From: Cris Di Sclafani Date: Tue, 3 Nov 2020 08:31:08 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.6 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=a81c110784e8da51f7f841e16cd3e3df5d9c781e;p=motion2.git Built motion from commit (unavailable).|2.5.6 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index c9c9172..9abd22b 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.6", "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-11-03T07:39:21.255Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); +define({ "name": "xCALLY Motion API", "version": "2.5.6", "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-11-03T08:22:42.747Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 85f21d4..dac3e06 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.5.6", "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-11-03T07:39:21.255Z", "url": "http://apidocjs.com", "version": "0.19.0" } } +{ "name": "xCALLY Motion API", "version": "2.5.6", "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-11-03T08:22:42.747Z", "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 af4ac36..7143afc 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 _0x0458=['integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','sequelize','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','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)]'];(function(_0x3b534c,_0x2c614f){var _0x449ef9=function(_0x285279){while(--_0x285279){_0x3b534c['push'](_0x3b534c['shift']());}};_0x449ef9(++_0x2c614f);}(_0x0458,0x11e));var _0x8045=function(_0x575b2c,_0x3f5e46){_0x575b2c=_0x575b2c-0x0;var _0x252693=_0x0458[_0x575b2c];return _0x252693;};'use strict';var Sequelize=require(_0x8045('0x0'));module['exports']={'name':{'type':Sequelize[_0x8045('0x1')],'get':function(_0x174fc9){return this[_0x8045('0x2')](_0x8045('0x3'));}},'action':{'type':Sequelize[_0x8045('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x8045('0x5'),_0x8045('0x6'),_0x8045('0x7'),_0x8045('0x8'),_0x8045('0x9'),_0x8045('0xa'),_0x8045('0xb'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x8045('0xc')},'data1':{'type':Sequelize[_0x8045('0x4')](0x1000),'comment':_0x8045('0xd')},'data2':{'type':Sequelize[_0x8045('0x4')](0x1000),'comment':_0x8045('0xe')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0x8045('0x4')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x8045('0x4')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5c69=['STRING','contactManager','integration','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','getDataValue','action'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x5c69,0x93));var _0x95c6=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x5c69[_0x75f869];return _0x10af8b;};'use strict';var Sequelize=require(_0x95c6('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x55bf77){return this[_0x95c6('0x1')](_0x95c6('0x2'));}},'action':{'type':Sequelize[_0x95c6('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x95c6('0x4'),_0x95c6('0x5'),'motionbar',_0x95c6('0x6'),_0x95c6('0x7'),_0x95c6('0x8'),_0x95c6('0x9'),_0x95c6('0xa')]],'msg':_0x95c6('0xb')}},'comment':_0x95c6('0xb')},'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['STRING'](0x1000),'comment':_0x95c6('0xc')},'data3':{'type':Sequelize[_0x95c6('0x3')](0x1000),'comment':_0x95c6('0xd')},'data4':{'type':Sequelize[_0x95c6('0x3')](0x1000)},'data5':{'type':Sequelize[_0x95c6('0x3')](0x1000)},'data6':{'type':Sequelize[_0x95c6('0x3')]},'data7':{'type':Sequelize[_0x95c6('0xe')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index f2c9e38..48a3ed1 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 _0x5e0e=['util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','error','stack','name','body','Action','find','params','catch','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x5e0e,0x89));var _0xe5e0=function(_0x36de10,_0xfe25e8){_0x36de10=_0x36de10-0x0;var _0x58100f=_0x5e0e[_0x36de10];return _0x58100f;};'use strict';var pdf=require(_0xe5e0('0x0'));var emlformat=require(_0xe5e0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe5e0('0x2'));var jsonpatch=require(_0xe5e0('0x3'));var rp=require(_0xe5e0('0x4'));var moment=require(_0xe5e0('0x5'));var BPromise=require(_0xe5e0('0x6'));var Mustache=require('mustache');var util=require(_0xe5e0('0x7'));var path=require('path');var sox=require(_0xe5e0('0x8'));var csv=require(_0xe5e0('0x9'));var ejs=require(_0xe5e0('0xa'));var fs=require('fs');var _=require(_0xe5e0('0xb'));var squel=require(_0xe5e0('0xc'));var crypto=require(_0xe5e0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe5e0('0xe'));var toCsv=require(_0xe5e0('0x9'));var querystring=require('querystring');var Papa=require(_0xe5e0('0xf'));var Redis=require(_0xe5e0('0x10'));var authService=require(_0xe5e0('0x11'));var qs=require(_0xe5e0('0x12'));var as=require(_0xe5e0('0x13'));var hardwareService=require(_0xe5e0('0x14'));var logger=require(_0xe5e0('0x15'))(_0xe5e0('0x16'));var utils=require(_0xe5e0('0x17'));var config=require(_0xe5e0('0x18'));var licenseUtil=require(_0xe5e0('0x19'));var db=require(_0xe5e0('0x1a'))['db'];function respondWithStatusCode(_0x25fd2,_0x529189){_0x529189=_0x529189||0xcc;return function(_0x5cabeb){if(_0x5cabeb){return _0x25fd2[_0xe5e0('0x1b')](_0x529189);}return _0x25fd2[_0xe5e0('0x1c')](_0x529189)[_0xe5e0('0x1d')]();};}function respondWithResult(_0x3baab3,_0x5e3a4d){_0x5e3a4d=_0x5e3a4d||0xc8;return function(_0x14043b){if(_0x14043b){return _0x3baab3[_0xe5e0('0x1c')](_0x5e3a4d)[_0xe5e0('0x1e')](_0x14043b);}};}function respondWithFilteredResult(_0x153860,_0x21db75){return function(_0x309b84){if(_0x309b84){var _0x1fe911=_0x309b84[_0xe5e0('0x1f')],_0x797dfd=_0x21db75['offset'],_0x2d381b=_0x21db75[_0xe5e0('0x20')]+_0x21db75['limit'],_0x501795;if(_0x2d381b>=_0x1fe911){_0x2d381b=_0x1fe911;_0x501795=0xc8;}else{_0x501795=0xce;}_0x153860[_0xe5e0('0x1c')](_0x501795);return _0x153860[_0xe5e0('0x21')]('Content-Range',_0x797dfd+'-'+_0x2d381b+'/'+_0x1fe911)[_0xe5e0('0x1e')](_0x309b84);}return null;};}function patchUpdates(_0x4a7ea4){return function(_0xa81bd4){try{jsonpatch[_0xe5e0('0x22')](_0xa81bd4,_0x4a7ea4,!![]);}catch(_0x3a2480){return BPromise[_0xe5e0('0x23')](_0x3a2480);}return _0xa81bd4[_0xe5e0('0x24')]();};}function saveUpdates(_0x10d6aa,_0x2b422d){return function(_0x1a491e){if(_0x1a491e){return _0x1a491e[_0xe5e0('0x25')](_0x10d6aa)[_0xe5e0('0x26')](function(_0x2f08dc){return _0x2f08dc;});}return null;};}function removeEntity(_0x2de764,_0x331ae1){return function(_0x4cd0ca){if(_0x4cd0ca){return _0x4cd0ca['destroy']()[_0xe5e0('0x26')](function(){_0x2de764[_0xe5e0('0x1c')](0xcc)[_0xe5e0('0x1d')]();});}};}function handleEntityNotFound(_0x62f2be,_0x3596ca){return function(_0x3227b2){if(!_0x3227b2){_0x62f2be[_0xe5e0('0x1b')](0x194);}return _0x3227b2;};}function handleError(_0x48071c,_0xf45724){_0xf45724=_0xf45724||0x1f4;return function(_0x5df2be){logger[_0xe5e0('0x27')](_0x5df2be[_0xe5e0('0x28')]);if(_0x5df2be[_0xe5e0('0x29')]){delete _0x5df2be[_0xe5e0('0x29')];}_0x48071c[_0xe5e0('0x1c')](_0xf45724)['send'](_0x5df2be);};}exports['update']=function(_0x25fe90,_0x4adf56){if(_0x25fe90[_0xe5e0('0x2a')]['id']){delete _0x25fe90[_0xe5e0('0x2a')]['id'];}return db[_0xe5e0('0x2b')][_0xe5e0('0x2c')]({'where':{'id':_0x25fe90[_0xe5e0('0x2d')]['id']}})[_0xe5e0('0x26')](handleEntityNotFound(_0x4adf56,null))['then'](saveUpdates(_0x25fe90[_0xe5e0('0x2a')],null))['then'](respondWithResult(_0x4adf56,null))[_0xe5e0('0x2e')](handleError(_0x4adf56,null));};exports[_0xe5e0('0x2f')]=function(_0x2bf557,_0x547e28){return db[_0xe5e0('0x2b')][_0xe5e0('0x2c')]({'where':{'id':_0x2bf557[_0xe5e0('0x2d')]['id']}})[_0xe5e0('0x26')](handleEntityNotFound(_0x547e28,null))[_0xe5e0('0x26')](removeEntity(_0x547e28,null))['catch'](handleError(_0x547e28,null));}; \ No newline at end of file +var _0x8ca9=['error','name','send','body','find','params','catch','destroy','Action','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','save','update','then','sendStatus'];(function(_0x5f2e30,_0x3c97c2){var _0x830c02=function(_0xf08d9f){while(--_0xf08d9f){_0x5f2e30['push'](_0x5f2e30['shift']());}};_0x830c02(++_0x3c97c2);}(_0x8ca9,0x9c));var _0x98ca=function(_0x2ab54b,_0x38d11e){_0x2ab54b=_0x2ab54b-0x0;var _0x43db33=_0x8ca9[_0x2ab54b];return _0x43db33;};'use strict';var pdf=require(_0x98ca('0x0'));var emlformat=require(_0x98ca('0x1'));var rimraf=require(_0x98ca('0x2'));var zipdir=require(_0x98ca('0x3'));var jsonpatch=require(_0x98ca('0x4'));var rp=require(_0x98ca('0x5'));var moment=require(_0x98ca('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x98ca('0x7'));var path=require('path');var sox=require(_0x98ca('0x8'));var csv=require('to-csv');var ejs=require(_0x98ca('0x9'));var fs=require('fs');var _=require(_0x98ca('0xa'));var squel=require(_0x98ca('0xb'));var crypto=require(_0x98ca('0xc'));var jsforce=require(_0x98ca('0xd'));var deskjs=require(_0x98ca('0xe'));var toCsv=require(_0x98ca('0xf'));var querystring=require(_0x98ca('0x10'));var Papa=require(_0x98ca('0x11'));var Redis=require(_0x98ca('0x12'));var authService=require(_0x98ca('0x13'));var qs=require(_0x98ca('0x14'));var as=require(_0x98ca('0x15'));var hardwareService=require(_0x98ca('0x16'));var logger=require(_0x98ca('0x17'))(_0x98ca('0x18'));var utils=require(_0x98ca('0x19'));var config=require(_0x98ca('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x98ca('0x1b'))['db'];function respondWithStatusCode(_0x44b65b,_0xba3887){_0xba3887=_0xba3887||0xcc;return function(_0x472e13){if(_0x472e13){return _0x44b65b['sendStatus'](_0xba3887);}return _0x44b65b[_0x98ca('0x1c')](_0xba3887)[_0x98ca('0x1d')]();};}function respondWithResult(_0x9a230e,_0xa2bab4){_0xa2bab4=_0xa2bab4||0xc8;return function(_0x3df0ef){if(_0x3df0ef){return _0x9a230e[_0x98ca('0x1c')](_0xa2bab4)[_0x98ca('0x1e')](_0x3df0ef);}};}function respondWithFilteredResult(_0x4940ca,_0x330713){return function(_0x29df1b){if(_0x29df1b){var _0x29f46b=_0x29df1b[_0x98ca('0x1f')],_0x398171=_0x330713[_0x98ca('0x20')],_0x52e9c8=_0x330713[_0x98ca('0x20')]+_0x330713[_0x98ca('0x21')],_0x238c1a;if(_0x52e9c8>=_0x29f46b){_0x52e9c8=_0x29f46b;_0x238c1a=0xc8;}else{_0x238c1a=0xce;}_0x4940ca[_0x98ca('0x1c')](_0x238c1a);return _0x4940ca[_0x98ca('0x22')](_0x98ca('0x23'),_0x398171+'-'+_0x52e9c8+'/'+_0x29f46b)[_0x98ca('0x1e')](_0x29df1b);}return null;};}function patchUpdates(_0x110f9f){return function(_0x1b2c69){try{jsonpatch['apply'](_0x1b2c69,_0x110f9f,!![]);}catch(_0x626b37){return BPromise['reject'](_0x626b37);}return _0x1b2c69[_0x98ca('0x24')]();};}function saveUpdates(_0x2fe568,_0x50f8b4){return function(_0x5ca905){if(_0x5ca905){return _0x5ca905[_0x98ca('0x25')](_0x2fe568)[_0x98ca('0x26')](function(_0x130544){return _0x130544;});}return null;};}function removeEntity(_0x519927,_0x2f7742){return function(_0xc23332){if(_0xc23332){return _0xc23332['destroy']()[_0x98ca('0x26')](function(){_0x519927['status'](0xcc)[_0x98ca('0x1d')]();});}};}function handleEntityNotFound(_0x323cdb,_0x430d16){return function(_0x3ec01d){if(!_0x3ec01d){_0x323cdb[_0x98ca('0x27')](0x194);}return _0x3ec01d;};}function handleError(_0xe5091e,_0x2a59e3){_0x2a59e3=_0x2a59e3||0x1f4;return function(_0x50b1a2){logger[_0x98ca('0x28')](_0x50b1a2['stack']);if(_0x50b1a2[_0x98ca('0x29')]){delete _0x50b1a2[_0x98ca('0x29')];}_0xe5091e['status'](_0x2a59e3)[_0x98ca('0x2a')](_0x50b1a2);};}exports['update']=function(_0x214649,_0x4f48db){if(_0x214649['body']['id']){delete _0x214649[_0x98ca('0x2b')]['id'];}return db['Action'][_0x98ca('0x2c')]({'where':{'id':_0x214649[_0x98ca('0x2d')]['id']}})[_0x98ca('0x26')](handleEntityNotFound(_0x4f48db,null))[_0x98ca('0x26')](saveUpdates(_0x214649[_0x98ca('0x2b')],null))[_0x98ca('0x26')](respondWithResult(_0x4f48db,null))[_0x98ca('0x2e')](handleError(_0x4f48db,null));};exports[_0x98ca('0x2f')]=function(_0x447881,_0x4f2406){return db[_0x98ca('0x30')]['find']({'where':{'id':_0x447881[_0x98ca('0x2d')]['id']}})[_0x98ca('0x26')](handleEntityNotFound(_0x4f2406,null))['then'](removeEntity(_0x4f2406,null))['catch'](handleError(_0x4f2406,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 2e92a9e..80fc56c 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 _0x8fc0=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./action.attributes','tools_actions'];(function(_0x3ed971,_0x2ec534){var _0x2dcfa5=function(_0x49e161){while(--_0x49e161){_0x3ed971['push'](_0x3ed971['shift']());}};_0x2dcfa5(++_0x2ec534);}(_0x8fc0,0x96));var _0x08fc=function(_0x271060,_0x3f86b1){_0x271060=_0x271060-0x0;var _0x40540b=_0x8fc0[_0x271060];return _0x40540b;};'use strict';var _=require(_0x08fc('0x0'));var util=require(_0x08fc('0x1'));var logger=require(_0x08fc('0x2'))(_0x08fc('0x3'));var moment=require(_0x08fc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x08fc('0x5'));var rimraf=require(_0x08fc('0x6'));var config=require(_0x08fc('0x7'));var attributes=require(_0x08fc('0x8'));module['exports']=function(_0x36f21a,_0x28a136){return _0x36f21a['define']('Action',attributes,{'tableName':_0x08fc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b7e=['Action','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','define'];(function(_0x16a6f2,_0x586adb){var _0x448dfc=function(_0x47f8c6){while(--_0x47f8c6){_0x16a6f2['push'](_0x16a6f2['shift']());}};_0x448dfc(++_0x586adb);}(_0x2b7e,0x11f));var _0xe2b7=function(_0x69a13c,_0xd77082){_0x69a13c=_0x69a13c-0x0;var _0xe77c83=_0x2b7e[_0x69a13c];return _0xe77c83;};'use strict';var _=require(_0xe2b7('0x0'));var util=require('util');var logger=require(_0xe2b7('0x1'))('api');var moment=require(_0xe2b7('0x2'));var BPromise=require(_0xe2b7('0x3'));var rp=require(_0xe2b7('0x4'));var fs=require('fs');var path=require(_0xe2b7('0x5'));var rimraf=require(_0xe2b7('0x6'));var config=require(_0xe2b7('0x7'));var attributes=require(_0xe2b7('0x8'));module['exports']=function(_0x5e9bda,_0x4af12f){return _0x5e9bda[_0xe2b7('0x9')](_0xe2b7('0xa'),attributes,{'tableName':'tools_actions','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 1fad99b..a9f024d 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1edf17,_0xb80e6){var _0x52c422=function(_0x13a2bb){while(--_0x13a2bb){_0x1edf17['push'](_0x1edf17['shift']());}};_0x52c422(++_0xb80e6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\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(_0x3732b2,_0x14450b){var _0x1ffa7a=function(_0x2ebeab){while(--_0x2ebeab){_0x3732b2['push'](_0x3732b2['shift']());}};_0x1ffa7a(++_0x14450b);}(_0xe706,0xa3));var _0x6e70=function(_0x54ba5b,_0x5b7508){_0x54ba5b=_0x54ba5b-0x0;var _0x5e16ac=_0xe706[_0x54ba5b];return _0x5e16ac;};'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']('Action,\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']('Action,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index ecb1132..1432c01 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 _0xd44b=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','destroy'];(function(_0x2c6c98,_0x240d40){var _0x21bdb4=function(_0x406360){while(--_0x406360){_0x2c6c98['push'](_0x2c6c98['shift']());}};_0x21bdb4(++_0x240d40);}(_0xd44b,0x76));var _0xbd44=function(_0x3db58f,_0x31f47d){_0x3db58f=_0x3db58f-0x0;var _0x3e6aa5=_0xd44b[_0x3db58f];return _0x3e6aa5;};'use strict';var multer=require(_0xbd44('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbd44('0x1'));var express=require(_0xbd44('0x2'));var router=express[_0xbd44('0x3')]();var auth=require(_0xbd44('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbd44('0x5'));var controller=require(_0xbd44('0x6'));router[_0xbd44('0x7')](_0xbd44('0x8'),auth[_0xbd44('0x9')](),controller[_0xbd44('0xa')]);router['delete'](_0xbd44('0x8'),auth['isAuthenticated'](),controller[_0xbd44('0xb')]);module[_0xbd44('0xc')]=router; \ No newline at end of file +var _0xdf78=['put','isAuthenticated','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xdf78,0x1b8));var _0x8df7=function(_0x3cd926,_0x524d08){_0x3cd926=_0x3cd926-0x0;var _0x2a4863=_0xdf78[_0x3cd926];return _0x2a4863;};'use strict';var multer=require(_0x8df7('0x0'));var util=require(_0x8df7('0x1'));var path=require(_0x8df7('0x2'));var timeout=require(_0x8df7('0x3'));var express=require(_0x8df7('0x4'));var router=express[_0x8df7('0x5')]();var auth=require(_0x8df7('0x6'));var interaction=require(_0x8df7('0x7'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0x8df7('0x8')]('/:id',auth[_0x8df7('0x9')](),controller['update']);router[_0x8df7('0xa')](_0x8df7('0xb'),auth[_0x8df7('0x9')](),controller[_0x8df7('0xc')]);module[_0x8df7('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 285275f..c4c3c7f 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 _0x1c8a=['STRING','TEXT','sequelize'];(function(_0x1911cd,_0x62b517){var _0x16cf31=function(_0x1285be){while(--_0x1285be){_0x1911cd['push'](_0x1911cd['shift']());}};_0x16cf31(++_0x62b517);}(_0x1c8a,0x74));var _0xa1c8=function(_0x3826ec,_0x5a474f){_0x3826ec=_0x3826ec-0x0;var _0x3e9096=_0x1c8a[_0x3826ec];return _0x3e9096;};'use strict';var Sequelize=require(_0xa1c8('0x0'));module['exports']={'name':{'type':Sequelize[_0xa1c8('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xa1c8('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xa1c8('0x2')]}}; \ No newline at end of file +var _0xbbae=['TEXT','exports','STRING'];(function(_0x4b22e2,_0x38fc50){var _0xa1a079=function(_0x337115){while(--_0x337115){_0x4b22e2['push'](_0x4b22e2['shift']());}};_0xa1a079(++_0x38fc50);}(_0xbbae,0x76));var _0xebba=function(_0x5a65e9,_0x5caf5d){_0x5a65e9=_0x5a65e9-0x0;var _0x95de87=_0xbbae[_0x5a65e9];return _0x95de87;};'use strict';var Sequelize=require('sequelize');module[_0xebba('0x0')]={'name':{'type':Sequelize[_0xebba('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xebba('0x1')]},'parent':{'type':Sequelize[_0xebba('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xebba('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index ae582cc..629261e 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 _0xb7e7=['name','index','map','AnalyticCustomReport','rawAttributes','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','filtears','intersection','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','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\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','DESC','alias','joins','parse','foreignTable','parentKey','foreignKey','conditions','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','ROUND(%s)','Sequelize','AnalyticMetric','%s.%s\x20=\x20%s.%s','toString','No\x20available\x20data','output','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','IS\x20NOT\x20NULL','clone','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','CustomReports','UserProfileResource','end'];(function(_0x2b0b70,_0x20f627){var _0x1712d9=function(_0x5e24cd){while(--_0x5e24cd){_0x2b0b70['push'](_0x2b0b70['shift']());}};_0x1712d9(++_0x20f627);}(_0xb7e7,0x121));var _0x7b7e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xb7e7[_0x43d11d];return _0x38cd08;};'use strict';var pdf=require(_0x7b7e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7b7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b7e('0x2'));var rp=require('request-promise');var moment=require(_0x7b7e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7b7e('0x4'));var util=require(_0x7b7e('0x5'));var path=require(_0x7b7e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b7e('0x7'));var fs=require('fs');var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var licenseUtil=require(_0x7b7e('0x17'));var db=require(_0x7b7e('0x18'))['db'];var dbH=require(_0x7b7e('0x18'))['dbH'];function respondWithStatusCode(_0x267446,_0x430eab){_0x430eab=_0x430eab||0xcc;return function(_0x50d7d2){if(_0x50d7d2){return _0x267446[_0x7b7e('0x19')](_0x430eab);}return _0x267446['status'](_0x430eab)['end']();};}function respondWithResult(_0x2889ed,_0xd304f5){_0xd304f5=_0xd304f5||0xc8;return function(_0xf067da){if(_0xf067da){return _0x2889ed[_0x7b7e('0x1a')](_0xd304f5)[_0x7b7e('0x1b')](_0xf067da);}};}function respondWithFilteredResult(_0x5703fd,_0x51baf6){return function(_0xc7f087){if(_0xc7f087){var _0x36444d=_0xc7f087[_0x7b7e('0x1c')],_0x27f999=_0x51baf6[_0x7b7e('0x1d')],_0x26aaec=_0x51baf6[_0x7b7e('0x1d')]+_0x51baf6[_0x7b7e('0x1e')],_0x2cc400;if(_0x26aaec>=_0x36444d){_0x26aaec=_0x36444d;_0x2cc400=0xc8;}else{_0x2cc400=0xce;}_0x5703fd[_0x7b7e('0x1a')](_0x2cc400);return _0x5703fd[_0x7b7e('0x1f')](_0x7b7e('0x20'),_0x27f999+'-'+_0x26aaec+'/'+_0x36444d)[_0x7b7e('0x1b')](_0xc7f087);}return null;};}function patchUpdates(_0x3bec7d){return function(_0x9776c3){try{jsonpatch[_0x7b7e('0x21')](_0x9776c3,_0x3bec7d,!![]);}catch(_0x3a7b8b){return BPromise['reject'](_0x3a7b8b);}return _0x9776c3[_0x7b7e('0x22')]();};}function saveUpdates(_0x43db4f,_0x24718c){return function(_0x4c0647){if(_0x4c0647){return _0x4c0647[_0x7b7e('0x23')](_0x43db4f)[_0x7b7e('0x24')](function(_0x14243b){return _0x14243b;});}return null;};}function removeEntity(_0x200156,_0x2b7211){return function(_0x303d8c){if(_0x303d8c){return _0x303d8c[_0x7b7e('0x25')]()[_0x7b7e('0x24')](function(){var _0x53bbb3=_0x303d8c['get']({'plain':!![]});var _0x4a836a=_0x7b7e('0x26');return db[_0x7b7e('0x27')][_0x7b7e('0x25')]({'where':{'type':_0x4a836a,'resourceId':_0x53bbb3['id']}})['then'](function(){return _0x303d8c;});})['then'](function(){_0x200156['status'](0xcc)[_0x7b7e('0x28')]();});}};}function handleEntityNotFound(_0x3c8192,_0x16a3c7){return function(_0x7aa71){if(!_0x7aa71){_0x3c8192[_0x7b7e('0x19')](0x194);}return _0x7aa71;};}function handleError(_0x48fad1,_0x6a1e71){_0x6a1e71=_0x6a1e71||0x1f4;return function(_0x21a15){logger['error'](_0x21a15['stack']);if(_0x21a15['name']){delete _0x21a15[_0x7b7e('0x29')];}_0x48fad1[_0x7b7e('0x1a')](_0x6a1e71)['send'](_0x21a15);};}exports[_0x7b7e('0x2a')]=function(_0x51d4b5,_0x1b4341){var _0xb9b6bf={},_0x27b525={},_0x5515ca={'count':0x0,'rows':[]};var _0x3960b8=_[_0x7b7e('0x2b')](db[_0x7b7e('0x2c')][_0x7b7e('0x2d')],function(_0x33f9a1){return{'name':_0x33f9a1['fieldName'],'type':_0x33f9a1[_0x7b7e('0x2e')]['key']};});_0x27b525[_0x7b7e('0x2f')]=_[_0x7b7e('0x2b')](_0x3960b8,_0x7b7e('0x29'));_0x27b525[_0x7b7e('0x30')]=_[_0x7b7e('0x31')](_0x51d4b5[_0x7b7e('0x30')]);_0x27b525[_0x7b7e('0x32')]=_['intersection'](_0x27b525['model'],_0x27b525[_0x7b7e('0x30')]);_0xb9b6bf[_0x7b7e('0x33')]=_['intersection'](_0x27b525[_0x7b7e('0x2f')],qs[_0x7b7e('0x34')](_0x51d4b5[_0x7b7e('0x30')]['fields']));_0xb9b6bf[_0x7b7e('0x33')]=_0xb9b6bf[_0x7b7e('0x33')][_0x7b7e('0x35')]?_0xb9b6bf[_0x7b7e('0x33')]:_0x27b525[_0x7b7e('0x2f')];if(!_0x51d4b5[_0x7b7e('0x30')][_0x7b7e('0x36')](_0x7b7e('0x37'))){_0xb9b6bf[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x51d4b5[_0x7b7e('0x30')][_0x7b7e('0x1e')]);_0xb9b6bf[_0x7b7e('0x1d')]=qs[_0x7b7e('0x1d')](_0x51d4b5[_0x7b7e('0x30')][_0x7b7e('0x1d')]);}_0xb9b6bf['order']=qs[_0x7b7e('0x38')](_0x51d4b5[_0x7b7e('0x30')][_0x7b7e('0x38')]);_0xb9b6bf[_0x7b7e('0x39')]=qs[_0x7b7e('0x32')](_[_0x7b7e('0x3a')](_0x51d4b5[_0x7b7e('0x30')],_0x27b525[_0x7b7e('0x32')]),_0x3960b8);if(_0x51d4b5[_0x7b7e('0x30')][_0x7b7e('0x3b')]){_0xb9b6bf['where']=_[_0x7b7e('0x3c')](_0xb9b6bf[_0x7b7e('0x39')],{'$or':_[_0x7b7e('0x2b')](_0x3960b8,function(_0x1d43da){if(_0x1d43da['type']!==_0x7b7e('0x3d')){var _0x35b31a={};_0x35b31a[_0x1d43da[_0x7b7e('0x29')]]={'$like':'%'+_0x51d4b5['query']['filter']+'%'};return _0x35b31a;}})});}_0xb9b6bf=_[_0x7b7e('0x3c')]({},_0xb9b6bf,_0x51d4b5['options']);var _0x35382c={'where':_0xb9b6bf[_0x7b7e('0x39')]};return db['AnalyticCustomReport'][_0x7b7e('0x1c')](_0x35382c)[_0x7b7e('0x24')](function(_0x2a6f4d){_0x5515ca[_0x7b7e('0x1c')]=_0x2a6f4d;if(_0x51d4b5[_0x7b7e('0x30')][_0x7b7e('0x3e')]){_0xb9b6bf[_0x7b7e('0x3f')]=[{'all':!![]}];}return db[_0x7b7e('0x2c')][_0x7b7e('0x40')](_0xb9b6bf);})['then'](function(_0x5d61c1){_0x5515ca[_0x7b7e('0x41')]=_0x5d61c1;return _0x5515ca;})['then'](respondWithFilteredResult(_0x1b4341,_0xb9b6bf))[_0x7b7e('0x42')](handleError(_0x1b4341,null));};exports['show']=function(_0x48dd74,_0x356db0){var _0x48252a={'raw':![],'where':{'id':_0x48dd74['params']['id']}},_0x2f9982={};_0x2f9982[_0x7b7e('0x2f')]=_[_0x7b7e('0x31')](db[_0x7b7e('0x2c')][_0x7b7e('0x2d')]);_0x2f9982['query']=_[_0x7b7e('0x31')](_0x48dd74[_0x7b7e('0x30')]);_0x2f9982[_0x7b7e('0x43')]=_[_0x7b7e('0x44')](_0x2f9982[_0x7b7e('0x2f')],_0x2f9982[_0x7b7e('0x30')]);_0x48252a['attributes']=_['intersection'](_0x2f9982['model'],qs[_0x7b7e('0x34')](_0x48dd74[_0x7b7e('0x30')][_0x7b7e('0x34')]));_0x48252a[_0x7b7e('0x33')]=_0x48252a[_0x7b7e('0x33')][_0x7b7e('0x35')]?_0x48252a['attributes']:_0x2f9982[_0x7b7e('0x2f')];if(_0x48dd74[_0x7b7e('0x30')]['includeAll']){_0x48252a['include']=[{'all':!![]}];}_0x48252a=_[_0x7b7e('0x3c')]({},_0x48252a,_0x48dd74[_0x7b7e('0x45')]);return db[_0x7b7e('0x2c')][_0x7b7e('0x46')](_0x48252a)[_0x7b7e('0x24')](handleEntityNotFound(_0x356db0,null))[_0x7b7e('0x24')](respondWithResult(_0x356db0,null))['catch'](handleError(_0x356db0,null));};exports[_0x7b7e('0x47')]=function(_0x4cc7db,_0x402793){return db[_0x7b7e('0x2c')][_0x7b7e('0x47')](_0x4cc7db[_0x7b7e('0x48')],{})['then'](function(_0x3b649e){var _0x1010b3=_0x4cc7db[_0x7b7e('0x49')][_0x7b7e('0x4a')]({'plain':!![]});if(!_0x1010b3)throw new Error(_0x7b7e('0x4b'));if(_0x1010b3['role']===_0x7b7e('0x49')){var _0x270c4a=_0x3b649e[_0x7b7e('0x4a')]({'plain':!![]});var _0xcb5186=_0x7b7e('0x4c');return db['UserProfileSection'][_0x7b7e('0x46')]({'where':{'name':_0xcb5186,'userProfileId':_0x1010b3[_0x7b7e('0x4d')]},'raw':!![]})[_0x7b7e('0x24')](function(_0x3280fa){if(_0x3280fa&&_0x3280fa[_0x7b7e('0x4e')]===0x0){return db[_0x7b7e('0x27')][_0x7b7e('0x47')]({'name':_0x270c4a['name'],'resourceId':_0x270c4a['id'],'type':_0x7b7e('0x26'),'sectionId':_0x3280fa['id']},{})['then'](function(){return _0x3b649e;});}else{return _0x3b649e;}})[_0x7b7e('0x42')](function(_0x766a54){logger['error'](_0x7b7e('0x4f'),_0x766a54);throw _0x766a54;});}return _0x3b649e;})[_0x7b7e('0x24')](respondWithResult(_0x402793,0xc9))[_0x7b7e('0x42')](handleError(_0x402793,null));};exports[_0x7b7e('0x23')]=function(_0x412d1b,_0x36ffd4){if(_0x412d1b[_0x7b7e('0x48')]['id']){delete _0x412d1b['body']['id'];}return db[_0x7b7e('0x2c')][_0x7b7e('0x46')]({'where':{'id':_0x412d1b[_0x7b7e('0x50')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x36ffd4,null))['then'](saveUpdates(_0x412d1b['body'],null))['then'](respondWithResult(_0x36ffd4,null))[_0x7b7e('0x42')](handleError(_0x36ffd4,null));};exports[_0x7b7e('0x25')]=function(_0x26d52f,_0x4aa92e){return db['AnalyticCustomReport'][_0x7b7e('0x46')]({'where':{'id':_0x26d52f[_0x7b7e('0x50')]['id']}})['then'](handleEntityNotFound(_0x4aa92e,null))[_0x7b7e('0x24')](removeEntity(_0x4aa92e,null))[_0x7b7e('0x42')](handleError(_0x4aa92e,null));};exports[_0x7b7e('0x51')]=function(_0x56ea8a,_0x2b0657){var _0x1d9af5=0xa;var _0x4d9a71=[_0x7b7e('0x52'),_0x7b7e('0x53'),_0x7b7e('0x54'),_0x7b7e('0x55')];var _0x41e78f={'SUM':_0x7b7e('0x56'),'COUNT':_0x7b7e('0x57'),'COUNT DISTINCT':_0x7b7e('0x58'),'MAX':_0x7b7e('0x59'),'MIN':'MIN(%s)','AVG':_0x7b7e('0x5a'),'GROUP_CONCAT':_0x7b7e('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7b7e('0x5c')};var _0xa22edc={'SEC_TO_TIME':_0x7b7e('0x5d'),'DATE':'DATE(%s)','HOUR':_0x7b7e('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7b7e('0x5f')};var _0x206ee7=function(_0x51aa97){return!_[_0x7b7e('0x60')]([_0x7b7e('0x61'),'IS\x20NOT\x20NULL',_0x7b7e('0x62'),_0x7b7e('0x63')],_0x51aa97);};var _0x1d43af=function(_0x3b1adb){if(!_0x3b1adb||!_0x3b1adb['rules'][_0x7b7e('0x35')]){return'';}for(var _0x73904d='(',_0x2e11b1=0x0;_0x2e11b1<_0x3b1adb[_0x7b7e('0x64')][_0x7b7e('0x35')];_0x2e11b1+=0x1){_0x2e11b1>0x0&&(_0x73904d+='\x20'+_0x3b1adb[_0x7b7e('0x65')]+'\x20');_0x73904d+=_0x3b1adb[_0x7b7e('0x64')][_0x2e11b1][_0x7b7e('0x66')]?_0x1d43af(_0x3b1adb[_0x7b7e('0x64')][_0x2e11b1][_0x7b7e('0x66')]):_0x3b1adb['rules'][_0x2e11b1][_0x7b7e('0x67')]+'\x20'+_0x3b1adb['rules'][_0x2e11b1]['condition']+(_0x206ee7(_0x3b1adb[_0x7b7e('0x64')][_0x2e11b1][_0x7b7e('0x68')])?'\x20'+_0x3b1adb[_0x7b7e('0x64')][_0x2e11b1][_0x7b7e('0x69')]:'');}return _0x73904d+')';};var _0x5cd4ae={'where':{'id':_0x56ea8a[_0x7b7e('0x50')]['id']}},_0x275998,_0x45e714,_0x3f2825,_0x3d4b2d,_0x169540;_0x5cd4ae=_['merge']({},_0x5cd4ae,_0x56ea8a[_0x7b7e('0x45')]);return db['AnalyticCustomReport']['find'](_0x5cd4ae)[_0x7b7e('0x24')](function(_0x4ef741){if(_0x4ef741){_0x275998=_0x4ef741;return _0x4ef741[_0x7b7e('0x6a')]();}return null;})['then'](function(_0x3c3d29){if(_0x3c3d29){if(!_0x3c3d29[_0x7b7e('0x35')]){throw new db['Sequelize'][(_0x7b7e('0x6b'))](_0x7b7e('0x6c'),0x193);}_0x45e714=_0x3c3d29;return db['AnalyticMetric'][_0x7b7e('0x40')]({'raw':!![]});}return null;})[_0x7b7e('0x24')](function(_0x50184c){if(_0x50184c){_0x3f2825=_[_0x7b7e('0x6d')](_0x50184c,'id');var _0x36ea09;var _0x2147d9=squel[_0x7b7e('0x6e')]();_0x2147d9[_0x7b7e('0x6f')](_0x275998[_0x7b7e('0x70')]);for(var _0x17e5ba=0x0;_0x17e5ba<_0x45e714['length'];_0x17e5ba+=0x1){_0x36ea09=_0x45e714[_0x17e5ba]['MetricId']?_0x3f2825[_0x45e714[_0x17e5ba][_0x7b7e('0x71')]][_0x7b7e('0x72')]:_0x45e714[_0x17e5ba][_0x7b7e('0x67')];_0x36ea09=_0x45e714[_0x17e5ba][_0x7b7e('0x73')]?_[_0x7b7e('0x74')](_0x41e78f[_0x45e714[_0x17e5ba][_0x7b7e('0x73')]],'%s',_0x36ea09):_0x36ea09;_0x36ea09=_0x45e714[_0x17e5ba][_0x7b7e('0x75')]?_['replace'](_0xa22edc[_0x45e714[_0x17e5ba][_0x7b7e('0x75')]],'%s',_0x36ea09):_0x36ea09;if(_0x45e714[_0x17e5ba][_0x7b7e('0x76')]){_0x2147d9['group'](_0x36ea09);}_0x45e714[_0x17e5ba][_0x7b7e('0x77')]&&_0x2147d9[_0x7b7e('0x78')](_0x36ea09,_0x45e714[_0x17e5ba][_0x7b7e('0x77')]===_0x7b7e('0x79')?![]:!![]);_0x2147d9[_0x7b7e('0x67')](_0x36ea09,_0x45e714[_0x17e5ba][_0x7b7e('0x7a')]||_0x36ea09);}if(_0x275998[_0x7b7e('0x7b')]){_0x275998[_0x7b7e('0x7b')]=JSON[_0x7b7e('0x7c')](_0x275998[_0x7b7e('0x7b')]);for(var _0x81617c=0x0;_0x81617c<_0x275998['joins'][_0x7b7e('0x35')];_0x81617c+=0x1){if(_0x275998[_0x7b7e('0x7b')][_0x81617c][_0x7b7e('0x2e')]&&_[_0x7b7e('0x60')](_0x4d9a71,_0x275998[_0x7b7e('0x7b')][_0x81617c][_0x7b7e('0x2e')])&&_0x275998[_0x7b7e('0x7b')][_0x81617c]['parentKey']&&_0x275998[_0x7b7e('0x7b')][_0x81617c][_0x7b7e('0x7d')]&&_0x275998[_0x7b7e('0x7b')][_0x81617c]['foreignKey']){_0x2147d9[_0x275998[_0x7b7e('0x7b')][_0x81617c][_0x7b7e('0x2e')]](_0x275998[_0x7b7e('0x7b')][_0x81617c][_0x7b7e('0x7d')],null,util[_0x7b7e('0x75')]('%s.%s\x20=\x20%s.%s',_0x275998['table'],_0x275998['joins'][_0x81617c][_0x7b7e('0x7e')],_0x275998[_0x7b7e('0x7b')][_0x81617c][_0x7b7e('0x7d')],_0x275998['joins'][_0x81617c][_0x7b7e('0x7f')]));}}}if(_0x275998[_0x7b7e('0x80')]){_0x275998[_0x7b7e('0x80')]=JSON['parse'](_0x275998[_0x7b7e('0x80')]);_0x2147d9[_0x7b7e('0x39')](_0x1d43af(_0x275998[_0x7b7e('0x80')][_0x7b7e('0x66')]));}_0x169540=_0x2147d9['clone']();_0x2147d9[_0x7b7e('0x1e')](_0x1d9af5);_0x2147d9[_0x7b7e('0x1d')](0x0);logger[_0x7b7e('0x81')](_0x7b7e('0x82'),_0x2147d9['toString']());return db['sequelize'][_0x7b7e('0x30')](_0x2147d9['toString'](),{'type':db[_0x7b7e('0x83')][_0x7b7e('0x84')][_0x7b7e('0x85')]});}})[_0x7b7e('0x24')](respondWithResult(_0x2b0657,null))['catch'](handleError(_0x2b0657,null));};function runReport(_0x2f37aa,_0x236b59,_0x2e9cbc){var _0x2c9acb=_0x236b59[_0x7b7e('0x29')];var _0x443cfc=0xa;var _0x2d40f4=[_0x7b7e('0x52'),_0x7b7e('0x53'),_0x7b7e('0x54'),_0x7b7e('0x55')];var _0x31a353={'SUM':_0x7b7e('0x56'),'COUNT':_0x7b7e('0x57'),'COUNT DISTINCT':_0x7b7e('0x58'),'MAX':_0x7b7e('0x59'),'MIN':'MIN(%s)','AVG':_0x7b7e('0x5a'),'GROUP_CONCAT':_0x7b7e('0x5b'),'GROUP_CONCAT ASC':_0x7b7e('0x86'),'GROUP_CONCAT DESC':_0x7b7e('0x5c')};var _0x10c35e={'SEC_TO_TIME':_0x7b7e('0x5d'),'DATE':_0x7b7e('0x87'),'HOUR':'HOUR(%s)','ROUND':_0x7b7e('0x88'),'UNIX_TIMESTAMP':_0x7b7e('0x5f')};var _0x3d86d6=function(_0x3f8682){return!_[_0x7b7e('0x60')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x7b7e('0x62'),_0x7b7e('0x63')],_0x3f8682);};var _0x145564=function(_0x87d33a){if(!_0x87d33a||!_0x87d33a[_0x7b7e('0x64')][_0x7b7e('0x35')]){return'';}for(var _0x2c65b8='(',_0x27d180=0x0;_0x27d180<_0x87d33a[_0x7b7e('0x64')][_0x7b7e('0x35')];_0x27d180+=0x1){_0x27d180>0x0&&(_0x2c65b8+='\x20'+_0x87d33a['operator']+'\x20');_0x2c65b8+=_0x87d33a[_0x7b7e('0x64')][_0x27d180][_0x7b7e('0x66')]?_0x145564(_0x87d33a[_0x7b7e('0x64')][_0x27d180][_0x7b7e('0x66')]):_0x87d33a[_0x7b7e('0x64')][_0x27d180][_0x7b7e('0x67')]+'\x20'+_0x87d33a[_0x7b7e('0x64')][_0x27d180]['condition']+(_0x3d86d6(_0x87d33a[_0x7b7e('0x64')][_0x27d180]['condition'])?'\x20'+_0x87d33a[_0x7b7e('0x64')][_0x27d180][_0x7b7e('0x69')]:'');}return _0x2c65b8+')';};var _0x4981a9={'where':{'id':_0x2f37aa['id']}},_0x61424f,_0x38fd40,_0x28e81c,_0x3242e6,_0x3faf4c;_0x4981a9=_['merge']({},_0x4981a9,_0x2e9cbc);return db[_0x7b7e('0x2c')]['find'](_0x4981a9)['then'](function(_0x15cd98){if(_0x15cd98){_0x61424f=_0x15cd98;return _0x15cd98[_0x7b7e('0x6a')]();}return null;})[_0x7b7e('0x24')](function(_0x1d080b){if(_0x1d080b){if(!_0x1d080b['length']){throw new db[(_0x7b7e('0x89'))]['ValidationErrorItem'](_0x7b7e('0x6c'),0x193);}_0x38fd40=_0x1d080b;return db[_0x7b7e('0x8a')][_0x7b7e('0x40')]({'raw':!![]});}return null;})[_0x7b7e('0x24')](function(_0x11d615){if(_0x11d615){_0x28e81c=_[_0x7b7e('0x6d')](_0x11d615,'id');var _0xc48937;var _0x57c8d1=squel[_0x7b7e('0x6e')]();_0x57c8d1[_0x7b7e('0x6f')](_0x61424f['table']);for(var _0x87a287=0x0;_0x87a287<_0x38fd40[_0x7b7e('0x35')];_0x87a287+=0x1){_0xc48937=_0x38fd40[_0x87a287][_0x7b7e('0x71')]?_0x28e81c[_0x38fd40[_0x87a287][_0x7b7e('0x71')]][_0x7b7e('0x72')]:_0x38fd40[_0x87a287][_0x7b7e('0x67')];_0xc48937=_0x38fd40[_0x87a287][_0x7b7e('0x73')]?_[_0x7b7e('0x74')](_0x31a353[_0x38fd40[_0x87a287][_0x7b7e('0x73')]],'%s',_0xc48937):_0xc48937;_0xc48937=_0x38fd40[_0x87a287][_0x7b7e('0x75')]?_[_0x7b7e('0x74')](_0x10c35e[_0x38fd40[_0x87a287][_0x7b7e('0x75')]],'%s',_0xc48937):_0xc48937;if(_0x38fd40[_0x87a287][_0x7b7e('0x76')]){_0x57c8d1[_0x7b7e('0x66')](_0xc48937);}_0x38fd40[_0x87a287][_0x7b7e('0x77')]&&_0x57c8d1[_0x7b7e('0x78')](_0xc48937,_0x38fd40[_0x87a287][_0x7b7e('0x77')]===_0x7b7e('0x79')?![]:!![]);_0x57c8d1[_0x7b7e('0x67')](_0xc48937,_0x38fd40[_0x87a287][_0x7b7e('0x7a')]||_0xc48937);}if(_0x61424f[_0x7b7e('0x7b')]){_0x61424f[_0x7b7e('0x7b')]=JSON['parse'](_0x61424f[_0x7b7e('0x7b')]);for(var _0x97d43b=0x0;_0x97d43b<_0x61424f['joins'][_0x7b7e('0x35')];_0x97d43b+=0x1){if(_0x61424f['joins'][_0x97d43b]['type']&&_[_0x7b7e('0x60')](_0x2d40f4,_0x61424f['joins'][_0x97d43b]['type'])&&_0x61424f[_0x7b7e('0x7b')][_0x97d43b][_0x7b7e('0x7e')]&&_0x61424f[_0x7b7e('0x7b')][_0x97d43b]['foreignTable']&&_0x61424f[_0x7b7e('0x7b')][_0x97d43b][_0x7b7e('0x7f')]){_0x57c8d1[_0x61424f[_0x7b7e('0x7b')][_0x97d43b][_0x7b7e('0x2e')]](_0x61424f[_0x7b7e('0x7b')][_0x97d43b][_0x7b7e('0x7d')],null,util[_0x7b7e('0x75')](_0x7b7e('0x8b'),_0x61424f[_0x7b7e('0x70')],_0x61424f['joins'][_0x97d43b][_0x7b7e('0x7e')],_0x61424f[_0x7b7e('0x7b')][_0x97d43b][_0x7b7e('0x7d')],_0x61424f['joins'][_0x97d43b][_0x7b7e('0x7f')]));}}}if(_0x61424f[_0x7b7e('0x80')]){_0x61424f['conditions']=JSON[_0x7b7e('0x7c')](_0x61424f['conditions']);_0x57c8d1['where'](_0x145564(_0x61424f[_0x7b7e('0x80')][_0x7b7e('0x66')]));}_0x3faf4c=_0x57c8d1['clone']();_0x57c8d1[_0x7b7e('0x1e')](_0x443cfc);_0x57c8d1['offset'](0x0);logger['debug'](_0x7b7e('0x82'),_0x57c8d1[_0x7b7e('0x8c')]());return db[_0x7b7e('0x83')][_0x7b7e('0x30')](_0x57c8d1[_0x7b7e('0x8c')](),{'type':db[_0x7b7e('0x83')][_0x7b7e('0x84')][_0x7b7e('0x85')]});}})['then'](function(_0x3cd173){if(!_0x3cd173[_0x7b7e('0x35')]){throw new db[(_0x7b7e('0x89'))][(_0x7b7e('0x6b'))](_0x7b7e('0x8d'),0xcc);}if(_0x236b59[_0x7b7e('0x8e')]===_0x7b7e('0x8f')){return null;}var _0x25541b=_[_0x7b7e('0x3c')](_0x236b59,{'name':_0x236b59[_0x7b7e('0x90')]||_0x236b59[_0x7b7e('0x29')]||_0x61424f[_0x7b7e('0x29')],'basename':_0x2c9acb,'savename':util['format']('%s-%s.%s',_0x236b59[_0x7b7e('0x29')]||_0x61424f[_0x7b7e('0x29')],require(_0x7b7e('0x91'))[_0x7b7e('0x92')](0x4),_0x236b59[_0x7b7e('0x8e')]||_0x7b7e('0x93')),'reportId':_0x61424f['id'],'reportType':_0x7b7e('0x94')});return db[_0x7b7e('0x95')][_0x7b7e('0x47')](_0x25541b,{'raw':!![]});})[_0x7b7e('0x24')](function(_0x1dfd0d){if(_0x61424f[_0x7b7e('0x70')]==='cdr'){_0x3faf4c[_0x7b7e('0x39')](_0x61424f['table']+_0x7b7e('0x96'),_0x236b59[_0x7b7e('0x97')],_0x236b59[_0x7b7e('0x98')]);}else{_0x3faf4c['where'](_0x61424f['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x236b59[_0x7b7e('0x97')],_0x236b59[_0x7b7e('0x98')]);}if(_0x1dfd0d){logger[_0x7b7e('0x99')](_0x7b7e('0x9a'),_0x3faf4c[_0x7b7e('0x8c')]());require(_0x7b7e('0x9b'))[_0x7b7e('0x9c')](path[_0x7b7e('0x52')](__dirname,_0x7b7e('0x9d'),_0x1dfd0d[_0x7b7e('0x8e')]),[_0x1dfd0d['id'],_0x3faf4c[_0x7b7e('0x8c')](),path['join'](__dirname,_0x7b7e('0x9e'),_0x1dfd0d[_0x7b7e('0x9f')]),_0x2c9acb]);return _0x1dfd0d;}else{var _0xec24c7=squel[_0x7b7e('0x6e')]();_0xec24c7['from']('('+_0x3faf4c[_0x7b7e('0x8c')]()+')',_0x7b7e('0xa0'));_0xec24c7[_0x7b7e('0x67')](_0x7b7e('0xa1'),_0x7b7e('0x1c'));_0x3faf4c[_0x7b7e('0x1e')](_0x236b59[_0x7b7e('0x1e')]||_0x443cfc);_0x3faf4c[_0x7b7e('0x1d')](_0x236b59[_0x7b7e('0x1d')]||0x0);return dbH[_0x7b7e('0x83')][_0x7b7e('0x30')](_0xec24c7[_0x7b7e('0x8c')](),{'type':dbH[_0x7b7e('0x83')][_0x7b7e('0x84')][_0x7b7e('0x85')]})[_0x7b7e('0x24')](function(_0x33243c){if(!_0x33243c[_0x7b7e('0x35')]){_0x3242e6=0x0;}else{_0x3242e6=_0x33243c[0x0][_0x7b7e('0x1c')]||0x0;}return dbH[_0x7b7e('0x83')][_0x7b7e('0x30')](_0x3faf4c[_0x7b7e('0x8c')](),{'type':dbH[_0x7b7e('0x83')][_0x7b7e('0x84')][_0x7b7e('0x85')]});})[_0x7b7e('0x24')](function(_0x387eab){return{'rows':_0x387eab||[],'count':_0x3242e6};});}});}exports[_0x7b7e('0xa2')]=function(_0x4e02eb,_0xe59e60){return runReport(_0x4e02eb['params'],_0x4e02eb['query'],_0x4e02eb['options'])[_0x7b7e('0x24')](respondWithResult(_0xe59e60,null))[_0x7b7e('0x42')](handleError(_0xe59e60,null));};exports['runReport']=runReport;exports['query']=function(_0x2c59e1,_0x21d29a){var _0x3b1083=0xa;var _0x5b0abe=[_0x7b7e('0x52'),'left_join','right_join',_0x7b7e('0x55')];var _0x596ec1={'SUM':'SUM(%s)','COUNT':_0x7b7e('0x57'),'COUNT DISTINCT':_0x7b7e('0x58'),'MAX':_0x7b7e('0x59'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7b7e('0x5b'),'GROUP_CONCAT ASC':_0x7b7e('0x86'),'GROUP_CONCAT DESC':_0x7b7e('0x5c')};var _0x210ed3={'SEC_TO_TIME':_0x7b7e('0x5d'),'DATE':_0x7b7e('0x87'),'HOUR':_0x7b7e('0x5e'),'ROUND':_0x7b7e('0x88'),'UNIX_TIMESTAMP':_0x7b7e('0x5f')};var _0x5263e2=function(_0x200ee8){return!_['includes']([_0x7b7e('0x61'),_0x7b7e('0xa3'),_0x7b7e('0x62'),_0x7b7e('0x63')],_0x200ee8);};var _0xc8849f=function(_0x4dfe50){if(!_0x4dfe50||!_0x4dfe50[_0x7b7e('0x64')][_0x7b7e('0x35')]){return'';}for(var _0x2fc631='(',_0x31e4c6=0x0;_0x31e4c6<_0x4dfe50['rules'][_0x7b7e('0x35')];_0x31e4c6+=0x1){_0x31e4c6>0x0&&(_0x2fc631+='\x20'+_0x4dfe50[_0x7b7e('0x65')]+'\x20');_0x2fc631+=_0x4dfe50['rules'][_0x31e4c6][_0x7b7e('0x66')]?_0xc8849f(_0x4dfe50[_0x7b7e('0x64')][_0x31e4c6][_0x7b7e('0x66')]):_0x4dfe50[_0x7b7e('0x64')][_0x31e4c6][_0x7b7e('0x67')]+'\x20'+_0x4dfe50[_0x7b7e('0x64')][_0x31e4c6][_0x7b7e('0x68')]+(_0x5263e2(_0x4dfe50[_0x7b7e('0x64')][_0x31e4c6][_0x7b7e('0x68')])?'\x20'+_0x4dfe50[_0x7b7e('0x64')][_0x31e4c6][_0x7b7e('0x69')]:'');}return _0x2fc631+')';};var _0x4c33ff={'where':{'id':_0x2c59e1[_0x7b7e('0x50')]['id']}},_0x1e689b,_0x711f2f,_0x4a2237,_0x1e19be,_0x48641d;_0x4c33ff=_[_0x7b7e('0x3c')]({},_0x4c33ff,_0x2c59e1[_0x7b7e('0x45')]);return db['AnalyticCustomReport'][_0x7b7e('0x46')](_0x4c33ff)[_0x7b7e('0x24')](function(_0x474f1c){if(_0x474f1c){_0x1e689b=_0x474f1c;return _0x474f1c[_0x7b7e('0x6a')]();}return null;})[_0x7b7e('0x24')](function(_0x27785c){if(_0x27785c){if(!_0x27785c[_0x7b7e('0x35')]){throw new db[(_0x7b7e('0x89'))][(_0x7b7e('0x6b'))](_0x7b7e('0x6c'),0x193);}_0x711f2f=_0x27785c;return db['AnalyticMetric'][_0x7b7e('0x40')]({'raw':!![]});}return null;})[_0x7b7e('0x24')](function(_0x33710d){if(_0x33710d){_0x4a2237=_['keyBy'](_0x33710d,'id');var _0x4fc6a4;var _0xf6897f=squel['select']();_0xf6897f['from'](_0x1e689b[_0x7b7e('0x70')]);for(var _0x173308=0x0;_0x173308<_0x711f2f[_0x7b7e('0x35')];_0x173308+=0x1){_0x4fc6a4=_0x711f2f[_0x173308]['MetricId']?_0x4a2237[_0x711f2f[_0x173308][_0x7b7e('0x71')]][_0x7b7e('0x72')]:_0x711f2f[_0x173308][_0x7b7e('0x67')];_0x4fc6a4=_0x711f2f[_0x173308][_0x7b7e('0x73')]?_[_0x7b7e('0x74')](_0x596ec1[_0x711f2f[_0x173308]['function']],'%s',_0x4fc6a4):_0x4fc6a4;_0x4fc6a4=_0x711f2f[_0x173308][_0x7b7e('0x75')]?_[_0x7b7e('0x74')](_0x210ed3[_0x711f2f[_0x173308][_0x7b7e('0x75')]],'%s',_0x4fc6a4):_0x4fc6a4;if(_0x711f2f[_0x173308][_0x7b7e('0x76')]){_0xf6897f[_0x7b7e('0x66')](_0x4fc6a4);}_0x711f2f[_0x173308][_0x7b7e('0x77')]&&_0xf6897f['order'](_0x4fc6a4,_0x711f2f[_0x173308]['orderBy']===_0x7b7e('0x79')?![]:!![]);_0xf6897f['field'](_0x4fc6a4,_0x711f2f[_0x173308][_0x7b7e('0x7a')]||_0x4fc6a4);}if(_0x1e689b[_0x7b7e('0x7b')]){_0x1e689b[_0x7b7e('0x7b')]=JSON[_0x7b7e('0x7c')](_0x1e689b[_0x7b7e('0x7b')]);for(var _0x1da1ef=0x0;_0x1da1ef<_0x1e689b[_0x7b7e('0x7b')]['length'];_0x1da1ef+=0x1){if(_0x1e689b['joins'][_0x1da1ef][_0x7b7e('0x2e')]&&_[_0x7b7e('0x60')](_0x5b0abe,_0x1e689b['joins'][_0x1da1ef][_0x7b7e('0x2e')])&&_0x1e689b[_0x7b7e('0x7b')][_0x1da1ef]['parentKey']&&_0x1e689b['joins'][_0x1da1ef][_0x7b7e('0x7d')]&&_0x1e689b[_0x7b7e('0x7b')][_0x1da1ef][_0x7b7e('0x7f')]){_0xf6897f[_0x1e689b['joins'][_0x1da1ef][_0x7b7e('0x2e')]](_0x1e689b[_0x7b7e('0x7b')][_0x1da1ef][_0x7b7e('0x7d')],null,util[_0x7b7e('0x75')](_0x7b7e('0x8b'),_0x1e689b[_0x7b7e('0x70')],_0x1e689b[_0x7b7e('0x7b')][_0x1da1ef][_0x7b7e('0x7e')],_0x1e689b[_0x7b7e('0x7b')][_0x1da1ef][_0x7b7e('0x7d')],_0x1e689b['joins'][_0x1da1ef]['foreignKey']));}}}if(_0x1e689b['conditions']){_0x1e689b[_0x7b7e('0x80')]=JSON['parse'](_0x1e689b[_0x7b7e('0x80')]);_0xf6897f[_0x7b7e('0x39')](_0xc8849f(_0x1e689b[_0x7b7e('0x80')]['group']));}_0x48641d=_0xf6897f[_0x7b7e('0xa4')]();_0xf6897f[_0x7b7e('0x1e')](_0x3b1083);_0xf6897f[_0x7b7e('0x1d')](0x0);logger[_0x7b7e('0x81')](_0x7b7e('0x82'),_0xf6897f[_0x7b7e('0x8c')]());return db[_0x7b7e('0x83')]['query'](_0xf6897f['toString'](),{'type':db['sequelize'][_0x7b7e('0x84')][_0x7b7e('0x85')]});}})[_0x7b7e('0x24')](function(){return{'sql':_0x48641d[_0x7b7e('0x8c')]()};})[_0x7b7e('0x24')](respondWithResult(_0x21d29a,null))[_0x7b7e('0x42')](handleError(_0x21d29a,null));}; \ No newline at end of file +var _0xde2c=['name','send','map','AnalyticCustomReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','catch','show','params','keys','rawAttributes','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','UserProfileResource','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','AnalyticMetric','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','QueryTypes','SELECT','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','UNIX_TIMESTAMP(%s)','includes','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','No\x20available\x20data','output','web','fullPath','%s-%s.%s','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','COUNT(*)','run','runReport','COUNT(DISTINCT\x20%s)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','end','error','stack'];(function(_0x4aa276,_0x3eb85c){var _0x4867f3=function(_0x159ddd){while(--_0x159ddd){_0x4aa276['push'](_0x4aa276['shift']());}};_0x4867f3(++_0x3eb85c);}(_0xde2c,0x7f));var _0xcde2=function(_0x34d275,_0x5d84ee){_0x34d275=_0x34d275-0x0;var _0x1379cc=_0xde2c[_0x34d275];return _0x1379cc;};'use strict';var pdf=require(_0xcde2('0x0'));var emlformat=require(_0xcde2('0x1'));var rimraf=require(_0xcde2('0x2'));var zipdir=require(_0xcde2('0x3'));var jsonpatch=require(_0xcde2('0x4'));var rp=require(_0xcde2('0x5'));var moment=require(_0xcde2('0x6'));var BPromise=require(_0xcde2('0x7'));var Mustache=require('mustache');var util=require(_0xcde2('0x8'));var path=require(_0xcde2('0x9'));var sox=require(_0xcde2('0xa'));var csv=require(_0xcde2('0xb'));var ejs=require(_0xcde2('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcde2('0xd'));var crypto=require(_0xcde2('0xe'));var jsforce=require(_0xcde2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcde2('0x10'));var Papa=require(_0xcde2('0x11'));var Redis=require('ioredis');var authService=require(_0xcde2('0x12'));var qs=require(_0xcde2('0x13'));var as=require(_0xcde2('0x14'));var hardwareService=require(_0xcde2('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xcde2('0x16'));var config=require(_0xcde2('0x17'));var licenseUtil=require(_0xcde2('0x18'));var db=require(_0xcde2('0x19'))['db'];var dbH=require(_0xcde2('0x19'))[_0xcde2('0x1a')];function respondWithStatusCode(_0x599294,_0x211215){_0x211215=_0x211215||0xcc;return function(_0x577062){if(_0x577062){return _0x599294[_0xcde2('0x1b')](_0x211215);}return _0x599294['status'](_0x211215)['end']();};}function respondWithResult(_0x34e079,_0x1c7103){_0x1c7103=_0x1c7103||0xc8;return function(_0x417505){if(_0x417505){return _0x34e079[_0xcde2('0x1c')](_0x1c7103)[_0xcde2('0x1d')](_0x417505);}};}function respondWithFilteredResult(_0x5312c7,_0x39b023){return function(_0x4c558b){if(_0x4c558b){var _0x31b4a7=_0x4c558b['count'],_0x198840=_0x39b023['offset'],_0xbade43=_0x39b023['offset']+_0x39b023[_0xcde2('0x1e')],_0x1f1858;if(_0xbade43>=_0x31b4a7){_0xbade43=_0x31b4a7;_0x1f1858=0xc8;}else{_0x1f1858=0xce;}_0x5312c7['status'](_0x1f1858);return _0x5312c7[_0xcde2('0x1f')](_0xcde2('0x20'),_0x198840+'-'+_0xbade43+'/'+_0x31b4a7)[_0xcde2('0x1d')](_0x4c558b);}return null;};}function patchUpdates(_0x481fc0){return function(_0x3ea61c){try{jsonpatch[_0xcde2('0x21')](_0x3ea61c,_0x481fc0,!![]);}catch(_0x208368){return BPromise[_0xcde2('0x22')](_0x208368);}return _0x3ea61c[_0xcde2('0x23')]();};}function saveUpdates(_0x57210d,_0x4bce90){return function(_0x5a92b9){if(_0x5a92b9){return _0x5a92b9[_0xcde2('0x24')](_0x57210d)[_0xcde2('0x25')](function(_0x2c9562){return _0x2c9562;});}return null;};}function removeEntity(_0x4063d4,_0xc86374){return function(_0x5a7c5c){if(_0x5a7c5c){return _0x5a7c5c[_0xcde2('0x26')]()['then'](function(){var _0x280d8c=_0x5a7c5c[_0xcde2('0x27')]({'plain':!![]});var _0x26d18e='CustomReports';return db['UserProfileResource'][_0xcde2('0x26')]({'where':{'type':_0x26d18e,'resourceId':_0x280d8c['id']}})[_0xcde2('0x25')](function(){return _0x5a7c5c;});})[_0xcde2('0x25')](function(){_0x4063d4[_0xcde2('0x1c')](0xcc)[_0xcde2('0x28')]();});}};}function handleEntityNotFound(_0x5a5b92,_0x2d1d17){return function(_0x45275a){if(!_0x45275a){_0x5a5b92[_0xcde2('0x1b')](0x194);}return _0x45275a;};}function handleError(_0x513965,_0x2487eb){_0x2487eb=_0x2487eb||0x1f4;return function(_0x348ca1){logger[_0xcde2('0x29')](_0x348ca1[_0xcde2('0x2a')]);if(_0x348ca1[_0xcde2('0x2b')]){delete _0x348ca1[_0xcde2('0x2b')];}_0x513965[_0xcde2('0x1c')](_0x2487eb)[_0xcde2('0x2c')](_0x348ca1);};}exports['index']=function(_0x3c3c01,_0x4a0826){var _0x141072={},_0xb87851={},_0x43706c={'count':0x0,'rows':[]};var _0x49cb58=_[_0xcde2('0x2d')](db[_0xcde2('0x2e')]['rawAttributes'],function(_0x26ec42){return{'name':_0x26ec42[_0xcde2('0x2f')],'type':_0x26ec42[_0xcde2('0x30')][_0xcde2('0x31')]};});_0xb87851[_0xcde2('0x32')]=_[_0xcde2('0x2d')](_0x49cb58,_0xcde2('0x2b'));_0xb87851[_0xcde2('0x33')]=_['keys'](_0x3c3c01[_0xcde2('0x33')]);_0xb87851[_0xcde2('0x34')]=_[_0xcde2('0x35')](_0xb87851[_0xcde2('0x32')],_0xb87851['query']);_0x141072[_0xcde2('0x36')]=_[_0xcde2('0x35')](_0xb87851[_0xcde2('0x32')],qs[_0xcde2('0x37')](_0x3c3c01['query'][_0xcde2('0x37')]));_0x141072[_0xcde2('0x36')]=_0x141072[_0xcde2('0x36')][_0xcde2('0x38')]?_0x141072['attributes']:_0xb87851[_0xcde2('0x32')];if(!_0x3c3c01[_0xcde2('0x33')][_0xcde2('0x39')](_0xcde2('0x3a'))){_0x141072[_0xcde2('0x1e')]=qs['limit'](_0x3c3c01[_0xcde2('0x33')][_0xcde2('0x1e')]);_0x141072[_0xcde2('0x3b')]=qs[_0xcde2('0x3b')](_0x3c3c01['query']['offset']);}_0x141072[_0xcde2('0x3c')]=qs[_0xcde2('0x3d')](_0x3c3c01[_0xcde2('0x33')][_0xcde2('0x3d')]);_0x141072[_0xcde2('0x3e')]=qs[_0xcde2('0x34')](_[_0xcde2('0x3f')](_0x3c3c01[_0xcde2('0x33')],_0xb87851[_0xcde2('0x34')]),_0x49cb58);if(_0x3c3c01['query'][_0xcde2('0x40')]){_0x141072[_0xcde2('0x3e')]=_[_0xcde2('0x41')](_0x141072[_0xcde2('0x3e')],{'$or':_[_0xcde2('0x2d')](_0x49cb58,function(_0x47b6ee){if(_0x47b6ee['type']!==_0xcde2('0x42')){var _0xc8e8a4={};_0xc8e8a4[_0x47b6ee[_0xcde2('0x2b')]]={'$like':'%'+_0x3c3c01[_0xcde2('0x33')][_0xcde2('0x40')]+'%'};return _0xc8e8a4;}})});}_0x141072=_[_0xcde2('0x41')]({},_0x141072,_0x3c3c01['options']);var _0x4d6c73={'where':_0x141072['where']};return db[_0xcde2('0x2e')][_0xcde2('0x43')](_0x4d6c73)[_0xcde2('0x25')](function(_0x1d171c){_0x43706c[_0xcde2('0x43')]=_0x1d171c;if(_0x3c3c01[_0xcde2('0x33')][_0xcde2('0x44')]){_0x141072['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xcde2('0x45')](_0x141072);})['then'](function(_0x3d4cd6){_0x43706c['rows']=_0x3d4cd6;return _0x43706c;})[_0xcde2('0x25')](respondWithFilteredResult(_0x4a0826,_0x141072))[_0xcde2('0x46')](handleError(_0x4a0826,null));};exports[_0xcde2('0x47')]=function(_0x5ea9a9,_0x346322){var _0x5afeff={'raw':![],'where':{'id':_0x5ea9a9[_0xcde2('0x48')]['id']}},_0x889aef={};_0x889aef[_0xcde2('0x32')]=_[_0xcde2('0x49')](db[_0xcde2('0x2e')][_0xcde2('0x4a')]);_0x889aef['query']=_['keys'](_0x5ea9a9[_0xcde2('0x33')]);_0x889aef['filtears']=_['intersection'](_0x889aef[_0xcde2('0x32')],_0x889aef['query']);_0x5afeff[_0xcde2('0x36')]=_[_0xcde2('0x35')](_0x889aef['model'],qs[_0xcde2('0x37')](_0x5ea9a9['query']['fields']));_0x5afeff[_0xcde2('0x36')]=_0x5afeff[_0xcde2('0x36')]['length']?_0x5afeff[_0xcde2('0x36')]:_0x889aef['model'];if(_0x5ea9a9[_0xcde2('0x33')][_0xcde2('0x44')]){_0x5afeff[_0xcde2('0x4b')]=[{'all':!![]}];}_0x5afeff=_[_0xcde2('0x41')]({},_0x5afeff,_0x5ea9a9[_0xcde2('0x4c')]);return db['AnalyticCustomReport'][_0xcde2('0x4d')](_0x5afeff)[_0xcde2('0x25')](handleEntityNotFound(_0x346322,null))[_0xcde2('0x25')](respondWithResult(_0x346322,null))[_0xcde2('0x46')](handleError(_0x346322,null));};exports['create']=function(_0x58ded4,_0x465fdf){return db['AnalyticCustomReport'][_0xcde2('0x4e')](_0x58ded4[_0xcde2('0x4f')],{})[_0xcde2('0x25')](function(_0x16675f){var _0x1ce210=_0x58ded4[_0xcde2('0x50')]['get']({'plain':!![]});if(!_0x1ce210)throw new Error(_0xcde2('0x51'));if(_0x1ce210['role']===_0xcde2('0x50')){var _0x5d4969=_0x16675f[_0xcde2('0x27')]({'plain':!![]});var _0x1f3fd2=_0xcde2('0x52');return db[_0xcde2('0x53')][_0xcde2('0x4d')]({'where':{'name':_0x1f3fd2,'userProfileId':_0x1ce210[_0xcde2('0x54')]},'raw':!![]})['then'](function(_0x3adc5b){if(_0x3adc5b&&_0x3adc5b['autoAssociation']===0x0){return db[_0xcde2('0x55')][_0xcde2('0x4e')]({'name':_0x5d4969[_0xcde2('0x2b')],'resourceId':_0x5d4969['id'],'type':_0xcde2('0x56'),'sectionId':_0x3adc5b['id']},{})[_0xcde2('0x25')](function(){return _0x16675f;});}else{return _0x16675f;}})[_0xcde2('0x46')](function(_0x3a0760){logger[_0xcde2('0x29')](_0xcde2('0x57'),_0x3a0760);throw _0x3a0760;});}return _0x16675f;})[_0xcde2('0x25')](respondWithResult(_0x465fdf,0xc9))[_0xcde2('0x46')](handleError(_0x465fdf,null));};exports[_0xcde2('0x24')]=function(_0x5d777d,_0x53bd70){if(_0x5d777d['body']['id']){delete _0x5d777d[_0xcde2('0x4f')]['id'];}return db['AnalyticCustomReport'][_0xcde2('0x4d')]({'where':{'id':_0x5d777d[_0xcde2('0x48')]['id']}})[_0xcde2('0x25')](handleEntityNotFound(_0x53bd70,null))['then'](saveUpdates(_0x5d777d[_0xcde2('0x4f')],null))['then'](respondWithResult(_0x53bd70,null))[_0xcde2('0x46')](handleError(_0x53bd70,null));};exports['destroy']=function(_0x1085d2,_0x10d6ab){return db['AnalyticCustomReport'][_0xcde2('0x4d')]({'where':{'id':_0x1085d2['params']['id']}})['then'](handleEntityNotFound(_0x10d6ab,null))[_0xcde2('0x25')](removeEntity(_0x10d6ab,null))[_0xcde2('0x46')](handleError(_0x10d6ab,null));};exports[_0xcde2('0x58')]=function(_0x255bab,_0x149e83){var _0x3787b5=0xa;var _0x522c37=[_0xcde2('0x59'),_0xcde2('0x5a'),_0xcde2('0x5b'),_0xcde2('0x5c')];var _0x349818={'SUM':_0xcde2('0x5d'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcde2('0x5e'),'MIN':_0xcde2('0x5f'),'AVG':_0xcde2('0x60'),'GROUP_CONCAT':_0xcde2('0x61'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xcde2('0x62')};var _0x345210={'SEC_TO_TIME':_0xcde2('0x63'),'DATE':_0xcde2('0x64'),'HOUR':_0xcde2('0x65'),'ROUND':_0xcde2('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1bea12=function(_0x3b9e2d){return!_['includes']([_0xcde2('0x67'),_0xcde2('0x68'),_0xcde2('0x69'),_0xcde2('0x6a')],_0x3b9e2d);};var _0x2b5383=function(_0x46e60a){if(!_0x46e60a||!_0x46e60a[_0xcde2('0x6b')][_0xcde2('0x38')]){return'';}for(var _0xf65908='(',_0x3ae71d=0x0;_0x3ae71d<_0x46e60a['rules'][_0xcde2('0x38')];_0x3ae71d+=0x1){_0x3ae71d>0x0&&(_0xf65908+='\x20'+_0x46e60a[_0xcde2('0x6c')]+'\x20');_0xf65908+=_0x46e60a['rules'][_0x3ae71d][_0xcde2('0x6d')]?_0x2b5383(_0x46e60a[_0xcde2('0x6b')][_0x3ae71d][_0xcde2('0x6d')]):_0x46e60a['rules'][_0x3ae71d][_0xcde2('0x6e')]+'\x20'+_0x46e60a[_0xcde2('0x6b')][_0x3ae71d][_0xcde2('0x6f')]+(_0x1bea12(_0x46e60a[_0xcde2('0x6b')][_0x3ae71d][_0xcde2('0x6f')])?'\x20'+_0x46e60a[_0xcde2('0x6b')][_0x3ae71d][_0xcde2('0x70')]:'');}return _0xf65908+')';};var _0x45bd76={'where':{'id':_0x255bab[_0xcde2('0x48')]['id']}},_0x857e85,_0x34e72a,_0x3b0961,_0x5d42f8,_0x5bd1bd;_0x45bd76=_[_0xcde2('0x41')]({},_0x45bd76,_0x255bab[_0xcde2('0x4c')]);return db['AnalyticCustomReport']['find'](_0x45bd76)['then'](function(_0x1341d0){if(_0x1341d0){_0x857e85=_0x1341d0;return _0x1341d0[_0xcde2('0x71')]();}return null;})[_0xcde2('0x25')](function(_0x88614f){if(_0x88614f){if(!_0x88614f[_0xcde2('0x38')]){throw new db[(_0xcde2('0x72'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x34e72a=_0x88614f;return db[_0xcde2('0x73')][_0xcde2('0x45')]({'raw':!![]});}return null;})[_0xcde2('0x25')](function(_0x289cd1){if(_0x289cd1){_0x3b0961=_[_0xcde2('0x74')](_0x289cd1,'id');var _0x1131e0;var _0x45fc0c=squel[_0xcde2('0x75')]();_0x45fc0c[_0xcde2('0x76')](_0x857e85[_0xcde2('0x77')]);for(var _0x2da2b2=0x0;_0x2da2b2<_0x34e72a[_0xcde2('0x38')];_0x2da2b2+=0x1){_0x1131e0=_0x34e72a[_0x2da2b2][_0xcde2('0x78')]?_0x3b0961[_0x34e72a[_0x2da2b2][_0xcde2('0x78')]][_0xcde2('0x79')]:_0x34e72a[_0x2da2b2][_0xcde2('0x6e')];_0x1131e0=_0x34e72a[_0x2da2b2][_0xcde2('0x7a')]?_[_0xcde2('0x7b')](_0x349818[_0x34e72a[_0x2da2b2][_0xcde2('0x7a')]],'%s',_0x1131e0):_0x1131e0;_0x1131e0=_0x34e72a[_0x2da2b2][_0xcde2('0x7c')]?_['replace'](_0x345210[_0x34e72a[_0x2da2b2][_0xcde2('0x7c')]],'%s',_0x1131e0):_0x1131e0;if(_0x34e72a[_0x2da2b2][_0xcde2('0x7d')]){_0x45fc0c[_0xcde2('0x6d')](_0x1131e0);}_0x34e72a[_0x2da2b2][_0xcde2('0x7e')]&&_0x45fc0c[_0xcde2('0x3c')](_0x1131e0,_0x34e72a[_0x2da2b2]['orderBy']===_0xcde2('0x7f')?![]:!![]);_0x45fc0c['field'](_0x1131e0,_0x34e72a[_0x2da2b2][_0xcde2('0x80')]||_0x1131e0);}if(_0x857e85[_0xcde2('0x81')]){_0x857e85[_0xcde2('0x81')]=JSON[_0xcde2('0x82')](_0x857e85[_0xcde2('0x81')]);for(var _0x42e629=0x0;_0x42e629<_0x857e85[_0xcde2('0x81')]['length'];_0x42e629+=0x1){if(_0x857e85['joins'][_0x42e629][_0xcde2('0x30')]&&_['includes'](_0x522c37,_0x857e85[_0xcde2('0x81')][_0x42e629][_0xcde2('0x30')])&&_0x857e85[_0xcde2('0x81')][_0x42e629][_0xcde2('0x83')]&&_0x857e85[_0xcde2('0x81')][_0x42e629][_0xcde2('0x84')]&&_0x857e85[_0xcde2('0x81')][_0x42e629]['foreignKey']){_0x45fc0c[_0x857e85[_0xcde2('0x81')][_0x42e629][_0xcde2('0x30')]](_0x857e85[_0xcde2('0x81')][_0x42e629][_0xcde2('0x84')],null,util['format'](_0xcde2('0x85'),_0x857e85[_0xcde2('0x77')],_0x857e85[_0xcde2('0x81')][_0x42e629][_0xcde2('0x83')],_0x857e85[_0xcde2('0x81')][_0x42e629][_0xcde2('0x84')],_0x857e85[_0xcde2('0x81')][_0x42e629][_0xcde2('0x86')]));}}}if(_0x857e85[_0xcde2('0x87')]){_0x857e85[_0xcde2('0x87')]=JSON[_0xcde2('0x82')](_0x857e85[_0xcde2('0x87')]);_0x45fc0c[_0xcde2('0x3e')](_0x2b5383(_0x857e85['conditions'][_0xcde2('0x6d')]));}_0x5bd1bd=_0x45fc0c[_0xcde2('0x88')]();_0x45fc0c[_0xcde2('0x1e')](_0x3787b5);_0x45fc0c[_0xcde2('0x3b')](0x0);logger[_0xcde2('0x89')](_0xcde2('0x8a'),_0x45fc0c[_0xcde2('0x8b')]());return db[_0xcde2('0x8c')][_0xcde2('0x33')](_0x45fc0c[_0xcde2('0x8b')](),{'type':db[_0xcde2('0x8c')][_0xcde2('0x8d')][_0xcde2('0x8e')]});}})[_0xcde2('0x25')](respondWithResult(_0x149e83,null))[_0xcde2('0x46')](handleError(_0x149e83,null));};function runReport(_0x1d0b11,_0x5c63d9,_0x598fdd){var _0x185986=_0x5c63d9[_0xcde2('0x2b')];var _0xa76992=0xa;var _0x4124a5=['join',_0xcde2('0x5a'),'right_join',_0xcde2('0x5c')];var _0x5f14a5={'SUM':_0xcde2('0x5d'),'COUNT':_0xcde2('0x8f'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcde2('0x5e'),'MIN':_0xcde2('0x5f'),'AVG':_0xcde2('0x60'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xcde2('0x90'),'GROUP_CONCAT DESC':_0xcde2('0x62')};var _0x35db40={'SEC_TO_TIME':_0xcde2('0x63'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xcde2('0x66'),'UNIX_TIMESTAMP':_0xcde2('0x91')};var _0x399c47=function(_0x248ec3){return!_[_0xcde2('0x92')]([_0xcde2('0x67'),'IS\x20NOT\x20NULL',_0xcde2('0x69'),_0xcde2('0x6a')],_0x248ec3);};var _0x1be173=function(_0x299987){if(!_0x299987||!_0x299987[_0xcde2('0x6b')][_0xcde2('0x38')]){return'';}for(var _0x113478='(',_0x5e58fa=0x0;_0x5e58fa<_0x299987[_0xcde2('0x6b')][_0xcde2('0x38')];_0x5e58fa+=0x1){_0x5e58fa>0x0&&(_0x113478+='\x20'+_0x299987['operator']+'\x20');_0x113478+=_0x299987[_0xcde2('0x6b')][_0x5e58fa][_0xcde2('0x6d')]?_0x1be173(_0x299987[_0xcde2('0x6b')][_0x5e58fa]['group']):_0x299987[_0xcde2('0x6b')][_0x5e58fa][_0xcde2('0x6e')]+'\x20'+_0x299987['rules'][_0x5e58fa]['condition']+(_0x399c47(_0x299987['rules'][_0x5e58fa][_0xcde2('0x6f')])?'\x20'+_0x299987[_0xcde2('0x6b')][_0x5e58fa]['value']:'');}return _0x113478+')';};var _0x12b989={'where':{'id':_0x1d0b11['id']}},_0x5e5437,_0x4c753a,_0x2bea8a,_0x243504,_0x3e6111;_0x12b989=_['merge']({},_0x12b989,_0x598fdd);return db[_0xcde2('0x2e')][_0xcde2('0x4d')](_0x12b989)[_0xcde2('0x25')](function(_0x3ad3dd){if(_0x3ad3dd){_0x5e5437=_0x3ad3dd;return _0x3ad3dd[_0xcde2('0x71')]();}return null;})[_0xcde2('0x25')](function(_0x44e249){if(_0x44e249){if(!_0x44e249['length']){throw new db['Sequelize'][(_0xcde2('0x93'))](_0xcde2('0x94'),0x193);}_0x4c753a=_0x44e249;return db[_0xcde2('0x73')][_0xcde2('0x45')]({'raw':!![]});}return null;})[_0xcde2('0x25')](function(_0x4dcf0e){if(_0x4dcf0e){_0x2bea8a=_[_0xcde2('0x74')](_0x4dcf0e,'id');var _0x51bd42;var _0x5c4458=squel[_0xcde2('0x75')]();_0x5c4458['from'](_0x5e5437['table']);for(var _0x117fdb=0x0;_0x117fdb<_0x4c753a[_0xcde2('0x38')];_0x117fdb+=0x1){_0x51bd42=_0x4c753a[_0x117fdb][_0xcde2('0x78')]?_0x2bea8a[_0x4c753a[_0x117fdb][_0xcde2('0x78')]][_0xcde2('0x79')]:_0x4c753a[_0x117fdb]['field'];_0x51bd42=_0x4c753a[_0x117fdb][_0xcde2('0x7a')]?_['replace'](_0x5f14a5[_0x4c753a[_0x117fdb][_0xcde2('0x7a')]],'%s',_0x51bd42):_0x51bd42;_0x51bd42=_0x4c753a[_0x117fdb][_0xcde2('0x7c')]?_[_0xcde2('0x7b')](_0x35db40[_0x4c753a[_0x117fdb][_0xcde2('0x7c')]],'%s',_0x51bd42):_0x51bd42;if(_0x4c753a[_0x117fdb]['groupBy']){_0x5c4458['group'](_0x51bd42);}_0x4c753a[_0x117fdb]['orderBy']&&_0x5c4458[_0xcde2('0x3c')](_0x51bd42,_0x4c753a[_0x117fdb]['orderBy']==='DESC'?![]:!![]);_0x5c4458[_0xcde2('0x6e')](_0x51bd42,_0x4c753a[_0x117fdb][_0xcde2('0x80')]||_0x51bd42);}if(_0x5e5437[_0xcde2('0x81')]){_0x5e5437[_0xcde2('0x81')]=JSON[_0xcde2('0x82')](_0x5e5437[_0xcde2('0x81')]);for(var _0x236d70=0x0;_0x236d70<_0x5e5437['joins'][_0xcde2('0x38')];_0x236d70+=0x1){if(_0x5e5437[_0xcde2('0x81')][_0x236d70][_0xcde2('0x30')]&&_[_0xcde2('0x92')](_0x4124a5,_0x5e5437[_0xcde2('0x81')][_0x236d70][_0xcde2('0x30')])&&_0x5e5437[_0xcde2('0x81')][_0x236d70]['parentKey']&&_0x5e5437[_0xcde2('0x81')][_0x236d70]['foreignTable']&&_0x5e5437['joins'][_0x236d70][_0xcde2('0x86')]){_0x5c4458[_0x5e5437[_0xcde2('0x81')][_0x236d70][_0xcde2('0x30')]](_0x5e5437[_0xcde2('0x81')][_0x236d70][_0xcde2('0x84')],null,util[_0xcde2('0x7c')](_0xcde2('0x85'),_0x5e5437['table'],_0x5e5437[_0xcde2('0x81')][_0x236d70][_0xcde2('0x83')],_0x5e5437[_0xcde2('0x81')][_0x236d70]['foreignTable'],_0x5e5437[_0xcde2('0x81')][_0x236d70][_0xcde2('0x86')]));}}}if(_0x5e5437['conditions']){_0x5e5437['conditions']=JSON[_0xcde2('0x82')](_0x5e5437[_0xcde2('0x87')]);_0x5c4458[_0xcde2('0x3e')](_0x1be173(_0x5e5437[_0xcde2('0x87')][_0xcde2('0x6d')]));}_0x3e6111=_0x5c4458['clone']();_0x5c4458['limit'](_0xa76992);_0x5c4458[_0xcde2('0x3b')](0x0);logger['debug'](_0xcde2('0x8a'),_0x5c4458[_0xcde2('0x8b')]());return db[_0xcde2('0x8c')][_0xcde2('0x33')](_0x5c4458[_0xcde2('0x8b')](),{'type':db['sequelize'][_0xcde2('0x8d')][_0xcde2('0x8e')]});}})[_0xcde2('0x25')](function(_0x58644b){if(!_0x58644b['length']){throw new db[(_0xcde2('0x72'))]['ValidationErrorItem'](_0xcde2('0x95'),0xcc);}if(_0x5c63d9[_0xcde2('0x96')]===_0xcde2('0x97')){return null;}var _0x149b4d=_[_0xcde2('0x41')](_0x5c63d9,{'name':_0x5c63d9[_0xcde2('0x98')]||_0x5c63d9[_0xcde2('0x2b')]||_0x5e5437['name'],'basename':_0x185986,'savename':util['format'](_0xcde2('0x99'),_0x5c63d9[_0xcde2('0x2b')]||_0x5e5437[_0xcde2('0x2b')],require('randomstring')['generate'](0x4),_0x5c63d9[_0xcde2('0x96')]||_0xcde2('0x9a')),'reportId':_0x5e5437['id'],'reportType':_0xcde2('0x9b')});return db['AnalyticExtractedReport'][_0xcde2('0x4e')](_0x149b4d,{'raw':!![]});})[_0xcde2('0x25')](function(_0x4f485d){if(_0x5e5437[_0xcde2('0x77')]===_0xcde2('0x9c')){_0x3e6111[_0xcde2('0x3e')](_0x5e5437[_0xcde2('0x77')]+_0xcde2('0x9d'),_0x5c63d9[_0xcde2('0x9e')],_0x5c63d9[_0xcde2('0x9f')]);}else{_0x3e6111[_0xcde2('0x3e')](_0x5e5437['table']+_0xcde2('0xa0'),_0x5c63d9[_0xcde2('0x9e')],_0x5c63d9[_0xcde2('0x9f')]);}if(_0x4f485d){logger['info'](_0xcde2('0xa1'),_0x3e6111[_0xcde2('0x8b')]());require(_0xcde2('0xa2'))[_0xcde2('0xa3')](path['join'](__dirname,_0xcde2('0xa4'),_0x4f485d[_0xcde2('0x96')]),[_0x4f485d['id'],_0x3e6111[_0xcde2('0x8b')](),path[_0xcde2('0x59')](__dirname,_0xcde2('0xa5'),_0x4f485d['savename']),_0x185986]);return _0x4f485d;}else{var _0x5d9b69=squel['select']();_0x5d9b69[_0xcde2('0x76')]('('+_0x3e6111[_0xcde2('0x8b')]()+')','countTable');_0x5d9b69[_0xcde2('0x6e')](_0xcde2('0xa6'),_0xcde2('0x43'));_0x3e6111['limit'](_0x5c63d9[_0xcde2('0x1e')]||_0xa76992);_0x3e6111[_0xcde2('0x3b')](_0x5c63d9[_0xcde2('0x3b')]||0x0);return dbH['sequelize'][_0xcde2('0x33')](_0x5d9b69[_0xcde2('0x8b')](),{'type':dbH[_0xcde2('0x8c')][_0xcde2('0x8d')][_0xcde2('0x8e')]})[_0xcde2('0x25')](function(_0x418733){if(!_0x418733[_0xcde2('0x38')]){_0x243504=0x0;}else{_0x243504=_0x418733[0x0][_0xcde2('0x43')]||0x0;}return dbH[_0xcde2('0x8c')][_0xcde2('0x33')](_0x3e6111[_0xcde2('0x8b')](),{'type':dbH['sequelize'][_0xcde2('0x8d')]['SELECT']});})[_0xcde2('0x25')](function(_0x5967da){return{'rows':_0x5967da||[],'count':_0x243504};});}});}exports[_0xcde2('0xa7')]=function(_0x555b3e,_0x5c5c33){return runReport(_0x555b3e[_0xcde2('0x48')],_0x555b3e[_0xcde2('0x33')],_0x555b3e[_0xcde2('0x4c')])[_0xcde2('0x25')](respondWithResult(_0x5c5c33,null))[_0xcde2('0x46')](handleError(_0x5c5c33,null));};exports[_0xcde2('0xa8')]=runReport;exports['query']=function(_0xb5031b,_0x1db57d){var _0x299fd5=0xa;var _0x3d4574=[_0xcde2('0x59'),_0xcde2('0x5a'),_0xcde2('0x5b'),_0xcde2('0x5c')];var _0x5ffd70={'SUM':_0xcde2('0x5d'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcde2('0xa9'),'MAX':_0xcde2('0x5e'),'MIN':_0xcde2('0x5f'),'AVG':_0xcde2('0x60'),'GROUP_CONCAT':_0xcde2('0x61'),'GROUP_CONCAT ASC':_0xcde2('0x90'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x353e44={'SEC_TO_TIME':_0xcde2('0x63'),'DATE':_0xcde2('0x64'),'HOUR':_0xcde2('0x65'),'ROUND':_0xcde2('0x66'),'UNIX_TIMESTAMP':_0xcde2('0x91')};var _0x4369a3=function(_0x4279b4){return!_['includes'](['IS\x20NULL',_0xcde2('0x68'),_0xcde2('0x69'),_0xcde2('0x6a')],_0x4279b4);};var _0xca5a30=function(_0x651eb6){if(!_0x651eb6||!_0x651eb6[_0xcde2('0x6b')][_0xcde2('0x38')]){return'';}for(var _0x3582b9='(',_0x37ac1d=0x0;_0x37ac1d<_0x651eb6[_0xcde2('0x6b')]['length'];_0x37ac1d+=0x1){_0x37ac1d>0x0&&(_0x3582b9+='\x20'+_0x651eb6[_0xcde2('0x6c')]+'\x20');_0x3582b9+=_0x651eb6[_0xcde2('0x6b')][_0x37ac1d][_0xcde2('0x6d')]?_0xca5a30(_0x651eb6[_0xcde2('0x6b')][_0x37ac1d][_0xcde2('0x6d')]):_0x651eb6[_0xcde2('0x6b')][_0x37ac1d]['field']+'\x20'+_0x651eb6[_0xcde2('0x6b')][_0x37ac1d]['condition']+(_0x4369a3(_0x651eb6[_0xcde2('0x6b')][_0x37ac1d][_0xcde2('0x6f')])?'\x20'+_0x651eb6[_0xcde2('0x6b')][_0x37ac1d][_0xcde2('0x70')]:'');}return _0x3582b9+')';};var _0x4ebd59={'where':{'id':_0xb5031b['params']['id']}},_0x3f3654,_0x2c736c,_0x3ab370,_0x16c5e9,_0x34588c;_0x4ebd59=_[_0xcde2('0x41')]({},_0x4ebd59,_0xb5031b[_0xcde2('0x4c')]);return db[_0xcde2('0x2e')]['find'](_0x4ebd59)[_0xcde2('0x25')](function(_0xd119e){if(_0xd119e){_0x3f3654=_0xd119e;return _0xd119e[_0xcde2('0x71')]();}return null;})['then'](function(_0x54fadf){if(_0x54fadf){if(!_0x54fadf[_0xcde2('0x38')]){throw new db[(_0xcde2('0x72'))][(_0xcde2('0x93'))](_0xcde2('0x94'),0x193);}_0x2c736c=_0x54fadf;return db['AnalyticMetric'][_0xcde2('0x45')]({'raw':!![]});}return null;})['then'](function(_0x1a7570){if(_0x1a7570){_0x3ab370=_[_0xcde2('0x74')](_0x1a7570,'id');var _0x5168f0;var _0x41b7d4=squel[_0xcde2('0x75')]();_0x41b7d4['from'](_0x3f3654[_0xcde2('0x77')]);for(var _0x3847ff=0x0;_0x3847ff<_0x2c736c['length'];_0x3847ff+=0x1){_0x5168f0=_0x2c736c[_0x3847ff]['MetricId']?_0x3ab370[_0x2c736c[_0x3847ff]['MetricId']]['metric']:_0x2c736c[_0x3847ff][_0xcde2('0x6e')];_0x5168f0=_0x2c736c[_0x3847ff][_0xcde2('0x7a')]?_[_0xcde2('0x7b')](_0x5ffd70[_0x2c736c[_0x3847ff]['function']],'%s',_0x5168f0):_0x5168f0;_0x5168f0=_0x2c736c[_0x3847ff][_0xcde2('0x7c')]?_[_0xcde2('0x7b')](_0x353e44[_0x2c736c[_0x3847ff][_0xcde2('0x7c')]],'%s',_0x5168f0):_0x5168f0;if(_0x2c736c[_0x3847ff][_0xcde2('0x7d')]){_0x41b7d4[_0xcde2('0x6d')](_0x5168f0);}_0x2c736c[_0x3847ff][_0xcde2('0x7e')]&&_0x41b7d4[_0xcde2('0x3c')](_0x5168f0,_0x2c736c[_0x3847ff][_0xcde2('0x7e')]===_0xcde2('0x7f')?![]:!![]);_0x41b7d4[_0xcde2('0x6e')](_0x5168f0,_0x2c736c[_0x3847ff][_0xcde2('0x80')]||_0x5168f0);}if(_0x3f3654[_0xcde2('0x81')]){_0x3f3654[_0xcde2('0x81')]=JSON[_0xcde2('0x82')](_0x3f3654[_0xcde2('0x81')]);for(var _0x38cd1e=0x0;_0x38cd1e<_0x3f3654['joins']['length'];_0x38cd1e+=0x1){if(_0x3f3654[_0xcde2('0x81')][_0x38cd1e][_0xcde2('0x30')]&&_[_0xcde2('0x92')](_0x3d4574,_0x3f3654['joins'][_0x38cd1e]['type'])&&_0x3f3654['joins'][_0x38cd1e][_0xcde2('0x83')]&&_0x3f3654[_0xcde2('0x81')][_0x38cd1e][_0xcde2('0x84')]&&_0x3f3654[_0xcde2('0x81')][_0x38cd1e][_0xcde2('0x86')]){_0x41b7d4[_0x3f3654['joins'][_0x38cd1e][_0xcde2('0x30')]](_0x3f3654[_0xcde2('0x81')][_0x38cd1e][_0xcde2('0x84')],null,util[_0xcde2('0x7c')](_0xcde2('0x85'),_0x3f3654[_0xcde2('0x77')],_0x3f3654['joins'][_0x38cd1e][_0xcde2('0x83')],_0x3f3654['joins'][_0x38cd1e][_0xcde2('0x84')],_0x3f3654['joins'][_0x38cd1e]['foreignKey']));}}}if(_0x3f3654['conditions']){_0x3f3654[_0xcde2('0x87')]=JSON['parse'](_0x3f3654['conditions']);_0x41b7d4[_0xcde2('0x3e')](_0xca5a30(_0x3f3654['conditions'][_0xcde2('0x6d')]));}_0x34588c=_0x41b7d4[_0xcde2('0x88')]();_0x41b7d4[_0xcde2('0x1e')](_0x299fd5);_0x41b7d4[_0xcde2('0x3b')](0x0);logger[_0xcde2('0x89')](_0xcde2('0x8a'),_0x41b7d4[_0xcde2('0x8b')]());return db[_0xcde2('0x8c')]['query'](_0x41b7d4['toString'](),{'type':db[_0xcde2('0x8c')]['QueryTypes']['SELECT']});}})[_0xcde2('0x25')](function(){return{'sql':_0x34588c[_0xcde2('0x8b')]()};})[_0xcde2('0x25')](respondWithResult(_0x1db57d,null))['catch'](handleError(_0x1db57d,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index d2bc59f..b8c2dde 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 _0xe3d9=['AnalyticCustomReport','lodash','moment','bluebird','request-promise','path','rimraf','./analyticCustomReport.attributes','define'];(function(_0x5c2bef,_0x16806e){var _0xd60cc1=function(_0x40e74a){while(--_0x40e74a){_0x5c2bef['push'](_0x5c2bef['shift']());}};_0xd60cc1(++_0x16806e);}(_0xe3d9,0x172));var _0x9e3d=function(_0x515a0a,_0x1a4496){_0x515a0a=_0x515a0a-0x0;var _0x5db495=_0xe3d9[_0x515a0a];return _0x5db495;};'use strict';var _=require(_0x9e3d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9e3d('0x1'));var BPromise=require(_0x9e3d('0x2'));var rp=require(_0x9e3d('0x3'));var fs=require('fs');var path=require(_0x9e3d('0x4'));var rimraf=require(_0x9e3d('0x5'));var config=require('../../config/environment');var attributes=require(_0x9e3d('0x6'));module['exports']=function(_0xb3acd4,_0x1b887e){return _0xb3acd4[_0x9e3d('0x7')](_0x9e3d('0x8'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f5e=['define','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x237418,_0x56e144){var _0x22393e=function(_0x53ae0e){while(--_0x53ae0e){_0x237418['push'](_0x237418['shift']());}};_0x22393e(++_0x56e144);}(_0x7f5e,0x160));var _0xe7f5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7f5e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe7f5('0x0'));var util=require(_0xe7f5('0x1'));var logger=require(_0xe7f5('0x2'))(_0xe7f5('0x3'));var moment=require(_0xe7f5('0x4'));var BPromise=require(_0xe7f5('0x5'));var rp=require(_0xe7f5('0x6'));var fs=require('fs');var path=require(_0xe7f5('0x7'));var rimraf=require(_0xe7f5('0x8'));var config=require(_0xe7f5('0x9'));var attributes=require(_0xe7f5('0xa'));module[_0xe7f5('0xb')]=function(_0x2dca85,_0x4ce158){return _0x2dca85[_0xe7f5('0xc')]('AnalyticCustomReport',attributes,{'tableName':_0xe7f5('0xd'),'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 a218db5..698ebd1 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 _0x6c33=['rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x205bea,_0x4695f2){var _0x59e5a3=function(_0x5d80f5){while(--_0x5d80f5){_0x205bea['push'](_0x205bea['shift']());}};_0x59e5a3(++_0x4695f2);}(_0x6c33,0xc9));var _0x36c3=function(_0x281e76,_0x8bde50){_0x281e76=_0x281e76-0x0;var _0x5ecce5=_0x6c33[_0x281e76];return _0x5ecce5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x36c3('0x0'));var rs=require(_0x36c3('0x1'));var fs=require('fs');var Redis=require(_0x36c3('0x2'));var db=require(_0x36c3('0x3'))['db'];var utils=require(_0x36c3('0x4'));var logger=require(_0x36c3('0x5'))(_0x36c3('0x6'));var config=require(_0x36c3('0x7'));var jayson=require(_0x36c3('0x8'));var client=jayson[_0x36c3('0x9')][_0x36c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x149bf2,_0x2c73a8,_0x5c7333){return new BPromise(function(_0x40fe9f,_0x1374d9){return client[_0x36c3('0xb')](_0x149bf2,_0x5c7333)[_0x36c3('0xc')](function(_0x397996){logger['info'](_0x36c3('0xd'),_0x2c73a8,'request\x20sent');logger[_0x36c3('0xe')](_0x36c3('0xf'),_0x2c73a8,'request\x20sent',JSON[_0x36c3('0x10')](_0x397996));if(_0x397996['error']){if(_0x397996[_0x36c3('0x11')][_0x36c3('0x12')]===0x1f4){logger[_0x36c3('0x11')](_0x36c3('0xd'),_0x2c73a8,_0x397996[_0x36c3('0x11')][_0x36c3('0x13')]);return _0x1374d9(_0x397996[_0x36c3('0x11')][_0x36c3('0x13')]);}logger[_0x36c3('0x11')](_0x36c3('0xd'),_0x2c73a8,_0x397996[_0x36c3('0x11')][_0x36c3('0x13')]);return _0x40fe9f(_0x397996[_0x36c3('0x11')]['message']);}else{logger[_0x36c3('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2c73a8,_0x36c3('0x15'));_0x40fe9f(_0x397996[_0x36c3('0x16')][_0x36c3('0x13')]);}})['catch'](function(_0x3b3fa0){logger['error'](_0x36c3('0xd'),_0x2c73a8,_0x3b3fa0);_0x1374d9(_0x3b3fa0);});});} \ No newline at end of file +var _0x8485=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb'];(function(_0x246568,_0x57af04){var _0x19b302=function(_0x4ae034){while(--_0x4ae034){_0x246568['push'](_0x246568['shift']());}};_0x19b302(++_0x57af04);}(_0x8485,0xb9));var _0x5848=function(_0x5dab10,_0x5e5fe8){_0x5dab10=_0x5dab10-0x0;var _0x56dcbe=_0x8485[_0x5dab10];return _0x56dcbe;};'use strict';var _=require(_0x5848('0x0'));var util=require('util');var moment=require(_0x5848('0x1'));var BPromise=require(_0x5848('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5848('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5848('0x4'))(_0x5848('0x5'));var config=require(_0x5848('0x6'));var jayson=require(_0x5848('0x7'));var client=jayson[_0x5848('0x8')][_0x5848('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x262c64,_0x5e6bd9,_0x3fe38e){return new BPromise(function(_0x1956da,_0xecf3f){return client[_0x5848('0xa')](_0x262c64,_0x3fe38e)[_0x5848('0xb')](function(_0xcf79c8){logger[_0x5848('0xc')](_0x5848('0xd'),_0x5e6bd9,'request\x20sent');logger['debug'](_0x5848('0xe'),_0x5e6bd9,'request\x20sent',JSON[_0x5848('0xf')](_0xcf79c8));if(_0xcf79c8[_0x5848('0x10')]){if(_0xcf79c8[_0x5848('0x10')][_0x5848('0x11')]===0x1f4){logger[_0x5848('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5e6bd9,_0xcf79c8[_0x5848('0x10')][_0x5848('0x12')]);return _0xecf3f(_0xcf79c8[_0x5848('0x10')][_0x5848('0x12')]);}logger['error'](_0x5848('0xd'),_0x5e6bd9,_0xcf79c8[_0x5848('0x10')]['message']);return _0x1956da(_0xcf79c8[_0x5848('0x10')][_0x5848('0x12')]);}else{logger[_0x5848('0xc')](_0x5848('0xd'),_0x5e6bd9,'request\x20sent');_0x1956da(_0xcf79c8[_0x5848('0x13')][_0x5848('0x12')]);}})[_0x5848('0x14')](function(_0x5a3309){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x5e6bd9,_0x5a3309);_0xecf3f(_0x5a3309);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 7955704..62758c4 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 _0x5fe7=['create','update','delete','/:id','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','show','/:id/preview','preview','run','query'];(function(_0x4f2ed3,_0x3cee97){var _0x375986=function(_0x1ec179){while(--_0x1ec179){_0x4f2ed3['push'](_0x4f2ed3['shift']());}};_0x375986(++_0x3cee97);}(_0x5fe7,0x1e1));var _0x75fe=function(_0x4b42f4,_0x140a19){_0x4b42f4=_0x4b42f4-0x0;var _0x1ed5eb=_0x5fe7[_0x4b42f4];return _0x1ed5eb;};'use strict';var multer=require('multer');var util=require(_0x75fe('0x0'));var path=require(_0x75fe('0x1'));var timeout=require(_0x75fe('0x2'));var express=require('express');var router=express[_0x75fe('0x3')]();var auth=require(_0x75fe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x75fe('0x5'));var controller=require('./analyticCustomReport.controller');router[_0x75fe('0x6')]('/',auth[_0x75fe('0x7')](),controller['index']);router[_0x75fe('0x6')]('/:id',auth[_0x75fe('0x7')](),controller[_0x75fe('0x8')]);router[_0x75fe('0x6')](_0x75fe('0x9'),auth[_0x75fe('0x7')](),controller[_0x75fe('0xa')]);router[_0x75fe('0x6')]('/:id/run',auth['isAuthenticated'](),controller[_0x75fe('0xb')]);router[_0x75fe('0x6')]('/:id/query',auth[_0x75fe('0x7')](),controller[_0x75fe('0xc')]);router['post']('/',auth[_0x75fe('0x7')](),controller[_0x75fe('0xd')]);router['put']('/:id',auth[_0x75fe('0x7')](),controller[_0x75fe('0xe')]);router[_0x75fe('0xf')](_0x75fe('0x10'),auth[_0x75fe('0x7')](),controller[_0x75fe('0x11')]);module[_0x75fe('0x12')]=router; \ No newline at end of file +var _0x02df=['get','index','/:id','isAuthenticated','/:id/preview','preview','query','post','create','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','./analyticCustomReport.controller'];(function(_0x4fd298,_0x595966){var _0xed434e=function(_0x104801){while(--_0x104801){_0x4fd298['push'](_0x4fd298['shift']());}};_0xed434e(++_0x595966);}(_0x02df,0xea));var _0xf02d=function(_0x5d7019,_0x5c614e){_0x5d7019=_0x5d7019-0x0;var _0x554a7e=_0x02df[_0x5d7019];return _0x554a7e;};'use strict';var multer=require(_0xf02d('0x0'));var util=require(_0xf02d('0x1'));var path=require(_0xf02d('0x2'));var timeout=require('connect-timeout');var express=require(_0xf02d('0x3'));var router=express['Router']();var auth=require(_0xf02d('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf02d('0x5'));router[_0xf02d('0x6')]('/',auth['isAuthenticated'](),controller[_0xf02d('0x7')]);router['get'](_0xf02d('0x8'),auth[_0xf02d('0x9')](),controller['show']);router[_0xf02d('0x6')](_0xf02d('0xa'),auth[_0xf02d('0x9')](),controller[_0xf02d('0xb')]);router[_0xf02d('0x6')]('/:id/run',auth[_0xf02d('0x9')](),controller['run']);router[_0xf02d('0x6')]('/:id/query',auth[_0xf02d('0x9')](),controller[_0xf02d('0xc')]);router[_0xf02d('0xd')]('/',auth[_0xf02d('0x9')](),controller[_0xf02d('0xe')]);router[_0xf02d('0xf')](_0xf02d('0x8'),auth[_0xf02d('0x9')](),controller[_0xf02d('0x10')]);router[_0xf02d('0x11')](_0xf02d('0x8'),auth[_0xf02d('0x9')](),controller[_0xf02d('0x12')]);module[_0xf02d('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 59f399f..d01599c 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 _0xb52a=['exports','STRING','TEXT','sequelize'];(function(_0x293099,_0xe927a1){var _0x42438d=function(_0x2d2b58){while(--_0x2d2b58){_0x293099['push'](_0x293099['shift']());}};_0x42438d(++_0xe927a1);}(_0xb52a,0xf7));var _0xab52=function(_0x18d631,_0x4376d2){_0x18d631=_0x18d631-0x0;var _0x50d708=_0xb52a[_0x18d631];return _0x50d708;};'use strict';var Sequelize=require(_0xab52('0x0'));module[_0xab52('0x1')]={'name':{'type':Sequelize[_0xab52('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xab52('0x2')]},'parent':{'type':Sequelize[_0xab52('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xab52('0x3')]},'joins':{'type':Sequelize[_0xab52('0x3')]}}; \ No newline at end of file +var _0xcec5=['STRING','TEXT','sequelize'];(function(_0xb97c94,_0x32d925){var _0x413a1e=function(_0x12d4ff){while(--_0x12d4ff){_0xb97c94['push'](_0xb97c94['shift']());}};_0x413a1e(++_0x32d925);}(_0xcec5,0x14c));var _0x5cec=function(_0x237c96,_0x2a6e57){_0x237c96=_0x237c96-0x0;var _0x9caf59=_0xcec5[_0x237c96];return _0x9caf59;};'use strict';var Sequelize=require(_0x5cec('0x0'));module['exports']={'name':{'type':Sequelize[_0x5cec('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5cec('0x1')]},'parent':{'type':Sequelize[_0x5cec('0x1')]},'table':{'type':Sequelize[_0x5cec('0x1')]},'conditions':{'type':Sequelize[_0x5cec('0x2')]},'joins':{'type':Sequelize[_0x5cec('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index c3b120e..c13ee71 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 _0xe375=['ValidationErrorItem','from','replace','alias','parse','%s.%s\x20=\x20%s.%s','debug','output','web','fullPath','%s-%s.%s','randomstring','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','savename','countTable','COUNT(*)','run','runReport','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','UserProfileResource','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','sort','where','filter','VIRTUAL','merge','options','AnalyticDefaultReport','includeAll','findAll','rows','catch','show','params','rawAttributes','filtears','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','preview','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\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','format','groupBy','orderBy','order','DESC','joins','type','includes','parentKey','foreignTable','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','cross_join','HOUR(%s)','UNIX_TIMESTAMP(%s)','value'];(function(_0x301dab,_0x38050a){var _0x2500a2=function(_0x4d3dff){while(--_0x4d3dff){_0x301dab['push'](_0x301dab['shift']());}};_0x2500a2(++_0x38050a);}(_0xe375,0x16e));var _0x5e37=function(_0x4eabd5,_0x4b579d){_0x4eabd5=_0x4eabd5-0x0;var _0x1dafdf=_0xe375[_0x4eabd5];return _0x1dafdf;};'use strict';var pdf=require(_0x5e37('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5e37('0x1'));var zipdir=require(_0x5e37('0x2'));var jsonpatch=require(_0x5e37('0x3'));var rp=require(_0x5e37('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5e37('0x5'));var path=require(_0x5e37('0x6'));var sox=require(_0x5e37('0x7'));var csv=require(_0x5e37('0x8'));var ejs=require(_0x5e37('0x9'));var fs=require('fs');var _=require(_0x5e37('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5e37('0xb'));var deskjs=require(_0x5e37('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5e37('0xd'));var Redis=require(_0x5e37('0xe'));var authService=require(_0x5e37('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5e37('0x10'));var hardwareService=require(_0x5e37('0x11'));var logger=require(_0x5e37('0x12'))(_0x5e37('0x13'));var utils=require(_0x5e37('0x14'));var config=require(_0x5e37('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5e37('0x16'))['db'];var dbH=require(_0x5e37('0x16'))[_0x5e37('0x17')];function respondWithStatusCode(_0x13fd72,_0x55b1d8){_0x55b1d8=_0x55b1d8||0xcc;return function(_0x1b98df){if(_0x1b98df){return _0x13fd72[_0x5e37('0x18')](_0x55b1d8);}return _0x13fd72['status'](_0x55b1d8)[_0x5e37('0x19')]();};}function respondWithResult(_0x4962df,_0x50e811){_0x50e811=_0x50e811||0xc8;return function(_0x2a4121){if(_0x2a4121){return _0x4962df[_0x5e37('0x1a')](_0x50e811)[_0x5e37('0x1b')](_0x2a4121);}};}function respondWithFilteredResult(_0x3ef53e,_0x339bda){return function(_0x50f9ce){if(_0x50f9ce){var _0x3a90fb=_0x50f9ce[_0x5e37('0x1c')],_0x3eee25=_0x339bda[_0x5e37('0x1d')],_0x55fc3a=_0x339bda[_0x5e37('0x1d')]+_0x339bda['limit'],_0xd05b0c;if(_0x55fc3a>=_0x3a90fb){_0x55fc3a=_0x3a90fb;_0xd05b0c=0xc8;}else{_0xd05b0c=0xce;}_0x3ef53e[_0x5e37('0x1a')](_0xd05b0c);return _0x3ef53e[_0x5e37('0x1e')](_0x5e37('0x1f'),_0x3eee25+'-'+_0x55fc3a+'/'+_0x3a90fb)[_0x5e37('0x1b')](_0x50f9ce);}return null;};}function patchUpdates(_0x19ea7c){return function(_0x53baed){try{jsonpatch[_0x5e37('0x20')](_0x53baed,_0x19ea7c,!![]);}catch(_0x1a9f34){return BPromise[_0x5e37('0x21')](_0x1a9f34);}return _0x53baed[_0x5e37('0x22')]();};}function saveUpdates(_0x51fbed,_0x24ed3a){return function(_0x500b39){if(_0x500b39){return _0x500b39[_0x5e37('0x23')](_0x51fbed)[_0x5e37('0x24')](function(_0x11da59){return _0x11da59;});}return null;};}function removeEntity(_0x4e7bac,_0x54cba5){return function(_0x474956){if(_0x474956){return _0x474956['destroy']()['then'](function(){var _0x42be56=_0x474956['get']({'plain':!![]});var _0x2f5c8e='DefaultReports';return db[_0x5e37('0x25')]['destroy']({'where':{'type':_0x2f5c8e,'resourceId':_0x42be56['id']}})[_0x5e37('0x24')](function(){return _0x474956;});})[_0x5e37('0x24')](function(){_0x4e7bac['status'](0xcc)[_0x5e37('0x19')]();});}};}function handleEntityNotFound(_0x4ab909,_0x36e4f4){return function(_0x759f6e){if(!_0x759f6e){_0x4ab909[_0x5e37('0x18')](0x194);}return _0x759f6e;};}function handleError(_0x88f947,_0xbe5799){_0xbe5799=_0xbe5799||0x1f4;return function(_0x15fa30){logger[_0x5e37('0x26')](_0x15fa30[_0x5e37('0x27')]);if(_0x15fa30[_0x5e37('0x28')]){delete _0x15fa30[_0x5e37('0x28')];}_0x88f947['status'](_0xbe5799)[_0x5e37('0x29')](_0x15fa30);};}exports[_0x5e37('0x2a')]=function(_0x248bf9,_0x1d5d9f){var _0x58abc8={},_0x2ff59d={},_0x445400={'count':0x0,'rows':[]};var _0x463701=_[_0x5e37('0x2b')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x344e44){return{'name':_0x344e44[_0x5e37('0x2c')],'type':_0x344e44['type'][_0x5e37('0x2d')]};});_0x2ff59d[_0x5e37('0x2e')]=_[_0x5e37('0x2b')](_0x463701,_0x5e37('0x28'));_0x2ff59d[_0x5e37('0x2f')]=_[_0x5e37('0x30')](_0x248bf9[_0x5e37('0x2f')]);_0x2ff59d[_0x5e37('0x31')]=_[_0x5e37('0x32')](_0x2ff59d['model'],_0x2ff59d[_0x5e37('0x2f')]);_0x58abc8['attributes']=_[_0x5e37('0x32')](_0x2ff59d[_0x5e37('0x2e')],qs['fields'](_0x248bf9[_0x5e37('0x2f')][_0x5e37('0x33')]));_0x58abc8['attributes']=_0x58abc8[_0x5e37('0x34')][_0x5e37('0x35')]?_0x58abc8[_0x5e37('0x34')]:_0x2ff59d[_0x5e37('0x2e')];if(!_0x248bf9[_0x5e37('0x2f')]['hasOwnProperty'](_0x5e37('0x36'))){_0x58abc8['limit']=qs[_0x5e37('0x37')](_0x248bf9['query'][_0x5e37('0x37')]);_0x58abc8[_0x5e37('0x1d')]=qs[_0x5e37('0x1d')](_0x248bf9[_0x5e37('0x2f')][_0x5e37('0x1d')]);}_0x58abc8['order']=qs[_0x5e37('0x38')](_0x248bf9['query']['sort']);_0x58abc8[_0x5e37('0x39')]=qs[_0x5e37('0x31')](_['pick'](_0x248bf9[_0x5e37('0x2f')],_0x2ff59d['filters']),_0x463701);if(_0x248bf9[_0x5e37('0x2f')][_0x5e37('0x3a')]){_0x58abc8[_0x5e37('0x39')]=_['merge'](_0x58abc8[_0x5e37('0x39')],{'$or':_[_0x5e37('0x2b')](_0x463701,function(_0x5d8f56){if(_0x5d8f56['type']!==_0x5e37('0x3b')){var _0x54c67b={};_0x54c67b[_0x5d8f56[_0x5e37('0x28')]]={'$like':'%'+_0x248bf9['query'][_0x5e37('0x3a')]+'%'};return _0x54c67b;}})});}_0x58abc8=_[_0x5e37('0x3c')]({},_0x58abc8,_0x248bf9[_0x5e37('0x3d')]);var _0x1f3a8b={'where':_0x58abc8[_0x5e37('0x39')]};return db[_0x5e37('0x3e')][_0x5e37('0x1c')](_0x1f3a8b)[_0x5e37('0x24')](function(_0x48f0c3){_0x445400[_0x5e37('0x1c')]=_0x48f0c3;if(_0x248bf9[_0x5e37('0x2f')][_0x5e37('0x3f')]){_0x58abc8['include']=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x5e37('0x40')](_0x58abc8);})[_0x5e37('0x24')](function(_0x1472c7){_0x445400[_0x5e37('0x41')]=_0x1472c7;return _0x445400;})[_0x5e37('0x24')](respondWithFilteredResult(_0x1d5d9f,_0x58abc8))[_0x5e37('0x42')](handleError(_0x1d5d9f,null));};exports[_0x5e37('0x43')]=function(_0x21bce3,_0x285ceb){var _0x3a21e2={'raw':!![],'where':{'id':_0x21bce3[_0x5e37('0x44')]['id']}},_0x43f461={};_0x43f461[_0x5e37('0x2e')]=_[_0x5e37('0x30')](db['AnalyticDefaultReport'][_0x5e37('0x45')]);_0x43f461['query']=_[_0x5e37('0x30')](_0x21bce3[_0x5e37('0x2f')]);_0x43f461[_0x5e37('0x46')]=_[_0x5e37('0x32')](_0x43f461[_0x5e37('0x2e')],_0x43f461[_0x5e37('0x2f')]);_0x3a21e2[_0x5e37('0x34')]=_['intersection'](_0x43f461[_0x5e37('0x2e')],qs['fields'](_0x21bce3[_0x5e37('0x2f')][_0x5e37('0x33')]));_0x3a21e2['attributes']=_0x3a21e2[_0x5e37('0x34')][_0x5e37('0x35')]?_0x3a21e2[_0x5e37('0x34')]:_0x43f461[_0x5e37('0x2e')];if(_0x21bce3[_0x5e37('0x2f')]['includeAll']){_0x3a21e2['include']=[{'all':!![]}];}_0x3a21e2=_[_0x5e37('0x3c')]({},_0x3a21e2,_0x21bce3[_0x5e37('0x3d')]);return db[_0x5e37('0x3e')][_0x5e37('0x47')](_0x3a21e2)[_0x5e37('0x24')](handleEntityNotFound(_0x285ceb,null))[_0x5e37('0x24')](respondWithResult(_0x285ceb,null))[_0x5e37('0x42')](handleError(_0x285ceb,null));};exports[_0x5e37('0x48')]=function(_0x53240f,_0x23b236){return db[_0x5e37('0x3e')][_0x5e37('0x48')](_0x53240f[_0x5e37('0x49')],{})['then'](function(_0x3227ab){var _0x313677=_0x53240f['user'][_0x5e37('0x4a')]({'plain':!![]});if(!_0x313677)throw new Error(_0x5e37('0x4b'));if(_0x313677[_0x5e37('0x4c')]===_0x5e37('0x4d')){var _0x164993=_0x3227ab[_0x5e37('0x4a')]({'plain':!![]});var _0x110100=_0x5e37('0x4e');return db[_0x5e37('0x4f')][_0x5e37('0x47')]({'where':{'name':_0x110100,'userProfileId':_0x313677[_0x5e37('0x50')]},'raw':!![]})[_0x5e37('0x24')](function(_0x2c643d){if(_0x2c643d&&_0x2c643d[_0x5e37('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x164993['name'],'resourceId':_0x164993['id'],'type':'DefaultReports','sectionId':_0x2c643d['id']},{})[_0x5e37('0x24')](function(){return _0x3227ab;});}else{return _0x3227ab;}})[_0x5e37('0x42')](function(_0x198863){logger[_0x5e37('0x26')](_0x5e37('0x52'),_0x198863);throw _0x198863;});}return _0x3227ab;})[_0x5e37('0x24')](respondWithResult(_0x23b236,0xc9))[_0x5e37('0x42')](handleError(_0x23b236,null));};exports[_0x5e37('0x23')]=function(_0x176a4e,_0x174a6c){if(_0x176a4e[_0x5e37('0x49')]['id']){delete _0x176a4e[_0x5e37('0x49')]['id'];}return db[_0x5e37('0x3e')][_0x5e37('0x47')]({'where':{'id':_0x176a4e[_0x5e37('0x44')]['id']}})[_0x5e37('0x24')](handleEntityNotFound(_0x174a6c,null))[_0x5e37('0x24')](saveUpdates(_0x176a4e[_0x5e37('0x49')],null))[_0x5e37('0x24')](respondWithResult(_0x174a6c,null))['catch'](handleError(_0x174a6c,null));};exports[_0x5e37('0x53')]=function(_0x3e697a,_0x21adff){return db[_0x5e37('0x3e')]['find']({'where':{'id':_0x3e697a[_0x5e37('0x44')]['id']}})[_0x5e37('0x24')](handleEntityNotFound(_0x21adff,null))[_0x5e37('0x24')](removeEntity(_0x21adff,null))[_0x5e37('0x42')](handleError(_0x21adff,null));};exports[_0x5e37('0x54')]=function(_0x241855,_0x2a8bf8){var _0x1cb9e7=0xa;var _0x2ad949=['join',_0x5e37('0x55'),_0x5e37('0x56'),'cross_join'];var _0x258079={'SUM':_0x5e37('0x57'),'COUNT':_0x5e37('0x58'),'COUNT DISTINCT':_0x5e37('0x59'),'MAX':_0x5e37('0x5a'),'MIN':_0x5e37('0x5b'),'AVG':_0x5e37('0x5c'),'GROUP_CONCAT':_0x5e37('0x5d'),'GROUP_CONCAT ASC':_0x5e37('0x5e'),'GROUP_CONCAT DESC':_0x5e37('0x5f')};var _0x1faea2={'SEC_TO_TIME':_0x5e37('0x60'),'DATE':_0x5e37('0x61'),'HOUR':'HOUR(%s)','ROUND':_0x5e37('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xff481f=function(_0x54f5a0){return!_['includes']([_0x5e37('0x63'),_0x5e37('0x64'),_0x5e37('0x65'),_0x5e37('0x66')],_0x54f5a0);};var _0x2dae43=function(_0x2ea1b2){if(!_0x2ea1b2||!_0x2ea1b2[_0x5e37('0x67')][_0x5e37('0x35')]){return'';}for(var _0x221700='(',_0x111c3b=0x0;_0x111c3b<_0x2ea1b2[_0x5e37('0x67')][_0x5e37('0x35')];_0x111c3b+=0x1){_0x111c3b>0x0&&(_0x221700+='\x20'+_0x2ea1b2[_0x5e37('0x68')]+'\x20');_0x221700+=_0x2ea1b2[_0x5e37('0x67')][_0x111c3b][_0x5e37('0x69')]?_0x2dae43(_0x2ea1b2[_0x5e37('0x67')][_0x111c3b]['group']):_0x2ea1b2[_0x5e37('0x67')][_0x111c3b][_0x5e37('0x6a')]+'\x20'+_0x2ea1b2['rules'][_0x111c3b]['condition']+(_0xff481f(_0x2ea1b2[_0x5e37('0x67')][_0x111c3b][_0x5e37('0x6b')])?'\x20'+_0x2ea1b2[_0x5e37('0x67')][_0x111c3b]['value']:'');}return _0x221700+')';};var _0xcaa83b={'where':{'id':_0x241855[_0x5e37('0x44')]['id']}},_0x2f39ff,_0x543331,_0x421e5b,_0x3b8015,_0x1f19d8;_0xcaa83b=_[_0x5e37('0x3c')]({},_0xcaa83b,_0x241855[_0x5e37('0x3d')]);return db[_0x5e37('0x3e')][_0x5e37('0x47')](_0xcaa83b)[_0x5e37('0x24')](function(_0x48ef23){if(_0x48ef23){_0x2f39ff=_0x48ef23;return _0x48ef23[_0x5e37('0x6c')]();}return null;})['then'](function(_0xcca263){if(_0xcca263){if(!_0xcca263[_0x5e37('0x35')]){throw new db[(_0x5e37('0x6d'))]['ValidationErrorItem'](_0x5e37('0x6e'),0x193);}_0x543331=_0xcca263;return db[_0x5e37('0x6f')][_0x5e37('0x40')]({'raw':!![]});}return null;})[_0x5e37('0x24')](function(_0x19584d){if(_0x19584d){_0x421e5b=_[_0x5e37('0x70')](_0x19584d,'id');var _0x213b1e;var _0x2c8f4f=squel[_0x5e37('0x71')]();_0x2c8f4f['from'](_0x2f39ff[_0x5e37('0x72')]);for(var _0x3f0a9b=0x0;_0x3f0a9b<_0x543331[_0x5e37('0x35')];_0x3f0a9b+=0x1){_0x213b1e=_0x543331[_0x3f0a9b][_0x5e37('0x73')]?_0x421e5b[_0x543331[_0x3f0a9b][_0x5e37('0x73')]][_0x5e37('0x74')]:_0x543331[_0x3f0a9b][_0x5e37('0x6a')];_0x213b1e=_0x543331[_0x3f0a9b][_0x5e37('0x75')]?_['replace'](_0x258079[_0x543331[_0x3f0a9b][_0x5e37('0x75')]],'%s',_0x213b1e):_0x213b1e;_0x213b1e=_0x543331[_0x3f0a9b]['format']?_['replace'](_0x1faea2[_0x543331[_0x3f0a9b][_0x5e37('0x76')]],'%s',_0x213b1e):_0x213b1e;if(_0x543331[_0x3f0a9b][_0x5e37('0x77')]){_0x2c8f4f[_0x5e37('0x69')](_0x213b1e);}_0x543331[_0x3f0a9b][_0x5e37('0x78')]&&_0x2c8f4f[_0x5e37('0x79')](_0x213b1e,_0x543331[_0x3f0a9b]['orderBy']===_0x5e37('0x7a')?![]:!![]);_0x2c8f4f[_0x5e37('0x6a')](_0x213b1e,_0x543331[_0x3f0a9b]['alias']||_0x213b1e);}if(_0x2f39ff['joins']){_0x2f39ff[_0x5e37('0x7b')]=JSON['parse'](_0x2f39ff[_0x5e37('0x7b')]);for(var _0x2eb428=0x0;_0x2eb428<_0x2f39ff['joins'][_0x5e37('0x35')];_0x2eb428+=0x1){if(_0x2f39ff[_0x5e37('0x7b')][_0x2eb428][_0x5e37('0x7c')]&&_[_0x5e37('0x7d')](_0x2ad949,_0x2f39ff['joins'][_0x2eb428][_0x5e37('0x7c')])&&_0x2f39ff[_0x5e37('0x7b')][_0x2eb428][_0x5e37('0x7e')]&&_0x2f39ff[_0x5e37('0x7b')][_0x2eb428][_0x5e37('0x7f')]&&_0x2f39ff[_0x5e37('0x7b')][_0x2eb428][_0x5e37('0x80')]){_0x2c8f4f[_0x2f39ff[_0x5e37('0x7b')][_0x2eb428][_0x5e37('0x7c')]](_0x2f39ff[_0x5e37('0x7b')][_0x2eb428][_0x5e37('0x7f')],null,util[_0x5e37('0x76')]('%s.%s\x20=\x20%s.%s',_0x2f39ff[_0x5e37('0x72')],_0x2f39ff['joins'][_0x2eb428][_0x5e37('0x7e')],_0x2f39ff[_0x5e37('0x7b')][_0x2eb428]['foreignTable'],_0x2f39ff[_0x5e37('0x7b')][_0x2eb428][_0x5e37('0x80')]));}}}if(_0x2f39ff['conditions']){_0x2f39ff[_0x5e37('0x81')]=JSON['parse'](_0x2f39ff['conditions']);_0x2c8f4f[_0x5e37('0x39')](_0x2dae43(_0x2f39ff[_0x5e37('0x81')]['group']));}_0x1f19d8=_0x2c8f4f[_0x5e37('0x82')]();_0x2c8f4f[_0x5e37('0x37')](_0x1cb9e7);_0x2c8f4f[_0x5e37('0x1d')](0x0);logger['debug'](_0x5e37('0x83'),_0x2c8f4f[_0x5e37('0x84')]());return db[_0x5e37('0x85')][_0x5e37('0x2f')](_0x2c8f4f['toString'](),{'type':db[_0x5e37('0x85')][_0x5e37('0x86')][_0x5e37('0x87')]});}})['then'](respondWithResult(_0x2a8bf8,null))[_0x5e37('0x42')](handleError(_0x2a8bf8,null));};function runReport(_0x380415,_0x2c7b91,_0x15d92e){var _0x163992=_0x2c7b91['name'];var _0x3fa31d=0xa;var _0x4b39b5=[_0x5e37('0x88'),_0x5e37('0x55'),_0x5e37('0x56'),_0x5e37('0x89')];var _0x16ee77={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5e37('0x59'),'MAX':'MAX(%s)','MIN':_0x5e37('0x5b'),'AVG':_0x5e37('0x5c'),'GROUP_CONCAT':_0x5e37('0x5d'),'GROUP_CONCAT ASC':_0x5e37('0x5e'),'GROUP_CONCAT DESC':_0x5e37('0x5f')};var _0x252f43={'SEC_TO_TIME':_0x5e37('0x60'),'DATE':_0x5e37('0x61'),'HOUR':_0x5e37('0x8a'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5e37('0x8b')};var _0x7d384=function(_0x384dfc){return!_[_0x5e37('0x7d')]([_0x5e37('0x63'),_0x5e37('0x64'),_0x5e37('0x65'),_0x5e37('0x66')],_0x384dfc);};var _0x4dfd6b=function(_0x4249cd){if(!_0x4249cd||!_0x4249cd[_0x5e37('0x67')][_0x5e37('0x35')]){return'';}for(var _0x410ab0='(',_0x1427eb=0x0;_0x1427eb<_0x4249cd[_0x5e37('0x67')]['length'];_0x1427eb+=0x1){_0x1427eb>0x0&&(_0x410ab0+='\x20'+_0x4249cd[_0x5e37('0x68')]+'\x20');_0x410ab0+=_0x4249cd[_0x5e37('0x67')][_0x1427eb][_0x5e37('0x69')]?_0x4dfd6b(_0x4249cd[_0x5e37('0x67')][_0x1427eb][_0x5e37('0x69')]):_0x4249cd[_0x5e37('0x67')][_0x1427eb]['field']+'\x20'+_0x4249cd[_0x5e37('0x67')][_0x1427eb][_0x5e37('0x6b')]+(_0x7d384(_0x4249cd[_0x5e37('0x67')][_0x1427eb][_0x5e37('0x6b')])?'\x20'+_0x4249cd[_0x5e37('0x67')][_0x1427eb][_0x5e37('0x8c')]:'');}return _0x410ab0+')';};var _0x1a832c={'where':{'id':_0x380415['id']}},_0x342e3c,_0x278dd7,_0x276c59,_0x4b3c90,_0x28c060;_0x1a832c=_[_0x5e37('0x3c')]({},_0x1a832c,_0x15d92e);return db[_0x5e37('0x3e')]['find'](_0x1a832c)[_0x5e37('0x24')](function(_0x1ce8a3){if(_0x1ce8a3){_0x342e3c=_0x1ce8a3;return _0x1ce8a3[_0x5e37('0x6c')]();}return null;})['then'](function(_0x5d51cb){if(_0x5d51cb){if(!_0x5d51cb[_0x5e37('0x35')]){throw new db['Sequelize'][(_0x5e37('0x8d'))](_0x5e37('0x6e'),0x193);}_0x278dd7=_0x5d51cb;return db[_0x5e37('0x6f')]['findAll']({'raw':!![]});}return null;})[_0x5e37('0x24')](function(_0x580b0f){if(_0x580b0f){_0x276c59=_[_0x5e37('0x70')](_0x580b0f,'id');var _0x2420af;var _0xc27e72=squel[_0x5e37('0x71')]();_0xc27e72[_0x5e37('0x8e')](_0x342e3c[_0x5e37('0x72')]);for(var _0x2eda80=0x0;_0x2eda80<_0x278dd7[_0x5e37('0x35')];_0x2eda80+=0x1){_0x2420af=_0x278dd7[_0x2eda80][_0x5e37('0x73')]?_0x276c59[_0x278dd7[_0x2eda80][_0x5e37('0x73')]][_0x5e37('0x74')]:_0x278dd7[_0x2eda80][_0x5e37('0x6a')];_0x2420af=_0x278dd7[_0x2eda80][_0x5e37('0x75')]?_[_0x5e37('0x8f')](_0x16ee77[_0x278dd7[_0x2eda80][_0x5e37('0x75')]],'%s',_0x2420af):_0x2420af;_0x2420af=_0x278dd7[_0x2eda80]['format']?_['replace'](_0x252f43[_0x278dd7[_0x2eda80][_0x5e37('0x76')]],'%s',_0x2420af):_0x2420af;if(_0x278dd7[_0x2eda80][_0x5e37('0x77')]){_0xc27e72[_0x5e37('0x69')](_0x2420af);}_0x278dd7[_0x2eda80]['orderBy']&&_0xc27e72[_0x5e37('0x79')](_0x2420af,_0x278dd7[_0x2eda80][_0x5e37('0x78')]===_0x5e37('0x7a')?![]:!![]);_0xc27e72['field'](_0x2420af,_0x278dd7[_0x2eda80][_0x5e37('0x90')]||_0x2420af);}if(_0x342e3c[_0x5e37('0x7b')]){_0x342e3c[_0x5e37('0x7b')]=JSON[_0x5e37('0x91')](_0x342e3c['joins']);for(var _0x2c37fa=0x0;_0x2c37fa<_0x342e3c[_0x5e37('0x7b')][_0x5e37('0x35')];_0x2c37fa+=0x1){if(_0x342e3c[_0x5e37('0x7b')][_0x2c37fa][_0x5e37('0x7c')]&&_[_0x5e37('0x7d')](_0x4b39b5,_0x342e3c[_0x5e37('0x7b')][_0x2c37fa][_0x5e37('0x7c')])&&_0x342e3c[_0x5e37('0x7b')][_0x2c37fa][_0x5e37('0x7e')]&&_0x342e3c[_0x5e37('0x7b')][_0x2c37fa]['foreignTable']&&_0x342e3c[_0x5e37('0x7b')][_0x2c37fa]['foreignKey']){_0xc27e72[_0x342e3c[_0x5e37('0x7b')][_0x2c37fa][_0x5e37('0x7c')]](_0x342e3c['joins'][_0x2c37fa]['foreignTable'],null,util[_0x5e37('0x76')](_0x5e37('0x92'),_0x342e3c[_0x5e37('0x72')],_0x342e3c[_0x5e37('0x7b')][_0x2c37fa][_0x5e37('0x7e')],_0x342e3c[_0x5e37('0x7b')][_0x2c37fa]['foreignTable'],_0x342e3c[_0x5e37('0x7b')][_0x2c37fa][_0x5e37('0x80')]));}}}if(_0x342e3c[_0x5e37('0x81')]){_0x342e3c['conditions']=JSON['parse'](_0x342e3c[_0x5e37('0x81')]);_0xc27e72[_0x5e37('0x39')](_0x4dfd6b(_0x342e3c[_0x5e37('0x81')][_0x5e37('0x69')]));}_0x28c060=_0xc27e72[_0x5e37('0x82')]();_0xc27e72[_0x5e37('0x37')](_0x3fa31d);_0xc27e72[_0x5e37('0x1d')](0x0);logger[_0x5e37('0x93')](_0x5e37('0x83'),_0xc27e72[_0x5e37('0x84')]());return db[_0x5e37('0x85')][_0x5e37('0x2f')](_0xc27e72[_0x5e37('0x84')](),{'type':db[_0x5e37('0x85')][_0x5e37('0x86')][_0x5e37('0x87')]});}})['then'](function(_0x419b12){if(!_0x419b12[_0x5e37('0x35')]){throw new db[(_0x5e37('0x6d'))][(_0x5e37('0x8d'))]('No\x20available\x20data',0xcc);}if(_0x2c7b91[_0x5e37('0x94')]===_0x5e37('0x95')){return null;}var _0x624c0f=_[_0x5e37('0x3c')](_0x2c7b91,{'name':_0x2c7b91[_0x5e37('0x96')]||_0x2c7b91[_0x5e37('0x28')]||_0x342e3c[_0x5e37('0x28')],'basename':_0x163992,'savename':util[_0x5e37('0x76')](_0x5e37('0x97'),_0x2c7b91[_0x5e37('0x28')]||_0x342e3c[_0x5e37('0x28')],require(_0x5e37('0x98'))['generate'](0x4),_0x2c7b91[_0x5e37('0x94')]||_0x5e37('0x99')),'reportId':_0x342e3c['id'],'reportType':_0x5e37('0x9a')});return db['AnalyticExtractedReport'][_0x5e37('0x48')](_0x624c0f,{'raw':!![]});})['then'](function(_0x59c1e5){if(_0x342e3c[_0x5e37('0x72')]===_0x5e37('0x9b')){_0x28c060[_0x5e37('0x39')](_0x342e3c[_0x5e37('0x72')]+_0x5e37('0x9c'),_0x2c7b91[_0x5e37('0x9d')],_0x2c7b91[_0x5e37('0x9e')]);}else{_0x28c060[_0x5e37('0x39')](_0x342e3c[_0x5e37('0x72')]+_0x5e37('0x9f'),_0x2c7b91[_0x5e37('0x9d')],_0x2c7b91['endDate']);}if(_0x59c1e5){logger[_0x5e37('0xa0')](_0x5e37('0xa1'),_0x28c060[_0x5e37('0x84')]());require(_0x5e37('0xa2'))[_0x5e37('0xa3')](path[_0x5e37('0x88')](__dirname,'../../components/export/',_0x59c1e5['output']),[_0x59c1e5['id'],_0x28c060['toString'](),path[_0x5e37('0x88')](__dirname,'../../files/reports',_0x59c1e5[_0x5e37('0xa4')]),_0x163992]);return _0x59c1e5;}else{var _0x160cbc=squel[_0x5e37('0x71')]();_0x160cbc[_0x5e37('0x8e')]('('+_0x28c060[_0x5e37('0x84')]()+')',_0x5e37('0xa5'));_0x160cbc[_0x5e37('0x6a')](_0x5e37('0xa6'),_0x5e37('0x1c'));_0x28c060[_0x5e37('0x37')](_0x2c7b91[_0x5e37('0x37')]||_0x3fa31d);_0x28c060[_0x5e37('0x1d')](_0x2c7b91[_0x5e37('0x1d')]||0x0);return dbH[_0x5e37('0x85')][_0x5e37('0x2f')](_0x160cbc['toString'](),{'type':dbH[_0x5e37('0x85')]['QueryTypes'][_0x5e37('0x87')]})[_0x5e37('0x24')](function(_0x3801f5){if(!_0x3801f5[_0x5e37('0x35')]){_0x4b3c90=0x0;}else{_0x4b3c90=_0x3801f5[0x0][_0x5e37('0x1c')]||0x0;}return dbH[_0x5e37('0x85')][_0x5e37('0x2f')](_0x28c060[_0x5e37('0x84')](),{'type':dbH[_0x5e37('0x85')][_0x5e37('0x86')][_0x5e37('0x87')]});})[_0x5e37('0x24')](function(_0x46d21b){return{'rows':_0x46d21b||[],'count':_0x4b3c90};});}});}exports[_0x5e37('0xa7')]=function(_0x571718,_0x1c9790){return runReport(_0x571718['params'],_0x571718[_0x5e37('0x2f')],_0x571718[_0x5e37('0x3d')])['then'](respondWithResult(_0x1c9790,null))[_0x5e37('0x42')](handleError(_0x1c9790,null));};exports[_0x5e37('0xa8')]=runReport;exports['query']=function(_0x5af176,_0x92ed3b){var _0x2c88b3=0xa;var _0x53257=[_0x5e37('0x88'),'left_join',_0x5e37('0x56'),_0x5e37('0x89')];var _0x164709={'SUM':_0x5e37('0x57'),'COUNT':_0x5e37('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x5e37('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x5e37('0x5d'),'GROUP_CONCAT ASC':_0x5e37('0x5e'),'GROUP_CONCAT DESC':_0x5e37('0x5f')};var _0xd67e1d={'SEC_TO_TIME':_0x5e37('0x60'),'DATE':_0x5e37('0x61'),'HOUR':_0x5e37('0x8a'),'ROUND':_0x5e37('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x265e41=function(_0x4ebac7){return!_[_0x5e37('0x7d')]([_0x5e37('0x63'),_0x5e37('0x64'),_0x5e37('0x65'),'IS\x20NOT\x20EMPTY'],_0x4ebac7);};var _0x21199f=function(_0x55d137){if(!_0x55d137||!_0x55d137[_0x5e37('0x67')][_0x5e37('0x35')]){return'';}for(var _0x3050a0='(',_0xb180e2=0x0;_0xb180e2<_0x55d137[_0x5e37('0x67')][_0x5e37('0x35')];_0xb180e2+=0x1){_0xb180e2>0x0&&(_0x3050a0+='\x20'+_0x55d137[_0x5e37('0x68')]+'\x20');_0x3050a0+=_0x55d137[_0x5e37('0x67')][_0xb180e2][_0x5e37('0x69')]?_0x21199f(_0x55d137['rules'][_0xb180e2][_0x5e37('0x69')]):_0x55d137[_0x5e37('0x67')][_0xb180e2]['field']+'\x20'+_0x55d137['rules'][_0xb180e2][_0x5e37('0x6b')]+(_0x265e41(_0x55d137[_0x5e37('0x67')][_0xb180e2]['condition'])?'\x20'+_0x55d137[_0x5e37('0x67')][_0xb180e2][_0x5e37('0x8c')]:'');}return _0x3050a0+')';};var _0x4ac84a={'where':{'id':_0x5af176[_0x5e37('0x44')]['id']}},_0x5d08b1,_0x1a33e4,_0x38c7c9,_0xf45dfe,_0x21c933;_0x4ac84a=_[_0x5e37('0x3c')]({},_0x4ac84a,_0x5af176[_0x5e37('0x3d')]);return db['AnalyticDefaultReport'][_0x5e37('0x47')](_0x4ac84a)[_0x5e37('0x24')](function(_0x1fb8cb){if(_0x1fb8cb){_0x5d08b1=_0x1fb8cb;return _0x1fb8cb[_0x5e37('0x6c')]();}return null;})[_0x5e37('0x24')](function(_0xccb940){if(_0xccb940){if(!_0xccb940[_0x5e37('0x35')]){throw new db[(_0x5e37('0x6d'))][(_0x5e37('0x8d'))](_0x5e37('0x6e'),0x193);}_0x1a33e4=_0xccb940;return db['AnalyticMetric'][_0x5e37('0x40')]({'raw':!![]});}return null;})[_0x5e37('0x24')](function(_0x5ee9b3){if(_0x5ee9b3){_0x38c7c9=_[_0x5e37('0x70')](_0x5ee9b3,'id');var _0x171b2f;var _0xe9b47c=squel[_0x5e37('0x71')]();_0xe9b47c[_0x5e37('0x8e')](_0x5d08b1[_0x5e37('0x72')]);for(var _0x487845=0x0;_0x487845<_0x1a33e4[_0x5e37('0x35')];_0x487845+=0x1){_0x171b2f=_0x1a33e4[_0x487845][_0x5e37('0x73')]?_0x38c7c9[_0x1a33e4[_0x487845][_0x5e37('0x73')]][_0x5e37('0x74')]:_0x1a33e4[_0x487845]['field'];_0x171b2f=_0x1a33e4[_0x487845][_0x5e37('0x75')]?_[_0x5e37('0x8f')](_0x164709[_0x1a33e4[_0x487845][_0x5e37('0x75')]],'%s',_0x171b2f):_0x171b2f;_0x171b2f=_0x1a33e4[_0x487845]['format']?_[_0x5e37('0x8f')](_0xd67e1d[_0x1a33e4[_0x487845][_0x5e37('0x76')]],'%s',_0x171b2f):_0x171b2f;if(_0x1a33e4[_0x487845][_0x5e37('0x77')]){_0xe9b47c[_0x5e37('0x69')](_0x171b2f);}_0x1a33e4[_0x487845][_0x5e37('0x78')]&&_0xe9b47c['order'](_0x171b2f,_0x1a33e4[_0x487845]['orderBy']===_0x5e37('0x7a')?![]:!![]);_0xe9b47c['field'](_0x171b2f,_0x1a33e4[_0x487845]['alias']||_0x171b2f);}if(_0x5d08b1['joins']){_0x5d08b1[_0x5e37('0x7b')]=JSON[_0x5e37('0x91')](_0x5d08b1[_0x5e37('0x7b')]);for(var _0x5b9bf2=0x0;_0x5b9bf2<_0x5d08b1[_0x5e37('0x7b')]['length'];_0x5b9bf2+=0x1){if(_0x5d08b1[_0x5e37('0x7b')][_0x5b9bf2][_0x5e37('0x7c')]&&_[_0x5e37('0x7d')](_0x53257,_0x5d08b1[_0x5e37('0x7b')][_0x5b9bf2][_0x5e37('0x7c')])&&_0x5d08b1[_0x5e37('0x7b')][_0x5b9bf2][_0x5e37('0x7e')]&&_0x5d08b1[_0x5e37('0x7b')][_0x5b9bf2][_0x5e37('0x7f')]&&_0x5d08b1[_0x5e37('0x7b')][_0x5b9bf2][_0x5e37('0x80')]){_0xe9b47c[_0x5d08b1['joins'][_0x5b9bf2][_0x5e37('0x7c')]](_0x5d08b1[_0x5e37('0x7b')][_0x5b9bf2]['foreignTable'],null,util[_0x5e37('0x76')](_0x5e37('0x92'),_0x5d08b1['table'],_0x5d08b1[_0x5e37('0x7b')][_0x5b9bf2][_0x5e37('0x7e')],_0x5d08b1['joins'][_0x5b9bf2][_0x5e37('0x7f')],_0x5d08b1[_0x5e37('0x7b')][_0x5b9bf2][_0x5e37('0x80')]));}}}if(_0x5d08b1['conditions']){_0x5d08b1[_0x5e37('0x81')]=JSON[_0x5e37('0x91')](_0x5d08b1[_0x5e37('0x81')]);_0xe9b47c[_0x5e37('0x39')](_0x21199f(_0x5d08b1[_0x5e37('0x81')][_0x5e37('0x69')]));}_0x21c933=_0xe9b47c[_0x5e37('0x82')]();_0xe9b47c['limit'](_0x2c88b3);_0xe9b47c[_0x5e37('0x1d')](0x0);logger[_0x5e37('0x93')](_0x5e37('0x83'),_0xe9b47c[_0x5e37('0x84')]());return db['sequelize'][_0x5e37('0x2f')](_0xe9b47c[_0x5e37('0x84')](),{'type':db[_0x5e37('0x85')][_0x5e37('0x86')][_0x5e37('0x87')]});}})[_0x5e37('0x24')](function(){return{'sql':_0x21c933[_0x5e37('0x84')]()};})[_0x5e37('0x24')](respondWithResult(_0x92ed3b,null))['catch'](handleError(_0x92ed3b,null));}; \ No newline at end of file +var _0x4e75=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','keys','catch','create','body','user','Reports','UserProfileSection','find','DefaultReports','params','preview','join','left_join','right_join','cross_join','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','rules','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','MetricId','metric','function','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignKey','foreignTable','table','conditions','parse','clone','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','value','keyBy','replace','%s.%s\x20=\x20%s.%s','debug','Limited\x20Query:','toString','No\x20available\x20data','fullPath','%s-%s.%s','randomstring','generate','output','csv','default','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','child_process','savename','COUNT(*)','run','runReport','COUNT(DISTINCT\x20%s)','from','html-pdf','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','json','count','offset','limit','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x5e96a6,_0x30e673){var _0x249082=function(_0x1b4ebc){while(--_0x1b4ebc){_0x5e96a6['push'](_0x5e96a6['shift']());}};_0x249082(++_0x30e673);}(_0x4e75,0x107));var _0x54e7=function(_0x253a4c,_0x18114c){_0x253a4c=_0x253a4c-0x0;var _0x194adb=_0x4e75[_0x253a4c];return _0x194adb;};'use strict';var pdf=require(_0x54e7('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x54e7('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x54e7('0x2'));var Mustache=require(_0x54e7('0x3'));var util=require('util');var path=require(_0x54e7('0x4'));var sox=require(_0x54e7('0x5'));var csv=require(_0x54e7('0x6'));var ejs=require(_0x54e7('0x7'));var fs=require('fs');var _=require(_0x54e7('0x8'));var squel=require('squel');var crypto=require(_0x54e7('0x9'));var jsforce=require(_0x54e7('0xa'));var deskjs=require(_0x54e7('0xb'));var toCsv=require(_0x54e7('0x6'));var querystring=require('querystring');var Papa=require(_0x54e7('0xc'));var Redis=require('ioredis');var authService=require(_0x54e7('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x54e7('0xe'));var hardwareService=require(_0x54e7('0xf'));var logger=require('../../config/logger')(_0x54e7('0x10'));var utils=require(_0x54e7('0x11'));var config=require(_0x54e7('0x12'));var licenseUtil=require(_0x54e7('0x13'));var db=require('../../mysqldb')['db'];var dbH=require(_0x54e7('0x14'))[_0x54e7('0x15')];function respondWithStatusCode(_0x4663ba,_0x2d217e){_0x2d217e=_0x2d217e||0xcc;return function(_0x515532){if(_0x515532){return _0x4663ba['sendStatus'](_0x2d217e);}return _0x4663ba[_0x54e7('0x16')](_0x2d217e)['end']();};}function respondWithResult(_0xeb2d38,_0x21bdbd){_0x21bdbd=_0x21bdbd||0xc8;return function(_0x59c19c){if(_0x59c19c){return _0xeb2d38['status'](_0x21bdbd)[_0x54e7('0x17')](_0x59c19c);}};}function respondWithFilteredResult(_0x5784dd,_0x5167fc){return function(_0xf851af){if(_0xf851af){var _0xa4d3c0=_0xf851af[_0x54e7('0x18')],_0x48866d=_0x5167fc['offset'],_0x3153f7=_0x5167fc[_0x54e7('0x19')]+_0x5167fc[_0x54e7('0x1a')],_0x2e1702;if(_0x3153f7>=_0xa4d3c0){_0x3153f7=_0xa4d3c0;_0x2e1702=0xc8;}else{_0x2e1702=0xce;}_0x5784dd[_0x54e7('0x16')](_0x2e1702);return _0x5784dd['set']('Content-Range',_0x48866d+'-'+_0x3153f7+'/'+_0xa4d3c0)[_0x54e7('0x17')](_0xf851af);}return null;};}function patchUpdates(_0x2c22a4){return function(_0x52784a){try{jsonpatch['apply'](_0x52784a,_0x2c22a4,!![]);}catch(_0x565aa4){return BPromise[_0x54e7('0x1b')](_0x565aa4);}return _0x52784a[_0x54e7('0x1c')]();};}function saveUpdates(_0x1ff379,_0x5a5074){return function(_0x1c93b5){if(_0x1c93b5){return _0x1c93b5[_0x54e7('0x1d')](_0x1ff379)[_0x54e7('0x1e')](function(_0x424311){return _0x424311;});}return null;};}function removeEntity(_0x351b0a,_0x1b9473){return function(_0x52aeb5){if(_0x52aeb5){return _0x52aeb5[_0x54e7('0x1f')]()[_0x54e7('0x1e')](function(){var _0x2a434a=_0x52aeb5[_0x54e7('0x20')]({'plain':!![]});var _0x28a0e1='DefaultReports';return db[_0x54e7('0x21')][_0x54e7('0x1f')]({'where':{'type':_0x28a0e1,'resourceId':_0x2a434a['id']}})[_0x54e7('0x1e')](function(){return _0x52aeb5;});})[_0x54e7('0x1e')](function(){_0x351b0a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9206eb,_0x40ce03){return function(_0x4df8ed){if(!_0x4df8ed){_0x9206eb[_0x54e7('0x22')](0x194);}return _0x4df8ed;};}function handleError(_0x35808c,_0x4277b1){_0x4277b1=_0x4277b1||0x1f4;return function(_0x175db6){logger[_0x54e7('0x23')](_0x175db6[_0x54e7('0x24')]);if(_0x175db6['name']){delete _0x175db6[_0x54e7('0x25')];}_0x35808c[_0x54e7('0x16')](_0x4277b1)[_0x54e7('0x26')](_0x175db6);};}exports[_0x54e7('0x27')]=function(_0x3c7394,_0x7b74ab){var _0x26b312={},_0x278f09={},_0x3c531c={'count':0x0,'rows':[]};var _0x6473ca=_[_0x54e7('0x28')](db[_0x54e7('0x29')][_0x54e7('0x2a')],function(_0x354c30){return{'name':_0x354c30[_0x54e7('0x2b')],'type':_0x354c30[_0x54e7('0x2c')][_0x54e7('0x2d')]};});_0x278f09[_0x54e7('0x2e')]=_['map'](_0x6473ca,_0x54e7('0x25'));_0x278f09[_0x54e7('0x2f')]=_['keys'](_0x3c7394['query']);_0x278f09[_0x54e7('0x30')]=_['intersection'](_0x278f09[_0x54e7('0x2e')],_0x278f09[_0x54e7('0x2f')]);_0x26b312[_0x54e7('0x31')]=_[_0x54e7('0x32')](_0x278f09[_0x54e7('0x2e')],qs[_0x54e7('0x33')](_0x3c7394[_0x54e7('0x2f')][_0x54e7('0x33')]));_0x26b312[_0x54e7('0x31')]=_0x26b312['attributes'][_0x54e7('0x34')]?_0x26b312[_0x54e7('0x31')]:_0x278f09['model'];if(!_0x3c7394['query'][_0x54e7('0x35')](_0x54e7('0x36'))){_0x26b312[_0x54e7('0x1a')]=qs[_0x54e7('0x1a')](_0x3c7394[_0x54e7('0x2f')][_0x54e7('0x1a')]);_0x26b312[_0x54e7('0x19')]=qs['offset'](_0x3c7394['query']['offset']);}_0x26b312[_0x54e7('0x37')]=qs[_0x54e7('0x38')](_0x3c7394[_0x54e7('0x2f')][_0x54e7('0x38')]);_0x26b312['where']=qs[_0x54e7('0x30')](_[_0x54e7('0x39')](_0x3c7394['query'],_0x278f09['filters']),_0x6473ca);if(_0x3c7394['query'][_0x54e7('0x3a')]){_0x26b312[_0x54e7('0x3b')]=_[_0x54e7('0x3c')](_0x26b312[_0x54e7('0x3b')],{'$or':_['map'](_0x6473ca,function(_0x5aa066){if(_0x5aa066[_0x54e7('0x2c')]!==_0x54e7('0x3d')){var _0x5448c7={};_0x5448c7[_0x5aa066[_0x54e7('0x25')]]={'$like':'%'+_0x3c7394[_0x54e7('0x2f')]['filter']+'%'};return _0x5448c7;}})});}_0x26b312=_[_0x54e7('0x3c')]({},_0x26b312,_0x3c7394[_0x54e7('0x3e')]);var _0xcfd4ce={'where':_0x26b312[_0x54e7('0x3b')]};return db[_0x54e7('0x29')]['count'](_0xcfd4ce)['then'](function(_0x35604a){_0x3c531c[_0x54e7('0x18')]=_0x35604a;if(_0x3c7394[_0x54e7('0x2f')][_0x54e7('0x3f')]){_0x26b312[_0x54e7('0x40')]=[{'all':!![]}];}return db[_0x54e7('0x29')][_0x54e7('0x41')](_0x26b312);})[_0x54e7('0x1e')](function(_0x39c876){_0x3c531c[_0x54e7('0x42')]=_0x39c876;return _0x3c531c;})[_0x54e7('0x1e')](respondWithFilteredResult(_0x7b74ab,_0x26b312))['catch'](handleError(_0x7b74ab,null));};exports['show']=function(_0x10909d,_0x56dccb){var _0x80be42={'raw':!![],'where':{'id':_0x10909d['params']['id']}},_0x5470f6={};_0x5470f6[_0x54e7('0x2e')]=_[_0x54e7('0x43')](db['AnalyticDefaultReport'][_0x54e7('0x2a')]);_0x5470f6[_0x54e7('0x2f')]=_[_0x54e7('0x43')](_0x10909d[_0x54e7('0x2f')]);_0x5470f6['filtears']=_[_0x54e7('0x32')](_0x5470f6[_0x54e7('0x2e')],_0x5470f6[_0x54e7('0x2f')]);_0x80be42[_0x54e7('0x31')]=_['intersection'](_0x5470f6[_0x54e7('0x2e')],qs['fields'](_0x10909d['query'][_0x54e7('0x33')]));_0x80be42[_0x54e7('0x31')]=_0x80be42[_0x54e7('0x31')][_0x54e7('0x34')]?_0x80be42[_0x54e7('0x31')]:_0x5470f6[_0x54e7('0x2e')];if(_0x10909d[_0x54e7('0x2f')][_0x54e7('0x3f')]){_0x80be42[_0x54e7('0x40')]=[{'all':!![]}];}_0x80be42=_['merge']({},_0x80be42,_0x10909d['options']);return db[_0x54e7('0x29')]['find'](_0x80be42)[_0x54e7('0x1e')](handleEntityNotFound(_0x56dccb,null))[_0x54e7('0x1e')](respondWithResult(_0x56dccb,null))[_0x54e7('0x44')](handleError(_0x56dccb,null));};exports[_0x54e7('0x45')]=function(_0x131e83,_0xe36db6){return db['AnalyticDefaultReport'][_0x54e7('0x45')](_0x131e83[_0x54e7('0x46')],{})[_0x54e7('0x1e')](function(_0x5845d3){var _0x3e2c49=_0x131e83['user'][_0x54e7('0x20')]({'plain':!![]});if(!_0x3e2c49)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e2c49['role']===_0x54e7('0x47')){var _0x32b8d0=_0x5845d3[_0x54e7('0x20')]({'plain':!![]});var _0x382f4c=_0x54e7('0x48');return db[_0x54e7('0x49')][_0x54e7('0x4a')]({'where':{'name':_0x382f4c,'userProfileId':_0x3e2c49['userProfileId']},'raw':!![]})['then'](function(_0x32fe5d){if(_0x32fe5d&&_0x32fe5d['autoAssociation']===0x0){return db['UserProfileResource'][_0x54e7('0x45')]({'name':_0x32b8d0[_0x54e7('0x25')],'resourceId':_0x32b8d0['id'],'type':_0x54e7('0x4b'),'sectionId':_0x32fe5d['id']},{})['then'](function(){return _0x5845d3;});}else{return _0x5845d3;}})[_0x54e7('0x44')](function(_0x38ec86){logger[_0x54e7('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38ec86);throw _0x38ec86;});}return _0x5845d3;})[_0x54e7('0x1e')](respondWithResult(_0xe36db6,0xc9))[_0x54e7('0x44')](handleError(_0xe36db6,null));};exports['update']=function(_0x37ffba,_0x317ffc){if(_0x37ffba[_0x54e7('0x46')]['id']){delete _0x37ffba[_0x54e7('0x46')]['id'];}return db[_0x54e7('0x29')]['find']({'where':{'id':_0x37ffba['params']['id']}})[_0x54e7('0x1e')](handleEntityNotFound(_0x317ffc,null))[_0x54e7('0x1e')](saveUpdates(_0x37ffba[_0x54e7('0x46')],null))[_0x54e7('0x1e')](respondWithResult(_0x317ffc,null))[_0x54e7('0x44')](handleError(_0x317ffc,null));};exports[_0x54e7('0x1f')]=function(_0x2e441e,_0x101092){return db[_0x54e7('0x29')][_0x54e7('0x4a')]({'where':{'id':_0x2e441e[_0x54e7('0x4c')]['id']}})[_0x54e7('0x1e')](handleEntityNotFound(_0x101092,null))['then'](removeEntity(_0x101092,null))['catch'](handleError(_0x101092,null));};exports[_0x54e7('0x4d')]=function(_0xa1dbc3,_0x36b823){var _0x180503=0xa;var _0x139810=[_0x54e7('0x4e'),_0x54e7('0x4f'),_0x54e7('0x50'),_0x54e7('0x51')];var _0x579af4={'SUM':'SUM(%s)','COUNT':_0x54e7('0x52'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x54e7('0x53'),'MIN':_0x54e7('0x54'),'AVG':_0x54e7('0x55'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x54e7('0x56'),'GROUP_CONCAT DESC':_0x54e7('0x57')};var _0x38908e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x54e7('0x58'),'HOUR':_0x54e7('0x59'),'ROUND':_0x54e7('0x5a'),'UNIX_TIMESTAMP':_0x54e7('0x5b')};var _0x59aac5=function(_0x394e1d){return!_[_0x54e7('0x5c')]([_0x54e7('0x5d'),_0x54e7('0x5e'),_0x54e7('0x5f'),_0x54e7('0x60')],_0x394e1d);};var _0x9c182f=function(_0x2e38e5){if(!_0x2e38e5||!_0x2e38e5['rules']['length']){return'';}for(var _0x3fceb7='(',_0x257b49=0x0;_0x257b49<_0x2e38e5['rules'][_0x54e7('0x34')];_0x257b49+=0x1){_0x257b49>0x0&&(_0x3fceb7+='\x20'+_0x2e38e5[_0x54e7('0x61')]+'\x20');_0x3fceb7+=_0x2e38e5[_0x54e7('0x62')][_0x257b49][_0x54e7('0x63')]?_0x9c182f(_0x2e38e5['rules'][_0x257b49][_0x54e7('0x63')]):_0x2e38e5[_0x54e7('0x62')][_0x257b49][_0x54e7('0x64')]+'\x20'+_0x2e38e5[_0x54e7('0x62')][_0x257b49][_0x54e7('0x65')]+(_0x59aac5(_0x2e38e5[_0x54e7('0x62')][_0x257b49][_0x54e7('0x65')])?'\x20'+_0x2e38e5[_0x54e7('0x62')][_0x257b49]['value']:'');}return _0x3fceb7+')';};var _0x32f905={'where':{'id':_0xa1dbc3['params']['id']}},_0x43867e,_0x5a2940,_0xaf9ef9,_0x356710,_0x46ff12;_0x32f905=_[_0x54e7('0x3c')]({},_0x32f905,_0xa1dbc3[_0x54e7('0x3e')]);return db[_0x54e7('0x29')][_0x54e7('0x4a')](_0x32f905)['then'](function(_0x67c1c6){if(_0x67c1c6){_0x43867e=_0x67c1c6;return _0x67c1c6[_0x54e7('0x66')]();}return null;})[_0x54e7('0x1e')](function(_0x1836ac){if(_0x1836ac){if(!_0x1836ac[_0x54e7('0x34')]){throw new db[(_0x54e7('0x67'))][(_0x54e7('0x68'))](_0x54e7('0x69'),0x193);}_0x5a2940=_0x1836ac;return db[_0x54e7('0x6a')][_0x54e7('0x41')]({'raw':!![]});}return null;})['then'](function(_0x274bc1){if(_0x274bc1){_0xaf9ef9=_['keyBy'](_0x274bc1,'id');var _0x55f5fa;var _0x2c2e07=squel[_0x54e7('0x6b')]();_0x2c2e07['from'](_0x43867e['table']);for(var _0x13028c=0x0;_0x13028c<_0x5a2940[_0x54e7('0x34')];_0x13028c+=0x1){_0x55f5fa=_0x5a2940[_0x13028c][_0x54e7('0x6c')]?_0xaf9ef9[_0x5a2940[_0x13028c][_0x54e7('0x6c')]][_0x54e7('0x6d')]:_0x5a2940[_0x13028c][_0x54e7('0x64')];_0x55f5fa=_0x5a2940[_0x13028c]['function']?_['replace'](_0x579af4[_0x5a2940[_0x13028c][_0x54e7('0x6e')]],'%s',_0x55f5fa):_0x55f5fa;_0x55f5fa=_0x5a2940[_0x13028c]['format']?_['replace'](_0x38908e[_0x5a2940[_0x13028c][_0x54e7('0x6f')]],'%s',_0x55f5fa):_0x55f5fa;if(_0x5a2940[_0x13028c][_0x54e7('0x70')]){_0x2c2e07[_0x54e7('0x63')](_0x55f5fa);}_0x5a2940[_0x13028c][_0x54e7('0x71')]&&_0x2c2e07[_0x54e7('0x37')](_0x55f5fa,_0x5a2940[_0x13028c][_0x54e7('0x71')]===_0x54e7('0x72')?![]:!![]);_0x2c2e07[_0x54e7('0x64')](_0x55f5fa,_0x5a2940[_0x13028c][_0x54e7('0x73')]||_0x55f5fa);}if(_0x43867e[_0x54e7('0x74')]){_0x43867e['joins']=JSON['parse'](_0x43867e[_0x54e7('0x74')]);for(var _0x2f985b=0x0;_0x2f985b<_0x43867e[_0x54e7('0x74')][_0x54e7('0x34')];_0x2f985b+=0x1){if(_0x43867e[_0x54e7('0x74')][_0x2f985b][_0x54e7('0x2c')]&&_[_0x54e7('0x5c')](_0x139810,_0x43867e[_0x54e7('0x74')][_0x2f985b][_0x54e7('0x2c')])&&_0x43867e[_0x54e7('0x74')][_0x2f985b][_0x54e7('0x75')]&&_0x43867e[_0x54e7('0x74')][_0x2f985b]['foreignTable']&&_0x43867e[_0x54e7('0x74')][_0x2f985b][_0x54e7('0x76')]){_0x2c2e07[_0x43867e[_0x54e7('0x74')][_0x2f985b][_0x54e7('0x2c')]](_0x43867e[_0x54e7('0x74')][_0x2f985b][_0x54e7('0x77')],null,util[_0x54e7('0x6f')]('%s.%s\x20=\x20%s.%s',_0x43867e[_0x54e7('0x78')],_0x43867e['joins'][_0x2f985b][_0x54e7('0x75')],_0x43867e['joins'][_0x2f985b]['foreignTable'],_0x43867e['joins'][_0x2f985b][_0x54e7('0x76')]));}}}if(_0x43867e['conditions']){_0x43867e[_0x54e7('0x79')]=JSON[_0x54e7('0x7a')](_0x43867e[_0x54e7('0x79')]);_0x2c2e07[_0x54e7('0x3b')](_0x9c182f(_0x43867e[_0x54e7('0x79')][_0x54e7('0x63')]));}_0x46ff12=_0x2c2e07[_0x54e7('0x7b')]();_0x2c2e07[_0x54e7('0x1a')](_0x180503);_0x2c2e07[_0x54e7('0x19')](0x0);logger['debug']('Limited\x20Query:',_0x2c2e07['toString']());return db[_0x54e7('0x7c')][_0x54e7('0x2f')](_0x2c2e07['toString'](),{'type':db[_0x54e7('0x7c')][_0x54e7('0x7d')][_0x54e7('0x7e')]});}})[_0x54e7('0x1e')](respondWithResult(_0x36b823,null))['catch'](handleError(_0x36b823,null));};function runReport(_0x2f29a8,_0x4477e2,_0x38e103){var _0x282b0a=_0x4477e2[_0x54e7('0x25')];var _0x5ea15a=0xa;var _0x31c3d1=[_0x54e7('0x4e'),'left_join','right_join',_0x54e7('0x51')];var _0x5f1bbf={'SUM':_0x54e7('0x7f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x54e7('0x53'),'MIN':_0x54e7('0x54'),'AVG':_0x54e7('0x55'),'GROUP_CONCAT':_0x54e7('0x80'),'GROUP_CONCAT ASC':_0x54e7('0x56'),'GROUP_CONCAT DESC':_0x54e7('0x57')};var _0x510c8b={'SEC_TO_TIME':_0x54e7('0x81'),'DATE':'DATE(%s)','HOUR':_0x54e7('0x59'),'ROUND':_0x54e7('0x5a'),'UNIX_TIMESTAMP':_0x54e7('0x5b')};var _0x11f358=function(_0x20917b){return!_['includes'](['IS\x20NULL',_0x54e7('0x5e'),_0x54e7('0x5f'),_0x54e7('0x60')],_0x20917b);};var _0x4e03a9=function(_0x4cd03d){if(!_0x4cd03d||!_0x4cd03d[_0x54e7('0x62')]['length']){return'';}for(var _0x345150='(',_0x514c21=0x0;_0x514c21<_0x4cd03d[_0x54e7('0x62')][_0x54e7('0x34')];_0x514c21+=0x1){_0x514c21>0x0&&(_0x345150+='\x20'+_0x4cd03d['operator']+'\x20');_0x345150+=_0x4cd03d[_0x54e7('0x62')][_0x514c21][_0x54e7('0x63')]?_0x4e03a9(_0x4cd03d[_0x54e7('0x62')][_0x514c21][_0x54e7('0x63')]):_0x4cd03d['rules'][_0x514c21]['field']+'\x20'+_0x4cd03d[_0x54e7('0x62')][_0x514c21][_0x54e7('0x65')]+(_0x11f358(_0x4cd03d[_0x54e7('0x62')][_0x514c21][_0x54e7('0x65')])?'\x20'+_0x4cd03d['rules'][_0x514c21][_0x54e7('0x82')]:'');}return _0x345150+')';};var _0x23f2f6={'where':{'id':_0x2f29a8['id']}},_0x5c3594,_0x1d6c2c,_0x39e653,_0x9d61f0,_0x37da8d;_0x23f2f6=_['merge']({},_0x23f2f6,_0x38e103);return db[_0x54e7('0x29')][_0x54e7('0x4a')](_0x23f2f6)['then'](function(_0xff2b86){if(_0xff2b86){_0x5c3594=_0xff2b86;return _0xff2b86[_0x54e7('0x66')]();}return null;})['then'](function(_0x5886e9){if(_0x5886e9){if(!_0x5886e9[_0x54e7('0x34')]){throw new db[(_0x54e7('0x67'))][(_0x54e7('0x68'))](_0x54e7('0x69'),0x193);}_0x1d6c2c=_0x5886e9;return db[_0x54e7('0x6a')][_0x54e7('0x41')]({'raw':!![]});}return null;})[_0x54e7('0x1e')](function(_0x2f7534){if(_0x2f7534){_0x39e653=_[_0x54e7('0x83')](_0x2f7534,'id');var _0x499e6f;var _0x2818af=squel[_0x54e7('0x6b')]();_0x2818af['from'](_0x5c3594['table']);for(var _0x5269f7=0x0;_0x5269f7<_0x1d6c2c[_0x54e7('0x34')];_0x5269f7+=0x1){_0x499e6f=_0x1d6c2c[_0x5269f7][_0x54e7('0x6c')]?_0x39e653[_0x1d6c2c[_0x5269f7]['MetricId']][_0x54e7('0x6d')]:_0x1d6c2c[_0x5269f7]['field'];_0x499e6f=_0x1d6c2c[_0x5269f7][_0x54e7('0x6e')]?_[_0x54e7('0x84')](_0x5f1bbf[_0x1d6c2c[_0x5269f7]['function']],'%s',_0x499e6f):_0x499e6f;_0x499e6f=_0x1d6c2c[_0x5269f7][_0x54e7('0x6f')]?_['replace'](_0x510c8b[_0x1d6c2c[_0x5269f7][_0x54e7('0x6f')]],'%s',_0x499e6f):_0x499e6f;if(_0x1d6c2c[_0x5269f7][_0x54e7('0x70')]){_0x2818af[_0x54e7('0x63')](_0x499e6f);}_0x1d6c2c[_0x5269f7][_0x54e7('0x71')]&&_0x2818af[_0x54e7('0x37')](_0x499e6f,_0x1d6c2c[_0x5269f7][_0x54e7('0x71')]===_0x54e7('0x72')?![]:!![]);_0x2818af['field'](_0x499e6f,_0x1d6c2c[_0x5269f7][_0x54e7('0x73')]||_0x499e6f);}if(_0x5c3594[_0x54e7('0x74')]){_0x5c3594[_0x54e7('0x74')]=JSON[_0x54e7('0x7a')](_0x5c3594['joins']);for(var _0x547e85=0x0;_0x547e85<_0x5c3594['joins'][_0x54e7('0x34')];_0x547e85+=0x1){if(_0x5c3594[_0x54e7('0x74')][_0x547e85][_0x54e7('0x2c')]&&_[_0x54e7('0x5c')](_0x31c3d1,_0x5c3594[_0x54e7('0x74')][_0x547e85][_0x54e7('0x2c')])&&_0x5c3594['joins'][_0x547e85][_0x54e7('0x75')]&&_0x5c3594[_0x54e7('0x74')][_0x547e85][_0x54e7('0x77')]&&_0x5c3594[_0x54e7('0x74')][_0x547e85]['foreignKey']){_0x2818af[_0x5c3594[_0x54e7('0x74')][_0x547e85][_0x54e7('0x2c')]](_0x5c3594[_0x54e7('0x74')][_0x547e85][_0x54e7('0x77')],null,util[_0x54e7('0x6f')](_0x54e7('0x85'),_0x5c3594[_0x54e7('0x78')],_0x5c3594['joins'][_0x547e85][_0x54e7('0x75')],_0x5c3594['joins'][_0x547e85][_0x54e7('0x77')],_0x5c3594[_0x54e7('0x74')][_0x547e85]['foreignKey']));}}}if(_0x5c3594[_0x54e7('0x79')]){_0x5c3594[_0x54e7('0x79')]=JSON['parse'](_0x5c3594['conditions']);_0x2818af[_0x54e7('0x3b')](_0x4e03a9(_0x5c3594[_0x54e7('0x79')][_0x54e7('0x63')]));}_0x37da8d=_0x2818af[_0x54e7('0x7b')]();_0x2818af[_0x54e7('0x1a')](_0x5ea15a);_0x2818af[_0x54e7('0x19')](0x0);logger[_0x54e7('0x86')](_0x54e7('0x87'),_0x2818af[_0x54e7('0x88')]());return db[_0x54e7('0x7c')]['query'](_0x2818af[_0x54e7('0x88')](),{'type':db[_0x54e7('0x7c')]['QueryTypes'][_0x54e7('0x7e')]});}})[_0x54e7('0x1e')](function(_0x50881c){if(!_0x50881c[_0x54e7('0x34')]){throw new db[(_0x54e7('0x67'))]['ValidationErrorItem'](_0x54e7('0x89'),0xcc);}if(_0x4477e2['output']==='web'){return null;}var _0x115769=_[_0x54e7('0x3c')](_0x4477e2,{'name':_0x4477e2[_0x54e7('0x8a')]||_0x4477e2[_0x54e7('0x25')]||_0x5c3594['name'],'basename':_0x282b0a,'savename':util[_0x54e7('0x6f')](_0x54e7('0x8b'),_0x4477e2[_0x54e7('0x25')]||_0x5c3594[_0x54e7('0x25')],require(_0x54e7('0x8c'))[_0x54e7('0x8d')](0x4),_0x4477e2[_0x54e7('0x8e')]||_0x54e7('0x8f')),'reportId':_0x5c3594['id'],'reportType':_0x54e7('0x90')});return db['AnalyticExtractedReport'][_0x54e7('0x45')](_0x115769,{'raw':!![]});})[_0x54e7('0x1e')](function(_0x5e2746){if(_0x5c3594[_0x54e7('0x78')]==='cdr'){_0x37da8d[_0x54e7('0x3b')](_0x5c3594[_0x54e7('0x78')]+_0x54e7('0x91'),_0x4477e2[_0x54e7('0x92')],_0x4477e2['endDate']);}else{_0x37da8d[_0x54e7('0x3b')](_0x5c3594[_0x54e7('0x78')]+_0x54e7('0x93'),_0x4477e2[_0x54e7('0x92')],_0x4477e2[_0x54e7('0x94')]);}if(_0x5e2746){logger['info']('Run\x20Query:',_0x37da8d['toString']());require(_0x54e7('0x95'))['fork'](path[_0x54e7('0x4e')](__dirname,'../../components/export/',_0x5e2746[_0x54e7('0x8e')]),[_0x5e2746['id'],_0x37da8d[_0x54e7('0x88')](),path['join'](__dirname,'../../files/reports',_0x5e2746[_0x54e7('0x96')]),_0x282b0a]);return _0x5e2746;}else{var _0x444f7d=squel['select']();_0x444f7d['from']('('+_0x37da8d['toString']()+')','countTable');_0x444f7d['field'](_0x54e7('0x97'),_0x54e7('0x18'));_0x37da8d[_0x54e7('0x1a')](_0x4477e2['limit']||_0x5ea15a);_0x37da8d[_0x54e7('0x19')](_0x4477e2['offset']||0x0);return dbH[_0x54e7('0x7c')][_0x54e7('0x2f')](_0x444f7d['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x54e7('0x7e')]})[_0x54e7('0x1e')](function(_0x47d564){if(!_0x47d564[_0x54e7('0x34')]){_0x9d61f0=0x0;}else{_0x9d61f0=_0x47d564[0x0]['count']||0x0;}return dbH[_0x54e7('0x7c')][_0x54e7('0x2f')](_0x37da8d[_0x54e7('0x88')](),{'type':dbH[_0x54e7('0x7c')][_0x54e7('0x7d')][_0x54e7('0x7e')]});})['then'](function(_0x15a70a){return{'rows':_0x15a70a||[],'count':_0x9d61f0};});}});}exports[_0x54e7('0x98')]=function(_0x413cb6,_0x232a87){return runReport(_0x413cb6[_0x54e7('0x4c')],_0x413cb6[_0x54e7('0x2f')],_0x413cb6[_0x54e7('0x3e')])[_0x54e7('0x1e')](respondWithResult(_0x232a87,null))[_0x54e7('0x44')](handleError(_0x232a87,null));};exports[_0x54e7('0x99')]=runReport;exports[_0x54e7('0x2f')]=function(_0x3a380e,_0x3e20b1){var _0x5f02f4=0xa;var _0x53e44b=[_0x54e7('0x4e'),_0x54e7('0x4f'),_0x54e7('0x50'),_0x54e7('0x51')];var _0x3cddc2={'SUM':_0x54e7('0x7f'),'COUNT':_0x54e7('0x52'),'COUNT DISTINCT':_0x54e7('0x9a'),'MAX':_0x54e7('0x53'),'MIN':_0x54e7('0x54'),'AVG':_0x54e7('0x55'),'GROUP_CONCAT':_0x54e7('0x80'),'GROUP_CONCAT ASC':_0x54e7('0x56'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1e1b53={'SEC_TO_TIME':_0x54e7('0x81'),'DATE':_0x54e7('0x58'),'HOUR':_0x54e7('0x59'),'ROUND':_0x54e7('0x5a'),'UNIX_TIMESTAMP':_0x54e7('0x5b')};var _0x5416a4=function(_0x1e825d){return!_['includes']([_0x54e7('0x5d'),_0x54e7('0x5e'),'IS\x20EMPTY',_0x54e7('0x60')],_0x1e825d);};var _0x23f9f5=function(_0x3ffe4a){if(!_0x3ffe4a||!_0x3ffe4a['rules'][_0x54e7('0x34')]){return'';}for(var _0x3bc062='(',_0x33b950=0x0;_0x33b950<_0x3ffe4a[_0x54e7('0x62')][_0x54e7('0x34')];_0x33b950+=0x1){_0x33b950>0x0&&(_0x3bc062+='\x20'+_0x3ffe4a[_0x54e7('0x61')]+'\x20');_0x3bc062+=_0x3ffe4a['rules'][_0x33b950][_0x54e7('0x63')]?_0x23f9f5(_0x3ffe4a[_0x54e7('0x62')][_0x33b950][_0x54e7('0x63')]):_0x3ffe4a[_0x54e7('0x62')][_0x33b950]['field']+'\x20'+_0x3ffe4a[_0x54e7('0x62')][_0x33b950][_0x54e7('0x65')]+(_0x5416a4(_0x3ffe4a[_0x54e7('0x62')][_0x33b950][_0x54e7('0x65')])?'\x20'+_0x3ffe4a['rules'][_0x33b950][_0x54e7('0x82')]:'');}return _0x3bc062+')';};var _0x1d7afa={'where':{'id':_0x3a380e[_0x54e7('0x4c')]['id']}},_0x4955c8,_0x5e25cd,_0x411687,_0x42e02e,_0x11d0ff;_0x1d7afa=_[_0x54e7('0x3c')]({},_0x1d7afa,_0x3a380e['options']);return db[_0x54e7('0x29')][_0x54e7('0x4a')](_0x1d7afa)[_0x54e7('0x1e')](function(_0x2e4f67){if(_0x2e4f67){_0x4955c8=_0x2e4f67;return _0x2e4f67[_0x54e7('0x66')]();}return null;})[_0x54e7('0x1e')](function(_0x1f1a3d){if(_0x1f1a3d){if(!_0x1f1a3d[_0x54e7('0x34')]){throw new db[(_0x54e7('0x67'))][(_0x54e7('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5e25cd=_0x1f1a3d;return db[_0x54e7('0x6a')][_0x54e7('0x41')]({'raw':!![]});}return null;})[_0x54e7('0x1e')](function(_0x3fb911){if(_0x3fb911){_0x411687=_[_0x54e7('0x83')](_0x3fb911,'id');var _0x232229;var _0xc2685e=squel[_0x54e7('0x6b')]();_0xc2685e[_0x54e7('0x9b')](_0x4955c8[_0x54e7('0x78')]);for(var _0x23990b=0x0;_0x23990b<_0x5e25cd[_0x54e7('0x34')];_0x23990b+=0x1){_0x232229=_0x5e25cd[_0x23990b][_0x54e7('0x6c')]?_0x411687[_0x5e25cd[_0x23990b][_0x54e7('0x6c')]][_0x54e7('0x6d')]:_0x5e25cd[_0x23990b][_0x54e7('0x64')];_0x232229=_0x5e25cd[_0x23990b][_0x54e7('0x6e')]?_[_0x54e7('0x84')](_0x3cddc2[_0x5e25cd[_0x23990b][_0x54e7('0x6e')]],'%s',_0x232229):_0x232229;_0x232229=_0x5e25cd[_0x23990b]['format']?_[_0x54e7('0x84')](_0x1e1b53[_0x5e25cd[_0x23990b]['format']],'%s',_0x232229):_0x232229;if(_0x5e25cd[_0x23990b]['groupBy']){_0xc2685e['group'](_0x232229);}_0x5e25cd[_0x23990b][_0x54e7('0x71')]&&_0xc2685e[_0x54e7('0x37')](_0x232229,_0x5e25cd[_0x23990b][_0x54e7('0x71')]===_0x54e7('0x72')?![]:!![]);_0xc2685e[_0x54e7('0x64')](_0x232229,_0x5e25cd[_0x23990b][_0x54e7('0x73')]||_0x232229);}if(_0x4955c8[_0x54e7('0x74')]){_0x4955c8[_0x54e7('0x74')]=JSON[_0x54e7('0x7a')](_0x4955c8[_0x54e7('0x74')]);for(var _0x1db872=0x0;_0x1db872<_0x4955c8[_0x54e7('0x74')][_0x54e7('0x34')];_0x1db872+=0x1){if(_0x4955c8['joins'][_0x1db872][_0x54e7('0x2c')]&&_['includes'](_0x53e44b,_0x4955c8[_0x54e7('0x74')][_0x1db872][_0x54e7('0x2c')])&&_0x4955c8[_0x54e7('0x74')][_0x1db872][_0x54e7('0x75')]&&_0x4955c8[_0x54e7('0x74')][_0x1db872][_0x54e7('0x77')]&&_0x4955c8[_0x54e7('0x74')][_0x1db872][_0x54e7('0x76')]){_0xc2685e[_0x4955c8['joins'][_0x1db872][_0x54e7('0x2c')]](_0x4955c8[_0x54e7('0x74')][_0x1db872][_0x54e7('0x77')],null,util['format'](_0x54e7('0x85'),_0x4955c8[_0x54e7('0x78')],_0x4955c8[_0x54e7('0x74')][_0x1db872]['parentKey'],_0x4955c8[_0x54e7('0x74')][_0x1db872]['foreignTable'],_0x4955c8['joins'][_0x1db872][_0x54e7('0x76')]));}}}if(_0x4955c8[_0x54e7('0x79')]){_0x4955c8[_0x54e7('0x79')]=JSON[_0x54e7('0x7a')](_0x4955c8[_0x54e7('0x79')]);_0xc2685e[_0x54e7('0x3b')](_0x23f9f5(_0x4955c8[_0x54e7('0x79')]['group']));}_0x11d0ff=_0xc2685e[_0x54e7('0x7b')]();_0xc2685e[_0x54e7('0x1a')](_0x5f02f4);_0xc2685e[_0x54e7('0x19')](0x0);logger[_0x54e7('0x86')](_0x54e7('0x87'),_0xc2685e[_0x54e7('0x88')]());return db[_0x54e7('0x7c')][_0x54e7('0x2f')](_0xc2685e['toString'](),{'type':db[_0x54e7('0x7c')]['QueryTypes']['SELECT']});}})[_0x54e7('0x1e')](function(){return{'sql':_0x11d0ff[_0x54e7('0x88')]()};})['then'](respondWithResult(_0x3e20b1,null))[_0x54e7('0x44')](handleError(_0x3e20b1,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index b858fce..e1896d1 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 _0xbbba=['moment','bluebird','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','lodash','util','../../config/logger','api'];(function(_0x7457a4,_0x160c54){var _0xd820a1=function(_0x54d139){while(--_0x54d139){_0x7457a4['push'](_0x7457a4['shift']());}};_0xd820a1(++_0x160c54);}(_0xbbba,0x100));var _0xabbb=function(_0x2b0f81,_0x3917f0){_0x2b0f81=_0x2b0f81-0x0;var _0x5ce74c=_0xbbba[_0x2b0f81];return _0x5ce74c;};'use strict';var _=require(_0xabbb('0x0'));var util=require(_0xabbb('0x1'));var logger=require(_0xabbb('0x2'))(_0xabbb('0x3'));var moment=require(_0xabbb('0x4'));var BPromise=require(_0xabbb('0x5'));var rp=require(_0xabbb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xabbb('0x7'));var config=require(_0xabbb('0x8'));var attributes=require(_0xabbb('0x9'));module[_0xabbb('0xa')]=function(_0x4607f0,_0x1cface){return _0x4607f0[_0xabbb('0xb')](_0xabbb('0xc'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba97=['bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports','define','lodash','util','api','moment'];(function(_0x2b9f8e,_0x47bfe1){var _0x1d8833=function(_0x1b668a){while(--_0x1b668a){_0x2b9f8e['push'](_0x2b9f8e['shift']());}};_0x1d8833(++_0x47bfe1);}(_0xba97,0x1e0));var _0x7ba9=function(_0x5578c3,_0x46d7bf){_0x5578c3=_0x5578c3-0x0;var _0x29285a=_0xba97[_0x5578c3];return _0x29285a;};'use strict';var _=require(_0x7ba9('0x0'));var util=require(_0x7ba9('0x1'));var logger=require('../../config/logger')(_0x7ba9('0x2'));var moment=require(_0x7ba9('0x3'));var BPromise=require(_0x7ba9('0x4'));var rp=require(_0x7ba9('0x5'));var fs=require('fs');var path=require(_0x7ba9('0x6'));var rimraf=require('rimraf');var config=require(_0x7ba9('0x7'));var attributes=require(_0x7ba9('0x8'));module[_0x7ba9('0x9')]=function(_0x431b3d,_0x5cde32){return _0x431b3d[_0x7ba9('0xa')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','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 20fe4dd..d839b76 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 _0xe1e3=['message','info','result','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x5d82e9,_0x54857e){var _0x518ebc=function(_0x592185){while(--_0x592185){_0x5d82e9['push'](_0x5d82e9['shift']());}};_0x518ebc(++_0x54857e);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x3dac68,_0x437ad1){_0x3dac68=_0x3dac68-0x0;var _0x58c26c=_0xe1e3[_0x3dac68];return _0x58c26c;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var moment=require('moment');var BPromise=require(_0x3e1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e1e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e1e('0x4'))(_0x3e1e('0x5'));var config=require(_0x3e1e('0x6'));var jayson=require(_0x3e1e('0x7'));var client=jayson[_0x3e1e('0x8')][_0x3e1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55cfba,_0x1574e5,_0x13926d){return new BPromise(function(_0x2f0e12,_0xa67e35){return client[_0x3e1e('0xa')](_0x55cfba,_0x13926d)[_0x3e1e('0xb')](function(_0x5e7d1f){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x1574e5,_0x3e1e('0xc'));logger['debug'](_0x3e1e('0xd'),_0x1574e5,_0x3e1e('0xc'),JSON[_0x3e1e('0xe')](_0x5e7d1f));if(_0x5e7d1f['error']){if(_0x5e7d1f[_0x3e1e('0xf')]['code']===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x1574e5,_0x5e7d1f['error']['message']);return _0xa67e35(_0x5e7d1f[_0x3e1e('0xf')]['message']);}logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x5e7d1f[_0x3e1e('0xf')][_0x3e1e('0x11')]);return _0x2f0e12(_0x5e7d1f['error']['message']);}else{logger[_0x3e1e('0x12')](_0x3e1e('0x10'),_0x1574e5,'request\x20sent');_0x2f0e12(_0x5e7d1f[_0x3e1e('0x13')][_0x3e1e('0x11')]);}})['catch'](function(_0x11c07f){logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x11c07f);_0xa67e35(_0x11c07f);});});} \ No newline at end of file +var _0xde13=['debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent'];(function(_0x59ddaf,_0x4908df){var _0x8342a6=function(_0x44139d){while(--_0x44139d){_0x59ddaf['push'](_0x59ddaf['shift']());}};_0x8342a6(++_0x4908df);}(_0xde13,0x146));var _0x3de1=function(_0x14f51e,_0x32923c){_0x14f51e=_0x14f51e-0x0;var _0x13e685=_0xde13[_0x14f51e];return _0x13e685;};'use strict';var _=require(_0x3de1('0x0'));var util=require(_0x3de1('0x1'));var moment=require(_0x3de1('0x2'));var BPromise=require(_0x3de1('0x3'));var rs=require(_0x3de1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3de1('0x5'))['db'];var utils=require(_0x3de1('0x6'));var logger=require(_0x3de1('0x7'))('rpc');var config=require(_0x3de1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3de1('0x9')][_0x3de1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d2169,_0x34291a,_0x5f1aff){return new BPromise(function(_0x11df45,_0x41b5bb){return client[_0x3de1('0xb')](_0x3d2169,_0x5f1aff)['then'](function(_0x4eb503){logger['info'](_0x3de1('0xc'),_0x34291a,_0x3de1('0xd'));logger[_0x3de1('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x34291a,_0x3de1('0xd'),JSON[_0x3de1('0xf')](_0x4eb503));if(_0x4eb503[_0x3de1('0x10')]){if(_0x4eb503['error']['code']===0x1f4){logger[_0x3de1('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x34291a,_0x4eb503['error']['message']);return _0x41b5bb(_0x4eb503[_0x3de1('0x10')][_0x3de1('0x11')]);}logger[_0x3de1('0x10')](_0x3de1('0xc'),_0x34291a,_0x4eb503['error'][_0x3de1('0x11')]);return _0x11df45(_0x4eb503['error'][_0x3de1('0x11')]);}else{logger['info'](_0x3de1('0xc'),_0x34291a,_0x3de1('0xd'));_0x11df45(_0x4eb503[_0x3de1('0x12')]['message']);}})[_0x3de1('0x13')](function(_0x25f619){logger[_0x3de1('0x10')](_0x3de1('0xc'),_0x34291a,_0x25f619);_0x41b5bb(_0x25f619);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index a09f156..d5b059e 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 _0xc880=['delete','destroy','exports','multer','util','path','connect-timeout','express','get','isAuthenticated','index','/:id','show','preview','/:id/run','run','/:id/query','query','create','update'];(function(_0x368ea9,_0x5eb1f6){var _0x35ff8f=function(_0x2eddc4){while(--_0x2eddc4){_0x368ea9['push'](_0x368ea9['shift']());}};_0x35ff8f(++_0x5eb1f6);}(_0xc880,0x11b));var _0x0c88=function(_0x37ae55,_0x12a4d0){_0x37ae55=_0x37ae55-0x0;var _0x283acf=_0xc880[_0x37ae55];return _0x283acf;};'use strict';var multer=require(_0x0c88('0x0'));var util=require(_0x0c88('0x1'));var path=require(_0x0c88('0x2'));var timeout=require(_0x0c88('0x3'));var express=require(_0x0c88('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0x0c88('0x5')]('/',auth[_0x0c88('0x6')](),controller[_0x0c88('0x7')]);router[_0x0c88('0x5')](_0x0c88('0x8'),auth[_0x0c88('0x6')](),controller[_0x0c88('0x9')]);router['get']('/:id/preview',auth[_0x0c88('0x6')](),controller[_0x0c88('0xa')]);router['get'](_0x0c88('0xb'),auth[_0x0c88('0x6')](),controller[_0x0c88('0xc')]);router[_0x0c88('0x5')](_0x0c88('0xd'),auth['isAuthenticated'](),controller[_0x0c88('0xe')]);router['post']('/',auth[_0x0c88('0x6')](),controller[_0x0c88('0xf')]);router['put'](_0x0c88('0x8'),auth[_0x0c88('0x6')](),controller[_0x0c88('0x10')]);router[_0x0c88('0x11')](_0x0c88('0x8'),auth['isAuthenticated'](),controller[_0x0c88('0x12')]);module[_0x0c88('0x13')]=router; \ No newline at end of file +var _0x7573=['get','index','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','run','query','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller'];(function(_0x382f3b,_0x58dd95){var _0x2743c5=function(_0x5b089c){while(--_0x5b089c){_0x382f3b['push'](_0x382f3b['shift']());}};_0x2743c5(++_0x58dd95);}(_0x7573,0x1ec));var _0x3757=function(_0x2abe88,_0xc95392){_0x2abe88=_0x2abe88-0x0;var _0x1e34d7=_0x7573[_0x2abe88];return _0x1e34d7;};'use strict';var multer=require(_0x3757('0x0'));var util=require(_0x3757('0x1'));var path=require('path');var timeout=require(_0x3757('0x2'));var express=require(_0x3757('0x3'));var router=express[_0x3757('0x4')]();var auth=require(_0x3757('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3757('0x6'));var controller=require(_0x3757('0x7'));router[_0x3757('0x8')]('/',auth['isAuthenticated'](),controller[_0x3757('0x9')]);router[_0x3757('0x8')](_0x3757('0xa'),auth[_0x3757('0xb')](),controller[_0x3757('0xc')]);router[_0x3757('0x8')](_0x3757('0xd'),auth[_0x3757('0xb')](),controller[_0x3757('0xe')]);router[_0x3757('0x8')](_0x3757('0xf'),auth[_0x3757('0xb')](),controller[_0x3757('0x10')]);router[_0x3757('0x8')]('/:id/query',auth[_0x3757('0xb')](),controller[_0x3757('0x11')]);router[_0x3757('0x12')]('/',auth[_0x3757('0xb')](),controller[_0x3757('0x13')]);router[_0x3757('0x14')](_0x3757('0xa'),auth[_0x3757('0xb')](),controller[_0x3757('0x15')]);router[_0x3757('0x16')](_0x3757('0xa'),auth[_0x3757('0xb')](),controller[_0x3757('0x17')]);module[_0x3757('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 093dbb2..27429bf 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 _0x55bc=['csv','DATE','Loading','scheduled','manual','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','pdf','xlsx'];(function(_0x450873,_0x14e9e5){var _0x38f94a=function(_0xf967c0){while(--_0xf967c0){_0x450873['push'](_0x450873['shift']());}};_0x38f94a(++_0x14e9e5);}(_0x55bc,0x18f));var _0xc55b=function(_0x35679b,_0xf2bdf7){_0x35679b=_0x35679b-0x0;var _0x16ea52=_0x55bc[_0x35679b];return _0x16ea52;};'use strict';var Sequelize=require(_0xc55b('0x0'));var moment=require(_0xc55b('0x1'));module[_0xc55b('0x2')]={'name':{'type':Sequelize[_0xc55b('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xc55b('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xc55b('0x4')]('csv',_0xc55b('0x5'),_0xc55b('0x6')),'allowNull':![],'defaultValue':_0xc55b('0x7')},'savename':{'type':Sequelize[_0xc55b('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xc55b('0x8')]},'endDate':{'type':Sequelize[_0xc55b('0x8')]},'status':{'type':Sequelize[_0xc55b('0x3')],'defaultValue':_0xc55b('0x9')},'type':{'type':Sequelize[_0xc55b('0x4')]('manual',_0xc55b('0xa')),'allowNull':![],'defaultValue':_0xc55b('0xb')},'reportId':{'type':Sequelize[_0xc55b('0xc')](0xb)[_0xc55b('0xd')]},'reportType':{'type':Sequelize[_0xc55b('0x3')]}}; \ No newline at end of file +var _0xd673=['moment','STRING','pdf','xlsx','DATE','ENUM','manual','scheduled','INTEGER','sequelize'];(function(_0x5c98ea,_0xa782aa){var _0x51e853=function(_0x57d5b0){while(--_0x57d5b0){_0x5c98ea['push'](_0x5c98ea['shift']());}};_0x51e853(++_0xa782aa);}(_0xd673,0x199));var _0x3d67=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd673[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x3d67('0x0'));var moment=require(_0x3d67('0x1'));module['exports']={'name':{'type':Sequelize[_0x3d67('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x3d67('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0x3d67('0x3'),_0x3d67('0x4')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x3d67('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x3d67('0x5')]},'endDate':{'type':Sequelize[_0x3d67('0x5')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x3d67('0x6')](_0x3d67('0x7'),_0x3d67('0x8')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x3d67('0x9')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x3d67('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index e249c00..64879ba 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 _0x7a54=['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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','type','key','model','map','keys','query','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','merge','options','count','includeAll','include','findAll','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','output','join','root','savename','Sequelize','exists','download','server/files/reports','%s.%s','toLowerCase','html-pdf','eml-format'];(function(_0x3fc46e,_0x116f6f){var _0x3e7b5e=function(_0xf9910){while(--_0xf9910){_0x3fc46e['push'](_0x3fc46e['shift']());}};_0x3e7b5e(++_0x116f6f);}(_0x7a54,0x106));var _0x47a5=function(_0xd7575e,_0x267255){_0xd7575e=_0xd7575e-0x0;var _0x2a822b=_0x7a54[_0xd7575e];return _0x2a822b;};'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 licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=_0x11faf5['count'],_0x2a2cbb=_0x362359[_0x47a5('0x1a')],_0x1ef44c=_0x362359['offset']+_0x362359['limit'],_0x574af6;if(_0x1ef44c>=_0x3b001e){_0x1ef44c=_0x3b001e;_0x574af6=0xc8;}else{_0x574af6=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x574af6);return _0x4e99a8[_0x47a5('0x1b')](_0x47a5('0x1c'),_0x2a2cbb+'-'+_0x1ef44c+'/'+_0x3b001e)[_0x47a5('0x19')](_0x11faf5);}return null;};}function patchUpdates(_0x477b1d){return function(_0x12b98e){try{jsonpatch[_0x47a5('0x1d')](_0x12b98e,_0x477b1d,!![]);}catch(_0xe3c618){return BPromise[_0x47a5('0x1e')](_0xe3c618);}return _0x12b98e['save']();};}function saveUpdates(_0x1570bc,_0xf160ba){return function(_0x47cf3c){if(_0x47cf3c){return _0x47cf3c[_0x47a5('0x1f')](_0x1570bc)[_0x47a5('0x20')](function(_0x36874d){return _0x36874d;});}return null;};}function removeEntity(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x21')]()[_0x47a5('0x20')](function(){var _0x5ef1b1=_0x2f142b[_0x47a5('0x22')]({'plain':!![]});var _0x385687='ExtractedReports';return db[_0x47a5('0x23')][_0x47a5('0x21')]({'where':{'type':_0x385687,'resourceId':_0x5ef1b1['id']}})[_0x47a5('0x20')](function(){return _0x2f142b;});})[_0x47a5('0x20')](function(){_0x4c5910[_0x47a5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53078a,_0x136745){return function(_0x5686db){if(!_0x5686db){_0x53078a[_0x47a5('0x16')](0x194);}return _0x5686db;};}function handleError(_0x5b6c4e,_0x23cb77){_0x23cb77=_0x23cb77||0x1f4;return function(_0x378208){logger[_0x47a5('0x24')](_0x378208[_0x47a5('0x25')]);if(_0x378208[_0x47a5('0x26')]){delete _0x378208[_0x47a5('0x26')];}_0x5b6c4e[_0x47a5('0x17')](_0x23cb77)[_0x47a5('0x27')](_0x378208);};}exports[_0x47a5('0x28')]=function(_0x361bfa,_0x1127f8){var _0x11a4fa={},_0x3ad507={},_0x528582={'count':0x0,'rows':[]};var _0x243210=_['map'](db[_0x47a5('0x29')][_0x47a5('0x2a')],function(_0x16901f){return{'name':_0x16901f['fieldName'],'type':_0x16901f[_0x47a5('0x2b')][_0x47a5('0x2c')]};});_0x3ad507[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x243210,'name');_0x3ad507['query']=_[_0x47a5('0x2f')](_0x361bfa[_0x47a5('0x30')]);_0x3ad507['filters']=_['intersection'](_0x3ad507[_0x47a5('0x2d')],_0x3ad507[_0x47a5('0x30')]);_0x11a4fa['attributes']=_[_0x47a5('0x31')](_0x3ad507['model'],qs[_0x47a5('0x32')](_0x361bfa[_0x47a5('0x30')]['fields']));_0x11a4fa['attributes']=_0x11a4fa[_0x47a5('0x33')]['length']?_0x11a4fa[_0x47a5('0x33')]:_0x3ad507[_0x47a5('0x2d')];if(!_0x361bfa[_0x47a5('0x30')]['hasOwnProperty'](_0x47a5('0x34'))){_0x11a4fa['limit']=qs['limit'](_0x361bfa[_0x47a5('0x30')]['limit']);_0x11a4fa[_0x47a5('0x1a')]=qs['offset'](_0x361bfa[_0x47a5('0x30')][_0x47a5('0x1a')]);}_0x11a4fa[_0x47a5('0x35')]=qs[_0x47a5('0x36')](_0x361bfa[_0x47a5('0x30')][_0x47a5('0x36')]);_0x11a4fa[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_[_0x47a5('0x39')](_0x361bfa['query'],_0x3ad507[_0x47a5('0x38')]),_0x243210);if(_0x361bfa[_0x47a5('0x30')]['filter']){_0x11a4fa[_0x47a5('0x37')]=_[_0x47a5('0x3a')](_0x11a4fa[_0x47a5('0x37')],{'$or':_['map'](_0x243210,function(_0x101f70){if(_0x101f70[_0x47a5('0x2b')]!=='VIRTUAL'){var _0x2ebba0={};_0x2ebba0[_0x101f70[_0x47a5('0x26')]]={'$like':'%'+_0x361bfa['query']['filter']+'%'};return _0x2ebba0;}})});}_0x11a4fa=_['merge']({},_0x11a4fa,_0x361bfa[_0x47a5('0x3b')]);var _0x5c569e={'where':_0x11a4fa[_0x47a5('0x37')]};return db[_0x47a5('0x29')][_0x47a5('0x3c')](_0x5c569e)[_0x47a5('0x20')](function(_0x1b2c80){_0x528582[_0x47a5('0x3c')]=_0x1b2c80;if(_0x361bfa[_0x47a5('0x30')][_0x47a5('0x3d')]){_0x11a4fa[_0x47a5('0x3e')]=[{'all':!![]}];}return db[_0x47a5('0x29')][_0x47a5('0x3f')](_0x11a4fa);})[_0x47a5('0x20')](function(_0x23d6d8){_0x528582['rows']=_0x23d6d8;return _0x528582;})[_0x47a5('0x20')](respondWithFilteredResult(_0x1127f8,_0x11a4fa))[_0x47a5('0x40')](handleError(_0x1127f8,null));};exports[_0x47a5('0x41')]=function(_0x23bd8d,_0x586f4f){var _0x7de536={'raw':!![],'where':{'id':_0x23bd8d['params']['id']}},_0x528ef3={};_0x528ef3['model']=_['keys'](db[_0x47a5('0x29')]['rawAttributes']);_0x528ef3[_0x47a5('0x30')]=_[_0x47a5('0x2f')](_0x23bd8d[_0x47a5('0x30')]);_0x528ef3['filtears']=_[_0x47a5('0x31')](_0x528ef3[_0x47a5('0x2d')],_0x528ef3['query']);_0x7de536['attributes']=_[_0x47a5('0x31')](_0x528ef3['model'],qs[_0x47a5('0x32')](_0x23bd8d[_0x47a5('0x30')][_0x47a5('0x32')]));_0x7de536[_0x47a5('0x33')]=_0x7de536[_0x47a5('0x33')][_0x47a5('0x42')]?_0x7de536[_0x47a5('0x33')]:_0x528ef3[_0x47a5('0x2d')];if(_0x23bd8d[_0x47a5('0x30')][_0x47a5('0x3d')]){_0x7de536[_0x47a5('0x3e')]=[{'all':!![]}];}_0x7de536=_[_0x47a5('0x3a')]({},_0x7de536,_0x23bd8d[_0x47a5('0x3b')]);return db[_0x47a5('0x29')][_0x47a5('0x43')](_0x7de536)[_0x47a5('0x20')](handleEntityNotFound(_0x586f4f,null))['then'](respondWithResult(_0x586f4f,null))[_0x47a5('0x40')](handleError(_0x586f4f,null));};exports[_0x47a5('0x44')]=function(_0x49eab1,_0x52b3a8){return db[_0x47a5('0x29')]['create'](_0x49eab1[_0x47a5('0x45')],{})[_0x47a5('0x20')](function(_0x54c35f){var _0x4f62d3=_0x49eab1[_0x47a5('0x46')]['get']({'plain':!![]});if(!_0x4f62d3)throw new Error(_0x47a5('0x47'));if(_0x4f62d3[_0x47a5('0x48')]===_0x47a5('0x46')){var _0x3e12a7=_0x54c35f[_0x47a5('0x22')]({'plain':!![]});var _0x26acd2=_0x47a5('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x26acd2,'userProfileId':_0x4f62d3[_0x47a5('0x4a')]},'raw':!![]})[_0x47a5('0x20')](function(_0x1163e3){if(_0x1163e3&&_0x1163e3[_0x47a5('0x4b')]===0x0){return db[_0x47a5('0x23')][_0x47a5('0x44')]({'name':_0x3e12a7[_0x47a5('0x26')],'resourceId':_0x3e12a7['id'],'type':_0x1163e3['name'],'sectionId':_0x1163e3['id']},{})[_0x47a5('0x20')](function(){return _0x54c35f;});}else{return _0x54c35f;}})[_0x47a5('0x40')](function(_0x5f6a){logger['error'](_0x47a5('0x4c'),_0x5f6a);throw _0x5f6a;});}return _0x54c35f;})['then'](respondWithResult(_0x52b3a8,0xc9))[_0x47a5('0x40')](handleError(_0x52b3a8,null));};exports[_0x47a5('0x1f')]=function(_0x46e90b,_0xf03bd5){if(_0x46e90b['body']['id']){delete _0x46e90b[_0x47a5('0x45')]['id'];}return db[_0x47a5('0x29')][_0x47a5('0x43')]({'where':{'id':_0x46e90b[_0x47a5('0x4d')]['id']}})[_0x47a5('0x20')](handleEntityNotFound(_0xf03bd5,null))[_0x47a5('0x20')](saveUpdates(_0x46e90b[_0x47a5('0x45')],null))['then'](respondWithResult(_0xf03bd5,null))[_0x47a5('0x40')](handleError(_0xf03bd5,null));};exports[_0x47a5('0x21')]=function(_0x187d7e,_0x8da9fb){return db[_0x47a5('0x29')][_0x47a5('0x43')]({'where':{'id':_0x187d7e['params']['id']}})[_0x47a5('0x20')](handleEntityNotFound(_0x8da9fb,null))[_0x47a5('0x20')](removeEntity(_0x8da9fb,null))[_0x47a5('0x40')](handleError(_0x8da9fb,null));};exports['download']=function(_0x4c5ed,_0x3c78b7,_0x183b3c){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x4c5ed[_0x47a5('0x4d')]['id']},'attributes':[_0x47a5('0x26'),'basename','savename',_0x47a5('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x3c78b7,null))[_0x47a5('0x20')](function(_0x5d383d){if(_0x5d383d){if(!fs['existsSync'](path[_0x47a5('0x4f')](config[_0x47a5('0x50')],'server/files/reports',_0x5d383d[_0x47a5('0x51')]))){throw new db[(_0x47a5('0x52'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x4c5ed[_0x47a5('0x30')][_0x47a5('0x53')]){return _0x3c78b7[_0x47a5('0x16')](0xc8);}return _0x3c78b7[_0x47a5('0x54')](path['join'](config[_0x47a5('0x50')],_0x47a5('0x55'),_0x5d383d[_0x47a5('0x51')]),util['format'](_0x47a5('0x56'),_0x5d383d['basename']||_0x5d383d[_0x47a5('0x26')],_0x5d383d[_0x47a5('0x4e')][_0x47a5('0x57')]()));}})[_0x47a5('0x40')](handleError(_0x3c78b7,null));}; \ No newline at end of file +var _0xb10b=['Report\x20not\x20found\x20or\x20empty','server/files/reports','format','%s.%s','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','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','AnalyticExtractedReport','findAll','catch','show','keys','filtears','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','savename','output','existsSync','join','root','Sequelize','ValidationError'];(function(_0x418850,_0xf85dfe){var _0x4cd572=function(_0x5901e2){while(--_0x5901e2){_0x418850['push'](_0x418850['shift']());}};_0x4cd572(++_0xf85dfe);}(_0xb10b,0x12a));var _0xbb10=function(_0x20006a,_0x30e3a9){_0x20006a=_0x20006a-0x0;var _0x5e26ac=_0xb10b[_0x20006a];return _0x5e26ac;};'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 licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x18'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x19')](_0x285009);}return _0x916a32[_0xbb10('0x1a')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x1a')](_0x42d7e4)[_0xbb10('0x1b')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=_0x36b5e8[_0xbb10('0x1c')],_0x2b184e=_0x24a57b[_0xbb10('0x1d')],_0x4a2bfc=_0x24a57b[_0xbb10('0x1d')]+_0x24a57b[_0xbb10('0x1e')],_0x2eca0f;if(_0x4a2bfc>=_0x3e26f4){_0x4a2bfc=_0x3e26f4;_0x2eca0f=0xc8;}else{_0x2eca0f=0xce;}_0x2f2ebf[_0xbb10('0x1a')](_0x2eca0f);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x2b184e+'-'+_0x4a2bfc+'/'+_0x3e26f4)[_0xbb10('0x1b')](_0x36b5e8);}return null;};}function patchUpdates(_0xe1c665){return function(_0x48b6e9){try{jsonpatch[_0xbb10('0x21')](_0x48b6e9,_0xe1c665,!![]);}catch(_0x19f48d){return BPromise[_0xbb10('0x22')](_0x19f48d);}return _0x48b6e9[_0xbb10('0x23')]();};}function saveUpdates(_0xdf237d,_0x44e563){return function(_0x4deb49){if(_0x4deb49){return _0x4deb49[_0xbb10('0x24')](_0xdf237d)[_0xbb10('0x25')](function(_0x50aea1){return _0x50aea1;});}return null;};}function removeEntity(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x26')]()[_0xbb10('0x25')](function(){var _0x445761=_0x311abe[_0xbb10('0x27')]({'plain':!![]});var _0x407cb4=_0xbb10('0x28');return db[_0xbb10('0x29')][_0xbb10('0x26')]({'where':{'type':_0x407cb4,'resourceId':_0x445761['id']}})[_0xbb10('0x25')](function(){return _0x311abe;});})[_0xbb10('0x25')](function(){_0x4c4b0d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fb5e0,_0xc93a04){return function(_0x3c5ae7){if(!_0x3c5ae7){_0x4fb5e0[_0xbb10('0x19')](0x194);}return _0x3c5ae7;};}function handleError(_0x4e25ff,_0x2fdde9){_0x2fdde9=_0x2fdde9||0x1f4;return function(_0x24d586){logger[_0xbb10('0x2a')](_0x24d586[_0xbb10('0x2b')]);if(_0x24d586[_0xbb10('0x2c')]){delete _0x24d586[_0xbb10('0x2c')];}_0x4e25ff[_0xbb10('0x1a')](_0x2fdde9)['send'](_0x24d586);};}exports[_0xbb10('0x2d')]=function(_0x21ac54,_0xfc3595){var _0x2e0249={},_0x1d30aa={},_0x2ff4c1={'count':0x0,'rows':[]};var _0x5d5c80=_[_0xbb10('0x2e')](db['AnalyticExtractedReport'][_0xbb10('0x2f')],function(_0x56f2da){return{'name':_0x56f2da[_0xbb10('0x30')],'type':_0x56f2da[_0xbb10('0x31')][_0xbb10('0x32')]};});_0x1d30aa['model']=_['map'](_0x5d5c80,_0xbb10('0x2c'));_0x1d30aa[_0xbb10('0x33')]=_['keys'](_0x21ac54[_0xbb10('0x33')]);_0x1d30aa[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x1d30aa[_0xbb10('0x36')],_0x1d30aa[_0xbb10('0x33')]);_0x2e0249[_0xbb10('0x37')]=_[_0xbb10('0x35')](_0x1d30aa['model'],qs[_0xbb10('0x38')](_0x21ac54[_0xbb10('0x33')][_0xbb10('0x38')]));_0x2e0249[_0xbb10('0x37')]=_0x2e0249[_0xbb10('0x37')][_0xbb10('0x39')]?_0x2e0249[_0xbb10('0x37')]:_0x1d30aa[_0xbb10('0x36')];if(!_0x21ac54[_0xbb10('0x33')]['hasOwnProperty'](_0xbb10('0x3a'))){_0x2e0249[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x21ac54[_0xbb10('0x33')]['limit']);_0x2e0249[_0xbb10('0x1d')]=qs['offset'](_0x21ac54['query'][_0xbb10('0x1d')]);}_0x2e0249[_0xbb10('0x3b')]=qs[_0xbb10('0x3c')](_0x21ac54[_0xbb10('0x33')][_0xbb10('0x3c')]);_0x2e0249[_0xbb10('0x3d')]=qs['filters'](_[_0xbb10('0x3e')](_0x21ac54[_0xbb10('0x33')],_0x1d30aa['filters']),_0x5d5c80);if(_0x21ac54['query']['filter']){_0x2e0249[_0xbb10('0x3d')]=_[_0xbb10('0x3f')](_0x2e0249[_0xbb10('0x3d')],{'$or':_['map'](_0x5d5c80,function(_0x3c0cd7){if(_0x3c0cd7[_0xbb10('0x31')]!==_0xbb10('0x40')){var _0x4d1a83={};_0x4d1a83[_0x3c0cd7[_0xbb10('0x2c')]]={'$like':'%'+_0x21ac54[_0xbb10('0x33')][_0xbb10('0x41')]+'%'};return _0x4d1a83;}})});}_0x2e0249=_[_0xbb10('0x3f')]({},_0x2e0249,_0x21ac54['options']);var _0xd238e9={'where':_0x2e0249[_0xbb10('0x3d')]};return db['AnalyticExtractedReport'][_0xbb10('0x1c')](_0xd238e9)[_0xbb10('0x25')](function(_0x44d6ae){_0x2ff4c1[_0xbb10('0x1c')]=_0x44d6ae;if(_0x21ac54[_0xbb10('0x33')][_0xbb10('0x42')]){_0x2e0249['include']=[{'all':!![]}];}return db[_0xbb10('0x43')][_0xbb10('0x44')](_0x2e0249);})[_0xbb10('0x25')](function(_0x3d3c41){_0x2ff4c1['rows']=_0x3d3c41;return _0x2ff4c1;})[_0xbb10('0x25')](respondWithFilteredResult(_0xfc3595,_0x2e0249))[_0xbb10('0x45')](handleError(_0xfc3595,null));};exports[_0xbb10('0x46')]=function(_0x403beb,_0x5e2cfa){var _0x351484={'raw':!![],'where':{'id':_0x403beb['params']['id']}},_0x202c60={};_0x202c60['model']=_[_0xbb10('0x47')](db['AnalyticExtractedReport'][_0xbb10('0x2f')]);_0x202c60[_0xbb10('0x33')]=_['keys'](_0x403beb[_0xbb10('0x33')]);_0x202c60[_0xbb10('0x48')]=_[_0xbb10('0x35')](_0x202c60['model'],_0x202c60[_0xbb10('0x33')]);_0x351484[_0xbb10('0x37')]=_[_0xbb10('0x35')](_0x202c60[_0xbb10('0x36')],qs[_0xbb10('0x38')](_0x403beb[_0xbb10('0x33')][_0xbb10('0x38')]));_0x351484[_0xbb10('0x37')]=_0x351484[_0xbb10('0x37')][_0xbb10('0x39')]?_0x351484[_0xbb10('0x37')]:_0x202c60[_0xbb10('0x36')];if(_0x403beb['query'][_0xbb10('0x42')]){_0x351484[_0xbb10('0x49')]=[{'all':!![]}];}_0x351484=_['merge']({},_0x351484,_0x403beb[_0xbb10('0x4a')]);return db[_0xbb10('0x43')][_0xbb10('0x4b')](_0x351484)[_0xbb10('0x25')](handleEntityNotFound(_0x5e2cfa,null))[_0xbb10('0x25')](respondWithResult(_0x5e2cfa,null))[_0xbb10('0x45')](handleError(_0x5e2cfa,null));};exports[_0xbb10('0x4c')]=function(_0x5be85e,_0x4a9793){return db[_0xbb10('0x43')][_0xbb10('0x4c')](_0x5be85e[_0xbb10('0x4d')],{})['then'](function(_0x5f0c12){var _0x3cd6f3=_0x5be85e[_0xbb10('0x4e')][_0xbb10('0x27')]({'plain':!![]});if(!_0x3cd6f3)throw new Error(_0xbb10('0x4f'));if(_0x3cd6f3[_0xbb10('0x50')]===_0xbb10('0x4e')){var _0x2f2552=_0x5f0c12[_0xbb10('0x27')]({'plain':!![]});var _0x2626d8=_0xbb10('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x2626d8,'userProfileId':_0x3cd6f3[_0xbb10('0x51')]},'raw':!![]})[_0xbb10('0x25')](function(_0x36ab7d){if(_0x36ab7d&&_0x36ab7d[_0xbb10('0x52')]===0x0){return db[_0xbb10('0x29')][_0xbb10('0x4c')]({'name':_0x2f2552[_0xbb10('0x2c')],'resourceId':_0x2f2552['id'],'type':_0x36ab7d[_0xbb10('0x2c')],'sectionId':_0x36ab7d['id']},{})[_0xbb10('0x25')](function(){return _0x5f0c12;});}else{return _0x5f0c12;}})[_0xbb10('0x45')](function(_0x19ca3e){logger[_0xbb10('0x2a')](_0xbb10('0x53'),_0x19ca3e);throw _0x19ca3e;});}return _0x5f0c12;})[_0xbb10('0x25')](respondWithResult(_0x4a9793,0xc9))[_0xbb10('0x45')](handleError(_0x4a9793,null));};exports['update']=function(_0x124052,_0x5bd44d){if(_0x124052[_0xbb10('0x4d')]['id']){delete _0x124052[_0xbb10('0x4d')]['id'];}return db[_0xbb10('0x43')][_0xbb10('0x4b')]({'where':{'id':_0x124052[_0xbb10('0x54')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x5bd44d,null))[_0xbb10('0x25')](saveUpdates(_0x124052[_0xbb10('0x4d')],null))[_0xbb10('0x25')](respondWithResult(_0x5bd44d,null))[_0xbb10('0x45')](handleError(_0x5bd44d,null));};exports[_0xbb10('0x26')]=function(_0x1c2dce,_0x1d49e1){return db[_0xbb10('0x43')][_0xbb10('0x4b')]({'where':{'id':_0x1c2dce['params']['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x1d49e1,null))[_0xbb10('0x25')](removeEntity(_0x1d49e1,null))[_0xbb10('0x45')](handleError(_0x1d49e1,null));};exports[_0xbb10('0x55')]=function(_0xbffa3c,_0x379d8c,_0x4bedd0){return db[_0xbb10('0x43')][_0xbb10('0x4b')]({'where':{'id':_0xbffa3c[_0xbb10('0x54')]['id']},'attributes':[_0xbb10('0x2c'),_0xbb10('0x56'),_0xbb10('0x57'),_0xbb10('0x58')],'raw':!![]})[_0xbb10('0x25')](handleEntityNotFound(_0x379d8c,null))[_0xbb10('0x25')](function(_0x40c4fb){if(_0x40c4fb){if(!fs[_0xbb10('0x59')](path[_0xbb10('0x5a')](config[_0xbb10('0x5b')],'server/files/reports',_0x40c4fb['savename']))){throw new db[(_0xbb10('0x5c'))][(_0xbb10('0x5d'))](_0xbb10('0x5e'));}if(_0xbffa3c[_0xbb10('0x33')]['exists']){return _0x379d8c['sendStatus'](0xc8);}return _0x379d8c[_0xbb10('0x55')](path[_0xbb10('0x5a')](config[_0xbb10('0x5b')],_0xbb10('0x5f'),_0x40c4fb[_0xbb10('0x57')]),util[_0xbb10('0x60')](_0xbb10('0x61'),_0x40c4fb['basename']||_0x40c4fb[_0xbb10('0x2c')],_0x40c4fb[_0xbb10('0x58')]['toLowerCase']()));}})['catch'](handleError(_0x379d8c,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 1fbb8f0..2ef0b86 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 _0x71b0=['exports','define','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x71b0,0x10a));var _0x071b=function(_0x364cba,_0x19c43b){_0x364cba=_0x364cba-0x0;var _0x1e6de2=_0x71b0[_0x364cba];return _0x1e6de2;};'use strict';var _=require(_0x071b('0x0'));var util=require(_0x071b('0x1'));var logger=require(_0x071b('0x2'))(_0x071b('0x3'));var moment=require('moment');var BPromise=require(_0x071b('0x4'));var rp=require(_0x071b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x071b('0x6'));var config=require(_0x071b('0x7'));var attributes=require(_0x071b('0x8'));module[_0x071b('0x9')]=function(_0x4518a9,_0x893236){return _0x4518a9[_0x071b('0xa')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa07c=['analytics_extracted_reports','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport'];(function(_0x1165ff,_0x375a85){var _0x169b79=function(_0x47534c){while(--_0x47534c){_0x1165ff['push'](_0x1165ff['shift']());}};_0x169b79(++_0x375a85);}(_0xa07c,0x16c));var _0xca07=function(_0xba4634,_0x6029b2){_0xba4634=_0xba4634-0x0;var _0x2ff5a7=_0xa07c[_0xba4634];return _0x2ff5a7;};'use strict';var _=require('lodash');var util=require(_0xca07('0x0'));var logger=require('../../config/logger')(_0xca07('0x1'));var moment=require(_0xca07('0x2'));var BPromise=require(_0xca07('0x3'));var rp=require(_0xca07('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca07('0x5'));var config=require(_0xca07('0x6'));var attributes=require(_0xca07('0x7'));module['exports']=function(_0x17f193,_0x445640){return _0x17f193[_0xca07('0x8')](_0xca07('0x9'),attributes,{'tableName':_0xca07('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 265a0a5..8e114d7 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 _0x8e3d=['jayson/promise','client','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4b5781,_0x423366){var _0x55526b=function(_0x261642){while(--_0x261642){_0x4b5781['push'](_0x4b5781['shift']());}};_0x55526b(++_0x423366);}(_0x8e3d,0xc6));var _0xd8e3=function(_0x118efa,_0x324857){_0x118efa=_0x118efa-0x0;var _0x154091=_0x8e3d[_0x118efa];return _0x154091;};'use strict';var _=require(_0xd8e3('0x0'));var util=require('util');var moment=require(_0xd8e3('0x1'));var BPromise=require(_0xd8e3('0x2'));var rs=require(_0xd8e3('0x3'));var fs=require('fs');var Redis=require(_0xd8e3('0x4'));var db=require(_0xd8e3('0x5'))['db'];var utils=require(_0xd8e3('0x6'));var logger=require(_0xd8e3('0x7'))('rpc');var config=require(_0xd8e3('0x8'));var jayson=require(_0xd8e3('0x9'));var client=jayson[_0xd8e3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38d8a7,_0x4b5e5c,_0x8db3f4){return new BPromise(function(_0x138175,_0xa8f2aa){return client[_0xd8e3('0xb')](_0x38d8a7,_0x8db3f4)['then'](function(_0x5d07d5){logger[_0xd8e3('0xc')](_0xd8e3('0xd'),_0x4b5e5c,_0xd8e3('0xe'));logger[_0xd8e3('0xf')](_0xd8e3('0x10'),_0x4b5e5c,_0xd8e3('0xe'),JSON[_0xd8e3('0x11')](_0x5d07d5));if(_0x5d07d5[_0xd8e3('0x12')]){if(_0x5d07d5[_0xd8e3('0x12')][_0xd8e3('0x13')]===0x1f4){logger[_0xd8e3('0x12')](_0xd8e3('0xd'),_0x4b5e5c,_0x5d07d5[_0xd8e3('0x12')][_0xd8e3('0x14')]);return _0xa8f2aa(_0x5d07d5[_0xd8e3('0x12')][_0xd8e3('0x14')]);}logger[_0xd8e3('0x12')](_0xd8e3('0xd'),_0x4b5e5c,_0x5d07d5[_0xd8e3('0x12')]['message']);return _0x138175(_0x5d07d5[_0xd8e3('0x12')][_0xd8e3('0x14')]);}else{logger[_0xd8e3('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4b5e5c,_0xd8e3('0xe'));_0x138175(_0x5d07d5[_0xd8e3('0x15')][_0xd8e3('0x14')]);}})[_0xd8e3('0x16')](function(_0x52cec1){logger[_0xd8e3('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4b5e5c,_0x52cec1);_0xa8f2aa(_0x52cec1);});});} \ No newline at end of file +var _0x8853=['then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request'];(function(_0x381150,_0x204b8b){var _0x30bf65=function(_0x5c355c){while(--_0x5c355c){_0x381150['push'](_0x381150['shift']());}};_0x30bf65(++_0x204b8b);}(_0x8853,0x1ef));var _0x3885=function(_0x4c6e6e,_0x53740d){_0x4c6e6e=_0x4c6e6e-0x0;var _0x5ec6b0=_0x8853[_0x4c6e6e];return _0x5ec6b0;};'use strict';var _=require(_0x3885('0x0'));var util=require('util');var moment=require(_0x3885('0x1'));var BPromise=require(_0x3885('0x2'));var rs=require(_0x3885('0x3'));var fs=require('fs');var Redis=require(_0x3885('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3885('0x5'));var logger=require(_0x3885('0x6'))(_0x3885('0x7'));var config=require('../../config/environment');var jayson=require(_0x3885('0x8'));var client=jayson['client'][_0x3885('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25962e,_0x7cded4,_0x21ea6a){return new BPromise(function(_0x467962,_0x56c1b1){return client[_0x3885('0xa')](_0x25962e,_0x21ea6a)[_0x3885('0xb')](function(_0x1b2241){logger['info'](_0x3885('0xc'),_0x7cded4,_0x3885('0xd'));logger[_0x3885('0xe')](_0x3885('0xf'),_0x7cded4,_0x3885('0xd'),JSON[_0x3885('0x10')](_0x1b2241));if(_0x1b2241[_0x3885('0x11')]){if(_0x1b2241['error'][_0x3885('0x12')]===0x1f4){logger[_0x3885('0x11')](_0x3885('0xc'),_0x7cded4,_0x1b2241[_0x3885('0x11')][_0x3885('0x13')]);return _0x56c1b1(_0x1b2241[_0x3885('0x11')]['message']);}logger[_0x3885('0x11')](_0x3885('0xc'),_0x7cded4,_0x1b2241[_0x3885('0x11')][_0x3885('0x13')]);return _0x467962(_0x1b2241[_0x3885('0x11')][_0x3885('0x13')]);}else{logger[_0x3885('0x14')](_0x3885('0xc'),_0x7cded4,'request\x20sent');_0x467962(_0x1b2241[_0x3885('0x15')][_0x3885('0x13')]);}})[_0x3885('0x16')](function(_0x251213){logger[_0x3885('0x11')](_0x3885('0xc'),_0x7cded4,_0x251213);_0x56c1b1(_0x251213);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 7821e1e..24bae4e 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 _0x0662=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated','show','download','post','create','put','update','delete'];(function(_0x3f0c58,_0x133188){var _0x46ae10=function(_0x566fe8){while(--_0x566fe8){_0x3f0c58['push'](_0x3f0c58['shift']());}};_0x46ae10(++_0x133188);}(_0x0662,0x1a5));var _0x2066=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x0662[_0x5783f4];return _0x28e380;};'use strict';var multer=require('multer');var util=require(_0x2066('0x0'));var path=require(_0x2066('0x1'));var timeout=require(_0x2066('0x2'));var express=require(_0x2066('0x3'));var router=express[_0x2066('0x4')]();var auth=require(_0x2066('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2066('0x6'));var controller=require(_0x2066('0x7'));router[_0x2066('0x8')]('/',auth['isAuthenticated'](),controller[_0x2066('0x9')]);router[_0x2066('0x8')](_0x2066('0xa'),auth[_0x2066('0xb')](),controller[_0x2066('0xc')]);router[_0x2066('0x8')]('/:id/download',auth[_0x2066('0xb')](),controller[_0x2066('0xd')]);router[_0x2066('0xe')]('/',auth['isAuthenticated'](),controller[_0x2066('0xf')]);router[_0x2066('0x10')](_0x2066('0xa'),auth[_0x2066('0xb')](),controller[_0x2066('0x11')]);router[_0x2066('0x12')](_0x2066('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x2066('0x13')]=router; \ No newline at end of file +var _0x6e4f=['../../config/environment','./analyticExtractedReport.controller','get','/:id','isAuthenticated','show','download','post','create','put','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4bb11e,_0xba04e1){var _0x1bc939=function(_0x4244c3){while(--_0x4244c3){_0x4bb11e['push'](_0x4bb11e['shift']());}};_0x1bc939(++_0xba04e1);}(_0x6e4f,0x1e8));var _0xf6e4=function(_0x214b7e,_0x12f8a4){_0x214b7e=_0x214b7e-0x0;var _0x69191d=_0x6e4f[_0x214b7e];return _0x69191d;};'use strict';var multer=require('multer');var util=require(_0xf6e4('0x0'));var path=require(_0xf6e4('0x1'));var timeout=require(_0xf6e4('0x2'));var express=require('express');var router=express[_0xf6e4('0x3')]();var auth=require(_0xf6e4('0x4'));var interaction=require(_0xf6e4('0x5'));var config=require(_0xf6e4('0x6'));var controller=require(_0xf6e4('0x7'));router[_0xf6e4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf6e4('0x8')](_0xf6e4('0x9'),auth[_0xf6e4('0xa')](),controller[_0xf6e4('0xb')]);router[_0xf6e4('0x8')]('/:id/download',auth[_0xf6e4('0xa')](),controller[_0xf6e4('0xc')]);router[_0xf6e4('0xd')]('/',auth[_0xf6e4('0xa')](),controller[_0xf6e4('0xe')]);router[_0xf6e4('0xf')](_0xf6e4('0x9'),auth[_0xf6e4('0xa')](),controller['update']);router[_0xf6e4('0x10')]('/:id',auth[_0xf6e4('0xa')](),controller[_0xf6e4('0x11')]);module[_0xf6e4('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 2d42168..40ae65b 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x3bd079,_0x2a0dbb){var _0x55383d=function(_0x3f3ea8){while(--_0x3f3ea8){_0x3bd079['push'](_0x3bd079['shift']());}};_0x55383d(++_0x2a0dbb);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc4aa[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'field':{'type':Sequelize[_0xac4a('0x2')]},'alias':{'type':Sequelize[_0xac4a('0x3')]},'function':{'type':Sequelize[_0xac4a('0x3')]},'format':{'type':Sequelize[_0xac4a('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x4ed5e0,_0x51cc17){var _0x3d9ff0=function(_0x767297){while(--_0x767297){_0x4ed5e0['push'](_0x4ed5e0['shift']());}};_0x3d9ff0(++_0x51cc17);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xc4aa[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'field':{'type':Sequelize[_0xac4a('0x2')]},'alias':{'type':Sequelize[_0xac4a('0x3')]},'function':{'type':Sequelize[_0xac4a('0x3')]},'format':{'type':Sequelize[_0xac4a('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 7664b7e..5b2f387 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 _0x934a=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','nolimit','sort','pick','filter','where','type','merge','options','includeAll','include','findAll','rows','catch','show','params','filtears','create','bulkCreate','body','find','ids','sequelize','transaction','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x37c347,_0x529584){var _0x2b2c23=function(_0x4a861d){while(--_0x4a861d){_0x37c347['push'](_0x37c347['shift']());}};_0x2b2c23(++_0x529584);}(_0x934a,0x127));var _0xa934=function(_0x119cd8,_0x556b73){_0x119cd8=_0x119cd8-0x0;var _0x7072a3=_0x934a[_0x119cd8];return _0x7072a3;};'use strict';var pdf=require(_0xa934('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa934('0x1'));var zipdir=require(_0xa934('0x2'));var jsonpatch=require(_0xa934('0x3'));var rp=require(_0xa934('0x4'));var moment=require('moment');var BPromise=require(_0xa934('0x5'));var Mustache=require(_0xa934('0x6'));var util=require(_0xa934('0x7'));var path=require(_0xa934('0x8'));var sox=require('sox');var csv=require(_0xa934('0x9'));var ejs=require(_0xa934('0xa'));var fs=require('fs');var _=require(_0xa934('0xb'));var squel=require('squel');var crypto=require(_0xa934('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa934('0xd'));var toCsv=require(_0xa934('0x9'));var querystring=require(_0xa934('0xe'));var Papa=require(_0xa934('0xf'));var Redis=require(_0xa934('0x10'));var authService=require(_0xa934('0x11'));var qs=require(_0xa934('0x12'));var as=require(_0xa934('0x13'));var hardwareService=require(_0xa934('0x14'));var logger=require(_0xa934('0x15'))(_0xa934('0x16'));var utils=require(_0xa934('0x17'));var config=require(_0xa934('0x18'));var licenseUtil=require(_0xa934('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x932fc0,_0x1b04ad){_0x1b04ad=_0x1b04ad||0xcc;return function(_0x4fe641){if(_0x4fe641){return _0x932fc0[_0xa934('0x1a')](_0x1b04ad);}return _0x932fc0['status'](_0x1b04ad)['end']();};}function respondWithResult(_0x2a4d54,_0x3d319d){_0x3d319d=_0x3d319d||0xc8;return function(_0x13d164){if(_0x13d164){return _0x2a4d54[_0xa934('0x1b')](_0x3d319d)[_0xa934('0x1c')](_0x13d164);}};}function respondWithFilteredResult(_0x318b24,_0x2f846b){return function(_0x2424f0){if(_0x2424f0){var _0x495bb1=_0x2424f0[_0xa934('0x1d')],_0x5e0d45=_0x2f846b[_0xa934('0x1e')],_0x2d1707=_0x2f846b[_0xa934('0x1e')]+_0x2f846b[_0xa934('0x1f')],_0x4f904f;if(_0x2d1707>=_0x495bb1){_0x2d1707=_0x495bb1;_0x4f904f=0xc8;}else{_0x4f904f=0xce;}_0x318b24[_0xa934('0x1b')](_0x4f904f);return _0x318b24[_0xa934('0x20')](_0xa934('0x21'),_0x5e0d45+'-'+_0x2d1707+'/'+_0x495bb1)[_0xa934('0x1c')](_0x2424f0);}return null;};}function patchUpdates(_0x17487d){return function(_0x19a1ee){try{jsonpatch[_0xa934('0x22')](_0x19a1ee,_0x17487d,!![]);}catch(_0xabe4af){return BPromise['reject'](_0xabe4af);}return _0x19a1ee[_0xa934('0x23')]();};}function saveUpdates(_0x499294,_0x7f9aa8){return function(_0x24dc73){if(_0x24dc73){return _0x24dc73[_0xa934('0x24')](_0x499294)[_0xa934('0x25')](function(_0xed0ec9){return _0xed0ec9;});}return null;};}function removeEntity(_0xd869c2,_0x530a38){return function(_0x1cabe8){if(_0x1cabe8){return _0x1cabe8[_0xa934('0x26')]()['then'](function(){_0xd869c2['status'](0xcc)[_0xa934('0x27')]();});}};}function handleEntityNotFound(_0x1da422,_0x23a9bf){return function(_0x4530f5){if(!_0x4530f5){_0x1da422['sendStatus'](0x194);}return _0x4530f5;};}function handleError(_0x4c0ce5,_0x1b4fcb){_0x1b4fcb=_0x1b4fcb||0x1f4;return function(_0x5afd87){logger[_0xa934('0x28')](_0x5afd87['stack']);if(_0x5afd87[_0xa934('0x29')]){delete _0x5afd87[_0xa934('0x29')];}_0x4c0ce5[_0xa934('0x1b')](_0x1b4fcb)[_0xa934('0x2a')](_0x5afd87);};}exports[_0xa934('0x2b')]=function(_0x5e1167,_0xe7ba3b){var _0x439a53={},_0x5a83a7={},_0x3f8494={'count':0x0,'rows':[]};var _0x6f4331=_[_0xa934('0x2c')](db[_0xa934('0x2d')][_0xa934('0x2e')],function(_0x2c9897){return{'name':_0x2c9897[_0xa934('0x2f')],'type':_0x2c9897['type'][_0xa934('0x30')]};});_0x5a83a7[_0xa934('0x31')]=_[_0xa934('0x2c')](_0x6f4331,_0xa934('0x29'));_0x5a83a7['query']=_[_0xa934('0x32')](_0x5e1167[_0xa934('0x33')]);_0x5a83a7[_0xa934('0x34')]=_['intersection'](_0x5a83a7['model'],_0x5a83a7[_0xa934('0x33')]);_0x439a53[_0xa934('0x35')]=_[_0xa934('0x36')](_0x5a83a7['model'],qs['fields'](_0x5e1167[_0xa934('0x33')][_0xa934('0x37')]));_0x439a53[_0xa934('0x35')]=_0x439a53[_0xa934('0x35')]['length']?_0x439a53[_0xa934('0x35')]:_0x5a83a7[_0xa934('0x31')];if(!_0x5e1167[_0xa934('0x33')]['hasOwnProperty'](_0xa934('0x38'))){_0x439a53['limit']=qs['limit'](_0x5e1167['query'][_0xa934('0x1f')]);_0x439a53[_0xa934('0x1e')]=qs[_0xa934('0x1e')](_0x5e1167['query'][_0xa934('0x1e')]);}_0x439a53['order']=qs[_0xa934('0x39')](_0x5e1167[_0xa934('0x33')][_0xa934('0x39')]);_0x439a53['where']=qs[_0xa934('0x34')](_[_0xa934('0x3a')](_0x5e1167['query'],_0x5a83a7[_0xa934('0x34')]),_0x6f4331);if(_0x5e1167['query'][_0xa934('0x3b')]){_0x439a53[_0xa934('0x3c')]=_['merge'](_0x439a53['where'],{'$or':_[_0xa934('0x2c')](_0x6f4331,function(_0x3a5f19){if(_0x3a5f19[_0xa934('0x3d')]!=='VIRTUAL'){var _0xe2dd={};_0xe2dd[_0x3a5f19[_0xa934('0x29')]]={'$like':'%'+_0x5e1167[_0xa934('0x33')][_0xa934('0x3b')]+'%'};return _0xe2dd;}})});}_0x439a53=_[_0xa934('0x3e')]({},_0x439a53,_0x5e1167[_0xa934('0x3f')]);var _0x5f465f={'where':_0x439a53[_0xa934('0x3c')]};return db[_0xa934('0x2d')][_0xa934('0x1d')](_0x5f465f)[_0xa934('0x25')](function(_0x248a27){_0x3f8494[_0xa934('0x1d')]=_0x248a27;if(_0x5e1167[_0xa934('0x33')][_0xa934('0x40')]){_0x439a53[_0xa934('0x41')]=[{'all':!![]}];}return db[_0xa934('0x2d')][_0xa934('0x42')](_0x439a53);})[_0xa934('0x25')](function(_0x252b60){_0x3f8494[_0xa934('0x43')]=_0x252b60;return _0x3f8494;})[_0xa934('0x25')](respondWithFilteredResult(_0xe7ba3b,_0x439a53))[_0xa934('0x44')](handleError(_0xe7ba3b,null));};exports[_0xa934('0x45')]=function(_0x3dd24b,_0x7def5e){var _0xfb1f07={'raw':![],'where':{'id':_0x3dd24b[_0xa934('0x46')]['id']}},_0x4afd34={};_0x4afd34[_0xa934('0x31')]=_['keys'](db[_0xa934('0x2d')][_0xa934('0x2e')]);_0x4afd34[_0xa934('0x33')]=_[_0xa934('0x32')](_0x3dd24b[_0xa934('0x33')]);_0x4afd34[_0xa934('0x47')]=_['intersection'](_0x4afd34[_0xa934('0x31')],_0x4afd34[_0xa934('0x33')]);_0xfb1f07['attributes']=_['intersection'](_0x4afd34[_0xa934('0x31')],qs['fields'](_0x3dd24b[_0xa934('0x33')][_0xa934('0x37')]));_0xfb1f07[_0xa934('0x35')]=_0xfb1f07['attributes']['length']?_0xfb1f07[_0xa934('0x35')]:_0x4afd34[_0xa934('0x31')];if(_0x3dd24b[_0xa934('0x33')]['includeAll']){_0xfb1f07[_0xa934('0x41')]=[{'all':!![]}];}_0xfb1f07=_['merge']({},_0xfb1f07,_0x3dd24b['options']);return db[_0xa934('0x2d')]['find'](_0xfb1f07)[_0xa934('0x25')](handleEntityNotFound(_0x7def5e,null))['then'](respondWithResult(_0x7def5e,null))['catch'](handleError(_0x7def5e,null));};exports['create']=function(_0x42885b,_0x4eda79){return db['AnalyticFieldReport'][_0xa934('0x48')](_0x42885b['body'],{})['then'](respondWithResult(_0x4eda79,0xc9))[_0xa934('0x44')](handleError(_0x4eda79,null));};exports['bulkCreate']=function(_0x37784a,_0x20168b){return db[_0xa934('0x2d')][_0xa934('0x49')](_0x37784a[_0xa934('0x4a')],{'raw':![],'individualHooks':!![]})[_0xa934('0x25')](respondWithResult(_0x20168b,0xc9))[_0xa934('0x44')](handleError(_0x20168b,null));};exports[_0xa934('0x24')]=function(_0xaef879,_0x443c39){if(_0xaef879[_0xa934('0x4a')]['id']){delete _0xaef879[_0xa934('0x4a')]['id'];}return db[_0xa934('0x2d')][_0xa934('0x4b')]({'where':{'id':_0xaef879[_0xa934('0x46')]['id']}})[_0xa934('0x25')](handleEntityNotFound(_0x443c39,null))[_0xa934('0x25')](saveUpdates(_0xaef879[_0xa934('0x4a')],null))[_0xa934('0x25')](respondWithResult(_0x443c39,null))['catch'](handleError(_0x443c39,null));};exports['destroy']=function(_0x5c67c9,_0x17c643){return db[_0xa934('0x2d')]['find']({'where':{'id':_0x5c67c9[_0xa934('0x46')]['id']}})[_0xa934('0x25')](handleEntityNotFound(_0x17c643,null))[_0xa934('0x25')](removeEntity(_0x17c643,null))[_0xa934('0x44')](handleError(_0x17c643,null));};exports['bulkDestroy']=function(_0x7cfd36,_0x782586){return db[_0xa934('0x2d')][_0xa934('0x26')]({'where':{'id':_0x7cfd36[_0xa934('0x33')][_0xa934('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0xa934('0x25')](respondWithResult(_0x782586,0xcc))[_0xa934('0x44')](handleError(_0x782586,null));};exports['addFields']=function(_0x259247,_0x54d36d,_0x589501){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x259247['params']['id']}})[_0xa934('0x25')](handleEntityNotFound(_0x54d36d,null))[_0xa934('0x25')](function(_0x197acb){if(_0x197acb){return db[_0xa934('0x4d')][_0xa934('0x4e')](function(_0x3eb21f){return db[_0xa934('0x2d')][_0xa934('0x26')]({'where':{'CustomReportId':_0x259247[_0xa934('0x46')]['id']},'transaction':_0x3eb21f})['then'](function(_0xe06ed6){var _0x48a976=_['map'](_0x259247[_0xa934('0x4a')],function(_0x1ae4f2){delete _0x1ae4f2['id'];_0x1ae4f2['CustomReportId']=_0x259247['params']['id'];return _0x1ae4f2;});return db['AnalyticFieldReport'][_0xa934('0x49')](_0x48a976,{'transaction':_0x3eb21f});});})[_0xa934('0x25')](function(){return db[_0xa934('0x2d')][_0xa934('0x42')]({'where':{'CustomReportId':_0x259247[_0xa934('0x46')]['id']}});});}})[_0xa934('0x25')](respondWithResult(_0x54d36d,null))[_0xa934('0x44')](handleError(_0x54d36d,null));}; \ No newline at end of file +var _0x0db8=['set','json','reject','update','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','rawAttributes','filtears','find','create','body','params','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit'];(function(_0x360b6a,_0x4f1d44){var _0x5d038d=function(_0x27fa99){while(--_0x27fa99){_0x360b6a['push'](_0x360b6a['shift']());}};_0x5d038d(++_0x4f1d44);}(_0x0db8,0xd4));var _0x80db=function(_0x1d97c0,_0x42db3c){_0x1d97c0=_0x1d97c0-0x0;var _0x5381df=_0x0db8[_0x1d97c0];return _0x5381df;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x80db('0x0'));var rimraf=require(_0x80db('0x1'));var zipdir=require(_0x80db('0x2'));var jsonpatch=require(_0x80db('0x3'));var rp=require(_0x80db('0x4'));var moment=require('moment');var BPromise=require(_0x80db('0x5'));var Mustache=require(_0x80db('0x6'));var util=require(_0x80db('0x7'));var path=require('path');var sox=require(_0x80db('0x8'));var csv=require(_0x80db('0x9'));var ejs=require(_0x80db('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x80db('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x80db('0xc'));var toCsv=require(_0x80db('0x9'));var querystring=require(_0x80db('0xd'));var Papa=require(_0x80db('0xe'));var Redis=require(_0x80db('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x80db('0x10'));var as=require(_0x80db('0x11'));var hardwareService=require(_0x80db('0x12'));var logger=require(_0x80db('0x13'))(_0x80db('0x14'));var utils=require(_0x80db('0x15'));var config=require(_0x80db('0x16'));var licenseUtil=require(_0x80db('0x17'));var db=require(_0x80db('0x18'))['db'];function respondWithStatusCode(_0x8dd341,_0x78170e){_0x78170e=_0x78170e||0xcc;return function(_0x38ed9b){if(_0x38ed9b){return _0x8dd341[_0x80db('0x19')](_0x78170e);}return _0x8dd341[_0x80db('0x1a')](_0x78170e)[_0x80db('0x1b')]();};}function respondWithResult(_0x338713,_0x13f1cf){_0x13f1cf=_0x13f1cf||0xc8;return function(_0xb84300){if(_0xb84300){return _0x338713[_0x80db('0x1a')](_0x13f1cf)['json'](_0xb84300);}};}function respondWithFilteredResult(_0x3a755f,_0x1044ed){return function(_0x10d1cd){if(_0x10d1cd){var _0x25774=_0x10d1cd[_0x80db('0x1c')],_0x409773=_0x1044ed['offset'],_0x978b53=_0x1044ed[_0x80db('0x1d')]+_0x1044ed[_0x80db('0x1e')],_0x4f580b;if(_0x978b53>=_0x25774){_0x978b53=_0x25774;_0x4f580b=0xc8;}else{_0x4f580b=0xce;}_0x3a755f[_0x80db('0x1a')](_0x4f580b);return _0x3a755f[_0x80db('0x1f')]('Content-Range',_0x409773+'-'+_0x978b53+'/'+_0x25774)[_0x80db('0x20')](_0x10d1cd);}return null;};}function patchUpdates(_0x58c38a){return function(_0x4dabf8){try{jsonpatch['apply'](_0x4dabf8,_0x58c38a,!![]);}catch(_0x3b0e00){return BPromise[_0x80db('0x21')](_0x3b0e00);}return _0x4dabf8['save']();};}function saveUpdates(_0x50eb1e,_0x3d91ee){return function(_0x8f5c75){if(_0x8f5c75){return _0x8f5c75[_0x80db('0x22')](_0x50eb1e)[_0x80db('0x23')](function(_0x30b925){return _0x30b925;});}return null;};}function removeEntity(_0x901f9e,_0x31b9d2){return function(_0x4fcc0f){if(_0x4fcc0f){return _0x4fcc0f[_0x80db('0x24')]()[_0x80db('0x23')](function(){_0x901f9e[_0x80db('0x1a')](0xcc)[_0x80db('0x1b')]();});}};}function handleEntityNotFound(_0x2ceac7,_0x2e2df3){return function(_0x57ec9d){if(!_0x57ec9d){_0x2ceac7[_0x80db('0x19')](0x194);}return _0x57ec9d;};}function handleError(_0x50773b,_0xe12f43){_0xe12f43=_0xe12f43||0x1f4;return function(_0x22fb02){logger[_0x80db('0x25')](_0x22fb02[_0x80db('0x26')]);if(_0x22fb02['name']){delete _0x22fb02[_0x80db('0x27')];}_0x50773b[_0x80db('0x1a')](_0xe12f43)[_0x80db('0x28')](_0x22fb02);};}exports[_0x80db('0x29')]=function(_0x57b883,_0x5c2e34){var _0x5ab8ff={},_0x1173db={},_0x4cac31={'count':0x0,'rows':[]};var _0x50a7b1=_[_0x80db('0x2a')](db[_0x80db('0x2b')]['rawAttributes'],function(_0x374ccc){return{'name':_0x374ccc[_0x80db('0x2c')],'type':_0x374ccc[_0x80db('0x2d')][_0x80db('0x2e')]};});_0x1173db[_0x80db('0x2f')]=_['map'](_0x50a7b1,_0x80db('0x27'));_0x1173db[_0x80db('0x30')]=_[_0x80db('0x31')](_0x57b883[_0x80db('0x30')]);_0x1173db[_0x80db('0x32')]=_['intersection'](_0x1173db[_0x80db('0x2f')],_0x1173db[_0x80db('0x30')]);_0x5ab8ff[_0x80db('0x33')]=_[_0x80db('0x34')](_0x1173db[_0x80db('0x2f')],qs[_0x80db('0x35')](_0x57b883['query']['fields']));_0x5ab8ff['attributes']=_0x5ab8ff['attributes'][_0x80db('0x36')]?_0x5ab8ff['attributes']:_0x1173db[_0x80db('0x2f')];if(!_0x57b883[_0x80db('0x30')]['hasOwnProperty']('nolimit')){_0x5ab8ff[_0x80db('0x1e')]=qs['limit'](_0x57b883[_0x80db('0x30')]['limit']);_0x5ab8ff['offset']=qs[_0x80db('0x1d')](_0x57b883[_0x80db('0x30')][_0x80db('0x1d')]);}_0x5ab8ff[_0x80db('0x37')]=qs[_0x80db('0x38')](_0x57b883['query'][_0x80db('0x38')]);_0x5ab8ff[_0x80db('0x39')]=qs[_0x80db('0x32')](_[_0x80db('0x3a')](_0x57b883['query'],_0x1173db[_0x80db('0x32')]),_0x50a7b1);if(_0x57b883[_0x80db('0x30')][_0x80db('0x3b')]){_0x5ab8ff[_0x80db('0x39')]=_[_0x80db('0x3c')](_0x5ab8ff[_0x80db('0x39')],{'$or':_[_0x80db('0x2a')](_0x50a7b1,function(_0x481bb0){if(_0x481bb0[_0x80db('0x2d')]!=='VIRTUAL'){var _0x337baa={};_0x337baa[_0x481bb0[_0x80db('0x27')]]={'$like':'%'+_0x57b883[_0x80db('0x30')][_0x80db('0x3b')]+'%'};return _0x337baa;}})});}_0x5ab8ff=_[_0x80db('0x3c')]({},_0x5ab8ff,_0x57b883[_0x80db('0x3d')]);var _0x495163={'where':_0x5ab8ff['where']};return db[_0x80db('0x2b')][_0x80db('0x1c')](_0x495163)[_0x80db('0x23')](function(_0x5be150){_0x4cac31['count']=_0x5be150;if(_0x57b883[_0x80db('0x30')][_0x80db('0x3e')]){_0x5ab8ff[_0x80db('0x3f')]=[{'all':!![]}];}return db[_0x80db('0x2b')]['findAll'](_0x5ab8ff);})[_0x80db('0x23')](function(_0x9bcd25){_0x4cac31[_0x80db('0x40')]=_0x9bcd25;return _0x4cac31;})[_0x80db('0x23')](respondWithFilteredResult(_0x5c2e34,_0x5ab8ff))[_0x80db('0x41')](handleError(_0x5c2e34,null));};exports[_0x80db('0x42')]=function(_0x3aa629,_0x25c356){var _0x463232={'raw':![],'where':{'id':_0x3aa629['params']['id']}},_0x3d1b1f={};_0x3d1b1f['model']=_[_0x80db('0x31')](db[_0x80db('0x2b')][_0x80db('0x43')]);_0x3d1b1f['query']=_[_0x80db('0x31')](_0x3aa629[_0x80db('0x30')]);_0x3d1b1f[_0x80db('0x44')]=_['intersection'](_0x3d1b1f[_0x80db('0x2f')],_0x3d1b1f[_0x80db('0x30')]);_0x463232['attributes']=_[_0x80db('0x34')](_0x3d1b1f['model'],qs[_0x80db('0x35')](_0x3aa629[_0x80db('0x30')][_0x80db('0x35')]));_0x463232[_0x80db('0x33')]=_0x463232[_0x80db('0x33')]['length']?_0x463232[_0x80db('0x33')]:_0x3d1b1f[_0x80db('0x2f')];if(_0x3aa629[_0x80db('0x30')][_0x80db('0x3e')]){_0x463232[_0x80db('0x3f')]=[{'all':!![]}];}_0x463232=_[_0x80db('0x3c')]({},_0x463232,_0x3aa629['options']);return db[_0x80db('0x2b')][_0x80db('0x45')](_0x463232)[_0x80db('0x23')](handleEntityNotFound(_0x25c356,null))[_0x80db('0x23')](respondWithResult(_0x25c356,null))['catch'](handleError(_0x25c356,null));};exports['create']=function(_0x4f7edb,_0x2e2404){return db[_0x80db('0x2b')][_0x80db('0x46')](_0x4f7edb[_0x80db('0x47')],{})[_0x80db('0x23')](respondWithResult(_0x2e2404,0xc9))[_0x80db('0x41')](handleError(_0x2e2404,null));};exports['bulkCreate']=function(_0x47d607,_0x15f003){return db[_0x80db('0x2b')]['bulkCreate'](_0x47d607[_0x80db('0x47')],{'raw':![],'individualHooks':!![]})[_0x80db('0x23')](respondWithResult(_0x15f003,0xc9))[_0x80db('0x41')](handleError(_0x15f003,null));};exports[_0x80db('0x22')]=function(_0xcaee32,_0x1abebb){if(_0xcaee32['body']['id']){delete _0xcaee32[_0x80db('0x47')]['id'];}return db['AnalyticFieldReport'][_0x80db('0x45')]({'where':{'id':_0xcaee32[_0x80db('0x48')]['id']}})[_0x80db('0x23')](handleEntityNotFound(_0x1abebb,null))[_0x80db('0x23')](saveUpdates(_0xcaee32[_0x80db('0x47')],null))[_0x80db('0x23')](respondWithResult(_0x1abebb,null))[_0x80db('0x41')](handleError(_0x1abebb,null));};exports[_0x80db('0x24')]=function(_0x2c6df3,_0x465f2b){return db[_0x80db('0x2b')][_0x80db('0x45')]({'where':{'id':_0x2c6df3[_0x80db('0x48')]['id']}})[_0x80db('0x23')](handleEntityNotFound(_0x465f2b,null))['then'](removeEntity(_0x465f2b,null))['catch'](handleError(_0x465f2b,null));};exports[_0x80db('0x49')]=function(_0x231a81,_0x29f649){return db[_0x80db('0x2b')][_0x80db('0x24')]({'where':{'id':_0x231a81[_0x80db('0x30')][_0x80db('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0x80db('0x23')](respondWithResult(_0x29f649,0xcc))[_0x80db('0x41')](handleError(_0x29f649,null));};exports[_0x80db('0x4b')]=function(_0xf1cbd4,_0x17208f,_0xcb75a1){return db[_0x80db('0x4c')][_0x80db('0x4d')]({'where':{'id':_0xf1cbd4[_0x80db('0x48')]['id']}})[_0x80db('0x23')](handleEntityNotFound(_0x17208f,null))['then'](function(_0x4e72a3){if(_0x4e72a3){return db[_0x80db('0x4e')][_0x80db('0x4f')](function(_0x5bd7f6){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0xf1cbd4[_0x80db('0x48')]['id']},'transaction':_0x5bd7f6})[_0x80db('0x23')](function(_0x138ef0){var _0x150967=_[_0x80db('0x2a')](_0xf1cbd4[_0x80db('0x47')],function(_0xd760bb){delete _0xd760bb['id'];_0xd760bb['CustomReportId']=_0xf1cbd4['params']['id'];return _0xd760bb;});return db[_0x80db('0x2b')]['bulkCreate'](_0x150967,{'transaction':_0x5bd7f6});});})['then'](function(){return db['AnalyticFieldReport'][_0x80db('0x50')]({'where':{'CustomReportId':_0xf1cbd4[_0x80db('0x48')]['id']}});});}})[_0x80db('0x23')](respondWithResult(_0x17208f,null))[_0x80db('0x41')](handleError(_0x17208f,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 25e7af2..32f15d1 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 _0x2962=['exports','define','AnalyticFieldReport','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2962,0x12f));var _0x2296=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x2962[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x2296('0x0'));var util=require(_0x2296('0x1'));var logger=require(_0x2296('0x2'))(_0x2296('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2296('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2296('0x5'));var config=require(_0x2296('0x6'));var attributes=require('./analyticFieldReport.attributes');module[_0x2296('0x7')]=function(_0x38f33f,_0x385027){return _0x38f33f[_0x2296('0x8')](_0x2296('0x9'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc03c=['path','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','lodash','util','moment','bluebird'];(function(_0x2a8b83,_0xfa4edf){var _0x695c82=function(_0x19c266){while(--_0x19c266){_0x2a8b83['push'](_0x2a8b83['shift']());}};_0x695c82(++_0xfa4edf);}(_0xc03c,0x11e));var _0xcc03=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0xc03c[_0x2aee2f];return _0x19337f;};'use strict';var _=require(_0xcc03('0x0'));var util=require(_0xcc03('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcc03('0x2'));var BPromise=require(_0xcc03('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc03('0x4'));var rimraf=require('rimraf');var config=require(_0xcc03('0x5'));var attributes=require(_0xcc03('0x6'));module['exports']=function(_0x1e1955,_0x3a49ea){return _0x1e1955[_0xcc03('0x7')](_0xcc03('0x8'),attributes,{'tableName':_0xcc03('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index cdb8642..452e365 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 _0xc09f=['error','code','message','AnalyticFieldReport,\x20%s,\x20%s','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','request\x20sent','stringify'];(function(_0x5ebe9f,_0x544824){var _0x8167fe=function(_0x39bcfe){while(--_0x39bcfe){_0x5ebe9f['push'](_0x5ebe9f['shift']());}};_0x8167fe(++_0x544824);}(_0xc09f,0x1d4));var _0xfc09=function(_0x51f2c0,_0xb7c46e){_0x51f2c0=_0x51f2c0-0x0;var _0x34ffd5=_0xc09f[_0x51f2c0];return _0x34ffd5;};'use strict';var _=require(_0xfc09('0x0'));var util=require(_0xfc09('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfc09('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc09('0x3'))['db'];var utils=require(_0xfc09('0x4'));var logger=require(_0xfc09('0x5'))(_0xfc09('0x6'));var config=require(_0xfc09('0x7'));var jayson=require(_0xfc09('0x8'));var client=jayson['client'][_0xfc09('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf7f3cd,_0x41a409,_0x68a923){return new BPromise(function(_0x436d62,_0x19d8ad){return client[_0xfc09('0xa')](_0xf7f3cd,_0x68a923)[_0xfc09('0xb')](function(_0x2b2aa3){logger[_0xfc09('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x41a409,'request\x20sent');logger[_0xfc09('0xd')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x41a409,_0xfc09('0xe'),JSON[_0xfc09('0xf')](_0x2b2aa3));if(_0x2b2aa3[_0xfc09('0x10')]){if(_0x2b2aa3[_0xfc09('0x10')][_0xfc09('0x11')]===0x1f4){logger[_0xfc09('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x41a409,_0x2b2aa3['error'][_0xfc09('0x12')]);return _0x19d8ad(_0x2b2aa3['error']['message']);}logger['error'](_0xfc09('0x13'),_0x41a409,_0x2b2aa3[_0xfc09('0x10')][_0xfc09('0x12')]);return _0x436d62(_0x2b2aa3['error'][_0xfc09('0x12')]);}else{logger[_0xfc09('0xc')](_0xfc09('0x13'),_0x41a409,_0xfc09('0xe'));_0x436d62(_0x2b2aa3[_0xfc09('0x14')][_0xfc09('0x12')]);}})[_0xfc09('0x15')](function(_0xd83ef9){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x41a409,_0xd83ef9);_0x19d8ad(_0xd83ef9);});});} \ No newline at end of file +var _0xf105=['lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch'];(function(_0x129bed,_0x529bf2){var _0x286f63=function(_0x247bf1){while(--_0x247bf1){_0x129bed['push'](_0x129bed['shift']());}};_0x286f63(++_0x529bf2);}(_0xf105,0x1e6));var _0x5f10=function(_0x13a187,_0x3e77dd){_0x13a187=_0x13a187-0x0;var _0x4d9b2b=_0xf105[_0x13a187];return _0x4d9b2b;};'use strict';var _=require(_0x5f10('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5f10('0x1'));var rs=require(_0x5f10('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f10('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f10('0x4'))('rpc');var config=require(_0x5f10('0x5'));var jayson=require(_0x5f10('0x6'));var client=jayson['client'][_0x5f10('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f2f1a,_0x59e22b,_0x109f57){return new BPromise(function(_0x34c1a5,_0x4ec421){return client[_0x5f10('0x8')](_0x4f2f1a,_0x109f57)['then'](function(_0x40fd9f){logger['info'](_0x5f10('0x9'),_0x59e22b,_0x5f10('0xa'));logger['debug'](_0x5f10('0xb'),_0x59e22b,_0x5f10('0xa'),JSON[_0x5f10('0xc')](_0x40fd9f));if(_0x40fd9f['error']){if(_0x40fd9f['error'][_0x5f10('0xd')]===0x1f4){logger[_0x5f10('0xe')](_0x5f10('0x9'),_0x59e22b,_0x40fd9f[_0x5f10('0xe')][_0x5f10('0xf')]);return _0x4ec421(_0x40fd9f[_0x5f10('0xe')]['message']);}logger[_0x5f10('0xe')](_0x5f10('0x9'),_0x59e22b,_0x40fd9f[_0x5f10('0xe')]['message']);return _0x34c1a5(_0x40fd9f[_0x5f10('0xe')][_0x5f10('0xf')]);}else{logger[_0x5f10('0x10')](_0x5f10('0x9'),_0x59e22b,_0x5f10('0xa'));_0x34c1a5(_0x40fd9f['result'][_0x5f10('0xf')]);}})[_0x5f10('0x11')](function(_0x334c01){logger[_0x5f10('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x59e22b,_0x334c01);_0x4ec421(_0x334c01);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 9b39466..c8103c0 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(_0x22fbaa,_0x11831e){var _0x55d3ed=function(_0x41269a){while(--_0x41269a){_0x22fbaa['push'](_0x22fbaa['shift']());}};_0x55d3ed(++_0x11831e);}(_0xe14b,0x93));var _0xbe14=function(_0x1a2cca,_0x9e8f05){_0x1a2cca=_0x1a2cca-0x0;var _0x217ab1=_0xe14b[_0x1a2cca];return _0x217ab1;};'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 _0x326f=['/:id','show','post','/create_many','bulkCreate','/:id/create_many','addFields','update','/destroy_many','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x326f,0xd1));var _0xf326=function(_0x2de8bf,_0x566883){_0x2de8bf=_0x2de8bf-0x0;var _0x4364be=_0x326f[_0x2de8bf];return _0x4364be;};'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['post'](_0xf326('0xe'),auth[_0xf326('0x9')](),controller[_0xf326('0xf')]);router[_0xf326('0xd')](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['put'](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x12')]);router['delete'](_0xf326('0x13'),auth[_0xf326('0x9')](),controller['bulkDestroy']);router[_0xf326('0x14')](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index ebe16d8..543b9fc 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 _0x3145=['STRING','name','TEXT','exports'];(function(_0x9d8ad5,_0x320d76){var _0x5eaba3=function(_0x2c8458){while(--_0x2c8458){_0x9d8ad5['push'](_0x9d8ad5['shift']());}};_0x5eaba3(++_0x320d76);}(_0x3145,0xc7));var _0x5314=function(_0x35e962,_0x4d91fe){_0x35e962=_0x35e962-0x0;var _0x57fa24=_0x3145[_0x35e962];return _0x57fa24;};'use strict';var Sequelize=require('sequelize');module[_0x5314('0x0')]={'name':{'type':Sequelize[_0x5314('0x1')],'allowNull':![],'unique':_0x5314('0x2')},'table':{'type':Sequelize[_0x5314('0x1')]},'metric':{'type':Sequelize[_0x5314('0x3')]},'description':{'type':Sequelize[_0x5314('0x1')]}}; \ No newline at end of file +var _0xebe6=['exports','STRING','name','TEXT','sequelize'];(function(_0x542f33,_0x63465e){var _0x22e020=function(_0x550605){while(--_0x550605){_0x542f33['push'](_0x542f33['shift']());}};_0x22e020(++_0x63465e);}(_0xebe6,0x13a));var _0x6ebe=function(_0x3cf7df,_0x43b053){_0x3cf7df=_0x3cf7df-0x0;var _0x52ca51=_0xebe6[_0x3cf7df];return _0x52ca51;};'use strict';var Sequelize=require(_0x6ebe('0x0'));module[_0x6ebe('0x1')]={'name':{'type':Sequelize[_0x6ebe('0x2')],'allowNull':![],'unique':_0x6ebe('0x3')},'table':{'type':Sequelize[_0x6ebe('0x2')]},'metric':{'type':Sequelize[_0x6ebe('0x4')]},'description':{'type':Sequelize[_0x6ebe('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 1a23faf..5ad86f5 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 _0xf1b3=['rawAttributes','filtears','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Metrics','UserProfileResource','stack','name','send','map','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','type','VIRTUAL','merge','options','AnalyticMetric','count','includeAll','include','findAll','catch','params','keys'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xf1b3,0xb4));var _0x3f1b=function(_0x165aa9,_0x54f7b3){_0x165aa9=_0x165aa9-0x0;var _0x5e1557=_0xf1b3[_0x165aa9];return _0x5e1557;};'use strict';var pdf=require(_0x3f1b('0x0'));var emlformat=require(_0x3f1b('0x1'));var rimraf=require(_0x3f1b('0x2'));var zipdir=require(_0x3f1b('0x3'));var jsonpatch=require(_0x3f1b('0x4'));var rp=require(_0x3f1b('0x5'));var moment=require(_0x3f1b('0x6'));var BPromise=require(_0x3f1b('0x7'));var Mustache=require(_0x3f1b('0x8'));var util=require(_0x3f1b('0x9'));var path=require(_0x3f1b('0xa'));var sox=require('sox');var csv=require(_0x3f1b('0xb'));var ejs=require(_0x3f1b('0xc'));var fs=require('fs');var _=require(_0x3f1b('0xd'));var squel=require(_0x3f1b('0xe'));var crypto=require(_0x3f1b('0xf'));var jsforce=require(_0x3f1b('0x10'));var deskjs=require(_0x3f1b('0x11'));var toCsv=require(_0x3f1b('0xb'));var querystring=require('querystring');var Papa=require(_0x3f1b('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3f1b('0x13'));var as=require(_0x3f1b('0x14'));var hardwareService=require(_0x3f1b('0x15'));var logger=require('../../config/logger')(_0x3f1b('0x16'));var utils=require(_0x3f1b('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3f1b('0x18'))['db'];function respondWithStatusCode(_0x3a1e86,_0x5c1923){_0x5c1923=_0x5c1923||0xcc;return function(_0x11b69f){if(_0x11b69f){return _0x3a1e86[_0x3f1b('0x19')](_0x5c1923);}return _0x3a1e86[_0x3f1b('0x1a')](_0x5c1923)[_0x3f1b('0x1b')]();};}function respondWithResult(_0x43785b,_0x5dc8c7){_0x5dc8c7=_0x5dc8c7||0xc8;return function(_0x33a74a){if(_0x33a74a){return _0x43785b[_0x3f1b('0x1a')](_0x5dc8c7)['json'](_0x33a74a);}};}function respondWithFilteredResult(_0x32b217,_0x44cebf){return function(_0x52a4ee){if(_0x52a4ee){var _0x1b23e2=_0x52a4ee['count'],_0xf8ca66=_0x44cebf['offset'],_0x22d318=_0x44cebf[_0x3f1b('0x1c')]+_0x44cebf[_0x3f1b('0x1d')],_0x14dc48;if(_0x22d318>=_0x1b23e2){_0x22d318=_0x1b23e2;_0x14dc48=0xc8;}else{_0x14dc48=0xce;}_0x32b217['status'](_0x14dc48);return _0x32b217[_0x3f1b('0x1e')](_0x3f1b('0x1f'),_0xf8ca66+'-'+_0x22d318+'/'+_0x1b23e2)[_0x3f1b('0x20')](_0x52a4ee);}return null;};}function patchUpdates(_0x4c067a){return function(_0x469fb3){try{jsonpatch[_0x3f1b('0x21')](_0x469fb3,_0x4c067a,!![]);}catch(_0x535ba8){return BPromise[_0x3f1b('0x22')](_0x535ba8);}return _0x469fb3[_0x3f1b('0x23')]();};}function saveUpdates(_0x35c0c0,_0x21f2c1){return function(_0x211989){if(_0x211989){return _0x211989[_0x3f1b('0x24')](_0x35c0c0)['then'](function(_0x5d91db){return _0x5d91db;});}return null;};}function removeEntity(_0x42f541,_0x12b1e5){return function(_0x5effa1){if(_0x5effa1){return _0x5effa1[_0x3f1b('0x25')]()[_0x3f1b('0x26')](function(){var _0x2959ff=_0x5effa1[_0x3f1b('0x27')]({'plain':!![]});var _0x1fb75a=_0x3f1b('0x28');return db[_0x3f1b('0x29')][_0x3f1b('0x25')]({'where':{'type':_0x1fb75a,'resourceId':_0x2959ff['id']}})[_0x3f1b('0x26')](function(){return _0x5effa1;});})['then'](function(){_0x42f541[_0x3f1b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5afb90,_0x2de07c){return function(_0xbbd1f5){if(!_0xbbd1f5){_0x5afb90[_0x3f1b('0x19')](0x194);}return _0xbbd1f5;};}function handleError(_0x27aa5c,_0x5bf398){_0x5bf398=_0x5bf398||0x1f4;return function(_0x1fa0c4){logger['error'](_0x1fa0c4[_0x3f1b('0x2a')]);if(_0x1fa0c4[_0x3f1b('0x2b')]){delete _0x1fa0c4['name'];}_0x27aa5c[_0x3f1b('0x1a')](_0x5bf398)[_0x3f1b('0x2c')](_0x1fa0c4);};}exports['index']=function(_0x5b92ac,_0x54b46f){var _0x3ffd7b={},_0x19791d={},_0xf86b68={'count':0x0,'rows':[]};var _0x287a12=_[_0x3f1b('0x2d')](db['AnalyticMetric']['rawAttributes'],function(_0x4cb6e2){return{'name':_0x4cb6e2[_0x3f1b('0x2e')],'type':_0x4cb6e2['type'][_0x3f1b('0x2f')]};});_0x19791d[_0x3f1b('0x30')]=_[_0x3f1b('0x2d')](_0x287a12,'name');_0x19791d[_0x3f1b('0x31')]=_['keys'](_0x5b92ac[_0x3f1b('0x31')]);_0x19791d['filters']=_['intersection'](_0x19791d[_0x3f1b('0x30')],_0x19791d[_0x3f1b('0x31')]);_0x3ffd7b[_0x3f1b('0x32')]=_[_0x3f1b('0x33')](_0x19791d[_0x3f1b('0x30')],qs[_0x3f1b('0x34')](_0x5b92ac[_0x3f1b('0x31')][_0x3f1b('0x34')]));_0x3ffd7b[_0x3f1b('0x32')]=_0x3ffd7b[_0x3f1b('0x32')][_0x3f1b('0x35')]?_0x3ffd7b[_0x3f1b('0x32')]:_0x19791d[_0x3f1b('0x30')];if(!_0x5b92ac['query'][_0x3f1b('0x36')](_0x3f1b('0x37'))){_0x3ffd7b['limit']=qs[_0x3f1b('0x1d')](_0x5b92ac[_0x3f1b('0x31')][_0x3f1b('0x1d')]);_0x3ffd7b[_0x3f1b('0x1c')]=qs['offset'](_0x5b92ac[_0x3f1b('0x31')][_0x3f1b('0x1c')]);}_0x3ffd7b['order']=qs['sort'](_0x5b92ac[_0x3f1b('0x31')][_0x3f1b('0x38')]);_0x3ffd7b[_0x3f1b('0x39')]=qs[_0x3f1b('0x3a')](_['pick'](_0x5b92ac[_0x3f1b('0x31')],_0x19791d[_0x3f1b('0x3a')]),_0x287a12);if(_0x5b92ac[_0x3f1b('0x31')][_0x3f1b('0x3b')]){_0x3ffd7b['where']=_['merge'](_0x3ffd7b[_0x3f1b('0x39')],{'$or':_[_0x3f1b('0x2d')](_0x287a12,function(_0x4705f9){if(_0x4705f9[_0x3f1b('0x3c')]!==_0x3f1b('0x3d')){var _0x2f2005={};_0x2f2005[_0x4705f9[_0x3f1b('0x2b')]]={'$like':'%'+_0x5b92ac[_0x3f1b('0x31')][_0x3f1b('0x3b')]+'%'};return _0x2f2005;}})});}_0x3ffd7b=_[_0x3f1b('0x3e')]({},_0x3ffd7b,_0x5b92ac[_0x3f1b('0x3f')]);var _0x377995={'where':_0x3ffd7b[_0x3f1b('0x39')]};return db[_0x3f1b('0x40')][_0x3f1b('0x41')](_0x377995)[_0x3f1b('0x26')](function(_0xf1298b){_0xf86b68[_0x3f1b('0x41')]=_0xf1298b;if(_0x5b92ac['query'][_0x3f1b('0x42')]){_0x3ffd7b[_0x3f1b('0x43')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x3f1b('0x44')](_0x3ffd7b);})['then'](function(_0x4966c1){_0xf86b68['rows']=_0x4966c1;return _0xf86b68;})['then'](respondWithFilteredResult(_0x54b46f,_0x3ffd7b))[_0x3f1b('0x45')](handleError(_0x54b46f,null));};exports['show']=function(_0x207f4c,_0x13cb5e){var _0x2ddc8f={'raw':!![],'where':{'id':_0x207f4c[_0x3f1b('0x46')]['id']}},_0xe8d0e3={};_0xe8d0e3['model']=_[_0x3f1b('0x47')](db[_0x3f1b('0x40')][_0x3f1b('0x48')]);_0xe8d0e3[_0x3f1b('0x31')]=_[_0x3f1b('0x47')](_0x207f4c[_0x3f1b('0x31')]);_0xe8d0e3[_0x3f1b('0x49')]=_[_0x3f1b('0x33')](_0xe8d0e3['model'],_0xe8d0e3[_0x3f1b('0x31')]);_0x2ddc8f[_0x3f1b('0x32')]=_[_0x3f1b('0x33')](_0xe8d0e3['model'],qs['fields'](_0x207f4c[_0x3f1b('0x31')][_0x3f1b('0x34')]));_0x2ddc8f[_0x3f1b('0x32')]=_0x2ddc8f[_0x3f1b('0x32')]['length']?_0x2ddc8f[_0x3f1b('0x32')]:_0xe8d0e3[_0x3f1b('0x30')];if(_0x207f4c[_0x3f1b('0x31')]['includeAll']){_0x2ddc8f[_0x3f1b('0x43')]=[{'all':!![]}];}_0x2ddc8f=_[_0x3f1b('0x3e')]({},_0x2ddc8f,_0x207f4c[_0x3f1b('0x3f')]);return db['AnalyticMetric'][_0x3f1b('0x4a')](_0x2ddc8f)[_0x3f1b('0x26')](handleEntityNotFound(_0x13cb5e,null))[_0x3f1b('0x26')](respondWithResult(_0x13cb5e,null))[_0x3f1b('0x45')](handleError(_0x13cb5e,null));};exports[_0x3f1b('0x4b')]=function(_0x4403b2,_0x2b9f0d){return db['AnalyticMetric']['create'](_0x4403b2['body'],{})[_0x3f1b('0x26')](function(_0x3ca0a4){var _0x28838c=_0x4403b2[_0x3f1b('0x4c')][_0x3f1b('0x27')]({'plain':!![]});if(!_0x28838c)throw new Error(_0x3f1b('0x4d'));if(_0x28838c[_0x3f1b('0x4e')]==='user'){var _0x278e06=_0x3ca0a4[_0x3f1b('0x27')]({'plain':!![]});var _0x232c80=_0x3f1b('0x28');return db[_0x3f1b('0x4f')][_0x3f1b('0x4a')]({'where':{'name':_0x232c80,'userProfileId':_0x28838c[_0x3f1b('0x50')]},'raw':!![]})[_0x3f1b('0x26')](function(_0x5c4ba4){if(_0x5c4ba4&&_0x5c4ba4[_0x3f1b('0x51')]===0x0){return db['UserProfileResource'][_0x3f1b('0x4b')]({'name':_0x278e06[_0x3f1b('0x2b')],'resourceId':_0x278e06['id'],'type':_0x5c4ba4[_0x3f1b('0x2b')],'sectionId':_0x5c4ba4['id']},{})[_0x3f1b('0x26')](function(){return _0x3ca0a4;});}else{return _0x3ca0a4;}})[_0x3f1b('0x45')](function(_0x1aba5f){logger['error'](_0x3f1b('0x52'),_0x1aba5f);throw _0x1aba5f;});}return _0x3ca0a4;})[_0x3f1b('0x26')](respondWithResult(_0x2b9f0d,0xc9))['catch'](handleError(_0x2b9f0d,null));};exports[_0x3f1b('0x24')]=function(_0x17af3b,_0x2aa066){if(_0x17af3b[_0x3f1b('0x53')]['id']){delete _0x17af3b['body']['id'];}return db[_0x3f1b('0x40')]['find']({'where':{'id':_0x17af3b[_0x3f1b('0x46')]['id']}})[_0x3f1b('0x26')](handleEntityNotFound(_0x2aa066,null))[_0x3f1b('0x26')](saveUpdates(_0x17af3b[_0x3f1b('0x53')],null))[_0x3f1b('0x26')](respondWithResult(_0x2aa066,null))['catch'](handleError(_0x2aa066,null));};exports[_0x3f1b('0x25')]=function(_0x1f4f87,_0x126cb5){return db[_0x3f1b('0x40')][_0x3f1b('0x4a')]({'where':{'id':_0x1f4f87[_0x3f1b('0x46')]['id']}})[_0x3f1b('0x26')](handleEntityNotFound(_0x126cb5,null))[_0x3f1b('0x26')](removeEntity(_0x126cb5,null))[_0x3f1b('0x45')](handleError(_0x126cb5,null));}; \ No newline at end of file +var _0x8555=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','set','reject','save','then','get','UserProfileResource','destroy','error','stack','name','status','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','catch','params','filtears','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics'];(function(_0x56a408,_0x48f9a3){var _0x2a0a65=function(_0x531a79){while(--_0x531a79){_0x56a408['push'](_0x56a408['shift']());}};_0x2a0a65(++_0x48f9a3);}(_0x8555,0x9d));var _0x5855=function(_0x3dfe62,_0x48d178){_0x3dfe62=_0x3dfe62-0x0;var _0x1b9191=_0x8555[_0x3dfe62];return _0x1b9191;};'use strict';var pdf=require(_0x5855('0x0'));var emlformat=require(_0x5855('0x1'));var rimraf=require(_0x5855('0x2'));var zipdir=require(_0x5855('0x3'));var jsonpatch=require(_0x5855('0x4'));var rp=require('request-promise');var moment=require(_0x5855('0x5'));var BPromise=require(_0x5855('0x6'));var Mustache=require(_0x5855('0x7'));var util=require(_0x5855('0x8'));var path=require(_0x5855('0x9'));var sox=require(_0x5855('0xa'));var csv=require(_0x5855('0xb'));var ejs=require(_0x5855('0xc'));var fs=require('fs');var _=require(_0x5855('0xd'));var squel=require('squel');var crypto=require(_0x5855('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5855('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5855('0x10'));var Papa=require(_0x5855('0x11'));var Redis=require('ioredis');var authService=require(_0x5855('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5855('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5855('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5855('0x15'));var db=require(_0x5855('0x16'))['db'];function respondWithStatusCode(_0x30fee9,_0xaf69f9){_0xaf69f9=_0xaf69f9||0xcc;return function(_0x35af49){if(_0x35af49){return _0x30fee9[_0x5855('0x17')](_0xaf69f9);}return _0x30fee9['status'](_0xaf69f9)[_0x5855('0x18')]();};}function respondWithResult(_0x41b3c9,_0xb1c615){_0xb1c615=_0xb1c615||0xc8;return function(_0xadc747){if(_0xadc747){return _0x41b3c9['status'](_0xb1c615)[_0x5855('0x19')](_0xadc747);}};}function respondWithFilteredResult(_0x1ffe92,_0x1c7d58){return function(_0x505881){if(_0x505881){var _0x49201a=_0x505881[_0x5855('0x1a')],_0x1c37e8=_0x1c7d58[_0x5855('0x1b')],_0x3d24b9=_0x1c7d58[_0x5855('0x1b')]+_0x1c7d58['limit'],_0x7a31a1;if(_0x3d24b9>=_0x49201a){_0x3d24b9=_0x49201a;_0x7a31a1=0xc8;}else{_0x7a31a1=0xce;}_0x1ffe92['status'](_0x7a31a1);return _0x1ffe92[_0x5855('0x1c')]('Content-Range',_0x1c37e8+'-'+_0x3d24b9+'/'+_0x49201a)[_0x5855('0x19')](_0x505881);}return null;};}function patchUpdates(_0x4ea84a){return function(_0x4b35b6){try{jsonpatch['apply'](_0x4b35b6,_0x4ea84a,!![]);}catch(_0x193189){return BPromise[_0x5855('0x1d')](_0x193189);}return _0x4b35b6[_0x5855('0x1e')]();};}function saveUpdates(_0x230b2b,_0x1dcb6a){return function(_0x305d84){if(_0x305d84){return _0x305d84['update'](_0x230b2b)[_0x5855('0x1f')](function(_0x498731){return _0x498731;});}return null;};}function removeEntity(_0x480d63,_0x3e6711){return function(_0x3e778f){if(_0x3e778f){return _0x3e778f['destroy']()['then'](function(){var _0x1023c6=_0x3e778f[_0x5855('0x20')]({'plain':!![]});var _0x507a34='Metrics';return db[_0x5855('0x21')][_0x5855('0x22')]({'where':{'type':_0x507a34,'resourceId':_0x1023c6['id']}})[_0x5855('0x1f')](function(){return _0x3e778f;});})[_0x5855('0x1f')](function(){_0x480d63['status'](0xcc)[_0x5855('0x18')]();});}};}function handleEntityNotFound(_0x3cd616,_0x51cad0){return function(_0x208e19){if(!_0x208e19){_0x3cd616[_0x5855('0x17')](0x194);}return _0x208e19;};}function handleError(_0xdb4dfd,_0x168974){_0x168974=_0x168974||0x1f4;return function(_0x24dfcd){logger[_0x5855('0x23')](_0x24dfcd[_0x5855('0x24')]);if(_0x24dfcd[_0x5855('0x25')]){delete _0x24dfcd[_0x5855('0x25')];}_0xdb4dfd[_0x5855('0x26')](_0x168974)['send'](_0x24dfcd);};}exports[_0x5855('0x27')]=function(_0x4ee674,_0x46e850){var _0x488d4b={},_0x22d90f={},_0x178728={'count':0x0,'rows':[]};var _0x353df6=_[_0x5855('0x28')](db[_0x5855('0x29')][_0x5855('0x2a')],function(_0x1a7535){return{'name':_0x1a7535[_0x5855('0x2b')],'type':_0x1a7535[_0x5855('0x2c')]['key']};});_0x22d90f[_0x5855('0x2d')]=_[_0x5855('0x28')](_0x353df6,_0x5855('0x25'));_0x22d90f['query']=_[_0x5855('0x2e')](_0x4ee674[_0x5855('0x2f')]);_0x22d90f[_0x5855('0x30')]=_[_0x5855('0x31')](_0x22d90f[_0x5855('0x2d')],_0x22d90f[_0x5855('0x2f')]);_0x488d4b['attributes']=_['intersection'](_0x22d90f[_0x5855('0x2d')],qs[_0x5855('0x32')](_0x4ee674['query'][_0x5855('0x32')]));_0x488d4b[_0x5855('0x33')]=_0x488d4b[_0x5855('0x33')][_0x5855('0x34')]?_0x488d4b[_0x5855('0x33')]:_0x22d90f[_0x5855('0x2d')];if(!_0x4ee674[_0x5855('0x2f')][_0x5855('0x35')]('nolimit')){_0x488d4b[_0x5855('0x36')]=qs[_0x5855('0x36')](_0x4ee674[_0x5855('0x2f')]['limit']);_0x488d4b['offset']=qs['offset'](_0x4ee674[_0x5855('0x2f')][_0x5855('0x1b')]);}_0x488d4b[_0x5855('0x37')]=qs[_0x5855('0x38')](_0x4ee674['query']['sort']);_0x488d4b[_0x5855('0x39')]=qs[_0x5855('0x30')](_[_0x5855('0x3a')](_0x4ee674[_0x5855('0x2f')],_0x22d90f[_0x5855('0x30')]),_0x353df6);if(_0x4ee674[_0x5855('0x2f')][_0x5855('0x3b')]){_0x488d4b['where']=_['merge'](_0x488d4b['where'],{'$or':_[_0x5855('0x28')](_0x353df6,function(_0x569883){if(_0x569883['type']!==_0x5855('0x3c')){var _0x21255e={};_0x21255e[_0x569883[_0x5855('0x25')]]={'$like':'%'+_0x4ee674[_0x5855('0x2f')]['filter']+'%'};return _0x21255e;}})});}_0x488d4b=_[_0x5855('0x3d')]({},_0x488d4b,_0x4ee674['options']);var _0x47f31d={'where':_0x488d4b[_0x5855('0x39')]};return db[_0x5855('0x29')][_0x5855('0x1a')](_0x47f31d)[_0x5855('0x1f')](function(_0x483b3e){_0x178728[_0x5855('0x1a')]=_0x483b3e;if(_0x4ee674[_0x5855('0x2f')][_0x5855('0x3e')]){_0x488d4b[_0x5855('0x3f')]=[{'all':!![]}];}return db[_0x5855('0x29')]['findAll'](_0x488d4b);})[_0x5855('0x1f')](function(_0x2b2496){_0x178728['rows']=_0x2b2496;return _0x178728;})[_0x5855('0x1f')](respondWithFilteredResult(_0x46e850,_0x488d4b))[_0x5855('0x40')](handleError(_0x46e850,null));};exports['show']=function(_0x2ff7ef,_0x393f06){var _0x94019b={'raw':!![],'where':{'id':_0x2ff7ef[_0x5855('0x41')]['id']}},_0x5802c2={};_0x5802c2[_0x5855('0x2d')]=_[_0x5855('0x2e')](db[_0x5855('0x29')][_0x5855('0x2a')]);_0x5802c2[_0x5855('0x2f')]=_[_0x5855('0x2e')](_0x2ff7ef[_0x5855('0x2f')]);_0x5802c2[_0x5855('0x42')]=_[_0x5855('0x31')](_0x5802c2[_0x5855('0x2d')],_0x5802c2[_0x5855('0x2f')]);_0x94019b[_0x5855('0x33')]=_[_0x5855('0x31')](_0x5802c2[_0x5855('0x2d')],qs['fields'](_0x2ff7ef['query'][_0x5855('0x32')]));_0x94019b[_0x5855('0x33')]=_0x94019b['attributes'][_0x5855('0x34')]?_0x94019b[_0x5855('0x33')]:_0x5802c2[_0x5855('0x2d')];if(_0x2ff7ef[_0x5855('0x2f')]['includeAll']){_0x94019b[_0x5855('0x3f')]=[{'all':!![]}];}_0x94019b=_[_0x5855('0x3d')]({},_0x94019b,_0x2ff7ef[_0x5855('0x43')]);return db[_0x5855('0x29')][_0x5855('0x44')](_0x94019b)[_0x5855('0x1f')](handleEntityNotFound(_0x393f06,null))[_0x5855('0x1f')](respondWithResult(_0x393f06,null))[_0x5855('0x40')](handleError(_0x393f06,null));};exports['create']=function(_0x48c6e4,_0x2dfa50){return db['AnalyticMetric'][_0x5855('0x45')](_0x48c6e4[_0x5855('0x46')],{})[_0x5855('0x1f')](function(_0x5afde3){var _0x37a900=_0x48c6e4['user']['get']({'plain':!![]});if(!_0x37a900)throw new Error(_0x5855('0x47'));if(_0x37a900[_0x5855('0x48')]==='user'){var _0x335e77=_0x5afde3[_0x5855('0x20')]({'plain':!![]});var _0x5d8afb=_0x5855('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x5d8afb,'userProfileId':_0x37a900[_0x5855('0x4a')]},'raw':!![]})['then'](function(_0x102442){if(_0x102442&&_0x102442[_0x5855('0x4b')]===0x0){return db['UserProfileResource'][_0x5855('0x45')]({'name':_0x335e77['name'],'resourceId':_0x335e77['id'],'type':_0x102442[_0x5855('0x25')],'sectionId':_0x102442['id']},{})[_0x5855('0x1f')](function(){return _0x5afde3;});}else{return _0x5afde3;}})[_0x5855('0x40')](function(_0xfd7761){logger[_0x5855('0x23')](_0x5855('0x4c'),_0xfd7761);throw _0xfd7761;});}return _0x5afde3;})['then'](respondWithResult(_0x2dfa50,0xc9))[_0x5855('0x40')](handleError(_0x2dfa50,null));};exports['update']=function(_0x1c37fc,_0xe8bc8e){if(_0x1c37fc['body']['id']){delete _0x1c37fc[_0x5855('0x46')]['id'];}return db[_0x5855('0x29')][_0x5855('0x44')]({'where':{'id':_0x1c37fc[_0x5855('0x41')]['id']}})[_0x5855('0x1f')](handleEntityNotFound(_0xe8bc8e,null))[_0x5855('0x1f')](saveUpdates(_0x1c37fc[_0x5855('0x46')],null))[_0x5855('0x1f')](respondWithResult(_0xe8bc8e,null))[_0x5855('0x40')](handleError(_0xe8bc8e,null));};exports[_0x5855('0x22')]=function(_0x4ae678,_0x266b87){return db[_0x5855('0x29')][_0x5855('0x44')]({'where':{'id':_0x4ae678['params']['id']}})[_0x5855('0x1f')](handleEntityNotFound(_0x266b87,null))[_0x5855('0x1f')](removeEntity(_0x266b87,null))[_0x5855('0x40')](handleError(_0x266b87,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 80f8b4e..0f91c98 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 _0xfa32=['./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','../../config/logger','api','bluebird','request-promise','../../config/environment'];(function(_0x110e6e,_0x3bee64){var _0x2faf08=function(_0x58693a){while(--_0x58693a){_0x110e6e['push'](_0x110e6e['shift']());}};_0x2faf08(++_0x3bee64);}(_0xfa32,0x163));var _0x2fa3=function(_0x2b71d4,_0x5d335a){_0x2b71d4=_0x2b71d4-0x0;var _0x301f66=_0xfa32[_0x2b71d4];return _0x301f66;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2fa3('0x0'))(_0x2fa3('0x1'));var moment=require('moment');var BPromise=require(_0x2fa3('0x2'));var rp=require(_0x2fa3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2fa3('0x4'));var attributes=require(_0x2fa3('0x5'));module['exports']=function(_0x2e1abd,_0x1163a3){return _0x2e1abd[_0x2fa3('0x6')](_0x2fa3('0x7'),attributes,{'tableName':_0x2fa3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2e8=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','define'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb2e8,0xa2));var _0x8b2e=function(_0x347057,_0x333b59){_0x347057=_0x347057-0x0;var _0x1675db=_0xb2e8[_0x347057];return _0x1675db;};'use strict';var _=require('lodash');var util=require(_0x8b2e('0x0'));var logger=require(_0x8b2e('0x1'))(_0x8b2e('0x2'));var moment=require('moment');var BPromise=require(_0x8b2e('0x3'));var rp=require(_0x8b2e('0x4'));var fs=require('fs');var path=require(_0x8b2e('0x5'));var rimraf=require('rimraf');var config=require(_0x8b2e('0x6'));var attributes=require(_0x8b2e('0x7'));module['exports']=function(_0x5490ce,_0x55afdf){return _0x5490ce[_0x8b2e('0x8')]('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index bfda558..e05844f 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 _0x2681=['then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','randomstring','ioredis','../../config/utils','jayson/promise','client','http','request'];(function(_0x313505,_0x2843f8){var _0x2bf886=function(_0x3286f0){while(--_0x3286f0){_0x313505['push'](_0x313505['shift']());}};_0x2bf886(++_0x2843f8);}(_0x2681,0x14b));var _0x1268=function(_0x455d19,_0x362eda){_0x455d19=_0x455d19-0x0;var _0x2cd76c=_0x2681[_0x455d19];return _0x2cd76c;};'use strict';var _=require(_0x1268('0x0'));var util=require(_0x1268('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1268('0x2'));var fs=require('fs');var Redis=require(_0x1268('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1268('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1268('0x5'));var client=jayson[_0x1268('0x6')][_0x1268('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3a90f0,_0x3e26f2,_0x135d80){return new BPromise(function(_0x541e48,_0x22a427){return client[_0x1268('0x8')](_0x3a90f0,_0x135d80)[_0x1268('0x9')](function(_0x18f03c){logger[_0x1268('0xa')](_0x1268('0xb'),_0x3e26f2,'request\x20sent');logger[_0x1268('0xc')](_0x1268('0xd'),_0x3e26f2,'request\x20sent',JSON[_0x1268('0xe')](_0x18f03c));if(_0x18f03c[_0x1268('0xf')]){if(_0x18f03c['error'][_0x1268('0x10')]===0x1f4){logger[_0x1268('0xf')](_0x1268('0xb'),_0x3e26f2,_0x18f03c[_0x1268('0xf')]['message']);return _0x22a427(_0x18f03c[_0x1268('0xf')]['message']);}logger['error'](_0x1268('0xb'),_0x3e26f2,_0x18f03c['error'][_0x1268('0x11')]);return _0x541e48(_0x18f03c['error'][_0x1268('0x11')]);}else{logger['info'](_0x1268('0xb'),_0x3e26f2,_0x1268('0x12'));_0x541e48(_0x18f03c[_0x1268('0x13')]['message']);}})['catch'](function(_0x25cba1){logger[_0x1268('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x3e26f2,_0x25cba1);_0x22a427(_0x25cba1);});});} \ No newline at end of file +var _0x9d75=['error','message','info','result','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x16593d,_0x51eab1){var _0x42cb97=function(_0x402bdd){while(--_0x402bdd){_0x16593d['push'](_0x16593d['shift']());}};_0x42cb97(++_0x51eab1);}(_0x9d75,0x1e7));var _0x59d7=function(_0xd8f54,_0xc55574){_0xd8f54=_0xd8f54-0x0;var _0x3b4e62=_0x9d75[_0xd8f54];return _0x3b4e62;};'use strict';var _=require(_0x59d7('0x0'));var util=require(_0x59d7('0x1'));var moment=require(_0x59d7('0x2'));var BPromise=require(_0x59d7('0x3'));var rs=require(_0x59d7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x59d7('0x5'))(_0x59d7('0x6'));var config=require(_0x59d7('0x7'));var jayson=require(_0x59d7('0x8'));var client=jayson['client'][_0x59d7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x321538,_0x57e6b6,_0x3417dc){return new BPromise(function(_0x454210,_0x122f23){return client[_0x59d7('0xa')](_0x321538,_0x3417dc)[_0x59d7('0xb')](function(_0x39fb96){logger['info'](_0x59d7('0xc'),_0x57e6b6,_0x59d7('0xd'));logger[_0x59d7('0xe')](_0x59d7('0xf'),_0x57e6b6,_0x59d7('0xd'),JSON[_0x59d7('0x10')](_0x39fb96));if(_0x39fb96[_0x59d7('0x11')]){if(_0x39fb96[_0x59d7('0x11')]['code']===0x1f4){logger[_0x59d7('0x11')](_0x59d7('0xc'),_0x57e6b6,_0x39fb96[_0x59d7('0x11')][_0x59d7('0x12')]);return _0x122f23(_0x39fb96['error']['message']);}logger[_0x59d7('0x11')](_0x59d7('0xc'),_0x57e6b6,_0x39fb96[_0x59d7('0x11')]['message']);return _0x454210(_0x39fb96[_0x59d7('0x11')][_0x59d7('0x12')]);}else{logger[_0x59d7('0x13')](_0x59d7('0xc'),_0x57e6b6,_0x59d7('0xd'));_0x454210(_0x39fb96[_0x59d7('0x14')][_0x59d7('0x12')]);}})['catch'](function(_0x2a188d){logger[_0x59d7('0x11')](_0x59d7('0xc'),_0x57e6b6,_0x2a188d);_0x122f23(_0x2a188d);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 5e4aa90..6415b9f 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 _0x7880=['Router','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x7880,0x1f4));var _0x0788=function(_0x315d84,_0x3dacc3){_0x315d84=_0x315d84-0x0;var _0x560da1=_0x7880[_0x315d84];return _0x560da1;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var auth=require(_0x0788('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0788('0x6'));var controller=require(_0x0788('0x7'));router[_0x0788('0x8')]('/',auth[_0x0788('0x9')](),controller[_0x0788('0xa')]);router[_0x0788('0x8')](_0x0788('0xb'),auth[_0x0788('0x9')](),controller[_0x0788('0xc')]);router[_0x0788('0xd')]('/',auth['isAuthenticated'](),controller[_0x0788('0xe')]);router['put'](_0x0788('0xb'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router[_0x0788('0x10')](_0x0788('0xb'),auth[_0x0788('0x9')](),controller[_0x0788('0x11')]);module['exports']=router; \ No newline at end of file +var _0x57ca=['isAuthenticated','index','/:id','show','post','create','delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x347ecc,_0x11d621){var _0x4a728d=function(_0x556ca5){while(--_0x556ca5){_0x347ecc['push'](_0x347ecc['shift']());}};_0x4a728d(++_0x11d621);}(_0x57ca,0x108));var _0xa57c=function(_0x410b63,_0x37aa85){_0x410b63=_0x410b63-0x0;var _0x380239=_0x57ca[_0x410b63];return _0x380239;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var auth=require(_0xa57c('0x4'));var interaction=require(_0xa57c('0x5'));var config=require(_0xa57c('0x6'));var controller=require('./analyticMetric.controller');router[_0xa57c('0x7')]('/',auth[_0xa57c('0x8')](),controller[_0xa57c('0x9')]);router[_0xa57c('0x7')](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller[_0xa57c('0xb')]);router[_0xa57c('0xc')]('/',auth['isAuthenticated'](),controller[_0xa57c('0xd')]);router['put'](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller['update']);router[_0xa57c('0xe')]('/:id',auth[_0xa57c('0x8')](),controller[_0xa57c('0xf')]);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 62f6654..61fb786 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 _0x8bc3=['exports','sequelize'];(function(_0x910899,_0x5b810c){var _0x35b519=function(_0xa7a83e){while(--_0xa7a83e){_0x910899['push'](_0x910899['shift']());}};_0x35b519(++_0x5b810c);}(_0x8bc3,0x6f));var _0x38bc=function(_0x2a2cfd,_0x274d1e){_0x2a2cfd=_0x2a2cfd-0x0;var _0x18c062=_0x8bc3[_0x2a2cfd];return _0x18c062;};'use strict';var Sequelize=require(_0x38bc('0x0'));module[_0x38bc('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x2b68=['TEXT','sequelize','exports'];(function(_0x5aacd4,_0x1383af){var _0x36f48b=function(_0x4462c8){while(--_0x4462c8){_0x5aacd4['push'](_0x5aacd4['shift']());}};_0x36f48b(++_0x1383af);}(_0x2b68,0x1cf));var _0x82b6=function(_0x457c47,_0x4c9104){_0x457c47=_0x457c47-0x0;var _0x463378=_0x2b68[_0x457c47];return _0x463378;};'use strict';var Sequelize=require(_0x82b6('0x0'));module[_0x82b6('0x1')]={'tree':{'type':Sequelize[_0x82b6('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index bb6c338..0f7a232 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 _0x2d0b=['destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','count','include','findAll','rows','catch','show','filtears','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then'];(function(_0x58f7ec,_0x5a36c0){var _0x54bde3=function(_0x22070){while(--_0x22070){_0x58f7ec['push'](_0x58f7ec['shift']());}};_0x54bde3(++_0x5a36c0);}(_0x2d0b,0x102));var _0xb2d0=function(_0x2a5e89,_0x39db32){_0x2a5e89=_0x2a5e89-0x0;var _0x37f8e5=_0x2d0b[_0x2a5e89];return _0x37f8e5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb2d0('0x0'));var rimraf=require(_0xb2d0('0x1'));var zipdir=require(_0xb2d0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb2d0('0x3'));var moment=require(_0xb2d0('0x4'));var BPromise=require(_0xb2d0('0x5'));var Mustache=require(_0xb2d0('0x6'));var util=require('util');var path=require(_0xb2d0('0x7'));var sox=require('sox');var csv=require(_0xb2d0('0x8'));var ejs=require(_0xb2d0('0x9'));var fs=require('fs');var _=require(_0xb2d0('0xa'));var squel=require(_0xb2d0('0xb'));var crypto=require(_0xb2d0('0xc'));var jsforce=require(_0xb2d0('0xd'));var deskjs=require(_0xb2d0('0xe'));var toCsv=require(_0xb2d0('0x8'));var querystring=require(_0xb2d0('0xf'));var Papa=require(_0xb2d0('0x10'));var Redis=require(_0xb2d0('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb2d0('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb2d0('0x13'));var licenseUtil=require(_0xb2d0('0x14'));var db=require(_0xb2d0('0x15'))['db'];function respondWithStatusCode(_0x4f7a57,_0x19e3e8){_0x19e3e8=_0x19e3e8||0xcc;return function(_0x539b47){if(_0x539b47){return _0x4f7a57[_0xb2d0('0x16')](_0x19e3e8);}return _0x4f7a57[_0xb2d0('0x17')](_0x19e3e8)[_0xb2d0('0x18')]();};}function respondWithResult(_0x2790a7,_0x343488){_0x343488=_0x343488||0xc8;return function(_0x3c2b9e){if(_0x3c2b9e){return _0x2790a7[_0xb2d0('0x17')](_0x343488)[_0xb2d0('0x19')](_0x3c2b9e);}};}function respondWithFilteredResult(_0x3509c5,_0x43390d){return function(_0x36c3b3){if(_0x36c3b3){var _0x1adbea=_0x36c3b3['count'],_0x84fcd7=_0x43390d[_0xb2d0('0x1a')],_0x1cb471=_0x43390d['offset']+_0x43390d[_0xb2d0('0x1b')],_0x223ae8;if(_0x1cb471>=_0x1adbea){_0x1cb471=_0x1adbea;_0x223ae8=0xc8;}else{_0x223ae8=0xce;}_0x3509c5[_0xb2d0('0x17')](_0x223ae8);return _0x3509c5[_0xb2d0('0x1c')](_0xb2d0('0x1d'),_0x84fcd7+'-'+_0x1cb471+'/'+_0x1adbea)[_0xb2d0('0x19')](_0x36c3b3);}return null;};}function patchUpdates(_0x27f6db){return function(_0x2f18e2){try{jsonpatch[_0xb2d0('0x1e')](_0x2f18e2,_0x27f6db,!![]);}catch(_0x2ec0b6){return BPromise['reject'](_0x2ec0b6);}return _0x2f18e2[_0xb2d0('0x1f')]();};}function saveUpdates(_0x1bdc6d,_0x1959fd){return function(_0x450048){if(_0x450048){return _0x450048[_0xb2d0('0x20')](_0x1bdc6d)[_0xb2d0('0x21')](function(_0x2a6079){return _0x2a6079;});}return null;};}function removeEntity(_0x9e90bf,_0x204b4a){return function(_0x19c461){if(_0x19c461){return _0x19c461[_0xb2d0('0x22')]()['then'](function(){_0x9e90bf[_0xb2d0('0x17')](0xcc)[_0xb2d0('0x18')]();});}};}function handleEntityNotFound(_0x15d113,_0x5a0a8f){return function(_0x2b0d02){if(!_0x2b0d02){_0x15d113[_0xb2d0('0x16')](0x194);}return _0x2b0d02;};}function handleError(_0x442573,_0x4fbbdf){_0x4fbbdf=_0x4fbbdf||0x1f4;return function(_0x39fcd4){logger[_0xb2d0('0x23')](_0x39fcd4[_0xb2d0('0x24')]);if(_0x39fcd4[_0xb2d0('0x25')]){delete _0x39fcd4[_0xb2d0('0x25')];}_0x442573[_0xb2d0('0x17')](_0x4fbbdf)[_0xb2d0('0x26')](_0x39fcd4);};}exports[_0xb2d0('0x27')]=function(_0x2684c9,_0x4be597){var _0x31d68c={},_0x4c1913={},_0x4bd772={'count':0x0,'rows':[]};var _0x1063df=_[_0xb2d0('0x28')](db[_0xb2d0('0x29')][_0xb2d0('0x2a')],function(_0x11e6fe){return{'name':_0x11e6fe[_0xb2d0('0x2b')],'type':_0x11e6fe[_0xb2d0('0x2c')][_0xb2d0('0x2d')]};});_0x4c1913[_0xb2d0('0x2e')]=_[_0xb2d0('0x28')](_0x1063df,_0xb2d0('0x25'));_0x4c1913[_0xb2d0('0x2f')]=_[_0xb2d0('0x30')](_0x2684c9['query']);_0x4c1913[_0xb2d0('0x31')]=_[_0xb2d0('0x32')](_0x4c1913[_0xb2d0('0x2e')],_0x4c1913[_0xb2d0('0x2f')]);_0x31d68c[_0xb2d0('0x33')]=_[_0xb2d0('0x32')](_0x4c1913['model'],qs[_0xb2d0('0x34')](_0x2684c9['query']['fields']));_0x31d68c[_0xb2d0('0x33')]=_0x31d68c[_0xb2d0('0x33')][_0xb2d0('0x35')]?_0x31d68c[_0xb2d0('0x33')]:_0x4c1913[_0xb2d0('0x2e')];if(!_0x2684c9[_0xb2d0('0x2f')][_0xb2d0('0x36')](_0xb2d0('0x37'))){_0x31d68c[_0xb2d0('0x1b')]=qs['limit'](_0x2684c9[_0xb2d0('0x2f')]['limit']);_0x31d68c[_0xb2d0('0x1a')]=qs['offset'](_0x2684c9[_0xb2d0('0x2f')][_0xb2d0('0x1a')]);}_0x31d68c[_0xb2d0('0x38')]=qs[_0xb2d0('0x39')](_0x2684c9[_0xb2d0('0x2f')]['sort']);_0x31d68c['where']=qs[_0xb2d0('0x31')](_['pick'](_0x2684c9[_0xb2d0('0x2f')],_0x4c1913[_0xb2d0('0x31')]),_0x1063df);if(_0x2684c9['query'][_0xb2d0('0x3a')]){_0x31d68c[_0xb2d0('0x3b')]=_['merge'](_0x31d68c[_0xb2d0('0x3b')],{'$or':_[_0xb2d0('0x28')](_0x1063df,function(_0x16546f){if(_0x16546f[_0xb2d0('0x2c')]!=='VIRTUAL'){var _0x1964f9={};_0x1964f9[_0x16546f[_0xb2d0('0x25')]]={'$like':'%'+_0x2684c9[_0xb2d0('0x2f')][_0xb2d0('0x3a')]+'%'};return _0x1964f9;}})});}_0x31d68c=_[_0xb2d0('0x3c')]({},_0x31d68c,_0x2684c9[_0xb2d0('0x3d')]);var _0x2c7c53={'where':_0x31d68c[_0xb2d0('0x3b')]};return db['AnalyticTreeReport'][_0xb2d0('0x3e')](_0x2c7c53)[_0xb2d0('0x21')](function(_0x7ccbc7){_0x4bd772[_0xb2d0('0x3e')]=_0x7ccbc7;if(_0x2684c9[_0xb2d0('0x2f')]['includeAll']){_0x31d68c[_0xb2d0('0x3f')]=[{'all':!![]}];}return db[_0xb2d0('0x29')][_0xb2d0('0x40')](_0x31d68c);})[_0xb2d0('0x21')](function(_0x3badae){_0x4bd772[_0xb2d0('0x41')]=_0x3badae;return _0x4bd772;})[_0xb2d0('0x21')](respondWithFilteredResult(_0x4be597,_0x31d68c))[_0xb2d0('0x42')](handleError(_0x4be597,null));};exports[_0xb2d0('0x43')]=function(_0xc08c02,_0x2913b7){var _0x227fbc={'raw':!![],'where':{'id':_0xc08c02['params']['id']}},_0x196189={};_0x196189['model']=_[_0xb2d0('0x30')](db[_0xb2d0('0x29')][_0xb2d0('0x2a')]);_0x196189['query']=_[_0xb2d0('0x30')](_0xc08c02[_0xb2d0('0x2f')]);_0x196189[_0xb2d0('0x44')]=_[_0xb2d0('0x32')](_0x196189['model'],_0x196189[_0xb2d0('0x2f')]);_0x227fbc[_0xb2d0('0x33')]=_[_0xb2d0('0x32')](_0x196189['model'],qs[_0xb2d0('0x34')](_0xc08c02[_0xb2d0('0x2f')][_0xb2d0('0x34')]));_0x227fbc['attributes']=_0x227fbc[_0xb2d0('0x33')][_0xb2d0('0x35')]?_0x227fbc[_0xb2d0('0x33')]:_0x196189[_0xb2d0('0x2e')];if(_0xc08c02[_0xb2d0('0x2f')]['includeAll']){_0x227fbc[_0xb2d0('0x3f')]=[{'all':!![]}];}_0x227fbc=_[_0xb2d0('0x3c')]({},_0x227fbc,_0xc08c02[_0xb2d0('0x3d')]);return db['AnalyticTreeReport'][_0xb2d0('0x45')](_0x227fbc)[_0xb2d0('0x21')](handleEntityNotFound(_0x2913b7,null))[_0xb2d0('0x21')](respondWithResult(_0x2913b7,null))['catch'](handleError(_0x2913b7,null));};exports['create']=function(_0x3dea72,_0x3ce6d1){return db[_0xb2d0('0x29')][_0xb2d0('0x46')](_0x3dea72['body'],{})['then'](respondWithResult(_0x3ce6d1,0xc9))['catch'](handleError(_0x3ce6d1,null));};exports[_0xb2d0('0x20')]=function(_0x32c97b,_0x11b721){if(_0x32c97b['body']['id']){delete _0x32c97b[_0xb2d0('0x47')]['id'];}return db['AnalyticTreeReport'][_0xb2d0('0x45')]({'where':{'id':_0x32c97b[_0xb2d0('0x48')]['id']}})[_0xb2d0('0x21')](handleEntityNotFound(_0x11b721,null))[_0xb2d0('0x21')](saveUpdates(_0x32c97b[_0xb2d0('0x47')],null))['then'](respondWithResult(_0x11b721,null))[_0xb2d0('0x42')](handleError(_0x11b721,null));};exports[_0xb2d0('0x22')]=function(_0x1531d4,_0x3ba6d9){return db[_0xb2d0('0x29')]['find']({'where':{'id':_0x1531d4[_0xb2d0('0x48')]['id']}})[_0xb2d0('0x21')](handleEntityNotFound(_0x3ba6d9,null))['then'](removeEntity(_0x3ba6d9,null))[_0xb2d0('0x42')](handleError(_0x3ba6d9,null));}; \ No newline at end of file +var _0x8fcd=['nolimit','sort','where','filters','pick','merge','filter','options','includeAll','include','AnalyticTreeReport','findAll','rows','params','rawAttributes','filtears','length','catch','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8fcd,0xa1));var _0xd8fc=function(_0xea3feb,_0x29a19d){_0xea3feb=_0xea3feb-0x0;var _0x4871c2=_0x8fcd[_0xea3feb];return _0x4871c2;};'use strict';var pdf=require(_0xd8fc('0x0'));var emlformat=require(_0xd8fc('0x1'));var rimraf=require(_0xd8fc('0x2'));var zipdir=require(_0xd8fc('0x3'));var jsonpatch=require(_0xd8fc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd8fc('0x5'));var Mustache=require(_0xd8fc('0x6'));var util=require(_0xd8fc('0x7'));var path=require(_0xd8fc('0x8'));var sox=require(_0xd8fc('0x9'));var csv=require(_0xd8fc('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd8fc('0xb'));var crypto=require('crypto');var jsforce=require(_0xd8fc('0xc'));var deskjs=require(_0xd8fc('0xd'));var toCsv=require(_0xd8fc('0xa'));var querystring=require(_0xd8fc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd8fc('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd8fc('0x10'));var logger=require(_0xd8fc('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd8fc('0x12'));var licenseUtil=require(_0xd8fc('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c41e9,_0x955550){_0x955550=_0x955550||0xcc;return function(_0x2b9d7e){if(_0x2b9d7e){return _0x3c41e9[_0xd8fc('0x14')](_0x955550);}return _0x3c41e9[_0xd8fc('0x15')](_0x955550)['end']();};}function respondWithResult(_0x32b375,_0x4f1064){_0x4f1064=_0x4f1064||0xc8;return function(_0x4761f){if(_0x4761f){return _0x32b375[_0xd8fc('0x15')](_0x4f1064)[_0xd8fc('0x16')](_0x4761f);}};}function respondWithFilteredResult(_0x524bac,_0x426e56){return function(_0x233c7e){if(_0x233c7e){var _0x57838b=_0x233c7e[_0xd8fc('0x17')],_0x49c450=_0x426e56['offset'],_0x234cfd=_0x426e56[_0xd8fc('0x18')]+_0x426e56[_0xd8fc('0x19')],_0x234b4d;if(_0x234cfd>=_0x57838b){_0x234cfd=_0x57838b;_0x234b4d=0xc8;}else{_0x234b4d=0xce;}_0x524bac[_0xd8fc('0x15')](_0x234b4d);return _0x524bac[_0xd8fc('0x1a')](_0xd8fc('0x1b'),_0x49c450+'-'+_0x234cfd+'/'+_0x57838b)[_0xd8fc('0x16')](_0x233c7e);}return null;};}function patchUpdates(_0x13a13d){return function(_0x1d7e77){try{jsonpatch[_0xd8fc('0x1c')](_0x1d7e77,_0x13a13d,!![]);}catch(_0x509961){return BPromise[_0xd8fc('0x1d')](_0x509961);}return _0x1d7e77[_0xd8fc('0x1e')]();};}function saveUpdates(_0x24001d,_0x3f9d57){return function(_0x24ae45){if(_0x24ae45){return _0x24ae45[_0xd8fc('0x1f')](_0x24001d)['then'](function(_0x202719){return _0x202719;});}return null;};}function removeEntity(_0x3f0196,_0x5cd1f9){return function(_0x37a93b){if(_0x37a93b){return _0x37a93b['destroy']()[_0xd8fc('0x20')](function(){_0x3f0196[_0xd8fc('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c852a,_0x47ccff){return function(_0xc0202b){if(!_0xc0202b){_0x5c852a[_0xd8fc('0x14')](0x194);}return _0xc0202b;};}function handleError(_0x18fd3a,_0x25d8ae){_0x25d8ae=_0x25d8ae||0x1f4;return function(_0x495bd2){logger[_0xd8fc('0x21')](_0x495bd2[_0xd8fc('0x22')]);if(_0x495bd2['name']){delete _0x495bd2[_0xd8fc('0x23')];}_0x18fd3a['status'](_0x25d8ae)[_0xd8fc('0x24')](_0x495bd2);};}exports[_0xd8fc('0x25')]=function(_0x454a77,_0xb4077f){var _0x58718b={},_0x9d29b4={},_0x51d0d0={'count':0x0,'rows':[]};var _0x1f4577=_[_0xd8fc('0x26')](db['AnalyticTreeReport']['rawAttributes'],function(_0x56a980){return{'name':_0x56a980[_0xd8fc('0x27')],'type':_0x56a980[_0xd8fc('0x28')][_0xd8fc('0x29')]};});_0x9d29b4[_0xd8fc('0x2a')]=_[_0xd8fc('0x26')](_0x1f4577,_0xd8fc('0x23'));_0x9d29b4[_0xd8fc('0x2b')]=_[_0xd8fc('0x2c')](_0x454a77[_0xd8fc('0x2b')]);_0x9d29b4['filters']=_[_0xd8fc('0x2d')](_0x9d29b4[_0xd8fc('0x2a')],_0x9d29b4['query']);_0x58718b[_0xd8fc('0x2e')]=_[_0xd8fc('0x2d')](_0x9d29b4[_0xd8fc('0x2a')],qs['fields'](_0x454a77[_0xd8fc('0x2b')][_0xd8fc('0x2f')]));_0x58718b[_0xd8fc('0x2e')]=_0x58718b['attributes']['length']?_0x58718b['attributes']:_0x9d29b4[_0xd8fc('0x2a')];if(!_0x454a77[_0xd8fc('0x2b')][_0xd8fc('0x30')](_0xd8fc('0x31'))){_0x58718b[_0xd8fc('0x19')]=qs[_0xd8fc('0x19')](_0x454a77[_0xd8fc('0x2b')][_0xd8fc('0x19')]);_0x58718b[_0xd8fc('0x18')]=qs[_0xd8fc('0x18')](_0x454a77['query'][_0xd8fc('0x18')]);}_0x58718b['order']=qs[_0xd8fc('0x32')](_0x454a77['query']['sort']);_0x58718b[_0xd8fc('0x33')]=qs[_0xd8fc('0x34')](_[_0xd8fc('0x35')](_0x454a77[_0xd8fc('0x2b')],_0x9d29b4[_0xd8fc('0x34')]),_0x1f4577);if(_0x454a77[_0xd8fc('0x2b')]['filter']){_0x58718b[_0xd8fc('0x33')]=_[_0xd8fc('0x36')](_0x58718b[_0xd8fc('0x33')],{'$or':_['map'](_0x1f4577,function(_0x1fae3e){if(_0x1fae3e[_0xd8fc('0x28')]!=='VIRTUAL'){var _0x4d39f6={};_0x4d39f6[_0x1fae3e[_0xd8fc('0x23')]]={'$like':'%'+_0x454a77['query'][_0xd8fc('0x37')]+'%'};return _0x4d39f6;}})});}_0x58718b=_['merge']({},_0x58718b,_0x454a77[_0xd8fc('0x38')]);var _0x2cd726={'where':_0x58718b[_0xd8fc('0x33')]};return db['AnalyticTreeReport'][_0xd8fc('0x17')](_0x2cd726)['then'](function(_0xbb9ee5){_0x51d0d0[_0xd8fc('0x17')]=_0xbb9ee5;if(_0x454a77['query'][_0xd8fc('0x39')]){_0x58718b[_0xd8fc('0x3a')]=[{'all':!![]}];}return db[_0xd8fc('0x3b')][_0xd8fc('0x3c')](_0x58718b);})['then'](function(_0x3ba4fb){_0x51d0d0[_0xd8fc('0x3d')]=_0x3ba4fb;return _0x51d0d0;})[_0xd8fc('0x20')](respondWithFilteredResult(_0xb4077f,_0x58718b))['catch'](handleError(_0xb4077f,null));};exports['show']=function(_0x4d8a1f,_0x17ffbb){var _0x360ef7={'raw':!![],'where':{'id':_0x4d8a1f[_0xd8fc('0x3e')]['id']}},_0x3e04ee={};_0x3e04ee['model']=_[_0xd8fc('0x2c')](db[_0xd8fc('0x3b')][_0xd8fc('0x3f')]);_0x3e04ee[_0xd8fc('0x2b')]=_[_0xd8fc('0x2c')](_0x4d8a1f[_0xd8fc('0x2b')]);_0x3e04ee[_0xd8fc('0x40')]=_['intersection'](_0x3e04ee[_0xd8fc('0x2a')],_0x3e04ee[_0xd8fc('0x2b')]);_0x360ef7['attributes']=_[_0xd8fc('0x2d')](_0x3e04ee[_0xd8fc('0x2a')],qs[_0xd8fc('0x2f')](_0x4d8a1f[_0xd8fc('0x2b')][_0xd8fc('0x2f')]));_0x360ef7[_0xd8fc('0x2e')]=_0x360ef7[_0xd8fc('0x2e')][_0xd8fc('0x41')]?_0x360ef7[_0xd8fc('0x2e')]:_0x3e04ee[_0xd8fc('0x2a')];if(_0x4d8a1f[_0xd8fc('0x2b')][_0xd8fc('0x39')]){_0x360ef7[_0xd8fc('0x3a')]=[{'all':!![]}];}_0x360ef7=_[_0xd8fc('0x36')]({},_0x360ef7,_0x4d8a1f['options']);return db['AnalyticTreeReport']['find'](_0x360ef7)[_0xd8fc('0x20')](handleEntityNotFound(_0x17ffbb,null))[_0xd8fc('0x20')](respondWithResult(_0x17ffbb,null))[_0xd8fc('0x42')](handleError(_0x17ffbb,null));};exports[_0xd8fc('0x43')]=function(_0x580668,_0x1495b1){return db[_0xd8fc('0x3b')][_0xd8fc('0x43')](_0x580668[_0xd8fc('0x44')],{})[_0xd8fc('0x20')](respondWithResult(_0x1495b1,0xc9))[_0xd8fc('0x42')](handleError(_0x1495b1,null));};exports[_0xd8fc('0x1f')]=function(_0x4b1781,_0x484a75){if(_0x4b1781['body']['id']){delete _0x4b1781[_0xd8fc('0x44')]['id'];}return db[_0xd8fc('0x3b')][_0xd8fc('0x45')]({'where':{'id':_0x4b1781[_0xd8fc('0x3e')]['id']}})[_0xd8fc('0x20')](handleEntityNotFound(_0x484a75,null))[_0xd8fc('0x20')](saveUpdates(_0x4b1781[_0xd8fc('0x44')],null))[_0xd8fc('0x20')](respondWithResult(_0x484a75,null))[_0xd8fc('0x42')](handleError(_0x484a75,null));};exports['destroy']=function(_0x4a2c1b,_0x2c3295){return db['AnalyticTreeReport'][_0xd8fc('0x45')]({'where':{'id':_0x4a2c1b['params']['id']}})[_0xd8fc('0x20')](handleEntityNotFound(_0x2c3295,null))[_0xd8fc('0x20')](removeEntity(_0x2c3295,null))['catch'](handleError(_0x2c3295,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 09273dc..f33e715 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 _0x6faf=['bluebird','request-promise','rimraf','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','api','moment'];(function(_0x504c2e,_0x383b42){var _0x4bf7de=function(_0x364a41){while(--_0x364a41){_0x504c2e['push'](_0x504c2e['shift']());}};_0x4bf7de(++_0x383b42);}(_0x6faf,0xf9));var _0xf6fa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6faf[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xf6fa('0x0'));var logger=require(_0xf6fa('0x1'))(_0xf6fa('0x2'));var moment=require(_0xf6fa('0x3'));var BPromise=require(_0xf6fa('0x4'));var rp=require(_0xf6fa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6fa('0x6'));var config=require('../../config/environment');var attributes=require(_0xf6fa('0x7'));module['exports']=function(_0xe883dd,_0x3c91fc){return _0xe883dd[_0xf6fa('0x8')](_0xf6fa('0x9'),attributes,{'tableName':_0xf6fa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa93a=['../../config/logger','bluebird','path','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0xa93a,0xb8));var _0xaa93=function(_0x479c8d,_0x3ba988){_0x479c8d=_0x479c8d-0x0;var _0x2d158f=_0xa93a[_0x479c8d];return _0x2d158f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaa93('0x0'))('api');var moment=require('moment');var BPromise=require(_0xaa93('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa93('0x2'));var rimraf=require('rimraf');var config=require(_0xaa93('0x3'));var attributes=require(_0xaa93('0x4'));module[_0xaa93('0x5')]=function(_0xed4247,_0x165af0){return _0xed4247['define'](_0xaa93('0x6'),attributes,{'tableName':_0xaa93('0x7'),'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 9d4c275..4ee80df 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 _0xba93=['then','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request'];(function(_0x25a6c6,_0x222572){var _0x1a2ee0=function(_0x1bcd75){while(--_0x1bcd75){_0x25a6c6['push'](_0x25a6c6['shift']());}};_0x1a2ee0(++_0x222572);}(_0xba93,0x117));var _0x3ba9=function(_0x19dfcc,_0x325656){_0x19dfcc=_0x19dfcc-0x0;var _0x10a833=_0xba93[_0x19dfcc];return _0x10a833;};'use strict';var _=require(_0x3ba9('0x0'));var util=require('util');var moment=require(_0x3ba9('0x1'));var BPromise=require('bluebird');var rs=require(_0x3ba9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ba9('0x3'))['db'];var utils=require(_0x3ba9('0x4'));var logger=require(_0x3ba9('0x5'))('rpc');var config=require(_0x3ba9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3ba9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc80f39,_0x1cc533,_0x54c77c){return new BPromise(function(_0x4d178f,_0x33f0dd){return client[_0x3ba9('0x8')](_0xc80f39,_0x54c77c)[_0x3ba9('0x9')](function(_0x500f86){logger['info'](_0x3ba9('0xa'),_0x1cc533,'request\x20sent');logger['debug'](_0x3ba9('0xb'),_0x1cc533,_0x3ba9('0xc'),JSON[_0x3ba9('0xd')](_0x500f86));if(_0x500f86[_0x3ba9('0xe')]){if(_0x500f86[_0x3ba9('0xe')]['code']===0x1f4){logger[_0x3ba9('0xe')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1cc533,_0x500f86[_0x3ba9('0xe')]['message']);return _0x33f0dd(_0x500f86['error']['message']);}logger[_0x3ba9('0xe')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1cc533,_0x500f86[_0x3ba9('0xe')][_0x3ba9('0xf')]);return _0x4d178f(_0x500f86['error'][_0x3ba9('0xf')]);}else{logger[_0x3ba9('0x10')](_0x3ba9('0xa'),_0x1cc533,_0x3ba9('0xc'));_0x4d178f(_0x500f86['result'][_0x3ba9('0xf')]);}})[_0x3ba9('0x11')](function(_0x26fb2d){logger[_0x3ba9('0xe')](_0x3ba9('0xa'),_0x1cc533,_0x26fb2d);_0x33f0dd(_0x26fb2d);});});} \ No newline at end of file +var _0xf59d=['request','then','info','AnalyticTreeReport,\x20%s,\x20%s','debug','request\x20sent','code','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x10eaae,_0x878a77){var _0x8c5a2b=function(_0x4744a8){while(--_0x4744a8){_0x10eaae['push'](_0x10eaae['shift']());}};_0x8c5a2b(++_0x878a77);}(_0xf59d,0x83));var _0xdf59=function(_0x1c01d8,_0x2ff6d3){_0x1c01d8=_0x1c01d8-0x0;var _0x1a368d=_0xf59d[_0x1c01d8];return _0x1a368d;};'use strict';var _=require('lodash');var util=require(_0xdf59('0x0'));var moment=require(_0xdf59('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf59('0x2'))['db'];var utils=require(_0xdf59('0x3'));var logger=require(_0xdf59('0x4'))(_0xdf59('0x5'));var config=require(_0xdf59('0x6'));var jayson=require(_0xdf59('0x7'));var client=jayson['client'][_0xdf59('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x575252,_0x288031,_0x20fb8d){return new BPromise(function(_0x36a75d,_0x1ea6b6){return client[_0xdf59('0x9')](_0x575252,_0x20fb8d)[_0xdf59('0xa')](function(_0xd39300){logger[_0xdf59('0xb')](_0xdf59('0xc'),_0x288031,'request\x20sent');logger[_0xdf59('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x288031,_0xdf59('0xe'),JSON['stringify'](_0xd39300));if(_0xd39300['error']){if(_0xd39300['error'][_0xdf59('0xf')]===0x1f4){logger['error'](_0xdf59('0xc'),_0x288031,_0xd39300[_0xdf59('0x10')]['message']);return _0x1ea6b6(_0xd39300[_0xdf59('0x10')]['message']);}logger['error'](_0xdf59('0xc'),_0x288031,_0xd39300[_0xdf59('0x10')][_0xdf59('0x11')]);return _0x36a75d(_0xd39300[_0xdf59('0x10')][_0xdf59('0x11')]);}else{logger[_0xdf59('0xb')](_0xdf59('0xc'),_0x288031,_0xdf59('0xe'));_0x36a75d(_0xd39300[_0xdf59('0x12')][_0xdf59('0x11')]);}})[_0xdf59('0x13')](function(_0x23a494){logger[_0xdf59('0x10')](_0xdf59('0xc'),_0x288031,_0x23a494);_0x1ea6b6(_0x23a494);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 975816b..d79a81e 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 _0x98f1=['multer','util','connect-timeout','express','Router','./analyticTreeReport.controller','isAuthenticated','get','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x23fdcd,_0x4760a4){var _0x413768=function(_0x2e1f37){while(--_0x2e1f37){_0x23fdcd['push'](_0x23fdcd['shift']());}};_0x413768(++_0x4760a4);}(_0x98f1,0x1f0));var _0x198f=function(_0x3e3d0a,_0x4745dd){_0x3e3d0a=_0x3e3d0a-0x0;var _0x3fc765=_0x98f1[_0x3e3d0a];return _0x3fc765;};'use strict';var multer=require(_0x198f('0x0'));var util=require(_0x198f('0x1'));var path=require('path');var timeout=require(_0x198f('0x2'));var express=require(_0x198f('0x3'));var router=express[_0x198f('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x198f('0x5'));router['get']('/',auth[_0x198f('0x6')](),controller['index']);router[_0x198f('0x7')](_0x198f('0x8'),auth[_0x198f('0x6')](),controller[_0x198f('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x198f('0xa')]);router[_0x198f('0xb')](_0x198f('0x8'),auth[_0x198f('0x6')](),controller[_0x198f('0xc')]);router[_0x198f('0xd')](_0x198f('0x8'),auth[_0x198f('0x6')](),controller[_0x198f('0xe')]);module[_0x198f('0xf')]=router; \ No newline at end of file +var _0x12ae=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x1f3563,_0x87b971){var _0x223598=function(_0x354fff){while(--_0x354fff){_0x1f3563['push'](_0x1f3563['shift']());}};_0x223598(++_0x87b971);}(_0x12ae,0x1a4));var _0xe12a=function(_0x3d25e5,_0x505036){_0x3d25e5=_0x3d25e5-0x0;var _0x374469=_0x12ae[_0x3d25e5];return _0x374469;};'use strict';var multer=require(_0xe12a('0x0'));var util=require('util');var path=require(_0xe12a('0x1'));var timeout=require(_0xe12a('0x2'));var express=require(_0xe12a('0x3'));var router=express[_0xe12a('0x4')]();var auth=require(_0xe12a('0x5'));var interaction=require(_0xe12a('0x6'));var config=require(_0xe12a('0x7'));var controller=require(_0xe12a('0x8'));router[_0xe12a('0x9')]('/',auth[_0xe12a('0xa')](),controller[_0xe12a('0xb')]);router[_0xe12a('0x9')](_0xe12a('0xc'),auth['isAuthenticated'](),controller[_0xe12a('0xd')]);router[_0xe12a('0xe')]('/',auth['isAuthenticated'](),controller[_0xe12a('0xf')]);router[_0xe12a('0x10')](_0xe12a('0xc'),auth[_0xe12a('0xa')](),controller[_0xe12a('0x11')]);router[_0xe12a('0x12')](_0xe12a('0xc'),auth[_0xe12a('0xa')](),controller[_0xe12a('0x13')]);module[_0xe12a('0x14')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 2726c75..6ca7539 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 _0x561d=['STRING','sequelize'];(function(_0x596de3,_0xf801c0){var _0xbf541f=function(_0x3b7460){while(--_0x3b7460){_0x596de3['push'](_0x596de3['shift']());}};_0xbf541f(++_0xf801c0);}(_0x561d,0x161));var _0xd561=function(_0x189364,_0xb3c7bb){_0x189364=_0x189364-0x0;var _0x26f26d=_0x561d[_0x189364];return _0x26f26d;};'use strict';var Sequelize=require(_0xd561('0x0'));module['exports']={'name':{'type':Sequelize[_0xd561('0x1')]},'basename':{'type':Sequelize[_0xd561('0x1')]},'type':{'type':Sequelize[_0xd561('0x1')]}}; \ No newline at end of file +var _0x3974=['STRING','sequelize','exports'];(function(_0x3f6c4d,_0x1f969b){var _0x144e6f=function(_0xd3d637){while(--_0xd3d637){_0x3f6c4d['push'](_0x3f6c4d['shift']());}};_0x144e6f(++_0x1f969b);}(_0x3974,0x154));var _0x4397=function(_0x47a721,_0x4a084b){_0x47a721=_0x47a721-0x0;var _0x5589ab=_0x3974[_0x47a721];return _0x5589ab;};'use strict';var Sequelize=require(_0x4397('0x0'));module[_0x4397('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x4397('0x2')]},'type':{'type':Sequelize[_0x4397('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 6cb5f1a..84a1db1 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 _0xa372=['stack','name','send','index','map','Attachment','rawAttributes','fieldName','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','includeAll','include','findAll','rows','params','filtears','options','find','catch','clone','get','omit','updatedAt','create','body','file','originalname','basename','filename','mimetype','download','findOne','server/files/attachments/','html-pdf','eml-format','rimraf','fast-json-patch','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy'];(function(_0x4ad393,_0x43251d){var _0x384321=function(_0x15c732){while(--_0x15c732){_0x4ad393['push'](_0x4ad393['shift']());}};_0x384321(++_0x43251d);}(_0xa372,0x125));var _0x2a37=function(_0x172361,_0x3c0ed5){_0x172361=_0x172361-0x0;var _0x1d2c7f=_0xa372[_0x172361];return _0x1d2c7f;};'use strict';var pdf=require(_0x2a37('0x0'));var emlformat=require(_0x2a37('0x1'));var rimraf=require(_0x2a37('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a37('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2a37('0x4'));var util=require('util');var path=require(_0x2a37('0x5'));var sox=require(_0x2a37('0x6'));var csv=require(_0x2a37('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2a37('0x8'));var crypto=require(_0x2a37('0x9'));var jsforce=require(_0x2a37('0xa'));var deskjs=require(_0x2a37('0xb'));var toCsv=require(_0x2a37('0x7'));var querystring=require(_0x2a37('0xc'));var Papa=require(_0x2a37('0xd'));var Redis=require(_0x2a37('0xe'));var authService=require(_0x2a37('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2a37('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2a37('0x11'));var utils=require('../../config/utils');var config=require(_0x2a37('0x12'));var licenseUtil=require(_0x2a37('0x13'));var db=require(_0x2a37('0x14'))['db'];function respondWithStatusCode(_0x52e5e1,_0x32af07){_0x32af07=_0x32af07||0xcc;return function(_0xd6cf9b){if(_0xd6cf9b){return _0x52e5e1[_0x2a37('0x15')](_0x32af07);}return _0x52e5e1[_0x2a37('0x16')](_0x32af07)['end']();};}function respondWithResult(_0x10e47d,_0x2a8b10){_0x2a8b10=_0x2a8b10||0xc8;return function(_0x52672d){if(_0x52672d){return _0x10e47d[_0x2a37('0x16')](_0x2a8b10)['json'](_0x52672d);}};}function respondWithFilteredResult(_0x30a569,_0x1c6849){return function(_0x563d5b){if(_0x563d5b){var _0x48f97e=_0x563d5b[_0x2a37('0x17')],_0x32385a=_0x1c6849[_0x2a37('0x18')],_0xc22db7=_0x1c6849[_0x2a37('0x18')]+_0x1c6849[_0x2a37('0x19')],_0x126148;if(_0xc22db7>=_0x48f97e){_0xc22db7=_0x48f97e;_0x126148=0xc8;}else{_0x126148=0xce;}_0x30a569[_0x2a37('0x16')](_0x126148);return _0x30a569[_0x2a37('0x1a')](_0x2a37('0x1b'),_0x32385a+'-'+_0xc22db7+'/'+_0x48f97e)[_0x2a37('0x1c')](_0x563d5b);}return null;};}function patchUpdates(_0x2e53b5){return function(_0x52f13d){try{jsonpatch[_0x2a37('0x1d')](_0x52f13d,_0x2e53b5,!![]);}catch(_0xb752da){return BPromise[_0x2a37('0x1e')](_0xb752da);}return _0x52f13d[_0x2a37('0x1f')]();};}function saveUpdates(_0x436b6a,_0x3ae0ee){return function(_0xeb1fb0){if(_0xeb1fb0){return _0xeb1fb0[_0x2a37('0x20')](_0x436b6a)[_0x2a37('0x21')](function(_0x49d53b){return _0x49d53b;});}return null;};}function removeEntity(_0x1923f0,_0x267542){return function(_0x1b14af){if(_0x1b14af){return _0x1b14af[_0x2a37('0x22')]()[_0x2a37('0x21')](function(){_0x1923f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c983f,_0x5c256f){return function(_0x1359d7){if(!_0x1359d7){_0x4c983f[_0x2a37('0x15')](0x194);}return _0x1359d7;};}function handleError(_0x409cb5,_0x3ff60e){_0x3ff60e=_0x3ff60e||0x1f4;return function(_0x175344){logger['error'](_0x175344[_0x2a37('0x23')]);if(_0x175344[_0x2a37('0x24')]){delete _0x175344[_0x2a37('0x24')];}_0x409cb5[_0x2a37('0x16')](_0x3ff60e)[_0x2a37('0x25')](_0x175344);};}exports[_0x2a37('0x26')]=function(_0x1af8af,_0x3c56c5){var _0x2fcc89={},_0x1111dc={},_0x5e1622={'count':0x0,'rows':[]};var _0x312454=_[_0x2a37('0x27')](db[_0x2a37('0x28')][_0x2a37('0x29')],function(_0x2f73b3){return{'name':_0x2f73b3[_0x2a37('0x2a')],'type':_0x2f73b3['type']['key']};});_0x1111dc['model']=_[_0x2a37('0x27')](_0x312454,_0x2a37('0x24'));_0x1111dc['query']=_[_0x2a37('0x2b')](_0x1af8af[_0x2a37('0x2c')]);_0x1111dc['filters']=_['intersection'](_0x1111dc[_0x2a37('0x2d')],_0x1111dc[_0x2a37('0x2c')]);_0x2fcc89[_0x2a37('0x2e')]=_[_0x2a37('0x2f')](_0x1111dc[_0x2a37('0x2d')],qs['fields'](_0x1af8af[_0x2a37('0x2c')][_0x2a37('0x30')]));_0x2fcc89['attributes']=_0x2fcc89[_0x2a37('0x2e')][_0x2a37('0x31')]?_0x2fcc89['attributes']:_0x1111dc[_0x2a37('0x2d')];if(!_0x1af8af['query'][_0x2a37('0x32')]('nolimit')){_0x2fcc89[_0x2a37('0x19')]=qs[_0x2a37('0x19')](_0x1af8af[_0x2a37('0x2c')]['limit']);_0x2fcc89[_0x2a37('0x18')]=qs[_0x2a37('0x18')](_0x1af8af['query'][_0x2a37('0x18')]);}_0x2fcc89[_0x2a37('0x33')]=qs[_0x2a37('0x34')](_0x1af8af[_0x2a37('0x2c')][_0x2a37('0x34')]);_0x2fcc89[_0x2a37('0x35')]=qs[_0x2a37('0x36')](_[_0x2a37('0x37')](_0x1af8af[_0x2a37('0x2c')],_0x1111dc['filters']),_0x312454);if(_0x1af8af[_0x2a37('0x2c')][_0x2a37('0x38')]){_0x2fcc89[_0x2a37('0x35')]=_[_0x2a37('0x39')](_0x2fcc89[_0x2a37('0x35')],{'$or':_[_0x2a37('0x27')](_0x312454,function(_0x347359){if(_0x347359[_0x2a37('0x3a')]!=='VIRTUAL'){var _0x5072c6={};_0x5072c6[_0x347359[_0x2a37('0x24')]]={'$like':'%'+_0x1af8af['query'][_0x2a37('0x38')]+'%'};return _0x5072c6;}})});}_0x2fcc89=_[_0x2a37('0x39')]({},_0x2fcc89,_0x1af8af['options']);var _0x58b5a2={'where':_0x2fcc89[_0x2a37('0x35')]};return db['Attachment'][_0x2a37('0x17')](_0x58b5a2)[_0x2a37('0x21')](function(_0x279959){_0x5e1622[_0x2a37('0x17')]=_0x279959;if(_0x1af8af[_0x2a37('0x2c')][_0x2a37('0x3b')]){_0x2fcc89[_0x2a37('0x3c')]=[{'all':!![]}];}return db['Attachment'][_0x2a37('0x3d')](_0x2fcc89);})[_0x2a37('0x21')](function(_0x48c278){_0x5e1622[_0x2a37('0x3e')]=_0x48c278;return _0x5e1622;})[_0x2a37('0x21')](respondWithFilteredResult(_0x3c56c5,_0x2fcc89))['catch'](handleError(_0x3c56c5,null));};exports['show']=function(_0x55f903,_0x50b035){var _0x5183f8={'raw':!![],'where':{'id':_0x55f903[_0x2a37('0x3f')]['id']}},_0x50b2a7={};_0x50b2a7['model']=_[_0x2a37('0x2b')](db[_0x2a37('0x28')][_0x2a37('0x29')]);_0x50b2a7[_0x2a37('0x2c')]=_[_0x2a37('0x2b')](_0x55f903['query']);_0x50b2a7[_0x2a37('0x40')]=_[_0x2a37('0x2f')](_0x50b2a7[_0x2a37('0x2d')],_0x50b2a7[_0x2a37('0x2c')]);_0x5183f8[_0x2a37('0x2e')]=_['intersection'](_0x50b2a7['model'],qs[_0x2a37('0x30')](_0x55f903[_0x2a37('0x2c')][_0x2a37('0x30')]));_0x5183f8['attributes']=_0x5183f8[_0x2a37('0x2e')][_0x2a37('0x31')]?_0x5183f8[_0x2a37('0x2e')]:_0x50b2a7[_0x2a37('0x2d')];if(_0x55f903['query']['includeAll']){_0x5183f8[_0x2a37('0x3c')]=[{'all':!![]}];}_0x5183f8=_[_0x2a37('0x39')]({},_0x5183f8,_0x55f903[_0x2a37('0x41')]);return db['Attachment'][_0x2a37('0x42')](_0x5183f8)['then'](handleEntityNotFound(_0x50b035,null))[_0x2a37('0x21')](respondWithResult(_0x50b035,null))[_0x2a37('0x43')](handleError(_0x50b035,null));};exports[_0x2a37('0x44')]=function(_0x48ef75,_0x3baa79){var _0x3d90a0={'where':{'id':_0x48ef75[_0x2a37('0x3f')]['id']}},_0x4b2cc1={};_0x4b2cc1[_0x2a37('0x2d')]=_[_0x2a37('0x2b')](db['Attachment'][_0x2a37('0x29')]);_0x3d90a0[_0x2a37('0x2e')]=_['intersection'](_0x4b2cc1['model'],qs[_0x2a37('0x30')](_0x48ef75[_0x2a37('0x2c')][_0x2a37('0x30')]));_0x3d90a0[_0x2a37('0x2e')]=_0x3d90a0['attributes'][_0x2a37('0x31')]?_0x3d90a0['attributes']:_0x4b2cc1[_0x2a37('0x2d')];if(_0x48ef75[_0x2a37('0x2c')]['includeAll']){_0x3d90a0[_0x2a37('0x3c')]=[{'all':!![]}];}_0x3d90a0=_['merge']({},_0x3d90a0,_0x48ef75['options']);return db[_0x2a37('0x28')][_0x2a37('0x42')](_0x3d90a0)[_0x2a37('0x21')](handleEntityNotFound(_0x3baa79,null))['then'](function(_0x560bdb){if(_0x560bdb){var _0x5335ef=_0x560bdb[_0x2a37('0x45')]({'plain':!![]});_0x5335ef=qs[_0x2a37('0x46')](_0x5335ef,['id','createdAt','updatedAt']);_0x48ef75['body']=_['omit'](_0x48ef75['body'],['id','createdAt',_0x2a37('0x47')]);return db[_0x2a37('0x28')][_0x2a37('0x48')](_[_0x2a37('0x39')](_0x5335ef,_0x48ef75[_0x2a37('0x49')]),{'include':_0x48ef75[_0x2a37('0x2c')][_0x2a37('0x3b')]?[{'all':!![]}]:undefined});}})[_0x2a37('0x21')](respondWithResult(_0x3baa79,0xc9))[_0x2a37('0x43')](handleError(_0x3baa79,null));};exports[_0x2a37('0x20')]=function(_0x5aaed8,_0x182f9a){if(_0x5aaed8[_0x2a37('0x49')]['id']){delete _0x5aaed8['body']['id'];}return db[_0x2a37('0x28')][_0x2a37('0x42')]({'where':{'id':_0x5aaed8['params']['id']}})[_0x2a37('0x21')](handleEntityNotFound(_0x182f9a,null))[_0x2a37('0x21')](saveUpdates(_0x5aaed8[_0x2a37('0x49')],null))[_0x2a37('0x21')](respondWithResult(_0x182f9a,null))[_0x2a37('0x43')](handleError(_0x182f9a,null));};exports[_0x2a37('0x22')]=function(_0x52e42f,_0x9006e){return db[_0x2a37('0x28')][_0x2a37('0x42')]({'where':{'id':_0x52e42f[_0x2a37('0x3f')]['id']}})[_0x2a37('0x21')](handleEntityNotFound(_0x9006e,null))[_0x2a37('0x21')](removeEntity(_0x9006e,null))[_0x2a37('0x43')](handleError(_0x9006e,null));};exports[_0x2a37('0x48')]=function(_0x2c35ae,_0x5808f5,_0x3377a1){_0x2c35ae['body'][_0x2a37('0x24')]=_0x2c35ae[_0x2a37('0x4a')][_0x2a37('0x4b')];_0x2c35ae[_0x2a37('0x49')][_0x2a37('0x4c')]=_0x2c35ae[_0x2a37('0x4a')][_0x2a37('0x4d')];_0x2c35ae['body'][_0x2a37('0x3a')]=_0x2c35ae[_0x2a37('0x4a')][_0x2a37('0x4e')];return db['Attachment'][_0x2a37('0x48')](_0x2c35ae[_0x2a37('0x49')])['then'](respondWithResult(_0x5808f5,0xc9))[_0x2a37('0x43')](handleError(_0x5808f5,null));};exports[_0x2a37('0x4f')]=function(_0x1b6fa6,_0x2ba27b,_0x1b0d30){return db[_0x2a37('0x28')][_0x2a37('0x50')]({'where':{'id':_0x1b6fa6[_0x2a37('0x3f')]['id']},'raw':!![]})[_0x2a37('0x21')](handleEntityNotFound(_0x2ba27b,null))[_0x2a37('0x21')](function(_0x3cf335){if(_0x3cf335){return _0x2ba27b[_0x2a37('0x4f')](path['join'](config['root'],_0x2a37('0x51'),_0x3cf335[_0x2a37('0x4c')]));}})[_0x2a37('0x43')](handleError(_0x2ba27b,null));}; \ No newline at end of file +var _0xd8c6=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','error','stack','name','send','index','Attachment','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','where','findAll','rows','catch','show','params','filtears','includeAll','include','clone','get','omit','createdAt','updatedAt','body','create','file','originalname','mimetype','download','findOne','join','basename','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'];(function(_0x23b936,_0x3ba0b5){var _0x8ee3ff=function(_0x3707d3){while(--_0x3707d3){_0x23b936['push'](_0x23b936['shift']());}};_0x8ee3ff(++_0x3ba0b5);}(_0xd8c6,0x99));var _0x6d8c=function(_0x5905f7,_0x2261f6){_0x5905f7=_0x5905f7-0x0;var _0x18724f=_0xd8c6[_0x5905f7];return _0x18724f;};'use strict';var pdf=require(_0x6d8c('0x0'));var emlformat=require(_0x6d8c('0x1'));var rimraf=require(_0x6d8c('0x2'));var zipdir=require(_0x6d8c('0x3'));var jsonpatch=require(_0x6d8c('0x4'));var rp=require(_0x6d8c('0x5'));var moment=require(_0x6d8c('0x6'));var BPromise=require(_0x6d8c('0x7'));var Mustache=require(_0x6d8c('0x8'));var util=require(_0x6d8c('0x9'));var path=require(_0x6d8c('0xa'));var sox=require(_0x6d8c('0xb'));var csv=require(_0x6d8c('0xc'));var ejs=require(_0x6d8c('0xd'));var fs=require('fs');var _=require(_0x6d8c('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6d8c('0xf'));var toCsv=require(_0x6d8c('0xc'));var querystring=require(_0x6d8c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6d8c('0x11'));var qs=require(_0x6d8c('0x12'));var as=require(_0x6d8c('0x13'));var hardwareService=require(_0x6d8c('0x14'));var logger=require('../../config/logger')(_0x6d8c('0x15'));var utils=require(_0x6d8c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6d8c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e3288,_0x585be9){_0x585be9=_0x585be9||0xcc;return function(_0x19f710){if(_0x19f710){return _0x2e3288[_0x6d8c('0x18')](_0x585be9);}return _0x2e3288[_0x6d8c('0x19')](_0x585be9)[_0x6d8c('0x1a')]();};}function respondWithResult(_0x557b40,_0x44d6c7){_0x44d6c7=_0x44d6c7||0xc8;return function(_0x39adf8){if(_0x39adf8){return _0x557b40[_0x6d8c('0x19')](_0x44d6c7)[_0x6d8c('0x1b')](_0x39adf8);}};}function respondWithFilteredResult(_0x17a8e9,_0x222b6c){return function(_0x1edb25){if(_0x1edb25){var _0x367f60=_0x1edb25[_0x6d8c('0x1c')],_0x578b75=_0x222b6c['offset'],_0x510c8d=_0x222b6c[_0x6d8c('0x1d')]+_0x222b6c[_0x6d8c('0x1e')],_0x3e37e3;if(_0x510c8d>=_0x367f60){_0x510c8d=_0x367f60;_0x3e37e3=0xc8;}else{_0x3e37e3=0xce;}_0x17a8e9[_0x6d8c('0x19')](_0x3e37e3);return _0x17a8e9['set'](_0x6d8c('0x1f'),_0x578b75+'-'+_0x510c8d+'/'+_0x367f60)['json'](_0x1edb25);}return null;};}function patchUpdates(_0x231724){return function(_0x5e8055){try{jsonpatch['apply'](_0x5e8055,_0x231724,!![]);}catch(_0xf79094){return BPromise[_0x6d8c('0x20')](_0xf79094);}return _0x5e8055[_0x6d8c('0x21')]();};}function saveUpdates(_0x50bb82,_0x2379df){return function(_0x2225a6){if(_0x2225a6){return _0x2225a6[_0x6d8c('0x22')](_0x50bb82)['then'](function(_0x2dac67){return _0x2dac67;});}return null;};}function removeEntity(_0x4b63f9,_0x2599ad){return function(_0x554657){if(_0x554657){return _0x554657['destroy']()[_0x6d8c('0x23')](function(){_0x4b63f9[_0x6d8c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x404d29,_0x2ab899){return function(_0x2e85e2){if(!_0x2e85e2){_0x404d29[_0x6d8c('0x18')](0x194);}return _0x2e85e2;};}function handleError(_0x496929,_0x5d4544){_0x5d4544=_0x5d4544||0x1f4;return function(_0xaa8fa1){logger[_0x6d8c('0x24')](_0xaa8fa1[_0x6d8c('0x25')]);if(_0xaa8fa1[_0x6d8c('0x26')]){delete _0xaa8fa1[_0x6d8c('0x26')];}_0x496929[_0x6d8c('0x19')](_0x5d4544)[_0x6d8c('0x27')](_0xaa8fa1);};}exports[_0x6d8c('0x28')]=function(_0x144476,_0x4b1fa4){var _0x51aa33={},_0x827c4c={},_0x512b40={'count':0x0,'rows':[]};var _0xadac4=_['map'](db[_0x6d8c('0x29')][_0x6d8c('0x2a')],function(_0x149edd){return{'name':_0x149edd[_0x6d8c('0x2b')],'type':_0x149edd['type'][_0x6d8c('0x2c')]};});_0x827c4c[_0x6d8c('0x2d')]=_[_0x6d8c('0x2e')](_0xadac4,'name');_0x827c4c[_0x6d8c('0x2f')]=_[_0x6d8c('0x30')](_0x144476['query']);_0x827c4c[_0x6d8c('0x31')]=_['intersection'](_0x827c4c[_0x6d8c('0x2d')],_0x827c4c[_0x6d8c('0x2f')]);_0x51aa33[_0x6d8c('0x32')]=_[_0x6d8c('0x33')](_0x827c4c[_0x6d8c('0x2d')],qs[_0x6d8c('0x34')](_0x144476['query'][_0x6d8c('0x34')]));_0x51aa33['attributes']=_0x51aa33[_0x6d8c('0x32')][_0x6d8c('0x35')]?_0x51aa33[_0x6d8c('0x32')]:_0x827c4c['model'];if(!_0x144476[_0x6d8c('0x2f')][_0x6d8c('0x36')](_0x6d8c('0x37'))){_0x51aa33[_0x6d8c('0x1e')]=qs[_0x6d8c('0x1e')](_0x144476['query'][_0x6d8c('0x1e')]);_0x51aa33[_0x6d8c('0x1d')]=qs[_0x6d8c('0x1d')](_0x144476[_0x6d8c('0x2f')][_0x6d8c('0x1d')]);}_0x51aa33[_0x6d8c('0x38')]=qs['sort'](_0x144476[_0x6d8c('0x2f')][_0x6d8c('0x39')]);_0x51aa33['where']=qs[_0x6d8c('0x31')](_[_0x6d8c('0x3a')](_0x144476[_0x6d8c('0x2f')],_0x827c4c['filters']),_0xadac4);if(_0x144476['query'][_0x6d8c('0x3b')]){_0x51aa33['where']=_[_0x6d8c('0x3c')](_0x51aa33['where'],{'$or':_['map'](_0xadac4,function(_0x19a86c){if(_0x19a86c['type']!==_0x6d8c('0x3d')){var _0x38fba5={};_0x38fba5[_0x19a86c[_0x6d8c('0x26')]]={'$like':'%'+_0x144476[_0x6d8c('0x2f')][_0x6d8c('0x3b')]+'%'};return _0x38fba5;}})});}_0x51aa33=_['merge']({},_0x51aa33,_0x144476['options']);var _0x143a65={'where':_0x51aa33[_0x6d8c('0x3e')]};return db[_0x6d8c('0x29')]['count'](_0x143a65)['then'](function(_0xdbd9f8){_0x512b40['count']=_0xdbd9f8;if(_0x144476[_0x6d8c('0x2f')]['includeAll']){_0x51aa33['include']=[{'all':!![]}];}return db[_0x6d8c('0x29')][_0x6d8c('0x3f')](_0x51aa33);})[_0x6d8c('0x23')](function(_0x14613e){_0x512b40[_0x6d8c('0x40')]=_0x14613e;return _0x512b40;})[_0x6d8c('0x23')](respondWithFilteredResult(_0x4b1fa4,_0x51aa33))[_0x6d8c('0x41')](handleError(_0x4b1fa4,null));};exports[_0x6d8c('0x42')]=function(_0x1e7888,_0x120f3a){var _0x40c7f2={'raw':!![],'where':{'id':_0x1e7888[_0x6d8c('0x43')]['id']}},_0x45f327={};_0x45f327[_0x6d8c('0x2d')]=_['keys'](db[_0x6d8c('0x29')][_0x6d8c('0x2a')]);_0x45f327[_0x6d8c('0x2f')]=_[_0x6d8c('0x30')](_0x1e7888[_0x6d8c('0x2f')]);_0x45f327[_0x6d8c('0x44')]=_[_0x6d8c('0x33')](_0x45f327[_0x6d8c('0x2d')],_0x45f327[_0x6d8c('0x2f')]);_0x40c7f2[_0x6d8c('0x32')]=_[_0x6d8c('0x33')](_0x45f327[_0x6d8c('0x2d')],qs[_0x6d8c('0x34')](_0x1e7888[_0x6d8c('0x2f')]['fields']));_0x40c7f2[_0x6d8c('0x32')]=_0x40c7f2[_0x6d8c('0x32')][_0x6d8c('0x35')]?_0x40c7f2[_0x6d8c('0x32')]:_0x45f327[_0x6d8c('0x2d')];if(_0x1e7888['query'][_0x6d8c('0x45')]){_0x40c7f2[_0x6d8c('0x46')]=[{'all':!![]}];}_0x40c7f2=_[_0x6d8c('0x3c')]({},_0x40c7f2,_0x1e7888['options']);return db['Attachment']['find'](_0x40c7f2)['then'](handleEntityNotFound(_0x120f3a,null))[_0x6d8c('0x23')](respondWithResult(_0x120f3a,null))['catch'](handleError(_0x120f3a,null));};exports[_0x6d8c('0x47')]=function(_0x2093d7,_0x4c5137){var _0xc01e2={'where':{'id':_0x2093d7[_0x6d8c('0x43')]['id']}},_0x238243={};_0x238243[_0x6d8c('0x2d')]=_[_0x6d8c('0x30')](db[_0x6d8c('0x29')][_0x6d8c('0x2a')]);_0xc01e2[_0x6d8c('0x32')]=_[_0x6d8c('0x33')](_0x238243[_0x6d8c('0x2d')],qs['fields'](_0x2093d7[_0x6d8c('0x2f')][_0x6d8c('0x34')]));_0xc01e2[_0x6d8c('0x32')]=_0xc01e2['attributes'][_0x6d8c('0x35')]?_0xc01e2['attributes']:_0x238243[_0x6d8c('0x2d')];if(_0x2093d7[_0x6d8c('0x2f')]['includeAll']){_0xc01e2[_0x6d8c('0x46')]=[{'all':!![]}];}_0xc01e2=_[_0x6d8c('0x3c')]({},_0xc01e2,_0x2093d7['options']);return db[_0x6d8c('0x29')]['find'](_0xc01e2)['then'](handleEntityNotFound(_0x4c5137,null))[_0x6d8c('0x23')](function(_0x5c36ef){if(_0x5c36ef){var _0x16f0fe=_0x5c36ef[_0x6d8c('0x48')]({'plain':!![]});_0x16f0fe=qs[_0x6d8c('0x49')](_0x16f0fe,['id',_0x6d8c('0x4a'),_0x6d8c('0x4b')]);_0x2093d7[_0x6d8c('0x4c')]=_[_0x6d8c('0x49')](_0x2093d7[_0x6d8c('0x4c')],['id',_0x6d8c('0x4a'),_0x6d8c('0x4b')]);return db[_0x6d8c('0x29')][_0x6d8c('0x4d')](_[_0x6d8c('0x3c')](_0x16f0fe,_0x2093d7[_0x6d8c('0x4c')]),{'include':_0x2093d7[_0x6d8c('0x2f')][_0x6d8c('0x45')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x4c5137,0xc9))[_0x6d8c('0x41')](handleError(_0x4c5137,null));};exports['update']=function(_0x28b343,_0x3fa250){if(_0x28b343[_0x6d8c('0x4c')]['id']){delete _0x28b343[_0x6d8c('0x4c')]['id'];}return db[_0x6d8c('0x29')]['find']({'where':{'id':_0x28b343[_0x6d8c('0x43')]['id']}})[_0x6d8c('0x23')](handleEntityNotFound(_0x3fa250,null))[_0x6d8c('0x23')](saveUpdates(_0x28b343[_0x6d8c('0x4c')],null))[_0x6d8c('0x23')](respondWithResult(_0x3fa250,null))['catch'](handleError(_0x3fa250,null));};exports['destroy']=function(_0x3f6d1e,_0x35cae9){return db['Attachment']['find']({'where':{'id':_0x3f6d1e['params']['id']}})[_0x6d8c('0x23')](handleEntityNotFound(_0x35cae9,null))[_0x6d8c('0x23')](removeEntity(_0x35cae9,null))[_0x6d8c('0x41')](handleError(_0x35cae9,null));};exports[_0x6d8c('0x4d')]=function(_0x4db620,_0x197487,_0x32f7d6){_0x4db620[_0x6d8c('0x4c')]['name']=_0x4db620[_0x6d8c('0x4e')][_0x6d8c('0x4f')];_0x4db620[_0x6d8c('0x4c')]['basename']=_0x4db620[_0x6d8c('0x4e')]['filename'];_0x4db620[_0x6d8c('0x4c')]['type']=_0x4db620[_0x6d8c('0x4e')][_0x6d8c('0x50')];return db[_0x6d8c('0x29')][_0x6d8c('0x4d')](_0x4db620[_0x6d8c('0x4c')])[_0x6d8c('0x23')](respondWithResult(_0x197487,0xc9))[_0x6d8c('0x41')](handleError(_0x197487,null));};exports[_0x6d8c('0x51')]=function(_0x7ec6a2,_0x5bd5f4,_0x2672ad){return db[_0x6d8c('0x29')][_0x6d8c('0x52')]({'where':{'id':_0x7ec6a2['params']['id']},'raw':!![]})[_0x6d8c('0x23')](handleEntityNotFound(_0x5bd5f4,null))[_0x6d8c('0x23')](function(_0x1dde2f){if(_0x1dde2f){return _0x5bd5f4['download'](path[_0x6d8c('0x53')](config['root'],'server/files/attachments/',_0x1dde2f[_0x6d8c('0x54')]));}})[_0x6d8c('0x41')](handleError(_0x5bd5f4,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 064d1f4..18b544e 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 _0x2ca5=['util','../../config/logger','api','bluebird','rimraf','../../config/environment','./attachment.attributes','define'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2ca5,0x108));var _0x52ca=function(_0xac15c3,_0x2451ea){_0xac15c3=_0xac15c3-0x0;var _0x3ef3db=_0x2ca5[_0xac15c3];return _0x3ef3db;};'use strict';var _=require('lodash');var util=require(_0x52ca('0x0'));var logger=require(_0x52ca('0x1'))(_0x52ca('0x2'));var moment=require('moment');var BPromise=require(_0x52ca('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x52ca('0x4'));var config=require(_0x52ca('0x5'));var attributes=require(_0x52ca('0x6'));module['exports']=function(_0x5aa9a0,_0x56f3c9){return _0x5aa9a0[_0x52ca('0x7')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1131=['define','util','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x1131,0x71));var _0x1113=function(_0x25cf5e,_0x21cf10){_0x25cf5e=_0x25cf5e-0x0;var _0x186518=_0x1131[_0x25cf5e];return _0x186518;};'use strict';var _=require('lodash');var util=require(_0x1113('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1113('0x1'));var rp=require(_0x1113('0x2'));var fs=require('fs');var path=require(_0x1113('0x3'));var rimraf=require(_0x1113('0x4'));var config=require(_0x1113('0x5'));var attributes=require(_0x1113('0x6'));module['exports']=function(_0x3880aa,_0x4e6389){return _0x3880aa[_0x1113('0x7')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index fddafe9..ceb412d 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 _0x8382=['CreateAttachment','Attachment','body','raw','info','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','Attachment,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x3476e0,_0x3d6064){var _0x36b833=function(_0x38b5f1){while(--_0x38b5f1){_0x3476e0['push'](_0x3476e0['shift']());}};_0x36b833(++_0x3d6064);}(_0x8382,0x1e5));var _0x2838=function(_0x59e25e,_0x1dcbf7){_0x59e25e=_0x59e25e-0x0;var _0x3c2751=_0x8382[_0x59e25e];return _0x3c2751;};'use strict';var _=require(_0x2838('0x0'));var util=require(_0x2838('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2838('0x2'));var fs=require('fs');var Redis=require(_0x2838('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2838('0x4'));var logger=require(_0x2838('0x5'))('rpc');var config=require(_0x2838('0x6'));var jayson=require(_0x2838('0x7'));var client=jayson[_0x2838('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x231b23,_0xaa2696,_0x39a172){return new BPromise(function(_0x4d045a,_0x317987){return client['request'](_0x231b23,_0x39a172)[_0x2838('0x9')](function(_0x4d7e5c){logger['info'](_0x2838('0xa'),_0xaa2696,'request\x20sent');logger[_0x2838('0xb')]('Attachment,\x20%s,\x20%s,\x20%s',_0xaa2696,_0x2838('0xc'),JSON[_0x2838('0xd')](_0x4d7e5c));if(_0x4d7e5c['error']){if(_0x4d7e5c[_0x2838('0xe')][_0x2838('0xf')]===0x1f4){logger[_0x2838('0xe')]('Attachment,\x20%s,\x20%s',_0xaa2696,_0x4d7e5c[_0x2838('0xe')][_0x2838('0x10')]);return _0x317987(_0x4d7e5c[_0x2838('0xe')][_0x2838('0x10')]);}logger[_0x2838('0xe')](_0x2838('0xa'),_0xaa2696,_0x4d7e5c['error'][_0x2838('0x10')]);return _0x4d045a(_0x4d7e5c[_0x2838('0xe')][_0x2838('0x10')]);}else{logger['info'](_0x2838('0xa'),_0xaa2696,_0x2838('0xc'));_0x4d045a(_0x4d7e5c[_0x2838('0x11')][_0x2838('0x10')]);}})[_0x2838('0x12')](function(_0x1bd579){logger[_0x2838('0xe')](_0x2838('0xa'),_0xaa2696,_0x1bd579);_0x317987(_0x1bd579);});});}exports[_0x2838('0x13')]=function(_0xd249a7){var _0x2575ee=this;return new Promise(function(_0x7726b5,_0x25cd03){return db[_0x2838('0x14')]['create'](_0xd249a7[_0x2838('0x15')],{'raw':_0xd249a7['options']?_0xd249a7['options'][_0x2838('0x16')]===undefined?!![]:![]:!![]})[_0x2838('0x9')](function(_0x43afcf){logger[_0x2838('0x17')](_0x2838('0x13'),_0xd249a7);logger[_0x2838('0xb')](_0x2838('0x13'),_0xd249a7,JSON[_0x2838('0xd')](_0x43afcf));_0x7726b5(_0x43afcf);})[_0x2838('0x12')](function(_0x3acfe9){logger[_0x2838('0xe')]('CreateAttachment',_0x3acfe9[_0x2838('0x10')],_0xd249a7);_0x25cd03(_0x2575ee[_0x2838('0xe')](0x1f4,_0x3acfe9[_0x2838('0x10')]));});});}; \ No newline at end of file +var _0x6998=['stringify','error','message','result','catch','CreateAttachment','Attachment','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../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'];(function(_0x1d491e,_0x2ab000){var _0x2ba991=function(_0x9d98fb){while(--_0x9d98fb){_0x1d491e['push'](_0x1d491e['shift']());}};_0x2ba991(++_0x2ab000);}(_0x6998,0x1af));var _0x8699=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0x6998[_0x14fad0];return _0x5c665f;};'use strict';var _=require(_0x8699('0x0'));var util=require('util');var moment=require(_0x8699('0x1'));var BPromise=require(_0x8699('0x2'));var rs=require(_0x8699('0x3'));var fs=require('fs');var Redis=require(_0x8699('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8699('0x5'));var logger=require(_0x8699('0x6'))(_0x8699('0x7'));var config=require(_0x8699('0x8'));var jayson=require(_0x8699('0x9'));var client=jayson[_0x8699('0xa')][_0x8699('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cc7a2,_0x11618f,_0x5a4904){return new BPromise(function(_0x3ce148,_0xd7b7b4){return client[_0x8699('0xc')](_0x2cc7a2,_0x5a4904)[_0x8699('0xd')](function(_0x388826){logger[_0x8699('0xe')](_0x8699('0xf'),_0x11618f,_0x8699('0x10'));logger[_0x8699('0x11')](_0x8699('0x12'),_0x11618f,_0x8699('0x10'),JSON[_0x8699('0x13')](_0x388826));if(_0x388826[_0x8699('0x14')]){if(_0x388826[_0x8699('0x14')]['code']===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x11618f,_0x388826[_0x8699('0x14')][_0x8699('0x15')]);return _0xd7b7b4(_0x388826[_0x8699('0x14')][_0x8699('0x15')]);}logger[_0x8699('0x14')](_0x8699('0xf'),_0x11618f,_0x388826[_0x8699('0x14')][_0x8699('0x15')]);return _0x3ce148(_0x388826['error'][_0x8699('0x15')]);}else{logger[_0x8699('0xe')](_0x8699('0xf'),_0x11618f,_0x8699('0x10'));_0x3ce148(_0x388826[_0x8699('0x16')][_0x8699('0x15')]);}})[_0x8699('0x17')](function(_0x2a00b0){logger['error'](_0x8699('0xf'),_0x11618f,_0x2a00b0);_0xd7b7b4(_0x2a00b0);});});}exports[_0x8699('0x18')]=function(_0x2406d3){var _0x5a2822=this;return new Promise(function(_0xb4f3d5,_0x15e42a){return db[_0x8699('0x19')][_0x8699('0x1a')](_0x2406d3[_0x8699('0x1b')],{'raw':_0x2406d3[_0x8699('0x1c')]?_0x2406d3[_0x8699('0x1c')][_0x8699('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x24dec2){logger[_0x8699('0xe')](_0x8699('0x18'),_0x2406d3);logger[_0x8699('0x11')]('CreateAttachment',_0x2406d3,JSON[_0x8699('0x13')](_0x24dec2));_0xb4f3d5(_0x24dec2);})[_0x8699('0x17')](function(_0x5a40d7){logger[_0x8699('0x14')]('CreateAttachment',_0x5a40d7[_0x8699('0x15')],_0x2406d3);_0x15e42a(_0x5a2822['error'](0x1f4,_0x5a40d7[_0x8699('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index f42070a..dd435c7 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 _0x199d=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','download','post','clone','join','root','server/files/attachments/','format','%s-%s','now','originalname','file','create','put','/:id','update','delete','destroy','multer','util'];(function(_0x4cbc3a,_0x550753){var _0x16834d=function(_0x57e5c6){while(--_0x57e5c6){_0x4cbc3a['push'](_0x4cbc3a['shift']());}};_0x16834d(++_0x550753);}(_0x199d,0x13d));var _0xd199=function(_0x57928b,_0x29a111){_0x57928b=_0x57928b-0x0;var _0x49aad6=_0x199d[_0x57928b];return _0x49aad6;};'use strict';var multer=require(_0xd199('0x0'));var util=require(_0xd199('0x1'));var path=require(_0xd199('0x2'));var timeout=require(_0xd199('0x3'));var express=require(_0xd199('0x4'));var router=express['Router']();var auth=require(_0xd199('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd199('0x6'));var controller=require(_0xd199('0x7'));router[_0xd199('0x8')]('/',auth['isAuthenticated'](),controller[_0xd199('0x9')]);router[_0xd199('0x8')]('/:id',auth[_0xd199('0xa')](),controller[_0xd199('0xb')]);router[_0xd199('0x8')]('/:id/download',auth[_0xd199('0xa')](),controller[_0xd199('0xc')]);router[_0xd199('0xd')]('/:id/clone',auth[_0xd199('0xa')](),controller[_0xd199('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x32c5bc,_0x58a748,_0x438a3f){_0x438a3f(null,path[_0xd199('0xf')](config[_0xd199('0x10')],_0xd199('0x11')));},'filename':function(_0x376305,_0x46d1df,_0x8e011f){_0x8e011f(null,util[_0xd199('0x12')](_0xd199('0x13'),Date[_0xd199('0x14')](),_0x46d1df[_0xd199('0x15')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xd199('0xd')]('/',upload['single'](_0xd199('0x16')),controller[_0xd199('0x17')]);router[_0xd199('0x18')](_0xd199('0x19'),auth['isAuthenticated'](),controller[_0xd199('0x1a')]);router[_0xd199('0x1b')](_0xd199('0x19'),auth[_0xd199('0xa')](),controller[_0xd199('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x2c16=['show','post','/:id/clone','clone','join','root','now','originalname','single','file','create','put','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index'];(function(_0x78d1ff,_0x3b1bfe){var _0x125c4c=function(_0x419336){while(--_0x419336){_0x78d1ff['push'](_0x78d1ff['shift']());}};_0x125c4c(++_0x3b1bfe);}(_0x2c16,0xf0));var _0x62c1=function(_0x27275a,_0xd1f75b){_0x27275a=_0x27275a-0x0;var _0x2db0a3=_0x2c16[_0x27275a];return _0x2db0a3;};'use strict';var multer=require(_0x62c1('0x0'));var util=require(_0x62c1('0x1'));var path=require(_0x62c1('0x2'));var timeout=require('connect-timeout');var express=require(_0x62c1('0x3'));var router=express[_0x62c1('0x4')]();var auth=require(_0x62c1('0x5'));var interaction=require(_0x62c1('0x6'));var config=require(_0x62c1('0x7'));var controller=require(_0x62c1('0x8'));router[_0x62c1('0x9')]('/',auth[_0x62c1('0xa')](),controller[_0x62c1('0xb')]);router[_0x62c1('0x9')]('/:id',auth[_0x62c1('0xa')](),controller[_0x62c1('0xc')]);router[_0x62c1('0x9')]('/:id/download',auth[_0x62c1('0xa')](),controller['download']);router[_0x62c1('0xd')](_0x62c1('0xe'),auth['isAuthenticated'](),controller[_0x62c1('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x39920f,_0x8dd534,_0x3470d4){_0x3470d4(null,path[_0x62c1('0x10')](config[_0x62c1('0x11')],'server/files/attachments/'));},'filename':function(_0x572c9e,_0x34228,_0x25bcbd){_0x25bcbd(null,util['format']('%s-%s',Date[_0x62c1('0x12')](),_0x34228[_0x62c1('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x62c1('0xd')]('/',upload[_0x62c1('0x14')](_0x62c1('0x15')),controller[_0x62c1('0x16')]);router[_0x62c1('0x17')]('/:id',auth[_0x62c1('0xa')](),controller['update']);router[_0x62c1('0x18')](_0x62c1('0x19'),auth[_0x62c1('0xa')](),controller[_0x62c1('0x1a')]);module[_0x62c1('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index e841e6f..5bac77c 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 _0xc4cc=['disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','getLicense','catch','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','../../config/utils','google','/login','email','callback','authenticate','use','clientID','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','map','emails','value','agent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc4cc,0x118));var _0xcc4c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc4cc[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var passport=require(_0xcc4c('0x0'));var GoogleStrategy=require(_0xcc4c('0x1'))[_0xcc4c('0x2')];var moment=require(_0xcc4c('0x3'));var db=require(_0xcc4c('0x4'))['db'];var config=require(_0xcc4c('0x5'));var signToken=require(_0xcc4c('0x6'))['signToken'];var utils=require(_0xcc4c('0x7'));exports['login']=passport['authenticate'](_0xcc4c('0x8'),{'failureRedirect':_0xcc4c('0x9'),'scope':['profile',_0xcc4c('0xa')],'session':![]});exports[_0xcc4c('0xb')]=passport[_0xcc4c('0xc')](_0xcc4c('0x8'),{'failureRedirect':_0xcc4c('0x9'),'session':![]});passport[_0xcc4c('0xd')](new GoogleStrategy({'clientID':config['google']?config[_0xcc4c('0x8')][_0xcc4c('0xe')]:'id','clientSecret':config[_0xcc4c('0x8')]?config[_0xcc4c('0x8')]['clientSecret']:_0xcc4c('0xf'),'callbackURL':config[_0xcc4c('0x8')]?config[_0xcc4c('0x8')][_0xcc4c('0x10')]:''},function(_0x4c3583,_0x4387e6,_0x5b742e,_0xb1deaf){var _0x12b30f,_0x1413d4;return db['Setting'][_0xcc4c('0x11')]({'where':{'id':0x1},'attributes':[_0xcc4c('0x12'),_0xcc4c('0x13')],'raw':!![]})[_0xcc4c('0x14')](function(_0x2afa56){_0x12b30f=_0x2afa56;return db[_0xcc4c('0x15')]['find']({'where':{'email':_[_0xcc4c('0x16')](_0x5b742e[_0xcc4c('0x17')],_0xcc4c('0x18')),'role':{'$or':['admin','user',_0xcc4c('0x19')]}}});})['then'](function(_0x57f326){_0x1413d4=_0x57f326;if(_0x1413d4){if(_0x1413d4[_0xcc4c('0x1a')]){return _0xb1deaf(_0xcc4c('0x1b'));}else if(_0x12b30f[_0xcc4c('0x13')]>0x0){if(_0x1413d4[_0xcc4c('0x1c')]){if(moment(_0x1413d4[_0xcc4c('0x1d')])[_0xcc4c('0x1e')](_0x12b30f['blockDuration'],_0xcc4c('0x1f'))>moment()){return _0xb1deaf('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils['clearBlockUser'](_0x1413d4,0x0,![],null)['then'](function(){return utils[_0xcc4c('0x20')](_0x1413d4);})[_0xcc4c('0x14')](function(){return _0xb1deaf(null,_0x1413d4);});}}else{return utils['getLicense'](_0x1413d4)[_0xcc4c('0x14')](function(){return _0xb1deaf(null,_0x1413d4);});}}else{return utils['getLicense'](_0x1413d4)['then'](function(){return _0xb1deaf(null,_0x1413d4);});}}return _0xb1deaf(_0xcc4c('0x1b'));})[_0xcc4c('0x21')](function(_0xc91ff6){_0xb1deaf(_0xc91ff6);});})); \ No newline at end of file +var _0x225c=['clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile','email','use','clientID'];(function(_0x25d1be,_0x6fb6e2){var _0x4d19c8=function(_0x354af3){while(--_0x354af3){_0x25d1be['push'](_0x25d1be['shift']());}};_0x4d19c8(++_0x6fb6e2);}(_0x225c,0x187));var _0xc225=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x225c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc225('0x0'));var passport=require(_0xc225('0x1'));var GoogleStrategy=require(_0xc225('0x2'))['Strategy'];var moment=require('moment');var db=require(_0xc225('0x3'))['db'];var config=require(_0xc225('0x4'));var signToken=require(_0xc225('0x5'))[_0xc225('0x6')];var utils=require(_0xc225('0x7'));exports[_0xc225('0x8')]=passport[_0xc225('0x9')](_0xc225('0xa'),{'failureRedirect':_0xc225('0xb'),'scope':[_0xc225('0xc'),_0xc225('0xd')],'session':![]});exports['callback']=passport['authenticate']('google',{'failureRedirect':_0xc225('0xb'),'session':![]});passport[_0xc225('0xe')](new GoogleStrategy({'clientID':config[_0xc225('0xa')]?config[_0xc225('0xa')][_0xc225('0xf')]:'id','clientSecret':config[_0xc225('0xa')]?config[_0xc225('0xa')][_0xc225('0x10')]:_0xc225('0x11'),'callbackURL':config[_0xc225('0xa')]?config['google'][_0xc225('0x12')]:''},function(_0x33a184,_0x5a77d6,_0x723f64,_0x91a640){var _0x40bd3d,_0x35cee7;return db[_0xc225('0x13')][_0xc225('0x14')]({'where':{'id':0x1},'attributes':[_0xc225('0x15'),_0xc225('0x16')],'raw':!![]})[_0xc225('0x17')](function(_0x6a1c75){_0x40bd3d=_0x6a1c75;return db[_0xc225('0x18')][_0xc225('0x19')]({'where':{'email':_['map'](_0x723f64['emails'],'value'),'role':{'$or':[_0xc225('0x1a'),_0xc225('0x1b'),_0xc225('0x1c')]}}});})[_0xc225('0x17')](function(_0x135b60){_0x35cee7=_0x135b60;if(_0x35cee7){if(_0x35cee7[_0xc225('0x1d')]){return _0x91a640(_0xc225('0x1e'));}else if(_0x40bd3d[_0xc225('0x16')]>0x0){if(_0x35cee7[_0xc225('0x1f')]){if(moment(_0x35cee7[_0xc225('0x20')])[_0xc225('0x21')](_0x40bd3d[_0xc225('0x16')],'minutes')>moment()){return _0x91a640(_0xc225('0x1e'));}else{return utils[_0xc225('0x22')](_0x35cee7,0x0,![],null)[_0xc225('0x17')](function(){return utils[_0xc225('0x23')](_0x35cee7);})[_0xc225('0x17')](function(){return _0x91a640(null,_0x35cee7);});}}else{return utils[_0xc225('0x23')](_0x35cee7)[_0xc225('0x17')](function(){return _0x91a640(null,_0x35cee7);});}}else{return utils['getLicense'](_0x35cee7)[_0xc225('0x17')](function(){return _0x91a640(null,_0x35cee7);});}}return _0x91a640(_0xc225('0x1e'));})[_0xc225('0x24')](function(_0x27b60){_0x91a640(_0x27b60);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 32594a6..41e5ce4 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 _0x682e=['login','get','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service'];(function(_0x451199,_0x3b8d9a){var _0x45b5e4=function(_0x463b9){while(--_0x463b9){_0x451199['push'](_0x451199['shift']());}};_0x45b5e4(++_0x3b8d9a);}(_0x682e,0x1ce));var _0xe682=function(_0x11d673,_0x2659e5){_0x11d673=_0x11d673-0x0;var _0x9c2476=_0x682e[_0x11d673];return _0x9c2476;};'use strict';var express=require(_0xe682('0x0'));var passport=require(_0xe682('0x1'));var router=express[_0xe682('0x2')]();var controller=require(_0xe682('0x3'));var userController=require(_0xe682('0x4'));var authService=require(_0xe682('0x5'));router['get']('/',controller[_0xe682('0x6')]);router[_0xe682('0x7')](_0xe682('0x8'),controller[_0xe682('0x9')],authService[_0xe682('0xa')],userController[_0xe682('0x6')],authService[_0xe682('0xb')]);module[_0xe682('0xc')]=router; \ No newline at end of file +var _0x3d9c=['./authGoogle.controller','../user/user.controller.js','get','login','/callback','callback','isMiddleware','exports','express','Router'];(function(_0x31600c,_0x16295b){var _0x295cc1=function(_0x1e84cf){while(--_0x1e84cf){_0x31600c['push'](_0x31600c['shift']());}};_0x295cc1(++_0x16295b);}(_0x3d9c,0x134));var _0xc3d9=function(_0x64c870,_0x59f08f){_0x64c870=_0x64c870-0x0;var _0x771865=_0x3d9c[_0x64c870];return _0x771865;};'use strict';var express=require(_0xc3d9('0x0'));var passport=require('passport');var router=express[_0xc3d9('0x1')]();var controller=require(_0xc3d9('0x2'));var userController=require(_0xc3d9('0x3'));var authService=require('../../components/auth/service');router[_0xc3d9('0x4')]('/',controller[_0xc3d9('0x5')]);router[_0xc3d9('0x4')](_0xc3d9('0x6'),controller[_0xc3d9('0x7')],authService[_0xc3d9('0x8')],userController[_0xc3d9('0x5')],authService['setTokenCookie']);module[_0xc3d9('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index eeadd0f..992b517 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 _0xb25a=['../../mysqldb','../../components/auth/service','../../config/utils','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','disabled','blocked','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','blockedAt','clearBlockUser','add','minutes','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','merge','\x22%s\x22\x20<%s>','request','SendMail','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','Reset\x20Email\x20sent!','token','Setting','passwordHistoryLimit','validatePasswordPattern','previousPasswords','resetPasswordToken','send','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash'];(function(_0x50c4c4,_0x5938b6){var _0x9ccfa3=function(_0x21aee6){while(--_0x21aee6){_0x50c4c4['push'](_0x50c4c4['shift']());}};_0x9ccfa3(++_0x5938b6);}(_0xb25a,0xa6));var _0xab25=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xb25a[_0x59ee6f];return _0x4c0979;};'use strict';var util=require(_0xab25('0x0'));var passport=require(_0xab25('0x1'));var LocalStrategy=require(_0xab25('0x2'))[_0xab25('0x3')];var jayson=require(_0xab25('0x4'));var _=require(_0xab25('0x5'));var rs=require('randomstring');var moment=require('moment');var db=require(_0xab25('0x6'))['db'];var authService=require(_0xab25('0x7'));var utils=require(_0xab25('0x8'));var client=jayson['client'][_0xab25('0x9')]({'port':0x232b});function localAuthenticate(_0x44cf67,_0x4c4691,_0x14f093,_0x12e5df){var _0x357b74,_0x550dee;return db['Setting'][_0xab25('0xa')]({'where':{'id':0x1},'attributes':[_0xab25('0xb'),_0xab25('0xc')],'raw':!![]})[_0xab25('0xd')](function(_0xf3c0e){_0x357b74=_0xf3c0e;return _0x44cf67[_0xab25('0xa')]({'attributes':['id',_0xab25('0xe'),_0xab25('0xf'),_0xab25('0x10'),'role',_0xab25('0x11'),_0xab25('0x12'),'blockedAt','loginAttempts'],'where':{'name':_0x4c4691,'role':{'$or':[_0xab25('0x13'),_0xab25('0x14'),_0xab25('0x15')]}}});})[_0xab25('0xd')](function(_0x8ee91){if(!_0x8ee91||_0x8ee91&&_0x8ee91[_0xab25('0xe')]!==_0x4c4691){throw new Error(_0xab25('0x16'));}else{_0x550dee=_0x8ee91;return _0x550dee;}})[_0xab25('0xd')](function(){_0x550dee[_0xab25('0x17')](_0x14f093,function(_0x4a3e48,_0x88256b){var _0x301952=_0x550dee[_0xab25('0x18')]+0x1;if(_0x4a3e48){return _0x12e5df(_0x4a3e48);}else if(!_0x88256b){if(_0x550dee['disabled']){return _0x12e5df(null,![],{'message':_0xab25('0x16')});}else if(_0x357b74[_0xab25('0xb')]>0x0){if(_0x550dee[_0xab25('0x12')]){if(_0x357b74[_0xab25('0xc')]>0x0){if(moment(_0x550dee[_0xab25('0x19')])['add'](_0x357b74['blockDuration'],'minutes')>moment()){return _0x12e5df(null,![],{'message':_0xab25('0x16')});}else{return utils['clearBlockUser'](_0x550dee,_0x301952,![],null)['then'](function(){return _0x12e5df(null,![],{'message':_0xab25('0x16')});});}}else{return _0x12e5df(null,![],{'message':_0xab25('0x16')});}}else{if(_0x301952>=_0x357b74[_0xab25('0xb')]){return utils[_0xab25('0x1a')](_0x550dee,0x0,!![],moment())[_0xab25('0xd')](function(){return _0x12e5df(null,![],{'message':_0xab25('0x16')});});}else{return utils['clearBlockUser'](_0x550dee,_0x301952,![],null)[_0xab25('0xd')](function(){return _0x12e5df(null,![],{'message':_0xab25('0x16')});});}}}else{return _0x12e5df(null,![],{'message':_0xab25('0x16')});}}else{if(_0x550dee[_0xab25('0x11')]){return _0x12e5df(null,![],{'message':_0xab25('0x16')});}else if(_0x357b74[_0xab25('0xb')]>0x0){if(_0x550dee[_0xab25('0x12')]){if(_0x357b74['blockDuration']>0x0){if(moment(_0x550dee[_0xab25('0x19')])[_0xab25('0x1b')](_0x357b74[_0xab25('0xc')],_0xab25('0x1c'))>moment()){return _0x12e5df(null,![],{'message':_0xab25('0x16')});}else{return utils['clearBlockUser'](_0x550dee,0x0,![],null)[_0xab25('0xd')](function(){return utils['getLicense'](_0x550dee);})['then'](function(){return _0x12e5df(null,_0x550dee);});}}else{return _0x12e5df(null,![],{'message':_0xab25('0x16')});}}else{return utils[_0xab25('0x1a')](_0x550dee,0x0,![],null)[_0xab25('0xd')](function(){return utils[_0xab25('0x1d')](_0x550dee);})[_0xab25('0xd')](function(){return _0x12e5df(null,_0x550dee);})[_0xab25('0x1e')](function(_0x34e966){return _0x12e5df(null,![],_0x34e966);});}}else{if(_0x550dee[_0xab25('0x12')]){return _0x12e5df(null,![],{'message':_0xab25('0x16')});}else{return utils[_0xab25('0x1d')](_0x550dee)[_0xab25('0xd')](function(){return _0x12e5df(null,_0x550dee);});}}}});})[_0xab25('0x1e')](function(_0x4187d7){return _0x12e5df(null,![],_0x4187d7);});}function sendServiceMail(_0x372fa5){return db[_0xab25('0x1f')][_0xab25('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0xab25('0x21')],'include':[{'model':db[_0xab25('0x22')],'as':_0xab25('0x23')}]})['then'](function(_0x40f098){if(!_0x40f098){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x2d55dc={'tls':{'rejectUnauthorized':![]}};if(_0x40f098[_0xab25('0x23')][_0xab25('0x24')]){_0x2d55dc[_0xab25('0x24')]=_0x40f098[_0xab25('0x23')][_0xab25('0x24')];}else{_0x2d55dc['host']=_0x40f098['Smtp'][_0xab25('0x25')];_0x2d55dc[_0xab25('0x26')]=_0x40f098['Smtp']['port'];_0x2d55dc[_0xab25('0x27')]=_0x40f098[_0xab25('0x23')]['secure'];}if(_0x40f098[_0xab25('0x23')][_0xab25('0x28')]){_0x2d55dc[_0xab25('0x29')]={'user':_0x40f098['Smtp'][_0xab25('0x14')],'pass':_0x40f098['Smtp'][_0xab25('0x2a')]};}var _0x30f6c4={'account':_0x2d55dc,'message':_[_0xab25('0x2b')]({'from':util['format'](_0xab25('0x2c'),_0x40f098[_0xab25('0xe')],_0x40f098['email']||_0x40f098['Smtp']['user'])},_0x372fa5)};return client[_0xab25('0x2d')](_0xab25('0x2e'),_0x30f6c4);})[_0xab25('0xd')](function(_0x415c08){if(_0x415c08['error']){throw new Error(util[_0xab25('0x2f')](_0xab25('0x30'),_0x415c08[_0xab25('0x31')][_0xab25('0x32')]||JSON[_0xab25('0x33')](_0x415c08['error'])));}return!![];});}function handleError(_0x24b0a3,_0x55210d,_0x509396){return _0x24b0a3[_0xab25('0x34')](_0x55210d||0x1f4)['send']({'message':_0x509396?_0x509396[_0xab25('0x32')]||_0x509396:''});}exports['login']=function(_0x92f555,_0xa1f796,_0x20a3d8){passport['authenticate'](_0xab25('0x35'),function(_0x583e75,_0x21f7de,_0xc22f42){var _0x566cf6=_0x583e75||_0xc22f42;if(_0x566cf6){return handleError(_0xa1f796,0x191,_0x566cf6);}if(!_0x21f7de){return handleError(_0xa1f796,0x194,{'message':_0xab25('0x36')});}else{var _0x42ff1d={'payload':{'id':_0x21f7de['id'],'role':_0x21f7de[_0xab25('0x37')]},'options':{'expiresIn':0x15180}};return authService[_0xab25('0x38')](_0x42ff1d)[_0xab25('0xd')](function(_0xd0d1ac){_0xa1f796['json']({'id':_0x21f7de['id'],'token':_0xd0d1ac,'statusCall':'','isAlreadyLogged':_0x21f7de[_0xab25('0x39')]});});}})(_0x92f555,_0xa1f796,_0x20a3d8);};exports[_0xab25('0x3a')]=function(_0x4a2e43,_0x2f3281,_0x582223){if(!_0x4a2e43[_0xab25('0x3b')][_0xab25('0x21')]){return handleError(_0x2f3281,0x1f4,{'message':_0xab25('0x3c')});}var _0x3ce4f0=rs[_0xab25('0x3d')]();_0x4a2e43[_0xab25('0x3b')][_0xab25('0x21')]=_0x4a2e43[_0xab25('0x3b')][_0xab25('0x21')]['trim']()[_0xab25('0x3e')]();var _0x414f3c;return db['Setting'][_0xab25('0xa')]({'where':{'id':0x1},'attributes':[_0xab25('0xb'),_0xab25('0xc')],'raw':!![]})[_0xab25('0xd')](function(_0x5bffe0){_0x414f3c=_0x5bffe0;return db[_0xab25('0x3f')][_0xab25('0x20')]({'where':{'email':_0x4a2e43[_0xab25('0x3b')][_0xab25('0x21')]}});})[_0xab25('0xd')](function(_0x19d405){if(!_0x19d405){throw new Error(_0xab25('0x40'));}if(_0x19d405[_0xab25('0x11')]){throw new Error(_0xab25('0x41'));}if(_0x19d405['blocked']){if(moment(_0x19d405['blockedAt'])[_0xab25('0x1b')](_0x414f3c[_0xab25('0xc')],_0xab25('0x1c'))>moment()){throw new Error(_0xab25('0x42'));}else{_0x19d405[_0xab25('0x12')]=![];_0x19d405[_0xab25('0x19')]=null;}}_0x19d405['resetPasswordToken']=_0x3ce4f0;_0x19d405[_0xab25('0x43')]=Date[_0xab25('0x44')]()+0x36ee80;return _0x19d405[_0xab25('0x45')]();})[_0xab25('0xd')](function(){return sendServiceMail({'to':_0x4a2e43['body']['email'],'subject':_0xab25('0x46'),'text':_0xab25('0x47')+_0xab25('0x48')+_0xab25('0x49')+_0x4a2e43[_0xab25('0x4a')][_0xab25('0x25')]+_0xab25('0x4b')+_0x3ce4f0+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xab25('0xd')](function(){_0x2f3281[_0xab25('0x34')](0xc8)['send']({'message':_0xab25('0x4c')});})[_0xab25('0x1e')](function(_0x20e11e){return handleError(_0x2f3281,0x1f4,_0x20e11e);});};exports['reset']=function(_0xdf2120,_0x80c66c,_0x2f5f8b){return db[_0xab25('0x3f')]['find']({'where':{'resetPasswordToken':_0xdf2120['params'][_0xab25('0x4d')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xab25('0xd')](function(_0xb329b2){if(!_0xb329b2){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xab25('0x4e')][_0xab25('0xa')]({'attributes':['id','securePassword','enforcePasswordHistory',_0xab25('0x4f')]})[_0xab25('0xd')](function(_0x443c92){if(_0x443c92['securePassword'])authService[_0xab25('0x50')](_0xdf2120[_0xab25('0x3b')][_0xab25('0xf')]);if(!_0x443c92['enforcePasswordHistory']||!_0xb329b2['previousPasswords'])return _0xb329b2;authService['validatePasswordHistory'](_0xdf2120[_0xab25('0x3b')][_0xab25('0xf')],_0xb329b2[_0xab25('0x51')],_0x443c92['passwordHistoryLimit']);return _0xb329b2;})[_0xab25('0xd')](function(){_0xb329b2[_0xab25('0xf')]=_0xdf2120['body'][_0xab25('0xf')];_0xb329b2[_0xab25('0x52')]=null;_0xb329b2[_0xab25('0x43')]=null;return _0xb329b2[_0xab25('0x45')]();});})[_0xab25('0xd')](function(){_0x80c66c['status'](0xc8)[_0xab25('0x53')]({'message':_0xab25('0x54')});})[_0xab25('0x1e')](function(_0x5c48eb){return handleError(_0x80c66c,0x1f4,_0x5c48eb);});};passport[_0xab25('0x55')](new LocalStrategy({'usernameField':_0xab25('0xe'),'passwordField':_0xab25('0xf')},function(_0x1797f0,_0x4402bf,_0x1cab29){return localAuthenticate(db['User'],_0x1797f0,_0x4402bf,_0x1cab29);})); \ No newline at end of file +var _0x8573=['moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','allowedLoginAttempts','blockDuration','then','password','role','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','name','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','Setting','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordHistory','previousPasswords','resetPasswordToken','Password\x20reset!','passport','passport-local','Strategy','jayson/promise','lodash'];(function(_0x45d1eb,_0x2c5883){var _0x153a8e=function(_0x339fe3){while(--_0x339fe3){_0x45d1eb['push'](_0x45d1eb['shift']());}};_0x153a8e(++_0x2c5883);}(_0x8573,0xf7));var _0x3857=function(_0x356f5a,_0x1fc418){_0x356f5a=_0x356f5a-0x0;var _0x5c215f=_0x8573[_0x356f5a];return _0x5c215f;};'use strict';var util=require('util');var passport=require(_0x3857('0x0'));var LocalStrategy=require(_0x3857('0x1'))[_0x3857('0x2')];var jayson=require(_0x3857('0x3'));var _=require(_0x3857('0x4'));var rs=require('randomstring');var moment=require(_0x3857('0x5'));var db=require(_0x3857('0x6'))['db'];var authService=require(_0x3857('0x7'));var utils=require(_0x3857('0x8'));var client=jayson[_0x3857('0x9')][_0x3857('0xa')]({'port':0x232b});function localAuthenticate(_0xe8a51e,_0x453bc9,_0x16c26d,_0xb0f1e0){var _0x1b5d82,_0x3b50e9;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x3857('0xb'),_0x3857('0xc')],'raw':!![]})[_0x3857('0xd')](function(_0xcd8731){_0x1b5d82=_0xcd8731;return _0xe8a51e['findOne']({'attributes':['id','name',_0x3857('0xe'),'salt',_0x3857('0xf'),'disabled',_0x3857('0x10'),_0x3857('0x11'),_0x3857('0x12')],'where':{'name':_0x453bc9,'role':{'$or':[_0x3857('0x13'),_0x3857('0x14'),_0x3857('0x15')]}}});})[_0x3857('0xd')](function(_0x29bfbc){if(!_0x29bfbc||_0x29bfbc&&_0x29bfbc['name']!==_0x453bc9){throw new Error(_0x3857('0x16'));}else{_0x3b50e9=_0x29bfbc;return _0x3b50e9;}})['then'](function(){_0x3b50e9[_0x3857('0x17')](_0x16c26d,function(_0x3d457f,_0x2253f0){var _0x21a394=_0x3b50e9[_0x3857('0x12')]+0x1;if(_0x3d457f){return _0xb0f1e0(_0x3d457f);}else if(!_0x2253f0){if(_0x3b50e9[_0x3857('0x18')]){return _0xb0f1e0(null,![],{'message':_0x3857('0x16')});}else if(_0x1b5d82[_0x3857('0xb')]>0x0){if(_0x3b50e9['blocked']){if(_0x1b5d82['blockDuration']>0x0){if(moment(_0x3b50e9['blockedAt'])[_0x3857('0x19')](_0x1b5d82[_0x3857('0xc')],_0x3857('0x1a'))>moment()){return _0xb0f1e0(null,![],{'message':_0x3857('0x16')});}else{return utils[_0x3857('0x1b')](_0x3b50e9,_0x21a394,![],null)[_0x3857('0xd')](function(){return _0xb0f1e0(null,![],{'message':_0x3857('0x16')});});}}else{return _0xb0f1e0(null,![],{'message':_0x3857('0x16')});}}else{if(_0x21a394>=_0x1b5d82['allowedLoginAttempts']){return utils[_0x3857('0x1b')](_0x3b50e9,0x0,!![],moment())[_0x3857('0xd')](function(){return _0xb0f1e0(null,![],{'message':_0x3857('0x16')});});}else{return utils[_0x3857('0x1b')](_0x3b50e9,_0x21a394,![],null)['then'](function(){return _0xb0f1e0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0xb0f1e0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x3b50e9[_0x3857('0x18')]){return _0xb0f1e0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x1b5d82[_0x3857('0xb')]>0x0){if(_0x3b50e9['blocked']){if(_0x1b5d82[_0x3857('0xc')]>0x0){if(moment(_0x3b50e9['blockedAt'])[_0x3857('0x19')](_0x1b5d82[_0x3857('0xc')],'minutes')>moment()){return _0xb0f1e0(null,![],{'message':_0x3857('0x16')});}else{return utils[_0x3857('0x1b')](_0x3b50e9,0x0,![],null)[_0x3857('0xd')](function(){return utils[_0x3857('0x1c')](_0x3b50e9);})['then'](function(){return _0xb0f1e0(null,_0x3b50e9);});}}else{return _0xb0f1e0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x3857('0x1b')](_0x3b50e9,0x0,![],null)[_0x3857('0xd')](function(){return utils[_0x3857('0x1c')](_0x3b50e9);})[_0x3857('0xd')](function(){return _0xb0f1e0(null,_0x3b50e9);})['catch'](function(_0x194d45){return _0xb0f1e0(null,![],_0x194d45);});}}else{if(_0x3b50e9[_0x3857('0x10')]){return _0xb0f1e0(null,![],{'message':_0x3857('0x16')});}else{return utils[_0x3857('0x1c')](_0x3b50e9)[_0x3857('0xd')](function(){return _0xb0f1e0(null,_0x3b50e9);});}}}});})[_0x3857('0x1d')](function(_0x167f24){return _0xb0f1e0(null,![],_0x167f24);});}function sendServiceMail(_0x4f7d5f){return db[_0x3857('0x1e')][_0x3857('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x3857('0x20'),_0x3857('0x21')],'include':[{'model':db['MailServerOut'],'as':_0x3857('0x22')}]})['then'](function(_0x4451a3){if(!_0x4451a3){throw new Error(_0x3857('0x23'));}var _0xb13444={'tls':{'rejectUnauthorized':![]}};if(_0x4451a3['Smtp'][_0x3857('0x24')]){_0xb13444[_0x3857('0x24')]=_0x4451a3[_0x3857('0x22')][_0x3857('0x24')];}else{_0xb13444[_0x3857('0x25')]=_0x4451a3[_0x3857('0x22')][_0x3857('0x25')];_0xb13444[_0x3857('0x26')]=_0x4451a3['Smtp']['port'];_0xb13444[_0x3857('0x27')]=_0x4451a3[_0x3857('0x22')][_0x3857('0x27')];}if(_0x4451a3[_0x3857('0x22')][_0x3857('0x28')]){_0xb13444[_0x3857('0x29')]={'user':_0x4451a3['Smtp'][_0x3857('0x14')],'pass':_0x4451a3[_0x3857('0x22')][_0x3857('0x2a')]};}var _0xa64186={'account':_0xb13444,'message':_['merge']({'from':util[_0x3857('0x2b')](_0x3857('0x2c'),_0x4451a3[_0x3857('0x20')],_0x4451a3[_0x3857('0x21')]||_0x4451a3[_0x3857('0x22')]['user'])},_0x4f7d5f)};return client[_0x3857('0x2d')]('SendMail',_0xa64186);})[_0x3857('0xd')](function(_0x74b75e){if(_0x74b75e[_0x3857('0x2e')]){throw new Error(util[_0x3857('0x2b')](_0x3857('0x2f'),_0x74b75e[_0x3857('0x2e')]['message']||JSON[_0x3857('0x30')](_0x74b75e[_0x3857('0x2e')])));}return!![];});}function handleError(_0x39a9a7,_0x5863de,_0x3ddad9){return _0x39a9a7[_0x3857('0x31')](_0x5863de||0x1f4)[_0x3857('0x32')]({'message':_0x3ddad9?_0x3ddad9[_0x3857('0x33')]||_0x3ddad9:''});}exports[_0x3857('0x34')]=function(_0x319db4,_0x395c59,_0x4034e4){passport[_0x3857('0x17')](_0x3857('0x35'),function(_0x1acf8a,_0xccb1ad,_0x754270){var _0x5c1f7f=_0x1acf8a||_0x754270;if(_0x5c1f7f){return handleError(_0x395c59,0x191,_0x5c1f7f);}if(!_0xccb1ad){return handleError(_0x395c59,0x194,{'message':_0x3857('0x36')});}else{var _0x173cb2={'payload':{'id':_0xccb1ad['id'],'role':_0xccb1ad[_0x3857('0xf')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x173cb2)[_0x3857('0xd')](function(_0x47709a){_0x395c59['json']({'id':_0xccb1ad['id'],'token':_0x47709a,'statusCall':'','isAlreadyLogged':_0xccb1ad[_0x3857('0x37')]});});}})(_0x319db4,_0x395c59,_0x4034e4);};exports[_0x3857('0x38')]=function(_0xa517c9,_0xd7ce38,_0x1d6670){if(!_0xa517c9['body'][_0x3857('0x21')]){return handleError(_0xd7ce38,0x1f4,{'message':_0x3857('0x39')});}var _0x4ca045=rs[_0x3857('0x3a')]();_0xa517c9[_0x3857('0x3b')][_0x3857('0x21')]=_0xa517c9[_0x3857('0x3b')][_0x3857('0x21')][_0x3857('0x3c')]()[_0x3857('0x3d')]();var _0x3cda0d;return db[_0x3857('0x3e')]['findOne']({'where':{'id':0x1},'attributes':[_0x3857('0xb'),_0x3857('0xc')],'raw':!![]})['then'](function(_0xfae216){_0x3cda0d=_0xfae216;return db[_0x3857('0x3f')][_0x3857('0x1f')]({'where':{'email':_0xa517c9[_0x3857('0x3b')][_0x3857('0x21')]}});})[_0x3857('0xd')](function(_0x6c65ab){if(!_0x6c65ab){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x6c65ab[_0x3857('0x18')]){throw new Error(_0x3857('0x40'));}if(_0x6c65ab[_0x3857('0x10')]){if(moment(_0x6c65ab[_0x3857('0x11')])[_0x3857('0x19')](_0x3cda0d[_0x3857('0xc')],_0x3857('0x1a'))>moment()){throw new Error(_0x3857('0x41'));}else{_0x6c65ab['blocked']=![];_0x6c65ab[_0x3857('0x11')]=null;}}_0x6c65ab['resetPasswordToken']=_0x4ca045;_0x6c65ab[_0x3857('0x42')]=Date[_0x3857('0x43')]()+0x36ee80;return _0x6c65ab[_0x3857('0x44')]();})['then'](function(){return sendServiceMail({'to':_0xa517c9['body'][_0x3857('0x21')],'subject':_0x3857('0x45'),'text':_0x3857('0x46')+_0x3857('0x47')+'http://'+_0xa517c9[_0x3857('0x48')][_0x3857('0x25')]+_0x3857('0x49')+_0x4ca045+'\x0a\x0a'+_0x3857('0x4a')});})[_0x3857('0xd')](function(){_0xd7ce38['status'](0xc8)[_0x3857('0x32')]({'message':_0x3857('0x4b')});})['catch'](function(_0x15122a){return handleError(_0xd7ce38,0x1f4,_0x15122a);});};exports[_0x3857('0x4c')]=function(_0xd7b478,_0x3ff4e7,_0x46fe3d){return db[_0x3857('0x3f')]['find']({'where':{'resetPasswordToken':_0xd7b478['params']['token'],'resetPasswordExpires':{'$gt':Date[_0x3857('0x43')]()}}})[_0x3857('0xd')](function(_0x299d96){if(!_0x299d96){throw new Error(_0x3857('0x4d'));}return db[_0x3857('0x3e')]['findOne']({'attributes':['id',_0x3857('0x4e'),_0x3857('0x4f'),'passwordHistoryLimit']})['then'](function(_0x54e8a3){if(_0x54e8a3['securePassword'])authService['validatePasswordPattern'](_0xd7b478[_0x3857('0x3b')]['password']);if(!_0x54e8a3[_0x3857('0x4f')]||!_0x299d96['previousPasswords'])return _0x299d96;authService[_0x3857('0x50')](_0xd7b478['body']['password'],_0x299d96[_0x3857('0x51')],_0x54e8a3['passwordHistoryLimit']);return _0x299d96;})[_0x3857('0xd')](function(){_0x299d96[_0x3857('0xe')]=_0xd7b478[_0x3857('0x3b')]['password'];_0x299d96[_0x3857('0x52')]=null;_0x299d96[_0x3857('0x42')]=null;return _0x299d96[_0x3857('0x44')]();});})['then'](function(){_0x3ff4e7['status'](0xc8)['send']({'message':_0x3857('0x53')});})[_0x3857('0x1d')](function(_0x3417d0){return handleError(_0x3ff4e7,0x1f4,_0x3417d0);});};passport['use'](new LocalStrategy({'usernameField':_0x3857('0x20'),'passwordField':_0x3857('0xe')},function(_0x3b2ba3,_0x57b318,_0x37a020){return localAuthenticate(db[_0x3857('0x3f')],_0x3b2ba3,_0x57b318,_0x37a020);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index ff0b3a0..fef19b4 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 _0x1af3=['Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','exports','express'];(function(_0x1d6379,_0x27c82a){var _0x2b0ebe=function(_0x529b30){while(--_0x529b30){_0x1d6379['push'](_0x1d6379['shift']());}};_0x2b0ebe(++_0x27c82a);}(_0x1af3,0x1ca));var _0x31af=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x1af3[_0x47b58b];return _0x46bebe;};'use strict';var express=require(_0x31af('0x0'));var router=express[_0x31af('0x1')]();var controller=require(_0x31af('0x2'));router[_0x31af('0x3')]('/',controller[_0x31af('0x4')]);router[_0x31af('0x3')](_0x31af('0x5'),controller[_0x31af('0x6')]);router[_0x31af('0x3')](_0x31af('0x7'),controller['reset']);module[_0x31af('0x8')]=router; \ No newline at end of file +var _0xbbfe=['login','/forgot','express','./authLocal.controller','post'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0xbbfe,0xfc));var _0xebbf=function(_0x26b075,_0x1d1474){_0x26b075=_0x26b075-0x0;var _0x5b4899=_0xbbfe[_0x26b075];return _0x5b4899;};'use strict';var express=require(_0xebbf('0x0'));var router=express['Router']();var controller=require(_0xebbf('0x1'));router[_0xebbf('0x2')]('/',controller[_0xebbf('0x3')]);router[_0xebbf('0x2')](_0xebbf('0x4'),controller['forgot']);router[_0xebbf('0x2')]('/reset/:token',controller['reset']);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index eb288fb..60be1b7 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 _0x687a=['BOOLEAN','INTEGER','sequelize','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x687a,0x1b2));var _0xa687=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x687a[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0xa687('0x0'));module['exports']={'name':{'type':Sequelize[_0xa687('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa687('0x1')]},'status':{'type':Sequelize[_0xa687('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xa687('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xc0c9=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x4ecefd,_0x270199){var _0x5c5978=function(_0x1f0d0b){while(--_0x1f0d0b){_0x4ecefd['push'](_0x4ecefd['shift']());}};_0x5c5978(++_0x270199);}(_0xc0c9,0x119));var _0x9c0c=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xc0c9[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x9c0c('0x0'));module[_0x9c0c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x9c0c('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x9c0c('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x9c0c('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 439ab31..aa44947 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 _0x647a=['then','destroy','sendStatus','name','index','map','Automation','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','filtears','include','find','create','body','params','addConditions','ids','omit','findOne','getConditions','addActions','Action','getActions','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','reject','save','update'];(function(_0x2e7adc,_0x429ee4){var _0x2f1827=function(_0x2a3a71){while(--_0x2a3a71){_0x2e7adc['push'](_0x2e7adc['shift']());}};_0x2f1827(++_0x429ee4);}(_0x647a,0x121));var _0xa647=function(_0x2b7868,_0x3c7807){_0x2b7868=_0x2b7868-0x0;var _0x1d66f3=_0x647a[_0x2b7868];return _0x1d66f3;};'use strict';var pdf=require(_0xa647('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa647('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa647('0x2'));var rp=require(_0xa647('0x3'));var moment=require(_0xa647('0x4'));var BPromise=require(_0xa647('0x5'));var Mustache=require(_0xa647('0x6'));var util=require(_0xa647('0x7'));var path=require('path');var sox=require(_0xa647('0x8'));var csv=require(_0xa647('0x9'));var ejs=require(_0xa647('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa647('0xb'));var jsforce=require(_0xa647('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa647('0x9'));var querystring=require(_0xa647('0xd'));var Papa=require(_0xa647('0xe'));var Redis=require(_0xa647('0xf'));var authService=require(_0xa647('0x10'));var qs=require(_0xa647('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa647('0x12'));var logger=require(_0xa647('0x13'))(_0xa647('0x14'));var utils=require(_0xa647('0x15'));var config=require(_0xa647('0x16'));var licenseUtil=require(_0xa647('0x17'));var db=require(_0xa647('0x18'))['db'];function respondWithStatusCode(_0x587c88,_0x392ccb){_0x392ccb=_0x392ccb||0xcc;return function(_0x2d0ab8){if(_0x2d0ab8){return _0x587c88['sendStatus'](_0x392ccb);}return _0x587c88[_0xa647('0x19')](_0x392ccb)[_0xa647('0x1a')]();};}function respondWithResult(_0x7ae7a9,_0x50b3bb){_0x50b3bb=_0x50b3bb||0xc8;return function(_0x499ff5){if(_0x499ff5){return _0x7ae7a9['status'](_0x50b3bb)[_0xa647('0x1b')](_0x499ff5);}};}function respondWithFilteredResult(_0x30297b,_0x53d76d){return function(_0x4ff8ab){if(_0x4ff8ab){var _0x3c7a2=_0x4ff8ab[_0xa647('0x1c')],_0xf924fd=_0x53d76d[_0xa647('0x1d')],_0x4397ab=_0x53d76d[_0xa647('0x1d')]+_0x53d76d[_0xa647('0x1e')],_0x1fe2d8;if(_0x4397ab>=_0x3c7a2){_0x4397ab=_0x3c7a2;_0x1fe2d8=0xc8;}else{_0x1fe2d8=0xce;}_0x30297b[_0xa647('0x19')](_0x1fe2d8);return _0x30297b[_0xa647('0x1f')]('Content-Range',_0xf924fd+'-'+_0x4397ab+'/'+_0x3c7a2)[_0xa647('0x1b')](_0x4ff8ab);}return null;};}function patchUpdates(_0xc4721a){return function(_0x13e42c){try{jsonpatch['apply'](_0x13e42c,_0xc4721a,!![]);}catch(_0x562f13){return BPromise[_0xa647('0x20')](_0x562f13);}return _0x13e42c[_0xa647('0x21')]();};}function saveUpdates(_0x21dea7,_0x510bb0){return function(_0x21066b){if(_0x21066b){return _0x21066b[_0xa647('0x22')](_0x21dea7)[_0xa647('0x23')](function(_0x1fbc7a){return _0x1fbc7a;});}return null;};}function removeEntity(_0x1d9d35,_0x5c7025){return function(_0x2530a9){if(_0x2530a9){return _0x2530a9[_0xa647('0x24')]()[_0xa647('0x23')](function(){_0x1d9d35[_0xa647('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f57e1,_0x186104){return function(_0x549133){if(!_0x549133){_0x3f57e1[_0xa647('0x25')](0x194);}return _0x549133;};}function handleError(_0x430592,_0x4e86ba){_0x4e86ba=_0x4e86ba||0x1f4;return function(_0x2ced6a){logger['error'](_0x2ced6a['stack']);if(_0x2ced6a[_0xa647('0x26')]){delete _0x2ced6a[_0xa647('0x26')];}_0x430592['status'](_0x4e86ba)['send'](_0x2ced6a);};}exports[_0xa647('0x27')]=function(_0x3dd06c,_0x993cce){var _0x1af5b0={},_0x5530d0={},_0x4d7c50={'count':0x0,'rows':[]};var _0x3a676d=_[_0xa647('0x28')](db[_0xa647('0x29')][_0xa647('0x2a')],function(_0x19f3ef){return{'name':_0x19f3ef['fieldName'],'type':_0x19f3ef[_0xa647('0x2b')][_0xa647('0x2c')]};});_0x5530d0[_0xa647('0x2d')]=_[_0xa647('0x28')](_0x3a676d,_0xa647('0x26'));_0x5530d0[_0xa647('0x2e')]=_[_0xa647('0x2f')](_0x3dd06c[_0xa647('0x2e')]);_0x5530d0[_0xa647('0x30')]=_[_0xa647('0x31')](_0x5530d0[_0xa647('0x2d')],_0x5530d0['query']);_0x1af5b0[_0xa647('0x32')]=_[_0xa647('0x31')](_0x5530d0['model'],qs[_0xa647('0x33')](_0x3dd06c[_0xa647('0x2e')][_0xa647('0x33')]));_0x1af5b0[_0xa647('0x32')]=_0x1af5b0[_0xa647('0x32')][_0xa647('0x34')]?_0x1af5b0[_0xa647('0x32')]:_0x5530d0[_0xa647('0x2d')];if(!_0x3dd06c['query'][_0xa647('0x35')](_0xa647('0x36'))){_0x1af5b0[_0xa647('0x1e')]=qs[_0xa647('0x1e')](_0x3dd06c[_0xa647('0x2e')][_0xa647('0x1e')]);_0x1af5b0['offset']=qs['offset'](_0x3dd06c['query']['offset']);}_0x1af5b0[_0xa647('0x37')]=qs[_0xa647('0x38')](_0x3dd06c['query']['sort']);_0x1af5b0[_0xa647('0x39')]=qs['filters'](_[_0xa647('0x3a')](_0x3dd06c[_0xa647('0x2e')],_0x5530d0['filters']),_0x3a676d);if(_0x3dd06c[_0xa647('0x2e')][_0xa647('0x3b')]){_0x1af5b0[_0xa647('0x39')]=_[_0xa647('0x3c')](_0x1af5b0[_0xa647('0x39')],{'$or':_['map'](_0x3a676d,function(_0x599fda){if(_0x599fda[_0xa647('0x2b')]!==_0xa647('0x3d')){var _0x5e32bb={};_0x5e32bb[_0x599fda['name']]={'$like':'%'+_0x3dd06c[_0xa647('0x2e')][_0xa647('0x3b')]+'%'};return _0x5e32bb;}})});}_0x1af5b0=_[_0xa647('0x3c')]({},_0x1af5b0,_0x3dd06c[_0xa647('0x3e')]);var _0x53d5e7={'where':_0x1af5b0[_0xa647('0x39')]};return db[_0xa647('0x29')]['count'](_0x53d5e7)[_0xa647('0x23')](function(_0x340e6c){_0x4d7c50[_0xa647('0x1c')]=_0x340e6c;if(_0x3dd06c['query'][_0xa647('0x3f')]){_0x1af5b0['include']=[{'all':!![]}];}return db['Automation']['findAll'](_0x1af5b0);})['then'](function(_0xdf8a55){_0x4d7c50[_0xa647('0x40')]=_0xdf8a55;return _0x4d7c50;})['then'](respondWithFilteredResult(_0x993cce,_0x1af5b0))[_0xa647('0x41')](handleError(_0x993cce,null));};exports[_0xa647('0x42')]=function(_0x5b6790,_0x252f90){var _0x335211={'raw':![],'where':{'id':_0x5b6790['params']['id']}},_0x74fa1={};_0x74fa1[_0xa647('0x2d')]=_[_0xa647('0x2f')](db[_0xa647('0x29')]['rawAttributes']);_0x74fa1[_0xa647('0x2e')]=_[_0xa647('0x2f')](_0x5b6790[_0xa647('0x2e')]);_0x74fa1[_0xa647('0x43')]=_[_0xa647('0x31')](_0x74fa1[_0xa647('0x2d')],_0x74fa1[_0xa647('0x2e')]);_0x335211[_0xa647('0x32')]=_[_0xa647('0x31')](_0x74fa1[_0xa647('0x2d')],qs[_0xa647('0x33')](_0x5b6790[_0xa647('0x2e')][_0xa647('0x33')]));_0x335211[_0xa647('0x32')]=_0x335211[_0xa647('0x32')][_0xa647('0x34')]?_0x335211[_0xa647('0x32')]:_0x74fa1[_0xa647('0x2d')];if(_0x5b6790[_0xa647('0x2e')][_0xa647('0x3f')]){_0x335211[_0xa647('0x44')]=[{'all':!![]}];}_0x335211=_['merge']({},_0x335211,_0x5b6790[_0xa647('0x3e')]);return db['Automation'][_0xa647('0x45')](_0x335211)[_0xa647('0x23')](handleEntityNotFound(_0x252f90,null))[_0xa647('0x23')](respondWithResult(_0x252f90,null))[_0xa647('0x41')](handleError(_0x252f90,null));};exports[_0xa647('0x46')]=function(_0x5bd618,_0x510286){return db['Automation'][_0xa647('0x46')](_0x5bd618['body'],{})['then'](respondWithResult(_0x510286,0xc9))[_0xa647('0x41')](handleError(_0x510286,null));};exports[_0xa647('0x22')]=function(_0x31c290,_0x5551cd){if(_0x31c290[_0xa647('0x47')]['id']){delete _0x31c290[_0xa647('0x47')]['id'];}return db[_0xa647('0x29')]['find']({'where':{'id':_0x31c290[_0xa647('0x48')]['id']}})[_0xa647('0x23')](handleEntityNotFound(_0x5551cd,null))['then'](saveUpdates(_0x31c290[_0xa647('0x47')],null))[_0xa647('0x23')](respondWithResult(_0x5551cd,null))[_0xa647('0x41')](handleError(_0x5551cd,null));};exports[_0xa647('0x24')]=function(_0x5b7a35,_0x31a490){return db[_0xa647('0x29')]['find']({'where':{'id':_0x5b7a35['params']['id']}})[_0xa647('0x23')](handleEntityNotFound(_0x31a490,null))[_0xa647('0x23')](removeEntity(_0x31a490,null))[_0xa647('0x41')](handleError(_0x31a490,null));};exports[_0xa647('0x49')]=function(_0x5bcf04,_0x36b1b8,_0x4950f1){return db['Condition'][_0xa647('0x45')]({'where':{'id':_0x5bcf04['params']['id']}})[_0xa647('0x23')](handleEntityNotFound(_0x36b1b8,null))[_0xa647('0x23')](function(_0x44009a){if(_0x44009a){return _0x44009a[_0xa647('0x49')](_0x5bcf04[_0xa647('0x47')][_0xa647('0x4a')],_[_0xa647('0x4b')](_0x5bcf04[_0xa647('0x47')],[_0xa647('0x4a'),'id'])||{});}})[_0xa647('0x23')](respondWithResult(_0x36b1b8,null))[_0xa647('0x41')](handleError(_0x36b1b8,null));};exports['getConditions']=function(_0xea7749,_0x4dd806,_0x3bac14){var _0xf1195d={};var _0x2e7ce3={};var _0x417fe3;var _0x27b66a;return db[_0xa647('0x29')][_0xa647('0x4c')]({'where':{'id':_0xea7749[_0xa647('0x48')]['id']}})['then'](handleEntityNotFound(_0x4dd806,null))['then'](function(_0x3f3c22){if(_0x3f3c22){_0x417fe3=_0x3f3c22;_0x2e7ce3[_0xa647('0x2d')]=_[_0xa647('0x2f')](db['Condition'][_0xa647('0x2a')]);_0x2e7ce3[_0xa647('0x2e')]=_[_0xa647('0x2f')](_0xea7749[_0xa647('0x2e')]);_0x2e7ce3['filters']=_[_0xa647('0x31')](_0x2e7ce3[_0xa647('0x2d')],_0x2e7ce3[_0xa647('0x2e')]);_0xf1195d[_0xa647('0x32')]=_[_0xa647('0x31')](_0x2e7ce3[_0xa647('0x2d')],qs[_0xa647('0x33')](_0xea7749['query'][_0xa647('0x33')]));_0xf1195d[_0xa647('0x32')]=_0xf1195d[_0xa647('0x32')][_0xa647('0x34')]?_0xf1195d[_0xa647('0x32')]:_0x2e7ce3[_0xa647('0x2d')];_0xf1195d[_0xa647('0x37')]=qs['sort'](_0xea7749['query'][_0xa647('0x38')]);_0xf1195d[_0xa647('0x39')]=qs['filters'](_[_0xa647('0x3a')](_0xea7749['query'],_0x2e7ce3[_0xa647('0x30')]));if(_0xea7749[_0xa647('0x2e')][_0xa647('0x3b')]){_0xf1195d[_0xa647('0x39')]=_[_0xa647('0x3c')](_0xf1195d[_0xa647('0x39')],{'$or':_[_0xa647('0x28')](_0xf1195d[_0xa647('0x32')],function(_0x1258fc){var _0x1cba63={};_0x1cba63[_0x1258fc]={'$like':'%'+_0xea7749[_0xa647('0x2e')][_0xa647('0x3b')]+'%'};return _0x1cba63;})});}_0xf1195d=_[_0xa647('0x3c')]({},_0xf1195d,_0xea7749[_0xa647('0x3e')]);return _0x417fe3[_0xa647('0x4d')](_0xf1195d);}})[_0xa647('0x23')](function(_0x568c4d){if(_0x568c4d){_0x27b66a=_0x568c4d[_0xa647('0x34')];if(!_0xea7749['query'][_0xa647('0x35')](_0xa647('0x36'))){_0xf1195d[_0xa647('0x1e')]=qs[_0xa647('0x1e')](_0xea7749['query'][_0xa647('0x1e')]);_0xf1195d[_0xa647('0x1d')]=qs['offset'](_0xea7749[_0xa647('0x2e')][_0xa647('0x1d')]);}return _0x417fe3[_0xa647('0x4d')](_0xf1195d);}})[_0xa647('0x23')](function(_0x5a892d){if(_0x5a892d){return _0x5a892d?{'count':_0x27b66a,'rows':_0x5a892d}:null;}})['then'](respondWithResult(_0x4dd806,null))[_0xa647('0x41')](handleError(_0x4dd806,null));};exports[_0xa647('0x4e')]=function(_0x255f3b,_0xf80af8,_0x3530a6){return db[_0xa647('0x4f')][_0xa647('0x45')]({'where':{'id':_0x255f3b[_0xa647('0x48')]['id']}})[_0xa647('0x23')](handleEntityNotFound(_0xf80af8,null))[_0xa647('0x23')](function(_0x1f096e){if(_0x1f096e){return _0x1f096e['addActions'](_0x255f3b[_0xa647('0x47')]['ids'],_['omit'](_0x255f3b[_0xa647('0x47')],[_0xa647('0x4a'),'id'])||{});}})[_0xa647('0x23')](respondWithResult(_0xf80af8,null))[_0xa647('0x41')](handleError(_0xf80af8,null));};exports[_0xa647('0x50')]=function(_0x1caddc,_0xcdae08,_0x452dbe){var _0x5eee49={};var _0x254abf={};var _0x367951;var _0x335853;return db[_0xa647('0x29')][_0xa647('0x4c')]({'where':{'id':_0x1caddc[_0xa647('0x48')]['id']}})[_0xa647('0x23')](handleEntityNotFound(_0xcdae08,null))[_0xa647('0x23')](function(_0x2d51ac){if(_0x2d51ac){_0x367951=_0x2d51ac;_0x254abf[_0xa647('0x2d')]=_['keys'](db[_0xa647('0x4f')][_0xa647('0x2a')]);_0x254abf['query']=_[_0xa647('0x2f')](_0x1caddc[_0xa647('0x2e')]);_0x254abf[_0xa647('0x30')]=_[_0xa647('0x31')](_0x254abf[_0xa647('0x2d')],_0x254abf[_0xa647('0x2e')]);_0x5eee49[_0xa647('0x32')]=_[_0xa647('0x31')](_0x254abf[_0xa647('0x2d')],qs[_0xa647('0x33')](_0x1caddc[_0xa647('0x2e')][_0xa647('0x33')]));_0x5eee49['attributes']=_0x5eee49[_0xa647('0x32')]['length']?_0x5eee49[_0xa647('0x32')]:_0x254abf[_0xa647('0x2d')];_0x5eee49[_0xa647('0x37')]=qs[_0xa647('0x38')](_0x1caddc[_0xa647('0x2e')][_0xa647('0x38')]);_0x5eee49[_0xa647('0x39')]=qs['filters'](_[_0xa647('0x3a')](_0x1caddc[_0xa647('0x2e')],_0x254abf[_0xa647('0x30')]));if(_0x1caddc[_0xa647('0x2e')][_0xa647('0x3b')]){_0x5eee49[_0xa647('0x39')]=_[_0xa647('0x3c')](_0x5eee49[_0xa647('0x39')],{'$or':_['map'](_0x5eee49['attributes'],function(_0x5c88d0){var _0x222a00={};_0x222a00[_0x5c88d0]={'$like':'%'+_0x1caddc[_0xa647('0x2e')]['filter']+'%'};return _0x222a00;})});}_0x5eee49=_[_0xa647('0x3c')]({},_0x5eee49,_0x1caddc[_0xa647('0x3e')]);return _0x367951[_0xa647('0x50')](_0x5eee49);}})[_0xa647('0x23')](function(_0x3e2102){if(_0x3e2102){_0x335853=_0x3e2102[_0xa647('0x34')];if(!_0x1caddc[_0xa647('0x2e')][_0xa647('0x35')](_0xa647('0x36'))){_0x5eee49[_0xa647('0x1e')]=qs[_0xa647('0x1e')](_0x1caddc[_0xa647('0x2e')][_0xa647('0x1e')]);_0x5eee49[_0xa647('0x1d')]=qs[_0xa647('0x1d')](_0x1caddc[_0xa647('0x2e')]['offset']);}return _0x367951[_0xa647('0x50')](_0x5eee49);}})[_0xa647('0x23')](function(_0x3e3b74){if(_0x3e3b74){return _0x3e3b74?{'count':_0x335853,'rows':_0x3e3b74}:null;}})[_0xa647('0x23')](respondWithResult(_0xcdae08,null))[_0xa647('0x41')](handleError(_0xcdae08,null));}; \ No newline at end of file +var _0x18bd=['Automation','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','length','nolimit','sort','where','filters','filter','type','merge','includeAll','include','findAll','rows','show','params','filtears','fields','catch','create','body','update','find','addConditions','ids','omit','getConditions','findOne','Condition','order','options','hasOwnProperty','addActions','Action','pick','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','destroy','then','error','stack','name','send','map'];(function(_0x105ee6,_0x51187b){var _0x4b36b5=function(_0x467d25){while(--_0x467d25){_0x105ee6['push'](_0x105ee6['shift']());}};_0x4b36b5(++_0x51187b);}(_0x18bd,0x85));var _0xd18b=function(_0x2cc4b6,_0x4862fe){_0x2cc4b6=_0x2cc4b6-0x0;var _0x247a8c=_0x18bd[_0x2cc4b6];return _0x247a8c;};'use strict';var pdf=require(_0xd18b('0x0'));var emlformat=require(_0xd18b('0x1'));var rimraf=require(_0xd18b('0x2'));var zipdir=require(_0xd18b('0x3'));var jsonpatch=require(_0xd18b('0x4'));var rp=require(_0xd18b('0x5'));var moment=require(_0xd18b('0x6'));var BPromise=require(_0xd18b('0x7'));var Mustache=require(_0xd18b('0x8'));var util=require(_0xd18b('0x9'));var path=require(_0xd18b('0xa'));var sox=require(_0xd18b('0xb'));var csv=require('to-csv');var ejs=require(_0xd18b('0xc'));var fs=require('fs');var _=require(_0xd18b('0xd'));var squel=require(_0xd18b('0xe'));var crypto=require(_0xd18b('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd18b('0x10'));var toCsv=require(_0xd18b('0x11'));var querystring=require(_0xd18b('0x12'));var Papa=require(_0xd18b('0x13'));var Redis=require(_0xd18b('0x14'));var authService=require(_0xd18b('0x15'));var qs=require(_0xd18b('0x16'));var as=require(_0xd18b('0x17'));var hardwareService=require(_0xd18b('0x18'));var logger=require('../../config/logger')(_0xd18b('0x19'));var utils=require(_0xd18b('0x1a'));var config=require(_0xd18b('0x1b'));var licenseUtil=require(_0xd18b('0x1c'));var db=require(_0xd18b('0x1d'))['db'];function respondWithStatusCode(_0x2c8cd1,_0x2583c6){_0x2583c6=_0x2583c6||0xcc;return function(_0x57e2e8){if(_0x57e2e8){return _0x2c8cd1[_0xd18b('0x1e')](_0x2583c6);}return _0x2c8cd1['status'](_0x2583c6)[_0xd18b('0x1f')]();};}function respondWithResult(_0x2c49fe,_0x30874f){_0x30874f=_0x30874f||0xc8;return function(_0x1c5dbd){if(_0x1c5dbd){return _0x2c49fe[_0xd18b('0x20')](_0x30874f)['json'](_0x1c5dbd);}};}function respondWithFilteredResult(_0xc3b215,_0x161f65){return function(_0x960071){if(_0x960071){var _0xbd6956=_0x960071[_0xd18b('0x21')],_0x77753d=_0x161f65[_0xd18b('0x22')],_0x4dcdc2=_0x161f65[_0xd18b('0x22')]+_0x161f65[_0xd18b('0x23')],_0x35a892;if(_0x4dcdc2>=_0xbd6956){_0x4dcdc2=_0xbd6956;_0x35a892=0xc8;}else{_0x35a892=0xce;}_0xc3b215[_0xd18b('0x20')](_0x35a892);return _0xc3b215[_0xd18b('0x24')](_0xd18b('0x25'),_0x77753d+'-'+_0x4dcdc2+'/'+_0xbd6956)[_0xd18b('0x26')](_0x960071);}return null;};}function patchUpdates(_0x13df96){return function(_0xe58ce3){try{jsonpatch[_0xd18b('0x27')](_0xe58ce3,_0x13df96,!![]);}catch(_0x50db7e){return BPromise['reject'](_0x50db7e);}return _0xe58ce3['save']();};}function saveUpdates(_0x42e00f,_0x343695){return function(_0x1202db){if(_0x1202db){return _0x1202db['update'](_0x42e00f)['then'](function(_0x4d3663){return _0x4d3663;});}return null;};}function removeEntity(_0x4370ef,_0x3e70b2){return function(_0x3c393a){if(_0x3c393a){return _0x3c393a[_0xd18b('0x28')]()[_0xd18b('0x29')](function(){_0x4370ef['status'](0xcc)[_0xd18b('0x1f')]();});}};}function handleEntityNotFound(_0x3d6efc,_0x29809c){return function(_0x4dae14){if(!_0x4dae14){_0x3d6efc[_0xd18b('0x1e')](0x194);}return _0x4dae14;};}function handleError(_0x4ceabb,_0x2d5604){_0x2d5604=_0x2d5604||0x1f4;return function(_0x2e1601){logger[_0xd18b('0x2a')](_0x2e1601[_0xd18b('0x2b')]);if(_0x2e1601[_0xd18b('0x2c')]){delete _0x2e1601['name'];}_0x4ceabb[_0xd18b('0x20')](_0x2d5604)[_0xd18b('0x2d')](_0x2e1601);};}exports['index']=function(_0x389f39,_0x9b8ed6){var _0x8ba88c={},_0x23dd9e={},_0xf9164e={'count':0x0,'rows':[]};var _0x35e2df=_[_0xd18b('0x2e')](db[_0xd18b('0x2f')][_0xd18b('0x30')],function(_0x13d4b6){return{'name':_0x13d4b6[_0xd18b('0x31')],'type':_0x13d4b6['type'][_0xd18b('0x32')]};});_0x23dd9e['model']=_[_0xd18b('0x2e')](_0x35e2df,'name');_0x23dd9e[_0xd18b('0x33')]=_[_0xd18b('0x34')](_0x389f39[_0xd18b('0x33')]);_0x23dd9e['filters']=_[_0xd18b('0x35')](_0x23dd9e[_0xd18b('0x36')],_0x23dd9e['query']);_0x8ba88c[_0xd18b('0x37')]=_['intersection'](_0x23dd9e[_0xd18b('0x36')],qs['fields'](_0x389f39[_0xd18b('0x33')]['fields']));_0x8ba88c[_0xd18b('0x37')]=_0x8ba88c[_0xd18b('0x37')][_0xd18b('0x38')]?_0x8ba88c['attributes']:_0x23dd9e[_0xd18b('0x36')];if(!_0x389f39['query']['hasOwnProperty'](_0xd18b('0x39'))){_0x8ba88c[_0xd18b('0x23')]=qs[_0xd18b('0x23')](_0x389f39[_0xd18b('0x33')]['limit']);_0x8ba88c[_0xd18b('0x22')]=qs['offset'](_0x389f39[_0xd18b('0x33')]['offset']);}_0x8ba88c['order']=qs[_0xd18b('0x3a')](_0x389f39[_0xd18b('0x33')][_0xd18b('0x3a')]);_0x8ba88c[_0xd18b('0x3b')]=qs[_0xd18b('0x3c')](_['pick'](_0x389f39[_0xd18b('0x33')],_0x23dd9e[_0xd18b('0x3c')]),_0x35e2df);if(_0x389f39['query'][_0xd18b('0x3d')]){_0x8ba88c[_0xd18b('0x3b')]=_['merge'](_0x8ba88c['where'],{'$or':_['map'](_0x35e2df,function(_0x1694b8){if(_0x1694b8[_0xd18b('0x3e')]!=='VIRTUAL'){var _0x27374c={};_0x27374c[_0x1694b8[_0xd18b('0x2c')]]={'$like':'%'+_0x389f39[_0xd18b('0x33')][_0xd18b('0x3d')]+'%'};return _0x27374c;}})});}_0x8ba88c=_[_0xd18b('0x3f')]({},_0x8ba88c,_0x389f39['options']);var _0x2420b7={'where':_0x8ba88c[_0xd18b('0x3b')]};return db[_0xd18b('0x2f')][_0xd18b('0x21')](_0x2420b7)[_0xd18b('0x29')](function(_0x5e757d){_0xf9164e['count']=_0x5e757d;if(_0x389f39[_0xd18b('0x33')][_0xd18b('0x40')]){_0x8ba88c[_0xd18b('0x41')]=[{'all':!![]}];}return db['Automation'][_0xd18b('0x42')](_0x8ba88c);})['then'](function(_0x4658d9){_0xf9164e[_0xd18b('0x43')]=_0x4658d9;return _0xf9164e;})[_0xd18b('0x29')](respondWithFilteredResult(_0x9b8ed6,_0x8ba88c))['catch'](handleError(_0x9b8ed6,null));};exports[_0xd18b('0x44')]=function(_0x30b46b,_0x3fc267){var _0x352cec={'raw':![],'where':{'id':_0x30b46b[_0xd18b('0x45')]['id']}},_0x2b37c7={};_0x2b37c7[_0xd18b('0x36')]=_['keys'](db['Automation'][_0xd18b('0x30')]);_0x2b37c7[_0xd18b('0x33')]=_[_0xd18b('0x34')](_0x30b46b['query']);_0x2b37c7[_0xd18b('0x46')]=_[_0xd18b('0x35')](_0x2b37c7[_0xd18b('0x36')],_0x2b37c7[_0xd18b('0x33')]);_0x352cec[_0xd18b('0x37')]=_[_0xd18b('0x35')](_0x2b37c7[_0xd18b('0x36')],qs['fields'](_0x30b46b['query'][_0xd18b('0x47')]));_0x352cec[_0xd18b('0x37')]=_0x352cec['attributes'][_0xd18b('0x38')]?_0x352cec['attributes']:_0x2b37c7[_0xd18b('0x36')];if(_0x30b46b[_0xd18b('0x33')]['includeAll']){_0x352cec[_0xd18b('0x41')]=[{'all':!![]}];}_0x352cec=_[_0xd18b('0x3f')]({},_0x352cec,_0x30b46b['options']);return db[_0xd18b('0x2f')]['find'](_0x352cec)['then'](handleEntityNotFound(_0x3fc267,null))[_0xd18b('0x29')](respondWithResult(_0x3fc267,null))[_0xd18b('0x48')](handleError(_0x3fc267,null));};exports[_0xd18b('0x49')]=function(_0x251fbc,_0x388ef5){return db[_0xd18b('0x2f')]['create'](_0x251fbc[_0xd18b('0x4a')],{})[_0xd18b('0x29')](respondWithResult(_0x388ef5,0xc9))[_0xd18b('0x48')](handleError(_0x388ef5,null));};exports[_0xd18b('0x4b')]=function(_0x59c58e,_0x18c5ce){if(_0x59c58e[_0xd18b('0x4a')]['id']){delete _0x59c58e[_0xd18b('0x4a')]['id'];}return db[_0xd18b('0x2f')][_0xd18b('0x4c')]({'where':{'id':_0x59c58e[_0xd18b('0x45')]['id']}})['then'](handleEntityNotFound(_0x18c5ce,null))[_0xd18b('0x29')](saveUpdates(_0x59c58e[_0xd18b('0x4a')],null))[_0xd18b('0x29')](respondWithResult(_0x18c5ce,null))['catch'](handleError(_0x18c5ce,null));};exports['destroy']=function(_0x11f204,_0x29ef8b){return db['Automation'][_0xd18b('0x4c')]({'where':{'id':_0x11f204['params']['id']}})[_0xd18b('0x29')](handleEntityNotFound(_0x29ef8b,null))[_0xd18b('0x29')](removeEntity(_0x29ef8b,null))[_0xd18b('0x48')](handleError(_0x29ef8b,null));};exports[_0xd18b('0x4d')]=function(_0x49a918,_0xd02194,_0x43e1c6){return db['Condition'][_0xd18b('0x4c')]({'where':{'id':_0x49a918[_0xd18b('0x45')]['id']}})[_0xd18b('0x29')](handleEntityNotFound(_0xd02194,null))['then'](function(_0x84cb11){if(_0x84cb11){return _0x84cb11['addConditions'](_0x49a918['body'][_0xd18b('0x4e')],_[_0xd18b('0x4f')](_0x49a918[_0xd18b('0x4a')],[_0xd18b('0x4e'),'id'])||{});}})[_0xd18b('0x29')](respondWithResult(_0xd02194,null))[_0xd18b('0x48')](handleError(_0xd02194,null));};exports[_0xd18b('0x50')]=function(_0x317c57,_0x2ade66,_0x2a6f3f){var _0x4a1b89={};var _0x4d9508={};var _0x57b63a;var _0x531937;return db[_0xd18b('0x2f')][_0xd18b('0x51')]({'where':{'id':_0x317c57[_0xd18b('0x45')]['id']}})['then'](handleEntityNotFound(_0x2ade66,null))[_0xd18b('0x29')](function(_0x3ab8fc){if(_0x3ab8fc){_0x57b63a=_0x3ab8fc;_0x4d9508[_0xd18b('0x36')]=_['keys'](db[_0xd18b('0x52')][_0xd18b('0x30')]);_0x4d9508[_0xd18b('0x33')]=_[_0xd18b('0x34')](_0x317c57[_0xd18b('0x33')]);_0x4d9508[_0xd18b('0x3c')]=_['intersection'](_0x4d9508[_0xd18b('0x36')],_0x4d9508[_0xd18b('0x33')]);_0x4a1b89[_0xd18b('0x37')]=_[_0xd18b('0x35')](_0x4d9508['model'],qs[_0xd18b('0x47')](_0x317c57[_0xd18b('0x33')][_0xd18b('0x47')]));_0x4a1b89[_0xd18b('0x37')]=_0x4a1b89[_0xd18b('0x37')]['length']?_0x4a1b89[_0xd18b('0x37')]:_0x4d9508[_0xd18b('0x36')];_0x4a1b89[_0xd18b('0x53')]=qs[_0xd18b('0x3a')](_0x317c57['query']['sort']);_0x4a1b89['where']=qs[_0xd18b('0x3c')](_['pick'](_0x317c57['query'],_0x4d9508[_0xd18b('0x3c')]));if(_0x317c57[_0xd18b('0x33')][_0xd18b('0x3d')]){_0x4a1b89[_0xd18b('0x3b')]=_[_0xd18b('0x3f')](_0x4a1b89[_0xd18b('0x3b')],{'$or':_[_0xd18b('0x2e')](_0x4a1b89[_0xd18b('0x37')],function(_0x3b7fa0){var _0x293690={};_0x293690[_0x3b7fa0]={'$like':'%'+_0x317c57[_0xd18b('0x33')][_0xd18b('0x3d')]+'%'};return _0x293690;})});}_0x4a1b89=_['merge']({},_0x4a1b89,_0x317c57[_0xd18b('0x54')]);return _0x57b63a[_0xd18b('0x50')](_0x4a1b89);}})[_0xd18b('0x29')](function(_0x2e3a36){if(_0x2e3a36){_0x531937=_0x2e3a36['length'];if(!_0x317c57['query'][_0xd18b('0x55')](_0xd18b('0x39'))){_0x4a1b89[_0xd18b('0x23')]=qs[_0xd18b('0x23')](_0x317c57[_0xd18b('0x33')]['limit']);_0x4a1b89[_0xd18b('0x22')]=qs['offset'](_0x317c57[_0xd18b('0x33')][_0xd18b('0x22')]);}return _0x57b63a['getConditions'](_0x4a1b89);}})[_0xd18b('0x29')](function(_0x1b47da){if(_0x1b47da){return _0x1b47da?{'count':_0x531937,'rows':_0x1b47da}:null;}})['then'](respondWithResult(_0x2ade66,null))[_0xd18b('0x48')](handleError(_0x2ade66,null));};exports['addActions']=function(_0x2ac494,_0x2f5dc9,_0x4ae686){return db['Action'][_0xd18b('0x4c')]({'where':{'id':_0x2ac494[_0xd18b('0x45')]['id']}})[_0xd18b('0x29')](handleEntityNotFound(_0x2f5dc9,null))[_0xd18b('0x29')](function(_0x1e462a){if(_0x1e462a){return _0x1e462a[_0xd18b('0x56')](_0x2ac494[_0xd18b('0x4a')]['ids'],_[_0xd18b('0x4f')](_0x2ac494[_0xd18b('0x4a')],[_0xd18b('0x4e'),'id'])||{});}})[_0xd18b('0x29')](respondWithResult(_0x2f5dc9,null))[_0xd18b('0x48')](handleError(_0x2f5dc9,null));};exports['getActions']=function(_0x1bd711,_0x201263,_0x5a0559){var _0x58255e={};var _0x4e1af0={};var _0x4ae63e;var _0xb1d995;return db[_0xd18b('0x2f')][_0xd18b('0x51')]({'where':{'id':_0x1bd711[_0xd18b('0x45')]['id']}})[_0xd18b('0x29')](handleEntityNotFound(_0x201263,null))[_0xd18b('0x29')](function(_0x6d52b){if(_0x6d52b){_0x4ae63e=_0x6d52b;_0x4e1af0['model']=_['keys'](db[_0xd18b('0x57')][_0xd18b('0x30')]);_0x4e1af0['query']=_['keys'](_0x1bd711[_0xd18b('0x33')]);_0x4e1af0[_0xd18b('0x3c')]=_[_0xd18b('0x35')](_0x4e1af0[_0xd18b('0x36')],_0x4e1af0[_0xd18b('0x33')]);_0x58255e[_0xd18b('0x37')]=_['intersection'](_0x4e1af0[_0xd18b('0x36')],qs[_0xd18b('0x47')](_0x1bd711[_0xd18b('0x33')][_0xd18b('0x47')]));_0x58255e['attributes']=_0x58255e['attributes'][_0xd18b('0x38')]?_0x58255e[_0xd18b('0x37')]:_0x4e1af0[_0xd18b('0x36')];_0x58255e[_0xd18b('0x53')]=qs[_0xd18b('0x3a')](_0x1bd711['query']['sort']);_0x58255e[_0xd18b('0x3b')]=qs[_0xd18b('0x3c')](_[_0xd18b('0x58')](_0x1bd711[_0xd18b('0x33')],_0x4e1af0[_0xd18b('0x3c')]));if(_0x1bd711[_0xd18b('0x33')]['filter']){_0x58255e['where']=_[_0xd18b('0x3f')](_0x58255e[_0xd18b('0x3b')],{'$or':_[_0xd18b('0x2e')](_0x58255e[_0xd18b('0x37')],function(_0x5c8aa1){var _0xd767ba={};_0xd767ba[_0x5c8aa1]={'$like':'%'+_0x1bd711[_0xd18b('0x33')][_0xd18b('0x3d')]+'%'};return _0xd767ba;})});}_0x58255e=_[_0xd18b('0x3f')]({},_0x58255e,_0x1bd711[_0xd18b('0x54')]);return _0x4ae63e['getActions'](_0x58255e);}})['then'](function(_0x2ec14a){if(_0x2ec14a){_0xb1d995=_0x2ec14a[_0xd18b('0x38')];if(!_0x1bd711[_0xd18b('0x33')][_0xd18b('0x55')](_0xd18b('0x39'))){_0x58255e[_0xd18b('0x23')]=qs['limit'](_0x1bd711[_0xd18b('0x33')][_0xd18b('0x23')]);_0x58255e[_0xd18b('0x22')]=qs['offset'](_0x1bd711[_0xd18b('0x33')][_0xd18b('0x22')]);}return _0x4ae63e[_0xd18b('0x59')](_0x58255e);}})[_0xd18b('0x29')](function(_0x6ed117){if(_0x6ed117){return _0x6ed117?{'count':_0xb1d995,'rows':_0x6ed117}:null;}})['then'](respondWithResult(_0x201263,null))[_0xd18b('0x48')](handleError(_0x201263,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index fc35c66..7770bbc 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 _0xbe99=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./automation.attributes','exports','define','lodash'];(function(_0x582ab8,_0x2ce139){var _0x37b44c=function(_0x4dfa4c){while(--_0x4dfa4c){_0x582ab8['push'](_0x582ab8['shift']());}};_0x37b44c(++_0x2ce139);}(_0xbe99,0x196));var _0x9be9=function(_0x5335ea,_0x2a612d){_0x5335ea=_0x5335ea-0x0;var _0x40a7da=_0xbe99[_0x5335ea];return _0x40a7da;};'use strict';var _=require(_0x9be9('0x0'));var util=require(_0x9be9('0x1'));var logger=require(_0x9be9('0x2'))(_0x9be9('0x3'));var moment=require(_0x9be9('0x4'));var BPromise=require('bluebird');var rp=require(_0x9be9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9be9('0x6'));var config=require(_0x9be9('0x7'));var attributes=require(_0x9be9('0x8'));module[_0x9be9('0x9')]=function(_0x52da35,_0x2134e7){return _0x52da35[_0x9be9('0xa')]('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51ef=['rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x51ef,0x1db));var _0xf51e=function(_0x1bfc2c,_0x19fe6e){_0x1bfc2c=_0x1bfc2c-0x0;var _0x4a5999=_0x51ef[_0x1bfc2c];return _0x4a5999;};'use strict';var _=require(_0xf51e('0x0'));var util=require(_0xf51e('0x1'));var logger=require(_0xf51e('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf51e('0x3'));var rp=require(_0xf51e('0x4'));var fs=require('fs');var path=require(_0xf51e('0x5'));var rimraf=require(_0xf51e('0x6'));var config=require(_0xf51e('0x7'));var attributes=require(_0xf51e('0x8'));module[_0xf51e('0x9')]=function(_0x3ec314,_0x253f22){return _0x3ec314[_0xf51e('0xa')](_0xf51e('0xb'),attributes,{'tableName':_0xf51e('0xc'),'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 85015c8..e7d74e8 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 _0x93ea=['rpc','../../config/environment','client','http','request','then','info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../config/utils','../../config/logger'];(function(_0x1919d6,_0x5eea51){var _0x39df02=function(_0x37302d){while(--_0x37302d){_0x1919d6['push'](_0x1919d6['shift']());}};_0x39df02(++_0x5eea51);}(_0x93ea,0xcc));var _0xa93e=function(_0x8ae98b,_0x155f88){_0x8ae98b=_0x8ae98b-0x0;var _0xc30bd4=_0x93ea[_0x8ae98b];return _0xc30bd4;};'use strict';var _=require(_0xa93e('0x0'));var util=require(_0xa93e('0x1'));var moment=require(_0xa93e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa93e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa93e('0x4'));var logger=require(_0xa93e('0x5'))(_0xa93e('0x6'));var config=require(_0xa93e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa93e('0x8')][_0xa93e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22dcdf,_0x54411d,_0x182569){return new BPromise(function(_0x852512,_0x4d164f){return client[_0xa93e('0xa')](_0x22dcdf,_0x182569)[_0xa93e('0xb')](function(_0x1dfff9){logger[_0xa93e('0xc')]('Automation,\x20%s,\x20%s',_0x54411d,_0xa93e('0xd'));logger['debug'](_0xa93e('0xe'),_0x54411d,_0xa93e('0xd'),JSON[_0xa93e('0xf')](_0x1dfff9));if(_0x1dfff9[_0xa93e('0x10')]){if(_0x1dfff9[_0xa93e('0x10')][_0xa93e('0x11')]===0x1f4){logger['error'](_0xa93e('0x12'),_0x54411d,_0x1dfff9['error'][_0xa93e('0x13')]);return _0x4d164f(_0x1dfff9[_0xa93e('0x10')][_0xa93e('0x13')]);}logger[_0xa93e('0x10')](_0xa93e('0x12'),_0x54411d,_0x1dfff9[_0xa93e('0x10')][_0xa93e('0x13')]);return _0x852512(_0x1dfff9['error'][_0xa93e('0x13')]);}else{logger[_0xa93e('0xc')](_0xa93e('0x12'),_0x54411d,_0xa93e('0xd'));_0x852512(_0x1dfff9[_0xa93e('0x14')][_0xa93e('0x13')]);}})['catch'](function(_0x53349a){logger['error'](_0xa93e('0x12'),_0x54411d,_0x53349a);_0x4d164f(_0x53349a);});});} \ No newline at end of file +var _0xec19=['../../config/environment','http','then','debug','request\x20sent','stringify','error','code','Automation,\x20%s,\x20%s','message','info','catch','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x53f9c8,_0x29b6dc){var _0x507562=function(_0x53fcb9){while(--_0x53fcb9){_0x53f9c8['push'](_0x53f9c8['shift']());}};_0x507562(++_0x29b6dc);}(_0xec19,0xc0));var _0x9ec1=function(_0x1d5709,_0x2c3912){_0x1d5709=_0x1d5709-0x0;var _0xe54bdb=_0xec19[_0x1d5709];return _0xe54bdb;};'use strict';var _=require(_0x9ec1('0x0'));var util=require(_0x9ec1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ec1('0x2'));var db=require(_0x9ec1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ec1('0x4'))(_0x9ec1('0x5'));var config=require(_0x9ec1('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9ec1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4778c5,_0x27a9f6,_0x530801){return new BPromise(function(_0x3a3bf2,_0x1e35ee){return client['request'](_0x4778c5,_0x530801)[_0x9ec1('0x8')](function(_0x56786d){logger['info']('Automation,\x20%s,\x20%s',_0x27a9f6,'request\x20sent');logger[_0x9ec1('0x9')]('Automation,\x20%s,\x20%s,\x20%s',_0x27a9f6,_0x9ec1('0xa'),JSON[_0x9ec1('0xb')](_0x56786d));if(_0x56786d[_0x9ec1('0xc')]){if(_0x56786d[_0x9ec1('0xc')][_0x9ec1('0xd')]===0x1f4){logger[_0x9ec1('0xc')](_0x9ec1('0xe'),_0x27a9f6,_0x56786d[_0x9ec1('0xc')]['message']);return _0x1e35ee(_0x56786d[_0x9ec1('0xc')][_0x9ec1('0xf')]);}logger['error'](_0x9ec1('0xe'),_0x27a9f6,_0x56786d['error'][_0x9ec1('0xf')]);return _0x3a3bf2(_0x56786d[_0x9ec1('0xc')][_0x9ec1('0xf')]);}else{logger[_0x9ec1('0x10')](_0x9ec1('0xe'),_0x27a9f6,_0x9ec1('0xa'));_0x3a3bf2(_0x56786d['result'][_0x9ec1('0xf')]);}})[_0x9ec1('0x11')](function(_0x39ea07){logger['error'](_0x9ec1('0xe'),_0x27a9f6,_0x39ea07);_0x1e35ee(_0x39ea07);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index db70a6e..64e7cab 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 _0xeff6=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','show','/:id/conditions','getConditions','get','/:id/actions','getActions','create','post','addConditions','update','delete','/:id','exports','multer'];(function(_0x7818b1,_0x505da9){var _0x15e2f1=function(_0x1b267f){while(--_0x1b267f){_0x7818b1['push'](_0x7818b1['shift']());}};_0x15e2f1(++_0x505da9);}(_0xeff6,0xf9));var _0x6eff=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeff6[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x6eff('0x0'));var util=require(_0x6eff('0x1'));var path=require(_0x6eff('0x2'));var timeout=require(_0x6eff('0x3'));var express=require(_0x6eff('0x4'));var router=express[_0x6eff('0x5')]();var auth=require(_0x6eff('0x6'));var interaction=require(_0x6eff('0x7'));var config=require(_0x6eff('0x8'));var controller=require(_0x6eff('0x9'));router['get']('/',auth[_0x6eff('0xa')](),controller[_0x6eff('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6eff('0xc')]);router['get'](_0x6eff('0xd'),auth[_0x6eff('0xa')](),controller[_0x6eff('0xe')]);router[_0x6eff('0xf')](_0x6eff('0x10'),auth['isAuthenticated'](),controller[_0x6eff('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6eff('0x12')]);router[_0x6eff('0x13')]('/:id/conditions',auth[_0x6eff('0xa')](),controller[_0x6eff('0x14')]);router['post'](_0x6eff('0x10'),auth[_0x6eff('0xa')](),controller['addActions']);router['put']('/:id',auth[_0x6eff('0xa')](),controller[_0x6eff('0x15')]);router[_0x6eff('0x16')](_0x6eff('0x17'),auth['isAuthenticated'](),controller['destroy']);module[_0x6eff('0x18')]=router; \ No newline at end of file +var _0x5fb4=['put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions'];(function(_0xad1130,_0x194b3d){var _0x663391=function(_0x1bcbe8){while(--_0x1bcbe8){_0xad1130['push'](_0xad1130['shift']());}};_0x663391(++_0x194b3d);}(_0x5fb4,0x183));var _0x45fb=function(_0xeb6bb1,_0xc83c4c){_0xeb6bb1=_0xeb6bb1-0x0;var _0x387e00=_0x5fb4[_0xeb6bb1];return _0x387e00;};'use strict';var multer=require(_0x45fb('0x0'));var util=require(_0x45fb('0x1'));var path=require(_0x45fb('0x2'));var timeout=require(_0x45fb('0x3'));var express=require(_0x45fb('0x4'));var router=express[_0x45fb('0x5')]();var auth=require(_0x45fb('0x6'));var interaction=require(_0x45fb('0x7'));var config=require(_0x45fb('0x8'));var controller=require(_0x45fb('0x9'));router['get']('/',auth[_0x45fb('0xa')](),controller[_0x45fb('0xb')]);router[_0x45fb('0xc')](_0x45fb('0xd'),auth[_0x45fb('0xa')](),controller['show']);router['get'](_0x45fb('0xe'),auth[_0x45fb('0xa')](),controller[_0x45fb('0xf')]);router['get'](_0x45fb('0x10'),auth[_0x45fb('0xa')](),controller[_0x45fb('0x11')]);router[_0x45fb('0x12')]('/',auth[_0x45fb('0xa')](),controller[_0x45fb('0x13')]);router[_0x45fb('0x12')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x45fb('0x14')]);router[_0x45fb('0x12')](_0x45fb('0x10'),auth[_0x45fb('0xa')](),controller['addActions']);router[_0x45fb('0x15')](_0x45fb('0xd'),auth[_0x45fb('0xa')](),controller['update']);router[_0x45fb('0x16')](_0x45fb('0xd'),auth['isAuthenticated'](),controller[_0x45fb('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 79576e7..49015ce 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 _0x48f2=['07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','UNSIGNED','Max\x20200\x20calls.','INTEGER','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\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)'];(function(_0x108d08,_0x106292){var _0x139062=function(_0x44fd25){while(--_0x44fd25){_0x108d08['push'](_0x108d08['shift']());}};_0x139062(++_0x106292);}(_0x48f2,0x119));var _0x248f=function(_0x2832e3,_0x2c8be0){_0x2832e3=_0x2832e3-0x0;var _0x4c5384=_0x48f2[_0x2832e3];return _0x4c5384;};'use strict';var Sequelize=require(_0x248f('0x0'));module[_0x248f('0x1')]={'name':{'type':Sequelize[_0x248f('0x2')],'unique':_0x248f('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0x248f('0x4')},'description':{'type':Sequelize[_0x248f('0x2')]},'active':{'type':Sequelize[_0x248f('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x248f('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x248f('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x248f('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x248f('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x248f('0x8')](0x3)[_0x248f('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x248f('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x248f('0x8')](0x3)[_0x248f('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x248f('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x248f('0x8')](0x5)[_0x248f('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x248f('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x248f('0x8')](0x3)[_0x248f('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x248f('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x248f('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x248f('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x248f('0x8')](0x3)[_0x248f('0x6')],'defaultValue':0x3,'comment':_0x248f('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x248f('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x248f('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x248f('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x248f('0x2')],'defaultValue':_0x248f('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x248f('0x10')](_0x248f('0x11'),_0x248f('0x12'),_0x248f('0x13')),'defaultValue':_0x248f('0x11')},'dialAMDActive':{'type':Sequelize[_0x248f('0x5')],'defaultValue':0x0,'comment':_0x248f('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x248f('0x8')](0x9)[_0x248f('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x248f('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x248f('0x8')](0x9)[_0x248f('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x248f('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x248f('0x8')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x248f('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x248f('0x8')](0x9)[_0x248f('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x248f('0x8')](0x9)[_0x248f('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x248f('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x248f('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x248f('0x8')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x248f('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x248f('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x248f('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x248f('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x248f('0x10')]('DESC','ASC'),'defaultValue':_0x248f('0x1c')},'dialPrefix':{'type':Sequelize[_0x248f('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x248f('0x8')](0x3)[_0x248f('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x248f('0x1d')},'dialCutDigit':{'type':Sequelize[_0x248f('0x8')](0x3)[_0x248f('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x248f('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x248f('0x8')](0x5)[_0x248f('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x248f('0x8')](0x3)[_0x248f('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x248f('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x248f('0x8')](0x5)[_0x248f('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x248f('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x248f('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x248f('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x248f('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x248f('0x21')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x248f('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x248f('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x248f('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x248f('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x248f('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x248f('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x248f('0x24')}}; \ No newline at end of file +var _0x9e85=['AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','ENUM','ivr','STRING','INTEGER','Max\x20200\x20calls.','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\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','#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','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9e85,0x1cf));var _0x59e8=function(_0x22d4a8,_0x3e1b0f){_0x22d4a8=_0x22d4a8-0x0;var _0x46c987=_0x9e85[_0x22d4a8];return _0x46c987;};'use strict';var Sequelize=require(_0x59e8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x59e8('0x1')](_0x59e8('0x2')),'allowNull':![],'defaultValue':_0x59e8('0x2')},'description':{'type':Sequelize[_0x59e8('0x3')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x59e8('0x4')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x59e8('0x5')},'dialOriginateCallerIdName':{'type':Sequelize[_0x59e8('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x59e8('0x4')](0x3)[_0x59e8('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x59e8('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0x59e8('0x4')](0x3)[_0x59e8('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x59e8('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x59e8('0x4')](0x5)[_0x59e8('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x59e8('0x9')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x59e8('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x59e8('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x59e8('0x4')](0x5)[_0x59e8('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x59e8('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x59e8('0x4')](0x3)[_0x59e8('0x6')],'defaultValue':0x3,'comment':_0x59e8('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x59e8('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x59e8('0x4')](0x3)[_0x59e8('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x59e8('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x59e8('0x3')],'defaultValue':_0x59e8('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x59e8('0x1')](_0x59e8('0xf'),_0x59e8('0x10'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x59e8('0x4')](0x9)[_0x59e8('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x59e8('0x11')},'dialAMDGreeting':{'type':Sequelize[_0x59e8('0x4')](0x9)[_0x59e8('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x59e8('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x59e8('0x4')](0x9)[_0x59e8('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x59e8('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x59e8('0x4')](0x9)[_0x59e8('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x59e8('0x14')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x59e8('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x59e8('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x59e8('0x4')](0x9)[_0x59e8('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x59e8('0x4')](0x5)[_0x59e8('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x59e8('0x16')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x59e8('0x4')](0x9)[_0x59e8('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x59e8('0x17')},'dialOrderByScheduledAt':{'type':Sequelize[_0x59e8('0x1')](_0x59e8('0x18'),'ASC'),'defaultValue':_0x59e8('0x18')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x59e8('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x59e8('0x19')},'dialCutDigit':{'type':Sequelize[_0x59e8('0x4')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x59e8('0x4')](0x3)[_0x59e8('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x59e8('0x1a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x59e8('0x4')](0x5)[_0x59e8('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x59e8('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x59e8('0x4')](0x5)[_0x59e8('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x59e8('0x1b')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x59e8('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x59e8('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x59e8('0x1c')},'dialMachineMaxRetry':{'type':Sequelize[_0x59e8('0x4')](0x3)[_0x59e8('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x59e8('0x1d')},'dialMachineRetryFrequency':{'type':Sequelize[_0x59e8('0x4')](0x5)[_0x59e8('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x59e8('0x1e')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x59e8('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x59e8('0x1f')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x59e8('0x4')](0x5)[_0x59e8('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x59e8('0x20')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index e822617..2993b60 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 _0xda2d=['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','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','map','rawAttributes','type','model','keys','filters','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','Campaign','include','findAll','rows','catch','params','filtears','includeAll','options','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','createdAt','updatedAt','getHoppers','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','findOne','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','cm_hopper','scheduledAt','ContactId','ListId','phone','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','fromQuery','CmListId','into','push','sequelize','all','removeLists','addBlackLists','omit','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x163a8e,_0x4d6aa6){var _0x439db9=function(_0x1be361){while(--_0x1be361){_0x163a8e['push'](_0x163a8e['shift']());}};_0x439db9(++_0x4d6aa6);}(_0xda2d,0x102));var _0xdda2=function(_0x5f4699,_0x38a603){_0x5f4699=_0x5f4699-0x0;var _0x3ef8b7=_0xda2d[_0x5f4699];return _0x3ef8b7;};'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 licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56d25d,_0xa6446b){_0xa6446b=_0xa6446b||0xcc;return function(_0x320f73){if(_0x320f73){return _0x56d25d[_0xdda2('0x19')](_0xa6446b);}return _0x56d25d[_0xdda2('0x1a')](_0xa6446b)[_0xdda2('0x1b')]();};}function respondWithResult(_0x475222,_0x3490f1){_0x3490f1=_0x3490f1||0xc8;return function(_0x4df902){if(_0x4df902){return _0x475222[_0xdda2('0x1a')](_0x3490f1)['json'](_0x4df902);}};}function respondWithFilteredResult(_0xbef148,_0xb6b01e){return function(_0x3553d5){if(_0x3553d5){var _0x457764=_0x3553d5[_0xdda2('0x1c')],_0x1922b1=_0xb6b01e['offset'],_0x5d8a83=_0xb6b01e[_0xdda2('0x1d')]+_0xb6b01e[_0xdda2('0x1e')],_0x55d674;if(_0x5d8a83>=_0x457764){_0x5d8a83=_0x457764;_0x55d674=0xc8;}else{_0x55d674=0xce;}_0xbef148[_0xdda2('0x1a')](_0x55d674);return _0xbef148[_0xdda2('0x1f')](_0xdda2('0x20'),_0x1922b1+'-'+_0x5d8a83+'/'+_0x457764)[_0xdda2('0x21')](_0x3553d5);}return null;};}function patchUpdates(_0x3ca127){return function(_0x351151){try{jsonpatch[_0xdda2('0x22')](_0x351151,_0x3ca127,!![]);}catch(_0x337b0b){return BPromise[_0xdda2('0x23')](_0x337b0b);}return _0x351151[_0xdda2('0x24')]();};}function saveUpdates(_0x4eed30,_0x41fe7d){return function(_0x5dfce7){if(_0x5dfce7){return _0x5dfce7[_0xdda2('0x25')](_0x4eed30)[_0xdda2('0x26')](function(_0xf994dc){return _0xf994dc;});}return null;};}function removeEntity(_0x4c5226,_0x347ee6){return function(_0x5a9bb8){if(_0x5a9bb8){return _0x5a9bb8[_0xdda2('0x27')]()[_0xdda2('0x26')](function(){var _0x4ac3eb=_0x5a9bb8[_0xdda2('0x28')]({'plain':!![]});var _0xfda248=_0xdda2('0x29');return db[_0xdda2('0x2a')][_0xdda2('0x27')]({'where':{'type':_0xfda248,'resourceId':_0x4ac3eb['id']}})['then'](function(){return _0x5a9bb8;});})[_0xdda2('0x26')](function(){_0x4c5226[_0xdda2('0x1a')](0xcc)[_0xdda2('0x1b')]();});}};}function handleEntityNotFound(_0x31d48b,_0x5436d1){return function(_0x4e97dc){if(!_0x4e97dc){_0x31d48b[_0xdda2('0x19')](0x194);}return _0x4e97dc;};}function handleError(_0x4567e7,_0x2e8591){_0x2e8591=_0x2e8591||0x1f4;return function(_0x5e9e74){logger[_0xdda2('0x2b')](_0x5e9e74[_0xdda2('0x2c')]);if(_0x5e9e74[_0xdda2('0x2d')]){delete _0x5e9e74[_0xdda2('0x2d')];}_0x4567e7[_0xdda2('0x1a')](_0x2e8591)[_0xdda2('0x2e')](_0x5e9e74);};}exports['index']=function(_0x24c37d,_0x255bbc){var _0x53acb5={},_0x45e800={},_0x2cfaca={'count':0x0,'rows':[]};var _0x3b18b8=_[_0xdda2('0x2f')](db['Campaign'][_0xdda2('0x30')],function(_0x5e107f){return{'name':_0x5e107f['fieldName'],'type':_0x5e107f[_0xdda2('0x31')]['key']};});_0x45e800[_0xdda2('0x32')]=_['map'](_0x3b18b8,'name');_0x45e800['query']=_[_0xdda2('0x33')](_0x24c37d['query']);_0x45e800[_0xdda2('0x34')]=_['intersection'](_0x45e800['model'],_0x45e800['query']);_0x53acb5[_0xdda2('0x35')]=_[_0xdda2('0x36')](_0x45e800[_0xdda2('0x32')],qs[_0xdda2('0x37')](_0x24c37d[_0xdda2('0x38')][_0xdda2('0x37')]));_0x53acb5[_0xdda2('0x35')]=_0x53acb5[_0xdda2('0x35')][_0xdda2('0x39')]?_0x53acb5[_0xdda2('0x35')]:_0x45e800['model'];if(!_0x24c37d[_0xdda2('0x38')][_0xdda2('0x3a')](_0xdda2('0x3b'))){_0x53acb5[_0xdda2('0x1e')]=qs[_0xdda2('0x1e')](_0x24c37d[_0xdda2('0x38')][_0xdda2('0x1e')]);_0x53acb5['offset']=qs['offset'](_0x24c37d[_0xdda2('0x38')][_0xdda2('0x1d')]);}_0x53acb5[_0xdda2('0x3c')]=qs['sort'](_0x24c37d['query'][_0xdda2('0x3d')]);_0x53acb5[_0xdda2('0x3e')]=qs[_0xdda2('0x34')](_[_0xdda2('0x3f')](_0x24c37d[_0xdda2('0x38')],_0x45e800['filters']),_0x3b18b8);if(_0x24c37d[_0xdda2('0x38')][_0xdda2('0x40')]){_0x53acb5['where']=_['merge'](_0x53acb5[_0xdda2('0x3e')],{'$or':_[_0xdda2('0x2f')](_0x3b18b8,function(_0x33fe97){if(_0x33fe97[_0xdda2('0x31')]!==_0xdda2('0x41')){var _0x585eba={};_0x585eba[_0x33fe97[_0xdda2('0x2d')]]={'$like':'%'+_0x24c37d[_0xdda2('0x38')][_0xdda2('0x40')]+'%'};return _0x585eba;}})});}_0x53acb5=_[_0xdda2('0x42')]({},_0x53acb5,_0x24c37d['options']);var _0x4dc38f={'where':_0x53acb5[_0xdda2('0x3e')]};return db[_0xdda2('0x43')][_0xdda2('0x1c')](_0x4dc38f)['then'](function(_0x1bb2a7){_0x2cfaca['count']=_0x1bb2a7;if(_0x24c37d[_0xdda2('0x38')]['includeAll']){_0x53acb5[_0xdda2('0x44')]=[{'all':!![]}];}return db[_0xdda2('0x43')][_0xdda2('0x45')](_0x53acb5);})[_0xdda2('0x26')](function(_0x57bd0e){_0x2cfaca[_0xdda2('0x46')]=_0x57bd0e;return _0x2cfaca;})['then'](respondWithFilteredResult(_0x255bbc,_0x53acb5))[_0xdda2('0x47')](handleError(_0x255bbc,null));};exports['show']=function(_0x1d1678,_0x12589b){var _0x153acf={'raw':![],'where':{'id':_0x1d1678[_0xdda2('0x48')]['id']}},_0x12d49d={};_0x12d49d['model']=_[_0xdda2('0x33')](db[_0xdda2('0x43')]['rawAttributes']);_0x12d49d[_0xdda2('0x38')]=_['keys'](_0x1d1678[_0xdda2('0x38')]);_0x12d49d[_0xdda2('0x49')]=_[_0xdda2('0x36')](_0x12d49d[_0xdda2('0x32')],_0x12d49d[_0xdda2('0x38')]);_0x153acf[_0xdda2('0x35')]=_[_0xdda2('0x36')](_0x12d49d[_0xdda2('0x32')],qs[_0xdda2('0x37')](_0x1d1678[_0xdda2('0x38')][_0xdda2('0x37')]));_0x153acf[_0xdda2('0x35')]=_0x153acf[_0xdda2('0x35')]['length']?_0x153acf['attributes']:_0x12d49d['model'];if(_0x1d1678[_0xdda2('0x38')][_0xdda2('0x4a')]){_0x153acf['include']=[{'all':!![]}];}_0x153acf=_[_0xdda2('0x42')]({},_0x153acf,_0x1d1678[_0xdda2('0x4b')]);return db[_0xdda2('0x43')]['find'](_0x153acf)[_0xdda2('0x26')](handleEntityNotFound(_0x12589b,null))[_0xdda2('0x26')](respondWithResult(_0x12589b,null))['catch'](handleError(_0x12589b,null));};exports['create']=function(_0x37422b,_0x5efd20){return db[_0xdda2('0x43')]['create'](_0x37422b[_0xdda2('0x4c')],{})[_0xdda2('0x26')](function(_0x50bd88){var _0x585665=_0x37422b[_0xdda2('0x4d')][_0xdda2('0x28')]({'plain':!![]});if(!_0x585665)throw new Error(_0xdda2('0x4e'));if(_0x585665[_0xdda2('0x4f')]==='user'){var _0x1edbc6=_0x50bd88[_0xdda2('0x28')]({'plain':!![]});var _0x3d2cb0=_0xdda2('0x29');return db[_0xdda2('0x50')]['find']({'where':{'name':_0x3d2cb0,'userProfileId':_0x585665[_0xdda2('0x51')]},'raw':!![]})[_0xdda2('0x26')](function(_0x51f2b6){if(_0x51f2b6&&_0x51f2b6[_0xdda2('0x52')]===0x0){return db[_0xdda2('0x2a')][_0xdda2('0x53')]({'name':_0x1edbc6[_0xdda2('0x2d')],'resourceId':_0x1edbc6['id'],'type':_0x51f2b6[_0xdda2('0x2d')],'sectionId':_0x51f2b6['id']},{})[_0xdda2('0x26')](function(){return _0x50bd88;});}else{return _0x50bd88;}})['catch'](function(_0x2c58c7){logger['error'](_0xdda2('0x54'),_0x2c58c7);throw _0x2c58c7;});}return _0x50bd88;})['then'](respondWithResult(_0x5efd20,0xc9))[_0xdda2('0x47')](handleError(_0x5efd20,null));};exports['clone']=function(_0x3b5bbf,_0x11c8b1){var _0xbb30b8={'where':{'id':_0x3b5bbf[_0xdda2('0x48')]['id']}},_0x119f70={};_0x119f70[_0xdda2('0x32')]=_[_0xdda2('0x33')](db[_0xdda2('0x43')]['rawAttributes']);_0xbb30b8[_0xdda2('0x35')]=_[_0xdda2('0x36')](_0x119f70[_0xdda2('0x32')],qs['fields'](_0x3b5bbf[_0xdda2('0x38')][_0xdda2('0x37')]));_0xbb30b8['attributes']=_0xbb30b8[_0xdda2('0x35')]['length']?_0xbb30b8[_0xdda2('0x35')]:_0x119f70[_0xdda2('0x32')];if(_0x3b5bbf[_0xdda2('0x38')][_0xdda2('0x4a')]){_0xbb30b8[_0xdda2('0x44')]=[{'all':!![]}];}_0xbb30b8=_['merge']({},_0xbb30b8,_0x3b5bbf['options']);return db['Campaign'][_0xdda2('0x55')](_0xbb30b8)[_0xdda2('0x26')](handleEntityNotFound(_0x11c8b1,null))['then'](function(_0x44637d){if(_0x44637d){var _0x126977=_0x44637d[_0xdda2('0x28')]({'plain':!![]});_0x126977=qs['omit'](_0x126977,['id',_0xdda2('0x56'),_0xdda2('0x57')]);_0x3b5bbf[_0xdda2('0x4c')]=_['omit'](_0x3b5bbf[_0xdda2('0x4c')],['id',_0xdda2('0x56'),_0xdda2('0x57')]);return db[_0xdda2('0x43')]['create'](_[_0xdda2('0x42')](_0x126977,_0x3b5bbf['body']),{'include':_0x3b5bbf['query']['includeAll']?[{'all':!![]}]:undefined})[_0xdda2('0x26')](function(_0x35b38a){var _0x2432c0=_0x3b5bbf[_0xdda2('0x4d')][_0xdda2('0x28')]({'plain':!![]});if(!_0x2432c0)throw new Error(_0xdda2('0x4e'));if(_0x2432c0[_0xdda2('0x4f')]===_0xdda2('0x4d')){var _0x269ad1=_0x35b38a[_0xdda2('0x28')]({'plain':!![]});var _0x26e7de='IvrCampaigns';return db[_0xdda2('0x50')][_0xdda2('0x55')]({'where':{'name':_0x26e7de,'userProfileId':_0x2432c0[_0xdda2('0x51')]},'raw':!![]})[_0xdda2('0x26')](function(_0x90bb5c){if(_0x90bb5c&&_0x90bb5c[_0xdda2('0x52')]===0x0){return db[_0xdda2('0x2a')]['create']({'name':_0x269ad1[_0xdda2('0x2d')],'resourceId':_0x269ad1['id'],'type':_0x90bb5c[_0xdda2('0x2d')],'sectionId':_0x90bb5c['id']},{})[_0xdda2('0x26')](function(){return _0x35b38a;});}else{return _0x35b38a;}})[_0xdda2('0x47')](function(_0x44f619){logger['error'](_0xdda2('0x54'),_0x44f619);throw _0x44f619;});}return _0x35b38a;});}})[_0xdda2('0x26')](respondWithResult(_0x11c8b1,0xc9))[_0xdda2('0x47')](handleError(_0x11c8b1,null));};exports[_0xdda2('0x25')]=function(_0x21d0e4,_0x4a6f28){if(_0x21d0e4[_0xdda2('0x4c')]['id']){delete _0x21d0e4[_0xdda2('0x4c')]['id'];}return db[_0xdda2('0x43')][_0xdda2('0x55')]({'where':{'id':_0x21d0e4[_0xdda2('0x48')]['id']}})['then'](handleEntityNotFound(_0x4a6f28,null))[_0xdda2('0x26')](saveUpdates(_0x21d0e4[_0xdda2('0x4c')],null))[_0xdda2('0x26')](respondWithResult(_0x4a6f28,null))['catch'](handleError(_0x4a6f28,null));};exports[_0xdda2('0x27')]=function(_0x483c17,_0x3cc35c){return db[_0xdda2('0x43')][_0xdda2('0x55')]({'where':{'id':_0x483c17['params']['id']}})[_0xdda2('0x26')](handleEntityNotFound(_0x3cc35c,null))[_0xdda2('0x26')](removeEntity(_0x3cc35c,null))['catch'](handleError(_0x3cc35c,null));};exports[_0xdda2('0x58')]=function(_0x5adab5,_0x3d645b,_0xc97cb1){var _0x354fb9={'raw':!![],'where':{}};var _0x29cf1a={};var _0x10d1de={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x5adab5[_0xdda2('0x48')]['id']}})[_0xdda2('0x26')](handleEntityNotFound(_0x3d645b,null))['then'](function(_0x53e9e0){if(_0x53e9e0){_0x29cf1a[_0xdda2('0x32')]=_['keys'](db[_0xdda2('0x59')][_0xdda2('0x30')]);_0x29cf1a['query']=_[_0xdda2('0x33')](_0x5adab5[_0xdda2('0x38')]);_0x29cf1a[_0xdda2('0x34')]=_[_0xdda2('0x36')](_0x29cf1a[_0xdda2('0x32')],_0x29cf1a[_0xdda2('0x38')]);_0x354fb9['attributes']=_[_0xdda2('0x36')](_0x29cf1a[_0xdda2('0x32')],qs[_0xdda2('0x37')](_0x5adab5['query'][_0xdda2('0x37')]));_0x354fb9[_0xdda2('0x35')]=_0x354fb9['attributes']['length']?_0x354fb9[_0xdda2('0x35')]:_0x29cf1a[_0xdda2('0x32')];if(!_0x5adab5[_0xdda2('0x38')]['hasOwnProperty']('nolimit')){_0x354fb9[_0xdda2('0x1e')]=qs['limit'](_0x5adab5[_0xdda2('0x38')][_0xdda2('0x1e')]);_0x354fb9[_0xdda2('0x1d')]=qs[_0xdda2('0x1d')](_0x5adab5[_0xdda2('0x38')][_0xdda2('0x1d')]);}_0x354fb9['order']=qs['sort'](_0x5adab5[_0xdda2('0x38')]['sort']);_0x354fb9[_0xdda2('0x3e')]=qs[_0xdda2('0x34')](_[_0xdda2('0x3f')](_0x5adab5[_0xdda2('0x38')],_0x29cf1a[_0xdda2('0x34')]));_0x354fb9[_0xdda2('0x3e')][_0xdda2('0x5a')]=_0x53e9e0['id'];if(_0x5adab5[_0xdda2('0x38')][_0xdda2('0x40')]){_0x354fb9['where']=_[_0xdda2('0x42')](_0x354fb9[_0xdda2('0x3e')],{'$or':_[_0xdda2('0x2f')](_0x354fb9[_0xdda2('0x35')],function(_0x4990fe){var _0x3b535d={};_0x3b535d[_0x4990fe]={'$like':'%'+_0x5adab5[_0xdda2('0x38')][_0xdda2('0x40')]+'%'};return _0x3b535d;})});}_0x354fb9=_[_0xdda2('0x42')]({},_0x354fb9,_0x5adab5['options']);return db['CmHopper'][_0xdda2('0x1c')]({'where':_0x354fb9[_0xdda2('0x3e')]})[_0xdda2('0x26')](function(_0xe1c6e6){_0x10d1de['count']=_0xe1c6e6;if(_0x5adab5[_0xdda2('0x38')][_0xdda2('0x4a')]){_0x354fb9[_0xdda2('0x44')]=[{'all':!![]}];}return db[_0xdda2('0x59')][_0xdda2('0x45')](_0x354fb9);})[_0xdda2('0x26')](function(_0x27288a){_0x10d1de[_0xdda2('0x46')]=_0x27288a;return _0x10d1de;});}})[_0xdda2('0x26')](respondWithFilteredResult(_0x3d645b,_0x354fb9))[_0xdda2('0x47')](handleError(_0x3d645b,null));};exports[_0xdda2('0x5b')]=function(_0x23a80a,_0x285cb2,_0x3ac576){var _0x2411e8={'raw':!![],'where':{}};var _0x4b9481={};var _0x221f72={'count':0x0,'rows':[]};return db[_0xdda2('0x43')]['findOne']({'where':{'id':_0x23a80a['params']['id']}})[_0xdda2('0x26')](handleEntityNotFound(_0x285cb2,null))[_0xdda2('0x26')](function(_0x1ba7dd){if(_0x1ba7dd){_0x4b9481[_0xdda2('0x32')]=_[_0xdda2('0x33')](db[_0xdda2('0x5c')]['rawAttributes']);_0x4b9481[_0xdda2('0x38')]=_[_0xdda2('0x33')](_0x23a80a[_0xdda2('0x38')]);_0x4b9481[_0xdda2('0x34')]=_['intersection'](_0x4b9481[_0xdda2('0x32')],_0x4b9481['query']);_0x2411e8[_0xdda2('0x35')]=_[_0xdda2('0x36')](_0x4b9481['model'],qs[_0xdda2('0x37')](_0x23a80a[_0xdda2('0x38')][_0xdda2('0x37')]));_0x2411e8[_0xdda2('0x35')]=_0x2411e8[_0xdda2('0x35')][_0xdda2('0x39')]?_0x2411e8[_0xdda2('0x35')]:_0x4b9481[_0xdda2('0x32')];if(!_0x23a80a[_0xdda2('0x38')][_0xdda2('0x3a')](_0xdda2('0x3b'))){_0x2411e8['limit']=qs[_0xdda2('0x1e')](_0x23a80a[_0xdda2('0x38')][_0xdda2('0x1e')]);_0x2411e8[_0xdda2('0x1d')]=qs[_0xdda2('0x1d')](_0x23a80a['query'][_0xdda2('0x1d')]);}_0x2411e8[_0xdda2('0x3c')]=qs['sort'](_0x23a80a[_0xdda2('0x38')][_0xdda2('0x3d')]);_0x2411e8['where']=qs['filters'](_[_0xdda2('0x3f')](_0x23a80a[_0xdda2('0x38')],_0x4b9481[_0xdda2('0x34')]));_0x2411e8[_0xdda2('0x3e')][_0xdda2('0x5a')]=_0x1ba7dd['id'];if(_0x23a80a[_0xdda2('0x38')]['filter']){_0x2411e8[_0xdda2('0x3e')]=_[_0xdda2('0x42')](_0x2411e8['where'],{'$or':_[_0xdda2('0x2f')](_0x2411e8[_0xdda2('0x35')],function(_0x4b57df){var _0x2da4a7={};_0x2da4a7[_0x4b57df]={'$like':'%'+_0x23a80a[_0xdda2('0x38')][_0xdda2('0x40')]+'%'};return _0x2da4a7;})});}_0x2411e8=_['merge']({},_0x2411e8,_0x23a80a[_0xdda2('0x4b')]);return db['CmHopperHistory'][_0xdda2('0x1c')]({'where':_0x2411e8[_0xdda2('0x3e')]})[_0xdda2('0x26')](function(_0x17852d){_0x221f72['count']=_0x17852d;if(_0x23a80a['query'][_0xdda2('0x4a')]){_0x2411e8[_0xdda2('0x44')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xdda2('0x45')](_0x2411e8);})[_0xdda2('0x26')](function(_0x130108){_0x221f72[_0xdda2('0x46')]=_0x130108;return _0x221f72;});}})[_0xdda2('0x26')](respondWithFilteredResult(_0x285cb2,_0x2411e8))[_0xdda2('0x47')](handleError(_0x285cb2,null));};exports[_0xdda2('0x5d')]=function(_0x362078,_0x3046c1,_0x26e599){var _0x37f066={'raw':!![],'where':{}};var _0x1527e0={};var _0x528185={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x362078[_0xdda2('0x48')]['id']}})['then'](handleEntityNotFound(_0x3046c1,null))[_0xdda2('0x26')](function(_0x323af8){if(_0x323af8){_0x1527e0[_0xdda2('0x32')]=_[_0xdda2('0x33')](db['CmHopperFinal'][_0xdda2('0x30')]);_0x1527e0[_0xdda2('0x38')]=_[_0xdda2('0x33')](_0x362078['query']);_0x1527e0[_0xdda2('0x34')]=_[_0xdda2('0x36')](_0x1527e0[_0xdda2('0x32')],_0x1527e0['query']);_0x37f066['attributes']=_[_0xdda2('0x36')](_0x1527e0[_0xdda2('0x32')],qs[_0xdda2('0x37')](_0x362078['query'][_0xdda2('0x37')]));_0x37f066[_0xdda2('0x35')]=_0x37f066[_0xdda2('0x35')][_0xdda2('0x39')]?_0x37f066[_0xdda2('0x35')]:_0x1527e0[_0xdda2('0x32')];if(!_0x362078[_0xdda2('0x38')]['hasOwnProperty'](_0xdda2('0x3b'))){_0x37f066[_0xdda2('0x1e')]=qs[_0xdda2('0x1e')](_0x362078[_0xdda2('0x38')]['limit']);_0x37f066[_0xdda2('0x1d')]=qs[_0xdda2('0x1d')](_0x362078[_0xdda2('0x38')][_0xdda2('0x1d')]);}_0x37f066['order']=qs['sort'](_0x362078['query'][_0xdda2('0x3d')]);_0x37f066[_0xdda2('0x3e')]=qs[_0xdda2('0x34')](_[_0xdda2('0x3f')](_0x362078[_0xdda2('0x38')],_0x1527e0[_0xdda2('0x34')]));_0x37f066['where'][_0xdda2('0x5a')]=_0x323af8['id'];if(_0x362078[_0xdda2('0x38')][_0xdda2('0x40')]){_0x37f066[_0xdda2('0x3e')]=_[_0xdda2('0x42')](_0x37f066[_0xdda2('0x3e')],{'$or':_[_0xdda2('0x2f')](_0x37f066[_0xdda2('0x35')],function(_0x4cdca6){var _0x1aa741={};_0x1aa741[_0x4cdca6]={'$like':'%'+_0x362078['query'][_0xdda2('0x40')]+'%'};return _0x1aa741;})});}_0x37f066=_['merge']({},_0x37f066,_0x362078[_0xdda2('0x4b')]);return db['CmHopperFinal'][_0xdda2('0x1c')]({'where':_0x37f066[_0xdda2('0x3e')]})[_0xdda2('0x26')](function(_0x22deff){_0x528185[_0xdda2('0x1c')]=_0x22deff;if(_0x362078[_0xdda2('0x38')][_0xdda2('0x4a')]){_0x37f066[_0xdda2('0x44')]=[{'all':!![]}];}return db[_0xdda2('0x5e')]['findAll'](_0x37f066);})[_0xdda2('0x26')](function(_0x434d79){_0x528185['rows']=_0x434d79;return _0x528185;});}})[_0xdda2('0x26')](respondWithFilteredResult(_0x3046c1,_0x37f066))[_0xdda2('0x47')](handleError(_0x3046c1,null));};exports[_0xdda2('0x5f')]=function(_0x5600da,_0x1702ae,_0x21ade3){var _0x251408={'raw':!![],'where':{}};var _0x311e34={};var _0x3edca8={'count':0x0,'rows':[]};return db[_0xdda2('0x43')][_0xdda2('0x60')]({'where':{'id':_0x5600da[_0xdda2('0x48')]['id']}})[_0xdda2('0x26')](handleEntityNotFound(_0x1702ae,null))[_0xdda2('0x26')](function(_0x4d4ce2){if(_0x4d4ce2){_0x311e34[_0xdda2('0x32')]=_[_0xdda2('0x33')](db[_0xdda2('0x61')][_0xdda2('0x30')]);_0x311e34[_0xdda2('0x38')]=_['keys'](_0x5600da[_0xdda2('0x38')]);_0x311e34[_0xdda2('0x34')]=_[_0xdda2('0x36')](_0x311e34['model'],_0x311e34[_0xdda2('0x38')]);_0x251408[_0xdda2('0x35')]=_[_0xdda2('0x36')](_0x311e34['model'],qs[_0xdda2('0x37')](_0x5600da['query']['fields']));_0x251408[_0xdda2('0x35')]=_0x251408[_0xdda2('0x35')][_0xdda2('0x39')]?_0x251408[_0xdda2('0x35')]:_0x311e34[_0xdda2('0x32')];if(!_0x5600da[_0xdda2('0x38')][_0xdda2('0x3a')]('nolimit')){_0x251408['limit']=qs[_0xdda2('0x1e')](_0x5600da[_0xdda2('0x38')][_0xdda2('0x1e')]);_0x251408[_0xdda2('0x1d')]=qs[_0xdda2('0x1d')](_0x5600da['query'][_0xdda2('0x1d')]);}_0x251408[_0xdda2('0x3c')]=qs[_0xdda2('0x3d')](_0x5600da[_0xdda2('0x38')][_0xdda2('0x3d')]);_0x251408[_0xdda2('0x3e')]=qs[_0xdda2('0x34')](_[_0xdda2('0x3f')](_0x5600da[_0xdda2('0x38')],_0x311e34[_0xdda2('0x34')]));_0x251408[_0xdda2('0x3e')][_0xdda2('0x5a')]=_0x4d4ce2['id'];if(_0x5600da[_0xdda2('0x38')][_0xdda2('0x40')]){_0x251408[_0xdda2('0x3e')]=_[_0xdda2('0x42')](_0x251408['where'],{'$or':_[_0xdda2('0x2f')](_0x251408['attributes'],function(_0x7f91a5){var _0x4f2d5c={};_0x4f2d5c[_0x7f91a5]={'$like':'%'+_0x5600da[_0xdda2('0x38')]['filter']+'%'};return _0x4f2d5c;})});}_0x251408=_[_0xdda2('0x42')]({},_0x251408,_0x5600da[_0xdda2('0x4b')]);return db[_0xdda2('0x61')]['count']({'where':_0x251408[_0xdda2('0x3e')]})[_0xdda2('0x26')](function(_0x275aa8){_0x3edca8['count']=_0x275aa8;if(_0x5600da['query'][_0xdda2('0x4a')]){_0x251408['include']=[{'all':!![]}];}return db[_0xdda2('0x61')][_0xdda2('0x45')](_0x251408);})[_0xdda2('0x26')](function(_0x182570){_0x3edca8['rows']=_0x182570;return _0x3edca8;});}})[_0xdda2('0x26')](respondWithFilteredResult(_0x1702ae,_0x251408))['catch'](handleError(_0x1702ae,null));};exports['getLists']=function(_0x50d63b,_0x5235d5,_0xbdadaa){var _0x4a6058={};var _0x155dc3={};var _0x17fa61;var _0x5c09f8;return db['Campaign'][_0xdda2('0x60')]({'where':{'id':_0x50d63b[_0xdda2('0x48')]['id']}})[_0xdda2('0x26')](handleEntityNotFound(_0x5235d5,null))[_0xdda2('0x26')](function(_0x55d25d){if(_0x55d25d){_0x17fa61=_0x55d25d;_0x155dc3['model']=_[_0xdda2('0x33')](db[_0xdda2('0x62')][_0xdda2('0x30')]);_0x155dc3[_0xdda2('0x38')]=_['keys'](_0x50d63b[_0xdda2('0x38')]);_0x155dc3[_0xdda2('0x34')]=_[_0xdda2('0x36')](_0x155dc3[_0xdda2('0x32')],_0x155dc3[_0xdda2('0x38')]);_0x4a6058[_0xdda2('0x35')]=_[_0xdda2('0x36')](_0x155dc3[_0xdda2('0x32')],qs[_0xdda2('0x37')](_0x50d63b[_0xdda2('0x38')][_0xdda2('0x37')]));_0x4a6058[_0xdda2('0x35')]=_0x4a6058[_0xdda2('0x35')][_0xdda2('0x39')]?_0x4a6058[_0xdda2('0x35')]:_0x155dc3[_0xdda2('0x32')];_0x4a6058['order']=qs[_0xdda2('0x3d')](_0x50d63b[_0xdda2('0x38')][_0xdda2('0x3d')]);_0x4a6058[_0xdda2('0x3e')]=qs[_0xdda2('0x34')](_[_0xdda2('0x3f')](_0x50d63b[_0xdda2('0x38')],_0x155dc3[_0xdda2('0x34')]));if(_0x50d63b[_0xdda2('0x38')][_0xdda2('0x40')]){_0x4a6058[_0xdda2('0x3e')]=_[_0xdda2('0x42')](_0x4a6058[_0xdda2('0x3e')],{'$or':_[_0xdda2('0x2f')](_0x4a6058[_0xdda2('0x35')],function(_0x5308f1){var _0x17c084={};_0x17c084[_0x5308f1]={'$like':'%'+_0x50d63b[_0xdda2('0x38')][_0xdda2('0x40')]+'%'};return _0x17c084;})});}_0x4a6058=_[_0xdda2('0x42')]({},_0x4a6058,_0x50d63b[_0xdda2('0x4b')]);return _0x17fa61[_0xdda2('0x63')](_0x4a6058);}})[_0xdda2('0x26')](function(_0x3945e5){if(_0x3945e5){_0x5c09f8=_0x3945e5[_0xdda2('0x39')];if(!_0x50d63b[_0xdda2('0x38')]['hasOwnProperty'](_0xdda2('0x3b'))){_0x4a6058['limit']=qs['limit'](_0x50d63b[_0xdda2('0x38')][_0xdda2('0x1e')]);_0x4a6058[_0xdda2('0x1d')]=qs[_0xdda2('0x1d')](_0x50d63b[_0xdda2('0x38')]['offset']);}return _0x17fa61[_0xdda2('0x63')](_0x4a6058);}})[_0xdda2('0x26')](function(_0x1cd6cf){if(_0x1cd6cf){return _0x1cd6cf?{'count':_0x5c09f8,'rows':_0x1cd6cf}:null;}})[_0xdda2('0x26')](respondWithResult(_0x5235d5,null))[_0xdda2('0x47')](handleError(_0x5235d5,null));};exports[_0xdda2('0x64')]=function(_0xc7ffe4,_0x4431ee,_0x577f44){var _0x5738f9,_0x3795b2;return db[_0xdda2('0x43')][_0xdda2('0x55')]({'where':{'id':_0xc7ffe4['params']['id']}})['then'](handleEntityNotFound(_0x4431ee,null))['then'](function(_0x78bde2){if(_0x78bde2){_0x3795b2=_0x78bde2;return _0x78bde2[_0xdda2('0x64')](_0xc7ffe4[_0xdda2('0x4c')][_0xdda2('0x65')],_['omit'](_0xc7ffe4[_0xdda2('0x4c')],['ids','id'])||{});}return null;})[_0xdda2('0x66')](function(_0x4dcdce){var _0x24cc9c;_0x5738f9=_0x4dcdce||[];var _0x223c52=[];if(_0x4dcdce){for(var _0x18544c=0x0;_0x18544c<_0x4dcdce['length'];_0x18544c+=0x1){var _0x335dc1=_0x4dcdce[_0x18544c][_0xdda2('0x28')]({'plain':!![]});_0x3795b2[_0xdda2('0x67')]=_0xc7ffe4['body'][_0xdda2('0x67')]?_0xc7ffe4[_0xdda2('0x4c')]['dialCheckDuplicateType']:_0x3795b2[_0xdda2('0x67')];switch(_0x3795b2[_0xdda2('0x67')]){case'always':_0x24cc9c=squel['insert']()['into'](_0xdda2('0x68'))['fromQuery'](['phone',_0xdda2('0x69'),_0xdda2('0x6a'),_0xdda2('0x6b'),_0xdda2('0x5a'),_0xdda2('0x56'),_0xdda2('0x57')],squel['select']()['field'](_0xdda2('0x6c'),'phone')[_0xdda2('0x6d')](_0xdda2('0x6e'),_0xdda2('0x69'))[_0xdda2('0x6d')]('id',_0xdda2('0x6a'))[_0xdda2('0x6d')](_0x335dc1['CmListId'][_0xdda2('0x6f')](),'ListId')[_0xdda2('0x6d')](_0xc7ffe4[_0xdda2('0x48')]['id'][_0xdda2('0x6f')](),_0xdda2('0x5a'))[_0xdda2('0x6d')](_0xdda2('0x6e'),_0xdda2('0x56'))[_0xdda2('0x6d')](_0xdda2('0x6e'),_0xdda2('0x57'))[_0xdda2('0x70')](_0xdda2('0x71'))[_0xdda2('0x3e')](_0xdda2('0x72'))[_0xdda2('0x3e')](_0xdda2('0x73'),_0x335dc1['CmListId'][_0xdda2('0x6f')]())[_0xdda2('0x3e')](_0xdda2('0x74'))[_0xdda2('0x3e')](_0xdda2('0x75'),squel[_0xdda2('0x76')]()[_0xdda2('0x6d')](_0xdda2('0x77'))[_0xdda2('0x70')](_0xdda2('0x78'))['where']('CampaignId\x20=\x20?',_0xc7ffe4['params']['id'][_0xdda2('0x6f')]()))[_0xdda2('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xdda2('0x76')]()[_0xdda2('0x6d')](_0xdda2('0x79'))[_0xdda2('0x70')](_0xdda2('0x68'))[_0xdda2('0x3e')]('CampaignId\x20=\x20?',_0xc7ffe4[_0xdda2('0x48')]['id']['toString']())))[_0xdda2('0x6f')]();break;case _0xdda2('0x7a'):_0x24cc9c=squel[_0xdda2('0x7b')]()['into'](_0xdda2('0x68'))[_0xdda2('0x7c')]([_0xdda2('0x6c'),_0xdda2('0x69'),'ContactId',_0xdda2('0x6b'),_0xdda2('0x5a'),_0xdda2('0x56'),_0xdda2('0x57')],squel[_0xdda2('0x76')]()['field'](_0xdda2('0x6c'),'phone')[_0xdda2('0x6d')](_0xdda2('0x6e'),_0xdda2('0x69'))['field']('id',_0xdda2('0x6a'))[_0xdda2('0x6d')](_0x335dc1[_0xdda2('0x7d')][_0xdda2('0x6f')](),_0xdda2('0x6b'))[_0xdda2('0x6d')](_0xc7ffe4[_0xdda2('0x48')]['id'][_0xdda2('0x6f')](),_0xdda2('0x5a'))[_0xdda2('0x6d')](_0xdda2('0x6e'),_0xdda2('0x56'))[_0xdda2('0x6d')](_0xdda2('0x6e'),_0xdda2('0x57'))['from'](_0xdda2('0x71'))['where'](_0xdda2('0x72'))[_0xdda2('0x3e')]('ListId\x20=\x20?',_0x335dc1[_0xdda2('0x7d')][_0xdda2('0x6f')]())[_0xdda2('0x3e')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xdda2('0x76')]()[_0xdda2('0x6d')](_0xdda2('0x79'))['from'](_0xdda2('0x68'))[_0xdda2('0x3e')]('CampaignId\x20=\x20?',_0xc7ffe4[_0xdda2('0x48')]['id'][_0xdda2('0x6f')]())))[_0xdda2('0x6f')]();break;default:_0x24cc9c=squel['insert']()[_0xdda2('0x7e')](_0xdda2('0x68'))[_0xdda2('0x7c')]([_0xdda2('0x6c'),_0xdda2('0x69'),'ContactId',_0xdda2('0x6b'),'CampaignId',_0xdda2('0x56'),_0xdda2('0x57')],squel[_0xdda2('0x76')]()['field']('phone',_0xdda2('0x6c'))[_0xdda2('0x6d')](_0xdda2('0x6e'),_0xdda2('0x69'))[_0xdda2('0x6d')]('id',_0xdda2('0x6a'))[_0xdda2('0x6d')](_0x335dc1['CmListId'][_0xdda2('0x6f')](),_0xdda2('0x6b'))['field'](_0xc7ffe4[_0xdda2('0x48')]['id'][_0xdda2('0x6f')](),_0xdda2('0x5a'))[_0xdda2('0x6d')](_0xdda2('0x6e'),'createdAt')[_0xdda2('0x6d')](_0xdda2('0x6e'),_0xdda2('0x57'))[_0xdda2('0x70')](_0xdda2('0x71'))['where']('deletedAt\x20IS\x20NULL')[_0xdda2('0x3e')](_0xdda2('0x73'),_0x335dc1[_0xdda2('0x7d')][_0xdda2('0x6f')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xdda2('0x6f')]();}_0x223c52[_0xdda2('0x7f')](db[_0xdda2('0x80')][_0xdda2('0x38')](_0x24cc9c));}return BPromise[_0xdda2('0x81')](_0x223c52);}})[_0xdda2('0x26')](function(){return _0x5738f9;})[_0xdda2('0x26')](respondWithResult(_0x4431ee,null))['catch'](handleError(_0x4431ee,null));};exports['removeLists']=function(_0x277248,_0x465af2,_0x47f684){return db[_0xdda2('0x43')][_0xdda2('0x55')]({'where':{'id':_0x277248[_0xdda2('0x48')]['id']}})[_0xdda2('0x26')](handleEntityNotFound(_0x465af2,null))['then'](function(_0x3896bb){if(_0x3896bb){return _0x3896bb[_0xdda2('0x82')](_0x277248[_0xdda2('0x38')][_0xdda2('0x65')]);}})['then'](function(_0x33d79f){if(_0x33d79f){return db['CmHopper']['destroy']({'where':{'ListId':_0x277248['query'][_0xdda2('0x65')],'CampaignId':_0x277248[_0xdda2('0x48')]['id']}})[_0xdda2('0x26')](function(){return _0x33d79f;});}})[_0xdda2('0x26')](respondWithStatusCode(_0x465af2,null))[_0xdda2('0x47')](handleError(_0x465af2,null));};exports['getBlackLists']=function(_0xeb204f,_0x2b5b85,_0x4eb2b1){var _0x202a23={'raw':!![],'where':{}};var _0x3eecea={};var _0x153934={'count':0x0,'rows':[]};return db[_0xdda2('0x43')][_0xdda2('0x60')]({'where':{'id':_0xeb204f[_0xdda2('0x48')]['id']}})[_0xdda2('0x26')](handleEntityNotFound(_0x2b5b85,null))[_0xdda2('0x26')](function(_0x4b7ad8){if(_0x4b7ad8){_0x3eecea['model']=_[_0xdda2('0x33')](db[_0xdda2('0x62')][_0xdda2('0x30')]);_0x3eecea[_0xdda2('0x38')]=_[_0xdda2('0x33')](_0xeb204f[_0xdda2('0x38')]);_0x3eecea[_0xdda2('0x34')]=_[_0xdda2('0x36')](_0x3eecea[_0xdda2('0x32')],_0x3eecea[_0xdda2('0x38')]);_0x202a23[_0xdda2('0x35')]=_['intersection'](_0x3eecea[_0xdda2('0x32')],qs[_0xdda2('0x37')](_0xeb204f[_0xdda2('0x38')][_0xdda2('0x37')]));_0x202a23[_0xdda2('0x35')]=_0x202a23[_0xdda2('0x35')][_0xdda2('0x39')]?_0x202a23['attributes']:_0x3eecea[_0xdda2('0x32')];if(!_0xeb204f[_0xdda2('0x38')][_0xdda2('0x3a')](_0xdda2('0x3b'))){_0x202a23[_0xdda2('0x1e')]=qs['limit'](_0xeb204f[_0xdda2('0x38')][_0xdda2('0x1e')]);_0x202a23[_0xdda2('0x1d')]=qs[_0xdda2('0x1d')](_0xeb204f[_0xdda2('0x38')]['offset']);}_0x202a23[_0xdda2('0x3c')]=qs['sort'](_0xeb204f['query'][_0xdda2('0x3d')]);_0x202a23['where']=qs[_0xdda2('0x34')](_[_0xdda2('0x3f')](_0xeb204f[_0xdda2('0x38')],_0x3eecea[_0xdda2('0x34')]));_0x202a23[_0xdda2('0x3e')][_0xdda2('0x5a')]=_0x4b7ad8['id'];if(_0xeb204f[_0xdda2('0x38')][_0xdda2('0x40')]){_0x202a23[_0xdda2('0x3e')]=_[_0xdda2('0x42')](_0x202a23[_0xdda2('0x3e')],{'$or':_[_0xdda2('0x2f')](_0x202a23[_0xdda2('0x35')],function(_0x121255){var _0x18a8f7={};_0x18a8f7[_0x121255]={'$like':'%'+_0xeb204f[_0xdda2('0x38')]['filter']+'%'};return _0x18a8f7;})});}_0x202a23=_['merge']({},_0x202a23,_0xeb204f[_0xdda2('0x4b')]);return db[_0xdda2('0x62')]['count']({'where':_0x202a23[_0xdda2('0x3e')]})[_0xdda2('0x26')](function(_0x2fbad0){_0x153934['count']=_0x2fbad0;if(_0xeb204f['query'][_0xdda2('0x4a')]){_0x202a23[_0xdda2('0x44')]=[{'all':!![]}];}return db['CmList'][_0xdda2('0x45')](_0x202a23);})[_0xdda2('0x26')](function(_0x2d58f3){_0x153934[_0xdda2('0x46')]=_0x2d58f3;return _0x153934;});}})[_0xdda2('0x26')](respondWithFilteredResult(_0x2b5b85,_0x202a23))[_0xdda2('0x47')](handleError(_0x2b5b85,null));};exports[_0xdda2('0x83')]=function(_0x391634,_0x1e96bf,_0x216ddd){var _0x39a334,_0xeedb00;return db['Campaign'][_0xdda2('0x55')]({'where':{'id':_0x391634['params']['id']}})['then'](handleEntityNotFound(_0x1e96bf,null))[_0xdda2('0x26')](function(_0x7317e0){if(_0x7317e0){_0xeedb00=_0x7317e0;return _0x7317e0[_0xdda2('0x83')](_0x391634[_0xdda2('0x4c')]['ids'],_[_0xdda2('0x84')](_0x391634[_0xdda2('0x4c')],[_0xdda2('0x65'),'id'])||{});}return null;})[_0xdda2('0x66')](function(_0x546969){var _0x55d75a;_0x39a334=_0x546969||[];var _0x1fd5db=[];if(_0x546969){for(var _0x34af22=0x0;_0x34af22<_0x546969[_0xdda2('0x39')];_0x34af22+=0x1){var _0x383421=_0x546969[_0x34af22][_0xdda2('0x28')]({'plain':!![]});_0x55d75a=squel[_0xdda2('0x7b')]()[_0xdda2('0x7e')](_0xdda2('0x85'))[_0xdda2('0x7c')]([_0xdda2('0x6c'),_0xdda2('0x6a'),'ListId',_0xdda2('0x5a'),'createdAt',_0xdda2('0x57')],squel['select']()[_0xdda2('0x6d')](_0xdda2('0x6c'),_0xdda2('0x6c'))[_0xdda2('0x6d')]('id','ContactId')['field'](_0x383421[_0xdda2('0x7d')][_0xdda2('0x6f')](),_0xdda2('0x6b'))[_0xdda2('0x6d')](_0x391634['params']['id'][_0xdda2('0x6f')](),_0xdda2('0x5a'))[_0xdda2('0x6d')](_0xdda2('0x6e'),_0xdda2('0x56'))[_0xdda2('0x6d')](_0xdda2('0x6e'),_0xdda2('0x57'))[_0xdda2('0x70')](_0xdda2('0x71'))[_0xdda2('0x3e')](_0xdda2('0x72'))[_0xdda2('0x3e')](_0xdda2('0x73'),_0x383421['CmListId'][_0xdda2('0x6f')]())[_0xdda2('0x3e')]('phone\x20IS\x20NOT\x20NULL'))[_0xdda2('0x6f')]();_0x1fd5db[_0xdda2('0x7f')](db[_0xdda2('0x80')][_0xdda2('0x38')](_0x55d75a));}return BPromise[_0xdda2('0x81')](_0x1fd5db);}})[_0xdda2('0x26')](function(){return _0x39a334;})['then'](respondWithResult(_0x1e96bf,null))[_0xdda2('0x47')](handleError(_0x1e96bf,null));};exports[_0xdda2('0x86')]=function(_0x50dfd6,_0x4fe8dc,_0x31bd58){return db[_0xdda2('0x43')][_0xdda2('0x55')]({'where':{'id':_0x50dfd6[_0xdda2('0x48')]['id']}})['then'](handleEntityNotFound(_0x4fe8dc,null))['then'](function(_0x56bff0){if(_0x56bff0){return _0x56bff0[_0xdda2('0x86')](_0x50dfd6[_0xdda2('0x38')][_0xdda2('0x65')]);}})[_0xdda2('0x26')](function(_0x5bc0e4){if(_0x5bc0e4){return db[_0xdda2('0x61')][_0xdda2('0x27')]({'where':{'ListId':_0x50dfd6['query'][_0xdda2('0x65')],'CampaignId':_0x50dfd6[_0xdda2('0x48')]['id']}})['then'](function(){return _0x5bc0e4;});}})[_0xdda2('0x26')](respondWithStatusCode(_0x4fe8dc,null))['catch'](handleError(_0x4fe8dc,null));}; \ No newline at end of file +var _0xeca8=['model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','where','filter','merge','VIRTUAL','options','include','findAll','rows','params','keys','Campaign','filtears','length','includeAll','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','body','userProfileId','autoAssociation','getHoppers','findOne','CmHopper','sort','CampaignId','getHopperHistories','CmHopperHistory','pick','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','omit','spread','dialCheckDuplicateType','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','CmListId','cm_contacts','cm_hopper','push','sequelize','destroy','getBlackLists','CmList','addBlackLists','all','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','count','offset','Content-Range','save','update','then','get','IvrCampaigns','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x497b43,_0x583d35){var _0xba34e9=function(_0x3a5c6f){while(--_0x3a5c6f){_0x497b43['push'](_0x497b43['shift']());}};_0xba34e9(++_0x583d35);}(_0xeca8,0x1f2));var _0x8eca=function(_0x4091f8,_0x10f82a){_0x4091f8=_0x4091f8-0x0;var _0x2028f5=_0xeca8[_0x4091f8];return _0x2028f5;};'use strict';var pdf=require(_0x8eca('0x0'));var emlformat=require(_0x8eca('0x1'));var rimraf=require(_0x8eca('0x2'));var zipdir=require(_0x8eca('0x3'));var jsonpatch=require(_0x8eca('0x4'));var rp=require(_0x8eca('0x5'));var moment=require('moment');var BPromise=require(_0x8eca('0x6'));var Mustache=require('mustache');var util=require(_0x8eca('0x7'));var path=require(_0x8eca('0x8'));var sox=require(_0x8eca('0x9'));var csv=require('to-csv');var ejs=require(_0x8eca('0xa'));var fs=require('fs');var _=require(_0x8eca('0xb'));var squel=require(_0x8eca('0xc'));var crypto=require(_0x8eca('0xd'));var jsforce=require(_0x8eca('0xe'));var deskjs=require(_0x8eca('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8eca('0x10'));var Papa=require(_0x8eca('0x11'));var Redis=require(_0x8eca('0x12'));var authService=require(_0x8eca('0x13'));var qs=require(_0x8eca('0x14'));var as=require(_0x8eca('0x15'));var hardwareService=require(_0x8eca('0x16'));var logger=require(_0x8eca('0x17'))(_0x8eca('0x18'));var utils=require(_0x8eca('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8eca('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdbd075,_0x642d77){_0x642d77=_0x642d77||0xcc;return function(_0x483804){if(_0x483804){return _0xdbd075[_0x8eca('0x1b')](_0x642d77);}return _0xdbd075['status'](_0x642d77)['end']();};}function respondWithResult(_0x581286,_0x178f9b){_0x178f9b=_0x178f9b||0xc8;return function(_0x36b8f1){if(_0x36b8f1){return _0x581286[_0x8eca('0x1c')](_0x178f9b)[_0x8eca('0x1d')](_0x36b8f1);}};}function respondWithFilteredResult(_0x44f68d,_0x22bc70){return function(_0xd23ac1){if(_0xd23ac1){var _0x4e390c=_0xd23ac1[_0x8eca('0x1e')],_0x15be36=_0x22bc70[_0x8eca('0x1f')],_0x1f7012=_0x22bc70['offset']+_0x22bc70['limit'],_0x4b8c67;if(_0x1f7012>=_0x4e390c){_0x1f7012=_0x4e390c;_0x4b8c67=0xc8;}else{_0x4b8c67=0xce;}_0x44f68d[_0x8eca('0x1c')](_0x4b8c67);return _0x44f68d['set'](_0x8eca('0x20'),_0x15be36+'-'+_0x1f7012+'/'+_0x4e390c)[_0x8eca('0x1d')](_0xd23ac1);}return null;};}function patchUpdates(_0x41f0d9){return function(_0x3860df){try{jsonpatch['apply'](_0x3860df,_0x41f0d9,!![]);}catch(_0x1b8151){return BPromise['reject'](_0x1b8151);}return _0x3860df[_0x8eca('0x21')]();};}function saveUpdates(_0x536d40,_0x373117){return function(_0x14af03){if(_0x14af03){return _0x14af03[_0x8eca('0x22')](_0x536d40)[_0x8eca('0x23')](function(_0x1cf97a){return _0x1cf97a;});}return null;};}function removeEntity(_0x3f6caf,_0x4cecf6){return function(_0xacfa9c){if(_0xacfa9c){return _0xacfa9c['destroy']()['then'](function(){var _0x2dc12e=_0xacfa9c[_0x8eca('0x24')]({'plain':!![]});var _0x2de054=_0x8eca('0x25');return db[_0x8eca('0x26')]['destroy']({'where':{'type':_0x2de054,'resourceId':_0x2dc12e['id']}})[_0x8eca('0x23')](function(){return _0xacfa9c;});})['then'](function(){_0x3f6caf[_0x8eca('0x1c')](0xcc)[_0x8eca('0x27')]();});}};}function handleEntityNotFound(_0x18ae97,_0x3e1f66){return function(_0x35a2de){if(!_0x35a2de){_0x18ae97[_0x8eca('0x1b')](0x194);}return _0x35a2de;};}function handleError(_0x33e4db,_0x448def){_0x448def=_0x448def||0x1f4;return function(_0x4e524f){logger[_0x8eca('0x28')](_0x4e524f[_0x8eca('0x29')]);if(_0x4e524f[_0x8eca('0x2a')]){delete _0x4e524f[_0x8eca('0x2a')];}_0x33e4db[_0x8eca('0x1c')](_0x448def)[_0x8eca('0x2b')](_0x4e524f);};}exports[_0x8eca('0x2c')]=function(_0x189ecf,_0x36b286){var _0x497122={},_0x1e26ce={},_0x14b57d={'count':0x0,'rows':[]};var _0x372f13=_[_0x8eca('0x2d')](db['Campaign'][_0x8eca('0x2e')],function(_0x475362){return{'name':_0x475362[_0x8eca('0x2f')],'type':_0x475362[_0x8eca('0x30')][_0x8eca('0x31')]};});_0x1e26ce[_0x8eca('0x32')]=_[_0x8eca('0x2d')](_0x372f13,_0x8eca('0x2a'));_0x1e26ce[_0x8eca('0x33')]=_['keys'](_0x189ecf['query']);_0x1e26ce[_0x8eca('0x34')]=_[_0x8eca('0x35')](_0x1e26ce[_0x8eca('0x32')],_0x1e26ce[_0x8eca('0x33')]);_0x497122[_0x8eca('0x36')]=_[_0x8eca('0x35')](_0x1e26ce[_0x8eca('0x32')],qs[_0x8eca('0x37')](_0x189ecf[_0x8eca('0x33')][_0x8eca('0x37')]));_0x497122['attributes']=_0x497122['attributes']['length']?_0x497122[_0x8eca('0x36')]:_0x1e26ce[_0x8eca('0x32')];if(!_0x189ecf[_0x8eca('0x33')][_0x8eca('0x38')](_0x8eca('0x39'))){_0x497122[_0x8eca('0x3a')]=qs[_0x8eca('0x3a')](_0x189ecf[_0x8eca('0x33')][_0x8eca('0x3a')]);_0x497122[_0x8eca('0x1f')]=qs[_0x8eca('0x1f')](_0x189ecf[_0x8eca('0x33')][_0x8eca('0x1f')]);}_0x497122[_0x8eca('0x3b')]=qs['sort'](_0x189ecf[_0x8eca('0x33')]['sort']);_0x497122[_0x8eca('0x3c')]=qs[_0x8eca('0x34')](_['pick'](_0x189ecf[_0x8eca('0x33')],_0x1e26ce['filters']),_0x372f13);if(_0x189ecf[_0x8eca('0x33')][_0x8eca('0x3d')]){_0x497122[_0x8eca('0x3c')]=_[_0x8eca('0x3e')](_0x497122[_0x8eca('0x3c')],{'$or':_[_0x8eca('0x2d')](_0x372f13,function(_0x14a951){if(_0x14a951[_0x8eca('0x30')]!==_0x8eca('0x3f')){var _0x2381e7={};_0x2381e7[_0x14a951[_0x8eca('0x2a')]]={'$like':'%'+_0x189ecf[_0x8eca('0x33')][_0x8eca('0x3d')]+'%'};return _0x2381e7;}})});}_0x497122=_['merge']({},_0x497122,_0x189ecf[_0x8eca('0x40')]);var _0x2b6222={'where':_0x497122[_0x8eca('0x3c')]};return db['Campaign'][_0x8eca('0x1e')](_0x2b6222)['then'](function(_0x237b57){_0x14b57d['count']=_0x237b57;if(_0x189ecf['query']['includeAll']){_0x497122[_0x8eca('0x41')]=[{'all':!![]}];}return db['Campaign'][_0x8eca('0x42')](_0x497122);})[_0x8eca('0x23')](function(_0x4aa158){_0x14b57d[_0x8eca('0x43')]=_0x4aa158;return _0x14b57d;})['then'](respondWithFilteredResult(_0x36b286,_0x497122))['catch'](handleError(_0x36b286,null));};exports['show']=function(_0x569b60,_0x29f030){var _0x5135e8={'raw':![],'where':{'id':_0x569b60[_0x8eca('0x44')]['id']}},_0x3d6c1f={};_0x3d6c1f['model']=_[_0x8eca('0x45')](db[_0x8eca('0x46')][_0x8eca('0x2e')]);_0x3d6c1f[_0x8eca('0x33')]=_['keys'](_0x569b60[_0x8eca('0x33')]);_0x3d6c1f[_0x8eca('0x47')]=_[_0x8eca('0x35')](_0x3d6c1f['model'],_0x3d6c1f[_0x8eca('0x33')]);_0x5135e8[_0x8eca('0x36')]=_[_0x8eca('0x35')](_0x3d6c1f[_0x8eca('0x32')],qs[_0x8eca('0x37')](_0x569b60['query'][_0x8eca('0x37')]));_0x5135e8[_0x8eca('0x36')]=_0x5135e8[_0x8eca('0x36')][_0x8eca('0x48')]?_0x5135e8['attributes']:_0x3d6c1f['model'];if(_0x569b60['query'][_0x8eca('0x49')]){_0x5135e8['include']=[{'all':!![]}];}_0x5135e8=_[_0x8eca('0x3e')]({},_0x5135e8,_0x569b60[_0x8eca('0x40')]);return db['Campaign'][_0x8eca('0x4a')](_0x5135e8)[_0x8eca('0x23')](handleEntityNotFound(_0x29f030,null))['then'](respondWithResult(_0x29f030,null))[_0x8eca('0x4b')](handleError(_0x29f030,null));};exports['create']=function(_0x2d0d58,_0x83b0ba){return db[_0x8eca('0x46')][_0x8eca('0x4c')](_0x2d0d58['body'],{})['then'](function(_0x5c6596){var _0xfbb46e=_0x2d0d58['user']['get']({'plain':!![]});if(!_0xfbb46e)throw new Error(_0x8eca('0x4d'));if(_0xfbb46e[_0x8eca('0x4e')]===_0x8eca('0x4f')){var _0x293aaf=_0x5c6596[_0x8eca('0x24')]({'plain':!![]});var _0x1be27f='IvrCampaigns';return db[_0x8eca('0x50')][_0x8eca('0x4a')]({'where':{'name':_0x1be27f,'userProfileId':_0xfbb46e['userProfileId']},'raw':!![]})[_0x8eca('0x23')](function(_0x16ff4e){if(_0x16ff4e&&_0x16ff4e['autoAssociation']===0x0){return db[_0x8eca('0x26')][_0x8eca('0x4c')]({'name':_0x293aaf[_0x8eca('0x2a')],'resourceId':_0x293aaf['id'],'type':_0x16ff4e[_0x8eca('0x2a')],'sectionId':_0x16ff4e['id']},{})['then'](function(){return _0x5c6596;});}else{return _0x5c6596;}})['catch'](function(_0x3a41e5){logger['error'](_0x8eca('0x51'),_0x3a41e5);throw _0x3a41e5;});}return _0x5c6596;})[_0x8eca('0x23')](respondWithResult(_0x83b0ba,0xc9))[_0x8eca('0x4b')](handleError(_0x83b0ba,null));};exports[_0x8eca('0x52')]=function(_0x1af9fb,_0x45da41){var _0x3f5a85={'where':{'id':_0x1af9fb[_0x8eca('0x44')]['id']}},_0x5eed95={};_0x5eed95[_0x8eca('0x32')]=_[_0x8eca('0x45')](db[_0x8eca('0x46')]['rawAttributes']);_0x3f5a85[_0x8eca('0x36')]=_[_0x8eca('0x35')](_0x5eed95[_0x8eca('0x32')],qs['fields'](_0x1af9fb[_0x8eca('0x33')]['fields']));_0x3f5a85[_0x8eca('0x36')]=_0x3f5a85[_0x8eca('0x36')][_0x8eca('0x48')]?_0x3f5a85[_0x8eca('0x36')]:_0x5eed95[_0x8eca('0x32')];if(_0x1af9fb[_0x8eca('0x33')][_0x8eca('0x49')]){_0x3f5a85[_0x8eca('0x41')]=[{'all':!![]}];}_0x3f5a85=_[_0x8eca('0x3e')]({},_0x3f5a85,_0x1af9fb[_0x8eca('0x40')]);return db[_0x8eca('0x46')][_0x8eca('0x4a')](_0x3f5a85)['then'](handleEntityNotFound(_0x45da41,null))[_0x8eca('0x23')](function(_0x270c55){if(_0x270c55){var _0x495bd5=_0x270c55[_0x8eca('0x24')]({'plain':!![]});_0x495bd5=qs['omit'](_0x495bd5,['id',_0x8eca('0x53'),_0x8eca('0x54')]);_0x1af9fb[_0x8eca('0x55')]=_['omit'](_0x1af9fb[_0x8eca('0x55')],['id','createdAt',_0x8eca('0x54')]);return db[_0x8eca('0x46')][_0x8eca('0x4c')](_[_0x8eca('0x3e')](_0x495bd5,_0x1af9fb[_0x8eca('0x55')]),{'include':_0x1af9fb['query']['includeAll']?[{'all':!![]}]:undefined})[_0x8eca('0x23')](function(_0x341dc5){var _0x3c3361=_0x1af9fb[_0x8eca('0x4f')][_0x8eca('0x24')]({'plain':!![]});if(!_0x3c3361)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c3361[_0x8eca('0x4e')]===_0x8eca('0x4f')){var _0x4366a0=_0x341dc5[_0x8eca('0x24')]({'plain':!![]});var _0x5ae5ac=_0x8eca('0x25');return db[_0x8eca('0x50')]['find']({'where':{'name':_0x5ae5ac,'userProfileId':_0x3c3361[_0x8eca('0x56')]},'raw':!![]})[_0x8eca('0x23')](function(_0x54ef41){if(_0x54ef41&&_0x54ef41[_0x8eca('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x4366a0[_0x8eca('0x2a')],'resourceId':_0x4366a0['id'],'type':_0x54ef41['name'],'sectionId':_0x54ef41['id']},{})[_0x8eca('0x23')](function(){return _0x341dc5;});}else{return _0x341dc5;}})[_0x8eca('0x4b')](function(_0x56bfaa){logger[_0x8eca('0x28')](_0x8eca('0x51'),_0x56bfaa);throw _0x56bfaa;});}return _0x341dc5;});}})[_0x8eca('0x23')](respondWithResult(_0x45da41,0xc9))[_0x8eca('0x4b')](handleError(_0x45da41,null));};exports[_0x8eca('0x22')]=function(_0x1a58fa,_0xeca48){if(_0x1a58fa[_0x8eca('0x55')]['id']){delete _0x1a58fa[_0x8eca('0x55')]['id'];}return db[_0x8eca('0x46')]['find']({'where':{'id':_0x1a58fa[_0x8eca('0x44')]['id']}})[_0x8eca('0x23')](handleEntityNotFound(_0xeca48,null))[_0x8eca('0x23')](saveUpdates(_0x1a58fa[_0x8eca('0x55')],null))[_0x8eca('0x23')](respondWithResult(_0xeca48,null))['catch'](handleError(_0xeca48,null));};exports['destroy']=function(_0x1ac204,_0x3a6b76){return db[_0x8eca('0x46')]['find']({'where':{'id':_0x1ac204[_0x8eca('0x44')]['id']}})[_0x8eca('0x23')](handleEntityNotFound(_0x3a6b76,null))[_0x8eca('0x23')](removeEntity(_0x3a6b76,null))['catch'](handleError(_0x3a6b76,null));};exports[_0x8eca('0x58')]=function(_0x5a5829,_0x19b43b,_0x587e16){var _0x338361={'raw':!![],'where':{}};var _0x172bd9={};var _0x314edf={'count':0x0,'rows':[]};return db[_0x8eca('0x46')][_0x8eca('0x59')]({'where':{'id':_0x5a5829[_0x8eca('0x44')]['id']}})[_0x8eca('0x23')](handleEntityNotFound(_0x19b43b,null))['then'](function(_0x49aba1){if(_0x49aba1){_0x172bd9[_0x8eca('0x32')]=_['keys'](db[_0x8eca('0x5a')][_0x8eca('0x2e')]);_0x172bd9[_0x8eca('0x33')]=_[_0x8eca('0x45')](_0x5a5829[_0x8eca('0x33')]);_0x172bd9[_0x8eca('0x34')]=_[_0x8eca('0x35')](_0x172bd9[_0x8eca('0x32')],_0x172bd9[_0x8eca('0x33')]);_0x338361[_0x8eca('0x36')]=_[_0x8eca('0x35')](_0x172bd9['model'],qs[_0x8eca('0x37')](_0x5a5829[_0x8eca('0x33')][_0x8eca('0x37')]));_0x338361['attributes']=_0x338361[_0x8eca('0x36')][_0x8eca('0x48')]?_0x338361['attributes']:_0x172bd9['model'];if(!_0x5a5829[_0x8eca('0x33')][_0x8eca('0x38')]('nolimit')){_0x338361[_0x8eca('0x3a')]=qs[_0x8eca('0x3a')](_0x5a5829['query']['limit']);_0x338361['offset']=qs[_0x8eca('0x1f')](_0x5a5829[_0x8eca('0x33')][_0x8eca('0x1f')]);}_0x338361[_0x8eca('0x3b')]=qs[_0x8eca('0x5b')](_0x5a5829[_0x8eca('0x33')][_0x8eca('0x5b')]);_0x338361[_0x8eca('0x3c')]=qs[_0x8eca('0x34')](_['pick'](_0x5a5829[_0x8eca('0x33')],_0x172bd9['filters']));_0x338361['where'][_0x8eca('0x5c')]=_0x49aba1['id'];if(_0x5a5829[_0x8eca('0x33')][_0x8eca('0x3d')]){_0x338361[_0x8eca('0x3c')]=_[_0x8eca('0x3e')](_0x338361[_0x8eca('0x3c')],{'$or':_[_0x8eca('0x2d')](_0x338361[_0x8eca('0x36')],function(_0x551cd6){var _0xa04df3={};_0xa04df3[_0x551cd6]={'$like':'%'+_0x5a5829['query'][_0x8eca('0x3d')]+'%'};return _0xa04df3;})});}_0x338361=_[_0x8eca('0x3e')]({},_0x338361,_0x5a5829[_0x8eca('0x40')]);return db[_0x8eca('0x5a')][_0x8eca('0x1e')]({'where':_0x338361[_0x8eca('0x3c')]})['then'](function(_0x273dfc){_0x314edf[_0x8eca('0x1e')]=_0x273dfc;if(_0x5a5829['query'][_0x8eca('0x49')]){_0x338361[_0x8eca('0x41')]=[{'all':!![]}];}return db[_0x8eca('0x5a')][_0x8eca('0x42')](_0x338361);})['then'](function(_0x35f8fc){_0x314edf[_0x8eca('0x43')]=_0x35f8fc;return _0x314edf;});}})[_0x8eca('0x23')](respondWithFilteredResult(_0x19b43b,_0x338361))[_0x8eca('0x4b')](handleError(_0x19b43b,null));};exports[_0x8eca('0x5d')]=function(_0x3709b0,_0xa22072,_0xc9d24a){var _0x2f0349={'raw':!![],'where':{}};var _0x2bf1c6={};var _0x213dda={'count':0x0,'rows':[]};return db['Campaign'][_0x8eca('0x59')]({'where':{'id':_0x3709b0['params']['id']}})[_0x8eca('0x23')](handleEntityNotFound(_0xa22072,null))[_0x8eca('0x23')](function(_0x3a77e5){if(_0x3a77e5){_0x2bf1c6[_0x8eca('0x32')]=_[_0x8eca('0x45')](db[_0x8eca('0x5e')][_0x8eca('0x2e')]);_0x2bf1c6[_0x8eca('0x33')]=_[_0x8eca('0x45')](_0x3709b0['query']);_0x2bf1c6[_0x8eca('0x34')]=_[_0x8eca('0x35')](_0x2bf1c6[_0x8eca('0x32')],_0x2bf1c6[_0x8eca('0x33')]);_0x2f0349[_0x8eca('0x36')]=_[_0x8eca('0x35')](_0x2bf1c6['model'],qs['fields'](_0x3709b0[_0x8eca('0x33')]['fields']));_0x2f0349[_0x8eca('0x36')]=_0x2f0349['attributes'][_0x8eca('0x48')]?_0x2f0349['attributes']:_0x2bf1c6[_0x8eca('0x32')];if(!_0x3709b0[_0x8eca('0x33')]['hasOwnProperty'](_0x8eca('0x39'))){_0x2f0349[_0x8eca('0x3a')]=qs[_0x8eca('0x3a')](_0x3709b0[_0x8eca('0x33')][_0x8eca('0x3a')]);_0x2f0349['offset']=qs['offset'](_0x3709b0[_0x8eca('0x33')]['offset']);}_0x2f0349[_0x8eca('0x3b')]=qs[_0x8eca('0x5b')](_0x3709b0[_0x8eca('0x33')][_0x8eca('0x5b')]);_0x2f0349[_0x8eca('0x3c')]=qs['filters'](_[_0x8eca('0x5f')](_0x3709b0[_0x8eca('0x33')],_0x2bf1c6[_0x8eca('0x34')]));_0x2f0349['where']['CampaignId']=_0x3a77e5['id'];if(_0x3709b0[_0x8eca('0x33')][_0x8eca('0x3d')]){_0x2f0349['where']=_[_0x8eca('0x3e')](_0x2f0349[_0x8eca('0x3c')],{'$or':_[_0x8eca('0x2d')](_0x2f0349[_0x8eca('0x36')],function(_0x258484){var _0x38e808={};_0x38e808[_0x258484]={'$like':'%'+_0x3709b0[_0x8eca('0x33')][_0x8eca('0x3d')]+'%'};return _0x38e808;})});}_0x2f0349=_[_0x8eca('0x3e')]({},_0x2f0349,_0x3709b0['options']);return db[_0x8eca('0x5e')][_0x8eca('0x1e')]({'where':_0x2f0349[_0x8eca('0x3c')]})[_0x8eca('0x23')](function(_0x5e33ac){_0x213dda[_0x8eca('0x1e')]=_0x5e33ac;if(_0x3709b0['query'][_0x8eca('0x49')]){_0x2f0349[_0x8eca('0x41')]=[{'all':!![]}];}return db[_0x8eca('0x5e')][_0x8eca('0x42')](_0x2f0349);})[_0x8eca('0x23')](function(_0x2d034b){_0x213dda[_0x8eca('0x43')]=_0x2d034b;return _0x213dda;});}})['then'](respondWithFilteredResult(_0xa22072,_0x2f0349))[_0x8eca('0x4b')](handleError(_0xa22072,null));};exports[_0x8eca('0x60')]=function(_0x451a08,_0x22b8fc,_0x5f2d98){var _0x2dbc5c={'raw':!![],'where':{}};var _0x58b64b={};var _0x56f69e={'count':0x0,'rows':[]};return db[_0x8eca('0x46')][_0x8eca('0x59')]({'where':{'id':_0x451a08[_0x8eca('0x44')]['id']}})['then'](handleEntityNotFound(_0x22b8fc,null))[_0x8eca('0x23')](function(_0x1a64e3){if(_0x1a64e3){_0x58b64b[_0x8eca('0x32')]=_['keys'](db[_0x8eca('0x61')]['rawAttributes']);_0x58b64b[_0x8eca('0x33')]=_[_0x8eca('0x45')](_0x451a08[_0x8eca('0x33')]);_0x58b64b['filters']=_[_0x8eca('0x35')](_0x58b64b[_0x8eca('0x32')],_0x58b64b['query']);_0x2dbc5c[_0x8eca('0x36')]=_[_0x8eca('0x35')](_0x58b64b['model'],qs['fields'](_0x451a08['query'][_0x8eca('0x37')]));_0x2dbc5c[_0x8eca('0x36')]=_0x2dbc5c[_0x8eca('0x36')][_0x8eca('0x48')]?_0x2dbc5c['attributes']:_0x58b64b[_0x8eca('0x32')];if(!_0x451a08[_0x8eca('0x33')][_0x8eca('0x38')](_0x8eca('0x39'))){_0x2dbc5c[_0x8eca('0x3a')]=qs[_0x8eca('0x3a')](_0x451a08[_0x8eca('0x33')]['limit']);_0x2dbc5c['offset']=qs['offset'](_0x451a08[_0x8eca('0x33')][_0x8eca('0x1f')]);}_0x2dbc5c['order']=qs['sort'](_0x451a08[_0x8eca('0x33')][_0x8eca('0x5b')]);_0x2dbc5c['where']=qs[_0x8eca('0x34')](_['pick'](_0x451a08['query'],_0x58b64b[_0x8eca('0x34')]));_0x2dbc5c[_0x8eca('0x3c')][_0x8eca('0x5c')]=_0x1a64e3['id'];if(_0x451a08[_0x8eca('0x33')]['filter']){_0x2dbc5c[_0x8eca('0x3c')]=_[_0x8eca('0x3e')](_0x2dbc5c['where'],{'$or':_[_0x8eca('0x2d')](_0x2dbc5c[_0x8eca('0x36')],function(_0x56338b){var _0x234f2d={};_0x234f2d[_0x56338b]={'$like':'%'+_0x451a08['query']['filter']+'%'};return _0x234f2d;})});}_0x2dbc5c=_[_0x8eca('0x3e')]({},_0x2dbc5c,_0x451a08[_0x8eca('0x40')]);return db[_0x8eca('0x61')]['count']({'where':_0x2dbc5c[_0x8eca('0x3c')]})[_0x8eca('0x23')](function(_0x5427b7){_0x56f69e['count']=_0x5427b7;if(_0x451a08[_0x8eca('0x33')][_0x8eca('0x49')]){_0x2dbc5c[_0x8eca('0x41')]=[{'all':!![]}];}return db[_0x8eca('0x61')][_0x8eca('0x42')](_0x2dbc5c);})['then'](function(_0x417cd7){_0x56f69e[_0x8eca('0x43')]=_0x417cd7;return _0x56f69e;});}})[_0x8eca('0x23')](respondWithFilteredResult(_0x22b8fc,_0x2dbc5c))[_0x8eca('0x4b')](handleError(_0x22b8fc,null));};exports[_0x8eca('0x62')]=function(_0x5eb04d,_0x50f33b,_0x585fd4){var _0x2cf2bf={'raw':!![],'where':{}};var _0x49558f={};var _0x51fcc5={'count':0x0,'rows':[]};return db[_0x8eca('0x46')]['findOne']({'where':{'id':_0x5eb04d[_0x8eca('0x44')]['id']}})['then'](handleEntityNotFound(_0x50f33b,null))[_0x8eca('0x23')](function(_0x4344a5){if(_0x4344a5){_0x49558f[_0x8eca('0x32')]=_[_0x8eca('0x45')](db[_0x8eca('0x63')][_0x8eca('0x2e')]);_0x49558f[_0x8eca('0x33')]=_[_0x8eca('0x45')](_0x5eb04d['query']);_0x49558f[_0x8eca('0x34')]=_['intersection'](_0x49558f[_0x8eca('0x32')],_0x49558f['query']);_0x2cf2bf[_0x8eca('0x36')]=_[_0x8eca('0x35')](_0x49558f[_0x8eca('0x32')],qs[_0x8eca('0x37')](_0x5eb04d[_0x8eca('0x33')][_0x8eca('0x37')]));_0x2cf2bf[_0x8eca('0x36')]=_0x2cf2bf[_0x8eca('0x36')]['length']?_0x2cf2bf[_0x8eca('0x36')]:_0x49558f['model'];if(!_0x5eb04d[_0x8eca('0x33')]['hasOwnProperty'](_0x8eca('0x39'))){_0x2cf2bf[_0x8eca('0x3a')]=qs[_0x8eca('0x3a')](_0x5eb04d['query'][_0x8eca('0x3a')]);_0x2cf2bf[_0x8eca('0x1f')]=qs[_0x8eca('0x1f')](_0x5eb04d[_0x8eca('0x33')]['offset']);}_0x2cf2bf[_0x8eca('0x3b')]=qs['sort'](_0x5eb04d[_0x8eca('0x33')][_0x8eca('0x5b')]);_0x2cf2bf[_0x8eca('0x3c')]=qs[_0x8eca('0x34')](_[_0x8eca('0x5f')](_0x5eb04d[_0x8eca('0x33')],_0x49558f[_0x8eca('0x34')]));_0x2cf2bf['where'][_0x8eca('0x5c')]=_0x4344a5['id'];if(_0x5eb04d['query'][_0x8eca('0x3d')]){_0x2cf2bf['where']=_[_0x8eca('0x3e')](_0x2cf2bf[_0x8eca('0x3c')],{'$or':_[_0x8eca('0x2d')](_0x2cf2bf[_0x8eca('0x36')],function(_0x5740ef){var _0x161373={};_0x161373[_0x5740ef]={'$like':'%'+_0x5eb04d[_0x8eca('0x33')][_0x8eca('0x3d')]+'%'};return _0x161373;})});}_0x2cf2bf=_[_0x8eca('0x3e')]({},_0x2cf2bf,_0x5eb04d['options']);return db[_0x8eca('0x63')][_0x8eca('0x1e')]({'where':_0x2cf2bf[_0x8eca('0x3c')]})['then'](function(_0x436552){_0x51fcc5[_0x8eca('0x1e')]=_0x436552;if(_0x5eb04d[_0x8eca('0x33')][_0x8eca('0x49')]){_0x2cf2bf[_0x8eca('0x41')]=[{'all':!![]}];}return db[_0x8eca('0x63')]['findAll'](_0x2cf2bf);})[_0x8eca('0x23')](function(_0x372243){_0x51fcc5[_0x8eca('0x43')]=_0x372243;return _0x51fcc5;});}})[_0x8eca('0x23')](respondWithFilteredResult(_0x50f33b,_0x2cf2bf))[_0x8eca('0x4b')](handleError(_0x50f33b,null));};exports[_0x8eca('0x64')]=function(_0x5268ef,_0x140334,_0xd8f244){var _0x3aca86={};var _0xadf009={};var _0x40903b;var _0x39ec22;return db[_0x8eca('0x46')][_0x8eca('0x59')]({'where':{'id':_0x5268ef['params']['id']}})[_0x8eca('0x23')](handleEntityNotFound(_0x140334,null))[_0x8eca('0x23')](function(_0xfe28d5){if(_0xfe28d5){_0x40903b=_0xfe28d5;_0xadf009['model']=_[_0x8eca('0x45')](db['CmList'][_0x8eca('0x2e')]);_0xadf009[_0x8eca('0x33')]=_[_0x8eca('0x45')](_0x5268ef['query']);_0xadf009[_0x8eca('0x34')]=_[_0x8eca('0x35')](_0xadf009['model'],_0xadf009[_0x8eca('0x33')]);_0x3aca86['attributes']=_[_0x8eca('0x35')](_0xadf009[_0x8eca('0x32')],qs[_0x8eca('0x37')](_0x5268ef[_0x8eca('0x33')][_0x8eca('0x37')]));_0x3aca86[_0x8eca('0x36')]=_0x3aca86[_0x8eca('0x36')][_0x8eca('0x48')]?_0x3aca86[_0x8eca('0x36')]:_0xadf009[_0x8eca('0x32')];_0x3aca86[_0x8eca('0x3b')]=qs[_0x8eca('0x5b')](_0x5268ef['query']['sort']);_0x3aca86[_0x8eca('0x3c')]=qs[_0x8eca('0x34')](_[_0x8eca('0x5f')](_0x5268ef['query'],_0xadf009[_0x8eca('0x34')]));if(_0x5268ef[_0x8eca('0x33')][_0x8eca('0x3d')]){_0x3aca86[_0x8eca('0x3c')]=_[_0x8eca('0x3e')](_0x3aca86[_0x8eca('0x3c')],{'$or':_[_0x8eca('0x2d')](_0x3aca86[_0x8eca('0x36')],function(_0x2bab5a){var _0x51080d={};_0x51080d[_0x2bab5a]={'$like':'%'+_0x5268ef[_0x8eca('0x33')][_0x8eca('0x3d')]+'%'};return _0x51080d;})});}_0x3aca86=_[_0x8eca('0x3e')]({},_0x3aca86,_0x5268ef[_0x8eca('0x40')]);return _0x40903b[_0x8eca('0x64')](_0x3aca86);}})[_0x8eca('0x23')](function(_0x56c5be){if(_0x56c5be){_0x39ec22=_0x56c5be[_0x8eca('0x48')];if(!_0x5268ef['query']['hasOwnProperty'](_0x8eca('0x39'))){_0x3aca86['limit']=qs['limit'](_0x5268ef['query'][_0x8eca('0x3a')]);_0x3aca86[_0x8eca('0x1f')]=qs[_0x8eca('0x1f')](_0x5268ef[_0x8eca('0x33')][_0x8eca('0x1f')]);}return _0x40903b[_0x8eca('0x64')](_0x3aca86);}})[_0x8eca('0x23')](function(_0x5ada38){if(_0x5ada38){return _0x5ada38?{'count':_0x39ec22,'rows':_0x5ada38}:null;}})[_0x8eca('0x23')](respondWithResult(_0x140334,null))[_0x8eca('0x4b')](handleError(_0x140334,null));};exports['addLists']=function(_0x14249b,_0x2b7ada,_0x507a7d){var _0x5003c2,_0x347554;return db[_0x8eca('0x46')][_0x8eca('0x4a')]({'where':{'id':_0x14249b[_0x8eca('0x44')]['id']}})[_0x8eca('0x23')](handleEntityNotFound(_0x2b7ada,null))[_0x8eca('0x23')](function(_0x1f638e){if(_0x1f638e){_0x347554=_0x1f638e;return _0x1f638e[_0x8eca('0x65')](_0x14249b[_0x8eca('0x55')][_0x8eca('0x66')],_[_0x8eca('0x67')](_0x14249b[_0x8eca('0x55')],[_0x8eca('0x66'),'id'])||{});}return null;})[_0x8eca('0x68')](function(_0x544aab){var _0x3ac970;_0x5003c2=_0x544aab||[];var _0xea719e=[];if(_0x544aab){for(var _0x408dd8=0x0;_0x408dd8<_0x544aab['length'];_0x408dd8+=0x1){var _0x55cfd2=_0x544aab[_0x408dd8]['get']({'plain':!![]});_0x347554[_0x8eca('0x69')]=_0x14249b[_0x8eca('0x55')]['dialCheckDuplicateType']?_0x14249b[_0x8eca('0x55')][_0x8eca('0x69')]:_0x347554[_0x8eca('0x69')];switch(_0x347554[_0x8eca('0x69')]){case'always':_0x3ac970=squel[_0x8eca('0x6a')]()[_0x8eca('0x6b')]('cm_hopper')[_0x8eca('0x6c')]([_0x8eca('0x6d'),_0x8eca('0x6e'),_0x8eca('0x6f'),_0x8eca('0x70'),_0x8eca('0x5c'),_0x8eca('0x53'),_0x8eca('0x54')],squel['select']()[_0x8eca('0x71')](_0x8eca('0x6d'),_0x8eca('0x6d'))['field'](_0x8eca('0x72'),'scheduledAt')[_0x8eca('0x71')]('id',_0x8eca('0x6f'))[_0x8eca('0x71')](_0x55cfd2['CmListId'][_0x8eca('0x73')](),'ListId')['field'](_0x14249b[_0x8eca('0x44')]['id']['toString'](),'CampaignId')[_0x8eca('0x71')]('NOW()',_0x8eca('0x53'))['field']('NOW()',_0x8eca('0x54'))[_0x8eca('0x74')]('cm_contacts')['where'](_0x8eca('0x75'))['where'](_0x8eca('0x76'),_0x55cfd2['CmListId']['toString']())['where'](_0x8eca('0x77'))[_0x8eca('0x3c')](_0x8eca('0x78'),squel[_0x8eca('0x79')]()[_0x8eca('0x71')](_0x8eca('0x7a'))[_0x8eca('0x74')]('cm_hopper_final')[_0x8eca('0x3c')](_0x8eca('0x7b'),_0x14249b[_0x8eca('0x44')]['id'][_0x8eca('0x73')]()))[_0x8eca('0x3c')](_0x8eca('0x78'),squel['select']()[_0x8eca('0x71')](_0x8eca('0x7c'))[_0x8eca('0x74')]('cm_hopper')['where'](_0x8eca('0x7b'),_0x14249b[_0x8eca('0x44')]['id'][_0x8eca('0x73')]())))[_0x8eca('0x73')]();break;case _0x8eca('0x7d'):_0x3ac970=squel[_0x8eca('0x6a')]()['into']('cm_hopper')[_0x8eca('0x6c')](['phone',_0x8eca('0x6e'),_0x8eca('0x6f'),_0x8eca('0x70'),'CampaignId',_0x8eca('0x53'),_0x8eca('0x54')],squel[_0x8eca('0x79')]()['field'](_0x8eca('0x6d'),'phone')[_0x8eca('0x71')](_0x8eca('0x72'),_0x8eca('0x6e'))[_0x8eca('0x71')]('id',_0x8eca('0x6f'))[_0x8eca('0x71')](_0x55cfd2[_0x8eca('0x7e')][_0x8eca('0x73')](),_0x8eca('0x70'))[_0x8eca('0x71')](_0x14249b[_0x8eca('0x44')]['id'][_0x8eca('0x73')](),_0x8eca('0x5c'))['field'](_0x8eca('0x72'),'createdAt')[_0x8eca('0x71')](_0x8eca('0x72'),_0x8eca('0x54'))[_0x8eca('0x74')](_0x8eca('0x7f'))[_0x8eca('0x3c')](_0x8eca('0x75'))[_0x8eca('0x3c')](_0x8eca('0x76'),_0x55cfd2[_0x8eca('0x7e')][_0x8eca('0x73')]())[_0x8eca('0x3c')](_0x8eca('0x77'))['where'](_0x8eca('0x78'),squel[_0x8eca('0x79')]()[_0x8eca('0x71')]('COALESCE(phone,\x27\x27)')[_0x8eca('0x74')](_0x8eca('0x80'))['where']('CampaignId\x20=\x20?',_0x14249b[_0x8eca('0x44')]['id'][_0x8eca('0x73')]())))[_0x8eca('0x73')]();break;default:_0x3ac970=squel[_0x8eca('0x6a')]()[_0x8eca('0x6b')](_0x8eca('0x80'))[_0x8eca('0x6c')]([_0x8eca('0x6d'),_0x8eca('0x6e'),'ContactId',_0x8eca('0x70'),_0x8eca('0x5c'),'createdAt',_0x8eca('0x54')],squel[_0x8eca('0x79')]()[_0x8eca('0x71')]('phone',_0x8eca('0x6d'))[_0x8eca('0x71')](_0x8eca('0x72'),_0x8eca('0x6e'))[_0x8eca('0x71')]('id',_0x8eca('0x6f'))[_0x8eca('0x71')](_0x55cfd2[_0x8eca('0x7e')][_0x8eca('0x73')](),_0x8eca('0x70'))['field'](_0x14249b[_0x8eca('0x44')]['id']['toString'](),_0x8eca('0x5c'))['field'](_0x8eca('0x72'),_0x8eca('0x53'))['field'](_0x8eca('0x72'),'updatedAt')['from'](_0x8eca('0x7f'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x8eca('0x76'),_0x55cfd2[_0x8eca('0x7e')][_0x8eca('0x73')]())[_0x8eca('0x3c')](_0x8eca('0x77')))[_0x8eca('0x73')]();}_0xea719e[_0x8eca('0x81')](db[_0x8eca('0x82')][_0x8eca('0x33')](_0x3ac970));}return BPromise['all'](_0xea719e);}})[_0x8eca('0x23')](function(){return _0x5003c2;})[_0x8eca('0x23')](respondWithResult(_0x2b7ada,null))[_0x8eca('0x4b')](handleError(_0x2b7ada,null));};exports['removeLists']=function(_0x2ebc28,_0x186b8a,_0x115c88){return db[_0x8eca('0x46')][_0x8eca('0x4a')]({'where':{'id':_0x2ebc28[_0x8eca('0x44')]['id']}})[_0x8eca('0x23')](handleEntityNotFound(_0x186b8a,null))[_0x8eca('0x23')](function(_0x2c1e2f){if(_0x2c1e2f){return _0x2c1e2f['removeLists'](_0x2ebc28[_0x8eca('0x33')][_0x8eca('0x66')]);}})[_0x8eca('0x23')](function(_0x427122){if(_0x427122){return db[_0x8eca('0x5a')][_0x8eca('0x83')]({'where':{'ListId':_0x2ebc28[_0x8eca('0x33')][_0x8eca('0x66')],'CampaignId':_0x2ebc28[_0x8eca('0x44')]['id']}})[_0x8eca('0x23')](function(){return _0x427122;});}})[_0x8eca('0x23')](respondWithStatusCode(_0x186b8a,null))[_0x8eca('0x4b')](handleError(_0x186b8a,null));};exports[_0x8eca('0x84')]=function(_0xcecb17,_0x1d1762,_0x157e4f){var _0x989b54={'raw':!![],'where':{}};var _0x43f499={};var _0x593e4c={'count':0x0,'rows':[]};return db['Campaign'][_0x8eca('0x59')]({'where':{'id':_0xcecb17[_0x8eca('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d1762,null))[_0x8eca('0x23')](function(_0x337e3f){if(_0x337e3f){_0x43f499['model']=_[_0x8eca('0x45')](db['CmList'][_0x8eca('0x2e')]);_0x43f499[_0x8eca('0x33')]=_['keys'](_0xcecb17[_0x8eca('0x33')]);_0x43f499['filters']=_['intersection'](_0x43f499['model'],_0x43f499[_0x8eca('0x33')]);_0x989b54[_0x8eca('0x36')]=_['intersection'](_0x43f499[_0x8eca('0x32')],qs[_0x8eca('0x37')](_0xcecb17[_0x8eca('0x33')]['fields']));_0x989b54[_0x8eca('0x36')]=_0x989b54[_0x8eca('0x36')]['length']?_0x989b54[_0x8eca('0x36')]:_0x43f499[_0x8eca('0x32')];if(!_0xcecb17[_0x8eca('0x33')]['hasOwnProperty'](_0x8eca('0x39'))){_0x989b54[_0x8eca('0x3a')]=qs[_0x8eca('0x3a')](_0xcecb17['query']['limit']);_0x989b54['offset']=qs[_0x8eca('0x1f')](_0xcecb17[_0x8eca('0x33')][_0x8eca('0x1f')]);}_0x989b54[_0x8eca('0x3b')]=qs['sort'](_0xcecb17['query']['sort']);_0x989b54[_0x8eca('0x3c')]=qs[_0x8eca('0x34')](_[_0x8eca('0x5f')](_0xcecb17[_0x8eca('0x33')],_0x43f499[_0x8eca('0x34')]));_0x989b54[_0x8eca('0x3c')][_0x8eca('0x5c')]=_0x337e3f['id'];if(_0xcecb17['query']['filter']){_0x989b54[_0x8eca('0x3c')]=_[_0x8eca('0x3e')](_0x989b54[_0x8eca('0x3c')],{'$or':_[_0x8eca('0x2d')](_0x989b54[_0x8eca('0x36')],function(_0x310713){var _0x84bcbe={};_0x84bcbe[_0x310713]={'$like':'%'+_0xcecb17['query'][_0x8eca('0x3d')]+'%'};return _0x84bcbe;})});}_0x989b54=_[_0x8eca('0x3e')]({},_0x989b54,_0xcecb17[_0x8eca('0x40')]);return db['CmList'][_0x8eca('0x1e')]({'where':_0x989b54[_0x8eca('0x3c')]})[_0x8eca('0x23')](function(_0x32bf66){_0x593e4c[_0x8eca('0x1e')]=_0x32bf66;if(_0xcecb17['query'][_0x8eca('0x49')]){_0x989b54[_0x8eca('0x41')]=[{'all':!![]}];}return db[_0x8eca('0x85')][_0x8eca('0x42')](_0x989b54);})['then'](function(_0xf36e4b){_0x593e4c[_0x8eca('0x43')]=_0xf36e4b;return _0x593e4c;});}})['then'](respondWithFilteredResult(_0x1d1762,_0x989b54))[_0x8eca('0x4b')](handleError(_0x1d1762,null));};exports[_0x8eca('0x86')]=function(_0x30d72d,_0x34190e,_0x4359f3){var _0x24a8e5,_0x1ac745;return db[_0x8eca('0x46')][_0x8eca('0x4a')]({'where':{'id':_0x30d72d[_0x8eca('0x44')]['id']}})[_0x8eca('0x23')](handleEntityNotFound(_0x34190e,null))['then'](function(_0x8f47fe){if(_0x8f47fe){_0x1ac745=_0x8f47fe;return _0x8f47fe[_0x8eca('0x86')](_0x30d72d[_0x8eca('0x55')][_0x8eca('0x66')],_['omit'](_0x30d72d[_0x8eca('0x55')],[_0x8eca('0x66'),'id'])||{});}return null;})[_0x8eca('0x68')](function(_0x407644){var _0x5a385d;_0x24a8e5=_0x407644||[];var _0x4a4cbb=[];if(_0x407644){for(var _0x382fc9=0x0;_0x382fc9<_0x407644['length'];_0x382fc9+=0x1){var _0x4cb8a9=_0x407644[_0x382fc9][_0x8eca('0x24')]({'plain':!![]});_0x5a385d=squel['insert']()[_0x8eca('0x6b')]('cm_hopper_black')[_0x8eca('0x6c')]([_0x8eca('0x6d'),_0x8eca('0x6f'),'ListId',_0x8eca('0x5c'),_0x8eca('0x53'),_0x8eca('0x54')],squel[_0x8eca('0x79')]()[_0x8eca('0x71')](_0x8eca('0x6d'),_0x8eca('0x6d'))[_0x8eca('0x71')]('id','ContactId')[_0x8eca('0x71')](_0x4cb8a9['CmListId'][_0x8eca('0x73')](),_0x8eca('0x70'))[_0x8eca('0x71')](_0x30d72d[_0x8eca('0x44')]['id'][_0x8eca('0x73')](),'CampaignId')['field']('NOW()',_0x8eca('0x53'))[_0x8eca('0x71')](_0x8eca('0x72'),_0x8eca('0x54'))[_0x8eca('0x74')](_0x8eca('0x7f'))['where'](_0x8eca('0x75'))[_0x8eca('0x3c')](_0x8eca('0x76'),_0x4cb8a9[_0x8eca('0x7e')][_0x8eca('0x73')]())[_0x8eca('0x3c')](_0x8eca('0x77')))[_0x8eca('0x73')]();_0x4a4cbb['push'](db[_0x8eca('0x82')][_0x8eca('0x33')](_0x5a385d));}return BPromise[_0x8eca('0x87')](_0x4a4cbb);}})['then'](function(){return _0x24a8e5;})[_0x8eca('0x23')](respondWithResult(_0x34190e,null))['catch'](handleError(_0x34190e,null));};exports['removeBlackLists']=function(_0x14e706,_0x106411,_0x3366f5){return db[_0x8eca('0x46')][_0x8eca('0x4a')]({'where':{'id':_0x14e706[_0x8eca('0x44')]['id']}})[_0x8eca('0x23')](handleEntityNotFound(_0x106411,null))[_0x8eca('0x23')](function(_0x331b85){if(_0x331b85){return _0x331b85[_0x8eca('0x88')](_0x14e706[_0x8eca('0x33')][_0x8eca('0x66')]);}})[_0x8eca('0x23')](function(_0x470b67){if(_0x470b67){return db[_0x8eca('0x63')][_0x8eca('0x83')]({'where':{'ListId':_0x14e706['query'][_0x8eca('0x66')],'CampaignId':_0x14e706[_0x8eca('0x44')]['id']}})[_0x8eca('0x23')](function(){return _0x470b67;});}})[_0x8eca('0x23')](respondWithStatusCode(_0x106411,null))[_0x8eca('0x4b')](handleError(_0x106411,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index fa9e02b..060fecd 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 _0x65d4=['path','../../config/environment','./campaign.attributes','exports','campaigns','lodash','moment','bluebird','request-promise'];(function(_0x4abd90,_0x4de7b1){var _0x83f82d=function(_0x47f42a){while(--_0x47f42a){_0x4abd90['push'](_0x4abd90['shift']());}};_0x83f82d(++_0x4de7b1);}(_0x65d4,0x12e));var _0x465d=function(_0x49c5b7,_0x4402dc){_0x49c5b7=_0x49c5b7-0x0;var _0x1435d1=_0x65d4[_0x49c5b7];return _0x1435d1;};'use strict';var _=require(_0x465d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x465d('0x1'));var BPromise=require(_0x465d('0x2'));var rp=require(_0x465d('0x3'));var fs=require('fs');var path=require(_0x465d('0x4'));var rimraf=require('rimraf');var config=require(_0x465d('0x5'));var attributes=require(_0x465d('0x6'));module[_0x465d('0x7')]=function(_0x482865,_0x296c43){return _0x482865['define']('Campaign',attributes,{'tableName':_0x465d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ee8=['./campaign.attributes','exports','define','Campaign','campaigns','lodash','util','api','bluebird','path','rimraf','../../config/environment'];(function(_0x368bba,_0x1f625b){var _0x409f8f=function(_0x463373){while(--_0x463373){_0x368bba['push'](_0x368bba['shift']());}};_0x409f8f(++_0x1f625b);}(_0x3ee8,0x89));var _0x83ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ee8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x83ee('0x0'));var util=require(_0x83ee('0x1'));var logger=require('../../config/logger')(_0x83ee('0x2'));var moment=require('moment');var BPromise=require(_0x83ee('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x83ee('0x4'));var rimraf=require(_0x83ee('0x5'));var config=require(_0x83ee('0x6'));var attributes=require(_0x83ee('0x7'));module[_0x83ee('0x8')]=function(_0x2f1801,_0x5ed519){return _0x2f1801[_0x83ee('0x9')](_0x83ee('0xa'),attributes,{'tableName':_0x83ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index a63cb17..c191d71 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(_0xf50eaf,_0x16e89c){var _0xa70950=function(_0x5df6dc){while(--_0x5df6dc){_0xf50eaf['push'](_0xf50eaf['shift']());}};_0xa70950(++_0x16e89c);}(_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);});});}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(_0x39ada9,_0x25d549){var _0xc3f08e=function(_0x3b6a37){while(--_0x3b6a37){_0x39ada9['push'](_0x39ada9['shift']());}};_0xc3f08e(++_0x25d549);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 119da7f..9709cf5 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 _0x9dbc=['index','/:id','isAuthenticated','getHoppers','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','/:id/clone','addLists','put','delete','destroy','removeBlackLists','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./campaign.controller','get'];(function(_0x2fdfef,_0x593dda){var _0x1e10d6=function(_0x14f313){while(--_0x14f313){_0x2fdfef['push'](_0x2fdfef['shift']());}};_0x1e10d6(++_0x593dda);}(_0x9dbc,0x172));var _0xc9db=function(_0x3792f3,_0x20773a){_0x3792f3=_0x3792f3-0x0;var _0x2c44d2=_0x9dbc[_0x3792f3];return _0x2c44d2;};'use strict';var multer=require(_0xc9db('0x0'));var util=require('util');var path=require(_0xc9db('0x1'));var timeout=require(_0xc9db('0x2'));var express=require('express');var router=express[_0xc9db('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc9db('0x4'));var config=require(_0xc9db('0x5'));var controller=require(_0xc9db('0x6'));router[_0xc9db('0x7')]('/',auth['isAuthenticated'](),controller[_0xc9db('0x8')]);router['get'](_0xc9db('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xc9db('0x7')]('/:id/hoppers',auth[_0xc9db('0xa')](),controller[_0xc9db('0xb')]);router[_0xc9db('0x7')]('/:id/hopper_histories',auth[_0xc9db('0xa')](),controller['getHopperHistories']);router[_0xc9db('0x7')](_0xc9db('0xc'),auth[_0xc9db('0xa')](),controller[_0xc9db('0xd')]);router[_0xc9db('0x7')](_0xc9db('0xe'),auth['isAuthenticated'](),controller[_0xc9db('0xf')]);router[_0xc9db('0x7')](_0xc9db('0x10'),auth[_0xc9db('0xa')](),controller[_0xc9db('0x11')]);router[_0xc9db('0x7')](_0xc9db('0x12'),auth[_0xc9db('0xa')](),controller['getBlackLists']);router[_0xc9db('0x13')]('/',auth[_0xc9db('0xa')](),controller['create']);router[_0xc9db('0x13')](_0xc9db('0x14'),auth[_0xc9db('0xa')](),controller['clone']);router['post']('/:id/lists',auth[_0xc9db('0xa')](),controller[_0xc9db('0x15')]);router[_0xc9db('0x13')](_0xc9db('0x12'),auth[_0xc9db('0xa')](),controller['addBlackLists']);router[_0xc9db('0x16')](_0xc9db('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xc9db('0x17')]('/:id',auth[_0xc9db('0xa')](),controller[_0xc9db('0x18')]);router[_0xc9db('0x17')](_0xc9db('0x10'),auth[_0xc9db('0xa')](),controller['removeLists']);router[_0xc9db('0x17')](_0xc9db('0x12'),auth[_0xc9db('0xa')](),controller[_0xc9db('0x19')]);module[_0xc9db('0x1a')]=router; \ No newline at end of file +var _0x0961=['removeLists','removeBlackLists','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','getLists','/:id/blacklists','post','create','/:id/clone','clone','addLists','addBlackLists','/:id','update','delete','/:id/lists'];(function(_0x34eac0,_0x2e4c1f){var _0x17abf2=function(_0x3d4094){while(--_0x3d4094){_0x34eac0['push'](_0x34eac0['shift']());}};_0x17abf2(++_0x2e4c1f);}(_0x0961,0x10a));var _0x1096=function(_0x143ce6,_0x46e089){_0x143ce6=_0x143ce6-0x0;var _0x33ed64=_0x0961[_0x143ce6];return _0x33ed64;};'use strict';var multer=require(_0x1096('0x0'));var util=require(_0x1096('0x1'));var path=require('path');var timeout=require(_0x1096('0x2'));var express=require(_0x1096('0x3'));var router=express[_0x1096('0x4')]();var auth=require(_0x1096('0x5'));var interaction=require(_0x1096('0x6'));var config=require(_0x1096('0x7'));var controller=require(_0x1096('0x8'));router[_0x1096('0x9')]('/',auth[_0x1096('0xa')](),controller[_0x1096('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x1096('0xc')]);router[_0x1096('0x9')](_0x1096('0xd'),auth[_0x1096('0xa')](),controller[_0x1096('0xe')]);router['get']('/:id/hopper_histories',auth[_0x1096('0xa')](),controller[_0x1096('0xf')]);router['get'](_0x1096('0x10'),auth['isAuthenticated'](),controller[_0x1096('0x11')]);router['get']('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x1096('0x12')]);router[_0x1096('0x9')]('/:id/lists',auth[_0x1096('0xa')](),controller[_0x1096('0x13')]);router[_0x1096('0x9')](_0x1096('0x14'),auth[_0x1096('0xa')](),controller['getBlackLists']);router[_0x1096('0x15')]('/',auth['isAuthenticated'](),controller[_0x1096('0x16')]);router[_0x1096('0x15')](_0x1096('0x17'),auth['isAuthenticated'](),controller[_0x1096('0x18')]);router[_0x1096('0x15')]('/:id/lists',auth[_0x1096('0xa')](),controller[_0x1096('0x19')]);router[_0x1096('0x15')](_0x1096('0x14'),auth['isAuthenticated'](),controller[_0x1096('0x1a')]);router['put'](_0x1096('0x1b'),auth[_0x1096('0xa')](),controller[_0x1096('0x1c')]);router[_0x1096('0x1d')](_0x1096('0x1b'),auth[_0x1096('0xa')](),controller['destroy']);router[_0x1096('0x1d')](_0x1096('0x1e'),auth[_0x1096('0xa')](),controller[_0x1096('0x1f')]);router[_0x1096('0x1d')](_0x1096('0x14'),auth[_0x1096('0xa')](),controller[_0x1096('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 3ff842c..ea9e51d 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 _0x6350=['key','sequelize','exports','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x2b643d,_0x1ebcb1){var _0x4f0f24=function(_0x223f3f){while(--_0x223f3f){_0x2b643d['push'](_0x2b643d['shift']());}};_0x4f0f24(++_0x1ebcb1);}(_0x6350,0x112));var _0x0635=function(_0x411940,_0x13f01e){_0x411940=_0x411940-0x0;var _0x3ee8fa=_0x6350[_0x411940];return _0x3ee8fa;};'use strict';var Sequelize=require(_0x0635('0x0'));module[_0x0635('0x1')]={'key':{'type':Sequelize[_0x0635('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x0635('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x0635('0x4')],'get':function(){return this[_0x0635('0x5')](_0x0635('0x6'));}}}; \ No newline at end of file +var _0x42f4=['VIRTUAL','getDataValue','key','exports','TEXT','STRING'];(function(_0x3c8366,_0x46df4c){var _0xae08f1=function(_0x5da3ef){while(--_0x5da3ef){_0x3c8366['push'](_0x3c8366['shift']());}};_0xae08f1(++_0x46df4c);}(_0x42f4,0x189));var _0x442f=function(_0x39bc44,_0x1d4373){_0x39bc44=_0x39bc44-0x0;var _0x2916d8=_0x42f4[_0x39bc44];return _0x2916d8;};'use strict';var Sequelize=require('sequelize');module[_0x442f('0x0')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x442f('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x442f('0x2')]},'name':{'type':Sequelize[_0x442f('0x3')],'get':function(){return this[_0x442f('0x4')](_0x442f('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 81a3a90..19ab3dd 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 _0x31f0=['bluebird','util','path','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','filtears','length','find','body','catch','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','fast-json-patch','request-promise','moment'];(function(_0x1fc36f,_0x464552){var _0x2856b4=function(_0x2487f3){while(--_0x2487f3){_0x1fc36f['push'](_0x1fc36f['shift']());}};_0x2856b4(++_0x464552);}(_0x31f0,0xb7));var _0x031f=function(_0x50147d,_0x2b4c15){_0x50147d=_0x50147d-0x0;var _0x3de12a=_0x31f0[_0x50147d];return _0x3de12a;};'use strict';var pdf=require(_0x031f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x031f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x031f('0x2'));var rp=require(_0x031f('0x3'));var moment=require(_0x031f('0x4'));var BPromise=require(_0x031f('0x5'));var Mustache=require('mustache');var util=require(_0x031f('0x6'));var path=require(_0x031f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x031f('0x8'));var squel=require('squel');var crypto=require(_0x031f('0x9'));var jsforce=require(_0x031f('0xa'));var deskjs=require(_0x031f('0xb'));var toCsv=require(_0x031f('0xc'));var querystring=require('querystring');var Papa=require(_0x031f('0xd'));var Redis=require(_0x031f('0xe'));var authService=require(_0x031f('0xf'));var qs=require(_0x031f('0x10'));var as=require(_0x031f('0x11'));var hardwareService=require(_0x031f('0x12'));var logger=require(_0x031f('0x13'))(_0x031f('0x14'));var utils=require('../../config/utils');var config=require(_0x031f('0x15'));var licenseUtil=require(_0x031f('0x16'));var db=require(_0x031f('0x17'))['db'];function respondWithStatusCode(_0x351052,_0x3819bb){_0x3819bb=_0x3819bb||0xcc;return function(_0x405896){if(_0x405896){return _0x351052[_0x031f('0x18')](_0x3819bb);}return _0x351052['status'](_0x3819bb)[_0x031f('0x19')]();};}function respondWithResult(_0x23b40c,_0x17a699){_0x17a699=_0x17a699||0xc8;return function(_0x2e3dfe){if(_0x2e3dfe){return _0x23b40c[_0x031f('0x1a')](_0x17a699)['json'](_0x2e3dfe);}};}function respondWithFilteredResult(_0x4b7011,_0x1f08db){return function(_0x3a10aa){if(_0x3a10aa){var _0xe4fc1d=_0x3a10aa[_0x031f('0x1b')],_0x286177=_0x1f08db['offset'],_0x5196b1=_0x1f08db[_0x031f('0x1c')]+_0x1f08db['limit'],_0x1dc4a7;if(_0x5196b1>=_0xe4fc1d){_0x5196b1=_0xe4fc1d;_0x1dc4a7=0xc8;}else{_0x1dc4a7=0xce;}_0x4b7011[_0x031f('0x1a')](_0x1dc4a7);return _0x4b7011[_0x031f('0x1d')](_0x031f('0x1e'),_0x286177+'-'+_0x5196b1+'/'+_0xe4fc1d)[_0x031f('0x1f')](_0x3a10aa);}return null;};}function patchUpdates(_0x1ceddc){return function(_0x26cb5e){try{jsonpatch[_0x031f('0x20')](_0x26cb5e,_0x1ceddc,!![]);}catch(_0x2825ef){return BPromise[_0x031f('0x21')](_0x2825ef);}return _0x26cb5e[_0x031f('0x22')]();};}function saveUpdates(_0x29dd6e,_0x48a76e){return function(_0xf72793){if(_0xf72793){return _0xf72793[_0x031f('0x23')](_0x29dd6e)[_0x031f('0x24')](function(_0x4d6706){return _0x4d6706;});}return null;};}function removeEntity(_0x5c4184,_0xa11a2b){return function(_0x4d0f92){if(_0x4d0f92){return _0x4d0f92[_0x031f('0x25')]()['then'](function(){var _0x54d054=_0x4d0f92['get']({'plain':!![]});var _0x971691=_0x031f('0x26');return db[_0x031f('0x27')][_0x031f('0x25')]({'where':{'type':_0x971691,'resourceId':_0x54d054['id']}})['then'](function(){return _0x4d0f92;});})[_0x031f('0x24')](function(){_0x5c4184['status'](0xcc)[_0x031f('0x19')]();});}};}function handleEntityNotFound(_0x1f5a14,_0xfa77b1){return function(_0x567666){if(!_0x567666){_0x1f5a14[_0x031f('0x18')](0x194);}return _0x567666;};}function handleError(_0x3b2a51,_0x54b44e){_0x54b44e=_0x54b44e||0x1f4;return function(_0x3847b2){logger[_0x031f('0x28')](_0x3847b2[_0x031f('0x29')]);if(_0x3847b2['name']){delete _0x3847b2[_0x031f('0x2a')];}_0x3b2a51[_0x031f('0x1a')](_0x54b44e)[_0x031f('0x2b')](_0x3847b2);};}exports[_0x031f('0x2c')]=function(_0xfaa36,_0x301bd2){var _0x52b544={},_0x1f62eb={},_0xab24ad={'count':0x0,'rows':[]};var _0x34f249=_[_0x031f('0x2d')](db[_0x031f('0x2e')][_0x031f('0x2f')],function(_0x378692){return{'name':_0x378692[_0x031f('0x30')],'type':_0x378692[_0x031f('0x31')][_0x031f('0x32')]};});_0x1f62eb[_0x031f('0x33')]=_['map'](_0x34f249,_0x031f('0x2a'));_0x1f62eb[_0x031f('0x34')]=_[_0x031f('0x35')](_0xfaa36[_0x031f('0x34')]);_0x1f62eb[_0x031f('0x36')]=_[_0x031f('0x37')](_0x1f62eb[_0x031f('0x33')],_0x1f62eb[_0x031f('0x34')]);_0x52b544[_0x031f('0x38')]=_[_0x031f('0x37')](_0x1f62eb[_0x031f('0x33')],qs[_0x031f('0x39')](_0xfaa36[_0x031f('0x34')]['fields']));_0x52b544[_0x031f('0x38')]=_0x52b544[_0x031f('0x38')]['length']?_0x52b544[_0x031f('0x38')]:_0x1f62eb[_0x031f('0x33')];if(!_0xfaa36['query'][_0x031f('0x3a')](_0x031f('0x3b'))){_0x52b544[_0x031f('0x3c')]=qs[_0x031f('0x3c')](_0xfaa36['query']['limit']);_0x52b544[_0x031f('0x1c')]=qs['offset'](_0xfaa36[_0x031f('0x34')][_0x031f('0x1c')]);}_0x52b544[_0x031f('0x3d')]=qs['sort'](_0xfaa36['query'][_0x031f('0x3e')]);_0x52b544['where']=qs['filters'](_[_0x031f('0x3f')](_0xfaa36[_0x031f('0x34')],_0x1f62eb[_0x031f('0x36')]),_0x34f249);if(_0xfaa36[_0x031f('0x34')][_0x031f('0x40')]){_0x52b544[_0x031f('0x41')]=_[_0x031f('0x42')](_0x52b544['where'],{'$or':_[_0x031f('0x2d')](_0x34f249,function(_0x2e580f){if(_0x2e580f[_0x031f('0x31')]!==_0x031f('0x43')){var _0x58daa2={};_0x58daa2[_0x2e580f[_0x031f('0x2a')]]={'$like':'%'+_0xfaa36[_0x031f('0x34')][_0x031f('0x40')]+'%'};return _0x58daa2;}})});}_0x52b544=_['merge']({},_0x52b544,_0xfaa36[_0x031f('0x44')]);var _0x3b504c={'where':_0x52b544['where']};return db[_0x031f('0x2e')][_0x031f('0x1b')](_0x3b504c)['then'](function(_0x4c50b2){_0xab24ad[_0x031f('0x1b')]=_0x4c50b2;if(_0xfaa36[_0x031f('0x34')][_0x031f('0x45')]){_0x52b544[_0x031f('0x46')]=[{'all':!![]}];}return db[_0x031f('0x2e')][_0x031f('0x47')](_0x52b544);})[_0x031f('0x24')](function(_0x5a212c){_0xab24ad[_0x031f('0x48')]=_0x5a212c;return _0xab24ad;})[_0x031f('0x24')](respondWithFilteredResult(_0x301bd2,_0x52b544))['catch'](handleError(_0x301bd2,null));};exports[_0x031f('0x49')]=function(_0x505e93,_0x456a98){var _0x260a3d={'raw':!![],'where':{'id':_0x505e93[_0x031f('0x4a')]['id']}},_0x56dd24={};_0x56dd24[_0x031f('0x33')]=_[_0x031f('0x35')](db['CannedAnswer'][_0x031f('0x2f')]);_0x56dd24[_0x031f('0x34')]=_[_0x031f('0x35')](_0x505e93[_0x031f('0x34')]);_0x56dd24[_0x031f('0x4b')]=_[_0x031f('0x37')](_0x56dd24[_0x031f('0x33')],_0x56dd24[_0x031f('0x34')]);_0x260a3d[_0x031f('0x38')]=_['intersection'](_0x56dd24[_0x031f('0x33')],qs[_0x031f('0x39')](_0x505e93[_0x031f('0x34')][_0x031f('0x39')]));_0x260a3d[_0x031f('0x38')]=_0x260a3d[_0x031f('0x38')][_0x031f('0x4c')]?_0x260a3d[_0x031f('0x38')]:_0x56dd24[_0x031f('0x33')];if(_0x505e93['query'][_0x031f('0x45')]){_0x260a3d['include']=[{'all':!![]}];}_0x260a3d=_['merge']({},_0x260a3d,_0x505e93[_0x031f('0x44')]);return db[_0x031f('0x2e')][_0x031f('0x4d')](_0x260a3d)[_0x031f('0x24')](handleEntityNotFound(_0x456a98,null))[_0x031f('0x24')](respondWithResult(_0x456a98,null))['catch'](handleError(_0x456a98,null));};exports[_0x031f('0x23')]=function(_0x365f8c,_0x4216ce){if(_0x365f8c['body']['id']){delete _0x365f8c[_0x031f('0x4e')]['id'];}return db[_0x031f('0x2e')][_0x031f('0x4d')]({'where':{'id':_0x365f8c[_0x031f('0x4a')]['id']}})[_0x031f('0x24')](handleEntityNotFound(_0x4216ce,null))[_0x031f('0x24')](saveUpdates(_0x365f8c['body'],null))['then'](respondWithResult(_0x4216ce,null))[_0x031f('0x4f')](handleError(_0x4216ce,null));};exports['destroy']=function(_0x3b8c04,_0x3bba44){return db['CannedAnswer'][_0x031f('0x4d')]({'where':{'id':_0x3b8c04['params']['id']}})['then'](handleEntityNotFound(_0x3bba44,null))[_0x031f('0x24')](removeEntity(_0x3bba44,null))['catch'](handleError(_0x3bba44,null));};exports[_0x031f('0x50')]=function(_0x57e9dc,_0x11bf43){var _0x2137c3={'key':_0x57e9dc['body'][_0x031f('0x32')]};if(_0x57e9dc[_0x031f('0x4e')]['MailAccountId']){_0x2137c3[_0x031f('0x51')]=_0x57e9dc['body'][_0x031f('0x51')];}else if(_0x57e9dc['body'][_0x031f('0x52')]){_0x2137c3[_0x031f('0x52')]=_0x57e9dc[_0x031f('0x4e')][_0x031f('0x52')];}else if(_0x57e9dc[_0x031f('0x4e')]['OpenchannelAccountId']){_0x2137c3[_0x031f('0x53')]=_0x57e9dc['body'][_0x031f('0x53')];}else if(_0x57e9dc[_0x031f('0x4e')]['ChatWebsiteId']){_0x2137c3[_0x031f('0x54')]=_0x57e9dc[_0x031f('0x4e')]['ChatWebsiteId'];}return db[_0x031f('0x2e')][_0x031f('0x4d')]({'where':_0x2137c3})[_0x031f('0x24')](function(_0x55b9cf){if(_0x55b9cf){throw new db[(_0x031f('0x55'))]['ValidationError'](_0x031f('0x56'));}return db['CannedAnswer'][_0x031f('0x50')](_0x57e9dc['body']);})[_0x031f('0x24')](function(_0x27b869){var _0x5f5517=_0x57e9dc['user'][_0x031f('0x57')]({'plain':!![]});if(!_0x5f5517)throw new Error(_0x031f('0x58'));if(_0x5f5517['role']===_0x031f('0x59')){var _0xb44c73=_0x27b869[_0x031f('0x57')]({'plain':!![]});return db[_0x031f('0x5a')][_0x031f('0x4d')]({'where':{'name':_0x031f('0x26'),'userProfileId':_0x5f5517[_0x031f('0x5b')]},'raw':!![]})[_0x031f('0x24')](function(_0x4b25e5){if(_0x4b25e5&&_0x4b25e5[_0x031f('0x5c')]===0x0){return db[_0x031f('0x27')][_0x031f('0x50')]({'name':_0xb44c73['name'],'resourceId':_0xb44c73['id'],'type':_0x4b25e5[_0x031f('0x2a')],'sectionId':_0x4b25e5['id']},{})[_0x031f('0x24')](function(){return _0x27b869;});}else{return _0x27b869;}})['catch'](function(_0xb86dcd){logger[_0x031f('0x28')](_0x031f('0x5d'),_0xb86dcd);throw _0xb86dcd;});}return _0x27b869;})[_0x031f('0x24')](respondWithResult(_0x11bf43,0xc9))['catch'](handleError(_0x11bf43,null));}; \ No newline at end of file +var _0xeff8=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','update','body','find','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','role','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','map','CannedAnswer','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0xeff8,0x186));var _0x8eff=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xeff8[_0x9df060];return _0x338dfe;};'use strict';var pdf=require(_0x8eff('0x0'));var emlformat=require(_0x8eff('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8eff('0x2'));var jsonpatch=require(_0x8eff('0x3'));var rp=require(_0x8eff('0x4'));var moment=require('moment');var BPromise=require(_0x8eff('0x5'));var Mustache=require(_0x8eff('0x6'));var util=require(_0x8eff('0x7'));var path=require(_0x8eff('0x8'));var sox=require('sox');var csv=require(_0x8eff('0x9'));var ejs=require(_0x8eff('0xa'));var fs=require('fs');var _=require(_0x8eff('0xb'));var squel=require(_0x8eff('0xc'));var crypto=require('crypto');var jsforce=require(_0x8eff('0xd'));var deskjs=require(_0x8eff('0xe'));var toCsv=require(_0x8eff('0x9'));var querystring=require(_0x8eff('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8eff('0x10'));var qs=require(_0x8eff('0x11'));var as=require(_0x8eff('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8eff('0x13'))(_0x8eff('0x14'));var utils=require('../../config/utils');var config=require(_0x8eff('0x15'));var licenseUtil=require(_0x8eff('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a399e,_0x45f280){_0x45f280=_0x45f280||0xcc;return function(_0x43c914){if(_0x43c914){return _0x4a399e[_0x8eff('0x17')](_0x45f280);}return _0x4a399e[_0x8eff('0x18')](_0x45f280)[_0x8eff('0x19')]();};}function respondWithResult(_0x56efdf,_0x3e7c01){_0x3e7c01=_0x3e7c01||0xc8;return function(_0x212a2e){if(_0x212a2e){return _0x56efdf[_0x8eff('0x18')](_0x3e7c01)[_0x8eff('0x1a')](_0x212a2e);}};}function respondWithFilteredResult(_0x228eb1,_0x4cfc91){return function(_0x16202e){if(_0x16202e){var _0xdbb753=_0x16202e['count'],_0x16a4eb=_0x4cfc91[_0x8eff('0x1b')],_0x427902=_0x4cfc91[_0x8eff('0x1b')]+_0x4cfc91[_0x8eff('0x1c')],_0x137344;if(_0x427902>=_0xdbb753){_0x427902=_0xdbb753;_0x137344=0xc8;}else{_0x137344=0xce;}_0x228eb1[_0x8eff('0x18')](_0x137344);return _0x228eb1[_0x8eff('0x1d')](_0x8eff('0x1e'),_0x16a4eb+'-'+_0x427902+'/'+_0xdbb753)[_0x8eff('0x1a')](_0x16202e);}return null;};}function patchUpdates(_0x399d96){return function(_0x1b003c){try{jsonpatch[_0x8eff('0x1f')](_0x1b003c,_0x399d96,!![]);}catch(_0x453c7a){return BPromise[_0x8eff('0x20')](_0x453c7a);}return _0x1b003c[_0x8eff('0x21')]();};}function saveUpdates(_0x2a7337,_0xdbb7b5){return function(_0x183a53){if(_0x183a53){return _0x183a53['update'](_0x2a7337)[_0x8eff('0x22')](function(_0x4d3e84){return _0x4d3e84;});}return null;};}function removeEntity(_0x5a2492,_0x1c4ad3){return function(_0x5ea31f){if(_0x5ea31f){return _0x5ea31f[_0x8eff('0x23')]()[_0x8eff('0x22')](function(){var _0x1ccc79=_0x5ea31f[_0x8eff('0x24')]({'plain':!![]});var _0x1ee09c='CannedAnswers';return db[_0x8eff('0x25')][_0x8eff('0x23')]({'where':{'type':_0x1ee09c,'resourceId':_0x1ccc79['id']}})['then'](function(){return _0x5ea31f;});})[_0x8eff('0x22')](function(){_0x5a2492[_0x8eff('0x18')](0xcc)[_0x8eff('0x19')]();});}};}function handleEntityNotFound(_0x3b698b,_0xd60d94){return function(_0x41324b){if(!_0x41324b){_0x3b698b[_0x8eff('0x17')](0x194);}return _0x41324b;};}function handleError(_0x2e8067,_0x516173){_0x516173=_0x516173||0x1f4;return function(_0x3e1607){logger[_0x8eff('0x26')](_0x3e1607[_0x8eff('0x27')]);if(_0x3e1607[_0x8eff('0x28')]){delete _0x3e1607[_0x8eff('0x28')];}_0x2e8067[_0x8eff('0x18')](_0x516173)['send'](_0x3e1607);};}exports['index']=function(_0x44dcdb,_0x472b19){var _0x17ff3f={},_0x5ce071={},_0x2ebf3a={'count':0x0,'rows':[]};var _0x2f8ad9=_[_0x8eff('0x29')](db[_0x8eff('0x2a')][_0x8eff('0x2b')],function(_0x2c5727){return{'name':_0x2c5727[_0x8eff('0x2c')],'type':_0x2c5727[_0x8eff('0x2d')][_0x8eff('0x2e')]};});_0x5ce071[_0x8eff('0x2f')]=_[_0x8eff('0x29')](_0x2f8ad9,_0x8eff('0x28'));_0x5ce071['query']=_[_0x8eff('0x30')](_0x44dcdb[_0x8eff('0x31')]);_0x5ce071[_0x8eff('0x32')]=_[_0x8eff('0x33')](_0x5ce071['model'],_0x5ce071[_0x8eff('0x31')]);_0x17ff3f[_0x8eff('0x34')]=_['intersection'](_0x5ce071['model'],qs[_0x8eff('0x35')](_0x44dcdb[_0x8eff('0x31')]['fields']));_0x17ff3f['attributes']=_0x17ff3f['attributes'][_0x8eff('0x36')]?_0x17ff3f['attributes']:_0x5ce071[_0x8eff('0x2f')];if(!_0x44dcdb['query'][_0x8eff('0x37')](_0x8eff('0x38'))){_0x17ff3f[_0x8eff('0x1c')]=qs[_0x8eff('0x1c')](_0x44dcdb[_0x8eff('0x31')][_0x8eff('0x1c')]);_0x17ff3f['offset']=qs[_0x8eff('0x1b')](_0x44dcdb['query'][_0x8eff('0x1b')]);}_0x17ff3f['order']=qs[_0x8eff('0x39')](_0x44dcdb[_0x8eff('0x31')][_0x8eff('0x39')]);_0x17ff3f[_0x8eff('0x3a')]=qs['filters'](_[_0x8eff('0x3b')](_0x44dcdb[_0x8eff('0x31')],_0x5ce071[_0x8eff('0x32')]),_0x2f8ad9);if(_0x44dcdb['query'][_0x8eff('0x3c')]){_0x17ff3f[_0x8eff('0x3a')]=_[_0x8eff('0x3d')](_0x17ff3f[_0x8eff('0x3a')],{'$or':_[_0x8eff('0x29')](_0x2f8ad9,function(_0xd2a915){if(_0xd2a915[_0x8eff('0x2d')]!==_0x8eff('0x3e')){var _0x661c36={};_0x661c36[_0xd2a915['name']]={'$like':'%'+_0x44dcdb['query'][_0x8eff('0x3c')]+'%'};return _0x661c36;}})});}_0x17ff3f=_[_0x8eff('0x3d')]({},_0x17ff3f,_0x44dcdb[_0x8eff('0x3f')]);var _0x36e93c={'where':_0x17ff3f[_0x8eff('0x3a')]};return db[_0x8eff('0x2a')][_0x8eff('0x40')](_0x36e93c)['then'](function(_0x14cf6e){_0x2ebf3a[_0x8eff('0x40')]=_0x14cf6e;if(_0x44dcdb['query'][_0x8eff('0x41')]){_0x17ff3f[_0x8eff('0x42')]=[{'all':!![]}];}return db[_0x8eff('0x2a')][_0x8eff('0x43')](_0x17ff3f);})[_0x8eff('0x22')](function(_0x43dc74){_0x2ebf3a[_0x8eff('0x44')]=_0x43dc74;return _0x2ebf3a;})[_0x8eff('0x22')](respondWithFilteredResult(_0x472b19,_0x17ff3f))[_0x8eff('0x45')](handleError(_0x472b19,null));};exports['show']=function(_0x37f376,_0x27a8c9){var _0x3f8a85={'raw':!![],'where':{'id':_0x37f376[_0x8eff('0x46')]['id']}},_0x2fa131={};_0x2fa131['model']=_[_0x8eff('0x30')](db['CannedAnswer'][_0x8eff('0x2b')]);_0x2fa131[_0x8eff('0x31')]=_[_0x8eff('0x30')](_0x37f376[_0x8eff('0x31')]);_0x2fa131['filtears']=_[_0x8eff('0x33')](_0x2fa131[_0x8eff('0x2f')],_0x2fa131[_0x8eff('0x31')]);_0x3f8a85['attributes']=_['intersection'](_0x2fa131[_0x8eff('0x2f')],qs[_0x8eff('0x35')](_0x37f376[_0x8eff('0x31')][_0x8eff('0x35')]));_0x3f8a85[_0x8eff('0x34')]=_0x3f8a85['attributes'][_0x8eff('0x36')]?_0x3f8a85['attributes']:_0x2fa131[_0x8eff('0x2f')];if(_0x37f376[_0x8eff('0x31')]['includeAll']){_0x3f8a85['include']=[{'all':!![]}];}_0x3f8a85=_['merge']({},_0x3f8a85,_0x37f376['options']);return db['CannedAnswer']['find'](_0x3f8a85)[_0x8eff('0x22')](handleEntityNotFound(_0x27a8c9,null))[_0x8eff('0x22')](respondWithResult(_0x27a8c9,null))[_0x8eff('0x45')](handleError(_0x27a8c9,null));};exports[_0x8eff('0x47')]=function(_0x1aa204,_0x190aec){if(_0x1aa204[_0x8eff('0x48')]['id']){delete _0x1aa204[_0x8eff('0x48')]['id'];}return db[_0x8eff('0x2a')][_0x8eff('0x49')]({'where':{'id':_0x1aa204['params']['id']}})[_0x8eff('0x22')](handleEntityNotFound(_0x190aec,null))['then'](saveUpdates(_0x1aa204[_0x8eff('0x48')],null))[_0x8eff('0x22')](respondWithResult(_0x190aec,null))[_0x8eff('0x45')](handleError(_0x190aec,null));};exports[_0x8eff('0x23')]=function(_0x5c491b,_0xecde36){return db[_0x8eff('0x2a')][_0x8eff('0x49')]({'where':{'id':_0x5c491b[_0x8eff('0x46')]['id']}})[_0x8eff('0x22')](handleEntityNotFound(_0xecde36,null))[_0x8eff('0x22')](removeEntity(_0xecde36,null))[_0x8eff('0x45')](handleError(_0xecde36,null));};exports['create']=function(_0x13ae7c,_0x38d88d){var _0x40209d={'key':_0x13ae7c[_0x8eff('0x48')][_0x8eff('0x2e')]};if(_0x13ae7c[_0x8eff('0x48')][_0x8eff('0x4a')]){_0x40209d[_0x8eff('0x4a')]=_0x13ae7c[_0x8eff('0x48')]['MailAccountId'];}else if(_0x13ae7c['body'][_0x8eff('0x4b')]){_0x40209d[_0x8eff('0x4b')]=_0x13ae7c[_0x8eff('0x48')][_0x8eff('0x4b')];}else if(_0x13ae7c[_0x8eff('0x48')][_0x8eff('0x4c')]){_0x40209d['OpenchannelAccountId']=_0x13ae7c[_0x8eff('0x48')][_0x8eff('0x4c')];}else if(_0x13ae7c[_0x8eff('0x48')]['ChatWebsiteId']){_0x40209d[_0x8eff('0x4d')]=_0x13ae7c[_0x8eff('0x48')][_0x8eff('0x4d')];}return db[_0x8eff('0x2a')]['find']({'where':_0x40209d})[_0x8eff('0x22')](function(_0x161f89){if(_0x161f89){throw new db[(_0x8eff('0x4e'))][(_0x8eff('0x4f'))](_0x8eff('0x50'));}return db[_0x8eff('0x2a')][_0x8eff('0x51')](_0x13ae7c['body']);})[_0x8eff('0x22')](function(_0x162b74){var _0x3a6d5e=_0x13ae7c[_0x8eff('0x52')][_0x8eff('0x24')]({'plain':!![]});if(!_0x3a6d5e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a6d5e[_0x8eff('0x53')]===_0x8eff('0x52')){var _0x5d79b=_0x162b74['get']({'plain':!![]});return db[_0x8eff('0x54')]['find']({'where':{'name':_0x8eff('0x55'),'userProfileId':_0x3a6d5e[_0x8eff('0x56')]},'raw':!![]})[_0x8eff('0x22')](function(_0xfecdd8){if(_0xfecdd8&&_0xfecdd8[_0x8eff('0x57')]===0x0){return db[_0x8eff('0x25')][_0x8eff('0x51')]({'name':_0x5d79b['name'],'resourceId':_0x5d79b['id'],'type':_0xfecdd8['name'],'sectionId':_0xfecdd8['id']},{})[_0x8eff('0x22')](function(){return _0x162b74;});}else{return _0x162b74;}})['catch'](function(_0x3bfeac){logger[_0x8eff('0x26')](_0x8eff('0x58'),_0x3bfeac);throw _0x3bfeac;});}return _0x162b74;})[_0x8eff('0x22')](respondWithResult(_0x38d88d,0xc9))[_0x8eff('0x45')](handleError(_0x38d88d,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index bf28a79..0c598d4 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 _0xb6bf=['util','api','moment','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3cc308,_0x541e5d){var _0x225a65=function(_0x15ba33){while(--_0x15ba33){_0x3cc308['push'](_0x3cc308['shift']());}};_0x225a65(++_0x541e5d);}(_0xb6bf,0xa9));var _0xfb6b=function(_0x176dce,_0x16ca5c){_0x176dce=_0x176dce-0x0;var _0x3444b2=_0xb6bf[_0x176dce];return _0x3444b2;};'use strict';var _=require('lodash');var util=require(_0xfb6b('0x0'));var logger=require('../../config/logger')(_0xfb6b('0x1'));var moment=require(_0xfb6b('0x2'));var BPromise=require('bluebird');var rp=require(_0xfb6b('0x3'));var fs=require('fs');var path=require(_0xfb6b('0x4'));var rimraf=require(_0xfb6b('0x5'));var config=require(_0xfb6b('0x6'));var attributes=require(_0xfb6b('0x7'));module[_0xfb6b('0x8')]=function(_0x402538,_0x390e51){return _0x402538[_0xfb6b('0x9')]('CannedAnswer',attributes,{'tableName':_0xfb6b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfb6b('0xb'),'collate':_0xfb6b('0xc')});}; \ No newline at end of file +var _0x6d2e=['moment','bluebird','request-promise','rimraf','exports','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x55cc8a,_0xf90869){var _0x356ab1=function(_0x1bbb09){while(--_0x1bbb09){_0x55cc8a['push'](_0x55cc8a['shift']());}};_0x356ab1(++_0xf90869);}(_0x6d2e,0x97));var _0xe6d2=function(_0x1e271f,_0xf14504){_0x1e271f=_0x1e271f-0x0;var _0x2b2ac5=_0x6d2e[_0x1e271f];return _0x2b2ac5;};'use strict';var _=require('lodash');var util=require(_0xe6d2('0x0'));var logger=require(_0xe6d2('0x1'))(_0xe6d2('0x2'));var moment=require(_0xe6d2('0x3'));var BPromise=require(_0xe6d2('0x4'));var rp=require(_0xe6d2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe6d2('0x6'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module[_0xe6d2('0x7')]=function(_0x2b4bf0,_0x3c0fab){return _0x2b4bf0['define'](_0xe6d2('0x8'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe6d2('0x9'),'collate':_0xe6d2('0xa')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 6caac66..b89c1bb 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 _0x1d8c=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x38d1c1,_0x5bd327){var _0x4535d9=function(_0x1a5715){while(--_0x1a5715){_0x38d1c1['push'](_0x38d1c1['shift']());}};_0x4535d9(++_0x5bd327);}(_0x1d8c,0xe2));var _0xc1d8=function(_0x4d8efe,_0x220da3){_0x4d8efe=_0x4d8efe-0x0;var _0x2e883d=_0x1d8c[_0x4d8efe];return _0x2e883d;};'use strict';var _=require(_0xc1d8('0x0'));var util=require(_0xc1d8('0x1'));var moment=require('moment');var BPromise=require(_0xc1d8('0x2'));var rs=require(_0xc1d8('0x3'));var fs=require('fs');var Redis=require(_0xc1d8('0x4'));var db=require(_0xc1d8('0x5'))['db'];var utils=require(_0xc1d8('0x6'));var logger=require(_0xc1d8('0x7'))(_0xc1d8('0x8'));var config=require(_0xc1d8('0x9'));var jayson=require(_0xc1d8('0xa'));var client=jayson[_0xc1d8('0xb')][_0xc1d8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x293607,_0x119d0f,_0x5e2e19){return new BPromise(function(_0x4821da,_0x47c6b0){return client[_0xc1d8('0xd')](_0x293607,_0x5e2e19)[_0xc1d8('0xe')](function(_0x47f2b7){logger[_0xc1d8('0xf')](_0xc1d8('0x10'),_0x119d0f,'request\x20sent');logger[_0xc1d8('0x11')](_0xc1d8('0x12'),_0x119d0f,_0xc1d8('0x13'),JSON[_0xc1d8('0x14')](_0x47f2b7));if(_0x47f2b7[_0xc1d8('0x15')]){if(_0x47f2b7[_0xc1d8('0x15')][_0xc1d8('0x16')]===0x1f4){logger['error'](_0xc1d8('0x10'),_0x119d0f,_0x47f2b7[_0xc1d8('0x15')][_0xc1d8('0x17')]);return _0x47c6b0(_0x47f2b7[_0xc1d8('0x15')]['message']);}logger[_0xc1d8('0x15')](_0xc1d8('0x10'),_0x119d0f,_0x47f2b7['error'][_0xc1d8('0x17')]);return _0x4821da(_0x47f2b7[_0xc1d8('0x15')]['message']);}else{logger[_0xc1d8('0xf')](_0xc1d8('0x10'),_0x119d0f,_0xc1d8('0x13'));_0x4821da(_0x47f2b7[_0xc1d8('0x18')][_0xc1d8('0x17')]);}})[_0xc1d8('0x19')](function(_0x1c10fb){logger['error'](_0xc1d8('0x10'),_0x119d0f,_0x1c10fb);_0x47c6b0(_0x1c10fb);});});} \ No newline at end of file +var _0x671d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','CannedAnswer,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x33996f,_0x421c94){var _0x44dc49=function(_0x2368f1){while(--_0x2368f1){_0x33996f['push'](_0x33996f['shift']());}};_0x44dc49(++_0x421c94);}(_0x671d,0x19e));var _0xd671=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0x671d[_0x44268d];return _0x4be92d;};'use strict';var _=require(_0xd671('0x0'));var util=require(_0xd671('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd671('0x2'));var fs=require('fs');var Redis=require(_0xd671('0x3'));var db=require(_0xd671('0x4'))['db'];var utils=require(_0xd671('0x5'));var logger=require(_0xd671('0x6'))(_0xd671('0x7'));var config=require(_0xd671('0x8'));var jayson=require(_0xd671('0x9'));var client=jayson[_0xd671('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xafe0c0,_0x538d9a,_0x32386b){return new BPromise(function(_0x181292,_0x3e35d9){return client[_0xd671('0xb')](_0xafe0c0,_0x32386b)[_0xd671('0xc')](function(_0x41b167){logger['info'](_0xd671('0xd'),_0x538d9a,_0xd671('0xe'));logger['debug']('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x538d9a,_0xd671('0xe'),JSON[_0xd671('0xf')](_0x41b167));if(_0x41b167[_0xd671('0x10')]){if(_0x41b167['error'][_0xd671('0x11')]===0x1f4){logger[_0xd671('0x10')](_0xd671('0xd'),_0x538d9a,_0x41b167[_0xd671('0x10')]['message']);return _0x3e35d9(_0x41b167[_0xd671('0x10')][_0xd671('0x12')]);}logger[_0xd671('0x10')](_0xd671('0xd'),_0x538d9a,_0x41b167['error'][_0xd671('0x12')]);return _0x181292(_0x41b167['error'][_0xd671('0x12')]);}else{logger[_0xd671('0x13')]('CannedAnswer,\x20%s,\x20%s',_0x538d9a,_0xd671('0xe'));_0x181292(_0x41b167[_0xd671('0x14')][_0xd671('0x12')]);}})['catch'](function(_0x328eab){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x538d9a,_0x328eab);_0x3e35d9(_0x328eab);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index ed76e1b..976552c 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 _0xed41=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller'];(function(_0x4ca91f,_0x399dc6){var _0xf593f6=function(_0x47de1e){while(--_0x47de1e){_0x4ca91f['push'](_0x4ca91f['shift']());}};_0xf593f6(++_0x399dc6);}(_0xed41,0x19a));var _0x1ed4=function(_0x15bb8e,_0x287e72){_0x15bb8e=_0x15bb8e-0x0;var _0x21550d=_0xed41[_0x15bb8e];return _0x21550d;};'use strict';var multer=require(_0x1ed4('0x0'));var util=require(_0x1ed4('0x1'));var path=require('path');var timeout=require(_0x1ed4('0x2'));var express=require('express');var router=express[_0x1ed4('0x3')]();var auth=require(_0x1ed4('0x4'));var interaction=require(_0x1ed4('0x5'));var config=require(_0x1ed4('0x6'));var controller=require(_0x1ed4('0x7'));router[_0x1ed4('0x8')]('/',auth[_0x1ed4('0x9')](),controller[_0x1ed4('0xa')]);router[_0x1ed4('0x8')](_0x1ed4('0xb'),auth['isAuthenticated'](),controller[_0x1ed4('0xc')]);router['post']('/',auth[_0x1ed4('0x9')](),controller[_0x1ed4('0xd')]);router[_0x1ed4('0xe')](_0x1ed4('0xb'),auth[_0x1ed4('0x9')](),controller[_0x1ed4('0xf')]);router[_0x1ed4('0x10')](_0x1ed4('0xb'),auth['isAuthenticated'](),controller[_0x1ed4('0x11')]);module[_0x1ed4('0x12')]=router; \ No newline at end of file +var _0x41f2=['get','/:id','post','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x41f2,0x14f));var _0x241f=function(_0x31a885,_0x374b7c){_0x31a885=_0x31a885-0x0;var _0x45006d=_0x41f2[_0x31a885];return _0x45006d;};'use strict';var multer=require(_0x241f('0x0'));var util=require(_0x241f('0x1'));var path=require('path');var timeout=require(_0x241f('0x2'));var express=require(_0x241f('0x3'));var router=express[_0x241f('0x4')]();var auth=require(_0x241f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x241f('0x6'));var controller=require(_0x241f('0x7'));router['get']('/',auth[_0x241f('0x8')](),controller[_0x241f('0x9')]);router[_0x241f('0xa')](_0x241f('0xb'),auth[_0x241f('0x8')](),controller['show']);router[_0x241f('0xc')]('/',auth[_0x241f('0x8')](),controller['create']);router['put']('/:id',auth[_0x241f('0x8')](),controller['update']);router[_0x241f('0xd')](_0x241f('0xb'),auth[_0x241f('0x8')](),controller['destroy']);module[_0x241f('0xe')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index ff5cd4e..fb7af0f 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 _0x0aa8=['INTEGER','sequelize','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x0aa8,0x1cd));var _0x80aa=function(_0x1b8b95,_0x3ea343){_0x1b8b95=_0x1b8b95-0x0;var _0x3657ae=_0x0aa8[_0x1b8b95];return _0x3657ae;};'use strict';var Sequelize=require(_0x80aa('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x80aa('0x1')],'allowNull':![],'defaultValue':_0x80aa('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x80aa('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x80aa('0x3')]},'lastapp':{'type':Sequelize[_0x80aa('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x80aa('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x80aa('0x3')]},'amaflags':{'type':Sequelize[_0x80aa('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x80aa('0x3')]},'userfield':{'type':Sequelize[_0x80aa('0x3')]},'uniqueid':{'type':Sequelize[_0x80aa('0x3')]},'linkedid':{'type':Sequelize[_0x80aa('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x80aa('0x3')]},'type':{'type':Sequelize[_0x80aa('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xeb80=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x10aa73,_0xc744f4){var _0x3496d9=function(_0x71c780){while(--_0x71c780){_0x10aa73['push'](_0x10aa73['shift']());}};_0x3496d9(++_0xc744f4);}(_0xeb80,0x97));var _0x0eb8=function(_0x14189d,_0x20b78e){_0x14189d=_0x14189d-0x0;var _0x492573=_0xeb80[_0x14189d];return _0x492573;};'use strict';var Sequelize=require(_0x0eb8('0x0'));module[_0x0eb8('0x1')]={'calldate':{'type':Sequelize[_0x0eb8('0x2')],'allowNull':![],'defaultValue':_0x0eb8('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x0eb8('0x4')]},'dst':{'type':Sequelize[_0x0eb8('0x4')]},'dcontext':{'type':Sequelize[_0x0eb8('0x4')]},'channel':{'type':Sequelize[_0x0eb8('0x4')]},'dstchannel':{'type':Sequelize[_0x0eb8('0x4')]},'lastapp':{'type':Sequelize[_0x0eb8('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x0eb8('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x0eb8('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0eb8('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x0eb8('0x4')]},'userfield':{'type':Sequelize[_0x0eb8('0x4')]},'uniqueid':{'type':Sequelize[_0x0eb8('0x4')]},'linkedid':{'type':Sequelize[_0x0eb8('0x4')]},'sequence':{'type':Sequelize[_0x0eb8('0x4')]},'peeraccount':{'type':Sequelize[_0x0eb8('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index f17d7c5..8836373 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 _0xc14f=['VIRTUAL','options','count','includeAll','include','findAll','rows','show','rawAttributes','length','find','catch','create','body','params','destroy','describe','html-pdf','eml-format','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','index','Cdr','fieldName','type','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map'];(function(_0x2cef72,_0x5bdfc0){var _0x3b5ce3=function(_0x108892){while(--_0x108892){_0x2cef72['push'](_0x2cef72['shift']());}};_0x3b5ce3(++_0x5bdfc0);}(_0xc14f,0xab));var _0xfc14=function(_0xdfe684,_0x8ed941){_0xdfe684=_0xdfe684-0x0;var _0x41c5b3=_0xc14f[_0xdfe684];return _0x41c5b3;};'use strict';var pdf=require(_0xfc14('0x0'));var emlformat=require(_0xfc14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfc14('0x2'));var rp=require('request-promise');var moment=require(_0xfc14('0x3'));var BPromise=require(_0xfc14('0x4'));var Mustache=require('mustache');var util=require(_0xfc14('0x5'));var path=require(_0xfc14('0x6'));var sox=require(_0xfc14('0x7'));var csv=require(_0xfc14('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfc14('0x9'));var squel=require(_0xfc14('0xa'));var crypto=require(_0xfc14('0xb'));var jsforce=require(_0xfc14('0xc'));var deskjs=require(_0xfc14('0xd'));var toCsv=require(_0xfc14('0x8'));var querystring=require(_0xfc14('0xe'));var Papa=require(_0xfc14('0xf'));var Redis=require(_0xfc14('0x10'));var authService=require(_0xfc14('0x11'));var qs=require(_0xfc14('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc14('0x13'));var logger=require('../../config/logger')(_0xfc14('0x14'));var utils=require(_0xfc14('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfc14('0x16'));var db=require(_0xfc14('0x17'))['db'];function respondWithStatusCode(_0x194512,_0x26861e){_0x26861e=_0x26861e||0xcc;return function(_0x3ec763){if(_0x3ec763){return _0x194512[_0xfc14('0x18')](_0x26861e);}return _0x194512['status'](_0x26861e)[_0xfc14('0x19')]();};}function respondWithResult(_0x3f9e73,_0x4689a5){_0x4689a5=_0x4689a5||0xc8;return function(_0xb33ddd){if(_0xb33ddd){return _0x3f9e73[_0xfc14('0x1a')](_0x4689a5)['json'](_0xb33ddd);}};}function respondWithFilteredResult(_0x33be08,_0x2f19cf){return function(_0xff20d7){if(_0xff20d7){var _0x209503=_0xff20d7['count'],_0x28ce7f=_0x2f19cf[_0xfc14('0x1b')],_0x54b619=_0x2f19cf[_0xfc14('0x1b')]+_0x2f19cf[_0xfc14('0x1c')],_0x23ed89;if(_0x54b619>=_0x209503){_0x54b619=_0x209503;_0x23ed89=0xc8;}else{_0x23ed89=0xce;}_0x33be08['status'](_0x23ed89);return _0x33be08[_0xfc14('0x1d')](_0xfc14('0x1e'),_0x28ce7f+'-'+_0x54b619+'/'+_0x209503)[_0xfc14('0x1f')](_0xff20d7);}return null;};}function patchUpdates(_0x609f41){return function(_0x43b075){try{jsonpatch[_0xfc14('0x20')](_0x43b075,_0x609f41,!![]);}catch(_0x26fb29){return BPromise[_0xfc14('0x21')](_0x26fb29);}return _0x43b075[_0xfc14('0x22')]();};}function saveUpdates(_0x184f65,_0x36776d){return function(_0x533e6a){if(_0x533e6a){return _0x533e6a['update'](_0x184f65)[_0xfc14('0x23')](function(_0x255173){return _0x255173;});}return null;};}function removeEntity(_0x224260,_0x103317){return function(_0x4e4229){if(_0x4e4229){return _0x4e4229['destroy']()[_0xfc14('0x23')](function(){_0x224260[_0xfc14('0x1a')](0xcc)[_0xfc14('0x19')]();});}};}function handleEntityNotFound(_0x4c490f,_0x3904af){return function(_0x3a67de){if(!_0x3a67de){_0x4c490f['sendStatus'](0x194);}return _0x3a67de;};}function handleError(_0x5a2f0d,_0x3062ab){_0x3062ab=_0x3062ab||0x1f4;return function(_0x2f2a2f){logger[_0xfc14('0x24')](_0x2f2a2f[_0xfc14('0x25')]);if(_0x2f2a2f[_0xfc14('0x26')]){delete _0x2f2a2f[_0xfc14('0x26')];}_0x5a2f0d[_0xfc14('0x1a')](_0x3062ab)[_0xfc14('0x27')](_0x2f2a2f);};}exports[_0xfc14('0x28')]=function(_0x476a59,_0x49ab1a){var _0x5e30da={},_0x4db632={},_0x2820c3={'count':0x0,'rows':[]};var _0x5ea0de=_['map'](db[_0xfc14('0x29')]['rawAttributes'],function(_0x32c670){return{'name':_0x32c670[_0xfc14('0x2a')],'type':_0x32c670[_0xfc14('0x2b')]['key']};});_0x4db632['model']=_['map'](_0x5ea0de,_0xfc14('0x26'));_0x4db632['query']=_[_0xfc14('0x2c')](_0x476a59[_0xfc14('0x2d')]);_0x4db632[_0xfc14('0x2e')]=_['intersection'](_0x4db632[_0xfc14('0x2f')],_0x4db632[_0xfc14('0x2d')]);_0x5e30da[_0xfc14('0x30')]=_[_0xfc14('0x31')](_0x4db632[_0xfc14('0x2f')],qs[_0xfc14('0x32')](_0x476a59[_0xfc14('0x2d')][_0xfc14('0x32')]));_0x5e30da[_0xfc14('0x30')]=_0x5e30da[_0xfc14('0x30')]['length']?_0x5e30da[_0xfc14('0x30')]:_0x4db632[_0xfc14('0x2f')];if(!_0x476a59[_0xfc14('0x2d')][_0xfc14('0x33')](_0xfc14('0x34'))){_0x5e30da[_0xfc14('0x1c')]=qs[_0xfc14('0x1c')](_0x476a59['query']['limit']);_0x5e30da[_0xfc14('0x1b')]=qs[_0xfc14('0x1b')](_0x476a59['query'][_0xfc14('0x1b')]);}_0x5e30da[_0xfc14('0x35')]=qs[_0xfc14('0x36')](_0x476a59[_0xfc14('0x2d')][_0xfc14('0x36')]);_0x5e30da['where']=qs[_0xfc14('0x2e')](_[_0xfc14('0x37')](_0x476a59[_0xfc14('0x2d')],_0x4db632[_0xfc14('0x2e')]),_0x5ea0de);if(_0x476a59['query'][_0xfc14('0x38')]){_0x5e30da[_0xfc14('0x39')]=_[_0xfc14('0x3a')](_0x5e30da['where'],{'$or':_[_0xfc14('0x3b')](_0x5ea0de,function(_0x22f113){if(_0x22f113[_0xfc14('0x2b')]!==_0xfc14('0x3c')){var _0x29b146={};_0x29b146[_0x22f113['name']]={'$like':'%'+_0x476a59[_0xfc14('0x2d')][_0xfc14('0x38')]+'%'};return _0x29b146;}})});}_0x5e30da=_['merge']({},_0x5e30da,_0x476a59[_0xfc14('0x3d')]);var _0x512c0e={'where':_0x5e30da['where']};return db[_0xfc14('0x29')][_0xfc14('0x3e')](_0x512c0e)['then'](function(_0x43c8f2){_0x2820c3['count']=_0x43c8f2;if(_0x476a59[_0xfc14('0x2d')][_0xfc14('0x3f')]){_0x5e30da[_0xfc14('0x40')]=[{'all':!![]}];}return db[_0xfc14('0x29')][_0xfc14('0x41')](_0x5e30da);})[_0xfc14('0x23')](function(_0x10a7f8){_0x2820c3[_0xfc14('0x42')]=_0x10a7f8;return _0x2820c3;})['then'](respondWithFilteredResult(_0x49ab1a,_0x5e30da))['catch'](handleError(_0x49ab1a,null));};exports[_0xfc14('0x43')]=function(_0x464f67,_0x25d7d6){var _0x15682d={'raw':!![],'where':{'id':_0x464f67['params']['id']}},_0x2c1f34={};_0x2c1f34[_0xfc14('0x2f')]=_[_0xfc14('0x2c')](db[_0xfc14('0x29')][_0xfc14('0x44')]);_0x2c1f34[_0xfc14('0x2d')]=_[_0xfc14('0x2c')](_0x464f67['query']);_0x2c1f34['filtears']=_[_0xfc14('0x31')](_0x2c1f34[_0xfc14('0x2f')],_0x2c1f34[_0xfc14('0x2d')]);_0x15682d[_0xfc14('0x30')]=_[_0xfc14('0x31')](_0x2c1f34['model'],qs[_0xfc14('0x32')](_0x464f67[_0xfc14('0x2d')][_0xfc14('0x32')]));_0x15682d[_0xfc14('0x30')]=_0x15682d[_0xfc14('0x30')][_0xfc14('0x45')]?_0x15682d[_0xfc14('0x30')]:_0x2c1f34[_0xfc14('0x2f')];if(_0x464f67[_0xfc14('0x2d')][_0xfc14('0x3f')]){_0x15682d['include']=[{'all':!![]}];}_0x15682d=_[_0xfc14('0x3a')]({},_0x15682d,_0x464f67['options']);return db[_0xfc14('0x29')][_0xfc14('0x46')](_0x15682d)[_0xfc14('0x23')](handleEntityNotFound(_0x25d7d6,null))[_0xfc14('0x23')](respondWithResult(_0x25d7d6,null))[_0xfc14('0x47')](handleError(_0x25d7d6,null));};exports['create']=function(_0x27590a,_0x15c73f){return db['Cdr'][_0xfc14('0x48')](_0x27590a[_0xfc14('0x49')],{})['then'](respondWithResult(_0x15c73f,0xc9))[_0xfc14('0x47')](handleError(_0x15c73f,null));};exports['update']=function(_0x25b14e,_0xaaa8c0){if(_0x25b14e['body']['id']){delete _0x25b14e[_0xfc14('0x49')]['id'];}return db[_0xfc14('0x29')][_0xfc14('0x46')]({'where':{'id':_0x25b14e[_0xfc14('0x4a')]['id']}})['then'](handleEntityNotFound(_0xaaa8c0,null))[_0xfc14('0x23')](saveUpdates(_0x25b14e[_0xfc14('0x49')],null))[_0xfc14('0x23')](respondWithResult(_0xaaa8c0,null))[_0xfc14('0x47')](handleError(_0xaaa8c0,null));};exports[_0xfc14('0x4b')]=function(_0x5d735c,_0x2b8b7e){return db[_0xfc14('0x29')]['find']({'where':{'id':_0x5d735c['params']['id']}})[_0xfc14('0x23')](handleEntityNotFound(_0x2b8b7e,null))[_0xfc14('0x23')](removeEntity(_0x2b8b7e,null))[_0xfc14('0x47')](handleError(_0x2b8b7e,null));};exports[_0xfc14('0x4c')]=function(_0x2de843,_0x4eb81b){return db[_0xfc14('0x29')]['describe']()[_0xfc14('0x23')](respondWithResult(_0x4eb81b,null))[_0xfc14('0x47')](handleError(_0x4eb81b,null));}; \ No newline at end of file +var _0x1caf=['fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','filtears','find','catch','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','Cdr','fieldName','type','key','query','keys','filters','intersection','model','attributes'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x1caf,0x1ce));var _0xf1ca=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x1caf[_0x543084];return _0x306a57;};'use strict';var pdf=require(_0xf1ca('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf1ca('0x1'));var jsonpatch=require(_0xf1ca('0x2'));var rp=require(_0xf1ca('0x3'));var moment=require(_0xf1ca('0x4'));var BPromise=require(_0xf1ca('0x5'));var Mustache=require(_0xf1ca('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf1ca('0x7'));var csv=require(_0xf1ca('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf1ca('0x9'));var squel=require(_0xf1ca('0xa'));var crypto=require(_0xf1ca('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf1ca('0x8'));var querystring=require(_0xf1ca('0xc'));var Papa=require('papaparse');var Redis=require(_0xf1ca('0xd'));var authService=require(_0xf1ca('0xe'));var qs=require(_0xf1ca('0xf'));var as=require(_0xf1ca('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf1ca('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf1ca('0x12'));var db=require(_0xf1ca('0x13'))['db'];function respondWithStatusCode(_0x57cdd0,_0x5d852c){_0x5d852c=_0x5d852c||0xcc;return function(_0x18c2c6){if(_0x18c2c6){return _0x57cdd0[_0xf1ca('0x14')](_0x5d852c);}return _0x57cdd0[_0xf1ca('0x15')](_0x5d852c)[_0xf1ca('0x16')]();};}function respondWithResult(_0x43e04c,_0xca44f8){_0xca44f8=_0xca44f8||0xc8;return function(_0x5f532b){if(_0x5f532b){return _0x43e04c[_0xf1ca('0x15')](_0xca44f8)[_0xf1ca('0x17')](_0x5f532b);}};}function respondWithFilteredResult(_0x1ec563,_0x229c0a){return function(_0x1ee679){if(_0x1ee679){var _0x5cab04=_0x1ee679[_0xf1ca('0x18')],_0x5dc01a=_0x229c0a['offset'],_0x4c3c3f=_0x229c0a[_0xf1ca('0x19')]+_0x229c0a['limit'],_0x678f7b;if(_0x4c3c3f>=_0x5cab04){_0x4c3c3f=_0x5cab04;_0x678f7b=0xc8;}else{_0x678f7b=0xce;}_0x1ec563[_0xf1ca('0x15')](_0x678f7b);return _0x1ec563[_0xf1ca('0x1a')](_0xf1ca('0x1b'),_0x5dc01a+'-'+_0x4c3c3f+'/'+_0x5cab04)[_0xf1ca('0x17')](_0x1ee679);}return null;};}function patchUpdates(_0x5aa49f){return function(_0x460221){try{jsonpatch[_0xf1ca('0x1c')](_0x460221,_0x5aa49f,!![]);}catch(_0x1e71c4){return BPromise['reject'](_0x1e71c4);}return _0x460221[_0xf1ca('0x1d')]();};}function saveUpdates(_0x1f7231,_0x2d1d46){return function(_0x5757e4){if(_0x5757e4){return _0x5757e4[_0xf1ca('0x1e')](_0x1f7231)[_0xf1ca('0x1f')](function(_0x27f210){return _0x27f210;});}return null;};}function removeEntity(_0x5d9869,_0x2b2f7f){return function(_0x3bc747){if(_0x3bc747){return _0x3bc747[_0xf1ca('0x20')]()[_0xf1ca('0x1f')](function(){_0x5d9869[_0xf1ca('0x15')](0xcc)[_0xf1ca('0x16')]();});}};}function handleEntityNotFound(_0x25aa3f,_0x27b8f6){return function(_0x3350a2){if(!_0x3350a2){_0x25aa3f[_0xf1ca('0x14')](0x194);}return _0x3350a2;};}function handleError(_0x25eb74,_0x53c7e6){_0x53c7e6=_0x53c7e6||0x1f4;return function(_0x1bba4a){logger[_0xf1ca('0x21')](_0x1bba4a[_0xf1ca('0x22')]);if(_0x1bba4a[_0xf1ca('0x23')]){delete _0x1bba4a[_0xf1ca('0x23')];}_0x25eb74[_0xf1ca('0x15')](_0x53c7e6)[_0xf1ca('0x24')](_0x1bba4a);};}exports[_0xf1ca('0x25')]=function(_0x1047df,_0x4a4fd2){var _0x2b4b3f={},_0x16663a={},_0x55346b={'count':0x0,'rows':[]};var _0xe4e71c=_[_0xf1ca('0x26')](db[_0xf1ca('0x27')]['rawAttributes'],function(_0x58c071){return{'name':_0x58c071[_0xf1ca('0x28')],'type':_0x58c071[_0xf1ca('0x29')][_0xf1ca('0x2a')]};});_0x16663a['model']=_[_0xf1ca('0x26')](_0xe4e71c,_0xf1ca('0x23'));_0x16663a[_0xf1ca('0x2b')]=_[_0xf1ca('0x2c')](_0x1047df[_0xf1ca('0x2b')]);_0x16663a[_0xf1ca('0x2d')]=_[_0xf1ca('0x2e')](_0x16663a[_0xf1ca('0x2f')],_0x16663a['query']);_0x2b4b3f[_0xf1ca('0x30')]=_[_0xf1ca('0x2e')](_0x16663a[_0xf1ca('0x2f')],qs[_0xf1ca('0x31')](_0x1047df[_0xf1ca('0x2b')][_0xf1ca('0x31')]));_0x2b4b3f['attributes']=_0x2b4b3f[_0xf1ca('0x30')][_0xf1ca('0x32')]?_0x2b4b3f['attributes']:_0x16663a[_0xf1ca('0x2f')];if(!_0x1047df['query'][_0xf1ca('0x33')](_0xf1ca('0x34'))){_0x2b4b3f[_0xf1ca('0x35')]=qs['limit'](_0x1047df['query']['limit']);_0x2b4b3f['offset']=qs['offset'](_0x1047df[_0xf1ca('0x2b')]['offset']);}_0x2b4b3f[_0xf1ca('0x36')]=qs[_0xf1ca('0x37')](_0x1047df['query'][_0xf1ca('0x37')]);_0x2b4b3f[_0xf1ca('0x38')]=qs[_0xf1ca('0x2d')](_['pick'](_0x1047df[_0xf1ca('0x2b')],_0x16663a['filters']),_0xe4e71c);if(_0x1047df[_0xf1ca('0x2b')][_0xf1ca('0x39')]){_0x2b4b3f['where']=_['merge'](_0x2b4b3f['where'],{'$or':_[_0xf1ca('0x26')](_0xe4e71c,function(_0x18c77a){if(_0x18c77a['type']!==_0xf1ca('0x3a')){var _0x2e5d54={};_0x2e5d54[_0x18c77a[_0xf1ca('0x23')]]={'$like':'%'+_0x1047df['query'][_0xf1ca('0x39')]+'%'};return _0x2e5d54;}})});}_0x2b4b3f=_[_0xf1ca('0x3b')]({},_0x2b4b3f,_0x1047df[_0xf1ca('0x3c')]);var _0x47ec69={'where':_0x2b4b3f[_0xf1ca('0x38')]};return db[_0xf1ca('0x27')][_0xf1ca('0x18')](_0x47ec69)[_0xf1ca('0x1f')](function(_0x3393a4){_0x55346b[_0xf1ca('0x18')]=_0x3393a4;if(_0x1047df['query'][_0xf1ca('0x3d')]){_0x2b4b3f[_0xf1ca('0x3e')]=[{'all':!![]}];}return db[_0xf1ca('0x27')][_0xf1ca('0x3f')](_0x2b4b3f);})[_0xf1ca('0x1f')](function(_0x454ee3){_0x55346b[_0xf1ca('0x40')]=_0x454ee3;return _0x55346b;})[_0xf1ca('0x1f')](respondWithFilteredResult(_0x4a4fd2,_0x2b4b3f))['catch'](handleError(_0x4a4fd2,null));};exports[_0xf1ca('0x41')]=function(_0x17dbae,_0x375fc1){var _0x584f92={'raw':!![],'where':{'id':_0x17dbae[_0xf1ca('0x42')]['id']}},_0x25449c={};_0x25449c[_0xf1ca('0x2f')]=_[_0xf1ca('0x2c')](db[_0xf1ca('0x27')][_0xf1ca('0x43')]);_0x25449c['query']=_[_0xf1ca('0x2c')](_0x17dbae['query']);_0x25449c[_0xf1ca('0x44')]=_[_0xf1ca('0x2e')](_0x25449c[_0xf1ca('0x2f')],_0x25449c[_0xf1ca('0x2b')]);_0x584f92[_0xf1ca('0x30')]=_[_0xf1ca('0x2e')](_0x25449c['model'],qs[_0xf1ca('0x31')](_0x17dbae['query'][_0xf1ca('0x31')]));_0x584f92['attributes']=_0x584f92[_0xf1ca('0x30')][_0xf1ca('0x32')]?_0x584f92[_0xf1ca('0x30')]:_0x25449c[_0xf1ca('0x2f')];if(_0x17dbae['query']['includeAll']){_0x584f92[_0xf1ca('0x3e')]=[{'all':!![]}];}_0x584f92=_[_0xf1ca('0x3b')]({},_0x584f92,_0x17dbae['options']);return db[_0xf1ca('0x27')][_0xf1ca('0x45')](_0x584f92)[_0xf1ca('0x1f')](handleEntityNotFound(_0x375fc1,null))[_0xf1ca('0x1f')](respondWithResult(_0x375fc1,null))[_0xf1ca('0x46')](handleError(_0x375fc1,null));};exports[_0xf1ca('0x47')]=function(_0x10f713,_0x433161){return db[_0xf1ca('0x27')][_0xf1ca('0x47')](_0x10f713[_0xf1ca('0x48')],{})[_0xf1ca('0x1f')](respondWithResult(_0x433161,0xc9))[_0xf1ca('0x46')](handleError(_0x433161,null));};exports['update']=function(_0x505a0f,_0x54d5a4){if(_0x505a0f[_0xf1ca('0x48')]['id']){delete _0x505a0f[_0xf1ca('0x48')]['id'];}return db['Cdr'][_0xf1ca('0x45')]({'where':{'id':_0x505a0f[_0xf1ca('0x42')]['id']}})[_0xf1ca('0x1f')](handleEntityNotFound(_0x54d5a4,null))[_0xf1ca('0x1f')](saveUpdates(_0x505a0f[_0xf1ca('0x48')],null))['then'](respondWithResult(_0x54d5a4,null))[_0xf1ca('0x46')](handleError(_0x54d5a4,null));};exports['destroy']=function(_0x1625e7,_0x415156){return db['Cdr'][_0xf1ca('0x45')]({'where':{'id':_0x1625e7[_0xf1ca('0x42')]['id']}})[_0xf1ca('0x1f')](handleEntityNotFound(_0x415156,null))[_0xf1ca('0x1f')](removeEntity(_0x415156,null))[_0xf1ca('0x46')](handleError(_0x415156,null));};exports['describe']=function(_0x5d3398,_0x5564de){return db['Cdr']['describe']()[_0xf1ca('0x1f')](respondWithResult(_0x5564de,null))[_0xf1ca('0x46')](handleError(_0x5564de,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 4dc8861..9cad718 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 _0x4137=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api'];(function(_0x23966e,_0x58e2d7){var _0x474e9e=function(_0xf60e0e){while(--_0xf60e0e){_0x23966e['push'](_0x23966e['shift']());}};_0x474e9e(++_0x58e2d7);}(_0x4137,0xf8));var _0x7413=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4137[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var logger=require(_0x7413('0x2'))(_0x7413('0x3'));var moment=require(_0x7413('0x4'));var BPromise=require(_0x7413('0x5'));var rp=require(_0x7413('0x6'));var fs=require('fs');var path=require(_0x7413('0x7'));var rimraf=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var attributes=require(_0x7413('0xa'));module[_0x7413('0xb')]=function(_0x4fbade,_0xc808cd){return _0x4fbade[_0x7413('0xc')](_0x7413('0xd'),attributes,{'tableName':_0x7413('0xe'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x7413('0xf')]},{'name':_0x7413('0x10'),'fields':['calldate']},{'name':_0x7413('0x11'),'fields':[_0x7413('0x11')]},{'name':'dst','fields':[_0x7413('0x12')]},{'name':_0x7413('0x13'),'fields':[_0x7413('0x13')]},{'name':_0x7413('0x14'),'fields':[_0x7413('0x14')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4819=['cdr','accountcode','calldate','disposition','dst','src','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','Cdr'];(function(_0x256a42,_0x4e6542){var _0x4663e4=function(_0x241dc4){while(--_0x241dc4){_0x256a42['push'](_0x256a42['shift']());}};_0x4663e4(++_0x4e6542);}(_0x4819,0xcd));var _0x9481=function(_0x317725,_0x1bd734){_0x317725=_0x317725-0x0;var _0x1e08cb=_0x4819[_0x317725];return _0x1e08cb;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[{'name':_0x9481('0xc'),'fields':[_0x9481('0xc')]},{'name':_0x9481('0xd'),'fields':['calldate']},{'name':_0x9481('0xe'),'fields':['disposition']},{'name':_0x9481('0xf'),'fields':['dst']},{'name':_0x9481('0x10'),'fields':[_0x9481('0x10')]},{'name':_0x9481('0x11'),'fields':[_0x9481('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 6a5f27f..9ff32f5 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 _0xeefb=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xeefb,0x10d));var _0xbeef=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xeefb[_0x5f0089];return _0x193892;};'use strict';var _=require(_0xbeef('0x0'));var util=require(_0xbeef('0x1'));var moment=require('moment');var BPromise=require(_0xbeef('0x2'));var rs=require(_0xbeef('0x3'));var fs=require('fs');var Redis=require(_0xbeef('0x4'));var db=require(_0xbeef('0x5'))['db'];var utils=require(_0xbeef('0x6'));var logger=require(_0xbeef('0x7'))(_0xbeef('0x8'));var config=require(_0xbeef('0x9'));var jayson=require(_0xbeef('0xa'));var client=jayson[_0xbeef('0xb')][_0xbeef('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ef6e5,_0x4896de,_0x1f1969){return new BPromise(function(_0x59f196,_0x5d52c3){return client[_0xbeef('0xd')](_0x4ef6e5,_0x1f1969)[_0xbeef('0xe')](function(_0x558f41){logger[_0xbeef('0xf')](_0xbeef('0x10'),_0x4896de,_0xbeef('0x11'));logger[_0xbeef('0x12')](_0xbeef('0x13'),_0x4896de,'request\x20sent',JSON[_0xbeef('0x14')](_0x558f41));if(_0x558f41[_0xbeef('0x15')]){if(_0x558f41[_0xbeef('0x15')][_0xbeef('0x16')]===0x1f4){logger[_0xbeef('0x15')](_0xbeef('0x10'),_0x4896de,_0x558f41[_0xbeef('0x15')][_0xbeef('0x17')]);return _0x5d52c3(_0x558f41[_0xbeef('0x15')]['message']);}logger[_0xbeef('0x15')]('Cdr,\x20%s,\x20%s',_0x4896de,_0x558f41['error']['message']);return _0x59f196(_0x558f41['error'][_0xbeef('0x17')]);}else{logger[_0xbeef('0xf')](_0xbeef('0x10'),_0x4896de,_0xbeef('0x11'));_0x59f196(_0x558f41['result'][_0xbeef('0x17')]);}})[_0xbeef('0x18')](function(_0x3cde7b){logger[_0xbeef('0x15')](_0xbeef('0x10'),_0x4896de,_0x3cde7b);_0x5d52c3(_0x3cde7b);});});} \ No newline at end of file +var _0x12cb=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util'];(function(_0x236b36,_0xa1f9de){var _0x23b450=function(_0x30e962){while(--_0x30e962){_0x236b36['push'](_0x236b36['shift']());}};_0x23b450(++_0xa1f9de);}(_0x12cb,0x124));var _0xb12c=function(_0x3f0df6,_0x2a7531){_0x3f0df6=_0x3f0df6-0x0;var _0x42eda7=_0x12cb[_0x3f0df6];return _0x42eda7;};'use strict';var _=require(_0xb12c('0x0'));var util=require(_0xb12c('0x1'));var moment=require('moment');var BPromise=require(_0xb12c('0x2'));var rs=require(_0xb12c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb12c('0x4'))['db'];var utils=require(_0xb12c('0x5'));var logger=require('../../config/logger')(_0xb12c('0x6'));var config=require(_0xb12c('0x7'));var jayson=require(_0xb12c('0x8'));var client=jayson['client'][_0xb12c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbd2fcb,_0x426a0e,_0x312b9c){return new BPromise(function(_0x1238cc,_0x42cacd){return client[_0xb12c('0xa')](_0xbd2fcb,_0x312b9c)[_0xb12c('0xb')](function(_0xb24bc1){logger['info'](_0xb12c('0xc'),_0x426a0e,_0xb12c('0xd'));logger[_0xb12c('0xe')](_0xb12c('0xf'),_0x426a0e,_0xb12c('0xd'),JSON[_0xb12c('0x10')](_0xb24bc1));if(_0xb24bc1['error']){if(_0xb24bc1[_0xb12c('0x11')][_0xb12c('0x12')]===0x1f4){logger[_0xb12c('0x11')](_0xb12c('0xc'),_0x426a0e,_0xb24bc1[_0xb12c('0x11')][_0xb12c('0x13')]);return _0x42cacd(_0xb24bc1['error']['message']);}logger['error'](_0xb12c('0xc'),_0x426a0e,_0xb24bc1[_0xb12c('0x11')][_0xb12c('0x13')]);return _0x1238cc(_0xb24bc1[_0xb12c('0x11')]['message']);}else{logger[_0xb12c('0x14')](_0xb12c('0xc'),_0x426a0e,_0xb12c('0xd'));_0x1238cc(_0xb24bc1['result'][_0xb12c('0x13')]);}})['catch'](function(_0x230aeb){logger[_0xb12c('0x11')]('Cdr,\x20%s,\x20%s',_0x426a0e,_0x230aeb);_0x42cacd(_0x230aeb);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 91b3cc7..fe33929 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 _0xafd5=['create','put','/:id','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','isAuthenticated','index','get','/describe','describe','show','post'];(function(_0x2a123d,_0x49e77a){var _0x2ceb0a=function(_0x2f7049){while(--_0x2f7049){_0x2a123d['push'](_0x2a123d['shift']());}};_0x2ceb0a(++_0x49e77a);}(_0xafd5,0x195));var _0x5afd=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xafd5[_0x45bf86];return _0x1f02b7;};'use strict';var multer=require(_0x5afd('0x0'));var util=require(_0x5afd('0x1'));var path=require('path');var timeout=require(_0x5afd('0x2'));var express=require(_0x5afd('0x3'));var router=express['Router']();var auth=require(_0x5afd('0x4'));var interaction=require(_0x5afd('0x5'));var config=require(_0x5afd('0x6'));var controller=require(_0x5afd('0x7'));router['get']('/',auth[_0x5afd('0x8')](),controller[_0x5afd('0x9')]);router[_0x5afd('0xa')](_0x5afd('0xb'),auth['isAuthenticated'](),controller[_0x5afd('0xc')]);router[_0x5afd('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x5afd('0xd')]);router[_0x5afd('0xe')]('/',auth['isAuthenticated'](),controller[_0x5afd('0xf')]);router[_0x5afd('0x10')](_0x5afd('0x11'),auth[_0x5afd('0x8')](),controller['update']);router[_0x5afd('0x12')](_0x5afd('0x11'),auth[_0x5afd('0x8')](),controller[_0x5afd('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0c95=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x307e30,_0xf9cfc0){var _0x471fc0=function(_0x49d8bd){while(--_0x49d8bd){_0x307e30['push'](_0x307e30['shift']());}};_0x471fc0(++_0xf9cfc0);}(_0x0c95,0x185));var _0x50c9=function(_0x51ab33,_0x71a8a8){_0x51ab33=_0x51ab33-0x0;var _0x5e1298=_0x0c95[_0x51ab33];return _0x5e1298;};'use strict';var multer=require(_0x50c9('0x0'));var util=require(_0x50c9('0x1'));var path=require(_0x50c9('0x2'));var timeout=require(_0x50c9('0x3'));var express=require(_0x50c9('0x4'));var router=express[_0x50c9('0x5')]();var auth=require(_0x50c9('0x6'));var interaction=require(_0x50c9('0x7'));var config=require(_0x50c9('0x8'));var controller=require(_0x50c9('0x9'));router[_0x50c9('0xa')]('/',auth[_0x50c9('0xb')](),controller[_0x50c9('0xc')]);router['get'](_0x50c9('0xd'),auth[_0x50c9('0xb')](),controller[_0x50c9('0xe')]);router[_0x50c9('0xa')](_0x50c9('0xf'),auth[_0x50c9('0xb')](),controller[_0x50c9('0x10')]);router[_0x50c9('0x11')]('/',auth['isAuthenticated'](),controller[_0x50c9('0x12')]);router[_0x50c9('0x13')]('/:id',auth[_0x50c9('0xb')](),controller[_0x50c9('0x14')]);router[_0x50c9('0x15')](_0x50c9('0xf'),auth[_0x50c9('0xb')](),controller[_0x50c9('0x16')]);module[_0x50c9('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 25478bc..423e6d9 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 _0x67ba=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x67ba,0x1b9));var _0xa67b=function(_0x9f4c5f,_0x24f44e){_0x9f4c5f=_0x9f4c5f-0x0;var _0x2ad13a=_0x67ba[_0x9f4c5f];return _0x2ad13a;};'use strict';var Sequelize=require(_0xa67b('0x0'));module[_0xa67b('0x1')]={'priority':{'type':Sequelize[_0xa67b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa67b('0x3')],'allowNull':![],'defaultValue':_0xa67b('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xa67b('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa67b('0x5')}}; \ No newline at end of file +var _0xbdd1=['*,*,*,*','sequelize','INTEGER','TEXT','STRING'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xbdd1,0x137));var _0x1bdd=function(_0x8a29bb,_0x365eb4){_0x8a29bb=_0x8a29bb-0x0;var _0xbaeeb8=_0xbdd1[_0x8a29bb];return _0xbaeeb8;};'use strict';var Sequelize=require(_0x1bdd('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1bdd('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x1bdd('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1bdd('0x3')],'defaultValue':_0x1bdd('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 22bea7a..eeb47e1 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 _0x364f=['apply','reject','save','update','then','destroy','error','stack','name','show','params','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','options','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x364f,0x16e));var _0xf364=function(_0x2a403a,_0x4ec334){_0x2a403a=_0x2a403a-0x0;var _0x3a0f0d=_0x364f[_0x2a403a];return _0x3a0f0d;};'use strict';var pdf=require(_0xf364('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf364('0x1'));var zipdir=require(_0xf364('0x2'));var jsonpatch=require(_0xf364('0x3'));var rp=require('request-promise');var moment=require(_0xf364('0x4'));var BPromise=require(_0xf364('0x5'));var Mustache=require(_0xf364('0x6'));var util=require(_0xf364('0x7'));var path=require(_0xf364('0x8'));var sox=require(_0xf364('0x9'));var csv=require(_0xf364('0xa'));var ejs=require(_0xf364('0xb'));var fs=require('fs');var _=require(_0xf364('0xc'));var squel=require(_0xf364('0xd'));var crypto=require('crypto');var jsforce=require(_0xf364('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf364('0xa'));var querystring=require(_0xf364('0xf'));var Papa=require(_0xf364('0x10'));var Redis=require(_0xf364('0x11'));var authService=require(_0xf364('0x12'));var qs=require(_0xf364('0x13'));var as=require(_0xf364('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf364('0x15'));var config=require(_0xf364('0x16'));var licenseUtil=require(_0xf364('0x17'));var db=require(_0xf364('0x18'))['db'];function respondWithStatusCode(_0x822414,_0x22a4bb){_0x22a4bb=_0x22a4bb||0xcc;return function(_0x3323e2){if(_0x3323e2){return _0x822414[_0xf364('0x19')](_0x22a4bb);}return _0x822414[_0xf364('0x1a')](_0x22a4bb)[_0xf364('0x1b')]();};}function respondWithResult(_0xff405b,_0x2205f1){_0x2205f1=_0x2205f1||0xc8;return function(_0x3493d4){if(_0x3493d4){return _0xff405b[_0xf364('0x1a')](_0x2205f1)[_0xf364('0x1c')](_0x3493d4);}};}function respondWithFilteredResult(_0x2ac284,_0x178145){return function(_0x2e0370){if(_0x2e0370){var _0x2afd1f=_0x2e0370[_0xf364('0x1d')],_0x2cc41e=_0x178145[_0xf364('0x1e')],_0x4b5f3e=_0x178145[_0xf364('0x1e')]+_0x178145['limit'],_0x7b6bfe;if(_0x4b5f3e>=_0x2afd1f){_0x4b5f3e=_0x2afd1f;_0x7b6bfe=0xc8;}else{_0x7b6bfe=0xce;}_0x2ac284[_0xf364('0x1a')](_0x7b6bfe);return _0x2ac284[_0xf364('0x1f')](_0xf364('0x20'),_0x2cc41e+'-'+_0x4b5f3e+'/'+_0x2afd1f)[_0xf364('0x1c')](_0x2e0370);}return null;};}function patchUpdates(_0x26c7e3){return function(_0x53318e){try{jsonpatch[_0xf364('0x21')](_0x53318e,_0x26c7e3,!![]);}catch(_0x59f19b){return BPromise[_0xf364('0x22')](_0x59f19b);}return _0x53318e[_0xf364('0x23')]();};}function saveUpdates(_0x3983f6,_0x558224){return function(_0x2b153b){if(_0x2b153b){return _0x2b153b[_0xf364('0x24')](_0x3983f6)[_0xf364('0x25')](function(_0x5ea743){return _0x5ea743;});}return null;};}function removeEntity(_0xad5314,_0x53b254){return function(_0x8c07cf){if(_0x8c07cf){return _0x8c07cf[_0xf364('0x26')]()[_0xf364('0x25')](function(){_0xad5314[_0xf364('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34e83b,_0x4dee53){return function(_0x3785fa){if(!_0x3785fa){_0x34e83b[_0xf364('0x19')](0x194);}return _0x3785fa;};}function handleError(_0x4e664a,_0x5258cd){_0x5258cd=_0x5258cd||0x1f4;return function(_0x1d94fd){logger[_0xf364('0x27')](_0x1d94fd[_0xf364('0x28')]);if(_0x1d94fd['name']){delete _0x1d94fd[_0xf364('0x29')];}_0x4e664a[_0xf364('0x1a')](_0x5258cd)['send'](_0x1d94fd);};}exports[_0xf364('0x2a')]=function(_0x20e3c6,_0x261d16){var _0x5c6687={'raw':!![],'where':{'id':_0x20e3c6[_0xf364('0x2b')]['id']}},_0x3b1edc={};_0x3b1edc[_0xf364('0x2c')]=_[_0xf364('0x2d')](db[_0xf364('0x2e')][_0xf364('0x2f')]);_0x3b1edc[_0xf364('0x30')]=_[_0xf364('0x2d')](_0x20e3c6['query']);_0x3b1edc['filtears']=_[_0xf364('0x31')](_0x3b1edc[_0xf364('0x2c')],_0x3b1edc[_0xf364('0x30')]);_0x5c6687[_0xf364('0x32')]=_[_0xf364('0x31')](_0x3b1edc[_0xf364('0x2c')],qs[_0xf364('0x33')](_0x20e3c6[_0xf364('0x30')]['fields']));_0x5c6687[_0xf364('0x32')]=_0x5c6687[_0xf364('0x32')][_0xf364('0x34')]?_0x5c6687[_0xf364('0x32')]:_0x3b1edc[_0xf364('0x2c')];if(_0x20e3c6['query'][_0xf364('0x35')]){_0x5c6687[_0xf364('0x36')]=[{'all':!![]}];}_0x5c6687=_[_0xf364('0x37')]({},_0x5c6687,_0x20e3c6[_0xf364('0x38')]);return db[_0xf364('0x2e')]['find'](_0x5c6687)['then'](handleEntityNotFound(_0x261d16,null))['then'](respondWithResult(_0x261d16,null))['catch'](handleError(_0x261d16,null));};exports['update']=function(_0xcd4555,_0xbb6f48){if(_0xcd4555['body']['id']){delete _0xcd4555['body']['id'];}return db[_0xf364('0x2e')]['find']({'where':{'id':_0xcd4555[_0xf364('0x2b')]['id']}})[_0xf364('0x25')](handleEntityNotFound(_0xbb6f48,null))[_0xf364('0x25')](saveUpdates(_0xcd4555['body'],null))['then'](respondWithResult(_0xbb6f48,null))['catch'](handleError(_0xbb6f48,null));};exports[_0xf364('0x26')]=function(_0x58b3de,_0x220df4){return db[_0xf364('0x2e')]['find']({'where':{'id':_0x58b3de['params']['id']}})[_0xf364('0x25')](handleEntityNotFound(_0x220df4,null))[_0xf364('0x25')](removeEntity(_0x220df4,null))['catch'](handleError(_0x220df4,null));}; \ No newline at end of file +var _0x60ad=['moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','status','count','limit','set','json','apply','reject','then','error','stack','name','model','keys','ChatApplication','rawAttributes','query','filtears','intersection','attributes','fields','length','includeAll','include','merge','options','catch','update','body','find','params','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0xd5f797,_0x25b324){var _0x491dda=function(_0x43a648){while(--_0x43a648){_0xd5f797['push'](_0xd5f797['shift']());}};_0x491dda(++_0x25b324);}(_0x60ad,0x112));var _0xd60a=function(_0x495884,_0x100255){_0x495884=_0x495884-0x0;var _0xdb8145=_0x60ad[_0x495884];return _0xdb8145;};'use strict';var pdf=require(_0xd60a('0x0'));var emlformat=require(_0xd60a('0x1'));var rimraf=require(_0xd60a('0x2'));var zipdir=require(_0xd60a('0x3'));var jsonpatch=require(_0xd60a('0x4'));var rp=require(_0xd60a('0x5'));var moment=require(_0xd60a('0x6'));var BPromise=require(_0xd60a('0x7'));var Mustache=require(_0xd60a('0x8'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd60a('0x9'));var ejs=require(_0xd60a('0xa'));var fs=require('fs');var _=require(_0xd60a('0xb'));var squel=require(_0xd60a('0xc'));var crypto=require(_0xd60a('0xd'));var jsforce=require(_0xd60a('0xe'));var deskjs=require(_0xd60a('0xf'));var toCsv=require(_0xd60a('0x9'));var querystring=require(_0xd60a('0x10'));var Papa=require('papaparse');var Redis=require(_0xd60a('0x11'));var authService=require(_0xd60a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd60a('0x13'));var hardwareService=require(_0xd60a('0x14'));var logger=require(_0xd60a('0x15'))(_0xd60a('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd60a('0x17'))['db'];function respondWithStatusCode(_0x164449,_0x5f34d4){_0x5f34d4=_0x5f34d4||0xcc;return function(_0x2d762e){if(_0x2d762e){return _0x164449['sendStatus'](_0x5f34d4);}return _0x164449['status'](_0x5f34d4)[_0xd60a('0x18')]();};}function respondWithResult(_0x4c398e,_0x5072f2){_0x5072f2=_0x5072f2||0xc8;return function(_0x32bb0d){if(_0x32bb0d){return _0x4c398e[_0xd60a('0x19')](_0x5072f2)['json'](_0x32bb0d);}};}function respondWithFilteredResult(_0x1bdc80,_0x53af31){return function(_0x3f4e5e){if(_0x3f4e5e){var _0x40f4d9=_0x3f4e5e[_0xd60a('0x1a')],_0x4bf736=_0x53af31['offset'],_0xd4ef1e=_0x53af31['offset']+_0x53af31[_0xd60a('0x1b')],_0x10374d;if(_0xd4ef1e>=_0x40f4d9){_0xd4ef1e=_0x40f4d9;_0x10374d=0xc8;}else{_0x10374d=0xce;}_0x1bdc80[_0xd60a('0x19')](_0x10374d);return _0x1bdc80[_0xd60a('0x1c')]('Content-Range',_0x4bf736+'-'+_0xd4ef1e+'/'+_0x40f4d9)[_0xd60a('0x1d')](_0x3f4e5e);}return null;};}function patchUpdates(_0x307951){return function(_0x42816d){try{jsonpatch[_0xd60a('0x1e')](_0x42816d,_0x307951,!![]);}catch(_0x4434f7){return BPromise[_0xd60a('0x1f')](_0x4434f7);}return _0x42816d['save']();};}function saveUpdates(_0xd369ee,_0x648264){return function(_0x10b05a){if(_0x10b05a){return _0x10b05a['update'](_0xd369ee)[_0xd60a('0x20')](function(_0x265587){return _0x265587;});}return null;};}function removeEntity(_0x4302b8,_0x22ffb5){return function(_0x463bd7){if(_0x463bd7){return _0x463bd7['destroy']()[_0xd60a('0x20')](function(){_0x4302b8['status'](0xcc)[_0xd60a('0x18')]();});}};}function handleEntityNotFound(_0x2c9443,_0x2a14f5){return function(_0xdd9a8){if(!_0xdd9a8){_0x2c9443['sendStatus'](0x194);}return _0xdd9a8;};}function handleError(_0x307e37,_0x364961){_0x364961=_0x364961||0x1f4;return function(_0x8cf749){logger[_0xd60a('0x21')](_0x8cf749[_0xd60a('0x22')]);if(_0x8cf749[_0xd60a('0x23')]){delete _0x8cf749[_0xd60a('0x23')];}_0x307e37[_0xd60a('0x19')](_0x364961)['send'](_0x8cf749);};}exports['show']=function(_0x251e36,_0x19bf02){var _0x3830bb={'raw':!![],'where':{'id':_0x251e36['params']['id']}},_0x2996a2={};_0x2996a2[_0xd60a('0x24')]=_[_0xd60a('0x25')](db[_0xd60a('0x26')][_0xd60a('0x27')]);_0x2996a2['query']=_[_0xd60a('0x25')](_0x251e36[_0xd60a('0x28')]);_0x2996a2[_0xd60a('0x29')]=_[_0xd60a('0x2a')](_0x2996a2[_0xd60a('0x24')],_0x2996a2[_0xd60a('0x28')]);_0x3830bb[_0xd60a('0x2b')]=_[_0xd60a('0x2a')](_0x2996a2[_0xd60a('0x24')],qs[_0xd60a('0x2c')](_0x251e36['query'][_0xd60a('0x2c')]));_0x3830bb[_0xd60a('0x2b')]=_0x3830bb['attributes'][_0xd60a('0x2d')]?_0x3830bb[_0xd60a('0x2b')]:_0x2996a2[_0xd60a('0x24')];if(_0x251e36[_0xd60a('0x28')][_0xd60a('0x2e')]){_0x3830bb[_0xd60a('0x2f')]=[{'all':!![]}];}_0x3830bb=_[_0xd60a('0x30')]({},_0x3830bb,_0x251e36[_0xd60a('0x31')]);return db[_0xd60a('0x26')]['find'](_0x3830bb)[_0xd60a('0x20')](handleEntityNotFound(_0x19bf02,null))[_0xd60a('0x20')](respondWithResult(_0x19bf02,null))[_0xd60a('0x32')](handleError(_0x19bf02,null));};exports[_0xd60a('0x33')]=function(_0x72a3c1,_0x1bdb30){if(_0x72a3c1[_0xd60a('0x34')]['id']){delete _0x72a3c1[_0xd60a('0x34')]['id'];}return db[_0xd60a('0x26')][_0xd60a('0x35')]({'where':{'id':_0x72a3c1[_0xd60a('0x36')]['id']}})['then'](handleEntityNotFound(_0x1bdb30,null))['then'](saveUpdates(_0x72a3c1[_0xd60a('0x34')],null))[_0xd60a('0x20')](respondWithResult(_0x1bdb30,null))[_0xd60a('0x32')](handleError(_0x1bdb30,null));};exports[_0xd60a('0x37')]=function(_0x356ed2,_0x20017b){return db[_0xd60a('0x26')]['find']({'where':{'id':_0x356ed2[_0xd60a('0x36')]['id']}})[_0xd60a('0x20')](handleEntityNotFound(_0x20017b,null))['then'](removeEntity(_0x20017b,null))['catch'](handleError(_0x20017b,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 972e7a9..4989182 100644 --- a/server/api/chatApplication/chatApplication.model.js +++ b/server/api/chatApplication/chatApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 4f787e5..33e0774 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 _0xbb7b=['ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb7b,0x1d2));var _0xbbb7=function(_0x242ca5,_0x3a3c6e){_0x242ca5=_0x242ca5-0x0;var _0xcaa70b=_0xbb7b[_0x242ca5];return _0xcaa70b;};'use strict';var _=require(_0xbbb7('0x0'));var util=require(_0xbbb7('0x1'));var moment=require(_0xbbb7('0x2'));var BPromise=require(_0xbbb7('0x3'));var rs=require(_0xbbb7('0x4'));var fs=require('fs');var Redis=require(_0xbbb7('0x5'));var db=require(_0xbbb7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbbb7('0x7'))(_0xbbb7('0x8'));var config=require(_0xbbb7('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbbb7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4689cf,_0x368812,_0x56be85){return new BPromise(function(_0x334232,_0x55cdf9){return client[_0xbbb7('0xb')](_0x4689cf,_0x56be85)[_0xbbb7('0xc')](function(_0x2b214b){logger[_0xbbb7('0xd')](_0xbbb7('0xe'),_0x368812,_0xbbb7('0xf'));logger[_0xbbb7('0x10')](_0xbbb7('0x11'),_0x368812,'request\x20sent',JSON[_0xbbb7('0x12')](_0x2b214b));if(_0x2b214b[_0xbbb7('0x13')]){if(_0x2b214b['error'][_0xbbb7('0x14')]===0x1f4){logger[_0xbbb7('0x13')]('ChatApplication,\x20%s,\x20%s',_0x368812,_0x2b214b['error'][_0xbbb7('0x15')]);return _0x55cdf9(_0x2b214b[_0xbbb7('0x13')][_0xbbb7('0x15')]);}logger['error'](_0xbbb7('0xe'),_0x368812,_0x2b214b['error'][_0xbbb7('0x15')]);return _0x334232(_0x2b214b[_0xbbb7('0x13')][_0xbbb7('0x15')]);}else{logger['info'](_0xbbb7('0xe'),_0x368812,_0xbbb7('0xf'));_0x334232(_0x2b214b['result']['message']);}})[_0xbbb7('0x16')](function(_0xba6bff){logger[_0xbbb7('0x13')](_0xbbb7('0xe'),_0x368812,_0xba6bff);_0x55cdf9(_0xba6bff);});});} \ No newline at end of file +var _0x190c=['then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatApplication,\x20%s,\x20%s','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5c811c,_0x313b25){var _0x5df3af=function(_0x3460de){while(--_0x3460de){_0x5c811c['push'](_0x5c811c['shift']());}};_0x5df3af(++_0x313b25);}(_0x190c,0xe8));var _0xc190=function(_0x64aff8,_0x106082){_0x64aff8=_0x64aff8-0x0;var _0x5488a3=_0x190c[_0x64aff8];return _0x5488a3;};'use strict';var _=require(_0xc190('0x0'));var util=require(_0xc190('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc190('0x2'));var db=require(_0xc190('0x3'))['db'];var utils=require(_0xc190('0x4'));var logger=require('../../config/logger')(_0xc190('0x5'));var config=require(_0xc190('0x6'));var jayson=require(_0xc190('0x7'));var client=jayson[_0xc190('0x8')][_0xc190('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8a6aa6,_0x5e796a,_0x37d1e3){return new BPromise(function(_0x2506dc,_0x40ba5f){return client['request'](_0x8a6aa6,_0x37d1e3)[_0xc190('0xa')](function(_0x8ded8f){logger[_0xc190('0xb')]('ChatApplication,\x20%s,\x20%s',_0x5e796a,_0xc190('0xc'));logger[_0xc190('0xd')](_0xc190('0xe'),_0x5e796a,_0xc190('0xc'),JSON[_0xc190('0xf')](_0x8ded8f));if(_0x8ded8f[_0xc190('0x10')]){if(_0x8ded8f[_0xc190('0x10')][_0xc190('0x11')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x5e796a,_0x8ded8f['error'][_0xc190('0x12')]);return _0x40ba5f(_0x8ded8f[_0xc190('0x10')][_0xc190('0x12')]);}logger[_0xc190('0x10')](_0xc190('0x13'),_0x5e796a,_0x8ded8f[_0xc190('0x10')]['message']);return _0x2506dc(_0x8ded8f['error'][_0xc190('0x12')]);}else{logger[_0xc190('0xb')](_0xc190('0x13'),_0x5e796a,_0xc190('0xc'));_0x2506dc(_0x8ded8f[_0xc190('0x14')][_0xc190('0x12')]);}})[_0xc190('0x15')](function(_0x476cdc){logger[_0xc190('0x10')]('ChatApplication,\x20%s,\x20%s',_0x5e796a,_0x476cdc);_0x40ba5f(_0x476cdc);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 3a7bec2..3db78ae 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 _0xf35d=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','update'];(function(_0x244862,_0x3da79e){var _0x2bce23=function(_0x235ae5){while(--_0x235ae5){_0x244862['push'](_0x244862['shift']());}};_0x2bce23(++_0x3da79e);}(_0xf35d,0x194));var _0xdf35=function(_0x63adb9,_0x5dfb61){_0x63adb9=_0x63adb9-0x0;var _0x1410ac=_0xf35d[_0x63adb9];return _0x1410ac;};'use strict';var multer=require('multer');var util=require(_0xdf35('0x0'));var path=require(_0xdf35('0x1'));var timeout=require(_0xdf35('0x2'));var express=require('express');var router=express[_0xdf35('0x3')]();var auth=require(_0xdf35('0x4'));var interaction=require(_0xdf35('0x5'));var config=require(_0xdf35('0x6'));var controller=require(_0xdf35('0x7'));router['get'](_0xdf35('0x8'),auth[_0xdf35('0x9')](),controller[_0xdf35('0xa')]);router['put'](_0xdf35('0x8'),auth[_0xdf35('0x9')](),controller[_0xdf35('0xb')]);router['delete']('/:id',auth[_0xdf35('0x9')](),controller['destroy']);module[_0xdf35('0xc')]=router; \ No newline at end of file +var _0xdb43=['../../config/environment','./chatApplication.controller','isAuthenticated','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x414cbf,_0x36eb68){var _0x15b321=function(_0x1cd77b){while(--_0x1cd77b){_0x414cbf['push'](_0x414cbf['shift']());}};_0x15b321(++_0x36eb68);}(_0xdb43,0x11a));var _0x3db4=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xdb43[_0x47a349];return _0x18ab75;};'use strict';var multer=require(_0x3db4('0x0'));var util=require(_0x3db4('0x1'));var path=require(_0x3db4('0x2'));var timeout=require(_0x3db4('0x3'));var express=require('express');var router=express[_0x3db4('0x4')]();var auth=require(_0x3db4('0x5'));var interaction=require(_0x3db4('0x6'));var config=require(_0x3db4('0x7'));var controller=require(_0x3db4('0x8'));router['get']('/:id',auth[_0x3db4('0x9')](),controller[_0x3db4('0xa')]);router[_0x3db4('0xb')](_0x3db4('0xc'),auth[_0x3db4('0x9')](),controller[_0x3db4('0xd')]);router[_0x3db4('0xe')](_0x3db4('0xc'),auth['isAuthenticated'](),controller[_0x3db4('0xf')]);module[_0x3db4('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 7c38271..9eba423 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 _0x084e=['exports','STRING','BOOLEAN','sequelize'];(function(_0x57f97d,_0x5a2747){var _0x21c252=function(_0x43ded4){while(--_0x43ded4){_0x57f97d['push'](_0x57f97d['shift']());}};_0x21c252(++_0x5a2747);}(_0x084e,0x113));var _0xe084=function(_0x408de5,_0x24fa7b){_0x408de5=_0x408de5-0x0;var _0x2015a1=_0x084e[_0x408de5];return _0x2015a1;};'use strict';var Sequelize=require(_0xe084('0x0'));module[_0xe084('0x1')]={'name':{'type':Sequelize[_0xe084('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe084('0x2')]},'write':{'type':Sequelize[_0xe084('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4b01=['BOOLEAN','sequelize','STRING'];(function(_0x5ad07c,_0x324dcd){var _0x204bae=function(_0x1245bc){while(--_0x1245bc){_0x5ad07c['push'](_0x5ad07c['shift']());}};_0x204bae(++_0x324dcd);}(_0x4b01,0x18a));var _0x14b0=function(_0x562cd1,_0x56a492){_0x562cd1=_0x562cd1-0x0;var _0x1a6346=_0x4b01[_0x562cd1];return _0x1a6346;};'use strict';var Sequelize=require(_0x14b0('0x0'));module['exports']={'name':{'type':Sequelize[_0x14b0('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x14b0('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 1f144ff..28cc84e 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 _0x7f74=['format','YYYY-MM-DD\x20HH:mm:ss','getMessages','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./chatGroup.socket','register','jayson/promise','client','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','end','stack','name','send','index','ChatGroup','rawAttributes','fieldName','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','merge','where','VIRTUAL','filter','options','findAll','show','filtears','includeAll','include','find','create','body','params','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','findOne','User','sort','removeMembers','addMessage','split'];(function(_0x12fa6d,_0x373162){var _0x658587=function(_0x52f16d){while(--_0x52f16d){_0x12fa6d['push'](_0x12fa6d['shift']());}};_0x658587(++_0x373162);}(_0x7f74,0x6e));var _0x47f7=function(_0x4bd76e,_0x260c31){_0x4bd76e=_0x4bd76e-0x0;var _0x96a285=_0x7f74[_0x4bd76e];return _0x96a285;};'use strict';var pdf=require(_0x47f7('0x0'));var emlformat=require(_0x47f7('0x1'));var rimraf=require(_0x47f7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x47f7('0x3'));var moment=require(_0x47f7('0x4'));var BPromise=require(_0x47f7('0x5'));var Mustache=require('mustache');var util=require(_0x47f7('0x6'));var path=require(_0x47f7('0x7'));var sox=require('sox');var csv=require(_0x47f7('0x8'));var ejs=require(_0x47f7('0x9'));var fs=require('fs');var _=require(_0x47f7('0xa'));var squel=require(_0x47f7('0xb'));var crypto=require(_0x47f7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47f7('0xd'));var toCsv=require('to-csv');var querystring=require(_0x47f7('0xe'));var Papa=require(_0x47f7('0xf'));var Redis=require('ioredis');var authService=require(_0x47f7('0x10'));var qs=require(_0x47f7('0x11'));var as=require(_0x47f7('0x12'));var hardwareService=require(_0x47f7('0x13'));var logger=require(_0x47f7('0x14'))(_0x47f7('0x15'));var utils=require(_0x47f7('0x16'));var config=require(_0x47f7('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x47f7('0x18')]=_[_0x47f7('0x19')](config[_0x47f7('0x18')],{'host':_0x47f7('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47f7('0x18')]));require(_0x47f7('0x1b'))[_0x47f7('0x1c')](socket);var jayson=require(_0x47f7('0x1d'));var client=jayson[_0x47f7('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x584cfb,_0x3220cb,_0x4c739f,_0x5e1cb3){return new BPromise(function(_0xc399df,_0x28d5c2){var _0x226d37=_0x5e1cb3||client;return _0x226d37[_0x47f7('0x1f')](_0x584cfb,_0x4c739f)[_0x47f7('0x20')](function(_0x101388){logger[_0x47f7('0x21')](_0x47f7('0x22'),_0x3220cb,_0x47f7('0x23'));logger[_0x47f7('0x24')](_0x47f7('0x25'),_0x3220cb,_0x47f7('0x23'),JSON['stringify'](_0x101388));if(_0x101388[_0x47f7('0x26')]){if(_0x101388['error'][_0x47f7('0x27')]===0x1f4){logger[_0x47f7('0x26')](_0x47f7('0x22'),_0x3220cb,_0x101388['error']['message']);return _0x28d5c2(_0x101388[_0x47f7('0x26')][_0x47f7('0x28')]);}logger[_0x47f7('0x26')](_0x47f7('0x22'),_0x3220cb,_0x101388[_0x47f7('0x26')][_0x47f7('0x28')]);return _0xc399df(_0x101388['error']['message']);}else{logger['info'](_0x47f7('0x22'),_0x3220cb,'request\x20sent');_0xc399df(_0x101388[_0x47f7('0x29')][_0x47f7('0x28')]);}})[_0x47f7('0x2a')](function(_0x273d80){logger[_0x47f7('0x26')](_0x47f7('0x22'),_0x3220cb,_0x273d80);_0x28d5c2(_0x273d80);});});}function respondWithStatusCode(_0x4a9b12,_0x2ef53b){_0x2ef53b=_0x2ef53b||0xcc;return function(_0x2008dd){if(_0x2008dd){return _0x4a9b12[_0x47f7('0x2b')](_0x2ef53b);}return _0x4a9b12[_0x47f7('0x2c')](_0x2ef53b)['end']();};}function respondWithResult(_0x1b1164,_0x22e1cb){_0x22e1cb=_0x22e1cb||0xc8;return function(_0x164d87){if(_0x164d87){return _0x1b1164[_0x47f7('0x2c')](_0x22e1cb)['json'](_0x164d87);}};}function respondWithFilteredResult(_0x582ee1,_0x511daf){return function(_0x4d5692){if(_0x4d5692){var _0xadbfeb=_0x4d5692[_0x47f7('0x2d')],_0x59c363=_0x511daf[_0x47f7('0x2e')],_0xa785e8=_0x511daf['offset']+_0x511daf[_0x47f7('0x2f')],_0x719b2b;if(_0xa785e8>=_0xadbfeb){_0xa785e8=_0xadbfeb;_0x719b2b=0xc8;}else{_0x719b2b=0xce;}_0x582ee1[_0x47f7('0x2c')](_0x719b2b);return _0x582ee1[_0x47f7('0x30')](_0x47f7('0x31'),_0x59c363+'-'+_0xa785e8+'/'+_0xadbfeb)[_0x47f7('0x32')](_0x4d5692);}return null;};}function patchUpdates(_0x33c73a){return function(_0x1212ef){try{jsonpatch[_0x47f7('0x33')](_0x1212ef,_0x33c73a,!![]);}catch(_0x4fa83e){return BPromise['reject'](_0x4fa83e);}return _0x1212ef[_0x47f7('0x34')]();};}function saveUpdates(_0x5b847f,_0xdffee4){return function(_0x591520){if(_0x591520){return _0x591520[_0x47f7('0x35')](_0x5b847f)[_0x47f7('0x20')](function(_0x3802a7){return _0x3802a7;});}return null;};}function removeEntity(_0x5932f,_0x564c1b){return function(_0x4dcd00){if(_0x4dcd00){return _0x4dcd00[_0x47f7('0x36')]()['then'](function(){_0x5932f[_0x47f7('0x2c')](0xcc)[_0x47f7('0x37')]();});}};}function handleEntityNotFound(_0x1dbc4a,_0x22e308){return function(_0x34e426){if(!_0x34e426){_0x1dbc4a['sendStatus'](0x194);}return _0x34e426;};}function handleError(_0x275878,_0x5c3bd9){_0x5c3bd9=_0x5c3bd9||0x1f4;return function(_0x40953f){logger[_0x47f7('0x26')](_0x40953f[_0x47f7('0x38')]);if(_0x40953f['name']){delete _0x40953f[_0x47f7('0x39')];}_0x275878[_0x47f7('0x2c')](_0x5c3bd9)[_0x47f7('0x3a')](_0x40953f);};}exports[_0x47f7('0x3b')]=function(_0x2840ad,_0x2126a3){var _0x4dfcdb={},_0x2d15d0={},_0xd2950b={'count':0x0,'rows':[]};var _0x40fff8=_['map'](db[_0x47f7('0x3c')][_0x47f7('0x3d')],function(_0x3c3a0f){return{'name':_0x3c3a0f[_0x47f7('0x3e')],'type':_0x3c3a0f['type']['key']};});_0x2d15d0[_0x47f7('0x3f')]=_[_0x47f7('0x40')](_0x40fff8,_0x47f7('0x39'));_0x2d15d0['query']=_[_0x47f7('0x41')](_0x2840ad[_0x47f7('0x42')]);_0x2d15d0[_0x47f7('0x43')]=_[_0x47f7('0x44')](_0x2d15d0[_0x47f7('0x3f')],_0x2d15d0[_0x47f7('0x42')]);_0x4dfcdb['attributes']=_[_0x47f7('0x44')](_0x2d15d0[_0x47f7('0x3f')],qs[_0x47f7('0x45')](_0x2840ad['query']['fields']));_0x4dfcdb[_0x47f7('0x46')]=_0x4dfcdb[_0x47f7('0x46')][_0x47f7('0x47')]?_0x4dfcdb[_0x47f7('0x46')]:_0x2d15d0[_0x47f7('0x3f')];if(!_0x2840ad[_0x47f7('0x42')][_0x47f7('0x48')](_0x47f7('0x49'))){_0x4dfcdb[_0x47f7('0x2f')]=qs[_0x47f7('0x2f')](_0x2840ad[_0x47f7('0x42')][_0x47f7('0x2f')]);_0x4dfcdb[_0x47f7('0x2e')]=qs[_0x47f7('0x2e')](_0x2840ad[_0x47f7('0x42')]['offset']);}_0x4dfcdb[_0x47f7('0x4a')]=qs['sort'](_0x2840ad[_0x47f7('0x42')]['sort']);_0x4dfcdb['where']=qs[_0x47f7('0x43')](_[_0x47f7('0x4b')](_0x2840ad[_0x47f7('0x42')],_0x2d15d0[_0x47f7('0x43')]),_0x40fff8);if(_0x2840ad[_0x47f7('0x42')]['filter']){_0x4dfcdb['where']=_[_0x47f7('0x4c')](_0x4dfcdb[_0x47f7('0x4d')],{'$or':_['map'](_0x40fff8,function(_0x10fcca){if(_0x10fcca['type']!==_0x47f7('0x4e')){var _0xb9c5b6={};_0xb9c5b6[_0x10fcca['name']]={'$like':'%'+_0x2840ad[_0x47f7('0x42')][_0x47f7('0x4f')]+'%'};return _0xb9c5b6;}})});}_0x4dfcdb=_['merge']({},_0x4dfcdb,_0x2840ad[_0x47f7('0x50')]);var _0x554059={'where':_0x4dfcdb[_0x47f7('0x4d')]};return db[_0x47f7('0x3c')][_0x47f7('0x2d')](_0x554059)['then'](function(_0x549bce){_0xd2950b[_0x47f7('0x2d')]=_0x549bce;if(_0x2840ad[_0x47f7('0x42')]['includeAll']){_0x4dfcdb['include']=[{'all':!![]}];}return db[_0x47f7('0x3c')][_0x47f7('0x51')](_0x4dfcdb);})[_0x47f7('0x20')](function(_0x294147){_0xd2950b['rows']=_0x294147;return _0xd2950b;})[_0x47f7('0x20')](respondWithFilteredResult(_0x2126a3,_0x4dfcdb))[_0x47f7('0x2a')](handleError(_0x2126a3,null));};exports[_0x47f7('0x52')]=function(_0x4c09ce,_0x381e6b){var _0x15a74a={'raw':!![],'where':{'id':_0x4c09ce['params']['id']}},_0x5eec77={};_0x5eec77[_0x47f7('0x3f')]=_[_0x47f7('0x41')](db[_0x47f7('0x3c')]['rawAttributes']);_0x5eec77[_0x47f7('0x42')]=_['keys'](_0x4c09ce[_0x47f7('0x42')]);_0x5eec77[_0x47f7('0x53')]=_['intersection'](_0x5eec77[_0x47f7('0x3f')],_0x5eec77[_0x47f7('0x42')]);_0x15a74a[_0x47f7('0x46')]=_['intersection'](_0x5eec77[_0x47f7('0x3f')],qs[_0x47f7('0x45')](_0x4c09ce[_0x47f7('0x42')][_0x47f7('0x45')]));_0x15a74a[_0x47f7('0x46')]=_0x15a74a[_0x47f7('0x46')][_0x47f7('0x47')]?_0x15a74a['attributes']:_0x5eec77['model'];if(_0x4c09ce[_0x47f7('0x42')][_0x47f7('0x54')]){_0x15a74a[_0x47f7('0x55')]=[{'all':!![]}];}_0x15a74a=_[_0x47f7('0x4c')]({},_0x15a74a,_0x4c09ce['options']);return db[_0x47f7('0x3c')][_0x47f7('0x56')](_0x15a74a)[_0x47f7('0x20')](handleEntityNotFound(_0x381e6b,null))[_0x47f7('0x20')](respondWithResult(_0x381e6b,null))[_0x47f7('0x2a')](handleError(_0x381e6b,null));};exports[_0x47f7('0x57')]=function(_0x55e859,_0x5da904){return db[_0x47f7('0x3c')][_0x47f7('0x57')](_0x55e859[_0x47f7('0x58')],{})[_0x47f7('0x20')](respondWithResult(_0x5da904,0xc9))[_0x47f7('0x2a')](handleError(_0x5da904,null));};exports[_0x47f7('0x35')]=function(_0x1e97fb,_0xdebc40){if(_0x1e97fb[_0x47f7('0x58')]['id']){delete _0x1e97fb[_0x47f7('0x58')]['id'];}return db[_0x47f7('0x3c')][_0x47f7('0x56')]({'where':{'id':_0x1e97fb[_0x47f7('0x59')]['id']}})[_0x47f7('0x20')](handleEntityNotFound(_0xdebc40,null))[_0x47f7('0x20')](saveUpdates(_0x1e97fb[_0x47f7('0x58')],null))[_0x47f7('0x20')](respondWithResult(_0xdebc40,null))[_0x47f7('0x2a')](handleError(_0xdebc40,null));};exports[_0x47f7('0x36')]=function(_0x5be98b,_0x58ca35){return db[_0x47f7('0x3c')][_0x47f7('0x56')]({'where':{'id':_0x5be98b[_0x47f7('0x59')]['id']}})[_0x47f7('0x20')](handleEntityNotFound(_0x58ca35,null))[_0x47f7('0x20')](removeEntity(_0x58ca35,null))['catch'](handleError(_0x58ca35,null));};exports[_0x47f7('0x5a')]=function(_0x3f5c78,_0x2dff3d){return db[_0x47f7('0x3c')][_0x47f7('0x5a')]()['then'](respondWithResult(_0x2dff3d,null))[_0x47f7('0x2a')](handleError(_0x2dff3d,null));};exports[_0x47f7('0x5b')]=function(_0x55f1c8,_0xe74253,_0x213a84){return db[_0x47f7('0x5c')][_0x47f7('0x2d')]({'where':{'ChatGroupId':_0x55f1c8[_0x47f7('0x59')]['id'],'ToId':_0x55f1c8['user']['id'],'read':![]}})[_0x47f7('0x20')](function(_0x37eacb){return{'id':_[_0x47f7('0x5d')](_0x55f1c8['params']['id']),'count':_0x37eacb};})['then'](respondWithResult(_0xe74253,null))[_0x47f7('0x2a')](handleError(_0xe74253,null));};exports[_0x47f7('0x5e')]=function(_0x552f67,_0x2faa55,_0x5d9c6d){return db[_0x47f7('0x3c')][_0x47f7('0x56')]({'where':{'id':_0x552f67[_0x47f7('0x59')]['id']}})['then'](handleEntityNotFound(_0x2faa55,null))[_0x47f7('0x20')](function(_0x560b31){if(_0x560b31){return _0x560b31[_0x47f7('0x5e')](_0x552f67[_0x47f7('0x58')][_0x47f7('0x5f')],_[_0x47f7('0x60')](_0x552f67[_0x47f7('0x58')],[_0x47f7('0x5f'),'id'])||{});}})[_0x47f7('0x20')](respondWithResult(_0x2faa55,null))[_0x47f7('0x2a')](handleError(_0x2faa55,null));};exports[_0x47f7('0x61')]=function(_0x16ac10,_0x1e4b75,_0x2c8887){var _0x10c4c1={};var _0x167ccc={};var _0x4cc73b;var _0x598018;return db['ChatGroup'][_0x47f7('0x62')]({'where':{'id':_0x16ac10[_0x47f7('0x59')]['id']}})[_0x47f7('0x20')](handleEntityNotFound(_0x1e4b75,null))[_0x47f7('0x20')](function(_0x4e7d7f){if(_0x4e7d7f){_0x4cc73b=_0x4e7d7f;_0x167ccc[_0x47f7('0x3f')]=_[_0x47f7('0x41')](db[_0x47f7('0x63')][_0x47f7('0x3d')]);_0x167ccc[_0x47f7('0x42')]=_['keys'](_0x16ac10['query']);_0x167ccc[_0x47f7('0x43')]=_[_0x47f7('0x44')](_0x167ccc['model'],_0x167ccc[_0x47f7('0x42')]);_0x10c4c1[_0x47f7('0x46')]=_['intersection'](_0x167ccc[_0x47f7('0x3f')],qs[_0x47f7('0x45')](_0x16ac10[_0x47f7('0x42')][_0x47f7('0x45')]));_0x10c4c1[_0x47f7('0x46')]=_0x10c4c1[_0x47f7('0x46')][_0x47f7('0x47')]?_0x10c4c1[_0x47f7('0x46')]:_0x167ccc[_0x47f7('0x3f')];_0x10c4c1[_0x47f7('0x4a')]=qs[_0x47f7('0x64')](_0x16ac10[_0x47f7('0x42')][_0x47f7('0x64')]);_0x10c4c1[_0x47f7('0x4d')]=qs[_0x47f7('0x43')](_[_0x47f7('0x4b')](_0x16ac10[_0x47f7('0x42')],_0x167ccc[_0x47f7('0x43')]));if(_0x16ac10[_0x47f7('0x42')][_0x47f7('0x4f')]){_0x10c4c1[_0x47f7('0x4d')]=_[_0x47f7('0x4c')](_0x10c4c1[_0x47f7('0x4d')],{'$or':_[_0x47f7('0x40')](_0x10c4c1['attributes'],function(_0x2973b8){var _0x435d86={};_0x435d86[_0x2973b8]={'$like':'%'+_0x16ac10[_0x47f7('0x42')][_0x47f7('0x4f')]+'%'};return _0x435d86;})});}_0x10c4c1=_[_0x47f7('0x4c')]({},_0x10c4c1,_0x16ac10[_0x47f7('0x50')]);return _0x4cc73b[_0x47f7('0x61')](_0x10c4c1);}})['then'](function(_0x519708){if(_0x519708){_0x598018=_0x519708['length'];if(!_0x16ac10['query'][_0x47f7('0x48')](_0x47f7('0x49'))){_0x10c4c1['limit']=qs[_0x47f7('0x2f')](_0x16ac10[_0x47f7('0x42')][_0x47f7('0x2f')]);_0x10c4c1[_0x47f7('0x2e')]=qs['offset'](_0x16ac10[_0x47f7('0x42')][_0x47f7('0x2e')]);}return _0x4cc73b[_0x47f7('0x61')](_0x10c4c1);}})[_0x47f7('0x20')](function(_0x3219d1){if(_0x3219d1){return _0x3219d1?{'count':_0x598018,'rows':_0x3219d1}:null;}})[_0x47f7('0x20')](respondWithResult(_0x1e4b75,null))[_0x47f7('0x2a')](handleError(_0x1e4b75,null));};exports[_0x47f7('0x65')]=function(_0x5d4ad0,_0x4168fe,_0x4f564d){return db[_0x47f7('0x3c')][_0x47f7('0x56')]({'where':{'id':_0x5d4ad0[_0x47f7('0x59')]['id']}})['then'](handleEntityNotFound(_0x4168fe,null))['then'](function(_0x61cf13){if(_0x61cf13){return _0x61cf13[_0x47f7('0x65')](_0x5d4ad0[_0x47f7('0x42')]['ids']);}})['then'](respondWithStatusCode(_0x4168fe,null))[_0x47f7('0x2a')](handleError(_0x4168fe,null));};exports[_0x47f7('0x66')]=function(_0x4c10fd,_0x4435a6,_0x15dcd4){if(_0x4c10fd[_0x47f7('0x58')]['id']){delete _0x4c10fd['body']['id'];}return db[_0x47f7('0x3c')][_0x47f7('0x56')]({'where':{'id':_0x4c10fd[_0x47f7('0x59')]['id']}})['then'](handleEntityNotFound(_0x4435a6,null))['then'](function(_0x338b1c){if(_0x338b1c){_0x4c10fd[_0x47f7('0x58')]['ChatGroupId']=_0x338b1c['id'];return db[_0x47f7('0x5c')][_0x47f7('0x57')](_0x4c10fd[_0x47f7('0x58')]);}})[_0x47f7('0x20')](respondWithResult(_0x4435a6,null))[_0x47f7('0x2a')](handleError(_0x4435a6,null));};exports['getMessages']=function(_0x1776fe,_0x4a0934,_0x1f9fb6){var _0xc8659={};var _0x4816c2={};var _0x2af04e;var _0x542bf2;return db[_0x47f7('0x3c')][_0x47f7('0x62')]({'where':{'id':_0x1776fe[_0x47f7('0x59')]['id']}})[_0x47f7('0x20')](handleEntityNotFound(_0x4a0934,null))[_0x47f7('0x20')](function(_0x1a6f26){if(_0x1a6f26){_0x2af04e=_0x1a6f26;_0x4816c2['model']=_['keys'](db[_0x47f7('0x5c')][_0x47f7('0x3d')]);_0x4816c2[_0x47f7('0x42')]=_[_0x47f7('0x41')](_0x1776fe[_0x47f7('0x42')]);_0x4816c2[_0x47f7('0x43')]=_['intersection'](_0x4816c2[_0x47f7('0x3f')],_0x4816c2['query']);_0xc8659['attributes']=_[_0x47f7('0x44')](_0x4816c2[_0x47f7('0x3f')],qs['fields'](_0x1776fe[_0x47f7('0x42')][_0x47f7('0x45')]));_0xc8659[_0x47f7('0x46')]=_0xc8659[_0x47f7('0x46')]['length']?_0xc8659[_0x47f7('0x46')]:_0x4816c2['model'];_0xc8659[_0x47f7('0x4a')]=qs[_0x47f7('0x64')](_0x1776fe['query'][_0x47f7('0x64')]);_0xc8659[_0x47f7('0x4d')]=qs[_0x47f7('0x43')](_[_0x47f7('0x4b')](_0x1776fe[_0x47f7('0x42')],_0x4816c2['filters']));if(_0x1776fe[_0x47f7('0x42')][_0x47f7('0x4f')]){_0xc8659['where']=_[_0x47f7('0x4c')](_0xc8659['where'],{'$or':_['map'](_0xc8659[_0x47f7('0x46')],function(_0x382060){var _0x8319a4={};_0x8319a4[_0x382060]={'$like':'%'+_0x1776fe[_0x47f7('0x42')]['filter']+'%'};return _0x8319a4;})});}if(_0x1776fe['query']['$gte']){var _0x2de11f=_0x1776fe[_0x47f7('0x42')]['$gte'][_0x47f7('0x67')](',');var _0x24f302={};_0x24f302[_0x2de11f[0x0]]={'$gte':moment(_0x2de11f[0x1])[_0x47f7('0x68')](_0x47f7('0x69'))};_0xc8659[_0x47f7('0x4d')]=_['merge'](_0xc8659[_0x47f7('0x4d')],_0x24f302);}_0xc8659=_[_0x47f7('0x4c')]({},_0xc8659,_0x1776fe[_0x47f7('0x50')]);return _0x2af04e['getMessages'](_0xc8659);}})[_0x47f7('0x20')](function(_0x2c72b7){if(_0x2c72b7){_0x542bf2=_0x2c72b7[_0x47f7('0x47')];if(!_0x1776fe[_0x47f7('0x42')][_0x47f7('0x48')](_0x47f7('0x49'))){_0xc8659[_0x47f7('0x2f')]=qs[_0x47f7('0x2f')](_0x1776fe[_0x47f7('0x42')]['limit']);_0xc8659[_0x47f7('0x2e')]=qs[_0x47f7('0x2e')](_0x1776fe[_0x47f7('0x42')][_0x47f7('0x2e')]);}return _0x2af04e[_0x47f7('0x6a')](_0xc8659);}})['then'](function(_0x452829){if(_0x452829){return _0x452829?{'count':_0x542bf2,'rows':_0x452829}:null;}})[_0x47f7('0x20')](respondWithResult(_0x4a0934,null))[_0x47f7('0x2a')](handleError(_0x4a0934,null));}; \ No newline at end of file +var _0x0ca7=['defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','name','send','index','map','ChatGroup','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','merge','where','VIRTUAL','filter','options','include','findAll','rows','show','params','filtears','includeAll','find','catch','create','body','describe','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','findOne','User','rawAttributes','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x348547,_0x32a2fb){var _0xceed34=function(_0x283d89){while(--_0x283d89){_0x348547['push'](_0x348547['shift']());}};_0xceed34(++_0x32a2fb);}(_0x0ca7,0x129));var _0x70ca=function(_0x2baca1,_0x2f3557){_0x2baca1=_0x2baca1-0x0;var _0x9aa62a=_0x0ca7[_0x2baca1];return _0x9aa62a;};'use strict';var pdf=require(_0x70ca('0x0'));var emlformat=require(_0x70ca('0x1'));var rimraf=require(_0x70ca('0x2'));var zipdir=require(_0x70ca('0x3'));var jsonpatch=require(_0x70ca('0x4'));var rp=require(_0x70ca('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x70ca('0x6'));var util=require('util');var path=require(_0x70ca('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x70ca('0x8'));var fs=require('fs');var _=require(_0x70ca('0x9'));var squel=require(_0x70ca('0xa'));var crypto=require('crypto');var jsforce=require(_0x70ca('0xb'));var deskjs=require(_0x70ca('0xc'));var toCsv=require(_0x70ca('0xd'));var querystring=require('querystring');var Papa=require(_0x70ca('0xe'));var Redis=require(_0x70ca('0xf'));var authService=require(_0x70ca('0x10'));var qs=require(_0x70ca('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x70ca('0x12'));var logger=require(_0x70ca('0x13'))(_0x70ca('0x14'));var utils=require('../../config/utils');var config=require(_0x70ca('0x15'));var licenseUtil=require(_0x70ca('0x16'));var db=require(_0x70ca('0x17'))['db'];config['redis']=_[_0x70ca('0x18')](config[_0x70ca('0x19')],{'host':_0x70ca('0x1a'),'port':0x18eb});var socket=require(_0x70ca('0x1b'))(new Redis(config[_0x70ca('0x19')]));require('./chatGroup.socket')[_0x70ca('0x1c')](socket);var jayson=require(_0x70ca('0x1d'));var client=jayson[_0x70ca('0x1e')][_0x70ca('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x77875c,_0x3b70d0,_0x5d7388,_0x2d1155){return new BPromise(function(_0x6d7d9e,_0x2b2534){var _0xb8dc4f=_0x2d1155||client;return _0xb8dc4f['request'](_0x77875c,_0x5d7388)[_0x70ca('0x20')](function(_0x4696be){logger[_0x70ca('0x21')](_0x70ca('0x22'),_0x3b70d0,_0x70ca('0x23'));logger['debug'](_0x70ca('0x24'),_0x3b70d0,_0x70ca('0x23'),JSON['stringify'](_0x4696be));if(_0x4696be['error']){if(_0x4696be[_0x70ca('0x25')]['code']===0x1f4){logger[_0x70ca('0x25')](_0x70ca('0x22'),_0x3b70d0,_0x4696be[_0x70ca('0x25')][_0x70ca('0x26')]);return _0x2b2534(_0x4696be[_0x70ca('0x25')]['message']);}logger[_0x70ca('0x25')](_0x70ca('0x22'),_0x3b70d0,_0x4696be[_0x70ca('0x25')][_0x70ca('0x26')]);return _0x6d7d9e(_0x4696be[_0x70ca('0x25')][_0x70ca('0x26')]);}else{logger[_0x70ca('0x21')](_0x70ca('0x22'),_0x3b70d0,_0x70ca('0x23'));_0x6d7d9e(_0x4696be[_0x70ca('0x27')][_0x70ca('0x26')]);}})['catch'](function(_0x594bf6){logger[_0x70ca('0x25')](_0x70ca('0x22'),_0x3b70d0,_0x594bf6);_0x2b2534(_0x594bf6);});});}function respondWithStatusCode(_0x2603b5,_0x1eaf01){_0x1eaf01=_0x1eaf01||0xcc;return function(_0x48f1cd){if(_0x48f1cd){return _0x2603b5[_0x70ca('0x28')](_0x1eaf01);}return _0x2603b5[_0x70ca('0x29')](_0x1eaf01)[_0x70ca('0x2a')]();};}function respondWithResult(_0x3545ed,_0x113c73){_0x113c73=_0x113c73||0xc8;return function(_0x30ceda){if(_0x30ceda){return _0x3545ed[_0x70ca('0x29')](_0x113c73)['json'](_0x30ceda);}};}function respondWithFilteredResult(_0x5d090,_0x549436){return function(_0x32a5a2){if(_0x32a5a2){var _0x52dc77=_0x32a5a2[_0x70ca('0x2b')],_0xe81215=_0x549436[_0x70ca('0x2c')],_0x164d56=_0x549436[_0x70ca('0x2c')]+_0x549436[_0x70ca('0x2d')],_0x2e13d9;if(_0x164d56>=_0x52dc77){_0x164d56=_0x52dc77;_0x2e13d9=0xc8;}else{_0x2e13d9=0xce;}_0x5d090[_0x70ca('0x29')](_0x2e13d9);return _0x5d090[_0x70ca('0x2e')](_0x70ca('0x2f'),_0xe81215+'-'+_0x164d56+'/'+_0x52dc77)[_0x70ca('0x30')](_0x32a5a2);}return null;};}function patchUpdates(_0x2a4880){return function(_0x337502){try{jsonpatch[_0x70ca('0x31')](_0x337502,_0x2a4880,!![]);}catch(_0x4290e8){return BPromise[_0x70ca('0x32')](_0x4290e8);}return _0x337502[_0x70ca('0x33')]();};}function saveUpdates(_0x23b96e,_0x66fb06){return function(_0x474733){if(_0x474733){return _0x474733[_0x70ca('0x34')](_0x23b96e)['then'](function(_0x34f00b){return _0x34f00b;});}return null;};}function removeEntity(_0x3c4f9c,_0x57474c){return function(_0x39da0e){if(_0x39da0e){return _0x39da0e[_0x70ca('0x35')]()[_0x70ca('0x20')](function(){_0x3c4f9c[_0x70ca('0x29')](0xcc)[_0x70ca('0x2a')]();});}};}function handleEntityNotFound(_0x2ba3f6,_0xeeec70){return function(_0x16f41a){if(!_0x16f41a){_0x2ba3f6['sendStatus'](0x194);}return _0x16f41a;};}function handleError(_0x26a9bd,_0x10537c){_0x10537c=_0x10537c||0x1f4;return function(_0x5ea46d){logger[_0x70ca('0x25')](_0x5ea46d['stack']);if(_0x5ea46d[_0x70ca('0x36')]){delete _0x5ea46d[_0x70ca('0x36')];}_0x26a9bd['status'](_0x10537c)[_0x70ca('0x37')](_0x5ea46d);};}exports[_0x70ca('0x38')]=function(_0x3b16e2,_0x149887){var _0x2d9e65={},_0x5827fb={},_0x1253cf={'count':0x0,'rows':[]};var _0x2d0f9f=_[_0x70ca('0x39')](db[_0x70ca('0x3a')]['rawAttributes'],function(_0x43ecfa){return{'name':_0x43ecfa['fieldName'],'type':_0x43ecfa[_0x70ca('0x3b')]['key']};});_0x5827fb[_0x70ca('0x3c')]=_[_0x70ca('0x39')](_0x2d0f9f,'name');_0x5827fb[_0x70ca('0x3d')]=_[_0x70ca('0x3e')](_0x3b16e2['query']);_0x5827fb[_0x70ca('0x3f')]=_[_0x70ca('0x40')](_0x5827fb['model'],_0x5827fb[_0x70ca('0x3d')]);_0x2d9e65[_0x70ca('0x41')]=_[_0x70ca('0x40')](_0x5827fb[_0x70ca('0x3c')],qs[_0x70ca('0x42')](_0x3b16e2[_0x70ca('0x3d')][_0x70ca('0x42')]));_0x2d9e65['attributes']=_0x2d9e65[_0x70ca('0x41')][_0x70ca('0x43')]?_0x2d9e65['attributes']:_0x5827fb[_0x70ca('0x3c')];if(!_0x3b16e2[_0x70ca('0x3d')]['hasOwnProperty']('nolimit')){_0x2d9e65[_0x70ca('0x2d')]=qs[_0x70ca('0x2d')](_0x3b16e2[_0x70ca('0x3d')][_0x70ca('0x2d')]);_0x2d9e65['offset']=qs['offset'](_0x3b16e2['query'][_0x70ca('0x2c')]);}_0x2d9e65[_0x70ca('0x44')]=qs[_0x70ca('0x45')](_0x3b16e2['query']['sort']);_0x2d9e65['where']=qs['filters'](_[_0x70ca('0x46')](_0x3b16e2[_0x70ca('0x3d')],_0x5827fb[_0x70ca('0x3f')]),_0x2d0f9f);if(_0x3b16e2['query']['filter']){_0x2d9e65['where']=_[_0x70ca('0x47')](_0x2d9e65[_0x70ca('0x48')],{'$or':_['map'](_0x2d0f9f,function(_0xa4ca4f){if(_0xa4ca4f[_0x70ca('0x3b')]!==_0x70ca('0x49')){var _0x492ade={};_0x492ade[_0xa4ca4f[_0x70ca('0x36')]]={'$like':'%'+_0x3b16e2[_0x70ca('0x3d')][_0x70ca('0x4a')]+'%'};return _0x492ade;}})});}_0x2d9e65=_[_0x70ca('0x47')]({},_0x2d9e65,_0x3b16e2[_0x70ca('0x4b')]);var _0x4e3399={'where':_0x2d9e65['where']};return db[_0x70ca('0x3a')][_0x70ca('0x2b')](_0x4e3399)[_0x70ca('0x20')](function(_0x1ef948){_0x1253cf[_0x70ca('0x2b')]=_0x1ef948;if(_0x3b16e2['query']['includeAll']){_0x2d9e65[_0x70ca('0x4c')]=[{'all':!![]}];}return db[_0x70ca('0x3a')][_0x70ca('0x4d')](_0x2d9e65);})[_0x70ca('0x20')](function(_0xdd7f48){_0x1253cf[_0x70ca('0x4e')]=_0xdd7f48;return _0x1253cf;})['then'](respondWithFilteredResult(_0x149887,_0x2d9e65))['catch'](handleError(_0x149887,null));};exports[_0x70ca('0x4f')]=function(_0x15c2b7,_0xbf475c){var _0x316951={'raw':!![],'where':{'id':_0x15c2b7[_0x70ca('0x50')]['id']}},_0x115893={};_0x115893[_0x70ca('0x3c')]=_[_0x70ca('0x3e')](db[_0x70ca('0x3a')]['rawAttributes']);_0x115893['query']=_[_0x70ca('0x3e')](_0x15c2b7[_0x70ca('0x3d')]);_0x115893[_0x70ca('0x51')]=_[_0x70ca('0x40')](_0x115893[_0x70ca('0x3c')],_0x115893[_0x70ca('0x3d')]);_0x316951[_0x70ca('0x41')]=_[_0x70ca('0x40')](_0x115893[_0x70ca('0x3c')],qs[_0x70ca('0x42')](_0x15c2b7['query']['fields']));_0x316951['attributes']=_0x316951[_0x70ca('0x41')]['length']?_0x316951[_0x70ca('0x41')]:_0x115893[_0x70ca('0x3c')];if(_0x15c2b7[_0x70ca('0x3d')][_0x70ca('0x52')]){_0x316951['include']=[{'all':!![]}];}_0x316951=_[_0x70ca('0x47')]({},_0x316951,_0x15c2b7[_0x70ca('0x4b')]);return db[_0x70ca('0x3a')][_0x70ca('0x53')](_0x316951)[_0x70ca('0x20')](handleEntityNotFound(_0xbf475c,null))[_0x70ca('0x20')](respondWithResult(_0xbf475c,null))[_0x70ca('0x54')](handleError(_0xbf475c,null));};exports['create']=function(_0x34ba5e,_0x5d408c){return db[_0x70ca('0x3a')][_0x70ca('0x55')](_0x34ba5e[_0x70ca('0x56')],{})['then'](respondWithResult(_0x5d408c,0xc9))[_0x70ca('0x54')](handleError(_0x5d408c,null));};exports[_0x70ca('0x34')]=function(_0x52f655,_0x4b3239){if(_0x52f655[_0x70ca('0x56')]['id']){delete _0x52f655[_0x70ca('0x56')]['id'];}return db[_0x70ca('0x3a')][_0x70ca('0x53')]({'where':{'id':_0x52f655[_0x70ca('0x50')]['id']}})[_0x70ca('0x20')](handleEntityNotFound(_0x4b3239,null))['then'](saveUpdates(_0x52f655['body'],null))[_0x70ca('0x20')](respondWithResult(_0x4b3239,null))[_0x70ca('0x54')](handleError(_0x4b3239,null));};exports[_0x70ca('0x35')]=function(_0x5d9746,_0x2b886f){return db[_0x70ca('0x3a')][_0x70ca('0x53')]({'where':{'id':_0x5d9746[_0x70ca('0x50')]['id']}})[_0x70ca('0x20')](handleEntityNotFound(_0x2b886f,null))[_0x70ca('0x20')](removeEntity(_0x2b886f,null))[_0x70ca('0x54')](handleError(_0x2b886f,null));};exports[_0x70ca('0x57')]=function(_0xd99597,_0x30206){return db[_0x70ca('0x3a')][_0x70ca('0x57')]()[_0x70ca('0x20')](respondWithResult(_0x30206,null))[_0x70ca('0x54')](handleError(_0x30206,null));};exports['getUnread']=function(_0x522af8,_0x1faea9,_0x37f021){return db[_0x70ca('0x58')][_0x70ca('0x2b')]({'where':{'ChatGroupId':_0x522af8[_0x70ca('0x50')]['id'],'ToId':_0x522af8[_0x70ca('0x59')]['id'],'read':![]}})[_0x70ca('0x20')](function(_0x638de6){return{'id':_[_0x70ca('0x5a')](_0x522af8[_0x70ca('0x50')]['id']),'count':_0x638de6};})['then'](respondWithResult(_0x1faea9,null))['catch'](handleError(_0x1faea9,null));};exports['addMembers']=function(_0x363353,_0x58a2b2,_0x30e555){return db[_0x70ca('0x3a')][_0x70ca('0x53')]({'where':{'id':_0x363353[_0x70ca('0x50')]['id']}})[_0x70ca('0x20')](handleEntityNotFound(_0x58a2b2,null))[_0x70ca('0x20')](function(_0x5a8c9c){if(_0x5a8c9c){return _0x5a8c9c[_0x70ca('0x5b')](_0x363353[_0x70ca('0x56')][_0x70ca('0x5c')],_['omit'](_0x363353['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x58a2b2,null))[_0x70ca('0x54')](handleError(_0x58a2b2,null));};exports[_0x70ca('0x5d')]=function(_0x3b88b1,_0x4d7a71,_0x17d8ea){var _0x5521d0={};var _0x343c08={};var _0x5a8907;var _0x1feef0;return db[_0x70ca('0x3a')][_0x70ca('0x5e')]({'where':{'id':_0x3b88b1['params']['id']}})['then'](handleEntityNotFound(_0x4d7a71,null))[_0x70ca('0x20')](function(_0x30637c){if(_0x30637c){_0x5a8907=_0x30637c;_0x343c08[_0x70ca('0x3c')]=_['keys'](db[_0x70ca('0x5f')][_0x70ca('0x60')]);_0x343c08[_0x70ca('0x3d')]=_[_0x70ca('0x3e')](_0x3b88b1[_0x70ca('0x3d')]);_0x343c08[_0x70ca('0x3f')]=_[_0x70ca('0x40')](_0x343c08[_0x70ca('0x3c')],_0x343c08['query']);_0x5521d0[_0x70ca('0x41')]=_[_0x70ca('0x40')](_0x343c08[_0x70ca('0x3c')],qs[_0x70ca('0x42')](_0x3b88b1[_0x70ca('0x3d')][_0x70ca('0x42')]));_0x5521d0[_0x70ca('0x41')]=_0x5521d0[_0x70ca('0x41')][_0x70ca('0x43')]?_0x5521d0['attributes']:_0x343c08[_0x70ca('0x3c')];_0x5521d0[_0x70ca('0x44')]=qs['sort'](_0x3b88b1[_0x70ca('0x3d')][_0x70ca('0x45')]);_0x5521d0[_0x70ca('0x48')]=qs[_0x70ca('0x3f')](_['pick'](_0x3b88b1[_0x70ca('0x3d')],_0x343c08[_0x70ca('0x3f')]));if(_0x3b88b1[_0x70ca('0x3d')][_0x70ca('0x4a')]){_0x5521d0[_0x70ca('0x48')]=_[_0x70ca('0x47')](_0x5521d0['where'],{'$or':_[_0x70ca('0x39')](_0x5521d0[_0x70ca('0x41')],function(_0x5adbc4){var _0x397b52={};_0x397b52[_0x5adbc4]={'$like':'%'+_0x3b88b1['query'][_0x70ca('0x4a')]+'%'};return _0x397b52;})});}_0x5521d0=_[_0x70ca('0x47')]({},_0x5521d0,_0x3b88b1['options']);return _0x5a8907[_0x70ca('0x5d')](_0x5521d0);}})['then'](function(_0x4b0b9a){if(_0x4b0b9a){_0x1feef0=_0x4b0b9a['length'];if(!_0x3b88b1[_0x70ca('0x3d')]['hasOwnProperty'](_0x70ca('0x61'))){_0x5521d0[_0x70ca('0x2d')]=qs['limit'](_0x3b88b1[_0x70ca('0x3d')]['limit']);_0x5521d0[_0x70ca('0x2c')]=qs[_0x70ca('0x2c')](_0x3b88b1[_0x70ca('0x3d')]['offset']);}return _0x5a8907[_0x70ca('0x5d')](_0x5521d0);}})[_0x70ca('0x20')](function(_0x54468b){if(_0x54468b){return _0x54468b?{'count':_0x1feef0,'rows':_0x54468b}:null;}})[_0x70ca('0x20')](respondWithResult(_0x4d7a71,null))[_0x70ca('0x54')](handleError(_0x4d7a71,null));};exports[_0x70ca('0x62')]=function(_0x17ced9,_0x1b717f,_0x40ed0a){return db[_0x70ca('0x3a')][_0x70ca('0x53')]({'where':{'id':_0x17ced9['params']['id']}})['then'](handleEntityNotFound(_0x1b717f,null))['then'](function(_0x41c14e){if(_0x41c14e){return _0x41c14e[_0x70ca('0x62')](_0x17ced9[_0x70ca('0x3d')]['ids']);}})[_0x70ca('0x20')](respondWithStatusCode(_0x1b717f,null))[_0x70ca('0x54')](handleError(_0x1b717f,null));};exports[_0x70ca('0x63')]=function(_0x3bb0a4,_0x4aa7fb,_0x1a84a3){if(_0x3bb0a4[_0x70ca('0x56')]['id']){delete _0x3bb0a4[_0x70ca('0x56')]['id'];}return db[_0x70ca('0x3a')][_0x70ca('0x53')]({'where':{'id':_0x3bb0a4['params']['id']}})['then'](handleEntityNotFound(_0x4aa7fb,null))['then'](function(_0x268fdd){if(_0x268fdd){_0x3bb0a4[_0x70ca('0x56')][_0x70ca('0x64')]=_0x268fdd['id'];return db[_0x70ca('0x58')][_0x70ca('0x55')](_0x3bb0a4[_0x70ca('0x56')]);}})[_0x70ca('0x20')](respondWithResult(_0x4aa7fb,null))[_0x70ca('0x54')](handleError(_0x4aa7fb,null));};exports[_0x70ca('0x65')]=function(_0x578bfb,_0x12d1f0,_0x4fae3b){var _0x3e6d68={};var _0x350fc3={};var _0x30288c;var _0x4a94db;return db[_0x70ca('0x3a')][_0x70ca('0x5e')]({'where':{'id':_0x578bfb['params']['id']}})['then'](handleEntityNotFound(_0x12d1f0,null))[_0x70ca('0x20')](function(_0xe1379a){if(_0xe1379a){_0x30288c=_0xe1379a;_0x350fc3[_0x70ca('0x3c')]=_[_0x70ca('0x3e')](db[_0x70ca('0x58')][_0x70ca('0x60')]);_0x350fc3[_0x70ca('0x3d')]=_[_0x70ca('0x3e')](_0x578bfb[_0x70ca('0x3d')]);_0x350fc3[_0x70ca('0x3f')]=_[_0x70ca('0x40')](_0x350fc3[_0x70ca('0x3c')],_0x350fc3[_0x70ca('0x3d')]);_0x3e6d68[_0x70ca('0x41')]=_['intersection'](_0x350fc3[_0x70ca('0x3c')],qs[_0x70ca('0x42')](_0x578bfb[_0x70ca('0x3d')][_0x70ca('0x42')]));_0x3e6d68[_0x70ca('0x41')]=_0x3e6d68[_0x70ca('0x41')][_0x70ca('0x43')]?_0x3e6d68['attributes']:_0x350fc3['model'];_0x3e6d68['order']=qs[_0x70ca('0x45')](_0x578bfb[_0x70ca('0x3d')][_0x70ca('0x45')]);_0x3e6d68[_0x70ca('0x48')]=qs[_0x70ca('0x3f')](_['pick'](_0x578bfb[_0x70ca('0x3d')],_0x350fc3[_0x70ca('0x3f')]));if(_0x578bfb['query'][_0x70ca('0x4a')]){_0x3e6d68[_0x70ca('0x48')]=_[_0x70ca('0x47')](_0x3e6d68[_0x70ca('0x48')],{'$or':_[_0x70ca('0x39')](_0x3e6d68[_0x70ca('0x41')],function(_0x161539){var _0x131e1f={};_0x131e1f[_0x161539]={'$like':'%'+_0x578bfb[_0x70ca('0x3d')][_0x70ca('0x4a')]+'%'};return _0x131e1f;})});}if(_0x578bfb[_0x70ca('0x3d')][_0x70ca('0x66')]){var _0x26c520=_0x578bfb['query'][_0x70ca('0x66')][_0x70ca('0x67')](',');var _0x4100f2={};_0x4100f2[_0x26c520[0x0]]={'$gte':moment(_0x26c520[0x1])[_0x70ca('0x68')](_0x70ca('0x69'))};_0x3e6d68['where']=_[_0x70ca('0x47')](_0x3e6d68[_0x70ca('0x48')],_0x4100f2);}_0x3e6d68=_['merge']({},_0x3e6d68,_0x578bfb[_0x70ca('0x4b')]);return _0x30288c[_0x70ca('0x65')](_0x3e6d68);}})[_0x70ca('0x20')](function(_0xec5987){if(_0xec5987){_0x4a94db=_0xec5987[_0x70ca('0x43')];if(!_0x578bfb[_0x70ca('0x3d')][_0x70ca('0x6a')](_0x70ca('0x61'))){_0x3e6d68[_0x70ca('0x2d')]=qs[_0x70ca('0x2d')](_0x578bfb[_0x70ca('0x3d')][_0x70ca('0x2d')]);_0x3e6d68[_0x70ca('0x2c')]=qs[_0x70ca('0x2c')](_0x578bfb[_0x70ca('0x3d')][_0x70ca('0x2c')]);}return _0x30288c[_0x70ca('0x65')](_0x3e6d68);}})[_0x70ca('0x20')](function(_0x413ffd){if(_0x413ffd){return _0x413ffd?{'count':_0x4a94db,'rows':_0x413ffd}:null;}})[_0x70ca('0x20')](respondWithResult(_0x12d1f0,null))[_0x70ca('0x54')](handleError(_0x12d1f0,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 0ddc5b6..61dece8 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 _0xdb28=['ChatGroup','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x5ef73f,_0x52a74a){var _0x567b5c=function(_0x1e8cbe){while(--_0x1e8cbe){_0x5ef73f['push'](_0x5ef73f['shift']());}};_0x567b5c(++_0x52a74a);}(_0xdb28,0x106));var _0x8db2=function(_0xef1167,_0x577766){_0xef1167=_0xef1167-0x0;var _0x410a94=_0xdb28[_0xef1167];return _0x410a94;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var ChatGroup=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x2032=['exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x2032,0xd9));var _0x2203=function(_0x59e494,_0x40d52c){_0x59e494=_0x59e494-0x0;var _0x2721ad=_0x2032[_0x59e494];return _0x2721ad;};'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 3f3b607..8e6ad58 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 _0x79d3=['ChatGroup','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatGroup.attributes','exports'];(function(_0xac2e6d,_0x2efe32){var _0x5ce4ce=function(_0x6ab930){while(--_0x6ab930){_0xac2e6d['push'](_0xac2e6d['shift']());}};_0x5ce4ce(++_0x2efe32);}(_0x79d3,0x15f));var _0x379d=function(_0x479fca,_0x5466c5){_0x479fca=_0x479fca-0x0;var _0x5f0526=_0x79d3[_0x479fca];return _0x5f0526;};'use strict';var _=require(_0x379d('0x0'));var util=require('util');var logger=require(_0x379d('0x1'))('api');var moment=require(_0x379d('0x2'));var BPromise=require(_0x379d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x379d('0x4'));var rimraf=require(_0x379d('0x5'));var config=require(_0x379d('0x6'));var attributes=require(_0x379d('0x7'));module[_0x379d('0x8')]=function(_0x2078a6,_0x2a1b43){return _0x2078a6['define'](_0x379d('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bd8=['./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x17ede9,_0x27d731){var _0x35b71d=function(_0x30f681){while(--_0x30f681){_0x17ede9['push'](_0x17ede9['shift']());}};_0x35b71d(++_0x27d731);}(_0x2bd8,0x130));var _0x82bd=function(_0x3f6ae0,_0x30fd89){_0x3f6ae0=_0x3f6ae0-0x0;var _0x2dd445=_0x2bd8[_0x3f6ae0];return _0x2dd445;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var moment=require(_0x82bd('0x3'));var BPromise=require(_0x82bd('0x4'));var rp=require(_0x82bd('0x5'));var fs=require('fs');var path=require(_0x82bd('0x6'));var rimraf=require(_0x82bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bd('0x8'));module[_0x82bd('0x9')]=function(_0x3bf810,_0x5ceb60){return _0x3bf810[_0x82bd('0xa')](_0x82bd('0xb'),attributes,{'tableName':_0x82bd('0xc'),'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 eca4161..d126de4 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 _0x95bf=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x38f532,_0x5317ed){var _0x12be51=function(_0x180896){while(--_0x180896){_0x38f532['push'](_0x38f532['shift']());}};_0x12be51(++_0x5317ed);}(_0x95bf,0xf4));var _0xf95b=function(_0x53d220,_0x7da0ac){_0x53d220=_0x53d220-0x0;var _0x5de661=_0x95bf[_0x53d220];return _0x5de661;};'use strict';var _=require('lodash');var util=require(_0xf95b('0x0'));var moment=require(_0xf95b('0x1'));var BPromise=require(_0xf95b('0x2'));var rs=require(_0xf95b('0x3'));var fs=require('fs');var Redis=require(_0xf95b('0x4'));var db=require(_0xf95b('0x5'))['db'];var utils=require(_0xf95b('0x6'));var logger=require(_0xf95b('0x7'))(_0xf95b('0x8'));var config=require(_0xf95b('0x9'));var jayson=require(_0xf95b('0xa'));var client=jayson['client'][_0xf95b('0xb')]({'port':0x232a});config[_0xf95b('0xc')]=_[_0xf95b('0xd')](config[_0xf95b('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf95b('0xc')]));require('./chatGroup.socket')[_0xf95b('0xe')](socket);function respondWithRpcPromise(_0xbd7163,_0x29d8d8,_0x2048ac){return new BPromise(function(_0x1ad23d,_0x17a320){return client[_0xf95b('0xf')](_0xbd7163,_0x2048ac)[_0xf95b('0x10')](function(_0x37edc4){logger['info'](_0xf95b('0x11'),_0x29d8d8,_0xf95b('0x12'));logger[_0xf95b('0x13')](_0xf95b('0x14'),_0x29d8d8,_0xf95b('0x12'),JSON[_0xf95b('0x15')](_0x37edc4));if(_0x37edc4[_0xf95b('0x16')]){if(_0x37edc4[_0xf95b('0x16')][_0xf95b('0x17')]===0x1f4){logger[_0xf95b('0x16')](_0xf95b('0x11'),_0x29d8d8,_0x37edc4[_0xf95b('0x16')][_0xf95b('0x18')]);return _0x17a320(_0x37edc4[_0xf95b('0x16')][_0xf95b('0x18')]);}logger[_0xf95b('0x16')](_0xf95b('0x11'),_0x29d8d8,_0x37edc4[_0xf95b('0x16')][_0xf95b('0x18')]);return _0x1ad23d(_0x37edc4['error']['message']);}else{logger['info'](_0xf95b('0x11'),_0x29d8d8,_0xf95b('0x12'));_0x1ad23d(_0x37edc4[_0xf95b('0x19')][_0xf95b('0x18')]);}})[_0xf95b('0x1a')](function(_0x19a298){logger[_0xf95b('0x16')](_0xf95b('0x11'),_0x29d8d8,_0x19a298);_0x17a320(_0x19a298);});});} \ No newline at end of file +var _0xcb70=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x80eb99,_0xf5b711){var _0x398203=function(_0x1adc3e){while(--_0x1adc3e){_0x80eb99['push'](_0x80eb99['shift']());}};_0x398203(++_0xf5b711);}(_0xcb70,0xf3));var _0x0cb7=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xcb70[_0x22b68a];return _0x1ac67a;};'use strict';var _=require(_0x0cb7('0x0'));var util=require(_0x0cb7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cb7('0x2'))['db'];var utils=require(_0x0cb7('0x3'));var logger=require(_0x0cb7('0x4'))(_0x0cb7('0x5'));var config=require(_0x0cb7('0x6'));var jayson=require(_0x0cb7('0x7'));var client=jayson[_0x0cb7('0x8')]['http']({'port':0x232a});config[_0x0cb7('0x9')]=_[_0x0cb7('0xa')](config[_0x0cb7('0x9')],{'host':_0x0cb7('0xb'),'port':0x18eb});var socket=require(_0x0cb7('0xc'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x0cb7('0xd')](socket);function respondWithRpcPromise(_0x475357,_0x307f2c,_0x10a745){return new BPromise(function(_0x559595,_0xdc1d5c){return client[_0x0cb7('0xe')](_0x475357,_0x10a745)[_0x0cb7('0xf')](function(_0x4f7530){logger[_0x0cb7('0x10')](_0x0cb7('0x11'),_0x307f2c,'request\x20sent');logger[_0x0cb7('0x12')](_0x0cb7('0x13'),_0x307f2c,_0x0cb7('0x14'),JSON[_0x0cb7('0x15')](_0x4f7530));if(_0x4f7530[_0x0cb7('0x16')]){if(_0x4f7530[_0x0cb7('0x16')]['code']===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x307f2c,_0x4f7530[_0x0cb7('0x16')]['message']);return _0xdc1d5c(_0x4f7530['error'][_0x0cb7('0x17')]);}logger[_0x0cb7('0x16')](_0x0cb7('0x11'),_0x307f2c,_0x4f7530['error'][_0x0cb7('0x17')]);return _0x559595(_0x4f7530[_0x0cb7('0x16')][_0x0cb7('0x17')]);}else{logger[_0x0cb7('0x10')](_0x0cb7('0x11'),_0x307f2c,_0x0cb7('0x14'));_0x559595(_0x4f7530[_0x0cb7('0x18')][_0x0cb7('0x17')]);}})['catch'](function(_0x2a8650){logger[_0x0cb7('0x16')](_0x0cb7('0x11'),_0x307f2c,_0x2a8650);_0xdc1d5c(_0x2a8650);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 097dda1..611d2c2 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 _0x9e6c=['removeListener','register','length','./chatGroup.events','emit'];(function(_0x15b8a0,_0x170f7f){var _0x59895f=function(_0x68cf71){while(--_0x68cf71){_0x15b8a0['push'](_0x15b8a0['shift']());}};_0x59895f(++_0x170f7f);}(_0x9e6c,0x170));var _0xc9e6=function(_0x36f243,_0x4fddd0){_0x36f243=_0x36f243-0x0;var _0x3ae118=_0x9e6c[_0x36f243];return _0x3ae118;};'use strict';var ChatGroupEvents=require(_0xc9e6('0x0'));var events=['save','remove','update'];function createListener(_0x5b2e21,_0x3fdc31){return function(_0x43ecd7){_0x3fdc31[_0xc9e6('0x1')](_0x5b2e21,_0x43ecd7);};}function removeListener(_0x145b7c,_0x1f5f8c){return function(){ChatGroupEvents[_0xc9e6('0x2')](_0x145b7c,_0x1f5f8c);};}exports[_0xc9e6('0x3')]=function(_0x2a1375){for(var _0x480a38=0x0,_0x2005af=events[_0xc9e6('0x4')];_0x480a38<_0x2005af;_0x480a38++){var _0x24da09=events[_0x480a38];var _0x431b7a=createListener('chatGroup:'+_0x24da09,_0x2a1375);ChatGroupEvents['on'](_0x24da09,_0x431b7a);}}; \ No newline at end of file +var _0xc9b9=['chatGroup:','./chatGroup.events','save','remove','update','emit','register','length'];(function(_0x483c47,_0x2fb407){var _0x201d21=function(_0x324073){while(--_0x324073){_0x483c47['push'](_0x483c47['shift']());}};_0x201d21(++_0x2fb407);}(_0xc9b9,0x151));var _0x9c9b=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xc9b9[_0x55f8b4];return _0x2475f9;};'use strict';var ChatGroupEvents=require(_0x9c9b('0x0'));var events=[_0x9c9b('0x1'),_0x9c9b('0x2'),_0x9c9b('0x3')];function createListener(_0x3cb293,_0xb81799){return function(_0x3cb481){_0xb81799[_0x9c9b('0x4')](_0x3cb293,_0x3cb481);};}function removeListener(_0x220c03,_0x4d9fe0){return function(){ChatGroupEvents['removeListener'](_0x220c03,_0x4d9fe0);};}exports[_0x9c9b('0x5')]=function(_0x2e06d8){for(var _0x14d15d=0x0,_0x15ac6e=events[_0x9c9b('0x6')];_0x14d15d<_0x15ac6e;_0x14d15d++){var _0x23bffd=events[_0x14d15d];var _0x40849a=createListener(_0x9c9b('0x7')+_0x23bffd,_0x2e06d8);ChatGroupEvents['on'](_0x23bffd,_0x40849a);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index c80791e..e6fb0c0 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 _0xa457=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/unread','/:id/messages','getMessages','post','create','/:id/members','addMembers'];(function(_0x53ce9e,_0x3aeb32){var _0x213188=function(_0x527e61){while(--_0x527e61){_0x53ce9e['push'](_0x53ce9e['shift']());}};_0x213188(++_0x3aeb32);}(_0xa457,0x1ea));var _0x7a45=function(_0x13acc3,_0x2837a6){_0x13acc3=_0x13acc3-0x0;var _0x271db1=_0xa457[_0x13acc3];return _0x271db1;};'use strict';var multer=require(_0x7a45('0x0'));var util=require(_0x7a45('0x1'));var path=require(_0x7a45('0x2'));var timeout=require(_0x7a45('0x3'));var express=require(_0x7a45('0x4'));var router=express[_0x7a45('0x5')]();var auth=require(_0x7a45('0x6'));var interaction=require(_0x7a45('0x7'));var config=require(_0x7a45('0x8'));var controller=require(_0x7a45('0x9'));router[_0x7a45('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7a45('0xa')](_0x7a45('0xb'),auth[_0x7a45('0xc')](),controller[_0x7a45('0xd')]);router[_0x7a45('0xa')](_0x7a45('0xe'),auth[_0x7a45('0xc')](),controller[_0x7a45('0xf')]);router[_0x7a45('0xa')](_0x7a45('0x10'),auth[_0x7a45('0xc')](),controller['getUnread']);router['get']('/:id/members',auth[_0x7a45('0xc')](),controller['getMembers']);router[_0x7a45('0xa')](_0x7a45('0x11'),auth[_0x7a45('0xc')](),controller[_0x7a45('0x12')]);router[_0x7a45('0x13')]('/',auth[_0x7a45('0xc')](),controller[_0x7a45('0x14')]);router[_0x7a45('0x13')](_0x7a45('0x15'),auth[_0x7a45('0xc')](),controller[_0x7a45('0x16')]);router[_0x7a45('0x13')](_0x7a45('0x11'),auth[_0x7a45('0xc')](),controller['addMessage']);router[_0x7a45('0x17')](_0x7a45('0xe'),auth[_0x7a45('0xc')](),controller[_0x7a45('0x18')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x7a45('0x19')](_0x7a45('0x15'),auth[_0x7a45('0xc')](),controller['removeMembers']);module[_0x7a45('0x1a')]=router; \ No newline at end of file +var _0x2428=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','getUnread','getMembers','getMessages','post','create','/:id/members','/:id/messages','addMessage','delete','removeMembers','exports','util','path'];(function(_0x474fa6,_0x4cbba8){var _0x5c7a8c=function(_0xeaa35){while(--_0xeaa35){_0x474fa6['push'](_0x474fa6['shift']());}};_0x5c7a8c(++_0x4cbba8);}(_0x2428,0x1b7));var _0x8242=function(_0x43c6fd,_0xc88a56){_0x43c6fd=_0x43c6fd-0x0;var _0xfaf7c=_0x2428[_0x43c6fd];return _0xfaf7c;};'use strict';var multer=require('multer');var util=require(_0x8242('0x0'));var path=require(_0x8242('0x1'));var timeout=require('connect-timeout');var express=require(_0x8242('0x2'));var router=express['Router']();var auth=require(_0x8242('0x3'));var interaction=require(_0x8242('0x4'));var config=require(_0x8242('0x5'));var controller=require('./chatGroup.controller');router[_0x8242('0x6')]('/',auth[_0x8242('0x7')](),controller['index']);router[_0x8242('0x6')](_0x8242('0x8'),auth['isAuthenticated'](),controller[_0x8242('0x9')]);router[_0x8242('0x6')]('/:id',auth[_0x8242('0x7')](),controller['show']);router[_0x8242('0x6')]('/:id/unread',auth['isAuthenticated'](),controller[_0x8242('0xa')]);router[_0x8242('0x6')]('/:id/members',auth[_0x8242('0x7')](),controller[_0x8242('0xb')]);router[_0x8242('0x6')]('/:id/messages',auth[_0x8242('0x7')](),controller[_0x8242('0xc')]);router[_0x8242('0xd')]('/',auth[_0x8242('0x7')](),controller[_0x8242('0xe')]);router[_0x8242('0xd')](_0x8242('0xf'),auth['isAuthenticated'](),controller['addMembers']);router[_0x8242('0xd')](_0x8242('0x10'),auth[_0x8242('0x7')](),controller[_0x8242('0x11')]);router['put']('/:id',auth[_0x8242('0x7')](),controller['update']);router[_0x8242('0x12')]('/:id',auth[_0x8242('0x7')](),controller['destroy']);router['delete'](_0x8242('0xf'),auth[_0x8242('0x7')](),controller[_0x8242('0x13')]);module[_0x8242('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 5a75f67..a5d3666 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 _0x1735=['long','out','exports','BOOLEAN','INTEGER','ENUM','star','TEXT','DATE','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1735,0xd4));var _0x5173=function(_0x10553f,_0x14f6f4){_0x10553f=_0x10553f-0x0;var _0x187481=_0x1735[_0x10553f];return _0x187481;};'use strict';var Sequelize=require('sequelize');module[_0x5173('0x0')]={'closed':{'type':Sequelize[_0x5173('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x5173('0x2')]},'ratingType':{'type':Sequelize[_0x5173('0x3')](_0x5173('0x4'),'thumb'),'defaultValue':_0x5173('0x4')},'ratingMessage':{'type':Sequelize[_0x5173('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x5173('0x6')]},'disposition':{'type':Sequelize[_0x5173('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5173('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x5173('0x7')]},'browserVersion':{'type':Sequelize[_0x5173('0x7')]},'osName':{'type':Sequelize[_0x5173('0x7')]},'osVersion':{'type':Sequelize[_0x5173('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x5173('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x5173('0x5')]},'customerIp':{'type':Sequelize[_0x5173('0x7')]},'formData':{'type':Sequelize['TEXT'](_0x5173('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x5173('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x5173('0x3')]('in',_0x5173('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x5173('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x5173('0x5')]}}; \ No newline at end of file +var _0x4db3=['long','out','sequelize','ENUM','star','TEXT','DATE','STRING'];(function(_0x45275d,_0x35f242){var _0x27306d=function(_0x1e358c){while(--_0x1e358c){_0x45275d['push'](_0x45275d['shift']());}};_0x27306d(++_0x35f242);}(_0x4db3,0x1ba));var _0x34db=function(_0x122ee6,_0xc87e48){_0x122ee6=_0x122ee6-0x0;var _0x123345=_0x4db3[_0x122ee6];return _0x123345;};'use strict';var Sequelize=require(_0x34db('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x34db('0x1')](_0x34db('0x2'),'thumb'),'defaultValue':_0x34db('0x2')},'ratingMessage':{'type':Sequelize[_0x34db('0x3')]},'pathTranscript':{'type':Sequelize[_0x34db('0x3')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x34db('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x34db('0x5')]},'thirdDisposition':{'type':Sequelize[_0x34db('0x5')]},'note':{'type':Sequelize[_0x34db('0x5')]},'browserName':{'type':Sequelize[_0x34db('0x5')]},'browserVersion':{'type':Sequelize[_0x34db('0x5')]},'osName':{'type':Sequelize[_0x34db('0x5')]},'osVersion':{'type':Sequelize[_0x34db('0x5')]},'deviceModel':{'type':Sequelize[_0x34db('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x34db('0x5')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x34db('0x3')](_0x34db('0x6'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x34db('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x34db('0x1')]('in',_0x34db('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x34db('0x5')]},'customerPort':{'type':Sequelize[_0x34db('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x34db('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 0eaa3bf..0e0aca1 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 _0x3c02=['Content-Range','apply','reject','update','destroy','sendStatus','name','send','Users','map','fullname','Tags','split','forEach','push','TagIds','ChatInteraction','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','field','color','from','tools_tags','u.id','u.fullname','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','having','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','t.id\x20IN\x20?','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','show','rawAttributes','filtears','include','options','create','body','params','describe','createVidaooSession','findOne','vidaooEscalation','vidaooApiKey','POST','https://api-vidaoo.xcally.com/api/v1/sessions','follow','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Sequelize','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','ValidationError','Interaction\x20already\x20assigned','closed','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','Unauthorized','download','server/files/attachments/','close','join','root','server/files/chat/upload/','format','now','pathTranscript','ChatMessage','ChatWebsite','CmContact','Messages','agentAlias','System','customer','%s%d','Visitor','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','mailTranscript','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','ChatInteractionId','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','getMyMessages','includeAgent','alias','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','transcript-%d-%s.zip','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Chat','N.A.','closedAt','browserName','osName','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','firstName','lastName','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','localhost','./chatInteraction.socket','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','end','status','json','count','offset','limit','set'];(function(_0x2fe900,_0x58bf09){var _0x27185d=function(_0x2fc243){while(--_0x2fc243){_0x2fe900['push'](_0x2fe900['shift']());}};_0x27185d(++_0x58bf09);}(_0x3c02,0xfe));var _0x23c0=function(_0x34273d,_0x529520){_0x34273d=_0x34273d-0x0;var _0x17d32b=_0x3c02[_0x34273d];return _0x17d32b;};'use strict';var pdf=require(_0x23c0('0x0'));var emlformat=require(_0x23c0('0x1'));var rimraf=require(_0x23c0('0x2'));var zipdir=require(_0x23c0('0x3'));var jsonpatch=require(_0x23c0('0x4'));var rp=require(_0x23c0('0x5'));var moment=require(_0x23c0('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x23c0('0x7'));var util=require(_0x23c0('0x8'));var path=require(_0x23c0('0x9'));var sox=require(_0x23c0('0xa'));var csv=require(_0x23c0('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x23c0('0xc'));var squel=require(_0x23c0('0xd'));var crypto=require(_0x23c0('0xe'));var jsforce=require(_0x23c0('0xf'));var deskjs=require(_0x23c0('0x10'));var toCsv=require(_0x23c0('0xb'));var querystring=require(_0x23c0('0x11'));var Papa=require(_0x23c0('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x23c0('0x13'));var hardwareService=require(_0x23c0('0x14'));var logger=require(_0x23c0('0x15'))(_0x23c0('0x16'));var utils=require('../../config/utils');var config=require(_0x23c0('0x17'));var licenseUtil=require(_0x23c0('0x18'));var db=require(_0x23c0('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x23c0('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x23c0('0x1b'))['register'](socket);var jayson=require(_0x23c0('0x1c'));var client=jayson[_0x23c0('0x1d')][_0x23c0('0x1e')]({'port':0x232b});var client9004=jayson[_0x23c0('0x1d')][_0x23c0('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x2d96c1,_0xc7d5ef,_0x3807f7,_0x202fc7){return new BPromise(function(_0x113cd0,_0xfcb77d){var _0x2a57b4=_0x202fc7||client;return _0x2a57b4[_0x23c0('0x1f')](_0x2d96c1,_0x3807f7)[_0x23c0('0x20')](function(_0x4fcdab){logger[_0x23c0('0x21')](_0x23c0('0x22'),_0xc7d5ef,'request\x20sent');logger[_0x23c0('0x23')](_0x23c0('0x24'),_0xc7d5ef,'request\x20sent',JSON[_0x23c0('0x25')](_0x4fcdab));if(_0x4fcdab[_0x23c0('0x26')]){if(_0x4fcdab[_0x23c0('0x26')][_0x23c0('0x27')]===0x1f4){logger[_0x23c0('0x26')]('ChatInteraction,\x20%s,\x20%s',_0xc7d5ef,_0x4fcdab[_0x23c0('0x26')][_0x23c0('0x28')]);return _0xfcb77d(_0x4fcdab[_0x23c0('0x26')][_0x23c0('0x28')]);}logger[_0x23c0('0x26')](_0x23c0('0x22'),_0xc7d5ef,_0x4fcdab[_0x23c0('0x26')]['message']);return _0x113cd0(_0x4fcdab[_0x23c0('0x26')][_0x23c0('0x28')]);}else{logger[_0x23c0('0x21')]('ChatInteraction,\x20%s,\x20%s',_0xc7d5ef,_0x23c0('0x29'));_0x113cd0(_0x4fcdab[_0x23c0('0x2a')][_0x23c0('0x28')]);}})[_0x23c0('0x2b')](function(_0x4fcaff){logger[_0x23c0('0x26')](_0x23c0('0x22'),_0xc7d5ef,_0x4fcaff);_0xfcb77d(_0x4fcaff);});});}function respondWithStatusCode(_0x402581,_0x3f8992){_0x3f8992=_0x3f8992||0xcc;return function(_0x196bd8){if(_0x196bd8){return _0x402581['sendStatus'](_0x3f8992);}return _0x402581['status'](_0x3f8992)[_0x23c0('0x2c')]();};}function respondWithResult(_0x358c40,_0x1c536c){_0x1c536c=_0x1c536c||0xc8;return function(_0x2485bb){if(_0x2485bb){return _0x358c40[_0x23c0('0x2d')](_0x1c536c)[_0x23c0('0x2e')](_0x2485bb);}};}function respondWithFilteredResult(_0x545b01,_0x25b3d6){return function(_0x102cd8){if(_0x102cd8){var _0x168d67=_0x102cd8[_0x23c0('0x2f')],_0xecabe9=_0x25b3d6[_0x23c0('0x30')],_0x29b116=_0x25b3d6[_0x23c0('0x30')]+_0x25b3d6[_0x23c0('0x31')],_0x5ddfc0;if(_0x29b116>=_0x168d67){_0x29b116=_0x168d67;_0x5ddfc0=0xc8;}else{_0x5ddfc0=0xce;}_0x545b01[_0x23c0('0x2d')](_0x5ddfc0);return _0x545b01[_0x23c0('0x32')](_0x23c0('0x33'),_0xecabe9+'-'+_0x29b116+'/'+_0x168d67)['json'](_0x102cd8);}return null;};}function patchUpdates(_0x56c9fb){return function(_0x1ac830){try{jsonpatch[_0x23c0('0x34')](_0x1ac830,_0x56c9fb,!![]);}catch(_0x528e13){return BPromise[_0x23c0('0x35')](_0x528e13);}return _0x1ac830['save']();};}function saveUpdates(_0x424333,_0x473065){return function(_0x20d419){if(_0x20d419){return _0x20d419[_0x23c0('0x36')](_0x424333)[_0x23c0('0x20')](function(_0x43c6d1){return _0x43c6d1;});}return null;};}function removeEntity(_0x684364,_0x4e3928){return function(_0x749814){if(_0x749814){return _0x749814[_0x23c0('0x37')]()[_0x23c0('0x20')](function(){_0x684364[_0x23c0('0x2d')](0xcc)[_0x23c0('0x2c')]();});}};}function handleEntityNotFound(_0x30c4b4,_0x4a160c){return function(_0x1cfa91){if(!_0x1cfa91){_0x30c4b4[_0x23c0('0x38')](0x194);}return _0x1cfa91;};}function handleError(_0x4fb70f,_0x184d8d){_0x184d8d=_0x184d8d||0x1f4;return function(_0x36eca2){logger['error'](_0x36eca2['stack']);if(_0x36eca2[_0x23c0('0x39')]){delete _0x36eca2[_0x23c0('0x39')];}_0x4fb70f[_0x23c0('0x2d')](_0x184d8d)[_0x23c0('0x3a')](_0x36eca2);};}function getInteractionUsers(_0x4919f0,_0x5c2b8e){return new BPromise(function(_0x4d07e5,_0x2e5f99){try{if(_0x5c2b8e[_0x4919f0['id']]){_0x4919f0[_0x23c0('0x3b')]=_[_0x23c0('0x3c')](_0x5c2b8e[_0x4919f0['id']],function(_0x42cb04){return{'id':_0x42cb04['id'],'fullname':_0x42cb04[_0x23c0('0x3d')]};});}}catch(_0x5a122a){_0x2e5f99(_0x5a122a);}_0x4d07e5(_0x4919f0);});}function getInteractionTags(_0x3f7885,_0x540c00){return new BPromise(function(_0xe65e9b,_0x4ac449){try{if(_0x3f7885['TagIds']){_0x3f7885[_0x23c0('0x3e')]=[];_0x3f7885['TagIds'][_0x23c0('0x3f')](',')[_0x23c0('0x40')](function(_0xca9f0e){_0x3f7885['Tags'][_0x23c0('0x41')](_0x540c00[_0xca9f0e]);});}delete _0x3f7885[_0x23c0('0x42')];}catch(_0x32b7db){_0x4ac449(_0x32b7db);}_0xe65e9b(_0x3f7885);});}function updateChatInteraction(_0x442808,_0x513d09,_0x4fe56a){return new BPromise(function(_0x127189,_0x7fdcb0){return getInteractionUsers(_0x442808,_0x4fe56a)[_0x23c0('0x20')](function(_0x17092a){return getInteractionTags(_0x17092a,_0x513d09);})[_0x23c0('0x20')](function(_0x41f4a9){_0x127189(_0x41f4a9);})['catch'](function(_0x2f4749){_0x7fdcb0(_0x2f4749);});});}exports['index']=function(_0x17bd8e,_0x367c4d){var _0xed0b7a={},_0x2de8c8={},_0x4b1980={'count':0x0,'rows':[]};var _0x57a031=_['map'](db[_0x23c0('0x43')]['rawAttributes'],function(_0x348514){return{'name':_0x348514[_0x23c0('0x44')],'type':_0x348514[_0x23c0('0x45')][_0x23c0('0x46')]};});_0x2de8c8[_0x23c0('0x47')]=_[_0x23c0('0x3c')](_0x57a031,_0x23c0('0x39'));_0x2de8c8[_0x23c0('0x48')]=_[_0x23c0('0x49')](_0x17bd8e[_0x23c0('0x48')]);_0x2de8c8[_0x23c0('0x4a')]=_[_0x23c0('0x4b')](_0x2de8c8[_0x23c0('0x47')],_0x2de8c8['query']);_0xed0b7a['attributes']=_[_0x23c0('0x4b')](_0x2de8c8[_0x23c0('0x47')],qs[_0x23c0('0x4c')](_0x17bd8e[_0x23c0('0x48')][_0x23c0('0x4c')]));_0xed0b7a['attributes']=_0xed0b7a[_0x23c0('0x4d')][_0x23c0('0x4e')]?_0xed0b7a['attributes']:_0x2de8c8[_0x23c0('0x47')];if(!_0x17bd8e[_0x23c0('0x48')]['hasOwnProperty']('nolimit')){_0xed0b7a[_0x23c0('0x31')]=qs[_0x23c0('0x31')](_0x17bd8e[_0x23c0('0x48')]['limit']);_0xed0b7a['offset']=qs['offset'](_0x17bd8e[_0x23c0('0x48')][_0x23c0('0x30')]);}_0xed0b7a[_0x23c0('0x4f')]=qs[_0x23c0('0x50')](_0x17bd8e[_0x23c0('0x48')]['sort']);_0xed0b7a['where']=qs['filters'](_[_0x23c0('0x51')](_0x17bd8e[_0x23c0('0x48')],_0x2de8c8[_0x23c0('0x4a')]),_0x57a031);var _0x500c94=[];var _0x41b873=squel['select']()[_0x23c0('0x52')]('id')[_0x23c0('0x52')](_0x23c0('0x39'))[_0x23c0('0x52')](_0x23c0('0x53'))[_0x23c0('0x54')](_0x23c0('0x55'));var _0x52bd28=squel['select']()[_0x23c0('0x52')](_0x23c0('0x56'))[_0x23c0('0x52')](_0x23c0('0x57'))['field']('ui.ChatInteractionId')[_0x23c0('0x54')](_0x23c0('0x58'),'ui')[_0x23c0('0x59')](_0x23c0('0x5a'),'u',_0x23c0('0x5b'));var _0x16edff=squel[_0x23c0('0x5c')]()[_0x23c0('0x54')](_0x23c0('0x5d'),'i')[_0x23c0('0x59')](_0x23c0('0x5e'),'c',_0x23c0('0x5f'))[_0x23c0('0x59')](_0x23c0('0x5a'),'o','o.id\x20=\x20i.UserId')['left_join']('chat_websites','a',_0x23c0('0x60'))[_0x23c0('0x59')](_0x23c0('0x61'),'me',_0x23c0('0x62'))['left_join'](_0x23c0('0x63'),'it',_0x23c0('0x64'))['left_join'](_0x23c0('0x55'),'t','t.id\x20=\x20it.TagId');var _0x573a11=squel[_0x23c0('0x65')]();var _0x58f715=[];var _0x523618=squel[_0x23c0('0x65')]();var _0x5338d8;if(_0x17bd8e[_0x23c0('0x48')][_0x23c0('0x66')]){_0x5338d8=as[_0x23c0('0x67')](_0x17bd8e['query'][_0x23c0('0x66')]);var _0xe03056=_0x5338d8[_0x23c0('0x68')];for(var _0x1c4da1=0x0;_0x1c4da1<_0x5338d8[_0x23c0('0x69')][_0x23c0('0x4e')];_0x1c4da1++){var _0x2970d9=_0x5338d8[_0x23c0('0x69')][_0x1c4da1];var _0x4caa62='i';var _0x338700=_['find'](_0x57a031,[_0x23c0('0x39'),_0x2970d9[_0x23c0('0x52')]]);if(!_0x338700){switch(_0x2970d9[_0x23c0('0x52')]){case'unreadMessages':if(_0x2970d9['value']==0x1){_0x16edff[_0x23c0('0x6a')]('`'+_0x2970d9[_0x23c0('0x52')]+'`\x20=\x200');}else{_0x16edff[_0x23c0('0x6a')]('`'+_0x2970d9['field']+_0x23c0('0x6b'));}break;case _0x23c0('0x6c'):if(_0x2970d9[_0x23c0('0x6d')]===_0x23c0('0x6e')){if(_0x2970d9[_0x23c0('0x6f')]['split']('\x20')[_0x23c0('0x4e')]>0x1){_0x573a11[_0xe03056]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x23c0('0x70')](_0x2970d9['value']),null);}else{var _0x41b5dc='%'+_0x2970d9['value']+'%';_0x573a11[_0xe03056]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x41b5dc,_0x41b5dc,_0x41b5dc);}}else{_0x338700=_[_0x23c0('0x71')](_0x57a031,[_0x23c0('0x39'),_0x23c0('0x72')]);_0x2970d9['field']=_0x23c0('0x72');_0x1d459f=as[_0x23c0('0x73')](_0x4caa62,_0x338700[_0x23c0('0x45')],_0x2970d9);_0x573a11[_0xe03056](_0x1d459f[_0x23c0('0x74')],_0x1d459f[_0x23c0('0x6f')][_0x23c0('0x75')],_0x1d459f['value'][_0x23c0('0x2c')]);}break;case _0x23c0('0x76'):var _0x4a0f1e=_0x2970d9[_0x23c0('0x6f')][_0x23c0('0x3f')](',')['map'](function(_0x5b83b0){return Number(_0x5b83b0);});_0x4a0f1e[_0x23c0('0x40')](function(_0x57f71b){_0x523618['or'](_0x23c0('0x77'),'%,'+_0x57f71b+',%');});_0x58f715=_[_0x23c0('0x78')](_0x58f715,_0x4a0f1e);break;case _0x23c0('0x79'):if(_0x2970d9[_0x23c0('0x6d')]===_0x23c0('0x6e')){_0x573a11[_0xe03056](_0x23c0('0x7a'),'%'+_0x2970d9[_0x23c0('0x6f')]+'%',null);}else{_0x338700=_['find'](_0x57a031,[_0x23c0('0x39'),_0x23c0('0x7b')]);_0x2970d9['field']=_0x23c0('0x7b');_0x1d459f=as['buildExpression'](_0x4caa62,_0x338700[_0x23c0('0x45')],_0x2970d9);_0x573a11[_0xe03056](_0x1d459f[_0x23c0('0x74')],_0x1d459f[_0x23c0('0x6f')][_0x23c0('0x75')],_0x1d459f[_0x23c0('0x6f')][_0x23c0('0x2c')]);}break;case'body':_0x1d459f=as[_0x23c0('0x73')]('me',null,_0x2970d9);_0x573a11[_0xe03056](_0x1d459f['text'],_0x1d459f[_0x23c0('0x6f')][_0x23c0('0x75')],_0x1d459f[_0x23c0('0x6f')][_0x23c0('0x2c')]);break;}}else{var _0x1d459f=as['buildExpression'](_0x4caa62,_0x338700[_0x23c0('0x45')],_0x2970d9);_0x573a11[_0xe03056](_0x1d459f[_0x23c0('0x74')],_0x1d459f['value'][_0x23c0('0x75')],_0x1d459f[_0x23c0('0x6f')]['end']);}}}else{var _0x296af6=_(_0x17bd8e[_0x23c0('0x48')])['keys']()[_0x23c0('0x3c')](function(_0x1cb6aa){return _[_0x23c0('0x7c')](_0x57a031,[_0x23c0('0x39'),_0x1cb6aa])?_0x1cb6aa:undefined;})[_0x23c0('0x7d')]()[_0x23c0('0x6f')]();if(!_[_0x23c0('0x7e')](_0x296af6)){_0x296af6[_0x23c0('0x40')](function(_0x2d94e0){if(_0x2d94e0===_0x23c0('0x7f')){_0x16edff['where'](_0x23c0('0x80'),[][_0x23c0('0x81')](_0x17bd8e[_0x23c0('0x48')][_0x2d94e0]));}else if(_0x2d94e0===_0x23c0('0x82')){var _0x481407=JSON['parse'](_0x17bd8e[_0x23c0('0x48')][_0x2d94e0])['$gte'];var _0x5429d6=JSON[_0x23c0('0x83')](_0x17bd8e[_0x23c0('0x48')][_0x2d94e0])[_0x23c0('0x84')];_0x16edff[_0x23c0('0x85')](_0x23c0('0x86'),_0x481407,_0x5429d6);}else{if(_0x17bd8e[_0x23c0('0x48')][_0x2d94e0]===_0x23c0('0x87')){_0x16edff[_0x23c0('0x85')]('i.'+_0x2d94e0+'\x20IS\x20NULL');}else{_0x16edff[_0x23c0('0x85')]('i.'+_0x2d94e0+_0x23c0('0x88'),_0x17bd8e[_0x23c0('0x48')][_0x2d94e0]);}}});}if(_0x17bd8e[_0x23c0('0x48')][_0x23c0('0x89')]){if(_0x17bd8e[_0x23c0('0x48')][_0x23c0('0x89')]==0x1){_0x16edff[_0x23c0('0x6a')](_0x23c0('0x8a'));}else{_0x16edff[_0x23c0('0x6a')](_0x23c0('0x8b'));}}if(_0x17bd8e[_0x23c0('0x48')][_0x23c0('0x8c')]){_0x58f715=_[_0x23c0('0x8d')](_0x17bd8e[_0x23c0('0x48')]['tag'])?_0x17bd8e[_0x23c0('0x48')][_0x23c0('0x8c')]:new Array(_0x17bd8e[_0x23c0('0x48')][_0x23c0('0x8c')]);_0x58f715[_0x23c0('0x40')](function(_0x2419a7){_0x523618['or'](_0x23c0('0x77'),'%,'+_0x2419a7+',%');});}if(_0x17bd8e[_0x23c0('0x48')][_0x23c0('0x8e')]){var _0x3303b2=_0x17bd8e['query'][_0x23c0('0x8e')][_0x23c0('0x8f')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x23c0('0x90'));if(qs[_0x23c0('0x91')](_0x3303b2)){_0x573a11['or'](_0x23c0('0x92'),_0x3303b2+'%');}else{_0x573a11['or'](_0x23c0('0x93'),qs['getFullTextValue'](_0x3303b2))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3303b2+'%');}}}_0x16edff[_0x23c0('0x85')](_0x573a11);_0x16edff[_0x23c0('0x94')](_0x23c0('0x95'));var _0x592669={'type':db['Sequelize']['QueryTypes'][_0x23c0('0x96')],'raw':!![]};var _0x26cf9e=_0x16edff[_0x23c0('0x97')]();_0x26cf9e[_0x23c0('0x52')]('i.id');_0x26cf9e[_0x23c0('0x52')](_0x23c0('0x98'),_0x23c0('0x99'));if(_0xed0b7a[_0x23c0('0x4f')]){_0xed0b7a['order'][_0x23c0('0x40')](function(_0x6916da){_0x16edff[_0x23c0('0x4f')]('i.'+_0x6916da[0x0],_0x6916da[0x1]==='DESC'?![]:!![]);});}if(!_[_0x23c0('0x7e')](_0x58f715)){_0x16edff[_0x23c0('0x6a')](_0x523618);_0x26cf9e[_0x23c0('0x85')](_0x23c0('0x9a'),_0x58f715);}BPromise['resolve']()[_0x23c0('0x20')](function(){if(!_0x5338d8){if(_0x17bd8e[_0x23c0('0x48')][_0x23c0('0x7f')]||_0x17bd8e[_0x23c0('0x48')][_0x23c0('0x9b')])return;_0x26cf9e[_0x23c0('0x85')](_0x23c0('0x9c'));_0x16edff[_0x23c0('0x85')](_0x23c0('0x9c'));return;}return _0x17bd8e[_0x23c0('0x9d')]['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x23c0('0x20')](function(_0x19c1f4){if(_[_0x23c0('0x7e')](_0x19c1f4)){_0x26cf9e[_0x23c0('0x85')]('i.ChatWebsiteId\x20IS\x20NULL');_0x16edff[_0x23c0('0x85')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x26cf9e[_0x23c0('0x85')]('i.ChatWebsiteId\x20IN\x20?',_[_0x23c0('0x3c')](_0x19c1f4,'id'));_0x16edff[_0x23c0('0x85')](_0x23c0('0x80'),_[_0x23c0('0x3c')](_0x19c1f4,'id'));}});})[_0x23c0('0x20')](function(){db[_0x23c0('0x9e')][_0x23c0('0x48')](_0x26cf9e[_0x23c0('0x9f')](),_0x592669)[_0x23c0('0x20')](function(_0x430611){_0x4b1980[_0x23c0('0x2f')]=_0x430611[_0x23c0('0x4e')];if(_0x4b1980[_0x23c0('0x2f')]===0x0)return[];return db[_0x23c0('0x9e')][_0x23c0('0x48')](_0x41b873[_0x23c0('0x9f')](),_0x592669)[_0x23c0('0x20')](function(_0x3bdaf3){_0x500c94=_[_0x23c0('0xa0')](_0x3bdaf3,'id');_0x592669=_[_0x23c0('0xa1')](_0x592669,{'model':db[_0x23c0('0x43')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x17bd8e[_0x23c0('0x48')][_0x23c0('0x4c')]){_0xed0b7a[_0x23c0('0x4d')][_0x23c0('0x40')](function(_0x534b1e){_0x16edff['field']('i.'+_0x534b1e);});}else{_0x16edff[_0x23c0('0x52')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x23c0('0x99'));_0x16edff[_0x23c0('0x52')](_0x23c0('0xa2'),_0x23c0('0xa3'));_0x16edff[_0x23c0('0x52')](_0x23c0('0xa4'),_0x23c0('0xa5'));_0x16edff[_0x23c0('0x52')](_0x23c0('0xa6'));_0x16edff[_0x23c0('0x52')]('c.firstName',_0x23c0('0xa7'));_0x16edff[_0x23c0('0x52')](_0x23c0('0xa8'),'Contact.lastName');_0x16edff[_0x23c0('0x52')]('c.email',_0x23c0('0xa9'));_0x16edff[_0x23c0('0x52')](_0x23c0('0xaa'),_0x23c0('0xab'));_0x16edff[_0x23c0('0x52')](_0x23c0('0xac'),'Contact.mobile');_0x16edff['field'](_0x23c0('0xad'),_0x23c0('0xae'));_0x16edff[_0x23c0('0x52')](_0x23c0('0xaf'),'Owner.fullname');_0x16edff['field'](_0x23c0('0xb0'),_0x23c0('0xb1'));_0x16edff[_0x23c0('0x52')](_0x23c0('0xb2'),_0x23c0('0x42'));}if(_0xed0b7a[_0x23c0('0x31')])_0x16edff[_0x23c0('0x31')](_0xed0b7a[_0x23c0('0x31')]);if(_0xed0b7a[_0x23c0('0x30')])_0x16edff['offset'](_0xed0b7a[_0x23c0('0x30')]);return db[_0x23c0('0x9e')][_0x23c0('0x48')](_0x16edff[_0x23c0('0x9f')](),_0x592669);})[_0x23c0('0x20')](function(_0x2a13df){_0x52bd28[_0x23c0('0x85')](_0x23c0('0xb3'),_[_0x23c0('0x3c')](_0x2a13df,'id'));return db[_0x23c0('0x9e')]['query'](_0x52bd28[_0x23c0('0x9f')](),_0x592669)[_0x23c0('0x20')](function(_0x543828){var _0x174be7=_[_0x23c0('0xb4')](_0x543828,'ChatInteractionId');var _0x57fc0d=[];_0x2a13df['forEach'](function(_0x3782c9){_0x57fc0d[_0x23c0('0x41')](updateChatInteraction(_0x3782c9,_0x500c94,_0x174be7));});return BPromise[_0x23c0('0xb5')](_0x57fc0d);});});})[_0x23c0('0x20')](function(_0x240388){_0x4b1980[_0x23c0('0xb6')]=_0x240388;return _0x4b1980;})['then'](respondWithFilteredResult(_0x367c4d,_0xed0b7a));})['catch'](handleError(_0x367c4d,null));};exports[_0x23c0('0xb7')]=function(_0x30f25d,_0x47bac4){var _0x30bc91={'raw':![],'where':{'id':_0x30f25d['params']['id']}},_0xbd12db={};_0xbd12db[_0x23c0('0x47')]=_[_0x23c0('0x49')](db[_0x23c0('0x43')][_0x23c0('0xb8')]);_0xbd12db[_0x23c0('0x48')]=_['keys'](_0x30f25d[_0x23c0('0x48')]);_0xbd12db[_0x23c0('0xb9')]=_[_0x23c0('0x4b')](_0xbd12db[_0x23c0('0x47')],_0xbd12db['query']);_0x30bc91[_0x23c0('0x4d')]=_[_0x23c0('0x4b')](_0xbd12db[_0x23c0('0x47')],qs[_0x23c0('0x4c')](_0x30f25d[_0x23c0('0x48')][_0x23c0('0x4c')]));_0x30bc91[_0x23c0('0x4d')]=_0x30bc91[_0x23c0('0x4d')][_0x23c0('0x4e')]?_0x30bc91[_0x23c0('0x4d')]:_0xbd12db['model'];if(_0x30f25d[_0x23c0('0x48')]['includeAll']){_0x30bc91[_0x23c0('0xba')]=[{'all':!![]}];}_0x30bc91=_[_0x23c0('0xa1')]({},_0x30bc91,_0x30f25d[_0x23c0('0xbb')]);return db[_0x23c0('0x43')]['find'](_0x30bc91)['then'](handleEntityNotFound(_0x47bac4,null))[_0x23c0('0x20')](respondWithResult(_0x47bac4,null))[_0x23c0('0x2b')](handleError(_0x47bac4,null));};exports[_0x23c0('0xbc')]=function(_0x19066e,_0x1ccdcf){return db[_0x23c0('0x43')][_0x23c0('0xbc')](_0x19066e[_0x23c0('0xbd')],{})['then'](respondWithResult(_0x1ccdcf,0xc9))[_0x23c0('0x2b')](handleError(_0x1ccdcf,null));};exports[_0x23c0('0x36')]=function(_0x253cbc,_0x43927c){if(_0x253cbc[_0x23c0('0xbd')]['id']){delete _0x253cbc[_0x23c0('0xbd')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x253cbc[_0x23c0('0xbe')]['id']}})['then'](handleEntityNotFound(_0x43927c,null))[_0x23c0('0x20')](saveUpdates(_0x253cbc[_0x23c0('0xbd')],null))[_0x23c0('0x20')](respondWithResult(_0x43927c,null))[_0x23c0('0x2b')](handleError(_0x43927c,null));};exports[_0x23c0('0x37')]=function(_0x5ec4af,_0x114213){return db[_0x23c0('0x43')]['find']({'where':{'id':_0x5ec4af[_0x23c0('0xbe')]['id']}})['then'](handleEntityNotFound(_0x114213,null))[_0x23c0('0x20')](removeEntity(_0x114213,null))[_0x23c0('0x2b')](handleError(_0x114213,null));};exports[_0x23c0('0xbf')]=function(_0x50abbc,_0x898336){return db[_0x23c0('0x43')][_0x23c0('0xbf')]()[_0x23c0('0x20')](respondWithResult(_0x898336,null))[_0x23c0('0x2b')](handleError(_0x898336,null));};exports[_0x23c0('0xc0')]=function(_0x57c4bf,_0x4ca3cb){var _0x4c9de3=_0x57c4bf['params']['id'];var _0x160ede;var _0xed1bba;var _0x3ccc9f;return db[_0x23c0('0x43')][_0x23c0('0xc1')]({'where':{'id':_0x4c9de3}})['then'](function(_0x49945c){_0x160ede=_0x49945c;return db['ChatWebsite'][_0x23c0('0xc1')]({'where':{'id':_0x49945c[_0x23c0('0x7f')]},'attributes':['id','vidaooApiKey',_0x23c0('0xc2')],'raw':!![]});})[_0x23c0('0x20')](function(_0x5b3c36){if(_0x5b3c36&&_0x5b3c36[_0x23c0('0xc3')]&&_0x5b3c36[_0x23c0('0xc2')]){_0xed1bba=_0x5b3c36;var _0x505fd3={'rejectUnauthorized':![],'method':_0x23c0('0xc4'),'uri':_0x23c0('0xc5'),'headers':{'X-APIKEY':_0x5b3c36[_0x23c0('0xc3')]},'body':{'name':'MotionCWB:'+_0x4c9de3},'redirect':_0x23c0('0xc6'),'json':!![]};return rp(_0x505fd3);}else{throw new db['Sequelize']['ValidationError'](_0x23c0('0xc7'));}})[_0x23c0('0x20')](function(_0x3d9d8b){_0x3ccc9f=_0x3d9d8b;if(_0x3ccc9f['id']){var _0x4d61f1={'body':_0x3ccc9f[_0x23c0('0xc8')],'ChatWebsiteId':_0xed1bba['id'],'ChatInteractionId':_0x160ede['id'],'direction':_0x23c0('0xc9'),'UserId':_0x57c4bf['user']['id']};return db['ChatMessage']['create'](_0x4d61f1,{});}else{throw new db[(_0x23c0('0xca'))]['ValidationError'](_0x23c0('0xcb'));}})[_0x23c0('0x20')](function(){return _0x160ede[_0x23c0('0xcc')]({'vidaooSessionId':_0x3ccc9f['id']});})[_0x23c0('0x20')](respondWithResult(_0x4ca3cb,null))[_0x23c0('0x2b')](handleError(_0x4ca3cb,null));};exports[_0x23c0('0xcd')]=function(_0x261105,_0x2ac53e){if(_0x261105[_0x23c0('0xbd')]['id']){delete _0x261105[_0x23c0('0xbd')]['id'];}return db[_0x23c0('0x43')][_0x23c0('0x71')]({'where':{'id':_0x261105[_0x23c0('0xbe')]['id']}})[_0x23c0('0x20')](handleEntityNotFound(_0x2ac53e,null))[_0x23c0('0x20')](saveUpdates(_0x261105['body'],null))[_0x23c0('0x20')](respondWithResult(_0x2ac53e,null))[_0x23c0('0x2b')](handleError(_0x2ac53e,null));};exports[_0x23c0('0xce')]=function(_0x3bb587,_0x180806,_0x1e3402){if(_0x3bb587[_0x23c0('0xbd')]['id']){delete _0x3bb587[_0x23c0('0xbd')]['id'];}return db['ChatInteraction'][_0x23c0('0x71')]({'where':{'id':_0x3bb587[_0x23c0('0xbe')]['id']}})['then'](function(_0x1aa78f){if(!_0x1aa78f){logger[_0x23c0('0x26')](_0x23c0('0xcf'),_0x23c0('0xce'),0x194,'entity\x20not\x20found');_0x180806['sendStatus'](0x194);}else{if(_0x1aa78f[_0x23c0('0x7b')]){throw new db[(_0x23c0('0xca'))][(_0x23c0('0xd0'))](_0x23c0('0xd1'));}}return _0x1aa78f;})['then'](function(_0x232505){if(_0x232505){return _0x232505[_0x23c0('0x36')]({'closed':_0x3bb587['body'][_0x23c0('0xd2')],'disposition':_0x3bb587[_0x23c0('0xbd')]['disposition']})[_0x23c0('0x20')](function(_0xf3cbbd){return _0xf3cbbd;});}})['then'](function(_0x358fad){return respondWithRpcPromise('AbandonInteraction','abandon',_0x3bb587[_0x23c0('0xbd')],client9004);})[_0x23c0('0x20')](respondWithResult(_0x180806,null))[_0x23c0('0x2b')](handleError(_0x180806,null));};exports[_0x23c0('0xd3')]=function(_0x291cc3,_0x3bcbaa,_0x4ec428){_0x291cc3[_0x23c0('0xbd')]['name']=_0x291cc3[_0x23c0('0xd4')][_0x23c0('0xd5')];_0x291cc3['body'][_0x23c0('0xd6')]=_0x291cc3['file'][_0x23c0('0xd7')];_0x291cc3['body'][_0x23c0('0x45')]=_0x291cc3[_0x23c0('0xd4')][_0x23c0('0xd8')];return db[_0x23c0('0xd9')]['create'](_0x291cc3[_0x23c0('0xbd')])['then'](respondWithResult(_0x3bcbaa,0xc9))['catch'](handleError(_0x3bcbaa,null));};exports['attachmentDownload']=function(_0x23af52,_0x30a020,_0x72c3cf){return db['ChatInteraction'][_0x23c0('0xc1')]({'where':{'id':_0x23af52[_0x23c0('0xbe')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x30a020,null))[_0x23c0('0x20')](function(_0xb1032c){if(_0xb1032c){if(_0xb1032c[_0x23c0('0xd2')]){return _0x30a020['status'](0x193)[_0x23c0('0x2e')]({'status':0x193,'message':_0x23c0('0xda')});}return db[_0x23c0('0xd9')][_0x23c0('0xc1')]({'where':{'id':_0x23af52[_0x23c0('0x48')]['attachId']},'raw':!![]})[_0x23c0('0x20')](handleEntityNotFound(_0x30a020,null));}})['then'](function(_0x14dbab){if(_0x14dbab){return _0x30a020[_0x23c0('0xdb')](path['join'](config['root'],_0x23c0('0xdc'),_0x14dbab[_0x23c0('0xd6')]));}})[_0x23c0('0x2b')](handleError(_0x30a020,null));};exports[_0x23c0('0xdd')]=function(_0x1c0436,_0x17166a){var _0xe538ed=null;var _0x5224a1=null;var _0x812253=null;var _0xcb4364=null;if(_0x1c0436[_0x23c0('0xbd')]['id']){delete _0x1c0436[_0x23c0('0xbd')]['id'];}if(_0x1c0436['body']['mailTranscript']){_0xcb4364=path[_0x23c0('0xde')](config[_0x23c0('0xdf')],_0x23c0('0xe0'),util[_0x23c0('0xe1')]('transcript-%s.txt',Date[_0x23c0('0xe2')]()));_0x1c0436['body'][_0x23c0('0xe3')]=_0xcb4364;}return db['ChatInteraction']['find']({'where':{'id':_0x1c0436[_0x23c0('0xbe')]['id']},'include':[{'model':db[_0x23c0('0xe4')],'as':'Messages','include':[{'model':db[_0x23c0('0x79')],'as':'User'}]}]})[_0x23c0('0x20')](handleEntityNotFound(_0x17166a,null))[_0x23c0('0x20')](saveUpdates(_0x1c0436['body'],null))[_0x23c0('0x20')](function(_0x39131a){if(_0x39131a){_0xe538ed=_0x39131a;return db[_0x23c0('0xe5')]['find']({'where':{'id':_0xe538ed[_0x23c0('0x7f')]}});}})[_0x23c0('0x20')](function(_0x230af0){if(_0x230af0){_0x812253=_0x230af0;return db[_0x23c0('0xe6')][_0x23c0('0x71')]({'where':{'id':_0xe538ed[_0x23c0('0x72')]}});}})[_0x23c0('0x20')](function(_0x497f55){if(_0x497f55){_0x5224a1=_0x497f55;if(_0xcb4364){var _0x558653=null;for(var _0x15ebdc=0x1;_0x15ebdc<_0xe538ed[_0x23c0('0xe7')]['length'];++_0x15ebdc){_0x558653=_0xe538ed['Messages'][_0x15ebdc];var _0x3a894c=_0x558653[_0x23c0('0x7b')]?util[_0x23c0('0xe1')]('%s%d',_0x812253[_0x23c0('0xe8')],_0x558653[_0x23c0('0x7b')]):_0x23c0('0xe9');var _0x47ef96=_0x1c0436['body'][_0x23c0('0xea')]||util[_0x23c0('0xe1')](_0x23c0('0xeb'),_0x23c0('0xec'),_0x558653[_0x23c0('0x72')]);switch(_0x812253['agentIdentifier']){case'website_alias':_0x3a894c=_0x558653[_0x23c0('0x7b')]?util[_0x23c0('0xe1')](_0x23c0('0xeb'),_0x812253['agentAlias'],_0x558653[_0x23c0('0x7b')]):_0x23c0('0xe9');break;case _0x23c0('0xed'):_0x3a894c=_0x558653[_0x23c0('0x7b')]?_0x558653[_0x23c0('0x79')]['alias']||_0x558653[_0x23c0('0x79')]['fullname']:'System';break;case _0x23c0('0xee'):_0x3a894c=_0x558653[_0x23c0('0x7b')]?_0x558653['User'][_0x23c0('0x3d')]:_0x23c0('0xe9');break;default:_0x3a894c=_0x558653[_0x23c0('0x7b')]?util[_0x23c0('0xe1')](_0x23c0('0xeb'),_0x812253['agentAlias'],_0x558653[_0x23c0('0x7b')]):'System';}var _0x448448=util[_0x23c0('0xe1')](_0x23c0('0xef'),moment(_0x558653[_0x23c0('0x82')])[_0x23c0('0xe1')]('MM/DD/YYYY\x20HH:mm:ss'),_0x558653[_0x23c0('0xf0')]==='in'?_0x47ef96:_0x3a894c,_0x558653[_0x23c0('0xbd')]);if(!_0x558653[_0x23c0('0xf1')]){fs['appendFileSync'](_0xcb4364,_0x448448);}}return db['MailAccount'][_0x23c0('0xc1')]({'where':{'service':!![]},'include':[{'model':db[_0x23c0('0xf2')],'as':_0x23c0('0xf3'),'raw':!![]}]});}}})[_0x23c0('0x20')](function(_0x335bd5){if(_0x335bd5&&_0x335bd5[_0x23c0('0xf3')]&&_0x1c0436['body']){var _0x63b161={'tls':{'rejectUnauthorized':![]}};if(_0x335bd5[_0x23c0('0xf3')][_0x23c0('0xf4')]){_0x63b161[_0x23c0('0xf4')]=_0x335bd5[_0x23c0('0xf3')][_0x23c0('0xf4')];}else{_0x63b161['host']=_0x335bd5[_0x23c0('0xf3')][_0x23c0('0xf5')];_0x63b161[_0x23c0('0xf6')]=_0x335bd5[_0x23c0('0xf3')][_0x23c0('0xf6')];_0x63b161[_0x23c0('0xf7')]=_0x335bd5[_0x23c0('0xf3')][_0x23c0('0xf7')];}if(_0x335bd5[_0x23c0('0xf3')][_0x23c0('0xf8')]){_0x63b161[_0x23c0('0xf9')]={'user':_0x335bd5[_0x23c0('0xf3')][_0x23c0('0x9d')],'pass':_0x335bd5[_0x23c0('0xf3')][_0x23c0('0xfa')]};}return respondWithRpcPromise(_0x23c0('0xfb'),'sendMail',{'account':_0x63b161,'message':{'from':util[_0x23c0('0xe1')]('\x22%s\x22\x20<%s>',_0x335bd5[_0x23c0('0x39')],_0x335bd5['email']||_0x335bd5[_0x23c0('0xf3')][_0x23c0('0x9d')]),'to':_0x1c0436[_0x23c0('0xbd')][_0x23c0('0xfc')],'subject':'Mail\x20Transcript','text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x1c0436['body'][_0x23c0('0xfc')]),'attachments':[{'path':_0xcb4364}]}})[_0x23c0('0x20')](function(){return _0xe538ed;})[_0x23c0('0x2b')](function(_0x304340){console[_0x23c0('0x26')](_0x304340);});}else{return _0xe538ed;}})[_0x23c0('0x20')](respondWithStatusCode(_0x17166a,0xc8))[_0x23c0('0x2b')](handleError(_0x17166a,null));};exports[_0x23c0('0xfd')]=function(_0x21c0cd,_0x4e4f0a,_0x582b26){return db[_0x23c0('0xe4')][_0x23c0('0x71')]({'where':{'id':_0x21c0cd[_0x23c0('0xbe')]['id']}})['then'](handleEntityNotFound(_0x4e4f0a,null))['then'](function(_0x3cd04a){if(_0x3cd04a){return _0x3cd04a[_0x23c0('0xfd')](_0x21c0cd['body'][_0x23c0('0xfe')],_[_0x23c0('0xff')](_0x21c0cd[_0x23c0('0xbd')],[_0x23c0('0xfe'),'id'])||{});}})[_0x23c0('0x20')](respondWithResult(_0x4e4f0a,null))[_0x23c0('0x2b')](handleError(_0x4e4f0a,null));};exports[_0x23c0('0x100')]=function(_0x952222,_0x386005,_0x5428b3){var _0x3b0c39={'raw':![],'where':{}};var _0x4f0625={};var _0x3b5638={'count':0x0,'rows':[]};return db[_0x23c0('0x43')]['findOne']({'where':{'id':_0x952222[_0x23c0('0xbe')]['id']}})[_0x23c0('0x20')](handleEntityNotFound(_0x386005,null))[_0x23c0('0x20')](function(_0x1bc2ed){if(_0x1bc2ed){_0x4f0625[_0x23c0('0x47')]=_[_0x23c0('0x49')](db[_0x23c0('0xe4')][_0x23c0('0xb8')]);_0x4f0625['query']=_[_0x23c0('0x49')](_0x952222[_0x23c0('0x48')]);_0x4f0625[_0x23c0('0x4a')]=_['intersection'](_0x4f0625[_0x23c0('0x47')],_0x4f0625['query']);_0x3b0c39['attributes']=_['intersection'](_0x4f0625[_0x23c0('0x47')],qs['fields'](_0x952222[_0x23c0('0x48')][_0x23c0('0x4c')]));_0x3b0c39[_0x23c0('0x4d')]=_0x3b0c39['attributes'][_0x23c0('0x4e')]?_0x3b0c39[_0x23c0('0x4d')]:_0x4f0625[_0x23c0('0x47')];if(!_0x952222[_0x23c0('0x48')][_0x23c0('0x101')](_0x23c0('0x102'))){_0x3b0c39[_0x23c0('0x31')]=qs['limit'](_0x952222['query'][_0x23c0('0x31')]);_0x3b0c39['offset']=qs['offset'](_0x952222['query'][_0x23c0('0x30')]);}_0x3b0c39[_0x23c0('0x4f')]=qs[_0x23c0('0x50')](_0x952222[_0x23c0('0x48')][_0x23c0('0x50')]);_0x3b0c39[_0x23c0('0x85')]=qs['filters'](_['pick'](_0x952222[_0x23c0('0x48')],_0x4f0625['filters']));_0x3b0c39['where'][_0x23c0('0x103')]=_0x1bc2ed['id'];if(_0x952222[_0x23c0('0x48')][_0x23c0('0x8e')]){_0x3b0c39['where']=_[_0x23c0('0xa1')](_0x3b0c39['where'],{'$or':_[_0x23c0('0x3c')](_0x3b0c39[_0x23c0('0x4d')],function(_0x3e4008){var _0x2d93f4={};_0x2d93f4[_0x3e4008]={'$like':'%'+_0x952222[_0x23c0('0x48')]['filter']+'%'};return _0x2d93f4;})});}if(_0x952222[_0x23c0('0x48')][_0x23c0('0x104')]){var _0x3fd360=_0x952222[_0x23c0('0x48')][_0x23c0('0x104')][_0x23c0('0x3f')](',');var _0x1c9617={};_0x1c9617[_0x3fd360[0x0]]={'$gte':moment(_0x3fd360[0x1])[_0x23c0('0xe1')](_0x23c0('0x105'))};_0x3b0c39[_0x23c0('0x85')]=_[_0x23c0('0xa1')](_0x3b0c39[_0x23c0('0x85')],_0x1c9617);}_0x3b0c39=_[_0x23c0('0xa1')]({},_0x3b0c39,_0x952222[_0x23c0('0xbb')]);return db[_0x23c0('0xe4')][_0x23c0('0x2f')]({'where':_0x3b0c39[_0x23c0('0x85')]})[_0x23c0('0x20')](function(_0x10a8cc){_0x3b5638[_0x23c0('0x2f')]=_0x10a8cc;if(_0x952222['query'][_0x23c0('0x106')]){_0x3b0c39['include']=[{'all':!![]}];}return db[_0x23c0('0xe4')][_0x23c0('0x107')](_0x3b0c39);})[_0x23c0('0x20')](function(_0x30054f){_0x3b5638[_0x23c0('0xb6')]=_0x30054f;return _0x3b5638;});}})[_0x23c0('0x20')](respondWithFilteredResult(_0x386005,_0x3b0c39))[_0x23c0('0x2b')](handleError(_0x386005,null));};exports[_0x23c0('0x108')]=function(_0x4ad8f4,_0x338b96,_0x2e91cf){var _0x5ebc0f={'where':{}},_0x4172c1={},_0x4421b8={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x23c0('0xc1')]({'where':{'id':_0x4ad8f4[_0x23c0('0xbe')]['id']}})[_0x23c0('0x20')](handleEntityNotFound(_0x338b96,null))[_0x23c0('0x20')](function(_0x526824){if(_0x526824){_0x4172c1[_0x23c0('0x47')]=_[_0x23c0('0x49')](db[_0x23c0('0xe4')][_0x23c0('0xb8')]);_0x4172c1[_0x23c0('0x48')]=_[_0x23c0('0x49')](_0x4ad8f4[_0x23c0('0x48')]);_0x4172c1[_0x23c0('0x4a')]=_[_0x23c0('0x4b')](_0x4172c1[_0x23c0('0x47')],_0x4172c1[_0x23c0('0x48')]);_0x5ebc0f[_0x23c0('0x4d')]=_[_0x23c0('0x4b')](_0x4172c1[_0x23c0('0x47')],qs['fields'](_0x4ad8f4[_0x23c0('0x48')][_0x23c0('0x4c')]));_0x5ebc0f[_0x23c0('0x4d')]=_0x5ebc0f[_0x23c0('0x4d')][_0x23c0('0x4e')]?_0x5ebc0f['attributes']:_0x4172c1[_0x23c0('0x47')];if(!_0x4ad8f4['query'][_0x23c0('0x101')](_0x23c0('0x102'))){_0x5ebc0f['limit']=qs[_0x23c0('0x31')](_0x4ad8f4['query'][_0x23c0('0x31')]);_0x5ebc0f[_0x23c0('0x30')]=qs[_0x23c0('0x30')](_0x4ad8f4[_0x23c0('0x48')][_0x23c0('0x30')]);}_0x5ebc0f[_0x23c0('0x4f')]=qs['sort'](_0x4ad8f4['query'][_0x23c0('0x50')]);_0x5ebc0f[_0x23c0('0x85')]=qs['filters'](_['pick'](_0x4ad8f4['query'],_0x4172c1['filters']));_0x5ebc0f[_0x23c0('0x85')][_0x23c0('0x103')]=_0x526824['id'];if(_0x4ad8f4['query'][_0x23c0('0x8e')]){_0x5ebc0f[_0x23c0('0x85')]=_['merge'](_0x5ebc0f[_0x23c0('0x85')],{'$or':_[_0x23c0('0x3c')](_0x5ebc0f[_0x23c0('0x4d')],function(_0x2c6544){var _0x4f4c34={};_0x4f4c34[_0x2c6544]={'$like':'%'+_0x4ad8f4[_0x23c0('0x48')][_0x23c0('0x8e')]+'%'};return _0x4f4c34;})});}_0x5ebc0f[_0x23c0('0x85')][_0x23c0('0xf1')]=![];if(_0x4ad8f4[_0x23c0('0x48')]['id']){_0x5ebc0f[_0x23c0('0x85')]['id']={'$gt':_0x4ad8f4[_0x23c0('0x48')]['id']};}_0x5ebc0f=_[_0x23c0('0xa1')]({},_0x5ebc0f,_0x4ad8f4['options']);return db['ChatMessage'][_0x23c0('0x2f')]({'where':_0x5ebc0f[_0x23c0('0x85')]})['then'](function(_0x45f865){_0x4421b8[_0x23c0('0x2f')]=_0x45f865;_0x5ebc0f[_0x23c0('0xba')]=[];if(_0x4ad8f4[_0x23c0('0x48')][_0x23c0('0x109')]){_0x5ebc0f[_0x23c0('0xba')][_0x23c0('0x41')]({'model':db[_0x23c0('0x79')],'as':_0x23c0('0x79'),'attributes':['id',_0x23c0('0x3d'),_0x23c0('0x10a')]});}if(_0x4ad8f4['query'][_0x23c0('0x106')]){_0x5ebc0f[_0x23c0('0xba')]=[{'all':!![]}];}return db[_0x23c0('0xe4')]['findAll'](_0x5ebc0f);})['then'](function(_0x233f5c){_0x4421b8[_0x23c0('0xb6')]=_0x233f5c;return _0x4421b8;});}})[_0x23c0('0x20')](respondWithFilteredResult(_0x338b96,_0x5ebc0f))[_0x23c0('0x2b')](handleError(_0x338b96,null));};exports['addTags']=function(_0x1b5061,_0x4cd183,_0x33ecf4){return db['ChatInteraction'][_0x23c0('0x71')]({'where':{'id':_0x1b5061[_0x23c0('0xbe')]['id']}})['then'](handleEntityNotFound(_0x4cd183,null))[_0x23c0('0x20')](function(_0x2b18c5){if(_0x2b18c5){return _0x2b18c5[_0x23c0('0x10b')](_0x1b5061[_0x23c0('0xbd')][_0x23c0('0xfe')],_['omit'](_0x1b5061['body'],['ids','id'])||{})[_0x23c0('0x10c')](function(){return db[_0x23c0('0x76')][_0x23c0('0x107')]({'attributes':['id',_0x23c0('0x39'),_0x23c0('0x53')],'where':{'id':_0x1b5061[_0x23c0('0xbd')]['ids']}});})[_0x23c0('0x20')](function(_0x488f7c){socket[_0x23c0('0x10d')](_0x23c0('0x10e'),{'id':Number(_0x1b5061[_0x23c0('0xbe')]['id']),'tags':_0x488f7c||[]});return{'id':Number(_0x1b5061[_0x23c0('0xbe')]['id']),'tags':_0x488f7c||[]};});}})['then'](respondWithResult(_0x4cd183,null))[_0x23c0('0x2b')](handleError(_0x4cd183,null));};exports[_0x23c0('0x10f')]=function(_0x6cef7f,_0x561206,_0x38fc5a){return db[_0x23c0('0x43')][_0x23c0('0x71')]({'where':{'id':_0x6cef7f[_0x23c0('0xbe')]['id']}})[_0x23c0('0x20')](handleEntityNotFound(_0x561206,null))[_0x23c0('0x20')](function(_0x3076c9){if(_0x3076c9){return _0x3076c9[_0x23c0('0x10f')](_0x6cef7f[_0x23c0('0x48')][_0x23c0('0xfe')]);}})[_0x23c0('0x20')](respondWithStatusCode(_0x561206,null))['catch'](handleError(_0x561206,null));};exports[_0x23c0('0xdb')]=function(_0x278914,_0x4a0357){var _0x3dd49d=moment()[_0x23c0('0x110')]()[_0x23c0('0x9f')]();var _0x49b0ff=path[_0x23c0('0xde')](config[_0x23c0('0xdf')],_0x23c0('0x111'),_0x23c0('0x112'),'tmp');var _0x9eaf0a=path[_0x23c0('0xde')](config[_0x23c0('0xdf')],'server',_0x23c0('0x112'),'attachments');var _0x188fa8=path[_0x23c0('0xde')](_0x49b0ff,_0x3dd49d);var _0x7c7836=util[_0x23c0('0xe1')](_0x23c0('0x113'),_0x278914[_0x23c0('0xbe')]['id'],_0x3dd49d);var _0x4d88cf=path[_0x23c0('0xde')](_0x49b0ff,_0x7c7836);var _0xd3a204=[];_0xd3a204[_0x23c0('0x41')]({'model':db[_0x23c0('0x79')],'as':_0x23c0('0x79'),'attributes':['id','fullname'],'raw':!![]});_0xd3a204[_0x23c0('0x41')]({'model':db[_0x23c0('0xe6')],'as':_0x23c0('0x6c'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x278914[_0x23c0('0x48')]['attachments']){_0xd3a204['push']({'model':db['Attachment'],'as':_0x23c0('0xd9'),'raw':!![]});}var _0x2add08=[{'model':db[_0x23c0('0xe4')],'as':_0x23c0('0xe7'),'attributes':['id','body','createdAt',_0x23c0('0xf0'),_0x23c0('0xf1'),_0x23c0('0x89')],'include':_0xd3a204}];_0x2add08[_0x23c0('0x41')]({'model':db[_0x23c0('0xe5')],'as':_0x23c0('0x114'),'attributes':['id','name']});_0x2add08[_0x23c0('0x41')]({'model':db['User'],'as':_0x23c0('0x115'),'attributes':['id',_0x23c0('0x3d')]});return db[_0x23c0('0x43')][_0x23c0('0x71')]({'where':{'id':_0x278914[_0x23c0('0xbe')]['id']},'include':_0x2add08})[_0x23c0('0x20')](handleEntityNotFound(_0x4a0357,null))['then'](function(_0x58bd60){if(_0x58bd60){var _0x175774=_0x58bd60[_0x23c0('0x116')]({'plain':!![]});fs[_0x23c0('0x117')](_0x188fa8);var _0x9645fb={'format':'A4','border':_0x23c0('0x118'),'header':{'height':_0x23c0('0x119'),'contents':{'first':_0x23c0('0x11a')}},'footer':{'height':_0x23c0('0x11b'),'contents':{'default':util[_0x23c0('0xe1')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x23c0('0xe1')](_0x23c0('0x11c'),_0x23c0('0x11d'),_0x175774['id']),moment()[_0x23c0('0xe1')]('YYYY-MM-DD')[_0x23c0('0x9f')]())}}};var _0x32830a={'channel':_0x23c0('0x11d'),'account':_0x175774[_0x23c0('0x114')]['name'],'agent':_0x175774[_0x23c0('0x115')]?_0x175774[_0x23c0('0x115')][_0x23c0('0x3d')]:_0x23c0('0x11e'),'createdAt':moment(_0x175774['createdAt'])[_0x23c0('0xe1')](_0x23c0('0x105'))[_0x23c0('0x9f')](),'closedAt':_0x175774[_0x23c0('0xd2')]?moment(_0x175774[_0x23c0('0x11f')])[_0x23c0('0xe1')](_0x23c0('0x105'))[_0x23c0('0x9f')]():'','disposition':_0x175774['disposition'],'chatInfo':{'browser':_0x175774[_0x23c0('0x120')],'os':_0x175774[_0x23c0('0x121')],'referer':_0x175774['referer'],'customerIp':_0x175774[_0x23c0('0x122')],'customerPort':_0x175774[_0x23c0('0x123')]?_0x175774['customerPort']:'N.A.'},'messages':_(_0x175774[_0x23c0('0xe7')])[_0x23c0('0x124')]()[_0x23c0('0x8e')]({'secret':![]})[_0x23c0('0x3c')](function(_0x2c350c){if(_0x2c350c['Attachment']){var _0xf91100=path[_0x23c0('0xde')](_0x9eaf0a,_0x2c350c[_0x23c0('0xd9')][_0x23c0('0xd6')]);if(fs[_0x23c0('0x125')](_0xf91100)){fs[_0x23c0('0x126')](_0xf91100)['pipe'](fs[_0x23c0('0x127')](path[_0x23c0('0xde')](_0x188fa8,_0x2c350c['Attachment']['basename'])));}}return{'date':moment(_0x2c350c[_0x23c0('0x82')])[_0x23c0('0xe1')](_0x23c0('0x105'))[_0x23c0('0x9f')](),'sender':_0x2c350c[_0x23c0('0xf0')]===_0x23c0('0xc9')?_0x2c350c[_0x23c0('0x79')]?_0x2c350c[_0x23c0('0x79')]['fullname']:_0x23c0('0xe9'):_0x2c350c[_0x23c0('0x6c')][_0x23c0('0x128')]+(_0x2c350c[_0x23c0('0x6c')]['lastName']?'\x20'+_0x2c350c[_0x23c0('0x6c')][_0x23c0('0x129')]:''),'body':_0x2c350c[_0x23c0('0xd9')]?_0x2c350c['Attachment'][_0x23c0('0xd6')]:_0x2c350c[_0x23c0('0xbd')],'direction':_0x2c350c['direction']===_0x23c0('0xc9')?'A':'C','secret':_0x2c350c[_0x23c0('0xf1')],'read':_0x2c350c[_0x23c0('0x89')],'attachment':_0x2c350c['Attachment']};})['value']()};return ejs['renderFile'](path[_0x23c0('0xde')](config[_0x23c0('0xdf')],'server',_0x23c0('0x12a'),_0x23c0('0x12b')),{'interaction':_0x32830a})[_0x23c0('0x20')](function(_0x290738){return new BPromise(function(_0xdfc63e,_0x5b0782){pdf[_0x23c0('0xbc')](_0x290738,_0x9645fb)[_0x23c0('0x12c')](path['join'](_0x188fa8,_0x23c0('0x12d')+_0x175774['id']+'-'+_0x3dd49d+_0x23c0('0x12e')),function(_0x50ab00,_0x3cd3f5){if(_0x50ab00)return _0x5b0782(_0x50ab00);_0xdfc63e(_0x3cd3f5);});});})[_0x23c0('0x20')](function(){return new BPromise(function(_0x1a7d84,_0x2ae991){zipdir(_0x188fa8,{'saveTo':_0x4d88cf},function(_0x149157,_0x488c55){if(_0x149157)return _0x2ae991(_0x149157);return _0x1a7d84(_0x488c55);});})[_0x23c0('0x20')](function(){return new BPromise(function(_0xb5aee3,_0xefe867){rimraf(_0x188fa8,function(_0x4fb6ba){if(_0x4fb6ba)_0xefe867(_0x4fb6ba);return _0xb5aee3();});});})[_0x23c0('0x20')](function(){return _0x4a0357[_0x23c0('0xdb')](_0x4d88cf,_0x7c7836,function(_0x5dfa39){if(_0x5dfa39){console[_0x23c0('0x12f')](_0x23c0('0x130'),_0x5dfa39);}else{fs['unlinkSync'](_0x4d88cf);}});});});}else{return _0x4a0357['sendStatus'](0xc8);}})[_0x23c0('0x2b')](handleError(_0x4a0357,null));}; \ No newline at end of file +var _0x2c42=['chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\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','text','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\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?','group','i.id','QueryTypes','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ChatInteractionId','all','rows','show','params','keys','filtears','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','user','ChatMessage','Sequelize','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','filename','mimetype','attachmentDownload','json','Unauthorized','Attachment','download','join','root','server/files/attachments/','basename','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','CmContact','format','agentAlias','customer','%s%d','Visitor','agentIdentifier','website_alias','System','agent_alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','pass','SendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','addMessage','omit','ids','getMessages','pick','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','includeAll','addTags','setTags','emit','chatInteractionTags:save','removeTags','files','tmp','server','transcript-%d-%s.zip','firstName','lastName','Account','Owner','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','existsSync','pipe','createWriteStream','direction','out','views','downloadInteraction.html','transcript-','.pdf','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','count','offset','set','apply','reject','save','update','destroy','end','stack','Users','map','fullname','TagIds','Tags','forEach','push','rawAttributes','fieldName','type','name','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','u.id\x20=\x20ui.UserId','from','chat_interactions','left_join','cm_contacts','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id'];(function(_0x51ea1d,_0x5515e2){var _0x205d5a=function(_0x4f072d){while(--_0x4f072d){_0x51ea1d['push'](_0x51ea1d['shift']());}};_0x205d5a(++_0x5515e2);}(_0x2c42,0xd9));var _0x22c4=function(_0x164283,_0x4b3b5a){_0x164283=_0x164283-0x0;var _0x3f111e=_0x2c42[_0x164283];return _0x3f111e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x22c4('0x0'));var zipdir=require(_0x22c4('0x1'));var jsonpatch=require(_0x22c4('0x2'));var rp=require(_0x22c4('0x3'));var moment=require(_0x22c4('0x4'));var BPromise=require(_0x22c4('0x5'));var Mustache=require(_0x22c4('0x6'));var util=require('util');var path=require(_0x22c4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x22c4('0x8'));var squel=require(_0x22c4('0x9'));var crypto=require(_0x22c4('0xa'));var jsforce=require(_0x22c4('0xb'));var deskjs=require(_0x22c4('0xc'));var toCsv=require(_0x22c4('0xd'));var querystring=require(_0x22c4('0xe'));var Papa=require('papaparse');var Redis=require(_0x22c4('0xf'));var authService=require(_0x22c4('0x10'));var qs=require(_0x22c4('0x11'));var as=require(_0x22c4('0x12'));var hardwareService=require(_0x22c4('0x13'));var logger=require('../../config/logger')(_0x22c4('0x14'));var utils=require('../../config/utils');var config=require(_0x22c4('0x15'));var licenseUtil=require(_0x22c4('0x16'));var db=require(_0x22c4('0x17'))['db'];config[_0x22c4('0x18')]=_[_0x22c4('0x19')](config[_0x22c4('0x18')],{'host':_0x22c4('0x1a'),'port':0x18eb});var socket=require(_0x22c4('0x1b'))(new Redis(config[_0x22c4('0x18')]));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0x22c4('0x1c'));var client=jayson['client'][_0x22c4('0x1d')]({'port':0x232b});var client9004=jayson[_0x22c4('0x1e')][_0x22c4('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0xdc6d00,_0x3ba5e6,_0x11e75f,_0x287fe2){return new BPromise(function(_0xf005dd,_0x55b35d){var _0x4130b8=_0x287fe2||client;return _0x4130b8[_0x22c4('0x1f')](_0xdc6d00,_0x11e75f)[_0x22c4('0x20')](function(_0x34bbc6){logger[_0x22c4('0x21')](_0x22c4('0x22'),_0x3ba5e6,_0x22c4('0x23'));logger[_0x22c4('0x24')](_0x22c4('0x25'),_0x3ba5e6,'request\x20sent',JSON[_0x22c4('0x26')](_0x34bbc6));if(_0x34bbc6[_0x22c4('0x27')]){if(_0x34bbc6[_0x22c4('0x27')][_0x22c4('0x28')]===0x1f4){logger[_0x22c4('0x27')](_0x22c4('0x22'),_0x3ba5e6,_0x34bbc6[_0x22c4('0x27')]['message']);return _0x55b35d(_0x34bbc6[_0x22c4('0x27')][_0x22c4('0x29')]);}logger['error'](_0x22c4('0x22'),_0x3ba5e6,_0x34bbc6[_0x22c4('0x27')]['message']);return _0xf005dd(_0x34bbc6['error'][_0x22c4('0x29')]);}else{logger[_0x22c4('0x21')]('ChatInteraction,\x20%s,\x20%s',_0x3ba5e6,_0x22c4('0x23'));_0xf005dd(_0x34bbc6[_0x22c4('0x2a')]['message']);}})[_0x22c4('0x2b')](function(_0xfb3aa7){logger[_0x22c4('0x27')](_0x22c4('0x22'),_0x3ba5e6,_0xfb3aa7);_0x55b35d(_0xfb3aa7);});});}function respondWithStatusCode(_0x3eb3a9,_0xe3b919){_0xe3b919=_0xe3b919||0xcc;return function(_0x382e18){if(_0x382e18){return _0x3eb3a9[_0x22c4('0x2c')](_0xe3b919);}return _0x3eb3a9[_0x22c4('0x2d')](_0xe3b919)['end']();};}function respondWithResult(_0x2e4249,_0x112a1b){_0x112a1b=_0x112a1b||0xc8;return function(_0x1d8ca6){if(_0x1d8ca6){return _0x2e4249[_0x22c4('0x2d')](_0x112a1b)['json'](_0x1d8ca6);}};}function respondWithFilteredResult(_0x56d6e2,_0x1b62e4){return function(_0x509b94){if(_0x509b94){var _0x5d5c01=_0x509b94[_0x22c4('0x2e')],_0x4bca09=_0x1b62e4['offset'],_0x23f8d4=_0x1b62e4[_0x22c4('0x2f')]+_0x1b62e4['limit'],_0xfaf906;if(_0x23f8d4>=_0x5d5c01){_0x23f8d4=_0x5d5c01;_0xfaf906=0xc8;}else{_0xfaf906=0xce;}_0x56d6e2[_0x22c4('0x2d')](_0xfaf906);return _0x56d6e2[_0x22c4('0x30')]('Content-Range',_0x4bca09+'-'+_0x23f8d4+'/'+_0x5d5c01)['json'](_0x509b94);}return null;};}function patchUpdates(_0x58afe8){return function(_0x1f522c){try{jsonpatch[_0x22c4('0x31')](_0x1f522c,_0x58afe8,!![]);}catch(_0x8b4080){return BPromise[_0x22c4('0x32')](_0x8b4080);}return _0x1f522c[_0x22c4('0x33')]();};}function saveUpdates(_0x4c151e,_0x26ce4f){return function(_0x3dca5e){if(_0x3dca5e){return _0x3dca5e[_0x22c4('0x34')](_0x4c151e)[_0x22c4('0x20')](function(_0xa233d3){return _0xa233d3;});}return null;};}function removeEntity(_0xade15f,_0x5f1c54){return function(_0x1eda1b){if(_0x1eda1b){return _0x1eda1b[_0x22c4('0x35')]()[_0x22c4('0x20')](function(){_0xade15f['status'](0xcc)[_0x22c4('0x36')]();});}};}function handleEntityNotFound(_0x5291ba,_0xf1e234){return function(_0x2dc847){if(!_0x2dc847){_0x5291ba[_0x22c4('0x2c')](0x194);}return _0x2dc847;};}function handleError(_0x2986b1,_0x22b1d6){_0x22b1d6=_0x22b1d6||0x1f4;return function(_0x3697de){logger[_0x22c4('0x27')](_0x3697de[_0x22c4('0x37')]);if(_0x3697de['name']){delete _0x3697de['name'];}_0x2986b1['status'](_0x22b1d6)['send'](_0x3697de);};}function getInteractionUsers(_0x1c03a5,_0x201858){return new BPromise(function(_0x26cc81,_0x459ac9){try{if(_0x201858[_0x1c03a5['id']]){_0x1c03a5[_0x22c4('0x38')]=_[_0x22c4('0x39')](_0x201858[_0x1c03a5['id']],function(_0x1060ba){return{'id':_0x1060ba['id'],'fullname':_0x1060ba[_0x22c4('0x3a')]};});}}catch(_0x531f7){_0x459ac9(_0x531f7);}_0x26cc81(_0x1c03a5);});}function getInteractionTags(_0x27743e,_0x5e231f){return new BPromise(function(_0x28de32,_0x2b3b2e){try{if(_0x27743e[_0x22c4('0x3b')]){_0x27743e[_0x22c4('0x3c')]=[];_0x27743e[_0x22c4('0x3b')]['split'](',')[_0x22c4('0x3d')](function(_0x1f7dfd){_0x27743e['Tags'][_0x22c4('0x3e')](_0x5e231f[_0x1f7dfd]);});}delete _0x27743e[_0x22c4('0x3b')];}catch(_0x31b556){_0x2b3b2e(_0x31b556);}_0x28de32(_0x27743e);});}function updateChatInteraction(_0x359fa4,_0x4127c2,_0x2afde7){return new BPromise(function(_0x33fafe,_0x4e20a4){return getInteractionUsers(_0x359fa4,_0x2afde7)[_0x22c4('0x20')](function(_0x3ae56b){return getInteractionTags(_0x3ae56b,_0x4127c2);})[_0x22c4('0x20')](function(_0x5a99f2){_0x33fafe(_0x5a99f2);})[_0x22c4('0x2b')](function(_0x230680){_0x4e20a4(_0x230680);});});}exports['index']=function(_0x3e3946,_0xfe947e){var _0x463665={},_0x519425={},_0x677179={'count':0x0,'rows':[]};var _0x41b440=_[_0x22c4('0x39')](db['ChatInteraction'][_0x22c4('0x3f')],function(_0x5bf7fd){return{'name':_0x5bf7fd[_0x22c4('0x40')],'type':_0x5bf7fd[_0x22c4('0x41')]['key']};});_0x519425['model']=_[_0x22c4('0x39')](_0x41b440,_0x22c4('0x42'));_0x519425[_0x22c4('0x43')]=_['keys'](_0x3e3946['query']);_0x519425[_0x22c4('0x44')]=_['intersection'](_0x519425[_0x22c4('0x45')],_0x519425[_0x22c4('0x43')]);_0x463665['attributes']=_[_0x22c4('0x46')](_0x519425['model'],qs[_0x22c4('0x47')](_0x3e3946[_0x22c4('0x43')][_0x22c4('0x47')]));_0x463665[_0x22c4('0x48')]=_0x463665['attributes'][_0x22c4('0x49')]?_0x463665[_0x22c4('0x48')]:_0x519425[_0x22c4('0x45')];if(!_0x3e3946[_0x22c4('0x43')][_0x22c4('0x4a')](_0x22c4('0x4b'))){_0x463665[_0x22c4('0x4c')]=qs[_0x22c4('0x4c')](_0x3e3946['query'][_0x22c4('0x4c')]);_0x463665[_0x22c4('0x2f')]=qs[_0x22c4('0x2f')](_0x3e3946[_0x22c4('0x43')]['offset']);}_0x463665[_0x22c4('0x4d')]=qs['sort'](_0x3e3946[_0x22c4('0x43')][_0x22c4('0x4e')]);_0x463665[_0x22c4('0x4f')]=qs[_0x22c4('0x44')](_['pick'](_0x3e3946[_0x22c4('0x43')],_0x519425[_0x22c4('0x44')]),_0x41b440);var _0x39fbfa=[];var _0x314e9b=squel[_0x22c4('0x50')]()['field']('id')[_0x22c4('0x51')](_0x22c4('0x42'))['field'](_0x22c4('0x52'))['from'](_0x22c4('0x53'));var _0x4bbaf6=squel[_0x22c4('0x50')]()['field'](_0x22c4('0x54'))[_0x22c4('0x51')](_0x22c4('0x55'))[_0x22c4('0x51')](_0x22c4('0x56'))['from'](_0x22c4('0x57'),'ui')['left_join']('users','u',_0x22c4('0x58'));var _0x59474a=squel[_0x22c4('0x50')]()[_0x22c4('0x59')](_0x22c4('0x5a'),'i')[_0x22c4('0x5b')](_0x22c4('0x5c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x22c4('0x5b')]('users','o','o.id\x20=\x20i.UserId')[_0x22c4('0x5b')](_0x22c4('0x5d'),'a',_0x22c4('0x5e'))['left_join'](_0x22c4('0x5f'),'me',_0x22c4('0x60'))[_0x22c4('0x5b')](_0x22c4('0x61'),'it',_0x22c4('0x62'))[_0x22c4('0x5b')](_0x22c4('0x53'),'t',_0x22c4('0x63'));var _0x1f5d5d=squel[_0x22c4('0x64')]();var _0x279ffa=[];var _0x8ad43a=squel[_0x22c4('0x64')]();var _0x4a0166;if(_0x3e3946[_0x22c4('0x43')][_0x22c4('0x65')]){_0x4a0166=as[_0x22c4('0x66')](_0x3e3946[_0x22c4('0x43')][_0x22c4('0x65')]);var _0x43ebb4=_0x4a0166[_0x22c4('0x67')];for(var _0x59c601=0x0;_0x59c601<_0x4a0166[_0x22c4('0x68')][_0x22c4('0x49')];_0x59c601++){var _0x41f3fd=_0x4a0166[_0x22c4('0x68')][_0x59c601];var _0x151ab3='i';var _0x20e889=_[_0x22c4('0x69')](_0x41b440,[_0x22c4('0x42'),_0x41f3fd[_0x22c4('0x51')]]);if(!_0x20e889){switch(_0x41f3fd[_0x22c4('0x51')]){case _0x22c4('0x6a'):if(_0x41f3fd[_0x22c4('0x6b')]==0x1){_0x59474a[_0x22c4('0x6c')]('`'+_0x41f3fd['field']+_0x22c4('0x6d'));}else{_0x59474a[_0x22c4('0x6c')]('`'+_0x41f3fd[_0x22c4('0x51')]+_0x22c4('0x6e'));}break;case _0x22c4('0x6f'):if(_0x41f3fd['operator']===_0x22c4('0x70')){if(_0x41f3fd['value']['split']('\x20')[_0x22c4('0x49')]>0x1){_0x1f5d5d[_0x43ebb4](_0x22c4('0x71'),qs[_0x22c4('0x72')](_0x41f3fd[_0x22c4('0x6b')]),null);}else{var _0x543b8d='%'+_0x41f3fd['value']+'%';_0x1f5d5d[_0x43ebb4](_0x22c4('0x73'),_0x543b8d,_0x543b8d,_0x543b8d);}}else{_0x20e889=_[_0x22c4('0x69')](_0x41b440,[_0x22c4('0x42'),'ContactId']);_0x41f3fd[_0x22c4('0x51')]=_0x22c4('0x74');_0x1463bf=as['buildExpression'](_0x151ab3,_0x20e889[_0x22c4('0x41')],_0x41f3fd);_0x1f5d5d[_0x43ebb4](_0x1463bf[_0x22c4('0x75')],_0x1463bf[_0x22c4('0x6b')][_0x22c4('0x76')],_0x1463bf[_0x22c4('0x6b')]['end']);}break;case _0x22c4('0x77'):var _0x461b60=_0x41f3fd[_0x22c4('0x6b')][_0x22c4('0x78')](',')['map'](function(_0xcdf86f){return Number(_0xcdf86f);});_0x461b60[_0x22c4('0x3d')](function(_0x219b3b){_0x8ad43a['or'](_0x22c4('0x79'),'%,'+_0x219b3b+',%');});_0x279ffa=_['union'](_0x279ffa,_0x461b60);break;case _0x22c4('0x7a'):if(_0x41f3fd['operator']===_0x22c4('0x70')){_0x1f5d5d[_0x43ebb4](_0x22c4('0x7b'),'%'+_0x41f3fd[_0x22c4('0x6b')]+'%',null);}else{_0x20e889=_[_0x22c4('0x69')](_0x41b440,[_0x22c4('0x42'),_0x22c4('0x7c')]);_0x41f3fd[_0x22c4('0x51')]=_0x22c4('0x7c');_0x1463bf=as[_0x22c4('0x7d')](_0x151ab3,_0x20e889[_0x22c4('0x41')],_0x41f3fd);_0x1f5d5d[_0x43ebb4](_0x1463bf['text'],_0x1463bf[_0x22c4('0x6b')][_0x22c4('0x76')],_0x1463bf['value'][_0x22c4('0x36')]);}break;case _0x22c4('0x7e'):_0x1463bf=as[_0x22c4('0x7d')]('me',null,_0x41f3fd);_0x1f5d5d[_0x43ebb4](_0x1463bf['text'],_0x1463bf['value']['start'],_0x1463bf[_0x22c4('0x6b')]['end']);break;}}else{var _0x1463bf=as[_0x22c4('0x7d')](_0x151ab3,_0x20e889[_0x22c4('0x41')],_0x41f3fd);_0x1f5d5d[_0x43ebb4](_0x1463bf['text'],_0x1463bf['value']['start'],_0x1463bf[_0x22c4('0x6b')][_0x22c4('0x36')]);}}}else{var _0x212748=_(_0x3e3946[_0x22c4('0x43')])['keys']()[_0x22c4('0x39')](function(_0x4aa2d7){return _[_0x22c4('0x7f')](_0x41b440,[_0x22c4('0x42'),_0x4aa2d7])?_0x4aa2d7:undefined;})['compact']()[_0x22c4('0x6b')]();if(!_[_0x22c4('0x80')](_0x212748)){_0x212748[_0x22c4('0x3d')](function(_0x3a4f32){if(_0x3a4f32===_0x22c4('0x81')){_0x59474a['where'](_0x22c4('0x82'),[][_0x22c4('0x83')](_0x3e3946[_0x22c4('0x43')][_0x3a4f32]));}else if(_0x3a4f32===_0x22c4('0x84')){var _0x576c96=JSON['parse'](_0x3e3946[_0x22c4('0x43')][_0x3a4f32])[_0x22c4('0x85')];var _0xf0662b=JSON['parse'](_0x3e3946[_0x22c4('0x43')][_0x3a4f32])['$lte'];_0x59474a['where'](_0x22c4('0x86'),_0x576c96,_0xf0662b);}else{if(_0x3e3946['query'][_0x3a4f32]==='null'){_0x59474a[_0x22c4('0x4f')]('i.'+_0x3a4f32+_0x22c4('0x87'));}else{_0x59474a[_0x22c4('0x4f')]('i.'+_0x3a4f32+_0x22c4('0x88'),_0x3e3946[_0x22c4('0x43')][_0x3a4f32]);}}});}if(_0x3e3946[_0x22c4('0x43')][_0x22c4('0x89')]){if(_0x3e3946['query'][_0x22c4('0x89')]==0x1){_0x59474a[_0x22c4('0x6c')](_0x22c4('0x8a'));}else{_0x59474a[_0x22c4('0x6c')](_0x22c4('0x8b'));}}if(_0x3e3946[_0x22c4('0x43')][_0x22c4('0x8c')]){_0x279ffa=_[_0x22c4('0x8d')](_0x3e3946[_0x22c4('0x43')][_0x22c4('0x8c')])?_0x3e3946['query'][_0x22c4('0x8c')]:new Array(_0x3e3946[_0x22c4('0x43')]['tag']);_0x279ffa[_0x22c4('0x3d')](function(_0x25ccf9){_0x8ad43a['or'](_0x22c4('0x79'),'%,'+_0x25ccf9+',%');});}if(_0x3e3946[_0x22c4('0x43')][_0x22c4('0x8e')]){var _0x39c13a=_0x3e3946[_0x22c4('0x43')][_0x22c4('0x8e')][_0x22c4('0x8f')]('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x22c4('0x90')](_0x39c13a)){_0x1f5d5d['or'](_0x22c4('0x91'),_0x39c13a+'%');}else{_0x1f5d5d['or'](_0x22c4('0x92'),qs[_0x22c4('0x72')](_0x39c13a))['or'](_0x22c4('0x93'),_0x39c13a+'%');}}}_0x59474a[_0x22c4('0x4f')](_0x1f5d5d);_0x59474a[_0x22c4('0x94')](_0x22c4('0x95'));var _0x11dd7b={'type':db['Sequelize'][_0x22c4('0x96')][_0x22c4('0x97')],'raw':!![]};var _0x5d88ec=_0x59474a[_0x22c4('0x98')]();_0x5d88ec[_0x22c4('0x51')](_0x22c4('0x95'));_0x5d88ec[_0x22c4('0x51')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x22c4('0x6a'));if(_0x463665[_0x22c4('0x4d')]){_0x463665['order']['forEach'](function(_0x540cb1){_0x59474a[_0x22c4('0x4d')]('i.'+_0x540cb1[0x0],_0x540cb1[0x1]===_0x22c4('0x99')?![]:!![]);});}if(!_[_0x22c4('0x80')](_0x279ffa)){_0x59474a[_0x22c4('0x6c')](_0x8ad43a);_0x5d88ec[_0x22c4('0x4f')](_0x22c4('0x9a'),_0x279ffa);}BPromise[_0x22c4('0x9b')]()[_0x22c4('0x20')](function(){if(!_0x4a0166){if(_0x3e3946['query'][_0x22c4('0x81')]||_0x3e3946['query'][_0x22c4('0x9c')])return;_0x5d88ec['where'](_0x22c4('0x9d'));_0x59474a[_0x22c4('0x4f')](_0x22c4('0x9d'));return;}return _0x3e3946['user']['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x22c4('0x20')](function(_0x288eeb){if(_['isEmpty'](_0x288eeb)){_0x5d88ec['where'](_0x22c4('0x9e'));_0x59474a[_0x22c4('0x4f')](_0x22c4('0x9e'));}else{_0x5d88ec[_0x22c4('0x4f')](_0x22c4('0x82'),_[_0x22c4('0x39')](_0x288eeb,'id'));_0x59474a[_0x22c4('0x4f')](_0x22c4('0x82'),_[_0x22c4('0x39')](_0x288eeb,'id'));}});})[_0x22c4('0x20')](function(){db[_0x22c4('0x9f')][_0x22c4('0x43')](_0x5d88ec['toString'](),_0x11dd7b)['then'](function(_0x2df813){_0x677179[_0x22c4('0x2e')]=_0x2df813[_0x22c4('0x49')];if(_0x677179[_0x22c4('0x2e')]===0x0)return[];return db[_0x22c4('0x9f')]['query'](_0x314e9b[_0x22c4('0xa0')](),_0x11dd7b)['then'](function(_0x226b39){_0x39fbfa=_[_0x22c4('0xa1')](_0x226b39,'id');_0x11dd7b=_[_0x22c4('0xa2')](_0x11dd7b,{'model':db[_0x22c4('0xa3')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3e3946['query'][_0x22c4('0x47')]){_0x463665[_0x22c4('0x48')][_0x22c4('0x3d')](function(_0x1b1729){_0x59474a[_0x22c4('0x51')]('i.'+_0x1b1729);});}else{_0x59474a['field'](_0x22c4('0xa4'),_0x22c4('0x6a'));_0x59474a[_0x22c4('0x51')](_0x22c4('0xa5'),_0x22c4('0xa6'));_0x59474a['field'](_0x22c4('0xa7'),_0x22c4('0xa8'));_0x59474a[_0x22c4('0x51')](_0x22c4('0xa9'));_0x59474a[_0x22c4('0x51')](_0x22c4('0xaa'),'Contact.firstName');_0x59474a[_0x22c4('0x51')](_0x22c4('0xab'),_0x22c4('0xac'));_0x59474a[_0x22c4('0x51')]('c.email',_0x22c4('0xad'));_0x59474a[_0x22c4('0x51')](_0x22c4('0xae'),_0x22c4('0xaf'));_0x59474a[_0x22c4('0x51')](_0x22c4('0xb0'),_0x22c4('0xb1'));_0x59474a[_0x22c4('0x51')](_0x22c4('0xb2'),_0x22c4('0xb3'));_0x59474a['field'](_0x22c4('0xb4'),_0x22c4('0xb5'));_0x59474a[_0x22c4('0x51')]('o.internal',_0x22c4('0xb6'));_0x59474a['field'](_0x22c4('0xb7'),_0x22c4('0x3b'));}if(_0x463665[_0x22c4('0x4c')])_0x59474a[_0x22c4('0x4c')](_0x463665[_0x22c4('0x4c')]);if(_0x463665[_0x22c4('0x2f')])_0x59474a[_0x22c4('0x2f')](_0x463665[_0x22c4('0x2f')]);return db[_0x22c4('0x9f')][_0x22c4('0x43')](_0x59474a[_0x22c4('0xa0')](),_0x11dd7b);})['then'](function(_0x34c355){_0x4bbaf6[_0x22c4('0x4f')]('ui.ChatInteractionId\x20IN\x20?',_['map'](_0x34c355,'id'));return db[_0x22c4('0x9f')][_0x22c4('0x43')](_0x4bbaf6[_0x22c4('0xa0')](),_0x11dd7b)[_0x22c4('0x20')](function(_0x372c3a){var _0x47f1ef=_['groupBy'](_0x372c3a,_0x22c4('0xb8'));var _0xee2a72=[];_0x34c355[_0x22c4('0x3d')](function(_0x59568f){_0xee2a72[_0x22c4('0x3e')](updateChatInteraction(_0x59568f,_0x39fbfa,_0x47f1ef));});return BPromise[_0x22c4('0xb9')](_0xee2a72);});});})[_0x22c4('0x20')](function(_0x17ce41){_0x677179[_0x22c4('0xba')]=_0x17ce41;return _0x677179;})[_0x22c4('0x20')](respondWithFilteredResult(_0xfe947e,_0x463665));})[_0x22c4('0x2b')](handleError(_0xfe947e,null));};exports[_0x22c4('0xbb')]=function(_0x3aa660,_0x31f5dd){var _0x13f5eb={'raw':![],'where':{'id':_0x3aa660[_0x22c4('0xbc')]['id']}},_0x2f7be5={};_0x2f7be5[_0x22c4('0x45')]=_[_0x22c4('0xbd')](db[_0x22c4('0xa3')]['rawAttributes']);_0x2f7be5[_0x22c4('0x43')]=_[_0x22c4('0xbd')](_0x3aa660[_0x22c4('0x43')]);_0x2f7be5[_0x22c4('0xbe')]=_[_0x22c4('0x46')](_0x2f7be5[_0x22c4('0x45')],_0x2f7be5[_0x22c4('0x43')]);_0x13f5eb[_0x22c4('0x48')]=_['intersection'](_0x2f7be5[_0x22c4('0x45')],qs['fields'](_0x3aa660[_0x22c4('0x43')][_0x22c4('0x47')]));_0x13f5eb[_0x22c4('0x48')]=_0x13f5eb[_0x22c4('0x48')][_0x22c4('0x49')]?_0x13f5eb[_0x22c4('0x48')]:_0x2f7be5[_0x22c4('0x45')];if(_0x3aa660[_0x22c4('0x43')]['includeAll']){_0x13f5eb[_0x22c4('0xbf')]=[{'all':!![]}];}_0x13f5eb=_[_0x22c4('0xa2')]({},_0x13f5eb,_0x3aa660[_0x22c4('0xc0')]);return db['ChatInteraction'][_0x22c4('0x69')](_0x13f5eb)['then'](handleEntityNotFound(_0x31f5dd,null))[_0x22c4('0x20')](respondWithResult(_0x31f5dd,null))[_0x22c4('0x2b')](handleError(_0x31f5dd,null));};exports[_0x22c4('0xc1')]=function(_0x228287,_0x564f75){return db[_0x22c4('0xa3')][_0x22c4('0xc1')](_0x228287[_0x22c4('0x7e')],{})[_0x22c4('0x20')](respondWithResult(_0x564f75,0xc9))['catch'](handleError(_0x564f75,null));};exports[_0x22c4('0x34')]=function(_0x5380a1,_0xda5317){if(_0x5380a1[_0x22c4('0x7e')]['id']){delete _0x5380a1[_0x22c4('0x7e')]['id'];}return db[_0x22c4('0xa3')][_0x22c4('0x69')]({'where':{'id':_0x5380a1['params']['id']}})[_0x22c4('0x20')](handleEntityNotFound(_0xda5317,null))[_0x22c4('0x20')](saveUpdates(_0x5380a1['body'],null))[_0x22c4('0x20')](respondWithResult(_0xda5317,null))['catch'](handleError(_0xda5317,null));};exports['destroy']=function(_0x2c6cd3,_0x5ae4b0){return db[_0x22c4('0xa3')][_0x22c4('0x69')]({'where':{'id':_0x2c6cd3[_0x22c4('0xbc')]['id']}})['then'](handleEntityNotFound(_0x5ae4b0,null))[_0x22c4('0x20')](removeEntity(_0x5ae4b0,null))[_0x22c4('0x2b')](handleError(_0x5ae4b0,null));};exports[_0x22c4('0xc2')]=function(_0x311941,_0x31d12e){return db[_0x22c4('0xa3')][_0x22c4('0xc2')]()[_0x22c4('0x20')](respondWithResult(_0x31d12e,null))[_0x22c4('0x2b')](handleError(_0x31d12e,null));};exports[_0x22c4('0xc3')]=function(_0x4d5d10,_0x348029){var _0x21144e=_0x4d5d10[_0x22c4('0xbc')]['id'];var _0x481504;var _0x422a81;var _0x36861f;return db[_0x22c4('0xa3')][_0x22c4('0xc4')]({'where':{'id':_0x21144e}})['then'](function(_0x3c83a8){_0x481504=_0x3c83a8;return db[_0x22c4('0xc5')]['findOne']({'where':{'id':_0x3c83a8[_0x22c4('0x81')]},'attributes':['id',_0x22c4('0xc6'),_0x22c4('0xc7')],'raw':!![]});})['then'](function(_0x2729b0){if(_0x2729b0&&_0x2729b0['vidaooApiKey']&&_0x2729b0[_0x22c4('0xc7')]){_0x422a81=_0x2729b0;var _0x136631={'rejectUnauthorized':![],'method':_0x22c4('0xc8'),'uri':_0x22c4('0xc9'),'headers':{'X-APIKEY':_0x2729b0[_0x22c4('0xc6')]},'body':{'name':_0x22c4('0xca')+_0x21144e},'redirect':'follow','json':!![]};return rp(_0x136631);}else{throw new db['Sequelize'][(_0x22c4('0xcb'))](_0x22c4('0xcc'));}})[_0x22c4('0x20')](function(_0x332005){_0x36861f=_0x332005;if(_0x36861f['id']){var _0xe39759={'body':_0x36861f[_0x22c4('0xcd')],'ChatWebsiteId':_0x422a81['id'],'ChatInteractionId':_0x481504['id'],'direction':'out','UserId':_0x4d5d10[_0x22c4('0xce')]['id']};return db[_0x22c4('0xcf')][_0x22c4('0xc1')](_0xe39759,{});}else{throw new db[(_0x22c4('0xd0'))][(_0x22c4('0xcb'))](_0x22c4('0xd1'));}})[_0x22c4('0x20')](function(){return _0x481504[_0x22c4('0xd2')]({'vidaooSessionId':_0x36861f['id']});})[_0x22c4('0x20')](respondWithResult(_0x348029,null))[_0x22c4('0x2b')](handleError(_0x348029,null));};exports[_0x22c4('0xd3')]=function(_0x42c2f6,_0x430373){if(_0x42c2f6[_0x22c4('0x7e')]['id']){delete _0x42c2f6[_0x22c4('0x7e')]['id'];}return db[_0x22c4('0xa3')][_0x22c4('0x69')]({'where':{'id':_0x42c2f6[_0x22c4('0xbc')]['id']}})['then'](handleEntityNotFound(_0x430373,null))[_0x22c4('0x20')](saveUpdates(_0x42c2f6[_0x22c4('0x7e')],null))[_0x22c4('0x20')](respondWithResult(_0x430373,null))[_0x22c4('0x2b')](handleError(_0x430373,null));};exports[_0x22c4('0xd4')]=function(_0x9959f,_0xb71b5,_0x5aaa58){if(_0x9959f[_0x22c4('0x7e')]['id']){delete _0x9959f['body']['id'];}return db[_0x22c4('0xa3')][_0x22c4('0x69')]({'where':{'id':_0x9959f[_0x22c4('0xbc')]['id']}})[_0x22c4('0x20')](function(_0x3d7538){if(!_0x3d7538){logger[_0x22c4('0x27')](_0x22c4('0xd5'),'abandon',0x194,_0x22c4('0xd6'));_0xb71b5[_0x22c4('0x2c')](0x194);}else{if(_0x3d7538[_0x22c4('0x7c')]){throw new db[(_0x22c4('0xd0'))][(_0x22c4('0xcb'))](_0x22c4('0xd7'));}}return _0x3d7538;})[_0x22c4('0x20')](function(_0x56508b){if(_0x56508b){return _0x56508b[_0x22c4('0x34')]({'closed':_0x9959f[_0x22c4('0x7e')][_0x22c4('0xd8')],'disposition':_0x9959f[_0x22c4('0x7e')][_0x22c4('0xd9')]})[_0x22c4('0x20')](function(_0x542d7a){return _0x542d7a;});}})['then'](function(_0x21bc13){return respondWithRpcPromise(_0x22c4('0xda'),'abandon',_0x9959f[_0x22c4('0x7e')],client9004);})[_0x22c4('0x20')](respondWithResult(_0xb71b5,null))[_0x22c4('0x2b')](handleError(_0xb71b5,null));};exports[_0x22c4('0xdb')]=function(_0x16b246,_0x6e473c,_0x3c048e){_0x16b246[_0x22c4('0x7e')][_0x22c4('0x42')]=_0x16b246[_0x22c4('0xdc')][_0x22c4('0xdd')];_0x16b246['body']['basename']=_0x16b246['file'][_0x22c4('0xde')];_0x16b246[_0x22c4('0x7e')][_0x22c4('0x41')]=_0x16b246[_0x22c4('0xdc')][_0x22c4('0xdf')];return db['Attachment'][_0x22c4('0xc1')](_0x16b246[_0x22c4('0x7e')])['then'](respondWithResult(_0x6e473c,0xc9))[_0x22c4('0x2b')](handleError(_0x6e473c,null));};exports[_0x22c4('0xe0')]=function(_0x4ee3ee,_0x1c6f70,_0x21371d){return db[_0x22c4('0xa3')][_0x22c4('0xc4')]({'where':{'id':_0x4ee3ee['params']['id']},'raw':!![]})[_0x22c4('0x20')](handleEntityNotFound(_0x1c6f70,null))[_0x22c4('0x20')](function(_0x4a7f26){if(_0x4a7f26){if(_0x4a7f26[_0x22c4('0xd8')]){return _0x1c6f70['status'](0x193)[_0x22c4('0xe1')]({'status':0x193,'message':_0x22c4('0xe2')});}return db[_0x22c4('0xe3')][_0x22c4('0xc4')]({'where':{'id':_0x4ee3ee[_0x22c4('0x43')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x1c6f70,null));}})[_0x22c4('0x20')](function(_0x3a1f64){if(_0x3a1f64){return _0x1c6f70[_0x22c4('0xe4')](path[_0x22c4('0xe5')](config[_0x22c4('0xe6')],_0x22c4('0xe7'),_0x3a1f64[_0x22c4('0xe8')]));}})['catch'](handleError(_0x1c6f70,null));};exports[_0x22c4('0xe9')]=function(_0x51370a,_0x383f4b){var _0x3d3632=null;var _0x3c772c=null;var _0x2de548=null;var _0x2f6f87=null;if(_0x51370a[_0x22c4('0x7e')]['id']){delete _0x51370a[_0x22c4('0x7e')]['id'];}if(_0x51370a[_0x22c4('0x7e')][_0x22c4('0xea')]){_0x2f6f87=path[_0x22c4('0xe5')](config['root'],_0x22c4('0xeb'),util['format'](_0x22c4('0xec'),Date[_0x22c4('0xed')]()));_0x51370a[_0x22c4('0x7e')][_0x22c4('0xee')]=_0x2f6f87;}return db[_0x22c4('0xa3')][_0x22c4('0x69')]({'where':{'id':_0x51370a['params']['id']},'include':[{'model':db[_0x22c4('0xcf')],'as':_0x22c4('0xef'),'include':[{'model':db['User'],'as':_0x22c4('0x7a')}]}]})['then'](handleEntityNotFound(_0x383f4b,null))['then'](saveUpdates(_0x51370a[_0x22c4('0x7e')],null))['then'](function(_0x1e8e6a){if(_0x1e8e6a){_0x3d3632=_0x1e8e6a;return db[_0x22c4('0xc5')][_0x22c4('0x69')]({'where':{'id':_0x3d3632['ChatWebsiteId']}});}})['then'](function(_0x4c8dc8){if(_0x4c8dc8){_0x2de548=_0x4c8dc8;return db[_0x22c4('0xf0')][_0x22c4('0x69')]({'where':{'id':_0x3d3632['ContactId']}});}})[_0x22c4('0x20')](function(_0x30f656){if(_0x30f656){_0x3c772c=_0x30f656;if(_0x2f6f87){var _0x26ab96=null;for(var _0x5b1b92=0x1;_0x5b1b92<_0x3d3632[_0x22c4('0xef')]['length'];++_0x5b1b92){_0x26ab96=_0x3d3632['Messages'][_0x5b1b92];var _0x5137e1=_0x26ab96['UserId']?util[_0x22c4('0xf1')]('%s%d',_0x2de548[_0x22c4('0xf2')],_0x26ab96[_0x22c4('0x7c')]):'System';var _0x5df466=_0x51370a['body'][_0x22c4('0xf3')]||util['format'](_0x22c4('0xf4'),_0x22c4('0xf5'),_0x26ab96[_0x22c4('0x74')]);switch(_0x2de548[_0x22c4('0xf6')]){case _0x22c4('0xf7'):_0x5137e1=_0x26ab96[_0x22c4('0x7c')]?util[_0x22c4('0xf1')](_0x22c4('0xf4'),_0x2de548[_0x22c4('0xf2')],_0x26ab96[_0x22c4('0x7c')]):_0x22c4('0xf8');break;case _0x22c4('0xf9'):_0x5137e1=_0x26ab96[_0x22c4('0x7c')]?_0x26ab96[_0x22c4('0x7a')]['alias']||_0x26ab96[_0x22c4('0x7a')][_0x22c4('0x3a')]:_0x22c4('0xf8');break;case _0x22c4('0xfa'):_0x5137e1=_0x26ab96['UserId']?_0x26ab96[_0x22c4('0x7a')][_0x22c4('0x3a')]:_0x22c4('0xf8');break;default:_0x5137e1=_0x26ab96[_0x22c4('0x7c')]?util[_0x22c4('0xf1')]('%s%d',_0x2de548[_0x22c4('0xf2')],_0x26ab96[_0x22c4('0x7c')]):_0x22c4('0xf8');}var _0x42aa03=util[_0x22c4('0xf1')]('[%s]\x20%s:\x20%s\x0a',moment(_0x26ab96[_0x22c4('0x84')])[_0x22c4('0xf1')](_0x22c4('0xfb')),_0x26ab96['direction']==='in'?_0x5df466:_0x5137e1,_0x26ab96[_0x22c4('0x7e')]);if(!_0x26ab96[_0x22c4('0xfc')]){fs[_0x22c4('0xfd')](_0x2f6f87,_0x42aa03);}}return db[_0x22c4('0xfe')][_0x22c4('0xc4')]({'where':{'service':!![]},'include':[{'model':db[_0x22c4('0xff')],'as':'Smtp','raw':!![]}]});}}})[_0x22c4('0x20')](function(_0x3e7c7f){if(_0x3e7c7f&&_0x3e7c7f['Smtp']&&_0x51370a['body']){var _0x1baa95={'tls':{'rejectUnauthorized':![]}};if(_0x3e7c7f[_0x22c4('0x100')][_0x22c4('0x101')]){_0x1baa95[_0x22c4('0x101')]=_0x3e7c7f[_0x22c4('0x100')][_0x22c4('0x101')];}else{_0x1baa95[_0x22c4('0x102')]=_0x3e7c7f[_0x22c4('0x100')][_0x22c4('0x102')];_0x1baa95[_0x22c4('0x103')]=_0x3e7c7f[_0x22c4('0x100')][_0x22c4('0x103')];_0x1baa95['secure']=_0x3e7c7f['Smtp'][_0x22c4('0x104')];}if(_0x3e7c7f[_0x22c4('0x100')]['authentication']){_0x1baa95['auth']={'user':_0x3e7c7f[_0x22c4('0x100')]['user'],'pass':_0x3e7c7f[_0x22c4('0x100')][_0x22c4('0x105')]};}return respondWithRpcPromise(_0x22c4('0x106'),'sendMail',{'account':_0x1baa95,'message':{'from':util[_0x22c4('0xf1')](_0x22c4('0x107'),_0x3e7c7f['name'],_0x3e7c7f[_0x22c4('0x108')]||_0x3e7c7f[_0x22c4('0x100')][_0x22c4('0xce')]),'to':_0x51370a[_0x22c4('0x7e')][_0x22c4('0xea')],'subject':_0x22c4('0x109'),'text':util[_0x22c4('0xf1')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x51370a[_0x22c4('0x7e')]['mailTranscript']),'attachments':[{'path':_0x2f6f87}]}})[_0x22c4('0x20')](function(){return _0x3d3632;})[_0x22c4('0x2b')](function(_0x4295c4){console[_0x22c4('0x27')](_0x4295c4);});}else{return _0x3d3632;}})[_0x22c4('0x20')](respondWithStatusCode(_0x383f4b,0xc8))[_0x22c4('0x2b')](handleError(_0x383f4b,null));};exports[_0x22c4('0x10a')]=function(_0x47b797,_0x30a425,_0x4664e8){return db['ChatMessage'][_0x22c4('0x69')]({'where':{'id':_0x47b797[_0x22c4('0xbc')]['id']}})[_0x22c4('0x20')](handleEntityNotFound(_0x30a425,null))[_0x22c4('0x20')](function(_0x20c70f){if(_0x20c70f){return _0x20c70f[_0x22c4('0x10a')](_0x47b797[_0x22c4('0x7e')]['ids'],_[_0x22c4('0x10b')](_0x47b797[_0x22c4('0x7e')],[_0x22c4('0x10c'),'id'])||{});}})['then'](respondWithResult(_0x30a425,null))[_0x22c4('0x2b')](handleError(_0x30a425,null));};exports[_0x22c4('0x10d')]=function(_0x7211c6,_0x2056c0,_0x325a31){var _0x48eae6={'raw':![],'where':{}};var _0x2b1b9b={};var _0xb3d9a4={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x22c4('0xc4')]({'where':{'id':_0x7211c6[_0x22c4('0xbc')]['id']}})['then'](handleEntityNotFound(_0x2056c0,null))[_0x22c4('0x20')](function(_0x2a64c3){if(_0x2a64c3){_0x2b1b9b[_0x22c4('0x45')]=_[_0x22c4('0xbd')](db['ChatMessage'][_0x22c4('0x3f')]);_0x2b1b9b[_0x22c4('0x43')]=_[_0x22c4('0xbd')](_0x7211c6[_0x22c4('0x43')]);_0x2b1b9b[_0x22c4('0x44')]=_[_0x22c4('0x46')](_0x2b1b9b['model'],_0x2b1b9b[_0x22c4('0x43')]);_0x48eae6[_0x22c4('0x48')]=_['intersection'](_0x2b1b9b[_0x22c4('0x45')],qs[_0x22c4('0x47')](_0x7211c6[_0x22c4('0x43')]['fields']));_0x48eae6[_0x22c4('0x48')]=_0x48eae6['attributes'][_0x22c4('0x49')]?_0x48eae6['attributes']:_0x2b1b9b['model'];if(!_0x7211c6[_0x22c4('0x43')]['hasOwnProperty'](_0x22c4('0x4b'))){_0x48eae6[_0x22c4('0x4c')]=qs[_0x22c4('0x4c')](_0x7211c6[_0x22c4('0x43')]['limit']);_0x48eae6['offset']=qs[_0x22c4('0x2f')](_0x7211c6[_0x22c4('0x43')]['offset']);}_0x48eae6[_0x22c4('0x4d')]=qs['sort'](_0x7211c6[_0x22c4('0x43')][_0x22c4('0x4e')]);_0x48eae6[_0x22c4('0x4f')]=qs[_0x22c4('0x44')](_[_0x22c4('0x10e')](_0x7211c6[_0x22c4('0x43')],_0x2b1b9b[_0x22c4('0x44')]));_0x48eae6[_0x22c4('0x4f')][_0x22c4('0xb8')]=_0x2a64c3['id'];if(_0x7211c6[_0x22c4('0x43')][_0x22c4('0x8e')]){_0x48eae6[_0x22c4('0x4f')]=_[_0x22c4('0xa2')](_0x48eae6[_0x22c4('0x4f')],{'$or':_[_0x22c4('0x39')](_0x48eae6[_0x22c4('0x48')],function(_0x34bed0){var _0x5e4c4b={};_0x5e4c4b[_0x34bed0]={'$like':'%'+_0x7211c6[_0x22c4('0x43')][_0x22c4('0x8e')]+'%'};return _0x5e4c4b;})});}if(_0x7211c6[_0x22c4('0x43')][_0x22c4('0x85')]){var _0x32b659=_0x7211c6[_0x22c4('0x43')][_0x22c4('0x85')][_0x22c4('0x78')](',');var _0x3ae789={};_0x3ae789[_0x32b659[0x0]]={'$gte':moment(_0x32b659[0x1])['format'](_0x22c4('0x10f'))};_0x48eae6[_0x22c4('0x4f')]=_[_0x22c4('0xa2')](_0x48eae6[_0x22c4('0x4f')],_0x3ae789);}_0x48eae6=_[_0x22c4('0xa2')]({},_0x48eae6,_0x7211c6[_0x22c4('0xc0')]);return db['ChatMessage'][_0x22c4('0x2e')]({'where':_0x48eae6[_0x22c4('0x4f')]})[_0x22c4('0x20')](function(_0x15ac00){_0xb3d9a4[_0x22c4('0x2e')]=_0x15ac00;if(_0x7211c6['query']['includeAll']){_0x48eae6[_0x22c4('0xbf')]=[{'all':!![]}];}return db['ChatMessage'][_0x22c4('0x110')](_0x48eae6);})[_0x22c4('0x20')](function(_0x423358){_0xb3d9a4['rows']=_0x423358;return _0xb3d9a4;});}})['then'](respondWithFilteredResult(_0x2056c0,_0x48eae6))[_0x22c4('0x2b')](handleError(_0x2056c0,null));};exports[_0x22c4('0x111')]=function(_0x2540bd,_0x51896e,_0x4ce49e){var _0x15f6c8={'where':{}},_0x253390={},_0x14c2eb={'count':0x0,'rows':[]};return db[_0x22c4('0xa3')][_0x22c4('0xc4')]({'where':{'id':_0x2540bd[_0x22c4('0xbc')]['id']}})['then'](handleEntityNotFound(_0x51896e,null))[_0x22c4('0x20')](function(_0x5abdc0){if(_0x5abdc0){_0x253390['model']=_[_0x22c4('0xbd')](db[_0x22c4('0xcf')][_0x22c4('0x3f')]);_0x253390[_0x22c4('0x43')]=_[_0x22c4('0xbd')](_0x2540bd[_0x22c4('0x43')]);_0x253390[_0x22c4('0x44')]=_[_0x22c4('0x46')](_0x253390['model'],_0x253390[_0x22c4('0x43')]);_0x15f6c8[_0x22c4('0x48')]=_['intersection'](_0x253390[_0x22c4('0x45')],qs[_0x22c4('0x47')](_0x2540bd[_0x22c4('0x43')][_0x22c4('0x47')]));_0x15f6c8[_0x22c4('0x48')]=_0x15f6c8[_0x22c4('0x48')]['length']?_0x15f6c8[_0x22c4('0x48')]:_0x253390[_0x22c4('0x45')];if(!_0x2540bd[_0x22c4('0x43')][_0x22c4('0x4a')](_0x22c4('0x4b'))){_0x15f6c8[_0x22c4('0x4c')]=qs[_0x22c4('0x4c')](_0x2540bd[_0x22c4('0x43')][_0x22c4('0x4c')]);_0x15f6c8['offset']=qs[_0x22c4('0x2f')](_0x2540bd[_0x22c4('0x43')][_0x22c4('0x2f')]);}_0x15f6c8[_0x22c4('0x4d')]=qs[_0x22c4('0x4e')](_0x2540bd[_0x22c4('0x43')]['sort']);_0x15f6c8[_0x22c4('0x4f')]=qs[_0x22c4('0x44')](_['pick'](_0x2540bd['query'],_0x253390['filters']));_0x15f6c8['where'][_0x22c4('0xb8')]=_0x5abdc0['id'];if(_0x2540bd['query'][_0x22c4('0x8e')]){_0x15f6c8['where']=_[_0x22c4('0xa2')](_0x15f6c8[_0x22c4('0x4f')],{'$or':_[_0x22c4('0x39')](_0x15f6c8[_0x22c4('0x48')],function(_0x583e78){var _0x20aa91={};_0x20aa91[_0x583e78]={'$like':'%'+_0x2540bd[_0x22c4('0x43')][_0x22c4('0x8e')]+'%'};return _0x20aa91;})});}_0x15f6c8[_0x22c4('0x4f')]['secret']=![];if(_0x2540bd[_0x22c4('0x43')]['id']){_0x15f6c8[_0x22c4('0x4f')]['id']={'$gt':_0x2540bd['query']['id']};}_0x15f6c8=_[_0x22c4('0xa2')]({},_0x15f6c8,_0x2540bd[_0x22c4('0xc0')]);return db[_0x22c4('0xcf')][_0x22c4('0x2e')]({'where':_0x15f6c8[_0x22c4('0x4f')]})[_0x22c4('0x20')](function(_0x14003f){_0x14c2eb['count']=_0x14003f;_0x15f6c8['include']=[];if(_0x2540bd['query'][_0x22c4('0x112')]){_0x15f6c8['include']['push']({'model':db[_0x22c4('0x7a')],'as':_0x22c4('0x7a'),'attributes':['id','fullname','alias']});}if(_0x2540bd[_0x22c4('0x43')][_0x22c4('0x113')]){_0x15f6c8[_0x22c4('0xbf')]=[{'all':!![]}];}return db[_0x22c4('0xcf')][_0x22c4('0x110')](_0x15f6c8);})[_0x22c4('0x20')](function(_0x4758f2){_0x14c2eb[_0x22c4('0xba')]=_0x4758f2;return _0x14c2eb;});}})[_0x22c4('0x20')](respondWithFilteredResult(_0x51896e,_0x15f6c8))['catch'](handleError(_0x51896e,null));};exports[_0x22c4('0x114')]=function(_0x59cc89,_0x150d43,_0x478070){return db['ChatInteraction']['find']({'where':{'id':_0x59cc89['params']['id']}})[_0x22c4('0x20')](handleEntityNotFound(_0x150d43,null))[_0x22c4('0x20')](function(_0x16581f){if(_0x16581f){return _0x16581f[_0x22c4('0x115')](_0x59cc89['body'][_0x22c4('0x10c')],_[_0x22c4('0x10b')](_0x59cc89[_0x22c4('0x7e')],['ids','id'])||{})['spread'](function(){return db[_0x22c4('0x77')][_0x22c4('0x110')]({'attributes':['id',_0x22c4('0x42'),_0x22c4('0x52')],'where':{'id':_0x59cc89[_0x22c4('0x7e')][_0x22c4('0x10c')]}});})[_0x22c4('0x20')](function(_0x3c8b39){socket[_0x22c4('0x116')](_0x22c4('0x117'),{'id':Number(_0x59cc89[_0x22c4('0xbc')]['id']),'tags':_0x3c8b39||[]});return{'id':Number(_0x59cc89['params']['id']),'tags':_0x3c8b39||[]};});}})['then'](respondWithResult(_0x150d43,null))[_0x22c4('0x2b')](handleError(_0x150d43,null));};exports[_0x22c4('0x118')]=function(_0x461971,_0x6c9acb,_0x3a8a76){return db[_0x22c4('0xa3')][_0x22c4('0x69')]({'where':{'id':_0x461971[_0x22c4('0xbc')]['id']}})[_0x22c4('0x20')](handleEntityNotFound(_0x6c9acb,null))[_0x22c4('0x20')](function(_0x49dd44){if(_0x49dd44){return _0x49dd44['removeTags'](_0x461971[_0x22c4('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x6c9acb,null))[_0x22c4('0x2b')](handleError(_0x6c9acb,null));};exports[_0x22c4('0xe4')]=function(_0x14a58b,_0x5d35cf){var _0x5854a9=moment()['unix']()[_0x22c4('0xa0')]();var _0x2eb1e2=path[_0x22c4('0xe5')](config[_0x22c4('0xe6')],'server',_0x22c4('0x119'),_0x22c4('0x11a'));var _0x4a366d=path['join'](config[_0x22c4('0xe6')],_0x22c4('0x11b'),_0x22c4('0x119'),'attachments');var _0x32a22f=path[_0x22c4('0xe5')](_0x2eb1e2,_0x5854a9);var _0x5e429d=util[_0x22c4('0xf1')](_0x22c4('0x11c'),_0x14a58b[_0x22c4('0xbc')]['id'],_0x5854a9);var _0x5e8257=path[_0x22c4('0xe5')](_0x2eb1e2,_0x5e429d);var _0x5dc2ef=[];_0x5dc2ef['push']({'model':db['User'],'as':_0x22c4('0x7a'),'attributes':['id','fullname'],'raw':!![]});_0x5dc2ef[_0x22c4('0x3e')]({'model':db['CmContact'],'as':_0x22c4('0x6f'),'attributes':['id',_0x22c4('0x11d'),_0x22c4('0x11e')],'raw':!![]});if(_0x14a58b[_0x22c4('0x43')]['attachments']){_0x5dc2ef['push']({'model':db[_0x22c4('0xe3')],'as':_0x22c4('0xe3'),'raw':!![]});}var _0x4b4419=[{'model':db[_0x22c4('0xcf')],'as':_0x22c4('0xef'),'attributes':['id',_0x22c4('0x7e'),_0x22c4('0x84'),'direction',_0x22c4('0xfc'),_0x22c4('0x89')],'include':_0x5dc2ef}];_0x4b4419[_0x22c4('0x3e')]({'model':db[_0x22c4('0xc5')],'as':_0x22c4('0x11f'),'attributes':['id',_0x22c4('0x42')]});_0x4b4419[_0x22c4('0x3e')]({'model':db[_0x22c4('0x7a')],'as':_0x22c4('0x120'),'attributes':['id',_0x22c4('0x3a')]});return db[_0x22c4('0xa3')]['find']({'where':{'id':_0x14a58b[_0x22c4('0xbc')]['id']},'include':_0x4b4419})['then'](handleEntityNotFound(_0x5d35cf,null))[_0x22c4('0x20')](function(_0x56e6b2){if(_0x56e6b2){var _0x196e8c=_0x56e6b2[_0x22c4('0x121')]({'plain':!![]});fs['mkdirSync'](_0x32a22f);var _0x409601={'format':'A4','border':_0x22c4('0x122'),'header':{'height':_0x22c4('0x123'),'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':'30px','contents':{'default':util[_0x22c4('0xf1')](_0x22c4('0x124'),util[_0x22c4('0xf1')](_0x22c4('0x125'),'Chat',_0x196e8c['id']),moment()[_0x22c4('0xf1')](_0x22c4('0x126'))['toString']())}}};var _0x157974={'channel':_0x22c4('0x127'),'account':_0x196e8c['Account']['name'],'agent':_0x196e8c[_0x22c4('0x120')]?_0x196e8c[_0x22c4('0x120')]['fullname']:_0x22c4('0x128'),'createdAt':moment(_0x196e8c['createdAt'])[_0x22c4('0xf1')](_0x22c4('0x10f'))['toString'](),'closedAt':_0x196e8c[_0x22c4('0xd8')]?moment(_0x196e8c[_0x22c4('0x129')])[_0x22c4('0xf1')]('YYYY-MM-DD\x20HH:mm:ss')[_0x22c4('0xa0')]():'','disposition':_0x196e8c[_0x22c4('0xd9')],'chatInfo':{'browser':_0x196e8c[_0x22c4('0x12a')],'os':_0x196e8c[_0x22c4('0x12b')],'referer':_0x196e8c[_0x22c4('0x12c')],'customerIp':_0x196e8c[_0x22c4('0x12d')],'customerPort':_0x196e8c[_0x22c4('0x12e')]?_0x196e8c[_0x22c4('0x12e')]:'N.A.'},'messages':_(_0x196e8c[_0x22c4('0xef')])['tail']()[_0x22c4('0x8e')]({'secret':![]})['map'](function(_0x3271fe){if(_0x3271fe[_0x22c4('0xe3')]){var _0x2c26af=path[_0x22c4('0xe5')](_0x4a366d,_0x3271fe[_0x22c4('0xe3')]['basename']);if(fs[_0x22c4('0x12f')](_0x2c26af)){fs['createReadStream'](_0x2c26af)[_0x22c4('0x130')](fs[_0x22c4('0x131')](path[_0x22c4('0xe5')](_0x32a22f,_0x3271fe[_0x22c4('0xe3')][_0x22c4('0xe8')])));}}return{'date':moment(_0x3271fe[_0x22c4('0x84')])[_0x22c4('0xf1')]('YYYY-MM-DD\x20HH:mm:ss')[_0x22c4('0xa0')](),'sender':_0x3271fe[_0x22c4('0x132')]===_0x22c4('0x133')?_0x3271fe[_0x22c4('0x7a')]?_0x3271fe[_0x22c4('0x7a')]['fullname']:'System':_0x3271fe[_0x22c4('0x6f')]['firstName']+(_0x3271fe[_0x22c4('0x6f')]['lastName']?'\x20'+_0x3271fe[_0x22c4('0x6f')][_0x22c4('0x11e')]:''),'body':_0x3271fe['Attachment']?_0x3271fe[_0x22c4('0xe3')]['basename']:_0x3271fe[_0x22c4('0x7e')],'direction':_0x3271fe[_0x22c4('0x132')]===_0x22c4('0x133')?'A':'C','secret':_0x3271fe[_0x22c4('0xfc')],'read':_0x3271fe[_0x22c4('0x89')],'attachment':_0x3271fe['Attachment']};})['value']()};return ejs['renderFile'](path[_0x22c4('0xe5')](config[_0x22c4('0xe6')],_0x22c4('0x11b'),_0x22c4('0x134'),_0x22c4('0x135')),{'interaction':_0x157974})['then'](function(_0x95bc5a){return new BPromise(function(_0x347f0e,_0x50729a){pdf[_0x22c4('0xc1')](_0x95bc5a,_0x409601)['toFile'](path[_0x22c4('0xe5')](_0x32a22f,_0x22c4('0x136')+_0x196e8c['id']+'-'+_0x5854a9+_0x22c4('0x137')),function(_0x25124c,_0x495708){if(_0x25124c)return _0x50729a(_0x25124c);_0x347f0e(_0x495708);});});})[_0x22c4('0x20')](function(){return new BPromise(function(_0x754743,_0x1d51a7){zipdir(_0x32a22f,{'saveTo':_0x5e8257},function(_0x1981f1,_0x5416f3){if(_0x1981f1)return _0x1d51a7(_0x1981f1);return _0x754743(_0x5416f3);});})['then'](function(){return new BPromise(function(_0x32aab6,_0x541cdd){rimraf(_0x32a22f,function(_0x385921){if(_0x385921)_0x541cdd(_0x385921);return _0x32aab6();});});})[_0x22c4('0x20')](function(){return _0x5d35cf[_0x22c4('0xe4')](_0x5e8257,_0x5e429d,function(_0x212a59){if(_0x212a59){console['log'](_0x22c4('0x138'),_0x212a59);}else{fs[_0x22c4('0x139')](_0x5e8257);}});});});}else{return _0x5d35cf[_0x22c4('0x2c')](0xc8);}})[_0x22c4('0x2b')](handleError(_0x5d35cf,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 9e737c0..ca4a154 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 _0x4c4a=['events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','Users','map','setDataValue','unreadMessages','length','emit','catch','hook','exports'];(function(_0x593264,_0x5b30b9){var _0x3afc87=function(_0x8982c4){while(--_0x8982c4){_0x593264['push'](_0x593264['shift']());}};_0x3afc87(++_0x5b30b9);}(_0x4c4a,0x1d0));var _0xa4c4=function(_0x1adb70,_0x4ee046){_0x1adb70=_0x1adb70-0x0;var _0x1cf6df=_0x4c4a[_0x1adb70];return _0x1cf6df;};'use strict';var EventEmitter=require(_0xa4c4('0x0'));var ChatInteraction=require(_0xa4c4('0x1'))['db'][_0xa4c4('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0xa4c4('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xa4c4('0x4')](0x0);var events={'afterCreate':_0xa4c4('0x5'),'afterUpdate':_0xa4c4('0x6'),'afterDestroy':'remove'};function emitEvent(_0x38fa20){return function(_0x55a242,_0x1d9aa8,_0x11aded){_0x55a242['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x11b498){_0x55a242['setDataValue'](_0xa4c4('0x7'),_0x11b498[_0xa4c4('0x8')](function(_0x2532be){return{'id':_0x2532be['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x55a242['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x16004a){_0x55a242[_0xa4c4('0x9')](_0xa4c4('0xa'),_0x16004a[_0xa4c4('0xb')]);ChatInteractionEvents[_0xa4c4('0xc')](_0x38fa20+':'+_0x55a242['id'],_0x55a242);ChatInteractionEvents['emit'](_0x38fa20,_0x55a242);_0x11aded(null);})[_0xa4c4('0xd')](_0x11aded(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xa4c4('0xe')](e,emitEvent(event));}}module[_0xa4c4('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x161f=['Users','map','unreadMessages','length','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatInteraction','ChatMessage','update','remove','getUsers','then','setDataValue'];(function(_0x47ca43,_0x449380){var _0x244d4f=function(_0x3e2c37){while(--_0x3e2c37){_0x47ca43['push'](_0x47ca43['shift']());}};_0x244d4f(++_0x449380);}(_0x161f,0x188));var _0xf161=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x161f[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xf161('0x0'))['db'][_0xf161('0x1')];var ChatMessage=require(_0xf161('0x0'))['db'][_0xf161('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf161('0x3'),'afterDestroy':_0xf161('0x4')};function emitEvent(_0x1fd297){return function(_0x1b276e,_0x394c79,_0x4e2183){_0x1b276e[_0xf161('0x5')]({'attributes':['id'],'raw':!![]})[_0xf161('0x6')](function(_0x394407){_0x1b276e[_0xf161('0x7')](_0xf161('0x8'),_0x394407[_0xf161('0x9')](function(_0x828a16){return{'id':_0x828a16['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x1b276e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf161('0x6')](function(_0x5e7029){_0x1b276e[_0xf161('0x7')](_0xf161('0xa'),_0x5e7029[_0xf161('0xb')]);ChatInteractionEvents['emit'](_0x1fd297+':'+_0x1b276e['id'],_0x1b276e);ChatInteractionEvents[_0xf161('0xc')](_0x1fd297,_0x1b276e);_0x4e2183(null);})['catch'](_0x4e2183(null));};}for(var e in events){if(events[_0xf161('0xd')](e)){var event=events[e];ChatInteraction[_0xf161('0xe')](e,emitEvent(event));}}module[_0xf161('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 5917954..1224440 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 _0x9121=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','utf8mb4','lodash'];(function(_0x24d895,_0x5cfcba){var _0x5e9d2b=function(_0x211fd2){while(--_0x211fd2){_0x24d895['push'](_0x24d895['shift']());}};_0x5e9d2b(++_0x5cfcba);}(_0x9121,0x175));var _0x1912=function(_0x188360,_0x3d93f8){_0x188360=_0x188360-0x0;var _0x1fbe6d=_0x9121[_0x188360];return _0x1fbe6d;};'use strict';var _=require(_0x1912('0x0'));var util=require(_0x1912('0x1'));var logger=require(_0x1912('0x2'))('api');var moment=require(_0x1912('0x3'));var BPromise=require('bluebird');var rp=require(_0x1912('0x4'));var fs=require('fs');var path=require(_0x1912('0x5'));var rimraf=require(_0x1912('0x6'));var config=require(_0x1912('0x7'));var attributes=require(_0x1912('0x8'));module[_0x1912('0x9')]=function(_0x500630,_0x2b2a6a){return _0x500630[_0x1912('0xa')](_0x1912('0xb'),attributes,{'tableName':_0x1912('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a9a26,_0xcc1a08,_0x5884da){if(_0x2a9a26[_0x1912('0xd')](_0x1912('0xe'))){_0x2a9a26[_0x1912('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5884da(null,_0x2a9a26);}},'charset':_0x1912('0x10'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf11b=['./chatInteraction.attributes','exports','define','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x331388,_0x1a253b){var _0x3b0133=function(_0x230762){while(--_0x230762){_0x331388['push'](_0x331388['shift']());}};_0x3b0133(++_0x1a253b);}(_0xf11b,0x1cd));var _0xbf11=function(_0x7be2eb,_0xfc7f5d){_0x7be2eb=_0x7be2eb-0x0;var _0x521c7b=_0xf11b[_0x7be2eb];return _0x521c7b;};'use strict';var _=require(_0xbf11('0x0'));var util=require('util');var logger=require(_0xbf11('0x1'))(_0xbf11('0x2'));var moment=require(_0xbf11('0x3'));var BPromise=require('bluebird');var rp=require(_0xbf11('0x4'));var fs=require('fs');var path=require(_0xbf11('0x5'));var rimraf=require(_0xbf11('0x6'));var config=require('../../config/environment');var attributes=require(_0xbf11('0x7'));module[_0xbf11('0x8')]=function(_0x1bb93d,_0x2cddb9){return _0x1bb93d[_0xbf11('0x9')]('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x446621,_0x381278,_0x316074){if(_0x446621['changed']('closed')){_0x446621[_0xbf11('0xa')]=moment()[_0xbf11('0xb')](_0xbf11('0xc'));}_0x316074(null,_0x446621);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 3768049..ff4c0ed 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 _0x3149=['request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ChatInteraction','body','options','attributes','limit','UpdateChatInteraction','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','./chatInteraction.socket','register'];(function(_0x1a5196,_0x2dd2d4){var _0x3ad2d5=function(_0x105b2f){while(--_0x105b2f){_0x1a5196['push'](_0x1a5196['shift']());}};_0x3ad2d5(++_0x2dd2d4);}(_0x3149,0x151));var _0x9314=function(_0x3987c2,_0x18691d){_0x3987c2=_0x3987c2-0x0;var _0x26344f=_0x3149[_0x3987c2];return _0x26344f;};'use strict';var _=require('lodash');var util=require(_0x9314('0x0'));var moment=require(_0x9314('0x1'));var BPromise=require(_0x9314('0x2'));var rs=require(_0x9314('0x3'));var fs=require('fs');var Redis=require(_0x9314('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9314('0x5'));var logger=require(_0x9314('0x6'))('rpc');var config=require(_0x9314('0x7'));var jayson=require(_0x9314('0x8'));var client=jayson[_0x9314('0x9')]['http']({'port':0x232a});config[_0x9314('0xa')]=_['defaults'](config[_0x9314('0xa')],{'host':_0x9314('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9314('0xa')]));require(_0x9314('0xc'))[_0x9314('0xd')](socket);function respondWithRpcPromise(_0x11bca7,_0xc049cf,_0x5ba5c8){return new BPromise(function(_0x393245,_0x235cc6){return client[_0x9314('0xe')](_0x11bca7,_0x5ba5c8)[_0x9314('0xf')](function(_0x2ee32d){logger[_0x9314('0x10')](_0x9314('0x11'),_0xc049cf,_0x9314('0x12'));logger[_0x9314('0x13')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xc049cf,_0x9314('0x12'),JSON[_0x9314('0x14')](_0x2ee32d));if(_0x2ee32d[_0x9314('0x15')]){if(_0x2ee32d['error'][_0x9314('0x16')]===0x1f4){logger[_0x9314('0x15')]('ChatInteraction,\x20%s,\x20%s',_0xc049cf,_0x2ee32d[_0x9314('0x15')]['message']);return _0x235cc6(_0x2ee32d[_0x9314('0x15')]['message']);}logger[_0x9314('0x15')](_0x9314('0x11'),_0xc049cf,_0x2ee32d[_0x9314('0x15')][_0x9314('0x17')]);return _0x393245(_0x2ee32d['error'][_0x9314('0x17')]);}else{logger['info'](_0x9314('0x11'),_0xc049cf,_0x9314('0x12'));_0x393245(_0x2ee32d[_0x9314('0x18')][_0x9314('0x17')]);}})[_0x9314('0x19')](function(_0x38e2ae){logger[_0x9314('0x15')]('ChatInteraction,\x20%s,\x20%s',_0xc049cf,_0x38e2ae);_0x235cc6(_0x38e2ae);});});}exports['UpdateChatInteraction']=function(_0x33124d){var _0x325061=this;return new Promise(function(_0x2e88ba,_0x2f1e75){return db[_0x9314('0x1a')]['update'](_0x33124d[_0x9314('0x1b')],{'raw':_0x33124d['options']?_0x33124d[_0x9314('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33124d[_0x9314('0x1c')]?_0x33124d[_0x9314('0x1c')]['where']||null:null,'attributes':_0x33124d[_0x9314('0x1c')]?_0x33124d[_0x9314('0x1c')][_0x9314('0x1d')]||null:null,'limit':_0x33124d[_0x9314('0x1c')]?_0x33124d[_0x9314('0x1c')][_0x9314('0x1e')]||null:null})['then'](function(_0x4dd904){logger[_0x9314('0x10')](_0x9314('0x1f'),_0x33124d);logger[_0x9314('0x13')]('UpdateChatInteraction',_0x33124d,JSON['stringify'](_0x4dd904));_0x2e88ba(_0x4dd904);})[_0x9314('0x19')](function(_0x410a4f){logger[_0x9314('0x15')](_0x9314('0x1f'),_0x410a4f[_0x9314('0x17')],_0x33124d);_0x2f1e75(_0x325061[_0x9314('0x15')](0x1f4,_0x410a4f['message']));});});};exports[_0x9314('0x20')]=function(_0x9511fb){return new Promise(function(_0x9a6cdc,_0x170e9d){return db[_0x9314('0x1a')][_0x9314('0x21')]({'where':_0x9511fb[_0x9314('0x1c')]?_0x9511fb['options']['where']||null:null})[_0x9314('0xf')](function(_0x1b94df){if(_0x1b94df){return _0x1b94df[_0x9314('0x22')](_0x9511fb[_0x9314('0x1b')][_0x9314('0x23')],_[_0x9314('0x24')](_0x9511fb[_0x9314('0x1b')],['ids','id'])||{});}})[_0x9314('0x25')](function(_0x3d4c82){logger[_0x9314('0x10')](_0x9314('0x26'),_0x9511fb);logger[_0x9314('0x13')]('AddTags',_0x9511fb,JSON['stringify'](_0x3d4c82));_0x9a6cdc(_0x3d4c82);})[_0x9314('0x19')](function(_0x386cd6){logger[_0x9314('0x15')](_0x9314('0x26'),_0x386cd6[_0x9314('0x17')],_0x9511fb);_0x170e9d(_this[_0x9314('0x15')](0x1f4,_0x386cd6[_0x9314('0x17')]));});});}; \ No newline at end of file +var _0x5b03=['message','result','catch','UpdateChatInteraction','update','options','raw','where','attributes','limit','then','AddTagsToChatInteraction','ids','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4d7084,_0x32912e){var _0x15c385=function(_0x5c4537){while(--_0x5c4537){_0x4d7084['push'](_0x4d7084['shift']());}};_0x15c385(++_0x32912e);}(_0x5b03,0x14e));var _0x35b0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5b03[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x35b0('0x0'));var util=require(_0x35b0('0x1'));var moment=require('moment');var BPromise=require(_0x35b0('0x2'));var rs=require(_0x35b0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x35b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x35b0('0x5'))(_0x35b0('0x6'));var config=require(_0x35b0('0x7'));var jayson=require(_0x35b0('0x8'));var client=jayson[_0x35b0('0x9')][_0x35b0('0xa')]({'port':0x232a});config['redis']=_[_0x35b0('0xb')](config['redis'],{'host':_0x35b0('0xc'),'port':0x18eb});var socket=require(_0x35b0('0xd'))(new Redis(config[_0x35b0('0xe')]));require(_0x35b0('0xf'))[_0x35b0('0x10')](socket);function respondWithRpcPromise(_0x55b7f5,_0x2e277b,_0x60c5fb){return new BPromise(function(_0x25d897,_0x4aae78){return client[_0x35b0('0x11')](_0x55b7f5,_0x60c5fb)['then'](function(_0x590152){logger[_0x35b0('0x12')](_0x35b0('0x13'),_0x2e277b,_0x35b0('0x14'));logger[_0x35b0('0x15')](_0x35b0('0x16'),_0x2e277b,_0x35b0('0x14'),JSON[_0x35b0('0x17')](_0x590152));if(_0x590152['error']){if(_0x590152[_0x35b0('0x18')][_0x35b0('0x19')]===0x1f4){logger[_0x35b0('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x2e277b,_0x590152[_0x35b0('0x18')]['message']);return _0x4aae78(_0x590152['error'][_0x35b0('0x1a')]);}logger[_0x35b0('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x2e277b,_0x590152[_0x35b0('0x18')]['message']);return _0x25d897(_0x590152[_0x35b0('0x18')][_0x35b0('0x1a')]);}else{logger[_0x35b0('0x12')](_0x35b0('0x13'),_0x2e277b,_0x35b0('0x14'));_0x25d897(_0x590152[_0x35b0('0x1b')][_0x35b0('0x1a')]);}})[_0x35b0('0x1c')](function(_0x1edf57){logger[_0x35b0('0x18')](_0x35b0('0x13'),_0x2e277b,_0x1edf57);_0x4aae78(_0x1edf57);});});}exports[_0x35b0('0x1d')]=function(_0x4573c4){var _0x1ad024=this;return new Promise(function(_0x53eeb0,_0x183480){return db['ChatInteraction'][_0x35b0('0x1e')](_0x4573c4['body'],{'raw':_0x4573c4[_0x35b0('0x1f')]?_0x4573c4[_0x35b0('0x1f')][_0x35b0('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4573c4[_0x35b0('0x1f')]?_0x4573c4[_0x35b0('0x1f')][_0x35b0('0x21')]||null:null,'attributes':_0x4573c4[_0x35b0('0x1f')]?_0x4573c4['options'][_0x35b0('0x22')]||null:null,'limit':_0x4573c4[_0x35b0('0x1f')]?_0x4573c4[_0x35b0('0x1f')][_0x35b0('0x23')]||null:null})[_0x35b0('0x24')](function(_0x5b7853){logger[_0x35b0('0x12')](_0x35b0('0x1d'),_0x4573c4);logger[_0x35b0('0x15')](_0x35b0('0x1d'),_0x4573c4,JSON[_0x35b0('0x17')](_0x5b7853));_0x53eeb0(_0x5b7853);})['catch'](function(_0x473152){logger[_0x35b0('0x18')]('UpdateChatInteraction',_0x473152[_0x35b0('0x1a')],_0x4573c4);_0x183480(_0x1ad024[_0x35b0('0x18')](0x1f4,_0x473152['message']));});});};exports[_0x35b0('0x25')]=function(_0x44bd98){return new Promise(function(_0x4eff42,_0x4ab379){return db['ChatInteraction']['find']({'where':_0x44bd98[_0x35b0('0x1f')]?_0x44bd98['options'][_0x35b0('0x21')]||null:null})['then'](function(_0x4b00fd){if(_0x4b00fd){return _0x4b00fd['addTags'](_0x44bd98['body'][_0x35b0('0x26')],_['omit'](_0x44bd98['body'],[_0x35b0('0x26'),'id'])||{});}})['spread'](function(_0x34be96){logger[_0x35b0('0x12')](_0x35b0('0x27'),_0x44bd98);logger['debug'](_0x35b0('0x27'),_0x44bd98,JSON[_0x35b0('0x17')](_0x34be96));_0x4eff42(_0x34be96);})[_0x35b0('0x1c')](function(_0x1ea758){logger['error'](_0x35b0('0x27'),_0x1ea758[_0x35b0('0x1a')],_0x44bd98);_0x4ab379(_this['error'](0x1f4,_0x1ea758[_0x35b0('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index ae52f27..c21baa6 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 _0x7059=['emit','removeListener','register','length','./chatInteraction.events','remove','update'];(function(_0x34e4a0,_0x1fd446){var _0x3ead3e=function(_0x47adec){while(--_0x47adec){_0x34e4a0['push'](_0x34e4a0['shift']());}};_0x3ead3e(++_0x1fd446);}(_0x7059,0x123));var _0x9705=function(_0x466d99,_0x2f9be1){_0x466d99=_0x466d99-0x0;var _0x270fbb=_0x7059[_0x466d99];return _0x270fbb;};'use strict';var ChatInteractionEvents=require(_0x9705('0x0'));var events=['save',_0x9705('0x1'),_0x9705('0x2')];function createListener(_0x593555,_0x4de4fb){return function(_0x4880d2){_0x4de4fb[_0x9705('0x3')](_0x593555,_0x4880d2);};}function removeListener(_0x3313be,_0x160b00){return function(){ChatInteractionEvents[_0x9705('0x4')](_0x3313be,_0x160b00);};}exports[_0x9705('0x5')]=function(_0x11b4f5){for(var _0x1c8690=0x0,_0x4d28d8=events[_0x9705('0x6')];_0x1c8690<_0x4d28d8;_0x1c8690++){var _0x2e9373=events[_0x1c8690];var _0x5c2ef5=createListener('chatInteraction:'+_0x2e9373,_0x11b4f5);ChatInteractionEvents['on'](_0x2e9373,_0x5c2ef5);}}; \ No newline at end of file +var _0x8324=['update','emit','register','length','chatInteraction:','save','remove'];(function(_0x2f14f5,_0xf9f8e7){var _0x13ae34=function(_0x118274){while(--_0x118274){_0x2f14f5['push'](_0x2f14f5['shift']());}};_0x13ae34(++_0xf9f8e7);}(_0x8324,0xde));var _0x4832=function(_0x287a47,_0x2f731c){_0x287a47=_0x287a47-0x0;var _0x3fb726=_0x8324[_0x287a47];return _0x3fb726;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x4832('0x0'),_0x4832('0x1'),_0x4832('0x2')];function createListener(_0x511e1b,_0x581b93){return function(_0x5507f0){_0x581b93[_0x4832('0x3')](_0x511e1b,_0x5507f0);};}function removeListener(_0x399637,_0x1c443d){return function(){ChatInteractionEvents['removeListener'](_0x399637,_0x1c443d);};}exports[_0x4832('0x4')]=function(_0x174848){for(var _0x5dfcca=0x0,_0x21dac5=events[_0x4832('0x5')];_0x5dfcca<_0x21dac5;_0x5dfcca++){var _0x2ea672=events[_0x5dfcca];var _0x125bac=createListener(_0x4832('0x6')+_0x2ea672,_0x174848);ChatInteractionEvents['on'](_0x2ea672,_0x125bac);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index cf661d7..421cdd5 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 _0x9bde=['post','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','tracked','chatinteraction:addtags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','chat','chatinteraction:destroy','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','download'];(function(_0x3fccdc,_0x543784){var _0x2c37a2=function(_0x5b8ed5){while(--_0x5b8ed5){_0x3fccdc['push'](_0x3fccdc['shift']());}};_0x2c37a2(++_0x543784);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1784dc,_0x47dab2){_0x1784dc=_0x1784dc-0x0;var _0x45af20=_0x9bde[_0x1784dc];return _0x45af20;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var auth=require(_0xe9bd('0x3'));var interaction=require(_0xe9bd('0x4'));var config=require(_0xe9bd('0x5'));var controller=require(_0xe9bd('0x6'));router[_0xe9bd('0x7')]('/',auth[_0xe9bd('0x8')](),controller['index']);router[_0xe9bd('0x7')](_0xe9bd('0x9'),auth[_0xe9bd('0x8')](),controller[_0xe9bd('0xa')]);router[_0xe9bd('0x7')](_0xe9bd('0xb'),auth[_0xe9bd('0xc')](),controller[_0xe9bd('0xd')]);router[_0xe9bd('0x7')](_0xe9bd('0xe'),auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router[_0xe9bd('0x7')](_0xe9bd('0xf'),auth[_0xe9bd('0x8')](),controller['getMessages']);router[_0xe9bd('0x7')](_0xe9bd('0x10'),auth[_0xe9bd('0xc')](),controller[_0xe9bd('0x11')]);router['get'](_0xe9bd('0x12'),auth['isAuthenticated'](),controller[_0xe9bd('0x13')]);router[_0xe9bd('0x14')]('/',auth[_0xe9bd('0x8')](),controller['create']);router['post'](_0xe9bd('0x15'),auth[_0xe9bd('0x8')](),controller[_0xe9bd('0x16')]);var upload=multer({'storage':multer[_0xe9bd('0x17')]({'destination':function(_0x3360bd,_0x389e7b,_0x45a9f2){_0x45a9f2(null,path['join'](config[_0xe9bd('0x18')],_0xe9bd('0x19')));},'filename':function(_0x160281,_0x494b27,_0x36f03d){_0x36f03d(null,util[_0xe9bd('0x1a')](_0xe9bd('0x1b'),Date[_0xe9bd('0x1c')](),_0x494b27['originalname'][_0xe9bd('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xe9bd('0x1e'),upload['single'](_0xe9bd('0x1f')),controller[_0xe9bd('0x20')]);router[_0xe9bd('0x14')](_0xe9bd('0xf'),auth[_0xe9bd('0xc')](),controller[_0xe9bd('0x21')]);router[_0xe9bd('0x14')]('/:id/tags',auth[_0xe9bd('0x8')](),interaction[_0xe9bd('0x22')]('chat',_0xe9bd('0x23')),controller['addTags']);router[_0xe9bd('0x24')](_0xe9bd('0xb'),auth[_0xe9bd('0x8')](),interaction[_0xe9bd('0x22')]('chat',_0xe9bd('0x25')),controller[_0xe9bd('0x26')]);router[_0xe9bd('0x24')](_0xe9bd('0x27'),controller[_0xe9bd('0x28')]);router[_0xe9bd('0x24')](_0xe9bd('0x29'),auth[_0xe9bd('0xc')](),controller[_0xe9bd('0x2a')]);router['put'](_0xe9bd('0x2b'),controller[_0xe9bd('0x2c')]);router['delete'](_0xe9bd('0xb'),auth[_0xe9bd('0x8')](),interaction[_0xe9bd('0x22')](_0xe9bd('0x2d'),_0xe9bd('0x2e')),controller[_0xe9bd('0x2f')]);router['delete']('/:id/tags',auth[_0xe9bd('0x8')](),controller['removeTags']);module[_0xe9bd('0x30')]=router; \ No newline at end of file +var _0x3e74=['isChatInteractionAuthorized','attachmentDownload','/:id/my_messages','getMyMessages','/:id/download','create','post','createVidaooSession','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','abandon','/:id/close','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x5cc53f,_0x2652f8){var _0x3a0d7c=function(_0x12623b){while(--_0x12623b){_0x5cc53f['push'](_0x5cc53f['shift']());}};_0x3a0d7c(++_0x2652f8);}(_0x3e74,0x175));var _0x43e7=function(_0x3752ab,_0x3e6353){_0x3752ab=_0x3752ab-0x0;var _0x1d845b=_0x3e74[_0x3752ab];return _0x1d845b;};'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('0xb')](),controller['show']);router[_0x43e7('0x6')]('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0x43e7('0xc')]);router[_0x43e7('0x6')]('/:id/messages',auth[_0x43e7('0x7')](),controller['getMessages']);router[_0x43e7('0x6')](_0x43e7('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x43e7('0xe')]);router[_0x43e7('0x6')](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller['download']);router['post']('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router[_0x43e7('0x11')]('/:id/vidaoo',auth['isAuthenticated'](),controller[_0x43e7('0x12')]);var upload=multer({'storage':multer[_0x43e7('0x13')]({'destination':function(_0x203378,_0x328445,_0x4de324){_0x4de324(null,path['join'](config[_0x43e7('0x14')],_0x43e7('0x15')));},'filename':function(_0x273a32,_0x5d346f,_0x4b5a6b){_0x4b5a6b(null,util[_0x43e7('0x16')](_0x43e7('0x17'),Date[_0x43e7('0x18')](),_0x5d346f[_0x43e7('0x19')][_0x43e7('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x43e7('0x11')](_0x43e7('0x1b'),upload[_0x43e7('0x1c')](_0x43e7('0x1d')),controller[_0x43e7('0x1e')]);router[_0x43e7('0x11')](_0x43e7('0x1f'),auth['isChatInteractionAuthorized'](),controller[_0x43e7('0x20')]);router[_0x43e7('0x11')]('/:id/tags',auth[_0x43e7('0x7')](),interaction[_0x43e7('0x21')](_0x43e7('0x22'),_0x43e7('0x23')),controller[_0x43e7('0x24')]);router[_0x43e7('0x25')]('/:id',auth[_0x43e7('0x7')](),interaction['tracked']('chat',_0x43e7('0x26')),controller[_0x43e7('0x27')]);router['put'](_0x43e7('0x28'),controller['customUpdate']);router[_0x43e7('0x25')]('/:id/abandon',auth[_0x43e7('0xb')](),controller[_0x43e7('0x29')]);router[_0x43e7('0x25')](_0x43e7('0x2a'),controller['close']);router['delete'](_0x43e7('0xa'),auth['isAuthenticated'](),interaction[_0x43e7('0x21')](_0x43e7('0x22'),_0x43e7('0x2b')),controller[_0x43e7('0x2c')]);router['delete'](_0x43e7('0x2d'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x2e')]);module[_0x43e7('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 a9c586d..a481561 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 _0x7a54=['BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x1f1e31,_0x27b5c3){var _0x229b56=function(_0x16db77){while(--_0x16db77){_0x1f1e31['push'](_0x1f1e31['shift']());}};_0x229b56(++_0x27b5c3);}(_0x7a54,0x106));var _0x47a5=function(_0x433d66,_0x15b699){_0x433d66=_0x433d66-0x0;var _0x3c92fe=_0x7a54[_0x433d66];return _0x3c92fe;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'body':{'type':Sequelize[_0x47a5('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x47a5('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0xdb28=['medium','INTEGER','sequelize','exports','TEXT'];(function(_0x59891c,_0x494d35){var _0x222eef=function(_0x5563cc){while(--_0x5563cc){_0x59891c['push'](_0x59891c['shift']());}};_0x222eef(++_0x494d35);}(_0xdb28,0x106));var _0x8db2=function(_0x44409c,_0x321116){_0x44409c=_0x44409c-0x0;var _0x104b3c=_0xdb28[_0x44409c];return _0x104b3c;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8db2('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index b24a73e..e86d0c7 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 _0x9772=['internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','role','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','all','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','ChatInternalMessage','includeAll','include','findAll','rows','show','filtears','find','catch','create','body','params','describe','get','messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','agent','admin','user','fullname','userpic'];(function(_0x4a893c,_0x4f05ea){var _0x3a6668=function(_0x48e7e7){while(--_0x48e7e7){_0x4a893c['push'](_0x4a893c['shift']());}};_0x3a6668(++_0x4f05ea);}(_0x9772,0x1d3));var _0x2977=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x9772[_0x27af45];return _0x18df21;};'use strict';var pdf=require(_0x2977('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2977('0x1'));var jsonpatch=require(_0x2977('0x2'));var rp=require(_0x2977('0x3'));var moment=require(_0x2977('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2977('0x5'));var util=require(_0x2977('0x6'));var path=require(_0x2977('0x7'));var sox=require(_0x2977('0x8'));var csv=require(_0x2977('0x9'));var ejs=require(_0x2977('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2977('0xb'));var crypto=require(_0x2977('0xc'));var jsforce=require(_0x2977('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2977('0x9'));var querystring=require(_0x2977('0xe'));var Papa=require(_0x2977('0xf'));var Redis=require(_0x2977('0x10'));var authService=require(_0x2977('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2977('0x12'));var hardwareService=require(_0x2977('0x13'));var logger=require(_0x2977('0x14'))(_0x2977('0x15'));var utils=require(_0x2977('0x16'));var config=require(_0x2977('0x17'));var licenseUtil=require(_0x2977('0x18'));var db=require('../../mysqldb')['db'];config[_0x2977('0x19')]=_[_0x2977('0x1a')](config[_0x2977('0x19')],{'host':_0x2977('0x1b'),'port':0x18eb});var socket=require(_0x2977('0x1c'))(new Redis(config[_0x2977('0x19')]));require(_0x2977('0x1d'))[_0x2977('0x1e')](socket);function respondWithStatusCode(_0x5e9358,_0x597628){_0x597628=_0x597628||0xcc;return function(_0x19977f){if(_0x19977f){return _0x5e9358['sendStatus'](_0x597628);}return _0x5e9358[_0x2977('0x1f')](_0x597628)[_0x2977('0x20')]();};}function respondWithResult(_0x412632,_0x3f5d91){_0x3f5d91=_0x3f5d91||0xc8;return function(_0x4ff6bf){if(_0x4ff6bf){return _0x412632[_0x2977('0x1f')](_0x3f5d91)[_0x2977('0x21')](_0x4ff6bf);}};}function respondWithFilteredResult(_0x17e595,_0x3b2775){return function(_0x5ba9e7){if(_0x5ba9e7){var _0x1c00cf=_0x5ba9e7[_0x2977('0x22')],_0x7a2282=_0x3b2775[_0x2977('0x23')],_0x3d5a2f=_0x3b2775['offset']+_0x3b2775['limit'],_0x4ee4f7;if(_0x3d5a2f>=_0x1c00cf){_0x3d5a2f=_0x1c00cf;_0x4ee4f7=0xc8;}else{_0x4ee4f7=0xce;}_0x17e595['status'](_0x4ee4f7);return _0x17e595[_0x2977('0x24')](_0x2977('0x25'),_0x7a2282+'-'+_0x3d5a2f+'/'+_0x1c00cf)[_0x2977('0x21')](_0x5ba9e7);}return null;};}function patchUpdates(_0x2c1e4c){return function(_0x3694bd){try{jsonpatch[_0x2977('0x26')](_0x3694bd,_0x2c1e4c,!![]);}catch(_0x33fb11){return BPromise[_0x2977('0x27')](_0x33fb11);}return _0x3694bd[_0x2977('0x28')]();};}function saveUpdates(_0x2299d4,_0xe4746e){return function(_0x7efe21){if(_0x7efe21){return _0x7efe21[_0x2977('0x29')](_0x2299d4)[_0x2977('0x2a')](function(_0x37e7f3){return _0x37e7f3;});}return null;};}function removeEntity(_0x34bcff,_0x20c85d){return function(_0x1f3e92){if(_0x1f3e92){return _0x1f3e92[_0x2977('0x2b')]()[_0x2977('0x2a')](function(){_0x34bcff[_0x2977('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4204fa,_0x15dbc1){return function(_0x3d48cc){if(!_0x3d48cc){_0x4204fa[_0x2977('0x2c')](0x194);}return _0x3d48cc;};}function handleError(_0x308104,_0x5b1ddf){_0x5b1ddf=_0x5b1ddf||0x1f4;return function(_0x11f230){logger[_0x2977('0x2d')](_0x11f230['stack']);if(_0x11f230['name']){delete _0x11f230[_0x2977('0x2e')];}_0x308104[_0x2977('0x1f')](_0x5b1ddf)[_0x2977('0x2f')](_0x11f230);};}exports['index']=function(_0x23cc2e,_0x1d66a1){var _0x2c450d={},_0x5ad337={},_0x147679={'count':0x0,'rows':[]};var _0x20d599=_[_0x2977('0x30')](db['ChatInternalMessage'][_0x2977('0x31')],function(_0x153db2){return{'name':_0x153db2[_0x2977('0x32')],'type':_0x153db2[_0x2977('0x33')]['key']};});_0x5ad337[_0x2977('0x34')]=_[_0x2977('0x30')](_0x20d599,_0x2977('0x2e'));_0x5ad337[_0x2977('0x35')]=_[_0x2977('0x36')](_0x23cc2e[_0x2977('0x35')]);_0x5ad337['filters']=_['intersection'](_0x5ad337[_0x2977('0x34')],_0x5ad337[_0x2977('0x35')]);_0x2c450d[_0x2977('0x37')]=_[_0x2977('0x38')](_0x5ad337[_0x2977('0x34')],qs[_0x2977('0x39')](_0x23cc2e[_0x2977('0x35')][_0x2977('0x39')]));_0x2c450d[_0x2977('0x37')]=_0x2c450d[_0x2977('0x37')][_0x2977('0x3a')]?_0x2c450d[_0x2977('0x37')]:_0x5ad337[_0x2977('0x34')];if(!_0x23cc2e['query']['hasOwnProperty'](_0x2977('0x3b'))){_0x2c450d[_0x2977('0x3c')]=qs[_0x2977('0x3c')](_0x23cc2e['query'][_0x2977('0x3c')]);_0x2c450d[_0x2977('0x23')]=qs['offset'](_0x23cc2e[_0x2977('0x35')][_0x2977('0x23')]);}_0x2c450d[_0x2977('0x3d')]=qs[_0x2977('0x3e')](_0x23cc2e[_0x2977('0x35')][_0x2977('0x3e')]);_0x2c450d['where']=qs['filters'](_[_0x2977('0x3f')](_0x23cc2e[_0x2977('0x35')],_0x5ad337['filters']),_0x20d599);if(_0x23cc2e[_0x2977('0x35')][_0x2977('0x40')]){_0x2c450d[_0x2977('0x41')]=_['merge'](_0x2c450d[_0x2977('0x41')],{'$or':_['map'](_0x20d599,function(_0x821cb7){if(_0x821cb7[_0x2977('0x33')]!==_0x2977('0x42')){var _0x404063={};_0x404063[_0x821cb7['name']]={'$like':'%'+_0x23cc2e['query'][_0x2977('0x40')]+'%'};return _0x404063;}})});}_0x2c450d=_[_0x2977('0x43')]({},_0x2c450d,_0x23cc2e[_0x2977('0x44')]);var _0x590545={'where':_0x2c450d['where']};return db[_0x2977('0x45')]['count'](_0x590545)[_0x2977('0x2a')](function(_0x1a213){_0x147679[_0x2977('0x22')]=_0x1a213;if(_0x23cc2e[_0x2977('0x35')][_0x2977('0x46')]){_0x2c450d[_0x2977('0x47')]=[{'all':!![]}];}return db[_0x2977('0x45')][_0x2977('0x48')](_0x2c450d);})[_0x2977('0x2a')](function(_0x20dfd9){_0x147679[_0x2977('0x49')]=_0x20dfd9;return _0x147679;})[_0x2977('0x2a')](respondWithFilteredResult(_0x1d66a1,_0x2c450d))['catch'](handleError(_0x1d66a1,null));};exports[_0x2977('0x4a')]=function(_0x7c2a7b,_0x102236){var _0x13efd3={'raw':!![],'where':{'id':_0x7c2a7b['params']['id']}},_0x3a7191={};_0x3a7191[_0x2977('0x34')]=_[_0x2977('0x36')](db[_0x2977('0x45')]['rawAttributes']);_0x3a7191[_0x2977('0x35')]=_[_0x2977('0x36')](_0x7c2a7b[_0x2977('0x35')]);_0x3a7191[_0x2977('0x4b')]=_[_0x2977('0x38')](_0x3a7191[_0x2977('0x34')],_0x3a7191[_0x2977('0x35')]);_0x13efd3[_0x2977('0x37')]=_[_0x2977('0x38')](_0x3a7191['model'],qs[_0x2977('0x39')](_0x7c2a7b[_0x2977('0x35')][_0x2977('0x39')]));_0x13efd3['attributes']=_0x13efd3[_0x2977('0x37')][_0x2977('0x3a')]?_0x13efd3['attributes']:_0x3a7191['model'];if(_0x7c2a7b['query']['includeAll']){_0x13efd3[_0x2977('0x47')]=[{'all':!![]}];}_0x13efd3=_[_0x2977('0x43')]({},_0x13efd3,_0x7c2a7b[_0x2977('0x44')]);return db['ChatInternalMessage'][_0x2977('0x4c')](_0x13efd3)[_0x2977('0x2a')](handleEntityNotFound(_0x102236,null))[_0x2977('0x2a')](respondWithResult(_0x102236,null))[_0x2977('0x4d')](handleError(_0x102236,null));};exports[_0x2977('0x4e')]=function(_0x39d707,_0x48162e){return db[_0x2977('0x45')]['create'](_0x39d707['body'],{})[_0x2977('0x2a')](respondWithResult(_0x48162e,0xc9))[_0x2977('0x4d')](handleError(_0x48162e,null));};exports[_0x2977('0x29')]=function(_0x2edcc0,_0x353df8){if(_0x2edcc0[_0x2977('0x4f')]['id']){delete _0x2edcc0[_0x2977('0x4f')]['id'];}return db['ChatInternalMessage'][_0x2977('0x4c')]({'where':{'id':_0x2edcc0[_0x2977('0x50')]['id']}})[_0x2977('0x2a')](handleEntityNotFound(_0x353df8,null))['then'](saveUpdates(_0x2edcc0[_0x2977('0x4f')],null))[_0x2977('0x2a')](respondWithResult(_0x353df8,null))[_0x2977('0x4d')](handleError(_0x353df8,null));};exports[_0x2977('0x2b')]=function(_0x331fbc,_0x4e7880){return db[_0x2977('0x45')]['find']({'where':{'id':_0x331fbc[_0x2977('0x50')]['id']}})[_0x2977('0x2a')](handleEntityNotFound(_0x4e7880,null))[_0x2977('0x2a')](removeEntity(_0x4e7880,null))['catch'](handleError(_0x4e7880,null));};exports['describe']=function(_0x2881bc,_0x26c8f1){return db[_0x2977('0x45')][_0x2977('0x51')]()[_0x2977('0x2a')](respondWithResult(_0x26c8f1,null))['catch'](handleError(_0x26c8f1,null));};function wrapUser(_0x47d764){return function(_0xac8e0c){var _0x2bdb37=_0x47d764[_0x2977('0x52')]({'plain':!![]});_0x2bdb37[_0x2977('0x53')]=[];if(_0xac8e0c){_0x2bdb37[_0x2977('0x54')]=_0xac8e0c[_0x2977('0x55')];_0x2bdb37[_0x2977('0x56')]=_0xac8e0c;}else{_0x2bdb37[_0x2977('0x54')]=moment(0x0)['format'](_0x2977('0x57'));_0x2bdb37[_0x2977('0x56')]={};}return _0x2bdb37;};}exports['getUsers']=function(_0x33708a,_0x29172d,_0x9844c4){var _0x5d64b3=[];return db['User'][_0x2977('0x48')]({'where':{'role':[_0x2977('0x58'),_0x2977('0x59'),_0x2977('0x5a')]},'attributes':['id',_0x2977('0x5b'),_0x2977('0x2e'),'role',_0x2977('0x5c'),_0x2977('0x5d'),_0x2977('0x5e'),_0x2977('0x5f'),_0x2977('0x60'),_0x2977('0x61')],'order':qs[_0x2977('0x3e')](_0x2977('0x62')),'include':[{'model':db[_0x2977('0x63')],'as':_0x2977('0x64'),'attributes':['id',_0x2977('0x2e'),_0x2977('0x33')],'through':{'attributes':[]}}]})['then'](function(_0x52f76c){if(_0x52f76c){var _0x3c05de=_0x33708a[_0x2977('0x5a')]['get']({'plain':!![]});if(!_0x3c05de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c05de[_0x2977('0x65')]===_0x2977('0x5a')){return db[_0x2977('0x66')][_0x2977('0x4c')]({'where':{'name':_0x2977('0x67'),'userProfileId':_0x3c05de[_0x2977('0x68')]},'raw':!![]})[_0x2977('0x2a')](function(_0x2d59f8){if(_0x2d59f8){if(_0x2d59f8['autoAssociation']===0x0){return db[_0x2977('0x69')][_0x2977('0x48')]({'where':{'sectionId':_0x2d59f8['id']},'raw':!![]})[_0x2977('0x2a')](function(_0x1a9616){var _0x53c2c5=[];if(_[_0x2977('0x6a')](_0x1a9616)){_0x53c2c5=_[_0x2977('0x40')](_0x52f76c,function(_0x2f41ed){if(_0x2f41ed[_0x2977('0x65')]!==_0x2977('0x58')){return _0x2f41ed;}});return _0x53c2c5;}else{for(var _0x3d9d4c=0x0;_0x3d9d4c<_0x52f76c[_0x2977('0x3a')];_0x3d9d4c++){var _0x8ae838=_0x52f76c[_0x3d9d4c];if(_0x8ae838[_0x2977('0x65')]===_0x2977('0x58')){var _0xf426fb=_[_0x2977('0x4c')](_0x1a9616,function(_0x27b089){return _0x27b089[_0x2977('0x6b')]===_0x8ae838['id'];});if(_0xf426fb)_0x53c2c5[_0x2977('0x6c')](_0x8ae838);}else{_0x53c2c5[_0x2977('0x6c')](_0x8ae838);}}return _0x53c2c5;}});}else{return _0x52f76c;}}else{var _0x5063d2=_['filter'](_0x52f76c,function(_0x88ca04){if(_0x88ca04[_0x2977('0x65')]!=='agent'){return _0x88ca04;}});return _0x5063d2;}});}else{return _0x52f76c;}}})[_0x2977('0x2a')](function(_0x4df87b){var _0x59b484=[];if(_0x4df87b){_0x5d64b3=_0x4df87b;for(var _0xcd2f8=0x0;_0xcd2f8<_0x4df87b[_0x2977('0x3a')];_0xcd2f8+=0x1){_0x5d64b3[_0xcd2f8]['messages']=[];_0x59b484[_0x2977('0x6c')](db['ChatInternalMessage'][_0x2977('0x4c')]({'where':{'FromId':[_0x33708a[_0x2977('0x5a')]['id'],_0x4df87b[_0xcd2f8]['id']],'ToId':[_0x33708a[_0x2977('0x5a')]['id'],_0x4df87b[_0xcd2f8]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x2977('0x6d'),_0x2977('0x6e'),'read',_0x2977('0x4f')],'order':qs[_0x2977('0x3e')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x2977('0x2a')](wrapUser(_0x4df87b[_0xcd2f8])));}return BPromise[_0x2977('0x6f')](_0x59b484);}return[];})[_0x2977('0x2a')](function(_0x4e3b28){return{'rows':_0x4e3b28,'count':_0x4e3b28['length']};})[_0x2977('0x2a')](respondWithResult(_0x29172d,null))[_0x2977('0x4d')](handleError(_0x29172d,null));}; \ No newline at end of file +var _0x5b38=['admin','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','user','createdAt','FromId','ToId','read','-createdAt','all','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','ChatInternalMessage','includeAll','include','findAll','rows','catch','params','keys','filtears','length','options','create','find','body','destroy','describe','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent'];(function(_0x27a381,_0x4f83df){var _0x4088b3=function(_0x37a8ad){while(--_0x37a8ad){_0x27a381['push'](_0x27a381['shift']());}};_0x4088b3(++_0x4f83df);}(_0x5b38,0x90));var _0x85b3=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x5b38[_0x4b174a];return _0x3cd7bf;};'use strict';var pdf=require(_0x85b3('0x0'));var emlformat=require(_0x85b3('0x1'));var rimraf=require(_0x85b3('0x2'));var zipdir=require(_0x85b3('0x3'));var jsonpatch=require(_0x85b3('0x4'));var rp=require(_0x85b3('0x5'));var moment=require(_0x85b3('0x6'));var BPromise=require(_0x85b3('0x7'));var Mustache=require(_0x85b3('0x8'));var util=require(_0x85b3('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x85b3('0xa'));var ejs=require(_0x85b3('0xb'));var fs=require('fs');var _=require(_0x85b3('0xc'));var squel=require(_0x85b3('0xd'));var crypto=require(_0x85b3('0xe'));var jsforce=require(_0x85b3('0xf'));var deskjs=require(_0x85b3('0x10'));var toCsv=require(_0x85b3('0xa'));var querystring=require(_0x85b3('0x11'));var Papa=require(_0x85b3('0x12'));var Redis=require(_0x85b3('0x13'));var authService=require(_0x85b3('0x14'));var qs=require(_0x85b3('0x15'));var as=require(_0x85b3('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x85b3('0x17'))('api');var utils=require(_0x85b3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x85b3('0x19'));var db=require(_0x85b3('0x1a'))['db'];config[_0x85b3('0x1b')]=_[_0x85b3('0x1c')](config[_0x85b3('0x1b')],{'host':_0x85b3('0x1d'),'port':0x18eb});var socket=require(_0x85b3('0x1e'))(new Redis(config[_0x85b3('0x1b')]));require(_0x85b3('0x1f'))[_0x85b3('0x20')](socket);function respondWithStatusCode(_0x2a4441,_0x155a46){_0x155a46=_0x155a46||0xcc;return function(_0x17e201){if(_0x17e201){return _0x2a4441[_0x85b3('0x21')](_0x155a46);}return _0x2a4441[_0x85b3('0x22')](_0x155a46)[_0x85b3('0x23')]();};}function respondWithResult(_0x40dacf,_0x49860a){_0x49860a=_0x49860a||0xc8;return function(_0x36e455){if(_0x36e455){return _0x40dacf[_0x85b3('0x22')](_0x49860a)[_0x85b3('0x24')](_0x36e455);}};}function respondWithFilteredResult(_0x122549,_0x55078f){return function(_0x226737){if(_0x226737){var _0x5ec0a2=_0x226737[_0x85b3('0x25')],_0x5df86a=_0x55078f[_0x85b3('0x26')],_0x2a301a=_0x55078f[_0x85b3('0x26')]+_0x55078f[_0x85b3('0x27')],_0x23a97d;if(_0x2a301a>=_0x5ec0a2){_0x2a301a=_0x5ec0a2;_0x23a97d=0xc8;}else{_0x23a97d=0xce;}_0x122549[_0x85b3('0x22')](_0x23a97d);return _0x122549['set'](_0x85b3('0x28'),_0x5df86a+'-'+_0x2a301a+'/'+_0x5ec0a2)[_0x85b3('0x24')](_0x226737);}return null;};}function patchUpdates(_0x29a481){return function(_0x29fe60){try{jsonpatch[_0x85b3('0x29')](_0x29fe60,_0x29a481,!![]);}catch(_0x3742ba){return BPromise[_0x85b3('0x2a')](_0x3742ba);}return _0x29fe60['save']();};}function saveUpdates(_0x4bbe6a,_0x951c3e){return function(_0x2a67f1){if(_0x2a67f1){return _0x2a67f1[_0x85b3('0x2b')](_0x4bbe6a)[_0x85b3('0x2c')](function(_0x31007d){return _0x31007d;});}return null;};}function removeEntity(_0x1dc0c1,_0x49928d){return function(_0x3bb71d){if(_0x3bb71d){return _0x3bb71d['destroy']()[_0x85b3('0x2c')](function(){_0x1dc0c1[_0x85b3('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3497b9,_0xcc48fe){return function(_0x4f9d88){if(!_0x4f9d88){_0x3497b9[_0x85b3('0x21')](0x194);}return _0x4f9d88;};}function handleError(_0x578e98,_0x247daa){_0x247daa=_0x247daa||0x1f4;return function(_0x475441){logger['error'](_0x475441['stack']);if(_0x475441[_0x85b3('0x2d')]){delete _0x475441[_0x85b3('0x2d')];}_0x578e98[_0x85b3('0x22')](_0x247daa)[_0x85b3('0x2e')](_0x475441);};}exports[_0x85b3('0x2f')]=function(_0x36d5b,_0x43f6dc){var _0x5aa4a7={},_0x2bb600={},_0xe918a9={'count':0x0,'rows':[]};var _0x32e62e=_[_0x85b3('0x30')](db['ChatInternalMessage'][_0x85b3('0x31')],function(_0x425b0c){return{'name':_0x425b0c[_0x85b3('0x32')],'type':_0x425b0c[_0x85b3('0x33')][_0x85b3('0x34')]};});_0x2bb600[_0x85b3('0x35')]=_['map'](_0x32e62e,_0x85b3('0x2d'));_0x2bb600[_0x85b3('0x36')]=_['keys'](_0x36d5b[_0x85b3('0x36')]);_0x2bb600[_0x85b3('0x37')]=_[_0x85b3('0x38')](_0x2bb600[_0x85b3('0x35')],_0x2bb600[_0x85b3('0x36')]);_0x5aa4a7[_0x85b3('0x39')]=_['intersection'](_0x2bb600[_0x85b3('0x35')],qs[_0x85b3('0x3a')](_0x36d5b[_0x85b3('0x36')][_0x85b3('0x3a')]));_0x5aa4a7[_0x85b3('0x39')]=_0x5aa4a7[_0x85b3('0x39')]['length']?_0x5aa4a7[_0x85b3('0x39')]:_0x2bb600[_0x85b3('0x35')];if(!_0x36d5b[_0x85b3('0x36')][_0x85b3('0x3b')]('nolimit')){_0x5aa4a7[_0x85b3('0x27')]=qs['limit'](_0x36d5b[_0x85b3('0x36')][_0x85b3('0x27')]);_0x5aa4a7[_0x85b3('0x26')]=qs[_0x85b3('0x26')](_0x36d5b['query'][_0x85b3('0x26')]);}_0x5aa4a7[_0x85b3('0x3c')]=qs[_0x85b3('0x3d')](_0x36d5b[_0x85b3('0x36')][_0x85b3('0x3d')]);_0x5aa4a7['where']=qs[_0x85b3('0x37')](_[_0x85b3('0x3e')](_0x36d5b[_0x85b3('0x36')],_0x2bb600[_0x85b3('0x37')]),_0x32e62e);if(_0x36d5b[_0x85b3('0x36')][_0x85b3('0x3f')]){_0x5aa4a7[_0x85b3('0x40')]=_['merge'](_0x5aa4a7[_0x85b3('0x40')],{'$or':_[_0x85b3('0x30')](_0x32e62e,function(_0x3fafad){if(_0x3fafad[_0x85b3('0x33')]!=='VIRTUAL'){var _0x1d3820={};_0x1d3820[_0x3fafad['name']]={'$like':'%'+_0x36d5b[_0x85b3('0x36')][_0x85b3('0x3f')]+'%'};return _0x1d3820;}})});}_0x5aa4a7=_[_0x85b3('0x41')]({},_0x5aa4a7,_0x36d5b['options']);var _0x506d14={'where':_0x5aa4a7['where']};return db[_0x85b3('0x42')][_0x85b3('0x25')](_0x506d14)[_0x85b3('0x2c')](function(_0x88f089){_0xe918a9[_0x85b3('0x25')]=_0x88f089;if(_0x36d5b['query'][_0x85b3('0x43')]){_0x5aa4a7[_0x85b3('0x44')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x85b3('0x45')](_0x5aa4a7);})[_0x85b3('0x2c')](function(_0x15214b){_0xe918a9[_0x85b3('0x46')]=_0x15214b;return _0xe918a9;})[_0x85b3('0x2c')](respondWithFilteredResult(_0x43f6dc,_0x5aa4a7))[_0x85b3('0x47')](handleError(_0x43f6dc,null));};exports['show']=function(_0xbe1c6f,_0x3f8162){var _0x2b8f27={'raw':!![],'where':{'id':_0xbe1c6f[_0x85b3('0x48')]['id']}},_0x18aca6={};_0x18aca6[_0x85b3('0x35')]=_[_0x85b3('0x49')](db['ChatInternalMessage']['rawAttributes']);_0x18aca6['query']=_['keys'](_0xbe1c6f['query']);_0x18aca6[_0x85b3('0x4a')]=_['intersection'](_0x18aca6[_0x85b3('0x35')],_0x18aca6[_0x85b3('0x36')]);_0x2b8f27[_0x85b3('0x39')]=_[_0x85b3('0x38')](_0x18aca6[_0x85b3('0x35')],qs[_0x85b3('0x3a')](_0xbe1c6f[_0x85b3('0x36')][_0x85b3('0x3a')]));_0x2b8f27[_0x85b3('0x39')]=_0x2b8f27[_0x85b3('0x39')][_0x85b3('0x4b')]?_0x2b8f27[_0x85b3('0x39')]:_0x18aca6[_0x85b3('0x35')];if(_0xbe1c6f[_0x85b3('0x36')][_0x85b3('0x43')]){_0x2b8f27['include']=[{'all':!![]}];}_0x2b8f27=_[_0x85b3('0x41')]({},_0x2b8f27,_0xbe1c6f[_0x85b3('0x4c')]);return db[_0x85b3('0x42')]['find'](_0x2b8f27)[_0x85b3('0x2c')](handleEntityNotFound(_0x3f8162,null))[_0x85b3('0x2c')](respondWithResult(_0x3f8162,null))[_0x85b3('0x47')](handleError(_0x3f8162,null));};exports[_0x85b3('0x4d')]=function(_0x3689f0,_0x1ae418){return db['ChatInternalMessage'][_0x85b3('0x4d')](_0x3689f0['body'],{})[_0x85b3('0x2c')](respondWithResult(_0x1ae418,0xc9))[_0x85b3('0x47')](handleError(_0x1ae418,null));};exports['update']=function(_0x512760,_0x1f8510){if(_0x512760['body']['id']){delete _0x512760['body']['id'];}return db[_0x85b3('0x42')][_0x85b3('0x4e')]({'where':{'id':_0x512760[_0x85b3('0x48')]['id']}})['then'](handleEntityNotFound(_0x1f8510,null))[_0x85b3('0x2c')](saveUpdates(_0x512760[_0x85b3('0x4f')],null))[_0x85b3('0x2c')](respondWithResult(_0x1f8510,null))[_0x85b3('0x47')](handleError(_0x1f8510,null));};exports[_0x85b3('0x50')]=function(_0x5efe81,_0xb1823a){return db[_0x85b3('0x42')][_0x85b3('0x4e')]({'where':{'id':_0x5efe81['params']['id']}})['then'](handleEntityNotFound(_0xb1823a,null))[_0x85b3('0x2c')](removeEntity(_0xb1823a,null))[_0x85b3('0x47')](handleError(_0xb1823a,null));};exports[_0x85b3('0x51')]=function(_0x412eeb,_0x22b493){return db[_0x85b3('0x42')][_0x85b3('0x51')]()[_0x85b3('0x2c')](respondWithResult(_0x22b493,null))[_0x85b3('0x47')](handleError(_0x22b493,null));};function wrapUser(_0x17dd9f){return function(_0x3ac0de){var _0x437067=_0x17dd9f['get']({'plain':!![]});_0x437067[_0x85b3('0x52')]=[];if(_0x3ac0de){_0x437067[_0x85b3('0x53')]=_0x3ac0de['createdAt'];_0x437067[_0x85b3('0x54')]=_0x3ac0de;}else{_0x437067['lastMessageAt']=moment(0x0)[_0x85b3('0x55')](_0x85b3('0x56'));_0x437067[_0x85b3('0x54')]={};}return _0x437067;};}exports[_0x85b3('0x57')]=function(_0x3574fc,_0x4768ee,_0x2cd4b6){var _0x5afadc=[];return db[_0x85b3('0x58')][_0x85b3('0x45')]({'where':{'role':[_0x85b3('0x59'),_0x85b3('0x5a'),'user']},'attributes':['id',_0x85b3('0x5b'),_0x85b3('0x2d'),_0x85b3('0x5c'),_0x85b3('0x5d'),_0x85b3('0x5e'),_0x85b3('0x5f'),_0x85b3('0x60'),_0x85b3('0x61'),_0x85b3('0x62')],'order':qs[_0x85b3('0x3d')]('-online'),'include':[{'model':db[_0x85b3('0x63')],'as':_0x85b3('0x64'),'attributes':['id','name',_0x85b3('0x33')],'through':{'attributes':[]}}]})['then'](function(_0x5e695b){if(_0x5e695b){var _0x1a5a8a=_0x3574fc['user'][_0x85b3('0x65')]({'plain':!![]});if(!_0x1a5a8a)throw new Error(_0x85b3('0x66'));if(_0x1a5a8a['role']==='user'){return db[_0x85b3('0x67')][_0x85b3('0x4e')]({'where':{'name':'Agents','userProfileId':_0x1a5a8a[_0x85b3('0x68')]},'raw':!![]})['then'](function(_0x3fce71){if(_0x3fce71){if(_0x3fce71[_0x85b3('0x69')]===0x0){return db[_0x85b3('0x6a')][_0x85b3('0x45')]({'where':{'sectionId':_0x3fce71['id']},'raw':!![]})[_0x85b3('0x2c')](function(_0x32cb91){var _0x1f5d9a=[];if(_[_0x85b3('0x6b')](_0x32cb91)){_0x1f5d9a=_[_0x85b3('0x3f')](_0x5e695b,function(_0x44f8a5){if(_0x44f8a5[_0x85b3('0x5c')]!==_0x85b3('0x59')){return _0x44f8a5;}});return _0x1f5d9a;}else{for(var _0x51af6b=0x0;_0x51af6b<_0x5e695b[_0x85b3('0x4b')];_0x51af6b++){var _0xf3e1cf=_0x5e695b[_0x51af6b];if(_0xf3e1cf['role']===_0x85b3('0x59')){var _0x5026f7=_[_0x85b3('0x4e')](_0x32cb91,function(_0x31708d){return _0x31708d[_0x85b3('0x6c')]===_0xf3e1cf['id'];});if(_0x5026f7)_0x1f5d9a[_0x85b3('0x6d')](_0xf3e1cf);}else{_0x1f5d9a[_0x85b3('0x6d')](_0xf3e1cf);}}return _0x1f5d9a;}});}else{return _0x5e695b;}}else{var _0x5c2aed=_[_0x85b3('0x3f')](_0x5e695b,function(_0x3e9862){if(_0x3e9862['role']!==_0x85b3('0x59')){return _0x3e9862;}});return _0x5c2aed;}});}else{return _0x5e695b;}}})[_0x85b3('0x2c')](function(_0x32d41e){var _0x335ccb=[];if(_0x32d41e){_0x5afadc=_0x32d41e;for(var _0x42c79a=0x0;_0x42c79a<_0x32d41e[_0x85b3('0x4b')];_0x42c79a+=0x1){_0x5afadc[_0x42c79a]['messages']=[];_0x335ccb[_0x85b3('0x6d')](db[_0x85b3('0x42')]['find']({'where':{'FromId':[_0x3574fc[_0x85b3('0x6e')]['id'],_0x32d41e[_0x42c79a]['id']],'ToId':[_0x3574fc[_0x85b3('0x6e')]['id'],_0x32d41e[_0x42c79a]['id']],'ChatGroupId':null},'attributes':['id',_0x85b3('0x6f'),_0x85b3('0x70'),_0x85b3('0x71'),_0x85b3('0x72'),_0x85b3('0x4f')],'order':qs[_0x85b3('0x3d')](_0x85b3('0x73')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x85b3('0x2c')](wrapUser(_0x32d41e[_0x42c79a])));}return BPromise[_0x85b3('0x74')](_0x335ccb);}return[];})[_0x85b3('0x2c')](function(_0x268d87){return{'rows':_0x268d87,'count':_0x268d87[_0x85b3('0x4b')]};})[_0x85b3('0x2c')](respondWithResult(_0x4768ee,null))[_0x85b3('0x47')](handleError(_0x4768ee,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 63c143a..94c5a9e 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 _0xa671=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','emit','hasOwnProperty','exports'];(function(_0x14fd8b,_0x517219){var _0xf32e2a=function(_0x21e658){while(--_0x21e658){_0x14fd8b['push'](_0x14fd8b['shift']());}};_0xf32e2a(++_0x517219);}(_0xa671,0x1a4));var _0x1a67=function(_0x231544,_0x592bab){_0x231544=_0x231544-0x0;var _0x3a96df=_0xa671[_0x231544];return _0x3a96df;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x1a67('0x0'))['db'][_0x1a67('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x1a67('0x2')](0x0);var events={'afterCreate':_0x1a67('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2d66be){return function(_0x5310b5,_0x2bea04,_0xe6c632){ChatInternalMessageEvents[_0x1a67('0x4')](_0x2d66be+':'+_0x5310b5['id'],_0x5310b5);ChatInternalMessageEvents[_0x1a67('0x4')](_0x2d66be,_0x5310b5);_0xe6c632(null);};}for(var e in events){if(events[_0x1a67('0x5')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x1a67('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x5e67=['events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit'];(function(_0x41cb53,_0x28e70d){var _0x578936=function(_0x10f09){while(--_0x10f09){_0x41cb53['push'](_0x41cb53['shift']());}};_0x578936(++_0x28e70d);}(_0x5e67,0x70));var _0x75e6=function(_0x5aa36c,_0x389428){_0x5aa36c=_0x5aa36c-0x0;var _0x44db5e=_0x5e67[_0x5aa36c];return _0x44db5e;};'use strict';var EventEmitter=require(_0x75e6('0x0'));var ChatInternalMessage=require(_0x75e6('0x1'))['db'][_0x75e6('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x75e6('0x3')](0x0);var events={'afterCreate':_0x75e6('0x4'),'afterUpdate':_0x75e6('0x5'),'afterDestroy':_0x75e6('0x6')};function emitEvent(_0x2f3320){return function(_0x1dbb1f,_0x3cfdcb,_0x243336){ChatInternalMessageEvents[_0x75e6('0x7')](_0x2f3320+':'+_0x1dbb1f['id'],_0x1dbb1f);ChatInternalMessageEvents['emit'](_0x2f3320,_0x1dbb1f);_0x243336(null);};}for(var e in events){if(events['hasOwnProperty'](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 90a9c16..efd926a 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 _0xbdb7=['define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes'];(function(_0x12e073,_0x4d43db){var _0x267748=function(_0x381284){while(--_0x381284){_0x12e073['push'](_0x12e073['shift']());}};_0x267748(++_0x4d43db);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x3cc563,_0x1598d3){_0x3cc563=_0x3cc563-0x0;var _0x11c044=_0xbdb7[_0x3cc563];return _0x11c044;};'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')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7bdb('0xb'),'collate':_0x7bdb('0xc')});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','../../config/logger','api','moment','bluebird'];(function(_0x26d4d2,_0x196e72){var _0x335121=function(_0x1f6347){while(--_0x1f6347){_0x26d4d2['push'](_0x26d4d2['shift']());}};_0x335121(++_0x196e72);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xcb91[_0x455c6c];return _0x488242;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatInternalMessage',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1cb9('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index d3ed32b..52935aa 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 _0xa59a=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1db2b2,_0x1c686c){var _0x2d61db=function(_0x541164){while(--_0x541164){_0x1db2b2['push'](_0x1db2b2['shift']());}};_0x2d61db(++_0x1c686c);}(_0xa59a,0xf6));var _0xaa59=function(_0xeb4e8d,_0x2d2fdb){_0xeb4e8d=_0xeb4e8d-0x0;var _0x2e855e=_0xa59a[_0xeb4e8d];return _0x2e855e;};'use strict';var _=require(_0xaa59('0x0'));var util=require(_0xaa59('0x1'));var moment=require(_0xaa59('0x2'));var BPromise=require(_0xaa59('0x3'));var rs=require(_0xaa59('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xaa59('0x5'));var logger=require('../../config/logger')(_0xaa59('0x6'));var config=require(_0xaa59('0x7'));var jayson=require(_0xaa59('0x8'));var client=jayson[_0xaa59('0x9')][_0xaa59('0xa')]({'port':0x232a});config[_0xaa59('0xb')]=_[_0xaa59('0xc')](config[_0xaa59('0xb')],{'host':_0xaa59('0xd'),'port':0x18eb});var socket=require(_0xaa59('0xe'))(new Redis(config[_0xaa59('0xb')]));require('./chatInternalMessage.socket')[_0xaa59('0xf')](socket);function respondWithRpcPromise(_0x353d4f,_0x43c49c,_0x2bec0d){return new BPromise(function(_0x32a172,_0x21bc72){return client['request'](_0x353d4f,_0x2bec0d)[_0xaa59('0x10')](function(_0x323e6){logger[_0xaa59('0x11')](_0xaa59('0x12'),_0x43c49c,_0xaa59('0x13'));logger['debug'](_0xaa59('0x14'),_0x43c49c,_0xaa59('0x13'),JSON[_0xaa59('0x15')](_0x323e6));if(_0x323e6[_0xaa59('0x16')]){if(_0x323e6['error'][_0xaa59('0x17')]===0x1f4){logger[_0xaa59('0x16')](_0xaa59('0x12'),_0x43c49c,_0x323e6[_0xaa59('0x16')][_0xaa59('0x18')]);return _0x21bc72(_0x323e6[_0xaa59('0x16')][_0xaa59('0x18')]);}logger[_0xaa59('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x43c49c,_0x323e6['error'][_0xaa59('0x18')]);return _0x32a172(_0x323e6[_0xaa59('0x16')][_0xaa59('0x18')]);}else{logger['info'](_0xaa59('0x12'),_0x43c49c,_0xaa59('0x13'));_0x32a172(_0x323e6[_0xaa59('0x19')]['message']);}})[_0xaa59('0x1a')](function(_0xeba21d){logger[_0xaa59('0x16')](_0xaa59('0x12'),_0x43c49c,_0xeba21d);_0x21bc72(_0xeba21d);});});} \ No newline at end of file +var _0x8415=['request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','./chatInternalMessage.socket'];(function(_0x4087bf,_0x475509){var _0x271594=function(_0x5ab088){while(--_0x5ab088){_0x4087bf['push'](_0x4087bf['shift']());}};_0x271594(++_0x475509);}(_0x8415,0xf0));var _0x5841=function(_0x59cb09,_0x5c764a){_0x59cb09=_0x59cb09-0x0;var _0x2d117e=_0x8415[_0x59cb09];return _0x2d117e;};'use strict';var _=require(_0x5841('0x0'));var util=require(_0x5841('0x1'));var moment=require(_0x5841('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5841('0x3'));var db=require(_0x5841('0x4'))['db'];var utils=require(_0x5841('0x5'));var logger=require(_0x5841('0x6'))(_0x5841('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5841('0x8')]({'port':0x232a});config[_0x5841('0x9')]=_[_0x5841('0xa')](config[_0x5841('0x9')],{'host':_0x5841('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5841('0x9')]));require(_0x5841('0xc'))['register'](socket);function respondWithRpcPromise(_0xd68a5f,_0x301cd5,_0x214751){return new BPromise(function(_0xd4d3be,_0x5c7f97){return client[_0x5841('0xd')](_0xd68a5f,_0x214751)[_0x5841('0xe')](function(_0x25eeba){logger[_0x5841('0xf')](_0x5841('0x10'),_0x301cd5,'request\x20sent');logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x301cd5,_0x5841('0x11'),JSON[_0x5841('0x12')](_0x25eeba));if(_0x25eeba['error']){if(_0x25eeba['error'][_0x5841('0x13')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x301cd5,_0x25eeba[_0x5841('0x14')][_0x5841('0x15')]);return _0x5c7f97(_0x25eeba[_0x5841('0x14')][_0x5841('0x15')]);}logger[_0x5841('0x14')](_0x5841('0x10'),_0x301cd5,_0x25eeba['error'][_0x5841('0x15')]);return _0xd4d3be(_0x25eeba[_0x5841('0x14')][_0x5841('0x15')]);}else{logger['info'](_0x5841('0x10'),_0x301cd5,_0x5841('0x11'));_0xd4d3be(_0x25eeba['result']['message']);}})[_0x5841('0x16')](function(_0x1ba4ed){logger[_0x5841('0x14')](_0x5841('0x10'),_0x301cd5,_0x1ba4ed);_0x5c7f97(_0x1ba4ed);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 1d4fd96..168f8d8 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 _0x40ca=['length','chatInternalMessage:','./chatInternalMessage.events','update','removeListener'];(function(_0x16bf05,_0x4f70da){var _0xbcf546=function(_0x70b01d){while(--_0x70b01d){_0x16bf05['push'](_0x16bf05['shift']());}};_0xbcf546(++_0x4f70da);}(_0x40ca,0x1a1));var _0xa40c=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x40ca[_0x311c35];return _0x5cc50c;};'use strict';var ChatInternalMessageEvents=require(_0xa40c('0x0'));var events=['save','remove',_0xa40c('0x1')];function createListener(_0x80a747,_0x2c7760){return function(_0x1f2731){_0x2c7760['emit'](_0x80a747,_0x1f2731);};}function removeListener(_0x11f66d,_0x4b3c47){return function(){ChatInternalMessageEvents[_0xa40c('0x2')](_0x11f66d,_0x4b3c47);};}exports['register']=function(_0x46eff2){for(var _0x4e1eb2=0x0,_0xee3296=events[_0xa40c('0x3')];_0x4e1eb2<_0xee3296;_0x4e1eb2++){var _0x6fadf3=events[_0x4e1eb2];var _0x444497=createListener(_0xa40c('0x4')+_0x6fadf3,_0x46eff2);ChatInternalMessageEvents['on'](_0x6fadf3,_0x444497);}}; \ No newline at end of file +var _0x3d15=['remove','removeListener','length','save'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3d15,0x127));var _0x53d1=function(_0x1de7d3,_0x50fb04){_0x1de7d3=_0x1de7d3-0x0;var _0x10de57=_0x3d15[_0x1de7d3];return _0x10de57;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x53d1('0x0'),_0x53d1('0x1'),'update'];function createListener(_0x2b5a03,_0x71e505){return function(_0x23f044){_0x71e505['emit'](_0x2b5a03,_0x23f044);};}function removeListener(_0x17f6f3,_0x462ede){return function(){ChatInternalMessageEvents[_0x53d1('0x2')](_0x17f6f3,_0x462ede);};}exports['register']=function(_0x3b3e81){for(var _0x74eec6=0x0,_0x4b4385=events[_0x53d1('0x3')];_0x74eec6<_0x4b4385;_0x74eec6++){var _0x32dfe1=events[_0x74eec6];var _0x1c4833=createListener('chatInternalMessage:'+_0x32dfe1,_0x3b3e81);ChatInternalMessageEvents['on'](_0x32dfe1,_0x1c4833);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index bf4a462..c55ed47 100644 --- a/server/api/chatInternalMessage/index.js +++ b/server/api/chatInternalMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/users','isAuthenticated','getUsers','/:id','post','create','put','update','delete','destroy'];(function(_0x405466,_0x564eac){var _0x766e4e=function(_0xc3ebbf){while(--_0xc3ebbf){_0x405466['push'](_0x405466['shift']());}};_0x766e4e(++_0x564eac);}(_0x70e0,0x17b));var _0x070e=function(_0x2c292c,_0x2a1035){_0x2c292c=_0x2c292c-0x0;var _0x15abd2=_0x70e0[_0x2c292c];return _0x15abd2;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./chatInternalMessage.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0x7')](_0x070e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x070e('0xe')]('/',auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xd'),controller[_0x070e('0x11')]);router[_0x070e('0x12')](_0x070e('0xd'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);module[_0x070e('0x14')]=router; \ No newline at end of file +var _0xe706=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x2a1e59,_0x29bd8d){var _0x47cff6=function(_0x1e36fd){while(--_0x1e36fd){_0x2a1e59['push'](_0x2a1e59['shift']());}};_0x47cff6(++_0x29bd8d);}(_0xe706,0xa3));var _0x6e70=function(_0x7aad15,_0x5e7f){_0x7aad15=_0x7aad15-0x0;var _0x420c7e=_0xe706[_0x7aad15];return _0x420c7e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x9')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x12')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router['put']('/:id',controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);module[_0x6e70('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 322d5e8..d57b141 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 _0x4fd7=['exports','TEXT','BOOLEAN','ENUM','out','sequelize'];(function(_0x59afa4,_0x10b02b){var _0x59999e=function(_0x106392){while(--_0x106392){_0x59afa4['push'](_0x59afa4['shift']());}};_0x59999e(++_0x10b02b);}(_0x4fd7,0x89));var _0x74fd=function(_0x1b3609,_0x5e90c3){_0x1b3609=_0x1b3609-0x0;var _0x13860c=_0x4fd7[_0x1b3609];return _0x13860c;};'use strict';var Sequelize=require(_0x74fd('0x0'));module[_0x74fd('0x1')]={'body':{'type':Sequelize[_0x74fd('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x74fd('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x74fd('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x74fd('0x4')]('in',_0x74fd('0x5')),'defaultValue':_0x74fd('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x688b=['exports','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x688b,0x1db));var _0xb688=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0x688b[_0x43776a];return _0x18eb8f;};'use strict';var Sequelize=require(_0xb688('0x0'));module[_0xb688('0x1')]={'body':{'type':Sequelize['TEXT'](_0xb688('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb688('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb688('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb688('0x4')]('in','out'),'defaultValue':_0xb688('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xb688('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index f27f5ad..4a1c58e 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 _0xd8b0=['options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','../../config/logger','agent','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','reject','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','count','offset','limit','apply','save','update','destroy','end','stack','name','send','index','ChatMessage','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL'];(function(_0xddafd9,_0xa70154){var _0x53534b=function(_0x201dc3){while(--_0x201dc3){_0xddafd9['push'](_0xddafd9['shift']());}};_0x53534b(++_0xa70154);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var licenseUtil=require(_0x0d8b('0x15'));var db=require(_0x0d8b('0x16'))['db'];config[_0x0d8b('0x17')]=_[_0x0d8b('0x18')](config[_0x0d8b('0x17')],{'host':_0x0d8b('0x19'),'port':0x18eb});var socket=require(_0x0d8b('0x1a'))(new Redis(config[_0x0d8b('0x17')]));require(_0x0d8b('0x1b'))[_0x0d8b('0x1c')](socket);var jayson=require(_0x0d8b('0x1d'));var client=jayson[_0x0d8b('0x1e')][_0x0d8b('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x0d8b('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xa86349,_0x17f7df,_0xe2e167,_0x2cb03c){return new BPromise(function(_0x5cd485,_0x106a01){var _0x4586c2=_0x2cb03c||client;return _0x4586c2[_0x0d8b('0x20')](_0xa86349,_0xe2e167)[_0x0d8b('0x21')](function(_0x333674){logger[_0x0d8b('0x22')](_0x0d8b('0x23'),_0x17f7df,_0x0d8b('0x24'));logger['debug'](_0x0d8b('0x25'),_0x17f7df,_0x0d8b('0x24'),JSON[_0x0d8b('0x26')](_0x333674));if(_0x333674[_0x0d8b('0x27')]){if(_0x333674[_0x0d8b('0x27')][_0x0d8b('0x28')]===0x1f4){logger[_0x0d8b('0x27')](_0x0d8b('0x23'),_0x17f7df,_0x333674['error']['message']);return _0x106a01(_0x333674[_0x0d8b('0x27')]['message']);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x17f7df,_0x333674[_0x0d8b('0x27')][_0x0d8b('0x29')]);return _0x5cd485(_0x333674[_0x0d8b('0x27')][_0x0d8b('0x29')]);}else{logger[_0x0d8b('0x22')](_0x0d8b('0x23'),_0x17f7df,_0x0d8b('0x24'));_0x5cd485(_0x333674[_0x0d8b('0x2a')][_0x0d8b('0x29')]);}})['catch'](function(_0xe8bbee){logger[_0x0d8b('0x27')]('ChatMessage,\x20%s,\x20%s',_0x17f7df,_0xe8bbee);_0x106a01(_0xe8bbee);});});}function respondWithStatusCode(_0xe1ef20,_0x4a0ae4){_0x4a0ae4=_0x4a0ae4||0xcc;return function(_0x3dd149){if(_0x3dd149){return _0xe1ef20[_0x0d8b('0x2b')](_0x4a0ae4);}return _0xe1ef20[_0x0d8b('0x2c')](_0x4a0ae4)['end']();};}function respondWithResult(_0x59a905,_0x28f639){_0x28f639=_0x28f639||0xc8;return function(_0x3ef745){if(_0x3ef745){return _0x59a905['status'](_0x28f639)[_0x0d8b('0x2d')](_0x3ef745);}};}function respondWithFilteredResult(_0x59aa83,_0x1b2b59){return function(_0x4b59e5){if(_0x4b59e5){var _0x97050a=_0x4b59e5[_0x0d8b('0x2e')],_0x48f24f=_0x1b2b59['offset'],_0x2ab00d=_0x1b2b59[_0x0d8b('0x2f')]+_0x1b2b59[_0x0d8b('0x30')],_0x546bf6;if(_0x2ab00d>=_0x97050a){_0x2ab00d=_0x97050a;_0x546bf6=0xc8;}else{_0x546bf6=0xce;}_0x59aa83[_0x0d8b('0x2c')](_0x546bf6);return _0x59aa83['set']('Content-Range',_0x48f24f+'-'+_0x2ab00d+'/'+_0x97050a)['json'](_0x4b59e5);}return null;};}function patchUpdates(_0x4e8992){return function(_0x5515d2){try{jsonpatch[_0x0d8b('0x31')](_0x5515d2,_0x4e8992,!![]);}catch(_0x54f6f3){return BPromise['reject'](_0x54f6f3);}return _0x5515d2[_0x0d8b('0x32')]();};}function saveUpdates(_0x1b6920,_0x109c14){return function(_0xdeee5d){if(_0xdeee5d){return _0xdeee5d[_0x0d8b('0x33')](_0x1b6920)[_0x0d8b('0x21')](function(_0x4a99d3){return _0x4a99d3;});}return null;};}function removeEntity(_0x6f93c7,_0x553e03){return function(_0x37ca42){if(_0x37ca42){return _0x37ca42[_0x0d8b('0x34')]()['then'](function(){_0x6f93c7[_0x0d8b('0x2c')](0xcc)[_0x0d8b('0x35')]();});}};}function handleEntityNotFound(_0x18a905,_0x4f2ed2){return function(_0x113318){if(!_0x113318){_0x18a905[_0x0d8b('0x2b')](0x194);}return _0x113318;};}function handleError(_0x206157,_0x31ceba){_0x31ceba=_0x31ceba||0x1f4;return function(_0x933e01){logger['error'](_0x933e01[_0x0d8b('0x36')]);if(_0x933e01[_0x0d8b('0x37')]){delete _0x933e01['name'];}_0x206157[_0x0d8b('0x2c')](_0x31ceba)[_0x0d8b('0x38')](_0x933e01);};}exports[_0x0d8b('0x39')]=function(_0x974b9b,_0x373544){var _0x519088={},_0x497a71={},_0x41b4f9={'count':0x0,'rows':[]};var _0x5c2c04=_['map'](db[_0x0d8b('0x3a')][_0x0d8b('0x3b')],function(_0x15ec8a){return{'name':_0x15ec8a[_0x0d8b('0x3c')],'type':_0x15ec8a[_0x0d8b('0x3d')][_0x0d8b('0x3e')]};});_0x497a71['model']=_[_0x0d8b('0x3f')](_0x5c2c04,_0x0d8b('0x37'));_0x497a71[_0x0d8b('0x40')]=_[_0x0d8b('0x41')](_0x974b9b[_0x0d8b('0x40')]);_0x497a71[_0x0d8b('0x42')]=_[_0x0d8b('0x43')](_0x497a71['model'],_0x497a71[_0x0d8b('0x40')]);_0x519088[_0x0d8b('0x44')]=_[_0x0d8b('0x43')](_0x497a71[_0x0d8b('0x45')],qs['fields'](_0x974b9b[_0x0d8b('0x40')]['fields']));_0x519088[_0x0d8b('0x44')]=_0x519088[_0x0d8b('0x44')][_0x0d8b('0x46')]?_0x519088[_0x0d8b('0x44')]:_0x497a71[_0x0d8b('0x45')];if(!_0x974b9b[_0x0d8b('0x40')][_0x0d8b('0x47')](_0x0d8b('0x48'))){_0x519088[_0x0d8b('0x30')]=qs[_0x0d8b('0x30')](_0x974b9b['query']['limit']);_0x519088['offset']=qs['offset'](_0x974b9b['query'][_0x0d8b('0x2f')]);}_0x519088[_0x0d8b('0x49')]=qs[_0x0d8b('0x4a')](_0x974b9b['query']['sort']);_0x519088[_0x0d8b('0x4b')]=qs[_0x0d8b('0x42')](_[_0x0d8b('0x4c')](_0x974b9b['query'],_0x497a71[_0x0d8b('0x42')]),_0x5c2c04);if(_0x974b9b[_0x0d8b('0x40')]['filter']){_0x519088['where']=_[_0x0d8b('0x4d')](_0x519088['where'],{'$or':_[_0x0d8b('0x3f')](_0x5c2c04,function(_0x5a96b1){if(_0x5a96b1['type']!==_0x0d8b('0x4e')){var _0x194f17={};_0x194f17[_0x5a96b1['name']]={'$like':'%'+_0x974b9b['query']['filter']+'%'};return _0x194f17;}})});}_0x519088=_['merge']({},_0x519088,_0x974b9b[_0x0d8b('0x4f')]);var _0x1e0498={'where':_0x519088[_0x0d8b('0x4b')]};return db['ChatMessage'][_0x0d8b('0x2e')](_0x1e0498)[_0x0d8b('0x21')](function(_0x27affa){_0x41b4f9[_0x0d8b('0x2e')]=_0x27affa;if(_0x974b9b[_0x0d8b('0x40')][_0x0d8b('0x50')]){_0x519088[_0x0d8b('0x51')]=[{'all':!![]}];}return db[_0x0d8b('0x3a')][_0x0d8b('0x52')](_0x519088);})[_0x0d8b('0x21')](function(_0x44d54b){_0x41b4f9[_0x0d8b('0x53')]=_0x44d54b;return _0x41b4f9;})[_0x0d8b('0x21')](respondWithFilteredResult(_0x373544,_0x519088))[_0x0d8b('0x54')](handleError(_0x373544,null));};exports[_0x0d8b('0x55')]=function(_0xdfcf32,_0x245325){var _0x1e162c={'raw':!![],'where':{'id':_0xdfcf32['params']['id']}},_0x408bc5={};_0x408bc5[_0x0d8b('0x45')]=_['keys'](db['ChatMessage'][_0x0d8b('0x3b')]);_0x408bc5[_0x0d8b('0x40')]=_[_0x0d8b('0x41')](_0xdfcf32[_0x0d8b('0x40')]);_0x408bc5['filtears']=_[_0x0d8b('0x43')](_0x408bc5[_0x0d8b('0x45')],_0x408bc5[_0x0d8b('0x40')]);_0x1e162c[_0x0d8b('0x44')]=_[_0x0d8b('0x43')](_0x408bc5['model'],qs['fields'](_0xdfcf32['query']['fields']));_0x1e162c[_0x0d8b('0x44')]=_0x1e162c[_0x0d8b('0x44')]['length']?_0x1e162c['attributes']:_0x408bc5[_0x0d8b('0x45')];if(_0xdfcf32[_0x0d8b('0x40')]['includeAll']){_0x1e162c['include']=[{'all':!![]}];}_0x1e162c=_[_0x0d8b('0x4d')]({},_0x1e162c,_0xdfcf32[_0x0d8b('0x4f')]);return db[_0x0d8b('0x3a')][_0x0d8b('0x56')](_0x1e162c)[_0x0d8b('0x21')](handleEntityNotFound(_0x245325,null))['then'](respondWithResult(_0x245325,null))[_0x0d8b('0x54')](handleError(_0x245325,null));};exports[_0x0d8b('0x57')]=function(_0x5481fc,_0x580580){return db[_0x0d8b('0x3a')][_0x0d8b('0x57')](_0x5481fc['body'],{})['then'](respondWithResult(_0x580580,0xc9))[_0x0d8b('0x54')](handleError(_0x580580,null));};exports[_0x0d8b('0x33')]=function(_0x377027,_0xb58818){if(_0x377027['body']['id']){delete _0x377027[_0x0d8b('0x58')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x377027[_0x0d8b('0x59')]['id']}})[_0x0d8b('0x21')](handleEntityNotFound(_0xb58818,null))['then'](saveUpdates(_0x377027['body'],null))[_0x0d8b('0x21')](respondWithResult(_0xb58818,null))[_0x0d8b('0x54')](handleError(_0xb58818,null));};exports[_0x0d8b('0x34')]=function(_0x2c1eb0,_0x3afc3a){return db[_0x0d8b('0x3a')][_0x0d8b('0x56')]({'where':{'id':_0x2c1eb0[_0x0d8b('0x59')]['id']}})['then'](handleEntityNotFound(_0x3afc3a,null))[_0x0d8b('0x21')](removeEntity(_0x3afc3a,null))[_0x0d8b('0x54')](handleError(_0x3afc3a,null));};exports[_0x0d8b('0x5a')]=function(_0x3c7efb,_0x3fb9ea){return db[_0x0d8b('0x3a')][_0x0d8b('0x5a')]()[_0x0d8b('0x21')](respondWithResult(_0x3fb9ea,null))[_0x0d8b('0x54')](handleError(_0x3fb9ea,null));};var interaction_log=require('../../config/logger')(_0x0d8b('0x5b'));exports[_0x0d8b('0x5c')]=function(_0x180b7b,_0x23de9e,_0x43ad22){var _0x577951={'channel':_0x0d8b('0x5d')};if(_0x180b7b[_0x0d8b('0x58')]['id']){delete _0x180b7b[_0x0d8b('0x58')]['id'];}_0x180b7b[_0x0d8b('0x58')][_0x0d8b('0x5e')]=!![];_0x180b7b['body']['readAt']=moment()[_0x0d8b('0x5f')](_0x0d8b('0x60'));_0x180b7b[_0x0d8b('0x58')][_0x0d8b('0x61')]=_0x180b7b['body'][_0x0d8b('0x61')]||_0x180b7b[_0x0d8b('0x62')]['id'];return db[_0x0d8b('0x3a')]['find']({'where':{'id':_0x180b7b[_0x0d8b('0x59')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x0d8b('0x63')}]})[_0x0d8b('0x21')](handleEntityNotFound(_0x23de9e,null))[_0x0d8b('0x21')](saveUpdates(_0x180b7b[_0x0d8b('0x58')],null))[_0x0d8b('0x21')](function(_0x3ce373){if(_0x3ce373){_0x577951['message']=_0x3ce373[_0x0d8b('0x64')]({'plain':!![]});return db['ChatInteraction'][_0x0d8b('0x56')]({'where':{'id':_0x3ce373[_0x0d8b('0x65')]}});}return null;})[_0x0d8b('0x21')](handleEntityNotFound(_0x23de9e,null))[_0x0d8b('0x21')](function(_0x48025e){if(_0x48025e){return _0x48025e[_0x0d8b('0x33')]({'UserId':_0x180b7b[_0x0d8b('0x58')][_0x0d8b('0x61')],'read1stAt':_[_0x0d8b('0x66')](_0x48025e[_0x0d8b('0x67')])?moment()[_0x0d8b('0x5f')](_0x0d8b('0x60')):undefined});}return null;})[_0x0d8b('0x21')](function(_0x2ce282){if(_0x2ce282){_0x577951[_0x0d8b('0x68')]=_0x2ce282['get']({'plain':!![]});interaction_log['info'](_0x0d8b('0x69'),_0x180b7b[_0x0d8b('0x62')]['id'],_0x180b7b['user'][_0x0d8b('0x37')],_0x180b7b['user']['role'],_0x577951[_0x0d8b('0x68')]['id'],_0x180b7b[_0x0d8b('0x58')]?JSON['stringify'](_0x180b7b['body']):_0x0d8b('0x6a'));return respondWithRpcPromise(_0x0d8b('0x6b'),_0x0d8b('0x6c'),_0x577951);}return null;})[_0x0d8b('0x21')](function(_0x2ab72b){if(_0x2ab72b){if(_0x180b7b[_0x0d8b('0x58')][_0x0d8b('0x6d')]){_0x577951['message'][_0x0d8b('0x6e')]=util['format'](_0x0d8b('0x6f'),_0x180b7b[_0x0d8b('0x62')][_0x0d8b('0x37')]);_0x577951[_0x0d8b('0x29')]['channel']=_0x577951[_0x0d8b('0x70')];_0x577951['message'][_0x0d8b('0x71')]=_0x0d8b('0x5c');return respondWithRpcPromise(_0x0d8b('0x72'),_0x0d8b('0x72'),{'event':_0x0d8b('0x73'),'message':_[_0x0d8b('0x4d')](_0x577951[_0x0d8b('0x29')],JSON[_0x0d8b('0x74')](_0x577951[_0x0d8b('0x68')][_0x0d8b('0x75')]))},client9002)['then'](function(){return _0x577951;});}return _0x577951;}return null;})[_0x0d8b('0x21')](respondWithResult(_0x23de9e,null))['catch'](handleError(_0x23de9e,null));};var interaction_log=require(_0x0d8b('0x76'))(_0x0d8b('0x5b'));exports['reject']=function(_0x1a62b9,_0x56e03c,_0x10c318){var _0x445a00={'agent':{},'channel':_0x0d8b('0x5d')};if(_0x1a62b9[_0x0d8b('0x58')]['id']){delete _0x1a62b9[_0x0d8b('0x58')]['id'];}_0x1a62b9[_0x0d8b('0x58')][_0x0d8b('0x61')]=_0x1a62b9[_0x0d8b('0x58')]['UserId']||_0x1a62b9[_0x0d8b('0x62')]['id'];_0x445a00[_0x0d8b('0x77')]['id']=_0x1a62b9['body'][_0x0d8b('0x61')];return db[_0x0d8b('0x3a')][_0x0d8b('0x56')]({'where':{'id':_0x1a62b9[_0x0d8b('0x59')]['id'],'UserId':null}})[_0x0d8b('0x21')](handleEntityNotFound(_0x56e03c,null))[_0x0d8b('0x21')](function(_0x40ff07){if(_0x40ff07){_0x445a00[_0x0d8b('0x29')]=_0x40ff07[_0x0d8b('0x64')]({'plain':!![]});return db[_0x0d8b('0x78')][_0x0d8b('0x56')]({'where':{'id':_0x40ff07[_0x0d8b('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x56e03c,null))[_0x0d8b('0x21')](function(_0x93fc55){if(_0x93fc55){_0x445a00[_0x0d8b('0x68')]=_0x93fc55['get']({'plain':!![]});interaction_log['info'](_0x0d8b('0x79'),_0x1a62b9[_0x0d8b('0x62')]['id'],_0x1a62b9[_0x0d8b('0x62')]['name'],_0x1a62b9['user'][_0x0d8b('0x7a')],_0x445a00[_0x0d8b('0x68')]['id'],_0x1a62b9[_0x0d8b('0x58')]?JSON[_0x0d8b('0x26')](_0x1a62b9[_0x0d8b('0x58')]):_0x0d8b('0x6a'));return respondWithRpcPromise(_0x0d8b('0x7b'),_0x0d8b('0x7c'),_0x445a00);}return null;})[_0x0d8b('0x21')](function(_0x3a5aea){if(_0x3a5aea){_0x3a5aea[_0x0d8b('0x29')][_0x0d8b('0x6e')]=util[_0x0d8b('0x5f')]('SIP/%s',_0x1a62b9[_0x0d8b('0x62')][_0x0d8b('0x37')]);_0x3a5aea['message']['channel']=_0x445a00[_0x0d8b('0x70')];_0x3a5aea[_0x0d8b('0x29')][_0x0d8b('0x71')]=_0x0d8b('0x7d');respondWithRpcPromise(_0x0d8b('0x72'),_0x0d8b('0x72'),{'event':'rejectmessage','message':_0x3a5aea['message']},client9002);return _0x445a00;}return null;})['then'](respondWithResult(_0x56e03c,null))[_0x0d8b('0x54')](handleError(_0x56e03c,null));}; \ No newline at end of file +var _0xd8b0=['options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','../../config/logger','agent','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','reject','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','count','offset','limit','apply','save','update','destroy','end','stack','name','send','index','ChatMessage','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL'];(function(_0x48ae1d,_0x46b91e){var _0x58fa63=function(_0x54bbbc){while(--_0x54bbbc){_0x48ae1d['push'](_0x48ae1d['shift']());}};_0x58fa63(++_0x46b91e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var licenseUtil=require(_0x0d8b('0x15'));var db=require(_0x0d8b('0x16'))['db'];config[_0x0d8b('0x17')]=_[_0x0d8b('0x18')](config[_0x0d8b('0x17')],{'host':_0x0d8b('0x19'),'port':0x18eb});var socket=require(_0x0d8b('0x1a'))(new Redis(config[_0x0d8b('0x17')]));require(_0x0d8b('0x1b'))[_0x0d8b('0x1c')](socket);var jayson=require(_0x0d8b('0x1d'));var client=jayson[_0x0d8b('0x1e')][_0x0d8b('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x0d8b('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xa86349,_0x17f7df,_0xe2e167,_0x2cb03c){return new BPromise(function(_0x5cd485,_0x106a01){var _0x4586c2=_0x2cb03c||client;return _0x4586c2[_0x0d8b('0x20')](_0xa86349,_0xe2e167)[_0x0d8b('0x21')](function(_0x333674){logger[_0x0d8b('0x22')](_0x0d8b('0x23'),_0x17f7df,_0x0d8b('0x24'));logger['debug'](_0x0d8b('0x25'),_0x17f7df,_0x0d8b('0x24'),JSON[_0x0d8b('0x26')](_0x333674));if(_0x333674[_0x0d8b('0x27')]){if(_0x333674[_0x0d8b('0x27')][_0x0d8b('0x28')]===0x1f4){logger[_0x0d8b('0x27')](_0x0d8b('0x23'),_0x17f7df,_0x333674['error']['message']);return _0x106a01(_0x333674[_0x0d8b('0x27')]['message']);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x17f7df,_0x333674[_0x0d8b('0x27')][_0x0d8b('0x29')]);return _0x5cd485(_0x333674[_0x0d8b('0x27')][_0x0d8b('0x29')]);}else{logger[_0x0d8b('0x22')](_0x0d8b('0x23'),_0x17f7df,_0x0d8b('0x24'));_0x5cd485(_0x333674[_0x0d8b('0x2a')][_0x0d8b('0x29')]);}})['catch'](function(_0xe8bbee){logger[_0x0d8b('0x27')]('ChatMessage,\x20%s,\x20%s',_0x17f7df,_0xe8bbee);_0x106a01(_0xe8bbee);});});}function respondWithStatusCode(_0xe1ef20,_0x4a0ae4){_0x4a0ae4=_0x4a0ae4||0xcc;return function(_0x3dd149){if(_0x3dd149){return _0xe1ef20[_0x0d8b('0x2b')](_0x4a0ae4);}return _0xe1ef20[_0x0d8b('0x2c')](_0x4a0ae4)['end']();};}function respondWithResult(_0x59a905,_0x28f639){_0x28f639=_0x28f639||0xc8;return function(_0x3ef745){if(_0x3ef745){return _0x59a905['status'](_0x28f639)[_0x0d8b('0x2d')](_0x3ef745);}};}function respondWithFilteredResult(_0x59aa83,_0x1b2b59){return function(_0x4b59e5){if(_0x4b59e5){var _0x97050a=_0x4b59e5[_0x0d8b('0x2e')],_0x48f24f=_0x1b2b59['offset'],_0x2ab00d=_0x1b2b59[_0x0d8b('0x2f')]+_0x1b2b59[_0x0d8b('0x30')],_0x546bf6;if(_0x2ab00d>=_0x97050a){_0x2ab00d=_0x97050a;_0x546bf6=0xc8;}else{_0x546bf6=0xce;}_0x59aa83[_0x0d8b('0x2c')](_0x546bf6);return _0x59aa83['set']('Content-Range',_0x48f24f+'-'+_0x2ab00d+'/'+_0x97050a)['json'](_0x4b59e5);}return null;};}function patchUpdates(_0x4e8992){return function(_0x5515d2){try{jsonpatch[_0x0d8b('0x31')](_0x5515d2,_0x4e8992,!![]);}catch(_0x54f6f3){return BPromise['reject'](_0x54f6f3);}return _0x5515d2[_0x0d8b('0x32')]();};}function saveUpdates(_0x1b6920,_0x109c14){return function(_0xdeee5d){if(_0xdeee5d){return _0xdeee5d[_0x0d8b('0x33')](_0x1b6920)[_0x0d8b('0x21')](function(_0x4a99d3){return _0x4a99d3;});}return null;};}function removeEntity(_0x6f93c7,_0x553e03){return function(_0x37ca42){if(_0x37ca42){return _0x37ca42[_0x0d8b('0x34')]()['then'](function(){_0x6f93c7[_0x0d8b('0x2c')](0xcc)[_0x0d8b('0x35')]();});}};}function handleEntityNotFound(_0x18a905,_0x4f2ed2){return function(_0x113318){if(!_0x113318){_0x18a905[_0x0d8b('0x2b')](0x194);}return _0x113318;};}function handleError(_0x206157,_0x31ceba){_0x31ceba=_0x31ceba||0x1f4;return function(_0x933e01){logger['error'](_0x933e01[_0x0d8b('0x36')]);if(_0x933e01[_0x0d8b('0x37')]){delete _0x933e01['name'];}_0x206157[_0x0d8b('0x2c')](_0x31ceba)[_0x0d8b('0x38')](_0x933e01);};}exports[_0x0d8b('0x39')]=function(_0x974b9b,_0x373544){var _0x519088={},_0x497a71={},_0x41b4f9={'count':0x0,'rows':[]};var _0x5c2c04=_['map'](db[_0x0d8b('0x3a')][_0x0d8b('0x3b')],function(_0x15ec8a){return{'name':_0x15ec8a[_0x0d8b('0x3c')],'type':_0x15ec8a[_0x0d8b('0x3d')][_0x0d8b('0x3e')]};});_0x497a71['model']=_[_0x0d8b('0x3f')](_0x5c2c04,_0x0d8b('0x37'));_0x497a71[_0x0d8b('0x40')]=_[_0x0d8b('0x41')](_0x974b9b[_0x0d8b('0x40')]);_0x497a71[_0x0d8b('0x42')]=_[_0x0d8b('0x43')](_0x497a71['model'],_0x497a71[_0x0d8b('0x40')]);_0x519088[_0x0d8b('0x44')]=_[_0x0d8b('0x43')](_0x497a71[_0x0d8b('0x45')],qs['fields'](_0x974b9b[_0x0d8b('0x40')]['fields']));_0x519088[_0x0d8b('0x44')]=_0x519088[_0x0d8b('0x44')][_0x0d8b('0x46')]?_0x519088[_0x0d8b('0x44')]:_0x497a71[_0x0d8b('0x45')];if(!_0x974b9b[_0x0d8b('0x40')][_0x0d8b('0x47')](_0x0d8b('0x48'))){_0x519088[_0x0d8b('0x30')]=qs[_0x0d8b('0x30')](_0x974b9b['query']['limit']);_0x519088['offset']=qs['offset'](_0x974b9b['query'][_0x0d8b('0x2f')]);}_0x519088[_0x0d8b('0x49')]=qs[_0x0d8b('0x4a')](_0x974b9b['query']['sort']);_0x519088[_0x0d8b('0x4b')]=qs[_0x0d8b('0x42')](_[_0x0d8b('0x4c')](_0x974b9b['query'],_0x497a71[_0x0d8b('0x42')]),_0x5c2c04);if(_0x974b9b[_0x0d8b('0x40')]['filter']){_0x519088['where']=_[_0x0d8b('0x4d')](_0x519088['where'],{'$or':_[_0x0d8b('0x3f')](_0x5c2c04,function(_0x5a96b1){if(_0x5a96b1['type']!==_0x0d8b('0x4e')){var _0x194f17={};_0x194f17[_0x5a96b1['name']]={'$like':'%'+_0x974b9b['query']['filter']+'%'};return _0x194f17;}})});}_0x519088=_['merge']({},_0x519088,_0x974b9b[_0x0d8b('0x4f')]);var _0x1e0498={'where':_0x519088[_0x0d8b('0x4b')]};return db['ChatMessage'][_0x0d8b('0x2e')](_0x1e0498)[_0x0d8b('0x21')](function(_0x27affa){_0x41b4f9[_0x0d8b('0x2e')]=_0x27affa;if(_0x974b9b[_0x0d8b('0x40')][_0x0d8b('0x50')]){_0x519088[_0x0d8b('0x51')]=[{'all':!![]}];}return db[_0x0d8b('0x3a')][_0x0d8b('0x52')](_0x519088);})[_0x0d8b('0x21')](function(_0x44d54b){_0x41b4f9[_0x0d8b('0x53')]=_0x44d54b;return _0x41b4f9;})[_0x0d8b('0x21')](respondWithFilteredResult(_0x373544,_0x519088))[_0x0d8b('0x54')](handleError(_0x373544,null));};exports[_0x0d8b('0x55')]=function(_0xdfcf32,_0x245325){var _0x1e162c={'raw':!![],'where':{'id':_0xdfcf32['params']['id']}},_0x408bc5={};_0x408bc5[_0x0d8b('0x45')]=_['keys'](db['ChatMessage'][_0x0d8b('0x3b')]);_0x408bc5[_0x0d8b('0x40')]=_[_0x0d8b('0x41')](_0xdfcf32[_0x0d8b('0x40')]);_0x408bc5['filtears']=_[_0x0d8b('0x43')](_0x408bc5[_0x0d8b('0x45')],_0x408bc5[_0x0d8b('0x40')]);_0x1e162c[_0x0d8b('0x44')]=_[_0x0d8b('0x43')](_0x408bc5['model'],qs['fields'](_0xdfcf32['query']['fields']));_0x1e162c[_0x0d8b('0x44')]=_0x1e162c[_0x0d8b('0x44')]['length']?_0x1e162c['attributes']:_0x408bc5[_0x0d8b('0x45')];if(_0xdfcf32[_0x0d8b('0x40')]['includeAll']){_0x1e162c['include']=[{'all':!![]}];}_0x1e162c=_[_0x0d8b('0x4d')]({},_0x1e162c,_0xdfcf32[_0x0d8b('0x4f')]);return db[_0x0d8b('0x3a')][_0x0d8b('0x56')](_0x1e162c)[_0x0d8b('0x21')](handleEntityNotFound(_0x245325,null))['then'](respondWithResult(_0x245325,null))[_0x0d8b('0x54')](handleError(_0x245325,null));};exports[_0x0d8b('0x57')]=function(_0x5481fc,_0x580580){return db[_0x0d8b('0x3a')][_0x0d8b('0x57')](_0x5481fc['body'],{})['then'](respondWithResult(_0x580580,0xc9))[_0x0d8b('0x54')](handleError(_0x580580,null));};exports[_0x0d8b('0x33')]=function(_0x377027,_0xb58818){if(_0x377027['body']['id']){delete _0x377027[_0x0d8b('0x58')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x377027[_0x0d8b('0x59')]['id']}})[_0x0d8b('0x21')](handleEntityNotFound(_0xb58818,null))['then'](saveUpdates(_0x377027['body'],null))[_0x0d8b('0x21')](respondWithResult(_0xb58818,null))[_0x0d8b('0x54')](handleError(_0xb58818,null));};exports[_0x0d8b('0x34')]=function(_0x2c1eb0,_0x3afc3a){return db[_0x0d8b('0x3a')][_0x0d8b('0x56')]({'where':{'id':_0x2c1eb0[_0x0d8b('0x59')]['id']}})['then'](handleEntityNotFound(_0x3afc3a,null))[_0x0d8b('0x21')](removeEntity(_0x3afc3a,null))[_0x0d8b('0x54')](handleError(_0x3afc3a,null));};exports[_0x0d8b('0x5a')]=function(_0x3c7efb,_0x3fb9ea){return db[_0x0d8b('0x3a')][_0x0d8b('0x5a')]()[_0x0d8b('0x21')](respondWithResult(_0x3fb9ea,null))[_0x0d8b('0x54')](handleError(_0x3fb9ea,null));};var interaction_log=require('../../config/logger')(_0x0d8b('0x5b'));exports[_0x0d8b('0x5c')]=function(_0x180b7b,_0x23de9e,_0x43ad22){var _0x577951={'channel':_0x0d8b('0x5d')};if(_0x180b7b[_0x0d8b('0x58')]['id']){delete _0x180b7b[_0x0d8b('0x58')]['id'];}_0x180b7b[_0x0d8b('0x58')][_0x0d8b('0x5e')]=!![];_0x180b7b['body']['readAt']=moment()[_0x0d8b('0x5f')](_0x0d8b('0x60'));_0x180b7b[_0x0d8b('0x58')][_0x0d8b('0x61')]=_0x180b7b['body'][_0x0d8b('0x61')]||_0x180b7b[_0x0d8b('0x62')]['id'];return db[_0x0d8b('0x3a')]['find']({'where':{'id':_0x180b7b[_0x0d8b('0x59')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x0d8b('0x63')}]})[_0x0d8b('0x21')](handleEntityNotFound(_0x23de9e,null))[_0x0d8b('0x21')](saveUpdates(_0x180b7b[_0x0d8b('0x58')],null))[_0x0d8b('0x21')](function(_0x3ce373){if(_0x3ce373){_0x577951['message']=_0x3ce373[_0x0d8b('0x64')]({'plain':!![]});return db['ChatInteraction'][_0x0d8b('0x56')]({'where':{'id':_0x3ce373[_0x0d8b('0x65')]}});}return null;})[_0x0d8b('0x21')](handleEntityNotFound(_0x23de9e,null))[_0x0d8b('0x21')](function(_0x48025e){if(_0x48025e){return _0x48025e[_0x0d8b('0x33')]({'UserId':_0x180b7b[_0x0d8b('0x58')][_0x0d8b('0x61')],'read1stAt':_[_0x0d8b('0x66')](_0x48025e[_0x0d8b('0x67')])?moment()[_0x0d8b('0x5f')](_0x0d8b('0x60')):undefined});}return null;})[_0x0d8b('0x21')](function(_0x2ce282){if(_0x2ce282){_0x577951[_0x0d8b('0x68')]=_0x2ce282['get']({'plain':!![]});interaction_log['info'](_0x0d8b('0x69'),_0x180b7b[_0x0d8b('0x62')]['id'],_0x180b7b['user'][_0x0d8b('0x37')],_0x180b7b['user']['role'],_0x577951[_0x0d8b('0x68')]['id'],_0x180b7b[_0x0d8b('0x58')]?JSON['stringify'](_0x180b7b['body']):_0x0d8b('0x6a'));return respondWithRpcPromise(_0x0d8b('0x6b'),_0x0d8b('0x6c'),_0x577951);}return null;})[_0x0d8b('0x21')](function(_0x2ab72b){if(_0x2ab72b){if(_0x180b7b[_0x0d8b('0x58')][_0x0d8b('0x6d')]){_0x577951['message'][_0x0d8b('0x6e')]=util['format'](_0x0d8b('0x6f'),_0x180b7b[_0x0d8b('0x62')][_0x0d8b('0x37')]);_0x577951[_0x0d8b('0x29')]['channel']=_0x577951[_0x0d8b('0x70')];_0x577951['message'][_0x0d8b('0x71')]=_0x0d8b('0x5c');return respondWithRpcPromise(_0x0d8b('0x72'),_0x0d8b('0x72'),{'event':_0x0d8b('0x73'),'message':_[_0x0d8b('0x4d')](_0x577951[_0x0d8b('0x29')],JSON[_0x0d8b('0x74')](_0x577951[_0x0d8b('0x68')][_0x0d8b('0x75')]))},client9002)['then'](function(){return _0x577951;});}return _0x577951;}return null;})[_0x0d8b('0x21')](respondWithResult(_0x23de9e,null))['catch'](handleError(_0x23de9e,null));};var interaction_log=require(_0x0d8b('0x76'))(_0x0d8b('0x5b'));exports['reject']=function(_0x1a62b9,_0x56e03c,_0x10c318){var _0x445a00={'agent':{},'channel':_0x0d8b('0x5d')};if(_0x1a62b9[_0x0d8b('0x58')]['id']){delete _0x1a62b9[_0x0d8b('0x58')]['id'];}_0x1a62b9[_0x0d8b('0x58')][_0x0d8b('0x61')]=_0x1a62b9[_0x0d8b('0x58')]['UserId']||_0x1a62b9[_0x0d8b('0x62')]['id'];_0x445a00[_0x0d8b('0x77')]['id']=_0x1a62b9['body'][_0x0d8b('0x61')];return db[_0x0d8b('0x3a')][_0x0d8b('0x56')]({'where':{'id':_0x1a62b9[_0x0d8b('0x59')]['id'],'UserId':null}})[_0x0d8b('0x21')](handleEntityNotFound(_0x56e03c,null))[_0x0d8b('0x21')](function(_0x40ff07){if(_0x40ff07){_0x445a00[_0x0d8b('0x29')]=_0x40ff07[_0x0d8b('0x64')]({'plain':!![]});return db[_0x0d8b('0x78')][_0x0d8b('0x56')]({'where':{'id':_0x40ff07[_0x0d8b('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x56e03c,null))[_0x0d8b('0x21')](function(_0x93fc55){if(_0x93fc55){_0x445a00[_0x0d8b('0x68')]=_0x93fc55['get']({'plain':!![]});interaction_log['info'](_0x0d8b('0x79'),_0x1a62b9[_0x0d8b('0x62')]['id'],_0x1a62b9[_0x0d8b('0x62')]['name'],_0x1a62b9['user'][_0x0d8b('0x7a')],_0x445a00[_0x0d8b('0x68')]['id'],_0x1a62b9[_0x0d8b('0x58')]?JSON[_0x0d8b('0x26')](_0x1a62b9[_0x0d8b('0x58')]):_0x0d8b('0x6a'));return respondWithRpcPromise(_0x0d8b('0x7b'),_0x0d8b('0x7c'),_0x445a00);}return null;})[_0x0d8b('0x21')](function(_0x3a5aea){if(_0x3a5aea){_0x3a5aea[_0x0d8b('0x29')][_0x0d8b('0x6e')]=util[_0x0d8b('0x5f')]('SIP/%s',_0x1a62b9[_0x0d8b('0x62')][_0x0d8b('0x37')]);_0x3a5aea['message']['channel']=_0x445a00[_0x0d8b('0x70')];_0x3a5aea[_0x0d8b('0x29')][_0x0d8b('0x71')]=_0x0d8b('0x7d');respondWithRpcPromise(_0x0d8b('0x72'),_0x0d8b('0x72'),{'event':'rejectmessage','message':_0x3a5aea['message']},client9002);return _0x445a00;}return null;})['then'](respondWithResult(_0x56e03c,null))[_0x0d8b('0x54')](handleError(_0x56e03c,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 485ab82..daca021 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 _0x6255=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x2ec48f,_0x5d8ed8){var _0x4efea5=function(_0xab56ef){while(--_0xab56ef){_0x2ec48f['push'](_0x2ec48f['shift']());}};_0x4efea5(++_0x5d8ed8);}(_0x6255,0x75));var _0x5625=function(_0x1daebd,_0x79a89){_0x1daebd=_0x1daebd-0x0;var _0x462a89=_0x6255[_0x1daebd];return _0x462a89;};'use strict';var EventEmitter=require(_0x5625('0x0'));var ChatMessage=require(_0x5625('0x1'))['db'][_0x5625('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x5625('0x3')](0x0);var events={'afterCreate':_0x5625('0x4'),'afterUpdate':_0x5625('0x5'),'afterDestroy':_0x5625('0x6')};function emitEvent(_0x56292f){return function(_0x79cceb,_0x260da0,_0x4dec14){ChatMessageEvents[_0x5625('0x7')](_0x56292f+':'+_0x79cceb['id'],_0x79cceb);ChatMessageEvents[_0x5625('0x7')](_0x56292f,_0x79cceb);_0x4dec14(null);};}for(var e in events){if(events[_0x5625('0x8')](e)){var event=events[e];ChatMessage[_0x5625('0x9')](e,emitEvent(event));}}module[_0x5625('0xa')]=ChatMessageEvents; \ No newline at end of file +var _0x5c94=['events','../../mysqldb','ChatMessage','update','remove','emit','hook','exports'];(function(_0x38987f,_0xc79720){var _0x4cb697=function(_0x1af5ae){while(--_0x1af5ae){_0x38987f['push'](_0x38987f['shift']());}};_0x4cb697(++_0xc79720);}(_0x5c94,0xc8));var _0x45c9=function(_0x54002d,_0x345175){_0x54002d=_0x54002d-0x0;var _0x2bef8c=_0x5c94[_0x54002d];return _0x2bef8c;};'use strict';var EventEmitter=require(_0x45c9('0x0'));var ChatMessage=require(_0x45c9('0x1'))['db'][_0x45c9('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x45c9('0x3'),'afterDestroy':_0x45c9('0x4')};function emitEvent(_0xf61b65){return function(_0x3f90e9,_0x2ee29c,_0x1836f2){ChatMessageEvents[_0x45c9('0x5')](_0xf61b65+':'+_0x3f90e9['id'],_0x3f90e9);ChatMessageEvents[_0x45c9('0x5')](_0xf61b65,_0x3f90e9);_0x1836f2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x45c9('0x6')](e,emitEvent(event));}}module[_0x45c9('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 3b6d426..0ace3f4 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 _0x4a69=['bluebird','request-promise','path','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','toLowerCase','direction','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x1d4741,_0x4c4611){var _0x564448=function(_0x31b100){while(--_0x31b100){_0x1d4741['push'](_0x1d4741['shift']());}};_0x564448(++_0x4c4611);}(_0x4a69,0x8d));var _0x94a6=function(_0x3ed95e,_0x2d2d13){_0x3ed95e=_0x3ed95e-0x0;var _0x4ab531=_0x4a69[_0x3ed95e];return _0x4ab531;};'use strict';var _=require(_0x94a6('0x0'));var util=require(_0x94a6('0x1'));var logger=require('../../config/logger')(_0x94a6('0x2'));var moment=require(_0x94a6('0x3'));var BPromise=require(_0x94a6('0x4'));var rp=require(_0x94a6('0x5'));var fs=require('fs');var path=require(_0x94a6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x94a6('0x7'));module[_0x94a6('0x8')]=function(_0x5de883,_0x5b65ef){return _0x5de883[_0x94a6('0x9')](_0x94a6('0xa'),attributes,{'tableName':_0x94a6('0xb'),'paranoid':![],'indexes':[{'name':_0x94a6('0xc'),'fields':[_0x94a6('0xd')],'type':_0x94a6('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d5250,_0x23b4c1,_0x3b9831){var _0x40f094=_0x5de883[_0x94a6('0xf')];var _0x1965e7=_0x5d5250['get']({'plain':!![]});if(_0x1965e7['direction'][_0x94a6('0x10')]()==='in'||_0x1965e7[_0x94a6('0x11')][_0x94a6('0x10')]()===_0x94a6('0x12')&&!_0x1965e7[_0x94a6('0x13')]&&!_[_0x94a6('0x14')](_0x1965e7[_0x94a6('0x15')])){_0x40f094[_0x94a6('0x16')]['findOne']({'where':{'id':_0x1965e7[_0x94a6('0x17')]}})[_0x94a6('0x18')](function(_0x18230f){if(_0x18230f){_0x18230f[_0x94a6('0x19')]({'lastMsgAt':_0x1965e7[_0x94a6('0x1a')],'lastMsgDirection':_0x1965e7[_0x94a6('0x11')]['toLowerCase']()});}})['catch'](function(_0x5a6ce0){console['error'](_0x5a6ce0);});}_0x3b9831();}},'charset':_0x94a6('0x1b'),'collate':_0x94a6('0x1c')});}; \ No newline at end of file +var _0xcd44=['exports','define','ChatMessage','chat_messages','fti_chat_messages','body','models','direction','toLowerCase','out','UserId','ChatInteraction','findOne','then','update','createdAt','catch','error','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes'];(function(_0x4db7f6,_0x405d17){var _0x16a9f7=function(_0x4fdbe1){while(--_0x4fdbe1){_0x4db7f6['push'](_0x4db7f6['shift']());}};_0x16a9f7(++_0x405d17);}(_0xcd44,0x151));var _0x4cd4=function(_0x5cad2e,_0x251321){_0x5cad2e=_0x5cad2e-0x0;var _0x2add85=_0xcd44[_0x5cad2e];return _0x2add85;};'use strict';var _=require(_0x4cd4('0x0'));var util=require(_0x4cd4('0x1'));var logger=require(_0x4cd4('0x2'))(_0x4cd4('0x3'));var moment=require(_0x4cd4('0x4'));var BPromise=require(_0x4cd4('0x5'));var rp=require(_0x4cd4('0x6'));var fs=require('fs');var path=require(_0x4cd4('0x7'));var rimraf=require(_0x4cd4('0x8'));var config=require(_0x4cd4('0x9'));var attributes=require(_0x4cd4('0xa'));module[_0x4cd4('0xb')]=function(_0x1b6d7f,_0x3d2dd8){return _0x1b6d7f[_0x4cd4('0xc')](_0x4cd4('0xd'),attributes,{'tableName':_0x4cd4('0xe'),'paranoid':![],'indexes':[{'name':_0x4cd4('0xf'),'fields':[_0x4cd4('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x35b86c,_0x170cd5,_0x4cc033){var _0x423618=_0x1b6d7f[_0x4cd4('0x11')];var _0x461e09=_0x35b86c['get']({'plain':!![]});if(_0x461e09[_0x4cd4('0x12')][_0x4cd4('0x13')]()==='in'||_0x461e09[_0x4cd4('0x12')]['toLowerCase']()===_0x4cd4('0x14')&&!_0x461e09['secret']&&!_['isNil'](_0x461e09[_0x4cd4('0x15')])){_0x423618[_0x4cd4('0x16')][_0x4cd4('0x17')]({'where':{'id':_0x461e09['ChatInteractionId']}})[_0x4cd4('0x18')](function(_0x206cc7){if(_0x206cc7){_0x206cc7[_0x4cd4('0x19')]({'lastMsgAt':_0x461e09[_0x4cd4('0x1a')],'lastMsgDirection':_0x461e09['direction'][_0x4cd4('0x13')]()});}})[_0x4cd4('0x1b')](function(_0x25d7ea){console[_0x4cd4('0x1c')](_0x25d7ea);});}_0x4cc033();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 3957ecc..a0257cb 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 _0x8f8d=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','info','result','ChatMessage','body','options','raw','then','debug','CreateChatMessage','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x10d17b,_0xf0e7d1){var _0x3bf07b=function(_0x160d3d){while(--_0x160d3d){_0x10d17b['push'](_0x10d17b['shift']());}};_0x3bf07b(++_0xf0e7d1);}(_0x8f8d,0x190));var _0xd8f8=function(_0x56511f,_0x5f797e){_0x56511f=_0x56511f-0x0;var _0x268a66=_0x8f8d[_0x56511f];return _0x268a66;};'use strict';var _=require(_0xd8f8('0x0'));var util=require(_0xd8f8('0x1'));var moment=require(_0xd8f8('0x2'));var BPromise=require(_0xd8f8('0x3'));var rs=require(_0xd8f8('0x4'));var fs=require('fs');var Redis=require(_0xd8f8('0x5'));var db=require(_0xd8f8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd8f8('0x7'))('rpc');var config=require(_0xd8f8('0x8'));var jayson=require(_0xd8f8('0x9'));var client=jayson[_0xd8f8('0xa')][_0xd8f8('0xb')]({'port':0x232a});config[_0xd8f8('0xc')]=_[_0xd8f8('0xd')](config[_0xd8f8('0xc')],{'host':_0xd8f8('0xe'),'port':0x18eb});var socket=require(_0xd8f8('0xf'))(new Redis(config[_0xd8f8('0xc')]));require(_0xd8f8('0x10'))['register'](socket);function respondWithRpcPromise(_0xeb443e,_0x126d39,_0x3c4c23){return new BPromise(function(_0x2e04e9,_0x3c0690){return client['request'](_0xeb443e,_0x3c4c23)['then'](function(_0x2ef503){logger['info']('ChatMessage,\x20%s,\x20%s',_0x126d39,_0xd8f8('0x11'));logger['debug'](_0xd8f8('0x12'),_0x126d39,_0xd8f8('0x11'),JSON['stringify'](_0x2ef503));if(_0x2ef503[_0xd8f8('0x13')]){if(_0x2ef503[_0xd8f8('0x13')][_0xd8f8('0x14')]===0x1f4){logger['error'](_0xd8f8('0x15'),_0x126d39,_0x2ef503[_0xd8f8('0x13')][_0xd8f8('0x16')]);return _0x3c0690(_0x2ef503[_0xd8f8('0x13')][_0xd8f8('0x16')]);}logger[_0xd8f8('0x13')](_0xd8f8('0x15'),_0x126d39,_0x2ef503['error']['message']);return _0x2e04e9(_0x2ef503[_0xd8f8('0x13')]['message']);}else{logger[_0xd8f8('0x17')](_0xd8f8('0x15'),_0x126d39,'request\x20sent');_0x2e04e9(_0x2ef503[_0xd8f8('0x18')][_0xd8f8('0x16')]);}})['catch'](function(_0x4d27e5){logger[_0xd8f8('0x13')](_0xd8f8('0x15'),_0x126d39,_0x4d27e5);_0x3c0690(_0x4d27e5);});});}exports['CreateChatMessage']=function(_0xaedd20){var _0x732ed2=this;return new Promise(function(_0x34f7f2,_0x26d989){return db[_0xd8f8('0x19')]['create'](_0xaedd20[_0xd8f8('0x1a')],{'raw':_0xaedd20[_0xd8f8('0x1b')]?_0xaedd20[_0xd8f8('0x1b')][_0xd8f8('0x1c')]===undefined?!![]:![]:!![]})[_0xd8f8('0x1d')](function(_0xa40177){logger[_0xd8f8('0x17')]('CreateChatMessage',_0xaedd20);logger[_0xd8f8('0x1e')](_0xd8f8('0x1f'),_0xaedd20,JSON[_0xd8f8('0x20')](_0xa40177));_0x34f7f2(_0xa40177);})[_0xd8f8('0x21')](function(_0xaf9297){logger[_0xd8f8('0x13')](_0xd8f8('0x1f'),_0xaf9297[_0xd8f8('0x16')],_0xaedd20);_0x26d989(_0x732ed2['error'](0x1f4,_0xaf9297[_0xd8f8('0x16')]));});});}; \ No newline at end of file +var _0xd481=['message','result','catch','CreateChatMessage','ChatMessage','options','lodash','bluebird','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xd481,0x13a));var _0x1d48=function(_0xf4e3aa,_0x17912){_0xf4e3aa=_0xf4e3aa-0x0;var _0x4da10e=_0xd481[_0xf4e3aa];return _0x4da10e;};'use strict';var _=require(_0x1d48('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1d48('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1d48('0x2'))(_0x1d48('0x3'));var config=require(_0x1d48('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x1d48('0x5')][_0x1d48('0x6')]({'port':0x232a});config[_0x1d48('0x7')]=_[_0x1d48('0x8')](config[_0x1d48('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x1d48('0x9'))(new Redis(config[_0x1d48('0x7')]));require(_0x1d48('0xa'))[_0x1d48('0xb')](socket);function respondWithRpcPromise(_0x17c4f7,_0x56a257,_0x289477){return new BPromise(function(_0x530ed0,_0x508e93){return client[_0x1d48('0xc')](_0x17c4f7,_0x289477)[_0x1d48('0xd')](function(_0x546775){logger[_0x1d48('0xe')](_0x1d48('0xf'),_0x56a257,'request\x20sent');logger[_0x1d48('0x10')](_0x1d48('0x11'),_0x56a257,_0x1d48('0x12'),JSON[_0x1d48('0x13')](_0x546775));if(_0x546775[_0x1d48('0x14')]){if(_0x546775[_0x1d48('0x14')][_0x1d48('0x15')]===0x1f4){logger['error'](_0x1d48('0xf'),_0x56a257,_0x546775[_0x1d48('0x14')][_0x1d48('0x16')]);return _0x508e93(_0x546775['error'][_0x1d48('0x16')]);}logger[_0x1d48('0x14')](_0x1d48('0xf'),_0x56a257,_0x546775[_0x1d48('0x14')][_0x1d48('0x16')]);return _0x530ed0(_0x546775[_0x1d48('0x14')][_0x1d48('0x16')]);}else{logger[_0x1d48('0xe')](_0x1d48('0xf'),_0x56a257,_0x1d48('0x12'));_0x530ed0(_0x546775[_0x1d48('0x17')][_0x1d48('0x16')]);}})[_0x1d48('0x18')](function(_0x580283){logger[_0x1d48('0x14')](_0x1d48('0xf'),_0x56a257,_0x580283);_0x508e93(_0x580283);});});}exports[_0x1d48('0x19')]=function(_0x52926e){var _0x2044a7=this;return new Promise(function(_0x1f0f71,_0x4c457c){return db[_0x1d48('0x1a')]['create'](_0x52926e['body'],{'raw':_0x52926e[_0x1d48('0x1b')]?_0x52926e[_0x1d48('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x458745){logger[_0x1d48('0xe')](_0x1d48('0x19'),_0x52926e);logger[_0x1d48('0x10')]('CreateChatMessage',_0x52926e,JSON[_0x1d48('0x13')](_0x458745));_0x1f0f71(_0x458745);})['catch'](function(_0x330f88){logger[_0x1d48('0x14')](_0x1d48('0x19'),_0x330f88[_0x1d48('0x16')],_0x52926e);_0x4c457c(_0x2044a7[_0x1d48('0x14')](0x1f4,_0x330f88[_0x1d48('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index cfb7eb0..c9a63fc 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 _0xc6ac=['removeListener','register','length','./chatMessage.events','save','remove','update','emit'];(function(_0x251079,_0x5c79d0){var _0x3ccf7a=function(_0x449978){while(--_0x449978){_0x251079['push'](_0x251079['shift']());}};_0x3ccf7a(++_0x5c79d0);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x166594,_0x292d0d){_0x166594=_0x166594-0x0;var _0x581456=_0xc6ac[_0x166594];return _0x581456;};'use strict';var ChatMessageEvents=require(_0xcc6a('0x0'));var events=[_0xcc6a('0x1'),_0xcc6a('0x2'),_0xcc6a('0x3')];function createListener(_0x276972,_0x279d85){return function(_0x17d786){_0x279d85[_0xcc6a('0x4')](_0x276972,_0x17d786);};}function removeListener(_0x297643,_0x22ee99){return function(){ChatMessageEvents[_0xcc6a('0x5')](_0x297643,_0x22ee99);};}exports[_0xcc6a('0x6')]=function(_0x12330e){for(var _0x197bd7=0x0,_0x5f3887=events[_0xcc6a('0x7')];_0x197bd7<_0x5f3887;_0x197bd7++){var _0x11b919=events[_0x197bd7];var _0xf02261=createListener('chatMessage:'+_0x11b919,_0x12330e);ChatMessageEvents['on'](_0x11b919,_0xf02261);}}; \ No newline at end of file +var _0x687b=['update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0x45397c,_0x24c4f5){var _0x41c704=function(_0x4c830b){while(--_0x4c830b){_0x45397c['push'](_0x45397c['shift']());}};_0x41c704(++_0x24c4f5);}(_0x687b,0x14a));var _0xb687=function(_0x34412f,_0x116bea){_0x34412f=_0x34412f-0x0;var _0x4b4b5a=_0x687b[_0x34412f];return _0x4b4b5a;};'use strict';var ChatMessageEvents=require(_0xb687('0x0'));var events=[_0xb687('0x1'),_0xb687('0x2'),_0xb687('0x3')];function createListener(_0x5d8563,_0x5e5f06){return function(_0x35069a){_0x5e5f06[_0xb687('0x4')](_0x5d8563,_0x35069a);};}function removeListener(_0x36c468,_0x31bd0d){return function(){ChatMessageEvents[_0xb687('0x5')](_0x36c468,_0x31bd0d);};}exports[_0xb687('0x6')]=function(_0x16ccf3){for(var _0xf43a1f=0x0,_0x47ffea=events[_0xb687('0x7')];_0xf43a1f<_0x47ffea;_0xf43a1f++){var _0x48942b=events[_0xf43a1f];var _0x2aea59=createListener(_0xb687('0x8')+_0x48942b,_0x16ccf3);ChatMessageEvents['on'](_0x48942b,_0x2aea59);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index bcd0367..2c3b37a 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 _0x166e=['accept','/:id/reject','delete','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','chat','chatmessage:create','create','update','put'];(function(_0x3cb152,_0x57eb54){var _0x4f54c3=function(_0x273a45){while(--_0x273a45){_0x3cb152['push'](_0x3cb152['shift']());}};_0x4f54c3(++_0x57eb54);}(_0x166e,0xa1));var _0xe166=function(_0x37569a,_0x329ea2){_0x37569a=_0x37569a-0x0;var _0x1f345a=_0x166e[_0x37569a];return _0x1f345a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe166('0x0'));var timeout=require('connect-timeout');var express=require(_0xe166('0x1'));var router=express[_0xe166('0x2')]();var auth=require(_0xe166('0x3'));var interaction=require(_0xe166('0x4'));var config=require(_0xe166('0x5'));var controller=require(_0xe166('0x6'));router[_0xe166('0x7')]('/',auth['isAuthenticated'](),controller[_0xe166('0x8')]);router[_0xe166('0x7')](_0xe166('0x9'),auth[_0xe166('0xa')](),controller[_0xe166('0xb')]);router['get'](_0xe166('0xc'),auth[_0xe166('0xa')](),controller[_0xe166('0xd')]);router[_0xe166('0xe')]('/',auth[_0xe166('0xa')](),interaction[_0xe166('0xf')](_0xe166('0x10'),_0xe166('0x11')),controller[_0xe166('0x12')]);router['put']('/:id',controller[_0xe166('0x13')]);router[_0xe166('0x14')]('/:id/accept',auth[_0xe166('0xa')](),controller[_0xe166('0x15')]);router['put'](_0xe166('0x16'),auth[_0xe166('0xa')](),controller['reject']);router[_0xe166('0x17')](_0xe166('0xc'),auth[_0xe166('0xa')](),controller[_0xe166('0x18')]);module[_0xe166('0x19')]=router; \ No newline at end of file +var _0xdd48=['index','/describe','describe','/:id','show','post','chat','chatmessage:create','create','put','update','/:id/accept','accept','reject','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x31a938,_0x4daec6){var _0x1bf341=function(_0x514261){while(--_0x514261){_0x31a938['push'](_0x31a938['shift']());}};_0x1bf341(++_0x4daec6);}(_0xdd48,0x155));var _0x8dd4=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xdd48[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x8dd4('0x0'));var util=require(_0x8dd4('0x1'));var path=require(_0x8dd4('0x2'));var timeout=require('connect-timeout');var express=require(_0x8dd4('0x3'));var router=express[_0x8dd4('0x4')]();var auth=require(_0x8dd4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8dd4('0x6'));var controller=require('./chatMessage.controller');router[_0x8dd4('0x7')]('/',auth[_0x8dd4('0x8')](),controller[_0x8dd4('0x9')]);router[_0x8dd4('0x7')](_0x8dd4('0xa'),auth['isAuthenticated'](),controller[_0x8dd4('0xb')]);router[_0x8dd4('0x7')](_0x8dd4('0xc'),auth['isAuthenticated'](),controller[_0x8dd4('0xd')]);router[_0x8dd4('0xe')]('/',auth[_0x8dd4('0x8')](),interaction['tracked'](_0x8dd4('0xf'),_0x8dd4('0x10')),controller[_0x8dd4('0x11')]);router[_0x8dd4('0x12')](_0x8dd4('0xc'),controller[_0x8dd4('0x13')]);router[_0x8dd4('0x12')](_0x8dd4('0x14'),auth['isAuthenticated'](),controller[_0x8dd4('0x15')]);router['put']('/:id/reject',auth[_0x8dd4('0x8')](),controller[_0x8dd4('0x16')]);router[_0x8dd4('0x17')]('/:id',auth[_0x8dd4('0x8')](),controller[_0x8dd4('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 45e86ae..ac88536 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 _0x6a87=['medium','sequelize','exports','TEXT'];(function(_0x356fea,_0x355712){var _0x5ab711=function(_0x28ad3a){while(--_0x28ad3a){_0x356fea['push'](_0x356fea['shift']());}};_0x5ab711(++_0x355712);}(_0x6a87,0xe1));var _0x76a8=function(_0x25e633,_0xf5a368){_0x25e633=_0x25e633-0x0;var _0x26d2c9=_0x6a87[_0x25e633];return _0x26d2c9;};'use strict';var Sequelize=require(_0x76a8('0x0'));module[_0x76a8('0x1')]={'body':{'type':Sequelize[_0x76a8('0x2')](_0x76a8('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xddc2=['sequelize'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xddc2,0x186));var _0x2ddc=function(_0x2d3dc7,_0xaa9dc9){_0x2d3dc7=_0x2d3dc7-0x0;var _0x57319c=_0xddc2[_0x2d3dc7];return _0x57319c;};'use strict';var Sequelize=require(_0x2ddc('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index a1563a4..94c05fa 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 _0xdb18=['name','options','include','rows','catch','includeAll','find','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','then','destroy','stack','send','index','map','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x33e28c,_0x502269){var _0x43ba3b=function(_0x478325){while(--_0x478325){_0x33e28c['push'](_0x33e28c['shift']());}};_0x43ba3b(++_0x502269);}(_0xdb18,0x9c));var _0x8db1=function(_0x8c43c7,_0x5a9b67){_0x8c43c7=_0x8c43c7-0x0;var _0x4cef22=_0xdb18[_0x8c43c7];return _0x4cef22;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8db1('0x0'));var zipdir=require(_0x8db1('0x1'));var jsonpatch=require(_0x8db1('0x2'));var rp=require(_0x8db1('0x3'));var moment=require(_0x8db1('0x4'));var BPromise=require(_0x8db1('0x5'));var Mustache=require(_0x8db1('0x6'));var util=require('util');var path=require(_0x8db1('0x7'));var sox=require(_0x8db1('0x8'));var csv=require('to-csv');var ejs=require(_0x8db1('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8db1('0xa'));var crypto=require(_0x8db1('0xb'));var jsforce=require(_0x8db1('0xc'));var deskjs=require(_0x8db1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8db1('0xe'));var Papa=require(_0x8db1('0xf'));var Redis=require(_0x8db1('0x10'));var authService=require(_0x8db1('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8db1('0x12'));var logger=require(_0x8db1('0x13'))(_0x8db1('0x14'));var utils=require('../../config/utils');var config=require(_0x8db1('0x15'));var licenseUtil=require(_0x8db1('0x16'));var db=require(_0x8db1('0x17'))['db'];function respondWithStatusCode(_0x2ca8e2,_0xc4dcf1){_0xc4dcf1=_0xc4dcf1||0xcc;return function(_0x1ea42f){if(_0x1ea42f){return _0x2ca8e2[_0x8db1('0x18')](_0xc4dcf1);}return _0x2ca8e2[_0x8db1('0x19')](_0xc4dcf1)['end']();};}function respondWithResult(_0x23df99,_0x4dcb89){_0x4dcb89=_0x4dcb89||0xc8;return function(_0x2dcabb){if(_0x2dcabb){return _0x23df99['status'](_0x4dcb89)[_0x8db1('0x1a')](_0x2dcabb);}};}function respondWithFilteredResult(_0x1e6128,_0x122a86){return function(_0x2d4ee9){if(_0x2d4ee9){var _0x1eaedf=_0x2d4ee9[_0x8db1('0x1b')],_0x45a7fd=_0x122a86[_0x8db1('0x1c')],_0x1ad479=_0x122a86[_0x8db1('0x1c')]+_0x122a86['limit'],_0x5ee489;if(_0x1ad479>=_0x1eaedf){_0x1ad479=_0x1eaedf;_0x5ee489=0xc8;}else{_0x5ee489=0xce;}_0x1e6128[_0x8db1('0x19')](_0x5ee489);return _0x1e6128[_0x8db1('0x1d')](_0x8db1('0x1e'),_0x45a7fd+'-'+_0x1ad479+'/'+_0x1eaedf)['json'](_0x2d4ee9);}return null;};}function patchUpdates(_0x5ee700){return function(_0x10f79c){try{jsonpatch[_0x8db1('0x1f')](_0x10f79c,_0x5ee700,!![]);}catch(_0x24d8f1){return BPromise['reject'](_0x24d8f1);}return _0x10f79c[_0x8db1('0x20')]();};}function saveUpdates(_0x1e1354,_0x416409){return function(_0x366676){if(_0x366676){return _0x366676[_0x8db1('0x21')](_0x1e1354)[_0x8db1('0x22')](function(_0x501960){return _0x501960;});}return null;};}function removeEntity(_0x584735,_0x5e2f89){return function(_0x4cd545){if(_0x4cd545){return _0x4cd545[_0x8db1('0x23')]()['then'](function(){_0x584735[_0x8db1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5520e0,_0xe6107d){return function(_0x24a565){if(!_0x24a565){_0x5520e0[_0x8db1('0x18')](0x194);}return _0x24a565;};}function handleError(_0xdbf434,_0x1d011e){_0x1d011e=_0x1d011e||0x1f4;return function(_0x230dd8){logger['error'](_0x230dd8[_0x8db1('0x24')]);if(_0x230dd8['name']){delete _0x230dd8['name'];}_0xdbf434[_0x8db1('0x19')](_0x1d011e)[_0x8db1('0x25')](_0x230dd8);};}exports[_0x8db1('0x26')]=function(_0x3999ca,_0x1405d6){var _0x7929a6={},_0x2ac9eb={},_0x58b8a2={'count':0x0,'rows':[]};var _0x4ef249=_[_0x8db1('0x27')](db[_0x8db1('0x28')][_0x8db1('0x29')],function(_0xc7a98e){return{'name':_0xc7a98e[_0x8db1('0x2a')],'type':_0xc7a98e[_0x8db1('0x2b')][_0x8db1('0x2c')]};});_0x2ac9eb[_0x8db1('0x2d')]=_[_0x8db1('0x27')](_0x4ef249,'name');_0x2ac9eb[_0x8db1('0x2e')]=_[_0x8db1('0x2f')](_0x3999ca[_0x8db1('0x2e')]);_0x2ac9eb[_0x8db1('0x30')]=_[_0x8db1('0x31')](_0x2ac9eb[_0x8db1('0x2d')],_0x2ac9eb[_0x8db1('0x2e')]);_0x7929a6[_0x8db1('0x32')]=_[_0x8db1('0x31')](_0x2ac9eb[_0x8db1('0x2d')],qs[_0x8db1('0x33')](_0x3999ca[_0x8db1('0x2e')][_0x8db1('0x33')]));_0x7929a6['attributes']=_0x7929a6['attributes'][_0x8db1('0x34')]?_0x7929a6[_0x8db1('0x32')]:_0x2ac9eb[_0x8db1('0x2d')];if(!_0x3999ca[_0x8db1('0x2e')][_0x8db1('0x35')](_0x8db1('0x36'))){_0x7929a6['limit']=qs['limit'](_0x3999ca[_0x8db1('0x2e')][_0x8db1('0x37')]);_0x7929a6[_0x8db1('0x1c')]=qs[_0x8db1('0x1c')](_0x3999ca[_0x8db1('0x2e')][_0x8db1('0x1c')]);}_0x7929a6[_0x8db1('0x38')]=qs[_0x8db1('0x39')](_0x3999ca[_0x8db1('0x2e')][_0x8db1('0x39')]);_0x7929a6['where']=qs['filters'](_[_0x8db1('0x3a')](_0x3999ca[_0x8db1('0x2e')],_0x2ac9eb[_0x8db1('0x30')]),_0x4ef249);if(_0x3999ca['query'][_0x8db1('0x3b')]){_0x7929a6[_0x8db1('0x3c')]=_[_0x8db1('0x3d')](_0x7929a6[_0x8db1('0x3c')],{'$or':_[_0x8db1('0x27')](_0x4ef249,function(_0x15813c){if(_0x15813c[_0x8db1('0x2b')]!==_0x8db1('0x3e')){var _0x491a13={};_0x491a13[_0x15813c[_0x8db1('0x3f')]]={'$like':'%'+_0x3999ca[_0x8db1('0x2e')][_0x8db1('0x3b')]+'%'};return _0x491a13;}})});}_0x7929a6=_[_0x8db1('0x3d')]({},_0x7929a6,_0x3999ca[_0x8db1('0x40')]);var _0x32b618={'where':_0x7929a6[_0x8db1('0x3c')]};return db[_0x8db1('0x28')]['count'](_0x32b618)[_0x8db1('0x22')](function(_0x51373c){_0x58b8a2[_0x8db1('0x1b')]=_0x51373c;if(_0x3999ca['query']['includeAll']){_0x7929a6[_0x8db1('0x41')]=[{'all':!![]}];}return db[_0x8db1('0x28')]['findAll'](_0x7929a6);})[_0x8db1('0x22')](function(_0xf7ef62){_0x58b8a2[_0x8db1('0x42')]=_0xf7ef62;return _0x58b8a2;})[_0x8db1('0x22')](respondWithFilteredResult(_0x1405d6,_0x7929a6))[_0x8db1('0x43')](handleError(_0x1405d6,null));};exports['show']=function(_0xd71bc8,_0x5808af){var _0x362570={'raw':!![],'where':{'id':_0xd71bc8['params']['id']}},_0xfd2ae7={};_0xfd2ae7[_0x8db1('0x2d')]=_[_0x8db1('0x2f')](db[_0x8db1('0x28')][_0x8db1('0x29')]);_0xfd2ae7[_0x8db1('0x2e')]=_[_0x8db1('0x2f')](_0xd71bc8[_0x8db1('0x2e')]);_0xfd2ae7['filtears']=_[_0x8db1('0x31')](_0xfd2ae7[_0x8db1('0x2d')],_0xfd2ae7[_0x8db1('0x2e')]);_0x362570[_0x8db1('0x32')]=_[_0x8db1('0x31')](_0xfd2ae7['model'],qs[_0x8db1('0x33')](_0xd71bc8[_0x8db1('0x2e')][_0x8db1('0x33')]));_0x362570[_0x8db1('0x32')]=_0x362570[_0x8db1('0x32')][_0x8db1('0x34')]?_0x362570[_0x8db1('0x32')]:_0xfd2ae7[_0x8db1('0x2d')];if(_0xd71bc8['query'][_0x8db1('0x44')]){_0x362570[_0x8db1('0x41')]=[{'all':!![]}];}_0x362570=_[_0x8db1('0x3d')]({},_0x362570,_0xd71bc8[_0x8db1('0x40')]);return db[_0x8db1('0x28')][_0x8db1('0x45')](_0x362570)[_0x8db1('0x22')](handleEntityNotFound(_0x5808af,null))[_0x8db1('0x22')](respondWithResult(_0x5808af,null))[_0x8db1('0x43')](handleError(_0x5808af,null));};exports['create']=function(_0x109dca,_0x43eb33){return db['ChatOfflineMessage']['create'](_0x109dca[_0x8db1('0x46')],{})[_0x8db1('0x22')](respondWithResult(_0x43eb33,0xc9))[_0x8db1('0x43')](handleError(_0x43eb33,null));};exports[_0x8db1('0x21')]=function(_0x3caea1,_0x3bc3f2){if(_0x3caea1[_0x8db1('0x46')]['id']){delete _0x3caea1['body']['id'];}return db[_0x8db1('0x28')][_0x8db1('0x45')]({'where':{'id':_0x3caea1['params']['id']}})[_0x8db1('0x22')](handleEntityNotFound(_0x3bc3f2,null))['then'](saveUpdates(_0x3caea1[_0x8db1('0x46')],null))[_0x8db1('0x22')](respondWithResult(_0x3bc3f2,null))[_0x8db1('0x43')](handleError(_0x3bc3f2,null));};exports[_0x8db1('0x23')]=function(_0x27e6a9,_0x1b416b){return db[_0x8db1('0x28')][_0x8db1('0x45')]({'where':{'id':_0x27e6a9[_0x8db1('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b416b,null))[_0x8db1('0x22')](removeEntity(_0x1b416b,null))[_0x8db1('0x43')](handleError(_0x1b416b,null));};exports['describe']=function(_0x37b733,_0xbfe10c){return db[_0x8db1('0x28')][_0x8db1('0x48')]()[_0x8db1('0x22')](respondWithResult(_0xbfe10c,null))[_0x8db1('0x43')](handleError(_0xbfe10c,null));}; \ No newline at end of file +var _0x0d91=['end','json','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','ChatOfflineMessage','rawAttributes','fieldName','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filters','filter','where','merge','type','options','includeAll','include','findAll','rows','params','keys','filtears','create','body','catch','find','destroy','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','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/license/util','../../mysqldb','sendStatus','status'];(function(_0x54aa7b,_0x521f21){var _0x972024=function(_0x527077){while(--_0x527077){_0x54aa7b['push'](_0x54aa7b['shift']());}};_0x972024(++_0x521f21);}(_0x0d91,0x7b));var _0x10d9=function(_0x27c383,_0x284463){_0x27c383=_0x27c383-0x0;var _0x1143a9=_0x0d91[_0x27c383];return _0x1143a9;};'use strict';var pdf=require(_0x10d9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x10d9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x10d9('0x2'));var rp=require(_0x10d9('0x3'));var moment=require(_0x10d9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x10d9('0x5'));var util=require(_0x10d9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x10d9('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x10d9('0x8'));var squel=require('squel');var crypto=require(_0x10d9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x10d9('0xa'));var toCsv=require(_0x10d9('0x7'));var querystring=require(_0x10d9('0xb'));var Papa=require(_0x10d9('0xc'));var Redis=require(_0x10d9('0xd'));var authService=require(_0x10d9('0xe'));var qs=require(_0x10d9('0xf'));var as=require(_0x10d9('0x10'));var hardwareService=require(_0x10d9('0x11'));var logger=require(_0x10d9('0x12'))(_0x10d9('0x13'));var utils=require(_0x10d9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x10d9('0x15'));var db=require(_0x10d9('0x16'))['db'];function respondWithStatusCode(_0x3e4698,_0x15a047){_0x15a047=_0x15a047||0xcc;return function(_0x59dc10){if(_0x59dc10){return _0x3e4698[_0x10d9('0x17')](_0x15a047);}return _0x3e4698[_0x10d9('0x18')](_0x15a047)[_0x10d9('0x19')]();};}function respondWithResult(_0x1b4616,_0x2e31bc){_0x2e31bc=_0x2e31bc||0xc8;return function(_0x3f4300){if(_0x3f4300){return _0x1b4616[_0x10d9('0x18')](_0x2e31bc)[_0x10d9('0x1a')](_0x3f4300);}};}function respondWithFilteredResult(_0x1afd5d,_0x518e32){return function(_0x271c24){if(_0x271c24){var _0xa254a7=_0x271c24[_0x10d9('0x1b')],_0x38d07d=_0x518e32[_0x10d9('0x1c')],_0xe2471c=_0x518e32[_0x10d9('0x1c')]+_0x518e32['limit'],_0x5af0fd;if(_0xe2471c>=_0xa254a7){_0xe2471c=_0xa254a7;_0x5af0fd=0xc8;}else{_0x5af0fd=0xce;}_0x1afd5d[_0x10d9('0x18')](_0x5af0fd);return _0x1afd5d[_0x10d9('0x1d')](_0x10d9('0x1e'),_0x38d07d+'-'+_0xe2471c+'/'+_0xa254a7)['json'](_0x271c24);}return null;};}function patchUpdates(_0x554c4e){return function(_0x381713){try{jsonpatch[_0x10d9('0x1f')](_0x381713,_0x554c4e,!![]);}catch(_0x484fe7){return BPromise[_0x10d9('0x20')](_0x484fe7);}return _0x381713['save']();};}function saveUpdates(_0x4d9929,_0x441347){return function(_0x1a7b51){if(_0x1a7b51){return _0x1a7b51[_0x10d9('0x21')](_0x4d9929)[_0x10d9('0x22')](function(_0xfd514c){return _0xfd514c;});}return null;};}function removeEntity(_0x1266f7,_0x43ba59){return function(_0x58a58c){if(_0x58a58c){return _0x58a58c['destroy']()[_0x10d9('0x22')](function(){_0x1266f7[_0x10d9('0x18')](0xcc)[_0x10d9('0x19')]();});}};}function handleEntityNotFound(_0x3607de,_0x173e74){return function(_0x4a2f4a){if(!_0x4a2f4a){_0x3607de['sendStatus'](0x194);}return _0x4a2f4a;};}function handleError(_0x3e2e79,_0x573a66){_0x573a66=_0x573a66||0x1f4;return function(_0x597c41){logger[_0x10d9('0x23')](_0x597c41[_0x10d9('0x24')]);if(_0x597c41[_0x10d9('0x25')]){delete _0x597c41[_0x10d9('0x25')];}_0x3e2e79['status'](_0x573a66)[_0x10d9('0x26')](_0x597c41);};}exports[_0x10d9('0x27')]=function(_0x1534c7,_0x2505fd){var _0x212e13={},_0x442e90={},_0x1afbbb={'count':0x0,'rows':[]};var _0x1957a8=_['map'](db[_0x10d9('0x28')][_0x10d9('0x29')],function(_0x5b1bd5){return{'name':_0x5b1bd5[_0x10d9('0x2a')],'type':_0x5b1bd5['type']['key']};});_0x442e90[_0x10d9('0x2b')]=_[_0x10d9('0x2c')](_0x1957a8,_0x10d9('0x25'));_0x442e90[_0x10d9('0x2d')]=_['keys'](_0x1534c7['query']);_0x442e90['filters']=_['intersection'](_0x442e90[_0x10d9('0x2b')],_0x442e90[_0x10d9('0x2d')]);_0x212e13[_0x10d9('0x2e')]=_[_0x10d9('0x2f')](_0x442e90[_0x10d9('0x2b')],qs[_0x10d9('0x30')](_0x1534c7[_0x10d9('0x2d')][_0x10d9('0x30')]));_0x212e13[_0x10d9('0x2e')]=_0x212e13[_0x10d9('0x2e')][_0x10d9('0x31')]?_0x212e13['attributes']:_0x442e90[_0x10d9('0x2b')];if(!_0x1534c7[_0x10d9('0x2d')][_0x10d9('0x32')](_0x10d9('0x33'))){_0x212e13[_0x10d9('0x34')]=qs[_0x10d9('0x34')](_0x1534c7[_0x10d9('0x2d')][_0x10d9('0x34')]);_0x212e13[_0x10d9('0x1c')]=qs[_0x10d9('0x1c')](_0x1534c7[_0x10d9('0x2d')][_0x10d9('0x1c')]);}_0x212e13['order']=qs[_0x10d9('0x35')](_0x1534c7[_0x10d9('0x2d')][_0x10d9('0x35')]);_0x212e13['where']=qs['filters'](_[_0x10d9('0x36')](_0x1534c7[_0x10d9('0x2d')],_0x442e90[_0x10d9('0x37')]),_0x1957a8);if(_0x1534c7['query'][_0x10d9('0x38')]){_0x212e13[_0x10d9('0x39')]=_[_0x10d9('0x3a')](_0x212e13[_0x10d9('0x39')],{'$or':_[_0x10d9('0x2c')](_0x1957a8,function(_0x221ec4){if(_0x221ec4[_0x10d9('0x3b')]!=='VIRTUAL'){var _0x3a5c90={};_0x3a5c90[_0x221ec4[_0x10d9('0x25')]]={'$like':'%'+_0x1534c7['query'][_0x10d9('0x38')]+'%'};return _0x3a5c90;}})});}_0x212e13=_[_0x10d9('0x3a')]({},_0x212e13,_0x1534c7[_0x10d9('0x3c')]);var _0x23faa9={'where':_0x212e13[_0x10d9('0x39')]};return db[_0x10d9('0x28')][_0x10d9('0x1b')](_0x23faa9)[_0x10d9('0x22')](function(_0x1e31fb){_0x1afbbb['count']=_0x1e31fb;if(_0x1534c7[_0x10d9('0x2d')][_0x10d9('0x3d')]){_0x212e13[_0x10d9('0x3e')]=[{'all':!![]}];}return db[_0x10d9('0x28')][_0x10d9('0x3f')](_0x212e13);})[_0x10d9('0x22')](function(_0x5869b4){_0x1afbbb[_0x10d9('0x40')]=_0x5869b4;return _0x1afbbb;})['then'](respondWithFilteredResult(_0x2505fd,_0x212e13))['catch'](handleError(_0x2505fd,null));};exports['show']=function(_0x4d8c1c,_0x2d5f3a){var _0x5a27b1={'raw':!![],'where':{'id':_0x4d8c1c[_0x10d9('0x41')]['id']}},_0xaa29e0={};_0xaa29e0[_0x10d9('0x2b')]=_[_0x10d9('0x42')](db[_0x10d9('0x28')]['rawAttributes']);_0xaa29e0[_0x10d9('0x2d')]=_['keys'](_0x4d8c1c['query']);_0xaa29e0[_0x10d9('0x43')]=_['intersection'](_0xaa29e0[_0x10d9('0x2b')],_0xaa29e0[_0x10d9('0x2d')]);_0x5a27b1[_0x10d9('0x2e')]=_[_0x10d9('0x2f')](_0xaa29e0[_0x10d9('0x2b')],qs[_0x10d9('0x30')](_0x4d8c1c[_0x10d9('0x2d')]['fields']));_0x5a27b1['attributes']=_0x5a27b1[_0x10d9('0x2e')]['length']?_0x5a27b1[_0x10d9('0x2e')]:_0xaa29e0['model'];if(_0x4d8c1c[_0x10d9('0x2d')]['includeAll']){_0x5a27b1[_0x10d9('0x3e')]=[{'all':!![]}];}_0x5a27b1=_['merge']({},_0x5a27b1,_0x4d8c1c[_0x10d9('0x3c')]);return db['ChatOfflineMessage']['find'](_0x5a27b1)['then'](handleEntityNotFound(_0x2d5f3a,null))[_0x10d9('0x22')](respondWithResult(_0x2d5f3a,null))['catch'](handleError(_0x2d5f3a,null));};exports['create']=function(_0x34506e,_0x44f25f){return db['ChatOfflineMessage'][_0x10d9('0x44')](_0x34506e[_0x10d9('0x45')],{})[_0x10d9('0x22')](respondWithResult(_0x44f25f,0xc9))[_0x10d9('0x46')](handleError(_0x44f25f,null));};exports['update']=function(_0x3d7a1a,_0xce0de2){if(_0x3d7a1a[_0x10d9('0x45')]['id']){delete _0x3d7a1a[_0x10d9('0x45')]['id'];}return db[_0x10d9('0x28')][_0x10d9('0x47')]({'where':{'id':_0x3d7a1a['params']['id']}})[_0x10d9('0x22')](handleEntityNotFound(_0xce0de2,null))[_0x10d9('0x22')](saveUpdates(_0x3d7a1a[_0x10d9('0x45')],null))['then'](respondWithResult(_0xce0de2,null))[_0x10d9('0x46')](handleError(_0xce0de2,null));};exports[_0x10d9('0x48')]=function(_0x129839,_0x706a98){return db[_0x10d9('0x28')]['find']({'where':{'id':_0x129839[_0x10d9('0x41')]['id']}})[_0x10d9('0x22')](handleEntityNotFound(_0x706a98,null))[_0x10d9('0x22')](removeEntity(_0x706a98,null))[_0x10d9('0x46')](handleError(_0x706a98,null));};exports[_0x10d9('0x49')]=function(_0x538785,_0x346644){return db[_0x10d9('0x28')][_0x10d9('0x49')]()['then'](respondWithResult(_0x346644,null))[_0x10d9('0x46')](handleError(_0x346644,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index a1e3a56..94749b7 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 _0x3937=['../../config/logger','api','bluebird','path','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','lodash'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x3937,0xbf));var _0x7393=function(_0x55bc07,_0xa1f55b){_0x55bc07=_0x55bc07-0x0;var _0x4d9285=_0x3937[_0x55bc07];return _0x4d9285;};'use strict';var _=require(_0x7393('0x0'));var util=require('util');var logger=require(_0x7393('0x1'))(_0x7393('0x2'));var moment=require('moment');var BPromise=require(_0x7393('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7393('0x4'));var rimraf=require('rimraf');var config=require(_0x7393('0x5'));var attributes=require(_0x7393('0x6'));module[_0x7393('0x7')]=function(_0x1f538f,_0x15eabd){return _0x1f538f[_0x7393('0x8')](_0x7393('0x9'),attributes,{'tableName':_0x7393('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7393('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc978=['bluebird','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x5c76e4,_0x22d3f2){var _0x3e2aa6=function(_0x38e7a8){while(--_0x38e7a8){_0x5c76e4['push'](_0x5c76e4['shift']());}};_0x3e2aa6(++_0x22d3f2);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var logger=require(_0x8c97('0x2'))(_0x8c97('0x3'));var moment=require(_0x8c97('0x4'));var BPromise=require(_0x8c97('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c97('0x6'));var rimraf=require(_0x8c97('0x7'));var config=require(_0x8c97('0x8'));var attributes=require(_0x8c97('0x9'));module[_0x8c97('0xa')]=function(_0x2a9434,_0xabd146){return _0x2a9434['define'](_0x8c97('0xb'),attributes,{'tableName':_0x8c97('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8c97('0xd'),'collate':_0x8c97('0xe')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 3e05b02..005c505 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 _0xbe66=['lodash','util','moment','ioredis','../../mysqldb','rpc','jayson/promise','http','request','ChatOfflineMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x323591,_0x518650){var _0x423982=function(_0x1b7a15){while(--_0x1b7a15){_0x323591['push'](_0x323591['shift']());}};_0x423982(++_0x518650);}(_0xbe66,0x85));var _0x6be6=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0xbe66[_0x1558ab];return _0x53b64a;};'use strict';var _=require(_0x6be6('0x0'));var util=require(_0x6be6('0x1'));var moment=require(_0x6be6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6be6('0x3'));var db=require(_0x6be6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6be6('0x5'));var config=require('../../config/environment');var jayson=require(_0x6be6('0x6'));var client=jayson['client'][_0x6be6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3e08ac,_0xa31a2b,_0x40f33f){return new BPromise(function(_0x151e52,_0x236d8e){return client[_0x6be6('0x8')](_0x3e08ac,_0x40f33f)['then'](function(_0x557006){logger['info'](_0x6be6('0x9'),_0xa31a2b,'request\x20sent');logger[_0x6be6('0xa')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0xa31a2b,_0x6be6('0xb'),JSON[_0x6be6('0xc')](_0x557006));if(_0x557006[_0x6be6('0xd')]){if(_0x557006[_0x6be6('0xd')][_0x6be6('0xe')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0xa31a2b,_0x557006['error'][_0x6be6('0xf')]);return _0x236d8e(_0x557006[_0x6be6('0xd')]['message']);}logger[_0x6be6('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0xa31a2b,_0x557006[_0x6be6('0xd')][_0x6be6('0xf')]);return _0x151e52(_0x557006[_0x6be6('0xd')][_0x6be6('0xf')]);}else{logger[_0x6be6('0x10')](_0x6be6('0x9'),_0xa31a2b,_0x6be6('0xb'));_0x151e52(_0x557006[_0x6be6('0x11')]['message']);}})[_0x6be6('0x12')](function(_0x97f228){logger[_0x6be6('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0xa31a2b,_0x97f228);_0x236d8e(_0x97f228);});});} \ No newline at end of file +var _0x9852=['result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9852,0x12e));var _0x2985=function(_0x2f4ee6,_0x24a540){_0x2f4ee6=_0x2f4ee6-0x0;var _0x28f20e=_0x9852[_0x2f4ee6];return _0x28f20e;};'use strict';var _=require(_0x2985('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2985('0x1'));var rs=require(_0x2985('0x2'));var fs=require('fs');var Redis=require(_0x2985('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2985('0x4'));var logger=require(_0x2985('0x5'))(_0x2985('0x6'));var config=require('../../config/environment');var jayson=require(_0x2985('0x7'));var client=jayson['client'][_0x2985('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52cd9d,_0x387414,_0x41c5bc){return new BPromise(function(_0x538e87,_0x149c96){return client['request'](_0x52cd9d,_0x41c5bc)[_0x2985('0x9')](function(_0xc1c97d){logger[_0x2985('0xa')](_0x2985('0xb'),_0x387414,'request\x20sent');logger[_0x2985('0xc')](_0x2985('0xd'),_0x387414,_0x2985('0xe'),JSON['stringify'](_0xc1c97d));if(_0xc1c97d[_0x2985('0xf')]){if(_0xc1c97d['error'][_0x2985('0x10')]===0x1f4){logger['error'](_0x2985('0xb'),_0x387414,_0xc1c97d[_0x2985('0xf')][_0x2985('0x11')]);return _0x149c96(_0xc1c97d[_0x2985('0xf')][_0x2985('0x11')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x387414,_0xc1c97d['error'][_0x2985('0x11')]);return _0x538e87(_0xc1c97d[_0x2985('0xf')][_0x2985('0x11')]);}else{logger['info'](_0x2985('0xb'),_0x387414,_0x2985('0xe'));_0x538e87(_0xc1c97d[_0x2985('0x12')][_0x2985('0x11')]);}})[_0x2985('0x13')](function(_0x37ccb4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x387414,_0x37ccb4);_0x149c96(_0x37ccb4);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 72944bb..a57e1e7 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 _0x34c4=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','exports','multer','path'];(function(_0x4c6abb,_0x8f43d5){var _0x3d1312=function(_0x497240){while(--_0x497240){_0x4c6abb['push'](_0x4c6abb['shift']());}};_0x3d1312(++_0x8f43d5);}(_0x34c4,0x166));var _0x434c=function(_0x8a1509,_0x283a6e){_0x8a1509=_0x8a1509-0x0;var _0x29998d=_0x34c4[_0x8a1509];return _0x29998d;};'use strict';var multer=require(_0x434c('0x0'));var util=require('util');var path=require(_0x434c('0x1'));var timeout=require('connect-timeout');var express=require(_0x434c('0x2'));var router=express[_0x434c('0x3')]();var auth=require(_0x434c('0x4'));var interaction=require(_0x434c('0x5'));var config=require(_0x434c('0x6'));var controller=require(_0x434c('0x7'));router[_0x434c('0x8')]('/',auth[_0x434c('0x9')](),controller[_0x434c('0xa')]);router[_0x434c('0x8')](_0x434c('0xb'),auth[_0x434c('0x9')](),controller[_0x434c('0xc')]);router[_0x434c('0x8')](_0x434c('0xd'),auth[_0x434c('0x9')](),controller[_0x434c('0xe')]);router[_0x434c('0xf')]('/',auth[_0x434c('0x9')](),controller[_0x434c('0x10')]);router['put'](_0x434c('0xd'),auth[_0x434c('0x9')](),controller['update']);router['delete']('/:id',auth[_0x434c('0x9')](),controller['destroy']);module[_0x434c('0x11')]=router; \ No newline at end of file +var _0xb070=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','show','post','create','put','update','/:id'];(function(_0x8fc955,_0x32d408){var _0x28fc8b=function(_0x3ae9ce){while(--_0x3ae9ce){_0x8fc955['push'](_0x8fc955['shift']());}};_0x28fc8b(++_0x32d408);}(_0xb070,0x1a5));var _0x0b07=function(_0x2815d5,_0x3530be){_0x2815d5=_0x2815d5-0x0;var _0x2969bc=_0xb070[_0x2815d5];return _0x2969bc;};'use strict';var multer=require(_0x0b07('0x0'));var util=require(_0x0b07('0x1'));var path=require(_0x0b07('0x2'));var timeout=require(_0x0b07('0x3'));var express=require(_0x0b07('0x4'));var router=express['Router']();var auth=require(_0x0b07('0x5'));var interaction=require(_0x0b07('0x6'));var config=require(_0x0b07('0x7'));var controller=require(_0x0b07('0x8'));router[_0x0b07('0x9')]('/',auth[_0x0b07('0xa')](),controller['index']);router[_0x0b07('0x9')](_0x0b07('0xb'),auth[_0x0b07('0xa')](),controller[_0x0b07('0xc')]);router['get']('/:id',auth[_0x0b07('0xa')](),controller[_0x0b07('0xd')]);router[_0x0b07('0xe')]('/',auth['isAuthenticated'](),controller[_0x0b07('0xf')]);router[_0x0b07('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0b07('0x11')]);router['delete'](_0x0b07('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x0b07('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index d2ea2a6..143f518 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 _0xfc06=['exports','ENUM','mouseOver','sequelize'];(function(_0x30ad51,_0x60659b){var _0x3b1934=function(_0x4ef23a){while(--_0x4ef23a){_0x30ad51['push'](_0x30ad51['shift']());}};_0x3b1934(++_0x60659b);}(_0xfc06,0x11f));var _0x6fc0=function(_0x4e0b59,_0xcdbc8){_0x4e0b59=_0x4e0b59-0x0;var _0x448041=_0xfc06[_0x4e0b59];return _0x448041;};'use strict';var Sequelize=require(_0x6fc0('0x0'));module[_0x6fc0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6fc0('0x2')](_0x6fc0('0x3'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2a3a=['ENUM','mouseOver','INTEGER','sequelize','exports','STRING'];(function(_0x4322a7,_0x551f1c){var _0xf5c98f=function(_0x4713f4){while(--_0x4713f4){_0x4322a7['push'](_0x4322a7['shift']());}};_0xf5c98f(++_0x551f1c);}(_0x2a3a,0x7b));var _0xa2a3=function(_0x2c0f63,_0x36ac13){_0x2c0f63=_0x2c0f63-0x0;var _0x50e73e=_0x2a3a[_0x2c0f63];return _0x50e73e;};'use strict';var Sequelize=require(_0xa2a3('0x0'));module[_0xa2a3('0x1')]={'name':{'type':Sequelize[_0xa2a3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa2a3('0x3')](_0xa2a3('0x4'),'timeout'),'defaultValue':_0xa2a3('0x4')},'selector':{'type':Sequelize[_0xa2a3('0x2')]},'timeout':{'type':Sequelize[_0xa2a3('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index fc9cc63..80cd7a5 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 _0xe0a6=['Content-Range','reject','update','destroy','then','error','name','send','params','keys','ChatProactiveAction','rawAttributes','query','filtears','intersection','model','attributes','length','includeAll','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit'];(function(_0x1dd16e,_0x2bd91d){var _0xa38c14=function(_0x5ad8fc){while(--_0x5ad8fc){_0x1dd16e['push'](_0x1dd16e['shift']());}};_0xa38c14(++_0x2bd91d);}(_0xe0a6,0x1ec));var _0x6e0a=function(_0x4ea5ac,_0x55324f){_0x4ea5ac=_0x4ea5ac-0x0;var _0x4ac509=_0xe0a6[_0x4ea5ac];return _0x4ac509;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6e0a('0x0'));var rimraf=require(_0x6e0a('0x1'));var zipdir=require(_0x6e0a('0x2'));var jsonpatch=require(_0x6e0a('0x3'));var rp=require('request-promise');var moment=require(_0x6e0a('0x4'));var BPromise=require(_0x6e0a('0x5'));var Mustache=require(_0x6e0a('0x6'));var util=require(_0x6e0a('0x7'));var path=require(_0x6e0a('0x8'));var sox=require(_0x6e0a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6e0a('0xa'));var squel=require('squel');var crypto=require(_0x6e0a('0xb'));var jsforce=require(_0x6e0a('0xc'));var deskjs=require(_0x6e0a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6e0a('0xe'));var Papa=require(_0x6e0a('0xf'));var Redis=require(_0x6e0a('0x10'));var authService=require(_0x6e0a('0x11'));var qs=require(_0x6e0a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6e0a('0x13'));var utils=require(_0x6e0a('0x14'));var config=require(_0x6e0a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6e0a('0x16'))['db'];function respondWithStatusCode(_0x36dc31,_0x35212b){_0x35212b=_0x35212b||0xcc;return function(_0x4710a4){if(_0x4710a4){return _0x36dc31[_0x6e0a('0x17')](_0x35212b);}return _0x36dc31[_0x6e0a('0x18')](_0x35212b)[_0x6e0a('0x19')]();};}function respondWithResult(_0x433ea1,_0x5ea62a){_0x5ea62a=_0x5ea62a||0xc8;return function(_0x57eed6){if(_0x57eed6){return _0x433ea1['status'](_0x5ea62a)['json'](_0x57eed6);}};}function respondWithFilteredResult(_0xf0b9ed,_0x44d4f8){return function(_0x162181){if(_0x162181){var _0x15fe4f=_0x162181['count'],_0xa90138=_0x44d4f8[_0x6e0a('0x1a')],_0x4169d5=_0x44d4f8['offset']+_0x44d4f8[_0x6e0a('0x1b')],_0x21a8ed;if(_0x4169d5>=_0x15fe4f){_0x4169d5=_0x15fe4f;_0x21a8ed=0xc8;}else{_0x21a8ed=0xce;}_0xf0b9ed['status'](_0x21a8ed);return _0xf0b9ed['set'](_0x6e0a('0x1c'),_0xa90138+'-'+_0x4169d5+'/'+_0x15fe4f)['json'](_0x162181);}return null;};}function patchUpdates(_0x165332){return function(_0x391756){try{jsonpatch['apply'](_0x391756,_0x165332,!![]);}catch(_0x4809df){return BPromise[_0x6e0a('0x1d')](_0x4809df);}return _0x391756['save']();};}function saveUpdates(_0x1c61fd,_0x35d35c){return function(_0x28dbea){if(_0x28dbea){return _0x28dbea[_0x6e0a('0x1e')](_0x1c61fd)['then'](function(_0x3b1bc2){return _0x3b1bc2;});}return null;};}function removeEntity(_0x342170,_0x45efbd){return function(_0x587a81){if(_0x587a81){return _0x587a81[_0x6e0a('0x1f')]()[_0x6e0a('0x20')](function(){_0x342170[_0x6e0a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f5d1c,_0x1f6f97){return function(_0x4a872d){if(!_0x4a872d){_0x3f5d1c[_0x6e0a('0x17')](0x194);}return _0x4a872d;};}function handleError(_0xbc64c6,_0x47c68d){_0x47c68d=_0x47c68d||0x1f4;return function(_0x2bb08e){logger[_0x6e0a('0x21')](_0x2bb08e['stack']);if(_0x2bb08e[_0x6e0a('0x22')]){delete _0x2bb08e[_0x6e0a('0x22')];}_0xbc64c6[_0x6e0a('0x18')](_0x47c68d)[_0x6e0a('0x23')](_0x2bb08e);};}exports['show']=function(_0x3f4d12,_0x1d7cbf){var _0x282db9={'raw':!![],'where':{'id':_0x3f4d12[_0x6e0a('0x24')]['id']}},_0x4922b6={};_0x4922b6['model']=_[_0x6e0a('0x25')](db[_0x6e0a('0x26')][_0x6e0a('0x27')]);_0x4922b6[_0x6e0a('0x28')]=_[_0x6e0a('0x25')](_0x3f4d12[_0x6e0a('0x28')]);_0x4922b6[_0x6e0a('0x29')]=_[_0x6e0a('0x2a')](_0x4922b6['model'],_0x4922b6['query']);_0x282db9['attributes']=_[_0x6e0a('0x2a')](_0x4922b6[_0x6e0a('0x2b')],qs['fields'](_0x3f4d12['query']['fields']));_0x282db9[_0x6e0a('0x2c')]=_0x282db9['attributes'][_0x6e0a('0x2d')]?_0x282db9['attributes']:_0x4922b6[_0x6e0a('0x2b')];if(_0x3f4d12['query'][_0x6e0a('0x2e')]){_0x282db9['include']=[{'all':!![]}];}_0x282db9=_['merge']({},_0x282db9,_0x3f4d12[_0x6e0a('0x2f')]);return db[_0x6e0a('0x26')][_0x6e0a('0x30')](_0x282db9)['then'](handleEntityNotFound(_0x1d7cbf,null))['then'](respondWithResult(_0x1d7cbf,null))[_0x6e0a('0x31')](handleError(_0x1d7cbf,null));};exports[_0x6e0a('0x32')]=function(_0x5e462b,_0x49fddf){return db[_0x6e0a('0x26')][_0x6e0a('0x32')](_0x5e462b[_0x6e0a('0x33')],{})[_0x6e0a('0x20')](respondWithResult(_0x49fddf,0xc9))[_0x6e0a('0x31')](handleError(_0x49fddf,null));};exports[_0x6e0a('0x1e')]=function(_0x1226d1,_0x981f4a){if(_0x1226d1[_0x6e0a('0x33')]['id']){delete _0x1226d1[_0x6e0a('0x33')]['id'];}return db[_0x6e0a('0x26')][_0x6e0a('0x30')]({'where':{'id':_0x1226d1[_0x6e0a('0x24')]['id']}})[_0x6e0a('0x20')](handleEntityNotFound(_0x981f4a,null))['then'](saveUpdates(_0x1226d1['body'],null))[_0x6e0a('0x20')](respondWithResult(_0x981f4a,null))[_0x6e0a('0x31')](handleError(_0x981f4a,null));};exports[_0x6e0a('0x1f')]=function(_0x4bd0fe,_0x44aa61){return db[_0x6e0a('0x26')][_0x6e0a('0x30')]({'where':{'id':_0x4bd0fe[_0x6e0a('0x24')]['id']}})[_0x6e0a('0x20')](handleEntityNotFound(_0x44aa61,null))[_0x6e0a('0x20')](removeEntity(_0x44aa61,null))['catch'](handleError(_0x44aa61,null));}; \ No newline at end of file +var _0x538d=['../../mysqldb','sendStatus','status','json','count','offset','set','apply','reject','save','then','end','error','stack','name','send','params','model','ChatProactiveAction','query','keys','filtears','attributes','intersection','length','includeAll','include','merge','options','find','catch','create','update','body','eml-format','zip-dir','mustache','util','path','ejs','lodash','squel','jsforce','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util'];(function(_0xfcbcb8,_0x35bf6b){var _0x1b1f97=function(_0x51e11d){while(--_0x51e11d){_0xfcbcb8['push'](_0xfcbcb8['shift']());}};_0x1b1f97(++_0x35bf6b);}(_0x538d,0xb5));var _0xd538=function(_0x24211a,_0x33c64c){_0x24211a=_0x24211a-0x0;var _0x7a2e6e=_0x538d[_0x24211a];return _0x7a2e6e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd538('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd538('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd538('0x2'));var util=require(_0xd538('0x3'));var path=require(_0xd538('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd538('0x5'));var fs=require('fs');var _=require(_0xd538('0x6'));var squel=require(_0xd538('0x7'));var crypto=require('crypto');var jsforce=require(_0xd538('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd538('0x9'));var Redis=require(_0xd538('0xa'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd538('0xb'));var logger=require(_0xd538('0xc'))('api');var utils=require(_0xd538('0xd'));var config=require('../../config/environment');var licenseUtil=require(_0xd538('0xe'));var db=require(_0xd538('0xf'))['db'];function respondWithStatusCode(_0x59718e,_0x1518fa){_0x1518fa=_0x1518fa||0xcc;return function(_0x329144){if(_0x329144){return _0x59718e[_0xd538('0x10')](_0x1518fa);}return _0x59718e[_0xd538('0x11')](_0x1518fa)['end']();};}function respondWithResult(_0x4ad5bd,_0x1449c1){_0x1449c1=_0x1449c1||0xc8;return function(_0xb9e8c5){if(_0xb9e8c5){return _0x4ad5bd[_0xd538('0x11')](_0x1449c1)[_0xd538('0x12')](_0xb9e8c5);}};}function respondWithFilteredResult(_0x5b5f08,_0x47e5aa){return function(_0x47302d){if(_0x47302d){var _0x43d296=_0x47302d[_0xd538('0x13')],_0x3e7925=_0x47e5aa[_0xd538('0x14')],_0x5392a3=_0x47e5aa['offset']+_0x47e5aa['limit'],_0x380f02;if(_0x5392a3>=_0x43d296){_0x5392a3=_0x43d296;_0x380f02=0xc8;}else{_0x380f02=0xce;}_0x5b5f08['status'](_0x380f02);return _0x5b5f08[_0xd538('0x15')]('Content-Range',_0x3e7925+'-'+_0x5392a3+'/'+_0x43d296)[_0xd538('0x12')](_0x47302d);}return null;};}function patchUpdates(_0x3ed6a3){return function(_0x57a824){try{jsonpatch[_0xd538('0x16')](_0x57a824,_0x3ed6a3,!![]);}catch(_0x1031e4){return BPromise[_0xd538('0x17')](_0x1031e4);}return _0x57a824[_0xd538('0x18')]();};}function saveUpdates(_0x3faf20,_0x277164){return function(_0xef591b){if(_0xef591b){return _0xef591b['update'](_0x3faf20)['then'](function(_0x1842d8){return _0x1842d8;});}return null;};}function removeEntity(_0x468e80,_0x211c02){return function(_0x370610){if(_0x370610){return _0x370610['destroy']()[_0xd538('0x19')](function(){_0x468e80[_0xd538('0x11')](0xcc)[_0xd538('0x1a')]();});}};}function handleEntityNotFound(_0x19616b,_0x2ceed0){return function(_0x19b6e6){if(!_0x19b6e6){_0x19616b[_0xd538('0x10')](0x194);}return _0x19b6e6;};}function handleError(_0x4e9d65,_0xd040c6){_0xd040c6=_0xd040c6||0x1f4;return function(_0x23aec5){logger[_0xd538('0x1b')](_0x23aec5[_0xd538('0x1c')]);if(_0x23aec5[_0xd538('0x1d')]){delete _0x23aec5[_0xd538('0x1d')];}_0x4e9d65[_0xd538('0x11')](_0xd040c6)[_0xd538('0x1e')](_0x23aec5);};}exports['show']=function(_0x25f9f0,_0x115897){var _0x43e2e8={'raw':!![],'where':{'id':_0x25f9f0[_0xd538('0x1f')]['id']}},_0x483ebe={};_0x483ebe[_0xd538('0x20')]=_['keys'](db[_0xd538('0x21')]['rawAttributes']);_0x483ebe[_0xd538('0x22')]=_[_0xd538('0x23')](_0x25f9f0['query']);_0x483ebe[_0xd538('0x24')]=_['intersection'](_0x483ebe[_0xd538('0x20')],_0x483ebe[_0xd538('0x22')]);_0x43e2e8[_0xd538('0x25')]=_[_0xd538('0x26')](_0x483ebe[_0xd538('0x20')],qs['fields'](_0x25f9f0['query']['fields']));_0x43e2e8[_0xd538('0x25')]=_0x43e2e8[_0xd538('0x25')][_0xd538('0x27')]?_0x43e2e8[_0xd538('0x25')]:_0x483ebe['model'];if(_0x25f9f0[_0xd538('0x22')][_0xd538('0x28')]){_0x43e2e8[_0xd538('0x29')]=[{'all':!![]}];}_0x43e2e8=_[_0xd538('0x2a')]({},_0x43e2e8,_0x25f9f0[_0xd538('0x2b')]);return db[_0xd538('0x21')][_0xd538('0x2c')](_0x43e2e8)[_0xd538('0x19')](handleEntityNotFound(_0x115897,null))['then'](respondWithResult(_0x115897,null))[_0xd538('0x2d')](handleError(_0x115897,null));};exports[_0xd538('0x2e')]=function(_0x68f68d,_0x296121){return db[_0xd538('0x21')][_0xd538('0x2e')](_0x68f68d['body'],{})[_0xd538('0x19')](respondWithResult(_0x296121,0xc9))[_0xd538('0x2d')](handleError(_0x296121,null));};exports[_0xd538('0x2f')]=function(_0x5bb2b8,_0x5358e7){if(_0x5bb2b8[_0xd538('0x30')]['id']){delete _0x5bb2b8[_0xd538('0x30')]['id'];}return db[_0xd538('0x21')][_0xd538('0x2c')]({'where':{'id':_0x5bb2b8['params']['id']}})[_0xd538('0x19')](handleEntityNotFound(_0x5358e7,null))[_0xd538('0x19')](saveUpdates(_0x5bb2b8['body'],null))[_0xd538('0x19')](respondWithResult(_0x5358e7,null))[_0xd538('0x2d')](handleError(_0x5358e7,null));};exports['destroy']=function(_0x37276f,_0x2a5182){return db[_0xd538('0x21')][_0xd538('0x2c')]({'where':{'id':_0x37276f['params']['id']}})['then'](handleEntityNotFound(_0x2a5182,null))[_0xd538('0x19')](removeEntity(_0x2a5182,null))[_0xd538('0x2d')](handleError(_0x2a5182,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 4fe6d4f..cc0ed78 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 _0xc44d=['moment','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util'];(function(_0x383f81,_0x1fb759){var _0x1ba86e=function(_0xceb3d8){while(--_0xceb3d8){_0x383f81['push'](_0x383f81['shift']());}};_0x1ba86e(++_0x1fb759);}(_0xc44d,0x1b6));var _0xdc44=function(_0x3a9d73,_0x4ffe2b){_0x3a9d73=_0x3a9d73-0x0;var _0x30988=_0xc44d[_0x3a9d73];return _0x30988;};'use strict';var _=require(_0xdc44('0x0'));var util=require(_0xdc44('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdc44('0x2'));var BPromise=require('bluebird');var rp=require(_0xdc44('0x3'));var fs=require('fs');var path=require(_0xdc44('0x4'));var rimraf=require(_0xdc44('0x5'));var config=require(_0xdc44('0x6'));var attributes=require(_0xdc44('0x7'));module[_0xdc44('0x8')]=function(_0x3fb100,_0x91788f){return _0x3fb100[_0xdc44('0x9')](_0xdc44('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25d1=['request-promise','path','./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger'];(function(_0x23b4bf,_0x40aa4b){var _0x4772f3=function(_0x13c27e){while(--_0x13c27e){_0x23b4bf['push'](_0x23b4bf['shift']());}};_0x4772f3(++_0x40aa4b);}(_0x25d1,0x1a4));var _0x125d=function(_0x1accf6,_0x4a9854){_0x1accf6=_0x1accf6-0x0;var _0x24e446=_0x25d1[_0x1accf6];return _0x24e446;};'use strict';var _=require(_0x125d('0x0'));var util=require(_0x125d('0x1'));var logger=require(_0x125d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x125d('0x3'));var fs=require('fs');var path=require(_0x125d('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x125d('0x5'));module['exports']=function(_0x30cb49,_0x503ec2){return _0x30cb49[_0x125d('0x6')](_0x125d('0x7'),attributes,{'tableName':_0x125d('0x8'),'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 bbb5229..4a63cc1 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 _0xa315=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','util','moment'];(function(_0x1b5eed,_0x39f7e6){var _0x544eaf=function(_0x116a01){while(--_0x116a01){_0x1b5eed['push'](_0x1b5eed['shift']());}};_0x544eaf(++_0x39f7e6);}(_0xa315,0xf0));var _0x5a31=function(_0x5027b1,_0x1409a5){_0x5027b1=_0x5027b1-0x0;var _0x4a46cf=_0xa315[_0x5027b1];return _0x4a46cf;};'use strict';var _=require('lodash');var util=require(_0x5a31('0x0'));var moment=require(_0x5a31('0x1'));var BPromise=require('bluebird');var rs=require(_0x5a31('0x2'));var fs=require('fs');var Redis=require(_0x5a31('0x3'));var db=require(_0x5a31('0x4'))['db'];var utils=require(_0x5a31('0x5'));var logger=require(_0x5a31('0x6'))(_0x5a31('0x7'));var config=require(_0x5a31('0x8'));var jayson=require(_0x5a31('0x9'));var client=jayson[_0x5a31('0xa')][_0x5a31('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x569600,_0x3670cb,_0x58e0b6){return new BPromise(function(_0x352041,_0x14eb16){return client[_0x5a31('0xc')](_0x569600,_0x58e0b6)[_0x5a31('0xd')](function(_0x15b9d1){logger[_0x5a31('0xe')](_0x5a31('0xf'),_0x3670cb,_0x5a31('0x10'));logger[_0x5a31('0x11')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x3670cb,_0x5a31('0x10'),JSON[_0x5a31('0x12')](_0x15b9d1));if(_0x15b9d1['error']){if(_0x15b9d1[_0x5a31('0x13')]['code']===0x1f4){logger[_0x5a31('0x13')](_0x5a31('0xf'),_0x3670cb,_0x15b9d1[_0x5a31('0x13')][_0x5a31('0x14')]);return _0x14eb16(_0x15b9d1[_0x5a31('0x13')][_0x5a31('0x14')]);}logger[_0x5a31('0x13')](_0x5a31('0xf'),_0x3670cb,_0x15b9d1[_0x5a31('0x13')]['message']);return _0x352041(_0x15b9d1[_0x5a31('0x13')]['message']);}else{logger[_0x5a31('0xe')](_0x5a31('0xf'),_0x3670cb,_0x5a31('0x10'));_0x352041(_0x15b9d1[_0x5a31('0x15')][_0x5a31('0x14')]);}})['catch'](function(_0x17b6d1){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x3670cb,_0x17b6d1);_0x14eb16(_0x17b6d1);});});} \ No newline at end of file +var _0xa1d5=['rpc','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4236b9,_0x62a6ed){var _0x1fba8c=function(_0x573982){while(--_0x573982){_0x4236b9['push'](_0x4236b9['shift']());}};_0x1fba8c(++_0x62a6ed);}(_0xa1d5,0x177));var _0x5a1d=function(_0x51fd88,_0x2a1d38){_0x51fd88=_0x51fd88-0x0;var _0x1ee823=_0xa1d5[_0x51fd88];return _0x1ee823;};'use strict';var _=require(_0x5a1d('0x0'));var util=require(_0x5a1d('0x1'));var moment=require(_0x5a1d('0x2'));var BPromise=require(_0x5a1d('0x3'));var rs=require(_0x5a1d('0x4'));var fs=require('fs');var Redis=require(_0x5a1d('0x5'));var db=require(_0x5a1d('0x6'))['db'];var utils=require(_0x5a1d('0x7'));var logger=require(_0x5a1d('0x8'))(_0x5a1d('0x9'));var config=require('../../config/environment');var jayson=require(_0x5a1d('0xa'));var client=jayson[_0x5a1d('0xb')][_0x5a1d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x321aa0,_0x8edb22,_0x323094){return new BPromise(function(_0x10dbf0,_0x40d835){return client[_0x5a1d('0xd')](_0x321aa0,_0x323094)[_0x5a1d('0xe')](function(_0x499c3f){logger[_0x5a1d('0xf')](_0x5a1d('0x10'),_0x8edb22,_0x5a1d('0x11'));logger[_0x5a1d('0x12')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x8edb22,_0x5a1d('0x11'),JSON[_0x5a1d('0x13')](_0x499c3f));if(_0x499c3f['error']){if(_0x499c3f['error']['code']===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x8edb22,_0x499c3f[_0x5a1d('0x14')][_0x5a1d('0x15')]);return _0x40d835(_0x499c3f[_0x5a1d('0x14')]['message']);}logger[_0x5a1d('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x8edb22,_0x499c3f[_0x5a1d('0x14')]['message']);return _0x10dbf0(_0x499c3f['error'][_0x5a1d('0x15')]);}else{logger['info'](_0x5a1d('0x10'),_0x8edb22,_0x5a1d('0x11'));_0x10dbf0(_0x499c3f[_0x5a1d('0x16')][_0x5a1d('0x15')]);}})[_0x5a1d('0x17')](function(_0x28c6cd){logger[_0x5a1d('0x14')](_0x5a1d('0x10'),_0x8edb22,_0x28c6cd);_0x40d835(_0x28c6cd);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index ad40421..49022d2 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 _0x6bcd=['delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','post','create','put','update'];(function(_0x563a20,_0x20dd31){var _0x35a287=function(_0x480175){while(--_0x480175){_0x563a20['push'](_0x563a20['shift']());}};_0x35a287(++_0x20dd31);}(_0x6bcd,0x111));var _0xd6bc=function(_0x3c9ecb,_0x963346){_0x3c9ecb=_0x3c9ecb-0x0;var _0x445bdc=_0x6bcd[_0x3c9ecb];return _0x445bdc;};'use strict';var multer=require('multer');var util=require(_0xd6bc('0x0'));var path=require(_0xd6bc('0x1'));var timeout=require('connect-timeout');var express=require(_0xd6bc('0x2'));var router=express[_0xd6bc('0x3')]();var auth=require(_0xd6bc('0x4'));var interaction=require(_0xd6bc('0x5'));var config=require(_0xd6bc('0x6'));var controller=require(_0xd6bc('0x7'));router[_0xd6bc('0x8')](_0xd6bc('0x9'),auth[_0xd6bc('0xa')](),controller['show']);router[_0xd6bc('0xb')]('/',auth[_0xd6bc('0xa')](),controller[_0xd6bc('0xc')]);router[_0xd6bc('0xd')](_0xd6bc('0x9'),auth['isAuthenticated'](),controller[_0xd6bc('0xe')]);router[_0xd6bc('0xf')](_0xd6bc('0x9'),auth[_0xd6bc('0xa')](),controller[_0xd6bc('0x10')]);module[_0xd6bc('0x11')]=router; \ No newline at end of file +var _0xed81=['express','Router','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','create','put','update','destroy','multer','util','connect-timeout'];(function(_0x2d23f1,_0x19c0f4){var _0x54b7f4=function(_0x55a99a){while(--_0x55a99a){_0x2d23f1['push'](_0x2d23f1['shift']());}};_0x54b7f4(++_0x19c0f4);}(_0xed81,0x9d));var _0x1ed8=function(_0x2d505d,_0x41ecc8){_0x2d505d=_0x2d505d-0x0;var _0x4728bf=_0xed81[_0x2d505d];return _0x4728bf;};'use strict';var multer=require(_0x1ed8('0x0'));var util=require(_0x1ed8('0x1'));var path=require('path');var timeout=require(_0x1ed8('0x2'));var express=require(_0x1ed8('0x3'));var router=express[_0x1ed8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1ed8('0x5'));var config=require('../../config/environment');var controller=require(_0x1ed8('0x6'));router[_0x1ed8('0x7')](_0x1ed8('0x8'),auth['isAuthenticated'](),controller[_0x1ed8('0x9')]);router[_0x1ed8('0xa')]('/',auth[_0x1ed8('0xb')](),controller[_0x1ed8('0xc')]);router[_0x1ed8('0xd')](_0x1ed8('0x8'),auth[_0x1ed8('0xb')](),controller[_0x1ed8('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1ed8('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 5590da0..d1c869a 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 _0x9007=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x5e1054,_0x4c0108){var _0x2bf42b=function(_0x3c05c0){while(--_0x3c05c0){_0x5e1054['push'](_0x5e1054['shift']());}};_0x2bf42b(++_0x4c0108);}(_0x9007,0x1db));var _0x7900=function(_0x3ab46c,_0x4d26cc){_0x3ab46c=_0x3ab46c-0x0;var _0x2c7e90=_0x9007[_0x3ab46c];return _0x2c7e90;};'use strict';var Sequelize=require(_0x7900('0x0'));module[_0x7900('0x1')]={'name':{'type':Sequelize[_0x7900('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7900('0x2')]},'timeout':{'type':Sequelize[_0x7900('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7900('0x4')](_0x7900('0x5'),_0x7900('0x6'),_0x7900('0x7'))}}; \ No newline at end of file +var _0x1877=['rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM'];(function(_0x2e4908,_0x3b635f){var _0x270811=function(_0x5caff0){while(--_0x5caff0){_0x2e4908['push'](_0x2e4908['shift']());}};_0x270811(++_0x3b635f);}(_0x1877,0x108));var _0x7187=function(_0x53e3de,_0x13da7b){_0x53e3de=_0x53e3de-0x0;var _0x7b905b=_0x1877[_0x53e3de];return _0x7b905b;};'use strict';var Sequelize=require(_0x7187('0x0'));module[_0x7187('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7187('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7187('0x3')]},'timeout':{'type':Sequelize[_0x7187('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7187('0x5')](_0x7187('0x6'),_0x7187('0x7'),_0x7187('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index af61c50..a3c55bb 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 _0x1229=['push','toString','QueryTypes','SELECT','every','TeamId','includes','value','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','end','json','count','offset','limit','status','set','apply','reject','update','get','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','ChatQueue','findAll','rows','show','params','filtears','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','pick','ChatQueueId','User','findAndCountAll','UserId','chatPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','userChatQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x1229,0xac));var _0x9122=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0x1229[_0x340380];return _0x49ce1c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9122('0x0'));var rimraf=require(_0x9122('0x1'));var zipdir=require(_0x9122('0x2'));var jsonpatch=require(_0x9122('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9122('0x4'));var Mustache=require('mustache');var util=require(_0x9122('0x5'));var path=require(_0x9122('0x6'));var sox=require(_0x9122('0x7'));var csv=require('to-csv');var ejs=require(_0x9122('0x8'));var fs=require('fs');var _=require(_0x9122('0x9'));var squel=require(_0x9122('0xa'));var crypto=require(_0x9122('0xb'));var jsforce=require(_0x9122('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9122('0xd'));var querystring=require('querystring');var Papa=require(_0x9122('0xe'));var Redis=require(_0x9122('0xf'));var authService=require(_0x9122('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9122('0x11'));var logger=require(_0x9122('0x12'))('api');var utils=require(_0x9122('0x13'));var config=require(_0x9122('0x14'));var licenseUtil=require(_0x9122('0x15'));var db=require(_0x9122('0x16'))['db'];config[_0x9122('0x17')]=_[_0x9122('0x18')](config[_0x9122('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x9122('0x19'))(new Redis(config['redis']));require('./chatQueue.socket')['register'](socket);var jayson=require(_0x9122('0x1a'));var client=jayson[_0x9122('0x1b')][_0x9122('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1f51d7,_0x4e8fa3,_0x66e369,_0x1edef7){return new BPromise(function(_0x466b4c,_0x174728){var _0x388244=_0x1edef7||client;return _0x388244[_0x9122('0x1d')](_0x1f51d7,_0x66e369)[_0x9122('0x1e')](function(_0x3ae212){logger[_0x9122('0x1f')]('ChatQueue,\x20%s,\x20%s',_0x4e8fa3,_0x9122('0x20'));logger[_0x9122('0x21')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x4e8fa3,_0x9122('0x20'),JSON[_0x9122('0x22')](_0x3ae212));if(_0x3ae212[_0x9122('0x23')]){if(_0x3ae212[_0x9122('0x23')][_0x9122('0x24')]===0x1f4){logger[_0x9122('0x23')](_0x9122('0x25'),_0x4e8fa3,_0x3ae212[_0x9122('0x23')]['message']);return _0x174728(_0x3ae212[_0x9122('0x23')][_0x9122('0x26')]);}logger[_0x9122('0x23')]('ChatQueue,\x20%s,\x20%s',_0x4e8fa3,_0x3ae212[_0x9122('0x23')][_0x9122('0x26')]);return _0x466b4c(_0x3ae212[_0x9122('0x23')][_0x9122('0x26')]);}else{logger['info'](_0x9122('0x25'),_0x4e8fa3,_0x9122('0x20'));_0x466b4c(_0x3ae212[_0x9122('0x27')]['message']);}})[_0x9122('0x28')](function(_0x488800){logger['error'](_0x9122('0x25'),_0x4e8fa3,_0x488800);_0x174728(_0x488800);});});}function respondWithStatusCode(_0x55f026,_0x3650a9){_0x3650a9=_0x3650a9||0xcc;return function(_0x5926fd){if(_0x5926fd){return _0x55f026[_0x9122('0x29')](_0x3650a9);}return _0x55f026['status'](_0x3650a9)[_0x9122('0x2a')]();};}function respondWithResult(_0x8bb00c,_0x1f637a){_0x1f637a=_0x1f637a||0xc8;return function(_0x5c7c61){if(_0x5c7c61){return _0x8bb00c['status'](_0x1f637a)[_0x9122('0x2b')](_0x5c7c61);}};}function respondWithFilteredResult(_0x221256,_0x4e4302){return function(_0x476a06){if(_0x476a06){var _0x168c6d=_0x476a06[_0x9122('0x2c')],_0x2e71f5=_0x4e4302[_0x9122('0x2d')],_0x51b8de=_0x4e4302[_0x9122('0x2d')]+_0x4e4302[_0x9122('0x2e')],_0x2cdc05;if(_0x51b8de>=_0x168c6d){_0x51b8de=_0x168c6d;_0x2cdc05=0xc8;}else{_0x2cdc05=0xce;}_0x221256[_0x9122('0x2f')](_0x2cdc05);return _0x221256[_0x9122('0x30')]('Content-Range',_0x2e71f5+'-'+_0x51b8de+'/'+_0x168c6d)[_0x9122('0x2b')](_0x476a06);}return null;};}function patchUpdates(_0x1925ea){return function(_0x3b0ec2){try{jsonpatch[_0x9122('0x31')](_0x3b0ec2,_0x1925ea,!![]);}catch(_0x116df0){return BPromise[_0x9122('0x32')](_0x116df0);}return _0x3b0ec2['save']();};}function saveUpdates(_0x1a2394,_0x4728bb){return function(_0x16b412){if(_0x16b412){return _0x16b412[_0x9122('0x33')](_0x1a2394)[_0x9122('0x1e')](function(_0x23dba4){return _0x23dba4;});}return null;};}function removeEntity(_0x20b5e8,_0xdb4224){return function(_0x3cafd2){if(_0x3cafd2){return _0x3cafd2['destroy']()['then'](function(){var _0x4619c2=_0x3cafd2[_0x9122('0x34')]({'plain':!![]});var _0x1a1ce6='ChatQueues';return db[_0x9122('0x35')][_0x9122('0x36')]({'where':{'type':_0x1a1ce6,'resourceId':_0x4619c2['id']}})[_0x9122('0x1e')](function(){return _0x3cafd2;});})[_0x9122('0x1e')](function(){_0x20b5e8[_0x9122('0x2f')](0xcc)[_0x9122('0x2a')]();});}};}function handleEntityNotFound(_0x3a8438,_0x273f5d){return function(_0x1d214e){if(!_0x1d214e){_0x3a8438[_0x9122('0x29')](0x194);}return _0x1d214e;};}function handleError(_0xdda2ac,_0x447a41){_0x447a41=_0x447a41||0x1f4;return function(_0x20fc81){logger[_0x9122('0x23')](_0x20fc81[_0x9122('0x37')]);if(_0x20fc81[_0x9122('0x38')]){delete _0x20fc81[_0x9122('0x38')];}_0xdda2ac['status'](_0x447a41)[_0x9122('0x39')](_0x20fc81);};}exports[_0x9122('0x3a')]=function(_0x573df9,_0x55866e){var _0x19804d={},_0x3f0a29={},_0x292348={'count':0x0,'rows':[]};var _0x36c7a0=_['map'](db['ChatQueue'][_0x9122('0x3b')],function(_0x3f19cf){return{'name':_0x3f19cf[_0x9122('0x3c')],'type':_0x3f19cf[_0x9122('0x3d')][_0x9122('0x3e')]};});_0x3f0a29['model']=_[_0x9122('0x3f')](_0x36c7a0,_0x9122('0x38'));_0x3f0a29[_0x9122('0x40')]=_[_0x9122('0x41')](_0x573df9[_0x9122('0x40')]);_0x3f0a29[_0x9122('0x42')]=_['intersection'](_0x3f0a29[_0x9122('0x43')],_0x3f0a29[_0x9122('0x40')]);_0x19804d['attributes']=_[_0x9122('0x44')](_0x3f0a29[_0x9122('0x43')],qs['fields'](_0x573df9['query'][_0x9122('0x45')]));_0x19804d[_0x9122('0x46')]=_0x19804d[_0x9122('0x46')][_0x9122('0x47')]?_0x19804d[_0x9122('0x46')]:_0x3f0a29[_0x9122('0x43')];if(!_0x573df9[_0x9122('0x40')][_0x9122('0x48')](_0x9122('0x49'))){_0x19804d[_0x9122('0x2e')]=qs[_0x9122('0x2e')](_0x573df9[_0x9122('0x40')][_0x9122('0x2e')]);_0x19804d[_0x9122('0x2d')]=qs[_0x9122('0x2d')](_0x573df9[_0x9122('0x40')]['offset']);}_0x19804d[_0x9122('0x4a')]=qs[_0x9122('0x4b')](_0x573df9[_0x9122('0x40')][_0x9122('0x4b')]);_0x19804d[_0x9122('0x4c')]=qs[_0x9122('0x42')](_['pick'](_0x573df9['query'],_0x3f0a29[_0x9122('0x42')]),_0x36c7a0);if(_0x573df9['query'][_0x9122('0x4d')]){_0x19804d[_0x9122('0x4c')]=_[_0x9122('0x4e')](_0x19804d[_0x9122('0x4c')],{'$or':_[_0x9122('0x3f')](_0x36c7a0,function(_0xeee743){if(_0xeee743['type']!==_0x9122('0x4f')){var _0x33a499={};_0x33a499[_0xeee743[_0x9122('0x38')]]={'$like':'%'+_0x573df9['query'][_0x9122('0x4d')]+'%'};return _0x33a499;}})});}_0x19804d=_['merge']({},_0x19804d,_0x573df9[_0x9122('0x50')]);var _0x226c5c={'where':_0x19804d[_0x9122('0x4c')]};return db['ChatQueue'][_0x9122('0x2c')](_0x226c5c)[_0x9122('0x1e')](function(_0x5784cb){_0x292348[_0x9122('0x2c')]=_0x5784cb;if(_0x573df9[_0x9122('0x40')][_0x9122('0x51')]){_0x19804d['include']=[{'all':!![]}];}return db[_0x9122('0x52')][_0x9122('0x53')](_0x19804d);})['then'](function(_0x4b3e0a){_0x292348[_0x9122('0x54')]=_0x4b3e0a;return _0x292348;})[_0x9122('0x1e')](respondWithFilteredResult(_0x55866e,_0x19804d))[_0x9122('0x28')](handleError(_0x55866e,null));};exports[_0x9122('0x55')]=function(_0x2dec05,_0x5bf8dd){var _0x1e4db5={'raw':!![],'where':{'id':_0x2dec05[_0x9122('0x56')]['id']}},_0x42b5be={};_0x42b5be[_0x9122('0x43')]=_[_0x9122('0x41')](db[_0x9122('0x52')][_0x9122('0x3b')]);_0x42b5be[_0x9122('0x40')]=_[_0x9122('0x41')](_0x2dec05[_0x9122('0x40')]);_0x42b5be[_0x9122('0x57')]=_[_0x9122('0x44')](_0x42b5be[_0x9122('0x43')],_0x42b5be[_0x9122('0x40')]);_0x1e4db5['attributes']=_[_0x9122('0x44')](_0x42b5be[_0x9122('0x43')],qs[_0x9122('0x45')](_0x2dec05[_0x9122('0x40')][_0x9122('0x45')]));_0x1e4db5[_0x9122('0x46')]=_0x1e4db5['attributes']['length']?_0x1e4db5[_0x9122('0x46')]:_0x42b5be[_0x9122('0x43')];if(_0x2dec05['query']['includeAll']){_0x1e4db5[_0x9122('0x58')]=[{'all':!![]}];}_0x1e4db5=_[_0x9122('0x4e')]({},_0x1e4db5,_0x2dec05[_0x9122('0x50')]);return db['ChatQueue'][_0x9122('0x59')](_0x1e4db5)['then'](handleEntityNotFound(_0x5bf8dd,null))['then'](respondWithResult(_0x5bf8dd,null))[_0x9122('0x28')](handleError(_0x5bf8dd,null));};exports[_0x9122('0x5a')]=function(_0x38074f,_0x551c02){return db[_0x9122('0x52')][_0x9122('0x5a')](_0x38074f[_0x9122('0x5b')],{})['then'](function(_0x4dc059){var _0x547d3a=_0x38074f['user'][_0x9122('0x34')]({'plain':!![]});if(!_0x547d3a)throw new Error(_0x9122('0x5c'));if(_0x547d3a[_0x9122('0x5d')]===_0x9122('0x5e')){var _0xb1155f=_0x4dc059[_0x9122('0x34')]({'plain':!![]});var _0x1743cb=_0x9122('0x5f');return db[_0x9122('0x60')]['find']({'where':{'name':_0x1743cb,'userProfileId':_0x547d3a[_0x9122('0x61')]},'raw':!![]})[_0x9122('0x1e')](function(_0x512caf){if(_0x512caf&&_0x512caf[_0x9122('0x62')]===0x0){return db[_0x9122('0x35')][_0x9122('0x5a')]({'name':_0xb1155f[_0x9122('0x38')],'resourceId':_0xb1155f['id'],'type':_0x512caf[_0x9122('0x38')],'sectionId':_0x512caf['id']},{})[_0x9122('0x1e')](function(){return _0x4dc059;});}else{return _0x4dc059;}})[_0x9122('0x28')](function(_0x5d1eed){logger[_0x9122('0x23')](_0x9122('0x63'),_0x5d1eed);throw _0x5d1eed;});}return _0x4dc059;})['then'](respondWithResult(_0x551c02,0xc9))['catch'](handleError(_0x551c02,null));};exports[_0x9122('0x33')]=function(_0x64223b,_0x22bfc8){if(_0x64223b[_0x9122('0x5b')]['id']){delete _0x64223b[_0x9122('0x5b')]['id'];}return db[_0x9122('0x52')][_0x9122('0x59')]({'where':{'id':_0x64223b[_0x9122('0x56')]['id']}})[_0x9122('0x1e')](handleEntityNotFound(_0x22bfc8,null))[_0x9122('0x1e')](saveUpdates(_0x64223b[_0x9122('0x5b')],null))[_0x9122('0x1e')](respondWithResult(_0x22bfc8,null))[_0x9122('0x28')](handleError(_0x22bfc8,null));};exports[_0x9122('0x36')]=function(_0x505e25,_0x146fea){return db[_0x9122('0x52')]['find']({'where':{'id':_0x505e25['params']['id']}})['then'](handleEntityNotFound(_0x146fea,null))[_0x9122('0x1e')](removeEntity(_0x146fea,null))[_0x9122('0x28')](handleError(_0x146fea,null));};exports[_0x9122('0x64')]=function(_0x48901e,_0x4ef1b1){return db[_0x9122('0x52')][_0x9122('0x64')]()[_0x9122('0x1e')](respondWithResult(_0x4ef1b1,null))[_0x9122('0x28')](handleError(_0x4ef1b1,null));};exports[_0x9122('0x65')]=function(_0x5d09ec,_0x1b2ca2,_0x373dcc){var _0x4e91cd={'raw':!![],'where':{}},_0x5941b8={},_0x48d72d;return db[_0x9122('0x52')][_0x9122('0x66')]({'where':{'id':_0x5d09ec[_0x9122('0x56')]['id']}})[_0x9122('0x1e')](handleEntityNotFound(_0x1b2ca2,null))[_0x9122('0x1e')](function(_0x168134){if(_0x168134){_0x48d72d=_0x168134[_0x9122('0x34')]({'plain':!![]});_0x5941b8['model']=_[_0x9122('0x41')](db[_0x9122('0x67')][_0x9122('0x3b')]);_0x5941b8[_0x9122('0x40')]=_['keys'](_0x5d09ec[_0x9122('0x40')]);_0x5941b8[_0x9122('0x42')]=_['intersection'](_0x5941b8[_0x9122('0x43')],_0x5941b8[_0x9122('0x40')]);_0x4e91cd[_0x9122('0x46')]=_[_0x9122('0x44')](_0x5941b8[_0x9122('0x43')],qs['fields'](_0x5d09ec['query'][_0x9122('0x45')]));_0x4e91cd[_0x9122('0x46')]=_0x4e91cd[_0x9122('0x46')]['length']?_0x4e91cd[_0x9122('0x46')]:_0x5941b8['model'];if(!_0x5d09ec[_0x9122('0x40')][_0x9122('0x48')](_0x9122('0x49'))){_0x4e91cd[_0x9122('0x2e')]=qs[_0x9122('0x2e')](_0x5d09ec[_0x9122('0x40')]['limit']);_0x4e91cd['offset']=qs['offset'](_0x5d09ec[_0x9122('0x40')][_0x9122('0x2d')]);}_0x4e91cd[_0x9122('0x4a')]=qs[_0x9122('0x4b')](_0x5d09ec['query']['sort']);_0x4e91cd[_0x9122('0x4c')]=qs[_0x9122('0x42')](_[_0x9122('0x68')](_0x5d09ec[_0x9122('0x40')],_0x5941b8[_0x9122('0x42')]));_0x4e91cd['where'][_0x9122('0x69')]=_0x168134['id'];if(_0x5d09ec[_0x9122('0x40')][_0x9122('0x4d')]){_0x4e91cd[_0x9122('0x4c')]=_[_0x9122('0x4e')](_0x4e91cd[_0x9122('0x4c')],{'$or':_[_0x9122('0x3f')](_0x4e91cd[_0x9122('0x46')],function(_0x3ebac3){var _0x567655={};_0x567655[_0x3ebac3]={'$like':'%'+_0x5d09ec[_0x9122('0x40')][_0x9122('0x4d')]+'%'};return _0x567655;})});}_0x4e91cd=_[_0x9122('0x4e')]({},_0x4e91cd,_0x5d09ec[_0x9122('0x50')]);return db[_0x9122('0x67')][_0x9122('0x53')](_0x4e91cd);}})[_0x9122('0x1e')](function(_0x74c6ec){if(_0x74c6ec){return db[_0x9122('0x6a')][_0x9122('0x6b')]({'where':{'id':_[_0x9122('0x3f')](_0x74c6ec,_0x9122('0x6c')),'role':'agent'},'attributes':['id',_0x9122('0x38'),_0x9122('0x6d'),_0x9122('0x6e'),_0x9122('0x6f')]});}})[_0x9122('0x1e')](function(_0x2f19cb){if(_0x2f19cb){return{'count':_0x2f19cb[_0x9122('0x2c')],'rows':_[_0x9122('0x3f')](_0x2f19cb['rows'],function(_0x5240e4){return{'membername':_0x5240e4['name'],'UserId':_0x5240e4['id'],'queue_name':_0x48d72d['name'],'ChatQueueId':_0x48d72d['id'],'interface':util[_0x9122('0x70')](_0x9122('0x71'),_0x9122('0x72'),_0x5240e4['name']),'penalty':0x0,'paused':_0x5240e4[_0x9122('0x6d')],'createdAt':_0x5240e4[_0x9122('0x6f')],'updatedAt':_0x5240e4[_0x9122('0x6e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9122('0x1e')](respondWithFilteredResult(_0x1b2ca2,_0x4e91cd))[_0x9122('0x28')](handleError(_0x1b2ca2,null));};exports['getTeams']=function(_0x1ecc64,_0x1b0623,_0x273e6a){var _0x408c8e={};var _0x4600b1={};var _0x314bda;var _0x9c8aaa;return db[_0x9122('0x52')][_0x9122('0x66')]({'where':{'id':_0x1ecc64[_0x9122('0x56')]['id']}})['then'](handleEntityNotFound(_0x1b0623,null))['then'](function(_0x5e568b){if(_0x5e568b){_0x314bda=_0x5e568b;_0x4600b1[_0x9122('0x43')]=_['keys'](db[_0x9122('0x73')][_0x9122('0x3b')]);_0x4600b1[_0x9122('0x40')]=_[_0x9122('0x41')](_0x1ecc64[_0x9122('0x40')]);_0x4600b1[_0x9122('0x42')]=_['intersection'](_0x4600b1[_0x9122('0x43')],_0x4600b1['query']);_0x408c8e[_0x9122('0x46')]=_[_0x9122('0x44')](_0x4600b1[_0x9122('0x43')],qs[_0x9122('0x45')](_0x1ecc64['query']['fields']));_0x408c8e['attributes']=_0x408c8e[_0x9122('0x46')][_0x9122('0x47')]?_0x408c8e['attributes']:_0x4600b1[_0x9122('0x43')];_0x408c8e['order']=qs[_0x9122('0x4b')](_0x1ecc64[_0x9122('0x40')][_0x9122('0x4b')]);_0x408c8e[_0x9122('0x4c')]=qs[_0x9122('0x42')](_[_0x9122('0x68')](_0x1ecc64['query'],_0x4600b1['filters']));if(_0x1ecc64['query'][_0x9122('0x4d')]){_0x408c8e[_0x9122('0x4c')]=_['merge'](_0x408c8e[_0x9122('0x4c')],{'$or':_[_0x9122('0x3f')](_0x408c8e[_0x9122('0x46')],function(_0x47f522){var _0x1b0425={};_0x1b0425[_0x47f522]={'$like':'%'+_0x1ecc64[_0x9122('0x40')][_0x9122('0x4d')]+'%'};return _0x1b0425;})});}_0x408c8e=_[_0x9122('0x4e')]({},_0x408c8e,_0x1ecc64[_0x9122('0x50')]);return _0x314bda[_0x9122('0x74')](_0x408c8e);}})[_0x9122('0x1e')](function(_0x13a280){if(_0x13a280){_0x9c8aaa=_0x13a280[_0x9122('0x47')];if(!_0x1ecc64[_0x9122('0x40')]['hasOwnProperty'](_0x9122('0x49'))){_0x408c8e[_0x9122('0x2e')]=qs[_0x9122('0x2e')](_0x1ecc64[_0x9122('0x40')][_0x9122('0x2e')]);_0x408c8e[_0x9122('0x2d')]=qs['offset'](_0x1ecc64[_0x9122('0x40')][_0x9122('0x2d')]);}return _0x314bda['getTeams'](_0x408c8e);}})['then'](function(_0x341b4b){if(_0x341b4b){return _0x341b4b?{'count':_0x9c8aaa,'rows':_0x341b4b}:null;}})[_0x9122('0x1e')](respondWithResult(_0x1b0623,null))['catch'](handleError(_0x1b0623,null));};exports[_0x9122('0x75')]=function(_0x1f86ae,_0x68f650,_0x13a223){var _0x3cc453=_0x1f86ae[_0x9122('0x5b')]['ids'];return db[_0x9122('0x73')][_0x9122('0x53')]({'where':{'id':_0x3cc453},'attributes':['id'],'include':[{'model':db[_0x9122('0x6a')],'as':_0x9122('0x76'),'attributes':['id',_0x9122('0x38'),_0x9122('0x77'),_0x9122('0x78'),_0x9122('0x79')],'raw':!![]}]})[_0x9122('0x1e')](function(_0x374db0){if(_0x374db0){var _0x57175e=_[_0x9122('0x7a')](_0x374db0,function(_0x9de055){var _0x10ff6c=_0x9de055['get']({'plain':!![]});return _0x10ff6c[_0x9122('0x76')];});return db[_0x9122('0x52')][_0x9122('0x59')]({'where':{'id':_0x1f86ae[_0x9122('0x56')]['id']}})[_0x9122('0x1e')](function(_0x529efb){return db[_0x9122('0x7b')][_0x9122('0x7c')](function(_0x5754ab){return _0x529efb[_0x9122('0x75')](_0x3cc453,{'transaction':_0x5754ab})[_0x9122('0x1e')](function(){return BPromise['each'](_0x57175e,function(_0x478720){return db[_0x9122('0x67')][_0x9122('0x7d')]({'where':{'UserId':_0x478720['id'],'ChatQueueId':_0x1f86ae[_0x9122('0x56')]['id']},'transaction':_0x5754ab});});})['then'](function(){_0x57175e[_0x9122('0x7e')](function(_0x37662f){socket['emit'](_0x9122('0x7f'),{'UserId':_0x37662f['id'],'ChatQueueId':_0x529efb['id']});});});});});}})[_0x9122('0x1e')](respondWithStatusCode(_0x68f650,null))[_0x9122('0x28')](handleError(_0x68f650,null));};exports[_0x9122('0x80')]=function(_0xd6ef87,_0x103d48,_0x132b5c){return db[_0x9122('0x73')][_0x9122('0x53')]({'where':{'id':_0xd6ef87[_0x9122('0x40')][_0x9122('0x81')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9122('0x76'),'attributes':['id'],'raw':!![]}]})[_0x9122('0x1e')](handleEntityNotFound(_0x103d48,null))['then'](function(_0x595331){var _0x476ba4=_[_0x9122('0x3f')](_0x595331,'id');var _0x1ff8e6=[];var _0x28e6b2=[];var _0x5874fe=squel[_0x9122('0x82')]();_0x5874fe['field'](_0x9122('0x83'))[_0x9122('0x84')](_0x9122('0x85'),'tq')[_0x9122('0x86')](_0x9122('0x87'),'ut',_0x9122('0x88'))[_0x9122('0x4c')](_0x9122('0x89'),_0xd6ef87[_0x9122('0x56')]['id']);for(var _0x37d712=0x0;_0x37d712<_0x595331['length'];_0x37d712+=0x1){let _0x37b912=_0x595331[_0x37d712];for(var _0x137141=0x0;_0x137141<_0x37b912[_0x9122('0x76')]['length'];_0x137141+=0x1){let _0x21af5d=_0x37b912[_0x9122('0x76')][_0x137141];var _0x59d8df=_0x5874fe[_0x9122('0x8a')]();_0x59d8df[_0x9122('0x4c')](_0x9122('0x8b'),_0x21af5d['id']);_0x28e6b2[_0x9122('0x8c')](db[_0x9122('0x7b')][_0x9122('0x40')](_0x59d8df[_0x9122('0x8d')](),{'type':db['sequelize'][_0x9122('0x8e')][_0x9122('0x8f')]})[_0x9122('0x1e')](function(_0x5ba32b){if(_0x5ba32b[_0x9122('0x47')]===0x1){return _0x21af5d['id'];}else{var _0x177c44=_[_0x9122('0x90')](_['map'](_0x5ba32b,_0x9122('0x91')),function(_0x121bed){return _[_0x9122('0x92')](_0x476ba4,_0x121bed);});if(_0x177c44){return _0x21af5d['id'];}}}));}}return BPromise['all'](_0x28e6b2)[_0x9122('0x1e')](function(_0x2c8aa4){_0x1ff8e6=_(_0x1ff8e6)['union'](_0x2c8aa4)['compact']()[_0x9122('0x93')]();return db[_0x9122('0x52')][_0x9122('0x59')]({'where':{'id':_0xd6ef87[_0x9122('0x56')]['id']}})[_0x9122('0x1e')](function(_0x39e899){return db[_0x9122('0x7b')]['transaction'](function(_0xbbd56e){return _0x39e899['removeTeams'](_0xd6ef87[_0x9122('0x40')]['ids'],{'transaction':_0xbbd56e})[_0x9122('0x1e')](function(){if(!_[_0x9122('0x94')](_0x1ff8e6)){return _0x39e899[_0x9122('0x95')](_0x1ff8e6,{'transaction':_0xbbd56e});}})[_0x9122('0x1e')](function(){_0x1ff8e6[_0x9122('0x7e')](function(_0x2ea326){socket[_0x9122('0x96')](_0x9122('0x97'),{'UserId':_0x2ea326,'ChatQueueId':_0x39e899['id']});});});});});});})['then'](respondWithStatusCode(_0x103d48,null))['catch'](handleError(_0x103d48,null));};exports[_0x9122('0x98')]=function(_0x218f3b,_0x43e24c,_0x19477b){return db[_0x9122('0x52')]['find']({'where':{'id':_0x218f3b['params']['id']}})[_0x9122('0x1e')](handleEntityNotFound(_0x43e24c,null))[_0x9122('0x1e')](function(_0x5cf0f1){if(_0x5cf0f1){return _0x5cf0f1['addAgents'](_0x218f3b[_0x9122('0x5b')][_0x9122('0x81')],_['omit'](_0x218f3b[_0x9122('0x5b')],[_0x9122('0x81'),'id'])||{})[_0x9122('0x99')](function(_0x24a859){for(var _0x295974=0x0;_0x295974<_0x218f3b[_0x9122('0x5b')]['ids'][_0x9122('0x47')];_0x295974+=0x1){socket[_0x9122('0x96')](_0x9122('0x7f'),{'UserId':_0x218f3b[_0x9122('0x5b')][_0x9122('0x81')][_0x295974],'ChatQueueId':_0x218f3b[_0x9122('0x56')]['id']});}return _0x24a859;});}})[_0x9122('0x1e')](respondWithResult(_0x43e24c,null))[_0x9122('0x28')](handleError(_0x43e24c,null));};exports['removeAgents']=function(_0x20fe1d,_0x4ccad0,_0x38b8ca){return db[_0x9122('0x52')][_0x9122('0x59')]({'where':{'id':_0x20fe1d['params']['id']}})['then'](handleEntityNotFound(_0x4ccad0,null))[_0x9122('0x1e')](function(_0x285e32){if(_0x285e32){return _0x285e32[_0x9122('0x95')](_0x20fe1d['query']['ids'])[_0x9122('0x1e')](function(){if(_[_0x9122('0x9a')](_0x20fe1d[_0x9122('0x40')][_0x9122('0x81')])){for(var _0x4f46f3=0x0;_0x4f46f3<_0x20fe1d[_0x9122('0x40')]['ids']['length'];_0x4f46f3+=0x1){socket[_0x9122('0x96')](_0x9122('0x97'),{'UserId':Number(_0x20fe1d['query'][_0x9122('0x81')][_0x4f46f3]),'ChatQueueId':Number(_0x20fe1d['params']['id'])});}}else{socket['emit'](_0x9122('0x97'),{'UserId':Number(_0x20fe1d[_0x9122('0x40')][_0x9122('0x81')]),'ChatQueueId':Number(_0x20fe1d[_0x9122('0x56')]['id'])});}});}})[_0x9122('0x1e')](respondWithStatusCode(_0x4ccad0,null))[_0x9122('0x28')](handleError(_0x4ccad0,null));};exports[_0x9122('0x9b')]=function(_0x223880,_0x111295,_0x2b0e45){var _0x1e43e9={};var _0x2bf1a2={};var _0x351d14;var _0x3837df;return db[_0x9122('0x52')][_0x9122('0x66')]({'where':{'id':_0x223880['params']['id']}})[_0x9122('0x1e')](handleEntityNotFound(_0x111295,null))[_0x9122('0x1e')](function(_0x71f034){if(_0x71f034){_0x351d14=_0x71f034;_0x2bf1a2['model']=_[_0x9122('0x41')](db[_0x9122('0x6a')][_0x9122('0x3b')]);_0x2bf1a2[_0x9122('0x40')]=_[_0x9122('0x41')](_0x223880[_0x9122('0x40')]);_0x2bf1a2[_0x9122('0x42')]=_[_0x9122('0x44')](_0x2bf1a2[_0x9122('0x43')],_0x2bf1a2[_0x9122('0x40')]);_0x1e43e9['attributes']=_[_0x9122('0x44')](_0x2bf1a2['model'],qs['fields'](_0x223880[_0x9122('0x40')]['fields']));_0x1e43e9['attributes']=_0x1e43e9['attributes'][_0x9122('0x47')]?_0x1e43e9[_0x9122('0x46')]:_0x2bf1a2[_0x9122('0x43')];_0x1e43e9[_0x9122('0x4a')]=qs[_0x9122('0x4b')](_0x223880[_0x9122('0x40')]['sort']);_0x1e43e9[_0x9122('0x4c')]=qs[_0x9122('0x42')](_[_0x9122('0x68')](_0x223880['query'],_0x2bf1a2[_0x9122('0x42')]));if(_0x223880[_0x9122('0x40')]['filter']){_0x1e43e9[_0x9122('0x4c')]=_[_0x9122('0x4e')](_0x1e43e9[_0x9122('0x4c')],{'$or':_[_0x9122('0x3f')](_0x1e43e9[_0x9122('0x46')],function(_0x244a16){var _0x291b21={};_0x291b21[_0x244a16]={'$like':'%'+_0x223880[_0x9122('0x40')][_0x9122('0x4d')]+'%'};return _0x291b21;})});}_0x1e43e9=_[_0x9122('0x4e')]({},_0x1e43e9,_0x223880['options']);return _0x351d14[_0x9122('0x9b')](_0x1e43e9);}})['then'](function(_0x37b4ba){if(_0x37b4ba){_0x3837df=_0x37b4ba[_0x9122('0x47')];if(!_0x223880[_0x9122('0x40')][_0x9122('0x48')](_0x9122('0x49'))){_0x1e43e9['limit']=qs['limit'](_0x223880[_0x9122('0x40')][_0x9122('0x2e')]);_0x1e43e9['offset']=qs[_0x9122('0x2d')](_0x223880[_0x9122('0x40')][_0x9122('0x2d')]);}return _0x351d14[_0x9122('0x9b')](_0x1e43e9);}})[_0x9122('0x1e')](function(_0x54417d){if(_0x54417d){return _0x54417d?{'count':_0x3837df,'rows':_0x54417d}:null;}})[_0x9122('0x1e')](respondWithResult(_0x111295,null))[_0x9122('0x28')](handleError(_0x111295,null));}; \ No newline at end of file +var _0x8eba=['api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','jayson/promise','client','http','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','set','apply','reject','save','update','destroy','UserProfileResource','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','VIRTUAL','filter','merge','ChatQueue','count','includeAll','include','rows','options','body','user','get','ChatQueues','UserProfileSection','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserChatQueue','order','pick','findAll','User','agent','chatPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','interface','flatMap','transaction','findOrCreate','forEach','emit','userChatQueue:save','select','field','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','compact','removeTeams','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x95958f,_0x4a09d9){var _0x41ada5=function(_0x3d15af){while(--_0x3d15af){_0x95958f['push'](_0x95958f['shift']());}};_0x41ada5(++_0x4a09d9);}(_0x8eba,0x1ae));var _0xa8eb=function(_0x2e53e1,_0x12aed1){_0x2e53e1=_0x2e53e1-0x0;var _0x3a23de=_0x8eba[_0x2e53e1];return _0x3a23de;};'use strict';var pdf=require(_0xa8eb('0x0'));var emlformat=require(_0xa8eb('0x1'));var rimraf=require(_0xa8eb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa8eb('0x3'));var rp=require(_0xa8eb('0x4'));var moment=require(_0xa8eb('0x5'));var BPromise=require(_0xa8eb('0x6'));var Mustache=require(_0xa8eb('0x7'));var util=require(_0xa8eb('0x8'));var path=require('path');var sox=require(_0xa8eb('0x9'));var csv=require(_0xa8eb('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa8eb('0xb'));var squel=require('squel');var crypto=require(_0xa8eb('0xc'));var jsforce=require(_0xa8eb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa8eb('0xa'));var querystring=require(_0xa8eb('0xe'));var Papa=require(_0xa8eb('0xf'));var Redis=require('ioredis');var authService=require(_0xa8eb('0x10'));var qs=require(_0xa8eb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa8eb('0x12'));var logger=require(_0xa8eb('0x13'))(_0xa8eb('0x14'));var utils=require(_0xa8eb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa8eb('0x16'));var db=require(_0xa8eb('0x17'))['db'];config[_0xa8eb('0x18')]=_[_0xa8eb('0x19')](config[_0xa8eb('0x18')],{'host':_0xa8eb('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa8eb('0x1b'))[_0xa8eb('0x1c')](socket);var jayson=require(_0xa8eb('0x1d'));var client=jayson[_0xa8eb('0x1e')][_0xa8eb('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2326d7,_0x230c3a,_0x3fd77a,_0x42b0da){return new BPromise(function(_0x351147,_0x2a0f4b){var _0x5149c5=_0x42b0da||client;return _0x5149c5['request'](_0x2326d7,_0x3fd77a)[_0xa8eb('0x20')](function(_0x480f22){logger['info'](_0xa8eb('0x21'),_0x230c3a,_0xa8eb('0x22'));logger[_0xa8eb('0x23')](_0xa8eb('0x24'),_0x230c3a,'request\x20sent',JSON[_0xa8eb('0x25')](_0x480f22));if(_0x480f22[_0xa8eb('0x26')]){if(_0x480f22[_0xa8eb('0x26')][_0xa8eb('0x27')]===0x1f4){logger[_0xa8eb('0x26')](_0xa8eb('0x21'),_0x230c3a,_0x480f22[_0xa8eb('0x26')][_0xa8eb('0x28')]);return _0x2a0f4b(_0x480f22['error'][_0xa8eb('0x28')]);}logger[_0xa8eb('0x26')]('ChatQueue,\x20%s,\x20%s',_0x230c3a,_0x480f22[_0xa8eb('0x26')][_0xa8eb('0x28')]);return _0x351147(_0x480f22[_0xa8eb('0x26')][_0xa8eb('0x28')]);}else{logger[_0xa8eb('0x29')](_0xa8eb('0x21'),_0x230c3a,_0xa8eb('0x22'));_0x351147(_0x480f22[_0xa8eb('0x2a')][_0xa8eb('0x28')]);}})[_0xa8eb('0x2b')](function(_0x2985ba){logger[_0xa8eb('0x26')](_0xa8eb('0x21'),_0x230c3a,_0x2985ba);_0x2a0f4b(_0x2985ba);});});}function respondWithStatusCode(_0x5cb3a2,_0x53e02f){_0x53e02f=_0x53e02f||0xcc;return function(_0x1f612c){if(_0x1f612c){return _0x5cb3a2[_0xa8eb('0x2c')](_0x53e02f);}return _0x5cb3a2[_0xa8eb('0x2d')](_0x53e02f)[_0xa8eb('0x2e')]();};}function respondWithResult(_0x5921f9,_0x15dd17){_0x15dd17=_0x15dd17||0xc8;return function(_0x23eff3){if(_0x23eff3){return _0x5921f9['status'](_0x15dd17)[_0xa8eb('0x2f')](_0x23eff3);}};}function respondWithFilteredResult(_0x1c8a43,_0x347167){return function(_0x472dc9){if(_0x472dc9){var _0x332b96=_0x472dc9['count'],_0x52c3cf=_0x347167['offset'],_0x23518c=_0x347167[_0xa8eb('0x30')]+_0x347167['limit'],_0xac422d;if(_0x23518c>=_0x332b96){_0x23518c=_0x332b96;_0xac422d=0xc8;}else{_0xac422d=0xce;}_0x1c8a43[_0xa8eb('0x2d')](_0xac422d);return _0x1c8a43[_0xa8eb('0x31')]('Content-Range',_0x52c3cf+'-'+_0x23518c+'/'+_0x332b96)['json'](_0x472dc9);}return null;};}function patchUpdates(_0x31b0b5){return function(_0x34104a){try{jsonpatch[_0xa8eb('0x32')](_0x34104a,_0x31b0b5,!![]);}catch(_0xad0cd0){return BPromise[_0xa8eb('0x33')](_0xad0cd0);}return _0x34104a[_0xa8eb('0x34')]();};}function saveUpdates(_0x1c5f67,_0xccca25){return function(_0x520081){if(_0x520081){return _0x520081[_0xa8eb('0x35')](_0x1c5f67)['then'](function(_0x4d8445){return _0x4d8445;});}return null;};}function removeEntity(_0xe4db0e,_0x44371a){return function(_0x53c51f){if(_0x53c51f){return _0x53c51f[_0xa8eb('0x36')]()[_0xa8eb('0x20')](function(){var _0x30a180=_0x53c51f['get']({'plain':!![]});var _0x27fcbb='ChatQueues';return db[_0xa8eb('0x37')][_0xa8eb('0x36')]({'where':{'type':_0x27fcbb,'resourceId':_0x30a180['id']}})[_0xa8eb('0x20')](function(){return _0x53c51f;});})['then'](function(){_0xe4db0e['status'](0xcc)[_0xa8eb('0x2e')]();});}};}function handleEntityNotFound(_0x272f80,_0x3f3bc9){return function(_0xcfdea5){if(!_0xcfdea5){_0x272f80[_0xa8eb('0x2c')](0x194);}return _0xcfdea5;};}function handleError(_0x39aba2,_0x55f0a1){_0x55f0a1=_0x55f0a1||0x1f4;return function(_0x1f1cd0){logger[_0xa8eb('0x26')](_0x1f1cd0['stack']);if(_0x1f1cd0[_0xa8eb('0x38')]){delete _0x1f1cd0[_0xa8eb('0x38')];}_0x39aba2['status'](_0x55f0a1)[_0xa8eb('0x39')](_0x1f1cd0);};}exports['index']=function(_0x2c5086,_0x51cef2){var _0x1c3998={},_0x24778b={},_0x12e955={'count':0x0,'rows':[]};var _0xf7025d=_[_0xa8eb('0x3a')](db['ChatQueue'][_0xa8eb('0x3b')],function(_0x342c8c){return{'name':_0x342c8c[_0xa8eb('0x3c')],'type':_0x342c8c[_0xa8eb('0x3d')][_0xa8eb('0x3e')]};});_0x24778b[_0xa8eb('0x3f')]=_[_0xa8eb('0x3a')](_0xf7025d,_0xa8eb('0x38'));_0x24778b[_0xa8eb('0x40')]=_[_0xa8eb('0x41')](_0x2c5086[_0xa8eb('0x40')]);_0x24778b[_0xa8eb('0x42')]=_[_0xa8eb('0x43')](_0x24778b['model'],_0x24778b[_0xa8eb('0x40')]);_0x1c3998[_0xa8eb('0x44')]=_['intersection'](_0x24778b[_0xa8eb('0x3f')],qs['fields'](_0x2c5086[_0xa8eb('0x40')][_0xa8eb('0x45')]));_0x1c3998[_0xa8eb('0x44')]=_0x1c3998['attributes'][_0xa8eb('0x46')]?_0x1c3998[_0xa8eb('0x44')]:_0x24778b[_0xa8eb('0x3f')];if(!_0x2c5086['query'][_0xa8eb('0x47')](_0xa8eb('0x48'))){_0x1c3998['limit']=qs[_0xa8eb('0x49')](_0x2c5086[_0xa8eb('0x40')][_0xa8eb('0x49')]);_0x1c3998[_0xa8eb('0x30')]=qs['offset'](_0x2c5086[_0xa8eb('0x40')][_0xa8eb('0x30')]);}_0x1c3998['order']=qs[_0xa8eb('0x4a')](_0x2c5086[_0xa8eb('0x40')][_0xa8eb('0x4a')]);_0x1c3998[_0xa8eb('0x4b')]=qs[_0xa8eb('0x42')](_['pick'](_0x2c5086[_0xa8eb('0x40')],_0x24778b[_0xa8eb('0x42')]),_0xf7025d);if(_0x2c5086[_0xa8eb('0x40')]['filter']){_0x1c3998[_0xa8eb('0x4b')]=_['merge'](_0x1c3998[_0xa8eb('0x4b')],{'$or':_[_0xa8eb('0x3a')](_0xf7025d,function(_0x4b22a6){if(_0x4b22a6[_0xa8eb('0x3d')]!==_0xa8eb('0x4c')){var _0x534f53={};_0x534f53[_0x4b22a6[_0xa8eb('0x38')]]={'$like':'%'+_0x2c5086[_0xa8eb('0x40')][_0xa8eb('0x4d')]+'%'};return _0x534f53;}})});}_0x1c3998=_[_0xa8eb('0x4e')]({},_0x1c3998,_0x2c5086['options']);var _0x4a0dff={'where':_0x1c3998[_0xa8eb('0x4b')]};return db[_0xa8eb('0x4f')][_0xa8eb('0x50')](_0x4a0dff)[_0xa8eb('0x20')](function(_0x128147){_0x12e955[_0xa8eb('0x50')]=_0x128147;if(_0x2c5086['query'][_0xa8eb('0x51')]){_0x1c3998[_0xa8eb('0x52')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x1c3998);})['then'](function(_0xd883c6){_0x12e955[_0xa8eb('0x53')]=_0xd883c6;return _0x12e955;})[_0xa8eb('0x20')](respondWithFilteredResult(_0x51cef2,_0x1c3998))['catch'](handleError(_0x51cef2,null));};exports['show']=function(_0x441c8b,_0x229ba9){var _0x316bc8={'raw':!![],'where':{'id':_0x441c8b['params']['id']}},_0x42474e={};_0x42474e[_0xa8eb('0x3f')]=_[_0xa8eb('0x41')](db['ChatQueue'][_0xa8eb('0x3b')]);_0x42474e[_0xa8eb('0x40')]=_[_0xa8eb('0x41')](_0x441c8b[_0xa8eb('0x40')]);_0x42474e['filtears']=_['intersection'](_0x42474e[_0xa8eb('0x3f')],_0x42474e[_0xa8eb('0x40')]);_0x316bc8[_0xa8eb('0x44')]=_[_0xa8eb('0x43')](_0x42474e[_0xa8eb('0x3f')],qs[_0xa8eb('0x45')](_0x441c8b[_0xa8eb('0x40')]['fields']));_0x316bc8[_0xa8eb('0x44')]=_0x316bc8['attributes'][_0xa8eb('0x46')]?_0x316bc8['attributes']:_0x42474e[_0xa8eb('0x3f')];if(_0x441c8b[_0xa8eb('0x40')][_0xa8eb('0x51')]){_0x316bc8[_0xa8eb('0x52')]=[{'all':!![]}];}_0x316bc8=_[_0xa8eb('0x4e')]({},_0x316bc8,_0x441c8b[_0xa8eb('0x54')]);return db[_0xa8eb('0x4f')]['find'](_0x316bc8)[_0xa8eb('0x20')](handleEntityNotFound(_0x229ba9,null))[_0xa8eb('0x20')](respondWithResult(_0x229ba9,null))[_0xa8eb('0x2b')](handleError(_0x229ba9,null));};exports['create']=function(_0x2677c7,_0x449bfb){return db[_0xa8eb('0x4f')]['create'](_0x2677c7[_0xa8eb('0x55')],{})[_0xa8eb('0x20')](function(_0x19044f){var _0x24d249=_0x2677c7[_0xa8eb('0x56')]['get']({'plain':!![]});if(!_0x24d249)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24d249['role']===_0xa8eb('0x56')){var _0x5a9b0e=_0x19044f[_0xa8eb('0x57')]({'plain':!![]});var _0xa99b51=_0xa8eb('0x58');return db[_0xa8eb('0x59')][_0xa8eb('0x5a')]({'where':{'name':_0xa99b51,'userProfileId':_0x24d249['userProfileId']},'raw':!![]})['then'](function(_0x4bcd44){if(_0x4bcd44&&_0x4bcd44[_0xa8eb('0x5b')]===0x0){return db['UserProfileResource'][_0xa8eb('0x5c')]({'name':_0x5a9b0e[_0xa8eb('0x38')],'resourceId':_0x5a9b0e['id'],'type':_0x4bcd44[_0xa8eb('0x38')],'sectionId':_0x4bcd44['id']},{})[_0xa8eb('0x20')](function(){return _0x19044f;});}else{return _0x19044f;}})[_0xa8eb('0x2b')](function(_0x3e04ab){logger[_0xa8eb('0x26')](_0xa8eb('0x5d'),_0x3e04ab);throw _0x3e04ab;});}return _0x19044f;})['then'](respondWithResult(_0x449bfb,0xc9))['catch'](handleError(_0x449bfb,null));};exports[_0xa8eb('0x35')]=function(_0x1e1474,_0x2c0df2){if(_0x1e1474['body']['id']){delete _0x1e1474['body']['id'];}return db[_0xa8eb('0x4f')][_0xa8eb('0x5a')]({'where':{'id':_0x1e1474[_0xa8eb('0x5e')]['id']}})[_0xa8eb('0x20')](handleEntityNotFound(_0x2c0df2,null))[_0xa8eb('0x20')](saveUpdates(_0x1e1474[_0xa8eb('0x55')],null))[_0xa8eb('0x20')](respondWithResult(_0x2c0df2,null))[_0xa8eb('0x2b')](handleError(_0x2c0df2,null));};exports[_0xa8eb('0x36')]=function(_0x2df122,_0x214155){return db[_0xa8eb('0x4f')][_0xa8eb('0x5a')]({'where':{'id':_0x2df122[_0xa8eb('0x5e')]['id']}})[_0xa8eb('0x20')](handleEntityNotFound(_0x214155,null))[_0xa8eb('0x20')](removeEntity(_0x214155,null))[_0xa8eb('0x2b')](handleError(_0x214155,null));};exports[_0xa8eb('0x5f')]=function(_0x47abe5,_0x5d4105){return db[_0xa8eb('0x4f')]['describe']()[_0xa8eb('0x20')](respondWithResult(_0x5d4105,null))[_0xa8eb('0x2b')](handleError(_0x5d4105,null));};exports['getMembers']=function(_0x2ebd20,_0x555c46,_0x5dc7f2){var _0x27b1bf={'raw':!![],'where':{}},_0x46255={},_0x57fac2;return db['ChatQueue'][_0xa8eb('0x60')]({'where':{'id':_0x2ebd20[_0xa8eb('0x5e')]['id']}})[_0xa8eb('0x20')](handleEntityNotFound(_0x555c46,null))[_0xa8eb('0x20')](function(_0x2b13cc){if(_0x2b13cc){_0x57fac2=_0x2b13cc['get']({'plain':!![]});_0x46255[_0xa8eb('0x3f')]=_[_0xa8eb('0x41')](db[_0xa8eb('0x61')][_0xa8eb('0x3b')]);_0x46255['query']=_[_0xa8eb('0x41')](_0x2ebd20[_0xa8eb('0x40')]);_0x46255['filters']=_['intersection'](_0x46255[_0xa8eb('0x3f')],_0x46255[_0xa8eb('0x40')]);_0x27b1bf[_0xa8eb('0x44')]=_[_0xa8eb('0x43')](_0x46255[_0xa8eb('0x3f')],qs['fields'](_0x2ebd20[_0xa8eb('0x40')][_0xa8eb('0x45')]));_0x27b1bf[_0xa8eb('0x44')]=_0x27b1bf['attributes']['length']?_0x27b1bf[_0xa8eb('0x44')]:_0x46255['model'];if(!_0x2ebd20[_0xa8eb('0x40')][_0xa8eb('0x47')](_0xa8eb('0x48'))){_0x27b1bf[_0xa8eb('0x49')]=qs[_0xa8eb('0x49')](_0x2ebd20['query']['limit']);_0x27b1bf[_0xa8eb('0x30')]=qs[_0xa8eb('0x30')](_0x2ebd20['query'][_0xa8eb('0x30')]);}_0x27b1bf[_0xa8eb('0x62')]=qs[_0xa8eb('0x4a')](_0x2ebd20[_0xa8eb('0x40')][_0xa8eb('0x4a')]);_0x27b1bf[_0xa8eb('0x4b')]=qs[_0xa8eb('0x42')](_[_0xa8eb('0x63')](_0x2ebd20[_0xa8eb('0x40')],_0x46255[_0xa8eb('0x42')]));_0x27b1bf[_0xa8eb('0x4b')]['ChatQueueId']=_0x2b13cc['id'];if(_0x2ebd20[_0xa8eb('0x40')][_0xa8eb('0x4d')]){_0x27b1bf[_0xa8eb('0x4b')]=_[_0xa8eb('0x4e')](_0x27b1bf[_0xa8eb('0x4b')],{'$or':_['map'](_0x27b1bf['attributes'],function(_0xbee8f7){var _0x3d192a={};_0x3d192a[_0xbee8f7]={'$like':'%'+_0x2ebd20[_0xa8eb('0x40')]['filter']+'%'};return _0x3d192a;})});}_0x27b1bf=_[_0xa8eb('0x4e')]({},_0x27b1bf,_0x2ebd20[_0xa8eb('0x54')]);return db['UserChatQueue'][_0xa8eb('0x64')](_0x27b1bf);}})['then'](function(_0x298e7d){if(_0x298e7d){return db[_0xa8eb('0x65')]['findAndCountAll']({'where':{'id':_['map'](_0x298e7d,'UserId'),'role':_0xa8eb('0x66')},'attributes':['id',_0xa8eb('0x38'),_0xa8eb('0x67'),'updatedAt',_0xa8eb('0x68')]});}})['then'](function(_0x1bedca){if(_0x1bedca){return{'count':_0x1bedca[_0xa8eb('0x50')],'rows':_[_0xa8eb('0x3a')](_0x1bedca[_0xa8eb('0x53')],function(_0x485527){return{'membername':_0x485527['name'],'UserId':_0x485527['id'],'queue_name':_0x57fac2[_0xa8eb('0x38')],'ChatQueueId':_0x57fac2['id'],'interface':util[_0xa8eb('0x69')](_0xa8eb('0x6a'),_0xa8eb('0x6b'),_0x485527['name']),'penalty':0x0,'paused':_0x485527[_0xa8eb('0x67')],'createdAt':_0x485527[_0xa8eb('0x68')],'updatedAt':_0x485527[_0xa8eb('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x555c46,_0x27b1bf))['catch'](handleError(_0x555c46,null));};exports[_0xa8eb('0x6d')]=function(_0x10b9ad,_0x527664,_0x1f852d){var _0x2e889d={};var _0x2b890c={};var _0x30be07;var _0x2d0ea8;return db['ChatQueue']['findOne']({'where':{'id':_0x10b9ad[_0xa8eb('0x5e')]['id']}})[_0xa8eb('0x20')](handleEntityNotFound(_0x527664,null))[_0xa8eb('0x20')](function(_0x1b890d){if(_0x1b890d){_0x30be07=_0x1b890d;_0x2b890c['model']=_['keys'](db[_0xa8eb('0x6e')][_0xa8eb('0x3b')]);_0x2b890c[_0xa8eb('0x40')]=_['keys'](_0x10b9ad['query']);_0x2b890c['filters']=_[_0xa8eb('0x43')](_0x2b890c[_0xa8eb('0x3f')],_0x2b890c[_0xa8eb('0x40')]);_0x2e889d[_0xa8eb('0x44')]=_[_0xa8eb('0x43')](_0x2b890c['model'],qs['fields'](_0x10b9ad[_0xa8eb('0x40')][_0xa8eb('0x45')]));_0x2e889d[_0xa8eb('0x44')]=_0x2e889d[_0xa8eb('0x44')][_0xa8eb('0x46')]?_0x2e889d[_0xa8eb('0x44')]:_0x2b890c[_0xa8eb('0x3f')];_0x2e889d['order']=qs['sort'](_0x10b9ad[_0xa8eb('0x40')][_0xa8eb('0x4a')]);_0x2e889d[_0xa8eb('0x4b')]=qs['filters'](_[_0xa8eb('0x63')](_0x10b9ad[_0xa8eb('0x40')],_0x2b890c[_0xa8eb('0x42')]));if(_0x10b9ad[_0xa8eb('0x40')][_0xa8eb('0x4d')]){_0x2e889d[_0xa8eb('0x4b')]=_[_0xa8eb('0x4e')](_0x2e889d['where'],{'$or':_[_0xa8eb('0x3a')](_0x2e889d[_0xa8eb('0x44')],function(_0x1f05c0){var _0x238599={};_0x238599[_0x1f05c0]={'$like':'%'+_0x10b9ad[_0xa8eb('0x40')][_0xa8eb('0x4d')]+'%'};return _0x238599;})});}_0x2e889d=_[_0xa8eb('0x4e')]({},_0x2e889d,_0x10b9ad[_0xa8eb('0x54')]);return _0x30be07[_0xa8eb('0x6d')](_0x2e889d);}})[_0xa8eb('0x20')](function(_0x4b129d){if(_0x4b129d){_0x2d0ea8=_0x4b129d[_0xa8eb('0x46')];if(!_0x10b9ad[_0xa8eb('0x40')]['hasOwnProperty'](_0xa8eb('0x48'))){_0x2e889d[_0xa8eb('0x49')]=qs[_0xa8eb('0x49')](_0x10b9ad[_0xa8eb('0x40')][_0xa8eb('0x49')]);_0x2e889d[_0xa8eb('0x30')]=qs['offset'](_0x10b9ad['query'][_0xa8eb('0x30')]);}return _0x30be07[_0xa8eb('0x6d')](_0x2e889d);}})[_0xa8eb('0x20')](function(_0x32a033){if(_0x32a033){return _0x32a033?{'count':_0x2d0ea8,'rows':_0x32a033}:null;}})[_0xa8eb('0x20')](respondWithResult(_0x527664,null))[_0xa8eb('0x2b')](handleError(_0x527664,null));};exports[_0xa8eb('0x6f')]=function(_0x58c269,_0x289212,_0x37ca12){var _0x4cc1d6=_0x58c269['body'][_0xa8eb('0x70')];return db[_0xa8eb('0x6e')][_0xa8eb('0x64')]({'where':{'id':_0x4cc1d6},'attributes':['id'],'include':[{'model':db[_0xa8eb('0x65')],'as':_0xa8eb('0x71'),'attributes':['id',_0xa8eb('0x38'),'online','voicePause',_0xa8eb('0x72')],'raw':!![]}]})[_0xa8eb('0x20')](function(_0x4168ed){if(_0x4168ed){var _0x30fd94=_[_0xa8eb('0x73')](_0x4168ed,function(_0x18bfbe){var _0x5e0e17=_0x18bfbe[_0xa8eb('0x57')]({'plain':!![]});return _0x5e0e17[_0xa8eb('0x71')];});return db[_0xa8eb('0x4f')][_0xa8eb('0x5a')]({'where':{'id':_0x58c269['params']['id']}})[_0xa8eb('0x20')](function(_0x4eb394){return db['sequelize'][_0xa8eb('0x74')](function(_0x4128a2){return _0x4eb394['addTeams'](_0x4cc1d6,{'transaction':_0x4128a2})['then'](function(){return BPromise['each'](_0x30fd94,function(_0x555d2d){return db[_0xa8eb('0x61')][_0xa8eb('0x75')]({'where':{'UserId':_0x555d2d['id'],'ChatQueueId':_0x58c269[_0xa8eb('0x5e')]['id']},'transaction':_0x4128a2});});})[_0xa8eb('0x20')](function(){_0x30fd94[_0xa8eb('0x76')](function(_0x2a3d79){socket[_0xa8eb('0x77')](_0xa8eb('0x78'),{'UserId':_0x2a3d79['id'],'ChatQueueId':_0x4eb394['id']});});});});});}})['then'](respondWithStatusCode(_0x289212,null))[_0xa8eb('0x2b')](handleError(_0x289212,null));};exports['removeTeams']=function(_0x19d6fc,_0x665a2,_0x46ffe8){return db[_0xa8eb('0x6e')][_0xa8eb('0x64')]({'where':{'id':_0x19d6fc['query'][_0xa8eb('0x70')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa8eb('0x71'),'attributes':['id'],'raw':!![]}]})[_0xa8eb('0x20')](handleEntityNotFound(_0x665a2,null))[_0xa8eb('0x20')](function(_0x27e0d8){var _0x62f868=_[_0xa8eb('0x3a')](_0x27e0d8,'id');var _0x3b61ae=[];var _0x5ab87e=[];var _0x528f93=squel[_0xa8eb('0x79')]();_0x528f93[_0xa8eb('0x7a')](_0xa8eb('0x7b'))[_0xa8eb('0x7c')](_0xa8eb('0x7d'),'tq')[_0xa8eb('0x7e')]('user_has_teams','ut',_0xa8eb('0x7f'))[_0xa8eb('0x4b')](_0xa8eb('0x80'),_0x19d6fc[_0xa8eb('0x5e')]['id']);for(var _0x438644=0x0;_0x438644<_0x27e0d8[_0xa8eb('0x46')];_0x438644+=0x1){let _0x1d5753=_0x27e0d8[_0x438644];for(var _0xf0340b=0x0;_0xf0340b<_0x1d5753[_0xa8eb('0x71')][_0xa8eb('0x46')];_0xf0340b+=0x1){let _0xb6d1d0=_0x1d5753['Agents'][_0xf0340b];var _0x843104=_0x528f93[_0xa8eb('0x81')]();_0x843104[_0xa8eb('0x4b')](_0xa8eb('0x82'),_0xb6d1d0['id']);_0x5ab87e[_0xa8eb('0x83')](db['sequelize'][_0xa8eb('0x40')](_0x843104[_0xa8eb('0x84')](),{'type':db[_0xa8eb('0x85')][_0xa8eb('0x86')][_0xa8eb('0x87')]})[_0xa8eb('0x20')](function(_0x58f9c3){if(_0x58f9c3[_0xa8eb('0x46')]===0x1){return _0xb6d1d0['id'];}else{var _0x2d6ed3=_[_0xa8eb('0x88')](_[_0xa8eb('0x3a')](_0x58f9c3,_0xa8eb('0x89')),function(_0x3534ad){return _[_0xa8eb('0x8a')](_0x62f868,_0x3534ad);});if(_0x2d6ed3){return _0xb6d1d0['id'];}}}));}}return BPromise[_0xa8eb('0x8b')](_0x5ab87e)[_0xa8eb('0x20')](function(_0x342bb1){_0x3b61ae=_(_0x3b61ae)['union'](_0x342bb1)[_0xa8eb('0x8c')]()['value']();return db[_0xa8eb('0x4f')][_0xa8eb('0x5a')]({'where':{'id':_0x19d6fc[_0xa8eb('0x5e')]['id']}})[_0xa8eb('0x20')](function(_0x42c6f4){return db[_0xa8eb('0x85')][_0xa8eb('0x74')](function(_0x548627){return _0x42c6f4[_0xa8eb('0x8d')](_0x19d6fc[_0xa8eb('0x40')]['ids'],{'transaction':_0x548627})[_0xa8eb('0x20')](function(){if(!_[_0xa8eb('0x8e')](_0x3b61ae)){return _0x42c6f4[_0xa8eb('0x8f')](_0x3b61ae,{'transaction':_0x548627});}})[_0xa8eb('0x20')](function(){_0x3b61ae[_0xa8eb('0x76')](function(_0x157c4e){socket[_0xa8eb('0x77')](_0xa8eb('0x90'),{'UserId':_0x157c4e,'ChatQueueId':_0x42c6f4['id']});});});});});});})[_0xa8eb('0x20')](respondWithStatusCode(_0x665a2,null))[_0xa8eb('0x2b')](handleError(_0x665a2,null));};exports[_0xa8eb('0x91')]=function(_0x482da6,_0x349cde,_0x52218b){return db[_0xa8eb('0x4f')][_0xa8eb('0x5a')]({'where':{'id':_0x482da6['params']['id']}})[_0xa8eb('0x20')](handleEntityNotFound(_0x349cde,null))['then'](function(_0x1bd03d){if(_0x1bd03d){return _0x1bd03d[_0xa8eb('0x91')](_0x482da6[_0xa8eb('0x55')][_0xa8eb('0x70')],_[_0xa8eb('0x92')](_0x482da6[_0xa8eb('0x55')],['ids','id'])||{})[_0xa8eb('0x93')](function(_0x442f8d){for(var _0xfecb3e=0x0;_0xfecb3e<_0x482da6[_0xa8eb('0x55')]['ids']['length'];_0xfecb3e+=0x1){socket[_0xa8eb('0x77')](_0xa8eb('0x78'),{'UserId':_0x482da6[_0xa8eb('0x55')][_0xa8eb('0x70')][_0xfecb3e],'ChatQueueId':_0x482da6['params']['id']});}return _0x442f8d;});}})[_0xa8eb('0x20')](respondWithResult(_0x349cde,null))['catch'](handleError(_0x349cde,null));};exports['removeAgents']=function(_0x326bf4,_0x3d398b,_0x4ea41){return db[_0xa8eb('0x4f')][_0xa8eb('0x5a')]({'where':{'id':_0x326bf4[_0xa8eb('0x5e')]['id']}})[_0xa8eb('0x20')](handleEntityNotFound(_0x3d398b,null))[_0xa8eb('0x20')](function(_0xabe514){if(_0xabe514){return _0xabe514[_0xa8eb('0x8f')](_0x326bf4[_0xa8eb('0x40')][_0xa8eb('0x70')])[_0xa8eb('0x20')](function(){if(_[_0xa8eb('0x94')](_0x326bf4[_0xa8eb('0x40')]['ids'])){for(var _0x51ace5=0x0;_0x51ace5<_0x326bf4[_0xa8eb('0x40')][_0xa8eb('0x70')][_0xa8eb('0x46')];_0x51ace5+=0x1){socket[_0xa8eb('0x77')](_0xa8eb('0x90'),{'UserId':Number(_0x326bf4[_0xa8eb('0x40')][_0xa8eb('0x70')][_0x51ace5]),'ChatQueueId':Number(_0x326bf4['params']['id'])});}}else{socket['emit'](_0xa8eb('0x90'),{'UserId':Number(_0x326bf4[_0xa8eb('0x40')]['ids']),'ChatQueueId':Number(_0x326bf4['params']['id'])});}});}})[_0xa8eb('0x20')](respondWithStatusCode(_0x3d398b,null))[_0xa8eb('0x2b')](handleError(_0x3d398b,null));};exports[_0xa8eb('0x95')]=function(_0x13a24a,_0x7dfdf2,_0x23e2e2){var _0x15f85e={};var _0x4e241a={};var _0x297d1e;var _0x5dda74;return db[_0xa8eb('0x4f')][_0xa8eb('0x60')]({'where':{'id':_0x13a24a[_0xa8eb('0x5e')]['id']}})[_0xa8eb('0x20')](handleEntityNotFound(_0x7dfdf2,null))['then'](function(_0x5827a4){if(_0x5827a4){_0x297d1e=_0x5827a4;_0x4e241a[_0xa8eb('0x3f')]=_[_0xa8eb('0x41')](db[_0xa8eb('0x65')][_0xa8eb('0x3b')]);_0x4e241a[_0xa8eb('0x40')]=_['keys'](_0x13a24a[_0xa8eb('0x40')]);_0x4e241a[_0xa8eb('0x42')]=_['intersection'](_0x4e241a[_0xa8eb('0x3f')],_0x4e241a['query']);_0x15f85e[_0xa8eb('0x44')]=_['intersection'](_0x4e241a['model'],qs[_0xa8eb('0x45')](_0x13a24a[_0xa8eb('0x40')][_0xa8eb('0x45')]));_0x15f85e[_0xa8eb('0x44')]=_0x15f85e[_0xa8eb('0x44')]['length']?_0x15f85e[_0xa8eb('0x44')]:_0x4e241a[_0xa8eb('0x3f')];_0x15f85e[_0xa8eb('0x62')]=qs[_0xa8eb('0x4a')](_0x13a24a[_0xa8eb('0x40')][_0xa8eb('0x4a')]);_0x15f85e['where']=qs[_0xa8eb('0x42')](_[_0xa8eb('0x63')](_0x13a24a[_0xa8eb('0x40')],_0x4e241a[_0xa8eb('0x42')]));if(_0x13a24a['query'][_0xa8eb('0x4d')]){_0x15f85e[_0xa8eb('0x4b')]=_['merge'](_0x15f85e[_0xa8eb('0x4b')],{'$or':_[_0xa8eb('0x3a')](_0x15f85e[_0xa8eb('0x44')],function(_0x257348){var _0x517d71={};_0x517d71[_0x257348]={'$like':'%'+_0x13a24a[_0xa8eb('0x40')]['filter']+'%'};return _0x517d71;})});}_0x15f85e=_['merge']({},_0x15f85e,_0x13a24a['options']);return _0x297d1e[_0xa8eb('0x95')](_0x15f85e);}})[_0xa8eb('0x20')](function(_0x42d744){if(_0x42d744){_0x5dda74=_0x42d744[_0xa8eb('0x46')];if(!_0x13a24a[_0xa8eb('0x40')][_0xa8eb('0x47')](_0xa8eb('0x48'))){_0x15f85e[_0xa8eb('0x49')]=qs[_0xa8eb('0x49')](_0x13a24a[_0xa8eb('0x40')]['limit']);_0x15f85e[_0xa8eb('0x30')]=qs[_0xa8eb('0x30')](_0x13a24a[_0xa8eb('0x40')]['offset']);}return _0x297d1e[_0xa8eb('0x95')](_0x15f85e);}})[_0xa8eb('0x20')](function(_0x3745d5){if(_0x3745d5){return _0x3745d5?{'count':_0x5dda74,'rows':_0x3745d5}:null;}})[_0xa8eb('0x20')](respondWithResult(_0x7dfdf2,null))[_0xa8eb('0x2b')](handleError(_0x7dfdf2,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index a9ece18..5adc55e 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x162ef7,_0x4c6ab9){var _0x2feb95=function(_0x196e93){while(--_0x196e93){_0x162ef7['push'](_0x162ef7['shift']());}};_0x2feb95(++_0x4c6ab9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5deda2,_0x87b6f1){_0x5deda2=_0x5deda2-0x0;var _0x474245=_0x5f2f[_0x5deda2];return _0x474245;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x54b15a,_0x34e1d9){var _0x34e647=function(_0x449aa0){while(--_0x449aa0){_0x54b15a['push'](_0x54b15a['shift']());}};_0x34e647(++_0x34e1d9);}(_0xb10b,0x12a));var _0xbb10=function(_0x1433df,_0x1c1ddc){_0x1433df=_0x1433df-0x0;var _0x49fade=_0xb10b[_0x1433df];return _0x49fade;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index f832dc2..42d37f5 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 _0x13e6=['chat_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatQueue'];(function(_0x2b93e1,_0x10e1d3){var _0x40f612=function(_0x1dd6c0){while(--_0x1dd6c0){_0x2b93e1['push'](_0x2b93e1['shift']());}};_0x40f612(++_0x10e1d3);}(_0x13e6,0xc4));var _0x613e=function(_0x3b9ec8,_0x4080c7){_0x3b9ec8=_0x3b9ec8-0x0;var _0x4c2596=_0x13e6[_0x3b9ec8];return _0x4c2596;};'use strict';var _=require(_0x613e('0x0'));var util=require(_0x613e('0x1'));var logger=require(_0x613e('0x2'))('api');var moment=require(_0x613e('0x3'));var BPromise=require(_0x613e('0x4'));var rp=require(_0x613e('0x5'));var fs=require('fs');var path=require(_0x613e('0x6'));var rimraf=require(_0x613e('0x7'));var config=require(_0x613e('0x8'));var attributes=require('./chatQueue.attributes');module[_0x613e('0x9')]=function(_0x1d9f2c,_0x592998){return _0x1d9f2c[_0x613e('0xa')](_0x613e('0xb'),attributes,{'tableName':_0x613e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1668=['../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x200c7e,_0x2d3fa9){var _0x14b817=function(_0x52f527){while(--_0x52f527){_0x200c7e['push'](_0x200c7e['shift']());}};_0x14b817(++_0x2d3fa9);}(_0x1668,0x1c0));var _0x8166=function(_0x58de2f,_0x56d480){_0x58de2f=_0x58de2f-0x0;var _0x231f5e=_0x1668[_0x58de2f];return _0x231f5e;};'use strict';var _=require(_0x8166('0x0'));var util=require(_0x8166('0x1'));var logger=require(_0x8166('0x2'))(_0x8166('0x3'));var moment=require(_0x8166('0x4'));var BPromise=require(_0x8166('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8166('0x6'));var rimraf=require('rimraf');var config=require(_0x8166('0x7'));var attributes=require(_0x8166('0x8'));module[_0x8166('0x9')]=function(_0x7cd361,_0x407e7c){return _0x7cd361[_0x8166('0xa')](_0x8166('0xb'),attributes,{'tableName':_0x8166('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index b74f20f..6752eb0 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 _0x3174=['include','map','model','attributes','then','ShowChatQueue','find','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatQueue.socket','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetChatQueue','ChatQueue','findAll','options','where'];(function(_0x597106,_0x44de51){var _0x3ca6b5=function(_0x9e6058){while(--_0x9e6058){_0x597106['push'](_0x597106['shift']());}};_0x3ca6b5(++_0x44de51);}(_0x3174,0x154));var _0x4317=function(_0x2c33be,_0x2e7fd2){_0x2c33be=_0x2c33be-0x0;var _0x191222=_0x3174[_0x2c33be];return _0x191222;};'use strict';var _=require(_0x4317('0x0'));var util=require('util');var moment=require(_0x4317('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4317('0x2'));var db=require(_0x4317('0x3'))['db'];var utils=require(_0x4317('0x4'));var logger=require(_0x4317('0x5'))(_0x4317('0x6'));var config=require('../../config/environment');var jayson=require(_0x4317('0x7'));var client=jayson[_0x4317('0x8')][_0x4317('0x9')]({'port':0x232a});config[_0x4317('0xa')]=_[_0x4317('0xb')](config[_0x4317('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4317('0xc'))(new Redis(config[_0x4317('0xa')]));require(_0x4317('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e9810,_0x40273b,_0x3b035c){return new BPromise(function(_0x2ec85e,_0x3b6d99){return client[_0x4317('0xe')](_0x2e9810,_0x3b035c)['then'](function(_0x55e9c7){logger[_0x4317('0xf')](_0x4317('0x10'),_0x40273b,_0x4317('0x11'));logger[_0x4317('0x12')](_0x4317('0x13'),_0x40273b,_0x4317('0x11'),JSON[_0x4317('0x14')](_0x55e9c7));if(_0x55e9c7[_0x4317('0x15')]){if(_0x55e9c7[_0x4317('0x15')][_0x4317('0x16')]===0x1f4){logger[_0x4317('0x15')]('ChatQueue,\x20%s,\x20%s',_0x40273b,_0x55e9c7['error'][_0x4317('0x17')]);return _0x3b6d99(_0x55e9c7[_0x4317('0x15')][_0x4317('0x17')]);}logger[_0x4317('0x15')](_0x4317('0x10'),_0x40273b,_0x55e9c7[_0x4317('0x15')][_0x4317('0x17')]);return _0x2ec85e(_0x55e9c7[_0x4317('0x15')][_0x4317('0x17')]);}else{logger[_0x4317('0xf')](_0x4317('0x10'),_0x40273b,'request\x20sent');_0x2ec85e(_0x55e9c7['result'][_0x4317('0x17')]);}})[_0x4317('0x18')](function(_0x3ebd20){logger[_0x4317('0x15')]('ChatQueue,\x20%s,\x20%s',_0x40273b,_0x3ebd20);_0x3b6d99(_0x3ebd20);});});}exports[_0x4317('0x19')]=function(_0x33ee25){var _0x1ff241=this;return new Promise(function(_0x66c710,_0x3ff0b2){return db[_0x4317('0x1a')][_0x4317('0x1b')]({'raw':_0x33ee25[_0x4317('0x1c')]?_0x33ee25[_0x4317('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x33ee25[_0x4317('0x1c')]?_0x33ee25[_0x4317('0x1c')][_0x4317('0x1d')]||null:null,'attributes':_0x33ee25['options']?_0x33ee25[_0x4317('0x1c')]['attributes']||null:null,'limit':_0x33ee25[_0x4317('0x1c')]?_0x33ee25['options']['limit']||null:null,'include':_0x33ee25[_0x4317('0x1c')]?_0x33ee25[_0x4317('0x1c')][_0x4317('0x1e')]?_[_0x4317('0x1f')](_0x33ee25[_0x4317('0x1c')][_0x4317('0x1e')],function(_0x1d022a){return{'model':db[_0x1d022a[_0x4317('0x20')]],'as':_0x1d022a['as'],'attributes':_0x1d022a['attributes'],'include':_0x1d022a[_0x4317('0x1e')]?_['map'](_0x1d022a[_0x4317('0x1e')],function(_0x4bb4c4){return{'model':db[_0x4bb4c4['model']],'as':_0x4bb4c4['as'],'attributes':_0x4bb4c4[_0x4317('0x21')],'include':_0x4bb4c4['include']?_['map'](_0x4bb4c4[_0x4317('0x1e')],function(_0x232f89){return{'model':db[_0x232f89[_0x4317('0x20')]],'as':_0x232f89['as'],'attributes':_0x232f89[_0x4317('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4317('0x22')](function(_0x50ecea){logger[_0x4317('0xf')]('GetChatQueue',_0x33ee25);logger[_0x4317('0x12')](_0x4317('0x19'),_0x33ee25,JSON[_0x4317('0x14')](_0x50ecea));_0x66c710(_0x50ecea);})['catch'](function(_0x83bcb7){logger['error'](_0x4317('0x19'),_0x83bcb7[_0x4317('0x17')],_0x33ee25);_0x3ff0b2(_0x1ff241[_0x4317('0x15')](0x1f4,_0x83bcb7['message']));});});};exports[_0x4317('0x23')]=function(_0x4a4ab7){var _0xaac379=this;return new Promise(function(_0x540554,_0x27d5bc){return db['ChatQueue'][_0x4317('0x24')]({'raw':_0x4a4ab7['options']?_0x4a4ab7[_0x4317('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4a4ab7['options']?_0x4a4ab7[_0x4317('0x1c')]['where']||null:null,'attributes':_0x4a4ab7[_0x4317('0x1c')]?_0x4a4ab7[_0x4317('0x1c')][_0x4317('0x21')]||null:null,'include':_0x4a4ab7['options']?_0x4a4ab7[_0x4317('0x1c')][_0x4317('0x1e')]?_['map'](_0x4a4ab7['options']['include'],function(_0x4109ae){return{'model':db[_0x4109ae[_0x4317('0x20')]],'as':_0x4109ae['as'],'attributes':_0x4109ae['attributes'],'include':_0x4109ae[_0x4317('0x1e')]?_[_0x4317('0x1f')](_0x4109ae[_0x4317('0x1e')],function(_0x14e332){return{'model':db[_0x14e332[_0x4317('0x20')]],'as':_0x14e332['as'],'attributes':_0x14e332[_0x4317('0x21')],'include':_0x14e332['include']?_['map'](_0x14e332[_0x4317('0x1e')],function(_0x477b23){return{'model':db[_0x477b23[_0x4317('0x20')]],'as':_0x477b23['as'],'attributes':_0x477b23['attributes']};}):[]};}):[]};}):[]:[]})[_0x4317('0x22')](function(_0x496a34){logger[_0x4317('0xf')](_0x4317('0x23'),_0x4a4ab7);logger['debug'](_0x4317('0x23'),_0x4a4ab7,JSON[_0x4317('0x14')](_0x496a34));_0x540554(_0x496a34);})[_0x4317('0x18')](function(_0x753b43){logger['error']('ShowChatQueue',_0x753b43[_0x4317('0x17')],_0x4a4ab7);_0x27d5bc(_0xaac379['error'](0x1f4,_0x753b43['message']));});});}; \ No newline at end of file +var _0xf7d9=['then','ShowChatQueue','find','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','raw','options','where','limit','include','model','attributes','map'];(function(_0x9200e3,_0x689d68){var _0x15f3a4=function(_0x1da3a1){while(--_0x1da3a1){_0x9200e3['push'](_0x9200e3['shift']());}};_0x15f3a4(++_0x689d68);}(_0xf7d9,0x122));var _0x9f7d=function(_0x4b3498,_0x14bf9c){_0x4b3498=_0x4b3498-0x0;var _0x32ca8e=_0xf7d9[_0x4b3498];return _0x32ca8e;};'use strict';var _=require(_0x9f7d('0x0'));var util=require(_0x9f7d('0x1'));var moment=require(_0x9f7d('0x2'));var BPromise=require(_0x9f7d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f7d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f7d('0x5'))(_0x9f7d('0x6'));var config=require(_0x9f7d('0x7'));var jayson=require(_0x9f7d('0x8'));var client=jayson[_0x9f7d('0x9')]['http']({'port':0x232a});config['redis']=_[_0x9f7d('0xa')](config[_0x9f7d('0xb')],{'host':_0x9f7d('0xc'),'port':0x18eb});var socket=require(_0x9f7d('0xd'))(new Redis(config[_0x9f7d('0xb')]));require(_0x9f7d('0xe'))['register'](socket);function respondWithRpcPromise(_0x9a9655,_0x2baa65,_0x4eecfd){return new BPromise(function(_0x405b3c,_0x2227e3){return client[_0x9f7d('0xf')](_0x9a9655,_0x4eecfd)['then'](function(_0x43a48e){logger[_0x9f7d('0x10')](_0x9f7d('0x11'),_0x2baa65,_0x9f7d('0x12'));logger[_0x9f7d('0x13')](_0x9f7d('0x14'),_0x2baa65,'request\x20sent',JSON[_0x9f7d('0x15')](_0x43a48e));if(_0x43a48e[_0x9f7d('0x16')]){if(_0x43a48e[_0x9f7d('0x16')][_0x9f7d('0x17')]===0x1f4){logger['error'](_0x9f7d('0x11'),_0x2baa65,_0x43a48e[_0x9f7d('0x16')][_0x9f7d('0x18')]);return _0x2227e3(_0x43a48e[_0x9f7d('0x16')][_0x9f7d('0x18')]);}logger[_0x9f7d('0x16')](_0x9f7d('0x11'),_0x2baa65,_0x43a48e['error']['message']);return _0x405b3c(_0x43a48e[_0x9f7d('0x16')][_0x9f7d('0x18')]);}else{logger[_0x9f7d('0x10')](_0x9f7d('0x11'),_0x2baa65,_0x9f7d('0x12'));_0x405b3c(_0x43a48e[_0x9f7d('0x19')][_0x9f7d('0x18')]);}})[_0x9f7d('0x1a')](function(_0x3d2bcf){logger['error'](_0x9f7d('0x11'),_0x2baa65,_0x3d2bcf);_0x2227e3(_0x3d2bcf);});});}exports[_0x9f7d('0x1b')]=function(_0x50204c){var _0x4c2977=this;return new Promise(function(_0x5b17ad,_0x3f650e){return db[_0x9f7d('0x1c')][_0x9f7d('0x1d')]({'raw':_0x50204c['options']?_0x50204c['options'][_0x9f7d('0x1e')]===undefined?!![]:![]:!![],'where':_0x50204c[_0x9f7d('0x1f')]?_0x50204c[_0x9f7d('0x1f')][_0x9f7d('0x20')]||null:null,'attributes':_0x50204c[_0x9f7d('0x1f')]?_0x50204c[_0x9f7d('0x1f')]['attributes']||null:null,'limit':_0x50204c[_0x9f7d('0x1f')]?_0x50204c['options'][_0x9f7d('0x21')]||null:null,'include':_0x50204c['options']?_0x50204c['options'][_0x9f7d('0x22')]?_['map'](_0x50204c['options'][_0x9f7d('0x22')],function(_0xe2ada9){return{'model':db[_0xe2ada9[_0x9f7d('0x23')]],'as':_0xe2ada9['as'],'attributes':_0xe2ada9[_0x9f7d('0x24')],'include':_0xe2ada9['include']?_['map'](_0xe2ada9[_0x9f7d('0x22')],function(_0x238d13){return{'model':db[_0x238d13[_0x9f7d('0x23')]],'as':_0x238d13['as'],'attributes':_0x238d13[_0x9f7d('0x24')],'include':_0x238d13['include']?_[_0x9f7d('0x25')](_0x238d13[_0x9f7d('0x22')],function(_0x8c6833){return{'model':db[_0x8c6833[_0x9f7d('0x23')]],'as':_0x8c6833['as'],'attributes':_0x8c6833[_0x9f7d('0x24')]};}):[]};}):[]};}):[]:[]})[_0x9f7d('0x26')](function(_0x3ec5a0){logger[_0x9f7d('0x10')]('GetChatQueue',_0x50204c);logger['debug'](_0x9f7d('0x1b'),_0x50204c,JSON[_0x9f7d('0x15')](_0x3ec5a0));_0x5b17ad(_0x3ec5a0);})[_0x9f7d('0x1a')](function(_0x1a467d){logger[_0x9f7d('0x16')](_0x9f7d('0x1b'),_0x1a467d[_0x9f7d('0x18')],_0x50204c);_0x3f650e(_0x4c2977[_0x9f7d('0x16')](0x1f4,_0x1a467d['message']));});});};exports[_0x9f7d('0x27')]=function(_0x1d4f34){var _0x30a12e=this;return new Promise(function(_0x4fa5b4,_0x2c27fd){return db[_0x9f7d('0x1c')][_0x9f7d('0x28')]({'raw':_0x1d4f34['options']?_0x1d4f34[_0x9f7d('0x1f')][_0x9f7d('0x1e')]===undefined?!![]:![]:!![],'where':_0x1d4f34['options']?_0x1d4f34[_0x9f7d('0x1f')][_0x9f7d('0x20')]||null:null,'attributes':_0x1d4f34[_0x9f7d('0x1f')]?_0x1d4f34['options']['attributes']||null:null,'include':_0x1d4f34[_0x9f7d('0x1f')]?_0x1d4f34[_0x9f7d('0x1f')][_0x9f7d('0x22')]?_[_0x9f7d('0x25')](_0x1d4f34[_0x9f7d('0x1f')][_0x9f7d('0x22')],function(_0x498bdf){return{'model':db[_0x498bdf['model']],'as':_0x498bdf['as'],'attributes':_0x498bdf[_0x9f7d('0x24')],'include':_0x498bdf['include']?_['map'](_0x498bdf[_0x9f7d('0x22')],function(_0x2dd9ff){return{'model':db[_0x2dd9ff[_0x9f7d('0x23')]],'as':_0x2dd9ff['as'],'attributes':_0x2dd9ff[_0x9f7d('0x24')],'include':_0x2dd9ff['include']?_[_0x9f7d('0x25')](_0x2dd9ff['include'],function(_0x1ef808){return{'model':db[_0x1ef808[_0x9f7d('0x23')]],'as':_0x1ef808['as'],'attributes':_0x1ef808[_0x9f7d('0x24')]};}):[]};}):[]};}):[]:[]})[_0x9f7d('0x26')](function(_0x4bb270){logger[_0x9f7d('0x10')](_0x9f7d('0x27'),_0x1d4f34);logger[_0x9f7d('0x13')](_0x9f7d('0x27'),_0x1d4f34,JSON['stringify'](_0x4bb270));_0x4fa5b4(_0x4bb270);})[_0x9f7d('0x1a')](function(_0x1f61b0){logger[_0x9f7d('0x16')](_0x9f7d('0x27'),_0x1f61b0[_0x9f7d('0x18')],_0x1d4f34);_0x2c27fd(_0x30a12e[_0x9f7d('0x16')](0x1f4,_0x1f61b0[_0x9f7d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 23599ba..9b62eff 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(_0x6cf3b6,_0x4b7560){var _0xdbe948=function(_0x1504d6){while(--_0x1504d6){_0x6cf3b6['push'](_0x6cf3b6['shift']());}};_0xdbe948(++_0x4b7560);}(_0xb10b,0x12a));var _0xbb10=function(_0x7880d2,_0x32e7d6){_0x7880d2=_0x7880d2-0x0;var _0x35ebbe=_0xb10b[_0x7880d2];return _0x35ebbe;};'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 _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x5b740b,_0x381833){var _0x6f8f4e=function(_0x86d068){while(--_0x86d068){_0x5b740b['push'](_0x5b740b['shift']());}};_0x6f8f4e(++_0x381833);}(_0xb10b,0x12a));var _0xbb10=function(_0xbe31d1,_0x126345){_0xbe31d1=_0xbe31d1-0x0;var _0x7bd03=_0xb10b[_0xbe31d1];return _0x7bd03;};'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 diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 4e72a89..e1aa897 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 _0x6fe2=['util','path','connect-timeout','Router','../../components/interaction/service','./chatQueue.controller','index','get','/describe','isAuthenticated','describe','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','addTeams','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer'];(function(_0x32d414,_0x4d23da){var _0x4e0bca=function(_0x15d397){while(--_0x15d397){_0x32d414['push'](_0x32d414['shift']());}};_0x4e0bca(++_0x4d23da);}(_0x6fe2,0x151));var _0x26fe=function(_0x19aecd,_0x3350c3){_0x19aecd=_0x19aecd-0x0;var _0x467006=_0x6fe2[_0x19aecd];return _0x467006;};'use strict';var multer=require(_0x26fe('0x0'));var util=require(_0x26fe('0x1'));var path=require(_0x26fe('0x2'));var timeout=require(_0x26fe('0x3'));var express=require('express');var router=express[_0x26fe('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x26fe('0x5'));var config=require('../../config/environment');var controller=require(_0x26fe('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x26fe('0x7')]);router[_0x26fe('0x8')](_0x26fe('0x9'),auth[_0x26fe('0xa')](),controller[_0x26fe('0xb')]);router[_0x26fe('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x26fe('0xc'),auth[_0x26fe('0xa')](),controller[_0x26fe('0xd')]);router[_0x26fe('0x8')]('/:id/teams',auth[_0x26fe('0xa')](),controller[_0x26fe('0xe')]);router[_0x26fe('0x8')](_0x26fe('0xf'),auth['isAuthenticated'](),controller[_0x26fe('0x10')]);router[_0x26fe('0x11')]('/',auth[_0x26fe('0xa')](),controller['create']);router[_0x26fe('0x11')]('/:id/teams',auth[_0x26fe('0xa')](),controller[_0x26fe('0x12')]);router['post'](_0x26fe('0xf'),auth[_0x26fe('0xa')](),controller['addAgents']);router['put'](_0x26fe('0x13'),auth['isAuthenticated'](),controller[_0x26fe('0x14')]);router[_0x26fe('0x15')](_0x26fe('0x13'),auth[_0x26fe('0xa')](),controller[_0x26fe('0x16')]);router[_0x26fe('0x15')]('/:id/teams',auth[_0x26fe('0xa')](),controller[_0x26fe('0x17')]);router[_0x26fe('0x15')](_0x26fe('0xf'),auth[_0x26fe('0xa')](),controller[_0x26fe('0x18')]);module[_0x26fe('0x19')]=router; \ No newline at end of file +var _0x0770=['../../components/auth/service','../../config/environment','./chatQueue.controller','get','index','describe','/:id','show','/:id/members','isAuthenticated','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','update','delete','destroy','removeTeams','multer','util','path','connect-timeout','express','Router'];(function(_0x22fb6f,_0xf08c45){var _0x15641c=function(_0x17c68a){while(--_0x17c68a){_0x22fb6f['push'](_0x22fb6f['shift']());}};_0x15641c(++_0xf08c45);}(_0x0770,0x18f));var _0x0077=function(_0x32ed89,_0x11d953){_0x32ed89=_0x32ed89-0x0;var _0x262961=_0x0770[_0x32ed89];return _0x262961;};'use strict';var multer=require(_0x0077('0x0'));var util=require(_0x0077('0x1'));var path=require(_0x0077('0x2'));var timeout=require(_0x0077('0x3'));var express=require(_0x0077('0x4'));var router=express[_0x0077('0x5')]();var auth=require(_0x0077('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0077('0x7'));var controller=require(_0x0077('0x8'));router[_0x0077('0x9')]('/',auth['isAuthenticated'](),controller[_0x0077('0xa')]);router[_0x0077('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x0077('0xb')]);router[_0x0077('0x9')](_0x0077('0xc'),auth['isAuthenticated'](),controller[_0x0077('0xd')]);router[_0x0077('0x9')](_0x0077('0xe'),auth[_0x0077('0xf')](),controller[_0x0077('0x10')]);router[_0x0077('0x9')](_0x0077('0x11'),auth[_0x0077('0xf')](),controller['getTeams']);router[_0x0077('0x9')](_0x0077('0x12'),auth[_0x0077('0xf')](),controller[_0x0077('0x13')]);router[_0x0077('0x14')]('/',auth['isAuthenticated'](),controller[_0x0077('0x15')]);router['post']('/:id/teams',auth[_0x0077('0xf')](),controller[_0x0077('0x16')]);router[_0x0077('0x14')](_0x0077('0x12'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x0077('0xc'),auth[_0x0077('0xf')](),controller[_0x0077('0x17')]);router[_0x0077('0x18')](_0x0077('0xc'),auth[_0x0077('0xf')](),controller[_0x0077('0x19')]);router[_0x0077('0x18')]('/:id/teams',auth[_0x0077('0xf')](),controller[_0x0077('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 12fdb5b..4aecee2 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 _0xfd43=['STRING','DATE','moment','sequelize'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xfd43,0x156));var _0x3fd4=function(_0x4110e7,_0x4beeb4){_0x4110e7=_0x4110e7-0x0;var _0x1ea0fe=_0xfd43[_0x4110e7];return _0x1ea0fe;};'use strict';var moment=require(_0x3fd4('0x0'));var Sequelize=require(_0x3fd4('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x3fd4('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3fd4('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x3fd4('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x01b8=['sequelize','exports','STRING','DATE','moment'];(function(_0x4b05e7,_0x2e5bbe){var _0x6eb188=function(_0x17ec64){while(--_0x17ec64){_0x4b05e7['push'](_0x4b05e7['shift']());}};_0x6eb188(++_0x2e5bbe);}(_0x01b8,0xc7));var _0x801b=function(_0x310da1,_0x390f65){_0x310da1=_0x310da1-0x0;var _0x333d17=_0x01b8[_0x310da1];return _0x333d17;};'use strict';var moment=require(_0x801b('0x0'));var Sequelize=require(_0x801b('0x1'));module[_0x801b('0x2')]={'uniqueid':{'type':Sequelize[_0x801b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x801b('0x3')]},'joinAt':{'type':Sequelize[_0x801b('0x4')]},'leaveAt':{'type':Sequelize[_0x801b('0x4')]},'acceptAt':{'type':Sequelize[_0x801b('0x4')]},'exitAt':{'type':Sequelize[_0x801b('0x4')]},'reason':{'type':Sequelize[_0x801b('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index a0d227a..b38efa0 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 _0x0fd7=['querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','Content-Range','reject','update','then','destroy','stack','name','send','rawAttributes','type','model','map','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','ChatQueueReport','findAll','catch','show','length','options','find','create','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js'];(function(_0x19c3c7,_0xdd0cff){var _0x1e6aee=function(_0x36e7dc){while(--_0x36e7dc){_0x19c3c7['push'](_0x19c3c7['shift']());}};_0x1e6aee(++_0xdd0cff);}(_0x0fd7,0x1cd));var _0x70fd=function(_0x1b95b7,_0x5ce2c3){_0x1b95b7=_0x1b95b7-0x0;var _0x4e9990=_0x0fd7[_0x1b95b7];return _0x4e9990;};'use strict';var pdf=require(_0x70fd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x70fd('0x1'));var zipdir=require(_0x70fd('0x2'));var jsonpatch=require(_0x70fd('0x3'));var rp=require('request-promise');var moment=require(_0x70fd('0x4'));var BPromise=require(_0x70fd('0x5'));var Mustache=require(_0x70fd('0x6'));var util=require(_0x70fd('0x7'));var path=require(_0x70fd('0x8'));var sox=require(_0x70fd('0x9'));var csv=require(_0x70fd('0xa'));var ejs=require(_0x70fd('0xb'));var fs=require('fs');var _=require(_0x70fd('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x70fd('0xd'));var deskjs=require(_0x70fd('0xe'));var toCsv=require(_0x70fd('0xa'));var querystring=require(_0x70fd('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x70fd('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x70fd('0x11'));var hardwareService=require(_0x70fd('0x12'));var logger=require(_0x70fd('0x13'))(_0x70fd('0x14'));var utils=require(_0x70fd('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x70fd('0x16'))['db'];function respondWithStatusCode(_0x6e6ffa,_0xa12bd8){_0xa12bd8=_0xa12bd8||0xcc;return function(_0x431b89){if(_0x431b89){return _0x6e6ffa[_0x70fd('0x17')](_0xa12bd8);}return _0x6e6ffa['status'](_0xa12bd8)[_0x70fd('0x18')]();};}function respondWithResult(_0x36880e,_0x1de13f){_0x1de13f=_0x1de13f||0xc8;return function(_0x18eb40){if(_0x18eb40){return _0x36880e[_0x70fd('0x19')](_0x1de13f)[_0x70fd('0x1a')](_0x18eb40);}};}function respondWithFilteredResult(_0x5a2b86,_0x2006c3){return function(_0x5067f0){if(_0x5067f0){var _0x4349fb=_0x5067f0['count'],_0xb92c70=_0x2006c3[_0x70fd('0x1b')],_0x40bc3c=_0x2006c3['offset']+_0x2006c3[_0x70fd('0x1c')],_0x166a7f;if(_0x40bc3c>=_0x4349fb){_0x40bc3c=_0x4349fb;_0x166a7f=0xc8;}else{_0x166a7f=0xce;}_0x5a2b86['status'](_0x166a7f);return _0x5a2b86['set'](_0x70fd('0x1d'),_0xb92c70+'-'+_0x40bc3c+'/'+_0x4349fb)['json'](_0x5067f0);}return null;};}function patchUpdates(_0x5eace3){return function(_0x31e239){try{jsonpatch['apply'](_0x31e239,_0x5eace3,!![]);}catch(_0x4edee0){return BPromise[_0x70fd('0x1e')](_0x4edee0);}return _0x31e239['save']();};}function saveUpdates(_0x1cd7ef,_0x3c3122){return function(_0x1d3875){if(_0x1d3875){return _0x1d3875[_0x70fd('0x1f')](_0x1cd7ef)[_0x70fd('0x20')](function(_0x3051ea){return _0x3051ea;});}return null;};}function removeEntity(_0x9e29ef,_0x7fe9ab){return function(_0x70c20d){if(_0x70c20d){return _0x70c20d[_0x70fd('0x21')]()[_0x70fd('0x20')](function(){_0x9e29ef['status'](0xcc)[_0x70fd('0x18')]();});}};}function handleEntityNotFound(_0x33f88c,_0x47cb9a){return function(_0x43274f){if(!_0x43274f){_0x33f88c[_0x70fd('0x17')](0x194);}return _0x43274f;};}function handleError(_0x335fd7,_0x5d4e45){_0x5d4e45=_0x5d4e45||0x1f4;return function(_0x3e04ee){logger['error'](_0x3e04ee[_0x70fd('0x22')]);if(_0x3e04ee[_0x70fd('0x23')]){delete _0x3e04ee[_0x70fd('0x23')];}_0x335fd7[_0x70fd('0x19')](_0x5d4e45)[_0x70fd('0x24')](_0x3e04ee);};}exports['index']=function(_0x4ac325,_0x144432){var _0x280e47={},_0x24134e={},_0x1d9e9e={'count':0x0,'rows':[]};var _0x12e34f=_['map'](db['ChatQueueReport'][_0x70fd('0x25')],function(_0x5b3aca){return{'name':_0x5b3aca['fieldName'],'type':_0x5b3aca[_0x70fd('0x26')]['key']};});_0x24134e[_0x70fd('0x27')]=_[_0x70fd('0x28')](_0x12e34f,_0x70fd('0x23'));_0x24134e[_0x70fd('0x29')]=_[_0x70fd('0x2a')](_0x4ac325[_0x70fd('0x29')]);_0x24134e[_0x70fd('0x2b')]=_['intersection'](_0x24134e['model'],_0x24134e[_0x70fd('0x29')]);_0x280e47[_0x70fd('0x2c')]=_[_0x70fd('0x2d')](_0x24134e[_0x70fd('0x27')],qs[_0x70fd('0x2e')](_0x4ac325['query'][_0x70fd('0x2e')]));_0x280e47['attributes']=_0x280e47[_0x70fd('0x2c')]['length']?_0x280e47['attributes']:_0x24134e[_0x70fd('0x27')];if(!_0x4ac325[_0x70fd('0x29')]['hasOwnProperty'](_0x70fd('0x2f'))){_0x280e47[_0x70fd('0x1c')]=qs['limit'](_0x4ac325[_0x70fd('0x29')][_0x70fd('0x1c')]);_0x280e47[_0x70fd('0x1b')]=qs[_0x70fd('0x1b')](_0x4ac325[_0x70fd('0x29')][_0x70fd('0x1b')]);}_0x280e47[_0x70fd('0x30')]=qs[_0x70fd('0x31')](_0x4ac325[_0x70fd('0x29')][_0x70fd('0x31')]);_0x280e47[_0x70fd('0x32')]=qs[_0x70fd('0x2b')](_[_0x70fd('0x33')](_0x4ac325[_0x70fd('0x29')],_0x24134e[_0x70fd('0x2b')]),_0x12e34f);if(_0x4ac325[_0x70fd('0x29')][_0x70fd('0x34')]){_0x280e47[_0x70fd('0x32')]=_[_0x70fd('0x35')](_0x280e47[_0x70fd('0x32')],{'$or':_[_0x70fd('0x28')](_0x12e34f,function(_0x6dd92b){if(_0x6dd92b[_0x70fd('0x26')]!=='VIRTUAL'){var _0x1e470f={};_0x1e470f[_0x6dd92b[_0x70fd('0x23')]]={'$like':'%'+_0x4ac325[_0x70fd('0x29')][_0x70fd('0x34')]+'%'};return _0x1e470f;}})});}_0x280e47=_[_0x70fd('0x35')]({},_0x280e47,_0x4ac325['options']);var _0x1a79e7={'where':_0x280e47[_0x70fd('0x32')]};return db['ChatQueueReport'][_0x70fd('0x36')](_0x1a79e7)[_0x70fd('0x20')](function(_0x58bdb2){_0x1d9e9e[_0x70fd('0x36')]=_0x58bdb2;if(_0x4ac325[_0x70fd('0x29')][_0x70fd('0x37')]){_0x280e47[_0x70fd('0x38')]=[{'all':!![]}];}return db[_0x70fd('0x39')][_0x70fd('0x3a')](_0x280e47);})[_0x70fd('0x20')](function(_0x5cf2a4){_0x1d9e9e['rows']=_0x5cf2a4;return _0x1d9e9e;})[_0x70fd('0x20')](respondWithFilteredResult(_0x144432,_0x280e47))[_0x70fd('0x3b')](handleError(_0x144432,null));};exports[_0x70fd('0x3c')]=function(_0xb6c3bb,_0x10d414){var _0x82e97b={'raw':!![],'where':{'id':_0xb6c3bb['params']['id']}},_0x19245a={};_0x19245a['model']=_[_0x70fd('0x2a')](db['ChatQueueReport'][_0x70fd('0x25')]);_0x19245a[_0x70fd('0x29')]=_['keys'](_0xb6c3bb[_0x70fd('0x29')]);_0x19245a['filtears']=_['intersection'](_0x19245a[_0x70fd('0x27')],_0x19245a[_0x70fd('0x29')]);_0x82e97b[_0x70fd('0x2c')]=_[_0x70fd('0x2d')](_0x19245a[_0x70fd('0x27')],qs[_0x70fd('0x2e')](_0xb6c3bb['query'][_0x70fd('0x2e')]));_0x82e97b['attributes']=_0x82e97b['attributes'][_0x70fd('0x3d')]?_0x82e97b[_0x70fd('0x2c')]:_0x19245a[_0x70fd('0x27')];if(_0xb6c3bb[_0x70fd('0x29')][_0x70fd('0x37')]){_0x82e97b['include']=[{'all':!![]}];}_0x82e97b=_[_0x70fd('0x35')]({},_0x82e97b,_0xb6c3bb[_0x70fd('0x3e')]);return db[_0x70fd('0x39')][_0x70fd('0x3f')](_0x82e97b)[_0x70fd('0x20')](handleEntityNotFound(_0x10d414,null))['then'](respondWithResult(_0x10d414,null))[_0x70fd('0x3b')](handleError(_0x10d414,null));};exports[_0x70fd('0x40')]=function(_0x3dd501,_0x332981){return db['ChatQueueReport'][_0x70fd('0x40')](_0x3dd501[_0x70fd('0x41')],{})[_0x70fd('0x20')](respondWithResult(_0x332981,0xc9))[_0x70fd('0x3b')](handleError(_0x332981,null));};exports['update']=function(_0x4a9810,_0x456a5c){if(_0x4a9810[_0x70fd('0x41')]['id']){delete _0x4a9810[_0x70fd('0x41')]['id'];}return db[_0x70fd('0x39')][_0x70fd('0x3f')]({'where':{'id':_0x4a9810[_0x70fd('0x42')]['id']}})[_0x70fd('0x20')](handleEntityNotFound(_0x456a5c,null))[_0x70fd('0x20')](saveUpdates(_0x4a9810[_0x70fd('0x41')],null))[_0x70fd('0x20')](respondWithResult(_0x456a5c,null))[_0x70fd('0x3b')](handleError(_0x456a5c,null));};exports[_0x70fd('0x21')]=function(_0xd0d805,_0x42ad49){return db[_0x70fd('0x39')][_0x70fd('0x3f')]({'where':{'id':_0xd0d805['params']['id']}})[_0x70fd('0x20')](handleEntityNotFound(_0x42ad49,null))['then'](removeEntity(_0x42ad49,null))['catch'](handleError(_0x42ad49,null));};exports['describe']=function(_0x5e69b8,_0x6b1b55){return db['ChatQueueReport'][_0x70fd('0x43')]()[_0x70fd('0x20')](respondWithResult(_0x6b1b55,null))[_0x70fd('0x3b')](handleError(_0x6b1b55,null));}; \ No newline at end of file +var _0xdd20=['util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','pick','filter','where','VIRTUAL','options','include','findAll','catch','show','params','keys','filtears','intersection','includeAll','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x322f46,_0x281e3f){var _0x42df89=function(_0x2c9e7b){while(--_0x2c9e7b){_0x322f46['push'](_0x322f46['shift']());}};_0x42df89(++_0x281e3f);}(_0xdd20,0x180));var _0x0dd2=function(_0x210d5a,_0x464d68){_0x210d5a=_0x210d5a-0x0;var _0x84fd2d=_0xdd20[_0x210d5a];return _0x84fd2d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0dd2('0x0'));var rimraf=require(_0x0dd2('0x1'));var zipdir=require(_0x0dd2('0x2'));var jsonpatch=require(_0x0dd2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0dd2('0x4'));var Mustache=require(_0x0dd2('0x5'));var util=require(_0x0dd2('0x6'));var path=require('path');var sox=require(_0x0dd2('0x7'));var csv=require(_0x0dd2('0x8'));var ejs=require(_0x0dd2('0x9'));var fs=require('fs');var _=require(_0x0dd2('0xa'));var squel=require(_0x0dd2('0xb'));var crypto=require('crypto');var jsforce=require(_0x0dd2('0xc'));var deskjs=require(_0x0dd2('0xd'));var toCsv=require(_0x0dd2('0x8'));var querystring=require('querystring');var Papa=require(_0x0dd2('0xe'));var Redis=require(_0x0dd2('0xf'));var authService=require(_0x0dd2('0x10'));var qs=require(_0x0dd2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0dd2('0x12'));var logger=require(_0x0dd2('0x13'))(_0x0dd2('0x14'));var utils=require('../../config/utils');var config=require(_0x0dd2('0x15'));var licenseUtil=require(_0x0dd2('0x16'));var db=require(_0x0dd2('0x17'))['db'];function respondWithStatusCode(_0x2b89fe,_0x1f6927){_0x1f6927=_0x1f6927||0xcc;return function(_0x2ea7e4){if(_0x2ea7e4){return _0x2b89fe[_0x0dd2('0x18')](_0x1f6927);}return _0x2b89fe[_0x0dd2('0x19')](_0x1f6927)[_0x0dd2('0x1a')]();};}function respondWithResult(_0x2e9ccf,_0x5582a2){_0x5582a2=_0x5582a2||0xc8;return function(_0x48dc39){if(_0x48dc39){return _0x2e9ccf[_0x0dd2('0x19')](_0x5582a2)[_0x0dd2('0x1b')](_0x48dc39);}};}function respondWithFilteredResult(_0x57d096,_0x1c4766){return function(_0x5bd5ed){if(_0x5bd5ed){var _0x2534b4=_0x5bd5ed[_0x0dd2('0x1c')],_0x1f9198=_0x1c4766[_0x0dd2('0x1d')],_0x9c6e90=_0x1c4766[_0x0dd2('0x1d')]+_0x1c4766['limit'],_0x442c57;if(_0x9c6e90>=_0x2534b4){_0x9c6e90=_0x2534b4;_0x442c57=0xc8;}else{_0x442c57=0xce;}_0x57d096[_0x0dd2('0x19')](_0x442c57);return _0x57d096[_0x0dd2('0x1e')](_0x0dd2('0x1f'),_0x1f9198+'-'+_0x9c6e90+'/'+_0x2534b4)['json'](_0x5bd5ed);}return null;};}function patchUpdates(_0x56fa16){return function(_0x5d69e4){try{jsonpatch[_0x0dd2('0x20')](_0x5d69e4,_0x56fa16,!![]);}catch(_0x5ab278){return BPromise[_0x0dd2('0x21')](_0x5ab278);}return _0x5d69e4[_0x0dd2('0x22')]();};}function saveUpdates(_0x1e4ba7,_0x13aea7){return function(_0x365c6a){if(_0x365c6a){return _0x365c6a[_0x0dd2('0x23')](_0x1e4ba7)[_0x0dd2('0x24')](function(_0x13e7a6){return _0x13e7a6;});}return null;};}function removeEntity(_0x46dbf7,_0xa22221){return function(_0x57b162){if(_0x57b162){return _0x57b162[_0x0dd2('0x25')]()['then'](function(){_0x46dbf7[_0x0dd2('0x19')](0xcc)[_0x0dd2('0x1a')]();});}};}function handleEntityNotFound(_0x3fb659,_0x245ea3){return function(_0x9efe0e){if(!_0x9efe0e){_0x3fb659['sendStatus'](0x194);}return _0x9efe0e;};}function handleError(_0x5d9385,_0x4ad7a8){_0x4ad7a8=_0x4ad7a8||0x1f4;return function(_0x3c1ba5){logger[_0x0dd2('0x26')](_0x3c1ba5[_0x0dd2('0x27')]);if(_0x3c1ba5[_0x0dd2('0x28')]){delete _0x3c1ba5[_0x0dd2('0x28')];}_0x5d9385['status'](_0x4ad7a8)[_0x0dd2('0x29')](_0x3c1ba5);};}exports[_0x0dd2('0x2a')]=function(_0x541121,_0xe9e707){var _0x4efea5={},_0x158015={},_0x3d6638={'count':0x0,'rows':[]};var _0x3a7008=_[_0x0dd2('0x2b')](db[_0x0dd2('0x2c')][_0x0dd2('0x2d')],function(_0x13e123){return{'name':_0x13e123[_0x0dd2('0x2e')],'type':_0x13e123[_0x0dd2('0x2f')][_0x0dd2('0x30')]};});_0x158015[_0x0dd2('0x31')]=_[_0x0dd2('0x2b')](_0x3a7008,_0x0dd2('0x28'));_0x158015['query']=_['keys'](_0x541121[_0x0dd2('0x32')]);_0x158015[_0x0dd2('0x33')]=_['intersection'](_0x158015[_0x0dd2('0x31')],_0x158015[_0x0dd2('0x32')]);_0x4efea5[_0x0dd2('0x34')]=_['intersection'](_0x158015['model'],qs['fields'](_0x541121[_0x0dd2('0x32')][_0x0dd2('0x35')]));_0x4efea5[_0x0dd2('0x34')]=_0x4efea5['attributes'][_0x0dd2('0x36')]?_0x4efea5[_0x0dd2('0x34')]:_0x158015[_0x0dd2('0x31')];if(!_0x541121[_0x0dd2('0x32')][_0x0dd2('0x37')](_0x0dd2('0x38'))){_0x4efea5[_0x0dd2('0x39')]=qs[_0x0dd2('0x39')](_0x541121[_0x0dd2('0x32')][_0x0dd2('0x39')]);_0x4efea5[_0x0dd2('0x1d')]=qs[_0x0dd2('0x1d')](_0x541121[_0x0dd2('0x32')][_0x0dd2('0x1d')]);}_0x4efea5[_0x0dd2('0x3a')]=qs['sort'](_0x541121['query']['sort']);_0x4efea5['where']=qs[_0x0dd2('0x33')](_[_0x0dd2('0x3b')](_0x541121[_0x0dd2('0x32')],_0x158015[_0x0dd2('0x33')]),_0x3a7008);if(_0x541121[_0x0dd2('0x32')][_0x0dd2('0x3c')]){_0x4efea5[_0x0dd2('0x3d')]=_['merge'](_0x4efea5['where'],{'$or':_[_0x0dd2('0x2b')](_0x3a7008,function(_0xa10083){if(_0xa10083['type']!==_0x0dd2('0x3e')){var _0x13556d={};_0x13556d[_0xa10083[_0x0dd2('0x28')]]={'$like':'%'+_0x541121[_0x0dd2('0x32')][_0x0dd2('0x3c')]+'%'};return _0x13556d;}})});}_0x4efea5=_['merge']({},_0x4efea5,_0x541121[_0x0dd2('0x3f')]);var _0xeba6cc={'where':_0x4efea5[_0x0dd2('0x3d')]};return db[_0x0dd2('0x2c')][_0x0dd2('0x1c')](_0xeba6cc)[_0x0dd2('0x24')](function(_0x2ca1f1){_0x3d6638[_0x0dd2('0x1c')]=_0x2ca1f1;if(_0x541121[_0x0dd2('0x32')]['includeAll']){_0x4efea5[_0x0dd2('0x40')]=[{'all':!![]}];}return db[_0x0dd2('0x2c')][_0x0dd2('0x41')](_0x4efea5);})[_0x0dd2('0x24')](function(_0x35f5d2){_0x3d6638['rows']=_0x35f5d2;return _0x3d6638;})[_0x0dd2('0x24')](respondWithFilteredResult(_0xe9e707,_0x4efea5))[_0x0dd2('0x42')](handleError(_0xe9e707,null));};exports[_0x0dd2('0x43')]=function(_0xbd93f6,_0x1a50b7){var _0x1d6c08={'raw':!![],'where':{'id':_0xbd93f6[_0x0dd2('0x44')]['id']}},_0x9f7a0a={};_0x9f7a0a[_0x0dd2('0x31')]=_[_0x0dd2('0x45')](db[_0x0dd2('0x2c')][_0x0dd2('0x2d')]);_0x9f7a0a[_0x0dd2('0x32')]=_[_0x0dd2('0x45')](_0xbd93f6[_0x0dd2('0x32')]);_0x9f7a0a[_0x0dd2('0x46')]=_[_0x0dd2('0x47')](_0x9f7a0a[_0x0dd2('0x31')],_0x9f7a0a[_0x0dd2('0x32')]);_0x1d6c08['attributes']=_[_0x0dd2('0x47')](_0x9f7a0a[_0x0dd2('0x31')],qs[_0x0dd2('0x35')](_0xbd93f6[_0x0dd2('0x32')][_0x0dd2('0x35')]));_0x1d6c08['attributes']=_0x1d6c08[_0x0dd2('0x34')]['length']?_0x1d6c08[_0x0dd2('0x34')]:_0x9f7a0a[_0x0dd2('0x31')];if(_0xbd93f6['query'][_0x0dd2('0x48')]){_0x1d6c08[_0x0dd2('0x40')]=[{'all':!![]}];}_0x1d6c08=_[_0x0dd2('0x49')]({},_0x1d6c08,_0xbd93f6[_0x0dd2('0x3f')]);return db[_0x0dd2('0x2c')][_0x0dd2('0x4a')](_0x1d6c08)[_0x0dd2('0x24')](handleEntityNotFound(_0x1a50b7,null))[_0x0dd2('0x24')](respondWithResult(_0x1a50b7,null))['catch'](handleError(_0x1a50b7,null));};exports['create']=function(_0x322b9b,_0x29a327){return db[_0x0dd2('0x2c')][_0x0dd2('0x4b')](_0x322b9b[_0x0dd2('0x4c')],{})['then'](respondWithResult(_0x29a327,0xc9))[_0x0dd2('0x42')](handleError(_0x29a327,null));};exports[_0x0dd2('0x23')]=function(_0x176ec1,_0x4d8d8a){if(_0x176ec1[_0x0dd2('0x4c')]['id']){delete _0x176ec1['body']['id'];}return db[_0x0dd2('0x2c')][_0x0dd2('0x4a')]({'where':{'id':_0x176ec1[_0x0dd2('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d8d8a,null))[_0x0dd2('0x24')](saveUpdates(_0x176ec1['body'],null))[_0x0dd2('0x24')](respondWithResult(_0x4d8d8a,null))[_0x0dd2('0x42')](handleError(_0x4d8d8a,null));};exports[_0x0dd2('0x25')]=function(_0x100047,_0x2aa8f3){return db[_0x0dd2('0x2c')][_0x0dd2('0x4a')]({'where':{'id':_0x100047[_0x0dd2('0x44')]['id']}})[_0x0dd2('0x24')](handleEntityNotFound(_0x2aa8f3,null))['then'](removeEntity(_0x2aa8f3,null))[_0x0dd2('0x42')](handleError(_0x2aa8f3,null));};exports[_0x0dd2('0x4d')]=function(_0x5d32f3,_0x1c12ab){return db['ChatQueueReport'][_0x0dd2('0x4d')]()['then'](respondWithResult(_0x1c12ab,null))[_0x0dd2('0x42')](handleError(_0x1c12ab,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 3811148..1772d05 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 _0xc9fe=['api','moment','bluebird','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash'];(function(_0x6145dd,_0x32949a){var _0x54073c=function(_0x3c68e2){while(--_0x3c68e2){_0x6145dd['push'](_0x6145dd['shift']());}};_0x54073c(++_0x32949a);}(_0xc9fe,0x81));var _0xec9f=function(_0x41c31e,_0x4e4916){_0x41c31e=_0x41c31e-0x0;var _0x5e9b30=_0xc9fe[_0x41c31e];return _0x5e9b30;};'use strict';var _=require(_0xec9f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xec9f('0x1'));var moment=require(_0xec9f('0x2'));var BPromise=require(_0xec9f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec9f('0x4'));var rimraf=require(_0xec9f('0x5'));var config=require(_0xec9f('0x6'));var attributes=require(_0xec9f('0x7'));module[_0xec9f('0x8')]=function(_0x184f8e,_0x581704){return _0x184f8e[_0xec9f('0x9')](_0xec9f('0xa'),attributes,{'tableName':_0xec9f('0xb'),'paranoid':![],'indexes':[{'name':_0xec9f('0xc'),'fields':[_0xec9f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xea54=['exports','define','report_chat_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatQueueReport.attributes'];(function(_0x159b98,_0x53502d){var _0x505eb9=function(_0x4b6177){while(--_0x4b6177){_0x159b98['push'](_0x159b98['shift']());}};_0x505eb9(++_0x53502d);}(_0xea54,0x1c4));var _0x4ea5=function(_0x48b90f,_0x2a2888){_0x48b90f=_0x48b90f-0x0;var _0x2d6262=_0xea54[_0x48b90f];return _0x2d6262;};'use strict';var _=require(_0x4ea5('0x0'));var util=require(_0x4ea5('0x1'));var logger=require(_0x4ea5('0x2'))(_0x4ea5('0x3'));var moment=require(_0x4ea5('0x4'));var BPromise=require(_0x4ea5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ea5('0x6'));var rimraf=require(_0x4ea5('0x7'));var config=require(_0x4ea5('0x8'));var attributes=require(_0x4ea5('0x9'));module[_0x4ea5('0xa')]=function(_0x2271ea,_0x2d5a72){return _0x2271ea[_0x4ea5('0xb')]('ChatQueueReport',attributes,{'tableName':_0x4ea5('0xc'),'paranoid':![],'indexes':[{'name':_0x4ea5('0xd'),'fields':[_0x4ea5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 7b132f0..0efbf72 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 _0xd349=['ioredis','../../mysqldb','../../config/utils','rpc','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','code','error','message','result','options','raw','then','CreateChatQueueReport','debug','stringify','catch','ChatQueueReport','update','attributes','limit','util','moment','randomstring'];(function(_0xacb435,_0x220f20){var _0x32b976=function(_0x45d334){while(--_0x45d334){_0xacb435['push'](_0xacb435['shift']());}};_0x32b976(++_0x220f20);}(_0xd349,0x192));var _0x9d34=function(_0x42dcfc,_0x880d1d){_0x42dcfc=_0x42dcfc-0x0;var _0x2abbb6=_0xd349[_0x42dcfc];return _0x2abbb6;};'use strict';var _=require('lodash');var util=require(_0x9d34('0x0'));var moment=require(_0x9d34('0x1'));var BPromise=require('bluebird');var rs=require(_0x9d34('0x2'));var fs=require('fs');var Redis=require(_0x9d34('0x3'));var db=require(_0x9d34('0x4'))['db'];var utils=require(_0x9d34('0x5'));var logger=require('../../config/logger')(_0x9d34('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9d34('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5c96f6,_0x2b876d,_0x279311){return new BPromise(function(_0x5caaf,_0x475560){return client[_0x9d34('0x8')](_0x5c96f6,_0x279311)['then'](function(_0x457146){logger[_0x9d34('0x9')](_0x9d34('0xa'),_0x2b876d,_0x9d34('0xb'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x2b876d,_0x9d34('0xb'),JSON['stringify'](_0x457146));if(_0x457146['error']){if(_0x457146['error'][_0x9d34('0xc')]===0x1f4){logger[_0x9d34('0xd')](_0x9d34('0xa'),_0x2b876d,_0x457146[_0x9d34('0xd')][_0x9d34('0xe')]);return _0x475560(_0x457146[_0x9d34('0xd')][_0x9d34('0xe')]);}logger[_0x9d34('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x2b876d,_0x457146[_0x9d34('0xd')]['message']);return _0x5caaf(_0x457146[_0x9d34('0xd')][_0x9d34('0xe')]);}else{logger[_0x9d34('0x9')](_0x9d34('0xa'),_0x2b876d,'request\x20sent');_0x5caaf(_0x457146[_0x9d34('0xf')]['message']);}})['catch'](function(_0x26cec5){logger[_0x9d34('0xd')](_0x9d34('0xa'),_0x2b876d,_0x26cec5);_0x475560(_0x26cec5);});});}exports['CreateChatQueueReport']=function(_0x4a368b){var _0x350d80=this;return new Promise(function(_0x326264,_0x5f5038){return db['ChatQueueReport']['create'](_0x4a368b['body'],{'raw':_0x4a368b[_0x9d34('0x10')]?_0x4a368b[_0x9d34('0x10')][_0x9d34('0x11')]===undefined?!![]:![]:!![]})[_0x9d34('0x12')](function(_0x225164){logger[_0x9d34('0x9')](_0x9d34('0x13'),_0x4a368b);logger[_0x9d34('0x14')]('CreateChatQueueReport',_0x4a368b,JSON[_0x9d34('0x15')](_0x225164));_0x326264(_0x225164);})[_0x9d34('0x16')](function(_0x3d50dc){logger[_0x9d34('0xd')](_0x9d34('0x13'),_0x3d50dc['message'],_0x4a368b);_0x5f5038(_0x350d80[_0x9d34('0xd')](0x1f4,_0x3d50dc[_0x9d34('0xe')]));});});};exports['UpdateChatQueueReport']=function(_0xb314e7){var _0x2ad15c=this;return new Promise(function(_0x441358,_0x3d49c5){return db[_0x9d34('0x17')][_0x9d34('0x18')](_0xb314e7['body'],{'raw':_0xb314e7[_0x9d34('0x10')]?_0xb314e7[_0x9d34('0x10')][_0x9d34('0x11')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb314e7['options']?_0xb314e7[_0x9d34('0x10')]['where']||null:null,'attributes':_0xb314e7[_0x9d34('0x10')]?_0xb314e7['options'][_0x9d34('0x19')]||null:null,'limit':_0xb314e7['options']?_0xb314e7['options'][_0x9d34('0x1a')]||null:null})[_0x9d34('0x12')](function(_0x58ebbd){logger['info']('UpdateChatQueueReport',_0xb314e7);logger[_0x9d34('0x14')]('UpdateChatQueueReport',_0xb314e7,JSON['stringify'](_0x58ebbd));_0x441358(_0x58ebbd);})[_0x9d34('0x16')](function(_0x5b04f5){logger[_0x9d34('0xd')]('UpdateChatQueueReport',_0x5b04f5['message'],_0xb314e7);_0x3d49c5(_0x2ad15c[_0x9d34('0xd')](0x1f4,_0x5b04f5[_0x9d34('0xe')]));});});}; \ No newline at end of file +var _0x9a37=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ChatQueueReport','create','options','raw','CreateChatQueueReport','UpdateChatQueueReport','update','body','attributes','limit','lodash','util','moment'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0x9a37,0x8d));var _0x79a3=function(_0xab2afb,_0x546bfb){_0xab2afb=_0xab2afb-0x0;var _0x25262b=_0x9a37[_0xab2afb];return _0x25262b;};'use strict';var _=require(_0x79a3('0x0'));var util=require(_0x79a3('0x1'));var moment=require(_0x79a3('0x2'));var BPromise=require(_0x79a3('0x3'));var rs=require(_0x79a3('0x4'));var fs=require('fs');var Redis=require(_0x79a3('0x5'));var db=require(_0x79a3('0x6'))['db'];var utils=require(_0x79a3('0x7'));var logger=require(_0x79a3('0x8'))(_0x79a3('0x9'));var config=require(_0x79a3('0xa'));var jayson=require(_0x79a3('0xb'));var client=jayson['client'][_0x79a3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x45353c,_0x546119,_0x2ef284){return new BPromise(function(_0x1d2fff,_0x477b0b){return client[_0x79a3('0xd')](_0x45353c,_0x2ef284)[_0x79a3('0xe')](function(_0x4dcc8f){logger[_0x79a3('0xf')](_0x79a3('0x10'),_0x546119,'request\x20sent');logger[_0x79a3('0x11')](_0x79a3('0x12'),_0x546119,_0x79a3('0x13'),JSON[_0x79a3('0x14')](_0x4dcc8f));if(_0x4dcc8f[_0x79a3('0x15')]){if(_0x4dcc8f[_0x79a3('0x15')][_0x79a3('0x16')]===0x1f4){logger['error'](_0x79a3('0x10'),_0x546119,_0x4dcc8f[_0x79a3('0x15')][_0x79a3('0x17')]);return _0x477b0b(_0x4dcc8f['error'][_0x79a3('0x17')]);}logger[_0x79a3('0x15')](_0x79a3('0x10'),_0x546119,_0x4dcc8f['error'][_0x79a3('0x17')]);return _0x1d2fff(_0x4dcc8f[_0x79a3('0x15')][_0x79a3('0x17')]);}else{logger['info'](_0x79a3('0x10'),_0x546119,'request\x20sent');_0x1d2fff(_0x4dcc8f[_0x79a3('0x18')]['message']);}})[_0x79a3('0x19')](function(_0x45ffdd){logger['error'](_0x79a3('0x10'),_0x546119,_0x45ffdd);_0x477b0b(_0x45ffdd);});});}exports['CreateChatQueueReport']=function(_0x7c878c){var _0x516d8c=this;return new Promise(function(_0x2d423f,_0x2e19e6){return db[_0x79a3('0x1a')][_0x79a3('0x1b')](_0x7c878c['body'],{'raw':_0x7c878c['options']?_0x7c878c[_0x79a3('0x1c')][_0x79a3('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x1f639e){logger[_0x79a3('0xf')](_0x79a3('0x1e'),_0x7c878c);logger['debug'](_0x79a3('0x1e'),_0x7c878c,JSON['stringify'](_0x1f639e));_0x2d423f(_0x1f639e);})[_0x79a3('0x19')](function(_0x29e411){logger[_0x79a3('0x15')](_0x79a3('0x1e'),_0x29e411[_0x79a3('0x17')],_0x7c878c);_0x2e19e6(_0x516d8c['error'](0x1f4,_0x29e411['message']));});});};exports[_0x79a3('0x1f')]=function(_0x53da1e){var _0x55919b=this;return new Promise(function(_0x10fda3,_0x15f79f){return db[_0x79a3('0x1a')][_0x79a3('0x20')](_0x53da1e[_0x79a3('0x21')],{'raw':_0x53da1e[_0x79a3('0x1c')]?_0x53da1e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53da1e[_0x79a3('0x1c')]?_0x53da1e['options']['where']||null:null,'attributes':_0x53da1e[_0x79a3('0x1c')]?_0x53da1e[_0x79a3('0x1c')][_0x79a3('0x22')]||null:null,'limit':_0x53da1e['options']?_0x53da1e['options'][_0x79a3('0x23')]||null:null})[_0x79a3('0xe')](function(_0x1d6c7b){logger[_0x79a3('0xf')](_0x79a3('0x1f'),_0x53da1e);logger[_0x79a3('0x11')](_0x79a3('0x1f'),_0x53da1e,JSON['stringify'](_0x1d6c7b));_0x10fda3(_0x1d6c7b);})['catch'](function(_0x1f411e){logger['error'](_0x79a3('0x1f'),_0x1f411e[_0x79a3('0x17')],_0x53da1e);_0x15f79f(_0x55919b[_0x79a3('0x15')](0x1f4,_0x1f411e[_0x79a3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 50d4247..56f761a 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 _0xd8b9=['index','/describe','isAuthenticated','show','post','create','/:id','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get'];(function(_0x3fcd96,_0x59bbe4){var _0x1663d4=function(_0x4ad068){while(--_0x4ad068){_0x3fcd96['push'](_0x3fcd96['shift']());}};_0x1663d4(++_0x59bbe4);}(_0xd8b9,0x1b9));var _0x9d8b=function(_0x5912c0,_0x1bab5b){_0x5912c0=_0x5912c0-0x0;var _0x4d1ed4=_0xd8b9[_0x5912c0];return _0x4d1ed4;};'use strict';var multer=require(_0x9d8b('0x0'));var util=require(_0x9d8b('0x1'));var path=require(_0x9d8b('0x2'));var timeout=require(_0x9d8b('0x3'));var express=require(_0x9d8b('0x4'));var router=express['Router']();var auth=require(_0x9d8b('0x5'));var interaction=require(_0x9d8b('0x6'));var config=require('../../config/environment');var controller=require(_0x9d8b('0x7'));router[_0x9d8b('0x8')]('/',auth['isAuthenticated'](),controller[_0x9d8b('0x9')]);router['get'](_0x9d8b('0xa'),auth[_0x9d8b('0xb')](),controller['describe']);router['get']('/:id',auth[_0x9d8b('0xb')](),controller[_0x9d8b('0xc')]);router[_0x9d8b('0xd')]('/',auth['isAuthenticated'](),controller[_0x9d8b('0xe')]);router['put'](_0x9d8b('0xf'),auth[_0x9d8b('0xb')](),controller[_0x9d8b('0x10')]);router['delete'](_0x9d8b('0xf'),auth[_0x9d8b('0xb')](),controller['destroy']);module[_0x9d8b('0x11')]=router; \ No newline at end of file +var _0x084b=['get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./chatQueueReport.controller'];(function(_0x3b8c25,_0x5d7aa8){var _0x85c9ca=function(_0x5b6524){while(--_0x5b6524){_0x3b8c25['push'](_0x3b8c25['shift']());}};_0x85c9ca(++_0x5d7aa8);}(_0x084b,0x14d));var _0xb084=function(_0xc6cde0,_0x3676c7){_0xc6cde0=_0xc6cde0-0x0;var _0x2ea372=_0x084b[_0xc6cde0];return _0x2ea372;};'use strict';var multer=require(_0xb084('0x0'));var util=require(_0xb084('0x1'));var path=require(_0xb084('0x2'));var timeout=require(_0xb084('0x3'));var express=require('express');var router=express[_0xb084('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb084('0x5'));var config=require('../../config/environment');var controller=require(_0xb084('0x6'));router[_0xb084('0x7')]('/',auth[_0xb084('0x8')](),controller['index']);router[_0xb084('0x7')]('/describe',auth[_0xb084('0x8')](),controller['describe']);router[_0xb084('0x7')](_0xb084('0x9'),auth[_0xb084('0x8')](),controller['show']);router[_0xb084('0xa')]('/',auth['isAuthenticated'](),controller[_0xb084('0xb')]);router[_0xb084('0xc')](_0xb084('0x9'),auth[_0xb084('0x8')](),controller[_0xb084('0xd')]);router[_0xb084('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xb084('0xf')]);module[_0xb084('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 798fe5f..73331ce 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 _0x051c=['STRING','account','agent','queue','sequelize','exports'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x051c,0x118));var _0xc051=function(_0x182e56,_0x15336b){_0x182e56=_0x182e56-0x0;var _0x39020b=_0x051c[_0x182e56];return _0x39020b;};'use strict';var moment=require('moment');var Sequelize=require(_0xc051('0x0'));module[_0xc051('0x1')]={'uniqueid':{'type':Sequelize[_0xc051('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc051('0x3'),_0xc051('0x4'),_0xc051('0x5')),'allowNull':![],'defaultValue':_0xc051('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x8539=['account','agent','queue','sequelize','exports','STRING','ENUM'];(function(_0x5e6290,_0x473523){var _0x230773=function(_0x4fb8d0){while(--_0x4fb8d0){_0x5e6290['push'](_0x5e6290['shift']());}};_0x230773(++_0x473523);}(_0x8539,0x17d));var _0x9853=function(_0x18bec0,_0x10bdf1){_0x18bec0=_0x18bec0-0x0;var _0x43faa5=_0x8539[_0x18bec0];return _0x43faa5;};'use strict';var moment=require('moment');var Sequelize=require(_0x9853('0x0'));module[_0x9853('0x1')]={'uniqueid':{'type':Sequelize[_0x9853('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9853('0x3')](_0x9853('0x4'),_0x9853('0x5'),'queue'),'allowNull':![],'defaultValue':_0x9853('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 08ecbb5..c836367 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 _0xa62c=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','save','then','error','stack','name','send','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','filtears','include','find','body','catch','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','jsforce'];(function(_0x1af688,_0x28b0dc){var _0x5c617f=function(_0x1b4400){while(--_0x1b4400){_0x1af688['push'](_0x1af688['shift']());}};_0x5c617f(++_0x28b0dc);}(_0xa62c,0x116));var _0xca62=function(_0x4f4c2a,_0x5f5a28){_0x4f4c2a=_0x4f4c2a-0x0;var _0xd15be6=_0xa62c[_0x4f4c2a];return _0xd15be6;};'use strict';var pdf=require(_0xca62('0x0'));var emlformat=require(_0xca62('0x1'));var rimraf=require(_0xca62('0x2'));var zipdir=require(_0xca62('0x3'));var jsonpatch=require(_0xca62('0x4'));var rp=require(_0xca62('0x5'));var moment=require(_0xca62('0x6'));var BPromise=require(_0xca62('0x7'));var Mustache=require(_0xca62('0x8'));var util=require(_0xca62('0x9'));var path=require(_0xca62('0xa'));var sox=require('sox');var csv=require(_0xca62('0xb'));var ejs=require(_0xca62('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xca62('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xca62('0xe'));var Papa=require(_0xca62('0xf'));var Redis=require(_0xca62('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xca62('0x11'));var as=require(_0xca62('0x12'));var hardwareService=require(_0xca62('0x13'));var logger=require('../../config/logger')(_0xca62('0x14'));var utils=require(_0xca62('0x15'));var config=require(_0xca62('0x16'));var licenseUtil=require(_0xca62('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31c479,_0x5a9f35){_0x5a9f35=_0x5a9f35||0xcc;return function(_0x15336c){if(_0x15336c){return _0x31c479[_0xca62('0x18')](_0x5a9f35);}return _0x31c479['status'](_0x5a9f35)[_0xca62('0x19')]();};}function respondWithResult(_0x5030fe,_0x4b9f0c){_0x4b9f0c=_0x4b9f0c||0xc8;return function(_0x4c862e){if(_0x4c862e){return _0x5030fe[_0xca62('0x1a')](_0x4b9f0c)[_0xca62('0x1b')](_0x4c862e);}};}function respondWithFilteredResult(_0x1c2f50,_0x5ab410){return function(_0x15bbf5){if(_0x15bbf5){var _0x22abe0=_0x15bbf5[_0xca62('0x1c')],_0x5c6d8b=_0x5ab410['offset'],_0x2ad117=_0x5ab410[_0xca62('0x1d')]+_0x5ab410[_0xca62('0x1e')],_0x5f5d91;if(_0x2ad117>=_0x22abe0){_0x2ad117=_0x22abe0;_0x5f5d91=0xc8;}else{_0x5f5d91=0xce;}_0x1c2f50[_0xca62('0x1a')](_0x5f5d91);return _0x1c2f50['set'](_0xca62('0x1f'),_0x5c6d8b+'-'+_0x2ad117+'/'+_0x22abe0)[_0xca62('0x1b')](_0x15bbf5);}return null;};}function patchUpdates(_0x1a47b9){return function(_0xa8ee39){try{jsonpatch[_0xca62('0x20')](_0xa8ee39,_0x1a47b9,!![]);}catch(_0x257099){return BPromise['reject'](_0x257099);}return _0xa8ee39[_0xca62('0x21')]();};}function saveUpdates(_0x1b9e4f,_0x5e2185){return function(_0x160ff5){if(_0x160ff5){return _0x160ff5['update'](_0x1b9e4f)[_0xca62('0x22')](function(_0x4e8ba1){return _0x4e8ba1;});}return null;};}function removeEntity(_0x20feab,_0x39cc79){return function(_0x1903f0){if(_0x1903f0){return _0x1903f0['destroy']()[_0xca62('0x22')](function(){_0x20feab[_0xca62('0x1a')](0xcc)[_0xca62('0x19')]();});}};}function handleEntityNotFound(_0x19ba06,_0x526947){return function(_0x96919b){if(!_0x96919b){_0x19ba06['sendStatus'](0x194);}return _0x96919b;};}function handleError(_0x2c79b2,_0x3300ef){_0x3300ef=_0x3300ef||0x1f4;return function(_0x2a909c){logger[_0xca62('0x23')](_0x2a909c[_0xca62('0x24')]);if(_0x2a909c[_0xca62('0x25')]){delete _0x2a909c[_0xca62('0x25')];}_0x2c79b2[_0xca62('0x1a')](_0x3300ef)[_0xca62('0x26')](_0x2a909c);};}exports['index']=function(_0x558786,_0x40a220){var _0x83a227={},_0x38acce={},_0x485ad0={'count':0x0,'rows':[]};var _0x26b873=_[_0xca62('0x27')](db[_0xca62('0x28')][_0xca62('0x29')],function(_0x423437){return{'name':_0x423437[_0xca62('0x2a')],'type':_0x423437[_0xca62('0x2b')][_0xca62('0x2c')]};});_0x38acce[_0xca62('0x2d')]=_[_0xca62('0x27')](_0x26b873,'name');_0x38acce['query']=_[_0xca62('0x2e')](_0x558786[_0xca62('0x2f')]);_0x38acce[_0xca62('0x30')]=_[_0xca62('0x31')](_0x38acce['model'],_0x38acce['query']);_0x83a227[_0xca62('0x32')]=_[_0xca62('0x31')](_0x38acce[_0xca62('0x2d')],qs[_0xca62('0x33')](_0x558786[_0xca62('0x2f')][_0xca62('0x33')]));_0x83a227['attributes']=_0x83a227[_0xca62('0x32')][_0xca62('0x34')]?_0x83a227[_0xca62('0x32')]:_0x38acce[_0xca62('0x2d')];if(!_0x558786[_0xca62('0x2f')]['hasOwnProperty']('nolimit')){_0x83a227[_0xca62('0x1e')]=qs['limit'](_0x558786[_0xca62('0x2f')][_0xca62('0x1e')]);_0x83a227[_0xca62('0x1d')]=qs[_0xca62('0x1d')](_0x558786[_0xca62('0x2f')][_0xca62('0x1d')]);}_0x83a227[_0xca62('0x35')]=qs['sort'](_0x558786[_0xca62('0x2f')][_0xca62('0x36')]);_0x83a227[_0xca62('0x37')]=qs['filters'](_[_0xca62('0x38')](_0x558786[_0xca62('0x2f')],_0x38acce['filters']),_0x26b873);if(_0x558786[_0xca62('0x2f')][_0xca62('0x39')]){_0x83a227[_0xca62('0x37')]=_['merge'](_0x83a227[_0xca62('0x37')],{'$or':_[_0xca62('0x27')](_0x26b873,function(_0x1d0696){if(_0x1d0696[_0xca62('0x2b')]!==_0xca62('0x3a')){var _0x564127={};_0x564127[_0x1d0696[_0xca62('0x25')]]={'$like':'%'+_0x558786[_0xca62('0x2f')][_0xca62('0x39')]+'%'};return _0x564127;}})});}_0x83a227=_[_0xca62('0x3b')]({},_0x83a227,_0x558786[_0xca62('0x3c')]);var _0x30641b={'where':_0x83a227[_0xca62('0x37')]};return db['ChatTransferReport']['count'](_0x30641b)[_0xca62('0x22')](function(_0x6e67bb){_0x485ad0[_0xca62('0x1c')]=_0x6e67bb;if(_0x558786[_0xca62('0x2f')][_0xca62('0x3d')]){_0x83a227['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0xca62('0x3e')](_0x83a227);})[_0xca62('0x22')](function(_0x53ac94){_0x485ad0[_0xca62('0x3f')]=_0x53ac94;return _0x485ad0;})['then'](respondWithFilteredResult(_0x40a220,_0x83a227))['catch'](handleError(_0x40a220,null));};exports[_0xca62('0x40')]=function(_0x4e9ffd,_0xa701a4){var _0x4f2d0a={'raw':!![],'where':{'id':_0x4e9ffd[_0xca62('0x41')]['id']}},_0x310bd7={};_0x310bd7[_0xca62('0x2d')]=_[_0xca62('0x2e')](db['ChatTransferReport'][_0xca62('0x29')]);_0x310bd7[_0xca62('0x2f')]=_[_0xca62('0x2e')](_0x4e9ffd[_0xca62('0x2f')]);_0x310bd7[_0xca62('0x42')]=_[_0xca62('0x31')](_0x310bd7['model'],_0x310bd7[_0xca62('0x2f')]);_0x4f2d0a[_0xca62('0x32')]=_[_0xca62('0x31')](_0x310bd7[_0xca62('0x2d')],qs[_0xca62('0x33')](_0x4e9ffd[_0xca62('0x2f')][_0xca62('0x33')]));_0x4f2d0a[_0xca62('0x32')]=_0x4f2d0a['attributes']['length']?_0x4f2d0a[_0xca62('0x32')]:_0x310bd7[_0xca62('0x2d')];if(_0x4e9ffd['query'][_0xca62('0x3d')]){_0x4f2d0a[_0xca62('0x43')]=[{'all':!![]}];}_0x4f2d0a=_[_0xca62('0x3b')]({},_0x4f2d0a,_0x4e9ffd[_0xca62('0x3c')]);return db[_0xca62('0x28')][_0xca62('0x44')](_0x4f2d0a)[_0xca62('0x22')](handleEntityNotFound(_0xa701a4,null))[_0xca62('0x22')](respondWithResult(_0xa701a4,null))['catch'](handleError(_0xa701a4,null));};exports['create']=function(_0x378a86,_0x5d0ee2){return db[_0xca62('0x28')]['create'](_0x378a86[_0xca62('0x45')],{})[_0xca62('0x22')](respondWithResult(_0x5d0ee2,0xc9))[_0xca62('0x46')](handleError(_0x5d0ee2,null));};exports[_0xca62('0x47')]=function(_0x374e18,_0x477d38){if(_0x374e18[_0xca62('0x45')]['id']){delete _0x374e18['body']['id'];}return db[_0xca62('0x28')][_0xca62('0x44')]({'where':{'id':_0x374e18[_0xca62('0x41')]['id']}})[_0xca62('0x22')](handleEntityNotFound(_0x477d38,null))[_0xca62('0x22')](saveUpdates(_0x374e18[_0xca62('0x45')],null))[_0xca62('0x22')](respondWithResult(_0x477d38,null))[_0xca62('0x46')](handleError(_0x477d38,null));};exports['destroy']=function(_0x26e4f9,_0x2f3aca){return db[_0xca62('0x28')][_0xca62('0x44')]({'where':{'id':_0x26e4f9[_0xca62('0x41')]['id']}})[_0xca62('0x22')](handleEntityNotFound(_0x2f3aca,null))[_0xca62('0x22')](removeEntity(_0x2f3aca,null))[_0xca62('0x46')](handleError(_0x2f3aca,null));};exports['describe']=function(_0x248aa8,_0x37839a){return db['ChatTransferReport'][_0xca62('0x48')]()['then'](respondWithResult(_0x37839a,null))[_0xca62('0x46')](handleError(_0x37839a,null));}; \ No newline at end of file +var _0xb3e9=['VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','update','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','jsforce','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','then','end','sendStatus','error','stack','name','send','index','ChatTransferReport','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','map'];(function(_0x29786a,_0x2d5681){var _0x31dc45=function(_0x5a8948){while(--_0x5a8948){_0x29786a['push'](_0x29786a['shift']());}};_0x31dc45(++_0x2d5681);}(_0xb3e9,0x17c));var _0x9b3e=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xb3e9[_0x35da42];return _0x370035;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9b3e('0x0'));var jsonpatch=require(_0x9b3e('0x1'));var rp=require(_0x9b3e('0x2'));var moment=require(_0x9b3e('0x3'));var BPromise=require(_0x9b3e('0x4'));var Mustache=require(_0x9b3e('0x5'));var util=require(_0x9b3e('0x6'));var path=require(_0x9b3e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9b3e('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9b3e('0x9'));var crypto=require('crypto');var jsforce=require(_0x9b3e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x9b3e('0xb'));var querystring=require(_0x9b3e('0xc'));var Papa=require(_0x9b3e('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9b3e('0xe'));var hardwareService=require(_0x9b3e('0xf'));var logger=require('../../config/logger')(_0x9b3e('0x10'));var utils=require(_0x9b3e('0x11'));var config=require(_0x9b3e('0x12'));var licenseUtil=require(_0x9b3e('0x13'));var db=require(_0x9b3e('0x14'))['db'];function respondWithStatusCode(_0x3d1fb1,_0x8fc84){_0x8fc84=_0x8fc84||0xcc;return function(_0x5011bf){if(_0x5011bf){return _0x3d1fb1['sendStatus'](_0x8fc84);}return _0x3d1fb1[_0x9b3e('0x15')](_0x8fc84)['end']();};}function respondWithResult(_0x29c428,_0x4580b1){_0x4580b1=_0x4580b1||0xc8;return function(_0x31e2fa){if(_0x31e2fa){return _0x29c428[_0x9b3e('0x15')](_0x4580b1)[_0x9b3e('0x16')](_0x31e2fa);}};}function respondWithFilteredResult(_0x3736c8,_0x54085b){return function(_0x371a35){if(_0x371a35){var _0x132622=_0x371a35[_0x9b3e('0x17')],_0x2b9ed5=_0x54085b[_0x9b3e('0x18')],_0x261fac=_0x54085b['offset']+_0x54085b[_0x9b3e('0x19')],_0x289026;if(_0x261fac>=_0x132622){_0x261fac=_0x132622;_0x289026=0xc8;}else{_0x289026=0xce;}_0x3736c8['status'](_0x289026);return _0x3736c8[_0x9b3e('0x1a')](_0x9b3e('0x1b'),_0x2b9ed5+'-'+_0x261fac+'/'+_0x132622)[_0x9b3e('0x16')](_0x371a35);}return null;};}function patchUpdates(_0x1a44f8){return function(_0x1550db){try{jsonpatch['apply'](_0x1550db,_0x1a44f8,!![]);}catch(_0x51cb51){return BPromise[_0x9b3e('0x1c')](_0x51cb51);}return _0x1550db[_0x9b3e('0x1d')]();};}function saveUpdates(_0x3d0f90,_0xa99891){return function(_0x6d3d1){if(_0x6d3d1){return _0x6d3d1['update'](_0x3d0f90)['then'](function(_0x424ab3){return _0x424ab3;});}return null;};}function removeEntity(_0x17dde9,_0x401419){return function(_0x5b9654){if(_0x5b9654){return _0x5b9654[_0x9b3e('0x1e')]()[_0x9b3e('0x1f')](function(){_0x17dde9[_0x9b3e('0x15')](0xcc)[_0x9b3e('0x20')]();});}};}function handleEntityNotFound(_0x566c1f,_0x8f77d2){return function(_0x226cbe){if(!_0x226cbe){_0x566c1f[_0x9b3e('0x21')](0x194);}return _0x226cbe;};}function handleError(_0x2d2181,_0x1f9e15){_0x1f9e15=_0x1f9e15||0x1f4;return function(_0x42d113){logger[_0x9b3e('0x22')](_0x42d113[_0x9b3e('0x23')]);if(_0x42d113['name']){delete _0x42d113[_0x9b3e('0x24')];}_0x2d2181[_0x9b3e('0x15')](_0x1f9e15)[_0x9b3e('0x25')](_0x42d113);};}exports[_0x9b3e('0x26')]=function(_0x55b9de,_0x10eb77){var _0x33380e={},_0x28745c={},_0x558995={'count':0x0,'rows':[]};var _0x3ecf21=_['map'](db[_0x9b3e('0x27')]['rawAttributes'],function(_0x4947a3){return{'name':_0x4947a3[_0x9b3e('0x28')],'type':_0x4947a3[_0x9b3e('0x29')][_0x9b3e('0x2a')]};});_0x28745c[_0x9b3e('0x2b')]=_['map'](_0x3ecf21,_0x9b3e('0x24'));_0x28745c[_0x9b3e('0x2c')]=_[_0x9b3e('0x2d')](_0x55b9de['query']);_0x28745c['filters']=_[_0x9b3e('0x2e')](_0x28745c['model'],_0x28745c[_0x9b3e('0x2c')]);_0x33380e['attributes']=_[_0x9b3e('0x2e')](_0x28745c[_0x9b3e('0x2b')],qs['fields'](_0x55b9de[_0x9b3e('0x2c')][_0x9b3e('0x2f')]));_0x33380e['attributes']=_0x33380e[_0x9b3e('0x30')][_0x9b3e('0x31')]?_0x33380e[_0x9b3e('0x30')]:_0x28745c['model'];if(!_0x55b9de[_0x9b3e('0x2c')][_0x9b3e('0x32')](_0x9b3e('0x33'))){_0x33380e['limit']=qs['limit'](_0x55b9de[_0x9b3e('0x2c')][_0x9b3e('0x19')]);_0x33380e['offset']=qs[_0x9b3e('0x18')](_0x55b9de[_0x9b3e('0x2c')][_0x9b3e('0x18')]);}_0x33380e[_0x9b3e('0x34')]=qs['sort'](_0x55b9de['query'][_0x9b3e('0x35')]);_0x33380e[_0x9b3e('0x36')]=qs[_0x9b3e('0x37')](_['pick'](_0x55b9de[_0x9b3e('0x2c')],_0x28745c['filters']),_0x3ecf21);if(_0x55b9de[_0x9b3e('0x2c')][_0x9b3e('0x38')]){_0x33380e[_0x9b3e('0x36')]=_['merge'](_0x33380e[_0x9b3e('0x36')],{'$or':_[_0x9b3e('0x39')](_0x3ecf21,function(_0x230048){if(_0x230048[_0x9b3e('0x29')]!==_0x9b3e('0x3a')){var _0xee643b={};_0xee643b[_0x230048['name']]={'$like':'%'+_0x55b9de[_0x9b3e('0x2c')][_0x9b3e('0x38')]+'%'};return _0xee643b;}})});}_0x33380e=_[_0x9b3e('0x3b')]({},_0x33380e,_0x55b9de['options']);var _0x1f51bc={'where':_0x33380e['where']};return db[_0x9b3e('0x27')][_0x9b3e('0x17')](_0x1f51bc)[_0x9b3e('0x1f')](function(_0x447511){_0x558995[_0x9b3e('0x17')]=_0x447511;if(_0x55b9de['query'][_0x9b3e('0x3c')]){_0x33380e['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x9b3e('0x3d')](_0x33380e);})[_0x9b3e('0x1f')](function(_0x5a3adc){_0x558995[_0x9b3e('0x3e')]=_0x5a3adc;return _0x558995;})[_0x9b3e('0x1f')](respondWithFilteredResult(_0x10eb77,_0x33380e))[_0x9b3e('0x3f')](handleError(_0x10eb77,null));};exports[_0x9b3e('0x40')]=function(_0x5eddeb,_0x3947b4){var _0x296702={'raw':!![],'where':{'id':_0x5eddeb[_0x9b3e('0x41')]['id']}},_0x2c3b59={};_0x2c3b59[_0x9b3e('0x2b')]=_[_0x9b3e('0x2d')](db[_0x9b3e('0x27')][_0x9b3e('0x42')]);_0x2c3b59['query']=_['keys'](_0x5eddeb['query']);_0x2c3b59['filtears']=_[_0x9b3e('0x2e')](_0x2c3b59[_0x9b3e('0x2b')],_0x2c3b59['query']);_0x296702[_0x9b3e('0x30')]=_[_0x9b3e('0x2e')](_0x2c3b59[_0x9b3e('0x2b')],qs[_0x9b3e('0x2f')](_0x5eddeb[_0x9b3e('0x2c')]['fields']));_0x296702[_0x9b3e('0x30')]=_0x296702[_0x9b3e('0x30')][_0x9b3e('0x31')]?_0x296702[_0x9b3e('0x30')]:_0x2c3b59[_0x9b3e('0x2b')];if(_0x5eddeb[_0x9b3e('0x2c')]['includeAll']){_0x296702['include']=[{'all':!![]}];}_0x296702=_[_0x9b3e('0x3b')]({},_0x296702,_0x5eddeb[_0x9b3e('0x43')]);return db[_0x9b3e('0x27')][_0x9b3e('0x44')](_0x296702)[_0x9b3e('0x1f')](handleEntityNotFound(_0x3947b4,null))[_0x9b3e('0x1f')](respondWithResult(_0x3947b4,null))[_0x9b3e('0x3f')](handleError(_0x3947b4,null));};exports[_0x9b3e('0x45')]=function(_0x26775a,_0x2b1c7d){return db[_0x9b3e('0x27')][_0x9b3e('0x45')](_0x26775a[_0x9b3e('0x46')],{})['then'](respondWithResult(_0x2b1c7d,0xc9))[_0x9b3e('0x3f')](handleError(_0x2b1c7d,null));};exports[_0x9b3e('0x47')]=function(_0x522aa2,_0x2cdab5){if(_0x522aa2[_0x9b3e('0x46')]['id']){delete _0x522aa2['body']['id'];}return db[_0x9b3e('0x27')][_0x9b3e('0x44')]({'where':{'id':_0x522aa2['params']['id']}})[_0x9b3e('0x1f')](handleEntityNotFound(_0x2cdab5,null))['then'](saveUpdates(_0x522aa2[_0x9b3e('0x46')],null))[_0x9b3e('0x1f')](respondWithResult(_0x2cdab5,null))[_0x9b3e('0x3f')](handleError(_0x2cdab5,null));};exports[_0x9b3e('0x1e')]=function(_0xfbf89e,_0x350a7c){return db[_0x9b3e('0x27')][_0x9b3e('0x44')]({'where':{'id':_0xfbf89e['params']['id']}})[_0x9b3e('0x1f')](handleEntityNotFound(_0x350a7c,null))[_0x9b3e('0x1f')](removeEntity(_0x350a7c,null))[_0x9b3e('0x3f')](handleError(_0x350a7c,null));};exports[_0x9b3e('0x48')]=function(_0x118325,_0x45d9b9){return db['ChatTransferReport']['describe']()[_0x9b3e('0x1f')](respondWithResult(_0x45d9b9,null))[_0x9b3e('0x3f')](handleError(_0x45d9b9,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index eec72ac..3ac3c15 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 _0xc2c9=['api','moment','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','report_chat_transfer','uniqueid','lodash','util'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xc2c9,0x11c));var _0x9c2c=function(_0x481317,_0x3397dd){_0x481317=_0x481317-0x0;var _0x1dfb20=_0xc2c9[_0x481317];return _0x1dfb20;};'use strict';var _=require(_0x9c2c('0x0'));var util=require(_0x9c2c('0x1'));var logger=require('../../config/logger')(_0x9c2c('0x2'));var moment=require(_0x9c2c('0x3'));var BPromise=require('bluebird');var rp=require(_0x9c2c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9c2c('0x5'));var config=require(_0x9c2c('0x6'));var attributes=require(_0x9c2c('0x7'));module[_0x9c2c('0x8')]=function(_0x35dec1,_0x5a6fe3){return _0x35dec1['define']('ChatTransferReport',attributes,{'tableName':_0x9c2c('0x9'),'paranoid':![],'indexes':[{'name':_0x9c2c('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d5e=['../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash','api','bluebird','request-promise','path'];(function(_0x145016,_0x40ba0b){var _0x4a57e8=function(_0x11ea2a){while(--_0x11ea2a){_0x145016['push'](_0x145016['shift']());}};_0x4a57e8(++_0x40ba0b);}(_0x2d5e,0x19d));var _0xe2d5=function(_0x1a816a,_0x14323c){_0x1a816a=_0x1a816a-0x0;var _0x8ff4b8=_0x2d5e[_0x1a816a];return _0x8ff4b8;};'use strict';var _=require(_0xe2d5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe2d5('0x1'));var moment=require('moment');var BPromise=require(_0xe2d5('0x2'));var rp=require(_0xe2d5('0x3'));var fs=require('fs');var path=require(_0xe2d5('0x4'));var rimraf=require('rimraf');var config=require(_0xe2d5('0x5'));var attributes=require(_0xe2d5('0x6'));module[_0xe2d5('0x7')]=function(_0x1c140d,_0x169c9d){return _0x1c140d[_0xe2d5('0x8')](_0xe2d5('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe2d5('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 6c72a18..445f228 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 _0x3fb5=['request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x1d79a9,_0x2bd178){var _0x5cec2c=function(_0x1857bc){while(--_0x1857bc){_0x1d79a9['push'](_0x1d79a9['shift']());}};_0x5cec2c(++_0x2bd178);}(_0x3fb5,0x18b));var _0x53fb=function(_0x266eef,_0x281749){_0x266eef=_0x266eef-0x0;var _0x412b9b=_0x3fb5[_0x266eef];return _0x412b9b;};'use strict';var _=require(_0x53fb('0x0'));var util=require(_0x53fb('0x1'));var moment=require(_0x53fb('0x2'));var BPromise=require(_0x53fb('0x3'));var rs=require(_0x53fb('0x4'));var fs=require('fs');var Redis=require(_0x53fb('0x5'));var db=require(_0x53fb('0x6'))['db'];var utils=require(_0x53fb('0x7'));var logger=require(_0x53fb('0x8'))(_0x53fb('0x9'));var config=require('../../config/environment');var jayson=require(_0x53fb('0xa'));var client=jayson[_0x53fb('0xb')][_0x53fb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x24fb76,_0x17106b,_0x537a96){return new BPromise(function(_0x2756eb,_0x2ec76c){return client[_0x53fb('0xd')](_0x24fb76,_0x537a96)[_0x53fb('0xe')](function(_0xdab803){logger['info'](_0x53fb('0xf'),_0x17106b,_0x53fb('0x10'));logger[_0x53fb('0x11')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x17106b,_0x53fb('0x10'),JSON[_0x53fb('0x12')](_0xdab803));if(_0xdab803['error']){if(_0xdab803[_0x53fb('0x13')][_0x53fb('0x14')]===0x1f4){logger[_0x53fb('0x13')](_0x53fb('0xf'),_0x17106b,_0xdab803[_0x53fb('0x13')][_0x53fb('0x15')]);return _0x2ec76c(_0xdab803[_0x53fb('0x13')]['message']);}logger['error'](_0x53fb('0xf'),_0x17106b,_0xdab803['error'][_0x53fb('0x15')]);return _0x2756eb(_0xdab803[_0x53fb('0x13')][_0x53fb('0x15')]);}else{logger['info'](_0x53fb('0xf'),_0x17106b,'request\x20sent');_0x2756eb(_0xdab803[_0x53fb('0x16')][_0x53fb('0x15')]);}})[_0x53fb('0x17')](function(_0x47b2c7){logger[_0x53fb('0x13')](_0x53fb('0xf'),_0x17106b,_0x47b2c7);_0x2ec76c(_0x47b2c7);});});} \ No newline at end of file +var _0xf0c5=['ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3f6ed8,_0x1ac76b){var _0x5b6a94=function(_0x13d95){while(--_0x13d95){_0x3f6ed8['push'](_0x3f6ed8['shift']());}};_0x5b6a94(++_0x1ac76b);}(_0xf0c5,0x1d5));var _0x5f0c=function(_0x3af841,_0x4ea81c){_0x3af841=_0x3af841-0x0;var _0x573ce5=_0xf0c5[_0x3af841];return _0x573ce5;};'use strict';var _=require(_0x5f0c('0x0'));var util=require(_0x5f0c('0x1'));var moment=require('moment');var BPromise=require(_0x5f0c('0x2'));var rs=require(_0x5f0c('0x3'));var fs=require('fs');var Redis=require(_0x5f0c('0x4'));var db=require(_0x5f0c('0x5'))['db'];var utils=require(_0x5f0c('0x6'));var logger=require('../../config/logger')(_0x5f0c('0x7'));var config=require(_0x5f0c('0x8'));var jayson=require(_0x5f0c('0x9'));var client=jayson[_0x5f0c('0xa')][_0x5f0c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e251a,_0x59bb75,_0x1a6e26){return new BPromise(function(_0x3f0fa6,_0x3cecbd){return client[_0x5f0c('0xc')](_0x1e251a,_0x1a6e26)[_0x5f0c('0xd')](function(_0x2b8633){logger[_0x5f0c('0xe')](_0x5f0c('0xf'),_0x59bb75,_0x5f0c('0x10'));logger['debug'](_0x5f0c('0x11'),_0x59bb75,_0x5f0c('0x10'),JSON['stringify'](_0x2b8633));if(_0x2b8633[_0x5f0c('0x12')]){if(_0x2b8633[_0x5f0c('0x12')]['code']===0x1f4){logger[_0x5f0c('0x12')](_0x5f0c('0xf'),_0x59bb75,_0x2b8633[_0x5f0c('0x12')][_0x5f0c('0x13')]);return _0x3cecbd(_0x2b8633[_0x5f0c('0x12')][_0x5f0c('0x13')]);}logger[_0x5f0c('0x12')](_0x5f0c('0xf'),_0x59bb75,_0x2b8633[_0x5f0c('0x12')]['message']);return _0x3f0fa6(_0x2b8633[_0x5f0c('0x12')][_0x5f0c('0x13')]);}else{logger[_0x5f0c('0xe')](_0x5f0c('0xf'),_0x59bb75,_0x5f0c('0x10'));_0x3f0fa6(_0x2b8633[_0x5f0c('0x14')]['message']);}})[_0x5f0c('0x15')](function(_0x1770b1){logger[_0x5f0c('0x12')](_0x5f0c('0xf'),_0x59bb75,_0x1770b1);_0x3cecbd(_0x1770b1);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 0667bc0..3b87d34 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 _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(_0xcbb8db,_0x1f0a12){var _0x2fdcac=function(_0x2eedc9){while(--_0x2eedc9){_0xcbb8db['push'](_0xcbb8db['shift']());}};_0x2fdcac(++_0x1f0a12);}(_0xb10b,0x12a));var _0xbb10=function(_0x1be143,_0x2f58ed){_0x1be143=_0x1be143-0x0;var _0xaa3f65=_0xb10b[_0x1be143];return _0xaa3f65;};'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 +var _0x5f66=['describe','get','/:id','show','create','put','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated','index'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var auth=require(_0x65f6('0x4'));var interaction=require(_0x65f6('0x5'));var config=require('../../config/environment');var controller=require(_0x65f6('0x6'));router['get']('/',auth[_0x65f6('0x7')](),controller[_0x65f6('0x8')]);router['get']('/describe',auth[_0x65f6('0x7')](),controller[_0x65f6('0x9')]);router[_0x65f6('0xa')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller[_0x65f6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller['update']);router[_0x65f6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x65f6('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 650fd80..f026161 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 _0xc5b4=['setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue','parse','onlineForm'];(function(_0x546f47,_0x5d8ece){var _0xf1f2d7=function(_0x87a95e){while(--_0x87a95e){_0x546f47['push'](_0x546f47['shift']());}};_0xf1f2d7(++_0x5d8ece);}(_0xc5b4,0x1cb));var _0x4c5b=function(_0x468d79,_0x2f16f1){_0x468d79=_0x468d79-0x0;var _0x4c2388=_0xc5b4[_0x468d79];return _0x4c2388;};'use strict';var Sequelize=require(_0x4c5b('0x0'));var rs=require(_0x4c5b('0x1'));module[_0x4c5b('0x2')]={'name':{'type':Sequelize[_0x4c5b('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4c5b('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':_0x4c5b('0x5')},'key':{'type':Sequelize[_0x4c5b('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x4c5b('0x3')],'allowNull':![],'defaultValue':_0x4c5b('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x4c5b('0x3')],'allowNull':![],'defaultValue':_0x4c5b('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x4c5b('0x3')],'allowNull':![],'defaultValue':_0x4c5b('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x4c5b('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x4c5b('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x4c5b('0xa')](_0x4c5b('0xb'),_0x4c5b('0xc')),'defaultValue':_0x4c5b('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x4c5b('0xd')},'start_chat_button':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':_0x4c5b('0xe')},'offline_chat_button':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':_0x4c5b('0xf')},'header_offline':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':_0x4c5b('0x10')},'download_transcript':{'type':Sequelize[_0x4c5b('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x4c5b('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x4c5b('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x4c5b('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x4c5b('0x12')]},'closingQuestion':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':_0x4c5b('0x13')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4c5b('0x14')},'formSubmitFailureMessage':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':_0x4c5b('0x15')},'noteTitle':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':_0x4c5b('0x16')},'placeholderMessage':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':_0x4c5b('0x17')},'closingMessage':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':_0x4c5b('0x18')},'closingMessageButton':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':_0x4c5b('0xf')},'skipMessageButton':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':_0x4c5b('0x19')},'conditionAgreement':{'type':Sequelize[_0x4c5b('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x4c5b('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x4c5b('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x4c5b('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':_0x4c5b('0x1a')},'ratingType':{'type':Sequelize[_0x4c5b('0xa')](_0x4c5b('0x1b'),_0x4c5b('0x1c')),'defaultValue':_0x4c5b('0x1b')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x4c5b('0x12')],'defaultValue':function(){return JSON[_0x4c5b('0x1d')]({'items':[{'type':_0x4c5b('0x1e'),'variable':null,'config':{'placeholder':_0x4c5b('0x1f'),'type':_0x4c5b('0x20'),'required':!![]},'props':{'title':_0x4c5b('0x1f'),'helpText':''}},{'type':_0x4c5b('0x1e'),'props':{'title':_0x4c5b('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x4c5b('0x5'),'type':_0x4c5b('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x4c5b('0x21')]('onlineForm')?JSON[_0x4c5b('0x22')](this[_0x4c5b('0x21')](_0x4c5b('0x23'))):{};},'set':function(_0x19f267){return this[_0x4c5b('0x24')]('onlineForm',JSON[_0x4c5b('0x1d')](_0x19f267));}},'offlineForm':{'type':Sequelize[_0x4c5b('0x12')],'defaultValue':function(){return JSON[_0x4c5b('0x1d')]({'items':[{'type':_0x4c5b('0x1e'),'props':{'title':_0x4c5b('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x4c5b('0x5')},'variable':null},{'type':_0x4c5b('0x25'),'config':{'placeholder':_0x4c5b('0x26')},'props':{'title':_0x4c5b('0x26'),'helpText':_0x4c5b('0x27')}}],'fromKey':0x0});},'get':function(){return this[_0x4c5b('0x21')](_0x4c5b('0x28'))?JSON['parse'](this[_0x4c5b('0x21')](_0x4c5b('0x28'))):{};},'set':function(_0x1ff60e){return this[_0x4c5b('0x24')]('offlineForm',JSON[_0x4c5b('0x1d')](_0x1ff60e));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x4c5b('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x4c5b('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x4c5b('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x4c5b('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x4c5b('0x29')},'waitingMessage':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':_0x4c5b('0x2a')},'offlineMessageSubject':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':_0x4c5b('0x2b')},'offlineMessageBody':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':_0x4c5b('0x2c')},'enableUnmanagedNote':{'type':Sequelize[_0x4c5b('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':_0x4c5b('0x2d')},'skipUnmanaged':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':_0x4c5b('0x19')},'sendUnmanaged':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':_0x4c5b('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0x4c5b('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x4c5b('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x4c5b('0x12')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x4c5b('0x3')]},'notificationTemplate':{'type':Sequelize[_0x4c5b('0x12')],'defaultValue':function(){return _0x4c5b('0x2e');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x4c5b('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':_0x4c5b('0x2f')},'waitForTheAssignedAgent':{'type':Sequelize[_0x4c5b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x4c5b('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':_0x4c5b('0x30')},'defaultTitle':{'type':Sequelize[_0x4c5b('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x4c5b('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x4c5b('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x4c5b('0x3')],'allowNull':![],'defaultValue':_0x4c5b('0x31'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x4c5b('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4c5b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x4c5b('0x3')],'defaultValue':_0x4c5b('0x32')},'systemAvatar':{'type':Sequelize[_0x4c5b('0x12')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4c5b('0x8')],'comment':_0x4c5b('0x33')},'mandatoryDisposition':{'type':Sequelize[_0x4c5b('0x9')],'defaultValue':![],'comment':_0x4c5b('0x34'),'set':function(_0x561162){if(!_0x561162)this['setDataValue'](_0x4c5b('0x35'),null);this[_0x4c5b('0x24')](_0x4c5b('0x36'),_0x561162);}},'vidaooEscalation':{'type':Sequelize[_0x4c5b('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file +var _0x5343=['INTEGER','ENUM','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Feedback','star','stringify','input','text','getDataValue','onlineForm','parse','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','website_alias','bottom_right','#fafafa','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','#ffffff'];(function(_0x49d206,_0x59720d){var _0x4cf37b=function(_0x4a8185){while(--_0x4a8185){_0x49d206['push'](_0x49d206['shift']());}};_0x4cf37b(++_0x59720d);}(_0x5343,0x123));var _0x3534=function(_0x17b57b,_0x525635){_0x17b57b=_0x17b57b-0x0;var _0x41f3af=_0x5343[_0x17b57b];return _0x41f3af;};'use strict';var Sequelize=require(_0x3534('0x0'));var rs=require(_0x3534('0x1'));module[_0x3534('0x2')]={'name':{'type':Sequelize[_0x3534('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3534('0x4')},'description':{'type':Sequelize[_0x3534('0x3')]},'mapKey':{'type':Sequelize[_0x3534('0x3')],'defaultValue':_0x3534('0x5')},'mapKeyOffline':{'type':Sequelize[_0x3534('0x3')],'defaultValue':_0x3534('0x5')},'key':{'type':Sequelize[_0x3534('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x3534('0x3')],'defaultValue':_0x3534('0x6')},'customerAlias':{'type':Sequelize[_0x3534('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x3534('0x3')],'allowNull':![],'defaultValue':_0x3534('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x3534('0x3')],'allowNull':![],'defaultValue':_0x3534('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x3534('0x3')],'allowNull':![],'defaultValue':_0x3534('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x3534('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x3534('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3534('0xa')]('rounded',_0x3534('0xb')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x3534('0x3')],'defaultValue':_0x3534('0xc')},'start_chat_button':{'type':Sequelize[_0x3534('0x3')],'defaultValue':_0x3534('0xd')},'offline_chat_button':{'type':Sequelize[_0x3534('0x3')],'defaultValue':_0x3534('0xe')},'header_offline':{'type':Sequelize[_0x3534('0x3')],'defaultValue':_0x3534('0xf')},'download_transcript':{'type':Sequelize[_0x3534('0x10')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x3534('0x3')],'defaultValue':_0x3534('0x11')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x3534('0x12')]},'closingQuestion':{'type':Sequelize[_0x3534('0x3')],'defaultValue':_0x3534('0x13')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3534('0x14')},'formSubmitFailureMessage':{'type':Sequelize[_0x3534('0x3')],'defaultValue':_0x3534('0x15')},'noteTitle':{'type':Sequelize[_0x3534('0x3')],'defaultValue':_0x3534('0x16')},'placeholderMessage':{'type':Sequelize[_0x3534('0x3')],'defaultValue':_0x3534('0x17')},'closingMessage':{'type':Sequelize[_0x3534('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x3534('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x3534('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x3534('0x10')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x3534('0x10')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x3534('0x10')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x3534('0x3')],'defaultValue':_0x3534('0x18')},'ratingType':{'type':Sequelize[_0x3534('0xa')](_0x3534('0x19'),'thumb'),'defaultValue':_0x3534('0x19')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x3534('0x12')],'defaultValue':function(){return JSON[_0x3534('0x1a')]({'items':[{'type':_0x3534('0x1b'),'variable':null,'config':{'placeholder':'name','type':_0x3534('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x3534('0x1b'),'props':{'title':_0x3534('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3534('0x5'),'type':_0x3534('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x3534('0x1d')](_0x3534('0x1e'))?JSON[_0x3534('0x1f')](this[_0x3534('0x1d')](_0x3534('0x1e'))):{};},'set':function(_0x50909d){return this['setDataValue'](_0x3534('0x1e'),JSON['stringify'](_0x50909d));}},'offlineForm':{'type':Sequelize[_0x3534('0x12')],'defaultValue':function(){return JSON[_0x3534('0x1a')]({'items':[{'type':'input','props':{'title':_0x3534('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3534('0x5'),'type':_0x3534('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':_0x3534('0x20')},'props':{'title':_0x3534('0x20'),'helpText':_0x3534('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x3534('0x1d')](_0x3534('0x22'))?JSON[_0x3534('0x1f')](this[_0x3534('0x1d')](_0x3534('0x22'))):{};},'set':function(_0x12eb8a){return this[_0x3534('0x23')](_0x3534('0x22'),JSON[_0x3534('0x1a')](_0x12eb8a));}},'token':{'type':Sequelize[_0x3534('0x3')],'defaultValue':function(){return rs[_0x3534('0x24')]();}},'autoclose':{'type':Sequelize[_0x3534('0x10')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3534('0x10')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x3534('0x10')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x3534('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x3534('0x3')]},'waitingTitle':{'type':Sequelize[_0x3534('0x3')],'defaultValue':_0x3534('0x25')},'waitingMessage':{'type':Sequelize[_0x3534('0x3')],'defaultValue':_0x3534('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x3534('0x3')],'defaultValue':_0x3534('0x27')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x3534('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x3534('0x10')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3534('0x29')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x3534('0x2a')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x3534('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x3534('0x10')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x3534('0x10')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x3534('0x12')]},'showAgentAvatar':{'type':Sequelize[_0x3534('0x10')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x3534('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x3534('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3534('0x10')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x3534('0x3')],'defaultValue':_0x3534('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x3534('0x2c')},'verticalAlignment':{'type':Sequelize[_0x3534('0x9')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x3534('0x3')]},'customerAvatar':{'type':Sequelize[_0x3534('0x12')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x3534('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x3534('0x3')],'allowNull':![],'defaultValue':_0x3534('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x3534('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3534('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3534('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x3534('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x3534('0x2e')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3534('0x2f'),'set':function(_0xf6ceb6){if(!_0xf6ceb6)this[_0x3534('0x23')](_0x3534('0x30'),null);this[_0x3534('0x23')](_0x3534('0x31'),_0xf6ceb6);}},'vidaooEscalation':{'type':Sequelize[_0x3534('0x10')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x3534('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 20b2687..3826571 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 _0xfa95=['auth','sendMail','\x22%s\x22\x20<%s>','forwardOfflineAddress','offlineMessageSubject','addInteraction','Contact','Owner','fullname','internal','Tag','Tags','color','tag','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','getLicense','custom','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.js','remote','x-real-ip','connection','remoteAddress','virtual','render','alignment','verticalAlignment','textColor','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','addProactiveActions','getProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','omit','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./chatWebsite.socket','register','jayson/promise','client','http','request','then','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','get','ChatWebsites','UserProfileResource','destroy','stack','name','send','index','Pause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','findAll','catch','show','mandatoryDispositionPause','keys','filtears','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','Disposition','getDispositions','nolimit','ChatWebsiteId','rows','ids','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','root','isNil','existsSync','server/files/images/logos/','download','getAvatar','join','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','user-agent-parser','setUA','headers','user-agent','getResult','ValidationError','no\x20available\x20attributes','difference','createdAt','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','CmContact','DESC','account','Applications','applications','orderBy','priority','asc','Contacts','ListId','contact','x-forwarded-for','first','firstName','x-real-port','browser','format','%s\x20%s','unknown','version','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','lastName','messageId','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','notify','updatedAt','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','service','host','secure','authentication'];(function(_0x57c9c7,_0xb70a91){var _0x48ad8b=function(_0x51af55){while(--_0x51af55){_0x57c9c7['push'](_0x57c9c7['shift']());}};_0x48ad8b(++_0xb70a91);}(_0xfa95,0x160));var _0x5fa9=function(_0x12b83d,_0x4bcec7){_0x12b83d=_0x12b83d-0x0;var _0x1fd39d=_0xfa95[_0x12b83d];return _0x1fd39d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5fa9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5fa9('0x1'));var jsonpatch=require(_0x5fa9('0x2'));var rp=require(_0x5fa9('0x3'));var moment=require(_0x5fa9('0x4'));var BPromise=require(_0x5fa9('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5fa9('0x6'));var sox=require(_0x5fa9('0x7'));var csv=require(_0x5fa9('0x8'));var ejs=require(_0x5fa9('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5fa9('0xa'));var crypto=require('crypto');var jsforce=require(_0x5fa9('0xb'));var deskjs=require(_0x5fa9('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5fa9('0xd'));var Papa=require(_0x5fa9('0xe'));var Redis=require(_0x5fa9('0xf'));var authService=require(_0x5fa9('0x10'));var qs=require(_0x5fa9('0x11'));var as=require(_0x5fa9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fa9('0x13'))(_0x5fa9('0x14'));var utils=require('../../config/utils');var config=require(_0x5fa9('0x15'));var licenseUtil=require(_0x5fa9('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5fa9('0x17')](config['redis'],{'host':_0x5fa9('0x18'),'port':0x18eb});var socket=require(_0x5fa9('0x19'))(new Redis(config[_0x5fa9('0x1a')]));require(_0x5fa9('0x1b'))[_0x5fa9('0x1c')](socket);var jayson=require(_0x5fa9('0x1d'));var client=jayson[_0x5fa9('0x1e')][_0x5fa9('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0x5fa9('0x1e')]['http']({'port':0x232b});function respondWithRpcPromise(_0x558d0a,_0x4a4789,_0x4d7616,_0x76f898){return new BPromise(function(_0xc3a93f,_0x4ac742){var _0x4c6a2d=_0x76f898||client;return _0x4c6a2d[_0x5fa9('0x20')](_0x558d0a,_0x4d7616)[_0x5fa9('0x21')](function(_0x3b1696){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x4a4789,'request\x20sent');logger[_0x5fa9('0x22')](_0x5fa9('0x23'),_0x4a4789,_0x5fa9('0x24'),JSON[_0x5fa9('0x25')](_0x3b1696));if(_0x3b1696['error']){if(_0x3b1696[_0x5fa9('0x26')][_0x5fa9('0x27')]===0x1f4){logger['error'](_0x5fa9('0x28'),_0x4a4789,_0x3b1696['error'][_0x5fa9('0x29')]);return _0x4ac742(_0x3b1696[_0x5fa9('0x26')][_0x5fa9('0x29')]);}logger[_0x5fa9('0x26')](_0x5fa9('0x28'),_0x4a4789,_0x3b1696[_0x5fa9('0x26')][_0x5fa9('0x29')]);return _0xc3a93f(_0x3b1696[_0x5fa9('0x26')][_0x5fa9('0x29')]);}else{logger['info'](_0x5fa9('0x28'),_0x4a4789,'request\x20sent');_0xc3a93f(_0x3b1696[_0x5fa9('0x2a')][_0x5fa9('0x29')]);}})['catch'](function(_0x8ac4ea){logger[_0x5fa9('0x26')](_0x5fa9('0x28'),_0x4a4789,_0x8ac4ea);_0x4ac742(_0x8ac4ea);});});}function respondWithStatusCode(_0x395656,_0x5e0cc5){_0x5e0cc5=_0x5e0cc5||0xcc;return function(_0x5d82b7){if(_0x5d82b7){return _0x395656[_0x5fa9('0x2b')](_0x5e0cc5);}return _0x395656[_0x5fa9('0x2c')](_0x5e0cc5)['end']();};}function respondWithResult(_0x27423c,_0x4f2d60){_0x4f2d60=_0x4f2d60||0xc8;return function(_0x2bc1a4){if(_0x2bc1a4){return _0x27423c[_0x5fa9('0x2c')](_0x4f2d60)[_0x5fa9('0x2d')](_0x2bc1a4);}};}function respondWithFilteredResult(_0xc9d665,_0x36b3bf){return function(_0x5985fd){if(_0x5985fd){var _0xac8449=_0x5985fd[_0x5fa9('0x2e')],_0x33960f=_0x36b3bf[_0x5fa9('0x2f')],_0x1b32cd=_0x36b3bf[_0x5fa9('0x2f')]+_0x36b3bf[_0x5fa9('0x30')],_0x527d40;if(_0x1b32cd>=_0xac8449){_0x1b32cd=_0xac8449;_0x527d40=0xc8;}else{_0x527d40=0xce;}_0xc9d665[_0x5fa9('0x2c')](_0x527d40);return _0xc9d665[_0x5fa9('0x31')](_0x5fa9('0x32'),_0x33960f+'-'+_0x1b32cd+'/'+_0xac8449)['json'](_0x5985fd);}return null;};}function patchUpdates(_0x306cfe){return function(_0x1f0603){try{jsonpatch[_0x5fa9('0x33')](_0x1f0603,_0x306cfe,!![]);}catch(_0x3273b1){return BPromise[_0x5fa9('0x34')](_0x3273b1);}return _0x1f0603[_0x5fa9('0x35')]();};}function saveUpdates(_0x4e100c,_0xa545c5){return function(_0x31130d){if(_0x31130d){return _0x31130d['update'](_0x4e100c)[_0x5fa9('0x21')](function(_0x19fe78){return _0x19fe78;});}return null;};}function removeEntity(_0x446a99,_0x3bb7a7){return function(_0x27af69){if(_0x27af69){return _0x27af69['destroy']()[_0x5fa9('0x21')](function(){var _0x476bb6=_0x27af69[_0x5fa9('0x36')]({'plain':!![]});var _0x2a1c57=_0x5fa9('0x37');return db[_0x5fa9('0x38')][_0x5fa9('0x39')]({'where':{'type':_0x2a1c57,'resourceId':_0x476bb6['id']}})[_0x5fa9('0x21')](function(){return _0x27af69;});})['then'](function(){_0x446a99[_0x5fa9('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57ae70,_0x3d34eb){return function(_0x46b408){if(!_0x46b408){_0x57ae70[_0x5fa9('0x2b')](0x194);}return _0x46b408;};}function handleError(_0x5226ab,_0xc33cfd){_0xc33cfd=_0xc33cfd||0x1f4;return function(_0x5520ad){logger['error'](_0x5520ad[_0x5fa9('0x3a')]);if(_0x5520ad[_0x5fa9('0x3b')]){delete _0x5520ad[_0x5fa9('0x3b')];}_0x5226ab[_0x5fa9('0x2c')](_0xc33cfd)[_0x5fa9('0x3c')](_0x5520ad);};}exports[_0x5fa9('0x3d')]=function(_0x136107,_0x5668a5){var _0x4db84c={'include':[{'model':db[_0x5fa9('0x3e')],'as':'mandatoryDispositionPause'}]},_0x506cdc={},_0x2f88b0={'count':0x0,'rows':[]};var _0x4fb123=_[_0x5fa9('0x3f')](db[_0x5fa9('0x40')][_0x5fa9('0x41')],function(_0x56c4d6){return{'name':_0x56c4d6[_0x5fa9('0x42')],'type':_0x56c4d6[_0x5fa9('0x43')][_0x5fa9('0x44')]};});_0x506cdc[_0x5fa9('0x45')]=_[_0x5fa9('0x3f')](_0x4fb123,_0x5fa9('0x3b'));_0x506cdc[_0x5fa9('0x46')]=_['keys'](_0x136107[_0x5fa9('0x46')]);_0x506cdc[_0x5fa9('0x47')]=_[_0x5fa9('0x48')](_0x506cdc[_0x5fa9('0x45')],_0x506cdc[_0x5fa9('0x46')]);_0x4db84c['attributes']=_[_0x5fa9('0x48')](_0x506cdc[_0x5fa9('0x45')],qs[_0x5fa9('0x49')](_0x136107[_0x5fa9('0x46')][_0x5fa9('0x49')]));_0x4db84c[_0x5fa9('0x4a')]=_0x4db84c[_0x5fa9('0x4a')][_0x5fa9('0x4b')]?_0x4db84c[_0x5fa9('0x4a')]:_0x506cdc[_0x5fa9('0x45')];if(!_0x136107['query'][_0x5fa9('0x4c')]('nolimit')){_0x4db84c[_0x5fa9('0x30')]=qs[_0x5fa9('0x30')](_0x136107[_0x5fa9('0x46')][_0x5fa9('0x30')]);_0x4db84c[_0x5fa9('0x2f')]=qs['offset'](_0x136107[_0x5fa9('0x46')]['offset']);}_0x4db84c[_0x5fa9('0x4d')]=qs[_0x5fa9('0x4e')](_0x136107[_0x5fa9('0x46')][_0x5fa9('0x4e')]);_0x4db84c['where']=qs[_0x5fa9('0x47')](_[_0x5fa9('0x4f')](_0x136107['query'],_0x506cdc[_0x5fa9('0x47')]),_0x4fb123);if(_0x136107[_0x5fa9('0x46')][_0x5fa9('0x50')]){_0x4db84c[_0x5fa9('0x51')]=_[_0x5fa9('0x52')](_0x4db84c[_0x5fa9('0x51')],{'$or':_[_0x5fa9('0x3f')](_0x4fb123,function(_0x49e31b){if(_0x49e31b[_0x5fa9('0x43')]!=='VIRTUAL'){var _0x553ae7={};_0x553ae7[_0x49e31b[_0x5fa9('0x3b')]]={'$like':'%'+_0x136107[_0x5fa9('0x46')][_0x5fa9('0x50')]+'%'};return _0x553ae7;}})});}_0x4db84c=_['merge']({},_0x4db84c,_0x136107[_0x5fa9('0x53')]);var _0x1967d8={'where':_0x4db84c[_0x5fa9('0x51')]};return db[_0x5fa9('0x40')][_0x5fa9('0x2e')](_0x1967d8)['then'](function(_0x54e16e){_0x2f88b0[_0x5fa9('0x2e')]=_0x54e16e;if(_0x136107[_0x5fa9('0x46')][_0x5fa9('0x54')]){_0x4db84c['include']=[{'all':!![]}];}return db['ChatWebsite'][_0x5fa9('0x55')](_0x4db84c);})[_0x5fa9('0x21')](function(_0x35eb56){_0x2f88b0['rows']=_0x35eb56;return _0x2f88b0;})[_0x5fa9('0x21')](respondWithFilteredResult(_0x5668a5,_0x4db84c))[_0x5fa9('0x56')](handleError(_0x5668a5,null));};exports[_0x5fa9('0x57')]=function(_0x1563d8,_0x6c8547){var _0x41879f={'raw':![],'where':{'id':_0x1563d8['params']['id']},'include':[{'model':db[_0x5fa9('0x3e')],'as':_0x5fa9('0x58')}]},_0x53e0d1={};_0x53e0d1[_0x5fa9('0x45')]=_[_0x5fa9('0x59')](db[_0x5fa9('0x40')][_0x5fa9('0x41')]);_0x53e0d1[_0x5fa9('0x46')]=_[_0x5fa9('0x59')](_0x1563d8[_0x5fa9('0x46')]);_0x53e0d1[_0x5fa9('0x5a')]=_['intersection'](_0x53e0d1[_0x5fa9('0x45')],_0x53e0d1[_0x5fa9('0x46')]);_0x41879f[_0x5fa9('0x4a')]=_[_0x5fa9('0x48')](_0x53e0d1[_0x5fa9('0x45')],qs['fields'](_0x1563d8['query']['fields']));_0x41879f['attributes']=_0x41879f['attributes'][_0x5fa9('0x4b')]?_0x41879f['attributes']:_0x53e0d1['model'];if(_0x1563d8[_0x5fa9('0x46')]['includeAll']){_0x41879f[_0x5fa9('0x5b')]=[{'all':!![]}];}_0x41879f=_[_0x5fa9('0x52')]({},_0x41879f,_0x1563d8[_0x5fa9('0x53')]);return db[_0x5fa9('0x40')][_0x5fa9('0x5c')](_0x41879f)[_0x5fa9('0x21')](handleEntityNotFound(_0x6c8547,null))[_0x5fa9('0x21')](respondWithResult(_0x6c8547,null))[_0x5fa9('0x56')](handleError(_0x6c8547,null));};exports[_0x5fa9('0x5d')]=function(_0x6feade,_0x4d46d5){return db[_0x5fa9('0x40')][_0x5fa9('0x5d')](_0x6feade[_0x5fa9('0x5e')],{})['then'](function(_0x54b074){var _0x46f5da=_0x6feade['user'][_0x5fa9('0x36')]({'plain':!![]});if(!_0x46f5da)throw new Error(_0x5fa9('0x5f'));if(_0x46f5da[_0x5fa9('0x60')]===_0x5fa9('0x61')){var _0x640b8e=_0x54b074[_0x5fa9('0x36')]({'plain':!![]});var _0x531b7f='ChatWebsites';return db[_0x5fa9('0x62')][_0x5fa9('0x5c')]({'where':{'name':_0x531b7f,'userProfileId':_0x46f5da[_0x5fa9('0x63')]},'raw':!![]})[_0x5fa9('0x21')](function(_0x5cc288){if(_0x5cc288&&_0x5cc288['autoAssociation']===0x0){return db[_0x5fa9('0x38')][_0x5fa9('0x5d')]({'name':_0x640b8e[_0x5fa9('0x3b')],'resourceId':_0x640b8e['id'],'type':_0x5cc288[_0x5fa9('0x3b')],'sectionId':_0x5cc288['id']},{})['then'](function(){return _0x54b074;});}else{return _0x54b074;}})[_0x5fa9('0x56')](function(_0x45bf00){logger[_0x5fa9('0x26')](_0x5fa9('0x64'),_0x45bf00);throw _0x45bf00;});}return _0x54b074;})['then'](respondWithResult(_0x4d46d5,0xc9))[_0x5fa9('0x56')](handleError(_0x4d46d5,null));};exports[_0x5fa9('0x65')]=function(_0x550b69,_0x3e7699){if(_0x550b69['body']['id']){delete _0x550b69['body']['id'];}return db[_0x5fa9('0x40')]['find']({'where':{'id':_0x550b69[_0x5fa9('0x66')]['id']},'include':[{'model':db[_0x5fa9('0x3e')],'as':_0x5fa9('0x58')}]})[_0x5fa9('0x21')](handleEntityNotFound(_0x3e7699,null))[_0x5fa9('0x21')](saveUpdates(_0x550b69['body'],null))['then'](respondWithResult(_0x3e7699,null))[_0x5fa9('0x56')](handleError(_0x3e7699,null));};exports['destroy']=function(_0x301b94,_0x5c722f){return db[_0x5fa9('0x40')][_0x5fa9('0x5c')]({'where':{'id':_0x301b94['params']['id']}})[_0x5fa9('0x21')](handleEntityNotFound(_0x5c722f,null))[_0x5fa9('0x21')](removeEntity(_0x5c722f,null))[_0x5fa9('0x56')](handleError(_0x5c722f,null));};exports[_0x5fa9('0x67')]=function(_0x1c9204,_0x177538){return db['ChatWebsite'][_0x5fa9('0x67')]()[_0x5fa9('0x21')](respondWithResult(_0x177538,null))[_0x5fa9('0x56')](handleError(_0x177538,null));};exports[_0x5fa9('0x68')]=function(_0x3f7f21,_0x2b26fe,_0x339b7f){if(_0x3f7f21[_0x5fa9('0x5e')]['id']){delete _0x3f7f21[_0x5fa9('0x5e')]['id'];}return db[_0x5fa9('0x40')][_0x5fa9('0x5c')]({'where':{'id':_0x3f7f21[_0x5fa9('0x66')]['id']}})[_0x5fa9('0x21')](handleEntityNotFound(_0x2b26fe,null))['then'](function(_0x54df5a){if(_0x54df5a){_0x3f7f21['body']['ChatWebsiteId']=_0x54df5a['id'];return db[_0x5fa9('0x69')][_0x5fa9('0x5d')](_0x3f7f21['body']);}})[_0x5fa9('0x21')](respondWithResult(_0x2b26fe,null))[_0x5fa9('0x56')](handleError(_0x2b26fe,null));};exports[_0x5fa9('0x6a')]=function(_0x129086,_0x5962d9,_0x3c4883){var _0x28093d={'raw':![],'where':{}};var _0x2f198e={};var _0x3ef7d5={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x129086['params']['id']}})[_0x5fa9('0x21')](handleEntityNotFound(_0x5962d9,null))[_0x5fa9('0x21')](function(_0x19e519){if(_0x19e519){_0x2f198e[_0x5fa9('0x45')]=_[_0x5fa9('0x59')](db[_0x5fa9('0x69')][_0x5fa9('0x41')]);_0x2f198e[_0x5fa9('0x46')]=_[_0x5fa9('0x59')](_0x129086[_0x5fa9('0x46')]);_0x2f198e[_0x5fa9('0x47')]=_[_0x5fa9('0x48')](_0x2f198e['model'],_0x2f198e[_0x5fa9('0x46')]);_0x28093d[_0x5fa9('0x4a')]=_[_0x5fa9('0x48')](_0x2f198e['model'],qs[_0x5fa9('0x49')](_0x129086[_0x5fa9('0x46')][_0x5fa9('0x49')]));_0x28093d['attributes']=_0x28093d[_0x5fa9('0x4a')][_0x5fa9('0x4b')]?_0x28093d[_0x5fa9('0x4a')]:_0x2f198e['model'];if(!_0x129086[_0x5fa9('0x46')][_0x5fa9('0x4c')](_0x5fa9('0x6b'))){_0x28093d[_0x5fa9('0x30')]=qs[_0x5fa9('0x30')](_0x129086[_0x5fa9('0x46')][_0x5fa9('0x30')]);_0x28093d[_0x5fa9('0x2f')]=qs['offset'](_0x129086[_0x5fa9('0x46')][_0x5fa9('0x2f')]);}_0x28093d[_0x5fa9('0x4d')]=qs[_0x5fa9('0x4e')](_0x129086[_0x5fa9('0x46')]['sort']);_0x28093d['where']=qs['filters'](_[_0x5fa9('0x4f')](_0x129086['query'],_0x2f198e[_0x5fa9('0x47')]));_0x28093d[_0x5fa9('0x51')][_0x5fa9('0x6c')]=_0x19e519['id'];if(_0x129086[_0x5fa9('0x46')][_0x5fa9('0x50')]){_0x28093d[_0x5fa9('0x51')]=_[_0x5fa9('0x52')](_0x28093d[_0x5fa9('0x51')],{'$or':_[_0x5fa9('0x3f')](_0x28093d[_0x5fa9('0x4a')],function(_0x365749){var _0x3ceb18={};_0x3ceb18[_0x365749]={'$like':'%'+_0x129086[_0x5fa9('0x46')][_0x5fa9('0x50')]+'%'};return _0x3ceb18;})});}_0x28093d=_[_0x5fa9('0x52')]({},_0x28093d,_0x129086[_0x5fa9('0x53')]);return db[_0x5fa9('0x69')]['count']({'where':_0x28093d[_0x5fa9('0x51')]})[_0x5fa9('0x21')](function(_0x3e02f9){_0x3ef7d5[_0x5fa9('0x2e')]=_0x3e02f9;if(_0x129086[_0x5fa9('0x46')][_0x5fa9('0x54')]){_0x28093d[_0x5fa9('0x5b')]=[{'all':!![]}];}return db['Disposition'][_0x5fa9('0x55')](_0x28093d);})[_0x5fa9('0x21')](function(_0x461b01){_0x3ef7d5[_0x5fa9('0x6d')]=_0x461b01;return _0x3ef7d5;});}})['then'](respondWithFilteredResult(_0x5962d9,_0x28093d))[_0x5fa9('0x56')](handleError(_0x5962d9,null));};exports['removeDispositions']=function(_0x49ba52,_0x332b19,_0xdee12e){return db[_0x5fa9('0x40')][_0x5fa9('0x5c')]({'where':{'id':_0x49ba52[_0x5fa9('0x66')]['id']}})[_0x5fa9('0x21')](handleEntityNotFound(_0x332b19,null))['then'](function(_0x2efd52){if(_0x2efd52){return _0x2efd52['removeDispositions'](_0x49ba52['query'][_0x5fa9('0x6e')]);}})[_0x5fa9('0x21')](respondWithStatusCode(_0x332b19,null))['catch'](handleError(_0x332b19,null));};exports['addAnswer']=function(_0x318919,_0x4ee3b2,_0x15fdd6){if(_0x318919['body']['id']){delete _0x318919[_0x5fa9('0x5e')]['id'];}return db[_0x5fa9('0x40')][_0x5fa9('0x5c')]({'where':{'id':_0x318919[_0x5fa9('0x66')]['id']}})[_0x5fa9('0x21')](handleEntityNotFound(_0x4ee3b2,null))[_0x5fa9('0x21')](function(_0x3490ea){if(_0x3490ea){_0x318919[_0x5fa9('0x5e')][_0x5fa9('0x6c')]=_0x3490ea['id'];return db[_0x5fa9('0x6f')][_0x5fa9('0x5d')](_0x318919['body']);}})[_0x5fa9('0x21')](respondWithResult(_0x4ee3b2,null))['catch'](handleError(_0x4ee3b2,null));};exports[_0x5fa9('0x70')]=function(_0x2a3463,_0x4c0f09,_0x5a2d32){var _0x2c7096={'raw':![],'where':{}};var _0x480439={};var _0x23270f={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x5fa9('0x71')]({'where':{'id':_0x2a3463[_0x5fa9('0x66')]['id']}})[_0x5fa9('0x21')](handleEntityNotFound(_0x4c0f09,null))[_0x5fa9('0x21')](function(_0x1543cb){if(_0x1543cb){_0x480439[_0x5fa9('0x45')]=_[_0x5fa9('0x59')](db[_0x5fa9('0x6f')]['rawAttributes']);_0x480439[_0x5fa9('0x46')]=_['keys'](_0x2a3463[_0x5fa9('0x46')]);_0x480439[_0x5fa9('0x47')]=_[_0x5fa9('0x48')](_0x480439['model'],_0x480439[_0x5fa9('0x46')]);_0x2c7096[_0x5fa9('0x4a')]=_['intersection'](_0x480439[_0x5fa9('0x45')],qs[_0x5fa9('0x49')](_0x2a3463[_0x5fa9('0x46')][_0x5fa9('0x49')]));_0x2c7096['attributes']=_0x2c7096[_0x5fa9('0x4a')][_0x5fa9('0x4b')]?_0x2c7096[_0x5fa9('0x4a')]:_0x480439['model'];if(!_0x2a3463[_0x5fa9('0x46')][_0x5fa9('0x4c')](_0x5fa9('0x6b'))){_0x2c7096[_0x5fa9('0x30')]=qs[_0x5fa9('0x30')](_0x2a3463['query'][_0x5fa9('0x30')]);_0x2c7096[_0x5fa9('0x2f')]=qs[_0x5fa9('0x2f')](_0x2a3463[_0x5fa9('0x46')][_0x5fa9('0x2f')]);}_0x2c7096[_0x5fa9('0x4d')]=qs[_0x5fa9('0x4e')](_0x2a3463[_0x5fa9('0x46')][_0x5fa9('0x4e')]);_0x2c7096['where']=qs[_0x5fa9('0x47')](_[_0x5fa9('0x4f')](_0x2a3463[_0x5fa9('0x46')],_0x480439[_0x5fa9('0x47')]));_0x2c7096['where'][_0x5fa9('0x6c')]=_0x1543cb['id'];if(_0x2a3463[_0x5fa9('0x46')]['filter']){_0x2c7096[_0x5fa9('0x51')]=_[_0x5fa9('0x52')](_0x2c7096[_0x5fa9('0x51')],{'$or':_[_0x5fa9('0x3f')](_0x2c7096['attributes'],function(_0x30bfa2){var _0x25c6ff={};_0x25c6ff[_0x30bfa2]={'$like':'%'+_0x2a3463[_0x5fa9('0x46')][_0x5fa9('0x50')]+'%'};return _0x25c6ff;})});}_0x2c7096=_['merge']({},_0x2c7096,_0x2a3463['options']);return db['CannedAnswer'][_0x5fa9('0x2e')]({'where':_0x2c7096[_0x5fa9('0x51')]})[_0x5fa9('0x21')](function(_0x3b6e4d){_0x23270f[_0x5fa9('0x2e')]=_0x3b6e4d;if(_0x2a3463[_0x5fa9('0x46')][_0x5fa9('0x54')]){_0x2c7096[_0x5fa9('0x5b')]=[{'all':!![]}];}return db[_0x5fa9('0x6f')]['findAll'](_0x2c7096);})[_0x5fa9('0x21')](function(_0x10a9ee){_0x23270f['rows']=_0x10a9ee;return _0x23270f;});}})[_0x5fa9('0x21')](respondWithFilteredResult(_0x4c0f09,_0x2c7096))['catch'](handleError(_0x4c0f09,null));};exports[_0x5fa9('0x72')]=function(_0x14d548,_0x1c1c27,_0x2f68cc){return db[_0x5fa9('0x40')][_0x5fa9('0x5c')]({'where':{'id':_0x14d548[_0x5fa9('0x66')]['id']}})[_0x5fa9('0x21')](handleEntityNotFound(_0x1c1c27,null))[_0x5fa9('0x21')](function(_0x2e5c70){if(_0x2e5c70){return _0x2e5c70[_0x5fa9('0x72')](_0x14d548['query']['ids']);}})['then'](respondWithStatusCode(_0x1c1c27,null))[_0x5fa9('0x56')](handleError(_0x1c1c27,null));};exports[_0x5fa9('0x73')]=function(_0x58e574,_0x30c5c5,_0x37307c){_0x58e574[_0x5fa9('0x5e')][_0x5fa9('0x74')]=_0x58e574[_0x5fa9('0x75')][_0x5fa9('0x76')];return db[_0x5fa9('0x40')][_0x5fa9('0x5c')]({'where':{'id':_0x58e574['params']['id']}})[_0x5fa9('0x21')](handleEntityNotFound(_0x30c5c5,null))[_0x5fa9('0x21')](saveUpdates(_0x58e574[_0x5fa9('0x5e')],null))[_0x5fa9('0x21')](respondWithResult(_0x30c5c5,null))[_0x5fa9('0x56')](handleError(_0x30c5c5,null));};exports[_0x5fa9('0x77')]=function(_0x38d0ec,_0x59a724,_0x5062fb){_0x38d0ec['body'][_0x5fa9('0x78')]=_0x38d0ec[_0x5fa9('0x75')][_0x5fa9('0x76')];return db['ChatWebsite'][_0x5fa9('0x5c')]({'where':{'id':_0x38d0ec['params']['id']}})[_0x5fa9('0x21')](handleEntityNotFound(_0x59a724,null))['then'](saveUpdates(_0x38d0ec[_0x5fa9('0x5e')],null))['then'](respondWithResult(_0x59a724,null))[_0x5fa9('0x56')](handleError(_0x59a724,null));};exports[_0x5fa9('0x79')]=function(_0x2ca72d,_0x32b1d4,_0x36652f){_0x2ca72d['body'][_0x5fa9('0x7a')]=_0x2ca72d[_0x5fa9('0x75')][_0x5fa9('0x76')];return db[_0x5fa9('0x40')][_0x5fa9('0x5c')]({'where':{'id':_0x2ca72d['params']['id']}})[_0x5fa9('0x21')](handleEntityNotFound(_0x32b1d4,null))[_0x5fa9('0x21')](saveUpdates(_0x2ca72d['body'],null))['then'](respondWithResult(_0x32b1d4,null))[_0x5fa9('0x56')](handleError(_0x32b1d4,null));};exports['addSystemAvatar']=function(_0x458dd4,_0x44a2ba,_0x5e74e6){_0x458dd4[_0x5fa9('0x5e')][_0x5fa9('0x7b')]=_0x458dd4[_0x5fa9('0x75')]['filename'];return db[_0x5fa9('0x40')][_0x5fa9('0x5c')]({'where':{'id':_0x458dd4[_0x5fa9('0x66')]['id']}})[_0x5fa9('0x21')](handleEntityNotFound(_0x44a2ba,null))[_0x5fa9('0x21')](saveUpdates(_0x458dd4['body'],null))[_0x5fa9('0x21')](respondWithResult(_0x44a2ba,null))[_0x5fa9('0x56')](handleError(_0x44a2ba,null));};exports[_0x5fa9('0x7c')]=function(_0x22c29e,_0x55b1f8,_0x58f786){var _0x32d83f=path['join'](config[_0x5fa9('0x7d')],'server/files/images/logos/default_logo.svg');var _0x24f904={'where':{'id':_0x22c29e[_0x5fa9('0x66')]['id']},'attributes':['id',_0x5fa9('0x74')],'raw':!![]};var _0x3353cb=![];return require('../../config/license/util')['getLicense']()['then'](function(_0x463928){if(_0x463928){_0x3353cb=_0x463928['custom'];}})['then'](function(){return db[_0x5fa9('0x40')][_0x5fa9('0x5c')](_0x24f904);})[_0x5fa9('0x21')](handleEntityNotFound(_0x55b1f8,null))[_0x5fa9('0x21')](function(_0x4440b9){if(_0x4440b9){if(!_[_0x5fa9('0x7e')](_0x4440b9[_0x5fa9('0x74')])){if(fs[_0x5fa9('0x7f')](path['join'](config[_0x5fa9('0x7d')],_0x5fa9('0x80'),_0x4440b9[_0x5fa9('0x74')]))&&_0x3353cb){_0x32d83f=path['join'](config[_0x5fa9('0x7d')],_0x5fa9('0x80'),_0x4440b9['sitepic']);}}return _0x55b1f8[_0x5fa9('0x81')](_0x32d83f);}})[_0x5fa9('0x56')](handleError(_0x55b1f8,null));};exports[_0x5fa9('0x82')]=function(_0x13d225,_0x1c10de,_0x2df2ab){var _0x2410fa=path[_0x5fa9('0x83')](config['root'],_0x5fa9('0x84'));var _0x3b2712={'where':{'id':_0x13d225[_0x5fa9('0x66')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x5fa9('0x40')][_0x5fa9('0x5c')](_0x3b2712)['then'](handleEntityNotFound(_0x1c10de,null))['then'](function(_0x23e547){if(_0x23e547){if(!_[_0x5fa9('0x7e')](_0x23e547['agentAvatar'])){if(fs['existsSync'](path['join'](config[_0x5fa9('0x7d')],_0x5fa9('0x85'),_0x23e547[_0x5fa9('0x78')]))){_0x2410fa=path[_0x5fa9('0x83')](config[_0x5fa9('0x7d')],_0x5fa9('0x85'),_0x23e547[_0x5fa9('0x78')]);}}return _0x1c10de[_0x5fa9('0x81')](_0x2410fa);}})['catch'](handleError(_0x1c10de,null));};exports[_0x5fa9('0x86')]=function(_0x55b5f8,_0x4f1915,_0x490095){var _0x16a3c8=path[_0x5fa9('0x83')](config[_0x5fa9('0x7d')],'server/files/images/avatars/customer_avatar.png');var _0x6a67f3={'where':{'id':_0x55b5f8[_0x5fa9('0x66')]['id']},'attributes':['id',_0x5fa9('0x7a'),_0x5fa9('0x87')],'raw':!![]};return db[_0x5fa9('0x40')]['find'](_0x6a67f3)[_0x5fa9('0x21')](handleEntityNotFound(_0x4f1915,null))[_0x5fa9('0x21')](function(_0x4c4324){if(_0x4c4324){if(!_[_0x5fa9('0x7e')](_0x4c4324[_0x5fa9('0x7a')])){if(fs[_0x5fa9('0x7f')](path[_0x5fa9('0x83')](config['root'],'server/files/images/avatars/',_0x4c4324['customerAvatar']))&&_0x4c4324['showCustomerAvatar']){_0x16a3c8=path[_0x5fa9('0x83')](config['root'],_0x5fa9('0x85'),_0x4c4324[_0x5fa9('0x7a')]);}}return _0x4f1915[_0x5fa9('0x81')](_0x16a3c8);}})[_0x5fa9('0x56')](handleError(_0x4f1915,null));};exports[_0x5fa9('0x88')]=function(_0x4a2334,_0x2b655f,_0x35a37f){var _0x198431=path[_0x5fa9('0x83')](config[_0x5fa9('0x7d')],'server/files/images/avatars/system_avatar.png');var _0xadf834={'where':{'id':_0x4a2334[_0x5fa9('0x66')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x5fa9('0x40')][_0x5fa9('0x5c')](_0xadf834)['then'](handleEntityNotFound(_0x2b655f,null))[_0x5fa9('0x21')](function(_0x6817ef){if(_0x6817ef){if(!_['isNil'](_0x6817ef[_0x5fa9('0x7b')])){if(fs[_0x5fa9('0x7f')](path['join'](config[_0x5fa9('0x7d')],_0x5fa9('0x85'),_0x6817ef[_0x5fa9('0x7b')]))){_0x198431=path[_0x5fa9('0x83')](config['root'],_0x5fa9('0x85'),_0x6817ef[_0x5fa9('0x7b')]);}}return _0x2b655f['download'](_0x198431);}})[_0x5fa9('0x56')](handleError(_0x2b655f,null));};exports['notify']=function(_0x138bc0,_0x3de3ee,_0x42ec9a){var _0x3dc0c1=require(_0x5fa9('0x89'));var _0x2098ae=new _0x3dc0c1();var _0x4433a4=_0x2098ae[_0x5fa9('0x8a')](_0x138bc0[_0x5fa9('0x8b')][_0x5fa9('0x8c')])[_0x5fa9('0x8d')]();var _0x97fc7d={'body':_0x138bc0[_0x5fa9('0x5e')],'channel':'chat'};var _0x189b67=[];var _0x24c94e=[];var _0x2220bb={};var _0x3a52e1=![];return db['CmContact'][_0x5fa9('0x67')]()[_0x5fa9('0x21')](function(_0x3e16df){if(!_0x3e16df){throw new db['Sequelize'][(_0x5fa9('0x8e'))](_0x5fa9('0x8f'));}_0x189b67=_[_0x5fa9('0x90')](_['keys'](_0x3e16df),[_0x5fa9('0x91'),'updatedAt']);_0x24c94e=_[_0x5fa9('0x90')](_[_0x5fa9('0x59')](_0x3e16df),[_0x5fa9('0x91'),'updatedAt','CompanyId','ListId']);if(_0x138bc0['body']['id']){delete _0x138bc0[_0x5fa9('0x5e')]['id'];}if(_[_0x5fa9('0x7e')](_0x138bc0['body'][_0x5fa9('0x92')])){throw new db[(_0x5fa9('0x93'))][(_0x5fa9('0x8e'))](_0x5fa9('0x94'));}if(_[_0x5fa9('0x7e')](_0x138bc0[_0x5fa9('0x5e')][_0x5fa9('0x5e')])||_0x138bc0['body'][_0x5fa9('0x5e')]===''){throw new db['Sequelize']['ValidationError'](_0x5fa9('0x95'));}if(_[_0x5fa9('0x7e')](_0x138bc0[_0x5fa9('0x5e')][_0x5fa9('0x96')])){throw new db[(_0x5fa9('0x93'))]['ValidationError'](_0x5fa9('0x97')+_0x24c94e);}if(!_[_0x5fa9('0x98')](_0x24c94e,_0x138bc0[_0x5fa9('0x5e')][_0x5fa9('0x96')])){throw new db[(_0x5fa9('0x93'))]['ValidationError'](_0x5fa9('0x99')+_0x24c94e);}_0x2220bb[_0x138bc0[_0x5fa9('0x5e')][_0x5fa9('0x96')]]=_0x138bc0[_0x5fa9('0x5e')]['from'];})[_0x5fa9('0x21')](function(){return db['ChatWebsite'][_0x5fa9('0x5c')]({'where':{'id':_0x138bc0[_0x5fa9('0x66')]['id']},'include':[{'model':db[_0x5fa9('0x9a')],'as':_0x5fa9('0x9b'),'include':[{'model':db[_0x5fa9('0x9c')],'as':'Contacts','where':_0x2220bb,'limit':0x1,'order':[['updatedAt',_0x5fa9('0x9d')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0x5fa9('0x21')](handleEntityNotFound(_0x3de3ee,null))[_0x5fa9('0x21')](function(_0x12c93f){if(_0x12c93f&&_0x12c93f[_0x5fa9('0x9b')]){_0x97fc7d[_0x5fa9('0x9e')]=_0x12c93f;_0x97fc7d['applications']=_0x12c93f[_0x5fa9('0x9f')];_0x97fc7d['list']=_0x12c93f[_0x5fa9('0x9b')];_0x97fc7d[_0x5fa9('0xa0')]=_[_0x5fa9('0xa1')](_0x97fc7d[_0x5fa9('0xa0')],[_0x5fa9('0xa2')],[_0x5fa9('0xa3')]);if(_0x97fc7d['account'][_0x5fa9('0x9f')]){delete _0x97fc7d[_0x5fa9('0x9e')]['Applications'];}if(_0x97fc7d[_0x5fa9('0x9e')]['List']&&_0x97fc7d['account'][_0x5fa9('0x9b')][_0x5fa9('0xa4')][_0x5fa9('0x4b')]){return _0x97fc7d[_0x5fa9('0x9e')]['List'][_0x5fa9('0xa4')][0x0];}var _0x285555=_['defaults'](_0x138bc0[_0x5fa9('0x5e')],{'firstName':_0x138bc0[_0x5fa9('0x5e')][_0x5fa9('0x92')],'ListId':_0x12c93f[_0x5fa9('0xa5')]});_0x285555[_0x138bc0[_0x5fa9('0x5e')]['mapKey']]=_0x138bc0[_0x5fa9('0x5e')][_0x5fa9('0x92')];return db[_0x5fa9('0x9c')][_0x5fa9('0x5d')](_0x285555,{'fields':_0x189b67,'raw':!![]});}})[_0x5fa9('0x21')](handleEntityNotFound(_0x3de3ee,null))[_0x5fa9('0x21')](function(_0x2a6628){_0x97fc7d[_0x5fa9('0xa6')]=_0x2a6628;var _0x3d030=_0x138bc0[_0x5fa9('0x5e')]['customerIp'];if(_0x138bc0[_0x5fa9('0x8b')]['cf-connecting-ip']){_0x3d030=_0x138bc0[_0x5fa9('0x8b')]['cf-connecting-ip'];}else if(_0x138bc0[_0x5fa9('0x8b')][_0x5fa9('0xa7')]){_0x3d030=_[_0x5fa9('0xa8')](_0x138bc0['headers'][_0x5fa9('0xa7')]['split'](','));}if(_0x2a6628){var _0xe08799={'ContactId':_0x2a6628['id'],'ChatWebsiteId':_0x138bc0[_0x5fa9('0x66')]['id'],'from':(_0x2a6628[_0x5fa9('0xa9')]||'')+'\x20'+(_0x2a6628['lastName']||''),'customerIp':_0x3d030,'customerPort':_0x138bc0['headers']['x-real-port']?_0x138bc0[_0x5fa9('0x8b')][_0x5fa9('0xaa')]:null,'referer':_0x138bc0[_0x5fa9('0x5e')]['referer'],'browserName':_0x4433a4['browser']['name']&&_0x4433a4[_0x5fa9('0xab')]['version']?util[_0x5fa9('0xac')](_0x5fa9('0xad'),_0x4433a4[_0x5fa9('0xab')]['name'],_0x4433a4[_0x5fa9('0xab')]['version']):_0x5fa9('0xae'),'browserVersion':_0x4433a4[_0x5fa9('0xab')]['version']||_0x5fa9('0xae'),'osName':util['format'](_0x5fa9('0xad'),_0x4433a4['os'][_0x5fa9('0x3b')],_0x4433a4['os'][_0x5fa9('0xaf')]),'osVersion':_0x4433a4['os'][_0x5fa9('0xaf')],'deviceModel':_0x4433a4[_0x5fa9('0xb0')][_0x5fa9('0x45')]&&_0x4433a4[_0x5fa9('0xb0')]['vendor']?util[_0x5fa9('0xac')](_0x5fa9('0xb1'),_0x4433a4['device'][_0x5fa9('0x45')],_0x4433a4[_0x5fa9('0xb0')][_0x5fa9('0xb2')],_0x4433a4[_0x5fa9('0xb0')]['type']):null,'deviceVendor':_0x4433a4['device'][_0x5fa9('0xb2')],'deviceType':_0x4433a4[_0x5fa9('0xb0')]['type'],'formData':JSON[_0x5fa9('0x25')](_0x138bc0['body'])};var _0x801275={'ChatWebsiteId':_0x138bc0[_0x5fa9('0x66')]['id'],'closed':![]};if(_0x138bc0[_0x5fa9('0x5e')][_0x5fa9('0xb3')]){_0x801275[_0x5fa9('0xb3')]=_0x138bc0['body'][_0x5fa9('0xb3')];return db[_0x5fa9('0xb4')][_0x5fa9('0x5c')]({'where':_0x801275})['then'](function(_0x47bb98){if(_0x47bb98){return[_0x47bb98,![]];}_0xe08799[_0x5fa9('0xb3')]=_0x138bc0['body'][_0x5fa9('0xb3')];_0xe08799[_0x5fa9('0xb5')]=_0x138bc0[_0x5fa9('0x5e')]['externalUrl'];return db[_0x5fa9('0xb4')][_0x5fa9('0x5d')](_0xe08799)[_0x5fa9('0x21')](function(_0x52e641){return[_0x52e641,!![]];});});}_0x801275[_0x5fa9('0xb6')]=_0x2a6628['id'];if(_0x138bc0[_0x5fa9('0x5e')]['interaction']&&_0x138bc0[_0x5fa9('0x5e')][_0x5fa9('0xb7')]['id']){_0x801275['id']=_0x138bc0[_0x5fa9('0x5e')][_0x5fa9('0xb7')]['id'];return db[_0x5fa9('0xb4')][_0x5fa9('0x5c')]({'where':_0x801275})[_0x5fa9('0x21')](function(_0x450435){if(_0x450435){return[_0x450435,![]];}return db[_0x5fa9('0xb4')][_0x5fa9('0x5d')](_0xe08799)[_0x5fa9('0x21')](function(_0xf6d4e4){return[_0xf6d4e4,!![]];});});}return db[_0x5fa9('0xb4')][_0x5fa9('0x5d')](_0xe08799)[_0x5fa9('0x21')](function(_0x221a03){return[_0x221a03,!![]];});}})[_0x5fa9('0xb8')](function(_0x2130f9,_0x27772e){if(_0x2130f9){_0x3a52e1=_0x27772e;if(!_0x27772e){var _0x4ce9e3={'from':(_0x97fc7d[_0x5fa9('0xa6')][_0x5fa9('0xa9')]||'')+'\x20'+(_0x97fc7d['contact'][_0x5fa9('0xb9')]||'')};if(_0x138bc0[_0x5fa9('0x5e')]['threadId']&&_0x138bc0[_0x5fa9('0x5e')][_0x5fa9('0xba')]&&_0x138bc0[_0x5fa9('0x5e')][_0x5fa9('0xb3')]!=_0x138bc0[_0x5fa9('0x5e')][_0x5fa9('0xba')]){_0x4ce9e3[_0x5fa9('0xb3')]=_0x138bc0[_0x5fa9('0x5e')]['messageId'];}return _0x2130f9[_0x5fa9('0x65')](_0x4ce9e3);}else{return _0x2130f9;}}})[_0x5fa9('0x21')](function(_0x3f05b5){_0x97fc7d['interaction']=_0x3f05b5[_0x5fa9('0x36')]({'plain':!![]});_0x97fc7d['interaction']['created']=_0x3a52e1;if(_0x97fc7d[_0x5fa9('0xb7')]['created']){if(_0x97fc7d[_0x5fa9('0x9e')][_0x5fa9('0xbb')]){_0x97fc7d[_0x5fa9('0xa0')][_0x5fa9('0xbc')]({'id':0x0,'priority':_0x97fc7d[_0x5fa9('0xa0')][_0x5fa9('0x4b')]+0x1,'app':_0x5fa9('0xbd'),'appdata':_0x5fa9('0xbe'),'interval':_0x5fa9('0xbf')});}}return db[_0x5fa9('0xc0')][_0x5fa9('0x5d')]({'body':_0x138bc0[_0x5fa9('0x5e')][_0x5fa9('0x5e')],'ChatWebsiteId':_0x138bc0['params']['id'],'ChatInteractionId':_0x3f05b5['id'],'direction':'in','ContactId':_0x97fc7d[_0x5fa9('0xa6')]['id'],'AttachmentId':_0x138bc0[_0x5fa9('0x5e')]['AttachmentId']});})[_0x5fa9('0x21')](function(_0x2388f4){_0x97fc7d[_0x5fa9('0x29')]=_0x2388f4;if(_0x97fc7d[_0x5fa9('0xb7')][_0x5fa9('0xc1')]){return db[_0x5fa9('0xc2')]['find']({'attributes':['id',_0x5fa9('0x3b')],'where':{'id':_0x97fc7d['interaction'][_0x5fa9('0xc1')]}})[_0x5fa9('0x21')](function(_0x455a53){if(_0x455a53){_0x97fc7d[_0x5fa9('0xa0')][_0x5fa9('0xc3')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x455a53[_0x5fa9('0x3b')]+','+(_0x97fc7d[_0x5fa9('0x9e')][_0x5fa9('0xc4')]||0xa),'interval':_0x5fa9('0xbf')});_0x97fc7d[_0x5fa9('0xc5')]=!![];}return respondWithRpcPromise('Start','startRouting',_0x97fc7d);});}return respondWithRpcPromise(_0x5fa9('0xc6'),'startRouting',_0x97fc7d);})[_0x5fa9('0x21')](function(_0x22ce78){respondWithRpcPromise(_0x5fa9('0xc7'),_0x5fa9('0xc7'),{'event':_0x5fa9('0xc8'),'message':_0x22ce78},client9002);return _0x22ce78;})[_0x5fa9('0x21')](respondWithResult(_0x3de3ee,null))[_0x5fa9('0x56')](handleError(_0x3de3ee,null));};exports['offline']=function(_0x18d18d,_0x104450,_0x1f781a){var _0x408131,_0x1c6802,_0x85080b;var _0x1992f3=[];var _0xc4bd31=[];var _0x181b47={};return db['CmContact'][_0x5fa9('0x67')]()[_0x5fa9('0x21')](function(_0x3d8b4f){if(!_0x3d8b4f){throw new db[(_0x5fa9('0x93'))]['ValidationError'](_0x5fa9('0x8f'));}_0xc4bd31=_[_0x5fa9('0x90')](_['keys'](_0x3d8b4f),[_0x5fa9('0x91'),_0x5fa9('0xc9')]);_0x1992f3=_[_0x5fa9('0x90')](_['keys'](_0x3d8b4f),[_0x5fa9('0x91'),_0x5fa9('0xc9'),'CompanyId',_0x5fa9('0xa5')]);if(_0x18d18d[_0x5fa9('0x5e')]['id']){delete _0x18d18d[_0x5fa9('0x5e')]['id'];}if(_[_0x5fa9('0x7e')](_0x18d18d[_0x5fa9('0x5e')][_0x5fa9('0x92')])){throw _0x104450[_0x5fa9('0x2c')](0x1f4)[_0x5fa9('0x3c')](new db[(_0x5fa9('0x93'))]['ValidationError'](_0x5fa9('0x94')));}if(_[_0x5fa9('0x7e')](_0x18d18d['body'][_0x5fa9('0x5e')])||_0x18d18d[_0x5fa9('0x5e')][_0x5fa9('0x5e')]===''){throw _0x104450[_0x5fa9('0x2c')](0x1f4)['send'](new db[(_0x5fa9('0x93'))][(_0x5fa9('0x8e'))](_0x5fa9('0x95')));}if(_[_0x5fa9('0x7e')](_0x18d18d['body']['mapKeyOffline'])){throw _0x104450[_0x5fa9('0x2c')](0x1f4)[_0x5fa9('0x3c')](new db[(_0x5fa9('0x93'))][(_0x5fa9('0x8e'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1992f3));}if(!_[_0x5fa9('0x98')](_0x1992f3,_0x18d18d[_0x5fa9('0x5e')][_0x5fa9('0xca')])){throw _0x104450[_0x5fa9('0x2c')](0x1f4)['send'](new db['Sequelize'][(_0x5fa9('0x8e'))](_0x5fa9('0xcb')+_0x1992f3));}_0x181b47[_0x18d18d[_0x5fa9('0x5e')][_0x5fa9('0xca')]]=_0x18d18d[_0x5fa9('0x5e')][_0x5fa9('0x92')];})[_0x5fa9('0x21')](function(){return db[_0x5fa9('0x40')]['find']({'where':{'id':_0x18d18d[_0x5fa9('0x66')]['id']},'include':[{'model':db[_0x5fa9('0x9a')],'as':'List'}]});})[_0x5fa9('0x21')](handleEntityNotFound(_0x104450,null))[_0x5fa9('0x21')](function(_0x500ce0){if(_0x500ce0&&_0x500ce0[_0x5fa9('0x9b')]){_0x1c6802=_0x500ce0;var _0x212918=_['defaults'](_0x18d18d[_0x5fa9('0x5e')],{'firstName':_0x18d18d[_0x5fa9('0x5e')][_0x5fa9('0x92')],'phone':_0x18d18d[_0x5fa9('0x5e')]['from'],'ListId':_0x500ce0['ListId']});_0x212918[_0x18d18d[_0x5fa9('0x5e')][_0x5fa9('0xca')]]=_0x18d18d[_0x5fa9('0x5e')][_0x5fa9('0x92')];return db[_0x5fa9('0x9c')][_0x5fa9('0xcc')]({'where':_0x181b47,'defaults':_0x212918});}})[_0x5fa9('0xb8')](function(_0x1ed72f){if(_0x1ed72f){_0x85080b=_0x1ed72f;var _0x58a62a=fs[_0x5fa9('0xcd')](path[_0x5fa9('0x83')](config[_0x5fa9('0x7d')],_0x5fa9('0xce')),_0x5fa9('0xcf'));var _0x5798dc=ejs['render'](_0x58a62a,{'body':_[_0x5fa9('0xd0')](_0x18d18d[_0x5fa9('0x5e')][_0x5fa9('0x5e')]),'bodyTitle':_0x1c6802[_0x5fa9('0xd1')]});return db[_0x5fa9('0xd2')]['create']({'body':_0x5798dc,'ContactId':_0x1ed72f['id'],'ChatWebsiteId':_0x1c6802['id']});}})[_0x5fa9('0x21')](function(_0x56505b){if(_0x56505b){_0x408131=_0x56505b;return db[_0x5fa9('0xd3')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x5fa9('0xd4')],'as':_0x5fa9('0xd5'),'raw':!![]}]});}})[_0x5fa9('0x21')](function(_0x2816db){if(_0x2816db&&_0x2816db['Smtp']&&_0x1c6802['forwardOfflineAddress']){var _0x15b9b1={'tls':{'rejectUnauthorized':![]}};if(_0x2816db['Smtp'][_0x5fa9('0xd6')]){_0x15b9b1[_0x5fa9('0xd6')]=_0x2816db[_0x5fa9('0xd5')][_0x5fa9('0xd6')];}else{_0x15b9b1[_0x5fa9('0xd7')]=_0x2816db[_0x5fa9('0xd5')][_0x5fa9('0xd7')];_0x15b9b1['port']=_0x2816db[_0x5fa9('0xd5')]['port'];_0x15b9b1[_0x5fa9('0xd8')]=_0x2816db['Smtp']['secure'];}if(_0x2816db[_0x5fa9('0xd5')][_0x5fa9('0xd9')]){_0x15b9b1[_0x5fa9('0xda')]={'user':_0x2816db[_0x5fa9('0xd5')][_0x5fa9('0x61')],'pass':_0x2816db[_0x5fa9('0xd5')]['pass']};}return respondWithRpcPromise('SendMail',_0x5fa9('0xdb'),{'account':_0x15b9b1,'message':{'from':util[_0x5fa9('0xac')](_0x5fa9('0xdc'),_0x2816db['name'],_0x2816db['email']||_0x2816db[_0x5fa9('0xd5')][_0x5fa9('0x61')]),'to':_0x1c6802[_0x5fa9('0xdd')],'subject':_0x1c6802[_0x5fa9('0xde')],'text':_0x408131['body']}},client9003)[_0x5fa9('0x21')](function(){return _0x408131;})['catch'](function(_0x53c481){console[_0x5fa9('0x26')](_0x53c481);});}})['then'](function(){if(_0x408131){return _0x408131;}})['then'](respondWithResult(_0x104450,null))['catch'](handleError(_0x104450,null));};exports[_0x5fa9('0xdf')]=function(_0x465116,_0xd70c6a,_0x136b06){return db['ChatInteraction'][_0x5fa9('0x5c')]({'where':{'id':_0x465116[_0x5fa9('0x66')]['id']}})[_0x5fa9('0x21')](handleEntityNotFound(_0xd70c6a,null))[_0x5fa9('0x21')](function(_0xce6124){if(_0xce6124){return _0xce6124['addInteraction'](_0x465116[_0x5fa9('0x5e')]['ids'],_['omit'](_0x465116[_0x5fa9('0x5e')],[_0x5fa9('0x6e'),'id'])||{});}})[_0x5fa9('0x21')](respondWithResult(_0xd70c6a,null))[_0x5fa9('0x56')](handleError(_0xd70c6a,null));};exports['getInteractions']=function(_0x5d32f7,_0x586162,_0x694c0c){var _0x54c605={'raw':![],'where':{}};var _0x5c025a={};var _0x487829={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x5fa9('0x71')]({'where':{'id':_0x5d32f7[_0x5fa9('0x66')]['id']}})['then'](handleEntityNotFound(_0x586162,null))[_0x5fa9('0x21')](function(_0x2a639e){if(_0x2a639e){_0x5c025a[_0x5fa9('0x45')]=_[_0x5fa9('0x59')](db[_0x5fa9('0xb4')][_0x5fa9('0x41')]);_0x5c025a[_0x5fa9('0x46')]=_[_0x5fa9('0x59')](_0x5d32f7['query']);_0x5c025a[_0x5fa9('0x47')]=_['intersection'](_0x5c025a['model'],_0x5c025a[_0x5fa9('0x46')]);_0x54c605[_0x5fa9('0x4a')]=_['intersection'](_0x5c025a[_0x5fa9('0x45')],qs[_0x5fa9('0x49')](_0x5d32f7[_0x5fa9('0x46')][_0x5fa9('0x49')]));_0x54c605[_0x5fa9('0x4a')]=_0x54c605['attributes'][_0x5fa9('0x4b')]?_0x54c605[_0x5fa9('0x4a')]:_0x5c025a[_0x5fa9('0x45')];if(!_0x5d32f7['query'][_0x5fa9('0x4c')](_0x5fa9('0x6b'))){_0x54c605[_0x5fa9('0x30')]=qs['limit'](_0x5d32f7[_0x5fa9('0x46')][_0x5fa9('0x30')]);_0x54c605['offset']=qs['offset'](_0x5d32f7[_0x5fa9('0x46')][_0x5fa9('0x2f')]);}_0x54c605['order']=qs[_0x5fa9('0x4e')](_0x5d32f7[_0x5fa9('0x46')][_0x5fa9('0x4e')]);_0x54c605[_0x5fa9('0x51')]=qs[_0x5fa9('0x47')](_[_0x5fa9('0x4f')](_0x5d32f7[_0x5fa9('0x46')],_0x5c025a[_0x5fa9('0x47')]));_0x54c605[_0x5fa9('0x51')]['ChatWebsiteId']=_0x2a639e['id'];if(_0x5d32f7['query'][_0x5fa9('0x50')]){_0x54c605[_0x5fa9('0x51')]=_[_0x5fa9('0x52')](_0x54c605['where'],{'$or':_[_0x5fa9('0x3f')](_0x54c605['attributes'],function(_0x2a4a60){var _0x37b8df={};_0x37b8df[_0x2a4a60]={'$like':'%'+_0x5d32f7['query'][_0x5fa9('0x50')]+'%'};return _0x37b8df;})});}_0x54c605=_[_0x5fa9('0x52')]({},_0x54c605,_0x5d32f7['options']);return db[_0x5fa9('0xb4')][_0x5fa9('0x2e')]({'where':_0x54c605['where']})['then'](function(_0x451242){_0x487829[_0x5fa9('0x2e')]=_0x451242;if(_0x5d32f7[_0x5fa9('0x46')]['includeAll']){_0x54c605[_0x5fa9('0x5b')]=[{'model':db[_0x5fa9('0x9c')],'as':_0x5fa9('0xe0'),'required':![]},{'model':db['User'],'as':_0x5fa9('0xe1'),'attributes':['name',_0x5fa9('0xe2'),_0x5fa9('0xe3')],'required':![]},{'model':db[_0x5fa9('0xe4')],'as':_0x5fa9('0xe5'),'attributes':['id',_0x5fa9('0x3b'),_0x5fa9('0xe6')],'where':_0x5d32f7[_0x5fa9('0x46')][_0x5fa9('0xe7')]?{'id':_0x5d32f7[_0x5fa9('0x46')][_0x5fa9('0xe7')]}:undefined,'required':_0x5d32f7[_0x5fa9('0x46')][_0x5fa9('0xe7')]?!![]:![]}];}return db[_0x5fa9('0xb4')][_0x5fa9('0x55')](_0x54c605);})[_0x5fa9('0x21')](function(_0x3b1c96){_0x487829[_0x5fa9('0x6d')]=_0x3b1c96;return _0x487829;});}})[_0x5fa9('0x21')](respondWithFilteredResult(_0x586162,_0x54c605))[_0x5fa9('0x56')](handleError(_0x586162,null));};function iftimePromise(_0x37dd4c,_0x442eb0){return respondWithRpcPromise('Command','getSnippet',{'command':_0x442eb0['timezone']?util[_0x5fa9('0xac')](_0x5fa9('0xe8'),_0x37dd4c[_0x5fa9('0xe9')],_0x442eb0[_0x5fa9('0xea')]):util[_0x5fa9('0xac')](_0x5fa9('0xeb'),_0x37dd4c[_0x5fa9('0xe9')])},client9002)[_0x5fa9('0x21')](function(_0x3577b4){var _0x292496=_0x3577b4&&_0x3577b4[_0x5fa9('0xec')]('true')>=0x0?!![]:![];logger['info'](_0x5fa9('0xed'),_0x442eb0['id'],_0x37dd4c['id'],_0x37dd4c[_0x5fa9('0xe9')],_0x292496?'ONLINE':_0x5fa9('0xee'),_0x442eb0[_0x5fa9('0xea')]?_0x442eb0[_0x5fa9('0xea')]:_0x5fa9('0xef'));return _0x292496;})[_0x5fa9('0x56')](function(_0x19b5dd){logger['error'](_0x5fa9('0xed'),_0x442eb0['id'],_0x37dd4c['id'],_0x37dd4c[_0x5fa9('0xe9')],util[_0x5fa9('0xf0')](_0x19b5dd,{'showHidden':![],'depth':null}),_0x442eb0[_0x5fa9('0xea')]?_0x442eb0[_0x5fa9('0xea')]:_0x5fa9('0xef'));return![];});}exports[_0x5fa9('0xf1')]=function(_0x5af42c,_0x39e09d,_0x1ec4e4){var _0x4d1d52=0x0;var _0x3b8a79=0x0;var _0x1e68ac=![];var _0x7a85d0;var _0xf1b166;return db[_0x5fa9('0x40')][_0x5fa9('0x5c')]({'where':{'id':_0x5af42c[_0x5fa9('0x66')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x5fa9('0xf2')],'as':_0x5fa9('0xf3'),'attributes':['id',_0x5fa9('0xe9')],'raw':!![]}]}]})[_0x5fa9('0x21')](handleEntityNotFound(_0x39e09d,null))[_0x5fa9('0x21')](function(_0x374c47){if(_0x374c47){_0x7a85d0=_0x374c47;return _0x374c47['getProactiveActions']({'raw':!![]});}})[_0x5fa9('0x21')](function(_0x5820f3){if(_0x7a85d0){if(_0x5820f3){_0xf1b166=_0x5820f3;}}return require(_0x5fa9('0x16'))[_0x5fa9('0xf4')]();})[_0x5fa9('0x21')](function(_0x5a63ba){if(_0x5a63ba){_0x3b8a79=_0x5a63ba['virtual'];_0x1e68ac=_0x5a63ba[_0x5fa9('0xf5')];}})['then'](function(){return db[_0x5fa9('0xb4')][_0x5fa9('0x2e')]({'where':{'closed':![]}});})[_0x5fa9('0x21')](function(_0x467488){_0x4d1d52=_0x467488;if(_0x3b8a79&&_0x467488>_0x3b8a79){return db[_0x5fa9('0xf6')][_0x5fa9('0x71')]({'where':{'id':0x1}})[_0x5fa9('0x21')](function(_0x3d0e8e){if(_0x3d0e8e){_0x3d0e8e[_0x5fa9('0xf7')](_0x5fa9('0xf8'));}});}})[_0x5fa9('0x21')](function(){if(_0x7a85d0[_0x5fa9('0xf2')]&&_0x7a85d0[_0x5fa9('0xf2')][_0x5fa9('0xf3')]){var _0x582a54=[];for(var _0x5be851=0x0;_0x5be851<_0x7a85d0['Interval']['Intervals'][_0x5fa9('0x4b')];_0x5be851++){var _0x2ddfbc=_0x7a85d0[_0x5fa9('0xf2')][_0x5fa9('0xf3')][_0x5be851][_0x5fa9('0x36')]({'plain':!![]});_0x582a54[_0x5fa9('0xbc')](iftimePromise(_0x2ddfbc,_0x7a85d0));}return BPromise[_0x5fa9('0xf9')](_0x582a54)['then'](function(_0x52f6dc){return _[_0x5fa9('0xfa')](_0x52f6dc);});}else{return!![];}})[_0x5fa9('0x21')](function(_0x2f9561){var _0x4129a8=fs['readFileSync'](path[_0x5fa9('0x83')](config['root'],_0x5fa9('0xfb')),_0x5fa9('0xcf'));var _0x45199b={'remote':_0x7a85d0[_0x5fa9('0xfc')],'query':querystring[_0x5fa9('0x25')](_['merge'](_0x7a85d0[_0x5fa9('0x36')]({'plain':!![]}),{'customerIp':_0x5af42c[_0x5fa9('0x8b')][_0x5fa9('0xa7')]||_0x5af42c[_0x5fa9('0x8b')][_0x5fa9('0xfd')]||_0x5af42c[_0x5fa9('0xfe')][_0x5fa9('0xff')]||_0x5af42c['ip'],'referer':_0x5af42c[_0x5fa9('0x8b')]['referer'],'openedInteractions':_0x4d1d52,'maxInteractions':_0x3b8a79,'virtual':_0x1e68ac[_0x5fa9('0x100')],'online':_0x2f9561,'custom':_0x1e68ac}))['replace'](/'/g,'\x5c\x27')};_0x39e09d['send'](ejs[_0x5fa9('0x101')](Mustache['render'](_0x4129a8,_0x45199b),{'proactiveActions':_0xf1b166,'alignment':_0x7a85d0[_0x5fa9('0x102')],'verticalAlignment':_0x7a85d0[_0x5fa9('0x103')],'div_color':_0x7a85d0['color'],'text_color':_0x7a85d0[_0x5fa9('0x104')]}));})[_0x5fa9('0x56')](handleError(_0x39e09d,null));};exports[_0x5fa9('0x105')]=function(_0x13ab2e,_0x8d7049,_0x217ec1){return db['ChatWebsite'][_0x5fa9('0x71')]({'where':{'id':_0x13ab2e[_0x5fa9('0x66')]['id']}})[_0x5fa9('0x21')](handleEntityNotFound(_0x8d7049,null))[_0x5fa9('0x21')](function(_0x21d9b0){if(_0x21d9b0){return db[_0x5fa9('0x106')][_0x5fa9('0x107')](function(_0x257adf){return db['ChatApplication'][_0x5fa9('0x39')]({'where':{'ChatWebsiteId':_0x13ab2e[_0x5fa9('0x66')]['id']},'transaction':_0x257adf})['then'](function(_0x402eb0){var _0x125a40=_[_0x5fa9('0x3f')](_0x13ab2e[_0x5fa9('0x5e')],function(_0x244242){_0x244242[_0x5fa9('0x6c')]=_0x13ab2e[_0x5fa9('0x66')]['id'];return _0x244242;});return db['ChatApplication'][_0x5fa9('0x108')](_0x125a40,{'transaction':_0x257adf});});})[_0x5fa9('0x21')](function(){return db['ChatApplication'][_0x5fa9('0x109')]({'where':{'ChatWebsiteId':_0x13ab2e['params']['id']},'order':_0x5fa9('0xa2')});});}})[_0x5fa9('0x21')](respondWithResult(_0x8d7049,null))[_0x5fa9('0x56')](handleError(_0x8d7049,null));};exports[_0x5fa9('0x10a')]=function(_0x41670a,_0x371e70,_0x5256d4){var _0x7c9457={};var _0x49a570={};var _0x884f40;var _0x364ce5;return db['ChatWebsite'][_0x5fa9('0x71')]({'where':{'id':_0x41670a[_0x5fa9('0x66')]['id']}})[_0x5fa9('0x21')](handleEntityNotFound(_0x371e70,null))[_0x5fa9('0x21')](function(_0x936e6c){if(_0x936e6c){_0x884f40=_0x936e6c;_0x49a570[_0x5fa9('0x45')]=_[_0x5fa9('0x59')](db['ChatApplication'][_0x5fa9('0x41')]);_0x49a570['query']=_[_0x5fa9('0x59')](_0x41670a[_0x5fa9('0x46')]);_0x49a570[_0x5fa9('0x47')]=_['intersection'](_0x49a570[_0x5fa9('0x45')],_0x49a570[_0x5fa9('0x46')]);_0x7c9457[_0x5fa9('0x4a')]=_[_0x5fa9('0x48')](_0x49a570[_0x5fa9('0x45')],qs['fields'](_0x41670a[_0x5fa9('0x46')][_0x5fa9('0x49')]));_0x7c9457['attributes']=_0x7c9457['attributes'][_0x5fa9('0x4b')]?_0x7c9457[_0x5fa9('0x4a')]:_0x49a570[_0x5fa9('0x45')];_0x7c9457['order']=qs[_0x5fa9('0x4e')](_0x41670a[_0x5fa9('0x46')][_0x5fa9('0x4e')]);_0x7c9457[_0x5fa9('0x51')]=qs[_0x5fa9('0x47')](_['pick'](_0x41670a[_0x5fa9('0x46')],_0x49a570[_0x5fa9('0x47')]));if(_0x41670a['query'][_0x5fa9('0x50')]){_0x7c9457[_0x5fa9('0x51')]=_[_0x5fa9('0x52')](_0x7c9457[_0x5fa9('0x51')],{'$or':_[_0x5fa9('0x3f')](_0x7c9457[_0x5fa9('0x4a')],function(_0x453209){var _0x2241df={};_0x2241df[_0x453209]={'$like':'%'+_0x41670a[_0x5fa9('0x46')][_0x5fa9('0x50')]+'%'};return _0x2241df;})});}_0x7c9457=_[_0x5fa9('0x52')]({},_0x7c9457,_0x41670a[_0x5fa9('0x53')]);return _0x884f40[_0x5fa9('0x10a')](_0x7c9457);}})[_0x5fa9('0x21')](function(_0x2a230c){if(_0x2a230c){_0x364ce5=_0x2a230c[_0x5fa9('0x4b')];if(!_0x41670a[_0x5fa9('0x46')][_0x5fa9('0x4c')](_0x5fa9('0x6b'))){_0x7c9457[_0x5fa9('0x30')]=qs['limit'](_0x41670a[_0x5fa9('0x46')][_0x5fa9('0x30')]);_0x7c9457[_0x5fa9('0x2f')]=qs[_0x5fa9('0x2f')](_0x41670a[_0x5fa9('0x46')][_0x5fa9('0x2f')]);}return _0x884f40['getApplications'](_0x7c9457);}})[_0x5fa9('0x21')](function(_0x251767){if(_0x251767){return _0x251767?{'count':_0x364ce5,'rows':_0x251767}:null;}})[_0x5fa9('0x21')](respondWithResult(_0x371e70,null))[_0x5fa9('0x56')](handleError(_0x371e70,null));};exports[_0x5fa9('0x10b')]=function(_0x118f48,_0xaafe77,_0x4fb479){return db['chatProactiveAction']['find']({'where':{'id':_0x118f48[_0x5fa9('0x66')]['id']}})['then'](handleEntityNotFound(_0xaafe77,null))['then'](function(_0xab8a76){if(_0xab8a76){return _0xab8a76[_0x5fa9('0x10b')](_0x118f48['body'][_0x5fa9('0x6e')],_['omit'](_0x118f48['body'],[_0x5fa9('0x6e'),'id'])||{});}})[_0x5fa9('0x21')](respondWithResult(_0xaafe77,null))[_0x5fa9('0x56')](handleError(_0xaafe77,null));};exports['getProactiveActions']=function(_0x60b37c,_0x5b05f1,_0x27982d){var _0x560a42={};var _0x58409b={};var _0x1eac07;var _0x235c1b;return db[_0x5fa9('0x40')][_0x5fa9('0x71')]({'where':{'id':_0x60b37c[_0x5fa9('0x66')]['id']}})[_0x5fa9('0x21')](handleEntityNotFound(_0x5b05f1,null))[_0x5fa9('0x21')](function(_0x161e40){if(_0x161e40){_0x1eac07=_0x161e40;_0x58409b[_0x5fa9('0x45')]=_[_0x5fa9('0x59')](db['ChatProactiveAction'][_0x5fa9('0x41')]);_0x58409b[_0x5fa9('0x46')]=_[_0x5fa9('0x59')](_0x60b37c[_0x5fa9('0x46')]);_0x58409b[_0x5fa9('0x47')]=_[_0x5fa9('0x48')](_0x58409b[_0x5fa9('0x45')],_0x58409b[_0x5fa9('0x46')]);_0x560a42[_0x5fa9('0x4a')]=_[_0x5fa9('0x48')](_0x58409b[_0x5fa9('0x45')],qs['fields'](_0x60b37c['query'][_0x5fa9('0x49')]));_0x560a42[_0x5fa9('0x4a')]=_0x560a42[_0x5fa9('0x4a')][_0x5fa9('0x4b')]?_0x560a42['attributes']:_0x58409b[_0x5fa9('0x45')];_0x560a42[_0x5fa9('0x4d')]=qs['sort'](_0x60b37c[_0x5fa9('0x46')][_0x5fa9('0x4e')]);_0x560a42[_0x5fa9('0x51')]=qs[_0x5fa9('0x47')](_['pick'](_0x60b37c[_0x5fa9('0x46')],_0x58409b['filters']));if(_0x60b37c[_0x5fa9('0x46')][_0x5fa9('0x50')]){_0x560a42[_0x5fa9('0x51')]=_[_0x5fa9('0x52')](_0x560a42['where'],{'$or':_[_0x5fa9('0x3f')](_0x560a42[_0x5fa9('0x4a')],function(_0x19a43f){var _0x31e635={};_0x31e635[_0x19a43f]={'$like':'%'+_0x60b37c[_0x5fa9('0x46')][_0x5fa9('0x50')]+'%'};return _0x31e635;})});}_0x560a42=_[_0x5fa9('0x52')]({},_0x560a42,_0x60b37c[_0x5fa9('0x53')]);return _0x1eac07[_0x5fa9('0x10c')](_0x560a42);}})['then'](function(_0x508f81){if(_0x508f81){_0x235c1b=_0x508f81[_0x5fa9('0x4b')];if(!_0x60b37c[_0x5fa9('0x46')][_0x5fa9('0x4c')](_0x5fa9('0x6b'))){_0x560a42['limit']=qs[_0x5fa9('0x30')](_0x60b37c[_0x5fa9('0x46')][_0x5fa9('0x30')]);_0x560a42[_0x5fa9('0x2f')]=qs[_0x5fa9('0x2f')](_0x60b37c[_0x5fa9('0x46')]['offset']);}return _0x1eac07[_0x5fa9('0x10c')](_0x560a42);}})[_0x5fa9('0x21')](function(_0x11c204){if(_0x11c204){return _0x11c204?{'count':_0x235c1b,'rows':_0x11c204}:null;}})[_0x5fa9('0x21')](respondWithResult(_0x5b05f1,null))[_0x5fa9('0x56')](handleError(_0x5b05f1,null));};exports[_0x5fa9('0x10d')]=function(_0x14e08a,_0x3a0f2e,_0x20f89a){var _0x151803=_0x14e08a[_0x5fa9('0x46')][_0x5fa9('0x10e')]===_0x5fa9('0x10f')?_0x5fa9('0x110'):_0x5fa9('0x111');return db['ChatWebsite'][_0x5fa9('0x5c')]({'attributes':['id',_0x151803],'where':{'id':_0x14e08a[_0x5fa9('0x66')]['id']}})['then'](handleEntityNotFound(_0x3a0f2e,null))[_0x5fa9('0x21')](function(_0x35fa5a){if(_0x35fa5a){var _0x384e80=_0x35fa5a[_0x151803];var _0x2d174f=_0x384e80&&_0x384e80[_0x5fa9('0x112')]?_0x384e80[_0x5fa9('0x112')]:[];_0x3a0f2e['send']({'fromKey':_['isNil'](_0x384e80[_0x5fa9('0x113')])?undefined:_0x384e80[_0x5fa9('0x113')],'count':_0x2d174f['length'],'rows':_0x2d174f});}})[_0x5fa9('0x56')](handleError(_0x3a0f2e,null));};exports[_0x5fa9('0x114')]=function(_0xa61109,_0x224612,_0x148c6e){var _0x5a1e08={'raw':![],'where':{}};var _0x38757b={};var _0x279db3={'count':0x0,'rows':[]};return db[_0x5fa9('0x40')][_0x5fa9('0x71')]({'where':{'id':_0xa61109[_0x5fa9('0x66')]['id']}})[_0x5fa9('0x21')](handleEntityNotFound(_0x224612,null))[_0x5fa9('0x21')](function(_0x20c1a3){if(_0x20c1a3){_0x38757b[_0x5fa9('0x45')]=_[_0x5fa9('0x59')](db[_0x5fa9('0xd2')][_0x5fa9('0x41')]);_0x38757b[_0x5fa9('0x46')]=_[_0x5fa9('0x59')](_0xa61109[_0x5fa9('0x46')]);_0x38757b[_0x5fa9('0x47')]=_['intersection'](_0x38757b[_0x5fa9('0x45')],_0x38757b['query']);_0x5a1e08[_0x5fa9('0x4a')]=_['intersection'](_0x38757b['model'],qs[_0x5fa9('0x49')](_0xa61109['query'][_0x5fa9('0x49')]));_0x5a1e08[_0x5fa9('0x4a')]=_0x5a1e08[_0x5fa9('0x4a')][_0x5fa9('0x4b')]?_0x5a1e08[_0x5fa9('0x4a')]:_0x38757b[_0x5fa9('0x45')];if(!_0xa61109[_0x5fa9('0x46')][_0x5fa9('0x4c')]('nolimit')){_0x5a1e08[_0x5fa9('0x30')]=qs[_0x5fa9('0x30')](_0xa61109['query'][_0x5fa9('0x30')]);_0x5a1e08['offset']=qs['offset'](_0xa61109[_0x5fa9('0x46')][_0x5fa9('0x2f')]);}_0x5a1e08[_0x5fa9('0x4d')]=qs[_0x5fa9('0x4e')](_0xa61109['query'][_0x5fa9('0x4e')]);_0x5a1e08[_0x5fa9('0x51')]=qs['filters'](_[_0x5fa9('0x4f')](_0xa61109[_0x5fa9('0x46')],_0x38757b[_0x5fa9('0x47')]));_0x5a1e08[_0x5fa9('0x51')][_0x5fa9('0x6c')]=_0x20c1a3['id'];if(_0xa61109[_0x5fa9('0x46')][_0x5fa9('0x50')]){_0x5a1e08[_0x5fa9('0x51')]=_[_0x5fa9('0x52')](_0x5a1e08[_0x5fa9('0x51')],{'$or':_[_0x5fa9('0x3f')](_0x5a1e08[_0x5fa9('0x4a')],function(_0x306a6f){var _0x3d70c0={};_0x3d70c0[_0x306a6f]={'$like':'%'+_0xa61109[_0x5fa9('0x46')]['filter']+'%'};return _0x3d70c0;})});}_0x5a1e08=_[_0x5fa9('0x52')]({},_0x5a1e08,_0xa61109[_0x5fa9('0x53')]);return db[_0x5fa9('0xd2')]['count']({'where':_0x5a1e08[_0x5fa9('0x51')]})['then'](function(_0x5c96fc){_0x279db3[_0x5fa9('0x2e')]=_0x5c96fc;if(_0xa61109['query']['includeAll']){_0x5a1e08[_0x5fa9('0x5b')]=[{'all':!![]}];}else{_0x5a1e08[_0x5fa9('0x5b')]=[{'model':db['CmContact'],'as':_0x5fa9('0xe0'),'required':![]}];}return db[_0x5fa9('0xd2')][_0x5fa9('0x55')](_0x5a1e08);})['then'](function(_0x58826a){_0x279db3[_0x5fa9('0x6d')]=_0x58826a;return _0x279db3;});}})[_0x5fa9('0x21')](respondWithFilteredResult(_0x224612,_0x5a1e08))[_0x5fa9('0x56')](handleError(_0x224612,null));};exports['addAgents']=function(_0x5c63b9,_0x108793,_0x392028){return db['ChatWebsite']['find']({'where':{'id':_0x5c63b9[_0x5fa9('0x66')]['id']}})[_0x5fa9('0x21')](handleEntityNotFound(_0x108793,null))['then'](function(_0x24dcbc){if(_0x24dcbc){return _0x24dcbc[_0x5fa9('0x115')](_0x5c63b9[_0x5fa9('0x5e')][_0x5fa9('0x6e')],_[_0x5fa9('0x116')](_0x5c63b9[_0x5fa9('0x5e')],['ids','id'])||{})[_0x5fa9('0xb8')](function(_0x1c4fd9){for(var _0x2ba671=0x0;_0x2ba671<_0x5c63b9[_0x5fa9('0x5e')]['ids'][_0x5fa9('0x4b')];_0x2ba671+=0x1){socket['emit'](_0x5fa9('0x117'),{'UserId':_0x5c63b9[_0x5fa9('0x5e')][_0x5fa9('0x6e')][_0x2ba671],'ChatWebsiteId':_0x5c63b9[_0x5fa9('0x66')]['id']});}return _0x1c4fd9;});}})[_0x5fa9('0x21')](respondWithResult(_0x108793,null))[_0x5fa9('0x56')](handleError(_0x108793,null));};exports[_0x5fa9('0x118')]=function(_0x2a7f1e,_0x44dca0,_0x452431){return db['ChatWebsite'][_0x5fa9('0x5c')]({'where':{'id':_0x2a7f1e[_0x5fa9('0x66')]['id']}})['then'](handleEntityNotFound(_0x44dca0,null))['then'](function(_0x97d1ff){if(_0x97d1ff){return _0x97d1ff[_0x5fa9('0x118')](_0x2a7f1e[_0x5fa9('0x46')]['ids'])[_0x5fa9('0x21')](function(){if(_[_0x5fa9('0x119')](_0x2a7f1e[_0x5fa9('0x46')][_0x5fa9('0x6e')])){for(var _0x7466f6=0x0;_0x7466f6<_0x2a7f1e[_0x5fa9('0x46')][_0x5fa9('0x6e')][_0x5fa9('0x4b')];_0x7466f6+=0x1){socket[_0x5fa9('0x11a')](_0x5fa9('0x11b'),{'UserId':Number(_0x2a7f1e[_0x5fa9('0x46')][_0x5fa9('0x6e')][_0x7466f6]),'ChatWebsiteId':Number(_0x2a7f1e['params']['id'])});}}else{socket[_0x5fa9('0x11a')]('userChatWebsite:remove',{'UserId':Number(_0x2a7f1e[_0x5fa9('0x46')][_0x5fa9('0x6e')]),'ChatWebsiteId':Number(_0x2a7f1e[_0x5fa9('0x66')]['id'])});}});}})['then'](respondWithStatusCode(_0x44dca0,null))['catch'](handleError(_0x44dca0,null));};exports[_0x5fa9('0x11c')]=function(_0x310078,_0x13da43,_0x1bedbc){var _0x93f554={};var _0x4510ac={};var _0x5906b2;var _0x1775a8;return db[_0x5fa9('0x40')][_0x5fa9('0x71')]({'where':{'id':_0x310078[_0x5fa9('0x66')]['id']}})[_0x5fa9('0x21')](handleEntityNotFound(_0x13da43,null))[_0x5fa9('0x21')](function(_0x545780){if(_0x545780){_0x5906b2=_0x545780;_0x4510ac[_0x5fa9('0x45')]=_[_0x5fa9('0x59')](db[_0x5fa9('0xc2')][_0x5fa9('0x41')]);_0x4510ac[_0x5fa9('0x46')]=_[_0x5fa9('0x59')](_0x310078['query']);_0x4510ac[_0x5fa9('0x47')]=_[_0x5fa9('0x48')](_0x4510ac['model'],_0x4510ac[_0x5fa9('0x46')]);_0x93f554[_0x5fa9('0x4a')]=_[_0x5fa9('0x48')](_0x4510ac['model'],qs['fields'](_0x310078['query']['fields']));_0x93f554[_0x5fa9('0x4a')]=_0x93f554[_0x5fa9('0x4a')][_0x5fa9('0x4b')]?_0x93f554[_0x5fa9('0x4a')]:_0x4510ac[_0x5fa9('0x45')];_0x93f554[_0x5fa9('0x4d')]=qs['sort'](_0x310078[_0x5fa9('0x46')][_0x5fa9('0x4e')]);_0x93f554['where']=qs[_0x5fa9('0x47')](_[_0x5fa9('0x4f')](_0x310078[_0x5fa9('0x46')],_0x4510ac['filters']));if(_0x310078[_0x5fa9('0x46')][_0x5fa9('0x50')]){_0x93f554[_0x5fa9('0x51')]=_['merge'](_0x93f554['where'],{'$or':_['map'](_0x93f554[_0x5fa9('0x4a')],function(_0x2e9349){var _0x586d9e={};_0x586d9e[_0x2e9349]={'$like':'%'+_0x310078[_0x5fa9('0x46')][_0x5fa9('0x50')]+'%'};return _0x586d9e;})});}_0x93f554=_[_0x5fa9('0x52')]({},_0x93f554,_0x310078[_0x5fa9('0x53')]);return _0x5906b2[_0x5fa9('0x11c')](_0x93f554);}})['then'](function(_0x2e145c){if(_0x2e145c){_0x1775a8=_0x2e145c[_0x5fa9('0x4b')];if(!_0x310078[_0x5fa9('0x46')][_0x5fa9('0x4c')]('nolimit')){_0x93f554[_0x5fa9('0x30')]=qs[_0x5fa9('0x30')](_0x310078[_0x5fa9('0x46')]['limit']);_0x93f554['offset']=qs['offset'](_0x310078['query']['offset']);}return _0x5906b2[_0x5fa9('0x11c')](_0x93f554);}})[_0x5fa9('0x21')](function(_0xac5d35){if(_0xac5d35){return _0xac5d35?{'count':_0x1775a8,'rows':_0xac5d35}:null;}})['then'](respondWithResult(_0x13da43,null))[_0x5fa9('0x56')](handleError(_0x13da43,null));}; \ No newline at end of file +var _0xb6ba=['MailServerOut','Smtp','service','host','port','secure','authentication','auth','SendMail','sendMail','forwardOfflineAddress','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','getProactiveActions','virtual','increment','chatLicenseExceeded','Intervals','all','server/files/chat/iframe.js','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','addApplications','sequelize','bulkCreate','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','end','json','offset','set','Content-Range','reject','update','destroy','get','UserProfileResource','name','send','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','limit','order','sort','filter','merge','where','count','includeAll','include','findAll','show','params','filtears','intersection','options','create','body','role','user','ChatWebsites','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','pick','rows','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','sitepic','filename','addAvatar','agentAvatar','file','customerAvatar','addSystemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','getLicense','custom','server/files/images/logos/','join','download','isNil','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','systemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','ChatApplication','Applications','List','account','list','applications','orderBy','priority','asc','defaults','contact','cf-connecting-ip','x-forwarded-for','first','split','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','firstName','lastName','messageId','created','autoclose','push','close','unmanaged','ChatMessage','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','offline','updatedAt','CompanyId','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount'];(function(_0x81e39d,_0x4c3934){var _0x548fbb=function(_0x1adda5){while(--_0x1adda5){_0x81e39d['push'](_0x81e39d['shift']());}};_0x548fbb(++_0x4c3934);}(_0xb6ba,0x166));var _0xab6b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb6ba[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0xab6b('0x0'));var emlformat=require(_0xab6b('0x1'));var rimraf=require(_0xab6b('0x2'));var zipdir=require(_0xab6b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab6b('0x4'));var moment=require(_0xab6b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xab6b('0x6'));var util=require(_0xab6b('0x7'));var path=require('path');var sox=require(_0xab6b('0x8'));var csv=require('to-csv');var ejs=require(_0xab6b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xab6b('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xab6b('0xb'));var toCsv=require(_0xab6b('0xc'));var querystring=require(_0xab6b('0xd'));var Papa=require(_0xab6b('0xe'));var Redis=require(_0xab6b('0xf'));var authService=require(_0xab6b('0x10'));var qs=require(_0xab6b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab6b('0x12'));var logger=require(_0xab6b('0x13'))('api');var utils=require(_0xab6b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xab6b('0x15'));var db=require(_0xab6b('0x16'))['db'];config[_0xab6b('0x17')]=_['defaults'](config['redis'],{'host':_0xab6b('0x18'),'port':0x18eb});var socket=require(_0xab6b('0x19'))(new Redis(config[_0xab6b('0x17')]));require(_0xab6b('0x1a'))[_0xab6b('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0xab6b('0x1c')]({'port':0x232a});var client9003=jayson[_0xab6b('0x1d')][_0xab6b('0x1c')]({'port':0x232b});function respondWithRpcPromise(_0x4b6b10,_0x22e928,_0x5e0224,_0x14a744){return new BPromise(function(_0x1e2138,_0x3da452){var _0x5aa6b3=_0x14a744||client;return _0x5aa6b3[_0xab6b('0x1e')](_0x4b6b10,_0x5e0224)[_0xab6b('0x1f')](function(_0x30368d){logger[_0xab6b('0x20')](_0xab6b('0x21'),_0x22e928,_0xab6b('0x22'));logger[_0xab6b('0x23')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x22e928,_0xab6b('0x22'),JSON[_0xab6b('0x24')](_0x30368d));if(_0x30368d[_0xab6b('0x25')]){if(_0x30368d[_0xab6b('0x25')][_0xab6b('0x26')]===0x1f4){logger[_0xab6b('0x25')](_0xab6b('0x21'),_0x22e928,_0x30368d[_0xab6b('0x25')]['message']);return _0x3da452(_0x30368d[_0xab6b('0x25')][_0xab6b('0x27')]);}logger['error'](_0xab6b('0x21'),_0x22e928,_0x30368d[_0xab6b('0x25')][_0xab6b('0x27')]);return _0x1e2138(_0x30368d[_0xab6b('0x25')]['message']);}else{logger['info'](_0xab6b('0x21'),_0x22e928,'request\x20sent');_0x1e2138(_0x30368d['result']['message']);}})[_0xab6b('0x28')](function(_0x2ae5e2){logger['error'](_0xab6b('0x21'),_0x22e928,_0x2ae5e2);_0x3da452(_0x2ae5e2);});});}function respondWithStatusCode(_0x27f2f5,_0x2b0048){_0x2b0048=_0x2b0048||0xcc;return function(_0x231643){if(_0x231643){return _0x27f2f5['sendStatus'](_0x2b0048);}return _0x27f2f5[_0xab6b('0x29')](_0x2b0048)[_0xab6b('0x2a')]();};}function respondWithResult(_0x2bd4e7,_0x135ea0){_0x135ea0=_0x135ea0||0xc8;return function(_0x2f3597){if(_0x2f3597){return _0x2bd4e7['status'](_0x135ea0)[_0xab6b('0x2b')](_0x2f3597);}};}function respondWithFilteredResult(_0x35eb73,_0x14826a){return function(_0x138cd4){if(_0x138cd4){var _0x413be1=_0x138cd4['count'],_0x2d3f53=_0x14826a[_0xab6b('0x2c')],_0x400699=_0x14826a[_0xab6b('0x2c')]+_0x14826a['limit'],_0x37c4ee;if(_0x400699>=_0x413be1){_0x400699=_0x413be1;_0x37c4ee=0xc8;}else{_0x37c4ee=0xce;}_0x35eb73['status'](_0x37c4ee);return _0x35eb73[_0xab6b('0x2d')](_0xab6b('0x2e'),_0x2d3f53+'-'+_0x400699+'/'+_0x413be1)[_0xab6b('0x2b')](_0x138cd4);}return null;};}function patchUpdates(_0x5ecf8){return function(_0x1bfb30){try{jsonpatch['apply'](_0x1bfb30,_0x5ecf8,!![]);}catch(_0x14abb1){return BPromise[_0xab6b('0x2f')](_0x14abb1);}return _0x1bfb30['save']();};}function saveUpdates(_0x3df26c,_0x255b5e){return function(_0x68e494){if(_0x68e494){return _0x68e494[_0xab6b('0x30')](_0x3df26c)[_0xab6b('0x1f')](function(_0x4bd45b){return _0x4bd45b;});}return null;};}function removeEntity(_0x186a8c,_0x22ea96){return function(_0x200131){if(_0x200131){return _0x200131[_0xab6b('0x31')]()['then'](function(){var _0x12c888=_0x200131[_0xab6b('0x32')]({'plain':!![]});var _0x5536a9='ChatWebsites';return db[_0xab6b('0x33')]['destroy']({'where':{'type':_0x5536a9,'resourceId':_0x12c888['id']}})[_0xab6b('0x1f')](function(){return _0x200131;});})[_0xab6b('0x1f')](function(){_0x186a8c[_0xab6b('0x29')](0xcc)[_0xab6b('0x2a')]();});}};}function handleEntityNotFound(_0x10b9e0,_0x17b89f){return function(_0x1d1066){if(!_0x1d1066){_0x10b9e0['sendStatus'](0x194);}return _0x1d1066;};}function handleError(_0x2b37bf,_0x3953d6){_0x3953d6=_0x3953d6||0x1f4;return function(_0x38ff9d){logger[_0xab6b('0x25')](_0x38ff9d['stack']);if(_0x38ff9d[_0xab6b('0x34')]){delete _0x38ff9d[_0xab6b('0x34')];}_0x2b37bf[_0xab6b('0x29')](_0x3953d6)[_0xab6b('0x35')](_0x38ff9d);};}exports[_0xab6b('0x36')]=function(_0x553525,_0x21c61){var _0x4d2895={'include':[{'model':db['Pause'],'as':_0xab6b('0x37')}]},_0x4b0f4f={},_0x26bafc={'count':0x0,'rows':[]};var _0x39727f=_[_0xab6b('0x38')](db[_0xab6b('0x39')][_0xab6b('0x3a')],function(_0x58c43c){return{'name':_0x58c43c[_0xab6b('0x3b')],'type':_0x58c43c[_0xab6b('0x3c')][_0xab6b('0x3d')]};});_0x4b0f4f[_0xab6b('0x3e')]=_[_0xab6b('0x38')](_0x39727f,_0xab6b('0x34'));_0x4b0f4f[_0xab6b('0x3f')]=_[_0xab6b('0x40')](_0x553525[_0xab6b('0x3f')]);_0x4b0f4f[_0xab6b('0x41')]=_['intersection'](_0x4b0f4f['model'],_0x4b0f4f['query']);_0x4d2895[_0xab6b('0x42')]=_['intersection'](_0x4b0f4f[_0xab6b('0x3e')],qs['fields'](_0x553525['query'][_0xab6b('0x43')]));_0x4d2895[_0xab6b('0x42')]=_0x4d2895[_0xab6b('0x42')][_0xab6b('0x44')]?_0x4d2895[_0xab6b('0x42')]:_0x4b0f4f[_0xab6b('0x3e')];if(!_0x553525['query']['hasOwnProperty'](_0xab6b('0x45'))){_0x4d2895[_0xab6b('0x46')]=qs[_0xab6b('0x46')](_0x553525['query'][_0xab6b('0x46')]);_0x4d2895[_0xab6b('0x2c')]=qs[_0xab6b('0x2c')](_0x553525['query'][_0xab6b('0x2c')]);}_0x4d2895[_0xab6b('0x47')]=qs['sort'](_0x553525[_0xab6b('0x3f')][_0xab6b('0x48')]);_0x4d2895['where']=qs[_0xab6b('0x41')](_['pick'](_0x553525[_0xab6b('0x3f')],_0x4b0f4f[_0xab6b('0x41')]),_0x39727f);if(_0x553525[_0xab6b('0x3f')][_0xab6b('0x49')]){_0x4d2895['where']=_[_0xab6b('0x4a')](_0x4d2895['where'],{'$or':_[_0xab6b('0x38')](_0x39727f,function(_0xe918f9){if(_0xe918f9['type']!=='VIRTUAL'){var _0x3a26fe={};_0x3a26fe[_0xe918f9[_0xab6b('0x34')]]={'$like':'%'+_0x553525[_0xab6b('0x3f')][_0xab6b('0x49')]+'%'};return _0x3a26fe;}})});}_0x4d2895=_['merge']({},_0x4d2895,_0x553525['options']);var _0x14ff81={'where':_0x4d2895[_0xab6b('0x4b')]};return db[_0xab6b('0x39')][_0xab6b('0x4c')](_0x14ff81)[_0xab6b('0x1f')](function(_0x215f2b){_0x26bafc[_0xab6b('0x4c')]=_0x215f2b;if(_0x553525[_0xab6b('0x3f')][_0xab6b('0x4d')]){_0x4d2895[_0xab6b('0x4e')]=[{'all':!![]}];}return db[_0xab6b('0x39')][_0xab6b('0x4f')](_0x4d2895);})['then'](function(_0x4f99f7){_0x26bafc['rows']=_0x4f99f7;return _0x26bafc;})[_0xab6b('0x1f')](respondWithFilteredResult(_0x21c61,_0x4d2895))[_0xab6b('0x28')](handleError(_0x21c61,null));};exports[_0xab6b('0x50')]=function(_0x30e27d,_0x533ae2){var _0x485cb3={'raw':![],'where':{'id':_0x30e27d[_0xab6b('0x51')]['id']},'include':[{'model':db['Pause'],'as':_0xab6b('0x37')}]},_0x320418={};_0x320418['model']=_[_0xab6b('0x40')](db[_0xab6b('0x39')][_0xab6b('0x3a')]);_0x320418['query']=_[_0xab6b('0x40')](_0x30e27d[_0xab6b('0x3f')]);_0x320418[_0xab6b('0x52')]=_['intersection'](_0x320418['model'],_0x320418[_0xab6b('0x3f')]);_0x485cb3[_0xab6b('0x42')]=_[_0xab6b('0x53')](_0x320418[_0xab6b('0x3e')],qs[_0xab6b('0x43')](_0x30e27d[_0xab6b('0x3f')][_0xab6b('0x43')]));_0x485cb3[_0xab6b('0x42')]=_0x485cb3[_0xab6b('0x42')]['length']?_0x485cb3['attributes']:_0x320418[_0xab6b('0x3e')];if(_0x30e27d[_0xab6b('0x3f')][_0xab6b('0x4d')]){_0x485cb3[_0xab6b('0x4e')]=[{'all':!![]}];}_0x485cb3=_[_0xab6b('0x4a')]({},_0x485cb3,_0x30e27d[_0xab6b('0x54')]);return db[_0xab6b('0x39')]['find'](_0x485cb3)[_0xab6b('0x1f')](handleEntityNotFound(_0x533ae2,null))['then'](respondWithResult(_0x533ae2,null))[_0xab6b('0x28')](handleError(_0x533ae2,null));};exports[_0xab6b('0x55')]=function(_0x4c4d82,_0x58d894){return db[_0xab6b('0x39')]['create'](_0x4c4d82[_0xab6b('0x56')],{})[_0xab6b('0x1f')](function(_0x4b5e90){var _0xb3e934=_0x4c4d82['user']['get']({'plain':!![]});if(!_0xb3e934)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb3e934[_0xab6b('0x57')]===_0xab6b('0x58')){var _0x95fa04=_0x4b5e90['get']({'plain':!![]});var _0x2473fc=_0xab6b('0x59');return db[_0xab6b('0x5a')][_0xab6b('0x5b')]({'where':{'name':_0x2473fc,'userProfileId':_0xb3e934['userProfileId']},'raw':!![]})['then'](function(_0x3e7865){if(_0x3e7865&&_0x3e7865[_0xab6b('0x5c')]===0x0){return db['UserProfileResource']['create']({'name':_0x95fa04[_0xab6b('0x34')],'resourceId':_0x95fa04['id'],'type':_0x3e7865['name'],'sectionId':_0x3e7865['id']},{})[_0xab6b('0x1f')](function(){return _0x4b5e90;});}else{return _0x4b5e90;}})[_0xab6b('0x28')](function(_0x48da4c){logger[_0xab6b('0x25')](_0xab6b('0x5d'),_0x48da4c);throw _0x48da4c;});}return _0x4b5e90;})[_0xab6b('0x1f')](respondWithResult(_0x58d894,0xc9))[_0xab6b('0x28')](handleError(_0x58d894,null));};exports[_0xab6b('0x30')]=function(_0x1d25c3,_0x19fb6a){if(_0x1d25c3['body']['id']){delete _0x1d25c3[_0xab6b('0x56')]['id'];}return db[_0xab6b('0x39')][_0xab6b('0x5b')]({'where':{'id':_0x1d25c3[_0xab6b('0x51')]['id']},'include':[{'model':db[_0xab6b('0x5e')],'as':_0xab6b('0x37')}]})[_0xab6b('0x1f')](handleEntityNotFound(_0x19fb6a,null))[_0xab6b('0x1f')](saveUpdates(_0x1d25c3['body'],null))[_0xab6b('0x1f')](respondWithResult(_0x19fb6a,null))[_0xab6b('0x28')](handleError(_0x19fb6a,null));};exports[_0xab6b('0x31')]=function(_0x10f248,_0x4b968d){return db['ChatWebsite'][_0xab6b('0x5b')]({'where':{'id':_0x10f248[_0xab6b('0x51')]['id']}})[_0xab6b('0x1f')](handleEntityNotFound(_0x4b968d,null))['then'](removeEntity(_0x4b968d,null))[_0xab6b('0x28')](handleError(_0x4b968d,null));};exports[_0xab6b('0x5f')]=function(_0x4d1e84,_0x4d3f7b){return db['ChatWebsite'][_0xab6b('0x5f')]()['then'](respondWithResult(_0x4d3f7b,null))[_0xab6b('0x28')](handleError(_0x4d3f7b,null));};exports[_0xab6b('0x60')]=function(_0x4fc7dd,_0x334c8b,_0x42edb6){if(_0x4fc7dd[_0xab6b('0x56')]['id']){delete _0x4fc7dd[_0xab6b('0x56')]['id'];}return db['ChatWebsite'][_0xab6b('0x5b')]({'where':{'id':_0x4fc7dd[_0xab6b('0x51')]['id']}})['then'](handleEntityNotFound(_0x334c8b,null))['then'](function(_0x49a294){if(_0x49a294){_0x4fc7dd['body'][_0xab6b('0x61')]=_0x49a294['id'];return db[_0xab6b('0x62')][_0xab6b('0x55')](_0x4fc7dd[_0xab6b('0x56')]);}})[_0xab6b('0x1f')](respondWithResult(_0x334c8b,null))['catch'](handleError(_0x334c8b,null));};exports[_0xab6b('0x63')]=function(_0x1e7788,_0x33f0ee,_0x22c17d){var _0x3799e6={'raw':![],'where':{}};var _0x1c9f39={};var _0x285b18={'count':0x0,'rows':[]};return db[_0xab6b('0x39')][_0xab6b('0x64')]({'where':{'id':_0x1e7788[_0xab6b('0x51')]['id']}})[_0xab6b('0x1f')](handleEntityNotFound(_0x33f0ee,null))[_0xab6b('0x1f')](function(_0x306b2e){if(_0x306b2e){_0x1c9f39[_0xab6b('0x3e')]=_[_0xab6b('0x40')](db[_0xab6b('0x62')]['rawAttributes']);_0x1c9f39[_0xab6b('0x3f')]=_[_0xab6b('0x40')](_0x1e7788['query']);_0x1c9f39[_0xab6b('0x41')]=_[_0xab6b('0x53')](_0x1c9f39[_0xab6b('0x3e')],_0x1c9f39[_0xab6b('0x3f')]);_0x3799e6['attributes']=_[_0xab6b('0x53')](_0x1c9f39['model'],qs['fields'](_0x1e7788[_0xab6b('0x3f')][_0xab6b('0x43')]));_0x3799e6[_0xab6b('0x42')]=_0x3799e6[_0xab6b('0x42')][_0xab6b('0x44')]?_0x3799e6[_0xab6b('0x42')]:_0x1c9f39[_0xab6b('0x3e')];if(!_0x1e7788[_0xab6b('0x3f')][_0xab6b('0x65')](_0xab6b('0x45'))){_0x3799e6[_0xab6b('0x46')]=qs[_0xab6b('0x46')](_0x1e7788['query'][_0xab6b('0x46')]);_0x3799e6[_0xab6b('0x2c')]=qs[_0xab6b('0x2c')](_0x1e7788['query'][_0xab6b('0x2c')]);}_0x3799e6[_0xab6b('0x47')]=qs[_0xab6b('0x48')](_0x1e7788[_0xab6b('0x3f')]['sort']);_0x3799e6[_0xab6b('0x4b')]=qs[_0xab6b('0x41')](_[_0xab6b('0x66')](_0x1e7788[_0xab6b('0x3f')],_0x1c9f39[_0xab6b('0x41')]));_0x3799e6['where'][_0xab6b('0x61')]=_0x306b2e['id'];if(_0x1e7788[_0xab6b('0x3f')][_0xab6b('0x49')]){_0x3799e6['where']=_[_0xab6b('0x4a')](_0x3799e6[_0xab6b('0x4b')],{'$or':_[_0xab6b('0x38')](_0x3799e6['attributes'],function(_0x1df78a){var _0x20bcf5={};_0x20bcf5[_0x1df78a]={'$like':'%'+_0x1e7788[_0xab6b('0x3f')]['filter']+'%'};return _0x20bcf5;})});}_0x3799e6=_['merge']({},_0x3799e6,_0x1e7788[_0xab6b('0x54')]);return db[_0xab6b('0x62')][_0xab6b('0x4c')]({'where':_0x3799e6['where']})[_0xab6b('0x1f')](function(_0x2a8834){_0x285b18[_0xab6b('0x4c')]=_0x2a8834;if(_0x1e7788[_0xab6b('0x3f')][_0xab6b('0x4d')]){_0x3799e6[_0xab6b('0x4e')]=[{'all':!![]}];}return db[_0xab6b('0x62')][_0xab6b('0x4f')](_0x3799e6);})['then'](function(_0x1d767c){_0x285b18[_0xab6b('0x67')]=_0x1d767c;return _0x285b18;});}})[_0xab6b('0x1f')](respondWithFilteredResult(_0x33f0ee,_0x3799e6))[_0xab6b('0x28')](handleError(_0x33f0ee,null));};exports['removeDispositions']=function(_0x3424a0,_0x264a40,_0x5c65d2){return db[_0xab6b('0x39')][_0xab6b('0x5b')]({'where':{'id':_0x3424a0['params']['id']}})[_0xab6b('0x1f')](handleEntityNotFound(_0x264a40,null))[_0xab6b('0x1f')](function(_0x35c578){if(_0x35c578){return _0x35c578[_0xab6b('0x68')](_0x3424a0['query'][_0xab6b('0x69')]);}})[_0xab6b('0x1f')](respondWithStatusCode(_0x264a40,null))[_0xab6b('0x28')](handleError(_0x264a40,null));};exports['addAnswer']=function(_0x4a92c4,_0x24c214,_0x59e36f){if(_0x4a92c4[_0xab6b('0x56')]['id']){delete _0x4a92c4['body']['id'];}return db[_0xab6b('0x39')]['find']({'where':{'id':_0x4a92c4[_0xab6b('0x51')]['id']}})[_0xab6b('0x1f')](handleEntityNotFound(_0x24c214,null))[_0xab6b('0x1f')](function(_0x5d2f4c){if(_0x5d2f4c){_0x4a92c4['body'][_0xab6b('0x61')]=_0x5d2f4c['id'];return db['CannedAnswer']['create'](_0x4a92c4[_0xab6b('0x56')]);}})[_0xab6b('0x1f')](respondWithResult(_0x24c214,null))[_0xab6b('0x28')](handleError(_0x24c214,null));};exports[_0xab6b('0x6a')]=function(_0x53c0c8,_0x532f2e,_0x2a8cea){var _0x122d70={'raw':![],'where':{}};var _0x50456d={};var _0x595350={'count':0x0,'rows':[]};return db[_0xab6b('0x39')]['findOne']({'where':{'id':_0x53c0c8[_0xab6b('0x51')]['id']}})[_0xab6b('0x1f')](handleEntityNotFound(_0x532f2e,null))[_0xab6b('0x1f')](function(_0x8ea414){if(_0x8ea414){_0x50456d['model']=_[_0xab6b('0x40')](db[_0xab6b('0x6b')][_0xab6b('0x3a')]);_0x50456d[_0xab6b('0x3f')]=_[_0xab6b('0x40')](_0x53c0c8[_0xab6b('0x3f')]);_0x50456d['filters']=_[_0xab6b('0x53')](_0x50456d[_0xab6b('0x3e')],_0x50456d[_0xab6b('0x3f')]);_0x122d70[_0xab6b('0x42')]=_[_0xab6b('0x53')](_0x50456d[_0xab6b('0x3e')],qs[_0xab6b('0x43')](_0x53c0c8['query'][_0xab6b('0x43')]));_0x122d70['attributes']=_0x122d70[_0xab6b('0x42')][_0xab6b('0x44')]?_0x122d70[_0xab6b('0x42')]:_0x50456d[_0xab6b('0x3e')];if(!_0x53c0c8['query'][_0xab6b('0x65')](_0xab6b('0x45'))){_0x122d70[_0xab6b('0x46')]=qs[_0xab6b('0x46')](_0x53c0c8[_0xab6b('0x3f')]['limit']);_0x122d70[_0xab6b('0x2c')]=qs[_0xab6b('0x2c')](_0x53c0c8['query'][_0xab6b('0x2c')]);}_0x122d70[_0xab6b('0x47')]=qs[_0xab6b('0x48')](_0x53c0c8['query'][_0xab6b('0x48')]);_0x122d70[_0xab6b('0x4b')]=qs[_0xab6b('0x41')](_[_0xab6b('0x66')](_0x53c0c8[_0xab6b('0x3f')],_0x50456d[_0xab6b('0x41')]));_0x122d70[_0xab6b('0x4b')][_0xab6b('0x61')]=_0x8ea414['id'];if(_0x53c0c8[_0xab6b('0x3f')]['filter']){_0x122d70[_0xab6b('0x4b')]=_[_0xab6b('0x4a')](_0x122d70[_0xab6b('0x4b')],{'$or':_[_0xab6b('0x38')](_0x122d70['attributes'],function(_0x1b17a){var _0xd401f0={};_0xd401f0[_0x1b17a]={'$like':'%'+_0x53c0c8[_0xab6b('0x3f')][_0xab6b('0x49')]+'%'};return _0xd401f0;})});}_0x122d70=_[_0xab6b('0x4a')]({},_0x122d70,_0x53c0c8[_0xab6b('0x54')]);return db[_0xab6b('0x6b')]['count']({'where':_0x122d70[_0xab6b('0x4b')]})[_0xab6b('0x1f')](function(_0x54e09f){_0x595350[_0xab6b('0x4c')]=_0x54e09f;if(_0x53c0c8[_0xab6b('0x3f')][_0xab6b('0x4d')]){_0x122d70[_0xab6b('0x4e')]=[{'all':!![]}];}return db[_0xab6b('0x6b')][_0xab6b('0x4f')](_0x122d70);})[_0xab6b('0x1f')](function(_0x23214f){_0x595350[_0xab6b('0x67')]=_0x23214f;return _0x595350;});}})[_0xab6b('0x1f')](respondWithFilteredResult(_0x532f2e,_0x122d70))[_0xab6b('0x28')](handleError(_0x532f2e,null));};exports[_0xab6b('0x6c')]=function(_0x5a2d55,_0x3b2ca7,_0x402611){return db['ChatWebsite'][_0xab6b('0x5b')]({'where':{'id':_0x5a2d55['params']['id']}})[_0xab6b('0x1f')](handleEntityNotFound(_0x3b2ca7,null))['then'](function(_0xd5dc33){if(_0xd5dc33){return _0xd5dc33[_0xab6b('0x6c')](_0x5a2d55['query'][_0xab6b('0x69')]);}})['then'](respondWithStatusCode(_0x3b2ca7,null))[_0xab6b('0x28')](handleError(_0x3b2ca7,null));};exports['addLogo']=function(_0x3b5c31,_0xe560e0,_0x349ed0){_0x3b5c31[_0xab6b('0x56')][_0xab6b('0x6d')]=_0x3b5c31['file'][_0xab6b('0x6e')];return db['ChatWebsite'][_0xab6b('0x5b')]({'where':{'id':_0x3b5c31[_0xab6b('0x51')]['id']}})[_0xab6b('0x1f')](handleEntityNotFound(_0xe560e0,null))[_0xab6b('0x1f')](saveUpdates(_0x3b5c31[_0xab6b('0x56')],null))[_0xab6b('0x1f')](respondWithResult(_0xe560e0,null))[_0xab6b('0x28')](handleError(_0xe560e0,null));};exports[_0xab6b('0x6f')]=function(_0x3d9011,_0x454fa4,_0x7e7af9){_0x3d9011['body'][_0xab6b('0x70')]=_0x3d9011[_0xab6b('0x71')][_0xab6b('0x6e')];return db[_0xab6b('0x39')][_0xab6b('0x5b')]({'where':{'id':_0x3d9011[_0xab6b('0x51')]['id']}})[_0xab6b('0x1f')](handleEntityNotFound(_0x454fa4,null))[_0xab6b('0x1f')](saveUpdates(_0x3d9011['body'],null))[_0xab6b('0x1f')](respondWithResult(_0x454fa4,null))[_0xab6b('0x28')](handleError(_0x454fa4,null));};exports['addCustomerAvatar']=function(_0x2db893,_0x33248a,_0x2f0931){_0x2db893[_0xab6b('0x56')][_0xab6b('0x72')]=_0x2db893[_0xab6b('0x71')][_0xab6b('0x6e')];return db[_0xab6b('0x39')][_0xab6b('0x5b')]({'where':{'id':_0x2db893['params']['id']}})['then'](handleEntityNotFound(_0x33248a,null))['then'](saveUpdates(_0x2db893['body'],null))[_0xab6b('0x1f')](respondWithResult(_0x33248a,null))['catch'](handleError(_0x33248a,null));};exports[_0xab6b('0x73')]=function(_0x22ba25,_0x40be34,_0x5d4a45){_0x22ba25[_0xab6b('0x56')]['systemAvatar']=_0x22ba25[_0xab6b('0x71')][_0xab6b('0x6e')];return db[_0xab6b('0x39')][_0xab6b('0x5b')]({'where':{'id':_0x22ba25[_0xab6b('0x51')]['id']}})['then'](handleEntityNotFound(_0x40be34,null))[_0xab6b('0x1f')](saveUpdates(_0x22ba25[_0xab6b('0x56')],null))['then'](respondWithResult(_0x40be34,null))['catch'](handleError(_0x40be34,null));};exports[_0xab6b('0x74')]=function(_0x55d030,_0x59f748,_0x446c4c){var _0x40b19b=path['join'](config[_0xab6b('0x75')],_0xab6b('0x76'));var _0x531040={'where':{'id':_0x55d030[_0xab6b('0x51')]['id']},'attributes':['id',_0xab6b('0x6d')],'raw':!![]};var _0x22d3c4=![];return require(_0xab6b('0x15'))[_0xab6b('0x77')]()[_0xab6b('0x1f')](function(_0x50ab84){if(_0x50ab84){_0x22d3c4=_0x50ab84[_0xab6b('0x78')];}})[_0xab6b('0x1f')](function(){return db[_0xab6b('0x39')][_0xab6b('0x5b')](_0x531040);})[_0xab6b('0x1f')](handleEntityNotFound(_0x59f748,null))[_0xab6b('0x1f')](function(_0xaa1ec0){if(_0xaa1ec0){if(!_['isNil'](_0xaa1ec0['sitepic'])){if(fs['existsSync'](path['join'](config[_0xab6b('0x75')],_0xab6b('0x79'),_0xaa1ec0['sitepic']))&&_0x22d3c4){_0x40b19b=path[_0xab6b('0x7a')](config[_0xab6b('0x75')],_0xab6b('0x79'),_0xaa1ec0[_0xab6b('0x6d')]);}}return _0x59f748[_0xab6b('0x7b')](_0x40b19b);}})['catch'](handleError(_0x59f748,null));};exports['getAvatar']=function(_0x41798c,_0x57df02,_0x501878){var _0x521208=path['join'](config[_0xab6b('0x75')],'server/files/images/avatars/default_avatar.png');var _0xf6e486={'where':{'id':_0x41798c[_0xab6b('0x51')]['id']},'attributes':['id',_0xab6b('0x70')],'raw':!![]};return db[_0xab6b('0x39')][_0xab6b('0x5b')](_0xf6e486)[_0xab6b('0x1f')](handleEntityNotFound(_0x57df02,null))[_0xab6b('0x1f')](function(_0x22d4db){if(_0x22d4db){if(!_[_0xab6b('0x7c')](_0x22d4db[_0xab6b('0x70')])){if(fs[_0xab6b('0x7d')](path[_0xab6b('0x7a')](config[_0xab6b('0x75')],'server/files/images/avatars/',_0x22d4db['agentAvatar']))){_0x521208=path['join'](config[_0xab6b('0x75')],_0xab6b('0x7e'),_0x22d4db[_0xab6b('0x70')]);}}return _0x57df02['download'](_0x521208);}})['catch'](handleError(_0x57df02,null));};exports[_0xab6b('0x7f')]=function(_0x4046dc,_0x5ddddb,_0xf1cf2b){var _0x2399b6=path['join'](config[_0xab6b('0x75')],_0xab6b('0x80'));var _0x33caea={'where':{'id':_0x4046dc[_0xab6b('0x51')]['id']},'attributes':['id',_0xab6b('0x72'),'showCustomerAvatar'],'raw':!![]};return db[_0xab6b('0x39')]['find'](_0x33caea)[_0xab6b('0x1f')](handleEntityNotFound(_0x5ddddb,null))['then'](function(_0x26f513){if(_0x26f513){if(!_['isNil'](_0x26f513[_0xab6b('0x72')])){if(fs[_0xab6b('0x7d')](path['join'](config[_0xab6b('0x75')],_0xab6b('0x7e'),_0x26f513[_0xab6b('0x72')]))&&_0x26f513[_0xab6b('0x81')]){_0x2399b6=path[_0xab6b('0x7a')](config['root'],_0xab6b('0x7e'),_0x26f513[_0xab6b('0x72')]);}}return _0x5ddddb[_0xab6b('0x7b')](_0x2399b6);}})['catch'](handleError(_0x5ddddb,null));};exports['getSystemAvatar']=function(_0x2d0075,_0x12e690,_0x454e30){var _0x6b2bbe=path[_0xab6b('0x7a')](config[_0xab6b('0x75')],'server/files/images/avatars/system_avatar.png');var _0xbe88a7={'where':{'id':_0x2d0075[_0xab6b('0x51')]['id']},'attributes':['id',_0xab6b('0x82')],'raw':!![]};return db['ChatWebsite'][_0xab6b('0x5b')](_0xbe88a7)[_0xab6b('0x1f')](handleEntityNotFound(_0x12e690,null))[_0xab6b('0x1f')](function(_0x2dfe1a){if(_0x2dfe1a){if(!_['isNil'](_0x2dfe1a['systemAvatar'])){if(fs[_0xab6b('0x7d')](path[_0xab6b('0x7a')](config[_0xab6b('0x75')],'server/files/images/avatars/',_0x2dfe1a['systemAvatar']))){_0x6b2bbe=path[_0xab6b('0x7a')](config[_0xab6b('0x75')],'server/files/images/avatars/',_0x2dfe1a[_0xab6b('0x82')]);}}return _0x12e690[_0xab6b('0x7b')](_0x6b2bbe);}})[_0xab6b('0x28')](handleError(_0x12e690,null));};exports[_0xab6b('0x83')]=function(_0x5626d4,_0x59c8b7,_0x459fa7){var _0x12a66=require(_0xab6b('0x84'));var _0x546e4b=new _0x12a66();var _0x998ec6=_0x546e4b[_0xab6b('0x85')](_0x5626d4[_0xab6b('0x86')][_0xab6b('0x87')])[_0xab6b('0x88')]();var _0x4cb0fb={'body':_0x5626d4[_0xab6b('0x56')],'channel':_0xab6b('0x89')};var _0x9496d9=[];var _0xd2af44=[];var _0x4bb99f={};var _0x394f7e=![];return db['CmContact'][_0xab6b('0x5f')]()[_0xab6b('0x1f')](function(_0x5b2cff){if(!_0x5b2cff){throw new db[(_0xab6b('0x8a'))][(_0xab6b('0x8b'))](_0xab6b('0x8c'));}_0x9496d9=_[_0xab6b('0x8d')](_[_0xab6b('0x40')](_0x5b2cff),[_0xab6b('0x8e'),'updatedAt']);_0xd2af44=_['difference'](_[_0xab6b('0x40')](_0x5b2cff),[_0xab6b('0x8e'),'updatedAt','CompanyId',_0xab6b('0x8f')]);if(_0x5626d4['body']['id']){delete _0x5626d4[_0xab6b('0x56')]['id'];}if(_[_0xab6b('0x7c')](_0x5626d4['body'][_0xab6b('0x90')])){throw new db[(_0xab6b('0x8a'))]['ValidationError'](_0xab6b('0x91'));}if(_[_0xab6b('0x7c')](_0x5626d4['body'][_0xab6b('0x56')])||_0x5626d4[_0xab6b('0x56')]['body']===''){throw new db[(_0xab6b('0x8a'))][(_0xab6b('0x8b'))](_0xab6b('0x92'));}if(_[_0xab6b('0x7c')](_0x5626d4[_0xab6b('0x56')]['mapKey'])){throw new db[(_0xab6b('0x8a'))]['ValidationError'](_0xab6b('0x93')+_0xd2af44);}if(!_['includes'](_0xd2af44,_0x5626d4[_0xab6b('0x56')][_0xab6b('0x94')])){throw new db[(_0xab6b('0x8a'))][(_0xab6b('0x8b'))](_0xab6b('0x95')+_0xd2af44);}_0x4bb99f[_0x5626d4[_0xab6b('0x56')][_0xab6b('0x94')]]=_0x5626d4[_0xab6b('0x56')][_0xab6b('0x90')];})['then'](function(){return db[_0xab6b('0x39')][_0xab6b('0x5b')]({'where':{'id':_0x5626d4[_0xab6b('0x51')]['id']},'include':[{'model':db[_0xab6b('0x96')],'as':'List','include':[{'model':db[_0xab6b('0x97')],'as':_0xab6b('0x98'),'where':_0x4bb99f,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xab6b('0x99')],'as':_0xab6b('0x9a')}]});})[_0xab6b('0x1f')](handleEntityNotFound(_0x59c8b7,null))[_0xab6b('0x1f')](function(_0x345edd){if(_0x345edd&&_0x345edd[_0xab6b('0x9b')]){_0x4cb0fb[_0xab6b('0x9c')]=_0x345edd;_0x4cb0fb['applications']=_0x345edd[_0xab6b('0x9a')];_0x4cb0fb[_0xab6b('0x9d')]=_0x345edd[_0xab6b('0x9b')];_0x4cb0fb[_0xab6b('0x9e')]=_[_0xab6b('0x9f')](_0x4cb0fb[_0xab6b('0x9e')],[_0xab6b('0xa0')],[_0xab6b('0xa1')]);if(_0x4cb0fb[_0xab6b('0x9c')][_0xab6b('0x9a')]){delete _0x4cb0fb[_0xab6b('0x9c')][_0xab6b('0x9a')];}if(_0x4cb0fb['account']['List']&&_0x4cb0fb[_0xab6b('0x9c')][_0xab6b('0x9b')][_0xab6b('0x98')]['length']){return _0x4cb0fb[_0xab6b('0x9c')][_0xab6b('0x9b')][_0xab6b('0x98')][0x0];}var _0x4e17fc=_[_0xab6b('0xa2')](_0x5626d4[_0xab6b('0x56')],{'firstName':_0x5626d4[_0xab6b('0x56')][_0xab6b('0x90')],'ListId':_0x345edd['ListId']});_0x4e17fc[_0x5626d4[_0xab6b('0x56')][_0xab6b('0x94')]]=_0x5626d4[_0xab6b('0x56')][_0xab6b('0x90')];return db[_0xab6b('0x97')][_0xab6b('0x55')](_0x4e17fc,{'fields':_0x9496d9,'raw':!![]});}})[_0xab6b('0x1f')](handleEntityNotFound(_0x59c8b7,null))[_0xab6b('0x1f')](function(_0x190d74){_0x4cb0fb[_0xab6b('0xa3')]=_0x190d74;var _0x4355b4=_0x5626d4[_0xab6b('0x56')]['customerIp'];if(_0x5626d4[_0xab6b('0x86')][_0xab6b('0xa4')]){_0x4355b4=_0x5626d4[_0xab6b('0x86')][_0xab6b('0xa4')];}else if(_0x5626d4['headers'][_0xab6b('0xa5')]){_0x4355b4=_[_0xab6b('0xa6')](_0x5626d4[_0xab6b('0x86')]['x-forwarded-for'][_0xab6b('0xa7')](','));}if(_0x190d74){var _0x48f945={'ContactId':_0x190d74['id'],'ChatWebsiteId':_0x5626d4['params']['id'],'from':(_0x190d74['firstName']||'')+'\x20'+(_0x190d74['lastName']||''),'customerIp':_0x4355b4,'customerPort':_0x5626d4[_0xab6b('0x86')][_0xab6b('0xa8')]?_0x5626d4[_0xab6b('0x86')][_0xab6b('0xa8')]:null,'referer':_0x5626d4[_0xab6b('0x56')][_0xab6b('0xa9')],'browserName':_0x998ec6[_0xab6b('0xaa')][_0xab6b('0x34')]&&_0x998ec6[_0xab6b('0xaa')][_0xab6b('0xab')]?util[_0xab6b('0xac')](_0xab6b('0xad'),_0x998ec6[_0xab6b('0xaa')]['name'],_0x998ec6[_0xab6b('0xaa')][_0xab6b('0xab')]):_0xab6b('0xae'),'browserVersion':_0x998ec6[_0xab6b('0xaa')][_0xab6b('0xab')]||'unknown','osName':util[_0xab6b('0xac')](_0xab6b('0xad'),_0x998ec6['os'][_0xab6b('0x34')],_0x998ec6['os'][_0xab6b('0xab')]),'osVersion':_0x998ec6['os'][_0xab6b('0xab')],'deviceModel':_0x998ec6[_0xab6b('0xaf')][_0xab6b('0x3e')]&&_0x998ec6['device']['vendor']?util[_0xab6b('0xac')](_0xab6b('0xb0'),_0x998ec6[_0xab6b('0xaf')][_0xab6b('0x3e')],_0x998ec6[_0xab6b('0xaf')]['vendor'],_0x998ec6['device'][_0xab6b('0x3c')]):null,'deviceVendor':_0x998ec6[_0xab6b('0xaf')]['vendor'],'deviceType':_0x998ec6[_0xab6b('0xaf')][_0xab6b('0x3c')],'formData':JSON['stringify'](_0x5626d4[_0xab6b('0x56')])};var _0x466da7={'ChatWebsiteId':_0x5626d4[_0xab6b('0x51')]['id'],'closed':![]};if(_0x5626d4[_0xab6b('0x56')]['threadId']){_0x466da7[_0xab6b('0xb1')]=_0x5626d4[_0xab6b('0x56')]['threadId'];return db[_0xab6b('0xb2')]['find']({'where':_0x466da7})[_0xab6b('0x1f')](function(_0x369aaa){if(_0x369aaa){return[_0x369aaa,![]];}_0x48f945['threadId']=_0x5626d4['body'][_0xab6b('0xb1')];_0x48f945[_0xab6b('0xb3')]=_0x5626d4[_0xab6b('0x56')][_0xab6b('0xb3')];return db[_0xab6b('0xb2')][_0xab6b('0x55')](_0x48f945)[_0xab6b('0x1f')](function(_0x128f48){return[_0x128f48,!![]];});});}_0x466da7[_0xab6b('0xb4')]=_0x190d74['id'];if(_0x5626d4[_0xab6b('0x56')]['interaction']&&_0x5626d4[_0xab6b('0x56')][_0xab6b('0xb5')]['id']){_0x466da7['id']=_0x5626d4[_0xab6b('0x56')]['interaction']['id'];return db[_0xab6b('0xb2')][_0xab6b('0x5b')]({'where':_0x466da7})[_0xab6b('0x1f')](function(_0xb74b03){if(_0xb74b03){return[_0xb74b03,![]];}return db[_0xab6b('0xb2')][_0xab6b('0x55')](_0x48f945)[_0xab6b('0x1f')](function(_0x57c244){return[_0x57c244,!![]];});});}return db['ChatInteraction'][_0xab6b('0x55')](_0x48f945)['then'](function(_0x1d2d85){return[_0x1d2d85,!![]];});}})[_0xab6b('0xb6')](function(_0x3d8da3,_0x445cfb){if(_0x3d8da3){_0x394f7e=_0x445cfb;if(!_0x445cfb){var _0x3c0ece={'from':(_0x4cb0fb['contact'][_0xab6b('0xb7')]||'')+'\x20'+(_0x4cb0fb[_0xab6b('0xa3')][_0xab6b('0xb8')]||'')};if(_0x5626d4[_0xab6b('0x56')][_0xab6b('0xb1')]&&_0x5626d4[_0xab6b('0x56')]['messageId']&&_0x5626d4['body'][_0xab6b('0xb1')]!=_0x5626d4['body'][_0xab6b('0xb9')]){_0x3c0ece[_0xab6b('0xb1')]=_0x5626d4[_0xab6b('0x56')]['messageId'];}return _0x3d8da3[_0xab6b('0x30')](_0x3c0ece);}else{return _0x3d8da3;}}})[_0xab6b('0x1f')](function(_0x3f1705){_0x4cb0fb[_0xab6b('0xb5')]=_0x3f1705[_0xab6b('0x32')]({'plain':!![]});_0x4cb0fb[_0xab6b('0xb5')][_0xab6b('0xba')]=_0x394f7e;if(_0x4cb0fb[_0xab6b('0xb5')][_0xab6b('0xba')]){if(_0x4cb0fb['account'][_0xab6b('0xbb')]){_0x4cb0fb[_0xab6b('0x9e')][_0xab6b('0xbc')]({'id':0x0,'priority':_0x4cb0fb[_0xab6b('0x9e')]['length']+0x1,'app':_0xab6b('0xbd'),'appdata':_0xab6b('0xbe'),'interval':'*,*,*,*'});}}return db[_0xab6b('0xbf')][_0xab6b('0x55')]({'body':_0x5626d4[_0xab6b('0x56')][_0xab6b('0x56')],'ChatWebsiteId':_0x5626d4[_0xab6b('0x51')]['id'],'ChatInteractionId':_0x3f1705['id'],'direction':'in','ContactId':_0x4cb0fb[_0xab6b('0xa3')]['id'],'AttachmentId':_0x5626d4[_0xab6b('0x56')]['AttachmentId']});})['then'](function(_0x29a0d4){_0x4cb0fb[_0xab6b('0x27')]=_0x29a0d4;if(_0x4cb0fb[_0xab6b('0xb5')][_0xab6b('0xc0')]){return db['User'][_0xab6b('0x5b')]({'attributes':['id','name'],'where':{'id':_0x4cb0fb[_0xab6b('0xb5')]['UserId']}})['then'](function(_0x1e6550){if(_0x1e6550){_0x4cb0fb[_0xab6b('0x9e')][_0xab6b('0xc1')]({'id':0x0,'priority':0x0,'app':_0xab6b('0xc2'),'appdata':_0x1e6550[_0xab6b('0x34')]+','+(_0x4cb0fb['account'][_0xab6b('0xc3')]||0xa),'interval':_0xab6b('0xc4')});_0x4cb0fb['forcedOwnership']=!![];}return respondWithRpcPromise(_0xab6b('0xc5'),_0xab6b('0xc6'),_0x4cb0fb);});}return respondWithRpcPromise('Start',_0xab6b('0xc6'),_0x4cb0fb);})[_0xab6b('0x1f')](function(_0x177b47){respondWithRpcPromise(_0xab6b('0xc7'),_0xab6b('0xc7'),{'event':_0xab6b('0x83'),'message':_0x177b47},client9002);return _0x177b47;})[_0xab6b('0x1f')](respondWithResult(_0x59c8b7,null))[_0xab6b('0x28')](handleError(_0x59c8b7,null));};exports[_0xab6b('0xc8')]=function(_0x3fc999,_0x3f9d5f,_0x268719){var _0x3522ec,_0x28320a,_0x21ac42;var _0x2a5d3b=[];var _0x357dca=[];var _0x16d331={};return db['CmContact'][_0xab6b('0x5f')]()[_0xab6b('0x1f')](function(_0x1f1a07){if(!_0x1f1a07){throw new db['Sequelize'][(_0xab6b('0x8b'))](_0xab6b('0x8c'));}_0x357dca=_[_0xab6b('0x8d')](_['keys'](_0x1f1a07),['createdAt',_0xab6b('0xc9')]);_0x2a5d3b=_[_0xab6b('0x8d')](_['keys'](_0x1f1a07),[_0xab6b('0x8e'),_0xab6b('0xc9'),_0xab6b('0xca'),_0xab6b('0x8f')]);if(_0x3fc999[_0xab6b('0x56')]['id']){delete _0x3fc999[_0xab6b('0x56')]['id'];}if(_[_0xab6b('0x7c')](_0x3fc999[_0xab6b('0x56')][_0xab6b('0x90')])){throw _0x3f9d5f[_0xab6b('0x29')](0x1f4)['send'](new db[(_0xab6b('0x8a'))][(_0xab6b('0x8b'))](_0xab6b('0x91')));}if(_['isNil'](_0x3fc999[_0xab6b('0x56')][_0xab6b('0x56')])||_0x3fc999[_0xab6b('0x56')][_0xab6b('0x56')]===''){throw _0x3f9d5f[_0xab6b('0x29')](0x1f4)['send'](new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xab6b('0x7c')](_0x3fc999[_0xab6b('0x56')][_0xab6b('0xcb')])){throw _0x3f9d5f['status'](0x1f4)['send'](new db[(_0xab6b('0x8a'))]['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2a5d3b));}if(!_['includes'](_0x2a5d3b,_0x3fc999[_0xab6b('0x56')][_0xab6b('0xcb')])){throw _0x3f9d5f['status'](0x1f4)[_0xab6b('0x35')](new db[(_0xab6b('0x8a'))][(_0xab6b('0x8b'))](_0xab6b('0xcc')+_0x2a5d3b));}_0x16d331[_0x3fc999[_0xab6b('0x56')][_0xab6b('0xcb')]]=_0x3fc999[_0xab6b('0x56')][_0xab6b('0x90')];})['then'](function(){return db['ChatWebsite'][_0xab6b('0x5b')]({'where':{'id':_0x3fc999[_0xab6b('0x51')]['id']},'include':[{'model':db['CmList'],'as':'List'}]});})[_0xab6b('0x1f')](handleEntityNotFound(_0x3f9d5f,null))[_0xab6b('0x1f')](function(_0x521f21){if(_0x521f21&&_0x521f21[_0xab6b('0x9b')]){_0x28320a=_0x521f21;var _0x13f684=_[_0xab6b('0xa2')](_0x3fc999['body'],{'firstName':_0x3fc999[_0xab6b('0x56')][_0xab6b('0x90')],'phone':_0x3fc999['body'][_0xab6b('0x90')],'ListId':_0x521f21['ListId']});_0x13f684[_0x3fc999[_0xab6b('0x56')]['mapKeyOffline']]=_0x3fc999[_0xab6b('0x56')]['from'];return db[_0xab6b('0x97')][_0xab6b('0xcd')]({'where':_0x16d331,'defaults':_0x13f684});}})[_0xab6b('0xb6')](function(_0x315c7b){if(_0x315c7b){_0x21ac42=_0x315c7b;var _0x3ed5e4=fs[_0xab6b('0xce')](path[_0xab6b('0x7a')](config[_0xab6b('0x75')],_0xab6b('0xcf')),_0xab6b('0xd0'));var _0x32074b=ejs[_0xab6b('0xd1')](_0x3ed5e4,{'body':_[_0xab6b('0xd2')](_0x3fc999['body']['body']),'bodyTitle':_0x28320a[_0xab6b('0xd3')]});return db[_0xab6b('0xd4')][_0xab6b('0x55')]({'body':_0x32074b,'ContactId':_0x315c7b['id'],'ChatWebsiteId':_0x28320a['id']});}})[_0xab6b('0x1f')](function(_0x431aa5){if(_0x431aa5){_0x3522ec=_0x431aa5;return db[_0xab6b('0xd5')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xab6b('0xd6')],'as':'Smtp','raw':!![]}]});}})[_0xab6b('0x1f')](function(_0x245d1d){if(_0x245d1d&&_0x245d1d[_0xab6b('0xd7')]&&_0x28320a['forwardOfflineAddress']){var _0x57e5dc={'tls':{'rejectUnauthorized':![]}};if(_0x245d1d[_0xab6b('0xd7')][_0xab6b('0xd8')]){_0x57e5dc['service']=_0x245d1d['Smtp'][_0xab6b('0xd8')];}else{_0x57e5dc[_0xab6b('0xd9')]=_0x245d1d[_0xab6b('0xd7')][_0xab6b('0xd9')];_0x57e5dc[_0xab6b('0xda')]=_0x245d1d[_0xab6b('0xd7')][_0xab6b('0xda')];_0x57e5dc[_0xab6b('0xdb')]=_0x245d1d[_0xab6b('0xd7')][_0xab6b('0xdb')];}if(_0x245d1d[_0xab6b('0xd7')][_0xab6b('0xdc')]){_0x57e5dc[_0xab6b('0xdd')]={'user':_0x245d1d[_0xab6b('0xd7')][_0xab6b('0x58')],'pass':_0x245d1d[_0xab6b('0xd7')]['pass']};}return respondWithRpcPromise(_0xab6b('0xde'),_0xab6b('0xdf'),{'account':_0x57e5dc,'message':{'from':util[_0xab6b('0xac')]('\x22%s\x22\x20<%s>',_0x245d1d['name'],_0x245d1d['email']||_0x245d1d[_0xab6b('0xd7')][_0xab6b('0x58')]),'to':_0x28320a[_0xab6b('0xe0')],'subject':_0x28320a[_0xab6b('0xe1')],'text':_0x3522ec[_0xab6b('0x56')]}},client9003)[_0xab6b('0x1f')](function(){return _0x3522ec;})[_0xab6b('0x28')](function(_0x122d17){console[_0xab6b('0x25')](_0x122d17);});}})['then'](function(){if(_0x3522ec){return _0x3522ec;}})[_0xab6b('0x1f')](respondWithResult(_0x3f9d5f,null))[_0xab6b('0x28')](handleError(_0x3f9d5f,null));};exports['addInteraction']=function(_0x198f6a,_0xcafe78,_0x31fec7){return db[_0xab6b('0xb2')][_0xab6b('0x5b')]({'where':{'id':_0x198f6a['params']['id']}})[_0xab6b('0x1f')](handleEntityNotFound(_0xcafe78,null))[_0xab6b('0x1f')](function(_0x2736f0){if(_0x2736f0){return _0x2736f0[_0xab6b('0xe2')](_0x198f6a['body'][_0xab6b('0x69')],_[_0xab6b('0xe3')](_0x198f6a[_0xab6b('0x56')],[_0xab6b('0x69'),'id'])||{});}})[_0xab6b('0x1f')](respondWithResult(_0xcafe78,null))[_0xab6b('0x28')](handleError(_0xcafe78,null));};exports[_0xab6b('0xe4')]=function(_0x381749,_0x18d8cd,_0x14d579){var _0x468277={'raw':![],'where':{}};var _0x1723f2={};var _0x58e64c={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xab6b('0x64')]({'where':{'id':_0x381749[_0xab6b('0x51')]['id']}})['then'](handleEntityNotFound(_0x18d8cd,null))[_0xab6b('0x1f')](function(_0x111624){if(_0x111624){_0x1723f2[_0xab6b('0x3e')]=_['keys'](db[_0xab6b('0xb2')]['rawAttributes']);_0x1723f2[_0xab6b('0x3f')]=_[_0xab6b('0x40')](_0x381749[_0xab6b('0x3f')]);_0x1723f2[_0xab6b('0x41')]=_[_0xab6b('0x53')](_0x1723f2[_0xab6b('0x3e')],_0x1723f2[_0xab6b('0x3f')]);_0x468277['attributes']=_[_0xab6b('0x53')](_0x1723f2[_0xab6b('0x3e')],qs[_0xab6b('0x43')](_0x381749[_0xab6b('0x3f')][_0xab6b('0x43')]));_0x468277[_0xab6b('0x42')]=_0x468277[_0xab6b('0x42')][_0xab6b('0x44')]?_0x468277[_0xab6b('0x42')]:_0x1723f2['model'];if(!_0x381749['query'][_0xab6b('0x65')](_0xab6b('0x45'))){_0x468277[_0xab6b('0x46')]=qs[_0xab6b('0x46')](_0x381749[_0xab6b('0x3f')][_0xab6b('0x46')]);_0x468277['offset']=qs[_0xab6b('0x2c')](_0x381749['query'][_0xab6b('0x2c')]);}_0x468277['order']=qs[_0xab6b('0x48')](_0x381749[_0xab6b('0x3f')]['sort']);_0x468277[_0xab6b('0x4b')]=qs['filters'](_[_0xab6b('0x66')](_0x381749[_0xab6b('0x3f')],_0x1723f2[_0xab6b('0x41')]));_0x468277['where'][_0xab6b('0x61')]=_0x111624['id'];if(_0x381749[_0xab6b('0x3f')]['filter']){_0x468277['where']=_[_0xab6b('0x4a')](_0x468277[_0xab6b('0x4b')],{'$or':_[_0xab6b('0x38')](_0x468277[_0xab6b('0x42')],function(_0x1c967a){var _0xe6cbb0={};_0xe6cbb0[_0x1c967a]={'$like':'%'+_0x381749[_0xab6b('0x3f')][_0xab6b('0x49')]+'%'};return _0xe6cbb0;})});}_0x468277=_[_0xab6b('0x4a')]({},_0x468277,_0x381749['options']);return db[_0xab6b('0xb2')]['count']({'where':_0x468277['where']})['then'](function(_0x12b2fe){_0x58e64c['count']=_0x12b2fe;if(_0x381749[_0xab6b('0x3f')][_0xab6b('0x4d')]){_0x468277['include']=[{'model':db[_0xab6b('0x97')],'as':_0xab6b('0xe5'),'required':![]},{'model':db['User'],'as':_0xab6b('0xe6'),'attributes':[_0xab6b('0x34'),_0xab6b('0xe7'),_0xab6b('0xe8')],'required':![]},{'model':db[_0xab6b('0xe9')],'as':_0xab6b('0xea'),'attributes':['id','name',_0xab6b('0xeb')],'where':_0x381749[_0xab6b('0x3f')][_0xab6b('0xec')]?{'id':_0x381749[_0xab6b('0x3f')][_0xab6b('0xec')]}:undefined,'required':_0x381749[_0xab6b('0x3f')][_0xab6b('0xec')]?!![]:![]}];}return db[_0xab6b('0xb2')][_0xab6b('0x4f')](_0x468277);})[_0xab6b('0x1f')](function(_0x22c8c6){_0x58e64c[_0xab6b('0x67')]=_0x22c8c6;return _0x58e64c;});}})[_0xab6b('0x1f')](respondWithFilteredResult(_0x18d8cd,_0x468277))[_0xab6b('0x28')](handleError(_0x18d8cd,null));};function iftimePromise(_0x23f44d,_0x2f52d0){return respondWithRpcPromise(_0xab6b('0xed'),_0xab6b('0xee'),{'command':_0x2f52d0[_0xab6b('0xef')]?util[_0xab6b('0xac')]('iftime\x20%s,%s',_0x23f44d[_0xab6b('0xf0')],_0x2f52d0[_0xab6b('0xef')]):util['format'](_0xab6b('0xf1'),_0x23f44d[_0xab6b('0xf0')])},client9002)[_0xab6b('0x1f')](function(_0x4a03c3){var _0x5afc97=_0x4a03c3&&_0x4a03c3[_0xab6b('0xf2')](_0xab6b('0xf3'))>=0x0?!![]:![];logger[_0xab6b('0x20')](_0xab6b('0xf4'),_0x2f52d0['id'],_0x23f44d['id'],_0x23f44d['interval'],_0x5afc97?_0xab6b('0xf5'):_0xab6b('0xf6'),_0x2f52d0[_0xab6b('0xef')]?_0x2f52d0[_0xab6b('0xef')]:_0xab6b('0xf7'));return _0x5afc97;})[_0xab6b('0x28')](function(_0x54a4d0){logger[_0xab6b('0x25')](_0xab6b('0xf4'),_0x2f52d0['id'],_0x23f44d['id'],_0x23f44d[_0xab6b('0xf0')],util[_0xab6b('0xf8')](_0x54a4d0,{'showHidden':![],'depth':null}),_0x2f52d0[_0xab6b('0xef')]?_0x2f52d0[_0xab6b('0xef')]:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x34029f,_0x2ad8bf,_0xa4f05b){var _0x93cac1=0x0;var _0xea9a88=0x0;var _0x172af3=![];var _0x1574cd;var _0xecd507;return db['ChatWebsite'][_0xab6b('0x5b')]({'where':{'id':_0x34029f[_0xab6b('0x51')]['id']},'include':[{'model':db[_0xab6b('0xf9')],'as':_0xab6b('0xf9'),'include':[{'model':db[_0xab6b('0xf9')],'as':'Intervals','attributes':['id',_0xab6b('0xf0')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2ad8bf,null))['then'](function(_0x2775f5){if(_0x2775f5){_0x1574cd=_0x2775f5;return _0x2775f5[_0xab6b('0xfa')]({'raw':!![]});}})[_0xab6b('0x1f')](function(_0xe03cd1){if(_0x1574cd){if(_0xe03cd1){_0xecd507=_0xe03cd1;}}return require('../../config/license/util')[_0xab6b('0x77')]();})[_0xab6b('0x1f')](function(_0x3734f3){if(_0x3734f3){_0xea9a88=_0x3734f3[_0xab6b('0xfb')];_0x172af3=_0x3734f3['custom'];}})['then'](function(){return db[_0xab6b('0xb2')]['count']({'where':{'closed':![]}});})[_0xab6b('0x1f')](function(_0x2eb236){_0x93cac1=_0x2eb236;if(_0xea9a88&&_0x2eb236>_0xea9a88){return db['License'][_0xab6b('0x64')]({'where':{'id':0x1}})['then'](function(_0x29a24a){if(_0x29a24a){_0x29a24a[_0xab6b('0xfc')](_0xab6b('0xfd'));}});}})['then'](function(){if(_0x1574cd[_0xab6b('0xf9')]&&_0x1574cd['Interval']['Intervals']){var _0x3e60af=[];for(var _0x59dba6=0x0;_0x59dba6<_0x1574cd['Interval']['Intervals'][_0xab6b('0x44')];_0x59dba6++){var _0x595360=_0x1574cd[_0xab6b('0xf9')][_0xab6b('0xfe')][_0x59dba6]['get']({'plain':!![]});_0x3e60af[_0xab6b('0xbc')](iftimePromise(_0x595360,_0x1574cd));}return BPromise[_0xab6b('0xff')](_0x3e60af)[_0xab6b('0x1f')](function(_0x1b74a5){return _['some'](_0x1b74a5);});}else{return!![];}})[_0xab6b('0x1f')](function(_0x304c78){var _0x45892b=fs['readFileSync'](path[_0xab6b('0x7a')](config['root'],_0xab6b('0x100')),_0xab6b('0xd0'));var _0x55fb25={'remote':_0x1574cd['remote'],'query':querystring[_0xab6b('0x24')](_[_0xab6b('0x4a')](_0x1574cd['get']({'plain':!![]}),{'customerIp':_0x34029f[_0xab6b('0x86')][_0xab6b('0xa5')]||_0x34029f[_0xab6b('0x86')][_0xab6b('0x101')]||_0x34029f[_0xab6b('0x102')][_0xab6b('0x103')]||_0x34029f['ip'],'referer':_0x34029f[_0xab6b('0x86')]['referer'],'openedInteractions':_0x93cac1,'maxInteractions':_0xea9a88,'virtual':_0x172af3[_0xab6b('0xfb')],'online':_0x304c78,'custom':_0x172af3}))[_0xab6b('0x104')](/'/g,'\x5c\x27')};_0x2ad8bf[_0xab6b('0x35')](ejs[_0xab6b('0xd1')](Mustache[_0xab6b('0xd1')](_0x45892b,_0x55fb25),{'proactiveActions':_0xecd507,'alignment':_0x1574cd[_0xab6b('0x105')],'verticalAlignment':_0x1574cd[_0xab6b('0x106')],'div_color':_0x1574cd[_0xab6b('0xeb')],'text_color':_0x1574cd['textColor']}));})[_0xab6b('0x28')](handleError(_0x2ad8bf,null));};exports[_0xab6b('0x107')]=function(_0x47a670,_0x5142dc,_0x26a076){return db[_0xab6b('0x39')][_0xab6b('0x64')]({'where':{'id':_0x47a670[_0xab6b('0x51')]['id']}})[_0xab6b('0x1f')](handleEntityNotFound(_0x5142dc,null))[_0xab6b('0x1f')](function(_0x883763){if(_0x883763){return db[_0xab6b('0x108')]['transaction'](function(_0x57bc08){return db[_0xab6b('0x99')][_0xab6b('0x31')]({'where':{'ChatWebsiteId':_0x47a670[_0xab6b('0x51')]['id']},'transaction':_0x57bc08})['then'](function(_0xc62520){var _0x3d2998=_[_0xab6b('0x38')](_0x47a670[_0xab6b('0x56')],function(_0x1574d1){_0x1574d1[_0xab6b('0x61')]=_0x47a670[_0xab6b('0x51')]['id'];return _0x1574d1;});return db[_0xab6b('0x99')][_0xab6b('0x109')](_0x3d2998,{'transaction':_0x57bc08});});})[_0xab6b('0x1f')](function(){return db[_0xab6b('0x99')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x47a670[_0xab6b('0x51')]['id']},'order':_0xab6b('0xa0')});});}})['then'](respondWithResult(_0x5142dc,null))['catch'](handleError(_0x5142dc,null));};exports[_0xab6b('0x10a')]=function(_0x2129b7,_0x2552e1,_0x181546){var _0x55cc65={};var _0x151c4e={};var _0x1083d4;var _0x35ba98;return db[_0xab6b('0x39')][_0xab6b('0x64')]({'where':{'id':_0x2129b7[_0xab6b('0x51')]['id']}})[_0xab6b('0x1f')](handleEntityNotFound(_0x2552e1,null))['then'](function(_0x5c69fe){if(_0x5c69fe){_0x1083d4=_0x5c69fe;_0x151c4e['model']=_[_0xab6b('0x40')](db['ChatApplication'][_0xab6b('0x3a')]);_0x151c4e[_0xab6b('0x3f')]=_[_0xab6b('0x40')](_0x2129b7[_0xab6b('0x3f')]);_0x151c4e[_0xab6b('0x41')]=_[_0xab6b('0x53')](_0x151c4e['model'],_0x151c4e[_0xab6b('0x3f')]);_0x55cc65[_0xab6b('0x42')]=_[_0xab6b('0x53')](_0x151c4e[_0xab6b('0x3e')],qs['fields'](_0x2129b7[_0xab6b('0x3f')]['fields']));_0x55cc65[_0xab6b('0x42')]=_0x55cc65[_0xab6b('0x42')][_0xab6b('0x44')]?_0x55cc65[_0xab6b('0x42')]:_0x151c4e[_0xab6b('0x3e')];_0x55cc65[_0xab6b('0x47')]=qs[_0xab6b('0x48')](_0x2129b7['query'][_0xab6b('0x48')]);_0x55cc65[_0xab6b('0x4b')]=qs[_0xab6b('0x41')](_[_0xab6b('0x66')](_0x2129b7['query'],_0x151c4e[_0xab6b('0x41')]));if(_0x2129b7[_0xab6b('0x3f')][_0xab6b('0x49')]){_0x55cc65[_0xab6b('0x4b')]=_[_0xab6b('0x4a')](_0x55cc65[_0xab6b('0x4b')],{'$or':_['map'](_0x55cc65[_0xab6b('0x42')],function(_0x508be9){var _0x106d13={};_0x106d13[_0x508be9]={'$like':'%'+_0x2129b7[_0xab6b('0x3f')][_0xab6b('0x49')]+'%'};return _0x106d13;})});}_0x55cc65=_[_0xab6b('0x4a')]({},_0x55cc65,_0x2129b7[_0xab6b('0x54')]);return _0x1083d4[_0xab6b('0x10a')](_0x55cc65);}})['then'](function(_0xd7c40){if(_0xd7c40){_0x35ba98=_0xd7c40[_0xab6b('0x44')];if(!_0x2129b7[_0xab6b('0x3f')][_0xab6b('0x65')](_0xab6b('0x45'))){_0x55cc65[_0xab6b('0x46')]=qs[_0xab6b('0x46')](_0x2129b7[_0xab6b('0x3f')]['limit']);_0x55cc65[_0xab6b('0x2c')]=qs[_0xab6b('0x2c')](_0x2129b7[_0xab6b('0x3f')][_0xab6b('0x2c')]);}return _0x1083d4[_0xab6b('0x10a')](_0x55cc65);}})[_0xab6b('0x1f')](function(_0x47b1f5){if(_0x47b1f5){return _0x47b1f5?{'count':_0x35ba98,'rows':_0x47b1f5}:null;}})[_0xab6b('0x1f')](respondWithResult(_0x2552e1,null))['catch'](handleError(_0x2552e1,null));};exports[_0xab6b('0x10b')]=function(_0x390767,_0x150483,_0x4cc78b){return db[_0xab6b('0x10c')]['find']({'where':{'id':_0x390767[_0xab6b('0x51')]['id']}})[_0xab6b('0x1f')](handleEntityNotFound(_0x150483,null))['then'](function(_0x5143cb){if(_0x5143cb){return _0x5143cb[_0xab6b('0x10b')](_0x390767[_0xab6b('0x56')]['ids'],_[_0xab6b('0xe3')](_0x390767[_0xab6b('0x56')],[_0xab6b('0x69'),'id'])||{});}})[_0xab6b('0x1f')](respondWithResult(_0x150483,null))[_0xab6b('0x28')](handleError(_0x150483,null));};exports[_0xab6b('0xfa')]=function(_0x4c4b19,_0x467da8,_0x2d7ae0){var _0x1a5335={};var _0x2654a6={};var _0x406203;var _0x40affe;return db[_0xab6b('0x39')][_0xab6b('0x64')]({'where':{'id':_0x4c4b19[_0xab6b('0x51')]['id']}})[_0xab6b('0x1f')](handleEntityNotFound(_0x467da8,null))[_0xab6b('0x1f')](function(_0x146018){if(_0x146018){_0x406203=_0x146018;_0x2654a6[_0xab6b('0x3e')]=_[_0xab6b('0x40')](db[_0xab6b('0x10d')][_0xab6b('0x3a')]);_0x2654a6[_0xab6b('0x3f')]=_[_0xab6b('0x40')](_0x4c4b19[_0xab6b('0x3f')]);_0x2654a6['filters']=_[_0xab6b('0x53')](_0x2654a6[_0xab6b('0x3e')],_0x2654a6[_0xab6b('0x3f')]);_0x1a5335['attributes']=_['intersection'](_0x2654a6[_0xab6b('0x3e')],qs[_0xab6b('0x43')](_0x4c4b19['query'][_0xab6b('0x43')]));_0x1a5335[_0xab6b('0x42')]=_0x1a5335[_0xab6b('0x42')][_0xab6b('0x44')]?_0x1a5335[_0xab6b('0x42')]:_0x2654a6['model'];_0x1a5335[_0xab6b('0x47')]=qs['sort'](_0x4c4b19[_0xab6b('0x3f')][_0xab6b('0x48')]);_0x1a5335[_0xab6b('0x4b')]=qs['filters'](_[_0xab6b('0x66')](_0x4c4b19[_0xab6b('0x3f')],_0x2654a6['filters']));if(_0x4c4b19['query'][_0xab6b('0x49')]){_0x1a5335[_0xab6b('0x4b')]=_[_0xab6b('0x4a')](_0x1a5335[_0xab6b('0x4b')],{'$or':_[_0xab6b('0x38')](_0x1a5335[_0xab6b('0x42')],function(_0xd1b641){var _0x4894a0={};_0x4894a0[_0xd1b641]={'$like':'%'+_0x4c4b19[_0xab6b('0x3f')][_0xab6b('0x49')]+'%'};return _0x4894a0;})});}_0x1a5335=_[_0xab6b('0x4a')]({},_0x1a5335,_0x4c4b19['options']);return _0x406203['getProactiveActions'](_0x1a5335);}})[_0xab6b('0x1f')](function(_0x4cc04a){if(_0x4cc04a){_0x40affe=_0x4cc04a['length'];if(!_0x4c4b19[_0xab6b('0x3f')]['hasOwnProperty']('nolimit')){_0x1a5335[_0xab6b('0x46')]=qs[_0xab6b('0x46')](_0x4c4b19[_0xab6b('0x3f')][_0xab6b('0x46')]);_0x1a5335[_0xab6b('0x2c')]=qs[_0xab6b('0x2c')](_0x4c4b19[_0xab6b('0x3f')][_0xab6b('0x2c')]);}return _0x406203[_0xab6b('0xfa')](_0x1a5335);}})['then'](function(_0x1fa7d9){if(_0x1fa7d9){return _0x1fa7d9?{'count':_0x40affe,'rows':_0x1fa7d9}:null;}})[_0xab6b('0x1f')](respondWithResult(_0x467da8,null))[_0xab6b('0x28')](handleError(_0x467da8,null));};exports[_0xab6b('0x10e')]=function(_0x3ca296,_0x49b654,_0x2654b9){var _0x30b1e0=_0x3ca296['query'][_0xab6b('0x10f')]===_0xab6b('0x110')?_0xab6b('0x111'):_0xab6b('0x112');return db['ChatWebsite'][_0xab6b('0x5b')]({'attributes':['id',_0x30b1e0],'where':{'id':_0x3ca296[_0xab6b('0x51')]['id']}})[_0xab6b('0x1f')](handleEntityNotFound(_0x49b654,null))['then'](function(_0xc8df96){if(_0xc8df96){var _0x1cee41=_0xc8df96[_0x30b1e0];var _0x51300e=_0x1cee41&&_0x1cee41[_0xab6b('0x113')]?_0x1cee41[_0xab6b('0x113')]:[];_0x49b654[_0xab6b('0x35')]({'fromKey':_[_0xab6b('0x7c')](_0x1cee41[_0xab6b('0x114')])?undefined:_0x1cee41[_0xab6b('0x114')],'count':_0x51300e[_0xab6b('0x44')],'rows':_0x51300e});}})[_0xab6b('0x28')](handleError(_0x49b654,null));};exports[_0xab6b('0x115')]=function(_0x4e8286,_0x7d1d7f,_0x57f5b5){var _0x3a02a5={'raw':![],'where':{}};var _0x4b1e50={};var _0x4f5659={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x4e8286[_0xab6b('0x51')]['id']}})['then'](handleEntityNotFound(_0x7d1d7f,null))[_0xab6b('0x1f')](function(_0x5edf16){if(_0x5edf16){_0x4b1e50['model']=_[_0xab6b('0x40')](db[_0xab6b('0xd4')][_0xab6b('0x3a')]);_0x4b1e50[_0xab6b('0x3f')]=_['keys'](_0x4e8286[_0xab6b('0x3f')]);_0x4b1e50[_0xab6b('0x41')]=_['intersection'](_0x4b1e50[_0xab6b('0x3e')],_0x4b1e50[_0xab6b('0x3f')]);_0x3a02a5[_0xab6b('0x42')]=_[_0xab6b('0x53')](_0x4b1e50['model'],qs['fields'](_0x4e8286['query']['fields']));_0x3a02a5['attributes']=_0x3a02a5['attributes'][_0xab6b('0x44')]?_0x3a02a5[_0xab6b('0x42')]:_0x4b1e50[_0xab6b('0x3e')];if(!_0x4e8286[_0xab6b('0x3f')]['hasOwnProperty'](_0xab6b('0x45'))){_0x3a02a5['limit']=qs['limit'](_0x4e8286[_0xab6b('0x3f')][_0xab6b('0x46')]);_0x3a02a5[_0xab6b('0x2c')]=qs['offset'](_0x4e8286[_0xab6b('0x3f')][_0xab6b('0x2c')]);}_0x3a02a5[_0xab6b('0x47')]=qs['sort'](_0x4e8286[_0xab6b('0x3f')][_0xab6b('0x48')]);_0x3a02a5[_0xab6b('0x4b')]=qs[_0xab6b('0x41')](_['pick'](_0x4e8286[_0xab6b('0x3f')],_0x4b1e50[_0xab6b('0x41')]));_0x3a02a5['where'][_0xab6b('0x61')]=_0x5edf16['id'];if(_0x4e8286[_0xab6b('0x3f')][_0xab6b('0x49')]){_0x3a02a5[_0xab6b('0x4b')]=_[_0xab6b('0x4a')](_0x3a02a5[_0xab6b('0x4b')],{'$or':_[_0xab6b('0x38')](_0x3a02a5[_0xab6b('0x42')],function(_0x592a8f){var _0x3b95e0={};_0x3b95e0[_0x592a8f]={'$like':'%'+_0x4e8286['query'][_0xab6b('0x49')]+'%'};return _0x3b95e0;})});}_0x3a02a5=_[_0xab6b('0x4a')]({},_0x3a02a5,_0x4e8286[_0xab6b('0x54')]);return db['ChatOfflineMessage'][_0xab6b('0x4c')]({'where':_0x3a02a5[_0xab6b('0x4b')]})[_0xab6b('0x1f')](function(_0x2461b7){_0x4f5659[_0xab6b('0x4c')]=_0x2461b7;if(_0x4e8286[_0xab6b('0x3f')][_0xab6b('0x4d')]){_0x3a02a5[_0xab6b('0x4e')]=[{'all':!![]}];}else{_0x3a02a5[_0xab6b('0x4e')]=[{'model':db[_0xab6b('0x97')],'as':_0xab6b('0xe5'),'required':![]}];}return db[_0xab6b('0xd4')][_0xab6b('0x4f')](_0x3a02a5);})[_0xab6b('0x1f')](function(_0x2f9f3d){_0x4f5659[_0xab6b('0x67')]=_0x2f9f3d;return _0x4f5659;});}})[_0xab6b('0x1f')](respondWithFilteredResult(_0x7d1d7f,_0x3a02a5))[_0xab6b('0x28')](handleError(_0x7d1d7f,null));};exports[_0xab6b('0x116')]=function(_0x354837,_0x213164,_0x1dfde0){return db['ChatWebsite']['find']({'where':{'id':_0x354837['params']['id']}})[_0xab6b('0x1f')](handleEntityNotFound(_0x213164,null))['then'](function(_0x3a6ee8){if(_0x3a6ee8){return _0x3a6ee8[_0xab6b('0x116')](_0x354837[_0xab6b('0x56')][_0xab6b('0x69')],_[_0xab6b('0xe3')](_0x354837['body'],[_0xab6b('0x69'),'id'])||{})[_0xab6b('0xb6')](function(_0x53c47d){for(var _0x513944=0x0;_0x513944<_0x354837[_0xab6b('0x56')][_0xab6b('0x69')][_0xab6b('0x44')];_0x513944+=0x1){socket[_0xab6b('0x117')](_0xab6b('0x118'),{'UserId':_0x354837[_0xab6b('0x56')][_0xab6b('0x69')][_0x513944],'ChatWebsiteId':_0x354837[_0xab6b('0x51')]['id']});}return _0x53c47d;});}})[_0xab6b('0x1f')](respondWithResult(_0x213164,null))['catch'](handleError(_0x213164,null));};exports[_0xab6b('0x119')]=function(_0x14bf77,_0x4e1f3f,_0x584b30){return db['ChatWebsite']['find']({'where':{'id':_0x14bf77[_0xab6b('0x51')]['id']}})['then'](handleEntityNotFound(_0x4e1f3f,null))[_0xab6b('0x1f')](function(_0x21aa3e){if(_0x21aa3e){return _0x21aa3e[_0xab6b('0x119')](_0x14bf77['query'][_0xab6b('0x69')])[_0xab6b('0x1f')](function(){if(_[_0xab6b('0x11a')](_0x14bf77[_0xab6b('0x3f')][_0xab6b('0x69')])){for(var _0x2b44f9=0x0;_0x2b44f9<_0x14bf77[_0xab6b('0x3f')][_0xab6b('0x69')][_0xab6b('0x44')];_0x2b44f9+=0x1){socket[_0xab6b('0x117')](_0xab6b('0x11b'),{'UserId':Number(_0x14bf77[_0xab6b('0x3f')][_0xab6b('0x69')][_0x2b44f9]),'ChatWebsiteId':Number(_0x14bf77[_0xab6b('0x51')]['id'])});}}else{socket[_0xab6b('0x117')](_0xab6b('0x11b'),{'UserId':Number(_0x14bf77[_0xab6b('0x3f')][_0xab6b('0x69')]),'ChatWebsiteId':Number(_0x14bf77[_0xab6b('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x4e1f3f,null))['catch'](handleError(_0x4e1f3f,null));};exports[_0xab6b('0x11c')]=function(_0x3fea3d,_0x567db1,_0x8b1e6d){var _0x2079cd={};var _0x5bcc8b={};var _0x4024fc;var _0xee0b02;return db['ChatWebsite']['findOne']({'where':{'id':_0x3fea3d['params']['id']}})[_0xab6b('0x1f')](handleEntityNotFound(_0x567db1,null))[_0xab6b('0x1f')](function(_0xd300a0){if(_0xd300a0){_0x4024fc=_0xd300a0;_0x5bcc8b['model']=_[_0xab6b('0x40')](db[_0xab6b('0x11d')][_0xab6b('0x3a')]);_0x5bcc8b[_0xab6b('0x3f')]=_[_0xab6b('0x40')](_0x3fea3d['query']);_0x5bcc8b['filters']=_[_0xab6b('0x53')](_0x5bcc8b[_0xab6b('0x3e')],_0x5bcc8b[_0xab6b('0x3f')]);_0x2079cd[_0xab6b('0x42')]=_['intersection'](_0x5bcc8b[_0xab6b('0x3e')],qs[_0xab6b('0x43')](_0x3fea3d[_0xab6b('0x3f')]['fields']));_0x2079cd[_0xab6b('0x42')]=_0x2079cd[_0xab6b('0x42')][_0xab6b('0x44')]?_0x2079cd[_0xab6b('0x42')]:_0x5bcc8b['model'];_0x2079cd['order']=qs[_0xab6b('0x48')](_0x3fea3d[_0xab6b('0x3f')][_0xab6b('0x48')]);_0x2079cd['where']=qs[_0xab6b('0x41')](_[_0xab6b('0x66')](_0x3fea3d['query'],_0x5bcc8b[_0xab6b('0x41')]));if(_0x3fea3d[_0xab6b('0x3f')][_0xab6b('0x49')]){_0x2079cd[_0xab6b('0x4b')]=_[_0xab6b('0x4a')](_0x2079cd[_0xab6b('0x4b')],{'$or':_[_0xab6b('0x38')](_0x2079cd[_0xab6b('0x42')],function(_0x1bf85d){var _0x54b2f5={};_0x54b2f5[_0x1bf85d]={'$like':'%'+_0x3fea3d[_0xab6b('0x3f')][_0xab6b('0x49')]+'%'};return _0x54b2f5;})});}_0x2079cd=_[_0xab6b('0x4a')]({},_0x2079cd,_0x3fea3d['options']);return _0x4024fc[_0xab6b('0x11c')](_0x2079cd);}})[_0xab6b('0x1f')](function(_0x1df2c7){if(_0x1df2c7){_0xee0b02=_0x1df2c7[_0xab6b('0x44')];if(!_0x3fea3d['query'][_0xab6b('0x65')](_0xab6b('0x45'))){_0x2079cd[_0xab6b('0x46')]=qs[_0xab6b('0x46')](_0x3fea3d['query'][_0xab6b('0x46')]);_0x2079cd[_0xab6b('0x2c')]=qs[_0xab6b('0x2c')](_0x3fea3d['query'][_0xab6b('0x2c')]);}return _0x4024fc['getAgents'](_0x2079cd);}})['then'](function(_0x1e6d80){if(_0x1e6d80){return _0x1e6d80?{'count':_0xee0b02,'rows':_0x1e6d80}:null;}})[_0xab6b('0x1f')](respondWithResult(_0x567db1,null))[_0xab6b('0x28')](handleError(_0x567db1,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index e1bbc2e..2ba017d 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 _0x6dfa=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','remove','emit'];(function(_0x5d8c1b,_0x38c5cb){var _0x5d0692=function(_0x24a39f){while(--_0x24a39f){_0x5d8c1b['push'](_0x5d8c1b['shift']());}};_0x5d0692(++_0x38c5cb);}(_0x6dfa,0x7b));var _0xa6df=function(_0xcf141e,_0x1ad395){_0xcf141e=_0xcf141e-0x0;var _0x4ed164=_0x6dfa[_0xcf141e];return _0x4ed164;};'use strict';var EventEmitter=require(_0xa6df('0x0'));var ChatWebsite=require(_0xa6df('0x1'))['db'][_0xa6df('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xa6df('0x3')](0x0);var events={'afterCreate':_0xa6df('0x4'),'afterUpdate':'update','afterDestroy':_0xa6df('0x5')};function emitEvent(_0x4e356f){return function(_0x2ea163,_0x4da450,_0x5b92a8){ChatWebsiteEvents[_0xa6df('0x6')](_0x4e356f+':'+_0x2ea163['id'],_0x2ea163);ChatWebsiteEvents[_0xa6df('0x6')](_0x4e356f,_0x2ea163);_0x5b92a8(null);};}for(var e in events){if(events[_0xa6df('0x7')](e)){var event=events[e];ChatWebsite[_0xa6df('0x8')](e,emitEvent(event));}}module[_0xa6df('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x194c=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove'];(function(_0x3b684e,_0x357ce4){var _0x21a5cb=function(_0x4f88a1){while(--_0x4f88a1){_0x3b684e['push'](_0x3b684e['shift']());}};_0x21a5cb(++_0x357ce4);}(_0x194c,0x19b));var _0xc194=function(_0xd547d1,_0x4d950c){_0xd547d1=_0xd547d1-0x0;var _0x24397f=_0x194c[_0xd547d1];return _0x24397f;};'use strict';var EventEmitter=require(_0xc194('0x0'));var ChatWebsite=require(_0xc194('0x1'))['db'][_0xc194('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xc194('0x3')](0x0);var events={'afterCreate':_0xc194('0x4'),'afterUpdate':_0xc194('0x5'),'afterDestroy':_0xc194('0x6')};function emitEvent(_0x5dc507){return function(_0x36b61d,_0x652a0f,_0x193efb){ChatWebsiteEvents[_0xc194('0x7')](_0x5dc507+':'+_0x36b61d['id'],_0x36b61d);ChatWebsiteEvents[_0xc194('0x7')](_0x5dc507,_0x36b61d);_0x193efb(null);};}for(var e in events){if(events[_0xc194('0x8')](e)){var event=events[e];ChatWebsite[_0xc194('0x9')](e,emitEvent(event));}}module[_0xc194('0xa')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 982cdcb..761abf3 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 _0xd404=['util','api','moment','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','chat_websites','lodash'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xd404,0x15b));var _0x4d40=function(_0x1bd7eb,_0x153e3c){_0x1bd7eb=_0x1bd7eb-0x0;var _0x379201=_0xd404[_0x1bd7eb];return _0x379201;};'use strict';var _=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var logger=require('../../config/logger')(_0x4d40('0x2'));var moment=require(_0x4d40('0x3'));var BPromise=require('bluebird');var rp=require(_0x4d40('0x4'));var fs=require('fs');var path=require(_0x4d40('0x5'));var rimraf=require(_0x4d40('0x6'));var config=require(_0x4d40('0x7'));var attributes=require(_0x4d40('0x8'));module[_0x4d40('0x9')]=function(_0xc2a9db,_0x24a237){return _0xc2a9db[_0x4d40('0xa')]('ChatWebsite',attributes,{'tableName':_0x4d40('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdb7=['request-promise','path','rimraf','./chatWebsite.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(_0x5bd5fc,_0x57597){_0x5bd5fc=_0x5bd5fc-0x0;var _0x420110=_0xbdb7[_0x5bd5fc];return _0x420110;};'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')]('ChatWebsite',attributes,{'tableName':'chat_websites','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 226b617..ce86599 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 _0x5c3c=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util'];(function(_0x36c39e,_0x383ba0){var _0x5307b7=function(_0x594d83){while(--_0x594d83){_0x36c39e['push'](_0x36c39e['shift']());}};_0x5307b7(++_0x383ba0);}(_0x5c3c,0x132));var _0xc5c3=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5c3c[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xc5c3('0xd'),'port':0x18eb});var socket=require(_0xc5c3('0xe'))(new Redis(config['redis']));require(_0xc5c3('0xf'))[_0xc5c3('0x10')](socket);function respondWithRpcPromise(_0x52f3eb,_0x14140f,_0x2a1d19){return new BPromise(function(_0x4e329f,_0x1f2e34){return client[_0xc5c3('0x11')](_0x52f3eb,_0x2a1d19)[_0xc5c3('0x12')](function(_0x59fb60){logger[_0xc5c3('0x13')](_0xc5c3('0x14'),_0x14140f,'request\x20sent');logger[_0xc5c3('0x15')](_0xc5c3('0x16'),_0x14140f,_0xc5c3('0x17'),JSON['stringify'](_0x59fb60));if(_0x59fb60[_0xc5c3('0x18')]){if(_0x59fb60[_0xc5c3('0x18')][_0xc5c3('0x19')]===0x1f4){logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x59fb60['error']['message']);return _0x1f2e34(_0x59fb60[_0xc5c3('0x18')][_0xc5c3('0x1a')]);}logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x59fb60['error']['message']);return _0x4e329f(_0x59fb60[_0xc5c3('0x18')]['message']);}else{logger[_0xc5c3('0x13')](_0xc5c3('0x14'),_0x14140f,_0xc5c3('0x17'));_0x4e329f(_0x59fb60[_0xc5c3('0x1b')][_0xc5c3('0x1a')]);}})['catch'](function(_0x364f42){logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x364f42);_0x1f2e34(_0x364f42);});});} \ No newline at end of file +var _0xd943=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','localhost','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x5e56f4,_0x171f01){var _0x1339df=function(_0x5e5914){while(--_0x5e5914){_0x5e56f4['push'](_0x5e56f4['shift']());}};_0x1339df(++_0x171f01);}(_0xd943,0x15d));var _0x3d94=function(_0x175cc9,_0x25379a){_0x175cc9=_0x175cc9-0x0;var _0x15abd5=_0xd943[_0x175cc9];return _0x15abd5;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x3d94('0xa')],{'host':_0x3d94('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d94('0xc'))[_0x3d94('0xd')](socket);function respondWithRpcPromise(_0x1cc58c,_0x5908a7,_0x182066){return new BPromise(function(_0x4ac968,_0x39e2fa){return client[_0x3d94('0xe')](_0x1cc58c,_0x182066)['then'](function(_0x1897de){logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));logger[_0x3d94('0x12')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5908a7,_0x3d94('0x11'),JSON[_0x3d94('0x13')](_0x1897de));if(_0x1897de[_0x3d94('0x14')]){if(_0x1897de['error'][_0x3d94('0x15')]===0x1f4){logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de['error'][_0x3d94('0x16')]);return _0x39e2fa(_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);}logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);return _0x4ac968(_0x1897de[_0x3d94('0x14')]['message']);}else{logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));_0x4ac968(_0x1897de[_0x3d94('0x17')][_0x3d94('0x16')]);}})[_0x3d94('0x18')](function(_0xef8b3){logger['error'](_0x3d94('0x10'),_0x5908a7,_0xef8b3);_0x39e2fa(_0xef8b3);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 00a9c91..0e113bf 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(_0x34ad17,_0x246dce){var _0x3dc241=function(_0xa8a137){while(--_0xa8a137){_0x34ad17['push'](_0x34ad17['shift']());}};_0x3dc241(++_0x246dce);}(_0x5f2f,0x73));var _0xf5f2=function(_0x481110,_0x2ff73b){_0x481110=_0x481110-0x0;var _0x56e6bf=_0x5f2f[_0x481110];return _0x56e6bf;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x5ca353,_0x21eb37){var _0x4f2fe5=function(_0x14cd1b){while(--_0x14cd1b){_0x5ca353['push'](_0x5ca353['shift']());}};_0x4f2fe5(++_0x21eb37);}(_0xb10b,0x12a));var _0xbb10=function(_0x564674,_0x462e46){_0x564674=_0x564674-0x0;var _0x5a8b9e=_0xb10b[_0x564674];return _0x5a8b9e;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index ebc5d05..86061b2 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 _0xfa2c=['addAnswer','diskStorage','root','server/files/images/logos/','format','now','originalname','single','addLogo','join','file','addAvatar','server/files/images/avatars/','%s-%s','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','offline','addApplications','/:id/proactive_actions','addProactiveActions','put','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','/:id/avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','addDisposition'];(function(_0x5cd719,_0x13e040){var _0x17d058=function(_0x1174c1){while(--_0x1174c1){_0x5cd719['push'](_0x5cd719['shift']());}};_0x17d058(++_0x13e040);}(_0xfa2c,0xda));var _0xcfa2=function(_0x3c7a12,_0x4e0a6d){_0x3c7a12=_0x3c7a12-0x0;var _0x386cd6=_0xfa2c[_0x3c7a12];return _0x386cd6;};'use strict';var multer=require(_0xcfa2('0x0'));var util=require(_0xcfa2('0x1'));var path=require(_0xcfa2('0x2'));var timeout=require('connect-timeout');var express=require(_0xcfa2('0x3'));var router=express[_0xcfa2('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcfa2('0x5'));var controller=require(_0xcfa2('0x6'));router[_0xcfa2('0x7')]('/',auth[_0xcfa2('0x8')](),controller[_0xcfa2('0x9')]);router[_0xcfa2('0x7')](_0xcfa2('0xa'),auth[_0xcfa2('0x8')](),controller[_0xcfa2('0xb')]);router[_0xcfa2('0x7')](_0xcfa2('0xc'),auth[_0xcfa2('0x8')](),controller[_0xcfa2('0xd')]);router[_0xcfa2('0x7')](_0xcfa2('0xe'),auth['isAuthenticated'](),controller[_0xcfa2('0xf')]);router[_0xcfa2('0x7')](_0xcfa2('0x10'),auth[_0xcfa2('0x8')](),controller['getAnswers']);router[_0xcfa2('0x7')](_0xcfa2('0x11'),controller['getLogo']);router[_0xcfa2('0x7')](_0xcfa2('0x12'),controller['getAvatar']);router['get']('/:id/customer_avatar',controller['getCustomerAvatar']);router[_0xcfa2('0x7')](_0xcfa2('0x13'),controller[_0xcfa2('0x14')]);router[_0xcfa2('0x7')](_0xcfa2('0x15'),auth[_0xcfa2('0x8')](),controller['getInteractions']);router[_0xcfa2('0x7')](_0xcfa2('0x16'),controller[_0xcfa2('0x17')]);router['get'](_0xcfa2('0x18'),auth[_0xcfa2('0x8')](),controller[_0xcfa2('0x19')]);router[_0xcfa2('0x7')]('/:id/proactive_actions',auth[_0xcfa2('0x8')](),controller['getProactiveActions']);router[_0xcfa2('0x7')](_0xcfa2('0x1a'),controller[_0xcfa2('0x1b')]);router[_0xcfa2('0x7')](_0xcfa2('0x1c'),auth[_0xcfa2('0x8')](),controller[_0xcfa2('0x1d')]);router['get'](_0xcfa2('0x1e'),auth['isAuthenticated'](),controller['getAgents']);router[_0xcfa2('0x1f')]('/',auth[_0xcfa2('0x8')](),controller[_0xcfa2('0x20')]);router[_0xcfa2('0x1f')](_0xcfa2('0xe'),auth[_0xcfa2('0x8')](),controller[_0xcfa2('0x21')]);router['post'](_0xcfa2('0x10'),auth['isAuthenticated'](),controller[_0xcfa2('0x22')]);var upload=multer({'storage':multer[_0xcfa2('0x23')]({'destination':function(_0x110b93,_0x507c71,_0x313ea2){_0x313ea2(null,path['join'](config[_0xcfa2('0x24')],_0xcfa2('0x25')));},'filename':function(_0x4bb2bc,_0xaa8f9f,_0x227437){_0x227437(null,util[_0xcfa2('0x26')]('%s-%s',Date[_0xcfa2('0x27')](),_0xaa8f9f[_0xcfa2('0x28')]));}})});router[_0xcfa2('0x1f')](_0xcfa2('0x11'),upload[_0xcfa2('0x29')]('file'),controller[_0xcfa2('0x2a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x524d53,_0x2cdf83,_0x4e7626){_0x4e7626(null,path[_0xcfa2('0x2b')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x3ab97e,_0x2d7de4,_0x390713){_0x390713(null,util[_0xcfa2('0x26')]('%s-%s',Date[_0xcfa2('0x27')](),_0x2d7de4[_0xcfa2('0x28')]));}})});router['post'](_0xcfa2('0x12'),upload['single'](_0xcfa2('0x2c')),controller[_0xcfa2('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4c7724,_0x47f4f4,_0x99595c){_0x99595c(null,path['join'](config[_0xcfa2('0x24')],_0xcfa2('0x2e')));},'filename':function(_0x4a9804,_0x362cf6,_0x5becd8){_0x5becd8(null,util[_0xcfa2('0x26')](_0xcfa2('0x2f'),Date[_0xcfa2('0x27')](),_0x362cf6[_0xcfa2('0x28')]));}})});router[_0xcfa2('0x1f')](_0xcfa2('0x30'),upload[_0xcfa2('0x29')](_0xcfa2('0x2c')),controller[_0xcfa2('0x31')]);var upload=multer({'storage':multer[_0xcfa2('0x23')]({'destination':function(_0x5650b6,_0x51c4e2,_0x4ddc9e){_0x4ddc9e(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x255664,_0x2a2b1a,_0x5012fa){_0x5012fa(null,util['format'](_0xcfa2('0x2f'),Date[_0xcfa2('0x27')](),_0x2a2b1a[_0xcfa2('0x28')]));}})});router[_0xcfa2('0x1f')](_0xcfa2('0x13'),upload[_0xcfa2('0x29')](_0xcfa2('0x2c')),controller[_0xcfa2('0x32')]);router[_0xcfa2('0x1f')](_0xcfa2('0x33'),controller[_0xcfa2('0x34')]);router[_0xcfa2('0x1f')]('/:id/offline',controller[_0xcfa2('0x35')]);router['post'](_0xcfa2('0x15'),auth[_0xcfa2('0x8')](),controller['addInteraction']);router['post'](_0xcfa2('0x18'),auth['isAuthenticated'](),controller[_0xcfa2('0x36')]);router[_0xcfa2('0x1f')](_0xcfa2('0x37'),auth[_0xcfa2('0x8')](),controller[_0xcfa2('0x38')]);router[_0xcfa2('0x1f')](_0xcfa2('0x1e'),auth[_0xcfa2('0x8')](),controller['addAgents']);router[_0xcfa2('0x39')](_0xcfa2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xcfa2('0x3a')](_0xcfa2('0xc'),auth[_0xcfa2('0x8')](),controller[_0xcfa2('0x3b')]);router[_0xcfa2('0x3a')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0xcfa2('0x3a')](_0xcfa2('0x10'),auth[_0xcfa2('0x8')](),controller[_0xcfa2('0x3c')]);router[_0xcfa2('0x3a')]('/:id/users',auth[_0xcfa2('0x8')](),controller[_0xcfa2('0x3d')]);module[_0xcfa2('0x3e')]=router; \ No newline at end of file +var _0xc84e=['addSystemAvatar','/:id/notify','notify','addInteraction','addApplications','addProactiveActions','addAgents','put','delete','destroy','removeAgents','multer','path','connect-timeout','express','Router','../../components/auth/service','./chatWebsite.controller','get','isAuthenticated','describe','/:id','getDispositions','/:id/canned_answers','/:id/logo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','/:id/dispositions','addDisposition','addAnswer','diskStorage','server/files/images/logos/','format','originalname','single','file','join','root','server/files/images/avatars/','%s-%s','now','addAvatar'];(function(_0x3cca7a,_0x109a23){var _0x34e717=function(_0x19a41f){while(--_0x19a41f){_0x3cca7a['push'](_0x3cca7a['shift']());}};_0x34e717(++_0x109a23);}(_0xc84e,0x81));var _0xec84=function(_0x2f7e4c,_0x19d5b8){_0x2f7e4c=_0x2f7e4c-0x0;var _0x272b34=_0xc84e[_0x2f7e4c];return _0x272b34;};'use strict';var multer=require(_0xec84('0x0'));var util=require('util');var path=require(_0xec84('0x1'));var timeout=require(_0xec84('0x2'));var express=require(_0xec84('0x3'));var router=express[_0xec84('0x4')]();var auth=require(_0xec84('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xec84('0x6'));router[_0xec84('0x7')]('/',auth[_0xec84('0x8')](),controller['index']);router[_0xec84('0x7')]('/describe',auth[_0xec84('0x8')](),controller[_0xec84('0x9')]);router[_0xec84('0x7')](_0xec84('0xa'),auth[_0xec84('0x8')](),controller['show']);router[_0xec84('0x7')]('/:id/dispositions',auth[_0xec84('0x8')](),controller[_0xec84('0xb')]);router[_0xec84('0x7')](_0xec84('0xc'),auth[_0xec84('0x8')](),controller['getAnswers']);router[_0xec84('0x7')](_0xec84('0xd'),controller['getLogo']);router[_0xec84('0x7')](_0xec84('0xe'),controller['getAvatar']);router[_0xec84('0x7')](_0xec84('0xf'),controller[_0xec84('0x10')]);router[_0xec84('0x7')](_0xec84('0x11'),controller[_0xec84('0x12')]);router[_0xec84('0x7')](_0xec84('0x13'),auth[_0xec84('0x8')](),controller[_0xec84('0x14')]);router[_0xec84('0x7')]('/:id/snippet',controller['getSnippet']);router[_0xec84('0x7')](_0xec84('0x15'),auth[_0xec84('0x8')](),controller[_0xec84('0x16')]);router[_0xec84('0x7')](_0xec84('0x17'),auth['isAuthenticated'](),controller[_0xec84('0x18')]);router[_0xec84('0x7')](_0xec84('0x19'),controller[_0xec84('0x1a')]);router[_0xec84('0x7')](_0xec84('0x1b'),auth[_0xec84('0x8')](),controller[_0xec84('0x1c')]);router[_0xec84('0x7')](_0xec84('0x1d'),auth[_0xec84('0x8')](),controller[_0xec84('0x1e')]);router['post']('/',auth['isAuthenticated'](),controller[_0xec84('0x1f')]);router[_0xec84('0x20')](_0xec84('0x21'),auth[_0xec84('0x8')](),controller[_0xec84('0x22')]);router[_0xec84('0x20')](_0xec84('0xc'),auth['isAuthenticated'](),controller[_0xec84('0x23')]);var upload=multer({'storage':multer[_0xec84('0x24')]({'destination':function(_0x2dcbe3,_0x58f885,_0x141ee5){_0x141ee5(null,path['join'](config['root'],_0xec84('0x25')));},'filename':function(_0x1d81a1,_0x398a78,_0x369ed1){_0x369ed1(null,util[_0xec84('0x26')]('%s-%s',Date['now'](),_0x398a78[_0xec84('0x27')]));}})});router[_0xec84('0x20')](_0xec84('0xd'),upload[_0xec84('0x28')](_0xec84('0x29')),controller['addLogo']);var upload=multer({'storage':multer[_0xec84('0x24')]({'destination':function(_0x288f60,_0x4ed476,_0xd45d5a){_0xd45d5a(null,path[_0xec84('0x2a')](config[_0xec84('0x2b')],_0xec84('0x2c')));},'filename':function(_0x503f2b,_0x6f5eea,_0x58abc3){_0x58abc3(null,util[_0xec84('0x26')](_0xec84('0x2d'),Date[_0xec84('0x2e')](),_0x6f5eea[_0xec84('0x27')]));}})});router[_0xec84('0x20')](_0xec84('0xe'),upload[_0xec84('0x28')](_0xec84('0x29')),controller[_0xec84('0x2f')]);var upload=multer({'storage':multer[_0xec84('0x24')]({'destination':function(_0x56437e,_0x446a82,_0x1e6540){_0x1e6540(null,path[_0xec84('0x2a')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x41ea63,_0x259f78,_0x31031a){_0x31031a(null,util[_0xec84('0x26')]('%s-%s',Date['now'](),_0x259f78[_0xec84('0x27')]));}})});router[_0xec84('0x20')]('/:id/customer_avatar',upload[_0xec84('0x28')](_0xec84('0x29')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x17a2ae,_0x2fb4e4,_0x3d22d7){_0x3d22d7(null,path[_0xec84('0x2a')](config[_0xec84('0x2b')],_0xec84('0x2c')));},'filename':function(_0x572e96,_0x40ffb8,_0x3d34d4){_0x3d34d4(null,util['format'](_0xec84('0x2d'),Date[_0xec84('0x2e')](),_0x40ffb8[_0xec84('0x27')]));}})});router[_0xec84('0x20')](_0xec84('0x11'),upload['single'](_0xec84('0x29')),controller[_0xec84('0x30')]);router[_0xec84('0x20')](_0xec84('0x31'),controller[_0xec84('0x32')]);router[_0xec84('0x20')]('/:id/offline',controller['offline']);router[_0xec84('0x20')]('/:id/interactions',auth[_0xec84('0x8')](),controller[_0xec84('0x33')]);router[_0xec84('0x20')](_0xec84('0x15'),auth[_0xec84('0x8')](),controller[_0xec84('0x34')]);router[_0xec84('0x20')]('/:id/proactive_actions',auth[_0xec84('0x8')](),controller[_0xec84('0x35')]);router[_0xec84('0x20')](_0xec84('0x1d'),auth[_0xec84('0x8')](),controller[_0xec84('0x36')]);router[_0xec84('0x37')](_0xec84('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xec84('0x38')](_0xec84('0xa'),auth[_0xec84('0x8')](),controller[_0xec84('0x39')]);router[_0xec84('0x38')]('/:id/dispositions',auth[_0xec84('0x8')](),controller['removeDispositions']);router['delete'](_0xec84('0xc'),auth[_0xec84('0x8')](),controller['removeAnswers']);router[_0xec84('0x38')](_0xec84('0x1d'),auth[_0xec84('0x8')](),controller[_0xec84('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 7da7323..a9b946b 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 _0x292c=['AmazonAWS','Google','sequelize','STRING','ENUM'];(function(_0x2086d8,_0x52cf3d){var _0xb4861c=function(_0x3b3d77){while(--_0x3b3d77){_0x2086d8['push'](_0x2086d8['shift']());}};_0xb4861c(++_0x52cf3d);}(_0x292c,0x66));var _0xc292=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x292c[_0x3e112d];return _0x531c31;};'use strict';var Sequelize=require(_0xc292('0x0'));module['exports']={'name':{'type':Sequelize[_0xc292('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc292('0x2')](_0xc292('0x3'),_0xc292('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xc292('0x1')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6808=['exports','STRING','ENUM','AmazonAWS','Google','sequelize'];(function(_0x209511,_0x231622){var _0x39b937=function(_0x4005a3){while(--_0x4005a3){_0x209511['push'](_0x209511['shift']());}};_0x39b937(++_0x231622);}(_0x6808,0xd1));var _0x8680=function(_0x5c2d92,_0xe3adf8){_0x5c2d92=_0x5c2d92-0x0;var _0x4848a6=_0x6808[_0x5c2d92];return _0x4848a6;};'use strict';var Sequelize=require(_0x8680('0x0'));module[_0x8680('0x1')]={'name':{'type':Sequelize[_0x8680('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x8680('0x3')](_0x8680('0x4'),_0x8680('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x8680('0x2')]},'data2':{'type':Sequelize[_0x8680('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index a4819ef..3a736e7 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 _0x4379=['query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','filtears','fields','length','include','find','create','body','update','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','apply','reject','save','destroy','then','end','sendStatus','error','name','send','index','CloudProvider','rawAttributes','fieldName','type','key','map'];(function(_0x3b0789,_0x15abed){var _0x4547b4=function(_0x5aaf22){while(--_0x5aaf22){_0x3b0789['push'](_0x3b0789['shift']());}};_0x4547b4(++_0x15abed);}(_0x4379,0x1e6));var _0x9437=function(_0x16a482,_0x2dd780){_0x16a482=_0x16a482-0x0;var _0x192f71=_0x4379[_0x16a482];return _0x192f71;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9437('0x0'));var zipdir=require(_0x9437('0x1'));var jsonpatch=require(_0x9437('0x2'));var rp=require(_0x9437('0x3'));var moment=require('moment');var BPromise=require(_0x9437('0x4'));var Mustache=require(_0x9437('0x5'));var util=require(_0x9437('0x6'));var path=require(_0x9437('0x7'));var sox=require(_0x9437('0x8'));var csv=require('to-csv');var ejs=require(_0x9437('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9437('0xa'));var crypto=require(_0x9437('0xb'));var jsforce=require(_0x9437('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9437('0xd'));var querystring=require(_0x9437('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9437('0xf'));var qs=require(_0x9437('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9437('0x11'));var logger=require(_0x9437('0x12'))(_0x9437('0x13'));var utils=require('../../config/utils');var config=require(_0x9437('0x14'));var licenseUtil=require(_0x9437('0x15'));var db=require(_0x9437('0x16'))['db'];function respondWithStatusCode(_0x16de8f,_0x58276e){_0x58276e=_0x58276e||0xcc;return function(_0x29c60b){if(_0x29c60b){return _0x16de8f['sendStatus'](_0x58276e);}return _0x16de8f['status'](_0x58276e)['end']();};}function respondWithResult(_0x17a73a,_0x126772){_0x126772=_0x126772||0xc8;return function(_0x3ba574){if(_0x3ba574){return _0x17a73a[_0x9437('0x17')](_0x126772)[_0x9437('0x18')](_0x3ba574);}};}function respondWithFilteredResult(_0x4bdc58,_0xf00dcc){return function(_0x5868c4){if(_0x5868c4){var _0x472980=_0x5868c4[_0x9437('0x19')],_0x5b3a44=_0xf00dcc[_0x9437('0x1a')],_0x33f6b3=_0xf00dcc[_0x9437('0x1a')]+_0xf00dcc[_0x9437('0x1b')],_0x55894f;if(_0x33f6b3>=_0x472980){_0x33f6b3=_0x472980;_0x55894f=0xc8;}else{_0x55894f=0xce;}_0x4bdc58[_0x9437('0x17')](_0x55894f);return _0x4bdc58[_0x9437('0x1c')]('Content-Range',_0x5b3a44+'-'+_0x33f6b3+'/'+_0x472980)[_0x9437('0x18')](_0x5868c4);}return null;};}function patchUpdates(_0x1f98e7){return function(_0x4dda92){try{jsonpatch[_0x9437('0x1d')](_0x4dda92,_0x1f98e7,!![]);}catch(_0x58b88e){return BPromise[_0x9437('0x1e')](_0x58b88e);}return _0x4dda92[_0x9437('0x1f')]();};}function saveUpdates(_0x217197,_0x538c83){return function(_0x2da417){if(_0x2da417){return _0x2da417['update'](_0x217197)['then'](function(_0x357738){return _0x357738;});}return null;};}function removeEntity(_0x387de3,_0xd55408){return function(_0x3044aa){if(_0x3044aa){return _0x3044aa[_0x9437('0x20')]()[_0x9437('0x21')](function(){_0x387de3[_0x9437('0x17')](0xcc)[_0x9437('0x22')]();});}};}function handleEntityNotFound(_0x526bde,_0x4be545){return function(_0x4baa59){if(!_0x4baa59){_0x526bde[_0x9437('0x23')](0x194);}return _0x4baa59;};}function handleError(_0x21ab3b,_0x3219b9){_0x3219b9=_0x3219b9||0x1f4;return function(_0x4bff85){logger[_0x9437('0x24')](_0x4bff85['stack']);if(_0x4bff85[_0x9437('0x25')]){delete _0x4bff85['name'];}_0x21ab3b[_0x9437('0x17')](_0x3219b9)[_0x9437('0x26')](_0x4bff85);};}exports[_0x9437('0x27')]=function(_0x59f2e2,_0x97730e){var _0x3329a5={},_0x43adae={},_0x473b3e={'count':0x0,'rows':[]};var _0x1f2c1a=_['map'](db[_0x9437('0x28')][_0x9437('0x29')],function(_0x58ffd4){return{'name':_0x58ffd4[_0x9437('0x2a')],'type':_0x58ffd4[_0x9437('0x2b')][_0x9437('0x2c')]};});_0x43adae['model']=_[_0x9437('0x2d')](_0x1f2c1a,_0x9437('0x25'));_0x43adae[_0x9437('0x2e')]=_[_0x9437('0x2f')](_0x59f2e2['query']);_0x43adae[_0x9437('0x30')]=_[_0x9437('0x31')](_0x43adae[_0x9437('0x32')],_0x43adae[_0x9437('0x2e')]);_0x3329a5[_0x9437('0x33')]=_[_0x9437('0x31')](_0x43adae['model'],qs['fields'](_0x59f2e2[_0x9437('0x2e')]['fields']));_0x3329a5[_0x9437('0x33')]=_0x3329a5[_0x9437('0x33')]['length']?_0x3329a5[_0x9437('0x33')]:_0x43adae['model'];if(!_0x59f2e2[_0x9437('0x2e')][_0x9437('0x34')](_0x9437('0x35'))){_0x3329a5[_0x9437('0x1b')]=qs['limit'](_0x59f2e2[_0x9437('0x2e')][_0x9437('0x1b')]);_0x3329a5['offset']=qs[_0x9437('0x1a')](_0x59f2e2[_0x9437('0x2e')][_0x9437('0x1a')]);}_0x3329a5[_0x9437('0x36')]=qs[_0x9437('0x37')](_0x59f2e2[_0x9437('0x2e')]['sort']);_0x3329a5[_0x9437('0x38')]=qs[_0x9437('0x30')](_[_0x9437('0x39')](_0x59f2e2['query'],_0x43adae[_0x9437('0x30')]),_0x1f2c1a);if(_0x59f2e2[_0x9437('0x2e')][_0x9437('0x3a')]){_0x3329a5['where']=_[_0x9437('0x3b')](_0x3329a5[_0x9437('0x38')],{'$or':_['map'](_0x1f2c1a,function(_0x49afd7){if(_0x49afd7[_0x9437('0x2b')]!==_0x9437('0x3c')){var _0x47f6af={};_0x47f6af[_0x49afd7['name']]={'$like':'%'+_0x59f2e2[_0x9437('0x2e')][_0x9437('0x3a')]+'%'};return _0x47f6af;}})});}_0x3329a5=_[_0x9437('0x3b')]({},_0x3329a5,_0x59f2e2[_0x9437('0x3d')]);var _0x519deb={'where':_0x3329a5[_0x9437('0x38')]};return db[_0x9437('0x28')][_0x9437('0x19')](_0x519deb)[_0x9437('0x21')](function(_0x9a04fd){_0x473b3e[_0x9437('0x19')]=_0x9a04fd;if(_0x59f2e2[_0x9437('0x2e')][_0x9437('0x3e')]){_0x3329a5['include']=[{'all':!![]}];}return db[_0x9437('0x28')][_0x9437('0x3f')](_0x3329a5);})[_0x9437('0x21')](function(_0x1344a3){_0x473b3e[_0x9437('0x40')]=_0x1344a3;return _0x473b3e;})[_0x9437('0x21')](respondWithFilteredResult(_0x97730e,_0x3329a5))[_0x9437('0x41')](handleError(_0x97730e,null));};exports[_0x9437('0x42')]=function(_0x16da11,_0xb2e396){var _0x5a9fee={'raw':!![],'where':{'id':_0x16da11['params']['id']}},_0x33d3d9={};_0x33d3d9[_0x9437('0x32')]=_[_0x9437('0x2f')](db[_0x9437('0x28')][_0x9437('0x29')]);_0x33d3d9[_0x9437('0x2e')]=_[_0x9437('0x2f')](_0x16da11['query']);_0x33d3d9[_0x9437('0x43')]=_[_0x9437('0x31')](_0x33d3d9[_0x9437('0x32')],_0x33d3d9[_0x9437('0x2e')]);_0x5a9fee[_0x9437('0x33')]=_[_0x9437('0x31')](_0x33d3d9[_0x9437('0x32')],qs[_0x9437('0x44')](_0x16da11['query']['fields']));_0x5a9fee[_0x9437('0x33')]=_0x5a9fee[_0x9437('0x33')][_0x9437('0x45')]?_0x5a9fee['attributes']:_0x33d3d9[_0x9437('0x32')];if(_0x16da11[_0x9437('0x2e')][_0x9437('0x3e')]){_0x5a9fee[_0x9437('0x46')]=[{'all':!![]}];}_0x5a9fee=_[_0x9437('0x3b')]({},_0x5a9fee,_0x16da11['options']);return db[_0x9437('0x28')][_0x9437('0x47')](_0x5a9fee)['then'](handleEntityNotFound(_0xb2e396,null))[_0x9437('0x21')](respondWithResult(_0xb2e396,null))[_0x9437('0x41')](handleError(_0xb2e396,null));};exports[_0x9437('0x48')]=function(_0x56d2ad,_0x4ed9c6){return db[_0x9437('0x28')][_0x9437('0x48')](_0x56d2ad[_0x9437('0x49')],{})['then'](respondWithResult(_0x4ed9c6,0xc9))[_0x9437('0x41')](handleError(_0x4ed9c6,null));};exports[_0x9437('0x4a')]=function(_0x51d8a6,_0x2c4170){if(_0x51d8a6[_0x9437('0x49')]['id']){delete _0x51d8a6[_0x9437('0x49')]['id'];}return db[_0x9437('0x28')][_0x9437('0x47')]({'where':{'id':_0x51d8a6[_0x9437('0x4b')]['id']}})[_0x9437('0x21')](handleEntityNotFound(_0x2c4170,null))[_0x9437('0x21')](saveUpdates(_0x51d8a6['body'],null))['then'](respondWithResult(_0x2c4170,null))[_0x9437('0x41')](handleError(_0x2c4170,null));};exports[_0x9437('0x20')]=function(_0x550050,_0x327009){return db[_0x9437('0x28')][_0x9437('0x47')]({'where':{'id':_0x550050[_0x9437('0x4b')]['id']}})[_0x9437('0x21')](handleEntityNotFound(_0x327009,null))[_0x9437('0x21')](removeEntity(_0x327009,null))[_0x9437('0x41')](handleError(_0x327009,null));}; \ No newline at end of file +var _0xfb85=['hasOwnProperty','nolimit','limit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','CloudProvider','find','create','body','destroy','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','Content-Range','reject','save','update','then','error','name','rawAttributes','fieldName','key','map','query','keys','filters','model','attributes','intersection','fields','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb85,0x12e));var _0x5fb8=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xfb85[_0x5d2803];return _0xdcad2c;};'use strict';var pdf=require(_0x5fb8('0x0'));var emlformat=require(_0x5fb8('0x1'));var rimraf=require(_0x5fb8('0x2'));var zipdir=require(_0x5fb8('0x3'));var jsonpatch=require(_0x5fb8('0x4'));var rp=require('request-promise');var moment=require(_0x5fb8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5fb8('0x6'));var sox=require(_0x5fb8('0x7'));var csv=require(_0x5fb8('0x8'));var ejs=require(_0x5fb8('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5fb8('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5fb8('0xb'));var toCsv=require(_0x5fb8('0x8'));var querystring=require('querystring');var Papa=require(_0x5fb8('0xc'));var Redis=require(_0x5fb8('0xd'));var authService=require(_0x5fb8('0xe'));var qs=require(_0x5fb8('0xf'));var as=require(_0x5fb8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fb8('0x11'))(_0x5fb8('0x12'));var utils=require(_0x5fb8('0x13'));var config=require(_0x5fb8('0x14'));var licenseUtil=require(_0x5fb8('0x15'));var db=require(_0x5fb8('0x16'))['db'];function respondWithStatusCode(_0x1c5ce0,_0x3ca3d8){_0x3ca3d8=_0x3ca3d8||0xcc;return function(_0x5c9019){if(_0x5c9019){return _0x1c5ce0[_0x5fb8('0x17')](_0x3ca3d8);}return _0x1c5ce0['status'](_0x3ca3d8)[_0x5fb8('0x18')]();};}function respondWithResult(_0x2354fe,_0x21aceb){_0x21aceb=_0x21aceb||0xc8;return function(_0x96bfe4){if(_0x96bfe4){return _0x2354fe[_0x5fb8('0x19')](_0x21aceb)[_0x5fb8('0x1a')](_0x96bfe4);}};}function respondWithFilteredResult(_0x4d4b73,_0x5a0769){return function(_0x570569){if(_0x570569){var _0xf0240f=_0x570569[_0x5fb8('0x1b')],_0x8f4db6=_0x5a0769[_0x5fb8('0x1c')],_0x4bc9f6=_0x5a0769['offset']+_0x5a0769['limit'],_0x31c26d;if(_0x4bc9f6>=_0xf0240f){_0x4bc9f6=_0xf0240f;_0x31c26d=0xc8;}else{_0x31c26d=0xce;}_0x4d4b73[_0x5fb8('0x19')](_0x31c26d);return _0x4d4b73['set'](_0x5fb8('0x1d'),_0x8f4db6+'-'+_0x4bc9f6+'/'+_0xf0240f)[_0x5fb8('0x1a')](_0x570569);}return null;};}function patchUpdates(_0x605a0e){return function(_0x5f11cb){try{jsonpatch['apply'](_0x5f11cb,_0x605a0e,!![]);}catch(_0x592250){return BPromise[_0x5fb8('0x1e')](_0x592250);}return _0x5f11cb[_0x5fb8('0x1f')]();};}function saveUpdates(_0x334f69,_0x141ed3){return function(_0x281274){if(_0x281274){return _0x281274[_0x5fb8('0x20')](_0x334f69)[_0x5fb8('0x21')](function(_0x249d7d){return _0x249d7d;});}return null;};}function removeEntity(_0x278fa4,_0x5ed8ac){return function(_0x4023ec){if(_0x4023ec){return _0x4023ec['destroy']()[_0x5fb8('0x21')](function(){_0x278fa4[_0x5fb8('0x19')](0xcc)[_0x5fb8('0x18')]();});}};}function handleEntityNotFound(_0x50b97b,_0x5ee98a){return function(_0x3c3e8b){if(!_0x3c3e8b){_0x50b97b[_0x5fb8('0x17')](0x194);}return _0x3c3e8b;};}function handleError(_0x28a264,_0x2b711f){_0x2b711f=_0x2b711f||0x1f4;return function(_0x2bcaf2){logger[_0x5fb8('0x22')](_0x2bcaf2['stack']);if(_0x2bcaf2[_0x5fb8('0x23')]){delete _0x2bcaf2[_0x5fb8('0x23')];}_0x28a264[_0x5fb8('0x19')](_0x2b711f)['send'](_0x2bcaf2);};}exports['index']=function(_0x458f50,_0x560145){var _0x4c6c13={},_0x1ab1b1={},_0x3b518e={'count':0x0,'rows':[]};var _0x344cbf=_['map'](db['CloudProvider'][_0x5fb8('0x24')],function(_0x1e6a0f){return{'name':_0x1e6a0f[_0x5fb8('0x25')],'type':_0x1e6a0f['type'][_0x5fb8('0x26')]};});_0x1ab1b1['model']=_[_0x5fb8('0x27')](_0x344cbf,_0x5fb8('0x23'));_0x1ab1b1[_0x5fb8('0x28')]=_[_0x5fb8('0x29')](_0x458f50[_0x5fb8('0x28')]);_0x1ab1b1[_0x5fb8('0x2a')]=_['intersection'](_0x1ab1b1[_0x5fb8('0x2b')],_0x1ab1b1[_0x5fb8('0x28')]);_0x4c6c13[_0x5fb8('0x2c')]=_[_0x5fb8('0x2d')](_0x1ab1b1[_0x5fb8('0x2b')],qs[_0x5fb8('0x2e')](_0x458f50[_0x5fb8('0x28')][_0x5fb8('0x2e')]));_0x4c6c13['attributes']=_0x4c6c13[_0x5fb8('0x2c')][_0x5fb8('0x2f')]?_0x4c6c13[_0x5fb8('0x2c')]:_0x1ab1b1['model'];if(!_0x458f50[_0x5fb8('0x28')][_0x5fb8('0x30')](_0x5fb8('0x31'))){_0x4c6c13[_0x5fb8('0x32')]=qs[_0x5fb8('0x32')](_0x458f50[_0x5fb8('0x28')][_0x5fb8('0x32')]);_0x4c6c13[_0x5fb8('0x1c')]=qs[_0x5fb8('0x1c')](_0x458f50[_0x5fb8('0x28')][_0x5fb8('0x1c')]);}_0x4c6c13['order']=qs[_0x5fb8('0x33')](_0x458f50[_0x5fb8('0x28')][_0x5fb8('0x33')]);_0x4c6c13[_0x5fb8('0x34')]=qs['filters'](_[_0x5fb8('0x35')](_0x458f50[_0x5fb8('0x28')],_0x1ab1b1[_0x5fb8('0x2a')]),_0x344cbf);if(_0x458f50[_0x5fb8('0x28')]['filter']){_0x4c6c13[_0x5fb8('0x34')]=_[_0x5fb8('0x36')](_0x4c6c13[_0x5fb8('0x34')],{'$or':_[_0x5fb8('0x27')](_0x344cbf,function(_0x58b557){if(_0x58b557[_0x5fb8('0x37')]!==_0x5fb8('0x38')){var _0xdc2ade={};_0xdc2ade[_0x58b557[_0x5fb8('0x23')]]={'$like':'%'+_0x458f50[_0x5fb8('0x28')][_0x5fb8('0x39')]+'%'};return _0xdc2ade;}})});}_0x4c6c13=_['merge']({},_0x4c6c13,_0x458f50[_0x5fb8('0x3a')]);var _0x1477ee={'where':_0x4c6c13[_0x5fb8('0x34')]};return db['CloudProvider'][_0x5fb8('0x1b')](_0x1477ee)[_0x5fb8('0x21')](function(_0x4ba271){_0x3b518e[_0x5fb8('0x1b')]=_0x4ba271;if(_0x458f50[_0x5fb8('0x28')][_0x5fb8('0x3b')]){_0x4c6c13[_0x5fb8('0x3c')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x4c6c13);})['then'](function(_0x3efb30){_0x3b518e[_0x5fb8('0x3d')]=_0x3efb30;return _0x3b518e;})[_0x5fb8('0x21')](respondWithFilteredResult(_0x560145,_0x4c6c13))[_0x5fb8('0x3e')](handleError(_0x560145,null));};exports[_0x5fb8('0x3f')]=function(_0x39b7a6,_0x427c5f){var _0x34ac7c={'raw':!![],'where':{'id':_0x39b7a6['params']['id']}},_0x5ac9c1={};_0x5ac9c1[_0x5fb8('0x2b')]=_[_0x5fb8('0x29')](db[_0x5fb8('0x40')]['rawAttributes']);_0x5ac9c1[_0x5fb8('0x28')]=_[_0x5fb8('0x29')](_0x39b7a6[_0x5fb8('0x28')]);_0x5ac9c1['filtears']=_['intersection'](_0x5ac9c1['model'],_0x5ac9c1[_0x5fb8('0x28')]);_0x34ac7c['attributes']=_[_0x5fb8('0x2d')](_0x5ac9c1[_0x5fb8('0x2b')],qs[_0x5fb8('0x2e')](_0x39b7a6[_0x5fb8('0x28')][_0x5fb8('0x2e')]));_0x34ac7c[_0x5fb8('0x2c')]=_0x34ac7c[_0x5fb8('0x2c')][_0x5fb8('0x2f')]?_0x34ac7c[_0x5fb8('0x2c')]:_0x5ac9c1['model'];if(_0x39b7a6[_0x5fb8('0x28')][_0x5fb8('0x3b')]){_0x34ac7c[_0x5fb8('0x3c')]=[{'all':!![]}];}_0x34ac7c=_[_0x5fb8('0x36')]({},_0x34ac7c,_0x39b7a6[_0x5fb8('0x3a')]);return db[_0x5fb8('0x40')][_0x5fb8('0x41')](_0x34ac7c)[_0x5fb8('0x21')](handleEntityNotFound(_0x427c5f,null))[_0x5fb8('0x21')](respondWithResult(_0x427c5f,null))['catch'](handleError(_0x427c5f,null));};exports[_0x5fb8('0x42')]=function(_0x396ee5,_0x47a5d7){return db[_0x5fb8('0x40')]['create'](_0x396ee5[_0x5fb8('0x43')],{})[_0x5fb8('0x21')](respondWithResult(_0x47a5d7,0xc9))[_0x5fb8('0x3e')](handleError(_0x47a5d7,null));};exports[_0x5fb8('0x20')]=function(_0x1de744,_0x5300db){if(_0x1de744[_0x5fb8('0x43')]['id']){delete _0x1de744[_0x5fb8('0x43')]['id'];}return db[_0x5fb8('0x40')][_0x5fb8('0x41')]({'where':{'id':_0x1de744['params']['id']}})[_0x5fb8('0x21')](handleEntityNotFound(_0x5300db,null))[_0x5fb8('0x21')](saveUpdates(_0x1de744[_0x5fb8('0x43')],null))[_0x5fb8('0x21')](respondWithResult(_0x5300db,null))[_0x5fb8('0x3e')](handleError(_0x5300db,null));};exports[_0x5fb8('0x44')]=function(_0x31c4ea,_0x5097fd){return db[_0x5fb8('0x40')][_0x5fb8('0x41')]({'where':{'id':_0x31c4ea[_0x5fb8('0x45')]['id']}})[_0x5fb8('0x21')](handleEntityNotFound(_0x5097fd,null))[_0x5fb8('0x21')](removeEntity(_0x5097fd,null))[_0x5fb8('0x3e')](handleError(_0x5097fd,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 3516819..788c6db 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 _0x7139=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util'];(function(_0x47408e,_0x481428){var _0x1636bc=function(_0x2fe7a6){while(--_0x2fe7a6){_0x47408e['push'](_0x47408e['shift']());}};_0x1636bc(++_0x481428);}(_0x7139,0xb4));var _0x9713=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7139[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x9713('0x0'));var util=require(_0x9713('0x1'));var logger=require(_0x9713('0x2'))(_0x9713('0x3'));var moment=require(_0x9713('0x4'));var BPromise=require(_0x9713('0x5'));var rp=require(_0x9713('0x6'));var fs=require('fs');var path=require(_0x9713('0x7'));var rimraf=require(_0x9713('0x8'));var config=require('../../config/environment');var attributes=require(_0x9713('0x9'));module[_0x9713('0xa')]=function(_0x514280,_0x537445){return _0x514280[_0x9713('0xb')](_0x9713('0xc'),attributes,{'tableName':_0x9713('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6555=['CloudProvider','util','api','moment','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define'];(function(_0x16c10e,_0x1ac5b5){var _0x5aad10=function(_0x3a49a8){while(--_0x3a49a8){_0x16c10e['push'](_0x16c10e['shift']());}};_0x5aad10(++_0x1ac5b5);}(_0x6555,0xc7));var _0x5655=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x6555[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x5655('0x0'));var logger=require('../../config/logger')(_0x5655('0x1'));var moment=require(_0x5655('0x2'));var BPromise=require('bluebird');var rp=require(_0x5655('0x3'));var fs=require('fs');var path=require(_0x5655('0x4'));var rimraf=require(_0x5655('0x5'));var config=require(_0x5655('0x6'));var attributes=require(_0x5655('0x7'));module[_0x5655('0x8')]=function(_0x3a62b8,_0x49a6b3){return _0x3a62b8[_0x5655('0x9')](_0x5655('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 3cd27e8..69c6784 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 _0x200a=['error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify'];(function(_0x2dc698,_0x5c51ac){var _0x3c5f5e=function(_0x1cc55a){while(--_0x1cc55a){_0x2dc698['push'](_0x2dc698['shift']());}};_0x3c5f5e(++_0x5c51ac);}(_0x200a,0x11e));var _0xa200=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x200a[_0x298ed3];return _0x5aad28;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa200('0x0'));var BPromise=require('bluebird');var rs=require(_0xa200('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa200('0x2'))['db'];var utils=require(_0xa200('0x3'));var logger=require('../../config/logger')(_0xa200('0x4'));var config=require(_0xa200('0x5'));var jayson=require(_0xa200('0x6'));var client=jayson[_0xa200('0x7')][_0xa200('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3129e9,_0x3c3292,_0x2bd687){return new BPromise(function(_0x2bccf2,_0x3e34c8){return client[_0xa200('0x9')](_0x3129e9,_0x2bd687)[_0xa200('0xa')](function(_0x2312a6){logger[_0xa200('0xb')]('CloudProvider,\x20%s,\x20%s',_0x3c3292,'request\x20sent');logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x3c3292,_0xa200('0xc'),JSON[_0xa200('0xd')](_0x2312a6));if(_0x2312a6['error']){if(_0x2312a6[_0xa200('0xe')][_0xa200('0xf')]===0x1f4){logger['error'](_0xa200('0x10'),_0x3c3292,_0x2312a6[_0xa200('0xe')][_0xa200('0x11')]);return _0x3e34c8(_0x2312a6[_0xa200('0xe')]['message']);}logger[_0xa200('0xe')](_0xa200('0x10'),_0x3c3292,_0x2312a6[_0xa200('0xe')]['message']);return _0x2bccf2(_0x2312a6[_0xa200('0xe')][_0xa200('0x11')]);}else{logger[_0xa200('0xb')](_0xa200('0x10'),_0x3c3292,'request\x20sent');_0x2bccf2(_0x2312a6[_0xa200('0x12')][_0xa200('0x11')]);}})[_0xa200('0x13')](function(_0x45b497){logger[_0xa200('0xe')]('CloudProvider,\x20%s,\x20%s',_0x3c3292,_0x45b497);_0x3e34c8(_0x45b497);});});} \ No newline at end of file +var _0x9f78=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','debug','request\x20sent','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x472cc2,_0x3c0a60){var _0x55417f=function(_0x265f40){while(--_0x265f40){_0x472cc2['push'](_0x472cc2['shift']());}};_0x55417f(++_0x3c0a60);}(_0x9f78,0x78));var _0x89f7=function(_0x4fa3b3,_0x3c7487){_0x4fa3b3=_0x4fa3b3-0x0;var _0x3a37f8=_0x9f78[_0x4fa3b3];return _0x3a37f8;};'use strict';var _=require(_0x89f7('0x0'));var util=require('util');var moment=require(_0x89f7('0x1'));var BPromise=require(_0x89f7('0x2'));var rs=require(_0x89f7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x89f7('0x4'))['db'];var utils=require(_0x89f7('0x5'));var logger=require(_0x89f7('0x6'))(_0x89f7('0x7'));var config=require(_0x89f7('0x8'));var jayson=require(_0x89f7('0x9'));var client=jayson[_0x89f7('0xa')][_0x89f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf22b2f,_0x1a7edc,_0x4b9fc4){return new BPromise(function(_0x2436a8,_0x26a71a){return client[_0x89f7('0xc')](_0xf22b2f,_0x4b9fc4)[_0x89f7('0xd')](function(_0x173d26){logger[_0x89f7('0xe')](_0x89f7('0xf'),_0x1a7edc,'request\x20sent');logger[_0x89f7('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x1a7edc,_0x89f7('0x11'),JSON['stringify'](_0x173d26));if(_0x173d26[_0x89f7('0x12')]){if(_0x173d26[_0x89f7('0x12')]['code']===0x1f4){logger[_0x89f7('0x12')](_0x89f7('0xf'),_0x1a7edc,_0x173d26[_0x89f7('0x12')][_0x89f7('0x13')]);return _0x26a71a(_0x173d26['error'][_0x89f7('0x13')]);}logger[_0x89f7('0x12')](_0x89f7('0xf'),_0x1a7edc,_0x173d26[_0x89f7('0x12')][_0x89f7('0x13')]);return _0x2436a8(_0x173d26[_0x89f7('0x12')][_0x89f7('0x13')]);}else{logger[_0x89f7('0xe')]('CloudProvider,\x20%s,\x20%s',_0x1a7edc,'request\x20sent');_0x2436a8(_0x173d26[_0x89f7('0x14')][_0x89f7('0x13')]);}})['catch'](function(_0x35e7a4){logger[_0x89f7('0x12')]('CloudProvider,\x20%s,\x20%s',_0x1a7edc,_0x35e7a4);_0x26a71a(_0x35e7a4);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 5f113e4..7c70d02 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 _0x7846=['../../config/environment','./cloudProvider.controller','get','isAuthenticated','show','post','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x59c777,_0x2132d1){var _0x217854=function(_0x144002){while(--_0x144002){_0x59c777['push'](_0x59c777['shift']());}};_0x217854(++_0x2132d1);}(_0x7846,0x16b));var _0x6784=function(_0xa6cb09,_0x39410f){_0xa6cb09=_0xa6cb09-0x0;var _0x12b437=_0x7846[_0xa6cb09];return _0x12b437;};'use strict';var multer=require(_0x6784('0x0'));var util=require(_0x6784('0x1'));var path=require(_0x6784('0x2'));var timeout=require(_0x6784('0x3'));var express=require(_0x6784('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6784('0x5'));var controller=require(_0x6784('0x6'));router[_0x6784('0x7')]('/',auth[_0x6784('0x8')](),controller['index']);router[_0x6784('0x7')]('/:id',auth[_0x6784('0x8')](),controller[_0x6784('0x9')]);router[_0x6784('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6784('0xb')]('/:id',auth[_0x6784('0x8')](),controller[_0x6784('0xc')]);router['delete'](_0x6784('0xd'),auth[_0x6784('0x8')](),controller[_0x6784('0xe')]);module[_0x6784('0xf')]=router; \ No newline at end of file +var _0x250c=['show','post','create','destroy','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id'];(function(_0x54ef0d,_0xcac0bd){var _0x31accf=function(_0x220db4){while(--_0x220db4){_0x54ef0d['push'](_0x54ef0d['shift']());}};_0x31accf(++_0xcac0bd);}(_0x250c,0xa0));var _0xc250=function(_0x3b90be,_0x5ac29e){_0x3b90be=_0x3b90be-0x0;var _0x2d6bfe=_0x250c[_0x3b90be];return _0x2d6bfe;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc250('0x0'));var timeout=require('connect-timeout');var express=require(_0xc250('0x1'));var router=express[_0xc250('0x2')]();var auth=require(_0xc250('0x3'));var interaction=require(_0xc250('0x4'));var config=require('../../config/environment');var controller=require('./cloudProvider.controller');router[_0xc250('0x5')]('/',auth[_0xc250('0x6')](),controller['index']);router['get'](_0xc250('0x7'),auth[_0xc250('0x6')](),controller[_0xc250('0x8')]);router[_0xc250('0x9')]('/',auth[_0xc250('0x6')](),controller[_0xc250('0xa')]);router['put']('/:id',auth[_0xc250('0x6')](),controller['update']);router['delete'](_0xc250('0x7'),auth[_0xc250('0x6')](),controller[_0xc250('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 31209b2..aab9ef0 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 _0xe4c0=['exports','STRING','name'];(function(_0x1810b7,_0x554776){var _0x3d8948=function(_0x4b11fa){while(--_0x4b11fa){_0x1810b7['push'](_0x1810b7['shift']());}};_0x3d8948(++_0x554776);}(_0xe4c0,0x1b3));var _0x0e4c=function(_0x5de1bc,_0x434be1){_0x5de1bc=_0x5de1bc-0x0;var _0x19f4b8=_0xe4c0[_0x5de1bc];return _0x19f4b8;};'use strict';var Sequelize=require('sequelize');module[_0x0e4c('0x0')]={'name':{'type':Sequelize[_0x0e4c('0x1')],'unique':_0x0e4c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x0e4c('0x1')]},'companyId':{'type':Sequelize[_0x0e4c('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x0e4c('0x1')]},'city':{'type':Sequelize[_0x0e4c('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x0e4c('0x1')]},'sStreet':{'type':Sequelize[_0x0e4c('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x0e4c('0x1')]},'description':{'type':Sequelize[_0x0e4c('0x1')]}}; \ No newline at end of file +var _0xfb2b=['exports','STRING','name','sequelize'];(function(_0x410612,_0x551c48){var _0xbfa860=function(_0x4fb412){while(--_0x4fb412){_0x410612['push'](_0x410612['shift']());}};_0xbfa860(++_0x551c48);}(_0xfb2b,0x97));var _0xbfb2=function(_0x39f60d,_0x2f5385){_0x39f60d=_0x39f60d-0x0;var _0x2bf065=_0xfb2b[_0x39f60d];return _0x2bf065;};'use strict';var Sequelize=require(_0xbfb2('0x0'));module[_0xbfb2('0x1')]={'name':{'type':Sequelize[_0xbfb2('0x2')],'unique':_0xbfb2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xbfb2('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xbfb2('0x2')]},'fax':{'type':Sequelize[_0xbfb2('0x2')]},'type':{'type':Sequelize[_0xbfb2('0x2')]},'street':{'type':Sequelize[_0xbfb2('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xbfb2('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xbfb2('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xbfb2('0x2')]},'sStreet':{'type':Sequelize[_0xbfb2('0x2')]},'sPostalCode':{'type':Sequelize[_0xbfb2('0x2')]},'sCity':{'type':Sequelize[_0xbfb2('0x2')]},'sCountry':{'type':Sequelize[_0xbfb2('0x2')]},'description':{'type':Sequelize[_0xbfb2('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index adf1db7..e24040c 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 _0xa9e0=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','rows','catch','show','params','rawAttributes','filtears','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','addContacts','CmContact','ids','omit','getContacts','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','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','Companies','UserProfileResource','stack','name','send','index','CmCompany','describe','keys','query','filters','intersection','model','attributes'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x22')](function(_0x2ec755){_0x14de77['model']=_[_0x0a9e('0x2b')](_0x2ec755);_0x14de77[_0x0a9e('0x2c')]=_[_0x0a9e('0x2b')](_0x140511[_0x0a9e('0x2c')]);_0x14de77[_0x0a9e('0x2d')]=_[_0x0a9e('0x2e')](_0x14de77[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x2c')]);_0x11c3b6[_0x0a9e('0x30')]=_['intersection'](_0x14de77[_0x0a9e('0x2f')],qs['fields'](_0x140511[_0x0a9e('0x2c')][_0x0a9e('0x31')]));_0x11c3b6[_0x0a9e('0x30')]=_0x11c3b6[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x11c3b6['attributes']:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x2c')][_0x0a9e('0x33')](_0x0a9e('0x34'))){_0x11c3b6[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x140511[_0x0a9e('0x2c')][_0x0a9e('0x1a')]);_0x11c3b6['offset']=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x35')]=qs[_0x0a9e('0x36')](_0x140511[_0x0a9e('0x2c')]['sort']);_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x2d')](_[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x2c')],_0x14de77['filters']),_0x2ec755);if(_0x140511['query'][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x37')],{'$or':_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x30')],function(_0x4f41ae){var _0x31916f={};_0x31916f[_0x4f41ae]={'$like':'%'+_0x140511[_0x0a9e('0x2c')][_0x0a9e('0x39')]+'%'};return _0x31916f;})});}_0x11c3b6=_['merge']({},_0x11c3b6,_0x140511[_0x0a9e('0x3c')]);var _0x1a180b={'where':_0x11c3b6[_0x0a9e('0x37')]};return db['CmCompany']['count'](_0x1a180b)[_0x0a9e('0x22')](function(_0x40d766){_0x5a101a['count']=_0x40d766;if(_0x140511[_0x0a9e('0x2c')][_0x0a9e('0x3d')]){_0x11c3b6[_0x0a9e('0x3e')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x11c3b6);})['then'](function(_0x15e37d){_0x5a101a[_0x0a9e('0x3f')]=_0x15e37d;return _0x5a101a;})['then'](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));})[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0x5b4f5e,_0x316c8f){var _0x2cfea9={'raw':![],'where':{'id':_0x5b4f5e[_0x0a9e('0x42')]['id']}},_0x274e8e={};_0x274e8e[_0x0a9e('0x2f')]=_[_0x0a9e('0x2b')](db[_0x0a9e('0x29')][_0x0a9e('0x43')]);_0x274e8e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2b')](_0x5b4f5e[_0x0a9e('0x2c')]);_0x274e8e[_0x0a9e('0x44')]=_[_0x0a9e('0x2e')](_0x274e8e[_0x0a9e('0x2f')],_0x274e8e[_0x0a9e('0x2c')]);_0x2cfea9['attributes']=_['intersection'](_0x274e8e[_0x0a9e('0x2f')],qs[_0x0a9e('0x31')](_0x5b4f5e[_0x0a9e('0x2c')][_0x0a9e('0x31')]));_0x2cfea9[_0x0a9e('0x30')]=_0x2cfea9[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2cfea9[_0x0a9e('0x30')]:_0x274e8e[_0x0a9e('0x2f')];if(_0x5b4f5e[_0x0a9e('0x2c')][_0x0a9e('0x3d')]){_0x2cfea9[_0x0a9e('0x3e')]=[{'all':!![]}];}_0x2cfea9=_['merge']({},_0x2cfea9,_0x5b4f5e[_0x0a9e('0x3c')]);return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x2cfea9)[_0x0a9e('0x22')](handleEntityNotFound(_0x316c8f,null))[_0x0a9e('0x22')](respondWithResult(_0x316c8f,null))[_0x0a9e('0x40')](handleError(_0x316c8f,null));};exports[_0x0a9e('0x46')]=function(_0x44dd99,_0x59afe8){return db[_0x0a9e('0x29')]['create'](_0x44dd99[_0x0a9e('0x47')],{})[_0x0a9e('0x22')](function(_0x8d6dd1){var _0x562fb4=_0x44dd99[_0x0a9e('0x48')][_0x0a9e('0x49')]({'plain':!![]});if(!_0x562fb4)throw new Error(_0x0a9e('0x4a'));if(_0x562fb4[_0x0a9e('0x4b')]===_0x0a9e('0x48')){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]({'plain':!![]});var _0x5bbcde=_0x0a9e('0x23');return db[_0x0a9e('0x4c')][_0x0a9e('0x45')]({'where':{'name':_0x5bbcde,'userProfileId':_0x562fb4[_0x0a9e('0x4d')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x992c77){if(_0x992c77&&_0x992c77[_0x0a9e('0x4e')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x46')]({'name':_0x37be73['name'],'resourceId':_0x37be73['id'],'type':_0x992c77[_0x0a9e('0x26')],'sectionId':_0x992c77['id']},{})[_0x0a9e('0x22')](function(){return _0x8d6dd1;});}else{return _0x8d6dd1;}})['catch'](function(_0x4ae14b){logger['error'](_0x0a9e('0x4f'),_0x4ae14b);throw _0x4ae14b;});}return _0x8d6dd1;})[_0x0a9e('0x22')](respondWithResult(_0x59afe8,0xc9))[_0x0a9e('0x40')](handleError(_0x59afe8,null));};exports[_0x0a9e('0x20')]=function(_0x61bb17,_0x30decb){if(_0x61bb17[_0x0a9e('0x47')]['id']){delete _0x61bb17[_0x0a9e('0x47')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x61bb17['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x30decb,null))[_0x0a9e('0x22')](saveUpdates(_0x61bb17[_0x0a9e('0x47')],null))['then'](respondWithResult(_0x30decb,null))[_0x0a9e('0x40')](handleError(_0x30decb,null));};exports[_0x0a9e('0x21')]=function(_0x53d113,_0x5a88da){return db[_0x0a9e('0x29')]['find']({'where':{'id':_0x53d113[_0x0a9e('0x42')]['id']}})['then'](handleEntityNotFound(_0x5a88da,null))[_0x0a9e('0x22')](removeEntity(_0x5a88da,null))[_0x0a9e('0x40')](handleError(_0x5a88da,null));};exports[_0x0a9e('0x2a')]=function(_0x53613a,_0x2f82da){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2f82da,null))[_0x0a9e('0x40')](handleError(_0x2f82da,null));};exports[_0x0a9e('0x50')]=function(_0x49c095,_0x145931,_0x5ce9ac){return db[_0x0a9e('0x51')]['find']({'where':{'id':_0x49c095[_0x0a9e('0x42')]['id']}})['then'](handleEntityNotFound(_0x145931,null))['then'](function(_0x5df0ad){if(_0x5df0ad){return _0x5df0ad[_0x0a9e('0x50')](_0x49c095['body'][_0x0a9e('0x52')],_[_0x0a9e('0x53')](_0x49c095[_0x0a9e('0x47')],[_0x0a9e('0x52'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x145931,null))[_0x0a9e('0x40')](handleError(_0x145931,null));};exports[_0x0a9e('0x54')]=function(_0x28d814,_0x4e67ab,_0x1c693e){var _0x121cef={};var _0x2642bb={};var _0x30c491;var _0xb83dfd;return db[_0x0a9e('0x29')]['findOne']({'where':{'id':_0x28d814[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4e67ab,null))['then'](function(_0x3649cc){if(_0x3649cc){_0x30c491=_0x3649cc;_0x2642bb['model']=_[_0x0a9e('0x2b')](db['CmContact']['rawAttributes']);_0x2642bb['query']=_[_0x0a9e('0x2b')](_0x28d814['query']);_0x2642bb[_0x0a9e('0x2d')]=_[_0x0a9e('0x2e')](_0x2642bb[_0x0a9e('0x2f')],_0x2642bb[_0x0a9e('0x2c')]);_0x121cef[_0x0a9e('0x30')]=_[_0x0a9e('0x2e')](_0x2642bb['model'],qs[_0x0a9e('0x31')](_0x28d814['query'][_0x0a9e('0x31')]));_0x121cef[_0x0a9e('0x30')]=_0x121cef[_0x0a9e('0x30')]['length']?_0x121cef[_0x0a9e('0x30')]:_0x2642bb[_0x0a9e('0x2f')];_0x121cef[_0x0a9e('0x35')]=qs[_0x0a9e('0x36')](_0x28d814['query'][_0x0a9e('0x36')]);_0x121cef[_0x0a9e('0x37')]=qs['filters'](_[_0x0a9e('0x38')](_0x28d814[_0x0a9e('0x2c')],_0x2642bb[_0x0a9e('0x2d')]));if(_0x28d814[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x121cef['where']=_[_0x0a9e('0x3a')](_0x121cef[_0x0a9e('0x37')],{'$or':_[_0x0a9e('0x3b')](_0x121cef['attributes'],function(_0x3528b7){var _0x4f1e60={};_0x4f1e60[_0x3528b7]={'$like':'%'+_0x28d814['query'][_0x0a9e('0x39')]+'%'};return _0x4f1e60;})});}_0x121cef=_[_0x0a9e('0x3a')]({},_0x121cef,_0x28d814[_0x0a9e('0x3c')]);return _0x30c491[_0x0a9e('0x54')](_0x121cef);}})[_0x0a9e('0x22')](function(_0xc8c264){if(_0xc8c264){_0xb83dfd=_0xc8c264[_0x0a9e('0x32')];if(!_0x28d814[_0x0a9e('0x2c')][_0x0a9e('0x33')](_0x0a9e('0x34'))){_0x121cef[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x28d814[_0x0a9e('0x2c')][_0x0a9e('0x1a')]);_0x121cef[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x28d814[_0x0a9e('0x2c')][_0x0a9e('0x19')]);}return _0x30c491['getContacts'](_0x121cef);}})[_0x0a9e('0x22')](function(_0x295763){if(_0x295763){return _0x295763?{'count':_0xb83dfd,'rows':_0x295763}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x4e67ab,null))['catch'](handleError(_0x4e67ab,null));}; \ No newline at end of file +var _0xa9e0=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','rows','catch','show','params','rawAttributes','filtears','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','addContacts','CmContact','ids','omit','getContacts','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','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','Companies','UserProfileResource','stack','name','send','index','CmCompany','describe','keys','query','filters','intersection','model','attributes'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x22')](function(_0x2ec755){_0x14de77['model']=_[_0x0a9e('0x2b')](_0x2ec755);_0x14de77[_0x0a9e('0x2c')]=_[_0x0a9e('0x2b')](_0x140511[_0x0a9e('0x2c')]);_0x14de77[_0x0a9e('0x2d')]=_[_0x0a9e('0x2e')](_0x14de77[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x2c')]);_0x11c3b6[_0x0a9e('0x30')]=_['intersection'](_0x14de77[_0x0a9e('0x2f')],qs['fields'](_0x140511[_0x0a9e('0x2c')][_0x0a9e('0x31')]));_0x11c3b6[_0x0a9e('0x30')]=_0x11c3b6[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x11c3b6['attributes']:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x2c')][_0x0a9e('0x33')](_0x0a9e('0x34'))){_0x11c3b6[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x140511[_0x0a9e('0x2c')][_0x0a9e('0x1a')]);_0x11c3b6['offset']=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x35')]=qs[_0x0a9e('0x36')](_0x140511[_0x0a9e('0x2c')]['sort']);_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x2d')](_[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x2c')],_0x14de77['filters']),_0x2ec755);if(_0x140511['query'][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x37')],{'$or':_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x30')],function(_0x4f41ae){var _0x31916f={};_0x31916f[_0x4f41ae]={'$like':'%'+_0x140511[_0x0a9e('0x2c')][_0x0a9e('0x39')]+'%'};return _0x31916f;})});}_0x11c3b6=_['merge']({},_0x11c3b6,_0x140511[_0x0a9e('0x3c')]);var _0x1a180b={'where':_0x11c3b6[_0x0a9e('0x37')]};return db['CmCompany']['count'](_0x1a180b)[_0x0a9e('0x22')](function(_0x40d766){_0x5a101a['count']=_0x40d766;if(_0x140511[_0x0a9e('0x2c')][_0x0a9e('0x3d')]){_0x11c3b6[_0x0a9e('0x3e')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x11c3b6);})['then'](function(_0x15e37d){_0x5a101a[_0x0a9e('0x3f')]=_0x15e37d;return _0x5a101a;})['then'](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));})[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0x5b4f5e,_0x316c8f){var _0x2cfea9={'raw':![],'where':{'id':_0x5b4f5e[_0x0a9e('0x42')]['id']}},_0x274e8e={};_0x274e8e[_0x0a9e('0x2f')]=_[_0x0a9e('0x2b')](db[_0x0a9e('0x29')][_0x0a9e('0x43')]);_0x274e8e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2b')](_0x5b4f5e[_0x0a9e('0x2c')]);_0x274e8e[_0x0a9e('0x44')]=_[_0x0a9e('0x2e')](_0x274e8e[_0x0a9e('0x2f')],_0x274e8e[_0x0a9e('0x2c')]);_0x2cfea9['attributes']=_['intersection'](_0x274e8e[_0x0a9e('0x2f')],qs[_0x0a9e('0x31')](_0x5b4f5e[_0x0a9e('0x2c')][_0x0a9e('0x31')]));_0x2cfea9[_0x0a9e('0x30')]=_0x2cfea9[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2cfea9[_0x0a9e('0x30')]:_0x274e8e[_0x0a9e('0x2f')];if(_0x5b4f5e[_0x0a9e('0x2c')][_0x0a9e('0x3d')]){_0x2cfea9[_0x0a9e('0x3e')]=[{'all':!![]}];}_0x2cfea9=_['merge']({},_0x2cfea9,_0x5b4f5e[_0x0a9e('0x3c')]);return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x2cfea9)[_0x0a9e('0x22')](handleEntityNotFound(_0x316c8f,null))[_0x0a9e('0x22')](respondWithResult(_0x316c8f,null))[_0x0a9e('0x40')](handleError(_0x316c8f,null));};exports[_0x0a9e('0x46')]=function(_0x44dd99,_0x59afe8){return db[_0x0a9e('0x29')]['create'](_0x44dd99[_0x0a9e('0x47')],{})[_0x0a9e('0x22')](function(_0x8d6dd1){var _0x562fb4=_0x44dd99[_0x0a9e('0x48')][_0x0a9e('0x49')]({'plain':!![]});if(!_0x562fb4)throw new Error(_0x0a9e('0x4a'));if(_0x562fb4[_0x0a9e('0x4b')]===_0x0a9e('0x48')){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]({'plain':!![]});var _0x5bbcde=_0x0a9e('0x23');return db[_0x0a9e('0x4c')][_0x0a9e('0x45')]({'where':{'name':_0x5bbcde,'userProfileId':_0x562fb4[_0x0a9e('0x4d')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x992c77){if(_0x992c77&&_0x992c77[_0x0a9e('0x4e')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x46')]({'name':_0x37be73['name'],'resourceId':_0x37be73['id'],'type':_0x992c77[_0x0a9e('0x26')],'sectionId':_0x992c77['id']},{})[_0x0a9e('0x22')](function(){return _0x8d6dd1;});}else{return _0x8d6dd1;}})['catch'](function(_0x4ae14b){logger['error'](_0x0a9e('0x4f'),_0x4ae14b);throw _0x4ae14b;});}return _0x8d6dd1;})[_0x0a9e('0x22')](respondWithResult(_0x59afe8,0xc9))[_0x0a9e('0x40')](handleError(_0x59afe8,null));};exports[_0x0a9e('0x20')]=function(_0x61bb17,_0x30decb){if(_0x61bb17[_0x0a9e('0x47')]['id']){delete _0x61bb17[_0x0a9e('0x47')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x61bb17['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x30decb,null))[_0x0a9e('0x22')](saveUpdates(_0x61bb17[_0x0a9e('0x47')],null))['then'](respondWithResult(_0x30decb,null))[_0x0a9e('0x40')](handleError(_0x30decb,null));};exports[_0x0a9e('0x21')]=function(_0x53d113,_0x5a88da){return db[_0x0a9e('0x29')]['find']({'where':{'id':_0x53d113[_0x0a9e('0x42')]['id']}})['then'](handleEntityNotFound(_0x5a88da,null))[_0x0a9e('0x22')](removeEntity(_0x5a88da,null))[_0x0a9e('0x40')](handleError(_0x5a88da,null));};exports[_0x0a9e('0x2a')]=function(_0x53613a,_0x2f82da){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2f82da,null))[_0x0a9e('0x40')](handleError(_0x2f82da,null));};exports[_0x0a9e('0x50')]=function(_0x49c095,_0x145931,_0x5ce9ac){return db[_0x0a9e('0x51')]['find']({'where':{'id':_0x49c095[_0x0a9e('0x42')]['id']}})['then'](handleEntityNotFound(_0x145931,null))['then'](function(_0x5df0ad){if(_0x5df0ad){return _0x5df0ad[_0x0a9e('0x50')](_0x49c095['body'][_0x0a9e('0x52')],_[_0x0a9e('0x53')](_0x49c095[_0x0a9e('0x47')],[_0x0a9e('0x52'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x145931,null))[_0x0a9e('0x40')](handleError(_0x145931,null));};exports[_0x0a9e('0x54')]=function(_0x28d814,_0x4e67ab,_0x1c693e){var _0x121cef={};var _0x2642bb={};var _0x30c491;var _0xb83dfd;return db[_0x0a9e('0x29')]['findOne']({'where':{'id':_0x28d814[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4e67ab,null))['then'](function(_0x3649cc){if(_0x3649cc){_0x30c491=_0x3649cc;_0x2642bb['model']=_[_0x0a9e('0x2b')](db['CmContact']['rawAttributes']);_0x2642bb['query']=_[_0x0a9e('0x2b')](_0x28d814['query']);_0x2642bb[_0x0a9e('0x2d')]=_[_0x0a9e('0x2e')](_0x2642bb[_0x0a9e('0x2f')],_0x2642bb[_0x0a9e('0x2c')]);_0x121cef[_0x0a9e('0x30')]=_[_0x0a9e('0x2e')](_0x2642bb['model'],qs[_0x0a9e('0x31')](_0x28d814['query'][_0x0a9e('0x31')]));_0x121cef[_0x0a9e('0x30')]=_0x121cef[_0x0a9e('0x30')]['length']?_0x121cef[_0x0a9e('0x30')]:_0x2642bb[_0x0a9e('0x2f')];_0x121cef[_0x0a9e('0x35')]=qs[_0x0a9e('0x36')](_0x28d814['query'][_0x0a9e('0x36')]);_0x121cef[_0x0a9e('0x37')]=qs['filters'](_[_0x0a9e('0x38')](_0x28d814[_0x0a9e('0x2c')],_0x2642bb[_0x0a9e('0x2d')]));if(_0x28d814[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x121cef['where']=_[_0x0a9e('0x3a')](_0x121cef[_0x0a9e('0x37')],{'$or':_[_0x0a9e('0x3b')](_0x121cef['attributes'],function(_0x3528b7){var _0x4f1e60={};_0x4f1e60[_0x3528b7]={'$like':'%'+_0x28d814['query'][_0x0a9e('0x39')]+'%'};return _0x4f1e60;})});}_0x121cef=_[_0x0a9e('0x3a')]({},_0x121cef,_0x28d814[_0x0a9e('0x3c')]);return _0x30c491[_0x0a9e('0x54')](_0x121cef);}})[_0x0a9e('0x22')](function(_0xc8c264){if(_0xc8c264){_0xb83dfd=_0xc8c264[_0x0a9e('0x32')];if(!_0x28d814[_0x0a9e('0x2c')][_0x0a9e('0x33')](_0x0a9e('0x34'))){_0x121cef[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x28d814[_0x0a9e('0x2c')][_0x0a9e('0x1a')]);_0x121cef[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x28d814[_0x0a9e('0x2c')][_0x0a9e('0x19')]);}return _0x30c491['getContacts'](_0x121cef);}})[_0x0a9e('0x22')](function(_0x295763){if(_0x295763){return _0x295763?{'count':_0xb83dfd,'rows':_0x295763}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x4e67ab,null))['catch'](handleError(_0x4e67ab,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 00f8686..3524e02 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 _0xc43c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./cmCompany.attributes','exports','define','CmCompany','cm_companies'];(function(_0x13cf5e,_0x216f0b){var _0xb26f15=function(_0x5b5e60){while(--_0x5b5e60){_0x13cf5e['push'](_0x13cf5e['shift']());}};_0xb26f15(++_0x216f0b);}(_0xc43c,0x152));var _0xcc43=function(_0x32d341,_0x34934a){_0x32d341=_0x32d341-0x0;var _0x44a538=_0xc43c[_0x32d341];return _0x44a538;};'use strict';var _=require(_0xcc43('0x0'));var util=require(_0xcc43('0x1'));var logger=require(_0xcc43('0x2'))(_0xcc43('0x3'));var moment=require(_0xcc43('0x4'));var BPromise=require(_0xcc43('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc43('0x6'));var rimraf=require(_0xcc43('0x7'));var config=require('../../config/environment');var attributes=require(_0xcc43('0x8'));module[_0xcc43('0x9')]=function(_0x217a5e,_0x17d1a2){return _0x217a5e[_0xcc43('0xa')](_0xcc43('0xb'),attributes,{'tableName':_0xcc43('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a59=['../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','api','moment','bluebird','request-promise','path'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x7a59,0x16e));var _0x97a5=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0x7a59[_0x120376];return _0x28c529;};'use strict';var _=require(_0x97a5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x97a5('0x1'));var moment=require(_0x97a5('0x2'));var BPromise=require(_0x97a5('0x3'));var rp=require(_0x97a5('0x4'));var fs=require('fs');var path=require(_0x97a5('0x5'));var rimraf=require('rimraf');var config=require(_0x97a5('0x6'));var attributes=require(_0x97a5('0x7'));module[_0x97a5('0x8')]=function(_0x48201b,_0x438520){return _0x48201b[_0x97a5('0x9')](_0x97a5('0xa'),attributes,{'tableName':_0x97a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 65ebbd4..a30438a 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 _0x607d=['lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x34c582,_0x4b6bee){var _0x2ca4eb=function(_0x2ef6ad){while(--_0x2ef6ad){_0x34c582['push'](_0x34c582['shift']());}};_0x2ca4eb(++_0x4b6bee);}(_0x607d,0x154));var _0xd607=function(_0x37c8b3,_0x20cac4){_0x37c8b3=_0x37c8b3-0x0;var _0x263d27=_0x607d[_0x37c8b3];return _0x263d27;};'use strict';var _=require(_0xd607('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd607('0x1'));var rs=require(_0xd607('0x2'));var fs=require('fs');var Redis=require(_0xd607('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd607('0x4'))(_0xd607('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd607('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x276736,_0x28606d,_0x447115){return new BPromise(function(_0x55bac5,_0x1b0750){return client[_0xd607('0x7')](_0x276736,_0x447115)[_0xd607('0x8')](function(_0x2df8b7){logger[_0xd607('0x9')](_0xd607('0xa'),_0x28606d,_0xd607('0xb'));logger[_0xd607('0xc')](_0xd607('0xd'),_0x28606d,_0xd607('0xb'),JSON[_0xd607('0xe')](_0x2df8b7));if(_0x2df8b7[_0xd607('0xf')]){if(_0x2df8b7['error'][_0xd607('0x10')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x28606d,_0x2df8b7[_0xd607('0xf')]['message']);return _0x1b0750(_0x2df8b7[_0xd607('0xf')]['message']);}logger['error'](_0xd607('0xa'),_0x28606d,_0x2df8b7['error'][_0xd607('0x11')]);return _0x55bac5(_0x2df8b7[_0xd607('0xf')][_0xd607('0x11')]);}else{logger[_0xd607('0x9')]('CmCompany,\x20%s,\x20%s',_0x28606d,_0xd607('0xb'));_0x55bac5(_0x2df8b7[_0xd607('0x12')][_0xd607('0x11')]);}})[_0xd607('0x13')](function(_0x2f2dd4){logger[_0xd607('0xf')](_0xd607('0xa'),_0x28606d,_0x2f2dd4);_0x1b0750(_0x2f2dd4);});});} \ No newline at end of file +var _0xd11d=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s'];(function(_0x2b815e,_0x2472dd){var _0x347e9f=function(_0x2138b0){while(--_0x2138b0){_0x2b815e['push'](_0x2b815e['shift']());}};_0x347e9f(++_0x2472dd);}(_0xd11d,0x10d));var _0xdd11=function(_0x3b3ac9,_0x29d62e){_0x3b3ac9=_0x3b3ac9-0x0;var _0x214d34=_0xd11d[_0x3b3ac9];return _0x214d34;};'use strict';var _=require(_0xdd11('0x0'));var util=require(_0xdd11('0x1'));var moment=require(_0xdd11('0x2'));var BPromise=require(_0xdd11('0x3'));var rs=require(_0xdd11('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd11('0x5'))['db'];var utils=require(_0xdd11('0x6'));var logger=require(_0xdd11('0x7'))(_0xdd11('0x8'));var config=require(_0xdd11('0x9'));var jayson=require(_0xdd11('0xa'));var client=jayson[_0xdd11('0xb')][_0xdd11('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58fc6e,_0xbe6330,_0x18dfb7){return new BPromise(function(_0x503dc2,_0x2b4c78){return client[_0xdd11('0xd')](_0x58fc6e,_0x18dfb7)['then'](function(_0x5beaeb){logger[_0xdd11('0xe')](_0xdd11('0xf'),_0xbe6330,_0xdd11('0x10'));logger[_0xdd11('0x11')](_0xdd11('0x12'),_0xbe6330,'request\x20sent',JSON[_0xdd11('0x13')](_0x5beaeb));if(_0x5beaeb[_0xdd11('0x14')]){if(_0x5beaeb['error'][_0xdd11('0x15')]===0x1f4){logger[_0xdd11('0x14')](_0xdd11('0xf'),_0xbe6330,_0x5beaeb['error']['message']);return _0x2b4c78(_0x5beaeb[_0xdd11('0x14')][_0xdd11('0x16')]);}logger['error'](_0xdd11('0xf'),_0xbe6330,_0x5beaeb[_0xdd11('0x14')]['message']);return _0x503dc2(_0x5beaeb[_0xdd11('0x14')][_0xdd11('0x16')]);}else{logger['info'](_0xdd11('0xf'),_0xbe6330,_0xdd11('0x10'));_0x503dc2(_0x5beaeb['result'][_0xdd11('0x16')]);}})[_0xdd11('0x17')](function(_0x1fad0e){logger[_0xdd11('0x14')]('CmCompany,\x20%s,\x20%s',_0xbe6330,_0x1fad0e);_0x2b4c78(_0x1fad0e);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 28f1bdd..6260ecd 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 _0x47c5=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4a1e37,_0x2eef28){var _0xeb1f8b=function(_0x5854e6){while(--_0x5854e6){_0x4a1e37['push'](_0x4a1e37['shift']());}};_0xeb1f8b(++_0x2eef28);}(_0x47c5,0x165));var _0x547c=function(_0x2bfda9,_0x2e4728){_0x2bfda9=_0x2bfda9-0x0;var _0x7020ee=_0x47c5[_0x2bfda9];return _0x7020ee;};'use strict';var multer=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var path=require(_0x547c('0x2'));var timeout=require(_0x547c('0x3'));var express=require(_0x547c('0x4'));var router=express[_0x547c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x547c('0x6'));var config=require(_0x547c('0x7'));var controller=require('./cmCompany.controller');router[_0x547c('0x8')]('/',auth[_0x547c('0x9')](),controller['index']);router[_0x547c('0x8')](_0x547c('0xa'),auth[_0x547c('0x9')](),controller[_0x547c('0xb')]);router[_0x547c('0x8')](_0x547c('0xc'),auth[_0x547c('0x9')](),controller[_0x547c('0xd')]);router[_0x547c('0x8')](_0x547c('0xe'),auth[_0x547c('0x9')](),controller[_0x547c('0xf')]);router[_0x547c('0x10')]('/',auth[_0x547c('0x9')](),controller[_0x547c('0x11')]);router[_0x547c('0x10')](_0x547c('0xe'),auth['isAuthenticated'](),controller[_0x547c('0x12')]);router[_0x547c('0x13')]('/:id',auth[_0x547c('0x9')](),controller[_0x547c('0x14')]);router[_0x547c('0x15')](_0x547c('0xc'),auth[_0x547c('0x9')](),controller[_0x547c('0x16')]);module[_0x547c('0x17')]=router; \ No newline at end of file +var _0x4c60=['index','/describe','describe','/:id','show','post','create','addContacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','get','isAuthenticated'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x4c60,0xc1));var _0x04c6=function(_0x2c2a2b,_0x556387){_0x2c2a2b=_0x2c2a2b-0x0;var _0x5ad9ad=_0x4c60[_0x2c2a2b];return _0x5ad9ad;};'use strict';var multer=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var path=require(_0x04c6('0x2'));var timeout=require(_0x04c6('0x3'));var express=require('express');var router=express[_0x04c6('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0x04c6('0x5')]('/',auth[_0x04c6('0x6')](),controller[_0x04c6('0x7')]);router[_0x04c6('0x5')](_0x04c6('0x8'),auth[_0x04c6('0x6')](),controller[_0x04c6('0x9')]);router['get'](_0x04c6('0xa'),auth[_0x04c6('0x6')](),controller[_0x04c6('0xb')]);router[_0x04c6('0x5')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0x04c6('0xc')]('/',auth['isAuthenticated'](),controller[_0x04c6('0xd')]);router[_0x04c6('0xc')]('/:id/contacts',auth[_0x04c6('0x6')](),controller[_0x04c6('0xe')]);router[_0x04c6('0xf')](_0x04c6('0xa'),auth['isAuthenticated'](),controller[_0x04c6('0x10')]);router[_0x04c6('0x11')](_0x04c6('0xa'),auth['isAuthenticated'](),controller[_0x04c6('0x12')]);module[_0x04c6('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 3ad8613..217ff38 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 _0x31f4=['INTEGER','UNSIGNED','exports','STRING','TEXT'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x31f4,0xde));var _0x431f=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x31f4[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x431f('0x0')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x431f('0x1')]},'street':{'type':Sequelize[_0x431f('0x1')]},'postalCode':{'type':Sequelize[_0x431f('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x431f('0x1')]},'dateOfBirth':{'type':Sequelize[_0x431f('0x1')]},'description':{'type':Sequelize[_0x431f('0x2')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x431f('0x1')]},'fax':{'type':Sequelize[_0x431f('0x1')]},'email':{'type':Sequelize[_0x431f('0x1')]},'url':{'type':Sequelize[_0x431f('0x1')]},'facebook':{'type':Sequelize[_0x431f('0x1')]},'fb_data':{'type':Sequelize[_0x431f('0x1')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x431f('0x1')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x431f('0x1')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x431f('0x1')]},'UserId':{'type':Sequelize[_0x431f('0x3')]},'priority':{'type':Sequelize[_0x431f('0x3')](0x2)[_0x431f('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xcfbc=['sequelize','exports','STRING','INTEGER','UNSIGNED','DATE','lodash'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xcfbc,0x141));var _0xccfb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcfbc[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xccfb('0x0'));var Sequelize=require(_0xccfb('0x1'));module[_0xccfb('0x2')]={'firstName':{'type':Sequelize[_0xccfb('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xccfb('0x3')]},'postalCode':{'type':Sequelize[_0xccfb('0x3')]},'city':{'type':Sequelize[_0xccfb('0x3')]},'country':{'type':Sequelize[_0xccfb('0x3')]},'dateOfBirth':{'type':Sequelize[_0xccfb('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xccfb('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xccfb('0x3')]},'fb_data':{'type':Sequelize[_0xccfb('0x3')]},'twitter':{'type':Sequelize[_0xccfb('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xccfb('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xccfb('0x3')]},'wechat':{'type':Sequelize[_0xccfb('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xccfb('0x4')]},'priority':{'type':Sequelize[_0xccfb('0x4')](0x2)[_0xccfb('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xccfb('0x6')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index f8866b4..1515b5c 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 _0xe706=['cm_contacts','left_join','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','value','split','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','dateOfBirth','datetime','buildExpression','text','filter','isNil','Contact','push','isEmpty','forEach','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','\x27\x27\x27\x27','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','c.id','DESC','having','t.id\x20IN\x20?','resolve','some','user','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','merge','c.firstName','c.phone','c.fax','c.email','c.ListId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','catch','params','tags','columnName','displayName','alias','custom','values','body','findAll','get','info','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','join','bulkCreate','each','duplicates','$or','findOrCreate','spread','show','find','Tag','Tags','$and','format','cf_%d','omit','table','setFields','id\x20=\x20?','toParam','phone','rawAttributes','options','getTags','setTags','ids','getHoppers','ContactId','includeAll','rows','getHopperHistories','include','getHopperFinals','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','filename','chmodSync','0777','fork','CompanyId','socket_timestamp','pid','send','file','meta','import','agent','binding','child_process','stringify','start\x20child\x20process\x20correctly!','error\x20child\x20process','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','then','end','error','stack','name','index','CmContact','describe','length','keys','startsWith','cf_','CmCustomField','findOne','all','fieldType','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','select'];(function(_0x3f1f15,_0x4d1b5f){var _0xb3b928=function(_0x820c2d){while(--_0x820c2d){_0x3f1f15['push'](_0x3f1f15['shift']());}};_0xb3b928(++_0x4d1b5f);}(_0xe706,0xa3));var _0x6e70=function(_0x53ed0b,_0x25e205){_0x53ed0b=_0x53ed0b-0x0;var _0x453628=_0xe706[_0x53ed0b];return _0x453628;};'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 licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];config[_0x6e70('0x1d')]=_[_0x6e70('0x1e')](config[_0x6e70('0x1d')],{'host':_0x6e70('0x1f'),'port':0x18eb});var socket=require(_0x6e70('0x20'))(new Redis(config['redis']));require('./cmContact.socket')['register'](socket);function respondWithStatusCode(_0x257e81,_0x5a37a6){_0x5a37a6=_0x5a37a6||0xcc;return function(_0x53aed0){if(_0x53aed0){return _0x257e81[_0x6e70('0x21')](_0x5a37a6);}return _0x257e81[_0x6e70('0x22')](_0x5a37a6)['end']();};}function respondWithResult(_0x24f3ac,_0x5c3fe7){_0x5c3fe7=_0x5c3fe7||0xc8;return function(_0x2efc0f){if(_0x2efc0f){return _0x24f3ac[_0x6e70('0x22')](_0x5c3fe7)['json'](_0x2efc0f);}};}function respondWithFilteredResult(_0x49029f,_0x3bd572){return function(_0x5ea7a5){if(_0x5ea7a5){var _0x28a21f=_0x5ea7a5[_0x6e70('0x23')],_0x173afe=_0x3bd572[_0x6e70('0x24')],_0x53acdc=_0x3bd572[_0x6e70('0x24')]+_0x3bd572[_0x6e70('0x25')],_0x497d61;if(_0x53acdc>=_0x28a21f){_0x53acdc=_0x28a21f;_0x497d61=0xc8;}else{_0x497d61=0xce;}_0x49029f[_0x6e70('0x22')](_0x497d61);return _0x49029f[_0x6e70('0x26')](_0x6e70('0x27'),_0x173afe+'-'+_0x53acdc+'/'+_0x28a21f)[_0x6e70('0x28')](_0x5ea7a5);}return null;};}function patchUpdates(_0x29326f){return function(_0xb29a2a){try{jsonpatch['apply'](_0xb29a2a,_0x29326f,!![]);}catch(_0x228350){return BPromise[_0x6e70('0x29')](_0x228350);}return _0xb29a2a[_0x6e70('0x2a')]();};}function saveUpdates(_0x502b2d,_0x3ccd87){return function(_0xa5d49){if(_0xa5d49){return _0xa5d49[_0x6e70('0x2b')](_0x502b2d)['then'](function(_0x10fc91){return _0x10fc91;});}return null;};}function removeEntity(_0x538b9c,_0x50aec2){return function(_0x4e97c7){if(_0x4e97c7){return _0x4e97c7[_0x6e70('0x2c')]()[_0x6e70('0x2d')](function(){_0x538b9c['status'](0xcc)[_0x6e70('0x2e')]();});}};}function handleEntityNotFound(_0x1196ed,_0x5f268f){return function(_0x338ad6){if(!_0x338ad6){_0x1196ed[_0x6e70('0x21')](0x194);}return _0x338ad6;};}function handleError(_0x2bb231,_0x4a67ac){_0x4a67ac=_0x4a67ac||0x1f4;return function(_0x54a5fe){logger[_0x6e70('0x2f')](_0x54a5fe[_0x6e70('0x30')]);if(_0x54a5fe[_0x6e70('0x31')]){delete _0x54a5fe[_0x6e70('0x31')];}_0x2bb231[_0x6e70('0x22')](_0x4a67ac)['send'](_0x54a5fe);};}exports[_0x6e70('0x32')]=function(_0x406f29,_0xecf336){var _0x2864a0={},_0x396a67={},_0x20a225={'count':0x0,'rows':[]};return db[_0x6e70('0x33')][_0x6e70('0x34')]()[_0x6e70('0x2d')](function(_0x3a5d30){var _0x4b1229=[];for(var _0x1b27d8=0x0;_0x1b27d80x1){_0x4d1243['or'](_0x6e70('0x73'),qs['getFullTextValue'](_0x28898a),null);}else{if(qs[_0x6e70('0x74')](_0x28898a)){_0x4d1243['or'](_0x6e70('0x75'),_0x28898a+'%');_0x4d1243['or'](_0x6e70('0x76'),_0x28898a+'%');_0x4d1243['or']('c.mobile\x20LIKE\x20?',_0x28898a+'%');_0x4d1243['or']('c.fax\x20LIKE\x20?',_0x28898a+'%');}else if(qs[_0x6e70('0x77')](_0x28898a)){_0x4d1243['or'](_0x6e70('0x78'),_0x28898a+'%');}else{_0x4d1243['or'](_0x6e70('0x79'),'%'+_0x28898a+'%');_0x4d1243['or'](_0x6e70('0x7a'),'%'+_0x28898a+'%');_0x4d1243['or'](_0x6e70('0x78'),'%'+_0x28898a+'%');}}}}_0x49e068[_0x6e70('0x48')](_0x4d1243);_0x49e068[_0x6e70('0x7b')]('c.id');var _0x4d47e1={'type':db[_0x6e70('0x7c')][_0x6e70('0x7d')][_0x6e70('0x7e')],'raw':!![]};var _0x2ad395=_0x49e068['clone']()['field'](_0x6e70('0x7f'));if(_0x2864a0[_0x6e70('0x46')]){_0x2864a0['order']['forEach'](function(_0x355708){_0x49e068['order']('c.'+_0x355708[0x0],_0x355708[0x1]===_0x6e70('0x80')?![]:!![]);});}if(!_[_0x6e70('0x68')](_0x1e9b06)){_0x49e068[_0x6e70('0x81')](_0x2dafb5);_0x2ad395[_0x6e70('0x48')](_0x6e70('0x82'),_0x1e9b06);}BPromise[_0x6e70('0x83')]()[_0x6e70('0x2d')](function(){if(_0x5bbc3a&&!_[_0x6e70('0x84')](_0x5bbc3a['conditions'],[_0x6e70('0x4a'),_0x6e70('0x5e')])){return _0x406f29[_0x6e70('0x85')][_0x6e70('0x86')]({'attributes':['id'],'raw':!![]})[_0x6e70('0x2d')](function(_0x5d1cf6){if(_['isEmpty'](_0x5d1cf6)){_0x2ad395['where'](_0x6e70('0x87'));_0x49e068[_0x6e70('0x48')](_0x6e70('0x87'));}else{_0x2ad395['where']('c.ListId\x20IN\x20?',_[_0x6e70('0x5b')](_0x5d1cf6,'id'));_0x49e068[_0x6e70('0x48')](_0x6e70('0x6b'),_[_0x6e70('0x5b')](_0x5d1cf6,'id'));}});}else{return;}})[_0x6e70('0x2d')](function(){db[_0x6e70('0x88')]['query'](_0x2ad395[_0x6e70('0x89')](),_0x4d47e1)[_0x6e70('0x2d')](function(_0x30d11b){_0x20a225[_0x6e70('0x23')]=_0x30d11b['length'];if(_0x20a225[_0x6e70('0x23')]===0x0)return[];return db['sequelize']['query'](_0x21b0e7[_0x6e70('0x89')](),_0x4d47e1);})[_0x6e70('0x2d')](function(_0x3f37c1){_0x1de947=_[_0x6e70('0x8a')](_0x3f37c1,'id');_0x4d47e1=_[_0x6e70('0x8b')](_0x4d47e1,{'model':db[_0x6e70('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x406f29['query'][_0x6e70('0x43')]){_0x2864a0[_0x6e70('0x42')][_0x6e70('0x69')](function(_0x18e64c){_0x49e068[_0x6e70('0x4a')]('c.'+_0x18e64c);});}else{_0x49e068[_0x6e70('0x4a')](_0x6e70('0x7f'));_0x49e068[_0x6e70('0x4a')](_0x6e70('0x8c'));_0x49e068[_0x6e70('0x4a')]('c.lastName');_0x49e068[_0x6e70('0x4a')](_0x6e70('0x8d'));_0x49e068[_0x6e70('0x4a')]('c.mobile');_0x49e068['field'](_0x6e70('0x8e'));_0x49e068[_0x6e70('0x4a')](_0x6e70('0x8f'));_0x49e068[_0x6e70('0x4a')](_0x6e70('0x90'));_0x49e068['field']('c.deletedAt');_0x49e068[_0x6e70('0x4a')](_0x6e70('0x91'),'TagIds');}if(_0x2864a0[_0x6e70('0x25')])_0x49e068[_0x6e70('0x25')](_0x2864a0[_0x6e70('0x25')]);if(_0x2864a0[_0x6e70('0x24')])_0x49e068[_0x6e70('0x24')](_0x2864a0[_0x6e70('0x24')]);return db[_0x6e70('0x88')][_0x6e70('0x3e')](_0x49e068[_0x6e70('0x89')](),_0x4d47e1);})[_0x6e70('0x2d')](function(_0x347cc4){_0x347cc4[_0x6e70('0x69')](function(_0x2eb58b){if(_0x2eb58b[_0x6e70('0x92')]){_0x2eb58b['Tags']=[];_0x2eb58b['TagIds'][_0x6e70('0x5a')](',')['forEach'](function(_0x267dcb){_0x2eb58b['Tags']['push'](_0x1de947[_0x267dcb]);});}delete _0x2eb58b[_0x6e70('0x92')];});_0x20a225['rows']=_0x347cc4;return _0x20a225;})['then'](respondWithFilteredResult(_0xecf336,_0x2864a0));});})[_0x6e70('0x93')](handleError(_0xecf336,null));};exports[_0x6e70('0x2c')]=function(_0x3d1b42,_0x4e9fda){return db['CmContact']['find']({'where':{'id':_0x3d1b42[_0x6e70('0x94')]['id']}})['then'](handleEntityNotFound(_0x4e9fda,null))[_0x6e70('0x2d')](removeEntity(_0x4e9fda,null))[_0x6e70('0x93')](handleError(_0x4e9fda,null));};exports[_0x6e70('0x34')]=function(_0x3fe93d,_0x329068){return db[_0x6e70('0x33')][_0x6e70('0x34')]()['then'](function(_0x282b02){delete _0x282b02[_0x6e70('0x95')];for(var _0xb649a6=0x0;_0xb649a6=_0x333674){_0x264b39=_0x333674;_0xa3612a=0xc8;}else{_0xa3612a=0xce;}_0x4586c2[_0x0d8b('0x1d')](_0xa3612a);return _0x4586c2[_0x0d8b('0x22')](_0x0d8b('0x23'),_0x18dd2d+'-'+_0x264b39+'/'+_0x333674)[_0x0d8b('0x1f')](_0x5fecbd);}return null;};}function patchUpdates(_0x352c17){return function(_0x50ec1e){try{jsonpatch['apply'](_0x50ec1e,_0x352c17,!![]);}catch(_0x33fb87){return BPromise['reject'](_0x33fb87);}return _0x50ec1e['save']();};}function saveUpdates(_0x5527d8,_0x238728){return function(_0x2b924f){if(_0x2b924f){return _0x2b924f[_0x0d8b('0x24')](_0x5527d8)[_0x0d8b('0x25')](function(_0x221071){return _0x221071;});}return null;};}function removeEntity(_0x2c64e2,_0x30980c){return function(_0x4562cb){if(_0x4562cb){return _0x4562cb[_0x0d8b('0x26')]()['then'](function(){_0x2c64e2[_0x0d8b('0x1d')](0xcc)[_0x0d8b('0x1e')]();});}};}function handleEntityNotFound(_0x5363e3,_0xe1ef20){return function(_0x4a0ae4){if(!_0x4a0ae4){_0x5363e3[_0x0d8b('0x27')](0x194);}return _0x4a0ae4;};}function handleError(_0x234bdd,_0xa2af02){_0xa2af02=_0xa2af02||0x1f4;return function(_0x4fe6f9){logger['error'](_0x4fe6f9[_0x0d8b('0x28')]);if(_0x4fe6f9[_0x0d8b('0x29')]){delete _0x4fe6f9['name'];}_0x234bdd[_0x0d8b('0x1d')](_0xa2af02)['send'](_0x4fe6f9);};}exports[_0x0d8b('0x2a')]=function(_0x4b59e5,_0x97050a){var _0x48f24f={},_0x2ab00d={},_0x546bf6={'count':0x0,'rows':[]};return db[_0x0d8b('0x2b')]['describe']()[_0x0d8b('0x25')](function(_0x106e4c){var _0x2c058d=[];for(var _0x56120a=0x0;_0x56120a0x1){_0x214583['or'](_0x0d8b('0x68'),qs['getFullTextValue'](_0x24a859),null);}else{if(qs[_0x0d8b('0x69')](_0x24a859)){_0x214583['or'](_0x0d8b('0x6a'),_0x24a859+'%');_0x214583['or'](_0x0d8b('0x6b'),_0x24a859+'%');_0x214583['or'](_0x0d8b('0x6c'),_0x24a859+'%');_0x214583['or'](_0x0d8b('0x6d'),_0x24a859+'%');}else if(qs['isEmail'](_0x24a859)){_0x214583['or'](_0x0d8b('0x6e'),_0x24a859+'%');}else{_0x214583['or'](_0x0d8b('0x6f'),'%'+_0x24a859+'%');_0x214583['or'](_0x0d8b('0x70'),'%'+_0x24a859+'%');_0x214583['or'](_0x0d8b('0x6e'),'%'+_0x24a859+'%');}}}}_0x2c3c84[_0x0d8b('0x3e')](_0x214583);_0x2c3c84['group']('c.id');var _0x3b1166={'type':db[_0x0d8b('0x71')][_0x0d8b('0x72')][_0x0d8b('0x73')],'raw':!![]};var _0x5a70bd=_0x2c3c84[_0x0d8b('0x74')]()[_0x0d8b('0x42')](_0x0d8b('0x75'));if(_0x48f24f['order']){_0x48f24f[_0x0d8b('0x3c')]['forEach'](function(_0x2fce07){_0x2c3c84[_0x0d8b('0x3c')]('c.'+_0x2fce07[0x0],_0x2fce07[0x1]===_0x0d8b('0x76')?![]:!![]);});}if(!_[_0x0d8b('0x77')](_0x5059ad)){_0x2c3c84[_0x0d8b('0x78')](_0x4d7bb0);_0x5a70bd[_0x0d8b('0x3e')]('t.id\x20IN\x20?',_0x5059ad);}BPromise[_0x0d8b('0x79')]()['then'](function(){if(_0x495870&&!_[_0x0d8b('0x7a')](_0x495870[_0x0d8b('0x4d')],[_0x0d8b('0x42'),_0x0d8b('0x56')])){return _0x4b59e5['user'][_0x0d8b('0x7b')]({'attributes':['id'],'raw':!![]})[_0x0d8b('0x25')](function(_0x1a1ba7){if(_[_0x0d8b('0x77')](_0x1a1ba7)){_0x5a70bd[_0x0d8b('0x3e')](_0x0d8b('0x7c'));_0x2c3c84[_0x0d8b('0x3e')](_0x0d8b('0x7c'));}else{_0x5a70bd[_0x0d8b('0x3e')](_0x0d8b('0x60'),_['map'](_0x1a1ba7,'id'));_0x2c3c84['where'](_0x0d8b('0x60'),_[_0x0d8b('0x52')](_0x1a1ba7,'id'));}});}else{return;}})['then'](function(){db[_0x0d8b('0x7d')]['query'](_0x5a70bd['toString'](),_0x3b1166)[_0x0d8b('0x25')](function(_0x1c4e96){_0x546bf6['count']=_0x1c4e96['length'];if(_0x546bf6[_0x0d8b('0x7e')]===0x0)return[];return db[_0x0d8b('0x7d')][_0x0d8b('0x36')](_0x37b26c[_0x0d8b('0x7f')](),_0x3b1166);})[_0x0d8b('0x25')](function(_0x156859){_0x4b4bde=_[_0x0d8b('0x80')](_0x156859,'id');_0x3b1166=_['merge'](_0x3b1166,{'model':db[_0x0d8b('0x2b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4b59e5['query'][_0x0d8b('0x39')]){_0x48f24f[_0x0d8b('0x38')][_0x0d8b('0x53')](function(_0x14a34b){_0x2c3c84['field']('c.'+_0x14a34b);});}else{_0x2c3c84[_0x0d8b('0x42')]('c.id');_0x2c3c84[_0x0d8b('0x42')](_0x0d8b('0x81'));_0x2c3c84[_0x0d8b('0x42')](_0x0d8b('0x82'));_0x2c3c84[_0x0d8b('0x42')](_0x0d8b('0x83'));_0x2c3c84[_0x0d8b('0x42')](_0x0d8b('0x84'));_0x2c3c84[_0x0d8b('0x42')](_0x0d8b('0x85'));_0x2c3c84['field'](_0x0d8b('0x86'));_0x2c3c84['field'](_0x0d8b('0x87'));_0x2c3c84[_0x0d8b('0x42')]('c.deletedAt');_0x2c3c84[_0x0d8b('0x42')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x0d8b('0x88'));}if(_0x48f24f[_0x0d8b('0x21')])_0x2c3c84[_0x0d8b('0x21')](_0x48f24f[_0x0d8b('0x21')]);if(_0x48f24f[_0x0d8b('0x20')])_0x2c3c84[_0x0d8b('0x20')](_0x48f24f[_0x0d8b('0x20')]);return db[_0x0d8b('0x7d')]['query'](_0x2c3c84[_0x0d8b('0x7f')](),_0x3b1166);})[_0x0d8b('0x25')](function(_0x5b2916){_0x5b2916[_0x0d8b('0x53')](function(_0x105df9){if(_0x105df9[_0x0d8b('0x88')]){_0x105df9[_0x0d8b('0x89')]=[];_0x105df9[_0x0d8b('0x88')][_0x0d8b('0x51')](',')[_0x0d8b('0x53')](function(_0x1bf696){_0x105df9[_0x0d8b('0x89')][_0x0d8b('0x5f')](_0x4b4bde[_0x1bf696]);});}delete _0x105df9[_0x0d8b('0x88')];});_0x546bf6[_0x0d8b('0x8a')]=_0x5b2916;return _0x546bf6;})['then'](respondWithFilteredResult(_0x97050a,_0x48f24f));});})[_0x0d8b('0x8b')](handleError(_0x97050a,null));};exports[_0x0d8b('0x26')]=function(_0x3acffa,_0x58525c){return db['CmContact'][_0x0d8b('0x4e')]({'where':{'id':_0x3acffa[_0x0d8b('0x8c')]['id']}})[_0x0d8b('0x25')](handleEntityNotFound(_0x58525c,null))['then'](removeEntity(_0x58525c,null))['catch'](handleError(_0x58525c,null));};exports[_0x0d8b('0x8d')]=function(_0x130159,_0x305b87){return db[_0x0d8b('0x2b')][_0x0d8b('0x8d')]()[_0x0d8b('0x25')](function(_0x45aabf){delete _0x45aabf[_0x0d8b('0x8e')];for(var _0x20a3dd=0x0;_0x20a3dd{}\s\\|]/g,'-');_0x3229d1(null,util[_0x35fc('0x1f')](_0x35fc('0x20'),path[_0x35fc('0x21')](_0x350a27[_0x35fc('0x1d')],path['extname'](_0x350a27[_0x35fc('0x1d')])),Date[_0x35fc('0x22')](),path[_0x35fc('0x23')](_0x350a27[_0x35fc('0x1d')])));}})});router[_0x35fc('0x16')]('/csv',upload[_0x35fc('0x24')](_0x35fc('0x25')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x35fc('0x1a')]({'destination':function(_0x5a93df,_0x3d4a98,_0x51cfec){_0x51cfec(null,path[_0x35fc('0x1b')](config['root'],_0x35fc('0x26')));},'filename':function(_0xdfab9f,_0x5cb986,_0x519264){_0x5cb986[_0x35fc('0x1d')]=_0x5cb986['originalname'][_0x35fc('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x519264(null,util[_0x35fc('0x1f')]('%s-%s%s',path[_0x35fc('0x21')](_0x5cb986[_0x35fc('0x1d')],path[_0x35fc('0x23')](_0x5cb986[_0x35fc('0x1d')])),Date[_0x35fc('0x22')](),path[_0x35fc('0x23')](_0x5cb986[_0x35fc('0x1d')])));}})});router[_0x35fc('0x16')]('/upload',upload[_0x35fc('0x24')](_0x35fc('0x25')),controller[_0x35fc('0x27')]);router['post'](_0x35fc('0x28'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x29')]);router[_0x35fc('0x2a')](_0x35fc('0xc'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x2b')]);router[_0x35fc('0x2c')](_0x35fc('0xc'),auth[_0x35fc('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe14b=['/upload/:id','import','put','/:id','update','exports','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/tags','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','post','merge','create','/create_many','bulkCreate','setTags','join','root','server/files/tmp','originalname','replace','%s-%s%s','extname','/csv','file','diskStorage','format','basename','now','/upload','single','upload'];(function(_0x2a83af,_0x4fa9ed){var _0x2e1648=function(_0x59c429){while(--_0x59c429){_0x2a83af['push'](_0x2a83af['shift']());}};_0x2e1648(++_0x4fa9ed);}(_0xe14b,0x93));var _0xbe14=function(_0x4052c0,_0x4271ab){_0x4052c0=_0x4052c0-0x0;var _0x296f04=_0xe14b[_0x4052c0];return _0x296f04;};'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('./cmContact.controller');router[_0xbe14('0x5')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x7')]);router[_0xbe14('0x5')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0x5')](_0xbe14('0xb'),auth[_0xbe14('0x6')](),controller['getTags']);router['get'](_0xbe14('0xc'),auth[_0xbe14('0x6')](),controller['getHoppers']);router[_0xbe14('0x5')](_0xbe14('0xd'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xe')]);router[_0xbe14('0x5')](_0xbe14('0xf'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x10')]);router[_0xbe14('0x5')](_0xbe14('0x11'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x13')]('/merge',auth['isAuthenticated'](),controller[_0xbe14('0x14')]);router[_0xbe14('0x13')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x15')]);router['post'](_0xbe14('0x16'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x13')](_0xbe14('0xb'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x18')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x137ee5,_0x456ca8,_0x329588){_0x329588(null,path[_0xbe14('0x19')](config[_0xbe14('0x1a')],_0xbe14('0x1b')));},'filename':function(_0x59a9e3,_0x24f820,_0x4a1bbd){_0x24f820[_0xbe14('0x1c')]=_0x24f820[_0xbe14('0x1c')][_0xbe14('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4a1bbd(null,util['format'](_0xbe14('0x1e'),path['basename'](_0x24f820[_0xbe14('0x1c')],path['extname'](_0x24f820[_0xbe14('0x1c')])),Date['now'](),path[_0xbe14('0x1f')](_0x24f820[_0xbe14('0x1c')])));}})});router['post'](_0xbe14('0x20'),upload['single'](_0xbe14('0x21')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xbe14('0x22')]({'destination':function(_0x5fa043,_0x1ee9c1,_0x39cc81){_0x39cc81(null,path[_0xbe14('0x19')](config[_0xbe14('0x1a')],'server/files/tmp'));},'filename':function(_0x1822e0,_0x1ba46a,_0x391556){_0x1ba46a[_0xbe14('0x1c')]=_0x1ba46a['originalname'][_0xbe14('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x391556(null,util[_0xbe14('0x23')]('%s-%s%s',path[_0xbe14('0x24')](_0x1ba46a[_0xbe14('0x1c')],path[_0xbe14('0x1f')](_0x1ba46a[_0xbe14('0x1c')])),Date[_0xbe14('0x25')](),path[_0xbe14('0x1f')](_0x1ba46a[_0xbe14('0x1c')])));}})});router[_0xbe14('0x13')](_0xbe14('0x26'),upload[_0xbe14('0x27')](_0xbe14('0x21')),controller[_0xbe14('0x28')]);router[_0xbe14('0x13')](_0xbe14('0x29'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x2a')]);router[_0xbe14('0x2b')](_0xbe14('0x2c'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x2d')]);router['delete'](_0xbe14('0x2c'),auth['isAuthenticated'](),controller['destroy']);module[_0xbe14('0x2e')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index c78e4e1..f245fee 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 _0x5f71=['INTEGER','sequelize'];(function(_0x26505b,_0x170874){var _0x1472a7=function(_0x34acae){while(--_0x34acae){_0x26505b['push'](_0x26505b['shift']());}};_0x1472a7(++_0x170874);}(_0x5f71,0xc9));var _0x15f7=function(_0x2ed181,_0x3165cd){_0x2ed181=_0x2ed181-0x0;var _0x13d60c=_0x5f71[_0x2ed181];return _0x13d60c;};'use strict';var Sequelize=require(_0x15f7('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x15f7('0x1')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x15f7('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file +var _0x83d0=['exports','INTEGER','STRING','sequelize'];(function(_0x31b9c9,_0x2d3086){var _0x184ae4=function(_0x5e8c4a){while(--_0x5e8c4a){_0x31b9c9['push'](_0x31b9c9['shift']());}};_0x184ae4(++_0x2d3086);}(_0x83d0,0xb7));var _0x083d=function(_0x57678e,_0x410f66){_0x57678e=_0x57678e-0x0;var _0x1f4e8d=_0x83d0[_0x57678e];return _0x1f4e8d;};'use strict';var Sequelize=require(_0x083d('0x0'));module[_0x083d('0x1')]={'CmContactId':{'type':Sequelize[_0x083d('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x083d('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x083d('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x083d('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x083d('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 811feee..b13bfb9 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 _0x7ecf=['jsforce','to-csv','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then','error','name','send','index','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','length','include','find','create','role','user','CmContactHasItems','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','lodash','squel','crypto'];(function(_0xb5f4ca,_0x1fad0c){var _0x5f33de=function(_0x2d0f77){while(--_0x2d0f77){_0xb5f4ca['push'](_0xb5f4ca['shift']());}};_0x5f33de(++_0x1fad0c);}(_0x7ecf,0x1bc));var _0xf7ec=function(_0x2da722,_0x416027){_0x2da722=_0x2da722-0x0;var _0x180961=_0x7ecf[_0x2da722];return _0x180961;};'use strict';var pdf=require(_0xf7ec('0x0'));var emlformat=require(_0xf7ec('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf7ec('0x2'));var jsonpatch=require(_0xf7ec('0x3'));var rp=require(_0xf7ec('0x4'));var moment=require('moment');var BPromise=require(_0xf7ec('0x5'));var Mustache=require('mustache');var util=require(_0xf7ec('0x6'));var path=require(_0xf7ec('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf7ec('0x8'));var fs=require('fs');var _=require(_0xf7ec('0x9'));var squel=require(_0xf7ec('0xa'));var crypto=require(_0xf7ec('0xb'));var jsforce=require(_0xf7ec('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf7ec('0xd'));var querystring=require('querystring');var Papa=require(_0xf7ec('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf7ec('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7ec('0x10'));var logger=require(_0xf7ec('0x11'))(_0xf7ec('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xf7ec('0x13'))['db'];function respondWithStatusCode(_0x51188c,_0x57698e){_0x57698e=_0x57698e||0xcc;return function(_0x22745d){if(_0x22745d){return _0x51188c[_0xf7ec('0x14')](_0x57698e);}return _0x51188c[_0xf7ec('0x15')](_0x57698e)[_0xf7ec('0x16')]();};}function respondWithResult(_0x1bed37,_0x47954b){_0x47954b=_0x47954b||0xc8;return function(_0x3c7832){if(_0x3c7832){return _0x1bed37[_0xf7ec('0x15')](_0x47954b)[_0xf7ec('0x17')](_0x3c7832);}};}function respondWithFilteredResult(_0x43189d,_0x3d6b8c){return function(_0x49defa){if(_0x49defa){var _0x4e592d=_0x49defa[_0xf7ec('0x18')],_0x51450b=_0x3d6b8c['offset'],_0x411758=_0x3d6b8c[_0xf7ec('0x19')]+_0x3d6b8c['limit'],_0x1ec8d0;if(_0x411758>=_0x4e592d){_0x411758=_0x4e592d;_0x1ec8d0=0xc8;}else{_0x1ec8d0=0xce;}_0x43189d['status'](_0x1ec8d0);return _0x43189d['set'](_0xf7ec('0x1a'),_0x51450b+'-'+_0x411758+'/'+_0x4e592d)[_0xf7ec('0x17')](_0x49defa);}return null;};}function patchUpdates(_0x2ade2e){return function(_0x5227c1){try{jsonpatch[_0xf7ec('0x1b')](_0x5227c1,_0x2ade2e,!![]);}catch(_0x3e6176){return BPromise[_0xf7ec('0x1c')](_0x3e6176);}return _0x5227c1[_0xf7ec('0x1d')]();};}function saveUpdates(_0x49d73d,_0x5e8899){return function(_0x30120f){if(_0x30120f){return _0x30120f[_0xf7ec('0x1e')](_0x49d73d)['then'](function(_0x23d707){return _0x23d707;});}return null;};}function removeEntity(_0x1e27c8,_0x8e6bae){return function(_0x3b904a){if(_0x3b904a){return _0x3b904a[_0xf7ec('0x1f')]()['then'](function(){var _0x5dca8e=_0x3b904a[_0xf7ec('0x20')]({'plain':!![]});var _0x75a96='CmContactHasItems';return db[_0xf7ec('0x21')][_0xf7ec('0x1f')]({'where':{'type':_0x75a96,'resourceId':_0x5dca8e['id']}})['then'](function(){return _0x3b904a;});})[_0xf7ec('0x22')](function(){_0x1e27c8['status'](0xcc)[_0xf7ec('0x16')]();});}};}function handleEntityNotFound(_0x2bebc5,_0x4ae205){return function(_0x508e1b){if(!_0x508e1b){_0x2bebc5[_0xf7ec('0x14')](0x194);}return _0x508e1b;};}function handleError(_0x4d0fe4,_0x3277f7){_0x3277f7=_0x3277f7||0x1f4;return function(_0x46345b){logger[_0xf7ec('0x23')](_0x46345b['stack']);if(_0x46345b[_0xf7ec('0x24')]){delete _0x46345b[_0xf7ec('0x24')];}_0x4d0fe4[_0xf7ec('0x15')](_0x3277f7)[_0xf7ec('0x25')](_0x46345b);};}exports[_0xf7ec('0x26')]=function(_0xa2f508,_0x12531f){var _0x13c190={},_0x1dc99a={},_0x30d79c={'count':0x0,'rows':[]};var _0x3f9907=_['map'](db[_0xf7ec('0x27')][_0xf7ec('0x28')],function(_0x30f61a){return{'name':_0x30f61a[_0xf7ec('0x29')],'type':_0x30f61a[_0xf7ec('0x2a')][_0xf7ec('0x2b')]};});_0x1dc99a[_0xf7ec('0x2c')]=_['map'](_0x3f9907,_0xf7ec('0x24'));_0x1dc99a[_0xf7ec('0x2d')]=_[_0xf7ec('0x2e')](_0xa2f508[_0xf7ec('0x2d')]);_0x1dc99a[_0xf7ec('0x2f')]=_[_0xf7ec('0x30')](_0x1dc99a[_0xf7ec('0x2c')],_0x1dc99a[_0xf7ec('0x2d')]);_0x13c190[_0xf7ec('0x31')]=_[_0xf7ec('0x30')](_0x1dc99a['model'],qs[_0xf7ec('0x32')](_0xa2f508[_0xf7ec('0x2d')][_0xf7ec('0x32')]));_0x13c190['attributes']=_0x13c190[_0xf7ec('0x31')]['length']?_0x13c190['attributes']:_0x1dc99a[_0xf7ec('0x2c')];if(!_0xa2f508['query'][_0xf7ec('0x33')]('nolimit')){_0x13c190['limit']=qs[_0xf7ec('0x34')](_0xa2f508[_0xf7ec('0x2d')][_0xf7ec('0x34')]);_0x13c190['offset']=qs[_0xf7ec('0x19')](_0xa2f508[_0xf7ec('0x2d')][_0xf7ec('0x19')]);}_0x13c190[_0xf7ec('0x35')]=qs[_0xf7ec('0x36')](_0xa2f508[_0xf7ec('0x2d')][_0xf7ec('0x36')]);_0x13c190[_0xf7ec('0x37')]=qs[_0xf7ec('0x2f')](_['pick'](_0xa2f508[_0xf7ec('0x2d')],_0x1dc99a[_0xf7ec('0x2f')]),_0x3f9907);if(_0xa2f508[_0xf7ec('0x2d')][_0xf7ec('0x38')]){_0x13c190[_0xf7ec('0x37')]=_['merge'](_0x13c190[_0xf7ec('0x37')],{'$or':_['map'](_0x3f9907,function(_0x26e3d6){if(_0x26e3d6[_0xf7ec('0x2a')]!==_0xf7ec('0x39')){var _0x134bf5={};_0x134bf5[_0x26e3d6['name']]={'$like':'%'+_0xa2f508[_0xf7ec('0x2d')][_0xf7ec('0x38')]+'%'};return _0x134bf5;}})});}_0x13c190=_[_0xf7ec('0x3a')]({},_0x13c190,_0xa2f508[_0xf7ec('0x3b')]);var _0x1ae298={'where':_0x13c190[_0xf7ec('0x37')]};return db[_0xf7ec('0x27')][_0xf7ec('0x18')](_0x1ae298)[_0xf7ec('0x22')](function(_0x1f65ad){_0x30d79c['count']=_0x1f65ad;if(_0xa2f508[_0xf7ec('0x2d')][_0xf7ec('0x3c')]){_0x13c190['include']=[{'all':!![]}];}return db[_0xf7ec('0x27')][_0xf7ec('0x3d')](_0x13c190);})[_0xf7ec('0x22')](function(_0x345bc5){_0x30d79c['rows']=_0x345bc5;return _0x30d79c;})[_0xf7ec('0x22')](respondWithFilteredResult(_0x12531f,_0x13c190))[_0xf7ec('0x3e')](handleError(_0x12531f,null));};exports[_0xf7ec('0x3f')]=function(_0x456f19,_0x59bfc7){var _0x5cd57b={'raw':!![],'where':{'id':_0x456f19['params']['id']}},_0x197c7c={};_0x197c7c[_0xf7ec('0x2c')]=_[_0xf7ec('0x2e')](db[_0xf7ec('0x27')][_0xf7ec('0x28')]);_0x197c7c[_0xf7ec('0x2d')]=_['keys'](_0x456f19['query']);_0x197c7c[_0xf7ec('0x2f')]=_['intersection'](_0x197c7c['model'],_0x197c7c[_0xf7ec('0x2d')]);_0x5cd57b['attributes']=_[_0xf7ec('0x30')](_0x197c7c[_0xf7ec('0x2c')],qs['fields'](_0x456f19[_0xf7ec('0x2d')]['fields']));_0x5cd57b['attributes']=_0x5cd57b[_0xf7ec('0x31')][_0xf7ec('0x40')]?_0x5cd57b[_0xf7ec('0x31')]:_0x197c7c[_0xf7ec('0x2c')];if(_0x456f19[_0xf7ec('0x2d')]['includeAll']){_0x5cd57b[_0xf7ec('0x41')]=[{'all':!![]}];}_0x5cd57b=_[_0xf7ec('0x3a')]({},_0x5cd57b,_0x456f19[_0xf7ec('0x3b')]);return db['CmContactHasItem'][_0xf7ec('0x42')](_0x5cd57b)[_0xf7ec('0x22')](handleEntityNotFound(_0x59bfc7,null))['then'](respondWithResult(_0x59bfc7,null))[_0xf7ec('0x3e')](handleError(_0x59bfc7,null));};exports['create']=function(_0x14e861,_0x3bcc33){return db[_0xf7ec('0x27')][_0xf7ec('0x43')](_0x14e861['body'],{})[_0xf7ec('0x22')](function(_0x1c3777){var _0xa8c8af=_0x14e861['user'][_0xf7ec('0x20')]({'plain':!![]});if(!_0xa8c8af)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa8c8af[_0xf7ec('0x44')]===_0xf7ec('0x45')){var _0x1a22b5=_0x1c3777[_0xf7ec('0x20')]({'plain':!![]});var _0x3c12c3=_0xf7ec('0x46');return db['UserProfileSection'][_0xf7ec('0x42')]({'where':{'name':_0x3c12c3,'userProfileId':_0xa8c8af[_0xf7ec('0x47')]},'raw':!![]})[_0xf7ec('0x22')](function(_0x402e1e){if(_0x402e1e&&_0x402e1e[_0xf7ec('0x48')]===0x0){return db[_0xf7ec('0x21')][_0xf7ec('0x43')]({'name':_0x1a22b5[_0xf7ec('0x24')],'resourceId':_0x1a22b5['id'],'type':_0x402e1e[_0xf7ec('0x24')],'sectionId':_0x402e1e['id']},{})[_0xf7ec('0x22')](function(){return _0x1c3777;});}else{return _0x1c3777;}})[_0xf7ec('0x3e')](function(_0x37ded9){logger[_0xf7ec('0x23')](_0xf7ec('0x49'),_0x37ded9);throw _0x37ded9;});}return _0x1c3777;})[_0xf7ec('0x22')](respondWithResult(_0x3bcc33,0xc9))['catch'](handleError(_0x3bcc33,null));};exports[_0xf7ec('0x1e')]=function(_0x5f0aeb,_0x43ff92){if(_0x5f0aeb['body']['id']){delete _0x5f0aeb[_0xf7ec('0x4a')]['id'];}return db[_0xf7ec('0x27')][_0xf7ec('0x42')]({'where':{'id':_0x5f0aeb[_0xf7ec('0x4b')]['id']}})[_0xf7ec('0x22')](handleEntityNotFound(_0x43ff92,null))[_0xf7ec('0x22')](saveUpdates(_0x5f0aeb['body'],null))[_0xf7ec('0x22')](respondWithResult(_0x43ff92,null))[_0xf7ec('0x3e')](handleError(_0x43ff92,null));};exports[_0xf7ec('0x1f')]=function(_0x1aeab2,_0xb1bd13){return db[_0xf7ec('0x27')][_0xf7ec('0x42')]({'where':{'id':_0x1aeab2[_0xf7ec('0x4b')]['id']}})[_0xf7ec('0x22')](handleEntityNotFound(_0xb1bd13,null))[_0xf7ec('0x22')](removeEntity(_0xb1bd13,null))[_0xf7ec('0x3e')](handleError(_0xb1bd13,null));}; \ No newline at end of file +var _0x8a7e=['UserProfileResource','destroy','status','sendStatus','error','name','send','map','CmContactHasItem','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','get','CmContactHasItems'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8a7e,0x124));var _0xe8a7=function(_0x419c9e,_0x1a5dfe){_0x419c9e=_0x419c9e-0x0;var _0x135d35=_0x8a7e[_0x419c9e];return _0x135d35;};'use strict';var pdf=require(_0xe8a7('0x0'));var emlformat=require(_0xe8a7('0x1'));var rimraf=require(_0xe8a7('0x2'));var zipdir=require(_0xe8a7('0x3'));var jsonpatch=require(_0xe8a7('0x4'));var rp=require(_0xe8a7('0x5'));var moment=require(_0xe8a7('0x6'));var BPromise=require(_0xe8a7('0x7'));var Mustache=require(_0xe8a7('0x8'));var util=require(_0xe8a7('0x9'));var path=require('path');var sox=require(_0xe8a7('0xa'));var csv=require('to-csv');var ejs=require(_0xe8a7('0xb'));var fs=require('fs');var _=require(_0xe8a7('0xc'));var squel=require(_0xe8a7('0xd'));var crypto=require(_0xe8a7('0xe'));var jsforce=require(_0xe8a7('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe8a7('0x10'));var Papa=require(_0xe8a7('0x11'));var Redis=require(_0xe8a7('0x12'));var authService=require(_0xe8a7('0x13'));var qs=require(_0xe8a7('0x14'));var as=require(_0xe8a7('0x15'));var hardwareService=require(_0xe8a7('0x16'));var logger=require(_0xe8a7('0x17'))(_0xe8a7('0x18'));var utils=require(_0xe8a7('0x19'));var config=require('../../config/environment');var db=require(_0xe8a7('0x1a'))['db'];function respondWithStatusCode(_0x1cd20c,_0x2844a5){_0x2844a5=_0x2844a5||0xcc;return function(_0x587689){if(_0x587689){return _0x1cd20c['sendStatus'](_0x2844a5);}return _0x1cd20c['status'](_0x2844a5)[_0xe8a7('0x1b')]();};}function respondWithResult(_0x533923,_0x4ecce3){_0x4ecce3=_0x4ecce3||0xc8;return function(_0x4f7f34){if(_0x4f7f34){return _0x533923['status'](_0x4ecce3)[_0xe8a7('0x1c')](_0x4f7f34);}};}function respondWithFilteredResult(_0x496d9d,_0x29e625){return function(_0x4a76fd){if(_0x4a76fd){var _0x567ec6=_0x4a76fd[_0xe8a7('0x1d')],_0x2e4f61=_0x29e625[_0xe8a7('0x1e')],_0xacab2b=_0x29e625[_0xe8a7('0x1e')]+_0x29e625[_0xe8a7('0x1f')],_0x53bcbf;if(_0xacab2b>=_0x567ec6){_0xacab2b=_0x567ec6;_0x53bcbf=0xc8;}else{_0x53bcbf=0xce;}_0x496d9d['status'](_0x53bcbf);return _0x496d9d[_0xe8a7('0x20')](_0xe8a7('0x21'),_0x2e4f61+'-'+_0xacab2b+'/'+_0x567ec6)[_0xe8a7('0x1c')](_0x4a76fd);}return null;};}function patchUpdates(_0x12c272){return function(_0xa468e5){try{jsonpatch[_0xe8a7('0x22')](_0xa468e5,_0x12c272,!![]);}catch(_0x5d72bc){return BPromise['reject'](_0x5d72bc);}return _0xa468e5[_0xe8a7('0x23')]();};}function saveUpdates(_0x54c9bf,_0xe06af7){return function(_0xb8a7da){if(_0xb8a7da){return _0xb8a7da[_0xe8a7('0x24')](_0x54c9bf)['then'](function(_0x2162b0){return _0x2162b0;});}return null;};}function removeEntity(_0x4e754b,_0x18c33e){return function(_0x51ee30){if(_0x51ee30){return _0x51ee30['destroy']()[_0xe8a7('0x25')](function(){var _0x5b680a=_0x51ee30[_0xe8a7('0x26')]({'plain':!![]});var _0x3b3c72=_0xe8a7('0x27');return db[_0xe8a7('0x28')][_0xe8a7('0x29')]({'where':{'type':_0x3b3c72,'resourceId':_0x5b680a['id']}})[_0xe8a7('0x25')](function(){return _0x51ee30;});})[_0xe8a7('0x25')](function(){_0x4e754b[_0xe8a7('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f06e2,_0x1116f1){return function(_0x265d30){if(!_0x265d30){_0x2f06e2[_0xe8a7('0x2b')](0x194);}return _0x265d30;};}function handleError(_0x52194a,_0xd36e5d){_0xd36e5d=_0xd36e5d||0x1f4;return function(_0x37c4e8){logger[_0xe8a7('0x2c')](_0x37c4e8['stack']);if(_0x37c4e8['name']){delete _0x37c4e8[_0xe8a7('0x2d')];}_0x52194a[_0xe8a7('0x2a')](_0xd36e5d)[_0xe8a7('0x2e')](_0x37c4e8);};}exports['index']=function(_0x2ffd86,_0x2da5d4){var _0x4e552e={},_0x4e89c1={},_0xfab35b={'count':0x0,'rows':[]};var _0x227f86=_[_0xe8a7('0x2f')](db[_0xe8a7('0x30')][_0xe8a7('0x31')],function(_0x30707d){return{'name':_0x30707d['fieldName'],'type':_0x30707d[_0xe8a7('0x32')][_0xe8a7('0x33')]};});_0x4e89c1[_0xe8a7('0x34')]=_['map'](_0x227f86,_0xe8a7('0x2d'));_0x4e89c1[_0xe8a7('0x35')]=_[_0xe8a7('0x36')](_0x2ffd86[_0xe8a7('0x35')]);_0x4e89c1['filters']=_[_0xe8a7('0x37')](_0x4e89c1[_0xe8a7('0x34')],_0x4e89c1[_0xe8a7('0x35')]);_0x4e552e[_0xe8a7('0x38')]=_[_0xe8a7('0x37')](_0x4e89c1[_0xe8a7('0x34')],qs[_0xe8a7('0x39')](_0x2ffd86[_0xe8a7('0x35')][_0xe8a7('0x39')]));_0x4e552e[_0xe8a7('0x38')]=_0x4e552e[_0xe8a7('0x38')]['length']?_0x4e552e['attributes']:_0x4e89c1[_0xe8a7('0x34')];if(!_0x2ffd86[_0xe8a7('0x35')]['hasOwnProperty'](_0xe8a7('0x3a'))){_0x4e552e[_0xe8a7('0x1f')]=qs[_0xe8a7('0x1f')](_0x2ffd86[_0xe8a7('0x35')][_0xe8a7('0x1f')]);_0x4e552e[_0xe8a7('0x1e')]=qs['offset'](_0x2ffd86[_0xe8a7('0x35')][_0xe8a7('0x1e')]);}_0x4e552e[_0xe8a7('0x3b')]=qs[_0xe8a7('0x3c')](_0x2ffd86['query']['sort']);_0x4e552e[_0xe8a7('0x3d')]=qs[_0xe8a7('0x3e')](_['pick'](_0x2ffd86['query'],_0x4e89c1[_0xe8a7('0x3e')]),_0x227f86);if(_0x2ffd86[_0xe8a7('0x35')][_0xe8a7('0x3f')]){_0x4e552e[_0xe8a7('0x3d')]=_[_0xe8a7('0x40')](_0x4e552e[_0xe8a7('0x3d')],{'$or':_['map'](_0x227f86,function(_0x34c92e){if(_0x34c92e[_0xe8a7('0x32')]!==_0xe8a7('0x41')){var _0x5075ae={};_0x5075ae[_0x34c92e['name']]={'$like':'%'+_0x2ffd86[_0xe8a7('0x35')][_0xe8a7('0x3f')]+'%'};return _0x5075ae;}})});}_0x4e552e=_['merge']({},_0x4e552e,_0x2ffd86[_0xe8a7('0x42')]);var _0x1bf771={'where':_0x4e552e['where']};return db['CmContactHasItem'][_0xe8a7('0x1d')](_0x1bf771)[_0xe8a7('0x25')](function(_0x349e91){_0xfab35b[_0xe8a7('0x1d')]=_0x349e91;if(_0x2ffd86['query']['includeAll']){_0x4e552e[_0xe8a7('0x43')]=[{'all':!![]}];}return db[_0xe8a7('0x30')][_0xe8a7('0x44')](_0x4e552e);})['then'](function(_0x4d5b8d){_0xfab35b[_0xe8a7('0x45')]=_0x4d5b8d;return _0xfab35b;})['then'](respondWithFilteredResult(_0x2da5d4,_0x4e552e))[_0xe8a7('0x46')](handleError(_0x2da5d4,null));};exports[_0xe8a7('0x47')]=function(_0x3bf0f1,_0xaf212c){var _0x169929={'raw':!![],'where':{'id':_0x3bf0f1[_0xe8a7('0x48')]['id']}},_0x583a00={};_0x583a00[_0xe8a7('0x34')]=_[_0xe8a7('0x36')](db[_0xe8a7('0x30')][_0xe8a7('0x31')]);_0x583a00[_0xe8a7('0x35')]=_[_0xe8a7('0x36')](_0x3bf0f1[_0xe8a7('0x35')]);_0x583a00['filters']=_['intersection'](_0x583a00['model'],_0x583a00['query']);_0x169929[_0xe8a7('0x38')]=_[_0xe8a7('0x37')](_0x583a00[_0xe8a7('0x34')],qs['fields'](_0x3bf0f1[_0xe8a7('0x35')][_0xe8a7('0x39')]));_0x169929[_0xe8a7('0x38')]=_0x169929[_0xe8a7('0x38')][_0xe8a7('0x49')]?_0x169929['attributes']:_0x583a00[_0xe8a7('0x34')];if(_0x3bf0f1[_0xe8a7('0x35')][_0xe8a7('0x4a')]){_0x169929[_0xe8a7('0x43')]=[{'all':!![]}];}_0x169929=_[_0xe8a7('0x40')]({},_0x169929,_0x3bf0f1[_0xe8a7('0x42')]);return db[_0xe8a7('0x30')][_0xe8a7('0x4b')](_0x169929)[_0xe8a7('0x25')](handleEntityNotFound(_0xaf212c,null))[_0xe8a7('0x25')](respondWithResult(_0xaf212c,null))[_0xe8a7('0x46')](handleError(_0xaf212c,null));};exports['create']=function(_0x15b482,_0x3f12b0){return db['CmContactHasItem'][_0xe8a7('0x4c')](_0x15b482[_0xe8a7('0x4d')],{})[_0xe8a7('0x25')](function(_0x19e05e){var _0x35b298=_0x15b482[_0xe8a7('0x4e')][_0xe8a7('0x26')]({'plain':!![]});if(!_0x35b298)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35b298[_0xe8a7('0x4f')]===_0xe8a7('0x4e')){var _0xb46748=_0x19e05e[_0xe8a7('0x26')]({'plain':!![]});var _0x20a6e7=_0xe8a7('0x27');return db[_0xe8a7('0x50')][_0xe8a7('0x4b')]({'where':{'name':_0x20a6e7,'userProfileId':_0x35b298['userProfileId']},'raw':!![]})[_0xe8a7('0x25')](function(_0x598eaa){if(_0x598eaa&&_0x598eaa[_0xe8a7('0x51')]===0x0){return db[_0xe8a7('0x28')][_0xe8a7('0x4c')]({'name':_0xb46748['name'],'resourceId':_0xb46748['id'],'type':_0x598eaa[_0xe8a7('0x2d')],'sectionId':_0x598eaa['id']},{})[_0xe8a7('0x25')](function(){return _0x19e05e;});}else{return _0x19e05e;}})[_0xe8a7('0x46')](function(_0x4aba02){logger[_0xe8a7('0x2c')](_0xe8a7('0x52'),_0x4aba02);throw _0x4aba02;});}return _0x19e05e;})['then'](respondWithResult(_0x3f12b0,0xc9))[_0xe8a7('0x46')](handleError(_0x3f12b0,null));};exports[_0xe8a7('0x24')]=function(_0x114500,_0xc89686){if(_0x114500['body']['id']){delete _0x114500[_0xe8a7('0x4d')]['id'];}return db[_0xe8a7('0x30')][_0xe8a7('0x4b')]({'where':{'id':_0x114500[_0xe8a7('0x48')]['id']}})[_0xe8a7('0x25')](handleEntityNotFound(_0xc89686,null))[_0xe8a7('0x25')](saveUpdates(_0x114500[_0xe8a7('0x4d')],null))[_0xe8a7('0x25')](respondWithResult(_0xc89686,null))['catch'](handleError(_0xc89686,null));};exports['destroy']=function(_0x387a1b,_0x5319b5){return db[_0xe8a7('0x30')][_0xe8a7('0x4b')]({'where':{'id':_0x387a1b[_0xe8a7('0x48')]['id']}})[_0xe8a7('0x25')](handleEntityNotFound(_0x5319b5,null))['then'](removeEntity(_0x5319b5,null))[_0xe8a7('0x46')](handleError(_0x5319b5,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 5a7822e..a3b372c 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 _0x9c5a=['define','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x2c7623,_0x56b10a){var _0x363242=function(_0x25b5a5){while(--_0x25b5a5){_0x2c7623['push'](_0x2c7623['shift']());}};_0x363242(++_0x56b10a);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x405c19,_0x56bc79){_0x405c19=_0x405c19-0x0;var _0x47270d=_0x9c5a[_0x405c19];return _0x47270d;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./cmContactHasItem.attributes');module[_0xa9c5('0x8')]=function(_0x4d9c7a,_0x394d84){return _0x4d9c7a[_0xa9c5('0x9')]('CmContactHasItem',attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3831=['define','cm_contact_has_items','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmContactHasItem.attributes'];(function(_0x28ba8b,_0xfaf144){var _0x4b8621=function(_0xdbc5fe){while(--_0xdbc5fe){_0x28ba8b['push'](_0x28ba8b['shift']());}};_0x4b8621(++_0xfaf144);}(_0x3831,0x14c));var _0x1383=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0x3831[_0x190ff6];return _0x5356d2;};'use strict';var _=require(_0x1383('0x0'));var util=require('util');var logger=require(_0x1383('0x1'))(_0x1383('0x2'));var moment=require(_0x1383('0x3'));var BPromise=require(_0x1383('0x4'));var rp=require(_0x1383('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1383('0x6'));var config=require('../../config/environment');var attributes=require(_0x1383('0x7'));module['exports']=function(_0x5b64b1,_0x5eb4d8){return _0x5b64b1[_0x1383('0x8')]('CmContactHasItem',attributes,{'tableName':_0x1383('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 49f7b43..f79dfc0 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 _0x86ec=['../../config/environment','client','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x86ec,0xe9));var _0xc86e=function(_0x3c6ddc,_0x241341){_0x3c6ddc=_0x3c6ddc-0x0;var _0x24cd9e=_0x86ec[_0x3c6ddc];return _0x24cd9e;};'use strict';var _=require(_0xc86e('0x0'));var util=require(_0xc86e('0x1'));var moment=require(_0xc86e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc86e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc86e('0x4'));var logger=require(_0xc86e('0x5'))(_0xc86e('0x6'));var config=require(_0xc86e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc86e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x570101,_0x546c0e,_0x466ae1){return new BPromise(function(_0xd76f26,_0xe48549){return client['request'](_0x570101,_0x466ae1)[_0xc86e('0x9')](function(_0x5e0dca){logger[_0xc86e('0xa')](_0xc86e('0xb'),_0x546c0e,_0xc86e('0xc'));logger['debug'](_0xc86e('0xd'),_0x546c0e,_0xc86e('0xc'),JSON[_0xc86e('0xe')](_0x5e0dca));if(_0x5e0dca[_0xc86e('0xf')]){if(_0x5e0dca[_0xc86e('0xf')][_0xc86e('0x10')]===0x1f4){logger['error'](_0xc86e('0xb'),_0x546c0e,_0x5e0dca['error']['message']);return _0xe48549(_0x5e0dca[_0xc86e('0xf')]['message']);}logger['error'](_0xc86e('0xb'),_0x546c0e,_0x5e0dca[_0xc86e('0xf')][_0xc86e('0x11')]);return _0xd76f26(_0x5e0dca[_0xc86e('0xf')][_0xc86e('0x11')]);}else{logger[_0xc86e('0xa')](_0xc86e('0xb'),_0x546c0e,_0xc86e('0xc'));_0xd76f26(_0x5e0dca[_0xc86e('0x12')][_0xc86e('0x11')]);}})[_0xc86e('0x13')](function(_0x530435){logger[_0xc86e('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x546c0e,_0x530435);_0xe48549(_0x530435);});});} \ No newline at end of file +var _0x7351=['jayson/promise','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x19112e,_0x55f32d){var _0x4ae6a2=function(_0x435513){while(--_0x435513){_0x19112e['push'](_0x19112e['shift']());}};_0x4ae6a2(++_0x55f32d);}(_0x7351,0x139));var _0x1735=function(_0x5d43db,_0x4a38f9){_0x5d43db=_0x5d43db-0x0;var _0x1c73b1=_0x7351[_0x5d43db];return _0x1c73b1;};'use strict';var _=require(_0x1735('0x0'));var util=require(_0x1735('0x1'));var moment=require(_0x1735('0x2'));var BPromise=require(_0x1735('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1735('0x4'))['db'];var utils=require(_0x1735('0x5'));var logger=require(_0x1735('0x6'))(_0x1735('0x7'));var config=require(_0x1735('0x8'));var jayson=require(_0x1735('0x9'));var client=jayson['client'][_0x1735('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31d194,_0x1be073,_0x13627d){return new BPromise(function(_0x25bd9f,_0x302e43){return client[_0x1735('0xb')](_0x31d194,_0x13627d)[_0x1735('0xc')](function(_0x3d1d20){logger[_0x1735('0xd')](_0x1735('0xe'),_0x1be073,_0x1735('0xf'));logger[_0x1735('0x10')](_0x1735('0x11'),_0x1be073,_0x1735('0xf'),JSON['stringify'](_0x3d1d20));if(_0x3d1d20[_0x1735('0x12')]){if(_0x3d1d20[_0x1735('0x12')][_0x1735('0x13')]===0x1f4){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x1be073,_0x3d1d20['error'][_0x1735('0x14')]);return _0x302e43(_0x3d1d20['error'][_0x1735('0x14')]);}logger['error'](_0x1735('0xe'),_0x1be073,_0x3d1d20[_0x1735('0x12')]['message']);return _0x25bd9f(_0x3d1d20['error'][_0x1735('0x14')]);}else{logger[_0x1735('0xd')](_0x1735('0xe'),_0x1be073,_0x1735('0xf'));_0x25bd9f(_0x3d1d20[_0x1735('0x15')][_0x1735('0x14')]);}})[_0x1735('0x16')](function(_0x2bebb0){logger[_0x1735('0x12')](_0x1735('0xe'),_0x1be073,_0x2bebb0);_0x302e43(_0x2bebb0);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index f3f49c6..6fa54ef 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 _0x58be=['destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','index','/:id','isAuthenticated','post','create','put','update','delete'];(function(_0x4733e8,_0x25e4d5){var _0x29b8cc=function(_0x13434f){while(--_0x13434f){_0x4733e8['push'](_0x4733e8['shift']());}};_0x29b8cc(++_0x25e4d5);}(_0x58be,0xb6));var _0xe58b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x58be[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xe58b('0x0'));var util=require('util');var path=require(_0xe58b('0x1'));var timeout=require(_0xe58b('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xe58b('0x3'));var interaction=require(_0xe58b('0x4'));var config=require(_0xe58b('0x5'));var controller=require(_0xe58b('0x6'));router[_0xe58b('0x7')]('/',auth['isAuthenticated'](),controller[_0xe58b('0x8')]);router[_0xe58b('0x7')](_0xe58b('0x9'),auth[_0xe58b('0xa')](),controller['show']);router[_0xe58b('0xb')]('/',auth[_0xe58b('0xa')](),controller[_0xe58b('0xc')]);router[_0xe58b('0xd')](_0xe58b('0x9'),auth[_0xe58b('0xa')](),controller[_0xe58b('0xe')]);router[_0xe58b('0xf')](_0xe58b('0x9'),auth['isAuthenticated'](),controller[_0xe58b('0x10')]);module[_0xe58b('0x11')]=router; \ No newline at end of file +var _0xec09=['show','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','/:id','isAuthenticated'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xec09,0xdd));var _0x9ec0=function(_0x1788e6,_0x2c941c){_0x1788e6=_0x1788e6-0x0;var _0x2e433f=_0xec09[_0x1788e6];return _0x2e433f;};'use strict';var multer=require(_0x9ec0('0x0'));var util=require(_0x9ec0('0x1'));var path=require(_0x9ec0('0x2'));var timeout=require(_0x9ec0('0x3'));var express=require(_0x9ec0('0x4'));var router=express[_0x9ec0('0x5')]();var auth=require(_0x9ec0('0x6'));var interaction=require(_0x9ec0('0x7'));var config=require(_0x9ec0('0x8'));var controller=require(_0x9ec0('0x9'));router[_0x9ec0('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9ec0('0xa')](_0x9ec0('0xb'),auth[_0x9ec0('0xc')](),controller[_0x9ec0('0xd')]);router['post']('/',auth[_0x9ec0('0xc')](),controller[_0x9ec0('0xe')]);router['put']('/:id',auth[_0x9ec0('0xc')](),controller[_0x9ec0('0xf')]);router['delete'](_0x9ec0('0xb'),auth[_0x9ec0('0xc')](),controller[_0x9ec0('0x10')]);module[_0x9ec0('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 7faec3b..af3251f 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 _0x0136=['exports','STRING','sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0136,0x182));var _0x6013=function(_0x2ec952,_0x551ddd){_0x2ec952=_0x2ec952-0x0;var _0x485dab=_0x0136[_0x2ec952];return _0x485dab;};'use strict';var Sequelize=require(_0x6013('0x0'));module[_0x6013('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'phone':{'type':Sequelize[_0x6013('0x2')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0x4093=['sequelize','INTEGER','STRING'];(function(_0x284f8e,_0x531296){var _0x57e2f0=function(_0x4ea18e){while(--_0x4ea18e){_0x284f8e['push'](_0x284f8e['shift']());}};_0x57e2f0(++_0x531296);}(_0x4093,0x1cb));var _0x3409=function(_0x5aace5,_0x3ecd63){_0x5aace5=_0x5aace5-0x0;var _0x3cde99=_0x4093[_0x5aace5];return _0x3cde99;};'use strict';var Sequelize=require(_0x3409('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x3409('0x1')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x3409('0x2')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index 6718e78..f359d11 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 _0x0bcd=['map','CmContactHasPhone','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','limit','Content-Range','apply','reject','update','then','destroy','get','CmContactHasPhones','UserProfileResource','name','send','index'];(function(_0x2bbc07,_0x1e2168){var _0x6879e4=function(_0x290fa1){while(--_0x290fa1){_0x2bbc07['push'](_0x2bbc07['shift']());}};_0x6879e4(++_0x1e2168);}(_0x0bcd,0x117));var _0xd0bc=function(_0x5c9ba7,_0x1191a9){_0x5c9ba7=_0x5c9ba7-0x0;var _0x247607=_0x0bcd[_0x5c9ba7];return _0x247607;};'use strict';var pdf=require(_0xd0bc('0x0'));var emlformat=require(_0xd0bc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd0bc('0x2'));var jsonpatch=require(_0xd0bc('0x3'));var rp=require('request-promise');var moment=require(_0xd0bc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd0bc('0x5'));var util=require(_0xd0bc('0x6'));var path=require(_0xd0bc('0x7'));var sox=require(_0xd0bc('0x8'));var csv=require(_0xd0bc('0x9'));var ejs=require(_0xd0bc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd0bc('0xb'));var crypto=require(_0xd0bc('0xc'));var jsforce=require(_0xd0bc('0xd'));var deskjs=require(_0xd0bc('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd0bc('0xf'));var Papa=require(_0xd0bc('0x10'));var Redis=require(_0xd0bc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd0bc('0x12'));var as=require(_0xd0bc('0x13'));var hardwareService=require(_0xd0bc('0x14'));var logger=require(_0xd0bc('0x15'))(_0xd0bc('0x16'));var utils=require('../../config/utils');var config=require(_0xd0bc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54e332,_0x4ddda6){_0x4ddda6=_0x4ddda6||0xcc;return function(_0x10e095){if(_0x10e095){return _0x54e332[_0xd0bc('0x18')](_0x4ddda6);}return _0x54e332[_0xd0bc('0x19')](_0x4ddda6)['end']();};}function respondWithResult(_0x572d7f,_0x1d14f5){_0x1d14f5=_0x1d14f5||0xc8;return function(_0x22534d){if(_0x22534d){return _0x572d7f[_0xd0bc('0x19')](_0x1d14f5)[_0xd0bc('0x1a')](_0x22534d);}};}function respondWithFilteredResult(_0x175336,_0x413e3c){return function(_0x2e961c){if(_0x2e961c){var _0x4f045c=_0x2e961c['count'],_0x3872d7=_0x413e3c[_0xd0bc('0x1b')],_0xf66cb4=_0x413e3c[_0xd0bc('0x1b')]+_0x413e3c[_0xd0bc('0x1c')],_0x19f9a2;if(_0xf66cb4>=_0x4f045c){_0xf66cb4=_0x4f045c;_0x19f9a2=0xc8;}else{_0x19f9a2=0xce;}_0x175336['status'](_0x19f9a2);return _0x175336['set'](_0xd0bc('0x1d'),_0x3872d7+'-'+_0xf66cb4+'/'+_0x4f045c)[_0xd0bc('0x1a')](_0x2e961c);}return null;};}function patchUpdates(_0x2ff443){return function(_0x3f1a8c){try{jsonpatch[_0xd0bc('0x1e')](_0x3f1a8c,_0x2ff443,!![]);}catch(_0x4475b0){return BPromise[_0xd0bc('0x1f')](_0x4475b0);}return _0x3f1a8c['save']();};}function saveUpdates(_0x49b1e0,_0xcc0869){return function(_0x1949c5){if(_0x1949c5){return _0x1949c5[_0xd0bc('0x20')](_0x49b1e0)[_0xd0bc('0x21')](function(_0x108857){return _0x108857;});}return null;};}function removeEntity(_0x5284de,_0x421080){return function(_0x39fa47){if(_0x39fa47){return _0x39fa47[_0xd0bc('0x22')]()[_0xd0bc('0x21')](function(){var _0x80075b=_0x39fa47[_0xd0bc('0x23')]({'plain':!![]});var _0x1bf1cc=_0xd0bc('0x24');return db[_0xd0bc('0x25')][_0xd0bc('0x22')]({'where':{'type':_0x1bf1cc,'resourceId':_0x80075b['id']}})['then'](function(){return _0x39fa47;});})[_0xd0bc('0x21')](function(){_0x5284de[_0xd0bc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfee466,_0x44cf0e){return function(_0x106c4b){if(!_0x106c4b){_0xfee466[_0xd0bc('0x18')](0x194);}return _0x106c4b;};}function handleError(_0x39eebe,_0x1bc5a4){_0x1bc5a4=_0x1bc5a4||0x1f4;return function(_0x1128eb){logger['error'](_0x1128eb['stack']);if(_0x1128eb[_0xd0bc('0x26')]){delete _0x1128eb[_0xd0bc('0x26')];}_0x39eebe[_0xd0bc('0x19')](_0x1bc5a4)[_0xd0bc('0x27')](_0x1128eb);};}exports[_0xd0bc('0x28')]=function(_0x4788bd,_0xa1f50b){var _0x2b3982={},_0xb2f512={},_0x526c54={'count':0x0,'rows':[]};var _0x5068ed=_[_0xd0bc('0x29')](db[_0xd0bc('0x2a')][_0xd0bc('0x2b')],function(_0x2982a2){return{'name':_0x2982a2['fieldName'],'type':_0x2982a2[_0xd0bc('0x2c')][_0xd0bc('0x2d')]};});_0xb2f512['model']=_[_0xd0bc('0x29')](_0x5068ed,_0xd0bc('0x26'));_0xb2f512[_0xd0bc('0x2e')]=_[_0xd0bc('0x2f')](_0x4788bd[_0xd0bc('0x2e')]);_0xb2f512['filters']=_['intersection'](_0xb2f512[_0xd0bc('0x30')],_0xb2f512[_0xd0bc('0x2e')]);_0x2b3982[_0xd0bc('0x31')]=_[_0xd0bc('0x32')](_0xb2f512[_0xd0bc('0x30')],qs[_0xd0bc('0x33')](_0x4788bd[_0xd0bc('0x2e')][_0xd0bc('0x33')]));_0x2b3982[_0xd0bc('0x31')]=_0x2b3982[_0xd0bc('0x31')]['length']?_0x2b3982[_0xd0bc('0x31')]:_0xb2f512[_0xd0bc('0x30')];if(!_0x4788bd[_0xd0bc('0x2e')]['hasOwnProperty'](_0xd0bc('0x34'))){_0x2b3982[_0xd0bc('0x1c')]=qs[_0xd0bc('0x1c')](_0x4788bd[_0xd0bc('0x2e')]['limit']);_0x2b3982[_0xd0bc('0x1b')]=qs[_0xd0bc('0x1b')](_0x4788bd[_0xd0bc('0x2e')][_0xd0bc('0x1b')]);}_0x2b3982['order']=qs['sort'](_0x4788bd[_0xd0bc('0x2e')][_0xd0bc('0x35')]);_0x2b3982[_0xd0bc('0x36')]=qs['filters'](_[_0xd0bc('0x37')](_0x4788bd[_0xd0bc('0x2e')],_0xb2f512[_0xd0bc('0x38')]),_0x5068ed);if(_0x4788bd['query']['filter']){_0x2b3982[_0xd0bc('0x36')]=_[_0xd0bc('0x39')](_0x2b3982[_0xd0bc('0x36')],{'$or':_[_0xd0bc('0x29')](_0x5068ed,function(_0x421e8d){if(_0x421e8d[_0xd0bc('0x2c')]!==_0xd0bc('0x3a')){var _0x3caacd={};_0x3caacd[_0x421e8d[_0xd0bc('0x26')]]={'$like':'%'+_0x4788bd['query'][_0xd0bc('0x3b')]+'%'};return _0x3caacd;}})});}_0x2b3982=_[_0xd0bc('0x39')]({},_0x2b3982,_0x4788bd[_0xd0bc('0x3c')]);var _0x3527c7={'where':_0x2b3982[_0xd0bc('0x36')]};return db[_0xd0bc('0x2a')][_0xd0bc('0x3d')](_0x3527c7)[_0xd0bc('0x21')](function(_0xdf22f7){_0x526c54[_0xd0bc('0x3d')]=_0xdf22f7;if(_0x4788bd[_0xd0bc('0x2e')][_0xd0bc('0x3e')]){_0x2b3982['include']=[{'all':!![]}];}return db[_0xd0bc('0x2a')][_0xd0bc('0x3f')](_0x2b3982);})[_0xd0bc('0x21')](function(_0x4a91c3){_0x526c54[_0xd0bc('0x40')]=_0x4a91c3;return _0x526c54;})[_0xd0bc('0x21')](respondWithFilteredResult(_0xa1f50b,_0x2b3982))[_0xd0bc('0x41')](handleError(_0xa1f50b,null));};exports[_0xd0bc('0x42')]=function(_0x449907,_0x16ea46){var _0x164d23={'raw':!![],'where':{'id':_0x449907['params']['id']}},_0xff2ce5={};_0xff2ce5[_0xd0bc('0x30')]=_[_0xd0bc('0x2f')](db['CmContactHasPhone']['rawAttributes']);_0xff2ce5[_0xd0bc('0x2e')]=_[_0xd0bc('0x2f')](_0x449907[_0xd0bc('0x2e')]);_0xff2ce5[_0xd0bc('0x38')]=_[_0xd0bc('0x32')](_0xff2ce5['model'],_0xff2ce5[_0xd0bc('0x2e')]);_0x164d23['attributes']=_[_0xd0bc('0x32')](_0xff2ce5[_0xd0bc('0x30')],qs['fields'](_0x449907[_0xd0bc('0x2e')]['fields']));_0x164d23[_0xd0bc('0x31')]=_0x164d23['attributes']['length']?_0x164d23[_0xd0bc('0x31')]:_0xff2ce5[_0xd0bc('0x30')];if(_0x449907['query'][_0xd0bc('0x3e')]){_0x164d23[_0xd0bc('0x43')]=[{'all':!![]}];}_0x164d23=_[_0xd0bc('0x39')]({},_0x164d23,_0x449907[_0xd0bc('0x3c')]);return db[_0xd0bc('0x2a')][_0xd0bc('0x44')](_0x164d23)[_0xd0bc('0x21')](handleEntityNotFound(_0x16ea46,null))[_0xd0bc('0x21')](respondWithResult(_0x16ea46,null))['catch'](handleError(_0x16ea46,null));};exports[_0xd0bc('0x45')]=function(_0x2e80fb,_0x210cb5){return db['CmContactHasPhone'][_0xd0bc('0x45')](_0x2e80fb[_0xd0bc('0x46')],{})[_0xd0bc('0x21')](function(_0x2c7d23){var _0x10da13=_0x2e80fb['user'][_0xd0bc('0x23')]({'plain':!![]});if(!_0x10da13)throw new Error(_0xd0bc('0x47'));if(_0x10da13[_0xd0bc('0x48')]===_0xd0bc('0x49')){var _0x67509d=_0x2c7d23[_0xd0bc('0x23')]({'plain':!![]});var _0x1d883e=_0xd0bc('0x24');return db[_0xd0bc('0x4a')][_0xd0bc('0x44')]({'where':{'name':_0x1d883e,'userProfileId':_0x10da13[_0xd0bc('0x4b')]},'raw':!![]})['then'](function(_0x29ff2c){if(_0x29ff2c&&_0x29ff2c[_0xd0bc('0x4c')]===0x0){return db[_0xd0bc('0x25')][_0xd0bc('0x45')]({'name':_0x67509d[_0xd0bc('0x26')],'resourceId':_0x67509d['id'],'type':_0x29ff2c[_0xd0bc('0x26')],'sectionId':_0x29ff2c['id']},{})[_0xd0bc('0x21')](function(){return _0x2c7d23;});}else{return _0x2c7d23;}})['catch'](function(_0x2158be){logger[_0xd0bc('0x4d')](_0xd0bc('0x4e'),_0x2158be);throw _0x2158be;});}return _0x2c7d23;})[_0xd0bc('0x21')](respondWithResult(_0x210cb5,0xc9))[_0xd0bc('0x41')](handleError(_0x210cb5,null));};exports[_0xd0bc('0x20')]=function(_0x166ffc,_0x29a69b){if(_0x166ffc[_0xd0bc('0x46')]['id']){delete _0x166ffc[_0xd0bc('0x46')]['id'];}return db[_0xd0bc('0x2a')]['find']({'where':{'id':_0x166ffc[_0xd0bc('0x4f')]['id']}})['then'](handleEntityNotFound(_0x29a69b,null))['then'](saveUpdates(_0x166ffc[_0xd0bc('0x46')],null))['then'](respondWithResult(_0x29a69b,null))[_0xd0bc('0x41')](handleError(_0x29a69b,null));};exports['destroy']=function(_0x45cb01,_0x7006b1){return db['CmContactHasPhone'][_0xd0bc('0x44')]({'where':{'id':_0x45cb01['params']['id']}})[_0xd0bc('0x21')](handleEntityNotFound(_0x7006b1,null))[_0xd0bc('0x21')](removeEntity(_0x7006b1,null))['catch'](handleError(_0x7006b1,null));}; \ No newline at end of file +var _0xafed=['eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','then','get','CmContactHasPhones','error','name','send','index','map','CmContactHasPhone','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','html-pdf'];(function(_0x1fdd8f,_0x53d86a){var _0x4d72f5=function(_0x2bb829){while(--_0x2bb829){_0x1fdd8f['push'](_0x1fdd8f['shift']());}};_0x4d72f5(++_0x53d86a);}(_0xafed,0x1f1));var _0xdafe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xafed[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xdafe('0x0'));var emlformat=require(_0xdafe('0x1'));var rimraf=require(_0xdafe('0x2'));var zipdir=require(_0xdafe('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdafe('0x4'));var moment=require(_0xdafe('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdafe('0x6'));var util=require('util');var path=require(_0xdafe('0x7'));var sox=require(_0xdafe('0x8'));var csv=require(_0xdafe('0x9'));var ejs=require(_0xdafe('0xa'));var fs=require('fs');var _=require(_0xdafe('0xb'));var squel=require(_0xdafe('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdafe('0xd'));var toCsv=require(_0xdafe('0x9'));var querystring=require('querystring');var Papa=require(_0xdafe('0xe'));var Redis=require(_0xdafe('0xf'));var authService=require(_0xdafe('0x10'));var qs=require(_0xdafe('0x11'));var as=require(_0xdafe('0x12'));var hardwareService=require(_0xdafe('0x13'));var logger=require('../../config/logger')(_0xdafe('0x14'));var utils=require(_0xdafe('0x15'));var config=require(_0xdafe('0x16'));var db=require(_0xdafe('0x17'))['db'];function respondWithStatusCode(_0x4e70e4,_0xb2cb59){_0xb2cb59=_0xb2cb59||0xcc;return function(_0x42dd9c){if(_0x42dd9c){return _0x4e70e4[_0xdafe('0x18')](_0xb2cb59);}return _0x4e70e4[_0xdafe('0x19')](_0xb2cb59)[_0xdafe('0x1a')]();};}function respondWithResult(_0x4d193a,_0x43e225){_0x43e225=_0x43e225||0xc8;return function(_0x13141c){if(_0x13141c){return _0x4d193a[_0xdafe('0x19')](_0x43e225)[_0xdafe('0x1b')](_0x13141c);}};}function respondWithFilteredResult(_0xa52793,_0x2cec7c){return function(_0x52bc37){if(_0x52bc37){var _0x134740=_0x52bc37[_0xdafe('0x1c')],_0x2ea5b7=_0x2cec7c[_0xdafe('0x1d')],_0x8458d5=_0x2cec7c[_0xdafe('0x1d')]+_0x2cec7c[_0xdafe('0x1e')],_0x4322f8;if(_0x8458d5>=_0x134740){_0x8458d5=_0x134740;_0x4322f8=0xc8;}else{_0x4322f8=0xce;}_0xa52793[_0xdafe('0x19')](_0x4322f8);return _0xa52793[_0xdafe('0x1f')](_0xdafe('0x20'),_0x2ea5b7+'-'+_0x8458d5+'/'+_0x134740)[_0xdafe('0x1b')](_0x52bc37);}return null;};}function patchUpdates(_0x507996){return function(_0x2e704a){try{jsonpatch['apply'](_0x2e704a,_0x507996,!![]);}catch(_0x5df961){return BPromise[_0xdafe('0x21')](_0x5df961);}return _0x2e704a[_0xdafe('0x22')]();};}function saveUpdates(_0x2b8b02,_0x41f4ab){return function(_0xbc4b2b){if(_0xbc4b2b){return _0xbc4b2b['update'](_0x2b8b02)['then'](function(_0x34731a){return _0x34731a;});}return null;};}function removeEntity(_0x5f253a,_0x208e9c){return function(_0x223cde){if(_0x223cde){return _0x223cde[_0xdafe('0x23')]()[_0xdafe('0x24')](function(){var _0x2359cb=_0x223cde[_0xdafe('0x25')]({'plain':!![]});var _0xfd5eff=_0xdafe('0x26');return db['UserProfileResource'][_0xdafe('0x23')]({'where':{'type':_0xfd5eff,'resourceId':_0x2359cb['id']}})['then'](function(){return _0x223cde;});})[_0xdafe('0x24')](function(){_0x5f253a[_0xdafe('0x19')](0xcc)[_0xdafe('0x1a')]();});}};}function handleEntityNotFound(_0xa4e6b6,_0x116fff){return function(_0x1fa1f8){if(!_0x1fa1f8){_0xa4e6b6[_0xdafe('0x18')](0x194);}return _0x1fa1f8;};}function handleError(_0x3b9582,_0x1cff9){_0x1cff9=_0x1cff9||0x1f4;return function(_0x3bc40b){logger[_0xdafe('0x27')](_0x3bc40b['stack']);if(_0x3bc40b[_0xdafe('0x28')]){delete _0x3bc40b[_0xdafe('0x28')];}_0x3b9582[_0xdafe('0x19')](_0x1cff9)[_0xdafe('0x29')](_0x3bc40b);};}exports[_0xdafe('0x2a')]=function(_0x52f2fb,_0x29d83a){var _0x4f4b1f={},_0x164522={},_0x435162={'count':0x0,'rows':[]};var _0x58c034=_[_0xdafe('0x2b')](db[_0xdafe('0x2c')][_0xdafe('0x2d')],function(_0x2948f0){return{'name':_0x2948f0['fieldName'],'type':_0x2948f0[_0xdafe('0x2e')][_0xdafe('0x2f')]};});_0x164522[_0xdafe('0x30')]=_[_0xdafe('0x2b')](_0x58c034,_0xdafe('0x28'));_0x164522[_0xdafe('0x31')]=_[_0xdafe('0x32')](_0x52f2fb[_0xdafe('0x31')]);_0x164522['filters']=_[_0xdafe('0x33')](_0x164522[_0xdafe('0x30')],_0x164522[_0xdafe('0x31')]);_0x4f4b1f[_0xdafe('0x34')]=_['intersection'](_0x164522[_0xdafe('0x30')],qs['fields'](_0x52f2fb[_0xdafe('0x31')][_0xdafe('0x35')]));_0x4f4b1f[_0xdafe('0x34')]=_0x4f4b1f['attributes'][_0xdafe('0x36')]?_0x4f4b1f[_0xdafe('0x34')]:_0x164522[_0xdafe('0x30')];if(!_0x52f2fb[_0xdafe('0x31')][_0xdafe('0x37')](_0xdafe('0x38'))){_0x4f4b1f['limit']=qs[_0xdafe('0x1e')](_0x52f2fb[_0xdafe('0x31')][_0xdafe('0x1e')]);_0x4f4b1f[_0xdafe('0x1d')]=qs['offset'](_0x52f2fb[_0xdafe('0x31')][_0xdafe('0x1d')]);}_0x4f4b1f['order']=qs[_0xdafe('0x39')](_0x52f2fb[_0xdafe('0x31')][_0xdafe('0x39')]);_0x4f4b1f[_0xdafe('0x3a')]=qs['filters'](_[_0xdafe('0x3b')](_0x52f2fb['query'],_0x164522[_0xdafe('0x3c')]),_0x58c034);if(_0x52f2fb[_0xdafe('0x31')][_0xdafe('0x3d')]){_0x4f4b1f[_0xdafe('0x3a')]=_['merge'](_0x4f4b1f['where'],{'$or':_['map'](_0x58c034,function(_0x96915e){if(_0x96915e['type']!==_0xdafe('0x3e')){var _0x4ba71b={};_0x4ba71b[_0x96915e[_0xdafe('0x28')]]={'$like':'%'+_0x52f2fb[_0xdafe('0x31')][_0xdafe('0x3d')]+'%'};return _0x4ba71b;}})});}_0x4f4b1f=_[_0xdafe('0x3f')]({},_0x4f4b1f,_0x52f2fb[_0xdafe('0x40')]);var _0x20bce9={'where':_0x4f4b1f['where']};return db[_0xdafe('0x2c')][_0xdafe('0x1c')](_0x20bce9)[_0xdafe('0x24')](function(_0x5843bd){_0x435162[_0xdafe('0x1c')]=_0x5843bd;if(_0x52f2fb[_0xdafe('0x31')][_0xdafe('0x41')]){_0x4f4b1f[_0xdafe('0x42')]=[{'all':!![]}];}return db['CmContactHasPhone'][_0xdafe('0x43')](_0x4f4b1f);})[_0xdafe('0x24')](function(_0x137904){_0x435162[_0xdafe('0x44')]=_0x137904;return _0x435162;})['then'](respondWithFilteredResult(_0x29d83a,_0x4f4b1f))[_0xdafe('0x45')](handleError(_0x29d83a,null));};exports['show']=function(_0x329dd3,_0x399552){var _0x143869={'raw':!![],'where':{'id':_0x329dd3[_0xdafe('0x46')]['id']}},_0x5b3fa0={};_0x5b3fa0[_0xdafe('0x30')]=_[_0xdafe('0x32')](db[_0xdafe('0x2c')]['rawAttributes']);_0x5b3fa0['query']=_[_0xdafe('0x32')](_0x329dd3[_0xdafe('0x31')]);_0x5b3fa0['filters']=_['intersection'](_0x5b3fa0[_0xdafe('0x30')],_0x5b3fa0['query']);_0x143869['attributes']=_['intersection'](_0x5b3fa0[_0xdafe('0x30')],qs[_0xdafe('0x35')](_0x329dd3[_0xdafe('0x31')][_0xdafe('0x35')]));_0x143869[_0xdafe('0x34')]=_0x143869['attributes']['length']?_0x143869[_0xdafe('0x34')]:_0x5b3fa0[_0xdafe('0x30')];if(_0x329dd3[_0xdafe('0x31')][_0xdafe('0x41')]){_0x143869[_0xdafe('0x42')]=[{'all':!![]}];}_0x143869=_['merge']({},_0x143869,_0x329dd3[_0xdafe('0x40')]);return db[_0xdafe('0x2c')]['find'](_0x143869)[_0xdafe('0x24')](handleEntityNotFound(_0x399552,null))[_0xdafe('0x24')](respondWithResult(_0x399552,null))[_0xdafe('0x45')](handleError(_0x399552,null));};exports[_0xdafe('0x47')]=function(_0x3cc8b5,_0x15cc79){return db['CmContactHasPhone'][_0xdafe('0x47')](_0x3cc8b5['body'],{})[_0xdafe('0x24')](function(_0x1a8732){var _0x254d60=_0x3cc8b5['user']['get']({'plain':!![]});if(!_0x254d60)throw new Error(_0xdafe('0x48'));if(_0x254d60[_0xdafe('0x49')]===_0xdafe('0x4a')){var _0x5168ee=_0x1a8732[_0xdafe('0x25')]({'plain':!![]});var _0x404784=_0xdafe('0x26');return db[_0xdafe('0x4b')]['find']({'where':{'name':_0x404784,'userProfileId':_0x254d60[_0xdafe('0x4c')]},'raw':!![]})['then'](function(_0x329e6a){if(_0x329e6a&&_0x329e6a[_0xdafe('0x4d')]===0x0){return db[_0xdafe('0x4e')][_0xdafe('0x47')]({'name':_0x5168ee[_0xdafe('0x28')],'resourceId':_0x5168ee['id'],'type':_0x329e6a[_0xdafe('0x28')],'sectionId':_0x329e6a['id']},{})[_0xdafe('0x24')](function(){return _0x1a8732;});}else{return _0x1a8732;}})[_0xdafe('0x45')](function(_0xffe849){logger[_0xdafe('0x27')](_0xdafe('0x4f'),_0xffe849);throw _0xffe849;});}return _0x1a8732;})['then'](respondWithResult(_0x15cc79,0xc9))[_0xdafe('0x45')](handleError(_0x15cc79,null));};exports[_0xdafe('0x50')]=function(_0x42fa8d,_0x12023a){if(_0x42fa8d[_0xdafe('0x51')]['id']){delete _0x42fa8d[_0xdafe('0x51')]['id'];}return db[_0xdafe('0x2c')][_0xdafe('0x52')]({'where':{'id':_0x42fa8d[_0xdafe('0x46')]['id']}})[_0xdafe('0x24')](handleEntityNotFound(_0x12023a,null))[_0xdafe('0x24')](saveUpdates(_0x42fa8d['body'],null))[_0xdafe('0x24')](respondWithResult(_0x12023a,null))[_0xdafe('0x45')](handleError(_0x12023a,null));};exports['destroy']=function(_0x443968,_0x40b2fd){return db[_0xdafe('0x2c')][_0xdafe('0x52')]({'where':{'id':_0x443968['params']['id']}})['then'](handleEntityNotFound(_0x40b2fd,null))[_0xdafe('0x24')](removeEntity(_0x40b2fd,null))[_0xdafe('0x45')](handleError(_0x40b2fd,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index b7f80ab..792e94a 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 _0x32c0=['../../config/environment','exports','define','cm_contact_has_phones','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x554569,_0x36fb90){var _0x1a8695=function(_0x90f507){while(--_0x90f507){_0x554569['push'](_0x554569['shift']());}};_0x1a8695(++_0x36fb90);}(_0x32c0,0x1f3));var _0x032c=function(_0x361122,_0xdc9d04){_0x361122=_0x361122-0x0;var _0x2a8ab6=_0x32c0[_0x361122];return _0x2a8ab6;};'use strict';var _=require(_0x032c('0x0'));var util=require(_0x032c('0x1'));var logger=require('../../config/logger')(_0x032c('0x2'));var moment=require(_0x032c('0x3'));var BPromise=require('bluebird');var rp=require(_0x032c('0x4'));var fs=require('fs');var path=require(_0x032c('0x5'));var rimraf=require(_0x032c('0x6'));var config=require(_0x032c('0x7'));var attributes=require('./cmContactHasPhone.attributes');module[_0x032c('0x8')]=function(_0x282c50,_0x2d5376){return _0x282c50[_0x032c('0x9')]('CmContactHasPhone',attributes,{'tableName':_0x032c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8137=['bluebird','request-promise','exports','define','CmContactHasPhone','cm_contact_has_phones','lodash'];(function(_0x3855c5,_0x34cfc2){var _0x24c32c=function(_0x19579b){while(--_0x19579b){_0x3855c5['push'](_0x3855c5['shift']());}};_0x24c32c(++_0x34cfc2);}(_0x8137,0x16b));var _0x7813=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x8137[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0x7813('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7813('0x1'));var rp=require(_0x7813('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmContactHasPhone.attributes');module[_0x7813('0x3')]=function(_0x1c0bfa,_0x2ec7d6){return _0x1c0bfa[_0x7813('0x4')](_0x7813('0x5'),attributes,{'tableName':_0x7813('0x6'),'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 b301c32..ecfd9e8 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 _0x745c=['message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','CmContactHasPhone,\x20%s,\x20%s','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x67d2b,_0xc3be07){var _0x23e7c1=function(_0x290c5e){while(--_0x290c5e){_0x67d2b['push'](_0x67d2b['shift']());}};_0x23e7c1(++_0xc3be07);}(_0x745c,0x1e4));var _0xc745=function(_0xcc21fb,_0x16b6c0){_0xcc21fb=_0xcc21fb-0x0;var _0x1fb780=_0x745c[_0xcc21fb];return _0x1fb780;};'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')]('CmContactHasPhone,\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')]('CmContactHasPhone,\x20%s,\x20%s',_0x2a5fbe,_0x4f3f2b);_0x4a6889(_0x4f3f2b);});});} \ No newline at end of file +var _0x4472=['request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmContactHasPhone,\x20%s,\x20%s'];(function(_0x572345,_0x5b21ba){var _0x47d228=function(_0x4f3be5){while(--_0x4f3be5){_0x572345['push'](_0x572345['shift']());}};_0x47d228(++_0x5b21ba);}(_0x4472,0x92));var _0x2447=function(_0x435f5f,_0x44bf62){_0x435f5f=_0x435f5f-0x0;var _0x3fd11c=_0x4472[_0x435f5f];return _0x3fd11c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2447('0x0'));var BPromise=require(_0x2447('0x1'));var rs=require(_0x2447('0x2'));var fs=require('fs');var Redis=require(_0x2447('0x3'));var db=require(_0x2447('0x4'))['db'];var utils=require(_0x2447('0x5'));var logger=require(_0x2447('0x6'))(_0x2447('0x7'));var config=require(_0x2447('0x8'));var jayson=require(_0x2447('0x9'));var client=jayson[_0x2447('0xa')][_0x2447('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x138b6e,_0x106d07,_0x18d62f){return new BPromise(function(_0x1d9c65,_0x580acc){return client['request'](_0x138b6e,_0x18d62f)[_0x2447('0xc')](function(_0xb955ed){logger[_0x2447('0xd')](_0x2447('0xe'),_0x106d07,_0x2447('0xf'));logger[_0x2447('0x10')](_0x2447('0x11'),_0x106d07,_0x2447('0xf'),JSON[_0x2447('0x12')](_0xb955ed));if(_0xb955ed[_0x2447('0x13')]){if(_0xb955ed[_0x2447('0x13')][_0x2447('0x14')]===0x1f4){logger[_0x2447('0x13')](_0x2447('0xe'),_0x106d07,_0xb955ed[_0x2447('0x13')][_0x2447('0x15')]);return _0x580acc(_0xb955ed[_0x2447('0x13')][_0x2447('0x15')]);}logger[_0x2447('0x13')](_0x2447('0xe'),_0x106d07,_0xb955ed[_0x2447('0x13')][_0x2447('0x15')]);return _0x1d9c65(_0xb955ed['error']['message']);}else{logger[_0x2447('0xd')](_0x2447('0xe'),_0x106d07,'request\x20sent');_0x1d9c65(_0xb955ed['result'][_0x2447('0x15')]);}})[_0x2447('0x16')](function(_0x13caee){logger[_0x2447('0x13')](_0x2447('0xe'),_0x106d07,_0x13caee);_0x580acc(_0x13caee);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 920181a..c2a6b5f 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 _0xaf75=['./cmContactHasPhone.controller','get','index','isAuthenticated','post','put','/:id','update','destroy','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x13d699,_0x3df0c6){var _0x2889a6=function(_0xf033ae){while(--_0xf033ae){_0x13d699['push'](_0x13d699['shift']());}};_0x2889a6(++_0x3df0c6);}(_0xaf75,0x159));var _0x5af7=function(_0x5c1e9e,_0x499cf4){_0x5c1e9e=_0x5c1e9e-0x0;var _0x2fbed6=_0xaf75[_0x5c1e9e];return _0x2fbed6;};'use strict';var multer=require(_0x5af7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5af7('0x1'));var express=require('express');var router=express[_0x5af7('0x2')]();var auth=require(_0x5af7('0x3'));var interaction=require(_0x5af7('0x4'));var config=require('../../config/environment');var controller=require(_0x5af7('0x5'));router[_0x5af7('0x6')]('/',auth['isAuthenticated'](),controller[_0x5af7('0x7')]);router[_0x5af7('0x6')]('/:id',auth[_0x5af7('0x8')](),controller['show']);router[_0x5af7('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5af7('0xa')](_0x5af7('0xb'),auth[_0x5af7('0x8')](),controller[_0x5af7('0xc')]);router['delete'](_0x5af7('0xb'),auth[_0x5af7('0x8')](),controller[_0x5af7('0xd')]);module['exports']=router; \ No newline at end of file +var _0x5c88=['index','/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0xb0c11d,_0x3cefe9){var _0x7f6999=function(_0x517d7e){while(--_0x517d7e){_0xb0c11d['push'](_0xb0c11d['shift']());}};_0x7f6999(++_0x3cefe9);}(_0x5c88,0x129));var _0x85c8=function(_0x45c86a,_0x5024f0){_0x45c86a=_0x45c86a-0x0;var _0x1d7a25=_0x5c88[_0x45c86a];return _0x1d7a25;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85c8('0x0'));var timeout=require(_0x85c8('0x1'));var express=require(_0x85c8('0x2'));var router=express[_0x85c8('0x3')]();var auth=require(_0x85c8('0x4'));var interaction=require(_0x85c8('0x5'));var config=require('../../config/environment');var controller=require('./cmContactHasPhone.controller');router['get']('/',auth[_0x85c8('0x6')](),controller[_0x85c8('0x7')]);router['get'](_0x85c8('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x85c8('0x9')]('/',auth[_0x85c8('0x6')](),controller[_0x85c8('0xa')]);router[_0x85c8('0xb')](_0x85c8('0x8'),auth[_0x85c8('0x6')](),controller[_0x85c8('0xc')]);router[_0x85c8('0xd')](_0x85c8('0x8'),auth[_0x85c8('0x6')](),controller[_0x85c8('0xe')]);module[_0x85c8('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 3756430..94ccae5 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 _0x3edc=['exports','VIRTUAL','alias','setDataValue','getDataValue','name','TEXT','long','type','select','parse','values','stringify','BOOLEAN','ENUM','voice','sequelize','lodash'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x3edc,0x1ae));var _0xc3ed=function(_0x32b066,_0x8c6b13){_0x32b066=_0x32b066-0x0;var _0x34c871=_0x3edc[_0x32b066];return _0x34c871;};'use strict';var Sequelize=require(_0xc3ed('0x0'));var _=require(_0xc3ed('0x1'));module[_0xc3ed('0x2')]={'name':{'type':Sequelize[_0xc3ed('0x3')],'get':function(_0xae2b4f){return this['getDataValue'](_0xc3ed('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3519ab){this[_0xc3ed('0x5')](_0xc3ed('0x4'),_0x3519ab?_0x3519ab:this[_0xc3ed('0x6')](_0xc3ed('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xc3ed('0x8')](_0xc3ed('0x9')),'get':function(){if(this[_0xc3ed('0x6')](_0xc3ed('0xa'))===_0xc3ed('0xb')){return JSON[_0xc3ed('0xc')](this['getDataValue'](_0xc3ed('0xd')));}else{return this[_0xc3ed('0x6')](_0xc3ed('0xd'));}},'set':function(_0x51c2c4){if(Array['isArray'](_0x51c2c4)){this['setDataValue'](_0xc3ed('0xd'),JSON[_0xc3ed('0xe')](_0x51c2c4));}else{this[_0xc3ed('0x5')](_0xc3ed('0xd'),_0x51c2c4);}}},'required':{'type':Sequelize[_0xc3ed('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xc3ed('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xc3ed('0x10')](_0xc3ed('0x11'))}}; \ No newline at end of file +var _0xacfe=['alias','STRING','setDataValue','name','TEXT','type','select','parse','values','isArray','stringify','BOOLEAN','voice','exports','VIRTUAL','getDataValue'];(function(_0x49dc1b,_0x3ae247){var _0x44a356=function(_0x3d259e){while(--_0x3d259e){_0x49dc1b['push'](_0x49dc1b['shift']());}};_0x44a356(++_0x3ae247);}(_0xacfe,0xfd));var _0xeacf=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xacfe[_0x273c39];return _0x46d6b5;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xeacf('0x0')]={'name':{'type':Sequelize[_0xeacf('0x1')],'get':function(_0x1be610){return this[_0xeacf('0x2')](_0xeacf('0x3'));}},'alias':{'type':Sequelize[_0xeacf('0x4')],'allowNull':![],'set':function(_0x2fbe17){this[_0xeacf('0x5')](_0xeacf('0x3'),_0x2fbe17?_0x2fbe17:this[_0xeacf('0x2')](_0xeacf('0x6')));}},'type':{'type':Sequelize[_0xeacf('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xeacf('0x7')]('long'),'get':function(){if(this[_0xeacf('0x2')](_0xeacf('0x8'))===_0xeacf('0x9')){return JSON[_0xeacf('0xa')](this['getDataValue'](_0xeacf('0xb')));}else{return this['getDataValue'](_0xeacf('0xb'));}},'set':function(_0x20e7d7){if(Array[_0xeacf('0xc')](_0x20e7d7)){this[_0xeacf('0x5')](_0xeacf('0xb'),JSON[_0xeacf('0xd')](_0x20e7d7));}else{this[_0xeacf('0x5')](_0xeacf('0xb'),_0x20e7d7);}}},'required':{'type':Sequelize[_0xeacf('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xeacf('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xeacf('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 6e24165..f7d691e 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 _0x2401=['sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','CmCustomField','rawAttributes','fieldName','type','key','differenceBy','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','filtears','find','body','params','create','TEXT','text','Sequelize','INTEGER','switch','BOOLEAN','sequelize','queryInterface','addColumn','cm_contacts','cf_%d','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x2715f0,_0x35ae1d){var _0x21f73f=function(_0x23a6c2){while(--_0x23a6c2){_0x2715f0['push'](_0x2715f0['shift']());}};_0x21f73f(++_0x35ae1d);}(_0x2401,0x1af));var _0x1240=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2401[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x1240('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1240('0x1'));var zipdir=require(_0x1240('0x2'));var jsonpatch=require(_0x1240('0x3'));var rp=require(_0x1240('0x4'));var moment=require(_0x1240('0x5'));var BPromise=require(_0x1240('0x6'));var Mustache=require(_0x1240('0x7'));var util=require('util');var path=require(_0x1240('0x8'));var sox=require(_0x1240('0x9'));var csv=require(_0x1240('0xa'));var ejs=require(_0x1240('0xb'));var fs=require('fs');var _=require(_0x1240('0xc'));var squel=require(_0x1240('0xd'));var crypto=require(_0x1240('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1240('0xf'));var Redis=require(_0x1240('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1240('0x11'));var as=require(_0x1240('0x12'));var hardwareService=require(_0x1240('0x13'));var logger=require(_0x1240('0x14'))(_0x1240('0x15'));var utils=require(_0x1240('0x16'));var config=require(_0x1240('0x17'));var licenseUtil=require(_0x1240('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x151158,_0x4487ed){_0x4487ed=_0x4487ed||0xcc;return function(_0x5029d2){if(_0x5029d2){return _0x151158[_0x1240('0x19')](_0x4487ed);}return _0x151158[_0x1240('0x1a')](_0x4487ed)[_0x1240('0x1b')]();};}function respondWithResult(_0x15f6d4,_0x16ce37){_0x16ce37=_0x16ce37||0xc8;return function(_0x537803){if(_0x537803){return _0x15f6d4[_0x1240('0x1a')](_0x16ce37)[_0x1240('0x1c')](_0x537803);}};}function respondWithFilteredResult(_0x5e4b73,_0x30c0c8){return function(_0x54c4e4){if(_0x54c4e4){var _0xc0e635=_0x54c4e4['count'],_0x2f72d3=_0x30c0c8[_0x1240('0x1d')],_0x6b647e=_0x30c0c8[_0x1240('0x1d')]+_0x30c0c8[_0x1240('0x1e')],_0x353ef8;if(_0x6b647e>=_0xc0e635){_0x6b647e=_0xc0e635;_0x353ef8=0xc8;}else{_0x353ef8=0xce;}_0x5e4b73['status'](_0x353ef8);return _0x5e4b73[_0x1240('0x1f')](_0x1240('0x20'),_0x2f72d3+'-'+_0x6b647e+'/'+_0xc0e635)[_0x1240('0x1c')](_0x54c4e4);}return null;};}function patchUpdates(_0x5249fa){return function(_0x33c45a){try{jsonpatch[_0x1240('0x21')](_0x33c45a,_0x5249fa,!![]);}catch(_0x15507d){return BPromise[_0x1240('0x22')](_0x15507d);}return _0x33c45a[_0x1240('0x23')]();};}function saveUpdates(_0x3db1c9,_0x25cdb6){return function(_0x5882e5){if(_0x5882e5){return _0x5882e5[_0x1240('0x24')](_0x3db1c9)['then'](function(_0x5e1ea7){return _0x5e1ea7;});}return null;};}function removeEntity(_0xacc074,_0x35f69f){return function(_0x20fd69){if(_0x20fd69){return _0x20fd69[_0x1240('0x25')]()[_0x1240('0x26')](function(){_0xacc074[_0x1240('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3387b7,_0xc0ca4d){return function(_0x1739ad){if(!_0x1739ad){_0x3387b7[_0x1240('0x19')](0x194);}return _0x1739ad;};}function handleError(_0x535dce,_0x3d84d9){_0x3d84d9=_0x3d84d9||0x1f4;return function(_0x4f6eac){logger[_0x1240('0x27')](_0x4f6eac[_0x1240('0x28')]);if(_0x4f6eac[_0x1240('0x29')]){delete _0x4f6eac[_0x1240('0x29')];}_0x535dce['status'](_0x3d84d9)['send'](_0x4f6eac);};}exports[_0x1240('0x2a')]=function(_0x59fdc5,_0x35012c){var _0x11b901={},_0x29d161={},_0xbff2cd={'count':0x0,'rows':[]};var _0x49f38f=_[_0x1240('0x2b')](db[_0x1240('0x2c')][_0x1240('0x2d')],function(_0x14bf3a){return{'name':_0x14bf3a[_0x1240('0x2e')],'type':_0x14bf3a[_0x1240('0x2f')][_0x1240('0x30')]};});_0x29d161['model']=_[_0x1240('0x31')](_['map'](_0x49f38f,'name'),['name']);_0x29d161[_0x1240('0x32')]=_['keys'](_0x59fdc5[_0x1240('0x32')]);_0x29d161[_0x1240('0x33')]=_[_0x1240('0x34')](_0x29d161[_0x1240('0x35')],_0x29d161[_0x1240('0x32')]);_0x11b901[_0x1240('0x36')]=_['intersection'](_0x29d161[_0x1240('0x35')],qs['fields'](_0x59fdc5[_0x1240('0x32')][_0x1240('0x37')]));_0x11b901[_0x1240('0x36')]=_0x11b901[_0x1240('0x36')][_0x1240('0x38')]?_0x11b901[_0x1240('0x36')]:_0x29d161[_0x1240('0x35')];if(!_0x59fdc5[_0x1240('0x32')][_0x1240('0x39')]('nolimit')){_0x11b901[_0x1240('0x1e')]=qs['limit'](_0x59fdc5[_0x1240('0x32')][_0x1240('0x1e')]);_0x11b901[_0x1240('0x1d')]=qs[_0x1240('0x1d')](_0x59fdc5[_0x1240('0x32')]['offset']);}_0x11b901[_0x1240('0x3a')]=qs[_0x1240('0x3b')](_0x59fdc5['query'][_0x1240('0x3b')]);_0x11b901[_0x1240('0x3c')]=qs[_0x1240('0x33')](_['pick'](_0x59fdc5[_0x1240('0x32')],_0x29d161[_0x1240('0x33')]),_0x49f38f);if(_0x59fdc5[_0x1240('0x32')][_0x1240('0x3d')]){_0x11b901[_0x1240('0x3c')]=_[_0x1240('0x3e')](_0x11b901[_0x1240('0x3c')],{'$or':_[_0x1240('0x2b')](_0x49f38f,function(_0x401f75){if(_0x401f75['type']!==_0x1240('0x3f')){var _0x49f2aa={};_0x49f2aa[_0x401f75[_0x1240('0x29')]]={'$like':'%'+_0x59fdc5[_0x1240('0x32')][_0x1240('0x3d')]+'%'};return _0x49f2aa;}})});}_0x11b901=_[_0x1240('0x3e')]({},_0x11b901,_0x59fdc5[_0x1240('0x40')]);var _0x217f02={'where':_0x11b901[_0x1240('0x3c')]};return db[_0x1240('0x2c')]['count'](_0x217f02)[_0x1240('0x26')](function(_0x190e5e){_0xbff2cd['count']=_0x190e5e;if(_0x59fdc5[_0x1240('0x32')][_0x1240('0x41')]){_0x11b901[_0x1240('0x42')]=[{'all':!![]}];}return db[_0x1240('0x2c')][_0x1240('0x43')](_0x11b901);})[_0x1240('0x26')](function(_0x29f37d){_0xbff2cd[_0x1240('0x44')]=_0x29f37d;return _0xbff2cd;})[_0x1240('0x26')](respondWithFilteredResult(_0x35012c,_0x11b901))[_0x1240('0x45')](handleError(_0x35012c,null));};exports[_0x1240('0x46')]=function(_0x53f02b,_0x2f5377){var _0x173256={'raw':!![],'where':{'id':_0x53f02b['params']['id']}},_0x2ad29c={};_0x2ad29c[_0x1240('0x35')]=_[_0x1240('0x47')](db[_0x1240('0x2c')][_0x1240('0x2d')]);_0x2ad29c[_0x1240('0x32')]=_[_0x1240('0x47')](_0x53f02b['query']);_0x2ad29c[_0x1240('0x48')]=_[_0x1240('0x34')](_0x2ad29c[_0x1240('0x35')],_0x2ad29c[_0x1240('0x32')]);_0x173256['attributes']=_[_0x1240('0x34')](_0x2ad29c[_0x1240('0x35')],qs['fields'](_0x53f02b['query']['fields']));_0x173256[_0x1240('0x36')]=_0x173256[_0x1240('0x36')][_0x1240('0x38')]?_0x173256[_0x1240('0x36')]:_0x2ad29c[_0x1240('0x35')];if(_0x53f02b[_0x1240('0x32')][_0x1240('0x41')]){_0x173256[_0x1240('0x42')]=[{'all':!![]}];}_0x173256=_[_0x1240('0x3e')]({},_0x173256,_0x53f02b[_0x1240('0x40')]);return db[_0x1240('0x2c')][_0x1240('0x49')](_0x173256)[_0x1240('0x26')](handleEntityNotFound(_0x2f5377,null))[_0x1240('0x26')](respondWithResult(_0x2f5377,null))[_0x1240('0x45')](handleError(_0x2f5377,null));};exports[_0x1240('0x24')]=function(_0x2239f9,_0x359a26){if(_0x2239f9[_0x1240('0x4a')]['id']){delete _0x2239f9[_0x1240('0x4a')]['id'];}return db[_0x1240('0x2c')][_0x1240('0x49')]({'where':{'id':_0x2239f9[_0x1240('0x4b')]['id']}})[_0x1240('0x26')](handleEntityNotFound(_0x359a26,null))['then'](saveUpdates(_0x2239f9[_0x1240('0x4a')],null))['then'](respondWithResult(_0x359a26,null))[_0x1240('0x45')](handleError(_0x359a26,null));};exports[_0x1240('0x25')]=function(_0x189655,_0x5bd9e1){return db[_0x1240('0x2c')]['find']({'where':{'id':_0x189655[_0x1240('0x4b')]['id']}})[_0x1240('0x26')](handleEntityNotFound(_0x5bd9e1,null))[_0x1240('0x26')](removeEntity(_0x5bd9e1,null))['catch'](handleError(_0x5bd9e1,null));};exports[_0x1240('0x4c')]=function(_0x23cb21,_0x5c0af1){var _0x134d93;return db['sequelize']['transaction'](function(_0x17b106){return db[_0x1240('0x2c')][_0x1240('0x4c')](_0x23cb21[_0x1240('0x4a')],{'transaction':_0x17b106})[_0x1240('0x26')](function(_0x3b0bbc){_0x134d93=_0x3b0bbc;var _0xa07ef3={'type':db['Sequelize'][_0x1240('0x4d')],'transaction':_0x17b106};switch(_0x23cb21[_0x1240('0x4a')][_0x1240('0x2f')]){case _0x1240('0x4e'):_0xa07ef3['type']=db['Sequelize'][_0x1240('0x4d')];break;case'number':_0xa07ef3[_0x1240('0x2f')]=db[_0x1240('0x4f')][_0x1240('0x50')];break;case _0x1240('0x51'):_0xa07ef3[_0x1240('0x2f')]=db[_0x1240('0x4f')][_0x1240('0x52')];_0xa07ef3['defaultValue']=![];break;default:}return db[_0x1240('0x53')][_0x1240('0x54')][_0x1240('0x55')](_0x1240('0x56'),util['format'](_0x1240('0x57'),_0x134d93['id']),_0xa07ef3);})[_0x1240('0x26')](function(){return _0x134d93;});})[_0x1240('0x26')](respondWithResult(_0x5c0af1,0xc9))['catch'](handleError(_0x5c0af1,null));}; \ No newline at end of file +var _0x6a96=['options','include','rows','catch','show','params','intersection','length','includeAll','update','body','find','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%d','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','differenceBy','keys','query','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a96,0x77));var _0x66a9=function(_0x16938f,_0x35e57f){_0x16938f=_0x16938f-0x0;var _0x5c66e9=_0x6a96[_0x16938f];return _0x5c66e9;};'use strict';var pdf=require(_0x66a9('0x0'));var emlformat=require(_0x66a9('0x1'));var rimraf=require(_0x66a9('0x2'));var zipdir=require(_0x66a9('0x3'));var jsonpatch=require(_0x66a9('0x4'));var rp=require(_0x66a9('0x5'));var moment=require(_0x66a9('0x6'));var BPromise=require(_0x66a9('0x7'));var Mustache=require(_0x66a9('0x8'));var util=require(_0x66a9('0x9'));var path=require('path');var sox=require(_0x66a9('0xa'));var csv=require('to-csv');var ejs=require(_0x66a9('0xb'));var fs=require('fs');var _=require(_0x66a9('0xc'));var squel=require('squel');var crypto=require(_0x66a9('0xd'));var jsforce=require(_0x66a9('0xe'));var deskjs=require(_0x66a9('0xf'));var toCsv=require(_0x66a9('0x10'));var querystring=require('querystring');var Papa=require(_0x66a9('0x11'));var Redis=require(_0x66a9('0x12'));var authService=require(_0x66a9('0x13'));var qs=require(_0x66a9('0x14'));var as=require(_0x66a9('0x15'));var hardwareService=require(_0x66a9('0x16'));var logger=require('../../config/logger')(_0x66a9('0x17'));var utils=require(_0x66a9('0x18'));var config=require(_0x66a9('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x66a9('0x1a'))['db'];function respondWithStatusCode(_0xbbb45a,_0x44fbd9){_0x44fbd9=_0x44fbd9||0xcc;return function(_0x4a59b){if(_0x4a59b){return _0xbbb45a[_0x66a9('0x1b')](_0x44fbd9);}return _0xbbb45a['status'](_0x44fbd9)[_0x66a9('0x1c')]();};}function respondWithResult(_0x248887,_0x3fbafc){_0x3fbafc=_0x3fbafc||0xc8;return function(_0x3613d7){if(_0x3613d7){return _0x248887[_0x66a9('0x1d')](_0x3fbafc)[_0x66a9('0x1e')](_0x3613d7);}};}function respondWithFilteredResult(_0x378f71,_0xa8c2d3){return function(_0x5e71de){if(_0x5e71de){var _0x1245f6=_0x5e71de[_0x66a9('0x1f')],_0xe45a2b=_0xa8c2d3[_0x66a9('0x20')],_0x4d59be=_0xa8c2d3[_0x66a9('0x20')]+_0xa8c2d3[_0x66a9('0x21')],_0x2034e6;if(_0x4d59be>=_0x1245f6){_0x4d59be=_0x1245f6;_0x2034e6=0xc8;}else{_0x2034e6=0xce;}_0x378f71[_0x66a9('0x1d')](_0x2034e6);return _0x378f71[_0x66a9('0x22')](_0x66a9('0x23'),_0xe45a2b+'-'+_0x4d59be+'/'+_0x1245f6)[_0x66a9('0x1e')](_0x5e71de);}return null;};}function patchUpdates(_0x3e2344){return function(_0x450ee7){try{jsonpatch[_0x66a9('0x24')](_0x450ee7,_0x3e2344,!![]);}catch(_0x59f1b4){return BPromise[_0x66a9('0x25')](_0x59f1b4);}return _0x450ee7[_0x66a9('0x26')]();};}function saveUpdates(_0x1ed300,_0x66be74){return function(_0x214967){if(_0x214967){return _0x214967['update'](_0x1ed300)[_0x66a9('0x27')](function(_0x3b0235){return _0x3b0235;});}return null;};}function removeEntity(_0x3d78ac,_0x2a89c3){return function(_0x243f55){if(_0x243f55){return _0x243f55['destroy']()[_0x66a9('0x27')](function(){_0x3d78ac[_0x66a9('0x1d')](0xcc)[_0x66a9('0x1c')]();});}};}function handleEntityNotFound(_0x33ffb1,_0x39a5cb){return function(_0x34ec3e){if(!_0x34ec3e){_0x33ffb1[_0x66a9('0x1b')](0x194);}return _0x34ec3e;};}function handleError(_0x5e11d4,_0x207f66){_0x207f66=_0x207f66||0x1f4;return function(_0x1fd929){logger[_0x66a9('0x28')](_0x1fd929[_0x66a9('0x29')]);if(_0x1fd929[_0x66a9('0x2a')]){delete _0x1fd929[_0x66a9('0x2a')];}_0x5e11d4['status'](_0x207f66)[_0x66a9('0x2b')](_0x1fd929);};}exports[_0x66a9('0x2c')]=function(_0x388d54,_0x4aa7bf){var _0x138ce6={},_0x3b7cf1={},_0x268fa9={'count':0x0,'rows':[]};var _0x5bd9bd=_[_0x66a9('0x2d')](db[_0x66a9('0x2e')][_0x66a9('0x2f')],function(_0x245387){return{'name':_0x245387[_0x66a9('0x30')],'type':_0x245387[_0x66a9('0x31')][_0x66a9('0x32')]};});_0x3b7cf1['model']=_[_0x66a9('0x33')](_[_0x66a9('0x2d')](_0x5bd9bd,'name'),[_0x66a9('0x2a')]);_0x3b7cf1['query']=_[_0x66a9('0x34')](_0x388d54[_0x66a9('0x35')]);_0x3b7cf1[_0x66a9('0x36')]=_['intersection'](_0x3b7cf1[_0x66a9('0x37')],_0x3b7cf1[_0x66a9('0x35')]);_0x138ce6[_0x66a9('0x38')]=_['intersection'](_0x3b7cf1[_0x66a9('0x37')],qs[_0x66a9('0x39')](_0x388d54['query'][_0x66a9('0x39')]));_0x138ce6[_0x66a9('0x38')]=_0x138ce6[_0x66a9('0x38')]['length']?_0x138ce6['attributes']:_0x3b7cf1[_0x66a9('0x37')];if(!_0x388d54[_0x66a9('0x35')][_0x66a9('0x3a')](_0x66a9('0x3b'))){_0x138ce6[_0x66a9('0x21')]=qs[_0x66a9('0x21')](_0x388d54['query']['limit']);_0x138ce6[_0x66a9('0x20')]=qs['offset'](_0x388d54[_0x66a9('0x35')][_0x66a9('0x20')]);}_0x138ce6[_0x66a9('0x3c')]=qs[_0x66a9('0x3d')](_0x388d54['query'][_0x66a9('0x3d')]);_0x138ce6[_0x66a9('0x3e')]=qs[_0x66a9('0x36')](_[_0x66a9('0x3f')](_0x388d54[_0x66a9('0x35')],_0x3b7cf1[_0x66a9('0x36')]),_0x5bd9bd);if(_0x388d54[_0x66a9('0x35')][_0x66a9('0x40')]){_0x138ce6[_0x66a9('0x3e')]=_[_0x66a9('0x41')](_0x138ce6['where'],{'$or':_[_0x66a9('0x2d')](_0x5bd9bd,function(_0x1038a8){if(_0x1038a8[_0x66a9('0x31')]!==_0x66a9('0x42')){var _0x32ec7d={};_0x32ec7d[_0x1038a8[_0x66a9('0x2a')]]={'$like':'%'+_0x388d54['query']['filter']+'%'};return _0x32ec7d;}})});}_0x138ce6=_[_0x66a9('0x41')]({},_0x138ce6,_0x388d54[_0x66a9('0x43')]);var _0x298f06={'where':_0x138ce6[_0x66a9('0x3e')]};return db[_0x66a9('0x2e')][_0x66a9('0x1f')](_0x298f06)[_0x66a9('0x27')](function(_0x12572b){_0x268fa9[_0x66a9('0x1f')]=_0x12572b;if(_0x388d54['query']['includeAll']){_0x138ce6[_0x66a9('0x44')]=[{'all':!![]}];}return db[_0x66a9('0x2e')]['findAll'](_0x138ce6);})[_0x66a9('0x27')](function(_0x30e747){_0x268fa9[_0x66a9('0x45')]=_0x30e747;return _0x268fa9;})['then'](respondWithFilteredResult(_0x4aa7bf,_0x138ce6))[_0x66a9('0x46')](handleError(_0x4aa7bf,null));};exports[_0x66a9('0x47')]=function(_0x100e33,_0x388971){var _0x5bc200={'raw':!![],'where':{'id':_0x100e33[_0x66a9('0x48')]['id']}},_0x1e5daa={};_0x1e5daa['model']=_['keys'](db[_0x66a9('0x2e')][_0x66a9('0x2f')]);_0x1e5daa[_0x66a9('0x35')]=_['keys'](_0x100e33[_0x66a9('0x35')]);_0x1e5daa['filtears']=_['intersection'](_0x1e5daa[_0x66a9('0x37')],_0x1e5daa['query']);_0x5bc200['attributes']=_[_0x66a9('0x49')](_0x1e5daa[_0x66a9('0x37')],qs[_0x66a9('0x39')](_0x100e33['query']['fields']));_0x5bc200[_0x66a9('0x38')]=_0x5bc200['attributes'][_0x66a9('0x4a')]?_0x5bc200[_0x66a9('0x38')]:_0x1e5daa[_0x66a9('0x37')];if(_0x100e33['query'][_0x66a9('0x4b')]){_0x5bc200['include']=[{'all':!![]}];}_0x5bc200=_[_0x66a9('0x41')]({},_0x5bc200,_0x100e33[_0x66a9('0x43')]);return db['CmCustomField']['find'](_0x5bc200)[_0x66a9('0x27')](handleEntityNotFound(_0x388971,null))[_0x66a9('0x27')](respondWithResult(_0x388971,null))['catch'](handleError(_0x388971,null));};exports[_0x66a9('0x4c')]=function(_0x4c6f3b,_0x186fc9){if(_0x4c6f3b[_0x66a9('0x4d')]['id']){delete _0x4c6f3b[_0x66a9('0x4d')]['id'];}return db['CmCustomField'][_0x66a9('0x4e')]({'where':{'id':_0x4c6f3b[_0x66a9('0x48')]['id']}})[_0x66a9('0x27')](handleEntityNotFound(_0x186fc9,null))[_0x66a9('0x27')](saveUpdates(_0x4c6f3b[_0x66a9('0x4d')],null))[_0x66a9('0x27')](respondWithResult(_0x186fc9,null))['catch'](handleError(_0x186fc9,null));};exports['destroy']=function(_0x48e32f,_0x1a1ee1){return db[_0x66a9('0x2e')][_0x66a9('0x4e')]({'where':{'id':_0x48e32f[_0x66a9('0x48')]['id']}})[_0x66a9('0x27')](handleEntityNotFound(_0x1a1ee1,null))[_0x66a9('0x27')](removeEntity(_0x1a1ee1,null))['catch'](handleError(_0x1a1ee1,null));};exports[_0x66a9('0x4f')]=function(_0xaca8c6,_0x13d05c){var _0x4593c4;return db[_0x66a9('0x50')][_0x66a9('0x51')](function(_0x81bd92){return db['CmCustomField'][_0x66a9('0x4f')](_0xaca8c6['body'],{'transaction':_0x81bd92})[_0x66a9('0x27')](function(_0x47cbfc){_0x4593c4=_0x47cbfc;var _0x10f1d4={'type':db[_0x66a9('0x52')][_0x66a9('0x53')],'transaction':_0x81bd92};switch(_0xaca8c6[_0x66a9('0x4d')][_0x66a9('0x31')]){case _0x66a9('0x54'):_0x10f1d4[_0x66a9('0x31')]=db[_0x66a9('0x52')][_0x66a9('0x53')];break;case _0x66a9('0x55'):_0x10f1d4[_0x66a9('0x31')]=db['Sequelize'][_0x66a9('0x56')];break;case _0x66a9('0x57'):_0x10f1d4[_0x66a9('0x31')]=db[_0x66a9('0x52')][_0x66a9('0x58')];_0x10f1d4[_0x66a9('0x59')]=![];break;default:}return db[_0x66a9('0x50')][_0x66a9('0x5a')][_0x66a9('0x5b')]('cm_contacts',util['format'](_0x66a9('0x5c'),_0x4593c4['id']),_0x10f1d4);})[_0x66a9('0x27')](function(){return _0x4593c4;});})[_0x66a9('0x27')](respondWithResult(_0x13d05c,0xc9))[_0x66a9('0x46')](handleError(_0x13d05c,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 7602075..19419f3 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 _0xb89f=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','cm_custom_fields'];(function(_0x529185,_0x5f5ef5){var _0x541314=function(_0x2c64cf){while(--_0x2c64cf){_0x529185['push'](_0x529185['shift']());}};_0x541314(++_0x5f5ef5);}(_0xb89f,0x113));var _0xfb89=function(_0x1f4302,_0x4b69a2){_0x1f4302=_0x1f4302-0x0;var _0x3dd7f5=_0xb89f[_0x1f4302];return _0x3dd7f5;};'use strict';var _=require('lodash');var util=require(_0xfb89('0x0'));var logger=require(_0xfb89('0x1'))(_0xfb89('0x2'));var moment=require(_0xfb89('0x3'));var BPromise=require(_0xfb89('0x4'));var rp=require(_0xfb89('0x5'));var fs=require('fs');var path=require(_0xfb89('0x6'));var rimraf=require('rimraf');var config=require(_0xfb89('0x7'));var attributes=require('./cmCustomField.attributes');module[_0xfb89('0x8')]=function(_0x4cb872,_0x5b1a8b){return _0x4cb872[_0xfb89('0x9')]('CmCustomField',attributes,{'tableName':_0xfb89('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc32=['exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xf019d2,_0x289841){var _0x19aee3=function(_0xe2bb02){while(--_0xe2bb02){_0xf019d2['push'](_0xf019d2['shift']());}};_0x19aee3(++_0x289841);}(_0xbc32,0x6c));var _0x2bc3=function(_0x531be9,_0x3c0928){_0x531be9=_0x531be9-0x0;var _0x291d43=_0xbc32[_0x531be9];return _0x291d43;};'use strict';var _=require(_0x2bc3('0x0'));var util=require(_0x2bc3('0x1'));var logger=require(_0x2bc3('0x2'))(_0x2bc3('0x3'));var moment=require(_0x2bc3('0x4'));var BPromise=require(_0x2bc3('0x5'));var rp=require(_0x2bc3('0x6'));var fs=require('fs');var path=require(_0x2bc3('0x7'));var rimraf=require(_0x2bc3('0x8'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0x2bc3('0x9')]=function(_0xa00008,_0x40aab3){return _0xa00008[_0x2bc3('0xa')](_0x2bc3('0xb'),attributes,{'tableName':_0x2bc3('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 9c97140..e798c4d 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 _0xf021=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','then','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','CmCustomField,\x20%s,\x20%s','result','catch'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xf021,0x18f));var _0x1f02=function(_0x4fc9c1,_0x570e05){_0x4fc9c1=_0x4fc9c1-0x0;var _0x15d7a1=_0xf021[_0x4fc9c1];return _0x15d7a1;};'use strict';var _=require(_0x1f02('0x0'));var util=require(_0x1f02('0x1'));var moment=require(_0x1f02('0x2'));var BPromise=require(_0x1f02('0x3'));var rs=require(_0x1f02('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f02('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f02('0x6'))(_0x1f02('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1f02('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x383d0b,_0x257d6a,_0x2a6c50){return new BPromise(function(_0x4193d2,_0x1f1cec){return client['request'](_0x383d0b,_0x2a6c50)[_0x1f02('0x9')](function(_0x5dc295){logger['info']('CmCustomField,\x20%s,\x20%s',_0x257d6a,_0x1f02('0xa'));logger[_0x1f02('0xb')](_0x1f02('0xc'),_0x257d6a,_0x1f02('0xa'),JSON[_0x1f02('0xd')](_0x5dc295));if(_0x5dc295['error']){if(_0x5dc295[_0x1f02('0xe')][_0x1f02('0xf')]===0x1f4){logger[_0x1f02('0xe')]('CmCustomField,\x20%s,\x20%s',_0x257d6a,_0x5dc295[_0x1f02('0xe')][_0x1f02('0x10')]);return _0x1f1cec(_0x5dc295[_0x1f02('0xe')]['message']);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x257d6a,_0x5dc295[_0x1f02('0xe')][_0x1f02('0x10')]);return _0x4193d2(_0x5dc295[_0x1f02('0xe')][_0x1f02('0x10')]);}else{logger[_0x1f02('0x11')](_0x1f02('0x12'),_0x257d6a,_0x1f02('0xa'));_0x4193d2(_0x5dc295[_0x1f02('0x13')]['message']);}})[_0x1f02('0x14')](function(_0x5cca16){logger['error']('CmCustomField,\x20%s,\x20%s',_0x257d6a,_0x5cca16);_0x1f1cec(_0x5cca16);});});} \ No newline at end of file +var _0xaba6=['../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xaba6,0xe2));var _0x6aba=function(_0x3bad98,_0x265549){_0x3bad98=_0x3bad98-0x0;var _0x4b3aa6=_0xaba6[_0x3bad98];return _0x4b3aa6;};'use strict';var _=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6aba('0x2'))['db'];var utils=require(_0x6aba('0x3'));var logger=require('../../config/logger')(_0x6aba('0x4'));var config=require(_0x6aba('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39c32a,_0x54416a,_0x3766d4){return new BPromise(function(_0x1a4fbc,_0x508dff){return client[_0x6aba('0x6')](_0x39c32a,_0x3766d4)[_0x6aba('0x7')](function(_0x4ea8eb){logger[_0x6aba('0x8')](_0x6aba('0x9'),_0x54416a,_0x6aba('0xa'));logger[_0x6aba('0xb')](_0x6aba('0xc'),_0x54416a,_0x6aba('0xa'),JSON[_0x6aba('0xd')](_0x4ea8eb));if(_0x4ea8eb['error']){if(_0x4ea8eb[_0x6aba('0xe')][_0x6aba('0xf')]===0x1f4){logger[_0x6aba('0xe')](_0x6aba('0x9'),_0x54416a,_0x4ea8eb['error'][_0x6aba('0x10')]);return _0x508dff(_0x4ea8eb[_0x6aba('0xe')]['message']);}logger[_0x6aba('0xe')](_0x6aba('0x9'),_0x54416a,_0x4ea8eb[_0x6aba('0xe')]['message']);return _0x1a4fbc(_0x4ea8eb[_0x6aba('0xe')][_0x6aba('0x10')]);}else{logger[_0x6aba('0x8')]('CmCustomField,\x20%s,\x20%s',_0x54416a,_0x6aba('0xa'));_0x1a4fbc(_0x4ea8eb[_0x6aba('0x11')][_0x6aba('0x10')]);}})[_0x6aba('0x12')](function(_0x379b17){logger[_0x6aba('0xe')](_0x6aba('0x9'),_0x54416a,_0x379b17);_0x508dff(_0x379b17);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index e2b2c26..3026db3 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 _0x2e35=['./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x89bd5e,_0x2fe7ac){var _0x5d4749=function(_0x8bc00a){while(--_0x8bc00a){_0x89bd5e['push'](_0x89bd5e['shift']());}};_0x5d4749(++_0x2fe7ac);}(_0x2e35,0x9a));var _0x52e3=function(_0x58469d,_0x4c2852){_0x58469d=_0x58469d-0x0;var _0x122d81=_0x2e35[_0x58469d];return _0x122d81;};'use strict';var multer=require(_0x52e3('0x0'));var util=require(_0x52e3('0x1'));var path=require('path');var timeout=require(_0x52e3('0x2'));var express=require(_0x52e3('0x3'));var router=express[_0x52e3('0x4')]();var auth=require(_0x52e3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x52e3('0x6'));router[_0x52e3('0x7')]('/',auth[_0x52e3('0x8')](),controller[_0x52e3('0x9')]);router[_0x52e3('0x7')](_0x52e3('0xa'),auth['isAuthenticated'](),controller[_0x52e3('0xb')]);router[_0x52e3('0xc')]('/',auth[_0x52e3('0x8')](),controller[_0x52e3('0xd')]);router['put'](_0x52e3('0xa'),auth['isAuthenticated'](),controller[_0x52e3('0xe')]);router[_0x52e3('0xf')]('/:id',auth[_0x52e3('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xafb7=['delete','exports','multer','util','express','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0xe09b12,_0x535e1f){var _0x6a2392=function(_0x24b4ae){while(--_0x24b4ae){_0xe09b12['push'](_0xe09b12['shift']());}};_0x6a2392(++_0x535e1f);}(_0xafb7,0x19a));var _0x7afb=function(_0x45ebab,_0x4eb13a){_0x45ebab=_0x45ebab-0x0;var _0x55816f=_0xafb7[_0x45ebab];return _0x55816f;};'use strict';var multer=require(_0x7afb('0x0'));var util=require(_0x7afb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7afb('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7afb('0x3'));var config=require(_0x7afb('0x4'));var controller=require(_0x7afb('0x5'));router[_0x7afb('0x6')]('/',auth[_0x7afb('0x7')](),controller[_0x7afb('0x8')]);router['get'](_0x7afb('0x9'),auth['isAuthenticated'](),controller[_0x7afb('0xa')]);router[_0x7afb('0xb')]('/',auth[_0x7afb('0x7')](),controller[_0x7afb('0xc')]);router[_0x7afb('0xd')](_0x7afb('0x9'),auth['isAuthenticated'](),controller[_0x7afb('0xe')]);router[_0x7afb('0xf')](_0x7afb('0x9'),auth[_0x7afb('0x7')](),controller['destroy']);module[_0x7afb('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 61e1427..d35c33a 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 _0x98a8=['format','INTEGER','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x98a8,0x12c));var _0x898a=function(_0x37ee1f,_0x5ccd60){_0x37ee1f=_0x37ee1f-0x0;var _0x156503=_0x98a8[_0x37ee1f];return _0x156503;};'use strict';var moment=require(_0x898a('0x0'));var Sequelize=require(_0x898a('0x1'));module[_0x898a('0x2')]={'phone':{'type':Sequelize[_0x898a('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x898a('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x898a('0x5')],'defaultValue':moment()[_0x898a('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x898a('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x898a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x898a('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x898a('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x898a('0x8')},'ListId':{'type':Sequelize[_0x898a('0x7')],'unique':_0x898a('0x8')},'UserId':{'type':Sequelize[_0x898a('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x898a('0x7')],'unique':_0x898a('0x8')},'CampaignId':{'type':Sequelize[_0x898a('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0fda=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','exports','STRING','BOOLEAN'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x14d840,_0x2194cf){_0x14d840=_0x14d840-0x0;var _0xfda39=_0x0fda[_0x14d840];return _0xfda39;};'use strict';var moment=require(_0xa0fd('0x0'));var Sequelize=require('sequelize');module[_0xa0fd('0x1')]={'phone':{'type':Sequelize[_0xa0fd('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xa0fd('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa0fd('0x4')],'defaultValue':moment()[_0xa0fd('0x5')](_0xa0fd('0x6'))},'countbusyretry':{'type':Sequelize[_0xa0fd('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa0fd('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xa0fd('0x7')](0x2)[_0xa0fd('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xa0fd('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa0fd('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xa0fd('0x7')],'unique':_0xa0fd('0x9')},'UserId':{'type':Sequelize[_0xa0fd('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xa0fd('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xa0fd('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xa0fd('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa0fd('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa0fd('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa0fd('0x7')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 5e942ac..0a90b15 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 _0xbe4e=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','update','then','end','error','stack','send','index','map','CmHopper','rawAttributes','type','key','model','query','intersection','concat','filters','$gt','$gte','$lt','$lte','$ne','$eq','$not','$notBetween','$notIn','$iLike','$notILike','$overlap','$contained','$any','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','name','merge','options','count','rows','catch','show','params','keys','filtears','fields','includeAll','include','create','body','find','describe','destroy','VoiceQueueId','Campaign','CampaignId','omit','dataValues','createdAt','state','statedesc','deleted','membername','UserId','user','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','format','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','VoiceQueue','Queue','dialActive','getOpenContacts','entity\x20not\x20found','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto'];(function(_0x1bd9ce,_0x533434){var _0x38d016=function(_0x53246c){while(--_0x53246c){_0x1bd9ce['push'](_0x1bd9ce['shift']());}};_0x38d016(++_0x533434);}(_0xbe4e,0x11f));var _0xebe4=function(_0x1299ff,_0x132845){_0x1299ff=_0x1299ff-0x0;var _0x2d732a=_0xbe4e[_0x1299ff];return _0x2d732a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xebe4('0x0'));var zipdir=require(_0xebe4('0x1'));var jsonpatch=require(_0xebe4('0x2'));var rp=require(_0xebe4('0x3'));var moment=require(_0xebe4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xebe4('0x5'));var util=require(_0xebe4('0x6'));var path=require(_0xebe4('0x7'));var sox=require(_0xebe4('0x8'));var csv=require(_0xebe4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xebe4('0xa'));var squel=require(_0xebe4('0xb'));var crypto=require(_0xebe4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xebe4('0xd'));var toCsv=require(_0xebe4('0x9'));var querystring=require(_0xebe4('0xe'));var Papa=require(_0xebe4('0xf'));var Redis=require(_0xebe4('0x10'));var authService=require(_0xebe4('0x11'));var qs=require(_0xebe4('0x12'));var as=require(_0xebe4('0x13'));var hardwareService=require(_0xebe4('0x14'));var logger=require(_0xebe4('0x15'))('api');var utils=require(_0xebe4('0x16'));var config=require(_0xebe4('0x17'));var licenseUtil=require(_0xebe4('0x18'));var db=require(_0xebe4('0x19'))['db'];function respondWithStatusCode(_0x2add02,_0x2a0ecf){_0x2a0ecf=_0x2a0ecf||0xcc;return function(_0x1e68bc){if(_0x1e68bc){return _0x2add02[_0xebe4('0x1a')](_0x2a0ecf);}return _0x2add02[_0xebe4('0x1b')](_0x2a0ecf)['end']();};}function respondWithResult(_0x62fbcb,_0x2c92a0){_0x2c92a0=_0x2c92a0||0xc8;return function(_0x3b9a21){if(_0x3b9a21){return _0x62fbcb[_0xebe4('0x1b')](_0x2c92a0)[_0xebe4('0x1c')](_0x3b9a21);}};}function respondWithFilteredResult(_0x44f5bb,_0x486a74){return function(_0x18e870){if(_0x18e870){var _0x2223e7=_0x18e870['count'],_0x580f2d=_0x486a74[_0xebe4('0x1d')],_0x29f533=_0x486a74[_0xebe4('0x1d')]+_0x486a74[_0xebe4('0x1e')],_0xd60001;if(_0x29f533>=_0x2223e7){_0x29f533=_0x2223e7;_0xd60001=0xc8;}else{_0xd60001=0xce;}_0x44f5bb['status'](_0xd60001);return _0x44f5bb[_0xebe4('0x1f')](_0xebe4('0x20'),_0x580f2d+'-'+_0x29f533+'/'+_0x2223e7)[_0xebe4('0x1c')](_0x18e870);}return null;};}function patchUpdates(_0x4b0d81){return function(_0x132b39){try{jsonpatch['apply'](_0x132b39,_0x4b0d81,!![]);}catch(_0x31b7f0){return BPromise[_0xebe4('0x21')](_0x31b7f0);}return _0x132b39['save']();};}function saveUpdates(_0x139902,_0x205994){return function(_0x1803d3){if(_0x1803d3){return _0x1803d3[_0xebe4('0x22')](_0x139902)['then'](function(_0x3125c0){return _0x3125c0;});}return null;};}function removeEntity(_0x278cfe,_0x2614eb){return function(_0x5d9a8b){if(_0x5d9a8b){return _0x5d9a8b['destroy']()[_0xebe4('0x23')](function(){_0x278cfe['status'](0xcc)[_0xebe4('0x24')]();});}};}function handleEntityNotFound(_0xfc27d,_0x4d48e5){return function(_0x46d21a){if(!_0x46d21a){_0xfc27d['sendStatus'](0x194);}return _0x46d21a;};}function handleError(_0x4891ed,_0x36a303){_0x36a303=_0x36a303||0x1f4;return function(_0x50d9bf){logger[_0xebe4('0x25')](_0x50d9bf[_0xebe4('0x26')]);if(_0x50d9bf['name']){delete _0x50d9bf['name'];}_0x4891ed['status'](_0x36a303)[_0xebe4('0x27')](_0x50d9bf);};}exports[_0xebe4('0x28')]=function(_0x9a6a9,_0x4f0e6a){var _0x804ae4={},_0x2d6727={},_0x5b811c={'count':0x0,'rows':[]};var _0x3a8ae0=_[_0xebe4('0x29')](db[_0xebe4('0x2a')][_0xebe4('0x2b')],function(_0x1153e7){return{'name':_0x1153e7['fieldName'],'type':_0x1153e7[_0xebe4('0x2c')][_0xebe4('0x2d')]};});_0x2d6727[_0xebe4('0x2e')]=_[_0xebe4('0x29')](_0x3a8ae0,'name');_0x2d6727[_0xebe4('0x2f')]=_['keys'](_0x9a6a9[_0xebe4('0x2f')]);_0x2d6727['filters']=_[_0xebe4('0x30')](_0x2d6727['model'],_0x2d6727[_0xebe4('0x2f')]);_0x2d6727['filters']=_[_0xebe4('0x31')](_0x2d6727[_0xebe4('0x32')],['$and','$or',_0xebe4('0x33'),_0xebe4('0x34'),_0xebe4('0x35'),_0xebe4('0x36'),_0xebe4('0x37'),_0xebe4('0x38'),_0xebe4('0x39'),'$between',_0xebe4('0x3a'),'$in',_0xebe4('0x3b'),'$like','$notLike',_0xebe4('0x3c'),_0xebe4('0x3d'),'$like',_0xebe4('0x3e'),'$contains',_0xebe4('0x3f'),_0xebe4('0x40')]);_0x804ae4['attributes']=_['intersection'](_0x2d6727[_0xebe4('0x2e')],qs['fields'](_0x9a6a9[_0xebe4('0x2f')]['fields']));_0x804ae4['attributes']=_0x804ae4[_0xebe4('0x41')][_0xebe4('0x42')]?_0x804ae4[_0xebe4('0x41')]:_0x2d6727[_0xebe4('0x2e')];if(!_0x9a6a9['query'][_0xebe4('0x43')](_0xebe4('0x44'))){_0x804ae4[_0xebe4('0x1e')]=qs[_0xebe4('0x1e')](_0x9a6a9[_0xebe4('0x2f')][_0xebe4('0x1e')]);_0x804ae4[_0xebe4('0x1d')]=qs[_0xebe4('0x1d')](_0x9a6a9['query']['offset']);}_0x804ae4[_0xebe4('0x45')]=qs[_0xebe4('0x46')](_0x9a6a9[_0xebe4('0x2f')][_0xebe4('0x46')]);_0x804ae4[_0xebe4('0x47')]=qs['filters'](_[_0xebe4('0x48')](_0x9a6a9[_0xebe4('0x2f')],_0x2d6727[_0xebe4('0x32')]),_0x3a8ae0);if(_0x9a6a9[_0xebe4('0x2f')][_0xebe4('0x49')]){_0x804ae4[_0xebe4('0x47')]=_['merge'](_0x804ae4[_0xebe4('0x47')],{'$or':_[_0xebe4('0x29')](_0x3a8ae0,function(_0x165f7e){if(_0x165f7e[_0xebe4('0x2c')]!==_0xebe4('0x4a')){var _0x4e3852={};_0x4e3852[_0x165f7e[_0xebe4('0x4b')]]={'$like':'%'+_0x9a6a9[_0xebe4('0x2f')][_0xebe4('0x49')]+'%'};return _0x4e3852;}})});}_0x804ae4=_[_0xebe4('0x4c')]({},_0x804ae4,_0x9a6a9[_0xebe4('0x4d')]);var _0x2b83b2={'where':_0x804ae4[_0xebe4('0x47')]};return db[_0xebe4('0x2a')]['count'](_0x2b83b2)[_0xebe4('0x23')](function(_0x1bcd02){_0x5b811c[_0xebe4('0x4e')]=_0x1bcd02;if(_0x9a6a9[_0xebe4('0x2f')]['includeAll']){_0x804ae4['include']=[{'all':!![]}];}return db[_0xebe4('0x2a')]['findAll'](_0x804ae4);})['then'](function(_0xe68ba3){_0x5b811c[_0xebe4('0x4f')]=_0xe68ba3;return _0x5b811c;})[_0xebe4('0x23')](respondWithFilteredResult(_0x4f0e6a,_0x804ae4))[_0xebe4('0x50')](handleError(_0x4f0e6a,null));};exports[_0xebe4('0x51')]=function(_0x42a169,_0x59a765){var _0x53f192={'raw':!![],'where':{'id':_0x42a169[_0xebe4('0x52')]['id']}},_0x51bd74={};_0x51bd74['model']=_['keys'](db[_0xebe4('0x2a')][_0xebe4('0x2b')]);_0x51bd74[_0xebe4('0x2f')]=_[_0xebe4('0x53')](_0x42a169[_0xebe4('0x2f')]);_0x51bd74[_0xebe4('0x54')]=_['intersection'](_0x51bd74['model'],_0x51bd74[_0xebe4('0x2f')]);_0x53f192[_0xebe4('0x41')]=_[_0xebe4('0x30')](_0x51bd74[_0xebe4('0x2e')],qs['fields'](_0x42a169[_0xebe4('0x2f')][_0xebe4('0x55')]));_0x53f192[_0xebe4('0x41')]=_0x53f192[_0xebe4('0x41')][_0xebe4('0x42')]?_0x53f192['attributes']:_0x51bd74['model'];if(_0x42a169[_0xebe4('0x2f')][_0xebe4('0x56')]){_0x53f192[_0xebe4('0x57')]=[{'all':!![]}];}_0x53f192=_[_0xebe4('0x4c')]({},_0x53f192,_0x42a169['options']);return db[_0xebe4('0x2a')]['find'](_0x53f192)[_0xebe4('0x23')](handleEntityNotFound(_0x59a765,null))[_0xebe4('0x23')](respondWithResult(_0x59a765,null))['catch'](handleError(_0x59a765,null));};exports[_0xebe4('0x58')]=function(_0x2d3bef,_0x13a8a2){return db[_0xebe4('0x2a')][_0xebe4('0x58')](_0x2d3bef[_0xebe4('0x59')],{})[_0xebe4('0x23')](respondWithResult(_0x13a8a2,0xc9))[_0xebe4('0x50')](handleError(_0x13a8a2,null));};exports['update']=function(_0x3ab87d,_0x14f56a){if(_0x3ab87d['body']['id']){delete _0x3ab87d[_0xebe4('0x59')]['id'];}return db['CmHopper'][_0xebe4('0x5a')]({'where':{'id':_0x3ab87d['params']['id']}})[_0xebe4('0x23')](handleEntityNotFound(_0x14f56a,null))[_0xebe4('0x23')](saveUpdates(_0x3ab87d[_0xebe4('0x59')],null))[_0xebe4('0x23')](respondWithResult(_0x14f56a,null))[_0xebe4('0x50')](handleError(_0x14f56a,null));};exports[_0xebe4('0x5b')]=function(_0x5d5af3,_0x2b03ee){return db[_0xebe4('0x2a')][_0xebe4('0x5b')]()[_0xebe4('0x23')](respondWithResult(_0x2b03ee,null))[_0xebe4('0x50')](handleError(_0x2b03ee,null));};exports[_0xebe4('0x5c')]=function(_0x4cb9db,_0x4e304a){var _0x2d1724;return db[_0xebe4('0x2a')]['find']({'where':{'id':_0x4cb9db[_0xebe4('0x52')]['id']}})[_0xebe4('0x23')](handleEntityNotFound(_0x4e304a,null))[_0xebe4('0x23')](function(_0x3e66cb){if(_0x3e66cb){return _0x3e66cb[_0xebe4('0x5c')]()[_0xebe4('0x23')](function(_0x8c4d20){return _0x8c4d20;});}})[_0xebe4('0x23')](function(_0x3d34d9){_0x2d1724=_0x3d34d9;if(_0x3d34d9){if(_0x3d34d9[_0xebe4('0x5d')]||_0x3d34d9['CampaignId']){return db[_0x3d34d9[_0xebe4('0x5d')]?'VoiceQueue':_0xebe4('0x5e')][_0xebe4('0x5a')]({'where':{'id':_0x3d34d9[_0xebe4('0x5d')]?_0x3d34d9[_0xebe4('0x5d')]:_0x3d34d9[_0xebe4('0x5f')]},'attributes':['id',_0xebe4('0x4b')],'raw':!![]});}}})[_0xebe4('0x23')](function(_0x6e03e2){var _0xcf185c={};if(_0x6e03e2){_[_0xebe4('0x4c')](_0xcf185c,_[_0xebe4('0x60')](_0x2d1724[_0xebe4('0x61')],[_0xebe4('0x62'),'updatedAt','id']));_0xcf185c[_0xebe4('0x63')]=0x15;_0xcf185c[_0xebe4('0x64')]=_0xebe4('0x65');_0xcf185c['campaign']=_0x6e03e2['name'];_0xcf185c[_0xebe4('0x66')]=_0x4cb9db['user'][_0xebe4('0x4b')];_0xcf185c[_0xebe4('0x67')]=_0x4cb9db[_0xebe4('0x68')]['id'];_0xcf185c[_0xebe4('0x65')]=!![];_0xcf185c[_0xebe4('0x69')]=moment()['format'](_0xebe4('0x6a'));_0xcf185c[_0xebe4('0x6b')]=_0x2d1724[_0xebe4('0x6c')];_0xcf185c[_0xebe4('0x6d')]=_0x2d1724[_0xebe4('0x5d')]?_0xebe4('0x6e'):_0xebe4('0x6f');return db[_0xebe4('0x70')]['find']({'where':{'id':_0xcf185c[_0xebe4('0x71')]},'attributes':[_0xebe4('0x72'),_0xebe4('0x73')]})[_0xebe4('0x23')](function(_0x4b514e){if(!_['isNil'](_0x4e304a)&&!_[_0xebe4('0x74')](_0x4b514e['firstName'])){_0xcf185c[_0xebe4('0x75')]=_0x4b514e[_0xebe4('0x72')];if(!_[_0xebe4('0x74')](_0x4b514e[_0xebe4('0x73')])){_0xcf185c[_0xebe4('0x75')]+='\x20'+_0x4b514e['lastName'];}}})[_0xebe4('0x76')](function(){return db[_0xebe4('0x77')][_0xebe4('0x58')](_0xcf185c);});}})['then'](function(){return _0x4e304a[_0xebe4('0x1b')](0xcc)['end']();})[_0xebe4('0x50')](handleError(_0x4e304a,null));};exports[_0xebe4('0x78')]=function(_0x5c65b0,_0xa8fd75,_0x20aeca){var _0x4681b0=[];return db['CmContact'][_0xebe4('0x5b')]()[_0xebe4('0x23')](function(_0x5d2b28){_0x4681b0=_[_0xebe4('0x53')](_0x5d2b28);return _0x5c65b0[_0xebe4('0x68')][_0xebe4('0x79')]({'where':{'type':_0xebe4('0x7a'),'dialActive':!![],'dialMethod':_0xebe4('0x7b')},'attributes':['id',_0xebe4('0x7c')],'raw':!![]});})['then'](function(_0xb0eb3e){if(_0xb0eb3e&&_0xb0eb3e[_0xebe4('0x42')]){return db[_0xebe4('0x7d')][_0xebe4('0x7e')](function(_0x3aac73){var _0x35f025={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xebe4('0x7f')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xebe4('0x29')](_0xb0eb3e,'id')},'$or':[{'UserId':null},{'UserId':_0x5c65b0[_0xebe4('0x68')]['id']}]};var _0x10c0d7=[];if(_0x5c65b0[_0xebe4('0x59')][_0xebe4('0x80')]&&_0x5c65b0[_0xebe4('0x59')]['direction']===_0xebe4('0x81')){if(!_[_0xebe4('0x82')](_0x5c65b0['body'][_0xebe4('0x83')])){_0x35f025['id']={'$in':_0x5c65b0[_0xebe4('0x59')][_0xebe4('0x83')]};}_0x10c0d7=[[_0xebe4('0x84'),_0xebe4('0x85')],['scheduledAt',_0xb0eb3e[0x0][_0xebe4('0x7c')]==='ASC'?_0xebe4('0x86'):_0xebe4('0x85')],db[_0xebe4('0x7d')][_0xebe4('0x87')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xebe4('0x86')]];}else{if(!_[_0xebe4('0x82')](_0x5c65b0[_0xebe4('0x59')][_0xebe4('0x83')])){_0x35f025['id']={'$notIn':_0x5c65b0['body'][_0xebe4('0x83')]};}_0x10c0d7=[['priority',_0xebe4('0x86')],[_0xebe4('0x88'),_0xb0eb3e[0x0][_0xebe4('0x7c')]],db[_0xebe4('0x7d')][_0xebe4('0x87')](_0xebe4('0x89')),['id',_0xebe4('0x85')]];}return db[_0xebe4('0x2a')][_0xebe4('0x8a')]({'attributes':['id',_0xebe4('0x8b')],'where':_0x35f025,'order':_0x10c0d7,'transaction':_0x3aac73,'lock':_0x3aac73[_0xebe4('0x8c')][_0xebe4('0x8d')],'include':[{'model':db[_0xebe4('0x70')],'as':_0xebe4('0x8e'),'attributes':_0x4681b0,'include':[{'model':db[_0xebe4('0x8f')],'as':_0xebe4('0x90'),'attributes':['id',_0xebe4('0x4b')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0xebe4('0x4b')]},{'model':db[_0xebe4('0x91')],'as':_0xebe4('0x92'),'attributes':['id',_0xebe4('0x4b'),_0xebe4('0x93')]}]})[_0xebe4('0x23')](function(_0x509e5f){if(_0x509e5f){return _0x509e5f[_0xebe4('0x22')]({'UserId':_0x5c65b0[_0xebe4('0x68')]['id']},{'transaction':_0x3aac73});}});});}})['then'](handleEntityNotFound(_0xa8fd75,null))['then'](respondWithResult(_0xa8fd75,null))['catch'](handleError(_0xa8fd75,null));};exports[_0xebe4('0x94')]=function(_0x21b2cb,_0x19f507,_0x321520){return _0x21b2cb[_0xebe4('0x68')][_0xebe4('0x79')]({'where':{'type':_0xebe4('0x7a'),'dialActive':!![],'dialMethod':_0xebe4('0x7b')},'attributes':['id'],'raw':!![]})[_0xebe4('0x23')](function(_0x5960ae){if(_0x5960ae&&_0x5960ae['length']){return db[_0xebe4('0x2a')][_0xebe4('0x4e')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xebe4('0x7f')](_0xebe4('0x6a'))},'VoiceQueueId':{'$in':_[_0xebe4('0x29')](_0x5960ae,'id')},'$or':[{'UserId':null},{'UserId':_0x21b2cb['user']['id']}]}});}return 0x0;})['then'](function(_0x30d84a){if(!_['isNil'](_0x30d84a)&&_['isNumber'](_0x30d84a)){return _0x19f507[_0xebe4('0x1b')](0xc8)[_0xebe4('0x1c')]({'contacts':_0x30d84a});}else{logger[_0xebe4('0x25')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xebe4('0x94'),0x194,_0xebe4('0x95'));_0x19f507['sendStatus'](0x194);}})[_0xebe4('0x50')](handleError(_0x19f507,null));}; \ No newline at end of file +var _0x973d=['firstName','calleridname','finally','CmHopperFinal','getPreview','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','YYYY-MM-DD\x20HH:mm:ss','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','scheduledat','LOCK','UPDATE','Company','CmList','List','Queue','dialActive','getOpenContacts','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','html-pdf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','set','Content-Range','reject','save','update','destroy','then','sendStatus','stack','name','send','index','CmHopper','rawAttributes','fieldName','type','query','filters','intersection','model','concat','$and','$or','$gt','$gte','$lte','$ne','$eq','$notBetween','$notIn','$like','$notLike','$iLike','$overlap','$contained','$any','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','count','includeAll','include','findAll','catch','show','params','keys','filtears','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','UserId','user','deletedat','format','calleridnum','phone','queue','ivr','ContactId','lastName','isNil'];(function(_0x26a6a6,_0x248ed6){var _0x411795=function(_0x4f471a){while(--_0x4f471a){_0x26a6a6['push'](_0x26a6a6['shift']());}};_0x411795(++_0x248ed6);}(_0x973d,0xb4));var _0xd973=function(_0x171b6e,_0x594024){_0x171b6e=_0x171b6e-0x0;var _0x58b7f3=_0x973d[_0x171b6e];return _0x58b7f3;};'use strict';var pdf=require(_0xd973('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd973('0x1'));var jsonpatch=require(_0xd973('0x2'));var rp=require('request-promise');var moment=require(_0xd973('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd973('0x4'));var util=require(_0xd973('0x5'));var path=require('path');var sox=require(_0xd973('0x6'));var csv=require(_0xd973('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd973('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd973('0x9'));var deskjs=require(_0xd973('0xa'));var toCsv=require(_0xd973('0x7'));var querystring=require(_0xd973('0xb'));var Papa=require(_0xd973('0xc'));var Redis=require('ioredis');var authService=require(_0xd973('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xd973('0xe'));var hardwareService=require(_0xd973('0xf'));var logger=require('../../config/logger')(_0xd973('0x10'));var utils=require('../../config/utils');var config=require(_0xd973('0x11'));var licenseUtil=require(_0xd973('0x12'));var db=require(_0xd973('0x13'))['db'];function respondWithStatusCode(_0x2dc47a,_0x3753df){_0x3753df=_0x3753df||0xcc;return function(_0x93a9d6){if(_0x93a9d6){return _0x2dc47a['sendStatus'](_0x3753df);}return _0x2dc47a['status'](_0x3753df)[_0xd973('0x14')]();};}function respondWithResult(_0x29cd4a,_0x4719c5){_0x4719c5=_0x4719c5||0xc8;return function(_0x6d30dd){if(_0x6d30dd){return _0x29cd4a[_0xd973('0x15')](_0x4719c5)[_0xd973('0x16')](_0x6d30dd);}};}function respondWithFilteredResult(_0x2b62d8,_0x3f194b){return function(_0xf9394e){if(_0xf9394e){var _0x7a600c=_0xf9394e['count'],_0x34af59=_0x3f194b[_0xd973('0x17')],_0x3e0e72=_0x3f194b['offset']+_0x3f194b['limit'],_0x4caac2;if(_0x3e0e72>=_0x7a600c){_0x3e0e72=_0x7a600c;_0x4caac2=0xc8;}else{_0x4caac2=0xce;}_0x2b62d8['status'](_0x4caac2);return _0x2b62d8[_0xd973('0x18')](_0xd973('0x19'),_0x34af59+'-'+_0x3e0e72+'/'+_0x7a600c)['json'](_0xf9394e);}return null;};}function patchUpdates(_0x2dadec){return function(_0x513d18){try{jsonpatch['apply'](_0x513d18,_0x2dadec,!![]);}catch(_0x173ba5){return BPromise[_0xd973('0x1a')](_0x173ba5);}return _0x513d18[_0xd973('0x1b')]();};}function saveUpdates(_0x55471c,_0x12865e){return function(_0x17d593){if(_0x17d593){return _0x17d593[_0xd973('0x1c')](_0x55471c)['then'](function(_0x25b0e4){return _0x25b0e4;});}return null;};}function removeEntity(_0x37b00f,_0x39b057){return function(_0x3d94fd){if(_0x3d94fd){return _0x3d94fd[_0xd973('0x1d')]()[_0xd973('0x1e')](function(){_0x37b00f[_0xd973('0x15')](0xcc)[_0xd973('0x14')]();});}};}function handleEntityNotFound(_0x43a7d5,_0x5afc0f){return function(_0x2bbf21){if(!_0x2bbf21){_0x43a7d5[_0xd973('0x1f')](0x194);}return _0x2bbf21;};}function handleError(_0x27d644,_0x465567){_0x465567=_0x465567||0x1f4;return function(_0x20d9a6){logger['error'](_0x20d9a6[_0xd973('0x20')]);if(_0x20d9a6[_0xd973('0x21')]){delete _0x20d9a6[_0xd973('0x21')];}_0x27d644[_0xd973('0x15')](_0x465567)[_0xd973('0x22')](_0x20d9a6);};}exports[_0xd973('0x23')]=function(_0x3d20b8,_0x1aa36d){var _0x282d12={},_0x59ce26={},_0x2bd86a={'count':0x0,'rows':[]};var _0xf1a4ae=_['map'](db[_0xd973('0x24')][_0xd973('0x25')],function(_0x55b59b){return{'name':_0x55b59b[_0xd973('0x26')],'type':_0x55b59b[_0xd973('0x27')]['key']};});_0x59ce26['model']=_['map'](_0xf1a4ae,_0xd973('0x21'));_0x59ce26[_0xd973('0x28')]=_['keys'](_0x3d20b8[_0xd973('0x28')]);_0x59ce26[_0xd973('0x29')]=_[_0xd973('0x2a')](_0x59ce26[_0xd973('0x2b')],_0x59ce26[_0xd973('0x28')]);_0x59ce26[_0xd973('0x29')]=_[_0xd973('0x2c')](_0x59ce26[_0xd973('0x29')],[_0xd973('0x2d'),_0xd973('0x2e'),_0xd973('0x2f'),_0xd973('0x30'),'$lt',_0xd973('0x31'),_0xd973('0x32'),_0xd973('0x33'),'$not','$between',_0xd973('0x34'),'$in',_0xd973('0x35'),_0xd973('0x36'),_0xd973('0x37'),_0xd973('0x38'),'$notILike','$like',_0xd973('0x39'),'$contains',_0xd973('0x3a'),_0xd973('0x3b')]);_0x282d12[_0xd973('0x3c')]=_[_0xd973('0x2a')](_0x59ce26[_0xd973('0x2b')],qs['fields'](_0x3d20b8[_0xd973('0x28')][_0xd973('0x3d')]));_0x282d12[_0xd973('0x3c')]=_0x282d12['attributes'][_0xd973('0x3e')]?_0x282d12[_0xd973('0x3c')]:_0x59ce26[_0xd973('0x2b')];if(!_0x3d20b8[_0xd973('0x28')][_0xd973('0x3f')]('nolimit')){_0x282d12[_0xd973('0x40')]=qs[_0xd973('0x40')](_0x3d20b8[_0xd973('0x28')]['limit']);_0x282d12[_0xd973('0x17')]=qs[_0xd973('0x17')](_0x3d20b8[_0xd973('0x28')][_0xd973('0x17')]);}_0x282d12[_0xd973('0x41')]=qs[_0xd973('0x42')](_0x3d20b8[_0xd973('0x28')][_0xd973('0x42')]);_0x282d12[_0xd973('0x43')]=qs[_0xd973('0x29')](_[_0xd973('0x44')](_0x3d20b8[_0xd973('0x28')],_0x59ce26['filters']),_0xf1a4ae);if(_0x3d20b8['query'][_0xd973('0x45')]){_0x282d12['where']=_['merge'](_0x282d12['where'],{'$or':_[_0xd973('0x46')](_0xf1a4ae,function(_0x10b580){if(_0x10b580[_0xd973('0x27')]!==_0xd973('0x47')){var _0x4cf275={};_0x4cf275[_0x10b580['name']]={'$like':'%'+_0x3d20b8['query']['filter']+'%'};return _0x4cf275;}})});}_0x282d12=_[_0xd973('0x48')]({},_0x282d12,_0x3d20b8[_0xd973('0x49')]);var _0x2e9fe5={'where':_0x282d12[_0xd973('0x43')]};return db[_0xd973('0x24')][_0xd973('0x4a')](_0x2e9fe5)[_0xd973('0x1e')](function(_0x50a8c4){_0x2bd86a[_0xd973('0x4a')]=_0x50a8c4;if(_0x3d20b8[_0xd973('0x28')][_0xd973('0x4b')]){_0x282d12[_0xd973('0x4c')]=[{'all':!![]}];}return db[_0xd973('0x24')][_0xd973('0x4d')](_0x282d12);})[_0xd973('0x1e')](function(_0x5ca83b){_0x2bd86a['rows']=_0x5ca83b;return _0x2bd86a;})[_0xd973('0x1e')](respondWithFilteredResult(_0x1aa36d,_0x282d12))[_0xd973('0x4e')](handleError(_0x1aa36d,null));};exports[_0xd973('0x4f')]=function(_0x45368e,_0x3c2a70){var _0x167e8b={'raw':!![],'where':{'id':_0x45368e[_0xd973('0x50')]['id']}},_0x1d1849={};_0x1d1849['model']=_[_0xd973('0x51')](db[_0xd973('0x24')]['rawAttributes']);_0x1d1849[_0xd973('0x28')]=_[_0xd973('0x51')](_0x45368e[_0xd973('0x28')]);_0x1d1849[_0xd973('0x52')]=_[_0xd973('0x2a')](_0x1d1849['model'],_0x1d1849[_0xd973('0x28')]);_0x167e8b[_0xd973('0x3c')]=_['intersection'](_0x1d1849['model'],qs[_0xd973('0x3d')](_0x45368e['query'][_0xd973('0x3d')]));_0x167e8b[_0xd973('0x3c')]=_0x167e8b[_0xd973('0x3c')][_0xd973('0x3e')]?_0x167e8b[_0xd973('0x3c')]:_0x1d1849[_0xd973('0x2b')];if(_0x45368e[_0xd973('0x28')][_0xd973('0x4b')]){_0x167e8b[_0xd973('0x4c')]=[{'all':!![]}];}_0x167e8b=_['merge']({},_0x167e8b,_0x45368e['options']);return db['CmHopper'][_0xd973('0x53')](_0x167e8b)[_0xd973('0x1e')](handleEntityNotFound(_0x3c2a70,null))[_0xd973('0x1e')](respondWithResult(_0x3c2a70,null))[_0xd973('0x4e')](handleError(_0x3c2a70,null));};exports[_0xd973('0x54')]=function(_0x1338b6,_0x127c17){return db[_0xd973('0x24')][_0xd973('0x54')](_0x1338b6[_0xd973('0x55')],{})[_0xd973('0x1e')](respondWithResult(_0x127c17,0xc9))[_0xd973('0x4e')](handleError(_0x127c17,null));};exports[_0xd973('0x1c')]=function(_0x1c9214,_0x9d6463){if(_0x1c9214[_0xd973('0x55')]['id']){delete _0x1c9214[_0xd973('0x55')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x1c9214['params']['id']}})['then'](handleEntityNotFound(_0x9d6463,null))[_0xd973('0x1e')](saveUpdates(_0x1c9214[_0xd973('0x55')],null))[_0xd973('0x1e')](respondWithResult(_0x9d6463,null))[_0xd973('0x4e')](handleError(_0x9d6463,null));};exports[_0xd973('0x56')]=function(_0x5af658,_0x264585){return db[_0xd973('0x24')][_0xd973('0x56')]()[_0xd973('0x1e')](respondWithResult(_0x264585,null))['catch'](handleError(_0x264585,null));};exports['destroy']=function(_0x54525f,_0x5f81e7){var _0x250331;return db[_0xd973('0x24')][_0xd973('0x53')]({'where':{'id':_0x54525f['params']['id']}})[_0xd973('0x1e')](handleEntityNotFound(_0x5f81e7,null))['then'](function(_0x321dbc){if(_0x321dbc){return _0x321dbc[_0xd973('0x1d')]()[_0xd973('0x1e')](function(_0x1d3687){return _0x1d3687;});}})[_0xd973('0x1e')](function(_0x22767f){_0x250331=_0x22767f;if(_0x22767f){if(_0x22767f[_0xd973('0x57')]||_0x22767f[_0xd973('0x58')]){return db[_0x22767f[_0xd973('0x57')]?_0xd973('0x59'):_0xd973('0x5a')][_0xd973('0x53')]({'where':{'id':_0x22767f[_0xd973('0x57')]?_0x22767f[_0xd973('0x57')]:_0x22767f[_0xd973('0x58')]},'attributes':['id','name'],'raw':!![]});}}})[_0xd973('0x1e')](function(_0x830e){var _0x172e4a={};if(_0x830e){_['merge'](_0x172e4a,_[_0xd973('0x5b')](_0x250331[_0xd973('0x5c')],[_0xd973('0x5d'),_0xd973('0x5e'),'id']));_0x172e4a[_0xd973('0x5f')]=0x15;_0x172e4a[_0xd973('0x60')]=_0xd973('0x61');_0x172e4a['campaign']=_0x830e[_0xd973('0x21')];_0x172e4a[_0xd973('0x62')]=_0x54525f['user'][_0xd973('0x21')];_0x172e4a[_0xd973('0x63')]=_0x54525f[_0xd973('0x64')]['id'];_0x172e4a['deleted']=!![];_0x172e4a[_0xd973('0x65')]=moment()[_0xd973('0x66')]('YYYY-MM-DD\x20HH:mm:ss');_0x172e4a[_0xd973('0x67')]=_0x250331[_0xd973('0x68')];_0x172e4a['campaigntype']=_0x250331['VoiceQueueId']?_0xd973('0x69'):_0xd973('0x6a');return db['CmContact'][_0xd973('0x53')]({'where':{'id':_0x172e4a[_0xd973('0x6b')]},'attributes':['firstName',_0xd973('0x6c')]})[_0xd973('0x1e')](function(_0x2fb6e6){if(!_['isNil'](_0x5f81e7)&&!_[_0xd973('0x6d')](_0x2fb6e6[_0xd973('0x6e')])){_0x172e4a[_0xd973('0x6f')]=_0x2fb6e6[_0xd973('0x6e')];if(!_['isNil'](_0x2fb6e6['lastName'])){_0x172e4a[_0xd973('0x6f')]+='\x20'+_0x2fb6e6[_0xd973('0x6c')];}}})[_0xd973('0x70')](function(){return db[_0xd973('0x71')][_0xd973('0x54')](_0x172e4a);});}})[_0xd973('0x1e')](function(){return _0x5f81e7[_0xd973('0x15')](0xcc)[_0xd973('0x14')]();})[_0xd973('0x4e')](handleError(_0x5f81e7,null));};exports[_0xd973('0x72')]=function(_0x1ce75a,_0x3a2454,_0x84d201){var _0x502bac=[];return db[_0xd973('0x73')]['describe']()[_0xd973('0x1e')](function(_0x31f09e){_0x502bac=_['keys'](_0x31f09e);return _0x1ce75a[_0xd973('0x64')][_0xd973('0x74')]({'where':{'type':_0xd973('0x75'),'dialActive':!![],'dialMethod':_0xd973('0x76')},'attributes':['id',_0xd973('0x77')],'raw':!![]});})[_0xd973('0x1e')](function(_0x5a4f27){if(_0x5a4f27&&_0x5a4f27['length']){return db['sequelize']['transaction'](function(_0xd0a997){var _0xa1e76f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xd973('0x66')](_0xd973('0x78'))},'VoiceQueueId':{'$in':_[_0xd973('0x46')](_0x5a4f27,'id')},'$or':[{'UserId':null},{'UserId':_0x1ce75a[_0xd973('0x64')]['id']}]};var _0x5d671b=[];if(_0x1ce75a[_0xd973('0x55')][_0xd973('0x79')]&&_0x1ce75a[_0xd973('0x55')][_0xd973('0x79')]===_0xd973('0x7a')){if(!_['isEmpty'](_0x1ce75a[_0xd973('0x55')]['hopperIds'])){_0xa1e76f['id']={'$in':_0x1ce75a[_0xd973('0x55')][_0xd973('0x7b')]};}_0x5d671b=[[_0xd973('0x7c'),_0xd973('0x7d')],[_0xd973('0x7e'),_0x5a4f27[0x0][_0xd973('0x77')]===_0xd973('0x7d')?_0xd973('0x7f'):_0xd973('0x7d')],db[_0xd973('0x80')][_0xd973('0x81')](_0xd973('0x82')),['id','DESC']];}else{if(!_[_0xd973('0x83')](_0x1ce75a[_0xd973('0x55')][_0xd973('0x7b')])){_0xa1e76f['id']={'$notIn':_0x1ce75a['body'][_0xd973('0x7b')]};}_0x5d671b=[[_0xd973('0x7c'),'DESC'],[_0xd973('0x7e'),_0x5a4f27[0x0][_0xd973('0x77')]],db[_0xd973('0x80')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db[_0xd973('0x24')]['findOne']({'attributes':['id',_0xd973('0x84')],'where':_0xa1e76f,'order':_0x5d671b,'transaction':_0xd0a997,'lock':_0xd0a997[_0xd973('0x85')][_0xd973('0x86')],'include':[{'model':db[_0xd973('0x73')],'as':'Contact','attributes':_0x502bac,'include':[{'model':db['CmCompany'],'as':_0xd973('0x87'),'attributes':['id',_0xd973('0x21')]}]},{'model':db[_0xd973('0x88')],'as':_0xd973('0x89'),'attributes':['id','name']},{'model':db[_0xd973('0x59')],'as':_0xd973('0x8a'),'attributes':['id',_0xd973('0x21'),_0xd973('0x8b')]}]})[_0xd973('0x1e')](function(_0x19d34c){if(_0x19d34c){return _0x19d34c[_0xd973('0x1c')]({'UserId':_0x1ce75a['user']['id']},{'transaction':_0xd0a997});}});});}})['then'](handleEntityNotFound(_0x3a2454,null))[_0xd973('0x1e')](respondWithResult(_0x3a2454,null))[_0xd973('0x4e')](handleError(_0x3a2454,null));};exports[_0xd973('0x8c')]=function(_0x4e81f0,_0x3aff35,_0x5cd8c4){return _0x4e81f0[_0xd973('0x64')][_0xd973('0x74')]({'where':{'type':_0xd973('0x75'),'dialActive':!![],'dialMethod':_0xd973('0x76')},'attributes':['id'],'raw':!![]})['then'](function(_0x163416){if(_0x163416&&_0x163416[_0xd973('0x3e')]){return db[_0xd973('0x24')][_0xd973('0x4a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xd973('0x78'))},'VoiceQueueId':{'$in':_['map'](_0x163416,'id')},'$or':[{'UserId':null},{'UserId':_0x4e81f0['user']['id']}]}});}return 0x0;})[_0xd973('0x1e')](function(_0x46ecd8){if(!_['isNil'](_0x46ecd8)&&_[_0xd973('0x8d')](_0x46ecd8)){return _0x3aff35['status'](0xc8)[_0xd973('0x16')]({'contacts':_0x46ecd8});}else{logger[_0xd973('0x8e')](_0xd973('0x8f'),_0xd973('0x8c'),0x194,_0xd973('0x90'));_0x3aff35[_0xd973('0x1f')](0x194);}})[_0xd973('0x4e')](handleError(_0x3aff35,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 5b26fc9..aa395f9 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 _0x2e82=['cm_hopper','scheduledat','phone','priority','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','define'];(function(_0x39b604,_0x44fde7){var _0x3fc4bc=function(_0x26a8b2){while(--_0x26a8b2){_0x39b604['push'](_0x39b604['shift']());}};_0x3fc4bc(++_0x44fde7);}(_0x2e82,0x148));var _0x22e8=function(_0x187d27,_0x3cc2df){_0x187d27=_0x187d27-0x0;var _0x564efb=_0x2e82[_0x187d27];return _0x564efb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x22e8('0x0'))('api');var moment=require(_0x22e8('0x1'));var BPromise=require(_0x22e8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x22e8('0x3'));var rimraf=require(_0x22e8('0x4'));var config=require(_0x22e8('0x5'));var attributes=require(_0x22e8('0x6'));module['exports']=function(_0x1dbbdf,_0x53b683){return _0x1dbbdf[_0x22e8('0x7')]('CmHopper',attributes,{'tableName':_0x22e8('0x8'),'paranoid':![],'indexes':[{'name':_0x22e8('0x9'),'fields':['scheduledat']},{'name':'phone','fields':[_0x22e8('0xa')]},{'name':_0x22e8('0xb'),'fields':[_0x22e8('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1552=['phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopper','scheduledat'];(function(_0x30e189,_0x16c631){var _0x379ae4=function(_0x4df9fc){while(--_0x4df9fc){_0x30e189['push'](_0x30e189['shift']());}};_0x379ae4(++_0x16c631);}(_0x1552,0x1f2));var _0x2155=function(_0x25fc41,_0x250864){_0x25fc41=_0x25fc41-0x0;var _0x1371d1=_0x1552[_0x25fc41];return _0x1371d1;};'use strict';var _=require(_0x2155('0x0'));var util=require(_0x2155('0x1'));var logger=require(_0x2155('0x2'))(_0x2155('0x3'));var moment=require(_0x2155('0x4'));var BPromise=require(_0x2155('0x5'));var rp=require(_0x2155('0x6'));var fs=require('fs');var path=require(_0x2155('0x7'));var rimraf=require(_0x2155('0x8'));var config=require(_0x2155('0x9'));var attributes=require('./cmHopper.attributes');module[_0x2155('0xa')]=function(_0x30b6b4,_0x3dab7c){return _0x30b6b4[_0x2155('0xb')](_0x2155('0xc'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x2155('0xd'),'fields':[_0x2155('0xd')]},{'name':_0x2155('0xe'),'fields':[_0x2155('0xe')]},{'name':_0x2155('0xf'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 1d3a213..abc4b37 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 _0x36b7=['error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','ShowCmHopper','find','then','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','voicePause','length','includes','UserId','push','all','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x75f951,_0x3f3d23){var _0x46e70d=function(_0xc22f8d){while(--_0xc22f8d){_0x75f951['push'](_0x75f951['shift']());}};_0x46e70d(++_0x3f3d23);}(_0x36b7,0x1a0));var _0x736b=function(_0x222213,_0x193248){_0x222213=_0x222213-0x0;var _0x2bb845=_0x36b7[_0x222213];return _0x2bb845;};'use strict';var _=require(_0x736b('0x0'));var util=require(_0x736b('0x1'));var moment=require('moment');var BPromise=require(_0x736b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x736b('0x3'));var db=require(_0x736b('0x4'))['db'];var utils=require(_0x736b('0x5'));var logger=require(_0x736b('0x6'))(_0x736b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x736b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b2cb4,_0x5277f1,_0x1597a7){return new BPromise(function(_0x90d09c,_0x98fdd6){return client[_0x736b('0x9')](_0x4b2cb4,_0x1597a7)['then'](function(_0x2a5e46){logger[_0x736b('0xa')](_0x736b('0xb'),_0x5277f1,'request\x20sent');logger[_0x736b('0xc')](_0x736b('0xd'),_0x5277f1,_0x736b('0xe'),JSON[_0x736b('0xf')](_0x2a5e46));if(_0x2a5e46['error']){if(_0x2a5e46[_0x736b('0x10')][_0x736b('0x11')]===0x1f4){logger[_0x736b('0x10')](_0x736b('0xb'),_0x5277f1,_0x2a5e46[_0x736b('0x10')][_0x736b('0x12')]);return _0x98fdd6(_0x2a5e46[_0x736b('0x10')][_0x736b('0x12')]);}logger[_0x736b('0x10')](_0x736b('0xb'),_0x5277f1,_0x2a5e46[_0x736b('0x10')][_0x736b('0x12')]);return _0x90d09c(_0x2a5e46[_0x736b('0x10')][_0x736b('0x12')]);}else{logger[_0x736b('0xa')](_0x736b('0xb'),_0x5277f1,_0x736b('0xe'));_0x90d09c(_0x2a5e46[_0x736b('0x13')][_0x736b('0x12')]);}})[_0x736b('0x14')](function(_0x3f62a9){logger[_0x736b('0x10')](_0x736b('0xb'),_0x5277f1,_0x3f62a9);_0x98fdd6(_0x3f62a9);});});}exports[_0x736b('0x15')]=function(_0x4b29e6){var _0x40bef7=this;return new Promise(function(_0x1f2ac0,_0x5ef800){return db[_0x736b('0x16')][_0x736b('0x17')]({'raw':_0x4b29e6[_0x736b('0x18')]?_0x4b29e6[_0x736b('0x18')][_0x736b('0x19')]===undefined?!![]:![]:!![],'where':_0x4b29e6[_0x736b('0x18')]?_0x4b29e6[_0x736b('0x18')][_0x736b('0x1a')]||null:null,'attributes':_0x4b29e6['options']?_0x4b29e6[_0x736b('0x18')][_0x736b('0x1b')]||null:null,'limit':_0x4b29e6['options']?_0x4b29e6[_0x736b('0x18')][_0x736b('0x1c')]||null:null,'include':_0x4b29e6[_0x736b('0x18')]?_0x4b29e6[_0x736b('0x18')][_0x736b('0x1d')]?_[_0x736b('0x1e')](_0x4b29e6['options'][_0x736b('0x1d')],function(_0x37866f){return{'model':db[_0x37866f[_0x736b('0x1f')]],'as':_0x37866f['as'],'attributes':_0x37866f[_0x736b('0x1b')],'include':_0x37866f[_0x736b('0x1d')]?_['map'](_0x37866f[_0x736b('0x1d')],function(_0x4051b0){return{'model':db[_0x4051b0[_0x736b('0x1f')]],'as':_0x4051b0['as'],'attributes':_0x4051b0[_0x736b('0x1b')],'include':_0x4051b0[_0x736b('0x1d')]?_[_0x736b('0x1e')](_0x4051b0[_0x736b('0x1d')],function(_0x21e611){return{'model':db[_0x21e611[_0x736b('0x1f')]],'as':_0x21e611['as'],'attributes':_0x21e611[_0x736b('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf3bb66){logger[_0x736b('0xa')](_0x736b('0x15'),_0x4b29e6);logger[_0x736b('0xc')](_0x736b('0x15'),_0x4b29e6,JSON[_0x736b('0xf')](_0xf3bb66));_0x1f2ac0(_0xf3bb66);})[_0x736b('0x14')](function(_0x38e77f){logger[_0x736b('0x10')](_0x736b('0x15'),_0x38e77f[_0x736b('0x12')],_0x4b29e6);_0x5ef800(_0x40bef7[_0x736b('0x10')](0x1f4,_0x38e77f[_0x736b('0x12')]));});});};exports[_0x736b('0x20')]=function(_0x342bbb){var _0x417f58=this;return new Promise(function(_0x5c2cb9,_0x2402d0){return db[_0x736b('0x16')][_0x736b('0x21')]({'raw':_0x342bbb['options']?_0x342bbb[_0x736b('0x18')][_0x736b('0x19')]===undefined?!![]:![]:!![],'where':_0x342bbb[_0x736b('0x18')]?_0x342bbb['options'][_0x736b('0x1a')]||null:null,'attributes':_0x342bbb[_0x736b('0x18')]?_0x342bbb[_0x736b('0x18')][_0x736b('0x1b')]||null:null,'include':_0x342bbb[_0x736b('0x18')]?_0x342bbb[_0x736b('0x18')][_0x736b('0x1d')]?_[_0x736b('0x1e')](_0x342bbb[_0x736b('0x18')][_0x736b('0x1d')],function(_0x37c3bd){return{'model':db[_0x37c3bd[_0x736b('0x1f')]],'as':_0x37c3bd['as'],'attributes':_0x37c3bd[_0x736b('0x1b')],'include':_0x37c3bd['include']?_['map'](_0x37c3bd[_0x736b('0x1d')],function(_0x1059d3){return{'model':db[_0x1059d3[_0x736b('0x1f')]],'as':_0x1059d3['as'],'attributes':_0x1059d3[_0x736b('0x1b')],'include':_0x1059d3[_0x736b('0x1d')]?_[_0x736b('0x1e')](_0x1059d3['include'],function(_0x51344b){return{'model':db[_0x51344b[_0x736b('0x1f')]],'as':_0x51344b['as'],'attributes':_0x51344b['attributes']};}):[]};}):[]};}):[]:[]})[_0x736b('0x22')](function(_0x531a75){logger[_0x736b('0xa')](_0x736b('0x20'),_0x342bbb);logger[_0x736b('0xc')]('ShowCmHopper',_0x342bbb,JSON[_0x736b('0xf')](_0x531a75));_0x5c2cb9(_0x531a75);})['catch'](function(_0x356819){logger[_0x736b('0x10')](_0x736b('0x20'),_0x356819[_0x736b('0x12')],_0x342bbb);_0x2402d0(_0x417f58[_0x736b('0x10')](0x1f4,_0x356819[_0x736b('0x12')]));});});};exports[_0x736b('0x23')]=function(_0x1c6088){var _0xbd956c=this;return new Promise(function(_0xb901c2,_0x181760){return db[_0x736b('0x16')][_0x736b('0x24')](_0x1c6088[_0x736b('0x25')],{'raw':_0x1c6088[_0x736b('0x18')]?_0x1c6088['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x42f820){logger[_0x736b('0xa')]('CreateCmHopper',_0x1c6088);logger[_0x736b('0xc')](_0x736b('0x23'),_0x1c6088,JSON['stringify'](_0x42f820));_0xb901c2(_0x42f820);})[_0x736b('0x14')](function(_0x10c5f7){logger['error'](_0x736b('0x23'),_0x10c5f7['message'],_0x1c6088);_0x181760(_0xbd956c[_0x736b('0x10')](0x1f4,_0x10c5f7['message']));});});};exports[_0x736b('0x26')]=function(_0x101b1f){var _0x2f8f6c=this;return new Promise(function(_0x1a4899,_0x438992){return db[_0x736b('0x16')][_0x736b('0x27')](_0x101b1f[_0x736b('0x25')],{'raw':_0x101b1f[_0x736b('0x18')]?_0x101b1f[_0x736b('0x18')][_0x736b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x101b1f[_0x736b('0x18')]?_0x101b1f['options'][_0x736b('0x1a')]||null:null,'attributes':_0x101b1f[_0x736b('0x18')]?_0x101b1f[_0x736b('0x18')][_0x736b('0x1b')]||null:null,'limit':_0x101b1f[_0x736b('0x18')]?_0x101b1f[_0x736b('0x18')]['limit']||null:null})[_0x736b('0x22')](function(_0x2947de){logger[_0x736b('0xa')](_0x736b('0x26'),_0x101b1f);logger['debug']('UpdateCmHopper',_0x101b1f,JSON['stringify'](_0x2947de));_0x1a4899(_0x2947de);})[_0x736b('0x14')](function(_0x52c248){logger[_0x736b('0x10')](_0x736b('0x26'),_0x52c248[_0x736b('0x12')],_0x101b1f);_0x438992(_0x2f8f6c[_0x736b('0x10')](0x1f4,_0x52c248[_0x736b('0x12')]));});});};exports[_0x736b('0x28')]=function(_0x41495b){var _0x147db1=this;return new Promise(function(_0x3b0598,_0x2f8a95){return db[_0x736b('0x16')][_0x736b('0x29')]({'where':_0x41495b[_0x736b('0x18')]?_0x41495b[_0x736b('0x18')][_0x736b('0x1a')]||null:null})[_0x736b('0x22')](function(_0x21ebcc){logger[_0x736b('0xa')](_0x736b('0x28'),_0x41495b);logger[_0x736b('0xc')]('DestroyCmHopper',_0x41495b,JSON[_0x736b('0xf')](_0x21ebcc));_0x3b0598(_0x21ebcc);})[_0x736b('0x14')](function(_0x6f3c89){logger[_0x736b('0x10')](_0x736b('0x28'),_0x6f3c89[_0x736b('0x12')],_0x41495b);_0x2f8a95(_0x147db1[_0x736b('0x10')](0x1f4,_0x6f3c89[_0x736b('0x12')]));});});};exports[_0x736b('0x2a')]=function(_0x237b51){var _0x808537=this;return new Promise(function(_0x126e44,_0x191ef1){return db[_0x736b('0x2b')][_0x736b('0x2c')]()[_0x736b('0x22')](function(_0xaacba2){return db[_0x736b('0x2d')][_0x736b('0x2e')](function(_0x2f1fbc){return db[_0x736b('0x16')][_0x736b('0x17')]({'where':_0x237b51[_0x736b('0x18')]?_0x237b51[_0x736b('0x18')]['where']||null:null,'attributes':_0x237b51['options']?_0x237b51['options']['attributes']||null:null,'limit':_0x237b51[_0x736b('0x18')]?_0x237b51[_0x736b('0x18')]['limit']||null:null,'order':_0x237b51[_0x736b('0x18')]?_0x237b51[_0x736b('0x18')][_0x736b('0x2f')]||null:null,'transaction':_0x2f1fbc,'lock':_0x2f1fbc[_0x736b('0x30')][_0x736b('0x31')],'include':[{'model':db[_0x736b('0x2b')],'as':_0x736b('0x32'),'attributes':_[_0x736b('0x33')](_0xaacba2)},{'model':db[_0x736b('0x34')],'as':_0x736b('0x35'),'attributes':['id','name',_0x736b('0x36')]}]})[_0x736b('0x22')](function(_0x2a6063){var _0x5632aa=[];var _0x3be527=[];for(var _0xcefdc0=0x0;_0xcefdc0<_0x2a6063[_0x736b('0x37')];_0xcefdc0+=0x1){if(!_0x3be527[_0x736b('0x38')](_0x2a6063[_0xcefdc0][_0x736b('0x39')])){_0x3be527[_0x736b('0x3a')](_0x2a6063[_0xcefdc0][_0x736b('0x39')]);_0x5632aa[_0x736b('0x3a')](_0x2a6063[_0xcefdc0]['update'](_0x237b51[_0x736b('0x25')],{'transaction':_0x2f1fbc}));}}return BPromise[_0x736b('0x3b')](_0x5632aa);});})['then'](function(_0x2f750b){logger[_0x736b('0xa')](_0x736b('0x2a'),_0x237b51);logger['debug'](_0x736b('0x2a'),_0x237b51,JSON['stringify'](_0x2f750b));_0x126e44(_0x2f750b);})[_0x736b('0x14')](function(_0x1dd65c){logger[_0x736b('0x10')](_0x736b('0x2a'),_0x1dd65c[_0x736b('0x12')],_0x237b51);_0x191ef1(_0x808537[_0x736b('0x10')](0x1f4,_0x1dd65c[_0x736b('0x12')]));});});});};exports[_0x736b('0x3c')]=function(_0x4478fa){var _0xb251b2=this;return new Promise(function(_0x205b64,_0x3b12){return db[_0x736b('0x2d')][_0x736b('0x2e')](function(_0x4df0d0){return db[_0x736b('0x3d')][_0x736b('0x24')](_0x4478fa[_0x736b('0x25')],{'raw':_0x4478fa[_0x736b('0x18')]?_0x4478fa['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x4df0d0})[_0x736b('0x22')](function(){return db['CmHopper'][_0x736b('0x29')]({'where':_0x4478fa[_0x736b('0x18')]?_0x4478fa[_0x736b('0x18')][_0x736b('0x1a')]||null:null,'transaction':_0x4df0d0});});})[_0x736b('0x22')](function(_0x44d0b3){logger[_0x736b('0xa')](_0x736b('0x3c'),_0x4478fa);logger[_0x736b('0xc')]('MoveContactManagedDialer',_0x4478fa,JSON[_0x736b('0xf')](_0x44d0b3));_0x205b64(_0x44d0b3);})[_0x736b('0x14')](function(_0x28c3f1){logger[_0x736b('0x10')](_0x736b('0x3c'),_0x28c3f1[_0x736b('0x12')],_0x4478fa);_0x3b12(_0xb251b2[_0x736b('0x10')](0x1f4,_0x28c3f1['message']));});});};exports[_0x736b('0x3e')]=function(_0xe45a10){var _0x328814=this;return new Promise(function(_0x5e97f9,_0x190ab7){return db[_0x736b('0x16')]['findAll']({'raw':_0xe45a10[_0x736b('0x18')]?_0xe45a10[_0x736b('0x18')][_0x736b('0x19')]===undefined?!![]:![]:!![],'where':_0xe45a10['options']?_0xe45a10['options']['where']||null:null,'attributes':[[db[_0x736b('0x2d')]['fn'](_0x736b('0x3f'),db[_0x736b('0x2d')]['fn']('IF',db[_0x736b('0x2d')][_0x736b('0x40')](_0x736b('0x41')+util[_0x736b('0x42')](_0x736b('0x43'),moment()[_0x736b('0x42')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x736b('0x44')))),_0x736b('0x45')]]})['then'](function(_0x4e05a4){logger[_0x736b('0xa')](_0x736b('0x3e'),_0xe45a10);logger[_0x736b('0xc')]('CountReScheduled',_0xe45a10,JSON['stringify'](_0x4e05a4));_0x5e97f9(_0x4e05a4);})[_0x736b('0x14')](function(_0x5f4165){logger[_0x736b('0x10')](_0x736b('0x3e'),_0x5f4165[_0x736b('0x12')],_0xe45a10);_0x190ab7(_0x328814[_0x736b('0x10')](0x1f4,_0x5f4165[_0x736b('0x12')]));});});};exports[_0x736b('0x46')]=function(_0x14784e){var _0x52c329=this;return new Promise(function(_0x5e82d1,_0x8469d){return db[_0x736b('0x2b')][_0x736b('0x2c')]()[_0x736b('0x22')](function(_0x4c73b8){return db[_0x736b('0x2d')][_0x736b('0x2e')](function(_0x25ffd9){return db[_0x736b('0x16')][_0x736b('0x17')]({'where':_0x14784e[_0x736b('0x18')]?_0x14784e['options']['where']||null:null,'attributes':_0x14784e[_0x736b('0x18')]?_0x14784e[_0x736b('0x18')][_0x736b('0x1b')]||null:null,'limit':0x1,'order':_0x14784e[_0x736b('0x18')]?_0x14784e[_0x736b('0x18')][_0x736b('0x2f')]||null:null,'group':db[_0x736b('0x16')]['UserId'],'transaction':_0x25ffd9,'lock':_0x25ffd9[_0x736b('0x30')][_0x736b('0x31')],'include':_0x14784e[_0x736b('0x18')]?_0x14784e[_0x736b('0x18')][_0x736b('0x1d')]?_['map'](_0x14784e[_0x736b('0x18')][_0x736b('0x1d')],function(_0x5807ff){return{'model':db[_0x5807ff[_0x736b('0x1f')]],'as':_0x5807ff['as'],'attributes':_0x5807ff[_0x736b('0x1b')],'include':_0x5807ff[_0x736b('0x1d')]?_['map'](_0x5807ff[_0x736b('0x1d')],function(_0x3cda2a){return{'model':db[_0x3cda2a[_0x736b('0x1f')]],'as':_0x3cda2a['as'],'attributes':_0x3cda2a[_0x736b('0x1b')],'include':_0x3cda2a[_0x736b('0x1d')]?_[_0x736b('0x1e')](_0x3cda2a['include'],function(_0x1e483c){return{'model':db[_0x1e483c['model']],'as':_0x1e483c['as'],'attributes':_0x1e483c[_0x736b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x736b('0x22')](function(_0xd075c5){var _0x5c2595=[];for(var _0x2db0d8=0x0;_0x2db0d8<_0xd075c5['length'];_0x2db0d8+=0x1){_0x5c2595[_0x736b('0x3a')](_0xd075c5[_0x2db0d8][_0x736b('0x27')](_0x14784e[_0x736b('0x25')],{'transaction':_0x25ffd9}));}return BPromise[_0x736b('0x3b')](_0x5c2595);});})[_0x736b('0x22')](function(_0xcbbc57){logger['info'](_0x736b('0x46'),_0x14784e);logger[_0x736b('0xc')](_0x736b('0x46'),_0x14784e,JSON['stringify'](_0xcbbc57));_0x5e82d1(_0xcbbc57);})[_0x736b('0x14')](function(_0x574754){logger[_0x736b('0x10')](_0x736b('0x46'),_0x574754[_0x736b('0x12')],_0x14784e);_0x8469d(_0x52c329['error'](0x1f4,_0x574754[_0x736b('0x12')]));});});});};exports[_0x736b('0x47')]=function(_0x2d3d1c){var _0x4cf6e6=this;return new Promise(function(_0x2ef9dc,_0x186ba4){db[_0x736b('0x2b')]['describe']()[_0x736b('0x22')](function(_0x377b3c){return db[_0x736b('0x16')][_0x736b('0x17')]({'raw':_0x2d3d1c['options']?_0x2d3d1c[_0x736b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2d3d1c[_0x736b('0x18')]?_0x2d3d1c[_0x736b('0x18')][_0x736b('0x1a')]||null:null,'attributes':_0x2d3d1c[_0x736b('0x18')]?_0x2d3d1c[_0x736b('0x18')][_0x736b('0x1b')]||null:null,'limit':_0x2d3d1c[_0x736b('0x18')]?_0x2d3d1c['options'][_0x736b('0x1c')]||null:null,'include':_0x2d3d1c['options']?_0x2d3d1c[_0x736b('0x18')][_0x736b('0x1d')]?_[_0x736b('0x1e')](_0x2d3d1c[_0x736b('0x18')]['include'],function(_0x398b16){return{'model':db[_0x398b16[_0x736b('0x1f')]],'as':_0x398b16['as'],'attributes':_0x398b16['as']==='Contact'?_[_0x736b('0x33')](_0x377b3c):_0x398b16[_0x736b('0x1b')],'include':_0x398b16[_0x736b('0x1d')]?_[_0x736b('0x1e')](_0x398b16['include'],function(_0x472155){return{'model':db[_0x472155[_0x736b('0x1f')]],'as':_0x472155['as'],'attributes':_0x472155[_0x736b('0x1b')],'include':_0x472155[_0x736b('0x1d')]?_[_0x736b('0x1e')](_0x472155['include'],function(_0x5ae47e){return{'model':db[_0x5ae47e[_0x736b('0x1f')]],'as':_0x5ae47e['as'],'attributes':_0x5ae47e[_0x736b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x736b('0x22')](function(_0x416886){logger['info'](_0x736b('0x15'),_0x2d3d1c);logger[_0x736b('0xc')](_0x736b('0x15'),_0x2d3d1c,JSON['stringify'](_0x416886));_0x2ef9dc(_0x416886);})[_0x736b('0x14')](function(_0x4151b5){logger[_0x736b('0x10')]('GetCmHopper',_0x4151b5[_0x736b('0x12')],_0x2d3d1c);_0x186ba4(_0x4cf6e6['error'](0x1f4,_0x4151b5[_0x736b('0x12')]));});});});}; \ No newline at end of file +var _0x44e8=['raw','where','attributes','limit','include','model','map','GetCmHopper','ShowCmHopper','find','CreateCmHopper','UpdateCmHopper','body','DestroyCmHopper','destroy','describe','transaction','findAll','order','LOCK','UPDATE','Contact','User','Agent','name','voicePause','UserId','push','update','GetContactDialer','sequelize','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','CmContact','all','GetCmHopperPreview','keys','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','code','error','CmHopper,\x20%s,\x20%s','message','catch','CmHopper','options'];(function(_0x1604eb,_0x298456){var _0x2c2583=function(_0x22c80a){while(--_0x22c80a){_0x1604eb['push'](_0x1604eb['shift']());}};_0x2c2583(++_0x298456);}(_0x44e8,0x1bf));var _0x844e=function(_0x36b05b,_0x3d66ad){_0x36b05b=_0x36b05b-0x0;var _0x7e4d60=_0x44e8[_0x36b05b];return _0x7e4d60;};'use strict';var _=require(_0x844e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x844e('0x1'));var fs=require('fs');var Redis=require(_0x844e('0x2'));var db=require(_0x844e('0x3'))['db'];var utils=require(_0x844e('0x4'));var logger=require('../../config/logger')(_0x844e('0x5'));var config=require('../../config/environment');var jayson=require(_0x844e('0x6'));var client=jayson['client'][_0x844e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2f70b8,_0x16c2f2,_0x386e8a){return new BPromise(function(_0x339592,_0x18f7c9){return client[_0x844e('0x8')](_0x2f70b8,_0x386e8a)[_0x844e('0x9')](function(_0x3ea7d6){logger[_0x844e('0xa')]('CmHopper,\x20%s,\x20%s',_0x16c2f2,_0x844e('0xb'));logger[_0x844e('0xc')](_0x844e('0xd'),_0x16c2f2,_0x844e('0xb'),JSON[_0x844e('0xe')](_0x3ea7d6));if(_0x3ea7d6['error']){if(_0x3ea7d6['error'][_0x844e('0xf')]===0x1f4){logger[_0x844e('0x10')](_0x844e('0x11'),_0x16c2f2,_0x3ea7d6[_0x844e('0x10')][_0x844e('0x12')]);return _0x18f7c9(_0x3ea7d6[_0x844e('0x10')][_0x844e('0x12')]);}logger[_0x844e('0x10')](_0x844e('0x11'),_0x16c2f2,_0x3ea7d6[_0x844e('0x10')]['message']);return _0x339592(_0x3ea7d6['error'][_0x844e('0x12')]);}else{logger[_0x844e('0xa')]('CmHopper,\x20%s,\x20%s',_0x16c2f2,'request\x20sent');_0x339592(_0x3ea7d6['result'][_0x844e('0x12')]);}})[_0x844e('0x13')](function(_0x14c084){logger[_0x844e('0x10')](_0x844e('0x11'),_0x16c2f2,_0x14c084);_0x18f7c9(_0x14c084);});});}exports['GetCmHopper']=function(_0x1de049){var _0x2fecad=this;return new Promise(function(_0xf84ba8,_0x28f7ac){return db[_0x844e('0x14')]['findAll']({'raw':_0x1de049[_0x844e('0x15')]?_0x1de049[_0x844e('0x15')][_0x844e('0x16')]===undefined?!![]:![]:!![],'where':_0x1de049[_0x844e('0x15')]?_0x1de049[_0x844e('0x15')][_0x844e('0x17')]||null:null,'attributes':_0x1de049[_0x844e('0x15')]?_0x1de049[_0x844e('0x15')][_0x844e('0x18')]||null:null,'limit':_0x1de049[_0x844e('0x15')]?_0x1de049[_0x844e('0x15')][_0x844e('0x19')]||null:null,'include':_0x1de049[_0x844e('0x15')]?_0x1de049[_0x844e('0x15')][_0x844e('0x1a')]?_['map'](_0x1de049[_0x844e('0x15')][_0x844e('0x1a')],function(_0x499563){return{'model':db[_0x499563[_0x844e('0x1b')]],'as':_0x499563['as'],'attributes':_0x499563[_0x844e('0x18')],'include':_0x499563[_0x844e('0x1a')]?_['map'](_0x499563[_0x844e('0x1a')],function(_0x5a5490){return{'model':db[_0x5a5490[_0x844e('0x1b')]],'as':_0x5a5490['as'],'attributes':_0x5a5490[_0x844e('0x18')],'include':_0x5a5490['include']?_[_0x844e('0x1c')](_0x5a5490[_0x844e('0x1a')],function(_0x222bee){return{'model':db[_0x222bee[_0x844e('0x1b')]],'as':_0x222bee['as'],'attributes':_0x222bee['attributes']};}):[]};}):[]};}):[]:[]})[_0x844e('0x9')](function(_0x2348ed){logger['info'](_0x844e('0x1d'),_0x1de049);logger[_0x844e('0xc')]('GetCmHopper',_0x1de049,JSON[_0x844e('0xe')](_0x2348ed));_0xf84ba8(_0x2348ed);})[_0x844e('0x13')](function(_0x5d30d0){logger[_0x844e('0x10')](_0x844e('0x1d'),_0x5d30d0['message'],_0x1de049);_0x28f7ac(_0x2fecad[_0x844e('0x10')](0x1f4,_0x5d30d0[_0x844e('0x12')]));});});};exports[_0x844e('0x1e')]=function(_0x21da33){var _0x125c3b=this;return new Promise(function(_0x58057b,_0x156e98){return db[_0x844e('0x14')][_0x844e('0x1f')]({'raw':_0x21da33['options']?_0x21da33[_0x844e('0x15')][_0x844e('0x16')]===undefined?!![]:![]:!![],'where':_0x21da33['options']?_0x21da33['options'][_0x844e('0x17')]||null:null,'attributes':_0x21da33[_0x844e('0x15')]?_0x21da33[_0x844e('0x15')][_0x844e('0x18')]||null:null,'include':_0x21da33['options']?_0x21da33['options'][_0x844e('0x1a')]?_[_0x844e('0x1c')](_0x21da33[_0x844e('0x15')][_0x844e('0x1a')],function(_0x3a8471){return{'model':db[_0x3a8471['model']],'as':_0x3a8471['as'],'attributes':_0x3a8471['attributes'],'include':_0x3a8471[_0x844e('0x1a')]?_[_0x844e('0x1c')](_0x3a8471[_0x844e('0x1a')],function(_0x1b50f2){return{'model':db[_0x1b50f2[_0x844e('0x1b')]],'as':_0x1b50f2['as'],'attributes':_0x1b50f2[_0x844e('0x18')],'include':_0x1b50f2['include']?_[_0x844e('0x1c')](_0x1b50f2['include'],function(_0x11da42){return{'model':db[_0x11da42['model']],'as':_0x11da42['as'],'attributes':_0x11da42[_0x844e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x844e('0x9')](function(_0x1ca1fb){logger[_0x844e('0xa')](_0x844e('0x1e'),_0x21da33);logger['debug']('ShowCmHopper',_0x21da33,JSON[_0x844e('0xe')](_0x1ca1fb));_0x58057b(_0x1ca1fb);})[_0x844e('0x13')](function(_0x2ca5b0){logger[_0x844e('0x10')](_0x844e('0x1e'),_0x2ca5b0[_0x844e('0x12')],_0x21da33);_0x156e98(_0x125c3b[_0x844e('0x10')](0x1f4,_0x2ca5b0['message']));});});};exports['CreateCmHopper']=function(_0x5efc55){var _0x5d6dc3=this;return new Promise(function(_0x1fdeb9,_0x30f178){return db[_0x844e('0x14')]['create'](_0x5efc55['body'],{'raw':_0x5efc55['options']?_0x5efc55[_0x844e('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x844e('0x9')](function(_0x492cc6){logger[_0x844e('0xa')]('CreateCmHopper',_0x5efc55);logger['debug'](_0x844e('0x20'),_0x5efc55,JSON[_0x844e('0xe')](_0x492cc6));_0x1fdeb9(_0x492cc6);})['catch'](function(_0x4069d0){logger[_0x844e('0x10')](_0x844e('0x20'),_0x4069d0[_0x844e('0x12')],_0x5efc55);_0x30f178(_0x5d6dc3['error'](0x1f4,_0x4069d0[_0x844e('0x12')]));});});};exports[_0x844e('0x21')]=function(_0x405ab9){var _0x48aa73=this;return new Promise(function(_0x2c861b,_0x173e45){return db[_0x844e('0x14')]['update'](_0x405ab9[_0x844e('0x22')],{'raw':_0x405ab9[_0x844e('0x15')]?_0x405ab9['options'][_0x844e('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x405ab9[_0x844e('0x15')]?_0x405ab9['options'][_0x844e('0x17')]||null:null,'attributes':_0x405ab9[_0x844e('0x15')]?_0x405ab9[_0x844e('0x15')][_0x844e('0x18')]||null:null,'limit':_0x405ab9['options']?_0x405ab9[_0x844e('0x15')]['limit']||null:null})[_0x844e('0x9')](function(_0x25585b){logger[_0x844e('0xa')](_0x844e('0x21'),_0x405ab9);logger[_0x844e('0xc')]('UpdateCmHopper',_0x405ab9,JSON[_0x844e('0xe')](_0x25585b));_0x2c861b(_0x25585b);})[_0x844e('0x13')](function(_0x52a928){logger[_0x844e('0x10')]('UpdateCmHopper',_0x52a928[_0x844e('0x12')],_0x405ab9);_0x173e45(_0x48aa73[_0x844e('0x10')](0x1f4,_0x52a928[_0x844e('0x12')]));});});};exports[_0x844e('0x23')]=function(_0x3d49f5){var _0x5de50f=this;return new Promise(function(_0x61f58f,_0x549ca){return db[_0x844e('0x14')][_0x844e('0x24')]({'where':_0x3d49f5[_0x844e('0x15')]?_0x3d49f5[_0x844e('0x15')]['where']||null:null})[_0x844e('0x9')](function(_0x1b8ac6){logger[_0x844e('0xa')](_0x844e('0x23'),_0x3d49f5);logger[_0x844e('0xc')](_0x844e('0x23'),_0x3d49f5,JSON['stringify'](_0x1b8ac6));_0x61f58f(_0x1b8ac6);})[_0x844e('0x13')](function(_0x3aea2a){logger[_0x844e('0x10')]('DestroyCmHopper',_0x3aea2a[_0x844e('0x12')],_0x3d49f5);_0x549ca(_0x5de50f[_0x844e('0x10')](0x1f4,_0x3aea2a[_0x844e('0x12')]));});});};exports['GetContactDialer']=function(_0x991ea9){var _0x338457=this;return new Promise(function(_0x4344aa,_0x75ea2c){return db['CmContact'][_0x844e('0x25')]()[_0x844e('0x9')](function(_0x27a340){return db['sequelize'][_0x844e('0x26')](function(_0xbe2066){return db[_0x844e('0x14')][_0x844e('0x27')]({'where':_0x991ea9[_0x844e('0x15')]?_0x991ea9[_0x844e('0x15')][_0x844e('0x17')]||null:null,'attributes':_0x991ea9[_0x844e('0x15')]?_0x991ea9[_0x844e('0x15')][_0x844e('0x18')]||null:null,'limit':_0x991ea9[_0x844e('0x15')]?_0x991ea9[_0x844e('0x15')][_0x844e('0x19')]||null:null,'order':_0x991ea9[_0x844e('0x15')]?_0x991ea9[_0x844e('0x15')][_0x844e('0x28')]||null:null,'transaction':_0xbe2066,'lock':_0xbe2066[_0x844e('0x29')][_0x844e('0x2a')],'include':[{'model':db['CmContact'],'as':_0x844e('0x2b'),'attributes':_['keys'](_0x27a340)},{'model':db[_0x844e('0x2c')],'as':_0x844e('0x2d'),'attributes':['id',_0x844e('0x2e'),_0x844e('0x2f')]}]})[_0x844e('0x9')](function(_0x426ac7){var _0x2e1781=[];var _0x49d4d0=[];for(var _0x14465a=0x0;_0x14465a<_0x426ac7['length'];_0x14465a+=0x1){if(!_0x49d4d0['includes'](_0x426ac7[_0x14465a][_0x844e('0x30')])){_0x49d4d0['push'](_0x426ac7[_0x14465a][_0x844e('0x30')]);_0x2e1781[_0x844e('0x31')](_0x426ac7[_0x14465a][_0x844e('0x32')](_0x991ea9[_0x844e('0x22')],{'transaction':_0xbe2066}));}}return BPromise['all'](_0x2e1781);});})[_0x844e('0x9')](function(_0x4c0068){logger[_0x844e('0xa')]('GetContactDialer',_0x991ea9);logger['debug']('GetContactDialer',_0x991ea9,JSON[_0x844e('0xe')](_0x4c0068));_0x4344aa(_0x4c0068);})['catch'](function(_0x164c70){logger[_0x844e('0x10')](_0x844e('0x33'),_0x164c70[_0x844e('0x12')],_0x991ea9);_0x75ea2c(_0x338457[_0x844e('0x10')](0x1f4,_0x164c70[_0x844e('0x12')]));});});});};exports['MoveContactManagedDialer']=function(_0x4c3dae){var _0x1889b7=this;return new Promise(function(_0x2decaf,_0x252fe3){return db[_0x844e('0x34')][_0x844e('0x26')](function(_0x4af640){return db[_0x844e('0x35')]['create'](_0x4c3dae[_0x844e('0x22')],{'raw':_0x4c3dae[_0x844e('0x15')]?_0x4c3dae['options'][_0x844e('0x16')]===undefined?!![]:![]:!![],'transaction':_0x4af640})[_0x844e('0x9')](function(){return db[_0x844e('0x14')]['destroy']({'where':_0x4c3dae['options']?_0x4c3dae[_0x844e('0x15')][_0x844e('0x17')]||null:null,'transaction':_0x4af640});});})[_0x844e('0x9')](function(_0x6cb2f9){logger[_0x844e('0xa')]('MoveContactManagedDialer',_0x4c3dae);logger[_0x844e('0xc')](_0x844e('0x36'),_0x4c3dae,JSON['stringify'](_0x6cb2f9));_0x2decaf(_0x6cb2f9);})['catch'](function(_0x3d40c2){logger[_0x844e('0x10')](_0x844e('0x36'),_0x3d40c2['message'],_0x4c3dae);_0x252fe3(_0x1889b7[_0x844e('0x10')](0x1f4,_0x3d40c2[_0x844e('0x12')]));});});};exports[_0x844e('0x37')]=function(_0x42fc0e){var _0x16fc43=this;return new Promise(function(_0x2c32f8,_0x37de63){return db['CmHopper'][_0x844e('0x27')]({'raw':_0x42fc0e['options']?_0x42fc0e[_0x844e('0x15')][_0x844e('0x16')]===undefined?!![]:![]:!![],'where':_0x42fc0e[_0x844e('0x15')]?_0x42fc0e[_0x844e('0x15')][_0x844e('0x17')]||null:null,'attributes':[[db['sequelize']['fn'](_0x844e('0x38'),db[_0x844e('0x34')]['fn']('IF',db[_0x844e('0x34')][_0x844e('0x39')](_0x844e('0x3a')+util[_0x844e('0x3b')](_0x844e('0x3c'),moment()[_0x844e('0x3b')](_0x844e('0x3d')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})['then'](function(_0x44bfc2){logger[_0x844e('0xa')](_0x844e('0x37'),_0x42fc0e);logger[_0x844e('0xc')]('CountReScheduled',_0x42fc0e,JSON[_0x844e('0xe')](_0x44bfc2));_0x2c32f8(_0x44bfc2);})[_0x844e('0x13')](function(_0x5061f3){logger[_0x844e('0x10')](_0x844e('0x37'),_0x5061f3[_0x844e('0x12')],_0x42fc0e);_0x37de63(_0x16fc43[_0x844e('0x10')](0x1f4,_0x5061f3[_0x844e('0x12')]));});});};exports[_0x844e('0x3e')]=function(_0x1f9e00){var _0x3dd689=this;return new Promise(function(_0x16aec1,_0x3e76e0){return db[_0x844e('0x3f')][_0x844e('0x25')]()[_0x844e('0x9')](function(_0x389611){return db[_0x844e('0x34')][_0x844e('0x26')](function(_0x3ef9c9){return db[_0x844e('0x14')][_0x844e('0x27')]({'where':_0x1f9e00['options']?_0x1f9e00[_0x844e('0x15')]['where']||null:null,'attributes':_0x1f9e00[_0x844e('0x15')]?_0x1f9e00[_0x844e('0x15')]['attributes']||null:null,'limit':0x1,'order':_0x1f9e00[_0x844e('0x15')]?_0x1f9e00[_0x844e('0x15')][_0x844e('0x28')]||null:null,'group':db[_0x844e('0x14')][_0x844e('0x30')],'transaction':_0x3ef9c9,'lock':_0x3ef9c9[_0x844e('0x29')][_0x844e('0x2a')],'include':_0x1f9e00['options']?_0x1f9e00[_0x844e('0x15')]['include']?_[_0x844e('0x1c')](_0x1f9e00[_0x844e('0x15')][_0x844e('0x1a')],function(_0x262a98){return{'model':db[_0x262a98[_0x844e('0x1b')]],'as':_0x262a98['as'],'attributes':_0x262a98[_0x844e('0x18')],'include':_0x262a98[_0x844e('0x1a')]?_['map'](_0x262a98['include'],function(_0x1c243d){return{'model':db[_0x1c243d[_0x844e('0x1b')]],'as':_0x1c243d['as'],'attributes':_0x1c243d[_0x844e('0x18')],'include':_0x1c243d['include']?_[_0x844e('0x1c')](_0x1c243d['include'],function(_0x2e9e28){return{'model':db[_0x2e9e28[_0x844e('0x1b')]],'as':_0x2e9e28['as'],'attributes':_0x2e9e28['attributes']};}):[]};}):[]};}):[]:[]})[_0x844e('0x9')](function(_0x2bada0){var _0xcc80e9=[];for(var _0x5852c0=0x0;_0x5852c0<_0x2bada0['length'];_0x5852c0+=0x1){_0xcc80e9[_0x844e('0x31')](_0x2bada0[_0x5852c0][_0x844e('0x32')](_0x1f9e00[_0x844e('0x22')],{'transaction':_0x3ef9c9}));}return BPromise[_0x844e('0x40')](_0xcc80e9);});})[_0x844e('0x9')](function(_0x3bdd4a){logger['info']('GetContactRecallMe',_0x1f9e00);logger[_0x844e('0xc')](_0x844e('0x3e'),_0x1f9e00,JSON[_0x844e('0xe')](_0x3bdd4a));_0x16aec1(_0x3bdd4a);})['catch'](function(_0x11fc3a){logger[_0x844e('0x10')](_0x844e('0x3e'),_0x11fc3a[_0x844e('0x12')],_0x1f9e00);_0x3e76e0(_0x3dd689['error'](0x1f4,_0x11fc3a['message']));});});});};exports[_0x844e('0x41')]=function(_0x5324d8){var _0x48b69d=this;return new Promise(function(_0x589734,_0x4fac57){db[_0x844e('0x3f')][_0x844e('0x25')]()[_0x844e('0x9')](function(_0xca58e3){return db['CmHopper'][_0x844e('0x27')]({'raw':_0x5324d8[_0x844e('0x15')]?_0x5324d8[_0x844e('0x15')][_0x844e('0x16')]===undefined?!![]:![]:!![],'where':_0x5324d8['options']?_0x5324d8[_0x844e('0x15')][_0x844e('0x17')]||null:null,'attributes':_0x5324d8[_0x844e('0x15')]?_0x5324d8[_0x844e('0x15')][_0x844e('0x18')]||null:null,'limit':_0x5324d8[_0x844e('0x15')]?_0x5324d8[_0x844e('0x15')][_0x844e('0x19')]||null:null,'include':_0x5324d8[_0x844e('0x15')]?_0x5324d8[_0x844e('0x15')]['include']?_[_0x844e('0x1c')](_0x5324d8['options'][_0x844e('0x1a')],function(_0x46a478){return{'model':db[_0x46a478[_0x844e('0x1b')]],'as':_0x46a478['as'],'attributes':_0x46a478['as']===_0x844e('0x2b')?_[_0x844e('0x42')](_0xca58e3):_0x46a478['attributes'],'include':_0x46a478[_0x844e('0x1a')]?_[_0x844e('0x1c')](_0x46a478[_0x844e('0x1a')],function(_0x4fdbb8){return{'model':db[_0x4fdbb8['model']],'as':_0x4fdbb8['as'],'attributes':_0x4fdbb8[_0x844e('0x18')],'include':_0x4fdbb8['include']?_[_0x844e('0x1c')](_0x4fdbb8[_0x844e('0x1a')],function(_0x5374ba){return{'model':db[_0x5374ba[_0x844e('0x1b')]],'as':_0x5374ba['as'],'attributes':_0x5374ba[_0x844e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x844e('0x9')](function(_0x3847a3){logger[_0x844e('0xa')]('GetCmHopper',_0x5324d8);logger[_0x844e('0xc')](_0x844e('0x1d'),_0x5324d8,JSON[_0x844e('0xe')](_0x3847a3));_0x589734(_0x3847a3);})[_0x844e('0x13')](function(_0x4e8a09){logger[_0x844e('0x10')](_0x844e('0x1d'),_0x4e8a09[_0x844e('0x12')],_0x5324d8);_0x4fac57(_0x48b69d[_0x844e('0x10')](0x1f4,_0x4e8a09['message']));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 36a3b16..c8d2460 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 _0x4f2f=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','/:id','post','/preview','getPreview','put','delete','exports','path'];(function(_0xaed320,_0x279f14){var _0x29b095=function(_0x5ba5d6){while(--_0x5ba5d6){_0xaed320['push'](_0xaed320['shift']());}};_0x29b095(++_0x279f14);}(_0x4f2f,0x1cb));var _0xf4f2=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x4f2f[_0x34bf97];return _0x292719;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf4f2('0x0'));var timeout=require(_0xf4f2('0x1'));var express=require('express');var router=express[_0xf4f2('0x2')]();var auth=require(_0xf4f2('0x3'));var interaction=require(_0xf4f2('0x4'));var config=require(_0xf4f2('0x5'));var controller=require(_0xf4f2('0x6'));router[_0xf4f2('0x7')]('/',auth[_0xf4f2('0x8')](),controller[_0xf4f2('0x9')]);router[_0xf4f2('0x7')](_0xf4f2('0xa'),auth[_0xf4f2('0x8')](),controller['describe']);router[_0xf4f2('0x7')](_0xf4f2('0xb'),auth['isAuthenticated'](),controller[_0xf4f2('0xc')]);router[_0xf4f2('0x7')](_0xf4f2('0xd'),auth[_0xf4f2('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf4f2('0xe')](_0xf4f2('0xf'),auth['isAuthenticated'](),controller[_0xf4f2('0x10')]);router[_0xf4f2('0x11')]('/:id',auth[_0xf4f2('0x8')](),controller['update']);router[_0xf4f2('0x12')](_0xf4f2('0xd'),auth[_0xf4f2('0x8')](),controller['destroy']);module[_0xf4f2('0x13')]=router; \ No newline at end of file +var _0x27c8=['/describe','isAuthenticated','describe','/opencontacts','/:id','post','/preview','getPreview','delete','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get'];(function(_0x1d4449,_0x495153){var _0x4dcde3=function(_0x36d549){while(--_0x36d549){_0x1d4449['push'](_0x1d4449['shift']());}};_0x4dcde3(++_0x495153);}(_0x27c8,0x6a));var _0x827c=function(_0x233696,_0x5553ef){_0x233696=_0x233696-0x0;var _0x48a31d=_0x27c8[_0x233696];return _0x48a31d;};'use strict';var multer=require('multer');var util=require(_0x827c('0x0'));var path=require(_0x827c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x827c('0x2')]();var auth=require(_0x827c('0x3'));var interaction=require(_0x827c('0x4'));var config=require(_0x827c('0x5'));var controller=require(_0x827c('0x6'));router[_0x827c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x827c('0x7')](_0x827c('0x8'),auth[_0x827c('0x9')](),controller[_0x827c('0xa')]);router[_0x827c('0x7')](_0x827c('0xb'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0x827c('0x7')](_0x827c('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x827c('0xd')]('/',auth[_0x827c('0x9')](),controller['create']);router[_0x827c('0xd')](_0x827c('0xe'),auth[_0x827c('0x9')](),controller[_0x827c('0xf')]);router['put'](_0x827c('0xc'),auth[_0x827c('0x9')](),controller['update']);router[_0x827c('0x10')](_0x827c('0xc'),auth[_0x827c('0x9')](),controller[_0x827c('0x11')]);module[_0x827c('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index bef5b98..4c416ca 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 _0xd21b=['exports','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2b710e,_0x24da1e){var _0x38e747=function(_0x2da48f){while(--_0x2da48f){_0x2b710e['push'](_0x2b710e['shift']());}};_0x38e747(++_0x24da1e);}(_0xd21b,0x15c));var _0xbd21=function(_0x1d8d9e,_0x20b77b){_0x1d8d9e=_0x1d8d9e-0x0;var _0x151b9d=_0xd21b[_0x1d8d9e];return _0x151b9d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xbd21('0x0')]={'CmHopperId':{'type':Sequelize[_0xbd21('0x1')]},'phone':{'type':Sequelize[_0xbd21('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xbd21('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xbd21('0x3')],'defaultValue':moment()[_0xbd21('0x4')](_0xbd21('0x5'))},'countbusyretry':{'type':Sequelize[_0xbd21('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbd21('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbd21('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xbd21('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbd21('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbd21('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbd21('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbd21('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6ab4=['INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0x6ab4,0x88));var _0x46ab=function(_0x546ac5,_0x59e59b){_0x546ac5=_0x546ac5-0x0;var _0x56a6d8=_0x6ab4[_0x546ac5];return _0x56a6d8;};'use strict';var moment=require('moment');var Sequelize=require(_0x46ab('0x0'));module[_0x46ab('0x1')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x46ab('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x46ab('0x3')],'defaultValue':moment()[_0x46ab('0x4')](_0x46ab('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x46ab('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x46ab('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x46ab('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x46ab('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x46ab('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x46ab('0x2')],'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 5e3eade..0f2e9f7 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 _0xa0ac=['destroy','get','CmHopperAdditionalPhones','name','send','CmHopperAdditionalPhone','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','show','params','keys','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','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','sendStatus','status','end','count','offset','limit','set','json','reject','save','update','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa0ac,0x7a));var _0xca0a=function(_0x3df705,_0x1b5848){_0x3df705=_0x3df705-0x0;var _0x41addc=_0xa0ac[_0x3df705];return _0x41addc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xca0a('0x0'));var rimraf=require(_0xca0a('0x1'));var zipdir=require(_0xca0a('0x2'));var jsonpatch=require(_0xca0a('0x3'));var rp=require(_0xca0a('0x4'));var moment=require('moment');var BPromise=require(_0xca0a('0x5'));var Mustache=require(_0xca0a('0x6'));var util=require(_0xca0a('0x7'));var path=require(_0xca0a('0x8'));var sox=require(_0xca0a('0x9'));var csv=require(_0xca0a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xca0a('0xb'));var squel=require(_0xca0a('0xc'));var crypto=require(_0xca0a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xca0a('0xe'));var toCsv=require(_0xca0a('0xa'));var querystring=require(_0xca0a('0xf'));var Papa=require(_0xca0a('0x10'));var Redis=require(_0xca0a('0x11'));var authService=require(_0xca0a('0x12'));var qs=require(_0xca0a('0x13'));var as=require(_0xca0a('0x14'));var hardwareService=require(_0xca0a('0x15'));var logger=require(_0xca0a('0x16'))(_0xca0a('0x17'));var utils=require(_0xca0a('0x18'));var config=require(_0xca0a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38afd5,_0x4b69d3){_0x4b69d3=_0x4b69d3||0xcc;return function(_0x13db6f){if(_0x13db6f){return _0x38afd5[_0xca0a('0x1a')](_0x4b69d3);}return _0x38afd5[_0xca0a('0x1b')](_0x4b69d3)[_0xca0a('0x1c')]();};}function respondWithResult(_0x2622cf,_0x292ef4){_0x292ef4=_0x292ef4||0xc8;return function(_0x1eaeec){if(_0x1eaeec){return _0x2622cf[_0xca0a('0x1b')](_0x292ef4)['json'](_0x1eaeec);}};}function respondWithFilteredResult(_0x26b93b,_0x3cbd42){return function(_0x301493){if(_0x301493){var _0x59c306=_0x301493[_0xca0a('0x1d')],_0x107b5c=_0x3cbd42[_0xca0a('0x1e')],_0x5d4690=_0x3cbd42['offset']+_0x3cbd42[_0xca0a('0x1f')],_0x5e65b3;if(_0x5d4690>=_0x59c306){_0x5d4690=_0x59c306;_0x5e65b3=0xc8;}else{_0x5e65b3=0xce;}_0x26b93b['status'](_0x5e65b3);return _0x26b93b[_0xca0a('0x20')]('Content-Range',_0x107b5c+'-'+_0x5d4690+'/'+_0x59c306)[_0xca0a('0x21')](_0x301493);}return null;};}function patchUpdates(_0x382503){return function(_0x491a59){try{jsonpatch['apply'](_0x491a59,_0x382503,!![]);}catch(_0x534fb4){return BPromise[_0xca0a('0x22')](_0x534fb4);}return _0x491a59[_0xca0a('0x23')]();};}function saveUpdates(_0x1af33a,_0x3e6ced){return function(_0x5e897c){if(_0x5e897c){return _0x5e897c[_0xca0a('0x24')](_0x1af33a)[_0xca0a('0x25')](function(_0x1f5819){return _0x1f5819;});}return null;};}function removeEntity(_0x2c2096,_0x5b5b6a){return function(_0x2700fa){if(_0x2700fa){return _0x2700fa[_0xca0a('0x26')]()[_0xca0a('0x25')](function(){var _0x388eb1=_0x2700fa[_0xca0a('0x27')]({'plain':!![]});var _0x56e5ae=_0xca0a('0x28');return db['UserProfileResource'][_0xca0a('0x26')]({'where':{'type':_0x56e5ae,'resourceId':_0x388eb1['id']}})[_0xca0a('0x25')](function(){return _0x2700fa;});})[_0xca0a('0x25')](function(){_0x2c2096[_0xca0a('0x1b')](0xcc)[_0xca0a('0x1c')]();});}};}function handleEntityNotFound(_0xb33b84,_0x34ba48){return function(_0x255d42){if(!_0x255d42){_0xb33b84[_0xca0a('0x1a')](0x194);}return _0x255d42;};}function handleError(_0x188a91,_0x3fa72f){_0x3fa72f=_0x3fa72f||0x1f4;return function(_0x360cef){logger['error'](_0x360cef['stack']);if(_0x360cef['name']){delete _0x360cef[_0xca0a('0x29')];}_0x188a91[_0xca0a('0x1b')](_0x3fa72f)[_0xca0a('0x2a')](_0x360cef);};}exports['index']=function(_0x4a4df7,_0x27d78d){var _0x3397a7={},_0x366c0e={},_0x3c20eb={'count':0x0,'rows':[]};var _0x2c64fa=_['map'](db[_0xca0a('0x2b')]['rawAttributes'],function(_0x635d22){return{'name':_0x635d22[_0xca0a('0x2c')],'type':_0x635d22[_0xca0a('0x2d')][_0xca0a('0x2e')]};});_0x366c0e[_0xca0a('0x2f')]=_['map'](_0x2c64fa,_0xca0a('0x29'));_0x366c0e[_0xca0a('0x30')]=_['keys'](_0x4a4df7[_0xca0a('0x30')]);_0x366c0e[_0xca0a('0x31')]=_[_0xca0a('0x32')](_0x366c0e[_0xca0a('0x2f')],_0x366c0e[_0xca0a('0x30')]);_0x3397a7[_0xca0a('0x33')]=_[_0xca0a('0x32')](_0x366c0e[_0xca0a('0x2f')],qs[_0xca0a('0x34')](_0x4a4df7[_0xca0a('0x30')][_0xca0a('0x34')]));_0x3397a7[_0xca0a('0x33')]=_0x3397a7[_0xca0a('0x33')][_0xca0a('0x35')]?_0x3397a7['attributes']:_0x366c0e[_0xca0a('0x2f')];if(!_0x4a4df7[_0xca0a('0x30')][_0xca0a('0x36')](_0xca0a('0x37'))){_0x3397a7[_0xca0a('0x1f')]=qs[_0xca0a('0x1f')](_0x4a4df7[_0xca0a('0x30')][_0xca0a('0x1f')]);_0x3397a7['offset']=qs['offset'](_0x4a4df7[_0xca0a('0x30')]['offset']);}_0x3397a7[_0xca0a('0x38')]=qs[_0xca0a('0x39')](_0x4a4df7['query'][_0xca0a('0x39')]);_0x3397a7[_0xca0a('0x3a')]=qs[_0xca0a('0x31')](_[_0xca0a('0x3b')](_0x4a4df7[_0xca0a('0x30')],_0x366c0e['filters']),_0x2c64fa);if(_0x4a4df7[_0xca0a('0x30')][_0xca0a('0x3c')]){_0x3397a7[_0xca0a('0x3a')]=_['merge'](_0x3397a7[_0xca0a('0x3a')],{'$or':_['map'](_0x2c64fa,function(_0x37a7d1){if(_0x37a7d1[_0xca0a('0x2d')]!==_0xca0a('0x3d')){var _0xcc6b30={};_0xcc6b30[_0x37a7d1[_0xca0a('0x29')]]={'$like':'%'+_0x4a4df7[_0xca0a('0x30')][_0xca0a('0x3c')]+'%'};return _0xcc6b30;}})});}_0x3397a7=_['merge']({},_0x3397a7,_0x4a4df7[_0xca0a('0x3e')]);var _0xb9811f={'where':_0x3397a7[_0xca0a('0x3a')]};return db['CmHopperAdditionalPhone'][_0xca0a('0x1d')](_0xb9811f)[_0xca0a('0x25')](function(_0x1e5e6){_0x3c20eb[_0xca0a('0x1d')]=_0x1e5e6;if(_0x4a4df7[_0xca0a('0x30')]['includeAll']){_0x3397a7[_0xca0a('0x3f')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0xca0a('0x40')](_0x3397a7);})[_0xca0a('0x25')](function(_0x2bece8){_0x3c20eb['rows']=_0x2bece8;return _0x3c20eb;})[_0xca0a('0x25')](respondWithFilteredResult(_0x27d78d,_0x3397a7))['catch'](handleError(_0x27d78d,null));};exports[_0xca0a('0x41')]=function(_0x181688,_0x302438){var _0x33a0b5={'raw':!![],'where':{'id':_0x181688[_0xca0a('0x42')]['id']}},_0x21fb87={};_0x21fb87[_0xca0a('0x2f')]=_[_0xca0a('0x43')](db[_0xca0a('0x2b')][_0xca0a('0x44')]);_0x21fb87[_0xca0a('0x30')]=_['keys'](_0x181688[_0xca0a('0x30')]);_0x21fb87[_0xca0a('0x31')]=_[_0xca0a('0x32')](_0x21fb87[_0xca0a('0x2f')],_0x21fb87[_0xca0a('0x30')]);_0x33a0b5['attributes']=_[_0xca0a('0x32')](_0x21fb87[_0xca0a('0x2f')],qs[_0xca0a('0x34')](_0x181688[_0xca0a('0x30')]['fields']));_0x33a0b5[_0xca0a('0x33')]=_0x33a0b5[_0xca0a('0x33')][_0xca0a('0x35')]?_0x33a0b5['attributes']:_0x21fb87[_0xca0a('0x2f')];if(_0x181688[_0xca0a('0x30')]['includeAll']){_0x33a0b5[_0xca0a('0x3f')]=[{'all':!![]}];}_0x33a0b5=_['merge']({},_0x33a0b5,_0x181688[_0xca0a('0x3e')]);return db['CmHopperAdditionalPhone'][_0xca0a('0x45')](_0x33a0b5)[_0xca0a('0x25')](handleEntityNotFound(_0x302438,null))['then'](respondWithResult(_0x302438,null))[_0xca0a('0x46')](handleError(_0x302438,null));};exports[_0xca0a('0x47')]=function(_0x1fa064,_0x34d899){return db['CmHopperAdditionalPhone'][_0xca0a('0x47')](_0x1fa064[_0xca0a('0x48')],{})[_0xca0a('0x25')](function(_0x5f2b0c){var _0x3f1992=_0x1fa064[_0xca0a('0x49')][_0xca0a('0x27')]({'plain':!![]});if(!_0x3f1992)throw new Error(_0xca0a('0x4a'));if(_0x3f1992[_0xca0a('0x4b')]===_0xca0a('0x49')){var _0x210f7d=_0x5f2b0c[_0xca0a('0x27')]({'plain':!![]});var _0x2ba7b0=_0xca0a('0x28');return db['UserProfileSection'][_0xca0a('0x45')]({'where':{'name':_0x2ba7b0,'userProfileId':_0x3f1992[_0xca0a('0x4c')]},'raw':!![]})[_0xca0a('0x25')](function(_0x21e967){if(_0x21e967&&_0x21e967[_0xca0a('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x210f7d[_0xca0a('0x29')],'resourceId':_0x210f7d['id'],'type':_0x21e967[_0xca0a('0x29')],'sectionId':_0x21e967['id']},{})[_0xca0a('0x25')](function(){return _0x5f2b0c;});}else{return _0x5f2b0c;}})[_0xca0a('0x46')](function(_0x61dbf7){logger[_0xca0a('0x4e')](_0xca0a('0x4f'),_0x61dbf7);throw _0x61dbf7;});}return _0x5f2b0c;})[_0xca0a('0x25')](respondWithResult(_0x34d899,0xc9))[_0xca0a('0x46')](handleError(_0x34d899,null));};exports['update']=function(_0xaf6771,_0x354cae){if(_0xaf6771[_0xca0a('0x48')]['id']){delete _0xaf6771[_0xca0a('0x48')]['id'];}return db[_0xca0a('0x2b')]['find']({'where':{'id':_0xaf6771[_0xca0a('0x42')]['id']}})['then'](handleEntityNotFound(_0x354cae,null))[_0xca0a('0x25')](saveUpdates(_0xaf6771[_0xca0a('0x48')],null))[_0xca0a('0x25')](respondWithResult(_0x354cae,null))[_0xca0a('0x46')](handleError(_0x354cae,null));};exports[_0xca0a('0x26')]=function(_0x3dfb97,_0x3f66e2){return db['CmHopperAdditionalPhone'][_0xca0a('0x45')]({'where':{'id':_0x3dfb97['params']['id']}})[_0xca0a('0x25')](handleEntityNotFound(_0x3f66e2,null))[_0xca0a('0x25')](removeEntity(_0x3f66e2,null))[_0xca0a('0x46')](handleError(_0x3f66e2,null));}; \ No newline at end of file +var _0xc15c=['apply','reject','save','update','then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','sendStatus','error','name','send','index','map','CmHopperAdditionalPhone','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','Content-Range'];(function(_0x4b8e15,_0x45e600){var _0x59a965=function(_0x3254b3){while(--_0x3254b3){_0x4b8e15['push'](_0x4b8e15['shift']());}};_0x59a965(++_0x45e600);}(_0xc15c,0x17e));var _0xcc15=function(_0x3a9ec5,_0x653819){_0x3a9ec5=_0x3a9ec5-0x0;var _0x564fe3=_0xc15c[_0x3a9ec5];return _0x564fe3;};'use strict';var pdf=require(_0xcc15('0x0'));var emlformat=require(_0xcc15('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcc15('0x2'));var rp=require(_0xcc15('0x3'));var moment=require(_0xcc15('0x4'));var BPromise=require(_0xcc15('0x5'));var Mustache=require('mustache');var util=require(_0xcc15('0x6'));var path=require(_0xcc15('0x7'));var sox=require(_0xcc15('0x8'));var csv=require(_0xcc15('0x9'));var ejs=require(_0xcc15('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcc15('0xb'));var crypto=require(_0xcc15('0xc'));var jsforce=require(_0xcc15('0xd'));var deskjs=require(_0xcc15('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcc15('0xf'));var Papa=require(_0xcc15('0x10'));var Redis=require(_0xcc15('0x11'));var authService=require(_0xcc15('0x12'));var qs=require(_0xcc15('0x13'));var as=require(_0xcc15('0x14'));var hardwareService=require(_0xcc15('0x15'));var logger=require(_0xcc15('0x16'))(_0xcc15('0x17'));var utils=require(_0xcc15('0x18'));var config=require(_0xcc15('0x19'));var db=require(_0xcc15('0x1a'))['db'];function respondWithStatusCode(_0x4754a4,_0x36653d){_0x36653d=_0x36653d||0xcc;return function(_0x313680){if(_0x313680){return _0x4754a4['sendStatus'](_0x36653d);}return _0x4754a4[_0xcc15('0x1b')](_0x36653d)[_0xcc15('0x1c')]();};}function respondWithResult(_0x54e0cc,_0x360a1f){_0x360a1f=_0x360a1f||0xc8;return function(_0x1b4522){if(_0x1b4522){return _0x54e0cc[_0xcc15('0x1b')](_0x360a1f)[_0xcc15('0x1d')](_0x1b4522);}};}function respondWithFilteredResult(_0x2377db,_0x1832be){return function(_0x5d37a6){if(_0x5d37a6){var _0x1864a9=_0x5d37a6[_0xcc15('0x1e')],_0x5d83b8=_0x1832be[_0xcc15('0x1f')],_0x2d1e60=_0x1832be[_0xcc15('0x1f')]+_0x1832be['limit'],_0x8557f6;if(_0x2d1e60>=_0x1864a9){_0x2d1e60=_0x1864a9;_0x8557f6=0xc8;}else{_0x8557f6=0xce;}_0x2377db['status'](_0x8557f6);return _0x2377db['set'](_0xcc15('0x20'),_0x5d83b8+'-'+_0x2d1e60+'/'+_0x1864a9)[_0xcc15('0x1d')](_0x5d37a6);}return null;};}function patchUpdates(_0x5e67c6){return function(_0x214b41){try{jsonpatch[_0xcc15('0x21')](_0x214b41,_0x5e67c6,!![]);}catch(_0xf6a2e2){return BPromise[_0xcc15('0x22')](_0xf6a2e2);}return _0x214b41[_0xcc15('0x23')]();};}function saveUpdates(_0x2dddf2,_0x5f26f6){return function(_0x1fe263){if(_0x1fe263){return _0x1fe263[_0xcc15('0x24')](_0x2dddf2)[_0xcc15('0x25')](function(_0x16a83a){return _0x16a83a;});}return null;};}function removeEntity(_0x2581eb,_0x106644){return function(_0x5a8d12){if(_0x5a8d12){return _0x5a8d12['destroy']()['then'](function(){var _0x513620=_0x5a8d12[_0xcc15('0x26')]({'plain':!![]});var _0x1df439=_0xcc15('0x27');return db[_0xcc15('0x28')][_0xcc15('0x29')]({'where':{'type':_0x1df439,'resourceId':_0x513620['id']}})[_0xcc15('0x25')](function(){return _0x5a8d12;});})[_0xcc15('0x25')](function(){_0x2581eb[_0xcc15('0x1b')](0xcc)[_0xcc15('0x1c')]();});}};}function handleEntityNotFound(_0x4e19c0,_0xe512e6){return function(_0x57278b){if(!_0x57278b){_0x4e19c0[_0xcc15('0x2a')](0x194);}return _0x57278b;};}function handleError(_0x191ff1,_0x4c1236){_0x4c1236=_0x4c1236||0x1f4;return function(_0x1e4dd7){logger[_0xcc15('0x2b')](_0x1e4dd7['stack']);if(_0x1e4dd7[_0xcc15('0x2c')]){delete _0x1e4dd7[_0xcc15('0x2c')];}_0x191ff1['status'](_0x4c1236)[_0xcc15('0x2d')](_0x1e4dd7);};}exports[_0xcc15('0x2e')]=function(_0x28c1b3,_0x2c3cba){var _0x4dcbdc={},_0x47c17f={},_0x1e443c={'count':0x0,'rows':[]};var _0xb79f6=_[_0xcc15('0x2f')](db[_0xcc15('0x30')]['rawAttributes'],function(_0x33d36a){return{'name':_0x33d36a[_0xcc15('0x31')],'type':_0x33d36a[_0xcc15('0x32')]['key']};});_0x47c17f[_0xcc15('0x33')]=_[_0xcc15('0x2f')](_0xb79f6,_0xcc15('0x2c'));_0x47c17f['query']=_[_0xcc15('0x34')](_0x28c1b3[_0xcc15('0x35')]);_0x47c17f[_0xcc15('0x36')]=_[_0xcc15('0x37')](_0x47c17f['model'],_0x47c17f[_0xcc15('0x35')]);_0x4dcbdc[_0xcc15('0x38')]=_['intersection'](_0x47c17f['model'],qs[_0xcc15('0x39')](_0x28c1b3[_0xcc15('0x35')][_0xcc15('0x39')]));_0x4dcbdc['attributes']=_0x4dcbdc[_0xcc15('0x38')][_0xcc15('0x3a')]?_0x4dcbdc[_0xcc15('0x38')]:_0x47c17f[_0xcc15('0x33')];if(!_0x28c1b3[_0xcc15('0x35')]['hasOwnProperty'](_0xcc15('0x3b'))){_0x4dcbdc[_0xcc15('0x3c')]=qs['limit'](_0x28c1b3[_0xcc15('0x35')][_0xcc15('0x3c')]);_0x4dcbdc['offset']=qs[_0xcc15('0x1f')](_0x28c1b3[_0xcc15('0x35')][_0xcc15('0x1f')]);}_0x4dcbdc['order']=qs[_0xcc15('0x3d')](_0x28c1b3[_0xcc15('0x35')]['sort']);_0x4dcbdc[_0xcc15('0x3e')]=qs[_0xcc15('0x36')](_[_0xcc15('0x3f')](_0x28c1b3[_0xcc15('0x35')],_0x47c17f[_0xcc15('0x36')]),_0xb79f6);if(_0x28c1b3[_0xcc15('0x35')][_0xcc15('0x40')]){_0x4dcbdc[_0xcc15('0x3e')]=_[_0xcc15('0x41')](_0x4dcbdc['where'],{'$or':_[_0xcc15('0x2f')](_0xb79f6,function(_0x4d4ca9){if(_0x4d4ca9['type']!==_0xcc15('0x42')){var _0x25ffb0={};_0x25ffb0[_0x4d4ca9[_0xcc15('0x2c')]]={'$like':'%'+_0x28c1b3[_0xcc15('0x35')][_0xcc15('0x40')]+'%'};return _0x25ffb0;}})});}_0x4dcbdc=_[_0xcc15('0x41')]({},_0x4dcbdc,_0x28c1b3['options']);var _0x112717={'where':_0x4dcbdc['where']};return db[_0xcc15('0x30')]['count'](_0x112717)[_0xcc15('0x25')](function(_0x1cf23c){_0x1e443c['count']=_0x1cf23c;if(_0x28c1b3[_0xcc15('0x35')][_0xcc15('0x43')]){_0x4dcbdc[_0xcc15('0x44')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0xcc15('0x45')](_0x4dcbdc);})[_0xcc15('0x25')](function(_0x456d92){_0x1e443c['rows']=_0x456d92;return _0x1e443c;})['then'](respondWithFilteredResult(_0x2c3cba,_0x4dcbdc))[_0xcc15('0x46')](handleError(_0x2c3cba,null));};exports[_0xcc15('0x47')]=function(_0x21418d,_0xe70dd2){var _0x377425={'raw':!![],'where':{'id':_0x21418d[_0xcc15('0x48')]['id']}},_0x4605ba={};_0x4605ba[_0xcc15('0x33')]=_[_0xcc15('0x34')](db[_0xcc15('0x30')][_0xcc15('0x49')]);_0x4605ba['query']=_[_0xcc15('0x34')](_0x21418d[_0xcc15('0x35')]);_0x4605ba[_0xcc15('0x36')]=_['intersection'](_0x4605ba['model'],_0x4605ba[_0xcc15('0x35')]);_0x377425[_0xcc15('0x38')]=_[_0xcc15('0x37')](_0x4605ba[_0xcc15('0x33')],qs[_0xcc15('0x39')](_0x21418d['query']['fields']));_0x377425[_0xcc15('0x38')]=_0x377425['attributes']['length']?_0x377425[_0xcc15('0x38')]:_0x4605ba['model'];if(_0x21418d[_0xcc15('0x35')][_0xcc15('0x43')]){_0x377425['include']=[{'all':!![]}];}_0x377425=_[_0xcc15('0x41')]({},_0x377425,_0x21418d[_0xcc15('0x4a')]);return db[_0xcc15('0x30')][_0xcc15('0x4b')](_0x377425)[_0xcc15('0x25')](handleEntityNotFound(_0xe70dd2,null))[_0xcc15('0x25')](respondWithResult(_0xe70dd2,null))['catch'](handleError(_0xe70dd2,null));};exports[_0xcc15('0x4c')]=function(_0x3b223e,_0x36cc2d){return db[_0xcc15('0x30')][_0xcc15('0x4c')](_0x3b223e[_0xcc15('0x4d')],{})[_0xcc15('0x25')](function(_0x5948fa){var _0x8f5b02=_0x3b223e[_0xcc15('0x4e')][_0xcc15('0x26')]({'plain':!![]});if(!_0x8f5b02)throw new Error(_0xcc15('0x4f'));if(_0x8f5b02[_0xcc15('0x50')]===_0xcc15('0x4e')){var _0x305dca=_0x5948fa[_0xcc15('0x26')]({'plain':!![]});var _0x20f79c=_0xcc15('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x20f79c,'userProfileId':_0x8f5b02[_0xcc15('0x51')]},'raw':!![]})[_0xcc15('0x25')](function(_0x495a2f){if(_0x495a2f&&_0x495a2f['autoAssociation']===0x0){return db['UserProfileResource'][_0xcc15('0x4c')]({'name':_0x305dca[_0xcc15('0x2c')],'resourceId':_0x305dca['id'],'type':_0x495a2f[_0xcc15('0x2c')],'sectionId':_0x495a2f['id']},{})['then'](function(){return _0x5948fa;});}else{return _0x5948fa;}})['catch'](function(_0xcd3d46){logger[_0xcc15('0x2b')](_0xcc15('0x52'),_0xcd3d46);throw _0xcd3d46;});}return _0x5948fa;})[_0xcc15('0x25')](respondWithResult(_0x36cc2d,0xc9))['catch'](handleError(_0x36cc2d,null));};exports[_0xcc15('0x24')]=function(_0xa88a2,_0x28d847){if(_0xa88a2[_0xcc15('0x4d')]['id']){delete _0xa88a2[_0xcc15('0x4d')]['id'];}return db[_0xcc15('0x30')]['find']({'where':{'id':_0xa88a2[_0xcc15('0x48')]['id']}})[_0xcc15('0x25')](handleEntityNotFound(_0x28d847,null))[_0xcc15('0x25')](saveUpdates(_0xa88a2[_0xcc15('0x4d')],null))[_0xcc15('0x25')](respondWithResult(_0x28d847,null))[_0xcc15('0x46')](handleError(_0x28d847,null));};exports[_0xcc15('0x29')]=function(_0x18db98,_0xd7a535){return db['CmHopperAdditionalPhone'][_0xcc15('0x4b')]({'where':{'id':_0x18db98['params']['id']}})[_0xcc15('0x25')](handleEntityNotFound(_0xd7a535,null))[_0xcc15('0x25')](removeEntity(_0xd7a535,null))['catch'](handleError(_0xd7a535,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 51ec452..dd1bc76 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 _0xe55c=['exports','define','CmHopperAdditionalPhone','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes'];(function(_0x38622b,_0x3cfdf7){var _0x2c1a7a=function(_0x5de9cc){while(--_0x5de9cc){_0x38622b['push'](_0x38622b['shift']());}};_0x2c1a7a(++_0x3cfdf7);}(_0xe55c,0x189));var _0xce55=function(_0x1f9e5b,_0x3574f1){_0x1f9e5b=_0x1f9e5b-0x0;var _0x38898e=_0xe55c[_0x1f9e5b];return _0x38898e;};'use strict';var _=require(_0xce55('0x0'));var util=require(_0xce55('0x1'));var logger=require(_0xce55('0x2'))(_0xce55('0x3'));var moment=require(_0xce55('0x4'));var BPromise=require(_0xce55('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce55('0x6'));var rimraf=require(_0xce55('0x7'));var config=require(_0xce55('0x8'));var attributes=require(_0xce55('0x9'));module[_0xce55('0xa')]=function(_0x242ac6,_0x435993){return _0x242ac6[_0xce55('0xb')](_0xce55('0xc'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35a8=['exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes'];(function(_0x2e2fcc,_0x47b37c){var _0x34a943=function(_0x15b444){while(--_0x15b444){_0x2e2fcc['push'](_0x2e2fcc['shift']());}};_0x34a943(++_0x47b37c);}(_0x35a8,0x1b4));var _0x835a=function(_0x4f9a54,_0x27fb4c){_0x4f9a54=_0x4f9a54-0x0;var _0x29dfcd=_0x35a8[_0x4f9a54];return _0x29dfcd;};'use strict';var _=require(_0x835a('0x0'));var util=require(_0x835a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x835a('0x2'));var rp=require(_0x835a('0x3'));var fs=require('fs');var path=require(_0x835a('0x4'));var rimraf=require(_0x835a('0x5'));var config=require(_0x835a('0x6'));var attributes=require(_0x835a('0x7'));module[_0x835a('0x8')]=function(_0x370b2b,_0x462ade){return _0x370b2b[_0x835a('0x9')](_0x835a('0xa'),attributes,{'tableName':_0x835a('0xb'),'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 418af3a..be9683a 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 _0x7b4a=['../../config/environment','jayson/promise','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','ListId','body','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countagentrejectretry','entity','dialGlobalMaxRetry','ASC','countnoanswerretry','countabandonedretry','SwapAdditionalPhones','VoiceQueueId','duration','waitTime','scheduledat','add','minutes','phone','isNil','createdAt','countmachineretry','updatedAt','hopperToAdd','additionalToHop','sequelize','transaction','update','IncrementPreviewCounters','field','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x27e80b,_0x53b08d){var _0x2efdcc=function(_0xc7c36b){while(--_0xc7c36b){_0x27e80b['push'](_0x27e80b['shift']());}};_0x2efdcc(++_0x53b08d);}(_0x7b4a,0x120));var _0xa7b4=function(_0x2770a9,_0x3bb210){_0x2770a9=_0x2770a9-0x0;var _0x59d922=_0x7b4a[_0x2770a9];return _0x59d922;};'use strict';var _=require('lodash');var util=require(_0xa7b4('0x0'));var moment=require(_0xa7b4('0x1'));var BPromise=require(_0xa7b4('0x2'));var rs=require(_0xa7b4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa7b4('0x4'));var logger=require(_0xa7b4('0x5'))(_0xa7b4('0x6'));var config=require(_0xa7b4('0x7'));var jayson=require(_0xa7b4('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ec6eb,_0x1d863f,_0x2efa82){return new BPromise(function(_0x287fc4,_0x36bf74){return client[_0xa7b4('0x9')](_0x4ec6eb,_0x2efa82)[_0xa7b4('0xa')](function(_0x862d39){logger[_0xa7b4('0xb')](_0xa7b4('0xc'),_0x1d863f,'request\x20sent');logger[_0xa7b4('0xd')](_0xa7b4('0xe'),_0x1d863f,_0xa7b4('0xf'),JSON[_0xa7b4('0x10')](_0x862d39));if(_0x862d39['error']){if(_0x862d39[_0xa7b4('0x11')][_0xa7b4('0x12')]===0x1f4){logger[_0xa7b4('0x11')](_0xa7b4('0xc'),_0x1d863f,_0x862d39[_0xa7b4('0x11')][_0xa7b4('0x13')]);return _0x36bf74(_0x862d39[_0xa7b4('0x11')][_0xa7b4('0x13')]);}logger[_0xa7b4('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1d863f,_0x862d39[_0xa7b4('0x11')][_0xa7b4('0x13')]);return _0x287fc4(_0x862d39[_0xa7b4('0x11')]['message']);}else{logger[_0xa7b4('0xb')](_0xa7b4('0xc'),_0x1d863f,'request\x20sent');_0x287fc4(_0x862d39[_0xa7b4('0x14')][_0xa7b4('0x13')]);}})[_0xa7b4('0x15')](function(_0x3d8293){logger[_0xa7b4('0x11')](_0xa7b4('0xc'),_0x1d863f,_0x3d8293);_0x36bf74(_0x3d8293);});});}exports[_0xa7b4('0x16')]=function(_0x4d3010){var _0x4f2e75=this;return new Promise(function(_0x339a93,_0x3432ee){return db[_0xa7b4('0x17')][_0xa7b4('0x18')]({'raw':!![],'where':{'ContactId':_0x4d3010['body']['ContactId'],'ListId':_0x4d3010['body'][_0xa7b4('0x19')],'VoiceQueueId':_0x4d3010[_0xa7b4('0x1a')]['VoiceQueueId']===undefined?null:_0x4d3010[_0xa7b4('0x1a')]['VoiceQueueId'],'CampaignId':_0x4d3010[_0xa7b4('0x1a')][_0xa7b4('0x1b')]===undefined?null:_0x4d3010[_0xa7b4('0x1a')][_0xa7b4('0x1b')]}})['then'](function(_0xd6bd24){if(_0xd6bd24!=null){return db[_0xa7b4('0x1c')][_0xa7b4('0x18')]({'raw':!![],'where':{'CmHopperId':_0xd6bd24['id'],'OrderBy':{'$gt':_0xd6bd24[_0xa7b4('0x1d')]}},'order':[[_0xa7b4('0x1d'),'ASC']]})['then'](function(_0x1efa0){var _0x35dbe3=0x0;if(_0x1efa0){if(_0x1efa0[_0xa7b4('0x1e')]+_0x1efa0[_0xa7b4('0x1f')]+_0x1efa0['countnoanswerretry']+_0x1efa0[_0xa7b4('0x20')]+_0x1efa0[_0xa7b4('0x21')]+_0x1efa0['countabandonedretry']+_0x1efa0['countmachineretry']+_0x1efa0[_0xa7b4('0x22')]<_0x4d3010[_0xa7b4('0x23')][_0xa7b4('0x24')])_0x35dbe3=0x1;_0x339a93({'additional':_0x35dbe3});}else{return db[_0xa7b4('0x1c')][_0xa7b4('0x18')]({'raw':!![],'where':{'CmHopperId':_0xd6bd24['id']},'order':[[_0xa7b4('0x1d'),_0xa7b4('0x25')]]})['then'](function(_0x158711){var _0x5e8c83=0x0;if(_0x158711){if(_0x158711['countbusyretry']+_0x158711['countcongestionretry']+_0x158711[_0xa7b4('0x26')]+_0x158711[_0xa7b4('0x20')]+_0x158711[_0xa7b4('0x21')]+_0x158711[_0xa7b4('0x27')]+_0x158711['countmachineretry']+_0x158711[_0xa7b4('0x22')]<_0x4d3010[_0xa7b4('0x23')][_0xa7b4('0x24')])_0x5e8c83=0x1;_0x339a93({'additional':_0x5e8c83});}else{_0x339a93({'additional':0x0});}})['catch'](function(_0x10f2a3){logger[_0xa7b4('0x11')]('VerifyAdditionalPhones',_0x10f2a3[_0xa7b4('0x13')],_0x4d3010);_0x3432ee(_0x4f2e75[_0xa7b4('0x11')](0x1f4,_0x10f2a3[_0xa7b4('0x13')]));});}})[_0xa7b4('0x15')](function(_0x937e13){logger[_0xa7b4('0x11')](_0xa7b4('0x16'),_0x937e13[_0xa7b4('0x13')],_0x4d3010);_0x3432ee(_0x4f2e75[_0xa7b4('0x11')](0x1f4,_0x937e13[_0xa7b4('0x13')]));});}else _0x339a93({'additional':0x0});});});};exports[_0xa7b4('0x28')]=function(_0x19ae98){var _0x4a3316=this;return new Promise(function(_0x3a4f72,_0x32f50f){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x19ae98[_0xa7b4('0x1a')]['ContactId'],'ListId':_0x19ae98['body']['ListId'],'VoiceQueueId':_0x19ae98['body']['VoiceQueueId']===undefined?null:_0x19ae98[_0xa7b4('0x1a')][_0xa7b4('0x29')],'CampaignId':_0x19ae98[_0xa7b4('0x1a')]['CampaignId']===undefined?null:_0x19ae98[_0xa7b4('0x1a')]['CampaignId']}})[_0xa7b4('0xa')](function(_0x3fb5e5){if(_0x3fb5e5!=null){return db[_0xa7b4('0x1c')][_0xa7b4('0x18')]({'raw':!![],'where':{'CmHopperId':_0x3fb5e5['id'],'OrderBy':{'$gt':_0x3fb5e5[_0xa7b4('0x1d')]}},'order':[[_0xa7b4('0x1d'),_0xa7b4('0x25')]]})[_0xa7b4('0xa')](function(_0x936f83){if(_0x936f83)return activateAdditionalPhone(_0x3fb5e5,_0x19ae98[_0xa7b4('0x1a')],_0x936f83,_0x19ae98[_0xa7b4('0x2a')],_0x19ae98[_0xa7b4('0x2b')])[_0xa7b4('0xa')](function(_0x135067){_0x3a4f72(_0x135067);});else{return db[_0xa7b4('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x3fb5e5['id']},'order':[[_0xa7b4('0x1d'),_0xa7b4('0x25')]]})[_0xa7b4('0xa')](function(_0x7738b3){if(_0x7738b3)return activateAdditionalPhone(_0x3fb5e5,_0x19ae98['body'],_0x7738b3,_0x19ae98[_0xa7b4('0x2a')],_0x19ae98['waitTime'])[_0xa7b4('0xa')](function(_0x3199e7){_0x3a4f72(_0x3199e7);});else{_0x3a4f72({'id':_0x3fb5e5['id'],'phone':''});}})[_0xa7b4('0x15')](function(_0x554b7a){logger['error']('VerifyAdditionalPhones',_0x554b7a[_0xa7b4('0x13')],_0x19ae98);_0x32f50f(_0x4a3316[_0xa7b4('0x11')](0x1f4,_0x554b7a[_0xa7b4('0x13')]));});}})[_0xa7b4('0x15')](function(_0x29efe2){logger[_0xa7b4('0x11')](_0xa7b4('0x16'),_0x29efe2[_0xa7b4('0x13')],_0x19ae98);_0x32f50f(_0x4a3316[_0xa7b4('0x11')](0x1f4,_0x29efe2['message']));});}else _0x3a4f72(0x1);});});};function activateAdditionalPhone(_0x45c858,_0x5837f7,_0x21a871,_0x239ddb,_0x27f520){return new Promise(function(_0x400098,_0x2302fb){logger[_0xa7b4('0xb')]('VerifyAdditionalPhones',_0x21a871);var _0x2aae44;if(moment()>moment(_0x21a871[_0xa7b4('0x2c')])){_0x2aae44=moment()[_0xa7b4('0x2d')](_0x27f520||0x3,_0xa7b4('0x2e'));}else{if(_0x21a871['OrderBy']==0x0){_0x2aae44=moment(_0x21a871[_0xa7b4('0x2c')]);}else{_0x2aae44=moment()['add'](_0x27f520||0x3,_0xa7b4('0x2e'));}}var _0x2e2898={'phone':_0x45c858[_0xa7b4('0x2f')],'active':0x0,'OrderBy':_[_0xa7b4('0x30')](_0x45c858[_0xa7b4('0x1d')])?0x0:_0x45c858[_0xa7b4('0x1d')],'scheduledat':moment()[_0xa7b4('0x2d')](_0x239ddb||0x1,'minutes'),'countbusyretry':_0x5837f7[_0xa7b4('0x1e')],'countcongestionretry':_0x5837f7[_0xa7b4('0x1f')],'countnoanswerretry':_0x5837f7['countnoanswerretry'],'countnosuchnumberretry':_0x5837f7[_0xa7b4('0x20')],'countdropretry':_0x5837f7[_0xa7b4('0x21')],'countabandonedretry':_0x5837f7[_0xa7b4('0x27')],'countmachineretry':_0x5837f7['countmachineretry'],'countagentrejectretry':_0x5837f7[_0xa7b4('0x22')],'createdAt':_0x5837f7[_0xa7b4('0x31')],'updatedAt':_0x5837f7['updatedAt']};var _0x191c74={'CmHopperId':_0x45c858['id'],'phone':_0x21a871[_0xa7b4('0x2f')],'active':0x0,'OrderBy':_['isNil'](_0x21a871[_0xa7b4('0x1d')])?0x0:_0x21a871['OrderBy'],'scheduledat':_0x2aae44,'countbusyretry':_0x21a871['countbusyretry'],'countcongestionretry':_0x21a871[_0xa7b4('0x1f')],'countnoanswerretry':_0x21a871['countnoanswerretry'],'countnosuchnumberretry':_0x5837f7[_0xa7b4('0x20')],'countdropretry':_0x5837f7[_0xa7b4('0x21')],'countabandonedretry':_0x5837f7[_0xa7b4('0x27')],'countmachineretry':_0x5837f7[_0xa7b4('0x32')],'countagentrejectretry':_0x5837f7[_0xa7b4('0x22')],'createdAt':_0x21a871[_0xa7b4('0x31')],'updatedAt':_0x21a871[_0xa7b4('0x33')]};logger['info'](_0xa7b4('0x34'),_0x2e2898);logger['info'](_0xa7b4('0x35'),_0x191c74);return db[_0xa7b4('0x36')][_0xa7b4('0x37')](function(_0x595f80){return db[_0xa7b4('0x1c')][_0xa7b4('0x38')](_0x2e2898,{'where':{'id':_0x21a871['id']}},{'transaction':_0x595f80})[_0xa7b4('0xa')](function(){return db[_0xa7b4('0x17')]['update'](_0x191c74,{'where':{'id':_0x45c858['id']}},{'transaction':_0x595f80});});})[_0xa7b4('0xa')](function(_0x1e4250){_0x400098({'id':_0x45c858['id'],'phone':_0x21a871[_0xa7b4('0x2f')]});})[_0xa7b4('0x15')](function(_0x1f28d4){logger[_0xa7b4('0x11')](_0xa7b4('0x16'),_0x1f28d4[_0xa7b4('0x13')],req);_0x2302fb(_this[_0xa7b4('0x11')](0x1f4,_0x1f28d4[_0xa7b4('0x13')]));});});}exports[_0xa7b4('0x39')]=function(_0x343288){var _0x501fc3=this;return new Promise(function(_0x22d521,_0x3ab01a){return db['CmHopper']['update'](_0x343288[_0xa7b4('0x1a')][_0xa7b4('0x3a')],{'where':{'id':_0x343288[_0xa7b4('0x1a')]['id']}})[_0xa7b4('0xa')](function(_0x5dd84b){_0x22d521(_0x5dd84b);})[_0xa7b4('0x15')](function(_0x5ee7fc){logger[_0xa7b4('0x11')](_0xa7b4('0x39'),_0x5ee7fc[_0xa7b4('0x13')],_0x343288);_0x3ab01a(_0x501fc3[_0xa7b4('0x11')](0x1f4,_0x5ee7fc[_0xa7b4('0x13')]));});});}; \ No newline at end of file +var _0x8ba8=['dialGlobalMaxRetry','countabandonedretry','countmachineretry','duration','waitTime','scheduledat','add','minutes','createdAt','updatedAt','phone','isNil','hopperToAdd','additionalToHop','transaction','update','IncrementPreviewCounters','field','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','entity'];(function(_0xce316,_0x19c4a5){var _0x24fdac=function(_0x1aaf82){while(--_0x1aaf82){_0xce316['push'](_0xce316['shift']());}};_0x24fdac(++_0x19c4a5);}(_0x8ba8,0x17a));var _0x88ba=function(_0x400bad,_0x2b46b8){_0x400bad=_0x400bad-0x0;var _0xcf0b0f=_0x8ba8[_0x400bad];return _0xcf0b0f;};'use strict';var _=require(_0x88ba('0x0'));var util=require(_0x88ba('0x1'));var moment=require(_0x88ba('0x2'));var BPromise=require(_0x88ba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x88ba('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x88ba('0x5'))(_0x88ba('0x6'));var config=require(_0x88ba('0x7'));var jayson=require(_0x88ba('0x8'));var client=jayson[_0x88ba('0x9')][_0x88ba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39d4bd,_0x1d197a,_0x5a9eb2){return new BPromise(function(_0x44ffe9,_0x26ac11){return client[_0x88ba('0xb')](_0x39d4bd,_0x5a9eb2)[_0x88ba('0xc')](function(_0x36e36b){logger[_0x88ba('0xd')](_0x88ba('0xe'),_0x1d197a,_0x88ba('0xf'));logger[_0x88ba('0x10')](_0x88ba('0x11'),_0x1d197a,_0x88ba('0xf'),JSON[_0x88ba('0x12')](_0x36e36b));if(_0x36e36b[_0x88ba('0x13')]){if(_0x36e36b[_0x88ba('0x13')][_0x88ba('0x14')]===0x1f4){logger['error'](_0x88ba('0xe'),_0x1d197a,_0x36e36b[_0x88ba('0x13')]['message']);return _0x26ac11(_0x36e36b[_0x88ba('0x13')][_0x88ba('0x15')]);}logger[_0x88ba('0x13')](_0x88ba('0xe'),_0x1d197a,_0x36e36b[_0x88ba('0x13')][_0x88ba('0x15')]);return _0x44ffe9(_0x36e36b[_0x88ba('0x13')][_0x88ba('0x15')]);}else{logger[_0x88ba('0xd')](_0x88ba('0xe'),_0x1d197a,_0x88ba('0xf'));_0x44ffe9(_0x36e36b[_0x88ba('0x16')][_0x88ba('0x15')]);}})[_0x88ba('0x17')](function(_0xa8b558){logger[_0x88ba('0x13')](_0x88ba('0xe'),_0x1d197a,_0xa8b558);_0x26ac11(_0xa8b558);});});}exports[_0x88ba('0x18')]=function(_0x2086b7){var _0x19bc87=this;return new Promise(function(_0x154583,_0x1397c7){return db[_0x88ba('0x19')][_0x88ba('0x1a')]({'raw':!![],'where':{'ContactId':_0x2086b7[_0x88ba('0x1b')][_0x88ba('0x1c')],'ListId':_0x2086b7[_0x88ba('0x1b')][_0x88ba('0x1d')],'VoiceQueueId':_0x2086b7[_0x88ba('0x1b')][_0x88ba('0x1e')]===undefined?null:_0x2086b7[_0x88ba('0x1b')][_0x88ba('0x1e')],'CampaignId':_0x2086b7[_0x88ba('0x1b')][_0x88ba('0x1f')]===undefined?null:_0x2086b7['body']['CampaignId']}})[_0x88ba('0xc')](function(_0x2147f7){if(_0x2147f7!=null){return db[_0x88ba('0x20')][_0x88ba('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x2147f7['id'],'OrderBy':{'$gt':_0x2147f7[_0x88ba('0x21')]}},'order':[['OrderBy',_0x88ba('0x22')]]})[_0x88ba('0xc')](function(_0x373e24){var _0x122c09=0x0;if(_0x373e24){if(_0x373e24[_0x88ba('0x23')]+_0x373e24[_0x88ba('0x24')]+_0x373e24[_0x88ba('0x25')]+_0x373e24[_0x88ba('0x26')]+_0x373e24[_0x88ba('0x27')]+_0x373e24['countabandonedretry']+_0x373e24['countmachineretry']+_0x373e24[_0x88ba('0x28')]<_0x2086b7[_0x88ba('0x29')][_0x88ba('0x2a')])_0x122c09=0x1;_0x154583({'additional':_0x122c09});}else{return db[_0x88ba('0x20')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x2147f7['id']},'order':[[_0x88ba('0x21'),'ASC']]})[_0x88ba('0xc')](function(_0xf8f0d1){var _0x27342a=0x0;if(_0xf8f0d1){if(_0xf8f0d1[_0x88ba('0x23')]+_0xf8f0d1[_0x88ba('0x24')]+_0xf8f0d1['countnoanswerretry']+_0xf8f0d1[_0x88ba('0x26')]+_0xf8f0d1[_0x88ba('0x27')]+_0xf8f0d1[_0x88ba('0x2b')]+_0xf8f0d1[_0x88ba('0x2c')]+_0xf8f0d1[_0x88ba('0x28')]<_0x2086b7[_0x88ba('0x29')]['dialGlobalMaxRetry'])_0x27342a=0x1;_0x154583({'additional':_0x27342a});}else{_0x154583({'additional':0x0});}})[_0x88ba('0x17')](function(_0x4793ea){logger['error'](_0x88ba('0x18'),_0x4793ea[_0x88ba('0x15')],_0x2086b7);_0x1397c7(_0x19bc87[_0x88ba('0x13')](0x1f4,_0x4793ea[_0x88ba('0x15')]));});}})[_0x88ba('0x17')](function(_0x39c742){logger[_0x88ba('0x13')]('VerifyAdditionalPhones',_0x39c742[_0x88ba('0x15')],_0x2086b7);_0x1397c7(_0x19bc87['error'](0x1f4,_0x39c742[_0x88ba('0x15')]));});}else _0x154583({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x5772f2){var _0xcb5320=this;return new Promise(function(_0x5a8f89,_0x16f280){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x5772f2[_0x88ba('0x1b')][_0x88ba('0x1c')],'ListId':_0x5772f2[_0x88ba('0x1b')][_0x88ba('0x1d')],'VoiceQueueId':_0x5772f2[_0x88ba('0x1b')][_0x88ba('0x1e')]===undefined?null:_0x5772f2[_0x88ba('0x1b')][_0x88ba('0x1e')],'CampaignId':_0x5772f2['body']['CampaignId']===undefined?null:_0x5772f2['body']['CampaignId']}})[_0x88ba('0xc')](function(_0x256fb5){if(_0x256fb5!=null){return db[_0x88ba('0x20')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x256fb5['id'],'OrderBy':{'$gt':_0x256fb5[_0x88ba('0x21')]}},'order':[[_0x88ba('0x21'),_0x88ba('0x22')]]})['then'](function(_0x1f020c){if(_0x1f020c)return activateAdditionalPhone(_0x256fb5,_0x5772f2[_0x88ba('0x1b')],_0x1f020c,_0x5772f2[_0x88ba('0x2d')],_0x5772f2[_0x88ba('0x2e')])[_0x88ba('0xc')](function(_0x2e9edc){_0x5a8f89(_0x2e9edc);});else{return db[_0x88ba('0x20')][_0x88ba('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x256fb5['id']},'order':[['OrderBy',_0x88ba('0x22')]]})[_0x88ba('0xc')](function(_0x5cf05f){if(_0x5cf05f)return activateAdditionalPhone(_0x256fb5,_0x5772f2[_0x88ba('0x1b')],_0x5cf05f,_0x5772f2[_0x88ba('0x2d')],_0x5772f2[_0x88ba('0x2e')])[_0x88ba('0xc')](function(_0x3c5184){_0x5a8f89(_0x3c5184);});else{_0x5a8f89({'id':_0x256fb5['id'],'phone':''});}})[_0x88ba('0x17')](function(_0x56dd44){logger['error'](_0x88ba('0x18'),_0x56dd44[_0x88ba('0x15')],_0x5772f2);_0x16f280(_0xcb5320[_0x88ba('0x13')](0x1f4,_0x56dd44[_0x88ba('0x15')]));});}})[_0x88ba('0x17')](function(_0x503b9c){logger['error'](_0x88ba('0x18'),_0x503b9c['message'],_0x5772f2);_0x16f280(_0xcb5320[_0x88ba('0x13')](0x1f4,_0x503b9c['message']));});}else _0x5a8f89(0x1);});});};function activateAdditionalPhone(_0x3cd421,_0x2d372b,_0x409c56,_0x4ab94b,_0x56c295){return new Promise(function(_0x4129a7,_0x407082){logger[_0x88ba('0xd')](_0x88ba('0x18'),_0x409c56);var _0x5b333f;if(moment()>moment(_0x409c56[_0x88ba('0x2f')])){_0x5b333f=moment()[_0x88ba('0x30')](_0x56c295||0x3,_0x88ba('0x31'));}else{if(_0x409c56[_0x88ba('0x21')]==0x0){_0x5b333f=moment(_0x409c56['scheduledat']);}else{_0x5b333f=moment()[_0x88ba('0x30')](_0x56c295||0x3,_0x88ba('0x31'));}}var _0x1f2981={'phone':_0x3cd421['phone'],'active':0x0,'OrderBy':_['isNil'](_0x3cd421[_0x88ba('0x21')])?0x0:_0x3cd421[_0x88ba('0x21')],'scheduledat':moment()[_0x88ba('0x30')](_0x4ab94b||0x1,_0x88ba('0x31')),'countbusyretry':_0x2d372b[_0x88ba('0x23')],'countcongestionretry':_0x2d372b[_0x88ba('0x24')],'countnoanswerretry':_0x2d372b[_0x88ba('0x25')],'countnosuchnumberretry':_0x2d372b['countnosuchnumberretry'],'countdropretry':_0x2d372b[_0x88ba('0x27')],'countabandonedretry':_0x2d372b[_0x88ba('0x2b')],'countmachineretry':_0x2d372b['countmachineretry'],'countagentrejectretry':_0x2d372b[_0x88ba('0x28')],'createdAt':_0x2d372b[_0x88ba('0x32')],'updatedAt':_0x2d372b[_0x88ba('0x33')]};var _0x313f76={'CmHopperId':_0x3cd421['id'],'phone':_0x409c56[_0x88ba('0x34')],'active':0x0,'OrderBy':_[_0x88ba('0x35')](_0x409c56['OrderBy'])?0x0:_0x409c56[_0x88ba('0x21')],'scheduledat':_0x5b333f,'countbusyretry':_0x409c56[_0x88ba('0x23')],'countcongestionretry':_0x409c56[_0x88ba('0x24')],'countnoanswerretry':_0x409c56[_0x88ba('0x25')],'countnosuchnumberretry':_0x2d372b[_0x88ba('0x26')],'countdropretry':_0x2d372b[_0x88ba('0x27')],'countabandonedretry':_0x2d372b[_0x88ba('0x2b')],'countmachineretry':_0x2d372b[_0x88ba('0x2c')],'countagentrejectretry':_0x2d372b[_0x88ba('0x28')],'createdAt':_0x409c56[_0x88ba('0x32')],'updatedAt':_0x409c56[_0x88ba('0x33')]};logger[_0x88ba('0xd')](_0x88ba('0x36'),_0x1f2981);logger['info'](_0x88ba('0x37'),_0x313f76);return db['sequelize'][_0x88ba('0x38')](function(_0x5178aa){return db['CmHopperAdditionalPhone'][_0x88ba('0x39')](_0x1f2981,{'where':{'id':_0x409c56['id']}},{'transaction':_0x5178aa})[_0x88ba('0xc')](function(){return db[_0x88ba('0x19')][_0x88ba('0x39')](_0x313f76,{'where':{'id':_0x3cd421['id']}},{'transaction':_0x5178aa});});})['then'](function(_0x214259){_0x4129a7({'id':_0x3cd421['id'],'phone':_0x409c56[_0x88ba('0x34')]});})[_0x88ba('0x17')](function(_0x2ee719){logger[_0x88ba('0x13')](_0x88ba('0x18'),_0x2ee719[_0x88ba('0x15')],req);_0x407082(_this[_0x88ba('0x13')](0x1f4,_0x2ee719[_0x88ba('0x15')]));});});}exports[_0x88ba('0x3a')]=function(_0x365aea){var _0x4378b8=this;return new Promise(function(_0x15cfc0,_0x5aed6e){return db[_0x88ba('0x19')][_0x88ba('0x39')](_0x365aea[_0x88ba('0x1b')][_0x88ba('0x3b')],{'where':{'id':_0x365aea[_0x88ba('0x1b')]['id']}})[_0x88ba('0xc')](function(_0x93b4a){_0x15cfc0(_0x93b4a);})['catch'](function(_0x822762){logger[_0x88ba('0x13')](_0x88ba('0x3a'),_0x822762[_0x88ba('0x15')],_0x365aea);_0x5aed6e(_0x4378b8[_0x88ba('0x13')](0x1f4,_0x822762[_0x88ba('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 6952f4b..1d012f1 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 _0x7af9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','/:id','isAuthenticated','show','create','put','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x238277,_0x94aaa4){var _0x16cac5=function(_0x22b047){while(--_0x22b047){_0x238277['push'](_0x238277['shift']());}};_0x16cac5(++_0x94aaa4);}(_0x7af9,0x95));var _0x97af=function(_0x1ab09a,_0x48a80f){_0x1ab09a=_0x1ab09a-0x0;var _0x21f89d=_0x7af9[_0x1ab09a];return _0x21f89d;};'use strict';var multer=require(_0x97af('0x0'));var util=require('util');var path=require(_0x97af('0x1'));var timeout=require(_0x97af('0x2'));var express=require('express');var router=express[_0x97af('0x3')]();var auth=require(_0x97af('0x4'));var interaction=require(_0x97af('0x5'));var config=require(_0x97af('0x6'));var controller=require(_0x97af('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x97af('0x8')](_0x97af('0x9'),auth[_0x97af('0xa')](),controller[_0x97af('0xb')]);router['post']('/',auth[_0x97af('0xa')](),controller[_0x97af('0xc')]);router[_0x97af('0xd')]('/:id',auth[_0x97af('0xa')](),controller['update']);router[_0x97af('0xe')](_0x97af('0x9'),auth[_0x97af('0xa')](),controller[_0x97af('0xf')]);module[_0x97af('0x10')]=router; \ No newline at end of file +var _0x38b8=['path','connect-timeout','Router','../../config/environment','./cmHopperAdditionalPhone.controller','index','get','isAuthenticated','show','create','put','/:id','update','destroy','exports','multer'];(function(_0x4ea323,_0x2944d1){var _0x139cee=function(_0x483f4f){while(--_0x483f4f){_0x4ea323['push'](_0x4ea323['shift']());}};_0x139cee(++_0x2944d1);}(_0x38b8,0x7f));var _0x838b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38b8[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x838b('0x0'));var util=require('util');var path=require(_0x838b('0x1'));var timeout=require(_0x838b('0x2'));var express=require('express');var router=express[_0x838b('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x838b('0x4'));var controller=require(_0x838b('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x838b('0x6')]);router[_0x838b('0x7')]('/:id',auth[_0x838b('0x8')](),controller[_0x838b('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x838b('0xa')]);router[_0x838b('0xb')](_0x838b('0xc'),auth['isAuthenticated'](),controller[_0x838b('0xd')]);router['delete'](_0x838b('0xc'),auth[_0x838b('0x8')](),controller[_0x838b('0xe')]);module[_0x838b('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 6eaa9b9..4707d6e 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 _0x2552=['INTEGER','contactListQueue','moment'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x2552,0x1b5));var _0x2255=function(_0x1f6bd6,_0xe777a1){_0x1f6bd6=_0x1f6bd6-0x0;var _0x4ccb3d=_0x2552[_0x1f6bd6];return _0x4ccb3d;};'use strict';var moment=require(_0x2255('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x2255('0x1')],'unique':_0x2255('0x2')},'ListId':{'type':Sequelize[_0x2255('0x1')],'unique':_0x2255('0x2')},'VoiceQueueId':{'type':Sequelize[_0x2255('0x1')],'unique':_0x2255('0x2')}}; \ No newline at end of file +var _0x9616=['contactListQueue','moment','sequelize','STRING','INTEGER'];(function(_0x2af6c2,_0x1bc9de){var _0x17fe34=function(_0x3b3cac){while(--_0x3b3cac){_0x2af6c2['push'](_0x2af6c2['shift']());}};_0x17fe34(++_0x1bc9de);}(_0x9616,0x1a0));var _0x6961=function(_0x132d12,_0x2c9799){_0x132d12=_0x132d12-0x0;var _0x1c3163=_0x9616[_0x132d12];return _0x1c3163;};'use strict';var moment=require(_0x6961('0x0'));var Sequelize=require(_0x6961('0x1'));module['exports']={'phone':{'type':Sequelize[_0x6961('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x6961('0x3')],'unique':_0x6961('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x6961('0x4')},'VoiceQueueId':{'type':Sequelize[_0x6961('0x3')],'unique':_0x6961('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index ce4b660..ee9de85 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 _0xeda4=['apply','reject','save','update','destroy','stack','name','send','CmHopperBlack','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','merge','filter','options','then','includeAll','include','findAll','rows','catch','show','params','keys','filtears','find','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xeda4,0x190));var _0x4eda=function(_0x7148a3,_0x1c6652){_0x7148a3=_0x7148a3-0x0;var _0x52f31d=_0xeda4[_0x7148a3];return _0x52f31d;};'use strict';var pdf=require(_0x4eda('0x0'));var emlformat=require(_0x4eda('0x1'));var rimraf=require(_0x4eda('0x2'));var zipdir=require(_0x4eda('0x3'));var jsonpatch=require(_0x4eda('0x4'));var rp=require('request-promise');var moment=require(_0x4eda('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4eda('0x6'));var util=require(_0x4eda('0x7'));var path=require('path');var sox=require(_0x4eda('0x8'));var csv=require(_0x4eda('0x9'));var ejs=require(_0x4eda('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4eda('0xb'));var crypto=require('crypto');var jsforce=require(_0x4eda('0xc'));var deskjs=require(_0x4eda('0xd'));var toCsv=require(_0x4eda('0x9'));var querystring=require(_0x4eda('0xe'));var Papa=require(_0x4eda('0xf'));var Redis=require(_0x4eda('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4eda('0x11'));var as=require(_0x4eda('0x12'));var hardwareService=require(_0x4eda('0x13'));var logger=require(_0x4eda('0x14'))('api');var utils=require(_0x4eda('0x15'));var config=require(_0x4eda('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4eda('0x17'))['db'];function respondWithStatusCode(_0x3d74bc,_0x5463bd){_0x5463bd=_0x5463bd||0xcc;return function(_0x4e8944){if(_0x4e8944){return _0x3d74bc[_0x4eda('0x18')](_0x5463bd);}return _0x3d74bc['status'](_0x5463bd)[_0x4eda('0x19')]();};}function respondWithResult(_0x1ecbc0,_0x43c68d){_0x43c68d=_0x43c68d||0xc8;return function(_0x2c5cb4){if(_0x2c5cb4){return _0x1ecbc0[_0x4eda('0x1a')](_0x43c68d)[_0x4eda('0x1b')](_0x2c5cb4);}};}function respondWithFilteredResult(_0x3a22c8,_0x13ec7b){return function(_0x1ae8ef){if(_0x1ae8ef){var _0x2d6774=_0x1ae8ef[_0x4eda('0x1c')],_0x557b40=_0x13ec7b[_0x4eda('0x1d')],_0x30c97e=_0x13ec7b[_0x4eda('0x1d')]+_0x13ec7b['limit'],_0x4e4cbb;if(_0x30c97e>=_0x2d6774){_0x30c97e=_0x2d6774;_0x4e4cbb=0xc8;}else{_0x4e4cbb=0xce;}_0x3a22c8[_0x4eda('0x1a')](_0x4e4cbb);return _0x3a22c8[_0x4eda('0x1e')](_0x4eda('0x1f'),_0x557b40+'-'+_0x30c97e+'/'+_0x2d6774)['json'](_0x1ae8ef);}return null;};}function patchUpdates(_0x2c628d){return function(_0x4a168e){try{jsonpatch[_0x4eda('0x20')](_0x4a168e,_0x2c628d,!![]);}catch(_0x42b028){return BPromise[_0x4eda('0x21')](_0x42b028);}return _0x4a168e[_0x4eda('0x22')]();};}function saveUpdates(_0x2d6c03,_0x58b936){return function(_0x21faa7){if(_0x21faa7){return _0x21faa7[_0x4eda('0x23')](_0x2d6c03)['then'](function(_0x17a856){return _0x17a856;});}return null;};}function removeEntity(_0x4cb4d2,_0xb36131){return function(_0x309bbb){if(_0x309bbb){return _0x309bbb[_0x4eda('0x24')]()['then'](function(){_0x4cb4d2[_0x4eda('0x1a')](0xcc)[_0x4eda('0x19')]();});}};}function handleEntityNotFound(_0x3b7721,_0x4eb4e6){return function(_0x5c94e3){if(!_0x5c94e3){_0x3b7721[_0x4eda('0x18')](0x194);}return _0x5c94e3;};}function handleError(_0x2cc31a,_0x12cbe4){_0x12cbe4=_0x12cbe4||0x1f4;return function(_0x2fd049){logger['error'](_0x2fd049[_0x4eda('0x25')]);if(_0x2fd049[_0x4eda('0x26')]){delete _0x2fd049['name'];}_0x2cc31a[_0x4eda('0x1a')](_0x12cbe4)[_0x4eda('0x27')](_0x2fd049);};}exports['index']=function(_0x3deeb0,_0x1e7948){var _0x2353d5={},_0xb0b048={},_0x38d033={'count':0x0,'rows':[]};var _0x4a431b=_['map'](db[_0x4eda('0x28')][_0x4eda('0x29')],function(_0x10257c){return{'name':_0x10257c[_0x4eda('0x2a')],'type':_0x10257c[_0x4eda('0x2b')]['key']};});_0xb0b048[_0x4eda('0x2c')]=_['map'](_0x4a431b,_0x4eda('0x26'));_0xb0b048[_0x4eda('0x2d')]=_['keys'](_0x3deeb0['query']);_0xb0b048[_0x4eda('0x2e')]=_[_0x4eda('0x2f')](_0xb0b048[_0x4eda('0x2c')],_0xb0b048[_0x4eda('0x2d')]);_0x2353d5[_0x4eda('0x30')]=_[_0x4eda('0x2f')](_0xb0b048['model'],qs[_0x4eda('0x31')](_0x3deeb0[_0x4eda('0x2d')][_0x4eda('0x31')]));_0x2353d5['attributes']=_0x2353d5['attributes'][_0x4eda('0x32')]?_0x2353d5[_0x4eda('0x30')]:_0xb0b048[_0x4eda('0x2c')];if(!_0x3deeb0['query'][_0x4eda('0x33')]('nolimit')){_0x2353d5[_0x4eda('0x34')]=qs[_0x4eda('0x34')](_0x3deeb0[_0x4eda('0x2d')][_0x4eda('0x34')]);_0x2353d5[_0x4eda('0x1d')]=qs[_0x4eda('0x1d')](_0x3deeb0[_0x4eda('0x2d')]['offset']);}_0x2353d5[_0x4eda('0x35')]=qs[_0x4eda('0x36')](_0x3deeb0['query']['sort']);_0x2353d5[_0x4eda('0x37')]=qs[_0x4eda('0x2e')](_['pick'](_0x3deeb0[_0x4eda('0x2d')],_0xb0b048[_0x4eda('0x2e')]),_0x4a431b);if(_0x3deeb0[_0x4eda('0x2d')]['filter']){_0x2353d5[_0x4eda('0x37')]=_[_0x4eda('0x38')](_0x2353d5[_0x4eda('0x37')],{'$or':_['map'](_0x4a431b,function(_0x216281){if(_0x216281[_0x4eda('0x2b')]!=='VIRTUAL'){var _0x5ec20b={};_0x5ec20b[_0x216281[_0x4eda('0x26')]]={'$like':'%'+_0x3deeb0['query'][_0x4eda('0x39')]+'%'};return _0x5ec20b;}})});}_0x2353d5=_[_0x4eda('0x38')]({},_0x2353d5,_0x3deeb0[_0x4eda('0x3a')]);var _0x8c78ad={'where':_0x2353d5['where']};return db['CmHopperBlack'][_0x4eda('0x1c')](_0x8c78ad)[_0x4eda('0x3b')](function(_0x2e9461){_0x38d033[_0x4eda('0x1c')]=_0x2e9461;if(_0x3deeb0[_0x4eda('0x2d')][_0x4eda('0x3c')]){_0x2353d5[_0x4eda('0x3d')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x4eda('0x3e')](_0x2353d5);})[_0x4eda('0x3b')](function(_0x5d8b68){_0x38d033[_0x4eda('0x3f')]=_0x5d8b68;return _0x38d033;})['then'](respondWithFilteredResult(_0x1e7948,_0x2353d5))[_0x4eda('0x40')](handleError(_0x1e7948,null));};exports[_0x4eda('0x41')]=function(_0x281ee6,_0x3b2f55){var _0x1739ae={'raw':!![],'where':{'id':_0x281ee6[_0x4eda('0x42')]['id']}},_0x4be0f2={};_0x4be0f2[_0x4eda('0x2c')]=_['keys'](db[_0x4eda('0x28')][_0x4eda('0x29')]);_0x4be0f2[_0x4eda('0x2d')]=_[_0x4eda('0x43')](_0x281ee6[_0x4eda('0x2d')]);_0x4be0f2[_0x4eda('0x44')]=_[_0x4eda('0x2f')](_0x4be0f2[_0x4eda('0x2c')],_0x4be0f2[_0x4eda('0x2d')]);_0x1739ae[_0x4eda('0x30')]=_['intersection'](_0x4be0f2[_0x4eda('0x2c')],qs[_0x4eda('0x31')](_0x281ee6[_0x4eda('0x2d')]['fields']));_0x1739ae[_0x4eda('0x30')]=_0x1739ae[_0x4eda('0x30')]['length']?_0x1739ae[_0x4eda('0x30')]:_0x4be0f2[_0x4eda('0x2c')];if(_0x281ee6[_0x4eda('0x2d')]['includeAll']){_0x1739ae[_0x4eda('0x3d')]=[{'all':!![]}];}_0x1739ae=_[_0x4eda('0x38')]({},_0x1739ae,_0x281ee6[_0x4eda('0x3a')]);return db[_0x4eda('0x28')][_0x4eda('0x45')](_0x1739ae)[_0x4eda('0x3b')](handleEntityNotFound(_0x3b2f55,null))[_0x4eda('0x3b')](respondWithResult(_0x3b2f55,null))[_0x4eda('0x40')](handleError(_0x3b2f55,null));};exports[_0x4eda('0x23')]=function(_0x58fae5,_0x1a757e){if(_0x58fae5['body']['id']){delete _0x58fae5[_0x4eda('0x46')]['id'];}return db['CmHopperBlack'][_0x4eda('0x45')]({'where':{'id':_0x58fae5[_0x4eda('0x42')]['id']}})[_0x4eda('0x3b')](handleEntityNotFound(_0x1a757e,null))['then'](saveUpdates(_0x58fae5[_0x4eda('0x46')],null))['then'](respondWithResult(_0x1a757e,null))['catch'](handleError(_0x1a757e,null));};exports[_0x4eda('0x24')]=function(_0x152263,_0x129211){return db[_0x4eda('0x28')][_0x4eda('0x45')]({'where':{'id':_0x152263[_0x4eda('0x42')]['id']}})[_0x4eda('0x3b')](handleEntityNotFound(_0x129211,null))['then'](removeEntity(_0x129211,null))['catch'](handleError(_0x129211,null));};exports[_0x4eda('0x47')]=function(_0x1a4ff5,_0x6e6cbc){return db['CmHopperBlack'][_0x4eda('0x47')]()[_0x4eda('0x3b')](respondWithResult(_0x6e6cbc,null))[_0x4eda('0x40')](handleError(_0x6e6cbc,null));}; \ No newline at end of file +var _0x1a7e=['fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','CmHopperBlack','includeAll','include','findAll','rows','show','keys','filtears','find','catch','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','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','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes'];(function(_0x178e71,_0x5c6c7d){var _0x3eec6c=function(_0x406d3f){while(--_0x406d3f){_0x178e71['push'](_0x178e71['shift']());}};_0x3eec6c(++_0x5c6c7d);}(_0x1a7e,0xb5));var _0xe1a7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a7e[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xe1a7('0x0'));var emlformat=require(_0xe1a7('0x1'));var rimraf=require(_0xe1a7('0x2'));var zipdir=require(_0xe1a7('0x3'));var jsonpatch=require(_0xe1a7('0x4'));var rp=require('request-promise');var moment=require(_0xe1a7('0x5'));var BPromise=require(_0xe1a7('0x6'));var Mustache=require(_0xe1a7('0x7'));var util=require(_0xe1a7('0x8'));var path=require(_0xe1a7('0x9'));var sox=require('sox');var csv=require(_0xe1a7('0xa'));var ejs=require(_0xe1a7('0xb'));var fs=require('fs');var _=require(_0xe1a7('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe1a7('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe1a7('0xe'));var Papa=require(_0xe1a7('0xf'));var Redis=require(_0xe1a7('0x10'));var authService=require(_0xe1a7('0x11'));var qs=require(_0xe1a7('0x12'));var as=require(_0xe1a7('0x13'));var hardwareService=require(_0xe1a7('0x14'));var logger=require(_0xe1a7('0x15'))(_0xe1a7('0x16'));var utils=require(_0xe1a7('0x17'));var config=require(_0xe1a7('0x18'));var licenseUtil=require(_0xe1a7('0x19'));var db=require(_0xe1a7('0x1a'))['db'];function respondWithStatusCode(_0x15a59c,_0x31d68e){_0x31d68e=_0x31d68e||0xcc;return function(_0x5d602c){if(_0x5d602c){return _0x15a59c[_0xe1a7('0x1b')](_0x31d68e);}return _0x15a59c['status'](_0x31d68e)[_0xe1a7('0x1c')]();};}function respondWithResult(_0x32e1c0,_0x2e35fc){_0x2e35fc=_0x2e35fc||0xc8;return function(_0x2d1995){if(_0x2d1995){return _0x32e1c0[_0xe1a7('0x1d')](_0x2e35fc)[_0xe1a7('0x1e')](_0x2d1995);}};}function respondWithFilteredResult(_0x1a9f87,_0x576ecb){return function(_0x4d47d5){if(_0x4d47d5){var _0x528a86=_0x4d47d5[_0xe1a7('0x1f')],_0x2dacfd=_0x576ecb[_0xe1a7('0x20')],_0x44f39d=_0x576ecb[_0xe1a7('0x20')]+_0x576ecb[_0xe1a7('0x21')],_0x12f98c;if(_0x44f39d>=_0x528a86){_0x44f39d=_0x528a86;_0x12f98c=0xc8;}else{_0x12f98c=0xce;}_0x1a9f87[_0xe1a7('0x1d')](_0x12f98c);return _0x1a9f87[_0xe1a7('0x22')](_0xe1a7('0x23'),_0x2dacfd+'-'+_0x44f39d+'/'+_0x528a86)[_0xe1a7('0x1e')](_0x4d47d5);}return null;};}function patchUpdates(_0x4b1453){return function(_0x41232f){try{jsonpatch[_0xe1a7('0x24')](_0x41232f,_0x4b1453,!![]);}catch(_0x3f9e45){return BPromise[_0xe1a7('0x25')](_0x3f9e45);}return _0x41232f['save']();};}function saveUpdates(_0x253a13,_0x1c6d7c){return function(_0x42e6fd){if(_0x42e6fd){return _0x42e6fd[_0xe1a7('0x26')](_0x253a13)['then'](function(_0x27d5e5){return _0x27d5e5;});}return null;};}function removeEntity(_0x2f3a85,_0xb8715){return function(_0x2d128d){if(_0x2d128d){return _0x2d128d[_0xe1a7('0x27')]()[_0xe1a7('0x28')](function(){_0x2f3a85[_0xe1a7('0x1d')](0xcc)[_0xe1a7('0x1c')]();});}};}function handleEntityNotFound(_0x3823da,_0x312b02){return function(_0x1fa517){if(!_0x1fa517){_0x3823da[_0xe1a7('0x1b')](0x194);}return _0x1fa517;};}function handleError(_0x19b4a6,_0x46623d){_0x46623d=_0x46623d||0x1f4;return function(_0xc4132c){logger['error'](_0xc4132c[_0xe1a7('0x29')]);if(_0xc4132c[_0xe1a7('0x2a')]){delete _0xc4132c['name'];}_0x19b4a6[_0xe1a7('0x1d')](_0x46623d)[_0xe1a7('0x2b')](_0xc4132c);};}exports[_0xe1a7('0x2c')]=function(_0x2ca32f,_0x2621a1){var _0x3f2881={},_0x4e3f1c={},_0x6cf920={'count':0x0,'rows':[]};var _0x3db0d5=_['map'](db['CmHopperBlack'][_0xe1a7('0x2d')],function(_0x18bf28){return{'name':_0x18bf28[_0xe1a7('0x2e')],'type':_0x18bf28['type'][_0xe1a7('0x2f')]};});_0x4e3f1c[_0xe1a7('0x30')]=_['map'](_0x3db0d5,_0xe1a7('0x2a'));_0x4e3f1c[_0xe1a7('0x31')]=_['keys'](_0x2ca32f[_0xe1a7('0x31')]);_0x4e3f1c[_0xe1a7('0x32')]=_[_0xe1a7('0x33')](_0x4e3f1c['model'],_0x4e3f1c[_0xe1a7('0x31')]);_0x3f2881[_0xe1a7('0x34')]=_[_0xe1a7('0x33')](_0x4e3f1c[_0xe1a7('0x30')],qs[_0xe1a7('0x35')](_0x2ca32f[_0xe1a7('0x31')]['fields']));_0x3f2881[_0xe1a7('0x34')]=_0x3f2881['attributes'][_0xe1a7('0x36')]?_0x3f2881[_0xe1a7('0x34')]:_0x4e3f1c[_0xe1a7('0x30')];if(!_0x2ca32f[_0xe1a7('0x31')][_0xe1a7('0x37')](_0xe1a7('0x38'))){_0x3f2881['limit']=qs[_0xe1a7('0x21')](_0x2ca32f[_0xe1a7('0x31')]['limit']);_0x3f2881[_0xe1a7('0x20')]=qs[_0xe1a7('0x20')](_0x2ca32f[_0xe1a7('0x31')][_0xe1a7('0x20')]);}_0x3f2881['order']=qs[_0xe1a7('0x39')](_0x2ca32f[_0xe1a7('0x31')][_0xe1a7('0x39')]);_0x3f2881[_0xe1a7('0x3a')]=qs[_0xe1a7('0x32')](_[_0xe1a7('0x3b')](_0x2ca32f[_0xe1a7('0x31')],_0x4e3f1c[_0xe1a7('0x32')]),_0x3db0d5);if(_0x2ca32f[_0xe1a7('0x31')]['filter']){_0x3f2881[_0xe1a7('0x3a')]=_[_0xe1a7('0x3c')](_0x3f2881[_0xe1a7('0x3a')],{'$or':_['map'](_0x3db0d5,function(_0x1b6fd9){if(_0x1b6fd9[_0xe1a7('0x3d')]!==_0xe1a7('0x3e')){var _0x459704={};_0x459704[_0x1b6fd9[_0xe1a7('0x2a')]]={'$like':'%'+_0x2ca32f[_0xe1a7('0x31')][_0xe1a7('0x3f')]+'%'};return _0x459704;}})});}_0x3f2881=_[_0xe1a7('0x3c')]({},_0x3f2881,_0x2ca32f[_0xe1a7('0x40')]);var _0x248c4b={'where':_0x3f2881['where']};return db[_0xe1a7('0x41')][_0xe1a7('0x1f')](_0x248c4b)['then'](function(_0x5348e9){_0x6cf920[_0xe1a7('0x1f')]=_0x5348e9;if(_0x2ca32f[_0xe1a7('0x31')][_0xe1a7('0x42')]){_0x3f2881[_0xe1a7('0x43')]=[{'all':!![]}];}return db[_0xe1a7('0x41')][_0xe1a7('0x44')](_0x3f2881);})[_0xe1a7('0x28')](function(_0x4fd9d2){_0x6cf920[_0xe1a7('0x45')]=_0x4fd9d2;return _0x6cf920;})['then'](respondWithFilteredResult(_0x2621a1,_0x3f2881))['catch'](handleError(_0x2621a1,null));};exports[_0xe1a7('0x46')]=function(_0x2d2c67,_0x593dc2){var _0x565142={'raw':!![],'where':{'id':_0x2d2c67['params']['id']}},_0x427144={};_0x427144[_0xe1a7('0x30')]=_[_0xe1a7('0x47')](db[_0xe1a7('0x41')][_0xe1a7('0x2d')]);_0x427144[_0xe1a7('0x31')]=_['keys'](_0x2d2c67[_0xe1a7('0x31')]);_0x427144[_0xe1a7('0x48')]=_[_0xe1a7('0x33')](_0x427144[_0xe1a7('0x30')],_0x427144['query']);_0x565142[_0xe1a7('0x34')]=_['intersection'](_0x427144['model'],qs[_0xe1a7('0x35')](_0x2d2c67[_0xe1a7('0x31')][_0xe1a7('0x35')]));_0x565142[_0xe1a7('0x34')]=_0x565142[_0xe1a7('0x34')][_0xe1a7('0x36')]?_0x565142[_0xe1a7('0x34')]:_0x427144[_0xe1a7('0x30')];if(_0x2d2c67[_0xe1a7('0x31')][_0xe1a7('0x42')]){_0x565142['include']=[{'all':!![]}];}_0x565142=_[_0xe1a7('0x3c')]({},_0x565142,_0x2d2c67[_0xe1a7('0x40')]);return db['CmHopperBlack'][_0xe1a7('0x49')](_0x565142)[_0xe1a7('0x28')](handleEntityNotFound(_0x593dc2,null))[_0xe1a7('0x28')](respondWithResult(_0x593dc2,null))[_0xe1a7('0x4a')](handleError(_0x593dc2,null));};exports['update']=function(_0x598b49,_0x24ce76){if(_0x598b49[_0xe1a7('0x4b')]['id']){delete _0x598b49[_0xe1a7('0x4b')]['id'];}return db[_0xe1a7('0x41')]['find']({'where':{'id':_0x598b49['params']['id']}})[_0xe1a7('0x28')](handleEntityNotFound(_0x24ce76,null))[_0xe1a7('0x28')](saveUpdates(_0x598b49[_0xe1a7('0x4b')],null))[_0xe1a7('0x28')](respondWithResult(_0x24ce76,null))[_0xe1a7('0x4a')](handleError(_0x24ce76,null));};exports['destroy']=function(_0xaeb0a3,_0x5141dd){return db['CmHopperBlack'][_0xe1a7('0x49')]({'where':{'id':_0xaeb0a3[_0xe1a7('0x4c')]['id']}})[_0xe1a7('0x28')](handleEntityNotFound(_0x5141dd,null))[_0xe1a7('0x28')](removeEntity(_0x5141dd,null))[_0xe1a7('0x4a')](handleError(_0x5141dd,null));};exports[_0xe1a7('0x4d')]=function(_0x21785d,_0xdf4866){return db[_0xe1a7('0x41')]['describe']()[_0xe1a7('0x28')](respondWithResult(_0xdf4866,null))['catch'](handleError(_0xdf4866,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index ee5716b..4b8bafa 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 _0x135d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x135d,0xfb));var _0xd135=function(_0x3299d4,_0x45d64c){_0x3299d4=_0x3299d4-0x0;var _0x10624c=_0x135d[_0x3299d4];return _0x10624c;};'use strict';var _=require(_0xd135('0x0'));var util=require(_0xd135('0x1'));var logger=require(_0xd135('0x2'))(_0xd135('0x3'));var moment=require(_0xd135('0x4'));var BPromise=require(_0xd135('0x5'));var rp=require(_0xd135('0x6'));var fs=require('fs');var path=require(_0xd135('0x7'));var rimraf=require(_0xd135('0x8'));var config=require(_0xd135('0x9'));var attributes=require(_0xd135('0xa'));module[_0xd135('0xb')]=function(_0x20b43c,_0xa0d46e){return _0x20b43c[_0xd135('0xc')]('CmHopperBlack',attributes,{'tableName':_0xd135('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0cc=['rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','../../config/logger','api','path'];(function(_0x1d1080,_0x7a3934){var _0xfc24ee=function(_0x5eb94a){while(--_0x5eb94a){_0x1d1080['push'](_0x1d1080['shift']());}};_0xfc24ee(++_0x7a3934);}(_0xb0cc,0x103));var _0xcb0c=function(_0x242303,_0x1ca58e){_0x242303=_0x242303-0x0;var _0x45ef07=_0xb0cc[_0x242303];return _0x45ef07;};'use strict';var _=require(_0xcb0c('0x0'));var util=require(_0xcb0c('0x1'));var logger=require(_0xcb0c('0x2'))(_0xcb0c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb0c('0x4'));var rimraf=require(_0xcb0c('0x5'));var config=require(_0xcb0c('0x6'));var attributes=require(_0xcb0c('0x7'));module[_0xcb0c('0x8')]=function(_0x241980,_0x52597e){return _0x241980[_0xcb0c('0x9')]('CmHopperBlack',attributes,{'tableName':_0xcb0c('0xa'),'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 dab2a47..c0310d8 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 _0x3f91=['error','code','message','CmHopperBlack,\x20%s,\x20%s','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','include','map','model','stringify','catch','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s'];(function(_0x2353c6,_0x581cd9){var _0x169845=function(_0x45b275){while(--_0x45b275){_0x2353c6['push'](_0x2353c6['shift']());}};_0x169845(++_0x581cd9);}(_0x3f91,0x106));var _0x13f9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3f91[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x13f9('0x0'));var util=require(_0x13f9('0x1'));var moment=require(_0x13f9('0x2'));var BPromise=require(_0x13f9('0x3'));var rs=require(_0x13f9('0x4'));var fs=require('fs');var Redis=require(_0x13f9('0x5'));var db=require(_0x13f9('0x6'))['db'];var utils=require(_0x13f9('0x7'));var logger=require('../../config/logger')(_0x13f9('0x8'));var config=require('../../config/environment');var jayson=require(_0x13f9('0x9'));var client=jayson[_0x13f9('0xa')][_0x13f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e1f4d,_0x466403,_0x227f0a){return new BPromise(function(_0x540f78,_0x3d3bf7){return client[_0x13f9('0xc')](_0x5e1f4d,_0x227f0a)[_0x13f9('0xd')](function(_0x104138){logger[_0x13f9('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x466403,_0x13f9('0xf'));logger[_0x13f9('0x10')](_0x13f9('0x11'),_0x466403,_0x13f9('0xf'),JSON['stringify'](_0x104138));if(_0x104138[_0x13f9('0x12')]){if(_0x104138['error'][_0x13f9('0x13')]===0x1f4){logger[_0x13f9('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x466403,_0x104138[_0x13f9('0x12')][_0x13f9('0x14')]);return _0x3d3bf7(_0x104138[_0x13f9('0x12')][_0x13f9('0x14')]);}logger[_0x13f9('0x12')](_0x13f9('0x15'),_0x466403,_0x104138[_0x13f9('0x12')][_0x13f9('0x14')]);return _0x540f78(_0x104138[_0x13f9('0x12')][_0x13f9('0x14')]);}else{logger[_0x13f9('0xe')](_0x13f9('0x15'),_0x466403,_0x13f9('0xf'));_0x540f78(_0x104138[_0x13f9('0x16')][_0x13f9('0x14')]);}})['catch'](function(_0x440a70){logger[_0x13f9('0x12')](_0x13f9('0x15'),_0x466403,_0x440a70);_0x3d3bf7(_0x440a70);});});}exports[_0x13f9('0x17')]=function(_0x16e811){var _0x56005e=this;return new Promise(function(_0x41a195,_0x35f07e){return db[_0x13f9('0x18')][_0x13f9('0x19')]({'raw':_0x16e811[_0x13f9('0x1a')]?_0x16e811[_0x13f9('0x1a')][_0x13f9('0x1b')]===undefined?!![]:![]:!![],'where':_0x16e811[_0x13f9('0x1a')]?_0x16e811[_0x13f9('0x1a')][_0x13f9('0x1c')]||null:null,'attributes':_0x16e811[_0x13f9('0x1a')]?_0x16e811[_0x13f9('0x1a')][_0x13f9('0x1d')]||null:null,'limit':_0x16e811[_0x13f9('0x1a')]?_0x16e811[_0x13f9('0x1a')]['limit']||null:null,'include':_0x16e811[_0x13f9('0x1a')]?_0x16e811[_0x13f9('0x1a')][_0x13f9('0x1e')]?_['map'](_0x16e811['options'][_0x13f9('0x1e')],function(_0xe29cea){return{'model':db[_0xe29cea['model']],'as':_0xe29cea['as'],'attributes':_0xe29cea[_0x13f9('0x1d')],'include':_0xe29cea[_0x13f9('0x1e')]?_[_0x13f9('0x1f')](_0xe29cea[_0x13f9('0x1e')],function(_0x41f735){return{'model':db[_0x41f735[_0x13f9('0x20')]],'as':_0x41f735['as'],'attributes':_0x41f735[_0x13f9('0x1d')],'include':_0x41f735[_0x13f9('0x1e')]?_['map'](_0x41f735[_0x13f9('0x1e')],function(_0x5f0c03){return{'model':db[_0x5f0c03[_0x13f9('0x20')]],'as':_0x5f0c03['as'],'attributes':_0x5f0c03[_0x13f9('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47ec2d){logger[_0x13f9('0xe')](_0x13f9('0x17'),_0x16e811);logger[_0x13f9('0x10')](_0x13f9('0x17'),_0x16e811,JSON[_0x13f9('0x21')](_0x47ec2d));_0x41a195(_0x47ec2d);})[_0x13f9('0x22')](function(_0x2482f0){logger[_0x13f9('0x12')](_0x13f9('0x17'),_0x2482f0[_0x13f9('0x14')],_0x16e811);_0x35f07e(_0x56005e[_0x13f9('0x12')](0x1f4,_0x2482f0[_0x13f9('0x14')]));});});};exports[_0x13f9('0x23')]=function(_0x59e502){var _0x1c713d=this;return new Promise(function(_0x534898,_0x205acf){return db[_0x13f9('0x18')][_0x13f9('0x24')](_0x59e502[_0x13f9('0x25')],{'raw':_0x59e502[_0x13f9('0x1a')]?_0x59e502[_0x13f9('0x1a')][_0x13f9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59e502['options']?_0x59e502['options']['where']||null:null,'attributes':_0x59e502[_0x13f9('0x1a')]?_0x59e502[_0x13f9('0x1a')][_0x13f9('0x1d')]||null:null,'limit':_0x59e502['options']?_0x59e502['options']['limit']||null:null})[_0x13f9('0xd')](function(_0x473333){logger[_0x13f9('0xe')](_0x13f9('0x23'),_0x59e502);logger['debug']('UpdateCmHopperBlack',_0x59e502,JSON[_0x13f9('0x21')](_0x473333));_0x534898(_0x473333);})[_0x13f9('0x22')](function(_0xcf4dbf){logger['error'](_0x13f9('0x23'),_0xcf4dbf[_0x13f9('0x14')],_0x59e502);_0x205acf(_0x1c713d[_0x13f9('0x12')](0x1f4,_0xcf4dbf[_0x13f9('0x14')]));});});};exports[_0x13f9('0x26')]=function(_0x468203){var _0x52e7de=this;return new Promise(function(_0x8b0aad,_0x4cef5c){return db[_0x13f9('0x18')][_0x13f9('0x27')]({'where':_0x468203[_0x13f9('0x1a')]?_0x468203['options']['where']||null:null})[_0x13f9('0xd')](function(_0x105ce2){logger[_0x13f9('0xe')](_0x13f9('0x26'),_0x468203);logger[_0x13f9('0x10')](_0x13f9('0x26'),_0x468203,JSON[_0x13f9('0x21')](_0x105ce2));_0x8b0aad(_0x105ce2);})['catch'](function(_0x173e17){logger[_0x13f9('0x12')](_0x13f9('0x26'),_0x173e17[_0x13f9('0x14')],_0x468203);_0x4cef5c(_0x52e7de[_0x13f9('0x12')](0x1f4,_0x173e17[_0x13f9('0x14')]));});});}; \ No newline at end of file +var _0xb9ec=['DestroyCmHopperBlack','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','then','body','UpdateCmHopperBlack'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xb9ec,0x14e));var _0xcb9e=function(_0x3a0edc,_0x30b9a8){_0x3a0edc=_0x3a0edc-0x0;var _0x13df80=_0xb9ec[_0x3a0edc];return _0x13df80;};'use strict';var _=require(_0xcb9e('0x0'));var util=require(_0xcb9e('0x1'));var moment=require(_0xcb9e('0x2'));var BPromise=require(_0xcb9e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb9e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcb9e('0x5'))(_0xcb9e('0x6'));var config=require(_0xcb9e('0x7'));var jayson=require(_0xcb9e('0x8'));var client=jayson[_0xcb9e('0x9')][_0xcb9e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4edd6a,_0x192691,_0x3aa79f){return new BPromise(function(_0x2d8b62,_0x2a8085){return client['request'](_0x4edd6a,_0x3aa79f)['then'](function(_0x597582){logger['info'](_0xcb9e('0xb'),_0x192691,_0xcb9e('0xc'));logger[_0xcb9e('0xd')](_0xcb9e('0xe'),_0x192691,'request\x20sent',JSON[_0xcb9e('0xf')](_0x597582));if(_0x597582[_0xcb9e('0x10')]){if(_0x597582['error'][_0xcb9e('0x11')]===0x1f4){logger[_0xcb9e('0x10')](_0xcb9e('0xb'),_0x192691,_0x597582['error']['message']);return _0x2a8085(_0x597582[_0xcb9e('0x10')][_0xcb9e('0x12')]);}logger[_0xcb9e('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x192691,_0x597582[_0xcb9e('0x10')][_0xcb9e('0x12')]);return _0x2d8b62(_0x597582[_0xcb9e('0x10')]['message']);}else{logger[_0xcb9e('0x13')](_0xcb9e('0xb'),_0x192691,_0xcb9e('0xc'));_0x2d8b62(_0x597582[_0xcb9e('0x14')][_0xcb9e('0x12')]);}})[_0xcb9e('0x15')](function(_0x11a3ec){logger[_0xcb9e('0x10')](_0xcb9e('0xb'),_0x192691,_0x11a3ec);_0x2a8085(_0x11a3ec);});});}exports[_0xcb9e('0x16')]=function(_0x5308d7){var _0x471902=this;return new Promise(function(_0x173a8d,_0x28ddea){return db[_0xcb9e('0x17')][_0xcb9e('0x18')]({'raw':_0x5308d7[_0xcb9e('0x19')]?_0x5308d7[_0xcb9e('0x19')][_0xcb9e('0x1a')]===undefined?!![]:![]:!![],'where':_0x5308d7['options']?_0x5308d7['options'][_0xcb9e('0x1b')]||null:null,'attributes':_0x5308d7[_0xcb9e('0x19')]?_0x5308d7[_0xcb9e('0x19')][_0xcb9e('0x1c')]||null:null,'limit':_0x5308d7[_0xcb9e('0x19')]?_0x5308d7[_0xcb9e('0x19')][_0xcb9e('0x1d')]||null:null,'include':_0x5308d7[_0xcb9e('0x19')]?_0x5308d7[_0xcb9e('0x19')][_0xcb9e('0x1e')]?_['map'](_0x5308d7[_0xcb9e('0x19')][_0xcb9e('0x1e')],function(_0x1a91b3){return{'model':db[_0x1a91b3['model']],'as':_0x1a91b3['as'],'attributes':_0x1a91b3[_0xcb9e('0x1c')],'include':_0x1a91b3[_0xcb9e('0x1e')]?_[_0xcb9e('0x1f')](_0x1a91b3[_0xcb9e('0x1e')],function(_0x5a726e){return{'model':db[_0x5a726e[_0xcb9e('0x20')]],'as':_0x5a726e['as'],'attributes':_0x5a726e[_0xcb9e('0x1c')],'include':_0x5a726e[_0xcb9e('0x1e')]?_[_0xcb9e('0x1f')](_0x5a726e['include'],function(_0x5eb47b){return{'model':db[_0x5eb47b[_0xcb9e('0x20')]],'as':_0x5eb47b['as'],'attributes':_0x5eb47b[_0xcb9e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcb9e('0x21')](function(_0x325f91){logger[_0xcb9e('0x13')](_0xcb9e('0x16'),_0x5308d7);logger[_0xcb9e('0xd')](_0xcb9e('0x16'),_0x5308d7,JSON['stringify'](_0x325f91));_0x173a8d(_0x325f91);})['catch'](function(_0x369764){logger[_0xcb9e('0x10')](_0xcb9e('0x16'),_0x369764[_0xcb9e('0x12')],_0x5308d7);_0x28ddea(_0x471902[_0xcb9e('0x10')](0x1f4,_0x369764[_0xcb9e('0x12')]));});});};exports['UpdateCmHopperBlack']=function(_0x8b9521){var _0x55a54b=this;return new Promise(function(_0x44b61a,_0x1dd647){return db[_0xcb9e('0x17')]['update'](_0x8b9521[_0xcb9e('0x22')],{'raw':_0x8b9521[_0xcb9e('0x19')]?_0x8b9521[_0xcb9e('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8b9521[_0xcb9e('0x19')]?_0x8b9521[_0xcb9e('0x19')]['where']||null:null,'attributes':_0x8b9521[_0xcb9e('0x19')]?_0x8b9521[_0xcb9e('0x19')][_0xcb9e('0x1c')]||null:null,'limit':_0x8b9521[_0xcb9e('0x19')]?_0x8b9521[_0xcb9e('0x19')]['limit']||null:null})[_0xcb9e('0x21')](function(_0x39e6e5){logger['info'](_0xcb9e('0x23'),_0x8b9521);logger['debug'](_0xcb9e('0x23'),_0x8b9521,JSON['stringify'](_0x39e6e5));_0x44b61a(_0x39e6e5);})[_0xcb9e('0x15')](function(_0x57e373){logger[_0xcb9e('0x10')](_0xcb9e('0x23'),_0x57e373[_0xcb9e('0x12')],_0x8b9521);_0x1dd647(_0x55a54b[_0xcb9e('0x10')](0x1f4,_0x57e373['message']));});});};exports['DestroyCmHopperBlack']=function(_0x230f1c){var _0x10e9aa=this;return new Promise(function(_0x1a5990,_0x38cc1c){return db[_0xcb9e('0x17')]['destroy']({'where':_0x230f1c['options']?_0x230f1c[_0xcb9e('0x19')][_0xcb9e('0x1b')]||null:null})['then'](function(_0x3b22ce){logger[_0xcb9e('0x13')](_0xcb9e('0x24'),_0x230f1c);logger[_0xcb9e('0xd')]('DestroyCmHopperBlack',_0x230f1c,JSON[_0xcb9e('0xf')](_0x3b22ce));_0x1a5990(_0x3b22ce);})['catch'](function(_0x4e4452){logger[_0xcb9e('0x10')](_0xcb9e('0x24'),_0x4e4452[_0xcb9e('0x12')],_0x230f1c);_0x38cc1c(_0x10e9aa[_0xcb9e('0x10')](0x1f4,_0x4e4452[_0xcb9e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 7873b11..ec30b02 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 _0x6f0d=['update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','describe','show','put','/:id'];(function(_0x21b119,_0x20266d){var _0xabdfdd=function(_0xcb35f0){while(--_0xcb35f0){_0x21b119['push'](_0x21b119['shift']());}};_0xabdfdd(++_0x20266d);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x245185,_0xd56549){_0x245185=_0x245185-0x0;var _0x19fc74=_0x6f0d[_0x245185];return _0x19fc74;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var auth=require(_0xd6f0('0x4'));var interaction=require(_0xd6f0('0x5'));var config=require(_0xd6f0('0x6'));var controller=require(_0xd6f0('0x7'));router[_0xd6f0('0x8')]('/',auth['isAuthenticated'](),controller[_0xd6f0('0x9')]);router['get'](_0xd6f0('0xa'),auth[_0xd6f0('0xb')](),controller[_0xd6f0('0xc')]);router[_0xd6f0('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd6f0('0xd')]);router[_0xd6f0('0xe')](_0xd6f0('0xf'),auth[_0xd6f0('0xb')](),controller[_0xd6f0('0x10')]);router['delete'](_0xd6f0('0xf'),auth[_0xd6f0('0xb')](),controller[_0xd6f0('0x11')]);module[_0xd6f0('0x12')]=router; \ No newline at end of file +var _0x207c=['./cmHopperBlack.controller','get','/describe','isAuthenticated','/:id','put','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x459a0a,_0x25c46f){var _0x4ab46c=function(_0x451a6a){while(--_0x451a6a){_0x459a0a['push'](_0x459a0a['shift']());}};_0x4ab46c(++_0x25c46f);}(_0x207c,0x1e8));var _0xc207=function(_0xfcc0e,_0x1da886){_0xfcc0e=_0xfcc0e-0x0;var _0x32bb2e=_0x207c[_0xfcc0e];return _0x32bb2e;};'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('0xc')](_0xc207('0xb'),auth[_0xc207('0xa')](),controller[_0xc207('0xd')]);router[_0xc207('0xe')](_0xc207('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index cbfbb20..a1e99e0 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 _0x089f=['exports','INTEGER','STRING','DATE','getDataValue','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','moment'];(function(_0x24b6c2,_0x143219){var _0x21bef5=function(_0x3250a0){while(--_0x3250a0){_0x24b6c2['push'](_0x24b6c2['shift']());}};_0x21bef5(++_0x143219);}(_0x089f,0x1c7));var _0xf089=function(_0x311704,_0x15923b){_0x311704=_0x311704-0x0;var _0x57ac17=_0x089f[_0x311704];return _0x57ac17;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf089('0x0'));module[_0xf089('0x1')]={'state':{'type':Sequelize[_0xf089('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf089('0x3')]},'scheduledat':{'type':Sequelize[_0xf089('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf089('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf089('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf089('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xf089('0x3')]},'originatecalleridname':{'type':Sequelize[_0xf089('0x3')]},'calleridnum':{'type':Sequelize[_0xf089('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xf089('0x4')]},'responsetime':{'type':Sequelize[_0xf089('0x4')]},'answertime':{'type':Sequelize[_0xf089('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf089('0x4')]},'ringtime':{'type':Sequelize[_0xf089('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf089('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf089('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf089('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf089('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xf089('0x3')]},'membername':{'type':Sequelize[_0xf089('0x3')]},'reason':{'type':Sequelize[_0xf089('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xf089('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf089('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4c22c7){var _0xa988bb=this[_0xf089('0x5')]('endtime');if(_0xa988bb&&_0x4c22c7){this[_0xf089('0x6')](_0xf089('0x7'),moment(_0x4c22c7)[_0xf089('0x8')](moment(_0xa988bb),_0xf089('0x9')));}return this['setDataValue'](_0xf089('0xa'),_0x4c22c7);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xf089('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xf089('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xf089('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf089('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf089('0x4')]},'deleted':{'type':Sequelize[_0xf089('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xf089('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xf089('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf089('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf089('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf089('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6162=['INTEGER','DATE','STRING','getDataValue','endtime','setDataValue','dispositionat','BOOLEAN','sequelize','moment','exports'];(function(_0x2ef8f1,_0x1280a3){var _0x17498d=function(_0xd20876){while(--_0xd20876){_0x2ef8f1['push'](_0x2ef8f1['shift']());}};_0x17498d(++_0x1280a3);}(_0x6162,0x1c0));var _0x2616=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x6162[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x2616('0x0'));var moment=require(_0x2616('0x1'));module[_0x2616('0x2')]={'state':{'type':Sequelize[_0x2616('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x2616('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2616('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2616('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2616('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x2616('0x5')]},'calleridnum':{'type':Sequelize[_0x2616('0x5')]},'calleridname':{'type':Sequelize[_0x2616('0x5')]},'starttime':{'type':Sequelize[_0x2616('0x4')]},'responsetime':{'type':Sequelize[_0x2616('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x2616('0x4')]},'endtime':{'type':Sequelize[_0x2616('0x4')]},'ringtime':{'type':Sequelize[_0x2616('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2616('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2616('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2616('0x5')]},'campaign':{'type':Sequelize[_0x2616('0x5')]},'campaigntype':{'type':Sequelize[_0x2616('0x5')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2616('0x5')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x3da630){var _0xbfbc9e=this[_0x2616('0x6')](_0x2616('0x7'));if(_0xbfbc9e&&_0x3da630){this[_0x2616('0x8')]('followuptime',moment(_0x3da630)['diff'](moment(_0xbfbc9e),'seconds'));}return this[_0x2616('0x8')](_0x2616('0x9'),_0x3da630);}},'amd':{'type':Sequelize[_0x2616('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2616('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x2616('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x2616('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x2616('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2616('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x2616('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x2616('0x4')]},'recallme':{'type':Sequelize[_0x2616('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x2616('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x2616('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2616('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2616('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2616('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 d53be5e..b307207 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 _0x5373=['order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperFinal','includeAll','include','findAll','rows','catch','show','params','filtears','length','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2019,\x201,\x20null','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','NOW()','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','ListId','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','checkContactHopper','findOne','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','stack','name','map','rawAttributes','fieldName','type','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit'];(function(_0x60d261,_0x557c14){var _0x432267=function(_0x2cbc6f){while(--_0x2cbc6f){_0x60d261['push'](_0x60d261['shift']());}};_0x432267(++_0x557c14);}(_0x5373,0x1cf));var _0x3537=function(_0x1d0643,_0x580295){_0x1d0643=_0x1d0643-0x0;var _0x490e8c=_0x5373[_0x1d0643];return _0x490e8c;};'use strict';var pdf=require(_0x3537('0x0'));var emlformat=require(_0x3537('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3537('0x2'));var jsonpatch=require(_0x3537('0x3'));var rp=require(_0x3537('0x4'));var moment=require('moment');var BPromise=require(_0x3537('0x5'));var Mustache=require(_0x3537('0x6'));var util=require(_0x3537('0x7'));var path=require(_0x3537('0x8'));var sox=require(_0x3537('0x9'));var csv=require(_0x3537('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3537('0xb'));var squel=require(_0x3537('0xc'));var crypto=require(_0x3537('0xd'));var jsforce=require(_0x3537('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3537('0xf'));var Papa=require(_0x3537('0x10'));var Redis=require(_0x3537('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3537('0x12'));var as=require(_0x3537('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3537('0x14'))(_0x3537('0x15'));var utils=require(_0x3537('0x16'));var config=require(_0x3537('0x17'));var licenseUtil=require(_0x3537('0x18'));var db=require(_0x3537('0x19'))['db'];function respondWithStatusCode(_0x299986,_0x46b059){_0x46b059=_0x46b059||0xcc;return function(_0x7b4a65){if(_0x7b4a65){return _0x299986[_0x3537('0x1a')](_0x46b059);}return _0x299986[_0x3537('0x1b')](_0x46b059)[_0x3537('0x1c')]();};}function respondWithResult(_0x32dcce,_0x1a8958){_0x1a8958=_0x1a8958||0xc8;return function(_0x2c3fbf){if(_0x2c3fbf){return _0x32dcce[_0x3537('0x1b')](_0x1a8958)[_0x3537('0x1d')](_0x2c3fbf);}};}function respondWithFilteredResult(_0x148c39,_0x11ec5d){return function(_0x1b8199){if(_0x1b8199){var _0x2a9e3e=_0x1b8199[_0x3537('0x1e')],_0x1c5cd1=_0x11ec5d[_0x3537('0x1f')],_0x101917=_0x11ec5d[_0x3537('0x1f')]+_0x11ec5d[_0x3537('0x20')],_0x2bebd7;if(_0x101917>=_0x2a9e3e){_0x101917=_0x2a9e3e;_0x2bebd7=0xc8;}else{_0x2bebd7=0xce;}_0x148c39['status'](_0x2bebd7);return _0x148c39[_0x3537('0x21')](_0x3537('0x22'),_0x1c5cd1+'-'+_0x101917+'/'+_0x2a9e3e)[_0x3537('0x1d')](_0x1b8199);}return null;};}function patchUpdates(_0x1fa3ad){return function(_0x51cbe8){try{jsonpatch['apply'](_0x51cbe8,_0x1fa3ad,!![]);}catch(_0x163c4c){return BPromise[_0x3537('0x23')](_0x163c4c);}return _0x51cbe8['save']();};}function saveUpdates(_0x2d4c91,_0x5502c8){return function(_0x12f813){if(_0x12f813){return _0x12f813[_0x3537('0x24')](_0x2d4c91)['then'](function(_0x4ee2df){return _0x4ee2df;});}return null;};}function removeEntity(_0x1cc1dc,_0x39ac49){return function(_0x2bd0e1){if(_0x2bd0e1){return _0x2bd0e1['destroy']()[_0x3537('0x25')](function(){_0x1cc1dc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2643a9,_0x1a8f39){return function(_0x4cd2a9){if(!_0x4cd2a9){_0x2643a9[_0x3537('0x1a')](0x194);}return _0x4cd2a9;};}function handleError(_0x3e9323,_0x3a7637){_0x3a7637=_0x3a7637||0x1f4;return function(_0x595c5d){logger['error'](_0x595c5d[_0x3537('0x26')]);if(_0x595c5d[_0x3537('0x27')]){delete _0x595c5d[_0x3537('0x27')];}_0x3e9323['status'](_0x3a7637)['send'](_0x595c5d);};}exports['index']=function(_0x381143,_0x2b35e3){var _0x5636bf={},_0x225b30={},_0x317aab={'count':0x0,'rows':[]};var _0x3f776=_[_0x3537('0x28')](db['CmHopperFinal'][_0x3537('0x29')],function(_0x4e14f3){return{'name':_0x4e14f3[_0x3537('0x2a')],'type':_0x4e14f3[_0x3537('0x2b')]['key']};});_0x225b30['model']=_[_0x3537('0x28')](_0x3f776,'name');_0x225b30['query']=_[_0x3537('0x2c')](_0x381143[_0x3537('0x2d')]);_0x225b30[_0x3537('0x2e')]=_[_0x3537('0x2f')](_0x225b30[_0x3537('0x30')],_0x225b30[_0x3537('0x2d')]);_0x5636bf['attributes']=_['intersection'](_0x225b30[_0x3537('0x30')],qs[_0x3537('0x31')](_0x381143[_0x3537('0x2d')][_0x3537('0x31')]));_0x5636bf['attributes']=_0x5636bf[_0x3537('0x32')]['length']?_0x5636bf['attributes']:_0x225b30[_0x3537('0x30')];if(!_0x381143[_0x3537('0x2d')][_0x3537('0x33')](_0x3537('0x34'))){_0x5636bf['limit']=qs[_0x3537('0x20')](_0x381143[_0x3537('0x2d')][_0x3537('0x20')]);_0x5636bf['offset']=qs['offset'](_0x381143[_0x3537('0x2d')][_0x3537('0x1f')]);}_0x5636bf[_0x3537('0x35')]=qs[_0x3537('0x36')](_0x381143[_0x3537('0x2d')]['sort']);_0x5636bf[_0x3537('0x37')]=qs[_0x3537('0x2e')](_[_0x3537('0x38')](_0x381143['query'],_0x225b30['filters']),_0x3f776);if(_0x381143[_0x3537('0x2d')][_0x3537('0x39')]){_0x5636bf[_0x3537('0x37')]=_[_0x3537('0x3a')](_0x5636bf[_0x3537('0x37')],{'$or':_['map'](_0x3f776,function(_0x7df793){if(_0x7df793[_0x3537('0x2b')]!==_0x3537('0x3b')){var _0x20ef8c={};_0x20ef8c[_0x7df793[_0x3537('0x27')]]={'$like':'%'+_0x381143[_0x3537('0x2d')][_0x3537('0x39')]+'%'};return _0x20ef8c;}})});}_0x5636bf=_[_0x3537('0x3a')]({},_0x5636bf,_0x381143[_0x3537('0x3c')]);var _0xf9ee29={'where':_0x5636bf[_0x3537('0x37')]};return db[_0x3537('0x3d')][_0x3537('0x1e')](_0xf9ee29)[_0x3537('0x25')](function(_0x346fc4){_0x317aab[_0x3537('0x1e')]=_0x346fc4;if(_0x381143[_0x3537('0x2d')][_0x3537('0x3e')]){_0x5636bf[_0x3537('0x3f')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x3537('0x40')](_0x5636bf);})[_0x3537('0x25')](function(_0x353333){_0x317aab[_0x3537('0x41')]=_0x353333;return _0x317aab;})[_0x3537('0x25')](respondWithFilteredResult(_0x2b35e3,_0x5636bf))[_0x3537('0x42')](handleError(_0x2b35e3,null));};exports[_0x3537('0x43')]=function(_0x39608c,_0x1c1626){var _0x29c539={'raw':!![],'where':{'id':_0x39608c[_0x3537('0x44')]['id']}},_0x3a5ebd={};_0x3a5ebd['model']=_[_0x3537('0x2c')](db[_0x3537('0x3d')][_0x3537('0x29')]);_0x3a5ebd[_0x3537('0x2d')]=_['keys'](_0x39608c[_0x3537('0x2d')]);_0x3a5ebd[_0x3537('0x45')]=_[_0x3537('0x2f')](_0x3a5ebd[_0x3537('0x30')],_0x3a5ebd['query']);_0x29c539[_0x3537('0x32')]=_[_0x3537('0x2f')](_0x3a5ebd[_0x3537('0x30')],qs[_0x3537('0x31')](_0x39608c[_0x3537('0x2d')][_0x3537('0x31')]));_0x29c539[_0x3537('0x32')]=_0x29c539[_0x3537('0x32')][_0x3537('0x46')]?_0x29c539[_0x3537('0x32')]:_0x3a5ebd[_0x3537('0x30')];if(_0x39608c[_0x3537('0x2d')]['includeAll']){_0x29c539[_0x3537('0x3f')]=[{'all':!![]}];}_0x29c539=_['merge']({},_0x29c539,_0x39608c['options']);return db['CmHopperFinal'][_0x3537('0x47')](_0x29c539)[_0x3537('0x25')](handleEntityNotFound(_0x1c1626,null))['then'](respondWithResult(_0x1c1626,null))[_0x3537('0x42')](handleError(_0x1c1626,null));};exports[_0x3537('0x48')]=function(_0x5b7eb6,_0x47394f){return db[_0x3537('0x3d')][_0x3537('0x48')]()['then'](respondWithResult(_0x47394f,null))['catch'](handleError(_0x47394f,null));};exports[_0x3537('0x24')]=function(_0x221ec3,_0x1cce09){if(_0x221ec3[_0x3537('0x49')]['uniqueid']){delete _0x221ec3[_0x3537('0x49')][_0x3537('0x4a')];}return db[_0x3537('0x3d')][_0x3537('0x47')]({'where':{'uniqueid':_0x221ec3[_0x3537('0x44')]['id']}})[_0x3537('0x25')](handleEntityNotFound(_0x1cce09,null))[_0x3537('0x25')](saveUpdates(_0x221ec3[_0x3537('0x49')],null))[_0x3537('0x25')](respondWithResult(_0x1cce09,null))[_0x3537('0x42')](handleError(_0x1cce09,null));};exports[_0x3537('0x4b')]=function(_0x5ac732,_0x2310c4,_0x585e68){return db[_0x3537('0x3d')][_0x3537('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x5ac732['params']['id']},'attributes':[[db[_0x3537('0x4c')]['fn'](_0x3537('0x4d'),db[_0x3537('0x4c')]['fn']('IF',db[_0x3537('0x4c')][_0x3537('0x4e')](_0x3537('0x4f')))),_0x3537('0x50')],[db[_0x3537('0x4c')]['fn']('COUNT',db[_0x3537('0x4c')]['fn']('IF',db['sequelize'][_0x3537('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0x3537('0x51')],[db[_0x3537('0x4c')]['fn'](_0x3537('0x4d'),db['sequelize']['fn']('IF',db[_0x3537('0x4c')][_0x3537('0x4e')](_0x3537('0x52')))),_0x3537('0x53')],[db[_0x3537('0x4c')]['fn'](_0x3537('0x4d'),db[_0x3537('0x4c')]['fn']('IF',db[_0x3537('0x4c')][_0x3537('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),_0x3537('0x54')],[db['sequelize']['fn']('COUNT',db[_0x3537('0x4c')]['fn']('IF',db[_0x3537('0x4c')][_0x3537('0x4e')](_0x3537('0x55')))),'dropContacts'],[db[_0x3537('0x4c')]['fn']('COUNT',db[_0x3537('0x4c')]['fn']('IF',db[_0x3537('0x4c')][_0x3537('0x4e')](_0x3537('0x56')))),'abandonedContacts'],[db[_0x3537('0x4c')]['fn']('COUNT',db[_0x3537('0x4c')]['fn']('IF',db['sequelize'][_0x3537('0x4e')](_0x3537('0x57')))),_0x3537('0x58')],[db['sequelize']['fn'](_0x3537('0x4d'),db['sequelize']['fn']('IF',db[_0x3537('0x4c')][_0x3537('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x3537('0x59')]]})[_0x3537('0x25')](handleEntityNotFound(_0x2310c4,null))[_0x3537('0x25')](respondWithResult(_0x2310c4,null))[_0x3537('0x42')](handleError(_0x2310c4,null));};exports[_0x3537('0x5a')]=function(_0x13fe18,_0x3c0316,_0x186470){return db[_0x3537('0x3d')][_0x3537('0x40')]({'raw':![],'where':{'CampaignId':_0x13fe18[_0x3537('0x44')]['id']},'attributes':[[db[_0x3537('0x4c')]['fn']('COUNT',db[_0x3537('0x4c')]['fn']('IF',db['sequelize'][_0x3537('0x4e')](_0x3537('0x4f')))),_0x3537('0x50')],[db[_0x3537('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x3537('0x4e')](_0x3537('0x5b')))),_0x3537('0x51')],[db[_0x3537('0x4c')]['fn']('COUNT',db[_0x3537('0x4c')]['fn']('IF',db[_0x3537('0x4c')][_0x3537('0x4e')](_0x3537('0x52')))),_0x3537('0x53')],[db[_0x3537('0x4c')]['fn'](_0x3537('0x4d'),db[_0x3537('0x4c')]['fn']('IF',db[_0x3537('0x4c')]['literal'](_0x3537('0x5c')))),'congestionContacts'],[db[_0x3537('0x4c')]['fn'](_0x3537('0x4d'),db[_0x3537('0x4c')]['fn']('IF',db['sequelize'][_0x3537('0x4e')](_0x3537('0x55')))),_0x3537('0x5d')],[db[_0x3537('0x4c')]['fn']('COUNT',db[_0x3537('0x4c')]['fn']('IF',db[_0x3537('0x4c')][_0x3537('0x4e')](_0x3537('0x56')))),'abandonedContacts'],[db['sequelize']['fn'](_0x3537('0x4d'),db[_0x3537('0x4c')]['fn']('IF',db[_0x3537('0x4c')][_0x3537('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3537('0x58')],[db[_0x3537('0x4c')]['fn'](_0x3537('0x4d'),db[_0x3537('0x4c')]['fn']('IF',db[_0x3537('0x4c')]['literal'](_0x3537('0x5e')))),_0x3537('0x59')]]})[_0x3537('0x25')](handleEntityNotFound(_0x3c0316,null))[_0x3537('0x25')](respondWithResult(_0x3c0316,null))['catch'](handleError(_0x3c0316,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x368228,_0x3ff347,_0x15934b){return db[_0x3537('0x5f')][_0x3537('0x47')]({'where':{'id':_0x368228[_0x3537('0x44')]['id']}})[_0x3537('0x25')](handleEntityNotFound(_0x3ff347,null))[_0x3537('0x25')](function(_0x357d12){var _0x11c88e;if(_0x357d12){_0x11c88e=squel[_0x3537('0x60')]()[_0x3537('0x61')](_0x3537('0x62'))[_0x3537('0x63')]([_0x3537('0x64'),_0x3537('0x65'),'ContactId','ListId',_0x3537('0x66'),_0x3537('0x67'),_0x3537('0x68')],squel[_0x3537('0x69')]()['field'](_0x3537('0x6a'),_0x3537('0x64'))[_0x3537('0x6b')]('NOW()',_0x3537('0x65'))[_0x3537('0x6b')](_0x3537('0x6c'),_0x3537('0x6d'))['field'](_0x3537('0x6e'),'ListId')[_0x3537('0x6b')]('ANY_VALUE(VoiceQueueId)',_0x3537('0x66'))[_0x3537('0x6b')](_0x3537('0x6f'),'createdAt')[_0x3537('0x6b')]('NOW()',_0x3537('0x68'))['from'](_0x3537('0x70'))[_0x3537('0x37')](_0x3537('0x71'),_0x368228[_0x3537('0x44')]['id'][_0x3537('0x72')]())[_0x3537('0x37')]('state\x20=\x20?',_0x368228['body']['state'][_0x3537('0x72')]())['where'](_0x3537('0x73'))[_0x3537('0x37')](_0x3537('0x74'),squel['select']()[_0x3537('0x6b')](_0x3537('0x64'))[_0x3537('0x75')](_0x3537('0x62'))[_0x3537('0x37')](_0x3537('0x71'),_0x368228['params']['id'][_0x3537('0x72')]()))['where'](_0x3537('0x74'),squel[_0x3537('0x69')]()['field'](_0x3537('0x76'))[_0x3537('0x75')](_0x3537('0x70'))[_0x3537('0x37')](_0x3537('0x71'),_0x368228['params']['id'][_0x3537('0x72')]())[_0x3537('0x37')](_0x3537('0x77')))[_0x3537('0x78')](_0x3537('0x6d')))[_0x3537('0x72')]();return db[_0x3537('0x4c')]['query'](_0x11c88e);}return[];})['then'](respondWithResult(_0x3ff347,null))[_0x3537('0x42')](handleError(_0x3ff347,null));};exports[_0x3537('0x79')]=function(_0x54fe50,_0xed47ba,_0x17cdd4){return db['Campaign'][_0x3537('0x47')]({'where':{'id':_0x54fe50[_0x3537('0x44')]['id']}})[_0x3537('0x25')](handleEntityNotFound(_0xed47ba,null))[_0x3537('0x25')](function(_0x53943b){var _0x3fd5c9;if(_0x53943b){_0x3fd5c9=squel['insert']()['into'](_0x3537('0x62'))['fromQuery'](['phone','scheduledAt',_0x3537('0x6d'),_0x3537('0x7a'),_0x3537('0x7b'),'createdAt',_0x3537('0x68')],squel['select']()[_0x3537('0x6b')](_0x3537('0x6a'),'phone')[_0x3537('0x6b')](_0x3537('0x6f'),'scheduledAt')['field']('ANY_VALUE(ContactId)',_0x3537('0x6d'))[_0x3537('0x6b')](_0x3537('0x6e'),_0x3537('0x7a'))['field'](_0x3537('0x7c'),_0x3537('0x7b'))[_0x3537('0x6b')](_0x3537('0x6f'),_0x3537('0x67'))[_0x3537('0x6b')](_0x3537('0x6f'),'updatedAt')[_0x3537('0x75')](_0x3537('0x70'))[_0x3537('0x37')](_0x3537('0x7d'),_0x54fe50[_0x3537('0x44')]['id'][_0x3537('0x72')]())[_0x3537('0x37')]('state\x20=\x20?',_0x54fe50['body'][_0x3537('0x7e')][_0x3537('0x72')]())[_0x3537('0x37')](_0x3537('0x73'))['where'](_0x3537('0x74'),squel[_0x3537('0x69')]()[_0x3537('0x6b')]('phone')[_0x3537('0x75')](_0x3537('0x62'))[_0x3537('0x37')](_0x3537('0x7d'),_0x54fe50[_0x3537('0x44')]['id'][_0x3537('0x72')]()))[_0x3537('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x3537('0x69')]()[_0x3537('0x6b')]('calleridnum')[_0x3537('0x75')](_0x3537('0x70'))['where'](_0x3537('0x7d'),_0x54fe50[_0x3537('0x44')]['id'][_0x3537('0x72')]())[_0x3537('0x37')](_0x3537('0x77')))['group'](_0x3537('0x6d')))[_0x3537('0x72')]();return db[_0x3537('0x4c')][_0x3537('0x2d')](_0x3fd5c9);}return[];})[_0x3537('0x25')](respondWithResult(_0xed47ba,null))[_0x3537('0x42')](handleError(_0xed47ba,null));};exports[_0x3537('0x7f')]=function(_0x5c98a9,_0x28a405,_0x44a523){return db['CmHopper'][_0x3537('0x80')]({'where':{'VoiceQueueId':_0x5c98a9['body'][_0x3537('0x66')],'CampaignId':_0x5c98a9[_0x3537('0x49')][_0x3537('0x7b')],'ContactId':_0x5c98a9[_0x3537('0x49')][_0x3537('0x6d')]}})['then'](handleEntityNotFound(_0x28a405,null))[_0x3537('0x25')](function(_0xd4994a){if(_0xd4994a){return _0xd4994a;}return null;})[_0x3537('0x25')](respondWithResult(_0x28a405,null))['catch'](handleError(_0x28a405,null));}; \ No newline at end of file +var _0x9805=['reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','phone','scheduledAt','ContactId','ListId','createdAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','VoiceQueueId\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','group','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(ContactId)','CampaignId\x20=\x20?','cm_hopper','state\x20=\x204','checkContactHopper','findOne','VoiceQueueId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','error','stack','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','name','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','then','describe','update','body','uniqueid','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null'];(function(_0x1559a5,_0x41924e){var _0x17a783=function(_0x152c63){while(--_0x152c63){_0x1559a5['push'](_0x1559a5['shift']());}};_0x17a783(++_0x41924e);}(_0x9805,0x1a5));var _0x5980=function(_0x27bd57,_0x40c4d5){_0x27bd57=_0x27bd57-0x0;var _0x35e9c6=_0x9805[_0x27bd57];return _0x35e9c6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5980('0x0'));var rimraf=require(_0x5980('0x1'));var zipdir=require(_0x5980('0x2'));var jsonpatch=require(_0x5980('0x3'));var rp=require(_0x5980('0x4'));var moment=require(_0x5980('0x5'));var BPromise=require(_0x5980('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5980('0x7'));var sox=require(_0x5980('0x8'));var csv=require(_0x5980('0x9'));var ejs=require(_0x5980('0xa'));var fs=require('fs');var _=require(_0x5980('0xb'));var squel=require(_0x5980('0xc'));var crypto=require('crypto');var jsforce=require(_0x5980('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5980('0x9'));var querystring=require(_0x5980('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5980('0xf'));var qs=require(_0x5980('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5980('0x11'));var logger=require(_0x5980('0x12'))('api');var utils=require(_0x5980('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5980('0x14'));var db=require(_0x5980('0x15'))['db'];function respondWithStatusCode(_0x7e50d8,_0x2dd185){_0x2dd185=_0x2dd185||0xcc;return function(_0x4de9d1){if(_0x4de9d1){return _0x7e50d8[_0x5980('0x16')](_0x2dd185);}return _0x7e50d8[_0x5980('0x17')](_0x2dd185)[_0x5980('0x18')]();};}function respondWithResult(_0xf0ca55,_0x50b518){_0x50b518=_0x50b518||0xc8;return function(_0x2a44f4){if(_0x2a44f4){return _0xf0ca55[_0x5980('0x17')](_0x50b518)[_0x5980('0x19')](_0x2a44f4);}};}function respondWithFilteredResult(_0x7116bb,_0x2860bf){return function(_0x13df31){if(_0x13df31){var _0x50ce9f=_0x13df31[_0x5980('0x1a')],_0x858ebf=_0x2860bf['offset'],_0x1fe2d3=_0x2860bf[_0x5980('0x1b')]+_0x2860bf['limit'],_0x586bd4;if(_0x1fe2d3>=_0x50ce9f){_0x1fe2d3=_0x50ce9f;_0x586bd4=0xc8;}else{_0x586bd4=0xce;}_0x7116bb[_0x5980('0x17')](_0x586bd4);return _0x7116bb['set'](_0x5980('0x1c'),_0x858ebf+'-'+_0x1fe2d3+'/'+_0x50ce9f)[_0x5980('0x19')](_0x13df31);}return null;};}function patchUpdates(_0x70cc65){return function(_0x1ec30d){try{jsonpatch[_0x5980('0x1d')](_0x1ec30d,_0x70cc65,!![]);}catch(_0x2b5b45){return BPromise[_0x5980('0x1e')](_0x2b5b45);}return _0x1ec30d['save']();};}function saveUpdates(_0x12d8a2,_0x5c4bff){return function(_0x5ad535){if(_0x5ad535){return _0x5ad535['update'](_0x12d8a2)['then'](function(_0x326181){return _0x326181;});}return null;};}function removeEntity(_0x135893,_0x51f7c9){return function(_0x509494){if(_0x509494){return _0x509494['destroy']()['then'](function(){_0x135893[_0x5980('0x17')](0xcc)[_0x5980('0x18')]();});}};}function handleEntityNotFound(_0x227914,_0x42ac88){return function(_0x4e021a){if(!_0x4e021a){_0x227914[_0x5980('0x16')](0x194);}return _0x4e021a;};}function handleError(_0x59869b,_0xeba73e){_0xeba73e=_0xeba73e||0x1f4;return function(_0x5ce054){logger[_0x5980('0x1f')](_0x5ce054[_0x5980('0x20')]);if(_0x5ce054['name']){delete _0x5ce054['name'];}_0x59869b['status'](_0xeba73e)['send'](_0x5ce054);};}exports[_0x5980('0x21')]=function(_0x5742d2,_0x775a1d){var _0x17d2f0={},_0x4100e7={},_0x343c1b={'count':0x0,'rows':[]};var _0x2f0127=_[_0x5980('0x22')](db[_0x5980('0x23')][_0x5980('0x24')],function(_0x590462){return{'name':_0x590462[_0x5980('0x25')],'type':_0x590462[_0x5980('0x26')][_0x5980('0x27')]};});_0x4100e7[_0x5980('0x28')]=_[_0x5980('0x22')](_0x2f0127,_0x5980('0x29'));_0x4100e7[_0x5980('0x2a')]=_['keys'](_0x5742d2['query']);_0x4100e7['filters']=_['intersection'](_0x4100e7[_0x5980('0x28')],_0x4100e7[_0x5980('0x2a')]);_0x17d2f0[_0x5980('0x2b')]=_[_0x5980('0x2c')](_0x4100e7[_0x5980('0x28')],qs['fields'](_0x5742d2['query'][_0x5980('0x2d')]));_0x17d2f0[_0x5980('0x2b')]=_0x17d2f0['attributes'][_0x5980('0x2e')]?_0x17d2f0['attributes']:_0x4100e7[_0x5980('0x28')];if(!_0x5742d2['query'][_0x5980('0x2f')](_0x5980('0x30'))){_0x17d2f0[_0x5980('0x31')]=qs[_0x5980('0x31')](_0x5742d2[_0x5980('0x2a')][_0x5980('0x31')]);_0x17d2f0[_0x5980('0x1b')]=qs[_0x5980('0x1b')](_0x5742d2[_0x5980('0x2a')][_0x5980('0x1b')]);}_0x17d2f0[_0x5980('0x32')]=qs[_0x5980('0x33')](_0x5742d2[_0x5980('0x2a')]['sort']);_0x17d2f0['where']=qs[_0x5980('0x34')](_[_0x5980('0x35')](_0x5742d2['query'],_0x4100e7[_0x5980('0x34')]),_0x2f0127);if(_0x5742d2[_0x5980('0x2a')]['filter']){_0x17d2f0[_0x5980('0x36')]=_[_0x5980('0x37')](_0x17d2f0[_0x5980('0x36')],{'$or':_[_0x5980('0x22')](_0x2f0127,function(_0x5e83e7){if(_0x5e83e7[_0x5980('0x26')]!==_0x5980('0x38')){var _0x13ff3c={};_0x13ff3c[_0x5e83e7['name']]={'$like':'%'+_0x5742d2['query'][_0x5980('0x39')]+'%'};return _0x13ff3c;}})});}_0x17d2f0=_[_0x5980('0x37')]({},_0x17d2f0,_0x5742d2[_0x5980('0x3a')]);var _0x41be2a={'where':_0x17d2f0[_0x5980('0x36')]};return db['CmHopperFinal']['count'](_0x41be2a)['then'](function(_0x2dd974){_0x343c1b[_0x5980('0x1a')]=_0x2dd974;if(_0x5742d2['query'][_0x5980('0x3b')]){_0x17d2f0[_0x5980('0x3c')]=[{'all':!![]}];}return db[_0x5980('0x23')][_0x5980('0x3d')](_0x17d2f0);})['then'](function(_0x331b5f){_0x343c1b[_0x5980('0x3e')]=_0x331b5f;return _0x343c1b;})['then'](respondWithFilteredResult(_0x775a1d,_0x17d2f0))[_0x5980('0x3f')](handleError(_0x775a1d,null));};exports[_0x5980('0x40')]=function(_0x877c30,_0x48b2b7){var _0x29b8d9={'raw':!![],'where':{'id':_0x877c30[_0x5980('0x41')]['id']}},_0x34785d={};_0x34785d[_0x5980('0x28')]=_[_0x5980('0x42')](db[_0x5980('0x23')][_0x5980('0x24')]);_0x34785d[_0x5980('0x2a')]=_[_0x5980('0x42')](_0x877c30[_0x5980('0x2a')]);_0x34785d['filtears']=_[_0x5980('0x2c')](_0x34785d[_0x5980('0x28')],_0x34785d[_0x5980('0x2a')]);_0x29b8d9[_0x5980('0x2b')]=_['intersection'](_0x34785d[_0x5980('0x28')],qs[_0x5980('0x2d')](_0x877c30['query'][_0x5980('0x2d')]));_0x29b8d9[_0x5980('0x2b')]=_0x29b8d9[_0x5980('0x2b')]['length']?_0x29b8d9['attributes']:_0x34785d[_0x5980('0x28')];if(_0x877c30[_0x5980('0x2a')][_0x5980('0x3b')]){_0x29b8d9[_0x5980('0x3c')]=[{'all':!![]}];}_0x29b8d9=_[_0x5980('0x37')]({},_0x29b8d9,_0x877c30[_0x5980('0x3a')]);return db[_0x5980('0x23')]['find'](_0x29b8d9)[_0x5980('0x43')](handleEntityNotFound(_0x48b2b7,null))[_0x5980('0x43')](respondWithResult(_0x48b2b7,null))[_0x5980('0x3f')](handleError(_0x48b2b7,null));};exports[_0x5980('0x44')]=function(_0x1b6dca,_0x59e115){return db[_0x5980('0x23')][_0x5980('0x44')]()[_0x5980('0x43')](respondWithResult(_0x59e115,null))['catch'](handleError(_0x59e115,null));};exports[_0x5980('0x45')]=function(_0x5c51ca,_0x20f337){if(_0x5c51ca[_0x5980('0x46')][_0x5980('0x47')]){delete _0x5c51ca['body'][_0x5980('0x47')];}return db[_0x5980('0x23')][_0x5980('0x48')]({'where':{'uniqueid':_0x5c51ca[_0x5980('0x41')]['id']}})['then'](handleEntityNotFound(_0x20f337,null))['then'](saveUpdates(_0x5c51ca[_0x5980('0x46')],null))[_0x5980('0x43')](respondWithResult(_0x20f337,null))['catch'](handleError(_0x20f337,null));};exports[_0x5980('0x49')]=function(_0x22e7c9,_0x3354ed,_0x2bc9ad){return db['CmHopperFinal'][_0x5980('0x3d')]({'raw':![],'where':{'VoiceQueueId':_0x22e7c9[_0x5980('0x41')]['id']},'attributes':[[db[_0x5980('0x4a')]['fn'](_0x5980('0x4b'),db[_0x5980('0x4a')]['fn']('IF',db[_0x5980('0x4a')]['literal'](_0x5980('0x4c')))),'noSuchContacts'],[db[_0x5980('0x4a')]['fn'](_0x5980('0x4b'),db[_0x5980('0x4a')]['fn']('IF',db[_0x5980('0x4a')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x5980('0x4d')],[db[_0x5980('0x4a')]['fn']('COUNT',db[_0x5980('0x4a')]['fn']('IF',db['sequelize'][_0x5980('0x4e')](_0x5980('0x4f')))),_0x5980('0x50')],[db[_0x5980('0x4a')]['fn'](_0x5980('0x4b'),db['sequelize']['fn']('IF',db[_0x5980('0x4a')]['literal'](_0x5980('0x51')))),_0x5980('0x52')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x5980('0x4e')](_0x5980('0x53')))),_0x5980('0x54')],[db[_0x5980('0x4a')]['fn']('COUNT',db[_0x5980('0x4a')]['fn']('IF',db[_0x5980('0x4a')][_0x5980('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5980('0x55')],[db['sequelize']['fn'](_0x5980('0x4b'),db[_0x5980('0x4a')]['fn']('IF',db[_0x5980('0x4a')][_0x5980('0x4e')](_0x5980('0x56')))),_0x5980('0x57')],[db[_0x5980('0x4a')]['fn'](_0x5980('0x4b'),db[_0x5980('0x4a')]['fn']('IF',db['sequelize'][_0x5980('0x4e')](_0x5980('0x58')))),_0x5980('0x59')]]})['then'](handleEntityNotFound(_0x3354ed,null))[_0x5980('0x43')](respondWithResult(_0x3354ed,null))[_0x5980('0x3f')](handleError(_0x3354ed,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x14b2b3,_0x560187,_0x5d81c3){return db[_0x5980('0x23')][_0x5980('0x3d')]({'raw':![],'where':{'CampaignId':_0x14b2b3[_0x5980('0x41')]['id']},'attributes':[[db[_0x5980('0x4a')]['fn'](_0x5980('0x4b'),db['sequelize']['fn']('IF',db[_0x5980('0x4a')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x5980('0x5a')],[db[_0x5980('0x4a')]['fn'](_0x5980('0x4b'),db[_0x5980('0x4a')]['fn']('IF',db[_0x5980('0x4a')]['literal'](_0x5980('0x5b')))),_0x5980('0x4d')],[db[_0x5980('0x4a')]['fn'](_0x5980('0x4b'),db[_0x5980('0x4a')]['fn']('IF',db[_0x5980('0x4a')]['literal'](_0x5980('0x4f')))),'busyContacts'],[db['sequelize']['fn'](_0x5980('0x4b'),db[_0x5980('0x4a')]['fn']('IF',db[_0x5980('0x4a')][_0x5980('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),_0x5980('0x52')],[db[_0x5980('0x4a')]['fn'](_0x5980('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0x5980('0x4e')](_0x5980('0x53')))),_0x5980('0x54')],[db[_0x5980('0x4a')]['fn'](_0x5980('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0x5980('0x4e')](_0x5980('0x5c')))),_0x5980('0x55')],[db[_0x5980('0x4a')]['fn'](_0x5980('0x4b'),db[_0x5980('0x4a')]['fn']('IF',db[_0x5980('0x4a')][_0x5980('0x4e')](_0x5980('0x56')))),_0x5980('0x57')],[db[_0x5980('0x4a')]['fn']('COUNT',db[_0x5980('0x4a')]['fn']('IF',db[_0x5980('0x4a')][_0x5980('0x4e')](_0x5980('0x58')))),'answeringMachine']]})[_0x5980('0x43')](handleEntityNotFound(_0x560187,null))['then'](respondWithResult(_0x560187,null))[_0x5980('0x3f')](handleError(_0x560187,null));};exports[_0x5980('0x5d')]=function(_0x29d942,_0x17a398,_0x4bc892){return db[_0x5980('0x5e')][_0x5980('0x48')]({'where':{'id':_0x29d942[_0x5980('0x41')]['id']}})[_0x5980('0x43')](handleEntityNotFound(_0x17a398,null))[_0x5980('0x43')](function(_0x50f6aa){var _0x3105c6;if(_0x50f6aa){_0x3105c6=squel[_0x5980('0x5f')]()[_0x5980('0x60')]('cm_hopper')['fromQuery']([_0x5980('0x61'),_0x5980('0x62'),_0x5980('0x63'),_0x5980('0x64'),'VoiceQueueId',_0x5980('0x65'),'updatedAt'],squel[_0x5980('0x66')]()[_0x5980('0x67')](_0x5980('0x68'),_0x5980('0x61'))[_0x5980('0x67')](_0x5980('0x69'),'scheduledAt')['field']('ANY_VALUE(ContactId)',_0x5980('0x63'))[_0x5980('0x67')](_0x5980('0x6a'),_0x5980('0x64'))['field'](_0x5980('0x6b'),'VoiceQueueId')[_0x5980('0x67')](_0x5980('0x69'),'createdAt')[_0x5980('0x67')](_0x5980('0x69'),'updatedAt')[_0x5980('0x6c')](_0x5980('0x6d'))[_0x5980('0x36')]('VoiceQueueId\x20=\x20?',_0x29d942[_0x5980('0x41')]['id'][_0x5980('0x6e')]())[_0x5980('0x36')](_0x5980('0x6f'),_0x29d942['body'][_0x5980('0x70')][_0x5980('0x6e')]())[_0x5980('0x36')](_0x5980('0x71'))[_0x5980('0x36')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5980('0x66')]()[_0x5980('0x67')](_0x5980('0x61'))['from']('cm_hopper')[_0x5980('0x36')](_0x5980('0x72'),_0x29d942['params']['id']['toString']()))[_0x5980('0x36')](_0x5980('0x73'),squel[_0x5980('0x66')]()[_0x5980('0x67')](_0x5980('0x74'))['from'](_0x5980('0x6d'))[_0x5980('0x36')]('VoiceQueueId\x20=\x20?',_0x29d942[_0x5980('0x41')]['id'][_0x5980('0x6e')]())[_0x5980('0x36')]('state\x20=\x204'))[_0x5980('0x75')](_0x5980('0x63')))[_0x5980('0x6e')]();return db[_0x5980('0x4a')]['query'](_0x3105c6);}return[];})[_0x5980('0x43')](respondWithResult(_0x17a398,null))['catch'](handleError(_0x17a398,null));};exports[_0x5980('0x76')]=function(_0x2aba86,_0xa03703,_0x594300){return db['Campaign']['find']({'where':{'id':_0x2aba86[_0x5980('0x41')]['id']}})[_0x5980('0x43')](handleEntityNotFound(_0xa03703,null))[_0x5980('0x43')](function(_0x2f90ee){var _0x34d314;if(_0x2f90ee){_0x34d314=squel['insert']()[_0x5980('0x60')]('cm_hopper')['fromQuery']([_0x5980('0x61'),_0x5980('0x62'),_0x5980('0x63'),'ListId',_0x5980('0x77'),_0x5980('0x65'),'updatedAt'],squel['select']()['field'](_0x5980('0x68'),_0x5980('0x61'))[_0x5980('0x67')](_0x5980('0x69'),_0x5980('0x62'))[_0x5980('0x67')](_0x5980('0x78'),_0x5980('0x63'))[_0x5980('0x67')](_0x5980('0x6a'),_0x5980('0x64'))[_0x5980('0x67')]('ANY_VALUE(CampaignId)',_0x5980('0x77'))[_0x5980('0x67')](_0x5980('0x69'),_0x5980('0x65'))['field'](_0x5980('0x69'),'updatedAt')[_0x5980('0x6c')]('cm_hopper_final')['where'](_0x5980('0x79'),_0x2aba86['params']['id'][_0x5980('0x6e')]())[_0x5980('0x36')]('state\x20=\x20?',_0x2aba86[_0x5980('0x46')][_0x5980('0x70')]['toString']())['where'](_0x5980('0x71'))['where'](_0x5980('0x73'),squel[_0x5980('0x66')]()[_0x5980('0x67')](_0x5980('0x61'))['from'](_0x5980('0x7a'))['where'](_0x5980('0x79'),_0x2aba86[_0x5980('0x41')]['id']['toString']()))['where'](_0x5980('0x73'),squel['select']()['field'](_0x5980('0x74'))[_0x5980('0x6c')](_0x5980('0x6d'))[_0x5980('0x36')](_0x5980('0x79'),_0x2aba86['params']['id'][_0x5980('0x6e')]())['where'](_0x5980('0x7b')))['group'](_0x5980('0x63')))[_0x5980('0x6e')]();return db[_0x5980('0x4a')][_0x5980('0x2a')](_0x34d314);}return[];})['then'](respondWithResult(_0xa03703,null))['catch'](handleError(_0xa03703,null));};exports[_0x5980('0x7c')]=function(_0x2fedc9,_0x14c1d4,_0x2f8103){return db['CmHopper'][_0x5980('0x7d')]({'where':{'VoiceQueueId':_0x2fedc9[_0x5980('0x46')][_0x5980('0x7e')],'CampaignId':_0x2fedc9[_0x5980('0x46')]['CampaignId'],'ContactId':_0x2fedc9[_0x5980('0x46')][_0x5980('0x63')]}})[_0x5980('0x43')](handleEntityNotFound(_0x14c1d4,null))['then'](function(_0x3f4067){if(_0x3f4067){return _0x3f4067;}return null;})[_0x5980('0x43')](respondWithResult(_0x14c1d4,null))[_0x5980('0x3f')](handleError(_0x14c1d4,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index c3c1727..e984963 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 _0x65d5=['rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x584053,_0x2c3c1a){var _0x284856=function(_0x2f07c8){while(--_0x2f07c8){_0x584053['push'](_0x584053['shift']());}};_0x284856(++_0x2c3c1a);}(_0x65d5,0x9e));var _0x565d=function(_0x39d42f,_0x1fb9eb){_0x39d42f=_0x39d42f-0x0;var _0x3e1c7a=_0x65d5[_0x39d42f];return _0x3e1c7a;};'use strict';var _=require(_0x565d('0x0'));var util=require(_0x565d('0x1'));var logger=require(_0x565d('0x2'))(_0x565d('0x3'));var moment=require('moment');var BPromise=require(_0x565d('0x4'));var rp=require(_0x565d('0x5'));var fs=require('fs');var path=require(_0x565d('0x6'));var rimraf=require(_0x565d('0x7'));var config=require(_0x565d('0x8'));var attributes=require(_0x565d('0x9'));module[_0x565d('0xa')]=function(_0x443e34,_0xba5b01){return _0x443e34[_0x565d('0xb')](_0x565d('0xc'),attributes,{'tableName':_0x565d('0xd'),'paranoid':![],'indexes':[{'name':_0x565d('0xe'),'fields':['calleridnum']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9d52=['moment','bluebird','request-promise','path','../../config/environment','./cmHopperFinal.attributes','CmHopperFinal','calleridnum','uniqueid','lodash','util'];(function(_0x40927b,_0xf9b0a0){var _0x2635e8=function(_0x1f2b8c){while(--_0x1f2b8c){_0x40927b['push'](_0x40927b['shift']());}};_0x2635e8(++_0xf9b0a0);}(_0x9d52,0x127));var _0x29d5=function(_0x1ebc6c,_0x58a00b){_0x1ebc6c=_0x1ebc6c-0x0;var _0x3a826d=_0x9d52[_0x1ebc6c];return _0x3a826d;};'use strict';var _=require(_0x29d5('0x0'));var util=require(_0x29d5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x29d5('0x2'));var BPromise=require(_0x29d5('0x3'));var rp=require(_0x29d5('0x4'));var fs=require('fs');var path=require(_0x29d5('0x5'));var rimraf=require('rimraf');var config=require(_0x29d5('0x6'));var attributes=require(_0x29d5('0x7'));module['exports']=function(_0x2ca5e8,_0x3921e5){return _0x2ca5e8['define'](_0x29d5('0x8'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x29d5('0x9'),'fields':[_0x29d5('0x9')]},{'name':_0x29d5('0xa'),'fields':[_0x29d5('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 91df7b2..881c0e2 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 _0x4531=['request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x39428c,_0x34b23a){var _0x52d069=function(_0x394962){while(--_0x394962){_0x39428c['push'](_0x39428c['shift']());}};_0x52d069(++_0x34b23a);}(_0x4531,0x6f));var _0x1453=function(_0x580027,_0x5fa2dd){_0x580027=_0x580027-0x0;var _0x2f4af0=_0x4531[_0x580027];return _0x2f4af0;};'use strict';var _=require(_0x1453('0x0'));var util=require(_0x1453('0x1'));var moment=require(_0x1453('0x2'));var BPromise=require(_0x1453('0x3'));var rs=require(_0x1453('0x4'));var fs=require('fs');var Redis=require(_0x1453('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1453('0x6'));var logger=require(_0x1453('0x7'))(_0x1453('0x8'));var config=require(_0x1453('0x9'));var jayson=require(_0x1453('0xa'));var client=jayson[_0x1453('0xb')][_0x1453('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2104c9,_0x252b1d,_0x19fd21){return new BPromise(function(_0x1c8933,_0x29d845){return client[_0x1453('0xd')](_0x2104c9,_0x19fd21)[_0x1453('0xe')](function(_0x1b2ef1){logger[_0x1453('0xf')](_0x1453('0x10'),_0x252b1d,_0x1453('0x11'));logger[_0x1453('0x12')](_0x1453('0x13'),_0x252b1d,'request\x20sent',JSON[_0x1453('0x14')](_0x1b2ef1));if(_0x1b2ef1['error']){if(_0x1b2ef1[_0x1453('0x15')][_0x1453('0x16')]===0x1f4){logger['error'](_0x1453('0x10'),_0x252b1d,_0x1b2ef1[_0x1453('0x15')]['message']);return _0x29d845(_0x1b2ef1[_0x1453('0x15')][_0x1453('0x17')]);}logger[_0x1453('0x15')]('CmHopperFinal,\x20%s,\x20%s',_0x252b1d,_0x1b2ef1[_0x1453('0x15')][_0x1453('0x17')]);return _0x1c8933(_0x1b2ef1[_0x1453('0x15')][_0x1453('0x17')]);}else{logger['info'](_0x1453('0x10'),_0x252b1d,_0x1453('0x11'));_0x1c8933(_0x1b2ef1['result'][_0x1453('0x17')]);}})[_0x1453('0x18')](function(_0x3e400e){logger['error'](_0x1453('0x10'),_0x252b1d,_0x3e400e);_0x29d845(_0x3e400e);});});}exports[_0x1453('0x19')]=function(_0x51c774){var _0x12c61f=this;return new Promise(function(_0x4d1462,_0x59c26c){return db[_0x1453('0x1a')][_0x1453('0x1b')](_0x51c774[_0x1453('0x1c')],{'raw':_0x51c774[_0x1453('0x1d')]?_0x51c774[_0x1453('0x1d')][_0x1453('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x544a00){logger['info']('CreateCmHopperFinal',_0x51c774);logger[_0x1453('0x12')](_0x1453('0x19'),_0x51c774,JSON[_0x1453('0x14')](_0x544a00));_0x4d1462(_0x544a00);})[_0x1453('0x18')](function(_0x557e84){logger[_0x1453('0x15')](_0x1453('0x19'),_0x557e84[_0x1453('0x17')],_0x51c774);_0x59c26c(_0x12c61f[_0x1453('0x15')](0x1f4,_0x557e84['message']));});});}; \ No newline at end of file +var _0x52c5=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','error','message','result','CreateCmHopperFinal','body','options','raw','stringify'];(function(_0x49d9b8,_0xe32180){var _0x3ef5b4=function(_0x37cc2e){while(--_0x37cc2e){_0x49d9b8['push'](_0x49d9b8['shift']());}};_0x3ef5b4(++_0xe32180);}(_0x52c5,0x10f));var _0x552c=function(_0x385c76,_0xb97335){_0x385c76=_0x385c76-0x0;var _0x5c8367=_0x52c5[_0x385c76];return _0x5c8367;};'use strict';var _=require(_0x552c('0x0'));var util=require(_0x552c('0x1'));var moment=require(_0x552c('0x2'));var BPromise=require('bluebird');var rs=require(_0x552c('0x3'));var fs=require('fs');var Redis=require(_0x552c('0x4'));var db=require(_0x552c('0x5'))['db'];var utils=require(_0x552c('0x6'));var logger=require(_0x552c('0x7'))('rpc');var config=require(_0x552c('0x8'));var jayson=require(_0x552c('0x9'));var client=jayson['client'][_0x552c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38a84e,_0x411bcf,_0x39a630){return new BPromise(function(_0x503918,_0x32ad84){return client[_0x552c('0xb')](_0x38a84e,_0x39a630)[_0x552c('0xc')](function(_0x2a5ea5){logger[_0x552c('0xd')](_0x552c('0xe'),_0x411bcf,_0x552c('0xf'));logger[_0x552c('0x10')](_0x552c('0x11'),_0x411bcf,_0x552c('0xf'),JSON['stringify'](_0x2a5ea5));if(_0x2a5ea5[_0x552c('0x12')]){if(_0x2a5ea5['error']['code']===0x1f4){logger[_0x552c('0x12')](_0x552c('0xe'),_0x411bcf,_0x2a5ea5[_0x552c('0x12')][_0x552c('0x13')]);return _0x32ad84(_0x2a5ea5[_0x552c('0x12')]['message']);}logger[_0x552c('0x12')](_0x552c('0xe'),_0x411bcf,_0x2a5ea5[_0x552c('0x12')][_0x552c('0x13')]);return _0x503918(_0x2a5ea5[_0x552c('0x12')]['message']);}else{logger[_0x552c('0xd')](_0x552c('0xe'),_0x411bcf,'request\x20sent');_0x503918(_0x2a5ea5[_0x552c('0x14')][_0x552c('0x13')]);}})['catch'](function(_0x3d14f6){logger[_0x552c('0x12')](_0x552c('0xe'),_0x411bcf,_0x3d14f6);_0x32ad84(_0x3d14f6);});});}exports[_0x552c('0x15')]=function(_0x4eeec2){var _0x2ed2d8=this;return new Promise(function(_0x3478f2,_0x3f2031){return db['CmHopperFinal']['create'](_0x4eeec2[_0x552c('0x16')],{'raw':_0x4eeec2['options']?_0x4eeec2[_0x552c('0x17')][_0x552c('0x18')]===undefined?!![]:![]:!![]})[_0x552c('0xc')](function(_0x242fc0){logger['info']('CreateCmHopperFinal',_0x4eeec2);logger['debug'](_0x552c('0x15'),_0x4eeec2,JSON[_0x552c('0x19')](_0x242fc0));_0x3478f2(_0x242fc0);})[_0x552c('0x1a')](function(_0x2500c0){logger[_0x552c('0x12')](_0x552c('0x15'),_0x2500c0[_0x552c('0x13')],_0x4eeec2);_0x3f2031(_0x2ed2d8[_0x552c('0x12')](0x1f4,_0x2500c0['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index c4d9327..17d39e2 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 _0x1d2b=['update','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','/:id'];(function(_0x27a23c,_0x16cac6){var _0x4a3035=function(_0x31b776){while(--_0x31b776){_0x27a23c['push'](_0x27a23c['shift']());}};_0x4a3035(++_0x16cac6);}(_0x1d2b,0xda));var _0xb1d2=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x1d2b[_0xc6be3a];return _0x56a310;};'use strict';var multer=require('multer');var util=require(_0xb1d2('0x0'));var path=require('path');var timeout=require(_0xb1d2('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xb1d2('0x2'));var interaction=require(_0xb1d2('0x3'));var config=require('../../config/environment');var controller=require(_0xb1d2('0x4'));router[_0xb1d2('0x5')]('/',auth[_0xb1d2('0x6')](),controller[_0xb1d2('0x7')]);router['get'](_0xb1d2('0x8'),auth[_0xb1d2('0x6')](),controller[_0xb1d2('0x9')]);router[_0xb1d2('0x5')]('/:id',auth[_0xb1d2('0x6')](),controller[_0xb1d2('0xa')]);router[_0xb1d2('0x5')](_0xb1d2('0xb'),auth[_0xb1d2('0x6')](),controller[_0xb1d2('0xc')]);router[_0xb1d2('0x5')](_0xb1d2('0xd'),auth[_0xb1d2('0x6')](),controller[_0xb1d2('0xe')]);router[_0xb1d2('0xf')]('/voice/queue/moveContacts/:id',auth[_0xb1d2('0x6')](),controller[_0xb1d2('0x10')]);router[_0xb1d2('0xf')](_0xb1d2('0x11'),auth['isAuthenticated'](),controller[_0xb1d2('0x12')]);router['post'](_0xb1d2('0x13'),auth[_0xb1d2('0x6')](),controller[_0xb1d2('0x14')]);router['put'](_0xb1d2('0x15'),auth['isAuthenticated'](),controller[_0xb1d2('0x16')]);module[_0xb1d2('0x17')]=router; \ No newline at end of file +var _0x05e5=['../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','post','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5fa8ee,_0x21853f){var _0x139ef5=function(_0x4fa30f){while(--_0x4fa30f){_0x5fa8ee['push'](_0x5fa8ee['shift']());}};_0x139ef5(++_0x21853f);}(_0x05e5,0x1f1));var _0x505e=function(_0x2a419e,_0x1aef84){_0x2a419e=_0x2a419e-0x0;var _0x1b6f49=_0x05e5[_0x2a419e];return _0x1b6f49;};'use strict';var multer=require(_0x505e('0x0'));var util=require(_0x505e('0x1'));var path=require(_0x505e('0x2'));var timeout=require(_0x505e('0x3'));var express=require(_0x505e('0x4'));var router=express[_0x505e('0x5')]();var auth=require(_0x505e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x505e('0x7'));var controller=require(_0x505e('0x8'));router[_0x505e('0x9')]('/',auth[_0x505e('0xa')](),controller['index']);router[_0x505e('0x9')](_0x505e('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x505e('0xc'),auth[_0x505e('0xa')](),controller[_0x505e('0xd')]);router[_0x505e('0x9')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0x505e('0xe')]);router[_0x505e('0x9')](_0x505e('0xf'),auth[_0x505e('0xa')](),controller['countContactsIvrCampaignHopperFinal']);router['post']('/voice/queue/moveContacts/:id',auth[_0x505e('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router['post'](_0x505e('0x10'),auth['isAuthenticated'](),controller[_0x505e('0x11')]);router[_0x505e('0x12')](_0x505e('0x13'),auth[_0x505e('0xa')](),controller[_0x505e('0x14')]);router[_0x505e('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x505e('0x16')]);module[_0x505e('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 6f3f661..e97f57e 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 _0xee5b=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x10dcd6,_0x2b69e2){var _0x1fbbe2=function(_0x59fad5){while(--_0x59fad5){_0x10dcd6['push'](_0x10dcd6['shift']());}};_0x1fbbe2(++_0x2b69e2);}(_0xee5b,0xb5));var _0xbee5=function(_0x6ac873,_0xa6e428){_0x6ac873=_0x6ac873-0x0;var _0x221dad=_0xee5b[_0x6ac873];return _0x221dad;};'use strict';var Sequelize=require(_0xbee5('0x0'));module[_0xbee5('0x1')]={'state':{'type':Sequelize[_0xbee5('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xbee5('0x3')]},'scheduledat':{'type':Sequelize[_0xbee5('0x4')]},'countbusyretry':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbee5('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xbee5('0x3')]},'originatecalleridname':{'type':Sequelize[_0xbee5('0x3')]},'calleridnum':{'type':Sequelize[_0xbee5('0x3')]},'calleridname':{'type':Sequelize[_0xbee5('0x3')]},'starttime':{'type':Sequelize[_0xbee5('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xbee5('0x4')]},'droptime':{'type':Sequelize[_0xbee5('0x4')]},'endtime':{'type':Sequelize[_0xbee5('0x4')]},'ringtime':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbee5('0x3')]},'campaign':{'type':Sequelize[_0xbee5('0x3')]},'campaigntype':{'type':Sequelize[_0xbee5('0x3')]},'membername':{'type':Sequelize[_0xbee5('0x3')]},'reason':{'type':Sequelize[_0xbee5('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xbee5('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xbee5('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbee5('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbee5('0x4')]},'recallme':{'type':Sequelize[_0xbee5('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xbee5('0x4')]},'edited':{'type':Sequelize[_0xbee5('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcef9=['BOOLEAN','exports','STRING','DATE','INTEGER'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xcef9,0xdd));var _0x9cef=function(_0xc6400d,_0x1dfad0){_0xc6400d=_0xc6400d-0x0;var _0x50d568=_0xcef9[_0xc6400d];return _0x50d568;};'use strict';var Sequelize=require('sequelize');module[_0x9cef('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x9cef('0x1')]},'scheduledat':{'type':Sequelize[_0x9cef('0x2')]},'countbusyretry':{'type':Sequelize[_0x9cef('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9cef('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9cef('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9cef('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x9cef('0x1')]},'originatecalleridname':{'type':Sequelize[_0x9cef('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x9cef('0x2')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x9cef('0x2')]},'droptime':{'type':Sequelize[_0x9cef('0x2')]},'endtime':{'type':Sequelize[_0x9cef('0x2')]},'ringtime':{'type':Sequelize[_0x9cef('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9cef('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9cef('0x1')]},'campaign':{'type':Sequelize[_0x9cef('0x1')]},'campaigntype':{'type':Sequelize[_0x9cef('0x1')]},'membername':{'type':Sequelize[_0x9cef('0x1')]},'reason':{'type':Sequelize[_0x9cef('0x1')]},'amd':{'type':Sequelize[_0x9cef('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x9cef('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x9cef('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9cef('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x9cef('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x9cef('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x9cef('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9cef('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9cef('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 4dc1eb0..128b9e8 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 _0x5cf6=['map','CmHopperHistory','fieldName','type','model','name','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','count','findAll','rows','keys','filtears','create','body','describe','uniqueid','find','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','status','end','json','offset','limit','set','apply','reject','update','destroy','then','sendStatus','stack','index'];(function(_0x7ed1e4,_0x4077cb){var _0x3ecac3=function(_0x356bbd){while(--_0x356bbd){_0x7ed1e4['push'](_0x7ed1e4['shift']());}};_0x3ecac3(++_0x4077cb);}(_0x5cf6,0x198));var _0x65cf=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x5cf6[_0x1cc8fe];return _0x230054;};'use strict';var pdf=require(_0x65cf('0x0'));var emlformat=require(_0x65cf('0x1'));var rimraf=require(_0x65cf('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65cf('0x3'));var rp=require(_0x65cf('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x65cf('0x5'));var path=require(_0x65cf('0x6'));var sox=require('sox');var csv=require(_0x65cf('0x7'));var ejs=require(_0x65cf('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x65cf('0x9'));var crypto=require('crypto');var jsforce=require(_0x65cf('0xa'));var deskjs=require(_0x65cf('0xb'));var toCsv=require('to-csv');var querystring=require(_0x65cf('0xc'));var Papa=require(_0x65cf('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x65cf('0xe'));var as=require(_0x65cf('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x65cf('0x10'));var utils=require(_0x65cf('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x65cf('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e5ae0,_0x409ca2){_0x409ca2=_0x409ca2||0xcc;return function(_0x426e94){if(_0x426e94){return _0x3e5ae0['sendStatus'](_0x409ca2);}return _0x3e5ae0[_0x65cf('0x13')](_0x409ca2)[_0x65cf('0x14')]();};}function respondWithResult(_0x44013c,_0x517567){_0x517567=_0x517567||0xc8;return function(_0x5262cc){if(_0x5262cc){return _0x44013c[_0x65cf('0x13')](_0x517567)[_0x65cf('0x15')](_0x5262cc);}};}function respondWithFilteredResult(_0x5bbe02,_0x4c2d3){return function(_0x4e4406){if(_0x4e4406){var _0x20e7d4=_0x4e4406['count'],_0x524da9=_0x4c2d3[_0x65cf('0x16')],_0x1e78b8=_0x4c2d3[_0x65cf('0x16')]+_0x4c2d3[_0x65cf('0x17')],_0x43d863;if(_0x1e78b8>=_0x20e7d4){_0x1e78b8=_0x20e7d4;_0x43d863=0xc8;}else{_0x43d863=0xce;}_0x5bbe02[_0x65cf('0x13')](_0x43d863);return _0x5bbe02[_0x65cf('0x18')]('Content-Range',_0x524da9+'-'+_0x1e78b8+'/'+_0x20e7d4)['json'](_0x4e4406);}return null;};}function patchUpdates(_0xe3bf65){return function(_0x547abd){try{jsonpatch[_0x65cf('0x19')](_0x547abd,_0xe3bf65,!![]);}catch(_0x469de0){return BPromise[_0x65cf('0x1a')](_0x469de0);}return _0x547abd['save']();};}function saveUpdates(_0xf0b5f5,_0x410f46){return function(_0x17a2c1){if(_0x17a2c1){return _0x17a2c1[_0x65cf('0x1b')](_0xf0b5f5)['then'](function(_0x15403e){return _0x15403e;});}return null;};}function removeEntity(_0x34f1bb,_0x45aae9){return function(_0xd30111){if(_0xd30111){return _0xd30111[_0x65cf('0x1c')]()[_0x65cf('0x1d')](function(){_0x34f1bb['status'](0xcc)[_0x65cf('0x14')]();});}};}function handleEntityNotFound(_0x268c9f,_0x45d3c3){return function(_0x4b1084){if(!_0x4b1084){_0x268c9f[_0x65cf('0x1e')](0x194);}return _0x4b1084;};}function handleError(_0x111b4a,_0x1d499d){_0x1d499d=_0x1d499d||0x1f4;return function(_0x2154a7){logger['error'](_0x2154a7[_0x65cf('0x1f')]);if(_0x2154a7['name']){delete _0x2154a7['name'];}_0x111b4a[_0x65cf('0x13')](_0x1d499d)['send'](_0x2154a7);};}exports[_0x65cf('0x20')]=function(_0x20a619,_0x5ad68c){var _0x237813={},_0x50c0a3={},_0x15efe2={'count':0x0,'rows':[]};var _0x3cbf52=_[_0x65cf('0x21')](db[_0x65cf('0x22')]['rawAttributes'],function(_0x375533){return{'name':_0x375533[_0x65cf('0x23')],'type':_0x375533[_0x65cf('0x24')]['key']};});_0x50c0a3[_0x65cf('0x25')]=_[_0x65cf('0x21')](_0x3cbf52,_0x65cf('0x26'));_0x50c0a3[_0x65cf('0x27')]=_['keys'](_0x20a619[_0x65cf('0x27')]);_0x50c0a3[_0x65cf('0x28')]=_[_0x65cf('0x29')](_0x50c0a3[_0x65cf('0x25')],_0x50c0a3[_0x65cf('0x27')]);_0x237813[_0x65cf('0x2a')]=_[_0x65cf('0x29')](_0x50c0a3[_0x65cf('0x25')],qs[_0x65cf('0x2b')](_0x20a619[_0x65cf('0x27')][_0x65cf('0x2b')]));_0x237813['attributes']=_0x237813[_0x65cf('0x2a')][_0x65cf('0x2c')]?_0x237813[_0x65cf('0x2a')]:_0x50c0a3[_0x65cf('0x25')];if(!_0x20a619[_0x65cf('0x27')]['hasOwnProperty'](_0x65cf('0x2d'))){_0x237813['limit']=qs[_0x65cf('0x17')](_0x20a619['query'][_0x65cf('0x17')]);_0x237813[_0x65cf('0x16')]=qs[_0x65cf('0x16')](_0x20a619['query']['offset']);}_0x237813['order']=qs[_0x65cf('0x2e')](_0x20a619[_0x65cf('0x27')][_0x65cf('0x2e')]);_0x237813[_0x65cf('0x2f')]=qs[_0x65cf('0x28')](_['pick'](_0x20a619['query'],_0x50c0a3['filters']),_0x3cbf52);if(_0x20a619['query'][_0x65cf('0x30')]){_0x237813['where']=_[_0x65cf('0x31')](_0x237813[_0x65cf('0x2f')],{'$or':_[_0x65cf('0x21')](_0x3cbf52,function(_0x39d3bc){if(_0x39d3bc[_0x65cf('0x24')]!==_0x65cf('0x32')){var _0x283646={};_0x283646[_0x39d3bc[_0x65cf('0x26')]]={'$like':'%'+_0x20a619[_0x65cf('0x27')][_0x65cf('0x30')]+'%'};return _0x283646;}})});}_0x237813=_[_0x65cf('0x31')]({},_0x237813,_0x20a619[_0x65cf('0x33')]);var _0x5f0d8c={'where':_0x237813[_0x65cf('0x2f')]};return db[_0x65cf('0x22')][_0x65cf('0x34')](_0x5f0d8c)['then'](function(_0x1ed765){_0x15efe2[_0x65cf('0x34')]=_0x1ed765;if(_0x20a619['query']['includeAll']){_0x237813['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x65cf('0x35')](_0x237813);})[_0x65cf('0x1d')](function(_0x51a4d9){_0x15efe2[_0x65cf('0x36')]=_0x51a4d9;return _0x15efe2;})[_0x65cf('0x1d')](respondWithFilteredResult(_0x5ad68c,_0x237813))['catch'](handleError(_0x5ad68c,null));};exports['show']=function(_0x15a140,_0x53be6a){var _0x40d69e={'raw':!![],'where':{'id':_0x15a140['params']['id']}},_0xcde9e1={};_0xcde9e1[_0x65cf('0x25')]=_[_0x65cf('0x37')](db['CmHopperHistory']['rawAttributes']);_0xcde9e1['query']=_[_0x65cf('0x37')](_0x15a140[_0x65cf('0x27')]);_0xcde9e1[_0x65cf('0x38')]=_[_0x65cf('0x29')](_0xcde9e1[_0x65cf('0x25')],_0xcde9e1['query']);_0x40d69e[_0x65cf('0x2a')]=_[_0x65cf('0x29')](_0xcde9e1[_0x65cf('0x25')],qs[_0x65cf('0x2b')](_0x15a140['query'][_0x65cf('0x2b')]));_0x40d69e['attributes']=_0x40d69e[_0x65cf('0x2a')][_0x65cf('0x2c')]?_0x40d69e['attributes']:_0xcde9e1[_0x65cf('0x25')];if(_0x15a140[_0x65cf('0x27')]['includeAll']){_0x40d69e['include']=[{'all':!![]}];}_0x40d69e=_[_0x65cf('0x31')]({},_0x40d69e,_0x15a140[_0x65cf('0x33')]);return db[_0x65cf('0x22')]['find'](_0x40d69e)[_0x65cf('0x1d')](handleEntityNotFound(_0x53be6a,null))[_0x65cf('0x1d')](respondWithResult(_0x53be6a,null))['catch'](handleError(_0x53be6a,null));};exports[_0x65cf('0x39')]=function(_0x3bab88,_0x37f330){return db[_0x65cf('0x22')][_0x65cf('0x39')](_0x3bab88[_0x65cf('0x3a')],{})[_0x65cf('0x1d')](respondWithResult(_0x37f330,0xc9))['catch'](handleError(_0x37f330,null));};exports[_0x65cf('0x3b')]=function(_0xc6ec62,_0x1ddaf6){return db[_0x65cf('0x22')][_0x65cf('0x3b')]()[_0x65cf('0x1d')](respondWithResult(_0x1ddaf6,null))['catch'](handleError(_0x1ddaf6,null));};exports[_0x65cf('0x1b')]=function(_0x37597b,_0x269917){if(_0x37597b[_0x65cf('0x3a')]['uniqueid']){delete _0x37597b[_0x65cf('0x3a')][_0x65cf('0x3c')];}return db[_0x65cf('0x22')][_0x65cf('0x3d')]({'where':{'uniqueid':_0x37597b['params']['id']}})[_0x65cf('0x1d')](handleEntityNotFound(_0x269917,null))[_0x65cf('0x1d')](saveUpdates(_0x37597b[_0x65cf('0x3a')],null))[_0x65cf('0x1d')](respondWithResult(_0x269917,null))[_0x65cf('0x3e')](handleError(_0x269917,null));}; \ No newline at end of file +var _0xe9c3=['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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','map','CmHopperHistory','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','describe','uniqueid'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xe9c3,0x96));var _0x3e9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9c3[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3e9c('0x0'));var rimraf=require(_0x3e9c('0x1'));var zipdir=require(_0x3e9c('0x2'));var jsonpatch=require(_0x3e9c('0x3'));var rp=require('request-promise');var moment=require(_0x3e9c('0x4'));var BPromise=require(_0x3e9c('0x5'));var Mustache=require(_0x3e9c('0x6'));var util=require(_0x3e9c('0x7'));var path=require(_0x3e9c('0x8'));var sox=require(_0x3e9c('0x9'));var csv=require(_0x3e9c('0xa'));var ejs=require(_0x3e9c('0xb'));var fs=require('fs');var _=require(_0x3e9c('0xc'));var squel=require(_0x3e9c('0xd'));var crypto=require(_0x3e9c('0xe'));var jsforce=require(_0x3e9c('0xf'));var deskjs=require(_0x3e9c('0x10'));var toCsv=require(_0x3e9c('0xa'));var querystring=require(_0x3e9c('0x11'));var Papa=require(_0x3e9c('0x12'));var Redis=require(_0x3e9c('0x13'));var authService=require(_0x3e9c('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x3e9c('0x15'));var hardwareService=require(_0x3e9c('0x16'));var logger=require('../../config/logger')(_0x3e9c('0x17'));var utils=require(_0x3e9c('0x18'));var config=require(_0x3e9c('0x19'));var licenseUtil=require(_0x3e9c('0x1a'));var db=require(_0x3e9c('0x1b'))['db'];function respondWithStatusCode(_0x3a9af6,_0x3c916f){_0x3c916f=_0x3c916f||0xcc;return function(_0x483b62){if(_0x483b62){return _0x3a9af6[_0x3e9c('0x1c')](_0x3c916f);}return _0x3a9af6[_0x3e9c('0x1d')](_0x3c916f)[_0x3e9c('0x1e')]();};}function respondWithResult(_0x22d443,_0x34fdca){_0x34fdca=_0x34fdca||0xc8;return function(_0x52e553){if(_0x52e553){return _0x22d443['status'](_0x34fdca)['json'](_0x52e553);}};}function respondWithFilteredResult(_0x2c2181,_0x225958){return function(_0x1fd4b8){if(_0x1fd4b8){var _0x489166=_0x1fd4b8[_0x3e9c('0x1f')],_0x40e84d=_0x225958[_0x3e9c('0x20')],_0x15bec6=_0x225958[_0x3e9c('0x20')]+_0x225958[_0x3e9c('0x21')],_0x4d6ca8;if(_0x15bec6>=_0x489166){_0x15bec6=_0x489166;_0x4d6ca8=0xc8;}else{_0x4d6ca8=0xce;}_0x2c2181[_0x3e9c('0x1d')](_0x4d6ca8);return _0x2c2181[_0x3e9c('0x22')](_0x3e9c('0x23'),_0x40e84d+'-'+_0x15bec6+'/'+_0x489166)[_0x3e9c('0x24')](_0x1fd4b8);}return null;};}function patchUpdates(_0x11a5ce){return function(_0x1340e4){try{jsonpatch[_0x3e9c('0x25')](_0x1340e4,_0x11a5ce,!![]);}catch(_0x25b0d2){return BPromise[_0x3e9c('0x26')](_0x25b0d2);}return _0x1340e4['save']();};}function saveUpdates(_0x38b064,_0x4b98b3){return function(_0xa6f53a){if(_0xa6f53a){return _0xa6f53a[_0x3e9c('0x27')](_0x38b064)[_0x3e9c('0x28')](function(_0x11a221){return _0x11a221;});}return null;};}function removeEntity(_0xa25f9f,_0x76b28c){return function(_0x1bfad9){if(_0x1bfad9){return _0x1bfad9[_0x3e9c('0x29')]()[_0x3e9c('0x28')](function(){_0xa25f9f[_0x3e9c('0x1d')](0xcc)[_0x3e9c('0x1e')]();});}};}function handleEntityNotFound(_0xff4831,_0x17c234){return function(_0x27a895){if(!_0x27a895){_0xff4831[_0x3e9c('0x1c')](0x194);}return _0x27a895;};}function handleError(_0x378e93,_0x50ea3b){_0x50ea3b=_0x50ea3b||0x1f4;return function(_0x5c523b){logger[_0x3e9c('0x2a')](_0x5c523b['stack']);if(_0x5c523b[_0x3e9c('0x2b')]){delete _0x5c523b[_0x3e9c('0x2b')];}_0x378e93[_0x3e9c('0x1d')](_0x50ea3b)[_0x3e9c('0x2c')](_0x5c523b);};}exports['index']=function(_0x1b8722,_0x367e07){var _0x27787d={},_0x2f0277={},_0x2be339={'count':0x0,'rows':[]};var _0x2a8181=_[_0x3e9c('0x2d')](db[_0x3e9c('0x2e')][_0x3e9c('0x2f')],function(_0x3c5fac){return{'name':_0x3c5fac['fieldName'],'type':_0x3c5fac[_0x3e9c('0x30')][_0x3e9c('0x31')]};});_0x2f0277[_0x3e9c('0x32')]=_[_0x3e9c('0x2d')](_0x2a8181,_0x3e9c('0x2b'));_0x2f0277[_0x3e9c('0x33')]=_['keys'](_0x1b8722['query']);_0x2f0277[_0x3e9c('0x34')]=_[_0x3e9c('0x35')](_0x2f0277[_0x3e9c('0x32')],_0x2f0277[_0x3e9c('0x33')]);_0x27787d[_0x3e9c('0x36')]=_['intersection'](_0x2f0277[_0x3e9c('0x32')],qs[_0x3e9c('0x37')](_0x1b8722['query'][_0x3e9c('0x37')]));_0x27787d['attributes']=_0x27787d['attributes'][_0x3e9c('0x38')]?_0x27787d[_0x3e9c('0x36')]:_0x2f0277[_0x3e9c('0x32')];if(!_0x1b8722[_0x3e9c('0x33')][_0x3e9c('0x39')]('nolimit')){_0x27787d[_0x3e9c('0x21')]=qs['limit'](_0x1b8722[_0x3e9c('0x33')][_0x3e9c('0x21')]);_0x27787d[_0x3e9c('0x20')]=qs['offset'](_0x1b8722[_0x3e9c('0x33')]['offset']);}_0x27787d[_0x3e9c('0x3a')]=qs['sort'](_0x1b8722[_0x3e9c('0x33')]['sort']);_0x27787d[_0x3e9c('0x3b')]=qs[_0x3e9c('0x34')](_['pick'](_0x1b8722[_0x3e9c('0x33')],_0x2f0277[_0x3e9c('0x34')]),_0x2a8181);if(_0x1b8722['query'][_0x3e9c('0x3c')]){_0x27787d['where']=_[_0x3e9c('0x3d')](_0x27787d[_0x3e9c('0x3b')],{'$or':_['map'](_0x2a8181,function(_0x5ccc8a){if(_0x5ccc8a[_0x3e9c('0x30')]!=='VIRTUAL'){var _0x22f30a={};_0x22f30a[_0x5ccc8a[_0x3e9c('0x2b')]]={'$like':'%'+_0x1b8722[_0x3e9c('0x33')][_0x3e9c('0x3c')]+'%'};return _0x22f30a;}})});}_0x27787d=_['merge']({},_0x27787d,_0x1b8722[_0x3e9c('0x3e')]);var _0x19850c={'where':_0x27787d[_0x3e9c('0x3b')]};return db['CmHopperHistory']['count'](_0x19850c)[_0x3e9c('0x28')](function(_0x2bd6cb){_0x2be339['count']=_0x2bd6cb;if(_0x1b8722[_0x3e9c('0x33')][_0x3e9c('0x3f')]){_0x27787d[_0x3e9c('0x40')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x3e9c('0x41')](_0x27787d);})['then'](function(_0x143000){_0x2be339[_0x3e9c('0x42')]=_0x143000;return _0x2be339;})[_0x3e9c('0x28')](respondWithFilteredResult(_0x367e07,_0x27787d))[_0x3e9c('0x43')](handleError(_0x367e07,null));};exports[_0x3e9c('0x44')]=function(_0x24a18b,_0x30480e){var _0x34e819={'raw':!![],'where':{'id':_0x24a18b[_0x3e9c('0x45')]['id']}},_0x5b5a02={};_0x5b5a02[_0x3e9c('0x32')]=_[_0x3e9c('0x46')](db[_0x3e9c('0x2e')][_0x3e9c('0x2f')]);_0x5b5a02['query']=_[_0x3e9c('0x46')](_0x24a18b['query']);_0x5b5a02['filtears']=_[_0x3e9c('0x35')](_0x5b5a02[_0x3e9c('0x32')],_0x5b5a02[_0x3e9c('0x33')]);_0x34e819[_0x3e9c('0x36')]=_[_0x3e9c('0x35')](_0x5b5a02['model'],qs[_0x3e9c('0x37')](_0x24a18b[_0x3e9c('0x33')][_0x3e9c('0x37')]));_0x34e819[_0x3e9c('0x36')]=_0x34e819[_0x3e9c('0x36')][_0x3e9c('0x38')]?_0x34e819[_0x3e9c('0x36')]:_0x5b5a02[_0x3e9c('0x32')];if(_0x24a18b[_0x3e9c('0x33')][_0x3e9c('0x3f')]){_0x34e819[_0x3e9c('0x40')]=[{'all':!![]}];}_0x34e819=_[_0x3e9c('0x3d')]({},_0x34e819,_0x24a18b['options']);return db[_0x3e9c('0x2e')][_0x3e9c('0x47')](_0x34e819)[_0x3e9c('0x28')](handleEntityNotFound(_0x30480e,null))[_0x3e9c('0x28')](respondWithResult(_0x30480e,null))[_0x3e9c('0x43')](handleError(_0x30480e,null));};exports['create']=function(_0xc99344,_0x50d6ff){return db[_0x3e9c('0x2e')]['create'](_0xc99344[_0x3e9c('0x48')],{})[_0x3e9c('0x28')](respondWithResult(_0x50d6ff,0xc9))['catch'](handleError(_0x50d6ff,null));};exports['describe']=function(_0x5b0092,_0x3b0e0e){return db[_0x3e9c('0x2e')][_0x3e9c('0x49')]()[_0x3e9c('0x28')](respondWithResult(_0x3b0e0e,null))[_0x3e9c('0x43')](handleError(_0x3b0e0e,null));};exports['update']=function(_0x4aed39,_0x51636f){if(_0x4aed39[_0x3e9c('0x48')]['uniqueid']){delete _0x4aed39['body'][_0x3e9c('0x4a')];}return db['CmHopperHistory'][_0x3e9c('0x47')]({'where':{'uniqueid':_0x4aed39[_0x3e9c('0x45')]['id']}})[_0x3e9c('0x28')](handleEntityNotFound(_0x51636f,null))[_0x3e9c('0x28')](saveUpdates(_0x4aed39[_0x3e9c('0x48')],null))[_0x3e9c('0x28')](respondWithResult(_0x51636f,null))['catch'](handleError(_0x51636f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 12e2d22..ef109a6 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 _0xdc43=['./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','bluebird','rimraf'];(function(_0x3e1a10,_0x6aeaf2){var _0x2fb8ee=function(_0x473aa3){while(--_0x473aa3){_0x3e1a10['push'](_0x3e1a10['shift']());}};_0x2fb8ee(++_0x6aeaf2);}(_0xdc43,0x166));var _0x3dc4=function(_0x3c99b1,_0x5aef54){_0x3c99b1=_0x3c99b1-0x0;var _0x4f8a11=_0xdc43[_0x3c99b1];return _0x4f8a11;};'use strict';var _=require(_0x3dc4('0x0'));var util=require(_0x3dc4('0x1'));var logger=require(_0x3dc4('0x2'))(_0x3dc4('0x3'));var moment=require('moment');var BPromise=require(_0x3dc4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3dc4('0x5'));var config=require('../../config/environment');var attributes=require(_0x3dc4('0x6'));module[_0x3dc4('0x7')]=function(_0x4a6fb9,_0x44c38e){return _0x4a6fb9[_0x3dc4('0x8')](_0x3dc4('0x9'),attributes,{'tableName':_0x3dc4('0xa'),'paranoid':![],'indexes':[{'name':_0x3dc4('0xb'),'fields':[_0x3dc4('0xb')]},{'name':_0x3dc4('0xc'),'fields':[_0x3dc4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa3ce=['define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x33d63e,_0x3268e5){var _0x30ed75=function(_0x5a6ceb){while(--_0x5a6ceb){_0x33d63e['push'](_0x33d63e['shift']());}};_0x30ed75(++_0x3268e5);}(_0xa3ce,0xaa));var _0xea3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa3ce[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xea3c('0x0'));var util=require('util');var logger=require(_0xea3c('0x1'))(_0xea3c('0x2'));var moment=require(_0xea3c('0x3'));var BPromise=require(_0xea3c('0x4'));var rp=require(_0xea3c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea3c('0x6'));var config=require(_0xea3c('0x7'));var attributes=require(_0xea3c('0x8'));module[_0xea3c('0x9')]=function(_0x40b834,_0x58a674){return _0x40b834[_0xea3c('0xa')](_0xea3c('0xb'),attributes,{'tableName':_0xea3c('0xc'),'paranoid':![],'indexes':[{'name':_0xea3c('0xd'),'fields':[_0xea3c('0xd')]},{'name':'uniqueid','fields':[_0xea3c('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 ddfc3a6..a5fa3d5 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 _0x5ed7=['`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','catch','CmHopperHistory','options','CreateCmHopperHistory','AvgHandleTime','findAll','raw','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null'];(function(_0x1872df,_0x2bb85e){var _0x5b6478=function(_0x2fdc4d){while(--_0x2fdc4d){_0x1872df['push'](_0x1872df['shift']());}};_0x5b6478(++_0x2bb85e);}(_0x5ed7,0x1ed));var _0x75ed=function(_0x340c07,_0x41bd1d){_0x340c07=_0x340c07-0x0;var _0x2cadf6=_0x5ed7[_0x340c07];return _0x2cadf6;};'use strict';var _=require(_0x75ed('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x75ed('0x1'));var rs=require(_0x75ed('0x2'));var fs=require('fs');var Redis=require(_0x75ed('0x3'));var db=require(_0x75ed('0x4'))['db'];var utils=require(_0x75ed('0x5'));var logger=require(_0x75ed('0x6'))(_0x75ed('0x7'));var config=require(_0x75ed('0x8'));var jayson=require(_0x75ed('0x9'));var client=jayson[_0x75ed('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a3c83,_0x5b7c08,_0x38bb80){return new BPromise(function(_0x29c602,_0x17e001){return client[_0x75ed('0xb')](_0x4a3c83,_0x38bb80)[_0x75ed('0xc')](function(_0x37b577){logger['info'](_0x75ed('0xd'),_0x5b7c08,'request\x20sent');logger[_0x75ed('0xe')](_0x75ed('0xf'),_0x5b7c08,_0x75ed('0x10'),JSON[_0x75ed('0x11')](_0x37b577));if(_0x37b577['error']){if(_0x37b577['error'][_0x75ed('0x12')]===0x1f4){logger[_0x75ed('0x13')](_0x75ed('0xd'),_0x5b7c08,_0x37b577[_0x75ed('0x13')][_0x75ed('0x14')]);return _0x17e001(_0x37b577[_0x75ed('0x13')][_0x75ed('0x14')]);}logger[_0x75ed('0x13')](_0x75ed('0xd'),_0x5b7c08,_0x37b577[_0x75ed('0x13')]['message']);return _0x29c602(_0x37b577['error'][_0x75ed('0x14')]);}else{logger[_0x75ed('0x15')]('CmHopperHistory,\x20%s,\x20%s',_0x5b7c08,_0x75ed('0x10'));_0x29c602(_0x37b577['result'][_0x75ed('0x14')]);}})[_0x75ed('0x16')](function(_0x5f4ee5){logger[_0x75ed('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x5b7c08,_0x5f4ee5);_0x17e001(_0x5f4ee5);});});}exports['CreateCmHopperHistory']=function(_0x19dee6){var _0x15f1cd=this;return new Promise(function(_0x2c924e,_0x2e2899){return db[_0x75ed('0x17')]['create'](_0x19dee6['body'],{'raw':_0x19dee6[_0x75ed('0x18')]?_0x19dee6[_0x75ed('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xdc05e){logger['info'](_0x75ed('0x19'),_0x19dee6);logger[_0x75ed('0xe')]('CreateCmHopperHistory',_0x19dee6,JSON[_0x75ed('0x11')](_0xdc05e));_0x2c924e(_0xdc05e);})[_0x75ed('0x16')](function(_0x39a507){logger[_0x75ed('0x13')](_0x75ed('0x19'),_0x39a507[_0x75ed('0x14')],_0x19dee6);_0x2e2899(_0x15f1cd[_0x75ed('0x13')](0x1f4,_0x39a507[_0x75ed('0x14')]));});});};exports[_0x75ed('0x1a')]=function(_0x14bf91){var _0x4b62a9=this;return new Promise(function(_0x677265,_0x194828){return db[_0x75ed('0x17')][_0x75ed('0x1b')]({'raw':_0x14bf91['options']?_0x14bf91[_0x75ed('0x18')][_0x75ed('0x1c')]===undefined?!![]:![]:!![],'where':_0x14bf91[_0x75ed('0x18')]?_0x14bf91[_0x75ed('0x18')]['where']||null:null,'attributes':[[db[_0x75ed('0x1d')]['fn'](_0x75ed('0x1e'),db[_0x75ed('0x1d')][_0x75ed('0x1f')]('id')),_0x75ed('0x20')],[db[_0x75ed('0x1d')]['fn']('COUNT',db[_0x75ed('0x1d')]['fn']('IF',db['sequelize'][_0x75ed('0x21')](_0x75ed('0x22')))),_0x75ed('0x23')],[db[_0x75ed('0x1d')]['fn'](_0x75ed('0x1e'),db['sequelize']['fn']('IF',db[_0x75ed('0x1d')][_0x75ed('0x21')](_0x75ed('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x75ed('0x1d')]['fn'](_0x75ed('0x1e'),db[_0x75ed('0x1d')]['fn']('IF',db['sequelize'][_0x75ed('0x21')]('`state`\x20=\x2011,\x201,\x20null'))),_0x75ed('0x25')],[db['sequelize']['fn']('AVG',db[_0x75ed('0x1d')]['fn']('IF',db['sequelize'][_0x75ed('0x21')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x75ed('0x26')],[db[_0x75ed('0x1d')]['fn'](_0x75ed('0x27'),db[_0x75ed('0x1d')]['fn']('IF',db[_0x75ed('0x1d')][_0x75ed('0x21')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x75ed('0x28')]]})[_0x75ed('0xc')](function(_0x2c9ac6){logger[_0x75ed('0x15')]('AvgHandleTime',_0x14bf91);logger['debug'](_0x75ed('0x1a'),_0x14bf91,JSON[_0x75ed('0x11')](_0x2c9ac6));_0x677265(_0x2c9ac6);})[_0x75ed('0x16')](function(_0xcba27a){logger[_0x75ed('0x13')](_0x75ed('0x1a'),_0xcba27a[_0x75ed('0x14')],_0x14bf91);_0x194828(_0x4b62a9[_0x75ed('0x13')](0x1f4,_0xcba27a[_0x75ed('0x14')]));});});};exports[_0x75ed('0x29')]=function(_0x2541ca){var _0x39606b=this;return new Promise(function(_0x205565,_0x299c4b){return db['CmHopperHistory'][_0x75ed('0x1b')]({'raw':_0x2541ca[_0x75ed('0x18')]?_0x2541ca[_0x75ed('0x18')][_0x75ed('0x1c')]===undefined?!![]:![]:!![],'where':_0x2541ca[_0x75ed('0x18')]?_0x2541ca['options'][_0x75ed('0x2a')]||null:null,'attributes':[[_0x75ed('0x2b'),_0x75ed('0x2c')],[db[_0x75ed('0x1d')]['fn'](_0x75ed('0x1e'),db[_0x75ed('0x1d')]['fn']('IF',db[_0x75ed('0x1d')][_0x75ed('0x21')]('`state`\x20=\x200,\x201,\x20null'))),_0x75ed('0x2d')],[db['sequelize']['fn'](_0x75ed('0x1e'),db[_0x75ed('0x1d')]['fn']('IF',db[_0x75ed('0x1d')]['literal'](_0x75ed('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0x75ed('0x1d')]['fn'](_0x75ed('0x1e'),db[_0x75ed('0x1d')]['fn']('IF',db[_0x75ed('0x1d')][_0x75ed('0x21')](_0x75ed('0x22')))),_0x75ed('0x2f')],[db['sequelize']['fn']('COUNT',db[_0x75ed('0x1d')]['fn']('IF',db[_0x75ed('0x1d')]['literal'](_0x75ed('0x30')))),_0x75ed('0x31')],[db[_0x75ed('0x1d')]['fn'](_0x75ed('0x1e'),db[_0x75ed('0x1d')]['fn']('IF',db[_0x75ed('0x1d')][_0x75ed('0x21')](_0x75ed('0x32')))),'outboundCongestionCallsDay'],[db['sequelize']['fn'](_0x75ed('0x1e'),db['sequelize']['fn']('IF',db[_0x75ed('0x1d')]['literal'](_0x75ed('0x33')))),_0x75ed('0x34')],[db[_0x75ed('0x1d')]['fn'](_0x75ed('0x1e'),db[_0x75ed('0x1d')]['fn']('IF',db['sequelize'][_0x75ed('0x21')](_0x75ed('0x35')))),'outboundDropCallsDayCallersExit'],[db[_0x75ed('0x1d')]['fn'](_0x75ed('0x1e'),db[_0x75ed('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x75ed('0x36')))),'outboundUnknownCallsDay'],[db[_0x75ed('0x1d')]['fn'](_0x75ed('0x1e'),db[_0x75ed('0x1d')]['fn']('IF',db[_0x75ed('0x1d')]['literal'](_0x75ed('0x37')))),'outboundBlacklistCallsDay'],[db[_0x75ed('0x1d')]['fn'](_0x75ed('0x1e'),db[_0x75ed('0x1d')]['fn']('IF',db[_0x75ed('0x1d')][_0x75ed('0x21')](_0x75ed('0x38')))),_0x75ed('0x39')],[db[_0x75ed('0x1d')]['fn'](_0x75ed('0x1e'),db[_0x75ed('0x1d')]['fn']('IF',db[_0x75ed('0x1d')][_0x75ed('0x21')](_0x75ed('0x3a')))),_0x75ed('0x3b')],[db[_0x75ed('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x75ed('0x1d')]['literal'](_0x75ed('0x3c')))),_0x75ed('0x3d')],[db[_0x75ed('0x1d')]['fn'](_0x75ed('0x1e'),db[_0x75ed('0x1d')]['fn']('IF',db[_0x75ed('0x1d')][_0x75ed('0x21')](_0x75ed('0x3e')))),_0x75ed('0x3b')],[db[_0x75ed('0x1d')]['fn'](_0x75ed('0x1e'),db[_0x75ed('0x1d')]['fn']('IF',db['sequelize'][_0x75ed('0x21')](_0x75ed('0x3f')))),_0x75ed('0x40')]],'group':['campaign']})[_0x75ed('0xc')](function(_0x45f9d8){logger[_0x75ed('0x15')](_0x75ed('0x29'),_0x2541ca);logger[_0x75ed('0xe')](_0x75ed('0x29'),_0x2541ca,JSON[_0x75ed('0x11')](_0x45f9d8));_0x205565(_0x45f9d8);})[_0x75ed('0x16')](function(_0x5b0c47){logger['error'](_0x75ed('0x29'),_0x5b0c47['message'],_0x2541ca);_0x299c4b(_0x39606b[_0x75ed('0x13')](0x1f4,_0x5b0c47[_0x75ed('0x14')]));});});};exports['GetCampaignHopperHistory']=function(_0x129a1f){var _0x1aff1f=this;return new Promise(function(_0x5a9127,_0x19e164){return db['CmHopperHistory'][_0x75ed('0x1b')]({'raw':_0x129a1f['options']?_0x129a1f[_0x75ed('0x18')][_0x75ed('0x1c')]===undefined?!![]:![]:!![],'where':_0x129a1f[_0x75ed('0x18')]?_0x129a1f[_0x75ed('0x18')]['where']||null:null,'attributes':[['campaign','name'],[db[_0x75ed('0x1d')]['fn']('COUNT',db[_0x75ed('0x1d')][_0x75ed('0x1f')]('id')),_0x75ed('0x41')],[db[_0x75ed('0x1d')]['fn'](_0x75ed('0x1e'),db[_0x75ed('0x1d')]['fn']('IF',db[_0x75ed('0x1d')][_0x75ed('0x21')](_0x75ed('0x22')))),_0x75ed('0x42')]],'group':[_0x75ed('0x2b')]})[_0x75ed('0xc')](function(_0x2bfe7d){logger['info'](_0x75ed('0x43'),_0x129a1f);logger[_0x75ed('0xe')](_0x75ed('0x43'),_0x129a1f,JSON[_0x75ed('0x11')](_0x2bfe7d));_0x5a9127(_0x2bfe7d);})['catch'](function(_0x18a497){logger[_0x75ed('0x13')](_0x75ed('0x43'),_0x18a497['message'],_0x129a1f);_0x19e164(_0x1aff1f[_0x75ed('0x13')](0x1f4,_0x18a497[_0x75ed('0x14')]));});});}; \ No newline at end of file +var _0x2c02=['result','catch','CreateCmHopperHistory','CmHopperHistory','options','raw','COUNT','col','predictiveIntervalTotalCalls','sequelize','literal','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','where','ivrTotalCallsDays','`state`\x20=\x204,\x201,\x20null','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x403e1a,_0x27e00c){var _0x1c65f4=function(_0x2bbd95){while(--_0x2bbd95){_0x403e1a['push'](_0x403e1a['shift']());}};_0x1c65f4(++_0x27e00c);}(_0x2c02,0x178));var _0x22c0=function(_0x5e5361,_0x3f2d46){_0x5e5361=_0x5e5361-0x0;var _0x3c89d9=_0x2c02[_0x5e5361];return _0x3c89d9;};'use strict';var _=require(_0x22c0('0x0'));var util=require(_0x22c0('0x1'));var moment=require('moment');var BPromise=require(_0x22c0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x22c0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x22c0('0x4'))(_0x22c0('0x5'));var config=require(_0x22c0('0x6'));var jayson=require(_0x22c0('0x7'));var client=jayson['client'][_0x22c0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2eafcd,_0x4e2356,_0x3ae4c2){return new BPromise(function(_0x45ff22,_0x16df75){return client[_0x22c0('0x9')](_0x2eafcd,_0x3ae4c2)[_0x22c0('0xa')](function(_0x51ee4d){logger[_0x22c0('0xb')](_0x22c0('0xc'),_0x4e2356,'request\x20sent');logger[_0x22c0('0xd')](_0x22c0('0xe'),_0x4e2356,_0x22c0('0xf'),JSON[_0x22c0('0x10')](_0x51ee4d));if(_0x51ee4d[_0x22c0('0x11')]){if(_0x51ee4d[_0x22c0('0x11')][_0x22c0('0x12')]===0x1f4){logger[_0x22c0('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x4e2356,_0x51ee4d[_0x22c0('0x11')]['message']);return _0x16df75(_0x51ee4d['error']['message']);}logger[_0x22c0('0x11')](_0x22c0('0xc'),_0x4e2356,_0x51ee4d[_0x22c0('0x11')][_0x22c0('0x13')]);return _0x45ff22(_0x51ee4d[_0x22c0('0x11')][_0x22c0('0x13')]);}else{logger[_0x22c0('0xb')](_0x22c0('0xc'),_0x4e2356,_0x22c0('0xf'));_0x45ff22(_0x51ee4d[_0x22c0('0x14')]['message']);}})[_0x22c0('0x15')](function(_0x1a10c6){logger[_0x22c0('0x11')](_0x22c0('0xc'),_0x4e2356,_0x1a10c6);_0x16df75(_0x1a10c6);});});}exports[_0x22c0('0x16')]=function(_0x4315d1){var _0x1f5cd7=this;return new Promise(function(_0xe3d94e,_0x15c90f){return db[_0x22c0('0x17')]['create'](_0x4315d1['body'],{'raw':_0x4315d1['options']?_0x4315d1[_0x22c0('0x18')][_0x22c0('0x19')]===undefined?!![]:![]:!![]})[_0x22c0('0xa')](function(_0x292204){logger[_0x22c0('0xb')](_0x22c0('0x16'),_0x4315d1);logger[_0x22c0('0xd')](_0x22c0('0x16'),_0x4315d1,JSON['stringify'](_0x292204));_0xe3d94e(_0x292204);})[_0x22c0('0x15')](function(_0xfedeb9){logger['error'](_0x22c0('0x16'),_0xfedeb9['message'],_0x4315d1);_0x15c90f(_0x1f5cd7[_0x22c0('0x11')](0x1f4,_0xfedeb9[_0x22c0('0x13')]));});});};exports['AvgHandleTime']=function(_0x41b9a7){var _0x28749b=this;return new Promise(function(_0xe8f27f,_0x52a23a){return db[_0x22c0('0x17')]['findAll']({'raw':_0x41b9a7['options']?_0x41b9a7[_0x22c0('0x18')][_0x22c0('0x19')]===undefined?!![]:![]:!![],'where':_0x41b9a7[_0x22c0('0x18')]?_0x41b9a7[_0x22c0('0x18')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x22c0('0x1a'),db['sequelize'][_0x22c0('0x1b')]('id')),_0x22c0('0x1c')],[db['sequelize']['fn']('COUNT',db[_0x22c0('0x1d')]['fn']('IF',db[_0x22c0('0x1d')][_0x22c0('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x22c0('0x1d')]['fn'](_0x22c0('0x1a'),db['sequelize']['fn']('IF',db[_0x22c0('0x1d')][_0x22c0('0x1e')]('`state`\x20=\x2010,\x201,\x20null'))),_0x22c0('0x1f')],[db[_0x22c0('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x22c0('0x1e')](_0x22c0('0x20')))),_0x22c0('0x21')],[db[_0x22c0('0x1d')]['fn'](_0x22c0('0x22'),db[_0x22c0('0x1d')]['fn']('IF',db[_0x22c0('0x1d')][_0x22c0('0x1e')](_0x22c0('0x23')))),_0x22c0('0x24')],[db['sequelize']['fn'](_0x22c0('0x22'),db[_0x22c0('0x1d')]['fn']('IF',db['sequelize'][_0x22c0('0x1e')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x22c0('0x25')]]})[_0x22c0('0xa')](function(_0x5b7b89){logger[_0x22c0('0xb')](_0x22c0('0x26'),_0x41b9a7);logger['debug'](_0x22c0('0x26'),_0x41b9a7,JSON['stringify'](_0x5b7b89));_0xe8f27f(_0x5b7b89);})[_0x22c0('0x15')](function(_0x25c670){logger[_0x22c0('0x11')]('AvgHandleTime',_0x25c670[_0x22c0('0x13')],_0x41b9a7);_0x52a23a(_0x28749b[_0x22c0('0x11')](0x1f4,_0x25c670[_0x22c0('0x13')]));});});};exports[_0x22c0('0x27')]=function(_0x4cc394){var _0x447db2=this;return new Promise(function(_0x3fdbcc,_0x44d990){return db[_0x22c0('0x17')][_0x22c0('0x28')]({'raw':_0x4cc394['options']?_0x4cc394[_0x22c0('0x18')][_0x22c0('0x19')]===undefined?!![]:![]:!![],'where':_0x4cc394[_0x22c0('0x18')]?_0x4cc394[_0x22c0('0x18')]['where']||null:null,'attributes':[[_0x22c0('0x29'),_0x22c0('0x2a')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x22c0('0x1e')](_0x22c0('0x2b')))),_0x22c0('0x2c')],[db[_0x22c0('0x1d')]['fn']('COUNT',db[_0x22c0('0x1d')]['fn']('IF',db[_0x22c0('0x1d')][_0x22c0('0x1e')](_0x22c0('0x2d')))),_0x22c0('0x2e')],[db[_0x22c0('0x1d')]['fn'](_0x22c0('0x1a'),db[_0x22c0('0x1d')]['fn']('IF',db[_0x22c0('0x1d')][_0x22c0('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0x22c0('0x1d')]['fn'](_0x22c0('0x1a'),db[_0x22c0('0x1d')]['fn']('IF',db[_0x22c0('0x1d')]['literal'](_0x22c0('0x2f')))),_0x22c0('0x30')],[db['sequelize']['fn'](_0x22c0('0x1a'),db[_0x22c0('0x1d')]['fn']('IF',db[_0x22c0('0x1d')][_0x22c0('0x1e')](_0x22c0('0x31')))),'outboundCongestionCallsDay'],[db[_0x22c0('0x1d')]['fn'](_0x22c0('0x1a'),db[_0x22c0('0x1d')]['fn']('IF',db[_0x22c0('0x1d')][_0x22c0('0x1e')](_0x22c0('0x32')))),_0x22c0('0x33')],[db[_0x22c0('0x1d')]['fn']('COUNT',db[_0x22c0('0x1d')]['fn']('IF',db['sequelize'][_0x22c0('0x1e')](_0x22c0('0x34')))),_0x22c0('0x35')],[db['sequelize']['fn'](_0x22c0('0x1a'),db['sequelize']['fn']('IF',db['sequelize'][_0x22c0('0x1e')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0x22c0('0x1a'),db[_0x22c0('0x1d')]['fn']('IF',db[_0x22c0('0x1d')][_0x22c0('0x1e')](_0x22c0('0x36')))),'outboundBlacklistCallsDay'],[db[_0x22c0('0x1d')]['fn'](_0x22c0('0x1a'),db[_0x22c0('0x1d')]['fn']('IF',db[_0x22c0('0x1d')]['literal'](_0x22c0('0x37')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0x22c0('0x1a'),db[_0x22c0('0x1d')]['fn']('IF',db['sequelize'][_0x22c0('0x1e')](_0x22c0('0x38')))),_0x22c0('0x39')],[db['sequelize']['fn'](_0x22c0('0x1a'),db['sequelize']['fn']('IF',db[_0x22c0('0x1d')][_0x22c0('0x1e')]('`state`\x20=\x2016,\x201,\x20null'))),_0x22c0('0x3a')],[db['sequelize']['fn'](_0x22c0('0x1a'),db[_0x22c0('0x1d')]['fn']('IF',db['sequelize'][_0x22c0('0x1e')](_0x22c0('0x3b')))),_0x22c0('0x39')],[db[_0x22c0('0x1d')]['fn'](_0x22c0('0x1a'),db[_0x22c0('0x1d')]['fn']('IF',db[_0x22c0('0x1d')][_0x22c0('0x1e')](_0x22c0('0x3c')))),'outboundReCallsDay']],'group':[_0x22c0('0x29')]})['then'](function(_0x42892d){logger[_0x22c0('0xb')](_0x22c0('0x27'),_0x4cc394);logger[_0x22c0('0xd')](_0x22c0('0x27'),_0x4cc394,JSON['stringify'](_0x42892d));_0x3fdbcc(_0x42892d);})['catch'](function(_0x2177a4){logger['error']('GetVoiceQueueHopperHistory',_0x2177a4[_0x22c0('0x13')],_0x4cc394);_0x44d990(_0x447db2[_0x22c0('0x11')](0x1f4,_0x2177a4[_0x22c0('0x13')]));});});};exports['GetCampaignHopperHistory']=function(_0xa3a261){var _0x5765a6=this;return new Promise(function(_0xbec181,_0x521e2e){return db[_0x22c0('0x17')][_0x22c0('0x28')]({'raw':_0xa3a261[_0x22c0('0x18')]?_0xa3a261[_0x22c0('0x18')][_0x22c0('0x19')]===undefined?!![]:![]:!![],'where':_0xa3a261[_0x22c0('0x18')]?_0xa3a261[_0x22c0('0x18')][_0x22c0('0x3d')]||null:null,'attributes':[[_0x22c0('0x29'),_0x22c0('0x2a')],[db[_0x22c0('0x1d')]['fn']('COUNT',db['sequelize'][_0x22c0('0x1b')]('id')),_0x22c0('0x3e')],[db[_0x22c0('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x22c0('0x1e')](_0x22c0('0x3f')))),_0x22c0('0x40')]],'group':[_0x22c0('0x29')]})[_0x22c0('0xa')](function(_0x180263){logger[_0x22c0('0xb')]('GetCampaignHopperHistory',_0xa3a261);logger[_0x22c0('0xd')](_0x22c0('0x41'),_0xa3a261,JSON[_0x22c0('0x10')](_0x180263));_0xbec181(_0x180263);})[_0x22c0('0x15')](function(_0x10125e){logger['error'](_0x22c0('0x41'),_0x10125e[_0x22c0('0x13')],_0xa3a261);_0x521e2e(_0x5765a6['error'](0x1f4,_0x10125e['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 1124c56..794f96e 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 _0x1e7c=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','show','post','put','/:id','update','exports'];(function(_0x48cd2b,_0xf4b369){var _0x44f334=function(_0x10bc97){while(--_0x10bc97){_0x48cd2b['push'](_0x48cd2b['shift']());}};_0x44f334(++_0xf4b369);}(_0x1e7c,0x132));var _0xc1e7=function(_0x2fc706,_0x3752c2){_0x2fc706=_0x2fc706-0x0;var _0xeac917=_0x1e7c[_0x2fc706];return _0xeac917;};'use strict';var multer=require(_0xc1e7('0x0'));var util=require('util');var path=require(_0xc1e7('0x1'));var timeout=require('connect-timeout');var express=require(_0xc1e7('0x2'));var router=express[_0xc1e7('0x3')]();var auth=require(_0xc1e7('0x4'));var interaction=require(_0xc1e7('0x5'));var config=require('../../config/environment');var controller=require(_0xc1e7('0x6'));router['get']('/',auth[_0xc1e7('0x7')](),controller[_0xc1e7('0x8')]);router[_0xc1e7('0x9')](_0xc1e7('0xa'),auth[_0xc1e7('0x7')](),controller['describe']);router[_0xc1e7('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc1e7('0xb')]);router[_0xc1e7('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc1e7('0xd')](_0xc1e7('0xe'),auth[_0xc1e7('0x7')](),controller[_0xc1e7('0xf')]);module[_0xc1e7('0x10')]=router; \ No newline at end of file +var _0x4c84=['post','create','put','update','util','path','express','Router','../../components/auth/service','../../components/interaction/service','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x3b56c0,_0xe100d8){var _0x377efe=function(_0x181589){while(--_0x181589){_0x3b56c0['push'](_0x3b56c0['shift']());}};_0x377efe(++_0xe100d8);}(_0x4c84,0x124));var _0x44c8=function(_0x270404,_0x27bce9){_0x270404=_0x270404-0x0;var _0x5e0690=_0x4c84[_0x270404];return _0x5e0690;};'use strict';var multer=require('multer');var util=require(_0x44c8('0x0'));var path=require(_0x44c8('0x1'));var timeout=require('connect-timeout');var express=require(_0x44c8('0x2'));var router=express[_0x44c8('0x3')]();var auth=require(_0x44c8('0x4'));var interaction=require(_0x44c8('0x5'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44c8('0x6')]);router['get'](_0x44c8('0x7'),auth[_0x44c8('0x8')](),controller[_0x44c8('0x9')]);router['get'](_0x44c8('0xa'),auth['isAuthenticated'](),controller[_0x44c8('0xb')]);router[_0x44c8('0xc')]('/',auth[_0x44c8('0x8')](),controller[_0x44c8('0xd')]);router[_0x44c8('0xe')](_0x44c8('0xa'),auth[_0x44c8('0x8')](),controller[_0x44c8('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index e955aec..11319dc 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 _0x1aec=['exports','STRING'];(function(_0x3b44f8,_0x252691){var _0x2e272a=function(_0x3ad695){while(--_0x3ad695){_0x3b44f8['push'](_0x3b44f8['shift']());}};_0x2e272a(++_0x252691);}(_0x1aec,0x124));var _0xc1ae=function(_0x1f5bf7,_0x8ea22a){_0x1f5bf7=_0x1f5bf7-0x0;var _0x150087=_0x1aec[_0x1f5bf7];return _0x150087;};'use strict';var Sequelize=require('sequelize');module[_0xc1ae('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc1ae('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4e79=['name','sequelize','exports','STRING'];(function(_0x5890ed,_0x5eec7c){var _0x49ef9b=function(_0x3d68eb){while(--_0x3d68eb){_0x5890ed['push'](_0x5890ed['shift']());}};_0x49ef9b(++_0x5eec7c);}(_0x4e79,0x129));var _0x94e7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4e79[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x94e7('0x0'));module[_0x94e7('0x1')]={'name':{'type':Sequelize[_0x94e7('0x2')],'unique':_0x94e7('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x94e7('0x2')]},'dialPrefix':{'type':Sequelize[_0x94e7('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index fb46150..3acfb07 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 _0xb35f=['defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','removeAgents','emit','userCmList:remove','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','Lists','UserProfileResource','error','name','send','index','map','CmList','fieldName','type','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','filtears','intersection','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','destroy','describe','addDisposition','ListId','Disposition','getDispositions','findAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','each','omit','success','push','dataValues','Malformed\x20request\x20syntax','CustomFields','concat','format','getContactsCsv','CmCustomField','raw','isEmpty','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','/tmp/list_%d_%s.csv','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','INTEGER','switch','BOOLEAN'];(function(_0x33e9c3,_0x5df2a8){var _0x5d752f=function(_0x340c28){while(--_0x340c28){_0x33e9c3['push'](_0x33e9c3['shift']());}};_0x5d752f(++_0x5df2a8);}(_0xb35f,0x1c8));var _0xfb35=function(_0x3d77e9,_0x5813d4){_0x3d77e9=_0x3d77e9-0x0;var _0xb29c1c=_0xb35f[_0x3d77e9];return _0xb29c1c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfb35('0x0'));var rimraf=require(_0xfb35('0x1'));var zipdir=require(_0xfb35('0x2'));var jsonpatch=require(_0xfb35('0x3'));var rp=require(_0xfb35('0x4'));var moment=require('moment');var BPromise=require(_0xfb35('0x5'));var Mustache=require(_0xfb35('0x6'));var util=require(_0xfb35('0x7'));var path=require(_0xfb35('0x8'));var sox=require('sox');var csv=require(_0xfb35('0x9'));var ejs=require(_0xfb35('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfb35('0xb'));var crypto=require('crypto');var jsforce=require(_0xfb35('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfb35('0xd'));var Papa=require(_0xfb35('0xe'));var Redis=require(_0xfb35('0xf'));var authService=require(_0xfb35('0x10'));var qs=require(_0xfb35('0x11'));var as=require(_0xfb35('0x12'));var hardwareService=require(_0xfb35('0x13'));var logger=require(_0xfb35('0x14'))(_0xfb35('0x15'));var utils=require(_0xfb35('0x16'));var config=require(_0xfb35('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfb35('0x18'))['db'];config[_0xfb35('0x19')]=_[_0xfb35('0x1a')](config[_0xfb35('0x19')],{'host':_0xfb35('0x1b'),'port':0x18eb});var socket=require(_0xfb35('0x1c'))(new Redis(config['redis']));require(_0xfb35('0x1d'))[_0xfb35('0x1e')](socket);function respondWithStatusCode(_0x2f10d6,_0x5af5c3){_0x5af5c3=_0x5af5c3||0xcc;return function(_0x380157){if(_0x380157){return _0x2f10d6[_0xfb35('0x1f')](_0x5af5c3);}return _0x2f10d6[_0xfb35('0x20')](_0x5af5c3)[_0xfb35('0x21')]();};}function respondWithResult(_0x288794,_0x3a1c5f){_0x3a1c5f=_0x3a1c5f||0xc8;return function(_0x3f572b){if(_0x3f572b){return _0x288794[_0xfb35('0x20')](_0x3a1c5f)[_0xfb35('0x22')](_0x3f572b);}};}function respondWithFilteredResult(_0x41c7c8,_0x352397){return function(_0x48b12b){if(_0x48b12b){var _0x55dab2=_0x48b12b[_0xfb35('0x23')],_0x23ec62=_0x352397[_0xfb35('0x24')],_0x93da3=_0x352397['offset']+_0x352397[_0xfb35('0x25')],_0x5f095e;if(_0x93da3>=_0x55dab2){_0x93da3=_0x55dab2;_0x5f095e=0xc8;}else{_0x5f095e=0xce;}_0x41c7c8['status'](_0x5f095e);return _0x41c7c8[_0xfb35('0x26')](_0xfb35('0x27'),_0x23ec62+'-'+_0x93da3+'/'+_0x55dab2)[_0xfb35('0x22')](_0x48b12b);}return null;};}function patchUpdates(_0x5c8e2f){return function(_0x36651b){try{jsonpatch[_0xfb35('0x28')](_0x36651b,_0x5c8e2f,!![]);}catch(_0x5a971e){return BPromise[_0xfb35('0x29')](_0x5a971e);}return _0x36651b[_0xfb35('0x2a')]();};}function saveUpdates(_0x54eaec,_0x1285c0){return function(_0x2511d0){if(_0x2511d0){return _0x2511d0[_0xfb35('0x2b')](_0x54eaec)[_0xfb35('0x2c')](function(_0x3dad84){return _0x3dad84;});}return null;};}function removeEntity(_0x131bb4,_0x1ab940){return function(_0x8454ff){if(_0x8454ff){return _0x8454ff['destroy']()['then'](function(){var _0x434bd9=_0x8454ff['get']({'plain':!![]});var _0x33116d=_0xfb35('0x2d');return db[_0xfb35('0x2e')]['destroy']({'where':{'type':_0x33116d,'resourceId':_0x434bd9['id']}})[_0xfb35('0x2c')](function(){return _0x8454ff;});})[_0xfb35('0x2c')](function(){_0x131bb4['status'](0xcc)[_0xfb35('0x21')]();});}};}function handleEntityNotFound(_0x3fa419,_0x46147e){return function(_0x2be54f){if(!_0x2be54f){_0x3fa419[_0xfb35('0x1f')](0x194);}return _0x2be54f;};}function handleError(_0x5fbe9d,_0x378333){_0x378333=_0x378333||0x1f4;return function(_0x4530a3){logger[_0xfb35('0x2f')](_0x4530a3['stack']);if(_0x4530a3[_0xfb35('0x30')]){delete _0x4530a3['name'];}_0x5fbe9d[_0xfb35('0x20')](_0x378333)[_0xfb35('0x31')](_0x4530a3);};}exports[_0xfb35('0x32')]=function(_0x2caade,_0x329c07){var _0x2cf720={},_0x308753={},_0x172951={'count':0x0,'rows':[]};var _0x5041db=_[_0xfb35('0x33')](db[_0xfb35('0x34')]['rawAttributes'],function(_0x2ce516){return{'name':_0x2ce516[_0xfb35('0x35')],'type':_0x2ce516[_0xfb35('0x36')]['key']};});_0x308753[_0xfb35('0x37')]=_['map'](_0x5041db,'name');_0x308753['query']=_[_0xfb35('0x38')](_0x2caade[_0xfb35('0x39')]);_0x308753[_0xfb35('0x3a')]=_['intersection'](_0x308753[_0xfb35('0x37')],_0x308753[_0xfb35('0x39')]);_0x2cf720[_0xfb35('0x3b')]=_['intersection'](_0x308753[_0xfb35('0x37')],qs[_0xfb35('0x3c')](_0x2caade[_0xfb35('0x39')][_0xfb35('0x3c')]));_0x2cf720[_0xfb35('0x3b')]=_0x2cf720[_0xfb35('0x3b')][_0xfb35('0x3d')]?_0x2cf720[_0xfb35('0x3b')]:_0x308753[_0xfb35('0x37')];if(!_0x2caade[_0xfb35('0x39')][_0xfb35('0x3e')](_0xfb35('0x3f'))){_0x2cf720[_0xfb35('0x25')]=qs['limit'](_0x2caade['query'][_0xfb35('0x25')]);_0x2cf720[_0xfb35('0x24')]=qs[_0xfb35('0x24')](_0x2caade['query'][_0xfb35('0x24')]);}_0x2cf720[_0xfb35('0x40')]=qs[_0xfb35('0x41')](_0x2caade['query'][_0xfb35('0x41')]);_0x2cf720['where']=qs[_0xfb35('0x3a')](_[_0xfb35('0x42')](_0x2caade[_0xfb35('0x39')],_0x308753['filters']),_0x5041db);if(_0x2caade[_0xfb35('0x39')]['filter']){_0x2cf720[_0xfb35('0x43')]=_['merge'](_0x2cf720[_0xfb35('0x43')],{'$or':_['map'](_0x5041db,function(_0x4dab21){if(_0x4dab21[_0xfb35('0x36')]!==_0xfb35('0x44')){var _0x4b7210={};_0x4b7210[_0x4dab21['name']]={'$like':'%'+_0x2caade['query'][_0xfb35('0x45')]+'%'};return _0x4b7210;}})});}_0x2cf720=_[_0xfb35('0x46')]({},_0x2cf720,_0x2caade[_0xfb35('0x47')]);var _0xfe7286={'where':_0x2cf720[_0xfb35('0x43')]};return db[_0xfb35('0x34')][_0xfb35('0x23')](_0xfe7286)['then'](function(_0x331585){_0x172951[_0xfb35('0x23')]=_0x331585;if(_0x2caade['query'][_0xfb35('0x48')]){_0x2cf720[_0xfb35('0x49')]=[{'all':!![]}];}return db[_0xfb35('0x34')]['findAll'](_0x2cf720);})[_0xfb35('0x2c')](function(_0x5dc4c7){_0x172951[_0xfb35('0x4a')]=_0x5dc4c7;return _0x172951;})[_0xfb35('0x2c')](respondWithFilteredResult(_0x329c07,_0x2cf720))[_0xfb35('0x4b')](handleError(_0x329c07,null));};exports[_0xfb35('0x4c')]=function(_0x46b242,_0x1e19b1){var _0x4e5122={'raw':![],'where':{'id':_0x46b242[_0xfb35('0x4d')]['id']}},_0x64bd8b={};_0x64bd8b['model']=_[_0xfb35('0x38')](db[_0xfb35('0x34')][_0xfb35('0x4e')]);_0x64bd8b['query']=_[_0xfb35('0x38')](_0x46b242[_0xfb35('0x39')]);_0x64bd8b[_0xfb35('0x4f')]=_[_0xfb35('0x50')](_0x64bd8b[_0xfb35('0x37')],_0x64bd8b[_0xfb35('0x39')]);_0x4e5122[_0xfb35('0x3b')]=_[_0xfb35('0x50')](_0x64bd8b[_0xfb35('0x37')],qs['fields'](_0x46b242[_0xfb35('0x39')][_0xfb35('0x3c')]));_0x4e5122[_0xfb35('0x3b')]=_0x4e5122[_0xfb35('0x3b')][_0xfb35('0x3d')]?_0x4e5122['attributes']:_0x64bd8b[_0xfb35('0x37')];if(_0x46b242[_0xfb35('0x39')][_0xfb35('0x48')]){_0x4e5122['include']=[{'all':!![]}];}_0x4e5122=_[_0xfb35('0x46')]({},_0x4e5122,_0x46b242[_0xfb35('0x47')]);return db['CmList'][_0xfb35('0x51')](_0x4e5122)['then'](handleEntityNotFound(_0x1e19b1,null))[_0xfb35('0x2c')](respondWithResult(_0x1e19b1,null))['catch'](handleError(_0x1e19b1,null));};exports[_0xfb35('0x52')]=function(_0x234609,_0x4a813f){return db[_0xfb35('0x34')]['create'](_0x234609[_0xfb35('0x53')],{})['then'](function(_0x1f8a5c){var _0x5c7861=_0x234609[_0xfb35('0x54')][_0xfb35('0x55')]({'plain':!![]});if(!_0x5c7861)throw new Error(_0xfb35('0x56'));if(_0x5c7861[_0xfb35('0x57')]===_0xfb35('0x54')){var _0x2b01ea=_0x1f8a5c[_0xfb35('0x55')]({'plain':!![]});var _0xeadea7=_0xfb35('0x2d');return db[_0xfb35('0x58')]['find']({'where':{'name':_0xeadea7,'userProfileId':_0x5c7861[_0xfb35('0x59')]},'raw':!![]})[_0xfb35('0x2c')](function(_0x1d7096){if(_0x1d7096&&_0x1d7096[_0xfb35('0x5a')]===0x0){return db['UserProfileResource'][_0xfb35('0x52')]({'name':_0x2b01ea[_0xfb35('0x30')],'resourceId':_0x2b01ea['id'],'type':_0x1d7096[_0xfb35('0x30')],'sectionId':_0x1d7096['id']},{})[_0xfb35('0x2c')](function(){return _0x1f8a5c;});}else{return _0x1f8a5c;}})['catch'](function(_0x481fd0){logger[_0xfb35('0x2f')](_0xfb35('0x5b'),_0x481fd0);throw _0x481fd0;});}return _0x1f8a5c;})[_0xfb35('0x2c')](respondWithResult(_0x4a813f,0xc9))[_0xfb35('0x4b')](handleError(_0x4a813f,null));};exports[_0xfb35('0x2b')]=function(_0x2855fe,_0x53b18b){if(_0x2855fe[_0xfb35('0x53')]['id']){delete _0x2855fe[_0xfb35('0x53')]['id'];}return db[_0xfb35('0x34')]['find']({'where':{'id':_0x2855fe[_0xfb35('0x4d')]['id']}})[_0xfb35('0x2c')](handleEntityNotFound(_0x53b18b,null))['then'](saveUpdates(_0x2855fe[_0xfb35('0x53')],null))[_0xfb35('0x2c')](respondWithResult(_0x53b18b,null))[_0xfb35('0x4b')](handleError(_0x53b18b,null));};exports[_0xfb35('0x5c')]=function(_0x44db40,_0x34dfc5){return db[_0xfb35('0x34')][_0xfb35('0x51')]({'where':{'id':_0x44db40[_0xfb35('0x4d')]['id']}})['then'](handleEntityNotFound(_0x34dfc5,null))['then'](removeEntity(_0x34dfc5,null))[_0xfb35('0x4b')](handleError(_0x34dfc5,null));};exports[_0xfb35('0x5d')]=function(_0x3ca060,_0x476b0f){return db['CmList'][_0xfb35('0x5d')]()['then'](respondWithResult(_0x476b0f,null))[_0xfb35('0x4b')](handleError(_0x476b0f,null));};exports[_0xfb35('0x5e')]=function(_0x3c933c,_0x4229a2,_0x4c9546){if(_0x3c933c[_0xfb35('0x53')]['id']){delete _0x3c933c[_0xfb35('0x53')]['id'];}return db[_0xfb35('0x34')][_0xfb35('0x51')]({'where':{'id':_0x3c933c[_0xfb35('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4229a2,null))[_0xfb35('0x2c')](function(_0x59e58f){if(_0x59e58f){_0x3c933c['body'][_0xfb35('0x5f')]=_0x59e58f['id'];return db[_0xfb35('0x60')][_0xfb35('0x52')](_0x3c933c['body']);}})[_0xfb35('0x2c')](respondWithResult(_0x4229a2,null))[_0xfb35('0x4b')](handleError(_0x4229a2,null));};exports[_0xfb35('0x61')]=function(_0x439186,_0x578ff3,_0x424acf){var _0x2f40f1={'raw':![],'where':{}};var _0x3bc556={};var _0x40ed0d={'count':0x0,'rows':[]};return db[_0xfb35('0x34')]['findOne']({'where':{'id':_0x439186['params']['id']}})[_0xfb35('0x2c')](handleEntityNotFound(_0x578ff3,null))[_0xfb35('0x2c')](function(_0x40bdb8){if(_0x40bdb8){_0x3bc556[_0xfb35('0x37')]=_[_0xfb35('0x38')](db[_0xfb35('0x60')][_0xfb35('0x4e')]);_0x3bc556['query']=_[_0xfb35('0x38')](_0x439186[_0xfb35('0x39')]);_0x3bc556['filters']=_[_0xfb35('0x50')](_0x3bc556['model'],_0x3bc556[_0xfb35('0x39')]);_0x2f40f1[_0xfb35('0x3b')]=_['intersection'](_0x3bc556[_0xfb35('0x37')],qs[_0xfb35('0x3c')](_0x439186[_0xfb35('0x39')][_0xfb35('0x3c')]));_0x2f40f1['attributes']=_0x2f40f1['attributes'][_0xfb35('0x3d')]?_0x2f40f1[_0xfb35('0x3b')]:_0x3bc556[_0xfb35('0x37')];if(!_0x439186[_0xfb35('0x39')][_0xfb35('0x3e')](_0xfb35('0x3f'))){_0x2f40f1[_0xfb35('0x25')]=qs['limit'](_0x439186[_0xfb35('0x39')]['limit']);_0x2f40f1[_0xfb35('0x24')]=qs[_0xfb35('0x24')](_0x439186['query']['offset']);}_0x2f40f1['order']=qs[_0xfb35('0x41')](_0x439186[_0xfb35('0x39')][_0xfb35('0x41')]);_0x2f40f1['where']=qs[_0xfb35('0x3a')](_[_0xfb35('0x42')](_0x439186[_0xfb35('0x39')],_0x3bc556['filters']));_0x2f40f1['where']['ListId']=_0x40bdb8['id'];if(_0x439186['query']['filter']){_0x2f40f1[_0xfb35('0x43')]=_[_0xfb35('0x46')](_0x2f40f1['where'],{'$or':_['map'](_0x2f40f1[_0xfb35('0x3b')],function(_0x3a3449){var _0xc1325a={};_0xc1325a[_0x3a3449]={'$like':'%'+_0x439186['query'][_0xfb35('0x45')]+'%'};return _0xc1325a;})});}_0x2f40f1=_[_0xfb35('0x46')]({},_0x2f40f1,_0x439186[_0xfb35('0x47')]);return db[_0xfb35('0x60')][_0xfb35('0x23')]({'where':_0x2f40f1[_0xfb35('0x43')]})[_0xfb35('0x2c')](function(_0x197167){_0x40ed0d['count']=_0x197167;if(_0x439186['query'][_0xfb35('0x48')]){_0x2f40f1['include']=[{'all':!![]}];}return db[_0xfb35('0x60')][_0xfb35('0x62')](_0x2f40f1);})[_0xfb35('0x2c')](function(_0x4619af){_0x40ed0d[_0xfb35('0x4a')]=_0x4619af;return _0x40ed0d;});}})[_0xfb35('0x2c')](respondWithFilteredResult(_0x578ff3,_0x2f40f1))[_0xfb35('0x4b')](handleError(_0x578ff3,null));};exports[_0xfb35('0x63')]=function(_0x2aca35,_0x5fc36a,_0x1a9ea2){return db[_0xfb35('0x34')][_0xfb35('0x51')]({'where':{'id':_0x2aca35['params']['id']}})['then'](handleEntityNotFound(_0x5fc36a,null))[_0xfb35('0x2c')](function(_0x41873b){if(_0x41873b){return _0x41873b['removeDispositions'](_0x2aca35[_0xfb35('0x39')][_0xfb35('0x64')]);}})[_0xfb35('0x2c')](respondWithStatusCode(_0x5fc36a,null))[_0xfb35('0x4b')](handleError(_0x5fc36a,null));};exports[_0xfb35('0x65')]=function(_0x63de5f,_0xb92b46,_0xebc25d){return db['CmList'][_0xfb35('0x51')]({'where':{'id':_0x63de5f[_0xfb35('0x4d')]['id']}})['then'](handleEntityNotFound(_0xb92b46,null))[_0xfb35('0x2c')](function(_0x4b7dae){if(_0x4b7dae){var _0x12a1d9=[];var _0x1bf787={'success':[],'errors':[]};return db[_0xfb35('0x66')][_0xfb35('0x5d')]()[_0xfb35('0x2c')](function(_0x51a285){if(_0x63de5f[_0xfb35('0x53')][_0xfb35('0x67')]&&_[_0xfb35('0x68')](_0x63de5f[_0xfb35('0x53')][_0xfb35('0x67')])){if(_0x63de5f[_0xfb35('0x53')][_0xfb35('0x67')][_0xfb35('0x3d')]){_0x63de5f[_0xfb35('0x53')][_0xfb35('0x67')]=_0x63de5f['body']['tags'][_0xfb35('0x69')](';')+';';}else{_0x63de5f[_0xfb35('0x53')][_0xfb35('0x67')]=null;}}else{_0x63de5f[_0xfb35('0x53')]['tags']=null;}if(_0x63de5f[_0xfb35('0x53')]&&_['isArray'](_0x63de5f[_0xfb35('0x53')])){for(var _0x4baab2=0x0;_0x4baab2<_0x63de5f[_0xfb35('0x53')][_0xfb35('0x3d')];_0x4baab2+=0x1){_0x63de5f['body'][_0x4baab2]['ListId']=_0x63de5f['params']['id'];_0x12a1d9['push'](_0x63de5f[_0xfb35('0x53')][_0x4baab2]);}return BPromise[_0xfb35('0x6a')](_0x12a1d9,function(_0x5290f6){return db['CmContact'][_0xfb35('0x52')](_[_0xfb35('0x6b')](_0x5290f6,[_0xfb35('0x64'),'id'])||{},{'fields':_[_0xfb35('0x38')](_0x51a285),'raw':!![]})[_0xfb35('0x2c')](function(_0x3e1792){_0x1bf787[_0xfb35('0x6c')][_0xfb35('0x6d')](_0x3e1792[_0xfb35('0x6e')]);})[_0xfb35('0x4b')](function(_0x908d9c){_0x1bf787['errors']['push']({'data':_0x5290f6,'error':_0x908d9c['message']});});})[_0xfb35('0x2c')](function(_0xcd0d3a){return _0x1bf787;})[_0xfb35('0x4b')](function(_0x378c58){return _0x378c58;});}else{_0xb92b46[_0xfb35('0x20')](0x190)['json']({'message':_0xfb35('0x6f')});}});}})['then'](respondWithResult(_0xb92b46,null))[_0xfb35('0x4b')](handleError(_0xb92b46,null));};exports['getContacts']=function(_0x2f6eb7,_0x237e1a,_0x3207a7){var _0x1802da;return db['CmList'][_0xfb35('0x51')]({'where':{'id':_0x2f6eb7['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0xfb35('0x70')}]})[_0xfb35('0x2c')](handleEntityNotFound(_0x237e1a,null))[_0xfb35('0x2c')](function(_0x191c3b){if(_0x191c3b){_0x1802da=_0x191c3b;return db['CmContact']['rawAttributes'];}})['then'](function(_0x3a3399){if(_0x3a3399){var _0x70387b={};var _0x23c0b0={};_0x23c0b0[_0xfb35('0x37')]=_[_0xfb35('0x71')](_[_0xfb35('0x38')](_0x3a3399),_['map'](_0x1802da[_0xfb35('0x70')],function(_0x27fd22){return util[_0xfb35('0x72')]('cf_%d',_0x27fd22['id']);}));_0x23c0b0[_0xfb35('0x39')]=_[_0xfb35('0x38')](_0x2f6eb7[_0xfb35('0x39')]);_0x23c0b0['filters']=_[_0xfb35('0x50')](_0x23c0b0[_0xfb35('0x37')],_0x23c0b0[_0xfb35('0x39')]);_0x70387b[_0xfb35('0x3b')]=_[_0xfb35('0x50')](_0x23c0b0[_0xfb35('0x37')],qs[_0xfb35('0x3c')](_0x2f6eb7[_0xfb35('0x39')][_0xfb35('0x3c')]));_0x70387b[_0xfb35('0x3b')]=_0x70387b['attributes'][_0xfb35('0x3d')]?_0x70387b[_0xfb35('0x3b')]:_0x23c0b0[_0xfb35('0x37')];if(!_0x2f6eb7[_0xfb35('0x39')]['hasOwnProperty'](_0xfb35('0x3f'))){_0x70387b['limit']=qs[_0xfb35('0x25')](_0x2f6eb7[_0xfb35('0x39')]['limit']);_0x70387b['offset']=qs[_0xfb35('0x24')](_0x2f6eb7[_0xfb35('0x39')][_0xfb35('0x24')]);}_0x70387b[_0xfb35('0x40')]=qs[_0xfb35('0x41')](_0x2f6eb7['query']['sort']);_0x70387b['where']=qs[_0xfb35('0x3a')](_[_0xfb35('0x42')](_0x2f6eb7[_0xfb35('0x39')],_0x23c0b0[_0xfb35('0x3a')]));_0x70387b['raw']=!![];if(_0x2f6eb7[_0xfb35('0x39')][_0xfb35('0x45')]){_0x70387b[_0xfb35('0x43')]=_['merge'](_0x70387b['where'],{'$or':_[_0xfb35('0x33')](_0x70387b[_0xfb35('0x3b')],function(_0x4b043f){var _0x2ab906={};_0x2ab906[_0x4b043f]={'$like':'%'+_0x2f6eb7[_0xfb35('0x39')][_0xfb35('0x45')]+'%'};return _0x2ab906;})});}_0x70387b=_['merge']({},_0x70387b,_0x2f6eb7[_0xfb35('0x47')]);return _0x1802da['getContacts'](_0x70387b);}})[_0xfb35('0x2c')](respondWithResult(_0x237e1a,null))['catch'](handleError(_0x237e1a,null));};exports[_0xfb35('0x73')]=function(_0xcee35b,_0x4c6dcb,_0x3c6848){var _0x20e116;return db[_0xfb35('0x34')][_0xfb35('0x51')]({'where':{'id':_0xcee35b['params']['id']},'include':[{'model':db[_0xfb35('0x74')],'as':'CustomFields'}]})[_0xfb35('0x2c')](handleEntityNotFound(_0x4c6dcb,null))[_0xfb35('0x2c')](function(_0x15b833){if(_0x15b833){_0x20e116=_0x15b833;return db[_0xfb35('0x66')][_0xfb35('0x4e')];}})[_0xfb35('0x2c')](function(_0x276675){if(_0x276675){var _0x58c01e={};var _0x47e9e5={};_0x47e9e5['model']=_['concat'](_['keys'](_0x276675),_['map'](_0x20e116[_0xfb35('0x70')],function(_0x3df7f7){return util[_0xfb35('0x72')]('cf_%d',_0x3df7f7['id']);}));_0x47e9e5[_0xfb35('0x39')]=_[_0xfb35('0x38')](_0xcee35b[_0xfb35('0x39')]);_0x47e9e5[_0xfb35('0x3a')]=_[_0xfb35('0x50')](_0x47e9e5[_0xfb35('0x37')],_0x47e9e5['query']);_0x58c01e['attributes']=_[_0xfb35('0x50')](_0x47e9e5[_0xfb35('0x37')],qs[_0xfb35('0x3c')](_0xcee35b[_0xfb35('0x39')][_0xfb35('0x3c')]));_0x58c01e[_0xfb35('0x3b')]=_0x58c01e['attributes'][_0xfb35('0x3d')]?_0x58c01e[_0xfb35('0x3b')]:_0x47e9e5['model'];if(!_0xcee35b[_0xfb35('0x39')][_0xfb35('0x3e')](_0xfb35('0x3f'))){_0x58c01e[_0xfb35('0x25')]=qs[_0xfb35('0x25')](_0xcee35b[_0xfb35('0x39')][_0xfb35('0x25')]);_0x58c01e['offset']=qs[_0xfb35('0x24')](_0xcee35b['query'][_0xfb35('0x24')]);}_0x58c01e[_0xfb35('0x40')]=qs[_0xfb35('0x41')](_0xcee35b[_0xfb35('0x39')][_0xfb35('0x41')]);_0x58c01e[_0xfb35('0x43')]=qs[_0xfb35('0x3a')](_[_0xfb35('0x42')](_0xcee35b[_0xfb35('0x39')],_0x47e9e5[_0xfb35('0x3a')]));_0x58c01e[_0xfb35('0x75')]=!![];if(_0xcee35b[_0xfb35('0x39')][_0xfb35('0x45')]){_0x58c01e[_0xfb35('0x43')]=_[_0xfb35('0x46')](_0x58c01e['where'],{'$or':_[_0xfb35('0x33')](_0x58c01e[_0xfb35('0x3b')],function(_0x263d82){var _0x4e8318={};_0x4e8318[_0x263d82]={'$like':'%'+_0xcee35b[_0xfb35('0x39')]['filter']+'%'};return _0x4e8318;})});}_0x58c01e=_[_0xfb35('0x46')]({},_0x58c01e,_0xcee35b[_0xfb35('0x47')]);return _0x20e116['getContacts'](_0x58c01e);}})['then'](function(_0x25a17a){if(!_[_0xfb35('0x76')](_0x25a17a)){var _0x26da69=toCsv(_0x25a17a);var _0x2446a1=Date['now']();fs[_0xfb35('0x77')](util[_0xfb35('0x72')]('/tmp/list_%d_%s.csv',_0x20e116['id'],_0x2446a1),_0x26da69);_0x4c6dcb[_0xfb35('0x78')](_0xfb35('0x79'),_0xfb35('0x7a')+util[_0xfb35('0x72')](_0xfb35('0x7b'),_0x20e116['id'],_0x2446a1));_0x4c6dcb['setHeader'](_0xfb35('0x7c'),'text/csv');return _0x4c6dcb['download'](util[_0xfb35('0x72')](_0xfb35('0x7d'),_0x20e116['id'],_0x2446a1));}else{return _0x4c6dcb[_0xfb35('0x1f')](0xcc);}})[_0xfb35('0x4b')](handleError(_0x4c6dcb,null));};exports[_0xfb35('0x7e')]=function(_0x5082bd,_0x13aa01,_0x22db57){var _0xf378c7;delete _0x5082bd[_0xfb35('0x53')]['id'];return db['CmList'][_0xfb35('0x7f')]({'where':{'id':_0x5082bd['params']['id']}})['then'](handleEntityNotFound(_0x13aa01,null))[_0xfb35('0x2c')](function(_0x44de97){if(_0x44de97){return db[_0xfb35('0x80')][_0xfb35('0x81')](function(_0x3ffde8){return db[_0xfb35('0x74')][_0xfb35('0x52')](_0x5082bd['body'],{'transaction':_0x3ffde8})[_0xfb35('0x2c')](function(_0x496dce){_0xf378c7=_0x496dce;return _0x44de97[_0xfb35('0x82')](_0x496dce,{'transaction':_0x3ffde8});})[_0xfb35('0x2c')](function(){var _0x23d9e7={'type':db[_0xfb35('0x83')][_0xfb35('0x84')],'transaction':_0x3ffde8};switch(_0x5082bd[_0xfb35('0x53')][_0xfb35('0x36')]){case'text':_0x23d9e7[_0xfb35('0x36')]=db[_0xfb35('0x83')]['TEXT'];break;case'number':_0x23d9e7[_0xfb35('0x36')]=db[_0xfb35('0x83')][_0xfb35('0x85')];break;case _0xfb35('0x86'):_0x23d9e7[_0xfb35('0x36')]=db['Sequelize'][_0xfb35('0x87')];_0x23d9e7[_0xfb35('0x88')]=![];break;default:}return db[_0xfb35('0x80')][_0xfb35('0x89')]['addColumn'](_0xfb35('0x8a'),util['format'](_0xfb35('0x8b'),_0xf378c7['id']),_0x23d9e7);})[_0xfb35('0x2c')](function(){return _0xf378c7;});});}})[_0xfb35('0x2c')](respondWithResult(_0x13aa01,null))[_0xfb35('0x4b')](handleError(_0x13aa01,null));};exports[_0xfb35('0x8c')]=function(_0x5948df,_0x30ec58,_0x4acb36){var _0x5468b7={};var _0x57c984={};var _0x3d0559;var _0x4e17db;return db['CmList'][_0xfb35('0x7f')]({'where':{'id':_0x5948df[_0xfb35('0x4d')]['id']}})[_0xfb35('0x2c')](handleEntityNotFound(_0x30ec58,null))[_0xfb35('0x2c')](function(_0xd60258){if(_0xd60258){_0x3d0559=_0xd60258;_0x57c984[_0xfb35('0x37')]=_[_0xfb35('0x38')](db['CmCustomField'][_0xfb35('0x4e')]);_0x57c984[_0xfb35('0x39')]=_[_0xfb35('0x38')](_0x5948df[_0xfb35('0x39')]);_0x57c984[_0xfb35('0x3a')]=_['intersection'](_0x57c984[_0xfb35('0x37')],_0x57c984['query']);_0x5468b7['attributes']=_[_0xfb35('0x50')](_0x57c984['model'],qs[_0xfb35('0x3c')](_0x5948df[_0xfb35('0x39')]['fields']));_0x5468b7[_0xfb35('0x3b')]=_0x5468b7['attributes'][_0xfb35('0x3d')]?_0x5468b7[_0xfb35('0x3b')]:_0x57c984[_0xfb35('0x37')];_0x5468b7[_0xfb35('0x40')]=qs[_0xfb35('0x41')](_0x5948df[_0xfb35('0x39')][_0xfb35('0x41')]);_0x5468b7[_0xfb35('0x43')]=qs[_0xfb35('0x3a')](_[_0xfb35('0x42')](_0x5948df['query'],_0x57c984[_0xfb35('0x3a')]));_0x5468b7[_0xfb35('0x43')]=_[_0xfb35('0x46')](_0x5468b7['where'],{'$or':[{'ListId':_0xd60258['id']},{'ListId':null}]});if(_0x5948df[_0xfb35('0x39')]['filter']){_0x5468b7[_0xfb35('0x43')]=_['merge'](_0x5468b7[_0xfb35('0x43')],{'$or':_['map'](_0x5468b7[_0xfb35('0x3b')],function(_0x3b1261){var _0x26d9e0={};_0x26d9e0[_0x3b1261]={'$like':'%'+_0x5948df[_0xfb35('0x39')][_0xfb35('0x45')]+'%'};return _0x26d9e0;})});}_0x5468b7=_['merge']({},_0x5468b7,_0x5948df[_0xfb35('0x47')]);return db['CmCustomField'][_0xfb35('0x8d')](_0x5468b7);}})[_0xfb35('0x2c')](respondWithResult(_0x30ec58,null))['catch'](handleError(_0x30ec58,null));};exports[_0xfb35('0x8e')]=function(_0x132028,_0x3f8b13,_0x1a3abf){return db[_0xfb35('0x34')]['find']({'where':{'id':_0x132028[_0xfb35('0x4d')]['id']}})[_0xfb35('0x2c')](handleEntityNotFound(_0x3f8b13,null))[_0xfb35('0x2c')](function(_0x22c2ff){if(_0x22c2ff){return _0x22c2ff[_0xfb35('0x8e')](_0x132028[_0xfb35('0x53')][_0xfb35('0x64')],_[_0xfb35('0x6b')](_0x132028[_0xfb35('0x53')],['ids','id'])||{})['spread'](function(_0x26e851){for(var _0x478ea6=0x0;_0x478ea6<_0x132028[_0xfb35('0x53')][_0xfb35('0x64')]['length'];_0x478ea6+=0x1){socket['emit']('userCmList:save',{'UserId':_0x132028[_0xfb35('0x53')][_0xfb35('0x64')][_0x478ea6],'CmListId':_0x132028['params']['id']});}return _0x26e851;});}})['then'](respondWithResult(_0x3f8b13,null))[_0xfb35('0x4b')](handleError(_0x3f8b13,null));};exports[_0xfb35('0x8f')]=function(_0x1f00e6,_0x40f1f1,_0xc72220){return db[_0xfb35('0x34')][_0xfb35('0x51')]({'where':{'id':_0x1f00e6[_0xfb35('0x4d')]['id']}})[_0xfb35('0x2c')](handleEntityNotFound(_0x40f1f1,null))['then'](function(_0x47f4b4){if(_0x47f4b4){return _0x47f4b4[_0xfb35('0x8f')](_0x1f00e6[_0xfb35('0x39')][_0xfb35('0x64')])[_0xfb35('0x2c')](function(){if(_['isArray'](_0x1f00e6[_0xfb35('0x39')][_0xfb35('0x64')])){for(var _0x2370c6=0x0;_0x2370c6<_0x1f00e6[_0xfb35('0x39')]['ids'][_0xfb35('0x3d')];_0x2370c6+=0x1){socket[_0xfb35('0x90')](_0xfb35('0x91'),{'UserId':Number(_0x1f00e6[_0xfb35('0x39')]['ids'][_0x2370c6]),'CmListId':Number(_0x1f00e6[_0xfb35('0x4d')]['id'])});}}else{socket[_0xfb35('0x90')](_0xfb35('0x91'),{'UserId':Number(_0x1f00e6[_0xfb35('0x39')][_0xfb35('0x64')]),'CmListId':Number(_0x1f00e6['params']['id'])});}});}})[_0xfb35('0x2c')](respondWithStatusCode(_0x40f1f1,null))[_0xfb35('0x4b')](handleError(_0x40f1f1,null));};exports['getAgents']=function(_0x1f2a9a,_0xdaf65d,_0x105c8e){var _0x4c3757={};var _0x5bc591={};var _0x44fa69;var _0xd699f4;return db[_0xfb35('0x34')][_0xfb35('0x7f')]({'where':{'id':_0x1f2a9a[_0xfb35('0x4d')]['id']}})[_0xfb35('0x2c')](handleEntityNotFound(_0xdaf65d,null))[_0xfb35('0x2c')](function(_0x42fc64){if(_0x42fc64){_0x44fa69=_0x42fc64;_0x5bc591[_0xfb35('0x37')]=_['keys'](db[_0xfb35('0x92')][_0xfb35('0x4e')]);_0x5bc591[_0xfb35('0x39')]=_['keys'](_0x1f2a9a['query']);_0x5bc591[_0xfb35('0x3a')]=_['intersection'](_0x5bc591[_0xfb35('0x37')],_0x5bc591['query']);_0x4c3757['attributes']=_[_0xfb35('0x50')](_0x5bc591[_0xfb35('0x37')],qs['fields'](_0x1f2a9a[_0xfb35('0x39')][_0xfb35('0x3c')]));_0x4c3757[_0xfb35('0x3b')]=_0x4c3757[_0xfb35('0x3b')][_0xfb35('0x3d')]?_0x4c3757[_0xfb35('0x3b')]:_0x5bc591[_0xfb35('0x37')];_0x4c3757[_0xfb35('0x40')]=qs[_0xfb35('0x41')](_0x1f2a9a['query'][_0xfb35('0x41')]);_0x4c3757[_0xfb35('0x43')]=qs[_0xfb35('0x3a')](_[_0xfb35('0x42')](_0x1f2a9a[_0xfb35('0x39')],_0x5bc591['filters']));if(_0x1f2a9a[_0xfb35('0x39')]['filter']){_0x4c3757[_0xfb35('0x43')]=_[_0xfb35('0x46')](_0x4c3757['where'],{'$or':_[_0xfb35('0x33')](_0x4c3757[_0xfb35('0x3b')],function(_0x3ea486){var _0x3b70ac={};_0x3b70ac[_0x3ea486]={'$like':'%'+_0x1f2a9a[_0xfb35('0x39')][_0xfb35('0x45')]+'%'};return _0x3b70ac;})});}_0x4c3757=_['merge']({},_0x4c3757,_0x1f2a9a[_0xfb35('0x47')]);return _0x44fa69[_0xfb35('0x93')](_0x4c3757);}})['then'](function(_0x1ef5b1){if(_0x1ef5b1){_0xd699f4=_0x1ef5b1['length'];if(!_0x1f2a9a[_0xfb35('0x39')]['hasOwnProperty'](_0xfb35('0x3f'))){_0x4c3757[_0xfb35('0x25')]=qs[_0xfb35('0x25')](_0x1f2a9a['query']['limit']);_0x4c3757['offset']=qs[_0xfb35('0x24')](_0x1f2a9a[_0xfb35('0x39')][_0xfb35('0x24')]);}return _0x44fa69[_0xfb35('0x93')](_0x4c3757);}})[_0xfb35('0x2c')](function(_0x33a672){if(_0x33a672){return _0x33a672?{'count':_0xd699f4,'rows':_0x33a672}:null;}})[_0xfb35('0x2c')](respondWithResult(_0xdaf65d,null))['catch'](handleError(_0xdaf65d,null));}; \ No newline at end of file +var _0xec6e=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','Lists','UserProfileResource','end','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','describe','addDisposition','ListId','getDispositions','findOne','Disposition','hasOwnProperty','order','rows','removeDispositions','ids','tags','isArray','each','CmContact','omit','success','push','dataValues','errors','message','getContacts','CustomFields','format','cf_%d','pick','raw','getContactsCsv','CmCustomField','concat','isEmpty','now','writeFileSync','setHeader','Content-disposition','list_%d_%s.csv','Content-type','download','/tmp/list_%d_%s.csv','transaction','text','Sequelize','number','switch','defaultValue','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce'];(function(_0x3d8fca,_0x5bc2a0){var _0x5e26f9=function(_0x1ba11a){while(--_0x1ba11a){_0x3d8fca['push'](_0x3d8fca['shift']());}};_0x5e26f9(++_0x5bc2a0);}(_0xec6e,0x10a));var _0xeec6=function(_0x556634,_0x520958){_0x556634=_0x556634-0x0;var _0x4429fd=_0xec6e[_0x556634];return _0x4429fd;};'use strict';var pdf=require(_0xeec6('0x0'));var emlformat=require(_0xeec6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xeec6('0x2'));var jsonpatch=require(_0xeec6('0x3'));var rp=require(_0xeec6('0x4'));var moment=require(_0xeec6('0x5'));var BPromise=require(_0xeec6('0x6'));var Mustache=require('mustache');var util=require(_0xeec6('0x7'));var path=require(_0xeec6('0x8'));var sox=require(_0xeec6('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xeec6('0xa'));var squel=require(_0xeec6('0xb'));var crypto=require(_0xeec6('0xc'));var jsforce=require(_0xeec6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xeec6('0xe'));var querystring=require(_0xeec6('0xf'));var Papa=require(_0xeec6('0x10'));var Redis=require(_0xeec6('0x11'));var authService=require(_0xeec6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xeec6('0x13'));var hardwareService=require(_0xeec6('0x14'));var logger=require('../../config/logger')(_0xeec6('0x15'));var utils=require(_0xeec6('0x16'));var config=require(_0xeec6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xeec6('0x18'))['db'];config['redis']=_[_0xeec6('0x19')](config[_0xeec6('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xeec6('0x1b'))(new Redis(config[_0xeec6('0x1a')]));require('./cmList.socket')[_0xeec6('0x1c')](socket);function respondWithStatusCode(_0xb30582,_0x28fa8a){_0x28fa8a=_0x28fa8a||0xcc;return function(_0x598ba8){if(_0x598ba8){return _0xb30582[_0xeec6('0x1d')](_0x28fa8a);}return _0xb30582[_0xeec6('0x1e')](_0x28fa8a)['end']();};}function respondWithResult(_0x2461ae,_0x4baa48){_0x4baa48=_0x4baa48||0xc8;return function(_0x473b6c){if(_0x473b6c){return _0x2461ae['status'](_0x4baa48)[_0xeec6('0x1f')](_0x473b6c);}};}function respondWithFilteredResult(_0x316eeb,_0x1c54be){return function(_0x494b51){if(_0x494b51){var _0x4e56b2=_0x494b51[_0xeec6('0x20')],_0x4dad51=_0x1c54be[_0xeec6('0x21')],_0x31ede6=_0x1c54be[_0xeec6('0x21')]+_0x1c54be[_0xeec6('0x22')],_0x42fb68;if(_0x31ede6>=_0x4e56b2){_0x31ede6=_0x4e56b2;_0x42fb68=0xc8;}else{_0x42fb68=0xce;}_0x316eeb[_0xeec6('0x1e')](_0x42fb68);return _0x316eeb[_0xeec6('0x23')](_0xeec6('0x24'),_0x4dad51+'-'+_0x31ede6+'/'+_0x4e56b2)['json'](_0x494b51);}return null;};}function patchUpdates(_0x2f15e0){return function(_0x4845a5){try{jsonpatch['apply'](_0x4845a5,_0x2f15e0,!![]);}catch(_0xf0b9f6){return BPromise['reject'](_0xf0b9f6);}return _0x4845a5[_0xeec6('0x25')]();};}function saveUpdates(_0x4e50ef,_0x427e53){return function(_0x3923a6){if(_0x3923a6){return _0x3923a6[_0xeec6('0x26')](_0x4e50ef)[_0xeec6('0x27')](function(_0x1bc3ea){return _0x1bc3ea;});}return null;};}function removeEntity(_0x112269,_0x2b98e4){return function(_0x346ef0){if(_0x346ef0){return _0x346ef0[_0xeec6('0x28')]()[_0xeec6('0x27')](function(){var _0x2ec5b8=_0x346ef0[_0xeec6('0x29')]({'plain':!![]});var _0x39d78e=_0xeec6('0x2a');return db[_0xeec6('0x2b')][_0xeec6('0x28')]({'where':{'type':_0x39d78e,'resourceId':_0x2ec5b8['id']}})['then'](function(){return _0x346ef0;});})[_0xeec6('0x27')](function(){_0x112269[_0xeec6('0x1e')](0xcc)[_0xeec6('0x2c')]();});}};}function handleEntityNotFound(_0x572245,_0x4136d8){return function(_0x227512){if(!_0x227512){_0x572245[_0xeec6('0x1d')](0x194);}return _0x227512;};}function handleError(_0x211c9c,_0xab04a9){_0xab04a9=_0xab04a9||0x1f4;return function(_0x16556e){logger[_0xeec6('0x2d')](_0x16556e[_0xeec6('0x2e')]);if(_0x16556e[_0xeec6('0x2f')]){delete _0x16556e[_0xeec6('0x2f')];}_0x211c9c[_0xeec6('0x1e')](_0xab04a9)[_0xeec6('0x30')](_0x16556e);};}exports[_0xeec6('0x31')]=function(_0x5b109d,_0x48b809){var _0x21e256={},_0x2049e7={},_0x4edeb1={'count':0x0,'rows':[]};var _0x1bfd15=_[_0xeec6('0x32')](db[_0xeec6('0x33')][_0xeec6('0x34')],function(_0x5ae5a7){return{'name':_0x5ae5a7[_0xeec6('0x35')],'type':_0x5ae5a7[_0xeec6('0x36')][_0xeec6('0x37')]};});_0x2049e7['model']=_[_0xeec6('0x32')](_0x1bfd15,_0xeec6('0x2f'));_0x2049e7[_0xeec6('0x38')]=_[_0xeec6('0x39')](_0x5b109d[_0xeec6('0x38')]);_0x2049e7[_0xeec6('0x3a')]=_[_0xeec6('0x3b')](_0x2049e7[_0xeec6('0x3c')],_0x2049e7['query']);_0x21e256[_0xeec6('0x3d')]=_[_0xeec6('0x3b')](_0x2049e7[_0xeec6('0x3c')],qs[_0xeec6('0x3e')](_0x5b109d['query'][_0xeec6('0x3e')]));_0x21e256[_0xeec6('0x3d')]=_0x21e256[_0xeec6('0x3d')][_0xeec6('0x3f')]?_0x21e256[_0xeec6('0x3d')]:_0x2049e7[_0xeec6('0x3c')];if(!_0x5b109d[_0xeec6('0x38')]['hasOwnProperty'](_0xeec6('0x40'))){_0x21e256[_0xeec6('0x22')]=qs[_0xeec6('0x22')](_0x5b109d[_0xeec6('0x38')][_0xeec6('0x22')]);_0x21e256[_0xeec6('0x21')]=qs['offset'](_0x5b109d[_0xeec6('0x38')][_0xeec6('0x21')]);}_0x21e256['order']=qs[_0xeec6('0x41')](_0x5b109d['query']['sort']);_0x21e256[_0xeec6('0x42')]=qs[_0xeec6('0x3a')](_['pick'](_0x5b109d['query'],_0x2049e7[_0xeec6('0x3a')]),_0x1bfd15);if(_0x5b109d['query'][_0xeec6('0x43')]){_0x21e256[_0xeec6('0x42')]=_['merge'](_0x21e256[_0xeec6('0x42')],{'$or':_['map'](_0x1bfd15,function(_0x57eabe){if(_0x57eabe[_0xeec6('0x36')]!==_0xeec6('0x44')){var _0x4252c0={};_0x4252c0[_0x57eabe[_0xeec6('0x2f')]]={'$like':'%'+_0x5b109d[_0xeec6('0x38')][_0xeec6('0x43')]+'%'};return _0x4252c0;}})});}_0x21e256=_[_0xeec6('0x45')]({},_0x21e256,_0x5b109d[_0xeec6('0x46')]);var _0x4e1700={'where':_0x21e256[_0xeec6('0x42')]};return db[_0xeec6('0x33')]['count'](_0x4e1700)[_0xeec6('0x27')](function(_0x4d8c08){_0x4edeb1['count']=_0x4d8c08;if(_0x5b109d[_0xeec6('0x38')][_0xeec6('0x47')]){_0x21e256[_0xeec6('0x48')]=[{'all':!![]}];}return db['CmList'][_0xeec6('0x49')](_0x21e256);})[_0xeec6('0x27')](function(_0x699117){_0x4edeb1['rows']=_0x699117;return _0x4edeb1;})[_0xeec6('0x27')](respondWithFilteredResult(_0x48b809,_0x21e256))[_0xeec6('0x4a')](handleError(_0x48b809,null));};exports[_0xeec6('0x4b')]=function(_0x4268b1,_0x32367f){var _0x590b21={'raw':![],'where':{'id':_0x4268b1[_0xeec6('0x4c')]['id']}},_0x4b4747={};_0x4b4747[_0xeec6('0x3c')]=_[_0xeec6('0x39')](db[_0xeec6('0x33')]['rawAttributes']);_0x4b4747[_0xeec6('0x38')]=_['keys'](_0x4268b1[_0xeec6('0x38')]);_0x4b4747['filtears']=_['intersection'](_0x4b4747['model'],_0x4b4747[_0xeec6('0x38')]);_0x590b21[_0xeec6('0x3d')]=_['intersection'](_0x4b4747[_0xeec6('0x3c')],qs['fields'](_0x4268b1[_0xeec6('0x38')][_0xeec6('0x3e')]));_0x590b21['attributes']=_0x590b21['attributes'][_0xeec6('0x3f')]?_0x590b21['attributes']:_0x4b4747[_0xeec6('0x3c')];if(_0x4268b1[_0xeec6('0x38')]['includeAll']){_0x590b21[_0xeec6('0x48')]=[{'all':!![]}];}_0x590b21=_[_0xeec6('0x45')]({},_0x590b21,_0x4268b1[_0xeec6('0x46')]);return db[_0xeec6('0x33')][_0xeec6('0x4d')](_0x590b21)[_0xeec6('0x27')](handleEntityNotFound(_0x32367f,null))['then'](respondWithResult(_0x32367f,null))[_0xeec6('0x4a')](handleError(_0x32367f,null));};exports[_0xeec6('0x4e')]=function(_0x4fde00,_0x4a8084){return db[_0xeec6('0x33')]['create'](_0x4fde00[_0xeec6('0x4f')],{})[_0xeec6('0x27')](function(_0x3ac726){var _0x1c4d17=_0x4fde00['user'][_0xeec6('0x29')]({'plain':!![]});if(!_0x1c4d17)throw new Error(_0xeec6('0x50'));if(_0x1c4d17['role']===_0xeec6('0x51')){var _0x13a163=_0x3ac726[_0xeec6('0x29')]({'plain':!![]});var _0x47f992=_0xeec6('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x47f992,'userProfileId':_0x1c4d17['userProfileId']},'raw':!![]})[_0xeec6('0x27')](function(_0x53180f){if(_0x53180f&&_0x53180f['autoAssociation']===0x0){return db[_0xeec6('0x2b')][_0xeec6('0x4e')]({'name':_0x13a163[_0xeec6('0x2f')],'resourceId':_0x13a163['id'],'type':_0x53180f[_0xeec6('0x2f')],'sectionId':_0x53180f['id']},{})[_0xeec6('0x27')](function(){return _0x3ac726;});}else{return _0x3ac726;}})[_0xeec6('0x4a')](function(_0x24ab95){logger[_0xeec6('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24ab95);throw _0x24ab95;});}return _0x3ac726;})[_0xeec6('0x27')](respondWithResult(_0x4a8084,0xc9))[_0xeec6('0x4a')](handleError(_0x4a8084,null));};exports[_0xeec6('0x26')]=function(_0x257d08,_0x37fdc1){if(_0x257d08[_0xeec6('0x4f')]['id']){delete _0x257d08[_0xeec6('0x4f')]['id'];}return db[_0xeec6('0x33')][_0xeec6('0x4d')]({'where':{'id':_0x257d08['params']['id']}})[_0xeec6('0x27')](handleEntityNotFound(_0x37fdc1,null))[_0xeec6('0x27')](saveUpdates(_0x257d08[_0xeec6('0x4f')],null))[_0xeec6('0x27')](respondWithResult(_0x37fdc1,null))[_0xeec6('0x4a')](handleError(_0x37fdc1,null));};exports[_0xeec6('0x28')]=function(_0x2d17da,_0x44c388){return db['CmList'][_0xeec6('0x4d')]({'where':{'id':_0x2d17da[_0xeec6('0x4c')]['id']}})[_0xeec6('0x27')](handleEntityNotFound(_0x44c388,null))[_0xeec6('0x27')](removeEntity(_0x44c388,null))[_0xeec6('0x4a')](handleError(_0x44c388,null));};exports[_0xeec6('0x52')]=function(_0x22d3d6,_0x1368c1){return db[_0xeec6('0x33')][_0xeec6('0x52')]()[_0xeec6('0x27')](respondWithResult(_0x1368c1,null))[_0xeec6('0x4a')](handleError(_0x1368c1,null));};exports[_0xeec6('0x53')]=function(_0x2fa1e7,_0x46b711,_0x4f919e){if(_0x2fa1e7['body']['id']){delete _0x2fa1e7[_0xeec6('0x4f')]['id'];}return db['CmList']['find']({'where':{'id':_0x2fa1e7[_0xeec6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x46b711,null))[_0xeec6('0x27')](function(_0x27d0ca){if(_0x27d0ca){_0x2fa1e7[_0xeec6('0x4f')][_0xeec6('0x54')]=_0x27d0ca['id'];return db['Disposition']['create'](_0x2fa1e7['body']);}})[_0xeec6('0x27')](respondWithResult(_0x46b711,null))['catch'](handleError(_0x46b711,null));};exports[_0xeec6('0x55')]=function(_0x526990,_0x631fdc,_0xc55e1d){var _0x28ef68={'raw':![],'where':{}};var _0xa55fe2={};var _0x1fe50f={'count':0x0,'rows':[]};return db['CmList'][_0xeec6('0x56')]({'where':{'id':_0x526990[_0xeec6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x631fdc,null))[_0xeec6('0x27')](function(_0x47335b){if(_0x47335b){_0xa55fe2[_0xeec6('0x3c')]=_['keys'](db[_0xeec6('0x57')][_0xeec6('0x34')]);_0xa55fe2[_0xeec6('0x38')]=_[_0xeec6('0x39')](_0x526990['query']);_0xa55fe2[_0xeec6('0x3a')]=_[_0xeec6('0x3b')](_0xa55fe2[_0xeec6('0x3c')],_0xa55fe2[_0xeec6('0x38')]);_0x28ef68[_0xeec6('0x3d')]=_['intersection'](_0xa55fe2[_0xeec6('0x3c')],qs[_0xeec6('0x3e')](_0x526990['query']['fields']));_0x28ef68[_0xeec6('0x3d')]=_0x28ef68['attributes']['length']?_0x28ef68[_0xeec6('0x3d')]:_0xa55fe2[_0xeec6('0x3c')];if(!_0x526990[_0xeec6('0x38')][_0xeec6('0x58')]('nolimit')){_0x28ef68[_0xeec6('0x22')]=qs['limit'](_0x526990['query']['limit']);_0x28ef68[_0xeec6('0x21')]=qs[_0xeec6('0x21')](_0x526990[_0xeec6('0x38')][_0xeec6('0x21')]);}_0x28ef68[_0xeec6('0x59')]=qs[_0xeec6('0x41')](_0x526990[_0xeec6('0x38')]['sort']);_0x28ef68['where']=qs[_0xeec6('0x3a')](_['pick'](_0x526990['query'],_0xa55fe2[_0xeec6('0x3a')]));_0x28ef68[_0xeec6('0x42')]['ListId']=_0x47335b['id'];if(_0x526990['query'][_0xeec6('0x43')]){_0x28ef68['where']=_['merge'](_0x28ef68['where'],{'$or':_[_0xeec6('0x32')](_0x28ef68['attributes'],function(_0x1336b9){var _0x34eee1={};_0x34eee1[_0x1336b9]={'$like':'%'+_0x526990[_0xeec6('0x38')][_0xeec6('0x43')]+'%'};return _0x34eee1;})});}_0x28ef68=_['merge']({},_0x28ef68,_0x526990['options']);return db['Disposition'][_0xeec6('0x20')]({'where':_0x28ef68[_0xeec6('0x42')]})[_0xeec6('0x27')](function(_0x237d0c){_0x1fe50f[_0xeec6('0x20')]=_0x237d0c;if(_0x526990[_0xeec6('0x38')]['includeAll']){_0x28ef68[_0xeec6('0x48')]=[{'all':!![]}];}return db[_0xeec6('0x57')][_0xeec6('0x49')](_0x28ef68);})[_0xeec6('0x27')](function(_0x395b53){_0x1fe50f[_0xeec6('0x5a')]=_0x395b53;return _0x1fe50f;});}})['then'](respondWithFilteredResult(_0x631fdc,_0x28ef68))['catch'](handleError(_0x631fdc,null));};exports[_0xeec6('0x5b')]=function(_0x2077b6,_0x12e1ad,_0x862103){return db[_0xeec6('0x33')][_0xeec6('0x4d')]({'where':{'id':_0x2077b6[_0xeec6('0x4c')]['id']}})[_0xeec6('0x27')](handleEntityNotFound(_0x12e1ad,null))[_0xeec6('0x27')](function(_0x1b08a0){if(_0x1b08a0){return _0x1b08a0[_0xeec6('0x5b')](_0x2077b6['query'][_0xeec6('0x5c')]);}})[_0xeec6('0x27')](respondWithStatusCode(_0x12e1ad,null))[_0xeec6('0x4a')](handleError(_0x12e1ad,null));};exports['addContacts']=function(_0xa6bd54,_0xd99eaf,_0x358075){return db[_0xeec6('0x33')][_0xeec6('0x4d')]({'where':{'id':_0xa6bd54[_0xeec6('0x4c')]['id']}})['then'](handleEntityNotFound(_0xd99eaf,null))[_0xeec6('0x27')](function(_0x56d494){if(_0x56d494){var _0x60689b=[];var _0x250698={'success':[],'errors':[]};return db['CmContact'][_0xeec6('0x52')]()['then'](function(_0x32f5a7){if(_0xa6bd54['body'][_0xeec6('0x5d')]&&_[_0xeec6('0x5e')](_0xa6bd54[_0xeec6('0x4f')][_0xeec6('0x5d')])){if(_0xa6bd54[_0xeec6('0x4f')][_0xeec6('0x5d')][_0xeec6('0x3f')]){_0xa6bd54[_0xeec6('0x4f')]['tags']=_0xa6bd54[_0xeec6('0x4f')][_0xeec6('0x5d')]['join'](';')+';';}else{_0xa6bd54[_0xeec6('0x4f')][_0xeec6('0x5d')]=null;}}else{_0xa6bd54[_0xeec6('0x4f')][_0xeec6('0x5d')]=null;}if(_0xa6bd54['body']&&_[_0xeec6('0x5e')](_0xa6bd54[_0xeec6('0x4f')])){for(var _0x3489c2=0x0;_0x3489c2<_0xa6bd54['body'][_0xeec6('0x3f')];_0x3489c2+=0x1){_0xa6bd54[_0xeec6('0x4f')][_0x3489c2][_0xeec6('0x54')]=_0xa6bd54['params']['id'];_0x60689b['push'](_0xa6bd54[_0xeec6('0x4f')][_0x3489c2]);}return BPromise[_0xeec6('0x5f')](_0x60689b,function(_0x1b3462){return db[_0xeec6('0x60')][_0xeec6('0x4e')](_[_0xeec6('0x61')](_0x1b3462,[_0xeec6('0x5c'),'id'])||{},{'fields':_[_0xeec6('0x39')](_0x32f5a7),'raw':!![]})[_0xeec6('0x27')](function(_0x26fabd){_0x250698[_0xeec6('0x62')][_0xeec6('0x63')](_0x26fabd[_0xeec6('0x64')]);})[_0xeec6('0x4a')](function(_0xab51ec){_0x250698[_0xeec6('0x65')][_0xeec6('0x63')]({'data':_0x1b3462,'error':_0xab51ec[_0xeec6('0x66')]});});})['then'](function(_0x165fe8){return _0x250698;})['catch'](function(_0xc7d380){return _0xc7d380;});}else{_0xd99eaf[_0xeec6('0x1e')](0x190)[_0xeec6('0x1f')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xeec6('0x27')](respondWithResult(_0xd99eaf,null))[_0xeec6('0x4a')](handleError(_0xd99eaf,null));};exports[_0xeec6('0x67')]=function(_0x4f9798,_0x22d074,_0x4cd00e){var _0x318b49;return db[_0xeec6('0x33')][_0xeec6('0x4d')]({'where':{'id':_0x4f9798[_0xeec6('0x4c')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xeec6('0x68')}]})[_0xeec6('0x27')](handleEntityNotFound(_0x22d074,null))[_0xeec6('0x27')](function(_0x5087cb){if(_0x5087cb){_0x318b49=_0x5087cb;return db[_0xeec6('0x60')][_0xeec6('0x34')];}})[_0xeec6('0x27')](function(_0x4bfe49){if(_0x4bfe49){var _0x59e1ae={};var _0x3e1300={};_0x3e1300['model']=_['concat'](_[_0xeec6('0x39')](_0x4bfe49),_['map'](_0x318b49[_0xeec6('0x68')],function(_0x1e05d3){return util[_0xeec6('0x69')](_0xeec6('0x6a'),_0x1e05d3['id']);}));_0x3e1300[_0xeec6('0x38')]=_[_0xeec6('0x39')](_0x4f9798[_0xeec6('0x38')]);_0x3e1300[_0xeec6('0x3a')]=_[_0xeec6('0x3b')](_0x3e1300[_0xeec6('0x3c')],_0x3e1300[_0xeec6('0x38')]);_0x59e1ae[_0xeec6('0x3d')]=_['intersection'](_0x3e1300['model'],qs[_0xeec6('0x3e')](_0x4f9798[_0xeec6('0x38')][_0xeec6('0x3e')]));_0x59e1ae[_0xeec6('0x3d')]=_0x59e1ae[_0xeec6('0x3d')][_0xeec6('0x3f')]?_0x59e1ae[_0xeec6('0x3d')]:_0x3e1300[_0xeec6('0x3c')];if(!_0x4f9798[_0xeec6('0x38')][_0xeec6('0x58')]('nolimit')){_0x59e1ae[_0xeec6('0x22')]=qs[_0xeec6('0x22')](_0x4f9798[_0xeec6('0x38')][_0xeec6('0x22')]);_0x59e1ae[_0xeec6('0x21')]=qs[_0xeec6('0x21')](_0x4f9798['query'][_0xeec6('0x21')]);}_0x59e1ae[_0xeec6('0x59')]=qs[_0xeec6('0x41')](_0x4f9798[_0xeec6('0x38')][_0xeec6('0x41')]);_0x59e1ae[_0xeec6('0x42')]=qs[_0xeec6('0x3a')](_[_0xeec6('0x6b')](_0x4f9798['query'],_0x3e1300['filters']));_0x59e1ae[_0xeec6('0x6c')]=!![];if(_0x4f9798[_0xeec6('0x38')][_0xeec6('0x43')]){_0x59e1ae['where']=_[_0xeec6('0x45')](_0x59e1ae[_0xeec6('0x42')],{'$or':_[_0xeec6('0x32')](_0x59e1ae[_0xeec6('0x3d')],function(_0x548239){var _0x507f91={};_0x507f91[_0x548239]={'$like':'%'+_0x4f9798['query']['filter']+'%'};return _0x507f91;})});}_0x59e1ae=_[_0xeec6('0x45')]({},_0x59e1ae,_0x4f9798[_0xeec6('0x46')]);return _0x318b49[_0xeec6('0x67')](_0x59e1ae);}})[_0xeec6('0x27')](respondWithResult(_0x22d074,null))[_0xeec6('0x4a')](handleError(_0x22d074,null));};exports[_0xeec6('0x6d')]=function(_0x257000,_0x27b327,_0x2a721b){var _0x4f6e75;return db[_0xeec6('0x33')]['find']({'where':{'id':_0x257000[_0xeec6('0x4c')]['id']},'include':[{'model':db[_0xeec6('0x6e')],'as':_0xeec6('0x68')}]})[_0xeec6('0x27')](handleEntityNotFound(_0x27b327,null))[_0xeec6('0x27')](function(_0x1cac1f){if(_0x1cac1f){_0x4f6e75=_0x1cac1f;return db['CmContact']['rawAttributes'];}})[_0xeec6('0x27')](function(_0x4559a9){if(_0x4559a9){var _0x13565b={};var _0x49ca40={};_0x49ca40[_0xeec6('0x3c')]=_[_0xeec6('0x6f')](_['keys'](_0x4559a9),_['map'](_0x4f6e75[_0xeec6('0x68')],function(_0x5c820d){return util['format'](_0xeec6('0x6a'),_0x5c820d['id']);}));_0x49ca40[_0xeec6('0x38')]=_[_0xeec6('0x39')](_0x257000[_0xeec6('0x38')]);_0x49ca40[_0xeec6('0x3a')]=_[_0xeec6('0x3b')](_0x49ca40[_0xeec6('0x3c')],_0x49ca40[_0xeec6('0x38')]);_0x13565b['attributes']=_['intersection'](_0x49ca40[_0xeec6('0x3c')],qs[_0xeec6('0x3e')](_0x257000['query'][_0xeec6('0x3e')]));_0x13565b[_0xeec6('0x3d')]=_0x13565b['attributes']['length']?_0x13565b['attributes']:_0x49ca40[_0xeec6('0x3c')];if(!_0x257000[_0xeec6('0x38')][_0xeec6('0x58')](_0xeec6('0x40'))){_0x13565b['limit']=qs[_0xeec6('0x22')](_0x257000[_0xeec6('0x38')][_0xeec6('0x22')]);_0x13565b['offset']=qs[_0xeec6('0x21')](_0x257000['query'][_0xeec6('0x21')]);}_0x13565b[_0xeec6('0x59')]=qs[_0xeec6('0x41')](_0x257000[_0xeec6('0x38')]['sort']);_0x13565b[_0xeec6('0x42')]=qs[_0xeec6('0x3a')](_['pick'](_0x257000[_0xeec6('0x38')],_0x49ca40[_0xeec6('0x3a')]));_0x13565b[_0xeec6('0x6c')]=!![];if(_0x257000[_0xeec6('0x38')][_0xeec6('0x43')]){_0x13565b[_0xeec6('0x42')]=_[_0xeec6('0x45')](_0x13565b[_0xeec6('0x42')],{'$or':_[_0xeec6('0x32')](_0x13565b[_0xeec6('0x3d')],function(_0x264231){var _0x58e907={};_0x58e907[_0x264231]={'$like':'%'+_0x257000[_0xeec6('0x38')][_0xeec6('0x43')]+'%'};return _0x58e907;})});}_0x13565b=_[_0xeec6('0x45')]({},_0x13565b,_0x257000[_0xeec6('0x46')]);return _0x4f6e75[_0xeec6('0x67')](_0x13565b);}})[_0xeec6('0x27')](function(_0x5b8b13){if(!_[_0xeec6('0x70')](_0x5b8b13)){var _0x33624d=toCsv(_0x5b8b13);var _0x4842a3=Date[_0xeec6('0x71')]();fs[_0xeec6('0x72')](util['format']('/tmp/list_%d_%s.csv',_0x4f6e75['id'],_0x4842a3),_0x33624d);_0x27b327[_0xeec6('0x73')](_0xeec6('0x74'),'attachment;\x20filename='+util[_0xeec6('0x69')](_0xeec6('0x75'),_0x4f6e75['id'],_0x4842a3));_0x27b327[_0xeec6('0x73')](_0xeec6('0x76'),'text/csv');return _0x27b327[_0xeec6('0x77')](util[_0xeec6('0x69')](_0xeec6('0x78'),_0x4f6e75['id'],_0x4842a3));}else{return _0x27b327['sendStatus'](0xcc);}})[_0xeec6('0x4a')](handleError(_0x27b327,null));};exports['addCustomField']=function(_0x5be100,_0x899577,_0x31eb2a){var _0x4a34fc;delete _0x5be100[_0xeec6('0x4f')]['id'];return db[_0xeec6('0x33')][_0xeec6('0x56')]({'where':{'id':_0x5be100[_0xeec6('0x4c')]['id']}})[_0xeec6('0x27')](handleEntityNotFound(_0x899577,null))['then'](function(_0x17151e){if(_0x17151e){return db['sequelize'][_0xeec6('0x79')](function(_0x54c7c6){return db[_0xeec6('0x6e')][_0xeec6('0x4e')](_0x5be100[_0xeec6('0x4f')],{'transaction':_0x54c7c6})[_0xeec6('0x27')](function(_0x574023){_0x4a34fc=_0x574023;return _0x17151e['addCustomFields'](_0x574023,{'transaction':_0x54c7c6});})['then'](function(){var _0x3f920d={'type':db['Sequelize']['TEXT'],'transaction':_0x54c7c6};switch(_0x5be100[_0xeec6('0x4f')][_0xeec6('0x36')]){case _0xeec6('0x7a'):_0x3f920d[_0xeec6('0x36')]=db[_0xeec6('0x7b')]['TEXT'];break;case _0xeec6('0x7c'):_0x3f920d[_0xeec6('0x36')]=db[_0xeec6('0x7b')]['INTEGER'];break;case _0xeec6('0x7d'):_0x3f920d[_0xeec6('0x36')]=db[_0xeec6('0x7b')]['BOOLEAN'];_0x3f920d[_0xeec6('0x7e')]=![];break;default:}return db['sequelize']['queryInterface'][_0xeec6('0x7f')](_0xeec6('0x80'),util[_0xeec6('0x69')](_0xeec6('0x81'),_0x4a34fc['id']),_0x3f920d);})['then'](function(){return _0x4a34fc;});});}})[_0xeec6('0x27')](respondWithResult(_0x899577,null))[_0xeec6('0x4a')](handleError(_0x899577,null));};exports[_0xeec6('0x82')]=function(_0xfed1a8,_0x4bec3d,_0x7800fc){var _0x33738a={};var _0x4211e4={};var _0x2dc9ae;var _0x499833;return db[_0xeec6('0x33')][_0xeec6('0x56')]({'where':{'id':_0xfed1a8['params']['id']}})[_0xeec6('0x27')](handleEntityNotFound(_0x4bec3d,null))[_0xeec6('0x27')](function(_0xd7240d){if(_0xd7240d){_0x2dc9ae=_0xd7240d;_0x4211e4[_0xeec6('0x3c')]=_[_0xeec6('0x39')](db[_0xeec6('0x6e')]['rawAttributes']);_0x4211e4['query']=_['keys'](_0xfed1a8[_0xeec6('0x38')]);_0x4211e4['filters']=_[_0xeec6('0x3b')](_0x4211e4[_0xeec6('0x3c')],_0x4211e4[_0xeec6('0x38')]);_0x33738a[_0xeec6('0x3d')]=_['intersection'](_0x4211e4[_0xeec6('0x3c')],qs['fields'](_0xfed1a8[_0xeec6('0x38')][_0xeec6('0x3e')]));_0x33738a[_0xeec6('0x3d')]=_0x33738a['attributes']['length']?_0x33738a[_0xeec6('0x3d')]:_0x4211e4['model'];_0x33738a[_0xeec6('0x59')]=qs[_0xeec6('0x41')](_0xfed1a8[_0xeec6('0x38')]['sort']);_0x33738a['where']=qs[_0xeec6('0x3a')](_[_0xeec6('0x6b')](_0xfed1a8[_0xeec6('0x38')],_0x4211e4[_0xeec6('0x3a')]));_0x33738a[_0xeec6('0x42')]=_['merge'](_0x33738a['where'],{'$or':[{'ListId':_0xd7240d['id']},{'ListId':null}]});if(_0xfed1a8[_0xeec6('0x38')][_0xeec6('0x43')]){_0x33738a[_0xeec6('0x42')]=_[_0xeec6('0x45')](_0x33738a[_0xeec6('0x42')],{'$or':_[_0xeec6('0x32')](_0x33738a[_0xeec6('0x3d')],function(_0x2cf553){var _0x3e5bd4={};_0x3e5bd4[_0x2cf553]={'$like':'%'+_0xfed1a8['query'][_0xeec6('0x43')]+'%'};return _0x3e5bd4;})});}_0x33738a=_[_0xeec6('0x45')]({},_0x33738a,_0xfed1a8['options']);return db[_0xeec6('0x6e')][_0xeec6('0x83')](_0x33738a);}})[_0xeec6('0x27')](respondWithResult(_0x4bec3d,null))[_0xeec6('0x4a')](handleError(_0x4bec3d,null));};exports['addAgents']=function(_0x3a90ec,_0xb082e6,_0x121e06){return db[_0xeec6('0x33')][_0xeec6('0x4d')]({'where':{'id':_0x3a90ec['params']['id']}})[_0xeec6('0x27')](handleEntityNotFound(_0xb082e6,null))[_0xeec6('0x27')](function(_0x1a1086){if(_0x1a1086){return _0x1a1086[_0xeec6('0x84')](_0x3a90ec['body']['ids'],_[_0xeec6('0x61')](_0x3a90ec[_0xeec6('0x4f')],[_0xeec6('0x5c'),'id'])||{})[_0xeec6('0x85')](function(_0x476ac7){for(var _0x8ea2a7=0x0;_0x8ea2a7<_0x3a90ec['body'][_0xeec6('0x5c')]['length'];_0x8ea2a7+=0x1){socket[_0xeec6('0x86')](_0xeec6('0x87'),{'UserId':_0x3a90ec[_0xeec6('0x4f')][_0xeec6('0x5c')][_0x8ea2a7],'CmListId':_0x3a90ec['params']['id']});}return _0x476ac7;});}})[_0xeec6('0x27')](respondWithResult(_0xb082e6,null))[_0xeec6('0x4a')](handleError(_0xb082e6,null));};exports[_0xeec6('0x88')]=function(_0x50ff67,_0x57c95d,_0x16d8cd){return db[_0xeec6('0x33')][_0xeec6('0x4d')]({'where':{'id':_0x50ff67['params']['id']}})[_0xeec6('0x27')](handleEntityNotFound(_0x57c95d,null))['then'](function(_0x40e42c){if(_0x40e42c){return _0x40e42c[_0xeec6('0x88')](_0x50ff67[_0xeec6('0x38')]['ids'])[_0xeec6('0x27')](function(){if(_[_0xeec6('0x5e')](_0x50ff67[_0xeec6('0x38')]['ids'])){for(var _0x3e3b74=0x0;_0x3e3b74<_0x50ff67[_0xeec6('0x38')][_0xeec6('0x5c')][_0xeec6('0x3f')];_0x3e3b74+=0x1){socket[_0xeec6('0x86')](_0xeec6('0x89'),{'UserId':Number(_0x50ff67[_0xeec6('0x38')][_0xeec6('0x5c')][_0x3e3b74]),'CmListId':Number(_0x50ff67['params']['id'])});}}else{socket[_0xeec6('0x86')]('userCmList:remove',{'UserId':Number(_0x50ff67[_0xeec6('0x38')][_0xeec6('0x5c')]),'CmListId':Number(_0x50ff67[_0xeec6('0x4c')]['id'])});}});}})[_0xeec6('0x27')](respondWithStatusCode(_0x57c95d,null))[_0xeec6('0x4a')](handleError(_0x57c95d,null));};exports[_0xeec6('0x8a')]=function(_0xca8d40,_0x5853cc,_0xfcc548){var _0x54f389={};var _0x5dd175={};var _0x2ae616;var _0x564303;return db[_0xeec6('0x33')][_0xeec6('0x56')]({'where':{'id':_0xca8d40[_0xeec6('0x4c')]['id']}})[_0xeec6('0x27')](handleEntityNotFound(_0x5853cc,null))[_0xeec6('0x27')](function(_0x3407c5){if(_0x3407c5){_0x2ae616=_0x3407c5;_0x5dd175[_0xeec6('0x3c')]=_[_0xeec6('0x39')](db[_0xeec6('0x8b')][_0xeec6('0x34')]);_0x5dd175[_0xeec6('0x38')]=_['keys'](_0xca8d40[_0xeec6('0x38')]);_0x5dd175[_0xeec6('0x3a')]=_['intersection'](_0x5dd175[_0xeec6('0x3c')],_0x5dd175[_0xeec6('0x38')]);_0x54f389[_0xeec6('0x3d')]=_['intersection'](_0x5dd175[_0xeec6('0x3c')],qs['fields'](_0xca8d40[_0xeec6('0x38')][_0xeec6('0x3e')]));_0x54f389['attributes']=_0x54f389[_0xeec6('0x3d')][_0xeec6('0x3f')]?_0x54f389['attributes']:_0x5dd175['model'];_0x54f389['order']=qs['sort'](_0xca8d40[_0xeec6('0x38')]['sort']);_0x54f389[_0xeec6('0x42')]=qs[_0xeec6('0x3a')](_[_0xeec6('0x6b')](_0xca8d40[_0xeec6('0x38')],_0x5dd175[_0xeec6('0x3a')]));if(_0xca8d40[_0xeec6('0x38')][_0xeec6('0x43')]){_0x54f389[_0xeec6('0x42')]=_[_0xeec6('0x45')](_0x54f389[_0xeec6('0x42')],{'$or':_[_0xeec6('0x32')](_0x54f389[_0xeec6('0x3d')],function(_0x184213){var _0x1df475={};_0x1df475[_0x184213]={'$like':'%'+_0xca8d40[_0xeec6('0x38')][_0xeec6('0x43')]+'%'};return _0x1df475;})});}_0x54f389=_[_0xeec6('0x45')]({},_0x54f389,_0xca8d40[_0xeec6('0x46')]);return _0x2ae616[_0xeec6('0x8a')](_0x54f389);}})[_0xeec6('0x27')](function(_0x3b5aab){if(_0x3b5aab){_0x564303=_0x3b5aab[_0xeec6('0x3f')];if(!_0xca8d40['query'][_0xeec6('0x58')](_0xeec6('0x40'))){_0x54f389['limit']=qs[_0xeec6('0x22')](_0xca8d40[_0xeec6('0x38')][_0xeec6('0x22')]);_0x54f389[_0xeec6('0x21')]=qs['offset'](_0xca8d40['query'][_0xeec6('0x21')]);}return _0x2ae616[_0xeec6('0x8a')](_0x54f389);}})[_0xeec6('0x27')](function(_0x4eeae7){if(_0x4eeae7){return _0x4eeae7?{'count':_0x564303,'rows':_0x4eeae7}:null;}})['then'](respondWithResult(_0x5853cc,null))[_0xeec6('0x4a')](handleError(_0x5853cc,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 9b3e73b..4aabc28 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 _0x602b=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save','remove'];(function(_0x40a126,_0x4318f0){var _0x2831f9=function(_0x25976c){while(--_0x25976c){_0x40a126['push'](_0x40a126['shift']());}};_0x2831f9(++_0x4318f0);}(_0x602b,0x9a));var _0xb602=function(_0x7159ae,_0x2a4761){_0x7159ae=_0x7159ae-0x0;var _0x18a02c=_0x602b[_0x7159ae];return _0x18a02c;};'use strict';var EventEmitter=require(_0xb602('0x0'));var CmList=require(_0xb602('0x1'))['db'][_0xb602('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb602('0x3')](0x0);var events={'afterCreate':_0xb602('0x4'),'afterUpdate':'update','afterDestroy':_0xb602('0x5')};function emitEvent(_0x114e1b){return function(_0x2f26c7,_0x254af7,_0x5e1e7b){CmListEvents['emit'](_0x114e1b+':'+_0x2f26c7['id'],_0x2f26c7);CmListEvents[_0xb602('0x6')](_0x114e1b,_0x2f26c7);_0x5e1e7b(null);};}for(var e in events){if(events[_0xb602('0x7')](e)){var event=events[e];CmList[_0xb602('0x8')](e,emitEvent(event));}}module[_0xb602('0x9')]=CmListEvents; \ No newline at end of file +var _0xe72c=['events','CmList','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x2c2a56,_0x9e32e){var _0x3a41fd=function(_0x1b4cd9){while(--_0x1b4cd9){_0x2c2a56['push'](_0x2c2a56['shift']());}};_0x3a41fd(++_0x9e32e);}(_0xe72c,0x110));var _0xce72=function(_0x3c51af,_0x1991ce){_0x3c51af=_0x3c51af-0x0;var _0xeb10d9=_0xe72c[_0x3c51af];return _0xeb10d9;};'use strict';var EventEmitter=require(_0xce72('0x0'));var CmList=require('../../mysqldb')['db'][_0xce72('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0xce72('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xce72('0x3'),'afterDestroy':_0xce72('0x4')};function emitEvent(_0x11a202){return function(_0x37ffe7,_0x509c11,_0x550857){CmListEvents[_0xce72('0x5')](_0x11a202+':'+_0x37ffe7['id'],_0x37ffe7);CmListEvents[_0xce72('0x5')](_0x11a202,_0x37ffe7);_0x550857(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xce72('0x6')](e,emitEvent(event));}}module[_0xce72('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index d857c3e..18d54d9 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 _0xf782=['rimraf','./cmList.attributes','CmList','cm_lists','lodash','util','path'];(function(_0x1958ee,_0x47c195){var _0x243b3a=function(_0x134953){while(--_0x134953){_0x1958ee['push'](_0x1958ee['shift']());}};_0x243b3a(++_0x47c195);}(_0xf782,0x66));var _0x2f78=function(_0xd2c332,_0x1b5f38){_0xd2c332=_0xd2c332-0x0;var _0x4efc6f=_0xf782[_0xd2c332];return _0x4efc6f;};'use strict';var _=require(_0x2f78('0x0'));var util=require(_0x2f78('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f78('0x2'));var rimraf=require(_0x2f78('0x3'));var config=require('../../config/environment');var attributes=require(_0x2f78('0x4'));module['exports']=function(_0x4c3c20,_0x491c84){return _0x4c3c20['define'](_0x2f78('0x5'),attributes,{'tableName':_0x2f78('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x563e=['cm_lists','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList'];(function(_0x17ca2d,_0x18fee6){var _0x1f9867=function(_0x3ba7cc){while(--_0x3ba7cc){_0x17ca2d['push'](_0x17ca2d['shift']());}};_0x1f9867(++_0x18fee6);}(_0x563e,0xa9));var _0xe563=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0x563e[_0x4207f4];return _0x29a621;};'use strict';var _=require(_0xe563('0x0'));var util=require(_0xe563('0x1'));var logger=require(_0xe563('0x2'))(_0xe563('0x3'));var moment=require(_0xe563('0x4'));var BPromise=require('bluebird');var rp=require(_0xe563('0x5'));var fs=require('fs');var path=require(_0xe563('0x6'));var rimraf=require(_0xe563('0x7'));var config=require(_0xe563('0x8'));var attributes=require(_0xe563('0x9'));module[_0xe563('0xa')]=function(_0x409dc4,_0x77445){return _0x409dc4[_0xe563('0xb')](_0xe563('0xc'),attributes,{'tableName':_0xe563('0xd'),'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 6686d70..0f0a69f 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 _0x4bac=['client','http','defaults','localhost','socket.io-emitter','redis','register','then','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2fc91,_0x3ff6e4){var _0x529cc3=function(_0x1d22ad){while(--_0x1d22ad){_0x2fc91['push'](_0x2fc91['shift']());}};_0x529cc3(++_0x3ff6e4);}(_0x4bac,0x1c5));var _0xc4ba=function(_0x3e8d48,_0x3a4f59){_0x3e8d48=_0x3e8d48-0x0;var _0xa9df80=_0x4bac[_0x3e8d48];return _0xa9df80;};'use strict';var _=require(_0xc4ba('0x0'));var util=require(_0xc4ba('0x1'));var moment=require(_0xc4ba('0x2'));var BPromise=require(_0xc4ba('0x3'));var rs=require(_0xc4ba('0x4'));var fs=require('fs');var Redis=require(_0xc4ba('0x5'));var db=require(_0xc4ba('0x6'))['db'];var utils=require(_0xc4ba('0x7'));var logger=require(_0xc4ba('0x8'))(_0xc4ba('0x9'));var config=require(_0xc4ba('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc4ba('0xb')][_0xc4ba('0xc')]({'port':0x232a});config['redis']=_[_0xc4ba('0xd')](config['redis'],{'host':_0xc4ba('0xe'),'port':0x18eb});var socket=require(_0xc4ba('0xf'))(new Redis(config[_0xc4ba('0x10')]));require('./cmList.socket')[_0xc4ba('0x11')](socket);function respondWithRpcPromise(_0x5cf326,_0x146eef,_0x59ae70){return new BPromise(function(_0x2f47c7,_0x47cab){return client['request'](_0x5cf326,_0x59ae70)[_0xc4ba('0x12')](function(_0x532e33){logger[_0xc4ba('0x13')](_0xc4ba('0x14'),_0x146eef,'request\x20sent');logger[_0xc4ba('0x15')](_0xc4ba('0x16'),_0x146eef,_0xc4ba('0x17'),JSON[_0xc4ba('0x18')](_0x532e33));if(_0x532e33[_0xc4ba('0x19')]){if(_0x532e33[_0xc4ba('0x19')]['code']===0x1f4){logger['error'](_0xc4ba('0x14'),_0x146eef,_0x532e33[_0xc4ba('0x19')]['message']);return _0x47cab(_0x532e33[_0xc4ba('0x19')][_0xc4ba('0x1a')]);}logger[_0xc4ba('0x19')]('CmList,\x20%s,\x20%s',_0x146eef,_0x532e33[_0xc4ba('0x19')][_0xc4ba('0x1a')]);return _0x2f47c7(_0x532e33[_0xc4ba('0x19')]['message']);}else{logger[_0xc4ba('0x13')](_0xc4ba('0x14'),_0x146eef,_0xc4ba('0x17'));_0x2f47c7(_0x532e33[_0xc4ba('0x1b')][_0xc4ba('0x1a')]);}})[_0xc4ba('0x1c')](function(_0x39d692){logger['error'](_0xc4ba('0x14'),_0x146eef,_0x39d692);_0x47cab(_0x39d692);});});} \ No newline at end of file +var _0x96c7=['error','code','message','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x533134,_0x3c5ff6){var _0x59e95f=function(_0x64e57b){while(--_0x64e57b){_0x533134['push'](_0x533134['shift']());}};_0x59e95f(++_0x3c5ff6);}(_0x96c7,0x1a1));var _0x796c=function(_0x2036d3,_0x123ff3){_0x2036d3=_0x2036d3-0x0;var _0x1b1952=_0x96c7[_0x2036d3];return _0x1b1952;};'use strict';var _=require(_0x796c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x796c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x796c('0x2'))['db'];var utils=require(_0x796c('0x3'));var logger=require(_0x796c('0x4'))(_0x796c('0x5'));var config=require(_0x796c('0x6'));var jayson=require(_0x796c('0x7'));var client=jayson['client'][_0x796c('0x8')]({'port':0x232a});config[_0x796c('0x9')]=_[_0x796c('0xa')](config['redis'],{'host':_0x796c('0xb'),'port':0x18eb});var socket=require(_0x796c('0xc'))(new Redis(config[_0x796c('0x9')]));require(_0x796c('0xd'))[_0x796c('0xe')](socket);function respondWithRpcPromise(_0x19a598,_0x518d16,_0x2b0f3a){return new BPromise(function(_0xa701f2,_0x2a3fdd){return client['request'](_0x19a598,_0x2b0f3a)[_0x796c('0xf')](function(_0x9d17b){logger[_0x796c('0x10')](_0x796c('0x11'),_0x518d16,_0x796c('0x12'));logger[_0x796c('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x518d16,_0x796c('0x12'),JSON['stringify'](_0x9d17b));if(_0x9d17b[_0x796c('0x14')]){if(_0x9d17b[_0x796c('0x14')][_0x796c('0x15')]===0x1f4){logger[_0x796c('0x14')](_0x796c('0x11'),_0x518d16,_0x9d17b[_0x796c('0x14')]['message']);return _0x2a3fdd(_0x9d17b[_0x796c('0x14')][_0x796c('0x16')]);}logger[_0x796c('0x14')]('CmList,\x20%s,\x20%s',_0x518d16,_0x9d17b['error'][_0x796c('0x16')]);return _0xa701f2(_0x9d17b['error'][_0x796c('0x16')]);}else{logger['info'](_0x796c('0x11'),_0x518d16,_0x796c('0x12'));_0xa701f2(_0x9d17b['result'][_0x796c('0x16')]);}})['catch'](function(_0x43a4f1){logger[_0x796c('0x14')](_0x796c('0x11'),_0x518d16,_0x43a4f1);_0x2a3fdd(_0x43a4f1);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 9586ce2..d73655e 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 _0x5b20=['remove','update','emit','removeListener','length','cmList:','./cmList.events','save'];(function(_0x4df1f5,_0x39c6d2){var _0x56585b=function(_0x287b6e){while(--_0x287b6e){_0x4df1f5['push'](_0x4df1f5['shift']());}};_0x56585b(++_0x39c6d2);}(_0x5b20,0x86));var _0x05b2=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5b20[_0x59ee6f];return _0x4c0979;};'use strict';var CmListEvents=require(_0x05b2('0x0'));var events=[_0x05b2('0x1'),_0x05b2('0x2'),_0x05b2('0x3')];function createListener(_0x34eed0,_0x54e72e){return function(_0x3f63b3){_0x54e72e[_0x05b2('0x4')](_0x34eed0,_0x3f63b3);};}function removeListener(_0x19cb65,_0x1d9490){return function(){CmListEvents[_0x05b2('0x5')](_0x19cb65,_0x1d9490);};}exports['register']=function(_0x22e0e2){for(var _0x83fd18=0x0,_0x541855=events[_0x05b2('0x6')];_0x83fd18<_0x541855;_0x83fd18++){var _0x43cd94=events[_0x83fd18];var _0x3be69a=createListener(_0x05b2('0x7')+_0x43cd94,_0x22e0e2);CmListEvents['on'](_0x43cd94,_0x3be69a);}}; \ No newline at end of file +var _0x078c=['register','length','./cmList.events','remove','update','emit','removeListener'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x078c,0x19f));var _0xc078=function(_0x120bc2,_0x57a253){_0x120bc2=_0x120bc2-0x0;var _0x454a41=_0x078c[_0x120bc2];return _0x454a41;};'use strict';var CmListEvents=require(_0xc078('0x0'));var events=['save',_0xc078('0x1'),_0xc078('0x2')];function createListener(_0x503bd4,_0x82572){return function(_0x107624){_0x82572[_0xc078('0x3')](_0x503bd4,_0x107624);};}function removeListener(_0x217004,_0x56bf2e){return function(){CmListEvents[_0xc078('0x4')](_0x217004,_0x56bf2e);};}exports[_0xc078('0x5')]=function(_0x394068){for(var _0x24b241=0x0,_0x40e428=events[_0xc078('0x6')];_0x24b241<_0x40e428;_0x24b241++){var _0x22661e=events[_0x24b241];var _0x4030b1=createListener('cmList:'+_0x22661e,_0x394068);CmListEvents['on'](_0x22661e,_0x4030b1);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index dfd2027..1856752 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 _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_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['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'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file +var _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 7455a21..ed53704 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(_0x5870cd,_0x958bad){var _0x2abd09=function(_0x1b8212){while(--_0x1b8212){_0x5870cd['push'](_0x5870cd['shift']());}};_0x2abd09(++_0x958bad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x3d9def,_0x3e9ab1){var _0x463b89=function(_0x98859e){while(--_0x98859e){_0x3d9def['push'](_0x3d9def['shift']());}};_0x463b89(++_0x3e9ab1);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index efb4358..24ce14a 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 _0xfb2d=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','then','destroy','error','stack','name','send','update','body','Condition','find','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x11d1dc,_0x1d7dd1){var _0x4a2e50=function(_0x16deda){while(--_0x16deda){_0x11d1dc['push'](_0x11d1dc['shift']());}};_0x4a2e50(++_0x1d7dd1);}(_0xfb2d,0xda));var _0xdfb2=function(_0x54a9e3,_0x4a3813){_0x54a9e3=_0x54a9e3-0x0;var _0x247cce=_0xfb2d[_0x54a9e3];return _0x247cce;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdfb2('0x0'));var rimraf=require(_0xdfb2('0x1'));var zipdir=require(_0xdfb2('0x2'));var jsonpatch=require(_0xdfb2('0x3'));var rp=require('request-promise');var moment=require(_0xdfb2('0x4'));var BPromise=require(_0xdfb2('0x5'));var Mustache=require('mustache');var util=require(_0xdfb2('0x6'));var path=require(_0xdfb2('0x7'));var sox=require(_0xdfb2('0x8'));var csv=require(_0xdfb2('0x9'));var ejs=require(_0xdfb2('0xa'));var fs=require('fs');var _=require(_0xdfb2('0xb'));var squel=require(_0xdfb2('0xc'));var crypto=require(_0xdfb2('0xd'));var jsforce=require(_0xdfb2('0xe'));var deskjs=require(_0xdfb2('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdfb2('0x10'));var Papa=require(_0xdfb2('0x11'));var Redis=require('ioredis');var authService=require(_0xdfb2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdfb2('0x13'));var hardwareService=require(_0xdfb2('0x14'));var logger=require(_0xdfb2('0x15'))(_0xdfb2('0x16'));var utils=require(_0xdfb2('0x17'));var config=require(_0xdfb2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xdfb2('0x19'))['db'];function respondWithStatusCode(_0x5f1f66,_0x1ddcb6){_0x1ddcb6=_0x1ddcb6||0xcc;return function(_0x1e5891){if(_0x1e5891){return _0x5f1f66[_0xdfb2('0x1a')](_0x1ddcb6);}return _0x5f1f66[_0xdfb2('0x1b')](_0x1ddcb6)[_0xdfb2('0x1c')]();};}function respondWithResult(_0x25f5f0,_0x899852){_0x899852=_0x899852||0xc8;return function(_0x265e63){if(_0x265e63){return _0x25f5f0[_0xdfb2('0x1b')](_0x899852)[_0xdfb2('0x1d')](_0x265e63);}};}function respondWithFilteredResult(_0x22fd25,_0x58f830){return function(_0x23fe3b){if(_0x23fe3b){var _0x3c89ef=_0x23fe3b[_0xdfb2('0x1e')],_0x3a5134=_0x58f830[_0xdfb2('0x1f')],_0x4afa51=_0x58f830[_0xdfb2('0x1f')]+_0x58f830['limit'],_0x1bc08e;if(_0x4afa51>=_0x3c89ef){_0x4afa51=_0x3c89ef;_0x1bc08e=0xc8;}else{_0x1bc08e=0xce;}_0x22fd25[_0xdfb2('0x1b')](_0x1bc08e);return _0x22fd25[_0xdfb2('0x20')](_0xdfb2('0x21'),_0x3a5134+'-'+_0x4afa51+'/'+_0x3c89ef)[_0xdfb2('0x1d')](_0x23fe3b);}return null;};}function patchUpdates(_0x487b15){return function(_0x5f576c){try{jsonpatch['apply'](_0x5f576c,_0x487b15,!![]);}catch(_0x17320a){return BPromise[_0xdfb2('0x22')](_0x17320a);}return _0x5f576c[_0xdfb2('0x23')]();};}function saveUpdates(_0x3b1536,_0x32f8e4){return function(_0xcba293){if(_0xcba293){return _0xcba293['update'](_0x3b1536)[_0xdfb2('0x24')](function(_0x2606b1){return _0x2606b1;});}return null;};}function removeEntity(_0x544d63,_0xb7d060){return function(_0x4260fb){if(_0x4260fb){return _0x4260fb[_0xdfb2('0x25')]()['then'](function(){_0x544d63[_0xdfb2('0x1b')](0xcc)[_0xdfb2('0x1c')]();});}};}function handleEntityNotFound(_0x4364e7,_0x459048){return function(_0x5704f6){if(!_0x5704f6){_0x4364e7[_0xdfb2('0x1a')](0x194);}return _0x5704f6;};}function handleError(_0x451f07,_0x452d9f){_0x452d9f=_0x452d9f||0x1f4;return function(_0x7151d9){logger[_0xdfb2('0x26')](_0x7151d9[_0xdfb2('0x27')]);if(_0x7151d9['name']){delete _0x7151d9[_0xdfb2('0x28')];}_0x451f07[_0xdfb2('0x1b')](_0x452d9f)[_0xdfb2('0x29')](_0x7151d9);};}exports[_0xdfb2('0x2a')]=function(_0x462a5a,_0x43581d){if(_0x462a5a['body']['id']){delete _0x462a5a[_0xdfb2('0x2b')]['id'];}return db[_0xdfb2('0x2c')][_0xdfb2('0x2d')]({'where':{'id':_0x462a5a['params']['id']}})['then'](handleEntityNotFound(_0x43581d,null))['then'](saveUpdates(_0x462a5a[_0xdfb2('0x2b')],null))[_0xdfb2('0x24')](respondWithResult(_0x43581d,null))[_0xdfb2('0x2e')](handleError(_0x43581d,null));};exports[_0xdfb2('0x25')]=function(_0x4479df,_0x479099){return db['Condition'][_0xdfb2('0x2d')]({'where':{'id':_0x4479df[_0xdfb2('0x2f')]['id']}})[_0xdfb2('0x24')](handleEntityNotFound(_0x479099,null))['then'](removeEntity(_0x479099,null))[_0xdfb2('0x2e')](handleError(_0x479099,null));}; \ No newline at end of file +var _0x858a=['send','body','Condition','find','catch','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','set','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x858a,0x156));var _0xa858=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x858a[_0x422905];return _0x33dc6c;};'use strict';var pdf=require(_0xa858('0x0'));var emlformat=require(_0xa858('0x1'));var rimraf=require(_0xa858('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa858('0x3'));var rp=require(_0xa858('0x4'));var moment=require(_0xa858('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa858('0x6'));var util=require(_0xa858('0x7'));var path=require(_0xa858('0x8'));var sox=require(_0xa858('0x9'));var csv=require(_0xa858('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa858('0xb'));var crypto=require(_0xa858('0xc'));var jsforce=require(_0xa858('0xd'));var deskjs=require(_0xa858('0xe'));var toCsv=require(_0xa858('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa858('0xf'));var qs=require(_0xa858('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa858('0x11'));var logger=require('../../config/logger')(_0xa858('0x12'));var utils=require(_0xa858('0x13'));var config=require(_0xa858('0x14'));var licenseUtil=require(_0xa858('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c304f,_0x106976){_0x106976=_0x106976||0xcc;return function(_0x4c758c){if(_0x4c758c){return _0x1c304f[_0xa858('0x16')](_0x106976);}return _0x1c304f[_0xa858('0x17')](_0x106976)[_0xa858('0x18')]();};}function respondWithResult(_0x23781b,_0x23a719){_0x23a719=_0x23a719||0xc8;return function(_0x29d42d){if(_0x29d42d){return _0x23781b[_0xa858('0x17')](_0x23a719)[_0xa858('0x19')](_0x29d42d);}};}function respondWithFilteredResult(_0x5af5db,_0x269d37){return function(_0x49269c){if(_0x49269c){var _0x2b97b8=_0x49269c['count'],_0x2404ef=_0x269d37['offset'],_0xeaadc7=_0x269d37['offset']+_0x269d37['limit'],_0x51c9a5;if(_0xeaadc7>=_0x2b97b8){_0xeaadc7=_0x2b97b8;_0x51c9a5=0xc8;}else{_0x51c9a5=0xce;}_0x5af5db[_0xa858('0x17')](_0x51c9a5);return _0x5af5db[_0xa858('0x1a')]('Content-Range',_0x2404ef+'-'+_0xeaadc7+'/'+_0x2b97b8)[_0xa858('0x19')](_0x49269c);}return null;};}function patchUpdates(_0x343d8f){return function(_0x3734b7){try{jsonpatch[_0xa858('0x1b')](_0x3734b7,_0x343d8f,!![]);}catch(_0x3faad1){return BPromise[_0xa858('0x1c')](_0x3faad1);}return _0x3734b7[_0xa858('0x1d')]();};}function saveUpdates(_0x49ebd9,_0x14bfac){return function(_0x47d899){if(_0x47d899){return _0x47d899[_0xa858('0x1e')](_0x49ebd9)[_0xa858('0x1f')](function(_0x1ebad6){return _0x1ebad6;});}return null;};}function removeEntity(_0x3ba831,_0x48b1a2){return function(_0x2c6c4a){if(_0x2c6c4a){return _0x2c6c4a[_0xa858('0x20')]()[_0xa858('0x1f')](function(){_0x3ba831[_0xa858('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cbaaf,_0x494a78){return function(_0x333a42){if(!_0x333a42){_0x3cbaaf[_0xa858('0x16')](0x194);}return _0x333a42;};}function handleError(_0x5ec99a,_0x3f8def){_0x3f8def=_0x3f8def||0x1f4;return function(_0x245a84){logger[_0xa858('0x21')](_0x245a84[_0xa858('0x22')]);if(_0x245a84[_0xa858('0x23')]){delete _0x245a84['name'];}_0x5ec99a[_0xa858('0x17')](_0x3f8def)[_0xa858('0x24')](_0x245a84);};}exports[_0xa858('0x1e')]=function(_0x4948f0,_0x4a8d30){if(_0x4948f0[_0xa858('0x25')]['id']){delete _0x4948f0[_0xa858('0x25')]['id'];}return db[_0xa858('0x26')][_0xa858('0x27')]({'where':{'id':_0x4948f0['params']['id']}})[_0xa858('0x1f')](handleEntityNotFound(_0x4a8d30,null))[_0xa858('0x1f')](saveUpdates(_0x4948f0[_0xa858('0x25')],null))[_0xa858('0x1f')](respondWithResult(_0x4a8d30,null))[_0xa858('0x28')](handleError(_0x4a8d30,null));};exports[_0xa858('0x20')]=function(_0x42143f,_0x42e9a2){return db[_0xa858('0x26')][_0xa858('0x27')]({'where':{'id':_0x42143f[_0xa858('0x29')]['id']}})[_0xa858('0x1f')](handleEntityNotFound(_0x42e9a2,null))[_0xa858('0x1f')](removeEntity(_0x42e9a2,null))[_0xa858('0x28')](handleError(_0x42e9a2,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 4787dce..59ec0be 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 _0xefbc=['../../config/logger','bluebird','request-promise','path','./condition.attributes','exports','Condition','tools_conditions'];(function(_0x1f7244,_0x22a5a4){var _0xacda64=function(_0x302c7b){while(--_0x302c7b){_0x1f7244['push'](_0x1f7244['shift']());}};_0xacda64(++_0x22a5a4);}(_0xefbc,0x88));var _0xcefb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xefbc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcefb('0x0'))('api');var moment=require('moment');var BPromise=require(_0xcefb('0x1'));var rp=require(_0xcefb('0x2'));var fs=require('fs');var path=require(_0xcefb('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcefb('0x4'));module[_0xcefb('0x5')]=function(_0x1afb5e,_0x39a789){return _0x1afb5e['define'](_0xcefb('0x6'),attributes,{'tableName':_0xcefb('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59dc=['api','moment','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','../../config/logger'];(function(_0x5a85d2,_0x1907f8){var _0x34f5fc=function(_0x2eaee2){while(--_0x2eaee2){_0x5a85d2['push'](_0x5a85d2['shift']());}};_0x34f5fc(++_0x1907f8);}(_0x59dc,0x99));var _0xc59d=function(_0x41eefe,_0x4ee752){_0x41eefe=_0x41eefe-0x0;var _0x23b8f9=_0x59dc[_0x41eefe];return _0x23b8f9;};'use strict';var _=require(_0xc59d('0x0'));var util=require(_0xc59d('0x1'));var logger=require(_0xc59d('0x2'))(_0xc59d('0x3'));var moment=require(_0xc59d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc59d('0x5'));var rimraf=require(_0xc59d('0x6'));var config=require(_0xc59d('0x7'));var attributes=require(_0xc59d('0x8'));module[_0xc59d('0x9')]=function(_0x1a0e3b,_0xf030e9){return _0x1a0e3b[_0xc59d('0xa')](_0xc59d('0xb'),attributes,{'tableName':_0xc59d('0xc'),'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 8eb4332..8329c2e 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 _0xa892=['result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x1fb138,_0x3d6660){var _0x5ab559=function(_0x3819ae){while(--_0x3819ae){_0x1fb138['push'](_0x1fb138['shift']());}};_0x5ab559(++_0x3d6660);}(_0xa892,0x14c));var _0x2a89=function(_0x181b3c,_0x27225a){_0x181b3c=_0x181b3c-0x0;var _0x47ff29=_0xa892[_0x181b3c];return _0x47ff29;};'use strict';var _=require(_0x2a89('0x0'));var util=require(_0x2a89('0x1'));var moment=require(_0x2a89('0x2'));var BPromise=require(_0x2a89('0x3'));var rs=require(_0x2a89('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2a89('0x5'));var logger=require(_0x2a89('0x6'))(_0x2a89('0x7'));var config=require(_0x2a89('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2a89('0x9')][_0x2a89('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2922fc,_0x4d26e8,_0x24a9dd){return new BPromise(function(_0x43b445,_0x230275){return client[_0x2a89('0xb')](_0x2922fc,_0x24a9dd)[_0x2a89('0xc')](function(_0x23747b){logger[_0x2a89('0xd')](_0x2a89('0xe'),_0x4d26e8,_0x2a89('0xf'));logger[_0x2a89('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x4d26e8,_0x2a89('0xf'),JSON[_0x2a89('0x11')](_0x23747b));if(_0x23747b[_0x2a89('0x12')]){if(_0x23747b[_0x2a89('0x12')]['code']===0x1f4){logger[_0x2a89('0x12')](_0x2a89('0xe'),_0x4d26e8,_0x23747b[_0x2a89('0x12')][_0x2a89('0x13')]);return _0x230275(_0x23747b[_0x2a89('0x12')][_0x2a89('0x13')]);}logger[_0x2a89('0x12')](_0x2a89('0xe'),_0x4d26e8,_0x23747b[_0x2a89('0x12')][_0x2a89('0x13')]);return _0x43b445(_0x23747b['error'][_0x2a89('0x13')]);}else{logger[_0x2a89('0xd')](_0x2a89('0xe'),_0x4d26e8,_0x2a89('0xf'));_0x43b445(_0x23747b[_0x2a89('0x14')][_0x2a89('0x13')]);}})[_0x2a89('0x15')](function(_0x3b3cef){logger[_0x2a89('0x12')](_0x2a89('0xe'),_0x4d26e8,_0x3b3cef);_0x230275(_0x3b3cef);});});} \ No newline at end of file +var _0xfaa9=['request\x20sent','debug','stringify','error','code','message','result','lodash','util','randomstring','../../mysqldb','rpc','../../config/environment','http','request','then','info','Condition,\x20%s,\x20%s'];(function(_0x16c7b1,_0x3a1944){var _0x40a711=function(_0x4005b5){while(--_0x4005b5){_0x16c7b1['push'](_0x16c7b1['shift']());}};_0x40a711(++_0x3a1944);}(_0xfaa9,0x97));var _0x9faa=function(_0x1228e5,_0x41d9d3){_0x1228e5=_0x1228e5-0x0;var _0x20101a=_0xfaa9[_0x1228e5];return _0x20101a;};'use strict';var _=require(_0x9faa('0x0'));var util=require(_0x9faa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9faa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9faa('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9faa('0x4'));var config=require(_0x9faa('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9faa('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2443a1,_0x9c4562,_0x44a748){return new BPromise(function(_0x4bbe77,_0x2ed59e){return client[_0x9faa('0x7')](_0x2443a1,_0x44a748)[_0x9faa('0x8')](function(_0x5c8601){logger[_0x9faa('0x9')](_0x9faa('0xa'),_0x9c4562,_0x9faa('0xb'));logger[_0x9faa('0xc')]('Condition,\x20%s,\x20%s,\x20%s',_0x9c4562,_0x9faa('0xb'),JSON[_0x9faa('0xd')](_0x5c8601));if(_0x5c8601[_0x9faa('0xe')]){if(_0x5c8601[_0x9faa('0xe')][_0x9faa('0xf')]===0x1f4){logger[_0x9faa('0xe')](_0x9faa('0xa'),_0x9c4562,_0x5c8601['error'][_0x9faa('0x10')]);return _0x2ed59e(_0x5c8601[_0x9faa('0xe')]['message']);}logger['error'](_0x9faa('0xa'),_0x9c4562,_0x5c8601[_0x9faa('0xe')][_0x9faa('0x10')]);return _0x4bbe77(_0x5c8601[_0x9faa('0xe')][_0x9faa('0x10')]);}else{logger['info'](_0x9faa('0xa'),_0x9c4562,_0x9faa('0xb'));_0x4bbe77(_0x5c8601[_0x9faa('0x11')]['message']);}})['catch'](function(_0x26baf2){logger[_0x9faa('0xe')](_0x9faa('0xa'),_0x9c4562,_0x26baf2);_0x2ed59e(_0x26baf2);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 2bab214..6c13267 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 _0x2229=['delete','/:id','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','put','isAuthenticated','update'];(function(_0x8b0f43,_0x1c57b8){var _0x3f4425=function(_0x16e59a){while(--_0x16e59a){_0x8b0f43['push'](_0x8b0f43['shift']());}};_0x3f4425(++_0x1c57b8);}(_0x2229,0xba));var _0x9222=function(_0xab2afb,_0x546bfb){_0xab2afb=_0xab2afb-0x0;var _0x25262b=_0x2229[_0xab2afb];return _0x25262b;};'use strict';var multer=require('multer');var util=require(_0x9222('0x0'));var path=require(_0x9222('0x1'));var timeout=require(_0x9222('0x2'));var express=require(_0x9222('0x3'));var router=express['Router']();var auth=require(_0x9222('0x4'));var interaction=require(_0x9222('0x5'));var config=require(_0x9222('0x6'));var controller=require('./condition.controller');router[_0x9222('0x7')]('/:id',auth[_0x9222('0x8')](),controller[_0x9222('0x9')]);router[_0x9222('0xa')](_0x9222('0xb'),auth[_0x9222('0x8')](),controller[_0x9222('0xc')]);module[_0x9222('0xd')]=router; \ No newline at end of file +var _0x0011=['../../components/auth/service','../../components/interaction/service','./condition.controller','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','express','Router'];(function(_0x6e2bdd,_0xb7cffa){var _0x49470f=function(_0x522c9a){while(--_0x522c9a){_0x6e2bdd['push'](_0x6e2bdd['shift']());}};_0x49470f(++_0xb7cffa);}(_0x0011,0xe6));var _0x1001=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x0011[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x1001('0x0'));var util=require(_0x1001('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1001('0x2'));var router=express[_0x1001('0x3')]();var auth=require(_0x1001('0x4'));var interaction=require(_0x1001('0x5'));var config=require('../../config/environment');var controller=require(_0x1001('0x6'));router['put'](_0x1001('0x7'),auth[_0x1001('0x8')](),controller[_0x1001('0x9')]);router[_0x1001('0xa')](_0x1001('0x7'),auth[_0x1001('0x8')](),controller[_0x1001('0xb')]);module[_0x1001('0xc')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 53746a6..48f32e4 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 _0xee14=['name','INTEGER','STRING'];(function(_0x65f6ba,_0x4a1ace){var _0x1e0cae=function(_0x482872){while(--_0x482872){_0x65f6ba['push'](_0x65f6ba['shift']());}};_0x1e0cae(++_0x4a1ace);}(_0xee14,0x13a));var _0x4ee1=function(_0x325a94,_0x1d666f){_0x325a94=_0x325a94-0x0;var _0xaa5dde=_0xee14[_0x325a94];return _0xaa5dde;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4ee1('0x0')],'allowNull':![],'unique':_0x4ee1('0x1')},'OrderBy':{'type':Sequelize[_0x4ee1('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x4ee1('0x0')],'allowNull':!![]}}; \ No newline at end of file +var _0x42b0=['sequelize','exports','name','STRING'];(function(_0x64be95,_0x2d738b){var _0x574694=function(_0x12453b){while(--_0x12453b){_0x64be95['push'](_0x64be95['shift']());}};_0x574694(++_0x2d738b);}(_0x42b0,0xbc));var _0x042b=function(_0x2bced3,_0x59c962){_0x2bced3=_0x2bced3-0x0;var _0x5d9a81=_0x42b0[_0x2bced3];return _0x5d9a81;};'use strict';var Sequelize=require(_0x042b('0x0'));module[_0x042b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x042b('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x042b('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index c520a82..b4e2b99 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 _0x9bde=['json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','sendStatus','stack','name','send','index','map','ContactItemType','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','intersection','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end'];(function(_0x33f620,_0x2df166){var _0x4ed082=function(_0x4bdbb5){while(--_0x4bdbb5){_0x33f620['push'](_0x33f620['shift']());}};_0x4ed082(++_0x2df166);}(_0x9bde,0xe1));var _0xe9bd=function(_0x27279b,_0xeef5c0){_0x27279b=_0x27279b-0x0;var _0x2f998f=_0x9bde[_0x27279b];return _0x2f998f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe9bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe9bd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe9bd('0x2'));var moment=require(_0xe9bd('0x3'));var BPromise=require(_0xe9bd('0x4'));var Mustache=require(_0xe9bd('0x5'));var util=require(_0xe9bd('0x6'));var path=require(_0xe9bd('0x7'));var sox=require(_0xe9bd('0x8'));var csv=require('to-csv');var ejs=require(_0xe9bd('0x9'));var fs=require('fs');var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0xf'));var querystring=require(_0xe9bd('0x10'));var Papa=require(_0xe9bd('0x11'));var Redis=require(_0xe9bd('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x13'));var hardwareService=require(_0xe9bd('0x14'));var logger=require(_0xe9bd('0x15'))('api');var utils=require(_0xe9bd('0x16'));var config=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x141587,_0x5e022a){_0x5e022a=_0x5e022a||0xcc;return function(_0x2c1d98){if(_0x2c1d98){return _0x141587['sendStatus'](_0x5e022a);}return _0x141587[_0xe9bd('0x19')](_0x5e022a)[_0xe9bd('0x1a')]();};}function respondWithResult(_0x3435b4,_0x51109f){_0x51109f=_0x51109f||0xc8;return function(_0x47ba5e){if(_0x47ba5e){return _0x3435b4[_0xe9bd('0x19')](_0x51109f)[_0xe9bd('0x1b')](_0x47ba5e);}};}function respondWithFilteredResult(_0x3a9e5f,_0x46a59b){return function(_0x3360bd){if(_0x3360bd){var _0x389e7b=_0x3360bd[_0xe9bd('0x1c')],_0x45a9f2=_0x46a59b[_0xe9bd('0x1d')],_0x573350=_0x46a59b['offset']+_0x46a59b[_0xe9bd('0x1e')],_0x1d11a0;if(_0x573350>=_0x389e7b){_0x573350=_0x389e7b;_0x1d11a0=0xc8;}else{_0x1d11a0=0xce;}_0x3a9e5f[_0xe9bd('0x19')](_0x1d11a0);return _0x3a9e5f[_0xe9bd('0x1f')](_0xe9bd('0x20'),_0x45a9f2+'-'+_0x573350+'/'+_0x389e7b)['json'](_0x3360bd);}return null;};}function patchUpdates(_0x20ec32){return function(_0x50a5e8){try{jsonpatch[_0xe9bd('0x21')](_0x50a5e8,_0x20ec32,!![]);}catch(_0x55b869){return BPromise[_0xe9bd('0x22')](_0x55b869);}return _0x50a5e8[_0xe9bd('0x23')]();};}function saveUpdates(_0x134c4e,_0x3dda13){return function(_0x1acb82){if(_0x1acb82){return _0x1acb82[_0xe9bd('0x24')](_0x134c4e)[_0xe9bd('0x25')](function(_0x49165b){return _0x49165b;});}return null;};}function removeEntity(_0x133318,_0x28cd17){return function(_0x4ecaf5){if(_0x4ecaf5){return _0x4ecaf5[_0xe9bd('0x26')]()['then'](function(){var _0x238ab1=_0x4ecaf5[_0xe9bd('0x27')]({'plain':!![]});var _0x36f8c0=_0xe9bd('0x28');return db['UserProfileResource'][_0xe9bd('0x26')]({'where':{'type':_0x36f8c0,'resourceId':_0x238ab1['id']}})[_0xe9bd('0x25')](function(){return _0x4ecaf5;});})[_0xe9bd('0x25')](function(){_0x133318[_0xe9bd('0x19')](0xcc)[_0xe9bd('0x1a')]();});}};}function handleEntityNotFound(_0xb52d45,_0x399f3c){return function(_0x43ea90){if(!_0x43ea90){_0xb52d45[_0xe9bd('0x29')](0x194);}return _0x43ea90;};}function handleError(_0x5987af,_0x3c211a){_0x3c211a=_0x3c211a||0x1f4;return function(_0x38fdfa){logger['error'](_0x38fdfa[_0xe9bd('0x2a')]);if(_0x38fdfa[_0xe9bd('0x2b')]){delete _0x38fdfa[_0xe9bd('0x2b')];}_0x5987af[_0xe9bd('0x19')](_0x3c211a)[_0xe9bd('0x2c')](_0x38fdfa);};}exports[_0xe9bd('0x2d')]=function(_0x519f48,_0x5b7f1d){var _0x1de54c={},_0x56e409={},_0xa45eb0={'count':0x0,'rows':[]};var _0x1f2c0e=_[_0xe9bd('0x2e')](db[_0xe9bd('0x2f')][_0xe9bd('0x30')],function(_0x509e36){return{'name':_0x509e36['fieldName'],'type':_0x509e36[_0xe9bd('0x31')][_0xe9bd('0x32')]};});_0x56e409[_0xe9bd('0x33')]=_[_0xe9bd('0x2e')](_0x1f2c0e,_0xe9bd('0x2b'));_0x56e409[_0xe9bd('0x34')]=_[_0xe9bd('0x35')](_0x519f48[_0xe9bd('0x34')]);_0x56e409[_0xe9bd('0x36')]=_['intersection'](_0x56e409[_0xe9bd('0x33')],_0x56e409[_0xe9bd('0x34')]);_0x1de54c[_0xe9bd('0x37')]=_['intersection'](_0x56e409['model'],qs[_0xe9bd('0x38')](_0x519f48[_0xe9bd('0x34')][_0xe9bd('0x38')]));_0x1de54c[_0xe9bd('0x37')]=_0x1de54c[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x1de54c[_0xe9bd('0x37')]:_0x56e409[_0xe9bd('0x33')];if(!_0x519f48[_0xe9bd('0x34')][_0xe9bd('0x3a')](_0xe9bd('0x3b'))){_0x1de54c[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x519f48[_0xe9bd('0x34')][_0xe9bd('0x1e')]);_0x1de54c[_0xe9bd('0x1d')]=qs[_0xe9bd('0x1d')](_0x519f48[_0xe9bd('0x34')]['offset']);}_0x1de54c[_0xe9bd('0x3c')]=qs[_0xe9bd('0x3d')](_0x519f48['query'][_0xe9bd('0x3d')]);_0x1de54c[_0xe9bd('0x3e')]=qs['filters'](_['pick'](_0x519f48[_0xe9bd('0x34')],_0x56e409[_0xe9bd('0x36')]),_0x1f2c0e);if(_0x519f48['query'][_0xe9bd('0x3f')]){_0x1de54c[_0xe9bd('0x3e')]=_[_0xe9bd('0x40')](_0x1de54c['where'],{'$or':_[_0xe9bd('0x2e')](_0x1f2c0e,function(_0x4d1945){if(_0x4d1945[_0xe9bd('0x31')]!==_0xe9bd('0x41')){var _0x63d67c={};_0x63d67c[_0x4d1945[_0xe9bd('0x2b')]]={'$like':'%'+_0x519f48['query'][_0xe9bd('0x3f')]+'%'};return _0x63d67c;}})});}_0x1de54c=_[_0xe9bd('0x40')]({},_0x1de54c,_0x519f48[_0xe9bd('0x42')]);var _0x3f1212={'where':_0x1de54c[_0xe9bd('0x3e')]};return db[_0xe9bd('0x2f')][_0xe9bd('0x1c')](_0x3f1212)[_0xe9bd('0x25')](function(_0x2b5a71){_0xa45eb0[_0xe9bd('0x1c')]=_0x2b5a71;if(_0x519f48['query']['includeAll']){_0x1de54c[_0xe9bd('0x43')]=[{'all':!![]}];}return db['ContactItemType'][_0xe9bd('0x44')](_0x1de54c);})[_0xe9bd('0x25')](function(_0x41881a){_0xa45eb0['rows']=_0x41881a;return _0xa45eb0;})[_0xe9bd('0x25')](respondWithFilteredResult(_0x5b7f1d,_0x1de54c))[_0xe9bd('0x45')](handleError(_0x5b7f1d,null));};exports[_0xe9bd('0x46')]=function(_0x5a4460,_0x2ef01b){var _0x3a5703={'raw':!![],'where':{'id':_0x5a4460[_0xe9bd('0x47')]['id']}},_0x2b3cd7={};_0x2b3cd7[_0xe9bd('0x33')]=_[_0xe9bd('0x35')](db[_0xe9bd('0x2f')][_0xe9bd('0x30')]);_0x2b3cd7[_0xe9bd('0x34')]=_[_0xe9bd('0x35')](_0x5a4460[_0xe9bd('0x34')]);_0x2b3cd7[_0xe9bd('0x36')]=_[_0xe9bd('0x48')](_0x2b3cd7[_0xe9bd('0x33')],_0x2b3cd7[_0xe9bd('0x34')]);_0x3a5703['attributes']=_['intersection'](_0x2b3cd7[_0xe9bd('0x33')],qs[_0xe9bd('0x38')](_0x5a4460[_0xe9bd('0x34')]['fields']));_0x3a5703['attributes']=_0x3a5703[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x3a5703[_0xe9bd('0x37')]:_0x2b3cd7[_0xe9bd('0x33')];if(_0x5a4460[_0xe9bd('0x34')][_0xe9bd('0x49')]){_0x3a5703[_0xe9bd('0x43')]=[{'all':!![]}];}_0x3a5703=_['merge']({},_0x3a5703,_0x5a4460[_0xe9bd('0x42')]);return db['ContactItemType'][_0xe9bd('0x4a')](_0x3a5703)[_0xe9bd('0x25')](handleEntityNotFound(_0x2ef01b,null))[_0xe9bd('0x25')](respondWithResult(_0x2ef01b,null))[_0xe9bd('0x45')](handleError(_0x2ef01b,null));};exports[_0xe9bd('0x4b')]=function(_0x4b7b67,_0x3317d6){return db[_0xe9bd('0x2f')][_0xe9bd('0x4b')](_0x4b7b67['body'],{})[_0xe9bd('0x25')](function(_0x476f23){var _0x34f787=_0x4b7b67['user'][_0xe9bd('0x27')]({'plain':!![]});if(!_0x34f787)throw new Error(_0xe9bd('0x4c'));if(_0x34f787[_0xe9bd('0x4d')]===_0xe9bd('0x4e')){var _0x1ee09c=_0x476f23['get']({'plain':!![]});var _0x3f4833='ContactItemTypes';return db[_0xe9bd('0x4f')][_0xe9bd('0x4a')]({'where':{'name':_0x3f4833,'userProfileId':_0x34f787[_0xe9bd('0x50')]},'raw':!![]})[_0xe9bd('0x25')](function(_0x194b7d){if(_0x194b7d&&_0x194b7d['autoAssociation']===0x0){return db[_0xe9bd('0x51')]['create']({'name':_0x1ee09c[_0xe9bd('0x2b')],'resourceId':_0x1ee09c['id'],'type':_0x194b7d[_0xe9bd('0x2b')],'sectionId':_0x194b7d['id']},{})['then'](function(){return _0x476f23;});}else{return _0x476f23;}})['catch'](function(_0x1ce539){logger['error'](_0xe9bd('0x52'),_0x1ce539);throw _0x1ce539;});}return _0x476f23;})['then'](respondWithResult(_0x3317d6,0xc9))[_0xe9bd('0x45')](handleError(_0x3317d6,null));};exports[_0xe9bd('0x24')]=function(_0x5496d7,_0x55f619){if(_0x5496d7['body']['id']){delete _0x5496d7[_0xe9bd('0x53')]['id'];}return db[_0xe9bd('0x2f')][_0xe9bd('0x4a')]({'where':{'id':_0x5496d7['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x55f619,null))[_0xe9bd('0x25')](saveUpdates(_0x5496d7[_0xe9bd('0x53')],null))[_0xe9bd('0x25')](respondWithResult(_0x55f619,null))['catch'](handleError(_0x55f619,null));};exports['destroy']=function(_0x441f89,_0x493aae){return db[_0xe9bd('0x2f')][_0xe9bd('0x4a')]({'where':{'id':_0x441f89[_0xe9bd('0x47')]['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x493aae,null))[_0xe9bd('0x25')](removeEntity(_0x493aae,null))[_0xe9bd('0x45')](handleError(_0x493aae,null));}; \ No newline at end of file +var _0x34e8=['then','ContactItemTypes','destroy','sendStatus','error','stack','name','map','ContactItemType','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','options','include','findAll','catch','show','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34e8,0x12c));var _0x834e=function(_0x3be0fa,_0x51f28d){_0x3be0fa=_0x3be0fa-0x0;var _0x198702=_0x34e8[_0x3be0fa];return _0x198702;};'use strict';var pdf=require(_0x834e('0x0'));var emlformat=require(_0x834e('0x1'));var rimraf=require(_0x834e('0x2'));var zipdir=require(_0x834e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834e('0x4'));var moment=require(_0x834e('0x5'));var BPromise=require(_0x834e('0x6'));var Mustache=require(_0x834e('0x7'));var util=require(_0x834e('0x8'));var path=require(_0x834e('0x9'));var sox=require(_0x834e('0xa'));var csv=require('to-csv');var ejs=require(_0x834e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0x10'));var querystring=require(_0x834e('0x11'));var Papa=require(_0x834e('0x12'));var Redis=require(_0x834e('0x13'));var authService=require(_0x834e('0x14'));var qs=require(_0x834e('0x15'));var as=require(_0x834e('0x16'));var hardwareService=require(_0x834e('0x17'));var logger=require(_0x834e('0x18'))(_0x834e('0x19'));var utils=require(_0x834e('0x1a'));var config=require(_0x834e('0x1b'));var db=require(_0x834e('0x1c'))['db'];function respondWithStatusCode(_0x538bb3,_0x5e5b6d){_0x5e5b6d=_0x5e5b6d||0xcc;return function(_0x6cd9b9){if(_0x6cd9b9){return _0x538bb3['sendStatus'](_0x5e5b6d);}return _0x538bb3[_0x834e('0x1d')](_0x5e5b6d)[_0x834e('0x1e')]();};}function respondWithResult(_0x28e659,_0x21cc0a){_0x21cc0a=_0x21cc0a||0xc8;return function(_0x50e860){if(_0x50e860){return _0x28e659[_0x834e('0x1d')](_0x21cc0a)[_0x834e('0x1f')](_0x50e860);}};}function respondWithFilteredResult(_0x57274a,_0x316205){return function(_0x4a9cdc){if(_0x4a9cdc){var _0x38a8cd=_0x4a9cdc[_0x834e('0x20')],_0x36d443=_0x316205[_0x834e('0x21')],_0x478afe=_0x316205['offset']+_0x316205[_0x834e('0x22')],_0x43ac41;if(_0x478afe>=_0x38a8cd){_0x478afe=_0x38a8cd;_0x43ac41=0xc8;}else{_0x43ac41=0xce;}_0x57274a[_0x834e('0x1d')](_0x43ac41);return _0x57274a[_0x834e('0x23')](_0x834e('0x24'),_0x36d443+'-'+_0x478afe+'/'+_0x38a8cd)[_0x834e('0x1f')](_0x4a9cdc);}return null;};}function patchUpdates(_0x254677){return function(_0x1dd214){try{jsonpatch['apply'](_0x1dd214,_0x254677,!![]);}catch(_0x2545b4){return BPromise[_0x834e('0x25')](_0x2545b4);}return _0x1dd214[_0x834e('0x26')]();};}function saveUpdates(_0x325a99,_0x4ab05d){return function(_0x45a630){if(_0x45a630){return _0x45a630[_0x834e('0x27')](_0x325a99)['then'](function(_0x1b4bdf){return _0x1b4bdf;});}return null;};}function removeEntity(_0x28d687,_0x8d406e){return function(_0x5c55ca){if(_0x5c55ca){return _0x5c55ca['destroy']()[_0x834e('0x28')](function(){var _0x34563b=_0x5c55ca['get']({'plain':!![]});var _0x25ee1d=_0x834e('0x29');return db['UserProfileResource'][_0x834e('0x2a')]({'where':{'type':_0x25ee1d,'resourceId':_0x34563b['id']}})[_0x834e('0x28')](function(){return _0x5c55ca;});})[_0x834e('0x28')](function(){_0x28d687['status'](0xcc)[_0x834e('0x1e')]();});}};}function handleEntityNotFound(_0x3e310f,_0x5e1cc5){return function(_0x5bef62){if(!_0x5bef62){_0x3e310f[_0x834e('0x2b')](0x194);}return _0x5bef62;};}function handleError(_0x508a1d,_0x2826ec){_0x2826ec=_0x2826ec||0x1f4;return function(_0x3f1b0b){logger[_0x834e('0x2c')](_0x3f1b0b[_0x834e('0x2d')]);if(_0x3f1b0b[_0x834e('0x2e')]){delete _0x3f1b0b[_0x834e('0x2e')];}_0x508a1d['status'](_0x2826ec)['send'](_0x3f1b0b);};}exports['index']=function(_0x58c1d7,_0x2c7a8d){var _0x567cea={},_0x106d6a={},_0x5dacc1={'count':0x0,'rows':[]};var _0xb5bc06=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x4551f5){return{'name':_0x4551f5[_0x834e('0x32')],'type':_0x4551f5[_0x834e('0x33')][_0x834e('0x34')]};});_0x106d6a[_0x834e('0x35')]=_['map'](_0xb5bc06,_0x834e('0x2e'));_0x106d6a['query']=_[_0x834e('0x36')](_0x58c1d7[_0x834e('0x37')]);_0x106d6a[_0x834e('0x38')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],_0x106d6a[_0x834e('0x37')]);_0x567cea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],qs[_0x834e('0x3b')](_0x58c1d7['query'][_0x834e('0x3b')]));_0x567cea[_0x834e('0x3a')]=_0x567cea[_0x834e('0x3a')][_0x834e('0x3c')]?_0x567cea['attributes']:_0x106d6a[_0x834e('0x35')];if(!_0x58c1d7[_0x834e('0x37')]['hasOwnProperty']('nolimit')){_0x567cea['limit']=qs[_0x834e('0x22')](_0x58c1d7[_0x834e('0x37')][_0x834e('0x22')]);_0x567cea[_0x834e('0x21')]=qs[_0x834e('0x21')](_0x58c1d7[_0x834e('0x37')]['offset']);}_0x567cea[_0x834e('0x3d')]=qs['sort'](_0x58c1d7[_0x834e('0x37')][_0x834e('0x3e')]);_0x567cea['where']=qs[_0x834e('0x38')](_[_0x834e('0x3f')](_0x58c1d7['query'],_0x106d6a['filters']),_0xb5bc06);if(_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]){_0x567cea[_0x834e('0x41')]=_[_0x834e('0x42')](_0x567cea[_0x834e('0x41')],{'$or':_['map'](_0xb5bc06,function(_0x1c5ed6){if(_0x1c5ed6['type']!=='VIRTUAL'){var _0x1b2edf={};_0x1b2edf[_0x1c5ed6['name']]={'$like':'%'+_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]+'%'};return _0x1b2edf;}})});}_0x567cea=_[_0x834e('0x42')]({},_0x567cea,_0x58c1d7[_0x834e('0x43')]);var _0x2b7933={'where':_0x567cea['where']};return db[_0x834e('0x30')][_0x834e('0x20')](_0x2b7933)[_0x834e('0x28')](function(_0x58c5fb){_0x5dacc1[_0x834e('0x20')]=_0x58c5fb;if(_0x58c1d7[_0x834e('0x37')]['includeAll']){_0x567cea[_0x834e('0x44')]=[{'all':!![]}];}return db['ContactItemType'][_0x834e('0x45')](_0x567cea);})[_0x834e('0x28')](function(_0x4a18bb){_0x5dacc1['rows']=_0x4a18bb;return _0x5dacc1;})[_0x834e('0x28')](respondWithFilteredResult(_0x2c7a8d,_0x567cea))[_0x834e('0x46')](handleError(_0x2c7a8d,null));};exports[_0x834e('0x47')]=function(_0xbc1571,_0x8ad264){var _0x23feea={'raw':!![],'where':{'id':_0xbc1571['params']['id']}},_0x195204={};_0x195204[_0x834e('0x35')]=_['keys'](db[_0x834e('0x30')]['rawAttributes']);_0x195204[_0x834e('0x37')]=_['keys'](_0xbc1571[_0x834e('0x37')]);_0x195204[_0x834e('0x38')]=_['intersection'](_0x195204[_0x834e('0x35')],_0x195204[_0x834e('0x37')]);_0x23feea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x195204[_0x834e('0x35')],qs[_0x834e('0x3b')](_0xbc1571[_0x834e('0x37')][_0x834e('0x3b')]));_0x23feea[_0x834e('0x3a')]=_0x23feea[_0x834e('0x3a')]['length']?_0x23feea[_0x834e('0x3a')]:_0x195204[_0x834e('0x35')];if(_0xbc1571['query'][_0x834e('0x48')]){_0x23feea[_0x834e('0x44')]=[{'all':!![]}];}_0x23feea=_[_0x834e('0x42')]({},_0x23feea,_0xbc1571[_0x834e('0x43')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x23feea)['then'](handleEntityNotFound(_0x8ad264,null))['then'](respondWithResult(_0x8ad264,null))[_0x834e('0x46')](handleError(_0x8ad264,null));};exports[_0x834e('0x4a')]=function(_0x30568e,_0x40ff5a){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x30568e[_0x834e('0x4b')],{})[_0x834e('0x28')](function(_0x1419eb){var _0x390c45=_0x30568e[_0x834e('0x4c')][_0x834e('0x4d')]({'plain':!![]});if(!_0x390c45)throw new Error(_0x834e('0x4e'));if(_0x390c45[_0x834e('0x4f')]===_0x834e('0x4c')){var _0x1a3855=_0x1419eb[_0x834e('0x4d')]({'plain':!![]});var _0x32b8f7=_0x834e('0x29');return db[_0x834e('0x50')]['find']({'where':{'name':_0x32b8f7,'userProfileId':_0x390c45[_0x834e('0x51')]},'raw':!![]})[_0x834e('0x28')](function(_0x4e73e0){if(_0x4e73e0&&_0x4e73e0[_0x834e('0x52')]===0x0){return db[_0x834e('0x53')]['create']({'name':_0x1a3855[_0x834e('0x2e')],'resourceId':_0x1a3855['id'],'type':_0x4e73e0[_0x834e('0x2e')],'sectionId':_0x4e73e0['id']},{})[_0x834e('0x28')](function(){return _0x1419eb;});}else{return _0x1419eb;}})[_0x834e('0x46')](function(_0x4288e4){logger[_0x834e('0x2c')](_0x834e('0x54'),_0x4288e4);throw _0x4288e4;});}return _0x1419eb;})['then'](respondWithResult(_0x40ff5a,0xc9))[_0x834e('0x46')](handleError(_0x40ff5a,null));};exports[_0x834e('0x27')]=function(_0x3e0550,_0x363675){if(_0x3e0550[_0x834e('0x4b')]['id']){delete _0x3e0550[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x3e0550['params']['id']}})[_0x834e('0x28')](handleEntityNotFound(_0x363675,null))['then'](saveUpdates(_0x3e0550[_0x834e('0x4b')],null))['then'](respondWithResult(_0x363675,null))[_0x834e('0x46')](handleError(_0x363675,null));};exports['destroy']=function(_0x527eef,_0x6c0b29){return db[_0x834e('0x30')]['find']({'where':{'id':_0x527eef['params']['id']}})[_0x834e('0x28')](handleEntityNotFound(_0x6c0b29,null))[_0x834e('0x28')](removeEntity(_0x6c0b29,null))[_0x834e('0x46')](handleError(_0x6c0b29,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index fc9e57a..360dc36 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 _0x2bd8=['./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x40b13e,_0x2837ab){var _0x3a949a=function(_0x2d1a86){while(--_0x2d1a86){_0x40b13e['push'](_0x40b13e['shift']());}};_0x3a949a(++_0x2837ab);}(_0x2bd8,0x130));var _0x82bd=function(_0x5539a4,_0x4e7999){_0x5539a4=_0x5539a4-0x0;var _0x17b78a=_0x2bd8[_0x5539a4];return _0x17b78a;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var moment=require(_0x82bd('0x3'));var BPromise=require(_0x82bd('0x4'));var rp=require(_0x82bd('0x5'));var fs=require('fs');var path=require(_0x82bd('0x6'));var rimraf=require(_0x82bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bd('0x8'));module[_0x82bd('0x9')]=function(_0x3bf810,_0x5ceb60){return _0x3bf810[_0x82bd('0xa')](_0x82bd('0xb'),attributes,{'tableName':_0x82bd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf69d=['tools_contact_item_types','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType'];(function(_0x14476b,_0xd1a7a4){var _0x24e2e8=function(_0x52ed26){while(--_0x52ed26){_0x14476b['push'](_0x14476b['shift']());}};_0x24e2e8(++_0xd1a7a4);}(_0xf69d,0xd3));var _0xdf69=function(_0x56c3ef,_0x2705b5){_0x56c3ef=_0x56c3ef-0x0;var _0x711eed=_0xf69d[_0x56c3ef];return _0x711eed;};'use strict';var _=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var logger=require(_0xdf69('0x2'))(_0xdf69('0x3'));var moment=require(_0xdf69('0x4'));var BPromise=require('bluebird');var rp=require(_0xdf69('0x5'));var fs=require('fs');var path=require(_0xdf69('0x6'));var rimraf=require(_0xdf69('0x7'));var config=require(_0xdf69('0x8'));var attributes=require(_0xdf69('0x9'));module[_0xdf69('0xa')]=function(_0x2d456f,_0x465b1b){return _0x2d456f[_0xdf69('0xb')](_0xdf69('0xc'),attributes,{'tableName':_0xdf69('0xd'),'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 9c1d821..1a1db22 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 _0x0c6d=['code','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x0c6d,0xf7));var _0xd0c6=function(_0x940f2c,_0x47a25d){_0x940f2c=_0x940f2c-0x0;var _0x2b1a30=_0x0c6d[_0x940f2c];return _0x2b1a30;};'use strict';var _=require('lodash');var util=require(_0xd0c6('0x0'));var moment=require(_0xd0c6('0x1'));var BPromise=require(_0xd0c6('0x2'));var rs=require(_0xd0c6('0x3'));var fs=require('fs');var Redis=require(_0xd0c6('0x4'));var db=require(_0xd0c6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0c6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd0c6('0x7')][_0xd0c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d4a64,_0x5de1cd,_0x16c6da){return new BPromise(function(_0x534412,_0x2a14f1){return client[_0xd0c6('0x9')](_0x2d4a64,_0x16c6da)[_0xd0c6('0xa')](function(_0x184f65){logger[_0xd0c6('0xb')](_0xd0c6('0xc'),_0x5de1cd,_0xd0c6('0xd'));logger[_0xd0c6('0xe')](_0xd0c6('0xf'),_0x5de1cd,'request\x20sent',JSON[_0xd0c6('0x10')](_0x184f65));if(_0x184f65['error']){if(_0x184f65['error'][_0xd0c6('0x11')]===0x1f4){logger[_0xd0c6('0x12')](_0xd0c6('0xc'),_0x5de1cd,_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);return _0x2a14f1(_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);}logger[_0xd0c6('0x12')](_0xd0c6('0xc'),_0x5de1cd,_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);return _0x534412(_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);}else{logger[_0xd0c6('0xb')](_0xd0c6('0xc'),_0x5de1cd,_0xd0c6('0xd'));_0x534412(_0x184f65[_0xd0c6('0x14')][_0xd0c6('0x13')]);}})[_0xd0c6('0x15')](function(_0x19dd14){logger[_0xd0c6('0x12')](_0xd0c6('0xc'),_0x5de1cd,_0x19dd14);_0x2a14f1(_0x19dd14);});});} \ No newline at end of file +var _0x9e9b=['message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','ContactItemType,\x20%s,\x20%s'];(function(_0xe58b80,_0x10dbc8){var _0x78d1b8=function(_0x1cd637){while(--_0x1cd637){_0xe58b80['push'](_0xe58b80['shift']());}};_0x78d1b8(++_0x10dbc8);}(_0x9e9b,0x1a7));var _0xb9e9=function(_0x479650,_0x2bee99){_0x479650=_0x479650-0x0;var _0x26b288=_0x9e9b[_0x479650];return _0x26b288;};'use strict';var _=require(_0xb9e9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb9e9('0x1'));var rs=require(_0xb9e9('0x2'));var fs=require('fs');var Redis=require(_0xb9e9('0x3'));var db=require(_0xb9e9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb9e9('0x5'))(_0xb9e9('0x6'));var config=require('../../config/environment');var jayson=require(_0xb9e9('0x7'));var client=jayson[_0xb9e9('0x8')][_0xb9e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x119d31,_0x3329cf,_0x3e199b){return new BPromise(function(_0x2e9b34,_0x15cb68){return client[_0xb9e9('0xa')](_0x119d31,_0x3e199b)[_0xb9e9('0xb')](function(_0x44ede3){logger[_0xb9e9('0xc')]('ContactItemType,\x20%s,\x20%s',_0x3329cf,_0xb9e9('0xd'));logger[_0xb9e9('0xe')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x3329cf,_0xb9e9('0xd'),JSON[_0xb9e9('0xf')](_0x44ede3));if(_0x44ede3[_0xb9e9('0x10')]){if(_0x44ede3['error']['code']===0x1f4){logger[_0xb9e9('0x10')](_0xb9e9('0x11'),_0x3329cf,_0x44ede3[_0xb9e9('0x10')][_0xb9e9('0x12')]);return _0x15cb68(_0x44ede3[_0xb9e9('0x10')]['message']);}logger['error'](_0xb9e9('0x11'),_0x3329cf,_0x44ede3[_0xb9e9('0x10')]['message']);return _0x2e9b34(_0x44ede3[_0xb9e9('0x10')][_0xb9e9('0x12')]);}else{logger[_0xb9e9('0xc')](_0xb9e9('0x11'),_0x3329cf,'request\x20sent');_0x2e9b34(_0x44ede3[_0xb9e9('0x13')][_0xb9e9('0x12')]);}})[_0xb9e9('0x14')](function(_0x555506){logger[_0xb9e9('0x10')](_0xb9e9('0x11'),_0x3329cf,_0x555506);_0x15cb68(_0x555506);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 19f14af..324e188 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 _0x596b=['index','/:id','create','delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated'];(function(_0x2c2ee,_0x189ad5){var _0x7bf628=function(_0x2319fa){while(--_0x2319fa){_0x2c2ee['push'](_0x2c2ee['shift']());}};_0x7bf628(++_0x189ad5);}(_0x596b,0x1e6));var _0xb596=function(_0x28f4ee,_0x1ff74e){_0x28f4ee=_0x28f4ee-0x0;var _0x5b52d7=_0x596b[_0x28f4ee];return _0x5b52d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb596('0x0'));var timeout=require(_0xb596('0x1'));var express=require(_0xb596('0x2'));var router=express[_0xb596('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb596('0x4'));var config=require(_0xb596('0x5'));var controller=require(_0xb596('0x6'));router[_0xb596('0x7')]('/',auth[_0xb596('0x8')](),controller[_0xb596('0x9')]);router[_0xb596('0x7')](_0xb596('0xa'),auth[_0xb596('0x8')](),controller['show']);router['post']('/',auth[_0xb596('0x8')](),controller[_0xb596('0xb')]);router['put']('/:id',auth[_0xb596('0x8')](),controller['update']);router[_0xb596('0xc')](_0xb596('0xa'),auth['isAuthenticated'](),controller[_0xb596('0xd')]);module[_0xb596('0xe')]=router; \ No newline at end of file +var _0x2df6=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','util','path'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2df6,0x1a0));var _0x62df=function(_0x30f951,_0x3ba029){_0x30f951=_0x30f951-0x0;var _0x17cce0=_0x2df6[_0x30f951];return _0x17cce0;};'use strict';var multer=require('multer');var util=require(_0x62df('0x0'));var path=require(_0x62df('0x1'));var timeout=require(_0x62df('0x2'));var express=require(_0x62df('0x3'));var router=express[_0x62df('0x4')]();var auth=require(_0x62df('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x62df('0x6'));var controller=require(_0x62df('0x7'));router[_0x62df('0x8')]('/',auth[_0x62df('0x9')](),controller[_0x62df('0xa')]);router[_0x62df('0x8')](_0x62df('0xb'),auth['isAuthenticated'](),controller[_0x62df('0xc')]);router[_0x62df('0xd')]('/',auth[_0x62df('0x9')](),controller[_0x62df('0xe')]);router[_0x62df('0xf')](_0x62df('0xb'),auth[_0x62df('0x9')](),controller[_0x62df('0x10')]);router[_0x62df('0x11')](_0x62df('0xb'),auth[_0x62df('0x9')](),controller[_0x62df('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 388ad44..9b8ab17 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 _0x8c32=['sequelize','exports','STRING','name'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8c32,0x130));var _0x28c3=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x8c32[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0x28c3('0x0'));module[_0x28c3('0x1')]={'name':{'type':Sequelize[_0x28c3('0x2')],'allowNull':![],'unique':_0x28c3('0x3')},'description':{'type':Sequelize[_0x28c3('0x2')]}}; \ No newline at end of file +var _0x30bc=['exports','STRING','sequelize'];(function(_0x1faae7,_0x8c251f){var _0xc41f9e=function(_0x355030){while(--_0x355030){_0x1faae7['push'](_0x1faae7['shift']());}};_0xc41f9e(++_0x8c251f);}(_0x30bc,0x149));var _0xc30b=function(_0x2b13f6,_0x25e44c){_0x2b13f6=_0x2b13f6-0x0;var _0x14ea98=_0x30bc[_0x2b13f6];return _0x14ea98;};'use strict';var Sequelize=require(_0xc30b('0x0'));module[_0xc30b('0x1')]={'name':{'type':Sequelize[_0xc30b('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xc30b('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index e669236..b500b2e 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 _0x9fd0=['filter','include','Dashboard','findAll','rows','catch','show','params','filtears','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','userProfileId','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','widgetAttributes:\x20%s','addItem','getItems','findOne','DashboardItem','html-pdf','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','count','limit','set','apply','reject','save','update','then','destroy','get','CustomDashboards','end','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','type','VIRTUAL'];(function(_0x172090,_0x4a1219){var _0x363fb5=function(_0x3924c5){while(--_0x3924c5){_0x172090['push'](_0x172090['shift']());}};_0x363fb5(++_0x4a1219);}(_0x9fd0,0xb0));var _0x09fd=function(_0x31881e,_0x2913b5){_0x31881e=_0x31881e-0x0;var _0x2f5bff=_0x9fd0[_0x31881e];return _0x2f5bff;};'use strict';var pdf=require(_0x09fd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x09fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x09fd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x09fd('0x3'));var Mustache=require(_0x09fd('0x4'));var util=require(_0x09fd('0x5'));var path=require(_0x09fd('0x6'));var sox=require(_0x09fd('0x7'));var csv=require(_0x09fd('0x8'));var ejs=require(_0x09fd('0x9'));var fs=require('fs');var _=require(_0x09fd('0xa'));var squel=require(_0x09fd('0xb'));var crypto=require(_0x09fd('0xc'));var jsforce=require(_0x09fd('0xd'));var deskjs=require(_0x09fd('0xe'));var toCsv=require(_0x09fd('0x8'));var querystring=require(_0x09fd('0xf'));var Papa=require(_0x09fd('0x10'));var Redis=require(_0x09fd('0x11'));var authService=require(_0x09fd('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x09fd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x09fd('0x14'))(_0x09fd('0x15'));var utils=require(_0x09fd('0x16'));var config=require(_0x09fd('0x17'));var licenseUtil=require(_0x09fd('0x18'));var db=require(_0x09fd('0x19'))['db'];config[_0x09fd('0x1a')]=_['defaults'](config[_0x09fd('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x09fd('0x1b'))(new Redis(config['redis']));require(_0x09fd('0x1c'))[_0x09fd('0x1d')](socket);function respondWithStatusCode(_0x914582,_0xa82bae){_0xa82bae=_0xa82bae||0xcc;return function(_0x400e21){if(_0x400e21){return _0x914582[_0x09fd('0x1e')](_0xa82bae);}return _0x914582[_0x09fd('0x1f')](_0xa82bae)['end']();};}function respondWithResult(_0x8762c3,_0x397206){_0x397206=_0x397206||0xc8;return function(_0x8c486a){if(_0x8c486a){return _0x8762c3[_0x09fd('0x1f')](_0x397206)[_0x09fd('0x20')](_0x8c486a);}};}function respondWithFilteredResult(_0x33c045,_0x214ca8){return function(_0x9a1b95){if(_0x9a1b95){var _0x2485ca=_0x9a1b95[_0x09fd('0x21')],_0x54dad3=_0x214ca8['offset'],_0x450b64=_0x214ca8['offset']+_0x214ca8[_0x09fd('0x22')],_0x6e6ec0;if(_0x450b64>=_0x2485ca){_0x450b64=_0x2485ca;_0x6e6ec0=0xc8;}else{_0x6e6ec0=0xce;}_0x33c045[_0x09fd('0x1f')](_0x6e6ec0);return _0x33c045[_0x09fd('0x23')]('Content-Range',_0x54dad3+'-'+_0x450b64+'/'+_0x2485ca)[_0x09fd('0x20')](_0x9a1b95);}return null;};}function patchUpdates(_0x2b6f70){return function(_0x4e619a){try{jsonpatch[_0x09fd('0x24')](_0x4e619a,_0x2b6f70,!![]);}catch(_0x2f2e6a){return BPromise[_0x09fd('0x25')](_0x2f2e6a);}return _0x4e619a[_0x09fd('0x26')]();};}function saveUpdates(_0x344421,_0x2f8cce){return function(_0x2053d4){if(_0x2053d4){return _0x2053d4[_0x09fd('0x27')](_0x344421)[_0x09fd('0x28')](function(_0x13b84a){return _0x13b84a;});}return null;};}function removeEntity(_0x47a8e2,_0x548f70){return function(_0x1c35a2){if(_0x1c35a2){return _0x1c35a2[_0x09fd('0x29')]()[_0x09fd('0x28')](function(){var _0x4631eb=_0x1c35a2[_0x09fd('0x2a')]({'plain':!![]});var _0xd24110=_0x09fd('0x2b');return db['UserProfileResource'][_0x09fd('0x29')]({'where':{'type':_0xd24110,'resourceId':_0x4631eb['id']}})[_0x09fd('0x28')](function(){return _0x1c35a2;});})['then'](function(){_0x47a8e2[_0x09fd('0x1f')](0xcc)[_0x09fd('0x2c')]();});}};}function handleEntityNotFound(_0x2dcd79,_0x3afd06){return function(_0x147506){if(!_0x147506){_0x2dcd79[_0x09fd('0x1e')](0x194);}return _0x147506;};}function handleError(_0x317988,_0x48a8f8){_0x48a8f8=_0x48a8f8||0x1f4;return function(_0x45ff54){logger[_0x09fd('0x2d')](_0x45ff54[_0x09fd('0x2e')]);if(_0x45ff54[_0x09fd('0x2f')]){delete _0x45ff54[_0x09fd('0x2f')];}_0x317988['status'](_0x48a8f8)[_0x09fd('0x30')](_0x45ff54);};}exports[_0x09fd('0x31')]=function(_0x519fda,_0x25992e){var _0x2b69e3={},_0x59dc72={},_0x9fc53d={'count':0x0,'rows':[]};var _0x5c9785=_['map'](db['Dashboard'][_0x09fd('0x32')],function(_0x21b4f6){return{'name':_0x21b4f6[_0x09fd('0x33')],'type':_0x21b4f6['type'][_0x09fd('0x34')]};});_0x59dc72[_0x09fd('0x35')]=_[_0x09fd('0x36')](_0x5c9785,_0x09fd('0x2f'));_0x59dc72[_0x09fd('0x37')]=_[_0x09fd('0x38')](_0x519fda[_0x09fd('0x37')]);_0x59dc72[_0x09fd('0x39')]=_[_0x09fd('0x3a')](_0x59dc72['model'],_0x59dc72[_0x09fd('0x37')]);_0x2b69e3['attributes']=_['intersection'](_0x59dc72[_0x09fd('0x35')],qs[_0x09fd('0x3b')](_0x519fda[_0x09fd('0x37')]['fields']));_0x2b69e3['attributes']=_0x2b69e3[_0x09fd('0x3c')][_0x09fd('0x3d')]?_0x2b69e3['attributes']:_0x59dc72[_0x09fd('0x35')];if(!_0x519fda[_0x09fd('0x37')][_0x09fd('0x3e')](_0x09fd('0x3f'))){_0x2b69e3[_0x09fd('0x22')]=qs[_0x09fd('0x22')](_0x519fda['query'][_0x09fd('0x22')]);_0x2b69e3[_0x09fd('0x40')]=qs[_0x09fd('0x40')](_0x519fda[_0x09fd('0x37')]['offset']);}_0x2b69e3[_0x09fd('0x41')]=qs[_0x09fd('0x42')](_0x519fda[_0x09fd('0x37')][_0x09fd('0x42')]);_0x2b69e3[_0x09fd('0x43')]=qs['filters'](_[_0x09fd('0x44')](_0x519fda[_0x09fd('0x37')],_0x59dc72[_0x09fd('0x39')]),_0x5c9785);if(_0x519fda['query']['filter']){_0x2b69e3['where']=_[_0x09fd('0x45')](_0x2b69e3[_0x09fd('0x43')],{'$or':_[_0x09fd('0x36')](_0x5c9785,function(_0x41ff0b){if(_0x41ff0b[_0x09fd('0x46')]!==_0x09fd('0x47')){var _0x163887={};_0x163887[_0x41ff0b[_0x09fd('0x2f')]]={'$like':'%'+_0x519fda[_0x09fd('0x37')][_0x09fd('0x48')]+'%'};return _0x163887;}})});}_0x2b69e3=_[_0x09fd('0x45')]({},_0x2b69e3,_0x519fda['options']);var _0x13b1a1={'where':_0x2b69e3[_0x09fd('0x43')]};return db['Dashboard'][_0x09fd('0x21')](_0x13b1a1)['then'](function(_0x362842){_0x9fc53d['count']=_0x362842;if(_0x519fda[_0x09fd('0x37')]['includeAll']){_0x2b69e3[_0x09fd('0x49')]=[{'all':!![]}];}return db[_0x09fd('0x4a')][_0x09fd('0x4b')](_0x2b69e3);})['then'](function(_0x44e660){_0x9fc53d[_0x09fd('0x4c')]=_0x44e660;return _0x9fc53d;})[_0x09fd('0x28')](respondWithFilteredResult(_0x25992e,_0x2b69e3))[_0x09fd('0x4d')](handleError(_0x25992e,null));};exports[_0x09fd('0x4e')]=function(_0x27e108,_0x419676){var _0x3038f5={'raw':![],'where':{'id':_0x27e108[_0x09fd('0x4f')]['id']}},_0x58a13b={};_0x58a13b[_0x09fd('0x35')]=_[_0x09fd('0x38')](db[_0x09fd('0x4a')][_0x09fd('0x32')]);_0x58a13b[_0x09fd('0x37')]=_['keys'](_0x27e108[_0x09fd('0x37')]);_0x58a13b[_0x09fd('0x50')]=_[_0x09fd('0x3a')](_0x58a13b[_0x09fd('0x35')],_0x58a13b[_0x09fd('0x37')]);_0x3038f5[_0x09fd('0x3c')]=_[_0x09fd('0x3a')](_0x58a13b[_0x09fd('0x35')],qs[_0x09fd('0x3b')](_0x27e108[_0x09fd('0x37')]['fields']));_0x3038f5[_0x09fd('0x3c')]=_0x3038f5[_0x09fd('0x3c')][_0x09fd('0x3d')]?_0x3038f5[_0x09fd('0x3c')]:_0x58a13b[_0x09fd('0x35')];if(_0x27e108['query'][_0x09fd('0x51')]){_0x3038f5['include']=[{'all':!![]}];}_0x3038f5=_['merge']({},_0x3038f5,_0x27e108[_0x09fd('0x52')]);return db['Dashboard'][_0x09fd('0x53')](_0x3038f5)[_0x09fd('0x28')](handleEntityNotFound(_0x419676,null))[_0x09fd('0x28')](respondWithResult(_0x419676,null))['catch'](handleError(_0x419676,null));};exports['create']=function(_0x27422b,_0xe15bc3){return db[_0x09fd('0x4a')][_0x09fd('0x54')](_0x27422b[_0x09fd('0x55')],{})[_0x09fd('0x28')](function(_0x120940){var _0x2f9845=_0x27422b[_0x09fd('0x56')][_0x09fd('0x2a')]({'plain':!![]});if(!_0x2f9845)throw new Error(_0x09fd('0x57'));if(_0x2f9845[_0x09fd('0x58')]===_0x09fd('0x56')){var _0x52427b=_0x120940[_0x09fd('0x2a')]({'plain':!![]});var _0x524d1d=_0x09fd('0x2b');return db[_0x09fd('0x59')][_0x09fd('0x53')]({'where':{'name':_0x524d1d,'userProfileId':_0x2f9845['userProfileId']},'raw':!![]})[_0x09fd('0x28')](function(_0x5a0a8e){if(_0x5a0a8e&&_0x5a0a8e[_0x09fd('0x5a')]===0x0){return db[_0x09fd('0x5b')][_0x09fd('0x54')]({'name':_0x52427b[_0x09fd('0x2f')],'resourceId':_0x52427b['id'],'type':_0x5a0a8e[_0x09fd('0x2f')],'sectionId':_0x5a0a8e['id']},{})[_0x09fd('0x28')](function(){return _0x120940;});}else{return _0x120940;}})[_0x09fd('0x4d')](function(_0x1fafff){logger[_0x09fd('0x2d')](_0x09fd('0x5c'),_0x1fafff);throw _0x1fafff;});}return _0x120940;})[_0x09fd('0x28')](respondWithResult(_0xe15bc3,0xc9))[_0x09fd('0x4d')](handleError(_0xe15bc3,null));};exports[_0x09fd('0x5d')]=function(_0x34e67f,_0x294013){var _0x4e8fa5={'where':{'id':_0x34e67f[_0x09fd('0x4f')]['id']}},_0x4feff8={};_0x4feff8[_0x09fd('0x35')]=_['keys'](db[_0x09fd('0x4a')][_0x09fd('0x32')]);_0x4e8fa5[_0x09fd('0x3c')]=_[_0x09fd('0x3a')](_0x4feff8[_0x09fd('0x35')],qs['fields'](_0x34e67f[_0x09fd('0x37')][_0x09fd('0x3b')]));_0x4e8fa5[_0x09fd('0x3c')]=_0x4e8fa5['attributes']['length']?_0x4e8fa5['attributes']:_0x4feff8[_0x09fd('0x35')];if(_0x34e67f['query'][_0x09fd('0x51')]){_0x4e8fa5[_0x09fd('0x49')]=[{'all':!![]}];}_0x4e8fa5=_[_0x09fd('0x45')]({},_0x4e8fa5,_0x34e67f[_0x09fd('0x52')]);return db[_0x09fd('0x4a')][_0x09fd('0x53')](_0x4e8fa5)['then'](handleEntityNotFound(_0x294013,null))[_0x09fd('0x28')](function(_0xaf2c0b){if(_0xaf2c0b){var _0x342a31=_0xaf2c0b['get']({'plain':!![]});_0x342a31=qs[_0x09fd('0x5e')](_0x342a31,['id','createdAt',_0x09fd('0x5f')]);_0x34e67f['body']=_['omit'](_0x34e67f['body'],['id',_0x09fd('0x60'),_0x09fd('0x5f')]);return db[_0x09fd('0x4a')][_0x09fd('0x54')](_['merge'](_0x342a31,_0x34e67f[_0x09fd('0x55')]),{'include':_0x34e67f[_0x09fd('0x37')][_0x09fd('0x51')]?[{'all':!![]}]:undefined})[_0x09fd('0x28')](function(_0x7ed3ef){var _0x438c9a=_0x34e67f['user'][_0x09fd('0x2a')]({'plain':!![]});if(!_0x438c9a)throw new Error(_0x09fd('0x57'));if(_0x438c9a[_0x09fd('0x58')]==='user'){var _0x32a586=_0x7ed3ef[_0x09fd('0x2a')]({'plain':!![]});var _0x4c7a23=_0x09fd('0x2b');return db[_0x09fd('0x59')]['find']({'where':{'name':_0x4c7a23,'userProfileId':_0x438c9a[_0x09fd('0x61')]},'raw':!![]})['then'](function(_0x17b7cb){if(_0x17b7cb&&_0x17b7cb[_0x09fd('0x5a')]===0x0){return db[_0x09fd('0x5b')][_0x09fd('0x54')]({'name':_0x32a586[_0x09fd('0x2f')],'resourceId':_0x32a586['id'],'type':_0x17b7cb[_0x09fd('0x2f')],'sectionId':_0x17b7cb['id']},{})[_0x09fd('0x28')](function(){return _0x7ed3ef;});}else{return _0x7ed3ef;}})[_0x09fd('0x4d')](function(_0x209bcb){logger['error'](_0x09fd('0x5c'),_0x209bcb);throw _0x209bcb;});}return _0x7ed3ef;});}})[_0x09fd('0x28')](respondWithResult(_0x294013,0xc9))['catch'](handleError(_0x294013,null));};exports[_0x09fd('0x27')]=function(_0x120977,_0x53a3ea){if(_0x120977[_0x09fd('0x55')]['id']){delete _0x120977[_0x09fd('0x55')]['id'];}return db[_0x09fd('0x4a')]['find']({'where':{'id':_0x120977[_0x09fd('0x4f')]['id']}})[_0x09fd('0x28')](handleEntityNotFound(_0x53a3ea,null))[_0x09fd('0x28')](saveUpdates(_0x120977[_0x09fd('0x55')],null))[_0x09fd('0x28')](respondWithResult(_0x53a3ea,null))[_0x09fd('0x4d')](handleError(_0x53a3ea,null));};exports['destroy']=function(_0x57463f,_0x46e88f){return db['Dashboard'][_0x09fd('0x53')]({'where':{'id':_0x57463f['params']['id']}})['then'](handleEntityNotFound(_0x46e88f,null))[_0x09fd('0x28')](removeEntity(_0x46e88f,null))[_0x09fd('0x4d')](handleError(_0x46e88f,null));};function widgetAttributes(_0x1151db){try{switch(_0x1151db[_0x09fd('0x46')]){case'iframe':return[{'name':'attrUrl','value':_0x1151db[_0x09fd('0x62')]||(_0x1151db[_0x09fd('0x63')]&&_0x1151db['attrs'][0x0]?_0x1151db[_0x09fd('0x63')][0x0]['value']:undefined)||_0x09fd('0x64')}];case _0x09fd('0x65'):return[{'name':_0x09fd('0x66'),'value':_0x1151db[_0x09fd('0x66')]||(_0x1151db[_0x09fd('0x63')]&&_0x1151db['attrs'][0x0]?_0x1151db[_0x09fd('0x63')][0x0][_0x09fd('0x67')]:undefined)||''}];case'clock':return[{'name':_0x09fd('0x68'),'value':_0x1151db['attrHourFormat']||(_0x1151db['attrs']&&_0x1151db[_0x09fd('0x63')][0x0]?_0x1151db[_0x09fd('0x63')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x1151db[_0x09fd('0x69')]||(_0x1151db[_0x09fd('0x63')]&&_0x1151db[_0x09fd('0x63')][0x1]?_0x1151db[_0x09fd('0x63')][0x1][_0x09fd('0x67')]:undefined)||_0x09fd('0x6a')},{'name':_0x09fd('0x6b'),'value':_0x1151db['attrFontSize']||(_0x1151db[_0x09fd('0x63')]&&_0x1151db['attrs'][0x2]?_0x1151db[_0x09fd('0x63')][0x2]['value']:undefined)||0xc}];case _0x09fd('0x6c'):return[{'name':_0x09fd('0x6d'),'value':_0x1151db['attrMetric']||(_0x1151db[_0x09fd('0x63')]&&_0x1151db[_0x09fd('0x63')][0x0]?_0x1151db[_0x09fd('0x63')][0x0][_0x09fd('0x67')]:undefined)||_0x09fd('0x6e')},{'name':_0x09fd('0x6f'),'value':_0x1151db[_0x09fd('0x6f')]||(_0x1151db[_0x09fd('0x63')]&&_0x1151db[_0x09fd('0x63')][0x1]?_0x1151db[_0x09fd('0x63')][0x1]['value']:undefined)||[]},{'name':_0x09fd('0x6b'),'value':_0x1151db[_0x09fd('0x6b')]||(_0x1151db[_0x09fd('0x63')]&&_0x1151db[_0x09fd('0x63')][0x2]?_0x1151db[_0x09fd('0x63')][0x2][_0x09fd('0x67')]:undefined)||0x14}];case _0x09fd('0x70'):case _0x09fd('0x71'):return[{'name':_0x09fd('0x72'),'value':_0x1151db['attrSerie1']||(_0x1151db[_0x09fd('0x63')]&&_0x1151db[_0x09fd('0x63')][0x0]?_0x1151db[_0x09fd('0x63')][0x0][_0x09fd('0x67')]:undefined)||_0x09fd('0x6e')},{'name':_0x09fd('0x73'),'value':_0x1151db[_0x09fd('0x73')]||(_0x1151db[_0x09fd('0x63')]&&_0x1151db[_0x09fd('0x63')][0x1]?_0x1151db[_0x09fd('0x63')][0x1][_0x09fd('0x67')]:undefined)||null},{'name':_0x09fd('0x74'),'value':_0x1151db[_0x09fd('0x74')]||(_0x1151db['attrs']&&_0x1151db[_0x09fd('0x63')][0x2]?_0x1151db[_0x09fd('0x63')][0x2][_0x09fd('0x67')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x1151db['attrVoiceQueues']||(_0x1151db['attrs']&&_0x1151db['attrs'][0x3]?_0x1151db[_0x09fd('0x63')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0x09fd('0x75'),'type':_0x1151db[_0x09fd('0x76')]||(_0x1151db[_0x09fd('0x63')]&&_0x1151db[_0x09fd('0x63')][0x0]?_0x1151db['attrs'][0x0]['type']:undefined)||null,'value':_0x1151db[_0x09fd('0x75')]||(_0x1151db[_0x09fd('0x63')]&&_0x1151db['attrs'][0x0]?_0x1151db[_0x09fd('0x63')][0x0][_0x09fd('0x67')]:undefined)||null},{'name':'attrRefresh','value':_0x1151db['attrRefresh']||(_0x1151db[_0x09fd('0x63')]&&_0x1151db[_0x09fd('0x63')][0x1]?_0x1151db[_0x09fd('0x63')][0x1][_0x09fd('0x67')]:undefined)||0x0}];default:return[];}}catch(_0x4e0936){logger[_0x09fd('0x2d')](_0x09fd('0x77'),JSON['stringify'](_0x4e0936));return[];}}exports[_0x09fd('0x78')]=function(_0x2330b3,_0x393c9a,_0x2bec08){if(_0x2330b3[_0x09fd('0x55')]['id']){delete _0x2330b3[_0x09fd('0x55')]['id'];}return db[_0x09fd('0x4a')]['find']({'where':{'id':_0x2330b3['params']['id']}})[_0x09fd('0x28')](handleEntityNotFound(_0x393c9a,null))[_0x09fd('0x28')](function(_0x228f46){if(_0x228f46){_0x2330b3['body']['DashboardId']=_0x228f46['id'];_0x2330b3[_0x09fd('0x55')][_0x09fd('0x63')]=widgetAttributes(_0x2330b3[_0x09fd('0x55')]);return db['DashboardItem'][_0x09fd('0x54')](_0x2330b3[_0x09fd('0x55')]);}})[_0x09fd('0x28')](respondWithResult(_0x393c9a,null))[_0x09fd('0x4d')](handleError(_0x393c9a,null));};exports[_0x09fd('0x79')]=function(_0x35a0df,_0x5f4458,_0x36834f){var _0xa325f5={};var _0x465b31={};var _0x1f49f1;var _0x301c9c;return db['Dashboard'][_0x09fd('0x7a')]({'where':{'id':_0x35a0df[_0x09fd('0x4f')]['id']}})[_0x09fd('0x28')](handleEntityNotFound(_0x5f4458,null))['then'](function(_0x3bb9b0){if(_0x3bb9b0){_0x1f49f1=_0x3bb9b0;_0x465b31['model']=_['keys'](db[_0x09fd('0x7b')][_0x09fd('0x32')]);_0x465b31[_0x09fd('0x37')]=_[_0x09fd('0x38')](_0x35a0df[_0x09fd('0x37')]);_0x465b31[_0x09fd('0x39')]=_[_0x09fd('0x3a')](_0x465b31['model'],_0x465b31[_0x09fd('0x37')]);_0xa325f5[_0x09fd('0x3c')]=_[_0x09fd('0x3a')](_0x465b31[_0x09fd('0x35')],qs['fields'](_0x35a0df['query'][_0x09fd('0x3b')]));_0xa325f5[_0x09fd('0x3c')]=_0xa325f5[_0x09fd('0x3c')]['length']?_0xa325f5[_0x09fd('0x3c')]:_0x465b31[_0x09fd('0x35')];_0xa325f5[_0x09fd('0x41')]=qs[_0x09fd('0x42')](_0x35a0df[_0x09fd('0x37')][_0x09fd('0x42')]);_0xa325f5['where']=qs['filters'](_[_0x09fd('0x44')](_0x35a0df['query'],_0x465b31[_0x09fd('0x39')]));if(_0x35a0df[_0x09fd('0x37')][_0x09fd('0x48')]){_0xa325f5['where']=_[_0x09fd('0x45')](_0xa325f5[_0x09fd('0x43')],{'$or':_[_0x09fd('0x36')](_0xa325f5[_0x09fd('0x3c')],function(_0x573d8f){var _0x6b9d07={};_0x6b9d07[_0x573d8f]={'$like':'%'+_0x35a0df[_0x09fd('0x37')][_0x09fd('0x48')]+'%'};return _0x6b9d07;})});}_0xa325f5=_[_0x09fd('0x45')]({},_0xa325f5,_0x35a0df[_0x09fd('0x52')]);return _0x1f49f1['getItems'](_0xa325f5);}})['then'](function(_0x799821){if(_0x799821){_0x301c9c=_0x799821[_0x09fd('0x3d')];if(!_0x35a0df[_0x09fd('0x37')]['hasOwnProperty'](_0x09fd('0x3f'))){_0xa325f5[_0x09fd('0x22')]=qs['limit'](_0x35a0df[_0x09fd('0x37')][_0x09fd('0x22')]);_0xa325f5[_0x09fd('0x40')]=qs['offset'](_0x35a0df[_0x09fd('0x37')][_0x09fd('0x40')]);}return _0x1f49f1[_0x09fd('0x79')](_0xa325f5);}})['then'](function(_0x2ca104){if(_0x2ca104){return _0x2ca104?{'count':_0x301c9c,'rows':_0x2ca104}:null;}})['then'](respondWithResult(_0x5f4458,null))['catch'](handleError(_0x5f4458,null));}; \ No newline at end of file +var _0xcbf9=['findAll','rows','params','find','catch','create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','iframe','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./dashboard.socket','register','status','end','offset','limit','set','Content-Range','json','save','update','then','get','CustomDashboards','UserProfileResource','destroy','sendStatus','error','stack','name','index','map','Dashboard','rawAttributes','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','count','includeAll','include'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xcbf9,0x9d));var _0x9cbf=function(_0x362f5e,_0xff295c){_0x362f5e=_0x362f5e-0x0;var _0x56eca3=_0xcbf9[_0x362f5e];return _0x56eca3;};'use strict';var pdf=require(_0x9cbf('0x0'));var emlformat=require(_0x9cbf('0x1'));var rimraf=require(_0x9cbf('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9cbf('0x3'));var rp=require(_0x9cbf('0x4'));var moment=require('moment');var BPromise=require(_0x9cbf('0x5'));var Mustache=require(_0x9cbf('0x6'));var util=require(_0x9cbf('0x7'));var path=require(_0x9cbf('0x8'));var sox=require(_0x9cbf('0x9'));var csv=require(_0x9cbf('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9cbf('0xb'));var squel=require(_0x9cbf('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9cbf('0xd'));var toCsv=require(_0x9cbf('0xa'));var querystring=require(_0x9cbf('0xe'));var Papa=require('papaparse');var Redis=require(_0x9cbf('0xf'));var authService=require(_0x9cbf('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9cbf('0x11'));var hardwareService=require(_0x9cbf('0x12'));var logger=require(_0x9cbf('0x13'))(_0x9cbf('0x14'));var utils=require(_0x9cbf('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9cbf('0x16'))['db'];config[_0x9cbf('0x17')]=_['defaults'](config[_0x9cbf('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x9cbf('0x18'))(new Redis(config['redis']));require(_0x9cbf('0x19'))[_0x9cbf('0x1a')](socket);function respondWithStatusCode(_0x21c4f,_0x29a99a){_0x29a99a=_0x29a99a||0xcc;return function(_0x2edd79){if(_0x2edd79){return _0x21c4f['sendStatus'](_0x29a99a);}return _0x21c4f[_0x9cbf('0x1b')](_0x29a99a)[_0x9cbf('0x1c')]();};}function respondWithResult(_0x301e57,_0x2141ba){_0x2141ba=_0x2141ba||0xc8;return function(_0x37edb7){if(_0x37edb7){return _0x301e57['status'](_0x2141ba)['json'](_0x37edb7);}};}function respondWithFilteredResult(_0xb44fe3,_0x280667){return function(_0x4d4307){if(_0x4d4307){var _0x1c89af=_0x4d4307['count'],_0x92b82e=_0x280667[_0x9cbf('0x1d')],_0x228966=_0x280667['offset']+_0x280667[_0x9cbf('0x1e')],_0x58bc19;if(_0x228966>=_0x1c89af){_0x228966=_0x1c89af;_0x58bc19=0xc8;}else{_0x58bc19=0xce;}_0xb44fe3['status'](_0x58bc19);return _0xb44fe3[_0x9cbf('0x1f')](_0x9cbf('0x20'),_0x92b82e+'-'+_0x228966+'/'+_0x1c89af)[_0x9cbf('0x21')](_0x4d4307);}return null;};}function patchUpdates(_0x48d6b5){return function(_0x520456){try{jsonpatch['apply'](_0x520456,_0x48d6b5,!![]);}catch(_0x29bcdb){return BPromise['reject'](_0x29bcdb);}return _0x520456[_0x9cbf('0x22')]();};}function saveUpdates(_0x42cb71,_0x14abcc){return function(_0x222394){if(_0x222394){return _0x222394[_0x9cbf('0x23')](_0x42cb71)[_0x9cbf('0x24')](function(_0x120263){return _0x120263;});}return null;};}function removeEntity(_0x10f94f,_0x20941a){return function(_0x44f8bd){if(_0x44f8bd){return _0x44f8bd['destroy']()[_0x9cbf('0x24')](function(){var _0x30b584=_0x44f8bd[_0x9cbf('0x25')]({'plain':!![]});var _0x44fd0a=_0x9cbf('0x26');return db[_0x9cbf('0x27')][_0x9cbf('0x28')]({'where':{'type':_0x44fd0a,'resourceId':_0x30b584['id']}})[_0x9cbf('0x24')](function(){return _0x44f8bd;});})[_0x9cbf('0x24')](function(){_0x10f94f[_0x9cbf('0x1b')](0xcc)[_0x9cbf('0x1c')]();});}};}function handleEntityNotFound(_0x1f6fae,_0x14c45b){return function(_0x369edd){if(!_0x369edd){_0x1f6fae[_0x9cbf('0x29')](0x194);}return _0x369edd;};}function handleError(_0x66f57b,_0x28a8c0){_0x28a8c0=_0x28a8c0||0x1f4;return function(_0x38e638){logger[_0x9cbf('0x2a')](_0x38e638[_0x9cbf('0x2b')]);if(_0x38e638[_0x9cbf('0x2c')]){delete _0x38e638[_0x9cbf('0x2c')];}_0x66f57b['status'](_0x28a8c0)['send'](_0x38e638);};}exports[_0x9cbf('0x2d')]=function(_0x13ce1a,_0x145819){var _0x5be420={},_0x7394c0={},_0x358b5e={'count':0x0,'rows':[]};var _0x3a0ce2=_[_0x9cbf('0x2e')](db[_0x9cbf('0x2f')][_0x9cbf('0x30')],function(_0x3d2d32){return{'name':_0x3d2d32['fieldName'],'type':_0x3d2d32['type'][_0x9cbf('0x31')]};});_0x7394c0[_0x9cbf('0x32')]=_['map'](_0x3a0ce2,_0x9cbf('0x2c'));_0x7394c0['query']=_[_0x9cbf('0x33')](_0x13ce1a[_0x9cbf('0x34')]);_0x7394c0['filters']=_[_0x9cbf('0x35')](_0x7394c0[_0x9cbf('0x32')],_0x7394c0[_0x9cbf('0x34')]);_0x5be420[_0x9cbf('0x36')]=_[_0x9cbf('0x35')](_0x7394c0[_0x9cbf('0x32')],qs[_0x9cbf('0x37')](_0x13ce1a[_0x9cbf('0x34')][_0x9cbf('0x37')]));_0x5be420[_0x9cbf('0x36')]=_0x5be420[_0x9cbf('0x36')][_0x9cbf('0x38')]?_0x5be420[_0x9cbf('0x36')]:_0x7394c0[_0x9cbf('0x32')];if(!_0x13ce1a[_0x9cbf('0x34')][_0x9cbf('0x39')](_0x9cbf('0x3a'))){_0x5be420['limit']=qs[_0x9cbf('0x1e')](_0x13ce1a[_0x9cbf('0x34')][_0x9cbf('0x1e')]);_0x5be420[_0x9cbf('0x1d')]=qs['offset'](_0x13ce1a[_0x9cbf('0x34')][_0x9cbf('0x1d')]);}_0x5be420[_0x9cbf('0x3b')]=qs[_0x9cbf('0x3c')](_0x13ce1a[_0x9cbf('0x34')][_0x9cbf('0x3c')]);_0x5be420[_0x9cbf('0x3d')]=qs[_0x9cbf('0x3e')](_[_0x9cbf('0x3f')](_0x13ce1a[_0x9cbf('0x34')],_0x7394c0[_0x9cbf('0x3e')]),_0x3a0ce2);if(_0x13ce1a['query'][_0x9cbf('0x40')]){_0x5be420[_0x9cbf('0x3d')]=_[_0x9cbf('0x41')](_0x5be420['where'],{'$or':_[_0x9cbf('0x2e')](_0x3a0ce2,function(_0x195e5a){if(_0x195e5a[_0x9cbf('0x42')]!=='VIRTUAL'){var _0xf3145e={};_0xf3145e[_0x195e5a['name']]={'$like':'%'+_0x13ce1a[_0x9cbf('0x34')]['filter']+'%'};return _0xf3145e;}})});}_0x5be420=_[_0x9cbf('0x41')]({},_0x5be420,_0x13ce1a[_0x9cbf('0x43')]);var _0xe3ad1e={'where':_0x5be420[_0x9cbf('0x3d')]};return db[_0x9cbf('0x2f')][_0x9cbf('0x44')](_0xe3ad1e)[_0x9cbf('0x24')](function(_0x7d3c98){_0x358b5e[_0x9cbf('0x44')]=_0x7d3c98;if(_0x13ce1a[_0x9cbf('0x34')][_0x9cbf('0x45')]){_0x5be420[_0x9cbf('0x46')]=[{'all':!![]}];}return db['Dashboard'][_0x9cbf('0x47')](_0x5be420);})['then'](function(_0xc29c1c){_0x358b5e[_0x9cbf('0x48')]=_0xc29c1c;return _0x358b5e;})[_0x9cbf('0x24')](respondWithFilteredResult(_0x145819,_0x5be420))['catch'](handleError(_0x145819,null));};exports['show']=function(_0x378156,_0x5f22ef){var _0x4adf5c={'raw':![],'where':{'id':_0x378156[_0x9cbf('0x49')]['id']}},_0x4ea697={};_0x4ea697[_0x9cbf('0x32')]=_[_0x9cbf('0x33')](db[_0x9cbf('0x2f')][_0x9cbf('0x30')]);_0x4ea697[_0x9cbf('0x34')]=_[_0x9cbf('0x33')](_0x378156[_0x9cbf('0x34')]);_0x4ea697['filtears']=_[_0x9cbf('0x35')](_0x4ea697[_0x9cbf('0x32')],_0x4ea697['query']);_0x4adf5c[_0x9cbf('0x36')]=_[_0x9cbf('0x35')](_0x4ea697[_0x9cbf('0x32')],qs['fields'](_0x378156['query'][_0x9cbf('0x37')]));_0x4adf5c[_0x9cbf('0x36')]=_0x4adf5c[_0x9cbf('0x36')]['length']?_0x4adf5c[_0x9cbf('0x36')]:_0x4ea697[_0x9cbf('0x32')];if(_0x378156[_0x9cbf('0x34')]['includeAll']){_0x4adf5c[_0x9cbf('0x46')]=[{'all':!![]}];}_0x4adf5c=_[_0x9cbf('0x41')]({},_0x4adf5c,_0x378156[_0x9cbf('0x43')]);return db[_0x9cbf('0x2f')][_0x9cbf('0x4a')](_0x4adf5c)[_0x9cbf('0x24')](handleEntityNotFound(_0x5f22ef,null))[_0x9cbf('0x24')](respondWithResult(_0x5f22ef,null))[_0x9cbf('0x4b')](handleError(_0x5f22ef,null));};exports[_0x9cbf('0x4c')]=function(_0x4da1b1,_0x5c786a){return db[_0x9cbf('0x2f')][_0x9cbf('0x4c')](_0x4da1b1[_0x9cbf('0x4d')],{})[_0x9cbf('0x24')](function(_0x3d3392){var _0x1f86eb=_0x4da1b1[_0x9cbf('0x4e')][_0x9cbf('0x25')]({'plain':!![]});if(!_0x1f86eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f86eb['role']==='user'){var _0x484083=_0x3d3392[_0x9cbf('0x25')]({'plain':!![]});var _0x170bd2='CustomDashboards';return db[_0x9cbf('0x4f')][_0x9cbf('0x4a')]({'where':{'name':_0x170bd2,'userProfileId':_0x1f86eb[_0x9cbf('0x50')]},'raw':!![]})[_0x9cbf('0x24')](function(_0x278c26){if(_0x278c26&&_0x278c26['autoAssociation']===0x0){return db[_0x9cbf('0x27')][_0x9cbf('0x4c')]({'name':_0x484083['name'],'resourceId':_0x484083['id'],'type':_0x278c26['name'],'sectionId':_0x278c26['id']},{})[_0x9cbf('0x24')](function(){return _0x3d3392;});}else{return _0x3d3392;}})[_0x9cbf('0x4b')](function(_0x1d68ba){logger['error'](_0x9cbf('0x51'),_0x1d68ba);throw _0x1d68ba;});}return _0x3d3392;})['then'](respondWithResult(_0x5c786a,0xc9))[_0x9cbf('0x4b')](handleError(_0x5c786a,null));};exports[_0x9cbf('0x52')]=function(_0x5872a1,_0x46ca94){var _0x3e83d4={'where':{'id':_0x5872a1[_0x9cbf('0x49')]['id']}},_0x2b7cb9={};_0x2b7cb9[_0x9cbf('0x32')]=_[_0x9cbf('0x33')](db[_0x9cbf('0x2f')][_0x9cbf('0x30')]);_0x3e83d4[_0x9cbf('0x36')]=_['intersection'](_0x2b7cb9['model'],qs['fields'](_0x5872a1[_0x9cbf('0x34')]['fields']));_0x3e83d4[_0x9cbf('0x36')]=_0x3e83d4[_0x9cbf('0x36')][_0x9cbf('0x38')]?_0x3e83d4['attributes']:_0x2b7cb9['model'];if(_0x5872a1['query'][_0x9cbf('0x45')]){_0x3e83d4[_0x9cbf('0x46')]=[{'all':!![]}];}_0x3e83d4=_['merge']({},_0x3e83d4,_0x5872a1[_0x9cbf('0x43')]);return db[_0x9cbf('0x2f')][_0x9cbf('0x4a')](_0x3e83d4)[_0x9cbf('0x24')](handleEntityNotFound(_0x46ca94,null))[_0x9cbf('0x24')](function(_0x53c918){if(_0x53c918){var _0x4fb6a8=_0x53c918['get']({'plain':!![]});_0x4fb6a8=qs[_0x9cbf('0x53')](_0x4fb6a8,['id',_0x9cbf('0x54'),_0x9cbf('0x55')]);_0x5872a1[_0x9cbf('0x4d')]=_[_0x9cbf('0x53')](_0x5872a1['body'],['id',_0x9cbf('0x54'),_0x9cbf('0x55')]);return db[_0x9cbf('0x2f')][_0x9cbf('0x4c')](_['merge'](_0x4fb6a8,_0x5872a1[_0x9cbf('0x4d')]),{'include':_0x5872a1['query'][_0x9cbf('0x45')]?[{'all':!![]}]:undefined})[_0x9cbf('0x24')](function(_0x428c13){var _0x5d1ad4=_0x5872a1['user'][_0x9cbf('0x25')]({'plain':!![]});if(!_0x5d1ad4)throw new Error(_0x9cbf('0x56'));if(_0x5d1ad4['role']===_0x9cbf('0x4e')){var _0x29e1c1=_0x428c13[_0x9cbf('0x25')]({'plain':!![]});var _0x1492dc=_0x9cbf('0x26');return db['UserProfileSection'][_0x9cbf('0x4a')]({'where':{'name':_0x1492dc,'userProfileId':_0x5d1ad4[_0x9cbf('0x50')]},'raw':!![]})[_0x9cbf('0x24')](function(_0x206390){if(_0x206390&&_0x206390[_0x9cbf('0x57')]===0x0){return db[_0x9cbf('0x27')][_0x9cbf('0x4c')]({'name':_0x29e1c1[_0x9cbf('0x2c')],'resourceId':_0x29e1c1['id'],'type':_0x206390[_0x9cbf('0x2c')],'sectionId':_0x206390['id']},{})['then'](function(){return _0x428c13;});}else{return _0x428c13;}})[_0x9cbf('0x4b')](function(_0x111c1e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x111c1e);throw _0x111c1e;});}return _0x428c13;});}})[_0x9cbf('0x24')](respondWithResult(_0x46ca94,0xc9))[_0x9cbf('0x4b')](handleError(_0x46ca94,null));};exports['update']=function(_0x255edb,_0x16061f){if(_0x255edb['body']['id']){delete _0x255edb['body']['id'];}return db[_0x9cbf('0x2f')][_0x9cbf('0x4a')]({'where':{'id':_0x255edb[_0x9cbf('0x49')]['id']}})[_0x9cbf('0x24')](handleEntityNotFound(_0x16061f,null))[_0x9cbf('0x24')](saveUpdates(_0x255edb[_0x9cbf('0x4d')],null))[_0x9cbf('0x24')](respondWithResult(_0x16061f,null))[_0x9cbf('0x4b')](handleError(_0x16061f,null));};exports[_0x9cbf('0x28')]=function(_0x4f2e43,_0x359586){return db[_0x9cbf('0x2f')]['find']({'where':{'id':_0x4f2e43['params']['id']}})['then'](handleEntityNotFound(_0x359586,null))[_0x9cbf('0x24')](removeEntity(_0x359586,null))[_0x9cbf('0x4b')](handleError(_0x359586,null));};function widgetAttributes(_0x212e39){try{switch(_0x212e39[_0x9cbf('0x42')]){case _0x9cbf('0x58'):return[{'name':'attrUrl','value':_0x212e39['attrUrl']||(_0x212e39['attrs']&&_0x212e39[_0x9cbf('0x59')][0x0]?_0x212e39[_0x9cbf('0x59')][0x0][_0x9cbf('0x5a')]:undefined)||_0x9cbf('0x5b')}];case'custom':return[{'name':_0x9cbf('0x5c'),'value':_0x212e39['attrPath']||(_0x212e39[_0x9cbf('0x59')]&&_0x212e39[_0x9cbf('0x59')][0x0]?_0x212e39['attrs'][0x0][_0x9cbf('0x5a')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x212e39[_0x9cbf('0x5d')]||(_0x212e39[_0x9cbf('0x59')]&&_0x212e39[_0x9cbf('0x59')][0x0]?_0x212e39[_0x9cbf('0x59')][0x0][_0x9cbf('0x5a')]:undefined)||_0x9cbf('0x5e')},{'name':_0x9cbf('0x5f'),'value':_0x212e39[_0x9cbf('0x5f')]||(_0x212e39['attrs']&&_0x212e39[_0x9cbf('0x59')][0x1]?_0x212e39[_0x9cbf('0x59')][0x1][_0x9cbf('0x5a')]:undefined)||_0x9cbf('0x60')},{'name':_0x9cbf('0x61'),'value':_0x212e39[_0x9cbf('0x61')]||(_0x212e39[_0x9cbf('0x59')]&&_0x212e39[_0x9cbf('0x59')][0x2]?_0x212e39[_0x9cbf('0x59')][0x2]['value']:undefined)||0xc}];case _0x9cbf('0x62'):return[{'name':_0x9cbf('0x63'),'value':_0x212e39[_0x9cbf('0x63')]||(_0x212e39[_0x9cbf('0x59')]&&_0x212e39[_0x9cbf('0x59')][0x0]?_0x212e39[_0x9cbf('0x59')][0x0][_0x9cbf('0x5a')]:undefined)||_0x9cbf('0x64')},{'name':_0x9cbf('0x65'),'value':_0x212e39['attrVoiceQueues']||(_0x212e39[_0x9cbf('0x59')]&&_0x212e39[_0x9cbf('0x59')][0x1]?_0x212e39[_0x9cbf('0x59')][0x1][_0x9cbf('0x5a')]:undefined)||[]},{'name':_0x9cbf('0x61'),'value':_0x212e39[_0x9cbf('0x61')]||(_0x212e39['attrs']&&_0x212e39[_0x9cbf('0x59')][0x2]?_0x212e39[_0x9cbf('0x59')][0x2][_0x9cbf('0x5a')]:undefined)||0x14}];case _0x9cbf('0x66'):case _0x9cbf('0x67'):return[{'name':_0x9cbf('0x68'),'value':_0x212e39[_0x9cbf('0x68')]||(_0x212e39[_0x9cbf('0x59')]&&_0x212e39[_0x9cbf('0x59')][0x0]?_0x212e39[_0x9cbf('0x59')][0x0][_0x9cbf('0x5a')]:undefined)||_0x9cbf('0x64')},{'name':_0x9cbf('0x69'),'value':_0x212e39['attrSerie2']||(_0x212e39[_0x9cbf('0x59')]&&_0x212e39['attrs'][0x1]?_0x212e39[_0x9cbf('0x59')][0x1]['value']:undefined)||null},{'name':_0x9cbf('0x6a'),'value':_0x212e39['attrSerie3']||(_0x212e39[_0x9cbf('0x59')]&&_0x212e39[_0x9cbf('0x59')][0x2]?_0x212e39[_0x9cbf('0x59')][0x2][_0x9cbf('0x5a')]:undefined)||null},{'name':_0x9cbf('0x65'),'value':_0x212e39[_0x9cbf('0x65')]||(_0x212e39[_0x9cbf('0x59')]&&_0x212e39[_0x9cbf('0x59')][0x3]?_0x212e39[_0x9cbf('0x59')][0x3][_0x9cbf('0x5a')]:undefined)||[]}];case'web-report':return[{'name':_0x9cbf('0x6b'),'type':_0x212e39['reportType']||(_0x212e39['attrs']&&_0x212e39[_0x9cbf('0x59')][0x0]?_0x212e39['attrs'][0x0][_0x9cbf('0x42')]:undefined)||null,'value':_0x212e39['attrReport']||(_0x212e39[_0x9cbf('0x59')]&&_0x212e39[_0x9cbf('0x59')][0x0]?_0x212e39[_0x9cbf('0x59')][0x0][_0x9cbf('0x5a')]:undefined)||null},{'name':_0x9cbf('0x6c'),'value':_0x212e39[_0x9cbf('0x6c')]||(_0x212e39['attrs']&&_0x212e39[_0x9cbf('0x59')][0x1]?_0x212e39['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x5b0a47){logger[_0x9cbf('0x2a')](_0x9cbf('0x6d'),JSON['stringify'](_0x5b0a47));return[];}}exports[_0x9cbf('0x6e')]=function(_0x203a1d,_0x473078,_0x16184b){if(_0x203a1d[_0x9cbf('0x4d')]['id']){delete _0x203a1d[_0x9cbf('0x4d')]['id'];}return db[_0x9cbf('0x2f')]['find']({'where':{'id':_0x203a1d[_0x9cbf('0x49')]['id']}})[_0x9cbf('0x24')](handleEntityNotFound(_0x473078,null))['then'](function(_0x3d9656){if(_0x3d9656){_0x203a1d[_0x9cbf('0x4d')][_0x9cbf('0x6f')]=_0x3d9656['id'];_0x203a1d[_0x9cbf('0x4d')][_0x9cbf('0x59')]=widgetAttributes(_0x203a1d[_0x9cbf('0x4d')]);return db[_0x9cbf('0x70')][_0x9cbf('0x4c')](_0x203a1d['body']);}})[_0x9cbf('0x24')](respondWithResult(_0x473078,null))[_0x9cbf('0x4b')](handleError(_0x473078,null));};exports[_0x9cbf('0x71')]=function(_0x1c608d,_0x1c293f,_0x2d4e1c){var _0x56071a={};var _0x87265={};var _0x176345;var _0x239b6a;return db[_0x9cbf('0x2f')]['findOne']({'where':{'id':_0x1c608d[_0x9cbf('0x49')]['id']}})['then'](handleEntityNotFound(_0x1c293f,null))[_0x9cbf('0x24')](function(_0x553a63){if(_0x553a63){_0x176345=_0x553a63;_0x87265[_0x9cbf('0x32')]=_[_0x9cbf('0x33')](db[_0x9cbf('0x70')][_0x9cbf('0x30')]);_0x87265[_0x9cbf('0x34')]=_[_0x9cbf('0x33')](_0x1c608d[_0x9cbf('0x34')]);_0x87265[_0x9cbf('0x3e')]=_[_0x9cbf('0x35')](_0x87265[_0x9cbf('0x32')],_0x87265[_0x9cbf('0x34')]);_0x56071a[_0x9cbf('0x36')]=_['intersection'](_0x87265['model'],qs[_0x9cbf('0x37')](_0x1c608d[_0x9cbf('0x34')]['fields']));_0x56071a[_0x9cbf('0x36')]=_0x56071a[_0x9cbf('0x36')]['length']?_0x56071a[_0x9cbf('0x36')]:_0x87265[_0x9cbf('0x32')];_0x56071a[_0x9cbf('0x3b')]=qs[_0x9cbf('0x3c')](_0x1c608d[_0x9cbf('0x34')]['sort']);_0x56071a['where']=qs[_0x9cbf('0x3e')](_[_0x9cbf('0x3f')](_0x1c608d[_0x9cbf('0x34')],_0x87265[_0x9cbf('0x3e')]));if(_0x1c608d['query']['filter']){_0x56071a[_0x9cbf('0x3d')]=_[_0x9cbf('0x41')](_0x56071a['where'],{'$or':_[_0x9cbf('0x2e')](_0x56071a[_0x9cbf('0x36')],function(_0x2246bc){var _0x5322cc={};_0x5322cc[_0x2246bc]={'$like':'%'+_0x1c608d[_0x9cbf('0x34')][_0x9cbf('0x40')]+'%'};return _0x5322cc;})});}_0x56071a=_['merge']({},_0x56071a,_0x1c608d[_0x9cbf('0x43')]);return _0x176345[_0x9cbf('0x71')](_0x56071a);}})['then'](function(_0x172b1b){if(_0x172b1b){_0x239b6a=_0x172b1b[_0x9cbf('0x38')];if(!_0x1c608d[_0x9cbf('0x34')][_0x9cbf('0x39')](_0x9cbf('0x3a'))){_0x56071a[_0x9cbf('0x1e')]=qs[_0x9cbf('0x1e')](_0x1c608d[_0x9cbf('0x34')][_0x9cbf('0x1e')]);_0x56071a[_0x9cbf('0x1d')]=qs[_0x9cbf('0x1d')](_0x1c608d['query'][_0x9cbf('0x1d')]);}return _0x176345[_0x9cbf('0x71')](_0x56071a);}})[_0x9cbf('0x24')](function(_0x98c791){if(_0x98c791){return _0x98c791?{'count':_0x239b6a,'rows':_0x98c791}:null;}})[_0x9cbf('0x24')](respondWithResult(_0x1c293f,null))[_0x9cbf('0x4b')](handleError(_0x1c293f,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 7a0c0e3..e1a97bf 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 _0x0860=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard'];(function(_0x1610a2,_0x5e7e91){var _0x3a632d=function(_0xad4867){while(--_0xad4867){_0x1610a2['push'](_0x1610a2['shift']());}};_0x3a632d(++_0x5e7e91);}(_0x0860,0xe4));var _0x0086=function(_0xa31016,_0x292ade){_0xa31016=_0xa31016-0x0;var _0x5dab72=_0x0860[_0xa31016];return _0x5dab72;};'use strict';var EventEmitter=require(_0x0086('0x0'));var Dashboard=require(_0x0086('0x1'))['db'][_0x0086('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x0086('0x3')](0x0);var events={'afterCreate':_0x0086('0x4'),'afterUpdate':_0x0086('0x5'),'afterDestroy':_0x0086('0x6')};function emitEvent(_0x5b5238){return function(_0x2ad692,_0x485525,_0x3ab7ec){DashboardEvents[_0x0086('0x7')](_0x5b5238+':'+_0x2ad692['id'],_0x2ad692);DashboardEvents[_0x0086('0x7')](_0x5b5238,_0x2ad692);_0x3ab7ec(null);};}for(var e in events){if(events[_0x0086('0x8')](e)){var event=events[e];Dashboard[_0x0086('0x9')](e,emitEvent(event));}}module[_0x0086('0xa')]=DashboardEvents; \ No newline at end of file +var _0x76a3=['Dashboard','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x28f07d,_0x33b560){var _0x42cf43=function(_0x2db9c9){while(--_0x2db9c9){_0x28f07d['push'](_0x28f07d['shift']());}};_0x42cf43(++_0x33b560);}(_0x76a3,0x80));var _0x376a=function(_0x2fd69d,_0xeb1037){_0x2fd69d=_0x2fd69d-0x0;var _0x5d5ef3=_0x76a3[_0x2fd69d];return _0x5d5ef3;};'use strict';var EventEmitter=require(_0x376a('0x0'));var Dashboard=require(_0x376a('0x1'))['db'][_0x376a('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x376a('0x3')](0x0);var events={'afterCreate':_0x376a('0x4'),'afterUpdate':_0x376a('0x5'),'afterDestroy':_0x376a('0x6')};function emitEvent(_0x4f27d4){return function(_0x4b4ec6,_0xb255a,_0x1b2b5f){DashboardEvents[_0x376a('0x7')](_0x4f27d4+':'+_0x4b4ec6['id'],_0x4b4ec6);DashboardEvents[_0x376a('0x7')](_0x4f27d4,_0x4b4ec6);_0x1b2b5f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x376a('0x8')](e,emitEvent(event));}}module[_0x376a('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index ba5da18..b449635 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 _0x4c0c=['lodash','../../config/logger','api','path','../../config/environment','./dashboard.attributes','define'];(function(_0x532954,_0x4bbf12){var _0x52698e=function(_0x24a3b9){while(--_0x24a3b9){_0x532954['push'](_0x532954['shift']());}};_0x52698e(++_0x4bbf12);}(_0x4c0c,0xe0));var _0xc4c0=function(_0x21b2f1,_0x3365c5){_0x21b2f1=_0x21b2f1-0x0;var _0x56f7cf=_0x4c0c[_0x21b2f1];return _0x56f7cf;};'use strict';var _=require(_0xc4c0('0x0'));var util=require('util');var logger=require(_0xc4c0('0x1'))(_0xc4c0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4c0('0x3'));var rimraf=require('rimraf');var config=require(_0xc4c0('0x4'));var attributes=require(_0xc4c0('0x5'));module['exports']=function(_0x22f04d,_0x581846){return _0x22f04d[_0xc4c0('0x6')]('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7c8=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','define','Dashboard','dashboards','lodash'];(function(_0x307025,_0x18d760){var _0x1e126a=function(_0x7f867a){while(--_0x7f867a){_0x307025['push'](_0x307025['shift']());}};_0x1e126a(++_0x18d760);}(_0xf7c8,0xb5));var _0x8f7c=function(_0x44d081,_0xa868bb){_0x44d081=_0x44d081-0x0;var _0x305c9d=_0xf7c8[_0x44d081];return _0x305c9d;};'use strict';var _=require(_0x8f7c('0x0'));var util=require(_0x8f7c('0x1'));var logger=require(_0x8f7c('0x2'))(_0x8f7c('0x3'));var moment=require(_0x8f7c('0x4'));var BPromise=require(_0x8f7c('0x5'));var rp=require(_0x8f7c('0x6'));var fs=require('fs');var path=require(_0x8f7c('0x7'));var rimraf=require('rimraf');var config=require(_0x8f7c('0x8'));var attributes=require(_0x8f7c('0x9'));module['exports']=function(_0x3d6a94,_0x4677d9){return _0x3d6a94[_0x8f7c('0xa')](_0x8f7c('0xb'),attributes,{'tableName':_0x8f7c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 2dec620..4a21c8c 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 _0x737d=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','code','Dashboard,\x20%s,\x20%s','message','result','lodash','util','../../mysqldb','../../config/logger'];(function(_0x41e3e7,_0x253246){var _0x40f52b=function(_0x25ffc3){while(--_0x25ffc3){_0x41e3e7['push'](_0x41e3e7['shift']());}};_0x40f52b(++_0x253246);}(_0x737d,0xbc));var _0xd737=function(_0x51c95b,_0x232e1b){_0x51c95b=_0x51c95b-0x0;var _0x175a8e=_0x737d[_0x51c95b];return _0x175a8e;};'use strict';var _=require(_0xd737('0x0'));var util=require(_0xd737('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd737('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xd737('0x3'))('rpc');var config=require(_0xd737('0x4'));var jayson=require(_0xd737('0x5'));var client=jayson[_0xd737('0x6')][_0xd737('0x7')]({'port':0x232a});config[_0xd737('0x8')]=_[_0xd737('0x9')](config[_0xd737('0x8')],{'host':_0xd737('0xa'),'port':0x18eb});var socket=require(_0xd737('0xb'))(new Redis(config[_0xd737('0x8')]));require('./dashboard.socket')[_0xd737('0xc')](socket);function respondWithRpcPromise(_0xb243eb,_0x51a15d,_0x1c604d){return new BPromise(function(_0x42afa9,_0x4f8018){return client[_0xd737('0xd')](_0xb243eb,_0x1c604d)[_0xd737('0xe')](function(_0x578842){logger[_0xd737('0xf')]('Dashboard,\x20%s,\x20%s',_0x51a15d,_0xd737('0x10'));logger[_0xd737('0x11')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x51a15d,'request\x20sent',JSON[_0xd737('0x12')](_0x578842));if(_0x578842[_0xd737('0x13')]){if(_0x578842['error'][_0xd737('0x14')]===0x1f4){logger[_0xd737('0x13')](_0xd737('0x15'),_0x51a15d,_0x578842[_0xd737('0x13')][_0xd737('0x16')]);return _0x4f8018(_0x578842[_0xd737('0x13')][_0xd737('0x16')]);}logger[_0xd737('0x13')]('Dashboard,\x20%s,\x20%s',_0x51a15d,_0x578842['error'][_0xd737('0x16')]);return _0x42afa9(_0x578842[_0xd737('0x13')][_0xd737('0x16')]);}else{logger[_0xd737('0xf')](_0xd737('0x15'),_0x51a15d,_0xd737('0x10'));_0x42afa9(_0x578842[_0xd737('0x17')][_0xd737('0x16')]);}})['catch'](function(_0x5901da){logger[_0xd737('0x13')]('Dashboard,\x20%s,\x20%s',_0x51a15d,_0x5901da);_0x4f8018(_0x5901da);});});} \ No newline at end of file +var _0x5da0=['Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','Dashboard,\x20%s,\x20%s'];(function(_0x3de0b3,_0x12fd64){var _0x4fdb4c=function(_0x60d59f){while(--_0x60d59f){_0x3de0b3['push'](_0x3de0b3['shift']());}};_0x4fdb4c(++_0x12fd64);}(_0x5da0,0x1be));var _0x05da=function(_0x5ace7e,_0x11faca){_0x5ace7e=_0x5ace7e-0x0;var _0x141e37=_0x5da0[_0x5ace7e];return _0x141e37;};'use strict';var _=require(_0x05da('0x0'));var util=require('util');var moment=require(_0x05da('0x1'));var BPromise=require(_0x05da('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05da('0x3'))['db'];var utils=require(_0x05da('0x4'));var logger=require(_0x05da('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x05da('0x6'));var client=jayson[_0x05da('0x7')][_0x05da('0x8')]({'port':0x232a});config['redis']=_[_0x05da('0x9')](config[_0x05da('0xa')],{'host':_0x05da('0xb'),'port':0x18eb});var socket=require(_0x05da('0xc'))(new Redis(config[_0x05da('0xa')]));require(_0x05da('0xd'))[_0x05da('0xe')](socket);function respondWithRpcPromise(_0x3f7208,_0x2c28bf,_0x490f0d){return new BPromise(function(_0x340081,_0x1be248){return client['request'](_0x3f7208,_0x490f0d)['then'](function(_0x12cb78){logger['info'](_0x05da('0xf'),_0x2c28bf,'request\x20sent');logger['debug'](_0x05da('0x10'),_0x2c28bf,_0x05da('0x11'),JSON['stringify'](_0x12cb78));if(_0x12cb78[_0x05da('0x12')]){if(_0x12cb78[_0x05da('0x12')]['code']===0x1f4){logger[_0x05da('0x12')]('Dashboard,\x20%s,\x20%s',_0x2c28bf,_0x12cb78[_0x05da('0x12')][_0x05da('0x13')]);return _0x1be248(_0x12cb78[_0x05da('0x12')][_0x05da('0x13')]);}logger['error'](_0x05da('0xf'),_0x2c28bf,_0x12cb78[_0x05da('0x12')]['message']);return _0x340081(_0x12cb78['error'][_0x05da('0x13')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x2c28bf,_0x05da('0x11'));_0x340081(_0x12cb78[_0x05da('0x14')][_0x05da('0x13')]);}})[_0x05da('0x15')](function(_0x4686d4){logger[_0x05da('0x12')](_0x05da('0xf'),_0x2c28bf,_0x4686d4);_0x1be248(_0x4686d4);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 1ab2fe6..9dfdaf9 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 _0x777b=['./dashboard.events','save','update','emit','removeListener','register','dashboard:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x777b,0x15e));var _0xb777=function(_0x4b71a6,_0x1cf46f){_0x4b71a6=_0x4b71a6-0x0;var _0x40482c=_0x777b[_0x4b71a6];return _0x40482c;};'use strict';var DashboardEvents=require(_0xb777('0x0'));var events=[_0xb777('0x1'),'remove',_0xb777('0x2')];function createListener(_0x1707a5,_0x2400d9){return function(_0x258d24){_0x2400d9[_0xb777('0x3')](_0x1707a5,_0x258d24);};}function removeListener(_0x4ea170,_0x2e8825){return function(){DashboardEvents[_0xb777('0x4')](_0x4ea170,_0x2e8825);};}exports[_0xb777('0x5')]=function(_0x3871da){for(var _0x490a68=0x0,_0x4bb0e9=events['length'];_0x490a68<_0x4bb0e9;_0x490a68++){var _0x5ac911=events[_0x490a68];var _0xbeda68=createListener(_0xb777('0x6')+_0x5ac911,_0x3871da);DashboardEvents['on'](_0x5ac911,_0xbeda68);}}; \ No newline at end of file +var _0xc6cd=['dashboard:','./dashboard.events','emit','removeListener','register','length'];(function(_0x262900,_0xe03fa){var _0x2113f9=function(_0x346a9b){while(--_0x346a9b){_0x262900['push'](_0x262900['shift']());}};_0x2113f9(++_0xe03fa);}(_0xc6cd,0x6d));var _0xdc6c=function(_0x520608,_0x24e56f){_0x520608=_0x520608-0x0;var _0x4f9a86=_0xc6cd[_0x520608];return _0x4f9a86;};'use strict';var DashboardEvents=require(_0xdc6c('0x0'));var events=['save','remove','update'];function createListener(_0x336d35,_0x277cff){return function(_0x5a956a){_0x277cff[_0xdc6c('0x1')](_0x336d35,_0x5a956a);};}function removeListener(_0x123137,_0x21c73b){return function(){DashboardEvents[_0xdc6c('0x2')](_0x123137,_0x21c73b);};}exports[_0xdc6c('0x3')]=function(_0x8c2c4a){for(var _0x10875f=0x0,_0x17727a=events[_0xdc6c('0x4')];_0x10875f<_0x17727a;_0x10875f++){var _0x35c415=events[_0x10875f];var _0x1b4735=createListener(_0xdc6c('0x5')+_0x35c415,_0x8c2c4a);DashboardEvents['on'](_0x35c415,_0x1b4735);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index ac7bfe3..dffcf66 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 _0xd8b0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','index','get','/:id','show','isAuthenticated','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','Router'];(function(_0x589f71,_0x212326){var _0x5763bd=function(_0x2cb8e1){while(--_0x2cb8e1){_0x589f71['push'](_0x589f71['shift']());}};_0x5763bd(++_0x212326);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xd')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller['clone']);router[_0x0d8b('0xd')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);module[_0x0d8b('0x15')]=router; \ No newline at end of file +var _0x70e0=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','/:id/items','isAuthenticated','getItems','post','/:id/clone','clone','addItem','put','/:id','update','multer'];(function(_0x352ed0,_0x2b7ced){var _0x20debc=function(_0x50c2cc){while(--_0x50c2cc){_0x352ed0['push'](_0x352ed0['shift']());}};_0x20debc(++_0x2b7ced);}(_0x70e0,0x17b));var _0x070e=function(_0x4cce81,_0x252735){_0x4cce81=_0x4cce81-0x0;var _0xad14bc=_0x70e0[_0x4cce81];return _0xad14bc;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./dashboard.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth[_0x070e('0xb')](),controller['create']);router['post'](_0x070e('0xe'),auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0xd')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0x12'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);router['delete']('/:id',auth[_0x070e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 1c77b4e..1dfad70 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 _0x92cb=['lodash','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','INTEGER','#2196f3','sequelize','squel'];(function(_0x219d87,_0x1cb6f7){var _0x22823d=function(_0x5357bf){while(--_0x5357bf){_0x219d87['push'](_0x219d87['shift']());}};_0x22823d(++_0x1cb6f7);}(_0x92cb,0xe2));var _0xb92c=function(_0x4ab34e,_0x129847){_0x4ab34e=_0x4ab34e-0x0;var _0x5e3ef4=_0x92cb[_0x4ab34e];return _0x5e3ef4;};'use strict';var Sequelize=require(_0xb92c('0x0'));var squel=require(_0xb92c('0x1'));var _=require(_0xb92c('0x2'));module['exports']={'title':{'type':Sequelize[_0xb92c('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb92c('0x4')](_0xb92c('0x5')),'get':function(){try{return JSON[_0xb92c('0x6')](this[_0xb92c('0x7')](_0xb92c('0x8')));}catch(_0x255049){return[];}},'set':function(_0x224551){try{this[_0xb92c('0x9')](_0xb92c('0x8'),JSON['stringify'](_0x224551));}catch(_0x502287){this['setDataValue'](_0xb92c('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xb92c('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb92c('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb92c('0xa')]},'col':{'type':Sequelize[_0xb92c('0xa')]},'background':{'type':Sequelize[_0xb92c('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb92c('0x3')],'allowNull':![],'defaultValue':_0xb92c('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb92c('0x3')]}}; \ No newline at end of file +var _0x114f=['INTEGER','#ffffff','sequelize','squel','lodash','STRING','long','getDataValue','attrs','setDataValue','stringify'];(function(_0x222d6b,_0x4a77cf){var _0x2d6bc6=function(_0x54419e){while(--_0x54419e){_0x222d6b['push'](_0x222d6b['shift']());}};_0x2d6bc6(++_0x4a77cf);}(_0x114f,0x1af));var _0xf114=function(_0x30182f,_0x30ce41){_0x30182f=_0x30182f-0x0;var _0x5207db=_0x114f[_0x30182f];return _0x5207db;};'use strict';var Sequelize=require(_0xf114('0x0'));var squel=require(_0xf114('0x1'));var _=require(_0xf114('0x2'));module['exports']={'title':{'type':Sequelize[_0xf114('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xf114('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xf114('0x4')),'get':function(){try{return JSON['parse'](this[_0xf114('0x5')](_0xf114('0x6')));}catch(_0x4993cf){return[];}},'set':function(_0x566731){try{this[_0xf114('0x7')](_0xf114('0x6'),JSON[_0xf114('0x8')](_0x566731));}catch(_0x4db8c4){this['setDataValue'](_0xf114('0x6'),JSON[_0xf114('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xf114('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xf114('0x9')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xf114('0x3')],'allowNull':![],'defaultValue':_0xf114('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xf114('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xf114('0x3')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 9ba9bab..e5d5a8f 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 _0xca8a=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','show','params','model','keys','query','intersection','attributes','fields','include','merge','options','DashboardItem','find','catch','type','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','squel','desk.js','papaparse','../../components/auth/service'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xca8a,0x1a6));var _0xaca8=function(_0x12b1ee,_0x4e2af8){_0x12b1ee=_0x12b1ee-0x0;var _0x222b82=_0xca8a[_0x12b1ee];return _0x222b82;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaca8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaca8('0x1'));var jsonpatch=require(_0xaca8('0x2'));var rp=require(_0xaca8('0x3'));var moment=require(_0xaca8('0x4'));var BPromise=require(_0xaca8('0x5'));var Mustache=require(_0xaca8('0x6'));var util=require('util');var path=require(_0xaca8('0x7'));var sox=require('sox');var csv=require(_0xaca8('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xaca8('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaca8('0xa'));var toCsv=require(_0xaca8('0x8'));var querystring=require('querystring');var Papa=require(_0xaca8('0xb'));var Redis=require('ioredis');var authService=require(_0xaca8('0xc'));var qs=require(_0xaca8('0xd'));var as=require(_0xaca8('0xe'));var hardwareService=require(_0xaca8('0xf'));var logger=require(_0xaca8('0x10'))('api');var utils=require(_0xaca8('0x11'));var config=require(_0xaca8('0x12'));var licenseUtil=require(_0xaca8('0x13'));var db=require(_0xaca8('0x14'))['db'];config['redis']=_[_0xaca8('0x15')](config[_0xaca8('0x16')],{'host':_0xaca8('0x17'),'port':0x18eb});var socket=require(_0xaca8('0x18'))(new Redis(config['redis']));require(_0xaca8('0x19'))[_0xaca8('0x1a')](socket);function respondWithStatusCode(_0x1ce660,_0x4432ea){_0x4432ea=_0x4432ea||0xcc;return function(_0x35c600){if(_0x35c600){return _0x1ce660[_0xaca8('0x1b')](_0x4432ea);}return _0x1ce660[_0xaca8('0x1c')](_0x4432ea)[_0xaca8('0x1d')]();};}function respondWithResult(_0xef467c,_0x23b328){_0x23b328=_0x23b328||0xc8;return function(_0x21d40e){if(_0x21d40e){return _0xef467c[_0xaca8('0x1c')](_0x23b328)[_0xaca8('0x1e')](_0x21d40e);}};}function respondWithFilteredResult(_0x9b78ea,_0x5b25ee){return function(_0x50a36e){if(_0x50a36e){var _0x4dfed0=_0x50a36e[_0xaca8('0x1f')],_0xcb573a=_0x5b25ee[_0xaca8('0x20')],_0xcfd325=_0x5b25ee[_0xaca8('0x20')]+_0x5b25ee[_0xaca8('0x21')],_0x2a125c;if(_0xcfd325>=_0x4dfed0){_0xcfd325=_0x4dfed0;_0x2a125c=0xc8;}else{_0x2a125c=0xce;}_0x9b78ea[_0xaca8('0x1c')](_0x2a125c);return _0x9b78ea[_0xaca8('0x22')](_0xaca8('0x23'),_0xcb573a+'-'+_0xcfd325+'/'+_0x4dfed0)['json'](_0x50a36e);}return null;};}function patchUpdates(_0xd1661e){return function(_0x9e169){try{jsonpatch[_0xaca8('0x24')](_0x9e169,_0xd1661e,!![]);}catch(_0x5edeed){return BPromise[_0xaca8('0x25')](_0x5edeed);}return _0x9e169[_0xaca8('0x26')]();};}function saveUpdates(_0x13cae4,_0x3bb780){return function(_0x1e2b7c){if(_0x1e2b7c){return _0x1e2b7c[_0xaca8('0x27')](_0x13cae4)[_0xaca8('0x28')](function(_0x415811){return _0x415811;});}return null;};}function removeEntity(_0x2827dc,_0x521ccc){return function(_0x470f11){if(_0x470f11){return _0x470f11[_0xaca8('0x29')]()[_0xaca8('0x28')](function(){_0x2827dc[_0xaca8('0x1c')](0xcc)[_0xaca8('0x1d')]();});}};}function handleEntityNotFound(_0x4ddffd,_0x5f3483){return function(_0x4acef3){if(!_0x4acef3){_0x4ddffd[_0xaca8('0x1b')](0x194);}return _0x4acef3;};}function handleError(_0x214614,_0x42bde6){_0x42bde6=_0x42bde6||0x1f4;return function(_0x57923e){logger[_0xaca8('0x2a')](_0x57923e[_0xaca8('0x2b')]);if(_0x57923e[_0xaca8('0x2c')]){delete _0x57923e[_0xaca8('0x2c')];}_0x214614[_0xaca8('0x1c')](_0x42bde6)['send'](_0x57923e);};}exports[_0xaca8('0x2d')]=function(_0xaff0f2,_0x3045c1){var _0x4ede13={'raw':![],'where':{'id':_0xaff0f2[_0xaca8('0x2e')]['id']}},_0x2ab47a={};_0x2ab47a[_0xaca8('0x2f')]=_[_0xaca8('0x30')](db['DashboardItem']['rawAttributes']);_0x2ab47a['query']=_[_0xaca8('0x30')](_0xaff0f2[_0xaca8('0x31')]);_0x2ab47a['filtears']=_[_0xaca8('0x32')](_0x2ab47a[_0xaca8('0x2f')],_0x2ab47a[_0xaca8('0x31')]);_0x4ede13[_0xaca8('0x33')]=_[_0xaca8('0x32')](_0x2ab47a[_0xaca8('0x2f')],qs[_0xaca8('0x34')](_0xaff0f2[_0xaca8('0x31')][_0xaca8('0x34')]));_0x4ede13['attributes']=_0x4ede13[_0xaca8('0x33')]['length']?_0x4ede13[_0xaca8('0x33')]:_0x2ab47a[_0xaca8('0x2f')];if(_0xaff0f2[_0xaca8('0x31')]['includeAll']){_0x4ede13[_0xaca8('0x35')]=[{'all':!![]}];}_0x4ede13=_[_0xaca8('0x36')]({},_0x4ede13,_0xaff0f2[_0xaca8('0x37')]);return db[_0xaca8('0x38')][_0xaca8('0x39')](_0x4ede13)['then'](handleEntityNotFound(_0x3045c1,null))['then'](respondWithResult(_0x3045c1,null))[_0xaca8('0x3a')](handleError(_0x3045c1,null));};exports[_0xaca8('0x29')]=function(_0x5308d4,_0x3637de){return db[_0xaca8('0x38')][_0xaca8('0x39')]({'where':{'id':_0x5308d4[_0xaca8('0x2e')]['id']}})[_0xaca8('0x28')](handleEntityNotFound(_0x3637de,null))['then'](removeEntity(_0x3637de,null))[_0xaca8('0x3a')](handleError(_0x3637de,null));};function widgetAttributes(_0x40732f){try{switch(_0x40732f[_0xaca8('0x3b')]){case'iframe':return[{'name':_0xaca8('0x3c'),'value':_0x40732f[_0xaca8('0x3c')]||(_0x40732f[_0xaca8('0x3d')]&&_0x40732f[_0xaca8('0x3d')][0x0]?_0x40732f[_0xaca8('0x3d')][0x0]['value']:undefined)||_0xaca8('0x3e')}];case _0xaca8('0x3f'):return[{'name':_0xaca8('0x40'),'value':_0x40732f[_0xaca8('0x40')]||(_0x40732f['attrs']&&_0x40732f[_0xaca8('0x3d')][0x0]?_0x40732f[_0xaca8('0x3d')][0x0][_0xaca8('0x41')]:undefined)||''}];case _0xaca8('0x42'):return[{'name':_0xaca8('0x43'),'value':_0x40732f[_0xaca8('0x43')]||(_0x40732f[_0xaca8('0x3d')]&&_0x40732f[_0xaca8('0x3d')][0x0]?_0x40732f['attrs'][0x0][_0xaca8('0x41')]:undefined)||'HH:mm:ss'},{'name':_0xaca8('0x44'),'value':_0x40732f['attrTimezone']||(_0x40732f['attrs']&&_0x40732f[_0xaca8('0x3d')][0x1]?_0x40732f[_0xaca8('0x3d')][0x1][_0xaca8('0x41')]:undefined)||_0xaca8('0x45')},{'name':_0xaca8('0x46'),'value':_0x40732f[_0xaca8('0x46')]||(_0x40732f[_0xaca8('0x3d')]&&_0x40732f['attrs'][0x2]?_0x40732f['attrs'][0x2][_0xaca8('0x41')]:undefined)||0xc}];case _0xaca8('0x47'):return[{'name':_0xaca8('0x48'),'value':_0x40732f[_0xaca8('0x48')]||(_0x40732f['attrs']&&_0x40732f[_0xaca8('0x3d')][0x0]?_0x40732f['attrs'][0x0][_0xaca8('0x41')]:undefined)||_0xaca8('0x49')},{'name':_0xaca8('0x4a'),'value':_0x40732f['attrVoiceQueues']||(_0x40732f[_0xaca8('0x3d')]&&_0x40732f[_0xaca8('0x3d')][0x1]?_0x40732f['attrs'][0x1][_0xaca8('0x41')]:undefined)||[]},{'name':_0xaca8('0x46'),'value':_0x40732f[_0xaca8('0x46')]||(_0x40732f[_0xaca8('0x3d')]&&_0x40732f[_0xaca8('0x3d')][0x2]?_0x40732f[_0xaca8('0x3d')][0x2]['value']:undefined)||0x14}];case _0xaca8('0x4b'):case _0xaca8('0x4c'):return[{'name':_0xaca8('0x4d'),'value':_0x40732f[_0xaca8('0x4d')]||(_0x40732f[_0xaca8('0x3d')]&&_0x40732f['attrs'][0x0]?_0x40732f['attrs'][0x0]['value']:undefined)||_0xaca8('0x49')},{'name':'attrSerie2','value':_0x40732f[_0xaca8('0x4e')]||(_0x40732f[_0xaca8('0x3d')]&&_0x40732f[_0xaca8('0x3d')][0x1]?_0x40732f[_0xaca8('0x3d')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x40732f[_0xaca8('0x4f')]||(_0x40732f[_0xaca8('0x3d')]&&_0x40732f[_0xaca8('0x3d')][0x2]?_0x40732f['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x40732f[_0xaca8('0x4a')]||(_0x40732f[_0xaca8('0x3d')]&&_0x40732f[_0xaca8('0x3d')][0x3]?_0x40732f[_0xaca8('0x3d')][0x3][_0xaca8('0x41')]:undefined)||[]}];case _0xaca8('0x50'):return[{'name':'attrReport','type':_0x40732f[_0xaca8('0x51')]||(_0x40732f[_0xaca8('0x3d')]&&_0x40732f[_0xaca8('0x3d')][0x0]?_0x40732f[_0xaca8('0x3d')][0x0][_0xaca8('0x3b')]:undefined)||null,'value':_0x40732f['attrReport']||(_0x40732f[_0xaca8('0x3d')]&&_0x40732f['attrs'][0x0]?_0x40732f[_0xaca8('0x3d')][0x0][_0xaca8('0x41')]:undefined)||null},{'name':_0xaca8('0x52'),'value':_0x40732f[_0xaca8('0x52')]||(_0x40732f[_0xaca8('0x3d')]&&_0x40732f[_0xaca8('0x3d')][0x1]?_0x40732f[_0xaca8('0x3d')][0x1][_0xaca8('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x739c9){logger['error'](_0xaca8('0x53'),JSON[_0xaca8('0x54')](_0x739c9));return[];}}exports['create']=function(_0x44e15c,_0x2a6744){if(_0x44e15c[_0xaca8('0x55')]){_0x44e15c[_0xaca8('0x55')]['attrs']=widgetAttributes(_0x44e15c[_0xaca8('0x55')]);}return db[_0xaca8('0x38')][_0xaca8('0x56')](_0x44e15c[_0xaca8('0x55')],{})['then'](respondWithResult(_0x2a6744,0xc9))[_0xaca8('0x3a')](handleError(_0x2a6744,null));};exports[_0xaca8('0x27')]=function(_0x3ea18b,_0x58d645){if(_0x3ea18b[_0xaca8('0x55')]['id']){delete _0x3ea18b[_0xaca8('0x55')]['id'];}_0x3ea18b[_0xaca8('0x55')]['attrs']=widgetAttributes(_0x3ea18b[_0xaca8('0x55')]);return db[_0xaca8('0x38')][_0xaca8('0x39')]({'where':{'id':_0x3ea18b[_0xaca8('0x2e')]['id']}})[_0xaca8('0x28')](handleEntityNotFound(_0x58d645,null))['then'](saveUpdates(_0x3ea18b['body'],null))[_0xaca8('0x28')](respondWithResult(_0x58d645,null))[_0xaca8('0x3a')](handleError(_0x58d645,null));}; \ No newline at end of file +var _0x9a59=['attrRefresh','widgetAttributes:\x20%s','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filtears','intersection','attributes','fields','includeAll','include','options','find','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','reportType','attrReport'];(function(_0x295627,_0x48231d){var _0x35ef9c=function(_0x376ee3){while(--_0x376ee3){_0x295627['push'](_0x295627['shift']());}};_0x35ef9c(++_0x48231d);}(_0x9a59,0x178));var _0x99a5=function(_0x27df6c,_0x430833){_0x27df6c=_0x27df6c-0x0;var _0x1e30ef=_0x9a59[_0x27df6c];return _0x1e30ef;};'use strict';var pdf=require(_0x99a5('0x0'));var emlformat=require(_0x99a5('0x1'));var rimraf=require(_0x99a5('0x2'));var zipdir=require(_0x99a5('0x3'));var jsonpatch=require(_0x99a5('0x4'));var rp=require(_0x99a5('0x5'));var moment=require(_0x99a5('0x6'));var BPromise=require(_0x99a5('0x7'));var Mustache=require(_0x99a5('0x8'));var util=require(_0x99a5('0x9'));var path=require(_0x99a5('0xa'));var sox=require('sox');var csv=require(_0x99a5('0xb'));var ejs=require(_0x99a5('0xc'));var fs=require('fs');var _=require(_0x99a5('0xd'));var squel=require(_0x99a5('0xe'));var crypto=require(_0x99a5('0xf'));var jsforce=require(_0x99a5('0x10'));var deskjs=require(_0x99a5('0x11'));var toCsv=require('to-csv');var querystring=require(_0x99a5('0x12'));var Papa=require(_0x99a5('0x13'));var Redis=require(_0x99a5('0x14'));var authService=require(_0x99a5('0x15'));var qs=require(_0x99a5('0x16'));var as=require(_0x99a5('0x17'));var hardwareService=require(_0x99a5('0x18'));var logger=require(_0x99a5('0x19'))(_0x99a5('0x1a'));var utils=require('../../config/utils');var config=require(_0x99a5('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x99a5('0x1c'))['db'];config[_0x99a5('0x1d')]=_[_0x99a5('0x1e')](config[_0x99a5('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x99a5('0x1f'))(new Redis(config['redis']));require(_0x99a5('0x20'))[_0x99a5('0x21')](socket);function respondWithStatusCode(_0x45f2db,_0x3ba08a){_0x3ba08a=_0x3ba08a||0xcc;return function(_0x2814dc){if(_0x2814dc){return _0x45f2db['sendStatus'](_0x3ba08a);}return _0x45f2db[_0x99a5('0x22')](_0x3ba08a)[_0x99a5('0x23')]();};}function respondWithResult(_0x2ad356,_0x7dd67d){_0x7dd67d=_0x7dd67d||0xc8;return function(_0x437b2b){if(_0x437b2b){return _0x2ad356[_0x99a5('0x22')](_0x7dd67d)[_0x99a5('0x24')](_0x437b2b);}};}function respondWithFilteredResult(_0x98ffa8,_0x19aeb3){return function(_0x46b0ac){if(_0x46b0ac){var _0x1ae36e=_0x46b0ac[_0x99a5('0x25')],_0x8f70bd=_0x19aeb3[_0x99a5('0x26')],_0x24dd36=_0x19aeb3['offset']+_0x19aeb3[_0x99a5('0x27')],_0x32806c;if(_0x24dd36>=_0x1ae36e){_0x24dd36=_0x1ae36e;_0x32806c=0xc8;}else{_0x32806c=0xce;}_0x98ffa8[_0x99a5('0x22')](_0x32806c);return _0x98ffa8[_0x99a5('0x28')](_0x99a5('0x29'),_0x8f70bd+'-'+_0x24dd36+'/'+_0x1ae36e)[_0x99a5('0x24')](_0x46b0ac);}return null;};}function patchUpdates(_0x10b65c){return function(_0x4d1225){try{jsonpatch[_0x99a5('0x2a')](_0x4d1225,_0x10b65c,!![]);}catch(_0x928041){return BPromise['reject'](_0x928041);}return _0x4d1225['save']();};}function saveUpdates(_0x3df7e1,_0x293873){return function(_0x61f23e){if(_0x61f23e){return _0x61f23e[_0x99a5('0x2b')](_0x3df7e1)[_0x99a5('0x2c')](function(_0x5a7242){return _0x5a7242;});}return null;};}function removeEntity(_0x3a9b03,_0x5b84ef){return function(_0x5456ac){if(_0x5456ac){return _0x5456ac[_0x99a5('0x2d')]()[_0x99a5('0x2c')](function(){_0x3a9b03[_0x99a5('0x22')](0xcc)[_0x99a5('0x23')]();});}};}function handleEntityNotFound(_0x37cf98,_0x1b9ed3){return function(_0x249077){if(!_0x249077){_0x37cf98['sendStatus'](0x194);}return _0x249077;};}function handleError(_0x93b514,_0x1725e6){_0x1725e6=_0x1725e6||0x1f4;return function(_0x5ce334){logger[_0x99a5('0x2e')](_0x5ce334[_0x99a5('0x2f')]);if(_0x5ce334[_0x99a5('0x30')]){delete _0x5ce334[_0x99a5('0x30')];}_0x93b514[_0x99a5('0x22')](_0x1725e6)[_0x99a5('0x31')](_0x5ce334);};}exports[_0x99a5('0x32')]=function(_0x102560,_0x539d69){var _0x514669={'raw':![],'where':{'id':_0x102560[_0x99a5('0x33')]['id']}},_0x517956={};_0x517956[_0x99a5('0x34')]=_[_0x99a5('0x35')](db[_0x99a5('0x36')][_0x99a5('0x37')]);_0x517956[_0x99a5('0x38')]=_[_0x99a5('0x35')](_0x102560[_0x99a5('0x38')]);_0x517956[_0x99a5('0x39')]=_[_0x99a5('0x3a')](_0x517956[_0x99a5('0x34')],_0x517956[_0x99a5('0x38')]);_0x514669[_0x99a5('0x3b')]=_[_0x99a5('0x3a')](_0x517956[_0x99a5('0x34')],qs[_0x99a5('0x3c')](_0x102560[_0x99a5('0x38')][_0x99a5('0x3c')]));_0x514669['attributes']=_0x514669[_0x99a5('0x3b')]['length']?_0x514669[_0x99a5('0x3b')]:_0x517956[_0x99a5('0x34')];if(_0x102560[_0x99a5('0x38')][_0x99a5('0x3d')]){_0x514669[_0x99a5('0x3e')]=[{'all':!![]}];}_0x514669=_['merge']({},_0x514669,_0x102560[_0x99a5('0x3f')]);return db[_0x99a5('0x36')][_0x99a5('0x40')](_0x514669)['then'](handleEntityNotFound(_0x539d69,null))[_0x99a5('0x2c')](respondWithResult(_0x539d69,null))[_0x99a5('0x41')](handleError(_0x539d69,null));};exports[_0x99a5('0x2d')]=function(_0x1b45bb,_0x4b0297){return db[_0x99a5('0x36')]['find']({'where':{'id':_0x1b45bb[_0x99a5('0x33')]['id']}})[_0x99a5('0x2c')](handleEntityNotFound(_0x4b0297,null))[_0x99a5('0x2c')](removeEntity(_0x4b0297,null))[_0x99a5('0x41')](handleError(_0x4b0297,null));};function widgetAttributes(_0x5f2e36){try{switch(_0x5f2e36[_0x99a5('0x42')]){case _0x99a5('0x43'):return[{'name':_0x99a5('0x44'),'value':_0x5f2e36[_0x99a5('0x44')]||(_0x5f2e36['attrs']&&_0x5f2e36[_0x99a5('0x45')][0x0]?_0x5f2e36[_0x99a5('0x45')][0x0][_0x99a5('0x46')]:undefined)||'https://'}];case _0x99a5('0x47'):return[{'name':_0x99a5('0x48'),'value':_0x5f2e36['attrPath']||(_0x5f2e36[_0x99a5('0x45')]&&_0x5f2e36[_0x99a5('0x45')][0x0]?_0x5f2e36[_0x99a5('0x45')][0x0]['value']:undefined)||''}];case _0x99a5('0x49'):return[{'name':_0x99a5('0x4a'),'value':_0x5f2e36['attrHourFormat']||(_0x5f2e36[_0x99a5('0x45')]&&_0x5f2e36[_0x99a5('0x45')][0x0]?_0x5f2e36[_0x99a5('0x45')][0x0][_0x99a5('0x46')]:undefined)||'HH:mm:ss'},{'name':_0x99a5('0x4b'),'value':_0x5f2e36[_0x99a5('0x4b')]||(_0x5f2e36[_0x99a5('0x45')]&&_0x5f2e36[_0x99a5('0x45')][0x1]?_0x5f2e36['attrs'][0x1][_0x99a5('0x46')]:undefined)||_0x99a5('0x4c')},{'name':'attrFontSize','value':_0x5f2e36[_0x99a5('0x4d')]||(_0x5f2e36[_0x99a5('0x45')]&&_0x5f2e36[_0x99a5('0x45')][0x2]?_0x5f2e36[_0x99a5('0x45')][0x2][_0x99a5('0x46')]:undefined)||0xc}];case _0x99a5('0x4e'):return[{'name':_0x99a5('0x4f'),'value':_0x5f2e36['attrMetric']||(_0x5f2e36[_0x99a5('0x45')]&&_0x5f2e36['attrs'][0x0]?_0x5f2e36['attrs'][0x0][_0x99a5('0x46')]:undefined)||'total'},{'name':_0x99a5('0x50'),'value':_0x5f2e36[_0x99a5('0x50')]||(_0x5f2e36[_0x99a5('0x45')]&&_0x5f2e36[_0x99a5('0x45')][0x1]?_0x5f2e36[_0x99a5('0x45')][0x1][_0x99a5('0x46')]:undefined)||[]},{'name':_0x99a5('0x4d'),'value':_0x5f2e36[_0x99a5('0x4d')]||(_0x5f2e36[_0x99a5('0x45')]&&_0x5f2e36[_0x99a5('0x45')][0x2]?_0x5f2e36['attrs'][0x2]['value']:undefined)||0x14}];case _0x99a5('0x51'):case'pie-chart':return[{'name':_0x99a5('0x52'),'value':_0x5f2e36[_0x99a5('0x52')]||(_0x5f2e36[_0x99a5('0x45')]&&_0x5f2e36[_0x99a5('0x45')][0x0]?_0x5f2e36[_0x99a5('0x45')][0x0][_0x99a5('0x46')]:undefined)||_0x99a5('0x53')},{'name':_0x99a5('0x54'),'value':_0x5f2e36['attrSerie2']||(_0x5f2e36[_0x99a5('0x45')]&&_0x5f2e36[_0x99a5('0x45')][0x1]?_0x5f2e36[_0x99a5('0x45')][0x1]['value']:undefined)||null},{'name':_0x99a5('0x55'),'value':_0x5f2e36['attrSerie3']||(_0x5f2e36['attrs']&&_0x5f2e36['attrs'][0x2]?_0x5f2e36[_0x99a5('0x45')][0x2]['value']:undefined)||null},{'name':_0x99a5('0x50'),'value':_0x5f2e36[_0x99a5('0x50')]||(_0x5f2e36[_0x99a5('0x45')]&&_0x5f2e36[_0x99a5('0x45')][0x3]?_0x5f2e36[_0x99a5('0x45')][0x3][_0x99a5('0x46')]:undefined)||[]}];case _0x99a5('0x56'):return[{'name':'attrReport','type':_0x5f2e36[_0x99a5('0x57')]||(_0x5f2e36[_0x99a5('0x45')]&&_0x5f2e36['attrs'][0x0]?_0x5f2e36['attrs'][0x0][_0x99a5('0x42')]:undefined)||null,'value':_0x5f2e36[_0x99a5('0x58')]||(_0x5f2e36[_0x99a5('0x45')]&&_0x5f2e36[_0x99a5('0x45')][0x0]?_0x5f2e36[_0x99a5('0x45')][0x0][_0x99a5('0x46')]:undefined)||null},{'name':'attrRefresh','value':_0x5f2e36[_0x99a5('0x59')]||(_0x5f2e36[_0x99a5('0x45')]&&_0x5f2e36['attrs'][0x1]?_0x5f2e36[_0x99a5('0x45')][0x1][_0x99a5('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x2b939){logger[_0x99a5('0x2e')](_0x99a5('0x5a'),JSON['stringify'](_0x2b939));return[];}}exports[_0x99a5('0x5b')]=function(_0xfb627b,_0x1dd2e5){if(_0xfb627b[_0x99a5('0x5c')]){_0xfb627b['body'][_0x99a5('0x45')]=widgetAttributes(_0xfb627b[_0x99a5('0x5c')]);}return db[_0x99a5('0x36')][_0x99a5('0x5b')](_0xfb627b['body'],{})[_0x99a5('0x2c')](respondWithResult(_0x1dd2e5,0xc9))[_0x99a5('0x41')](handleError(_0x1dd2e5,null));};exports[_0x99a5('0x2b')]=function(_0x6e0de4,_0x4c1f3c){if(_0x6e0de4['body']['id']){delete _0x6e0de4[_0x99a5('0x5c')]['id'];}_0x6e0de4[_0x99a5('0x5c')][_0x99a5('0x45')]=widgetAttributes(_0x6e0de4[_0x99a5('0x5c')]);return db[_0x99a5('0x36')][_0x99a5('0x40')]({'where':{'id':_0x6e0de4[_0x99a5('0x33')]['id']}})['then'](handleEntityNotFound(_0x4c1f3c,null))['then'](saveUpdates(_0x6e0de4[_0x99a5('0x5c')],null))[_0x99a5('0x2c')](respondWithResult(_0x4c1f3c,null))[_0x99a5('0x41')](handleError(_0x4c1f3c,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index f76768a..1195b80 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 _0x96ab=['DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x440b91,_0x548ba6){var _0x1d0e8e=function(_0x2dde19){while(--_0x2dde19){_0x440b91['push'](_0x440b91['shift']());}};_0x1d0e8e(++_0x548ba6);}(_0x96ab,0x12a));var _0xb96a=function(_0x4fffe7,_0xec1cdd){_0x4fffe7=_0x4fffe7-0x0;var _0x5c8a47=_0x96ab[_0x4fffe7];return _0x5c8a47;};'use strict';var EventEmitter=require(_0xb96a('0x0'));var DashboardItem=require(_0xb96a('0x1'))['db'][_0xb96a('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xb96a('0x3')](0x0);var events={'afterCreate':_0xb96a('0x4'),'afterUpdate':_0xb96a('0x5'),'afterDestroy':_0xb96a('0x6')};function emitEvent(_0x3e9e73){return function(_0x24a52e,_0x19dc15,_0x5b1da2){DashboardItemEvents[_0xb96a('0x7')](_0x3e9e73+':'+_0x24a52e['id'],_0x24a52e);DashboardItemEvents['emit'](_0x3e9e73,_0x24a52e);_0x5b1da2(null);};}for(var e in events){if(events[_0xb96a('0x8')](e)){var event=events[e];DashboardItem[_0xb96a('0x9')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x21e9=['emit','hasOwnProperty','hook','exports','../../mysqldb','save','update','remove'];(function(_0xcba291,_0x10e9d5){var _0x162274=function(_0x38100e){while(--_0x38100e){_0xcba291['push'](_0xcba291['shift']());}};_0x162274(++_0x10e9d5);}(_0x21e9,0x164));var _0x921e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x21e9[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x921e('0x0'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x921e('0x1'),'afterUpdate':_0x921e('0x2'),'afterDestroy':_0x921e('0x3')};function emitEvent(_0x547278){return function(_0x3738e8,_0x1626cb,_0x44d3e1){DashboardItemEvents[_0x921e('0x4')](_0x547278+':'+_0x3738e8['id'],_0x3738e8);DashboardItemEvents[_0x921e('0x4')](_0x547278,_0x3738e8);_0x44d3e1(null);};}for(var e in events){if(events[_0x921e('0x5')](e)){var event=events[e];DashboardItem[_0x921e('0x6')](e,emitEvent(event));}}module[_0x921e('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index d4aab2d..85ee213 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 _0x5a3d=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash'];(function(_0x4f32de,_0x5bd4a){var _0x149821=function(_0x205885){while(--_0x205885){_0x4f32de['push'](_0x4f32de['shift']());}};_0x149821(++_0x5bd4a);}(_0x5a3d,0x178));var _0xd5a3=function(_0x5ac791,_0x504d37){_0x5ac791=_0x5ac791-0x0;var _0x9e3a19=_0x5a3d[_0x5ac791];return _0x9e3a19;};'use strict';var _=require(_0xd5a3('0x0'));var util=require(_0xd5a3('0x1'));var logger=require(_0xd5a3('0x2'))(_0xd5a3('0x3'));var moment=require(_0xd5a3('0x4'));var BPromise=require(_0xd5a3('0x5'));var rp=require(_0xd5a3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd5a3('0x7'));var config=require('../../config/environment');var attributes=require(_0xd5a3('0x8'));module[_0xd5a3('0x9')]=function(_0x42c16d,_0x459fe6){return _0x42c16d[_0xd5a3('0xa')](_0xd5a3('0xb'),attributes,{'tableName':_0xd5a3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6281=['path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items','lodash','moment','request-promise'];(function(_0x362581,_0x24844b){var _0x2a4c82=function(_0x427d7d){while(--_0x427d7d){_0x362581['push'](_0x362581['shift']());}};_0x2a4c82(++_0x24844b);}(_0x6281,0x151));var _0x1628=function(_0x2096b2,_0x53c8bd){_0x2096b2=_0x2096b2-0x0;var _0x540b16=_0x6281[_0x2096b2];return _0x540b16;};'use strict';var _=require(_0x1628('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1628('0x1'));var BPromise=require('bluebird');var rp=require(_0x1628('0x2'));var fs=require('fs');var path=require(_0x1628('0x3'));var rimraf=require(_0x1628('0x4'));var config=require(_0x1628('0x5'));var attributes=require(_0x1628('0x6'));module['exports']=function(_0x4c30af,_0x57f58b){return _0x4c30af[_0x1628('0x7')](_0x1628('0x8'),attributes,{'tableName':_0x1628('0x9'),'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 ffb6403..a808f26 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 _0xdb89=['info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','then'];(function(_0x2b950d,_0x164105){var _0x29eec7=function(_0x158e23){while(--_0x158e23){_0x2b950d['push'](_0x2b950d['shift']());}};_0x29eec7(++_0x164105);}(_0xdb89,0x8c));var _0x9db8=function(_0x4c4dc9,_0x289f6a){_0x4c4dc9=_0x4c4dc9-0x0;var _0x47349d=_0xdb89[_0x4c4dc9];return _0x47349d;};'use strict';var _=require(_0x9db8('0x0'));var util=require(_0x9db8('0x1'));var moment=require(_0x9db8('0x2'));var BPromise=require(_0x9db8('0x3'));var rs=require(_0x9db8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9db8('0x5'))['db'];var utils=require(_0x9db8('0x6'));var logger=require('../../config/logger')(_0x9db8('0x7'));var config=require(_0x9db8('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9db8('0x9')]({'port':0x232a});config[_0x9db8('0xa')]=_['defaults'](config[_0x9db8('0xa')],{'host':_0x9db8('0xb'),'port':0x18eb});var socket=require(_0x9db8('0xc'))(new Redis(config['redis']));require(_0x9db8('0xd'))[_0x9db8('0xe')](socket);function respondWithRpcPromise(_0x5debab,_0x5791dc,_0x1abc5c){return new BPromise(function(_0x30a335,_0x39f379){return client['request'](_0x5debab,_0x1abc5c)[_0x9db8('0xf')](function(_0x15119c){logger[_0x9db8('0x10')](_0x9db8('0x11'),_0x5791dc,_0x9db8('0x12'));logger[_0x9db8('0x13')](_0x9db8('0x14'),_0x5791dc,_0x9db8('0x12'),JSON['stringify'](_0x15119c));if(_0x15119c[_0x9db8('0x15')]){if(_0x15119c['error'][_0x9db8('0x16')]===0x1f4){logger['error'](_0x9db8('0x11'),_0x5791dc,_0x15119c[_0x9db8('0x15')][_0x9db8('0x17')]);return _0x39f379(_0x15119c['error'][_0x9db8('0x17')]);}logger[_0x9db8('0x15')](_0x9db8('0x11'),_0x5791dc,_0x15119c[_0x9db8('0x15')]['message']);return _0x30a335(_0x15119c['error'][_0x9db8('0x17')]);}else{logger[_0x9db8('0x10')](_0x9db8('0x11'),_0x5791dc,'request\x20sent');_0x30a335(_0x15119c[_0x9db8('0x18')]['message']);}})[_0x9db8('0x19')](function(_0x5be6f7){logger['error']('DashboardItem,\x20%s,\x20%s',_0x5791dc,_0x5be6f7);_0x39f379(_0x5be6f7);});});} \ No newline at end of file +var _0x5408=['info','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./dashboardItem.socket','register','request','then','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','code','error','DashboardItem,\x20%s,\x20%s','message'];(function(_0x12ee62,_0x1700b8){var _0x296d13=function(_0x58791d){while(--_0x58791d){_0x12ee62['push'](_0x12ee62['shift']());}};_0x296d13(++_0x1700b8);}(_0x5408,0xb1));var _0x8540=function(_0x1af1e1,_0x37bc24){_0x1af1e1=_0x1af1e1-0x0;var _0x5f3450=_0x5408[_0x1af1e1];return _0x5f3450;};'use strict';var _=require(_0x8540('0x0'));var util=require(_0x8540('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8540('0x2'));var fs=require('fs');var Redis=require(_0x8540('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8540('0x4'));var logger=require(_0x8540('0x5'))(_0x8540('0x6'));var config=require(_0x8540('0x7'));var jayson=require(_0x8540('0x8'));var client=jayson[_0x8540('0x9')][_0x8540('0xa')]({'port':0x232a});config['redis']=_[_0x8540('0xb')](config['redis'],{'host':_0x8540('0xc'),'port':0x18eb});var socket=require(_0x8540('0xd'))(new Redis(config[_0x8540('0xe')]));require(_0x8540('0xf'))[_0x8540('0x10')](socket);function respondWithRpcPromise(_0x2aab04,_0x136e6a,_0x1da459){return new BPromise(function(_0xa913a2,_0x4ba3a4){return client[_0x8540('0x11')](_0x2aab04,_0x1da459)[_0x8540('0x12')](function(_0x82b6ca){logger['info']('DashboardItem,\x20%s,\x20%s',_0x136e6a,_0x8540('0x13'));logger[_0x8540('0x14')](_0x8540('0x15'),_0x136e6a,_0x8540('0x13'),JSON['stringify'](_0x82b6ca));if(_0x82b6ca['error']){if(_0x82b6ca['error'][_0x8540('0x16')]===0x1f4){logger[_0x8540('0x17')](_0x8540('0x18'),_0x136e6a,_0x82b6ca['error'][_0x8540('0x19')]);return _0x4ba3a4(_0x82b6ca[_0x8540('0x17')][_0x8540('0x19')]);}logger[_0x8540('0x17')](_0x8540('0x18'),_0x136e6a,_0x82b6ca[_0x8540('0x17')][_0x8540('0x19')]);return _0xa913a2(_0x82b6ca['error'][_0x8540('0x19')]);}else{logger[_0x8540('0x1a')](_0x8540('0x18'),_0x136e6a,_0x8540('0x13'));_0xa913a2(_0x82b6ca[_0x8540('0x1b')][_0x8540('0x19')]);}})[_0x8540('0x1c')](function(_0x4c85dd){logger[_0x8540('0x17')]('DashboardItem,\x20%s,\x20%s',_0x136e6a,_0x4c85dd);_0x4ba3a4(_0x4c85dd);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 709f264..50362c7 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 _0xc7b8=['length','dashboardItem:','save','update','emit','removeListener','register'];(function(_0x2aee2f,_0xad9887){var _0x19337f=function(_0x2e62d){while(--_0x2e62d){_0x2aee2f['push'](_0x2aee2f['shift']());}};_0x19337f(++_0xad9887);}(_0xc7b8,0x1f3));var _0x8c7b=function(_0x5e7f6e,_0x3c5f1e){_0x5e7f6e=_0x5e7f6e-0x0;var _0x5cb9a3=_0xc7b8[_0x5e7f6e];return _0x5cb9a3;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x8c7b('0x0'),'remove',_0x8c7b('0x1')];function createListener(_0x2eb538,_0xf08017){return function(_0x5da9f6){_0xf08017[_0x8c7b('0x2')](_0x2eb538,_0x5da9f6);};}function removeListener(_0x54ff8e,_0x5a7083){return function(){DashboardItemEvents[_0x8c7b('0x3')](_0x54ff8e,_0x5a7083);};}exports[_0x8c7b('0x4')]=function(_0x36f567){for(var _0x3af2b9=0x0,_0x54dd1d=events[_0x8c7b('0x5')];_0x3af2b9<_0x54dd1d;_0x3af2b9++){var _0x5edf71=events[_0x3af2b9];var _0x1a68b0=createListener(_0x8c7b('0x6')+_0x5edf71,_0x36f567);DashboardItemEvents['on'](_0x5edf71,_0x1a68b0);}}; \ No newline at end of file +var _0x500d=['register','length','./dashboardItem.events','remove','update','removeListener'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x500d,0x146));var _0xd500=function(_0x27d771,_0x1a50b2){_0x27d771=_0x27d771-0x0;var _0x2ba087=_0x500d[_0x27d771];return _0x2ba087;};'use strict';var DashboardItemEvents=require(_0xd500('0x0'));var events=['save',_0xd500('0x1'),_0xd500('0x2')];function createListener(_0x908669,_0xa11079){return function(_0x12ee3a){_0xa11079['emit'](_0x908669,_0x12ee3a);};}function removeListener(_0xb766fc,_0x11ebdf){return function(){DashboardItemEvents[_0xd500('0x3')](_0xb766fc,_0x11ebdf);};}exports[_0xd500('0x4')]=function(_0x5e7801){for(var _0x3f3614=0x0,_0x185012=events[_0xd500('0x5')];_0x3f3614<_0x185012;_0x3f3614++){var _0x310660=events[_0x3f3614];var _0x55b843=createListener('dashboardItem:'+_0x310660,_0x5e7801);DashboardItemEvents['on'](_0x310660,_0x55b843);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 0d8d202..7c961aa 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 _0x687b=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show'];(function(_0x3fffdb,_0x18964c){var _0x5a9235=function(_0x303b08){while(--_0x303b08){_0x3fffdb['push'](_0x3fffdb['shift']());}};_0x5a9235(++_0x18964c);}(_0x687b,0x14a));var _0xb687=function(_0x499ca5,_0x4986cf){_0x499ca5=_0x499ca5-0x0;var _0x7bfd9c=_0x687b[_0x499ca5];return _0x7bfd9c;};'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')](_0xb687('0x9'),auth[_0xb687('0xa')](),controller[_0xb687('0xb')]);router[_0xb687('0xc')]('/',auth[_0xb687('0xa')](),controller['create']);router[_0xb687('0xd')](_0xb687('0x9'),auth['isAuthenticated'](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0x9'),auth[_0xb687('0xa')](),controller[_0xb687('0x10')]);module[_0xb687('0x11')]=router; \ No newline at end of file +var _0xda19=['create','put','delete','destroy','exports','util','path','express','../../components/auth/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post'];(function(_0x47634a,_0x2ce6e4){var _0x20d61a=function(_0x191961){while(--_0x191961){_0x47634a['push'](_0x47634a['shift']());}};_0x20d61a(++_0x2ce6e4);}(_0xda19,0xd5));var _0x9da1=function(_0x262e63,_0x2feadb){_0x262e63=_0x262e63-0x0;var _0x14e369=_0xda19[_0x262e63];return _0x14e369;};'use strict';var multer=require('multer');var util=require(_0x9da1('0x0'));var path=require(_0x9da1('0x1'));var timeout=require('connect-timeout');var express=require(_0x9da1('0x2'));var router=express['Router']();var auth=require(_0x9da1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9da1('0x4'));var controller=require(_0x9da1('0x5'));router[_0x9da1('0x6')](_0x9da1('0x7'),auth[_0x9da1('0x8')](),controller[_0x9da1('0x9')]);router[_0x9da1('0xa')]('/',auth[_0x9da1('0x8')](),controller[_0x9da1('0xb')]);router[_0x9da1('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9da1('0xd')]('/:id',auth[_0x9da1('0x8')](),controller[_0x9da1('0xe')]);module[_0x9da1('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 a3da1d5..8a4a8be 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 _0x6f9d=['second','third','sequelize','STRING','first'];(function(_0xaec719,_0x2975e2){var _0x3e82f5=function(_0x252539){while(--_0x252539){_0xaec719['push'](_0xaec719['shift']());}};_0x3e82f5(++_0x2975e2);}(_0x6f9d,0x174));var _0xd6f9=function(_0x1116cd,_0x41a0b7){_0x1116cd=_0x1116cd-0x0;var _0x52974a=_0x6f9d[_0x1116cd];return _0x52974a;};'use strict';var Sequelize=require(_0xd6f9('0x0'));module['exports']={'name':{'type':Sequelize[_0xd6f9('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xd6f9('0x2'),_0xd6f9('0x3'),_0xd6f9('0x4')),'allowNull':![],'defaultValue':_0xd6f9('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2d10=['second','sequelize','STRING','ENUM','first'];(function(_0x1176ce,_0x7685c4){var _0x2a79fd=function(_0x3ee29a){while(--_0x3ee29a){_0x1176ce['push'](_0x1176ce['shift']());}};_0x2a79fd(++_0x7685c4);}(_0x2d10,0x88));var _0x02d1=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0x2d10[_0x946518];return _0x909b69;};'use strict';var Sequelize=require(_0x02d1('0x0'));module['exports']={'name':{'type':Sequelize[_0x02d1('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x02d1('0x2')](_0x02d1('0x3'),_0x02d1('0x4'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x02d1('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 983438b..a9fec45 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 _0xb401=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','set','Content-Range','apply','reject','then','destroy','get','Dispositions','UserProfileResource','stack','name','send','index','Disposition','rawAttributes','type','key','model','map','keys','filters','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','count','include','findAll','rows','catch','filtears','intersection','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x250e87,_0x343582){var _0x11a4ef=function(_0x210dfa){while(--_0x210dfa){_0x250e87['push'](_0x250e87['shift']());}};_0x11a4ef(++_0x343582);}(_0xb401,0xe0));var _0x1b40=function(_0x53009f,_0x2cda58){_0x53009f=_0x53009f-0x0;var _0x4f84a1=_0xb401[_0x53009f];return _0x4f84a1;};'use strict';var pdf=require(_0x1b40('0x0'));var emlformat=require(_0x1b40('0x1'));var rimraf=require(_0x1b40('0x2'));var zipdir=require(_0x1b40('0x3'));var jsonpatch=require(_0x1b40('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1b40('0x5'));var Mustache=require(_0x1b40('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1b40('0x7'));var csv=require(_0x1b40('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1b40('0x9'));var crypto=require('crypto');var jsforce=require(_0x1b40('0xa'));var deskjs=require(_0x1b40('0xb'));var toCsv=require(_0x1b40('0x8'));var querystring=require(_0x1b40('0xc'));var Papa=require(_0x1b40('0xd'));var Redis=require('ioredis');var authService=require(_0x1b40('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1b40('0xf'));var hardwareService=require(_0x1b40('0x10'));var logger=require('../../config/logger')(_0x1b40('0x11'));var utils=require(_0x1b40('0x12'));var config=require(_0x1b40('0x13'));var licenseUtil=require(_0x1b40('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x279b05,_0x4126c5){_0x4126c5=_0x4126c5||0xcc;return function(_0xe78243){if(_0xe78243){return _0x279b05[_0x1b40('0x15')](_0x4126c5);}return _0x279b05[_0x1b40('0x16')](_0x4126c5)['end']();};}function respondWithResult(_0x1d9f39,_0x1d1ef4){_0x1d1ef4=_0x1d1ef4||0xc8;return function(_0x16e65c){if(_0x16e65c){return _0x1d9f39[_0x1b40('0x16')](_0x1d1ef4)['json'](_0x16e65c);}};}function respondWithFilteredResult(_0x30e4ba,_0x2945ec){return function(_0x2bcfbe){if(_0x2bcfbe){var _0x21f73d=_0x2bcfbe['count'],_0x3d5486=_0x2945ec[_0x1b40('0x17')],_0x165bee=_0x2945ec[_0x1b40('0x17')]+_0x2945ec[_0x1b40('0x18')],_0x120d22;if(_0x165bee>=_0x21f73d){_0x165bee=_0x21f73d;_0x120d22=0xc8;}else{_0x120d22=0xce;}_0x30e4ba[_0x1b40('0x16')](_0x120d22);return _0x30e4ba[_0x1b40('0x19')](_0x1b40('0x1a'),_0x3d5486+'-'+_0x165bee+'/'+_0x21f73d)['json'](_0x2bcfbe);}return null;};}function patchUpdates(_0x381f28){return function(_0x82222b){try{jsonpatch[_0x1b40('0x1b')](_0x82222b,_0x381f28,!![]);}catch(_0x577a87){return BPromise[_0x1b40('0x1c')](_0x577a87);}return _0x82222b['save']();};}function saveUpdates(_0x7a08af,_0xbb9beb){return function(_0x484a02){if(_0x484a02){return _0x484a02['update'](_0x7a08af)[_0x1b40('0x1d')](function(_0x810517){return _0x810517;});}return null;};}function removeEntity(_0x405b52,_0x360314){return function(_0x3d3151){if(_0x3d3151){return _0x3d3151[_0x1b40('0x1e')]()['then'](function(){var _0x4bdcdf=_0x3d3151[_0x1b40('0x1f')]({'plain':!![]});var _0x2c8a8d=_0x1b40('0x20');return db[_0x1b40('0x21')][_0x1b40('0x1e')]({'where':{'type':_0x2c8a8d,'resourceId':_0x4bdcdf['id']}})['then'](function(){return _0x3d3151;});})[_0x1b40('0x1d')](function(){_0x405b52[_0x1b40('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4178dc,_0x183632){return function(_0x7b773a){if(!_0x7b773a){_0x4178dc['sendStatus'](0x194);}return _0x7b773a;};}function handleError(_0x1fbfa0,_0x403433){_0x403433=_0x403433||0x1f4;return function(_0x5c7ca2){logger['error'](_0x5c7ca2[_0x1b40('0x22')]);if(_0x5c7ca2[_0x1b40('0x23')]){delete _0x5c7ca2[_0x1b40('0x23')];}_0x1fbfa0[_0x1b40('0x16')](_0x403433)[_0x1b40('0x24')](_0x5c7ca2);};}exports[_0x1b40('0x25')]=function(_0x5dc619,_0x864a83){var _0xc26fa={},_0x2e3b51={},_0x51d7df={'count':0x0,'rows':[]};var _0x4a1a5b=_['map'](db[_0x1b40('0x26')][_0x1b40('0x27')],function(_0x4919b4){return{'name':_0x4919b4['fieldName'],'type':_0x4919b4[_0x1b40('0x28')][_0x1b40('0x29')]};});_0x2e3b51[_0x1b40('0x2a')]=_[_0x1b40('0x2b')](_0x4a1a5b,_0x1b40('0x23'));_0x2e3b51['query']=_[_0x1b40('0x2c')](_0x5dc619['query']);_0x2e3b51[_0x1b40('0x2d')]=_['intersection'](_0x2e3b51[_0x1b40('0x2a')],_0x2e3b51['query']);_0xc26fa[_0x1b40('0x2e')]=_['intersection'](_0x2e3b51[_0x1b40('0x2a')],qs[_0x1b40('0x2f')](_0x5dc619[_0x1b40('0x30')][_0x1b40('0x2f')]));_0xc26fa[_0x1b40('0x2e')]=_0xc26fa['attributes'][_0x1b40('0x31')]?_0xc26fa[_0x1b40('0x2e')]:_0x2e3b51[_0x1b40('0x2a')];if(!_0x5dc619[_0x1b40('0x30')][_0x1b40('0x32')](_0x1b40('0x33'))){_0xc26fa[_0x1b40('0x18')]=qs[_0x1b40('0x18')](_0x5dc619['query'][_0x1b40('0x18')]);_0xc26fa['offset']=qs[_0x1b40('0x17')](_0x5dc619[_0x1b40('0x30')][_0x1b40('0x17')]);}_0xc26fa[_0x1b40('0x34')]=qs[_0x1b40('0x35')](_0x5dc619[_0x1b40('0x30')][_0x1b40('0x35')]);_0xc26fa[_0x1b40('0x36')]=qs[_0x1b40('0x2d')](_[_0x1b40('0x37')](_0x5dc619['query'],_0x2e3b51[_0x1b40('0x2d')]),_0x4a1a5b);if(_0x5dc619[_0x1b40('0x30')][_0x1b40('0x38')]){_0xc26fa[_0x1b40('0x36')]=_['merge'](_0xc26fa[_0x1b40('0x36')],{'$or':_[_0x1b40('0x2b')](_0x4a1a5b,function(_0x48dfb7){if(_0x48dfb7[_0x1b40('0x28')]!==_0x1b40('0x39')){var _0x1ea91f={};_0x1ea91f[_0x48dfb7[_0x1b40('0x23')]]={'$like':'%'+_0x5dc619[_0x1b40('0x30')][_0x1b40('0x38')]+'%'};return _0x1ea91f;}})});}_0xc26fa=_['merge']({},_0xc26fa,_0x5dc619['options']);var _0xb2c56f={'where':_0xc26fa[_0x1b40('0x36')]};return db[_0x1b40('0x26')][_0x1b40('0x3a')](_0xb2c56f)[_0x1b40('0x1d')](function(_0x56f8e3){_0x51d7df['count']=_0x56f8e3;if(_0x5dc619[_0x1b40('0x30')]['includeAll']){_0xc26fa[_0x1b40('0x3b')]=[{'all':!![]}];}return db[_0x1b40('0x26')][_0x1b40('0x3c')](_0xc26fa);})['then'](function(_0x409984){_0x51d7df[_0x1b40('0x3d')]=_0x409984;return _0x51d7df;})['then'](respondWithFilteredResult(_0x864a83,_0xc26fa))[_0x1b40('0x3e')](handleError(_0x864a83,null));};exports['show']=function(_0x72c8d2,_0x5a8891){var _0x45a637={'raw':!![],'where':{'id':_0x72c8d2['params']['id']}},_0x5a2c1c={};_0x5a2c1c[_0x1b40('0x2a')]=_[_0x1b40('0x2c')](db['Disposition']['rawAttributes']);_0x5a2c1c['query']=_[_0x1b40('0x2c')](_0x72c8d2[_0x1b40('0x30')]);_0x5a2c1c[_0x1b40('0x3f')]=_[_0x1b40('0x40')](_0x5a2c1c['model'],_0x5a2c1c[_0x1b40('0x30')]);_0x45a637[_0x1b40('0x2e')]=_['intersection'](_0x5a2c1c['model'],qs[_0x1b40('0x2f')](_0x72c8d2[_0x1b40('0x30')][_0x1b40('0x2f')]));_0x45a637[_0x1b40('0x2e')]=_0x45a637[_0x1b40('0x2e')][_0x1b40('0x31')]?_0x45a637[_0x1b40('0x2e')]:_0x5a2c1c[_0x1b40('0x2a')];if(_0x72c8d2['query'][_0x1b40('0x41')]){_0x45a637[_0x1b40('0x3b')]=[{'all':!![]}];}_0x45a637=_[_0x1b40('0x42')]({},_0x45a637,_0x72c8d2[_0x1b40('0x43')]);return db['Disposition']['find'](_0x45a637)[_0x1b40('0x1d')](handleEntityNotFound(_0x5a8891,null))['then'](respondWithResult(_0x5a8891,null))[_0x1b40('0x3e')](handleError(_0x5a8891,null));};exports[_0x1b40('0x44')]=function(_0x38b69d,_0x2b7997){return db[_0x1b40('0x26')][_0x1b40('0x44')](_0x38b69d[_0x1b40('0x45')],{})['then'](function(_0x1063f9){var _0x292a84=_0x38b69d[_0x1b40('0x46')][_0x1b40('0x1f')]({'plain':!![]});if(!_0x292a84)throw new Error(_0x1b40('0x47'));if(_0x292a84[_0x1b40('0x48')]===_0x1b40('0x46')){var _0x3651b1=_0x1063f9[_0x1b40('0x1f')]({'plain':!![]});var _0x30c21d='Dispositions';return db[_0x1b40('0x49')][_0x1b40('0x4a')]({'where':{'name':_0x30c21d,'userProfileId':_0x292a84[_0x1b40('0x4b')]},'raw':!![]})[_0x1b40('0x1d')](function(_0x41f80d){if(_0x41f80d&&_0x41f80d[_0x1b40('0x4c')]===0x0){return db['UserProfileResource'][_0x1b40('0x44')]({'name':_0x3651b1['name'],'resourceId':_0x3651b1['id'],'type':_0x41f80d[_0x1b40('0x23')],'sectionId':_0x41f80d['id']},{})[_0x1b40('0x1d')](function(){return _0x1063f9;});}else{return _0x1063f9;}})[_0x1b40('0x3e')](function(_0x2f6162){logger[_0x1b40('0x4d')](_0x1b40('0x4e'),_0x2f6162);throw _0x2f6162;});}return _0x1063f9;})[_0x1b40('0x1d')](respondWithResult(_0x2b7997,0xc9))[_0x1b40('0x3e')](handleError(_0x2b7997,null));};exports['update']=function(_0x23d8ab,_0x3a5415){if(_0x23d8ab[_0x1b40('0x45')]['id']){delete _0x23d8ab[_0x1b40('0x45')]['id'];}return db[_0x1b40('0x26')]['find']({'where':{'id':_0x23d8ab[_0x1b40('0x4f')]['id']}})[_0x1b40('0x1d')](handleEntityNotFound(_0x3a5415,null))[_0x1b40('0x1d')](saveUpdates(_0x23d8ab[_0x1b40('0x45')],null))['then'](respondWithResult(_0x3a5415,null))['catch'](handleError(_0x3a5415,null));};exports[_0x1b40('0x1e')]=function(_0x45a239,_0x84018f){return db[_0x1b40('0x26')]['find']({'where':{'id':_0x45a239['params']['id']}})[_0x1b40('0x1d')](handleEntityNotFound(_0x84018f,null))[_0x1b40('0x1d')](removeEntity(_0x84018f,null))[_0x1b40('0x3e')](handleError(_0x84018f,null));}; \ No newline at end of file +var _0x24f0=['sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','Dispositions','UserProfileResource','destroy','error','name','index','map','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filters','filter','where','merge','VIRTUAL','Disposition','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','filtears','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x44fee6,_0x4afc8d){var _0x23662d=function(_0x59cd70){while(--_0x59cd70){_0x44fee6['push'](_0x44fee6['shift']());}};_0x23662d(++_0x4afc8d);}(_0x24f0,0x91));var _0x024f=function(_0xbd6b13,_0x2e9921){_0xbd6b13=_0xbd6b13-0x0;var _0x4f3a90=_0x24f0[_0xbd6b13];return _0x4f3a90;};'use strict';var pdf=require(_0x024f('0x0'));var emlformat=require(_0x024f('0x1'));var rimraf=require(_0x024f('0x2'));var zipdir=require(_0x024f('0x3'));var jsonpatch=require(_0x024f('0x4'));var rp=require(_0x024f('0x5'));var moment=require('moment');var BPromise=require(_0x024f('0x6'));var Mustache=require(_0x024f('0x7'));var util=require(_0x024f('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x024f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x024f('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x024f('0xb'));var toCsv=require(_0x024f('0xc'));var querystring=require(_0x024f('0xd'));var Papa=require(_0x024f('0xe'));var Redis=require(_0x024f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x024f('0x10'));var as=require(_0x024f('0x11'));var hardwareService=require(_0x024f('0x12'));var logger=require(_0x024f('0x13'))(_0x024f('0x14'));var utils=require(_0x024f('0x15'));var config=require(_0x024f('0x16'));var licenseUtil=require(_0x024f('0x17'));var db=require(_0x024f('0x18'))['db'];function respondWithStatusCode(_0x92b98a,_0x4e2eb6){_0x4e2eb6=_0x4e2eb6||0xcc;return function(_0x18512f){if(_0x18512f){return _0x92b98a[_0x024f('0x19')](_0x4e2eb6);}return _0x92b98a[_0x024f('0x1a')](_0x4e2eb6)[_0x024f('0x1b')]();};}function respondWithResult(_0x54dce2,_0x7f4a8f){_0x7f4a8f=_0x7f4a8f||0xc8;return function(_0x1493f8){if(_0x1493f8){return _0x54dce2[_0x024f('0x1a')](_0x7f4a8f)['json'](_0x1493f8);}};}function respondWithFilteredResult(_0x2f5427,_0x907482){return function(_0xa6fcfc){if(_0xa6fcfc){var _0x6b2d9=_0xa6fcfc[_0x024f('0x1c')],_0x3cfc21=_0x907482['offset'],_0x10977f=_0x907482[_0x024f('0x1d')]+_0x907482['limit'],_0x55563c;if(_0x10977f>=_0x6b2d9){_0x10977f=_0x6b2d9;_0x55563c=0xc8;}else{_0x55563c=0xce;}_0x2f5427['status'](_0x55563c);return _0x2f5427[_0x024f('0x1e')](_0x024f('0x1f'),_0x3cfc21+'-'+_0x10977f+'/'+_0x6b2d9)[_0x024f('0x20')](_0xa6fcfc);}return null;};}function patchUpdates(_0x53454e){return function(_0xd09039){try{jsonpatch[_0x024f('0x21')](_0xd09039,_0x53454e,!![]);}catch(_0x5bdfde){return BPromise[_0x024f('0x22')](_0x5bdfde);}return _0xd09039[_0x024f('0x23')]();};}function saveUpdates(_0xeb2ee,_0x4dcddd){return function(_0x439718){if(_0x439718){return _0x439718[_0x024f('0x24')](_0xeb2ee)[_0x024f('0x25')](function(_0x485ff3){return _0x485ff3;});}return null;};}function removeEntity(_0x2259fd,_0x595382){return function(_0x4ff36d){if(_0x4ff36d){return _0x4ff36d['destroy']()['then'](function(){var _0x5871f2=_0x4ff36d['get']({'plain':!![]});var _0x3993a9=_0x024f('0x26');return db[_0x024f('0x27')][_0x024f('0x28')]({'where':{'type':_0x3993a9,'resourceId':_0x5871f2['id']}})[_0x024f('0x25')](function(){return _0x4ff36d;});})['then'](function(){_0x2259fd[_0x024f('0x1a')](0xcc)[_0x024f('0x1b')]();});}};}function handleEntityNotFound(_0x836ced,_0x580abb){return function(_0x25b222){if(!_0x25b222){_0x836ced['sendStatus'](0x194);}return _0x25b222;};}function handleError(_0x2de76c,_0x15e571){_0x15e571=_0x15e571||0x1f4;return function(_0x50ea76){logger[_0x024f('0x29')](_0x50ea76['stack']);if(_0x50ea76[_0x024f('0x2a')]){delete _0x50ea76[_0x024f('0x2a')];}_0x2de76c[_0x024f('0x1a')](_0x15e571)['send'](_0x50ea76);};}exports[_0x024f('0x2b')]=function(_0x30d816,_0x2e6c55){var _0x28a5c4={},_0x7d483={},_0x42109c={'count':0x0,'rows':[]};var _0x35c064=_[_0x024f('0x2c')](db['Disposition']['rawAttributes'],function(_0x1e0f42){return{'name':_0x1e0f42[_0x024f('0x2d')],'type':_0x1e0f42[_0x024f('0x2e')]['key']};});_0x7d483[_0x024f('0x2f')]=_[_0x024f('0x2c')](_0x35c064,'name');_0x7d483[_0x024f('0x30')]=_['keys'](_0x30d816['query']);_0x7d483['filters']=_[_0x024f('0x31')](_0x7d483[_0x024f('0x2f')],_0x7d483['query']);_0x28a5c4[_0x024f('0x32')]=_[_0x024f('0x31')](_0x7d483[_0x024f('0x2f')],qs[_0x024f('0x33')](_0x30d816[_0x024f('0x30')][_0x024f('0x33')]));_0x28a5c4[_0x024f('0x32')]=_0x28a5c4[_0x024f('0x32')][_0x024f('0x34')]?_0x28a5c4[_0x024f('0x32')]:_0x7d483[_0x024f('0x2f')];if(!_0x30d816[_0x024f('0x30')][_0x024f('0x35')]('nolimit')){_0x28a5c4[_0x024f('0x36')]=qs[_0x024f('0x36')](_0x30d816[_0x024f('0x30')][_0x024f('0x36')]);_0x28a5c4[_0x024f('0x1d')]=qs[_0x024f('0x1d')](_0x30d816[_0x024f('0x30')][_0x024f('0x1d')]);}_0x28a5c4[_0x024f('0x37')]=qs[_0x024f('0x38')](_0x30d816[_0x024f('0x30')]['sort']);_0x28a5c4['where']=qs['filters'](_[_0x024f('0x39')](_0x30d816[_0x024f('0x30')],_0x7d483[_0x024f('0x3a')]),_0x35c064);if(_0x30d816[_0x024f('0x30')][_0x024f('0x3b')]){_0x28a5c4[_0x024f('0x3c')]=_[_0x024f('0x3d')](_0x28a5c4['where'],{'$or':_[_0x024f('0x2c')](_0x35c064,function(_0x1415a7){if(_0x1415a7[_0x024f('0x2e')]!==_0x024f('0x3e')){var _0x2ffb86={};_0x2ffb86[_0x1415a7[_0x024f('0x2a')]]={'$like':'%'+_0x30d816['query'][_0x024f('0x3b')]+'%'};return _0x2ffb86;}})});}_0x28a5c4=_['merge']({},_0x28a5c4,_0x30d816['options']);var _0x5cc401={'where':_0x28a5c4['where']};return db[_0x024f('0x3f')]['count'](_0x5cc401)[_0x024f('0x25')](function(_0x23b3a3){_0x42109c[_0x024f('0x1c')]=_0x23b3a3;if(_0x30d816[_0x024f('0x30')][_0x024f('0x40')]){_0x28a5c4[_0x024f('0x41')]=[{'all':!![]}];}return db[_0x024f('0x3f')][_0x024f('0x42')](_0x28a5c4);})['then'](function(_0x17f726){_0x42109c[_0x024f('0x43')]=_0x17f726;return _0x42109c;})[_0x024f('0x25')](respondWithFilteredResult(_0x2e6c55,_0x28a5c4))[_0x024f('0x44')](handleError(_0x2e6c55,null));};exports[_0x024f('0x45')]=function(_0x1b31a8,_0x3134f2){var _0x4f0030={'raw':!![],'where':{'id':_0x1b31a8[_0x024f('0x46')]['id']}},_0x2e0a85={};_0x2e0a85[_0x024f('0x2f')]=_[_0x024f('0x47')](db[_0x024f('0x3f')][_0x024f('0x48')]);_0x2e0a85[_0x024f('0x30')]=_[_0x024f('0x47')](_0x1b31a8['query']);_0x2e0a85[_0x024f('0x49')]=_[_0x024f('0x31')](_0x2e0a85[_0x024f('0x2f')],_0x2e0a85[_0x024f('0x30')]);_0x4f0030['attributes']=_[_0x024f('0x31')](_0x2e0a85[_0x024f('0x2f')],qs[_0x024f('0x33')](_0x1b31a8[_0x024f('0x30')]['fields']));_0x4f0030['attributes']=_0x4f0030[_0x024f('0x32')][_0x024f('0x34')]?_0x4f0030[_0x024f('0x32')]:_0x2e0a85[_0x024f('0x2f')];if(_0x1b31a8['query'][_0x024f('0x40')]){_0x4f0030[_0x024f('0x41')]=[{'all':!![]}];}_0x4f0030=_[_0x024f('0x3d')]({},_0x4f0030,_0x1b31a8[_0x024f('0x4a')]);return db[_0x024f('0x3f')][_0x024f('0x4b')](_0x4f0030)[_0x024f('0x25')](handleEntityNotFound(_0x3134f2,null))[_0x024f('0x25')](respondWithResult(_0x3134f2,null))[_0x024f('0x44')](handleError(_0x3134f2,null));};exports[_0x024f('0x4c')]=function(_0x5b91cb,_0x3aa46d){return db[_0x024f('0x3f')][_0x024f('0x4c')](_0x5b91cb[_0x024f('0x4d')],{})['then'](function(_0x3c0cb7){var _0x3c8b02=_0x5b91cb[_0x024f('0x4e')][_0x024f('0x4f')]({'plain':!![]});if(!_0x3c8b02)throw new Error(_0x024f('0x50'));if(_0x3c8b02[_0x024f('0x51')]===_0x024f('0x4e')){var _0x3c09b3=_0x3c0cb7[_0x024f('0x4f')]({'plain':!![]});var _0x8ed19d=_0x024f('0x26');return db[_0x024f('0x52')][_0x024f('0x4b')]({'where':{'name':_0x8ed19d,'userProfileId':_0x3c8b02[_0x024f('0x53')]},'raw':!![]})[_0x024f('0x25')](function(_0x292ce4){if(_0x292ce4&&_0x292ce4[_0x024f('0x54')]===0x0){return db[_0x024f('0x27')][_0x024f('0x4c')]({'name':_0x3c09b3[_0x024f('0x2a')],'resourceId':_0x3c09b3['id'],'type':_0x292ce4[_0x024f('0x2a')],'sectionId':_0x292ce4['id']},{})[_0x024f('0x25')](function(){return _0x3c0cb7;});}else{return _0x3c0cb7;}})[_0x024f('0x44')](function(_0x442ea9){logger[_0x024f('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x442ea9);throw _0x442ea9;});}return _0x3c0cb7;})[_0x024f('0x25')](respondWithResult(_0x3aa46d,0xc9))['catch'](handleError(_0x3aa46d,null));};exports[_0x024f('0x24')]=function(_0x5c5aff,_0x5e8305){if(_0x5c5aff[_0x024f('0x4d')]['id']){delete _0x5c5aff[_0x024f('0x4d')]['id'];}return db['Disposition'][_0x024f('0x4b')]({'where':{'id':_0x5c5aff[_0x024f('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e8305,null))[_0x024f('0x25')](saveUpdates(_0x5c5aff[_0x024f('0x4d')],null))[_0x024f('0x25')](respondWithResult(_0x5e8305,null))[_0x024f('0x44')](handleError(_0x5e8305,null));};exports[_0x024f('0x28')]=function(_0x119269,_0x45a536){return db[_0x024f('0x3f')][_0x024f('0x4b')]({'where':{'id':_0x119269[_0x024f('0x46')]['id']}})['then'](handleEntityNotFound(_0x45a536,null))[_0x024f('0x25')](removeEntity(_0x45a536,null))['catch'](handleError(_0x45a536,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 3a8c2d2..6d65983 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 _0xf3be=['WhatsappAccountId','lodash','util','../../config/logger','api','bluebird','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','name_mail','MailAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf3be,0x1e1));var _0xef3b=function(_0x4e66d5,_0x121195){_0x4e66d5=_0x4e66d5-0x0;var _0x2db775=_0xf3be[_0x4e66d5];return _0x2db775;};'use strict';var _=require(_0xef3b('0x0'));var util=require(_0xef3b('0x1'));var logger=require(_0xef3b('0x2'))(_0xef3b('0x3'));var moment=require('moment');var BPromise=require(_0xef3b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xef3b('0x5'));module[_0xef3b('0x6')]=function(_0x48f499,_0x3dfcc2){return _0x48f499[_0xef3b('0x7')](_0xef3b('0x8'),attributes,{'tableName':_0xef3b('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xef3b('0xa'),'fields':[_0xef3b('0xb'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0xef3b('0xb'),'ChatWebsiteId']},{'unique':!![],'name':_0xef3b('0xc'),'fields':[_0xef3b('0xb'),_0xef3b('0xd')]},{'unique':!![],'name':'name_sms','fields':[_0xef3b('0xb'),'SmsAccountId']},{'unique':!![],'name':_0xef3b('0xe'),'fields':[_0xef3b('0xb'),_0xef3b('0xf')]},{'unique':!![],'name':_0xef3b('0x10'),'fields':[_0xef3b('0xb'),_0xef3b('0x11')]},{'unique':!![],'name':_0xef3b('0x12'),'fields':[_0xef3b('0xb'),_0xef3b('0x13')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x90b5=['tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','Disposition'];(function(_0x3ab46c,_0x4d26cc){var _0x2c7e90=function(_0x29e83d){while(--_0x29e83d){_0x3ab46c['push'](_0x3ab46c['shift']());}};_0x2c7e90(++_0x4d26cc);}(_0x90b5,0x139));var _0x590b=function(_0x30d253,_0x21f1e1){_0x30d253=_0x30d253-0x0;var _0x3411a8=_0x90b5[_0x30d253];return _0x3411a8;};'use strict';var _=require(_0x590b('0x0'));var util=require('util');var logger=require(_0x590b('0x1'))(_0x590b('0x2'));var moment=require(_0x590b('0x3'));var BPromise=require(_0x590b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x590b('0x5'));var config=require(_0x590b('0x6'));var attributes=require('./disposition.attributes');module[_0x590b('0x7')]=function(_0x2059e4,_0x88a5f9){return _0x2059e4['define'](_0x590b('0x8'),attributes,{'tableName':_0x590b('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x590b('0xa'),'fields':[_0x590b('0xb'),_0x590b('0xc')]},{'unique':!![],'name':_0x590b('0xd'),'fields':[_0x590b('0xb'),_0x590b('0xe')]},{'unique':!![],'name':_0x590b('0xf'),'fields':['name',_0x590b('0x10')]},{'unique':!![],'name':_0x590b('0x11'),'fields':['name',_0x590b('0x12')]},{'unique':!![],'name':'name_fax','fields':[_0x590b('0xb'),_0x590b('0x13')]},{'unique':!![],'name':_0x590b('0x14'),'fields':[_0x590b('0xb'),'OpenchannelAccountId']},{'unique':!![],'name':_0x590b('0x15'),'fields':[_0x590b('0xb'),_0x590b('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 a13c2e0..10abcb9 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 _0xe7f5=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','Disposition,\x20%s,\x20%s','request\x20sent','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring'];(function(_0x353643,_0x568495){var _0x394b32=function(_0x3924ae){while(--_0x3924ae){_0x353643['push'](_0x353643['shift']());}};_0x394b32(++_0x568495);}(_0xe7f5,0x1b5));var _0x5e7f=function(_0x9f17f3,_0x2408c1){_0x9f17f3=_0x9f17f3-0x0;var _0x2aee4f=_0xe7f5[_0x9f17f3];return _0x2aee4f;};'use strict';var _=require(_0x5e7f('0x0'));var util=require('util');var moment=require(_0x5e7f('0x1'));var BPromise=require('bluebird');var rs=require(_0x5e7f('0x2'));var fs=require('fs');var Redis=require(_0x5e7f('0x3'));var db=require(_0x5e7f('0x4'))['db'];var utils=require(_0x5e7f('0x5'));var logger=require('../../config/logger')(_0x5e7f('0x6'));var config=require('../../config/environment');var jayson=require(_0x5e7f('0x7'));var client=jayson[_0x5e7f('0x8')][_0x5e7f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58d6af,_0xfce610,_0x45f9e4){return new BPromise(function(_0x4521b2,_0x26bed4){return client[_0x5e7f('0xa')](_0x58d6af,_0x45f9e4)['then'](function(_0x881fc7){logger[_0x5e7f('0xb')](_0x5e7f('0xc'),_0xfce610,_0x5e7f('0xd'));logger['debug'](_0x5e7f('0xe'),_0xfce610,_0x5e7f('0xd'),JSON[_0x5e7f('0xf')](_0x881fc7));if(_0x881fc7[_0x5e7f('0x10')]){if(_0x881fc7[_0x5e7f('0x10')][_0x5e7f('0x11')]===0x1f4){logger[_0x5e7f('0x10')](_0x5e7f('0xc'),_0xfce610,_0x881fc7[_0x5e7f('0x10')]['message']);return _0x26bed4(_0x881fc7[_0x5e7f('0x10')]['message']);}logger['error']('Disposition,\x20%s,\x20%s',_0xfce610,_0x881fc7[_0x5e7f('0x10')][_0x5e7f('0x12')]);return _0x4521b2(_0x881fc7[_0x5e7f('0x10')]['message']);}else{logger['info'](_0x5e7f('0xc'),_0xfce610,'request\x20sent');_0x4521b2(_0x881fc7[_0x5e7f('0x13')][_0x5e7f('0x12')]);}})['catch'](function(_0x984ee2){logger[_0x5e7f('0x10')](_0x5e7f('0xc'),_0xfce610,_0x984ee2);_0x26bed4(_0x984ee2);});});} \ No newline at end of file +var _0xa857=['request','info','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','error','code','message','Disposition,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x250873,_0x3e8932){var _0x437de2=function(_0x434923){while(--_0x434923){_0x250873['push'](_0x250873['shift']());}};_0x437de2(++_0x3e8932);}(_0xa857,0xa4));var _0x7a85=function(_0x38da6a,_0x33fd78){_0x38da6a=_0x38da6a-0x0;var _0x222076=_0xa857[_0x38da6a];return _0x222076;};'use strict';var _=require(_0x7a85('0x0'));var util=require('util');var moment=require(_0x7a85('0x1'));var BPromise=require(_0x7a85('0x2'));var rs=require(_0x7a85('0x3'));var fs=require('fs');var Redis=require(_0x7a85('0x4'));var db=require(_0x7a85('0x5'))['db'];var utils=require(_0x7a85('0x6'));var logger=require(_0x7a85('0x7'))('rpc');var config=require(_0x7a85('0x8'));var jayson=require(_0x7a85('0x9'));var client=jayson[_0x7a85('0xa')][_0x7a85('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xea2644,_0x308967,_0x562f4e){return new BPromise(function(_0x2345cc,_0x1e2f5b){return client[_0x7a85('0xc')](_0xea2644,_0x562f4e)['then'](function(_0x373e1a){logger[_0x7a85('0xd')]('Disposition,\x20%s,\x20%s',_0x308967,_0x7a85('0xe'));logger[_0x7a85('0xf')](_0x7a85('0x10'),_0x308967,_0x7a85('0xe'),JSON['stringify'](_0x373e1a));if(_0x373e1a[_0x7a85('0x11')]){if(_0x373e1a[_0x7a85('0x11')][_0x7a85('0x12')]===0x1f4){logger[_0x7a85('0x11')]('Disposition,\x20%s,\x20%s',_0x308967,_0x373e1a['error'][_0x7a85('0x13')]);return _0x1e2f5b(_0x373e1a['error'][_0x7a85('0x13')]);}logger[_0x7a85('0x11')]('Disposition,\x20%s,\x20%s',_0x308967,_0x373e1a[_0x7a85('0x11')]['message']);return _0x2345cc(_0x373e1a[_0x7a85('0x11')][_0x7a85('0x13')]);}else{logger[_0x7a85('0xd')](_0x7a85('0x14'),_0x308967,_0x7a85('0xe'));_0x2345cc(_0x373e1a['result'][_0x7a85('0x13')]);}})[_0x7a85('0x15')](function(_0x134686){logger[_0x7a85('0x11')](_0x7a85('0x14'),_0x308967,_0x134686);_0x1e2f5b(_0x134686);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index c92adc5..e775b6e 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 _0xf701=['util','path','express','Router','../../components/auth/service','../../config/environment','./disposition.controller','get','index','show','isAuthenticated','create','put','/:id','delete','multer'];(function(_0x345ee5,_0x4b0854){var _0x1fe009=function(_0x22a1df){while(--_0x22a1df){_0x345ee5['push'](_0x345ee5['shift']());}};_0x1fe009(++_0x4b0854);}(_0xf701,0x11f));var _0x1f70=function(_0x37338c,_0x4b24c9){_0x37338c=_0x37338c-0x0;var _0x2d917c=_0xf701[_0x37338c];return _0x2d917c;};'use strict';var multer=require(_0x1f70('0x0'));var util=require(_0x1f70('0x1'));var path=require(_0x1f70('0x2'));var timeout=require('connect-timeout');var express=require(_0x1f70('0x3'));var router=express[_0x1f70('0x4')]();var auth=require(_0x1f70('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1f70('0x6'));var controller=require(_0x1f70('0x7'));router[_0x1f70('0x8')]('/',auth['isAuthenticated'](),controller[_0x1f70('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x1f70('0xa')]);router['post']('/',auth[_0x1f70('0xb')](),controller[_0x1f70('0xc')]);router[_0x1f70('0xd')](_0x1f70('0xe'),auth[_0x1f70('0xb')](),controller['update']);router[_0x1f70('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbbce=['./disposition.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xd65ee,_0xeaaeb8){var _0x927259=function(_0x406301){while(--_0x406301){_0xd65ee['push'](_0xd65ee['shift']());}};_0x927259(++_0xeaaeb8);}(_0xbbce,0x1c6));var _0xebbc=function(_0x1900df,_0x140793){_0x1900df=_0x1900df-0x0;var _0x1d79da=_0xbbce[_0x1900df];return _0x1d79da;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xebbc('0x0'));var timeout=require(_0xebbc('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xebbc('0x2'));var interaction=require(_0xebbc('0x3'));var config=require(_0xebbc('0x4'));var controller=require(_0xebbc('0x5'));router[_0xebbc('0x6')]('/',auth['isAuthenticated'](),controller[_0xebbc('0x7')]);router[_0xebbc('0x6')](_0xebbc('0x8'),auth[_0xebbc('0x9')](),controller[_0xebbc('0xa')]);router['post']('/',auth[_0xebbc('0x9')](),controller[_0xebbc('0xb')]);router[_0xebbc('0xc')](_0xebbc('0x8'),auth[_0xebbc('0x9')](),controller[_0xebbc('0xd')]);router[_0xebbc('0xe')](_0xebbc('0x8'),auth[_0xebbc('0x9')](),controller[_0xebbc('0xf')]);module[_0xebbc('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index e2ea2f2..39d5ff2 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 _0xff55=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','2400','4800','9600','12000','14400','7200','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x530cdd,_0x3e3a5c){var _0x4d1460=function(_0x48caca){while(--_0x48caca){_0x530cdd['push'](_0x530cdd['shift']());}};_0x4d1460(++_0x3e3a5c);}(_0xff55,0x123));var _0x5ff5=function(_0x1d19f3,_0xb82f56){_0x1d19f3=_0x1d19f3-0x0;var _0x9891a2=_0xff55[_0x1d19f3];return _0x9891a2;};'use strict';var Sequelize=require(_0x5ff5('0x0'));module[_0x5ff5('0x1')]={'name':{'type':Sequelize[_0x5ff5('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x5ff5('0x3')](_0x5ff5('0x4'),'no'),'defaultValue':_0x5ff5('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x5ff5('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x5ff5('0x3')](_0x5ff5('0x5'),_0x5ff5('0x6'),'7200',_0x5ff5('0x7'),_0x5ff5('0x8'),_0x5ff5('0x9')),'defaultValue':_0x5ff5('0x6')},'maxrate':{'type':Sequelize[_0x5ff5('0x3')](_0x5ff5('0x5'),_0x5ff5('0x6'),_0x5ff5('0xa'),'9600','12000',_0x5ff5('0x9')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x5ff5('0x2')],'defaultValue':_0x5ff5('0xb')},'gateway':{'type':Sequelize[_0x5ff5('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5ff5('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x5ff5('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x5ff5('0x3')](_0x5ff5('0xd'),_0x5ff5('0xe'),_0x5ff5('0xf'),_0x5ff5('0x10')),'defaultValue':_0x5ff5('0xd')},'key':{'type':Sequelize[_0x5ff5('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5ff5('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5ff5('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5ff5('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5ff5('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5ff5('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5ff5('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5ff5('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x5ff5('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x5ff5('0x12')],'defaultValue':![],'comment':_0x5ff5('0x14'),'set':function(_0x5e412f){if(!_0x5e412f)this[_0x5ff5('0x15')](_0x5ff5('0x16'),null);this[_0x5ff5('0x15')](_0x5ff5('0x17'),_0x5e412f);}}}; \ No newline at end of file +var _0x0ed5=['2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','localstationid'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x0ed5,0xf8));var _0x50ed=function(_0x57cd4f,_0x293401){_0x57cd4f=_0x57cd4f-0x0;var _0x47a2fa=_0x0ed5[_0x57cd4f];return _0x47a2fa;};'use strict';var Sequelize=require(_0x50ed('0x0'));module[_0x50ed('0x1')]={'name':{'type':Sequelize[_0x50ed('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x50ed('0x2')]},'ecm':{'type':Sequelize[_0x50ed('0x3')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x50ed('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x50ed('0x2')],'unique':_0x50ed('0x4')},'minrate':{'type':Sequelize[_0x50ed('0x3')](_0x50ed('0x5'),_0x50ed('0x6'),_0x50ed('0x7'),_0x50ed('0x8'),_0x50ed('0x9'),_0x50ed('0xa')),'defaultValue':_0x50ed('0x6')},'maxrate':{'type':Sequelize[_0x50ed('0x3')](_0x50ed('0x5'),'4800',_0x50ed('0x7'),_0x50ed('0x8'),_0x50ed('0x9'),_0x50ed('0xa')),'defaultValue':_0x50ed('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x50ed('0xb')},'gateway':{'type':Sequelize[_0x50ed('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[_0x50ed('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x50ed('0xd'),_0x50ed('0xe'),_0x50ed('0xf'),_0x50ed('0x10')),'defaultValue':_0x50ed('0xd')},'key':{'type':Sequelize[_0x50ed('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x50ed('0x11')],'defaultValue':function(){return _0x50ed('0x12');}},'notificationSound':{'type':Sequelize[_0x50ed('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x50ed('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x50ed('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x50ed('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x50ed('0x13')],'defaultValue':![],'comment':_0x50ed('0x14'),'set':function(_0x5da953){if(!_0x5da953)this[_0x50ed('0x15')]('mandatoryDispositionPauseId',null);this[_0x50ed('0x15')](_0x50ed('0x16'),_0x5da953);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index e165d66..dc8269b 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 _0x5ea2=['jayson/promise','http','client','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','update','destroy','get','UserProfileResource','end','name','send','index','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','findAll','rows','catch','params','mandatoryDispositionPause','filtears','includeAll','include','options','find','create','body','user','role','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','describe','FaxAccountId','Disposition','getDispositions','findOne','merge','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','Owner','internal','Tag','Tags','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','app','description','appdata','push','Answer','CDR(type)=inbound-fax','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','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','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','omit','tech','createdAt','updatedAt','TrunkId','ListId','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','root','server/files/attachments','CheckAfterSend','isNil','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','Messages','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','removeAgents','isArray','userFaxAccount:remove','emit','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket'];(function(_0x223e4b,_0x343132){var _0x381dde=function(_0xd19b7){while(--_0xd19b7){_0x223e4b['push'](_0x223e4b['shift']());}};_0x381dde(++_0x343132);}(_0x5ea2,0x15e));var _0x25ea=function(_0x16c825,_0x35cdf4){_0x16c825=_0x16c825-0x0;var _0x48e8b1=_0x5ea2[_0x16c825];return _0x48e8b1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x25ea('0x0'));var rimraf=require(_0x25ea('0x1'));var zipdir=require(_0x25ea('0x2'));var jsonpatch=require(_0x25ea('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x25ea('0x4'));var Mustache=require(_0x25ea('0x5'));var util=require(_0x25ea('0x6'));var path=require(_0x25ea('0x7'));var sox=require(_0x25ea('0x8'));var csv=require(_0x25ea('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x25ea('0xa'));var deskjs=require(_0x25ea('0xb'));var toCsv=require('to-csv');var querystring=require(_0x25ea('0xc'));var Papa=require('papaparse');var Redis=require(_0x25ea('0xd'));var authService=require(_0x25ea('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x25ea('0xf'));var hardwareService=require(_0x25ea('0x10'));var logger=require(_0x25ea('0x11'))('api');var utils=require(_0x25ea('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x25ea('0x13'));var db=require(_0x25ea('0x14'))['db'];config['redis']=_[_0x25ea('0x15')](config[_0x25ea('0x16')],{'host':_0x25ea('0x17'),'port':0x18eb});var socket=require(_0x25ea('0x18'))(new Redis(config[_0x25ea('0x16')]));require(_0x25ea('0x19'))['register'](socket);var jayson=require(_0x25ea('0x1a'));var client=jayson['client'][_0x25ea('0x1b')]({'port':0x232c});var client9002=jayson[_0x25ea('0x1c')][_0x25ea('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xf760f2,_0x5246d3,_0x88c832,_0x30c7c5){return new BPromise(function(_0x1d5bae,_0x26b6af){var _0x17d773=_0x30c7c5||client;return _0x17d773['request'](_0xf760f2,_0x88c832)[_0x25ea('0x1d')](function(_0x907cf3){logger[_0x25ea('0x1e')]('FaxAccount,\x20%s,\x20%s',_0x5246d3,_0x25ea('0x1f'));logger[_0x25ea('0x20')](_0x25ea('0x21'),_0x5246d3,_0x25ea('0x1f'),JSON[_0x25ea('0x22')](_0x907cf3));if(_0x907cf3[_0x25ea('0x23')]){if(_0x907cf3[_0x25ea('0x23')][_0x25ea('0x24')]===0x1f4){logger[_0x25ea('0x23')](_0x25ea('0x25'),_0x5246d3,_0x907cf3[_0x25ea('0x23')][_0x25ea('0x26')]);return _0x26b6af(_0x907cf3[_0x25ea('0x23')][_0x25ea('0x26')]);}logger[_0x25ea('0x23')](_0x25ea('0x25'),_0x5246d3,_0x907cf3[_0x25ea('0x23')][_0x25ea('0x26')]);return _0x1d5bae(_0x907cf3[_0x25ea('0x23')][_0x25ea('0x26')]);}else{logger[_0x25ea('0x1e')](_0x25ea('0x25'),_0x5246d3,_0x25ea('0x1f'));_0x1d5bae(_0x907cf3[_0x25ea('0x27')][_0x25ea('0x26')]);}})['catch'](function(_0x4b70d9){logger['error'](_0x25ea('0x25'),_0x5246d3,_0x4b70d9);_0x26b6af(_0x4b70d9);});});}function respondWithStatusCode(_0x1c4ec6,_0x49f907){_0x49f907=_0x49f907||0xcc;return function(_0x6f6af5){if(_0x6f6af5){return _0x1c4ec6[_0x25ea('0x28')](_0x49f907);}return _0x1c4ec6[_0x25ea('0x29')](_0x49f907)['end']();};}function respondWithResult(_0x5690b6,_0x2ecb96){_0x2ecb96=_0x2ecb96||0xc8;return function(_0x2573ab){if(_0x2573ab){return _0x5690b6['status'](_0x2ecb96)[_0x25ea('0x2a')](_0x2573ab);}};}function respondWithFilteredResult(_0x216fa5,_0x207415){return function(_0x348ba1){if(_0x348ba1){var _0xdece8c=_0x348ba1[_0x25ea('0x2b')],_0x37ad6d=_0x207415['offset'],_0x41e57f=_0x207415[_0x25ea('0x2c')]+_0x207415[_0x25ea('0x2d')],_0x42685e;if(_0x41e57f>=_0xdece8c){_0x41e57f=_0xdece8c;_0x42685e=0xc8;}else{_0x42685e=0xce;}_0x216fa5[_0x25ea('0x29')](_0x42685e);return _0x216fa5['set'](_0x25ea('0x2e'),_0x37ad6d+'-'+_0x41e57f+'/'+_0xdece8c)['json'](_0x348ba1);}return null;};}function patchUpdates(_0x412eca){return function(_0x3009c7){try{jsonpatch[_0x25ea('0x2f')](_0x3009c7,_0x412eca,!![]);}catch(_0x53434a){return BPromise['reject'](_0x53434a);}return _0x3009c7[_0x25ea('0x30')]();};}function saveUpdates(_0x1b21ad,_0x188538){return function(_0x13b0da){if(_0x13b0da){return _0x13b0da[_0x25ea('0x31')](_0x1b21ad)[_0x25ea('0x1d')](function(_0x26cde3){return _0x26cde3;});}return null;};}function removeEntity(_0x1ec3c1,_0x5f25e3){return function(_0x36e6cd){if(_0x36e6cd){return _0x36e6cd[_0x25ea('0x32')]()[_0x25ea('0x1d')](function(){var _0x1b188e=_0x36e6cd[_0x25ea('0x33')]({'plain':!![]});var _0x4806a5='FaxAccounts';return db[_0x25ea('0x34')][_0x25ea('0x32')]({'where':{'type':_0x4806a5,'resourceId':_0x1b188e['id']}})[_0x25ea('0x1d')](function(){return _0x36e6cd;});})[_0x25ea('0x1d')](function(){_0x1ec3c1[_0x25ea('0x29')](0xcc)[_0x25ea('0x35')]();});}};}function handleEntityNotFound(_0x11af1a,_0x2e3b8d){return function(_0x494ebe){if(!_0x494ebe){_0x11af1a['sendStatus'](0x194);}return _0x494ebe;};}function handleError(_0x4ae739,_0x351ce1){_0x351ce1=_0x351ce1||0x1f4;return function(_0x5b418e){logger[_0x25ea('0x23')](_0x5b418e['stack']);if(_0x5b418e[_0x25ea('0x36')]){delete _0x5b418e['name'];}_0x4ae739['status'](_0x351ce1)[_0x25ea('0x37')](_0x5b418e);};}exports[_0x25ea('0x38')]=function(_0x11764a,_0x172271){var _0x595400={'include':[{'model':db[_0x25ea('0x39')],'as':'mandatoryDispositionPause'}]},_0x44d037={},_0x26bcfe={'count':0x0,'rows':[]};var _0x4caa3e=_[_0x25ea('0x3a')](db[_0x25ea('0x3b')][_0x25ea('0x3c')],function(_0x544e0d){return{'name':_0x544e0d[_0x25ea('0x3d')],'type':_0x544e0d[_0x25ea('0x3e')][_0x25ea('0x3f')]};});_0x44d037[_0x25ea('0x40')]=_[_0x25ea('0x3a')](_0x4caa3e,_0x25ea('0x36'));_0x44d037['query']=_[_0x25ea('0x41')](_0x11764a[_0x25ea('0x42')]);_0x44d037[_0x25ea('0x43')]=_[_0x25ea('0x44')](_0x44d037[_0x25ea('0x40')],_0x44d037[_0x25ea('0x42')]);_0x595400[_0x25ea('0x45')]=_['intersection'](_0x44d037['model'],qs[_0x25ea('0x46')](_0x11764a[_0x25ea('0x42')][_0x25ea('0x46')]));_0x595400['attributes']=_0x595400[_0x25ea('0x45')][_0x25ea('0x47')]?_0x595400['attributes']:_0x44d037[_0x25ea('0x40')];if(!_0x11764a[_0x25ea('0x42')][_0x25ea('0x48')](_0x25ea('0x49'))){_0x595400['limit']=qs[_0x25ea('0x2d')](_0x11764a[_0x25ea('0x42')][_0x25ea('0x2d')]);_0x595400[_0x25ea('0x2c')]=qs[_0x25ea('0x2c')](_0x11764a['query'][_0x25ea('0x2c')]);}_0x595400[_0x25ea('0x4a')]=qs[_0x25ea('0x4b')](_0x11764a['query']['sort']);_0x595400[_0x25ea('0x4c')]=qs[_0x25ea('0x43')](_[_0x25ea('0x4d')](_0x11764a[_0x25ea('0x42')],_0x44d037['filters']),_0x4caa3e);if(_0x11764a[_0x25ea('0x42')][_0x25ea('0x4e')]){_0x595400[_0x25ea('0x4c')]=_['merge'](_0x595400['where'],{'$or':_[_0x25ea('0x3a')](_0x4caa3e,function(_0x2b91d8){if(_0x2b91d8['type']!==_0x25ea('0x4f')){var _0x2f28d5={};_0x2f28d5[_0x2b91d8['name']]={'$like':'%'+_0x11764a['query'][_0x25ea('0x4e')]+'%'};return _0x2f28d5;}})});}_0x595400=_['merge']({},_0x595400,_0x11764a['options']);var _0x16a5f2={'where':_0x595400['where']};return db[_0x25ea('0x3b')][_0x25ea('0x2b')](_0x16a5f2)[_0x25ea('0x1d')](function(_0x525657){_0x26bcfe[_0x25ea('0x2b')]=_0x525657;if(_0x11764a[_0x25ea('0x42')]['includeAll']){_0x595400['include']=[{'all':!![]}];}return db[_0x25ea('0x3b')][_0x25ea('0x50')](_0x595400);})[_0x25ea('0x1d')](function(_0x24fd94){_0x26bcfe[_0x25ea('0x51')]=_0x24fd94;return _0x26bcfe;})[_0x25ea('0x1d')](respondWithFilteredResult(_0x172271,_0x595400))[_0x25ea('0x52')](handleError(_0x172271,null));};exports['show']=function(_0x560228,_0x5db849){var _0x48e00={'raw':![],'where':{'id':_0x560228[_0x25ea('0x53')]['id']},'include':[{'model':db[_0x25ea('0x39')],'as':_0x25ea('0x54')}]},_0x44888b={};_0x44888b[_0x25ea('0x40')]=_[_0x25ea('0x41')](db['FaxAccount'][_0x25ea('0x3c')]);_0x44888b[_0x25ea('0x42')]=_[_0x25ea('0x41')](_0x560228[_0x25ea('0x42')]);_0x44888b[_0x25ea('0x55')]=_[_0x25ea('0x44')](_0x44888b[_0x25ea('0x40')],_0x44888b['query']);_0x48e00['attributes']=_[_0x25ea('0x44')](_0x44888b[_0x25ea('0x40')],qs[_0x25ea('0x46')](_0x560228[_0x25ea('0x42')][_0x25ea('0x46')]));_0x48e00[_0x25ea('0x45')]=_0x48e00[_0x25ea('0x45')]['length']?_0x48e00['attributes']:_0x44888b[_0x25ea('0x40')];if(_0x560228['query'][_0x25ea('0x56')]){_0x48e00[_0x25ea('0x57')]=[{'all':!![]}];}_0x48e00=_['merge']({},_0x48e00,_0x560228[_0x25ea('0x58')]);return db[_0x25ea('0x3b')][_0x25ea('0x59')](_0x48e00)[_0x25ea('0x1d')](handleEntityNotFound(_0x5db849,null))[_0x25ea('0x1d')](respondWithResult(_0x5db849,null))['catch'](handleError(_0x5db849,null));};exports['create']=function(_0x576715,_0x256cd1){return db['FaxAccount'][_0x25ea('0x5a')](_0x576715[_0x25ea('0x5b')],{})[_0x25ea('0x1d')](function(_0x147e67){var _0x1c9575=_0x576715[_0x25ea('0x5c')][_0x25ea('0x33')]({'plain':!![]});if(!_0x1c9575)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c9575[_0x25ea('0x5d')]==='user'){var _0x13ba27=_0x147e67[_0x25ea('0x33')]({'plain':!![]});var _0x5c994a=_0x25ea('0x5e');return db[_0x25ea('0x5f')]['find']({'where':{'name':_0x5c994a,'userProfileId':_0x1c9575[_0x25ea('0x60')]},'raw':!![]})['then'](function(_0x485747){if(_0x485747&&_0x485747[_0x25ea('0x61')]===0x0){return db[_0x25ea('0x34')][_0x25ea('0x5a')]({'name':_0x13ba27['name'],'resourceId':_0x13ba27['id'],'type':_0x485747[_0x25ea('0x36')],'sectionId':_0x485747['id']},{})[_0x25ea('0x1d')](function(){return _0x147e67;});}else{return _0x147e67;}})[_0x25ea('0x52')](function(_0x18a0bf){logger[_0x25ea('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18a0bf);throw _0x18a0bf;});}return _0x147e67;})[_0x25ea('0x1d')](respondWithResult(_0x256cd1,0xc9))[_0x25ea('0x52')](handleError(_0x256cd1,null));};exports[_0x25ea('0x31')]=function(_0x120bd2,_0x48726f){if(_0x120bd2[_0x25ea('0x5b')]['id']){delete _0x120bd2['body']['id'];}return db[_0x25ea('0x3b')][_0x25ea('0x59')]({'where':{'id':_0x120bd2['params']['id']},'include':[{'model':db['Pause'],'as':_0x25ea('0x54')}]})['then'](handleEntityNotFound(_0x48726f,null))[_0x25ea('0x1d')](saveUpdates(_0x120bd2[_0x25ea('0x5b')],null))['then'](respondWithResult(_0x48726f,null))['catch'](handleError(_0x48726f,null));};exports[_0x25ea('0x32')]=function(_0x3d2c6b,_0x227bc0){return db[_0x25ea('0x3b')][_0x25ea('0x59')]({'where':{'id':_0x3d2c6b[_0x25ea('0x53')]['id']}})['then'](handleEntityNotFound(_0x227bc0,null))[_0x25ea('0x1d')](removeEntity(_0x227bc0,null))[_0x25ea('0x52')](handleError(_0x227bc0,null));};exports[_0x25ea('0x62')]=function(_0x264805,_0x473dac){return db[_0x25ea('0x3b')][_0x25ea('0x62')]()[_0x25ea('0x1d')](respondWithResult(_0x473dac,null))['catch'](handleError(_0x473dac,null));};exports['addDisposition']=function(_0x338f4d,_0x1adfb0,_0x46715b){if(_0x338f4d[_0x25ea('0x5b')]['id']){delete _0x338f4d['body']['id'];}return db[_0x25ea('0x3b')][_0x25ea('0x59')]({'where':{'id':_0x338f4d['params']['id']}})[_0x25ea('0x1d')](handleEntityNotFound(_0x1adfb0,null))['then'](function(_0x2e9c17){if(_0x2e9c17){_0x338f4d[_0x25ea('0x5b')][_0x25ea('0x63')]=_0x2e9c17['id'];return db[_0x25ea('0x64')][_0x25ea('0x5a')](_0x338f4d[_0x25ea('0x5b')]);}})[_0x25ea('0x1d')](respondWithResult(_0x1adfb0,null))[_0x25ea('0x52')](handleError(_0x1adfb0,null));};exports[_0x25ea('0x65')]=function(_0x3e7597,_0x2f2bb6,_0x11462d){var _0x22e1a3={'raw':![],'where':{}};var _0xb992bb={};var _0x29bf76={'count':0x0,'rows':[]};return db[_0x25ea('0x3b')][_0x25ea('0x66')]({'where':{'id':_0x3e7597[_0x25ea('0x53')]['id']}})['then'](handleEntityNotFound(_0x2f2bb6,null))[_0x25ea('0x1d')](function(_0x12cfe6){if(_0x12cfe6){_0xb992bb[_0x25ea('0x40')]=_[_0x25ea('0x41')](db[_0x25ea('0x64')]['rawAttributes']);_0xb992bb[_0x25ea('0x42')]=_[_0x25ea('0x41')](_0x3e7597[_0x25ea('0x42')]);_0xb992bb[_0x25ea('0x43')]=_[_0x25ea('0x44')](_0xb992bb[_0x25ea('0x40')],_0xb992bb['query']);_0x22e1a3[_0x25ea('0x45')]=_['intersection'](_0xb992bb[_0x25ea('0x40')],qs['fields'](_0x3e7597[_0x25ea('0x42')][_0x25ea('0x46')]));_0x22e1a3[_0x25ea('0x45')]=_0x22e1a3[_0x25ea('0x45')][_0x25ea('0x47')]?_0x22e1a3[_0x25ea('0x45')]:_0xb992bb[_0x25ea('0x40')];if(!_0x3e7597[_0x25ea('0x42')][_0x25ea('0x48')]('nolimit')){_0x22e1a3[_0x25ea('0x2d')]=qs[_0x25ea('0x2d')](_0x3e7597[_0x25ea('0x42')][_0x25ea('0x2d')]);_0x22e1a3[_0x25ea('0x2c')]=qs[_0x25ea('0x2c')](_0x3e7597[_0x25ea('0x42')][_0x25ea('0x2c')]);}_0x22e1a3[_0x25ea('0x4a')]=qs[_0x25ea('0x4b')](_0x3e7597[_0x25ea('0x42')][_0x25ea('0x4b')]);_0x22e1a3['where']=qs[_0x25ea('0x43')](_['pick'](_0x3e7597[_0x25ea('0x42')],_0xb992bb['filters']));_0x22e1a3[_0x25ea('0x4c')][_0x25ea('0x63')]=_0x12cfe6['id'];if(_0x3e7597['query'][_0x25ea('0x4e')]){_0x22e1a3[_0x25ea('0x4c')]=_[_0x25ea('0x67')](_0x22e1a3['where'],{'$or':_[_0x25ea('0x3a')](_0x22e1a3['attributes'],function(_0xd37af9){var _0x2280da={};_0x2280da[_0xd37af9]={'$like':'%'+_0x3e7597[_0x25ea('0x42')][_0x25ea('0x4e')]+'%'};return _0x2280da;})});}_0x22e1a3=_[_0x25ea('0x67')]({},_0x22e1a3,_0x3e7597[_0x25ea('0x58')]);return db[_0x25ea('0x64')][_0x25ea('0x2b')]({'where':_0x22e1a3[_0x25ea('0x4c')]})[_0x25ea('0x1d')](function(_0x27a17f){_0x29bf76[_0x25ea('0x2b')]=_0x27a17f;if(_0x3e7597[_0x25ea('0x42')]['includeAll']){_0x22e1a3['include']=[{'all':!![]}];}return db['Disposition'][_0x25ea('0x50')](_0x22e1a3);})[_0x25ea('0x1d')](function(_0x2c001c){_0x29bf76[_0x25ea('0x51')]=_0x2c001c;return _0x29bf76;});}})[_0x25ea('0x1d')](respondWithFilteredResult(_0x2f2bb6,_0x22e1a3))['catch'](handleError(_0x2f2bb6,null));};exports[_0x25ea('0x68')]=function(_0x189b46,_0x5e8dd5,_0x8d3d7e){return db[_0x25ea('0x3b')]['find']({'where':{'id':_0x189b46['params']['id']}})[_0x25ea('0x1d')](handleEntityNotFound(_0x5e8dd5,null))[_0x25ea('0x1d')](function(_0x3d1412){if(_0x3d1412){return _0x3d1412['removeDispositions'](_0x189b46[_0x25ea('0x42')][_0x25ea('0x69')]);}})[_0x25ea('0x1d')](respondWithStatusCode(_0x5e8dd5,null))['catch'](handleError(_0x5e8dd5,null));};exports['addAnswer']=function(_0x1c9ddd,_0x22068c,_0x1529c0){if(_0x1c9ddd[_0x25ea('0x5b')]['id']){delete _0x1c9ddd[_0x25ea('0x5b')]['id'];}return db[_0x25ea('0x3b')][_0x25ea('0x59')]({'where':{'id':_0x1c9ddd[_0x25ea('0x53')]['id']}})['then'](handleEntityNotFound(_0x22068c,null))[_0x25ea('0x1d')](function(_0x2ec685){if(_0x2ec685){_0x1c9ddd[_0x25ea('0x5b')]['FaxAccountId']=_0x2ec685['id'];return db['CannedAnswer'][_0x25ea('0x5a')](_0x1c9ddd[_0x25ea('0x5b')]);}})[_0x25ea('0x1d')](respondWithResult(_0x22068c,null))[_0x25ea('0x52')](handleError(_0x22068c,null));};exports[_0x25ea('0x6a')]=function(_0x37e882,_0x8a6b5c,_0x1f7357){var _0x1328b8={'raw':![],'where':{}};var _0x86eda7={};var _0x4c1f31={'count':0x0,'rows':[]};return db[_0x25ea('0x3b')][_0x25ea('0x66')]({'where':{'id':_0x37e882[_0x25ea('0x53')]['id']}})[_0x25ea('0x1d')](handleEntityNotFound(_0x8a6b5c,null))['then'](function(_0x4d4460){if(_0x4d4460){_0x86eda7[_0x25ea('0x40')]=_[_0x25ea('0x41')](db[_0x25ea('0x6b')][_0x25ea('0x3c')]);_0x86eda7['query']=_[_0x25ea('0x41')](_0x37e882['query']);_0x86eda7[_0x25ea('0x43')]=_[_0x25ea('0x44')](_0x86eda7[_0x25ea('0x40')],_0x86eda7[_0x25ea('0x42')]);_0x1328b8[_0x25ea('0x45')]=_['intersection'](_0x86eda7[_0x25ea('0x40')],qs[_0x25ea('0x46')](_0x37e882[_0x25ea('0x42')][_0x25ea('0x46')]));_0x1328b8['attributes']=_0x1328b8[_0x25ea('0x45')][_0x25ea('0x47')]?_0x1328b8[_0x25ea('0x45')]:_0x86eda7[_0x25ea('0x40')];if(!_0x37e882[_0x25ea('0x42')]['hasOwnProperty'](_0x25ea('0x49'))){_0x1328b8[_0x25ea('0x2d')]=qs[_0x25ea('0x2d')](_0x37e882[_0x25ea('0x42')][_0x25ea('0x2d')]);_0x1328b8[_0x25ea('0x2c')]=qs[_0x25ea('0x2c')](_0x37e882['query']['offset']);}_0x1328b8['order']=qs[_0x25ea('0x4b')](_0x37e882[_0x25ea('0x42')][_0x25ea('0x4b')]);_0x1328b8[_0x25ea('0x4c')]=qs[_0x25ea('0x43')](_[_0x25ea('0x4d')](_0x37e882[_0x25ea('0x42')],_0x86eda7[_0x25ea('0x43')]));_0x1328b8[_0x25ea('0x4c')]['FaxAccountId']=_0x4d4460['id'];if(_0x37e882['query'][_0x25ea('0x4e')]){_0x1328b8['where']=_['merge'](_0x1328b8[_0x25ea('0x4c')],{'$or':_['map'](_0x1328b8[_0x25ea('0x45')],function(_0x7edf33){var _0x38aaaf={};_0x38aaaf[_0x7edf33]={'$like':'%'+_0x37e882[_0x25ea('0x42')][_0x25ea('0x4e')]+'%'};return _0x38aaaf;})});}_0x1328b8=_['merge']({},_0x1328b8,_0x37e882['options']);return db[_0x25ea('0x6b')]['count']({'where':_0x1328b8[_0x25ea('0x4c')]})[_0x25ea('0x1d')](function(_0x2d2b37){_0x4c1f31[_0x25ea('0x2b')]=_0x2d2b37;if(_0x37e882[_0x25ea('0x42')]['includeAll']){_0x1328b8[_0x25ea('0x57')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x1328b8);})[_0x25ea('0x1d')](function(_0x5ca6d1){_0x4c1f31[_0x25ea('0x51')]=_0x5ca6d1;return _0x4c1f31;});}})[_0x25ea('0x1d')](respondWithFilteredResult(_0x8a6b5c,_0x1328b8))[_0x25ea('0x52')](handleError(_0x8a6b5c,null));};exports[_0x25ea('0x6c')]=function(_0x26221a,_0x3a1578,_0x30cb28){return db[_0x25ea('0x3b')][_0x25ea('0x59')]({'where':{'id':_0x26221a[_0x25ea('0x53')]['id']}})[_0x25ea('0x1d')](handleEntityNotFound(_0x3a1578,null))['then'](function(_0x66b63d){if(_0x66b63d){return _0x66b63d[_0x25ea('0x6c')](_0x26221a[_0x25ea('0x42')][_0x25ea('0x69')]);}})[_0x25ea('0x1d')](respondWithStatusCode(_0x3a1578,null))[_0x25ea('0x52')](handleError(_0x3a1578,null));};exports[_0x25ea('0x6d')]=function(_0x2a3d36,_0x3eae50,_0x90587b){return db[_0x25ea('0x6e')]['find']({'where':{'id':_0x2a3d36['params']['id']}})[_0x25ea('0x1d')](handleEntityNotFound(_0x3eae50,null))[_0x25ea('0x1d')](function(_0x19112b){if(_0x19112b){return _0x19112b[_0x25ea('0x6d')](_0x2a3d36[_0x25ea('0x5b')]['ids'],_['omit'](_0x2a3d36[_0x25ea('0x5b')],[_0x25ea('0x69'),'id'])||{});}})[_0x25ea('0x1d')](respondWithResult(_0x3eae50,null))[_0x25ea('0x52')](handleError(_0x3eae50,null));};exports[_0x25ea('0x6f')]=function(_0x3bec93,_0x3fdb56,_0x36d405){var _0x31caa1={'raw':![],'where':{}};var _0x324d19={};var _0x4f0565={'count':0x0,'rows':[]};return db[_0x25ea('0x3b')][_0x25ea('0x66')]({'where':{'id':_0x3bec93[_0x25ea('0x53')]['id']}})[_0x25ea('0x1d')](handleEntityNotFound(_0x3fdb56,null))[_0x25ea('0x1d')](function(_0x200a7f){if(_0x200a7f){_0x324d19[_0x25ea('0x40')]=_[_0x25ea('0x41')](db[_0x25ea('0x6e')][_0x25ea('0x3c')]);_0x324d19[_0x25ea('0x42')]=_['keys'](_0x3bec93['query']);_0x324d19[_0x25ea('0x43')]=_['intersection'](_0x324d19[_0x25ea('0x40')],_0x324d19[_0x25ea('0x42')]);_0x31caa1[_0x25ea('0x45')]=_[_0x25ea('0x44')](_0x324d19[_0x25ea('0x40')],qs[_0x25ea('0x46')](_0x3bec93[_0x25ea('0x42')][_0x25ea('0x46')]));_0x31caa1[_0x25ea('0x45')]=_0x31caa1[_0x25ea('0x45')][_0x25ea('0x47')]?_0x31caa1['attributes']:_0x324d19[_0x25ea('0x40')];if(!_0x3bec93[_0x25ea('0x42')][_0x25ea('0x48')](_0x25ea('0x49'))){_0x31caa1[_0x25ea('0x2d')]=qs[_0x25ea('0x2d')](_0x3bec93[_0x25ea('0x42')][_0x25ea('0x2d')]);_0x31caa1[_0x25ea('0x2c')]=qs['offset'](_0x3bec93[_0x25ea('0x42')][_0x25ea('0x2c')]);}_0x31caa1[_0x25ea('0x4a')]=qs[_0x25ea('0x4b')](_0x3bec93[_0x25ea('0x42')][_0x25ea('0x4b')]);_0x31caa1[_0x25ea('0x4c')]=qs['filters'](_['pick'](_0x3bec93[_0x25ea('0x42')],_0x324d19['filters']));_0x31caa1[_0x25ea('0x4c')]['FaxAccountId']=_0x200a7f['id'];if(_0x3bec93[_0x25ea('0x42')]['filter']){_0x31caa1['where']=_[_0x25ea('0x67')](_0x31caa1['where'],{'$or':_['map'](_0x31caa1['attributes'],function(_0x1e3b8b){var _0x114cba={};_0x114cba[_0x1e3b8b]={'$like':'%'+_0x3bec93[_0x25ea('0x42')][_0x25ea('0x4e')]+'%'};return _0x114cba;})});}_0x31caa1=_['merge']({},_0x31caa1,_0x3bec93[_0x25ea('0x58')]);return db[_0x25ea('0x6e')][_0x25ea('0x2b')]({'where':_0x31caa1[_0x25ea('0x4c')]})[_0x25ea('0x1d')](function(_0x2a6f19){_0x4f0565[_0x25ea('0x2b')]=_0x2a6f19;if(_0x3bec93[_0x25ea('0x42')][_0x25ea('0x56')]){_0x31caa1['include']=[{'model':db[_0x25ea('0x70')],'as':_0x25ea('0x71'),'required':![]},{'model':db['User'],'as':_0x25ea('0x72'),'attributes':['name','fullname',_0x25ea('0x73')],'required':![]},{'model':db[_0x25ea('0x74')],'as':_0x25ea('0x75'),'attributes':['id',_0x25ea('0x36'),'color'],'where':_0x3bec93[_0x25ea('0x42')]['tag']?{'id':_0x3bec93[_0x25ea('0x42')][_0x25ea('0x76')]}:undefined,'required':_0x3bec93['query'][_0x25ea('0x76')]?!![]:![]}];}return db[_0x25ea('0x6e')][_0x25ea('0x50')](_0x31caa1);})[_0x25ea('0x1d')](function(_0x8e326c){_0x4f0565['rows']=_0x8e326c;return _0x4f0565;});}})[_0x25ea('0x1d')](respondWithFilteredResult(_0x3fdb56,_0x31caa1))[_0x25ea('0x52')](handleError(_0x3fdb56,null));};exports[_0x25ea('0x77')]=function(_0x1e2956,_0xfe8034,_0x115a80){return db[_0x25ea('0x3b')][_0x25ea('0x66')]({'where':{'id':_0x1e2956['params']['id']}})['then'](handleEntityNotFound(_0xfe8034,null))[_0x25ea('0x1d')](function(_0x443a51){if(_0x443a51){return db[_0x25ea('0x78')][_0x25ea('0x79')](function(_0x537b49){return db['FaxApplication'][_0x25ea('0x32')]({'where':{'FaxAccountId':_0x1e2956[_0x25ea('0x53')]['id']},'transaction':_0x537b49})[_0x25ea('0x1d')](function(_0x594223){var _0x2f5251=_[_0x25ea('0x3a')](_0x1e2956[_0x25ea('0x5b')],function(_0x18f53b){_0x18f53b[_0x25ea('0x63')]=_0x1e2956[_0x25ea('0x53')]['id'];return _0x18f53b;});return db[_0x25ea('0x7a')][_0x25ea('0x7b')](_0x2f5251,{'transaction':_0x537b49});});})[_0x25ea('0x1d')](function(){return db['FaxApplication'][_0x25ea('0x7c')]({'where':{'FaxAccountId':_0x1e2956[_0x25ea('0x53')]['id']},'order':_0x25ea('0x7d')});});}})[_0x25ea('0x1d')](respondWithResult(_0xfe8034,null))[_0x25ea('0x52')](handleError(_0xfe8034,null));};exports[_0x25ea('0x7e')]=function(_0xcb75a7,_0x3d6ab3,_0x51f209){var _0x33f238={};var _0x3b719e={};var _0x3b3c5f;var _0x4099bf;return db[_0x25ea('0x3b')][_0x25ea('0x66')]({'where':{'id':_0xcb75a7[_0x25ea('0x53')]['id']}})[_0x25ea('0x1d')](handleEntityNotFound(_0x3d6ab3,null))['then'](function(_0x4e30e6){if(_0x4e30e6){_0x3b3c5f=_0x4e30e6;_0x3b719e[_0x25ea('0x40')]=_[_0x25ea('0x41')](db['FaxApplication']['rawAttributes']);_0x3b719e['query']=_[_0x25ea('0x41')](_0xcb75a7['query']);_0x3b719e[_0x25ea('0x43')]=_[_0x25ea('0x44')](_0x3b719e[_0x25ea('0x40')],_0x3b719e[_0x25ea('0x42')]);_0x33f238[_0x25ea('0x45')]=_[_0x25ea('0x44')](_0x3b719e[_0x25ea('0x40')],qs['fields'](_0xcb75a7[_0x25ea('0x42')][_0x25ea('0x46')]));_0x33f238[_0x25ea('0x45')]=_0x33f238[_0x25ea('0x45')]['length']?_0x33f238['attributes']:_0x3b719e[_0x25ea('0x40')];_0x33f238[_0x25ea('0x4a')]=qs[_0x25ea('0x4b')](_0xcb75a7[_0x25ea('0x42')]['sort']);_0x33f238[_0x25ea('0x4c')]=qs[_0x25ea('0x43')](_[_0x25ea('0x4d')](_0xcb75a7[_0x25ea('0x42')],_0x3b719e['filters']));if(_0xcb75a7[_0x25ea('0x42')][_0x25ea('0x4e')]){_0x33f238[_0x25ea('0x4c')]=_[_0x25ea('0x67')](_0x33f238[_0x25ea('0x4c')],{'$or':_[_0x25ea('0x3a')](_0x33f238[_0x25ea('0x45')],function(_0x20316a){var _0x23090b={};_0x23090b[_0x20316a]={'$like':'%'+_0xcb75a7[_0x25ea('0x42')][_0x25ea('0x4e')]+'%'};return _0x23090b;})});}_0x33f238=_[_0x25ea('0x67')]({},_0x33f238,_0xcb75a7[_0x25ea('0x58')]);return _0x3b3c5f[_0x25ea('0x7e')](_0x33f238);}})['then'](function(_0x67e27b){if(_0x67e27b){_0x4099bf=_0x67e27b[_0x25ea('0x47')];if(!_0xcb75a7['query']['hasOwnProperty'](_0x25ea('0x49'))){_0x33f238['limit']=qs['limit'](_0xcb75a7['query'][_0x25ea('0x2d')]);_0x33f238[_0x25ea('0x2c')]=qs[_0x25ea('0x2c')](_0xcb75a7[_0x25ea('0x42')][_0x25ea('0x2c')]);}return _0x3b3c5f[_0x25ea('0x7e')](_0x33f238);}})['then'](function(_0x44bc7c){if(_0x44bc7c){return _0x44bc7c?{'count':_0x4099bf,'rows':_0x44bc7c}:null;}})['then'](respondWithResult(_0x3d6ab3,null))[_0x25ea('0x52')](handleError(_0x3d6ab3,null));};function Extension(_0x11e90d,_0x3b257e,_0x4f0123,_0x4535f5){this['context']=_0x25ea('0x7f');this['exten']=_0x11e90d['localstationid'];this[_0x25ea('0x80')]=_0x4535f5;this[_0x25ea('0x3e')]='system';this[_0x25ea('0x81')]='Fax\x20Extension';this[_0x25ea('0x63')]=_0x11e90d['id'];this[_0x25ea('0x7d')]=_0x3b257e;this[_0x25ea('0x82')]=_0x4f0123;}function createExtensionsReciveFax(_0x3a03a1){var _0x3c5884=0x1;var _0x99d695=[];_0x99d695[_0x25ea('0x83')](new Extension(_0x3a03a1,_0x3c5884,'',_0x25ea('0x84')));_0x3c5884+=0x1;_0x99d695[_0x25ea('0x83')](new Extension(_0x3a03a1,_0x3c5884,_0x25ea('0x85'),'Set'));_0x3c5884+=0x1;for(var _0x33da10 in _0x3a03a1){if(_0x3a03a1[_0x25ea('0x48')](_0x33da10)&&(_0x33da10==='ecm'||_0x33da10===_0x25ea('0x86')||_0x33da10===_0x25ea('0x87')||_0x33da10===_0x25ea('0x88')||_0x33da10===_0x25ea('0x89')||_0x33da10===_0x25ea('0x8a')||_0x33da10===_0x25ea('0x8b')||_0x33da10==='modem'||_0x33da10===_0x25ea('0x8c'))){_0x99d695[_0x25ea('0x83')](new Extension(_0x3a03a1,_0x3c5884,_0x25ea('0x8d')+_0x33da10+')='+_0x3a03a1[_0x33da10],_0x25ea('0x8e')));_0x3c5884+=0x1;}}_0x99d695['push'](new Extension(_0x3a03a1,_0x3c5884,'6',_0x25ea('0x8f')));_0x3c5884+=0x1;_0x99d695[_0x25ea('0x83')](new Extension(_0x3a03a1,_0x3c5884,_0x25ea('0x90'),_0x25ea('0x91')));_0x3c5884=0x0;return _0x99d695;}exports[_0x25ea('0x92')]=function(_0x3992da,_0x3be959,_0x1d44ce){var _0x289b3d;return db[_0x25ea('0x78')][_0x25ea('0x79')](function(_0x32e97b){return db[_0x25ea('0x3b')][_0x25ea('0x5a')](_0x3992da['body'],{'transaction':_0x32e97b})[_0x25ea('0x1d')](function(_0x14d7e3){_0x289b3d=_0x14d7e3[_0x25ea('0x33')]({'plain':!![]});return db['VoiceExtension'][_0x25ea('0x7b')](createExtensionsReciveFax(_0x289b3d),{'transaction':_0x32e97b});});})['then'](function(){return _0x289b3d;})[_0x25ea('0x1d')](respondWithResult(_0x3be959,null))[_0x25ea('0x52')](handleError(_0x3be959,null));};exports[_0x25ea('0x93')]=function(_0x418886,_0x49fae1,_0x57c19d){var _0xe5c59e;return db['sequelize']['transaction'](function(_0x2eecf5){return db[_0x25ea('0x3b')][_0x25ea('0x31')](_0x418886['body'],{'where':{'id':_0x418886['body']['id']},'transaction':_0x2eecf5})[_0x25ea('0x1d')](function(_0x4f0550){return db[_0x25ea('0x94')][_0x25ea('0x32')]({'where':{'FaxAccountId':_0x418886[_0x25ea('0x5b')]['id']},'transaction':_0x2eecf5})[_0x25ea('0x1d')](function(_0x2db93e){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x25ea('0x95')](_0x418886[_0x25ea('0x5b')],[_0x25ea('0x96'),_0x25ea('0x3f'),_0x25ea('0x97'),_0x25ea('0x98'),_0x25ea('0x99'),_0x25ea('0x9a')])),{'transaction':_0x2eecf5});});});})[_0x25ea('0x1d')](function(){return db[_0x25ea('0x3b')]['findById'](_0x418886[_0x25ea('0x5b')]['id']);})['then'](respondWithResult(_0x49fae1,null))[_0x25ea('0x52')](handleError(_0x49fae1,null));};exports['getMessages']=function(_0x22fa45,_0x39db1b,_0x85f3a6){var _0x62d824={'raw':!![],'where':{}};var _0x4535d4={};var _0x390ae2={'count':0x0,'rows':[]};return db[_0x25ea('0x3b')][_0x25ea('0x66')]({'where':{'id':_0x22fa45[_0x25ea('0x53')]['id']}})[_0x25ea('0x1d')](handleEntityNotFound(_0x39db1b,null))[_0x25ea('0x1d')](function(_0x3aa3dd){if(_0x3aa3dd){_0x4535d4['model']=_[_0x25ea('0x41')](db[_0x25ea('0x9b')][_0x25ea('0x3c')]);_0x4535d4[_0x25ea('0x42')]=_['keys'](_0x22fa45['query']);_0x4535d4[_0x25ea('0x43')]=_[_0x25ea('0x44')](_0x4535d4['model'],_0x4535d4[_0x25ea('0x42')]);_0x62d824['attributes']=_[_0x25ea('0x44')](_0x4535d4[_0x25ea('0x40')],qs[_0x25ea('0x46')](_0x22fa45[_0x25ea('0x42')][_0x25ea('0x46')]));_0x62d824[_0x25ea('0x45')]=_0x62d824['attributes'][_0x25ea('0x47')]?_0x62d824['attributes']:_0x4535d4[_0x25ea('0x40')];if(!_0x22fa45[_0x25ea('0x42')][_0x25ea('0x48')](_0x25ea('0x49'))){_0x62d824[_0x25ea('0x2d')]=qs[_0x25ea('0x2d')](_0x22fa45['query'][_0x25ea('0x2d')]);_0x62d824[_0x25ea('0x2c')]=qs[_0x25ea('0x2c')](_0x22fa45[_0x25ea('0x42')]['offset']);}_0x62d824['order']=qs['sort'](_0x22fa45[_0x25ea('0x42')][_0x25ea('0x4b')]);_0x62d824[_0x25ea('0x4c')]=qs[_0x25ea('0x43')](_['pick'](_0x22fa45['query'],_0x4535d4[_0x25ea('0x43')]));_0x62d824['where']['FaxAccountId']=_0x3aa3dd['id'];if(_0x22fa45[_0x25ea('0x42')][_0x25ea('0x4e')]){_0x62d824[_0x25ea('0x4c')]=_[_0x25ea('0x67')](_0x62d824['where'],{'$or':_[_0x25ea('0x3a')](_0x62d824[_0x25ea('0x45')],function(_0x3dfa0a){var _0x1e24eb={};_0x1e24eb[_0x3dfa0a]={'$like':'%'+_0x22fa45[_0x25ea('0x42')]['filter']+'%'};return _0x1e24eb;})});}if(_0x22fa45['query'][_0x25ea('0x9c')]){var _0x452a0d=_0x22fa45['query'][_0x25ea('0x9c')][_0x25ea('0x9d')](',');var _0x5f375d={};_0x5f375d[_0x452a0d[0x0]]={'$gte':moment(_0x452a0d[0x1])[_0x25ea('0x9e')](_0x25ea('0x9f'))};_0x62d824['where']=_[_0x25ea('0x67')](_0x62d824[_0x25ea('0x4c')],_0x5f375d);}_0x62d824=_[_0x25ea('0x67')]({},_0x62d824,_0x22fa45[_0x25ea('0x58')]);return db[_0x25ea('0x9b')][_0x25ea('0x2b')]({'where':_0x62d824[_0x25ea('0x4c')]})[_0x25ea('0x1d')](function(_0x323c66){_0x390ae2[_0x25ea('0x2b')]=_0x323c66;if(_0x22fa45[_0x25ea('0x42')][_0x25ea('0x56')]){_0x62d824['include']=[{'all':!![]}];}return db[_0x25ea('0x9b')][_0x25ea('0x50')](_0x62d824);})['then'](function(_0x273385){_0x390ae2[_0x25ea('0x51')]=_0x273385;return _0x390ae2;});}})['then'](respondWithFilteredResult(_0x39db1b,_0x62d824))['catch'](handleError(_0x39db1b,null));};exports[_0x25ea('0x37')]=function(_0x4449c6,_0x1ca216,_0x528f13){var _0x2f3cd5,_0x49a93d={},_0x49f01f;if(_0x4449c6[_0x25ea('0x5b')]['to']){_0x49f01f=_0x4449c6[_0x25ea('0x5b')]['to'][0x0];}return db['FaxAccount'][_0x25ea('0x59')]({'where':{'id':_0x4449c6[_0x25ea('0x53')]['id']},'include':[{'model':db['CmList'],'as':_0x25ea('0xa0'),'include':[{'model':db[_0x25ea('0x70')],'as':_0x25ea('0xa1'),'where':{'fax':_0x49f01f},'limit':0x1,'order':[['updatedAt',_0x25ea('0xa2')]]}]}]})[_0x25ea('0x1d')](handleEntityNotFound(_0x1ca216,null))['then'](function(_0x52c79a){_0x2f3cd5=_0x52c79a;if(_0x4449c6['body'][_0x25ea('0xa3')]&&_0x4449c6[_0x25ea('0x5b')][_0x25ea('0xa3')][_0x25ea('0x47')]){for(var _0x118947=0x0;_0x118947<_0x4449c6[_0x25ea('0x5b')]['attachments']['length'];_0x118947+=0x1){_0x4449c6['body'][_0x25ea('0xa3')][_0x118947]={'filename':_0x4449c6[_0x25ea('0x5b')]['attachments'][_0x118947][_0x25ea('0x36')],'id':_0x4449c6[_0x25ea('0x5b')][_0x25ea('0xa3')][_0x118947]['id'],'path':path['join'](config[_0x25ea('0xa4')],_0x25ea('0xa5'),_0x4449c6[_0x25ea('0x5b')][_0x25ea('0xa3')][_0x118947]['basename'])};}}return respondWithRpcPromise(_0x25ea('0xa6'),'CheckAfterSend',{'FaxAccountId':_[_0x25ea('0xa7')](_0x4449c6['params']['id'])?undefined:_0x4449c6[_0x25ea('0x53')]['id'],'path':_[_0x25ea('0xa7')](_0x4449c6['body'][_0x25ea('0xa3')][0x0][_0x25ea('0x7')])?undefined:_0x4449c6[_0x25ea('0x5b')][_0x25ea('0xa3')][0x0][_0x25ea('0x7')],'fax':_[_0x25ea('0xa7')](_0x4449c6[_0x25ea('0x5b')]['to'][0x0])?undefined:_0x4449c6[_0x25ea('0x5b')]['to'][0x0]},client9002);})['then'](function(){if(_0x2f3cd5){if(_[_0x25ea('0xa7')](_0x4449c6[_0x25ea('0x5b')]['from'])){_0x4449c6[_0x25ea('0x5b')]['from']=util[_0x25ea('0x9e')](_0x25ea('0xa8'),_0x2f3cd5[_0x25ea('0x36')],_0x2f3cd5[_0x25ea('0xa9')]);}if(_0x2f3cd5[_0x25ea('0xa0')]){if(_0x2f3cd5[_0x25ea('0xa0')][_0x25ea('0xa1')]['length']){return _0x2f3cd5['List'][_0x25ea('0xa1')][0x0];}else{return db[_0x25ea('0x70')][_0x25ea('0x5a')](_[_0x25ea('0x15')](_0x4449c6[_0x25ea('0x5b')],{'firstName':_0x4449c6[_0x25ea('0x5b')]['to'][0x0],'phone':_0x4449c6[_0x25ea('0x5b')]['to'][0x0],'fax':_0x4449c6[_0x25ea('0x5b')]['to'][0x0],'ListId':_0x2f3cd5[_0x25ea('0x9a')]}));}}else{throw new Error(_0x25ea('0xaa'));}}else{throw new Error(_0x25ea('0xab'));}})[_0x25ea('0x1d')](function(_0x29590f){if(_0x29590f){return db[_0x25ea('0x6e')][_0x25ea('0x59')]({'where':{'ContactId':_0x29590f['id'],'closed':![],'FaxAccountId':_0x2f3cd5['id']}})[_0x25ea('0x1d')](function(_0x5ce50c){if(_0x5ce50c){return[_0x5ce50c,![]];}return db[_0x25ea('0x6e')][_0x25ea('0x5a')]({'UserId':_0x4449c6['user']['id'],'ContactId':_0x29590f['id'],'FaxAccountId':_0x2f3cd5['id'],'fax':_0x4449c6[_0x25ea('0x5b')]['to'][0x0],'firstMsgDirection':_0x25ea('0xac'),'Messages':[_[_0x25ea('0x67')](_0x4449c6[_0x25ea('0x5b')],{'read':![],'body':_0x4449c6['body'][_0x25ea('0xa3')][0x0][_0x25ea('0xad')],'FaxAccountId':_0x2f3cd5['id'],'UserId':_0x4449c6[_0x25ea('0x5c')]['id'],'ContactId':_0x29590f['id'],'AttachmentId':_0x4449c6['body'][_0x25ea('0xa3')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})['then'](function(_0x49209f){return[_0x49209f,!![]];});});}else{throw new Error(_0x25ea('0xae'));}})[_0x25ea('0xaf')](function(_0x2f8087,_0x344738){if(_0x344738){return _0x2f8087;}return db[_0x25ea('0x9b')][_0x25ea('0x5a')]({'direction':_0x25ea('0xac'),'read':![],'body':_0x4449c6[_0x25ea('0x5b')][_0x25ea('0xa3')][0x0][_0x25ea('0xad')],'FaxAccountId':_0x2f3cd5['id'],'FaxInteractionId':_0x2f8087['id'],'UserId':_0x4449c6[_0x25ea('0x5c')]['id'],'ContactId':_0x2f8087[_0x25ea('0xb0')],'AttachmentId':_0x4449c6[_0x25ea('0x5b')]['attachments'][0x0]['id']})[_0x25ea('0x1d')](function(_0x39a56a){_0x2f8087['dataValues'][_0x25ea('0xb1')]=[];_0x2f8087[_0x25ea('0xb2')][_0x25ea('0xb1')][_0x25ea('0x83')](_0x39a56a[_0x25ea('0xb2')]);return _0x2f8087;});})['then'](function(_0x4719e5){respondWithRpcPromise(_0x25ea('0xb3'),'SendFax',{'FaxAccountId':_['isNil'](_0x4449c6['params']['id'])?undefined:_0x4449c6['params']['id'],'path':_[_0x25ea('0xa7')](_0x4449c6['body'][_0x25ea('0xa3')][0x0][_0x25ea('0x7')])?undefined:_0x4449c6['body'][_0x25ea('0xa3')][0x0]['path'],'fax':_[_0x25ea('0xa7')](_0x4449c6[_0x25ea('0x5b')]['to'][0x0])?undefined:_0x4449c6[_0x25ea('0x5b')]['to'][0x0],'AttachmentId':_0x4449c6[_0x25ea('0x5b')][_0x25ea('0xa3')][0x0]['id']},client9002)['then'](function(_0x7b228d){logger['info'](_0x25ea('0xb4'),_0x7b228d);})[_0x25ea('0x52')](function(_0x1ec790){logger[_0x25ea('0x1e')](_0x25ea('0xb4'),_0x1ec790);});return _0x4719e5;})['then'](respondWithResult(_0x1ca216,null))['catch'](handleError(_0x1ca216,null));};exports['addAgents']=function(_0x5dc2ff,_0x38cdb4,_0xe79ce4){return db['FaxAccount']['find']({'where':{'id':_0x5dc2ff[_0x25ea('0x53')]['id']}})[_0x25ea('0x1d')](handleEntityNotFound(_0x38cdb4,null))[_0x25ea('0x1d')](function(_0x1c6152){if(_0x1c6152){return _0x1c6152[_0x25ea('0xb5')](_0x5dc2ff[_0x25ea('0x5b')]['ids'],_['omit'](_0x5dc2ff[_0x25ea('0x5b')],[_0x25ea('0x69'),'id'])||{})[_0x25ea('0xaf')](function(_0xf15b4f){for(var _0x45b8e3=0x0;_0x45b8e3<_0x5dc2ff[_0x25ea('0x5b')][_0x25ea('0x69')][_0x25ea('0x47')];_0x45b8e3+=0x1){socket['emit']('userFaxAccount:save',{'UserId':_0x5dc2ff['body']['ids'][_0x45b8e3],'FaxAccountId':_0x5dc2ff[_0x25ea('0x53')]['id']});}return _0xf15b4f;});}})['then'](respondWithResult(_0x38cdb4,null))[_0x25ea('0x52')](handleError(_0x38cdb4,null));};exports[_0x25ea('0xb6')]=function(_0x305202,_0x27a8e6,_0x12d953){return db[_0x25ea('0x3b')][_0x25ea('0x59')]({'where':{'id':_0x305202[_0x25ea('0x53')]['id']}})[_0x25ea('0x1d')](handleEntityNotFound(_0x27a8e6,null))[_0x25ea('0x1d')](function(_0x126e04){if(_0x126e04){return _0x126e04[_0x25ea('0xb6')](_0x305202[_0x25ea('0x42')]['ids'])[_0x25ea('0x1d')](function(){if(_[_0x25ea('0xb7')](_0x305202[_0x25ea('0x42')][_0x25ea('0x69')])){for(var _0x307b50=0x0;_0x307b50<_0x305202[_0x25ea('0x42')][_0x25ea('0x69')][_0x25ea('0x47')];_0x307b50+=0x1){socket['emit'](_0x25ea('0xb8'),{'UserId':Number(_0x305202[_0x25ea('0x42')][_0x25ea('0x69')][_0x307b50]),'FaxAccountId':Number(_0x305202[_0x25ea('0x53')]['id'])});}}else{socket[_0x25ea('0xb9')](_0x25ea('0xb8'),{'UserId':Number(_0x305202[_0x25ea('0x42')]['ids']),'FaxAccountId':Number(_0x305202[_0x25ea('0x53')]['id'])});}});}})[_0x25ea('0x1d')](respondWithStatusCode(_0x27a8e6,null))[_0x25ea('0x52')](handleError(_0x27a8e6,null));};exports[_0x25ea('0xba')]=function(_0x115eec,_0xffbfc4,_0x5a7a81){var _0x422005={};var _0x38ead4={};var _0x350aea;var _0x235680;return db[_0x25ea('0x3b')]['findOne']({'where':{'id':_0x115eec['params']['id']}})[_0x25ea('0x1d')](handleEntityNotFound(_0xffbfc4,null))[_0x25ea('0x1d')](function(_0x131d42){if(_0x131d42){_0x350aea=_0x131d42;_0x38ead4[_0x25ea('0x40')]=_[_0x25ea('0x41')](db[_0x25ea('0xbb')][_0x25ea('0x3c')]);_0x38ead4['query']=_['keys'](_0x115eec[_0x25ea('0x42')]);_0x38ead4[_0x25ea('0x43')]=_['intersection'](_0x38ead4[_0x25ea('0x40')],_0x38ead4[_0x25ea('0x42')]);_0x422005[_0x25ea('0x45')]=_[_0x25ea('0x44')](_0x38ead4[_0x25ea('0x40')],qs[_0x25ea('0x46')](_0x115eec[_0x25ea('0x42')][_0x25ea('0x46')]));_0x422005[_0x25ea('0x45')]=_0x422005[_0x25ea('0x45')][_0x25ea('0x47')]?_0x422005[_0x25ea('0x45')]:_0x38ead4[_0x25ea('0x40')];_0x422005[_0x25ea('0x4a')]=qs['sort'](_0x115eec['query'][_0x25ea('0x4b')]);_0x422005['where']=qs[_0x25ea('0x43')](_[_0x25ea('0x4d')](_0x115eec[_0x25ea('0x42')],_0x38ead4['filters']));if(_0x115eec[_0x25ea('0x42')][_0x25ea('0x4e')]){_0x422005[_0x25ea('0x4c')]=_[_0x25ea('0x67')](_0x422005['where'],{'$or':_[_0x25ea('0x3a')](_0x422005[_0x25ea('0x45')],function(_0x54e703){var _0x240c3a={};_0x240c3a[_0x54e703]={'$like':'%'+_0x115eec[_0x25ea('0x42')][_0x25ea('0x4e')]+'%'};return _0x240c3a;})});}_0x422005=_[_0x25ea('0x67')]({},_0x422005,_0x115eec['options']);return _0x350aea[_0x25ea('0xba')](_0x422005);}})['then'](function(_0x2c2e9f){if(_0x2c2e9f){_0x235680=_0x2c2e9f[_0x25ea('0x47')];if(!_0x115eec[_0x25ea('0x42')][_0x25ea('0x48')]('nolimit')){_0x422005[_0x25ea('0x2d')]=qs['limit'](_0x115eec[_0x25ea('0x42')][_0x25ea('0x2d')]);_0x422005[_0x25ea('0x2c')]=qs[_0x25ea('0x2c')](_0x115eec[_0x25ea('0x42')][_0x25ea('0x2c')]);}return _0x350aea['getAgents'](_0x422005);}})['then'](function(_0x1f98fa){if(_0x1f98fa){return _0x1f98fa?{'count':_0x235680,'rows':_0x1f98fa}:null;}})[_0x25ea('0x1d')](respondWithResult(_0xffbfc4,null))[_0x25ea('0x52')](handleError(_0xffbfc4,null));}; \ No newline at end of file +var _0xbe8c=['zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','limit','Content-Range','json','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','end','sendStatus','stack','name','Pause','map','FaxAccount','rawAttributes','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','mandatoryDispositionPause','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','length','includeAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','transaction','FaxApplication','findAndCountAll','priority','getApplications','from-voip-provider','app','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','headerinfo','minrate','modem','FAXOPT(','/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','sequelize','VoiceExtension','bulkCreate','tech','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','send','CmList','Contacts','DESC','attachments','join','root','server/files/attachments','basename','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','spread','out','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','isArray','emit','getAgents','html-pdf','eml-format','rimraf'];(function(_0x2805e4,_0x508d62){var _0x1e7eab=function(_0x519d00){while(--_0x519d00){_0x2805e4['push'](_0x2805e4['shift']());}};_0x1e7eab(++_0x508d62);}(_0xbe8c,0xbd));var _0xcbe8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbe8c[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0xcbe8('0x0'));var emlformat=require(_0xcbe8('0x1'));var rimraf=require(_0xcbe8('0x2'));var zipdir=require(_0xcbe8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcbe8('0x4'));var moment=require(_0xcbe8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcbe8('0x6'));var util=require('util');var path=require('path');var sox=require(_0xcbe8('0x7'));var csv=require(_0xcbe8('0x8'));var ejs=require(_0xcbe8('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcbe8('0xa'));var crypto=require(_0xcbe8('0xb'));var jsforce=require(_0xcbe8('0xc'));var deskjs=require(_0xcbe8('0xd'));var toCsv=require(_0xcbe8('0x8'));var querystring=require('querystring');var Papa=require(_0xcbe8('0xe'));var Redis=require(_0xcbe8('0xf'));var authService=require(_0xcbe8('0x10'));var qs=require(_0xcbe8('0x11'));var as=require(_0xcbe8('0x12'));var hardwareService=require(_0xcbe8('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xcbe8('0x14'));var licenseUtil=require(_0xcbe8('0x15'));var db=require(_0xcbe8('0x16'))['db'];config[_0xcbe8('0x17')]=_[_0xcbe8('0x18')](config['redis'],{'host':_0xcbe8('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcbe8('0x17')]));require('./faxAccount.socket')[_0xcbe8('0x1a')](socket);var jayson=require(_0xcbe8('0x1b'));var client=jayson[_0xcbe8('0x1c')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xeffaf3,_0x381af6,_0x461e72,_0x35d381){return new BPromise(function(_0x5b263b,_0x3e2cc5){var _0x448ce8=_0x35d381||client;return _0x448ce8[_0xcbe8('0x1d')](_0xeffaf3,_0x461e72)[_0xcbe8('0x1e')](function(_0x43e29b){logger[_0xcbe8('0x1f')](_0xcbe8('0x20'),_0x381af6,_0xcbe8('0x21'));logger[_0xcbe8('0x22')](_0xcbe8('0x23'),_0x381af6,_0xcbe8('0x21'),JSON[_0xcbe8('0x24')](_0x43e29b));if(_0x43e29b[_0xcbe8('0x25')]){if(_0x43e29b['error'][_0xcbe8('0x26')]===0x1f4){logger[_0xcbe8('0x25')](_0xcbe8('0x20'),_0x381af6,_0x43e29b['error'][_0xcbe8('0x27')]);return _0x3e2cc5(_0x43e29b['error'][_0xcbe8('0x27')]);}logger[_0xcbe8('0x25')](_0xcbe8('0x20'),_0x381af6,_0x43e29b[_0xcbe8('0x25')]['message']);return _0x5b263b(_0x43e29b['error']['message']);}else{logger['info'](_0xcbe8('0x20'),_0x381af6,_0xcbe8('0x21'));_0x5b263b(_0x43e29b[_0xcbe8('0x28')]['message']);}})[_0xcbe8('0x29')](function(_0x7da1ad){logger[_0xcbe8('0x25')]('FaxAccount,\x20%s,\x20%s',_0x381af6,_0x7da1ad);_0x3e2cc5(_0x7da1ad);});});}function respondWithStatusCode(_0xf74332,_0x3cc348){_0x3cc348=_0x3cc348||0xcc;return function(_0x140145){if(_0x140145){return _0xf74332['sendStatus'](_0x3cc348);}return _0xf74332[_0xcbe8('0x2a')](_0x3cc348)['end']();};}function respondWithResult(_0x3a7155,_0x35724b){_0x35724b=_0x35724b||0xc8;return function(_0x2fb100){if(_0x2fb100){return _0x3a7155['status'](_0x35724b)['json'](_0x2fb100);}};}function respondWithFilteredResult(_0xf35a31,_0x5490e3){return function(_0x398122){if(_0x398122){var _0xa0dd7e=_0x398122['count'],_0x5c122b=_0x5490e3['offset'],_0x18d48e=_0x5490e3[_0xcbe8('0x2b')]+_0x5490e3[_0xcbe8('0x2c')],_0x1f88e0;if(_0x18d48e>=_0xa0dd7e){_0x18d48e=_0xa0dd7e;_0x1f88e0=0xc8;}else{_0x1f88e0=0xce;}_0xf35a31[_0xcbe8('0x2a')](_0x1f88e0);return _0xf35a31['set'](_0xcbe8('0x2d'),_0x5c122b+'-'+_0x18d48e+'/'+_0xa0dd7e)[_0xcbe8('0x2e')](_0x398122);}return null;};}function patchUpdates(_0x3b82a7){return function(_0x5c2b99){try{jsonpatch[_0xcbe8('0x2f')](_0x5c2b99,_0x3b82a7,!![]);}catch(_0x3350ec){return BPromise[_0xcbe8('0x30')](_0x3350ec);}return _0x5c2b99[_0xcbe8('0x31')]();};}function saveUpdates(_0x36897d,_0x493d81){return function(_0x7b9617){if(_0x7b9617){return _0x7b9617[_0xcbe8('0x32')](_0x36897d)[_0xcbe8('0x1e')](function(_0x4b4cf9){return _0x4b4cf9;});}return null;};}function removeEntity(_0xadf55c,_0xa357aa){return function(_0x28704f){if(_0x28704f){return _0x28704f[_0xcbe8('0x33')]()[_0xcbe8('0x1e')](function(){var _0x28da4a=_0x28704f[_0xcbe8('0x34')]({'plain':!![]});var _0x3698c2=_0xcbe8('0x35');return db[_0xcbe8('0x36')][_0xcbe8('0x33')]({'where':{'type':_0x3698c2,'resourceId':_0x28da4a['id']}})[_0xcbe8('0x1e')](function(){return _0x28704f;});})['then'](function(){_0xadf55c['status'](0xcc)[_0xcbe8('0x37')]();});}};}function handleEntityNotFound(_0x570f1c,_0x4bf48b){return function(_0x2f32ae){if(!_0x2f32ae){_0x570f1c[_0xcbe8('0x38')](0x194);}return _0x2f32ae;};}function handleError(_0x325e7b,_0x4d92c6){_0x4d92c6=_0x4d92c6||0x1f4;return function(_0x2e0561){logger[_0xcbe8('0x25')](_0x2e0561[_0xcbe8('0x39')]);if(_0x2e0561[_0xcbe8('0x3a')]){delete _0x2e0561['name'];}_0x325e7b[_0xcbe8('0x2a')](_0x4d92c6)['send'](_0x2e0561);};}exports['index']=function(_0x2b9587,_0x2c49da){var _0x579a3f={'include':[{'model':db[_0xcbe8('0x3b')],'as':'mandatoryDispositionPause'}]},_0x12b97f={},_0x5ecd75={'count':0x0,'rows':[]};var _0x3fa5eb=_[_0xcbe8('0x3c')](db[_0xcbe8('0x3d')][_0xcbe8('0x3e')],function(_0x55a84a){return{'name':_0x55a84a['fieldName'],'type':_0x55a84a['type'][_0xcbe8('0x3f')]};});_0x12b97f[_0xcbe8('0x40')]=_[_0xcbe8('0x3c')](_0x3fa5eb,_0xcbe8('0x3a'));_0x12b97f[_0xcbe8('0x41')]=_['keys'](_0x2b9587[_0xcbe8('0x41')]);_0x12b97f[_0xcbe8('0x42')]=_[_0xcbe8('0x43')](_0x12b97f[_0xcbe8('0x40')],_0x12b97f[_0xcbe8('0x41')]);_0x579a3f[_0xcbe8('0x44')]=_[_0xcbe8('0x43')](_0x12b97f[_0xcbe8('0x40')],qs[_0xcbe8('0x45')](_0x2b9587[_0xcbe8('0x41')][_0xcbe8('0x45')]));_0x579a3f[_0xcbe8('0x44')]=_0x579a3f[_0xcbe8('0x44')]['length']?_0x579a3f['attributes']:_0x12b97f[_0xcbe8('0x40')];if(!_0x2b9587[_0xcbe8('0x41')][_0xcbe8('0x46')](_0xcbe8('0x47'))){_0x579a3f[_0xcbe8('0x2c')]=qs['limit'](_0x2b9587['query'][_0xcbe8('0x2c')]);_0x579a3f[_0xcbe8('0x2b')]=qs['offset'](_0x2b9587[_0xcbe8('0x41')]['offset']);}_0x579a3f[_0xcbe8('0x48')]=qs[_0xcbe8('0x49')](_0x2b9587['query']['sort']);_0x579a3f[_0xcbe8('0x4a')]=qs[_0xcbe8('0x42')](_[_0xcbe8('0x4b')](_0x2b9587[_0xcbe8('0x41')],_0x12b97f['filters']),_0x3fa5eb);if(_0x2b9587[_0xcbe8('0x41')][_0xcbe8('0x4c')]){_0x579a3f[_0xcbe8('0x4a')]=_[_0xcbe8('0x4d')](_0x579a3f[_0xcbe8('0x4a')],{'$or':_[_0xcbe8('0x3c')](_0x3fa5eb,function(_0x4c94d9){if(_0x4c94d9[_0xcbe8('0x4e')]!==_0xcbe8('0x4f')){var _0x21a6e8={};_0x21a6e8[_0x4c94d9[_0xcbe8('0x3a')]]={'$like':'%'+_0x2b9587[_0xcbe8('0x41')]['filter']+'%'};return _0x21a6e8;}})});}_0x579a3f=_[_0xcbe8('0x4d')]({},_0x579a3f,_0x2b9587[_0xcbe8('0x50')]);var _0x20dc28={'where':_0x579a3f[_0xcbe8('0x4a')]};return db[_0xcbe8('0x3d')]['count'](_0x20dc28)[_0xcbe8('0x1e')](function(_0x45cde0){_0x5ecd75[_0xcbe8('0x51')]=_0x45cde0;if(_0x2b9587[_0xcbe8('0x41')]['includeAll']){_0x579a3f[_0xcbe8('0x52')]=[{'all':!![]}];}return db['FaxAccount'][_0xcbe8('0x53')](_0x579a3f);})[_0xcbe8('0x1e')](function(_0xeaf215){_0x5ecd75['rows']=_0xeaf215;return _0x5ecd75;})[_0xcbe8('0x1e')](respondWithFilteredResult(_0x2c49da,_0x579a3f))['catch'](handleError(_0x2c49da,null));};exports['show']=function(_0x197fbc,_0x284a7f){var _0x25d71c={'raw':![],'where':{'id':_0x197fbc['params']['id']},'include':[{'model':db[_0xcbe8('0x3b')],'as':_0xcbe8('0x54')}]},_0x2e3d50={};_0x2e3d50['model']=_['keys'](db[_0xcbe8('0x3d')][_0xcbe8('0x3e')]);_0x2e3d50[_0xcbe8('0x41')]=_[_0xcbe8('0x55')](_0x197fbc[_0xcbe8('0x41')]);_0x2e3d50['filtears']=_[_0xcbe8('0x43')](_0x2e3d50[_0xcbe8('0x40')],_0x2e3d50['query']);_0x25d71c[_0xcbe8('0x44')]=_[_0xcbe8('0x43')](_0x2e3d50[_0xcbe8('0x40')],qs[_0xcbe8('0x45')](_0x197fbc['query'][_0xcbe8('0x45')]));_0x25d71c[_0xcbe8('0x44')]=_0x25d71c[_0xcbe8('0x44')]['length']?_0x25d71c[_0xcbe8('0x44')]:_0x2e3d50[_0xcbe8('0x40')];if(_0x197fbc[_0xcbe8('0x41')]['includeAll']){_0x25d71c['include']=[{'all':!![]}];}_0x25d71c=_['merge']({},_0x25d71c,_0x197fbc[_0xcbe8('0x50')]);return db[_0xcbe8('0x3d')]['find'](_0x25d71c)['then'](handleEntityNotFound(_0x284a7f,null))['then'](respondWithResult(_0x284a7f,null))[_0xcbe8('0x29')](handleError(_0x284a7f,null));};exports[_0xcbe8('0x56')]=function(_0x339d92,_0xcf7c6c){return db[_0xcbe8('0x3d')][_0xcbe8('0x56')](_0x339d92[_0xcbe8('0x57')],{})[_0xcbe8('0x1e')](function(_0x3236a2){var _0x686aa5=_0x339d92[_0xcbe8('0x58')]['get']({'plain':!![]});if(!_0x686aa5)throw new Error(_0xcbe8('0x59'));if(_0x686aa5['role']===_0xcbe8('0x58')){var _0x56a353=_0x3236a2[_0xcbe8('0x34')]({'plain':!![]});var _0x25fbf0=_0xcbe8('0x35');return db[_0xcbe8('0x5a')][_0xcbe8('0x5b')]({'where':{'name':_0x25fbf0,'userProfileId':_0x686aa5[_0xcbe8('0x5c')]},'raw':!![]})[_0xcbe8('0x1e')](function(_0x1f9d9c){if(_0x1f9d9c&&_0x1f9d9c[_0xcbe8('0x5d')]===0x0){return db['UserProfileResource']['create']({'name':_0x56a353[_0xcbe8('0x3a')],'resourceId':_0x56a353['id'],'type':_0x1f9d9c['name'],'sectionId':_0x1f9d9c['id']},{})['then'](function(){return _0x3236a2;});}else{return _0x3236a2;}})[_0xcbe8('0x29')](function(_0x14d074){logger[_0xcbe8('0x25')](_0xcbe8('0x5e'),_0x14d074);throw _0x14d074;});}return _0x3236a2;})['then'](respondWithResult(_0xcf7c6c,0xc9))[_0xcbe8('0x29')](handleError(_0xcf7c6c,null));};exports[_0xcbe8('0x32')]=function(_0x32aacb,_0x473acd){if(_0x32aacb[_0xcbe8('0x57')]['id']){delete _0x32aacb[_0xcbe8('0x57')]['id'];}return db['FaxAccount'][_0xcbe8('0x5b')]({'where':{'id':_0x32aacb[_0xcbe8('0x5f')]['id']},'include':[{'model':db[_0xcbe8('0x3b')],'as':_0xcbe8('0x54')}]})[_0xcbe8('0x1e')](handleEntityNotFound(_0x473acd,null))['then'](saveUpdates(_0x32aacb[_0xcbe8('0x57')],null))[_0xcbe8('0x1e')](respondWithResult(_0x473acd,null))[_0xcbe8('0x29')](handleError(_0x473acd,null));};exports[_0xcbe8('0x33')]=function(_0x34c83d,_0x469c3d){return db['FaxAccount'][_0xcbe8('0x5b')]({'where':{'id':_0x34c83d['params']['id']}})[_0xcbe8('0x1e')](handleEntityNotFound(_0x469c3d,null))[_0xcbe8('0x1e')](removeEntity(_0x469c3d,null))[_0xcbe8('0x29')](handleError(_0x469c3d,null));};exports[_0xcbe8('0x60')]=function(_0x18ba39,_0x6a1a7e){return db['FaxAccount'][_0xcbe8('0x60')]()['then'](respondWithResult(_0x6a1a7e,null))[_0xcbe8('0x29')](handleError(_0x6a1a7e,null));};exports[_0xcbe8('0x61')]=function(_0x573879,_0x108e18,_0x1ae2d6){if(_0x573879[_0xcbe8('0x57')]['id']){delete _0x573879['body']['id'];}return db['FaxAccount'][_0xcbe8('0x5b')]({'where':{'id':_0x573879[_0xcbe8('0x5f')]['id']}})[_0xcbe8('0x1e')](handleEntityNotFound(_0x108e18,null))[_0xcbe8('0x1e')](function(_0x274078){if(_0x274078){_0x573879['body'][_0xcbe8('0x62')]=_0x274078['id'];return db['Disposition'][_0xcbe8('0x56')](_0x573879['body']);}})[_0xcbe8('0x1e')](respondWithResult(_0x108e18,null))[_0xcbe8('0x29')](handleError(_0x108e18,null));};exports[_0xcbe8('0x63')]=function(_0x42140b,_0x772ee7,_0x2b9b33){var _0x4c0b66={'raw':![],'where':{}};var _0x2dec16={};var _0xf86775={'count':0x0,'rows':[]};return db[_0xcbe8('0x3d')][_0xcbe8('0x64')]({'where':{'id':_0x42140b[_0xcbe8('0x5f')]['id']}})['then'](handleEntityNotFound(_0x772ee7,null))['then'](function(_0x13e437){if(_0x13e437){_0x2dec16['model']=_[_0xcbe8('0x55')](db[_0xcbe8('0x65')][_0xcbe8('0x3e')]);_0x2dec16[_0xcbe8('0x41')]=_[_0xcbe8('0x55')](_0x42140b[_0xcbe8('0x41')]);_0x2dec16[_0xcbe8('0x42')]=_[_0xcbe8('0x43')](_0x2dec16['model'],_0x2dec16[_0xcbe8('0x41')]);_0x4c0b66['attributes']=_['intersection'](_0x2dec16['model'],qs[_0xcbe8('0x45')](_0x42140b['query']['fields']));_0x4c0b66[_0xcbe8('0x44')]=_0x4c0b66['attributes'][_0xcbe8('0x66')]?_0x4c0b66['attributes']:_0x2dec16['model'];if(!_0x42140b[_0xcbe8('0x41')][_0xcbe8('0x46')]('nolimit')){_0x4c0b66['limit']=qs[_0xcbe8('0x2c')](_0x42140b['query'][_0xcbe8('0x2c')]);_0x4c0b66['offset']=qs[_0xcbe8('0x2b')](_0x42140b[_0xcbe8('0x41')][_0xcbe8('0x2b')]);}_0x4c0b66[_0xcbe8('0x48')]=qs[_0xcbe8('0x49')](_0x42140b['query'][_0xcbe8('0x49')]);_0x4c0b66['where']=qs[_0xcbe8('0x42')](_[_0xcbe8('0x4b')](_0x42140b[_0xcbe8('0x41')],_0x2dec16['filters']));_0x4c0b66[_0xcbe8('0x4a')][_0xcbe8('0x62')]=_0x13e437['id'];if(_0x42140b['query']['filter']){_0x4c0b66['where']=_[_0xcbe8('0x4d')](_0x4c0b66[_0xcbe8('0x4a')],{'$or':_[_0xcbe8('0x3c')](_0x4c0b66['attributes'],function(_0x4d8c52){var _0x171fc8={};_0x171fc8[_0x4d8c52]={'$like':'%'+_0x42140b[_0xcbe8('0x41')][_0xcbe8('0x4c')]+'%'};return _0x171fc8;})});}_0x4c0b66=_[_0xcbe8('0x4d')]({},_0x4c0b66,_0x42140b[_0xcbe8('0x50')]);return db[_0xcbe8('0x65')][_0xcbe8('0x51')]({'where':_0x4c0b66[_0xcbe8('0x4a')]})['then'](function(_0x2cde00){_0xf86775['count']=_0x2cde00;if(_0x42140b['query'][_0xcbe8('0x67')]){_0x4c0b66[_0xcbe8('0x52')]=[{'all':!![]}];}return db[_0xcbe8('0x65')][_0xcbe8('0x53')](_0x4c0b66);})[_0xcbe8('0x1e')](function(_0x279752){_0xf86775[_0xcbe8('0x68')]=_0x279752;return _0xf86775;});}})['then'](respondWithFilteredResult(_0x772ee7,_0x4c0b66))[_0xcbe8('0x29')](handleError(_0x772ee7,null));};exports['removeDispositions']=function(_0x482f76,_0x3e962b,_0x210c1f){return db['FaxAccount'][_0xcbe8('0x5b')]({'where':{'id':_0x482f76[_0xcbe8('0x5f')]['id']}})[_0xcbe8('0x1e')](handleEntityNotFound(_0x3e962b,null))['then'](function(_0x43ccc7){if(_0x43ccc7){return _0x43ccc7[_0xcbe8('0x69')](_0x482f76['query'][_0xcbe8('0x6a')]);}})[_0xcbe8('0x1e')](respondWithStatusCode(_0x3e962b,null))[_0xcbe8('0x29')](handleError(_0x3e962b,null));};exports[_0xcbe8('0x6b')]=function(_0x13ea2c,_0x14052e,_0x32edf4){if(_0x13ea2c[_0xcbe8('0x57')]['id']){delete _0x13ea2c[_0xcbe8('0x57')]['id'];}return db['FaxAccount'][_0xcbe8('0x5b')]({'where':{'id':_0x13ea2c['params']['id']}})['then'](handleEntityNotFound(_0x14052e,null))[_0xcbe8('0x1e')](function(_0x10c1ea){if(_0x10c1ea){_0x13ea2c[_0xcbe8('0x57')][_0xcbe8('0x62')]=_0x10c1ea['id'];return db[_0xcbe8('0x6c')]['create'](_0x13ea2c[_0xcbe8('0x57')]);}})[_0xcbe8('0x1e')](respondWithResult(_0x14052e,null))['catch'](handleError(_0x14052e,null));};exports[_0xcbe8('0x6d')]=function(_0x326687,_0x177dea,_0x323b47){var _0x2caec8={'raw':![],'where':{}};var _0x4177b7={};var _0x1916d7={'count':0x0,'rows':[]};return db['FaxAccount'][_0xcbe8('0x64')]({'where':{'id':_0x326687['params']['id']}})[_0xcbe8('0x1e')](handleEntityNotFound(_0x177dea,null))[_0xcbe8('0x1e')](function(_0x870e10){if(_0x870e10){_0x4177b7[_0xcbe8('0x40')]=_[_0xcbe8('0x55')](db[_0xcbe8('0x6c')]['rawAttributes']);_0x4177b7[_0xcbe8('0x41')]=_[_0xcbe8('0x55')](_0x326687[_0xcbe8('0x41')]);_0x4177b7['filters']=_[_0xcbe8('0x43')](_0x4177b7[_0xcbe8('0x40')],_0x4177b7[_0xcbe8('0x41')]);_0x2caec8[_0xcbe8('0x44')]=_['intersection'](_0x4177b7[_0xcbe8('0x40')],qs[_0xcbe8('0x45')](_0x326687[_0xcbe8('0x41')][_0xcbe8('0x45')]));_0x2caec8[_0xcbe8('0x44')]=_0x2caec8['attributes']['length']?_0x2caec8[_0xcbe8('0x44')]:_0x4177b7[_0xcbe8('0x40')];if(!_0x326687[_0xcbe8('0x41')][_0xcbe8('0x46')](_0xcbe8('0x47'))){_0x2caec8[_0xcbe8('0x2c')]=qs[_0xcbe8('0x2c')](_0x326687['query'][_0xcbe8('0x2c')]);_0x2caec8[_0xcbe8('0x2b')]=qs['offset'](_0x326687[_0xcbe8('0x41')][_0xcbe8('0x2b')]);}_0x2caec8[_0xcbe8('0x48')]=qs[_0xcbe8('0x49')](_0x326687[_0xcbe8('0x41')]['sort']);_0x2caec8[_0xcbe8('0x4a')]=qs[_0xcbe8('0x42')](_[_0xcbe8('0x4b')](_0x326687[_0xcbe8('0x41')],_0x4177b7[_0xcbe8('0x42')]));_0x2caec8[_0xcbe8('0x4a')][_0xcbe8('0x62')]=_0x870e10['id'];if(_0x326687[_0xcbe8('0x41')]['filter']){_0x2caec8[_0xcbe8('0x4a')]=_['merge'](_0x2caec8[_0xcbe8('0x4a')],{'$or':_[_0xcbe8('0x3c')](_0x2caec8[_0xcbe8('0x44')],function(_0x4cb1d5){var _0x3a06e1={};_0x3a06e1[_0x4cb1d5]={'$like':'%'+_0x326687[_0xcbe8('0x41')][_0xcbe8('0x4c')]+'%'};return _0x3a06e1;})});}_0x2caec8=_[_0xcbe8('0x4d')]({},_0x2caec8,_0x326687[_0xcbe8('0x50')]);return db['CannedAnswer'][_0xcbe8('0x51')]({'where':_0x2caec8['where']})[_0xcbe8('0x1e')](function(_0x169a79){_0x1916d7['count']=_0x169a79;if(_0x326687['query'][_0xcbe8('0x67')]){_0x2caec8[_0xcbe8('0x52')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x2caec8);})[_0xcbe8('0x1e')](function(_0x24a423){_0x1916d7[_0xcbe8('0x68')]=_0x24a423;return _0x1916d7;});}})[_0xcbe8('0x1e')](respondWithFilteredResult(_0x177dea,_0x2caec8))[_0xcbe8('0x29')](handleError(_0x177dea,null));};exports[_0xcbe8('0x6e')]=function(_0x21501d,_0x13bb22,_0x4be4bc){return db['FaxAccount'][_0xcbe8('0x5b')]({'where':{'id':_0x21501d[_0xcbe8('0x5f')]['id']}})[_0xcbe8('0x1e')](handleEntityNotFound(_0x13bb22,null))[_0xcbe8('0x1e')](function(_0x4a765e){if(_0x4a765e){return _0x4a765e[_0xcbe8('0x6e')](_0x21501d[_0xcbe8('0x41')][_0xcbe8('0x6a')]);}})[_0xcbe8('0x1e')](respondWithStatusCode(_0x13bb22,null))[_0xcbe8('0x29')](handleError(_0x13bb22,null));};exports[_0xcbe8('0x6f')]=function(_0x511c9b,_0x5faff8,_0x3b9426){return db[_0xcbe8('0x70')][_0xcbe8('0x5b')]({'where':{'id':_0x511c9b[_0xcbe8('0x5f')]['id']}})[_0xcbe8('0x1e')](handleEntityNotFound(_0x5faff8,null))[_0xcbe8('0x1e')](function(_0x4a2d45){if(_0x4a2d45){return _0x4a2d45[_0xcbe8('0x6f')](_0x511c9b[_0xcbe8('0x57')][_0xcbe8('0x6a')],_[_0xcbe8('0x71')](_0x511c9b[_0xcbe8('0x57')],[_0xcbe8('0x6a'),'id'])||{});}})['then'](respondWithResult(_0x5faff8,null))['catch'](handleError(_0x5faff8,null));};exports[_0xcbe8('0x72')]=function(_0x46f009,_0x36dac3,_0x2ea2dc){var _0x1c53f9={'raw':![],'where':{}};var _0x540dd9={};var _0x149ebc={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x46f009[_0xcbe8('0x5f')]['id']}})[_0xcbe8('0x1e')](handleEntityNotFound(_0x36dac3,null))[_0xcbe8('0x1e')](function(_0xfee9bc){if(_0xfee9bc){_0x540dd9[_0xcbe8('0x40')]=_[_0xcbe8('0x55')](db['FaxInteraction'][_0xcbe8('0x3e')]);_0x540dd9['query']=_['keys'](_0x46f009['query']);_0x540dd9[_0xcbe8('0x42')]=_[_0xcbe8('0x43')](_0x540dd9[_0xcbe8('0x40')],_0x540dd9[_0xcbe8('0x41')]);_0x1c53f9[_0xcbe8('0x44')]=_[_0xcbe8('0x43')](_0x540dd9[_0xcbe8('0x40')],qs['fields'](_0x46f009['query']['fields']));_0x1c53f9[_0xcbe8('0x44')]=_0x1c53f9[_0xcbe8('0x44')][_0xcbe8('0x66')]?_0x1c53f9['attributes']:_0x540dd9['model'];if(!_0x46f009[_0xcbe8('0x41')][_0xcbe8('0x46')](_0xcbe8('0x47'))){_0x1c53f9[_0xcbe8('0x2c')]=qs['limit'](_0x46f009['query'][_0xcbe8('0x2c')]);_0x1c53f9[_0xcbe8('0x2b')]=qs[_0xcbe8('0x2b')](_0x46f009[_0xcbe8('0x41')][_0xcbe8('0x2b')]);}_0x1c53f9[_0xcbe8('0x48')]=qs[_0xcbe8('0x49')](_0x46f009[_0xcbe8('0x41')][_0xcbe8('0x49')]);_0x1c53f9[_0xcbe8('0x4a')]=qs[_0xcbe8('0x42')](_[_0xcbe8('0x4b')](_0x46f009['query'],_0x540dd9['filters']));_0x1c53f9[_0xcbe8('0x4a')][_0xcbe8('0x62')]=_0xfee9bc['id'];if(_0x46f009[_0xcbe8('0x41')][_0xcbe8('0x4c')]){_0x1c53f9[_0xcbe8('0x4a')]=_['merge'](_0x1c53f9['where'],{'$or':_['map'](_0x1c53f9['attributes'],function(_0x397728){var _0x981d90={};_0x981d90[_0x397728]={'$like':'%'+_0x46f009['query']['filter']+'%'};return _0x981d90;})});}_0x1c53f9=_['merge']({},_0x1c53f9,_0x46f009[_0xcbe8('0x50')]);return db[_0xcbe8('0x70')][_0xcbe8('0x51')]({'where':_0x1c53f9[_0xcbe8('0x4a')]})['then'](function(_0x32355b){_0x149ebc[_0xcbe8('0x51')]=_0x32355b;if(_0x46f009[_0xcbe8('0x41')]['includeAll']){_0x1c53f9['include']=[{'model':db[_0xcbe8('0x73')],'as':_0xcbe8('0x74'),'required':![]},{'model':db[_0xcbe8('0x75')],'as':_0xcbe8('0x76'),'attributes':['name',_0xcbe8('0x77'),_0xcbe8('0x78')],'required':![]},{'model':db[_0xcbe8('0x79')],'as':_0xcbe8('0x7a'),'attributes':['id',_0xcbe8('0x3a'),'color'],'where':_0x46f009[_0xcbe8('0x41')][_0xcbe8('0x7b')]?{'id':_0x46f009[_0xcbe8('0x41')]['tag']}:undefined,'required':_0x46f009[_0xcbe8('0x41')]['tag']?!![]:![]}];}return db[_0xcbe8('0x70')][_0xcbe8('0x53')](_0x1c53f9);})['then'](function(_0xbdec82){_0x149ebc['rows']=_0xbdec82;return _0x149ebc;});}})[_0xcbe8('0x1e')](respondWithFilteredResult(_0x36dac3,_0x1c53f9))['catch'](handleError(_0x36dac3,null));};exports[_0xcbe8('0x7c')]=function(_0x3fd802,_0x37cb98,_0x16565c){return db[_0xcbe8('0x3d')][_0xcbe8('0x64')]({'where':{'id':_0x3fd802[_0xcbe8('0x5f')]['id']}})[_0xcbe8('0x1e')](handleEntityNotFound(_0x37cb98,null))[_0xcbe8('0x1e')](function(_0x4dc970){if(_0x4dc970){return db['sequelize'][_0xcbe8('0x7d')](function(_0x474f19){return db['FaxApplication'][_0xcbe8('0x33')]({'where':{'FaxAccountId':_0x3fd802['params']['id']},'transaction':_0x474f19})['then'](function(_0x1ae5b4){var _0x4648a2=_[_0xcbe8('0x3c')](_0x3fd802[_0xcbe8('0x57')],function(_0x5ce0e0){_0x5ce0e0[_0xcbe8('0x62')]=_0x3fd802[_0xcbe8('0x5f')]['id'];return _0x5ce0e0;});return db[_0xcbe8('0x7e')]['bulkCreate'](_0x4648a2,{'transaction':_0x474f19});});})[_0xcbe8('0x1e')](function(){return db[_0xcbe8('0x7e')][_0xcbe8('0x7f')]({'where':{'FaxAccountId':_0x3fd802['params']['id']},'order':_0xcbe8('0x80')});});}})[_0xcbe8('0x1e')](respondWithResult(_0x37cb98,null))[_0xcbe8('0x29')](handleError(_0x37cb98,null));};exports['getApplications']=function(_0x38f03e,_0x13abfb,_0x1ad9ee){var _0x22b516={};var _0x5c8a51={};var _0x406400;var _0x96a4c0;return db['FaxAccount'][_0xcbe8('0x64')]({'where':{'id':_0x38f03e['params']['id']}})[_0xcbe8('0x1e')](handleEntityNotFound(_0x13abfb,null))[_0xcbe8('0x1e')](function(_0x58ded2){if(_0x58ded2){_0x406400=_0x58ded2;_0x5c8a51[_0xcbe8('0x40')]=_[_0xcbe8('0x55')](db[_0xcbe8('0x7e')][_0xcbe8('0x3e')]);_0x5c8a51[_0xcbe8('0x41')]=_[_0xcbe8('0x55')](_0x38f03e['query']);_0x5c8a51[_0xcbe8('0x42')]=_[_0xcbe8('0x43')](_0x5c8a51[_0xcbe8('0x40')],_0x5c8a51['query']);_0x22b516[_0xcbe8('0x44')]=_['intersection'](_0x5c8a51[_0xcbe8('0x40')],qs[_0xcbe8('0x45')](_0x38f03e[_0xcbe8('0x41')][_0xcbe8('0x45')]));_0x22b516[_0xcbe8('0x44')]=_0x22b516['attributes'][_0xcbe8('0x66')]?_0x22b516[_0xcbe8('0x44')]:_0x5c8a51[_0xcbe8('0x40')];_0x22b516[_0xcbe8('0x48')]=qs[_0xcbe8('0x49')](_0x38f03e[_0xcbe8('0x41')][_0xcbe8('0x49')]);_0x22b516['where']=qs[_0xcbe8('0x42')](_[_0xcbe8('0x4b')](_0x38f03e[_0xcbe8('0x41')],_0x5c8a51[_0xcbe8('0x42')]));if(_0x38f03e[_0xcbe8('0x41')]['filter']){_0x22b516[_0xcbe8('0x4a')]=_[_0xcbe8('0x4d')](_0x22b516[_0xcbe8('0x4a')],{'$or':_[_0xcbe8('0x3c')](_0x22b516[_0xcbe8('0x44')],function(_0x30f919){var _0x3204b6={};_0x3204b6[_0x30f919]={'$like':'%'+_0x38f03e['query']['filter']+'%'};return _0x3204b6;})});}_0x22b516=_[_0xcbe8('0x4d')]({},_0x22b516,_0x38f03e['options']);return _0x406400[_0xcbe8('0x81')](_0x22b516);}})['then'](function(_0x9018f8){if(_0x9018f8){_0x96a4c0=_0x9018f8[_0xcbe8('0x66')];if(!_0x38f03e[_0xcbe8('0x41')][_0xcbe8('0x46')](_0xcbe8('0x47'))){_0x22b516[_0xcbe8('0x2c')]=qs[_0xcbe8('0x2c')](_0x38f03e[_0xcbe8('0x41')]['limit']);_0x22b516[_0xcbe8('0x2b')]=qs[_0xcbe8('0x2b')](_0x38f03e[_0xcbe8('0x41')]['offset']);}return _0x406400['getApplications'](_0x22b516);}})[_0xcbe8('0x1e')](function(_0x3afee1){if(_0x3afee1){return _0x3afee1?{'count':_0x96a4c0,'rows':_0x3afee1}:null;}})[_0xcbe8('0x1e')](respondWithResult(_0x13abfb,null))[_0xcbe8('0x29')](handleError(_0x13abfb,null));};function Extension(_0x4f6104,_0x1aca26,_0x1a4397,_0x3d8293){this['context']=_0xcbe8('0x82');this['exten']=_0x4f6104['localstationid'];this[_0xcbe8('0x83')]=_0x3d8293;this['type']='system';this[_0xcbe8('0x84')]=_0xcbe8('0x85');this[_0xcbe8('0x62')]=_0x4f6104['id'];this[_0xcbe8('0x80')]=_0x1aca26;this[_0xcbe8('0x86')]=_0x1a4397;}function createExtensionsReciveFax(_0x425766){var _0x3d96be=0x1;var _0x32feed=[];_0x32feed[_0xcbe8('0x87')](new Extension(_0x425766,_0x3d96be,'',_0xcbe8('0x88')));_0x3d96be+=0x1;_0x32feed[_0xcbe8('0x87')](new Extension(_0x425766,_0x3d96be,_0xcbe8('0x89'),_0xcbe8('0x8a')));_0x3d96be+=0x1;for(var _0x125318 in _0x425766){if(_0x425766[_0xcbe8('0x46')](_0x125318)&&(_0x125318===_0xcbe8('0x8b')||_0x125318===_0xcbe8('0x8c')||_0x125318===_0xcbe8('0x8d')||_0x125318===_0xcbe8('0x8e')||_0x125318===_0xcbe8('0x8f')||_0x125318==='maxrate'||_0x125318===_0xcbe8('0x90')||_0x125318===_0xcbe8('0x91')||_0x125318==='t38timeout')){_0x32feed['push'](new Extension(_0x425766,_0x3d96be,_0xcbe8('0x92')+_0x125318+')='+_0x425766[_0x125318],_0xcbe8('0x8a')));_0x3d96be+=0x1;}}_0x32feed[_0xcbe8('0x87')](new Extension(_0x425766,_0x3d96be,'6','Wait'));_0x3d96be+=0x1;_0x32feed[_0xcbe8('0x87')](new Extension(_0x425766,_0x3d96be,_0xcbe8('0x93'),_0xcbe8('0x94')));_0x3d96be=0x0;return _0x32feed;}exports[_0xcbe8('0x95')]=function(_0xfba984,_0x3f3b2c,_0x18ca7f){var _0x295d57;return db[_0xcbe8('0x96')][_0xcbe8('0x7d')](function(_0x5b0ab5){return db[_0xcbe8('0x3d')][_0xcbe8('0x56')](_0xfba984['body'],{'transaction':_0x5b0ab5})['then'](function(_0x312d39){_0x295d57=_0x312d39[_0xcbe8('0x34')]({'plain':!![]});return db[_0xcbe8('0x97')][_0xcbe8('0x98')](createExtensionsReciveFax(_0x295d57),{'transaction':_0x5b0ab5});});})[_0xcbe8('0x1e')](function(){return _0x295d57;})['then'](respondWithResult(_0x3f3b2c,null))[_0xcbe8('0x29')](handleError(_0x3f3b2c,null));};exports['updateAccountApplications']=function(_0x2ff641,_0x3de6e5,_0x1ef446){var _0x1d3ae7;return db[_0xcbe8('0x96')][_0xcbe8('0x7d')](function(_0x1e197b){return db[_0xcbe8('0x3d')]['update'](_0x2ff641[_0xcbe8('0x57')],{'where':{'id':_0x2ff641[_0xcbe8('0x57')]['id']},'transaction':_0x1e197b})[_0xcbe8('0x1e')](function(_0x381747){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x2ff641[_0xcbe8('0x57')]['id']},'transaction':_0x1e197b})[_0xcbe8('0x1e')](function(_0x394109){return db[_0xcbe8('0x97')][_0xcbe8('0x98')](createExtensionsReciveFax(_[_0xcbe8('0x71')](_0x2ff641[_0xcbe8('0x57')],[_0xcbe8('0x99'),_0xcbe8('0x3f'),'createdAt',_0xcbe8('0x9a'),_0xcbe8('0x9b'),_0xcbe8('0x9c')])),{'transaction':_0x1e197b});});});})['then'](function(){return db[_0xcbe8('0x3d')][_0xcbe8('0x9d')](_0x2ff641['body']['id']);})[_0xcbe8('0x1e')](respondWithResult(_0x3de6e5,null))[_0xcbe8('0x29')](handleError(_0x3de6e5,null));};exports[_0xcbe8('0x9e')]=function(_0x5e15f9,_0x5d8375,_0x46fef1){var _0x43923c={'raw':!![],'where':{}};var _0x3c09fe={};var _0x33bcf1={'count':0x0,'rows':[]};return db[_0xcbe8('0x3d')][_0xcbe8('0x64')]({'where':{'id':_0x5e15f9['params']['id']}})['then'](handleEntityNotFound(_0x5d8375,null))[_0xcbe8('0x1e')](function(_0x498879){if(_0x498879){_0x3c09fe['model']=_[_0xcbe8('0x55')](db[_0xcbe8('0x9f')][_0xcbe8('0x3e')]);_0x3c09fe[_0xcbe8('0x41')]=_[_0xcbe8('0x55')](_0x5e15f9[_0xcbe8('0x41')]);_0x3c09fe[_0xcbe8('0x42')]=_[_0xcbe8('0x43')](_0x3c09fe[_0xcbe8('0x40')],_0x3c09fe[_0xcbe8('0x41')]);_0x43923c[_0xcbe8('0x44')]=_[_0xcbe8('0x43')](_0x3c09fe[_0xcbe8('0x40')],qs[_0xcbe8('0x45')](_0x5e15f9[_0xcbe8('0x41')][_0xcbe8('0x45')]));_0x43923c[_0xcbe8('0x44')]=_0x43923c[_0xcbe8('0x44')][_0xcbe8('0x66')]?_0x43923c[_0xcbe8('0x44')]:_0x3c09fe[_0xcbe8('0x40')];if(!_0x5e15f9['query'][_0xcbe8('0x46')]('nolimit')){_0x43923c[_0xcbe8('0x2c')]=qs[_0xcbe8('0x2c')](_0x5e15f9[_0xcbe8('0x41')][_0xcbe8('0x2c')]);_0x43923c[_0xcbe8('0x2b')]=qs[_0xcbe8('0x2b')](_0x5e15f9[_0xcbe8('0x41')]['offset']);}_0x43923c['order']=qs['sort'](_0x5e15f9[_0xcbe8('0x41')][_0xcbe8('0x49')]);_0x43923c['where']=qs[_0xcbe8('0x42')](_['pick'](_0x5e15f9['query'],_0x3c09fe[_0xcbe8('0x42')]));_0x43923c[_0xcbe8('0x4a')][_0xcbe8('0x62')]=_0x498879['id'];if(_0x5e15f9['query'][_0xcbe8('0x4c')]){_0x43923c[_0xcbe8('0x4a')]=_[_0xcbe8('0x4d')](_0x43923c[_0xcbe8('0x4a')],{'$or':_[_0xcbe8('0x3c')](_0x43923c['attributes'],function(_0x529fef){var _0x559a9a={};_0x559a9a[_0x529fef]={'$like':'%'+_0x5e15f9[_0xcbe8('0x41')][_0xcbe8('0x4c')]+'%'};return _0x559a9a;})});}if(_0x5e15f9[_0xcbe8('0x41')][_0xcbe8('0xa0')]){var _0x2eb0e3=_0x5e15f9[_0xcbe8('0x41')][_0xcbe8('0xa0')]['split'](',');var _0x5d1471={};_0x5d1471[_0x2eb0e3[0x0]]={'$gte':moment(_0x2eb0e3[0x1])[_0xcbe8('0xa1')](_0xcbe8('0xa2'))};_0x43923c[_0xcbe8('0x4a')]=_['merge'](_0x43923c[_0xcbe8('0x4a')],_0x5d1471);}_0x43923c=_[_0xcbe8('0x4d')]({},_0x43923c,_0x5e15f9[_0xcbe8('0x50')]);return db[_0xcbe8('0x9f')][_0xcbe8('0x51')]({'where':_0x43923c[_0xcbe8('0x4a')]})[_0xcbe8('0x1e')](function(_0x3dcbd7){_0x33bcf1['count']=_0x3dcbd7;if(_0x5e15f9[_0xcbe8('0x41')][_0xcbe8('0x67')]){_0x43923c[_0xcbe8('0x52')]=[{'all':!![]}];}return db[_0xcbe8('0x9f')][_0xcbe8('0x53')](_0x43923c);})[_0xcbe8('0x1e')](function(_0x1040af){_0x33bcf1[_0xcbe8('0x68')]=_0x1040af;return _0x33bcf1;});}})[_0xcbe8('0x1e')](respondWithFilteredResult(_0x5d8375,_0x43923c))['catch'](handleError(_0x5d8375,null));};exports[_0xcbe8('0xa3')]=function(_0x59e72a,_0x493b37,_0x5322f6){var _0x2116c8,_0x487c01={},_0x216b78;if(_0x59e72a['body']['to']){_0x216b78=_0x59e72a[_0xcbe8('0x57')]['to'][0x0];}return db[_0xcbe8('0x3d')][_0xcbe8('0x5b')]({'where':{'id':_0x59e72a[_0xcbe8('0x5f')]['id']},'include':[{'model':db[_0xcbe8('0xa4')],'as':'List','include':[{'model':db['CmContact'],'as':_0xcbe8('0xa5'),'where':{'fax':_0x216b78},'limit':0x1,'order':[[_0xcbe8('0x9a'),_0xcbe8('0xa6')]]}]}]})['then'](handleEntityNotFound(_0x493b37,null))['then'](function(_0x15ee12){_0x2116c8=_0x15ee12;if(_0x59e72a[_0xcbe8('0x57')][_0xcbe8('0xa7')]&&_0x59e72a[_0xcbe8('0x57')]['attachments'][_0xcbe8('0x66')]){for(var _0x48cc0f=0x0;_0x48cc0f<_0x59e72a[_0xcbe8('0x57')][_0xcbe8('0xa7')][_0xcbe8('0x66')];_0x48cc0f+=0x1){_0x59e72a['body'][_0xcbe8('0xa7')][_0x48cc0f]={'filename':_0x59e72a[_0xcbe8('0x57')][_0xcbe8('0xa7')][_0x48cc0f]['name'],'id':_0x59e72a[_0xcbe8('0x57')][_0xcbe8('0xa7')][_0x48cc0f]['id'],'path':path[_0xcbe8('0xa8')](config[_0xcbe8('0xa9')],_0xcbe8('0xaa'),_0x59e72a[_0xcbe8('0x57')][_0xcbe8('0xa7')][_0x48cc0f][_0xcbe8('0xab')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_['isNil'](_0x59e72a[_0xcbe8('0x5f')]['id'])?undefined:_0x59e72a[_0xcbe8('0x5f')]['id'],'path':_[_0xcbe8('0xac')](_0x59e72a['body'][_0xcbe8('0xa7')][0x0][_0xcbe8('0xad')])?undefined:_0x59e72a[_0xcbe8('0x57')][_0xcbe8('0xa7')][0x0][_0xcbe8('0xad')],'fax':_[_0xcbe8('0xac')](_0x59e72a[_0xcbe8('0x57')]['to'][0x0])?undefined:_0x59e72a[_0xcbe8('0x57')]['to'][0x0]},client9002);})['then'](function(){if(_0x2116c8){if(_[_0xcbe8('0xac')](_0x59e72a[_0xcbe8('0x57')][_0xcbe8('0xae')])){_0x59e72a[_0xcbe8('0x57')]['from']=util[_0xcbe8('0xa1')](_0xcbe8('0xaf'),_0x2116c8[_0xcbe8('0x3a')],_0x2116c8[_0xcbe8('0xb0')]);}if(_0x2116c8[_0xcbe8('0xb1')]){if(_0x2116c8[_0xcbe8('0xb1')]['Contacts'][_0xcbe8('0x66')]){return _0x2116c8[_0xcbe8('0xb1')][_0xcbe8('0xa5')][0x0];}else{return db[_0xcbe8('0x73')][_0xcbe8('0x56')](_[_0xcbe8('0x18')](_0x59e72a[_0xcbe8('0x57')],{'firstName':_0x59e72a['body']['to'][0x0],'phone':_0x59e72a[_0xcbe8('0x57')]['to'][0x0],'fax':_0x59e72a['body']['to'][0x0],'ListId':_0x2116c8[_0xcbe8('0x9c')]}));}}else{throw new Error(_0xcbe8('0xb2'));}}else{throw new Error(_0xcbe8('0xb3'));}})[_0xcbe8('0x1e')](function(_0xf9cfaf){if(_0xf9cfaf){return db['FaxInteraction'][_0xcbe8('0x5b')]({'where':{'ContactId':_0xf9cfaf['id'],'closed':![],'FaxAccountId':_0x2116c8['id']}})['then'](function(_0x2324ed){if(_0x2324ed){return[_0x2324ed,![]];}return db[_0xcbe8('0x70')][_0xcbe8('0x56')]({'UserId':_0x59e72a['user']['id'],'ContactId':_0xf9cfaf['id'],'FaxAccountId':_0x2116c8['id'],'fax':_0x59e72a[_0xcbe8('0x57')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xcbe8('0x4d')](_0x59e72a[_0xcbe8('0x57')],{'read':![],'body':_0x59e72a[_0xcbe8('0x57')][_0xcbe8('0xa7')][0x0][_0xcbe8('0xb4')],'FaxAccountId':_0x2116c8['id'],'UserId':_0x59e72a[_0xcbe8('0x58')]['id'],'ContactId':_0xf9cfaf['id'],'AttachmentId':_0x59e72a[_0xcbe8('0x57')][_0xcbe8('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0xcbe8('0x9f')],'as':_0xcbe8('0xb5')}]})[_0xcbe8('0x1e')](function(_0x9a466a){return[_0x9a466a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xcbe8('0xb6')](function(_0x46bb36,_0x4deda2){if(_0x4deda2){return _0x46bb36;}return db['FaxMessage'][_0xcbe8('0x56')]({'direction':_0xcbe8('0xb7'),'read':![],'body':_0x59e72a[_0xcbe8('0x57')][_0xcbe8('0xa7')][0x0][_0xcbe8('0xb4')],'FaxAccountId':_0x2116c8['id'],'FaxInteractionId':_0x46bb36['id'],'UserId':_0x59e72a['user']['id'],'ContactId':_0x46bb36['ContactId'],'AttachmentId':_0x59e72a[_0xcbe8('0x57')][_0xcbe8('0xa7')][0x0]['id']})['then'](function(_0x4348bb){_0x46bb36[_0xcbe8('0xb8')]['Messages']=[];_0x46bb36[_0xcbe8('0xb8')][_0xcbe8('0xb5')]['push'](_0x4348bb[_0xcbe8('0xb8')]);return _0x46bb36;});})[_0xcbe8('0x1e')](function(_0x251da3){respondWithRpcPromise(_0xcbe8('0xb9'),_0xcbe8('0xb9'),{'FaxAccountId':_[_0xcbe8('0xac')](_0x59e72a['params']['id'])?undefined:_0x59e72a[_0xcbe8('0x5f')]['id'],'path':_[_0xcbe8('0xac')](_0x59e72a[_0xcbe8('0x57')][_0xcbe8('0xa7')][0x0][_0xcbe8('0xad')])?undefined:_0x59e72a['body']['attachments'][0x0]['path'],'fax':_[_0xcbe8('0xac')](_0x59e72a[_0xcbe8('0x57')]['to'][0x0])?undefined:_0x59e72a['body']['to'][0x0],'AttachmentId':_0x59e72a['body'][_0xcbe8('0xa7')][0x0]['id']},client9002)[_0xcbe8('0x1e')](function(_0x23655f){logger['info']('SendFaxRpc,\x20%s',_0x23655f);})[_0xcbe8('0x29')](function(_0x43f641){logger[_0xcbe8('0x1f')](_0xcbe8('0xba'),_0x43f641);});return _0x251da3;})[_0xcbe8('0x1e')](respondWithResult(_0x493b37,null))[_0xcbe8('0x29')](handleError(_0x493b37,null));};exports[_0xcbe8('0xbb')]=function(_0x7afca1,_0x2c4fad,_0x107444){return db[_0xcbe8('0x3d')][_0xcbe8('0x5b')]({'where':{'id':_0x7afca1[_0xcbe8('0x5f')]['id']}})[_0xcbe8('0x1e')](handleEntityNotFound(_0x2c4fad,null))[_0xcbe8('0x1e')](function(_0x2084b9){if(_0x2084b9){return _0x2084b9[_0xcbe8('0xbb')](_0x7afca1[_0xcbe8('0x57')][_0xcbe8('0x6a')],_[_0xcbe8('0x71')](_0x7afca1[_0xcbe8('0x57')],[_0xcbe8('0x6a'),'id'])||{})['spread'](function(_0x6bf429){for(var _0x32119d=0x0;_0x32119d<_0x7afca1[_0xcbe8('0x57')]['ids']['length'];_0x32119d+=0x1){socket['emit'](_0xcbe8('0xbc'),{'UserId':_0x7afca1[_0xcbe8('0x57')]['ids'][_0x32119d],'FaxAccountId':_0x7afca1[_0xcbe8('0x5f')]['id']});}return _0x6bf429;});}})['then'](respondWithResult(_0x2c4fad,null))[_0xcbe8('0x29')](handleError(_0x2c4fad,null));};exports['removeAgents']=function(_0x49a8ef,_0xc1091,_0x57611d){return db['FaxAccount'][_0xcbe8('0x5b')]({'where':{'id':_0x49a8ef[_0xcbe8('0x5f')]['id']}})[_0xcbe8('0x1e')](handleEntityNotFound(_0xc1091,null))['then'](function(_0x40c7ce){if(_0x40c7ce){return _0x40c7ce['removeAgents'](_0x49a8ef[_0xcbe8('0x41')][_0xcbe8('0x6a')])['then'](function(){if(_[_0xcbe8('0xbd')](_0x49a8ef[_0xcbe8('0x41')][_0xcbe8('0x6a')])){for(var _0x1dab13=0x0;_0x1dab13<_0x49a8ef[_0xcbe8('0x41')]['ids'][_0xcbe8('0x66')];_0x1dab13+=0x1){socket[_0xcbe8('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0x49a8ef[_0xcbe8('0x41')][_0xcbe8('0x6a')][_0x1dab13]),'FaxAccountId':Number(_0x49a8ef[_0xcbe8('0x5f')]['id'])});}}else{socket[_0xcbe8('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0x49a8ef[_0xcbe8('0x41')][_0xcbe8('0x6a')]),'FaxAccountId':Number(_0x49a8ef[_0xcbe8('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0xc1091,null))[_0xcbe8('0x29')](handleError(_0xc1091,null));};exports['getAgents']=function(_0x37af0a,_0x30c0de,_0x4fad75){var _0x2f88d5={};var _0x284407={};var _0x53da3a;var _0x49e736;return db[_0xcbe8('0x3d')]['findOne']({'where':{'id':_0x37af0a['params']['id']}})['then'](handleEntityNotFound(_0x30c0de,null))['then'](function(_0x39f235){if(_0x39f235){_0x53da3a=_0x39f235;_0x284407[_0xcbe8('0x40')]=_['keys'](db[_0xcbe8('0x75')][_0xcbe8('0x3e')]);_0x284407[_0xcbe8('0x41')]=_[_0xcbe8('0x55')](_0x37af0a[_0xcbe8('0x41')]);_0x284407['filters']=_[_0xcbe8('0x43')](_0x284407[_0xcbe8('0x40')],_0x284407[_0xcbe8('0x41')]);_0x2f88d5[_0xcbe8('0x44')]=_['intersection'](_0x284407['model'],qs['fields'](_0x37af0a['query'][_0xcbe8('0x45')]));_0x2f88d5['attributes']=_0x2f88d5['attributes'][_0xcbe8('0x66')]?_0x2f88d5['attributes']:_0x284407[_0xcbe8('0x40')];_0x2f88d5[_0xcbe8('0x48')]=qs[_0xcbe8('0x49')](_0x37af0a['query'][_0xcbe8('0x49')]);_0x2f88d5[_0xcbe8('0x4a')]=qs['filters'](_[_0xcbe8('0x4b')](_0x37af0a[_0xcbe8('0x41')],_0x284407[_0xcbe8('0x42')]));if(_0x37af0a[_0xcbe8('0x41')][_0xcbe8('0x4c')]){_0x2f88d5[_0xcbe8('0x4a')]=_['merge'](_0x2f88d5['where'],{'$or':_[_0xcbe8('0x3c')](_0x2f88d5[_0xcbe8('0x44')],function(_0x1da545){var _0x29d0e7={};_0x29d0e7[_0x1da545]={'$like':'%'+_0x37af0a[_0xcbe8('0x41')]['filter']+'%'};return _0x29d0e7;})});}_0x2f88d5=_[_0xcbe8('0x4d')]({},_0x2f88d5,_0x37af0a['options']);return _0x53da3a[_0xcbe8('0xbf')](_0x2f88d5);}})[_0xcbe8('0x1e')](function(_0x372dc8){if(_0x372dc8){_0x49e736=_0x372dc8[_0xcbe8('0x66')];if(!_0x37af0a['query']['hasOwnProperty'](_0xcbe8('0x47'))){_0x2f88d5[_0xcbe8('0x2c')]=qs[_0xcbe8('0x2c')](_0x37af0a[_0xcbe8('0x41')][_0xcbe8('0x2c')]);_0x2f88d5[_0xcbe8('0x2b')]=qs[_0xcbe8('0x2b')](_0x37af0a[_0xcbe8('0x41')][_0xcbe8('0x2b')]);}return _0x53da3a[_0xcbe8('0xbf')](_0x2f88d5);}})[_0xcbe8('0x1e')](function(_0x225cca){if(_0x225cca){return _0x225cca?{'count':_0x49e736,'rows':_0x225cca}:null;}})[_0xcbe8('0x1e')](respondWithResult(_0x30c0de,null))[_0xcbe8('0x29')](handleError(_0x30c0de,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index d67447a..efaf8e8 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 _0x4584=['../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x565671,_0x322141){var _0x35f653=function(_0x5b2030){while(--_0x5b2030){_0x565671['push'](_0x565671['shift']());}};_0x35f653(++_0x322141);}(_0x4584,0x1cb));var _0x4458=function(_0x516536,_0x27f68b){_0x516536=_0x516536-0x0;var _0x457651=_0x4584[_0x516536];return _0x457651;};'use strict';var EventEmitter=require(_0x4458('0x0'));var FaxAccount=require(_0x4458('0x1'))['db'][_0x4458('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x4458('0x3')](0x0);var events={'afterCreate':_0x4458('0x4'),'afterUpdate':_0x4458('0x5'),'afterDestroy':_0x4458('0x6')};function emitEvent(_0x4fa161){return function(_0x30a5e8,_0x41d5fa,_0xcb13ce){FaxAccountEvents[_0x4458('0x7')](_0x4fa161+':'+_0x30a5e8['id'],_0x30a5e8);FaxAccountEvents[_0x4458('0x7')](_0x4fa161,_0x30a5e8);_0xcb13ce(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x4458('0x8')](e,emitEvent(event));}}module[_0x4458('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x49c9=['setMaxListeners','save','emit','hasOwnProperty','exports','events','../../mysqldb','FaxAccount'];(function(_0x1d3e78,_0x4de8c0){var _0x19b99e=function(_0x1f32e7){while(--_0x1f32e7){_0x1d3e78['push'](_0x1d3e78['shift']());}};_0x19b99e(++_0x4de8c0);}(_0x49c9,0x11d));var _0x949c=function(_0x3b2ad8,_0x11a31a){_0x3b2ad8=_0x3b2ad8-0x0;var _0x57d937=_0x49c9[_0x3b2ad8];return _0x57d937;};'use strict';var EventEmitter=require(_0x949c('0x0'));var FaxAccount=require(_0x949c('0x1'))['db'][_0x949c('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x949c('0x3')](0x0);var events={'afterCreate':_0x949c('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x34a90d){return function(_0x21c6ac,_0x1ba314,_0xe8a8c6){FaxAccountEvents['emit'](_0x34a90d+':'+_0x21c6ac['id'],_0x21c6ac);FaxAccountEvents[_0x949c('0x5')](_0x34a90d,_0x21c6ac);_0xe8a8c6(null);};}for(var e in events){if(events[_0x949c('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x949c('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 2f95161..f703483 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 _0x36f5=['../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x204238,_0x10423d){var _0x5628ca=function(_0x470ec4){while(--_0x470ec4){_0x204238['push'](_0x204238['shift']());}};_0x5628ca(++_0x10423d);}(_0x36f5,0x157));var _0x536f=function(_0x4eefe0,_0x581893){_0x4eefe0=_0x4eefe0-0x0;var _0x14593a=_0x36f5[_0x4eefe0];return _0x14593a;};'use strict';var _=require(_0x536f('0x0'));var util=require(_0x536f('0x1'));var logger=require('../../config/logger')(_0x536f('0x2'));var moment=require(_0x536f('0x3'));var BPromise=require(_0x536f('0x4'));var rp=require(_0x536f('0x5'));var fs=require('fs');var path=require(_0x536f('0x6'));var rimraf=require(_0x536f('0x7'));var config=require(_0x536f('0x8'));var attributes=require(_0x536f('0x9'));module[_0x536f('0xa')]=function(_0xcd3139,_0x2db7db){return _0xcd3139[_0x536f('0xb')](_0x536f('0xc'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf30c=['fax_accounts','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports','define'];(function(_0x1cad44,_0x156016){var _0x25cbe8=function(_0x4b2b38){while(--_0x4b2b38){_0x1cad44['push'](_0x1cad44['shift']());}};_0x25cbe8(++_0x156016);}(_0xf30c,0x161));var _0xcf30=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf30c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xcf30('0x0'));var logger=require(_0xcf30('0x1'))(_0xcf30('0x2'));var moment=require('moment');var BPromise=require(_0xcf30('0x3'));var rp=require(_0xcf30('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf30('0x5'));var config=require(_0xcf30('0x6'));var attributes=require(_0xcf30('0x7'));module[_0xcf30('0x8')]=function(_0x43eba4,_0x28f13f){return _0x43eba4[_0xcf30('0x9')]('FaxAccount',attributes,{'tableName':_0xcf30('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index ae87517..f3a0387 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 _0xbf97=['mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmContact','Contacts','DESC','FaxApplication','Applications','get','list','List','orderBy','applications','priority','asc','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','push','length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./faxAccount.socket','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','map','include','model','NotifyFaxAccount','body','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes'];(function(_0x2ecd27,_0x167995){var _0x154c06=function(_0x7a1bdf){while(--_0x7a1bdf){_0x2ecd27['push'](_0x2ecd27['shift']());}};_0x154c06(++_0x167995);}(_0xbf97,0x1a1));var _0x7bf9=function(_0x38189a,_0x508d10){_0x38189a=_0x38189a-0x0;var _0x44c4d3=_0xbf97[_0x38189a];return _0x44c4d3;};'use strict';var _=require(_0x7bf9('0x0'));var util=require(_0x7bf9('0x1'));var moment=require(_0x7bf9('0x2'));var BPromise=require(_0x7bf9('0x3'));var rs=require(_0x7bf9('0x4'));var fs=require('fs');var Redis=require(_0x7bf9('0x5'));var db=require(_0x7bf9('0x6'))['db'];var utils=require(_0x7bf9('0x7'));var logger=require('../../config/logger')(_0x7bf9('0x8'));var config=require(_0x7bf9('0x9'));var jayson=require(_0x7bf9('0xa'));var client=jayson[_0x7bf9('0xb')]['http']({'port':0x232c});config[_0x7bf9('0xc')]=_[_0x7bf9('0xd')](config[_0x7bf9('0xc')],{'host':_0x7bf9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7bf9('0xc')]));require(_0x7bf9('0xf'))['register'](socket);function respondWithRpcPromise(_0x1ded9d,_0x2da1d4,_0x51a9a9){return new BPromise(function(_0x3ebce9,_0x58fc01){return client[_0x7bf9('0x10')](_0x1ded9d,_0x51a9a9)[_0x7bf9('0x11')](function(_0x4b46fe){logger[_0x7bf9('0x12')]('FaxAccount,\x20%s,\x20%s',_0x2da1d4,_0x7bf9('0x13'));logger[_0x7bf9('0x14')](_0x7bf9('0x15'),_0x2da1d4,_0x7bf9('0x13'),JSON[_0x7bf9('0x16')](_0x4b46fe));if(_0x4b46fe[_0x7bf9('0x17')]){if(_0x4b46fe[_0x7bf9('0x17')][_0x7bf9('0x18')]===0x1f4){logger[_0x7bf9('0x17')]('FaxAccount,\x20%s,\x20%s',_0x2da1d4,_0x4b46fe[_0x7bf9('0x17')][_0x7bf9('0x19')]);return _0x58fc01(_0x4b46fe[_0x7bf9('0x17')][_0x7bf9('0x19')]);}logger[_0x7bf9('0x17')](_0x7bf9('0x1a'),_0x2da1d4,_0x4b46fe['error'][_0x7bf9('0x19')]);return _0x3ebce9(_0x4b46fe[_0x7bf9('0x17')][_0x7bf9('0x19')]);}else{logger[_0x7bf9('0x12')](_0x7bf9('0x1a'),_0x2da1d4,_0x7bf9('0x13'));_0x3ebce9(_0x4b46fe[_0x7bf9('0x1b')]['message']);}})[_0x7bf9('0x1c')](function(_0x1e70e6){logger[_0x7bf9('0x17')](_0x7bf9('0x1a'),_0x2da1d4,_0x1e70e6);_0x58fc01(_0x1e70e6);});});}exports[_0x7bf9('0x1d')]=function(_0x18d8ae){var _0x90a423=this;return new Promise(function(_0x16ea4d,_0x24a5a0){return db[_0x7bf9('0x1e')][_0x7bf9('0x1f')]({'raw':_0x18d8ae['options']?_0x18d8ae[_0x7bf9('0x20')][_0x7bf9('0x21')]===undefined?!![]:![]:!![],'where':_0x18d8ae['options']?_0x18d8ae[_0x7bf9('0x20')][_0x7bf9('0x22')]||null:null,'attributes':_0x18d8ae[_0x7bf9('0x20')]?_0x18d8ae[_0x7bf9('0x20')][_0x7bf9('0x23')]||null:null,'limit':_0x18d8ae[_0x7bf9('0x20')]?_0x18d8ae[_0x7bf9('0x20')][_0x7bf9('0x24')]||null:null,'include':_0x18d8ae[_0x7bf9('0x20')]?_0x18d8ae['options']['include']?_[_0x7bf9('0x25')](_0x18d8ae[_0x7bf9('0x20')]['include'],function(_0xe79349){return{'model':db[_0xe79349['model']],'as':_0xe79349['as'],'attributes':_0xe79349[_0x7bf9('0x23')],'include':_0xe79349[_0x7bf9('0x26')]?_[_0x7bf9('0x25')](_0xe79349['include'],function(_0x5b5daa){return{'model':db[_0x5b5daa[_0x7bf9('0x27')]],'as':_0x5b5daa['as'],'attributes':_0x5b5daa['attributes'],'include':_0x5b5daa[_0x7bf9('0x26')]?_[_0x7bf9('0x25')](_0x5b5daa['include'],function(_0x21714e){return{'model':db[_0x21714e[_0x7bf9('0x27')]],'as':_0x21714e['as'],'attributes':_0x21714e[_0x7bf9('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7bf9('0x11')](function(_0x238ee9){logger[_0x7bf9('0x12')](_0x7bf9('0x1d'),_0x18d8ae);logger['debug'](_0x7bf9('0x1d'),_0x18d8ae,JSON[_0x7bf9('0x16')](_0x238ee9));_0x16ea4d(_0x238ee9);})[_0x7bf9('0x1c')](function(_0x42acc9){logger[_0x7bf9('0x17')](_0x7bf9('0x1d'),_0x42acc9[_0x7bf9('0x19')],_0x18d8ae);_0x24a5a0(_0x90a423[_0x7bf9('0x17')](0x1f4,_0x42acc9[_0x7bf9('0x19')]));});});};exports[_0x7bf9('0x28')]=function(_0x58d3a7,_0x5d1532,_0x142d4b){var _0x1741e4=this;return new Promise(function(_0x55c047,_0x12020d){var _0x4b54a5={'body':_0x58d3a7[_0x7bf9('0x29')],'channel':'fax'};var _0x459610=[];var _0x2d233f=[];var _0x56fc21={};return db['CmContact']['describe']()[_0x7bf9('0x11')](function(_0x311d13){if(!_0x311d13){throw new db['Sequelize'][(_0x7bf9('0x2a'))](_0x7bf9('0x2b'));}_0x459610=_[_0x7bf9('0x2c')](_[_0x7bf9('0x2d')](_0x311d13),['createdAt','updatedAt']);_0x2d233f=_['difference'](_['keys'](_0x311d13),[_0x7bf9('0x2e'),_0x7bf9('0x2f'),_0x7bf9('0x30'),_0x7bf9('0x31')]);if(_0x58d3a7[_0x7bf9('0x29')]['id']){delete _0x58d3a7[_0x7bf9('0x29')]['id'];}if(_[_0x7bf9('0x32')](_0x58d3a7['body'][_0x7bf9('0x33')])){throw new db[(_0x7bf9('0x34'))][(_0x7bf9('0x2a'))](_0x7bf9('0x35'));}if(_['isNil'](_0x58d3a7['body'][_0x7bf9('0x29')])||_0x58d3a7[_0x7bf9('0x29')][_0x7bf9('0x29')]===''){throw new db['Sequelize'][(_0x7bf9('0x2a'))](_0x7bf9('0x36'));}if(_[_0x7bf9('0x32')](_0x58d3a7[_0x7bf9('0x29')][_0x7bf9('0x37')])){throw new db['Sequelize'][(_0x7bf9('0x2a'))](_0x7bf9('0x38')+_0x2d233f);}if(!_[_0x7bf9('0x39')](_0x2d233f,_0x58d3a7[_0x7bf9('0x29')][_0x7bf9('0x37')])){throw new db[(_0x7bf9('0x34'))][(_0x7bf9('0x2a'))](_0x7bf9('0x3a')+_0x2d233f);}_0x56fc21[_0x58d3a7[_0x7bf9('0x29')][_0x7bf9('0x37')]]=_0x58d3a7['body'][_0x7bf9('0x33')];})[_0x7bf9('0x11')](function(){return db[_0x7bf9('0x1e')][_0x7bf9('0x3b')]({'where':{'id':_0x58d3a7[_0x7bf9('0x3c')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x7bf9('0x3d')],'as':_0x7bf9('0x3e'),'where':_0x56fc21,'limit':0x1,'order':[[_0x7bf9('0x2f'),_0x7bf9('0x3f')]]}]},{'model':db[_0x7bf9('0x40')],'as':_0x7bf9('0x41')}]});})[_0x7bf9('0x11')](function(_0x3a5451){if(_0x3a5451&&_0x3a5451['List']){var _0x5effdc=_0x3a5451[_0x7bf9('0x42')]({'plain':!![]});_0x4b54a5[_0x7bf9('0x3c')]=_0x5effdc;_0x4b54a5['applications']=_0x5effdc['Applications'];_0x4b54a5[_0x7bf9('0x43')]=_0x5effdc[_0x7bf9('0x44')];_0x4b54a5['applications']=_[_0x7bf9('0x45')](_0x4b54a5[_0x7bf9('0x46')],[_0x7bf9('0x47')],[_0x7bf9('0x48')]);if(_0x4b54a5['account'][_0x7bf9('0x41')]){delete _0x4b54a5[_0x7bf9('0x3c')][_0x7bf9('0x41')];}if(_0x4b54a5[_0x7bf9('0x3c')][_0x7bf9('0x44')]&&_0x4b54a5[_0x7bf9('0x3c')][_0x7bf9('0x44')][_0x7bf9('0x3e')]['length']){return _0x4b54a5['account'][_0x7bf9('0x44')][_0x7bf9('0x3e')][0x0];}var _0x5ca8bf=_[_0x7bf9('0xd')](_0x58d3a7[_0x7bf9('0x29')],{'firstName':_0x58d3a7['body'][_0x7bf9('0x33')],'ListId':_0x5effdc[_0x7bf9('0x31')]});_0x5ca8bf[_0x58d3a7[_0x7bf9('0x29')][_0x7bf9('0x37')]]=_0x58d3a7['body'][_0x7bf9('0x33')];return db[_0x7bf9('0x3d')][_0x7bf9('0x49')](_0x5ca8bf,{'fields':_0x459610,'raw':!![]});}})['then'](function(_0x58d5f5){_0x4b54a5[_0x7bf9('0x4a')]=_0x58d5f5;if(_0x58d5f5){var _0x33b40b={'ContactId':_0x58d5f5['id'],'FaxAccountId':_0x58d3a7[_0x7bf9('0x3c')]['id'],'fax':_0x58d5f5[_0x7bf9('0x4b')]};return db[_0x7bf9('0x4c')]['find']({'where':{'ContactId':_0x58d5f5['id'],'closed':![],'FaxAccountId':_0x58d3a7['account']['id']}})[_0x7bf9('0x11')](function(_0x3c31e4){if(_0x3c31e4){return[_0x3c31e4,![]];}return db[_0x7bf9('0x4c')][_0x7bf9('0x49')](_0x33b40b)[_0x7bf9('0x11')](function(_0x23396e){return[_0x23396e,!![]];});});}else{throw new Error(_0x7bf9('0x4d'));}})[_0x7bf9('0x4e')](function(_0x355fc4,_0x5aea43){var _0x10969b=_0x355fc4[_0x7bf9('0x42')]({'plain':!![]});if(_0x5aea43){if(_0x4b54a5[_0x7bf9('0x3c')]['autoclose']){_0x4b54a5[_0x7bf9('0x46')][_0x7bf9('0x4f')]({'id':0x0,'priority':_0x4b54a5['applications'][_0x7bf9('0x50')]+0x1,'app':_0x7bf9('0x51'),'appdata':_0x7bf9('0x52'),'interval':_0x7bf9('0x53')});}_0x10969b[_0x7bf9('0x54')]=!![];}else{_0x10969b[_0x7bf9('0x54')]=![];}_0x4b54a5[_0x7bf9('0x55')]=_0x10969b;return db[_0x7bf9('0x56')][_0x7bf9('0x49')]({'body':_0x58d3a7[_0x7bf9('0x29')][_0x7bf9('0x29')],'FaxAccountId':_0x58d3a7[_0x7bf9('0x3c')]['id'],'FaxInteractionId':_0x355fc4['id'],'direction':'in','ContactId':_0x355fc4['ContactId'],'AttachmentId':_0x58d3a7['body'][_0x7bf9('0x57')]});})[_0x7bf9('0x11')](function(_0x1fed37){_0x4b54a5[_0x7bf9('0x19')]=_0x1fed37;if(_0x4b54a5[_0x7bf9('0x55')][_0x7bf9('0x58')]){return db['User']['find']({'attributes':['id',_0x7bf9('0x59')],'where':{'id':_0x4b54a5['interaction'][_0x7bf9('0x58')]}})[_0x7bf9('0x11')](function(_0x66964b){if(_0x66964b){_0x4b54a5[_0x7bf9('0x46')][_0x7bf9('0x5a')]({'id':0x0,'priority':0x0,'app':_0x7bf9('0x5b'),'appdata':_0x66964b['name']+','+(_0x4b54a5[_0x7bf9('0x3c')][_0x7bf9('0x5c')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x7bf9('0x5d'),'startRouting',_0x4b54a5);});}return respondWithRpcPromise(_0x7bf9('0x5d'),_0x7bf9('0x5e'),_0x4b54a5);})['then'](function(_0x27bb6d){_0x55c047(_0x27bb6d);})[_0x7bf9('0x1c')](function(_0x5f7d9e){_0x12020d(_0x1741e4[_0x7bf9('0x17')](0x1f4,_0x5f7d9e[_0x7bf9('0x19')]));});});}; \ No newline at end of file +var _0xf641=['interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','*,*,*,*','Start','startRouting','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./faxAccount.socket','register','request','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxAccount,\x20%s,\x20%s','result','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','model','message','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','isNil','from','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','account','CmList','List','Contacts','FaxApplication','get','Applications','list','applications','priority','asc','length','defaults','ListId','contact','FaxInteraction','find','create','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','created'];(function(_0x324111,_0x1b6daf){var _0x46e69b=function(_0x49e9c5){while(--_0x49e9c5){_0x324111['push'](_0x324111['shift']());}};_0x46e69b(++_0x1b6daf);}(_0xf641,0x17d));var _0x1f64=function(_0x35f2d6,_0x1eacc1){_0x35f2d6=_0x35f2d6-0x0;var _0x33a492=_0xf641[_0x35f2d6];return _0x33a492;};'use strict';var _=require(_0x1f64('0x0'));var util=require(_0x1f64('0x1'));var moment=require('moment');var BPromise=require(_0x1f64('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f64('0x3'));var db=require(_0x1f64('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f64('0x5'))(_0x1f64('0x6'));var config=require(_0x1f64('0x7'));var jayson=require(_0x1f64('0x8'));var client=jayson[_0x1f64('0x9')][_0x1f64('0xa')]({'port':0x232c});config['redis']=_['defaults'](config[_0x1f64('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1f64('0xc'))(new Redis(config[_0x1f64('0xb')]));require(_0x1f64('0xd'))[_0x1f64('0xe')](socket);function respondWithRpcPromise(_0x595de1,_0x498c93,_0x11b966){return new BPromise(function(_0xbc2e15,_0x28805c){return client[_0x1f64('0xf')](_0x595de1,_0x11b966)[_0x1f64('0x10')](function(_0x7b8f98){logger[_0x1f64('0x11')]('FaxAccount,\x20%s,\x20%s',_0x498c93,'request\x20sent');logger[_0x1f64('0x12')](_0x1f64('0x13'),_0x498c93,_0x1f64('0x14'),JSON[_0x1f64('0x15')](_0x7b8f98));if(_0x7b8f98[_0x1f64('0x16')]){if(_0x7b8f98[_0x1f64('0x16')]['code']===0x1f4){logger['error'](_0x1f64('0x17'),_0x498c93,_0x7b8f98[_0x1f64('0x16')]['message']);return _0x28805c(_0x7b8f98[_0x1f64('0x16')]['message']);}logger['error'](_0x1f64('0x17'),_0x498c93,_0x7b8f98[_0x1f64('0x16')]['message']);return _0xbc2e15(_0x7b8f98[_0x1f64('0x16')]['message']);}else{logger[_0x1f64('0x11')]('FaxAccount,\x20%s,\x20%s',_0x498c93,'request\x20sent');_0xbc2e15(_0x7b8f98[_0x1f64('0x18')]['message']);}})['catch'](function(_0x4cbb1a){logger[_0x1f64('0x16')]('FaxAccount,\x20%s,\x20%s',_0x498c93,_0x4cbb1a);_0x28805c(_0x4cbb1a);});});}exports[_0x1f64('0x19')]=function(_0x12eadd){var _0x1b744f=this;return new Promise(function(_0x312189,_0x2bd5d6){return db[_0x1f64('0x1a')][_0x1f64('0x1b')]({'raw':_0x12eadd[_0x1f64('0x1c')]?_0x12eadd[_0x1f64('0x1c')][_0x1f64('0x1d')]===undefined?!![]:![]:!![],'where':_0x12eadd[_0x1f64('0x1c')]?_0x12eadd[_0x1f64('0x1c')][_0x1f64('0x1e')]||null:null,'attributes':_0x12eadd[_0x1f64('0x1c')]?_0x12eadd[_0x1f64('0x1c')][_0x1f64('0x1f')]||null:null,'limit':_0x12eadd['options']?_0x12eadd[_0x1f64('0x1c')][_0x1f64('0x20')]||null:null,'include':_0x12eadd[_0x1f64('0x1c')]?_0x12eadd['options']['include']?_['map'](_0x12eadd['options'][_0x1f64('0x21')],function(_0x4faf36){return{'model':db[_0x4faf36[_0x1f64('0x22')]],'as':_0x4faf36['as'],'attributes':_0x4faf36[_0x1f64('0x1f')],'include':_0x4faf36[_0x1f64('0x21')]?_['map'](_0x4faf36[_0x1f64('0x21')],function(_0x19660f){return{'model':db[_0x19660f[_0x1f64('0x22')]],'as':_0x19660f['as'],'attributes':_0x19660f['attributes'],'include':_0x19660f['include']?_['map'](_0x19660f[_0x1f64('0x21')],function(_0xf9da63){return{'model':db[_0xf9da63[_0x1f64('0x22')]],'as':_0xf9da63['as'],'attributes':_0xf9da63[_0x1f64('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1f64('0x10')](function(_0x2ef604){logger[_0x1f64('0x11')](_0x1f64('0x19'),_0x12eadd);logger[_0x1f64('0x12')]('GetFaxAccount',_0x12eadd,JSON[_0x1f64('0x15')](_0x2ef604));_0x312189(_0x2ef604);})['catch'](function(_0x1b52c){logger[_0x1f64('0x16')](_0x1f64('0x19'),_0x1b52c[_0x1f64('0x23')],_0x12eadd);_0x2bd5d6(_0x1b744f[_0x1f64('0x16')](0x1f4,_0x1b52c['message']));});});};exports[_0x1f64('0x24')]=function(_0x4cf4c0,_0x574b38,_0x2bf856){var _0x5ace16=this;return new Promise(function(_0x55cdf8,_0x59ea7c){var _0xe629be={'body':_0x4cf4c0[_0x1f64('0x25')],'channel':_0x1f64('0x26')};var _0x1243cc=[];var _0x5e31d9=[];var _0xba687d={};return db[_0x1f64('0x27')][_0x1f64('0x28')]()[_0x1f64('0x10')](function(_0x2663cd){if(!_0x2663cd){throw new db[(_0x1f64('0x29'))][(_0x1f64('0x2a'))]('no\x20available\x20attributes');}_0x1243cc=_[_0x1f64('0x2b')](_[_0x1f64('0x2c')](_0x2663cd),[_0x1f64('0x2d'),_0x1f64('0x2e')]);_0x5e31d9=_[_0x1f64('0x2b')](_[_0x1f64('0x2c')](_0x2663cd),[_0x1f64('0x2d'),_0x1f64('0x2e'),'CompanyId','ListId']);if(_0x4cf4c0[_0x1f64('0x25')]['id']){delete _0x4cf4c0[_0x1f64('0x25')]['id'];}if(_[_0x1f64('0x2f')](_0x4cf4c0[_0x1f64('0x25')][_0x1f64('0x30')])){throw new db[(_0x1f64('0x29'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x1f64('0x2f')](_0x4cf4c0['body'][_0x1f64('0x25')])||_0x4cf4c0[_0x1f64('0x25')][_0x1f64('0x25')]===''){throw new db[(_0x1f64('0x29'))][(_0x1f64('0x2a'))](_0x1f64('0x31'));}if(_[_0x1f64('0x2f')](_0x4cf4c0['body'][_0x1f64('0x32')])){throw new db[(_0x1f64('0x29'))][(_0x1f64('0x2a'))](_0x1f64('0x33')+_0x5e31d9);}if(!_[_0x1f64('0x34')](_0x5e31d9,_0x4cf4c0[_0x1f64('0x25')]['mapKey'])){throw new db[(_0x1f64('0x29'))][(_0x1f64('0x2a'))](_0x1f64('0x35')+_0x5e31d9);}_0xba687d[_0x4cf4c0[_0x1f64('0x25')]['mapKey']]=_0x4cf4c0['body']['from'];})['then'](function(){return db[_0x1f64('0x1a')]['find']({'where':{'id':_0x4cf4c0[_0x1f64('0x36')]['id']},'include':[{'model':db[_0x1f64('0x37')],'as':_0x1f64('0x38'),'include':[{'model':db[_0x1f64('0x27')],'as':_0x1f64('0x39'),'where':_0xba687d,'limit':0x1,'order':[[_0x1f64('0x2e'),'DESC']]}]},{'model':db[_0x1f64('0x3a')],'as':'Applications'}]});})[_0x1f64('0x10')](function(_0x40bd6b){if(_0x40bd6b&&_0x40bd6b['List']){var _0x3c3b25=_0x40bd6b[_0x1f64('0x3b')]({'plain':!![]});_0xe629be[_0x1f64('0x36')]=_0x3c3b25;_0xe629be['applications']=_0x3c3b25[_0x1f64('0x3c')];_0xe629be[_0x1f64('0x3d')]=_0x3c3b25[_0x1f64('0x38')];_0xe629be['applications']=_['orderBy'](_0xe629be[_0x1f64('0x3e')],[_0x1f64('0x3f')],[_0x1f64('0x40')]);if(_0xe629be[_0x1f64('0x36')][_0x1f64('0x3c')]){delete _0xe629be[_0x1f64('0x36')][_0x1f64('0x3c')];}if(_0xe629be['account'][_0x1f64('0x38')]&&_0xe629be[_0x1f64('0x36')][_0x1f64('0x38')]['Contacts'][_0x1f64('0x41')]){return _0xe629be[_0x1f64('0x36')]['List']['Contacts'][0x0];}var _0x258804=_[_0x1f64('0x42')](_0x4cf4c0[_0x1f64('0x25')],{'firstName':_0x4cf4c0['body'][_0x1f64('0x30')],'ListId':_0x3c3b25[_0x1f64('0x43')]});_0x258804[_0x4cf4c0[_0x1f64('0x25')][_0x1f64('0x32')]]=_0x4cf4c0[_0x1f64('0x25')][_0x1f64('0x30')];return db[_0x1f64('0x27')]['create'](_0x258804,{'fields':_0x1243cc,'raw':!![]});}})[_0x1f64('0x10')](function(_0x18917e){_0xe629be[_0x1f64('0x44')]=_0x18917e;if(_0x18917e){var _0x293900={'ContactId':_0x18917e['id'],'FaxAccountId':_0x4cf4c0['account']['id'],'fax':_0x18917e[_0x1f64('0x26')]};return db[_0x1f64('0x45')][_0x1f64('0x46')]({'where':{'ContactId':_0x18917e['id'],'closed':![],'FaxAccountId':_0x4cf4c0[_0x1f64('0x36')]['id']}})[_0x1f64('0x10')](function(_0x3abe67){if(_0x3abe67){return[_0x3abe67,![]];}return db[_0x1f64('0x45')][_0x1f64('0x47')](_0x293900)[_0x1f64('0x10')](function(_0x2abefe){return[_0x2abefe,!![]];});});}else{throw new Error(_0x1f64('0x48'));}})[_0x1f64('0x49')](function(_0x1ec2b9,_0x521afb){var _0x16ece8=_0x1ec2b9[_0x1f64('0x3b')]({'plain':!![]});if(_0x521afb){if(_0xe629be[_0x1f64('0x36')][_0x1f64('0x4a')]){_0xe629be[_0x1f64('0x3e')][_0x1f64('0x4b')]({'id':0x0,'priority':_0xe629be[_0x1f64('0x3e')][_0x1f64('0x41')]+0x1,'app':_0x1f64('0x4c'),'appdata':_0x1f64('0x4d'),'interval':'*,*,*,*'});}_0x16ece8[_0x1f64('0x4e')]=!![];}else{_0x16ece8[_0x1f64('0x4e')]=![];}_0xe629be[_0x1f64('0x4f')]=_0x16ece8;return db[_0x1f64('0x50')][_0x1f64('0x47')]({'body':_0x4cf4c0[_0x1f64('0x25')][_0x1f64('0x25')],'FaxAccountId':_0x4cf4c0[_0x1f64('0x36')]['id'],'FaxInteractionId':_0x1ec2b9['id'],'direction':'in','ContactId':_0x1ec2b9[_0x1f64('0x51')],'AttachmentId':_0x4cf4c0[_0x1f64('0x25')][_0x1f64('0x52')]});})[_0x1f64('0x10')](function(_0xca1035){_0xe629be[_0x1f64('0x23')]=_0xca1035;if(_0xe629be['interaction'][_0x1f64('0x53')]){return db[_0x1f64('0x54')][_0x1f64('0x46')]({'attributes':['id',_0x1f64('0x55')],'where':{'id':_0xe629be[_0x1f64('0x4f')][_0x1f64('0x53')]}})[_0x1f64('0x10')](function(_0x5e97c1){if(_0x5e97c1){_0xe629be[_0x1f64('0x3e')][_0x1f64('0x56')]({'id':0x0,'priority':0x0,'app':_0x1f64('0x57'),'appdata':_0x5e97c1[_0x1f64('0x55')]+','+(_0xe629be['account']['waitForTheAssignedAgent']||0xa),'interval':_0x1f64('0x58')});}return respondWithRpcPromise(_0x1f64('0x59'),_0x1f64('0x5a'),_0xe629be);});}return respondWithRpcPromise(_0x1f64('0x59'),_0x1f64('0x5a'),_0xe629be);})[_0x1f64('0x10')](function(_0x892401){_0x55cdf8(_0x892401);})[_0x1f64('0x5b')](function(_0x282e4b){_0x59ea7c(_0x5ace16[_0x1f64('0x16')](0x1f4,_0x282e4b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 5e29eb4..4ded21f 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 _0x4bd3=['faxAccount:','./faxAccount.events','remove','update','emit','register','length'];(function(_0x5690ed,_0x3780c2){var _0x2c379b=function(_0x39ca9e){while(--_0x39ca9e){_0x5690ed['push'](_0x5690ed['shift']());}};_0x2c379b(++_0x3780c2);}(_0x4bd3,0x174));var _0x34bd=function(_0x56c0d1,_0x186ea3){_0x56c0d1=_0x56c0d1-0x0;var _0x3e7b6d=_0x4bd3[_0x56c0d1];return _0x3e7b6d;};'use strict';var FaxAccountEvents=require(_0x34bd('0x0'));var events=['save',_0x34bd('0x1'),_0x34bd('0x2')];function createListener(_0x5369c1,_0x4997bc){return function(_0x4cad21){_0x4997bc[_0x34bd('0x3')](_0x5369c1,_0x4cad21);};}function removeListener(_0x44854a,_0x1fc8eb){return function(){FaxAccountEvents['removeListener'](_0x44854a,_0x1fc8eb);};}exports[_0x34bd('0x4')]=function(_0x2a15a2){for(var _0x5c2a7a=0x0,_0x3e8744=events[_0x34bd('0x5')];_0x5c2a7a<_0x3e8744;_0x5c2a7a++){var _0x51a4d7=events[_0x5c2a7a];var _0xd600e1=createListener(_0x34bd('0x6')+_0x51a4d7,_0x2a15a2);FaxAccountEvents['on'](_0x51a4d7,_0xd600e1);}}; \ No newline at end of file +var _0x01d9=['./faxAccount.events','save','remove','update','emit','removeListener','register','length','faxAccount:'];(function(_0x40244d,_0x5cdc16){var _0x13ee62=function(_0x283722){while(--_0x283722){_0x40244d['push'](_0x40244d['shift']());}};_0x13ee62(++_0x5cdc16);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var FaxAccountEvents=require(_0x901d('0x0'));var events=[_0x901d('0x1'),_0x901d('0x2'),_0x901d('0x3')];function createListener(_0x521cc9,_0x2ce1fd){return function(_0x28bf48){_0x2ce1fd[_0x901d('0x4')](_0x521cc9,_0x28bf48);};}function removeListener(_0x8f7b4,_0x214f38){return function(){FaxAccountEvents[_0x901d('0x5')](_0x8f7b4,_0x214f38);};}exports[_0x901d('0x6')]=function(_0x4e7842){for(var _0x1e5d7d=0x0,_0x6c9ac8=events[_0x901d('0x7')];_0x1e5d7d<_0x6c9ac8;_0x1e5d7d++){var _0x12c39f=events[_0x1e5d7d];var _0x313f85=createListener(_0x901d('0x8')+_0x12c39f,_0x4e7842);FaxAccountEvents['on'](_0x12c39f,_0x313f85);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index a57791c..b9d6a66 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 _0x52fb=['getAgents','create','post','addDisposition','addAnswer','addInteraction','addAccountApplications','/updateaccountapplications','send','/:id/users','put','update','destroy','delete','removeDispositions','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0x52fb,0x1a7));var _0xb52f=function(_0x5cac44,_0x29a021){_0x5cac44=_0x5cac44-0x0;var _0x243e4b=_0x52fb[_0x5cac44];return _0x243e4b;};'use strict';var multer=require(_0xb52f('0x0'));var util=require(_0xb52f('0x1'));var path=require('path');var timeout=require(_0xb52f('0x2'));var express=require(_0xb52f('0x3'));var router=express[_0xb52f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb52f('0x5'));var config=require(_0xb52f('0x6'));var controller=require('./faxAccount.controller');router[_0xb52f('0x7')]('/',auth['isAuthenticated'](),controller[_0xb52f('0x8')]);router[_0xb52f('0x7')]('/describe',auth[_0xb52f('0x9')](),controller[_0xb52f('0xa')]);router[_0xb52f('0x7')](_0xb52f('0xb'),auth[_0xb52f('0x9')](),controller[_0xb52f('0xc')]);router['get'](_0xb52f('0xd'),auth[_0xb52f('0x9')](),controller[_0xb52f('0xe')]);router[_0xb52f('0x7')](_0xb52f('0xf'),auth[_0xb52f('0x9')](),controller['getAnswers']);router[_0xb52f('0x7')](_0xb52f('0x10'),auth[_0xb52f('0x9')](),controller[_0xb52f('0x11')]);router[_0xb52f('0x7')](_0xb52f('0x12'),auth[_0xb52f('0x9')](),controller['getApplications']);router[_0xb52f('0x7')](_0xb52f('0x13'),auth['isAuthenticated'](),controller[_0xb52f('0x14')]);router[_0xb52f('0x7')]('/:id/users',auth[_0xb52f('0x9')](),controller[_0xb52f('0x15')]);router['post']('/',auth[_0xb52f('0x9')](),controller[_0xb52f('0x16')]);router[_0xb52f('0x17')](_0xb52f('0xd'),auth['isAuthenticated'](),controller[_0xb52f('0x18')]);router['post'](_0xb52f('0xf'),auth[_0xb52f('0x9')](),controller[_0xb52f('0x19')]);router[_0xb52f('0x17')](_0xb52f('0x10'),auth[_0xb52f('0x9')](),controller[_0xb52f('0x1a')]);router[_0xb52f('0x17')](_0xb52f('0x12'),auth[_0xb52f('0x9')](),controller['addApplications']);router['post']('/addaccountapplications',auth['isAuthenticated'](),controller[_0xb52f('0x1b')]);router[_0xb52f('0x17')](_0xb52f('0x1c'),auth[_0xb52f('0x9')](),controller['updateAccountApplications']);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0xb52f('0x1d')]);router[_0xb52f('0x17')](_0xb52f('0x1e'),auth[_0xb52f('0x9')](),controller['addAgents']);router[_0xb52f('0x1f')](_0xb52f('0xb'),auth[_0xb52f('0x9')](),controller[_0xb52f('0x20')]);router['delete'](_0xb52f('0xb'),auth[_0xb52f('0x9')](),controller[_0xb52f('0x21')]);router[_0xb52f('0x22')](_0xb52f('0xd'),auth[_0xb52f('0x9')](),controller[_0xb52f('0x23')]);router[_0xb52f('0x22')](_0xb52f('0xf'),auth[_0xb52f('0x9')](),controller['removeAnswers']);router[_0xb52f('0x22')](_0xb52f('0x1e'),auth[_0xb52f('0x9')](),controller['removeAgents']);module[_0xb52f('0x24')]=router; \ No newline at end of file +var _0x922a=['removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','/addaccountapplications','updateAccountApplications','/:id/send','send','addAgents','update','delete','destroy','removeDispositions','removeAnswers'];(function(_0xc5c1da,_0x14444b){var _0x3731f8=function(_0x18ce47){while(--_0x18ce47){_0xc5c1da['push'](_0xc5c1da['shift']());}};_0x3731f8(++_0x14444b);}(_0x922a,0x12f));var _0xa922=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x922a[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0xa922('0x0'));var util=require(_0xa922('0x1'));var path=require(_0xa922('0x2'));var timeout=require(_0xa922('0x3'));var express=require(_0xa922('0x4'));var router=express[_0xa922('0x5')]();var auth=require(_0xa922('0x6'));var interaction=require(_0xa922('0x7'));var config=require(_0xa922('0x8'));var controller=require(_0xa922('0x9'));router['get']('/',auth[_0xa922('0xa')](),controller['index']);router[_0xa922('0xb')](_0xa922('0xc'),auth[_0xa922('0xa')](),controller[_0xa922('0xd')]);router[_0xa922('0xb')](_0xa922('0xe'),auth[_0xa922('0xa')](),controller[_0xa922('0xf')]);router[_0xa922('0xb')](_0xa922('0x10'),auth[_0xa922('0xa')](),controller[_0xa922('0x11')]);router[_0xa922('0xb')](_0xa922('0x12'),auth[_0xa922('0xa')](),controller['getAnswers']);router[_0xa922('0xb')](_0xa922('0x13'),auth['isAuthenticated'](),controller[_0xa922('0x14')]);router[_0xa922('0xb')](_0xa922('0x15'),auth[_0xa922('0xa')](),controller[_0xa922('0x16')]);router['get'](_0xa922('0x17'),auth['isAuthenticated'](),controller[_0xa922('0x18')]);router['get'](_0xa922('0x19'),auth['isAuthenticated'](),controller[_0xa922('0x1a')]);router[_0xa922('0x1b')]('/',auth[_0xa922('0xa')](),controller[_0xa922('0x1c')]);router[_0xa922('0x1b')](_0xa922('0x10'),auth[_0xa922('0xa')](),controller[_0xa922('0x1d')]);router[_0xa922('0x1b')](_0xa922('0x12'),auth[_0xa922('0xa')](),controller[_0xa922('0x1e')]);router[_0xa922('0x1b')](_0xa922('0x13'),auth[_0xa922('0xa')](),controller['addInteraction']);router[_0xa922('0x1b')]('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0xa922('0x1b')](_0xa922('0x1f'),auth[_0xa922('0xa')](),controller['addAccountApplications']);router[_0xa922('0x1b')]('/updateaccountapplications',auth[_0xa922('0xa')](),controller[_0xa922('0x20')]);router['post'](_0xa922('0x21'),auth[_0xa922('0xa')](),controller[_0xa922('0x22')]);router[_0xa922('0x1b')]('/:id/users',auth['isAuthenticated'](),controller[_0xa922('0x23')]);router['put'](_0xa922('0xe'),auth[_0xa922('0xa')](),controller[_0xa922('0x24')]);router[_0xa922('0x25')]('/:id',auth[_0xa922('0xa')](),controller[_0xa922('0x26')]);router[_0xa922('0x25')](_0xa922('0x10'),auth[_0xa922('0xa')](),controller[_0xa922('0x27')]);router[_0xa922('0x25')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xa922('0x28')]);router[_0xa922('0x25')]('/:id/users',auth['isAuthenticated'](),controller[_0xa922('0x29')]);module[_0xa922('0x2a')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 7b41846..f12612d 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 _0x887b=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x430a10,_0x5b6abf){var _0xc98900=function(_0x2265db){while(--_0x2265db){_0x430a10['push'](_0x430a10['shift']());}};_0xc98900(++_0x5b6abf);}(_0x887b,0x185));var _0xb887=function(_0x49513e,_0x5ad1f7){_0x49513e=_0x49513e-0x0;var _0x5a51a1=_0x887b[_0x49513e];return _0x5a51a1;};'use strict';var Sequelize=require(_0xb887('0x0'));module[_0xb887('0x1')]={'priority':{'type':Sequelize[_0xb887('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb887('0x3')],'allowNull':![],'defaultValue':_0xb887('0x4')},'appdata':{'type':Sequelize[_0xb887('0x5')]()},'description':{'type':Sequelize[_0xb887('0x3')]},'interval':{'type':Sequelize[_0xb887('0x3')],'defaultValue':_0xb887('0x6')}}; \ No newline at end of file +var _0xa3d4=['noop','sequelize','INTEGER','STRING'];(function(_0x3da6eb,_0xed5f5){var _0x19aa32=function(_0x3b645b){while(--_0x3b645b){_0x3da6eb['push'](_0x3da6eb['shift']());}};_0x19aa32(++_0xed5f5);}(_0xa3d4,0x151));var _0x4a3d=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xa3d4[_0x2dea24];return _0x309d58;};'use strict';var Sequelize=require(_0x4a3d('0x0'));module['exports']={'priority':{'type':Sequelize[_0x4a3d('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4a3d('0x2')],'allowNull':![],'defaultValue':_0x4a3d('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4a3d('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 56ca654..961c88e 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 _0xe236=['include','findAll','rows','then','show','params','filtears','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','destroy','stack','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','name','merge','options','includeAll'];(function(_0x184759,_0x1cc38a){var _0xf26d5f=function(_0x1010c8){while(--_0x1010c8){_0x184759['push'](_0x184759['shift']());}};_0xf26d5f(++_0x1cc38a);}(_0xe236,0xe0));var _0x6e23=function(_0x5eca50,_0xc1e3f8){_0x5eca50=_0x5eca50-0x0;var _0x41fb84=_0xe236[_0x5eca50];return _0x41fb84;};'use strict';var pdf=require(_0x6e23('0x0'));var emlformat=require(_0x6e23('0x1'));var rimraf=require(_0x6e23('0x2'));var zipdir=require(_0x6e23('0x3'));var jsonpatch=require(_0x6e23('0x4'));var rp=require(_0x6e23('0x5'));var moment=require(_0x6e23('0x6'));var BPromise=require(_0x6e23('0x7'));var Mustache=require(_0x6e23('0x8'));var util=require(_0x6e23('0x9'));var path=require(_0x6e23('0xa'));var sox=require(_0x6e23('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6e23('0xc'));var squel=require('squel');var crypto=require(_0x6e23('0xd'));var jsforce=require(_0x6e23('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6e23('0xf'));var Papa=require(_0x6e23('0x10'));var Redis=require(_0x6e23('0x11'));var authService=require(_0x6e23('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e23('0x13'));var logger=require('../../config/logger')(_0x6e23('0x14'));var utils=require('../../config/utils');var config=require(_0x6e23('0x15'));var licenseUtil=require(_0x6e23('0x16'));var db=require(_0x6e23('0x17'))['db'];function respondWithStatusCode(_0x57402c,_0x4049c2){_0x4049c2=_0x4049c2||0xcc;return function(_0x32a0bc){if(_0x32a0bc){return _0x57402c[_0x6e23('0x18')](_0x4049c2);}return _0x57402c['status'](_0x4049c2)[_0x6e23('0x19')]();};}function respondWithResult(_0x555f02,_0x4d9d0f){_0x4d9d0f=_0x4d9d0f||0xc8;return function(_0xae97aa){if(_0xae97aa){return _0x555f02[_0x6e23('0x1a')](_0x4d9d0f)[_0x6e23('0x1b')](_0xae97aa);}};}function respondWithFilteredResult(_0x136822,_0x3c5855){return function(_0x409e54){if(_0x409e54){var _0x4508e5=_0x409e54[_0x6e23('0x1c')],_0x11b66c=_0x3c5855[_0x6e23('0x1d')],_0x49232f=_0x3c5855[_0x6e23('0x1d')]+_0x3c5855[_0x6e23('0x1e')],_0x4ebf11;if(_0x49232f>=_0x4508e5){_0x49232f=_0x4508e5;_0x4ebf11=0xc8;}else{_0x4ebf11=0xce;}_0x136822[_0x6e23('0x1a')](_0x4ebf11);return _0x136822[_0x6e23('0x1f')](_0x6e23('0x20'),_0x11b66c+'-'+_0x49232f+'/'+_0x4508e5)[_0x6e23('0x1b')](_0x409e54);}return null;};}function patchUpdates(_0x294043){return function(_0x4cdbe9){try{jsonpatch['apply'](_0x4cdbe9,_0x294043,!![]);}catch(_0x67936c){return BPromise[_0x6e23('0x21')](_0x67936c);}return _0x4cdbe9['save']();};}function saveUpdates(_0x3d5370,_0x23dabe){return function(_0x319803){if(_0x319803){return _0x319803['update'](_0x3d5370)['then'](function(_0x37c2bf){return _0x37c2bf;});}return null;};}function removeEntity(_0x20a109,_0x430966){return function(_0x161e54){if(_0x161e54){return _0x161e54[_0x6e23('0x22')]()['then'](function(){_0x20a109[_0x6e23('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48a286,_0x38eb2d){return function(_0x44db5e){if(!_0x44db5e){_0x48a286['sendStatus'](0x194);}return _0x44db5e;};}function handleError(_0xdcd202,_0x864e69){_0x864e69=_0x864e69||0x1f4;return function(_0x3b51f5){logger['error'](_0x3b51f5[_0x6e23('0x23')]);if(_0x3b51f5['name']){delete _0x3b51f5['name'];}_0xdcd202[_0x6e23('0x1a')](_0x864e69)[_0x6e23('0x24')](_0x3b51f5);};}exports[_0x6e23('0x25')]=function(_0x57c0a2,_0x2d102a){var _0x5524d1={},_0x5401e0={},_0x58ec84={'count':0x0,'rows':[]};var _0x7cacfe=_[_0x6e23('0x26')](db[_0x6e23('0x27')][_0x6e23('0x28')],function(_0x3afa41){return{'name':_0x3afa41[_0x6e23('0x29')],'type':_0x3afa41[_0x6e23('0x2a')][_0x6e23('0x2b')]};});_0x5401e0[_0x6e23('0x2c')]=_['map'](_0x7cacfe,'name');_0x5401e0[_0x6e23('0x2d')]=_[_0x6e23('0x2e')](_0x57c0a2[_0x6e23('0x2d')]);_0x5401e0[_0x6e23('0x2f')]=_[_0x6e23('0x30')](_0x5401e0[_0x6e23('0x2c')],_0x5401e0[_0x6e23('0x2d')]);_0x5524d1[_0x6e23('0x31')]=_['intersection'](_0x5401e0[_0x6e23('0x2c')],qs['fields'](_0x57c0a2[_0x6e23('0x2d')][_0x6e23('0x32')]));_0x5524d1[_0x6e23('0x31')]=_0x5524d1['attributes']['length']?_0x5524d1[_0x6e23('0x31')]:_0x5401e0[_0x6e23('0x2c')];if(!_0x57c0a2[_0x6e23('0x2d')]['hasOwnProperty'](_0x6e23('0x33'))){_0x5524d1[_0x6e23('0x1e')]=qs[_0x6e23('0x1e')](_0x57c0a2['query'][_0x6e23('0x1e')]);_0x5524d1[_0x6e23('0x1d')]=qs[_0x6e23('0x1d')](_0x57c0a2[_0x6e23('0x2d')][_0x6e23('0x1d')]);}_0x5524d1['order']=qs['sort'](_0x57c0a2[_0x6e23('0x2d')][_0x6e23('0x34')]);_0x5524d1[_0x6e23('0x35')]=qs[_0x6e23('0x2f')](_[_0x6e23('0x36')](_0x57c0a2[_0x6e23('0x2d')],_0x5401e0[_0x6e23('0x2f')]),_0x7cacfe);if(_0x57c0a2['query'][_0x6e23('0x37')]){_0x5524d1[_0x6e23('0x35')]=_['merge'](_0x5524d1[_0x6e23('0x35')],{'$or':_[_0x6e23('0x26')](_0x7cacfe,function(_0x54d65f){if(_0x54d65f[_0x6e23('0x2a')]!=='VIRTUAL'){var _0x5a5e24={};_0x5a5e24[_0x54d65f[_0x6e23('0x38')]]={'$like':'%'+_0x57c0a2['query'][_0x6e23('0x37')]+'%'};return _0x5a5e24;}})});}_0x5524d1=_[_0x6e23('0x39')]({},_0x5524d1,_0x57c0a2[_0x6e23('0x3a')]);var _0x3c3c35={'where':_0x5524d1[_0x6e23('0x35')]};return db['FaxApplication'][_0x6e23('0x1c')](_0x3c3c35)['then'](function(_0x3b6b98){_0x58ec84[_0x6e23('0x1c')]=_0x3b6b98;if(_0x57c0a2[_0x6e23('0x2d')][_0x6e23('0x3b')]){_0x5524d1[_0x6e23('0x3c')]=[{'all':!![]}];}return db[_0x6e23('0x27')][_0x6e23('0x3d')](_0x5524d1);})['then'](function(_0x15432f){_0x58ec84[_0x6e23('0x3e')]=_0x15432f;return _0x58ec84;})[_0x6e23('0x3f')](respondWithFilteredResult(_0x2d102a,_0x5524d1))['catch'](handleError(_0x2d102a,null));};exports[_0x6e23('0x40')]=function(_0x3a57b7,_0x4f2a4c){var _0x2bcce2={'raw':!![],'where':{'id':_0x3a57b7[_0x6e23('0x41')]['id']}},_0x23e709={};_0x23e709[_0x6e23('0x2c')]=_['keys'](db[_0x6e23('0x27')][_0x6e23('0x28')]);_0x23e709[_0x6e23('0x2d')]=_[_0x6e23('0x2e')](_0x3a57b7[_0x6e23('0x2d')]);_0x23e709[_0x6e23('0x42')]=_[_0x6e23('0x30')](_0x23e709[_0x6e23('0x2c')],_0x23e709[_0x6e23('0x2d')]);_0x2bcce2[_0x6e23('0x31')]=_[_0x6e23('0x30')](_0x23e709[_0x6e23('0x2c')],qs['fields'](_0x3a57b7[_0x6e23('0x2d')]['fields']));_0x2bcce2[_0x6e23('0x31')]=_0x2bcce2[_0x6e23('0x31')]['length']?_0x2bcce2[_0x6e23('0x31')]:_0x23e709[_0x6e23('0x2c')];if(_0x3a57b7[_0x6e23('0x2d')][_0x6e23('0x3b')]){_0x2bcce2[_0x6e23('0x3c')]=[{'all':!![]}];}_0x2bcce2=_[_0x6e23('0x39')]({},_0x2bcce2,_0x3a57b7['options']);return db[_0x6e23('0x27')][_0x6e23('0x43')](_0x2bcce2)['then'](handleEntityNotFound(_0x4f2a4c,null))[_0x6e23('0x3f')](respondWithResult(_0x4f2a4c,null))[_0x6e23('0x44')](handleError(_0x4f2a4c,null));};exports[_0x6e23('0x45')]=function(_0x391fbb,_0x2b1bab){return db['FaxApplication'][_0x6e23('0x45')](_0x391fbb[_0x6e23('0x46')],{})[_0x6e23('0x3f')](respondWithResult(_0x2b1bab,0xc9))['catch'](handleError(_0x2b1bab,null));};exports['update']=function(_0x5d43d8,_0x12955c){if(_0x5d43d8[_0x6e23('0x46')]['id']){delete _0x5d43d8[_0x6e23('0x46')]['id'];}return db[_0x6e23('0x27')][_0x6e23('0x43')]({'where':{'id':_0x5d43d8[_0x6e23('0x41')]['id']}})[_0x6e23('0x3f')](handleEntityNotFound(_0x12955c,null))[_0x6e23('0x3f')](saveUpdates(_0x5d43d8[_0x6e23('0x46')],null))[_0x6e23('0x3f')](respondWithResult(_0x12955c,null))[_0x6e23('0x44')](handleError(_0x12955c,null));};exports['destroy']=function(_0x34eeda,_0x23b0b5){return db[_0x6e23('0x27')]['find']({'where':{'id':_0x34eeda[_0x6e23('0x41')]['id']}})['then'](handleEntityNotFound(_0x23b0b5,null))[_0x6e23('0x3f')](removeEntity(_0x23b0b5,null))['catch'](handleError(_0x23b0b5,null));}; \ No newline at end of file +var _0x43f3=['order','sort','filters','pick','filter','merge','where','options','includeAll','include','findAll','rows','filtears','length','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','offset','limit','status','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','type','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x43f3,0xab));var _0x343f=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x43f3[_0x1b4b23];return _0x2a325b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x343f('0x0'));var rimraf=require(_0x343f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x343f('0x2'));var rp=require('request-promise');var moment=require(_0x343f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x343f('0x4'));var util=require(_0x343f('0x5'));var path=require(_0x343f('0x6'));var sox=require('sox');var csv=require(_0x343f('0x7'));var ejs=require(_0x343f('0x8'));var fs=require('fs');var _=require(_0x343f('0x9'));var squel=require(_0x343f('0xa'));var crypto=require(_0x343f('0xb'));var jsforce=require(_0x343f('0xc'));var deskjs=require(_0x343f('0xd'));var toCsv=require(_0x343f('0x7'));var querystring=require(_0x343f('0xe'));var Papa=require(_0x343f('0xf'));var Redis=require(_0x343f('0x10'));var authService=require(_0x343f('0x11'));var qs=require(_0x343f('0x12'));var as=require(_0x343f('0x13'));var hardwareService=require(_0x343f('0x14'));var logger=require(_0x343f('0x15'))(_0x343f('0x16'));var utils=require(_0x343f('0x17'));var config=require(_0x343f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x343f('0x19'))['db'];function respondWithStatusCode(_0x524b21,_0x47dd74){_0x47dd74=_0x47dd74||0xcc;return function(_0xa3f54){if(_0xa3f54){return _0x524b21[_0x343f('0x1a')](_0x47dd74);}return _0x524b21['status'](_0x47dd74)['end']();};}function respondWithResult(_0x3dbbd3,_0x552c07){_0x552c07=_0x552c07||0xc8;return function(_0x414029){if(_0x414029){return _0x3dbbd3['status'](_0x552c07)[_0x343f('0x1b')](_0x414029);}};}function respondWithFilteredResult(_0x950400,_0x1c399c){return function(_0x45ddab){if(_0x45ddab){var _0x189d1b=_0x45ddab[_0x343f('0x1c')],_0x50ccfe=_0x1c399c[_0x343f('0x1d')],_0x4ae9ef=_0x1c399c[_0x343f('0x1d')]+_0x1c399c[_0x343f('0x1e')],_0x21c19b;if(_0x4ae9ef>=_0x189d1b){_0x4ae9ef=_0x189d1b;_0x21c19b=0xc8;}else{_0x21c19b=0xce;}_0x950400[_0x343f('0x1f')](_0x21c19b);return _0x950400['set'](_0x343f('0x20'),_0x50ccfe+'-'+_0x4ae9ef+'/'+_0x189d1b)[_0x343f('0x1b')](_0x45ddab);}return null;};}function patchUpdates(_0x1103da){return function(_0x1637d9){try{jsonpatch[_0x343f('0x21')](_0x1637d9,_0x1103da,!![]);}catch(_0xe837ce){return BPromise[_0x343f('0x22')](_0xe837ce);}return _0x1637d9[_0x343f('0x23')]();};}function saveUpdates(_0x48ff0,_0x3a0352){return function(_0x1ee0bf){if(_0x1ee0bf){return _0x1ee0bf[_0x343f('0x24')](_0x48ff0)[_0x343f('0x25')](function(_0x5e678c){return _0x5e678c;});}return null;};}function removeEntity(_0x3128fd,_0x577f87){return function(_0x24d568){if(_0x24d568){return _0x24d568[_0x343f('0x26')]()[_0x343f('0x25')](function(){_0x3128fd[_0x343f('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40c9ae,_0x78a79e){return function(_0x3b82fe){if(!_0x3b82fe){_0x40c9ae[_0x343f('0x1a')](0x194);}return _0x3b82fe;};}function handleError(_0xa486bd,_0x2ef4c3){_0x2ef4c3=_0x2ef4c3||0x1f4;return function(_0x25d61b){logger[_0x343f('0x27')](_0x25d61b[_0x343f('0x28')]);if(_0x25d61b[_0x343f('0x29')]){delete _0x25d61b[_0x343f('0x29')];}_0xa486bd[_0x343f('0x1f')](_0x2ef4c3)[_0x343f('0x2a')](_0x25d61b);};}exports[_0x343f('0x2b')]=function(_0x4f42c2,_0x39f161){var _0x3b647d={},_0x1c8dd6={},_0x5a2a5d={'count':0x0,'rows':[]};var _0x3d4873=_[_0x343f('0x2c')](db[_0x343f('0x2d')][_0x343f('0x2e')],function(_0x23477a){return{'name':_0x23477a['fieldName'],'type':_0x23477a[_0x343f('0x2f')][_0x343f('0x30')]};});_0x1c8dd6['model']=_['map'](_0x3d4873,'name');_0x1c8dd6['query']=_[_0x343f('0x31')](_0x4f42c2[_0x343f('0x32')]);_0x1c8dd6['filters']=_[_0x343f('0x33')](_0x1c8dd6[_0x343f('0x34')],_0x1c8dd6['query']);_0x3b647d[_0x343f('0x35')]=_['intersection'](_0x1c8dd6[_0x343f('0x34')],qs[_0x343f('0x36')](_0x4f42c2[_0x343f('0x32')][_0x343f('0x36')]));_0x3b647d['attributes']=_0x3b647d[_0x343f('0x35')]['length']?_0x3b647d[_0x343f('0x35')]:_0x1c8dd6[_0x343f('0x34')];if(!_0x4f42c2[_0x343f('0x32')][_0x343f('0x37')](_0x343f('0x38'))){_0x3b647d[_0x343f('0x1e')]=qs[_0x343f('0x1e')](_0x4f42c2[_0x343f('0x32')][_0x343f('0x1e')]);_0x3b647d['offset']=qs['offset'](_0x4f42c2[_0x343f('0x32')][_0x343f('0x1d')]);}_0x3b647d[_0x343f('0x39')]=qs[_0x343f('0x3a')](_0x4f42c2[_0x343f('0x32')][_0x343f('0x3a')]);_0x3b647d['where']=qs[_0x343f('0x3b')](_[_0x343f('0x3c')](_0x4f42c2['query'],_0x1c8dd6[_0x343f('0x3b')]),_0x3d4873);if(_0x4f42c2['query'][_0x343f('0x3d')]){_0x3b647d['where']=_[_0x343f('0x3e')](_0x3b647d[_0x343f('0x3f')],{'$or':_[_0x343f('0x2c')](_0x3d4873,function(_0x4d444d){if(_0x4d444d[_0x343f('0x2f')]!=='VIRTUAL'){var _0x38d4a8={};_0x38d4a8[_0x4d444d[_0x343f('0x29')]]={'$like':'%'+_0x4f42c2['query'][_0x343f('0x3d')]+'%'};return _0x38d4a8;}})});}_0x3b647d=_[_0x343f('0x3e')]({},_0x3b647d,_0x4f42c2[_0x343f('0x40')]);var _0x58f243={'where':_0x3b647d[_0x343f('0x3f')]};return db['FaxApplication'][_0x343f('0x1c')](_0x58f243)['then'](function(_0x4385ad){_0x5a2a5d['count']=_0x4385ad;if(_0x4f42c2[_0x343f('0x32')][_0x343f('0x41')]){_0x3b647d[_0x343f('0x42')]=[{'all':!![]}];}return db['FaxApplication'][_0x343f('0x43')](_0x3b647d);})['then'](function(_0x12e358){_0x5a2a5d[_0x343f('0x44')]=_0x12e358;return _0x5a2a5d;})['then'](respondWithFilteredResult(_0x39f161,_0x3b647d))['catch'](handleError(_0x39f161,null));};exports['show']=function(_0x40bd7b,_0x216e27){var _0x261f8b={'raw':!![],'where':{'id':_0x40bd7b['params']['id']}},_0x398014={};_0x398014[_0x343f('0x34')]=_[_0x343f('0x31')](db[_0x343f('0x2d')][_0x343f('0x2e')]);_0x398014[_0x343f('0x32')]=_[_0x343f('0x31')](_0x40bd7b[_0x343f('0x32')]);_0x398014[_0x343f('0x45')]=_['intersection'](_0x398014[_0x343f('0x34')],_0x398014[_0x343f('0x32')]);_0x261f8b[_0x343f('0x35')]=_[_0x343f('0x33')](_0x398014['model'],qs['fields'](_0x40bd7b[_0x343f('0x32')]['fields']));_0x261f8b['attributes']=_0x261f8b[_0x343f('0x35')][_0x343f('0x46')]?_0x261f8b[_0x343f('0x35')]:_0x398014[_0x343f('0x34')];if(_0x40bd7b['query']['includeAll']){_0x261f8b[_0x343f('0x42')]=[{'all':!![]}];}_0x261f8b=_[_0x343f('0x3e')]({},_0x261f8b,_0x40bd7b[_0x343f('0x40')]);return db[_0x343f('0x2d')][_0x343f('0x47')](_0x261f8b)[_0x343f('0x25')](handleEntityNotFound(_0x216e27,null))[_0x343f('0x25')](respondWithResult(_0x216e27,null))[_0x343f('0x48')](handleError(_0x216e27,null));};exports[_0x343f('0x49')]=function(_0x4cf0e6,_0x5a51a8){return db[_0x343f('0x2d')][_0x343f('0x49')](_0x4cf0e6[_0x343f('0x4a')],{})['then'](respondWithResult(_0x5a51a8,0xc9))['catch'](handleError(_0x5a51a8,null));};exports['update']=function(_0xb3cdff,_0x125ccc){if(_0xb3cdff[_0x343f('0x4a')]['id']){delete _0xb3cdff[_0x343f('0x4a')]['id'];}return db[_0x343f('0x2d')][_0x343f('0x47')]({'where':{'id':_0xb3cdff[_0x343f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x125ccc,null))[_0x343f('0x25')](saveUpdates(_0xb3cdff[_0x343f('0x4a')],null))[_0x343f('0x25')](respondWithResult(_0x125ccc,null))[_0x343f('0x48')](handleError(_0x125ccc,null));};exports[_0x343f('0x26')]=function(_0x5ef7ba,_0x18a3c4){return db['FaxApplication'][_0x343f('0x47')]({'where':{'id':_0x5ef7ba[_0x343f('0x4b')]['id']}})[_0x343f('0x25')](handleEntityNotFound(_0x18a3c4,null))[_0x343f('0x25')](removeEntity(_0x18a3c4,null))[_0x343f('0x48')](handleError(_0x18a3c4,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 04fcd55..8b80b39 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 _0xb8a9=['path','exports','define','FaxApplication','utf8mb4_unicode_ci','util','../../config/logger','bluebird','request-promise'];(function(_0x29b0d0,_0x42f4d1){var _0x3b8d92=function(_0x283d42){while(--_0x283d42){_0x29b0d0['push'](_0x29b0d0['shift']());}};_0x3b8d92(++_0x42f4d1);}(_0xb8a9,0x95));var _0x9b8a=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xb8a9[_0x1a36a5];return _0x746243;};'use strict';var _=require('lodash');var util=require(_0x9b8a('0x0'));var logger=require(_0x9b8a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9b8a('0x2'));var rp=require(_0x9b8a('0x3'));var fs=require('fs');var path=require(_0x9b8a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0x9b8a('0x5')]=function(_0x50f702,_0xab7974){return _0x50f702[_0x9b8a('0x6')](_0x9b8a('0x7'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9b8a('0x8')});}; \ No newline at end of file +var _0xc77e=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xc77e,0x10c));var _0xec77=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc77e[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0xec77('0x0'));var logger=require(_0xec77('0x1'))('api');var moment=require(_0xec77('0x2'));var BPromise=require('bluebird');var rp=require(_0xec77('0x3'));var fs=require('fs');var path=require(_0xec77('0x4'));var rimraf=require(_0xec77('0x5'));var config=require(_0xec77('0x6'));var attributes=require(_0xec77('0x7'));module[_0xec77('0x8')]=function(_0x5bd44e,_0x598032){return _0x5bd44e[_0xec77('0x9')](_0xec77('0xa'),attributes,{'tableName':_0xec77('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xec77('0xc'),'collate':_0xec77('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 810df5f..aeb168e 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 _0xb3a2=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','update','options','where','attributes','limit','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x7d424a,_0x611e5f){var _0x28cd71=function(_0x38a886){while(--_0x38a886){_0x7d424a['push'](_0x7d424a['shift']());}};_0x28cd71(++_0x611e5f);}(_0xb3a2,0x18d));var _0x2b3a=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xb3a2[_0x5f1391];return _0x50ebe3;};'use strict';var _=require('lodash');var util=require(_0x2b3a('0x0'));var moment=require(_0x2b3a('0x1'));var BPromise=require(_0x2b3a('0x2'));var rs=require(_0x2b3a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b3a('0x4'))['db'];var utils=require(_0x2b3a('0x5'));var logger=require(_0x2b3a('0x6'))('rpc');var config=require(_0x2b3a('0x7'));var jayson=require(_0x2b3a('0x8'));var client=jayson[_0x2b3a('0x9')][_0x2b3a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x360a9e,_0x39a8de,_0x507001){return new BPromise(function(_0xd1350b,_0x237bc6){return client[_0x2b3a('0xb')](_0x360a9e,_0x507001)[_0x2b3a('0xc')](function(_0x1bb4e3){logger[_0x2b3a('0xd')]('FaxApplication,\x20%s,\x20%s',_0x39a8de,_0x2b3a('0xe'));logger[_0x2b3a('0xf')](_0x2b3a('0x10'),_0x39a8de,'request\x20sent',JSON['stringify'](_0x1bb4e3));if(_0x1bb4e3['error']){if(_0x1bb4e3[_0x2b3a('0x11')][_0x2b3a('0x12')]===0x1f4){logger['error'](_0x2b3a('0x13'),_0x39a8de,_0x1bb4e3[_0x2b3a('0x11')][_0x2b3a('0x14')]);return _0x237bc6(_0x1bb4e3['error'][_0x2b3a('0x14')]);}logger[_0x2b3a('0x11')](_0x2b3a('0x13'),_0x39a8de,_0x1bb4e3[_0x2b3a('0x11')][_0x2b3a('0x14')]);return _0xd1350b(_0x1bb4e3['error'][_0x2b3a('0x14')]);}else{logger[_0x2b3a('0xd')](_0x2b3a('0x13'),_0x39a8de,_0x2b3a('0xe'));_0xd1350b(_0x1bb4e3[_0x2b3a('0x15')][_0x2b3a('0x14')]);}})[_0x2b3a('0x16')](function(_0x263966){logger[_0x2b3a('0x11')](_0x2b3a('0x13'),_0x39a8de,_0x263966);_0x237bc6(_0x263966);});});}exports[_0x2b3a('0x17')]=function(_0x3bf6a0){var _0x243f8c=this;return new Promise(function(_0x198496,_0x33d3ad){return db[_0x2b3a('0x18')][_0x2b3a('0x19')](_0x3bf6a0['body'],{'raw':_0x3bf6a0['options']?_0x3bf6a0[_0x2b3a('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bf6a0[_0x2b3a('0x1a')]?_0x3bf6a0[_0x2b3a('0x1a')][_0x2b3a('0x1b')]||null:null,'attributes':_0x3bf6a0[_0x2b3a('0x1a')]?_0x3bf6a0['options'][_0x2b3a('0x1c')]||null:null,'limit':_0x3bf6a0[_0x2b3a('0x1a')]?_0x3bf6a0[_0x2b3a('0x1a')][_0x2b3a('0x1d')]||null:null})[_0x2b3a('0xc')](function(_0x4cb36b){logger['info'](_0x2b3a('0x17'),_0x3bf6a0);logger[_0x2b3a('0xf')](_0x2b3a('0x17'),_0x3bf6a0,JSON[_0x2b3a('0x1e')](_0x4cb36b));_0x198496(_0x4cb36b);})[_0x2b3a('0x16')](function(_0x1080c3){logger[_0x2b3a('0x11')]('UpdateFaxApplication',_0x1080c3[_0x2b3a('0x14')],_0x3bf6a0);_0x33d3ad(_0x243f8c[_0x2b3a('0x11')](0x1f4,_0x1080c3[_0x2b3a('0x14')]));});});}; \ No newline at end of file +var _0xbab2=['where','limit','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','options','raw'];(function(_0x5c6b86,_0x325c7b){var _0x4bb85e=function(_0x3daaf4){while(--_0x3daaf4){_0x5c6b86['push'](_0x5c6b86['shift']());}};_0x4bb85e(++_0x325c7b);}(_0xbab2,0x14d));var _0x2bab=function(_0x295c8c,_0x5bf0fc){_0x295c8c=_0x295c8c-0x0;var _0x5b8bfa=_0xbab2[_0x295c8c];return _0x5b8bfa;};'use strict';var _=require(_0x2bab('0x0'));var util=require(_0x2bab('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2bab('0x2'));var fs=require('fs');var Redis=require(_0x2bab('0x3'));var db=require(_0x2bab('0x4'))['db'];var utils=require(_0x2bab('0x5'));var logger=require(_0x2bab('0x6'))(_0x2bab('0x7'));var config=require(_0x2bab('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2bab('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb30c0a,_0x1b77b5,_0x27c234){return new BPromise(function(_0x11891a,_0x4f4f02){return client[_0x2bab('0xa')](_0xb30c0a,_0x27c234)[_0x2bab('0xb')](function(_0x426812){logger[_0x2bab('0xc')](_0x2bab('0xd'),_0x1b77b5,_0x2bab('0xe'));logger[_0x2bab('0xf')](_0x2bab('0x10'),_0x1b77b5,_0x2bab('0xe'),JSON['stringify'](_0x426812));if(_0x426812[_0x2bab('0x11')]){if(_0x426812['error'][_0x2bab('0x12')]===0x1f4){logger['error'](_0x2bab('0xd'),_0x1b77b5,_0x426812['error'][_0x2bab('0x13')]);return _0x4f4f02(_0x426812['error'][_0x2bab('0x13')]);}logger['error'](_0x2bab('0xd'),_0x1b77b5,_0x426812[_0x2bab('0x11')][_0x2bab('0x13')]);return _0x11891a(_0x426812['error'][_0x2bab('0x13')]);}else{logger[_0x2bab('0xc')](_0x2bab('0xd'),_0x1b77b5,_0x2bab('0xe'));_0x11891a(_0x426812[_0x2bab('0x14')][_0x2bab('0x13')]);}})[_0x2bab('0x15')](function(_0x5a04eb){logger[_0x2bab('0x11')]('FaxApplication,\x20%s,\x20%s',_0x1b77b5,_0x5a04eb);_0x4f4f02(_0x5a04eb);});});}exports[_0x2bab('0x16')]=function(_0x2aaeb9){var _0x2b56b0=this;return new Promise(function(_0x2ca18f,_0x1065fa){return db[_0x2bab('0x17')][_0x2bab('0x18')](_0x2aaeb9['body'],{'raw':_0x2aaeb9[_0x2bab('0x19')]?_0x2aaeb9[_0x2bab('0x19')][_0x2bab('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2aaeb9[_0x2bab('0x19')]?_0x2aaeb9[_0x2bab('0x19')][_0x2bab('0x1b')]||null:null,'attributes':_0x2aaeb9['options']?_0x2aaeb9[_0x2bab('0x19')]['attributes']||null:null,'limit':_0x2aaeb9[_0x2bab('0x19')]?_0x2aaeb9['options'][_0x2bab('0x1c')]||null:null})[_0x2bab('0xb')](function(_0x24f491){logger[_0x2bab('0xc')](_0x2bab('0x16'),_0x2aaeb9);logger[_0x2bab('0xf')](_0x2bab('0x16'),_0x2aaeb9,JSON[_0x2bab('0x1d')](_0x24f491));_0x2ca18f(_0x24f491);})[_0x2bab('0x15')](function(_0x3e21eb){logger['error'](_0x2bab('0x16'),_0x3e21eb[_0x2bab('0x13')],_0x2aaeb9);_0x1065fa(_0x2b56b0[_0x2bab('0x11')](0x1f4,_0x3e21eb[_0x2bab('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index d173ebf..ebfe6fe 100644 --- a/server/api/faxApplication/index.js +++ b/server/api/faxApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['connect-timeout','express','Router','./faxApplication.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','util','path'];(function(_0x20dbe3,_0x2cc5b3){var _0x57b693=function(_0x462771){while(--_0x462771){_0x20dbe3['push'](_0x20dbe3['shift']());}};_0x57b693(++_0x2cc5b3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xc4aa[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac4a('0x6'));router[_0xac4a('0x7')]('/',auth[_0xac4a('0x8')](),controller[_0xac4a('0x9')]);router[_0xac4a('0x7')](_0xac4a('0xa'),auth[_0xac4a('0x8')](),controller[_0xac4a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xac4a('0xc')]);router[_0xac4a('0xd')](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8958=['isAuthenticated','show','create','put','update','delete','destroy','util','../../components/auth/service','../../config/environment','./faxApplication.controller','get','index','/:id'];(function(_0x2c33c8,_0x463c14){var _0x52e7f8=function(_0x3bccba){while(--_0x3bccba){_0x2c33c8['push'](_0x2c33c8['shift']());}};_0x52e7f8(++_0x463c14);}(_0x8958,0x93));var _0x8895=function(_0x2c3f37,_0x5a46b6){_0x2c3f37=_0x2c3f37-0x0;var _0x12a453=_0x8958[_0x2c3f37];return _0x12a453;};'use strict';var multer=require('multer');var util=require(_0x8895('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x8895('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0x8895('0x2'));var controller=require(_0x8895('0x3'));router[_0x8895('0x4')]('/',auth['isAuthenticated'](),controller[_0x8895('0x5')]);router[_0x8895('0x4')](_0x8895('0x6'),auth[_0x8895('0x7')](),controller[_0x8895('0x8')]);router['post']('/',auth[_0x8895('0x7')](),controller[_0x8895('0x9')]);router[_0x8895('0xa')](_0x8895('0x6'),auth[_0x8895('0x7')](),controller[_0x8895('0xb')]);router[_0x8895('0xc')](_0x8895('0x6'),auth[_0x8895('0x7')](),controller[_0x8895('0xd')]);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 1555a27..37508a5 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 _0x23d3=['ENUM','sequelize','exports','BOOLEAN','STRING','DATE','out'];(function(_0x155882,_0x240858){var _0x5aaf42=function(_0x11f7f1){while(--_0x11f7f1){_0x155882['push'](_0x155882['shift']());}};_0x5aaf42(++_0x240858);}(_0x23d3,0xe8));var _0x323d=function(_0x2f9d62,_0x4f3015){_0x2f9d62=_0x2f9d62-0x0;var _0x520f72=_0x23d3[_0x2f9d62];return _0x520f72;};'use strict';var Sequelize=require(_0x323d('0x0'));module[_0x323d('0x1')]={'closed':{'type':Sequelize[_0x323d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x323d('0x3')]},'secondDisposition':{'type':Sequelize[_0x323d('0x3')]},'thirdDisposition':{'type':Sequelize[_0x323d('0x3')]},'note':{'type':Sequelize[_0x323d('0x3')]},'read1stAt':{'type':Sequelize[_0x323d('0x4')]},'fax':{'type':Sequelize[_0x323d('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x323d('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x323d('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x323d('0x6')]('in',_0x323d('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x1b94=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x2bab95,_0x15f1a8){var _0x5b31cd=function(_0x1fc7ea){while(--_0x1fc7ea){_0x2bab95['push'](_0x2bab95['shift']());}};_0x5b31cd(++_0x15f1a8);}(_0x1b94,0x1f2));var _0x41b9=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x1b94[_0x599f41];return _0x2e4d58;};'use strict';var Sequelize=require(_0x41b9('0x0'));module[_0x41b9('0x1')]={'closed':{'type':Sequelize[_0x41b9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x41b9('0x3')]},'disposition':{'type':Sequelize[_0x41b9('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x41b9('0x4')]},'note':{'type':Sequelize[_0x41b9('0x4')]},'read1stAt':{'type':Sequelize[_0x41b9('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x41b9('0x5')]('in',_0x41b9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x41b9('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x41b9('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 37274f9..6dbfa4e 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 _0x7a62=['Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','rows','show','params','filtears','fields','includeAll','include','merge','catch','create','update','describe','addMessage','ids','omit','getMessages','findOne','nolimit','format','options','FaxMessage','findAll','setTags','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','basename','existsSync','pipe','createWriteStream','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','Users','map','fullname','Tags','split','forEach','push','TagIds','index','FaxInteraction','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','hasOwnProperty','order','sort','filters','pick','select','field','color','from','tools_tags','u.id','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','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','type','text','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','start','body','some','isEmpty','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal'];(function(_0x3a9635,_0x1ab817){var _0x10d08c=function(_0x222242){while(--_0x222242){_0x3a9635['push'](_0x3a9635['shift']());}};_0x10d08c(++_0x1ab817);}(_0x7a62,0x111));var _0x27a6=function(_0x3916e2,_0x3e8602){_0x3916e2=_0x3916e2-0x0;var _0x389929=_0x7a62[_0x3916e2];return _0x389929;};'use strict';var pdf=require(_0x27a6('0x0'));var emlformat=require(_0x27a6('0x1'));var rimraf=require(_0x27a6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x27a6('0x3'));var rp=require(_0x27a6('0x4'));var moment=require(_0x27a6('0x5'));var BPromise=require(_0x27a6('0x6'));var Mustache=require(_0x27a6('0x7'));var util=require(_0x27a6('0x8'));var path=require('path');var sox=require(_0x27a6('0x9'));var csv=require('to-csv');var ejs=require(_0x27a6('0xa'));var fs=require('fs');var _=require(_0x27a6('0xb'));var squel=require(_0x27a6('0xc'));var crypto=require('crypto');var jsforce=require(_0x27a6('0xd'));var deskjs=require(_0x27a6('0xe'));var toCsv=require(_0x27a6('0xf'));var querystring=require(_0x27a6('0x10'));var Papa=require(_0x27a6('0x11'));var Redis=require(_0x27a6('0x12'));var authService=require(_0x27a6('0x13'));var qs=require(_0x27a6('0x14'));var as=require(_0x27a6('0x15'));var hardwareService=require(_0x27a6('0x16'));var logger=require('../../config/logger')(_0x27a6('0x17'));var utils=require(_0x27a6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x27a6('0x19'));var db=require('../../mysqldb')['db'];config[_0x27a6('0x1a')]=_[_0x27a6('0x1b')](config[_0x27a6('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x27a6('0x1c'))(new Redis(config[_0x27a6('0x1a')]));require(_0x27a6('0x1d'))[_0x27a6('0x1e')](socket);function respondWithStatusCode(_0xc40fa0,_0x546c30){_0x546c30=_0x546c30||0xcc;return function(_0x3f707e){if(_0x3f707e){return _0xc40fa0[_0x27a6('0x1f')](_0x546c30);}return _0xc40fa0['status'](_0x546c30)['end']();};}function respondWithResult(_0x123930,_0xcc8ff9){_0xcc8ff9=_0xcc8ff9||0xc8;return function(_0x5e86f1){if(_0x5e86f1){return _0x123930[_0x27a6('0x20')](_0xcc8ff9)['json'](_0x5e86f1);}};}function respondWithFilteredResult(_0x381792,_0xc5dca4){return function(_0x1c2dd0){if(_0x1c2dd0){var _0x589702=_0x1c2dd0[_0x27a6('0x21')],_0x2a6551=_0xc5dca4['offset'],_0x585a17=_0xc5dca4[_0x27a6('0x22')]+_0xc5dca4[_0x27a6('0x23')],_0x383929;if(_0x585a17>=_0x589702){_0x585a17=_0x589702;_0x383929=0xc8;}else{_0x383929=0xce;}_0x381792[_0x27a6('0x20')](_0x383929);return _0x381792[_0x27a6('0x24')](_0x27a6('0x25'),_0x2a6551+'-'+_0x585a17+'/'+_0x589702)[_0x27a6('0x26')](_0x1c2dd0);}return null;};}function patchUpdates(_0x50705c){return function(_0x47aa70){try{jsonpatch[_0x27a6('0x27')](_0x47aa70,_0x50705c,!![]);}catch(_0x486a44){return BPromise[_0x27a6('0x28')](_0x486a44);}return _0x47aa70[_0x27a6('0x29')]();};}function saveUpdates(_0x46aed4,_0x54864b){return function(_0x42969f){if(_0x42969f){return _0x42969f['update'](_0x46aed4)[_0x27a6('0x2a')](function(_0x186654){return _0x186654;});}return null;};}function removeEntity(_0x397ae0,_0xb848f2){return function(_0x57df3e){if(_0x57df3e){return _0x57df3e[_0x27a6('0x2b')]()[_0x27a6('0x2a')](function(){_0x397ae0[_0x27a6('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27afc9,_0x5a7005){return function(_0x553db2){if(!_0x553db2){_0x27afc9[_0x27a6('0x1f')](0x194);}return _0x553db2;};}function handleError(_0x69969,_0x1048ae){_0x1048ae=_0x1048ae||0x1f4;return function(_0x38e1ed){logger[_0x27a6('0x2c')](_0x38e1ed[_0x27a6('0x2d')]);if(_0x38e1ed[_0x27a6('0x2e')]){delete _0x38e1ed[_0x27a6('0x2e')];}_0x69969[_0x27a6('0x20')](_0x1048ae)[_0x27a6('0x2f')](_0x38e1ed);};}function getInteractionUsers(_0x444796,_0x5b31cb){return new BPromise(function(_0x1edd0d,_0x25ba89){try{if(_0x5b31cb[_0x444796['id']]){_0x444796[_0x27a6('0x30')]=_[_0x27a6('0x31')](_0x5b31cb[_0x444796['id']],function(_0x4cab0d){return{'id':_0x4cab0d['id'],'fullname':_0x4cab0d[_0x27a6('0x32')]};});}}catch(_0x125b95){_0x25ba89(_0x125b95);}_0x1edd0d(_0x444796);});}function getInteractionTags(_0x4861ec,_0x351e98){return new BPromise(function(_0x4ad641,_0x1bc43a){try{if(_0x4861ec['TagIds']){_0x4861ec[_0x27a6('0x33')]=[];_0x4861ec['TagIds'][_0x27a6('0x34')](',')[_0x27a6('0x35')](function(_0x5a95b5){_0x4861ec[_0x27a6('0x33')][_0x27a6('0x36')](_0x351e98[_0x5a95b5]);});}delete _0x4861ec[_0x27a6('0x37')];}catch(_0xc80078){_0x1bc43a(_0xc80078);}_0x4ad641(_0x4861ec);});}function updateFaxInteraction(_0x50c742,_0x5a2edb,_0x1b2c9f){return new BPromise(function(_0x5cc1b6,_0x22336d){return getInteractionUsers(_0x50c742,_0x1b2c9f)['then'](function(_0x57c3c7){return getInteractionTags(_0x57c3c7,_0x5a2edb);})[_0x27a6('0x2a')](function(_0x3fe4f7){_0x5cc1b6(_0x3fe4f7);})['catch'](function(_0x307549){_0x22336d(_0x307549);});});}exports[_0x27a6('0x38')]=function(_0x1c25b6,_0x43c62e){var _0x1407ab={},_0x4c5a74={},_0x2f6067={'count':0x0,'rows':[]};var _0x5e88ce=_[_0x27a6('0x31')](db[_0x27a6('0x39')][_0x27a6('0x3a')],function(_0x213d7b){return{'name':_0x213d7b[_0x27a6('0x3b')],'type':_0x213d7b['type'][_0x27a6('0x3c')]};});_0x4c5a74[_0x27a6('0x3d')]=_[_0x27a6('0x31')](_0x5e88ce,_0x27a6('0x2e'));_0x4c5a74[_0x27a6('0x3e')]=_[_0x27a6('0x3f')](_0x1c25b6['query']);_0x4c5a74['filters']=_['intersection'](_0x4c5a74[_0x27a6('0x3d')],_0x4c5a74[_0x27a6('0x3e')]);_0x1407ab[_0x27a6('0x40')]=_[_0x27a6('0x41')](_0x4c5a74[_0x27a6('0x3d')],qs['fields'](_0x1c25b6[_0x27a6('0x3e')]['fields']));_0x1407ab[_0x27a6('0x40')]=_0x1407ab[_0x27a6('0x40')]['length']?_0x1407ab[_0x27a6('0x40')]:_0x4c5a74[_0x27a6('0x3d')];if(!_0x1c25b6[_0x27a6('0x3e')][_0x27a6('0x42')]('nolimit')){_0x1407ab[_0x27a6('0x23')]=qs[_0x27a6('0x23')](_0x1c25b6['query'][_0x27a6('0x23')]);_0x1407ab['offset']=qs['offset'](_0x1c25b6[_0x27a6('0x3e')][_0x27a6('0x22')]);}_0x1407ab[_0x27a6('0x43')]=qs[_0x27a6('0x44')](_0x1c25b6[_0x27a6('0x3e')][_0x27a6('0x44')]);_0x1407ab['where']=qs[_0x27a6('0x45')](_[_0x27a6('0x46')](_0x1c25b6[_0x27a6('0x3e')],_0x4c5a74[_0x27a6('0x45')]),_0x5e88ce);var _0x305f75=[];var _0x3270d5=squel[_0x27a6('0x47')]()[_0x27a6('0x48')]('id')[_0x27a6('0x48')](_0x27a6('0x2e'))['field'](_0x27a6('0x49'))[_0x27a6('0x4a')](_0x27a6('0x4b'));var _0x319dff=squel[_0x27a6('0x47')]()['field'](_0x27a6('0x4c'))[_0x27a6('0x48')]('u.fullname')[_0x27a6('0x48')](_0x27a6('0x4d'))[_0x27a6('0x4a')](_0x27a6('0x4e'),'ui')[_0x27a6('0x4f')](_0x27a6('0x50'),'u',_0x27a6('0x51'));var _0x4ed32f=squel[_0x27a6('0x47')]()['from'](_0x27a6('0x52'),'i')[_0x27a6('0x4f')](_0x27a6('0x53'),'c',_0x27a6('0x54'))[_0x27a6('0x4f')](_0x27a6('0x50'),'o','o.id\x20=\x20i.UserId')[_0x27a6('0x4f')](_0x27a6('0x55'),'a',_0x27a6('0x56'))[_0x27a6('0x4f')](_0x27a6('0x57'),'me','me.FaxInteractionId\x20=\x20i.id')['left_join'](_0x27a6('0x58'),'it',_0x27a6('0x59'))[_0x27a6('0x4f')](_0x27a6('0x4b'),'t','t.id\x20=\x20it.TagId');var _0x582b78=squel[_0x27a6('0x5a')]();var _0x343f14=[];var _0x1e3714=squel['expr']();var _0x5f52c0;if(_0x1c25b6[_0x27a6('0x3e')][_0x27a6('0x5b')]){_0x5f52c0=as[_0x27a6('0x5c')](_0x1c25b6['query'][_0x27a6('0x5b')]);var _0x45d7e4=_0x5f52c0[_0x27a6('0x5d')];for(var _0x1c72ee=0x0;_0x1c72ee<_0x5f52c0[_0x27a6('0x5e')]['length'];_0x1c72ee++){var _0x391c3a=_0x5f52c0[_0x27a6('0x5e')][_0x1c72ee];var _0xe27ffb='i';var _0x5e2baf=_[_0x27a6('0x5f')](_0x5e88ce,['name',_0x391c3a[_0x27a6('0x48')]]);if(!_0x5e2baf){switch(_0x391c3a[_0x27a6('0x48')]){case _0x27a6('0x60'):if(_0x391c3a[_0x27a6('0x61')]==0x1){_0x4ed32f[_0x27a6('0x62')]('`'+_0x391c3a[_0x27a6('0x48')]+_0x27a6('0x63'));}else{_0x4ed32f['having']('`'+_0x391c3a[_0x27a6('0x48')]+_0x27a6('0x64'));}break;case _0x27a6('0x65'):if(_0x391c3a[_0x27a6('0x66')]==='$substring'){if(_0x391c3a['value'][_0x27a6('0x34')]('\x20')[_0x27a6('0x67')]>0x1){_0x582b78[_0x45d7e4](_0x27a6('0x68'),qs[_0x27a6('0x69')](_0x391c3a[_0x27a6('0x61')]),null);}else{var _0x382660='%'+_0x391c3a[_0x27a6('0x61')]+'%';_0x582b78[_0x45d7e4](_0x27a6('0x6a'),_0x382660,_0x382660,_0x382660);}}else{_0x5e2baf=_[_0x27a6('0x5f')](_0x5e88ce,[_0x27a6('0x2e'),_0x27a6('0x6b')]);_0x391c3a[_0x27a6('0x48')]=_0x27a6('0x6b');_0x3ae646=as['buildExpression'](_0xe27ffb,_0x5e2baf[_0x27a6('0x6c')],_0x391c3a);_0x582b78[_0x45d7e4](_0x3ae646[_0x27a6('0x6d')],_0x3ae646['value']['start'],_0x3ae646[_0x27a6('0x61')][_0x27a6('0x6e')]);}break;case _0x27a6('0x6f'):var _0xfef08d=_0x391c3a[_0x27a6('0x61')][_0x27a6('0x34')](',')[_0x27a6('0x31')](function(_0x4647c9){return Number(_0x4647c9);});_0xfef08d[_0x27a6('0x35')](function(_0x49eedd){_0x1e3714['or'](_0x27a6('0x70'),'%,'+_0x49eedd+',%');});_0x343f14=_[_0x27a6('0x71')](_0x343f14,_0xfef08d);break;case'User':if(_0x391c3a['operator']===_0x27a6('0x72')){_0x582b78[_0x45d7e4](_0x27a6('0x73'),'%'+_0x391c3a[_0x27a6('0x61')]+'%',null);}else{_0x5e2baf=_[_0x27a6('0x5f')](_0x5e88ce,['name','UserId']);_0x391c3a[_0x27a6('0x48')]=_0x27a6('0x74');_0x3ae646=as[_0x27a6('0x75')](_0xe27ffb,_0x5e2baf[_0x27a6('0x6c')],_0x391c3a);_0x582b78[_0x45d7e4](_0x3ae646[_0x27a6('0x6d')],_0x3ae646['value'][_0x27a6('0x76')],_0x3ae646[_0x27a6('0x61')][_0x27a6('0x6e')]);}break;case _0x27a6('0x77'):_0x3ae646=as[_0x27a6('0x75')]('me',null,_0x391c3a);_0x582b78[_0x45d7e4](_0x3ae646[_0x27a6('0x6d')],_0x3ae646[_0x27a6('0x61')][_0x27a6('0x76')],_0x3ae646['value']['end']);break;}}else{var _0x3ae646=as[_0x27a6('0x75')](_0xe27ffb,_0x5e2baf[_0x27a6('0x6c')],_0x391c3a);_0x582b78[_0x45d7e4](_0x3ae646[_0x27a6('0x6d')],_0x3ae646['value']['start'],_0x3ae646['value'][_0x27a6('0x6e')]);}}}else{var _0x2d638d=_(_0x1c25b6['query'])[_0x27a6('0x3f')]()[_0x27a6('0x31')](function(_0x47e6d9){return _[_0x27a6('0x78')](_0x5e88ce,[_0x27a6('0x2e'),_0x47e6d9])?_0x47e6d9:undefined;})['compact']()[_0x27a6('0x61')]();if(!_[_0x27a6('0x79')](_0x2d638d)){_0x2d638d[_0x27a6('0x35')](function(_0x5dae02){if(_0x5dae02==='FaxAccountId'){_0x4ed32f[_0x27a6('0x7a')](_0x27a6('0x7b'),[][_0x27a6('0x7c')](_0x1c25b6['query'][_0x5dae02]));}else if(_0x5dae02===_0x27a6('0x7d')){var _0x22626d=JSON['parse'](_0x1c25b6[_0x27a6('0x3e')][_0x5dae02])[_0x27a6('0x7e')];var _0x52ea26=JSON['parse'](_0x1c25b6['query'][_0x5dae02])[_0x27a6('0x7f')];_0x4ed32f['where'](_0x27a6('0x80'),_0x22626d,_0x52ea26);}else{if(_0x1c25b6['query'][_0x5dae02]===_0x27a6('0x81')){_0x4ed32f[_0x27a6('0x7a')]('i.'+_0x5dae02+_0x27a6('0x82'));}else{_0x4ed32f[_0x27a6('0x7a')]('i.'+_0x5dae02+'\x20=\x20?',_0x1c25b6[_0x27a6('0x3e')][_0x5dae02]);}}});}if(_0x1c25b6[_0x27a6('0x3e')][_0x27a6('0x83')]){if(_0x1c25b6[_0x27a6('0x3e')][_0x27a6('0x83')]==0x1){_0x4ed32f[_0x27a6('0x62')](_0x27a6('0x84'));}else{_0x4ed32f[_0x27a6('0x62')](_0x27a6('0x85'));}}if(_0x1c25b6[_0x27a6('0x3e')]['tag']){_0x343f14=_['isArray'](_0x1c25b6[_0x27a6('0x3e')][_0x27a6('0x86')])?_0x1c25b6['query'][_0x27a6('0x86')]:new Array(_0x1c25b6[_0x27a6('0x3e')][_0x27a6('0x86')]);_0x343f14[_0x27a6('0x35')](function(_0x282e65){_0x1e3714['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x282e65+',%');});}if(_0x1c25b6[_0x27a6('0x3e')][_0x27a6('0x87')]){var _0x1c6e2c=_0x1c25b6[_0x27a6('0x3e')]['filter'][_0x27a6('0x88')]('\x5c','\x5c\x5c')[_0x27a6('0x88')]('\x27\x27',_0x27a6('0x89'));if(qs[_0x27a6('0x8a')](_0x1c6e2c)){_0x582b78['or']('i.id\x20LIKE\x20?',_0x1c6e2c+'%')['or'](_0x27a6('0x8b'),_0x1c6e2c+'%');}_0x582b78['or'](_0x27a6('0x8c'),_0x1c6e2c+'%');}}_0x4ed32f['where'](_0x582b78);_0x4ed32f[_0x27a6('0x8d')](_0x27a6('0x8e'));var _0x317713={'type':db['Sequelize'][_0x27a6('0x8f')]['SELECT'],'raw':!![]};var _0x3c0d7b=_0x4ed32f[_0x27a6('0x90')]();_0x3c0d7b['field'](_0x27a6('0x8e'));_0x3c0d7b[_0x27a6('0x48')](_0x27a6('0x91'),_0x27a6('0x60'));if(_0x1407ab[_0x27a6('0x43')]){_0x1407ab[_0x27a6('0x43')][_0x27a6('0x35')](function(_0x19fb5b){_0x4ed32f[_0x27a6('0x43')]('i.'+_0x19fb5b[0x0],_0x19fb5b[0x1]===_0x27a6('0x92')?![]:!![]);});}if(!_[_0x27a6('0x79')](_0x343f14)){_0x4ed32f[_0x27a6('0x62')](_0x1e3714);_0x3c0d7b[_0x27a6('0x7a')](_0x27a6('0x93'),_0x343f14);}BPromise[_0x27a6('0x94')]()[_0x27a6('0x2a')](function(){if(!_0x5f52c0){if(_0x1c25b6['query'][_0x27a6('0x95')]||_0x1c25b6[_0x27a6('0x3e')][_0x27a6('0x96')])return;_0x3c0d7b['where'](_0x27a6('0x97'));_0x4ed32f['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}return _0x1c25b6[_0x27a6('0x98')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x27a6('0x2a')](function(_0x486ae7){if(_['isEmpty'](_0x486ae7)){_0x3c0d7b['where'](_0x27a6('0x99'));_0x4ed32f[_0x27a6('0x7a')](_0x27a6('0x99'));}else{_0x3c0d7b[_0x27a6('0x7a')](_0x27a6('0x7b'),_[_0x27a6('0x31')](_0x486ae7,'id'));_0x4ed32f[_0x27a6('0x7a')]('i.FaxAccountId\x20IN\x20?',_[_0x27a6('0x31')](_0x486ae7,'id'));}});})['then'](function(){db[_0x27a6('0x9a')][_0x27a6('0x3e')](_0x3c0d7b[_0x27a6('0x9b')](),_0x317713)[_0x27a6('0x2a')](function(_0x4b60c8){_0x2f6067['count']=_0x4b60c8[_0x27a6('0x67')];if(_0x2f6067['count']===0x0)return[];return db['sequelize'][_0x27a6('0x3e')](_0x3270d5[_0x27a6('0x9b')](),_0x317713)['then'](function(_0x279e3c){_0x305f75=_[_0x27a6('0x9c')](_0x279e3c,'id');_0x317713=_['merge'](_0x317713,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1c25b6[_0x27a6('0x3e')]['fields']){_0x1407ab['attributes']['forEach'](function(_0x24b842){_0x4ed32f[_0x27a6('0x48')]('i.'+_0x24b842);});}else{_0x4ed32f[_0x27a6('0x48')](_0x27a6('0x91'),_0x27a6('0x60'));_0x4ed32f[_0x27a6('0x48')](_0x27a6('0x9d'),_0x27a6('0x9e'));_0x4ed32f[_0x27a6('0x48')]('a.mandatoryDisposition',_0x27a6('0x9f'));_0x4ed32f['field'](_0x27a6('0xa0'));_0x4ed32f[_0x27a6('0x48')](_0x27a6('0xa1'),'Contact.firstName');_0x4ed32f[_0x27a6('0x48')](_0x27a6('0xa2'),'Contact.lastName');_0x4ed32f['field'](_0x27a6('0xa3'),_0x27a6('0xa4'));_0x4ed32f[_0x27a6('0x48')](_0x27a6('0xa5'),_0x27a6('0xa6'));_0x4ed32f['field'](_0x27a6('0xa7'),_0x27a6('0xa8'));_0x4ed32f['field'](_0x27a6('0xa9'),_0x27a6('0xaa'));_0x4ed32f[_0x27a6('0x48')]('o.fullname',_0x27a6('0xab'));_0x4ed32f[_0x27a6('0x48')](_0x27a6('0xac'),_0x27a6('0xad'));_0x4ed32f[_0x27a6('0x48')](_0x27a6('0xae'),'TagIds');}if(_0x1407ab[_0x27a6('0x23')])_0x4ed32f[_0x27a6('0x23')](_0x1407ab['limit']);if(_0x1407ab['offset'])_0x4ed32f[_0x27a6('0x22')](_0x1407ab['offset']);return db['sequelize'][_0x27a6('0x3e')](_0x4ed32f[_0x27a6('0x9b')](),_0x317713);})[_0x27a6('0x2a')](function(_0x4ea898){_0x319dff['where'](_0x27a6('0xaf'),_[_0x27a6('0x31')](_0x4ea898,'id'));return db['sequelize']['query'](_0x319dff[_0x27a6('0x9b')](),_0x317713)['then'](function(_0xf3a315){var _0x39ce32=_[_0x27a6('0xb0')](_0xf3a315,_0x27a6('0xb1'));var _0x425954=[];_0x4ea898[_0x27a6('0x35')](function(_0x524736){_0x425954[_0x27a6('0x36')](updateFaxInteraction(_0x524736,_0x305f75,_0x39ce32));});return BPromise['all'](_0x425954);});});})[_0x27a6('0x2a')](function(_0x346c){_0x2f6067[_0x27a6('0xb2')]=_0x346c;return _0x2f6067;})['then'](respondWithFilteredResult(_0x43c62e,_0x1407ab));})['catch'](handleError(_0x43c62e,null));};exports[_0x27a6('0xb3')]=function(_0x37a01d,_0x342c86){var _0x200424={'raw':![],'where':{'id':_0x37a01d[_0x27a6('0xb4')]['id']}},_0x4a5cc2={};_0x4a5cc2[_0x27a6('0x3d')]=_['keys'](db['FaxInteraction'][_0x27a6('0x3a')]);_0x4a5cc2[_0x27a6('0x3e')]=_[_0x27a6('0x3f')](_0x37a01d['query']);_0x4a5cc2[_0x27a6('0xb5')]=_[_0x27a6('0x41')](_0x4a5cc2[_0x27a6('0x3d')],_0x4a5cc2[_0x27a6('0x3e')]);_0x200424[_0x27a6('0x40')]=_[_0x27a6('0x41')](_0x4a5cc2['model'],qs['fields'](_0x37a01d[_0x27a6('0x3e')][_0x27a6('0xb6')]));_0x200424[_0x27a6('0x40')]=_0x200424[_0x27a6('0x40')][_0x27a6('0x67')]?_0x200424[_0x27a6('0x40')]:_0x4a5cc2[_0x27a6('0x3d')];if(_0x37a01d[_0x27a6('0x3e')][_0x27a6('0xb7')]){_0x200424[_0x27a6('0xb8')]=[{'all':!![]}];}_0x200424=_[_0x27a6('0xb9')]({},_0x200424,_0x37a01d['options']);return db[_0x27a6('0x39')]['find'](_0x200424)[_0x27a6('0x2a')](handleEntityNotFound(_0x342c86,null))[_0x27a6('0x2a')](respondWithResult(_0x342c86,null))[_0x27a6('0xba')](handleError(_0x342c86,null));};exports['create']=function(_0x2bd86e,_0x33044f){return db[_0x27a6('0x39')][_0x27a6('0xbb')](_0x2bd86e['body'],{})[_0x27a6('0x2a')](respondWithResult(_0x33044f,0xc9))[_0x27a6('0xba')](handleError(_0x33044f,null));};exports[_0x27a6('0xbc')]=function(_0x1eeb49,_0x3bbeed){if(_0x1eeb49[_0x27a6('0x77')]['id']){delete _0x1eeb49[_0x27a6('0x77')]['id'];}return db[_0x27a6('0x39')][_0x27a6('0x5f')]({'where':{'id':_0x1eeb49[_0x27a6('0xb4')]['id']}})[_0x27a6('0x2a')](handleEntityNotFound(_0x3bbeed,null))[_0x27a6('0x2a')](saveUpdates(_0x1eeb49[_0x27a6('0x77')],null))['then'](respondWithResult(_0x3bbeed,null))[_0x27a6('0xba')](handleError(_0x3bbeed,null));};exports['destroy']=function(_0x32fb64,_0x31cd0f){return db[_0x27a6('0x39')][_0x27a6('0x5f')]({'where':{'id':_0x32fb64['params']['id']}})[_0x27a6('0x2a')](handleEntityNotFound(_0x31cd0f,null))[_0x27a6('0x2a')](removeEntity(_0x31cd0f,null))[_0x27a6('0xba')](handleError(_0x31cd0f,null));};exports['describe']=function(_0x2f70a0,_0x23606e){return db[_0x27a6('0x39')][_0x27a6('0xbd')]()[_0x27a6('0x2a')](respondWithResult(_0x23606e,null))[_0x27a6('0xba')](handleError(_0x23606e,null));};exports[_0x27a6('0xbe')]=function(_0x5480a1,_0x1d19ea,_0x56556a){return db['FaxMessage'][_0x27a6('0x5f')]({'where':{'id':_0x5480a1[_0x27a6('0xb4')]['id']}})[_0x27a6('0x2a')](handleEntityNotFound(_0x1d19ea,null))[_0x27a6('0x2a')](function(_0x39b168){if(_0x39b168){return _0x39b168[_0x27a6('0xbe')](_0x5480a1[_0x27a6('0x77')][_0x27a6('0xbf')],_[_0x27a6('0xc0')](_0x5480a1[_0x27a6('0x77')],['ids','id'])||{});}})[_0x27a6('0x2a')](respondWithResult(_0x1d19ea,null))[_0x27a6('0xba')](handleError(_0x1d19ea,null));};exports[_0x27a6('0xc1')]=function(_0x1121bc,_0x4b75e8,_0x327317){var _0x26cf0c={'raw':![],'where':{}};var _0x4edc86={};var _0xa5c5b4={'count':0x0,'rows':[]};return db[_0x27a6('0x39')][_0x27a6('0xc2')]({'where':{'id':_0x1121bc['params']['id']}})[_0x27a6('0x2a')](handleEntityNotFound(_0x4b75e8,null))[_0x27a6('0x2a')](function(_0x4e452a){if(_0x4e452a){_0x4edc86[_0x27a6('0x3d')]=_['keys'](db['FaxMessage'][_0x27a6('0x3a')]);_0x4edc86[_0x27a6('0x3e')]=_[_0x27a6('0x3f')](_0x1121bc[_0x27a6('0x3e')]);_0x4edc86[_0x27a6('0x45')]=_['intersection'](_0x4edc86[_0x27a6('0x3d')],_0x4edc86[_0x27a6('0x3e')]);_0x26cf0c[_0x27a6('0x40')]=_[_0x27a6('0x41')](_0x4edc86[_0x27a6('0x3d')],qs[_0x27a6('0xb6')](_0x1121bc[_0x27a6('0x3e')][_0x27a6('0xb6')]));_0x26cf0c[_0x27a6('0x40')]=_0x26cf0c[_0x27a6('0x40')][_0x27a6('0x67')]?_0x26cf0c[_0x27a6('0x40')]:_0x4edc86['model'];if(!_0x1121bc[_0x27a6('0x3e')][_0x27a6('0x42')](_0x27a6('0xc3'))){_0x26cf0c[_0x27a6('0x23')]=qs[_0x27a6('0x23')](_0x1121bc[_0x27a6('0x3e')][_0x27a6('0x23')]);_0x26cf0c['offset']=qs[_0x27a6('0x22')](_0x1121bc[_0x27a6('0x3e')][_0x27a6('0x22')]);}_0x26cf0c[_0x27a6('0x43')]=qs[_0x27a6('0x44')](_0x1121bc[_0x27a6('0x3e')][_0x27a6('0x44')]);_0x26cf0c['where']=qs[_0x27a6('0x45')](_[_0x27a6('0x46')](_0x1121bc[_0x27a6('0x3e')],_0x4edc86['filters']));_0x26cf0c['where'][_0x27a6('0xb1')]=_0x4e452a['id'];if(_0x1121bc[_0x27a6('0x3e')]['filter']){_0x26cf0c[_0x27a6('0x7a')]=_[_0x27a6('0xb9')](_0x26cf0c[_0x27a6('0x7a')],{'$or':_[_0x27a6('0x31')](_0x26cf0c[_0x27a6('0x40')],function(_0x2944d0){var _0x48df54={};_0x48df54[_0x2944d0]={'$like':'%'+_0x1121bc[_0x27a6('0x3e')][_0x27a6('0x87')]+'%'};return _0x48df54;})});}if(_0x1121bc['query'][_0x27a6('0x7e')]){var _0x498d3e=_0x1121bc['query'][_0x27a6('0x7e')]['split'](',');var _0x2fe87c={};_0x2fe87c[_0x498d3e[0x0]]={'$gte':moment(_0x498d3e[0x1])[_0x27a6('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x26cf0c[_0x27a6('0x7a')]=_[_0x27a6('0xb9')](_0x26cf0c[_0x27a6('0x7a')],_0x2fe87c);}_0x26cf0c=_[_0x27a6('0xb9')]({},_0x26cf0c,_0x1121bc[_0x27a6('0xc5')]);return db[_0x27a6('0xc6')][_0x27a6('0x21')]({'where':_0x26cf0c[_0x27a6('0x7a')]})[_0x27a6('0x2a')](function(_0x526a28){_0xa5c5b4[_0x27a6('0x21')]=_0x526a28;if(_0x1121bc[_0x27a6('0x3e')]['includeAll']){_0x26cf0c[_0x27a6('0xb8')]=[{'all':!![]}];}return db['FaxMessage'][_0x27a6('0xc7')](_0x26cf0c);})[_0x27a6('0x2a')](function(_0x2de7bb){_0xa5c5b4['rows']=_0x2de7bb;return _0xa5c5b4;});}})['then'](respondWithFilteredResult(_0x4b75e8,_0x26cf0c))[_0x27a6('0xba')](handleError(_0x4b75e8,null));};exports['addTags']=function(_0x33443f,_0x551a58,_0x2c2741){return db[_0x27a6('0x39')]['find']({'where':{'id':_0x33443f['params']['id']}})[_0x27a6('0x2a')](handleEntityNotFound(_0x551a58,null))[_0x27a6('0x2a')](function(_0x4bd858){if(_0x4bd858){return _0x4bd858[_0x27a6('0xc8')](_0x33443f['body'][_0x27a6('0xbf')],_[_0x27a6('0xc0')](_0x33443f[_0x27a6('0x77')],[_0x27a6('0xbf'),'id'])||{})['spread'](function(){return db[_0x27a6('0x6f')][_0x27a6('0xc7')]({'attributes':['id','name',_0x27a6('0x49')],'where':{'id':_0x33443f[_0x27a6('0x77')]['ids']}});})['then'](function(_0x230456){socket[_0x27a6('0xc9')](_0x27a6('0xca'),{'id':Number(_0x33443f[_0x27a6('0xb4')]['id']),'tags':_0x230456||[]});return{'id':Number(_0x33443f['params']['id']),'tags':_0x230456||[]};});}})['then'](respondWithResult(_0x551a58,null))[_0x27a6('0xba')](handleError(_0x551a58,null));};exports[_0x27a6('0xcb')]=function(_0x2de395,_0x6a6b3d,_0x4cd420){return db[_0x27a6('0x39')][_0x27a6('0x5f')]({'where':{'id':_0x2de395[_0x27a6('0xb4')]['id']}})[_0x27a6('0x2a')](handleEntityNotFound(_0x6a6b3d,null))[_0x27a6('0x2a')](function(_0x459cc7){if(_0x459cc7){return _0x459cc7[_0x27a6('0xcb')](_0x2de395[_0x27a6('0x3e')][_0x27a6('0xbf')]);}})['then'](respondWithStatusCode(_0x6a6b3d,null))[_0x27a6('0xba')](handleError(_0x6a6b3d,null));};exports[_0x27a6('0xcc')]=function(_0x35be07,_0x99fbd8){var _0x210718=moment()[_0x27a6('0xcd')]()[_0x27a6('0x9b')]();var _0x1db011=path[_0x27a6('0xce')](config[_0x27a6('0xcf')],_0x27a6('0xd0'),_0x27a6('0xd1'),_0x27a6('0xd2'));var _0x3c139c=path[_0x27a6('0xce')](config[_0x27a6('0xcf')],_0x27a6('0xd0'),_0x27a6('0xd1'),_0x27a6('0xd3'));var _0x379abe=path[_0x27a6('0xce')](_0x1db011,_0x210718);var _0x2e5174=util['format'](_0x27a6('0xd4'),_0x35be07[_0x27a6('0xb4')]['id'],_0x210718);var _0xd520ba=path['join'](_0x1db011,_0x2e5174);var _0x24210e=[];_0x24210e['push']({'model':db[_0x27a6('0xd5')],'as':_0x27a6('0xd5'),'raw':!![]});var _0x92010a=[{'model':db[_0x27a6('0xc6')],'as':_0x27a6('0xd6'),'attributes':['id',_0x27a6('0x77'),_0x27a6('0x7d')],'include':_0x24210e}];return db[_0x27a6('0x39')][_0x27a6('0x5f')]({'where':{'id':_0x35be07[_0x27a6('0xb4')]['id']},'include':_0x92010a})['then'](handleEntityNotFound(_0x99fbd8,null))[_0x27a6('0x2a')](function(_0x4c3cd1){if(_0x4c3cd1&&_0x4c3cd1['Messages']){var _0x218c46=_0x4c3cd1[_0x27a6('0xd7')]({'plain':!![]});fs['mkdirSync'](_0x379abe);for(var _0x56fd72=0x0;_0x56fd72<_0x218c46[_0x27a6('0xd6')]['length'];_0x56fd72++){var _0x1218f4=_0x218c46[_0x27a6('0xd6')][_0x56fd72][_0x27a6('0xd5')];if(_0x1218f4){var _0x2ccdf2=path[_0x27a6('0xce')](_0x3c139c,_0x1218f4[_0x27a6('0xd8')]);if(fs[_0x27a6('0xd9')](_0x2ccdf2)){fs['createReadStream'](_0x2ccdf2)[_0x27a6('0xda')](fs[_0x27a6('0xdb')](path[_0x27a6('0xce')](_0x379abe,_0x1218f4['basename'])));}}}return BPromise[_0x27a6('0x94')]()[_0x27a6('0x2a')](function(){return new BPromise(function(_0x5ce5de,_0x1e3cec){zipdir(_0x379abe,{'saveTo':_0xd520ba},function(_0x5295eb,_0xd8ec98){if(_0x5295eb)return _0x1e3cec(_0x5295eb);return _0x5ce5de(_0xd8ec98);});})[_0x27a6('0x2a')](function(){return new BPromise(function(_0x2ee714,_0x46ee9d){rimraf(_0x379abe,function(_0x43a9d7){if(_0x43a9d7)_0x46ee9d(_0x43a9d7);return _0x2ee714();});});})[_0x27a6('0x2a')](function(){return _0x99fbd8[_0x27a6('0xcc')](_0xd520ba,_0x2e5174,function(_0x3b0c95){if(_0x3b0c95){console[_0x27a6('0xdc')](_0x27a6('0xdd'),_0x3b0c95);}else{fs[_0x27a6('0xde')](_0xd520ba);}});});});}else{return _0x99fbd8[_0x27a6('0x1f')](0xc8);}})[_0x27a6('0xba')](handleError(_0x99fbd8,null));}; \ No newline at end of file +var _0xbf44=['server','files','tmp','Attachment','Messages','get','mkdirSync','basename','createReadStream','pipe','createWriteStream','err','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','Users','map','fullname','Tags','split','forEach','push','TagIds','catch','index','FaxInteraction','rawAttributes','fieldName','keys','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','select','field','color','from','tools_tags','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','left_join','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','length','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','i.FaxAccountId\x20IS\x20NULL','toString','sequelize','merge','a.key','Account.key','Account.mandatoryDisposition','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','show','params','filtears','includeAll','options','describe','FaxMessage','addMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','download','join','root'];(function(_0x58520a,_0x103e5b){var _0x2b1690=function(_0x5e427d){while(--_0x5e427d){_0x58520a['push'](_0x58520a['shift']());}};_0x2b1690(++_0x103e5b);}(_0xbf44,0xdc));var _0x4bf4=function(_0x4bc169,_0x4b1164){_0x4bc169=_0x4bc169-0x0;var _0x56d503=_0xbf44[_0x4bc169];return _0x56d503;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4bf4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4bf4('0x1'));var rp=require(_0x4bf4('0x2'));var moment=require('moment');var BPromise=require(_0x4bf4('0x3'));var Mustache=require(_0x4bf4('0x4'));var util=require(_0x4bf4('0x5'));var path=require('path');var sox=require(_0x4bf4('0x6'));var csv=require(_0x4bf4('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4bf4('0x8'));var crypto=require('crypto');var jsforce=require(_0x4bf4('0x9'));var deskjs=require(_0x4bf4('0xa'));var toCsv=require(_0x4bf4('0x7'));var querystring=require(_0x4bf4('0xb'));var Papa=require(_0x4bf4('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4bf4('0xd'));var as=require(_0x4bf4('0xe'));var hardwareService=require(_0x4bf4('0xf'));var logger=require(_0x4bf4('0x10'))(_0x4bf4('0x11'));var utils=require('../../config/utils');var config=require(_0x4bf4('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x4bf4('0x13'))['db'];config[_0x4bf4('0x14')]=_[_0x4bf4('0x15')](config[_0x4bf4('0x14')],{'host':_0x4bf4('0x16'),'port':0x18eb});var socket=require(_0x4bf4('0x17'))(new Redis(config[_0x4bf4('0x14')]));require(_0x4bf4('0x18'))[_0x4bf4('0x19')](socket);function respondWithStatusCode(_0x3fa33e,_0x16045f){_0x16045f=_0x16045f||0xcc;return function(_0x356c88){if(_0x356c88){return _0x3fa33e[_0x4bf4('0x1a')](_0x16045f);}return _0x3fa33e[_0x4bf4('0x1b')](_0x16045f)['end']();};}function respondWithResult(_0x20ad7a,_0x2340ba){_0x2340ba=_0x2340ba||0xc8;return function(_0x1a14d8){if(_0x1a14d8){return _0x20ad7a[_0x4bf4('0x1b')](_0x2340ba)[_0x4bf4('0x1c')](_0x1a14d8);}};}function respondWithFilteredResult(_0x5002ee,_0x778fb0){return function(_0xdec402){if(_0xdec402){var _0x18832a=_0xdec402[_0x4bf4('0x1d')],_0x31ea05=_0x778fb0[_0x4bf4('0x1e')],_0x382481=_0x778fb0['offset']+_0x778fb0[_0x4bf4('0x1f')],_0x59dcb7;if(_0x382481>=_0x18832a){_0x382481=_0x18832a;_0x59dcb7=0xc8;}else{_0x59dcb7=0xce;}_0x5002ee[_0x4bf4('0x1b')](_0x59dcb7);return _0x5002ee[_0x4bf4('0x20')](_0x4bf4('0x21'),_0x31ea05+'-'+_0x382481+'/'+_0x18832a)[_0x4bf4('0x1c')](_0xdec402);}return null;};}function patchUpdates(_0x6abcee){return function(_0x2ebea1){try{jsonpatch[_0x4bf4('0x22')](_0x2ebea1,_0x6abcee,!![]);}catch(_0x1d23af){return BPromise[_0x4bf4('0x23')](_0x1d23af);}return _0x2ebea1['save']();};}function saveUpdates(_0x13975e,_0x53017f){return function(_0x1f3cc9){if(_0x1f3cc9){return _0x1f3cc9[_0x4bf4('0x24')](_0x13975e)['then'](function(_0x40ad75){return _0x40ad75;});}return null;};}function removeEntity(_0x3484b2,_0x2a96d7){return function(_0x25e7fa){if(_0x25e7fa){return _0x25e7fa[_0x4bf4('0x25')]()[_0x4bf4('0x26')](function(){_0x3484b2['status'](0xcc)[_0x4bf4('0x27')]();});}};}function handleEntityNotFound(_0x95d596,_0x51d524){return function(_0x25d2d7){if(!_0x25d2d7){_0x95d596[_0x4bf4('0x1a')](0x194);}return _0x25d2d7;};}function handleError(_0x299534,_0x1e5a6c){_0x1e5a6c=_0x1e5a6c||0x1f4;return function(_0x39e5be){logger[_0x4bf4('0x28')](_0x39e5be[_0x4bf4('0x29')]);if(_0x39e5be[_0x4bf4('0x2a')]){delete _0x39e5be['name'];}_0x299534[_0x4bf4('0x1b')](_0x1e5a6c)[_0x4bf4('0x2b')](_0x39e5be);};}function getInteractionUsers(_0x16cfcc,_0x3b14d9){return new BPromise(function(_0x11cc8c,_0x4f550b){try{if(_0x3b14d9[_0x16cfcc['id']]){_0x16cfcc[_0x4bf4('0x2c')]=_[_0x4bf4('0x2d')](_0x3b14d9[_0x16cfcc['id']],function(_0xe44f7e){return{'id':_0xe44f7e['id'],'fullname':_0xe44f7e[_0x4bf4('0x2e')]};});}}catch(_0x50002a){_0x4f550b(_0x50002a);}_0x11cc8c(_0x16cfcc);});}function getInteractionTags(_0x1e5a71,_0x587dd7){return new BPromise(function(_0x219d90,_0xb2f77a){try{if(_0x1e5a71['TagIds']){_0x1e5a71[_0x4bf4('0x2f')]=[];_0x1e5a71['TagIds'][_0x4bf4('0x30')](',')[_0x4bf4('0x31')](function(_0x221d0d){_0x1e5a71[_0x4bf4('0x2f')][_0x4bf4('0x32')](_0x587dd7[_0x221d0d]);});}delete _0x1e5a71[_0x4bf4('0x33')];}catch(_0x4c31aa){_0xb2f77a(_0x4c31aa);}_0x219d90(_0x1e5a71);});}function updateFaxInteraction(_0x287dce,_0x241384,_0x5bae6f){return new BPromise(function(_0x503cb5,_0x1026c6){return getInteractionUsers(_0x287dce,_0x5bae6f)[_0x4bf4('0x26')](function(_0x5ca009){return getInteractionTags(_0x5ca009,_0x241384);})[_0x4bf4('0x26')](function(_0x12e249){_0x503cb5(_0x12e249);})[_0x4bf4('0x34')](function(_0x31354d){_0x1026c6(_0x31354d);});});}exports[_0x4bf4('0x35')]=function(_0x183471,_0x5785ca){var _0x57dfa5={},_0x450786={},_0x33adc0={'count':0x0,'rows':[]};var _0xefb7ff=_['map'](db[_0x4bf4('0x36')][_0x4bf4('0x37')],function(_0x3f8535){return{'name':_0x3f8535[_0x4bf4('0x38')],'type':_0x3f8535['type']['key']};});_0x450786['model']=_[_0x4bf4('0x2d')](_0xefb7ff,_0x4bf4('0x2a'));_0x450786['query']=_[_0x4bf4('0x39')](_0x183471[_0x4bf4('0x3a')]);_0x450786['filters']=_[_0x4bf4('0x3b')](_0x450786[_0x4bf4('0x3c')],_0x450786[_0x4bf4('0x3a')]);_0x57dfa5['attributes']=_[_0x4bf4('0x3b')](_0x450786['model'],qs['fields'](_0x183471[_0x4bf4('0x3a')][_0x4bf4('0x3d')]));_0x57dfa5[_0x4bf4('0x3e')]=_0x57dfa5['attributes']['length']?_0x57dfa5[_0x4bf4('0x3e')]:_0x450786[_0x4bf4('0x3c')];if(!_0x183471[_0x4bf4('0x3a')][_0x4bf4('0x3f')](_0x4bf4('0x40'))){_0x57dfa5[_0x4bf4('0x1f')]=qs[_0x4bf4('0x1f')](_0x183471[_0x4bf4('0x3a')][_0x4bf4('0x1f')]);_0x57dfa5['offset']=qs[_0x4bf4('0x1e')](_0x183471['query']['offset']);}_0x57dfa5['order']=qs[_0x4bf4('0x41')](_0x183471['query']['sort']);_0x57dfa5[_0x4bf4('0x42')]=qs[_0x4bf4('0x43')](_[_0x4bf4('0x44')](_0x183471['query'],_0x450786['filters']),_0xefb7ff);var _0x568cf3=[];var _0x30b099=squel[_0x4bf4('0x45')]()[_0x4bf4('0x46')]('id')['field'](_0x4bf4('0x2a'))['field'](_0x4bf4('0x47'))[_0x4bf4('0x48')](_0x4bf4('0x49'));var _0x383615=squel['select']()[_0x4bf4('0x46')]('u.id')[_0x4bf4('0x46')]('u.fullname')[_0x4bf4('0x46')]('ui.FaxInteractionId')['from'](_0x4bf4('0x4a'),'ui')['left_join'](_0x4bf4('0x4b'),'u',_0x4bf4('0x4c'));var _0x15fbf3=squel[_0x4bf4('0x45')]()[_0x4bf4('0x48')](_0x4bf4('0x4d'),'i')['left_join'](_0x4bf4('0x4e'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4bf4('0x4f')](_0x4bf4('0x4b'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x4bf4('0x50'),'a','a.id\x20=\x20i.FaxAccountId')['left_join'](_0x4bf4('0x51'),'me',_0x4bf4('0x52'))[_0x4bf4('0x4f')](_0x4bf4('0x53'),'it',_0x4bf4('0x54'))['left_join'](_0x4bf4('0x49'),'t',_0x4bf4('0x55'));var _0x7991ca=squel['expr']();var _0x1ee6ee=[];var _0x7afb9b=squel['expr']();var _0x1e7615;if(_0x183471['query'][_0x4bf4('0x56')]){_0x1e7615=as[_0x4bf4('0x57')](_0x183471[_0x4bf4('0x3a')][_0x4bf4('0x56')]);var _0x4a2cec=_0x1e7615[_0x4bf4('0x58')];for(var _0x5021b9=0x0;_0x5021b9<_0x1e7615[_0x4bf4('0x59')][_0x4bf4('0x5a')];_0x5021b9++){var _0x406bc8=_0x1e7615[_0x4bf4('0x59')][_0x5021b9];var _0x5a0b34='i';var _0x570e83=_['find'](_0xefb7ff,[_0x4bf4('0x2a'),_0x406bc8[_0x4bf4('0x46')]]);if(!_0x570e83){switch(_0x406bc8[_0x4bf4('0x46')]){case _0x4bf4('0x5b'):if(_0x406bc8['value']==0x1){_0x15fbf3[_0x4bf4('0x5c')]('`'+_0x406bc8[_0x4bf4('0x46')]+_0x4bf4('0x5d'));}else{_0x15fbf3[_0x4bf4('0x5c')]('`'+_0x406bc8[_0x4bf4('0x46')]+_0x4bf4('0x5e'));}break;case _0x4bf4('0x5f'):if(_0x406bc8[_0x4bf4('0x60')]===_0x4bf4('0x61')){if(_0x406bc8[_0x4bf4('0x62')][_0x4bf4('0x30')]('\x20')[_0x4bf4('0x5a')]>0x1){_0x7991ca[_0x4a2cec]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4bf4('0x63')](_0x406bc8[_0x4bf4('0x62')]),null);}else{var _0x446f24='%'+_0x406bc8['value']+'%';_0x7991ca[_0x4a2cec](_0x4bf4('0x64'),_0x446f24,_0x446f24,_0x446f24);}}else{_0x570e83=_[_0x4bf4('0x65')](_0xefb7ff,[_0x4bf4('0x2a'),_0x4bf4('0x66')]);_0x406bc8['field']='ContactId';_0x29223c=as[_0x4bf4('0x67')](_0x5a0b34,_0x570e83[_0x4bf4('0x68')],_0x406bc8);_0x7991ca[_0x4a2cec](_0x29223c[_0x4bf4('0x69')],_0x29223c[_0x4bf4('0x62')][_0x4bf4('0x6a')],_0x29223c[_0x4bf4('0x62')]['end']);}break;case _0x4bf4('0x6b'):var _0x2cdbf4=_0x406bc8[_0x4bf4('0x62')][_0x4bf4('0x30')](',')['map'](function(_0x2a89e3){return Number(_0x2a89e3);});_0x2cdbf4[_0x4bf4('0x31')](function(_0x5abda0){_0x7afb9b['or'](_0x4bf4('0x6c'),'%,'+_0x5abda0+',%');});_0x1ee6ee=_[_0x4bf4('0x6d')](_0x1ee6ee,_0x2cdbf4);break;case _0x4bf4('0x6e'):if(_0x406bc8[_0x4bf4('0x60')]===_0x4bf4('0x61')){_0x7991ca[_0x4a2cec](_0x4bf4('0x6f'),'%'+_0x406bc8[_0x4bf4('0x62')]+'%',null);}else{_0x570e83=_['find'](_0xefb7ff,[_0x4bf4('0x2a'),_0x4bf4('0x70')]);_0x406bc8[_0x4bf4('0x46')]=_0x4bf4('0x70');_0x29223c=as['buildExpression'](_0x5a0b34,_0x570e83[_0x4bf4('0x68')],_0x406bc8);_0x7991ca[_0x4a2cec](_0x29223c['text'],_0x29223c[_0x4bf4('0x62')][_0x4bf4('0x6a')],_0x29223c[_0x4bf4('0x62')]['end']);}break;case _0x4bf4('0x71'):_0x29223c=as[_0x4bf4('0x67')]('me',null,_0x406bc8);_0x7991ca[_0x4a2cec](_0x29223c[_0x4bf4('0x69')],_0x29223c['value']['start'],_0x29223c[_0x4bf4('0x62')]['end']);break;}}else{var _0x29223c=as[_0x4bf4('0x67')](_0x5a0b34,_0x570e83[_0x4bf4('0x68')],_0x406bc8);_0x7991ca[_0x4a2cec](_0x29223c[_0x4bf4('0x69')],_0x29223c[_0x4bf4('0x62')][_0x4bf4('0x6a')],_0x29223c[_0x4bf4('0x62')][_0x4bf4('0x27')]);}}}else{var _0x370cf1=_(_0x183471[_0x4bf4('0x3a')])[_0x4bf4('0x39')]()['map'](function(_0x5da144){return _[_0x4bf4('0x72')](_0xefb7ff,[_0x4bf4('0x2a'),_0x5da144])?_0x5da144:undefined;})[_0x4bf4('0x73')]()[_0x4bf4('0x62')]();if(!_[_0x4bf4('0x74')](_0x370cf1)){_0x370cf1[_0x4bf4('0x31')](function(_0x5d70e7){if(_0x5d70e7===_0x4bf4('0x75')){_0x15fbf3[_0x4bf4('0x42')](_0x4bf4('0x76'),[][_0x4bf4('0x77')](_0x183471[_0x4bf4('0x3a')][_0x5d70e7]));}else if(_0x5d70e7===_0x4bf4('0x78')){var _0x32e06b=JSON[_0x4bf4('0x79')](_0x183471[_0x4bf4('0x3a')][_0x5d70e7])[_0x4bf4('0x7a')];var _0x78e3c6=JSON['parse'](_0x183471['query'][_0x5d70e7])[_0x4bf4('0x7b')];_0x15fbf3[_0x4bf4('0x42')](_0x4bf4('0x7c'),_0x32e06b,_0x78e3c6);}else{if(_0x183471[_0x4bf4('0x3a')][_0x5d70e7]===_0x4bf4('0x7d')){_0x15fbf3[_0x4bf4('0x42')]('i.'+_0x5d70e7+'\x20IS\x20NULL');}else{_0x15fbf3[_0x4bf4('0x42')]('i.'+_0x5d70e7+'\x20=\x20?',_0x183471[_0x4bf4('0x3a')][_0x5d70e7]);}}});}if(_0x183471[_0x4bf4('0x3a')][_0x4bf4('0x7e')]){if(_0x183471[_0x4bf4('0x3a')][_0x4bf4('0x7e')]==0x1){_0x15fbf3['having'](_0x4bf4('0x7f'));}else{_0x15fbf3[_0x4bf4('0x5c')](_0x4bf4('0x80'));}}if(_0x183471[_0x4bf4('0x3a')][_0x4bf4('0x81')]){_0x1ee6ee=_['isArray'](_0x183471[_0x4bf4('0x3a')][_0x4bf4('0x81')])?_0x183471[_0x4bf4('0x3a')]['tag']:new Array(_0x183471[_0x4bf4('0x3a')][_0x4bf4('0x81')]);_0x1ee6ee[_0x4bf4('0x31')](function(_0x15a981){_0x7afb9b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x15a981+',%');});}if(_0x183471[_0x4bf4('0x3a')]['filter']){var _0x4225d=_0x183471[_0x4bf4('0x3a')][_0x4bf4('0x82')]['replace']('\x5c','\x5c\x5c')[_0x4bf4('0x83')]('\x27\x27',_0x4bf4('0x84'));if(qs['isNumeric'](_0x4225d)){_0x7991ca['or'](_0x4bf4('0x85'),_0x4225d+'%')['or'](_0x4bf4('0x86'),_0x4225d+'%');}_0x7991ca['or'](_0x4bf4('0x87'),_0x4225d+'%');}}_0x15fbf3[_0x4bf4('0x42')](_0x7991ca);_0x15fbf3[_0x4bf4('0x88')](_0x4bf4('0x89'));var _0x1bbf3e={'type':db[_0x4bf4('0x8a')][_0x4bf4('0x8b')][_0x4bf4('0x8c')],'raw':!![]};var _0x44ad46=_0x15fbf3['clone']();_0x44ad46['field'](_0x4bf4('0x89'));_0x44ad46['field'](_0x4bf4('0x8d'),_0x4bf4('0x5b'));if(_0x57dfa5[_0x4bf4('0x8e')]){_0x57dfa5[_0x4bf4('0x8e')][_0x4bf4('0x31')](function(_0x4c7f4c){_0x15fbf3[_0x4bf4('0x8e')]('i.'+_0x4c7f4c[0x0],_0x4c7f4c[0x1]===_0x4bf4('0x8f')?![]:!![]);});}if(!_[_0x4bf4('0x74')](_0x1ee6ee)){_0x15fbf3[_0x4bf4('0x5c')](_0x7afb9b);_0x44ad46[_0x4bf4('0x42')](_0x4bf4('0x90'),_0x1ee6ee);}BPromise[_0x4bf4('0x91')]()[_0x4bf4('0x26')](function(){if(!_0x1e7615){if(_0x183471[_0x4bf4('0x3a')][_0x4bf4('0x75')]||_0x183471[_0x4bf4('0x3a')][_0x4bf4('0x92')])return;_0x44ad46[_0x4bf4('0x42')](_0x4bf4('0x93'));_0x15fbf3['where'](_0x4bf4('0x93'));return;}return _0x183471[_0x4bf4('0x94')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x5f03dd){if(_[_0x4bf4('0x74')](_0x5f03dd)){_0x44ad46['where'](_0x4bf4('0x95'));_0x15fbf3[_0x4bf4('0x42')](_0x4bf4('0x95'));}else{_0x44ad46['where'](_0x4bf4('0x76'),_[_0x4bf4('0x2d')](_0x5f03dd,'id'));_0x15fbf3[_0x4bf4('0x42')](_0x4bf4('0x76'),_[_0x4bf4('0x2d')](_0x5f03dd,'id'));}});})[_0x4bf4('0x26')](function(){db['sequelize'][_0x4bf4('0x3a')](_0x44ad46[_0x4bf4('0x96')](),_0x1bbf3e)[_0x4bf4('0x26')](function(_0x37ff45){_0x33adc0[_0x4bf4('0x1d')]=_0x37ff45['length'];if(_0x33adc0[_0x4bf4('0x1d')]===0x0)return[];return db[_0x4bf4('0x97')][_0x4bf4('0x3a')](_0x30b099[_0x4bf4('0x96')](),_0x1bbf3e)[_0x4bf4('0x26')](function(_0x278653){_0x568cf3=_['keyBy'](_0x278653,'id');_0x1bbf3e=_[_0x4bf4('0x98')](_0x1bbf3e,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x183471[_0x4bf4('0x3a')]['fields']){_0x57dfa5['attributes'][_0x4bf4('0x31')](function(_0x23e297){_0x15fbf3[_0x4bf4('0x46')]('i.'+_0x23e297);});}else{_0x15fbf3[_0x4bf4('0x46')](_0x4bf4('0x8d'),_0x4bf4('0x5b'));_0x15fbf3[_0x4bf4('0x46')](_0x4bf4('0x99'),_0x4bf4('0x9a'));_0x15fbf3['field']('a.mandatoryDisposition',_0x4bf4('0x9b'));_0x15fbf3['field']('i.*');_0x15fbf3[_0x4bf4('0x46')](_0x4bf4('0x9c'),'Contact.firstName');_0x15fbf3[_0x4bf4('0x46')](_0x4bf4('0x9d'),_0x4bf4('0x9e'));_0x15fbf3[_0x4bf4('0x46')](_0x4bf4('0x9f'),'Contact.email');_0x15fbf3[_0x4bf4('0x46')](_0x4bf4('0xa0'),_0x4bf4('0xa1'));_0x15fbf3[_0x4bf4('0x46')](_0x4bf4('0xa2'),_0x4bf4('0xa3'));_0x15fbf3[_0x4bf4('0x46')](_0x4bf4('0xa4'),_0x4bf4('0xa5'));_0x15fbf3[_0x4bf4('0x46')](_0x4bf4('0xa6'),'Owner.fullname');_0x15fbf3['field'](_0x4bf4('0xa7'),_0x4bf4('0xa8'));_0x15fbf3['field'](_0x4bf4('0xa9'),_0x4bf4('0x33'));}if(_0x57dfa5[_0x4bf4('0x1f')])_0x15fbf3[_0x4bf4('0x1f')](_0x57dfa5[_0x4bf4('0x1f')]);if(_0x57dfa5[_0x4bf4('0x1e')])_0x15fbf3[_0x4bf4('0x1e')](_0x57dfa5['offset']);return db[_0x4bf4('0x97')][_0x4bf4('0x3a')](_0x15fbf3[_0x4bf4('0x96')](),_0x1bbf3e);})[_0x4bf4('0x26')](function(_0x4a928b){_0x383615[_0x4bf4('0x42')](_0x4bf4('0xaa'),_[_0x4bf4('0x2d')](_0x4a928b,'id'));return db[_0x4bf4('0x97')][_0x4bf4('0x3a')](_0x383615[_0x4bf4('0x96')](),_0x1bbf3e)['then'](function(_0x4535f7){var _0x15ff4d=_[_0x4bf4('0xab')](_0x4535f7,'FaxInteractionId');var _0x54a3be=[];_0x4a928b[_0x4bf4('0x31')](function(_0x236435){_0x54a3be[_0x4bf4('0x32')](updateFaxInteraction(_0x236435,_0x568cf3,_0x15ff4d));});return BPromise['all'](_0x54a3be);});});})[_0x4bf4('0x26')](function(_0x2a066c){_0x33adc0['rows']=_0x2a066c;return _0x33adc0;})['then'](respondWithFilteredResult(_0x5785ca,_0x57dfa5));})['catch'](handleError(_0x5785ca,null));};exports[_0x4bf4('0xac')]=function(_0x4d9478,_0x520ece){var _0x3097e3={'raw':![],'where':{'id':_0x4d9478[_0x4bf4('0xad')]['id']}},_0x4b1458={};_0x4b1458['model']=_[_0x4bf4('0x39')](db[_0x4bf4('0x36')][_0x4bf4('0x37')]);_0x4b1458[_0x4bf4('0x3a')]=_[_0x4bf4('0x39')](_0x4d9478[_0x4bf4('0x3a')]);_0x4b1458[_0x4bf4('0xae')]=_[_0x4bf4('0x3b')](_0x4b1458[_0x4bf4('0x3c')],_0x4b1458[_0x4bf4('0x3a')]);_0x3097e3[_0x4bf4('0x3e')]=_['intersection'](_0x4b1458[_0x4bf4('0x3c')],qs[_0x4bf4('0x3d')](_0x4d9478[_0x4bf4('0x3a')]['fields']));_0x3097e3[_0x4bf4('0x3e')]=_0x3097e3[_0x4bf4('0x3e')][_0x4bf4('0x5a')]?_0x3097e3[_0x4bf4('0x3e')]:_0x4b1458[_0x4bf4('0x3c')];if(_0x4d9478[_0x4bf4('0x3a')][_0x4bf4('0xaf')]){_0x3097e3['include']=[{'all':!![]}];}_0x3097e3=_[_0x4bf4('0x98')]({},_0x3097e3,_0x4d9478[_0x4bf4('0xb0')]);return db[_0x4bf4('0x36')][_0x4bf4('0x65')](_0x3097e3)[_0x4bf4('0x26')](handleEntityNotFound(_0x520ece,null))[_0x4bf4('0x26')](respondWithResult(_0x520ece,null))[_0x4bf4('0x34')](handleError(_0x520ece,null));};exports['create']=function(_0x346063,_0x2b911a){return db[_0x4bf4('0x36')]['create'](_0x346063[_0x4bf4('0x71')],{})[_0x4bf4('0x26')](respondWithResult(_0x2b911a,0xc9))[_0x4bf4('0x34')](handleError(_0x2b911a,null));};exports[_0x4bf4('0x24')]=function(_0x36e45d,_0x587026){if(_0x36e45d['body']['id']){delete _0x36e45d[_0x4bf4('0x71')]['id'];}return db[_0x4bf4('0x36')][_0x4bf4('0x65')]({'where':{'id':_0x36e45d[_0x4bf4('0xad')]['id']}})[_0x4bf4('0x26')](handleEntityNotFound(_0x587026,null))[_0x4bf4('0x26')](saveUpdates(_0x36e45d[_0x4bf4('0x71')],null))['then'](respondWithResult(_0x587026,null))[_0x4bf4('0x34')](handleError(_0x587026,null));};exports['destroy']=function(_0x3fe8d2,_0x2a4014){return db[_0x4bf4('0x36')][_0x4bf4('0x65')]({'where':{'id':_0x3fe8d2[_0x4bf4('0xad')]['id']}})['then'](handleEntityNotFound(_0x2a4014,null))[_0x4bf4('0x26')](removeEntity(_0x2a4014,null))[_0x4bf4('0x34')](handleError(_0x2a4014,null));};exports[_0x4bf4('0xb1')]=function(_0x1bfd9c,_0x51290d){return db[_0x4bf4('0x36')]['describe']()[_0x4bf4('0x26')](respondWithResult(_0x51290d,null))['catch'](handleError(_0x51290d,null));};exports['addMessage']=function(_0x92ed51,_0x39485b,_0x95fd04){return db[_0x4bf4('0xb2')][_0x4bf4('0x65')]({'where':{'id':_0x92ed51[_0x4bf4('0xad')]['id']}})['then'](handleEntityNotFound(_0x39485b,null))[_0x4bf4('0x26')](function(_0xe3a5b4){if(_0xe3a5b4){return _0xe3a5b4[_0x4bf4('0xb3')](_0x92ed51[_0x4bf4('0x71')][_0x4bf4('0xb4')],_[_0x4bf4('0xb5')](_0x92ed51['body'],[_0x4bf4('0xb4'),'id'])||{});}})[_0x4bf4('0x26')](respondWithResult(_0x39485b,null))[_0x4bf4('0x34')](handleError(_0x39485b,null));};exports[_0x4bf4('0xb6')]=function(_0xf3dbdc,_0x136774,_0x248bd2){var _0x5ca78f={'raw':![],'where':{}};var _0x1b33f2={};var _0x3f2e6d={'count':0x0,'rows':[]};return db[_0x4bf4('0x36')]['findOne']({'where':{'id':_0xf3dbdc[_0x4bf4('0xad')]['id']}})[_0x4bf4('0x26')](handleEntityNotFound(_0x136774,null))['then'](function(_0x3c14a0){if(_0x3c14a0){_0x1b33f2['model']=_[_0x4bf4('0x39')](db['FaxMessage']['rawAttributes']);_0x1b33f2[_0x4bf4('0x3a')]=_[_0x4bf4('0x39')](_0xf3dbdc[_0x4bf4('0x3a')]);_0x1b33f2[_0x4bf4('0x43')]=_['intersection'](_0x1b33f2[_0x4bf4('0x3c')],_0x1b33f2[_0x4bf4('0x3a')]);_0x5ca78f['attributes']=_['intersection'](_0x1b33f2[_0x4bf4('0x3c')],qs[_0x4bf4('0x3d')](_0xf3dbdc[_0x4bf4('0x3a')][_0x4bf4('0x3d')]));_0x5ca78f[_0x4bf4('0x3e')]=_0x5ca78f[_0x4bf4('0x3e')][_0x4bf4('0x5a')]?_0x5ca78f[_0x4bf4('0x3e')]:_0x1b33f2[_0x4bf4('0x3c')];if(!_0xf3dbdc[_0x4bf4('0x3a')]['hasOwnProperty']('nolimit')){_0x5ca78f[_0x4bf4('0x1f')]=qs[_0x4bf4('0x1f')](_0xf3dbdc[_0x4bf4('0x3a')][_0x4bf4('0x1f')]);_0x5ca78f[_0x4bf4('0x1e')]=qs['offset'](_0xf3dbdc[_0x4bf4('0x3a')][_0x4bf4('0x1e')]);}_0x5ca78f[_0x4bf4('0x8e')]=qs['sort'](_0xf3dbdc[_0x4bf4('0x3a')][_0x4bf4('0x41')]);_0x5ca78f[_0x4bf4('0x42')]=qs[_0x4bf4('0x43')](_[_0x4bf4('0x44')](_0xf3dbdc[_0x4bf4('0x3a')],_0x1b33f2[_0x4bf4('0x43')]));_0x5ca78f[_0x4bf4('0x42')]['FaxInteractionId']=_0x3c14a0['id'];if(_0xf3dbdc['query']['filter']){_0x5ca78f[_0x4bf4('0x42')]=_[_0x4bf4('0x98')](_0x5ca78f[_0x4bf4('0x42')],{'$or':_['map'](_0x5ca78f['attributes'],function(_0x50d70f){var _0x5a3938={};_0x5a3938[_0x50d70f]={'$like':'%'+_0xf3dbdc['query'][_0x4bf4('0x82')]+'%'};return _0x5a3938;})});}if(_0xf3dbdc['query']['$gte']){var _0x25696d=_0xf3dbdc[_0x4bf4('0x3a')][_0x4bf4('0x7a')][_0x4bf4('0x30')](',');var _0x471f28={};_0x471f28[_0x25696d[0x0]]={'$gte':moment(_0x25696d[0x1])[_0x4bf4('0xb7')](_0x4bf4('0xb8'))};_0x5ca78f[_0x4bf4('0x42')]=_[_0x4bf4('0x98')](_0x5ca78f['where'],_0x471f28);}_0x5ca78f=_[_0x4bf4('0x98')]({},_0x5ca78f,_0xf3dbdc[_0x4bf4('0xb0')]);return db[_0x4bf4('0xb2')][_0x4bf4('0x1d')]({'where':_0x5ca78f['where']})[_0x4bf4('0x26')](function(_0x5acd49){_0x3f2e6d[_0x4bf4('0x1d')]=_0x5acd49;if(_0xf3dbdc[_0x4bf4('0x3a')][_0x4bf4('0xaf')]){_0x5ca78f[_0x4bf4('0xb9')]=[{'all':!![]}];}return db[_0x4bf4('0xb2')][_0x4bf4('0xba')](_0x5ca78f);})['then'](function(_0x50b30e){_0x3f2e6d['rows']=_0x50b30e;return _0x3f2e6d;});}})[_0x4bf4('0x26')](respondWithFilteredResult(_0x136774,_0x5ca78f))[_0x4bf4('0x34')](handleError(_0x136774,null));};exports[_0x4bf4('0xbb')]=function(_0x389083,_0xec4f1,_0x562764){return db['FaxInteraction'][_0x4bf4('0x65')]({'where':{'id':_0x389083[_0x4bf4('0xad')]['id']}})[_0x4bf4('0x26')](handleEntityNotFound(_0xec4f1,null))['then'](function(_0xd889a8){if(_0xd889a8){return _0xd889a8[_0x4bf4('0xbc')](_0x389083['body'][_0x4bf4('0xb4')],_[_0x4bf4('0xb5')](_0x389083[_0x4bf4('0x71')],[_0x4bf4('0xb4'),'id'])||{})[_0x4bf4('0xbd')](function(){return db[_0x4bf4('0x6b')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x389083[_0x4bf4('0x71')][_0x4bf4('0xb4')]}});})['then'](function(_0x248c2b){socket[_0x4bf4('0xbe')](_0x4bf4('0xbf'),{'id':Number(_0x389083[_0x4bf4('0xad')]['id']),'tags':_0x248c2b||[]});return{'id':Number(_0x389083['params']['id']),'tags':_0x248c2b||[]};});}})['then'](respondWithResult(_0xec4f1,null))[_0x4bf4('0x34')](handleError(_0xec4f1,null));};exports['removeTags']=function(_0x3a39ae,_0x10df11,_0x114137){return db['FaxInteraction'][_0x4bf4('0x65')]({'where':{'id':_0x3a39ae[_0x4bf4('0xad')]['id']}})[_0x4bf4('0x26')](handleEntityNotFound(_0x10df11,null))['then'](function(_0x2ae5cd){if(_0x2ae5cd){return _0x2ae5cd[_0x4bf4('0xc0')](_0x3a39ae[_0x4bf4('0x3a')][_0x4bf4('0xb4')]);}})[_0x4bf4('0x26')](respondWithStatusCode(_0x10df11,null))[_0x4bf4('0x34')](handleError(_0x10df11,null));};exports[_0x4bf4('0xc1')]=function(_0x1f7e4d,_0x5ddf06){var _0xd32deb=moment()['unix']()[_0x4bf4('0x96')]();var _0x56e827=path[_0x4bf4('0xc2')](config[_0x4bf4('0xc3')],_0x4bf4('0xc4'),_0x4bf4('0xc5'),_0x4bf4('0xc6'));var _0x266cb4=path[_0x4bf4('0xc2')](config[_0x4bf4('0xc3')],'server',_0x4bf4('0xc5'),'attachments');var _0x49ea3c=path[_0x4bf4('0xc2')](_0x56e827,_0xd32deb);var _0x4dbf1f=util[_0x4bf4('0xb7')]('transcript-%d-%s.zip',_0x1f7e4d[_0x4bf4('0xad')]['id'],_0xd32deb);var _0x40c358=path['join'](_0x56e827,_0x4dbf1f);var _0x421437=[];_0x421437[_0x4bf4('0x32')]({'model':db[_0x4bf4('0xc7')],'as':_0x4bf4('0xc7'),'raw':!![]});var _0x1f6aa2=[{'model':db[_0x4bf4('0xb2')],'as':_0x4bf4('0xc8'),'attributes':['id',_0x4bf4('0x71'),'createdAt'],'include':_0x421437}];return db[_0x4bf4('0x36')][_0x4bf4('0x65')]({'where':{'id':_0x1f7e4d[_0x4bf4('0xad')]['id']},'include':_0x1f6aa2})['then'](handleEntityNotFound(_0x5ddf06,null))[_0x4bf4('0x26')](function(_0x4be10d){if(_0x4be10d&&_0x4be10d[_0x4bf4('0xc8')]){var _0x15d579=_0x4be10d[_0x4bf4('0xc9')]({'plain':!![]});fs[_0x4bf4('0xca')](_0x49ea3c);for(var _0x598c0e=0x0;_0x598c0e<_0x15d579[_0x4bf4('0xc8')][_0x4bf4('0x5a')];_0x598c0e++){var _0x298998=_0x15d579[_0x4bf4('0xc8')][_0x598c0e]['Attachment'];if(_0x298998){var _0xa0c201=path[_0x4bf4('0xc2')](_0x266cb4,_0x298998[_0x4bf4('0xcb')]);if(fs['existsSync'](_0xa0c201)){fs[_0x4bf4('0xcc')](_0xa0c201)[_0x4bf4('0xcd')](fs[_0x4bf4('0xce')](path[_0x4bf4('0xc2')](_0x49ea3c,_0x298998[_0x4bf4('0xcb')])));}}}return BPromise[_0x4bf4('0x91')]()[_0x4bf4('0x26')](function(){return new BPromise(function(_0x1d22e9,_0x26c158){zipdir(_0x49ea3c,{'saveTo':_0x40c358},function(_0x382906,_0x2a012a){if(_0x382906)return _0x26c158(_0x382906);return _0x1d22e9(_0x2a012a);});})[_0x4bf4('0x26')](function(){return new BPromise(function(_0x5086b5,_0x2685fe){rimraf(_0x49ea3c,function(_0x4761c8){if(_0x4761c8)_0x2685fe(_0x4761c8);return _0x5086b5();});});})[_0x4bf4('0x26')](function(){return _0x5ddf06[_0x4bf4('0xc1')](_0x40c358,_0x4dbf1f,function(_0x4d6f77){if(_0x4d6f77){console['log'](_0x4bf4('0xcf'),_0x4d6f77);}else{fs['unlinkSync'](_0x40c358);}});});});}else{return _0x5ddf06['sendStatus'](0xc8);}})[_0x4bf4('0x34')](handleError(_0x5ddf06,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 16d688f..6a6419a 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 _0x7a54=['setDataValue','map','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers'];(function(_0x441058,_0x42d57d){var _0x56671d=function(_0x56fcc8){while(--_0x56fcc8){_0x441058['push'](_0x441058['shift']());}};_0x56671d(++_0x42d57d);}(_0x7a54,0x106));var _0x47a5=function(_0x537b36,_0x442e9d){_0x537b36=_0x537b36-0x0;var _0x356162=_0x7a54[_0x537b36];return _0x356162;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var FaxInteraction=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x47a5('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x47a5('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x47a5('0x5'),'afterDestroy':_0x47a5('0x6')};function emitEvent(_0x2a1a7e){return function(_0x3717e1,_0xfdf934,_0x545a97){_0x3717e1[_0x47a5('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x343372){_0x3717e1[_0x47a5('0x8')]('Users',_0x343372[_0x47a5('0x9')](function(_0x5077f3){return{'id':_0x5077f3['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x3717e1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2a0e98){_0x3717e1[_0x47a5('0x8')]('unreadMessages',_0x2a0e98[_0x47a5('0xa')]);FaxInteractionEvents['emit'](_0x2a1a7e+':'+_0x3717e1['id'],_0x3717e1);FaxInteractionEvents['emit'](_0x2a1a7e,_0x3717e1);_0x545a97(null);})[_0x47a5('0xb')](_0x545a97(null));};}for(var e in events){if(events[_0x47a5('0xc')](e)){var event=events[e];FaxInteraction[_0x47a5('0xd')](e,emitEvent(event));}}module[_0x47a5('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x1419a8,_0x4207da){var _0x305a1b=function(_0x5f3305){while(--_0x5f3305){_0x1419a8['push'](_0x1419a8['shift']());}};_0x305a1b(++_0x4207da);}(_0x1261,0x144));var _0x1126=function(_0xd8f7bd,_0x45dc8c){_0xd8f7bd=_0xd8f7bd-0x0;var _0x1bd5ee=_0x1261[_0xd8f7bd];return _0x1bd5ee;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 0180e23..d513a76 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 _0x6fa3=['./faxInteraction.attributes','define','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x14911e,_0x578e33){var _0x46ed87=function(_0x315ad6){while(--_0x315ad6){_0x14911e['push'](_0x14911e['shift']());}};_0x46ed87(++_0x578e33);}(_0x6fa3,0xe4));var _0x36fa=function(_0x4954c1,_0xd74fee){_0x4954c1=_0x4954c1-0x0;var _0x1f2b6f=_0x6fa3[_0x4954c1];return _0x1f2b6f;};'use strict';var _=require('lodash');var util=require(_0x36fa('0x0'));var logger=require(_0x36fa('0x1'))(_0x36fa('0x2'));var moment=require(_0x36fa('0x3'));var BPromise=require('bluebird');var rp=require(_0x36fa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x36fa('0x5'));var attributes=require(_0x36fa('0x6'));module['exports']=function(_0x9282d7,_0x55f4d8){return _0x9282d7[_0x36fa('0x7')]('FaxInteraction',attributes,{'tableName':_0x36fa('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x291882,_0x32fd0d,_0x3527c5){if(_0x291882[_0x36fa('0x9')]('closed')){_0x291882[_0x36fa('0xa')]=moment()[_0x36fa('0xb')](_0x36fa('0xc'));}_0x3527c5(null,_0x291882);}}});}; \ No newline at end of file +var _0x07fb=['../../config/environment','./faxInteraction.attributes','exports','define','fax_interactions','changed','lodash','util','../../config/logger','api','moment','path'];(function(_0x447fda,_0x4c578e){var _0x37b204=function(_0x5bdee7){while(--_0x5bdee7){_0x447fda['push'](_0x447fda['shift']());}};_0x37b204(++_0x4c578e);}(_0x07fb,0x1e6));var _0xb07f=function(_0x20f27c,_0x36ea42){_0x20f27c=_0x20f27c-0x0;var _0x2ec2f9=_0x07fb[_0x20f27c];return _0x2ec2f9;};'use strict';var _=require(_0xb07f('0x0'));var util=require(_0xb07f('0x1'));var logger=require(_0xb07f('0x2'))(_0xb07f('0x3'));var moment=require(_0xb07f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb07f('0x5'));var rimraf=require('rimraf');var config=require(_0xb07f('0x6'));var attributes=require(_0xb07f('0x7'));module[_0xb07f('0x8')]=function(_0x5f3a12,_0x3891a1){return _0x5f3a12[_0xb07f('0x9')]('FaxInteraction',attributes,{'tableName':_0xb07f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3e0155,_0x2d9caa,_0xdced2a){if(_0x3e0155[_0xb07f('0xb')]('closed')){_0x3e0155['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0xdced2a(null,_0x3e0155);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 381dd89..db82613 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 _0xa65c=['then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','body','options','raw','where','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','FaxInteraction','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','register'];(function(_0x47401b,_0x241726){var _0x4fcd8b=function(_0x3ec2bf){while(--_0x3ec2bf){_0x47401b['push'](_0x47401b['shift']());}};_0x4fcd8b(++_0x241726);}(_0xa65c,0xc5));var _0xca65=function(_0x58fc89,_0x5b9cb7){_0x58fc89=_0x58fc89-0x0;var _0x2180ff=_0xa65c[_0x58fc89];return _0x2180ff;};'use strict';var _=require(_0xca65('0x0'));var util=require(_0xca65('0x1'));var moment=require(_0xca65('0x2'));var BPromise=require(_0xca65('0x3'));var rs=require(_0xca65('0x4'));var fs=require('fs');var Redis=require(_0xca65('0x5'));var db=require(_0xca65('0x6'))['db'];var utils=require(_0xca65('0x7'));var logger=require(_0xca65('0x8'))(_0xca65('0x9'));var config=require(_0xca65('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xca65('0xb')][_0xca65('0xc')]({'port':0x232a});config['redis']=_[_0xca65('0xd')](config['redis'],{'host':_0xca65('0xe'),'port':0x18eb});var socket=require(_0xca65('0xf'))(new Redis(config[_0xca65('0x10')]));require('./faxInteraction.socket')[_0xca65('0x11')](socket);function respondWithRpcPromise(_0x843648,_0x447dee,_0x4ab6d6){return new BPromise(function(_0x1c24f7,_0x5df17b){return client['request'](_0x843648,_0x4ab6d6)[_0xca65('0x12')](function(_0x1e73b2){logger[_0xca65('0x13')](_0xca65('0x14'),_0x447dee,_0xca65('0x15'));logger[_0xca65('0x16')](_0xca65('0x17'),_0x447dee,_0xca65('0x15'),JSON[_0xca65('0x18')](_0x1e73b2));if(_0x1e73b2['error']){if(_0x1e73b2[_0xca65('0x19')]['code']===0x1f4){logger[_0xca65('0x19')](_0xca65('0x14'),_0x447dee,_0x1e73b2['error'][_0xca65('0x1a')]);return _0x5df17b(_0x1e73b2['error']['message']);}logger[_0xca65('0x19')](_0xca65('0x14'),_0x447dee,_0x1e73b2[_0xca65('0x19')]['message']);return _0x1c24f7(_0x1e73b2['error'][_0xca65('0x1a')]);}else{logger[_0xca65('0x13')](_0xca65('0x14'),_0x447dee,_0xca65('0x15'));_0x1c24f7(_0x1e73b2[_0xca65('0x1b')]['message']);}})[_0xca65('0x1c')](function(_0x4c762d){logger[_0xca65('0x19')](_0xca65('0x14'),_0x447dee,_0x4c762d);_0x5df17b(_0x4c762d);});});}exports['UpdateFaxInteraction']=function(_0x20da4b){var _0x16fa4f=this;return new Promise(function(_0x318c7c,_0x3e5960){return db['FaxInteraction']['update'](_0x20da4b[_0xca65('0x1d')],{'raw':_0x20da4b[_0xca65('0x1e')]?_0x20da4b[_0xca65('0x1e')][_0xca65('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20da4b[_0xca65('0x1e')]?_0x20da4b[_0xca65('0x1e')][_0xca65('0x20')]||null:null,'attributes':_0x20da4b[_0xca65('0x1e')]?_0x20da4b['options'][_0xca65('0x21')]||null:null,'limit':_0x20da4b[_0xca65('0x1e')]?_0x20da4b['options'][_0xca65('0x22')]||null:null})[_0xca65('0x12')](function(_0x40dc07){logger[_0xca65('0x13')](_0xca65('0x23'),_0x20da4b);logger[_0xca65('0x16')](_0xca65('0x23'),_0x20da4b,JSON[_0xca65('0x18')](_0x40dc07));_0x318c7c(_0x40dc07);})[_0xca65('0x1c')](function(_0x2d4864){logger[_0xca65('0x19')]('UpdateFaxInteraction',_0x2d4864[_0xca65('0x1a')],_0x20da4b);_0x3e5960(_0x16fa4f[_0xca65('0x19')](0x1f4,_0x2d4864['message']));});});};exports[_0xca65('0x24')]=function(_0x3b4a23){return new Promise(function(_0x23283c,_0x162050){return db[_0xca65('0x25')]['find']({'where':_0x3b4a23[_0xca65('0x1e')]?_0x3b4a23[_0xca65('0x1e')]['where']||null:null})[_0xca65('0x12')](function(_0x152006){if(_0x152006){return _0x152006[_0xca65('0x26')](_0x3b4a23[_0xca65('0x1d')]['ids'],_[_0xca65('0x27')](_0x3b4a23['body'],[_0xca65('0x28'),'id'])||{});}})[_0xca65('0x29')](function(_0x137f3f){logger[_0xca65('0x13')](_0xca65('0x2a'),_0x3b4a23);logger[_0xca65('0x16')](_0xca65('0x2a'),_0x3b4a23,JSON[_0xca65('0x18')](_0x137f3f));_0x23283c(_0x137f3f);})[_0xca65('0x1c')](function(_0x5053be){logger[_0xca65('0x19')]('AddTags',_0x5053be[_0xca65('0x1a')],_0x3b4a23);_0x162050(_this['error'](0x1f4,_0x5053be['message']));});});}; \ No newline at end of file +var _0xd9c8=['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','FaxInteraction','update','options','raw','where','limit','find','addTags','body','omit','ids','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket'];(function(_0x4c3c9e,_0x4d8c54){var _0x223668=function(_0xc9456){while(--_0xc9456){_0x4c3c9e['push'](_0x4c3c9e['shift']());}};_0x223668(++_0x4d8c54);}(_0xd9c8,0x112));var _0x8d9c=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xd9c8[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x8d9c('0x0'));var util=require(_0x8d9c('0x1'));var moment=require(_0x8d9c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d9c('0x3'));var db=require(_0x8d9c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8d9c('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8d9c('0x6'));var client=jayson[_0x8d9c('0x7')][_0x8d9c('0x8')]({'port':0x232a});config[_0x8d9c('0x9')]=_['defaults'](config[_0x8d9c('0x9')],{'host':_0x8d9c('0xa'),'port':0x18eb});var socket=require(_0x8d9c('0xb'))(new Redis(config[_0x8d9c('0x9')]));require(_0x8d9c('0xc'))[_0x8d9c('0xd')](socket);function respondWithRpcPromise(_0x2aa23f,_0x206bd4,_0x531689){return new BPromise(function(_0x8f94ea,_0x589104){return client[_0x8d9c('0xe')](_0x2aa23f,_0x531689)[_0x8d9c('0xf')](function(_0x454244){logger[_0x8d9c('0x10')](_0x8d9c('0x11'),_0x206bd4,_0x8d9c('0x12'));logger[_0x8d9c('0x13')](_0x8d9c('0x14'),_0x206bd4,_0x8d9c('0x12'),JSON[_0x8d9c('0x15')](_0x454244));if(_0x454244[_0x8d9c('0x16')]){if(_0x454244['error'][_0x8d9c('0x17')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x206bd4,_0x454244[_0x8d9c('0x16')]['message']);return _0x589104(_0x454244[_0x8d9c('0x16')][_0x8d9c('0x18')]);}logger[_0x8d9c('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x206bd4,_0x454244[_0x8d9c('0x16')][_0x8d9c('0x18')]);return _0x8f94ea(_0x454244['error']['message']);}else{logger[_0x8d9c('0x10')](_0x8d9c('0x11'),_0x206bd4,_0x8d9c('0x12'));_0x8f94ea(_0x454244[_0x8d9c('0x19')][_0x8d9c('0x18')]);}})[_0x8d9c('0x1a')](function(_0x22c6dc){logger[_0x8d9c('0x16')](_0x8d9c('0x11'),_0x206bd4,_0x22c6dc);_0x589104(_0x22c6dc);});});}exports[_0x8d9c('0x1b')]=function(_0x2b6327){var _0x1a8980=this;return new Promise(function(_0x1b5ff6,_0x253f5f){return db[_0x8d9c('0x1c')][_0x8d9c('0x1d')](_0x2b6327['body'],{'raw':_0x2b6327[_0x8d9c('0x1e')]?_0x2b6327[_0x8d9c('0x1e')][_0x8d9c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b6327[_0x8d9c('0x1e')]?_0x2b6327['options'][_0x8d9c('0x20')]||null:null,'attributes':_0x2b6327[_0x8d9c('0x1e')]?_0x2b6327[_0x8d9c('0x1e')]['attributes']||null:null,'limit':_0x2b6327['options']?_0x2b6327[_0x8d9c('0x1e')][_0x8d9c('0x21')]||null:null})[_0x8d9c('0xf')](function(_0x3763c1){logger[_0x8d9c('0x10')](_0x8d9c('0x1b'),_0x2b6327);logger[_0x8d9c('0x13')]('UpdateFaxInteraction',_0x2b6327,JSON['stringify'](_0x3763c1));_0x1b5ff6(_0x3763c1);})[_0x8d9c('0x1a')](function(_0x4b3730){logger[_0x8d9c('0x16')](_0x8d9c('0x1b'),_0x4b3730[_0x8d9c('0x18')],_0x2b6327);_0x253f5f(_0x1a8980[_0x8d9c('0x16')](0x1f4,_0x4b3730[_0x8d9c('0x18')]));});});};exports['AddTagsToFaxInteraction']=function(_0x4c204b){return new Promise(function(_0x5eb21f,_0xba791c){return db[_0x8d9c('0x1c')][_0x8d9c('0x22')]({'where':_0x4c204b[_0x8d9c('0x1e')]?_0x4c204b[_0x8d9c('0x1e')]['where']||null:null})[_0x8d9c('0xf')](function(_0x28d9fe){if(_0x28d9fe){return _0x28d9fe[_0x8d9c('0x23')](_0x4c204b[_0x8d9c('0x24')]['ids'],_[_0x8d9c('0x25')](_0x4c204b[_0x8d9c('0x24')],[_0x8d9c('0x26'),'id'])||{});}})[_0x8d9c('0x27')](function(_0xf39b4d){logger['info'](_0x8d9c('0x28'),_0x4c204b);logger[_0x8d9c('0x13')](_0x8d9c('0x28'),_0x4c204b,JSON[_0x8d9c('0x15')](_0xf39b4d));_0x5eb21f(_0xf39b4d);})[_0x8d9c('0x1a')](function(_0x203fc1){logger[_0x8d9c('0x16')]('AddTags',_0x203fc1[_0x8d9c('0x18')],_0x4c204b);_0xba791c(_this[_0x8d9c('0x16')](0x1f4,_0x203fc1[_0x8d9c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 2bd7084..2e37013 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 _0xf3fc=['register','length','faxInteraction:','./faxInteraction.events','save','remove','removeListener'];(function(_0xc5b7b8,_0x5b3fd4){var _0x4de82e=function(_0x44e861){while(--_0x44e861){_0xc5b7b8['push'](_0xc5b7b8['shift']());}};_0x4de82e(++_0x5b3fd4);}(_0xf3fc,0xf8));var _0xcf3f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf3fc[_0x20a584];return _0x4b41a8;};'use strict';var FaxInteractionEvents=require(_0xcf3f('0x0'));var events=[_0xcf3f('0x1'),_0xcf3f('0x2'),'update'];function createListener(_0x3ea15e,_0x345332){return function(_0x971b60){_0x345332['emit'](_0x3ea15e,_0x971b60);};}function removeListener(_0x18e057,_0x5de06b){return function(){FaxInteractionEvents[_0xcf3f('0x3')](_0x18e057,_0x5de06b);};}exports[_0xcf3f('0x4')]=function(_0x518172){for(var _0x268da5=0x0,_0x1eccae=events[_0xcf3f('0x5')];_0x268da5<_0x1eccae;_0x268da5++){var _0x2e6f00=events[_0x268da5];var _0x2c6f22=createListener(_0xcf3f('0x6')+_0x2e6f00,_0x518172);FaxInteractionEvents['on'](_0x2e6f00,_0x2c6f22);}}; \ No newline at end of file +var _0xd4f1=['faxInteraction:','remove','update','removeListener','register','length'];(function(_0x3e844c,_0x188bc2){var _0x4e7c8a=function(_0x1dc8ad){while(--_0x1dc8ad){_0x3e844c['push'](_0x3e844c['shift']());}};_0x4e7c8a(++_0x188bc2);}(_0xd4f1,0x1c3));var _0x1d4f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd4f1[_0x20a584];return _0x4b41a8;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x1d4f('0x0'),_0x1d4f('0x1')];function createListener(_0x4d0306,_0x1dd4d7){return function(_0x40a965){_0x1dd4d7['emit'](_0x4d0306,_0x40a965);};}function removeListener(_0x2c09d6,_0x11725f){return function(){FaxInteractionEvents[_0x1d4f('0x2')](_0x2c09d6,_0x11725f);};}exports[_0x1d4f('0x3')]=function(_0xa63eb){for(var _0xed1312=0x0,_0x5f504e=events[_0x1d4f('0x4')];_0xed1312<_0x5f504e;_0xed1312++){var _0x5c139c=events[_0xed1312];var _0x47010c=createListener(_0x1d4f('0x5')+_0x5c139c,_0xa63eb);FaxInteractionEvents['on'](_0x5c139c,_0x47010c);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 76a39bd..e885cd4 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 _0x878f=['../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','/:id','faxinteraction:update','update','delete','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4c174d,_0x3cb4f1){var _0x463366=function(_0x49cddd){while(--_0x49cddd){_0x4c174d['push'](_0x4c174d['shift']());}};_0x463366(++_0x3cb4f1);}(_0x878f,0x173));var _0xf878=function(_0x2f30db,_0x49bc61){_0x2f30db=_0x2f30db-0x0;var _0x342ae7=_0x878f[_0x2f30db];return _0x342ae7;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var auth=require(_0xf878('0x5'));var interaction=require(_0xf878('0x6'));var config=require(_0xf878('0x7'));var controller=require(_0xf878('0x8'));router[_0xf878('0x9')]('/',auth[_0xf878('0xa')](),controller['index']);router['get'](_0xf878('0xb'),auth[_0xf878('0xa')](),controller['describe']);router['get']('/:id',auth[_0xf878('0xa')](),controller['show']);router['get'](_0xf878('0xc'),auth[_0xf878('0xa')](),controller[_0xf878('0xd')]);router['get'](_0xf878('0xe'),auth[_0xf878('0xa')](),controller['download']);router[_0xf878('0xf')]('/',auth['isAuthenticated'](),controller[_0xf878('0x10')]);router[_0xf878('0xf')](_0xf878('0xc'),auth['isAuthenticated'](),controller[_0xf878('0x11')]);router[_0xf878('0xf')](_0xf878('0x12'),auth['isAuthenticated'](),interaction[_0xf878('0x13')](_0xf878('0x14'),_0xf878('0x15')),controller['addTags']);router['put'](_0xf878('0x16'),auth[_0xf878('0xa')](),interaction[_0xf878('0x13')](_0xf878('0x14'),_0xf878('0x17')),controller[_0xf878('0x18')]);router[_0xf878('0x19')](_0xf878('0x16'),auth[_0xf878('0xa')](),interaction[_0xf878('0x13')](_0xf878('0x14'),'faxinteraction:destroy'),controller[_0xf878('0x1a')]);router[_0xf878('0x19')](_0xf878('0x12'),auth[_0xf878('0xa')](),controller[_0xf878('0x1b')]);module[_0xf878('0x1c')]=router; \ No newline at end of file +var _0xa571=['isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','/:id/tags','tracked','faxinteraction:addtags','addTags','put','update','delete','fax','faxinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./faxInteraction.controller'];(function(_0x1ba4cd,_0x4b9096){var _0x3a5986=function(_0x1ad50c){while(--_0x1ad50c){_0x1ba4cd['push'](_0x1ba4cd['shift']());}};_0x3a5986(++_0x4b9096);}(_0xa571,0x107));var _0x1a57=function(_0x38e730,_0x2e63b6){_0x38e730=_0x38e730-0x0;var _0x29b82e=_0xa571[_0x38e730];return _0x29b82e;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var auth=require(_0x1a57('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1a57('0x6'));router['get']('/',auth[_0x1a57('0x7')](),controller[_0x1a57('0x8')]);router[_0x1a57('0x9')](_0x1a57('0xa'),auth[_0x1a57('0x7')](),controller[_0x1a57('0xb')]);router['get'](_0x1a57('0xc'),auth[_0x1a57('0x7')](),controller[_0x1a57('0xd')]);router['get'](_0x1a57('0xe'),auth[_0x1a57('0x7')](),controller[_0x1a57('0xf')]);router[_0x1a57('0x9')](_0x1a57('0x10'),auth[_0x1a57('0x7')](),controller[_0x1a57('0x11')]);router[_0x1a57('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1a57('0x12')](_0x1a57('0xe'),auth[_0x1a57('0x7')](),controller['addMessage']);router[_0x1a57('0x12')](_0x1a57('0x13'),auth['isAuthenticated'](),interaction[_0x1a57('0x14')]('fax',_0x1a57('0x15')),controller[_0x1a57('0x16')]);router[_0x1a57('0x17')](_0x1a57('0xc'),auth['isAuthenticated'](),interaction[_0x1a57('0x14')]('fax','faxinteraction:update'),controller[_0x1a57('0x18')]);router[_0x1a57('0x19')](_0x1a57('0xc'),auth['isAuthenticated'](),interaction[_0x1a57('0x14')](_0x1a57('0x1a'),_0x1a57('0x1b')),controller['destroy']);router[_0x1a57('0x19')](_0x1a57('0x13'),auth[_0x1a57('0x7')](),controller[_0x1a57('0x1c')]);module[_0x1a57('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 050ebe4..7b39aa7 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 _0x58f5=['TEXT','medium','BOOLEAN','ENUM','out','sequelize','exports'];(function(_0x4dd25c,_0x110ed1){var _0x40579f=function(_0x55dec3){while(--_0x55dec3){_0x4dd25c['push'](_0x4dd25c['shift']());}};_0x40579f(++_0x110ed1);}(_0x58f5,0x19b));var _0x558f=function(_0x204110,_0x2919ed){_0x204110=_0x204110-0x0;var _0x2e69fc=_0x58f5[_0x204110];return _0x2e69fc;};'use strict';var Sequelize=require(_0x558f('0x0'));module[_0x558f('0x1')]={'body':{'type':Sequelize[_0x558f('0x2')](_0x558f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x558f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x558f('0x5')]('in',_0x558f('0x6')),'defaultValue':_0x558f('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xe60f=['out','TEXT','DATE','sequelize','exports','medium','BOOLEAN'];(function(_0x56b402,_0x3356c2){var _0x5e3dea=function(_0x5b3bf4){while(--_0x5b3bf4){_0x56b402['push'](_0x56b402['shift']());}};_0x5e3dea(++_0x3356c2);}(_0xe60f,0x17d));var _0xfe60=function(_0xb0f226,_0x11877a){_0xb0f226=_0xb0f226-0x0;var _0x1cb4fe=_0xe60f[_0xb0f226];return _0x1cb4fe;};'use strict';var Sequelize=require(_0xfe60('0x0'));module[_0xfe60('0x1')]={'body':{'type':Sequelize['TEXT'](_0xfe60('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xfe60('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xfe60('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xfe60('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0xfe60('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index d814729..53f114e 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 _0xdaa7=['sendStatus','stack','name','send','index','FaxMessage','fieldName','type','key','map','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','rows','params','filtears','includeAll','body','destroy','find','describe','accept','fax','read','readAt','UserId','user','CmContact','get','FaxInteraction','FaxInteractionId','isNil','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','SIP/%s','channel','EventManager','acceptmessage','fax-interactions','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','interface','event','rejectmessage','create','findOne','ContactId','Attachment','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','files','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','end','json','count','offset','limit','Content-Range','reject','save','update'];(function(_0x5096c8,_0x530081){var _0x4c47ca=function(_0x5c17e1){while(--_0x5c17e1){_0x5096c8['push'](_0x5096c8['shift']());}};_0x4c47ca(++_0x530081);}(_0xdaa7,0x154));var _0x7daa=function(_0x3ed054,_0x4d4f16){_0x3ed054=_0x3ed054-0x0;var _0x16dd95=_0xdaa7[_0x3ed054];return _0x16dd95;};'use strict';var pdf=require(_0x7daa('0x0'));var emlformat=require(_0x7daa('0x1'));var rimraf=require(_0x7daa('0x2'));var zipdir=require(_0x7daa('0x3'));var jsonpatch=require(_0x7daa('0x4'));var rp=require(_0x7daa('0x5'));var moment=require('moment');var BPromise=require(_0x7daa('0x6'));var Mustache=require(_0x7daa('0x7'));var util=require(_0x7daa('0x8'));var path=require(_0x7daa('0x9'));var sox=require(_0x7daa('0xa'));var csv=require(_0x7daa('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7daa('0xc'));var crypto=require(_0x7daa('0xd'));var jsforce=require(_0x7daa('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7daa('0xf'));var Redis=require(_0x7daa('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7daa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7daa('0x12'));var logger=require(_0x7daa('0x13'))(_0x7daa('0x14'));var utils=require('../../config/utils');var config=require(_0x7daa('0x15'));var licenseUtil=require(_0x7daa('0x16'));var db=require(_0x7daa('0x17'))['db'];config[_0x7daa('0x18')]=_[_0x7daa('0x19')](config[_0x7daa('0x18')],{'host':_0x7daa('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7daa('0x18')]));require(_0x7daa('0x1b'))[_0x7daa('0x1c')](socket);var jayson=require(_0x7daa('0x1d'));var client=jayson[_0x7daa('0x1e')][_0x7daa('0x1f')]({'port':0x232c});var client9002=jayson[_0x7daa('0x1e')][_0x7daa('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2fd935,_0x209d90,_0x5dd33,_0x1f4c25){return new BPromise(function(_0x198782,_0x535917){var _0x3e0a0b=_0x1f4c25||client;return _0x3e0a0b[_0x7daa('0x20')](_0x2fd935,_0x5dd33)[_0x7daa('0x21')](function(_0xa8d049){logger[_0x7daa('0x22')](_0x7daa('0x23'),_0x209d90,_0x7daa('0x24'));logger[_0x7daa('0x25')](_0x7daa('0x26'),_0x209d90,_0x7daa('0x24'),JSON[_0x7daa('0x27')](_0xa8d049));if(_0xa8d049['error']){if(_0xa8d049['error']['code']===0x1f4){logger[_0x7daa('0x28')]('FaxMessage,\x20%s,\x20%s',_0x209d90,_0xa8d049['error'][_0x7daa('0x29')]);return _0x535917(_0xa8d049[_0x7daa('0x28')][_0x7daa('0x29')]);}logger[_0x7daa('0x28')](_0x7daa('0x23'),_0x209d90,_0xa8d049['error']['message']);return _0x198782(_0xa8d049['error'][_0x7daa('0x29')]);}else{logger[_0x7daa('0x22')](_0x7daa('0x23'),_0x209d90,_0x7daa('0x24'));_0x198782(_0xa8d049['result']['message']);}})[_0x7daa('0x2a')](function(_0x17e40c){logger[_0x7daa('0x28')](_0x7daa('0x23'),_0x209d90,_0x17e40c);_0x535917(_0x17e40c);});});}function respondWithStatusCode(_0xa369e6,_0x193e9a){_0x193e9a=_0x193e9a||0xcc;return function(_0x3ddfb9){if(_0x3ddfb9){return _0xa369e6['sendStatus'](_0x193e9a);}return _0xa369e6[_0x7daa('0x2b')](_0x193e9a)[_0x7daa('0x2c')]();};}function respondWithResult(_0x1ca8ed,_0x5d6aba){_0x5d6aba=_0x5d6aba||0xc8;return function(_0x56cccb){if(_0x56cccb){return _0x1ca8ed['status'](_0x5d6aba)[_0x7daa('0x2d')](_0x56cccb);}};}function respondWithFilteredResult(_0x24201c,_0x52d307){return function(_0x4f21da){if(_0x4f21da){var _0x45bc24=_0x4f21da[_0x7daa('0x2e')],_0x30132f=_0x52d307[_0x7daa('0x2f')],_0x52e5d2=_0x52d307[_0x7daa('0x2f')]+_0x52d307[_0x7daa('0x30')],_0x366ab2;if(_0x52e5d2>=_0x45bc24){_0x52e5d2=_0x45bc24;_0x366ab2=0xc8;}else{_0x366ab2=0xce;}_0x24201c['status'](_0x366ab2);return _0x24201c['set'](_0x7daa('0x31'),_0x30132f+'-'+_0x52e5d2+'/'+_0x45bc24)[_0x7daa('0x2d')](_0x4f21da);}return null;};}function patchUpdates(_0x59a258){return function(_0x5d6696){try{jsonpatch['apply'](_0x5d6696,_0x59a258,!![]);}catch(_0x2176c1){return BPromise[_0x7daa('0x32')](_0x2176c1);}return _0x5d6696[_0x7daa('0x33')]();};}function saveUpdates(_0x4bbae7,_0x5ee1d7){return function(_0x21eac0){if(_0x21eac0){return _0x21eac0[_0x7daa('0x34')](_0x4bbae7)[_0x7daa('0x21')](function(_0x2b2715){return _0x2b2715;});}return null;};}function removeEntity(_0x7dbdfc,_0x221105){return function(_0x189881){if(_0x189881){return _0x189881['destroy']()[_0x7daa('0x21')](function(){_0x7dbdfc['status'](0xcc)[_0x7daa('0x2c')]();});}};}function handleEntityNotFound(_0x2cbe62,_0x1a7c9d){return function(_0x5467b5){if(!_0x5467b5){_0x2cbe62[_0x7daa('0x35')](0x194);}return _0x5467b5;};}function handleError(_0x2d361d,_0x3b0cbc){_0x3b0cbc=_0x3b0cbc||0x1f4;return function(_0x1b5c99){logger[_0x7daa('0x28')](_0x1b5c99[_0x7daa('0x36')]);if(_0x1b5c99[_0x7daa('0x37')]){delete _0x1b5c99[_0x7daa('0x37')];}_0x2d361d[_0x7daa('0x2b')](_0x3b0cbc)[_0x7daa('0x38')](_0x1b5c99);};}exports[_0x7daa('0x39')]=function(_0x2c4795,_0x179f55){var _0x87b046={},_0x42e09f={},_0x34e908={'count':0x0,'rows':[]};var _0x1f1dc6=_['map'](db[_0x7daa('0x3a')]['rawAttributes'],function(_0x4e8f47){return{'name':_0x4e8f47[_0x7daa('0x3b')],'type':_0x4e8f47[_0x7daa('0x3c')][_0x7daa('0x3d')]};});_0x42e09f['model']=_[_0x7daa('0x3e')](_0x1f1dc6,_0x7daa('0x37'));_0x42e09f['query']=_[_0x7daa('0x3f')](_0x2c4795[_0x7daa('0x40')]);_0x42e09f['filters']=_[_0x7daa('0x41')](_0x42e09f['model'],_0x42e09f['query']);_0x87b046[_0x7daa('0x42')]=_['intersection'](_0x42e09f[_0x7daa('0x43')],qs[_0x7daa('0x44')](_0x2c4795[_0x7daa('0x40')][_0x7daa('0x44')]));_0x87b046[_0x7daa('0x42')]=_0x87b046[_0x7daa('0x42')][_0x7daa('0x45')]?_0x87b046[_0x7daa('0x42')]:_0x42e09f[_0x7daa('0x43')];if(!_0x2c4795[_0x7daa('0x40')][_0x7daa('0x46')](_0x7daa('0x47'))){_0x87b046[_0x7daa('0x30')]=qs['limit'](_0x2c4795[_0x7daa('0x40')][_0x7daa('0x30')]);_0x87b046[_0x7daa('0x2f')]=qs[_0x7daa('0x2f')](_0x2c4795[_0x7daa('0x40')][_0x7daa('0x2f')]);}_0x87b046[_0x7daa('0x48')]=qs[_0x7daa('0x49')](_0x2c4795[_0x7daa('0x40')][_0x7daa('0x49')]);_0x87b046[_0x7daa('0x4a')]=qs[_0x7daa('0x4b')](_['pick'](_0x2c4795[_0x7daa('0x40')],_0x42e09f[_0x7daa('0x4b')]),_0x1f1dc6);if(_0x2c4795[_0x7daa('0x40')][_0x7daa('0x4c')]){_0x87b046[_0x7daa('0x4a')]=_[_0x7daa('0x4d')](_0x87b046['where'],{'$or':_['map'](_0x1f1dc6,function(_0x41c3e9){if(_0x41c3e9[_0x7daa('0x3c')]!==_0x7daa('0x4e')){var _0x3054da={};_0x3054da[_0x41c3e9[_0x7daa('0x37')]]={'$like':'%'+_0x2c4795[_0x7daa('0x40')][_0x7daa('0x4c')]+'%'};return _0x3054da;}})});}_0x87b046=_['merge']({},_0x87b046,_0x2c4795[_0x7daa('0x4f')]);var _0x128a66={'where':_0x87b046[_0x7daa('0x4a')]};return db['FaxMessage'][_0x7daa('0x2e')](_0x128a66)[_0x7daa('0x21')](function(_0x4bf9a7){_0x34e908['count']=_0x4bf9a7;if(_0x2c4795[_0x7daa('0x40')]['includeAll']){_0x87b046[_0x7daa('0x50')]=[{'all':!![]}];}return db[_0x7daa('0x3a')]['findAll'](_0x87b046);})[_0x7daa('0x21')](function(_0x3f27c6){_0x34e908[_0x7daa('0x51')]=_0x3f27c6;return _0x34e908;})[_0x7daa('0x21')](respondWithFilteredResult(_0x179f55,_0x87b046))[_0x7daa('0x2a')](handleError(_0x179f55,null));};exports['show']=function(_0x2130ec,_0x12510a){var _0x4f544d={'raw':!![],'where':{'id':_0x2130ec[_0x7daa('0x52')]['id']}},_0x4b710f={};_0x4b710f['model']=_[_0x7daa('0x3f')](db[_0x7daa('0x3a')]['rawAttributes']);_0x4b710f[_0x7daa('0x40')]=_['keys'](_0x2130ec[_0x7daa('0x40')]);_0x4b710f[_0x7daa('0x53')]=_[_0x7daa('0x41')](_0x4b710f[_0x7daa('0x43')],_0x4b710f[_0x7daa('0x40')]);_0x4f544d[_0x7daa('0x42')]=_[_0x7daa('0x41')](_0x4b710f['model'],qs[_0x7daa('0x44')](_0x2130ec[_0x7daa('0x40')][_0x7daa('0x44')]));_0x4f544d[_0x7daa('0x42')]=_0x4f544d[_0x7daa('0x42')]['length']?_0x4f544d[_0x7daa('0x42')]:_0x4b710f[_0x7daa('0x43')];if(_0x2130ec[_0x7daa('0x40')][_0x7daa('0x54')]){_0x4f544d['include']=[{'all':!![]}];}_0x4f544d=_['merge']({},_0x4f544d,_0x2130ec[_0x7daa('0x4f')]);return db['FaxMessage']['find'](_0x4f544d)[_0x7daa('0x21')](handleEntityNotFound(_0x12510a,null))[_0x7daa('0x21')](respondWithResult(_0x12510a,null))[_0x7daa('0x2a')](handleError(_0x12510a,null));};exports[_0x7daa('0x34')]=function(_0x4a2cc3,_0x20dc20){if(_0x4a2cc3[_0x7daa('0x55')]['id']){delete _0x4a2cc3[_0x7daa('0x55')]['id'];}return db[_0x7daa('0x3a')]['find']({'where':{'id':_0x4a2cc3[_0x7daa('0x52')]['id']}})[_0x7daa('0x21')](handleEntityNotFound(_0x20dc20,null))[_0x7daa('0x21')](saveUpdates(_0x4a2cc3[_0x7daa('0x55')],null))[_0x7daa('0x21')](respondWithResult(_0x20dc20,null))[_0x7daa('0x2a')](handleError(_0x20dc20,null));};exports[_0x7daa('0x56')]=function(_0x263f54,_0x53e97e){return db[_0x7daa('0x3a')][_0x7daa('0x57')]({'where':{'id':_0x263f54[_0x7daa('0x52')]['id']}})[_0x7daa('0x21')](handleEntityNotFound(_0x53e97e,null))[_0x7daa('0x21')](removeEntity(_0x53e97e,null))[_0x7daa('0x2a')](handleError(_0x53e97e,null));};exports[_0x7daa('0x58')]=function(_0x1b54b7,_0x2d364e){return db[_0x7daa('0x3a')]['describe']()[_0x7daa('0x21')](respondWithResult(_0x2d364e,null))['catch'](handleError(_0x2d364e,null));};var interaction_log=require(_0x7daa('0x13'))('fax-interactions');exports[_0x7daa('0x59')]=function(_0x5b3811,_0x2ba2db,_0x2fbd76){var _0x5b8d40={'channel':_0x7daa('0x5a')};if(_0x5b3811[_0x7daa('0x55')]['id']){delete _0x5b3811[_0x7daa('0x55')]['id'];}_0x5b3811[_0x7daa('0x55')][_0x7daa('0x5b')]=!![];_0x5b3811[_0x7daa('0x55')][_0x7daa('0x5c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5b3811[_0x7daa('0x55')]['UserId']=_0x5b3811[_0x7daa('0x55')][_0x7daa('0x5d')]||_0x5b3811[_0x7daa('0x5e')]['id'];return db[_0x7daa('0x3a')]['find']({'where':{'id':_0x5b3811[_0x7daa('0x52')]['id'],'UserId':null},'include':[{'model':db[_0x7daa('0x5f')],'as':'Contact'}]})[_0x7daa('0x21')](handleEntityNotFound(_0x2ba2db,null))[_0x7daa('0x21')](saveUpdates(_0x5b3811[_0x7daa('0x55')],null))[_0x7daa('0x21')](function(_0x4c0f4a){if(_0x4c0f4a){_0x5b8d40['message']=_0x4c0f4a[_0x7daa('0x60')]({'plain':!![]});return db[_0x7daa('0x61')]['find']({'where':{'id':_0x4c0f4a[_0x7daa('0x62')]}});}return null;})[_0x7daa('0x21')](handleEntityNotFound(_0x2ba2db,null))[_0x7daa('0x21')](function(_0x2f5df1){if(_0x2f5df1){return _0x2f5df1[_0x7daa('0x34')]({'UserId':_0x5b3811['body']['UserId'],'read1stAt':_[_0x7daa('0x63')](_0x2f5df1['read1stAt'])?moment()[_0x7daa('0x64')](_0x7daa('0x65')):undefined});}return null;})[_0x7daa('0x21')](function(_0x529982){if(_0x529982){_0x5b8d40[_0x7daa('0x66')]=_0x529982[_0x7daa('0x60')]({'plain':!![]});interaction_log[_0x7daa('0x22')](_0x7daa('0x67'),_0x5b3811[_0x7daa('0x5e')]['id'],_0x5b3811[_0x7daa('0x5e')][_0x7daa('0x37')],_0x5b3811[_0x7daa('0x5e')][_0x7daa('0x68')],_0x5b8d40[_0x7daa('0x66')]['id'],_0x5b3811[_0x7daa('0x55')]?JSON[_0x7daa('0x27')](_0x5b3811[_0x7daa('0x55')]):'null');return respondWithRpcPromise(_0x7daa('0x69'),'acceptMessage',_0x5b8d40);}return null;})[_0x7daa('0x21')](function(_0x3927a3){if(_0x3927a3){if(_0x5b3811['body']['manual']){_0x5b8d40[_0x7daa('0x29')]['interface']=util[_0x7daa('0x64')](_0x7daa('0x6a'),_0x5b3811[_0x7daa('0x5e')][_0x7daa('0x37')]);_0x5b8d40['message'][_0x7daa('0x6b')]=_0x5b8d40[_0x7daa('0x6b')];_0x5b8d40[_0x7daa('0x29')]['event']='accept';return respondWithRpcPromise(_0x7daa('0x6c'),_0x7daa('0x6c'),{'event':_0x7daa('0x6d'),'message':_0x5b8d40[_0x7daa('0x29')]},client9002)[_0x7daa('0x21')](function(){return _0x5b8d40;});}return _0x5b8d40;}return null;})['then'](respondWithResult(_0x2ba2db,null))['catch'](handleError(_0x2ba2db,null));};var interaction_log=require(_0x7daa('0x13'))(_0x7daa('0x6e'));exports[_0x7daa('0x32')]=function(_0x46c402,_0xefaa08,_0x5beeae){var _0x3015de={'agent':{},'channel':_0x7daa('0x5a')};if(_0x46c402[_0x7daa('0x55')]['id']){delete _0x46c402[_0x7daa('0x55')]['id'];}_0x46c402['body'][_0x7daa('0x5d')]=_0x46c402[_0x7daa('0x55')][_0x7daa('0x5d')]||_0x46c402[_0x7daa('0x5e')]['id'];_0x3015de[_0x7daa('0x6f')]['id']=_0x46c402[_0x7daa('0x55')][_0x7daa('0x5d')];return db[_0x7daa('0x3a')][_0x7daa('0x57')]({'where':{'id':_0x46c402['params']['id'],'UserId':null}})[_0x7daa('0x21')](handleEntityNotFound(_0xefaa08,null))['then'](function(_0x433d96){if(_0x433d96){_0x3015de[_0x7daa('0x29')]=_0x433d96[_0x7daa('0x60')]({'plain':!![]});return db[_0x7daa('0x61')]['find']({'where':{'id':_0x433d96[_0x7daa('0x62')]}});}return null;})[_0x7daa('0x21')](handleEntityNotFound(_0xefaa08,null))[_0x7daa('0x21')](function(_0x2112a7){if(_0x2112a7){_0x3015de['interaction']=_0x2112a7[_0x7daa('0x60')]({'plain':!![]});interaction_log[_0x7daa('0x22')](_0x7daa('0x70'),_0x46c402[_0x7daa('0x5e')]['id'],_0x46c402['user'][_0x7daa('0x37')],_0x46c402[_0x7daa('0x5e')][_0x7daa('0x68')],_0x3015de[_0x7daa('0x66')]['id'],_0x46c402[_0x7daa('0x55')]?JSON[_0x7daa('0x27')](_0x46c402[_0x7daa('0x55')]):_0x7daa('0x71'));return respondWithRpcPromise(_0x7daa('0x72'),_0x7daa('0x73'),_0x3015de);}return null;})[_0x7daa('0x21')](function(_0x45fd1e){if(_0x45fd1e){_0x45fd1e[_0x7daa('0x29')][_0x7daa('0x74')]=util['format']('SIP/%s',_0x46c402[_0x7daa('0x5e')][_0x7daa('0x37')]);_0x45fd1e[_0x7daa('0x29')][_0x7daa('0x6b')]=_0x3015de['channel'];_0x45fd1e[_0x7daa('0x29')][_0x7daa('0x75')]=_0x7daa('0x32');respondWithRpcPromise(_0x7daa('0x6c'),_0x7daa('0x6c'),{'event':_0x7daa('0x76'),'message':_0x45fd1e[_0x7daa('0x29')]},client9002);return _0x3015de;}return null;})[_0x7daa('0x21')](respondWithResult(_0xefaa08,null))[_0x7daa('0x2a')](handleError(_0xefaa08,null));};exports[_0x7daa('0x77')]=function(_0x5593fa,_0x4b0086){var _0x296ed5;return db[_0x7daa('0x3a')][_0x7daa('0x77')](_0x5593fa[_0x7daa('0x55')],{})[_0x7daa('0x21')](function(_0x447eef){_0x296ed5=_0x447eef;return db[_0x7daa('0x5f')][_0x7daa('0x78')]({'where':{'id':_0x296ed5[_0x7daa('0x79')]}});})[_0x7daa('0x21')](function(_0x4e937f){if(_[_0x7daa('0x63')](_0x4e937f)){return;}else{_0x296ed5['fax']=_0x4e937f[_0x7daa('0x5a')];return db[_0x7daa('0x7a')]['findOne']({'where':{'id':_0x296ed5['AttachmentId']}});}})['then'](function(_0x2a1e58){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x7daa('0x63')](_0x5593fa['body'])?undefined:_0x5593fa[_0x7daa('0x55')][_0x7daa('0x7b')],'path':_[_0x7daa('0x63')](_0x2a1e58)?undefined:util[_0x7daa('0x64')](_0x7daa('0x7c'),_0x2a1e58[_0x7daa('0x7d')]),'fax':_[_0x7daa('0x63')](_0x296ed5[_0x7daa('0x5a')])?undefined:_0x296ed5[_0x7daa('0x5a')],'AttachmentId':_0x296ed5[_0x7daa('0x7e')]},client9002);})['then'](respondWithResult(_0x4b0086,0xc9))[_0x7daa('0x2a')](handleError(_0x4b0086,null));};exports[_0x7daa('0x7f')]=function(_0x441f3d,_0x4be36c){var _0x27c84d=path[_0x7daa('0x80')](config[_0x7daa('0x81')],'server',_0x7daa('0x82'),'attachments');return db['FaxMessage'][_0x7daa('0x57')]({'where':{'id':_0x441f3d[_0x7daa('0x52')]['id']},'include':[{'model':db[_0x7daa('0x7a')],'as':_0x7daa('0x7a')}]})[_0x7daa('0x21')](handleEntityNotFound(_0x4be36c,null))['then'](function(_0x2df248){if(_0x2df248){return _0x4be36c[_0x7daa('0x7f')](path[_0x7daa('0x80')](_0x27c84d,_0x2df248[_0x7daa('0x7a')]['basename']));}})['catch'](handleError(_0x4be36c,null));}; \ No newline at end of file +var _0x59c4=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./faxMessage.socket','register','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','count','offset','limit','set','reject','save','update','destroy','end','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','describe','fax-interactions','accept','fax','body','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','FaxInteraction','FaxInteractionId','interaction','user','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectmessage','create','findOne','ContactId','isNil','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','AttachmentId','join','root','attachments','download','basename','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x59c4,0x79));var _0x459c=function(_0x320542,_0x3bcd84){_0x320542=_0x320542-0x0;var _0x54a0ff=_0x59c4[_0x320542];return _0x54a0ff;};'use strict';var pdf=require(_0x459c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x459c('0x1'));var zipdir=require(_0x459c('0x2'));var jsonpatch=require(_0x459c('0x3'));var rp=require(_0x459c('0x4'));var moment=require(_0x459c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x459c('0x6'));var util=require(_0x459c('0x7'));var path=require(_0x459c('0x8'));var sox=require(_0x459c('0x9'));var csv=require(_0x459c('0xa'));var ejs=require(_0x459c('0xb'));var fs=require('fs');var _=require(_0x459c('0xc'));var squel=require(_0x459c('0xd'));var crypto=require(_0x459c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x459c('0xf'));var toCsv=require(_0x459c('0xa'));var querystring=require(_0x459c('0x10'));var Papa=require(_0x459c('0x11'));var Redis=require(_0x459c('0x12'));var authService=require(_0x459c('0x13'));var qs=require(_0x459c('0x14'));var as=require(_0x459c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x459c('0x16'))('api');var utils=require(_0x459c('0x17'));var config=require(_0x459c('0x18'));var licenseUtil=require(_0x459c('0x19'));var db=require(_0x459c('0x1a'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x459c('0x1b'),'port':0x18eb});var socket=require(_0x459c('0x1c'))(new Redis(config[_0x459c('0x1d')]));require(_0x459c('0x1e'))[_0x459c('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x459c('0x20')][_0x459c('0x21')]({'port':0x232c});var client9002=jayson[_0x459c('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5aa10a,_0x176c37,_0x31e6f3,_0x33feff){return new BPromise(function(_0x519eee,_0x3b743a){var _0x2a308d=_0x33feff||client;return _0x2a308d[_0x459c('0x22')](_0x5aa10a,_0x31e6f3)[_0x459c('0x23')](function(_0x380f4f){logger[_0x459c('0x24')](_0x459c('0x25'),_0x176c37,_0x459c('0x26'));logger[_0x459c('0x27')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x176c37,_0x459c('0x26'),JSON[_0x459c('0x28')](_0x380f4f));if(_0x380f4f[_0x459c('0x29')]){if(_0x380f4f[_0x459c('0x29')]['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x176c37,_0x380f4f[_0x459c('0x29')]['message']);return _0x3b743a(_0x380f4f[_0x459c('0x29')][_0x459c('0x2a')]);}logger[_0x459c('0x29')](_0x459c('0x25'),_0x176c37,_0x380f4f[_0x459c('0x29')][_0x459c('0x2a')]);return _0x519eee(_0x380f4f[_0x459c('0x29')]['message']);}else{logger[_0x459c('0x24')](_0x459c('0x25'),_0x176c37,_0x459c('0x26'));_0x519eee(_0x380f4f[_0x459c('0x2b')][_0x459c('0x2a')]);}})[_0x459c('0x2c')](function(_0x3c556b){logger[_0x459c('0x29')]('FaxMessage,\x20%s,\x20%s',_0x176c37,_0x3c556b);_0x3b743a(_0x3c556b);});});}function respondWithStatusCode(_0xc3af8,_0x1c3a40){_0x1c3a40=_0x1c3a40||0xcc;return function(_0x11bc6e){if(_0x11bc6e){return _0xc3af8[_0x459c('0x2d')](_0x1c3a40);}return _0xc3af8['status'](_0x1c3a40)['end']();};}function respondWithResult(_0x269f59,_0x1758d6){_0x1758d6=_0x1758d6||0xc8;return function(_0x52c2cd){if(_0x52c2cd){return _0x269f59[_0x459c('0x2e')](_0x1758d6)['json'](_0x52c2cd);}};}function respondWithFilteredResult(_0x331a6f,_0xf5dfb3){return function(_0x4a9762){if(_0x4a9762){var _0x39e143=_0x4a9762[_0x459c('0x2f')],_0x1041f9=_0xf5dfb3[_0x459c('0x30')],_0x12637d=_0xf5dfb3[_0x459c('0x30')]+_0xf5dfb3[_0x459c('0x31')],_0x5267ef;if(_0x12637d>=_0x39e143){_0x12637d=_0x39e143;_0x5267ef=0xc8;}else{_0x5267ef=0xce;}_0x331a6f[_0x459c('0x2e')](_0x5267ef);return _0x331a6f[_0x459c('0x32')]('Content-Range',_0x1041f9+'-'+_0x12637d+'/'+_0x39e143)['json'](_0x4a9762);}return null;};}function patchUpdates(_0x21f431){return function(_0x44f41b){try{jsonpatch['apply'](_0x44f41b,_0x21f431,!![]);}catch(_0xd16922){return BPromise[_0x459c('0x33')](_0xd16922);}return _0x44f41b[_0x459c('0x34')]();};}function saveUpdates(_0x592131,_0x3eb9e1){return function(_0x299880){if(_0x299880){return _0x299880[_0x459c('0x35')](_0x592131)[_0x459c('0x23')](function(_0x4529b1){return _0x4529b1;});}return null;};}function removeEntity(_0x490b9a,_0x3bbf7c){return function(_0x48e59c){if(_0x48e59c){return _0x48e59c[_0x459c('0x36')]()[_0x459c('0x23')](function(){_0x490b9a[_0x459c('0x2e')](0xcc)[_0x459c('0x37')]();});}};}function handleEntityNotFound(_0x784ad7,_0x4a65cc){return function(_0x102786){if(!_0x102786){_0x784ad7['sendStatus'](0x194);}return _0x102786;};}function handleError(_0x8aa792,_0x1480a5){_0x1480a5=_0x1480a5||0x1f4;return function(_0x5e8f59){logger[_0x459c('0x29')](_0x5e8f59[_0x459c('0x38')]);if(_0x5e8f59[_0x459c('0x39')]){delete _0x5e8f59['name'];}_0x8aa792[_0x459c('0x2e')](_0x1480a5)[_0x459c('0x3a')](_0x5e8f59);};}exports[_0x459c('0x3b')]=function(_0xdb3cdc,_0x2a56ed){var _0x4d13e5={},_0x150ffb={},_0x2e2f5c={'count':0x0,'rows':[]};var _0x50ef12=_[_0x459c('0x3c')](db[_0x459c('0x3d')][_0x459c('0x3e')],function(_0x575120){return{'name':_0x575120[_0x459c('0x3f')],'type':_0x575120[_0x459c('0x40')][_0x459c('0x41')]};});_0x150ffb[_0x459c('0x42')]=_[_0x459c('0x3c')](_0x50ef12,_0x459c('0x39'));_0x150ffb[_0x459c('0x43')]=_[_0x459c('0x44')](_0xdb3cdc[_0x459c('0x43')]);_0x150ffb['filters']=_[_0x459c('0x45')](_0x150ffb[_0x459c('0x42')],_0x150ffb['query']);_0x4d13e5[_0x459c('0x46')]=_[_0x459c('0x45')](_0x150ffb[_0x459c('0x42')],qs[_0x459c('0x47')](_0xdb3cdc[_0x459c('0x43')]['fields']));_0x4d13e5[_0x459c('0x46')]=_0x4d13e5['attributes'][_0x459c('0x48')]?_0x4d13e5[_0x459c('0x46')]:_0x150ffb[_0x459c('0x42')];if(!_0xdb3cdc[_0x459c('0x43')][_0x459c('0x49')](_0x459c('0x4a'))){_0x4d13e5[_0x459c('0x31')]=qs[_0x459c('0x31')](_0xdb3cdc[_0x459c('0x43')][_0x459c('0x31')]);_0x4d13e5[_0x459c('0x30')]=qs[_0x459c('0x30')](_0xdb3cdc[_0x459c('0x43')][_0x459c('0x30')]);}_0x4d13e5[_0x459c('0x4b')]=qs[_0x459c('0x4c')](_0xdb3cdc['query'][_0x459c('0x4c')]);_0x4d13e5[_0x459c('0x4d')]=qs[_0x459c('0x4e')](_[_0x459c('0x4f')](_0xdb3cdc[_0x459c('0x43')],_0x150ffb['filters']),_0x50ef12);if(_0xdb3cdc[_0x459c('0x43')][_0x459c('0x50')]){_0x4d13e5[_0x459c('0x4d')]=_[_0x459c('0x51')](_0x4d13e5[_0x459c('0x4d')],{'$or':_['map'](_0x50ef12,function(_0x41cc18){if(_0x41cc18[_0x459c('0x40')]!==_0x459c('0x52')){var _0x3a19d6={};_0x3a19d6[_0x41cc18[_0x459c('0x39')]]={'$like':'%'+_0xdb3cdc[_0x459c('0x43')][_0x459c('0x50')]+'%'};return _0x3a19d6;}})});}_0x4d13e5=_['merge']({},_0x4d13e5,_0xdb3cdc[_0x459c('0x53')]);var _0x153767={'where':_0x4d13e5['where']};return db[_0x459c('0x3d')][_0x459c('0x2f')](_0x153767)[_0x459c('0x23')](function(_0x163e66){_0x2e2f5c[_0x459c('0x2f')]=_0x163e66;if(_0xdb3cdc[_0x459c('0x43')][_0x459c('0x54')]){_0x4d13e5[_0x459c('0x55')]=[{'all':!![]}];}return db[_0x459c('0x3d')][_0x459c('0x56')](_0x4d13e5);})[_0x459c('0x23')](function(_0x4a8ddd){_0x2e2f5c['rows']=_0x4a8ddd;return _0x2e2f5c;})[_0x459c('0x23')](respondWithFilteredResult(_0x2a56ed,_0x4d13e5))[_0x459c('0x2c')](handleError(_0x2a56ed,null));};exports[_0x459c('0x57')]=function(_0x41506f,_0x109d45){var _0x1c2117={'raw':!![],'where':{'id':_0x41506f[_0x459c('0x58')]['id']}},_0x5c3cd9={};_0x5c3cd9[_0x459c('0x42')]=_[_0x459c('0x44')](db[_0x459c('0x3d')][_0x459c('0x3e')]);_0x5c3cd9['query']=_[_0x459c('0x44')](_0x41506f[_0x459c('0x43')]);_0x5c3cd9['filtears']=_[_0x459c('0x45')](_0x5c3cd9[_0x459c('0x42')],_0x5c3cd9[_0x459c('0x43')]);_0x1c2117[_0x459c('0x46')]=_[_0x459c('0x45')](_0x5c3cd9[_0x459c('0x42')],qs[_0x459c('0x47')](_0x41506f[_0x459c('0x43')][_0x459c('0x47')]));_0x1c2117[_0x459c('0x46')]=_0x1c2117[_0x459c('0x46')]['length']?_0x1c2117[_0x459c('0x46')]:_0x5c3cd9[_0x459c('0x42')];if(_0x41506f[_0x459c('0x43')][_0x459c('0x54')]){_0x1c2117[_0x459c('0x55')]=[{'all':!![]}];}_0x1c2117=_[_0x459c('0x51')]({},_0x1c2117,_0x41506f['options']);return db['FaxMessage']['find'](_0x1c2117)[_0x459c('0x23')](handleEntityNotFound(_0x109d45,null))[_0x459c('0x23')](respondWithResult(_0x109d45,null))[_0x459c('0x2c')](handleError(_0x109d45,null));};exports[_0x459c('0x35')]=function(_0x5de278,_0x1adbf1){if(_0x5de278['body']['id']){delete _0x5de278['body']['id'];}return db[_0x459c('0x3d')][_0x459c('0x59')]({'where':{'id':_0x5de278[_0x459c('0x58')]['id']}})[_0x459c('0x23')](handleEntityNotFound(_0x1adbf1,null))[_0x459c('0x23')](saveUpdates(_0x5de278['body'],null))[_0x459c('0x23')](respondWithResult(_0x1adbf1,null))[_0x459c('0x2c')](handleError(_0x1adbf1,null));};exports['destroy']=function(_0x468266,_0x44ca6d){return db[_0x459c('0x3d')][_0x459c('0x59')]({'where':{'id':_0x468266['params']['id']}})[_0x459c('0x23')](handleEntityNotFound(_0x44ca6d,null))[_0x459c('0x23')](removeEntity(_0x44ca6d,null))[_0x459c('0x2c')](handleError(_0x44ca6d,null));};exports[_0x459c('0x5a')]=function(_0x39db62,_0x5ebe56){return db[_0x459c('0x3d')][_0x459c('0x5a')]()[_0x459c('0x23')](respondWithResult(_0x5ebe56,null))[_0x459c('0x2c')](handleError(_0x5ebe56,null));};var interaction_log=require(_0x459c('0x16'))(_0x459c('0x5b'));exports[_0x459c('0x5c')]=function(_0x3c3f0c,_0x3fc71e,_0x4f681d){var _0x4fb569={'channel':_0x459c('0x5d')};if(_0x3c3f0c[_0x459c('0x5e')]['id']){delete _0x3c3f0c[_0x459c('0x5e')]['id'];}_0x3c3f0c[_0x459c('0x5e')][_0x459c('0x5f')]=!![];_0x3c3f0c[_0x459c('0x5e')][_0x459c('0x60')]=moment()[_0x459c('0x61')](_0x459c('0x62'));_0x3c3f0c['body']['UserId']=_0x3c3f0c[_0x459c('0x5e')][_0x459c('0x63')]||_0x3c3f0c['user']['id'];return db[_0x459c('0x3d')][_0x459c('0x59')]({'where':{'id':_0x3c3f0c['params']['id'],'UserId':null},'include':[{'model':db[_0x459c('0x64')],'as':_0x459c('0x65')}]})[_0x459c('0x23')](handleEntityNotFound(_0x3fc71e,null))[_0x459c('0x23')](saveUpdates(_0x3c3f0c[_0x459c('0x5e')],null))[_0x459c('0x23')](function(_0x1283a3){if(_0x1283a3){_0x4fb569[_0x459c('0x2a')]=_0x1283a3[_0x459c('0x66')]({'plain':!![]});return db[_0x459c('0x67')][_0x459c('0x59')]({'where':{'id':_0x1283a3[_0x459c('0x68')]}});}return null;})[_0x459c('0x23')](handleEntityNotFound(_0x3fc71e,null))[_0x459c('0x23')](function(_0x131d5c){if(_0x131d5c){return _0x131d5c[_0x459c('0x35')]({'UserId':_0x3c3f0c[_0x459c('0x5e')]['UserId'],'read1stAt':_['isNil'](_0x131d5c['read1stAt'])?moment()[_0x459c('0x61')](_0x459c('0x62')):undefined});}return null;})[_0x459c('0x23')](function(_0x1046db){if(_0x1046db){_0x4fb569[_0x459c('0x69')]=_0x1046db['get']({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3c3f0c[_0x459c('0x6a')]['id'],_0x3c3f0c['user']['name'],_0x3c3f0c[_0x459c('0x6a')][_0x459c('0x6b')],_0x4fb569[_0x459c('0x69')]['id'],_0x3c3f0c[_0x459c('0x5e')]?JSON[_0x459c('0x28')](_0x3c3f0c[_0x459c('0x5e')]):_0x459c('0x6c'));return respondWithRpcPromise(_0x459c('0x6d'),_0x459c('0x6e'),_0x4fb569);}return null;})['then'](function(_0x13034a){if(_0x13034a){if(_0x3c3f0c[_0x459c('0x5e')][_0x459c('0x6f')]){_0x4fb569['message'][_0x459c('0x70')]=util[_0x459c('0x61')](_0x459c('0x71'),_0x3c3f0c['user'][_0x459c('0x39')]);_0x4fb569[_0x459c('0x2a')][_0x459c('0x72')]=_0x4fb569[_0x459c('0x72')];_0x4fb569['message'][_0x459c('0x73')]=_0x459c('0x5c');return respondWithRpcPromise(_0x459c('0x74'),_0x459c('0x74'),{'event':_0x459c('0x75'),'message':_0x4fb569[_0x459c('0x2a')]},client9002)[_0x459c('0x23')](function(){return _0x4fb569;});}return _0x4fb569;}return null;})[_0x459c('0x23')](respondWithResult(_0x3fc71e,null))[_0x459c('0x2c')](handleError(_0x3fc71e,null));};var interaction_log=require(_0x459c('0x16'))(_0x459c('0x5b'));exports[_0x459c('0x33')]=function(_0x366319,_0x57d377,_0x2c08d4){var _0xadc799={'agent':{},'channel':'fax'};if(_0x366319[_0x459c('0x5e')]['id']){delete _0x366319[_0x459c('0x5e')]['id'];}_0x366319[_0x459c('0x5e')][_0x459c('0x63')]=_0x366319[_0x459c('0x5e')]['UserId']||_0x366319[_0x459c('0x6a')]['id'];_0xadc799[_0x459c('0x76')]['id']=_0x366319['body']['UserId'];return db[_0x459c('0x3d')]['find']({'where':{'id':_0x366319['params']['id'],'UserId':null}})[_0x459c('0x23')](handleEntityNotFound(_0x57d377,null))[_0x459c('0x23')](function(_0x56aee2){if(_0x56aee2){_0xadc799[_0x459c('0x2a')]=_0x56aee2[_0x459c('0x66')]({'plain':!![]});return db['FaxInteraction'][_0x459c('0x59')]({'where':{'id':_0x56aee2[_0x459c('0x68')]}});}return null;})[_0x459c('0x23')](handleEntityNotFound(_0x57d377,null))['then'](function(_0x495594){if(_0x495594){_0xadc799[_0x459c('0x69')]=_0x495594[_0x459c('0x66')]({'plain':!![]});interaction_log[_0x459c('0x24')](_0x459c('0x77'),_0x366319[_0x459c('0x6a')]['id'],_0x366319['user'][_0x459c('0x39')],_0x366319['user'][_0x459c('0x6b')],_0xadc799[_0x459c('0x69')]['id'],_0x366319[_0x459c('0x5e')]?JSON[_0x459c('0x28')](_0x366319[_0x459c('0x5e')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0xadc799);}return null;})[_0x459c('0x23')](function(_0x3d70c7){if(_0x3d70c7){_0x3d70c7[_0x459c('0x2a')][_0x459c('0x70')]=util['format'](_0x459c('0x71'),_0x366319[_0x459c('0x6a')][_0x459c('0x39')]);_0x3d70c7['message'][_0x459c('0x72')]=_0xadc799['channel'];_0x3d70c7[_0x459c('0x2a')][_0x459c('0x73')]='reject';respondWithRpcPromise('EventManager',_0x459c('0x74'),{'event':_0x459c('0x78'),'message':_0x3d70c7['message']},client9002);return _0xadc799;}return null;})['then'](respondWithResult(_0x57d377,null))[_0x459c('0x2c')](handleError(_0x57d377,null));};exports['create']=function(_0x1cdea6,_0x373563){var _0x106943;return db[_0x459c('0x3d')][_0x459c('0x79')](_0x1cdea6[_0x459c('0x5e')],{})[_0x459c('0x23')](function(_0x1dd43a){_0x106943=_0x1dd43a;return db[_0x459c('0x64')][_0x459c('0x7a')]({'where':{'id':_0x106943[_0x459c('0x7b')]}});})['then'](function(_0xe2db34){if(_[_0x459c('0x7c')](_0xe2db34)){return;}else{_0x106943[_0x459c('0x5d')]=_0xe2db34[_0x459c('0x5d')];return db[_0x459c('0x7d')][_0x459c('0x7a')]({'where':{'id':_0x106943['AttachmentId']}});}})['then'](function(_0x2a4063){return respondWithRpcPromise(_0x459c('0x7e'),'SendFax',{'FaxAccountId':_[_0x459c('0x7c')](_0x1cdea6[_0x459c('0x5e')])?undefined:_0x1cdea6[_0x459c('0x5e')][_0x459c('0x7f')],'path':_[_0x459c('0x7c')](_0x2a4063)?undefined:util['format'](_0x459c('0x80'),_0x2a4063['basename']),'fax':_[_0x459c('0x7c')](_0x106943['fax'])?undefined:_0x106943[_0x459c('0x5d')],'AttachmentId':_0x106943[_0x459c('0x81')]},client9002);})['then'](respondWithResult(_0x373563,0xc9))[_0x459c('0x2c')](handleError(_0x373563,null));};exports['download']=function(_0x5c2388,_0x354d42){var _0x38fd65=path[_0x459c('0x82')](config[_0x459c('0x83')],'server','files',_0x459c('0x84'));return db[_0x459c('0x3d')][_0x459c('0x59')]({'where':{'id':_0x5c2388[_0x459c('0x58')]['id']},'include':[{'model':db['Attachment'],'as':_0x459c('0x7d')}]})[_0x459c('0x23')](handleEntityNotFound(_0x354d42,null))[_0x459c('0x23')](function(_0x51e51f){if(_0x51e51f){return _0x354d42[_0x459c('0x85')](path[_0x459c('0x82')](_0x38fd65,_0x51e51f[_0x459c('0x7d')][_0x459c('0x86')]));}})[_0x459c('0x2c')](handleError(_0x354d42,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 70d4919..3be8fc4 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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x501697,_0x1da1e4){var _0x272971=function(_0x31a9e1){while(--_0x31a9e1){_0x501697['push'](_0x501697['shift']());}};_0x272971(++_0x1da1e4);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x7995('0x0'));var FaxMessage=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){FaxMessageEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);FaxMessageEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];FaxMessage[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update','remove'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x34e8,0x12c));var _0x834e=function(_0x441944,_0x379098){_0x441944=_0x441944-0x0;var _0x1831b0=_0x34e8[_0x441944];return _0x1831b0;};'use strict';var EventEmitter=require(_0x834e('0x0'));var FaxMessage=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){FaxMessageEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);FaxMessageEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 0c11700..648b3f2 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 _0xa5bb=['findOne','FaxInteractionId','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction'];(function(_0x122e9b,_0x391bf4){var _0x22c247=function(_0x1b2c65){while(--_0x1b2c65){_0x122e9b['push'](_0x122e9b['shift']());}};_0x22c247(++_0x391bf4);}(_0xa5bb,0xd1));var _0xba5b=function(_0x4b0083,_0x38acca){_0x4b0083=_0x4b0083-0x0;var _0x305b3d=_0xa5bb[_0x4b0083];return _0x305b3d;};'use strict';var _=require('lodash');var util=require(_0xba5b('0x0'));var logger=require(_0xba5b('0x1'))(_0xba5b('0x2'));var moment=require(_0xba5b('0x3'));var BPromise=require(_0xba5b('0x4'));var rp=require(_0xba5b('0x5'));var fs=require('fs');var path=require(_0xba5b('0x6'));var rimraf=require('rimraf');var config=require(_0xba5b('0x7'));var attributes=require(_0xba5b('0x8'));module[_0xba5b('0x9')]=function(_0x2427c0,_0x261c34){return _0x2427c0[_0xba5b('0xa')](_0xba5b('0xb'),attributes,{'tableName':_0xba5b('0xc'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0xba5b('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x526eb7,_0x11c83a,_0x517de5){var _0x17a105=_0x2427c0[_0xba5b('0xe')];var _0x317d6b=_0x526eb7[_0xba5b('0xf')]({'plain':!![]});if(_0x317d6b[_0xba5b('0x10')][_0xba5b('0x11')]()==='in'||_0x317d6b[_0xba5b('0x10')][_0xba5b('0x11')]()===_0xba5b('0x12')&&!_0x317d6b[_0xba5b('0x13')]&&!_[_0xba5b('0x14')](_0x317d6b[_0xba5b('0x15')])){_0x17a105[_0xba5b('0x16')][_0xba5b('0x17')]({'where':{'id':_0x317d6b[_0xba5b('0x18')]}})['then'](function(_0x24c11a){if(_0x24c11a){_0x24c11a['update']({'lastMsgAt':_0x317d6b[_0xba5b('0x19')],'lastMsgDirection':_0x317d6b['direction']['toLowerCase']()});}})[_0xba5b('0x1a')](function(_0x3ea286){console['error'](_0x3ea286);});}_0x517de5();}},'charset':_0xba5b('0x1b'),'collate':_0xba5b('0x1c')});}; \ No newline at end of file +var _0xd000=['FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','models','get','direction','toLowerCase','secret','UserId','FaxInteraction'];(function(_0x1fbd46,_0x7fccbb){var _0x2a4158=function(_0x265e8b){while(--_0x265e8b){_0x1fbd46['push'](_0x1fbd46['shift']());}};_0x2a4158(++_0x7fccbb);}(_0xd000,0x1ac));var _0x0d00=function(_0x5c5daf,_0x4caf37){_0x5c5daf=_0x5c5daf-0x0;var _0x25fa5f=_0xd000[_0x5c5daf];return _0x25fa5f;};'use strict';var _=require('lodash');var util=require(_0x0d00('0x0'));var logger=require(_0x0d00('0x1'))(_0x0d00('0x2'));var moment=require('moment');var BPromise=require(_0x0d00('0x3'));var rp=require(_0x0d00('0x4'));var fs=require('fs');var path=require(_0x0d00('0x5'));var rimraf=require('rimraf');var config=require(_0x0d00('0x6'));var attributes=require(_0x0d00('0x7'));module[_0x0d00('0x8')]=function(_0x39e85b,_0xcf86a4){return _0x39e85b['define'](_0x0d00('0x9'),attributes,{'tableName':_0x0d00('0xa'),'paranoid':![],'indexes':[{'name':_0x0d00('0xb'),'fields':[_0x0d00('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x541b98,_0x23b162,_0x4ba310){var _0x13bf43=_0x39e85b[_0x0d00('0xd')];var _0x2a91aa=_0x541b98[_0x0d00('0xe')]({'plain':!![]});if(_0x2a91aa[_0x0d00('0xf')][_0x0d00('0x10')]()==='in'||_0x2a91aa['direction'][_0x0d00('0x10')]()==='out'&&!_0x2a91aa[_0x0d00('0x11')]&&!_['isNil'](_0x2a91aa[_0x0d00('0x12')])){_0x13bf43[_0x0d00('0x13')]['findOne']({'where':{'id':_0x2a91aa[_0x0d00('0x14')]}})[_0x0d00('0x15')](function(_0x409a06){if(_0x409a06){_0x409a06[_0x0d00('0x16')]({'lastMsgAt':_0x2a91aa[_0x0d00('0x17')],'lastMsgDirection':_0x2a91aa['direction'][_0x0d00('0x10')]()});}})[_0x0d00('0x18')](function(_0x814497){console[_0x0d00('0x19')](_0x814497);});}_0x4ba310();}},'charset':_0x0d00('0x1a'),'collate':_0x0d00('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index ddd7c22..4dcca7c 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 _0x8fea=['where','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateFaxMessage','FaxMessage','create','options','raw','UpdateFaxMessage','update'];(function(_0x37f5a1,_0x461925){var _0x3a97a5=function(_0x11f158){while(--_0x11f158){_0x37f5a1['push'](_0x37f5a1['shift']());}};_0x3a97a5(++_0x461925);}(_0x8fea,0x132));var _0xa8fe=function(_0xc25778,_0xf5d1f6){_0xc25778=_0xc25778-0x0;var _0x314223=_0x8fea[_0xc25778];return _0x314223;};'use strict';var _=require(_0xa8fe('0x0'));var util=require(_0xa8fe('0x1'));var moment=require('moment');var BPromise=require(_0xa8fe('0x2'));var rs=require(_0xa8fe('0x3'));var fs=require('fs');var Redis=require(_0xa8fe('0x4'));var db=require(_0xa8fe('0x5'))['db'];var utils=require(_0xa8fe('0x6'));var logger=require(_0xa8fe('0x7'))(_0xa8fe('0x8'));var config=require(_0xa8fe('0x9'));var jayson=require(_0xa8fe('0xa'));var client=jayson['client'][_0xa8fe('0xb')]({'port':0x232a});config[_0xa8fe('0xc')]=_[_0xa8fe('0xd')](config['redis'],{'host':_0xa8fe('0xe'),'port':0x18eb});var socket=require(_0xa8fe('0xf'))(new Redis(config[_0xa8fe('0xc')]));require(_0xa8fe('0x10'))['register'](socket);function respondWithRpcPromise(_0x7b620a,_0x32d9e4,_0x32ac56){return new BPromise(function(_0x2bf1cd,_0x91b113){return client[_0xa8fe('0x11')](_0x7b620a,_0x32ac56)[_0xa8fe('0x12')](function(_0x3c10cd){logger[_0xa8fe('0x13')](_0xa8fe('0x14'),_0x32d9e4,_0xa8fe('0x15'));logger[_0xa8fe('0x16')](_0xa8fe('0x17'),_0x32d9e4,_0xa8fe('0x15'),JSON[_0xa8fe('0x18')](_0x3c10cd));if(_0x3c10cd[_0xa8fe('0x19')]){if(_0x3c10cd['error'][_0xa8fe('0x1a')]===0x1f4){logger[_0xa8fe('0x19')](_0xa8fe('0x14'),_0x32d9e4,_0x3c10cd['error']['message']);return _0x91b113(_0x3c10cd[_0xa8fe('0x19')]['message']);}logger[_0xa8fe('0x19')](_0xa8fe('0x14'),_0x32d9e4,_0x3c10cd['error'][_0xa8fe('0x1b')]);return _0x2bf1cd(_0x3c10cd[_0xa8fe('0x19')][_0xa8fe('0x1b')]);}else{logger[_0xa8fe('0x13')](_0xa8fe('0x14'),_0x32d9e4,_0xa8fe('0x15'));_0x2bf1cd(_0x3c10cd['result']['message']);}})[_0xa8fe('0x1c')](function(_0x46c51d){logger[_0xa8fe('0x19')]('FaxMessage,\x20%s,\x20%s',_0x32d9e4,_0x46c51d);_0x91b113(_0x46c51d);});});}exports[_0xa8fe('0x1d')]=function(_0x343f33){var _0x22e33f=this;return new Promise(function(_0x7a10fd,_0x38a970){return db[_0xa8fe('0x1e')][_0xa8fe('0x1f')](_0x343f33['body'],{'raw':_0x343f33[_0xa8fe('0x20')]?_0x343f33[_0xa8fe('0x20')][_0xa8fe('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x28b8db){logger['info'](_0xa8fe('0x1d'),_0x343f33);logger['debug']('CreateFaxMessage',_0x343f33,JSON[_0xa8fe('0x18')](_0x28b8db));_0x7a10fd(_0x28b8db);})[_0xa8fe('0x1c')](function(_0x2a85fe){logger['error']('CreateFaxMessage',_0x2a85fe[_0xa8fe('0x1b')],_0x343f33);_0x38a970(_0x22e33f[_0xa8fe('0x19')](0x1f4,_0x2a85fe['message']));});});};exports[_0xa8fe('0x22')]=function(_0x114757){var _0x42f6be=this;return new Promise(function(_0x7397af,_0x26d1ff){return db[_0xa8fe('0x1e')][_0xa8fe('0x23')](_0x114757['body'],{'raw':_0x114757[_0xa8fe('0x20')]?_0x114757[_0xa8fe('0x20')][_0xa8fe('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x114757['options']?_0x114757[_0xa8fe('0x20')][_0xa8fe('0x24')]||null:null,'attributes':_0x114757[_0xa8fe('0x20')]?_0x114757[_0xa8fe('0x20')][_0xa8fe('0x25')]||null:null,'limit':_0x114757[_0xa8fe('0x20')]?_0x114757[_0xa8fe('0x20')]['limit']||null:null})[_0xa8fe('0x12')](function(_0x185a55){logger[_0xa8fe('0x13')](_0xa8fe('0x22'),_0x114757);logger[_0xa8fe('0x16')](_0xa8fe('0x22'),_0x114757,JSON[_0xa8fe('0x18')](_0x185a55));_0x7397af(_0x185a55);})[_0xa8fe('0x1c')](function(_0x11b254){logger['error'](_0xa8fe('0x22'),_0x11b254[_0xa8fe('0x1b')],_0x114757);_0x26d1ff(_0x42f6be[_0xa8fe('0x19')](0x1f4,_0x11b254['message']));});});}; \ No newline at end of file +var _0xec5a=['where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','debug','stringify','UpdateFaxMessage','update'];(function(_0x2314ac,_0x312489){var _0x3c8d18=function(_0x2da6a0){while(--_0x2da6a0){_0x2314ac['push'](_0x2314ac['shift']());}};_0x3c8d18(++_0x312489);}(_0xec5a,0x17f));var _0xaec5=function(_0x5c0a34,_0x4e1497){_0x5c0a34=_0x5c0a34-0x0;var _0x33ca98=_0xec5a[_0x5c0a34];return _0x33ca98;};'use strict';var _=require(_0xaec5('0x0'));var util=require('util');var moment=require(_0xaec5('0x1'));var BPromise=require(_0xaec5('0x2'));var rs=require(_0xaec5('0x3'));var fs=require('fs');var Redis=require(_0xaec5('0x4'));var db=require(_0xaec5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaec5('0x6'))(_0xaec5('0x7'));var config=require(_0xaec5('0x8'));var jayson=require(_0xaec5('0x9'));var client=jayson[_0xaec5('0xa')]['http']({'port':0x232a});config['redis']=_[_0xaec5('0xb')](config[_0xaec5('0xc')],{'host':_0xaec5('0xd'),'port':0x18eb});var socket=require(_0xaec5('0xe'))(new Redis(config['redis']));require(_0xaec5('0xf'))['register'](socket);function respondWithRpcPromise(_0x3d216c,_0x22d736,_0x5e57f1){return new BPromise(function(_0x5ba68b,_0x1d8601){return client['request'](_0x3d216c,_0x5e57f1)[_0xaec5('0x10')](function(_0x29bfdf){logger[_0xaec5('0x11')](_0xaec5('0x12'),_0x22d736,_0xaec5('0x13'));logger['debug'](_0xaec5('0x14'),_0x22d736,'request\x20sent',JSON['stringify'](_0x29bfdf));if(_0x29bfdf[_0xaec5('0x15')]){if(_0x29bfdf['error'][_0xaec5('0x16')]===0x1f4){logger['error'](_0xaec5('0x12'),_0x22d736,_0x29bfdf['error'][_0xaec5('0x17')]);return _0x1d8601(_0x29bfdf['error'][_0xaec5('0x17')]);}logger[_0xaec5('0x15')](_0xaec5('0x12'),_0x22d736,_0x29bfdf[_0xaec5('0x15')][_0xaec5('0x17')]);return _0x5ba68b(_0x29bfdf[_0xaec5('0x15')][_0xaec5('0x17')]);}else{logger[_0xaec5('0x11')](_0xaec5('0x12'),_0x22d736,_0xaec5('0x13'));_0x5ba68b(_0x29bfdf['result'][_0xaec5('0x17')]);}})[_0xaec5('0x18')](function(_0xa30e54){logger[_0xaec5('0x15')]('FaxMessage,\x20%s,\x20%s',_0x22d736,_0xa30e54);_0x1d8601(_0xa30e54);});});}exports[_0xaec5('0x19')]=function(_0x571bd7){var _0x3b9308=this;return new Promise(function(_0x5f06bd,_0x402194){return db[_0xaec5('0x1a')][_0xaec5('0x1b')](_0x571bd7[_0xaec5('0x1c')],{'raw':_0x571bd7[_0xaec5('0x1d')]?_0x571bd7[_0xaec5('0x1d')][_0xaec5('0x1e')]===undefined?!![]:![]:!![]})[_0xaec5('0x10')](function(_0xda7a4b){logger[_0xaec5('0x11')](_0xaec5('0x19'),_0x571bd7);logger[_0xaec5('0x1f')](_0xaec5('0x19'),_0x571bd7,JSON[_0xaec5('0x20')](_0xda7a4b));_0x5f06bd(_0xda7a4b);})[_0xaec5('0x18')](function(_0x480da2){logger[_0xaec5('0x15')](_0xaec5('0x19'),_0x480da2['message'],_0x571bd7);_0x402194(_0x3b9308[_0xaec5('0x15')](0x1f4,_0x480da2[_0xaec5('0x17')]));});});};exports[_0xaec5('0x21')]=function(_0x312417){var _0x3551af=this;return new Promise(function(_0x3c25c1,_0x68176d){return db['FaxMessage'][_0xaec5('0x22')](_0x312417[_0xaec5('0x1c')],{'raw':_0x312417[_0xaec5('0x1d')]?_0x312417[_0xaec5('0x1d')][_0xaec5('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x312417[_0xaec5('0x1d')]?_0x312417[_0xaec5('0x1d')][_0xaec5('0x23')]||null:null,'attributes':_0x312417['options']?_0x312417['options'][_0xaec5('0x24')]||null:null,'limit':_0x312417[_0xaec5('0x1d')]?_0x312417['options'][_0xaec5('0x25')]||null:null})[_0xaec5('0x10')](function(_0x2f6457){logger[_0xaec5('0x11')](_0xaec5('0x21'),_0x312417);logger[_0xaec5('0x1f')](_0xaec5('0x21'),_0x312417,JSON[_0xaec5('0x20')](_0x2f6457));_0x3c25c1(_0x2f6457);})[_0xaec5('0x18')](function(_0x294f65){logger[_0xaec5('0x15')](_0xaec5('0x21'),_0x294f65['message'],_0x312417);_0x68176d(_0x3551af['error'](0x1f4,_0x294f65['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index be63a71..b89042a 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index a8d06ef..454471d 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 _0x4cad=['download','tracked','fax','put','update','/:id/accept','accept','/:id/reject','reject','delete','/:id','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','index','get','/describe','show','/:id/download'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4cad,0x1d8));var _0xd4ca=function(_0x5bdd91,_0x5f426c){_0x5bdd91=_0x5bdd91-0x0;var _0x55a7fe=_0x4cad[_0x5bdd91];return _0x55a7fe;};'use strict';var multer=require(_0xd4ca('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd4ca('0x1'));var express=require(_0xd4ca('0x2'));var router=express[_0xd4ca('0x3')]();var auth=require(_0xd4ca('0x4'));var interaction=require(_0xd4ca('0x5'));var config=require(_0xd4ca('0x6'));var controller=require(_0xd4ca('0x7'));router['get']('/',auth[_0xd4ca('0x8')](),controller[_0xd4ca('0x9')]);router[_0xd4ca('0xa')](_0xd4ca('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xd4ca('0xa')]('/:id',auth[_0xd4ca('0x8')](),controller[_0xd4ca('0xc')]);router[_0xd4ca('0xa')](_0xd4ca('0xd'),auth[_0xd4ca('0x8')](),controller[_0xd4ca('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xd4ca('0xf')](_0xd4ca('0x10'),'faxmessage:create'),controller['create']);router[_0xd4ca('0x11')]('/:id',auth[_0xd4ca('0x8')](),controller[_0xd4ca('0x12')]);router[_0xd4ca('0x11')](_0xd4ca('0x13'),auth[_0xd4ca('0x8')](),controller[_0xd4ca('0x14')]);router[_0xd4ca('0x11')](_0xd4ca('0x15'),auth['isAuthenticated'](),controller[_0xd4ca('0x16')]);router[_0xd4ca('0x17')](_0xd4ca('0x18'),auth['isAuthenticated'](),controller[_0xd4ca('0x19')]);module[_0xd4ca('0x1a')]=router; \ No newline at end of file +var _0x33b9=['connect-timeout','express','Router','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/download','post','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','path'];(function(_0x284bc3,_0x22dffe){var _0x41ac81=function(_0x47031f){while(--_0x47031f){_0x284bc3['push'](_0x284bc3['shift']());}};_0x41ac81(++_0x22dffe);}(_0x33b9,0x1ec));var _0x933b=function(_0x45aa42,_0x3ae28d){_0x45aa42=_0x45aa42-0x0;var _0x5f1d31=_0x33b9[_0x45aa42];return _0x5f1d31;};'use strict';var multer=require(_0x933b('0x0'));var util=require('util');var path=require(_0x933b('0x1'));var timeout=require(_0x933b('0x2'));var express=require(_0x933b('0x3'));var router=express[_0x933b('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x933b('0x5'));var controller=require(_0x933b('0x6'));router[_0x933b('0x7')]('/',auth[_0x933b('0x8')](),controller[_0x933b('0x9')]);router['get'](_0x933b('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x933b('0x7')](_0x933b('0xb'),auth[_0x933b('0x8')](),controller[_0x933b('0xc')]);router['get'](_0x933b('0xd'),auth[_0x933b('0x8')](),controller['download']);router[_0x933b('0xe')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x933b('0xf'),_0x933b('0x10')),controller[_0x933b('0x11')]);router[_0x933b('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x933b('0x13')]);router['put'](_0x933b('0x14'),auth[_0x933b('0x8')](),controller[_0x933b('0x15')]);router[_0x933b('0x12')](_0x933b('0x16'),auth[_0x933b('0x8')](),controller[_0x933b('0x17')]);router[_0x933b('0x18')](_0x933b('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x933b('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 90f2920..f2f52a9 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 _0x923c=['sequelize','STRING','name','ENUM','roundrobin','INTEGER'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x923c,0x198));var _0xc923=function(_0x3b4563,_0x236ece){_0x3b4563=_0x3b4563-0x0;var _0x1f27ff=_0x923c[_0x3b4563];return _0x1f27ff;};'use strict';var Sequelize=require(_0xc923('0x0'));module['exports']={'name':{'type':Sequelize[_0xc923('0x1')],'unique':_0xc923('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc923('0x3')]('rrmemory','beepall',_0xc923('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc923('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2141=['roundrobin','sequelize','exports','STRING','name','INTEGER','beepall'];(function(_0x34ba76,_0x55a489){var _0x20d0f1=function(_0x1281ca){while(--_0x1281ca){_0x34ba76['push'](_0x34ba76['shift']());}};_0x20d0f1(++_0x55a489);}(_0x2141,0x1ba));var _0x1214=function(_0x52bf45,_0x121f24){_0x52bf45=_0x52bf45-0x0;var _0x141e4d=_0x2141[_0x52bf45];return _0x141e4d;};'use strict';var Sequelize=require(_0x1214('0x0'));module[_0x1214('0x1')]={'name':{'type':Sequelize[_0x1214('0x2')],'unique':_0x1214('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1214('0x2')]},'timeout':{'type':Sequelize[_0x1214('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x1214('0x5'),_0x1214('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x1214('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 b05b46c..7102fa9 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 _0x64ca=['every','TeamId','includes','all','union','compact','removeAgents','userFaxQueue:remove','addAgents','spread','isArray','getAgents','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','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','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','then','get','FaxQueues','destroy','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','params','UserFaxQueue','pick','FaxQueueId','User','UserId','agent','faxPause','updatedAt','createdAt','%s/%s','getTeams','addTeams','ids','voicePause','interface','Agents','sequelize','transaction','each','forEach','emit','userFaxQueue:save','removeTeams','select','field','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT'];(function(_0x14d33a,_0x3bac2c){var _0x279163=function(_0x177138){while(--_0x177138){_0x14d33a['push'](_0x14d33a['shift']());}};_0x279163(++_0x3bac2c);}(_0x64ca,0x11e));var _0xa64c=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x64ca[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0xa64c('0x0'));var emlformat=require(_0xa64c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa64c('0x2'));var rp=require('request-promise');var moment=require(_0xa64c('0x3'));var BPromise=require(_0xa64c('0x4'));var Mustache=require(_0xa64c('0x5'));var util=require('util');var path=require(_0xa64c('0x6'));var sox=require(_0xa64c('0x7'));var csv=require(_0xa64c('0x8'));var ejs=require(_0xa64c('0x9'));var fs=require('fs');var _=require(_0xa64c('0xa'));var squel=require('squel');var crypto=require(_0xa64c('0xb'));var jsforce=require(_0xa64c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa64c('0x8'));var querystring=require(_0xa64c('0xd'));var Papa=require(_0xa64c('0xe'));var Redis=require(_0xa64c('0xf'));var authService=require(_0xa64c('0x10'));var qs=require(_0xa64c('0x11'));var as=require(_0xa64c('0x12'));var hardwareService=require(_0xa64c('0x13'));var logger=require(_0xa64c('0x14'))('api');var utils=require(_0xa64c('0x15'));var config=require(_0xa64c('0x16'));var licenseUtil=require(_0xa64c('0x17'));var db=require('../../mysqldb')['db'];config[_0xa64c('0x18')]=_[_0xa64c('0x19')](config[_0xa64c('0x18')],{'host':_0xa64c('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa64c('0x18')]));require(_0xa64c('0x1b'))[_0xa64c('0x1c')](socket);function respondWithStatusCode(_0x42614b,_0x2dc8a8){_0x2dc8a8=_0x2dc8a8||0xcc;return function(_0x271457){if(_0x271457){return _0x42614b[_0xa64c('0x1d')](_0x2dc8a8);}return _0x42614b[_0xa64c('0x1e')](_0x2dc8a8)[_0xa64c('0x1f')]();};}function respondWithResult(_0x3b65d7,_0x594e62){_0x594e62=_0x594e62||0xc8;return function(_0x2ed6cb){if(_0x2ed6cb){return _0x3b65d7[_0xa64c('0x1e')](_0x594e62)[_0xa64c('0x20')](_0x2ed6cb);}};}function respondWithFilteredResult(_0x3e4deb,_0x36b6fa){return function(_0x225ff1){if(_0x225ff1){var _0x32a8d9=_0x225ff1['count'],_0x5be43e=_0x36b6fa[_0xa64c('0x21')],_0x3cc602=_0x36b6fa[_0xa64c('0x21')]+_0x36b6fa[_0xa64c('0x22')],_0x4287f2;if(_0x3cc602>=_0x32a8d9){_0x3cc602=_0x32a8d9;_0x4287f2=0xc8;}else{_0x4287f2=0xce;}_0x3e4deb[_0xa64c('0x1e')](_0x4287f2);return _0x3e4deb[_0xa64c('0x23')](_0xa64c('0x24'),_0x5be43e+'-'+_0x3cc602+'/'+_0x32a8d9)['json'](_0x225ff1);}return null;};}function patchUpdates(_0x43a77e){return function(_0x142979){try{jsonpatch[_0xa64c('0x25')](_0x142979,_0x43a77e,!![]);}catch(_0x2288ad){return BPromise[_0xa64c('0x26')](_0x2288ad);}return _0x142979['save']();};}function saveUpdates(_0x5db4c4,_0x471b11){return function(_0x10b02e){if(_0x10b02e){return _0x10b02e['update'](_0x5db4c4)['then'](function(_0x505b81){return _0x505b81;});}return null;};}function removeEntity(_0x16481f,_0x4311fb){return function(_0xe9c3f1){if(_0xe9c3f1){return _0xe9c3f1['destroy']()[_0xa64c('0x27')](function(){var _0x3e0c04=_0xe9c3f1[_0xa64c('0x28')]({'plain':!![]});var _0xe0a939=_0xa64c('0x29');return db['UserProfileResource'][_0xa64c('0x2a')]({'where':{'type':_0xe0a939,'resourceId':_0x3e0c04['id']}})[_0xa64c('0x27')](function(){return _0xe9c3f1;});})[_0xa64c('0x27')](function(){_0x16481f[_0xa64c('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a0834,_0x59094a){return function(_0x1d9473){if(!_0x1d9473){_0x1a0834[_0xa64c('0x1d')](0x194);}return _0x1d9473;};}function handleError(_0x58932d,_0x5309d5){_0x5309d5=_0x5309d5||0x1f4;return function(_0x50a586){logger[_0xa64c('0x2b')](_0x50a586[_0xa64c('0x2c')]);if(_0x50a586['name']){delete _0x50a586[_0xa64c('0x2d')];}_0x58932d[_0xa64c('0x1e')](_0x5309d5)[_0xa64c('0x2e')](_0x50a586);};}exports[_0xa64c('0x2f')]=function(_0x28191e,_0x18acab){var _0x5813f1={},_0x1e73f9={},_0x2c5c80={'count':0x0,'rows':[]};var _0x4ce2c8=_[_0xa64c('0x30')](db[_0xa64c('0x31')][_0xa64c('0x32')],function(_0x2d126a){return{'name':_0x2d126a[_0xa64c('0x33')],'type':_0x2d126a['type'][_0xa64c('0x34')]};});_0x1e73f9[_0xa64c('0x35')]=_[_0xa64c('0x30')](_0x4ce2c8,'name');_0x1e73f9[_0xa64c('0x36')]=_[_0xa64c('0x37')](_0x28191e[_0xa64c('0x36')]);_0x1e73f9[_0xa64c('0x38')]=_[_0xa64c('0x39')](_0x1e73f9[_0xa64c('0x35')],_0x1e73f9['query']);_0x5813f1[_0xa64c('0x3a')]=_[_0xa64c('0x39')](_0x1e73f9['model'],qs['fields'](_0x28191e['query'][_0xa64c('0x3b')]));_0x5813f1[_0xa64c('0x3a')]=_0x5813f1[_0xa64c('0x3a')][_0xa64c('0x3c')]?_0x5813f1[_0xa64c('0x3a')]:_0x1e73f9[_0xa64c('0x35')];if(!_0x28191e['query'][_0xa64c('0x3d')](_0xa64c('0x3e'))){_0x5813f1[_0xa64c('0x22')]=qs[_0xa64c('0x22')](_0x28191e[_0xa64c('0x36')][_0xa64c('0x22')]);_0x5813f1[_0xa64c('0x21')]=qs[_0xa64c('0x21')](_0x28191e[_0xa64c('0x36')][_0xa64c('0x21')]);}_0x5813f1[_0xa64c('0x3f')]=qs['sort'](_0x28191e[_0xa64c('0x36')][_0xa64c('0x40')]);_0x5813f1[_0xa64c('0x41')]=qs[_0xa64c('0x38')](_['pick'](_0x28191e[_0xa64c('0x36')],_0x1e73f9[_0xa64c('0x38')]),_0x4ce2c8);if(_0x28191e[_0xa64c('0x36')][_0xa64c('0x42')]){_0x5813f1[_0xa64c('0x41')]=_['merge'](_0x5813f1[_0xa64c('0x41')],{'$or':_[_0xa64c('0x30')](_0x4ce2c8,function(_0x2b943c){if(_0x2b943c[_0xa64c('0x43')]!==_0xa64c('0x44')){var _0xabd641={};_0xabd641[_0x2b943c['name']]={'$like':'%'+_0x28191e[_0xa64c('0x36')]['filter']+'%'};return _0xabd641;}})});}_0x5813f1=_[_0xa64c('0x45')]({},_0x5813f1,_0x28191e[_0xa64c('0x46')]);var _0x2e1700={'where':_0x5813f1['where']};return db[_0xa64c('0x31')][_0xa64c('0x47')](_0x2e1700)[_0xa64c('0x27')](function(_0x384ef7){_0x2c5c80['count']=_0x384ef7;if(_0x28191e[_0xa64c('0x36')][_0xa64c('0x48')]){_0x5813f1[_0xa64c('0x49')]=[{'all':!![]}];}return db[_0xa64c('0x31')][_0xa64c('0x4a')](_0x5813f1);})[_0xa64c('0x27')](function(_0x48ee26){_0x2c5c80[_0xa64c('0x4b')]=_0x48ee26;return _0x2c5c80;})['then'](respondWithFilteredResult(_0x18acab,_0x5813f1))[_0xa64c('0x4c')](handleError(_0x18acab,null));};exports['show']=function(_0x382e10,_0x304318){var _0x299451={'raw':!![],'where':{'id':_0x382e10['params']['id']}},_0x4300a9={};_0x4300a9[_0xa64c('0x35')]=_[_0xa64c('0x37')](db[_0xa64c('0x31')][_0xa64c('0x32')]);_0x4300a9[_0xa64c('0x36')]=_['keys'](_0x382e10[_0xa64c('0x36')]);_0x4300a9['filtears']=_[_0xa64c('0x39')](_0x4300a9[_0xa64c('0x35')],_0x4300a9[_0xa64c('0x36')]);_0x299451[_0xa64c('0x3a')]=_[_0xa64c('0x39')](_0x4300a9[_0xa64c('0x35')],qs['fields'](_0x382e10['query'][_0xa64c('0x3b')]));_0x299451[_0xa64c('0x3a')]=_0x299451[_0xa64c('0x3a')][_0xa64c('0x3c')]?_0x299451[_0xa64c('0x3a')]:_0x4300a9[_0xa64c('0x35')];if(_0x382e10['query'][_0xa64c('0x48')]){_0x299451[_0xa64c('0x49')]=[{'all':!![]}];}_0x299451=_[_0xa64c('0x45')]({},_0x299451,_0x382e10[_0xa64c('0x46')]);return db['FaxQueue'][_0xa64c('0x4d')](_0x299451)[_0xa64c('0x27')](handleEntityNotFound(_0x304318,null))['then'](respondWithResult(_0x304318,null))[_0xa64c('0x4c')](handleError(_0x304318,null));};exports[_0xa64c('0x4e')]=function(_0x51213a,_0x2ceb70){return db[_0xa64c('0x31')][_0xa64c('0x4e')](_0x51213a['body'],{})[_0xa64c('0x27')](function(_0x1f837f){var _0x5344c5=_0x51213a[_0xa64c('0x4f')]['get']({'plain':!![]});if(!_0x5344c5)throw new Error(_0xa64c('0x50'));if(_0x5344c5['role']===_0xa64c('0x4f')){var _0x30529a=_0x1f837f[_0xa64c('0x28')]({'plain':!![]});var _0x2e1d97='FaxQueues';return db[_0xa64c('0x51')]['find']({'where':{'name':_0x2e1d97,'userProfileId':_0x5344c5[_0xa64c('0x52')]},'raw':!![]})['then'](function(_0x3e0094){if(_0x3e0094&&_0x3e0094['autoAssociation']===0x0){return db[_0xa64c('0x53')]['create']({'name':_0x30529a['name'],'resourceId':_0x30529a['id'],'type':_0x3e0094[_0xa64c('0x2d')],'sectionId':_0x3e0094['id']},{})[_0xa64c('0x27')](function(){return _0x1f837f;});}else{return _0x1f837f;}})[_0xa64c('0x4c')](function(_0x45b66d){logger[_0xa64c('0x2b')](_0xa64c('0x54'),_0x45b66d);throw _0x45b66d;});}return _0x1f837f;})[_0xa64c('0x27')](respondWithResult(_0x2ceb70,0xc9))[_0xa64c('0x4c')](handleError(_0x2ceb70,null));};exports[_0xa64c('0x55')]=function(_0x473d5e,_0xb51399){if(_0x473d5e[_0xa64c('0x56')]['id']){delete _0x473d5e[_0xa64c('0x56')]['id'];}return db['FaxQueue'][_0xa64c('0x4d')]({'where':{'id':_0x473d5e['params']['id']}})[_0xa64c('0x27')](handleEntityNotFound(_0xb51399,null))['then'](saveUpdates(_0x473d5e[_0xa64c('0x56')],null))[_0xa64c('0x27')](respondWithResult(_0xb51399,null))[_0xa64c('0x4c')](handleError(_0xb51399,null));};exports[_0xa64c('0x2a')]=function(_0x3cfa1a,_0x29f686){return db[_0xa64c('0x31')][_0xa64c('0x4d')]({'where':{'id':_0x3cfa1a['params']['id']}})['then'](handleEntityNotFound(_0x29f686,null))[_0xa64c('0x27')](removeEntity(_0x29f686,null))[_0xa64c('0x4c')](handleError(_0x29f686,null));};exports[_0xa64c('0x57')]=function(_0x1a4bec,_0x1c74fe){return db[_0xa64c('0x31')][_0xa64c('0x57')]()[_0xa64c('0x27')](respondWithResult(_0x1c74fe,null))[_0xa64c('0x4c')](handleError(_0x1c74fe,null));};exports[_0xa64c('0x58')]=function(_0x29b9c2,_0x3def7e,_0x5bbb25){var _0x308479={'raw':!![],'where':{}},_0xc8a590={},_0x4c4ef7;return db[_0xa64c('0x31')][_0xa64c('0x59')]({'where':{'id':_0x29b9c2[_0xa64c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3def7e,null))[_0xa64c('0x27')](function(_0x32742c){if(_0x32742c){_0x4c4ef7=_0x32742c[_0xa64c('0x28')]({'plain':!![]});_0xc8a590['model']=_[_0xa64c('0x37')](db[_0xa64c('0x5b')][_0xa64c('0x32')]);_0xc8a590[_0xa64c('0x36')]=_[_0xa64c('0x37')](_0x29b9c2[_0xa64c('0x36')]);_0xc8a590[_0xa64c('0x38')]=_[_0xa64c('0x39')](_0xc8a590[_0xa64c('0x35')],_0xc8a590[_0xa64c('0x36')]);_0x308479[_0xa64c('0x3a')]=_['intersection'](_0xc8a590[_0xa64c('0x35')],qs[_0xa64c('0x3b')](_0x29b9c2[_0xa64c('0x36')][_0xa64c('0x3b')]));_0x308479[_0xa64c('0x3a')]=_0x308479['attributes'][_0xa64c('0x3c')]?_0x308479['attributes']:_0xc8a590['model'];if(!_0x29b9c2[_0xa64c('0x36')][_0xa64c('0x3d')](_0xa64c('0x3e'))){_0x308479[_0xa64c('0x22')]=qs[_0xa64c('0x22')](_0x29b9c2[_0xa64c('0x36')][_0xa64c('0x22')]);_0x308479['offset']=qs[_0xa64c('0x21')](_0x29b9c2['query'][_0xa64c('0x21')]);}_0x308479['order']=qs[_0xa64c('0x40')](_0x29b9c2[_0xa64c('0x36')][_0xa64c('0x40')]);_0x308479[_0xa64c('0x41')]=qs[_0xa64c('0x38')](_[_0xa64c('0x5c')](_0x29b9c2[_0xa64c('0x36')],_0xc8a590[_0xa64c('0x38')]));_0x308479[_0xa64c('0x41')][_0xa64c('0x5d')]=_0x32742c['id'];if(_0x29b9c2[_0xa64c('0x36')][_0xa64c('0x42')]){_0x308479[_0xa64c('0x41')]=_[_0xa64c('0x45')](_0x308479[_0xa64c('0x41')],{'$or':_[_0xa64c('0x30')](_0x308479[_0xa64c('0x3a')],function(_0x55488a){var _0x5cfe2b={};_0x5cfe2b[_0x55488a]={'$like':'%'+_0x29b9c2[_0xa64c('0x36')]['filter']+'%'};return _0x5cfe2b;})});}_0x308479=_[_0xa64c('0x45')]({},_0x308479,_0x29b9c2[_0xa64c('0x46')]);return db[_0xa64c('0x5b')][_0xa64c('0x4a')](_0x308479);}})['then'](function(_0x53e9bf){if(_0x53e9bf){return db[_0xa64c('0x5e')]['findAndCountAll']({'where':{'id':_['map'](_0x53e9bf,_0xa64c('0x5f')),'role':_0xa64c('0x60')},'attributes':['id',_0xa64c('0x2d'),_0xa64c('0x61'),_0xa64c('0x62'),_0xa64c('0x63')]});}})[_0xa64c('0x27')](function(_0x57a2cd){if(_0x57a2cd){return{'count':_0x57a2cd[_0xa64c('0x47')],'rows':_[_0xa64c('0x30')](_0x57a2cd[_0xa64c('0x4b')],function(_0x143133){return{'membername':_0x143133['name'],'UserId':_0x143133['id'],'queue_name':_0x4c4ef7['name'],'FaxQueueId':_0x4c4ef7['id'],'interface':util['format'](_0xa64c('0x64'),'SIP',_0x143133[_0xa64c('0x2d')]),'penalty':0x0,'paused':_0x143133['faxPause'],'createdAt':_0x143133[_0xa64c('0x63')],'updatedAt':_0x143133[_0xa64c('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa64c('0x27')](respondWithFilteredResult(_0x3def7e,_0x308479))[_0xa64c('0x4c')](handleError(_0x3def7e,null));};exports[_0xa64c('0x65')]=function(_0x360de6,_0x238652,_0x202f07){var _0x5344e2={};var _0x3e1d6a={};var _0x177e20;var _0x51b771;return db[_0xa64c('0x31')]['findOne']({'where':{'id':_0x360de6[_0xa64c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x238652,null))['then'](function(_0x469774){if(_0x469774){_0x177e20=_0x469774;_0x3e1d6a[_0xa64c('0x35')]=_['keys'](db['Team']['rawAttributes']);_0x3e1d6a[_0xa64c('0x36')]=_[_0xa64c('0x37')](_0x360de6[_0xa64c('0x36')]);_0x3e1d6a[_0xa64c('0x38')]=_[_0xa64c('0x39')](_0x3e1d6a[_0xa64c('0x35')],_0x3e1d6a[_0xa64c('0x36')]);_0x5344e2[_0xa64c('0x3a')]=_['intersection'](_0x3e1d6a[_0xa64c('0x35')],qs[_0xa64c('0x3b')](_0x360de6['query'][_0xa64c('0x3b')]));_0x5344e2['attributes']=_0x5344e2[_0xa64c('0x3a')][_0xa64c('0x3c')]?_0x5344e2[_0xa64c('0x3a')]:_0x3e1d6a[_0xa64c('0x35')];_0x5344e2[_0xa64c('0x3f')]=qs[_0xa64c('0x40')](_0x360de6['query'][_0xa64c('0x40')]);_0x5344e2[_0xa64c('0x41')]=qs[_0xa64c('0x38')](_[_0xa64c('0x5c')](_0x360de6[_0xa64c('0x36')],_0x3e1d6a[_0xa64c('0x38')]));if(_0x360de6[_0xa64c('0x36')][_0xa64c('0x42')]){_0x5344e2[_0xa64c('0x41')]=_[_0xa64c('0x45')](_0x5344e2[_0xa64c('0x41')],{'$or':_[_0xa64c('0x30')](_0x5344e2['attributes'],function(_0x482cdf){var _0x40894e={};_0x40894e[_0x482cdf]={'$like':'%'+_0x360de6[_0xa64c('0x36')]['filter']+'%'};return _0x40894e;})});}_0x5344e2=_['merge']({},_0x5344e2,_0x360de6[_0xa64c('0x46')]);return _0x177e20[_0xa64c('0x65')](_0x5344e2);}})[_0xa64c('0x27')](function(_0x4558df){if(_0x4558df){_0x51b771=_0x4558df['length'];if(!_0x360de6[_0xa64c('0x36')][_0xa64c('0x3d')](_0xa64c('0x3e'))){_0x5344e2[_0xa64c('0x22')]=qs['limit'](_0x360de6[_0xa64c('0x36')][_0xa64c('0x22')]);_0x5344e2[_0xa64c('0x21')]=qs[_0xa64c('0x21')](_0x360de6[_0xa64c('0x36')]['offset']);}return _0x177e20[_0xa64c('0x65')](_0x5344e2);}})[_0xa64c('0x27')](function(_0x680fd5){if(_0x680fd5){return _0x680fd5?{'count':_0x51b771,'rows':_0x680fd5}:null;}})['then'](respondWithResult(_0x238652,null))[_0xa64c('0x4c')](handleError(_0x238652,null));};exports[_0xa64c('0x66')]=function(_0x45aec5,_0x2209ea,_0x114dde){var _0x363aca=_0x45aec5[_0xa64c('0x56')][_0xa64c('0x67')];return db['Team']['findAll']({'where':{'id':_0x363aca},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xa64c('0x2d'),'online',_0xa64c('0x68'),_0xa64c('0x69')],'raw':!![]}]})[_0xa64c('0x27')](function(_0x1ef4be){if(_0x1ef4be){var _0xdd945e=_['flatMap'](_0x1ef4be,function(_0x345606){var _0x542fc9=_0x345606['get']({'plain':!![]});return _0x542fc9[_0xa64c('0x6a')];});return db[_0xa64c('0x31')][_0xa64c('0x4d')]({'where':{'id':_0x45aec5[_0xa64c('0x5a')]['id']}})[_0xa64c('0x27')](function(_0x12b90a){return db[_0xa64c('0x6b')][_0xa64c('0x6c')](function(_0x4e6861){return _0x12b90a[_0xa64c('0x66')](_0x363aca,{'transaction':_0x4e6861})[_0xa64c('0x27')](function(){return BPromise[_0xa64c('0x6d')](_0xdd945e,function(_0x454dc9){return db[_0xa64c('0x5b')]['findOrCreate']({'where':{'UserId':_0x454dc9['id'],'FaxQueueId':_0x45aec5[_0xa64c('0x5a')]['id']},'transaction':_0x4e6861});});})['then'](function(){_0xdd945e[_0xa64c('0x6e')](function(_0x49265a){socket[_0xa64c('0x6f')](_0xa64c('0x70'),{'UserId':_0x49265a['id'],'FaxQueueId':_0x12b90a['id']});});});});});}})['then'](respondWithStatusCode(_0x2209ea,null))['catch'](handleError(_0x2209ea,null));};exports[_0xa64c('0x71')]=function(_0x3dc4a8,_0x340a9c,_0x1af8d4){return db['Team'][_0xa64c('0x4a')]({'where':{'id':_0x3dc4a8['query'][_0xa64c('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa64c('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xa64c('0x27')](handleEntityNotFound(_0x340a9c,null))[_0xa64c('0x27')](function(_0x94d84d){var _0x472e87=_[_0xa64c('0x30')](_0x94d84d,'id');var _0x2aca44=[];var _0x3a46e5=[];var _0x124c8d=squel[_0xa64c('0x72')]();_0x124c8d[_0xa64c('0x73')]('tq.TeamId')[_0xa64c('0x74')](_0xa64c('0x75'),'tq')['join'](_0xa64c('0x76'),'ut',_0xa64c('0x77'))[_0xa64c('0x41')]('FaxQueueId\x20=\x20?',_0x3dc4a8['params']['id']);for(var _0x428fbf=0x0;_0x428fbf<_0x94d84d[_0xa64c('0x3c')];_0x428fbf+=0x1){let _0xd28f19=_0x94d84d[_0x428fbf];for(var _0x2e4657=0x0;_0x2e4657<_0xd28f19['Agents'][_0xa64c('0x3c')];_0x2e4657+=0x1){let _0x2bdfae=_0xd28f19[_0xa64c('0x6a')][_0x2e4657];var _0x2a00ca=_0x124c8d[_0xa64c('0x78')]();_0x2a00ca[_0xa64c('0x41')](_0xa64c('0x79'),_0x2bdfae['id']);_0x3a46e5['push'](db[_0xa64c('0x6b')][_0xa64c('0x36')](_0x2a00ca[_0xa64c('0x7a')](),{'type':db[_0xa64c('0x6b')][_0xa64c('0x7b')][_0xa64c('0x7c')]})[_0xa64c('0x27')](function(_0x3f3009){if(_0x3f3009[_0xa64c('0x3c')]===0x1){return _0x2bdfae['id'];}else{var _0x5abd4d=_[_0xa64c('0x7d')](_[_0xa64c('0x30')](_0x3f3009,_0xa64c('0x7e')),function(_0x33f4e4){return _[_0xa64c('0x7f')](_0x472e87,_0x33f4e4);});if(_0x5abd4d){return _0x2bdfae['id'];}}}));}}return BPromise[_0xa64c('0x80')](_0x3a46e5)[_0xa64c('0x27')](function(_0x2db86d){_0x2aca44=_(_0x2aca44)[_0xa64c('0x81')](_0x2db86d)[_0xa64c('0x82')]()['value']();return db[_0xa64c('0x31')]['find']({'where':{'id':_0x3dc4a8['params']['id']}})[_0xa64c('0x27')](function(_0x3d76bf){return db[_0xa64c('0x6b')]['transaction'](function(_0x5e09e2){return _0x3d76bf[_0xa64c('0x71')](_0x3dc4a8[_0xa64c('0x36')][_0xa64c('0x67')],{'transaction':_0x5e09e2})[_0xa64c('0x27')](function(){if(!_['isEmpty'](_0x2aca44)){return _0x3d76bf[_0xa64c('0x83')](_0x2aca44,{'transaction':_0x5e09e2});}})[_0xa64c('0x27')](function(){_0x2aca44['forEach'](function(_0x34d115){socket[_0xa64c('0x6f')](_0xa64c('0x84'),{'UserId':_0x34d115,'FaxQueueId':_0x3d76bf['id']});});});});});});})[_0xa64c('0x27')](respondWithStatusCode(_0x340a9c,null))['catch'](handleError(_0x340a9c,null));};exports[_0xa64c('0x85')]=function(_0x418217,_0x1b8efe,_0x5e8251){return db[_0xa64c('0x31')][_0xa64c('0x4d')]({'where':{'id':_0x418217['params']['id']}})[_0xa64c('0x27')](handleEntityNotFound(_0x1b8efe,null))[_0xa64c('0x27')](function(_0x2de76c){if(_0x2de76c){return _0x2de76c[_0xa64c('0x85')](_0x418217[_0xa64c('0x56')][_0xa64c('0x67')],_['omit'](_0x418217[_0xa64c('0x56')],[_0xa64c('0x67'),'id'])||{})[_0xa64c('0x86')](function(_0x4ec0a5){for(var _0xa9c59=0x0;_0xa9c59<_0x418217[_0xa64c('0x56')][_0xa64c('0x67')]['length'];_0xa9c59+=0x1){socket[_0xa64c('0x6f')](_0xa64c('0x70'),{'UserId':_0x418217['body'][_0xa64c('0x67')][_0xa9c59],'FaxQueueId':_0x418217[_0xa64c('0x5a')]['id']});}return _0x4ec0a5;});}})[_0xa64c('0x27')](respondWithResult(_0x1b8efe,null))[_0xa64c('0x4c')](handleError(_0x1b8efe,null));};exports[_0xa64c('0x83')]=function(_0x94b6fb,_0x81ad12,_0x38b14a){return db[_0xa64c('0x31')][_0xa64c('0x4d')]({'where':{'id':_0x94b6fb[_0xa64c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x81ad12,null))['then'](function(_0x37d03a){if(_0x37d03a){return _0x37d03a[_0xa64c('0x83')](_0x94b6fb['query']['ids'])[_0xa64c('0x27')](function(){if(_[_0xa64c('0x87')](_0x94b6fb[_0xa64c('0x36')]['ids'])){for(var _0x4fa7c4=0x0;_0x4fa7c4<_0x94b6fb[_0xa64c('0x36')][_0xa64c('0x67')][_0xa64c('0x3c')];_0x4fa7c4+=0x1){socket[_0xa64c('0x6f')](_0xa64c('0x84'),{'UserId':Number(_0x94b6fb['query'][_0xa64c('0x67')][_0x4fa7c4]),'FaxQueueId':Number(_0x94b6fb[_0xa64c('0x5a')]['id'])});}}else{socket[_0xa64c('0x6f')](_0xa64c('0x84'),{'UserId':Number(_0x94b6fb[_0xa64c('0x36')][_0xa64c('0x67')]),'FaxQueueId':Number(_0x94b6fb[_0xa64c('0x5a')]['id'])});}});}})[_0xa64c('0x27')](respondWithStatusCode(_0x81ad12,null))['catch'](handleError(_0x81ad12,null));};exports[_0xa64c('0x88')]=function(_0x5d0fe8,_0x3f6582,_0x5e7d33){var _0xad2d50={};var _0x3baa64={};var _0x18a7b6;var _0x3e2e0d;return db[_0xa64c('0x31')][_0xa64c('0x59')]({'where':{'id':_0x5d0fe8[_0xa64c('0x5a')]['id']}})[_0xa64c('0x27')](handleEntityNotFound(_0x3f6582,null))[_0xa64c('0x27')](function(_0x2e817a){if(_0x2e817a){_0x18a7b6=_0x2e817a;_0x3baa64[_0xa64c('0x35')]=_['keys'](db[_0xa64c('0x5e')][_0xa64c('0x32')]);_0x3baa64[_0xa64c('0x36')]=_[_0xa64c('0x37')](_0x5d0fe8[_0xa64c('0x36')]);_0x3baa64[_0xa64c('0x38')]=_['intersection'](_0x3baa64[_0xa64c('0x35')],_0x3baa64['query']);_0xad2d50[_0xa64c('0x3a')]=_[_0xa64c('0x39')](_0x3baa64[_0xa64c('0x35')],qs['fields'](_0x5d0fe8[_0xa64c('0x36')][_0xa64c('0x3b')]));_0xad2d50[_0xa64c('0x3a')]=_0xad2d50[_0xa64c('0x3a')][_0xa64c('0x3c')]?_0xad2d50[_0xa64c('0x3a')]:_0x3baa64[_0xa64c('0x35')];_0xad2d50[_0xa64c('0x3f')]=qs[_0xa64c('0x40')](_0x5d0fe8['query'][_0xa64c('0x40')]);_0xad2d50[_0xa64c('0x41')]=qs[_0xa64c('0x38')](_[_0xa64c('0x5c')](_0x5d0fe8[_0xa64c('0x36')],_0x3baa64['filters']));if(_0x5d0fe8[_0xa64c('0x36')][_0xa64c('0x42')]){_0xad2d50[_0xa64c('0x41')]=_[_0xa64c('0x45')](_0xad2d50[_0xa64c('0x41')],{'$or':_[_0xa64c('0x30')](_0xad2d50[_0xa64c('0x3a')],function(_0x3f28b5){var _0x226ace={};_0x226ace[_0x3f28b5]={'$like':'%'+_0x5d0fe8[_0xa64c('0x36')]['filter']+'%'};return _0x226ace;})});}_0xad2d50=_[_0xa64c('0x45')]({},_0xad2d50,_0x5d0fe8[_0xa64c('0x46')]);return _0x18a7b6[_0xa64c('0x88')](_0xad2d50);}})['then'](function(_0x303675){if(_0x303675){_0x3e2e0d=_0x303675[_0xa64c('0x3c')];if(!_0x5d0fe8[_0xa64c('0x36')][_0xa64c('0x3d')](_0xa64c('0x3e'))){_0xad2d50[_0xa64c('0x22')]=qs[_0xa64c('0x22')](_0x5d0fe8[_0xa64c('0x36')]['limit']);_0xad2d50[_0xa64c('0x21')]=qs[_0xa64c('0x21')](_0x5d0fe8[_0xa64c('0x36')][_0xa64c('0x21')]);}return _0x18a7b6[_0xa64c('0x88')](_0xad2d50);}})['then'](function(_0x500713){if(_0x500713){return _0x500713?{'count':_0x3e2e0d,'rows':_0x500713}:null;}})['then'](respondWithResult(_0x3f6582,null))[_0xa64c('0x4c')](handleError(_0x3f6582,null));}; \ No newline at end of file +var _0xab6f=['findOrCreate','forEach','userFaxQueue:save','removeTeams','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','compact','removeAgents','addAgents','omit','isArray','emit','userFaxQueue:remove','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','localhost','redis','./faxQueue.socket','register','sendStatus','end','status','json','offset','limit','reject','save','update','then','get','FaxQueues','UserProfileResource','error','name','send','index','map','fieldName','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','FaxQueue','count','includeAll','include','findAll','rows','show','rawAttributes','fields','find','catch','create','body','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','describe','getMembers','UserFaxQueue','nolimit','FaxQueueId','options','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','getTeams','findOne','Team','addTeams','ids','User','online','interface','Agents','sequelize','transaction','each'];(function(_0x49b5e9,_0xbbf0ea){var _0xd9c201=function(_0x451f61){while(--_0x451f61){_0x49b5e9['push'](_0x49b5e9['shift']());}};_0xd9c201(++_0xbbf0ea);}(_0xab6f,0x1b4));var _0xfab6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab6f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfab6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfab6('0x1'));var rp=require(_0xfab6('0x2'));var moment=require(_0xfab6('0x3'));var BPromise=require(_0xfab6('0x4'));var Mustache=require('mustache');var util=require(_0xfab6('0x5'));var path=require(_0xfab6('0x6'));var sox=require(_0xfab6('0x7'));var csv=require('to-csv');var ejs=require(_0xfab6('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfab6('0x9'));var crypto=require(_0xfab6('0xa'));var jsforce=require(_0xfab6('0xb'));var deskjs=require(_0xfab6('0xc'));var toCsv=require(_0xfab6('0xd'));var querystring=require(_0xfab6('0xe'));var Papa=require(_0xfab6('0xf'));var Redis=require(_0xfab6('0x10'));var authService=require(_0xfab6('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfab6('0x12'));var logger=require(_0xfab6('0x13'))(_0xfab6('0x14'));var utils=require(_0xfab6('0x15'));var config=require(_0xfab6('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xfab6('0x17')](config['redis'],{'host':_0xfab6('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfab6('0x19')]));require(_0xfab6('0x1a'))[_0xfab6('0x1b')](socket);function respondWithStatusCode(_0x2c174d,_0x3bab22){_0x3bab22=_0x3bab22||0xcc;return function(_0x3a5401){if(_0x3a5401){return _0x2c174d[_0xfab6('0x1c')](_0x3bab22);}return _0x2c174d['status'](_0x3bab22)[_0xfab6('0x1d')]();};}function respondWithResult(_0x50b237,_0x31905e){_0x31905e=_0x31905e||0xc8;return function(_0xea4f91){if(_0xea4f91){return _0x50b237[_0xfab6('0x1e')](_0x31905e)[_0xfab6('0x1f')](_0xea4f91);}};}function respondWithFilteredResult(_0x5e0f83,_0x43fc59){return function(_0x4e11b7){if(_0x4e11b7){var _0x256bbe=_0x4e11b7['count'],_0x39328e=_0x43fc59[_0xfab6('0x20')],_0x3c5691=_0x43fc59[_0xfab6('0x20')]+_0x43fc59[_0xfab6('0x21')],_0x4a066a;if(_0x3c5691>=_0x256bbe){_0x3c5691=_0x256bbe;_0x4a066a=0xc8;}else{_0x4a066a=0xce;}_0x5e0f83[_0xfab6('0x1e')](_0x4a066a);return _0x5e0f83['set']('Content-Range',_0x39328e+'-'+_0x3c5691+'/'+_0x256bbe)[_0xfab6('0x1f')](_0x4e11b7);}return null;};}function patchUpdates(_0xd4d00){return function(_0x449b0e){try{jsonpatch['apply'](_0x449b0e,_0xd4d00,!![]);}catch(_0x1f1bc5){return BPromise[_0xfab6('0x22')](_0x1f1bc5);}return _0x449b0e[_0xfab6('0x23')]();};}function saveUpdates(_0x4fe8fc,_0xb44100){return function(_0x2b9639){if(_0x2b9639){return _0x2b9639[_0xfab6('0x24')](_0x4fe8fc)[_0xfab6('0x25')](function(_0x440e38){return _0x440e38;});}return null;};}function removeEntity(_0x301215,_0x2a77ab){return function(_0x1a9bec){if(_0x1a9bec){return _0x1a9bec['destroy']()[_0xfab6('0x25')](function(){var _0x5a94eb=_0x1a9bec[_0xfab6('0x26')]({'plain':!![]});var _0xb04d76=_0xfab6('0x27');return db[_0xfab6('0x28')]['destroy']({'where':{'type':_0xb04d76,'resourceId':_0x5a94eb['id']}})[_0xfab6('0x25')](function(){return _0x1a9bec;});})[_0xfab6('0x25')](function(){_0x301215[_0xfab6('0x1e')](0xcc)[_0xfab6('0x1d')]();});}};}function handleEntityNotFound(_0x2ff6dd,_0x14a1d5){return function(_0x18007d){if(!_0x18007d){_0x2ff6dd[_0xfab6('0x1c')](0x194);}return _0x18007d;};}function handleError(_0x34d12c,_0x6e7af5){_0x6e7af5=_0x6e7af5||0x1f4;return function(_0x4ad29f){logger[_0xfab6('0x29')](_0x4ad29f['stack']);if(_0x4ad29f[_0xfab6('0x2a')]){delete _0x4ad29f[_0xfab6('0x2a')];}_0x34d12c[_0xfab6('0x1e')](_0x6e7af5)[_0xfab6('0x2b')](_0x4ad29f);};}exports[_0xfab6('0x2c')]=function(_0x46d3e6,_0x2970d5){var _0x5aef68={},_0x361deb={},_0x3cca4b={'count':0x0,'rows':[]};var _0x1f0000=_[_0xfab6('0x2d')](db['FaxQueue']['rawAttributes'],function(_0x4e29eb){return{'name':_0x4e29eb[_0xfab6('0x2e')],'type':_0x4e29eb['type'][_0xfab6('0x2f')]};});_0x361deb['model']=_[_0xfab6('0x2d')](_0x1f0000,_0xfab6('0x2a'));_0x361deb[_0xfab6('0x30')]=_[_0xfab6('0x31')](_0x46d3e6['query']);_0x361deb[_0xfab6('0x32')]=_[_0xfab6('0x33')](_0x361deb[_0xfab6('0x34')],_0x361deb['query']);_0x5aef68[_0xfab6('0x35')]=_[_0xfab6('0x33')](_0x361deb[_0xfab6('0x34')],qs['fields'](_0x46d3e6[_0xfab6('0x30')]['fields']));_0x5aef68['attributes']=_0x5aef68[_0xfab6('0x35')][_0xfab6('0x36')]?_0x5aef68[_0xfab6('0x35')]:_0x361deb[_0xfab6('0x34')];if(!_0x46d3e6[_0xfab6('0x30')][_0xfab6('0x37')]('nolimit')){_0x5aef68[_0xfab6('0x21')]=qs[_0xfab6('0x21')](_0x46d3e6[_0xfab6('0x30')][_0xfab6('0x21')]);_0x5aef68[_0xfab6('0x20')]=qs[_0xfab6('0x20')](_0x46d3e6[_0xfab6('0x30')][_0xfab6('0x20')]);}_0x5aef68[_0xfab6('0x38')]=qs['sort'](_0x46d3e6['query'][_0xfab6('0x39')]);_0x5aef68[_0xfab6('0x3a')]=qs[_0xfab6('0x32')](_[_0xfab6('0x3b')](_0x46d3e6[_0xfab6('0x30')],_0x361deb[_0xfab6('0x32')]),_0x1f0000);if(_0x46d3e6[_0xfab6('0x30')][_0xfab6('0x3c')]){_0x5aef68[_0xfab6('0x3a')]=_[_0xfab6('0x3d')](_0x5aef68['where'],{'$or':_[_0xfab6('0x2d')](_0x1f0000,function(_0x22d55d){if(_0x22d55d['type']!==_0xfab6('0x3e')){var _0x48db78={};_0x48db78[_0x22d55d['name']]={'$like':'%'+_0x46d3e6[_0xfab6('0x30')][_0xfab6('0x3c')]+'%'};return _0x48db78;}})});}_0x5aef68=_['merge']({},_0x5aef68,_0x46d3e6['options']);var _0x36b324={'where':_0x5aef68[_0xfab6('0x3a')]};return db[_0xfab6('0x3f')][_0xfab6('0x40')](_0x36b324)[_0xfab6('0x25')](function(_0xbef513){_0x3cca4b[_0xfab6('0x40')]=_0xbef513;if(_0x46d3e6[_0xfab6('0x30')][_0xfab6('0x41')]){_0x5aef68[_0xfab6('0x42')]=[{'all':!![]}];}return db[_0xfab6('0x3f')][_0xfab6('0x43')](_0x5aef68);})[_0xfab6('0x25')](function(_0x5a1d4a){_0x3cca4b[_0xfab6('0x44')]=_0x5a1d4a;return _0x3cca4b;})['then'](respondWithFilteredResult(_0x2970d5,_0x5aef68))['catch'](handleError(_0x2970d5,null));};exports[_0xfab6('0x45')]=function(_0x583b8d,_0x5c74e1){var _0x225137={'raw':!![],'where':{'id':_0x583b8d['params']['id']}},_0x248377={};_0x248377[_0xfab6('0x34')]=_['keys'](db[_0xfab6('0x3f')][_0xfab6('0x46')]);_0x248377[_0xfab6('0x30')]=_[_0xfab6('0x31')](_0x583b8d[_0xfab6('0x30')]);_0x248377['filtears']=_['intersection'](_0x248377[_0xfab6('0x34')],_0x248377[_0xfab6('0x30')]);_0x225137['attributes']=_[_0xfab6('0x33')](_0x248377[_0xfab6('0x34')],qs['fields'](_0x583b8d[_0xfab6('0x30')][_0xfab6('0x47')]));_0x225137[_0xfab6('0x35')]=_0x225137['attributes']['length']?_0x225137['attributes']:_0x248377[_0xfab6('0x34')];if(_0x583b8d['query'][_0xfab6('0x41')]){_0x225137['include']=[{'all':!![]}];}_0x225137=_[_0xfab6('0x3d')]({},_0x225137,_0x583b8d['options']);return db[_0xfab6('0x3f')][_0xfab6('0x48')](_0x225137)[_0xfab6('0x25')](handleEntityNotFound(_0x5c74e1,null))[_0xfab6('0x25')](respondWithResult(_0x5c74e1,null))[_0xfab6('0x49')](handleError(_0x5c74e1,null));};exports[_0xfab6('0x4a')]=function(_0x2a5ccd,_0x5753d2){return db[_0xfab6('0x3f')][_0xfab6('0x4a')](_0x2a5ccd[_0xfab6('0x4b')],{})[_0xfab6('0x25')](function(_0x1f2ffa){var _0x21b2fa=_0x2a5ccd[_0xfab6('0x4c')]['get']({'plain':!![]});if(!_0x21b2fa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21b2fa[_0xfab6('0x4d')]==='user'){var _0x43045e=_0x1f2ffa[_0xfab6('0x26')]({'plain':!![]});var _0x4cad3d=_0xfab6('0x27');return db['UserProfileSection'][_0xfab6('0x48')]({'where':{'name':_0x4cad3d,'userProfileId':_0x21b2fa[_0xfab6('0x4e')]},'raw':!![]})['then'](function(_0x2bd1a9){if(_0x2bd1a9&&_0x2bd1a9['autoAssociation']===0x0){return db[_0xfab6('0x28')][_0xfab6('0x4a')]({'name':_0x43045e[_0xfab6('0x2a')],'resourceId':_0x43045e['id'],'type':_0x2bd1a9[_0xfab6('0x2a')],'sectionId':_0x2bd1a9['id']},{})[_0xfab6('0x25')](function(){return _0x1f2ffa;});}else{return _0x1f2ffa;}})[_0xfab6('0x49')](function(_0x48d36f){logger['error'](_0xfab6('0x4f'),_0x48d36f);throw _0x48d36f;});}return _0x1f2ffa;})['then'](respondWithResult(_0x5753d2,0xc9))['catch'](handleError(_0x5753d2,null));};exports[_0xfab6('0x24')]=function(_0x5bf9b1,_0x432d00){if(_0x5bf9b1['body']['id']){delete _0x5bf9b1['body']['id'];}return db[_0xfab6('0x3f')]['find']({'where':{'id':_0x5bf9b1[_0xfab6('0x50')]['id']}})[_0xfab6('0x25')](handleEntityNotFound(_0x432d00,null))['then'](saveUpdates(_0x5bf9b1['body'],null))[_0xfab6('0x25')](respondWithResult(_0x432d00,null))[_0xfab6('0x49')](handleError(_0x432d00,null));};exports[_0xfab6('0x51')]=function(_0x2a086c,_0x25df29){return db[_0xfab6('0x3f')][_0xfab6('0x48')]({'where':{'id':_0x2a086c[_0xfab6('0x50')]['id']}})['then'](handleEntityNotFound(_0x25df29,null))[_0xfab6('0x25')](removeEntity(_0x25df29,null))[_0xfab6('0x49')](handleError(_0x25df29,null));};exports[_0xfab6('0x52')]=function(_0x21c658,_0x50b870){return db[_0xfab6('0x3f')][_0xfab6('0x52')]()[_0xfab6('0x25')](respondWithResult(_0x50b870,null))[_0xfab6('0x49')](handleError(_0x50b870,null));};exports[_0xfab6('0x53')]=function(_0xe1b7c5,_0x240bf5,_0x31f5ce){var _0x112793={'raw':!![],'where':{}},_0x3a46a2={},_0x46a7c5;return db[_0xfab6('0x3f')]['findOne']({'where':{'id':_0xe1b7c5[_0xfab6('0x50')]['id']}})[_0xfab6('0x25')](handleEntityNotFound(_0x240bf5,null))[_0xfab6('0x25')](function(_0x6e3cf9){if(_0x6e3cf9){_0x46a7c5=_0x6e3cf9['get']({'plain':!![]});_0x3a46a2['model']=_[_0xfab6('0x31')](db[_0xfab6('0x54')][_0xfab6('0x46')]);_0x3a46a2[_0xfab6('0x30')]=_[_0xfab6('0x31')](_0xe1b7c5[_0xfab6('0x30')]);_0x3a46a2['filters']=_[_0xfab6('0x33')](_0x3a46a2[_0xfab6('0x34')],_0x3a46a2[_0xfab6('0x30')]);_0x112793[_0xfab6('0x35')]=_[_0xfab6('0x33')](_0x3a46a2[_0xfab6('0x34')],qs['fields'](_0xe1b7c5[_0xfab6('0x30')][_0xfab6('0x47')]));_0x112793[_0xfab6('0x35')]=_0x112793[_0xfab6('0x35')][_0xfab6('0x36')]?_0x112793['attributes']:_0x3a46a2[_0xfab6('0x34')];if(!_0xe1b7c5[_0xfab6('0x30')][_0xfab6('0x37')](_0xfab6('0x55'))){_0x112793[_0xfab6('0x21')]=qs[_0xfab6('0x21')](_0xe1b7c5[_0xfab6('0x30')][_0xfab6('0x21')]);_0x112793[_0xfab6('0x20')]=qs['offset'](_0xe1b7c5[_0xfab6('0x30')][_0xfab6('0x20')]);}_0x112793[_0xfab6('0x38')]=qs[_0xfab6('0x39')](_0xe1b7c5[_0xfab6('0x30')][_0xfab6('0x39')]);_0x112793[_0xfab6('0x3a')]=qs[_0xfab6('0x32')](_['pick'](_0xe1b7c5['query'],_0x3a46a2['filters']));_0x112793[_0xfab6('0x3a')][_0xfab6('0x56')]=_0x6e3cf9['id'];if(_0xe1b7c5['query'][_0xfab6('0x3c')]){_0x112793['where']=_[_0xfab6('0x3d')](_0x112793[_0xfab6('0x3a')],{'$or':_[_0xfab6('0x2d')](_0x112793['attributes'],function(_0x3da7f3){var _0x403ab7={};_0x403ab7[_0x3da7f3]={'$like':'%'+_0xe1b7c5[_0xfab6('0x30')][_0xfab6('0x3c')]+'%'};return _0x403ab7;})});}_0x112793=_[_0xfab6('0x3d')]({},_0x112793,_0xe1b7c5[_0xfab6('0x57')]);return db['UserFaxQueue']['findAll'](_0x112793);}})[_0xfab6('0x25')](function(_0x5af4d1){if(_0x5af4d1){return db['User'][_0xfab6('0x58')]({'where':{'id':_[_0xfab6('0x2d')](_0x5af4d1,_0xfab6('0x59')),'role':_0xfab6('0x5a')},'attributes':['id',_0xfab6('0x2a'),_0xfab6('0x5b'),_0xfab6('0x5c'),_0xfab6('0x5d')]});}})[_0xfab6('0x25')](function(_0x83fbd6){if(_0x83fbd6){return{'count':_0x83fbd6[_0xfab6('0x40')],'rows':_[_0xfab6('0x2d')](_0x83fbd6[_0xfab6('0x44')],function(_0x5785d8){return{'membername':_0x5785d8[_0xfab6('0x2a')],'UserId':_0x5785d8['id'],'queue_name':_0x46a7c5['name'],'FaxQueueId':_0x46a7c5['id'],'interface':util[_0xfab6('0x5e')](_0xfab6('0x5f'),'SIP',_0x5785d8[_0xfab6('0x2a')]),'penalty':0x0,'paused':_0x5785d8['faxPause'],'createdAt':_0x5785d8[_0xfab6('0x5d')],'updatedAt':_0x5785d8['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xfab6('0x25')](respondWithFilteredResult(_0x240bf5,_0x112793))['catch'](handleError(_0x240bf5,null));};exports[_0xfab6('0x60')]=function(_0x5f31d2,_0x48673b,_0x211c8a){var _0x23fc46={};var _0x1e8668={};var _0x57eeee;var _0x510ece;return db[_0xfab6('0x3f')][_0xfab6('0x61')]({'where':{'id':_0x5f31d2[_0xfab6('0x50')]['id']}})[_0xfab6('0x25')](handleEntityNotFound(_0x48673b,null))[_0xfab6('0x25')](function(_0x975d1){if(_0x975d1){_0x57eeee=_0x975d1;_0x1e8668[_0xfab6('0x34')]=_['keys'](db[_0xfab6('0x62')][_0xfab6('0x46')]);_0x1e8668[_0xfab6('0x30')]=_[_0xfab6('0x31')](_0x5f31d2[_0xfab6('0x30')]);_0x1e8668[_0xfab6('0x32')]=_[_0xfab6('0x33')](_0x1e8668[_0xfab6('0x34')],_0x1e8668['query']);_0x23fc46[_0xfab6('0x35')]=_[_0xfab6('0x33')](_0x1e8668[_0xfab6('0x34')],qs[_0xfab6('0x47')](_0x5f31d2['query']['fields']));_0x23fc46['attributes']=_0x23fc46['attributes'][_0xfab6('0x36')]?_0x23fc46['attributes']:_0x1e8668[_0xfab6('0x34')];_0x23fc46[_0xfab6('0x38')]=qs[_0xfab6('0x39')](_0x5f31d2[_0xfab6('0x30')]['sort']);_0x23fc46['where']=qs[_0xfab6('0x32')](_[_0xfab6('0x3b')](_0x5f31d2[_0xfab6('0x30')],_0x1e8668['filters']));if(_0x5f31d2[_0xfab6('0x30')][_0xfab6('0x3c')]){_0x23fc46['where']=_[_0xfab6('0x3d')](_0x23fc46[_0xfab6('0x3a')],{'$or':_[_0xfab6('0x2d')](_0x23fc46['attributes'],function(_0x2ff84f){var _0x13bf55={};_0x13bf55[_0x2ff84f]={'$like':'%'+_0x5f31d2[_0xfab6('0x30')][_0xfab6('0x3c')]+'%'};return _0x13bf55;})});}_0x23fc46=_[_0xfab6('0x3d')]({},_0x23fc46,_0x5f31d2[_0xfab6('0x57')]);return _0x57eeee[_0xfab6('0x60')](_0x23fc46);}})[_0xfab6('0x25')](function(_0x1a6519){if(_0x1a6519){_0x510ece=_0x1a6519[_0xfab6('0x36')];if(!_0x5f31d2['query'][_0xfab6('0x37')](_0xfab6('0x55'))){_0x23fc46[_0xfab6('0x21')]=qs[_0xfab6('0x21')](_0x5f31d2[_0xfab6('0x30')][_0xfab6('0x21')]);_0x23fc46['offset']=qs[_0xfab6('0x20')](_0x5f31d2['query'][_0xfab6('0x20')]);}return _0x57eeee[_0xfab6('0x60')](_0x23fc46);}})[_0xfab6('0x25')](function(_0x52e004){if(_0x52e004){return _0x52e004?{'count':_0x510ece,'rows':_0x52e004}:null;}})[_0xfab6('0x25')](respondWithResult(_0x48673b,null))[_0xfab6('0x49')](handleError(_0x48673b,null));};exports[_0xfab6('0x63')]=function(_0x46749a,_0x31f6df,_0x29d103){var _0x4814f5=_0x46749a[_0xfab6('0x4b')][_0xfab6('0x64')];return db[_0xfab6('0x62')][_0xfab6('0x43')]({'where':{'id':_0x4814f5},'attributes':['id'],'include':[{'model':db[_0xfab6('0x65')],'as':'Agents','attributes':['id','name',_0xfab6('0x66'),'voicePause',_0xfab6('0x67')],'raw':!![]}]})[_0xfab6('0x25')](function(_0x2bab58){if(_0x2bab58){var _0x2f9a41=_['flatMap'](_0x2bab58,function(_0x18e4c5){var _0x29dd2f=_0x18e4c5[_0xfab6('0x26')]({'plain':!![]});return _0x29dd2f[_0xfab6('0x68')];});return db[_0xfab6('0x3f')][_0xfab6('0x48')]({'where':{'id':_0x46749a[_0xfab6('0x50')]['id']}})[_0xfab6('0x25')](function(_0x47e7bf){return db[_0xfab6('0x69')][_0xfab6('0x6a')](function(_0x1f8036){return _0x47e7bf[_0xfab6('0x63')](_0x4814f5,{'transaction':_0x1f8036})['then'](function(){return BPromise[_0xfab6('0x6b')](_0x2f9a41,function(_0x3f0c51){return db['UserFaxQueue'][_0xfab6('0x6c')]({'where':{'UserId':_0x3f0c51['id'],'FaxQueueId':_0x46749a[_0xfab6('0x50')]['id']},'transaction':_0x1f8036});});})[_0xfab6('0x25')](function(){_0x2f9a41[_0xfab6('0x6d')](function(_0x5c0e9c){socket['emit'](_0xfab6('0x6e'),{'UserId':_0x5c0e9c['id'],'FaxQueueId':_0x47e7bf['id']});});});});});}})[_0xfab6('0x25')](respondWithStatusCode(_0x31f6df,null))[_0xfab6('0x49')](handleError(_0x31f6df,null));};exports[_0xfab6('0x6f')]=function(_0x4c752a,_0x5f0601,_0x184a4a){return db['Team']['findAll']({'where':{'id':_0x4c752a[_0xfab6('0x30')]['ids']},'attributes':['id'],'include':[{'model':db[_0xfab6('0x65')],'as':_0xfab6('0x68'),'attributes':['id'],'raw':!![]}]})[_0xfab6('0x25')](handleEntityNotFound(_0x5f0601,null))[_0xfab6('0x25')](function(_0x43817d){var _0x541e61=_[_0xfab6('0x2d')](_0x43817d,'id');var _0x38ff65=[];var _0x392ee4=[];var _0x2192fc=squel[_0xfab6('0x70')]();_0x2192fc['field'](_0xfab6('0x71'))[_0xfab6('0x72')](_0xfab6('0x73'),'tq')[_0xfab6('0x74')](_0xfab6('0x75'),'ut',_0xfab6('0x76'))[_0xfab6('0x3a')](_0xfab6('0x77'),_0x4c752a[_0xfab6('0x50')]['id']);for(var _0x66e922=0x0;_0x66e922<_0x43817d[_0xfab6('0x36')];_0x66e922+=0x1){let _0x21b04b=_0x43817d[_0x66e922];for(var _0x569a44=0x0;_0x569a44<_0x21b04b[_0xfab6('0x68')][_0xfab6('0x36')];_0x569a44+=0x1){let _0x504541=_0x21b04b[_0xfab6('0x68')][_0x569a44];var _0x425001=_0x2192fc[_0xfab6('0x78')]();_0x425001[_0xfab6('0x3a')](_0xfab6('0x79'),_0x504541['id']);_0x392ee4[_0xfab6('0x7a')](db[_0xfab6('0x69')][_0xfab6('0x30')](_0x425001[_0xfab6('0x7b')](),{'type':db[_0xfab6('0x69')][_0xfab6('0x7c')][_0xfab6('0x7d')]})[_0xfab6('0x25')](function(_0x5e4572){if(_0x5e4572[_0xfab6('0x36')]===0x1){return _0x504541['id'];}else{var _0x15c19b=_['every'](_[_0xfab6('0x2d')](_0x5e4572,_0xfab6('0x7e')),function(_0x20eeed){return _[_0xfab6('0x7f')](_0x541e61,_0x20eeed);});if(_0x15c19b){return _0x504541['id'];}}}));}}return BPromise['all'](_0x392ee4)[_0xfab6('0x25')](function(_0x390a71){_0x38ff65=_(_0x38ff65)['union'](_0x390a71)[_0xfab6('0x80')]()['value']();return db[_0xfab6('0x3f')][_0xfab6('0x48')]({'where':{'id':_0x4c752a[_0xfab6('0x50')]['id']}})['then'](function(_0x1b1b94){return db[_0xfab6('0x69')][_0xfab6('0x6a')](function(_0x3e6a81){return _0x1b1b94[_0xfab6('0x6f')](_0x4c752a[_0xfab6('0x30')][_0xfab6('0x64')],{'transaction':_0x3e6a81})[_0xfab6('0x25')](function(){if(!_['isEmpty'](_0x38ff65)){return _0x1b1b94[_0xfab6('0x81')](_0x38ff65,{'transaction':_0x3e6a81});}})[_0xfab6('0x25')](function(){_0x38ff65[_0xfab6('0x6d')](function(_0x2b7c55){socket['emit']('userFaxQueue:remove',{'UserId':_0x2b7c55,'FaxQueueId':_0x1b1b94['id']});});});});});});})[_0xfab6('0x25')](respondWithStatusCode(_0x5f0601,null))['catch'](handleError(_0x5f0601,null));};exports[_0xfab6('0x82')]=function(_0x558f1e,_0x285342,_0xbc3740){return db['FaxQueue'][_0xfab6('0x48')]({'where':{'id':_0x558f1e[_0xfab6('0x50')]['id']}})[_0xfab6('0x25')](handleEntityNotFound(_0x285342,null))[_0xfab6('0x25')](function(_0x1e74aa){if(_0x1e74aa){return _0x1e74aa[_0xfab6('0x82')](_0x558f1e[_0xfab6('0x4b')][_0xfab6('0x64')],_[_0xfab6('0x83')](_0x558f1e[_0xfab6('0x4b')],[_0xfab6('0x64'),'id'])||{})['spread'](function(_0x5af92d){for(var _0x30b3fc=0x0;_0x30b3fc<_0x558f1e[_0xfab6('0x4b')][_0xfab6('0x64')][_0xfab6('0x36')];_0x30b3fc+=0x1){socket['emit'](_0xfab6('0x6e'),{'UserId':_0x558f1e[_0xfab6('0x4b')][_0xfab6('0x64')][_0x30b3fc],'FaxQueueId':_0x558f1e[_0xfab6('0x50')]['id']});}return _0x5af92d;});}})[_0xfab6('0x25')](respondWithResult(_0x285342,null))[_0xfab6('0x49')](handleError(_0x285342,null));};exports[_0xfab6('0x81')]=function(_0x170d86,_0x3fb285,_0xb54bc8){return db[_0xfab6('0x3f')][_0xfab6('0x48')]({'where':{'id':_0x170d86[_0xfab6('0x50')]['id']}})[_0xfab6('0x25')](handleEntityNotFound(_0x3fb285,null))['then'](function(_0x366406){if(_0x366406){return _0x366406['removeAgents'](_0x170d86['query'][_0xfab6('0x64')])['then'](function(){if(_[_0xfab6('0x84')](_0x170d86[_0xfab6('0x30')][_0xfab6('0x64')])){for(var _0x37e22a=0x0;_0x37e22a<_0x170d86[_0xfab6('0x30')][_0xfab6('0x64')]['length'];_0x37e22a+=0x1){socket[_0xfab6('0x85')](_0xfab6('0x86'),{'UserId':Number(_0x170d86[_0xfab6('0x30')][_0xfab6('0x64')][_0x37e22a]),'FaxQueueId':Number(_0x170d86[_0xfab6('0x50')]['id'])});}}else{socket[_0xfab6('0x85')](_0xfab6('0x86'),{'UserId':Number(_0x170d86[_0xfab6('0x30')][_0xfab6('0x64')]),'FaxQueueId':Number(_0x170d86[_0xfab6('0x50')]['id'])});}});}})[_0xfab6('0x25')](respondWithStatusCode(_0x3fb285,null))[_0xfab6('0x49')](handleError(_0x3fb285,null));};exports['getAgents']=function(_0x4f0645,_0x224945,_0x367cfd){var _0x36bf7b={};var _0x54d83c={};var _0x3d5b41;var _0x574069;return db[_0xfab6('0x3f')][_0xfab6('0x61')]({'where':{'id':_0x4f0645[_0xfab6('0x50')]['id']}})[_0xfab6('0x25')](handleEntityNotFound(_0x224945,null))[_0xfab6('0x25')](function(_0x263c7b){if(_0x263c7b){_0x3d5b41=_0x263c7b;_0x54d83c[_0xfab6('0x34')]=_[_0xfab6('0x31')](db[_0xfab6('0x65')][_0xfab6('0x46')]);_0x54d83c[_0xfab6('0x30')]=_[_0xfab6('0x31')](_0x4f0645[_0xfab6('0x30')]);_0x54d83c[_0xfab6('0x32')]=_[_0xfab6('0x33')](_0x54d83c[_0xfab6('0x34')],_0x54d83c[_0xfab6('0x30')]);_0x36bf7b['attributes']=_['intersection'](_0x54d83c[_0xfab6('0x34')],qs[_0xfab6('0x47')](_0x4f0645[_0xfab6('0x30')][_0xfab6('0x47')]));_0x36bf7b[_0xfab6('0x35')]=_0x36bf7b[_0xfab6('0x35')][_0xfab6('0x36')]?_0x36bf7b[_0xfab6('0x35')]:_0x54d83c[_0xfab6('0x34')];_0x36bf7b['order']=qs['sort'](_0x4f0645[_0xfab6('0x30')][_0xfab6('0x39')]);_0x36bf7b[_0xfab6('0x3a')]=qs[_0xfab6('0x32')](_[_0xfab6('0x3b')](_0x4f0645[_0xfab6('0x30')],_0x54d83c[_0xfab6('0x32')]));if(_0x4f0645[_0xfab6('0x30')]['filter']){_0x36bf7b['where']=_['merge'](_0x36bf7b['where'],{'$or':_[_0xfab6('0x2d')](_0x36bf7b['attributes'],function(_0x5225fe){var _0x308ad8={};_0x308ad8[_0x5225fe]={'$like':'%'+_0x4f0645['query'][_0xfab6('0x3c')]+'%'};return _0x308ad8;})});}_0x36bf7b=_[_0xfab6('0x3d')]({},_0x36bf7b,_0x4f0645[_0xfab6('0x57')]);return _0x3d5b41['getAgents'](_0x36bf7b);}})[_0xfab6('0x25')](function(_0x25ceb7){if(_0x25ceb7){_0x574069=_0x25ceb7[_0xfab6('0x36')];if(!_0x4f0645[_0xfab6('0x30')][_0xfab6('0x37')](_0xfab6('0x55'))){_0x36bf7b[_0xfab6('0x21')]=qs[_0xfab6('0x21')](_0x4f0645['query'][_0xfab6('0x21')]);_0x36bf7b['offset']=qs[_0xfab6('0x20')](_0x4f0645[_0xfab6('0x30')][_0xfab6('0x20')]);}return _0x3d5b41[_0xfab6('0x87')](_0x36bf7b);}})[_0xfab6('0x25')](function(_0x23bf64){if(_0x23bf64){return _0x23bf64?{'count':_0x574069,'rows':_0x23bf64}:null;}})[_0xfab6('0x25')](respondWithResult(_0x224945,null))[_0xfab6('0x49')](handleError(_0x224945,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 6f1db7f..1758c35 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 _0x8ea8=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x8ea8,0xed));var _0x88ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ea8[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x88ea('0x0'))['db'][_0x88ea('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x88ea('0x2')](0x0);var events={'afterCreate':_0x88ea('0x3'),'afterUpdate':_0x88ea('0x4'),'afterDestroy':_0x88ea('0x5')};function emitEvent(_0x28332c){return function(_0x363b7a,_0x260610,_0x45ee80){FaxQueueEvents[_0x88ea('0x6')](_0x28332c+':'+_0x363b7a['id'],_0x363b7a);FaxQueueEvents[_0x88ea('0x6')](_0x28332c,_0x363b7a);_0x45ee80(null);};}for(var e in events){if(events[_0x88ea('0x7')](e)){var event=events[e];FaxQueue[_0x88ea('0x8')](e,emitEvent(event));}}module[_0x88ea('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x78bd=['events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty','exports'];(function(_0x150e6b,_0x65b66){var _0x1d3ffa=function(_0x16fccb){while(--_0x16fccb){_0x150e6b['push'](_0x150e6b['shift']());}};_0x1d3ffa(++_0x65b66);}(_0x78bd,0x19e));var _0xd78b=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x78bd[_0x9fd887];return _0x1a54ab;};'use strict';var EventEmitter=require(_0xd78b('0x0'));var FaxQueue=require(_0xd78b('0x1'))['db'][_0xd78b('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xd78b('0x3')](0x0);var events={'afterCreate':_0xd78b('0x4'),'afterUpdate':_0xd78b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x25b093){return function(_0x39349d,_0x124cd8,_0x38a844){FaxQueueEvents[_0xd78b('0x6')](_0x25b093+':'+_0x39349d['id'],_0x39349d);FaxQueueEvents[_0xd78b('0x6')](_0x25b093,_0x39349d);_0x38a844(null);};}for(var e in events){if(events[_0xd78b('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xd78b('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index d0c8629..4a75cf4 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 _0x7d53=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./faxQueue.attributes','exports','define','FaxQueue','fax_queues'];(function(_0x3b905d,_0x1e8305){var _0x56f03c=function(_0x4940e5){while(--_0x4940e5){_0x3b905d['push'](_0x3b905d['shift']());}};_0x56f03c(++_0x1e8305);}(_0x7d53,0x108));var _0x37d5=function(_0x4b9e88,_0x4bf7be){_0x4b9e88=_0x4b9e88-0x0;var _0x1bbc49=_0x7d53[_0x4b9e88];return _0x1bbc49;};'use strict';var _=require(_0x37d5('0x0'));var util=require(_0x37d5('0x1'));var logger=require(_0x37d5('0x2'))(_0x37d5('0x3'));var moment=require(_0x37d5('0x4'));var BPromise=require(_0x37d5('0x5'));var rp=require(_0x37d5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x37d5('0x7'));module[_0x37d5('0x8')]=function(_0x31ddbb,_0x125c84){return _0x31ddbb[_0x37d5('0x9')](_0x37d5('0xa'),attributes,{'tableName':_0x37d5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x421b=['define','fax_queues','util','../../config/logger','bluebird','request-promise','path','../../config/environment','exports'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x421b,0x185));var _0xb421=function(_0x58b0de,_0xb0a80a){_0x58b0de=_0x58b0de-0x0;var _0xc00ec3=_0x421b[_0x58b0de];return _0xc00ec3;};'use strict';var _=require('lodash');var util=require(_0xb421('0x0'));var logger=require(_0xb421('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb421('0x2'));var rp=require(_0xb421('0x3'));var fs=require('fs');var path=require(_0xb421('0x4'));var rimraf=require('rimraf');var config=require(_0xb421('0x5'));var attributes=require('./faxQueue.attributes');module[_0xb421('0x6')]=function(_0x11641a,_0x4f02ef){return _0x11641a[_0xb421('0x7')]('FaxQueue',attributes,{'tableName':_0xb421('0x8'),'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 60a1206..e53b159 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 _0xe438=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','then','info','request\x20sent','debug','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','FaxQueue','findAll','options','where','attributes','limit','map','include','model','GetFaxQueue','find','raw','ShowFaxQueue','lodash','util','moment'];(function(_0x29c7ed,_0x389f4b){var _0x22b24d=function(_0x512d23){while(--_0x512d23){_0x29c7ed['push'](_0x29c7ed['shift']());}};_0x22b24d(++_0x389f4b);}(_0xe438,0x179));var _0x8e43=function(_0x540946,_0x85ed6c){_0x540946=_0x540946-0x0;var _0x15bf13=_0xe438[_0x540946];return _0x15bf13;};'use strict';var _=require(_0x8e43('0x0'));var util=require(_0x8e43('0x1'));var moment=require(_0x8e43('0x2'));var BPromise=require('bluebird');var rs=require(_0x8e43('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e43('0x4'))['db'];var utils=require(_0x8e43('0x5'));var logger=require(_0x8e43('0x6'))('rpc');var config=require(_0x8e43('0x7'));var jayson=require(_0x8e43('0x8'));var client=jayson['client'][_0x8e43('0x9')]({'port':0x232a});config[_0x8e43('0xa')]=_[_0x8e43('0xb')](config[_0x8e43('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8e43('0xc'))(new Redis(config[_0x8e43('0xa')]));require(_0x8e43('0xd'))[_0x8e43('0xe')](socket);function respondWithRpcPromise(_0x2e6ff5,_0x104011,_0x210b82){return new BPromise(function(_0x1743cd,_0x5897f0){return client['request'](_0x2e6ff5,_0x210b82)[_0x8e43('0xf')](function(_0x50a8ab){logger[_0x8e43('0x10')]('FaxQueue,\x20%s,\x20%s',_0x104011,_0x8e43('0x11'));logger[_0x8e43('0x12')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x104011,_0x8e43('0x11'),JSON['stringify'](_0x50a8ab));if(_0x50a8ab['error']){if(_0x50a8ab[_0x8e43('0x13')][_0x8e43('0x14')]===0x1f4){logger[_0x8e43('0x13')](_0x8e43('0x15'),_0x104011,_0x50a8ab[_0x8e43('0x13')][_0x8e43('0x16')]);return _0x5897f0(_0x50a8ab[_0x8e43('0x13')]['message']);}logger[_0x8e43('0x13')](_0x8e43('0x15'),_0x104011,_0x50a8ab[_0x8e43('0x13')][_0x8e43('0x16')]);return _0x1743cd(_0x50a8ab[_0x8e43('0x13')][_0x8e43('0x16')]);}else{logger[_0x8e43('0x10')](_0x8e43('0x15'),_0x104011,'request\x20sent');_0x1743cd(_0x50a8ab[_0x8e43('0x17')][_0x8e43('0x16')]);}})[_0x8e43('0x18')](function(_0x469183){logger['error'](_0x8e43('0x15'),_0x104011,_0x469183);_0x5897f0(_0x469183);});});}exports['GetFaxQueue']=function(_0x501698){var _0x55597a=this;return new Promise(function(_0x3cf518,_0x563e85){return db[_0x8e43('0x19')][_0x8e43('0x1a')]({'raw':_0x501698[_0x8e43('0x1b')]?_0x501698[_0x8e43('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x501698[_0x8e43('0x1b')]?_0x501698[_0x8e43('0x1b')][_0x8e43('0x1c')]||null:null,'attributes':_0x501698[_0x8e43('0x1b')]?_0x501698[_0x8e43('0x1b')][_0x8e43('0x1d')]||null:null,'limit':_0x501698[_0x8e43('0x1b')]?_0x501698[_0x8e43('0x1b')][_0x8e43('0x1e')]||null:null,'include':_0x501698[_0x8e43('0x1b')]?_0x501698[_0x8e43('0x1b')]['include']?_[_0x8e43('0x1f')](_0x501698[_0x8e43('0x1b')][_0x8e43('0x20')],function(_0x4d6fd7){return{'model':db[_0x4d6fd7['model']],'as':_0x4d6fd7['as'],'attributes':_0x4d6fd7[_0x8e43('0x1d')],'include':_0x4d6fd7[_0x8e43('0x20')]?_[_0x8e43('0x1f')](_0x4d6fd7[_0x8e43('0x20')],function(_0x3e8dc7){return{'model':db[_0x3e8dc7[_0x8e43('0x21')]],'as':_0x3e8dc7['as'],'attributes':_0x3e8dc7[_0x8e43('0x1d')],'include':_0x3e8dc7[_0x8e43('0x20')]?_[_0x8e43('0x1f')](_0x3e8dc7[_0x8e43('0x20')],function(_0x25ad71){return{'model':db[_0x25ad71[_0x8e43('0x21')]],'as':_0x25ad71['as'],'attributes':_0x25ad71[_0x8e43('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8e43('0xf')](function(_0x441333){logger[_0x8e43('0x10')]('GetFaxQueue',_0x501698);logger[_0x8e43('0x12')]('GetFaxQueue',_0x501698,JSON['stringify'](_0x441333));_0x3cf518(_0x441333);})['catch'](function(_0x19aeb4){logger[_0x8e43('0x13')](_0x8e43('0x22'),_0x19aeb4[_0x8e43('0x16')],_0x501698);_0x563e85(_0x55597a['error'](0x1f4,_0x19aeb4[_0x8e43('0x16')]));});});};exports['ShowFaxQueue']=function(_0x206c18){var _0x14a96f=this;return new Promise(function(_0x5eb8b9,_0x27c4df){return db[_0x8e43('0x19')][_0x8e43('0x23')]({'raw':_0x206c18[_0x8e43('0x1b')]?_0x206c18['options'][_0x8e43('0x24')]===undefined?!![]:![]:!![],'where':_0x206c18['options']?_0x206c18['options'][_0x8e43('0x1c')]||null:null,'attributes':_0x206c18[_0x8e43('0x1b')]?_0x206c18[_0x8e43('0x1b')][_0x8e43('0x1d')]||null:null,'include':_0x206c18[_0x8e43('0x1b')]?_0x206c18['options'][_0x8e43('0x20')]?_['map'](_0x206c18[_0x8e43('0x1b')]['include'],function(_0x2768ac){return{'model':db[_0x2768ac[_0x8e43('0x21')]],'as':_0x2768ac['as'],'attributes':_0x2768ac[_0x8e43('0x1d')],'include':_0x2768ac[_0x8e43('0x20')]?_[_0x8e43('0x1f')](_0x2768ac[_0x8e43('0x20')],function(_0x5dc2d){return{'model':db[_0x5dc2d[_0x8e43('0x21')]],'as':_0x5dc2d['as'],'attributes':_0x5dc2d[_0x8e43('0x1d')],'include':_0x5dc2d[_0x8e43('0x20')]?_[_0x8e43('0x1f')](_0x5dc2d[_0x8e43('0x20')],function(_0x355acf){return{'model':db[_0x355acf[_0x8e43('0x21')]],'as':_0x355acf['as'],'attributes':_0x355acf[_0x8e43('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8e43('0xf')](function(_0x2c13ac){logger[_0x8e43('0x10')](_0x8e43('0x25'),_0x206c18);logger['debug']('ShowFaxQueue',_0x206c18,JSON['stringify'](_0x2c13ac));_0x5eb8b9(_0x2c13ac);})['catch'](function(_0x3c47b9){logger[_0x8e43('0x13')](_0x8e43('0x25'),_0x3c47b9[_0x8e43('0x16')],_0x206c18);_0x27c4df(_0x14a96f[_0x8e43('0x13')](0x1f4,_0x3c47b9['message']));});});}; \ No newline at end of file +var _0x6c5a=['FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','info','ShowFaxQueue','lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','request\x20sent','debug'];(function(_0x5d0786,_0x15f63c){var _0x321db6=function(_0x2a5020){while(--_0x2a5020){_0x5d0786['push'](_0x5d0786['shift']());}};_0x321db6(++_0x15f63c);}(_0x6c5a,0xe2));var _0xa6c5=function(_0x42ab9c,_0x13dc8a){_0x42ab9c=_0x42ab9c-0x0;var _0x1b2de0=_0x6c5a[_0x42ab9c];return _0x1b2de0;};'use strict';var _=require(_0xa6c5('0x0'));var util=require(_0xa6c5('0x1'));var moment=require('moment');var BPromise=require(_0xa6c5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6c5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa6c5('0x4'));var logger=require('../../config/logger')(_0xa6c5('0x5'));var config=require(_0xa6c5('0x6'));var jayson=require(_0xa6c5('0x7'));var client=jayson[_0xa6c5('0x8')][_0xa6c5('0x9')]({'port':0x232a});config[_0xa6c5('0xa')]=_[_0xa6c5('0xb')](config[_0xa6c5('0xa')],{'host':_0xa6c5('0xc'),'port':0x18eb});var socket=require(_0xa6c5('0xd'))(new Redis(config['redis']));require(_0xa6c5('0xe'))[_0xa6c5('0xf')](socket);function respondWithRpcPromise(_0x4b4cb9,_0x55e583,_0x3cf709){return new BPromise(function(_0x5e23b3,_0x30687e){return client[_0xa6c5('0x10')](_0x4b4cb9,_0x3cf709)[_0xa6c5('0x11')](function(_0x21da15){logger['info']('FaxQueue,\x20%s,\x20%s',_0x55e583,_0xa6c5('0x12'));logger[_0xa6c5('0x13')](_0xa6c5('0x14'),_0x55e583,_0xa6c5('0x12'),JSON[_0xa6c5('0x15')](_0x21da15));if(_0x21da15[_0xa6c5('0x16')]){if(_0x21da15[_0xa6c5('0x16')][_0xa6c5('0x17')]===0x1f4){logger[_0xa6c5('0x16')](_0xa6c5('0x18'),_0x55e583,_0x21da15['error'][_0xa6c5('0x19')]);return _0x30687e(_0x21da15['error'][_0xa6c5('0x19')]);}logger[_0xa6c5('0x16')](_0xa6c5('0x18'),_0x55e583,_0x21da15[_0xa6c5('0x16')][_0xa6c5('0x19')]);return _0x5e23b3(_0x21da15[_0xa6c5('0x16')][_0xa6c5('0x19')]);}else{logger['info'](_0xa6c5('0x18'),_0x55e583,_0xa6c5('0x12'));_0x5e23b3(_0x21da15[_0xa6c5('0x1a')][_0xa6c5('0x19')]);}})[_0xa6c5('0x1b')](function(_0x4f55b7){logger[_0xa6c5('0x16')]('FaxQueue,\x20%s,\x20%s',_0x55e583,_0x4f55b7);_0x30687e(_0x4f55b7);});});}exports[_0xa6c5('0x1c')]=function(_0x375574){var _0x467d48=this;return new Promise(function(_0x24bfb4,_0x40b360){return db[_0xa6c5('0x1d')][_0xa6c5('0x1e')]({'raw':_0x375574[_0xa6c5('0x1f')]?_0x375574[_0xa6c5('0x1f')][_0xa6c5('0x20')]===undefined?!![]:![]:!![],'where':_0x375574[_0xa6c5('0x1f')]?_0x375574[_0xa6c5('0x1f')][_0xa6c5('0x21')]||null:null,'attributes':_0x375574[_0xa6c5('0x1f')]?_0x375574[_0xa6c5('0x1f')][_0xa6c5('0x22')]||null:null,'limit':_0x375574[_0xa6c5('0x1f')]?_0x375574[_0xa6c5('0x1f')][_0xa6c5('0x23')]||null:null,'include':_0x375574['options']?_0x375574[_0xa6c5('0x1f')][_0xa6c5('0x24')]?_[_0xa6c5('0x25')](_0x375574[_0xa6c5('0x1f')]['include'],function(_0x35dfae){return{'model':db[_0x35dfae[_0xa6c5('0x26')]],'as':_0x35dfae['as'],'attributes':_0x35dfae['attributes'],'include':_0x35dfae[_0xa6c5('0x24')]?_[_0xa6c5('0x25')](_0x35dfae['include'],function(_0x44a943){return{'model':db[_0x44a943['model']],'as':_0x44a943['as'],'attributes':_0x44a943[_0xa6c5('0x22')],'include':_0x44a943[_0xa6c5('0x24')]?_['map'](_0x44a943[_0xa6c5('0x24')],function(_0x2344f8){return{'model':db[_0x2344f8[_0xa6c5('0x26')]],'as':_0x2344f8['as'],'attributes':_0x2344f8[_0xa6c5('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa6c5('0x11')](function(_0x328ff6){logger[_0xa6c5('0x27')](_0xa6c5('0x1c'),_0x375574);logger['debug'](_0xa6c5('0x1c'),_0x375574,JSON[_0xa6c5('0x15')](_0x328ff6));_0x24bfb4(_0x328ff6);})[_0xa6c5('0x1b')](function(_0xd78bdb){logger[_0xa6c5('0x16')]('GetFaxQueue',_0xd78bdb[_0xa6c5('0x19')],_0x375574);_0x40b360(_0x467d48[_0xa6c5('0x16')](0x1f4,_0xd78bdb[_0xa6c5('0x19')]));});});};exports[_0xa6c5('0x28')]=function(_0x40173b){var _0x5cff78=this;return new Promise(function(_0x71feab,_0x1e27c2){return db[_0xa6c5('0x1d')]['find']({'raw':_0x40173b['options']?_0x40173b['options'][_0xa6c5('0x20')]===undefined?!![]:![]:!![],'where':_0x40173b[_0xa6c5('0x1f')]?_0x40173b[_0xa6c5('0x1f')][_0xa6c5('0x21')]||null:null,'attributes':_0x40173b[_0xa6c5('0x1f')]?_0x40173b[_0xa6c5('0x1f')][_0xa6c5('0x22')]||null:null,'include':_0x40173b[_0xa6c5('0x1f')]?_0x40173b[_0xa6c5('0x1f')][_0xa6c5('0x24')]?_['map'](_0x40173b['options']['include'],function(_0x57931c){return{'model':db[_0x57931c['model']],'as':_0x57931c['as'],'attributes':_0x57931c[_0xa6c5('0x22')],'include':_0x57931c[_0xa6c5('0x24')]?_[_0xa6c5('0x25')](_0x57931c[_0xa6c5('0x24')],function(_0x168e95){return{'model':db[_0x168e95[_0xa6c5('0x26')]],'as':_0x168e95['as'],'attributes':_0x168e95[_0xa6c5('0x22')],'include':_0x168e95[_0xa6c5('0x24')]?_[_0xa6c5('0x25')](_0x168e95['include'],function(_0x29809a){return{'model':db[_0x29809a[_0xa6c5('0x26')]],'as':_0x29809a['as'],'attributes':_0x29809a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x402220){logger[_0xa6c5('0x27')]('ShowFaxQueue',_0x40173b);logger['debug'](_0xa6c5('0x28'),_0x40173b,JSON[_0xa6c5('0x15')](_0x402220));_0x71feab(_0x402220);})[_0xa6c5('0x1b')](function(_0x581c17){logger[_0xa6c5('0x16')](_0xa6c5('0x28'),_0x581c17[_0xa6c5('0x19')],_0x40173b);_0x1e27c2(_0x5cff78[_0xa6c5('0x16')](0x1f4,_0x581c17[_0xa6c5('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 2ab8cea..25afb32 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 _0x851b=['remove','length','faxQueue:','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x851b,0x13b));var _0xb851=function(_0x9ea78f,_0x5105b7){_0x9ea78f=_0x9ea78f-0x0;var _0x2e9d96=_0x851b[_0x9ea78f];return _0x2e9d96;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xb851('0x0'),_0xb851('0x1'),'update'];function createListener(_0x2da7f1,_0xdd503b){return function(_0x10dc9f){_0xdd503b['emit'](_0x2da7f1,_0x10dc9f);};}function removeListener(_0x438fba,_0x53d07b){return function(){FaxQueueEvents['removeListener'](_0x438fba,_0x53d07b);};}exports['register']=function(_0x4aa138){for(var _0x298c10=0x0,_0x393eec=events[_0xb851('0x2')];_0x298c10<_0x393eec;_0x298c10++){var _0x2d3a44=events[_0x298c10];var _0x224456=createListener(_0xb851('0x3')+_0x2d3a44,_0x4aa138);FaxQueueEvents['on'](_0x2d3a44,_0x224456);}}; \ No newline at end of file +var _0x9feb=['removeListener','register','length','faxQueue:','./faxQueue.events','save','remove','emit'];(function(_0x5a0638,_0x500af9){var _0x360ea5=function(_0x272c71){while(--_0x272c71){_0x5a0638['push'](_0x5a0638['shift']());}};_0x360ea5(++_0x500af9);}(_0x9feb,0x1e4));var _0xb9fe=function(_0x1cce43,_0x42ce10){_0x1cce43=_0x1cce43-0x0;var _0x4442c2=_0x9feb[_0x1cce43];return _0x4442c2;};'use strict';var FaxQueueEvents=require(_0xb9fe('0x0'));var events=[_0xb9fe('0x1'),_0xb9fe('0x2'),'update'];function createListener(_0x102300,_0x3713c9){return function(_0x537dfe){_0x3713c9[_0xb9fe('0x3')](_0x102300,_0x537dfe);};}function removeListener(_0x38640f,_0x3fcf64){return function(){FaxQueueEvents[_0xb9fe('0x4')](_0x38640f,_0x3fcf64);};}exports[_0xb9fe('0x5')]=function(_0x4e407b){for(var _0x9e5cca=0x0,_0x57f60e=events[_0xb9fe('0x6')];_0x9e5cca<_0x57f60e;_0x9e5cca++){var _0x2f4848=events[_0x9e5cca];var _0x1a46b1=createListener(_0xb9fe('0x7')+_0x2f4848,_0x4e407b);FaxQueueEvents['on'](_0x2f4848,_0x1a46b1);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index e71014f..ef8e9fa 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','/:id/members','getTeams','getAgents','post','create','addTeams','/:id/users','put','update','delete','destroy','/:id/teams'];(function(_0x3706d5,_0x452e14){var _0x4fb368=function(_0x39328c){while(--_0x39328c){_0x3706d5['push'](_0x3706d5['shift']());}};_0x4fb368(++_0x452e14);}(_0x5f2f,0x73));var _0xf5f2=function(_0x28cf13,_0x26cf35){_0x28cf13=_0x28cf13-0x0;var _0x202155=_0x5f2f[_0x28cf13];return _0x202155;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getMembers']);router[_0xf5f2('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x8')]('/:id/users',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x11')]);router[_0xf5f2('0x10')]('/:id/teams',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x10')](_0xf5f2('0x13'),auth[_0xf5f2('0x9')](),controller['addAgents']);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x15')]);router[_0xf5f2('0x16')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x17')]);router[_0xf5f2('0x16')](_0xf5f2('0x18'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x19')]);router[_0xf5f2('0x16')](_0xf5f2('0x13'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1a')]);module[_0xf5f2('0x1b')]=router; \ No newline at end of file +var _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x5cba78,_0x3e1e1c){var _0x3af348=function(_0x593f90){while(--_0x593f90){_0x5cba78['push'](_0x5cba78['shift']());}};_0x3af348(++_0x3e1e1c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 5c34cf7..d1b491b 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 _0x6238=['moment','sequelize','exports','DATE','STRING'];(function(_0x115cd8,_0x20557d){var _0x33f9eb=function(_0x1cdb75){while(--_0x1cdb75){_0x115cd8['push'](_0x115cd8['shift']());}};_0x33f9eb(++_0x20557d);}(_0x6238,0x136));var _0x8623=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6238[_0x3947c9];return _0x2e7871;};'use strict';var moment=require(_0x8623('0x0'));var Sequelize=require(_0x8623('0x1'));module[_0x8623('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8623('0x3')]},'leaveAt':{'type':Sequelize[_0x8623('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8623('0x4')]}}; \ No newline at end of file +var _0xdafe=['DATE','exports','STRING'];(function(_0x21f456,_0x34c691){var _0x45f23d=function(_0x44e692){while(--_0x44e692){_0x21f456['push'](_0x21f456['shift']());}};_0x45f23d(++_0x34c691);}(_0xdafe,0x79));var _0xedaf=function(_0x4c6e5f,_0xeac330){_0x4c6e5f=_0x4c6e5f-0x0;var _0x453b85=_0xdafe[_0x4c6e5f];return _0x453b85;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xedaf('0x0')]={'uniqueid':{'type':Sequelize[_0xedaf('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xedaf('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xedaf('0x2')]},'acceptAt':{'type':Sequelize[_0xedaf('0x2')]},'exitAt':{'type':Sequelize[_0xedaf('0x2')]},'reason':{'type':Sequelize[_0xedaf('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index a7cbb10..22446ff 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 _0x17ba=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','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','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','offset','order','pick','filter','where','merge','type','options','includeAll','include','catch','show','params','keys','filtears','length','create','body','update','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x17ba,0x1bf));var _0xa17b=function(_0x22919b,_0x2d2f8c){_0x22919b=_0x22919b-0x0;var _0xb10d26=_0x17ba[_0x22919b];return _0xb10d26;};'use strict';var pdf=require(_0xa17b('0x0'));var emlformat=require(_0xa17b('0x1'));var rimraf=require(_0xa17b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa17b('0x3'));var rp=require(_0xa17b('0x4'));var moment=require(_0xa17b('0x5'));var BPromise=require(_0xa17b('0x6'));var Mustache=require(_0xa17b('0x7'));var util=require('util');var path=require(_0xa17b('0x8'));var sox=require(_0xa17b('0x9'));var csv=require(_0xa17b('0xa'));var ejs=require(_0xa17b('0xb'));var fs=require('fs');var _=require(_0xa17b('0xc'));var squel=require(_0xa17b('0xd'));var crypto=require(_0xa17b('0xe'));var jsforce=require(_0xa17b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa17b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa17b('0x10'));var authService=require(_0xa17b('0x11'));var qs=require(_0xa17b('0x12'));var as=require(_0xa17b('0x13'));var hardwareService=require(_0xa17b('0x14'));var logger=require(_0xa17b('0x15'))('api');var utils=require(_0xa17b('0x16'));var config=require(_0xa17b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa17b('0x18'))['db'];function respondWithStatusCode(_0x14897b,_0x159ce7){_0x159ce7=_0x159ce7||0xcc;return function(_0x3d7e7b){if(_0x3d7e7b){return _0x14897b[_0xa17b('0x19')](_0x159ce7);}return _0x14897b[_0xa17b('0x1a')](_0x159ce7)[_0xa17b('0x1b')]();};}function respondWithResult(_0x592990,_0x4e4273){_0x4e4273=_0x4e4273||0xc8;return function(_0x2907af){if(_0x2907af){return _0x592990['status'](_0x4e4273)[_0xa17b('0x1c')](_0x2907af);}};}function respondWithFilteredResult(_0x578349,_0x17c00e){return function(_0x7e941a){if(_0x7e941a){var _0x1e2bf4=_0x7e941a[_0xa17b('0x1d')],_0x580ab2=_0x17c00e['offset'],_0x4f2366=_0x17c00e['offset']+_0x17c00e[_0xa17b('0x1e')],_0x3a0f20;if(_0x4f2366>=_0x1e2bf4){_0x4f2366=_0x1e2bf4;_0x3a0f20=0xc8;}else{_0x3a0f20=0xce;}_0x578349[_0xa17b('0x1a')](_0x3a0f20);return _0x578349[_0xa17b('0x1f')](_0xa17b('0x20'),_0x580ab2+'-'+_0x4f2366+'/'+_0x1e2bf4)['json'](_0x7e941a);}return null;};}function patchUpdates(_0x3588f4){return function(_0x6462c6){try{jsonpatch[_0xa17b('0x21')](_0x6462c6,_0x3588f4,!![]);}catch(_0x482fe0){return BPromise[_0xa17b('0x22')](_0x482fe0);}return _0x6462c6[_0xa17b('0x23')]();};}function saveUpdates(_0x56e4ca,_0x3aab7f){return function(_0xe911da){if(_0xe911da){return _0xe911da['update'](_0x56e4ca)[_0xa17b('0x24')](function(_0x903b4a){return _0x903b4a;});}return null;};}function removeEntity(_0x344263,_0x54f035){return function(_0x31c64f){if(_0x31c64f){return _0x31c64f[_0xa17b('0x25')]()[_0xa17b('0x24')](function(){_0x344263[_0xa17b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x253cdf,_0x18ddac){return function(_0x1446ce){if(!_0x1446ce){_0x253cdf[_0xa17b('0x19')](0x194);}return _0x1446ce;};}function handleError(_0x3ef06d,_0x1e54e0){_0x1e54e0=_0x1e54e0||0x1f4;return function(_0x557df0){logger[_0xa17b('0x26')](_0x557df0[_0xa17b('0x27')]);if(_0x557df0[_0xa17b('0x28')]){delete _0x557df0[_0xa17b('0x28')];}_0x3ef06d['status'](_0x1e54e0)[_0xa17b('0x29')](_0x557df0);};}exports[_0xa17b('0x2a')]=function(_0x203e38,_0x55cb15){var _0x82cade={},_0x51fcf6={},_0x338135={'count':0x0,'rows':[]};var _0x38f274=_[_0xa17b('0x2b')](db[_0xa17b('0x2c')][_0xa17b('0x2d')],function(_0x158259){return{'name':_0x158259[_0xa17b('0x2e')],'type':_0x158259['type'][_0xa17b('0x2f')]};});_0x51fcf6[_0xa17b('0x30')]=_['map'](_0x38f274,_0xa17b('0x28'));_0x51fcf6[_0xa17b('0x31')]=_['keys'](_0x203e38[_0xa17b('0x31')]);_0x51fcf6[_0xa17b('0x32')]=_[_0xa17b('0x33')](_0x51fcf6['model'],_0x51fcf6[_0xa17b('0x31')]);_0x82cade[_0xa17b('0x34')]=_['intersection'](_0x51fcf6['model'],qs[_0xa17b('0x35')](_0x203e38['query'][_0xa17b('0x35')]));_0x82cade['attributes']=_0x82cade[_0xa17b('0x34')]['length']?_0x82cade['attributes']:_0x51fcf6['model'];if(!_0x203e38[_0xa17b('0x31')]['hasOwnProperty'](_0xa17b('0x36'))){_0x82cade['limit']=qs[_0xa17b('0x1e')](_0x203e38[_0xa17b('0x31')][_0xa17b('0x1e')]);_0x82cade['offset']=qs[_0xa17b('0x37')](_0x203e38[_0xa17b('0x31')][_0xa17b('0x37')]);}_0x82cade[_0xa17b('0x38')]=qs['sort'](_0x203e38['query']['sort']);_0x82cade['where']=qs[_0xa17b('0x32')](_[_0xa17b('0x39')](_0x203e38['query'],_0x51fcf6[_0xa17b('0x32')]),_0x38f274);if(_0x203e38[_0xa17b('0x31')][_0xa17b('0x3a')]){_0x82cade[_0xa17b('0x3b')]=_[_0xa17b('0x3c')](_0x82cade['where'],{'$or':_[_0xa17b('0x2b')](_0x38f274,function(_0x434593){if(_0x434593[_0xa17b('0x3d')]!=='VIRTUAL'){var _0x3b828a={};_0x3b828a[_0x434593[_0xa17b('0x28')]]={'$like':'%'+_0x203e38[_0xa17b('0x31')][_0xa17b('0x3a')]+'%'};return _0x3b828a;}})});}_0x82cade=_['merge']({},_0x82cade,_0x203e38[_0xa17b('0x3e')]);var _0x3ff961={'where':_0x82cade['where']};return db[_0xa17b('0x2c')][_0xa17b('0x1d')](_0x3ff961)[_0xa17b('0x24')](function(_0x50b4c0){_0x338135[_0xa17b('0x1d')]=_0x50b4c0;if(_0x203e38[_0xa17b('0x31')][_0xa17b('0x3f')]){_0x82cade[_0xa17b('0x40')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x82cade);})[_0xa17b('0x24')](function(_0x30a60f){_0x338135['rows']=_0x30a60f;return _0x338135;})[_0xa17b('0x24')](respondWithFilteredResult(_0x55cb15,_0x82cade))[_0xa17b('0x41')](handleError(_0x55cb15,null));};exports[_0xa17b('0x42')]=function(_0x2ebcd2,_0x3c63ff){var _0xb87924={'raw':!![],'where':{'id':_0x2ebcd2[_0xa17b('0x43')]['id']}},_0x518c09={};_0x518c09['model']=_[_0xa17b('0x44')](db[_0xa17b('0x2c')][_0xa17b('0x2d')]);_0x518c09[_0xa17b('0x31')]=_['keys'](_0x2ebcd2[_0xa17b('0x31')]);_0x518c09[_0xa17b('0x45')]=_[_0xa17b('0x33')](_0x518c09['model'],_0x518c09[_0xa17b('0x31')]);_0xb87924[_0xa17b('0x34')]=_[_0xa17b('0x33')](_0x518c09[_0xa17b('0x30')],qs[_0xa17b('0x35')](_0x2ebcd2[_0xa17b('0x31')][_0xa17b('0x35')]));_0xb87924['attributes']=_0xb87924['attributes'][_0xa17b('0x46')]?_0xb87924[_0xa17b('0x34')]:_0x518c09[_0xa17b('0x30')];if(_0x2ebcd2[_0xa17b('0x31')][_0xa17b('0x3f')]){_0xb87924[_0xa17b('0x40')]=[{'all':!![]}];}_0xb87924=_[_0xa17b('0x3c')]({},_0xb87924,_0x2ebcd2[_0xa17b('0x3e')]);return db[_0xa17b('0x2c')]['find'](_0xb87924)['then'](handleEntityNotFound(_0x3c63ff,null))[_0xa17b('0x24')](respondWithResult(_0x3c63ff,null))[_0xa17b('0x41')](handleError(_0x3c63ff,null));};exports[_0xa17b('0x47')]=function(_0x4a482f,_0x3e2733){return db['FaxQueueReport'][_0xa17b('0x47')](_0x4a482f[_0xa17b('0x48')],{})['then'](respondWithResult(_0x3e2733,0xc9))[_0xa17b('0x41')](handleError(_0x3e2733,null));};exports[_0xa17b('0x49')]=function(_0x1b1f89,_0x5dc62f){if(_0x1b1f89[_0xa17b('0x48')]['id']){delete _0x1b1f89[_0xa17b('0x48')]['id'];}return db[_0xa17b('0x2c')][_0xa17b('0x4a')]({'where':{'id':_0x1b1f89[_0xa17b('0x43')]['id']}})[_0xa17b('0x24')](handleEntityNotFound(_0x5dc62f,null))[_0xa17b('0x24')](saveUpdates(_0x1b1f89[_0xa17b('0x48')],null))[_0xa17b('0x24')](respondWithResult(_0x5dc62f,null))[_0xa17b('0x41')](handleError(_0x5dc62f,null));};exports['destroy']=function(_0x1b51d9,_0x419267){return db['FaxQueueReport']['find']({'where':{'id':_0x1b51d9['params']['id']}})[_0xa17b('0x24')](handleEntityNotFound(_0x419267,null))[_0xa17b('0x24')](removeEntity(_0x419267,null))[_0xa17b('0x41')](handleError(_0x419267,null));};exports['describe']=function(_0xe25174,_0x4ad6b1){return db[_0xa17b('0x2c')][_0xa17b('0x4b')]()['then'](respondWithResult(_0x4ad6b1,null))[_0xa17b('0x41')](handleError(_0x4ad6b1,null));}; \ No newline at end of file +var _0x8b87=['count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','type','key','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','FaxQueueReport','includeAll','include','findAll','rows','catch','show','rawAttributes','filtears','create','update','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0x377bd1,_0x5b2699){var _0x5d33a6=function(_0x5d45da){while(--_0x5d45da){_0x377bd1['push'](_0x377bd1['shift']());}};_0x5d33a6(++_0x5b2699);}(_0x8b87,0xd6));var _0x78b8=function(_0xe36a93,_0x146ba2){_0xe36a93=_0xe36a93-0x0;var _0x33cc72=_0x8b87[_0xe36a93];return _0x33cc72;};'use strict';var pdf=require(_0x78b8('0x0'));var emlformat=require(_0x78b8('0x1'));var rimraf=require(_0x78b8('0x2'));var zipdir=require(_0x78b8('0x3'));var jsonpatch=require(_0x78b8('0x4'));var rp=require('request-promise');var moment=require(_0x78b8('0x5'));var BPromise=require(_0x78b8('0x6'));var Mustache=require(_0x78b8('0x7'));var util=require(_0x78b8('0x8'));var path=require(_0x78b8('0x9'));var sox=require(_0x78b8('0xa'));var csv=require(_0x78b8('0xb'));var ejs=require(_0x78b8('0xc'));var fs=require('fs');var _=require(_0x78b8('0xd'));var squel=require(_0x78b8('0xe'));var crypto=require(_0x78b8('0xf'));var jsforce=require(_0x78b8('0x10'));var deskjs=require(_0x78b8('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x78b8('0x12'));var Redis=require(_0x78b8('0x13'));var authService=require(_0x78b8('0x14'));var qs=require(_0x78b8('0x15'));var as=require(_0x78b8('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x78b8('0x17'))(_0x78b8('0x18'));var utils=require(_0x78b8('0x19'));var config=require(_0x78b8('0x1a'));var licenseUtil=require(_0x78b8('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a48cb,_0x20d4ed){_0x20d4ed=_0x20d4ed||0xcc;return function(_0x17f403){if(_0x17f403){return _0x5a48cb[_0x78b8('0x1c')](_0x20d4ed);}return _0x5a48cb[_0x78b8('0x1d')](_0x20d4ed)[_0x78b8('0x1e')]();};}function respondWithResult(_0x15a0ba,_0x5e6cb4){_0x5e6cb4=_0x5e6cb4||0xc8;return function(_0x4b4d69){if(_0x4b4d69){return _0x15a0ba[_0x78b8('0x1d')](_0x5e6cb4)[_0x78b8('0x1f')](_0x4b4d69);}};}function respondWithFilteredResult(_0x54cd4e,_0x3a471d){return function(_0x50747a){if(_0x50747a){var _0x14a77f=_0x50747a[_0x78b8('0x20')],_0x152e2f=_0x3a471d[_0x78b8('0x21')],_0x53a24e=_0x3a471d[_0x78b8('0x21')]+_0x3a471d[_0x78b8('0x22')],_0x13743c;if(_0x53a24e>=_0x14a77f){_0x53a24e=_0x14a77f;_0x13743c=0xc8;}else{_0x13743c=0xce;}_0x54cd4e[_0x78b8('0x1d')](_0x13743c);return _0x54cd4e['set'](_0x78b8('0x23'),_0x152e2f+'-'+_0x53a24e+'/'+_0x14a77f)['json'](_0x50747a);}return null;};}function patchUpdates(_0x3e61f9){return function(_0x1d0ab3){try{jsonpatch[_0x78b8('0x24')](_0x1d0ab3,_0x3e61f9,!![]);}catch(_0x19495b){return BPromise[_0x78b8('0x25')](_0x19495b);}return _0x1d0ab3[_0x78b8('0x26')]();};}function saveUpdates(_0x20612b,_0x52d43c){return function(_0x2a8fb4){if(_0x2a8fb4){return _0x2a8fb4['update'](_0x20612b)[_0x78b8('0x27')](function(_0x2d7d7d){return _0x2d7d7d;});}return null;};}function removeEntity(_0x250779,_0x15ed8e){return function(_0x27ac28){if(_0x27ac28){return _0x27ac28[_0x78b8('0x28')]()[_0x78b8('0x27')](function(){_0x250779['status'](0xcc)[_0x78b8('0x1e')]();});}};}function handleEntityNotFound(_0x12267d,_0x2a9a62){return function(_0x32d939){if(!_0x32d939){_0x12267d[_0x78b8('0x1c')](0x194);}return _0x32d939;};}function handleError(_0x1fbf5f,_0x336a30){_0x336a30=_0x336a30||0x1f4;return function(_0x2c108a){logger[_0x78b8('0x29')](_0x2c108a[_0x78b8('0x2a')]);if(_0x2c108a['name']){delete _0x2c108a[_0x78b8('0x2b')];}_0x1fbf5f[_0x78b8('0x1d')](_0x336a30)[_0x78b8('0x2c')](_0x2c108a);};}exports[_0x78b8('0x2d')]=function(_0x4a2a52,_0x48c578){var _0x3933e4={},_0x489a72={},_0x44d6c5={'count':0x0,'rows':[]};var _0x403aeb=_[_0x78b8('0x2e')](db['FaxQueueReport']['rawAttributes'],function(_0x3f421b){return{'name':_0x3f421b[_0x78b8('0x2f')],'type':_0x3f421b[_0x78b8('0x30')][_0x78b8('0x31')]};});_0x489a72['model']=_['map'](_0x403aeb,'name');_0x489a72['query']=_[_0x78b8('0x32')](_0x4a2a52[_0x78b8('0x33')]);_0x489a72['filters']=_['intersection'](_0x489a72[_0x78b8('0x34')],_0x489a72[_0x78b8('0x33')]);_0x3933e4[_0x78b8('0x35')]=_[_0x78b8('0x36')](_0x489a72['model'],qs[_0x78b8('0x37')](_0x4a2a52[_0x78b8('0x33')]['fields']));_0x3933e4[_0x78b8('0x35')]=_0x3933e4['attributes'][_0x78b8('0x38')]?_0x3933e4[_0x78b8('0x35')]:_0x489a72['model'];if(!_0x4a2a52[_0x78b8('0x33')][_0x78b8('0x39')](_0x78b8('0x3a'))){_0x3933e4[_0x78b8('0x22')]=qs['limit'](_0x4a2a52[_0x78b8('0x33')][_0x78b8('0x22')]);_0x3933e4[_0x78b8('0x21')]=qs['offset'](_0x4a2a52['query']['offset']);}_0x3933e4[_0x78b8('0x3b')]=qs[_0x78b8('0x3c')](_0x4a2a52[_0x78b8('0x33')][_0x78b8('0x3c')]);_0x3933e4['where']=qs[_0x78b8('0x3d')](_['pick'](_0x4a2a52['query'],_0x489a72[_0x78b8('0x3d')]),_0x403aeb);if(_0x4a2a52[_0x78b8('0x33')][_0x78b8('0x3e')]){_0x3933e4[_0x78b8('0x3f')]=_[_0x78b8('0x40')](_0x3933e4[_0x78b8('0x3f')],{'$or':_[_0x78b8('0x2e')](_0x403aeb,function(_0x223215){if(_0x223215[_0x78b8('0x30')]!==_0x78b8('0x41')){var _0x16f887={};_0x16f887[_0x223215[_0x78b8('0x2b')]]={'$like':'%'+_0x4a2a52['query'][_0x78b8('0x3e')]+'%'};return _0x16f887;}})});}_0x3933e4=_['merge']({},_0x3933e4,_0x4a2a52[_0x78b8('0x42')]);var _0x5d5e41={'where':_0x3933e4[_0x78b8('0x3f')]};return db[_0x78b8('0x43')]['count'](_0x5d5e41)[_0x78b8('0x27')](function(_0x2d83ab){_0x44d6c5[_0x78b8('0x20')]=_0x2d83ab;if(_0x4a2a52[_0x78b8('0x33')][_0x78b8('0x44')]){_0x3933e4[_0x78b8('0x45')]=[{'all':!![]}];}return db[_0x78b8('0x43')][_0x78b8('0x46')](_0x3933e4);})[_0x78b8('0x27')](function(_0x1e6b44){_0x44d6c5[_0x78b8('0x47')]=_0x1e6b44;return _0x44d6c5;})[_0x78b8('0x27')](respondWithFilteredResult(_0x48c578,_0x3933e4))[_0x78b8('0x48')](handleError(_0x48c578,null));};exports[_0x78b8('0x49')]=function(_0x26312f,_0x49aeab){var _0x17df9b={'raw':!![],'where':{'id':_0x26312f['params']['id']}},_0xb8dc14={};_0xb8dc14[_0x78b8('0x34')]=_[_0x78b8('0x32')](db['FaxQueueReport'][_0x78b8('0x4a')]);_0xb8dc14['query']=_[_0x78b8('0x32')](_0x26312f[_0x78b8('0x33')]);_0xb8dc14[_0x78b8('0x4b')]=_[_0x78b8('0x36')](_0xb8dc14['model'],_0xb8dc14['query']);_0x17df9b['attributes']=_[_0x78b8('0x36')](_0xb8dc14[_0x78b8('0x34')],qs[_0x78b8('0x37')](_0x26312f['query']['fields']));_0x17df9b[_0x78b8('0x35')]=_0x17df9b[_0x78b8('0x35')][_0x78b8('0x38')]?_0x17df9b['attributes']:_0xb8dc14['model'];if(_0x26312f[_0x78b8('0x33')][_0x78b8('0x44')]){_0x17df9b[_0x78b8('0x45')]=[{'all':!![]}];}_0x17df9b=_['merge']({},_0x17df9b,_0x26312f[_0x78b8('0x42')]);return db[_0x78b8('0x43')]['find'](_0x17df9b)['then'](handleEntityNotFound(_0x49aeab,null))[_0x78b8('0x27')](respondWithResult(_0x49aeab,null))[_0x78b8('0x48')](handleError(_0x49aeab,null));};exports[_0x78b8('0x4c')]=function(_0x11e644,_0x543296){return db['FaxQueueReport'][_0x78b8('0x4c')](_0x11e644['body'],{})[_0x78b8('0x27')](respondWithResult(_0x543296,0xc9))[_0x78b8('0x48')](handleError(_0x543296,null));};exports[_0x78b8('0x4d')]=function(_0x52d66f,_0xb0b813){if(_0x52d66f['body']['id']){delete _0x52d66f[_0x78b8('0x4e')]['id'];}return db[_0x78b8('0x43')][_0x78b8('0x4f')]({'where':{'id':_0x52d66f[_0x78b8('0x50')]['id']}})[_0x78b8('0x27')](handleEntityNotFound(_0xb0b813,null))[_0x78b8('0x27')](saveUpdates(_0x52d66f[_0x78b8('0x4e')],null))['then'](respondWithResult(_0xb0b813,null))['catch'](handleError(_0xb0b813,null));};exports[_0x78b8('0x28')]=function(_0x571bc1,_0x332afa){return db[_0x78b8('0x43')][_0x78b8('0x4f')]({'where':{'id':_0x571bc1['params']['id']}})[_0x78b8('0x27')](handleEntityNotFound(_0x332afa,null))[_0x78b8('0x27')](removeEntity(_0x332afa,null))['catch'](handleError(_0x332afa,null));};exports[_0x78b8('0x51')]=function(_0x4e3713,_0x4a8e15){return db['FaxQueueReport'][_0x78b8('0x51')]()[_0x78b8('0x27')](respondWithResult(_0x4a8e15,null))[_0x78b8('0x48')](handleError(_0x4a8e15,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index c30efd8..fdf3651 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 _0xcd3f=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','report_fax_queue','uniqueid'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcd3f,0x6c));var _0xfcd3=function(_0x1c83d6,_0x59dfb5){_0x1c83d6=_0x1c83d6-0x0;var _0x8131c0=_0xcd3f[_0x1c83d6];return _0x8131c0;};'use strict';var _=require(_0xfcd3('0x0'));var util=require(_0xfcd3('0x1'));var logger=require(_0xfcd3('0x2'))('api');var moment=require(_0xfcd3('0x3'));var BPromise=require(_0xfcd3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcd3('0x5'));var rimraf=require(_0xfcd3('0x6'));var config=require(_0xfcd3('0x7'));var attributes=require('./faxQueueReport.attributes');module[_0xfcd3('0x8')]=function(_0xe01eaf,_0x505dff){return _0xe01eaf[_0xfcd3('0x9')]('FaxQueueReport',attributes,{'tableName':_0xfcd3('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xfcd3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x702a=['uniqueid','util','../../config/logger','api','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue'];(function(_0x38ebb5,_0x5afbba){var _0x5b95ae=function(_0x1d45a2){while(--_0x1d45a2){_0x38ebb5['push'](_0x38ebb5['shift']());}};_0x5b95ae(++_0x5afbba);}(_0x702a,0x169));var _0xa702=function(_0x4bdf64,_0x53bc68){_0x4bdf64=_0x4bdf64-0x0;var _0x1d2dc1=_0x702a[_0x4bdf64];return _0x1d2dc1;};'use strict';var _=require('lodash');var util=require(_0xa702('0x0'));var logger=require(_0xa702('0x1'))(_0xa702('0x2'));var moment=require('moment');var BPromise=require(_0xa702('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa702('0x4'));var rimraf=require(_0xa702('0x5'));var config=require('../../config/environment');var attributes=require(_0xa702('0x6'));module[_0xa702('0x7')]=function(_0x32d7c5,_0x2a2064){return _0x32d7c5[_0xa702('0x8')](_0xa702('0x9'),attributes,{'tableName':_0xa702('0xa'),'paranoid':![],'indexes':[{'name':_0xa702('0xb'),'fields':[_0xa702('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 284a8e0..a8072d9 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 _0xc327=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','FaxQueueReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','UpdateFaxQueueReport','attributes','debug','lodash','bluebird','ioredis'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xc327,0x18d));var _0x7c32=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xc327[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x7c32('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7c32('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c32('0x2'));var db=require(_0x7c32('0x3'))['db'];var utils=require(_0x7c32('0x4'));var logger=require(_0x7c32('0x5'))(_0x7c32('0x6'));var config=require('../../config/environment');var jayson=require(_0x7c32('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dcacd,_0x5dc921,_0x18e2fc){return new BPromise(function(_0x287d92,_0x1d7371){return client[_0x7c32('0x8')](_0x4dcacd,_0x18e2fc)[_0x7c32('0x9')](function(_0x946caf){logger[_0x7c32('0xa')](_0x7c32('0xb'),_0x5dc921,'request\x20sent');logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x5dc921,'request\x20sent',JSON[_0x7c32('0xc')](_0x946caf));if(_0x946caf[_0x7c32('0xd')]){if(_0x946caf['error']['code']===0x1f4){logger[_0x7c32('0xd')](_0x7c32('0xb'),_0x5dc921,_0x946caf[_0x7c32('0xd')][_0x7c32('0xe')]);return _0x1d7371(_0x946caf['error'][_0x7c32('0xe')]);}logger[_0x7c32('0xd')](_0x7c32('0xb'),_0x5dc921,_0x946caf[_0x7c32('0xd')][_0x7c32('0xe')]);return _0x287d92(_0x946caf[_0x7c32('0xd')][_0x7c32('0xe')]);}else{logger[_0x7c32('0xa')](_0x7c32('0xb'),_0x5dc921,_0x7c32('0xf'));_0x287d92(_0x946caf[_0x7c32('0x10')][_0x7c32('0xe')]);}})[_0x7c32('0x11')](function(_0xc2e24b){logger['error'](_0x7c32('0xb'),_0x5dc921,_0xc2e24b);_0x1d7371(_0xc2e24b);});});}exports[_0x7c32('0x12')]=function(_0x5186fe){var _0x34e8b0=this;return new Promise(function(_0x1060bd,_0x5b2684){return db[_0x7c32('0x13')]['create'](_0x5186fe[_0x7c32('0x14')],{'raw':_0x5186fe[_0x7c32('0x15')]?_0x5186fe[_0x7c32('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x7c32('0x9')](function(_0x35b3c7){logger['info'](_0x7c32('0x12'),_0x5186fe);logger['debug']('CreateFaxQueueReport',_0x5186fe,JSON[_0x7c32('0xc')](_0x35b3c7));_0x1060bd(_0x35b3c7);})[_0x7c32('0x11')](function(_0xb7d56b){logger[_0x7c32('0xd')](_0x7c32('0x12'),_0xb7d56b[_0x7c32('0xe')],_0x5186fe);_0x5b2684(_0x34e8b0[_0x7c32('0xd')](0x1f4,_0xb7d56b[_0x7c32('0xe')]));});});};exports[_0x7c32('0x16')]=function(_0x5c332f){var _0xf74fb=this;return new Promise(function(_0x543208,_0x16d5ff){return db[_0x7c32('0x13')]['update'](_0x5c332f[_0x7c32('0x14')],{'raw':_0x5c332f[_0x7c32('0x15')]?_0x5c332f[_0x7c32('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c332f[_0x7c32('0x15')]?_0x5c332f[_0x7c32('0x15')]['where']||null:null,'attributes':_0x5c332f[_0x7c32('0x15')]?_0x5c332f[_0x7c32('0x15')][_0x7c32('0x17')]||null:null,'limit':_0x5c332f['options']?_0x5c332f['options']['limit']||null:null})['then'](function(_0x43af3e){logger[_0x7c32('0xa')](_0x7c32('0x16'),_0x5c332f);logger[_0x7c32('0x18')](_0x7c32('0x16'),_0x5c332f,JSON[_0x7c32('0xc')](_0x43af3e));_0x543208(_0x43af3e);})[_0x7c32('0x11')](function(_0xd58516){logger['error'](_0x7c32('0x16'),_0xd58516[_0x7c32('0xe')],_0x5c332f);_0x16d5ff(_0xf74fb[_0x7c32('0xd')](0x1f4,_0xd58516[_0x7c32('0xe')]));});});}; \ No newline at end of file +var _0xac0f=['message','info','catch','FaxQueueReport','create','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','update','body','where','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x596684,_0x3e7a0a){var _0x21d272=function(_0x1223f2){while(--_0x1223f2){_0x596684['push'](_0x596684['shift']());}};_0x21d272(++_0x3e7a0a);}(_0xac0f,0x1a6));var _0xfac0=function(_0x34f32c,_0x39fe66){_0x34f32c=_0x34f32c-0x0;var _0x54de91=_0xac0f[_0x34f32c];return _0x54de91;};'use strict';var _=require('lodash');var util=require(_0xfac0('0x0'));var moment=require(_0xfac0('0x1'));var BPromise=require('bluebird');var rs=require(_0xfac0('0x2'));var fs=require('fs');var Redis=require(_0xfac0('0x3'));var db=require(_0xfac0('0x4'))['db'];var utils=require(_0xfac0('0x5'));var logger=require(_0xfac0('0x6'))('rpc');var config=require(_0xfac0('0x7'));var jayson=require(_0xfac0('0x8'));var client=jayson[_0xfac0('0x9')][_0xfac0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x590e06,_0x35a0b0,_0x5d13a9){return new BPromise(function(_0x4d746f,_0x16897f){return client[_0xfac0('0xb')](_0x590e06,_0x5d13a9)[_0xfac0('0xc')](function(_0x21c647){logger['info'](_0xfac0('0xd'),_0x35a0b0,_0xfac0('0xe'));logger[_0xfac0('0xf')](_0xfac0('0x10'),_0x35a0b0,_0xfac0('0xe'),JSON[_0xfac0('0x11')](_0x21c647));if(_0x21c647[_0xfac0('0x12')]){if(_0x21c647['error'][_0xfac0('0x13')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x35a0b0,_0x21c647[_0xfac0('0x12')][_0xfac0('0x14')]);return _0x16897f(_0x21c647['error']['message']);}logger[_0xfac0('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x35a0b0,_0x21c647[_0xfac0('0x12')]['message']);return _0x4d746f(_0x21c647[_0xfac0('0x12')][_0xfac0('0x14')]);}else{logger[_0xfac0('0x15')](_0xfac0('0xd'),_0x35a0b0,_0xfac0('0xe'));_0x4d746f(_0x21c647['result']['message']);}})[_0xfac0('0x16')](function(_0x27382b){logger[_0xfac0('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x35a0b0,_0x27382b);_0x16897f(_0x27382b);});});}exports['CreateFaxQueueReport']=function(_0x3b9946){var _0x189c12=this;return new Promise(function(_0x3cd344,_0x55b2e7){return db[_0xfac0('0x17')][_0xfac0('0x18')](_0x3b9946['body'],{'raw':_0x3b9946[_0xfac0('0x19')]?_0x3b9946[_0xfac0('0x19')][_0xfac0('0x1a')]===undefined?!![]:![]:!![]})[_0xfac0('0xc')](function(_0x54fac3){logger['info'](_0xfac0('0x1b'),_0x3b9946);logger['debug'](_0xfac0('0x1b'),_0x3b9946,JSON[_0xfac0('0x11')](_0x54fac3));_0x3cd344(_0x54fac3);})[_0xfac0('0x16')](function(_0x472d52){logger[_0xfac0('0x12')](_0xfac0('0x1b'),_0x472d52[_0xfac0('0x14')],_0x3b9946);_0x55b2e7(_0x189c12[_0xfac0('0x12')](0x1f4,_0x472d52[_0xfac0('0x14')]));});});};exports[_0xfac0('0x1c')]=function(_0x7ad303){var _0x1c8400=this;return new Promise(function(_0x335164,_0x7ae977){return db['FaxQueueReport'][_0xfac0('0x1d')](_0x7ad303[_0xfac0('0x1e')],{'raw':_0x7ad303[_0xfac0('0x19')]?_0x7ad303[_0xfac0('0x19')][_0xfac0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7ad303[_0xfac0('0x19')]?_0x7ad303[_0xfac0('0x19')][_0xfac0('0x1f')]||null:null,'attributes':_0x7ad303['options']?_0x7ad303[_0xfac0('0x19')][_0xfac0('0x20')]||null:null,'limit':_0x7ad303[_0xfac0('0x19')]?_0x7ad303['options'][_0xfac0('0x21')]||null:null})[_0xfac0('0xc')](function(_0x1850d6){logger[_0xfac0('0x15')](_0xfac0('0x1c'),_0x7ad303);logger['debug']('UpdateFaxQueueReport',_0x7ad303,JSON[_0xfac0('0x11')](_0x1850d6));_0x335164(_0x1850d6);})[_0xfac0('0x16')](function(_0x33740c){logger[_0xfac0('0x12')](_0xfac0('0x1c'),_0x33740c['message'],_0x7ad303);_0x7ae977(_0x1c8400[_0xfac0('0x12')](0x1f4,_0x33740c[_0xfac0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 5e33b67..e7961fa 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 _0x0bed=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','/:id','show','post'];(function(_0x5c5682,_0x120751){var _0x202d04=function(_0x53e79e){while(--_0x53e79e){_0x5c5682['push'](_0x5c5682['shift']());}};_0x202d04(++_0x120751);}(_0x0bed,0x7c));var _0xd0be=function(_0x28e37f,_0x593dc9){_0x28e37f=_0x28e37f-0x0;var _0x4d7b21=_0x0bed[_0x28e37f];return _0x4d7b21;};'use strict';var multer=require(_0xd0be('0x0'));var util=require(_0xd0be('0x1'));var path=require(_0xd0be('0x2'));var timeout=require(_0xd0be('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xd0be('0x4'));var interaction=require(_0xd0be('0x5'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0xd0be('0x6')]('/',auth['isAuthenticated'](),controller[_0xd0be('0x7')]);router[_0xd0be('0x6')]('/describe',auth[_0xd0be('0x8')](),controller['describe']);router[_0xd0be('0x6')](_0xd0be('0x9'),auth[_0xd0be('0x8')](),controller[_0xd0be('0xa')]);router[_0xd0be('0xb')]('/',auth[_0xd0be('0x8')](),controller[_0xd0be('0xc')]);router[_0xd0be('0xd')](_0xd0be('0x9'),auth[_0xd0be('0x8')](),controller['update']);router[_0xd0be('0xe')](_0xd0be('0x9'),auth[_0xd0be('0x8')](),controller[_0xd0be('0xf')]);module[_0xd0be('0x10')]=router; \ No newline at end of file +var _0x7aa6=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','exports'];(function(_0x44647c,_0xac4615){var _0x5da3af=function(_0x1f3d88){while(--_0x1f3d88){_0x44647c['push'](_0x44647c['shift']());}};_0x5da3af(++_0xac4615);}(_0x7aa6,0x1c8));var _0x67aa=function(_0xa12e48,_0x5d61a9){_0xa12e48=_0xa12e48-0x0;var _0x3b4c5c=_0x7aa6[_0xa12e48];return _0x3b4c5c;};'use strict';var multer=require(_0x67aa('0x0'));var util=require(_0x67aa('0x1'));var path=require('path');var timeout=require(_0x67aa('0x2'));var express=require(_0x67aa('0x3'));var router=express[_0x67aa('0x4')]();var auth=require(_0x67aa('0x5'));var interaction=require(_0x67aa('0x6'));var config=require(_0x67aa('0x7'));var controller=require('./faxQueueReport.controller');router[_0x67aa('0x8')]('/',auth[_0x67aa('0x9')](),controller[_0x67aa('0xa')]);router[_0x67aa('0x8')](_0x67aa('0xb'),auth[_0x67aa('0x9')](),controller[_0x67aa('0xc')]);router['get'](_0x67aa('0xd'),auth[_0x67aa('0x9')](),controller[_0x67aa('0xe')]);router[_0x67aa('0xf')]('/',auth[_0x67aa('0x9')](),controller[_0x67aa('0x10')]);router[_0x67aa('0x11')](_0x67aa('0xd'),auth[_0x67aa('0x9')](),controller['update']);router['delete'](_0x67aa('0xd'),auth[_0x67aa('0x9')](),controller['destroy']);module[_0x67aa('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 52e4bb0..ffb9f3d 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 _0x3926=['STRING','ENUM','agent','queue','DATE','sequelize','exports'];(function(_0x43399c,_0xfb505a){var _0x189392=function(_0x5a6f0f){while(--_0x5a6f0f){_0x43399c['push'](_0x43399c['shift']());}};_0x189392(++_0xfb505a);}(_0x3926,0xd0));var _0x6392=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x3926[_0x2dea24];return _0x309d58;};'use strict';var moment=require('moment');var Sequelize=require(_0x6392('0x0'));module[_0x6392('0x1')]={'uniqueid':{'type':Sequelize[_0x6392('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6392('0x3')]('account',_0x6392('0x4'),_0x6392('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x6392('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x1f09=['queue','DATE','sequelize','exports','STRING','account','agent'];(function(_0x59408d,_0x1d2352){var _0x49d8b5=function(_0xd2e3bc){while(--_0xd2e3bc){_0x59408d['push'](_0x59408d['shift']());}};_0x49d8b5(++_0x1d2352);}(_0x1f09,0x1ec));var _0x91f0=function(_0x43143b,_0x1fb527){_0x43143b=_0x43143b-0x0;var _0x8d0458=_0x1f09[_0x43143b];return _0x8d0458;};'use strict';var moment=require('moment');var Sequelize=require(_0x91f0('0x0'));module[_0x91f0('0x1')]={'uniqueid':{'type':Sequelize[_0x91f0('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x91f0('0x3'),_0x91f0('0x4'),_0x91f0('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x91f0('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index eb04f26..562a49a 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 _0x4fda=['html-pdf','eml-format','zip-dir','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','include','rows','params','filtears','includeAll','catch','create','body','find','describe'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x4fda,0x172));var _0xa4fd=function(_0x590851,_0x496bee){_0x590851=_0x590851-0x0;var _0x3b0115=_0x4fda[_0x590851];return _0x3b0115;};'use strict';var pdf=require(_0xa4fd('0x0'));var emlformat=require(_0xa4fd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa4fd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa4fd('0x3'));var Mustache=require(_0xa4fd('0x4'));var util=require(_0xa4fd('0x5'));var path=require(_0xa4fd('0x6'));var sox=require('sox');var csv=require(_0xa4fd('0x7'));var ejs=require(_0xa4fd('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa4fd('0x9'));var crypto=require(_0xa4fd('0xa'));var jsforce=require(_0xa4fd('0xb'));var deskjs=require(_0xa4fd('0xc'));var toCsv=require(_0xa4fd('0x7'));var querystring=require(_0xa4fd('0xd'));var Papa=require(_0xa4fd('0xe'));var Redis=require(_0xa4fd('0xf'));var authService=require(_0xa4fd('0x10'));var qs=require(_0xa4fd('0x11'));var as=require(_0xa4fd('0x12'));var hardwareService=require(_0xa4fd('0x13'));var logger=require(_0xa4fd('0x14'))(_0xa4fd('0x15'));var utils=require(_0xa4fd('0x16'));var config=require(_0xa4fd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa4fd('0x18'))['db'];function respondWithStatusCode(_0x1833b7,_0x1cb56f){_0x1cb56f=_0x1cb56f||0xcc;return function(_0x4295df){if(_0x4295df){return _0x1833b7[_0xa4fd('0x19')](_0x1cb56f);}return _0x1833b7['status'](_0x1cb56f)['end']();};}function respondWithResult(_0x46346d,_0x58a9ed){_0x58a9ed=_0x58a9ed||0xc8;return function(_0x190750){if(_0x190750){return _0x46346d[_0xa4fd('0x1a')](_0x58a9ed)[_0xa4fd('0x1b')](_0x190750);}};}function respondWithFilteredResult(_0x586fea,_0x2db6af){return function(_0x31916b){if(_0x31916b){var _0x200068=_0x31916b[_0xa4fd('0x1c')],_0x52d7dc=_0x2db6af[_0xa4fd('0x1d')],_0x2d972c=_0x2db6af['offset']+_0x2db6af[_0xa4fd('0x1e')],_0x4b77ca;if(_0x2d972c>=_0x200068){_0x2d972c=_0x200068;_0x4b77ca=0xc8;}else{_0x4b77ca=0xce;}_0x586fea['status'](_0x4b77ca);return _0x586fea['set'](_0xa4fd('0x1f'),_0x52d7dc+'-'+_0x2d972c+'/'+_0x200068)[_0xa4fd('0x1b')](_0x31916b);}return null;};}function patchUpdates(_0x38ec85){return function(_0x4a9006){try{jsonpatch[_0xa4fd('0x20')](_0x4a9006,_0x38ec85,!![]);}catch(_0x97870f){return BPromise[_0xa4fd('0x21')](_0x97870f);}return _0x4a9006['save']();};}function saveUpdates(_0x16b630,_0x244330){return function(_0x2cbcc9){if(_0x2cbcc9){return _0x2cbcc9[_0xa4fd('0x22')](_0x16b630)[_0xa4fd('0x23')](function(_0x2ff22f){return _0x2ff22f;});}return null;};}function removeEntity(_0x5b9c98,_0x258cd4){return function(_0x30d5ae){if(_0x30d5ae){return _0x30d5ae[_0xa4fd('0x24')]()[_0xa4fd('0x23')](function(){_0x5b9c98[_0xa4fd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d5741,_0x1b08a6){return function(_0x1c5c18){if(!_0x1c5c18){_0x4d5741[_0xa4fd('0x19')](0x194);}return _0x1c5c18;};}function handleError(_0x187ad2,_0x5cab45){_0x5cab45=_0x5cab45||0x1f4;return function(_0x585f82){logger[_0xa4fd('0x25')](_0x585f82[_0xa4fd('0x26')]);if(_0x585f82[_0xa4fd('0x27')]){delete _0x585f82[_0xa4fd('0x27')];}_0x187ad2[_0xa4fd('0x1a')](_0x5cab45)[_0xa4fd('0x28')](_0x585f82);};}exports[_0xa4fd('0x29')]=function(_0x1775ea,_0x133722){var _0x24f9d0={},_0x4ba559={},_0xaee12e={'count':0x0,'rows':[]};var _0x2064d2=_[_0xa4fd('0x2a')](db[_0xa4fd('0x2b')][_0xa4fd('0x2c')],function(_0xe1a1f2){return{'name':_0xe1a1f2['fieldName'],'type':_0xe1a1f2[_0xa4fd('0x2d')][_0xa4fd('0x2e')]};});_0x4ba559[_0xa4fd('0x2f')]=_['map'](_0x2064d2,_0xa4fd('0x27'));_0x4ba559[_0xa4fd('0x30')]=_['keys'](_0x1775ea[_0xa4fd('0x30')]);_0x4ba559['filters']=_[_0xa4fd('0x31')](_0x4ba559[_0xa4fd('0x2f')],_0x4ba559[_0xa4fd('0x30')]);_0x24f9d0[_0xa4fd('0x32')]=_[_0xa4fd('0x31')](_0x4ba559[_0xa4fd('0x2f')],qs[_0xa4fd('0x33')](_0x1775ea['query'][_0xa4fd('0x33')]));_0x24f9d0[_0xa4fd('0x32')]=_0x24f9d0['attributes'][_0xa4fd('0x34')]?_0x24f9d0['attributes']:_0x4ba559[_0xa4fd('0x2f')];if(!_0x1775ea[_0xa4fd('0x30')][_0xa4fd('0x35')](_0xa4fd('0x36'))){_0x24f9d0['limit']=qs['limit'](_0x1775ea[_0xa4fd('0x30')][_0xa4fd('0x1e')]);_0x24f9d0['offset']=qs['offset'](_0x1775ea[_0xa4fd('0x30')][_0xa4fd('0x1d')]);}_0x24f9d0[_0xa4fd('0x37')]=qs[_0xa4fd('0x38')](_0x1775ea['query'][_0xa4fd('0x38')]);_0x24f9d0['where']=qs[_0xa4fd('0x39')](_[_0xa4fd('0x3a')](_0x1775ea[_0xa4fd('0x30')],_0x4ba559[_0xa4fd('0x39')]),_0x2064d2);if(_0x1775ea['query']['filter']){_0x24f9d0['where']=_['merge'](_0x24f9d0[_0xa4fd('0x3b')],{'$or':_[_0xa4fd('0x2a')](_0x2064d2,function(_0x48d57c){if(_0x48d57c[_0xa4fd('0x2d')]!==_0xa4fd('0x3c')){var _0x8577bb={};_0x8577bb[_0x48d57c['name']]={'$like':'%'+_0x1775ea[_0xa4fd('0x30')][_0xa4fd('0x3d')]+'%'};return _0x8577bb;}})});}_0x24f9d0=_[_0xa4fd('0x3e')]({},_0x24f9d0,_0x1775ea[_0xa4fd('0x3f')]);var _0x1c03e0={'where':_0x24f9d0[_0xa4fd('0x3b')]};return db[_0xa4fd('0x2b')]['count'](_0x1c03e0)[_0xa4fd('0x23')](function(_0x361265){_0xaee12e[_0xa4fd('0x1c')]=_0x361265;if(_0x1775ea[_0xa4fd('0x30')]['includeAll']){_0x24f9d0[_0xa4fd('0x40')]=[{'all':!![]}];}return db[_0xa4fd('0x2b')]['findAll'](_0x24f9d0);})[_0xa4fd('0x23')](function(_0x28678c){_0xaee12e[_0xa4fd('0x41')]=_0x28678c;return _0xaee12e;})[_0xa4fd('0x23')](respondWithFilteredResult(_0x133722,_0x24f9d0))['catch'](handleError(_0x133722,null));};exports['show']=function(_0x2535b5,_0x3e176a){var _0x4590bb={'raw':!![],'where':{'id':_0x2535b5[_0xa4fd('0x42')]['id']}},_0x3cfdfa={};_0x3cfdfa[_0xa4fd('0x2f')]=_['keys'](db[_0xa4fd('0x2b')][_0xa4fd('0x2c')]);_0x3cfdfa[_0xa4fd('0x30')]=_['keys'](_0x2535b5['query']);_0x3cfdfa[_0xa4fd('0x43')]=_[_0xa4fd('0x31')](_0x3cfdfa[_0xa4fd('0x2f')],_0x3cfdfa[_0xa4fd('0x30')]);_0x4590bb['attributes']=_[_0xa4fd('0x31')](_0x3cfdfa[_0xa4fd('0x2f')],qs[_0xa4fd('0x33')](_0x2535b5[_0xa4fd('0x30')][_0xa4fd('0x33')]));_0x4590bb[_0xa4fd('0x32')]=_0x4590bb[_0xa4fd('0x32')][_0xa4fd('0x34')]?_0x4590bb[_0xa4fd('0x32')]:_0x3cfdfa['model'];if(_0x2535b5[_0xa4fd('0x30')][_0xa4fd('0x44')]){_0x4590bb[_0xa4fd('0x40')]=[{'all':!![]}];}_0x4590bb=_['merge']({},_0x4590bb,_0x2535b5[_0xa4fd('0x3f')]);return db['FaxTransferReport']['find'](_0x4590bb)[_0xa4fd('0x23')](handleEntityNotFound(_0x3e176a,null))[_0xa4fd('0x23')](respondWithResult(_0x3e176a,null))[_0xa4fd('0x45')](handleError(_0x3e176a,null));};exports[_0xa4fd('0x46')]=function(_0x4e210a,_0x6d4378){return db[_0xa4fd('0x2b')][_0xa4fd('0x46')](_0x4e210a['body'],{})[_0xa4fd('0x23')](respondWithResult(_0x6d4378,0xc9))['catch'](handleError(_0x6d4378,null));};exports[_0xa4fd('0x22')]=function(_0x19539d,_0x31d327){if(_0x19539d[_0xa4fd('0x47')]['id']){delete _0x19539d[_0xa4fd('0x47')]['id'];}return db[_0xa4fd('0x2b')][_0xa4fd('0x48')]({'where':{'id':_0x19539d[_0xa4fd('0x42')]['id']}})[_0xa4fd('0x23')](handleEntityNotFound(_0x31d327,null))[_0xa4fd('0x23')](saveUpdates(_0x19539d[_0xa4fd('0x47')],null))[_0xa4fd('0x23')](respondWithResult(_0x31d327,null))['catch'](handleError(_0x31d327,null));};exports[_0xa4fd('0x24')]=function(_0x541b2e,_0x2b9ab7){return db['FaxTransferReport']['find']({'where':{'id':_0x541b2e[_0xa4fd('0x42')]['id']}})['then'](handleEntityNotFound(_0x2b9ab7,null))[_0xa4fd('0x23')](removeEntity(_0x2b9ab7,null))[_0xa4fd('0x45')](handleError(_0x2b9ab7,null));};exports[_0xa4fd('0x49')]=function(_0x4398f4,_0x3fc36f){return db[_0xa4fd('0x2b')][_0xa4fd('0x49')]()['then'](respondWithResult(_0x3fc36f,null))[_0xa4fd('0x45')](handleError(_0x3fc36f,null));}; \ No newline at end of file +var _0xfb81=['destroy','stack','name','send','map','rawAttributes','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','FaxTransferReport','findAll','rows','catch','show','params','filtears','length','includeAll','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then'];(function(_0x1238e2,_0xeb9ea8){var _0x395c85=function(_0x5037de){while(--_0x5037de){_0x1238e2['push'](_0x1238e2['shift']());}};_0x395c85(++_0xeb9ea8);}(_0xfb81,0x188));var _0x1fb8=function(_0x48c8ab,_0x5af680){_0x48c8ab=_0x48c8ab-0x0;var _0x246963=_0xfb81[_0x48c8ab];return _0x246963;};'use strict';var pdf=require(_0x1fb8('0x0'));var emlformat=require(_0x1fb8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1fb8('0x2'));var jsonpatch=require(_0x1fb8('0x3'));var rp=require(_0x1fb8('0x4'));var moment=require(_0x1fb8('0x5'));var BPromise=require(_0x1fb8('0x6'));var Mustache=require(_0x1fb8('0x7'));var util=require(_0x1fb8('0x8'));var path=require(_0x1fb8('0x9'));var sox=require(_0x1fb8('0xa'));var csv=require(_0x1fb8('0xb'));var ejs=require(_0x1fb8('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1fb8('0xd'));var crypto=require(_0x1fb8('0xe'));var jsforce=require(_0x1fb8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1fb8('0xb'));var querystring=require(_0x1fb8('0x10'));var Papa=require('papaparse');var Redis=require(_0x1fb8('0x11'));var authService=require(_0x1fb8('0x12'));var qs=require(_0x1fb8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1fb8('0x14'));var logger=require('../../config/logger')(_0x1fb8('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35caaa,_0x244174){_0x244174=_0x244174||0xcc;return function(_0x42c6bb){if(_0x42c6bb){return _0x35caaa['sendStatus'](_0x244174);}return _0x35caaa[_0x1fb8('0x16')](_0x244174)[_0x1fb8('0x17')]();};}function respondWithResult(_0x1fd464,_0x2769e){_0x2769e=_0x2769e||0xc8;return function(_0x4aa87a){if(_0x4aa87a){return _0x1fd464['status'](_0x2769e)[_0x1fb8('0x18')](_0x4aa87a);}};}function respondWithFilteredResult(_0x4fc08e,_0x8654e6){return function(_0x3433ce){if(_0x3433ce){var _0x46587a=_0x3433ce[_0x1fb8('0x19')],_0x227dbf=_0x8654e6[_0x1fb8('0x1a')],_0x373ffa=_0x8654e6['offset']+_0x8654e6[_0x1fb8('0x1b')],_0x24f4f2;if(_0x373ffa>=_0x46587a){_0x373ffa=_0x46587a;_0x24f4f2=0xc8;}else{_0x24f4f2=0xce;}_0x4fc08e['status'](_0x24f4f2);return _0x4fc08e['set'](_0x1fb8('0x1c'),_0x227dbf+'-'+_0x373ffa+'/'+_0x46587a)[_0x1fb8('0x18')](_0x3433ce);}return null;};}function patchUpdates(_0xc5865){return function(_0x465ffe){try{jsonpatch[_0x1fb8('0x1d')](_0x465ffe,_0xc5865,!![]);}catch(_0x390beb){return BPromise[_0x1fb8('0x1e')](_0x390beb);}return _0x465ffe[_0x1fb8('0x1f')]();};}function saveUpdates(_0x239f75,_0x573376){return function(_0x7c6705){if(_0x7c6705){return _0x7c6705[_0x1fb8('0x20')](_0x239f75)[_0x1fb8('0x21')](function(_0x473c27){return _0x473c27;});}return null;};}function removeEntity(_0x11ba7d,_0x497424){return function(_0x4606be){if(_0x4606be){return _0x4606be[_0x1fb8('0x22')]()[_0x1fb8('0x21')](function(){_0x11ba7d[_0x1fb8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16c07e,_0x17dac3){return function(_0x47624e){if(!_0x47624e){_0x16c07e['sendStatus'](0x194);}return _0x47624e;};}function handleError(_0x3ef8e5,_0x29f0fe){_0x29f0fe=_0x29f0fe||0x1f4;return function(_0x4095b9){logger['error'](_0x4095b9[_0x1fb8('0x23')]);if(_0x4095b9[_0x1fb8('0x24')]){delete _0x4095b9[_0x1fb8('0x24')];}_0x3ef8e5[_0x1fb8('0x16')](_0x29f0fe)[_0x1fb8('0x25')](_0x4095b9);};}exports['index']=function(_0x49b365,_0x495811){var _0xc7b3f9={},_0x7b936f={},_0x24f5c9={'count':0x0,'rows':[]};var _0x16d82d=_[_0x1fb8('0x26')](db['FaxTransferReport'][_0x1fb8('0x27')],function(_0xc883db){return{'name':_0xc883db['fieldName'],'type':_0xc883db['type']['key']};});_0x7b936f[_0x1fb8('0x28')]=_[_0x1fb8('0x26')](_0x16d82d,_0x1fb8('0x24'));_0x7b936f[_0x1fb8('0x29')]=_[_0x1fb8('0x2a')](_0x49b365['query']);_0x7b936f[_0x1fb8('0x2b')]=_[_0x1fb8('0x2c')](_0x7b936f['model'],_0x7b936f[_0x1fb8('0x29')]);_0xc7b3f9['attributes']=_[_0x1fb8('0x2c')](_0x7b936f['model'],qs[_0x1fb8('0x2d')](_0x49b365['query'][_0x1fb8('0x2d')]));_0xc7b3f9[_0x1fb8('0x2e')]=_0xc7b3f9['attributes']['length']?_0xc7b3f9['attributes']:_0x7b936f[_0x1fb8('0x28')];if(!_0x49b365[_0x1fb8('0x29')][_0x1fb8('0x2f')](_0x1fb8('0x30'))){_0xc7b3f9[_0x1fb8('0x1b')]=qs[_0x1fb8('0x1b')](_0x49b365[_0x1fb8('0x29')][_0x1fb8('0x1b')]);_0xc7b3f9[_0x1fb8('0x1a')]=qs['offset'](_0x49b365['query'][_0x1fb8('0x1a')]);}_0xc7b3f9[_0x1fb8('0x31')]=qs[_0x1fb8('0x32')](_0x49b365[_0x1fb8('0x29')]['sort']);_0xc7b3f9[_0x1fb8('0x33')]=qs[_0x1fb8('0x2b')](_[_0x1fb8('0x34')](_0x49b365['query'],_0x7b936f['filters']),_0x16d82d);if(_0x49b365['query'][_0x1fb8('0x35')]){_0xc7b3f9[_0x1fb8('0x33')]=_[_0x1fb8('0x36')](_0xc7b3f9[_0x1fb8('0x33')],{'$or':_[_0x1fb8('0x26')](_0x16d82d,function(_0x295b63){if(_0x295b63['type']!==_0x1fb8('0x37')){var _0x6620ba={};_0x6620ba[_0x295b63[_0x1fb8('0x24')]]={'$like':'%'+_0x49b365[_0x1fb8('0x29')][_0x1fb8('0x35')]+'%'};return _0x6620ba;}})});}_0xc7b3f9=_[_0x1fb8('0x36')]({},_0xc7b3f9,_0x49b365[_0x1fb8('0x38')]);var _0x47a0c4={'where':_0xc7b3f9[_0x1fb8('0x33')]};return db['FaxTransferReport'][_0x1fb8('0x19')](_0x47a0c4)['then'](function(_0x4677ce){_0x24f5c9[_0x1fb8('0x19')]=_0x4677ce;if(_0x49b365[_0x1fb8('0x29')]['includeAll']){_0xc7b3f9[_0x1fb8('0x39')]=[{'all':!![]}];}return db[_0x1fb8('0x3a')][_0x1fb8('0x3b')](_0xc7b3f9);})[_0x1fb8('0x21')](function(_0x31a7e4){_0x24f5c9[_0x1fb8('0x3c')]=_0x31a7e4;return _0x24f5c9;})[_0x1fb8('0x21')](respondWithFilteredResult(_0x495811,_0xc7b3f9))[_0x1fb8('0x3d')](handleError(_0x495811,null));};exports[_0x1fb8('0x3e')]=function(_0x4cca2a,_0x378edf){var _0xd558a1={'raw':!![],'where':{'id':_0x4cca2a[_0x1fb8('0x3f')]['id']}},_0x3b6d2c={};_0x3b6d2c[_0x1fb8('0x28')]=_[_0x1fb8('0x2a')](db[_0x1fb8('0x3a')]['rawAttributes']);_0x3b6d2c[_0x1fb8('0x29')]=_[_0x1fb8('0x2a')](_0x4cca2a['query']);_0x3b6d2c[_0x1fb8('0x40')]=_[_0x1fb8('0x2c')](_0x3b6d2c[_0x1fb8('0x28')],_0x3b6d2c[_0x1fb8('0x29')]);_0xd558a1[_0x1fb8('0x2e')]=_['intersection'](_0x3b6d2c[_0x1fb8('0x28')],qs[_0x1fb8('0x2d')](_0x4cca2a[_0x1fb8('0x29')][_0x1fb8('0x2d')]));_0xd558a1['attributes']=_0xd558a1[_0x1fb8('0x2e')][_0x1fb8('0x41')]?_0xd558a1[_0x1fb8('0x2e')]:_0x3b6d2c[_0x1fb8('0x28')];if(_0x4cca2a[_0x1fb8('0x29')][_0x1fb8('0x42')]){_0xd558a1[_0x1fb8('0x39')]=[{'all':!![]}];}_0xd558a1=_[_0x1fb8('0x36')]({},_0xd558a1,_0x4cca2a[_0x1fb8('0x38')]);return db[_0x1fb8('0x3a')][_0x1fb8('0x43')](_0xd558a1)['then'](handleEntityNotFound(_0x378edf,null))[_0x1fb8('0x21')](respondWithResult(_0x378edf,null))['catch'](handleError(_0x378edf,null));};exports[_0x1fb8('0x44')]=function(_0x1281f7,_0x3df879){return db[_0x1fb8('0x3a')][_0x1fb8('0x44')](_0x1281f7[_0x1fb8('0x45')],{})[_0x1fb8('0x21')](respondWithResult(_0x3df879,0xc9))['catch'](handleError(_0x3df879,null));};exports[_0x1fb8('0x20')]=function(_0x58a172,_0x14639a){if(_0x58a172[_0x1fb8('0x45')]['id']){delete _0x58a172[_0x1fb8('0x45')]['id'];}return db['FaxTransferReport'][_0x1fb8('0x43')]({'where':{'id':_0x58a172[_0x1fb8('0x3f')]['id']}})['then'](handleEntityNotFound(_0x14639a,null))[_0x1fb8('0x21')](saveUpdates(_0x58a172[_0x1fb8('0x45')],null))[_0x1fb8('0x21')](respondWithResult(_0x14639a,null))[_0x1fb8('0x3d')](handleError(_0x14639a,null));};exports['destroy']=function(_0x1c1173,_0x448d7e){return db['FaxTransferReport'][_0x1fb8('0x43')]({'where':{'id':_0x1c1173['params']['id']}})[_0x1fb8('0x21')](handleEntityNotFound(_0x448d7e,null))['then'](removeEntity(_0x448d7e,null))['catch'](handleError(_0x448d7e,null));};exports[_0x1fb8('0x46')]=function(_0x32e3bf,_0x57ca08){return db[_0x1fb8('0x3a')]['describe']()['then'](respondWithResult(_0x57ca08,null))['catch'](handleError(_0x57ca08,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index e65a4b5..6fff528 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 _0xad91=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','uniqueid'];(function(_0x59b2b8,_0x411d2c){var _0x47d0c8=function(_0x40acd4){while(--_0x40acd4){_0x59b2b8['push'](_0x59b2b8['shift']());}};_0x47d0c8(++_0x411d2c);}(_0xad91,0xd0));var _0x1ad9=function(_0x4b4154,_0x38a122){_0x4b4154=_0x4b4154-0x0;var _0x340ed7=_0xad91[_0x4b4154];return _0x340ed7;};'use strict';var _=require(_0x1ad9('0x0'));var util=require(_0x1ad9('0x1'));var logger=require(_0x1ad9('0x2'))(_0x1ad9('0x3'));var moment=require('moment');var BPromise=require(_0x1ad9('0x4'));var rp=require(_0x1ad9('0x5'));var fs=require('fs');var path=require(_0x1ad9('0x6'));var rimraf=require(_0x1ad9('0x7'));var config=require(_0x1ad9('0x8'));var attributes=require(_0x1ad9('0x9'));module[_0x1ad9('0xa')]=function(_0x3f764f,_0x458581){return _0x3f764f[_0x1ad9('0xb')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1ad9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9161=['./faxTransferReport.attributes','exports','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x9161,0x1dd));var _0x1916=function(_0xed3e11,_0x14d728){_0xed3e11=_0xed3e11-0x0;var _0x36ba30=_0x9161[_0xed3e11];return _0x36ba30;};'use strict';var _=require(_0x1916('0x0'));var util=require(_0x1916('0x1'));var logger=require(_0x1916('0x2'))(_0x1916('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1916('0x4'));var fs=require('fs');var path=require(_0x1916('0x5'));var rimraf=require(_0x1916('0x6'));var config=require('../../config/environment');var attributes=require(_0x1916('0x7'));module[_0x1916('0x8')]=function(_0x42992e,_0x2a382a){return _0x42992e['define']('FaxTransferReport',attributes,{'tableName':_0x1916('0x9'),'paranoid':![],'indexes':[{'name':_0x1916('0xa'),'fields':[_0x1916('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index e3e05c4..d632845 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 _0xf438=['request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x1e2e89,_0x6b8fc6){var _0x43dafe=function(_0x5abb6a){while(--_0x5abb6a){_0x1e2e89['push'](_0x1e2e89['shift']());}};_0x43dafe(++_0x6b8fc6);}(_0xf438,0x197));var _0x8f43=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xf438[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var util=require(_0x8f43('0x0'));var moment=require(_0x8f43('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f43('0x2'))['db'];var utils=require(_0x8f43('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x8f43('0x4'));var jayson=require(_0x8f43('0x5'));var client=jayson[_0x8f43('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x457997,_0x8dc99b,_0x3b1a26){return new BPromise(function(_0xd596ee,_0x1e0748){return client[_0x8f43('0x7')](_0x457997,_0x3b1a26)[_0x8f43('0x8')](function(_0x2c584e){logger['info'](_0x8f43('0x9'),_0x8dc99b,_0x8f43('0xa'));logger[_0x8f43('0xb')](_0x8f43('0xc'),_0x8dc99b,_0x8f43('0xa'),JSON['stringify'](_0x2c584e));if(_0x2c584e[_0x8f43('0xd')]){if(_0x2c584e[_0x8f43('0xd')]['code']===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x8dc99b,_0x2c584e[_0x8f43('0xd')][_0x8f43('0xe')]);return _0x1e0748(_0x2c584e['error']['message']);}logger['error'](_0x8f43('0x9'),_0x8dc99b,_0x2c584e[_0x8f43('0xd')][_0x8f43('0xe')]);return _0xd596ee(_0x2c584e[_0x8f43('0xd')]['message']);}else{logger[_0x8f43('0xf')](_0x8f43('0x9'),_0x8dc99b,'request\x20sent');_0xd596ee(_0x2c584e[_0x8f43('0x10')][_0x8f43('0xe')]);}})[_0x8f43('0x11')](function(_0x5d069d){logger[_0x8f43('0xd')](_0x8f43('0x9'),_0x8dc99b,_0x5d069d);_0x1e0748(_0x5d069d);});});} \ No newline at end of file +var _0x3891=['http','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x4b34d4,_0x35a0ac){var _0x2ceb11=function(_0xfc1a24){while(--_0xfc1a24){_0x4b34d4['push'](_0x4b34d4['shift']());}};_0x2ceb11(++_0x35a0ac);}(_0x3891,0x91));var _0x1389=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0x3891[_0x3e3bee];return _0x3ae14c;};'use strict';var _=require(_0x1389('0x0'));var util=require(_0x1389('0x1'));var moment=require(_0x1389('0x2'));var BPromise=require(_0x1389('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1389('0x4'))['db'];var utils=require(_0x1389('0x5'));var logger=require('../../config/logger')(_0x1389('0x6'));var config=require(_0x1389('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1389('0x8')][_0x1389('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a100b,_0x3e4001,_0x1cbe9f){return new BPromise(function(_0x41bc89,_0x5e0daa){return client['request'](_0x5a100b,_0x1cbe9f)[_0x1389('0xa')](function(_0x1c422c){logger[_0x1389('0xb')](_0x1389('0xc'),_0x3e4001,'request\x20sent');logger[_0x1389('0xd')](_0x1389('0xe'),_0x3e4001,_0x1389('0xf'),JSON[_0x1389('0x10')](_0x1c422c));if(_0x1c422c[_0x1389('0x11')]){if(_0x1c422c[_0x1389('0x11')][_0x1389('0x12')]===0x1f4){logger[_0x1389('0x11')](_0x1389('0xc'),_0x3e4001,_0x1c422c[_0x1389('0x11')]['message']);return _0x5e0daa(_0x1c422c['error'][_0x1389('0x13')]);}logger[_0x1389('0x11')](_0x1389('0xc'),_0x3e4001,_0x1c422c[_0x1389('0x11')][_0x1389('0x13')]);return _0x41bc89(_0x1c422c['error'][_0x1389('0x13')]);}else{logger[_0x1389('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x3e4001,_0x1389('0xf'));_0x41bc89(_0x1c422c[_0x1389('0x14')][_0x1389('0x13')]);}})[_0x1389('0x15')](function(_0x2a3a4e){logger[_0x1389('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x3e4001,_0x2a3a4e);_0x5e0daa(_0x2a3a4e);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 75bba85..440424f 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 _0x4555=['Router','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','describe','/:id','put','update','destroy','path','connect-timeout'];(function(_0x1ccf3b,_0x508466){var _0x46e22e=function(_0x458e1a){while(--_0x458e1a){_0x1ccf3b['push'](_0x1ccf3b['shift']());}};_0x46e22e(++_0x508466);}(_0x4555,0x177));var _0x5455=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4555[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5455('0x0'));var timeout=require(_0x5455('0x1'));var express=require('express');var router=express[_0x5455('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5455('0x3'));var controller=require(_0x5455('0x4'));router['get']('/',auth[_0x5455('0x5')](),controller[_0x5455('0x6')]);router[_0x5455('0x7')]('/describe',auth[_0x5455('0x5')](),controller[_0x5455('0x8')]);router[_0x5455('0x7')](_0x5455('0x9'),auth[_0x5455('0x5')](),controller['show']);router['post']('/',auth[_0x5455('0x5')](),controller['create']);router[_0x5455('0xa')]('/:id',auth[_0x5455('0x5')](),controller[_0x5455('0xb')]);router['delete'](_0x5455('0x9'),auth['isAuthenticated'](),controller[_0x5455('0xc')]);module['exports']=router; \ No newline at end of file +var _0x8d0a=['../../components/interaction/service','./faxTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','update','destroy','exports','util','path','express','Router'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x8d0a,0xc8));var _0xa8d0=function(_0x7e6fc5,_0x359bf2){_0x7e6fc5=_0x7e6fc5-0x0;var _0x4e5ca7=_0x8d0a[_0x7e6fc5];return _0x4e5ca7;};'use strict';var multer=require('multer');var util=require(_0xa8d0('0x0'));var path=require(_0xa8d0('0x1'));var timeout=require('connect-timeout');var express=require(_0xa8d0('0x2'));var router=express[_0xa8d0('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa8d0('0x4'));var config=require('../../config/environment');var controller=require(_0xa8d0('0x5'));router['get']('/',auth[_0xa8d0('0x6')](),controller[_0xa8d0('0x7')]);router[_0xa8d0('0x8')](_0xa8d0('0x9'),auth[_0xa8d0('0x6')](),controller[_0xa8d0('0xa')]);router[_0xa8d0('0x8')](_0xa8d0('0xb'),auth[_0xa8d0('0x6')](),controller[_0xa8d0('0xc')]);router['post']('/',auth[_0xa8d0('0x6')](),controller[_0xa8d0('0xd')]);router['put'](_0xa8d0('0xb'),auth[_0xa8d0('0x6')](),controller[_0xa8d0('0xe')]);router['delete'](_0xa8d0('0xb'),auth[_0xa8d0('0x6')](),controller[_0xa8d0('0xf')]);module[_0xa8d0('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 2e6bb8a..d8f4d66 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 _0x8d0a=['getConfigurations','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','isAuthenticated','show'];(function(_0x12b395,_0x3bc2a9){var _0x50116e=function(_0x1b0a32){while(--_0x1b0a32){_0x12b395['push'](_0x12b395['shift']());}};_0x50116e(++_0x3bc2a9);}(_0x8d0a,0x65));var _0xa8d0=function(_0x32c754,_0x88a9fa){_0x32c754=_0x32c754-0x0;var _0x868982=_0x8d0a[_0x32c754];return _0x868982;};'use strict';var multer=require(_0xa8d0('0x0'));var util=require('util');var path=require(_0xa8d0('0x1'));var timeout=require(_0xa8d0('0x2'));var express=require(_0xa8d0('0x3'));var router=express[_0xa8d0('0x4')]();var auth=require(_0xa8d0('0x5'));var interaction=require(_0xa8d0('0x6'));var config=require(_0xa8d0('0x7'));var controller=require(_0xa8d0('0x8'));router[_0xa8d0('0x9')]('/',auth['isAuthenticated'](),controller[_0xa8d0('0xa')]);router[_0xa8d0('0x9')](_0xa8d0('0xb'),auth[_0xa8d0('0xc')](),controller[_0xa8d0('0xd')]);router['get']('/:id/configurations',auth[_0xa8d0('0xc')](),controller[_0xa8d0('0xe')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xa8d0('0xf')]);router['post']('/',auth[_0xa8d0('0xc')](),controller[_0xa8d0('0x10')]);router[_0xa8d0('0x11')](_0xa8d0('0x12'),auth[_0xa8d0('0xc')](),controller[_0xa8d0('0x13')]);router[_0xa8d0('0x14')](_0xa8d0('0xb'),auth[_0xa8d0('0xc')](),controller[_0xa8d0('0x15')]);router[_0xa8d0('0x16')]('/:id',auth[_0xa8d0('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xef17=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','getFields','post','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef17,0x136));var _0x7ef1=function(_0x14df3c,_0xe03a6b){_0x14df3c=_0x14df3c-0x0;var _0x19c46d=_0xef17[_0x14df3c];return _0x19c46d;};'use strict';var multer=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var path=require(_0x7ef1('0x2'));var timeout=require(_0x7ef1('0x3'));var express=require(_0x7ef1('0x4'));var router=express[_0x7ef1('0x5')]();var auth=require(_0x7ef1('0x6'));var interaction=require(_0x7ef1('0x7'));var config=require(_0x7ef1('0x8'));var controller=require('./intDeskAccount.controller');router[_0x7ef1('0x9')]('/',auth['isAuthenticated'](),controller[_0x7ef1('0xa')]);router['get'](_0x7ef1('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x7ef1('0x9')](_0x7ef1('0xc'),auth['isAuthenticated'](),controller[_0x7ef1('0xd')]);router[_0x7ef1('0x9')](_0x7ef1('0xe'),auth[_0x7ef1('0xf')](),controller[_0x7ef1('0x10')]);router[_0x7ef1('0x11')]('/',auth[_0x7ef1('0xf')](),controller['create']);router['post'](_0x7ef1('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x7ef1('0xb'),auth['isAuthenticated'](),controller[_0x7ef1('0x12')]);router[_0x7ef1('0x13')](_0x7ef1('0xb'),auth[_0x7ef1('0xf')](),controller[_0x7ef1('0x14')]);module[_0x7ef1('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 97eb406..8d79c8b 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 _0x7f67=['newTab','sequelize','exports','STRING','basic','ENUM','integrationTab'];(function(_0x59bde6,_0x171dca){var _0x39aa5b=function(_0x315b8f){while(--_0x315b8f){_0x59bde6['push'](_0x59bde6['shift']());}};_0x39aa5b(++_0x171dca);}(_0x7f67,0x17b));var _0x77f6=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7f67[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x77f6('0x0'));module[_0x77f6('0x1')]={'name':{'type':Sequelize[_0x77f6('0x2')]},'description':{'type':Sequelize[_0x77f6('0x2')]},'username':{'type':Sequelize[_0x77f6('0x2')]},'remoteUri':{'type':Sequelize[_0x77f6('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x77f6('0x3')),'defaultValue':_0x77f6('0x3')},'password':{'type':Sequelize[_0x77f6('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x77f6('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x77f6('0x2')]},'serverUrl':{'type':Sequelize[_0x77f6('0x2')]},'type':{'type':Sequelize[_0x77f6('0x4')](_0x77f6('0x5'),_0x77f6('0x6')),'defaultValue':_0x77f6('0x5')}}; \ No newline at end of file +var _0x3def=['basic','integrationTab','newTab','sequelize','exports','STRING','ENUM'];(function(_0x2f3935,_0x37152f){var _0x334b91=function(_0x408575){while(--_0x408575){_0x2f3935['push'](_0x2f3935['shift']());}};_0x334b91(++_0x37152f);}(_0x3def,0x1c3));var _0xf3de=function(_0x54003d,_0xa72cda){_0x54003d=_0x54003d-0x0;var _0x897241=_0x3def[_0x54003d];return _0x897241;};'use strict';var Sequelize=require(_0xf3de('0x0'));module[_0xf3de('0x1')]={'name':{'type':Sequelize[_0xf3de('0x2')]},'description':{'type':Sequelize[_0xf3de('0x2')]},'username':{'type':Sequelize[_0xf3de('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xf3de('0x3')]('basic'),'defaultValue':_0xf3de('0x4')},'password':{'type':Sequelize[_0xf3de('0x2')]},'consumerKey':{'type':Sequelize[_0xf3de('0x2')]},'consumerSecret':{'type':Sequelize[_0xf3de('0x2')]},'token':{'type':Sequelize[_0xf3de('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf3de('0x2')]},'type':{'type':Sequelize['ENUM'](_0xf3de('0x5'),_0xf3de('0x6')),'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 9b8a13a..caef05d 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 _0xec48=['Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','count','offset','limit','set','save','update','destroy','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','DeskAccount','includeAll','include','findAll','rows','show','params','length','find','create','body','getConfigurations','findOne','DeskConfiguration','order','pick','hasOwnProperty','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','authType','username','consumerKey','consumerSecret','token','tokenSecret','remoteUri','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','password','concat','label','stringify','test'];(function(_0x3d6dc6,_0x303c6e){var _0x61908e=function(_0x37b472){while(--_0x37b472){_0x3d6dc6['push'](_0x3d6dc6['shift']());}};_0x61908e(++_0x303c6e);}(_0xec48,0x7a));var _0x8ec4=function(_0x1619c1,_0x21b9fd){_0x1619c1=_0x1619c1-0x0;var _0x424d3f=_0xec48[_0x1619c1];return _0x424d3f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8ec4('0x0'));var rimraf=require(_0x8ec4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8ec4('0x2'));var rp=require(_0x8ec4('0x3'));var moment=require(_0x8ec4('0x4'));var BPromise=require(_0x8ec4('0x5'));var Mustache=require(_0x8ec4('0x6'));var util=require('util');var path=require(_0x8ec4('0x7'));var sox=require('sox');var csv=require(_0x8ec4('0x8'));var ejs=require(_0x8ec4('0x9'));var fs=require('fs');var _=require(_0x8ec4('0xa'));var squel=require(_0x8ec4('0xb'));var crypto=require('crypto');var jsforce=require(_0x8ec4('0xc'));var deskjs=require(_0x8ec4('0xd'));var toCsv=require(_0x8ec4('0x8'));var querystring=require(_0x8ec4('0xe'));var Papa=require(_0x8ec4('0xf'));var Redis=require(_0x8ec4('0x10'));var authService=require(_0x8ec4('0x11'));var qs=require(_0x8ec4('0x12'));var as=require(_0x8ec4('0x13'));var hardwareService=require(_0x8ec4('0x14'));var logger=require(_0x8ec4('0x15'))(_0x8ec4('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8ec4('0x17'))['db'];var integrations=require(_0x8ec4('0x18'));var jayson=require(_0x8ec4('0x19'));var client=jayson[_0x8ec4('0x1a')][_0x8ec4('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x249979,_0x5b5007,_0x3c2522,_0x5173e1){return new BPromise(function(_0x535f73,_0x5f4e33){var _0x342269=_0x5173e1||client;return _0x342269['request'](_0x249979,_0x3c2522)[_0x8ec4('0x1c')](function(_0x67ca3c){logger[_0x8ec4('0x1d')](_0x8ec4('0x1e'),_0x5b5007,_0x8ec4('0x1f'));logger[_0x8ec4('0x20')](_0x8ec4('0x21'),_0x5b5007,'request\x20sent',JSON['stringify'](_0x67ca3c));if(_0x67ca3c['error']){if(_0x67ca3c[_0x8ec4('0x22')][_0x8ec4('0x23')]===0x1f4){logger['error'](_0x8ec4('0x1e'),_0x5b5007,_0x67ca3c[_0x8ec4('0x22')][_0x8ec4('0x24')]);return _0x5f4e33(_0x67ca3c[_0x8ec4('0x22')]['message']);}logger['error'](_0x8ec4('0x1e'),_0x5b5007,_0x67ca3c[_0x8ec4('0x22')][_0x8ec4('0x24')]);return _0x535f73(_0x67ca3c[_0x8ec4('0x22')][_0x8ec4('0x24')]);}else{logger[_0x8ec4('0x1d')](_0x8ec4('0x1e'),_0x5b5007,_0x8ec4('0x1f'));_0x535f73(_0x67ca3c[_0x8ec4('0x25')][_0x8ec4('0x24')]);}})[_0x8ec4('0x26')](function(_0x5e9283){logger[_0x8ec4('0x22')](_0x8ec4('0x1e'),_0x5b5007,_0x5e9283);_0x5f4e33(_0x5e9283);});});}function respondWithStatusCode(_0x4d9b72,_0x19a031){_0x19a031=_0x19a031||0xcc;return function(_0x1c54a7){if(_0x1c54a7){return _0x4d9b72['sendStatus'](_0x19a031);}return _0x4d9b72[_0x8ec4('0x27')](_0x19a031)[_0x8ec4('0x28')]();};}function respondWithResult(_0x5de622,_0x202911){_0x202911=_0x202911||0xc8;return function(_0x5b09db){if(_0x5b09db){return _0x5de622[_0x8ec4('0x27')](_0x202911)[_0x8ec4('0x29')](_0x5b09db);}};}function respondWithFilteredResult(_0x5557c4,_0x1d84af){return function(_0xedd30e){if(_0xedd30e){var _0x1a5534=_0xedd30e[_0x8ec4('0x2a')],_0x3ddf96=_0x1d84af[_0x8ec4('0x2b')],_0x1a4860=_0x1d84af[_0x8ec4('0x2b')]+_0x1d84af[_0x8ec4('0x2c')],_0x1e060f;if(_0x1a4860>=_0x1a5534){_0x1a4860=_0x1a5534;_0x1e060f=0xc8;}else{_0x1e060f=0xce;}_0x5557c4['status'](_0x1e060f);return _0x5557c4[_0x8ec4('0x2d')]('Content-Range',_0x3ddf96+'-'+_0x1a4860+'/'+_0x1a5534)[_0x8ec4('0x29')](_0xedd30e);}return null;};}function patchUpdates(_0x180191){return function(_0x4f8bd5){try{jsonpatch['apply'](_0x4f8bd5,_0x180191,!![]);}catch(_0x254ace){return BPromise['reject'](_0x254ace);}return _0x4f8bd5[_0x8ec4('0x2e')]();};}function saveUpdates(_0x323064,_0x34b904){return function(_0x1a1142){if(_0x1a1142){return _0x1a1142[_0x8ec4('0x2f')](_0x323064)['then'](function(_0x6d4f63){return _0x6d4f63;});}return null;};}function removeEntity(_0xc08ac0,_0x83d7ff){return function(_0x28cb4c){if(_0x28cb4c){return _0x28cb4c[_0x8ec4('0x30')]()[_0x8ec4('0x1c')](function(){_0xc08ac0[_0x8ec4('0x27')](0xcc)[_0x8ec4('0x28')]();});}};}function handleEntityNotFound(_0x1a4a5b,_0x683e65){return function(_0x5f2c28){if(!_0x5f2c28){_0x1a4a5b[_0x8ec4('0x31')](0x194);}return _0x5f2c28;};}function handleError(_0x282ae6,_0x3f2236){_0x3f2236=_0x3f2236||0x1f4;return function(_0x1b907b){logger['error'](_0x1b907b[_0x8ec4('0x32')]);if(_0x1b907b[_0x8ec4('0x33')]){delete _0x1b907b[_0x8ec4('0x33')];}_0x282ae6[_0x8ec4('0x27')](_0x3f2236)[_0x8ec4('0x34')](_0x1b907b);};}exports['index']=function(_0x37c477,_0xf1d0e9){var _0x5ae510={},_0x197d87={},_0x2ddd4b={'count':0x0,'rows':[]};var _0x25c222=_[_0x8ec4('0x35')](db['DeskAccount'][_0x8ec4('0x36')],function(_0x5996ab){return{'name':_0x5996ab[_0x8ec4('0x37')],'type':_0x5996ab[_0x8ec4('0x38')]['key']};});_0x197d87['model']=_['map'](_0x25c222,_0x8ec4('0x33'));_0x197d87[_0x8ec4('0x39')]=_[_0x8ec4('0x3a')](_0x37c477[_0x8ec4('0x39')]);_0x197d87['filters']=_[_0x8ec4('0x3b')](_0x197d87[_0x8ec4('0x3c')],_0x197d87[_0x8ec4('0x39')]);_0x5ae510[_0x8ec4('0x3d')]=_[_0x8ec4('0x3b')](_0x197d87[_0x8ec4('0x3c')],qs[_0x8ec4('0x3e')](_0x37c477[_0x8ec4('0x39')][_0x8ec4('0x3e')]));_0x5ae510['attributes']=_0x5ae510[_0x8ec4('0x3d')]['length']?_0x5ae510[_0x8ec4('0x3d')]:_0x197d87[_0x8ec4('0x3c')];if(!_0x37c477[_0x8ec4('0x39')]['hasOwnProperty'](_0x8ec4('0x3f'))){_0x5ae510[_0x8ec4('0x2c')]=qs[_0x8ec4('0x2c')](_0x37c477[_0x8ec4('0x39')]['limit']);_0x5ae510[_0x8ec4('0x2b')]=qs[_0x8ec4('0x2b')](_0x37c477[_0x8ec4('0x39')][_0x8ec4('0x2b')]);}_0x5ae510['order']=qs[_0x8ec4('0x40')](_0x37c477[_0x8ec4('0x39')][_0x8ec4('0x40')]);_0x5ae510[_0x8ec4('0x41')]=qs[_0x8ec4('0x42')](_['pick'](_0x37c477[_0x8ec4('0x39')],_0x197d87[_0x8ec4('0x42')]),_0x25c222);if(_0x37c477['query'][_0x8ec4('0x43')]){_0x5ae510['where']=_[_0x8ec4('0x44')](_0x5ae510['where'],{'$or':_[_0x8ec4('0x35')](_0x25c222,function(_0x18ed27){if(_0x18ed27[_0x8ec4('0x38')]!==_0x8ec4('0x45')){var _0x7d99df={};_0x7d99df[_0x18ed27['name']]={'$like':'%'+_0x37c477[_0x8ec4('0x39')][_0x8ec4('0x43')]+'%'};return _0x7d99df;}})});}_0x5ae510=_[_0x8ec4('0x44')]({},_0x5ae510,_0x37c477[_0x8ec4('0x46')]);var _0x23675f={'where':_0x5ae510[_0x8ec4('0x41')]};return db[_0x8ec4('0x47')]['count'](_0x23675f)[_0x8ec4('0x1c')](function(_0x3d0f54){_0x2ddd4b[_0x8ec4('0x2a')]=_0x3d0f54;if(_0x37c477[_0x8ec4('0x39')][_0x8ec4('0x48')]){_0x5ae510[_0x8ec4('0x49')]=[{'all':!![]}];}return db[_0x8ec4('0x47')][_0x8ec4('0x4a')](_0x5ae510);})[_0x8ec4('0x1c')](function(_0x53f3e4){_0x2ddd4b[_0x8ec4('0x4b')]=_0x53f3e4;return _0x2ddd4b;})[_0x8ec4('0x1c')](respondWithFilteredResult(_0xf1d0e9,_0x5ae510))[_0x8ec4('0x26')](handleError(_0xf1d0e9,null));};exports[_0x8ec4('0x4c')]=function(_0x1e8ca1,_0x2b8382){var _0xd8f0a2={'raw':![],'where':{'id':_0x1e8ca1[_0x8ec4('0x4d')]['id']}},_0x36fbf4={};_0x36fbf4['model']=_[_0x8ec4('0x3a')](db[_0x8ec4('0x47')][_0x8ec4('0x36')]);_0x36fbf4['query']=_[_0x8ec4('0x3a')](_0x1e8ca1[_0x8ec4('0x39')]);_0x36fbf4['filtears']=_['intersection'](_0x36fbf4[_0x8ec4('0x3c')],_0x36fbf4[_0x8ec4('0x39')]);_0xd8f0a2[_0x8ec4('0x3d')]=_[_0x8ec4('0x3b')](_0x36fbf4['model'],qs[_0x8ec4('0x3e')](_0x1e8ca1['query'][_0x8ec4('0x3e')]));_0xd8f0a2[_0x8ec4('0x3d')]=_0xd8f0a2[_0x8ec4('0x3d')][_0x8ec4('0x4e')]?_0xd8f0a2[_0x8ec4('0x3d')]:_0x36fbf4[_0x8ec4('0x3c')];if(_0x1e8ca1[_0x8ec4('0x39')][_0x8ec4('0x48')]){_0xd8f0a2[_0x8ec4('0x49')]=[{'all':!![]}];}_0xd8f0a2=_[_0x8ec4('0x44')]({},_0xd8f0a2,_0x1e8ca1['options']);return db['DeskAccount'][_0x8ec4('0x4f')](_0xd8f0a2)[_0x8ec4('0x1c')](handleEntityNotFound(_0x2b8382,null))[_0x8ec4('0x1c')](respondWithResult(_0x2b8382,null))[_0x8ec4('0x26')](handleError(_0x2b8382,null));};exports[_0x8ec4('0x50')]=function(_0x57d064,_0xe1185f){return db['DeskAccount'][_0x8ec4('0x50')](_0x57d064[_0x8ec4('0x51')],{})[_0x8ec4('0x1c')](respondWithResult(_0xe1185f,0xc9))['catch'](handleError(_0xe1185f,null));};exports[_0x8ec4('0x2f')]=function(_0x1e6b98,_0x1e0668){if(_0x1e6b98[_0x8ec4('0x51')]['id']){delete _0x1e6b98['body']['id'];}return db[_0x8ec4('0x47')][_0x8ec4('0x4f')]({'where':{'id':_0x1e6b98[_0x8ec4('0x4d')]['id']}})[_0x8ec4('0x1c')](handleEntityNotFound(_0x1e0668,null))[_0x8ec4('0x1c')](saveUpdates(_0x1e6b98[_0x8ec4('0x51')],null))[_0x8ec4('0x1c')](respondWithResult(_0x1e0668,null))['catch'](handleError(_0x1e0668,null));};exports['destroy']=function(_0x126675,_0xc31727){return db[_0x8ec4('0x47')][_0x8ec4('0x4f')]({'where':{'id':_0x126675[_0x8ec4('0x4d')]['id']}})[_0x8ec4('0x1c')](handleEntityNotFound(_0xc31727,null))[_0x8ec4('0x1c')](removeEntity(_0xc31727,null))[_0x8ec4('0x26')](handleError(_0xc31727,null));};exports[_0x8ec4('0x52')]=function(_0x29197e,_0x4b95c1,_0x135624){var _0x1c1ac8={};var _0xb98894={};var _0x15b064;var _0x1ba0a1;return db[_0x8ec4('0x47')][_0x8ec4('0x53')]({'where':{'id':_0x29197e[_0x8ec4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4b95c1,null))[_0x8ec4('0x1c')](function(_0x5dcc1d){if(_0x5dcc1d){_0x15b064=_0x5dcc1d;_0xb98894[_0x8ec4('0x3c')]=_['keys'](db[_0x8ec4('0x54')][_0x8ec4('0x36')]);_0xb98894[_0x8ec4('0x39')]=_['keys'](_0x29197e[_0x8ec4('0x39')]);_0xb98894[_0x8ec4('0x42')]=_[_0x8ec4('0x3b')](_0xb98894[_0x8ec4('0x3c')],_0xb98894[_0x8ec4('0x39')]);_0x1c1ac8['attributes']=_[_0x8ec4('0x3b')](_0xb98894['model'],qs[_0x8ec4('0x3e')](_0x29197e[_0x8ec4('0x39')][_0x8ec4('0x3e')]));_0x1c1ac8[_0x8ec4('0x3d')]=_0x1c1ac8[_0x8ec4('0x3d')][_0x8ec4('0x4e')]?_0x1c1ac8['attributes']:_0xb98894[_0x8ec4('0x3c')];_0x1c1ac8[_0x8ec4('0x55')]=qs['sort'](_0x29197e[_0x8ec4('0x39')][_0x8ec4('0x40')]);_0x1c1ac8['where']=qs[_0x8ec4('0x42')](_[_0x8ec4('0x56')](_0x29197e[_0x8ec4('0x39')],_0xb98894[_0x8ec4('0x42')]));if(_0x29197e['query']['filter']){_0x1c1ac8['where']=_[_0x8ec4('0x44')](_0x1c1ac8['where'],{'$or':_[_0x8ec4('0x35')](_0x1c1ac8[_0x8ec4('0x3d')],function(_0x2bf1be){var _0x5df152={};_0x5df152[_0x2bf1be]={'$like':'%'+_0x29197e[_0x8ec4('0x39')][_0x8ec4('0x43')]+'%'};return _0x5df152;})});}_0x1c1ac8=_[_0x8ec4('0x44')]({},_0x1c1ac8,_0x29197e[_0x8ec4('0x46')]);return _0x15b064[_0x8ec4('0x52')](_0x1c1ac8);}})[_0x8ec4('0x1c')](function(_0x360e4f){if(_0x360e4f){_0x1ba0a1=_0x360e4f[_0x8ec4('0x4e')];if(!_0x29197e[_0x8ec4('0x39')][_0x8ec4('0x57')](_0x8ec4('0x3f'))){_0x1c1ac8[_0x8ec4('0x2c')]=qs[_0x8ec4('0x2c')](_0x29197e['query'][_0x8ec4('0x2c')]);_0x1c1ac8['offset']=qs[_0x8ec4('0x2b')](_0x29197e[_0x8ec4('0x39')][_0x8ec4('0x2b')]);}return _0x15b064['getConfigurations'](_0x1c1ac8);}})[_0x8ec4('0x1c')](function(_0x37296c){if(_0x37296c){return _0x37296c?{'count':_0x1ba0a1,'rows':_0x37296c}:null;}})['then'](respondWithResult(_0x4b95c1,null))[_0x8ec4('0x26')](handleError(_0x4b95c1,null));};exports['addConfiguration']=function(_0x2e1646,_0x32a984,_0x280a87){if(_0x2e1646[_0x8ec4('0x51')]['id']){delete _0x2e1646['body']['id'];}return db[_0x8ec4('0x47')]['findOne']({'where':{'id':_0x2e1646[_0x8ec4('0x4d')]['id']}})[_0x8ec4('0x1c')](handleEntityNotFound(_0x32a984,null))['then'](function(_0x1589b5){if(_0x1589b5){_0x2e1646[_0x8ec4('0x51')]['AccountId']=_0x1589b5['id'];_0x2e1646[_0x8ec4('0x51')][_0x8ec4('0x58')]=integrations[_0x8ec4('0x59')](_0x2e1646['body'][_0x8ec4('0x5a')],_0x2e1646[_0x8ec4('0x51')][_0x8ec4('0x38')]);_0x2e1646[_0x8ec4('0x51')][_0x8ec4('0x5b')]=integrations[_0x8ec4('0x5c')](_0x2e1646[_0x8ec4('0x51')]['channel'],_0x2e1646[_0x8ec4('0x51')]['type']);return db[_0x8ec4('0x54')][_0x8ec4('0x50')](_0x2e1646[_0x8ec4('0x51')],{'include':[{'model':db[_0x8ec4('0x5d')],'as':_0x8ec4('0x58')},{'model':db[_0x8ec4('0x5d')],'as':_0x8ec4('0x5b')}]});}return null;})[_0x8ec4('0x1c')](respondWithResult(_0x32a984,null))[_0x8ec4('0x26')](handleError(_0x32a984,null));};exports[_0x8ec4('0x5e')]=function(_0x36299b,_0x6c3463,_0x21d809){var _0x50d75d=[{'name':_0x8ec4('0x5f'),'label':_0x8ec4('0x5f'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x5d7398='';return db['DeskAccount'][_0x8ec4('0x53')]({'where':{'id':_0x36299b[_0x8ec4('0x4d')]['id']},'attributes':['id','remoteUri',_0x8ec4('0x60'),_0x8ec4('0x61'),'password',_0x8ec4('0x62'),_0x8ec4('0x63'),_0x8ec4('0x64'),_0x8ec4('0x65')]})[_0x8ec4('0x1c')](handleEntityNotFound(_0x6c3463,null))[_0x8ec4('0x1c')](function(_0x232791){if(_0x232791){_0x5d7398=_0x232791[_0x8ec4('0x66')];var _0x5737f6=_0x5d7398['slice'](-0x1);if(_0x5737f6==='/'){_0x5d7398=_0x5d7398[_0x8ec4('0x67')](0x0,_0x5d7398[_0x8ec4('0x68')](_0x5737f6));}var _0x29890b={'method':_0x8ec4('0x69'),'uri':util[_0x8ec4('0x6a')](_0x8ec4('0x6b'),_0x5d7398),'headers':{'Content-Type':_0x8ec4('0x6c'),'Accept':_0x8ec4('0x6c')},'json':!![]};if(_0x232791[_0x8ec4('0x60')]===_0x8ec4('0x6d')){_0x29890b[_0x8ec4('0x6e')][_0x8ec4('0x6f')]=util[_0x8ec4('0x6a')](_0x8ec4('0x70'),new Buffer(util[_0x8ec4('0x6a')]('%s:%s',_0x232791['username'],_0x232791[_0x8ec4('0x71')]))['toString']('base64'));}return rp(_0x29890b)[_0x8ec4('0x1c')](function(_0xa5aa2b){return _0x50d75d[_0x8ec4('0x72')](_[_0x8ec4('0x35')](_0xa5aa2b['_embedded']['entries'],function(_0x309696){return{'id':_0x309696[_0x8ec4('0x33')],'name':_0x309696['name'],'type':_0x309696[_0x8ec4('0x38')],'active':_0x309696['active'],'label':_0x309696[_0x8ec4('0x73')],'custom':!![]};}));});}})[_0x8ec4('0x1c')](function(_0x564499){return{'count':_0x564499['length'],'rows':_0x564499};})[_0x8ec4('0x1c')](respondWithResult(_0x6c3463,null))[_0x8ec4('0x26')](function(_0x58461c){var _0x4c7c10=_0x36299b[_0x8ec4('0x39')]['test']?0x1f4:_0x58461c['statusCode']||0x1f4;logger[_0x8ec4('0x22')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4c7c10,JSON[_0x8ec4('0x74')](_0x58461c));delete _0x58461c[_0x8ec4('0x33')];if(_0x4c7c10===0x191){_0x4c7c10=0x190;}_0x6c3463[_0x8ec4('0x27')](_0x4c7c10)[_0x8ec4('0x34')](_0x36299b['query'][_0x8ec4('0x75')]?{'message':_0x8ec4('0x76'),'statusCode':_0x58461c[_0x8ec4('0x77')]}:_0x58461c);});}; \ No newline at end of file +var _0x1a0f=['to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','DeskAccount','fieldName','type','model','map','query','keys','filters','fields','attributes','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','filtears','intersection','length','find','create','body','update','findOne','DeskConfiguration','rawAttributes','pick','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerSecret','token','substring','GET','format','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','concat','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','fast-json-patch','moment','mustache','util','path','sox'];(function(_0x1f8c6b,_0xa91698){var _0x41315a=function(_0x51a93e){while(--_0x51a93e){_0x1f8c6b['push'](_0x1f8c6b['shift']());}};_0x41315a(++_0xa91698);}(_0x1a0f,0x73));var _0xf1a0=function(_0x22de09,_0x3db597){_0x22de09=_0x22de09-0x0;var _0x4a13dc=_0x1a0f[_0x22de09];return _0x4a13dc;};'use strict';var pdf=require(_0xf1a0('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf1a0('0x1'));var rp=require('request-promise');var moment=require(_0xf1a0('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf1a0('0x3'));var util=require(_0xf1a0('0x4'));var path=require(_0xf1a0('0x5'));var sox=require(_0xf1a0('0x6'));var csv=require(_0xf1a0('0x7'));var ejs=require(_0xf1a0('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf1a0('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf1a0('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf1a0('0xb'));var Papa=require('papaparse');var Redis=require(_0xf1a0('0xc'));var authService=require(_0xf1a0('0xd'));var qs=require(_0xf1a0('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf1a0('0xf'));var logger=require(_0xf1a0('0x10'))(_0xf1a0('0x11'));var utils=require(_0xf1a0('0x12'));var config=require(_0xf1a0('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xf1a0('0x14'))['db'];var integrations=require(_0xf1a0('0x15'));var jayson=require(_0xf1a0('0x16'));var client=jayson[_0xf1a0('0x17')][_0xf1a0('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x2af7db,_0x53a875,_0x391074,_0x1dac54){return new BPromise(function(_0xec272a,_0x133fb3){var _0x51bd4c=_0x1dac54||client;return _0x51bd4c['request'](_0x2af7db,_0x391074)['then'](function(_0x406566){logger[_0xf1a0('0x19')](_0xf1a0('0x1a'),_0x53a875,_0xf1a0('0x1b'));logger[_0xf1a0('0x1c')](_0xf1a0('0x1d'),_0x53a875,'request\x20sent',JSON[_0xf1a0('0x1e')](_0x406566));if(_0x406566[_0xf1a0('0x1f')]){if(_0x406566[_0xf1a0('0x1f')][_0xf1a0('0x20')]===0x1f4){logger[_0xf1a0('0x1f')](_0xf1a0('0x1a'),_0x53a875,_0x406566['error'][_0xf1a0('0x21')]);return _0x133fb3(_0x406566[_0xf1a0('0x1f')][_0xf1a0('0x21')]);}logger[_0xf1a0('0x1f')](_0xf1a0('0x1a'),_0x53a875,_0x406566['error'][_0xf1a0('0x21')]);return _0xec272a(_0x406566[_0xf1a0('0x1f')][_0xf1a0('0x21')]);}else{logger[_0xf1a0('0x19')]('DeskAccount,\x20%s,\x20%s',_0x53a875,'request\x20sent');_0xec272a(_0x406566[_0xf1a0('0x22')][_0xf1a0('0x21')]);}})[_0xf1a0('0x23')](function(_0x1ed132){logger['error'](_0xf1a0('0x1a'),_0x53a875,_0x1ed132);_0x133fb3(_0x1ed132);});});}function respondWithStatusCode(_0x20fe03,_0x1c155e){_0x1c155e=_0x1c155e||0xcc;return function(_0x35d7f6){if(_0x35d7f6){return _0x20fe03[_0xf1a0('0x24')](_0x1c155e);}return _0x20fe03[_0xf1a0('0x25')](_0x1c155e)['end']();};}function respondWithResult(_0x29c123,_0x123b8a){_0x123b8a=_0x123b8a||0xc8;return function(_0x24248b){if(_0x24248b){return _0x29c123['status'](_0x123b8a)['json'](_0x24248b);}};}function respondWithFilteredResult(_0x40d17d,_0x535a4f){return function(_0x3f7045){if(_0x3f7045){var _0x4eaaff=_0x3f7045[_0xf1a0('0x26')],_0xa197f7=_0x535a4f[_0xf1a0('0x27')],_0x16ed53=_0x535a4f[_0xf1a0('0x27')]+_0x535a4f['limit'],_0x31f5d6;if(_0x16ed53>=_0x4eaaff){_0x16ed53=_0x4eaaff;_0x31f5d6=0xc8;}else{_0x31f5d6=0xce;}_0x40d17d[_0xf1a0('0x25')](_0x31f5d6);return _0x40d17d[_0xf1a0('0x28')](_0xf1a0('0x29'),_0xa197f7+'-'+_0x16ed53+'/'+_0x4eaaff)['json'](_0x3f7045);}return null;};}function patchUpdates(_0x3862fc){return function(_0x3b82ce){try{jsonpatch[_0xf1a0('0x2a')](_0x3b82ce,_0x3862fc,!![]);}catch(_0x559ea6){return BPromise[_0xf1a0('0x2b')](_0x559ea6);}return _0x3b82ce[_0xf1a0('0x2c')]();};}function saveUpdates(_0x17a138,_0x1ebec2){return function(_0xd74f4){if(_0xd74f4){return _0xd74f4['update'](_0x17a138)[_0xf1a0('0x2d')](function(_0x376914){return _0x376914;});}return null;};}function removeEntity(_0x5dc6ee,_0x3f021e){return function(_0x39ac46){if(_0x39ac46){return _0x39ac46[_0xf1a0('0x2e')]()[_0xf1a0('0x2d')](function(){_0x5dc6ee[_0xf1a0('0x25')](0xcc)[_0xf1a0('0x2f')]();});}};}function handleEntityNotFound(_0x79145d,_0x33d972){return function(_0x3a8f5e){if(!_0x3a8f5e){_0x79145d[_0xf1a0('0x24')](0x194);}return _0x3a8f5e;};}function handleError(_0x191f04,_0x2252d9){_0x2252d9=_0x2252d9||0x1f4;return function(_0x373370){logger[_0xf1a0('0x1f')](_0x373370[_0xf1a0('0x30')]);if(_0x373370[_0xf1a0('0x31')]){delete _0x373370[_0xf1a0('0x31')];}_0x191f04['status'](_0x2252d9)[_0xf1a0('0x32')](_0x373370);};}exports['index']=function(_0x38f803,_0x312156){var _0x293e5d={},_0x5b7ad5={},_0x6c9d11={'count':0x0,'rows':[]};var _0x567b6e=_['map'](db[_0xf1a0('0x33')]['rawAttributes'],function(_0x45770f){return{'name':_0x45770f[_0xf1a0('0x34')],'type':_0x45770f[_0xf1a0('0x35')]['key']};});_0x5b7ad5[_0xf1a0('0x36')]=_[_0xf1a0('0x37')](_0x567b6e,_0xf1a0('0x31'));_0x5b7ad5[_0xf1a0('0x38')]=_[_0xf1a0('0x39')](_0x38f803[_0xf1a0('0x38')]);_0x5b7ad5[_0xf1a0('0x3a')]=_['intersection'](_0x5b7ad5['model'],_0x5b7ad5[_0xf1a0('0x38')]);_0x293e5d['attributes']=_['intersection'](_0x5b7ad5[_0xf1a0('0x36')],qs[_0xf1a0('0x3b')](_0x38f803[_0xf1a0('0x38')][_0xf1a0('0x3b')]));_0x293e5d['attributes']=_0x293e5d['attributes']['length']?_0x293e5d[_0xf1a0('0x3c')]:_0x5b7ad5[_0xf1a0('0x36')];if(!_0x38f803[_0xf1a0('0x38')]['hasOwnProperty'](_0xf1a0('0x3d'))){_0x293e5d[_0xf1a0('0x3e')]=qs[_0xf1a0('0x3e')](_0x38f803[_0xf1a0('0x38')][_0xf1a0('0x3e')]);_0x293e5d[_0xf1a0('0x27')]=qs[_0xf1a0('0x27')](_0x38f803[_0xf1a0('0x38')]['offset']);}_0x293e5d[_0xf1a0('0x3f')]=qs['sort'](_0x38f803[_0xf1a0('0x38')][_0xf1a0('0x40')]);_0x293e5d[_0xf1a0('0x41')]=qs[_0xf1a0('0x3a')](_['pick'](_0x38f803[_0xf1a0('0x38')],_0x5b7ad5[_0xf1a0('0x3a')]),_0x567b6e);if(_0x38f803[_0xf1a0('0x38')][_0xf1a0('0x42')]){_0x293e5d[_0xf1a0('0x41')]=_[_0xf1a0('0x43')](_0x293e5d[_0xf1a0('0x41')],{'$or':_[_0xf1a0('0x37')](_0x567b6e,function(_0x45dc8a){if(_0x45dc8a[_0xf1a0('0x35')]!==_0xf1a0('0x44')){var _0x394542={};_0x394542[_0x45dc8a[_0xf1a0('0x31')]]={'$like':'%'+_0x38f803[_0xf1a0('0x38')][_0xf1a0('0x42')]+'%'};return _0x394542;}})});}_0x293e5d=_[_0xf1a0('0x43')]({},_0x293e5d,_0x38f803[_0xf1a0('0x45')]);var _0x1ca572={'where':_0x293e5d['where']};return db[_0xf1a0('0x33')][_0xf1a0('0x26')](_0x1ca572)[_0xf1a0('0x2d')](function(_0x5e5f61){_0x6c9d11[_0xf1a0('0x26')]=_0x5e5f61;if(_0x38f803[_0xf1a0('0x38')][_0xf1a0('0x46')]){_0x293e5d[_0xf1a0('0x47')]=[{'all':!![]}];}return db[_0xf1a0('0x33')][_0xf1a0('0x48')](_0x293e5d);})[_0xf1a0('0x2d')](function(_0x450116){_0x6c9d11['rows']=_0x450116;return _0x6c9d11;})['then'](respondWithFilteredResult(_0x312156,_0x293e5d))[_0xf1a0('0x23')](handleError(_0x312156,null));};exports['show']=function(_0x3bce9c,_0x1b35fc){var _0x27e657={'raw':![],'where':{'id':_0x3bce9c[_0xf1a0('0x49')]['id']}},_0x444e10={};_0x444e10[_0xf1a0('0x36')]=_[_0xf1a0('0x39')](db[_0xf1a0('0x33')]['rawAttributes']);_0x444e10[_0xf1a0('0x38')]=_[_0xf1a0('0x39')](_0x3bce9c[_0xf1a0('0x38')]);_0x444e10[_0xf1a0('0x4a')]=_[_0xf1a0('0x4b')](_0x444e10['model'],_0x444e10[_0xf1a0('0x38')]);_0x27e657[_0xf1a0('0x3c')]=_[_0xf1a0('0x4b')](_0x444e10[_0xf1a0('0x36')],qs[_0xf1a0('0x3b')](_0x3bce9c[_0xf1a0('0x38')][_0xf1a0('0x3b')]));_0x27e657[_0xf1a0('0x3c')]=_0x27e657[_0xf1a0('0x3c')][_0xf1a0('0x4c')]?_0x27e657[_0xf1a0('0x3c')]:_0x444e10['model'];if(_0x3bce9c[_0xf1a0('0x38')][_0xf1a0('0x46')]){_0x27e657[_0xf1a0('0x47')]=[{'all':!![]}];}_0x27e657=_[_0xf1a0('0x43')]({},_0x27e657,_0x3bce9c[_0xf1a0('0x45')]);return db[_0xf1a0('0x33')][_0xf1a0('0x4d')](_0x27e657)[_0xf1a0('0x2d')](handleEntityNotFound(_0x1b35fc,null))[_0xf1a0('0x2d')](respondWithResult(_0x1b35fc,null))[_0xf1a0('0x23')](handleError(_0x1b35fc,null));};exports['create']=function(_0x3f1723,_0x3c2be5){return db[_0xf1a0('0x33')][_0xf1a0('0x4e')](_0x3f1723[_0xf1a0('0x4f')],{})[_0xf1a0('0x2d')](respondWithResult(_0x3c2be5,0xc9))[_0xf1a0('0x23')](handleError(_0x3c2be5,null));};exports[_0xf1a0('0x50')]=function(_0x48b83b,_0x1329aa){if(_0x48b83b[_0xf1a0('0x4f')]['id']){delete _0x48b83b[_0xf1a0('0x4f')]['id'];}return db[_0xf1a0('0x33')][_0xf1a0('0x4d')]({'where':{'id':_0x48b83b[_0xf1a0('0x49')]['id']}})['then'](handleEntityNotFound(_0x1329aa,null))[_0xf1a0('0x2d')](saveUpdates(_0x48b83b[_0xf1a0('0x4f')],null))['then'](respondWithResult(_0x1329aa,null))[_0xf1a0('0x23')](handleError(_0x1329aa,null));};exports[_0xf1a0('0x2e')]=function(_0x51acdb,_0x9a92cf){return db[_0xf1a0('0x33')][_0xf1a0('0x4d')]({'where':{'id':_0x51acdb[_0xf1a0('0x49')]['id']}})['then'](handleEntityNotFound(_0x9a92cf,null))[_0xf1a0('0x2d')](removeEntity(_0x9a92cf,null))['catch'](handleError(_0x9a92cf,null));};exports['getConfigurations']=function(_0x4b7c9e,_0x35c487,_0x2f70ff){var _0x30792b={};var _0x4e24ad={};var _0x357cd7;var _0x4f96dc;return db[_0xf1a0('0x33')][_0xf1a0('0x51')]({'where':{'id':_0x4b7c9e[_0xf1a0('0x49')]['id']}})['then'](handleEntityNotFound(_0x35c487,null))[_0xf1a0('0x2d')](function(_0x135789){if(_0x135789){_0x357cd7=_0x135789;_0x4e24ad[_0xf1a0('0x36')]=_['keys'](db[_0xf1a0('0x52')][_0xf1a0('0x53')]);_0x4e24ad['query']=_[_0xf1a0('0x39')](_0x4b7c9e['query']);_0x4e24ad['filters']=_['intersection'](_0x4e24ad[_0xf1a0('0x36')],_0x4e24ad['query']);_0x30792b[_0xf1a0('0x3c')]=_[_0xf1a0('0x4b')](_0x4e24ad[_0xf1a0('0x36')],qs[_0xf1a0('0x3b')](_0x4b7c9e['query'][_0xf1a0('0x3b')]));_0x30792b[_0xf1a0('0x3c')]=_0x30792b['attributes'][_0xf1a0('0x4c')]?_0x30792b[_0xf1a0('0x3c')]:_0x4e24ad[_0xf1a0('0x36')];_0x30792b[_0xf1a0('0x3f')]=qs[_0xf1a0('0x40')](_0x4b7c9e[_0xf1a0('0x38')][_0xf1a0('0x40')]);_0x30792b[_0xf1a0('0x41')]=qs[_0xf1a0('0x3a')](_[_0xf1a0('0x54')](_0x4b7c9e['query'],_0x4e24ad[_0xf1a0('0x3a')]));if(_0x4b7c9e['query'][_0xf1a0('0x42')]){_0x30792b[_0xf1a0('0x41')]=_['merge'](_0x30792b[_0xf1a0('0x41')],{'$or':_[_0xf1a0('0x37')](_0x30792b[_0xf1a0('0x3c')],function(_0x218f61){var _0xbed3e9={};_0xbed3e9[_0x218f61]={'$like':'%'+_0x4b7c9e['query']['filter']+'%'};return _0xbed3e9;})});}_0x30792b=_['merge']({},_0x30792b,_0x4b7c9e[_0xf1a0('0x45')]);return _0x357cd7[_0xf1a0('0x55')](_0x30792b);}})['then'](function(_0x56ba9f){if(_0x56ba9f){_0x4f96dc=_0x56ba9f[_0xf1a0('0x4c')];if(!_0x4b7c9e[_0xf1a0('0x38')][_0xf1a0('0x56')]('nolimit')){_0x30792b['limit']=qs['limit'](_0x4b7c9e[_0xf1a0('0x38')]['limit']);_0x30792b[_0xf1a0('0x27')]=qs[_0xf1a0('0x27')](_0x4b7c9e['query'][_0xf1a0('0x27')]);}return _0x357cd7[_0xf1a0('0x55')](_0x30792b);}})[_0xf1a0('0x2d')](function(_0x5036c1){if(_0x5036c1){return _0x5036c1?{'count':_0x4f96dc,'rows':_0x5036c1}:null;}})[_0xf1a0('0x2d')](respondWithResult(_0x35c487,null))['catch'](handleError(_0x35c487,null));};exports[_0xf1a0('0x57')]=function(_0x1f39c7,_0x167b2d,_0x4c76fa){if(_0x1f39c7[_0xf1a0('0x4f')]['id']){delete _0x1f39c7[_0xf1a0('0x4f')]['id'];}return db[_0xf1a0('0x33')][_0xf1a0('0x51')]({'where':{'id':_0x1f39c7[_0xf1a0('0x49')]['id']}})[_0xf1a0('0x2d')](handleEntityNotFound(_0x167b2d,null))[_0xf1a0('0x2d')](function(_0x7e444f){if(_0x7e444f){_0x1f39c7[_0xf1a0('0x4f')][_0xf1a0('0x58')]=_0x7e444f['id'];_0x1f39c7[_0xf1a0('0x4f')][_0xf1a0('0x59')]=integrations[_0xf1a0('0x5a')](_0x1f39c7[_0xf1a0('0x4f')][_0xf1a0('0x5b')],_0x1f39c7[_0xf1a0('0x4f')][_0xf1a0('0x35')]);_0x1f39c7['body'][_0xf1a0('0x5c')]=integrations[_0xf1a0('0x5d')](_0x1f39c7['body'][_0xf1a0('0x5b')],_0x1f39c7[_0xf1a0('0x4f')][_0xf1a0('0x35')]);return db['DeskConfiguration'][_0xf1a0('0x4e')](_0x1f39c7['body'],{'include':[{'model':db[_0xf1a0('0x5e')],'as':_0xf1a0('0x59')},{'model':db[_0xf1a0('0x5e')],'as':_0xf1a0('0x5c')}]});}return null;})[_0xf1a0('0x2d')](respondWithResult(_0x167b2d,null))['catch'](handleError(_0x167b2d,null));};exports[_0xf1a0('0x5f')]=function(_0x20cb51,_0x312a82,_0x3d1001){var _0x321c1c=[{'name':_0xf1a0('0x60'),'label':_0xf1a0('0x60'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x2d5199='';return db['DeskAccount'][_0xf1a0('0x51')]({'where':{'id':_0x20cb51[_0xf1a0('0x49')]['id']},'attributes':['id',_0xf1a0('0x61'),_0xf1a0('0x62'),_0xf1a0('0x63'),_0xf1a0('0x64'),'consumerKey',_0xf1a0('0x65'),_0xf1a0('0x66'),'tokenSecret']})['then'](handleEntityNotFound(_0x312a82,null))[_0xf1a0('0x2d')](function(_0x47489d){if(_0x47489d){_0x2d5199=_0x47489d[_0xf1a0('0x61')];var _0x2d75bb=_0x2d5199['slice'](-0x1);if(_0x2d75bb==='/'){_0x2d5199=_0x2d5199[_0xf1a0('0x67')](0x0,_0x2d5199['lastIndexOf'](_0x2d75bb));}var _0x52330f={'method':_0xf1a0('0x68'),'uri':util[_0xf1a0('0x69')]('%s/custom_fields',_0x2d5199),'headers':{'Content-Type':_0xf1a0('0x6a'),'Accept':'application/json'},'json':!![]};if(_0x47489d[_0xf1a0('0x62')]===_0xf1a0('0x6b')){_0x52330f[_0xf1a0('0x6c')][_0xf1a0('0x6d')]=util['format'](_0xf1a0('0x6e'),new Buffer(util[_0xf1a0('0x69')](_0xf1a0('0x6f'),_0x47489d['username'],_0x47489d[_0xf1a0('0x64')]))[_0xf1a0('0x70')]('base64'));}return rp(_0x52330f)['then'](function(_0x2c8590){return _0x321c1c[_0xf1a0('0x71')](_[_0xf1a0('0x37')](_0x2c8590[_0xf1a0('0x72')][_0xf1a0('0x73')],function(_0x591208){return{'id':_0x591208[_0xf1a0('0x31')],'name':_0x591208['name'],'type':_0x591208[_0xf1a0('0x35')],'active':_0x591208[_0xf1a0('0x74')],'label':_0x591208[_0xf1a0('0x75')],'custom':!![]};}));});}})[_0xf1a0('0x2d')](function(_0x4008c5){return{'count':_0x4008c5[_0xf1a0('0x4c')],'rows':_0x4008c5};})[_0xf1a0('0x2d')](respondWithResult(_0x312a82,null))[_0xf1a0('0x23')](function(_0x53d888){var _0x3d492d=_0x20cb51['query']['test']?0x1f4:_0x53d888[_0xf1a0('0x76')]||0x1f4;logger[_0xf1a0('0x1f')](_0xf1a0('0x77'),_0xf1a0('0x5f'),_0x3d492d,JSON['stringify'](_0x53d888));delete _0x53d888[_0xf1a0('0x31')];if(_0x3d492d===0x191){_0x3d492d=0x190;}_0x312a82[_0xf1a0('0x25')](_0x3d492d)[_0xf1a0('0x32')](_0x20cb51[_0xf1a0('0x38')][_0xf1a0('0x78')]?{'message':_0xf1a0('0x79'),'statusCode':_0x53d888[_0xf1a0('0x76')]}:_0x53d888);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index f1cd836..44ce212 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 _0xc9ef=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x82158f,_0x4e103e){var _0x5f475f=function(_0x473255){while(--_0x473255){_0x82158f['push'](_0x82158f['shift']());}};_0x5f475f(++_0x4e103e);}(_0xc9ef,0x117));var _0xfc9e=function(_0x39abf6,_0x5cd4f1){_0x39abf6=_0x39abf6-0x0;var _0x2af92d=_0xc9ef[_0x39abf6];return _0x2af92d;};'use strict';var _=require(_0xfc9e('0x0'));var util=require(_0xfc9e('0x1'));var logger=require(_0xfc9e('0x2'))(_0xfc9e('0x3'));var moment=require(_0xfc9e('0x4'));var BPromise=require('bluebird');var rp=require(_0xfc9e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc9e('0x6'));var config=require(_0xfc9e('0x7'));var attributes=require(_0xfc9e('0x8'));var integrations=require(_0xfc9e('0x9'));module['exports']=function(_0x479f23,_0x3f3e3c){return _0x479f23[_0xfc9e('0xa')](_0xfc9e('0xb'),attributes,{'tableName':_0xfc9e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebf0=['path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4f3735,_0x5a3313){var _0x5e7c0e=function(_0x7971bd){while(--_0x7971bd){_0x4f3735['push'](_0x4f3735['shift']());}};_0x5e7c0e(++_0x5a3313);}(_0xebf0,0x1ac));var _0x0ebf=function(_0x58c796,_0x159038){_0x58c796=_0x58c796-0x0;var _0x419bd2=_0xebf0[_0x58c796];return _0x419bd2;};'use strict';var _=require(_0x0ebf('0x0'));var util=require('util');var logger=require(_0x0ebf('0x1'))(_0x0ebf('0x2'));var moment=require(_0x0ebf('0x3'));var BPromise=require(_0x0ebf('0x4'));var rp=require(_0x0ebf('0x5'));var fs=require('fs');var path=require(_0x0ebf('0x6'));var rimraf=require(_0x0ebf('0x7'));var config=require(_0x0ebf('0x8'));var attributes=require(_0x0ebf('0x9'));var integrations=require(_0x0ebf('0xa'));module['exports']=function(_0x3844c1,_0x5d7162){return _0x3844c1[_0x0ebf('0xb')](_0x0ebf('0xc'),attributes,{'tableName':_0x0ebf('0xd'),'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 41df6c8..129b585 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 _0x2775=['http','request','then','info','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','DeskAccount,\x20%s,\x20%s','message','catch','DeskAccount','options','raw','where','limit','map','model','attributes','include','debug','stringify','find','ShowDeskAccount','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x48381d,_0x4ee067){var _0x1431d3=function(_0x492d96){while(--_0x492d96){_0x48381d['push'](_0x48381d['shift']());}};_0x1431d3(++_0x4ee067);}(_0x2775,0x1c5));var _0x5277=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x2775[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x5277('0x0'));var util=require('util');var moment=require(_0x5277('0x1'));var BPromise=require('bluebird');var rs=require(_0x5277('0x2'));var fs=require('fs');var Redis=require(_0x5277('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5277('0x4'));var logger=require(_0x5277('0x5'))('rpc');var config=require(_0x5277('0x6'));var jayson=require(_0x5277('0x7'));var client=jayson[_0x5277('0x8')][_0x5277('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1116da,_0x476ac1,_0x53b898){return new BPromise(function(_0x31b2b8,_0x1bce89){return client[_0x5277('0xa')](_0x1116da,_0x53b898)[_0x5277('0xb')](function(_0x4a5f1f){logger[_0x5277('0xc')]('DeskAccount,\x20%s,\x20%s',_0x476ac1,_0x5277('0xd'));logger['debug'](_0x5277('0xe'),_0x476ac1,_0x5277('0xd'),JSON['stringify'](_0x4a5f1f));if(_0x4a5f1f[_0x5277('0xf')]){if(_0x4a5f1f[_0x5277('0xf')][_0x5277('0x10')]===0x1f4){logger[_0x5277('0xf')](_0x5277('0x11'),_0x476ac1,_0x4a5f1f[_0x5277('0xf')][_0x5277('0x12')]);return _0x1bce89(_0x4a5f1f[_0x5277('0xf')][_0x5277('0x12')]);}logger[_0x5277('0xf')](_0x5277('0x11'),_0x476ac1,_0x4a5f1f[_0x5277('0xf')][_0x5277('0x12')]);return _0x31b2b8(_0x4a5f1f[_0x5277('0xf')][_0x5277('0x12')]);}else{logger[_0x5277('0xc')](_0x5277('0x11'),_0x476ac1,'request\x20sent');_0x31b2b8(_0x4a5f1f['result'][_0x5277('0x12')]);}})[_0x5277('0x13')](function(_0xb4c5d2){logger[_0x5277('0xf')](_0x5277('0x11'),_0x476ac1,_0xb4c5d2);_0x1bce89(_0xb4c5d2);});});}exports['GetDeskAccount']=function(_0x3875ee){var _0x4e90a3=this;return new Promise(function(_0x524bdd,_0x231618){return db[_0x5277('0x14')]['findAll']({'raw':_0x3875ee[_0x5277('0x15')]?_0x3875ee[_0x5277('0x15')][_0x5277('0x16')]===undefined?!![]:![]:!![],'where':_0x3875ee[_0x5277('0x15')]?_0x3875ee[_0x5277('0x15')][_0x5277('0x17')]||null:null,'attributes':_0x3875ee['options']?_0x3875ee[_0x5277('0x15')]['attributes']||null:null,'limit':_0x3875ee[_0x5277('0x15')]?_0x3875ee[_0x5277('0x15')][_0x5277('0x18')]||null:null,'include':_0x3875ee[_0x5277('0x15')]?_0x3875ee[_0x5277('0x15')]['include']?_[_0x5277('0x19')](_0x3875ee[_0x5277('0x15')]['include'],function(_0x18e05d){return{'model':db[_0x18e05d[_0x5277('0x1a')]],'as':_0x18e05d['as'],'attributes':_0x18e05d[_0x5277('0x1b')],'include':_0x18e05d[_0x5277('0x1c')]?_[_0x5277('0x19')](_0x18e05d[_0x5277('0x1c')],function(_0x514a89){return{'model':db[_0x514a89[_0x5277('0x1a')]],'as':_0x514a89['as'],'attributes':_0x514a89[_0x5277('0x1b')],'include':_0x514a89[_0x5277('0x1c')]?_[_0x5277('0x19')](_0x514a89['include'],function(_0x3dca4c){return{'model':db[_0x3dca4c[_0x5277('0x1a')]],'as':_0x3dca4c['as'],'attributes':_0x3dca4c['attributes']};}):[]};}):[]};}):[]:[]})[_0x5277('0xb')](function(_0x1f1c67){logger[_0x5277('0xc')]('GetDeskAccount',_0x3875ee);logger[_0x5277('0x1d')]('GetDeskAccount',_0x3875ee,JSON[_0x5277('0x1e')](_0x1f1c67));_0x524bdd(_0x1f1c67);})['catch'](function(_0x16c0ad){logger[_0x5277('0xf')]('GetDeskAccount',_0x16c0ad[_0x5277('0x12')],_0x3875ee);_0x231618(_0x4e90a3[_0x5277('0xf')](0x1f4,_0x16c0ad['message']));});});};exports['ShowDeskAccount']=function(_0x1da8a9){var _0x27a80d=this;return new Promise(function(_0x165165,_0x51cf07){return db[_0x5277('0x14')][_0x5277('0x1f')]({'raw':_0x1da8a9[_0x5277('0x15')]?_0x1da8a9[_0x5277('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1da8a9[_0x5277('0x15')]?_0x1da8a9['options'][_0x5277('0x17')]||null:null,'attributes':_0x1da8a9['options']?_0x1da8a9[_0x5277('0x15')]['attributes']||null:null,'include':_0x1da8a9['options']?_0x1da8a9['options'][_0x5277('0x1c')]?_['map'](_0x1da8a9[_0x5277('0x15')][_0x5277('0x1c')],function(_0x4ae26f){return{'model':db[_0x4ae26f['model']],'as':_0x4ae26f['as'],'attributes':_0x4ae26f[_0x5277('0x1b')],'include':_0x4ae26f[_0x5277('0x1c')]?_[_0x5277('0x19')](_0x4ae26f[_0x5277('0x1c')],function(_0x190115){return{'model':db[_0x190115[_0x5277('0x1a')]],'as':_0x190115['as'],'attributes':_0x190115[_0x5277('0x1b')],'include':_0x190115[_0x5277('0x1c')]?_[_0x5277('0x19')](_0x190115[_0x5277('0x1c')],function(_0x3259cd){return{'model':db[_0x3259cd[_0x5277('0x1a')]],'as':_0x3259cd['as'],'attributes':_0x3259cd[_0x5277('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e8ffb){logger[_0x5277('0xc')]('ShowDeskAccount',_0x1da8a9);logger['debug'](_0x5277('0x20'),_0x1da8a9,JSON[_0x5277('0x1e')](_0x3e8ffb));_0x165165(_0x3e8ffb);})[_0x5277('0x13')](function(_0x8dcd7b){logger['error']('ShowDeskAccount',_0x8dcd7b[_0x5277('0x12')],_0x1da8a9);_0x51cf07(_0x27a80d[_0x5277('0xf')](0x1f4,_0x8dcd7b[_0x5277('0x12')]));});});}; \ No newline at end of file +var _0x9c20=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','raw','options','where','attributes','limit','include','map','model','then','ShowDeskAccount','find'];(function(_0x127c7e,_0x470192){var _0x45f955=function(_0x26dcea){while(--_0x26dcea){_0x127c7e['push'](_0x127c7e['shift']());}};_0x45f955(++_0x470192);}(_0x9c20,0x130));var _0x09c2=function(_0x332933,_0x3f58df){_0x332933=_0x332933-0x0;var _0x34fb7b=_0x9c20[_0x332933];return _0x34fb7b;};'use strict';var _=require(_0x09c2('0x0'));var util=require(_0x09c2('0x1'));var moment=require(_0x09c2('0x2'));var BPromise=require(_0x09c2('0x3'));var rs=require(_0x09c2('0x4'));var fs=require('fs');var Redis=require(_0x09c2('0x5'));var db=require(_0x09c2('0x6'))['db'];var utils=require(_0x09c2('0x7'));var logger=require(_0x09c2('0x8'))(_0x09c2('0x9'));var config=require('../../config/environment');var jayson=require(_0x09c2('0xa'));var client=jayson[_0x09c2('0xb')][_0x09c2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7904ab,_0xc459e4,_0x291174){return new BPromise(function(_0x51784d,_0x52e86d){return client[_0x09c2('0xd')](_0x7904ab,_0x291174)['then'](function(_0x37772c){logger[_0x09c2('0xe')](_0x09c2('0xf'),_0xc459e4,_0x09c2('0x10'));logger[_0x09c2('0x11')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0xc459e4,_0x09c2('0x10'),JSON[_0x09c2('0x12')](_0x37772c));if(_0x37772c['error']){if(_0x37772c[_0x09c2('0x13')][_0x09c2('0x14')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0xc459e4,_0x37772c['error'][_0x09c2('0x15')]);return _0x52e86d(_0x37772c[_0x09c2('0x13')][_0x09c2('0x15')]);}logger['error'](_0x09c2('0xf'),_0xc459e4,_0x37772c[_0x09c2('0x13')][_0x09c2('0x15')]);return _0x51784d(_0x37772c[_0x09c2('0x13')][_0x09c2('0x15')]);}else{logger[_0x09c2('0xe')](_0x09c2('0xf'),_0xc459e4,_0x09c2('0x10'));_0x51784d(_0x37772c[_0x09c2('0x16')][_0x09c2('0x15')]);}})[_0x09c2('0x17')](function(_0x27f6ec){logger[_0x09c2('0x13')](_0x09c2('0xf'),_0xc459e4,_0x27f6ec);_0x52e86d(_0x27f6ec);});});}exports[_0x09c2('0x18')]=function(_0xe61ce3){var _0x44039e=this;return new Promise(function(_0x5c539f,_0x5b6ae6){return db[_0x09c2('0x19')][_0x09c2('0x1a')]({'raw':_0xe61ce3['options']?_0xe61ce3['options'][_0x09c2('0x1b')]===undefined?!![]:![]:!![],'where':_0xe61ce3[_0x09c2('0x1c')]?_0xe61ce3[_0x09c2('0x1c')][_0x09c2('0x1d')]||null:null,'attributes':_0xe61ce3[_0x09c2('0x1c')]?_0xe61ce3[_0x09c2('0x1c')][_0x09c2('0x1e')]||null:null,'limit':_0xe61ce3[_0x09c2('0x1c')]?_0xe61ce3['options'][_0x09c2('0x1f')]||null:null,'include':_0xe61ce3[_0x09c2('0x1c')]?_0xe61ce3[_0x09c2('0x1c')]['include']?_['map'](_0xe61ce3[_0x09c2('0x1c')]['include'],function(_0x37681d){return{'model':db[_0x37681d['model']],'as':_0x37681d['as'],'attributes':_0x37681d[_0x09c2('0x1e')],'include':_0x37681d[_0x09c2('0x20')]?_[_0x09c2('0x21')](_0x37681d[_0x09c2('0x20')],function(_0x548dda){return{'model':db[_0x548dda['model']],'as':_0x548dda['as'],'attributes':_0x548dda[_0x09c2('0x1e')],'include':_0x548dda['include']?_[_0x09c2('0x21')](_0x548dda[_0x09c2('0x20')],function(_0x4c4de7){return{'model':db[_0x4c4de7[_0x09c2('0x22')]],'as':_0x4c4de7['as'],'attributes':_0x4c4de7[_0x09c2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x09c2('0x23')](function(_0x5bc8c7){logger[_0x09c2('0xe')](_0x09c2('0x18'),_0xe61ce3);logger[_0x09c2('0x11')](_0x09c2('0x18'),_0xe61ce3,JSON[_0x09c2('0x12')](_0x5bc8c7));_0x5c539f(_0x5bc8c7);})['catch'](function(_0x20db76){logger[_0x09c2('0x13')](_0x09c2('0x18'),_0x20db76[_0x09c2('0x15')],_0xe61ce3);_0x5b6ae6(_0x44039e['error'](0x1f4,_0x20db76['message']));});});};exports[_0x09c2('0x24')]=function(_0x496ff1){var _0x41e950=this;return new Promise(function(_0x1ad46f,_0x180f40){return db['DeskAccount'][_0x09c2('0x25')]({'raw':_0x496ff1['options']?_0x496ff1[_0x09c2('0x1c')][_0x09c2('0x1b')]===undefined?!![]:![]:!![],'where':_0x496ff1['options']?_0x496ff1['options']['where']||null:null,'attributes':_0x496ff1[_0x09c2('0x1c')]?_0x496ff1['options']['attributes']||null:null,'include':_0x496ff1['options']?_0x496ff1[_0x09c2('0x1c')]['include']?_[_0x09c2('0x21')](_0x496ff1[_0x09c2('0x1c')]['include'],function(_0x3cc9cb){return{'model':db[_0x3cc9cb[_0x09c2('0x22')]],'as':_0x3cc9cb['as'],'attributes':_0x3cc9cb[_0x09c2('0x1e')],'include':_0x3cc9cb['include']?_[_0x09c2('0x21')](_0x3cc9cb[_0x09c2('0x20')],function(_0x223653){return{'model':db[_0x223653['model']],'as':_0x223653['as'],'attributes':_0x223653[_0x09c2('0x1e')],'include':_0x223653[_0x09c2('0x20')]?_[_0x09c2('0x21')](_0x223653[_0x09c2('0x20')],function(_0xe9d549){return{'model':db[_0xe9d549['model']],'as':_0xe9d549['as'],'attributes':_0xe9d549[_0x09c2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x09c2('0x23')](function(_0x10e73f){logger[_0x09c2('0xe')]('ShowDeskAccount',_0x496ff1);logger[_0x09c2('0x11')]('ShowDeskAccount',_0x496ff1,JSON[_0x09c2('0x12')](_0x10e73f));_0x1ad46f(_0x10e73f);})['catch'](function(_0x54c8a2){logger[_0x09c2('0x13')](_0x09c2('0x24'),_0x54c8a2['message'],_0x496ff1);_0x180f40(_0x41e950[_0x09c2('0x13')](0x1f4,_0x54c8a2[_0x09c2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 0d48078..ec440b7 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 _0x82f8=['/:id/tags','post','create','setTags','update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/descriptions','getDescriptions'];(function(_0x2d1cf7,_0x41ee0f){var _0xcdf632=function(_0x3fa8b5){while(--_0x3fa8b5){_0x2d1cf7['push'](_0x2d1cf7['shift']());}};_0xcdf632(++_0x41ee0f);}(_0x82f8,0x157));var _0x882f=function(_0x279eee,_0x17896c){_0x279eee=_0x279eee-0x0;var _0x51a359=_0x82f8[_0x279eee];return _0x51a359;};'use strict';var multer=require('multer');var util=require(_0x882f('0x0'));var path=require(_0x882f('0x1'));var timeout=require('connect-timeout');var express=require(_0x882f('0x2'));var router=express[_0x882f('0x3')]();var auth=require(_0x882f('0x4'));var interaction=require(_0x882f('0x5'));var config=require(_0x882f('0x6'));var controller=require(_0x882f('0x7'));router[_0x882f('0x8')]('/',auth[_0x882f('0x9')](),controller['index']);router['get'](_0x882f('0xa'),auth[_0x882f('0x9')](),controller[_0x882f('0xb')]);router[_0x882f('0x8')]('/:id/fields',auth[_0x882f('0x9')](),controller['getFields']);router[_0x882f('0x8')]('/:id/subjects',auth[_0x882f('0x9')](),controller['getSubjects']);router['get'](_0x882f('0xc'),auth[_0x882f('0x9')](),controller[_0x882f('0xd')]);router[_0x882f('0x8')](_0x882f('0xe'),auth['isAuthenticated'](),controller['getTags']);router[_0x882f('0xf')]('/',auth[_0x882f('0x9')](),controller[_0x882f('0x10')]);router[_0x882f('0xf')](_0x882f('0xe'),auth[_0x882f('0x9')](),controller[_0x882f('0x11')]);router['put'](_0x882f('0xa'),auth[_0x882f('0x9')](),controller[_0x882f('0x12')]);router[_0x882f('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x882f('0x14')]=router; \ No newline at end of file +var _0x0170=['/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects'];(function(_0x4b8aa8,_0x1e43fa){var _0x466d54=function(_0x17f9fd){while(--_0x17f9fd){_0x4b8aa8['push'](_0x4b8aa8['shift']());}};_0x466d54(++_0x1e43fa);}(_0x0170,0x1d6));var _0x0017=function(_0x52d579,_0x453f9d){_0x52d579=_0x52d579-0x0;var _0x398818=_0x0170[_0x52d579];return _0x398818;};'use strict';var multer=require(_0x0017('0x0'));var util=require(_0x0017('0x1'));var path=require('path');var timeout=require(_0x0017('0x2'));var express=require(_0x0017('0x3'));var router=express[_0x0017('0x4')]();var auth=require(_0x0017('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0017('0x6'));var controller=require(_0x0017('0x7'));router[_0x0017('0x8')]('/',auth[_0x0017('0x9')](),controller[_0x0017('0xa')]);router[_0x0017('0x8')](_0x0017('0xb'),auth[_0x0017('0x9')](),controller[_0x0017('0xc')]);router[_0x0017('0x8')](_0x0017('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x0017('0x8')](_0x0017('0xe'),auth[_0x0017('0x9')](),controller[_0x0017('0xf')]);router[_0x0017('0x8')](_0x0017('0x10'),auth[_0x0017('0x9')](),controller[_0x0017('0x11')]);router[_0x0017('0x8')](_0x0017('0x12'),auth[_0x0017('0x9')](),controller[_0x0017('0x13')]);router[_0x0017('0x14')]('/',auth['isAuthenticated'](),controller[_0x0017('0x15')]);router[_0x0017('0x14')](_0x0017('0x12'),auth[_0x0017('0x9')](),controller[_0x0017('0x16')]);router['put']('/:id',auth[_0x0017('0x9')](),controller[_0x0017('0x17')]);router[_0x0017('0x18')]('/:id',auth[_0x0017('0x9')](),controller[_0x0017('0x19')]);module[_0x0017('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 6799d4a..b584b9e 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 _0xcfbd=['STRING'];(function(_0x13a58e,_0x38ca8f){var _0x48e456=function(_0x2a4ac4){while(--_0x2a4ac4){_0x13a58e['push'](_0x13a58e['shift']());}};_0x48e456(++_0x38ca8f);}(_0xcfbd,0xa1));var _0xdcfb=function(_0x4d6b6f,_0xf81419){_0x4d6b6f=_0x4d6b6f-0x0;var _0x5830b6=_0xcfbd[_0x4d6b6f];return _0x5830b6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdcfb('0x0')]},'description':{'type':Sequelize[_0xdcfb('0x0')]}}; \ No newline at end of file +var _0x3675=['sequelize','STRING'];(function(_0x51e801,_0x32f18d){var _0x2f3471=function(_0x288b35){while(--_0x288b35){_0x51e801['push'](_0x51e801['shift']());}};_0x2f3471(++_0x32f18d);}(_0x3675,0x16a));var _0x5367=function(_0x388b47,_0x5cdac5){_0x388b47=_0x388b47-0x0;var _0x4859df=_0x3675[_0x388b47];return _0x4859df;};'use strict';var Sequelize=require(_0x5367('0x0'));module['exports']={'name':{'type':Sequelize[_0x5367('0x1')]},'description':{'type':Sequelize[_0x5367('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 998bcad..a752054 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 _0x50fb=['message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','params','filtears','include','find','body','getFields','findOne','DeskField','pick','getSubjects','getDescriptions','getTags','setTags','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','DeskConfiguration,\x20%s,\x20%s'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x50fb,0x152));var _0xb50f=function(_0x3e6ced,_0x3af192){_0x3e6ced=_0x3e6ced-0x0;var _0x22a08c=_0x50fb[_0x3e6ced];return _0x22a08c;};'use strict';var pdf=require(_0xb50f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb50f('0x1'));var zipdir=require(_0xb50f('0x2'));var jsonpatch=require(_0xb50f('0x3'));var rp=require(_0xb50f('0x4'));var moment=require(_0xb50f('0x5'));var BPromise=require(_0xb50f('0x6'));var Mustache=require(_0xb50f('0x7'));var util=require(_0xb50f('0x8'));var path=require(_0xb50f('0x9'));var sox=require(_0xb50f('0xa'));var csv=require('to-csv');var ejs=require(_0xb50f('0xb'));var fs=require('fs');var _=require(_0xb50f('0xc'));var squel=require(_0xb50f('0xd'));var crypto=require(_0xb50f('0xe'));var jsforce=require(_0xb50f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb50f('0x10'));var querystring=require('querystring');var Papa=require(_0xb50f('0x11'));var Redis=require(_0xb50f('0x12'));var authService=require(_0xb50f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb50f('0x14'));var hardwareService=require(_0xb50f('0x15'));var logger=require(_0xb50f('0x16'))('api');var utils=require(_0xb50f('0x17'));var config=require(_0xb50f('0x18'));var licenseUtil=require(_0xb50f('0x19'));var db=require(_0xb50f('0x1a'))['db'];var jayson=require(_0xb50f('0x1b'));var client=jayson[_0xb50f('0x1c')][_0xb50f('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2a1061,_0x113aed,_0x1eb2e0,_0x1db154){return new BPromise(function(_0x335cf7,_0x1b18e9){var _0x48416e=_0x1db154||client;return _0x48416e[_0xb50f('0x1e')](_0x2a1061,_0x1eb2e0)[_0xb50f('0x1f')](function(_0x2b69d4){logger[_0xb50f('0x20')]('DeskConfiguration,\x20%s,\x20%s',_0x113aed,'request\x20sent');logger['debug'](_0xb50f('0x21'),_0x113aed,_0xb50f('0x22'),JSON[_0xb50f('0x23')](_0x2b69d4));if(_0x2b69d4['error']){if(_0x2b69d4[_0xb50f('0x24')]['code']===0x1f4){logger[_0xb50f('0x24')]('DeskConfiguration,\x20%s,\x20%s',_0x113aed,_0x2b69d4[_0xb50f('0x24')]['message']);return _0x1b18e9(_0x2b69d4['error']['message']);}logger[_0xb50f('0x24')](_0xb50f('0x25'),_0x113aed,_0x2b69d4[_0xb50f('0x24')][_0xb50f('0x26')]);return _0x335cf7(_0x2b69d4[_0xb50f('0x24')]['message']);}else{logger[_0xb50f('0x20')](_0xb50f('0x25'),_0x113aed,_0xb50f('0x22'));_0x335cf7(_0x2b69d4[_0xb50f('0x27')]['message']);}})[_0xb50f('0x28')](function(_0x13b363){logger[_0xb50f('0x24')](_0xb50f('0x25'),_0x113aed,_0x13b363);_0x1b18e9(_0x13b363);});});}function respondWithStatusCode(_0x2aaa5b,_0x36a3e6){_0x36a3e6=_0x36a3e6||0xcc;return function(_0x101432){if(_0x101432){return _0x2aaa5b[_0xb50f('0x29')](_0x36a3e6);}return _0x2aaa5b[_0xb50f('0x2a')](_0x36a3e6)['end']();};}function respondWithResult(_0x2cb0f0,_0x139b7d){_0x139b7d=_0x139b7d||0xc8;return function(_0x594f51){if(_0x594f51){return _0x2cb0f0['status'](_0x139b7d)['json'](_0x594f51);}};}function respondWithFilteredResult(_0x4b07c5,_0x1c1c2e){return function(_0x5d3f4d){if(_0x5d3f4d){var _0x1a8fb6=_0x5d3f4d[_0xb50f('0x2b')],_0x19eeed=_0x1c1c2e['offset'],_0x213aa9=_0x1c1c2e[_0xb50f('0x2c')]+_0x1c1c2e[_0xb50f('0x2d')],_0x581234;if(_0x213aa9>=_0x1a8fb6){_0x213aa9=_0x1a8fb6;_0x581234=0xc8;}else{_0x581234=0xce;}_0x4b07c5[_0xb50f('0x2a')](_0x581234);return _0x4b07c5[_0xb50f('0x2e')](_0xb50f('0x2f'),_0x19eeed+'-'+_0x213aa9+'/'+_0x1a8fb6)['json'](_0x5d3f4d);}return null;};}function patchUpdates(_0x175b80){return function(_0x2bddcd){try{jsonpatch[_0xb50f('0x30')](_0x2bddcd,_0x175b80,!![]);}catch(_0x437c2c){return BPromise[_0xb50f('0x31')](_0x437c2c);}return _0x2bddcd[_0xb50f('0x32')]();};}function saveUpdates(_0x50bd4a,_0x579612){return function(_0x1cbd05){if(_0x1cbd05){return _0x1cbd05[_0xb50f('0x33')](_0x50bd4a)['then'](function(_0xece05b){return _0xece05b;});}return null;};}function removeEntity(_0xcc5edf,_0x3fe518){return function(_0x14b96f){if(_0x14b96f){return _0x14b96f[_0xb50f('0x34')]()[_0xb50f('0x1f')](function(){_0xcc5edf[_0xb50f('0x2a')](0xcc)[_0xb50f('0x35')]();});}};}function handleEntityNotFound(_0x4d2cb5,_0xb4d0a){return function(_0x4954d8){if(!_0x4954d8){_0x4d2cb5[_0xb50f('0x29')](0x194);}return _0x4954d8;};}function handleError(_0x89b517,_0x22a642){_0x22a642=_0x22a642||0x1f4;return function(_0x151099){logger[_0xb50f('0x24')](_0x151099[_0xb50f('0x36')]);if(_0x151099['name']){delete _0x151099[_0xb50f('0x37')];}_0x89b517[_0xb50f('0x2a')](_0x22a642)[_0xb50f('0x38')](_0x151099);};}exports['index']=function(_0x512c83,_0x1f3b7c){var _0x142b6c={},_0x5a634c={},_0x352dfb={'count':0x0,'rows':[]};var _0x1b4ac8=_[_0xb50f('0x39')](db[_0xb50f('0x3a')][_0xb50f('0x3b')],function(_0x472dfd){return{'name':_0x472dfd[_0xb50f('0x3c')],'type':_0x472dfd[_0xb50f('0x3d')][_0xb50f('0x3e')]};});_0x5a634c[_0xb50f('0x3f')]=_[_0xb50f('0x39')](_0x1b4ac8,_0xb50f('0x37'));_0x5a634c['query']=_[_0xb50f('0x40')](_0x512c83['query']);_0x5a634c[_0xb50f('0x41')]=_['intersection'](_0x5a634c[_0xb50f('0x3f')],_0x5a634c[_0xb50f('0x42')]);_0x142b6c[_0xb50f('0x43')]=_[_0xb50f('0x44')](_0x5a634c[_0xb50f('0x3f')],qs[_0xb50f('0x45')](_0x512c83['query'][_0xb50f('0x45')]));_0x142b6c['attributes']=_0x142b6c[_0xb50f('0x43')][_0xb50f('0x46')]?_0x142b6c[_0xb50f('0x43')]:_0x5a634c[_0xb50f('0x3f')];if(!_0x512c83['query'][_0xb50f('0x47')](_0xb50f('0x48'))){_0x142b6c['limit']=qs[_0xb50f('0x2d')](_0x512c83['query'][_0xb50f('0x2d')]);_0x142b6c[_0xb50f('0x2c')]=qs[_0xb50f('0x2c')](_0x512c83[_0xb50f('0x42')]['offset']);}_0x142b6c[_0xb50f('0x49')]=qs[_0xb50f('0x4a')](_0x512c83[_0xb50f('0x42')][_0xb50f('0x4a')]);_0x142b6c[_0xb50f('0x4b')]=qs[_0xb50f('0x41')](_['pick'](_0x512c83[_0xb50f('0x42')],_0x5a634c[_0xb50f('0x41')]),_0x1b4ac8);if(_0x512c83[_0xb50f('0x42')][_0xb50f('0x4c')]){_0x142b6c['where']=_[_0xb50f('0x4d')](_0x142b6c[_0xb50f('0x4b')],{'$or':_[_0xb50f('0x39')](_0x1b4ac8,function(_0x357a10){if(_0x357a10[_0xb50f('0x3d')]!==_0xb50f('0x4e')){var _0x5d6a45={};_0x5d6a45[_0x357a10[_0xb50f('0x37')]]={'$like':'%'+_0x512c83['query'][_0xb50f('0x4c')]+'%'};return _0x5d6a45;}})});}_0x142b6c=_[_0xb50f('0x4d')]({},_0x142b6c,_0x512c83[_0xb50f('0x4f')]);var _0x53b370={'where':_0x142b6c[_0xb50f('0x4b')]};return db[_0xb50f('0x3a')][_0xb50f('0x2b')](_0x53b370)[_0xb50f('0x1f')](function(_0x51575f){_0x352dfb[_0xb50f('0x2b')]=_0x51575f;if(_0x512c83[_0xb50f('0x42')][_0xb50f('0x50')]){_0x142b6c['include']=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x142b6c);})[_0xb50f('0x1f')](function(_0xc4c844){_0x352dfb['rows']=_0xc4c844;return _0x352dfb;})[_0xb50f('0x1f')](respondWithFilteredResult(_0x1f3b7c,_0x142b6c))['catch'](handleError(_0x1f3b7c,null));};exports['show']=function(_0x42ede1,_0x19379f){var _0x2e0286={'raw':![],'where':{'id':_0x42ede1[_0xb50f('0x51')]['id']}},_0x1e94a4={};_0x1e94a4['model']=_[_0xb50f('0x40')](db[_0xb50f('0x3a')][_0xb50f('0x3b')]);_0x1e94a4['query']=_[_0xb50f('0x40')](_0x42ede1[_0xb50f('0x42')]);_0x1e94a4[_0xb50f('0x52')]=_[_0xb50f('0x44')](_0x1e94a4[_0xb50f('0x3f')],_0x1e94a4['query']);_0x2e0286[_0xb50f('0x43')]=_[_0xb50f('0x44')](_0x1e94a4[_0xb50f('0x3f')],qs[_0xb50f('0x45')](_0x42ede1[_0xb50f('0x42')][_0xb50f('0x45')]));_0x2e0286[_0xb50f('0x43')]=_0x2e0286[_0xb50f('0x43')][_0xb50f('0x46')]?_0x2e0286[_0xb50f('0x43')]:_0x1e94a4[_0xb50f('0x3f')];if(_0x42ede1[_0xb50f('0x42')]['includeAll']){_0x2e0286[_0xb50f('0x53')]=[{'all':!![]}];}_0x2e0286=_[_0xb50f('0x4d')]({},_0x2e0286,_0x42ede1[_0xb50f('0x4f')]);return db['DeskConfiguration'][_0xb50f('0x54')](_0x2e0286)[_0xb50f('0x1f')](handleEntityNotFound(_0x19379f,null))[_0xb50f('0x1f')](respondWithResult(_0x19379f,null))[_0xb50f('0x28')](handleError(_0x19379f,null));};exports['create']=function(_0x3bd6f7,_0x2cd085){return db[_0xb50f('0x3a')]['create'](_0x3bd6f7['body'],{})[_0xb50f('0x1f')](respondWithResult(_0x2cd085,0xc9))['catch'](handleError(_0x2cd085,null));};exports['update']=function(_0x167881,_0x55458b){if(_0x167881[_0xb50f('0x55')]['id']){delete _0x167881[_0xb50f('0x55')]['id'];}return db['DeskConfiguration'][_0xb50f('0x54')]({'where':{'id':_0x167881[_0xb50f('0x51')]['id']}})[_0xb50f('0x1f')](handleEntityNotFound(_0x55458b,null))[_0xb50f('0x1f')](saveUpdates(_0x167881[_0xb50f('0x55')],null))[_0xb50f('0x1f')](respondWithResult(_0x55458b,null))[_0xb50f('0x28')](handleError(_0x55458b,null));};exports[_0xb50f('0x34')]=function(_0x51372e,_0x2f50bb){return db[_0xb50f('0x3a')][_0xb50f('0x54')]({'where':{'id':_0x51372e[_0xb50f('0x51')]['id']}})[_0xb50f('0x1f')](handleEntityNotFound(_0x2f50bb,null))[_0xb50f('0x1f')](removeEntity(_0x2f50bb,null))['catch'](handleError(_0x2f50bb,null));};exports[_0xb50f('0x56')]=function(_0x206698,_0x3d552e,_0x3dac69){var _0x31dcd5={};var _0x40efe7={};var _0x390d75;var _0x5be574;return db[_0xb50f('0x3a')][_0xb50f('0x57')]({'where':{'id':_0x206698[_0xb50f('0x51')]['id']}})[_0xb50f('0x1f')](handleEntityNotFound(_0x3d552e,null))[_0xb50f('0x1f')](function(_0x4254a1){if(_0x4254a1){_0x390d75=_0x4254a1;_0x40efe7[_0xb50f('0x3f')]=_[_0xb50f('0x40')](db[_0xb50f('0x58')][_0xb50f('0x3b')]);_0x40efe7[_0xb50f('0x42')]=_['keys'](_0x206698[_0xb50f('0x42')]);_0x40efe7[_0xb50f('0x41')]=_['intersection'](_0x40efe7[_0xb50f('0x3f')],_0x40efe7[_0xb50f('0x42')]);_0x31dcd5['attributes']=_[_0xb50f('0x44')](_0x40efe7['model'],qs[_0xb50f('0x45')](_0x206698['query'][_0xb50f('0x45')]));_0x31dcd5[_0xb50f('0x43')]=_0x31dcd5[_0xb50f('0x43')][_0xb50f('0x46')]?_0x31dcd5[_0xb50f('0x43')]:_0x40efe7['model'];_0x31dcd5['order']=qs['sort'](_0x206698['query'][_0xb50f('0x4a')]);_0x31dcd5['where']=qs['filters'](_[_0xb50f('0x59')](_0x206698[_0xb50f('0x42')],_0x40efe7[_0xb50f('0x41')]));if(_0x206698[_0xb50f('0x42')][_0xb50f('0x4c')]){_0x31dcd5[_0xb50f('0x4b')]=_[_0xb50f('0x4d')](_0x31dcd5[_0xb50f('0x4b')],{'$or':_['map'](_0x31dcd5[_0xb50f('0x43')],function(_0x440bb9){var _0x56bdad={};_0x56bdad[_0x440bb9]={'$like':'%'+_0x206698[_0xb50f('0x42')][_0xb50f('0x4c')]+'%'};return _0x56bdad;})});}_0x31dcd5=_[_0xb50f('0x4d')]({},_0x31dcd5,_0x206698[_0xb50f('0x4f')]);return _0x390d75[_0xb50f('0x56')](_0x31dcd5);}})[_0xb50f('0x1f')](function(_0x5813cc){if(_0x5813cc){_0x5be574=_0x5813cc[_0xb50f('0x46')];if(!_0x206698['query'][_0xb50f('0x47')](_0xb50f('0x48'))){_0x31dcd5[_0xb50f('0x2d')]=qs[_0xb50f('0x2d')](_0x206698[_0xb50f('0x42')][_0xb50f('0x2d')]);_0x31dcd5[_0xb50f('0x2c')]=qs[_0xb50f('0x2c')](_0x206698['query'][_0xb50f('0x2c')]);}return _0x390d75[_0xb50f('0x56')](_0x31dcd5);}})['then'](function(_0x39aad6){if(_0x39aad6){return _0x39aad6?{'count':_0x5be574,'rows':_0x39aad6}:null;}})[_0xb50f('0x1f')](respondWithResult(_0x3d552e,null))['catch'](handleError(_0x3d552e,null));};exports[_0xb50f('0x5a')]=function(_0x500db0,_0x5d5ed9,_0x240022){var _0x116b78={};var _0x942a22={};var _0x52f101;var _0x32fbd5;return db['DeskConfiguration'][_0xb50f('0x57')]({'where':{'id':_0x500db0[_0xb50f('0x51')]['id']}})[_0xb50f('0x1f')](handleEntityNotFound(_0x5d5ed9,null))[_0xb50f('0x1f')](function(_0x5dfb86){if(_0x5dfb86){_0x52f101=_0x5dfb86;_0x942a22[_0xb50f('0x3f')]=_[_0xb50f('0x40')](db['DeskField']['rawAttributes']);_0x942a22[_0xb50f('0x42')]=_['keys'](_0x500db0[_0xb50f('0x42')]);_0x942a22[_0xb50f('0x41')]=_[_0xb50f('0x44')](_0x942a22['model'],_0x942a22[_0xb50f('0x42')]);_0x116b78['attributes']=_[_0xb50f('0x44')](_0x942a22[_0xb50f('0x3f')],qs[_0xb50f('0x45')](_0x500db0[_0xb50f('0x42')][_0xb50f('0x45')]));_0x116b78[_0xb50f('0x43')]=_0x116b78['attributes'][_0xb50f('0x46')]?_0x116b78['attributes']:_0x942a22[_0xb50f('0x3f')];_0x116b78[_0xb50f('0x49')]=qs['sort'](_0x500db0[_0xb50f('0x42')][_0xb50f('0x4a')]);_0x116b78[_0xb50f('0x4b')]=qs[_0xb50f('0x41')](_['pick'](_0x500db0[_0xb50f('0x42')],_0x942a22[_0xb50f('0x41')]));if(_0x500db0['query'][_0xb50f('0x4c')]){_0x116b78[_0xb50f('0x4b')]=_[_0xb50f('0x4d')](_0x116b78[_0xb50f('0x4b')],{'$or':_[_0xb50f('0x39')](_0x116b78[_0xb50f('0x43')],function(_0x3da949){var _0x13cc40={};_0x13cc40[_0x3da949]={'$like':'%'+_0x500db0['query'][_0xb50f('0x4c')]+'%'};return _0x13cc40;})});}_0x116b78=_[_0xb50f('0x4d')]({},_0x116b78,_0x500db0[_0xb50f('0x4f')]);return _0x52f101[_0xb50f('0x5a')](_0x116b78);}})[_0xb50f('0x1f')](function(_0x43396b){if(_0x43396b){_0x32fbd5=_0x43396b[_0xb50f('0x46')];if(!_0x500db0[_0xb50f('0x42')]['hasOwnProperty'](_0xb50f('0x48'))){_0x116b78[_0xb50f('0x2d')]=qs['limit'](_0x500db0[_0xb50f('0x42')][_0xb50f('0x2d')]);_0x116b78[_0xb50f('0x2c')]=qs[_0xb50f('0x2c')](_0x500db0[_0xb50f('0x42')][_0xb50f('0x2c')]);}return _0x52f101[_0xb50f('0x5a')](_0x116b78);}})[_0xb50f('0x1f')](function(_0x22b8e7){if(_0x22b8e7){return _0x22b8e7?{'count':_0x32fbd5,'rows':_0x22b8e7}:null;}})[_0xb50f('0x1f')](respondWithResult(_0x5d5ed9,null))[_0xb50f('0x28')](handleError(_0x5d5ed9,null));};exports[_0xb50f('0x5b')]=function(_0x27a9c1,_0xfe6de7,_0x398ace){var _0x3f62c9={};var _0x4b0dae={};var _0x3bc7f2;var _0x298f3a;return db['DeskConfiguration'][_0xb50f('0x57')]({'where':{'id':_0x27a9c1[_0xb50f('0x51')]['id']}})[_0xb50f('0x1f')](handleEntityNotFound(_0xfe6de7,null))['then'](function(_0x326ffb){if(_0x326ffb){_0x3bc7f2=_0x326ffb;_0x4b0dae['model']=_[_0xb50f('0x40')](db[_0xb50f('0x58')][_0xb50f('0x3b')]);_0x4b0dae[_0xb50f('0x42')]=_[_0xb50f('0x40')](_0x27a9c1['query']);_0x4b0dae['filters']=_['intersection'](_0x4b0dae[_0xb50f('0x3f')],_0x4b0dae[_0xb50f('0x42')]);_0x3f62c9[_0xb50f('0x43')]=_['intersection'](_0x4b0dae[_0xb50f('0x3f')],qs[_0xb50f('0x45')](_0x27a9c1['query'][_0xb50f('0x45')]));_0x3f62c9['attributes']=_0x3f62c9[_0xb50f('0x43')][_0xb50f('0x46')]?_0x3f62c9[_0xb50f('0x43')]:_0x4b0dae[_0xb50f('0x3f')];_0x3f62c9[_0xb50f('0x49')]=qs[_0xb50f('0x4a')](_0x27a9c1[_0xb50f('0x42')][_0xb50f('0x4a')]);_0x3f62c9['where']=qs[_0xb50f('0x41')](_['pick'](_0x27a9c1[_0xb50f('0x42')],_0x4b0dae['filters']));if(_0x27a9c1[_0xb50f('0x42')]['filter']){_0x3f62c9['where']=_[_0xb50f('0x4d')](_0x3f62c9[_0xb50f('0x4b')],{'$or':_[_0xb50f('0x39')](_0x3f62c9['attributes'],function(_0x377f11){var _0x520a2e={};_0x520a2e[_0x377f11]={'$like':'%'+_0x27a9c1['query'][_0xb50f('0x4c')]+'%'};return _0x520a2e;})});}_0x3f62c9=_[_0xb50f('0x4d')]({},_0x3f62c9,_0x27a9c1[_0xb50f('0x4f')]);return _0x3bc7f2[_0xb50f('0x5b')](_0x3f62c9);}})[_0xb50f('0x1f')](function(_0x3c6d15){if(_0x3c6d15){_0x298f3a=_0x3c6d15[_0xb50f('0x46')];if(!_0x27a9c1['query']['hasOwnProperty']('nolimit')){_0x3f62c9[_0xb50f('0x2d')]=qs['limit'](_0x27a9c1[_0xb50f('0x42')][_0xb50f('0x2d')]);_0x3f62c9['offset']=qs['offset'](_0x27a9c1['query']['offset']);}return _0x3bc7f2[_0xb50f('0x5b')](_0x3f62c9);}})[_0xb50f('0x1f')](function(_0x3c005d){if(_0x3c005d){return _0x3c005d?{'count':_0x298f3a,'rows':_0x3c005d}:null;}})['then'](respondWithResult(_0xfe6de7,null))['catch'](handleError(_0xfe6de7,null));};exports[_0xb50f('0x5c')]=function(_0x45f7e5,_0x256936,_0x501213){var _0x567ce6={};var _0x9ff8be={};var _0x4a0431;var _0x309c37;return db[_0xb50f('0x3a')]['findOne']({'where':{'id':_0x45f7e5[_0xb50f('0x51')]['id']}})[_0xb50f('0x1f')](handleEntityNotFound(_0x256936,null))[_0xb50f('0x1f')](function(_0x4ccf8a){if(_0x4ccf8a){_0x4a0431=_0x4ccf8a;_0x9ff8be['model']=_[_0xb50f('0x40')](db['Tag']['rawAttributes']);_0x9ff8be[_0xb50f('0x42')]=_['keys'](_0x45f7e5[_0xb50f('0x42')]);_0x9ff8be[_0xb50f('0x41')]=_['intersection'](_0x9ff8be[_0xb50f('0x3f')],_0x9ff8be['query']);_0x567ce6[_0xb50f('0x43')]=_['intersection'](_0x9ff8be[_0xb50f('0x3f')],qs[_0xb50f('0x45')](_0x45f7e5['query'][_0xb50f('0x45')]));_0x567ce6[_0xb50f('0x43')]=_0x567ce6['attributes']['length']?_0x567ce6['attributes']:_0x9ff8be['model'];_0x567ce6[_0xb50f('0x49')]=qs[_0xb50f('0x4a')](_0x45f7e5[_0xb50f('0x42')][_0xb50f('0x4a')]);_0x567ce6[_0xb50f('0x4b')]=qs['filters'](_[_0xb50f('0x59')](_0x45f7e5[_0xb50f('0x42')],_0x9ff8be['filters']));if(_0x45f7e5['query'][_0xb50f('0x4c')]){_0x567ce6[_0xb50f('0x4b')]=_['merge'](_0x567ce6[_0xb50f('0x4b')],{'$or':_['map'](_0x567ce6['attributes'],function(_0x3c0daa){var _0xd1a0e7={};_0xd1a0e7[_0x3c0daa]={'$like':'%'+_0x45f7e5[_0xb50f('0x42')]['filter']+'%'};return _0xd1a0e7;})});}_0x567ce6=_[_0xb50f('0x4d')]({},_0x567ce6,_0x45f7e5[_0xb50f('0x4f')]);return _0x4a0431[_0xb50f('0x5c')](_0x567ce6);}})[_0xb50f('0x1f')](function(_0x146c0c){if(_0x146c0c){_0x309c37=_0x146c0c[_0xb50f('0x46')];if(!_0x45f7e5[_0xb50f('0x42')][_0xb50f('0x47')]('nolimit')){_0x567ce6[_0xb50f('0x2d')]=qs[_0xb50f('0x2d')](_0x45f7e5[_0xb50f('0x42')][_0xb50f('0x2d')]);_0x567ce6['offset']=qs['offset'](_0x45f7e5['query']['offset']);}return _0x4a0431[_0xb50f('0x5c')](_0x567ce6);}})[_0xb50f('0x1f')](function(_0xb56541){if(_0xb56541){return _0xb56541?{'count':_0x309c37,'rows':_0xb56541}:null;}})[_0xb50f('0x1f')](respondWithResult(_0x256936,null))[_0xb50f('0x28')](handleError(_0x256936,null));};exports[_0xb50f('0x5d')]=function(_0x19d535,_0x10c465,_0xd118ea){if(_0x19d535[_0xb50f('0x55')]['id']){delete _0x19d535['body']['id'];}return db['DeskConfiguration'][_0xb50f('0x57')]({'where':{'id':_0x19d535[_0xb50f('0x51')]['id']}})[_0xb50f('0x1f')](handleEntityNotFound(_0x10c465,null))[_0xb50f('0x1f')](function(_0x58036b){if(_0x58036b){return _0x58036b[_0xb50f('0x5d')](_0x19d535[_0xb50f('0x55')]['ids']||[]);}return null;})[_0xb50f('0x1f')](respondWithResult(_0x10c465,null))[_0xb50f('0x28')](handleError(_0x10c465,null));}; \ No newline at end of file +var _0xfa70=['merge','options','count','include','findAll','show','params','filtears','length','includeAll','catch','create','body','find','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','status','end','json','offset','limit','save','update','destroy','stack','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','name','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter'];(function(_0x2246c7,_0x27b9d0){var _0x64944a=function(_0x2a1bb5){while(--_0x2a1bb5){_0x2246c7['push'](_0x2246c7['shift']());}};_0x64944a(++_0x27b9d0);}(_0xfa70,0xcd));var _0x0fa7=function(_0x275697,_0x39c26b){_0x275697=_0x275697-0x0;var _0x2758fc=_0xfa70[_0x275697];return _0x2758fc;};'use strict';var pdf=require(_0x0fa7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0fa7('0x1'));var zipdir=require(_0x0fa7('0x2'));var jsonpatch=require(_0x0fa7('0x3'));var rp=require('request-promise');var moment=require(_0x0fa7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0fa7('0x5'));var util=require(_0x0fa7('0x6'));var path=require('path');var sox=require(_0x0fa7('0x7'));var csv=require(_0x0fa7('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0fa7('0x9'));var squel=require(_0x0fa7('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0fa7('0xb'));var toCsv=require(_0x0fa7('0x8'));var querystring=require(_0x0fa7('0xc'));var Papa=require(_0x0fa7('0xd'));var Redis=require(_0x0fa7('0xe'));var authService=require(_0x0fa7('0xf'));var qs=require(_0x0fa7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0fa7('0x11'));var logger=require('../../config/logger')(_0x0fa7('0x12'));var utils=require(_0x0fa7('0x13'));var config=require(_0x0fa7('0x14'));var licenseUtil=require(_0x0fa7('0x15'));var db=require(_0x0fa7('0x16'))['db'];var jayson=require(_0x0fa7('0x17'));var client=jayson[_0x0fa7('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47d840,_0x210dbf,_0x2e0f1e,_0x18104e){return new BPromise(function(_0x3dfb5e,_0x214dd2){var _0x3c6ada=_0x18104e||client;return _0x3c6ada['request'](_0x47d840,_0x2e0f1e)[_0x0fa7('0x19')](function(_0x1ec865){logger[_0x0fa7('0x1a')](_0x0fa7('0x1b'),_0x210dbf,_0x0fa7('0x1c'));logger[_0x0fa7('0x1d')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x210dbf,_0x0fa7('0x1c'),JSON[_0x0fa7('0x1e')](_0x1ec865));if(_0x1ec865[_0x0fa7('0x1f')]){if(_0x1ec865[_0x0fa7('0x1f')][_0x0fa7('0x20')]===0x1f4){logger[_0x0fa7('0x1f')](_0x0fa7('0x1b'),_0x210dbf,_0x1ec865[_0x0fa7('0x1f')][_0x0fa7('0x21')]);return _0x214dd2(_0x1ec865[_0x0fa7('0x1f')][_0x0fa7('0x21')]);}logger[_0x0fa7('0x1f')]('DeskConfiguration,\x20%s,\x20%s',_0x210dbf,_0x1ec865[_0x0fa7('0x1f')][_0x0fa7('0x21')]);return _0x3dfb5e(_0x1ec865[_0x0fa7('0x1f')][_0x0fa7('0x21')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x210dbf,'request\x20sent');_0x3dfb5e(_0x1ec865['result'][_0x0fa7('0x21')]);}})['catch'](function(_0x84fc97){logger[_0x0fa7('0x1f')](_0x0fa7('0x1b'),_0x210dbf,_0x84fc97);_0x214dd2(_0x84fc97);});});}function respondWithStatusCode(_0x2fb51e,_0x194bee){_0x194bee=_0x194bee||0xcc;return function(_0x39278f){if(_0x39278f){return _0x2fb51e[_0x0fa7('0x22')](_0x194bee);}return _0x2fb51e[_0x0fa7('0x23')](_0x194bee)[_0x0fa7('0x24')]();};}function respondWithResult(_0x17f24b,_0x2aae75){_0x2aae75=_0x2aae75||0xc8;return function(_0x3f43a9){if(_0x3f43a9){return _0x17f24b[_0x0fa7('0x23')](_0x2aae75)[_0x0fa7('0x25')](_0x3f43a9);}};}function respondWithFilteredResult(_0x321e11,_0xdcf229){return function(_0x326f71){if(_0x326f71){var _0x1060a8=_0x326f71['count'],_0x4e6e3e=_0xdcf229[_0x0fa7('0x26')],_0x456d7e=_0xdcf229[_0x0fa7('0x26')]+_0xdcf229[_0x0fa7('0x27')],_0x4365ff;if(_0x456d7e>=_0x1060a8){_0x456d7e=_0x1060a8;_0x4365ff=0xc8;}else{_0x4365ff=0xce;}_0x321e11['status'](_0x4365ff);return _0x321e11['set']('Content-Range',_0x4e6e3e+'-'+_0x456d7e+'/'+_0x1060a8)[_0x0fa7('0x25')](_0x326f71);}return null;};}function patchUpdates(_0xb9af4){return function(_0x25f31b){try{jsonpatch['apply'](_0x25f31b,_0xb9af4,!![]);}catch(_0xb60128){return BPromise['reject'](_0xb60128);}return _0x25f31b[_0x0fa7('0x28')]();};}function saveUpdates(_0x3bc6f4,_0x39d12b){return function(_0x51bc7e){if(_0x51bc7e){return _0x51bc7e[_0x0fa7('0x29')](_0x3bc6f4)['then'](function(_0x498fc3){return _0x498fc3;});}return null;};}function removeEntity(_0x200cbd,_0x2d59c6){return function(_0x2228e9){if(_0x2228e9){return _0x2228e9[_0x0fa7('0x2a')]()['then'](function(){_0x200cbd[_0x0fa7('0x23')](0xcc)[_0x0fa7('0x24')]();});}};}function handleEntityNotFound(_0x1eb523,_0x4f0fae){return function(_0x2c1c35){if(!_0x2c1c35){_0x1eb523[_0x0fa7('0x22')](0x194);}return _0x2c1c35;};}function handleError(_0x28fbae,_0x2dbe57){_0x2dbe57=_0x2dbe57||0x1f4;return function(_0x584e04){logger[_0x0fa7('0x1f')](_0x584e04[_0x0fa7('0x2b')]);if(_0x584e04['name']){delete _0x584e04['name'];}_0x28fbae[_0x0fa7('0x23')](_0x2dbe57)[_0x0fa7('0x2c')](_0x584e04);};}exports[_0x0fa7('0x2d')]=function(_0x25f361,_0x208bcc){var _0x2d61cf={},_0x3f1d31={},_0xdcd8ca={'count':0x0,'rows':[]};var _0x3f4b21=_[_0x0fa7('0x2e')](db[_0x0fa7('0x2f')][_0x0fa7('0x30')],function(_0x38573c){return{'name':_0x38573c[_0x0fa7('0x31')],'type':_0x38573c[_0x0fa7('0x32')][_0x0fa7('0x33')]};});_0x3f1d31['model']=_[_0x0fa7('0x2e')](_0x3f4b21,_0x0fa7('0x34'));_0x3f1d31[_0x0fa7('0x35')]=_[_0x0fa7('0x36')](_0x25f361[_0x0fa7('0x35')]);_0x3f1d31['filters']=_[_0x0fa7('0x37')](_0x3f1d31[_0x0fa7('0x38')],_0x3f1d31['query']);_0x2d61cf['attributes']=_[_0x0fa7('0x37')](_0x3f1d31[_0x0fa7('0x38')],qs[_0x0fa7('0x39')](_0x25f361[_0x0fa7('0x35')]['fields']));_0x2d61cf[_0x0fa7('0x3a')]=_0x2d61cf['attributes']['length']?_0x2d61cf[_0x0fa7('0x3a')]:_0x3f1d31[_0x0fa7('0x38')];if(!_0x25f361[_0x0fa7('0x35')][_0x0fa7('0x3b')](_0x0fa7('0x3c'))){_0x2d61cf[_0x0fa7('0x27')]=qs[_0x0fa7('0x27')](_0x25f361[_0x0fa7('0x35')]['limit']);_0x2d61cf[_0x0fa7('0x26')]=qs[_0x0fa7('0x26')](_0x25f361[_0x0fa7('0x35')]['offset']);}_0x2d61cf[_0x0fa7('0x3d')]=qs['sort'](_0x25f361[_0x0fa7('0x35')][_0x0fa7('0x3e')]);_0x2d61cf[_0x0fa7('0x3f')]=qs[_0x0fa7('0x40')](_[_0x0fa7('0x41')](_0x25f361['query'],_0x3f1d31[_0x0fa7('0x40')]),_0x3f4b21);if(_0x25f361[_0x0fa7('0x35')]['filter']){_0x2d61cf[_0x0fa7('0x3f')]=_['merge'](_0x2d61cf[_0x0fa7('0x3f')],{'$or':_['map'](_0x3f4b21,function(_0x285ad5){if(_0x285ad5[_0x0fa7('0x32')]!==_0x0fa7('0x42')){var _0x2f4de4={};_0x2f4de4[_0x285ad5[_0x0fa7('0x34')]]={'$like':'%'+_0x25f361['query'][_0x0fa7('0x43')]+'%'};return _0x2f4de4;}})});}_0x2d61cf=_[_0x0fa7('0x44')]({},_0x2d61cf,_0x25f361[_0x0fa7('0x45')]);var _0x39d99b={'where':_0x2d61cf[_0x0fa7('0x3f')]};return db[_0x0fa7('0x2f')][_0x0fa7('0x46')](_0x39d99b)['then'](function(_0x36585a){_0xdcd8ca[_0x0fa7('0x46')]=_0x36585a;if(_0x25f361['query']['includeAll']){_0x2d61cf[_0x0fa7('0x47')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x0fa7('0x48')](_0x2d61cf);})[_0x0fa7('0x19')](function(_0x3556f7){_0xdcd8ca['rows']=_0x3556f7;return _0xdcd8ca;})[_0x0fa7('0x19')](respondWithFilteredResult(_0x208bcc,_0x2d61cf))['catch'](handleError(_0x208bcc,null));};exports[_0x0fa7('0x49')]=function(_0x11716f,_0x150c60){var _0x2d69e4={'raw':![],'where':{'id':_0x11716f[_0x0fa7('0x4a')]['id']}},_0x4d573c={};_0x4d573c[_0x0fa7('0x38')]=_[_0x0fa7('0x36')](db[_0x0fa7('0x2f')][_0x0fa7('0x30')]);_0x4d573c[_0x0fa7('0x35')]=_[_0x0fa7('0x36')](_0x11716f[_0x0fa7('0x35')]);_0x4d573c[_0x0fa7('0x4b')]=_[_0x0fa7('0x37')](_0x4d573c[_0x0fa7('0x38')],_0x4d573c[_0x0fa7('0x35')]);_0x2d69e4['attributes']=_[_0x0fa7('0x37')](_0x4d573c[_0x0fa7('0x38')],qs[_0x0fa7('0x39')](_0x11716f['query'][_0x0fa7('0x39')]));_0x2d69e4[_0x0fa7('0x3a')]=_0x2d69e4['attributes'][_0x0fa7('0x4c')]?_0x2d69e4['attributes']:_0x4d573c[_0x0fa7('0x38')];if(_0x11716f[_0x0fa7('0x35')][_0x0fa7('0x4d')]){_0x2d69e4['include']=[{'all':!![]}];}_0x2d69e4=_['merge']({},_0x2d69e4,_0x11716f[_0x0fa7('0x45')]);return db[_0x0fa7('0x2f')]['find'](_0x2d69e4)[_0x0fa7('0x19')](handleEntityNotFound(_0x150c60,null))['then'](respondWithResult(_0x150c60,null))[_0x0fa7('0x4e')](handleError(_0x150c60,null));};exports[_0x0fa7('0x4f')]=function(_0x4d7a0c,_0xe463f6){return db[_0x0fa7('0x2f')][_0x0fa7('0x4f')](_0x4d7a0c[_0x0fa7('0x50')],{})[_0x0fa7('0x19')](respondWithResult(_0xe463f6,0xc9))['catch'](handleError(_0xe463f6,null));};exports[_0x0fa7('0x29')]=function(_0x158e2d,_0x2ff89b){if(_0x158e2d[_0x0fa7('0x50')]['id']){delete _0x158e2d['body']['id'];}return db[_0x0fa7('0x2f')][_0x0fa7('0x51')]({'where':{'id':_0x158e2d['params']['id']}})['then'](handleEntityNotFound(_0x2ff89b,null))[_0x0fa7('0x19')](saveUpdates(_0x158e2d[_0x0fa7('0x50')],null))['then'](respondWithResult(_0x2ff89b,null))[_0x0fa7('0x4e')](handleError(_0x2ff89b,null));};exports['destroy']=function(_0xb42d2a,_0x52230d){return db['DeskConfiguration']['find']({'where':{'id':_0xb42d2a[_0x0fa7('0x4a')]['id']}})[_0x0fa7('0x19')](handleEntityNotFound(_0x52230d,null))[_0x0fa7('0x19')](removeEntity(_0x52230d,null))['catch'](handleError(_0x52230d,null));};exports[_0x0fa7('0x52')]=function(_0xb8d559,_0xdfc978,_0x4ddcd){var _0x15aedf={};var _0xbf360={};var _0x2c0fdc;var _0x4db4e7;return db[_0x0fa7('0x2f')][_0x0fa7('0x53')]({'where':{'id':_0xb8d559['params']['id']}})[_0x0fa7('0x19')](handleEntityNotFound(_0xdfc978,null))[_0x0fa7('0x19')](function(_0x45ccb9){if(_0x45ccb9){_0x2c0fdc=_0x45ccb9;_0xbf360[_0x0fa7('0x38')]=_['keys'](db[_0x0fa7('0x54')][_0x0fa7('0x30')]);_0xbf360[_0x0fa7('0x35')]=_['keys'](_0xb8d559['query']);_0xbf360[_0x0fa7('0x40')]=_[_0x0fa7('0x37')](_0xbf360[_0x0fa7('0x38')],_0xbf360[_0x0fa7('0x35')]);_0x15aedf[_0x0fa7('0x3a')]=_[_0x0fa7('0x37')](_0xbf360[_0x0fa7('0x38')],qs['fields'](_0xb8d559[_0x0fa7('0x35')][_0x0fa7('0x39')]));_0x15aedf[_0x0fa7('0x3a')]=_0x15aedf[_0x0fa7('0x3a')]['length']?_0x15aedf['attributes']:_0xbf360[_0x0fa7('0x38')];_0x15aedf[_0x0fa7('0x3d')]=qs[_0x0fa7('0x3e')](_0xb8d559['query'][_0x0fa7('0x3e')]);_0x15aedf[_0x0fa7('0x3f')]=qs[_0x0fa7('0x40')](_['pick'](_0xb8d559[_0x0fa7('0x35')],_0xbf360[_0x0fa7('0x40')]));if(_0xb8d559[_0x0fa7('0x35')][_0x0fa7('0x43')]){_0x15aedf[_0x0fa7('0x3f')]=_[_0x0fa7('0x44')](_0x15aedf[_0x0fa7('0x3f')],{'$or':_[_0x0fa7('0x2e')](_0x15aedf[_0x0fa7('0x3a')],function(_0x4db437){var _0x1f1d16={};_0x1f1d16[_0x4db437]={'$like':'%'+_0xb8d559[_0x0fa7('0x35')][_0x0fa7('0x43')]+'%'};return _0x1f1d16;})});}_0x15aedf=_[_0x0fa7('0x44')]({},_0x15aedf,_0xb8d559['options']);return _0x2c0fdc[_0x0fa7('0x52')](_0x15aedf);}})[_0x0fa7('0x19')](function(_0x181110){if(_0x181110){_0x4db4e7=_0x181110[_0x0fa7('0x4c')];if(!_0xb8d559['query']['hasOwnProperty'](_0x0fa7('0x3c'))){_0x15aedf['limit']=qs[_0x0fa7('0x27')](_0xb8d559[_0x0fa7('0x35')][_0x0fa7('0x27')]);_0x15aedf['offset']=qs['offset'](_0xb8d559[_0x0fa7('0x35')][_0x0fa7('0x26')]);}return _0x2c0fdc[_0x0fa7('0x52')](_0x15aedf);}})[_0x0fa7('0x19')](function(_0x1ea781){if(_0x1ea781){return _0x1ea781?{'count':_0x4db4e7,'rows':_0x1ea781}:null;}})[_0x0fa7('0x19')](respondWithResult(_0xdfc978,null))[_0x0fa7('0x4e')](handleError(_0xdfc978,null));};exports['getSubjects']=function(_0x2b0554,_0x3eeaf3,_0x948a72){var _0x196298={};var _0x263b31={};var _0x1d5dae;var _0x1213d5;return db[_0x0fa7('0x2f')][_0x0fa7('0x53')]({'where':{'id':_0x2b0554['params']['id']}})[_0x0fa7('0x19')](handleEntityNotFound(_0x3eeaf3,null))[_0x0fa7('0x19')](function(_0x29faaf){if(_0x29faaf){_0x1d5dae=_0x29faaf;_0x263b31[_0x0fa7('0x38')]=_[_0x0fa7('0x36')](db[_0x0fa7('0x54')][_0x0fa7('0x30')]);_0x263b31[_0x0fa7('0x35')]=_[_0x0fa7('0x36')](_0x2b0554[_0x0fa7('0x35')]);_0x263b31[_0x0fa7('0x40')]=_[_0x0fa7('0x37')](_0x263b31[_0x0fa7('0x38')],_0x263b31[_0x0fa7('0x35')]);_0x196298[_0x0fa7('0x3a')]=_[_0x0fa7('0x37')](_0x263b31[_0x0fa7('0x38')],qs[_0x0fa7('0x39')](_0x2b0554[_0x0fa7('0x35')][_0x0fa7('0x39')]));_0x196298[_0x0fa7('0x3a')]=_0x196298[_0x0fa7('0x3a')][_0x0fa7('0x4c')]?_0x196298[_0x0fa7('0x3a')]:_0x263b31['model'];_0x196298['order']=qs[_0x0fa7('0x3e')](_0x2b0554['query'][_0x0fa7('0x3e')]);_0x196298[_0x0fa7('0x3f')]=qs['filters'](_[_0x0fa7('0x41')](_0x2b0554[_0x0fa7('0x35')],_0x263b31[_0x0fa7('0x40')]));if(_0x2b0554[_0x0fa7('0x35')][_0x0fa7('0x43')]){_0x196298[_0x0fa7('0x3f')]=_[_0x0fa7('0x44')](_0x196298['where'],{'$or':_[_0x0fa7('0x2e')](_0x196298[_0x0fa7('0x3a')],function(_0x3469f8){var _0x37daf1={};_0x37daf1[_0x3469f8]={'$like':'%'+_0x2b0554['query'][_0x0fa7('0x43')]+'%'};return _0x37daf1;})});}_0x196298=_[_0x0fa7('0x44')]({},_0x196298,_0x2b0554[_0x0fa7('0x45')]);return _0x1d5dae[_0x0fa7('0x55')](_0x196298);}})[_0x0fa7('0x19')](function(_0x4448dd){if(_0x4448dd){_0x1213d5=_0x4448dd['length'];if(!_0x2b0554[_0x0fa7('0x35')][_0x0fa7('0x3b')](_0x0fa7('0x3c'))){_0x196298[_0x0fa7('0x27')]=qs[_0x0fa7('0x27')](_0x2b0554['query'][_0x0fa7('0x27')]);_0x196298[_0x0fa7('0x26')]=qs['offset'](_0x2b0554[_0x0fa7('0x35')][_0x0fa7('0x26')]);}return _0x1d5dae[_0x0fa7('0x55')](_0x196298);}})[_0x0fa7('0x19')](function(_0x32e2b0){if(_0x32e2b0){return _0x32e2b0?{'count':_0x1213d5,'rows':_0x32e2b0}:null;}})[_0x0fa7('0x19')](respondWithResult(_0x3eeaf3,null))[_0x0fa7('0x4e')](handleError(_0x3eeaf3,null));};exports[_0x0fa7('0x56')]=function(_0x2a9487,_0x161ad2,_0x5d54dc){var _0xb5a744={};var _0x322d45={};var _0xd75908;var _0x577abe;return db[_0x0fa7('0x2f')][_0x0fa7('0x53')]({'where':{'id':_0x2a9487[_0x0fa7('0x4a')]['id']}})[_0x0fa7('0x19')](handleEntityNotFound(_0x161ad2,null))[_0x0fa7('0x19')](function(_0x8b6b76){if(_0x8b6b76){_0xd75908=_0x8b6b76;_0x322d45[_0x0fa7('0x38')]=_[_0x0fa7('0x36')](db[_0x0fa7('0x54')][_0x0fa7('0x30')]);_0x322d45[_0x0fa7('0x35')]=_[_0x0fa7('0x36')](_0x2a9487['query']);_0x322d45[_0x0fa7('0x40')]=_[_0x0fa7('0x37')](_0x322d45[_0x0fa7('0x38')],_0x322d45[_0x0fa7('0x35')]);_0xb5a744[_0x0fa7('0x3a')]=_[_0x0fa7('0x37')](_0x322d45[_0x0fa7('0x38')],qs[_0x0fa7('0x39')](_0x2a9487['query'][_0x0fa7('0x39')]));_0xb5a744['attributes']=_0xb5a744[_0x0fa7('0x3a')][_0x0fa7('0x4c')]?_0xb5a744[_0x0fa7('0x3a')]:_0x322d45['model'];_0xb5a744[_0x0fa7('0x3d')]=qs[_0x0fa7('0x3e')](_0x2a9487[_0x0fa7('0x35')][_0x0fa7('0x3e')]);_0xb5a744[_0x0fa7('0x3f')]=qs['filters'](_[_0x0fa7('0x41')](_0x2a9487[_0x0fa7('0x35')],_0x322d45['filters']));if(_0x2a9487[_0x0fa7('0x35')]['filter']){_0xb5a744['where']=_[_0x0fa7('0x44')](_0xb5a744['where'],{'$or':_[_0x0fa7('0x2e')](_0xb5a744['attributes'],function(_0x219256){var _0x17b2bf={};_0x17b2bf[_0x219256]={'$like':'%'+_0x2a9487[_0x0fa7('0x35')]['filter']+'%'};return _0x17b2bf;})});}_0xb5a744=_[_0x0fa7('0x44')]({},_0xb5a744,_0x2a9487[_0x0fa7('0x45')]);return _0xd75908['getDescriptions'](_0xb5a744);}})[_0x0fa7('0x19')](function(_0x2674d4){if(_0x2674d4){_0x577abe=_0x2674d4['length'];if(!_0x2a9487[_0x0fa7('0x35')][_0x0fa7('0x3b')](_0x0fa7('0x3c'))){_0xb5a744[_0x0fa7('0x27')]=qs[_0x0fa7('0x27')](_0x2a9487[_0x0fa7('0x35')][_0x0fa7('0x27')]);_0xb5a744['offset']=qs[_0x0fa7('0x26')](_0x2a9487[_0x0fa7('0x35')]['offset']);}return _0xd75908[_0x0fa7('0x56')](_0xb5a744);}})[_0x0fa7('0x19')](function(_0x8d0848){if(_0x8d0848){return _0x8d0848?{'count':_0x577abe,'rows':_0x8d0848}:null;}})[_0x0fa7('0x19')](respondWithResult(_0x161ad2,null))['catch'](handleError(_0x161ad2,null));};exports[_0x0fa7('0x57')]=function(_0x1a9d67,_0x22ca63,_0x46b237){var _0x40854f={};var _0x31a19f={};var _0x443ca7;var _0x58b9d6;return db[_0x0fa7('0x2f')][_0x0fa7('0x53')]({'where':{'id':_0x1a9d67[_0x0fa7('0x4a')]['id']}})[_0x0fa7('0x19')](handleEntityNotFound(_0x22ca63,null))[_0x0fa7('0x19')](function(_0x40e437){if(_0x40e437){_0x443ca7=_0x40e437;_0x31a19f['model']=_[_0x0fa7('0x36')](db[_0x0fa7('0x58')]['rawAttributes']);_0x31a19f['query']=_[_0x0fa7('0x36')](_0x1a9d67[_0x0fa7('0x35')]);_0x31a19f[_0x0fa7('0x40')]=_[_0x0fa7('0x37')](_0x31a19f[_0x0fa7('0x38')],_0x31a19f[_0x0fa7('0x35')]);_0x40854f['attributes']=_[_0x0fa7('0x37')](_0x31a19f[_0x0fa7('0x38')],qs['fields'](_0x1a9d67[_0x0fa7('0x35')][_0x0fa7('0x39')]));_0x40854f[_0x0fa7('0x3a')]=_0x40854f[_0x0fa7('0x3a')][_0x0fa7('0x4c')]?_0x40854f[_0x0fa7('0x3a')]:_0x31a19f[_0x0fa7('0x38')];_0x40854f['order']=qs[_0x0fa7('0x3e')](_0x1a9d67['query'][_0x0fa7('0x3e')]);_0x40854f[_0x0fa7('0x3f')]=qs[_0x0fa7('0x40')](_['pick'](_0x1a9d67[_0x0fa7('0x35')],_0x31a19f[_0x0fa7('0x40')]));if(_0x1a9d67['query']['filter']){_0x40854f[_0x0fa7('0x3f')]=_['merge'](_0x40854f['where'],{'$or':_[_0x0fa7('0x2e')](_0x40854f[_0x0fa7('0x3a')],function(_0x15db20){var _0x2a1b6e={};_0x2a1b6e[_0x15db20]={'$like':'%'+_0x1a9d67['query']['filter']+'%'};return _0x2a1b6e;})});}_0x40854f=_[_0x0fa7('0x44')]({},_0x40854f,_0x1a9d67[_0x0fa7('0x45')]);return _0x443ca7[_0x0fa7('0x57')](_0x40854f);}})[_0x0fa7('0x19')](function(_0x12a32e){if(_0x12a32e){_0x58b9d6=_0x12a32e['length'];if(!_0x1a9d67[_0x0fa7('0x35')][_0x0fa7('0x3b')](_0x0fa7('0x3c'))){_0x40854f[_0x0fa7('0x27')]=qs[_0x0fa7('0x27')](_0x1a9d67['query'][_0x0fa7('0x27')]);_0x40854f[_0x0fa7('0x26')]=qs[_0x0fa7('0x26')](_0x1a9d67[_0x0fa7('0x35')][_0x0fa7('0x26')]);}return _0x443ca7[_0x0fa7('0x57')](_0x40854f);}})[_0x0fa7('0x19')](function(_0x3bf845){if(_0x3bf845){return _0x3bf845?{'count':_0x58b9d6,'rows':_0x3bf845}:null;}})['then'](respondWithResult(_0x22ca63,null))['catch'](handleError(_0x22ca63,null));};exports[_0x0fa7('0x59')]=function(_0x628ffb,_0x4e0bd5,_0x188164){if(_0x628ffb[_0x0fa7('0x50')]['id']){delete _0x628ffb[_0x0fa7('0x50')]['id'];}return db[_0x0fa7('0x2f')][_0x0fa7('0x53')]({'where':{'id':_0x628ffb[_0x0fa7('0x4a')]['id']}})[_0x0fa7('0x19')](handleEntityNotFound(_0x4e0bd5,null))[_0x0fa7('0x19')](function(_0x4ded41){if(_0x4ded41){return _0x4ded41[_0x0fa7('0x59')](_0x628ffb['body'][_0x0fa7('0x5a')]||[]);}return null;})[_0x0fa7('0x19')](respondWithResult(_0x4e0bd5,null))[_0x0fa7('0x4e')](handleError(_0x4e0bd5,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 0f38e34..ae7ac36 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 _0xbbcd=['request-promise','path','rimraf','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1f99a0,_0x50b73d){var _0x1e0849=function(_0x41e764){while(--_0x41e764){_0x1f99a0['push'](_0x1f99a0['shift']());}};_0x1e0849(++_0x50b73d);}(_0xbbcd,0x171));var _0xdbbc=function(_0x16a599,_0x3ba59f){_0x16a599=_0x16a599-0x0;var _0xf8a94c=_0xbbcd[_0x16a599];return _0xf8a94c;};'use strict';var _=require(_0xdbbc('0x0'));var util=require(_0xdbbc('0x1'));var logger=require(_0xdbbc('0x2'))('api');var moment=require(_0xdbbc('0x3'));var BPromise=require(_0xdbbc('0x4'));var rp=require(_0xdbbc('0x5'));var fs=require('fs');var path=require(_0xdbbc('0x6'));var rimraf=require(_0xdbbc('0x7'));var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x38c1a6,_0x34812b){return _0x38c1a6[_0xdbbc('0x8')](_0xdbbc('0x9'),attributes,{'tableName':_0xdbbc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1541=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x4966d1,_0x3716c0){var _0x7cb44b=function(_0x3f34a5){while(--_0x3f34a5){_0x4966d1['push'](_0x4966d1['shift']());}};_0x7cb44b(++_0x3716c0);}(_0x1541,0xa7));var _0x1154=function(_0xf168d3,_0x43dcfc){_0xf168d3=_0xf168d3-0x0;var _0x17fb54=_0x1541[_0xf168d3];return _0x17fb54;};'use strict';var _=require(_0x1154('0x0'));var util=require(_0x1154('0x1'));var logger=require(_0x1154('0x2'))('api');var moment=require(_0x1154('0x3'));var BPromise=require(_0x1154('0x4'));var rp=require(_0x1154('0x5'));var fs=require('fs');var path=require(_0x1154('0x6'));var rimraf=require(_0x1154('0x7'));var config=require(_0x1154('0x8'));var attributes=require(_0x1154('0x9'));module[_0x1154('0xa')]=function(_0x189224,_0x4f6eac){return _0x189224[_0x1154('0xb')](_0x1154('0xc'),attributes,{'tableName':_0x1154('0xd'),'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 06533f1..3475332 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 _0xf2a6=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','result','catch','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0xf2a6,0x13d));var _0x6f2a=function(_0x5d03b8,_0x481517){_0x5d03b8=_0x5d03b8-0x0;var _0x2de442=_0xf2a6[_0x5d03b8];return _0x2de442;};'use strict';var _=require(_0x6f2a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6f2a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f2a('0x2'))['db'];var utils=require(_0x6f2a('0x3'));var logger=require(_0x6f2a('0x4'))(_0x6f2a('0x5'));var config=require(_0x6f2a('0x6'));var jayson=require(_0x6f2a('0x7'));var client=jayson[_0x6f2a('0x8')][_0x6f2a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1efd8,_0x424ebd,_0x4b4fde){return new BPromise(function(_0x379b80,_0xda4179){return client[_0x6f2a('0xa')](_0x1efd8,_0x4b4fde)[_0x6f2a('0xb')](function(_0x5b1229){logger[_0x6f2a('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x424ebd,_0x6f2a('0xd'));logger[_0x6f2a('0xe')](_0x6f2a('0xf'),_0x424ebd,'request\x20sent',JSON[_0x6f2a('0x10')](_0x5b1229));if(_0x5b1229['error']){if(_0x5b1229[_0x6f2a('0x11')][_0x6f2a('0x12')]===0x1f4){logger[_0x6f2a('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x424ebd,_0x5b1229[_0x6f2a('0x11')]['message']);return _0xda4179(_0x5b1229[_0x6f2a('0x11')][_0x6f2a('0x13')]);}logger[_0x6f2a('0x11')](_0x6f2a('0x14'),_0x424ebd,_0x5b1229[_0x6f2a('0x11')]['message']);return _0x379b80(_0x5b1229[_0x6f2a('0x11')][_0x6f2a('0x13')]);}else{logger[_0x6f2a('0xc')](_0x6f2a('0x14'),_0x424ebd,_0x6f2a('0xd'));_0x379b80(_0x5b1229[_0x6f2a('0x15')][_0x6f2a('0x13')]);}})[_0x6f2a('0x16')](function(_0x2cf5de){logger[_0x6f2a('0x11')](_0x6f2a('0x14'),_0x424ebd,_0x2cf5de);_0xda4179(_0x2cf5de);});});} \ No newline at end of file +var _0xe812=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','moment'];(function(_0x2160e,_0x30ae52){var _0x43d380=function(_0x47c6a4){while(--_0x47c6a4){_0x2160e['push'](_0x2160e['shift']());}};_0x43d380(++_0x30ae52);}(_0xe812,0x1f2));var _0x2e81=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe812[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2e81('0x0'));var moment=require(_0x2e81('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e81('0x2'));var db=require(_0x2e81('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e81('0x4'))(_0x2e81('0x5'));var config=require('../../config/environment');var jayson=require(_0x2e81('0x6'));var client=jayson[_0x2e81('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36604d,_0x32b221,_0x27f9c6){return new BPromise(function(_0x5559ca,_0x142cab){return client[_0x2e81('0x8')](_0x36604d,_0x27f9c6)[_0x2e81('0x9')](function(_0x11a56b){logger['info'](_0x2e81('0xa'),_0x32b221,_0x2e81('0xb'));logger[_0x2e81('0xc')](_0x2e81('0xd'),_0x32b221,_0x2e81('0xb'),JSON[_0x2e81('0xe')](_0x11a56b));if(_0x11a56b[_0x2e81('0xf')]){if(_0x11a56b[_0x2e81('0xf')][_0x2e81('0x10')]===0x1f4){logger[_0x2e81('0xf')](_0x2e81('0xa'),_0x32b221,_0x11a56b['error'][_0x2e81('0x11')]);return _0x142cab(_0x11a56b[_0x2e81('0xf')]['message']);}logger[_0x2e81('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x32b221,_0x11a56b[_0x2e81('0xf')][_0x2e81('0x11')]);return _0x5559ca(_0x11a56b[_0x2e81('0xf')][_0x2e81('0x11')]);}else{logger[_0x2e81('0x12')](_0x2e81('0xa'),_0x32b221,'request\x20sent');_0x5559ca(_0x11a56b[_0x2e81('0x13')][_0x2e81('0x11')]);}})['catch'](function(_0x330131){logger['error'](_0x2e81('0xa'),_0x32b221,_0x330131);_0x142cab(_0x330131);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 176f719..6ad0c41 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 _0xaf45=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','index','/:id','isAuthenticated','show','post','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x1486ce,_0x133a36){var _0x236fd4=function(_0x1c04dd){while(--_0x1c04dd){_0x1486ce['push'](_0x1486ce['shift']());}};_0x236fd4(++_0x133a36);}(_0xaf45,0xb0));var _0x5af4=function(_0x2880d8,_0x284ded){_0x2880d8=_0x2880d8-0x0;var _0x51f5a9=_0xaf45[_0x2880d8];return _0x51f5a9;};'use strict';var multer=require('multer');var util=require(_0x5af4('0x0'));var path=require(_0x5af4('0x1'));var timeout=require(_0x5af4('0x2'));var express=require(_0x5af4('0x3'));var router=express['Router']();var auth=require(_0x5af4('0x4'));var interaction=require(_0x5af4('0x5'));var config=require(_0x5af4('0x6'));var controller=require(_0x5af4('0x7'));router[_0x5af4('0x8')]('/',auth['isAuthenticated'](),controller[_0x5af4('0x9')]);router[_0x5af4('0x8')](_0x5af4('0xa'),auth[_0x5af4('0xb')](),controller[_0x5af4('0xc')]);router[_0x5af4('0xd')]('/',auth[_0x5af4('0xb')](),controller['create']);router[_0x5af4('0xe')](_0x5af4('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5af4('0xf')](_0x5af4('0xa'),auth[_0x5af4('0xb')](),controller[_0x5af4('0x10')]);module[_0x5af4('0x11')]=router; \ No newline at end of file +var _0x527e=['/:id','show','post','isAuthenticated','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDeskField.controller','index','get'];(function(_0x4de734,_0x156f52){var _0x398938=function(_0x4bfc1c){while(--_0x4bfc1c){_0x4de734['push'](_0x4de734['shift']());}};_0x398938(++_0x156f52);}(_0x527e,0x1ca));var _0xe527=function(_0x355e0e,_0x5401d1){_0x355e0e=_0x355e0e-0x0;var _0x3a10ea=_0x527e[_0x355e0e];return _0x3a10ea;};'use strict';var multer=require(_0xe527('0x0'));var util=require('util');var path=require(_0xe527('0x1'));var timeout=require(_0xe527('0x2'));var express=require(_0xe527('0x3'));var router=express[_0xe527('0x4')]();var auth=require(_0xe527('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe527('0x6'));var controller=require(_0xe527('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe527('0x8')]);router[_0xe527('0x9')](_0xe527('0xa'),auth['isAuthenticated'](),controller[_0xe527('0xb')]);router[_0xe527('0xc')]('/',auth[_0xe527('0xd')](),controller['create']);router[_0xe527('0xe')](_0xe527('0xa'),auth[_0xe527('0xd')](),controller['update']);router[_0xe527('0xf')]('/:id',auth[_0xe527('0xd')](),controller[_0xe527('0x10')]);module[_0xe527('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index de4d68a..65e5f07 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 _0x79bb=['STRING','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','variable'];(function(_0x2c9d30,_0xb7653e){var _0x2ca878=function(_0x2923ef){while(--_0x2923ef){_0x2c9d30['push'](_0x2c9d30['shift']());}};_0x2ca878(++_0xb7653e);}(_0x79bb,0xc8));var _0xb79b=function(_0x16bfc5,_0x4f9dc3){_0x16bfc5=_0x16bfc5-0x0;var _0x43b820=_0x79bb[_0x16bfc5];return _0x43b820;};'use strict';var Sequelize=require(_0xb79b('0x0'));module[_0xb79b('0x1')]={'type':{'type':Sequelize[_0xb79b('0x2')](_0xb79b('0x3'),'variable',_0xb79b('0x4'),_0xb79b('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xb79b('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xb79b('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb79b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb79b('0x7')]}}; \ No newline at end of file +var _0x3466=['BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','STRING','ENUM'];(function(_0x20d0e1,_0x40be61){var _0x3d11b7=function(_0x42fb45){while(--_0x42fb45){_0x20d0e1['push'](_0x20d0e1['shift']());}};_0x3d11b7(++_0x40be61);}(_0x3466,0x145));var _0x6346=function(_0xe34c89,_0x57ad1d){_0xe34c89=_0xe34c89-0x0;var _0xb1da27=_0x3466[_0xe34c89];return _0xb1da27;};'use strict';var Sequelize=require(_0x6346('0x0'));module[_0x6346('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6346('0x2'),_0x6346('0x3'),_0x6346('0x4'),_0x6346('0x5')),'defaultValue':_0x6346('0x2')},'content':{'type':Sequelize[_0x6346('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6346('0x7')](_0x6346('0x2'),_0x6346('0x3'),_0x6346('0x4'))},'keyContent':{'type':Sequelize[_0x6346('0x6')]},'idField':{'type':Sequelize[_0x6346('0x6')]},'nameField':{'type':Sequelize[_0x6346('0x6')]},'customField':{'type':Sequelize[_0x6346('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6346('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 4691501..1159149 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 _0xaf02=['zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','filtears','merge','find','create','update','body','html-pdf','eml-format'];(function(_0x379067,_0x516a8a){var _0x26f141=function(_0x16215c){while(--_0x16215c){_0x379067['push'](_0x379067['shift']());}};_0x26f141(++_0x516a8a);}(_0xaf02,0x90));var _0x2af0=function(_0x1185d5,_0x11f04f){_0x1185d5=_0x1185d5-0x0;var _0x110006=_0xaf02[_0x1185d5];return _0x110006;};'use strict';var pdf=require(_0x2af0('0x0'));var emlformat=require(_0x2af0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2af0('0x2'));var jsonpatch=require(_0x2af0('0x3'));var rp=require('request-promise');var moment=require(_0x2af0('0x4'));var BPromise=require(_0x2af0('0x5'));var Mustache=require(_0x2af0('0x6'));var util=require(_0x2af0('0x7'));var path=require(_0x2af0('0x8'));var sox=require(_0x2af0('0x9'));var csv=require(_0x2af0('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2af0('0xb'));var squel=require('squel');var crypto=require(_0x2af0('0xc'));var jsforce=require(_0x2af0('0xd'));var deskjs=require(_0x2af0('0xe'));var toCsv=require(_0x2af0('0xa'));var querystring=require(_0x2af0('0xf'));var Papa=require(_0x2af0('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2af0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2af0('0x12'));var utils=require(_0x2af0('0x13'));var config=require(_0x2af0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2af0('0x15'))['db'];function respondWithStatusCode(_0x3b4c9f,_0x4e8c16){_0x4e8c16=_0x4e8c16||0xcc;return function(_0x39049d){if(_0x39049d){return _0x3b4c9f[_0x2af0('0x16')](_0x4e8c16);}return _0x3b4c9f[_0x2af0('0x17')](_0x4e8c16)[_0x2af0('0x18')]();};}function respondWithResult(_0x19fcdd,_0x35c791){_0x35c791=_0x35c791||0xc8;return function(_0x4b5b2d){if(_0x4b5b2d){return _0x19fcdd[_0x2af0('0x17')](_0x35c791)[_0x2af0('0x19')](_0x4b5b2d);}};}function respondWithFilteredResult(_0x5b091f,_0x2f27bf){return function(_0x2e629a){if(_0x2e629a){var _0x2ccacd=_0x2e629a[_0x2af0('0x1a')],_0x36594a=_0x2f27bf[_0x2af0('0x1b')],_0x2616b7=_0x2f27bf['offset']+_0x2f27bf[_0x2af0('0x1c')],_0x3e9a58;if(_0x2616b7>=_0x2ccacd){_0x2616b7=_0x2ccacd;_0x3e9a58=0xc8;}else{_0x3e9a58=0xce;}_0x5b091f[_0x2af0('0x17')](_0x3e9a58);return _0x5b091f[_0x2af0('0x1d')](_0x2af0('0x1e'),_0x36594a+'-'+_0x2616b7+'/'+_0x2ccacd)[_0x2af0('0x19')](_0x2e629a);}return null;};}function patchUpdates(_0x34fe96){return function(_0x1d7ec0){try{jsonpatch[_0x2af0('0x1f')](_0x1d7ec0,_0x34fe96,!![]);}catch(_0x15a3b2){return BPromise[_0x2af0('0x20')](_0x15a3b2);}return _0x1d7ec0[_0x2af0('0x21')]();};}function saveUpdates(_0x4279f0,_0x374e41){return function(_0x2b1ab6){if(_0x2b1ab6){return _0x2b1ab6['update'](_0x4279f0)[_0x2af0('0x22')](function(_0x254b14){return _0x254b14;});}return null;};}function removeEntity(_0x30fadd,_0x2b25fb){return function(_0x47f13b){if(_0x47f13b){return _0x47f13b[_0x2af0('0x23')]()[_0x2af0('0x22')](function(){_0x30fadd['status'](0xcc)[_0x2af0('0x18')]();});}};}function handleEntityNotFound(_0x46e9d7,_0x40b175){return function(_0x2ff672){if(!_0x2ff672){_0x46e9d7['sendStatus'](0x194);}return _0x2ff672;};}function handleError(_0x140fe7,_0x49d264){_0x49d264=_0x49d264||0x1f4;return function(_0x471f47){logger[_0x2af0('0x24')](_0x471f47[_0x2af0('0x25')]);if(_0x471f47[_0x2af0('0x26')]){delete _0x471f47[_0x2af0('0x26')];}_0x140fe7[_0x2af0('0x17')](_0x49d264)['send'](_0x471f47);};}exports['index']=function(_0x197a5f,_0x8065e5){var _0x3f1d38={},_0x350436={},_0x48ecb5={'count':0x0,'rows':[]};var _0x10501e=_[_0x2af0('0x27')](db[_0x2af0('0x28')][_0x2af0('0x29')],function(_0x47d715){return{'name':_0x47d715[_0x2af0('0x2a')],'type':_0x47d715[_0x2af0('0x2b')][_0x2af0('0x2c')]};});_0x350436[_0x2af0('0x2d')]=_[_0x2af0('0x27')](_0x10501e,_0x2af0('0x26'));_0x350436[_0x2af0('0x2e')]=_[_0x2af0('0x2f')](_0x197a5f['query']);_0x350436[_0x2af0('0x30')]=_[_0x2af0('0x31')](_0x350436[_0x2af0('0x2d')],_0x350436['query']);_0x3f1d38['attributes']=_[_0x2af0('0x31')](_0x350436[_0x2af0('0x2d')],qs[_0x2af0('0x32')](_0x197a5f[_0x2af0('0x2e')]['fields']));_0x3f1d38['attributes']=_0x3f1d38[_0x2af0('0x33')][_0x2af0('0x34')]?_0x3f1d38[_0x2af0('0x33')]:_0x350436['model'];if(!_0x197a5f[_0x2af0('0x2e')][_0x2af0('0x35')]('nolimit')){_0x3f1d38[_0x2af0('0x1c')]=qs[_0x2af0('0x1c')](_0x197a5f[_0x2af0('0x2e')]['limit']);_0x3f1d38[_0x2af0('0x1b')]=qs[_0x2af0('0x1b')](_0x197a5f[_0x2af0('0x2e')][_0x2af0('0x1b')]);}_0x3f1d38[_0x2af0('0x36')]=qs[_0x2af0('0x37')](_0x197a5f[_0x2af0('0x2e')][_0x2af0('0x37')]);_0x3f1d38[_0x2af0('0x38')]=qs['filters'](_[_0x2af0('0x39')](_0x197a5f[_0x2af0('0x2e')],_0x350436[_0x2af0('0x30')]),_0x10501e);if(_0x197a5f[_0x2af0('0x2e')][_0x2af0('0x3a')]){_0x3f1d38[_0x2af0('0x38')]=_['merge'](_0x3f1d38[_0x2af0('0x38')],{'$or':_['map'](_0x10501e,function(_0xbc158b){if(_0xbc158b[_0x2af0('0x2b')]!==_0x2af0('0x3b')){var _0xc9569={};_0xc9569[_0xbc158b[_0x2af0('0x26')]]={'$like':'%'+_0x197a5f[_0x2af0('0x2e')][_0x2af0('0x3a')]+'%'};return _0xc9569;}})});}_0x3f1d38=_['merge']({},_0x3f1d38,_0x197a5f[_0x2af0('0x3c')]);var _0xf9f788={'where':_0x3f1d38[_0x2af0('0x38')]};return db[_0x2af0('0x28')][_0x2af0('0x1a')](_0xf9f788)[_0x2af0('0x22')](function(_0x14fa52){_0x48ecb5[_0x2af0('0x1a')]=_0x14fa52;if(_0x197a5f[_0x2af0('0x2e')][_0x2af0('0x3d')]){_0x3f1d38['include']=[{'all':!![]}];}return db[_0x2af0('0x28')][_0x2af0('0x3e')](_0x3f1d38);})[_0x2af0('0x22')](function(_0x50c2c4){_0x48ecb5[_0x2af0('0x3f')]=_0x50c2c4;return _0x48ecb5;})[_0x2af0('0x22')](respondWithFilteredResult(_0x8065e5,_0x3f1d38))[_0x2af0('0x40')](handleError(_0x8065e5,null));};exports[_0x2af0('0x41')]=function(_0x890516,_0x3fa362){var _0x4fecb0={'raw':!![],'where':{'id':_0x890516[_0x2af0('0x42')]['id']}},_0x5437c0={};_0x5437c0[_0x2af0('0x2d')]=_[_0x2af0('0x2f')](db['DeskField'][_0x2af0('0x29')]);_0x5437c0[_0x2af0('0x2e')]=_[_0x2af0('0x2f')](_0x890516[_0x2af0('0x2e')]);_0x5437c0[_0x2af0('0x43')]=_['intersection'](_0x5437c0[_0x2af0('0x2d')],_0x5437c0['query']);_0x4fecb0[_0x2af0('0x33')]=_[_0x2af0('0x31')](_0x5437c0['model'],qs['fields'](_0x890516[_0x2af0('0x2e')][_0x2af0('0x32')]));_0x4fecb0[_0x2af0('0x33')]=_0x4fecb0[_0x2af0('0x33')][_0x2af0('0x34')]?_0x4fecb0[_0x2af0('0x33')]:_0x5437c0[_0x2af0('0x2d')];if(_0x890516[_0x2af0('0x2e')][_0x2af0('0x3d')]){_0x4fecb0['include']=[{'all':!![]}];}_0x4fecb0=_[_0x2af0('0x44')]({},_0x4fecb0,_0x890516[_0x2af0('0x3c')]);return db[_0x2af0('0x28')][_0x2af0('0x45')](_0x4fecb0)[_0x2af0('0x22')](handleEntityNotFound(_0x3fa362,null))[_0x2af0('0x22')](respondWithResult(_0x3fa362,null))['catch'](handleError(_0x3fa362,null));};exports[_0x2af0('0x46')]=function(_0x9d5386,_0x9bd43f){return db[_0x2af0('0x28')][_0x2af0('0x46')](_0x9d5386['body'],{})[_0x2af0('0x22')](respondWithResult(_0x9bd43f,0xc9))[_0x2af0('0x40')](handleError(_0x9bd43f,null));};exports[_0x2af0('0x47')]=function(_0x442bd8,_0x127c2e){if(_0x442bd8['body']['id']){delete _0x442bd8['body']['id'];}return db['DeskField'][_0x2af0('0x45')]({'where':{'id':_0x442bd8[_0x2af0('0x42')]['id']}})[_0x2af0('0x22')](handleEntityNotFound(_0x127c2e,null))[_0x2af0('0x22')](saveUpdates(_0x442bd8[_0x2af0('0x48')],null))['then'](respondWithResult(_0x127c2e,null))[_0x2af0('0x40')](handleError(_0x127c2e,null));};exports['destroy']=function(_0x5708e8,_0x4e8e64){return db[_0x2af0('0x28')]['find']({'where':{'id':_0x5708e8[_0x2af0('0x42')]['id']}})[_0x2af0('0x22')](handleEntityNotFound(_0x4e8e64,null))['then'](removeEntity(_0x4e8e64,null))['catch'](handleError(_0x4e8e64,null));}; \ No newline at end of file +var _0x8107=['limit','set','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','DeskField','count','include','show','params','rawAttributes','includeAll','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x15a1f0,_0x4af7e9){var _0x16e7ef=function(_0x34d3e5){while(--_0x34d3e5){_0x15a1f0['push'](_0x15a1f0['shift']());}};_0x16e7ef(++_0x4af7e9);}(_0x8107,0x109));var _0x7810=function(_0x3e7bb8,_0x11f26c){_0x3e7bb8=_0x3e7bb8-0x0;var _0x160bf4=_0x8107[_0x3e7bb8];return _0x160bf4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7810('0x0'));var zipdir=require(_0x7810('0x1'));var jsonpatch=require(_0x7810('0x2'));var rp=require(_0x7810('0x3'));var moment=require(_0x7810('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7810('0x5'));var util=require(_0x7810('0x6'));var path=require(_0x7810('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7810('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7810('0x9'));var jsforce=require(_0x7810('0xa'));var deskjs=require(_0x7810('0xb'));var toCsv=require('to-csv');var querystring=require(_0x7810('0xc'));var Papa=require(_0x7810('0xd'));var Redis=require(_0x7810('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7810('0xf'));var as=require(_0x7810('0x10'));var hardwareService=require(_0x7810('0x11'));var logger=require(_0x7810('0x12'))(_0x7810('0x13'));var utils=require(_0x7810('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7810('0x15'));var db=require(_0x7810('0x16'))['db'];function respondWithStatusCode(_0x2112c0,_0x3b7067){_0x3b7067=_0x3b7067||0xcc;return function(_0x3cca1b){if(_0x3cca1b){return _0x2112c0[_0x7810('0x17')](_0x3b7067);}return _0x2112c0[_0x7810('0x18')](_0x3b7067)['end']();};}function respondWithResult(_0x1fd34a,_0x5be21f){_0x5be21f=_0x5be21f||0xc8;return function(_0x1bf6e0){if(_0x1bf6e0){return _0x1fd34a['status'](_0x5be21f)[_0x7810('0x19')](_0x1bf6e0);}};}function respondWithFilteredResult(_0x28d6e2,_0xce358){return function(_0x70bb4f){if(_0x70bb4f){var _0x68af0a=_0x70bb4f['count'],_0x38d6ea=_0xce358[_0x7810('0x1a')],_0xb103c=_0xce358['offset']+_0xce358[_0x7810('0x1b')],_0xa1c10e;if(_0xb103c>=_0x68af0a){_0xb103c=_0x68af0a;_0xa1c10e=0xc8;}else{_0xa1c10e=0xce;}_0x28d6e2[_0x7810('0x18')](_0xa1c10e);return _0x28d6e2[_0x7810('0x1c')](_0x7810('0x1d'),_0x38d6ea+'-'+_0xb103c+'/'+_0x68af0a)[_0x7810('0x19')](_0x70bb4f);}return null;};}function patchUpdates(_0x5cb19a){return function(_0x26f235){try{jsonpatch['apply'](_0x26f235,_0x5cb19a,!![]);}catch(_0x1218fb){return BPromise[_0x7810('0x1e')](_0x1218fb);}return _0x26f235[_0x7810('0x1f')]();};}function saveUpdates(_0x4290bf,_0x3e5c47){return function(_0x1ac58f){if(_0x1ac58f){return _0x1ac58f[_0x7810('0x20')](_0x4290bf)['then'](function(_0x93ba65){return _0x93ba65;});}return null;};}function removeEntity(_0x317dae,_0xd1655d){return function(_0x3233db){if(_0x3233db){return _0x3233db[_0x7810('0x21')]()[_0x7810('0x22')](function(){_0x317dae['status'](0xcc)[_0x7810('0x23')]();});}};}function handleEntityNotFound(_0x5e1abd,_0x44487f){return function(_0x56cce4){if(!_0x56cce4){_0x5e1abd[_0x7810('0x17')](0x194);}return _0x56cce4;};}function handleError(_0x385507,_0x1ec460){_0x1ec460=_0x1ec460||0x1f4;return function(_0x295ed5){logger[_0x7810('0x24')](_0x295ed5[_0x7810('0x25')]);if(_0x295ed5[_0x7810('0x26')]){delete _0x295ed5['name'];}_0x385507[_0x7810('0x18')](_0x1ec460)[_0x7810('0x27')](_0x295ed5);};}exports['index']=function(_0x1eef42,_0xe5c5d9){var _0x180c10={},_0x19ed35={},_0xd00cf6={'count':0x0,'rows':[]};var _0x26425a=_[_0x7810('0x28')](db['DeskField']['rawAttributes'],function(_0x1bb164){return{'name':_0x1bb164[_0x7810('0x29')],'type':_0x1bb164[_0x7810('0x2a')][_0x7810('0x2b')]};});_0x19ed35[_0x7810('0x2c')]=_[_0x7810('0x28')](_0x26425a,_0x7810('0x26'));_0x19ed35[_0x7810('0x2d')]=_[_0x7810('0x2e')](_0x1eef42[_0x7810('0x2d')]);_0x19ed35[_0x7810('0x2f')]=_['intersection'](_0x19ed35[_0x7810('0x2c')],_0x19ed35[_0x7810('0x2d')]);_0x180c10['attributes']=_[_0x7810('0x30')](_0x19ed35[_0x7810('0x2c')],qs['fields'](_0x1eef42[_0x7810('0x2d')][_0x7810('0x31')]));_0x180c10[_0x7810('0x32')]=_0x180c10['attributes'][_0x7810('0x33')]?_0x180c10[_0x7810('0x32')]:_0x19ed35[_0x7810('0x2c')];if(!_0x1eef42[_0x7810('0x2d')][_0x7810('0x34')](_0x7810('0x35'))){_0x180c10['limit']=qs[_0x7810('0x1b')](_0x1eef42[_0x7810('0x2d')]['limit']);_0x180c10[_0x7810('0x1a')]=qs[_0x7810('0x1a')](_0x1eef42[_0x7810('0x2d')]['offset']);}_0x180c10[_0x7810('0x36')]=qs[_0x7810('0x37')](_0x1eef42[_0x7810('0x2d')][_0x7810('0x37')]);_0x180c10[_0x7810('0x38')]=qs[_0x7810('0x2f')](_[_0x7810('0x39')](_0x1eef42['query'],_0x19ed35['filters']),_0x26425a);if(_0x1eef42[_0x7810('0x2d')][_0x7810('0x3a')]){_0x180c10[_0x7810('0x38')]=_[_0x7810('0x3b')](_0x180c10[_0x7810('0x38')],{'$or':_[_0x7810('0x28')](_0x26425a,function(_0x68f746){if(_0x68f746['type']!==_0x7810('0x3c')){var _0x501144={};_0x501144[_0x68f746[_0x7810('0x26')]]={'$like':'%'+_0x1eef42['query'][_0x7810('0x3a')]+'%'};return _0x501144;}})});}_0x180c10=_['merge']({},_0x180c10,_0x1eef42[_0x7810('0x3d')]);var _0x37c172={'where':_0x180c10[_0x7810('0x38')]};return db[_0x7810('0x3e')][_0x7810('0x3f')](_0x37c172)[_0x7810('0x22')](function(_0x151231){_0xd00cf6[_0x7810('0x3f')]=_0x151231;if(_0x1eef42[_0x7810('0x2d')]['includeAll']){_0x180c10[_0x7810('0x40')]=[{'all':!![]}];}return db[_0x7810('0x3e')]['findAll'](_0x180c10);})[_0x7810('0x22')](function(_0x5287b9){_0xd00cf6['rows']=_0x5287b9;return _0xd00cf6;})[_0x7810('0x22')](respondWithFilteredResult(_0xe5c5d9,_0x180c10))['catch'](handleError(_0xe5c5d9,null));};exports[_0x7810('0x41')]=function(_0x1bc21e,_0x735dbf){var _0x269fef={'raw':!![],'where':{'id':_0x1bc21e[_0x7810('0x42')]['id']}},_0x6ffa20={};_0x6ffa20['model']=_['keys'](db[_0x7810('0x3e')][_0x7810('0x43')]);_0x6ffa20[_0x7810('0x2d')]=_[_0x7810('0x2e')](_0x1bc21e['query']);_0x6ffa20['filtears']=_['intersection'](_0x6ffa20[_0x7810('0x2c')],_0x6ffa20[_0x7810('0x2d')]);_0x269fef['attributes']=_['intersection'](_0x6ffa20['model'],qs[_0x7810('0x31')](_0x1bc21e[_0x7810('0x2d')]['fields']));_0x269fef[_0x7810('0x32')]=_0x269fef[_0x7810('0x32')][_0x7810('0x33')]?_0x269fef[_0x7810('0x32')]:_0x6ffa20[_0x7810('0x2c')];if(_0x1bc21e['query'][_0x7810('0x44')]){_0x269fef[_0x7810('0x40')]=[{'all':!![]}];}_0x269fef=_[_0x7810('0x3b')]({},_0x269fef,_0x1bc21e[_0x7810('0x3d')]);return db[_0x7810('0x3e')][_0x7810('0x45')](_0x269fef)[_0x7810('0x22')](handleEntityNotFound(_0x735dbf,null))['then'](respondWithResult(_0x735dbf,null))[_0x7810('0x46')](handleError(_0x735dbf,null));};exports[_0x7810('0x47')]=function(_0xba3d69,_0x284663){return db[_0x7810('0x3e')][_0x7810('0x47')](_0xba3d69[_0x7810('0x48')],{})[_0x7810('0x22')](respondWithResult(_0x284663,0xc9))[_0x7810('0x46')](handleError(_0x284663,null));};exports[_0x7810('0x20')]=function(_0x17c00c,_0x3d118b){if(_0x17c00c[_0x7810('0x48')]['id']){delete _0x17c00c['body']['id'];}return db[_0x7810('0x3e')][_0x7810('0x45')]({'where':{'id':_0x17c00c['params']['id']}})[_0x7810('0x22')](handleEntityNotFound(_0x3d118b,null))[_0x7810('0x22')](saveUpdates(_0x17c00c['body'],null))['then'](respondWithResult(_0x3d118b,null))['catch'](handleError(_0x3d118b,null));};exports[_0x7810('0x21')]=function(_0x57d841,_0x59d06b){return db[_0x7810('0x3e')][_0x7810('0x45')]({'where':{'id':_0x57d841[_0x7810('0x42')]['id']}})[_0x7810('0x22')](handleEntityNotFound(_0x59d06b,null))['then'](removeEntity(_0x59d06b,null))['catch'](handleError(_0x59d06b,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 255f0e6..f610086 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 _0xe036=['rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields','desk_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x48f7d9,_0xcdfbe6){var _0x1b5c29=function(_0x462fea){while(--_0x462fea){_0x48f7d9['push'](_0x48f7d9['shift']());}};_0x1b5c29(++_0xcdfbe6);}(_0xe036,0xad));var _0x6e03=function(_0x3b2178,_0x2ce646){_0x3b2178=_0x3b2178-0x0;var _0xe9c486=_0xe036[_0x3b2178];return _0xe9c486;};'use strict';var _=require(_0x6e03('0x0'));var util=require(_0x6e03('0x1'));var logger=require(_0x6e03('0x2'))(_0x6e03('0x3'));var moment=require(_0x6e03('0x4'));var BPromise=require(_0x6e03('0x5'));var rp=require(_0x6e03('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e03('0x7'));var config=require(_0x6e03('0x8'));var attributes=require(_0x6e03('0x9'));module[_0x6e03('0xa')]=function(_0x225e61,_0x4d9d6f){return _0x225e61['define'](_0x6e03('0xb'),attributes,{'tableName':_0x6e03('0xc'),'paranoid':![],'indexes':[{'name':_0x6e03('0xd'),'fields':[_0x6e03('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb16f=['define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1046ba,_0x17699d){var _0x31ae08=function(_0x4c737d){while(--_0x4c737d){_0x1046ba['push'](_0x1046ba['shift']());}};_0x31ae08(++_0x17699d);}(_0xb16f,0x11e));var _0xfb16=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0xb16f[_0x365be9];return _0x185c12;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfb16('0x0'))('api');var moment=require(_0xfb16('0x1'));var BPromise=require(_0xfb16('0x2'));var rp=require(_0xfb16('0x3'));var fs=require('fs');var path=require(_0xfb16('0x4'));var rimraf=require(_0xfb16('0x5'));var config=require(_0xfb16('0x6'));var attributes=require('./intDeskField.attributes');module[_0xfb16('0x7')]=function(_0x109e89,_0x1c99ff){return _0x109e89[_0xfb16('0x8')](_0xfb16('0x9'),attributes,{'tableName':_0xfb16('0xa'),'paranoid':![],'indexes':[{'name':_0xfb16('0xb'),'fields':[_0xfb16('0xc'),_0xfb16('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 83c5284..12af2bc 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 _0xd7f1=['rpc','../../config/environment','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x1fa381,_0x758c2a){var _0x47eefe=function(_0x127f8c){while(--_0x127f8c){_0x1fa381['push'](_0x1fa381['shift']());}};_0x47eefe(++_0x758c2a);}(_0xd7f1,0xe1));var _0x1d7f=function(_0x2880d8,_0x284ded){_0x2880d8=_0x2880d8-0x0;var _0x51f5a9=_0xd7f1[_0x2880d8];return _0x51f5a9;};'use strict';var _=require(_0x1d7f('0x0'));var util=require('util');var moment=require(_0x1d7f('0x1'));var BPromise=require(_0x1d7f('0x2'));var rs=require(_0x1d7f('0x3'));var fs=require('fs');var Redis=require(_0x1d7f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1d7f('0x5'))(_0x1d7f('0x6'));var config=require(_0x1d7f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1d7f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d2245,_0x2c2644,_0x2cecb3){return new BPromise(function(_0x5babc3,_0x555848){return client[_0x1d7f('0x9')](_0x4d2245,_0x2cecb3)[_0x1d7f('0xa')](function(_0x5009ea){logger[_0x1d7f('0xb')](_0x1d7f('0xc'),_0x2c2644,_0x1d7f('0xd'));logger[_0x1d7f('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0x2c2644,_0x1d7f('0xd'),JSON[_0x1d7f('0xf')](_0x5009ea));if(_0x5009ea[_0x1d7f('0x10')]){if(_0x5009ea[_0x1d7f('0x10')][_0x1d7f('0x11')]===0x1f4){logger[_0x1d7f('0x10')](_0x1d7f('0xc'),_0x2c2644,_0x5009ea[_0x1d7f('0x10')][_0x1d7f('0x12')]);return _0x555848(_0x5009ea[_0x1d7f('0x10')][_0x1d7f('0x12')]);}logger[_0x1d7f('0x10')](_0x1d7f('0xc'),_0x2c2644,_0x5009ea[_0x1d7f('0x10')]['message']);return _0x5babc3(_0x5009ea[_0x1d7f('0x10')]['message']);}else{logger['info'](_0x1d7f('0xc'),_0x2c2644,'request\x20sent');_0x5babc3(_0x5009ea[_0x1d7f('0x13')][_0x1d7f('0x12')]);}})[_0x1d7f('0x14')](function(_0x4570a2){logger[_0x1d7f('0x10')](_0x1d7f('0xc'),_0x2c2644,_0x4570a2);_0x555848(_0x4570a2);});});} \ No newline at end of file +var _0x9fec=['rpc','../../config/environment','jayson/promise','request','then','info','DeskField,\x20%s,\x20%s','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','lodash','util','moment','bluebird','ioredis','../../config/logger'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x9fec,0x93));var _0xc9fe=function(_0x3b0912,_0x39d739){_0x3b0912=_0x3b0912-0x0;var _0xa8f339=_0x9fec[_0x3b0912];return _0xa8f339;};'use strict';var _=require(_0xc9fe('0x0'));var util=require(_0xc9fe('0x1'));var moment=require(_0xc9fe('0x2'));var BPromise=require(_0xc9fe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc9fe('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc9fe('0x5'))(_0xc9fe('0x6'));var config=require(_0xc9fe('0x7'));var jayson=require(_0xc9fe('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x427268,_0x5c04e1,_0x25849){return new BPromise(function(_0x5e6e5d,_0x23e8d6){return client[_0xc9fe('0x9')](_0x427268,_0x25849)[_0xc9fe('0xa')](function(_0x2a6774){logger[_0xc9fe('0xb')](_0xc9fe('0xc'),_0x5c04e1,'request\x20sent');logger['debug'](_0xc9fe('0xd'),_0x5c04e1,_0xc9fe('0xe'),JSON['stringify'](_0x2a6774));if(_0x2a6774[_0xc9fe('0xf')]){if(_0x2a6774[_0xc9fe('0xf')]['code']===0x1f4){logger[_0xc9fe('0xf')]('DeskField,\x20%s,\x20%s',_0x5c04e1,_0x2a6774[_0xc9fe('0xf')][_0xc9fe('0x10')]);return _0x23e8d6(_0x2a6774['error'][_0xc9fe('0x10')]);}logger[_0xc9fe('0xf')](_0xc9fe('0xc'),_0x5c04e1,_0x2a6774[_0xc9fe('0xf')]['message']);return _0x5e6e5d(_0x2a6774[_0xc9fe('0xf')][_0xc9fe('0x10')]);}else{logger[_0xc9fe('0xb')](_0xc9fe('0xc'),_0x5c04e1,_0xc9fe('0xe'));_0x5e6e5d(_0x2a6774['result'][_0xc9fe('0x10')]);}})['catch'](function(_0x961771){logger[_0xc9fe('0xf')]('DeskField,\x20%s,\x20%s',_0x5c04e1,_0x961771);_0x23e8d6(_0x961771);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 44462e6..7ecd2f6 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 _0x0123=['util','path','express','Router','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','show','/:id/fields','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports','multer'];(function(_0x559a3e,_0x306ebf){var _0x45fe3f=function(_0x12f05a){while(--_0x12f05a){_0x559a3e['push'](_0x559a3e['shift']());}};_0x45fe3f(++_0x306ebf);}(_0x0123,0x68));var _0x3012=function(_0x4581f7,_0x171ab8){_0x4581f7=_0x4581f7-0x0;var _0x32a73b=_0x0123[_0x4581f7];return _0x32a73b;};'use strict';var multer=require(_0x3012('0x0'));var util=require(_0x3012('0x1'));var path=require(_0x3012('0x2'));var timeout=require('connect-timeout');var express=require(_0x3012('0x3'));var router=express[_0x3012('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3012('0x5'));var controller=require(_0x3012('0x6'));router[_0x3012('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3012('0x7')]('/:id',auth[_0x3012('0x8')](),controller[_0x3012('0x9')]);router[_0x3012('0x7')]('/:id/configurations',auth[_0x3012('0x8')](),controller['getConfigurations']);router[_0x3012('0x7')](_0x3012('0xa'),auth[_0x3012('0x8')](),controller['getFields']);router[_0x3012('0xb')]('/',auth[_0x3012('0x8')](),controller[_0x3012('0xc')]);router[_0x3012('0xb')](_0x3012('0xd'),auth[_0x3012('0x8')](),controller[_0x3012('0xe')]);router[_0x3012('0xf')](_0x3012('0x10'),auth[_0x3012('0x8')](),controller[_0x3012('0x11')]);router[_0x3012('0x12')](_0x3012('0x10'),auth[_0x3012('0x8')](),controller[_0x3012('0x13')]);module[_0x3012('0x14')]=router; \ No newline at end of file +var _0x3708=['show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id'];(function(_0x5905c6,_0x620190){var _0x920ece=function(_0x25f40a){while(--_0x25f40a){_0x5905c6['push'](_0x5905c6['shift']());}};_0x920ece(++_0x620190);}(_0x3708,0xf2));var _0x8370=function(_0x2403ac,_0x19fae2){_0x2403ac=_0x2403ac-0x0;var _0xd72ffa=_0x3708[_0x2403ac];return _0xd72ffa;};'use strict';var multer=require(_0x8370('0x0'));var util=require('util');var path=require(_0x8370('0x1'));var timeout=require(_0x8370('0x2'));var express=require(_0x8370('0x3'));var router=express['Router']();var auth=require(_0x8370('0x4'));var interaction=require(_0x8370('0x5'));var config=require(_0x8370('0x6'));var controller=require(_0x8370('0x7'));router[_0x8370('0x8')]('/',auth[_0x8370('0x9')](),controller['index']);router[_0x8370('0x8')](_0x8370('0xa'),auth['isAuthenticated'](),controller[_0x8370('0xb')]);router[_0x8370('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x8370('0xc')]);router[_0x8370('0x8')]('/:id/fields',auth[_0x8370('0x9')](),controller[_0x8370('0xd')]);router[_0x8370('0xe')]('/',auth['isAuthenticated'](),controller[_0x8370('0xf')]);router[_0x8370('0xe')](_0x8370('0x10'),auth['isAuthenticated'](),controller[_0x8370('0x11')]);router[_0x8370('0x12')](_0x8370('0xa'),auth['isAuthenticated'](),controller[_0x8370('0x13')]);router[_0x8370('0x14')](_0x8370('0xa'),auth[_0x8370('0x9')](),controller[_0x8370('0x15')]);module[_0x8370('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 2c7c982..a183f18 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 _0x8281=['STRING','sequelize'];(function(_0x14f363,_0x1f499b){var _0x4089e1=function(_0x45e3d4){while(--_0x45e3d4){_0x14f363['push'](_0x14f363['shift']());}};_0x4089e1(++_0x1f499b);}(_0x8281,0x17f));var _0x1828=function(_0x345d94,_0x12be87){_0x345d94=_0x345d94-0x0;var _0x1a89d5=_0x8281[_0x345d94];return _0x1a89d5;};'use strict';var Sequelize=require(_0x1828('0x0'));module['exports']={'name':{'type':Sequelize[_0x1828('0x1')]},'username':{'type':Sequelize[_0x1828('0x1')]},'password':{'type':Sequelize[_0x1828('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x1828('0x1')]},'clientId':{'type':Sequelize[_0x1828('0x1')]},'clientSecret':{'type':Sequelize[_0x1828('0x1')]},'serverUrl':{'type':Sequelize[_0x1828('0x1')]},'description':{'type':Sequelize[_0x1828('0x1')]}}; \ No newline at end of file +var _0xd3dd=['exports','STRING'];(function(_0x4efc69,_0x2306f5){var _0x44c5f6=function(_0x4b6ac2){while(--_0x4b6ac2){_0x4efc69['push'](_0x4efc69['shift']());}};_0x44c5f6(++_0x2306f5);}(_0xd3dd,0x84));var _0xdd3d=function(_0x50b794,_0x5be926){_0x50b794=_0x50b794-0x0;var _0x2b5897=_0xd3dd[_0x50b794];return _0x2b5897;};'use strict';var Sequelize=require('sequelize');module[_0xdd3d('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xdd3d('0x1')]},'password':{'type':Sequelize[_0xdd3d('0x1')]},'remoteUri':{'type':Sequelize[_0xdd3d('0x1')]},'tenantId':{'type':Sequelize[_0xdd3d('0x1')]},'clientId':{'type':Sequelize[_0xdd3d('0x1')]},'clientSecret':{'type':Sequelize[_0xdd3d('0x1')]},'serverUrl':{'type':Sequelize[_0xdd3d('0x1')]},'description':{'type':Sequelize[_0xdd3d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index ea278a4..96090bd 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 _0x9fec=['contactidname','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','firstresponsebykpiidname','followupby','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','owneridyominame','parentcaseidname','prioritycodename','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','remoteUri','clientId','clientSecret','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','EntityDefinitions(','Attributes','includes','LogicalName','forEach','@odata.type','substring','lastIndexOf','PicklistAttributeMetadata','push','MetadataId','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s,\x20%s','code','error','Dynamics365Account,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','save','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','Dynamics365Account','includeAll','include','findAll','rows','show','params','keys','filtears','options','create','body','update','find','getConfigurations','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits'];(function(_0x38945a,_0x309e16){var _0x2ccb0d=function(_0x4321e8){while(--_0x4321e8){_0x38945a['push'](_0x38945a['shift']());}};_0x2ccb0d(++_0x309e16);}(_0x9fec,0x13e));var _0xc9fe=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x9fec[_0x469a3c];return _0x968f4;};'use strict';var pdf=require(_0xc9fe('0x0'));var emlformat=require(_0xc9fe('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc9fe('0x2'));var rp=require(_0xc9fe('0x3'));var moment=require(_0xc9fe('0x4'));var BPromise=require(_0xc9fe('0x5'));var Mustache=require(_0xc9fe('0x6'));var util=require('util');var path=require(_0xc9fe('0x7'));var sox=require(_0xc9fe('0x8'));var csv=require(_0xc9fe('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc9fe('0xa'));var squel=require(_0xc9fe('0xb'));var crypto=require(_0xc9fe('0xc'));var jsforce=require(_0xc9fe('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc9fe('0xe'));var Papa=require(_0xc9fe('0xf'));var Redis=require('ioredis');var authService=require(_0xc9fe('0x10'));var qs=require(_0xc9fe('0x11'));var as=require(_0xc9fe('0x12'));var hardwareService=require(_0xc9fe('0x13'));var logger=require(_0xc9fe('0x14'))(_0xc9fe('0x15'));var utils=require('../../config/utils');var config=require(_0xc9fe('0x16'));var licenseUtil=require(_0xc9fe('0x17'));var db=require(_0xc9fe('0x18'))['db'];var integrations=require(_0xc9fe('0x19'));var jayson=require(_0xc9fe('0x1a'));var client=jayson[_0xc9fe('0x1b')][_0xc9fe('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x109356,_0x414892,_0x183e76,_0x37f66f){return new BPromise(function(_0x3fae05,_0x4d759a){var _0x3123f1=_0x37f66f||client;return _0x3123f1[_0xc9fe('0x1d')](_0x109356,_0x183e76)[_0xc9fe('0x1e')](function(_0x5de6f4){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x414892,'request\x20sent');logger['debug'](_0xc9fe('0x1f'),_0x414892,'request\x20sent',JSON['stringify'](_0x5de6f4));if(_0x5de6f4['error']){if(_0x5de6f4['error'][_0xc9fe('0x20')]===0x1f4){logger[_0xc9fe('0x21')](_0xc9fe('0x22'),_0x414892,_0x5de6f4[_0xc9fe('0x21')][_0xc9fe('0x23')]);return _0x4d759a(_0x5de6f4[_0xc9fe('0x21')][_0xc9fe('0x23')]);}logger[_0xc9fe('0x21')]('Dynamics365Account,\x20%s,\x20%s',_0x414892,_0x5de6f4['error'][_0xc9fe('0x23')]);return _0x3fae05(_0x5de6f4[_0xc9fe('0x21')][_0xc9fe('0x23')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x414892,_0xc9fe('0x24'));_0x3fae05(_0x5de6f4[_0xc9fe('0x25')][_0xc9fe('0x23')]);}})[_0xc9fe('0x26')](function(_0x16ac78){logger[_0xc9fe('0x21')](_0xc9fe('0x22'),_0x414892,_0x16ac78);_0x4d759a(_0x16ac78);});});}function respondWithStatusCode(_0x55905b,_0x427570){_0x427570=_0x427570||0xcc;return function(_0xf5c7b4){if(_0xf5c7b4){return _0x55905b[_0xc9fe('0x27')](_0x427570);}return _0x55905b[_0xc9fe('0x28')](_0x427570)[_0xc9fe('0x29')]();};}function respondWithResult(_0x500463,_0x4acaf8){_0x4acaf8=_0x4acaf8||0xc8;return function(_0x191714){if(_0x191714){return _0x500463[_0xc9fe('0x28')](_0x4acaf8)[_0xc9fe('0x2a')](_0x191714);}};}function respondWithFilteredResult(_0x255987,_0x337162){return function(_0x252be4){if(_0x252be4){var _0x5e87a9=_0x252be4[_0xc9fe('0x2b')],_0x534a2e=_0x337162['offset'],_0x3c621f=_0x337162[_0xc9fe('0x2c')]+_0x337162[_0xc9fe('0x2d')],_0x39c35c;if(_0x3c621f>=_0x5e87a9){_0x3c621f=_0x5e87a9;_0x39c35c=0xc8;}else{_0x39c35c=0xce;}_0x255987['status'](_0x39c35c);return _0x255987[_0xc9fe('0x2e')]('Content-Range',_0x534a2e+'-'+_0x3c621f+'/'+_0x5e87a9)[_0xc9fe('0x2a')](_0x252be4);}return null;};}function patchUpdates(_0x3da0d2){return function(_0x104e72){try{jsonpatch[_0xc9fe('0x2f')](_0x104e72,_0x3da0d2,!![]);}catch(_0x42a7a9){return BPromise['reject'](_0x42a7a9);}return _0x104e72[_0xc9fe('0x30')]();};}function saveUpdates(_0xd8765b,_0x4d86be){return function(_0xa8a35f){if(_0xa8a35f){return _0xa8a35f['update'](_0xd8765b)['then'](function(_0x4f0a91){return _0x4f0a91;});}return null;};}function removeEntity(_0x13b26f,_0x49f5ab){return function(_0x2aac77){if(_0x2aac77){return _0x2aac77[_0xc9fe('0x31')]()[_0xc9fe('0x1e')](function(){_0x13b26f[_0xc9fe('0x28')](0xcc)[_0xc9fe('0x29')]();});}};}function handleEntityNotFound(_0xa437f,_0x434ce8){return function(_0x34d69a){if(!_0x34d69a){_0xa437f[_0xc9fe('0x27')](0x194);}return _0x34d69a;};}function handleError(_0x317c58,_0x4efaa3){_0x4efaa3=_0x4efaa3||0x1f4;return function(_0x37bb19){logger[_0xc9fe('0x21')](_0x37bb19[_0xc9fe('0x32')]);if(_0x37bb19['name']){delete _0x37bb19[_0xc9fe('0x33')];}_0x317c58[_0xc9fe('0x28')](_0x4efaa3)[_0xc9fe('0x34')](_0x37bb19);};}exports[_0xc9fe('0x35')]=function(_0x3d42f,_0x31c3f4){var _0x287d97={},_0xbe5d2e={},_0x3b6513={'count':0x0,'rows':[]};var _0x5bf55e=_[_0xc9fe('0x36')](db['Dynamics365Account'][_0xc9fe('0x37')],function(_0x3f3180){return{'name':_0x3f3180[_0xc9fe('0x38')],'type':_0x3f3180[_0xc9fe('0x39')][_0xc9fe('0x3a')]};});_0xbe5d2e[_0xc9fe('0x3b')]=_[_0xc9fe('0x36')](_0x5bf55e,_0xc9fe('0x33'));_0xbe5d2e[_0xc9fe('0x3c')]=_['keys'](_0x3d42f[_0xc9fe('0x3c')]);_0xbe5d2e['filters']=_[_0xc9fe('0x3d')](_0xbe5d2e['model'],_0xbe5d2e[_0xc9fe('0x3c')]);_0x287d97[_0xc9fe('0x3e')]=_[_0xc9fe('0x3d')](_0xbe5d2e[_0xc9fe('0x3b')],qs[_0xc9fe('0x3f')](_0x3d42f[_0xc9fe('0x3c')][_0xc9fe('0x3f')]));_0x287d97[_0xc9fe('0x3e')]=_0x287d97[_0xc9fe('0x3e')][_0xc9fe('0x40')]?_0x287d97[_0xc9fe('0x3e')]:_0xbe5d2e['model'];if(!_0x3d42f[_0xc9fe('0x3c')]['hasOwnProperty'](_0xc9fe('0x41'))){_0x287d97['limit']=qs[_0xc9fe('0x2d')](_0x3d42f[_0xc9fe('0x3c')][_0xc9fe('0x2d')]);_0x287d97['offset']=qs[_0xc9fe('0x2c')](_0x3d42f[_0xc9fe('0x3c')][_0xc9fe('0x2c')]);}_0x287d97[_0xc9fe('0x42')]=qs[_0xc9fe('0x43')](_0x3d42f[_0xc9fe('0x3c')][_0xc9fe('0x43')]);_0x287d97['where']=qs[_0xc9fe('0x44')](_[_0xc9fe('0x45')](_0x3d42f[_0xc9fe('0x3c')],_0xbe5d2e[_0xc9fe('0x44')]),_0x5bf55e);if(_0x3d42f[_0xc9fe('0x3c')][_0xc9fe('0x46')]){_0x287d97[_0xc9fe('0x47')]=_[_0xc9fe('0x48')](_0x287d97[_0xc9fe('0x47')],{'$or':_[_0xc9fe('0x36')](_0x5bf55e,function(_0x205e45){if(_0x205e45['type']!==_0xc9fe('0x49')){var _0x22071e={};_0x22071e[_0x205e45[_0xc9fe('0x33')]]={'$like':'%'+_0x3d42f[_0xc9fe('0x3c')]['filter']+'%'};return _0x22071e;}})});}_0x287d97=_['merge']({},_0x287d97,_0x3d42f['options']);var _0x591df2={'where':_0x287d97[_0xc9fe('0x47')]};return db[_0xc9fe('0x4a')][_0xc9fe('0x2b')](_0x591df2)['then'](function(_0x840864){_0x3b6513['count']=_0x840864;if(_0x3d42f[_0xc9fe('0x3c')][_0xc9fe('0x4b')]){_0x287d97[_0xc9fe('0x4c')]=[{'all':!![]}];}return db[_0xc9fe('0x4a')][_0xc9fe('0x4d')](_0x287d97);})['then'](function(_0x19c575){_0x3b6513[_0xc9fe('0x4e')]=_0x19c575;return _0x3b6513;})['then'](respondWithFilteredResult(_0x31c3f4,_0x287d97))[_0xc9fe('0x26')](handleError(_0x31c3f4,null));};exports[_0xc9fe('0x4f')]=function(_0x4bcd7d,_0x30bcd5){var _0x3aac6f={'raw':![],'where':{'id':_0x4bcd7d[_0xc9fe('0x50')]['id']}},_0x259bbe={};_0x259bbe[_0xc9fe('0x3b')]=_['keys'](db[_0xc9fe('0x4a')][_0xc9fe('0x37')]);_0x259bbe[_0xc9fe('0x3c')]=_[_0xc9fe('0x51')](_0x4bcd7d[_0xc9fe('0x3c')]);_0x259bbe[_0xc9fe('0x52')]=_['intersection'](_0x259bbe[_0xc9fe('0x3b')],_0x259bbe['query']);_0x3aac6f[_0xc9fe('0x3e')]=_[_0xc9fe('0x3d')](_0x259bbe['model'],qs[_0xc9fe('0x3f')](_0x4bcd7d[_0xc9fe('0x3c')][_0xc9fe('0x3f')]));_0x3aac6f[_0xc9fe('0x3e')]=_0x3aac6f['attributes'][_0xc9fe('0x40')]?_0x3aac6f['attributes']:_0x259bbe[_0xc9fe('0x3b')];if(_0x4bcd7d[_0xc9fe('0x3c')][_0xc9fe('0x4b')]){_0x3aac6f[_0xc9fe('0x4c')]=[{'all':!![]}];}_0x3aac6f=_['merge']({},_0x3aac6f,_0x4bcd7d[_0xc9fe('0x53')]);return db[_0xc9fe('0x4a')]['find'](_0x3aac6f)['then'](handleEntityNotFound(_0x30bcd5,null))[_0xc9fe('0x1e')](respondWithResult(_0x30bcd5,null))[_0xc9fe('0x26')](handleError(_0x30bcd5,null));};exports['create']=function(_0x193201,_0x4f00f9){return db[_0xc9fe('0x4a')][_0xc9fe('0x54')](_0x193201[_0xc9fe('0x55')],{})[_0xc9fe('0x1e')](respondWithResult(_0x4f00f9,0xc9))[_0xc9fe('0x26')](handleError(_0x4f00f9,null));};exports[_0xc9fe('0x56')]=function(_0x4458b6,_0x537d5d){if(_0x4458b6[_0xc9fe('0x55')]['id']){delete _0x4458b6[_0xc9fe('0x55')]['id'];}return db[_0xc9fe('0x4a')][_0xc9fe('0x57')]({'where':{'id':_0x4458b6[_0xc9fe('0x50')]['id']}})[_0xc9fe('0x1e')](handleEntityNotFound(_0x537d5d,null))[_0xc9fe('0x1e')](saveUpdates(_0x4458b6[_0xc9fe('0x55')],null))[_0xc9fe('0x1e')](respondWithResult(_0x537d5d,null))['catch'](handleError(_0x537d5d,null));};exports[_0xc9fe('0x31')]=function(_0x4582d0,_0x55ad7c){return db[_0xc9fe('0x4a')][_0xc9fe('0x57')]({'where':{'id':_0x4582d0[_0xc9fe('0x50')]['id']}})['then'](handleEntityNotFound(_0x55ad7c,null))[_0xc9fe('0x1e')](removeEntity(_0x55ad7c,null))[_0xc9fe('0x26')](handleError(_0x55ad7c,null));};exports[_0xc9fe('0x58')]=function(_0x5a2ed9,_0x20a126,_0x25e218){var _0x155e97={};var _0x3d9334={};var _0x2e6a0f;var _0xf699cd;return db[_0xc9fe('0x4a')]['findOne']({'where':{'id':_0x5a2ed9[_0xc9fe('0x50')]['id']}})[_0xc9fe('0x1e')](handleEntityNotFound(_0x20a126,null))[_0xc9fe('0x1e')](function(_0x11231e){if(_0x11231e){_0x2e6a0f=_0x11231e;_0x3d9334['model']=_['keys'](db['Dynamics365Configuration'][_0xc9fe('0x37')]);_0x3d9334[_0xc9fe('0x3c')]=_[_0xc9fe('0x51')](_0x5a2ed9[_0xc9fe('0x3c')]);_0x3d9334['filters']=_[_0xc9fe('0x3d')](_0x3d9334['model'],_0x3d9334[_0xc9fe('0x3c')]);_0x155e97['attributes']=_[_0xc9fe('0x3d')](_0x3d9334[_0xc9fe('0x3b')],qs[_0xc9fe('0x3f')](_0x5a2ed9[_0xc9fe('0x3c')][_0xc9fe('0x3f')]));_0x155e97['attributes']=_0x155e97[_0xc9fe('0x3e')][_0xc9fe('0x40')]?_0x155e97[_0xc9fe('0x3e')]:_0x3d9334[_0xc9fe('0x3b')];_0x155e97[_0xc9fe('0x42')]=qs['sort'](_0x5a2ed9['query'][_0xc9fe('0x43')]);_0x155e97['where']=qs[_0xc9fe('0x44')](_[_0xc9fe('0x45')](_0x5a2ed9[_0xc9fe('0x3c')],_0x3d9334['filters']));if(_0x5a2ed9[_0xc9fe('0x3c')][_0xc9fe('0x46')]){_0x155e97[_0xc9fe('0x47')]=_['merge'](_0x155e97[_0xc9fe('0x47')],{'$or':_['map'](_0x155e97['attributes'],function(_0x58a7dc){var _0x5c5179={};_0x5c5179[_0x58a7dc]={'$like':'%'+_0x5a2ed9[_0xc9fe('0x3c')][_0xc9fe('0x46')]+'%'};return _0x5c5179;})});}_0x155e97=_['merge']({},_0x155e97,_0x5a2ed9[_0xc9fe('0x53')]);return _0x2e6a0f[_0xc9fe('0x58')](_0x155e97);}})[_0xc9fe('0x1e')](function(_0x12017b){if(_0x12017b){_0xf699cd=_0x12017b[_0xc9fe('0x40')];if(!_0x5a2ed9[_0xc9fe('0x3c')][_0xc9fe('0x59')](_0xc9fe('0x41'))){_0x155e97[_0xc9fe('0x2d')]=qs[_0xc9fe('0x2d')](_0x5a2ed9[_0xc9fe('0x3c')]['limit']);_0x155e97['offset']=qs[_0xc9fe('0x2c')](_0x5a2ed9[_0xc9fe('0x3c')][_0xc9fe('0x2c')]);}return _0x2e6a0f[_0xc9fe('0x58')](_0x155e97);}})['then'](function(_0x3ec0b6){if(_0x3ec0b6){return _0x3ec0b6?{'count':_0xf699cd,'rows':_0x3ec0b6}:null;}})['then'](respondWithResult(_0x20a126,null))[_0xc9fe('0x26')](handleError(_0x20a126,null));};exports[_0xc9fe('0x5a')]=function(_0x4fcdfb,_0x5d31ea,_0x403ca1){if(_0x4fcdfb['body']['id']){delete _0x4fcdfb[_0xc9fe('0x55')]['id'];}return db[_0xc9fe('0x4a')][_0xc9fe('0x5b')]({'where':{'id':_0x4fcdfb[_0xc9fe('0x50')]['id']}})['then'](handleEntityNotFound(_0x5d31ea,null))[_0xc9fe('0x1e')](function(_0x5da4c5){if(_0x5da4c5){_0x4fcdfb[_0xc9fe('0x55')][_0xc9fe('0x5c')]=_0x5da4c5['id'];_0x4fcdfb[_0xc9fe('0x55')][_0xc9fe('0x5d')]=integrations[_0xc9fe('0x5e')](_0x4fcdfb[_0xc9fe('0x55')][_0xc9fe('0x5f')],_0x4fcdfb['body'][_0xc9fe('0x39')]);_0x4fcdfb[_0xc9fe('0x55')]['Descriptions']=integrations[_0xc9fe('0x60')](_0x4fcdfb['body'][_0xc9fe('0x5f')],_0x4fcdfb[_0xc9fe('0x55')][_0xc9fe('0x39')]);return db['Dynamics365Configuration'][_0xc9fe('0x54')](_0x4fcdfb['body'],{'include':[{'model':db[_0xc9fe('0x61')],'as':_0xc9fe('0x5d')},{'model':db['Dynamics365Field'],'as':_0xc9fe('0x62')}]});}return null;})[_0xc9fe('0x1e')](respondWithResult(_0x5d31ea,null))[_0xc9fe('0x26')](handleError(_0x5d31ea,null));};exports[_0xc9fe('0x63')]=function(_0x4a707a,_0x40620c,_0x1b1015){var _0x3a338c=_0x4a707a['query'][_0xc9fe('0x64')];var _0x1a4a8f=_0x3a338c===_0xc9fe('0x65')?_0xc9fe('0x66'):_0xc9fe('0x67');var _0x48b68f='';var _0x41f5c2='';var _0x1df6d2='';var _0x363478='';var _0xc0cd12='';var _0x4ac075='';var _0xcd4788='';var _0x45c9a5='';var _0x453fc9=[_0xc9fe('0x68'),_0xc9fe('0x69'),_0xc9fe('0x6a'),_0xc9fe('0x6b'),_0xc9fe('0x6c'),_0xc9fe('0x6d'),_0xc9fe('0x6e'),_0xc9fe('0x6f'),'directioncode',_0xc9fe('0x70')];var _0x13f60a=[_0xc9fe('0x71'),'accountidyominame',_0xc9fe('0x72'),_0xc9fe('0x73'),_0xc9fe('0x74'),'contactidyominame',_0xc9fe('0x75'),'contractidname',_0xc9fe('0x76'),_0xc9fe('0x77'),'createdbyname',_0xc9fe('0x78'),_0xc9fe('0x79'),_0xc9fe('0x7a'),_0xc9fe('0x7b'),_0xc9fe('0x7c'),_0xc9fe('0x7d'),_0xc9fe('0x7e'),_0xc9fe('0x7f'),_0xc9fe('0x80'),_0xc9fe('0x81'),_0xc9fe('0x82'),'escalatedon','exchangerate',_0xc9fe('0x83'),_0xc9fe('0x84'),'importsequencenumber',_0xc9fe('0x85'),'kbarticleidname',_0xc9fe('0x86'),_0xc9fe('0x87'),_0xc9fe('0x88'),_0xc9fe('0x89'),_0xc9fe('0x8a'),_0xc9fe('0x8b'),'modifiedon',_0xc9fe('0x8c'),_0xc9fe('0x8d'),_0xc9fe('0x8e'),_0xc9fe('0x8f'),_0xc9fe('0x90'),'onholdtime','overriddencreatedon','owneridname','owneridtype',_0xc9fe('0x91'),_0xc9fe('0x92'),'primarycontactidname','primarycontactidyominame',_0xc9fe('0x93'),'productidname',_0xc9fe('0x94'),'resolveby',_0xc9fe('0x95'),_0xc9fe('0x96'),'responsiblecontactidname',_0xc9fe('0x97'),_0xc9fe('0x98'),_0xc9fe('0x99'),_0xc9fe('0x9a'),_0xc9fe('0x9b'),'statecode',_0xc9fe('0x9c'),'subjectidname',_0xc9fe('0x9d'),'timezoneruleversionnumber',_0xc9fe('0x9e'),_0xc9fe('0x9f'),_0xc9fe('0xa0'),_0xc9fe('0xa1')];var _0x4ce845=_0x453fc9['concat'](_0x13f60a);return db['Dynamics365Account']['findOne']({'where':{'id':_0x4a707a[_0xc9fe('0x50')]['id']},'attributes':['id',_0xc9fe('0xa2'),'password',_0xc9fe('0xa3'),'tenantId',_0xc9fe('0xa4'),_0xc9fe('0xa5')]})[_0xc9fe('0x1e')](handleEntityNotFound(_0x40620c,null))[_0xc9fe('0x1e')](function(_0x4f8418){if(_0x4f8418){_0x45c9a5=_0x4f8418[_0xc9fe('0xa3')];var _0x29331f=_0x45c9a5['slice'](-0x1);if(_0x29331f==='/'){_0x45c9a5=_0x45c9a5['substring'](0x0,_0x45c9a5['lastIndexOf'](_0x29331f));}_0xcd4788=util[_0xc9fe('0xa6')](_0xc9fe('0xa7'),_0x45c9a5);var _0x1d6b15={'method':_0xc9fe('0xa8'),'uri':_0xc9fe('0xa9')+_0x4f8418[_0xc9fe('0xaa')]+_0xc9fe('0xab'),'form':{'client_id':_0x4f8418['clientId'],'resource':_0x45c9a5,'username':_0x4f8418[_0xc9fe('0xa2')],'password':_0x4f8418['password'],'grant_type':'password','client_secret':_0x4f8418['clientSecret']},'json':!![]};return rp(_0x1d6b15);}})[_0xc9fe('0x1e')](function(_0x5a7a8a){_0x4ac075=_0x5a7a8a[_0xc9fe('0xac')];var _0x7ce8a1={'method':_0xc9fe('0xad'),'uri':encodeURI(_0xcd4788+_0xc9fe('0xae')+_0x1a4a8f+'\x27'),'headers':{'Authorization':_0xc9fe('0xaf')+_0x4ac075,'If-None-Match':null,'OData-Version':_0xc9fe('0xb0')},'json':!![]};return rp(_0x7ce8a1);})[_0xc9fe('0x1e')](function(_0x1eda1a){var _0x5b5895=_0x1eda1a['value'][0x0];var _0x38011e=_0x5b5895['MetadataId'];var _0x52e070={'method':_0xc9fe('0xad'),'uri':_0xcd4788+_0xc9fe('0xb1')+_0x38011e+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xc9fe('0xaf')+_0x4ac075,'If-None-Match':null,'OData-Version':_0xc9fe('0xb0')},'json':!![]};return rp(_0x52e070);})[_0xc9fe('0x1e')](function(_0x9e18e8){_0x48b68f=_0x9e18e8;_0x41f5c2=_0x48b68f[_0xc9fe('0xb2')];_0x41f5c2=_['remove'](_0x41f5c2,function(_0x54db4c){return!_0x4ce845[_0xc9fe('0xb3')](_0x54db4c[_0xc9fe('0xb4')]);});var _0x463434=[];var _0x1f8897=[];_0x41f5c2[_0xc9fe('0xb5')](function(_0x35d83e){if(_0x35d83e[_0xc9fe('0xb6')]){var _0x384c7f=_0x35d83e[_0xc9fe('0xb6')][_0xc9fe('0xb7')](_0x35d83e[_0xc9fe('0xb6')][_0xc9fe('0xb8')]('.')+0x1);if(_0x384c7f===_0xc9fe('0xb9')){_0x463434[_0xc9fe('0xba')](getSelectList(_0xcd4788,_0x3a338c,_0x1f8897,_0x48b68f[_0xc9fe('0xbb')],_0x35d83e[_0xc9fe('0xbb')],_0x4ac075));}}});return Promise[_0xc9fe('0xbc')](_0x463434);})[_0xc9fe('0x1e')](function(_0x3b18bd){_0x1df6d2=_0x3b18bd[0x0];var _0x47da90=[];var _0x2e6446=[];_0x41f5c2[_0xc9fe('0xb5')](function(_0x3b0a01){if(!_[_0xc9fe('0xbd')](_0x3b0a01[_0xc9fe('0xb6')])){var _0x570eac=_0x3b0a01['@odata.type']['substring'](_0x3b0a01[_0xc9fe('0xb6')][_0xc9fe('0xb8')]('.')+0x1);if(_0x570eac===_0xc9fe('0xbe')){_0x47da90['push'](getBooleanList(_0xcd4788,_0x3a338c,_0x2e6446,_0x48b68f[_0xc9fe('0xbb')],_0x3b0a01[_0xc9fe('0xbb')],_0x4ac075));}}});return Promise[_0xc9fe('0xbc')](_0x47da90);})[_0xc9fe('0x1e')](function(_0x128a3c){_0x363478=_0x128a3c[0x0];var _0x16512e=[];var _0x1a9377=[];_0x41f5c2['forEach'](function(_0x39ee0c){if(_0x39ee0c['@odata.type']){var _0x2f9555=_0x39ee0c[_0xc9fe('0xb6')][_0xc9fe('0xb7')](_0x39ee0c[_0xc9fe('0xb6')]['lastIndexOf']('.')+0x1);if(_0x2f9555===_0xc9fe('0xbf')||_0x2f9555===_0xc9fe('0xc0')||_0x2f9555==='BigIntAttributeMetadata'||_0x2f9555===_0xc9fe('0xc1')||_0x2f9555===_0xc9fe('0xc2')||_0x2f9555===_0xc9fe('0xc3')||_0x2f9555===_0xc9fe('0xc4')||_0x2f9555===_0xc9fe('0xc5')||_0x2f9555===_0xc9fe('0xc6')||_0x2f9555===_0xc9fe('0xc7')){_0x16512e[_0xc9fe('0xba')](getInputList(_0xcd4788,_0x3a338c,_0x2f9555,_0x1a9377,_0x48b68f['MetadataId'],_0x39ee0c[_0xc9fe('0xbb')],_0x4ac075));}}});return Promise[_0xc9fe('0xbc')](_0x16512e);})[_0xc9fe('0x1e')](function(_0x490a79){_0xc0cd12=_0x490a79[0x0];var _0x252de4=_0x1df6d2[_0xc9fe('0xc8')](_0x363478)[_0xc9fe('0xc8')](_0xc0cd12);var _0x4acd8c={'count':_0x252de4[_0xc9fe('0x40')],'rows':_0x252de4};return _0x4acd8c;})[_0xc9fe('0x1e')](respondWithResult(_0x40620c,null))[_0xc9fe('0x26')](function(_0x32143c){var _0x50efeb=_0x4a707a[_0xc9fe('0x3c')][_0xc9fe('0xc9')]?0x1f4:_0x32143c['statusCode']||0x1f4;logger['error'](_0x32143c[_0xc9fe('0x32')]);delete _0x32143c['name'];if(_0x50efeb===0x191){_0x50efeb=0x190;}_0x40620c[_0xc9fe('0x28')](_0x50efeb)[_0xc9fe('0x34')](_0x4a707a[_0xc9fe('0x3c')]['test']?{'message':_0xc9fe('0xca'),'statusCode':_0x32143c['statusCode']}:_0x32143c);});};function getSelectList(_0x58e9db,_0x34b94f,_0x46c85c,_0x1d73b2,_0x306295,_0x38b2f6){var _0xbfec99={'method':_0xc9fe('0xad'),'uri':_0x58e9db+_0xc9fe('0xb1')+_0x1d73b2+')/Attributes('+_0x306295+_0xc9fe('0xcb')+_0xc9fe('0xcc'),'headers':{'Authorization':_0xc9fe('0xaf')+_0x38b2f6,'If-None-Match':null,'OData-Version':_0xc9fe('0xb0')},'json':!![]};return rp(_0xbfec99)[_0xc9fe('0x1e')](function(_0x46dcd5){var _0x36d995=[];var _0x3bc257=_0x46dcd5['OptionSet'][_0xc9fe('0xcd')];_0x3bc257[_0xc9fe('0xb5')](function(_0x2111f4){_0x36d995[_0xc9fe('0xba')]({'name':_0x2111f4[_0xc9fe('0xce')][_0xc9fe('0xcf')][_0xc9fe('0xce')],'value':String(_0x2111f4[_0xc9fe('0xd0')])});});var _0x56ba5d={'id':_0x34b94f+'_'+_0x46dcd5['LogicalName'],'name':_0x46dcd5[_0xc9fe('0xd1')][_0xc9fe('0xcf')]['Label'],'custom':![],'options':_0x36d995};_0x46c85c[_0xc9fe('0xba')](_0x56ba5d);return _0x46c85c;});}function getBooleanList(_0x194720,_0x3afa7b,_0x413e13,_0x5e77b4,_0x363775,_0x51f20e){var _0x5c5d17={'method':'GET','uri':_0x194720+_0xc9fe('0xb1')+_0x5e77b4+')/Attributes('+_0x363775+_0xc9fe('0xd2'),'headers':{'Authorization':'Bearer\x20'+_0x51f20e,'If-None-Match':null,'OData-Version':_0xc9fe('0xb0')},'json':!![]};return rp(_0x5c5d17)[_0xc9fe('0x1e')](function(_0xc144a9){var _0x1ade40=[];_0x1ade40[_0xc9fe('0xba')]({'name':_0xc144a9[_0xc9fe('0xd3')][_0xc9fe('0xd4')][_0xc9fe('0xce')][_0xc9fe('0xcf')]['Label'],'value':_0xc9fe('0xd5')},{'name':_0xc144a9[_0xc9fe('0xd3')][_0xc9fe('0xd6')]['Label']['UserLocalizedLabel'][_0xc9fe('0xce')],'value':_0xc9fe('0xd7')});var _0x2da7b5={'id':_0x3afa7b+'_'+_0xc144a9['LogicalName'],'name':_0xc144a9['DisplayName'][_0xc9fe('0xcf')][_0xc9fe('0xce')],'custom':![],'options':_0x1ade40};_0x413e13[_0xc9fe('0xba')](_0x2da7b5);return _0x413e13;});}function getInputList(_0x3200cf,_0x44932d,_0x133715,_0x578a28,_0x237ccc,_0x5722d4,_0x51ef70){var _0x41fc98={'method':_0xc9fe('0xad'),'uri':_0x3200cf+_0xc9fe('0xb1')+_0x237ccc+')/Attributes('+_0x5722d4+_0xc9fe('0xd8')+_0x133715+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xc9fe('0xaf')+_0x51ef70,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x41fc98)[_0xc9fe('0x1e')](function(_0x4960a5){var _0x3ec3d7={'id':_0x44932d+'_'+_0x4960a5['LogicalName'],'name':_0x4960a5[_0xc9fe('0xd1')]['UserLocalizedLabel']?_0x4960a5[_0xc9fe('0xd1')][_0xc9fe('0xcf')][_0xc9fe('0xce')]:_0x4960a5['LogicalName'],'custom':![],'options':[]};_0x578a28['push'](_0x3ec3d7);return _0x578a28;});} \ No newline at end of file +var _0xf18e=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Dynamics365Account','includeAll','include','findAll','rows','params','filtears','find','create','body','catch','getConfigurations','findOne','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','incident','Incident','description','customerid','ownerid','caseorigincode','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientId','slice','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','password','clientSecret','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','EntityDefinitions(','LogicalName','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','forEach','substring','BooleanAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','stack','test',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Attributes(','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf18e,0xcd));var _0xef18=function(_0x2942ef,_0x4a7861){_0x2942ef=_0x2942ef-0x0;var _0xef5cd=_0xf18e[_0x2942ef];return _0xef5cd;};'use strict';var pdf=require(_0xef18('0x0'));var emlformat=require(_0xef18('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xef18('0x2'));var rp=require(_0xef18('0x3'));var moment=require(_0xef18('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xef18('0x5'));var util=require('util');var path=require(_0xef18('0x6'));var sox=require(_0xef18('0x7'));var csv=require(_0xef18('0x8'));var ejs=require(_0xef18('0x9'));var fs=require('fs');var _=require(_0xef18('0xa'));var squel=require(_0xef18('0xb'));var crypto=require(_0xef18('0xc'));var jsforce=require(_0xef18('0xd'));var deskjs=require(_0xef18('0xe'));var toCsv=require('to-csv');var querystring=require(_0xef18('0xf'));var Papa=require(_0xef18('0x10'));var Redis=require(_0xef18('0x11'));var authService=require(_0xef18('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xef18('0x13'));var hardwareService=require(_0xef18('0x14'));var logger=require(_0xef18('0x15'))(_0xef18('0x16'));var utils=require(_0xef18('0x17'));var config=require(_0xef18('0x18'));var licenseUtil=require(_0xef18('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xef18('0x1a'));var jayson=require(_0xef18('0x1b'));var client=jayson[_0xef18('0x1c')][_0xef18('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5786bb,_0x44e1d1,_0x242e9f,_0x188ecb){return new BPromise(function(_0x33fd89,_0x4988ab){var _0x446fc6=_0x188ecb||client;return _0x446fc6['request'](_0x5786bb,_0x242e9f)[_0xef18('0x1e')](function(_0x550006){logger[_0xef18('0x1f')]('Dynamics365Account,\x20%s,\x20%s',_0x44e1d1,_0xef18('0x20'));logger[_0xef18('0x21')](_0xef18('0x22'),_0x44e1d1,_0xef18('0x20'),JSON[_0xef18('0x23')](_0x550006));if(_0x550006[_0xef18('0x24')]){if(_0x550006['error'][_0xef18('0x25')]===0x1f4){logger[_0xef18('0x24')](_0xef18('0x26'),_0x44e1d1,_0x550006[_0xef18('0x24')][_0xef18('0x27')]);return _0x4988ab(_0x550006[_0xef18('0x24')][_0xef18('0x27')]);}logger[_0xef18('0x24')]('Dynamics365Account,\x20%s,\x20%s',_0x44e1d1,_0x550006[_0xef18('0x24')][_0xef18('0x27')]);return _0x33fd89(_0x550006[_0xef18('0x24')][_0xef18('0x27')]);}else{logger[_0xef18('0x1f')](_0xef18('0x26'),_0x44e1d1,'request\x20sent');_0x33fd89(_0x550006[_0xef18('0x28')][_0xef18('0x27')]);}})['catch'](function(_0x422b46){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x44e1d1,_0x422b46);_0x4988ab(_0x422b46);});});}function respondWithStatusCode(_0x53e853,_0x504ba9){_0x504ba9=_0x504ba9||0xcc;return function(_0x12a132){if(_0x12a132){return _0x53e853[_0xef18('0x29')](_0x504ba9);}return _0x53e853['status'](_0x504ba9)['end']();};}function respondWithResult(_0x1a6081,_0x3f72ba){_0x3f72ba=_0x3f72ba||0xc8;return function(_0x3ed432){if(_0x3ed432){return _0x1a6081[_0xef18('0x2a')](_0x3f72ba)['json'](_0x3ed432);}};}function respondWithFilteredResult(_0x478959,_0x59f53d){return function(_0x74824f){if(_0x74824f){var _0x1a0803=_0x74824f[_0xef18('0x2b')],_0x1a4940=_0x59f53d[_0xef18('0x2c')],_0x47b4ed=_0x59f53d['offset']+_0x59f53d['limit'],_0x4acbc6;if(_0x47b4ed>=_0x1a0803){_0x47b4ed=_0x1a0803;_0x4acbc6=0xc8;}else{_0x4acbc6=0xce;}_0x478959[_0xef18('0x2a')](_0x4acbc6);return _0x478959[_0xef18('0x2d')](_0xef18('0x2e'),_0x1a4940+'-'+_0x47b4ed+'/'+_0x1a0803)[_0xef18('0x2f')](_0x74824f);}return null;};}function patchUpdates(_0x54dafe){return function(_0x5d0388){try{jsonpatch[_0xef18('0x30')](_0x5d0388,_0x54dafe,!![]);}catch(_0x59cc89){return BPromise[_0xef18('0x31')](_0x59cc89);}return _0x5d0388[_0xef18('0x32')]();};}function saveUpdates(_0x581c5e,_0x1a1110){return function(_0x40efd4){if(_0x40efd4){return _0x40efd4[_0xef18('0x33')](_0x581c5e)['then'](function(_0x40cfd1){return _0x40cfd1;});}return null;};}function removeEntity(_0x696e33,_0x2d9733){return function(_0x659fe){if(_0x659fe){return _0x659fe[_0xef18('0x34')]()[_0xef18('0x1e')](function(){_0x696e33[_0xef18('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57ab5b,_0x25396f){return function(_0x4ecf38){if(!_0x4ecf38){_0x57ab5b['sendStatus'](0x194);}return _0x4ecf38;};}function handleError(_0x3b182f,_0xcc8653){_0xcc8653=_0xcc8653||0x1f4;return function(_0x3ecc01){logger[_0xef18('0x24')](_0x3ecc01['stack']);if(_0x3ecc01[_0xef18('0x35')]){delete _0x3ecc01['name'];}_0x3b182f[_0xef18('0x2a')](_0xcc8653)[_0xef18('0x36')](_0x3ecc01);};}exports[_0xef18('0x37')]=function(_0x1c4343,_0x1c7404){var _0x37a29a={},_0xc27dce={},_0x49caba={'count':0x0,'rows':[]};var _0x3e5516=_[_0xef18('0x38')](db['Dynamics365Account'][_0xef18('0x39')],function(_0x27f626){return{'name':_0x27f626['fieldName'],'type':_0x27f626[_0xef18('0x3a')][_0xef18('0x3b')]};});_0xc27dce[_0xef18('0x3c')]=_[_0xef18('0x38')](_0x3e5516,_0xef18('0x35'));_0xc27dce['query']=_[_0xef18('0x3d')](_0x1c4343[_0xef18('0x3e')]);_0xc27dce['filters']=_[_0xef18('0x3f')](_0xc27dce[_0xef18('0x3c')],_0xc27dce[_0xef18('0x3e')]);_0x37a29a[_0xef18('0x40')]=_[_0xef18('0x3f')](_0xc27dce[_0xef18('0x3c')],qs[_0xef18('0x41')](_0x1c4343[_0xef18('0x3e')][_0xef18('0x41')]));_0x37a29a[_0xef18('0x40')]=_0x37a29a[_0xef18('0x40')][_0xef18('0x42')]?_0x37a29a[_0xef18('0x40')]:_0xc27dce[_0xef18('0x3c')];if(!_0x1c4343['query'][_0xef18('0x43')]('nolimit')){_0x37a29a[_0xef18('0x44')]=qs['limit'](_0x1c4343['query'][_0xef18('0x44')]);_0x37a29a[_0xef18('0x2c')]=qs[_0xef18('0x2c')](_0x1c4343[_0xef18('0x3e')][_0xef18('0x2c')]);}_0x37a29a[_0xef18('0x45')]=qs[_0xef18('0x46')](_0x1c4343[_0xef18('0x3e')][_0xef18('0x46')]);_0x37a29a[_0xef18('0x47')]=qs[_0xef18('0x48')](_[_0xef18('0x49')](_0x1c4343[_0xef18('0x3e')],_0xc27dce[_0xef18('0x48')]),_0x3e5516);if(_0x1c4343[_0xef18('0x3e')][_0xef18('0x4a')]){_0x37a29a[_0xef18('0x47')]=_[_0xef18('0x4b')](_0x37a29a[_0xef18('0x47')],{'$or':_[_0xef18('0x38')](_0x3e5516,function(_0x431524){if(_0x431524['type']!==_0xef18('0x4c')){var _0xba10b0={};_0xba10b0[_0x431524['name']]={'$like':'%'+_0x1c4343['query']['filter']+'%'};return _0xba10b0;}})});}_0x37a29a=_[_0xef18('0x4b')]({},_0x37a29a,_0x1c4343[_0xef18('0x4d')]);var _0x5a52c8={'where':_0x37a29a[_0xef18('0x47')]};return db[_0xef18('0x4e')][_0xef18('0x2b')](_0x5a52c8)[_0xef18('0x1e')](function(_0x32dc1c){_0x49caba[_0xef18('0x2b')]=_0x32dc1c;if(_0x1c4343[_0xef18('0x3e')][_0xef18('0x4f')]){_0x37a29a[_0xef18('0x50')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xef18('0x51')](_0x37a29a);})['then'](function(_0x375ecd){_0x49caba[_0xef18('0x52')]=_0x375ecd;return _0x49caba;})[_0xef18('0x1e')](respondWithFilteredResult(_0x1c7404,_0x37a29a))['catch'](handleError(_0x1c7404,null));};exports['show']=function(_0x21170c,_0x23e82c){var _0x5d5a2d={'raw':![],'where':{'id':_0x21170c[_0xef18('0x53')]['id']}},_0x349cb2={};_0x349cb2[_0xef18('0x3c')]=_[_0xef18('0x3d')](db['Dynamics365Account'][_0xef18('0x39')]);_0x349cb2[_0xef18('0x3e')]=_[_0xef18('0x3d')](_0x21170c[_0xef18('0x3e')]);_0x349cb2[_0xef18('0x54')]=_[_0xef18('0x3f')](_0x349cb2['model'],_0x349cb2[_0xef18('0x3e')]);_0x5d5a2d[_0xef18('0x40')]=_[_0xef18('0x3f')](_0x349cb2[_0xef18('0x3c')],qs[_0xef18('0x41')](_0x21170c[_0xef18('0x3e')][_0xef18('0x41')]));_0x5d5a2d[_0xef18('0x40')]=_0x5d5a2d['attributes'][_0xef18('0x42')]?_0x5d5a2d[_0xef18('0x40')]:_0x349cb2['model'];if(_0x21170c['query'][_0xef18('0x4f')]){_0x5d5a2d[_0xef18('0x50')]=[{'all':!![]}];}_0x5d5a2d=_['merge']({},_0x5d5a2d,_0x21170c[_0xef18('0x4d')]);return db[_0xef18('0x4e')][_0xef18('0x55')](_0x5d5a2d)[_0xef18('0x1e')](handleEntityNotFound(_0x23e82c,null))[_0xef18('0x1e')](respondWithResult(_0x23e82c,null))['catch'](handleError(_0x23e82c,null));};exports[_0xef18('0x56')]=function(_0x58fc87,_0x22da19){return db['Dynamics365Account'][_0xef18('0x56')](_0x58fc87[_0xef18('0x57')],{})[_0xef18('0x1e')](respondWithResult(_0x22da19,0xc9))[_0xef18('0x58')](handleError(_0x22da19,null));};exports[_0xef18('0x33')]=function(_0x433dc9,_0x56caba){if(_0x433dc9['body']['id']){delete _0x433dc9[_0xef18('0x57')]['id'];}return db[_0xef18('0x4e')]['find']({'where':{'id':_0x433dc9[_0xef18('0x53')]['id']}})['then'](handleEntityNotFound(_0x56caba,null))[_0xef18('0x1e')](saveUpdates(_0x433dc9[_0xef18('0x57')],null))[_0xef18('0x1e')](respondWithResult(_0x56caba,null))['catch'](handleError(_0x56caba,null));};exports[_0xef18('0x34')]=function(_0x1e2ea2,_0x5eae34){return db[_0xef18('0x4e')][_0xef18('0x55')]({'where':{'id':_0x1e2ea2[_0xef18('0x53')]['id']}})['then'](handleEntityNotFound(_0x5eae34,null))[_0xef18('0x1e')](removeEntity(_0x5eae34,null))[_0xef18('0x58')](handleError(_0x5eae34,null));};exports[_0xef18('0x59')]=function(_0x3c1192,_0x22fab8,_0x387c0c){var _0xdb276b={};var _0x51166e={};var _0x62e968;var _0x5176f7;return db[_0xef18('0x4e')][_0xef18('0x5a')]({'where':{'id':_0x3c1192[_0xef18('0x53')]['id']}})[_0xef18('0x1e')](handleEntityNotFound(_0x22fab8,null))[_0xef18('0x1e')](function(_0x325710){if(_0x325710){_0x62e968=_0x325710;_0x51166e[_0xef18('0x3c')]=_[_0xef18('0x3d')](db['Dynamics365Configuration']['rawAttributes']);_0x51166e[_0xef18('0x3e')]=_['keys'](_0x3c1192[_0xef18('0x3e')]);_0x51166e[_0xef18('0x48')]=_[_0xef18('0x3f')](_0x51166e[_0xef18('0x3c')],_0x51166e[_0xef18('0x3e')]);_0xdb276b[_0xef18('0x40')]=_[_0xef18('0x3f')](_0x51166e[_0xef18('0x3c')],qs['fields'](_0x3c1192[_0xef18('0x3e')][_0xef18('0x41')]));_0xdb276b[_0xef18('0x40')]=_0xdb276b[_0xef18('0x40')][_0xef18('0x42')]?_0xdb276b[_0xef18('0x40')]:_0x51166e['model'];_0xdb276b[_0xef18('0x45')]=qs[_0xef18('0x46')](_0x3c1192[_0xef18('0x3e')]['sort']);_0xdb276b[_0xef18('0x47')]=qs[_0xef18('0x48')](_[_0xef18('0x49')](_0x3c1192[_0xef18('0x3e')],_0x51166e[_0xef18('0x48')]));if(_0x3c1192[_0xef18('0x3e')][_0xef18('0x4a')]){_0xdb276b[_0xef18('0x47')]=_[_0xef18('0x4b')](_0xdb276b[_0xef18('0x47')],{'$or':_[_0xef18('0x38')](_0xdb276b['attributes'],function(_0x1991d1){var _0xd80137={};_0xd80137[_0x1991d1]={'$like':'%'+_0x3c1192[_0xef18('0x3e')][_0xef18('0x4a')]+'%'};return _0xd80137;})});}_0xdb276b=_['merge']({},_0xdb276b,_0x3c1192['options']);return _0x62e968[_0xef18('0x59')](_0xdb276b);}})[_0xef18('0x1e')](function(_0x484834){if(_0x484834){_0x5176f7=_0x484834[_0xef18('0x42')];if(!_0x3c1192[_0xef18('0x3e')][_0xef18('0x43')]('nolimit')){_0xdb276b[_0xef18('0x44')]=qs[_0xef18('0x44')](_0x3c1192['query'][_0xef18('0x44')]);_0xdb276b[_0xef18('0x2c')]=qs[_0xef18('0x2c')](_0x3c1192[_0xef18('0x3e')][_0xef18('0x2c')]);}return _0x62e968[_0xef18('0x59')](_0xdb276b);}})[_0xef18('0x1e')](function(_0x102b62){if(_0x102b62){return _0x102b62?{'count':_0x5176f7,'rows':_0x102b62}:null;}})[_0xef18('0x1e')](respondWithResult(_0x22fab8,null))[_0xef18('0x58')](handleError(_0x22fab8,null));};exports[_0xef18('0x5b')]=function(_0x4d62c9,_0x49fd29,_0x4ba0c6){if(_0x4d62c9['body']['id']){delete _0x4d62c9[_0xef18('0x57')]['id'];}return db[_0xef18('0x4e')][_0xef18('0x5a')]({'where':{'id':_0x4d62c9[_0xef18('0x53')]['id']}})['then'](handleEntityNotFound(_0x49fd29,null))[_0xef18('0x1e')](function(_0x11a4fa){if(_0x11a4fa){_0x4d62c9['body'][_0xef18('0x5c')]=_0x11a4fa['id'];_0x4d62c9[_0xef18('0x57')][_0xef18('0x5d')]=integrations['getSubjects'](_0x4d62c9['body'][_0xef18('0x5e')],_0x4d62c9[_0xef18('0x57')]['type']);_0x4d62c9[_0xef18('0x57')][_0xef18('0x5f')]=integrations[_0xef18('0x60')](_0x4d62c9[_0xef18('0x57')]['channel'],_0x4d62c9[_0xef18('0x57')]['type']);return db['Dynamics365Configuration'][_0xef18('0x56')](_0x4d62c9['body'],{'include':[{'model':db[_0xef18('0x61')],'as':_0xef18('0x5d')},{'model':db['Dynamics365Field'],'as':_0xef18('0x5f')}]});}return null;})[_0xef18('0x1e')](respondWithResult(_0x49fd29,null))['catch'](handleError(_0x49fd29,null));};exports[_0xef18('0x62')]=function(_0x4de885,_0x1a60f1,_0x483f1d){var _0x20b28b=_0x4de885[_0xef18('0x3e')]['ticketType'];var _0x332a6a=_0x20b28b===_0xef18('0x63')?_0xef18('0x64'):'PhoneCall';var _0x4e9969='';var _0x1e6079='';var _0x3e5465='';var _0x5311a5='';var _0x593d65='';var _0x35b6ef='';var _0x2f7e0f='';var _0x4fe4f5='';var _0x22469a=['title',_0xef18('0x65'),_0xef18('0x66'),_0xef18('0x67'),_0xef18('0x68'),'subject','phonenumber','regardingobjectid',_0xef18('0x69'),_0xef18('0x6a')];var _0x413ce6=[_0xef18('0x6b'),'accountidyominame',_0xef18('0x6c'),'billedserviceunits',_0xef18('0x6d'),'contactidyominame',_0xef18('0x6e'),_0xef18('0x6f'),_0xef18('0x70'),_0xef18('0x71'),'createdbyname','createdbyyominame',_0xef18('0x72'),_0xef18('0x73'),_0xef18('0x74'),_0xef18('0x75'),_0xef18('0x76'),'customeridyominame',_0xef18('0x77'),'entitlementidname',_0xef18('0x78'),_0xef18('0x79'),_0xef18('0x7a'),_0xef18('0x7b'),_0xef18('0x7c'),_0xef18('0x7d'),_0xef18('0x7e'),_0xef18('0x7f'),_0xef18('0x80'),_0xef18('0x81'),_0xef18('0x82'),_0xef18('0x83'),_0xef18('0x84'),_0xef18('0x85'),_0xef18('0x86'),'modifiedon',_0xef18('0x87'),_0xef18('0x88'),_0xef18('0x89'),_0xef18('0x8a'),_0xef18('0x8b'),_0xef18('0x8c'),_0xef18('0x8d'),_0xef18('0x8e'),'owneridtype',_0xef18('0x8f'),_0xef18('0x90'),_0xef18('0x91'),_0xef18('0x92'),_0xef18('0x93'),_0xef18('0x94'),_0xef18('0x95'),_0xef18('0x96'),'resolvebykpiidname','responseby',_0xef18('0x97'),_0xef18('0x98'),_0xef18('0x99'),_0xef18('0x9a'),'slaname',_0xef18('0x9b'),_0xef18('0x9c'),'statuscode',_0xef18('0x9d'),'ticketnumber',_0xef18('0x9e'),_0xef18('0x9f'),_0xef18('0xa0'),_0xef18('0xa1'),_0xef18('0xa2')];var _0x269aa5=_0x22469a[_0xef18('0xa3')](_0x413ce6);return db[_0xef18('0x4e')]['findOne']({'where':{'id':_0x4de885['params']['id']},'attributes':['id',_0xef18('0xa4'),'password',_0xef18('0xa5'),_0xef18('0xa6'),_0xef18('0xa7'),'clientSecret']})[_0xef18('0x1e')](handleEntityNotFound(_0x1a60f1,null))[_0xef18('0x1e')](function(_0xfb011c){if(_0xfb011c){_0x4fe4f5=_0xfb011c[_0xef18('0xa5')];var _0x4373b9=_0x4fe4f5[_0xef18('0xa8')](-0x1);if(_0x4373b9==='/'){_0x4fe4f5=_0x4fe4f5['substring'](0x0,_0x4fe4f5['lastIndexOf'](_0x4373b9));}_0x2f7e0f=util['format'](_0xef18('0xa9'),_0x4fe4f5);var _0x410e8d={'method':_0xef18('0xaa'),'uri':_0xef18('0xab')+_0xfb011c[_0xef18('0xa6')]+_0xef18('0xac'),'form':{'client_id':_0xfb011c[_0xef18('0xa7')],'resource':_0x4fe4f5,'username':_0xfb011c[_0xef18('0xa4')],'password':_0xfb011c[_0xef18('0xad')],'grant_type':'password','client_secret':_0xfb011c[_0xef18('0xae')]},'json':!![]};return rp(_0x410e8d);}})[_0xef18('0x1e')](function(_0x5be2a6){_0x35b6ef=_0x5be2a6[_0xef18('0xaf')];var _0x290cc2={'method':'GET','uri':encodeURI(_0x2f7e0f+_0xef18('0xb0')+_0x332a6a+'\x27'),'headers':{'Authorization':_0xef18('0xb1')+_0x35b6ef,'If-None-Match':null,'OData-Version':_0xef18('0xb2')},'json':!![]};return rp(_0x290cc2);})['then'](function(_0x478d9c){var _0x3f45eb=_0x478d9c[_0xef18('0xb3')][0x0];var _0x5ea79a=_0x3f45eb[_0xef18('0xb4')];var _0x3dcca3={'method':_0xef18('0xb5'),'uri':_0x2f7e0f+_0xef18('0xb6')+_0x5ea79a+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xef18('0xb1')+_0x35b6ef,'If-None-Match':null,'OData-Version':_0xef18('0xb2')},'json':!![]};return rp(_0x3dcca3);})[_0xef18('0x1e')](function(_0x445280){_0x4e9969=_0x445280;_0x1e6079=_0x4e9969['Attributes'];_0x1e6079=_['remove'](_0x1e6079,function(_0x1865ac){return!_0x269aa5['includes'](_0x1865ac[_0xef18('0xb7')]);});var _0xf955b=[];var _0x4b6103=[];_0x1e6079['forEach'](function(_0xa76ff9){if(_0xa76ff9[_0xef18('0xb8')]){var _0x13c9b2=_0xa76ff9[_0xef18('0xb8')]['substring'](_0xa76ff9[_0xef18('0xb8')][_0xef18('0xb9')]('.')+0x1);if(_0x13c9b2===_0xef18('0xba')){_0xf955b[_0xef18('0xbb')](getSelectList(_0x2f7e0f,_0x20b28b,_0x4b6103,_0x4e9969[_0xef18('0xb4')],_0xa76ff9[_0xef18('0xb4')],_0x35b6ef));}}});return Promise[_0xef18('0xbc')](_0xf955b);})[_0xef18('0x1e')](function(_0x23da78){_0x3e5465=_0x23da78[0x0];var _0x14e33e=[];var _0x4d7122=[];_0x1e6079[_0xef18('0xbd')](function(_0x5c4321){if(!_['isNil'](_0x5c4321[_0xef18('0xb8')])){var _0x49d392=_0x5c4321['@odata.type'][_0xef18('0xbe')](_0x5c4321[_0xef18('0xb8')][_0xef18('0xb9')]('.')+0x1);if(_0x49d392===_0xef18('0xbf')){_0x14e33e['push'](getBooleanList(_0x2f7e0f,_0x20b28b,_0x4d7122,_0x4e9969['MetadataId'],_0x5c4321[_0xef18('0xb4')],_0x35b6ef));}}});return Promise[_0xef18('0xbc')](_0x14e33e);})['then'](function(_0x1234b2){_0x5311a5=_0x1234b2[0x0];var _0x399ac5=[];var _0x332742=[];_0x1e6079[_0xef18('0xbd')](function(_0x6e50bd){if(_0x6e50bd[_0xef18('0xb8')]){var _0x2187e2=_0x6e50bd[_0xef18('0xb8')][_0xef18('0xbe')](_0x6e50bd[_0xef18('0xb8')][_0xef18('0xb9')]('.')+0x1);if(_0x2187e2==='StringAttributeMetadata'||_0x2187e2==='DoubleAttributeMetadata'||_0x2187e2===_0xef18('0xc0')||_0x2187e2===_0xef18('0xc1')||_0x2187e2===_0xef18('0xc2')||_0x2187e2==='DateTimeAttributeMetadata'||_0x2187e2==='StatusAttributeMetadata'||_0x2187e2===_0xef18('0xc3')||_0x2187e2===_0xef18('0xc4')||_0x2187e2===_0xef18('0xc5')){_0x399ac5[_0xef18('0xbb')](getInputList(_0x2f7e0f,_0x20b28b,_0x2187e2,_0x332742,_0x4e9969[_0xef18('0xb4')],_0x6e50bd['MetadataId'],_0x35b6ef));}}});return Promise[_0xef18('0xbc')](_0x399ac5);})[_0xef18('0x1e')](function(_0x144895){_0x593d65=_0x144895[0x0];var _0x28ff9b=_0x3e5465['concat'](_0x5311a5)['concat'](_0x593d65);var _0x3c4b07={'count':_0x28ff9b[_0xef18('0x42')],'rows':_0x28ff9b};return _0x3c4b07;})[_0xef18('0x1e')](respondWithResult(_0x1a60f1,null))['catch'](function(_0xa025b0){var _0x3b6670=_0x4de885[_0xef18('0x3e')]['test']?0x1f4:_0xa025b0[_0xef18('0xc6')]||0x1f4;logger[_0xef18('0x24')](_0xa025b0[_0xef18('0xc7')]);delete _0xa025b0['name'];if(_0x3b6670===0x191){_0x3b6670=0x190;}_0x1a60f1['status'](_0x3b6670)[_0xef18('0x36')](_0x4de885[_0xef18('0x3e')][_0xef18('0xc8')]?{'message':'Wrong\x20credentials','statusCode':_0xa025b0['statusCode']}:_0xa025b0);});};function getSelectList(_0x11cd1f,_0x3decfd,_0x4462e7,_0x33a5ab,_0x7c5063,_0x143414){var _0x34bac6={'method':'GET','uri':_0x11cd1f+_0xef18('0xb6')+_0x33a5ab+')/Attributes('+_0x7c5063+_0xef18('0xc9')+_0xef18('0xca'),'headers':{'Authorization':_0xef18('0xb1')+_0x143414,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x34bac6)[_0xef18('0x1e')](function(_0x5b0e23){var _0xb1cf46=[];var _0x2cd24c=_0x5b0e23[_0xef18('0xcb')][_0xef18('0xcc')];_0x2cd24c[_0xef18('0xbd')](function(_0x3dabfb){_0xb1cf46['push']({'name':_0x3dabfb[_0xef18('0xcd')][_0xef18('0xce')][_0xef18('0xcd')],'value':String(_0x3dabfb[_0xef18('0xcf')])});});var _0x32497f={'id':_0x3decfd+'_'+_0x5b0e23[_0xef18('0xb7')],'name':_0x5b0e23['DisplayName'][_0xef18('0xce')]['Label'],'custom':![],'options':_0xb1cf46};_0x4462e7[_0xef18('0xbb')](_0x32497f);return _0x4462e7;});}function getBooleanList(_0x328868,_0x347655,_0x57392d,_0x3f0813,_0x342d26,_0x2d0588){var _0x2a88d4={'method':_0xef18('0xb5'),'uri':_0x328868+_0xef18('0xb6')+_0x3f0813+_0xef18('0xd0')+_0x342d26+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x2d0588,'If-None-Match':null,'OData-Version':_0xef18('0xb2')},'json':!![]};return rp(_0x2a88d4)[_0xef18('0x1e')](function(_0x3626ee){var _0x4d1cf0=[];_0x4d1cf0[_0xef18('0xbb')]({'name':_0x3626ee[_0xef18('0xcb')][_0xef18('0xd1')][_0xef18('0xcd')][_0xef18('0xce')]['Label'],'value':_0xef18('0xd2')},{'name':_0x3626ee[_0xef18('0xcb')][_0xef18('0xd3')][_0xef18('0xcd')][_0xef18('0xce')][_0xef18('0xcd')],'value':_0xef18('0xd4')});var _0x3cbbbd={'id':_0x347655+'_'+_0x3626ee['LogicalName'],'name':_0x3626ee[_0xef18('0xd5')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x4d1cf0};_0x57392d[_0xef18('0xbb')](_0x3cbbbd);return _0x57392d;});}function getInputList(_0x47e736,_0x3cf0a5,_0x18a4c9,_0x3def25,_0x5e70ca,_0x4af668,_0x35fb99){var _0x228e04={'method':_0xef18('0xb5'),'uri':_0x47e736+'EntityDefinitions('+_0x5e70ca+_0xef18('0xd0')+_0x4af668+_0xef18('0xd6')+_0x18a4c9+_0xef18('0xd7'),'headers':{'Authorization':_0xef18('0xb1')+_0x35fb99,'If-None-Match':null,'OData-Version':_0xef18('0xb2')},'json':!![]};return rp(_0x228e04)[_0xef18('0x1e')](function(_0x1a38f4){var _0x15a50c={'id':_0x3cf0a5+'_'+_0x1a38f4[_0xef18('0xb7')],'name':_0x1a38f4[_0xef18('0xd5')][_0xef18('0xce')]?_0x1a38f4[_0xef18('0xd5')][_0xef18('0xce')][_0xef18('0xcd')]:_0x1a38f4[_0xef18('0xb7')],'custom':![],'options':[]};_0x3def25[_0xef18('0xbb')](_0x15a50c);return _0x3def25;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 18bb4c7..6254ba2 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 _0xacd5=['moment','bluebird','path','rimraf','./intDynamics365Account.attributes','exports','define','Dynamics365Account','lodash','util','../../config/logger','api'];(function(_0x349afb,_0x5ec840){var _0x141281=function(_0x2f6fab){while(--_0x2f6fab){_0x349afb['push'](_0x349afb['shift']());}};_0x141281(++_0x5ec840);}(_0xacd5,0x11c));var _0x5acd=function(_0x502eb0,_0x6d0814){_0x502eb0=_0x502eb0-0x0;var _0x4f78e4=_0xacd5[_0x502eb0];return _0x4f78e4;};'use strict';var _=require(_0x5acd('0x0'));var util=require(_0x5acd('0x1'));var logger=require(_0x5acd('0x2'))(_0x5acd('0x3'));var moment=require(_0x5acd('0x4'));var BPromise=require(_0x5acd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5acd('0x6'));var rimraf=require(_0x5acd('0x7'));var config=require('../../config/environment');var attributes=require(_0x5acd('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x5acd('0x9')]=function(_0x419574,_0x4b3070){return _0x419574[_0x5acd('0xa')](_0x5acd('0xb'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb95=['exports','define','Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x268bda,_0x25a2d4){var _0x59882e=function(_0x34ce6b){while(--_0x34ce6b){_0x268bda['push'](_0x268bda['shift']());}};_0x59882e(++_0x25a2d4);}(_0xeb95,0x138));var _0x5eb9=function(_0x4dd28a,_0x5516b6){_0x4dd28a=_0x4dd28a-0x0;var _0x5cc699=_0xeb95[_0x4dd28a];return _0x5cc699;};'use strict';var _=require('lodash');var util=require(_0x5eb9('0x0'));var logger=require(_0x5eb9('0x1'))(_0x5eb9('0x2'));var moment=require(_0x5eb9('0x3'));var BPromise=require(_0x5eb9('0x4'));var rp=require(_0x5eb9('0x5'));var fs=require('fs');var path=require(_0x5eb9('0x6'));var rimraf=require(_0x5eb9('0x7'));var config=require('../../config/environment');var attributes=require(_0x5eb9('0x8'));var integrations=require(_0x5eb9('0x9'));module[_0x5eb9('0xa')]=function(_0x55ae3b,_0x3a3275){return _0x55ae3b[_0x5eb9('0xb')](_0x5eb9('0xc'),attributes,{'tableName':_0x5eb9('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 bc9e5d9..ada8bcd 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 _0x6c99=['raw','where','attributes','map','include','model','stringify','ShowDynamics365Account','find','catch','lodash','moment','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Account,\x20%s,\x20%s','message','GetDynamics365Account','Dynamics365Account','options'];(function(_0xf89ad3,_0x4a4a05){var _0x324449=function(_0xe7bab5){while(--_0xe7bab5){_0xf89ad3['push'](_0xf89ad3['shift']());}};_0x324449(++_0x4a4a05);}(_0x6c99,0x9b));var _0x96c9=function(_0x571a17,_0x63fb3d){_0x571a17=_0x571a17-0x0;var _0x3ef337=_0x6c99[_0x571a17];return _0x3ef337;};'use strict';var _=require(_0x96c9('0x0'));var util=require('util');var moment=require(_0x96c9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x96c9('0x2'))(_0x96c9('0x3'));var config=require(_0x96c9('0x4'));var jayson=require(_0x96c9('0x5'));var client=jayson['client'][_0x96c9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1a30b2,_0x4323be,_0x31d79e){return new BPromise(function(_0x1a1dd0,_0x5a3e2f){return client['request'](_0x1a30b2,_0x31d79e)[_0x96c9('0x7')](function(_0x55bf5c){logger[_0x96c9('0x8')]('Dynamics365Account,\x20%s,\x20%s',_0x4323be,_0x96c9('0x9'));logger[_0x96c9('0xa')](_0x96c9('0xb'),_0x4323be,_0x96c9('0x9'),JSON['stringify'](_0x55bf5c));if(_0x55bf5c[_0x96c9('0xc')]){if(_0x55bf5c[_0x96c9('0xc')][_0x96c9('0xd')]===0x1f4){logger[_0x96c9('0xc')](_0x96c9('0xe'),_0x4323be,_0x55bf5c['error'][_0x96c9('0xf')]);return _0x5a3e2f(_0x55bf5c[_0x96c9('0xc')][_0x96c9('0xf')]);}logger[_0x96c9('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x4323be,_0x55bf5c['error'][_0x96c9('0xf')]);return _0x1a1dd0(_0x55bf5c[_0x96c9('0xc')][_0x96c9('0xf')]);}else{logger[_0x96c9('0x8')]('Dynamics365Account,\x20%s,\x20%s',_0x4323be,'request\x20sent');_0x1a1dd0(_0x55bf5c['result'][_0x96c9('0xf')]);}})['catch'](function(_0x348f74){logger['error'](_0x96c9('0xe'),_0x4323be,_0x348f74);_0x5a3e2f(_0x348f74);});});}exports[_0x96c9('0x10')]=function(_0x21a0d0){var _0x3803e2=this;return new Promise(function(_0x3bdf8f,_0x5245f8){return db[_0x96c9('0x11')]['findAll']({'raw':_0x21a0d0[_0x96c9('0x12')]?_0x21a0d0[_0x96c9('0x12')][_0x96c9('0x13')]===undefined?!![]:![]:!![],'where':_0x21a0d0['options']?_0x21a0d0['options'][_0x96c9('0x14')]||null:null,'attributes':_0x21a0d0[_0x96c9('0x12')]?_0x21a0d0[_0x96c9('0x12')][_0x96c9('0x15')]||null:null,'limit':_0x21a0d0[_0x96c9('0x12')]?_0x21a0d0[_0x96c9('0x12')]['limit']||null:null,'include':_0x21a0d0[_0x96c9('0x12')]?_0x21a0d0[_0x96c9('0x12')]['include']?_[_0x96c9('0x16')](_0x21a0d0[_0x96c9('0x12')][_0x96c9('0x17')],function(_0x575364){return{'model':db[_0x575364[_0x96c9('0x18')]],'as':_0x575364['as'],'attributes':_0x575364[_0x96c9('0x15')],'include':_0x575364[_0x96c9('0x17')]?_[_0x96c9('0x16')](_0x575364[_0x96c9('0x17')],function(_0x2b7ad3){return{'model':db[_0x2b7ad3[_0x96c9('0x18')]],'as':_0x2b7ad3['as'],'attributes':_0x2b7ad3['attributes'],'include':_0x2b7ad3[_0x96c9('0x17')]?_[_0x96c9('0x16')](_0x2b7ad3[_0x96c9('0x17')],function(_0x3b8b0f){return{'model':db[_0x3b8b0f[_0x96c9('0x18')]],'as':_0x3b8b0f['as'],'attributes':_0x3b8b0f[_0x96c9('0x15')]};}):[]};}):[]};}):[]:[]})[_0x96c9('0x7')](function(_0x195271){logger[_0x96c9('0x8')](_0x96c9('0x10'),_0x21a0d0);logger[_0x96c9('0xa')](_0x96c9('0x10'),_0x21a0d0,JSON[_0x96c9('0x19')](_0x195271));_0x3bdf8f(_0x195271);})['catch'](function(_0x342216){logger[_0x96c9('0xc')]('GetDynamics365Account',_0x342216[_0x96c9('0xf')],_0x21a0d0);_0x5245f8(_0x3803e2['error'](0x1f4,_0x342216['message']));});});};exports[_0x96c9('0x1a')]=function(_0x3e4184){var _0x3516eb=this;return new Promise(function(_0x4e8ce0,_0x51af17){return db[_0x96c9('0x11')][_0x96c9('0x1b')]({'raw':_0x3e4184[_0x96c9('0x12')]?_0x3e4184[_0x96c9('0x12')][_0x96c9('0x13')]===undefined?!![]:![]:!![],'where':_0x3e4184[_0x96c9('0x12')]?_0x3e4184['options']['where']||null:null,'attributes':_0x3e4184[_0x96c9('0x12')]?_0x3e4184[_0x96c9('0x12')]['attributes']||null:null,'include':_0x3e4184[_0x96c9('0x12')]?_0x3e4184[_0x96c9('0x12')][_0x96c9('0x17')]?_[_0x96c9('0x16')](_0x3e4184[_0x96c9('0x12')][_0x96c9('0x17')],function(_0x49103b){return{'model':db[_0x49103b[_0x96c9('0x18')]],'as':_0x49103b['as'],'attributes':_0x49103b[_0x96c9('0x15')],'include':_0x49103b[_0x96c9('0x17')]?_[_0x96c9('0x16')](_0x49103b['include'],function(_0x12c32c){return{'model':db[_0x12c32c['model']],'as':_0x12c32c['as'],'attributes':_0x12c32c['attributes'],'include':_0x12c32c[_0x96c9('0x17')]?_['map'](_0x12c32c[_0x96c9('0x17')],function(_0x4f1334){return{'model':db[_0x4f1334[_0x96c9('0x18')]],'as':_0x4f1334['as'],'attributes':_0x4f1334[_0x96c9('0x15')]};}):[]};}):[]};}):[]:[]})[_0x96c9('0x7')](function(_0x5521c6){logger['info'](_0x96c9('0x1a'),_0x3e4184);logger['debug'](_0x96c9('0x1a'),_0x3e4184,JSON['stringify'](_0x5521c6));_0x4e8ce0(_0x5521c6);})[_0x96c9('0x1c')](function(_0x1fff04){logger[_0x96c9('0xc')](_0x96c9('0x1a'),_0x1fff04['message'],_0x3e4184);_0x51af17(_0x3516eb[_0x96c9('0xc')](0x1f4,_0x1fff04[_0x96c9('0xf')]));});});}; \ No newline at end of file +var _0xf02c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','Dynamics365Account','findAll','options','attributes','limit','include','map','model','GetDynamics365Account','stringify','ShowDynamics365Account','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5bd1f3,_0x4ae947){var _0x223d04=function(_0x3f5a7f){while(--_0x3f5a7f){_0x5bd1f3['push'](_0x5bd1f3['shift']());}};_0x223d04(++_0x4ae947);}(_0xf02c,0x92));var _0xcf02=function(_0x1daa71,_0xa0d44){_0x1daa71=_0x1daa71-0x0;var _0x1e8012=_0xf02c[_0x1daa71];return _0x1e8012;};'use strict';var _=require(_0xcf02('0x0'));var util=require(_0xcf02('0x1'));var moment=require(_0xcf02('0x2'));var BPromise=require(_0xcf02('0x3'));var rs=require(_0xcf02('0x4'));var fs=require('fs');var Redis=require(_0xcf02('0x5'));var db=require(_0xcf02('0x6'))['db'];var utils=require(_0xcf02('0x7'));var logger=require(_0xcf02('0x8'))(_0xcf02('0x9'));var config=require(_0xcf02('0xa'));var jayson=require(_0xcf02('0xb'));var client=jayson[_0xcf02('0xc')][_0xcf02('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3569a1,_0x49ad8e,_0x45745e){return new BPromise(function(_0x56c3db,_0x5a255f){return client['request'](_0x3569a1,_0x45745e)[_0xcf02('0xe')](function(_0x2f1633){logger[_0xcf02('0xf')](_0xcf02('0x10'),_0x49ad8e,'request\x20sent');logger[_0xcf02('0x11')](_0xcf02('0x12'),_0x49ad8e,_0xcf02('0x13'),JSON['stringify'](_0x2f1633));if(_0x2f1633['error']){if(_0x2f1633[_0xcf02('0x14')][_0xcf02('0x15')]===0x1f4){logger[_0xcf02('0x14')](_0xcf02('0x10'),_0x49ad8e,_0x2f1633[_0xcf02('0x14')]['message']);return _0x5a255f(_0x2f1633[_0xcf02('0x14')][_0xcf02('0x16')]);}logger[_0xcf02('0x14')](_0xcf02('0x10'),_0x49ad8e,_0x2f1633[_0xcf02('0x14')][_0xcf02('0x16')]);return _0x56c3db(_0x2f1633[_0xcf02('0x14')]['message']);}else{logger[_0xcf02('0xf')](_0xcf02('0x10'),_0x49ad8e,_0xcf02('0x13'));_0x56c3db(_0x2f1633['result'][_0xcf02('0x16')]);}})[_0xcf02('0x17')](function(_0x59f337){logger[_0xcf02('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0x49ad8e,_0x59f337);_0x5a255f(_0x59f337);});});}exports['GetDynamics365Account']=function(_0x4f3829){var _0x2860fd=this;return new Promise(function(_0x53a97e,_0x29615d){return db[_0xcf02('0x18')][_0xcf02('0x19')]({'raw':_0x4f3829[_0xcf02('0x1a')]?_0x4f3829['options']['raw']===undefined?!![]:![]:!![],'where':_0x4f3829[_0xcf02('0x1a')]?_0x4f3829[_0xcf02('0x1a')]['where']||null:null,'attributes':_0x4f3829[_0xcf02('0x1a')]?_0x4f3829[_0xcf02('0x1a')][_0xcf02('0x1b')]||null:null,'limit':_0x4f3829[_0xcf02('0x1a')]?_0x4f3829['options'][_0xcf02('0x1c')]||null:null,'include':_0x4f3829[_0xcf02('0x1a')]?_0x4f3829[_0xcf02('0x1a')][_0xcf02('0x1d')]?_[_0xcf02('0x1e')](_0x4f3829[_0xcf02('0x1a')][_0xcf02('0x1d')],function(_0x2926b9){return{'model':db[_0x2926b9['model']],'as':_0x2926b9['as'],'attributes':_0x2926b9['attributes'],'include':_0x2926b9['include']?_[_0xcf02('0x1e')](_0x2926b9[_0xcf02('0x1d')],function(_0x2fd260){return{'model':db[_0x2fd260[_0xcf02('0x1f')]],'as':_0x2fd260['as'],'attributes':_0x2fd260[_0xcf02('0x1b')],'include':_0x2fd260[_0xcf02('0x1d')]?_[_0xcf02('0x1e')](_0x2fd260[_0xcf02('0x1d')],function(_0x4ee2b9){return{'model':db[_0x4ee2b9[_0xcf02('0x1f')]],'as':_0x4ee2b9['as'],'attributes':_0x4ee2b9[_0xcf02('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54716d){logger[_0xcf02('0xf')](_0xcf02('0x20'),_0x4f3829);logger[_0xcf02('0x11')](_0xcf02('0x20'),_0x4f3829,JSON[_0xcf02('0x21')](_0x54716d));_0x53a97e(_0x54716d);})[_0xcf02('0x17')](function(_0x2b8bc6){logger[_0xcf02('0x14')](_0xcf02('0x20'),_0x2b8bc6['message'],_0x4f3829);_0x29615d(_0x2860fd[_0xcf02('0x14')](0x1f4,_0x2b8bc6[_0xcf02('0x16')]));});});};exports[_0xcf02('0x22')]=function(_0x5af4c3){var _0x2bef8e=this;return new Promise(function(_0x320d89,_0x47b633){return db[_0xcf02('0x18')][_0xcf02('0x23')]({'raw':_0x5af4c3['options']?_0x5af4c3[_0xcf02('0x1a')][_0xcf02('0x24')]===undefined?!![]:![]:!![],'where':_0x5af4c3[_0xcf02('0x1a')]?_0x5af4c3[_0xcf02('0x1a')][_0xcf02('0x25')]||null:null,'attributes':_0x5af4c3['options']?_0x5af4c3[_0xcf02('0x1a')][_0xcf02('0x1b')]||null:null,'include':_0x5af4c3[_0xcf02('0x1a')]?_0x5af4c3[_0xcf02('0x1a')][_0xcf02('0x1d')]?_['map'](_0x5af4c3['options'][_0xcf02('0x1d')],function(_0x8c5158){return{'model':db[_0x8c5158[_0xcf02('0x1f')]],'as':_0x8c5158['as'],'attributes':_0x8c5158['attributes'],'include':_0x8c5158['include']?_[_0xcf02('0x1e')](_0x8c5158[_0xcf02('0x1d')],function(_0x259577){return{'model':db[_0x259577[_0xcf02('0x1f')]],'as':_0x259577['as'],'attributes':_0x259577[_0xcf02('0x1b')],'include':_0x259577['include']?_[_0xcf02('0x1e')](_0x259577[_0xcf02('0x1d')],function(_0x11ead1){return{'model':db[_0x11ead1['model']],'as':_0x11ead1['as'],'attributes':_0x11ead1[_0xcf02('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcf02('0xe')](function(_0xaaab0a){logger[_0xcf02('0xf')](_0xcf02('0x22'),_0x5af4c3);logger['debug'](_0xcf02('0x22'),_0x5af4c3,JSON[_0xcf02('0x21')](_0xaaab0a));_0x320d89(_0xaaab0a);})['catch'](function(_0x3bb89a){logger[_0xcf02('0x14')](_0xcf02('0x22'),_0x3bb89a[_0xcf02('0x16')],_0x5af4c3);_0x47b633(_0x2bef8e['error'](0x1f4,_0x3bb89a[_0xcf02('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 4233118..21e0ab9 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 _0xdd61=['connect-timeout','Router','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','exports','util','path'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xdd61,0x67));var _0x1dd6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xdd61[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x1dd6('0x0'));var path=require(_0x1dd6('0x1'));var timeout=require(_0x1dd6('0x2'));var express=require('express');var router=express[_0x1dd6('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1dd6('0x4'));var controller=require(_0x1dd6('0x5'));router[_0x1dd6('0x6')]('/',auth[_0x1dd6('0x7')](),controller['index']);router[_0x1dd6('0x6')](_0x1dd6('0x8'),auth[_0x1dd6('0x7')](),controller[_0x1dd6('0x9')]);router['get'](_0x1dd6('0xa'),auth[_0x1dd6('0x7')](),controller[_0x1dd6('0xb')]);router['get'](_0x1dd6('0xc'),auth['isAuthenticated'](),controller[_0x1dd6('0xd')]);router[_0x1dd6('0x6')](_0x1dd6('0xe'),auth[_0x1dd6('0x7')](),controller['getDescriptions']);router[_0x1dd6('0xf')]('/',auth['isAuthenticated'](),controller[_0x1dd6('0x10')]);router[_0x1dd6('0x11')](_0x1dd6('0x8'),auth[_0x1dd6('0x7')](),controller[_0x1dd6('0x12')]);router[_0x1dd6('0x13')](_0x1dd6('0x8'),auth[_0x1dd6('0x7')](),controller['destroy']);module[_0x1dd6('0x14')]=router; \ No newline at end of file +var _0x223e=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects'];(function(_0x560b55,_0x50b9b4){var _0x4667ca=function(_0x3172be){while(--_0x3172be){_0x560b55['push'](_0x560b55['shift']());}};_0x4667ca(++_0x50b9b4);}(_0x223e,0x86));var _0xe223=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0x223e[_0x1a7550];return _0x426e22;};'use strict';var multer=require(_0xe223('0x0'));var util=require(_0xe223('0x1'));var path=require(_0xe223('0x2'));var timeout=require('connect-timeout');var express=require(_0xe223('0x3'));var router=express[_0xe223('0x4')]();var auth=require(_0xe223('0x5'));var interaction=require(_0xe223('0x6'));var config=require(_0xe223('0x7'));var controller=require(_0xe223('0x8'));router[_0xe223('0x9')]('/',auth[_0xe223('0xa')](),controller[_0xe223('0xb')]);router[_0xe223('0x9')](_0xe223('0xc'),auth['isAuthenticated'](),controller[_0xe223('0xd')]);router['get'](_0xe223('0xe'),auth[_0xe223('0xa')](),controller['getFields']);router['get'](_0xe223('0xf'),auth[_0xe223('0xa')](),controller[_0xe223('0x10')]);router['get']('/:id/descriptions',auth[_0xe223('0xa')](),controller[_0xe223('0x11')]);router[_0xe223('0x12')]('/',auth[_0xe223('0xa')](),controller[_0xe223('0x13')]);router[_0xe223('0x14')](_0xe223('0xc'),auth[_0xe223('0xa')](),controller[_0xe223('0x15')]);router[_0xe223('0x16')]('/:id',auth[_0xe223('0xa')](),controller[_0xe223('0x17')]);module[_0xe223('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 94ba681..b282c8f 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 _0xe51a=['incident','phonecall','sequelize','exports','STRING','ENUM'];(function(_0x3ba6ee,_0x1f7dc3){var _0x383f97=function(_0x115de0){while(--_0x115de0){_0x3ba6ee['push'](_0x3ba6ee['shift']());}};_0x383f97(++_0x1f7dc3);}(_0xe51a,0xd4));var _0xae51=function(_0x5b4237,_0x301844){_0x5b4237=_0x5b4237-0x0;var _0x24582e=_0xe51a[_0x5b4237];return _0x24582e;};'use strict';var Sequelize=require(_0xae51('0x0'));module[_0xae51('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xae51('0x2')]},'ticketType':{'type':Sequelize[_0xae51('0x3')](_0xae51('0x4'),_0xae51('0x5')),'defaultValue':_0xae51('0x4')}}; \ No newline at end of file +var _0xfc6b=['ENUM','incident','phonecall','sequelize','exports','STRING'];(function(_0x32e3af,_0x36f85a){var _0x2f1294=function(_0x530e65){while(--_0x530e65){_0x32e3af['push'](_0x32e3af['shift']());}};_0x2f1294(++_0x36f85a);}(_0xfc6b,0x1dd));var _0xbfc6=function(_0x418c37,_0x414240){_0x418c37=_0x418c37-0x0;var _0x209859=_0xfc6b[_0x418c37];return _0x209859;};'use strict';var Sequelize=require(_0xbfc6('0x0'));module[_0xbfc6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbfc6('0x2')]},'ticketType':{'type':Sequelize[_0xbfc6('0x3')](_0xbfc6('0x4'),_0xbfc6('0x5')),'defaultValue':_0xbfc6('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 21980e8..4c20791 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 _0x44ab=['type','key','keys','filters','intersection','model','query','attributes','length','hasOwnProperty','order','sort','where','filter','merge','name','options','includeAll','findAll','rows','show','params','rawAttributes','fields','include','find','create','body','getFields','findOne','pick','getSubjects','Dynamics365Field','nolimit','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','jayson/promise','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','index','map','Dynamics365Configuration'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x44ab,0x183));var _0xb44a=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x44ab[_0x1caf6a];return _0x1bf493;};'use strict';var pdf=require(_0xb44a('0x0'));var emlformat=require(_0xb44a('0x1'));var rimraf=require(_0xb44a('0x2'));var zipdir=require(_0xb44a('0x3'));var jsonpatch=require(_0xb44a('0x4'));var rp=require(_0xb44a('0x5'));var moment=require('moment');var BPromise=require(_0xb44a('0x6'));var Mustache=require('mustache');var util=require(_0xb44a('0x7'));var path=require('path');var sox=require(_0xb44a('0x8'));var csv=require(_0xb44a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb44a('0xa'));var squel=require(_0xb44a('0xb'));var crypto=require(_0xb44a('0xc'));var jsforce=require(_0xb44a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb44a('0x9'));var querystring=require(_0xb44a('0xe'));var Papa=require(_0xb44a('0xf'));var Redis=require(_0xb44a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb44a('0x11'));var as=require(_0xb44a('0x12'));var hardwareService=require(_0xb44a('0x13'));var logger=require('../../config/logger')(_0xb44a('0x14'));var utils=require(_0xb44a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb44a('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb44a('0x17'));var client=jayson['client'][_0xb44a('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5aad97,_0x4b7fd1,_0x54c603,_0x7b1896){return new BPromise(function(_0x4450d3,_0x17f375){var _0x145a23=_0x7b1896||client;return _0x145a23['request'](_0x5aad97,_0x54c603)[_0xb44a('0x19')](function(_0x3a3d20){logger[_0xb44a('0x1a')](_0xb44a('0x1b'),_0x4b7fd1,_0xb44a('0x1c'));logger[_0xb44a('0x1d')](_0xb44a('0x1e'),_0x4b7fd1,'request\x20sent',JSON['stringify'](_0x3a3d20));if(_0x3a3d20[_0xb44a('0x1f')]){if(_0x3a3d20[_0xb44a('0x1f')]['code']===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x4b7fd1,_0x3a3d20['error'][_0xb44a('0x20')]);return _0x17f375(_0x3a3d20[_0xb44a('0x1f')][_0xb44a('0x20')]);}logger[_0xb44a('0x1f')](_0xb44a('0x1b'),_0x4b7fd1,_0x3a3d20['error'][_0xb44a('0x20')]);return _0x4450d3(_0x3a3d20[_0xb44a('0x1f')]['message']);}else{logger[_0xb44a('0x1a')](_0xb44a('0x1b'),_0x4b7fd1,_0xb44a('0x1c'));_0x4450d3(_0x3a3d20[_0xb44a('0x21')][_0xb44a('0x20')]);}})[_0xb44a('0x22')](function(_0x4370c7){logger[_0xb44a('0x1f')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4b7fd1,_0x4370c7);_0x17f375(_0x4370c7);});});}function respondWithStatusCode(_0x31a4c3,_0x526131){_0x526131=_0x526131||0xcc;return function(_0x4f2fa0){if(_0x4f2fa0){return _0x31a4c3[_0xb44a('0x23')](_0x526131);}return _0x31a4c3[_0xb44a('0x24')](_0x526131)['end']();};}function respondWithResult(_0x569a01,_0x23d982){_0x23d982=_0x23d982||0xc8;return function(_0x695d41){if(_0x695d41){return _0x569a01[_0xb44a('0x24')](_0x23d982)[_0xb44a('0x25')](_0x695d41);}};}function respondWithFilteredResult(_0xc67c3f,_0x9feef3){return function(_0x7eb5f3){if(_0x7eb5f3){var _0x1a697e=_0x7eb5f3[_0xb44a('0x26')],_0x173639=_0x9feef3[_0xb44a('0x27')],_0x59957a=_0x9feef3[_0xb44a('0x27')]+_0x9feef3[_0xb44a('0x28')],_0x58e78c;if(_0x59957a>=_0x1a697e){_0x59957a=_0x1a697e;_0x58e78c=0xc8;}else{_0x58e78c=0xce;}_0xc67c3f[_0xb44a('0x24')](_0x58e78c);return _0xc67c3f[_0xb44a('0x29')](_0xb44a('0x2a'),_0x173639+'-'+_0x59957a+'/'+_0x1a697e)['json'](_0x7eb5f3);}return null;};}function patchUpdates(_0x3fd545){return function(_0x574db0){try{jsonpatch[_0xb44a('0x2b')](_0x574db0,_0x3fd545,!![]);}catch(_0x36534d){return BPromise[_0xb44a('0x2c')](_0x36534d);}return _0x574db0[_0xb44a('0x2d')]();};}function saveUpdates(_0x40379c,_0x41f9cc){return function(_0x210009){if(_0x210009){return _0x210009[_0xb44a('0x2e')](_0x40379c)[_0xb44a('0x19')](function(_0x50f3d9){return _0x50f3d9;});}return null;};}function removeEntity(_0x369469,_0x559ba6){return function(_0xed8aac){if(_0xed8aac){return _0xed8aac[_0xb44a('0x2f')]()[_0xb44a('0x19')](function(){_0x369469[_0xb44a('0x24')](0xcc)[_0xb44a('0x30')]();});}};}function handleEntityNotFound(_0x4c083f,_0x3e5226){return function(_0x1ac12e){if(!_0x1ac12e){_0x4c083f['sendStatus'](0x194);}return _0x1ac12e;};}function handleError(_0x4e03df,_0x19c8c5){_0x19c8c5=_0x19c8c5||0x1f4;return function(_0x349070){logger['error'](_0x349070[_0xb44a('0x31')]);if(_0x349070['name']){delete _0x349070['name'];}_0x4e03df[_0xb44a('0x24')](_0x19c8c5)['send'](_0x349070);};}exports[_0xb44a('0x32')]=function(_0xdfde95,_0x46278d){var _0x4de273={},_0xe3f9e0={},_0x21d36c={'count':0x0,'rows':[]};var _0x267152=_[_0xb44a('0x33')](db[_0xb44a('0x34')]['rawAttributes'],function(_0x325f94){return{'name':_0x325f94['fieldName'],'type':_0x325f94[_0xb44a('0x35')][_0xb44a('0x36')]};});_0xe3f9e0['model']=_[_0xb44a('0x33')](_0x267152,'name');_0xe3f9e0['query']=_[_0xb44a('0x37')](_0xdfde95['query']);_0xe3f9e0[_0xb44a('0x38')]=_[_0xb44a('0x39')](_0xe3f9e0[_0xb44a('0x3a')],_0xe3f9e0['query']);_0x4de273['attributes']=_[_0xb44a('0x39')](_0xe3f9e0[_0xb44a('0x3a')],qs['fields'](_0xdfde95[_0xb44a('0x3b')]['fields']));_0x4de273[_0xb44a('0x3c')]=_0x4de273[_0xb44a('0x3c')][_0xb44a('0x3d')]?_0x4de273[_0xb44a('0x3c')]:_0xe3f9e0[_0xb44a('0x3a')];if(!_0xdfde95[_0xb44a('0x3b')][_0xb44a('0x3e')]('nolimit')){_0x4de273[_0xb44a('0x28')]=qs['limit'](_0xdfde95[_0xb44a('0x3b')][_0xb44a('0x28')]);_0x4de273[_0xb44a('0x27')]=qs[_0xb44a('0x27')](_0xdfde95['query']['offset']);}_0x4de273[_0xb44a('0x3f')]=qs[_0xb44a('0x40')](_0xdfde95[_0xb44a('0x3b')][_0xb44a('0x40')]);_0x4de273[_0xb44a('0x41')]=qs[_0xb44a('0x38')](_['pick'](_0xdfde95[_0xb44a('0x3b')],_0xe3f9e0[_0xb44a('0x38')]),_0x267152);if(_0xdfde95[_0xb44a('0x3b')][_0xb44a('0x42')]){_0x4de273[_0xb44a('0x41')]=_[_0xb44a('0x43')](_0x4de273[_0xb44a('0x41')],{'$or':_[_0xb44a('0x33')](_0x267152,function(_0x4cd2f1){if(_0x4cd2f1[_0xb44a('0x35')]!=='VIRTUAL'){var _0x574d7e={};_0x574d7e[_0x4cd2f1[_0xb44a('0x44')]]={'$like':'%'+_0xdfde95[_0xb44a('0x3b')][_0xb44a('0x42')]+'%'};return _0x574d7e;}})});}_0x4de273=_[_0xb44a('0x43')]({},_0x4de273,_0xdfde95[_0xb44a('0x45')]);var _0x4d376c={'where':_0x4de273['where']};return db[_0xb44a('0x34')]['count'](_0x4d376c)['then'](function(_0x4d1b98){_0x21d36c[_0xb44a('0x26')]=_0x4d1b98;if(_0xdfde95['query'][_0xb44a('0x46')]){_0x4de273['include']=[{'all':!![]}];}return db[_0xb44a('0x34')][_0xb44a('0x47')](_0x4de273);})[_0xb44a('0x19')](function(_0x1e47b2){_0x21d36c[_0xb44a('0x48')]=_0x1e47b2;return _0x21d36c;})[_0xb44a('0x19')](respondWithFilteredResult(_0x46278d,_0x4de273))[_0xb44a('0x22')](handleError(_0x46278d,null));};exports[_0xb44a('0x49')]=function(_0xacbecd,_0x58971e){var _0x2ffbaf={'raw':![],'where':{'id':_0xacbecd[_0xb44a('0x4a')]['id']}},_0x9b8ea7={};_0x9b8ea7[_0xb44a('0x3a')]=_['keys'](db[_0xb44a('0x34')][_0xb44a('0x4b')]);_0x9b8ea7[_0xb44a('0x3b')]=_[_0xb44a('0x37')](_0xacbecd[_0xb44a('0x3b')]);_0x9b8ea7['filtears']=_[_0xb44a('0x39')](_0x9b8ea7[_0xb44a('0x3a')],_0x9b8ea7[_0xb44a('0x3b')]);_0x2ffbaf['attributes']=_['intersection'](_0x9b8ea7[_0xb44a('0x3a')],qs[_0xb44a('0x4c')](_0xacbecd[_0xb44a('0x3b')][_0xb44a('0x4c')]));_0x2ffbaf[_0xb44a('0x3c')]=_0x2ffbaf[_0xb44a('0x3c')][_0xb44a('0x3d')]?_0x2ffbaf['attributes']:_0x9b8ea7[_0xb44a('0x3a')];if(_0xacbecd[_0xb44a('0x3b')][_0xb44a('0x46')]){_0x2ffbaf[_0xb44a('0x4d')]=[{'all':!![]}];}_0x2ffbaf=_['merge']({},_0x2ffbaf,_0xacbecd[_0xb44a('0x45')]);return db['Dynamics365Configuration'][_0xb44a('0x4e')](_0x2ffbaf)[_0xb44a('0x19')](handleEntityNotFound(_0x58971e,null))[_0xb44a('0x19')](respondWithResult(_0x58971e,null))['catch'](handleError(_0x58971e,null));};exports[_0xb44a('0x4f')]=function(_0x661270,_0x182eed){return db[_0xb44a('0x34')][_0xb44a('0x4f')](_0x661270[_0xb44a('0x50')],{})[_0xb44a('0x19')](respondWithResult(_0x182eed,0xc9))[_0xb44a('0x22')](handleError(_0x182eed,null));};exports[_0xb44a('0x2e')]=function(_0x2522ff,_0x5ade7a){if(_0x2522ff['body']['id']){delete _0x2522ff[_0xb44a('0x50')]['id'];}return db[_0xb44a('0x34')][_0xb44a('0x4e')]({'where':{'id':_0x2522ff[_0xb44a('0x4a')]['id']}})[_0xb44a('0x19')](handleEntityNotFound(_0x5ade7a,null))[_0xb44a('0x19')](saveUpdates(_0x2522ff[_0xb44a('0x50')],null))[_0xb44a('0x19')](respondWithResult(_0x5ade7a,null))[_0xb44a('0x22')](handleError(_0x5ade7a,null));};exports[_0xb44a('0x2f')]=function(_0x295a49,_0x1a2f84){return db[_0xb44a('0x34')][_0xb44a('0x4e')]({'where':{'id':_0x295a49[_0xb44a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1a2f84,null))[_0xb44a('0x19')](removeEntity(_0x1a2f84,null))[_0xb44a('0x22')](handleError(_0x1a2f84,null));};exports[_0xb44a('0x51')]=function(_0x208d3c,_0x5a1e64,_0x472dad){var _0x250172={};var _0x361dec={};var _0x47a69a;var _0x32fe88;return db[_0xb44a('0x34')][_0xb44a('0x52')]({'where':{'id':_0x208d3c[_0xb44a('0x4a')]['id']}})[_0xb44a('0x19')](handleEntityNotFound(_0x5a1e64,null))[_0xb44a('0x19')](function(_0x31ba58){if(_0x31ba58){_0x47a69a=_0x31ba58;_0x361dec[_0xb44a('0x3a')]=_[_0xb44a('0x37')](db['Dynamics365Field'][_0xb44a('0x4b')]);_0x361dec[_0xb44a('0x3b')]=_['keys'](_0x208d3c[_0xb44a('0x3b')]);_0x361dec[_0xb44a('0x38')]=_['intersection'](_0x361dec['model'],_0x361dec[_0xb44a('0x3b')]);_0x250172['attributes']=_[_0xb44a('0x39')](_0x361dec[_0xb44a('0x3a')],qs['fields'](_0x208d3c[_0xb44a('0x3b')][_0xb44a('0x4c')]));_0x250172[_0xb44a('0x3c')]=_0x250172[_0xb44a('0x3c')][_0xb44a('0x3d')]?_0x250172['attributes']:_0x361dec['model'];_0x250172[_0xb44a('0x3f')]=qs[_0xb44a('0x40')](_0x208d3c[_0xb44a('0x3b')]['sort']);_0x250172['where']=qs[_0xb44a('0x38')](_[_0xb44a('0x53')](_0x208d3c[_0xb44a('0x3b')],_0x361dec[_0xb44a('0x38')]));if(_0x208d3c[_0xb44a('0x3b')]['filter']){_0x250172['where']=_['merge'](_0x250172[_0xb44a('0x41')],{'$or':_['map'](_0x250172[_0xb44a('0x3c')],function(_0x210faf){var _0x3e24cd={};_0x3e24cd[_0x210faf]={'$like':'%'+_0x208d3c['query'][_0xb44a('0x42')]+'%'};return _0x3e24cd;})});}_0x250172=_['merge']({},_0x250172,_0x208d3c[_0xb44a('0x45')]);return _0x47a69a[_0xb44a('0x51')](_0x250172);}})[_0xb44a('0x19')](function(_0xbd7535){if(_0xbd7535){_0x32fe88=_0xbd7535[_0xb44a('0x3d')];if(!_0x208d3c[_0xb44a('0x3b')]['hasOwnProperty']('nolimit')){_0x250172[_0xb44a('0x28')]=qs[_0xb44a('0x28')](_0x208d3c[_0xb44a('0x3b')][_0xb44a('0x28')]);_0x250172[_0xb44a('0x27')]=qs[_0xb44a('0x27')](_0x208d3c[_0xb44a('0x3b')][_0xb44a('0x27')]);}return _0x47a69a['getFields'](_0x250172);}})[_0xb44a('0x19')](function(_0x5d59c6){if(_0x5d59c6){return _0x5d59c6?{'count':_0x32fe88,'rows':_0x5d59c6}:null;}})[_0xb44a('0x19')](respondWithResult(_0x5a1e64,null))[_0xb44a('0x22')](handleError(_0x5a1e64,null));};exports[_0xb44a('0x54')]=function(_0x3b7d61,_0x4dcb6d,_0x1a0a31){var _0xdc2b6f={};var _0x219e74={};var _0x3a29ad;var _0x236b74;return db[_0xb44a('0x34')][_0xb44a('0x52')]({'where':{'id':_0x3b7d61[_0xb44a('0x4a')]['id']}})[_0xb44a('0x19')](handleEntityNotFound(_0x4dcb6d,null))[_0xb44a('0x19')](function(_0x1debf5){if(_0x1debf5){_0x3a29ad=_0x1debf5;_0x219e74[_0xb44a('0x3a')]=_[_0xb44a('0x37')](db[_0xb44a('0x55')]['rawAttributes']);_0x219e74[_0xb44a('0x3b')]=_[_0xb44a('0x37')](_0x3b7d61[_0xb44a('0x3b')]);_0x219e74[_0xb44a('0x38')]=_[_0xb44a('0x39')](_0x219e74[_0xb44a('0x3a')],_0x219e74['query']);_0xdc2b6f[_0xb44a('0x3c')]=_[_0xb44a('0x39')](_0x219e74[_0xb44a('0x3a')],qs[_0xb44a('0x4c')](_0x3b7d61['query'][_0xb44a('0x4c')]));_0xdc2b6f[_0xb44a('0x3c')]=_0xdc2b6f[_0xb44a('0x3c')][_0xb44a('0x3d')]?_0xdc2b6f[_0xb44a('0x3c')]:_0x219e74[_0xb44a('0x3a')];_0xdc2b6f[_0xb44a('0x3f')]=qs[_0xb44a('0x40')](_0x3b7d61[_0xb44a('0x3b')][_0xb44a('0x40')]);_0xdc2b6f[_0xb44a('0x41')]=qs[_0xb44a('0x38')](_[_0xb44a('0x53')](_0x3b7d61[_0xb44a('0x3b')],_0x219e74['filters']));if(_0x3b7d61['query']['filter']){_0xdc2b6f[_0xb44a('0x41')]=_[_0xb44a('0x43')](_0xdc2b6f[_0xb44a('0x41')],{'$or':_[_0xb44a('0x33')](_0xdc2b6f['attributes'],function(_0x2e6abb){var _0x2c60d7={};_0x2c60d7[_0x2e6abb]={'$like':'%'+_0x3b7d61[_0xb44a('0x3b')][_0xb44a('0x42')]+'%'};return _0x2c60d7;})});}_0xdc2b6f=_[_0xb44a('0x43')]({},_0xdc2b6f,_0x3b7d61['options']);return _0x3a29ad[_0xb44a('0x54')](_0xdc2b6f);}})[_0xb44a('0x19')](function(_0x5c10b2){if(_0x5c10b2){_0x236b74=_0x5c10b2['length'];if(!_0x3b7d61['query']['hasOwnProperty'](_0xb44a('0x56'))){_0xdc2b6f[_0xb44a('0x28')]=qs[_0xb44a('0x28')](_0x3b7d61[_0xb44a('0x3b')][_0xb44a('0x28')]);_0xdc2b6f[_0xb44a('0x27')]=qs[_0xb44a('0x27')](_0x3b7d61['query'][_0xb44a('0x27')]);}return _0x3a29ad[_0xb44a('0x54')](_0xdc2b6f);}})['then'](function(_0x25d9d5){if(_0x25d9d5){return _0x25d9d5?{'count':_0x236b74,'rows':_0x25d9d5}:null;}})[_0xb44a('0x19')](respondWithResult(_0x4dcb6d,null))[_0xb44a('0x22')](handleError(_0x4dcb6d,null));};exports[_0xb44a('0x57')]=function(_0x33e50f,_0x25606a,_0x141682){var _0x297375={};var _0x1bc1f4={};var _0xa96abf;var _0x57bd19;return db[_0xb44a('0x34')]['findOne']({'where':{'id':_0x33e50f[_0xb44a('0x4a')]['id']}})[_0xb44a('0x19')](handleEntityNotFound(_0x25606a,null))['then'](function(_0x4d4b16){if(_0x4d4b16){_0xa96abf=_0x4d4b16;_0x1bc1f4[_0xb44a('0x3a')]=_[_0xb44a('0x37')](db[_0xb44a('0x55')][_0xb44a('0x4b')]);_0x1bc1f4['query']=_[_0xb44a('0x37')](_0x33e50f[_0xb44a('0x3b')]);_0x1bc1f4[_0xb44a('0x38')]=_['intersection'](_0x1bc1f4[_0xb44a('0x3a')],_0x1bc1f4[_0xb44a('0x3b')]);_0x297375[_0xb44a('0x3c')]=_[_0xb44a('0x39')](_0x1bc1f4[_0xb44a('0x3a')],qs[_0xb44a('0x4c')](_0x33e50f[_0xb44a('0x3b')][_0xb44a('0x4c')]));_0x297375['attributes']=_0x297375[_0xb44a('0x3c')][_0xb44a('0x3d')]?_0x297375[_0xb44a('0x3c')]:_0x1bc1f4[_0xb44a('0x3a')];_0x297375[_0xb44a('0x3f')]=qs[_0xb44a('0x40')](_0x33e50f[_0xb44a('0x3b')][_0xb44a('0x40')]);_0x297375[_0xb44a('0x41')]=qs['filters'](_[_0xb44a('0x53')](_0x33e50f[_0xb44a('0x3b')],_0x1bc1f4[_0xb44a('0x38')]));if(_0x33e50f[_0xb44a('0x3b')][_0xb44a('0x42')]){_0x297375[_0xb44a('0x41')]=_[_0xb44a('0x43')](_0x297375[_0xb44a('0x41')],{'$or':_[_0xb44a('0x33')](_0x297375[_0xb44a('0x3c')],function(_0x249c6e){var _0x58d5b3={};_0x58d5b3[_0x249c6e]={'$like':'%'+_0x33e50f[_0xb44a('0x3b')][_0xb44a('0x42')]+'%'};return _0x58d5b3;})});}_0x297375=_['merge']({},_0x297375,_0x33e50f[_0xb44a('0x45')]);return _0xa96abf[_0xb44a('0x57')](_0x297375);}})['then'](function(_0x40283b){if(_0x40283b){_0x57bd19=_0x40283b[_0xb44a('0x3d')];if(!_0x33e50f[_0xb44a('0x3b')][_0xb44a('0x3e')](_0xb44a('0x56'))){_0x297375[_0xb44a('0x28')]=qs[_0xb44a('0x28')](_0x33e50f['query']['limit']);_0x297375[_0xb44a('0x27')]=qs['offset'](_0x33e50f[_0xb44a('0x3b')]['offset']);}return _0xa96abf[_0xb44a('0x57')](_0x297375);}})['then'](function(_0x376a42){if(_0x376a42){return _0x376a42?{'count':_0x57bd19,'rows':_0x376a42}:null;}})['then'](respondWithResult(_0x25606a,null))['catch'](handleError(_0x25606a,null));}; \ No newline at end of file +var _0x9a97=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','rows','show','params','filtears','options','find','create','body','getFields','findOne','Dynamics365Field','getDescriptions','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1868c9,_0x129410){var _0x26899f=function(_0x2aca15){while(--_0x2aca15){_0x1868c9['push'](_0x1868c9['shift']());}};_0x26899f(++_0x129410);}(_0x9a97,0x1c5));var _0x79a9=function(_0x347042,_0x3601e5){_0x347042=_0x347042-0x0;var _0x91c699=_0x9a97[_0x347042];return _0x91c699;};'use strict';var pdf=require(_0x79a9('0x0'));var emlformat=require(_0x79a9('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x79a9('0x2'));var rp=require(_0x79a9('0x3'));var moment=require(_0x79a9('0x4'));var BPromise=require(_0x79a9('0x5'));var Mustache=require(_0x79a9('0x6'));var util=require('util');var path=require(_0x79a9('0x7'));var sox=require(_0x79a9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x79a9('0x9'));var squel=require('squel');var crypto=require(_0x79a9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x79a9('0xb'));var toCsv=require(_0x79a9('0xc'));var querystring=require(_0x79a9('0xd'));var Papa=require(_0x79a9('0xe'));var Redis=require(_0x79a9('0xf'));var authService=require(_0x79a9('0x10'));var qs=require(_0x79a9('0x11'));var as=require(_0x79a9('0x12'));var hardwareService=require(_0x79a9('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x79a9('0x14'));var config=require(_0x79a9('0x15'));var licenseUtil=require(_0x79a9('0x16'));var db=require(_0x79a9('0x17'))['db'];var jayson=require(_0x79a9('0x18'));var client=jayson[_0x79a9('0x19')][_0x79a9('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x577667,_0x392214,_0x3e6cd5,_0x1033b7){return new BPromise(function(_0x27e9e1,_0x58b1a0){var _0x332030=_0x1033b7||client;return _0x332030[_0x79a9('0x1b')](_0x577667,_0x3e6cd5)[_0x79a9('0x1c')](function(_0x359dd0){logger[_0x79a9('0x1d')](_0x79a9('0x1e'),_0x392214,_0x79a9('0x1f'));logger[_0x79a9('0x20')](_0x79a9('0x21'),_0x392214,_0x79a9('0x1f'),JSON[_0x79a9('0x22')](_0x359dd0));if(_0x359dd0[_0x79a9('0x23')]){if(_0x359dd0['error'][_0x79a9('0x24')]===0x1f4){logger[_0x79a9('0x23')](_0x79a9('0x1e'),_0x392214,_0x359dd0[_0x79a9('0x23')][_0x79a9('0x25')]);return _0x58b1a0(_0x359dd0[_0x79a9('0x23')][_0x79a9('0x25')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x392214,_0x359dd0[_0x79a9('0x23')][_0x79a9('0x25')]);return _0x27e9e1(_0x359dd0['error'][_0x79a9('0x25')]);}else{logger[_0x79a9('0x1d')]('Dynamics365Configuration,\x20%s,\x20%s',_0x392214,_0x79a9('0x1f'));_0x27e9e1(_0x359dd0[_0x79a9('0x26')][_0x79a9('0x25')]);}})[_0x79a9('0x27')](function(_0x4f6333){logger[_0x79a9('0x23')]('Dynamics365Configuration,\x20%s,\x20%s',_0x392214,_0x4f6333);_0x58b1a0(_0x4f6333);});});}function respondWithStatusCode(_0x1c830b,_0x3c0813){_0x3c0813=_0x3c0813||0xcc;return function(_0x3fa969){if(_0x3fa969){return _0x1c830b[_0x79a9('0x28')](_0x3c0813);}return _0x1c830b[_0x79a9('0x29')](_0x3c0813)[_0x79a9('0x2a')]();};}function respondWithResult(_0x2e21f2,_0x2b7654){_0x2b7654=_0x2b7654||0xc8;return function(_0x3db1f4){if(_0x3db1f4){return _0x2e21f2['status'](_0x2b7654)[_0x79a9('0x2b')](_0x3db1f4);}};}function respondWithFilteredResult(_0x490b16,_0x562923){return function(_0x251df7){if(_0x251df7){var _0x1630a6=_0x251df7[_0x79a9('0x2c')],_0xd9bcd4=_0x562923[_0x79a9('0x2d')],_0x23626b=_0x562923[_0x79a9('0x2d')]+_0x562923['limit'],_0x8e980c;if(_0x23626b>=_0x1630a6){_0x23626b=_0x1630a6;_0x8e980c=0xc8;}else{_0x8e980c=0xce;}_0x490b16[_0x79a9('0x29')](_0x8e980c);return _0x490b16[_0x79a9('0x2e')](_0x79a9('0x2f'),_0xd9bcd4+'-'+_0x23626b+'/'+_0x1630a6)[_0x79a9('0x2b')](_0x251df7);}return null;};}function patchUpdates(_0x2aca0f){return function(_0x435c75){try{jsonpatch[_0x79a9('0x30')](_0x435c75,_0x2aca0f,!![]);}catch(_0x43fea4){return BPromise[_0x79a9('0x31')](_0x43fea4);}return _0x435c75[_0x79a9('0x32')]();};}function saveUpdates(_0x4c146f,_0x49223a){return function(_0x47a77a){if(_0x47a77a){return _0x47a77a[_0x79a9('0x33')](_0x4c146f)[_0x79a9('0x1c')](function(_0x4d6233){return _0x4d6233;});}return null;};}function removeEntity(_0x37ba00,_0x583d08){return function(_0x15e293){if(_0x15e293){return _0x15e293[_0x79a9('0x34')]()[_0x79a9('0x1c')](function(){_0x37ba00[_0x79a9('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3adf82,_0x3d7b41){return function(_0x8c9528){if(!_0x8c9528){_0x3adf82[_0x79a9('0x28')](0x194);}return _0x8c9528;};}function handleError(_0x68d82a,_0x149bee){_0x149bee=_0x149bee||0x1f4;return function(_0x58c78e){logger[_0x79a9('0x23')](_0x58c78e[_0x79a9('0x35')]);if(_0x58c78e[_0x79a9('0x36')]){delete _0x58c78e[_0x79a9('0x36')];}_0x68d82a[_0x79a9('0x29')](_0x149bee)[_0x79a9('0x37')](_0x58c78e);};}exports[_0x79a9('0x38')]=function(_0x534ba9,_0x6e65aa){var _0x1e1a35={},_0x41f979={},_0x5a7e55={'count':0x0,'rows':[]};var _0x47c5bc=_[_0x79a9('0x39')](db[_0x79a9('0x3a')][_0x79a9('0x3b')],function(_0x4f8182){return{'name':_0x4f8182[_0x79a9('0x3c')],'type':_0x4f8182[_0x79a9('0x3d')][_0x79a9('0x3e')]};});_0x41f979['model']=_['map'](_0x47c5bc,'name');_0x41f979[_0x79a9('0x3f')]=_[_0x79a9('0x40')](_0x534ba9['query']);_0x41f979['filters']=_['intersection'](_0x41f979[_0x79a9('0x41')],_0x41f979[_0x79a9('0x3f')]);_0x1e1a35[_0x79a9('0x42')]=_[_0x79a9('0x43')](_0x41f979[_0x79a9('0x41')],qs[_0x79a9('0x44')](_0x534ba9['query'][_0x79a9('0x44')]));_0x1e1a35[_0x79a9('0x42')]=_0x1e1a35['attributes'][_0x79a9('0x45')]?_0x1e1a35[_0x79a9('0x42')]:_0x41f979[_0x79a9('0x41')];if(!_0x534ba9[_0x79a9('0x3f')][_0x79a9('0x46')](_0x79a9('0x47'))){_0x1e1a35[_0x79a9('0x48')]=qs[_0x79a9('0x48')](_0x534ba9[_0x79a9('0x3f')][_0x79a9('0x48')]);_0x1e1a35['offset']=qs['offset'](_0x534ba9['query']['offset']);}_0x1e1a35[_0x79a9('0x49')]=qs[_0x79a9('0x4a')](_0x534ba9[_0x79a9('0x3f')]['sort']);_0x1e1a35[_0x79a9('0x4b')]=qs[_0x79a9('0x4c')](_[_0x79a9('0x4d')](_0x534ba9[_0x79a9('0x3f')],_0x41f979['filters']),_0x47c5bc);if(_0x534ba9[_0x79a9('0x3f')][_0x79a9('0x4e')]){_0x1e1a35[_0x79a9('0x4b')]=_['merge'](_0x1e1a35['where'],{'$or':_[_0x79a9('0x39')](_0x47c5bc,function(_0x5010cf){if(_0x5010cf[_0x79a9('0x3d')]!==_0x79a9('0x4f')){var _0x497699={};_0x497699[_0x5010cf[_0x79a9('0x36')]]={'$like':'%'+_0x534ba9[_0x79a9('0x3f')][_0x79a9('0x4e')]+'%'};return _0x497699;}})});}_0x1e1a35=_[_0x79a9('0x50')]({},_0x1e1a35,_0x534ba9['options']);var _0x24806b={'where':_0x1e1a35[_0x79a9('0x4b')]};return db[_0x79a9('0x3a')][_0x79a9('0x2c')](_0x24806b)['then'](function(_0x4465e6){_0x5a7e55['count']=_0x4465e6;if(_0x534ba9[_0x79a9('0x3f')][_0x79a9('0x51')]){_0x1e1a35['include']=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x1e1a35);})[_0x79a9('0x1c')](function(_0xf1207d){_0x5a7e55[_0x79a9('0x52')]=_0xf1207d;return _0x5a7e55;})[_0x79a9('0x1c')](respondWithFilteredResult(_0x6e65aa,_0x1e1a35))[_0x79a9('0x27')](handleError(_0x6e65aa,null));};exports[_0x79a9('0x53')]=function(_0xecf9bb,_0xf3e09e){var _0xc47704={'raw':![],'where':{'id':_0xecf9bb[_0x79a9('0x54')]['id']}},_0x1fe91c={};_0x1fe91c[_0x79a9('0x41')]=_[_0x79a9('0x40')](db[_0x79a9('0x3a')][_0x79a9('0x3b')]);_0x1fe91c[_0x79a9('0x3f')]=_[_0x79a9('0x40')](_0xecf9bb[_0x79a9('0x3f')]);_0x1fe91c[_0x79a9('0x55')]=_[_0x79a9('0x43')](_0x1fe91c[_0x79a9('0x41')],_0x1fe91c[_0x79a9('0x3f')]);_0xc47704[_0x79a9('0x42')]=_[_0x79a9('0x43')](_0x1fe91c[_0x79a9('0x41')],qs[_0x79a9('0x44')](_0xecf9bb[_0x79a9('0x3f')][_0x79a9('0x44')]));_0xc47704['attributes']=_0xc47704[_0x79a9('0x42')][_0x79a9('0x45')]?_0xc47704[_0x79a9('0x42')]:_0x1fe91c['model'];if(_0xecf9bb['query'][_0x79a9('0x51')]){_0xc47704['include']=[{'all':!![]}];}_0xc47704=_[_0x79a9('0x50')]({},_0xc47704,_0xecf9bb[_0x79a9('0x56')]);return db[_0x79a9('0x3a')][_0x79a9('0x57')](_0xc47704)[_0x79a9('0x1c')](handleEntityNotFound(_0xf3e09e,null))[_0x79a9('0x1c')](respondWithResult(_0xf3e09e,null))[_0x79a9('0x27')](handleError(_0xf3e09e,null));};exports[_0x79a9('0x58')]=function(_0x2a0ef0,_0x11bc2d){return db[_0x79a9('0x3a')][_0x79a9('0x58')](_0x2a0ef0[_0x79a9('0x59')],{})[_0x79a9('0x1c')](respondWithResult(_0x11bc2d,0xc9))['catch'](handleError(_0x11bc2d,null));};exports[_0x79a9('0x33')]=function(_0x3f1b3a,_0x541bdb){if(_0x3f1b3a['body']['id']){delete _0x3f1b3a['body']['id'];}return db['Dynamics365Configuration'][_0x79a9('0x57')]({'where':{'id':_0x3f1b3a[_0x79a9('0x54')]['id']}})['then'](handleEntityNotFound(_0x541bdb,null))[_0x79a9('0x1c')](saveUpdates(_0x3f1b3a[_0x79a9('0x59')],null))[_0x79a9('0x1c')](respondWithResult(_0x541bdb,null))[_0x79a9('0x27')](handleError(_0x541bdb,null));};exports[_0x79a9('0x34')]=function(_0x11b2a7,_0x43560a){return db['Dynamics365Configuration'][_0x79a9('0x57')]({'where':{'id':_0x11b2a7[_0x79a9('0x54')]['id']}})[_0x79a9('0x1c')](handleEntityNotFound(_0x43560a,null))[_0x79a9('0x1c')](removeEntity(_0x43560a,null))[_0x79a9('0x27')](handleError(_0x43560a,null));};exports[_0x79a9('0x5a')]=function(_0x198625,_0x4c1b35,_0x110087){var _0x393e4b={};var _0x6820bc={};var _0xc36d51;var _0x41de06;return db[_0x79a9('0x3a')][_0x79a9('0x5b')]({'where':{'id':_0x198625['params']['id']}})[_0x79a9('0x1c')](handleEntityNotFound(_0x4c1b35,null))[_0x79a9('0x1c')](function(_0x359a21){if(_0x359a21){_0xc36d51=_0x359a21;_0x6820bc[_0x79a9('0x41')]=_[_0x79a9('0x40')](db[_0x79a9('0x5c')][_0x79a9('0x3b')]);_0x6820bc[_0x79a9('0x3f')]=_[_0x79a9('0x40')](_0x198625[_0x79a9('0x3f')]);_0x6820bc[_0x79a9('0x4c')]=_[_0x79a9('0x43')](_0x6820bc['model'],_0x6820bc[_0x79a9('0x3f')]);_0x393e4b[_0x79a9('0x42')]=_[_0x79a9('0x43')](_0x6820bc[_0x79a9('0x41')],qs[_0x79a9('0x44')](_0x198625[_0x79a9('0x3f')][_0x79a9('0x44')]));_0x393e4b[_0x79a9('0x42')]=_0x393e4b[_0x79a9('0x42')]['length']?_0x393e4b[_0x79a9('0x42')]:_0x6820bc[_0x79a9('0x41')];_0x393e4b[_0x79a9('0x49')]=qs['sort'](_0x198625[_0x79a9('0x3f')][_0x79a9('0x4a')]);_0x393e4b[_0x79a9('0x4b')]=qs['filters'](_['pick'](_0x198625[_0x79a9('0x3f')],_0x6820bc['filters']));if(_0x198625[_0x79a9('0x3f')][_0x79a9('0x4e')]){_0x393e4b[_0x79a9('0x4b')]=_['merge'](_0x393e4b['where'],{'$or':_[_0x79a9('0x39')](_0x393e4b[_0x79a9('0x42')],function(_0x14ee5d){var _0x541173={};_0x541173[_0x14ee5d]={'$like':'%'+_0x198625[_0x79a9('0x3f')]['filter']+'%'};return _0x541173;})});}_0x393e4b=_[_0x79a9('0x50')]({},_0x393e4b,_0x198625[_0x79a9('0x56')]);return _0xc36d51['getFields'](_0x393e4b);}})[_0x79a9('0x1c')](function(_0x30dfa8){if(_0x30dfa8){_0x41de06=_0x30dfa8[_0x79a9('0x45')];if(!_0x198625[_0x79a9('0x3f')][_0x79a9('0x46')](_0x79a9('0x47'))){_0x393e4b[_0x79a9('0x48')]=qs[_0x79a9('0x48')](_0x198625[_0x79a9('0x3f')][_0x79a9('0x48')]);_0x393e4b[_0x79a9('0x2d')]=qs[_0x79a9('0x2d')](_0x198625[_0x79a9('0x3f')][_0x79a9('0x2d')]);}return _0xc36d51[_0x79a9('0x5a')](_0x393e4b);}})[_0x79a9('0x1c')](function(_0x4f5ce3){if(_0x4f5ce3){return _0x4f5ce3?{'count':_0x41de06,'rows':_0x4f5ce3}:null;}})[_0x79a9('0x1c')](respondWithResult(_0x4c1b35,null))['catch'](handleError(_0x4c1b35,null));};exports['getSubjects']=function(_0x5f44bb,_0x440e2f,_0xa25025){var _0x4302d4={};var _0x4f8189={};var _0x55c24c;var _0x3f2541;return db[_0x79a9('0x3a')][_0x79a9('0x5b')]({'where':{'id':_0x5f44bb[_0x79a9('0x54')]['id']}})['then'](handleEntityNotFound(_0x440e2f,null))['then'](function(_0x50f85f){if(_0x50f85f){_0x55c24c=_0x50f85f;_0x4f8189[_0x79a9('0x41')]=_['keys'](db[_0x79a9('0x5c')][_0x79a9('0x3b')]);_0x4f8189[_0x79a9('0x3f')]=_[_0x79a9('0x40')](_0x5f44bb[_0x79a9('0x3f')]);_0x4f8189['filters']=_['intersection'](_0x4f8189[_0x79a9('0x41')],_0x4f8189[_0x79a9('0x3f')]);_0x4302d4[_0x79a9('0x42')]=_[_0x79a9('0x43')](_0x4f8189['model'],qs[_0x79a9('0x44')](_0x5f44bb[_0x79a9('0x3f')][_0x79a9('0x44')]));_0x4302d4[_0x79a9('0x42')]=_0x4302d4['attributes']['length']?_0x4302d4[_0x79a9('0x42')]:_0x4f8189['model'];_0x4302d4['order']=qs[_0x79a9('0x4a')](_0x5f44bb[_0x79a9('0x3f')]['sort']);_0x4302d4[_0x79a9('0x4b')]=qs['filters'](_['pick'](_0x5f44bb[_0x79a9('0x3f')],_0x4f8189[_0x79a9('0x4c')]));if(_0x5f44bb[_0x79a9('0x3f')][_0x79a9('0x4e')]){_0x4302d4[_0x79a9('0x4b')]=_['merge'](_0x4302d4[_0x79a9('0x4b')],{'$or':_[_0x79a9('0x39')](_0x4302d4['attributes'],function(_0xe5eed5){var _0x50c2d1={};_0x50c2d1[_0xe5eed5]={'$like':'%'+_0x5f44bb['query']['filter']+'%'};return _0x50c2d1;})});}_0x4302d4=_[_0x79a9('0x50')]({},_0x4302d4,_0x5f44bb[_0x79a9('0x56')]);return _0x55c24c['getSubjects'](_0x4302d4);}})[_0x79a9('0x1c')](function(_0x32323f){if(_0x32323f){_0x3f2541=_0x32323f['length'];if(!_0x5f44bb[_0x79a9('0x3f')][_0x79a9('0x46')](_0x79a9('0x47'))){_0x4302d4['limit']=qs[_0x79a9('0x48')](_0x5f44bb[_0x79a9('0x3f')]['limit']);_0x4302d4['offset']=qs[_0x79a9('0x2d')](_0x5f44bb[_0x79a9('0x3f')]['offset']);}return _0x55c24c['getSubjects'](_0x4302d4);}})[_0x79a9('0x1c')](function(_0x425e91){if(_0x425e91){return _0x425e91?{'count':_0x3f2541,'rows':_0x425e91}:null;}})['then'](respondWithResult(_0x440e2f,null))[_0x79a9('0x27')](handleError(_0x440e2f,null));};exports[_0x79a9('0x5d')]=function(_0x245b42,_0x1964c1,_0x5940f3){var _0x148109={};var _0x3b705a={};var _0x46e84a;var _0x311349;return db[_0x79a9('0x3a')][_0x79a9('0x5b')]({'where':{'id':_0x245b42[_0x79a9('0x54')]['id']}})[_0x79a9('0x1c')](handleEntityNotFound(_0x1964c1,null))[_0x79a9('0x1c')](function(_0x54047c){if(_0x54047c){_0x46e84a=_0x54047c;_0x3b705a[_0x79a9('0x41')]=_[_0x79a9('0x40')](db[_0x79a9('0x5c')][_0x79a9('0x3b')]);_0x3b705a['query']=_[_0x79a9('0x40')](_0x245b42[_0x79a9('0x3f')]);_0x3b705a[_0x79a9('0x4c')]=_[_0x79a9('0x43')](_0x3b705a[_0x79a9('0x41')],_0x3b705a['query']);_0x148109['attributes']=_['intersection'](_0x3b705a[_0x79a9('0x41')],qs['fields'](_0x245b42['query'][_0x79a9('0x44')]));_0x148109['attributes']=_0x148109[_0x79a9('0x42')]['length']?_0x148109[_0x79a9('0x42')]:_0x3b705a[_0x79a9('0x41')];_0x148109[_0x79a9('0x49')]=qs[_0x79a9('0x4a')](_0x245b42[_0x79a9('0x3f')][_0x79a9('0x4a')]);_0x148109[_0x79a9('0x4b')]=qs[_0x79a9('0x4c')](_[_0x79a9('0x4d')](_0x245b42[_0x79a9('0x3f')],_0x3b705a[_0x79a9('0x4c')]));if(_0x245b42[_0x79a9('0x3f')][_0x79a9('0x4e')]){_0x148109[_0x79a9('0x4b')]=_[_0x79a9('0x50')](_0x148109[_0x79a9('0x4b')],{'$or':_['map'](_0x148109['attributes'],function(_0x4d1924){var _0x302e1c={};_0x302e1c[_0x4d1924]={'$like':'%'+_0x245b42[_0x79a9('0x3f')][_0x79a9('0x4e')]+'%'};return _0x302e1c;})});}_0x148109=_[_0x79a9('0x50')]({},_0x148109,_0x245b42['options']);return _0x46e84a[_0x79a9('0x5d')](_0x148109);}})[_0x79a9('0x1c')](function(_0x547450){if(_0x547450){_0x311349=_0x547450[_0x79a9('0x45')];if(!_0x245b42[_0x79a9('0x3f')][_0x79a9('0x46')](_0x79a9('0x47'))){_0x148109[_0x79a9('0x48')]=qs['limit'](_0x245b42[_0x79a9('0x3f')][_0x79a9('0x48')]);_0x148109[_0x79a9('0x2d')]=qs[_0x79a9('0x2d')](_0x245b42[_0x79a9('0x3f')]['offset']);}return _0x46e84a[_0x79a9('0x5d')](_0x148109);}})[_0x79a9('0x1c')](function(_0x21f79c){if(_0x21f79c){return _0x21f79c?{'count':_0x311349,'rows':_0x21f79c}:null;}})[_0x79a9('0x1c')](respondWithResult(_0x1964c1,null))[_0x79a9('0x27')](handleError(_0x1964c1,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 4abe94d..b43e082 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 _0x8f2f=['moment','bluebird','request-promise','path','../../config/environment','exports','define','int_dynamics365_configurations','lodash','api'];(function(_0x111ff4,_0x37f4b5){var _0x22c314=function(_0x3e6425){while(--_0x3e6425){_0x111ff4['push'](_0x111ff4['shift']());}};_0x22c314(++_0x37f4b5);}(_0x8f2f,0x1b6));var _0xf8f2=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x8f2f[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xf8f2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf8f2('0x1'));var moment=require(_0xf8f2('0x2'));var BPromise=require(_0xf8f2('0x3'));var rp=require(_0xf8f2('0x4'));var fs=require('fs');var path=require(_0xf8f2('0x5'));var rimraf=require('rimraf');var config=require(_0xf8f2('0x6'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xf8f2('0x7')]=function(_0x3b9cad,_0x3c0b24){return _0x3b9cad[_0xf8f2('0x8')]('Dynamics365Configuration',attributes,{'tableName':_0xf8f2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa906=['../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','moment','path'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xa906,0x137));var _0x6a90=function(_0x27453f,_0x23e8a5){_0x27453f=_0x27453f-0x0;var _0x176ff5=_0xa906[_0x27453f];return _0x176ff5;};'use strict';var _=require('lodash');var util=require(_0x6a90('0x0'));var logger=require(_0x6a90('0x1'))('api');var moment=require(_0x6a90('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a90('0x3'));var rimraf=require('rimraf');var config=require(_0x6a90('0x4'));var attributes=require(_0x6a90('0x5'));module[_0x6a90('0x6')]=function(_0x4a3bfe,_0x15bbc4){return _0x4a3bfe['define'](_0x6a90('0x7'),attributes,{'tableName':_0x6a90('0x8'),'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 a75186b..e38cd50 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 _0x67bd=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash'];(function(_0xb5b69a,_0x1efef9){var _0x36e222=function(_0x3a0c4b){while(--_0x3a0c4b){_0xb5b69a['push'](_0xb5b69a['shift']());}};_0x36e222(++_0x1efef9);}(_0x67bd,0xc5));var _0xd67b=function(_0x1ba691,_0x59087e){_0x1ba691=_0x1ba691-0x0;var _0xa6091c=_0x67bd[_0x1ba691];return _0xa6091c;};'use strict';var _=require(_0xd67b('0x0'));var util=require(_0xd67b('0x1'));var moment=require(_0xd67b('0x2'));var BPromise=require(_0xd67b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd67b('0x4'));var db=require(_0xd67b('0x5'))['db'];var utils=require(_0xd67b('0x6'));var logger=require(_0xd67b('0x7'))(_0xd67b('0x8'));var config=require(_0xd67b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd67b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25173b,_0x13f74b,_0x4985f6){return new BPromise(function(_0x220568,_0x57f831){return client[_0xd67b('0xb')](_0x25173b,_0x4985f6)[_0xd67b('0xc')](function(_0x452814){logger['info'](_0xd67b('0xd'),_0x13f74b,'request\x20sent');logger['debug'](_0xd67b('0xe'),_0x13f74b,_0xd67b('0xf'),JSON['stringify'](_0x452814));if(_0x452814[_0xd67b('0x10')]){if(_0x452814['error'][_0xd67b('0x11')]===0x1f4){logger[_0xd67b('0x10')](_0xd67b('0xd'),_0x13f74b,_0x452814[_0xd67b('0x10')][_0xd67b('0x12')]);return _0x57f831(_0x452814[_0xd67b('0x10')]['message']);}logger['error'](_0xd67b('0xd'),_0x13f74b,_0x452814['error']['message']);return _0x220568(_0x452814['error'][_0xd67b('0x12')]);}else{logger[_0xd67b('0x13')](_0xd67b('0xd'),_0x13f74b,_0xd67b('0xf'));_0x220568(_0x452814[_0xd67b('0x14')]['message']);}})[_0xd67b('0x15')](function(_0x4832a1){logger['error'](_0xd67b('0xd'),_0x13f74b,_0x4832a1);_0x57f831(_0x4832a1);});});} \ No newline at end of file +var _0xdf22=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x593310,_0x17b9e9){var _0x1ea007=function(_0x4eaceb){while(--_0x4eaceb){_0x593310['push'](_0x593310['shift']());}};_0x1ea007(++_0x17b9e9);}(_0xdf22,0xa6));var _0x2df2=function(_0x4488f3,_0x68ba40){_0x4488f3=_0x4488f3-0x0;var _0x375c8d=_0xdf22[_0x4488f3];return _0x375c8d;};'use strict';var _=require(_0x2df2('0x0'));var util=require('util');var moment=require(_0x2df2('0x1'));var BPromise=require(_0x2df2('0x2'));var rs=require(_0x2df2('0x3'));var fs=require('fs');var Redis=require(_0x2df2('0x4'));var db=require(_0x2df2('0x5'))['db'];var utils=require(_0x2df2('0x6'));var logger=require(_0x2df2('0x7'))(_0x2df2('0x8'));var config=require(_0x2df2('0x9'));var jayson=require(_0x2df2('0xa'));var client=jayson[_0x2df2('0xb')][_0x2df2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x239253,_0x22fae8,_0x17e668){return new BPromise(function(_0x178299,_0x3ce53c){return client[_0x2df2('0xd')](_0x239253,_0x17e668)[_0x2df2('0xe')](function(_0x5b663c){logger['info'](_0x2df2('0xf'),_0x22fae8,_0x2df2('0x10'));logger[_0x2df2('0x11')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x22fae8,_0x2df2('0x10'),JSON['stringify'](_0x5b663c));if(_0x5b663c[_0x2df2('0x12')]){if(_0x5b663c['error'][_0x2df2('0x13')]===0x1f4){logger[_0x2df2('0x12')](_0x2df2('0xf'),_0x22fae8,_0x5b663c[_0x2df2('0x12')][_0x2df2('0x14')]);return _0x3ce53c(_0x5b663c[_0x2df2('0x12')][_0x2df2('0x14')]);}logger[_0x2df2('0x12')](_0x2df2('0xf'),_0x22fae8,_0x5b663c[_0x2df2('0x12')][_0x2df2('0x14')]);return _0x178299(_0x5b663c[_0x2df2('0x12')]['message']);}else{logger['info'](_0x2df2('0xf'),_0x22fae8,'request\x20sent');_0x178299(_0x5b663c[_0x2df2('0x15')][_0x2df2('0x14')]);}})[_0x2df2('0x16')](function(_0x441dfe){logger[_0x2df2('0x12')](_0x2df2('0xf'),_0x22fae8,_0x441dfe);_0x3ce53c(_0x441dfe);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 3c92e84..d591019 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 _0x7a2c=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','show','post','create','/:id','update','destroy'];(function(_0x301f0f,_0xdd2d29){var _0x3f3f0e=function(_0x23e57f){while(--_0x23e57f){_0x301f0f['push'](_0x301f0f['shift']());}};_0x3f3f0e(++_0xdd2d29);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x46ed45,_0x44e17d){_0x46ed45=_0x46ed45-0x0;var _0xbcf8df=_0x7a2c[_0x46ed45];return _0xbcf8df;};'use strict';var multer=require(_0xc7a2('0x0'));var util=require('util');var path=require(_0xc7a2('0x1'));var timeout=require(_0xc7a2('0x2'));var express=require(_0xc7a2('0x3'));var router=express[_0xc7a2('0x4')]();var auth=require(_0xc7a2('0x5'));var interaction=require(_0xc7a2('0x6'));var config=require(_0xc7a2('0x7'));var controller=require(_0xc7a2('0x8'));router['get']('/',auth[_0xc7a2('0x9')](),controller[_0xc7a2('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc7a2('0xb')]);router[_0xc7a2('0xc')]('/',auth[_0xc7a2('0x9')](),controller[_0xc7a2('0xd')]);router['put'](_0xc7a2('0xe'),auth[_0xc7a2('0x9')](),controller[_0xc7a2('0xf')]);router['delete'](_0xc7a2('0xe'),auth['isAuthenticated'](),controller[_0xc7a2('0x10')]);module[_0xc7a2('0x11')]=router; \ No newline at end of file +var _0xd691=['delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','create','put','/:id','update'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0xd691,0xe6));var _0x1d69=function(_0x38ae35,_0x16c078){_0x38ae35=_0x38ae35-0x0;var _0x4b3e8f=_0xd691[_0x38ae35];return _0x4b3e8f;};'use strict';var multer=require(_0x1d69('0x0'));var util=require(_0x1d69('0x1'));var path=require(_0x1d69('0x2'));var timeout=require('connect-timeout');var express=require(_0x1d69('0x3'));var router=express[_0x1d69('0x4')]();var auth=require(_0x1d69('0x5'));var interaction=require(_0x1d69('0x6'));var config=require(_0x1d69('0x7'));var controller=require(_0x1d69('0x8'));router[_0x1d69('0x9')]('/',auth[_0x1d69('0xa')](),controller[_0x1d69('0xb')]);router[_0x1d69('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1d69('0xc')]);router['post']('/',auth[_0x1d69('0xa')](),controller[_0x1d69('0xd')]);router[_0x1d69('0xe')](_0x1d69('0xf'),auth['isAuthenticated'](),controller[_0x1d69('0x10')]);router[_0x1d69('0x11')](_0x1d69('0xf'),auth[_0x1d69('0xa')](),controller[_0x1d69('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 2439af6..8d69f9d 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 _0x5341=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x456492,_0x41ea6f){var _0x36dbb3=function(_0x218d87){while(--_0x218d87){_0x456492['push'](_0x456492['shift']());}};_0x36dbb3(++_0x41ea6f);}(_0x5341,0xbb));var _0x1534=function(_0xf496c,_0x2bab4b){_0xf496c=_0xf496c-0x0;var _0x4ad9d0=_0x5341[_0xf496c];return _0x4ad9d0;};'use strict';var Sequelize=require(_0x1534('0x0'));module[_0x1534('0x1')]={'type':{'type':Sequelize[_0x1534('0x2')](_0x1534('0x3'),_0x1534('0x4'),_0x1534('0x5'),_0x1534('0x6')),'defaultValue':_0x1534('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1534('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x1534('0x3'),_0x1534('0x4'),_0x1534('0x5'))},'keyContent':{'type':Sequelize[_0x1534('0x7')]},'idField':{'type':Sequelize[_0x1534('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1534('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd2c2=['customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x150d3f,_0x443ee1){var _0xb44c2d=function(_0x5db644){while(--_0x5db644){_0x150d3f['push'](_0x150d3f['shift']());}};_0xb44c2d(++_0x443ee1);}(_0xd2c2,0x18c));var _0x2d2c=function(_0xb006e3,_0x46418d){_0xb006e3=_0xb006e3-0x0;var _0x302019=_0xd2c2[_0xb006e3];return _0x302019;};'use strict';var Sequelize=require(_0x2d2c('0x0'));module['exports']={'type':{'type':Sequelize[_0x2d2c('0x1')](_0x2d2c('0x2'),_0x2d2c('0x3'),_0x2d2c('0x4'),_0x2d2c('0x5')),'defaultValue':_0x2d2c('0x2')},'content':{'type':Sequelize[_0x2d2c('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x2d2c('0x2'),_0x2d2c('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x2d2c('0x6')]},'idField':{'type':Sequelize[_0x2d2c('0x6')]},'nameField':{'type':Sequelize[_0x2d2c('0x6')]},'customField':{'type':Sequelize[_0x2d2c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2d2c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 38b8f53..33ed8ec 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 _0xdb28=['update','destroy','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','options','includeAll','include','findAll','rows','catch','show','params','filtears','find','create','body','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','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','apply','save'];(function(_0x140c16,_0x2d4d27){var _0x395698=function(_0x4e62bc){while(--_0x4e62bc){_0x140c16['push'](_0x140c16['shift']());}};_0x395698(++_0x2d4d27);}(_0xdb28,0x106));var _0x8db2=function(_0x2088cd,_0x28e09a){_0x2088cd=_0x2088cd-0x0;var _0x1f58c2=_0xdb28[_0x2088cd];return _0x1f58c2;};'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 licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=_0x16c8c2[_0x8db2('0x1c')],_0x13b0f5=_0x131252[_0x8db2('0x1d')],_0x24da1b=_0x131252[_0x8db2('0x1d')]+_0x131252[_0x8db2('0x1e')],_0x48101e;if(_0x24da1b>=_0x5489a9){_0x24da1b=_0x5489a9;_0x48101e=0xc8;}else{_0x48101e=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x48101e);return _0x3c96a7[_0x8db2('0x1f')]('Content-Range',_0x13b0f5+'-'+_0x24da1b+'/'+_0x5489a9)['json'](_0x16c8c2);}return null;};}function patchUpdates(_0x77789){return function(_0x104e33){try{jsonpatch[_0x8db2('0x20')](_0x104e33,_0x77789,!![]);}catch(_0x1b64e4){return BPromise['reject'](_0x1b64e4);}return _0x104e33[_0x8db2('0x21')]();};}function saveUpdates(_0x36a9ff,_0x260940){return function(_0x297ba3){if(_0x297ba3){return _0x297ba3[_0x8db2('0x22')](_0x36a9ff)['then'](function(_0x124467){return _0x124467;});}return null;};}function removeEntity(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')]()[_0x8db2('0x24')](function(){_0x3e30e6[_0x8db2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x256202,_0x4f6516){return function(_0x5725f0){if(!_0x5725f0){_0x256202['sendStatus'](0x194);}return _0x5725f0;};}function handleError(_0x4d923c,_0xec8cd2){_0xec8cd2=_0xec8cd2||0x1f4;return function(_0x29b5cd){logger[_0x8db2('0x25')](_0x29b5cd[_0x8db2('0x26')]);if(_0x29b5cd[_0x8db2('0x27')]){delete _0x29b5cd[_0x8db2('0x27')];}_0x4d923c['status'](_0xec8cd2)[_0x8db2('0x28')](_0x29b5cd);};}exports[_0x8db2('0x29')]=function(_0x430dd5,_0x8b7cec){var _0x483aee={},_0x2e0691={},_0x11f398={'count':0x0,'rows':[]};var _0x241baf=_[_0x8db2('0x2a')](db[_0x8db2('0x2b')][_0x8db2('0x2c')],function(_0xa54ea3){return{'name':_0xa54ea3[_0x8db2('0x2d')],'type':_0xa54ea3[_0x8db2('0x2e')]['key']};});_0x2e0691[_0x8db2('0x2f')]=_['map'](_0x241baf,'name');_0x2e0691[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x430dd5[_0x8db2('0x30')]);_0x2e0691['filters']=_[_0x8db2('0x32')](_0x2e0691['model'],_0x2e0691[_0x8db2('0x30')]);_0x483aee[_0x8db2('0x33')]=_[_0x8db2('0x32')](_0x2e0691['model'],qs['fields'](_0x430dd5[_0x8db2('0x30')][_0x8db2('0x34')]));_0x483aee['attributes']=_0x483aee['attributes'][_0x8db2('0x35')]?_0x483aee[_0x8db2('0x33')]:_0x2e0691[_0x8db2('0x2f')];if(!_0x430dd5[_0x8db2('0x30')][_0x8db2('0x36')](_0x8db2('0x37'))){_0x483aee[_0x8db2('0x1e')]=qs[_0x8db2('0x1e')](_0x430dd5[_0x8db2('0x30')][_0x8db2('0x1e')]);_0x483aee['offset']=qs[_0x8db2('0x1d')](_0x430dd5[_0x8db2('0x30')]['offset']);}_0x483aee[_0x8db2('0x38')]=qs[_0x8db2('0x39')](_0x430dd5['query']['sort']);_0x483aee[_0x8db2('0x3a')]=qs['filters'](_[_0x8db2('0x3b')](_0x430dd5[_0x8db2('0x30')],_0x2e0691[_0x8db2('0x3c')]),_0x241baf);if(_0x430dd5[_0x8db2('0x30')]['filter']){_0x483aee[_0x8db2('0x3a')]=_['merge'](_0x483aee[_0x8db2('0x3a')],{'$or':_[_0x8db2('0x2a')](_0x241baf,function(_0x2c8bc9){if(_0x2c8bc9[_0x8db2('0x2e')]!=='VIRTUAL'){var _0x50ee17={};_0x50ee17[_0x2c8bc9[_0x8db2('0x27')]]={'$like':'%'+_0x430dd5[_0x8db2('0x30')]['filter']+'%'};return _0x50ee17;}})});}_0x483aee=_[_0x8db2('0x3d')]({},_0x483aee,_0x430dd5[_0x8db2('0x3e')]);var _0x656dd2={'where':_0x483aee['where']};return db[_0x8db2('0x2b')][_0x8db2('0x1c')](_0x656dd2)[_0x8db2('0x24')](function(_0x279e74){_0x11f398[_0x8db2('0x1c')]=_0x279e74;if(_0x430dd5[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x483aee[_0x8db2('0x40')]=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x41')](_0x483aee);})[_0x8db2('0x24')](function(_0x20bf0b){_0x11f398[_0x8db2('0x42')]=_0x20bf0b;return _0x11f398;})['then'](respondWithFilteredResult(_0x8b7cec,_0x483aee))[_0x8db2('0x43')](handleError(_0x8b7cec,null));};exports[_0x8db2('0x44')]=function(_0x5e0382,_0x49a7ae){var _0x249c73={'raw':!![],'where':{'id':_0x5e0382[_0x8db2('0x45')]['id']}},_0x4f1a49={};_0x4f1a49[_0x8db2('0x2f')]=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x2c')]);_0x4f1a49[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x5e0382['query']);_0x4f1a49[_0x8db2('0x46')]=_[_0x8db2('0x32')](_0x4f1a49[_0x8db2('0x2f')],_0x4f1a49[_0x8db2('0x30')]);_0x249c73['attributes']=_[_0x8db2('0x32')](_0x4f1a49[_0x8db2('0x2f')],qs[_0x8db2('0x34')](_0x5e0382[_0x8db2('0x30')]['fields']));_0x249c73[_0x8db2('0x33')]=_0x249c73['attributes'][_0x8db2('0x35')]?_0x249c73[_0x8db2('0x33')]:_0x4f1a49[_0x8db2('0x2f')];if(_0x5e0382['query']['includeAll']){_0x249c73[_0x8db2('0x40')]=[{'all':!![]}];}_0x249c73=_['merge']({},_0x249c73,_0x5e0382[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x47')](_0x249c73)[_0x8db2('0x24')](handleEntityNotFound(_0x49a7ae,null))[_0x8db2('0x24')](respondWithResult(_0x49a7ae,null))[_0x8db2('0x43')](handleError(_0x49a7ae,null));};exports[_0x8db2('0x48')]=function(_0xab6bdd,_0x4291e3){return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xab6bdd[_0x8db2('0x49')],{})['then'](respondWithResult(_0x4291e3,0xc9))[_0x8db2('0x43')](handleError(_0x4291e3,null));};exports[_0x8db2('0x22')]=function(_0xdbba64,_0x3244db){if(_0xdbba64['body']['id']){delete _0xdbba64['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x47')]({'where':{'id':_0xdbba64[_0x8db2('0x45')]['id']}})['then'](handleEntityNotFound(_0x3244db,null))['then'](saveUpdates(_0xdbba64['body'],null))[_0x8db2('0x24')](respondWithResult(_0x3244db,null))[_0x8db2('0x43')](handleError(_0x3244db,null));};exports[_0x8db2('0x23')]=function(_0x383fa1,_0xaab731){return db[_0x8db2('0x2b')][_0x8db2('0x47')]({'where':{'id':_0x383fa1['params']['id']}})['then'](handleEntityNotFound(_0xaab731,null))[_0x8db2('0x24')](removeEntity(_0xaab731,null))[_0x8db2('0x43')](handleError(_0xaab731,null));}; \ No newline at end of file +var _0x1261=['reject','save','then','destroy','error','stack','name','send','index','map','Dynamics365Field','type','model','filters','intersection','attributes','fields','query','hasOwnProperty','limit','order','sort','where','merge','VIRTUAL','filter','options','count','include','findAll','catch','show','keys','filtears','length','includeAll','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range'];(function(_0x2309ef,_0x1cdf21){var _0x53df85=function(_0x4c551b){while(--_0x4c551b){_0x2309ef['push'](_0x2309ef['shift']());}};_0x53df85(++_0x1cdf21);}(_0x1261,0x144));var _0x1126=function(_0x1e744a,_0xa8fdb1){_0x1e744a=_0x1e744a-0x0;var _0x1ac4d0=_0x1261[_0x1e744a];return _0x1ac4d0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=_0x45149c['count'],_0x35fe9f=_0x4be0c6[_0x1126('0x1c')],_0x42f379=_0x4be0c6[_0x1126('0x1c')]+_0x4be0c6['limit'],_0x257b5f;if(_0x42f379>=_0x4794a7){_0x42f379=_0x4794a7;_0x257b5f=0xc8;}else{_0x257b5f=0xce;}_0x279455['status'](_0x257b5f);return _0x279455[_0x1126('0x1d')](_0x1126('0x1e'),_0x35fe9f+'-'+_0x42f379+'/'+_0x4794a7)['json'](_0x45149c);}return null;};}function patchUpdates(_0x548359){return function(_0x4564c0){try{jsonpatch['apply'](_0x4564c0,_0x548359,!![]);}catch(_0x22ed37){return BPromise[_0x1126('0x1f')](_0x22ed37);}return _0x4564c0[_0x1126('0x20')]();};}function saveUpdates(_0x54400a,_0x2a08ba){return function(_0x49d209){if(_0x49d209){return _0x49d209['update'](_0x54400a)[_0x1126('0x21')](function(_0x3a9bed){return _0x3a9bed;});}return null;};}function removeEntity(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x22')]()[_0x1126('0x21')](function(){_0x25b24b['status'](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x59cd8e,_0x529dd9){return function(_0x4b57ab){if(!_0x4b57ab){_0x59cd8e[_0x1126('0x18')](0x194);}return _0x4b57ab;};}function handleError(_0x15bcc3,_0x329914){_0x329914=_0x329914||0x1f4;return function(_0x34bcf1){logger[_0x1126('0x23')](_0x34bcf1[_0x1126('0x24')]);if(_0x34bcf1[_0x1126('0x25')]){delete _0x34bcf1[_0x1126('0x25')];}_0x15bcc3['status'](_0x329914)[_0x1126('0x26')](_0x34bcf1);};}exports[_0x1126('0x27')]=function(_0xa293f4,_0x5ddf63){var _0x541bc9={},_0xeb7d89={},_0x39bf0e={'count':0x0,'rows':[]};var _0x55e195=_[_0x1126('0x28')](db[_0x1126('0x29')]['rawAttributes'],function(_0x3fa694){return{'name':_0x3fa694['fieldName'],'type':_0x3fa694[_0x1126('0x2a')]['key']};});_0xeb7d89[_0x1126('0x2b')]=_['map'](_0x55e195,_0x1126('0x25'));_0xeb7d89['query']=_['keys'](_0xa293f4['query']);_0xeb7d89[_0x1126('0x2c')]=_[_0x1126('0x2d')](_0xeb7d89[_0x1126('0x2b')],_0xeb7d89['query']);_0x541bc9[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0xeb7d89['model'],qs[_0x1126('0x2f')](_0xa293f4[_0x1126('0x30')][_0x1126('0x2f')]));_0x541bc9[_0x1126('0x2e')]=_0x541bc9['attributes']['length']?_0x541bc9[_0x1126('0x2e')]:_0xeb7d89[_0x1126('0x2b')];if(!_0xa293f4[_0x1126('0x30')][_0x1126('0x31')]('nolimit')){_0x541bc9[_0x1126('0x32')]=qs[_0x1126('0x32')](_0xa293f4[_0x1126('0x30')][_0x1126('0x32')]);_0x541bc9[_0x1126('0x1c')]=qs['offset'](_0xa293f4[_0x1126('0x30')][_0x1126('0x1c')]);}_0x541bc9[_0x1126('0x33')]=qs[_0x1126('0x34')](_0xa293f4['query']['sort']);_0x541bc9[_0x1126('0x35')]=qs[_0x1126('0x2c')](_['pick'](_0xa293f4[_0x1126('0x30')],_0xeb7d89[_0x1126('0x2c')]),_0x55e195);if(_0xa293f4[_0x1126('0x30')]['filter']){_0x541bc9['where']=_[_0x1126('0x36')](_0x541bc9[_0x1126('0x35')],{'$or':_[_0x1126('0x28')](_0x55e195,function(_0x156554){if(_0x156554['type']!==_0x1126('0x37')){var _0x4965d0={};_0x4965d0[_0x156554[_0x1126('0x25')]]={'$like':'%'+_0xa293f4[_0x1126('0x30')][_0x1126('0x38')]+'%'};return _0x4965d0;}})});}_0x541bc9=_[_0x1126('0x36')]({},_0x541bc9,_0xa293f4[_0x1126('0x39')]);var _0x5746f6={'where':_0x541bc9[_0x1126('0x35')]};return db[_0x1126('0x29')][_0x1126('0x3a')](_0x5746f6)[_0x1126('0x21')](function(_0x3469a2){_0x39bf0e[_0x1126('0x3a')]=_0x3469a2;if(_0xa293f4[_0x1126('0x30')]['includeAll']){_0x541bc9[_0x1126('0x3b')]=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3c')](_0x541bc9);})[_0x1126('0x21')](function(_0xcf0483){_0x39bf0e['rows']=_0xcf0483;return _0x39bf0e;})['then'](respondWithFilteredResult(_0x5ddf63,_0x541bc9))[_0x1126('0x3d')](handleError(_0x5ddf63,null));};exports[_0x1126('0x3e')]=function(_0xcee9de,_0x21c38e){var _0x18b496={'raw':!![],'where':{'id':_0xcee9de['params']['id']}},_0x276fd5={};_0x276fd5['model']=_['keys'](db[_0x1126('0x29')]['rawAttributes']);_0x276fd5[_0x1126('0x30')]=_[_0x1126('0x3f')](_0xcee9de[_0x1126('0x30')]);_0x276fd5[_0x1126('0x40')]=_['intersection'](_0x276fd5['model'],_0x276fd5[_0x1126('0x30')]);_0x18b496[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x276fd5['model'],qs[_0x1126('0x2f')](_0xcee9de['query'][_0x1126('0x2f')]));_0x18b496['attributes']=_0x18b496[_0x1126('0x2e')][_0x1126('0x41')]?_0x18b496[_0x1126('0x2e')]:_0x276fd5['model'];if(_0xcee9de[_0x1126('0x30')][_0x1126('0x42')]){_0x18b496[_0x1126('0x3b')]=[{'all':!![]}];}_0x18b496=_['merge']({},_0x18b496,_0xcee9de['options']);return db['Dynamics365Field'][_0x1126('0x43')](_0x18b496)['then'](handleEntityNotFound(_0x21c38e,null))[_0x1126('0x21')](respondWithResult(_0x21c38e,null))['catch'](handleError(_0x21c38e,null));};exports[_0x1126('0x44')]=function(_0x323499,_0x146066){return db[_0x1126('0x29')][_0x1126('0x44')](_0x323499['body'],{})[_0x1126('0x21')](respondWithResult(_0x146066,0xc9))[_0x1126('0x3d')](handleError(_0x146066,null));};exports['update']=function(_0x1a15f8,_0x13dc39){if(_0x1a15f8['body']['id']){delete _0x1a15f8[_0x1126('0x45')]['id'];}return db[_0x1126('0x29')]['find']({'where':{'id':_0x1a15f8[_0x1126('0x46')]['id']}})[_0x1126('0x21')](handleEntityNotFound(_0x13dc39,null))[_0x1126('0x21')](saveUpdates(_0x1a15f8['body'],null))[_0x1126('0x21')](respondWithResult(_0x13dc39,null))[_0x1126('0x3d')](handleError(_0x13dc39,null));};exports[_0x1126('0x22')]=function(_0x5878bb,_0x224456){return db[_0x1126('0x29')][_0x1126('0x43')]({'where':{'id':_0x5878bb[_0x1126('0x46')]['id']}})['then'](handleEntityNotFound(_0x224456,null))[_0x1126('0x21')](removeEntity(_0x224456,null))['catch'](handleError(_0x224456,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index f80ace3..a2c7869 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 _0x8eaa=['FieldId','lodash','util','api','moment','bluebird','path','rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index'];(function(_0x1544e4,_0x255c32){var _0x123a58=function(_0x1f63e8){while(--_0x1f63e8){_0x1544e4['push'](_0x1544e4['shift']());}};_0x123a58(++_0x255c32);}(_0x8eaa,0xc5));var _0xa8ea=function(_0x35aecc,_0x12f383){_0x35aecc=_0x35aecc-0x0;var _0xa9df46=_0x8eaa[_0x35aecc];return _0xa9df46;};'use strict';var _=require(_0xa8ea('0x0'));var util=require(_0xa8ea('0x1'));var logger=require('../../config/logger')(_0xa8ea('0x2'));var moment=require(_0xa8ea('0x3'));var BPromise=require(_0xa8ea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa8ea('0x5'));var rimraf=require(_0xa8ea('0x6'));var config=require('../../config/environment');var attributes=require(_0xa8ea('0x7'));module[_0xa8ea('0x8')]=function(_0x52f555,_0x3d70d7){return _0x52f555[_0xa8ea('0x9')](_0xa8ea('0xa'),attributes,{'tableName':_0xa8ea('0xb'),'paranoid':![],'indexes':[{'name':_0xa8ea('0xc'),'fields':['idField',_0xa8ea('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9aff=['../../config/environment','exports','define','Dynamics365Field','dynamics365_unique_index','idField','api','moment','bluebird','request-promise','rimraf'];(function(_0x3a92c5,_0x41dfb2){var _0x498572=function(_0x51038d){while(--_0x51038d){_0x3a92c5['push'](_0x3a92c5['shift']());}};_0x498572(++_0x41dfb2);}(_0x9aff,0x192));var _0xf9af=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x9aff[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf9af('0x0'));var moment=require(_0xf9af('0x1'));var BPromise=require(_0xf9af('0x2'));var rp=require(_0xf9af('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf9af('0x4'));var config=require(_0xf9af('0x5'));var attributes=require('./intDynamics365Field.attributes');module[_0xf9af('0x6')]=function(_0x39e30e,_0x4057c2){return _0x39e30e[_0xf9af('0x7')](_0xf9af('0x8'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xf9af('0x9'),'fields':[_0xf9af('0xa'),'FieldId'],'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 be68e8b..29ec25f 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 _0x4351=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x1f0848,_0x8f82f){var _0x114988=function(_0x2156bc){while(--_0x2156bc){_0x1f0848['push'](_0x1f0848['shift']());}};_0x114988(++_0x8f82f);}(_0x4351,0x1b5));var _0x1435=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x4351[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x1435('0x0'));var util=require(_0x1435('0x1'));var moment=require(_0x1435('0x2'));var BPromise=require(_0x1435('0x3'));var rs=require(_0x1435('0x4'));var fs=require('fs');var Redis=require(_0x1435('0x5'));var db=require(_0x1435('0x6'))['db'];var utils=require(_0x1435('0x7'));var logger=require(_0x1435('0x8'))(_0x1435('0x9'));var config=require(_0x1435('0xa'));var jayson=require(_0x1435('0xb'));var client=jayson[_0x1435('0xc')][_0x1435('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x337fd6,_0x56ce86,_0x10760d){return new BPromise(function(_0x5de4b0,_0x4d04c7){return client[_0x1435('0xe')](_0x337fd6,_0x10760d)[_0x1435('0xf')](function(_0x14a9e1){logger[_0x1435('0x10')](_0x1435('0x11'),_0x56ce86,'request\x20sent');logger[_0x1435('0x12')](_0x1435('0x13'),_0x56ce86,'request\x20sent',JSON['stringify'](_0x14a9e1));if(_0x14a9e1[_0x1435('0x14')]){if(_0x14a9e1['error'][_0x1435('0x15')]===0x1f4){logger['error'](_0x1435('0x11'),_0x56ce86,_0x14a9e1['error']['message']);return _0x4d04c7(_0x14a9e1['error'][_0x1435('0x16')]);}logger[_0x1435('0x14')](_0x1435('0x11'),_0x56ce86,_0x14a9e1['error']['message']);return _0x5de4b0(_0x14a9e1[_0x1435('0x14')]['message']);}else{logger[_0x1435('0x10')](_0x1435('0x11'),_0x56ce86,_0x1435('0x17'));_0x5de4b0(_0x14a9e1[_0x1435('0x18')][_0x1435('0x16')]);}})[_0x1435('0x19')](function(_0x5ecd){logger[_0x1435('0x14')](_0x1435('0x11'),_0x56ce86,_0x5ecd);_0x4d04c7(_0x5ecd);});});} \ No newline at end of file +var _0x5334=['http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x583eea,_0x5e142b){var _0x5b25e5=function(_0x1a7a18){while(--_0x1a7a18){_0x583eea['push'](_0x583eea['shift']());}};_0x5b25e5(++_0x5e142b);}(_0x5334,0x84));var _0x4533=function(_0x469100,_0x537385){_0x469100=_0x469100-0x0;var _0x26efb8=_0x5334[_0x469100];return _0x26efb8;};'use strict';var _=require(_0x4533('0x0'));var util=require(_0x4533('0x1'));var moment=require(_0x4533('0x2'));var BPromise=require(_0x4533('0x3'));var rs=require(_0x4533('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4533('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4533('0x6'))(_0x4533('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4533('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4dea06,_0x4d89e7,_0x487906){return new BPromise(function(_0x3fbdc3,_0x42f94b){return client[_0x4533('0x9')](_0x4dea06,_0x487906)[_0x4533('0xa')](function(_0x31018b){logger[_0x4533('0xb')](_0x4533('0xc'),_0x4d89e7,'request\x20sent');logger[_0x4533('0xd')](_0x4533('0xe'),_0x4d89e7,_0x4533('0xf'),JSON[_0x4533('0x10')](_0x31018b));if(_0x31018b['error']){if(_0x31018b[_0x4533('0x11')]['code']===0x1f4){logger[_0x4533('0x11')](_0x4533('0xc'),_0x4d89e7,_0x31018b[_0x4533('0x11')][_0x4533('0x12')]);return _0x42f94b(_0x31018b['error'][_0x4533('0x12')]);}logger[_0x4533('0x11')](_0x4533('0xc'),_0x4d89e7,_0x31018b[_0x4533('0x11')]['message']);return _0x3fbdc3(_0x31018b[_0x4533('0x11')]['message']);}else{logger['info'](_0x4533('0xc'),_0x4d89e7,_0x4533('0xf'));_0x3fbdc3(_0x31018b['result'][_0x4533('0x12')]);}})[_0x4533('0x13')](function(_0x2a9877){logger['error'](_0x4533('0xc'),_0x4d89e7,_0x2a9877);_0x42f94b(_0x2a9877);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 3fcd1db..cd7e829 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 _0x6d38=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','delete','exports'];(function(_0x3c295d,_0x23862d){var _0x105b15=function(_0x891b89){while(--_0x891b89){_0x3c295d['push'](_0x3c295d['shift']());}};_0x105b15(++_0x23862d);}(_0x6d38,0xa0));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(_0x86d3('0x3'));var router=express['Router']();var auth=require(_0x86d3('0x4'));var interaction=require(_0x86d3('0x5'));var config=require('../../config/environment');var controller=require(_0x86d3('0x6'));router[_0x86d3('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x86d3('0x7')](_0x86d3('0x8'),auth[_0x86d3('0x9')](),controller[_0x86d3('0xa')]);router[_0x86d3('0x7')](_0x86d3('0xb'),auth['isAuthenticated'](),controller[_0x86d3('0xc')]);router['get'](_0x86d3('0xd'),auth[_0x86d3('0x9')](),controller[_0x86d3('0xe')]);router['post']('/',auth[_0x86d3('0x9')](),controller[_0x86d3('0xf')]);router['post'](_0x86d3('0xb'),auth[_0x86d3('0x9')](),controller[_0x86d3('0x10')]);router[_0x86d3('0x11')]('/:id',auth[_0x86d3('0x9')](),controller['update']);router[_0x86d3('0x12')](_0x86d3('0x8'),auth[_0x86d3('0x9')](),controller['destroy']);module[_0x86d3('0x13')]=router; \ No newline at end of file +var _0xe925=['post','/:id/configurations','put','update','delete','destroy','exports','connect-timeout','express','../../components/auth/service','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','getConfigurations','/:id/fields','create'];(function(_0x431fc5,_0x45baf6){var _0x10ff01=function(_0x42786e){while(--_0x42786e){_0x431fc5['push'](_0x431fc5['shift']());}};_0x10ff01(++_0x45baf6);}(_0xe925,0x127));var _0x5e92=function(_0x1bc690,_0x317afe){_0x1bc690=_0x1bc690-0x0;var _0xca76e=_0xe925[_0x1bc690];return _0xca76e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5e92('0x0'));var express=require(_0x5e92('0x1'));var router=express['Router']();var auth=require(_0x5e92('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5e92('0x3'));router[_0x5e92('0x4')]('/',auth['isAuthenticated'](),controller[_0x5e92('0x5')]);router['get'](_0x5e92('0x6'),auth[_0x5e92('0x7')](),controller['show']);router[_0x5e92('0x4')]('/:id/configurations',auth[_0x5e92('0x7')](),controller[_0x5e92('0x8')]);router[_0x5e92('0x4')](_0x5e92('0x9'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x5e92('0xa')]);router[_0x5e92('0xb')](_0x5e92('0xc'),auth[_0x5e92('0x7')](),controller['addConfiguration']);router[_0x5e92('0xd')](_0x5e92('0x6'),auth[_0x5e92('0x7')](),controller[_0x5e92('0xe')]);router[_0x5e92('0xf')](_0x5e92('0x6'),auth[_0x5e92('0x7')](),controller[_0x5e92('0x10')]);module[_0x5e92('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 60f1878..97ae9cd 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 _0x7753=['remoteUri','sequelize','exports','STRING'];(function(_0x2354d6,_0x404147){var _0x298268=function(_0x59c584){while(--_0x59c584){_0x2354d6['push'](_0x2354d6['shift']());}};_0x298268(++_0x404147);}(_0x7753,0xfd));var _0x3775=function(_0x2ff4bd,_0x4780a6){_0x2ff4bd=_0x2ff4bd-0x0;var _0x28edc6=_0x7753[_0x2ff4bd];return _0x28edc6;};'use strict';var Sequelize=require(_0x3775('0x0'));module[_0x3775('0x1')]={'name':{'type':Sequelize[_0x3775('0x2')]},'description':{'type':Sequelize[_0x3775('0x2')]},'username':{'type':Sequelize[_0x3775('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x3775('0x2')]},'remoteUri':{'type':Sequelize[_0x3775('0x2')],'unique':_0x3775('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa9fc=['exports','STRING','remoteUri','sequelize'];(function(_0xed2ddc,_0x445968){var _0x41d15a=function(_0x22c14d){while(--_0x22c14d){_0xed2ddc['push'](_0xed2ddc['shift']());}};_0x41d15a(++_0x445968);}(_0xa9fc,0x19f));var _0xca9f=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0xa9fc[_0x71e493];return _0x3d40ab;};'use strict';var Sequelize=require(_0xca9f('0x0'));module[_0xca9f('0x1')]={'name':{'type':Sequelize[_0xca9f('0x2')]},'description':{'type':Sequelize[_0xca9f('0x2')]},'username':{'type':Sequelize[_0xca9f('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xca9f('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xca9f('0x3')},'serverUrl':{'type':Sequelize[_0xca9f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 8b49e98..4d9cc38 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 _0x9957=['requester','subject','priority','group','source','ticket_type','remove','includes','default','custom_text','label','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','getFields','statusCode','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','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskAccount,\x20%s,\x20%s','result','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','stack','name','send','FreshdeskAccount','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','filtears','options','find','update','body','getConfigurations','findOne','FreshdeskConfiguration','order','filter','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64'];(function(_0x458e37,_0x5dec26){var _0x34bcb7=function(_0x51f1c0){while(--_0x51f1c0){_0x458e37['push'](_0x458e37['shift']());}};_0x34bcb7(++_0x5dec26);}(_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 licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];var integrations=require(_0x7995('0x1b'));var jayson=require(_0x7995('0x1c'));var client=jayson[_0x7995('0x1d')][_0x7995('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2bbe7a,_0x4cc004,_0x58f5ad,_0x2b4e94){return new BPromise(function(_0x2233dd,_0x24b5bb){var _0x321ae8=_0x2b4e94||client;return _0x321ae8[_0x7995('0x1f')](_0x2bbe7a,_0x58f5ad)[_0x7995('0x20')](function(_0x2202ce){logger[_0x7995('0x21')]('FreshdeskAccount,\x20%s,\x20%s',_0x4cc004,_0x7995('0x22'));logger['debug'](_0x7995('0x23'),_0x4cc004,_0x7995('0x22'),JSON[_0x7995('0x24')](_0x2202ce));if(_0x2202ce[_0x7995('0x25')]){if(_0x2202ce[_0x7995('0x25')][_0x7995('0x26')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x4cc004,_0x2202ce[_0x7995('0x25')]['message']);return _0x24b5bb(_0x2202ce['error'][_0x7995('0x27')]);}logger[_0x7995('0x25')]('FreshdeskAccount,\x20%s,\x20%s',_0x4cc004,_0x2202ce[_0x7995('0x25')]['message']);return _0x2233dd(_0x2202ce['error'][_0x7995('0x27')]);}else{logger[_0x7995('0x21')](_0x7995('0x28'),_0x4cc004,_0x7995('0x22'));_0x2233dd(_0x2202ce[_0x7995('0x29')][_0x7995('0x27')]);}})['catch'](function(_0x32a09a){logger[_0x7995('0x25')](_0x7995('0x28'),_0x4cc004,_0x32a09a);_0x24b5bb(_0x32a09a);});});}function respondWithStatusCode(_0x285437,_0x563799){_0x563799=_0x563799||0xcc;return function(_0x13bc35){if(_0x13bc35){return _0x285437[_0x7995('0x2a')](_0x563799);}return _0x285437[_0x7995('0x2b')](_0x563799)['end']();};}function respondWithResult(_0x39df42,_0x34e70c){_0x34e70c=_0x34e70c||0xc8;return function(_0x401dc3){if(_0x401dc3){return _0x39df42[_0x7995('0x2b')](_0x34e70c)[_0x7995('0x2c')](_0x401dc3);}};}function respondWithFilteredResult(_0x2a307e,_0x56691a){return function(_0x47625f){if(_0x47625f){var _0x5911c3=_0x47625f[_0x7995('0x2d')],_0x229742=_0x56691a[_0x7995('0x2e')],_0x49bc7e=_0x56691a['offset']+_0x56691a[_0x7995('0x2f')],_0xf16cc2;if(_0x49bc7e>=_0x5911c3){_0x49bc7e=_0x5911c3;_0xf16cc2=0xc8;}else{_0xf16cc2=0xce;}_0x2a307e['status'](_0xf16cc2);return _0x2a307e[_0x7995('0x30')](_0x7995('0x31'),_0x229742+'-'+_0x49bc7e+'/'+_0x5911c3)[_0x7995('0x2c')](_0x47625f);}return null;};}function patchUpdates(_0x574574){return function(_0x530611){try{jsonpatch['apply'](_0x530611,_0x574574,!![]);}catch(_0x3573be){return BPromise[_0x7995('0x32')](_0x3573be);}return _0x530611[_0x7995('0x33')]();};}function saveUpdates(_0x2b874d,_0x2e3493){return function(_0x1ca460){if(_0x1ca460){return _0x1ca460['update'](_0x2b874d)['then'](function(_0xfa8f15){return _0xfa8f15;});}return null;};}function removeEntity(_0x5524af,_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x34')]()[_0x7995('0x20')](function(){_0x5524af[_0x7995('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44309d,_0x33e24e){return function(_0x5dd802){if(!_0x5dd802){_0x44309d['sendStatus'](0x194);}return _0x5dd802;};}function handleError(_0x577412,_0x45bc5e){_0x45bc5e=_0x45bc5e||0x1f4;return function(_0x3acfc3){logger['error'](_0x3acfc3[_0x7995('0x35')]);if(_0x3acfc3['name']){delete _0x3acfc3[_0x7995('0x36')];}_0x577412[_0x7995('0x2b')](_0x45bc5e)[_0x7995('0x37')](_0x3acfc3);};}exports['index']=function(_0x52d76d,_0x36d057){var _0x5e67fe={},_0x5d2428={},_0x3e99cd={'count':0x0,'rows':[]};var _0xe328b1=_['map'](db[_0x7995('0x38')][_0x7995('0x39')],function(_0x2b772f){return{'name':_0x2b772f[_0x7995('0x3a')],'type':_0x2b772f[_0x7995('0x3b')]['key']};});_0x5d2428[_0x7995('0x3c')]=_[_0x7995('0x3d')](_0xe328b1,_0x7995('0x36'));_0x5d2428[_0x7995('0x3e')]=_['keys'](_0x52d76d[_0x7995('0x3e')]);_0x5d2428[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x5d2428[_0x7995('0x3c')],_0x5d2428[_0x7995('0x3e')]);_0x5e67fe[_0x7995('0x41')]=_['intersection'](_0x5d2428[_0x7995('0x3c')],qs[_0x7995('0x42')](_0x52d76d[_0x7995('0x3e')][_0x7995('0x42')]));_0x5e67fe[_0x7995('0x41')]=_0x5e67fe[_0x7995('0x41')][_0x7995('0x43')]?_0x5e67fe[_0x7995('0x41')]:_0x5d2428[_0x7995('0x3c')];if(!_0x52d76d[_0x7995('0x3e')][_0x7995('0x44')](_0x7995('0x45'))){_0x5e67fe[_0x7995('0x2f')]=qs['limit'](_0x52d76d['query'][_0x7995('0x2f')]);_0x5e67fe[_0x7995('0x2e')]=qs['offset'](_0x52d76d['query'][_0x7995('0x2e')]);}_0x5e67fe['order']=qs['sort'](_0x52d76d[_0x7995('0x3e')][_0x7995('0x46')]);_0x5e67fe[_0x7995('0x47')]=qs['filters'](_[_0x7995('0x48')](_0x52d76d['query'],_0x5d2428[_0x7995('0x3f')]),_0xe328b1);if(_0x52d76d['query']['filter']){_0x5e67fe[_0x7995('0x47')]=_[_0x7995('0x49')](_0x5e67fe[_0x7995('0x47')],{'$or':_[_0x7995('0x3d')](_0xe328b1,function(_0x599ecb){if(_0x599ecb[_0x7995('0x3b')]!==_0x7995('0x4a')){var _0x31b347={};_0x31b347[_0x599ecb[_0x7995('0x36')]]={'$like':'%'+_0x52d76d['query']['filter']+'%'};return _0x31b347;}})});}_0x5e67fe=_[_0x7995('0x49')]({},_0x5e67fe,_0x52d76d['options']);var _0x23c41d={'where':_0x5e67fe['where']};return db[_0x7995('0x38')]['count'](_0x23c41d)[_0x7995('0x20')](function(_0x1b0373){_0x3e99cd['count']=_0x1b0373;if(_0x52d76d[_0x7995('0x3e')][_0x7995('0x4b')]){_0x5e67fe[_0x7995('0x4c')]=[{'all':!![]}];}return db[_0x7995('0x38')]['findAll'](_0x5e67fe);})[_0x7995('0x20')](function(_0x3e787d){_0x3e99cd[_0x7995('0x4d')]=_0x3e787d;return _0x3e99cd;})['then'](respondWithFilteredResult(_0x36d057,_0x5e67fe))[_0x7995('0x4e')](handleError(_0x36d057,null));};exports[_0x7995('0x4f')]=function(_0x511567,_0x3d8ae3){var _0x255313={'raw':![],'where':{'id':_0x511567[_0x7995('0x50')]['id']}},_0x51934b={};_0x51934b[_0x7995('0x3c')]=_['keys'](db[_0x7995('0x38')]['rawAttributes']);_0x51934b[_0x7995('0x3e')]=_[_0x7995('0x51')](_0x511567[_0x7995('0x3e')]);_0x51934b[_0x7995('0x52')]=_[_0x7995('0x40')](_0x51934b[_0x7995('0x3c')],_0x51934b[_0x7995('0x3e')]);_0x255313['attributes']=_[_0x7995('0x40')](_0x51934b[_0x7995('0x3c')],qs[_0x7995('0x42')](_0x511567['query'][_0x7995('0x42')]));_0x255313[_0x7995('0x41')]=_0x255313[_0x7995('0x41')]['length']?_0x255313['attributes']:_0x51934b['model'];if(_0x511567[_0x7995('0x3e')][_0x7995('0x4b')]){_0x255313['include']=[{'all':!![]}];}_0x255313=_[_0x7995('0x49')]({},_0x255313,_0x511567[_0x7995('0x53')]);return db[_0x7995('0x38')][_0x7995('0x54')](_0x255313)[_0x7995('0x20')](handleEntityNotFound(_0x3d8ae3,null))['then'](respondWithResult(_0x3d8ae3,null))[_0x7995('0x4e')](handleError(_0x3d8ae3,null));};exports['create']=function(_0x14fe7f,_0x33c801){return db[_0x7995('0x38')]['create'](_0x14fe7f['body'],{})['then'](respondWithResult(_0x33c801,0xc9))['catch'](handleError(_0x33c801,null));};exports[_0x7995('0x55')]=function(_0x3709de,_0x1a861c){if(_0x3709de[_0x7995('0x56')]['id']){delete _0x3709de[_0x7995('0x56')]['id'];}return db[_0x7995('0x38')][_0x7995('0x54')]({'where':{'id':_0x3709de[_0x7995('0x50')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x1a861c,null))[_0x7995('0x20')](saveUpdates(_0x3709de[_0x7995('0x56')],null))[_0x7995('0x20')](respondWithResult(_0x1a861c,null))[_0x7995('0x4e')](handleError(_0x1a861c,null));};exports[_0x7995('0x34')]=function(_0x1ea1dc,_0x416133){return db[_0x7995('0x38')][_0x7995('0x54')]({'where':{'id':_0x1ea1dc[_0x7995('0x50')]['id']}})['then'](handleEntityNotFound(_0x416133,null))[_0x7995('0x20')](removeEntity(_0x416133,null))[_0x7995('0x4e')](handleError(_0x416133,null));};exports[_0x7995('0x57')]=function(_0x32c0d3,_0x5d160d,_0x53125a){var _0x402fa0={};var _0x197b52={};var _0x5b9467;var _0x332a85;return db['FreshdeskAccount'][_0x7995('0x58')]({'where':{'id':_0x32c0d3[_0x7995('0x50')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x5d160d,null))[_0x7995('0x20')](function(_0x502d43){if(_0x502d43){_0x5b9467=_0x502d43;_0x197b52['model']=_[_0x7995('0x51')](db[_0x7995('0x59')][_0x7995('0x39')]);_0x197b52[_0x7995('0x3e')]=_[_0x7995('0x51')](_0x32c0d3[_0x7995('0x3e')]);_0x197b52[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x197b52[_0x7995('0x3c')],_0x197b52['query']);_0x402fa0[_0x7995('0x41')]=_[_0x7995('0x40')](_0x197b52[_0x7995('0x3c')],qs[_0x7995('0x42')](_0x32c0d3['query']['fields']));_0x402fa0[_0x7995('0x41')]=_0x402fa0[_0x7995('0x41')]['length']?_0x402fa0[_0x7995('0x41')]:_0x197b52[_0x7995('0x3c')];_0x402fa0[_0x7995('0x5a')]=qs[_0x7995('0x46')](_0x32c0d3[_0x7995('0x3e')]['sort']);_0x402fa0[_0x7995('0x47')]=qs['filters'](_[_0x7995('0x48')](_0x32c0d3[_0x7995('0x3e')],_0x197b52[_0x7995('0x3f')]));if(_0x32c0d3[_0x7995('0x3e')][_0x7995('0x5b')]){_0x402fa0[_0x7995('0x47')]=_[_0x7995('0x49')](_0x402fa0[_0x7995('0x47')],{'$or':_[_0x7995('0x3d')](_0x402fa0[_0x7995('0x41')],function(_0x2618c4){var _0x234d8d={};_0x234d8d[_0x2618c4]={'$like':'%'+_0x32c0d3['query'][_0x7995('0x5b')]+'%'};return _0x234d8d;})});}_0x402fa0=_[_0x7995('0x49')]({},_0x402fa0,_0x32c0d3[_0x7995('0x53')]);return _0x5b9467[_0x7995('0x57')](_0x402fa0);}})[_0x7995('0x20')](function(_0x54a2e0){if(_0x54a2e0){_0x332a85=_0x54a2e0['length'];if(!_0x32c0d3[_0x7995('0x3e')][_0x7995('0x44')](_0x7995('0x45'))){_0x402fa0[_0x7995('0x2f')]=qs['limit'](_0x32c0d3[_0x7995('0x3e')]['limit']);_0x402fa0['offset']=qs[_0x7995('0x2e')](_0x32c0d3[_0x7995('0x3e')][_0x7995('0x2e')]);}return _0x5b9467[_0x7995('0x57')](_0x402fa0);}})[_0x7995('0x20')](function(_0x25d9a4){if(_0x25d9a4){return _0x25d9a4?{'count':_0x332a85,'rows':_0x25d9a4}:null;}})[_0x7995('0x20')](respondWithResult(_0x5d160d,null))[_0x7995('0x4e')](handleError(_0x5d160d,null));};exports[_0x7995('0x5c')]=function(_0x2466df,_0x560b0a,_0x2dc1f7){if(_0x2466df[_0x7995('0x56')]['id']){delete _0x2466df[_0x7995('0x56')]['id'];}return db['FreshdeskAccount'][_0x7995('0x58')]({'where':{'id':_0x2466df[_0x7995('0x50')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x560b0a,null))[_0x7995('0x20')](function(_0x3b0d30){if(_0x3b0d30){_0x2466df[_0x7995('0x56')][_0x7995('0x5d')]=_0x3b0d30['id'];_0x2466df[_0x7995('0x56')][_0x7995('0x5e')]=integrations[_0x7995('0x5f')](_0x2466df[_0x7995('0x56')]['channel'],_0x2466df['body'][_0x7995('0x3b')]);_0x2466df[_0x7995('0x56')][_0x7995('0x60')]=integrations[_0x7995('0x61')](_0x2466df['body'][_0x7995('0x62')],_0x2466df[_0x7995('0x56')]['type']);return db['FreshdeskConfiguration'][_0x7995('0x63')](_0x2466df[_0x7995('0x56')],{'include':[{'model':db['FreshdeskField'],'as':_0x7995('0x5e')},{'model':db['FreshdeskField'],'as':_0x7995('0x60')}]});}return null;})[_0x7995('0x20')](respondWithResult(_0x560b0a,null))['catch'](handleError(_0x560b0a,null));};exports['getFields']=function(_0x1f01c0,_0x50c1a4,_0x31b9e6){var _0xa41fff='';return db[_0x7995('0x38')][_0x7995('0x58')]({'where':{'id':_0x1f01c0[_0x7995('0x50')]['id']},'attributes':['id',_0x7995('0x64'),_0x7995('0x65')]})[_0x7995('0x20')](handleEntityNotFound(_0x50c1a4,null))[_0x7995('0x20')](function(_0x117317){if(_0x117317){_0xa41fff=_0x117317[_0x7995('0x64')];var _0x16108c=_0xa41fff[_0x7995('0x66')](-0x1);if(_0x16108c==='/'){_0xa41fff=_0xa41fff[_0x7995('0x67')](0x0,_0xa41fff[_0x7995('0x68')](_0x16108c));}return rp({'method':_0x7995('0x69'),'uri':util[_0x7995('0x6a')](_0x7995('0x6b'),_0xa41fff,_0x7995('0x6c')),'headers':{'Authorization':util[_0x7995('0x6a')](_0x7995('0x6d'),new Buffer(util[_0x7995('0x6a')](_0x7995('0x6e'),_0x117317[_0x7995('0x65')]))[_0x7995('0x6f')](_0x7995('0x70')))},'json':!![]});}})[_0x7995('0x20')](function(_0x34724d){if(_0x34724d){var _0x59efff=[_0x7995('0x71'),_0x7995('0x72'),'agent','description',_0x7995('0x2b'),_0x7995('0x73'),_0x7995('0x74'),_0x7995('0x75'),_0x7995('0x76'),_0x7995('0x74'),'company'];_[_0x7995('0x77')](_0x34724d,function(_0xb68962){return _0x59efff[_0x7995('0x78')](_0xb68962[_0x7995('0x36')])||!_0xb68962[_0x7995('0x79')]&&_0xb68962[_0x7995('0x3b')]!==_0x7995('0x7a')&&_0xb68962[_0x7995('0x3b')]!=='custom_dropdown';});return{'count':_0x34724d[_0x7995('0x43')],'rows':_[_0x7995('0x3d')](_0x34724d,function(_0x5c04c9){return{'id':_0x5c04c9['name'],'name':_0x5c04c9[_0x7995('0x7b')],'custom':!_0x5c04c9[_0x7995('0x79')],'options':_0x5c04c9[_0x7995('0x7c')]?_[_0x7995('0x3d')](_0x5c04c9[_0x7995('0x7c')],function(_0x4a02ea){return{'name':_[_0x7995('0x7d')](_0x4a02ea),'value':_0x4a02ea};}):[]};})};}})[_0x7995('0x20')](respondWithResult(_0x50c1a4,null))['catch'](function(_0x209977){var _0x30b41f=_0x1f01c0['query'][_0x7995('0x7e')]?0x1f4:_0x209977['statusCode']||0x1f4;logger[_0x7995('0x25')](_0x7995('0x7f'),_0x7995('0x80'),_0x30b41f,JSON[_0x7995('0x24')](_0x209977));delete _0x209977[_0x7995('0x36')];if(_0x30b41f===0x191){_0x30b41f=0x190;}_0x50c1a4['status'](_0x30b41f)[_0x7995('0x37')](_0x1f01c0[_0x7995('0x3e')][_0x7995('0x7e')]?{'message':'Wrong\x20credentials','statusCode':_0x209977[_0x7995('0x81')]}:_0x209977);});}; \ No newline at end of file +var _0x9957=['requester','subject','priority','group','source','ticket_type','remove','includes','default','custom_text','label','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','getFields','statusCode','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','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskAccount,\x20%s,\x20%s','result','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','stack','name','send','FreshdeskAccount','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','filtears','options','find','update','body','getConfigurations','findOne','FreshdeskConfiguration','order','filter','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64'];(function(_0x4c578c,_0x50972b){var _0x18ce5c=function(_0x9fbde){while(--_0x9fbde){_0x4c578c['push'](_0x4c578c['shift']());}};_0x18ce5c(++_0x50972b);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];var integrations=require(_0x7995('0x1b'));var jayson=require(_0x7995('0x1c'));var client=jayson[_0x7995('0x1d')][_0x7995('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2bbe7a,_0x4cc004,_0x58f5ad,_0x2b4e94){return new BPromise(function(_0x2233dd,_0x24b5bb){var _0x321ae8=_0x2b4e94||client;return _0x321ae8[_0x7995('0x1f')](_0x2bbe7a,_0x58f5ad)[_0x7995('0x20')](function(_0x2202ce){logger[_0x7995('0x21')]('FreshdeskAccount,\x20%s,\x20%s',_0x4cc004,_0x7995('0x22'));logger['debug'](_0x7995('0x23'),_0x4cc004,_0x7995('0x22'),JSON[_0x7995('0x24')](_0x2202ce));if(_0x2202ce[_0x7995('0x25')]){if(_0x2202ce[_0x7995('0x25')][_0x7995('0x26')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x4cc004,_0x2202ce[_0x7995('0x25')]['message']);return _0x24b5bb(_0x2202ce['error'][_0x7995('0x27')]);}logger[_0x7995('0x25')]('FreshdeskAccount,\x20%s,\x20%s',_0x4cc004,_0x2202ce[_0x7995('0x25')]['message']);return _0x2233dd(_0x2202ce['error'][_0x7995('0x27')]);}else{logger[_0x7995('0x21')](_0x7995('0x28'),_0x4cc004,_0x7995('0x22'));_0x2233dd(_0x2202ce[_0x7995('0x29')][_0x7995('0x27')]);}})['catch'](function(_0x32a09a){logger[_0x7995('0x25')](_0x7995('0x28'),_0x4cc004,_0x32a09a);_0x24b5bb(_0x32a09a);});});}function respondWithStatusCode(_0x285437,_0x563799){_0x563799=_0x563799||0xcc;return function(_0x13bc35){if(_0x13bc35){return _0x285437[_0x7995('0x2a')](_0x563799);}return _0x285437[_0x7995('0x2b')](_0x563799)['end']();};}function respondWithResult(_0x39df42,_0x34e70c){_0x34e70c=_0x34e70c||0xc8;return function(_0x401dc3){if(_0x401dc3){return _0x39df42[_0x7995('0x2b')](_0x34e70c)[_0x7995('0x2c')](_0x401dc3);}};}function respondWithFilteredResult(_0x2a307e,_0x56691a){return function(_0x47625f){if(_0x47625f){var _0x5911c3=_0x47625f[_0x7995('0x2d')],_0x229742=_0x56691a[_0x7995('0x2e')],_0x49bc7e=_0x56691a['offset']+_0x56691a[_0x7995('0x2f')],_0xf16cc2;if(_0x49bc7e>=_0x5911c3){_0x49bc7e=_0x5911c3;_0xf16cc2=0xc8;}else{_0xf16cc2=0xce;}_0x2a307e['status'](_0xf16cc2);return _0x2a307e[_0x7995('0x30')](_0x7995('0x31'),_0x229742+'-'+_0x49bc7e+'/'+_0x5911c3)[_0x7995('0x2c')](_0x47625f);}return null;};}function patchUpdates(_0x574574){return function(_0x530611){try{jsonpatch['apply'](_0x530611,_0x574574,!![]);}catch(_0x3573be){return BPromise[_0x7995('0x32')](_0x3573be);}return _0x530611[_0x7995('0x33')]();};}function saveUpdates(_0x2b874d,_0x2e3493){return function(_0x1ca460){if(_0x1ca460){return _0x1ca460['update'](_0x2b874d)['then'](function(_0xfa8f15){return _0xfa8f15;});}return null;};}function removeEntity(_0x5524af,_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x34')]()[_0x7995('0x20')](function(){_0x5524af[_0x7995('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44309d,_0x33e24e){return function(_0x5dd802){if(!_0x5dd802){_0x44309d['sendStatus'](0x194);}return _0x5dd802;};}function handleError(_0x577412,_0x45bc5e){_0x45bc5e=_0x45bc5e||0x1f4;return function(_0x3acfc3){logger['error'](_0x3acfc3[_0x7995('0x35')]);if(_0x3acfc3['name']){delete _0x3acfc3[_0x7995('0x36')];}_0x577412[_0x7995('0x2b')](_0x45bc5e)[_0x7995('0x37')](_0x3acfc3);};}exports['index']=function(_0x52d76d,_0x36d057){var _0x5e67fe={},_0x5d2428={},_0x3e99cd={'count':0x0,'rows':[]};var _0xe328b1=_['map'](db[_0x7995('0x38')][_0x7995('0x39')],function(_0x2b772f){return{'name':_0x2b772f[_0x7995('0x3a')],'type':_0x2b772f[_0x7995('0x3b')]['key']};});_0x5d2428[_0x7995('0x3c')]=_[_0x7995('0x3d')](_0xe328b1,_0x7995('0x36'));_0x5d2428[_0x7995('0x3e')]=_['keys'](_0x52d76d[_0x7995('0x3e')]);_0x5d2428[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x5d2428[_0x7995('0x3c')],_0x5d2428[_0x7995('0x3e')]);_0x5e67fe[_0x7995('0x41')]=_['intersection'](_0x5d2428[_0x7995('0x3c')],qs[_0x7995('0x42')](_0x52d76d[_0x7995('0x3e')][_0x7995('0x42')]));_0x5e67fe[_0x7995('0x41')]=_0x5e67fe[_0x7995('0x41')][_0x7995('0x43')]?_0x5e67fe[_0x7995('0x41')]:_0x5d2428[_0x7995('0x3c')];if(!_0x52d76d[_0x7995('0x3e')][_0x7995('0x44')](_0x7995('0x45'))){_0x5e67fe[_0x7995('0x2f')]=qs['limit'](_0x52d76d['query'][_0x7995('0x2f')]);_0x5e67fe[_0x7995('0x2e')]=qs['offset'](_0x52d76d['query'][_0x7995('0x2e')]);}_0x5e67fe['order']=qs['sort'](_0x52d76d[_0x7995('0x3e')][_0x7995('0x46')]);_0x5e67fe[_0x7995('0x47')]=qs['filters'](_[_0x7995('0x48')](_0x52d76d['query'],_0x5d2428[_0x7995('0x3f')]),_0xe328b1);if(_0x52d76d['query']['filter']){_0x5e67fe[_0x7995('0x47')]=_[_0x7995('0x49')](_0x5e67fe[_0x7995('0x47')],{'$or':_[_0x7995('0x3d')](_0xe328b1,function(_0x599ecb){if(_0x599ecb[_0x7995('0x3b')]!==_0x7995('0x4a')){var _0x31b347={};_0x31b347[_0x599ecb[_0x7995('0x36')]]={'$like':'%'+_0x52d76d['query']['filter']+'%'};return _0x31b347;}})});}_0x5e67fe=_[_0x7995('0x49')]({},_0x5e67fe,_0x52d76d['options']);var _0x23c41d={'where':_0x5e67fe['where']};return db[_0x7995('0x38')]['count'](_0x23c41d)[_0x7995('0x20')](function(_0x1b0373){_0x3e99cd['count']=_0x1b0373;if(_0x52d76d[_0x7995('0x3e')][_0x7995('0x4b')]){_0x5e67fe[_0x7995('0x4c')]=[{'all':!![]}];}return db[_0x7995('0x38')]['findAll'](_0x5e67fe);})[_0x7995('0x20')](function(_0x3e787d){_0x3e99cd[_0x7995('0x4d')]=_0x3e787d;return _0x3e99cd;})['then'](respondWithFilteredResult(_0x36d057,_0x5e67fe))[_0x7995('0x4e')](handleError(_0x36d057,null));};exports[_0x7995('0x4f')]=function(_0x511567,_0x3d8ae3){var _0x255313={'raw':![],'where':{'id':_0x511567[_0x7995('0x50')]['id']}},_0x51934b={};_0x51934b[_0x7995('0x3c')]=_['keys'](db[_0x7995('0x38')]['rawAttributes']);_0x51934b[_0x7995('0x3e')]=_[_0x7995('0x51')](_0x511567[_0x7995('0x3e')]);_0x51934b[_0x7995('0x52')]=_[_0x7995('0x40')](_0x51934b[_0x7995('0x3c')],_0x51934b[_0x7995('0x3e')]);_0x255313['attributes']=_[_0x7995('0x40')](_0x51934b[_0x7995('0x3c')],qs[_0x7995('0x42')](_0x511567['query'][_0x7995('0x42')]));_0x255313[_0x7995('0x41')]=_0x255313[_0x7995('0x41')]['length']?_0x255313['attributes']:_0x51934b['model'];if(_0x511567[_0x7995('0x3e')][_0x7995('0x4b')]){_0x255313['include']=[{'all':!![]}];}_0x255313=_[_0x7995('0x49')]({},_0x255313,_0x511567[_0x7995('0x53')]);return db[_0x7995('0x38')][_0x7995('0x54')](_0x255313)[_0x7995('0x20')](handleEntityNotFound(_0x3d8ae3,null))['then'](respondWithResult(_0x3d8ae3,null))[_0x7995('0x4e')](handleError(_0x3d8ae3,null));};exports['create']=function(_0x14fe7f,_0x33c801){return db[_0x7995('0x38')]['create'](_0x14fe7f['body'],{})['then'](respondWithResult(_0x33c801,0xc9))['catch'](handleError(_0x33c801,null));};exports[_0x7995('0x55')]=function(_0x3709de,_0x1a861c){if(_0x3709de[_0x7995('0x56')]['id']){delete _0x3709de[_0x7995('0x56')]['id'];}return db[_0x7995('0x38')][_0x7995('0x54')]({'where':{'id':_0x3709de[_0x7995('0x50')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x1a861c,null))[_0x7995('0x20')](saveUpdates(_0x3709de[_0x7995('0x56')],null))[_0x7995('0x20')](respondWithResult(_0x1a861c,null))[_0x7995('0x4e')](handleError(_0x1a861c,null));};exports[_0x7995('0x34')]=function(_0x1ea1dc,_0x416133){return db[_0x7995('0x38')][_0x7995('0x54')]({'where':{'id':_0x1ea1dc[_0x7995('0x50')]['id']}})['then'](handleEntityNotFound(_0x416133,null))[_0x7995('0x20')](removeEntity(_0x416133,null))[_0x7995('0x4e')](handleError(_0x416133,null));};exports[_0x7995('0x57')]=function(_0x32c0d3,_0x5d160d,_0x53125a){var _0x402fa0={};var _0x197b52={};var _0x5b9467;var _0x332a85;return db['FreshdeskAccount'][_0x7995('0x58')]({'where':{'id':_0x32c0d3[_0x7995('0x50')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x5d160d,null))[_0x7995('0x20')](function(_0x502d43){if(_0x502d43){_0x5b9467=_0x502d43;_0x197b52['model']=_[_0x7995('0x51')](db[_0x7995('0x59')][_0x7995('0x39')]);_0x197b52[_0x7995('0x3e')]=_[_0x7995('0x51')](_0x32c0d3[_0x7995('0x3e')]);_0x197b52[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x197b52[_0x7995('0x3c')],_0x197b52['query']);_0x402fa0[_0x7995('0x41')]=_[_0x7995('0x40')](_0x197b52[_0x7995('0x3c')],qs[_0x7995('0x42')](_0x32c0d3['query']['fields']));_0x402fa0[_0x7995('0x41')]=_0x402fa0[_0x7995('0x41')]['length']?_0x402fa0[_0x7995('0x41')]:_0x197b52[_0x7995('0x3c')];_0x402fa0[_0x7995('0x5a')]=qs[_0x7995('0x46')](_0x32c0d3[_0x7995('0x3e')]['sort']);_0x402fa0[_0x7995('0x47')]=qs['filters'](_[_0x7995('0x48')](_0x32c0d3[_0x7995('0x3e')],_0x197b52[_0x7995('0x3f')]));if(_0x32c0d3[_0x7995('0x3e')][_0x7995('0x5b')]){_0x402fa0[_0x7995('0x47')]=_[_0x7995('0x49')](_0x402fa0[_0x7995('0x47')],{'$or':_[_0x7995('0x3d')](_0x402fa0[_0x7995('0x41')],function(_0x2618c4){var _0x234d8d={};_0x234d8d[_0x2618c4]={'$like':'%'+_0x32c0d3['query'][_0x7995('0x5b')]+'%'};return _0x234d8d;})});}_0x402fa0=_[_0x7995('0x49')]({},_0x402fa0,_0x32c0d3[_0x7995('0x53')]);return _0x5b9467[_0x7995('0x57')](_0x402fa0);}})[_0x7995('0x20')](function(_0x54a2e0){if(_0x54a2e0){_0x332a85=_0x54a2e0['length'];if(!_0x32c0d3[_0x7995('0x3e')][_0x7995('0x44')](_0x7995('0x45'))){_0x402fa0[_0x7995('0x2f')]=qs['limit'](_0x32c0d3[_0x7995('0x3e')]['limit']);_0x402fa0['offset']=qs[_0x7995('0x2e')](_0x32c0d3[_0x7995('0x3e')][_0x7995('0x2e')]);}return _0x5b9467[_0x7995('0x57')](_0x402fa0);}})[_0x7995('0x20')](function(_0x25d9a4){if(_0x25d9a4){return _0x25d9a4?{'count':_0x332a85,'rows':_0x25d9a4}:null;}})[_0x7995('0x20')](respondWithResult(_0x5d160d,null))[_0x7995('0x4e')](handleError(_0x5d160d,null));};exports[_0x7995('0x5c')]=function(_0x2466df,_0x560b0a,_0x2dc1f7){if(_0x2466df[_0x7995('0x56')]['id']){delete _0x2466df[_0x7995('0x56')]['id'];}return db['FreshdeskAccount'][_0x7995('0x58')]({'where':{'id':_0x2466df[_0x7995('0x50')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x560b0a,null))[_0x7995('0x20')](function(_0x3b0d30){if(_0x3b0d30){_0x2466df[_0x7995('0x56')][_0x7995('0x5d')]=_0x3b0d30['id'];_0x2466df[_0x7995('0x56')][_0x7995('0x5e')]=integrations[_0x7995('0x5f')](_0x2466df[_0x7995('0x56')]['channel'],_0x2466df['body'][_0x7995('0x3b')]);_0x2466df[_0x7995('0x56')][_0x7995('0x60')]=integrations[_0x7995('0x61')](_0x2466df['body'][_0x7995('0x62')],_0x2466df[_0x7995('0x56')]['type']);return db['FreshdeskConfiguration'][_0x7995('0x63')](_0x2466df[_0x7995('0x56')],{'include':[{'model':db['FreshdeskField'],'as':_0x7995('0x5e')},{'model':db['FreshdeskField'],'as':_0x7995('0x60')}]});}return null;})[_0x7995('0x20')](respondWithResult(_0x560b0a,null))['catch'](handleError(_0x560b0a,null));};exports['getFields']=function(_0x1f01c0,_0x50c1a4,_0x31b9e6){var _0xa41fff='';return db[_0x7995('0x38')][_0x7995('0x58')]({'where':{'id':_0x1f01c0[_0x7995('0x50')]['id']},'attributes':['id',_0x7995('0x64'),_0x7995('0x65')]})[_0x7995('0x20')](handleEntityNotFound(_0x50c1a4,null))[_0x7995('0x20')](function(_0x117317){if(_0x117317){_0xa41fff=_0x117317[_0x7995('0x64')];var _0x16108c=_0xa41fff[_0x7995('0x66')](-0x1);if(_0x16108c==='/'){_0xa41fff=_0xa41fff[_0x7995('0x67')](0x0,_0xa41fff[_0x7995('0x68')](_0x16108c));}return rp({'method':_0x7995('0x69'),'uri':util[_0x7995('0x6a')](_0x7995('0x6b'),_0xa41fff,_0x7995('0x6c')),'headers':{'Authorization':util[_0x7995('0x6a')](_0x7995('0x6d'),new Buffer(util[_0x7995('0x6a')](_0x7995('0x6e'),_0x117317[_0x7995('0x65')]))[_0x7995('0x6f')](_0x7995('0x70')))},'json':!![]});}})[_0x7995('0x20')](function(_0x34724d){if(_0x34724d){var _0x59efff=[_0x7995('0x71'),_0x7995('0x72'),'agent','description',_0x7995('0x2b'),_0x7995('0x73'),_0x7995('0x74'),_0x7995('0x75'),_0x7995('0x76'),_0x7995('0x74'),'company'];_[_0x7995('0x77')](_0x34724d,function(_0xb68962){return _0x59efff[_0x7995('0x78')](_0xb68962[_0x7995('0x36')])||!_0xb68962[_0x7995('0x79')]&&_0xb68962[_0x7995('0x3b')]!==_0x7995('0x7a')&&_0xb68962[_0x7995('0x3b')]!=='custom_dropdown';});return{'count':_0x34724d[_0x7995('0x43')],'rows':_[_0x7995('0x3d')](_0x34724d,function(_0x5c04c9){return{'id':_0x5c04c9['name'],'name':_0x5c04c9[_0x7995('0x7b')],'custom':!_0x5c04c9[_0x7995('0x79')],'options':_0x5c04c9[_0x7995('0x7c')]?_[_0x7995('0x3d')](_0x5c04c9[_0x7995('0x7c')],function(_0x4a02ea){return{'name':_[_0x7995('0x7d')](_0x4a02ea),'value':_0x4a02ea};}):[]};})};}})[_0x7995('0x20')](respondWithResult(_0x50c1a4,null))['catch'](function(_0x209977){var _0x30b41f=_0x1f01c0['query'][_0x7995('0x7e')]?0x1f4:_0x209977['statusCode']||0x1f4;logger[_0x7995('0x25')](_0x7995('0x7f'),_0x7995('0x80'),_0x30b41f,JSON[_0x7995('0x24')](_0x209977));delete _0x209977[_0x7995('0x36')];if(_0x30b41f===0x191){_0x30b41f=0x190;}_0x50c1a4['status'](_0x30b41f)[_0x7995('0x37')](_0x1f01c0[_0x7995('0x3e')][_0x7995('0x7e')]?{'message':'Wrong\x20credentials','statusCode':_0x209977[_0x7995('0x81')]}:_0x209977);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index e3b47ae..6c85f9c 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 _0xcd43=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash'];(function(_0x8ff2ab,_0x3955ee){var _0x30955a=function(_0x588800){while(--_0x588800){_0x8ff2ab['push'](_0x8ff2ab['shift']());}};_0x30955a(++_0x3955ee);}(_0xcd43,0x95));var _0x3cd4=function(_0x394322,_0x51090f){_0x394322=_0x394322-0x0;var _0x1502a6=_0xcd43[_0x394322];return _0x1502a6;};'use strict';var _=require(_0x3cd4('0x0'));var util=require(_0x3cd4('0x1'));var logger=require('../../config/logger')(_0x3cd4('0x2'));var moment=require(_0x3cd4('0x3'));var BPromise=require(_0x3cd4('0x4'));var rp=require(_0x3cd4('0x5'));var fs=require('fs');var path=require(_0x3cd4('0x6'));var rimraf=require(_0x3cd4('0x7'));var config=require(_0x3cd4('0x8'));var attributes=require(_0x3cd4('0x9'));var integrations=require(_0x3cd4('0xa'));module[_0x3cd4('0xb')]=function(_0x2a6996,_0x5d6829){return _0x2a6996[_0x3cd4('0xc')](_0x3cd4('0xd'),attributes,{'tableName':_0x3cd4('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedb2=['int_freshdesk_accounts','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount'];(function(_0xe4bb3d,_0x21e87e){var _0xd9e51=function(_0x1f732b){while(--_0x1f732b){_0xe4bb3d['push'](_0xe4bb3d['shift']());}};_0xd9e51(++_0x21e87e);}(_0xedb2,0x1a1));var _0x2edb=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xedb2[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x2edb('0x0'));var util=require('util');var logger=require(_0x2edb('0x1'))('api');var moment=require(_0x2edb('0x2'));var BPromise=require('bluebird');var rp=require(_0x2edb('0x3'));var fs=require('fs');var path=require(_0x2edb('0x4'));var rimraf=require(_0x2edb('0x5'));var config=require(_0x2edb('0x6'));var attributes=require(_0x2edb('0x7'));var integrations=require(_0x2edb('0x8'));module[_0x2edb('0x9')]=function(_0x2119cc,_0x1f94f5){return _0x2119cc[_0x2edb('0xa')](_0x2edb('0xb'),attributes,{'tableName':_0x2edb('0xc'),'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 ef18c23..634bae1 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 _0x8d26=['options','raw','where','limit','include','model','map','attributes','stringify','ShowFreshdeskAccount','find','info','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d26,0x174));var _0x68d2=function(_0x455555,_0x2147fd){_0x455555=_0x455555-0x0;var _0x3cb183=_0x8d26[_0x455555];return _0x3cb183;};'use strict';var _=require(_0x68d2('0x0'));var util=require(_0x68d2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x68d2('0x2'));var db=require(_0x68d2('0x3'))['db'];var utils=require(_0x68d2('0x4'));var logger=require(_0x68d2('0x5'))(_0x68d2('0x6'));var config=require(_0x68d2('0x7'));var jayson=require(_0x68d2('0x8'));var client=jayson[_0x68d2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa467bf,_0x47e46f,_0x52ab4e){return new BPromise(function(_0x46af8a,_0x34dccc){return client[_0x68d2('0xa')](_0xa467bf,_0x52ab4e)[_0x68d2('0xb')](function(_0x163f3e){logger['info'](_0x68d2('0xc'),_0x47e46f,_0x68d2('0xd'));logger[_0x68d2('0xe')](_0x68d2('0xf'),_0x47e46f,_0x68d2('0xd'),JSON['stringify'](_0x163f3e));if(_0x163f3e['error']){if(_0x163f3e[_0x68d2('0x10')][_0x68d2('0x11')]===0x1f4){logger['error'](_0x68d2('0xc'),_0x47e46f,_0x163f3e[_0x68d2('0x10')][_0x68d2('0x12')]);return _0x34dccc(_0x163f3e[_0x68d2('0x10')][_0x68d2('0x12')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x47e46f,_0x163f3e[_0x68d2('0x10')][_0x68d2('0x12')]);return _0x46af8a(_0x163f3e[_0x68d2('0x10')]['message']);}else{logger['info'](_0x68d2('0xc'),_0x47e46f,'request\x20sent');_0x46af8a(_0x163f3e[_0x68d2('0x13')][_0x68d2('0x12')]);}})[_0x68d2('0x14')](function(_0x1a2fed){logger[_0x68d2('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x47e46f,_0x1a2fed);_0x34dccc(_0x1a2fed);});});}exports[_0x68d2('0x15')]=function(_0x5bf325){var _0xd0d89e=this;return new Promise(function(_0x52d45c,_0x14fad8){return db[_0x68d2('0x16')][_0x68d2('0x17')]({'raw':_0x5bf325[_0x68d2('0x18')]?_0x5bf325[_0x68d2('0x18')][_0x68d2('0x19')]===undefined?!![]:![]:!![],'where':_0x5bf325['options']?_0x5bf325[_0x68d2('0x18')][_0x68d2('0x1a')]||null:null,'attributes':_0x5bf325['options']?_0x5bf325[_0x68d2('0x18')]['attributes']||null:null,'limit':_0x5bf325['options']?_0x5bf325[_0x68d2('0x18')][_0x68d2('0x1b')]||null:null,'include':_0x5bf325[_0x68d2('0x18')]?_0x5bf325[_0x68d2('0x18')][_0x68d2('0x1c')]?_['map'](_0x5bf325[_0x68d2('0x18')]['include'],function(_0x5a7667){return{'model':db[_0x5a7667[_0x68d2('0x1d')]],'as':_0x5a7667['as'],'attributes':_0x5a7667['attributes'],'include':_0x5a7667[_0x68d2('0x1c')]?_[_0x68d2('0x1e')](_0x5a7667[_0x68d2('0x1c')],function(_0x47dc79){return{'model':db[_0x47dc79['model']],'as':_0x47dc79['as'],'attributes':_0x47dc79['attributes'],'include':_0x47dc79['include']?_['map'](_0x47dc79[_0x68d2('0x1c')],function(_0x14d1b4){return{'model':db[_0x14d1b4[_0x68d2('0x1d')]],'as':_0x14d1b4['as'],'attributes':_0x14d1b4[_0x68d2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x68d2('0xb')](function(_0x17fbba){logger['info'](_0x68d2('0x15'),_0x5bf325);logger[_0x68d2('0xe')](_0x68d2('0x15'),_0x5bf325,JSON[_0x68d2('0x20')](_0x17fbba));_0x52d45c(_0x17fbba);})[_0x68d2('0x14')](function(_0x4d1195){logger[_0x68d2('0x10')](_0x68d2('0x15'),_0x4d1195[_0x68d2('0x12')],_0x5bf325);_0x14fad8(_0xd0d89e[_0x68d2('0x10')](0x1f4,_0x4d1195['message']));});});};exports[_0x68d2('0x21')]=function(_0x1aa133){var _0x338d57=this;return new Promise(function(_0x2dfc8b,_0x380268){return db[_0x68d2('0x16')][_0x68d2('0x22')]({'raw':_0x1aa133[_0x68d2('0x18')]?_0x1aa133[_0x68d2('0x18')][_0x68d2('0x19')]===undefined?!![]:![]:!![],'where':_0x1aa133[_0x68d2('0x18')]?_0x1aa133[_0x68d2('0x18')][_0x68d2('0x1a')]||null:null,'attributes':_0x1aa133[_0x68d2('0x18')]?_0x1aa133[_0x68d2('0x18')][_0x68d2('0x1f')]||null:null,'include':_0x1aa133['options']?_0x1aa133[_0x68d2('0x18')][_0x68d2('0x1c')]?_['map'](_0x1aa133['options'][_0x68d2('0x1c')],function(_0x5d7bc2){return{'model':db[_0x5d7bc2[_0x68d2('0x1d')]],'as':_0x5d7bc2['as'],'attributes':_0x5d7bc2[_0x68d2('0x1f')],'include':_0x5d7bc2[_0x68d2('0x1c')]?_[_0x68d2('0x1e')](_0x5d7bc2['include'],function(_0x2109bb){return{'model':db[_0x2109bb[_0x68d2('0x1d')]],'as':_0x2109bb['as'],'attributes':_0x2109bb[_0x68d2('0x1f')],'include':_0x2109bb[_0x68d2('0x1c')]?_[_0x68d2('0x1e')](_0x2109bb['include'],function(_0x434ac1){return{'model':db[_0x434ac1['model']],'as':_0x434ac1['as'],'attributes':_0x434ac1[_0x68d2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x68d2('0xb')](function(_0x2bc716){logger[_0x68d2('0x23')]('ShowFreshdeskAccount',_0x1aa133);logger['debug'](_0x68d2('0x21'),_0x1aa133,JSON[_0x68d2('0x20')](_0x2bc716));_0x2dfc8b(_0x2bc716);})[_0x68d2('0x14')](function(_0x3011ff){logger['error'](_0x68d2('0x21'),_0x3011ff[_0x68d2('0x12')],_0x1aa133);_0x380268(_0x338d57[_0x68d2('0x10')](0x1f4,_0x3011ff[_0x68d2('0x12')]));});});}; \ No newline at end of file +var _0x63d3=['info','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','include','map','model','ShowFreshdeskAccount','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x46d790,_0x35899a){var _0x67b468=function(_0x2bb0a0){while(--_0x2bb0a0){_0x46d790['push'](_0x46d790['shift']());}};_0x67b468(++_0x35899a);}(_0x63d3,0x1a5));var _0x363d=function(_0x43a710,_0x482f5b){_0x43a710=_0x43a710-0x0;var _0x47e675=_0x63d3[_0x43a710];return _0x47e675;};'use strict';var _=require(_0x363d('0x0'));var util=require(_0x363d('0x1'));var moment=require(_0x363d('0x2'));var BPromise=require(_0x363d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x363d('0x4'));var db=require(_0x363d('0x5'))['db'];var utils=require(_0x363d('0x6'));var logger=require(_0x363d('0x7'))(_0x363d('0x8'));var config=require(_0x363d('0x9'));var jayson=require(_0x363d('0xa'));var client=jayson[_0x363d('0xb')][_0x363d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42d61c,_0x39405b,_0x4a1203){return new BPromise(function(_0x5c5edd,_0x1b2ec7){return client[_0x363d('0xd')](_0x42d61c,_0x4a1203)[_0x363d('0xe')](function(_0x2652f9){logger['info'](_0x363d('0xf'),_0x39405b,_0x363d('0x10'));logger[_0x363d('0x11')](_0x363d('0x12'),_0x39405b,'request\x20sent',JSON[_0x363d('0x13')](_0x2652f9));if(_0x2652f9[_0x363d('0x14')]){if(_0x2652f9[_0x363d('0x14')][_0x363d('0x15')]===0x1f4){logger[_0x363d('0x14')](_0x363d('0xf'),_0x39405b,_0x2652f9[_0x363d('0x14')][_0x363d('0x16')]);return _0x1b2ec7(_0x2652f9['error'][_0x363d('0x16')]);}logger[_0x363d('0x14')](_0x363d('0xf'),_0x39405b,_0x2652f9['error'][_0x363d('0x16')]);return _0x5c5edd(_0x2652f9[_0x363d('0x14')]['message']);}else{logger[_0x363d('0x17')](_0x363d('0xf'),_0x39405b,'request\x20sent');_0x5c5edd(_0x2652f9[_0x363d('0x18')][_0x363d('0x16')]);}})[_0x363d('0x19')](function(_0x1f9884){logger['error'](_0x363d('0xf'),_0x39405b,_0x1f9884);_0x1b2ec7(_0x1f9884);});});}exports[_0x363d('0x1a')]=function(_0x5703ef){var _0x3fff6c=this;return new Promise(function(_0x3c3e64,_0x4918f2){return db[_0x363d('0x1b')][_0x363d('0x1c')]({'raw':_0x5703ef[_0x363d('0x1d')]?_0x5703ef[_0x363d('0x1d')][_0x363d('0x1e')]===undefined?!![]:![]:!![],'where':_0x5703ef[_0x363d('0x1d')]?_0x5703ef['options']['where']||null:null,'attributes':_0x5703ef[_0x363d('0x1d')]?_0x5703ef[_0x363d('0x1d')][_0x363d('0x1f')]||null:null,'limit':_0x5703ef[_0x363d('0x1d')]?_0x5703ef['options']['limit']||null:null,'include':_0x5703ef['options']?_0x5703ef['options'][_0x363d('0x20')]?_[_0x363d('0x21')](_0x5703ef[_0x363d('0x1d')][_0x363d('0x20')],function(_0x26a1a0){return{'model':db[_0x26a1a0[_0x363d('0x22')]],'as':_0x26a1a0['as'],'attributes':_0x26a1a0[_0x363d('0x1f')],'include':_0x26a1a0[_0x363d('0x20')]?_[_0x363d('0x21')](_0x26a1a0[_0x363d('0x20')],function(_0x4e7e35){return{'model':db[_0x4e7e35[_0x363d('0x22')]],'as':_0x4e7e35['as'],'attributes':_0x4e7e35[_0x363d('0x1f')],'include':_0x4e7e35[_0x363d('0x20')]?_['map'](_0x4e7e35[_0x363d('0x20')],function(_0x20842f){return{'model':db[_0x20842f[_0x363d('0x22')]],'as':_0x20842f['as'],'attributes':_0x20842f[_0x363d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x363d('0xe')](function(_0x586583){logger['info'](_0x363d('0x1a'),_0x5703ef);logger[_0x363d('0x11')](_0x363d('0x1a'),_0x5703ef,JSON[_0x363d('0x13')](_0x586583));_0x3c3e64(_0x586583);})['catch'](function(_0x27ae92){logger['error'](_0x363d('0x1a'),_0x27ae92[_0x363d('0x16')],_0x5703ef);_0x4918f2(_0x3fff6c['error'](0x1f4,_0x27ae92[_0x363d('0x16')]));});});};exports[_0x363d('0x23')]=function(_0x28ff21){var _0x364a1=this;return new Promise(function(_0x24656b,_0x3a6c53){return db['FreshdeskAccount']['find']({'raw':_0x28ff21['options']?_0x28ff21[_0x363d('0x1d')][_0x363d('0x1e')]===undefined?!![]:![]:!![],'where':_0x28ff21[_0x363d('0x1d')]?_0x28ff21[_0x363d('0x1d')][_0x363d('0x24')]||null:null,'attributes':_0x28ff21['options']?_0x28ff21[_0x363d('0x1d')][_0x363d('0x1f')]||null:null,'include':_0x28ff21['options']?_0x28ff21[_0x363d('0x1d')][_0x363d('0x20')]?_[_0x363d('0x21')](_0x28ff21[_0x363d('0x1d')]['include'],function(_0x246024){return{'model':db[_0x246024[_0x363d('0x22')]],'as':_0x246024['as'],'attributes':_0x246024[_0x363d('0x1f')],'include':_0x246024['include']?_[_0x363d('0x21')](_0x246024[_0x363d('0x20')],function(_0x37a905){return{'model':db[_0x37a905[_0x363d('0x22')]],'as':_0x37a905['as'],'attributes':_0x37a905['attributes'],'include':_0x37a905['include']?_[_0x363d('0x21')](_0x37a905[_0x363d('0x20')],function(_0x35aadf){return{'model':db[_0x35aadf[_0x363d('0x22')]],'as':_0x35aadf['as'],'attributes':_0x35aadf[_0x363d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x363d('0xe')](function(_0x22ca33){logger[_0x363d('0x17')]('ShowFreshdeskAccount',_0x28ff21);logger[_0x363d('0x11')]('ShowFreshdeskAccount',_0x28ff21,JSON['stringify'](_0x22ca33));_0x24656b(_0x22ca33);})[_0x363d('0x19')](function(_0x209e9f){logger[_0x363d('0x14')]('ShowFreshdeskAccount',_0x209e9f[_0x363d('0x16')],_0x28ff21);_0x3a6c53(_0x364a1['error'](0x1f4,_0x209e9f[_0x363d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 8d2ca60..1be9340 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 _0xc9ee=['delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','show','/:id/fields','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update'];(function(_0x188a93,_0xaf57db){var _0x23b40d=function(_0x599f63){while(--_0x599f63){_0x188a93['push'](_0x188a93['shift']());}};_0x23b40d(++_0xaf57db);}(_0xc9ee,0x8e));var _0xec9e=function(_0x3815c2,_0x1f54e3){_0x3815c2=_0x3815c2-0x0;var _0x271f88=_0xc9ee[_0x3815c2];return _0x271f88;};'use strict';var multer=require('multer');var util=require(_0xec9e('0x0'));var path=require(_0xec9e('0x1'));var timeout=require(_0xec9e('0x2'));var express=require(_0xec9e('0x3'));var router=express[_0xec9e('0x4')]();var auth=require(_0xec9e('0x5'));var interaction=require(_0xec9e('0x6'));var config=require(_0xec9e('0x7'));var controller=require(_0xec9e('0x8'));router[_0xec9e('0x9')]('/',auth['isAuthenticated'](),controller[_0xec9e('0xa')]);router[_0xec9e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xec9e('0xb')]);router[_0xec9e('0x9')](_0xec9e('0xc'),auth['isAuthenticated'](),controller[_0xec9e('0xd')]);router[_0xec9e('0x9')](_0xec9e('0xe'),auth[_0xec9e('0xf')](),controller[_0xec9e('0x10')]);router[_0xec9e('0x9')](_0xec9e('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xec9e('0x9')](_0xec9e('0x12'),auth[_0xec9e('0xf')](),controller[_0xec9e('0x13')]);router[_0xec9e('0x14')]('/',auth[_0xec9e('0xf')](),controller[_0xec9e('0x15')]);router['post'](_0xec9e('0x12'),auth[_0xec9e('0xf')](),controller[_0xec9e('0x16')]);router[_0xec9e('0x17')](_0xec9e('0x18'),auth[_0xec9e('0xf')](),controller[_0xec9e('0x19')]);router[_0xec9e('0x1a')](_0xec9e('0x18'),auth[_0xec9e('0xf')](),controller[_0xec9e('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xc2f6=['../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','getTags','create','post','/:id/tags','setTags','put','update','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x4c4131,_0x2549e9){var _0x3a3413=function(_0x4d7a30){while(--_0x4d7a30){_0x4c4131['push'](_0x4c4131['shift']());}};_0x3a3413(++_0x2549e9);}(_0xc2f6,0x1ce));var _0x6c2f=function(_0x4e70a0,_0xbfc948){_0x4e70a0=_0x4e70a0-0x0;var _0x49e7b3=_0xc2f6[_0x4e70a0];return _0x49e7b3;};'use strict';var multer=require('multer');var util=require(_0x6c2f('0x0'));var path=require(_0x6c2f('0x1'));var timeout=require(_0x6c2f('0x2'));var express=require(_0x6c2f('0x3'));var router=express['Router']();var auth=require(_0x6c2f('0x4'));var interaction=require(_0x6c2f('0x5'));var config=require(_0x6c2f('0x6'));var controller=require(_0x6c2f('0x7'));router[_0x6c2f('0x8')]('/',auth[_0x6c2f('0x9')](),controller[_0x6c2f('0xa')]);router[_0x6c2f('0x8')](_0x6c2f('0xb'),auth[_0x6c2f('0x9')](),controller[_0x6c2f('0xc')]);router[_0x6c2f('0x8')](_0x6c2f('0xd'),auth[_0x6c2f('0x9')](),controller['getFields']);router[_0x6c2f('0x8')](_0x6c2f('0xe'),auth[_0x6c2f('0x9')](),controller['getSubjects']);router[_0x6c2f('0x8')](_0x6c2f('0xf'),auth[_0x6c2f('0x9')](),controller[_0x6c2f('0x10')]);router[_0x6c2f('0x8')]('/:id/tags',auth[_0x6c2f('0x9')](),controller[_0x6c2f('0x11')]);router['post']('/',auth[_0x6c2f('0x9')](),controller[_0x6c2f('0x12')]);router[_0x6c2f('0x13')](_0x6c2f('0x14'),auth['isAuthenticated'](),controller[_0x6c2f('0x15')]);router[_0x6c2f('0x16')]('/:id',auth[_0x6c2f('0x9')](),controller[_0x6c2f('0x17')]);router[_0x6c2f('0x18')](_0x6c2f('0xb'),auth[_0x6c2f('0x9')](),controller[_0x6c2f('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index b8dc79a..67a809f 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 _0x6a37=['STRING','sequelize','exports'];(function(_0x4e4056,_0x1ba3b3){var _0x1ca38d=function(_0xfd4890){while(--_0xfd4890){_0x4e4056['push'](_0x4e4056['shift']());}};_0x1ca38d(++_0x1ba3b3);}(_0x6a37,0x1d2));var _0x76a3=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x6a37[_0x9dfc10];return _0x4f938a;};'use strict';var Sequelize=require(_0x76a3('0x0'));module[_0x76a3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x76a3('0x2')]}}; \ No newline at end of file +var _0x77e2=['sequelize','STRING'];(function(_0x1f7258,_0x3ef992){var _0x212f52=function(_0x133e48){while(--_0x133e48){_0x1f7258['push'](_0x1f7258['shift']());}};_0x212f52(++_0x3ef992);}(_0x77e2,0x1e4));var _0x277e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x77e2[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x277e('0x0'));module['exports']={'name':{'type':Sequelize[_0x277e('0x1')]},'description':{'type':Sequelize[_0x277e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 5570bec..5ea04be 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 _0xce36=['request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','sendStatus','status','offset','set','json','apply','save','update','destroy','end','stack','name','index','map','FreshdeskConfiguration','rawAttributes','type','model','query','keys','attributes','intersection','fields','length','nolimit','limit','order','sort','filters','pick','filter','merge','where','options','count','includeAll','findAll','rows','catch','show','params','filtears','include','find','create','body','findOne','FreshdeskField','getFields','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','client','http','request','then','info'];(function(_0x14f959,_0x47f64d){var _0x31de4c=function(_0x3d2dc3){while(--_0x3d2dc3){_0x14f959['push'](_0x14f959['shift']());}};_0x31de4c(++_0x47f64d);}(_0xce36,0x1ab));var _0x6ce3=function(_0x4fb1b8,_0x32d98d){_0x4fb1b8=_0x4fb1b8-0x0;var _0x146c71=_0xce36[_0x4fb1b8];return _0x146c71;};'use strict';var pdf=require(_0x6ce3('0x0'));var emlformat=require(_0x6ce3('0x1'));var rimraf=require(_0x6ce3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6ce3('0x3'));var rp=require('request-promise');var moment=require(_0x6ce3('0x4'));var BPromise=require(_0x6ce3('0x5'));var Mustache=require(_0x6ce3('0x6'));var util=require(_0x6ce3('0x7'));var path=require(_0x6ce3('0x8'));var sox=require(_0x6ce3('0x9'));var csv=require(_0x6ce3('0xa'));var ejs=require(_0x6ce3('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6ce3('0xc'));var crypto=require(_0x6ce3('0xd'));var jsforce=require(_0x6ce3('0xe'));var deskjs=require(_0x6ce3('0xf'));var toCsv=require(_0x6ce3('0xa'));var querystring=require('querystring');var Papa=require(_0x6ce3('0x10'));var Redis=require(_0x6ce3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6ce3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ce3('0x13'))(_0x6ce3('0x14'));var utils=require('../../config/utils');var config=require(_0x6ce3('0x15'));var licenseUtil=require(_0x6ce3('0x16'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x6ce3('0x17')][_0x6ce3('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x49b982,_0x3133f1,_0x1c6bbc,_0x3dd409){return new BPromise(function(_0x473ae3,_0xf92ccf){var _0xa6d565=_0x3dd409||client;return _0xa6d565[_0x6ce3('0x19')](_0x49b982,_0x1c6bbc)[_0x6ce3('0x1a')](function(_0x585732){logger[_0x6ce3('0x1b')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3133f1,_0x6ce3('0x1c'));logger['debug'](_0x6ce3('0x1d'),_0x3133f1,'request\x20sent',JSON['stringify'](_0x585732));if(_0x585732[_0x6ce3('0x1e')]){if(_0x585732[_0x6ce3('0x1e')][_0x6ce3('0x1f')]===0x1f4){logger['error'](_0x6ce3('0x20'),_0x3133f1,_0x585732[_0x6ce3('0x1e')][_0x6ce3('0x21')]);return _0xf92ccf(_0x585732[_0x6ce3('0x1e')][_0x6ce3('0x21')]);}logger[_0x6ce3('0x1e')](_0x6ce3('0x20'),_0x3133f1,_0x585732[_0x6ce3('0x1e')][_0x6ce3('0x21')]);return _0x473ae3(_0x585732[_0x6ce3('0x1e')]['message']);}else{logger[_0x6ce3('0x1b')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3133f1,_0x6ce3('0x1c'));_0x473ae3(_0x585732[_0x6ce3('0x22')][_0x6ce3('0x21')]);}})['catch'](function(_0x2a4529){logger[_0x6ce3('0x1e')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3133f1,_0x2a4529);_0xf92ccf(_0x2a4529);});});}function respondWithStatusCode(_0x5e425d,_0x3f998d){_0x3f998d=_0x3f998d||0xcc;return function(_0x1773b8){if(_0x1773b8){return _0x5e425d[_0x6ce3('0x23')](_0x3f998d);}return _0x5e425d[_0x6ce3('0x24')](_0x3f998d)['end']();};}function respondWithResult(_0xb1718c,_0xef2573){_0xef2573=_0xef2573||0xc8;return function(_0x350cc1){if(_0x350cc1){return _0xb1718c[_0x6ce3('0x24')](_0xef2573)['json'](_0x350cc1);}};}function respondWithFilteredResult(_0x3b057c,_0xa3f5bc){return function(_0x2ff8d0){if(_0x2ff8d0){var _0x57d35b=_0x2ff8d0['count'],_0x5781d1=_0xa3f5bc[_0x6ce3('0x25')],_0x5d444b=_0xa3f5bc[_0x6ce3('0x25')]+_0xa3f5bc['limit'],_0x57d2d1;if(_0x5d444b>=_0x57d35b){_0x5d444b=_0x57d35b;_0x57d2d1=0xc8;}else{_0x57d2d1=0xce;}_0x3b057c[_0x6ce3('0x24')](_0x57d2d1);return _0x3b057c[_0x6ce3('0x26')]('Content-Range',_0x5781d1+'-'+_0x5d444b+'/'+_0x57d35b)[_0x6ce3('0x27')](_0x2ff8d0);}return null;};}function patchUpdates(_0x23f3a3){return function(_0x4991aa){try{jsonpatch[_0x6ce3('0x28')](_0x4991aa,_0x23f3a3,!![]);}catch(_0x3f05d9){return BPromise['reject'](_0x3f05d9);}return _0x4991aa[_0x6ce3('0x29')]();};}function saveUpdates(_0x1b0712,_0x420410){return function(_0x302460){if(_0x302460){return _0x302460[_0x6ce3('0x2a')](_0x1b0712)[_0x6ce3('0x1a')](function(_0xa0a20b){return _0xa0a20b;});}return null;};}function removeEntity(_0x4b5ba7,_0x33714c){return function(_0x2ec401){if(_0x2ec401){return _0x2ec401[_0x6ce3('0x2b')]()['then'](function(){_0x4b5ba7[_0x6ce3('0x24')](0xcc)[_0x6ce3('0x2c')]();});}};}function handleEntityNotFound(_0x1fcea2,_0x12af65){return function(_0x16791b){if(!_0x16791b){_0x1fcea2[_0x6ce3('0x23')](0x194);}return _0x16791b;};}function handleError(_0x19c431,_0x3a1c02){_0x3a1c02=_0x3a1c02||0x1f4;return function(_0x3e71e6){logger[_0x6ce3('0x1e')](_0x3e71e6[_0x6ce3('0x2d')]);if(_0x3e71e6[_0x6ce3('0x2e')]){delete _0x3e71e6[_0x6ce3('0x2e')];}_0x19c431[_0x6ce3('0x24')](_0x3a1c02)['send'](_0x3e71e6);};}exports[_0x6ce3('0x2f')]=function(_0x3c7868,_0x2382c5){var _0x5ef878={},_0x3ca371={},_0x445204={'count':0x0,'rows':[]};var _0x57582e=_[_0x6ce3('0x30')](db[_0x6ce3('0x31')][_0x6ce3('0x32')],function(_0x3efa71){return{'name':_0x3efa71['fieldName'],'type':_0x3efa71[_0x6ce3('0x33')]['key']};});_0x3ca371[_0x6ce3('0x34')]=_[_0x6ce3('0x30')](_0x57582e,_0x6ce3('0x2e'));_0x3ca371[_0x6ce3('0x35')]=_[_0x6ce3('0x36')](_0x3c7868[_0x6ce3('0x35')]);_0x3ca371['filters']=_['intersection'](_0x3ca371[_0x6ce3('0x34')],_0x3ca371['query']);_0x5ef878[_0x6ce3('0x37')]=_[_0x6ce3('0x38')](_0x3ca371[_0x6ce3('0x34')],qs[_0x6ce3('0x39')](_0x3c7868['query'][_0x6ce3('0x39')]));_0x5ef878['attributes']=_0x5ef878['attributes'][_0x6ce3('0x3a')]?_0x5ef878['attributes']:_0x3ca371[_0x6ce3('0x34')];if(!_0x3c7868[_0x6ce3('0x35')]['hasOwnProperty'](_0x6ce3('0x3b'))){_0x5ef878[_0x6ce3('0x3c')]=qs[_0x6ce3('0x3c')](_0x3c7868[_0x6ce3('0x35')]['limit']);_0x5ef878[_0x6ce3('0x25')]=qs[_0x6ce3('0x25')](_0x3c7868[_0x6ce3('0x35')][_0x6ce3('0x25')]);}_0x5ef878[_0x6ce3('0x3d')]=qs[_0x6ce3('0x3e')](_0x3c7868[_0x6ce3('0x35')][_0x6ce3('0x3e')]);_0x5ef878['where']=qs[_0x6ce3('0x3f')](_[_0x6ce3('0x40')](_0x3c7868['query'],_0x3ca371['filters']),_0x57582e);if(_0x3c7868['query'][_0x6ce3('0x41')]){_0x5ef878['where']=_[_0x6ce3('0x42')](_0x5ef878[_0x6ce3('0x43')],{'$or':_[_0x6ce3('0x30')](_0x57582e,function(_0x5848e9){if(_0x5848e9[_0x6ce3('0x33')]!=='VIRTUAL'){var _0x53a4fb={};_0x53a4fb[_0x5848e9[_0x6ce3('0x2e')]]={'$like':'%'+_0x3c7868[_0x6ce3('0x35')][_0x6ce3('0x41')]+'%'};return _0x53a4fb;}})});}_0x5ef878=_['merge']({},_0x5ef878,_0x3c7868[_0x6ce3('0x44')]);var _0x253b35={'where':_0x5ef878[_0x6ce3('0x43')]};return db[_0x6ce3('0x31')][_0x6ce3('0x45')](_0x253b35)[_0x6ce3('0x1a')](function(_0x16c455){_0x445204[_0x6ce3('0x45')]=_0x16c455;if(_0x3c7868['query'][_0x6ce3('0x46')]){_0x5ef878['include']=[{'all':!![]}];}return db[_0x6ce3('0x31')][_0x6ce3('0x47')](_0x5ef878);})['then'](function(_0x4316c3){_0x445204[_0x6ce3('0x48')]=_0x4316c3;return _0x445204;})['then'](respondWithFilteredResult(_0x2382c5,_0x5ef878))[_0x6ce3('0x49')](handleError(_0x2382c5,null));};exports[_0x6ce3('0x4a')]=function(_0x11dd67,_0x306d84){var _0x49cc5d={'raw':![],'where':{'id':_0x11dd67[_0x6ce3('0x4b')]['id']}},_0x3fabee={};_0x3fabee[_0x6ce3('0x34')]=_[_0x6ce3('0x36')](db[_0x6ce3('0x31')][_0x6ce3('0x32')]);_0x3fabee[_0x6ce3('0x35')]=_[_0x6ce3('0x36')](_0x11dd67['query']);_0x3fabee[_0x6ce3('0x4c')]=_[_0x6ce3('0x38')](_0x3fabee[_0x6ce3('0x34')],_0x3fabee['query']);_0x49cc5d[_0x6ce3('0x37')]=_[_0x6ce3('0x38')](_0x3fabee[_0x6ce3('0x34')],qs[_0x6ce3('0x39')](_0x11dd67[_0x6ce3('0x35')][_0x6ce3('0x39')]));_0x49cc5d[_0x6ce3('0x37')]=_0x49cc5d[_0x6ce3('0x37')][_0x6ce3('0x3a')]?_0x49cc5d['attributes']:_0x3fabee[_0x6ce3('0x34')];if(_0x11dd67[_0x6ce3('0x35')]['includeAll']){_0x49cc5d[_0x6ce3('0x4d')]=[{'all':!![]}];}_0x49cc5d=_[_0x6ce3('0x42')]({},_0x49cc5d,_0x11dd67[_0x6ce3('0x44')]);return db[_0x6ce3('0x31')][_0x6ce3('0x4e')](_0x49cc5d)[_0x6ce3('0x1a')](handleEntityNotFound(_0x306d84,null))['then'](respondWithResult(_0x306d84,null))['catch'](handleError(_0x306d84,null));};exports[_0x6ce3('0x4f')]=function(_0x440020,_0x149f75){return db[_0x6ce3('0x31')][_0x6ce3('0x4f')](_0x440020['body'],{})[_0x6ce3('0x1a')](respondWithResult(_0x149f75,0xc9))[_0x6ce3('0x49')](handleError(_0x149f75,null));};exports[_0x6ce3('0x2a')]=function(_0x3042f6,_0xcea338){if(_0x3042f6[_0x6ce3('0x50')]['id']){delete _0x3042f6[_0x6ce3('0x50')]['id'];}return db[_0x6ce3('0x31')]['find']({'where':{'id':_0x3042f6[_0x6ce3('0x4b')]['id']}})[_0x6ce3('0x1a')](handleEntityNotFound(_0xcea338,null))['then'](saveUpdates(_0x3042f6[_0x6ce3('0x50')],null))[_0x6ce3('0x1a')](respondWithResult(_0xcea338,null))[_0x6ce3('0x49')](handleError(_0xcea338,null));};exports['destroy']=function(_0x3e2ae8,_0x112611){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x3e2ae8['params']['id']}})[_0x6ce3('0x1a')](handleEntityNotFound(_0x112611,null))[_0x6ce3('0x1a')](removeEntity(_0x112611,null))[_0x6ce3('0x49')](handleError(_0x112611,null));};exports['getFields']=function(_0x588358,_0x3ebc3b,_0x8e2060){var _0x2c54c4={};var _0x492a18={};var _0x20e48a;var _0x4330ba;return db[_0x6ce3('0x31')][_0x6ce3('0x51')]({'where':{'id':_0x588358[_0x6ce3('0x4b')]['id']}})[_0x6ce3('0x1a')](handleEntityNotFound(_0x3ebc3b,null))['then'](function(_0x561277){if(_0x561277){_0x20e48a=_0x561277;_0x492a18['model']=_['keys'](db[_0x6ce3('0x52')][_0x6ce3('0x32')]);_0x492a18['query']=_[_0x6ce3('0x36')](_0x588358['query']);_0x492a18[_0x6ce3('0x3f')]=_['intersection'](_0x492a18[_0x6ce3('0x34')],_0x492a18[_0x6ce3('0x35')]);_0x2c54c4[_0x6ce3('0x37')]=_[_0x6ce3('0x38')](_0x492a18[_0x6ce3('0x34')],qs[_0x6ce3('0x39')](_0x588358[_0x6ce3('0x35')][_0x6ce3('0x39')]));_0x2c54c4[_0x6ce3('0x37')]=_0x2c54c4['attributes'][_0x6ce3('0x3a')]?_0x2c54c4[_0x6ce3('0x37')]:_0x492a18[_0x6ce3('0x34')];_0x2c54c4['order']=qs[_0x6ce3('0x3e')](_0x588358[_0x6ce3('0x35')][_0x6ce3('0x3e')]);_0x2c54c4['where']=qs[_0x6ce3('0x3f')](_[_0x6ce3('0x40')](_0x588358[_0x6ce3('0x35')],_0x492a18[_0x6ce3('0x3f')]));if(_0x588358[_0x6ce3('0x35')][_0x6ce3('0x41')]){_0x2c54c4[_0x6ce3('0x43')]=_[_0x6ce3('0x42')](_0x2c54c4['where'],{'$or':_[_0x6ce3('0x30')](_0x2c54c4[_0x6ce3('0x37')],function(_0x4c7133){var _0x1afddf={};_0x1afddf[_0x4c7133]={'$like':'%'+_0x588358['query']['filter']+'%'};return _0x1afddf;})});}_0x2c54c4=_['merge']({},_0x2c54c4,_0x588358['options']);return _0x20e48a[_0x6ce3('0x53')](_0x2c54c4);}})[_0x6ce3('0x1a')](function(_0x33d6d3){if(_0x33d6d3){_0x4330ba=_0x33d6d3[_0x6ce3('0x3a')];if(!_0x588358[_0x6ce3('0x35')][_0x6ce3('0x54')](_0x6ce3('0x3b'))){_0x2c54c4[_0x6ce3('0x3c')]=qs['limit'](_0x588358['query'][_0x6ce3('0x3c')]);_0x2c54c4[_0x6ce3('0x25')]=qs[_0x6ce3('0x25')](_0x588358[_0x6ce3('0x35')][_0x6ce3('0x25')]);}return _0x20e48a[_0x6ce3('0x53')](_0x2c54c4);}})[_0x6ce3('0x1a')](function(_0x22345b){if(_0x22345b){return _0x22345b?{'count':_0x4330ba,'rows':_0x22345b}:null;}})['then'](respondWithResult(_0x3ebc3b,null))[_0x6ce3('0x49')](handleError(_0x3ebc3b,null));};exports['getSubjects']=function(_0x30769c,_0x1ce9ce,_0x2295c0){var _0x1028f6={};var _0x3d4989={};var _0x3c93a8;var _0x15eaf1;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x30769c['params']['id']}})[_0x6ce3('0x1a')](handleEntityNotFound(_0x1ce9ce,null))[_0x6ce3('0x1a')](function(_0x23755d){if(_0x23755d){_0x3c93a8=_0x23755d;_0x3d4989['model']=_[_0x6ce3('0x36')](db[_0x6ce3('0x52')]['rawAttributes']);_0x3d4989[_0x6ce3('0x35')]=_[_0x6ce3('0x36')](_0x30769c[_0x6ce3('0x35')]);_0x3d4989['filters']=_[_0x6ce3('0x38')](_0x3d4989[_0x6ce3('0x34')],_0x3d4989['query']);_0x1028f6[_0x6ce3('0x37')]=_['intersection'](_0x3d4989[_0x6ce3('0x34')],qs[_0x6ce3('0x39')](_0x30769c[_0x6ce3('0x35')][_0x6ce3('0x39')]));_0x1028f6[_0x6ce3('0x37')]=_0x1028f6[_0x6ce3('0x37')][_0x6ce3('0x3a')]?_0x1028f6[_0x6ce3('0x37')]:_0x3d4989['model'];_0x1028f6['order']=qs['sort'](_0x30769c[_0x6ce3('0x35')][_0x6ce3('0x3e')]);_0x1028f6[_0x6ce3('0x43')]=qs['filters'](_[_0x6ce3('0x40')](_0x30769c[_0x6ce3('0x35')],_0x3d4989[_0x6ce3('0x3f')]));if(_0x30769c[_0x6ce3('0x35')][_0x6ce3('0x41')]){_0x1028f6[_0x6ce3('0x43')]=_[_0x6ce3('0x42')](_0x1028f6[_0x6ce3('0x43')],{'$or':_[_0x6ce3('0x30')](_0x1028f6[_0x6ce3('0x37')],function(_0x183a5d){var _0x277a71={};_0x277a71[_0x183a5d]={'$like':'%'+_0x30769c[_0x6ce3('0x35')][_0x6ce3('0x41')]+'%'};return _0x277a71;})});}_0x1028f6=_['merge']({},_0x1028f6,_0x30769c[_0x6ce3('0x44')]);return _0x3c93a8[_0x6ce3('0x55')](_0x1028f6);}})[_0x6ce3('0x1a')](function(_0x18556d){if(_0x18556d){_0x15eaf1=_0x18556d[_0x6ce3('0x3a')];if(!_0x30769c[_0x6ce3('0x35')][_0x6ce3('0x54')](_0x6ce3('0x3b'))){_0x1028f6[_0x6ce3('0x3c')]=qs[_0x6ce3('0x3c')](_0x30769c[_0x6ce3('0x35')]['limit']);_0x1028f6[_0x6ce3('0x25')]=qs['offset'](_0x30769c[_0x6ce3('0x35')][_0x6ce3('0x25')]);}return _0x3c93a8[_0x6ce3('0x55')](_0x1028f6);}})['then'](function(_0xfba157){if(_0xfba157){return _0xfba157?{'count':_0x15eaf1,'rows':_0xfba157}:null;}})[_0x6ce3('0x1a')](respondWithResult(_0x1ce9ce,null))[_0x6ce3('0x49')](handleError(_0x1ce9ce,null));};exports['getDescriptions']=function(_0x4033f0,_0x4b1535,_0x119c4b){var _0x2ca8bc={};var _0x405b30={};var _0x28d2ab;var _0x2ada12;return db[_0x6ce3('0x31')][_0x6ce3('0x51')]({'where':{'id':_0x4033f0[_0x6ce3('0x4b')]['id']}})[_0x6ce3('0x1a')](handleEntityNotFound(_0x4b1535,null))[_0x6ce3('0x1a')](function(_0x58534b){if(_0x58534b){_0x28d2ab=_0x58534b;_0x405b30[_0x6ce3('0x34')]=_[_0x6ce3('0x36')](db[_0x6ce3('0x52')][_0x6ce3('0x32')]);_0x405b30['query']=_[_0x6ce3('0x36')](_0x4033f0[_0x6ce3('0x35')]);_0x405b30[_0x6ce3('0x3f')]=_[_0x6ce3('0x38')](_0x405b30[_0x6ce3('0x34')],_0x405b30[_0x6ce3('0x35')]);_0x2ca8bc[_0x6ce3('0x37')]=_['intersection'](_0x405b30[_0x6ce3('0x34')],qs[_0x6ce3('0x39')](_0x4033f0['query'][_0x6ce3('0x39')]));_0x2ca8bc['attributes']=_0x2ca8bc['attributes']['length']?_0x2ca8bc[_0x6ce3('0x37')]:_0x405b30[_0x6ce3('0x34')];_0x2ca8bc[_0x6ce3('0x3d')]=qs['sort'](_0x4033f0[_0x6ce3('0x35')][_0x6ce3('0x3e')]);_0x2ca8bc[_0x6ce3('0x43')]=qs['filters'](_[_0x6ce3('0x40')](_0x4033f0[_0x6ce3('0x35')],_0x405b30[_0x6ce3('0x3f')]));if(_0x4033f0[_0x6ce3('0x35')][_0x6ce3('0x41')]){_0x2ca8bc[_0x6ce3('0x43')]=_[_0x6ce3('0x42')](_0x2ca8bc[_0x6ce3('0x43')],{'$or':_[_0x6ce3('0x30')](_0x2ca8bc[_0x6ce3('0x37')],function(_0x57441c){var _0xf74a9c={};_0xf74a9c[_0x57441c]={'$like':'%'+_0x4033f0[_0x6ce3('0x35')][_0x6ce3('0x41')]+'%'};return _0xf74a9c;})});}_0x2ca8bc=_[_0x6ce3('0x42')]({},_0x2ca8bc,_0x4033f0[_0x6ce3('0x44')]);return _0x28d2ab[_0x6ce3('0x56')](_0x2ca8bc);}})[_0x6ce3('0x1a')](function(_0x142f79){if(_0x142f79){_0x2ada12=_0x142f79[_0x6ce3('0x3a')];if(!_0x4033f0[_0x6ce3('0x35')][_0x6ce3('0x54')](_0x6ce3('0x3b'))){_0x2ca8bc[_0x6ce3('0x3c')]=qs[_0x6ce3('0x3c')](_0x4033f0['query'][_0x6ce3('0x3c')]);_0x2ca8bc[_0x6ce3('0x25')]=qs[_0x6ce3('0x25')](_0x4033f0['query'][_0x6ce3('0x25')]);}return _0x28d2ab['getDescriptions'](_0x2ca8bc);}})[_0x6ce3('0x1a')](function(_0x2580d8){if(_0x2580d8){return _0x2580d8?{'count':_0x2ada12,'rows':_0x2580d8}:null;}})[_0x6ce3('0x1a')](respondWithResult(_0x4b1535,null))[_0x6ce3('0x49')](handleError(_0x4b1535,null));};exports['getTags']=function(_0x40e49e,_0x552d01,_0x4ce38f){var _0xc5660e={};var _0xc3ace2={};var _0x1d4d04;var _0x310301;return db[_0x6ce3('0x31')]['findOne']({'where':{'id':_0x40e49e[_0x6ce3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x552d01,null))[_0x6ce3('0x1a')](function(_0x8615a2){if(_0x8615a2){_0x1d4d04=_0x8615a2;_0xc3ace2[_0x6ce3('0x34')]=_[_0x6ce3('0x36')](db[_0x6ce3('0x57')]['rawAttributes']);_0xc3ace2[_0x6ce3('0x35')]=_[_0x6ce3('0x36')](_0x40e49e[_0x6ce3('0x35')]);_0xc3ace2[_0x6ce3('0x3f')]=_['intersection'](_0xc3ace2['model'],_0xc3ace2[_0x6ce3('0x35')]);_0xc5660e[_0x6ce3('0x37')]=_[_0x6ce3('0x38')](_0xc3ace2[_0x6ce3('0x34')],qs[_0x6ce3('0x39')](_0x40e49e[_0x6ce3('0x35')][_0x6ce3('0x39')]));_0xc5660e['attributes']=_0xc5660e['attributes'][_0x6ce3('0x3a')]?_0xc5660e[_0x6ce3('0x37')]:_0xc3ace2[_0x6ce3('0x34')];_0xc5660e['order']=qs[_0x6ce3('0x3e')](_0x40e49e['query'][_0x6ce3('0x3e')]);_0xc5660e[_0x6ce3('0x43')]=qs[_0x6ce3('0x3f')](_[_0x6ce3('0x40')](_0x40e49e[_0x6ce3('0x35')],_0xc3ace2[_0x6ce3('0x3f')]));if(_0x40e49e[_0x6ce3('0x35')][_0x6ce3('0x41')]){_0xc5660e[_0x6ce3('0x43')]=_[_0x6ce3('0x42')](_0xc5660e['where'],{'$or':_[_0x6ce3('0x30')](_0xc5660e[_0x6ce3('0x37')],function(_0x265e62){var _0x30ed7d={};_0x30ed7d[_0x265e62]={'$like':'%'+_0x40e49e[_0x6ce3('0x35')][_0x6ce3('0x41')]+'%'};return _0x30ed7d;})});}_0xc5660e=_[_0x6ce3('0x42')]({},_0xc5660e,_0x40e49e[_0x6ce3('0x44')]);return _0x1d4d04[_0x6ce3('0x58')](_0xc5660e);}})[_0x6ce3('0x1a')](function(_0x35ec45){if(_0x35ec45){_0x310301=_0x35ec45['length'];if(!_0x40e49e[_0x6ce3('0x35')]['hasOwnProperty']('nolimit')){_0xc5660e[_0x6ce3('0x3c')]=qs[_0x6ce3('0x3c')](_0x40e49e[_0x6ce3('0x35')]['limit']);_0xc5660e[_0x6ce3('0x25')]=qs[_0x6ce3('0x25')](_0x40e49e[_0x6ce3('0x35')][_0x6ce3('0x25')]);}return _0x1d4d04[_0x6ce3('0x58')](_0xc5660e);}})[_0x6ce3('0x1a')](function(_0x4f877b){if(_0x4f877b){return _0x4f877b?{'count':_0x310301,'rows':_0x4f877b}:null;}})[_0x6ce3('0x1a')](respondWithResult(_0x552d01,null))['catch'](handleError(_0x552d01,null));};exports[_0x6ce3('0x59')]=function(_0x22f96b,_0x50a2ed,_0x4d8ca1){if(_0x22f96b[_0x6ce3('0x50')]['id']){delete _0x22f96b[_0x6ce3('0x50')]['id'];}return db[_0x6ce3('0x31')][_0x6ce3('0x51')]({'where':{'id':_0x22f96b['params']['id']}})[_0x6ce3('0x1a')](handleEntityNotFound(_0x50a2ed,null))[_0x6ce3('0x1a')](function(_0x12735f){if(_0x12735f){return _0x12735f[_0x6ce3('0x59')](_0x22f96b[_0x6ce3('0x50')][_0x6ce3('0x5a')]||[]);}return null;})['then'](respondWithResult(_0x50a2ed,null))[_0x6ce3('0x49')](handleError(_0x50a2ed,null));}; \ No newline at end of file +var _0xd276=['pick','filter','VIRTUAL','options','includeAll','include','FreshdeskConfiguration','findAll','rows','show','params','rawAttributes','filtears','merge','find','create','body','update','findOne','FreshdeskField','sort','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','stack','name','send','map','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','where'];(function(_0x104f33,_0x34ef8a){var _0x21073d=function(_0x30c8f9){while(--_0x30c8f9){_0x104f33['push'](_0x104f33['shift']());}};_0x21073d(++_0x34ef8a);}(_0xd276,0x1f2));var _0x6d27=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xd276[_0x4ea69d];return _0x5318e0;};'use strict';var pdf=require(_0x6d27('0x0'));var emlformat=require(_0x6d27('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6d27('0x2'));var jsonpatch=require(_0x6d27('0x3'));var rp=require(_0x6d27('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6d27('0x5'));var util=require(_0x6d27('0x6'));var path=require(_0x6d27('0x7'));var sox=require(_0x6d27('0x8'));var csv=require('to-csv');var ejs=require(_0x6d27('0x9'));var fs=require('fs');var _=require(_0x6d27('0xa'));var squel=require(_0x6d27('0xb'));var crypto=require(_0x6d27('0xc'));var jsforce=require(_0x6d27('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6d27('0xe'));var querystring=require('querystring');var Papa=require(_0x6d27('0xf'));var Redis=require(_0x6d27('0x10'));var authService=require(_0x6d27('0x11'));var qs=require(_0x6d27('0x12'));var as=require(_0x6d27('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6d27('0x14'));var utils=require(_0x6d27('0x15'));var config=require(_0x6d27('0x16'));var licenseUtil=require(_0x6d27('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x6d27('0x18'));var client=jayson['client'][_0x6d27('0x19')]({'port':0x232a});function respondWithRpcPromise(_0xb4ffec,_0x3c2e4e,_0x34bd5c,_0x2f814f){return new BPromise(function(_0x1391fb,_0x1b20ff){var _0x290190=_0x2f814f||client;return _0x290190['request'](_0xb4ffec,_0x34bd5c)[_0x6d27('0x1a')](function(_0x353684){logger[_0x6d27('0x1b')](_0x6d27('0x1c'),_0x3c2e4e,_0x6d27('0x1d'));logger['debug'](_0x6d27('0x1e'),_0x3c2e4e,_0x6d27('0x1d'),JSON['stringify'](_0x353684));if(_0x353684[_0x6d27('0x1f')]){if(_0x353684[_0x6d27('0x1f')][_0x6d27('0x20')]===0x1f4){logger[_0x6d27('0x1f')](_0x6d27('0x1c'),_0x3c2e4e,_0x353684[_0x6d27('0x1f')]['message']);return _0x1b20ff(_0x353684['error'][_0x6d27('0x21')]);}logger[_0x6d27('0x1f')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3c2e4e,_0x353684['error'][_0x6d27('0x21')]);return _0x1391fb(_0x353684[_0x6d27('0x1f')][_0x6d27('0x21')]);}else{logger[_0x6d27('0x1b')](_0x6d27('0x1c'),_0x3c2e4e,_0x6d27('0x1d'));_0x1391fb(_0x353684[_0x6d27('0x22')][_0x6d27('0x21')]);}})[_0x6d27('0x23')](function(_0x4c5b2e){logger[_0x6d27('0x1f')](_0x6d27('0x1c'),_0x3c2e4e,_0x4c5b2e);_0x1b20ff(_0x4c5b2e);});});}function respondWithStatusCode(_0x23f849,_0x2792bc){_0x2792bc=_0x2792bc||0xcc;return function(_0x4c122f){if(_0x4c122f){return _0x23f849[_0x6d27('0x24')](_0x2792bc);}return _0x23f849['status'](_0x2792bc)[_0x6d27('0x25')]();};}function respondWithResult(_0x1f27bb,_0x2d9c21){_0x2d9c21=_0x2d9c21||0xc8;return function(_0x5a7926){if(_0x5a7926){return _0x1f27bb[_0x6d27('0x26')](_0x2d9c21)[_0x6d27('0x27')](_0x5a7926);}};}function respondWithFilteredResult(_0x132265,_0x2494e7){return function(_0x31d5a1){if(_0x31d5a1){var _0xfb91e=_0x31d5a1[_0x6d27('0x28')],_0x1cbfc1=_0x2494e7[_0x6d27('0x29')],_0x23a09c=_0x2494e7['offset']+_0x2494e7['limit'],_0x37ff78;if(_0x23a09c>=_0xfb91e){_0x23a09c=_0xfb91e;_0x37ff78=0xc8;}else{_0x37ff78=0xce;}_0x132265[_0x6d27('0x26')](_0x37ff78);return _0x132265[_0x6d27('0x2a')](_0x6d27('0x2b'),_0x1cbfc1+'-'+_0x23a09c+'/'+_0xfb91e)[_0x6d27('0x27')](_0x31d5a1);}return null;};}function patchUpdates(_0x356474){return function(_0x5b0043){try{jsonpatch[_0x6d27('0x2c')](_0x5b0043,_0x356474,!![]);}catch(_0xf410a8){return BPromise[_0x6d27('0x2d')](_0xf410a8);}return _0x5b0043[_0x6d27('0x2e')]();};}function saveUpdates(_0x46f359,_0x36ede2){return function(_0x289831){if(_0x289831){return _0x289831['update'](_0x46f359)[_0x6d27('0x1a')](function(_0x2bb19b){return _0x2bb19b;});}return null;};}function removeEntity(_0x9aed8,_0x3a1792){return function(_0x798041){if(_0x798041){return _0x798041['destroy']()[_0x6d27('0x1a')](function(){_0x9aed8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e94ab,_0x6b9879){return function(_0x24ff00){if(!_0x24ff00){_0x1e94ab['sendStatus'](0x194);}return _0x24ff00;};}function handleError(_0x21f9be,_0x6f11b6){_0x6f11b6=_0x6f11b6||0x1f4;return function(_0x23666e){logger[_0x6d27('0x1f')](_0x23666e[_0x6d27('0x2f')]);if(_0x23666e[_0x6d27('0x30')]){delete _0x23666e['name'];}_0x21f9be[_0x6d27('0x26')](_0x6f11b6)[_0x6d27('0x31')](_0x23666e);};}exports['index']=function(_0xbaa252,_0x3a7a96){var _0x35768f={},_0x196c0e={},_0x2678c5={'count':0x0,'rows':[]};var _0xb0b4=_[_0x6d27('0x32')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x1ccab8){return{'name':_0x1ccab8[_0x6d27('0x33')],'type':_0x1ccab8['type'][_0x6d27('0x34')]};});_0x196c0e[_0x6d27('0x35')]=_['map'](_0xb0b4,_0x6d27('0x30'));_0x196c0e[_0x6d27('0x36')]=_[_0x6d27('0x37')](_0xbaa252[_0x6d27('0x36')]);_0x196c0e[_0x6d27('0x38')]=_['intersection'](_0x196c0e[_0x6d27('0x35')],_0x196c0e[_0x6d27('0x36')]);_0x35768f[_0x6d27('0x39')]=_[_0x6d27('0x3a')](_0x196c0e[_0x6d27('0x35')],qs[_0x6d27('0x3b')](_0xbaa252['query']['fields']));_0x35768f[_0x6d27('0x39')]=_0x35768f[_0x6d27('0x39')][_0x6d27('0x3c')]?_0x35768f[_0x6d27('0x39')]:_0x196c0e[_0x6d27('0x35')];if(!_0xbaa252['query'][_0x6d27('0x3d')](_0x6d27('0x3e'))){_0x35768f[_0x6d27('0x3f')]=qs[_0x6d27('0x3f')](_0xbaa252['query'][_0x6d27('0x3f')]);_0x35768f[_0x6d27('0x29')]=qs['offset'](_0xbaa252['query'][_0x6d27('0x29')]);}_0x35768f[_0x6d27('0x40')]=qs['sort'](_0xbaa252[_0x6d27('0x36')]['sort']);_0x35768f[_0x6d27('0x41')]=qs[_0x6d27('0x38')](_[_0x6d27('0x42')](_0xbaa252[_0x6d27('0x36')],_0x196c0e[_0x6d27('0x38')]),_0xb0b4);if(_0xbaa252['query'][_0x6d27('0x43')]){_0x35768f['where']=_['merge'](_0x35768f[_0x6d27('0x41')],{'$or':_[_0x6d27('0x32')](_0xb0b4,function(_0x4bdc8f){if(_0x4bdc8f['type']!==_0x6d27('0x44')){var _0x3255c3={};_0x3255c3[_0x4bdc8f[_0x6d27('0x30')]]={'$like':'%'+_0xbaa252['query']['filter']+'%'};return _0x3255c3;}})});}_0x35768f=_['merge']({},_0x35768f,_0xbaa252[_0x6d27('0x45')]);var _0x5bf971={'where':_0x35768f[_0x6d27('0x41')]};return db['FreshdeskConfiguration'][_0x6d27('0x28')](_0x5bf971)[_0x6d27('0x1a')](function(_0x5eb643){_0x2678c5['count']=_0x5eb643;if(_0xbaa252[_0x6d27('0x36')][_0x6d27('0x46')]){_0x35768f[_0x6d27('0x47')]=[{'all':!![]}];}return db[_0x6d27('0x48')][_0x6d27('0x49')](_0x35768f);})[_0x6d27('0x1a')](function(_0xa58c73){_0x2678c5[_0x6d27('0x4a')]=_0xa58c73;return _0x2678c5;})['then'](respondWithFilteredResult(_0x3a7a96,_0x35768f))[_0x6d27('0x23')](handleError(_0x3a7a96,null));};exports[_0x6d27('0x4b')]=function(_0x1abe4f,_0x7d4b69){var _0x8fba7f={'raw':![],'where':{'id':_0x1abe4f[_0x6d27('0x4c')]['id']}},_0x1d2174={};_0x1d2174[_0x6d27('0x35')]=_['keys'](db[_0x6d27('0x48')][_0x6d27('0x4d')]);_0x1d2174[_0x6d27('0x36')]=_[_0x6d27('0x37')](_0x1abe4f[_0x6d27('0x36')]);_0x1d2174[_0x6d27('0x4e')]=_[_0x6d27('0x3a')](_0x1d2174['model'],_0x1d2174[_0x6d27('0x36')]);_0x8fba7f[_0x6d27('0x39')]=_[_0x6d27('0x3a')](_0x1d2174['model'],qs[_0x6d27('0x3b')](_0x1abe4f[_0x6d27('0x36')]['fields']));_0x8fba7f['attributes']=_0x8fba7f[_0x6d27('0x39')][_0x6d27('0x3c')]?_0x8fba7f[_0x6d27('0x39')]:_0x1d2174[_0x6d27('0x35')];if(_0x1abe4f[_0x6d27('0x36')][_0x6d27('0x46')]){_0x8fba7f['include']=[{'all':!![]}];}_0x8fba7f=_[_0x6d27('0x4f')]({},_0x8fba7f,_0x1abe4f[_0x6d27('0x45')]);return db[_0x6d27('0x48')][_0x6d27('0x50')](_0x8fba7f)[_0x6d27('0x1a')](handleEntityNotFound(_0x7d4b69,null))[_0x6d27('0x1a')](respondWithResult(_0x7d4b69,null))[_0x6d27('0x23')](handleError(_0x7d4b69,null));};exports[_0x6d27('0x51')]=function(_0x1e5d5d,_0x2290e9){return db['FreshdeskConfiguration'][_0x6d27('0x51')](_0x1e5d5d[_0x6d27('0x52')],{})[_0x6d27('0x1a')](respondWithResult(_0x2290e9,0xc9))[_0x6d27('0x23')](handleError(_0x2290e9,null));};exports[_0x6d27('0x53')]=function(_0x567daa,_0x21d0ef){if(_0x567daa['body']['id']){delete _0x567daa[_0x6d27('0x52')]['id'];}return db[_0x6d27('0x48')][_0x6d27('0x50')]({'where':{'id':_0x567daa[_0x6d27('0x4c')]['id']}})[_0x6d27('0x1a')](handleEntityNotFound(_0x21d0ef,null))[_0x6d27('0x1a')](saveUpdates(_0x567daa['body'],null))[_0x6d27('0x1a')](respondWithResult(_0x21d0ef,null))[_0x6d27('0x23')](handleError(_0x21d0ef,null));};exports['destroy']=function(_0x3b5a18,_0x2d4e2d){return db[_0x6d27('0x48')][_0x6d27('0x50')]({'where':{'id':_0x3b5a18[_0x6d27('0x4c')]['id']}})[_0x6d27('0x1a')](handleEntityNotFound(_0x2d4e2d,null))[_0x6d27('0x1a')](removeEntity(_0x2d4e2d,null))['catch'](handleError(_0x2d4e2d,null));};exports['getFields']=function(_0x493164,_0x45a9b1,_0x2e5dc1){var _0x3af9dc={};var _0x1d46ed={};var _0x1d783c;var _0x208740;return db['FreshdeskConfiguration'][_0x6d27('0x54')]({'where':{'id':_0x493164[_0x6d27('0x4c')]['id']}})[_0x6d27('0x1a')](handleEntityNotFound(_0x45a9b1,null))[_0x6d27('0x1a')](function(_0xf786b9){if(_0xf786b9){_0x1d783c=_0xf786b9;_0x1d46ed['model']=_[_0x6d27('0x37')](db[_0x6d27('0x55')][_0x6d27('0x4d')]);_0x1d46ed[_0x6d27('0x36')]=_[_0x6d27('0x37')](_0x493164[_0x6d27('0x36')]);_0x1d46ed[_0x6d27('0x38')]=_[_0x6d27('0x3a')](_0x1d46ed['model'],_0x1d46ed[_0x6d27('0x36')]);_0x3af9dc[_0x6d27('0x39')]=_[_0x6d27('0x3a')](_0x1d46ed['model'],qs['fields'](_0x493164['query'][_0x6d27('0x3b')]));_0x3af9dc[_0x6d27('0x39')]=_0x3af9dc['attributes']['length']?_0x3af9dc[_0x6d27('0x39')]:_0x1d46ed[_0x6d27('0x35')];_0x3af9dc['order']=qs[_0x6d27('0x56')](_0x493164['query']['sort']);_0x3af9dc['where']=qs['filters'](_[_0x6d27('0x42')](_0x493164['query'],_0x1d46ed[_0x6d27('0x38')]));if(_0x493164[_0x6d27('0x36')][_0x6d27('0x43')]){_0x3af9dc[_0x6d27('0x41')]=_[_0x6d27('0x4f')](_0x3af9dc[_0x6d27('0x41')],{'$or':_[_0x6d27('0x32')](_0x3af9dc[_0x6d27('0x39')],function(_0x4be162){var _0x14c10d={};_0x14c10d[_0x4be162]={'$like':'%'+_0x493164['query']['filter']+'%'};return _0x14c10d;})});}_0x3af9dc=_['merge']({},_0x3af9dc,_0x493164[_0x6d27('0x45')]);return _0x1d783c[_0x6d27('0x57')](_0x3af9dc);}})[_0x6d27('0x1a')](function(_0x2748c7){if(_0x2748c7){_0x208740=_0x2748c7[_0x6d27('0x3c')];if(!_0x493164[_0x6d27('0x36')][_0x6d27('0x3d')](_0x6d27('0x3e'))){_0x3af9dc['limit']=qs[_0x6d27('0x3f')](_0x493164[_0x6d27('0x36')][_0x6d27('0x3f')]);_0x3af9dc['offset']=qs['offset'](_0x493164[_0x6d27('0x36')]['offset']);}return _0x1d783c[_0x6d27('0x57')](_0x3af9dc);}})['then'](function(_0x115e91){if(_0x115e91){return _0x115e91?{'count':_0x208740,'rows':_0x115e91}:null;}})[_0x6d27('0x1a')](respondWithResult(_0x45a9b1,null))['catch'](handleError(_0x45a9b1,null));};exports[_0x6d27('0x58')]=function(_0x2d5d63,_0x3830b9,_0x3690a5){var _0x465d21={};var _0x1c4ccc={};var _0x34c852;var _0x36bf3c;return db['FreshdeskConfiguration'][_0x6d27('0x54')]({'where':{'id':_0x2d5d63['params']['id']}})[_0x6d27('0x1a')](handleEntityNotFound(_0x3830b9,null))[_0x6d27('0x1a')](function(_0x328ec1){if(_0x328ec1){_0x34c852=_0x328ec1;_0x1c4ccc[_0x6d27('0x35')]=_['keys'](db[_0x6d27('0x55')][_0x6d27('0x4d')]);_0x1c4ccc[_0x6d27('0x36')]=_['keys'](_0x2d5d63['query']);_0x1c4ccc[_0x6d27('0x38')]=_[_0x6d27('0x3a')](_0x1c4ccc['model'],_0x1c4ccc[_0x6d27('0x36')]);_0x465d21[_0x6d27('0x39')]=_[_0x6d27('0x3a')](_0x1c4ccc[_0x6d27('0x35')],qs[_0x6d27('0x3b')](_0x2d5d63[_0x6d27('0x36')]['fields']));_0x465d21[_0x6d27('0x39')]=_0x465d21[_0x6d27('0x39')][_0x6d27('0x3c')]?_0x465d21[_0x6d27('0x39')]:_0x1c4ccc[_0x6d27('0x35')];_0x465d21['order']=qs[_0x6d27('0x56')](_0x2d5d63[_0x6d27('0x36')]['sort']);_0x465d21[_0x6d27('0x41')]=qs['filters'](_[_0x6d27('0x42')](_0x2d5d63[_0x6d27('0x36')],_0x1c4ccc['filters']));if(_0x2d5d63[_0x6d27('0x36')][_0x6d27('0x43')]){_0x465d21[_0x6d27('0x41')]=_[_0x6d27('0x4f')](_0x465d21[_0x6d27('0x41')],{'$or':_[_0x6d27('0x32')](_0x465d21[_0x6d27('0x39')],function(_0x3af8a5){var _0x536486={};_0x536486[_0x3af8a5]={'$like':'%'+_0x2d5d63[_0x6d27('0x36')][_0x6d27('0x43')]+'%'};return _0x536486;})});}_0x465d21=_[_0x6d27('0x4f')]({},_0x465d21,_0x2d5d63[_0x6d27('0x45')]);return _0x34c852[_0x6d27('0x58')](_0x465d21);}})[_0x6d27('0x1a')](function(_0x12d546){if(_0x12d546){_0x36bf3c=_0x12d546[_0x6d27('0x3c')];if(!_0x2d5d63[_0x6d27('0x36')][_0x6d27('0x3d')](_0x6d27('0x3e'))){_0x465d21[_0x6d27('0x3f')]=qs['limit'](_0x2d5d63['query'][_0x6d27('0x3f')]);_0x465d21[_0x6d27('0x29')]=qs[_0x6d27('0x29')](_0x2d5d63[_0x6d27('0x36')]['offset']);}return _0x34c852['getSubjects'](_0x465d21);}})[_0x6d27('0x1a')](function(_0x4b34fc){if(_0x4b34fc){return _0x4b34fc?{'count':_0x36bf3c,'rows':_0x4b34fc}:null;}})[_0x6d27('0x1a')](respondWithResult(_0x3830b9,null))[_0x6d27('0x23')](handleError(_0x3830b9,null));};exports[_0x6d27('0x59')]=function(_0x2bc32e,_0x38c6c1,_0x4097cd){var _0x518b13={};var _0xa00890={};var _0xe9e811;var _0x355614;return db[_0x6d27('0x48')]['findOne']({'where':{'id':_0x2bc32e[_0x6d27('0x4c')]['id']}})[_0x6d27('0x1a')](handleEntityNotFound(_0x38c6c1,null))[_0x6d27('0x1a')](function(_0xf8b3e0){if(_0xf8b3e0){_0xe9e811=_0xf8b3e0;_0xa00890[_0x6d27('0x35')]=_['keys'](db[_0x6d27('0x55')][_0x6d27('0x4d')]);_0xa00890['query']=_[_0x6d27('0x37')](_0x2bc32e[_0x6d27('0x36')]);_0xa00890[_0x6d27('0x38')]=_[_0x6d27('0x3a')](_0xa00890[_0x6d27('0x35')],_0xa00890[_0x6d27('0x36')]);_0x518b13[_0x6d27('0x39')]=_['intersection'](_0xa00890[_0x6d27('0x35')],qs[_0x6d27('0x3b')](_0x2bc32e['query'][_0x6d27('0x3b')]));_0x518b13[_0x6d27('0x39')]=_0x518b13[_0x6d27('0x39')][_0x6d27('0x3c')]?_0x518b13[_0x6d27('0x39')]:_0xa00890[_0x6d27('0x35')];_0x518b13['order']=qs[_0x6d27('0x56')](_0x2bc32e['query'][_0x6d27('0x56')]);_0x518b13[_0x6d27('0x41')]=qs[_0x6d27('0x38')](_[_0x6d27('0x42')](_0x2bc32e[_0x6d27('0x36')],_0xa00890[_0x6d27('0x38')]));if(_0x2bc32e['query'][_0x6d27('0x43')]){_0x518b13[_0x6d27('0x41')]=_['merge'](_0x518b13[_0x6d27('0x41')],{'$or':_[_0x6d27('0x32')](_0x518b13[_0x6d27('0x39')],function(_0x37f209){var _0x2c2e93={};_0x2c2e93[_0x37f209]={'$like':'%'+_0x2bc32e[_0x6d27('0x36')][_0x6d27('0x43')]+'%'};return _0x2c2e93;})});}_0x518b13=_[_0x6d27('0x4f')]({},_0x518b13,_0x2bc32e[_0x6d27('0x45')]);return _0xe9e811[_0x6d27('0x59')](_0x518b13);}})['then'](function(_0x51693b){if(_0x51693b){_0x355614=_0x51693b[_0x6d27('0x3c')];if(!_0x2bc32e[_0x6d27('0x36')][_0x6d27('0x3d')](_0x6d27('0x3e'))){_0x518b13[_0x6d27('0x3f')]=qs['limit'](_0x2bc32e[_0x6d27('0x36')][_0x6d27('0x3f')]);_0x518b13[_0x6d27('0x29')]=qs[_0x6d27('0x29')](_0x2bc32e[_0x6d27('0x36')][_0x6d27('0x29')]);}return _0xe9e811[_0x6d27('0x59')](_0x518b13);}})['then'](function(_0x4ab1ba){if(_0x4ab1ba){return _0x4ab1ba?{'count':_0x355614,'rows':_0x4ab1ba}:null;}})[_0x6d27('0x1a')](respondWithResult(_0x38c6c1,null))['catch'](handleError(_0x38c6c1,null));};exports[_0x6d27('0x5a')]=function(_0x4f7fb6,_0x319c26,_0xa223be){var _0xd53fd5={};var _0x113b77={};var _0x41652d;var _0x29125a;return db[_0x6d27('0x48')][_0x6d27('0x54')]({'where':{'id':_0x4f7fb6['params']['id']}})[_0x6d27('0x1a')](handleEntityNotFound(_0x319c26,null))['then'](function(_0x331f49){if(_0x331f49){_0x41652d=_0x331f49;_0x113b77['model']=_['keys'](db[_0x6d27('0x5b')][_0x6d27('0x4d')]);_0x113b77[_0x6d27('0x36')]=_[_0x6d27('0x37')](_0x4f7fb6['query']);_0x113b77[_0x6d27('0x38')]=_['intersection'](_0x113b77[_0x6d27('0x35')],_0x113b77[_0x6d27('0x36')]);_0xd53fd5[_0x6d27('0x39')]=_[_0x6d27('0x3a')](_0x113b77['model'],qs['fields'](_0x4f7fb6[_0x6d27('0x36')][_0x6d27('0x3b')]));_0xd53fd5[_0x6d27('0x39')]=_0xd53fd5[_0x6d27('0x39')][_0x6d27('0x3c')]?_0xd53fd5[_0x6d27('0x39')]:_0x113b77['model'];_0xd53fd5[_0x6d27('0x40')]=qs[_0x6d27('0x56')](_0x4f7fb6['query'][_0x6d27('0x56')]);_0xd53fd5[_0x6d27('0x41')]=qs[_0x6d27('0x38')](_[_0x6d27('0x42')](_0x4f7fb6[_0x6d27('0x36')],_0x113b77['filters']));if(_0x4f7fb6[_0x6d27('0x36')]['filter']){_0xd53fd5[_0x6d27('0x41')]=_[_0x6d27('0x4f')](_0xd53fd5[_0x6d27('0x41')],{'$or':_[_0x6d27('0x32')](_0xd53fd5[_0x6d27('0x39')],function(_0x51901b){var _0x172a2c={};_0x172a2c[_0x51901b]={'$like':'%'+_0x4f7fb6['query']['filter']+'%'};return _0x172a2c;})});}_0xd53fd5=_[_0x6d27('0x4f')]({},_0xd53fd5,_0x4f7fb6[_0x6d27('0x45')]);return _0x41652d[_0x6d27('0x5a')](_0xd53fd5);}})[_0x6d27('0x1a')](function(_0x17336d){if(_0x17336d){_0x29125a=_0x17336d[_0x6d27('0x3c')];if(!_0x4f7fb6[_0x6d27('0x36')][_0x6d27('0x3d')](_0x6d27('0x3e'))){_0xd53fd5[_0x6d27('0x3f')]=qs[_0x6d27('0x3f')](_0x4f7fb6['query'][_0x6d27('0x3f')]);_0xd53fd5[_0x6d27('0x29')]=qs[_0x6d27('0x29')](_0x4f7fb6[_0x6d27('0x36')][_0x6d27('0x29')]);}return _0x41652d[_0x6d27('0x5a')](_0xd53fd5);}})[_0x6d27('0x1a')](function(_0x448a93){if(_0x448a93){return _0x448a93?{'count':_0x29125a,'rows':_0x448a93}:null;}})['then'](respondWithResult(_0x319c26,null))[_0x6d27('0x23')](handleError(_0x319c26,null));};exports[_0x6d27('0x5c')]=function(_0x128c47,_0x365065,_0x33f8ed){if(_0x128c47['body']['id']){delete _0x128c47[_0x6d27('0x52')]['id'];}return db['FreshdeskConfiguration'][_0x6d27('0x54')]({'where':{'id':_0x128c47['params']['id']}})[_0x6d27('0x1a')](handleEntityNotFound(_0x365065,null))['then'](function(_0x1b6ac3){if(_0x1b6ac3){return _0x1b6ac3['setTags'](_0x128c47[_0x6d27('0x52')][_0x6d27('0x5d')]||[]);}return null;})[_0x6d27('0x1a')](respondWithResult(_0x365065,null))[_0x6d27('0x23')](handleError(_0x365065,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 8f1ea91..8f7cfde 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 _0xc642=['FreshdeskConfiguration','lodash','util','../../config/logger','api','moment','request-promise','path','./intFreshdeskConfiguration.attributes','define'];(function(_0x55034e,_0x2037db){var _0x3c14f5=function(_0x4396a7){while(--_0x4396a7){_0x55034e['push'](_0x55034e['shift']());}};_0x3c14f5(++_0x2037db);}(_0xc642,0x187));var _0x2c64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc642[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2c64('0x0'));var util=require(_0x2c64('0x1'));var logger=require(_0x2c64('0x2'))(_0x2c64('0x3'));var moment=require(_0x2c64('0x4'));var BPromise=require('bluebird');var rp=require(_0x2c64('0x5'));var fs=require('fs');var path=require(_0x2c64('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2c64('0x7'));module['exports']=function(_0x4d7136,_0x5e6a63){return _0x4d7136[_0x2c64('0x8')](_0x2c64('0x9'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb50=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','lodash','util'];(function(_0x573eae,_0x5f103f){var _0x2be09c=function(_0x70c4bd){while(--_0x70c4bd){_0x573eae['push'](_0x573eae['shift']());}};_0x2be09c(++_0x5f103f);}(_0xdb50,0x1df));var _0x0db5=function(_0x56245e,_0x4d009c){_0x56245e=_0x56245e-0x0;var _0x1cf81e=_0xdb50[_0x56245e];return _0x1cf81e;};'use strict';var _=require(_0x0db5('0x0'));var util=require(_0x0db5('0x1'));var logger=require(_0x0db5('0x2'))(_0x0db5('0x3'));var moment=require(_0x0db5('0x4'));var BPromise=require(_0x0db5('0x5'));var rp=require(_0x0db5('0x6'));var fs=require('fs');var path=require(_0x0db5('0x7'));var rimraf=require(_0x0db5('0x8'));var config=require('../../config/environment');var attributes=require(_0x0db5('0x9'));module[_0x0db5('0xa')]=function(_0xe8143,_0x5c0f13){return _0xe8143[_0x0db5('0xb')](_0x0db5('0xc'),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 e0fb34e..c159ed9 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 _0x8cd1=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x1aa177,_0x1ca1f8){var _0x413972=function(_0x1dcd45){while(--_0x1dcd45){_0x1aa177['push'](_0x1aa177['shift']());}};_0x413972(++_0x1ca1f8);}(_0x8cd1,0xe1));var _0x18cd=function(_0x33fb23,_0x1084e2){_0x33fb23=_0x33fb23-0x0;var _0x1550a5=_0x8cd1[_0x33fb23];return _0x1550a5;};'use strict';var _=require(_0x18cd('0x0'));var util=require(_0x18cd('0x1'));var moment=require(_0x18cd('0x2'));var BPromise=require(_0x18cd('0x3'));var rs=require(_0x18cd('0x4'));var fs=require('fs');var Redis=require(_0x18cd('0x5'));var db=require(_0x18cd('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x18cd('0x7'));var jayson=require(_0x18cd('0x8'));var client=jayson[_0x18cd('0x9')][_0x18cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5708da,_0x302177,_0x501e8c){return new BPromise(function(_0x3e42fe,_0x5e73ea){return client[_0x18cd('0xb')](_0x5708da,_0x501e8c)['then'](function(_0x5ee2fa){logger['info'](_0x18cd('0xc'),_0x302177,_0x18cd('0xd'));logger['debug'](_0x18cd('0xe'),_0x302177,_0x18cd('0xd'),JSON[_0x18cd('0xf')](_0x5ee2fa));if(_0x5ee2fa[_0x18cd('0x10')]){if(_0x5ee2fa[_0x18cd('0x10')][_0x18cd('0x11')]===0x1f4){logger[_0x18cd('0x10')](_0x18cd('0xc'),_0x302177,_0x5ee2fa[_0x18cd('0x10')]['message']);return _0x5e73ea(_0x5ee2fa[_0x18cd('0x10')][_0x18cd('0x12')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x302177,_0x5ee2fa['error'][_0x18cd('0x12')]);return _0x3e42fe(_0x5ee2fa[_0x18cd('0x10')]['message']);}else{logger['info'](_0x18cd('0xc'),_0x302177,_0x18cd('0xd'));_0x3e42fe(_0x5ee2fa['result'][_0x18cd('0x12')]);}})[_0x18cd('0x13')](function(_0x45979d){logger[_0x18cd('0x10')](_0x18cd('0xc'),_0x302177,_0x45979d);_0x5e73ea(_0x45979d);});});} \ No newline at end of file +var _0x22e0=['catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x22e0,0x190));var _0x022e=function(_0x41f51f,_0x3af801){_0x41f51f=_0x41f51f-0x0;var _0x27a041=_0x22e0[_0x41f51f];return _0x27a041;};'use strict';var _=require(_0x022e('0x0'));var util=require(_0x022e('0x1'));var moment=require(_0x022e('0x2'));var BPromise=require('bluebird');var rs=require(_0x022e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x022e('0x4'));var logger=require(_0x022e('0x5'))(_0x022e('0x6'));var config=require(_0x022e('0x7'));var jayson=require(_0x022e('0x8'));var client=jayson[_0x022e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x158a7d,_0x18ebf1,_0x5256f1){return new BPromise(function(_0x5dd24e,_0x17f0e0){return client[_0x022e('0xa')](_0x158a7d,_0x5256f1)[_0x022e('0xb')](function(_0x53cc04){logger[_0x022e('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x18ebf1,_0x022e('0xd'));logger['debug'](_0x022e('0xe'),_0x18ebf1,_0x022e('0xd'),JSON['stringify'](_0x53cc04));if(_0x53cc04[_0x022e('0xf')]){if(_0x53cc04['error'][_0x022e('0x10')]===0x1f4){logger['error'](_0x022e('0x11'),_0x18ebf1,_0x53cc04['error'][_0x022e('0x12')]);return _0x17f0e0(_0x53cc04[_0x022e('0xf')]['message']);}logger[_0x022e('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x18ebf1,_0x53cc04['error']['message']);return _0x5dd24e(_0x53cc04['error'][_0x022e('0x12')]);}else{logger[_0x022e('0xc')](_0x022e('0x11'),_0x18ebf1,_0x022e('0xd'));_0x5dd24e(_0x53cc04[_0x022e('0x13')][_0x022e('0x12')]);}})[_0x022e('0x14')](function(_0x326bdd){logger[_0x022e('0xf')](_0x022e('0x11'),_0x18ebf1,_0x326bdd);_0x17f0e0(_0x326bdd);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index b96cffc..5b4757e 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(_0x3b7772,_0x468c2d){var _0x5f2508=function(_0x514b76){while(--_0x514b76){_0x3b7772['push'](_0x3b7772['shift']());}};_0x5f2508(++_0x468c2d);}(_0x008c,0x188));var _0xc008=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0x008c[_0x585d81];return _0x1aca0d;};'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 _0x70e0=['create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','post','isAuthenticated'];(function(_0x380af2,_0x36cf66){var _0x1789dc=function(_0x37b604){while(--_0x37b604){_0x380af2['push'](_0x380af2['shift']());}};_0x1789dc(++_0x36cf66);}(_0x70e0,0x17b));var _0x070e=function(_0xf0f939,_0x55199a){_0xf0f939=_0xf0f939-0x0;var _0x5c2849=_0x70e0[_0xf0f939];return _0x5c2849;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./intFreshdeskField.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0xa')]('/',auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')](_0x070e('0xe'),auth[_0x070e('0xb')](),controller['update']);router['delete'](_0x070e('0xe'),auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);module[_0x070e('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 56fc275..69b6ff9 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 _0x1952=['STRING','customVariable','exports','ENUM','variable','keyValue'];(function(_0x2c7d41,_0x199e65){var _0x882f7e=function(_0x58c0e8){while(--_0x58c0e8){_0x2c7d41['push'](_0x2c7d41['shift']());}};_0x882f7e(++_0x199e65);}(_0x1952,0x92));var _0x2195=function(_0x204714,_0x124c3d){_0x204714=_0x204714-0x0;var _0x5da297=_0x1952[_0x204714];return _0x5da297;};'use strict';var Sequelize=require('sequelize');module[_0x2195('0x0')]={'type':{'type':Sequelize[_0x2195('0x1')]('string',_0x2195('0x2'),'customVariable',_0x2195('0x3')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2195('0x4')]},'keyType':{'type':Sequelize[_0x2195('0x1')]('string',_0x2195('0x2'),_0x2195('0x5'))},'keyContent':{'type':Sequelize[_0x2195('0x4')]},'idField':{'type':Sequelize[_0x2195('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2195('0x4')]}}; \ No newline at end of file +var _0x4e8e=['customVariable','keyValue','string','STRING','ENUM','sequelize','exports','variable'];(function(_0x3b7fb0,_0x553e21){var _0x3b7fc5=function(_0x286bdc){while(--_0x286bdc){_0x3b7fb0['push'](_0x3b7fb0['shift']());}};_0x3b7fc5(++_0x553e21);}(_0x4e8e,0x95));var _0xe4e8=function(_0x417b71,_0x3a90eb){_0x417b71=_0x417b71-0x0;var _0x15cf17=_0x4e8e[_0x417b71];return _0x15cf17;};'use strict';var Sequelize=require(_0xe4e8('0x0'));module[_0xe4e8('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xe4e8('0x2'),_0xe4e8('0x3'),_0xe4e8('0x4')),'defaultValue':_0xe4e8('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe4e8('0x6')]},'keyType':{'type':Sequelize[_0xe4e8('0x7')](_0xe4e8('0x5'),'variable',_0xe4e8('0x3'))},'keyContent':{'type':Sequelize[_0xe4e8('0x6')]},'idField':{'type':Sequelize[_0xe4e8('0x6')]},'nameField':{'type':Sequelize[_0xe4e8('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe4e8('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 0dfe0e1..18c825a 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 _0xa405=['stack','name','send','index','map','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','offset','sort','where','pick','filters','filter','VIRTUAL','options','FreshdeskField','count','includeAll','findAll','rows','show','keys','filtears','include','merge','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','limit','Content-Range','json','apply','reject','save','update','then','destroy','end','error'];(function(_0x29e6b5,_0x50eedf){var _0x45ab22=function(_0x1e3a5b){while(--_0x1e3a5b){_0x29e6b5['push'](_0x29e6b5['shift']());}};_0x45ab22(++_0x50eedf);}(_0xa405,0x1ca));var _0x5a40=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa405[_0x4b369d];return _0x571a98;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5a40('0x0'));var rimraf=require(_0x5a40('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5a40('0x2'));var rp=require(_0x5a40('0x3'));var moment=require(_0x5a40('0x4'));var BPromise=require(_0x5a40('0x5'));var Mustache=require(_0x5a40('0x6'));var util=require('util');var path=require(_0x5a40('0x7'));var sox=require(_0x5a40('0x8'));var csv=require(_0x5a40('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5a40('0xa'));var deskjs=require(_0x5a40('0xb'));var toCsv=require(_0x5a40('0x9'));var querystring=require(_0x5a40('0xc'));var Papa=require(_0x5a40('0xd'));var Redis=require(_0x5a40('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a40('0xf'));var logger=require('../../config/logger')(_0x5a40('0x10'));var utils=require('../../config/utils');var config=require(_0x5a40('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a40('0x12'))['db'];function respondWithStatusCode(_0x9545d8,_0x519a31){_0x519a31=_0x519a31||0xcc;return function(_0x2c0a46){if(_0x2c0a46){return _0x9545d8[_0x5a40('0x13')](_0x519a31);}return _0x9545d8[_0x5a40('0x14')](_0x519a31)['end']();};}function respondWithResult(_0x3c655d,_0xec9a89){_0xec9a89=_0xec9a89||0xc8;return function(_0x14b1d2){if(_0x14b1d2){return _0x3c655d['status'](_0xec9a89)['json'](_0x14b1d2);}};}function respondWithFilteredResult(_0x56ec80,_0x12cc02){return function(_0x1181fe){if(_0x1181fe){var _0x1c0e57=_0x1181fe['count'],_0x20112f=_0x12cc02['offset'],_0x5a8270=_0x12cc02['offset']+_0x12cc02[_0x5a40('0x15')],_0x20e4c0;if(_0x5a8270>=_0x1c0e57){_0x5a8270=_0x1c0e57;_0x20e4c0=0xc8;}else{_0x20e4c0=0xce;}_0x56ec80[_0x5a40('0x14')](_0x20e4c0);return _0x56ec80['set'](_0x5a40('0x16'),_0x20112f+'-'+_0x5a8270+'/'+_0x1c0e57)[_0x5a40('0x17')](_0x1181fe);}return null;};}function patchUpdates(_0x3e0752){return function(_0x339b09){try{jsonpatch[_0x5a40('0x18')](_0x339b09,_0x3e0752,!![]);}catch(_0x51522c){return BPromise[_0x5a40('0x19')](_0x51522c);}return _0x339b09[_0x5a40('0x1a')]();};}function saveUpdates(_0x549ef7,_0x449af9){return function(_0x3ac314){if(_0x3ac314){return _0x3ac314[_0x5a40('0x1b')](_0x549ef7)[_0x5a40('0x1c')](function(_0x3a44c4){return _0x3a44c4;});}return null;};}function removeEntity(_0xa2f465,_0x49692a){return function(_0x1b50a9){if(_0x1b50a9){return _0x1b50a9[_0x5a40('0x1d')]()[_0x5a40('0x1c')](function(){_0xa2f465[_0x5a40('0x14')](0xcc)[_0x5a40('0x1e')]();});}};}function handleEntityNotFound(_0x4056b1,_0x2fdbf9){return function(_0x8ebf86){if(!_0x8ebf86){_0x4056b1[_0x5a40('0x13')](0x194);}return _0x8ebf86;};}function handleError(_0x4ca585,_0x14973d){_0x14973d=_0x14973d||0x1f4;return function(_0x6ee34c){logger[_0x5a40('0x1f')](_0x6ee34c[_0x5a40('0x20')]);if(_0x6ee34c[_0x5a40('0x21')]){delete _0x6ee34c[_0x5a40('0x21')];}_0x4ca585[_0x5a40('0x14')](_0x14973d)[_0x5a40('0x22')](_0x6ee34c);};}exports[_0x5a40('0x23')]=function(_0x36188d,_0x44ed8f){var _0x486b34={},_0x3e668c={},_0x49fa77={'count':0x0,'rows':[]};var _0x16dc8c=_[_0x5a40('0x24')](db['FreshdeskField']['rawAttributes'],function(_0x469e17){return{'name':_0x469e17[_0x5a40('0x25')],'type':_0x469e17[_0x5a40('0x26')][_0x5a40('0x27')]};});_0x3e668c[_0x5a40('0x28')]=_[_0x5a40('0x24')](_0x16dc8c,'name');_0x3e668c['query']=_['keys'](_0x36188d[_0x5a40('0x29')]);_0x3e668c['filters']=_[_0x5a40('0x2a')](_0x3e668c['model'],_0x3e668c[_0x5a40('0x29')]);_0x486b34[_0x5a40('0x2b')]=_[_0x5a40('0x2a')](_0x3e668c[_0x5a40('0x28')],qs['fields'](_0x36188d[_0x5a40('0x29')][_0x5a40('0x2c')]));_0x486b34[_0x5a40('0x2b')]=_0x486b34[_0x5a40('0x2b')][_0x5a40('0x2d')]?_0x486b34[_0x5a40('0x2b')]:_0x3e668c[_0x5a40('0x28')];if(!_0x36188d[_0x5a40('0x29')]['hasOwnProperty'](_0x5a40('0x2e'))){_0x486b34['limit']=qs['limit'](_0x36188d['query']['limit']);_0x486b34[_0x5a40('0x2f')]=qs[_0x5a40('0x2f')](_0x36188d[_0x5a40('0x29')]['offset']);}_0x486b34['order']=qs[_0x5a40('0x30')](_0x36188d[_0x5a40('0x29')][_0x5a40('0x30')]);_0x486b34[_0x5a40('0x31')]=qs['filters'](_[_0x5a40('0x32')](_0x36188d[_0x5a40('0x29')],_0x3e668c[_0x5a40('0x33')]),_0x16dc8c);if(_0x36188d[_0x5a40('0x29')][_0x5a40('0x34')]){_0x486b34['where']=_['merge'](_0x486b34[_0x5a40('0x31')],{'$or':_[_0x5a40('0x24')](_0x16dc8c,function(_0x33c1ed){if(_0x33c1ed['type']!==_0x5a40('0x35')){var _0x58d067={};_0x58d067[_0x33c1ed['name']]={'$like':'%'+_0x36188d[_0x5a40('0x29')][_0x5a40('0x34')]+'%'};return _0x58d067;}})});}_0x486b34=_['merge']({},_0x486b34,_0x36188d[_0x5a40('0x36')]);var _0x408e31={'where':_0x486b34['where']};return db[_0x5a40('0x37')][_0x5a40('0x38')](_0x408e31)[_0x5a40('0x1c')](function(_0x3a7716){_0x49fa77[_0x5a40('0x38')]=_0x3a7716;if(_0x36188d['query'][_0x5a40('0x39')]){_0x486b34['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x5a40('0x3a')](_0x486b34);})['then'](function(_0x1a860a){_0x49fa77[_0x5a40('0x3b')]=_0x1a860a;return _0x49fa77;})[_0x5a40('0x1c')](respondWithFilteredResult(_0x44ed8f,_0x486b34))['catch'](handleError(_0x44ed8f,null));};exports[_0x5a40('0x3c')]=function(_0x4279eb,_0x1f4a88){var _0x2c6efa={'raw':!![],'where':{'id':_0x4279eb['params']['id']}},_0x32081a={};_0x32081a['model']=_[_0x5a40('0x3d')](db['FreshdeskField']['rawAttributes']);_0x32081a[_0x5a40('0x29')]=_[_0x5a40('0x3d')](_0x4279eb[_0x5a40('0x29')]);_0x32081a[_0x5a40('0x3e')]=_[_0x5a40('0x2a')](_0x32081a[_0x5a40('0x28')],_0x32081a[_0x5a40('0x29')]);_0x2c6efa[_0x5a40('0x2b')]=_['intersection'](_0x32081a[_0x5a40('0x28')],qs['fields'](_0x4279eb['query'][_0x5a40('0x2c')]));_0x2c6efa[_0x5a40('0x2b')]=_0x2c6efa[_0x5a40('0x2b')][_0x5a40('0x2d')]?_0x2c6efa[_0x5a40('0x2b')]:_0x32081a[_0x5a40('0x28')];if(_0x4279eb[_0x5a40('0x29')][_0x5a40('0x39')]){_0x2c6efa[_0x5a40('0x3f')]=[{'all':!![]}];}_0x2c6efa=_[_0x5a40('0x40')]({},_0x2c6efa,_0x4279eb[_0x5a40('0x36')]);return db['FreshdeskField'][_0x5a40('0x41')](_0x2c6efa)['then'](handleEntityNotFound(_0x1f4a88,null))[_0x5a40('0x1c')](respondWithResult(_0x1f4a88,null))[_0x5a40('0x42')](handleError(_0x1f4a88,null));};exports['create']=function(_0x3402d9,_0x598518){return db['FreshdeskField'][_0x5a40('0x43')](_0x3402d9[_0x5a40('0x44')],{})[_0x5a40('0x1c')](respondWithResult(_0x598518,0xc9))[_0x5a40('0x42')](handleError(_0x598518,null));};exports[_0x5a40('0x1b')]=function(_0x582ca5,_0x36af74){if(_0x582ca5[_0x5a40('0x44')]['id']){delete _0x582ca5[_0x5a40('0x44')]['id'];}return db['FreshdeskField'][_0x5a40('0x41')]({'where':{'id':_0x582ca5[_0x5a40('0x45')]['id']}})[_0x5a40('0x1c')](handleEntityNotFound(_0x36af74,null))[_0x5a40('0x1c')](saveUpdates(_0x582ca5[_0x5a40('0x44')],null))[_0x5a40('0x1c')](respondWithResult(_0x36af74,null))[_0x5a40('0x42')](handleError(_0x36af74,null));};exports[_0x5a40('0x1d')]=function(_0x35e4ed,_0x104626){return db['FreshdeskField'][_0x5a40('0x41')]({'where':{'id':_0x35e4ed[_0x5a40('0x45')]['id']}})[_0x5a40('0x1c')](handleEntityNotFound(_0x104626,null))[_0x5a40('0x1c')](removeEntity(_0x104626,null))[_0x5a40('0x42')](handleError(_0x104626,null));}; \ No newline at end of file +var _0x6370=['find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','nolimit','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','filtears','fields'];(function(_0x29ef83,_0x2c7e0d){var _0x3e406b=function(_0x577f4e){while(--_0x577f4e){_0x29ef83['push'](_0x29ef83['shift']());}};_0x3e406b(++_0x2c7e0d);}(_0x6370,0x99));var _0x0637=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x6370[_0x481bf7];return _0x461787;};'use strict';var pdf=require(_0x0637('0x0'));var emlformat=require(_0x0637('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0637('0x2'));var jsonpatch=require(_0x0637('0x3'));var rp=require(_0x0637('0x4'));var moment=require('moment');var BPromise=require(_0x0637('0x5'));var Mustache=require(_0x0637('0x6'));var util=require(_0x0637('0x7'));var path=require(_0x0637('0x8'));var sox=require(_0x0637('0x9'));var csv=require(_0x0637('0xa'));var ejs=require(_0x0637('0xb'));var fs=require('fs');var _=require(_0x0637('0xc'));var squel=require(_0x0637('0xd'));var crypto=require(_0x0637('0xe'));var jsforce=require(_0x0637('0xf'));var deskjs=require(_0x0637('0x10'));var toCsv=require('to-csv');var querystring=require(_0x0637('0x11'));var Papa=require(_0x0637('0x12'));var Redis=require(_0x0637('0x13'));var authService=require(_0x0637('0x14'));var qs=require(_0x0637('0x15'));var as=require(_0x0637('0x16'));var hardwareService=require(_0x0637('0x17'));var logger=require(_0x0637('0x18'))(_0x0637('0x19'));var utils=require(_0x0637('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x0637('0x1b'));var db=require(_0x0637('0x1c'))['db'];function respondWithStatusCode(_0x3e923e,_0x4638b9){_0x4638b9=_0x4638b9||0xcc;return function(_0x3efa2d){if(_0x3efa2d){return _0x3e923e[_0x0637('0x1d')](_0x4638b9);}return _0x3e923e[_0x0637('0x1e')](_0x4638b9)['end']();};}function respondWithResult(_0x4a2d76,_0x332fbc){_0x332fbc=_0x332fbc||0xc8;return function(_0x5698c5){if(_0x5698c5){return _0x4a2d76[_0x0637('0x1e')](_0x332fbc)[_0x0637('0x1f')](_0x5698c5);}};}function respondWithFilteredResult(_0x1e3bcc,_0xb8c626){return function(_0x26a8f3){if(_0x26a8f3){var _0x1829ad=_0x26a8f3['count'],_0x4bb156=_0xb8c626[_0x0637('0x20')],_0x318e48=_0xb8c626['offset']+_0xb8c626[_0x0637('0x21')],_0x17dbad;if(_0x318e48>=_0x1829ad){_0x318e48=_0x1829ad;_0x17dbad=0xc8;}else{_0x17dbad=0xce;}_0x1e3bcc[_0x0637('0x1e')](_0x17dbad);return _0x1e3bcc[_0x0637('0x22')](_0x0637('0x23'),_0x4bb156+'-'+_0x318e48+'/'+_0x1829ad)[_0x0637('0x1f')](_0x26a8f3);}return null;};}function patchUpdates(_0xc6a480){return function(_0x44a668){try{jsonpatch[_0x0637('0x24')](_0x44a668,_0xc6a480,!![]);}catch(_0x12d4d1){return BPromise['reject'](_0x12d4d1);}return _0x44a668['save']();};}function saveUpdates(_0x26ffa8,_0x6c3b52){return function(_0x2e6f8a){if(_0x2e6f8a){return _0x2e6f8a[_0x0637('0x25')](_0x26ffa8)[_0x0637('0x26')](function(_0x2a0a49){return _0x2a0a49;});}return null;};}function removeEntity(_0x24c944,_0x3afd1d){return function(_0x368ce2){if(_0x368ce2){return _0x368ce2[_0x0637('0x27')]()['then'](function(){_0x24c944[_0x0637('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x270c5a,_0x4c1a7d){return function(_0x43fa6c){if(!_0x43fa6c){_0x270c5a[_0x0637('0x1d')](0x194);}return _0x43fa6c;};}function handleError(_0x4cbdec,_0x1b3d51){_0x1b3d51=_0x1b3d51||0x1f4;return function(_0x499fe4){logger[_0x0637('0x28')](_0x499fe4[_0x0637('0x29')]);if(_0x499fe4['name']){delete _0x499fe4[_0x0637('0x2a')];}_0x4cbdec[_0x0637('0x1e')](_0x1b3d51)[_0x0637('0x2b')](_0x499fe4);};}exports[_0x0637('0x2c')]=function(_0x3374cf,_0x2d3c31){var _0x2c28ed={},_0x4f01b9={},_0x433637={'count':0x0,'rows':[]};var _0x3cdf2b=_[_0x0637('0x2d')](db[_0x0637('0x2e')][_0x0637('0x2f')],function(_0x1e777c){return{'name':_0x1e777c['fieldName'],'type':_0x1e777c[_0x0637('0x30')][_0x0637('0x31')]};});_0x4f01b9[_0x0637('0x32')]=_[_0x0637('0x2d')](_0x3cdf2b,'name');_0x4f01b9['query']=_[_0x0637('0x33')](_0x3374cf[_0x0637('0x34')]);_0x4f01b9[_0x0637('0x35')]=_['intersection'](_0x4f01b9[_0x0637('0x32')],_0x4f01b9[_0x0637('0x34')]);_0x2c28ed[_0x0637('0x36')]=_[_0x0637('0x37')](_0x4f01b9['model'],qs['fields'](_0x3374cf[_0x0637('0x34')]['fields']));_0x2c28ed[_0x0637('0x36')]=_0x2c28ed['attributes']['length']?_0x2c28ed[_0x0637('0x36')]:_0x4f01b9['model'];if(!_0x3374cf[_0x0637('0x34')]['hasOwnProperty'](_0x0637('0x38'))){_0x2c28ed['limit']=qs[_0x0637('0x21')](_0x3374cf['query'][_0x0637('0x21')]);_0x2c28ed[_0x0637('0x20')]=qs['offset'](_0x3374cf['query'][_0x0637('0x20')]);}_0x2c28ed['order']=qs[_0x0637('0x39')](_0x3374cf['query']['sort']);_0x2c28ed[_0x0637('0x3a')]=qs[_0x0637('0x35')](_[_0x0637('0x3b')](_0x3374cf[_0x0637('0x34')],_0x4f01b9[_0x0637('0x35')]),_0x3cdf2b);if(_0x3374cf[_0x0637('0x34')]['filter']){_0x2c28ed['where']=_[_0x0637('0x3c')](_0x2c28ed[_0x0637('0x3a')],{'$or':_['map'](_0x3cdf2b,function(_0x41f460){if(_0x41f460['type']!==_0x0637('0x3d')){var _0x93be4={};_0x93be4[_0x41f460[_0x0637('0x2a')]]={'$like':'%'+_0x3374cf[_0x0637('0x34')]['filter']+'%'};return _0x93be4;}})});}_0x2c28ed=_['merge']({},_0x2c28ed,_0x3374cf[_0x0637('0x3e')]);var _0x118635={'where':_0x2c28ed['where']};return db[_0x0637('0x2e')][_0x0637('0x3f')](_0x118635)['then'](function(_0x397140){_0x433637[_0x0637('0x3f')]=_0x397140;if(_0x3374cf['query'][_0x0637('0x40')]){_0x2c28ed[_0x0637('0x41')]=[{'all':!![]}];}return db[_0x0637('0x2e')][_0x0637('0x42')](_0x2c28ed);})['then'](function(_0x33a7ec){_0x433637[_0x0637('0x43')]=_0x33a7ec;return _0x433637;})[_0x0637('0x26')](respondWithFilteredResult(_0x2d3c31,_0x2c28ed))[_0x0637('0x44')](handleError(_0x2d3c31,null));};exports['show']=function(_0x107e0e,_0x1cc3d3){var _0x15628a={'raw':!![],'where':{'id':_0x107e0e[_0x0637('0x45')]['id']}},_0x5320d1={};_0x5320d1['model']=_[_0x0637('0x33')](db[_0x0637('0x2e')][_0x0637('0x2f')]);_0x5320d1[_0x0637('0x34')]=_[_0x0637('0x33')](_0x107e0e['query']);_0x5320d1[_0x0637('0x46')]=_['intersection'](_0x5320d1[_0x0637('0x32')],_0x5320d1[_0x0637('0x34')]);_0x15628a['attributes']=_[_0x0637('0x37')](_0x5320d1[_0x0637('0x32')],qs['fields'](_0x107e0e[_0x0637('0x34')][_0x0637('0x47')]));_0x15628a[_0x0637('0x36')]=_0x15628a['attributes']['length']?_0x15628a[_0x0637('0x36')]:_0x5320d1[_0x0637('0x32')];if(_0x107e0e['query'][_0x0637('0x40')]){_0x15628a[_0x0637('0x41')]=[{'all':!![]}];}_0x15628a=_['merge']({},_0x15628a,_0x107e0e[_0x0637('0x3e')]);return db[_0x0637('0x2e')][_0x0637('0x48')](_0x15628a)['then'](handleEntityNotFound(_0x1cc3d3,null))[_0x0637('0x26')](respondWithResult(_0x1cc3d3,null))[_0x0637('0x44')](handleError(_0x1cc3d3,null));};exports['create']=function(_0x43cdfe,_0x39ebe2){return db[_0x0637('0x2e')][_0x0637('0x49')](_0x43cdfe['body'],{})[_0x0637('0x26')](respondWithResult(_0x39ebe2,0xc9))['catch'](handleError(_0x39ebe2,null));};exports[_0x0637('0x25')]=function(_0x5c01a9,_0x14f055){if(_0x5c01a9[_0x0637('0x4a')]['id']){delete _0x5c01a9[_0x0637('0x4a')]['id'];}return db['FreshdeskField'][_0x0637('0x48')]({'where':{'id':_0x5c01a9[_0x0637('0x45')]['id']}})[_0x0637('0x26')](handleEntityNotFound(_0x14f055,null))[_0x0637('0x26')](saveUpdates(_0x5c01a9['body'],null))['then'](respondWithResult(_0x14f055,null))[_0x0637('0x44')](handleError(_0x14f055,null));};exports[_0x0637('0x27')]=function(_0x3faaed,_0x527133){return db[_0x0637('0x2e')]['find']({'where':{'id':_0x3faaed[_0x0637('0x45')]['id']}})[_0x0637('0x26')](handleEntityNotFound(_0x527133,null))[_0x0637('0x26')](removeEntity(_0x527133,null))['catch'](handleError(_0x527133,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 5dee14b..12640bb 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 _0x5c8a=['bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes','define','freshdesk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment'];(function(_0x29aca7,_0x21c650){var _0x1db0a0=function(_0x45b5ea){while(--_0x45b5ea){_0x29aca7['push'](_0x29aca7['shift']());}};_0x1db0a0(++_0x21c650);}(_0x5c8a,0xf3));var _0xa5c8=function(_0xf66c15,_0xf099e5){_0xf66c15=_0xf66c15-0x0;var _0x506314=_0x5c8a[_0xf66c15];return _0x506314;};'use strict';var _=require(_0xa5c8('0x0'));var util=require('util');var logger=require(_0xa5c8('0x1'))(_0xa5c8('0x2'));var moment=require(_0xa5c8('0x3'));var BPromise=require(_0xa5c8('0x4'));var rp=require(_0xa5c8('0x5'));var fs=require('fs');var path=require(_0xa5c8('0x6'));var rimraf=require('rimraf');var config=require(_0xa5c8('0x7'));var attributes=require(_0xa5c8('0x8'));module['exports']=function(_0x12b4e6,_0x299236){return _0x12b4e6[_0xa5c8('0x9')]('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xa5c8('0xa'),'fields':[_0xa5c8('0xb'),_0xa5c8('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x57f6=['idField','FieldId','lodash','util','api','bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes','define','FreshdeskField','freshdesk_unique_index'];(function(_0x1bbce7,_0x581b65){var _0xe3a3ef=function(_0x58c0c7){while(--_0x58c0c7){_0x1bbce7['push'](_0x1bbce7['shift']());}};_0xe3a3ef(++_0x581b65);}(_0x57f6,0xb8));var _0x657f=function(_0x1d669e,_0x4921c9){_0x1d669e=_0x1d669e-0x0;var _0x1d1ec7=_0x57f6[_0x1d669e];return _0x1d1ec7;};'use strict';var _=require(_0x657f('0x0'));var util=require(_0x657f('0x1'));var logger=require('../../config/logger')(_0x657f('0x2'));var moment=require('moment');var BPromise=require(_0x657f('0x3'));var rp=require(_0x657f('0x4'));var fs=require('fs');var path=require(_0x657f('0x5'));var rimraf=require(_0x657f('0x6'));var config=require('../../config/environment');var attributes=require(_0x657f('0x7'));module['exports']=function(_0x4080a4,_0x55b41d){return _0x4080a4[_0x657f('0x8')](_0x657f('0x9'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x657f('0xa'),'fields':[_0x657f('0xb'),_0x657f('0xc')],'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 795e521..a4be889 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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x147220,_0x5ce79c){_0x147220=_0x147220-0x0;var _0x9f3eec=_0x7a54[_0x147220];return _0x9f3eec;};'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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x5b9419,_0x29e8b){_0x5b9419=_0x5b9419-0x0;var _0x3092da=_0x7a54[_0x5b9419];return _0x3092da;};'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 0f6cc83..43703d3 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 _0x4ca9=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x471cf8,_0x4b1e54){var _0x403cc5=function(_0x1ffa77){while(--_0x1ffa77){_0x471cf8['push'](_0x471cf8['shift']());}};_0x403cc5(++_0x4b1e54);}(_0x4ca9,0x11e));var _0x94ca=function(_0xf006eb,_0x3b4f9b){_0xf006eb=_0xf006eb-0x0;var _0x1cdeca=_0x4ca9[_0xf006eb];return _0x1cdeca;};'use strict';var multer=require(_0x94ca('0x0'));var util=require(_0x94ca('0x1'));var path=require(_0x94ca('0x2'));var timeout=require(_0x94ca('0x3'));var express=require(_0x94ca('0x4'));var router=express[_0x94ca('0x5')]();var auth=require(_0x94ca('0x6'));var interaction=require(_0x94ca('0x7'));var config=require(_0x94ca('0x8'));var controller=require('./intFreshsalesAccount.controller');router['get']('/',auth[_0x94ca('0x9')](),controller[_0x94ca('0xa')]);router[_0x94ca('0xb')](_0x94ca('0xc'),auth['isAuthenticated'](),controller[_0x94ca('0xd')]);router['get'](_0x94ca('0xe'),auth[_0x94ca('0x9')](),controller[_0x94ca('0xf')]);router[_0x94ca('0xb')](_0x94ca('0x10'),auth[_0x94ca('0x9')](),controller[_0x94ca('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x94ca('0xe'),auth[_0x94ca('0x9')](),controller['addConfiguration']);router[_0x94ca('0x12')](_0x94ca('0xc'),auth[_0x94ca('0x9')](),controller[_0x94ca('0x13')]);router[_0x94ca('0x14')]('/:id',auth[_0x94ca('0x9')](),controller[_0x94ca('0x15')]);module[_0x94ca('0x16')]=router; \ No newline at end of file +var _0x22ba=['put','update','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','getFields','post','addConfiguration'];(function(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_0x22ba,0x8f));var _0xa22b=function(_0x3df223,_0x1740fc){_0x3df223=_0x3df223-0x0;var _0x562d11=_0x22ba[_0x3df223];return _0x562d11;};'use strict';var multer=require('multer');var util=require(_0xa22b('0x0'));var path=require(_0xa22b('0x1'));var timeout=require(_0xa22b('0x2'));var express=require('express');var router=express[_0xa22b('0x3')]();var auth=require(_0xa22b('0x4'));var interaction=require(_0xa22b('0x5'));var config=require(_0xa22b('0x6'));var controller=require(_0xa22b('0x7'));router['get']('/',auth[_0xa22b('0x8')](),controller[_0xa22b('0x9')]);router[_0xa22b('0xa')](_0xa22b('0xb'),auth[_0xa22b('0x8')](),controller['show']);router[_0xa22b('0xa')](_0xa22b('0xc'),auth[_0xa22b('0x8')](),controller[_0xa22b('0xd')]);router[_0xa22b('0xa')]('/:id/fields',auth[_0xa22b('0x8')](),controller[_0xa22b('0xe')]);router[_0xa22b('0xf')]('/',auth[_0xa22b('0x8')](),controller['create']);router[_0xa22b('0xf')](_0xa22b('0xc'),auth[_0xa22b('0x8')](),controller[_0xa22b('0x10')]);router[_0xa22b('0x11')](_0xa22b('0xb'),auth['isAuthenticated'](),controller[_0xa22b('0x12')]);router['delete']('/:id',auth[_0xa22b('0x8')](),controller[_0xa22b('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 6d6e6e1..e1c1441 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 _0xf4ce=['STRING','username','sequelize'];(function(_0x480b14,_0x397259){var _0x271f62=function(_0x3a47a1){while(--_0x3a47a1){_0x480b14['push'](_0x480b14['shift']());}};_0x271f62(++_0x397259);}(_0xf4ce,0xf2));var _0xef4c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xf4ce[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0xef4c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xef4c('0x1')]},'username':{'type':Sequelize[_0xef4c('0x1')],'unique':_0xef4c('0x2')},'apiKey':{'type':Sequelize[_0xef4c('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf643=['sequelize','exports','STRING','username','remoteUri'];(function(_0x197171,_0x13c3ce){var _0x20337f=function(_0x40847f){while(--_0x40847f){_0x197171['push'](_0x197171['shift']());}};_0x20337f(++_0x13c3ce);}(_0xf643,0x122));var _0x3f64=function(_0x3d9e8f,_0x197be8){_0x3d9e8f=_0x3d9e8f-0x0;var _0x52dd70=_0xf643[_0x3d9e8f];return _0x52dd70;};'use strict';var Sequelize=require(_0x3f64('0x0'));module[_0x3f64('0x1')]={'name':{'type':Sequelize[_0x3f64('0x2')]},'description':{'type':Sequelize[_0x3f64('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x3f64('0x3')},'apiKey':{'type':Sequelize[_0x3f64('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x3f64('0x4')},'serverUrl':{'type':Sequelize[_0x3f64('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 247eb45..65c7f53 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 _0x087b=['update','destroy','end','stack','name','send','index','map','FreshsalesAccount','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','nolimit','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','params','fields','length','includeAll','options','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','order','addConfiguration','Subjects','Descriptions','getFields','username','apiKey','remoteUri','slice','substring','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','users','email','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','json','count','offset','limit','set','apply','reject','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x087b,0x11a));var _0xb087=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x087b[_0x3e5086];return _0xfeb102;};'use strict';var pdf=require(_0xb087('0x0'));var emlformat=require(_0xb087('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb087('0x2'));var rp=require('request-promise');var moment=require(_0xb087('0x3'));var BPromise=require(_0xb087('0x4'));var Mustache=require(_0xb087('0x5'));var util=require(_0xb087('0x6'));var path=require(_0xb087('0x7'));var sox=require(_0xb087('0x8'));var csv=require(_0xb087('0x9'));var ejs=require(_0xb087('0xa'));var fs=require('fs');var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x9'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var hardwareService=require(_0xb087('0x15'));var logger=require(_0xb087('0x16'))(_0xb087('0x17'));var utils=require(_0xb087('0x18'));var config=require(_0xb087('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb087('0x1a'))['db'];var integrations=require(_0xb087('0x1b'));var jayson=require(_0xb087('0x1c'));var client=jayson['client'][_0xb087('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3f145e,_0x43f136,_0x46410b,_0x11784c){return new BPromise(function(_0x12d0db,_0x5e9757){var _0x5147e3=_0x11784c||client;return _0x5147e3[_0xb087('0x1e')](_0x3f145e,_0x46410b)[_0xb087('0x1f')](function(_0x5193a4){logger[_0xb087('0x20')](_0xb087('0x21'),_0x43f136,'request\x20sent');logger[_0xb087('0x22')](_0xb087('0x23'),_0x43f136,_0xb087('0x24'),JSON['stringify'](_0x5193a4));if(_0x5193a4[_0xb087('0x25')]){if(_0x5193a4[_0xb087('0x25')][_0xb087('0x26')]===0x1f4){logger[_0xb087('0x25')]('FreshsalesAccount,\x20%s,\x20%s',_0x43f136,_0x5193a4[_0xb087('0x25')][_0xb087('0x27')]);return _0x5e9757(_0x5193a4[_0xb087('0x25')][_0xb087('0x27')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x43f136,_0x5193a4['error']['message']);return _0x12d0db(_0x5193a4[_0xb087('0x25')][_0xb087('0x27')]);}else{logger[_0xb087('0x20')](_0xb087('0x21'),_0x43f136,_0xb087('0x24'));_0x12d0db(_0x5193a4[_0xb087('0x28')][_0xb087('0x27')]);}})['catch'](function(_0x1d1424){logger[_0xb087('0x25')](_0xb087('0x21'),_0x43f136,_0x1d1424);_0x5e9757(_0x1d1424);});});}function respondWithStatusCode(_0x1cfb3e,_0x3ad74e){_0x3ad74e=_0x3ad74e||0xcc;return function(_0x4d9028){if(_0x4d9028){return _0x1cfb3e[_0xb087('0x29')](_0x3ad74e);}return _0x1cfb3e[_0xb087('0x2a')](_0x3ad74e)['end']();};}function respondWithResult(_0x5a2dc6,_0x50745a){_0x50745a=_0x50745a||0xc8;return function(_0x598b99){if(_0x598b99){return _0x5a2dc6['status'](_0x50745a)[_0xb087('0x2b')](_0x598b99);}};}function respondWithFilteredResult(_0x45685d,_0x1d124f){return function(_0x3ca2df){if(_0x3ca2df){var _0xd9ec66=_0x3ca2df[_0xb087('0x2c')],_0xb72173=_0x1d124f[_0xb087('0x2d')],_0xf3f41f=_0x1d124f[_0xb087('0x2d')]+_0x1d124f[_0xb087('0x2e')],_0x35a52c;if(_0xf3f41f>=_0xd9ec66){_0xf3f41f=_0xd9ec66;_0x35a52c=0xc8;}else{_0x35a52c=0xce;}_0x45685d[_0xb087('0x2a')](_0x35a52c);return _0x45685d[_0xb087('0x2f')]('Content-Range',_0xb72173+'-'+_0xf3f41f+'/'+_0xd9ec66)[_0xb087('0x2b')](_0x3ca2df);}return null;};}function patchUpdates(_0x1335d9){return function(_0x20183f){try{jsonpatch[_0xb087('0x30')](_0x20183f,_0x1335d9,!![]);}catch(_0x22d441){return BPromise[_0xb087('0x31')](_0x22d441);}return _0x20183f[_0xb087('0x32')]();};}function saveUpdates(_0x13fb2f,_0x53a535){return function(_0x4c48f8){if(_0x4c48f8){return _0x4c48f8[_0xb087('0x33')](_0x13fb2f)[_0xb087('0x1f')](function(_0x4cb5a8){return _0x4cb5a8;});}return null;};}function removeEntity(_0x60bfe2,_0x7d3776){return function(_0x2a48d3){if(_0x2a48d3){return _0x2a48d3[_0xb087('0x34')]()[_0xb087('0x1f')](function(){_0x60bfe2[_0xb087('0x2a')](0xcc)[_0xb087('0x35')]();});}};}function handleEntityNotFound(_0x3b7ace,_0x8f4f02){return function(_0xdc7033){if(!_0xdc7033){_0x3b7ace[_0xb087('0x29')](0x194);}return _0xdc7033;};}function handleError(_0x3069b5,_0x57ae94){_0x57ae94=_0x57ae94||0x1f4;return function(_0x3bec03){logger['error'](_0x3bec03[_0xb087('0x36')]);if(_0x3bec03[_0xb087('0x37')]){delete _0x3bec03[_0xb087('0x37')];}_0x3069b5[_0xb087('0x2a')](_0x57ae94)[_0xb087('0x38')](_0x3bec03);};}exports[_0xb087('0x39')]=function(_0x32c3e8,_0x29df58){var _0x8a4c3c={},_0x521c3f={},_0x5814c2={'count':0x0,'rows':[]};var _0x35f900=_[_0xb087('0x3a')](db[_0xb087('0x3b')][_0xb087('0x3c')],function(_0x1982a8){return{'name':_0x1982a8['fieldName'],'type':_0x1982a8[_0xb087('0x3d')][_0xb087('0x3e')]};});_0x521c3f['model']=_['map'](_0x35f900,_0xb087('0x37'));_0x521c3f[_0xb087('0x3f')]=_[_0xb087('0x40')](_0x32c3e8['query']);_0x521c3f[_0xb087('0x41')]=_[_0xb087('0x42')](_0x521c3f[_0xb087('0x43')],_0x521c3f[_0xb087('0x3f')]);_0x8a4c3c[_0xb087('0x44')]=_['intersection'](_0x521c3f[_0xb087('0x43')],qs['fields'](_0x32c3e8[_0xb087('0x3f')]['fields']));_0x8a4c3c[_0xb087('0x44')]=_0x8a4c3c[_0xb087('0x44')]['length']?_0x8a4c3c[_0xb087('0x44')]:_0x521c3f['model'];if(!_0x32c3e8[_0xb087('0x3f')]['hasOwnProperty'](_0xb087('0x45'))){_0x8a4c3c[_0xb087('0x2e')]=qs[_0xb087('0x2e')](_0x32c3e8[_0xb087('0x3f')][_0xb087('0x2e')]);_0x8a4c3c[_0xb087('0x2d')]=qs[_0xb087('0x2d')](_0x32c3e8['query'][_0xb087('0x2d')]);}_0x8a4c3c['order']=qs[_0xb087('0x46')](_0x32c3e8[_0xb087('0x3f')]['sort']);_0x8a4c3c[_0xb087('0x47')]=qs[_0xb087('0x41')](_[_0xb087('0x48')](_0x32c3e8['query'],_0x521c3f[_0xb087('0x41')]),_0x35f900);if(_0x32c3e8['query'][_0xb087('0x49')]){_0x8a4c3c[_0xb087('0x47')]=_['merge'](_0x8a4c3c[_0xb087('0x47')],{'$or':_[_0xb087('0x3a')](_0x35f900,function(_0x4addbd){if(_0x4addbd[_0xb087('0x3d')]!==_0xb087('0x4a')){var _0x54eb11={};_0x54eb11[_0x4addbd[_0xb087('0x37')]]={'$like':'%'+_0x32c3e8[_0xb087('0x3f')][_0xb087('0x49')]+'%'};return _0x54eb11;}})});}_0x8a4c3c=_[_0xb087('0x4b')]({},_0x8a4c3c,_0x32c3e8['options']);var _0x47902e={'where':_0x8a4c3c[_0xb087('0x47')]};return db[_0xb087('0x3b')][_0xb087('0x2c')](_0x47902e)[_0xb087('0x1f')](function(_0x36a88f){_0x5814c2[_0xb087('0x2c')]=_0x36a88f;if(_0x32c3e8['query']['includeAll']){_0x8a4c3c[_0xb087('0x4c')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0xb087('0x4d')](_0x8a4c3c);})[_0xb087('0x1f')](function(_0x2a1823){_0x5814c2[_0xb087('0x4e')]=_0x2a1823;return _0x5814c2;})['then'](respondWithFilteredResult(_0x29df58,_0x8a4c3c))[_0xb087('0x4f')](handleError(_0x29df58,null));};exports['show']=function(_0x2fe8a0,_0x73413b){var _0xcb56c7={'raw':![],'where':{'id':_0x2fe8a0[_0xb087('0x50')]['id']}},_0x212021={};_0x212021['model']=_[_0xb087('0x40')](db[_0xb087('0x3b')][_0xb087('0x3c')]);_0x212021['query']=_[_0xb087('0x40')](_0x2fe8a0['query']);_0x212021['filtears']=_[_0xb087('0x42')](_0x212021[_0xb087('0x43')],_0x212021['query']);_0xcb56c7[_0xb087('0x44')]=_[_0xb087('0x42')](_0x212021[_0xb087('0x43')],qs['fields'](_0x2fe8a0['query'][_0xb087('0x51')]));_0xcb56c7['attributes']=_0xcb56c7['attributes'][_0xb087('0x52')]?_0xcb56c7[_0xb087('0x44')]:_0x212021[_0xb087('0x43')];if(_0x2fe8a0[_0xb087('0x3f')][_0xb087('0x53')]){_0xcb56c7[_0xb087('0x4c')]=[{'all':!![]}];}_0xcb56c7=_[_0xb087('0x4b')]({},_0xcb56c7,_0x2fe8a0[_0xb087('0x54')]);return db[_0xb087('0x3b')][_0xb087('0x55')](_0xcb56c7)[_0xb087('0x1f')](handleEntityNotFound(_0x73413b,null))[_0xb087('0x1f')](respondWithResult(_0x73413b,null))['catch'](handleError(_0x73413b,null));};exports[_0xb087('0x56')]=function(_0x46548e,_0x5cac89){return db[_0xb087('0x3b')][_0xb087('0x56')](_0x46548e[_0xb087('0x57')],{})[_0xb087('0x1f')](respondWithResult(_0x5cac89,0xc9))[_0xb087('0x4f')](handleError(_0x5cac89,null));};exports[_0xb087('0x33')]=function(_0x167e90,_0x298169){if(_0x167e90[_0xb087('0x57')]['id']){delete _0x167e90[_0xb087('0x57')]['id'];}return db[_0xb087('0x3b')]['find']({'where':{'id':_0x167e90[_0xb087('0x50')]['id']}})['then'](handleEntityNotFound(_0x298169,null))[_0xb087('0x1f')](saveUpdates(_0x167e90['body'],null))[_0xb087('0x1f')](respondWithResult(_0x298169,null))[_0xb087('0x4f')](handleError(_0x298169,null));};exports[_0xb087('0x34')]=function(_0x1fe773,_0x62e7cc){return db[_0xb087('0x3b')][_0xb087('0x55')]({'where':{'id':_0x1fe773[_0xb087('0x50')]['id']}})[_0xb087('0x1f')](handleEntityNotFound(_0x62e7cc,null))[_0xb087('0x1f')](removeEntity(_0x62e7cc,null))[_0xb087('0x4f')](handleError(_0x62e7cc,null));};exports[_0xb087('0x58')]=function(_0x3834a6,_0x22be05,_0x3f6fd7){var _0x122103={};var _0x217f26={};var _0x3185c4;var _0x40ff74;return db[_0xb087('0x3b')][_0xb087('0x59')]({'where':{'id':_0x3834a6[_0xb087('0x50')]['id']}})['then'](handleEntityNotFound(_0x22be05,null))[_0xb087('0x1f')](function(_0x1f893a){if(_0x1f893a){_0x3185c4=_0x1f893a;_0x217f26[_0xb087('0x43')]=_['keys'](db[_0xb087('0x5a')][_0xb087('0x3c')]);_0x217f26['query']=_[_0xb087('0x40')](_0x3834a6[_0xb087('0x3f')]);_0x217f26[_0xb087('0x41')]=_['intersection'](_0x217f26[_0xb087('0x43')],_0x217f26[_0xb087('0x3f')]);_0x122103[_0xb087('0x44')]=_[_0xb087('0x42')](_0x217f26[_0xb087('0x43')],qs[_0xb087('0x51')](_0x3834a6[_0xb087('0x3f')][_0xb087('0x51')]));_0x122103['attributes']=_0x122103[_0xb087('0x44')][_0xb087('0x52')]?_0x122103[_0xb087('0x44')]:_0x217f26['model'];_0x122103[_0xb087('0x5b')]=qs['sort'](_0x3834a6['query'][_0xb087('0x46')]);_0x122103[_0xb087('0x47')]=qs['filters'](_[_0xb087('0x48')](_0x3834a6['query'],_0x217f26[_0xb087('0x41')]));if(_0x3834a6[_0xb087('0x3f')]['filter']){_0x122103['where']=_[_0xb087('0x4b')](_0x122103['where'],{'$or':_['map'](_0x122103[_0xb087('0x44')],function(_0x52d72a){var _0x34ad78={};_0x34ad78[_0x52d72a]={'$like':'%'+_0x3834a6['query'][_0xb087('0x49')]+'%'};return _0x34ad78;})});}_0x122103=_[_0xb087('0x4b')]({},_0x122103,_0x3834a6[_0xb087('0x54')]);return _0x3185c4[_0xb087('0x58')](_0x122103);}})[_0xb087('0x1f')](function(_0x3174bb){if(_0x3174bb){_0x40ff74=_0x3174bb['length'];if(!_0x3834a6[_0xb087('0x3f')]['hasOwnProperty'](_0xb087('0x45'))){_0x122103[_0xb087('0x2e')]=qs[_0xb087('0x2e')](_0x3834a6['query'][_0xb087('0x2e')]);_0x122103['offset']=qs[_0xb087('0x2d')](_0x3834a6[_0xb087('0x3f')][_0xb087('0x2d')]);}return _0x3185c4[_0xb087('0x58')](_0x122103);}})[_0xb087('0x1f')](function(_0xe9e103){if(_0xe9e103){return _0xe9e103?{'count':_0x40ff74,'rows':_0xe9e103}:null;}})['then'](respondWithResult(_0x22be05,null))[_0xb087('0x4f')](handleError(_0x22be05,null));};exports[_0xb087('0x5c')]=function(_0x4bedbd,_0x25a45f,_0x58de88){if(_0x4bedbd[_0xb087('0x57')]['id']){delete _0x4bedbd[_0xb087('0x57')]['id'];}return db[_0xb087('0x3b')][_0xb087('0x59')]({'where':{'id':_0x4bedbd[_0xb087('0x50')]['id']}})[_0xb087('0x1f')](handleEntityNotFound(_0x25a45f,null))[_0xb087('0x1f')](function(_0x186b40){if(_0x186b40){_0x4bedbd['body']['AccountId']=_0x186b40['id'];_0x4bedbd['body'][_0xb087('0x5d')]=integrations['getSubjects'](_0x4bedbd[_0xb087('0x57')]['channel'],_0x4bedbd[_0xb087('0x57')][_0xb087('0x3d')]);_0x4bedbd[_0xb087('0x57')][_0xb087('0x5e')]=integrations['getDescriptions'](_0x4bedbd[_0xb087('0x57')]['channel'],_0x4bedbd[_0xb087('0x57')][_0xb087('0x3d')]);return db[_0xb087('0x5a')][_0xb087('0x56')](_0x4bedbd['body'],{'include':[{'model':db['FreshsalesField'],'as':_0xb087('0x5d')},{'model':db['FreshsalesField'],'as':_0xb087('0x5e')}]});}return null;})[_0xb087('0x1f')](respondWithResult(_0x25a45f,null))[_0xb087('0x4f')](handleError(_0x25a45f,null));};exports[_0xb087('0x5f')]=function(_0x4a9193,_0x4bdd30,_0x2580e2){var _0x551f56='';var _0x34e72c='';return db[_0xb087('0x3b')][_0xb087('0x59')]({'where':{'id':_0x4a9193[_0xb087('0x50')]['id']},'attributes':['id',_0xb087('0x60'),'remoteUri',_0xb087('0x61')]})[_0xb087('0x1f')](handleEntityNotFound(_0x4bdd30,null))['then'](function(_0x544ee0){if(_0x544ee0){_0x34e72c=_0x544ee0['username'];_0x551f56=_0x544ee0[_0xb087('0x62')];var _0x193bbc=_0x544ee0[_0xb087('0x62')][_0xb087('0x63')](-0x1);if(_0x193bbc==='/'){_0x551f56=_0x551f56[_0xb087('0x64')](0x0,_0x551f56[_0xb087('0x65')](_0x193bbc));}return rp({'method':'GET','uri':util[_0xb087('0x66')](_0xb087('0x67'),_0x551f56,_0xb087('0x68')),'headers':{'Authorization':_0xb087('0x69')+_0x544ee0[_0xb087('0x61')]},'json':!![]});}})[_0xb087('0x1f')](function(_0x33ab61){if(_0x33ab61){var _0x50454b=_0x33ab61[_0xb087('0x6a')];var _0x3a04ae=![];var _0x28965f=null;for(_0x28965f=0x0;_0x28965f<_0x50454b['length'];_0x28965f++){if(_0x50454b[_0x28965f][_0xb087('0x6b')]===_0x34e72c){_0x3a04ae=!![];}}if(_0x3a04ae){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xb087('0x1f')](respondWithResult(_0x4bdd30,null))[_0xb087('0x4f')](function(_0x45da69){var _0x267dea=_0x4a9193[_0xb087('0x3f')][_0xb087('0x6c')]?0x1f4:_0x45da69['statusCode']||0x1f4;logger['error'](_0xb087('0x6d'),_0xb087('0x5f'),_0x267dea,JSON['stringify'](_0x45da69));delete _0x45da69[_0xb087('0x37')];if(_0x267dea===0x191){_0x267dea=0x190;}_0x4bdd30[_0xb087('0x2a')](_0x267dea)[_0xb087('0x38')](_0x4a9193[_0xb087('0x3f')][_0xb087('0x6c')]?{'message':_0xb087('0x6e'),'statusCode':_0x45da69['statusCode']}:_0x45da69);});}; \ No newline at end of file +var _0xb47f=['channel','getDescriptions','create','FreshsalesField','getFields','remoteUri','username','substring','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','send','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','request','then','info','FreshsalesAccount,\x20%s,\x20%s','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','count','offset','set','apply','update','destroy','sendStatus','stack','name','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','FreshsalesAccount','includeAll','include','findAll','show','params','keys','rawAttributes','filtears','find','body','getConfigurations','findOne','FreshsalesConfiguration','limit','addConfiguration','AccountId','Subjects','getSubjects'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb47f,0x15b));var _0xfb47=function(_0x541983,_0x4eb28e){_0x541983=_0x541983-0x0;var _0x429a27=_0xb47f[_0x541983];return _0x429a27;};'use strict';var pdf=require(_0xfb47('0x0'));var emlformat=require(_0xfb47('0x1'));var rimraf=require(_0xfb47('0x2'));var zipdir=require(_0xfb47('0x3'));var jsonpatch=require(_0xfb47('0x4'));var rp=require('request-promise');var moment=require(_0xfb47('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfb47('0x6'));var util=require(_0xfb47('0x7'));var path=require(_0xfb47('0x8'));var sox=require(_0xfb47('0x9'));var csv=require(_0xfb47('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfb47('0xb'));var squel=require(_0xfb47('0xc'));var crypto=require(_0xfb47('0xd'));var jsforce=require(_0xfb47('0xe'));var deskjs=require(_0xfb47('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfb47('0x10'));var Papa=require(_0xfb47('0x11'));var Redis=require(_0xfb47('0x12'));var authService=require(_0xfb47('0x13'));var qs=require(_0xfb47('0x14'));var as=require(_0xfb47('0x15'));var hardwareService=require(_0xfb47('0x16'));var logger=require(_0xfb47('0x17'))(_0xfb47('0x18'));var utils=require(_0xfb47('0x19'));var config=require(_0xfb47('0x1a'));var licenseUtil=require(_0xfb47('0x1b'));var db=require(_0xfb47('0x1c'))['db'];var integrations=require(_0xfb47('0x1d'));var jayson=require(_0xfb47('0x1e'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5d2b64,_0x58a970,_0x46b76f,_0x38412b){return new BPromise(function(_0x3bdffc,_0x2cbd42){var _0x2ddf36=_0x38412b||client;return _0x2ddf36[_0xfb47('0x1f')](_0x5d2b64,_0x46b76f)[_0xfb47('0x20')](function(_0x1ed448){logger[_0xfb47('0x21')](_0xfb47('0x22'),_0x58a970,'request\x20sent');logger['debug'](_0xfb47('0x23'),_0x58a970,_0xfb47('0x24'),JSON['stringify'](_0x1ed448));if(_0x1ed448['error']){if(_0x1ed448[_0xfb47('0x25')][_0xfb47('0x26')]===0x1f4){logger[_0xfb47('0x25')]('FreshsalesAccount,\x20%s,\x20%s',_0x58a970,_0x1ed448[_0xfb47('0x25')]['message']);return _0x2cbd42(_0x1ed448[_0xfb47('0x25')][_0xfb47('0x27')]);}logger[_0xfb47('0x25')](_0xfb47('0x22'),_0x58a970,_0x1ed448[_0xfb47('0x25')]['message']);return _0x3bdffc(_0x1ed448[_0xfb47('0x25')][_0xfb47('0x27')]);}else{logger['info'](_0xfb47('0x22'),_0x58a970,_0xfb47('0x24'));_0x3bdffc(_0x1ed448[_0xfb47('0x28')]['message']);}})[_0xfb47('0x29')](function(_0x472ade){logger[_0xfb47('0x25')](_0xfb47('0x22'),_0x58a970,_0x472ade);_0x2cbd42(_0x472ade);});});}function respondWithStatusCode(_0xbd2550,_0x52a174){_0x52a174=_0x52a174||0xcc;return function(_0x3874f5){if(_0x3874f5){return _0xbd2550['sendStatus'](_0x52a174);}return _0xbd2550[_0xfb47('0x2a')](_0x52a174)[_0xfb47('0x2b')]();};}function respondWithResult(_0x300c7c,_0x113e05){_0x113e05=_0x113e05||0xc8;return function(_0x382a3f){if(_0x382a3f){return _0x300c7c[_0xfb47('0x2a')](_0x113e05)[_0xfb47('0x2c')](_0x382a3f);}};}function respondWithFilteredResult(_0x39b834,_0x2fad3){return function(_0x5184b7){if(_0x5184b7){var _0x58dbda=_0x5184b7[_0xfb47('0x2d')],_0x5ec010=_0x2fad3['offset'],_0x3ce3c0=_0x2fad3[_0xfb47('0x2e')]+_0x2fad3['limit'],_0x144941;if(_0x3ce3c0>=_0x58dbda){_0x3ce3c0=_0x58dbda;_0x144941=0xc8;}else{_0x144941=0xce;}_0x39b834['status'](_0x144941);return _0x39b834[_0xfb47('0x2f')]('Content-Range',_0x5ec010+'-'+_0x3ce3c0+'/'+_0x58dbda)[_0xfb47('0x2c')](_0x5184b7);}return null;};}function patchUpdates(_0x1c3aeb){return function(_0xa33d01){try{jsonpatch[_0xfb47('0x30')](_0xa33d01,_0x1c3aeb,!![]);}catch(_0x23319e){return BPromise['reject'](_0x23319e);}return _0xa33d01['save']();};}function saveUpdates(_0x200c06,_0xe30271){return function(_0x16bc20){if(_0x16bc20){return _0x16bc20[_0xfb47('0x31')](_0x200c06)[_0xfb47('0x20')](function(_0x17aa64){return _0x17aa64;});}return null;};}function removeEntity(_0x4edcc0,_0x4a6e13){return function(_0x1fb0ac){if(_0x1fb0ac){return _0x1fb0ac[_0xfb47('0x32')]()['then'](function(){_0x4edcc0[_0xfb47('0x2a')](0xcc)[_0xfb47('0x2b')]();});}};}function handleEntityNotFound(_0x10efab,_0x3c9e1a){return function(_0x1fe1ce){if(!_0x1fe1ce){_0x10efab[_0xfb47('0x33')](0x194);}return _0x1fe1ce;};}function handleError(_0x2b98b7,_0x17300e){_0x17300e=_0x17300e||0x1f4;return function(_0xe244e5){logger['error'](_0xe244e5[_0xfb47('0x34')]);if(_0xe244e5[_0xfb47('0x35')]){delete _0xe244e5[_0xfb47('0x35')];}_0x2b98b7[_0xfb47('0x2a')](_0x17300e)['send'](_0xe244e5);};}exports['index']=function(_0x5253bd,_0x60f0ae){var _0x1472bf={},_0x100d8c={},_0x285f2a={'count':0x0,'rows':[]};var _0x168224=_['map'](db['FreshsalesAccount']['rawAttributes'],function(_0x2871ec){return{'name':_0x2871ec[_0xfb47('0x36')],'type':_0x2871ec[_0xfb47('0x37')][_0xfb47('0x38')]};});_0x100d8c[_0xfb47('0x39')]=_[_0xfb47('0x3a')](_0x168224,_0xfb47('0x35'));_0x100d8c[_0xfb47('0x3b')]=_['keys'](_0x5253bd[_0xfb47('0x3b')]);_0x100d8c[_0xfb47('0x3c')]=_[_0xfb47('0x3d')](_0x100d8c[_0xfb47('0x39')],_0x100d8c[_0xfb47('0x3b')]);_0x1472bf[_0xfb47('0x3e')]=_['intersection'](_0x100d8c[_0xfb47('0x39')],qs[_0xfb47('0x3f')](_0x5253bd['query'][_0xfb47('0x3f')]));_0x1472bf[_0xfb47('0x3e')]=_0x1472bf['attributes'][_0xfb47('0x40')]?_0x1472bf[_0xfb47('0x3e')]:_0x100d8c[_0xfb47('0x39')];if(!_0x5253bd['query'][_0xfb47('0x41')](_0xfb47('0x42'))){_0x1472bf['limit']=qs['limit'](_0x5253bd[_0xfb47('0x3b')]['limit']);_0x1472bf[_0xfb47('0x2e')]=qs['offset'](_0x5253bd[_0xfb47('0x3b')][_0xfb47('0x2e')]);}_0x1472bf[_0xfb47('0x43')]=qs[_0xfb47('0x44')](_0x5253bd[_0xfb47('0x3b')][_0xfb47('0x44')]);_0x1472bf['where']=qs[_0xfb47('0x3c')](_['pick'](_0x5253bd[_0xfb47('0x3b')],_0x100d8c[_0xfb47('0x3c')]),_0x168224);if(_0x5253bd[_0xfb47('0x3b')][_0xfb47('0x45')]){_0x1472bf[_0xfb47('0x46')]=_[_0xfb47('0x47')](_0x1472bf['where'],{'$or':_[_0xfb47('0x3a')](_0x168224,function(_0x56398c){if(_0x56398c[_0xfb47('0x37')]!==_0xfb47('0x48')){var _0x2b9cb5={};_0x2b9cb5[_0x56398c[_0xfb47('0x35')]]={'$like':'%'+_0x5253bd[_0xfb47('0x3b')][_0xfb47('0x45')]+'%'};return _0x2b9cb5;}})});}_0x1472bf=_['merge']({},_0x1472bf,_0x5253bd[_0xfb47('0x49')]);var _0x4e9d2f={'where':_0x1472bf[_0xfb47('0x46')]};return db[_0xfb47('0x4a')][_0xfb47('0x2d')](_0x4e9d2f)[_0xfb47('0x20')](function(_0x9d4e70){_0x285f2a[_0xfb47('0x2d')]=_0x9d4e70;if(_0x5253bd['query'][_0xfb47('0x4b')]){_0x1472bf[_0xfb47('0x4c')]=[{'all':!![]}];}return db[_0xfb47('0x4a')][_0xfb47('0x4d')](_0x1472bf);})['then'](function(_0x1df539){_0x285f2a['rows']=_0x1df539;return _0x285f2a;})[_0xfb47('0x20')](respondWithFilteredResult(_0x60f0ae,_0x1472bf))[_0xfb47('0x29')](handleError(_0x60f0ae,null));};exports[_0xfb47('0x4e')]=function(_0x2a7586,_0x42c535){var _0x38f78a={'raw':![],'where':{'id':_0x2a7586[_0xfb47('0x4f')]['id']}},_0x297acf={};_0x297acf[_0xfb47('0x39')]=_[_0xfb47('0x50')](db[_0xfb47('0x4a')][_0xfb47('0x51')]);_0x297acf['query']=_[_0xfb47('0x50')](_0x2a7586['query']);_0x297acf[_0xfb47('0x52')]=_['intersection'](_0x297acf[_0xfb47('0x39')],_0x297acf[_0xfb47('0x3b')]);_0x38f78a[_0xfb47('0x3e')]=_[_0xfb47('0x3d')](_0x297acf['model'],qs[_0xfb47('0x3f')](_0x2a7586['query'][_0xfb47('0x3f')]));_0x38f78a[_0xfb47('0x3e')]=_0x38f78a[_0xfb47('0x3e')]['length']?_0x38f78a[_0xfb47('0x3e')]:_0x297acf['model'];if(_0x2a7586[_0xfb47('0x3b')]['includeAll']){_0x38f78a[_0xfb47('0x4c')]=[{'all':!![]}];}_0x38f78a=_['merge']({},_0x38f78a,_0x2a7586['options']);return db[_0xfb47('0x4a')][_0xfb47('0x53')](_0x38f78a)['then'](handleEntityNotFound(_0x42c535,null))[_0xfb47('0x20')](respondWithResult(_0x42c535,null))[_0xfb47('0x29')](handleError(_0x42c535,null));};exports['create']=function(_0x5f50f6,_0x33ed0c){return db[_0xfb47('0x4a')]['create'](_0x5f50f6[_0xfb47('0x54')],{})[_0xfb47('0x20')](respondWithResult(_0x33ed0c,0xc9))['catch'](handleError(_0x33ed0c,null));};exports['update']=function(_0x14856e,_0x1becc6){if(_0x14856e[_0xfb47('0x54')]['id']){delete _0x14856e[_0xfb47('0x54')]['id'];}return db[_0xfb47('0x4a')]['find']({'where':{'id':_0x14856e[_0xfb47('0x4f')]['id']}})[_0xfb47('0x20')](handleEntityNotFound(_0x1becc6,null))[_0xfb47('0x20')](saveUpdates(_0x14856e[_0xfb47('0x54')],null))[_0xfb47('0x20')](respondWithResult(_0x1becc6,null))[_0xfb47('0x29')](handleError(_0x1becc6,null));};exports[_0xfb47('0x32')]=function(_0x4c50e0,_0x1fd259){return db['FreshsalesAccount'][_0xfb47('0x53')]({'where':{'id':_0x4c50e0[_0xfb47('0x4f')]['id']}})[_0xfb47('0x20')](handleEntityNotFound(_0x1fd259,null))[_0xfb47('0x20')](removeEntity(_0x1fd259,null))[_0xfb47('0x29')](handleError(_0x1fd259,null));};exports[_0xfb47('0x55')]=function(_0x2c1286,_0x5269cf,_0x38d7b0){var _0xe5f2a1={};var _0x1386b0={};var _0x50a871;var _0x1dd5df;return db[_0xfb47('0x4a')][_0xfb47('0x56')]({'where':{'id':_0x2c1286[_0xfb47('0x4f')]['id']}})[_0xfb47('0x20')](handleEntityNotFound(_0x5269cf,null))['then'](function(_0x4fdbfd){if(_0x4fdbfd){_0x50a871=_0x4fdbfd;_0x1386b0[_0xfb47('0x39')]=_[_0xfb47('0x50')](db[_0xfb47('0x57')][_0xfb47('0x51')]);_0x1386b0[_0xfb47('0x3b')]=_['keys'](_0x2c1286[_0xfb47('0x3b')]);_0x1386b0[_0xfb47('0x3c')]=_[_0xfb47('0x3d')](_0x1386b0[_0xfb47('0x39')],_0x1386b0[_0xfb47('0x3b')]);_0xe5f2a1[_0xfb47('0x3e')]=_['intersection'](_0x1386b0[_0xfb47('0x39')],qs[_0xfb47('0x3f')](_0x2c1286[_0xfb47('0x3b')][_0xfb47('0x3f')]));_0xe5f2a1[_0xfb47('0x3e')]=_0xe5f2a1['attributes']['length']?_0xe5f2a1[_0xfb47('0x3e')]:_0x1386b0['model'];_0xe5f2a1[_0xfb47('0x43')]=qs[_0xfb47('0x44')](_0x2c1286['query']['sort']);_0xe5f2a1[_0xfb47('0x46')]=qs[_0xfb47('0x3c')](_['pick'](_0x2c1286['query'],_0x1386b0[_0xfb47('0x3c')]));if(_0x2c1286[_0xfb47('0x3b')][_0xfb47('0x45')]){_0xe5f2a1[_0xfb47('0x46')]=_[_0xfb47('0x47')](_0xe5f2a1['where'],{'$or':_['map'](_0xe5f2a1['attributes'],function(_0x365e94){var _0x183648={};_0x183648[_0x365e94]={'$like':'%'+_0x2c1286[_0xfb47('0x3b')][_0xfb47('0x45')]+'%'};return _0x183648;})});}_0xe5f2a1=_[_0xfb47('0x47')]({},_0xe5f2a1,_0x2c1286[_0xfb47('0x49')]);return _0x50a871[_0xfb47('0x55')](_0xe5f2a1);}})[_0xfb47('0x20')](function(_0x40b3b6){if(_0x40b3b6){_0x1dd5df=_0x40b3b6[_0xfb47('0x40')];if(!_0x2c1286[_0xfb47('0x3b')][_0xfb47('0x41')]('nolimit')){_0xe5f2a1[_0xfb47('0x58')]=qs['limit'](_0x2c1286[_0xfb47('0x3b')][_0xfb47('0x58')]);_0xe5f2a1[_0xfb47('0x2e')]=qs[_0xfb47('0x2e')](_0x2c1286[_0xfb47('0x3b')][_0xfb47('0x2e')]);}return _0x50a871['getConfigurations'](_0xe5f2a1);}})['then'](function(_0x5814ad){if(_0x5814ad){return _0x5814ad?{'count':_0x1dd5df,'rows':_0x5814ad}:null;}})[_0xfb47('0x20')](respondWithResult(_0x5269cf,null))[_0xfb47('0x29')](handleError(_0x5269cf,null));};exports[_0xfb47('0x59')]=function(_0xd0045e,_0x4e4df1,_0x176e0b){if(_0xd0045e[_0xfb47('0x54')]['id']){delete _0xd0045e[_0xfb47('0x54')]['id'];}return db['FreshsalesAccount'][_0xfb47('0x56')]({'where':{'id':_0xd0045e[_0xfb47('0x4f')]['id']}})[_0xfb47('0x20')](handleEntityNotFound(_0x4e4df1,null))[_0xfb47('0x20')](function(_0x4d8052){if(_0x4d8052){_0xd0045e['body'][_0xfb47('0x5a')]=_0x4d8052['id'];_0xd0045e['body'][_0xfb47('0x5b')]=integrations[_0xfb47('0x5c')](_0xd0045e[_0xfb47('0x54')][_0xfb47('0x5d')],_0xd0045e['body']['type']);_0xd0045e[_0xfb47('0x54')]['Descriptions']=integrations[_0xfb47('0x5e')](_0xd0045e[_0xfb47('0x54')][_0xfb47('0x5d')],_0xd0045e[_0xfb47('0x54')]['type']);return db[_0xfb47('0x57')][_0xfb47('0x5f')](_0xd0045e['body'],{'include':[{'model':db[_0xfb47('0x60')],'as':_0xfb47('0x5b')},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4e4df1,null))[_0xfb47('0x29')](handleError(_0x4e4df1,null));};exports[_0xfb47('0x61')]=function(_0x53bec5,_0x381ffe,_0xde8274){var _0x3e9915='';var _0x2af575='';return db[_0xfb47('0x4a')][_0xfb47('0x56')]({'where':{'id':_0x53bec5[_0xfb47('0x4f')]['id']},'attributes':['id','username',_0xfb47('0x62'),'apiKey']})[_0xfb47('0x20')](handleEntityNotFound(_0x381ffe,null))[_0xfb47('0x20')](function(_0x333ed1){if(_0x333ed1){_0x2af575=_0x333ed1[_0xfb47('0x63')];_0x3e9915=_0x333ed1['remoteUri'];var _0x4db3bb=_0x333ed1[_0xfb47('0x62')]['slice'](-0x1);if(_0x4db3bb==='/'){_0x3e9915=_0x3e9915[_0xfb47('0x64')](0x0,_0x3e9915[_0xfb47('0x65')](_0x4db3bb));}return rp({'method':'GET','uri':util[_0xfb47('0x66')](_0xfb47('0x67'),_0x3e9915,_0xfb47('0x68')),'headers':{'Authorization':_0xfb47('0x69')+_0x333ed1['apiKey']},'json':!![]});}})['then'](function(_0x53e8ed){if(_0x53e8ed){var _0x2813d8=_0x53e8ed['users'];var _0x35fd90=![];var _0x3b2476=null;for(_0x3b2476=0x0;_0x3b2476<_0x2813d8[_0xfb47('0x40')];_0x3b2476++){if(_0x2813d8[_0x3b2476]['email']===_0x2af575){_0x35fd90=!![];}}if(_0x35fd90){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xfb47('0x6a')});}}})[_0xfb47('0x20')](respondWithResult(_0x381ffe,null))[_0xfb47('0x29')](function(_0x1fad8e){var _0x4bad74=_0x53bec5[_0xfb47('0x3b')]['test']?0x1f4:_0x1fad8e['statusCode']||0x1f4;logger['error'](_0xfb47('0x6b'),_0xfb47('0x61'),_0x4bad74,JSON['stringify'](_0x1fad8e));delete _0x1fad8e[_0xfb47('0x35')];if(_0x4bad74===0x191){_0x4bad74=0x190;}_0x381ffe[_0xfb47('0x2a')](_0x4bad74)[_0xfb47('0x6c')](_0x53bec5[_0xfb47('0x3b')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x1fad8e[_0xfb47('0x6d')]}:_0x1fad8e);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 1be9a08..99c068b 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 _0x22d2=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','FreshsalesAccount','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2d8f6c,_0x44db4c){var _0x3a00f6=function(_0x1b16ea){while(--_0x1b16ea){_0x2d8f6c['push'](_0x2d8f6c['shift']());}};_0x3a00f6(++_0x44db4c);}(_0x22d2,0x92));var _0x222d=function(_0x3c6c2c,_0x21af5a){_0x3c6c2c=_0x3c6c2c-0x0;var _0x17accc=_0x22d2[_0x3c6c2c];return _0x17accc;};'use strict';var _=require(_0x222d('0x0'));var util=require('util');var logger=require(_0x222d('0x1'))(_0x222d('0x2'));var moment=require(_0x222d('0x3'));var BPromise=require(_0x222d('0x4'));var rp=require(_0x222d('0x5'));var fs=require('fs');var path=require(_0x222d('0x6'));var rimraf=require('rimraf');var config=require(_0x222d('0x7'));var attributes=require(_0x222d('0x8'));var integrations=require(_0x222d('0x9'));module['exports']=function(_0x5c126b,_0x19e281){return _0x5c126b['define'](_0x222d('0xa'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e8d=['moment','bluebird','request-promise','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x5967ae,_0x54d642){var _0x5e19cf=function(_0x1b5738){while(--_0x1b5738){_0x5967ae['push'](_0x5967ae['shift']());}};_0x5e19cf(++_0x54d642);}(_0x8e8d,0x141));var _0xd8e8=function(_0x42b019,_0x54aeea){_0x42b019=_0x42b019-0x0;var _0x3bd81e=_0x8e8d[_0x42b019];return _0x3bd81e;};'use strict';var _=require(_0xd8e8('0x0'));var util=require(_0xd8e8('0x1'));var logger=require(_0xd8e8('0x2'))(_0xd8e8('0x3'));var moment=require(_0xd8e8('0x4'));var BPromise=require(_0xd8e8('0x5'));var rp=require(_0xd8e8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd8e8('0x7'));var integrations=require(_0xd8e8('0x8'));module[_0xd8e8('0x9')]=function(_0x1cc655,_0x482ecf){return _0x1cc655[_0xd8e8('0xa')](_0xd8e8('0xb'),attributes,{'tableName':_0xd8e8('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 ef9de84..4bc0bfe 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 _0xe5af=['ShowFreshsalesAccount','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','include','model','map','find','raw','debug'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xe5af,0x9c));var _0xfe5a=function(_0x590644,_0x542055){_0x590644=_0x590644-0x0;var _0x2777a9=_0xe5af[_0x590644];return _0x2777a9;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var moment=require(_0xfe5a('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe5a('0x2'));var fs=require('fs');var Redis=require(_0xfe5a('0x3'));var db=require(_0xfe5a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe5a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfe5a('0x6'));var client=jayson[_0xfe5a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eea2e,_0x356c69,_0x106492){return new BPromise(function(_0xfb4357,_0x3e683c){return client['request'](_0x5eea2e,_0x106492)[_0xfe5a('0x8')](function(_0x5a48ff){logger['info'](_0xfe5a('0x9'),_0x356c69,_0xfe5a('0xa'));logger['debug'](_0xfe5a('0xb'),_0x356c69,_0xfe5a('0xa'),JSON[_0xfe5a('0xc')](_0x5a48ff));if(_0x5a48ff[_0xfe5a('0xd')]){if(_0x5a48ff[_0xfe5a('0xd')]['code']===0x1f4){logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);return _0x3e683c(_0x5a48ff[_0xfe5a('0xd')]['message']);}logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);return _0xfb4357(_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);}else{logger[_0xfe5a('0xf')](_0xfe5a('0x9'),_0x356c69,_0xfe5a('0xa'));_0xfb4357(_0x5a48ff[_0xfe5a('0x10')][_0xfe5a('0xe')]);}})[_0xfe5a('0x11')](function(_0x22afa7){logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x22afa7);_0x3e683c(_0x22afa7);});});}exports[_0xfe5a('0x12')]=function(_0x5bf597){var _0x20620b=this;return new Promise(function(_0x456707,_0x54d5fb){return db[_0xfe5a('0x13')][_0xfe5a('0x14')]({'raw':_0x5bf597[_0xfe5a('0x15')]?_0x5bf597['options']['raw']===undefined?!![]:![]:!![],'where':_0x5bf597[_0xfe5a('0x15')]?_0x5bf597[_0xfe5a('0x15')][_0xfe5a('0x16')]||null:null,'attributes':_0x5bf597[_0xfe5a('0x15')]?_0x5bf597[_0xfe5a('0x15')][_0xfe5a('0x17')]||null:null,'limit':_0x5bf597['options']?_0x5bf597[_0xfe5a('0x15')]['limit']||null:null,'include':_0x5bf597[_0xfe5a('0x15')]?_0x5bf597[_0xfe5a('0x15')][_0xfe5a('0x18')]?_['map'](_0x5bf597['options'][_0xfe5a('0x18')],function(_0x3e55fd){return{'model':db[_0x3e55fd['model']],'as':_0x3e55fd['as'],'attributes':_0x3e55fd[_0xfe5a('0x17')],'include':_0x3e55fd[_0xfe5a('0x18')]?_['map'](_0x3e55fd[_0xfe5a('0x18')],function(_0x3a4f3c){return{'model':db[_0x3a4f3c[_0xfe5a('0x19')]],'as':_0x3a4f3c['as'],'attributes':_0x3a4f3c[_0xfe5a('0x17')],'include':_0x3a4f3c['include']?_[_0xfe5a('0x1a')](_0x3a4f3c[_0xfe5a('0x18')],function(_0x24481f){return{'model':db[_0x24481f[_0xfe5a('0x19')]],'as':_0x24481f['as'],'attributes':_0x24481f[_0xfe5a('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfe5a('0x8')](function(_0xdbf1e0){logger[_0xfe5a('0xf')]('GetFreshsalesAccount',_0x5bf597);logger['debug'](_0xfe5a('0x12'),_0x5bf597,JSON['stringify'](_0xdbf1e0));_0x456707(_0xdbf1e0);})[_0xfe5a('0x11')](function(_0xfcb05b){logger[_0xfe5a('0xd')]('GetFreshsalesAccount',_0xfcb05b['message'],_0x5bf597);_0x54d5fb(_0x20620b['error'](0x1f4,_0xfcb05b[_0xfe5a('0xe')]));});});};exports['ShowFreshsalesAccount']=function(_0x51d1f4){var _0x498b64=this;return new Promise(function(_0x3b6e4d,_0x14c66d){return db[_0xfe5a('0x13')][_0xfe5a('0x1b')]({'raw':_0x51d1f4[_0xfe5a('0x15')]?_0x51d1f4[_0xfe5a('0x15')][_0xfe5a('0x1c')]===undefined?!![]:![]:!![],'where':_0x51d1f4[_0xfe5a('0x15')]?_0x51d1f4[_0xfe5a('0x15')][_0xfe5a('0x16')]||null:null,'attributes':_0x51d1f4[_0xfe5a('0x15')]?_0x51d1f4['options'][_0xfe5a('0x17')]||null:null,'include':_0x51d1f4[_0xfe5a('0x15')]?_0x51d1f4['options'][_0xfe5a('0x18')]?_[_0xfe5a('0x1a')](_0x51d1f4[_0xfe5a('0x15')][_0xfe5a('0x18')],function(_0xe5a992){return{'model':db[_0xe5a992['model']],'as':_0xe5a992['as'],'attributes':_0xe5a992['attributes'],'include':_0xe5a992[_0xfe5a('0x18')]?_['map'](_0xe5a992[_0xfe5a('0x18')],function(_0xb31d0){return{'model':db[_0xb31d0[_0xfe5a('0x19')]],'as':_0xb31d0['as'],'attributes':_0xb31d0[_0xfe5a('0x17')],'include':_0xb31d0['include']?_[_0xfe5a('0x1a')](_0xb31d0[_0xfe5a('0x18')],function(_0x2e3a36){return{'model':db[_0x2e3a36['model']],'as':_0x2e3a36['as'],'attributes':_0x2e3a36[_0xfe5a('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfe5a('0x8')](function(_0x4617f0){logger[_0xfe5a('0xf')]('ShowFreshsalesAccount',_0x51d1f4);logger[_0xfe5a('0x1d')]('ShowFreshsalesAccount',_0x51d1f4,JSON[_0xfe5a('0xc')](_0x4617f0));_0x3b6e4d(_0x4617f0);})[_0xfe5a('0x11')](function(_0x576189){logger[_0xfe5a('0xd')](_0xfe5a('0x1e'),_0x576189[_0xfe5a('0xe')],_0x51d1f4);_0x14c66d(_0x498b64[_0xfe5a('0xd')](0x1f4,_0x576189['message']));});});}; \ No newline at end of file +var _0xde1a=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','attributes','limit','include','map','model','stringify','ShowFreshsalesAccount','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5485d6,_0x3e0630){var _0x46fdd0=function(_0x3f3135){while(--_0x3f3135){_0x5485d6['push'](_0x5485d6['shift']());}};_0x46fdd0(++_0x3e0630);}(_0xde1a,0xfd));var _0xade1=function(_0x35bb79,_0x45293e){_0x35bb79=_0x35bb79-0x0;var _0x207b2a=_0xde1a[_0x35bb79];return _0x207b2a;};'use strict';var _=require('lodash');var util=require(_0xade1('0x0'));var moment=require(_0xade1('0x1'));var BPromise=require(_0xade1('0x2'));var rs=require(_0xade1('0x3'));var fs=require('fs');var Redis=require(_0xade1('0x4'));var db=require(_0xade1('0x5'))['db'];var utils=require(_0xade1('0x6'));var logger=require(_0xade1('0x7'))('rpc');var config=require(_0xade1('0x8'));var jayson=require(_0xade1('0x9'));var client=jayson[_0xade1('0xa')][_0xade1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3be6d5,_0x15e325,_0x5eb992){return new BPromise(function(_0x3a24e7,_0x41d069){return client[_0xade1('0xc')](_0x3be6d5,_0x5eb992)[_0xade1('0xd')](function(_0x120f47){logger[_0xade1('0xe')](_0xade1('0xf'),_0x15e325,_0xade1('0x10'));logger['debug'](_0xade1('0x11'),_0x15e325,_0xade1('0x10'),JSON['stringify'](_0x120f47));if(_0x120f47[_0xade1('0x12')]){if(_0x120f47[_0xade1('0x12')][_0xade1('0x13')]===0x1f4){logger['error'](_0xade1('0xf'),_0x15e325,_0x120f47[_0xade1('0x12')][_0xade1('0x14')]);return _0x41d069(_0x120f47[_0xade1('0x12')][_0xade1('0x14')]);}logger[_0xade1('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x15e325,_0x120f47[_0xade1('0x12')][_0xade1('0x14')]);return _0x3a24e7(_0x120f47[_0xade1('0x12')][_0xade1('0x14')]);}else{logger[_0xade1('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x15e325,_0xade1('0x10'));_0x3a24e7(_0x120f47[_0xade1('0x15')][_0xade1('0x14')]);}})[_0xade1('0x16')](function(_0x994e75){logger['error'](_0xade1('0xf'),_0x15e325,_0x994e75);_0x41d069(_0x994e75);});});}exports[_0xade1('0x17')]=function(_0x32e7ca){var _0x1600af=this;return new Promise(function(_0x321ee0,_0xd0fa40){return db[_0xade1('0x18')][_0xade1('0x19')]({'raw':_0x32e7ca[_0xade1('0x1a')]?_0x32e7ca[_0xade1('0x1a')][_0xade1('0x1b')]===undefined?!![]:![]:!![],'where':_0x32e7ca[_0xade1('0x1a')]?_0x32e7ca['options']['where']||null:null,'attributes':_0x32e7ca[_0xade1('0x1a')]?_0x32e7ca[_0xade1('0x1a')][_0xade1('0x1c')]||null:null,'limit':_0x32e7ca[_0xade1('0x1a')]?_0x32e7ca[_0xade1('0x1a')][_0xade1('0x1d')]||null:null,'include':_0x32e7ca[_0xade1('0x1a')]?_0x32e7ca[_0xade1('0x1a')][_0xade1('0x1e')]?_[_0xade1('0x1f')](_0x32e7ca[_0xade1('0x1a')]['include'],function(_0x6260d3){return{'model':db[_0x6260d3['model']],'as':_0x6260d3['as'],'attributes':_0x6260d3[_0xade1('0x1c')],'include':_0x6260d3['include']?_[_0xade1('0x1f')](_0x6260d3[_0xade1('0x1e')],function(_0x183fa2){return{'model':db[_0x183fa2[_0xade1('0x20')]],'as':_0x183fa2['as'],'attributes':_0x183fa2[_0xade1('0x1c')],'include':_0x183fa2[_0xade1('0x1e')]?_[_0xade1('0x1f')](_0x183fa2['include'],function(_0x101f75){return{'model':db[_0x101f75[_0xade1('0x20')]],'as':_0x101f75['as'],'attributes':_0x101f75['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x38dd9f){logger[_0xade1('0xe')]('GetFreshsalesAccount',_0x32e7ca);logger['debug'](_0xade1('0x17'),_0x32e7ca,JSON[_0xade1('0x21')](_0x38dd9f));_0x321ee0(_0x38dd9f);})[_0xade1('0x16')](function(_0x51d9e7){logger[_0xade1('0x12')](_0xade1('0x17'),_0x51d9e7['message'],_0x32e7ca);_0xd0fa40(_0x1600af['error'](0x1f4,_0x51d9e7['message']));});});};exports[_0xade1('0x22')]=function(_0x1a089e){var _0x78042e=this;return new Promise(function(_0x417cdf,_0xb7876f){return db[_0xade1('0x18')][_0xade1('0x23')]({'raw':_0x1a089e[_0xade1('0x1a')]?_0x1a089e[_0xade1('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1a089e[_0xade1('0x1a')]?_0x1a089e[_0xade1('0x1a')][_0xade1('0x24')]||null:null,'attributes':_0x1a089e['options']?_0x1a089e[_0xade1('0x1a')][_0xade1('0x1c')]||null:null,'include':_0x1a089e[_0xade1('0x1a')]?_0x1a089e['options'][_0xade1('0x1e')]?_[_0xade1('0x1f')](_0x1a089e[_0xade1('0x1a')][_0xade1('0x1e')],function(_0x1f0f0d){return{'model':db[_0x1f0f0d['model']],'as':_0x1f0f0d['as'],'attributes':_0x1f0f0d[_0xade1('0x1c')],'include':_0x1f0f0d[_0xade1('0x1e')]?_[_0xade1('0x1f')](_0x1f0f0d['include'],function(_0x1d67ba){return{'model':db[_0x1d67ba[_0xade1('0x20')]],'as':_0x1d67ba['as'],'attributes':_0x1d67ba[_0xade1('0x1c')],'include':_0x1d67ba[_0xade1('0x1e')]?_[_0xade1('0x1f')](_0x1d67ba[_0xade1('0x1e')],function(_0x22dba3){return{'model':db[_0x22dba3[_0xade1('0x20')]],'as':_0x22dba3['as'],'attributes':_0x22dba3[_0xade1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xade1('0xd')](function(_0x2e78a6){logger[_0xade1('0xe')]('ShowFreshsalesAccount',_0x1a089e);logger['debug'](_0xade1('0x22'),_0x1a089e,JSON[_0xade1('0x21')](_0x2e78a6));_0x417cdf(_0x2e78a6);})[_0xade1('0x16')](function(_0x23f9f8){logger['error'](_0xade1('0x22'),_0x23f9f8['message'],_0x1a089e);_0xb7876f(_0x78042e['error'](0x1f4,_0x23f9f8[_0xade1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 423a4e9..eebedc5 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 _0x2823=['create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0x2823,0xe8));var _0x3282=function(_0x4939a4,_0x13671c){_0x4939a4=_0x4939a4-0x0;var _0x25d53f=_0x2823[_0x4939a4];return _0x25d53f;};'use strict';var multer=require(_0x3282('0x0'));var util=require(_0x3282('0x1'));var path=require(_0x3282('0x2'));var timeout=require('connect-timeout');var express=require(_0x3282('0x3'));var router=express[_0x3282('0x4')]();var auth=require(_0x3282('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3282('0x6'));var controller=require(_0x3282('0x7'));router[_0x3282('0x8')]('/',auth[_0x3282('0x9')](),controller[_0x3282('0xa')]);router[_0x3282('0x8')]('/:id',auth[_0x3282('0x9')](),controller[_0x3282('0xb')]);router[_0x3282('0x8')](_0x3282('0xc'),auth[_0x3282('0x9')](),controller[_0x3282('0xd')]);router[_0x3282('0x8')](_0x3282('0xe'),auth[_0x3282('0x9')](),controller[_0x3282('0xf')]);router[_0x3282('0x8')](_0x3282('0x10'),auth[_0x3282('0x9')](),controller['getFields']);router[_0x3282('0x11')]('/',auth['isAuthenticated'](),controller[_0x3282('0x12')]);router[_0x3282('0x13')](_0x3282('0x14'),auth[_0x3282('0x9')](),controller[_0x3282('0x15')]);router[_0x3282('0x16')](_0x3282('0x14'),auth[_0x3282('0x9')](),controller[_0x3282('0x17')]);module[_0x3282('0x18')]=router; \ No newline at end of file +var _0xb6c1=['../../components/auth/service','./intFreshsalesConfiguration.controller','get','index','/:id','show','/:id/subjects','getSubjects','isAuthenticated','/:id/fields','getFields','post','create','put','delete','destroy','exports','multer','util','express'];(function(_0x5213d3,_0x457833){var _0x3eb033=function(_0x32b684){while(--_0x32b684){_0x5213d3['push'](_0x5213d3['shift']());}};_0x3eb033(++_0x457833);}(_0xb6c1,0x1c9));var _0x1b6c=function(_0x42a869,_0x552220){_0x42a869=_0x42a869-0x0;var _0x214633=_0xb6c1[_0x42a869];return _0x214633;};'use strict';var multer=require(_0x1b6c('0x0'));var util=require(_0x1b6c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1b6c('0x2'));var router=express['Router']();var auth=require(_0x1b6c('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1b6c('0x4'));router[_0x1b6c('0x5')]('/',auth['isAuthenticated'](),controller[_0x1b6c('0x6')]);router[_0x1b6c('0x5')](_0x1b6c('0x7'),auth['isAuthenticated'](),controller[_0x1b6c('0x8')]);router[_0x1b6c('0x5')](_0x1b6c('0x9'),auth['isAuthenticated'](),controller[_0x1b6c('0xa')]);router['get']('/:id/descriptions',auth[_0x1b6c('0xb')](),controller['getDescriptions']);router[_0x1b6c('0x5')](_0x1b6c('0xc'),auth[_0x1b6c('0xb')](),controller[_0x1b6c('0xd')]);router[_0x1b6c('0xe')]('/',auth['isAuthenticated'](),controller[_0x1b6c('0xf')]);router[_0x1b6c('0x10')](_0x1b6c('0x7'),auth[_0x1b6c('0xb')](),controller['update']);router[_0x1b6c('0x11')]('/:id',auth[_0x1b6c('0xb')](),controller[_0x1b6c('0x12')]);module[_0x1b6c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index c7922b7..8173408 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 _0x037d=['exports','STRING','sequelize'];(function(_0x15fe02,_0x15676c){var _0x2ba8f7=function(_0x173ae8){while(--_0x173ae8){_0x15fe02['push'](_0x15fe02['shift']());}};_0x2ba8f7(++_0x15676c);}(_0x037d,0xfb));var _0xd037=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x037d[_0x2070da];return _0x4f9fe1;};'use strict';var Sequelize=require(_0xd037('0x0'));module[_0xd037('0x1')]={'name':{'type':Sequelize[_0xd037('0x2')]},'description':{'type':Sequelize[_0xd037('0x2')]}}; \ No newline at end of file +var _0xf5ce=['sequelize','exports','STRING'];(function(_0x4009c2,_0x2248cc){var _0x48c499=function(_0x285f48){while(--_0x285f48){_0x4009c2['push'](_0x4009c2['shift']());}};_0x48c499(++_0x2248cc);}(_0xf5ce,0x1d1));var _0xef5c=function(_0x3ebf67,_0x549a3b){_0x3ebf67=_0x3ebf67-0x0;var _0x37d86a=_0xf5ce[_0x3ebf67];return _0x37d86a;};'use strict';var Sequelize=require(_0xef5c('0x0'));module[_0xef5c('0x1')]={'name':{'type':Sequelize[_0xef5c('0x2')]},'description':{'type':Sequelize[_0xef5c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 8136f72..288db87 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 _0xcffe=['getFields','html-pdf','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','send','map','rawAttributes','fieldName','key','name','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','FreshsalesConfiguration','rows','show','params','create','body','find','getSubjects','findOne','length','getDescriptions','FreshsalesField'];(function(_0x5d4460,_0x400e28){var _0x5bdc5e=function(_0x114666){while(--_0x114666){_0x5d4460['push'](_0x5d4460['shift']());}};_0x5bdc5e(++_0x400e28);}(_0xcffe,0xb1));var _0xecff=function(_0x5c96eb,_0x5404da){_0x5c96eb=_0x5c96eb-0x0;var _0x4ddbad=_0xcffe[_0x5c96eb];return _0x4ddbad;};'use strict';var pdf=require(_0xecff('0x0'));var emlformat=require(_0xecff('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xecff('0x2'));var rp=require(_0xecff('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xecff('0x4'));var util=require(_0xecff('0x5'));var path=require(_0xecff('0x6'));var sox=require(_0xecff('0x7'));var csv=require(_0xecff('0x8'));var ejs=require(_0xecff('0x9'));var fs=require('fs');var _=require(_0xecff('0xa'));var squel=require(_0xecff('0xb'));var crypto=require('crypto');var jsforce=require(_0xecff('0xc'));var deskjs=require(_0xecff('0xd'));var toCsv=require(_0xecff('0x8'));var querystring=require(_0xecff('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xecff('0xf'));var qs=require(_0xecff('0x10'));var as=require(_0xecff('0x11'));var hardwareService=require(_0xecff('0x12'));var logger=require(_0xecff('0x13'))(_0xecff('0x14'));var utils=require(_0xecff('0x15'));var config=require(_0xecff('0x16'));var licenseUtil=require(_0xecff('0x17'));var db=require(_0xecff('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xecff('0x19')][_0xecff('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x49f5ec,_0x225c64,_0x55c3e7,_0x51505d){return new BPromise(function(_0x4089f8,_0x14daf3){var _0x142ffa=_0x51505d||client;return _0x142ffa['request'](_0x49f5ec,_0x55c3e7)[_0xecff('0x1b')](function(_0x45b35a){logger['info'](_0xecff('0x1c'),_0x225c64,_0xecff('0x1d'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x225c64,_0xecff('0x1d'),JSON[_0xecff('0x1e')](_0x45b35a));if(_0x45b35a[_0xecff('0x1f')]){if(_0x45b35a['error'][_0xecff('0x20')]===0x1f4){logger[_0xecff('0x1f')](_0xecff('0x1c'),_0x225c64,_0x45b35a[_0xecff('0x1f')][_0xecff('0x21')]);return _0x14daf3(_0x45b35a[_0xecff('0x1f')]['message']);}logger[_0xecff('0x1f')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x225c64,_0x45b35a[_0xecff('0x1f')][_0xecff('0x21')]);return _0x4089f8(_0x45b35a[_0xecff('0x1f')]['message']);}else{logger[_0xecff('0x22')](_0xecff('0x1c'),_0x225c64,'request\x20sent');_0x4089f8(_0x45b35a['result'][_0xecff('0x21')]);}})[_0xecff('0x23')](function(_0x3f8f5e){logger[_0xecff('0x1f')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x225c64,_0x3f8f5e);_0x14daf3(_0x3f8f5e);});});}function respondWithStatusCode(_0x3aa140,_0x478476){_0x478476=_0x478476||0xcc;return function(_0x5b1e62){if(_0x5b1e62){return _0x3aa140[_0xecff('0x24')](_0x478476);}return _0x3aa140[_0xecff('0x25')](_0x478476)[_0xecff('0x26')]();};}function respondWithResult(_0x29415c,_0x3f7de8){_0x3f7de8=_0x3f7de8||0xc8;return function(_0x33b00e){if(_0x33b00e){return _0x29415c[_0xecff('0x25')](_0x3f7de8)[_0xecff('0x27')](_0x33b00e);}};}function respondWithFilteredResult(_0x54d084,_0x453669){return function(_0x460475){if(_0x460475){var _0x213968=_0x460475[_0xecff('0x28')],_0x5a3cfc=_0x453669[_0xecff('0x29')],_0x12cab5=_0x453669[_0xecff('0x29')]+_0x453669[_0xecff('0x2a')],_0x47e945;if(_0x12cab5>=_0x213968){_0x12cab5=_0x213968;_0x47e945=0xc8;}else{_0x47e945=0xce;}_0x54d084[_0xecff('0x25')](_0x47e945);return _0x54d084[_0xecff('0x2b')]('Content-Range',_0x5a3cfc+'-'+_0x12cab5+'/'+_0x213968)[_0xecff('0x27')](_0x460475);}return null;};}function patchUpdates(_0xee3c3a){return function(_0x23d12c){try{jsonpatch[_0xecff('0x2c')](_0x23d12c,_0xee3c3a,!![]);}catch(_0x3337f0){return BPromise[_0xecff('0x2d')](_0x3337f0);}return _0x23d12c[_0xecff('0x2e')]();};}function saveUpdates(_0x457213,_0x164007){return function(_0x2c1d29){if(_0x2c1d29){return _0x2c1d29[_0xecff('0x2f')](_0x457213)[_0xecff('0x1b')](function(_0x54a05a){return _0x54a05a;});}return null;};}function removeEntity(_0x53a38e,_0x5949e7){return function(_0x44f8bb){if(_0x44f8bb){return _0x44f8bb[_0xecff('0x30')]()['then'](function(){_0x53a38e[_0xecff('0x25')](0xcc)[_0xecff('0x26')]();});}};}function handleEntityNotFound(_0x5966b9,_0x26589c){return function(_0xeba07a){if(!_0xeba07a){_0x5966b9[_0xecff('0x24')](0x194);}return _0xeba07a;};}function handleError(_0x2a31f1,_0x34052a){_0x34052a=_0x34052a||0x1f4;return function(_0x36f49a){logger[_0xecff('0x1f')](_0x36f49a['stack']);if(_0x36f49a['name']){delete _0x36f49a['name'];}_0x2a31f1[_0xecff('0x25')](_0x34052a)[_0xecff('0x31')](_0x36f49a);};}exports['index']=function(_0x29ea17,_0x37ff07){var _0x1ccb9e={},_0x5d84ba={},_0x1daabb={'count':0x0,'rows':[]};var _0x3e40e2=_[_0xecff('0x32')](db['FreshsalesConfiguration'][_0xecff('0x33')],function(_0x4bf5fb){return{'name':_0x4bf5fb[_0xecff('0x34')],'type':_0x4bf5fb['type'][_0xecff('0x35')]};});_0x5d84ba['model']=_[_0xecff('0x32')](_0x3e40e2,_0xecff('0x36'));_0x5d84ba[_0xecff('0x37')]=_[_0xecff('0x38')](_0x29ea17['query']);_0x5d84ba['filters']=_[_0xecff('0x39')](_0x5d84ba[_0xecff('0x3a')],_0x5d84ba[_0xecff('0x37')]);_0x1ccb9e[_0xecff('0x3b')]=_['intersection'](_0x5d84ba[_0xecff('0x3a')],qs[_0xecff('0x3c')](_0x29ea17[_0xecff('0x37')][_0xecff('0x3c')]));_0x1ccb9e[_0xecff('0x3b')]=_0x1ccb9e[_0xecff('0x3b')]['length']?_0x1ccb9e[_0xecff('0x3b')]:_0x5d84ba[_0xecff('0x3a')];if(!_0x29ea17[_0xecff('0x37')][_0xecff('0x3d')](_0xecff('0x3e'))){_0x1ccb9e['limit']=qs['limit'](_0x29ea17[_0xecff('0x37')]['limit']);_0x1ccb9e[_0xecff('0x29')]=qs[_0xecff('0x29')](_0x29ea17[_0xecff('0x37')]['offset']);}_0x1ccb9e[_0xecff('0x3f')]=qs[_0xecff('0x40')](_0x29ea17[_0xecff('0x37')][_0xecff('0x40')]);_0x1ccb9e['where']=qs[_0xecff('0x41')](_[_0xecff('0x42')](_0x29ea17[_0xecff('0x37')],_0x5d84ba['filters']),_0x3e40e2);if(_0x29ea17[_0xecff('0x37')][_0xecff('0x43')]){_0x1ccb9e[_0xecff('0x44')]=_[_0xecff('0x45')](_0x1ccb9e[_0xecff('0x44')],{'$or':_[_0xecff('0x32')](_0x3e40e2,function(_0x280b7b){if(_0x280b7b[_0xecff('0x46')]!==_0xecff('0x47')){var _0x160f88={};_0x160f88[_0x280b7b[_0xecff('0x36')]]={'$like':'%'+_0x29ea17[_0xecff('0x37')]['filter']+'%'};return _0x160f88;}})});}_0x1ccb9e=_[_0xecff('0x45')]({},_0x1ccb9e,_0x29ea17[_0xecff('0x48')]);var _0x49a866={'where':_0x1ccb9e[_0xecff('0x44')]};return db['FreshsalesConfiguration']['count'](_0x49a866)[_0xecff('0x1b')](function(_0x30349d){_0x1daabb[_0xecff('0x28')]=_0x30349d;if(_0x29ea17['query'][_0xecff('0x49')]){_0x1ccb9e[_0xecff('0x4a')]=[{'all':!![]}];}return db[_0xecff('0x4b')]['findAll'](_0x1ccb9e);})['then'](function(_0xe87abb){_0x1daabb[_0xecff('0x4c')]=_0xe87abb;return _0x1daabb;})['then'](respondWithFilteredResult(_0x37ff07,_0x1ccb9e))['catch'](handleError(_0x37ff07,null));};exports[_0xecff('0x4d')]=function(_0x4169c0,_0x5358b3){var _0x4f0deb={'raw':![],'where':{'id':_0x4169c0[_0xecff('0x4e')]['id']}},_0x5d844f={};_0x5d844f[_0xecff('0x3a')]=_[_0xecff('0x38')](db['FreshsalesConfiguration'][_0xecff('0x33')]);_0x5d844f['query']=_['keys'](_0x4169c0[_0xecff('0x37')]);_0x5d844f['filtears']=_['intersection'](_0x5d844f[_0xecff('0x3a')],_0x5d844f[_0xecff('0x37')]);_0x4f0deb[_0xecff('0x3b')]=_[_0xecff('0x39')](_0x5d844f[_0xecff('0x3a')],qs[_0xecff('0x3c')](_0x4169c0[_0xecff('0x37')][_0xecff('0x3c')]));_0x4f0deb['attributes']=_0x4f0deb['attributes']['length']?_0x4f0deb['attributes']:_0x5d844f['model'];if(_0x4169c0[_0xecff('0x37')]['includeAll']){_0x4f0deb[_0xecff('0x4a')]=[{'all':!![]}];}_0x4f0deb=_[_0xecff('0x45')]({},_0x4f0deb,_0x4169c0['options']);return db[_0xecff('0x4b')]['find'](_0x4f0deb)[_0xecff('0x1b')](handleEntityNotFound(_0x5358b3,null))[_0xecff('0x1b')](respondWithResult(_0x5358b3,null))[_0xecff('0x23')](handleError(_0x5358b3,null));};exports['create']=function(_0x2304aa,_0x51a48b){return db[_0xecff('0x4b')][_0xecff('0x4f')](_0x2304aa[_0xecff('0x50')],{})[_0xecff('0x1b')](respondWithResult(_0x51a48b,0xc9))[_0xecff('0x23')](handleError(_0x51a48b,null));};exports[_0xecff('0x2f')]=function(_0x18f4c0,_0xb1b8fd){if(_0x18f4c0[_0xecff('0x50')]['id']){delete _0x18f4c0[_0xecff('0x50')]['id'];}return db[_0xecff('0x4b')][_0xecff('0x51')]({'where':{'id':_0x18f4c0[_0xecff('0x4e')]['id']}})[_0xecff('0x1b')](handleEntityNotFound(_0xb1b8fd,null))[_0xecff('0x1b')](saveUpdates(_0x18f4c0[_0xecff('0x50')],null))[_0xecff('0x1b')](respondWithResult(_0xb1b8fd,null))[_0xecff('0x23')](handleError(_0xb1b8fd,null));};exports['destroy']=function(_0xd167bb,_0x54591d){return db[_0xecff('0x4b')][_0xecff('0x51')]({'where':{'id':_0xd167bb[_0xecff('0x4e')]['id']}})[_0xecff('0x1b')](handleEntityNotFound(_0x54591d,null))[_0xecff('0x1b')](removeEntity(_0x54591d,null))['catch'](handleError(_0x54591d,null));};exports[_0xecff('0x52')]=function(_0x99f674,_0x59e90a,_0xefb425){var _0x599e31={};var _0x478b54={};var _0x59bc9d;var _0x48477c;return db[_0xecff('0x4b')][_0xecff('0x53')]({'where':{'id':_0x99f674[_0xecff('0x4e')]['id']}})[_0xecff('0x1b')](handleEntityNotFound(_0x59e90a,null))[_0xecff('0x1b')](function(_0x3ba9f9){if(_0x3ba9f9){_0x59bc9d=_0x3ba9f9;_0x478b54['model']=_[_0xecff('0x38')](db['FreshsalesField'][_0xecff('0x33')]);_0x478b54[_0xecff('0x37')]=_[_0xecff('0x38')](_0x99f674[_0xecff('0x37')]);_0x478b54['filters']=_['intersection'](_0x478b54['model'],_0x478b54['query']);_0x599e31[_0xecff('0x3b')]=_[_0xecff('0x39')](_0x478b54[_0xecff('0x3a')],qs['fields'](_0x99f674['query'][_0xecff('0x3c')]));_0x599e31[_0xecff('0x3b')]=_0x599e31['attributes'][_0xecff('0x54')]?_0x599e31[_0xecff('0x3b')]:_0x478b54['model'];_0x599e31[_0xecff('0x3f')]=qs[_0xecff('0x40')](_0x99f674[_0xecff('0x37')][_0xecff('0x40')]);_0x599e31[_0xecff('0x44')]=qs['filters'](_[_0xecff('0x42')](_0x99f674[_0xecff('0x37')],_0x478b54[_0xecff('0x41')]));if(_0x99f674['query'][_0xecff('0x43')]){_0x599e31[_0xecff('0x44')]=_[_0xecff('0x45')](_0x599e31[_0xecff('0x44')],{'$or':_[_0xecff('0x32')](_0x599e31[_0xecff('0x3b')],function(_0x38893c){var _0x1755b5={};_0x1755b5[_0x38893c]={'$like':'%'+_0x99f674[_0xecff('0x37')][_0xecff('0x43')]+'%'};return _0x1755b5;})});}_0x599e31=_[_0xecff('0x45')]({},_0x599e31,_0x99f674[_0xecff('0x48')]);return _0x59bc9d[_0xecff('0x52')](_0x599e31);}})[_0xecff('0x1b')](function(_0x33c0af){if(_0x33c0af){_0x48477c=_0x33c0af['length'];if(!_0x99f674['query'][_0xecff('0x3d')](_0xecff('0x3e'))){_0x599e31[_0xecff('0x2a')]=qs['limit'](_0x99f674['query'][_0xecff('0x2a')]);_0x599e31[_0xecff('0x29')]=qs[_0xecff('0x29')](_0x99f674[_0xecff('0x37')][_0xecff('0x29')]);}return _0x59bc9d[_0xecff('0x52')](_0x599e31);}})[_0xecff('0x1b')](function(_0x3003f7){if(_0x3003f7){return _0x3003f7?{'count':_0x48477c,'rows':_0x3003f7}:null;}})['then'](respondWithResult(_0x59e90a,null))[_0xecff('0x23')](handleError(_0x59e90a,null));};exports[_0xecff('0x55')]=function(_0x191fdf,_0x59fd2d,_0x2d36ea){var _0x5c1110={};var _0x3121c6={};var _0x32a307;var _0x113e11;return db[_0xecff('0x4b')]['findOne']({'where':{'id':_0x191fdf[_0xecff('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59fd2d,null))[_0xecff('0x1b')](function(_0x285ba4){if(_0x285ba4){_0x32a307=_0x285ba4;_0x3121c6['model']=_[_0xecff('0x38')](db[_0xecff('0x56')]['rawAttributes']);_0x3121c6[_0xecff('0x37')]=_[_0xecff('0x38')](_0x191fdf[_0xecff('0x37')]);_0x3121c6[_0xecff('0x41')]=_['intersection'](_0x3121c6[_0xecff('0x3a')],_0x3121c6[_0xecff('0x37')]);_0x5c1110[_0xecff('0x3b')]=_[_0xecff('0x39')](_0x3121c6[_0xecff('0x3a')],qs[_0xecff('0x3c')](_0x191fdf[_0xecff('0x37')]['fields']));_0x5c1110['attributes']=_0x5c1110['attributes'][_0xecff('0x54')]?_0x5c1110[_0xecff('0x3b')]:_0x3121c6[_0xecff('0x3a')];_0x5c1110[_0xecff('0x3f')]=qs[_0xecff('0x40')](_0x191fdf[_0xecff('0x37')][_0xecff('0x40')]);_0x5c1110[_0xecff('0x44')]=qs['filters'](_[_0xecff('0x42')](_0x191fdf[_0xecff('0x37')],_0x3121c6[_0xecff('0x41')]));if(_0x191fdf[_0xecff('0x37')][_0xecff('0x43')]){_0x5c1110['where']=_[_0xecff('0x45')](_0x5c1110[_0xecff('0x44')],{'$or':_[_0xecff('0x32')](_0x5c1110['attributes'],function(_0x76d502){var _0xbeec4f={};_0xbeec4f[_0x76d502]={'$like':'%'+_0x191fdf[_0xecff('0x37')][_0xecff('0x43')]+'%'};return _0xbeec4f;})});}_0x5c1110=_[_0xecff('0x45')]({},_0x5c1110,_0x191fdf['options']);return _0x32a307[_0xecff('0x55')](_0x5c1110);}})[_0xecff('0x1b')](function(_0xaccb74){if(_0xaccb74){_0x113e11=_0xaccb74[_0xecff('0x54')];if(!_0x191fdf[_0xecff('0x37')][_0xecff('0x3d')](_0xecff('0x3e'))){_0x5c1110['limit']=qs['limit'](_0x191fdf[_0xecff('0x37')][_0xecff('0x2a')]);_0x5c1110[_0xecff('0x29')]=qs[_0xecff('0x29')](_0x191fdf['query'][_0xecff('0x29')]);}return _0x32a307[_0xecff('0x55')](_0x5c1110);}})[_0xecff('0x1b')](function(_0x37632a){if(_0x37632a){return _0x37632a?{'count':_0x113e11,'rows':_0x37632a}:null;}})['then'](respondWithResult(_0x59fd2d,null))[_0xecff('0x23')](handleError(_0x59fd2d,null));};exports['getFields']=function(_0x45ea87,_0x49c759,_0x3c7362){var _0x58ac38={};var _0x533a56={};var _0x5798e3;var _0x58c85d;return db['FreshsalesConfiguration'][_0xecff('0x53')]({'where':{'id':_0x45ea87[_0xecff('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c759,null))[_0xecff('0x1b')](function(_0x4e6857){if(_0x4e6857){_0x5798e3=_0x4e6857;_0x533a56[_0xecff('0x3a')]=_['keys'](db[_0xecff('0x56')][_0xecff('0x33')]);_0x533a56[_0xecff('0x37')]=_[_0xecff('0x38')](_0x45ea87['query']);_0x533a56[_0xecff('0x41')]=_[_0xecff('0x39')](_0x533a56[_0xecff('0x3a')],_0x533a56['query']);_0x58ac38[_0xecff('0x3b')]=_['intersection'](_0x533a56['model'],qs[_0xecff('0x3c')](_0x45ea87[_0xecff('0x37')]['fields']));_0x58ac38[_0xecff('0x3b')]=_0x58ac38[_0xecff('0x3b')][_0xecff('0x54')]?_0x58ac38[_0xecff('0x3b')]:_0x533a56[_0xecff('0x3a')];_0x58ac38['order']=qs[_0xecff('0x40')](_0x45ea87[_0xecff('0x37')][_0xecff('0x40')]);_0x58ac38[_0xecff('0x44')]=qs[_0xecff('0x41')](_['pick'](_0x45ea87['query'],_0x533a56['filters']));if(_0x45ea87['query'][_0xecff('0x43')]){_0x58ac38['where']=_[_0xecff('0x45')](_0x58ac38[_0xecff('0x44')],{'$or':_[_0xecff('0x32')](_0x58ac38[_0xecff('0x3b')],function(_0xb68db6){var _0x57e737={};_0x57e737[_0xb68db6]={'$like':'%'+_0x45ea87['query'][_0xecff('0x43')]+'%'};return _0x57e737;})});}_0x58ac38=_['merge']({},_0x58ac38,_0x45ea87[_0xecff('0x48')]);return _0x5798e3[_0xecff('0x57')](_0x58ac38);}})[_0xecff('0x1b')](function(_0x1d364e){if(_0x1d364e){_0x58c85d=_0x1d364e[_0xecff('0x54')];if(!_0x45ea87[_0xecff('0x37')]['hasOwnProperty']('nolimit')){_0x58ac38[_0xecff('0x2a')]=qs['limit'](_0x45ea87[_0xecff('0x37')][_0xecff('0x2a')]);_0x58ac38[_0xecff('0x29')]=qs[_0xecff('0x29')](_0x45ea87[_0xecff('0x37')][_0xecff('0x29')]);}return _0x5798e3[_0xecff('0x57')](_0x58ac38);}})[_0xecff('0x1b')](function(_0x194f90){if(_0x194f90){return _0x194f90?{'count':_0x58c85d,'rows':_0x194f90}:null;}})['then'](respondWithResult(_0x49c759,null))[_0xecff('0x23')](handleError(_0x49c759,null));}; \ No newline at end of file +var _0x0b5a=['limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','where','filter','merge','FreshsalesConfiguration','includeAll','include','findAll','rows','show','params','filtears','options','create','body','find','getSubjects','findOne','FreshsalesField','sort','pick','getDescriptions','order','getFields','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','jayson/promise','client','request','info','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','json','count','offset'];(function(_0x4a8905,_0x1ae8fb){var _0x4aec8d=function(_0x12486d){while(--_0x12486d){_0x4a8905['push'](_0x4a8905['shift']());}};_0x4aec8d(++_0x1ae8fb);}(_0x0b5a,0x199));var _0xa0b5=function(_0x32c5e0,_0x59cce9){_0x32c5e0=_0x32c5e0-0x0;var _0x2f4f11=_0x0b5a[_0x32c5e0];return _0x2f4f11;};'use strict';var pdf=require(_0xa0b5('0x0'));var emlformat=require(_0xa0b5('0x1'));var rimraf=require(_0xa0b5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa0b5('0x3'));var rp=require(_0xa0b5('0x4'));var moment=require(_0xa0b5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa0b5('0x6'));var util=require(_0xa0b5('0x7'));var path=require(_0xa0b5('0x8'));var sox=require(_0xa0b5('0x9'));var csv=require(_0xa0b5('0xa'));var ejs=require(_0xa0b5('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa0b5('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa0b5('0xa'));var querystring=require('querystring');var Papa=require(_0xa0b5('0xd'));var Redis=require(_0xa0b5('0xe'));var authService=require(_0xa0b5('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0b5('0x10'))(_0xa0b5('0x11'));var utils=require(_0xa0b5('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xa0b5('0x13'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa0b5('0x14'));var client=jayson[_0xa0b5('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f6bd7,_0x1616f5,_0x4c062e,_0x1b5597){return new BPromise(function(_0x366cf7,_0x37b80d){var _0x497b1a=_0x1b5597||client;return _0x497b1a[_0xa0b5('0x16')](_0x1f6bd7,_0x4c062e)['then'](function(_0x4ec9e1){logger[_0xa0b5('0x17')](_0xa0b5('0x18'),_0x1616f5,'request\x20sent');logger['debug'](_0xa0b5('0x19'),_0x1616f5,_0xa0b5('0x1a'),JSON[_0xa0b5('0x1b')](_0x4ec9e1));if(_0x4ec9e1['error']){if(_0x4ec9e1[_0xa0b5('0x1c')]['code']===0x1f4){logger[_0xa0b5('0x1c')](_0xa0b5('0x18'),_0x1616f5,_0x4ec9e1['error'][_0xa0b5('0x1d')]);return _0x37b80d(_0x4ec9e1[_0xa0b5('0x1c')]['message']);}logger[_0xa0b5('0x1c')](_0xa0b5('0x18'),_0x1616f5,_0x4ec9e1[_0xa0b5('0x1c')][_0xa0b5('0x1d')]);return _0x366cf7(_0x4ec9e1['error'][_0xa0b5('0x1d')]);}else{logger['info'](_0xa0b5('0x18'),_0x1616f5,_0xa0b5('0x1a'));_0x366cf7(_0x4ec9e1[_0xa0b5('0x1e')]['message']);}})[_0xa0b5('0x1f')](function(_0x107782){logger[_0xa0b5('0x1c')](_0xa0b5('0x18'),_0x1616f5,_0x107782);_0x37b80d(_0x107782);});});}function respondWithStatusCode(_0x117f65,_0x5e84e7){_0x5e84e7=_0x5e84e7||0xcc;return function(_0x5ab1a7){if(_0x5ab1a7){return _0x117f65['sendStatus'](_0x5e84e7);}return _0x117f65[_0xa0b5('0x20')](_0x5e84e7)['end']();};}function respondWithResult(_0x1816fe,_0x46a4c3){_0x46a4c3=_0x46a4c3||0xc8;return function(_0x34ce23){if(_0x34ce23){return _0x1816fe[_0xa0b5('0x20')](_0x46a4c3)[_0xa0b5('0x21')](_0x34ce23);}};}function respondWithFilteredResult(_0x2ceb56,_0x207a20){return function(_0x53face){if(_0x53face){var _0x16b5a7=_0x53face[_0xa0b5('0x22')],_0x389671=_0x207a20[_0xa0b5('0x23')],_0xf78483=_0x207a20['offset']+_0x207a20[_0xa0b5('0x24')],_0x364c97;if(_0xf78483>=_0x16b5a7){_0xf78483=_0x16b5a7;_0x364c97=0xc8;}else{_0x364c97=0xce;}_0x2ceb56['status'](_0x364c97);return _0x2ceb56[_0xa0b5('0x25')](_0xa0b5('0x26'),_0x389671+'-'+_0xf78483+'/'+_0x16b5a7)[_0xa0b5('0x21')](_0x53face);}return null;};}function patchUpdates(_0x2caa89){return function(_0xb42a0a){try{jsonpatch[_0xa0b5('0x27')](_0xb42a0a,_0x2caa89,!![]);}catch(_0x966c92){return BPromise[_0xa0b5('0x28')](_0x966c92);}return _0xb42a0a[_0xa0b5('0x29')]();};}function saveUpdates(_0x2f8556,_0xff4b85){return function(_0x5d197c){if(_0x5d197c){return _0x5d197c[_0xa0b5('0x2a')](_0x2f8556)[_0xa0b5('0x2b')](function(_0xfdb2ed){return _0xfdb2ed;});}return null;};}function removeEntity(_0x1949c2,_0x50f010){return function(_0x276d9b){if(_0x276d9b){return _0x276d9b[_0xa0b5('0x2c')]()[_0xa0b5('0x2b')](function(){_0x1949c2[_0xa0b5('0x20')](0xcc)[_0xa0b5('0x2d')]();});}};}function handleEntityNotFound(_0x1957d8,_0x40fd41){return function(_0x655454){if(!_0x655454){_0x1957d8[_0xa0b5('0x2e')](0x194);}return _0x655454;};}function handleError(_0x55b6d7,_0x1a9e72){_0x1a9e72=_0x1a9e72||0x1f4;return function(_0x5c25f4){logger[_0xa0b5('0x1c')](_0x5c25f4[_0xa0b5('0x2f')]);if(_0x5c25f4[_0xa0b5('0x30')]){delete _0x5c25f4[_0xa0b5('0x30')];}_0x55b6d7[_0xa0b5('0x20')](_0x1a9e72)[_0xa0b5('0x31')](_0x5c25f4);};}exports[_0xa0b5('0x32')]=function(_0x216714,_0x1ce809){var _0x523b67={},_0x50c235={},_0x18db24={'count':0x0,'rows':[]};var _0x3ffef0=_[_0xa0b5('0x33')](db['FreshsalesConfiguration'][_0xa0b5('0x34')],function(_0x275ec3){return{'name':_0x275ec3[_0xa0b5('0x35')],'type':_0x275ec3[_0xa0b5('0x36')][_0xa0b5('0x37')]};});_0x50c235['model']=_['map'](_0x3ffef0,'name');_0x50c235['query']=_[_0xa0b5('0x38')](_0x216714[_0xa0b5('0x39')]);_0x50c235[_0xa0b5('0x3a')]=_[_0xa0b5('0x3b')](_0x50c235[_0xa0b5('0x3c')],_0x50c235[_0xa0b5('0x39')]);_0x523b67['attributes']=_['intersection'](_0x50c235['model'],qs[_0xa0b5('0x3d')](_0x216714[_0xa0b5('0x39')][_0xa0b5('0x3d')]));_0x523b67[_0xa0b5('0x3e')]=_0x523b67[_0xa0b5('0x3e')][_0xa0b5('0x3f')]?_0x523b67[_0xa0b5('0x3e')]:_0x50c235[_0xa0b5('0x3c')];if(!_0x216714[_0xa0b5('0x39')][_0xa0b5('0x40')](_0xa0b5('0x41'))){_0x523b67[_0xa0b5('0x24')]=qs[_0xa0b5('0x24')](_0x216714['query']['limit']);_0x523b67[_0xa0b5('0x23')]=qs['offset'](_0x216714[_0xa0b5('0x39')][_0xa0b5('0x23')]);}_0x523b67['order']=qs['sort'](_0x216714[_0xa0b5('0x39')]['sort']);_0x523b67[_0xa0b5('0x42')]=qs['filters'](_['pick'](_0x216714[_0xa0b5('0x39')],_0x50c235[_0xa0b5('0x3a')]),_0x3ffef0);if(_0x216714[_0xa0b5('0x39')][_0xa0b5('0x43')]){_0x523b67[_0xa0b5('0x42')]=_[_0xa0b5('0x44')](_0x523b67['where'],{'$or':_[_0xa0b5('0x33')](_0x3ffef0,function(_0x390cf9){if(_0x390cf9[_0xa0b5('0x36')]!=='VIRTUAL'){var _0x118a88={};_0x118a88[_0x390cf9[_0xa0b5('0x30')]]={'$like':'%'+_0x216714[_0xa0b5('0x39')][_0xa0b5('0x43')]+'%'};return _0x118a88;}})});}_0x523b67=_[_0xa0b5('0x44')]({},_0x523b67,_0x216714['options']);var _0x1e2c63={'where':_0x523b67['where']};return db[_0xa0b5('0x45')]['count'](_0x1e2c63)[_0xa0b5('0x2b')](function(_0x51f3f7){_0x18db24[_0xa0b5('0x22')]=_0x51f3f7;if(_0x216714[_0xa0b5('0x39')][_0xa0b5('0x46')]){_0x523b67[_0xa0b5('0x47')]=[{'all':!![]}];}return db[_0xa0b5('0x45')][_0xa0b5('0x48')](_0x523b67);})[_0xa0b5('0x2b')](function(_0x3661a4){_0x18db24[_0xa0b5('0x49')]=_0x3661a4;return _0x18db24;})['then'](respondWithFilteredResult(_0x1ce809,_0x523b67))[_0xa0b5('0x1f')](handleError(_0x1ce809,null));};exports[_0xa0b5('0x4a')]=function(_0x3d7d5b,_0x19d3d3){var _0x2b8114={'raw':![],'where':{'id':_0x3d7d5b[_0xa0b5('0x4b')]['id']}},_0x49d582={};_0x49d582[_0xa0b5('0x3c')]=_[_0xa0b5('0x38')](db[_0xa0b5('0x45')][_0xa0b5('0x34')]);_0x49d582[_0xa0b5('0x39')]=_['keys'](_0x3d7d5b[_0xa0b5('0x39')]);_0x49d582[_0xa0b5('0x4c')]=_[_0xa0b5('0x3b')](_0x49d582[_0xa0b5('0x3c')],_0x49d582['query']);_0x2b8114[_0xa0b5('0x3e')]=_[_0xa0b5('0x3b')](_0x49d582[_0xa0b5('0x3c')],qs[_0xa0b5('0x3d')](_0x3d7d5b[_0xa0b5('0x39')][_0xa0b5('0x3d')]));_0x2b8114[_0xa0b5('0x3e')]=_0x2b8114[_0xa0b5('0x3e')][_0xa0b5('0x3f')]?_0x2b8114[_0xa0b5('0x3e')]:_0x49d582['model'];if(_0x3d7d5b['query']['includeAll']){_0x2b8114[_0xa0b5('0x47')]=[{'all':!![]}];}_0x2b8114=_[_0xa0b5('0x44')]({},_0x2b8114,_0x3d7d5b[_0xa0b5('0x4d')]);return db[_0xa0b5('0x45')]['find'](_0x2b8114)[_0xa0b5('0x2b')](handleEntityNotFound(_0x19d3d3,null))['then'](respondWithResult(_0x19d3d3,null))['catch'](handleError(_0x19d3d3,null));};exports[_0xa0b5('0x4e')]=function(_0x555466,_0x1ddfb4){return db[_0xa0b5('0x45')][_0xa0b5('0x4e')](_0x555466['body'],{})[_0xa0b5('0x2b')](respondWithResult(_0x1ddfb4,0xc9))['catch'](handleError(_0x1ddfb4,null));};exports[_0xa0b5('0x2a')]=function(_0x4b1c5e,_0x232b8a){if(_0x4b1c5e[_0xa0b5('0x4f')]['id']){delete _0x4b1c5e['body']['id'];}return db[_0xa0b5('0x45')][_0xa0b5('0x50')]({'where':{'id':_0x4b1c5e[_0xa0b5('0x4b')]['id']}})[_0xa0b5('0x2b')](handleEntityNotFound(_0x232b8a,null))[_0xa0b5('0x2b')](saveUpdates(_0x4b1c5e[_0xa0b5('0x4f')],null))['then'](respondWithResult(_0x232b8a,null))[_0xa0b5('0x1f')](handleError(_0x232b8a,null));};exports[_0xa0b5('0x2c')]=function(_0x3a5c09,_0xe70332){return db[_0xa0b5('0x45')][_0xa0b5('0x50')]({'where':{'id':_0x3a5c09[_0xa0b5('0x4b')]['id']}})[_0xa0b5('0x2b')](handleEntityNotFound(_0xe70332,null))[_0xa0b5('0x2b')](removeEntity(_0xe70332,null))['catch'](handleError(_0xe70332,null));};exports[_0xa0b5('0x51')]=function(_0x5c0911,_0x14ed82,_0x2c45c6){var _0x2f4d80={};var _0x434b95={};var _0x215c37;var _0x49274f;return db[_0xa0b5('0x45')][_0xa0b5('0x52')]({'where':{'id':_0x5c0911[_0xa0b5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x14ed82,null))[_0xa0b5('0x2b')](function(_0x1b8034){if(_0x1b8034){_0x215c37=_0x1b8034;_0x434b95[_0xa0b5('0x3c')]=_['keys'](db[_0xa0b5('0x53')]['rawAttributes']);_0x434b95[_0xa0b5('0x39')]=_[_0xa0b5('0x38')](_0x5c0911[_0xa0b5('0x39')]);_0x434b95['filters']=_[_0xa0b5('0x3b')](_0x434b95[_0xa0b5('0x3c')],_0x434b95[_0xa0b5('0x39')]);_0x2f4d80[_0xa0b5('0x3e')]=_[_0xa0b5('0x3b')](_0x434b95[_0xa0b5('0x3c')],qs[_0xa0b5('0x3d')](_0x5c0911[_0xa0b5('0x39')][_0xa0b5('0x3d')]));_0x2f4d80[_0xa0b5('0x3e')]=_0x2f4d80[_0xa0b5('0x3e')][_0xa0b5('0x3f')]?_0x2f4d80[_0xa0b5('0x3e')]:_0x434b95['model'];_0x2f4d80['order']=qs['sort'](_0x5c0911[_0xa0b5('0x39')][_0xa0b5('0x54')]);_0x2f4d80['where']=qs['filters'](_[_0xa0b5('0x55')](_0x5c0911[_0xa0b5('0x39')],_0x434b95[_0xa0b5('0x3a')]));if(_0x5c0911['query'][_0xa0b5('0x43')]){_0x2f4d80[_0xa0b5('0x42')]=_[_0xa0b5('0x44')](_0x2f4d80[_0xa0b5('0x42')],{'$or':_['map'](_0x2f4d80[_0xa0b5('0x3e')],function(_0x5f1c32){var _0x237b1c={};_0x237b1c[_0x5f1c32]={'$like':'%'+_0x5c0911['query']['filter']+'%'};return _0x237b1c;})});}_0x2f4d80=_[_0xa0b5('0x44')]({},_0x2f4d80,_0x5c0911[_0xa0b5('0x4d')]);return _0x215c37[_0xa0b5('0x51')](_0x2f4d80);}})['then'](function(_0x54485d){if(_0x54485d){_0x49274f=_0x54485d[_0xa0b5('0x3f')];if(!_0x5c0911['query'][_0xa0b5('0x40')](_0xa0b5('0x41'))){_0x2f4d80[_0xa0b5('0x24')]=qs[_0xa0b5('0x24')](_0x5c0911[_0xa0b5('0x39')][_0xa0b5('0x24')]);_0x2f4d80[_0xa0b5('0x23')]=qs[_0xa0b5('0x23')](_0x5c0911[_0xa0b5('0x39')][_0xa0b5('0x23')]);}return _0x215c37[_0xa0b5('0x51')](_0x2f4d80);}})[_0xa0b5('0x2b')](function(_0x452dc0){if(_0x452dc0){return _0x452dc0?{'count':_0x49274f,'rows':_0x452dc0}:null;}})[_0xa0b5('0x2b')](respondWithResult(_0x14ed82,null))[_0xa0b5('0x1f')](handleError(_0x14ed82,null));};exports[_0xa0b5('0x56')]=function(_0xfeb8,_0x2f1465,_0x3df220){var _0x2e97a8={};var _0x41bcf7={};var _0x18296;var _0x32b7be;return db[_0xa0b5('0x45')]['findOne']({'where':{'id':_0xfeb8['params']['id']}})[_0xa0b5('0x2b')](handleEntityNotFound(_0x2f1465,null))[_0xa0b5('0x2b')](function(_0x45498e){if(_0x45498e){_0x18296=_0x45498e;_0x41bcf7[_0xa0b5('0x3c')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x41bcf7['query']=_[_0xa0b5('0x38')](_0xfeb8[_0xa0b5('0x39')]);_0x41bcf7['filters']=_[_0xa0b5('0x3b')](_0x41bcf7[_0xa0b5('0x3c')],_0x41bcf7[_0xa0b5('0x39')]);_0x2e97a8[_0xa0b5('0x3e')]=_[_0xa0b5('0x3b')](_0x41bcf7[_0xa0b5('0x3c')],qs['fields'](_0xfeb8['query'][_0xa0b5('0x3d')]));_0x2e97a8['attributes']=_0x2e97a8[_0xa0b5('0x3e')][_0xa0b5('0x3f')]?_0x2e97a8['attributes']:_0x41bcf7[_0xa0b5('0x3c')];_0x2e97a8[_0xa0b5('0x57')]=qs['sort'](_0xfeb8[_0xa0b5('0x39')][_0xa0b5('0x54')]);_0x2e97a8['where']=qs[_0xa0b5('0x3a')](_[_0xa0b5('0x55')](_0xfeb8[_0xa0b5('0x39')],_0x41bcf7[_0xa0b5('0x3a')]));if(_0xfeb8['query'][_0xa0b5('0x43')]){_0x2e97a8[_0xa0b5('0x42')]=_[_0xa0b5('0x44')](_0x2e97a8[_0xa0b5('0x42')],{'$or':_[_0xa0b5('0x33')](_0x2e97a8[_0xa0b5('0x3e')],function(_0x2f5d63){var _0x34b181={};_0x34b181[_0x2f5d63]={'$like':'%'+_0xfeb8[_0xa0b5('0x39')][_0xa0b5('0x43')]+'%'};return _0x34b181;})});}_0x2e97a8=_[_0xa0b5('0x44')]({},_0x2e97a8,_0xfeb8[_0xa0b5('0x4d')]);return _0x18296[_0xa0b5('0x56')](_0x2e97a8);}})[_0xa0b5('0x2b')](function(_0x5aab05){if(_0x5aab05){_0x32b7be=_0x5aab05[_0xa0b5('0x3f')];if(!_0xfeb8[_0xa0b5('0x39')][_0xa0b5('0x40')](_0xa0b5('0x41'))){_0x2e97a8[_0xa0b5('0x24')]=qs['limit'](_0xfeb8['query'][_0xa0b5('0x24')]);_0x2e97a8[_0xa0b5('0x23')]=qs[_0xa0b5('0x23')](_0xfeb8[_0xa0b5('0x39')][_0xa0b5('0x23')]);}return _0x18296[_0xa0b5('0x56')](_0x2e97a8);}})[_0xa0b5('0x2b')](function(_0x16f1c0){if(_0x16f1c0){return _0x16f1c0?{'count':_0x32b7be,'rows':_0x16f1c0}:null;}})[_0xa0b5('0x2b')](respondWithResult(_0x2f1465,null))[_0xa0b5('0x1f')](handleError(_0x2f1465,null));};exports[_0xa0b5('0x58')]=function(_0x39bb95,_0x269dd2,_0x2ef023){var _0x4cf884={};var _0x44cf15={};var _0x3988de;var _0x12cc33;return db['FreshsalesConfiguration'][_0xa0b5('0x52')]({'where':{'id':_0x39bb95[_0xa0b5('0x4b')]['id']}})[_0xa0b5('0x2b')](handleEntityNotFound(_0x269dd2,null))[_0xa0b5('0x2b')](function(_0x48ffb4){if(_0x48ffb4){_0x3988de=_0x48ffb4;_0x44cf15[_0xa0b5('0x3c')]=_['keys'](db[_0xa0b5('0x53')]['rawAttributes']);_0x44cf15['query']=_[_0xa0b5('0x38')](_0x39bb95[_0xa0b5('0x39')]);_0x44cf15[_0xa0b5('0x3a')]=_[_0xa0b5('0x3b')](_0x44cf15['model'],_0x44cf15[_0xa0b5('0x39')]);_0x4cf884['attributes']=_[_0xa0b5('0x3b')](_0x44cf15[_0xa0b5('0x3c')],qs[_0xa0b5('0x3d')](_0x39bb95[_0xa0b5('0x39')][_0xa0b5('0x3d')]));_0x4cf884[_0xa0b5('0x3e')]=_0x4cf884[_0xa0b5('0x3e')][_0xa0b5('0x3f')]?_0x4cf884['attributes']:_0x44cf15['model'];_0x4cf884[_0xa0b5('0x57')]=qs[_0xa0b5('0x54')](_0x39bb95['query']['sort']);_0x4cf884[_0xa0b5('0x42')]=qs[_0xa0b5('0x3a')](_[_0xa0b5('0x55')](_0x39bb95[_0xa0b5('0x39')],_0x44cf15['filters']));if(_0x39bb95[_0xa0b5('0x39')][_0xa0b5('0x43')]){_0x4cf884[_0xa0b5('0x42')]=_[_0xa0b5('0x44')](_0x4cf884['where'],{'$or':_['map'](_0x4cf884['attributes'],function(_0x1b592b){var _0x32c852={};_0x32c852[_0x1b592b]={'$like':'%'+_0x39bb95[_0xa0b5('0x39')][_0xa0b5('0x43')]+'%'};return _0x32c852;})});}_0x4cf884=_[_0xa0b5('0x44')]({},_0x4cf884,_0x39bb95[_0xa0b5('0x4d')]);return _0x3988de[_0xa0b5('0x58')](_0x4cf884);}})['then'](function(_0x4a3742){if(_0x4a3742){_0x12cc33=_0x4a3742['length'];if(!_0x39bb95[_0xa0b5('0x39')][_0xa0b5('0x40')]('nolimit')){_0x4cf884[_0xa0b5('0x24')]=qs['limit'](_0x39bb95[_0xa0b5('0x39')][_0xa0b5('0x24')]);_0x4cf884[_0xa0b5('0x23')]=qs[_0xa0b5('0x23')](_0x39bb95[_0xa0b5('0x39')][_0xa0b5('0x23')]);}return _0x3988de[_0xa0b5('0x58')](_0x4cf884);}})['then'](function(_0xb21a50){if(_0xb21a50){return _0xb21a50?{'count':_0x12cc33,'rows':_0xb21a50}:null;}})[_0xa0b5('0x2b')](respondWithResult(_0x269dd2,null))[_0xa0b5('0x1f')](handleError(_0x269dd2,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 2a18aad..9fe89dd 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 _0xf1a7=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','util'];(function(_0x4b7b9b,_0xa4aff9){var _0x3be710=function(_0x5b64fa){while(--_0x5b64fa){_0x4b7b9b['push'](_0x4b7b9b['shift']());}};_0x3be710(++_0xa4aff9);}(_0xf1a7,0x8f));var _0x7f1a=function(_0x1ac4b5,_0x53da32){_0x1ac4b5=_0x1ac4b5-0x0;var _0x54e0fe=_0xf1a7[_0x1ac4b5];return _0x54e0fe;};'use strict';var _=require('lodash');var util=require(_0x7f1a('0x0'));var logger=require('../../config/logger')(_0x7f1a('0x1'));var moment=require(_0x7f1a('0x2'));var BPromise=require(_0x7f1a('0x3'));var rp=require(_0x7f1a('0x4'));var fs=require('fs');var path=require(_0x7f1a('0x5'));var rimraf=require(_0x7f1a('0x6'));var config=require(_0x7f1a('0x7'));var attributes=require(_0x7f1a('0x8'));module[_0x7f1a('0x9')]=function(_0x41446f,_0x1c3c87){return _0x41446f['define'](_0x7f1a('0xa'),attributes,{'tableName':_0x7f1a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1df5=['FreshsalesConfiguration','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports'];(function(_0x3c6b9b,_0x2c9652){var _0x1ac6a4=function(_0x503c16){while(--_0x503c16){_0x3c6b9b['push'](_0x3c6b9b['shift']());}};_0x1ac6a4(++_0x2c9652);}(_0x1df5,0xfd));var _0x51df=function(_0x25f45c,_0x490c8e){_0x25f45c=_0x25f45c-0x0;var _0x1bd027=_0x1df5[_0x25f45c];return _0x1bd027;};'use strict';var _=require(_0x51df('0x0'));var util=require(_0x51df('0x1'));var logger=require(_0x51df('0x2'))(_0x51df('0x3'));var moment=require(_0x51df('0x4'));var BPromise=require('bluebird');var rp=require(_0x51df('0x5'));var fs=require('fs');var path=require(_0x51df('0x6'));var rimraf=require(_0x51df('0x7'));var config=require(_0x51df('0x8'));var attributes=require(_0x51df('0x9'));module[_0x51df('0xa')]=function(_0x15de76,_0x239dbb){return _0x15de76['define'](_0x51df('0xb'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 6c5dad9..18f492f 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 _0x4dd3=['message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4dfd2a,_0x2aad47){var _0x39d2cc=function(_0x3a6919){while(--_0x3a6919){_0x4dfd2a['push'](_0x4dfd2a['shift']());}};_0x39d2cc(++_0x2aad47);}(_0x4dd3,0xf5));var _0x34dd=function(_0x3b594b,_0x5835c3){_0x3b594b=_0x3b594b-0x0;var _0x1ea5f8=_0x4dd3[_0x3b594b];return _0x1ea5f8;};'use strict';var _=require(_0x34dd('0x0'));var util=require(_0x34dd('0x1'));var moment=require(_0x34dd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34dd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x34dd('0x4'));var logger=require(_0x34dd('0x5'))(_0x34dd('0x6'));var config=require('../../config/environment');var jayson=require(_0x34dd('0x7'));var client=jayson[_0x34dd('0x8')][_0x34dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x365482,_0x3a3429,_0x5e8911){return new BPromise(function(_0x4cb036,_0xc0c516){return client[_0x34dd('0xa')](_0x365482,_0x5e8911)[_0x34dd('0xb')](function(_0x4e1bc8){logger[_0x34dd('0xc')](_0x34dd('0xd'),_0x3a3429,_0x34dd('0xe'));logger[_0x34dd('0xf')](_0x34dd('0x10'),_0x3a3429,_0x34dd('0xe'),JSON['stringify'](_0x4e1bc8));if(_0x4e1bc8[_0x34dd('0x11')]){if(_0x4e1bc8[_0x34dd('0x11')][_0x34dd('0x12')]===0x1f4){logger[_0x34dd('0x11')](_0x34dd('0xd'),_0x3a3429,_0x4e1bc8['error']['message']);return _0xc0c516(_0x4e1bc8[_0x34dd('0x11')][_0x34dd('0x13')]);}logger[_0x34dd('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3a3429,_0x4e1bc8[_0x34dd('0x11')]['message']);return _0x4cb036(_0x4e1bc8[_0x34dd('0x11')][_0x34dd('0x13')]);}else{logger[_0x34dd('0xc')](_0x34dd('0xd'),_0x3a3429,_0x34dd('0xe'));_0x4cb036(_0x4e1bc8[_0x34dd('0x14')]['message']);}})[_0x34dd('0x15')](function(_0x46d9f5){logger[_0x34dd('0x11')](_0x34dd('0xd'),_0x3a3429,_0x46d9f5);_0xc0c516(_0x46d9f5);});});} \ No newline at end of file +var _0x9b87=['error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x56b0aa,_0x49b625){var _0x585536=function(_0x293918){while(--_0x293918){_0x56b0aa['push'](_0x56b0aa['shift']());}};_0x585536(++_0x49b625);}(_0x9b87,0x8e));var _0x79b8=function(_0x180e31,_0x47c1f0){_0x180e31=_0x180e31-0x0;var _0xb2e496=_0x9b87[_0x180e31];return _0xb2e496;};'use strict';var _=require(_0x79b8('0x0'));var util=require(_0x79b8('0x1'));var moment=require(_0x79b8('0x2'));var BPromise=require(_0x79b8('0x3'));var rs=require(_0x79b8('0x4'));var fs=require('fs');var Redis=require(_0x79b8('0x5'));var db=require(_0x79b8('0x6'))['db'];var utils=require(_0x79b8('0x7'));var logger=require(_0x79b8('0x8'))(_0x79b8('0x9'));var config=require(_0x79b8('0xa'));var jayson=require(_0x79b8('0xb'));var client=jayson[_0x79b8('0xc')][_0x79b8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1d2c9f,_0xf5e0f2,_0x5e10fe){return new BPromise(function(_0x4e0dd8,_0x5c15d4){return client['request'](_0x1d2c9f,_0x5e10fe)[_0x79b8('0xe')](function(_0x317e29){logger[_0x79b8('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xf5e0f2,_0x79b8('0x10'));logger[_0x79b8('0x11')](_0x79b8('0x12'),_0xf5e0f2,'request\x20sent',JSON['stringify'](_0x317e29));if(_0x317e29[_0x79b8('0x13')]){if(_0x317e29[_0x79b8('0x13')][_0x79b8('0x14')]===0x1f4){logger[_0x79b8('0x13')](_0x79b8('0x15'),_0xf5e0f2,_0x317e29[_0x79b8('0x13')][_0x79b8('0x16')]);return _0x5c15d4(_0x317e29[_0x79b8('0x13')][_0x79b8('0x16')]);}logger[_0x79b8('0x13')](_0x79b8('0x15'),_0xf5e0f2,_0x317e29['error'][_0x79b8('0x16')]);return _0x4e0dd8(_0x317e29['error']['message']);}else{logger[_0x79b8('0xf')](_0x79b8('0x15'),_0xf5e0f2,_0x79b8('0x10'));_0x4e0dd8(_0x317e29['result'][_0x79b8('0x16')]);}})['catch'](function(_0x5ef869){logger[_0x79b8('0x13')](_0x79b8('0x15'),_0xf5e0f2,_0x5ef869);_0x5c15d4(_0x5ef869);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index e4b8a0c..c3463fa 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 _0xef86=['create','put','update','delete','destroy','multer','util','path','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show'];(function(_0x46e4a2,_0x5c0d8f){var _0xc528fc=function(_0x4a1d9a){while(--_0x4a1d9a){_0x46e4a2['push'](_0x46e4a2['shift']());}};_0xc528fc(++_0x5c0d8f);}(_0xef86,0x18b));var _0x6ef8=function(_0x42389e,_0x165ee2){_0x42389e=_0x42389e-0x0;var _0x1958d7=_0xef86[_0x42389e];return _0x1958d7;};'use strict';var multer=require(_0x6ef8('0x0'));var util=require(_0x6ef8('0x1'));var path=require(_0x6ef8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6ef8('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6ef8('0x4'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router[_0x6ef8('0x5')]('/',auth[_0x6ef8('0x6')](),controller[_0x6ef8('0x7')]);router[_0x6ef8('0x5')](_0x6ef8('0x8'),auth['isAuthenticated'](),controller[_0x6ef8('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6ef8('0xa')]);router[_0x6ef8('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x6ef8('0xc')]);router[_0x6ef8('0xd')](_0x6ef8('0x8'),auth[_0x6ef8('0x6')](),controller[_0x6ef8('0xe')]);module['exports']=router; \ No newline at end of file +var _0xecf4=['/:id','isAuthenticated','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x2b14c8,_0x54e01e){var _0x2f483d=function(_0x15f5ac){while(--_0x15f5ac){_0x2b14c8['push'](_0x2b14c8['shift']());}};_0x2f483d(++_0x54e01e);}(_0xecf4,0x14b));var _0x4ecf=function(_0x40b493,_0x4050de){_0x40b493=_0x40b493-0x0;var _0x548365=_0xecf4[_0x40b493];return _0x548365;};'use strict';var multer=require(_0x4ecf('0x0'));var util=require(_0x4ecf('0x1'));var path=require(_0x4ecf('0x2'));var timeout=require(_0x4ecf('0x3'));var express=require(_0x4ecf('0x4'));var router=express[_0x4ecf('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x4ecf('0x6'));var config=require(_0x4ecf('0x7'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4ecf('0x8')](_0x4ecf('0x9'),auth[_0x4ecf('0xa')](),controller[_0x4ecf('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4ecf('0xc')]);router['put']('/:id',auth[_0x4ecf('0xa')](),controller[_0x4ecf('0xd')]);router[_0x4ecf('0xe')](_0x4ecf('0x9'),auth['isAuthenticated'](),controller[_0x4ecf('0xf')]);module[_0x4ecf('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 5ca9cbb..991f767 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 _0x23d7=['exports','ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN','sequelize'];(function(_0x447c82,_0x407de3){var _0x5429aa=function(_0x5b5415){while(--_0x5b5415){_0x447c82['push'](_0x447c82['shift']());}};_0x5429aa(++_0x407de3);}(_0x23d7,0x1dc));var _0x723d=function(_0x2d68e2,_0x2feae3){_0x2d68e2=_0x2d68e2-0x0;var _0x5c6b8f=_0x23d7[_0x2d68e2];return _0x5c6b8f;};'use strict';var Sequelize=require(_0x723d('0x0'));module[_0x723d('0x1')]={'type':{'type':Sequelize[_0x723d('0x2')]('string',_0x723d('0x3'),_0x723d('0x4'),_0x723d('0x5')),'defaultValue':_0x723d('0x6')},'content':{'type':Sequelize[_0x723d('0x7')]},'key':{'type':Sequelize[_0x723d('0x7')]},'keyType':{'type':Sequelize[_0x723d('0x2')](_0x723d('0x6'),_0x723d('0x3'),_0x723d('0x4'))},'keyContent':{'type':Sequelize[_0x723d('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x723d('0x7')]},'customField':{'type':Sequelize[_0x723d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x723d('0x7')]}}; \ No newline at end of file +var _0xb6a5=['customVariable','STRING','BOOLEAN','exports','ENUM','keyValue','string','variable'];(function(_0x4c5e74,_0x319d00){var _0x48b7f6=function(_0x247742){while(--_0x247742){_0x4c5e74['push'](_0x4c5e74['shift']());}};_0x48b7f6(++_0x319d00);}(_0xb6a5,0x7b));var _0x5b6a=function(_0x229ed4,_0x559734){_0x229ed4=_0x229ed4-0x0;var _0xb015ae=_0xb6a5[_0x229ed4];return _0xb015ae;};'use strict';var Sequelize=require('sequelize');module[_0x5b6a('0x0')]={'type':{'type':Sequelize[_0x5b6a('0x1')]('string','variable','customVariable',_0x5b6a('0x2')),'defaultValue':_0x5b6a('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5b6a('0x1')](_0x5b6a('0x3'),_0x5b6a('0x4'),_0x5b6a('0x5'))},'keyContent':{'type':Sequelize[_0x5b6a('0x6')]},'idField':{'type':Sequelize[_0x5b6a('0x6')]},'nameField':{'type':Sequelize[_0x5b6a('0x6')]},'customField':{'type':Sequelize[_0x5b6a('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 94a31d7..029de8b 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 _0x7159=['ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','count','offset','set','Content-Range','json','reject','save','destroy','then','end','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','params','filtears','includeAll','find','catch','create','update','body','html-pdf','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv'];(function(_0x374b9d,_0x59eadb){var _0xf81d32=function(_0x355376){while(--_0x355376){_0x374b9d['push'](_0x374b9d['shift']());}};_0xf81d32(++_0x59eadb);}(_0x7159,0x1a7));var _0x9715=function(_0x90935a,_0x4dfbff){_0x90935a=_0x90935a-0x0;var _0x5b649e=_0x7159[_0x90935a];return _0x5b649e;};'use strict';var pdf=require(_0x9715('0x0'));var emlformat=require(_0x9715('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9715('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9715('0x3'));var BPromise=require(_0x9715('0x4'));var Mustache=require('mustache');var util=require(_0x9715('0x5'));var path=require(_0x9715('0x6'));var sox=require(_0x9715('0x7'));var csv=require(_0x9715('0x8'));var ejs=require(_0x9715('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9715('0xa'));var crypto=require(_0x9715('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9715('0xc'));var toCsv=require(_0x9715('0x8'));var querystring=require(_0x9715('0xd'));var Papa=require(_0x9715('0xe'));var Redis=require(_0x9715('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9715('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9715('0x11'))(_0x9715('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9715('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39d982,_0xcaccc8){_0xcaccc8=_0xcaccc8||0xcc;return function(_0x5af5a1){if(_0x5af5a1){return _0x39d982[_0x9715('0x14')](_0xcaccc8);}return _0x39d982[_0x9715('0x15')](_0xcaccc8)['end']();};}function respondWithResult(_0x4b1d00,_0x48d781){_0x48d781=_0x48d781||0xc8;return function(_0x5074eb){if(_0x5074eb){return _0x4b1d00[_0x9715('0x15')](_0x48d781)['json'](_0x5074eb);}};}function respondWithFilteredResult(_0xc287f8,_0x5ae7f1){return function(_0x5d98e8){if(_0x5d98e8){var _0x1d3544=_0x5d98e8[_0x9715('0x16')],_0x2f8eaa=_0x5ae7f1[_0x9715('0x17')],_0x36f54b=_0x5ae7f1[_0x9715('0x17')]+_0x5ae7f1['limit'],_0x45eada;if(_0x36f54b>=_0x1d3544){_0x36f54b=_0x1d3544;_0x45eada=0xc8;}else{_0x45eada=0xce;}_0xc287f8[_0x9715('0x15')](_0x45eada);return _0xc287f8[_0x9715('0x18')](_0x9715('0x19'),_0x2f8eaa+'-'+_0x36f54b+'/'+_0x1d3544)[_0x9715('0x1a')](_0x5d98e8);}return null;};}function patchUpdates(_0x40465e){return function(_0x30ea56){try{jsonpatch['apply'](_0x30ea56,_0x40465e,!![]);}catch(_0x369a10){return BPromise[_0x9715('0x1b')](_0x369a10);}return _0x30ea56[_0x9715('0x1c')]();};}function saveUpdates(_0x397847,_0x2cf94b){return function(_0x1d05cf){if(_0x1d05cf){return _0x1d05cf['update'](_0x397847)['then'](function(_0x2bf37b){return _0x2bf37b;});}return null;};}function removeEntity(_0x15d19e,_0x5ca744){return function(_0x28c8fd){if(_0x28c8fd){return _0x28c8fd[_0x9715('0x1d')]()[_0x9715('0x1e')](function(){_0x15d19e[_0x9715('0x15')](0xcc)[_0x9715('0x1f')]();});}};}function handleEntityNotFound(_0x5e5f19,_0x37dec3){return function(_0x2c37dc){if(!_0x2c37dc){_0x5e5f19['sendStatus'](0x194);}return _0x2c37dc;};}function handleError(_0x26a034,_0x35682d){_0x35682d=_0x35682d||0x1f4;return function(_0x42c887){logger[_0x9715('0x20')](_0x42c887[_0x9715('0x21')]);if(_0x42c887['name']){delete _0x42c887[_0x9715('0x22')];}_0x26a034['status'](_0x35682d)[_0x9715('0x23')](_0x42c887);};}exports[_0x9715('0x24')]=function(_0x22851c,_0x395df3){var _0x40ecb7={},_0x68c0a5={},_0x387ffd={'count':0x0,'rows':[]};var _0x5ec4ee=_[_0x9715('0x25')](db[_0x9715('0x26')][_0x9715('0x27')],function(_0x31206c){return{'name':_0x31206c[_0x9715('0x28')],'type':_0x31206c[_0x9715('0x29')][_0x9715('0x2a')]};});_0x68c0a5['model']=_[_0x9715('0x25')](_0x5ec4ee,_0x9715('0x22'));_0x68c0a5[_0x9715('0x2b')]=_[_0x9715('0x2c')](_0x22851c[_0x9715('0x2b')]);_0x68c0a5[_0x9715('0x2d')]=_[_0x9715('0x2e')](_0x68c0a5[_0x9715('0x2f')],_0x68c0a5[_0x9715('0x2b')]);_0x40ecb7[_0x9715('0x30')]=_['intersection'](_0x68c0a5[_0x9715('0x2f')],qs[_0x9715('0x31')](_0x22851c['query'][_0x9715('0x31')]));_0x40ecb7[_0x9715('0x30')]=_0x40ecb7[_0x9715('0x30')][_0x9715('0x32')]?_0x40ecb7[_0x9715('0x30')]:_0x68c0a5[_0x9715('0x2f')];if(!_0x22851c[_0x9715('0x2b')][_0x9715('0x33')]('nolimit')){_0x40ecb7[_0x9715('0x34')]=qs[_0x9715('0x34')](_0x22851c[_0x9715('0x2b')]['limit']);_0x40ecb7[_0x9715('0x17')]=qs[_0x9715('0x17')](_0x22851c[_0x9715('0x2b')]['offset']);}_0x40ecb7[_0x9715('0x35')]=qs[_0x9715('0x36')](_0x22851c[_0x9715('0x2b')][_0x9715('0x36')]);_0x40ecb7[_0x9715('0x37')]=qs[_0x9715('0x2d')](_[_0x9715('0x38')](_0x22851c[_0x9715('0x2b')],_0x68c0a5['filters']),_0x5ec4ee);if(_0x22851c[_0x9715('0x2b')]['filter']){_0x40ecb7['where']=_['merge'](_0x40ecb7[_0x9715('0x37')],{'$or':_[_0x9715('0x25')](_0x5ec4ee,function(_0x43d50d){if(_0x43d50d[_0x9715('0x29')]!==_0x9715('0x39')){var _0x55aab3={};_0x55aab3[_0x43d50d[_0x9715('0x22')]]={'$like':'%'+_0x22851c['query'][_0x9715('0x3a')]+'%'};return _0x55aab3;}})});}_0x40ecb7=_[_0x9715('0x3b')]({},_0x40ecb7,_0x22851c[_0x9715('0x3c')]);var _0x567e52={'where':_0x40ecb7['where']};return db[_0x9715('0x26')][_0x9715('0x16')](_0x567e52)[_0x9715('0x1e')](function(_0x472666){_0x387ffd[_0x9715('0x16')]=_0x472666;if(_0x22851c[_0x9715('0x2b')]['includeAll']){_0x40ecb7[_0x9715('0x3d')]=[{'all':!![]}];}return db[_0x9715('0x26')][_0x9715('0x3e')](_0x40ecb7);})[_0x9715('0x1e')](function(_0x5891a5){_0x387ffd[_0x9715('0x3f')]=_0x5891a5;return _0x387ffd;})['then'](respondWithFilteredResult(_0x395df3,_0x40ecb7))['catch'](handleError(_0x395df3,null));};exports['show']=function(_0x11b1ed,_0x3f80ba){var _0x445571={'raw':!![],'where':{'id':_0x11b1ed[_0x9715('0x40')]['id']}},_0x5e48ff={};_0x5e48ff[_0x9715('0x2f')]=_[_0x9715('0x2c')](db[_0x9715('0x26')][_0x9715('0x27')]);_0x5e48ff['query']=_[_0x9715('0x2c')](_0x11b1ed[_0x9715('0x2b')]);_0x5e48ff[_0x9715('0x41')]=_[_0x9715('0x2e')](_0x5e48ff['model'],_0x5e48ff[_0x9715('0x2b')]);_0x445571[_0x9715('0x30')]=_[_0x9715('0x2e')](_0x5e48ff['model'],qs[_0x9715('0x31')](_0x11b1ed[_0x9715('0x2b')]['fields']));_0x445571['attributes']=_0x445571[_0x9715('0x30')][_0x9715('0x32')]?_0x445571['attributes']:_0x5e48ff[_0x9715('0x2f')];if(_0x11b1ed[_0x9715('0x2b')][_0x9715('0x42')]){_0x445571[_0x9715('0x3d')]=[{'all':!![]}];}_0x445571=_['merge']({},_0x445571,_0x11b1ed[_0x9715('0x3c')]);return db[_0x9715('0x26')][_0x9715('0x43')](_0x445571)[_0x9715('0x1e')](handleEntityNotFound(_0x3f80ba,null))[_0x9715('0x1e')](respondWithResult(_0x3f80ba,null))[_0x9715('0x44')](handleError(_0x3f80ba,null));};exports[_0x9715('0x45')]=function(_0x13a012,_0x4603a9){return db[_0x9715('0x26')]['create'](_0x13a012['body'],{})[_0x9715('0x1e')](respondWithResult(_0x4603a9,0xc9))['catch'](handleError(_0x4603a9,null));};exports[_0x9715('0x46')]=function(_0x26a04b,_0xb9e541){if(_0x26a04b[_0x9715('0x47')]['id']){delete _0x26a04b[_0x9715('0x47')]['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x26a04b[_0x9715('0x40')]['id']}})[_0x9715('0x1e')](handleEntityNotFound(_0xb9e541,null))[_0x9715('0x1e')](saveUpdates(_0x26a04b['body'],null))['then'](respondWithResult(_0xb9e541,null))[_0x9715('0x44')](handleError(_0xb9e541,null));};exports[_0x9715('0x1d')]=function(_0x172add,_0x5c1abe){return db[_0x9715('0x26')][_0x9715('0x43')]({'where':{'id':_0x172add[_0x9715('0x40')]['id']}})[_0x9715('0x1e')](handleEntityNotFound(_0x5c1abe,null))['then'](removeEntity(_0x5c1abe,null))['catch'](handleError(_0x5c1abe,null));}; \ No newline at end of file +var _0x0d2e=['include','findAll','rows','catch','show','params','filtears','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll'];(function(_0x51834b,_0x446dc3){var _0x20ca1d=function(_0x37ce47){while(--_0x37ce47){_0x51834b['push'](_0x51834b['shift']());}};_0x20ca1d(++_0x446dc3);}(_0x0d2e,0x1e4));var _0xe0d2=function(_0x120e59,_0x443649){_0x120e59=_0x120e59-0x0;var _0x53ff80=_0x0d2e[_0x120e59];return _0x53ff80;};'use strict';var pdf=require(_0xe0d2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe0d2('0x1'));var zipdir=require(_0xe0d2('0x2'));var jsonpatch=require(_0xe0d2('0x3'));var rp=require(_0xe0d2('0x4'));var moment=require(_0xe0d2('0x5'));var BPromise=require(_0xe0d2('0x6'));var Mustache=require(_0xe0d2('0x7'));var util=require('util');var path=require(_0xe0d2('0x8'));var sox=require(_0xe0d2('0x9'));var csv=require(_0xe0d2('0xa'));var ejs=require(_0xe0d2('0xb'));var fs=require('fs');var _=require(_0xe0d2('0xc'));var squel=require(_0xe0d2('0xd'));var crypto=require('crypto');var jsforce=require(_0xe0d2('0xe'));var deskjs=require(_0xe0d2('0xf'));var toCsv=require(_0xe0d2('0xa'));var querystring=require(_0xe0d2('0x10'));var Papa=require('papaparse');var Redis=require(_0xe0d2('0x11'));var authService=require(_0xe0d2('0x12'));var qs=require(_0xe0d2('0x13'));var as=require(_0xe0d2('0x14'));var hardwareService=require(_0xe0d2('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xe0d2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe0d2('0x17'));var db=require(_0xe0d2('0x18'))['db'];function respondWithStatusCode(_0x543a98,_0x38efb4){_0x38efb4=_0x38efb4||0xcc;return function(_0x5943c2){if(_0x5943c2){return _0x543a98[_0xe0d2('0x19')](_0x38efb4);}return _0x543a98[_0xe0d2('0x1a')](_0x38efb4)[_0xe0d2('0x1b')]();};}function respondWithResult(_0x3faf54,_0x10ef11){_0x10ef11=_0x10ef11||0xc8;return function(_0xa7bc9f){if(_0xa7bc9f){return _0x3faf54[_0xe0d2('0x1a')](_0x10ef11)[_0xe0d2('0x1c')](_0xa7bc9f);}};}function respondWithFilteredResult(_0x3d0df6,_0x2d20d8){return function(_0x5d797f){if(_0x5d797f){var _0x4e8ebd=_0x5d797f['count'],_0x8696e7=_0x2d20d8['offset'],_0x48436e=_0x2d20d8[_0xe0d2('0x1d')]+_0x2d20d8[_0xe0d2('0x1e')],_0x136002;if(_0x48436e>=_0x4e8ebd){_0x48436e=_0x4e8ebd;_0x136002=0xc8;}else{_0x136002=0xce;}_0x3d0df6[_0xe0d2('0x1a')](_0x136002);return _0x3d0df6[_0xe0d2('0x1f')](_0xe0d2('0x20'),_0x8696e7+'-'+_0x48436e+'/'+_0x4e8ebd)[_0xe0d2('0x1c')](_0x5d797f);}return null;};}function patchUpdates(_0x187e0e){return function(_0x546ed0){try{jsonpatch[_0xe0d2('0x21')](_0x546ed0,_0x187e0e,!![]);}catch(_0x30e4c2){return BPromise[_0xe0d2('0x22')](_0x30e4c2);}return _0x546ed0[_0xe0d2('0x23')]();};}function saveUpdates(_0x1e7ecc,_0x477236){return function(_0xd1b365){if(_0xd1b365){return _0xd1b365[_0xe0d2('0x24')](_0x1e7ecc)[_0xe0d2('0x25')](function(_0x41c460){return _0x41c460;});}return null;};}function removeEntity(_0x833664,_0x2c0d16){return function(_0x5563dc){if(_0x5563dc){return _0x5563dc['destroy']()[_0xe0d2('0x25')](function(){_0x833664[_0xe0d2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eb237,_0x4e875b){return function(_0x39d8c6){if(!_0x39d8c6){_0x3eb237[_0xe0d2('0x19')](0x194);}return _0x39d8c6;};}function handleError(_0x99993b,_0x287e86){_0x287e86=_0x287e86||0x1f4;return function(_0x1b940a){logger[_0xe0d2('0x26')](_0x1b940a[_0xe0d2('0x27')]);if(_0x1b940a['name']){delete _0x1b940a[_0xe0d2('0x28')];}_0x99993b[_0xe0d2('0x1a')](_0x287e86)[_0xe0d2('0x29')](_0x1b940a);};}exports[_0xe0d2('0x2a')]=function(_0x2c91c9,_0x1bf32c){var _0x33c16b={},_0x39ffb2={},_0x36a62a={'count':0x0,'rows':[]};var _0x50d10c=_[_0xe0d2('0x2b')](db[_0xe0d2('0x2c')][_0xe0d2('0x2d')],function(_0x27ff7d){return{'name':_0x27ff7d[_0xe0d2('0x2e')],'type':_0x27ff7d[_0xe0d2('0x2f')][_0xe0d2('0x30')]};});_0x39ffb2[_0xe0d2('0x31')]=_['map'](_0x50d10c,'name');_0x39ffb2[_0xe0d2('0x32')]=_[_0xe0d2('0x33')](_0x2c91c9[_0xe0d2('0x32')]);_0x39ffb2[_0xe0d2('0x34')]=_[_0xe0d2('0x35')](_0x39ffb2[_0xe0d2('0x31')],_0x39ffb2[_0xe0d2('0x32')]);_0x33c16b[_0xe0d2('0x36')]=_[_0xe0d2('0x35')](_0x39ffb2[_0xe0d2('0x31')],qs['fields'](_0x2c91c9[_0xe0d2('0x32')][_0xe0d2('0x37')]));_0x33c16b['attributes']=_0x33c16b['attributes'][_0xe0d2('0x38')]?_0x33c16b[_0xe0d2('0x36')]:_0x39ffb2[_0xe0d2('0x31')];if(!_0x2c91c9[_0xe0d2('0x32')][_0xe0d2('0x39')](_0xe0d2('0x3a'))){_0x33c16b[_0xe0d2('0x1e')]=qs[_0xe0d2('0x1e')](_0x2c91c9['query']['limit']);_0x33c16b[_0xe0d2('0x1d')]=qs[_0xe0d2('0x1d')](_0x2c91c9['query'][_0xe0d2('0x1d')]);}_0x33c16b[_0xe0d2('0x3b')]=qs[_0xe0d2('0x3c')](_0x2c91c9[_0xe0d2('0x32')][_0xe0d2('0x3c')]);_0x33c16b[_0xe0d2('0x3d')]=qs[_0xe0d2('0x34')](_[_0xe0d2('0x3e')](_0x2c91c9['query'],_0x39ffb2[_0xe0d2('0x34')]),_0x50d10c);if(_0x2c91c9[_0xe0d2('0x32')][_0xe0d2('0x3f')]){_0x33c16b[_0xe0d2('0x3d')]=_[_0xe0d2('0x40')](_0x33c16b['where'],{'$or':_['map'](_0x50d10c,function(_0x42a1b8){if(_0x42a1b8['type']!==_0xe0d2('0x41')){var _0x1c9a68={};_0x1c9a68[_0x42a1b8[_0xe0d2('0x28')]]={'$like':'%'+_0x2c91c9[_0xe0d2('0x32')]['filter']+'%'};return _0x1c9a68;}})});}_0x33c16b=_[_0xe0d2('0x40')]({},_0x33c16b,_0x2c91c9[_0xe0d2('0x42')]);var _0x4ef1aa={'where':_0x33c16b[_0xe0d2('0x3d')]};return db[_0xe0d2('0x2c')]['count'](_0x4ef1aa)[_0xe0d2('0x25')](function(_0x1cf37c){_0x36a62a[_0xe0d2('0x43')]=_0x1cf37c;if(_0x2c91c9['query'][_0xe0d2('0x44')]){_0x33c16b[_0xe0d2('0x45')]=[{'all':!![]}];}return db[_0xe0d2('0x2c')][_0xe0d2('0x46')](_0x33c16b);})[_0xe0d2('0x25')](function(_0x5950a2){_0x36a62a[_0xe0d2('0x47')]=_0x5950a2;return _0x36a62a;})['then'](respondWithFilteredResult(_0x1bf32c,_0x33c16b))[_0xe0d2('0x48')](handleError(_0x1bf32c,null));};exports[_0xe0d2('0x49')]=function(_0x2862ca,_0x47a9c0){var _0x5d9b61={'raw':!![],'where':{'id':_0x2862ca[_0xe0d2('0x4a')]['id']}},_0x3636df={};_0x3636df['model']=_[_0xe0d2('0x33')](db[_0xe0d2('0x2c')][_0xe0d2('0x2d')]);_0x3636df[_0xe0d2('0x32')]=_['keys'](_0x2862ca[_0xe0d2('0x32')]);_0x3636df[_0xe0d2('0x4b')]=_[_0xe0d2('0x35')](_0x3636df[_0xe0d2('0x31')],_0x3636df[_0xe0d2('0x32')]);_0x5d9b61[_0xe0d2('0x36')]=_[_0xe0d2('0x35')](_0x3636df[_0xe0d2('0x31')],qs[_0xe0d2('0x37')](_0x2862ca[_0xe0d2('0x32')]['fields']));_0x5d9b61[_0xe0d2('0x36')]=_0x5d9b61[_0xe0d2('0x36')]['length']?_0x5d9b61[_0xe0d2('0x36')]:_0x3636df[_0xe0d2('0x31')];if(_0x2862ca[_0xe0d2('0x32')][_0xe0d2('0x44')]){_0x5d9b61[_0xe0d2('0x45')]=[{'all':!![]}];}_0x5d9b61=_['merge']({},_0x5d9b61,_0x2862ca['options']);return db[_0xe0d2('0x2c')][_0xe0d2('0x4c')](_0x5d9b61)[_0xe0d2('0x25')](handleEntityNotFound(_0x47a9c0,null))[_0xe0d2('0x25')](respondWithResult(_0x47a9c0,null))['catch'](handleError(_0x47a9c0,null));};exports['create']=function(_0x48a75e,_0xf35b27){return db['FreshsalesField'][_0xe0d2('0x4d')](_0x48a75e[_0xe0d2('0x4e')],{})['then'](respondWithResult(_0xf35b27,0xc9))[_0xe0d2('0x48')](handleError(_0xf35b27,null));};exports['update']=function(_0x4c8134,_0x33489c){if(_0x4c8134[_0xe0d2('0x4e')]['id']){delete _0x4c8134[_0xe0d2('0x4e')]['id'];}return db[_0xe0d2('0x2c')][_0xe0d2('0x4c')]({'where':{'id':_0x4c8134[_0xe0d2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x33489c,null))[_0xe0d2('0x25')](saveUpdates(_0x4c8134['body'],null))[_0xe0d2('0x25')](respondWithResult(_0x33489c,null))[_0xe0d2('0x48')](handleError(_0x33489c,null));};exports['destroy']=function(_0x1ecafb,_0x22cc9e){return db['FreshsalesField']['find']({'where':{'id':_0x1ecafb[_0xe0d2('0x4a')]['id']}})[_0xe0d2('0x25')](handleEntityNotFound(_0x22cc9e,null))[_0xe0d2('0x25')](removeEntity(_0x22cc9e,null))['catch'](handleError(_0x22cc9e,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 0a394be..3287fed 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 _0x723e=['lodash','util','../../config/logger','api','bluebird','../../config/environment','./intFreshsalesField.attributes','exports','int_freshsales_fields','freshsales_unique_index','FieldId'];(function(_0x5dea2f,_0x3132c4){var _0x3d4558=function(_0x32cc79){while(--_0x32cc79){_0x5dea2f['push'](_0x5dea2f['shift']());}};_0x3d4558(++_0x3132c4);}(_0x723e,0x1a2));var _0xe723=function(_0x34c437,_0x28501c){_0x34c437=_0x34c437-0x0;var _0x37e190=_0x723e[_0x34c437];return _0x37e190;};'use strict';var _=require(_0xe723('0x0'));var util=require(_0xe723('0x1'));var logger=require(_0xe723('0x2'))(_0xe723('0x3'));var moment=require('moment');var BPromise=require(_0xe723('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe723('0x5'));var attributes=require(_0xe723('0x6'));module[_0xe723('0x7')]=function(_0x233000,_0x22f973){return _0x233000['define']('FreshsalesField',attributes,{'tableName':_0xe723('0x8'),'paranoid':![],'indexes':[{'name':_0xe723('0x9'),'fields':['idField',_0xe723('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x36ee=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','freshsales_unique_index','FieldId','../../config/logger','moment'];(function(_0x508dc5,_0x1aa23c){var _0x403554=function(_0x25d1ac){while(--_0x25d1ac){_0x508dc5['push'](_0x508dc5['shift']());}};_0x403554(++_0x1aa23c);}(_0x36ee,0xe8));var _0xe36e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x36ee[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe36e('0x0'))('api');var moment=require(_0xe36e('0x1'));var BPromise=require(_0xe36e('0x2'));var rp=require(_0xe36e('0x3'));var fs=require('fs');var path=require(_0xe36e('0x4'));var rimraf=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var attributes=require(_0xe36e('0x7'));module[_0xe36e('0x8')]=function(_0x25a07d,_0x190404){return _0x25a07d[_0xe36e('0x9')](_0xe36e('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xe36e('0xb'),'fields':['idField',_0xe36e('0xc')],'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 0d96cc8..debe5d4 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 _0x8946=['request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5263d4,_0x281f33){var _0x458f0a=function(_0x57a212){while(--_0x57a212){_0x5263d4['push'](_0x5263d4['shift']());}};_0x458f0a(++_0x281f33);}(_0x8946,0x130));var _0x6894=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x8946[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x6894('0x0'));var util=require(_0x6894('0x1'));var moment=require(_0x6894('0x2'));var BPromise=require('bluebird');var rs=require(_0x6894('0x3'));var fs=require('fs');var Redis=require(_0x6894('0x4'));var db=require(_0x6894('0x5'))['db'];var utils=require(_0x6894('0x6'));var logger=require(_0x6894('0x7'))(_0x6894('0x8'));var config=require(_0x6894('0x9'));var jayson=require(_0x6894('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4fa96f,_0x4b50d5,_0x481c37){return new BPromise(function(_0x596385,_0x54cfcb){return client[_0x6894('0xb')](_0x4fa96f,_0x481c37)['then'](function(_0x2228db){logger[_0x6894('0xc')](_0x6894('0xd'),_0x4b50d5,_0x6894('0xe'));logger[_0x6894('0xf')](_0x6894('0x10'),_0x4b50d5,_0x6894('0xe'),JSON[_0x6894('0x11')](_0x2228db));if(_0x2228db[_0x6894('0x12')]){if(_0x2228db[_0x6894('0x12')]['code']===0x1f4){logger[_0x6894('0x12')](_0x6894('0xd'),_0x4b50d5,_0x2228db[_0x6894('0x12')]['message']);return _0x54cfcb(_0x2228db['error'][_0x6894('0x13')]);}logger[_0x6894('0x12')](_0x6894('0xd'),_0x4b50d5,_0x2228db[_0x6894('0x12')]['message']);return _0x596385(_0x2228db[_0x6894('0x12')][_0x6894('0x13')]);}else{logger[_0x6894('0xc')](_0x6894('0xd'),_0x4b50d5,_0x6894('0xe'));_0x596385(_0x2228db[_0x6894('0x14')][_0x6894('0x13')]);}})['catch'](function(_0x4318f7){logger['error'](_0x6894('0xd'),_0x4b50d5,_0x4318f7);_0x54cfcb(_0x4318f7);});});} \ No newline at end of file +var _0x253d=['http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x253d,0x1c7));var _0xd253=function(_0x547c46,_0x10c804){_0x547c46=_0x547c46-0x0;var _0x5a15ab=_0x253d[_0x547c46];return _0x5a15ab;};'use strict';var _=require(_0xd253('0x0'));var util=require(_0xd253('0x1'));var moment=require(_0xd253('0x2'));var BPromise=require(_0xd253('0x3'));var rs=require(_0xd253('0x4'));var fs=require('fs');var Redis=require(_0xd253('0x5'));var db=require(_0xd253('0x6'))['db'];var utils=require(_0xd253('0x7'));var logger=require(_0xd253('0x8'))(_0xd253('0x9'));var config=require(_0xd253('0xa'));var jayson=require(_0xd253('0xb'));var client=jayson[_0xd253('0xc')][_0xd253('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x6d5a81,_0x2c1bc5,_0x44a497){return new BPromise(function(_0x1fac9d,_0x2afded){return client[_0xd253('0xe')](_0x6d5a81,_0x44a497)['then'](function(_0x58e270){logger[_0xd253('0xf')](_0xd253('0x10'),_0x2c1bc5,_0xd253('0x11'));logger[_0xd253('0x12')](_0xd253('0x13'),_0x2c1bc5,_0xd253('0x11'),JSON[_0xd253('0x14')](_0x58e270));if(_0x58e270['error']){if(_0x58e270[_0xd253('0x15')][_0xd253('0x16')]===0x1f4){logger[_0xd253('0x15')](_0xd253('0x10'),_0x2c1bc5,_0x58e270['error']['message']);return _0x2afded(_0x58e270[_0xd253('0x15')][_0xd253('0x17')]);}logger[_0xd253('0x15')]('FreshsalesField,\x20%s,\x20%s',_0x2c1bc5,_0x58e270[_0xd253('0x15')][_0xd253('0x17')]);return _0x1fac9d(_0x58e270[_0xd253('0x15')][_0xd253('0x17')]);}else{logger['info'](_0xd253('0x10'),_0x2c1bc5,'request\x20sent');_0x1fac9d(_0x58e270[_0xd253('0x18')][_0xd253('0x17')]);}})[_0xd253('0x19')](function(_0x12fc0b){logger[_0xd253('0x15')]('FreshsalesField,\x20%s,\x20%s',_0x2c1bc5,_0x12fc0b);_0x2afded(_0x12fc0b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 81d1876..5b0860f 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 _0x4371=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','isAuthenticated','get','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x482214,_0x2550ff){var _0x38d0cb=function(_0x2ba281){while(--_0x2ba281){_0x482214['push'](_0x482214['shift']());}};_0x38d0cb(++_0x2550ff);}(_0x4371,0x192));var _0x1437=function(_0x5a5cfb,_0x37ed01){_0x5a5cfb=_0x5a5cfb-0x0;var _0x334936=_0x4371[_0x5a5cfb];return _0x334936;};'use strict';var multer=require(_0x1437('0x0'));var util=require(_0x1437('0x1'));var path=require(_0x1437('0x2'));var timeout=require(_0x1437('0x3'));var express=require(_0x1437('0x4'));var router=express[_0x1437('0x5')]();var auth=require(_0x1437('0x6'));var interaction=require(_0x1437('0x7'));var config=require(_0x1437('0x8'));var controller=require(_0x1437('0x9'));router['get']('/',auth[_0x1437('0xa')](),controller['index']);router[_0x1437('0xb')]('/:id',auth[_0x1437('0xa')](),controller[_0x1437('0xc')]);router[_0x1437('0xb')]('/:id/configurations',auth[_0x1437('0xa')](),controller[_0x1437('0xd')]);router[_0x1437('0xb')](_0x1437('0xe'),auth[_0x1437('0xa')](),controller[_0x1437('0xf')]);router[_0x1437('0x10')]('/',auth['isAuthenticated'](),controller[_0x1437('0x11')]);router[_0x1437('0x10')](_0x1437('0x12'),auth[_0x1437('0xa')](),controller['addConfiguration']);router['put'](_0x1437('0x13'),auth[_0x1437('0xa')](),controller[_0x1437('0x14')]);router[_0x1437('0x15')](_0x1437('0x13'),auth['isAuthenticated'](),controller[_0x1437('0x16')]);module[_0x1437('0x17')]=router; \ No newline at end of file +var _0xfb0e=['/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x2df60d,_0x1e08b1){var _0x210ff1=function(_0x343efc){while(--_0x343efc){_0x2df60d['push'](_0x2df60d['shift']());}};_0x210ff1(++_0x1e08b1);}(_0xfb0e,0x13c));var _0xefb0=function(_0x5d225a,_0x2debe9){_0x5d225a=_0x5d225a-0x0;var _0x1e7761=_0xfb0e[_0x5d225a];return _0x1e7761;};'use strict';var multer=require(_0xefb0('0x0'));var util=require(_0xefb0('0x1'));var path=require(_0xefb0('0x2'));var timeout=require(_0xefb0('0x3'));var express=require(_0xefb0('0x4'));var router=express[_0xefb0('0x5')]();var auth=require(_0xefb0('0x6'));var interaction=require(_0xefb0('0x7'));var config=require(_0xefb0('0x8'));var controller=require('./intSalesforceAccount.controller');router[_0xefb0('0x9')]('/',auth[_0xefb0('0xa')](),controller[_0xefb0('0xb')]);router[_0xefb0('0x9')]('/:id',auth[_0xefb0('0xa')](),controller[_0xefb0('0xc')]);router[_0xefb0('0x9')](_0xefb0('0xd'),auth['isAuthenticated'](),controller[_0xefb0('0xe')]);router[_0xefb0('0x9')](_0xefb0('0xf'),auth['isAuthenticated'](),controller[_0xefb0('0x10')]);router[_0xefb0('0x11')]('/',auth['isAuthenticated'](),controller[_0xefb0('0x12')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xefb0('0x13')]);router['put'](_0xefb0('0x14'),auth[_0xefb0('0xa')](),controller['update']);router[_0xefb0('0x15')](_0xefb0('0x14'),auth['isAuthenticated'](),controller[_0xefb0('0x16')]);module[_0xefb0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 65b9178..5b92d55 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 _0x5fc3=['STRING','username','newTab','sequelize','exports'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x5fc3,0xa8));var _0x35fc=function(_0x27ddf5,_0x5a3e18){_0x27ddf5=_0x27ddf5-0x0;var _0x26e74a=_0x5fc3[_0x27ddf5];return _0x26e74a;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x35fc('0x2')]},'username':{'type':Sequelize[_0x35fc('0x2')],'unique':_0x35fc('0x3')},'remoteUri':{'type':Sequelize[_0x35fc('0x2')]},'password':{'type':Sequelize[_0x35fc('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x35fc('0x2')]},'securityToken':{'type':Sequelize[_0x35fc('0x2')]},'serverUrl':{'type':Sequelize[_0x35fc('0x2')]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x35fc('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x9957=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x2fe7a5,_0x58e280){var _0x279de0=function(_0x2db63c){while(--_0x2db63c){_0x2fe7a5['push'](_0x2fe7a5['shift']());}};_0x279de0(++_0x58e280);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')]},'description':{'type':Sequelize[_0x7995('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x7995('0x3')},'remoteUri':{'type':Sequelize[_0x7995('0x2')]},'password':{'type':Sequelize[_0x7995('0x2')]},'clientId':{'type':Sequelize[_0x7995('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x7995('0x2')]},'serverUrl':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x4')](_0x7995('0x5'),_0x7995('0x6')),'defaultValue':_0x7995('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index a46f180..3eca5c5 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 _0xdf94=['getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','login','concat','ticketType','sobject','describe','CallDisposition','CallObject','CallType','IsArchived','Status','Type','isNil','Origin','Reason','Priority','IsEscalated','SuppliedName','SuppliedCompany','custom','includes','picklistValues','label','value','True','False','false','test','statusCode','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','then','include','show','params','includeAll','find','body','getConfigurations','findOne','SalesforceConfiguration','pick','addConfiguration','getSubjects','channel','Descriptions','create','SalesforceField'];(function(_0x19a44e,_0x1f05dc){var _0x36e8e3=function(_0x33ce4b){while(--_0x33ce4b){_0x19a44e['push'](_0x19a44e['shift']());}};_0x36e8e3(++_0x1f05dc);}(_0xdf94,0xad));var _0x4df9=function(_0x3f39b6,_0x574c30){_0x3f39b6=_0x3f39b6-0x0;var _0x1609c2=_0xdf94[_0x3f39b6];return _0x1609c2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4df9('0x0'));var rimraf=require(_0x4df9('0x1'));var zipdir=require(_0x4df9('0x2'));var jsonpatch=require(_0x4df9('0x3'));var rp=require(_0x4df9('0x4'));var moment=require(_0x4df9('0x5'));var BPromise=require(_0x4df9('0x6'));var Mustache=require(_0x4df9('0x7'));var util=require(_0x4df9('0x8'));var path=require(_0x4df9('0x9'));var sox=require(_0x4df9('0xa'));var csv=require(_0x4df9('0xb'));var ejs=require(_0x4df9('0xc'));var fs=require('fs');var _=require(_0x4df9('0xd'));var squel=require(_0x4df9('0xe'));var crypto=require(_0x4df9('0xf'));var jsforce=require(_0x4df9('0x10'));var deskjs=require(_0x4df9('0x11'));var toCsv=require('to-csv');var querystring=require(_0x4df9('0x12'));var Papa=require(_0x4df9('0x13'));var Redis=require(_0x4df9('0x14'));var authService=require(_0x4df9('0x15'));var qs=require(_0x4df9('0x16'));var as=require(_0x4df9('0x17'));var hardwareService=require(_0x4df9('0x18'));var logger=require('../../config/logger')('api');var utils=require(_0x4df9('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x4df9('0x1a'));var db=require(_0x4df9('0x1b'))['db'];var integrations=require(_0x4df9('0x1c'));var jayson=require(_0x4df9('0x1d'));var client=jayson['client'][_0x4df9('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x354c9b,_0x2d7cf2,_0x5aa2c1,_0xe3614f){return new BPromise(function(_0x1a35ef,_0xc141bb){var _0x4fe068=_0xe3614f||client;return _0x4fe068[_0x4df9('0x1f')](_0x354c9b,_0x5aa2c1)['then'](function(_0x13d9c6){logger[_0x4df9('0x20')](_0x4df9('0x21'),_0x2d7cf2,_0x4df9('0x22'));logger['debug'](_0x4df9('0x23'),_0x2d7cf2,_0x4df9('0x22'),JSON[_0x4df9('0x24')](_0x13d9c6));if(_0x13d9c6['error']){if(_0x13d9c6[_0x4df9('0x25')]['code']===0x1f4){logger[_0x4df9('0x25')](_0x4df9('0x21'),_0x2d7cf2,_0x13d9c6[_0x4df9('0x25')][_0x4df9('0x26')]);return _0xc141bb(_0x13d9c6[_0x4df9('0x25')]['message']);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x2d7cf2,_0x13d9c6[_0x4df9('0x25')][_0x4df9('0x26')]);return _0x1a35ef(_0x13d9c6[_0x4df9('0x25')][_0x4df9('0x26')]);}else{logger[_0x4df9('0x20')](_0x4df9('0x21'),_0x2d7cf2,_0x4df9('0x22'));_0x1a35ef(_0x13d9c6['result'][_0x4df9('0x26')]);}})[_0x4df9('0x27')](function(_0x178841){logger[_0x4df9('0x25')](_0x4df9('0x21'),_0x2d7cf2,_0x178841);_0xc141bb(_0x178841);});});}function respondWithStatusCode(_0x56fd4b,_0x316f5c){_0x316f5c=_0x316f5c||0xcc;return function(_0x3473cc){if(_0x3473cc){return _0x56fd4b['sendStatus'](_0x316f5c);}return _0x56fd4b['status'](_0x316f5c)[_0x4df9('0x28')]();};}function respondWithResult(_0x2ba01c,_0x4c7d68){_0x4c7d68=_0x4c7d68||0xc8;return function(_0x4234d1){if(_0x4234d1){return _0x2ba01c[_0x4df9('0x29')](_0x4c7d68)[_0x4df9('0x2a')](_0x4234d1);}};}function respondWithFilteredResult(_0x3c069f,_0x233150){return function(_0x461de2){if(_0x461de2){var _0x5e4f21=_0x461de2[_0x4df9('0x2b')],_0x10d7f6=_0x233150[_0x4df9('0x2c')],_0x38c7a9=_0x233150[_0x4df9('0x2c')]+_0x233150[_0x4df9('0x2d')],_0x599fc8;if(_0x38c7a9>=_0x5e4f21){_0x38c7a9=_0x5e4f21;_0x599fc8=0xc8;}else{_0x599fc8=0xce;}_0x3c069f['status'](_0x599fc8);return _0x3c069f[_0x4df9('0x2e')](_0x4df9('0x2f'),_0x10d7f6+'-'+_0x38c7a9+'/'+_0x5e4f21)[_0x4df9('0x2a')](_0x461de2);}return null;};}function patchUpdates(_0x32a88e){return function(_0x428910){try{jsonpatch[_0x4df9('0x30')](_0x428910,_0x32a88e,!![]);}catch(_0x3ee40a){return BPromise[_0x4df9('0x31')](_0x3ee40a);}return _0x428910['save']();};}function saveUpdates(_0x150b6a,_0x3079f4){return function(_0x3a5746){if(_0x3a5746){return _0x3a5746[_0x4df9('0x32')](_0x150b6a)['then'](function(_0x24de38){return _0x24de38;});}return null;};}function removeEntity(_0x5cb835,_0x20c2fd){return function(_0x13337e){if(_0x13337e){return _0x13337e[_0x4df9('0x33')]()['then'](function(){_0x5cb835['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x586e25,_0x2e6f30){return function(_0x2c166b){if(!_0x2c166b){_0x586e25['sendStatus'](0x194);}return _0x2c166b;};}function handleError(_0x4847a8,_0x44bc0b){_0x44bc0b=_0x44bc0b||0x1f4;return function(_0x4da4d2){logger[_0x4df9('0x25')](_0x4da4d2['stack']);if(_0x4da4d2[_0x4df9('0x34')]){delete _0x4da4d2[_0x4df9('0x34')];}_0x4847a8['status'](_0x44bc0b)['send'](_0x4da4d2);};}exports[_0x4df9('0x35')]=function(_0x1f48c9,_0x3b8cac){var _0xdd21b8={},_0x79eb6={},_0x514fb1={'count':0x0,'rows':[]};var _0x49d9ea=_[_0x4df9('0x36')](db[_0x4df9('0x37')][_0x4df9('0x38')],function(_0x18545b){return{'name':_0x18545b[_0x4df9('0x39')],'type':_0x18545b[_0x4df9('0x3a')][_0x4df9('0x3b')]};});_0x79eb6[_0x4df9('0x3c')]=_['map'](_0x49d9ea,_0x4df9('0x34'));_0x79eb6[_0x4df9('0x3d')]=_[_0x4df9('0x3e')](_0x1f48c9[_0x4df9('0x3d')]);_0x79eb6[_0x4df9('0x3f')]=_[_0x4df9('0x40')](_0x79eb6['model'],_0x79eb6[_0x4df9('0x3d')]);_0xdd21b8[_0x4df9('0x41')]=_[_0x4df9('0x40')](_0x79eb6[_0x4df9('0x3c')],qs[_0x4df9('0x42')](_0x1f48c9[_0x4df9('0x3d')]['fields']));_0xdd21b8['attributes']=_0xdd21b8[_0x4df9('0x41')][_0x4df9('0x43')]?_0xdd21b8['attributes']:_0x79eb6[_0x4df9('0x3c')];if(!_0x1f48c9[_0x4df9('0x3d')][_0x4df9('0x44')]('nolimit')){_0xdd21b8['limit']=qs[_0x4df9('0x2d')](_0x1f48c9[_0x4df9('0x3d')][_0x4df9('0x2d')]);_0xdd21b8[_0x4df9('0x2c')]=qs[_0x4df9('0x2c')](_0x1f48c9['query'][_0x4df9('0x2c')]);}_0xdd21b8[_0x4df9('0x45')]=qs[_0x4df9('0x46')](_0x1f48c9['query'][_0x4df9('0x46')]);_0xdd21b8[_0x4df9('0x47')]=qs[_0x4df9('0x3f')](_['pick'](_0x1f48c9[_0x4df9('0x3d')],_0x79eb6[_0x4df9('0x3f')]),_0x49d9ea);if(_0x1f48c9[_0x4df9('0x3d')]['filter']){_0xdd21b8[_0x4df9('0x47')]=_[_0x4df9('0x48')](_0xdd21b8[_0x4df9('0x47')],{'$or':_['map'](_0x49d9ea,function(_0x582569){if(_0x582569[_0x4df9('0x3a')]!==_0x4df9('0x49')){var _0x18bae7={};_0x18bae7[_0x582569['name']]={'$like':'%'+_0x1f48c9[_0x4df9('0x3d')][_0x4df9('0x4a')]+'%'};return _0x18bae7;}})});}_0xdd21b8=_['merge']({},_0xdd21b8,_0x1f48c9[_0x4df9('0x4b')]);var _0x3822c7={'where':_0xdd21b8[_0x4df9('0x47')]};return db[_0x4df9('0x37')][_0x4df9('0x2b')](_0x3822c7)[_0x4df9('0x4c')](function(_0x1f1337){_0x514fb1[_0x4df9('0x2b')]=_0x1f1337;if(_0x1f48c9[_0x4df9('0x3d')]['includeAll']){_0xdd21b8[_0x4df9('0x4d')]=[{'all':!![]}];}return db[_0x4df9('0x37')]['findAll'](_0xdd21b8);})['then'](function(_0x2882f9){_0x514fb1['rows']=_0x2882f9;return _0x514fb1;})['then'](respondWithFilteredResult(_0x3b8cac,_0xdd21b8))[_0x4df9('0x27')](handleError(_0x3b8cac,null));};exports[_0x4df9('0x4e')]=function(_0x122a65,_0x52faad){var _0x1d08fd={'raw':![],'where':{'id':_0x122a65[_0x4df9('0x4f')]['id']}},_0x4c0bc9={};_0x4c0bc9[_0x4df9('0x3c')]=_[_0x4df9('0x3e')](db['SalesforceAccount'][_0x4df9('0x38')]);_0x4c0bc9['query']=_[_0x4df9('0x3e')](_0x122a65[_0x4df9('0x3d')]);_0x4c0bc9['filtears']=_[_0x4df9('0x40')](_0x4c0bc9[_0x4df9('0x3c')],_0x4c0bc9[_0x4df9('0x3d')]);_0x1d08fd[_0x4df9('0x41')]=_[_0x4df9('0x40')](_0x4c0bc9['model'],qs[_0x4df9('0x42')](_0x122a65[_0x4df9('0x3d')][_0x4df9('0x42')]));_0x1d08fd[_0x4df9('0x41')]=_0x1d08fd[_0x4df9('0x41')][_0x4df9('0x43')]?_0x1d08fd[_0x4df9('0x41')]:_0x4c0bc9['model'];if(_0x122a65[_0x4df9('0x3d')][_0x4df9('0x50')]){_0x1d08fd[_0x4df9('0x4d')]=[{'all':!![]}];}_0x1d08fd=_[_0x4df9('0x48')]({},_0x1d08fd,_0x122a65[_0x4df9('0x4b')]);return db[_0x4df9('0x37')][_0x4df9('0x51')](_0x1d08fd)[_0x4df9('0x4c')](handleEntityNotFound(_0x52faad,null))[_0x4df9('0x4c')](respondWithResult(_0x52faad,null))[_0x4df9('0x27')](handleError(_0x52faad,null));};exports['create']=function(_0x561c13,_0x2e8173){return db[_0x4df9('0x37')]['create'](_0x561c13[_0x4df9('0x52')],{})['then'](respondWithResult(_0x2e8173,0xc9))[_0x4df9('0x27')](handleError(_0x2e8173,null));};exports[_0x4df9('0x32')]=function(_0x2e64ea,_0x35c074){if(_0x2e64ea['body']['id']){delete _0x2e64ea[_0x4df9('0x52')]['id'];}return db[_0x4df9('0x37')]['find']({'where':{'id':_0x2e64ea['params']['id']}})['then'](handleEntityNotFound(_0x35c074,null))['then'](saveUpdates(_0x2e64ea[_0x4df9('0x52')],null))[_0x4df9('0x4c')](respondWithResult(_0x35c074,null))['catch'](handleError(_0x35c074,null));};exports[_0x4df9('0x33')]=function(_0x2782f9,_0x5c64c9){return db[_0x4df9('0x37')]['find']({'where':{'id':_0x2782f9[_0x4df9('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5c64c9,null))[_0x4df9('0x4c')](removeEntity(_0x5c64c9,null))[_0x4df9('0x27')](handleError(_0x5c64c9,null));};exports[_0x4df9('0x53')]=function(_0x93dcb,_0x2186b7,_0x233a47){var _0x41d9b0={};var _0x35f333={};var _0x368bc1;var _0x1261ed;return db[_0x4df9('0x37')][_0x4df9('0x54')]({'where':{'id':_0x93dcb['params']['id']}})[_0x4df9('0x4c')](handleEntityNotFound(_0x2186b7,null))['then'](function(_0x1f7757){if(_0x1f7757){_0x368bc1=_0x1f7757;_0x35f333[_0x4df9('0x3c')]=_[_0x4df9('0x3e')](db[_0x4df9('0x55')][_0x4df9('0x38')]);_0x35f333[_0x4df9('0x3d')]=_[_0x4df9('0x3e')](_0x93dcb['query']);_0x35f333[_0x4df9('0x3f')]=_['intersection'](_0x35f333[_0x4df9('0x3c')],_0x35f333[_0x4df9('0x3d')]);_0x41d9b0['attributes']=_[_0x4df9('0x40')](_0x35f333[_0x4df9('0x3c')],qs[_0x4df9('0x42')](_0x93dcb['query'][_0x4df9('0x42')]));_0x41d9b0['attributes']=_0x41d9b0['attributes']['length']?_0x41d9b0[_0x4df9('0x41')]:_0x35f333[_0x4df9('0x3c')];_0x41d9b0[_0x4df9('0x45')]=qs[_0x4df9('0x46')](_0x93dcb[_0x4df9('0x3d')]['sort']);_0x41d9b0[_0x4df9('0x47')]=qs[_0x4df9('0x3f')](_[_0x4df9('0x56')](_0x93dcb[_0x4df9('0x3d')],_0x35f333['filters']));if(_0x93dcb[_0x4df9('0x3d')][_0x4df9('0x4a')]){_0x41d9b0[_0x4df9('0x47')]=_[_0x4df9('0x48')](_0x41d9b0[_0x4df9('0x47')],{'$or':_[_0x4df9('0x36')](_0x41d9b0['attributes'],function(_0x3dad3a){var _0x3d6ef4={};_0x3d6ef4[_0x3dad3a]={'$like':'%'+_0x93dcb[_0x4df9('0x3d')][_0x4df9('0x4a')]+'%'};return _0x3d6ef4;})});}_0x41d9b0=_[_0x4df9('0x48')]({},_0x41d9b0,_0x93dcb[_0x4df9('0x4b')]);return _0x368bc1['getConfigurations'](_0x41d9b0);}})[_0x4df9('0x4c')](function(_0x2b9ced){if(_0x2b9ced){_0x1261ed=_0x2b9ced[_0x4df9('0x43')];if(!_0x93dcb[_0x4df9('0x3d')]['hasOwnProperty']('nolimit')){_0x41d9b0['limit']=qs[_0x4df9('0x2d')](_0x93dcb[_0x4df9('0x3d')][_0x4df9('0x2d')]);_0x41d9b0[_0x4df9('0x2c')]=qs['offset'](_0x93dcb[_0x4df9('0x3d')]['offset']);}return _0x368bc1['getConfigurations'](_0x41d9b0);}})[_0x4df9('0x4c')](function(_0x4a72ac){if(_0x4a72ac){return _0x4a72ac?{'count':_0x1261ed,'rows':_0x4a72ac}:null;}})['then'](respondWithResult(_0x2186b7,null))[_0x4df9('0x27')](handleError(_0x2186b7,null));};exports[_0x4df9('0x57')]=function(_0xd6adb5,_0x49e96,_0x494142){if(_0xd6adb5[_0x4df9('0x52')]['id']){delete _0xd6adb5[_0x4df9('0x52')]['id'];}return db[_0x4df9('0x37')]['findOne']({'where':{'id':_0xd6adb5[_0x4df9('0x4f')]['id']}})['then'](handleEntityNotFound(_0x49e96,null))[_0x4df9('0x4c')](function(_0x4b399d){if(_0x4b399d){_0xd6adb5[_0x4df9('0x52')]['AccountId']=_0x4b399d['id'];_0xd6adb5[_0x4df9('0x52')]['Subjects']=integrations[_0x4df9('0x58')](_0xd6adb5[_0x4df9('0x52')][_0x4df9('0x59')],_0xd6adb5['body']['type']);_0xd6adb5['body'][_0x4df9('0x5a')]=integrations['getDescriptions'](_0xd6adb5[_0x4df9('0x52')][_0x4df9('0x59')],_0xd6adb5[_0x4df9('0x52')][_0x4df9('0x3a')]);return db['SalesforceConfiguration'][_0x4df9('0x5b')](_0xd6adb5[_0x4df9('0x52')],{'include':[{'model':db[_0x4df9('0x5c')],'as':'Subjects'},{'model':db[_0x4df9('0x5c')],'as':_0x4df9('0x5a')}]});}return null;})['then'](respondWithResult(_0x49e96,null))['catch'](handleError(_0x49e96,null));};exports[_0x4df9('0x5d')]=function(_0x26a6bd,_0x46323d,_0x2504c7){var _0x141d27;var _0x493a82='';var _0x3888d4=_0x4df9('0x5e');return db[_0x4df9('0x37')][_0x4df9('0x54')]({'where':{'id':_0x26a6bd['params']['id']},'attributes':['id',_0x4df9('0x5f'),_0x4df9('0x60'),_0x4df9('0x61'),_0x4df9('0x62'),_0x4df9('0x63'),_0x4df9('0x64')]})[_0x4df9('0x4c')](handleEntityNotFound(_0x46323d,null))[_0x4df9('0x4c')](function(_0x50d9a9){if(_0x50d9a9){_0x493a82=_0x50d9a9[_0x4df9('0x5f')];var _0x1f2c81=_0x493a82[_0x4df9('0x65')](-0x1);if(_0x1f2c81==='/'){_0x493a82=_0x493a82[_0x4df9('0x66')](0x0,_0x493a82[_0x4df9('0x67')](_0x1f2c81));}_0x141d27=new jsforce['Connection']({'oauth2':{'loginUrl':_0x493a82,'clientId':_0x50d9a9['clientId'],'clientSecret':_0x50d9a9[_0x4df9('0x61')]}});return _0x141d27[_0x4df9('0x68')](_0x50d9a9[_0x4df9('0x62')],_0x50d9a9[_0x4df9('0x63')][_0x4df9('0x69')](_0x50d9a9[_0x4df9('0x64')]));}})[_0x4df9('0x4c')](function(_0x25b37d){if(_0x25b37d){if(!_['isNil'](_0x26a6bd[_0x4df9('0x3d')][_0x4df9('0x6a')])){_0x3888d4=_0x26a6bd[_0x4df9('0x3d')]['ticketType'];}return _0x141d27[_0x4df9('0x6b')](_0x3888d4)[_0x4df9('0x6c')]();}})['then'](function(_0x5593de){var _0x4b1f90=[_0x4df9('0x6d'),'CallDurationInSeconds',_0x4df9('0x6e'),_0x4df9('0x6f'),_0x4df9('0x70'),'Priority',_0x4df9('0x71'),_0x4df9('0x72')];if(!_[_0x4df9('0x73')](_0x26a6bd[_0x4df9('0x3d')]['ticketType'])&&_0x26a6bd[_0x4df9('0x3d')]['ticketType']==='Case'){_0x4b1f90=[_0x4df9('0x72'),_0x4df9('0x74'),_0x4df9('0x75'),_0x4df9('0x71'),_0x4df9('0x76'),_0x4df9('0x77'),_0x4df9('0x78'),_0x4df9('0x79')];}if(_0x5593de){_['remove'](_0x5593de[_0x4df9('0x42')],function(_0x32709e){return _0x32709e[_0x4df9('0x7a')]===![]&&!_0x4b1f90[_0x4df9('0x7b')](_0x32709e[_0x4df9('0x34')]);});return{'count':_0x5593de[_0x4df9('0x42')]['length'],'rows':_[_0x4df9('0x36')](_0x5593de[_0x4df9('0x42')],function(_0x4eb24f){return{'id':_0x4eb24f[_0x4df9('0x34')],'name':_0x4eb24f['label'],'custom':_0x4eb24f[_0x4df9('0x7a')],'options':_0x4eb24f[_0x4df9('0x7c')][_0x4df9('0x43')]>0x0?_[_0x4df9('0x36')](_0x4eb24f[_0x4df9('0x7c')],function(_0x4e1dd6){return{'name':_0x4e1dd6[_0x4df9('0x7d')],'value':_0x4e1dd6[_0x4df9('0x7e')]};}):_0x4eb24f[_0x4df9('0x3a')]=='boolean'?[{'name':_0x4df9('0x7f'),'value':'true'},{'name':_0x4df9('0x80'),'value':_0x4df9('0x81')}]:[]};})};}})[_0x4df9('0x4c')](respondWithResult(_0x46323d,null))[_0x4df9('0x27')](function(_0xad5d2d){var _0x298ffd=_0x26a6bd[_0x4df9('0x3d')][_0x4df9('0x82')]?0x1f4:_0xad5d2d[_0x4df9('0x83')]||0x1f4;logger[_0x4df9('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x298ffd,JSON[_0x4df9('0x24')](_0xad5d2d));delete _0xad5d2d[_0x4df9('0x34')];if(_0x298ffd===0x191){_0x298ffd=0x190;}_0x46323d[_0x4df9('0x29')](_0x298ffd)[_0x4df9('0x84')](_0x26a6bd[_0x4df9('0x3d')][_0x4df9('0x82')]?{'message':'Wrong\x20credentials','statusCode':_0xad5d2d[_0x4df9('0x83')]}:_0xad5d2d);});}; \ No newline at end of file +var _0x6c65=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','then','info','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','show','params','filtears','include','options','create','body','update','destroy','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','Task','remoteUri','clientId','clientSecret','username','password','securityToken','substring','lastIndexOf','login','isNil','ticketType','sobject','describe','CallDisposition','CallDurationInSeconds','CallObject','CallType','IsArchived','Status','Type','Origin','Reason','IsEscalated','SuppliedName','SuppliedCompany','remove','custom','label','picklistValues','value','boolean','True','true','False','false','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x6c65,0x78));var _0x56c6=function(_0x4c332b,_0x442b6c){_0x4c332b=_0x4c332b-0x0;var _0x251662=_0x6c65[_0x4c332b];return _0x251662;};'use strict';var pdf=require(_0x56c6('0x0'));var emlformat=require(_0x56c6('0x1'));var rimraf=require(_0x56c6('0x2'));var zipdir=require(_0x56c6('0x3'));var jsonpatch=require(_0x56c6('0x4'));var rp=require(_0x56c6('0x5'));var moment=require('moment');var BPromise=require(_0x56c6('0x6'));var Mustache=require(_0x56c6('0x7'));var util=require(_0x56c6('0x8'));var path=require(_0x56c6('0x9'));var sox=require(_0x56c6('0xa'));var csv=require('to-csv');var ejs=require(_0x56c6('0xb'));var fs=require('fs');var _=require(_0x56c6('0xc'));var squel=require(_0x56c6('0xd'));var crypto=require(_0x56c6('0xe'));var jsforce=require(_0x56c6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x56c6('0x10'));var querystring=require(_0x56c6('0x11'));var Papa=require(_0x56c6('0x12'));var Redis=require('ioredis');var authService=require(_0x56c6('0x13'));var qs=require(_0x56c6('0x14'));var as=require(_0x56c6('0x15'));var hardwareService=require(_0x56c6('0x16'));var logger=require(_0x56c6('0x17'))(_0x56c6('0x18'));var utils=require('../../config/utils');var config=require(_0x56c6('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x56c6('0x1a'));var jayson=require(_0x56c6('0x1b'));var client=jayson[_0x56c6('0x1c')][_0x56c6('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x54ac65,_0x29fff0,_0x511316,_0x17f72e){return new BPromise(function(_0x59b7b5,_0x277e4f){var _0x596c86=_0x17f72e||client;return _0x596c86['request'](_0x54ac65,_0x511316)[_0x56c6('0x1e')](function(_0x4d0838){logger[_0x56c6('0x1f')]('SalesforceAccount,\x20%s,\x20%s',_0x29fff0,_0x56c6('0x20'));logger['debug'](_0x56c6('0x21'),_0x29fff0,'request\x20sent',JSON[_0x56c6('0x22')](_0x4d0838));if(_0x4d0838['error']){if(_0x4d0838[_0x56c6('0x23')][_0x56c6('0x24')]===0x1f4){logger['error'](_0x56c6('0x25'),_0x29fff0,_0x4d0838[_0x56c6('0x23')][_0x56c6('0x26')]);return _0x277e4f(_0x4d0838[_0x56c6('0x23')]['message']);}logger[_0x56c6('0x23')](_0x56c6('0x25'),_0x29fff0,_0x4d0838[_0x56c6('0x23')][_0x56c6('0x26')]);return _0x59b7b5(_0x4d0838[_0x56c6('0x23')]['message']);}else{logger[_0x56c6('0x1f')](_0x56c6('0x25'),_0x29fff0,'request\x20sent');_0x59b7b5(_0x4d0838[_0x56c6('0x27')]['message']);}})['catch'](function(_0x225c19){logger[_0x56c6('0x23')](_0x56c6('0x25'),_0x29fff0,_0x225c19);_0x277e4f(_0x225c19);});});}function respondWithStatusCode(_0x5c6682,_0x27806e){_0x27806e=_0x27806e||0xcc;return function(_0x12af1d){if(_0x12af1d){return _0x5c6682[_0x56c6('0x28')](_0x27806e);}return _0x5c6682[_0x56c6('0x29')](_0x27806e)[_0x56c6('0x2a')]();};}function respondWithResult(_0x207f05,_0x50d7ee){_0x50d7ee=_0x50d7ee||0xc8;return function(_0x4be5df){if(_0x4be5df){return _0x207f05[_0x56c6('0x29')](_0x50d7ee)[_0x56c6('0x2b')](_0x4be5df);}};}function respondWithFilteredResult(_0x5cb361,_0x33f95e){return function(_0x53766a){if(_0x53766a){var _0x2e6b1a=_0x53766a[_0x56c6('0x2c')],_0x52e761=_0x33f95e[_0x56c6('0x2d')],_0x7ef8d9=_0x33f95e[_0x56c6('0x2d')]+_0x33f95e[_0x56c6('0x2e')],_0x5827e7;if(_0x7ef8d9>=_0x2e6b1a){_0x7ef8d9=_0x2e6b1a;_0x5827e7=0xc8;}else{_0x5827e7=0xce;}_0x5cb361[_0x56c6('0x29')](_0x5827e7);return _0x5cb361[_0x56c6('0x2f')](_0x56c6('0x30'),_0x52e761+'-'+_0x7ef8d9+'/'+_0x2e6b1a)[_0x56c6('0x2b')](_0x53766a);}return null;};}function patchUpdates(_0x352fd7){return function(_0x27af24){try{jsonpatch[_0x56c6('0x31')](_0x27af24,_0x352fd7,!![]);}catch(_0x492d80){return BPromise[_0x56c6('0x32')](_0x492d80);}return _0x27af24[_0x56c6('0x33')]();};}function saveUpdates(_0x53dc4e,_0x5909cf){return function(_0x4337e3){if(_0x4337e3){return _0x4337e3['update'](_0x53dc4e)[_0x56c6('0x1e')](function(_0x530a03){return _0x530a03;});}return null;};}function removeEntity(_0x15e631,_0x2187f8){return function(_0x1658b2){if(_0x1658b2){return _0x1658b2['destroy']()[_0x56c6('0x1e')](function(){_0x15e631[_0x56c6('0x29')](0xcc)[_0x56c6('0x2a')]();});}};}function handleEntityNotFound(_0x37e1b8,_0x6d20d5){return function(_0x172646){if(!_0x172646){_0x37e1b8[_0x56c6('0x28')](0x194);}return _0x172646;};}function handleError(_0xa5a91c,_0xf19490){_0xf19490=_0xf19490||0x1f4;return function(_0x35572b){logger['error'](_0x35572b[_0x56c6('0x34')]);if(_0x35572b[_0x56c6('0x35')]){delete _0x35572b['name'];}_0xa5a91c[_0x56c6('0x29')](_0xf19490)[_0x56c6('0x36')](_0x35572b);};}exports[_0x56c6('0x37')]=function(_0x1280ce,_0x44f690){var _0x36b6de={},_0x4654ed={},_0x5aa1d7={'count':0x0,'rows':[]};var _0x456d5c=_[_0x56c6('0x38')](db[_0x56c6('0x39')][_0x56c6('0x3a')],function(_0x3ef0af){return{'name':_0x3ef0af[_0x56c6('0x3b')],'type':_0x3ef0af[_0x56c6('0x3c')]['key']};});_0x4654ed['model']=_[_0x56c6('0x38')](_0x456d5c,_0x56c6('0x35'));_0x4654ed[_0x56c6('0x3d')]=_[_0x56c6('0x3e')](_0x1280ce[_0x56c6('0x3d')]);_0x4654ed[_0x56c6('0x3f')]=_[_0x56c6('0x40')](_0x4654ed[_0x56c6('0x41')],_0x4654ed[_0x56c6('0x3d')]);_0x36b6de[_0x56c6('0x42')]=_['intersection'](_0x4654ed[_0x56c6('0x41')],qs[_0x56c6('0x43')](_0x1280ce[_0x56c6('0x3d')]['fields']));_0x36b6de[_0x56c6('0x42')]=_0x36b6de[_0x56c6('0x42')][_0x56c6('0x44')]?_0x36b6de['attributes']:_0x4654ed['model'];if(!_0x1280ce[_0x56c6('0x3d')][_0x56c6('0x45')](_0x56c6('0x46'))){_0x36b6de[_0x56c6('0x2e')]=qs[_0x56c6('0x2e')](_0x1280ce[_0x56c6('0x3d')][_0x56c6('0x2e')]);_0x36b6de[_0x56c6('0x2d')]=qs[_0x56c6('0x2d')](_0x1280ce[_0x56c6('0x3d')][_0x56c6('0x2d')]);}_0x36b6de[_0x56c6('0x47')]=qs[_0x56c6('0x48')](_0x1280ce['query'][_0x56c6('0x48')]);_0x36b6de[_0x56c6('0x49')]=qs[_0x56c6('0x3f')](_['pick'](_0x1280ce[_0x56c6('0x3d')],_0x4654ed[_0x56c6('0x3f')]),_0x456d5c);if(_0x1280ce[_0x56c6('0x3d')][_0x56c6('0x4a')]){_0x36b6de[_0x56c6('0x49')]=_[_0x56c6('0x4b')](_0x36b6de[_0x56c6('0x49')],{'$or':_[_0x56c6('0x38')](_0x456d5c,function(_0x4e15e4){if(_0x4e15e4[_0x56c6('0x3c')]!=='VIRTUAL'){var _0x5ade3d={};_0x5ade3d[_0x4e15e4[_0x56c6('0x35')]]={'$like':'%'+_0x1280ce[_0x56c6('0x3d')][_0x56c6('0x4a')]+'%'};return _0x5ade3d;}})});}_0x36b6de=_[_0x56c6('0x4b')]({},_0x36b6de,_0x1280ce['options']);var _0x9c0f96={'where':_0x36b6de[_0x56c6('0x49')]};return db[_0x56c6('0x39')]['count'](_0x9c0f96)[_0x56c6('0x1e')](function(_0x36c272){_0x5aa1d7[_0x56c6('0x2c')]=_0x36c272;if(_0x1280ce[_0x56c6('0x3d')][_0x56c6('0x4c')]){_0x36b6de['include']=[{'all':!![]}];}return db[_0x56c6('0x39')][_0x56c6('0x4d')](_0x36b6de);})[_0x56c6('0x1e')](function(_0x2c7a7e){_0x5aa1d7[_0x56c6('0x4e')]=_0x2c7a7e;return _0x5aa1d7;})[_0x56c6('0x1e')](respondWithFilteredResult(_0x44f690,_0x36b6de))[_0x56c6('0x4f')](handleError(_0x44f690,null));};exports[_0x56c6('0x50')]=function(_0x4529df,_0x3ee188){var _0x415c9c={'raw':![],'where':{'id':_0x4529df[_0x56c6('0x51')]['id']}},_0x500dc7={};_0x500dc7['model']=_[_0x56c6('0x3e')](db['SalesforceAccount']['rawAttributes']);_0x500dc7[_0x56c6('0x3d')]=_[_0x56c6('0x3e')](_0x4529df[_0x56c6('0x3d')]);_0x500dc7[_0x56c6('0x52')]=_[_0x56c6('0x40')](_0x500dc7[_0x56c6('0x41')],_0x500dc7[_0x56c6('0x3d')]);_0x415c9c[_0x56c6('0x42')]=_[_0x56c6('0x40')](_0x500dc7[_0x56c6('0x41')],qs['fields'](_0x4529df[_0x56c6('0x3d')][_0x56c6('0x43')]));_0x415c9c[_0x56c6('0x42')]=_0x415c9c[_0x56c6('0x42')]['length']?_0x415c9c[_0x56c6('0x42')]:_0x500dc7[_0x56c6('0x41')];if(_0x4529df[_0x56c6('0x3d')]['includeAll']){_0x415c9c[_0x56c6('0x53')]=[{'all':!![]}];}_0x415c9c=_[_0x56c6('0x4b')]({},_0x415c9c,_0x4529df[_0x56c6('0x54')]);return db[_0x56c6('0x39')]['find'](_0x415c9c)[_0x56c6('0x1e')](handleEntityNotFound(_0x3ee188,null))[_0x56c6('0x1e')](respondWithResult(_0x3ee188,null))[_0x56c6('0x4f')](handleError(_0x3ee188,null));};exports[_0x56c6('0x55')]=function(_0x16b385,_0x4a90af){return db['SalesforceAccount'][_0x56c6('0x55')](_0x16b385[_0x56c6('0x56')],{})[_0x56c6('0x1e')](respondWithResult(_0x4a90af,0xc9))[_0x56c6('0x4f')](handleError(_0x4a90af,null));};exports[_0x56c6('0x57')]=function(_0x45e109,_0x46e2c0){if(_0x45e109[_0x56c6('0x56')]['id']){delete _0x45e109['body']['id'];}return db[_0x56c6('0x39')]['find']({'where':{'id':_0x45e109[_0x56c6('0x51')]['id']}})['then'](handleEntityNotFound(_0x46e2c0,null))[_0x56c6('0x1e')](saveUpdates(_0x45e109['body'],null))[_0x56c6('0x1e')](respondWithResult(_0x46e2c0,null))[_0x56c6('0x4f')](handleError(_0x46e2c0,null));};exports[_0x56c6('0x58')]=function(_0x320755,_0xfc4f07){return db[_0x56c6('0x39')]['find']({'where':{'id':_0x320755[_0x56c6('0x51')]['id']}})['then'](handleEntityNotFound(_0xfc4f07,null))[_0x56c6('0x1e')](removeEntity(_0xfc4f07,null))['catch'](handleError(_0xfc4f07,null));};exports[_0x56c6('0x59')]=function(_0xa3150b,_0x5e21b8,_0x3b75eb){var _0x4ba03d={};var _0x5dd916={};var _0x6ca474;var _0x3ffe64;return db[_0x56c6('0x39')][_0x56c6('0x5a')]({'where':{'id':_0xa3150b[_0x56c6('0x51')]['id']}})[_0x56c6('0x1e')](handleEntityNotFound(_0x5e21b8,null))['then'](function(_0x52a42e){if(_0x52a42e){_0x6ca474=_0x52a42e;_0x5dd916[_0x56c6('0x41')]=_[_0x56c6('0x3e')](db[_0x56c6('0x5b')][_0x56c6('0x3a')]);_0x5dd916[_0x56c6('0x3d')]=_['keys'](_0xa3150b[_0x56c6('0x3d')]);_0x5dd916[_0x56c6('0x3f')]=_[_0x56c6('0x40')](_0x5dd916['model'],_0x5dd916[_0x56c6('0x3d')]);_0x4ba03d[_0x56c6('0x42')]=_[_0x56c6('0x40')](_0x5dd916[_0x56c6('0x41')],qs['fields'](_0xa3150b['query']['fields']));_0x4ba03d['attributes']=_0x4ba03d[_0x56c6('0x42')][_0x56c6('0x44')]?_0x4ba03d[_0x56c6('0x42')]:_0x5dd916[_0x56c6('0x41')];_0x4ba03d[_0x56c6('0x47')]=qs[_0x56c6('0x48')](_0xa3150b[_0x56c6('0x3d')][_0x56c6('0x48')]);_0x4ba03d[_0x56c6('0x49')]=qs[_0x56c6('0x3f')](_['pick'](_0xa3150b[_0x56c6('0x3d')],_0x5dd916[_0x56c6('0x3f')]));if(_0xa3150b[_0x56c6('0x3d')][_0x56c6('0x4a')]){_0x4ba03d['where']=_[_0x56c6('0x4b')](_0x4ba03d['where'],{'$or':_['map'](_0x4ba03d[_0x56c6('0x42')],function(_0x79a0ad){var _0x5d065b={};_0x5d065b[_0x79a0ad]={'$like':'%'+_0xa3150b['query'][_0x56c6('0x4a')]+'%'};return _0x5d065b;})});}_0x4ba03d=_[_0x56c6('0x4b')]({},_0x4ba03d,_0xa3150b[_0x56c6('0x54')]);return _0x6ca474[_0x56c6('0x59')](_0x4ba03d);}})['then'](function(_0x44ab51){if(_0x44ab51){_0x3ffe64=_0x44ab51[_0x56c6('0x44')];if(!_0xa3150b['query'][_0x56c6('0x45')](_0x56c6('0x46'))){_0x4ba03d['limit']=qs[_0x56c6('0x2e')](_0xa3150b[_0x56c6('0x3d')]['limit']);_0x4ba03d['offset']=qs['offset'](_0xa3150b[_0x56c6('0x3d')][_0x56c6('0x2d')]);}return _0x6ca474[_0x56c6('0x59')](_0x4ba03d);}})[_0x56c6('0x1e')](function(_0xcaa70f){if(_0xcaa70f){return _0xcaa70f?{'count':_0x3ffe64,'rows':_0xcaa70f}:null;}})[_0x56c6('0x1e')](respondWithResult(_0x5e21b8,null))[_0x56c6('0x4f')](handleError(_0x5e21b8,null));};exports[_0x56c6('0x5c')]=function(_0x42bce7,_0x8eb033,_0x59e3f3){if(_0x42bce7[_0x56c6('0x56')]['id']){delete _0x42bce7[_0x56c6('0x56')]['id'];}return db[_0x56c6('0x39')][_0x56c6('0x5a')]({'where':{'id':_0x42bce7[_0x56c6('0x51')]['id']}})[_0x56c6('0x1e')](handleEntityNotFound(_0x8eb033,null))[_0x56c6('0x1e')](function(_0xcda2c1){if(_0xcda2c1){_0x42bce7[_0x56c6('0x56')][_0x56c6('0x5d')]=_0xcda2c1['id'];_0x42bce7[_0x56c6('0x56')][_0x56c6('0x5e')]=integrations[_0x56c6('0x5f')](_0x42bce7[_0x56c6('0x56')][_0x56c6('0x60')],_0x42bce7['body']['type']);_0x42bce7[_0x56c6('0x56')][_0x56c6('0x61')]=integrations['getDescriptions'](_0x42bce7[_0x56c6('0x56')][_0x56c6('0x60')],_0x42bce7[_0x56c6('0x56')][_0x56c6('0x3c')]);return db[_0x56c6('0x5b')][_0x56c6('0x55')](_0x42bce7[_0x56c6('0x56')],{'include':[{'model':db[_0x56c6('0x62')],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0x56c6('0x61')}]});}return null;})['then'](respondWithResult(_0x8eb033,null))[_0x56c6('0x4f')](handleError(_0x8eb033,null));};exports['getFields']=function(_0x2a30b4,_0x3b769f,_0x2c133c){var _0x12d438;var _0xd4f9c3='';var _0x64d662=_0x56c6('0x63');return db[_0x56c6('0x39')][_0x56c6('0x5a')]({'where':{'id':_0x2a30b4[_0x56c6('0x51')]['id']},'attributes':['id',_0x56c6('0x64'),_0x56c6('0x65'),_0x56c6('0x66'),_0x56c6('0x67'),_0x56c6('0x68'),_0x56c6('0x69')]})[_0x56c6('0x1e')](handleEntityNotFound(_0x3b769f,null))['then'](function(_0x8b7bc9){if(_0x8b7bc9){_0xd4f9c3=_0x8b7bc9[_0x56c6('0x64')];var _0x827afc=_0xd4f9c3['slice'](-0x1);if(_0x827afc==='/'){_0xd4f9c3=_0xd4f9c3[_0x56c6('0x6a')](0x0,_0xd4f9c3[_0x56c6('0x6b')](_0x827afc));}_0x12d438=new jsforce['Connection']({'oauth2':{'loginUrl':_0xd4f9c3,'clientId':_0x8b7bc9[_0x56c6('0x65')],'clientSecret':_0x8b7bc9[_0x56c6('0x66')]}});return _0x12d438[_0x56c6('0x6c')](_0x8b7bc9[_0x56c6('0x67')],_0x8b7bc9[_0x56c6('0x68')]['concat'](_0x8b7bc9[_0x56c6('0x69')]));}})[_0x56c6('0x1e')](function(_0x795a6c){if(_0x795a6c){if(!_[_0x56c6('0x6d')](_0x2a30b4[_0x56c6('0x3d')]['ticketType'])){_0x64d662=_0x2a30b4[_0x56c6('0x3d')][_0x56c6('0x6e')];}return _0x12d438[_0x56c6('0x6f')](_0x64d662)[_0x56c6('0x70')]();}})[_0x56c6('0x1e')](function(_0xc38d58){var _0x3ac45d=[_0x56c6('0x71'),_0x56c6('0x72'),_0x56c6('0x73'),_0x56c6('0x74'),_0x56c6('0x75'),'Priority',_0x56c6('0x76'),_0x56c6('0x77')];if(!_[_0x56c6('0x6d')](_0x2a30b4[_0x56c6('0x3d')][_0x56c6('0x6e')])&&_0x2a30b4[_0x56c6('0x3d')][_0x56c6('0x6e')]==='Case'){_0x3ac45d=[_0x56c6('0x77'),_0x56c6('0x78'),_0x56c6('0x79'),_0x56c6('0x76'),'Priority',_0x56c6('0x7a'),_0x56c6('0x7b'),_0x56c6('0x7c')];}if(_0xc38d58){_[_0x56c6('0x7d')](_0xc38d58[_0x56c6('0x43')],function(_0x3dbeff){return _0x3dbeff[_0x56c6('0x7e')]===![]&&!_0x3ac45d['includes'](_0x3dbeff['name']);});return{'count':_0xc38d58[_0x56c6('0x43')][_0x56c6('0x44')],'rows':_['map'](_0xc38d58[_0x56c6('0x43')],function(_0x50ca63){return{'id':_0x50ca63['name'],'name':_0x50ca63[_0x56c6('0x7f')],'custom':_0x50ca63[_0x56c6('0x7e')],'options':_0x50ca63[_0x56c6('0x80')][_0x56c6('0x44')]>0x0?_[_0x56c6('0x38')](_0x50ca63['picklistValues'],function(_0x2c9f6e){return{'name':_0x2c9f6e['label'],'value':_0x2c9f6e[_0x56c6('0x81')]};}):_0x50ca63[_0x56c6('0x3c')]==_0x56c6('0x82')?[{'name':_0x56c6('0x83'),'value':_0x56c6('0x84')},{'name':_0x56c6('0x85'),'value':_0x56c6('0x86')}]:[]};})};}})[_0x56c6('0x1e')](respondWithResult(_0x3b769f,null))[_0x56c6('0x4f')](function(_0xee0646){var _0x554221=_0x2a30b4[_0x56c6('0x3d')][_0x56c6('0x87')]?0x1f4:_0xee0646['statusCode']||0x1f4;logger[_0x56c6('0x23')](_0x56c6('0x88'),_0x56c6('0x89'),_0x554221,JSON[_0x56c6('0x22')](_0xee0646));delete _0xee0646[_0x56c6('0x35')];if(_0x554221===0x191){_0x554221=0x190;}_0x3b769f[_0x56c6('0x29')](_0x554221)[_0x56c6('0x36')](_0x2a30b4[_0x56c6('0x3d')]['test']?{'message':_0x56c6('0x8a'),'statusCode':_0xee0646[_0x56c6('0x8b')]}:_0xee0646);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 1852f1d..b1bdb67 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 _0x77ee=['bluebird','rimraf','../../components/integrations/configuration','exports','define','lodash','../../config/logger','api'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x77ee,0x16d));var _0xe77e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x77ee[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xe77e('0x0'));var util=require('util');var logger=require(_0xe77e('0x1'))(_0xe77e('0x2'));var moment=require('moment');var BPromise=require(_0xe77e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe77e('0x4'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xe77e('0x5'));module[_0xe77e('0x6')]=function(_0x37ac38,_0x227941){return _0x37ac38[_0xe77e('0x7')]('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea2b=['./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x59b2af,_0x1584c0){var _0x3b47ed=function(_0x626df){while(--_0x626df){_0x59b2af['push'](_0x59b2af['shift']());}};_0x3b47ed(++_0x1584c0);}(_0xea2b,0x7d));var _0xbea2=function(_0x5bc6c5,_0x83b307){_0x5bc6c5=_0x5bc6c5-0x0;var _0x5e7f84=_0xea2b[_0x5bc6c5];return _0x5e7f84;};'use strict';var _=require('lodash');var util=require(_0xbea2('0x0'));var logger=require(_0xbea2('0x1'))('api');var moment=require(_0xbea2('0x2'));var BPromise=require(_0xbea2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbea2('0x4'));var rimraf=require(_0xbea2('0x5'));var config=require(_0xbea2('0x6'));var attributes=require(_0xbea2('0x7'));var integrations=require(_0xbea2('0x8'));module[_0xbea2('0x9')]=function(_0x1993e2,_0x50d413){return _0x1993e2['define'](_0xbea2('0xa'),attributes,{'tableName':_0xbea2('0xb'),'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 fe69b79..bd03c43 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 _0xaa88=['model','GetSalesforceAccount','stringify','ShowSalesforceAccount','SalesforceAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','SalesforceAccount,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','attributes','limit','map','include'];(function(_0x386b69,_0x5d9360){var _0x476415=function(_0x49fd60){while(--_0x49fd60){_0x386b69['push'](_0x386b69['shift']());}};_0x476415(++_0x5d9360);}(_0xaa88,0x137));var _0x8aa8=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xaa88[_0x24259d];return _0x5a701;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});}exports['GetSalesforceAccount']=function(_0x2c1b9a){var _0x49d80d=this;return new Promise(function(_0x557adc,_0xab7af5){return db['SalesforceAccount'][_0x8aa8('0x15')]({'raw':_0x2c1b9a[_0x8aa8('0x16')]?_0x2c1b9a[_0x8aa8('0x16')][_0x8aa8('0x17')]===undefined?!![]:![]:!![],'where':_0x2c1b9a['options']?_0x2c1b9a[_0x8aa8('0x16')][_0x8aa8('0x18')]||null:null,'attributes':_0x2c1b9a[_0x8aa8('0x16')]?_0x2c1b9a[_0x8aa8('0x16')][_0x8aa8('0x19')]||null:null,'limit':_0x2c1b9a[_0x8aa8('0x16')]?_0x2c1b9a['options'][_0x8aa8('0x1a')]||null:null,'include':_0x2c1b9a['options']?_0x2c1b9a[_0x8aa8('0x16')]['include']?_[_0x8aa8('0x1b')](_0x2c1b9a['options'][_0x8aa8('0x1c')],function(_0x40adb5){return{'model':db[_0x40adb5[_0x8aa8('0x1d')]],'as':_0x40adb5['as'],'attributes':_0x40adb5['attributes'],'include':_0x40adb5[_0x8aa8('0x1c')]?_[_0x8aa8('0x1b')](_0x40adb5[_0x8aa8('0x1c')],function(_0x547a7b){return{'model':db[_0x547a7b['model']],'as':_0x547a7b['as'],'attributes':_0x547a7b[_0x8aa8('0x19')],'include':_0x547a7b[_0x8aa8('0x1c')]?_[_0x8aa8('0x1b')](_0x547a7b[_0x8aa8('0x1c')],function(_0x24143e){return{'model':db[_0x24143e['model']],'as':_0x24143e['as'],'attributes':_0x24143e[_0x8aa8('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a0ff2){logger[_0x8aa8('0xc')](_0x8aa8('0x1e'),_0x2c1b9a);logger['debug']('GetSalesforceAccount',_0x2c1b9a,JSON[_0x8aa8('0x1f')](_0x2a0ff2));_0x557adc(_0x2a0ff2);})['catch'](function(_0x385208){logger[_0x8aa8('0x10')](_0x8aa8('0x1e'),_0x385208[_0x8aa8('0x12')],_0x2c1b9a);_0xab7af5(_0x49d80d[_0x8aa8('0x10')](0x1f4,_0x385208['message']));});});};exports[_0x8aa8('0x20')]=function(_0x3003e5){var _0x4b67f5=this;return new Promise(function(_0x99f74e,_0xee2f61){return db[_0x8aa8('0x21')]['find']({'raw':_0x3003e5[_0x8aa8('0x16')]?_0x3003e5[_0x8aa8('0x16')][_0x8aa8('0x17')]===undefined?!![]:![]:!![],'where':_0x3003e5[_0x8aa8('0x16')]?_0x3003e5[_0x8aa8('0x16')][_0x8aa8('0x18')]||null:null,'attributes':_0x3003e5[_0x8aa8('0x16')]?_0x3003e5[_0x8aa8('0x16')][_0x8aa8('0x19')]||null:null,'include':_0x3003e5[_0x8aa8('0x16')]?_0x3003e5[_0x8aa8('0x16')]['include']?_['map'](_0x3003e5[_0x8aa8('0x16')][_0x8aa8('0x1c')],function(_0x201d8d){return{'model':db[_0x201d8d[_0x8aa8('0x1d')]],'as':_0x201d8d['as'],'attributes':_0x201d8d[_0x8aa8('0x19')],'include':_0x201d8d[_0x8aa8('0x1c')]?_['map'](_0x201d8d['include'],function(_0x19ed76){return{'model':db[_0x19ed76['model']],'as':_0x19ed76['as'],'attributes':_0x19ed76[_0x8aa8('0x19')],'include':_0x19ed76[_0x8aa8('0x1c')]?_[_0x8aa8('0x1b')](_0x19ed76['include'],function(_0x36ae4b){return{'model':db[_0x36ae4b[_0x8aa8('0x1d')]],'as':_0x36ae4b['as'],'attributes':_0x36ae4b[_0x8aa8('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x526779){logger[_0x8aa8('0xc')](_0x8aa8('0x20'),_0x3003e5);logger['debug'](_0x8aa8('0x20'),_0x3003e5,JSON[_0x8aa8('0x1f')](_0x526779));_0x99f74e(_0x526779);})['catch'](function(_0x3bbdd5){logger['error']('ShowSalesforceAccount',_0x3bbdd5[_0x8aa8('0x12')],_0x3003e5);_0xee2f61(_0x4b67f5['error'](0x1f4,_0x3bbdd5[_0x8aa8('0x12')]));});});}; \ No newline at end of file +var _0x54ef=['ShowSalesforceAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','limit','include','map','model','catch'];(function(_0x321fd3,_0xaacf71){var _0x49a19a=function(_0x39c199){while(--_0x39c199){_0x321fd3['push'](_0x321fd3['shift']());}};_0x49a19a(++_0xaacf71);}(_0x54ef,0x112));var _0xf54e=function(_0x1c8969,_0x7293ac){_0x1c8969=_0x1c8969-0x0;var _0x3d27c3=_0x54ef[_0x1c8969];return _0x3d27c3;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});}exports[_0xf54e('0x15')]=function(_0x15cc48){var _0x3e7d96=this;return new Promise(function(_0x2e27b6,_0x1ef06e){return db[_0xf54e('0x16')][_0xf54e('0x17')]({'raw':_0x15cc48[_0xf54e('0x18')]?_0x15cc48['options']['raw']===undefined?!![]:![]:!![],'where':_0x15cc48[_0xf54e('0x18')]?_0x15cc48['options'][_0xf54e('0x19')]||null:null,'attributes':_0x15cc48[_0xf54e('0x18')]?_0x15cc48[_0xf54e('0x18')][_0xf54e('0x1a')]||null:null,'limit':_0x15cc48[_0xf54e('0x18')]?_0x15cc48[_0xf54e('0x18')][_0xf54e('0x1b')]||null:null,'include':_0x15cc48[_0xf54e('0x18')]?_0x15cc48[_0xf54e('0x18')][_0xf54e('0x1c')]?_[_0xf54e('0x1d')](_0x15cc48['options'][_0xf54e('0x1c')],function(_0x54f914){return{'model':db[_0x54f914[_0xf54e('0x1e')]],'as':_0x54f914['as'],'attributes':_0x54f914[_0xf54e('0x1a')],'include':_0x54f914[_0xf54e('0x1c')]?_[_0xf54e('0x1d')](_0x54f914[_0xf54e('0x1c')],function(_0x160160){return{'model':db[_0x160160[_0xf54e('0x1e')]],'as':_0x160160['as'],'attributes':_0x160160[_0xf54e('0x1a')],'include':_0x160160[_0xf54e('0x1c')]?_[_0xf54e('0x1d')](_0x160160[_0xf54e('0x1c')],function(_0x39c0ae){return{'model':db[_0x39c0ae[_0xf54e('0x1e')]],'as':_0x39c0ae['as'],'attributes':_0x39c0ae['attributes']};}):[]};}):[]};}):[]:[]})[_0xf54e('0xc')](function(_0x4cbf7c){logger[_0xf54e('0xd')]('GetSalesforceAccount',_0x15cc48);logger[_0xf54e('0x10')](_0xf54e('0x15'),_0x15cc48,JSON[_0xf54e('0x11')](_0x4cbf7c));_0x2e27b6(_0x4cbf7c);})[_0xf54e('0x1f')](function(_0x25b643){logger[_0xf54e('0x12')](_0xf54e('0x15'),_0x25b643['message'],_0x15cc48);_0x1ef06e(_0x3e7d96['error'](0x1f4,_0x25b643[_0xf54e('0x13')]));});});};exports[_0xf54e('0x20')]=function(_0x2ec92e){var _0x16d00f=this;return new Promise(function(_0xb2d4c4,_0x133cd7){return db[_0xf54e('0x16')][_0xf54e('0x21')]({'raw':_0x2ec92e[_0xf54e('0x18')]?_0x2ec92e[_0xf54e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2ec92e['options']?_0x2ec92e[_0xf54e('0x18')][_0xf54e('0x19')]||null:null,'attributes':_0x2ec92e['options']?_0x2ec92e[_0xf54e('0x18')][_0xf54e('0x1a')]||null:null,'include':_0x2ec92e[_0xf54e('0x18')]?_0x2ec92e[_0xf54e('0x18')]['include']?_['map'](_0x2ec92e['options'][_0xf54e('0x1c')],function(_0xe7e042){return{'model':db[_0xe7e042[_0xf54e('0x1e')]],'as':_0xe7e042['as'],'attributes':_0xe7e042[_0xf54e('0x1a')],'include':_0xe7e042[_0xf54e('0x1c')]?_[_0xf54e('0x1d')](_0xe7e042['include'],function(_0x4aff8e){return{'model':db[_0x4aff8e['model']],'as':_0x4aff8e['as'],'attributes':_0x4aff8e[_0xf54e('0x1a')],'include':_0x4aff8e[_0xf54e('0x1c')]?_['map'](_0x4aff8e['include'],function(_0xda1d10){return{'model':db[_0xda1d10[_0xf54e('0x1e')]],'as':_0xda1d10['as'],'attributes':_0xda1d10[_0xf54e('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14ecc8){logger[_0xf54e('0xd')]('ShowSalesforceAccount',_0x2ec92e);logger[_0xf54e('0x10')](_0xf54e('0x20'),_0x2ec92e,JSON[_0xf54e('0x11')](_0x14ecc8));_0xb2d4c4(_0x14ecc8);})[_0xf54e('0x1f')](function(_0x12ef97){logger[_0xf54e('0x12')]('ShowSalesforceAccount',_0x12ef97['message'],_0x2ec92e);_0x133cd7(_0x16d00f[_0xf54e('0x12')](0x1f4,_0x12ef97[_0xf54e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 59dfff6..7cb1960 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 _0x685c=['post','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x507afe,_0x31a47b){var _0x2e8dde=function(_0x8b1369){while(--_0x8b1369){_0x507afe['push'](_0x507afe['shift']());}};_0x2e8dde(++_0x31a47b);}(_0x685c,0x154));var _0xc685=function(_0xbf28ab,_0x4587bc){_0xbf28ab=_0xbf28ab-0x0;var _0x4e5b7d=_0x685c[_0xbf28ab];return _0x4e5b7d;};'use strict';var multer=require(_0xc685('0x0'));var util=require('util');var path=require(_0xc685('0x1'));var timeout=require(_0xc685('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xc685('0x3'));var interaction=require(_0xc685('0x4'));var config=require('../../config/environment');var controller=require(_0xc685('0x5'));router[_0xc685('0x6')]('/',auth[_0xc685('0x7')](),controller[_0xc685('0x8')]);router[_0xc685('0x6')](_0xc685('0x9'),auth[_0xc685('0x7')](),controller[_0xc685('0xa')]);router[_0xc685('0x6')](_0xc685('0xb'),auth[_0xc685('0x7')](),controller[_0xc685('0xc')]);router[_0xc685('0x6')](_0xc685('0xd'),auth[_0xc685('0x7')](),controller[_0xc685('0xe')]);router['get'](_0xc685('0xf'),auth[_0xc685('0x7')](),controller[_0xc685('0x10')]);router[_0xc685('0x11')]('/',auth[_0xc685('0x7')](),controller['create']);router['put'](_0xc685('0x9'),auth[_0xc685('0x7')](),controller['update']);router[_0xc685('0x12')](_0xc685('0x9'),auth[_0xc685('0x7')](),controller[_0xc685('0x13')]);module[_0xc685('0x14')]=router; \ No newline at end of file +var _0x572f=['getDescriptions','post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x3a6922,_0xc728be){var _0x9c1b44=function(_0x4ffb5e){while(--_0x4ffb5e){_0x3a6922['push'](_0x3a6922['shift']());}};_0x9c1b44(++_0xc728be);}(_0x572f,0x1e2));var _0xf572=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x572f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf572('0x0'));var util=require(_0xf572('0x1'));var path=require(_0xf572('0x2'));var timeout=require(_0xf572('0x3'));var express=require(_0xf572('0x4'));var router=express[_0xf572('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf572('0x6'));var config=require(_0xf572('0x7'));var controller=require(_0xf572('0x8'));router[_0xf572('0x9')]('/',auth[_0xf572('0xa')](),controller[_0xf572('0xb')]);router['get']('/:id',auth[_0xf572('0xa')](),controller[_0xf572('0xc')]);router['get'](_0xf572('0xd'),auth['isAuthenticated'](),controller[_0xf572('0xe')]);router[_0xf572('0x9')](_0xf572('0xf'),auth[_0xf572('0xa')](),controller[_0xf572('0x10')]);router[_0xf572('0x9')](_0xf572('0x11'),auth['isAuthenticated'](),controller[_0xf572('0x12')]);router[_0xf572('0x13')]('/',auth[_0xf572('0xa')](),controller['create']);router['put'](_0xf572('0x14'),auth[_0xf572('0xa')](),controller[_0xf572('0x15')]);router[_0xf572('0x16')]('/:id',auth[_0xf572('0xa')](),controller[_0xf572('0x17')]);module[_0xf572('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 232b8b0..3931b22 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 _0x47e7=['contact_lead','contact','lead','nothing','exports','STRING','ENUM','Task','Case'];(function(_0x368587,_0x1b6554){var _0x42d33c=function(_0xfdccf){while(--_0xfdccf){_0x368587['push'](_0x368587['shift']());}};_0x42d33c(++_0x1b6554);}(_0x47e7,0x94));var _0x747e=function(_0x2f0e05,_0x724ec4){_0x2f0e05=_0x2f0e05-0x0;var _0x2d4fb7=_0x47e7[_0x2f0e05];return _0x2d4fb7;};'use strict';var Sequelize=require('sequelize');module[_0x747e('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x747e('0x1')]},'ticketType':{'type':Sequelize[_0x747e('0x2')](_0x747e('0x3'),_0x747e('0x4')),'defaultValue':_0x747e('0x3')},'moduleSearch':{'type':Sequelize[_0x747e('0x2')](_0x747e('0x5'),_0x747e('0x6'),_0x747e('0x7')),'defaultValue':_0x747e('0x5')},'moduleCreate':{'type':Sequelize[_0x747e('0x2')](_0x747e('0x8'),_0x747e('0x6'),_0x747e('0x7')),'defaultValue':_0x747e('0x7')}}; \ No newline at end of file +var _0xebdc=['lead','nothing','exports','STRING','ENUM','Task','Case','contact_lead','contact'];(function(_0xb36f6d,_0x2102de){var _0x960913=function(_0x25310a){while(--_0x25310a){_0xb36f6d['push'](_0xb36f6d['shift']());}};_0x960913(++_0x2102de);}(_0xebdc,0x107));var _0xcebd=function(_0x4025cd,_0x47a3d1){_0x4025cd=_0x4025cd-0x0;var _0x23f373=_0xebdc[_0x4025cd];return _0x23f373;};'use strict';var Sequelize=require('sequelize');module[_0xcebd('0x0')]={'name':{'type':Sequelize[_0xcebd('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xcebd('0x2')](_0xcebd('0x3'),_0xcebd('0x4')),'defaultValue':_0xcebd('0x3')},'moduleSearch':{'type':Sequelize[_0xcebd('0x2')](_0xcebd('0x5'),_0xcebd('0x6'),_0xcebd('0x7')),'defaultValue':_0xcebd('0x5')},'moduleCreate':{'type':Sequelize[_0xcebd('0x2')](_0xcebd('0x8'),_0xcebd('0x6'),'lead'),'defaultValue':_0xcebd('0x7')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 0f5dc12..43d8478 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 _0x3854=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','jayson/promise','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','count','offset','limit','json','apply','save','update','end','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','show','params','filtears','find','create','body','destroy','findOne','SalesforceField','getFields','getSubjects','pick','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse'];(function(_0x1601ad,_0x4e4a92){var _0x3973aa=function(_0x39f34d){while(--_0x39f34d){_0x1601ad['push'](_0x1601ad['shift']());}};_0x3973aa(++_0x4e4a92);}(_0x3854,0x14d));var _0x4385=function(_0x4d1433,_0x1ac619){_0x4d1433=_0x4d1433-0x0;var _0x497bef=_0x3854[_0x4d1433];return _0x497bef;};'use strict';var pdf=require(_0x4385('0x0'));var emlformat=require(_0x4385('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4385('0x2'));var jsonpatch=require(_0x4385('0x3'));var rp=require('request-promise');var moment=require(_0x4385('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4385('0x5'));var util=require(_0x4385('0x6'));var path=require('path');var sox=require(_0x4385('0x7'));var csv=require(_0x4385('0x8'));var ejs=require(_0x4385('0x9'));var fs=require('fs');var _=require(_0x4385('0xa'));var squel=require(_0x4385('0xb'));var crypto=require(_0x4385('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4385('0xd'));var Papa=require(_0x4385('0xe'));var Redis=require('ioredis');var authService=require(_0x4385('0xf'));var qs=require(_0x4385('0x10'));var as=require(_0x4385('0x11'));var hardwareService=require(_0x4385('0x12'));var logger=require(_0x4385('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4385('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4385('0x15'));var client=jayson['client'][_0x4385('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x31d8a5,_0x44d5a5,_0x1edf80,_0x3957eb){return new BPromise(function(_0x5df900,_0x300fd5){var _0x1c7e39=_0x3957eb||client;return _0x1c7e39[_0x4385('0x17')](_0x31d8a5,_0x1edf80)[_0x4385('0x18')](function(_0x38600c){logger[_0x4385('0x19')](_0x4385('0x1a'),_0x44d5a5,_0x4385('0x1b'));logger[_0x4385('0x1c')](_0x4385('0x1d'),_0x44d5a5,_0x4385('0x1b'),JSON[_0x4385('0x1e')](_0x38600c));if(_0x38600c[_0x4385('0x1f')]){if(_0x38600c[_0x4385('0x1f')][_0x4385('0x20')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x44d5a5,_0x38600c[_0x4385('0x1f')][_0x4385('0x21')]);return _0x300fd5(_0x38600c[_0x4385('0x1f')][_0x4385('0x21')]);}logger[_0x4385('0x1f')](_0x4385('0x1a'),_0x44d5a5,_0x38600c[_0x4385('0x1f')][_0x4385('0x21')]);return _0x5df900(_0x38600c['error'][_0x4385('0x21')]);}else{logger[_0x4385('0x19')]('SalesforceConfiguration,\x20%s,\x20%s',_0x44d5a5,_0x4385('0x1b'));_0x5df900(_0x38600c[_0x4385('0x22')][_0x4385('0x21')]);}})[_0x4385('0x23')](function(_0x425cc7){logger[_0x4385('0x1f')](_0x4385('0x1a'),_0x44d5a5,_0x425cc7);_0x300fd5(_0x425cc7);});});}function respondWithStatusCode(_0x2f06a2,_0x417adb){_0x417adb=_0x417adb||0xcc;return function(_0x1f18d5){if(_0x1f18d5){return _0x2f06a2[_0x4385('0x24')](_0x417adb);}return _0x2f06a2[_0x4385('0x25')](_0x417adb)['end']();};}function respondWithResult(_0xee5d97,_0x270082){_0x270082=_0x270082||0xc8;return function(_0x4d7b58){if(_0x4d7b58){return _0xee5d97[_0x4385('0x25')](_0x270082)['json'](_0x4d7b58);}};}function respondWithFilteredResult(_0x265614,_0x7492ee){return function(_0x4cae72){if(_0x4cae72){var _0x25ced6=_0x4cae72[_0x4385('0x26')],_0x4a2418=_0x7492ee[_0x4385('0x27')],_0x96c984=_0x7492ee['offset']+_0x7492ee[_0x4385('0x28')],_0xdde1b8;if(_0x96c984>=_0x25ced6){_0x96c984=_0x25ced6;_0xdde1b8=0xc8;}else{_0xdde1b8=0xce;}_0x265614['status'](_0xdde1b8);return _0x265614['set']('Content-Range',_0x4a2418+'-'+_0x96c984+'/'+_0x25ced6)[_0x4385('0x29')](_0x4cae72);}return null;};}function patchUpdates(_0xc7de37){return function(_0x5ee6a0){try{jsonpatch[_0x4385('0x2a')](_0x5ee6a0,_0xc7de37,!![]);}catch(_0x56f7c2){return BPromise['reject'](_0x56f7c2);}return _0x5ee6a0[_0x4385('0x2b')]();};}function saveUpdates(_0x41b53d,_0x556812){return function(_0x36a7b6){if(_0x36a7b6){return _0x36a7b6[_0x4385('0x2c')](_0x41b53d)[_0x4385('0x18')](function(_0x5f1125){return _0x5f1125;});}return null;};}function removeEntity(_0x399510,_0xca5236){return function(_0x33056a){if(_0x33056a){return _0x33056a['destroy']()['then'](function(){_0x399510[_0x4385('0x25')](0xcc)[_0x4385('0x2d')]();});}};}function handleEntityNotFound(_0x425d03,_0x2d8d78){return function(_0x559c9a){if(!_0x559c9a){_0x425d03['sendStatus'](0x194);}return _0x559c9a;};}function handleError(_0x1c394b,_0x4ebef3){_0x4ebef3=_0x4ebef3||0x1f4;return function(_0x47ea59){logger[_0x4385('0x1f')](_0x47ea59[_0x4385('0x2e')]);if(_0x47ea59[_0x4385('0x2f')]){delete _0x47ea59[_0x4385('0x2f')];}_0x1c394b[_0x4385('0x25')](_0x4ebef3)[_0x4385('0x30')](_0x47ea59);};}exports[_0x4385('0x31')]=function(_0x1a72f6,_0x5e2763){var _0x33e75d={},_0x5b91f8={},_0xf47f21={'count':0x0,'rows':[]};var _0x43dfeb=_[_0x4385('0x32')](db[_0x4385('0x33')][_0x4385('0x34')],function(_0x1412df){return{'name':_0x1412df['fieldName'],'type':_0x1412df[_0x4385('0x35')][_0x4385('0x36')]};});_0x5b91f8[_0x4385('0x37')]=_[_0x4385('0x32')](_0x43dfeb,_0x4385('0x2f'));_0x5b91f8[_0x4385('0x38')]=_[_0x4385('0x39')](_0x1a72f6['query']);_0x5b91f8[_0x4385('0x3a')]=_[_0x4385('0x3b')](_0x5b91f8['model'],_0x5b91f8['query']);_0x33e75d['attributes']=_[_0x4385('0x3b')](_0x5b91f8[_0x4385('0x37')],qs['fields'](_0x1a72f6[_0x4385('0x38')][_0x4385('0x3c')]));_0x33e75d[_0x4385('0x3d')]=_0x33e75d[_0x4385('0x3d')][_0x4385('0x3e')]?_0x33e75d[_0x4385('0x3d')]:_0x5b91f8[_0x4385('0x37')];if(!_0x1a72f6[_0x4385('0x38')][_0x4385('0x3f')](_0x4385('0x40'))){_0x33e75d[_0x4385('0x28')]=qs[_0x4385('0x28')](_0x1a72f6[_0x4385('0x38')]['limit']);_0x33e75d[_0x4385('0x27')]=qs[_0x4385('0x27')](_0x1a72f6[_0x4385('0x38')][_0x4385('0x27')]);}_0x33e75d[_0x4385('0x41')]=qs['sort'](_0x1a72f6[_0x4385('0x38')][_0x4385('0x42')]);_0x33e75d[_0x4385('0x43')]=qs[_0x4385('0x3a')](_['pick'](_0x1a72f6[_0x4385('0x38')],_0x5b91f8[_0x4385('0x3a')]),_0x43dfeb);if(_0x1a72f6[_0x4385('0x38')][_0x4385('0x44')]){_0x33e75d['where']=_[_0x4385('0x45')](_0x33e75d[_0x4385('0x43')],{'$or':_[_0x4385('0x32')](_0x43dfeb,function(_0x19d6fe){if(_0x19d6fe[_0x4385('0x35')]!==_0x4385('0x46')){var _0x439eca={};_0x439eca[_0x19d6fe[_0x4385('0x2f')]]={'$like':'%'+_0x1a72f6[_0x4385('0x38')][_0x4385('0x44')]+'%'};return _0x439eca;}})});}_0x33e75d=_[_0x4385('0x45')]({},_0x33e75d,_0x1a72f6[_0x4385('0x47')]);var _0x4a8afd={'where':_0x33e75d['where']};return db['SalesforceConfiguration']['count'](_0x4a8afd)[_0x4385('0x18')](function(_0x1fd3f8){_0xf47f21[_0x4385('0x26')]=_0x1fd3f8;if(_0x1a72f6[_0x4385('0x38')][_0x4385('0x48')]){_0x33e75d['include']=[{'all':!![]}];}return db[_0x4385('0x33')]['findAll'](_0x33e75d);})[_0x4385('0x18')](function(_0x1a1a07){_0xf47f21[_0x4385('0x49')]=_0x1a1a07;return _0xf47f21;})['then'](respondWithFilteredResult(_0x5e2763,_0x33e75d))[_0x4385('0x23')](handleError(_0x5e2763,null));};exports[_0x4385('0x4a')]=function(_0x23ee46,_0x442703){var _0xde268a={'raw':![],'where':{'id':_0x23ee46[_0x4385('0x4b')]['id']}},_0x43a847={};_0x43a847[_0x4385('0x37')]=_[_0x4385('0x39')](db['SalesforceConfiguration'][_0x4385('0x34')]);_0x43a847[_0x4385('0x38')]=_[_0x4385('0x39')](_0x23ee46[_0x4385('0x38')]);_0x43a847[_0x4385('0x4c')]=_[_0x4385('0x3b')](_0x43a847[_0x4385('0x37')],_0x43a847[_0x4385('0x38')]);_0xde268a['attributes']=_[_0x4385('0x3b')](_0x43a847['model'],qs[_0x4385('0x3c')](_0x23ee46['query'][_0x4385('0x3c')]));_0xde268a['attributes']=_0xde268a['attributes'][_0x4385('0x3e')]?_0xde268a[_0x4385('0x3d')]:_0x43a847[_0x4385('0x37')];if(_0x23ee46[_0x4385('0x38')][_0x4385('0x48')]){_0xde268a['include']=[{'all':!![]}];}_0xde268a=_[_0x4385('0x45')]({},_0xde268a,_0x23ee46[_0x4385('0x47')]);return db[_0x4385('0x33')][_0x4385('0x4d')](_0xde268a)['then'](handleEntityNotFound(_0x442703,null))[_0x4385('0x18')](respondWithResult(_0x442703,null))['catch'](handleError(_0x442703,null));};exports[_0x4385('0x4e')]=function(_0x4abeda,_0x4cb021){return db[_0x4385('0x33')][_0x4385('0x4e')](_0x4abeda['body'],{})[_0x4385('0x18')](respondWithResult(_0x4cb021,0xc9))[_0x4385('0x23')](handleError(_0x4cb021,null));};exports[_0x4385('0x2c')]=function(_0x1a2d3a,_0xe72611){if(_0x1a2d3a['body']['id']){delete _0x1a2d3a[_0x4385('0x4f')]['id'];}return db[_0x4385('0x33')][_0x4385('0x4d')]({'where':{'id':_0x1a2d3a[_0x4385('0x4b')]['id']}})[_0x4385('0x18')](handleEntityNotFound(_0xe72611,null))['then'](saveUpdates(_0x1a2d3a[_0x4385('0x4f')],null))['then'](respondWithResult(_0xe72611,null))[_0x4385('0x23')](handleError(_0xe72611,null));};exports[_0x4385('0x50')]=function(_0x1f84c7,_0x2358a3){return db[_0x4385('0x33')]['find']({'where':{'id':_0x1f84c7[_0x4385('0x4b')]['id']}})[_0x4385('0x18')](handleEntityNotFound(_0x2358a3,null))[_0x4385('0x18')](removeEntity(_0x2358a3,null))[_0x4385('0x23')](handleError(_0x2358a3,null));};exports['getFields']=function(_0x34682a,_0x46d63a,_0x45bafb){var _0x3a7924={};var _0x56a9d8={};var _0x51c951;var _0x481ae6;return db['SalesforceConfiguration'][_0x4385('0x51')]({'where':{'id':_0x34682a[_0x4385('0x4b')]['id']}})[_0x4385('0x18')](handleEntityNotFound(_0x46d63a,null))[_0x4385('0x18')](function(_0xf886ad){if(_0xf886ad){_0x51c951=_0xf886ad;_0x56a9d8[_0x4385('0x37')]=_[_0x4385('0x39')](db[_0x4385('0x52')]['rawAttributes']);_0x56a9d8[_0x4385('0x38')]=_[_0x4385('0x39')](_0x34682a['query']);_0x56a9d8[_0x4385('0x3a')]=_[_0x4385('0x3b')](_0x56a9d8['model'],_0x56a9d8[_0x4385('0x38')]);_0x3a7924[_0x4385('0x3d')]=_[_0x4385('0x3b')](_0x56a9d8[_0x4385('0x37')],qs['fields'](_0x34682a[_0x4385('0x38')][_0x4385('0x3c')]));_0x3a7924['attributes']=_0x3a7924[_0x4385('0x3d')][_0x4385('0x3e')]?_0x3a7924[_0x4385('0x3d')]:_0x56a9d8[_0x4385('0x37')];_0x3a7924['order']=qs[_0x4385('0x42')](_0x34682a['query'][_0x4385('0x42')]);_0x3a7924[_0x4385('0x43')]=qs['filters'](_['pick'](_0x34682a[_0x4385('0x38')],_0x56a9d8[_0x4385('0x3a')]));if(_0x34682a[_0x4385('0x38')][_0x4385('0x44')]){_0x3a7924[_0x4385('0x43')]=_['merge'](_0x3a7924[_0x4385('0x43')],{'$or':_[_0x4385('0x32')](_0x3a7924[_0x4385('0x3d')],function(_0x33eae2){var _0x5c5f9c={};_0x5c5f9c[_0x33eae2]={'$like':'%'+_0x34682a[_0x4385('0x38')][_0x4385('0x44')]+'%'};return _0x5c5f9c;})});}_0x3a7924=_[_0x4385('0x45')]({},_0x3a7924,_0x34682a[_0x4385('0x47')]);return _0x51c951[_0x4385('0x53')](_0x3a7924);}})[_0x4385('0x18')](function(_0x228330){if(_0x228330){_0x481ae6=_0x228330[_0x4385('0x3e')];if(!_0x34682a[_0x4385('0x38')][_0x4385('0x3f')](_0x4385('0x40'))){_0x3a7924[_0x4385('0x28')]=qs[_0x4385('0x28')](_0x34682a[_0x4385('0x38')][_0x4385('0x28')]);_0x3a7924['offset']=qs[_0x4385('0x27')](_0x34682a[_0x4385('0x38')][_0x4385('0x27')]);}return _0x51c951[_0x4385('0x53')](_0x3a7924);}})[_0x4385('0x18')](function(_0x55632a){if(_0x55632a){return _0x55632a?{'count':_0x481ae6,'rows':_0x55632a}:null;}})[_0x4385('0x18')](respondWithResult(_0x46d63a,null))[_0x4385('0x23')](handleError(_0x46d63a,null));};exports[_0x4385('0x54')]=function(_0x4c081a,_0x9456cc,_0x2eba73){var _0x49e140={};var _0x47552e={};var _0x4195db;var _0x55944e;return db[_0x4385('0x33')][_0x4385('0x51')]({'where':{'id':_0x4c081a[_0x4385('0x4b')]['id']}})[_0x4385('0x18')](handleEntityNotFound(_0x9456cc,null))[_0x4385('0x18')](function(_0xb6fa19){if(_0xb6fa19){_0x4195db=_0xb6fa19;_0x47552e['model']=_['keys'](db[_0x4385('0x52')][_0x4385('0x34')]);_0x47552e[_0x4385('0x38')]=_[_0x4385('0x39')](_0x4c081a[_0x4385('0x38')]);_0x47552e[_0x4385('0x3a')]=_[_0x4385('0x3b')](_0x47552e[_0x4385('0x37')],_0x47552e['query']);_0x49e140[_0x4385('0x3d')]=_[_0x4385('0x3b')](_0x47552e[_0x4385('0x37')],qs[_0x4385('0x3c')](_0x4c081a[_0x4385('0x38')]['fields']));_0x49e140[_0x4385('0x3d')]=_0x49e140[_0x4385('0x3d')][_0x4385('0x3e')]?_0x49e140[_0x4385('0x3d')]:_0x47552e['model'];_0x49e140[_0x4385('0x41')]=qs['sort'](_0x4c081a[_0x4385('0x38')][_0x4385('0x42')]);_0x49e140['where']=qs[_0x4385('0x3a')](_[_0x4385('0x55')](_0x4c081a[_0x4385('0x38')],_0x47552e[_0x4385('0x3a')]));if(_0x4c081a[_0x4385('0x38')]['filter']){_0x49e140[_0x4385('0x43')]=_[_0x4385('0x45')](_0x49e140[_0x4385('0x43')],{'$or':_['map'](_0x49e140[_0x4385('0x3d')],function(_0x3eaa2b){var _0x4e3eef={};_0x4e3eef[_0x3eaa2b]={'$like':'%'+_0x4c081a['query'][_0x4385('0x44')]+'%'};return _0x4e3eef;})});}_0x49e140=_[_0x4385('0x45')]({},_0x49e140,_0x4c081a[_0x4385('0x47')]);return _0x4195db['getSubjects'](_0x49e140);}})[_0x4385('0x18')](function(_0x10de17){if(_0x10de17){_0x55944e=_0x10de17['length'];if(!_0x4c081a[_0x4385('0x38')]['hasOwnProperty']('nolimit')){_0x49e140[_0x4385('0x28')]=qs[_0x4385('0x28')](_0x4c081a[_0x4385('0x38')][_0x4385('0x28')]);_0x49e140[_0x4385('0x27')]=qs[_0x4385('0x27')](_0x4c081a[_0x4385('0x38')]['offset']);}return _0x4195db[_0x4385('0x54')](_0x49e140);}})['then'](function(_0x3c5bc6){if(_0x3c5bc6){return _0x3c5bc6?{'count':_0x55944e,'rows':_0x3c5bc6}:null;}})[_0x4385('0x18')](respondWithResult(_0x9456cc,null))[_0x4385('0x23')](handleError(_0x9456cc,null));};exports[_0x4385('0x56')]=function(_0x4a691d,_0x5a7b9a,_0x3836da){var _0x4496a1={};var _0x265f33={};var _0x92f615;var _0x4890e3;return db[_0x4385('0x33')][_0x4385('0x51')]({'where':{'id':_0x4a691d[_0x4385('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a7b9a,null))[_0x4385('0x18')](function(_0x255a1e){if(_0x255a1e){_0x92f615=_0x255a1e;_0x265f33[_0x4385('0x37')]=_[_0x4385('0x39')](db[_0x4385('0x52')][_0x4385('0x34')]);_0x265f33[_0x4385('0x38')]=_[_0x4385('0x39')](_0x4a691d[_0x4385('0x38')]);_0x265f33[_0x4385('0x3a')]=_[_0x4385('0x3b')](_0x265f33['model'],_0x265f33[_0x4385('0x38')]);_0x4496a1[_0x4385('0x3d')]=_[_0x4385('0x3b')](_0x265f33[_0x4385('0x37')],qs['fields'](_0x4a691d[_0x4385('0x38')][_0x4385('0x3c')]));_0x4496a1['attributes']=_0x4496a1[_0x4385('0x3d')][_0x4385('0x3e')]?_0x4496a1[_0x4385('0x3d')]:_0x265f33[_0x4385('0x37')];_0x4496a1[_0x4385('0x41')]=qs[_0x4385('0x42')](_0x4a691d[_0x4385('0x38')][_0x4385('0x42')]);_0x4496a1[_0x4385('0x43')]=qs['filters'](_['pick'](_0x4a691d[_0x4385('0x38')],_0x265f33[_0x4385('0x3a')]));if(_0x4a691d['query'][_0x4385('0x44')]){_0x4496a1['where']=_[_0x4385('0x45')](_0x4496a1[_0x4385('0x43')],{'$or':_[_0x4385('0x32')](_0x4496a1['attributes'],function(_0x4b5873){var _0x52d27f={};_0x52d27f[_0x4b5873]={'$like':'%'+_0x4a691d[_0x4385('0x38')][_0x4385('0x44')]+'%'};return _0x52d27f;})});}_0x4496a1=_['merge']({},_0x4496a1,_0x4a691d[_0x4385('0x47')]);return _0x92f615[_0x4385('0x56')](_0x4496a1);}})[_0x4385('0x18')](function(_0x2f1d95){if(_0x2f1d95){_0x4890e3=_0x2f1d95[_0x4385('0x3e')];if(!_0x4a691d['query']['hasOwnProperty'](_0x4385('0x40'))){_0x4496a1['limit']=qs['limit'](_0x4a691d[_0x4385('0x38')][_0x4385('0x28')]);_0x4496a1[_0x4385('0x27')]=qs['offset'](_0x4a691d['query'][_0x4385('0x27')]);}return _0x92f615[_0x4385('0x56')](_0x4496a1);}})['then'](function(_0x55fea2){if(_0x55fea2){return _0x55fea2?{'count':_0x4890e3,'rows':_0x55fea2}:null;}})[_0x4385('0x18')](respondWithResult(_0x5a7b9a,null))[_0x4385('0x23')](handleError(_0x5a7b9a,null));}; \ No newline at end of file +var _0xa6fc=['keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','show','params','rawAttributes','options','create','body','getFields','findOne','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','client','http','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','sendStatus','stack','name','status','map','SalesforceConfiguration','fieldName','key','query'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa6fc,0x119));var _0xca6f=function(_0x53ada4,_0x51d7a4){_0x53ada4=_0x53ada4-0x0;var _0x34c975=_0xa6fc[_0x53ada4];return _0x34c975;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xca6f('0x0'));var rimraf=require(_0xca6f('0x1'));var zipdir=require(_0xca6f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xca6f('0x3'));var Mustache=require(_0xca6f('0x4'));var util=require(_0xca6f('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xca6f('0x6'));var fs=require('fs');var _=require(_0xca6f('0x7'));var squel=require(_0xca6f('0x8'));var crypto=require(_0xca6f('0x9'));var jsforce=require(_0xca6f('0xa'));var deskjs=require(_0xca6f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xca6f('0xc'));var Redis=require(_0xca6f('0xd'));var authService=require(_0xca6f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xca6f('0xf'));var hardwareService=require(_0xca6f('0x10'));var logger=require(_0xca6f('0x11'))(_0xca6f('0x12'));var utils=require(_0xca6f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xca6f('0x14'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xca6f('0x15')][_0xca6f('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x1507b2,_0x5d0bd8,_0x5660e2,_0x260159){return new BPromise(function(_0x23b1d6,_0x45c8a4){var _0x1996c3=_0x260159||client;return _0x1996c3[_0xca6f('0x17')](_0x1507b2,_0x5660e2)[_0xca6f('0x18')](function(_0x4d0ef1){logger[_0xca6f('0x19')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5d0bd8,_0xca6f('0x1a'));logger[_0xca6f('0x1b')](_0xca6f('0x1c'),_0x5d0bd8,'request\x20sent',JSON[_0xca6f('0x1d')](_0x4d0ef1));if(_0x4d0ef1[_0xca6f('0x1e')]){if(_0x4d0ef1[_0xca6f('0x1e')][_0xca6f('0x1f')]===0x1f4){logger['error'](_0xca6f('0x20'),_0x5d0bd8,_0x4d0ef1['error']['message']);return _0x45c8a4(_0x4d0ef1[_0xca6f('0x1e')][_0xca6f('0x21')]);}logger[_0xca6f('0x1e')](_0xca6f('0x20'),_0x5d0bd8,_0x4d0ef1[_0xca6f('0x1e')]['message']);return _0x23b1d6(_0x4d0ef1[_0xca6f('0x1e')][_0xca6f('0x21')]);}else{logger[_0xca6f('0x19')](_0xca6f('0x20'),_0x5d0bd8,_0xca6f('0x1a'));_0x23b1d6(_0x4d0ef1[_0xca6f('0x22')][_0xca6f('0x21')]);}})[_0xca6f('0x23')](function(_0xff6372){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x5d0bd8,_0xff6372);_0x45c8a4(_0xff6372);});});}function respondWithStatusCode(_0x582e79,_0x17c0aa){_0x17c0aa=_0x17c0aa||0xcc;return function(_0x414de8){if(_0x414de8){return _0x582e79['sendStatus'](_0x17c0aa);}return _0x582e79['status'](_0x17c0aa)[_0xca6f('0x24')]();};}function respondWithResult(_0x438e86,_0x1c90a0){_0x1c90a0=_0x1c90a0||0xc8;return function(_0x4e7ca9){if(_0x4e7ca9){return _0x438e86['status'](_0x1c90a0)[_0xca6f('0x25')](_0x4e7ca9);}};}function respondWithFilteredResult(_0x170193,_0x47f58c){return function(_0x56118f){if(_0x56118f){var _0x49e2d8=_0x56118f[_0xca6f('0x26')],_0x502a25=_0x47f58c[_0xca6f('0x27')],_0x4a367b=_0x47f58c[_0xca6f('0x27')]+_0x47f58c[_0xca6f('0x28')],_0x4cf389;if(_0x4a367b>=_0x49e2d8){_0x4a367b=_0x49e2d8;_0x4cf389=0xc8;}else{_0x4cf389=0xce;}_0x170193['status'](_0x4cf389);return _0x170193['set'](_0xca6f('0x29'),_0x502a25+'-'+_0x4a367b+'/'+_0x49e2d8)[_0xca6f('0x25')](_0x56118f);}return null;};}function patchUpdates(_0x3af390){return function(_0x1401ab){try{jsonpatch[_0xca6f('0x2a')](_0x1401ab,_0x3af390,!![]);}catch(_0x46fc4f){return BPromise['reject'](_0x46fc4f);}return _0x1401ab[_0xca6f('0x2b')]();};}function saveUpdates(_0x4d32ff,_0x38a827){return function(_0x3ffce4){if(_0x3ffce4){return _0x3ffce4[_0xca6f('0x2c')](_0x4d32ff)[_0xca6f('0x18')](function(_0x4107d1){return _0x4107d1;});}return null;};}function removeEntity(_0x454594,_0x142fb1){return function(_0x330069){if(_0x330069){return _0x330069[_0xca6f('0x2d')]()[_0xca6f('0x18')](function(){_0x454594['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28eb03,_0x40958c){return function(_0x5d143e){if(!_0x5d143e){_0x28eb03[_0xca6f('0x2e')](0x194);}return _0x5d143e;};}function handleError(_0x551e7c,_0x3d0a39){_0x3d0a39=_0x3d0a39||0x1f4;return function(_0x1fabcf){logger[_0xca6f('0x1e')](_0x1fabcf[_0xca6f('0x2f')]);if(_0x1fabcf[_0xca6f('0x30')]){delete _0x1fabcf[_0xca6f('0x30')];}_0x551e7c[_0xca6f('0x31')](_0x3d0a39)['send'](_0x1fabcf);};}exports['index']=function(_0x2bff23,_0x13d2f6){var _0x1c7fb7={},_0x2214ae={},_0xf5ede8={'count':0x0,'rows':[]};var _0x53b075=_[_0xca6f('0x32')](db[_0xca6f('0x33')]['rawAttributes'],function(_0x229bbc){return{'name':_0x229bbc[_0xca6f('0x34')],'type':_0x229bbc['type'][_0xca6f('0x35')]};});_0x2214ae['model']=_[_0xca6f('0x32')](_0x53b075,_0xca6f('0x30'));_0x2214ae[_0xca6f('0x36')]=_[_0xca6f('0x37')](_0x2bff23[_0xca6f('0x36')]);_0x2214ae['filters']=_[_0xca6f('0x38')](_0x2214ae[_0xca6f('0x39')],_0x2214ae[_0xca6f('0x36')]);_0x1c7fb7['attributes']=_[_0xca6f('0x38')](_0x2214ae[_0xca6f('0x39')],qs[_0xca6f('0x3a')](_0x2bff23['query'][_0xca6f('0x3a')]));_0x1c7fb7[_0xca6f('0x3b')]=_0x1c7fb7[_0xca6f('0x3b')][_0xca6f('0x3c')]?_0x1c7fb7['attributes']:_0x2214ae[_0xca6f('0x39')];if(!_0x2bff23[_0xca6f('0x36')][_0xca6f('0x3d')](_0xca6f('0x3e'))){_0x1c7fb7['limit']=qs[_0xca6f('0x28')](_0x2bff23[_0xca6f('0x36')][_0xca6f('0x28')]);_0x1c7fb7[_0xca6f('0x27')]=qs['offset'](_0x2bff23[_0xca6f('0x36')][_0xca6f('0x27')]);}_0x1c7fb7[_0xca6f('0x3f')]=qs[_0xca6f('0x40')](_0x2bff23[_0xca6f('0x36')][_0xca6f('0x40')]);_0x1c7fb7[_0xca6f('0x41')]=qs[_0xca6f('0x42')](_[_0xca6f('0x43')](_0x2bff23[_0xca6f('0x36')],_0x2214ae[_0xca6f('0x42')]),_0x53b075);if(_0x2bff23[_0xca6f('0x36')][_0xca6f('0x44')]){_0x1c7fb7[_0xca6f('0x41')]=_[_0xca6f('0x45')](_0x1c7fb7[_0xca6f('0x41')],{'$or':_[_0xca6f('0x32')](_0x53b075,function(_0x551cfc){if(_0x551cfc['type']!==_0xca6f('0x46')){var _0x473738={};_0x473738[_0x551cfc[_0xca6f('0x30')]]={'$like':'%'+_0x2bff23[_0xca6f('0x36')][_0xca6f('0x44')]+'%'};return _0x473738;}})});}_0x1c7fb7=_[_0xca6f('0x45')]({},_0x1c7fb7,_0x2bff23['options']);var _0x5ee799={'where':_0x1c7fb7[_0xca6f('0x41')]};return db[_0xca6f('0x33')][_0xca6f('0x26')](_0x5ee799)['then'](function(_0x24432c){_0xf5ede8['count']=_0x24432c;if(_0x2bff23[_0xca6f('0x36')]['includeAll']){_0x1c7fb7[_0xca6f('0x47')]=[{'all':!![]}];}return db[_0xca6f('0x33')][_0xca6f('0x48')](_0x1c7fb7);})[_0xca6f('0x18')](function(_0x20b77d){_0xf5ede8[_0xca6f('0x49')]=_0x20b77d;return _0xf5ede8;})[_0xca6f('0x18')](respondWithFilteredResult(_0x13d2f6,_0x1c7fb7))[_0xca6f('0x23')](handleError(_0x13d2f6,null));};exports[_0xca6f('0x4a')]=function(_0x255ade,_0x2b6075){var _0x155cd7={'raw':![],'where':{'id':_0x255ade[_0xca6f('0x4b')]['id']}},_0x1e02cc={};_0x1e02cc[_0xca6f('0x39')]=_[_0xca6f('0x37')](db['SalesforceConfiguration'][_0xca6f('0x4c')]);_0x1e02cc[_0xca6f('0x36')]=_[_0xca6f('0x37')](_0x255ade[_0xca6f('0x36')]);_0x1e02cc['filtears']=_['intersection'](_0x1e02cc[_0xca6f('0x39')],_0x1e02cc[_0xca6f('0x36')]);_0x155cd7['attributes']=_[_0xca6f('0x38')](_0x1e02cc['model'],qs[_0xca6f('0x3a')](_0x255ade[_0xca6f('0x36')][_0xca6f('0x3a')]));_0x155cd7['attributes']=_0x155cd7[_0xca6f('0x3b')][_0xca6f('0x3c')]?_0x155cd7['attributes']:_0x1e02cc[_0xca6f('0x39')];if(_0x255ade[_0xca6f('0x36')]['includeAll']){_0x155cd7[_0xca6f('0x47')]=[{'all':!![]}];}_0x155cd7=_['merge']({},_0x155cd7,_0x255ade[_0xca6f('0x4d')]);return db[_0xca6f('0x33')]['find'](_0x155cd7)['then'](handleEntityNotFound(_0x2b6075,null))[_0xca6f('0x18')](respondWithResult(_0x2b6075,null))[_0xca6f('0x23')](handleError(_0x2b6075,null));};exports[_0xca6f('0x4e')]=function(_0x298648,_0x5a9c18){return db[_0xca6f('0x33')][_0xca6f('0x4e')](_0x298648[_0xca6f('0x4f')],{})[_0xca6f('0x18')](respondWithResult(_0x5a9c18,0xc9))[_0xca6f('0x23')](handleError(_0x5a9c18,null));};exports[_0xca6f('0x2c')]=function(_0x5d62b1,_0xafc69b){if(_0x5d62b1[_0xca6f('0x4f')]['id']){delete _0x5d62b1[_0xca6f('0x4f')]['id'];}return db[_0xca6f('0x33')]['find']({'where':{'id':_0x5d62b1['params']['id']}})[_0xca6f('0x18')](handleEntityNotFound(_0xafc69b,null))[_0xca6f('0x18')](saveUpdates(_0x5d62b1[_0xca6f('0x4f')],null))[_0xca6f('0x18')](respondWithResult(_0xafc69b,null))['catch'](handleError(_0xafc69b,null));};exports[_0xca6f('0x2d')]=function(_0x450727,_0x2abc2c){return db[_0xca6f('0x33')]['find']({'where':{'id':_0x450727[_0xca6f('0x4b')]['id']}})[_0xca6f('0x18')](handleEntityNotFound(_0x2abc2c,null))['then'](removeEntity(_0x2abc2c,null))[_0xca6f('0x23')](handleError(_0x2abc2c,null));};exports[_0xca6f('0x50')]=function(_0x3809df,_0x1bb408,_0x3c62a3){var _0x212efb={};var _0x421a0c={};var _0x5e794e;var _0x4f573e;return db['SalesforceConfiguration'][_0xca6f('0x51')]({'where':{'id':_0x3809df[_0xca6f('0x4b')]['id']}})[_0xca6f('0x18')](handleEntityNotFound(_0x1bb408,null))['then'](function(_0xac36df){if(_0xac36df){_0x5e794e=_0xac36df;_0x421a0c[_0xca6f('0x39')]=_[_0xca6f('0x37')](db[_0xca6f('0x52')][_0xca6f('0x4c')]);_0x421a0c[_0xca6f('0x36')]=_[_0xca6f('0x37')](_0x3809df[_0xca6f('0x36')]);_0x421a0c[_0xca6f('0x42')]=_[_0xca6f('0x38')](_0x421a0c[_0xca6f('0x39')],_0x421a0c[_0xca6f('0x36')]);_0x212efb[_0xca6f('0x3b')]=_[_0xca6f('0x38')](_0x421a0c[_0xca6f('0x39')],qs[_0xca6f('0x3a')](_0x3809df[_0xca6f('0x36')][_0xca6f('0x3a')]));_0x212efb[_0xca6f('0x3b')]=_0x212efb[_0xca6f('0x3b')]['length']?_0x212efb[_0xca6f('0x3b')]:_0x421a0c[_0xca6f('0x39')];_0x212efb[_0xca6f('0x3f')]=qs[_0xca6f('0x40')](_0x3809df['query'][_0xca6f('0x40')]);_0x212efb[_0xca6f('0x41')]=qs[_0xca6f('0x42')](_[_0xca6f('0x43')](_0x3809df[_0xca6f('0x36')],_0x421a0c[_0xca6f('0x42')]));if(_0x3809df[_0xca6f('0x36')]['filter']){_0x212efb[_0xca6f('0x41')]=_[_0xca6f('0x45')](_0x212efb[_0xca6f('0x41')],{'$or':_[_0xca6f('0x32')](_0x212efb['attributes'],function(_0x5b38ac){var _0x21f455={};_0x21f455[_0x5b38ac]={'$like':'%'+_0x3809df['query'][_0xca6f('0x44')]+'%'};return _0x21f455;})});}_0x212efb=_[_0xca6f('0x45')]({},_0x212efb,_0x3809df['options']);return _0x5e794e[_0xca6f('0x50')](_0x212efb);}})[_0xca6f('0x18')](function(_0x406a38){if(_0x406a38){_0x4f573e=_0x406a38['length'];if(!_0x3809df['query'][_0xca6f('0x3d')](_0xca6f('0x3e'))){_0x212efb[_0xca6f('0x28')]=qs[_0xca6f('0x28')](_0x3809df[_0xca6f('0x36')][_0xca6f('0x28')]);_0x212efb[_0xca6f('0x27')]=qs['offset'](_0x3809df[_0xca6f('0x36')][_0xca6f('0x27')]);}return _0x5e794e[_0xca6f('0x50')](_0x212efb);}})[_0xca6f('0x18')](function(_0x2b06fa){if(_0x2b06fa){return _0x2b06fa?{'count':_0x4f573e,'rows':_0x2b06fa}:null;}})['then'](respondWithResult(_0x1bb408,null))[_0xca6f('0x23')](handleError(_0x1bb408,null));};exports['getSubjects']=function(_0x55330f,_0x12ae57,_0xcc8504){var _0x1c1d9a={};var _0x56491c={};var _0x4f35cb;var _0xe3700b;return db[_0xca6f('0x33')]['findOne']({'where':{'id':_0x55330f[_0xca6f('0x4b')]['id']}})[_0xca6f('0x18')](handleEntityNotFound(_0x12ae57,null))[_0xca6f('0x18')](function(_0x25cbb7){if(_0x25cbb7){_0x4f35cb=_0x25cbb7;_0x56491c[_0xca6f('0x39')]=_[_0xca6f('0x37')](db[_0xca6f('0x52')][_0xca6f('0x4c')]);_0x56491c[_0xca6f('0x36')]=_[_0xca6f('0x37')](_0x55330f[_0xca6f('0x36')]);_0x56491c['filters']=_[_0xca6f('0x38')](_0x56491c['model'],_0x56491c[_0xca6f('0x36')]);_0x1c1d9a[_0xca6f('0x3b')]=_[_0xca6f('0x38')](_0x56491c['model'],qs[_0xca6f('0x3a')](_0x55330f[_0xca6f('0x36')][_0xca6f('0x3a')]));_0x1c1d9a[_0xca6f('0x3b')]=_0x1c1d9a[_0xca6f('0x3b')]['length']?_0x1c1d9a[_0xca6f('0x3b')]:_0x56491c[_0xca6f('0x39')];_0x1c1d9a[_0xca6f('0x3f')]=qs['sort'](_0x55330f[_0xca6f('0x36')][_0xca6f('0x40')]);_0x1c1d9a[_0xca6f('0x41')]=qs[_0xca6f('0x42')](_[_0xca6f('0x43')](_0x55330f[_0xca6f('0x36')],_0x56491c[_0xca6f('0x42')]));if(_0x55330f['query'][_0xca6f('0x44')]){_0x1c1d9a[_0xca6f('0x41')]=_[_0xca6f('0x45')](_0x1c1d9a[_0xca6f('0x41')],{'$or':_['map'](_0x1c1d9a[_0xca6f('0x3b')],function(_0x4b09e1){var _0x12bd06={};_0x12bd06[_0x4b09e1]={'$like':'%'+_0x55330f[_0xca6f('0x36')][_0xca6f('0x44')]+'%'};return _0x12bd06;})});}_0x1c1d9a=_['merge']({},_0x1c1d9a,_0x55330f['options']);return _0x4f35cb['getSubjects'](_0x1c1d9a);}})[_0xca6f('0x18')](function(_0x5027b0){if(_0x5027b0){_0xe3700b=_0x5027b0[_0xca6f('0x3c')];if(!_0x55330f[_0xca6f('0x36')][_0xca6f('0x3d')](_0xca6f('0x3e'))){_0x1c1d9a[_0xca6f('0x28')]=qs['limit'](_0x55330f[_0xca6f('0x36')][_0xca6f('0x28')]);_0x1c1d9a[_0xca6f('0x27')]=qs[_0xca6f('0x27')](_0x55330f['query'][_0xca6f('0x27')]);}return _0x4f35cb['getSubjects'](_0x1c1d9a);}})[_0xca6f('0x18')](function(_0x14fd59){if(_0x14fd59){return _0x14fd59?{'count':_0xe3700b,'rows':_0x14fd59}:null;}})[_0xca6f('0x18')](respondWithResult(_0x12ae57,null))[_0xca6f('0x23')](handleError(_0x12ae57,null));};exports[_0xca6f('0x53')]=function(_0x571b46,_0x720b66,_0xf47b1f){var _0x455d58={};var _0x29ed8c={};var _0x110eed;var _0x4df2fb;return db[_0xca6f('0x33')][_0xca6f('0x51')]({'where':{'id':_0x571b46[_0xca6f('0x4b')]['id']}})[_0xca6f('0x18')](handleEntityNotFound(_0x720b66,null))[_0xca6f('0x18')](function(_0xd0bb61){if(_0xd0bb61){_0x110eed=_0xd0bb61;_0x29ed8c[_0xca6f('0x39')]=_['keys'](db[_0xca6f('0x52')][_0xca6f('0x4c')]);_0x29ed8c['query']=_[_0xca6f('0x37')](_0x571b46[_0xca6f('0x36')]);_0x29ed8c[_0xca6f('0x42')]=_[_0xca6f('0x38')](_0x29ed8c[_0xca6f('0x39')],_0x29ed8c[_0xca6f('0x36')]);_0x455d58['attributes']=_[_0xca6f('0x38')](_0x29ed8c['model'],qs[_0xca6f('0x3a')](_0x571b46['query']['fields']));_0x455d58['attributes']=_0x455d58['attributes'][_0xca6f('0x3c')]?_0x455d58['attributes']:_0x29ed8c['model'];_0x455d58[_0xca6f('0x3f')]=qs[_0xca6f('0x40')](_0x571b46['query'][_0xca6f('0x40')]);_0x455d58[_0xca6f('0x41')]=qs[_0xca6f('0x42')](_[_0xca6f('0x43')](_0x571b46[_0xca6f('0x36')],_0x29ed8c[_0xca6f('0x42')]));if(_0x571b46[_0xca6f('0x36')][_0xca6f('0x44')]){_0x455d58[_0xca6f('0x41')]=_[_0xca6f('0x45')](_0x455d58[_0xca6f('0x41')],{'$or':_[_0xca6f('0x32')](_0x455d58['attributes'],function(_0x5c40bf){var _0x31e0c3={};_0x31e0c3[_0x5c40bf]={'$like':'%'+_0x571b46[_0xca6f('0x36')][_0xca6f('0x44')]+'%'};return _0x31e0c3;})});}_0x455d58=_[_0xca6f('0x45')]({},_0x455d58,_0x571b46['options']);return _0x110eed[_0xca6f('0x53')](_0x455d58);}})['then'](function(_0x5946d9){if(_0x5946d9){_0x4df2fb=_0x5946d9['length'];if(!_0x571b46[_0xca6f('0x36')][_0xca6f('0x3d')](_0xca6f('0x3e'))){_0x455d58[_0xca6f('0x28')]=qs['limit'](_0x571b46[_0xca6f('0x36')][_0xca6f('0x28')]);_0x455d58[_0xca6f('0x27')]=qs['offset'](_0x571b46[_0xca6f('0x36')][_0xca6f('0x27')]);}return _0x110eed[_0xca6f('0x53')](_0x455d58);}})[_0xca6f('0x18')](function(_0x32614b){if(_0x32614b){return _0x32614b?{'count':_0x4df2fb,'rows':_0x32614b}:null;}})[_0xca6f('0x18')](respondWithResult(_0x720b66,null))['catch'](handleError(_0x720b66,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 7b33ce7..5731ad5 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 _0x990c=['SalesforceConfiguration','int_salesforce_configurations','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x990c,0x13a));var _0xc990=function(_0x4ae146,_0x3bb7f8){_0x4ae146=_0x4ae146-0x0;var _0xd9e331=_0x990c[_0x4ae146];return _0xd9e331;};'use strict';var _=require(_0xc990('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc990('0x1'));var moment=require(_0xc990('0x2'));var BPromise=require(_0xc990('0x3'));var rp=require(_0xc990('0x4'));var fs=require('fs');var path=require(_0xc990('0x5'));var rimraf=require(_0xc990('0x6'));var config=require(_0xc990('0x7'));var attributes=require(_0xc990('0x8'));module[_0xc990('0x9')]=function(_0x49aa93,_0x563529){return _0x49aa93['define'](_0xc990('0xa'),attributes,{'tableName':_0xc990('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8313=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash'];(function(_0x3b7efb,_0x5c8774){var _0x507f5c=function(_0x405148){while(--_0x405148){_0x3b7efb['push'](_0x3b7efb['shift']());}};_0x507f5c(++_0x5c8774);}(_0x8313,0x1bf));var _0x3831=function(_0x509121,_0x26fd99){_0x509121=_0x509121-0x0;var _0x43084b=_0x8313[_0x509121];return _0x43084b;};'use strict';var _=require(_0x3831('0x0'));var util=require(_0x3831('0x1'));var logger=require(_0x3831('0x2'))(_0x3831('0x3'));var moment=require(_0x3831('0x4'));var BPromise=require(_0x3831('0x5'));var rp=require(_0x3831('0x6'));var fs=require('fs');var path=require(_0x3831('0x7'));var rimraf=require('rimraf');var config=require(_0x3831('0x8'));var attributes=require(_0x3831('0x9'));module[_0x3831('0xa')]=function(_0x4f9fb5,_0x33456a){return _0x4f9fb5[_0x3831('0xb')](_0x3831('0xc'),attributes,{'tableName':_0x3831('0xd'),'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 df34390..fff2ef6 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 _0x42ae=['client','http','request','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x45aa1,_0x35bf74){var _0x36cc77=function(_0x52da2d){while(--_0x52da2d){_0x45aa1['push'](_0x45aa1['shift']());}};_0x36cc77(++_0x35bf74);}(_0x42ae,0x153));var _0xe42a=function(_0x1bfb48,_0x2de37a){_0x1bfb48=_0x1bfb48-0x0;var _0x1f432a=_0x42ae[_0x1bfb48];return _0x1f432a;};'use strict';var _=require(_0xe42a('0x0'));var util=require(_0xe42a('0x1'));var moment=require(_0xe42a('0x2'));var BPromise=require(_0xe42a('0x3'));var rs=require(_0xe42a('0x4'));var fs=require('fs');var Redis=require(_0xe42a('0x5'));var db=require(_0xe42a('0x6'))['db'];var utils=require(_0xe42a('0x7'));var logger=require(_0xe42a('0x8'))(_0xe42a('0x9'));var config=require('../../config/environment');var jayson=require(_0xe42a('0xa'));var client=jayson[_0xe42a('0xb')][_0xe42a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39b7d7,_0xa3f3a4,_0x3a4b7c){return new BPromise(function(_0x3f4e6b,_0x1db6ae){return client[_0xe42a('0xd')](_0x39b7d7,_0x3a4b7c)['then'](function(_0x36c2f7){logger['info'](_0xe42a('0xe'),_0xa3f3a4,_0xe42a('0xf'));logger[_0xe42a('0x10')](_0xe42a('0x11'),_0xa3f3a4,'request\x20sent',JSON[_0xe42a('0x12')](_0x36c2f7));if(_0x36c2f7[_0xe42a('0x13')]){if(_0x36c2f7[_0xe42a('0x13')][_0xe42a('0x14')]===0x1f4){logger[_0xe42a('0x13')](_0xe42a('0xe'),_0xa3f3a4,_0x36c2f7[_0xe42a('0x13')]['message']);return _0x1db6ae(_0x36c2f7[_0xe42a('0x13')][_0xe42a('0x15')]);}logger[_0xe42a('0x13')](_0xe42a('0xe'),_0xa3f3a4,_0x36c2f7['error'][_0xe42a('0x15')]);return _0x3f4e6b(_0x36c2f7['error'][_0xe42a('0x15')]);}else{logger[_0xe42a('0x16')](_0xe42a('0xe'),_0xa3f3a4,_0xe42a('0xf'));_0x3f4e6b(_0x36c2f7[_0xe42a('0x17')][_0xe42a('0x15')]);}})[_0xe42a('0x18')](function(_0x1757b6){logger[_0xe42a('0x13')](_0xe42a('0xe'),_0xa3f3a4,_0x1757b6);_0x1db6ae(_0x1757b6);});});} \ No newline at end of file +var _0xd812=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','bluebird'];(function(_0x1f85f4,_0xbeeec7){var _0x5f46f9=function(_0xf3803d){while(--_0xf3803d){_0x1f85f4['push'](_0x1f85f4['shift']());}};_0x5f46f9(++_0xbeeec7);}(_0xd812,0x129));var _0x2d81=function(_0x3c6dce,_0x5424dd){_0x3c6dce=_0x3c6dce-0x0;var _0x1450e9=_0xd812[_0x3c6dce];return _0x1450e9;};'use strict';var _=require(_0x2d81('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2d81('0x1'));var rs=require(_0x2d81('0x2'));var fs=require('fs');var Redis=require(_0x2d81('0x3'));var db=require(_0x2d81('0x4'))['db'];var utils=require(_0x2d81('0x5'));var logger=require('../../config/logger')(_0x2d81('0x6'));var config=require('../../config/environment');var jayson=require(_0x2d81('0x7'));var client=jayson[_0x2d81('0x8')][_0x2d81('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x147c11,_0x25dce3,_0xbfe77e){return new BPromise(function(_0x3e8ffb,_0x29129a){return client[_0x2d81('0xa')](_0x147c11,_0xbfe77e)[_0x2d81('0xb')](function(_0x3bc077){logger[_0x2d81('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x25dce3,_0x2d81('0xd'));logger[_0x2d81('0xe')](_0x2d81('0xf'),_0x25dce3,_0x2d81('0xd'),JSON[_0x2d81('0x10')](_0x3bc077));if(_0x3bc077['error']){if(_0x3bc077[_0x2d81('0x11')][_0x2d81('0x12')]===0x1f4){logger[_0x2d81('0x11')](_0x2d81('0x13'),_0x25dce3,_0x3bc077[_0x2d81('0x11')]['message']);return _0x29129a(_0x3bc077[_0x2d81('0x11')]['message']);}logger[_0x2d81('0x11')](_0x2d81('0x13'),_0x25dce3,_0x3bc077[_0x2d81('0x11')][_0x2d81('0x14')]);return _0x3e8ffb(_0x3bc077[_0x2d81('0x11')][_0x2d81('0x14')]);}else{logger[_0x2d81('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x25dce3,'request\x20sent');_0x3e8ffb(_0x3bc077[_0x2d81('0x15')]['message']);}})[_0x2d81('0x16')](function(_0x111850){logger[_0x2d81('0x11')](_0x2d81('0x13'),_0x25dce3,_0x111850);_0x29129a(_0x111850);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 8203e92..29ae8d6 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 _0xafb9=['get','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x2fd897,_0x1b5305){var _0x1de92f=function(_0x40f170){while(--_0x40f170){_0x2fd897['push'](_0x2fd897['shift']());}};_0x1de92f(++_0x1b5305);}(_0xafb9,0x68));var _0x9afb=function(_0x110f3e,_0x516c50){_0x110f3e=_0x110f3e-0x0;var _0x1e9009=_0xafb9[_0x110f3e];return _0x1e9009;};'use strict';var multer=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var path=require(_0x9afb('0x2'));var timeout=require(_0x9afb('0x3'));var express=require(_0x9afb('0x4'));var router=express[_0x9afb('0x5')]();var auth=require(_0x9afb('0x6'));var interaction=require(_0x9afb('0x7'));var config=require(_0x9afb('0x8'));var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0x9afb('0x9')](),controller['index']);router[_0x9afb('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x9afb('0xb')]);router[_0x9afb('0xc')]('/',auth[_0x9afb('0x9')](),controller['create']);router[_0x9afb('0xd')](_0x9afb('0xe'),auth[_0x9afb('0x9')](),controller[_0x9afb('0xf')]);router[_0x9afb('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9afb('0x11')]);module[_0x9afb('0x12')]=router; \ No newline at end of file +var _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy'];(function(_0xc90d0,_0x310a56){var _0x225c05=function(_0x1d31a0){while(--_0x1d31a0){_0xc90d0['push'](_0xc90d0['shift']());}};_0x225c05(++_0x310a56);}(_0x814b,0x1a2));var _0xb814=function(_0x44b3f6,_0x2f0b79){_0x44b3f6=_0x44b3f6-0x0;var _0x4a6207=_0x814b[_0x44b3f6];return _0x4a6207;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0xd')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index a0030e3..d7fa179 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 _0x9866=['sequelize','exports','string','variable','customVariable','keyValue','STRING','ENUM'];(function(_0x4b8bf6,_0x4019c4){var _0xc8491=function(_0x5ce76d){while(--_0x5ce76d){_0x4b8bf6['push'](_0x4b8bf6['shift']());}};_0xc8491(++_0x4019c4);}(_0x9866,0x198));var _0x6986=function(_0x2bd5d4,_0x3d07da){_0x2bd5d4=_0x2bd5d4-0x0;var _0x2c07ba=_0x9866[_0x2bd5d4];return _0x2c07ba;};'use strict';var Sequelize=require(_0x6986('0x0'));module[_0x6986('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6986('0x2'),_0x6986('0x3'),_0x6986('0x4'),_0x6986('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6986('0x6')]},'key':{'type':Sequelize[_0x6986('0x6')]},'keyType':{'type':Sequelize[_0x6986('0x7')]('string',_0x6986('0x3'),_0x6986('0x4'))},'keyContent':{'type':Sequelize[_0x6986('0x6')]},'idField':{'type':Sequelize[_0x6986('0x6')]},'variableName':{'type':Sequelize[_0x6986('0x6')]}}; \ No newline at end of file +var _0xa020=['variable','customVariable','keyValue','STRING','sequelize','exports','ENUM','string'];(function(_0x31908,_0xe78b58){var _0x3562b8=function(_0x23cb77){while(--_0x23cb77){_0x31908['push'](_0x31908['shift']());}};_0x3562b8(++_0xe78b58);}(_0xa020,0x1ac));var _0x0a02=function(_0x5e2f74,_0x11c047){_0x5e2f74=_0x5e2f74-0x0;var _0x102234=_0xa020[_0x5e2f74];return _0x102234;};'use strict';var Sequelize=require(_0x0a02('0x0'));module[_0x0a02('0x1')]={'type':{'type':Sequelize[_0x0a02('0x2')](_0x0a02('0x3'),_0x0a02('0x4'),_0x0a02('0x5'),_0x0a02('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0a02('0x7')]},'key':{'type':Sequelize[_0x0a02('0x7')]},'keyType':{'type':Sequelize[_0x0a02('0x2')](_0x0a02('0x3'),_0x0a02('0x4'),_0x0a02('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0a02('0x7')]},'variableName':{'type':Sequelize[_0x0a02('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index f390a6e..285d4b9 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 _0x0c5d=['end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','SalesforceField','includeAll','include','findAll','rows','keys','find','catch','create','body','params','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','update','then','destroy'];(function(_0x2cc09e,_0xbcc417){var _0x5180c6=function(_0x54c4d5){while(--_0x54c4d5){_0x2cc09e['push'](_0x2cc09e['shift']());}};_0x5180c6(++_0xbcc417);}(_0x0c5d,0x6c));var _0xd0c5=function(_0x1c0c59,_0x352525){_0x1c0c59=_0x1c0c59-0x0;var _0x1d5f1f=_0x0c5d[_0x1c0c59];return _0x1d5f1f;};'use strict';var pdf=require(_0xd0c5('0x0'));var emlformat=require(_0xd0c5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd0c5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd0c5('0x3'));var moment=require(_0xd0c5('0x4'));var BPromise=require(_0xd0c5('0x5'));var Mustache=require(_0xd0c5('0x6'));var util=require(_0xd0c5('0x7'));var path=require(_0xd0c5('0x8'));var sox=require(_0xd0c5('0x9'));var csv=require(_0xd0c5('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd0c5('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd0c5('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd0c5('0xd'));var Papa=require(_0xd0c5('0xe'));var Redis=require('ioredis');var authService=require(_0xd0c5('0xf'));var qs=require(_0xd0c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd0c5('0x11'));var logger=require(_0xd0c5('0x12'))(_0xd0c5('0x13'));var utils=require(_0xd0c5('0x14'));var config=require(_0xd0c5('0x15'));var licenseUtil=require(_0xd0c5('0x16'));var db=require(_0xd0c5('0x17'))['db'];function respondWithStatusCode(_0x46db00,_0x1e5ac4){_0x1e5ac4=_0x1e5ac4||0xcc;return function(_0x125470){if(_0x125470){return _0x46db00[_0xd0c5('0x18')](_0x1e5ac4);}return _0x46db00[_0xd0c5('0x19')](_0x1e5ac4)['end']();};}function respondWithResult(_0x11511d,_0x1c1cc8){_0x1c1cc8=_0x1c1cc8||0xc8;return function(_0x1fc98d){if(_0x1fc98d){return _0x11511d[_0xd0c5('0x19')](_0x1c1cc8)['json'](_0x1fc98d);}};}function respondWithFilteredResult(_0x280e22,_0x23d941){return function(_0x242615){if(_0x242615){var _0x639e72=_0x242615[_0xd0c5('0x1a')],_0x556487=_0x23d941['offset'],_0x2be13d=_0x23d941[_0xd0c5('0x1b')]+_0x23d941[_0xd0c5('0x1c')],_0x5809ba;if(_0x2be13d>=_0x639e72){_0x2be13d=_0x639e72;_0x5809ba=0xc8;}else{_0x5809ba=0xce;}_0x280e22[_0xd0c5('0x19')](_0x5809ba);return _0x280e22[_0xd0c5('0x1d')](_0xd0c5('0x1e'),_0x556487+'-'+_0x2be13d+'/'+_0x639e72)[_0xd0c5('0x1f')](_0x242615);}return null;};}function patchUpdates(_0x1f27b9){return function(_0x287961){try{jsonpatch['apply'](_0x287961,_0x1f27b9,!![]);}catch(_0x25cf4c){return BPromise[_0xd0c5('0x20')](_0x25cf4c);}return _0x287961['save']();};}function saveUpdates(_0x835e8d,_0x30f548){return function(_0x4768c6){if(_0x4768c6){return _0x4768c6[_0xd0c5('0x21')](_0x835e8d)[_0xd0c5('0x22')](function(_0x3f0b74){return _0x3f0b74;});}return null;};}function removeEntity(_0x331849,_0x49db81){return function(_0x4ac41c){if(_0x4ac41c){return _0x4ac41c[_0xd0c5('0x23')]()[_0xd0c5('0x22')](function(){_0x331849[_0xd0c5('0x19')](0xcc)[_0xd0c5('0x24')]();});}};}function handleEntityNotFound(_0x5eb093,_0x185e33){return function(_0x54f42c){if(!_0x54f42c){_0x5eb093['sendStatus'](0x194);}return _0x54f42c;};}function handleError(_0x3ec4ee,_0x1a3e9d){_0x1a3e9d=_0x1a3e9d||0x1f4;return function(_0x364963){logger[_0xd0c5('0x25')](_0x364963[_0xd0c5('0x26')]);if(_0x364963[_0xd0c5('0x27')]){delete _0x364963[_0xd0c5('0x27')];}_0x3ec4ee[_0xd0c5('0x19')](_0x1a3e9d)[_0xd0c5('0x28')](_0x364963);};}exports[_0xd0c5('0x29')]=function(_0x34c2f4,_0x3e6400){var _0x3502fe={},_0x2ee47e={},_0x1df662={'count':0x0,'rows':[]};var _0x2869a3=_[_0xd0c5('0x2a')](db['SalesforceField'][_0xd0c5('0x2b')],function(_0x36415f){return{'name':_0x36415f[_0xd0c5('0x2c')],'type':_0x36415f[_0xd0c5('0x2d')][_0xd0c5('0x2e')]};});_0x2ee47e[_0xd0c5('0x2f')]=_[_0xd0c5('0x2a')](_0x2869a3,'name');_0x2ee47e[_0xd0c5('0x30')]=_['keys'](_0x34c2f4[_0xd0c5('0x30')]);_0x2ee47e[_0xd0c5('0x31')]=_[_0xd0c5('0x32')](_0x2ee47e[_0xd0c5('0x2f')],_0x2ee47e[_0xd0c5('0x30')]);_0x3502fe[_0xd0c5('0x33')]=_[_0xd0c5('0x32')](_0x2ee47e['model'],qs['fields'](_0x34c2f4[_0xd0c5('0x30')]['fields']));_0x3502fe[_0xd0c5('0x33')]=_0x3502fe[_0xd0c5('0x33')][_0xd0c5('0x34')]?_0x3502fe[_0xd0c5('0x33')]:_0x2ee47e['model'];if(!_0x34c2f4[_0xd0c5('0x30')][_0xd0c5('0x35')]('nolimit')){_0x3502fe[_0xd0c5('0x1c')]=qs['limit'](_0x34c2f4[_0xd0c5('0x30')][_0xd0c5('0x1c')]);_0x3502fe[_0xd0c5('0x1b')]=qs['offset'](_0x34c2f4[_0xd0c5('0x30')][_0xd0c5('0x1b')]);}_0x3502fe[_0xd0c5('0x36')]=qs[_0xd0c5('0x37')](_0x34c2f4[_0xd0c5('0x30')][_0xd0c5('0x37')]);_0x3502fe[_0xd0c5('0x38')]=qs[_0xd0c5('0x31')](_[_0xd0c5('0x39')](_0x34c2f4[_0xd0c5('0x30')],_0x2ee47e[_0xd0c5('0x31')]),_0x2869a3);if(_0x34c2f4[_0xd0c5('0x30')][_0xd0c5('0x3a')]){_0x3502fe['where']=_['merge'](_0x3502fe[_0xd0c5('0x38')],{'$or':_['map'](_0x2869a3,function(_0x1df6e9){if(_0x1df6e9[_0xd0c5('0x2d')]!=='VIRTUAL'){var _0x38146f={};_0x38146f[_0x1df6e9[_0xd0c5('0x27')]]={'$like':'%'+_0x34c2f4['query'][_0xd0c5('0x3a')]+'%'};return _0x38146f;}})});}_0x3502fe=_[_0xd0c5('0x3b')]({},_0x3502fe,_0x34c2f4[_0xd0c5('0x3c')]);var _0x444a21={'where':_0x3502fe[_0xd0c5('0x38')]};return db[_0xd0c5('0x3d')][_0xd0c5('0x1a')](_0x444a21)[_0xd0c5('0x22')](function(_0x32d6c3){_0x1df662[_0xd0c5('0x1a')]=_0x32d6c3;if(_0x34c2f4[_0xd0c5('0x30')][_0xd0c5('0x3e')]){_0x3502fe[_0xd0c5('0x3f')]=[{'all':!![]}];}return db['SalesforceField'][_0xd0c5('0x40')](_0x3502fe);})[_0xd0c5('0x22')](function(_0x215048){_0x1df662[_0xd0c5('0x41')]=_0x215048;return _0x1df662;})[_0xd0c5('0x22')](respondWithFilteredResult(_0x3e6400,_0x3502fe))['catch'](handleError(_0x3e6400,null));};exports['show']=function(_0x13db1a,_0x2c51c1){var _0xfdffaa={'raw':!![],'where':{'id':_0x13db1a['params']['id']}},_0x35d9c3={};_0x35d9c3[_0xd0c5('0x2f')]=_[_0xd0c5('0x42')](db[_0xd0c5('0x3d')][_0xd0c5('0x2b')]);_0x35d9c3[_0xd0c5('0x30')]=_[_0xd0c5('0x42')](_0x13db1a[_0xd0c5('0x30')]);_0x35d9c3['filtears']=_[_0xd0c5('0x32')](_0x35d9c3[_0xd0c5('0x2f')],_0x35d9c3['query']);_0xfdffaa[_0xd0c5('0x33')]=_[_0xd0c5('0x32')](_0x35d9c3[_0xd0c5('0x2f')],qs['fields'](_0x13db1a['query']['fields']));_0xfdffaa['attributes']=_0xfdffaa[_0xd0c5('0x33')]['length']?_0xfdffaa[_0xd0c5('0x33')]:_0x35d9c3['model'];if(_0x13db1a[_0xd0c5('0x30')]['includeAll']){_0xfdffaa[_0xd0c5('0x3f')]=[{'all':!![]}];}_0xfdffaa=_[_0xd0c5('0x3b')]({},_0xfdffaa,_0x13db1a[_0xd0c5('0x3c')]);return db[_0xd0c5('0x3d')][_0xd0c5('0x43')](_0xfdffaa)['then'](handleEntityNotFound(_0x2c51c1,null))[_0xd0c5('0x22')](respondWithResult(_0x2c51c1,null))[_0xd0c5('0x44')](handleError(_0x2c51c1,null));};exports[_0xd0c5('0x45')]=function(_0x22923a,_0x250733){return db[_0xd0c5('0x3d')]['create'](_0x22923a[_0xd0c5('0x46')],{})[_0xd0c5('0x22')](respondWithResult(_0x250733,0xc9))[_0xd0c5('0x44')](handleError(_0x250733,null));};exports[_0xd0c5('0x21')]=function(_0x5b935c,_0x3616b6){if(_0x5b935c[_0xd0c5('0x46')]['id']){delete _0x5b935c[_0xd0c5('0x46')]['id'];}return db[_0xd0c5('0x3d')][_0xd0c5('0x43')]({'where':{'id':_0x5b935c[_0xd0c5('0x47')]['id']}})[_0xd0c5('0x22')](handleEntityNotFound(_0x3616b6,null))[_0xd0c5('0x22')](saveUpdates(_0x5b935c[_0xd0c5('0x46')],null))[_0xd0c5('0x22')](respondWithResult(_0x3616b6,null))[_0xd0c5('0x44')](handleError(_0x3616b6,null));};exports[_0xd0c5('0x23')]=function(_0x592ff6,_0x553e27){return db[_0xd0c5('0x3d')][_0xd0c5('0x43')]({'where':{'id':_0x592ff6[_0xd0c5('0x47')]['id']}})[_0xd0c5('0x22')](handleEntityNotFound(_0x553e27,null))[_0xd0c5('0x22')](removeEntity(_0x553e27,null))[_0xd0c5('0x44')](handleError(_0x553e27,null));}; \ No newline at end of file +var _0x4fc2=['destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','SalesforceField','findAll','rows','show','params','keys','length','find','catch','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x4e3018,_0x3361e3){var _0x453dbb=function(_0x14bfb0){while(--_0x14bfb0){_0x4e3018['push'](_0x4e3018['shift']());}};_0x453dbb(++_0x3361e3);}(_0x4fc2,0x111));var _0x24fc=function(_0x26b622,_0x237e9e){_0x26b622=_0x26b622-0x0;var _0x58a028=_0x4fc2[_0x26b622];return _0x58a028;};'use strict';var pdf=require(_0x24fc('0x0'));var emlformat=require(_0x24fc('0x1'));var rimraf=require(_0x24fc('0x2'));var zipdir=require(_0x24fc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24fc('0x4'));var moment=require(_0x24fc('0x5'));var BPromise=require(_0x24fc('0x6'));var Mustache=require('mustache');var util=require(_0x24fc('0x7'));var path=require(_0x24fc('0x8'));var sox=require('sox');var csv=require(_0x24fc('0x9'));var ejs=require(_0x24fc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x24fc('0xb'));var crypto=require(_0x24fc('0xc'));var jsforce=require(_0x24fc('0xd'));var deskjs=require(_0x24fc('0xe'));var toCsv=require(_0x24fc('0x9'));var querystring=require(_0x24fc('0xf'));var Papa=require('papaparse');var Redis=require(_0x24fc('0x10'));var authService=require(_0x24fc('0x11'));var qs=require(_0x24fc('0x12'));var as=require(_0x24fc('0x13'));var hardwareService=require(_0x24fc('0x14'));var logger=require(_0x24fc('0x15'))(_0x24fc('0x16'));var utils=require(_0x24fc('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x24fc('0x18'));var db=require(_0x24fc('0x19'))['db'];function respondWithStatusCode(_0x5cc65e,_0x306873){_0x306873=_0x306873||0xcc;return function(_0x76cb25){if(_0x76cb25){return _0x5cc65e[_0x24fc('0x1a')](_0x306873);}return _0x5cc65e[_0x24fc('0x1b')](_0x306873)[_0x24fc('0x1c')]();};}function respondWithResult(_0x326276,_0x537b5c){_0x537b5c=_0x537b5c||0xc8;return function(_0x2a0971){if(_0x2a0971){return _0x326276[_0x24fc('0x1b')](_0x537b5c)[_0x24fc('0x1d')](_0x2a0971);}};}function respondWithFilteredResult(_0x42cbe8,_0x4acd36){return function(_0x2ac989){if(_0x2ac989){var _0x588543=_0x2ac989[_0x24fc('0x1e')],_0x4af098=_0x4acd36[_0x24fc('0x1f')],_0x3385c7=_0x4acd36['offset']+_0x4acd36[_0x24fc('0x20')],_0x218fb6;if(_0x3385c7>=_0x588543){_0x3385c7=_0x588543;_0x218fb6=0xc8;}else{_0x218fb6=0xce;}_0x42cbe8[_0x24fc('0x1b')](_0x218fb6);return _0x42cbe8[_0x24fc('0x21')](_0x24fc('0x22'),_0x4af098+'-'+_0x3385c7+'/'+_0x588543)['json'](_0x2ac989);}return null;};}function patchUpdates(_0x5eabee){return function(_0x4073e0){try{jsonpatch[_0x24fc('0x23')](_0x4073e0,_0x5eabee,!![]);}catch(_0x5b0516){return BPromise[_0x24fc('0x24')](_0x5b0516);}return _0x4073e0[_0x24fc('0x25')]();};}function saveUpdates(_0xbf1d6b,_0x2d0e3d){return function(_0x49a0ba){if(_0x49a0ba){return _0x49a0ba[_0x24fc('0x26')](_0xbf1d6b)['then'](function(_0x339b50){return _0x339b50;});}return null;};}function removeEntity(_0x591c8f,_0x3ed464){return function(_0x44c121){if(_0x44c121){return _0x44c121[_0x24fc('0x27')]()['then'](function(){_0x591c8f[_0x24fc('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35a9c7,_0x2bb93a){return function(_0x36a9b4){if(!_0x36a9b4){_0x35a9c7[_0x24fc('0x1a')](0x194);}return _0x36a9b4;};}function handleError(_0x3296fc,_0x262e11){_0x262e11=_0x262e11||0x1f4;return function(_0x3f0875){logger[_0x24fc('0x28')](_0x3f0875[_0x24fc('0x29')]);if(_0x3f0875[_0x24fc('0x2a')]){delete _0x3f0875['name'];}_0x3296fc[_0x24fc('0x1b')](_0x262e11)[_0x24fc('0x2b')](_0x3f0875);};}exports[_0x24fc('0x2c')]=function(_0x5bb4c8,_0xf2f77d){var _0x3d1ec8={},_0x35f9f9={},_0x290f84={'count':0x0,'rows':[]};var _0x8f2528=_[_0x24fc('0x2d')](db['SalesforceField'][_0x24fc('0x2e')],function(_0x29a461){return{'name':_0x29a461[_0x24fc('0x2f')],'type':_0x29a461[_0x24fc('0x30')][_0x24fc('0x31')]};});_0x35f9f9['model']=_['map'](_0x8f2528,'name');_0x35f9f9[_0x24fc('0x32')]=_['keys'](_0x5bb4c8[_0x24fc('0x32')]);_0x35f9f9[_0x24fc('0x33')]=_[_0x24fc('0x34')](_0x35f9f9[_0x24fc('0x35')],_0x35f9f9['query']);_0x3d1ec8[_0x24fc('0x36')]=_[_0x24fc('0x34')](_0x35f9f9['model'],qs[_0x24fc('0x37')](_0x5bb4c8[_0x24fc('0x32')]['fields']));_0x3d1ec8['attributes']=_0x3d1ec8[_0x24fc('0x36')]['length']?_0x3d1ec8[_0x24fc('0x36')]:_0x35f9f9[_0x24fc('0x35')];if(!_0x5bb4c8['query'][_0x24fc('0x38')](_0x24fc('0x39'))){_0x3d1ec8[_0x24fc('0x20')]=qs[_0x24fc('0x20')](_0x5bb4c8[_0x24fc('0x32')][_0x24fc('0x20')]);_0x3d1ec8[_0x24fc('0x1f')]=qs[_0x24fc('0x1f')](_0x5bb4c8[_0x24fc('0x32')]['offset']);}_0x3d1ec8[_0x24fc('0x3a')]=qs[_0x24fc('0x3b')](_0x5bb4c8[_0x24fc('0x32')][_0x24fc('0x3b')]);_0x3d1ec8[_0x24fc('0x3c')]=qs['filters'](_['pick'](_0x5bb4c8[_0x24fc('0x32')],_0x35f9f9['filters']),_0x8f2528);if(_0x5bb4c8[_0x24fc('0x32')][_0x24fc('0x3d')]){_0x3d1ec8[_0x24fc('0x3c')]=_[_0x24fc('0x3e')](_0x3d1ec8['where'],{'$or':_[_0x24fc('0x2d')](_0x8f2528,function(_0x4f4ec8){if(_0x4f4ec8[_0x24fc('0x30')]!==_0x24fc('0x3f')){var _0x3834d7={};_0x3834d7[_0x4f4ec8[_0x24fc('0x2a')]]={'$like':'%'+_0x5bb4c8[_0x24fc('0x32')]['filter']+'%'};return _0x3834d7;}})});}_0x3d1ec8=_[_0x24fc('0x3e')]({},_0x3d1ec8,_0x5bb4c8[_0x24fc('0x40')]);var _0x2181f7={'where':_0x3d1ec8[_0x24fc('0x3c')]};return db['SalesforceField'][_0x24fc('0x1e')](_0x2181f7)[_0x24fc('0x41')](function(_0x56306e){_0x290f84[_0x24fc('0x1e')]=_0x56306e;if(_0x5bb4c8['query'][_0x24fc('0x42')]){_0x3d1ec8[_0x24fc('0x43')]=[{'all':!![]}];}return db[_0x24fc('0x44')][_0x24fc('0x45')](_0x3d1ec8);})[_0x24fc('0x41')](function(_0x278b18){_0x290f84[_0x24fc('0x46')]=_0x278b18;return _0x290f84;})[_0x24fc('0x41')](respondWithFilteredResult(_0xf2f77d,_0x3d1ec8))['catch'](handleError(_0xf2f77d,null));};exports[_0x24fc('0x47')]=function(_0x43fb6d,_0x32f72c){var _0x4fee9f={'raw':!![],'where':{'id':_0x43fb6d[_0x24fc('0x48')]['id']}},_0x14a8b4={};_0x14a8b4['model']=_[_0x24fc('0x49')](db[_0x24fc('0x44')][_0x24fc('0x2e')]);_0x14a8b4['query']=_[_0x24fc('0x49')](_0x43fb6d[_0x24fc('0x32')]);_0x14a8b4['filtears']=_[_0x24fc('0x34')](_0x14a8b4[_0x24fc('0x35')],_0x14a8b4[_0x24fc('0x32')]);_0x4fee9f[_0x24fc('0x36')]=_['intersection'](_0x14a8b4[_0x24fc('0x35')],qs[_0x24fc('0x37')](_0x43fb6d[_0x24fc('0x32')][_0x24fc('0x37')]));_0x4fee9f[_0x24fc('0x36')]=_0x4fee9f['attributes'][_0x24fc('0x4a')]?_0x4fee9f[_0x24fc('0x36')]:_0x14a8b4[_0x24fc('0x35')];if(_0x43fb6d[_0x24fc('0x32')]['includeAll']){_0x4fee9f[_0x24fc('0x43')]=[{'all':!![]}];}_0x4fee9f=_[_0x24fc('0x3e')]({},_0x4fee9f,_0x43fb6d['options']);return db['SalesforceField'][_0x24fc('0x4b')](_0x4fee9f)['then'](handleEntityNotFound(_0x32f72c,null))['then'](respondWithResult(_0x32f72c,null))[_0x24fc('0x4c')](handleError(_0x32f72c,null));};exports['create']=function(_0x281194,_0x264854){return db[_0x24fc('0x44')]['create'](_0x281194[_0x24fc('0x4d')],{})[_0x24fc('0x41')](respondWithResult(_0x264854,0xc9))[_0x24fc('0x4c')](handleError(_0x264854,null));};exports[_0x24fc('0x26')]=function(_0x39873d,_0x6c6754){if(_0x39873d[_0x24fc('0x4d')]['id']){delete _0x39873d[_0x24fc('0x4d')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x39873d[_0x24fc('0x48')]['id']}})[_0x24fc('0x41')](handleEntityNotFound(_0x6c6754,null))[_0x24fc('0x41')](saveUpdates(_0x39873d['body'],null))['then'](respondWithResult(_0x6c6754,null))[_0x24fc('0x4c')](handleError(_0x6c6754,null));};exports[_0x24fc('0x27')]=function(_0x179a60,_0x134f64){return db[_0x24fc('0x44')][_0x24fc('0x4b')]({'where':{'id':_0x179a60[_0x24fc('0x48')]['id']}})[_0x24fc('0x41')](handleEntityNotFound(_0x134f64,null))[_0x24fc('0x41')](removeEntity(_0x134f64,null))[_0x24fc('0x4c')](handleError(_0x134f64,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index bd48453..7966cd1 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 _0xa7ee=['rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x28d518,_0x473f87){var _0x87c9a1=function(_0xb42c21){while(--_0xb42c21){_0x28d518['push'](_0x28d518['shift']());}};_0x87c9a1(++_0x473f87);}(_0xa7ee,0x119));var _0xea7e=function(_0x22bee0,_0x412ecb){_0x22bee0=_0x22bee0-0x0;var _0x2d295b=_0xa7ee[_0x22bee0];return _0x2d295b;};'use strict';var _=require(_0xea7e('0x0'));var util=require(_0xea7e('0x1'));var logger=require(_0xea7e('0x2'))(_0xea7e('0x3'));var moment=require(_0xea7e('0x4'));var BPromise=require(_0xea7e('0x5'));var rp=require(_0xea7e('0x6'));var fs=require('fs');var path=require(_0xea7e('0x7'));var rimraf=require(_0xea7e('0x8'));var config=require(_0xea7e('0x9'));var attributes=require(_0xea7e('0xa'));module[_0xea7e('0xb')]=function(_0xc6b99d,_0x3d9e5e){return _0xc6b99d[_0xea7e('0xc')]('SalesforceField',attributes,{'tableName':_0xea7e('0xd'),'paranoid':![],'indexes':[{'name':_0xea7e('0xe'),'fields':[_0xea7e('0xf'),_0xea7e('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe0e9=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SalesforceField','int_salesforce_fields','FieldId'];(function(_0x2404bc,_0x595297){var _0x32f9e7=function(_0x3ae03b){while(--_0x3ae03b){_0x2404bc['push'](_0x2404bc['shift']());}};_0x32f9e7(++_0x595297);}(_0xe0e9,0x9a));var _0x9e0e=function(_0x5b5e5f,_0x4b50fa){_0x5b5e5f=_0x5b5e5f-0x0;var _0x206429=_0xe0e9[_0x5b5e5f];return _0x206429;};'use strict';var _=require(_0x9e0e('0x0'));var util=require(_0x9e0e('0x1'));var logger=require(_0x9e0e('0x2'))(_0x9e0e('0x3'));var moment=require(_0x9e0e('0x4'));var BPromise=require(_0x9e0e('0x5'));var rp=require(_0x9e0e('0x6'));var fs=require('fs');var path=require(_0x9e0e('0x7'));var rimraf=require(_0x9e0e('0x8'));var config=require(_0x9e0e('0x9'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x9bc0ba,_0x1ba8e1){return _0x9bc0ba[_0x9e0e('0xa')](_0x9e0e('0xb'),attributes,{'tableName':_0x9e0e('0xc'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0x9e0e('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 8a7b977..e154a5e 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 _0xdace=['request\x20sent','debug','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xdace,0xc5));var _0xedac=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xdace[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecbd3,_0x4081c6,_0x21440e){return new BPromise(function(_0x162eea,_0x53fa43){return client[_0xedac('0xb')](_0x5ecbd3,_0x21440e)[_0xedac('0xc')](function(_0xc98887){logger['info']('SalesforceField,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});} \ No newline at end of file +var _0x9ffd=['SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SalesforceField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x516175,_0x1d603a){var _0x1ec6e5=function(_0x5cdf19){while(--_0x5cdf19){_0x516175['push'](_0x516175['shift']());}};_0x1ec6e5(++_0x1d603a);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x18a306,_0x1bbc6e){_0x18a306=_0x18a306-0x0;var _0x1b105c=_0x9ffd[_0x18a306];return _0x1b105c;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('SalesforceField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('SalesforceField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('SalesforceField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 2c72f20..a7be650 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 _0x23ea=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','create','/:id/configurations','put','update','destroy','multer','util','path'];(function(_0x595505,_0x56cc58){var _0x4d62d7=function(_0x47a93f){while(--_0x47a93f){_0x595505['push'](_0x595505['shift']());}};_0x4d62d7(++_0x56cc58);}(_0x23ea,0xc3));var _0xa23e=function(_0x5e7cf2,_0x1d3e7c){_0x5e7cf2=_0x5e7cf2-0x0;var _0x412b1a=_0x23ea[_0x5e7cf2];return _0x412b1a;};'use strict';var multer=require(_0xa23e('0x0'));var util=require(_0xa23e('0x1'));var path=require(_0xa23e('0x2'));var timeout=require(_0xa23e('0x3'));var express=require(_0xa23e('0x4'));var router=express[_0xa23e('0x5')]();var auth=require(_0xa23e('0x6'));var interaction=require(_0xa23e('0x7'));var config=require(_0xa23e('0x8'));var controller=require(_0xa23e('0x9'));router[_0xa23e('0xa')]('/',auth['isAuthenticated'](),controller[_0xa23e('0xb')]);router[_0xa23e('0xa')](_0xa23e('0xc'),auth[_0xa23e('0xd')](),controller[_0xa23e('0xe')]);router[_0xa23e('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xa23e('0xf')]);router[_0xa23e('0xa')](_0xa23e('0x10'),auth[_0xa23e('0xd')](),controller['getFields']);router['post']('/',auth[_0xa23e('0xd')](),controller[_0xa23e('0x11')]);router['post'](_0xa23e('0x12'),auth[_0xa23e('0xd')](),controller['addConfiguration']);router[_0xa23e('0x13')](_0xa23e('0xc'),auth[_0xa23e('0xd')](),controller[_0xa23e('0x14')]);router['delete'](_0xa23e('0xc'),auth[_0xa23e('0xd')](),controller[_0xa23e('0x15')]);module['exports']=router; \ No newline at end of file +var _0x54a1=['put','delete','exports','multer','path','connect-timeout','../../components/interaction/service','./intServicenowAccount.controller','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','post'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x54a1,0xf1));var _0x154a=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x54a1[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0x154a('0x0'));var util=require('util');var path=require(_0x154a('0x1'));var timeout=require(_0x154a('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x154a('0x3'));var config=require('../../config/environment');var controller=require(_0x154a('0x4'));router['get']('/',auth[_0x154a('0x5')](),controller[_0x154a('0x6')]);router['get'](_0x154a('0x7'),auth[_0x154a('0x5')](),controller[_0x154a('0x8')]);router['get'](_0x154a('0x9'),auth[_0x154a('0x5')](),controller['getConfigurations']);router['get'](_0x154a('0xa'),auth['isAuthenticated'](),controller[_0x154a('0xb')]);router['post']('/',auth[_0x154a('0x5')](),controller[_0x154a('0xc')]);router[_0x154a('0xd')](_0x154a('0x9'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x154a('0xe')](_0x154a('0x7'),auth[_0x154a('0x5')](),controller['update']);router[_0x154a('0xf')](_0x154a('0x7'),auth[_0x154a('0x5')](),controller['destroy']);module[_0x154a('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 8639527..2f19bef 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 _0x974c=['username','STRING'];(function(_0x41466d,_0xd3977){var _0x96389b=function(_0x3b68b3){while(--_0x3b68b3){_0x41466d['push'](_0x41466d['shift']());}};_0x96389b(++_0xd3977);}(_0x974c,0x1a9));var _0xc974=function(_0x3be243,_0x20eae1){_0x3be243=_0x3be243-0x0;var _0x42fd00=_0x974c[_0x3be243];return _0x42fd00;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc974('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc974('0x0')],'unique':_0xc974('0x1')},'password':{'type':Sequelize[_0xc974('0x0')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc974('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xc974('0x0')]}}; \ No newline at end of file +var _0x93e6=['STRING','username','remoteUri','sequelize','exports'];(function(_0x38ea2d,_0x43cce0){var _0x1293b5=function(_0x29ce71){while(--_0x29ce71){_0x38ea2d['push'](_0x38ea2d['shift']());}};_0x1293b5(++_0x43cce0);}(_0x93e6,0x18e));var _0x693e=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0x93e6[_0xd050c6];return _0x7278a;};'use strict';var Sequelize=require(_0x693e('0x0'));module[_0x693e('0x1')]={'name':{'type':Sequelize[_0x693e('0x2')]},'description':{'type':Sequelize[_0x693e('0x2')]},'username':{'type':Sequelize[_0x693e('0x2')],'unique':_0x693e('0x3')},'password':{'type':Sequelize[_0x693e('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x693e('0x2')],'unique':_0x693e('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index d05293a..d61a964 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 _0x05b6=['length','include','create','update','body','find','getConfigurations','ServicenowConfiguration','sort','AccountId','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','hold_reason','knowledge','subcategory','close_code','notify','severity','parent','made_sla','caused_by','watch_list','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','delivery_task','business_stc','additional_assignee_list','description','calendar_duration','close_notes','follow_up','parent_incident','contact_type','incident_state','urgency','problem_id','company','reassignment_count','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','findOne','username','email','remoteUri','serverUrl','slice','substring','%s/api/now/doc/table/schema/','format','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','forEach','internalType','label','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','sendStatus','count','offset','limit','status','set','Content-Range','json','apply','save','then','destroy','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','show','params','filtears'];(function(_0x24626a,_0x26b4cc){var _0x528f07=function(_0x4d55ab){while(--_0x4d55ab){_0x24626a['push'](_0x24626a['shift']());}};_0x528f07(++_0x26b4cc);}(_0x05b6,0x74));var _0x605b=function(_0x5ee607,_0x5ef350){_0x5ee607=_0x5ee607-0x0;var _0x49a75a=_0x05b6[_0x5ee607];return _0x49a75a;};'use strict';var pdf=require(_0x605b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x605b('0x1'));var zipdir=require(_0x605b('0x2'));var jsonpatch=require(_0x605b('0x3'));var rp=require(_0x605b('0x4'));var moment=require(_0x605b('0x5'));var BPromise=require(_0x605b('0x6'));var Mustache=require(_0x605b('0x7'));var util=require(_0x605b('0x8'));var path=require(_0x605b('0x9'));var sox=require(_0x605b('0xa'));var csv=require(_0x605b('0xb'));var ejs=require(_0x605b('0xc'));var fs=require('fs');var _=require(_0x605b('0xd'));var squel=require(_0x605b('0xe'));var crypto=require(_0x605b('0xf'));var jsforce=require(_0x605b('0x10'));var deskjs=require(_0x605b('0x11'));var toCsv=require(_0x605b('0xb'));var querystring=require(_0x605b('0x12'));var Papa=require('papaparse');var Redis=require(_0x605b('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x605b('0x14'));var logger=require(_0x605b('0x15'))(_0x605b('0x16'));var utils=require(_0x605b('0x17'));var config=require(_0x605b('0x18'));var licenseUtil=require(_0x605b('0x19'));var db=require(_0x605b('0x1a'))['db'];var integrations=require(_0x605b('0x1b'));var jayson=require(_0x605b('0x1c'));var client=jayson[_0x605b('0x1d')][_0x605b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x460ae7,_0x1cf8e9,_0x4040b9,_0x54390b){return new BPromise(function(_0x262b53,_0x2e6b45){var _0x4c0cf0=_0x54390b||client;return _0x4c0cf0['request'](_0x460ae7,_0x4040b9)['then'](function(_0x12da61){logger[_0x605b('0x1f')]('ServicenowAccount,\x20%s,\x20%s',_0x1cf8e9,_0x605b('0x20'));logger[_0x605b('0x21')](_0x605b('0x22'),_0x1cf8e9,_0x605b('0x20'),JSON[_0x605b('0x23')](_0x12da61));if(_0x12da61['error']){if(_0x12da61[_0x605b('0x24')][_0x605b('0x25')]===0x1f4){logger['error'](_0x605b('0x26'),_0x1cf8e9,_0x12da61['error'][_0x605b('0x27')]);return _0x2e6b45(_0x12da61[_0x605b('0x24')][_0x605b('0x27')]);}logger['error'](_0x605b('0x26'),_0x1cf8e9,_0x12da61[_0x605b('0x24')][_0x605b('0x27')]);return _0x262b53(_0x12da61[_0x605b('0x24')][_0x605b('0x27')]);}else{logger[_0x605b('0x1f')](_0x605b('0x26'),_0x1cf8e9,'request\x20sent');_0x262b53(_0x12da61[_0x605b('0x28')][_0x605b('0x27')]);}})[_0x605b('0x29')](function(_0x25ee26){logger[_0x605b('0x24')](_0x605b('0x26'),_0x1cf8e9,_0x25ee26);_0x2e6b45(_0x25ee26);});});}function respondWithStatusCode(_0x1040dc,_0x5245b7){_0x5245b7=_0x5245b7||0xcc;return function(_0x5de6f3){if(_0x5de6f3){return _0x1040dc[_0x605b('0x2a')](_0x5245b7);}return _0x1040dc['status'](_0x5245b7)['end']();};}function respondWithResult(_0x1b6642,_0xbbb6d){_0xbbb6d=_0xbbb6d||0xc8;return function(_0x9f5513){if(_0x9f5513){return _0x1b6642['status'](_0xbbb6d)['json'](_0x9f5513);}};}function respondWithFilteredResult(_0x2cf74b,_0x577136){return function(_0x337a20){if(_0x337a20){var _0x5d18f0=_0x337a20[_0x605b('0x2b')],_0x33078a=_0x577136['offset'],_0xb0f44e=_0x577136[_0x605b('0x2c')]+_0x577136[_0x605b('0x2d')],_0x4c3b6c;if(_0xb0f44e>=_0x5d18f0){_0xb0f44e=_0x5d18f0;_0x4c3b6c=0xc8;}else{_0x4c3b6c=0xce;}_0x2cf74b[_0x605b('0x2e')](_0x4c3b6c);return _0x2cf74b[_0x605b('0x2f')](_0x605b('0x30'),_0x33078a+'-'+_0xb0f44e+'/'+_0x5d18f0)[_0x605b('0x31')](_0x337a20);}return null;};}function patchUpdates(_0x22512b){return function(_0xdd2774){try{jsonpatch[_0x605b('0x32')](_0xdd2774,_0x22512b,!![]);}catch(_0x1b11b0){return BPromise['reject'](_0x1b11b0);}return _0xdd2774[_0x605b('0x33')]();};}function saveUpdates(_0x27415c,_0x240f5d){return function(_0x261eb0){if(_0x261eb0){return _0x261eb0['update'](_0x27415c)[_0x605b('0x34')](function(_0x435122){return _0x435122;});}return null;};}function removeEntity(_0x111bca,_0x4e64bb){return function(_0xc635b7){if(_0xc635b7){return _0xc635b7[_0x605b('0x35')]()['then'](function(){_0x111bca[_0x605b('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1663b7,_0x5f4afc){return function(_0x28d0fc){if(!_0x28d0fc){_0x1663b7[_0x605b('0x2a')](0x194);}return _0x28d0fc;};}function handleError(_0x18709a,_0x5a5250){_0x5a5250=_0x5a5250||0x1f4;return function(_0x18d09b){logger[_0x605b('0x24')](_0x18d09b[_0x605b('0x36')]);if(_0x18d09b[_0x605b('0x37')]){delete _0x18d09b[_0x605b('0x37')];}_0x18709a[_0x605b('0x2e')](_0x5a5250)[_0x605b('0x38')](_0x18d09b);};}exports[_0x605b('0x39')]=function(_0x568342,_0x455beb){var _0x1e853={},_0x4a1a42={},_0x5a1b05={'count':0x0,'rows':[]};var _0x4f4982=_[_0x605b('0x3a')](db[_0x605b('0x3b')][_0x605b('0x3c')],function(_0x1bb4e8){return{'name':_0x1bb4e8[_0x605b('0x3d')],'type':_0x1bb4e8[_0x605b('0x3e')]['key']};});_0x4a1a42[_0x605b('0x3f')]=_[_0x605b('0x3a')](_0x4f4982,_0x605b('0x37'));_0x4a1a42[_0x605b('0x40')]=_[_0x605b('0x41')](_0x568342[_0x605b('0x40')]);_0x4a1a42[_0x605b('0x42')]=_['intersection'](_0x4a1a42['model'],_0x4a1a42[_0x605b('0x40')]);_0x1e853[_0x605b('0x43')]=_[_0x605b('0x44')](_0x4a1a42[_0x605b('0x3f')],qs['fields'](_0x568342[_0x605b('0x40')][_0x605b('0x45')]));_0x1e853[_0x605b('0x43')]=_0x1e853['attributes']['length']?_0x1e853[_0x605b('0x43')]:_0x4a1a42[_0x605b('0x3f')];if(!_0x568342['query']['hasOwnProperty'](_0x605b('0x46'))){_0x1e853[_0x605b('0x2d')]=qs[_0x605b('0x2d')](_0x568342[_0x605b('0x40')][_0x605b('0x2d')]);_0x1e853[_0x605b('0x2c')]=qs[_0x605b('0x2c')](_0x568342[_0x605b('0x40')]['offset']);}_0x1e853[_0x605b('0x47')]=qs['sort'](_0x568342[_0x605b('0x40')]['sort']);_0x1e853[_0x605b('0x48')]=qs[_0x605b('0x42')](_[_0x605b('0x49')](_0x568342[_0x605b('0x40')],_0x4a1a42[_0x605b('0x42')]),_0x4f4982);if(_0x568342[_0x605b('0x40')][_0x605b('0x4a')]){_0x1e853['where']=_[_0x605b('0x4b')](_0x1e853[_0x605b('0x48')],{'$or':_[_0x605b('0x3a')](_0x4f4982,function(_0x724eef){if(_0x724eef[_0x605b('0x3e')]!==_0x605b('0x4c')){var _0x41ab09={};_0x41ab09[_0x724eef[_0x605b('0x37')]]={'$like':'%'+_0x568342['query'][_0x605b('0x4a')]+'%'};return _0x41ab09;}})});}_0x1e853=_['merge']({},_0x1e853,_0x568342[_0x605b('0x4d')]);var _0x3e4489={'where':_0x1e853['where']};return db['ServicenowAccount'][_0x605b('0x2b')](_0x3e4489)[_0x605b('0x34')](function(_0x98fe86){_0x5a1b05[_0x605b('0x2b')]=_0x98fe86;if(_0x568342[_0x605b('0x40')][_0x605b('0x4e')]){_0x1e853['include']=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x1e853);})[_0x605b('0x34')](function(_0x4d659b){_0x5a1b05['rows']=_0x4d659b;return _0x5a1b05;})[_0x605b('0x34')](respondWithFilteredResult(_0x455beb,_0x1e853))[_0x605b('0x29')](handleError(_0x455beb,null));};exports[_0x605b('0x4f')]=function(_0x3ce531,_0x38253e){var _0x2dbf1e={'raw':![],'where':{'id':_0x3ce531[_0x605b('0x50')]['id']}},_0x173f85={};_0x173f85[_0x605b('0x3f')]=_['keys'](db[_0x605b('0x3b')]['rawAttributes']);_0x173f85['query']=_[_0x605b('0x41')](_0x3ce531['query']);_0x173f85[_0x605b('0x51')]=_[_0x605b('0x44')](_0x173f85[_0x605b('0x3f')],_0x173f85[_0x605b('0x40')]);_0x2dbf1e[_0x605b('0x43')]=_[_0x605b('0x44')](_0x173f85[_0x605b('0x3f')],qs[_0x605b('0x45')](_0x3ce531['query'][_0x605b('0x45')]));_0x2dbf1e[_0x605b('0x43')]=_0x2dbf1e[_0x605b('0x43')][_0x605b('0x52')]?_0x2dbf1e['attributes']:_0x173f85[_0x605b('0x3f')];if(_0x3ce531[_0x605b('0x40')][_0x605b('0x4e')]){_0x2dbf1e[_0x605b('0x53')]=[{'all':!![]}];}_0x2dbf1e=_[_0x605b('0x4b')]({},_0x2dbf1e,_0x3ce531[_0x605b('0x4d')]);return db[_0x605b('0x3b')]['find'](_0x2dbf1e)['then'](handleEntityNotFound(_0x38253e,null))[_0x605b('0x34')](respondWithResult(_0x38253e,null))[_0x605b('0x29')](handleError(_0x38253e,null));};exports['create']=function(_0x2934c1,_0x49b569){return db[_0x605b('0x3b')][_0x605b('0x54')](_0x2934c1['body'],{})['then'](respondWithResult(_0x49b569,0xc9))[_0x605b('0x29')](handleError(_0x49b569,null));};exports[_0x605b('0x55')]=function(_0x52a51b,_0x222cee){if(_0x52a51b[_0x605b('0x56')]['id']){delete _0x52a51b[_0x605b('0x56')]['id'];}return db[_0x605b('0x3b')]['find']({'where':{'id':_0x52a51b[_0x605b('0x50')]['id']}})[_0x605b('0x34')](handleEntityNotFound(_0x222cee,null))['then'](saveUpdates(_0x52a51b[_0x605b('0x56')],null))[_0x605b('0x34')](respondWithResult(_0x222cee,null))['catch'](handleError(_0x222cee,null));};exports[_0x605b('0x35')]=function(_0x4bc087,_0x4ac692){return db[_0x605b('0x3b')][_0x605b('0x57')]({'where':{'id':_0x4bc087['params']['id']}})['then'](handleEntityNotFound(_0x4ac692,null))['then'](removeEntity(_0x4ac692,null))[_0x605b('0x29')](handleError(_0x4ac692,null));};exports[_0x605b('0x58')]=function(_0x4791b7,_0x35347e,_0x4528a4){var _0x17ee10={};var _0x1b4a25={};var _0x16d0e7;var _0x57b50c;return db[_0x605b('0x3b')]['findOne']({'where':{'id':_0x4791b7[_0x605b('0x50')]['id']}})[_0x605b('0x34')](handleEntityNotFound(_0x35347e,null))[_0x605b('0x34')](function(_0x2689c1){if(_0x2689c1){_0x16d0e7=_0x2689c1;_0x1b4a25[_0x605b('0x3f')]=_['keys'](db[_0x605b('0x59')][_0x605b('0x3c')]);_0x1b4a25[_0x605b('0x40')]=_[_0x605b('0x41')](_0x4791b7[_0x605b('0x40')]);_0x1b4a25[_0x605b('0x42')]=_[_0x605b('0x44')](_0x1b4a25['model'],_0x1b4a25[_0x605b('0x40')]);_0x17ee10[_0x605b('0x43')]=_[_0x605b('0x44')](_0x1b4a25['model'],qs[_0x605b('0x45')](_0x4791b7[_0x605b('0x40')][_0x605b('0x45')]));_0x17ee10[_0x605b('0x43')]=_0x17ee10[_0x605b('0x43')]['length']?_0x17ee10[_0x605b('0x43')]:_0x1b4a25['model'];_0x17ee10[_0x605b('0x47')]=qs[_0x605b('0x5a')](_0x4791b7[_0x605b('0x40')]['sort']);_0x17ee10[_0x605b('0x48')]=qs[_0x605b('0x42')](_['pick'](_0x4791b7[_0x605b('0x40')],_0x1b4a25[_0x605b('0x42')]));if(_0x4791b7[_0x605b('0x40')][_0x605b('0x4a')]){_0x17ee10[_0x605b('0x48')]=_[_0x605b('0x4b')](_0x17ee10[_0x605b('0x48')],{'$or':_['map'](_0x17ee10[_0x605b('0x43')],function(_0x5c2a20){var _0x5cb4fd={};_0x5cb4fd[_0x5c2a20]={'$like':'%'+_0x4791b7[_0x605b('0x40')][_0x605b('0x4a')]+'%'};return _0x5cb4fd;})});}_0x17ee10=_[_0x605b('0x4b')]({},_0x17ee10,_0x4791b7[_0x605b('0x4d')]);return _0x16d0e7[_0x605b('0x58')](_0x17ee10);}})[_0x605b('0x34')](function(_0x48afa1){if(_0x48afa1){_0x57b50c=_0x48afa1[_0x605b('0x52')];if(!_0x4791b7[_0x605b('0x40')]['hasOwnProperty']('nolimit')){_0x17ee10['limit']=qs[_0x605b('0x2d')](_0x4791b7[_0x605b('0x40')]['limit']);_0x17ee10['offset']=qs[_0x605b('0x2c')](_0x4791b7['query'][_0x605b('0x2c')]);}return _0x16d0e7[_0x605b('0x58')](_0x17ee10);}})['then'](function(_0x54a740){if(_0x54a740){return _0x54a740?{'count':_0x57b50c,'rows':_0x54a740}:null;}})['then'](respondWithResult(_0x35347e,null))[_0x605b('0x29')](handleError(_0x35347e,null));};exports['addConfiguration']=function(_0x5ccf12,_0xb80aaa,_0x2b3272){if(_0x5ccf12['body']['id']){delete _0x5ccf12['body']['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x5ccf12[_0x605b('0x50')]['id']}})[_0x605b('0x34')](handleEntityNotFound(_0xb80aaa,null))[_0x605b('0x34')](function(_0x22df0e){if(_0x22df0e){_0x5ccf12[_0x605b('0x56')][_0x605b('0x5b')]=_0x22df0e['id'];_0x5ccf12['body']['Subjects']=integrations['getSubjects'](_0x5ccf12['body'][_0x605b('0x5c')],_0x5ccf12[_0x605b('0x56')]['type']);_0x5ccf12[_0x605b('0x56')][_0x605b('0x5d')]=integrations[_0x605b('0x5e')](_0x5ccf12[_0x605b('0x56')][_0x605b('0x5c')],_0x5ccf12[_0x605b('0x56')][_0x605b('0x3e')]);return db[_0x605b('0x59')][_0x605b('0x54')](_0x5ccf12[_0x605b('0x56')],{'include':[{'model':db[_0x605b('0x5f')],'as':_0x605b('0x60')},{'model':db[_0x605b('0x5f')],'as':_0x605b('0x5d')}]});}return null;})[_0x605b('0x34')](respondWithResult(_0xb80aaa,null))[_0x605b('0x29')](handleError(_0xb80aaa,null));};exports[_0x605b('0x61')]=function(_0x418c82,_0x160ec8,_0x36107d){var _0x569073=['made_sla',_0x605b('0x62'),_0x605b('0x63'),_0x605b('0x64'),_0x605b('0x65'),_0x605b('0x66'),'incident_state',_0x605b('0x67'),'category'];var _0x44e24e=[_0x605b('0x68'),_0x605b('0x69'),_0x605b('0x6a'),_0x605b('0x6b'),'upon_reject',_0x605b('0x6c'),_0x605b('0x6d'),'hold_reason','approval_history',_0x605b('0x6e'),_0x605b('0x6f'),_0x605b('0x70'),'opened_by',_0x605b('0x71'),_0x605b('0x72'),_0x605b('0x73'),_0x605b('0x74'),'sys_created_by',_0x605b('0x63'),_0x605b('0x47'),_0x605b('0x75'),_0x605b('0x76'),'cmdb_ci',_0x605b('0x77'),_0x605b('0x78'),_0x605b('0x79'),_0x605b('0x7a'),_0x605b('0x7b'),_0x605b('0x7c'),_0x605b('0x7d'),'rfc','time_worked',_0x605b('0x7e'),_0x605b('0x7f'),_0x605b('0x80'),_0x605b('0x81'),_0x605b('0x82'),_0x605b('0x83'),_0x605b('0x84'),_0x605b('0x85'),_0x605b('0x86'),'subcategory',_0x605b('0x87'),_0x605b('0x88'),_0x605b('0x65'),'correlation_display',_0x605b('0x89'),'work_start','assignment_group',_0x605b('0x8a'),_0x605b('0x8b'),_0x605b('0x8c'),_0x605b('0x8d'),'notify','sys_class_name',_0x605b('0x8e'),'closed_by',_0x605b('0x8f'),_0x605b('0x90'),'sys_id',_0x605b('0x91'),'reopened_by',_0x605b('0x92'),_0x605b('0x93'),_0x605b('0x94'),_0x605b('0x95'),_0x605b('0x96'),'activity_due','assigned_to',_0x605b('0x67'),_0x605b('0x97'),_0x605b('0x98'),_0x605b('0x99'),_0x605b('0x9a'),'due_date',_0x605b('0x9b'),_0x605b('0x9c'),_0x605b('0x9d'),_0x605b('0x9e'),_0x605b('0x9f'),'correlation_id',_0x605b('0xa0'),'category'];var _0x2f35c6='';var _0x82b025='';var _0xcc1c51=[];var _0x48a7f9='';var _0x519ca9='';var _0x45bb1d=[];var _0x4cd0be='';var _0x40ff49='';var _0x249dc5={};var _0x5d64c4='';return db[_0x605b('0x3b')][_0x605b('0xa1')]({'where':{'id':_0x418c82[_0x605b('0x50')]['id']},'attributes':['id',_0x605b('0xa2'),'password',_0x605b('0xa3'),_0x605b('0xa4'),_0x605b('0xa5')]})[_0x605b('0x34')](handleEntityNotFound(_0x160ec8,null))[_0x605b('0x34')](function(_0x1127cc){if(_0x1127cc){_0x5d64c4=_0x1127cc[_0x605b('0xa4')];var _0x580da1=_0x5d64c4[_0x605b('0xa6')](-0x1);if(_0x580da1==='/'){_0x5d64c4=_0x5d64c4[_0x605b('0xa7')](0x0,_0x5d64c4['lastIndexOf'](_0x580da1));}_0x40ff49=util['format'](_0x605b('0xa8'),_0x5d64c4);_0x4cd0be=util[_0x605b('0xa9')](_0x605b('0xaa'),_0x5d64c4);_0x249dc5={'user':_0x1127cc[_0x605b('0xa2')],'pass':_0x1127cc[_0x605b('0xab')]};var _0x528eee={'method':_0x605b('0xac'),'uri':_0x40ff49+_0x605b('0xad'),'auth':_0x249dc5,'json':!![]};return rp(_0x528eee);}})[_0x605b('0x34')](function(_0x391aa6){if(_0x391aa6[_0x605b('0x28')][_0x605b('0x52')]>0x0){_0x2f35c6=_0x391aa6[_0x605b('0x28')];}console[_0x605b('0xae')](_0x605b('0xaf'),_0x2f35c6);_0x45bb1d=[];_0x82b025=Object[_0x605b('0xb0')]([],_0x2f35c6);_[_0x605b('0xb1')](_0x82b025,function(_0x5ca3ca){return!_0x569073['includes'](_0x5ca3ca['name']);});_0x82b025[_0x605b('0xb2')](function(_0x418653){var _0x53e1f3=createFieldObject(_0x4cd0be,_0x249dc5,_0x418653[_0x605b('0xb3')],_0x418653[_0x605b('0x37')],_0x418653[_0x605b('0xb4')],![]);_0x45bb1d[_0x605b('0xb5')](_0x53e1f3);});return Promise[_0x605b('0xb6')](_0x45bb1d);})[_0x605b('0x34')](function(_0x42397f){_0xcc1c51=_0x42397f;_0x48a7f9=Object['assign']([],_0x2f35c6);console[_0x605b('0xae')](_0x605b('0xb7'),_0x2f35c6);_['remove'](_0x48a7f9,function(_0x101248){return _0x44e24e[_0x605b('0xb8')](_0x101248['name']);});console['log'](_0x605b('0xb9'),_0x48a7f9);_0x45bb1d=[];_0x48a7f9[_0x605b('0xb2')](function(_0x1dcd69){var _0x5de72b=createFieldObject(_0x4cd0be,_0x249dc5,_0x1dcd69[_0x605b('0xb3')],_0x1dcd69[_0x605b('0x37')],_0x1dcd69[_0x605b('0xb4')],!![]);_0x45bb1d['push'](_0x5de72b);});return Promise[_0x605b('0xb6')](_0x45bb1d);})[_0x605b('0x34')](function(_0xb9a1b4){_0x519ca9=_0xb9a1b4;var _0x19b949=_0xcc1c51[_0x605b('0xba')](_0x519ca9);return{'count':_0x19b949['length'],'rows':_0x19b949};})['then'](respondWithResult(_0x160ec8,null))[_0x605b('0x29')](function(_0x487b09){console[_0x605b('0xae')](_0x605b('0xbb')+_0x487b09);var _0x304f8c=_0x418c82['query'][_0x605b('0xbc')]?0x1f4:_0x487b09[_0x605b('0xbd')]||0x1f4;logger[_0x605b('0x24')](_0x487b09[_0x605b('0x36')]);delete _0x487b09[_0x605b('0x37')];if(_0x304f8c===0x191){_0x304f8c=0x190;}_0x160ec8[_0x605b('0x2e')](_0x304f8c)[_0x605b('0x38')](_0x418c82[_0x605b('0x40')]['test']?{'message':_0x605b('0xbe'),'statusCode':_0x487b09[_0x605b('0xbd')]}:_0x487b09);});};function createFieldObject(_0x2d511a,_0x50cbc5,_0x523891,_0xb6b670,_0xe16516,_0x428851){return new Promise(function(_0x4a5000,_0x203ab2){var _0x110eb6={'id':_0xb6b670,'name':_0xe16516,'custom':_0x428851};if(_0x523891===_0x605b('0xbf')){_0x110eb6[_0x605b('0x4d')]=[{'name':_0x605b('0xc0'),'value':_0x605b('0xc1')},{'name':'False','value':_0x605b('0xc2')}];_0x4a5000(_0x110eb6);}else{var _0x4efa42={'method':_0x605b('0xac'),'uri':_0x2d511a+_0x605b('0xc3')+_0xb6b670,'auth':_0x50cbc5,'json':!![]};return rp(_0x4efa42)[_0x605b('0x34')](function(_0x3e61f1){var _0x420e90=[];if(_0x3e61f1['result'][_0x605b('0x52')]>0x0){_0x3e61f1[_0x605b('0x28')][_0x605b('0xb2')](function(_0x1adaf0){if(_0x1adaf0[_0x605b('0xc4')]==='false'){var _0x298206={'name':_0x1adaf0[_0x605b('0xb4')],'value':_0x1adaf0[_0x605b('0xc5')]};_0x420e90[_0x605b('0xb5')](_0x298206);}});}_0x110eb6['options']=_0x420e90;if(_0x110eb6[_0x605b('0x4d')]['length']>0x0){_0x4a5000(_0x110eb6);}else{if(_0x428851==![]){_0x4a5000();}else{_0x4a5000(_0x110eb6);}}});}});} \ No newline at end of file +var _0x3451=['username','password','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','remove','forEach','internalType','label','push','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','test','statusCode','stack','True','False','false','inactive','value','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','end','name','send','index','map','rawAttributes','fieldName','type','key','model','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','ServicenowAccount','includeAll','include','findAll','rows','show','params','find','create','update','body','destroy','getConfigurations','findOne','keys','ServicenowConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','approval_set','subcategory','short_description','delivery_task','work_start','assignment_group','description','calendar_duration','sys_class_name','closed_by','parent_incident','contact_type','reopened_by','urgency','problem_id','company','activity_due','assigned_to','comments','approval','comments_and_work_notes','sys_mod_count','reopen_count','escalation','location','email','serverUrl','remoteUri','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/'];(function(_0x347399,_0x42bbda){var _0x24e7be=function(_0x33fdc){while(--_0x33fdc){_0x347399['push'](_0x347399['shift']());}};_0x24e7be(++_0x42bbda);}(_0x3451,0x19a));var _0x1345=function(_0x295726,_0x5f072e){_0x295726=_0x295726-0x0;var _0x30315b=_0x3451[_0x295726];return _0x30315b;};'use strict';var pdf=require(_0x1345('0x0'));var emlformat=require(_0x1345('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1345('0x2'));var jsonpatch=require(_0x1345('0x3'));var rp=require(_0x1345('0x4'));var moment=require(_0x1345('0x5'));var BPromise=require(_0x1345('0x6'));var Mustache=require(_0x1345('0x7'));var util=require(_0x1345('0x8'));var path=require(_0x1345('0x9'));var sox=require(_0x1345('0xa'));var csv=require(_0x1345('0xb'));var ejs=require(_0x1345('0xc'));var fs=require('fs');var _=require(_0x1345('0xd'));var squel=require('squel');var crypto=require(_0x1345('0xe'));var jsforce=require(_0x1345('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1345('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1345('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1345('0x11'));var as=require(_0x1345('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1345('0x13'));var utils=require('../../config/utils');var config=require(_0x1345('0x14'));var licenseUtil=require(_0x1345('0x15'));var db=require(_0x1345('0x16'))['db'];var integrations=require(_0x1345('0x17'));var jayson=require('jayson/promise');var client=jayson[_0x1345('0x18')][_0x1345('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x19c7e9,_0x45c525,_0x4ea08a,_0x181a2b){return new BPromise(function(_0x426e00,_0x51ad9f){var _0x20a8ac=_0x181a2b||client;return _0x20a8ac[_0x1345('0x1a')](_0x19c7e9,_0x4ea08a)[_0x1345('0x1b')](function(_0x3cd49e){logger[_0x1345('0x1c')](_0x1345('0x1d'),_0x45c525,_0x1345('0x1e'));logger[_0x1345('0x1f')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x45c525,'request\x20sent',JSON[_0x1345('0x20')](_0x3cd49e));if(_0x3cd49e[_0x1345('0x21')]){if(_0x3cd49e[_0x1345('0x21')][_0x1345('0x22')]===0x1f4){logger['error'](_0x1345('0x1d'),_0x45c525,_0x3cd49e[_0x1345('0x21')][_0x1345('0x23')]);return _0x51ad9f(_0x3cd49e[_0x1345('0x21')][_0x1345('0x23')]);}logger[_0x1345('0x21')](_0x1345('0x1d'),_0x45c525,_0x3cd49e[_0x1345('0x21')][_0x1345('0x23')]);return _0x426e00(_0x3cd49e[_0x1345('0x21')][_0x1345('0x23')]);}else{logger['info'](_0x1345('0x1d'),_0x45c525,_0x1345('0x1e'));_0x426e00(_0x3cd49e[_0x1345('0x24')][_0x1345('0x23')]);}})[_0x1345('0x25')](function(_0x122d24){logger[_0x1345('0x21')](_0x1345('0x1d'),_0x45c525,_0x122d24);_0x51ad9f(_0x122d24);});});}function respondWithStatusCode(_0x26c2a6,_0x339ea9){_0x339ea9=_0x339ea9||0xcc;return function(_0x2e7206){if(_0x2e7206){return _0x26c2a6[_0x1345('0x26')](_0x339ea9);}return _0x26c2a6[_0x1345('0x27')](_0x339ea9)['end']();};}function respondWithResult(_0x346054,_0x4a390c){_0x4a390c=_0x4a390c||0xc8;return function(_0xd08b03){if(_0xd08b03){return _0x346054[_0x1345('0x27')](_0x4a390c)[_0x1345('0x28')](_0xd08b03);}};}function respondWithFilteredResult(_0x32f9a3,_0x44aa74){return function(_0x1b4b4f){if(_0x1b4b4f){var _0x3b891c=_0x1b4b4f[_0x1345('0x29')],_0x25b564=_0x44aa74[_0x1345('0x2a')],_0x3dcf6c=_0x44aa74['offset']+_0x44aa74[_0x1345('0x2b')],_0x164131;if(_0x3dcf6c>=_0x3b891c){_0x3dcf6c=_0x3b891c;_0x164131=0xc8;}else{_0x164131=0xce;}_0x32f9a3['status'](_0x164131);return _0x32f9a3['set'](_0x1345('0x2c'),_0x25b564+'-'+_0x3dcf6c+'/'+_0x3b891c)[_0x1345('0x28')](_0x1b4b4f);}return null;};}function patchUpdates(_0x28b5dc){return function(_0x25b06d){try{jsonpatch[_0x1345('0x2d')](_0x25b06d,_0x28b5dc,!![]);}catch(_0x51425d){return BPromise[_0x1345('0x2e')](_0x51425d);}return _0x25b06d[_0x1345('0x2f')]();};}function saveUpdates(_0x96c944,_0x49d8e8){return function(_0x349f0a){if(_0x349f0a){return _0x349f0a['update'](_0x96c944)['then'](function(_0xee1b74){return _0xee1b74;});}return null;};}function removeEntity(_0x1edcdc,_0x7a1680){return function(_0x30ea62){if(_0x30ea62){return _0x30ea62['destroy']()[_0x1345('0x1b')](function(){_0x1edcdc[_0x1345('0x27')](0xcc)[_0x1345('0x30')]();});}};}function handleEntityNotFound(_0xbed4b,_0x147728){return function(_0x415249){if(!_0x415249){_0xbed4b[_0x1345('0x26')](0x194);}return _0x415249;};}function handleError(_0xf2ff36,_0x26071b){_0x26071b=_0x26071b||0x1f4;return function(_0x2b596b){logger[_0x1345('0x21')](_0x2b596b['stack']);if(_0x2b596b[_0x1345('0x31')]){delete _0x2b596b[_0x1345('0x31')];}_0xf2ff36[_0x1345('0x27')](_0x26071b)[_0x1345('0x32')](_0x2b596b);};}exports[_0x1345('0x33')]=function(_0x4c0890,_0x376031){var _0x5da4c8={},_0x553305={},_0x424180={'count':0x0,'rows':[]};var _0x5f0433=_[_0x1345('0x34')](db['ServicenowAccount'][_0x1345('0x35')],function(_0x33ee2d){return{'name':_0x33ee2d[_0x1345('0x36')],'type':_0x33ee2d[_0x1345('0x37')][_0x1345('0x38')]};});_0x553305[_0x1345('0x39')]=_[_0x1345('0x34')](_0x5f0433,'name');_0x553305['query']=_['keys'](_0x4c0890['query']);_0x553305['filters']=_[_0x1345('0x3a')](_0x553305[_0x1345('0x39')],_0x553305[_0x1345('0x3b')]);_0x5da4c8[_0x1345('0x3c')]=_[_0x1345('0x3a')](_0x553305['model'],qs['fields'](_0x4c0890[_0x1345('0x3b')][_0x1345('0x3d')]));_0x5da4c8[_0x1345('0x3c')]=_0x5da4c8[_0x1345('0x3c')][_0x1345('0x3e')]?_0x5da4c8[_0x1345('0x3c')]:_0x553305['model'];if(!_0x4c0890[_0x1345('0x3b')][_0x1345('0x3f')](_0x1345('0x40'))){_0x5da4c8[_0x1345('0x2b')]=qs['limit'](_0x4c0890[_0x1345('0x3b')][_0x1345('0x2b')]);_0x5da4c8[_0x1345('0x2a')]=qs['offset'](_0x4c0890[_0x1345('0x3b')][_0x1345('0x2a')]);}_0x5da4c8[_0x1345('0x41')]=qs['sort'](_0x4c0890[_0x1345('0x3b')][_0x1345('0x42')]);_0x5da4c8[_0x1345('0x43')]=qs[_0x1345('0x44')](_[_0x1345('0x45')](_0x4c0890['query'],_0x553305[_0x1345('0x44')]),_0x5f0433);if(_0x4c0890[_0x1345('0x3b')][_0x1345('0x46')]){_0x5da4c8[_0x1345('0x43')]=_['merge'](_0x5da4c8[_0x1345('0x43')],{'$or':_[_0x1345('0x34')](_0x5f0433,function(_0x321336){if(_0x321336[_0x1345('0x37')]!==_0x1345('0x47')){var _0x1c7694={};_0x1c7694[_0x321336[_0x1345('0x31')]]={'$like':'%'+_0x4c0890[_0x1345('0x3b')][_0x1345('0x46')]+'%'};return _0x1c7694;}})});}_0x5da4c8=_[_0x1345('0x48')]({},_0x5da4c8,_0x4c0890[_0x1345('0x49')]);var _0x3d3454={'where':_0x5da4c8[_0x1345('0x43')]};return db[_0x1345('0x4a')][_0x1345('0x29')](_0x3d3454)[_0x1345('0x1b')](function(_0x5de116){_0x424180[_0x1345('0x29')]=_0x5de116;if(_0x4c0890[_0x1345('0x3b')][_0x1345('0x4b')]){_0x5da4c8[_0x1345('0x4c')]=[{'all':!![]}];}return db[_0x1345('0x4a')][_0x1345('0x4d')](_0x5da4c8);})[_0x1345('0x1b')](function(_0x179c04){_0x424180[_0x1345('0x4e')]=_0x179c04;return _0x424180;})[_0x1345('0x1b')](respondWithFilteredResult(_0x376031,_0x5da4c8))[_0x1345('0x25')](handleError(_0x376031,null));};exports[_0x1345('0x4f')]=function(_0x1753bc,_0x5e3059){var _0x399d81={'raw':![],'where':{'id':_0x1753bc[_0x1345('0x50')]['id']}},_0x54e837={};_0x54e837[_0x1345('0x39')]=_['keys'](db[_0x1345('0x4a')][_0x1345('0x35')]);_0x54e837[_0x1345('0x3b')]=_['keys'](_0x1753bc['query']);_0x54e837['filtears']=_[_0x1345('0x3a')](_0x54e837[_0x1345('0x39')],_0x54e837['query']);_0x399d81[_0x1345('0x3c')]=_[_0x1345('0x3a')](_0x54e837['model'],qs[_0x1345('0x3d')](_0x1753bc['query'][_0x1345('0x3d')]));_0x399d81['attributes']=_0x399d81[_0x1345('0x3c')][_0x1345('0x3e')]?_0x399d81['attributes']:_0x54e837[_0x1345('0x39')];if(_0x1753bc[_0x1345('0x3b')]['includeAll']){_0x399d81['include']=[{'all':!![]}];}_0x399d81=_[_0x1345('0x48')]({},_0x399d81,_0x1753bc['options']);return db[_0x1345('0x4a')][_0x1345('0x51')](_0x399d81)[_0x1345('0x1b')](handleEntityNotFound(_0x5e3059,null))['then'](respondWithResult(_0x5e3059,null))['catch'](handleError(_0x5e3059,null));};exports['create']=function(_0x1c7aae,_0x2e01bc){return db[_0x1345('0x4a')][_0x1345('0x52')](_0x1c7aae['body'],{})[_0x1345('0x1b')](respondWithResult(_0x2e01bc,0xc9))['catch'](handleError(_0x2e01bc,null));};exports[_0x1345('0x53')]=function(_0x1450ba,_0xadb7a6){if(_0x1450ba[_0x1345('0x54')]['id']){delete _0x1450ba[_0x1345('0x54')]['id'];}return db[_0x1345('0x4a')][_0x1345('0x51')]({'where':{'id':_0x1450ba[_0x1345('0x50')]['id']}})[_0x1345('0x1b')](handleEntityNotFound(_0xadb7a6,null))[_0x1345('0x1b')](saveUpdates(_0x1450ba['body'],null))[_0x1345('0x1b')](respondWithResult(_0xadb7a6,null))[_0x1345('0x25')](handleError(_0xadb7a6,null));};exports[_0x1345('0x55')]=function(_0x130b8b,_0x29729b){return db[_0x1345('0x4a')][_0x1345('0x51')]({'where':{'id':_0x130b8b[_0x1345('0x50')]['id']}})[_0x1345('0x1b')](handleEntityNotFound(_0x29729b,null))[_0x1345('0x1b')](removeEntity(_0x29729b,null))[_0x1345('0x25')](handleError(_0x29729b,null));};exports[_0x1345('0x56')]=function(_0xe895c3,_0x21a0a7,_0x310acd){var _0x2be053={};var _0x579d5a={};var _0x4224f7;var _0x3f27f1;return db['ServicenowAccount'][_0x1345('0x57')]({'where':{'id':_0xe895c3[_0x1345('0x50')]['id']}})[_0x1345('0x1b')](handleEntityNotFound(_0x21a0a7,null))['then'](function(_0x3cffb4){if(_0x3cffb4){_0x4224f7=_0x3cffb4;_0x579d5a[_0x1345('0x39')]=_[_0x1345('0x58')](db[_0x1345('0x59')][_0x1345('0x35')]);_0x579d5a[_0x1345('0x3b')]=_[_0x1345('0x58')](_0xe895c3[_0x1345('0x3b')]);_0x579d5a[_0x1345('0x44')]=_[_0x1345('0x3a')](_0x579d5a[_0x1345('0x39')],_0x579d5a[_0x1345('0x3b')]);_0x2be053[_0x1345('0x3c')]=_[_0x1345('0x3a')](_0x579d5a['model'],qs['fields'](_0xe895c3['query'][_0x1345('0x3d')]));_0x2be053[_0x1345('0x3c')]=_0x2be053[_0x1345('0x3c')][_0x1345('0x3e')]?_0x2be053[_0x1345('0x3c')]:_0x579d5a[_0x1345('0x39')];_0x2be053[_0x1345('0x41')]=qs[_0x1345('0x42')](_0xe895c3[_0x1345('0x3b')][_0x1345('0x42')]);_0x2be053[_0x1345('0x43')]=qs[_0x1345('0x44')](_[_0x1345('0x45')](_0xe895c3['query'],_0x579d5a['filters']));if(_0xe895c3[_0x1345('0x3b')][_0x1345('0x46')]){_0x2be053['where']=_[_0x1345('0x48')](_0x2be053[_0x1345('0x43')],{'$or':_['map'](_0x2be053[_0x1345('0x3c')],function(_0x41f412){var _0x13c142={};_0x13c142[_0x41f412]={'$like':'%'+_0xe895c3[_0x1345('0x3b')]['filter']+'%'};return _0x13c142;})});}_0x2be053=_[_0x1345('0x48')]({},_0x2be053,_0xe895c3[_0x1345('0x49')]);return _0x4224f7[_0x1345('0x56')](_0x2be053);}})[_0x1345('0x1b')](function(_0x2ee772){if(_0x2ee772){_0x3f27f1=_0x2ee772['length'];if(!_0xe895c3['query'][_0x1345('0x3f')](_0x1345('0x40'))){_0x2be053[_0x1345('0x2b')]=qs[_0x1345('0x2b')](_0xe895c3['query'][_0x1345('0x2b')]);_0x2be053['offset']=qs[_0x1345('0x2a')](_0xe895c3['query'][_0x1345('0x2a')]);}return _0x4224f7[_0x1345('0x56')](_0x2be053);}})[_0x1345('0x1b')](function(_0x550f6f){if(_0x550f6f){return _0x550f6f?{'count':_0x3f27f1,'rows':_0x550f6f}:null;}})[_0x1345('0x1b')](respondWithResult(_0x21a0a7,null))[_0x1345('0x25')](handleError(_0x21a0a7,null));};exports['addConfiguration']=function(_0xf69b9c,_0x462dbe,_0x174968){if(_0xf69b9c['body']['id']){delete _0xf69b9c['body']['id'];}return db[_0x1345('0x4a')][_0x1345('0x57')]({'where':{'id':_0xf69b9c['params']['id']}})[_0x1345('0x1b')](handleEntityNotFound(_0x462dbe,null))['then'](function(_0x1b513a){if(_0x1b513a){_0xf69b9c[_0x1345('0x54')][_0x1345('0x5a')]=_0x1b513a['id'];_0xf69b9c[_0x1345('0x54')][_0x1345('0x5b')]=integrations[_0x1345('0x5c')](_0xf69b9c[_0x1345('0x54')][_0x1345('0x5d')],_0xf69b9c['body'][_0x1345('0x37')]);_0xf69b9c[_0x1345('0x54')][_0x1345('0x5e')]=integrations[_0x1345('0x5f')](_0xf69b9c['body'][_0x1345('0x5d')],_0xf69b9c[_0x1345('0x54')][_0x1345('0x37')]);return db['ServicenowConfiguration'][_0x1345('0x52')](_0xf69b9c[_0x1345('0x54')],{'include':[{'model':db[_0x1345('0x60')],'as':_0x1345('0x5b')},{'model':db[_0x1345('0x60')],'as':_0x1345('0x5e')}]});}return null;})['then'](respondWithResult(_0x462dbe,null))[_0x1345('0x25')](handleError(_0x462dbe,null));};exports[_0x1345('0x61')]=function(_0x53dacc,_0x43b879,_0x1491ef){var _0x534894=[_0x1345('0x62'),_0x1345('0x63'),_0x1345('0x64'),'subcategory',_0x1345('0x65'),_0x1345('0x66'),_0x1345('0x67'),_0x1345('0x68'),_0x1345('0x69')];var _0x3f8f1c=[_0x1345('0x6a'),'made_sla',_0x1345('0x6b'),_0x1345('0x6c'),_0x1345('0x6d'),_0x1345('0x6e'),_0x1345('0x6f'),'hold_reason','approval_history','number',_0x1345('0x70'),'sys_updated_by',_0x1345('0x71'),_0x1345('0x72'),_0x1345('0x73'),_0x1345('0x74'),_0x1345('0x75'),_0x1345('0x76'),_0x1345('0x64'),_0x1345('0x41'),_0x1345('0x77'),_0x1345('0x78'),_0x1345('0x79'),_0x1345('0x7a'),_0x1345('0x7b'),_0x1345('0x7c'),_0x1345('0x7d'),_0x1345('0x7e'),_0x1345('0x7f'),_0x1345('0x80'),'rfc',_0x1345('0x81'),_0x1345('0x82'),_0x1345('0x83'),_0x1345('0x84'),_0x1345('0x85'),_0x1345('0x86'),_0x1345('0x87'),_0x1345('0x88'),'caller_id',_0x1345('0x89'),_0x1345('0x8a'),'work_notes',_0x1345('0x8b'),_0x1345('0x65'),'correlation_display',_0x1345('0x8c'),_0x1345('0x8d'),_0x1345('0x8e'),'business_stc','additional_assignee_list',_0x1345('0x8f'),_0x1345('0x90'),'notify',_0x1345('0x91'),'close_notes',_0x1345('0x92'),'follow_up',_0x1345('0x93'),'sys_id',_0x1345('0x94'),_0x1345('0x95'),_0x1345('0x67'),_0x1345('0x96'),_0x1345('0x97'),_0x1345('0x98'),'reassignment_count',_0x1345('0x99'),_0x1345('0x9a'),_0x1345('0x68'),_0x1345('0x9b'),'sla_due',_0x1345('0x9c'),_0x1345('0x9d'),'due_date',_0x1345('0x9e'),_0x1345('0x9f'),'sys_tags',_0x1345('0xa0'),'upon_approval','correlation_id',_0x1345('0xa1'),_0x1345('0x69')];var _0x427d4d='';var _0x1992ef='';var _0x20dc4c=[];var _0x4047db='';var _0x4aa90e='';var _0x58c9b9=[];var _0x4025a4='';var _0x1e704e='';var _0x4a9157={};var _0x3422bb='';return db[_0x1345('0x4a')][_0x1345('0x57')]({'where':{'id':_0x53dacc[_0x1345('0x50')]['id']},'attributes':['id','username','password',_0x1345('0xa2'),'remoteUri',_0x1345('0xa3')]})[_0x1345('0x1b')](handleEntityNotFound(_0x43b879,null))['then'](function(_0x57e0b7){if(_0x57e0b7){_0x3422bb=_0x57e0b7[_0x1345('0xa4')];var _0x8e4405=_0x3422bb['slice'](-0x1);if(_0x8e4405==='/'){_0x3422bb=_0x3422bb['substring'](0x0,_0x3422bb[_0x1345('0xa5')](_0x8e4405));}_0x1e704e=util[_0x1345('0xa6')](_0x1345('0xa7'),_0x3422bb);_0x4025a4=util[_0x1345('0xa6')](_0x1345('0xa8'),_0x3422bb);_0x4a9157={'user':_0x57e0b7[_0x1345('0xa9')],'pass':_0x57e0b7[_0x1345('0xaa')]};var _0x364079={'method':_0x1345('0xab'),'uri':_0x1e704e+_0x1345('0xac'),'auth':_0x4a9157,'json':!![]};return rp(_0x364079);}})[_0x1345('0x1b')](function(_0x5774c4){if(_0x5774c4[_0x1345('0x24')][_0x1345('0x3e')]>0x0){_0x427d4d=_0x5774c4[_0x1345('0x24')];}console[_0x1345('0xad')](_0x1345('0xae'),_0x427d4d);_0x58c9b9=[];_0x1992ef=Object['assign']([],_0x427d4d);_[_0x1345('0xaf')](_0x1992ef,function(_0x384014){return!_0x534894['includes'](_0x384014[_0x1345('0x31')]);});_0x1992ef[_0x1345('0xb0')](function(_0x273151){var _0xcfeeed=createFieldObject(_0x4025a4,_0x4a9157,_0x273151[_0x1345('0xb1')],_0x273151[_0x1345('0x31')],_0x273151[_0x1345('0xb2')],![]);_0x58c9b9[_0x1345('0xb3')](_0xcfeeed);});return Promise[_0x1345('0xb4')](_0x58c9b9);})[_0x1345('0x1b')](function(_0x4338f9){_0x20dc4c=_0x4338f9;_0x4047db=Object[_0x1345('0xb5')]([],_0x427d4d);console[_0x1345('0xad')](_0x1345('0xb6'),_0x427d4d);_[_0x1345('0xaf')](_0x4047db,function(_0x26ee05){return _0x3f8f1c['includes'](_0x26ee05[_0x1345('0x31')]);});console[_0x1345('0xad')](_0x1345('0xb7'),_0x4047db);_0x58c9b9=[];_0x4047db['forEach'](function(_0x5a0f9d){var _0x3af7a5=createFieldObject(_0x4025a4,_0x4a9157,_0x5a0f9d['internalType'],_0x5a0f9d[_0x1345('0x31')],_0x5a0f9d[_0x1345('0xb2')],!![]);_0x58c9b9[_0x1345('0xb3')](_0x3af7a5);});return Promise[_0x1345('0xb4')](_0x58c9b9);})[_0x1345('0x1b')](function(_0x9b2cb5){_0x4aa90e=_0x9b2cb5;var _0x1a4dc5=_0x20dc4c[_0x1345('0xb8')](_0x4aa90e);return{'count':_0x1a4dc5['length'],'rows':_0x1a4dc5};})[_0x1345('0x1b')](respondWithResult(_0x43b879,null))[_0x1345('0x25')](function(_0x134d69){console[_0x1345('0xad')]('ServiceNow\x20error:\x20'+_0x134d69);var _0x5bb85a=_0x53dacc[_0x1345('0x3b')][_0x1345('0xb9')]?0x1f4:_0x134d69[_0x1345('0xba')]||0x1f4;logger[_0x1345('0x21')](_0x134d69[_0x1345('0xbb')]);delete _0x134d69[_0x1345('0x31')];if(_0x5bb85a===0x191){_0x5bb85a=0x190;}_0x43b879[_0x1345('0x27')](_0x5bb85a)[_0x1345('0x32')](_0x53dacc[_0x1345('0x3b')][_0x1345('0xb9')]?{'message':'Wrong\x20credentials','statusCode':_0x134d69['statusCode']}:_0x134d69);});};function createFieldObject(_0x3d12f5,_0x282f13,_0x4d54a1,_0x4ef4e1,_0xeb90b6,_0x5c6544){return new Promise(function(_0x2cd542,_0x2132c1){var _0x4d89bc={'id':_0x4ef4e1,'name':_0xeb90b6,'custom':_0x5c6544};if(_0x4d54a1==='boolean'){_0x4d89bc['options']=[{'name':_0x1345('0xbc'),'value':'true'},{'name':_0x1345('0xbd'),'value':_0x1345('0xbe')}];_0x2cd542(_0x4d89bc);}else{var _0x3d4ef3={'method':_0x1345('0xab'),'uri':_0x3d12f5+'sys_choice?sysparm_query=name=incident^element='+_0x4ef4e1,'auth':_0x282f13,'json':!![]};return rp(_0x3d4ef3)['then'](function(_0x36bf21){var _0x449bed=[];if(_0x36bf21[_0x1345('0x24')][_0x1345('0x3e')]>0x0){_0x36bf21[_0x1345('0x24')]['forEach'](function(_0x3f4382){if(_0x3f4382[_0x1345('0xbf')]===_0x1345('0xbe')){var _0x43f988={'name':_0x3f4382[_0x1345('0xb2')],'value':_0x3f4382[_0x1345('0xc0')]};_0x449bed[_0x1345('0xb3')](_0x43f988);}});}_0x4d89bc[_0x1345('0x49')]=_0x449bed;if(_0x4d89bc[_0x1345('0x49')][_0x1345('0x3e')]>0x0){_0x2cd542(_0x4d89bc);}else{if(_0x5c6544==![]){_0x2cd542();}else{_0x2cd542(_0x4d89bc);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index a5b2e9f..0cb39a3 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 _0xe015=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','bluebird'];(function(_0x2c1dcd,_0x350452){var _0x158ce5=function(_0x5c1c57){while(--_0x5c1c57){_0x2c1dcd['push'](_0x2c1dcd['shift']());}};_0x158ce5(++_0x350452);}(_0xe015,0x13b));var _0x5e01=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe015[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var logger=require(_0x5e01('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5e01('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e01('0x4'));var rimraf=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var attributes=require(_0x5e01('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x5e01('0x8')]=function(_0x3d2da2,_0x4de678){return _0x3d2da2['define'](_0x5e01('0x9'),attributes,{'tableName':_0x5e01('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd50=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','ServicenowAccount','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd50,0x196));var _0x0bd5=function(_0x57c097,_0x1a9697){_0x57c097=_0x57c097-0x0;var _0x3fd85e=_0xbd50[_0x57c097];return _0x3fd85e;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var logger=require(_0x0bd5('0x2'))('api');var moment=require(_0x0bd5('0x3'));var BPromise=require(_0x0bd5('0x4'));var rp=require(_0x0bd5('0x5'));var fs=require('fs');var path=require(_0x0bd5('0x6'));var rimraf=require(_0x0bd5('0x7'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0bd5('0x8')]=function(_0x2ef1d0,_0xcc6cfa){return _0x2ef1d0[_0x0bd5('0x9')](_0x0bd5('0xa'),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 0cb1b54..e0c1600 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 _0xba4e=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','info','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetServicenowAccount','ShowServicenowAccount','ServicenowAccount','lodash','moment','bluebird','randomstring'];(function(_0x1dcad1,_0x2f8dd5){var _0x34b47d=function(_0x20f076){while(--_0x20f076){_0x1dcad1['push'](_0x1dcad1['shift']());}};_0x34b47d(++_0x2f8dd5);}(_0xba4e,0x10c));var _0xeba4=function(_0x317cc5,_0x3b6179){_0x317cc5=_0x317cc5-0x0;var _0x44fe81=_0xba4e[_0x317cc5];return _0x44fe81;};'use strict';var _=require(_0xeba4('0x0'));var util=require('util');var moment=require(_0xeba4('0x1'));var BPromise=require(_0xeba4('0x2'));var rs=require(_0xeba4('0x3'));var fs=require('fs');var Redis=require(_0xeba4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xeba4('0x5'));var logger=require(_0xeba4('0x6'))(_0xeba4('0x7'));var config=require(_0xeba4('0x8'));var jayson=require(_0xeba4('0x9'));var client=jayson['client'][_0xeba4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x440846,_0x1056ee,_0x2ca812){return new BPromise(function(_0x3d1100,_0x30f692){return client[_0xeba4('0xb')](_0x440846,_0x2ca812)[_0xeba4('0xc')](function(_0x322558){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x1056ee,_0xeba4('0xd'));logger[_0xeba4('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1056ee,_0xeba4('0xd'),JSON[_0xeba4('0xf')](_0x322558));if(_0x322558['error']){if(_0x322558[_0xeba4('0x10')]['code']===0x1f4){logger[_0xeba4('0x10')](_0xeba4('0x11'),_0x1056ee,_0x322558[_0xeba4('0x10')][_0xeba4('0x12')]);return _0x30f692(_0x322558['error'][_0xeba4('0x12')]);}logger[_0xeba4('0x10')](_0xeba4('0x11'),_0x1056ee,_0x322558[_0xeba4('0x10')]['message']);return _0x3d1100(_0x322558[_0xeba4('0x10')][_0xeba4('0x12')]);}else{logger[_0xeba4('0x13')](_0xeba4('0x11'),_0x1056ee,_0xeba4('0xd'));_0x3d1100(_0x322558[_0xeba4('0x14')][_0xeba4('0x12')]);}})[_0xeba4('0x15')](function(_0x540a67){logger[_0xeba4('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x1056ee,_0x540a67);_0x30f692(_0x540a67);});});}exports['GetServicenowAccount']=function(_0x414f4a){var _0x5ca377=this;return new Promise(function(_0x26185d,_0x3d14cb){return db['ServicenowAccount'][_0xeba4('0x16')]({'raw':_0x414f4a['options']?_0x414f4a[_0xeba4('0x17')][_0xeba4('0x18')]===undefined?!![]:![]:!![],'where':_0x414f4a['options']?_0x414f4a[_0xeba4('0x17')][_0xeba4('0x19')]||null:null,'attributes':_0x414f4a[_0xeba4('0x17')]?_0x414f4a[_0xeba4('0x17')][_0xeba4('0x1a')]||null:null,'limit':_0x414f4a[_0xeba4('0x17')]?_0x414f4a[_0xeba4('0x17')][_0xeba4('0x1b')]||null:null,'include':_0x414f4a[_0xeba4('0x17')]?_0x414f4a['options'][_0xeba4('0x1c')]?_[_0xeba4('0x1d')](_0x414f4a[_0xeba4('0x17')][_0xeba4('0x1c')],function(_0x5d4abd){return{'model':db[_0x5d4abd[_0xeba4('0x1e')]],'as':_0x5d4abd['as'],'attributes':_0x5d4abd[_0xeba4('0x1a')],'include':_0x5d4abd[_0xeba4('0x1c')]?_[_0xeba4('0x1d')](_0x5d4abd[_0xeba4('0x1c')],function(_0x27072a){return{'model':db[_0x27072a[_0xeba4('0x1e')]],'as':_0x27072a['as'],'attributes':_0x27072a[_0xeba4('0x1a')],'include':_0x27072a[_0xeba4('0x1c')]?_[_0xeba4('0x1d')](_0x27072a[_0xeba4('0x1c')],function(_0x52ad1e){return{'model':db[_0x52ad1e[_0xeba4('0x1e')]],'as':_0x52ad1e['as'],'attributes':_0x52ad1e[_0xeba4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x522657){logger[_0xeba4('0x13')]('GetServicenowAccount',_0x414f4a);logger[_0xeba4('0xe')]('GetServicenowAccount',_0x414f4a,JSON[_0xeba4('0xf')](_0x522657));_0x26185d(_0x522657);})[_0xeba4('0x15')](function(_0x1dcbbc){logger['error'](_0xeba4('0x1f'),_0x1dcbbc['message'],_0x414f4a);_0x3d14cb(_0x5ca377[_0xeba4('0x10')](0x1f4,_0x1dcbbc[_0xeba4('0x12')]));});});};exports[_0xeba4('0x20')]=function(_0x580cbe){var _0x19e010=this;return new Promise(function(_0x3c16c0,_0xfefe88){return db[_0xeba4('0x21')]['find']({'raw':_0x580cbe['options']?_0x580cbe[_0xeba4('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x580cbe[_0xeba4('0x17')]?_0x580cbe[_0xeba4('0x17')][_0xeba4('0x19')]||null:null,'attributes':_0x580cbe['options']?_0x580cbe['options']['attributes']||null:null,'include':_0x580cbe[_0xeba4('0x17')]?_0x580cbe[_0xeba4('0x17')][_0xeba4('0x1c')]?_['map'](_0x580cbe['options'][_0xeba4('0x1c')],function(_0x23a717){return{'model':db[_0x23a717[_0xeba4('0x1e')]],'as':_0x23a717['as'],'attributes':_0x23a717['attributes'],'include':_0x23a717[_0xeba4('0x1c')]?_[_0xeba4('0x1d')](_0x23a717['include'],function(_0x26a83a){return{'model':db[_0x26a83a[_0xeba4('0x1e')]],'as':_0x26a83a['as'],'attributes':_0x26a83a[_0xeba4('0x1a')],'include':_0x26a83a[_0xeba4('0x1c')]?_['map'](_0x26a83a[_0xeba4('0x1c')],function(_0x199b8f){return{'model':db[_0x199b8f[_0xeba4('0x1e')]],'as':_0x199b8f['as'],'attributes':_0x199b8f[_0xeba4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xeba4('0xc')](function(_0x165126){logger[_0xeba4('0x13')](_0xeba4('0x20'),_0x580cbe);logger['debug']('ShowServicenowAccount',_0x580cbe,JSON[_0xeba4('0xf')](_0x165126));_0x3c16c0(_0x165126);})[_0xeba4('0x15')](function(_0x3435fb){logger[_0xeba4('0x10')](_0xeba4('0x20'),_0x3435fb[_0xeba4('0x12')],_0x580cbe);_0xfefe88(_0x19e010['error'](0x1f4,_0x3435fb[_0xeba4('0x12')]));});});}; \ No newline at end of file +var _0x7d69=['message','ServicenowAccount,\x20%s,\x20%s','request\x20sent','GetServicenowAccount','ServicenowAccount','findAll','options','where','limit','include','attributes','map','model','ShowServicenowAccount','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7d69,0xbf));var _0x97d6=function(_0xdba72b,_0x4c2375){_0xdba72b=_0xdba72b-0x0;var _0x591715=_0x7d69[_0xdba72b];return _0x591715;};'use strict';var _=require(_0x97d6('0x0'));var util=require(_0x97d6('0x1'));var moment=require(_0x97d6('0x2'));var BPromise=require(_0x97d6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97d6('0x4'));var db=require(_0x97d6('0x5'))['db'];var utils=require(_0x97d6('0x6'));var logger=require(_0x97d6('0x7'))(_0x97d6('0x8'));var config=require(_0x97d6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x97d6('0xa')][_0x97d6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d2a7c,_0x5e0e02,_0x24eaff){return new BPromise(function(_0x18f514,_0x553cd6){return client[_0x97d6('0xc')](_0x1d2a7c,_0x24eaff)[_0x97d6('0xd')](function(_0x2f8351){logger[_0x97d6('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x5e0e02,'request\x20sent');logger[_0x97d6('0xf')](_0x97d6('0x10'),_0x5e0e02,'request\x20sent',JSON[_0x97d6('0x11')](_0x2f8351));if(_0x2f8351[_0x97d6('0x12')]){if(_0x2f8351[_0x97d6('0x12')]['code']===0x1f4){logger[_0x97d6('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x5e0e02,_0x2f8351[_0x97d6('0x12')][_0x97d6('0x13')]);return _0x553cd6(_0x2f8351[_0x97d6('0x12')][_0x97d6('0x13')]);}logger[_0x97d6('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x5e0e02,_0x2f8351[_0x97d6('0x12')][_0x97d6('0x13')]);return _0x18f514(_0x2f8351['error'][_0x97d6('0x13')]);}else{logger[_0x97d6('0xe')](_0x97d6('0x14'),_0x5e0e02,_0x97d6('0x15'));_0x18f514(_0x2f8351['result']['message']);}})['catch'](function(_0x2505a5){logger[_0x97d6('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x5e0e02,_0x2505a5);_0x553cd6(_0x2505a5);});});}exports[_0x97d6('0x16')]=function(_0x127634){var _0x7735d1=this;return new Promise(function(_0x9bb50d,_0x1636d0){return db[_0x97d6('0x17')][_0x97d6('0x18')]({'raw':_0x127634[_0x97d6('0x19')]?_0x127634[_0x97d6('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x127634[_0x97d6('0x19')]?_0x127634['options'][_0x97d6('0x1a')]||null:null,'attributes':_0x127634['options']?_0x127634[_0x97d6('0x19')]['attributes']||null:null,'limit':_0x127634[_0x97d6('0x19')]?_0x127634[_0x97d6('0x19')][_0x97d6('0x1b')]||null:null,'include':_0x127634[_0x97d6('0x19')]?_0x127634['options'][_0x97d6('0x1c')]?_['map'](_0x127634[_0x97d6('0x19')]['include'],function(_0x16c64d){return{'model':db[_0x16c64d['model']],'as':_0x16c64d['as'],'attributes':_0x16c64d[_0x97d6('0x1d')],'include':_0x16c64d[_0x97d6('0x1c')]?_[_0x97d6('0x1e')](_0x16c64d[_0x97d6('0x1c')],function(_0x39cb27){return{'model':db[_0x39cb27['model']],'as':_0x39cb27['as'],'attributes':_0x39cb27[_0x97d6('0x1d')],'include':_0x39cb27['include']?_['map'](_0x39cb27[_0x97d6('0x1c')],function(_0x2a43ad){return{'model':db[_0x2a43ad[_0x97d6('0x1f')]],'as':_0x2a43ad['as'],'attributes':_0x2a43ad[_0x97d6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x97d6('0xd')](function(_0x13ac31){logger[_0x97d6('0xe')](_0x97d6('0x16'),_0x127634);logger['debug']('GetServicenowAccount',_0x127634,JSON[_0x97d6('0x11')](_0x13ac31));_0x9bb50d(_0x13ac31);})['catch'](function(_0x5dbaa1){logger[_0x97d6('0x12')]('GetServicenowAccount',_0x5dbaa1[_0x97d6('0x13')],_0x127634);_0x1636d0(_0x7735d1[_0x97d6('0x12')](0x1f4,_0x5dbaa1[_0x97d6('0x13')]));});});};exports[_0x97d6('0x20')]=function(_0x5b3bae){var _0x4a0e40=this;return new Promise(function(_0x21396e,_0x59352c){return db[_0x97d6('0x17')][_0x97d6('0x21')]({'raw':_0x5b3bae[_0x97d6('0x19')]?_0x5b3bae[_0x97d6('0x19')][_0x97d6('0x22')]===undefined?!![]:![]:!![],'where':_0x5b3bae[_0x97d6('0x19')]?_0x5b3bae[_0x97d6('0x19')][_0x97d6('0x1a')]||null:null,'attributes':_0x5b3bae['options']?_0x5b3bae[_0x97d6('0x19')][_0x97d6('0x1d')]||null:null,'include':_0x5b3bae[_0x97d6('0x19')]?_0x5b3bae[_0x97d6('0x19')]['include']?_[_0x97d6('0x1e')](_0x5b3bae[_0x97d6('0x19')][_0x97d6('0x1c')],function(_0x191311){return{'model':db[_0x191311[_0x97d6('0x1f')]],'as':_0x191311['as'],'attributes':_0x191311[_0x97d6('0x1d')],'include':_0x191311[_0x97d6('0x1c')]?_[_0x97d6('0x1e')](_0x191311[_0x97d6('0x1c')],function(_0xe47748){return{'model':db[_0xe47748[_0x97d6('0x1f')]],'as':_0xe47748['as'],'attributes':_0xe47748['attributes'],'include':_0xe47748[_0x97d6('0x1c')]?_[_0x97d6('0x1e')](_0xe47748['include'],function(_0x4c1f65){return{'model':db[_0x4c1f65[_0x97d6('0x1f')]],'as':_0x4c1f65['as'],'attributes':_0x4c1f65[_0x97d6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x97d6('0xd')](function(_0x29d891){logger[_0x97d6('0xe')](_0x97d6('0x20'),_0x5b3bae);logger[_0x97d6('0xf')](_0x97d6('0x20'),_0x5b3bae,JSON[_0x97d6('0x11')](_0x29d891));_0x21396e(_0x29d891);})['catch'](function(_0x38b0e0){logger['error'](_0x97d6('0x20'),_0x38b0e0[_0x97d6('0x13')],_0x5b3bae);_0x59352c(_0x4a0e40[_0x97d6('0x12')](0x1f4,_0x38b0e0[_0x97d6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 069ae44..841733b 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 _0xf86a=['express','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','util','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf86a,0x1c6));var _0xaf86=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf86a[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0xaf86('0x0'));var path=require(_0xaf86('0x1'));var timeout=require('connect-timeout');var express=require(_0xaf86('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xaf86('0x3'));router[_0xaf86('0x4')]('/',auth[_0xaf86('0x5')](),controller['index']);router['get'](_0xaf86('0x6'),auth[_0xaf86('0x5')](),controller[_0xaf86('0x7')]);router['get'](_0xaf86('0x8'),auth[_0xaf86('0x5')](),controller[_0xaf86('0x9')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xaf86('0xa')]);router['get'](_0xaf86('0xb'),auth[_0xaf86('0x5')](),controller[_0xaf86('0xc')]);router[_0xaf86('0xd')]('/',auth[_0xaf86('0x5')](),controller[_0xaf86('0xe')]);router[_0xaf86('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xaf86('0x10')](_0xaf86('0x6'),auth[_0xaf86('0x5')](),controller[_0xaf86('0x11')]);module[_0xaf86('0x12')]=router; \ No newline at end of file +var _0x8a90=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','get','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','path','connect-timeout'];(function(_0x5366cc,_0x59d1c8){var _0x78e4fb=function(_0x3be1fd){while(--_0x3be1fd){_0x5366cc['push'](_0x5366cc['shift']());}};_0x78e4fb(++_0x59d1c8);}(_0x8a90,0x19c));var _0x08a9=function(_0x245a93,_0x258504){_0x245a93=_0x245a93-0x0;var _0x38bf51=_0x8a90[_0x245a93];return _0x38bf51;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x08a9('0x0'));var timeout=require(_0x08a9('0x1'));var express=require(_0x08a9('0x2'));var router=express[_0x08a9('0x3')]();var auth=require(_0x08a9('0x4'));var interaction=require(_0x08a9('0x5'));var config=require(_0x08a9('0x6'));var controller=require(_0x08a9('0x7'));router['get']('/',auth[_0x08a9('0x8')](),controller['index']);router[_0x08a9('0x9')](_0x08a9('0xa'),auth['isAuthenticated'](),controller[_0x08a9('0xb')]);router['get']('/:id/fields',auth[_0x08a9('0x8')](),controller[_0x08a9('0xc')]);router[_0x08a9('0x9')](_0x08a9('0xd'),auth[_0x08a9('0x8')](),controller[_0x08a9('0xe')]);router[_0x08a9('0x9')](_0x08a9('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x08a9('0x10')]('/',auth[_0x08a9('0x8')](),controller[_0x08a9('0x11')]);router[_0x08a9('0x12')](_0x08a9('0xa'),auth[_0x08a9('0x8')](),controller[_0x08a9('0x13')]);router[_0x08a9('0x14')](_0x08a9('0xa'),auth['isAuthenticated'](),controller[_0x08a9('0x15')]);module[_0x08a9('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 acd0f87..3c449e7 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 _0x2cc1=['STRING','sequelize'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x2cc1,0x16f));var _0x12cc=function(_0x1344cc,_0x19667f){_0x1344cc=_0x1344cc-0x0;var _0x4b7296=_0x2cc1[_0x1344cc];return _0x4b7296;};'use strict';var Sequelize=require(_0x12cc('0x0'));module['exports']={'name':{'type':Sequelize[_0x12cc('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9eaa=['STRING','sequelize','exports'];(function(_0x16b47d,_0x25a1d2){var _0x367793=function(_0x46dc71){while(--_0x46dc71){_0x16b47d['push'](_0x16b47d['shift']());}};_0x367793(++_0x25a1d2);}(_0x9eaa,0x1a5));var _0xa9ea=function(_0x50de39,_0x5ddf97){_0x50de39=_0x50de39-0x0;var _0x1d7cef=_0x9eaa[_0x50de39];return _0x1d7cef;};'use strict';var Sequelize=require(_0xa9ea('0x0'));module[_0xa9ea('0x1')]={'name':{'type':Sequelize[_0xa9ea('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 36be60b..1798c97 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 _0x543b=['name','send','index','map','ServicenowConfiguration','fieldName','type','model','query','keys','attributes','intersection','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','show','params','filtears','fields','find','create','body','getFields','ServicenowField','rawAttributes','hasOwnProperty','getSubjects','findOne','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','sendStatus','status','offset','set','Content-Range','json','save','destroy','end'];(function(_0x306fe9,_0xeeaac0){var _0x3a9b8d=function(_0x221e6b){while(--_0x221e6b){_0x306fe9['push'](_0x306fe9['shift']());}};_0x3a9b8d(++_0xeeaac0);}(_0x543b,0x18d));var _0xb543=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x543b[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xb543('0x0'));var emlformat=require(_0xb543('0x1'));var rimraf=require(_0xb543('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb543('0x3'));var rp=require(_0xb543('0x4'));var moment=require(_0xb543('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb543('0x6'));var util=require(_0xb543('0x7'));var path=require(_0xb543('0x8'));var sox=require(_0xb543('0x9'));var csv=require(_0xb543('0xa'));var ejs=require(_0xb543('0xb'));var fs=require('fs');var _=require(_0xb543('0xc'));var squel=require(_0xb543('0xd'));var crypto=require(_0xb543('0xe'));var jsforce=require(_0xb543('0xf'));var deskjs=require(_0xb543('0x10'));var toCsv=require(_0xb543('0xa'));var querystring=require('querystring');var Papa=require(_0xb543('0x11'));var Redis=require('ioredis');var authService=require(_0xb543('0x12'));var qs=require(_0xb543('0x13'));var as=require(_0xb543('0x14'));var hardwareService=require(_0xb543('0x15'));var logger=require(_0xb543('0x16'))(_0xb543('0x17'));var utils=require('../../config/utils');var config=require(_0xb543('0x18'));var licenseUtil=require(_0xb543('0x19'));var db=require(_0xb543('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb543('0x1b')][_0xb543('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x11e73f,_0x5935cc,_0x5348ca,_0x175499){return new BPromise(function(_0x3f6875,_0x2151d4){var _0x1a3516=_0x175499||client;return _0x1a3516['request'](_0x11e73f,_0x5348ca)[_0xb543('0x1d')](function(_0x399b28){logger[_0xb543('0x1e')](_0xb543('0x1f'),_0x5935cc,'request\x20sent');logger[_0xb543('0x20')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x5935cc,_0xb543('0x21'),JSON[_0xb543('0x22')](_0x399b28));if(_0x399b28[_0xb543('0x23')]){if(_0x399b28[_0xb543('0x23')]['code']===0x1f4){logger[_0xb543('0x23')](_0xb543('0x1f'),_0x5935cc,_0x399b28[_0xb543('0x23')]['message']);return _0x2151d4(_0x399b28['error'][_0xb543('0x24')]);}logger[_0xb543('0x23')](_0xb543('0x1f'),_0x5935cc,_0x399b28[_0xb543('0x23')][_0xb543('0x24')]);return _0x3f6875(_0x399b28[_0xb543('0x23')][_0xb543('0x24')]);}else{logger[_0xb543('0x1e')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5935cc,_0xb543('0x21'));_0x3f6875(_0x399b28[_0xb543('0x25')][_0xb543('0x24')]);}})[_0xb543('0x26')](function(_0x3f7b62){logger[_0xb543('0x23')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5935cc,_0x3f7b62);_0x2151d4(_0x3f7b62);});});}function respondWithStatusCode(_0x5e763c,_0x5d4ac2){_0x5d4ac2=_0x5d4ac2||0xcc;return function(_0x4b932e){if(_0x4b932e){return _0x5e763c[_0xb543('0x27')](_0x5d4ac2);}return _0x5e763c[_0xb543('0x28')](_0x5d4ac2)['end']();};}function respondWithResult(_0x5285f4,_0x426969){_0x426969=_0x426969||0xc8;return function(_0x3464b8){if(_0x3464b8){return _0x5285f4[_0xb543('0x28')](_0x426969)['json'](_0x3464b8);}};}function respondWithFilteredResult(_0x11a806,_0x5312f7){return function(_0x2ee119){if(_0x2ee119){var _0xf9b0b6=_0x2ee119['count'],_0x2593f5=_0x5312f7[_0xb543('0x29')],_0x2eca71=_0x5312f7['offset']+_0x5312f7['limit'],_0x27f68f;if(_0x2eca71>=_0xf9b0b6){_0x2eca71=_0xf9b0b6;_0x27f68f=0xc8;}else{_0x27f68f=0xce;}_0x11a806[_0xb543('0x28')](_0x27f68f);return _0x11a806[_0xb543('0x2a')](_0xb543('0x2b'),_0x2593f5+'-'+_0x2eca71+'/'+_0xf9b0b6)[_0xb543('0x2c')](_0x2ee119);}return null;};}function patchUpdates(_0x1d1d2c){return function(_0x23cfb0){try{jsonpatch['apply'](_0x23cfb0,_0x1d1d2c,!![]);}catch(_0x3703ec){return BPromise['reject'](_0x3703ec);}return _0x23cfb0[_0xb543('0x2d')]();};}function saveUpdates(_0xf47fe4,_0x2830a8){return function(_0x44f62c){if(_0x44f62c){return _0x44f62c['update'](_0xf47fe4)[_0xb543('0x1d')](function(_0x52b242){return _0x52b242;});}return null;};}function removeEntity(_0x237432,_0x4495e3){return function(_0x9dc86f){if(_0x9dc86f){return _0x9dc86f[_0xb543('0x2e')]()['then'](function(){_0x237432[_0xb543('0x28')](0xcc)[_0xb543('0x2f')]();});}};}function handleEntityNotFound(_0x4289c6,_0x2e54fe){return function(_0x361e09){if(!_0x361e09){_0x4289c6[_0xb543('0x27')](0x194);}return _0x361e09;};}function handleError(_0x53f2e5,_0x8e5a33){_0x8e5a33=_0x8e5a33||0x1f4;return function(_0xd73d54){logger[_0xb543('0x23')](_0xd73d54['stack']);if(_0xd73d54['name']){delete _0xd73d54[_0xb543('0x30')];}_0x53f2e5[_0xb543('0x28')](_0x8e5a33)[_0xb543('0x31')](_0xd73d54);};}exports[_0xb543('0x32')]=function(_0xd57849,_0x26787f){var _0x180205={},_0x452453={},_0x34375d={'count':0x0,'rows':[]};var _0x5c4ad0=_[_0xb543('0x33')](db[_0xb543('0x34')]['rawAttributes'],function(_0x2fb62e){return{'name':_0x2fb62e[_0xb543('0x35')],'type':_0x2fb62e[_0xb543('0x36')]['key']};});_0x452453[_0xb543('0x37')]=_[_0xb543('0x33')](_0x5c4ad0,'name');_0x452453[_0xb543('0x38')]=_[_0xb543('0x39')](_0xd57849[_0xb543('0x38')]);_0x452453['filters']=_['intersection'](_0x452453[_0xb543('0x37')],_0x452453[_0xb543('0x38')]);_0x180205[_0xb543('0x3a')]=_[_0xb543('0x3b')](_0x452453['model'],qs['fields'](_0xd57849['query']['fields']));_0x180205[_0xb543('0x3a')]=_0x180205[_0xb543('0x3a')][_0xb543('0x3c')]?_0x180205[_0xb543('0x3a')]:_0x452453[_0xb543('0x37')];if(!_0xd57849[_0xb543('0x38')]['hasOwnProperty'](_0xb543('0x3d'))){_0x180205[_0xb543('0x3e')]=qs[_0xb543('0x3e')](_0xd57849[_0xb543('0x38')]['limit']);_0x180205[_0xb543('0x29')]=qs[_0xb543('0x29')](_0xd57849[_0xb543('0x38')][_0xb543('0x29')]);}_0x180205[_0xb543('0x3f')]=qs[_0xb543('0x40')](_0xd57849[_0xb543('0x38')][_0xb543('0x40')]);_0x180205[_0xb543('0x41')]=qs[_0xb543('0x42')](_[_0xb543('0x43')](_0xd57849[_0xb543('0x38')],_0x452453[_0xb543('0x42')]),_0x5c4ad0);if(_0xd57849['query'][_0xb543('0x44')]){_0x180205[_0xb543('0x41')]=_[_0xb543('0x45')](_0x180205[_0xb543('0x41')],{'$or':_[_0xb543('0x33')](_0x5c4ad0,function(_0x20bf65){if(_0x20bf65['type']!==_0xb543('0x46')){var _0x182035={};_0x182035[_0x20bf65[_0xb543('0x30')]]={'$like':'%'+_0xd57849[_0xb543('0x38')]['filter']+'%'};return _0x182035;}})});}_0x180205=_['merge']({},_0x180205,_0xd57849[_0xb543('0x47')]);var _0x13706e={'where':_0x180205[_0xb543('0x41')]};return db[_0xb543('0x34')]['count'](_0x13706e)[_0xb543('0x1d')](function(_0x23e298){_0x34375d[_0xb543('0x48')]=_0x23e298;if(_0xd57849[_0xb543('0x38')][_0xb543('0x49')]){_0x180205[_0xb543('0x4a')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x180205);})[_0xb543('0x1d')](function(_0x155374){_0x34375d['rows']=_0x155374;return _0x34375d;})['then'](respondWithFilteredResult(_0x26787f,_0x180205))[_0xb543('0x26')](handleError(_0x26787f,null));};exports[_0xb543('0x4b')]=function(_0x493516,_0x2536a6){var _0x3bd933={'raw':![],'where':{'id':_0x493516[_0xb543('0x4c')]['id']}},_0x214004={};_0x214004['model']=_[_0xb543('0x39')](db[_0xb543('0x34')]['rawAttributes']);_0x214004[_0xb543('0x38')]=_['keys'](_0x493516['query']);_0x214004[_0xb543('0x4d')]=_['intersection'](_0x214004[_0xb543('0x37')],_0x214004[_0xb543('0x38')]);_0x3bd933[_0xb543('0x3a')]=_[_0xb543('0x3b')](_0x214004['model'],qs[_0xb543('0x4e')](_0x493516[_0xb543('0x38')][_0xb543('0x4e')]));_0x3bd933[_0xb543('0x3a')]=_0x3bd933[_0xb543('0x3a')][_0xb543('0x3c')]?_0x3bd933[_0xb543('0x3a')]:_0x214004[_0xb543('0x37')];if(_0x493516[_0xb543('0x38')][_0xb543('0x49')]){_0x3bd933['include']=[{'all':!![]}];}_0x3bd933=_[_0xb543('0x45')]({},_0x3bd933,_0x493516[_0xb543('0x47')]);return db[_0xb543('0x34')][_0xb543('0x4f')](_0x3bd933)[_0xb543('0x1d')](handleEntityNotFound(_0x2536a6,null))[_0xb543('0x1d')](respondWithResult(_0x2536a6,null))[_0xb543('0x26')](handleError(_0x2536a6,null));};exports[_0xb543('0x50')]=function(_0x568d0f,_0x5abdc0){return db[_0xb543('0x34')][_0xb543('0x50')](_0x568d0f[_0xb543('0x51')],{})[_0xb543('0x1d')](respondWithResult(_0x5abdc0,0xc9))[_0xb543('0x26')](handleError(_0x5abdc0,null));};exports['update']=function(_0x5cf363,_0x344eb3){if(_0x5cf363[_0xb543('0x51')]['id']){delete _0x5cf363[_0xb543('0x51')]['id'];}return db[_0xb543('0x34')][_0xb543('0x4f')]({'where':{'id':_0x5cf363[_0xb543('0x4c')]['id']}})[_0xb543('0x1d')](handleEntityNotFound(_0x344eb3,null))[_0xb543('0x1d')](saveUpdates(_0x5cf363[_0xb543('0x51')],null))[_0xb543('0x1d')](respondWithResult(_0x344eb3,null))[_0xb543('0x26')](handleError(_0x344eb3,null));};exports[_0xb543('0x2e')]=function(_0x320e47,_0x874268){return db[_0xb543('0x34')][_0xb543('0x4f')]({'where':{'id':_0x320e47[_0xb543('0x4c')]['id']}})['then'](handleEntityNotFound(_0x874268,null))[_0xb543('0x1d')](removeEntity(_0x874268,null))[_0xb543('0x26')](handleError(_0x874268,null));};exports[_0xb543('0x52')]=function(_0x92eeca,_0x1f3a51,_0x3f785a){var _0x24e1e6={};var _0x51e0ed={};var _0x2beb21;var _0x417714;return db[_0xb543('0x34')]['findOne']({'where':{'id':_0x92eeca[_0xb543('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1f3a51,null))[_0xb543('0x1d')](function(_0x358234){if(_0x358234){_0x2beb21=_0x358234;_0x51e0ed['model']=_[_0xb543('0x39')](db[_0xb543('0x53')][_0xb543('0x54')]);_0x51e0ed['query']=_['keys'](_0x92eeca[_0xb543('0x38')]);_0x51e0ed[_0xb543('0x42')]=_['intersection'](_0x51e0ed['model'],_0x51e0ed[_0xb543('0x38')]);_0x24e1e6[_0xb543('0x3a')]=_[_0xb543('0x3b')](_0x51e0ed['model'],qs[_0xb543('0x4e')](_0x92eeca[_0xb543('0x38')]['fields']));_0x24e1e6[_0xb543('0x3a')]=_0x24e1e6[_0xb543('0x3a')][_0xb543('0x3c')]?_0x24e1e6['attributes']:_0x51e0ed[_0xb543('0x37')];_0x24e1e6[_0xb543('0x3f')]=qs[_0xb543('0x40')](_0x92eeca['query'][_0xb543('0x40')]);_0x24e1e6[_0xb543('0x41')]=qs[_0xb543('0x42')](_['pick'](_0x92eeca['query'],_0x51e0ed[_0xb543('0x42')]));if(_0x92eeca[_0xb543('0x38')][_0xb543('0x44')]){_0x24e1e6[_0xb543('0x41')]=_[_0xb543('0x45')](_0x24e1e6['where'],{'$or':_[_0xb543('0x33')](_0x24e1e6[_0xb543('0x3a')],function(_0x4f41b9){var _0x37b2cc={};_0x37b2cc[_0x4f41b9]={'$like':'%'+_0x92eeca[_0xb543('0x38')][_0xb543('0x44')]+'%'};return _0x37b2cc;})});}_0x24e1e6=_[_0xb543('0x45')]({},_0x24e1e6,_0x92eeca['options']);return _0x2beb21['getFields'](_0x24e1e6);}})[_0xb543('0x1d')](function(_0x56560d){if(_0x56560d){_0x417714=_0x56560d[_0xb543('0x3c')];if(!_0x92eeca[_0xb543('0x38')][_0xb543('0x55')](_0xb543('0x3d'))){_0x24e1e6['limit']=qs['limit'](_0x92eeca[_0xb543('0x38')]['limit']);_0x24e1e6[_0xb543('0x29')]=qs[_0xb543('0x29')](_0x92eeca[_0xb543('0x38')][_0xb543('0x29')]);}return _0x2beb21[_0xb543('0x52')](_0x24e1e6);}})['then'](function(_0x162f2e){if(_0x162f2e){return _0x162f2e?{'count':_0x417714,'rows':_0x162f2e}:null;}})[_0xb543('0x1d')](respondWithResult(_0x1f3a51,null))[_0xb543('0x26')](handleError(_0x1f3a51,null));};exports[_0xb543('0x56')]=function(_0x556d62,_0x216c60,_0x5f0c5b){var _0x80a470={};var _0x42bbd0={};var _0x357d3e;var _0x223229;return db['ServicenowConfiguration'][_0xb543('0x57')]({'where':{'id':_0x556d62[_0xb543('0x4c')]['id']}})['then'](handleEntityNotFound(_0x216c60,null))[_0xb543('0x1d')](function(_0x5d87e4){if(_0x5d87e4){_0x357d3e=_0x5d87e4;_0x42bbd0['model']=_[_0xb543('0x39')](db[_0xb543('0x53')][_0xb543('0x54')]);_0x42bbd0['query']=_[_0xb543('0x39')](_0x556d62[_0xb543('0x38')]);_0x42bbd0['filters']=_[_0xb543('0x3b')](_0x42bbd0[_0xb543('0x37')],_0x42bbd0[_0xb543('0x38')]);_0x80a470[_0xb543('0x3a')]=_[_0xb543('0x3b')](_0x42bbd0[_0xb543('0x37')],qs[_0xb543('0x4e')](_0x556d62[_0xb543('0x38')]['fields']));_0x80a470['attributes']=_0x80a470[_0xb543('0x3a')][_0xb543('0x3c')]?_0x80a470['attributes']:_0x42bbd0[_0xb543('0x37')];_0x80a470['order']=qs['sort'](_0x556d62[_0xb543('0x38')][_0xb543('0x40')]);_0x80a470[_0xb543('0x41')]=qs[_0xb543('0x42')](_['pick'](_0x556d62[_0xb543('0x38')],_0x42bbd0[_0xb543('0x42')]));if(_0x556d62[_0xb543('0x38')][_0xb543('0x44')]){_0x80a470['where']=_[_0xb543('0x45')](_0x80a470[_0xb543('0x41')],{'$or':_[_0xb543('0x33')](_0x80a470[_0xb543('0x3a')],function(_0x5f1e4b){var _0x43ef88={};_0x43ef88[_0x5f1e4b]={'$like':'%'+_0x556d62[_0xb543('0x38')]['filter']+'%'};return _0x43ef88;})});}_0x80a470=_[_0xb543('0x45')]({},_0x80a470,_0x556d62[_0xb543('0x47')]);return _0x357d3e[_0xb543('0x56')](_0x80a470);}})['then'](function(_0x15cbf8){if(_0x15cbf8){_0x223229=_0x15cbf8[_0xb543('0x3c')];if(!_0x556d62['query']['hasOwnProperty'](_0xb543('0x3d'))){_0x80a470[_0xb543('0x3e')]=qs[_0xb543('0x3e')](_0x556d62[_0xb543('0x38')][_0xb543('0x3e')]);_0x80a470[_0xb543('0x29')]=qs['offset'](_0x556d62[_0xb543('0x38')][_0xb543('0x29')]);}return _0x357d3e[_0xb543('0x56')](_0x80a470);}})[_0xb543('0x1d')](function(_0x164514){if(_0x164514){return _0x164514?{'count':_0x223229,'rows':_0x164514}:null;}})['then'](respondWithResult(_0x216c60,null))['catch'](handleError(_0x216c60,null));};exports['getDescriptions']=function(_0x3ccc49,_0x51d51b,_0x519371){var _0x5030f2={};var _0x43e12e={};var _0x16b61b;var _0x537d79;return db[_0xb543('0x34')]['findOne']({'where':{'id':_0x3ccc49['params']['id']}})['then'](handleEntityNotFound(_0x51d51b,null))['then'](function(_0x3ab75b){if(_0x3ab75b){_0x16b61b=_0x3ab75b;_0x43e12e[_0xb543('0x37')]=_['keys'](db[_0xb543('0x53')][_0xb543('0x54')]);_0x43e12e['query']=_[_0xb543('0x39')](_0x3ccc49['query']);_0x43e12e[_0xb543('0x42')]=_[_0xb543('0x3b')](_0x43e12e[_0xb543('0x37')],_0x43e12e[_0xb543('0x38')]);_0x5030f2[_0xb543('0x3a')]=_[_0xb543('0x3b')](_0x43e12e[_0xb543('0x37')],qs[_0xb543('0x4e')](_0x3ccc49[_0xb543('0x38')][_0xb543('0x4e')]));_0x5030f2['attributes']=_0x5030f2['attributes'][_0xb543('0x3c')]?_0x5030f2[_0xb543('0x3a')]:_0x43e12e['model'];_0x5030f2[_0xb543('0x3f')]=qs[_0xb543('0x40')](_0x3ccc49[_0xb543('0x38')]['sort']);_0x5030f2[_0xb543('0x41')]=qs['filters'](_[_0xb543('0x43')](_0x3ccc49[_0xb543('0x38')],_0x43e12e['filters']));if(_0x3ccc49[_0xb543('0x38')][_0xb543('0x44')]){_0x5030f2[_0xb543('0x41')]=_['merge'](_0x5030f2['where'],{'$or':_['map'](_0x5030f2[_0xb543('0x3a')],function(_0x4ee933){var _0x30a423={};_0x30a423[_0x4ee933]={'$like':'%'+_0x3ccc49[_0xb543('0x38')]['filter']+'%'};return _0x30a423;})});}_0x5030f2=_['merge']({},_0x5030f2,_0x3ccc49[_0xb543('0x47')]);return _0x16b61b['getDescriptions'](_0x5030f2);}})[_0xb543('0x1d')](function(_0x6064f5){if(_0x6064f5){_0x537d79=_0x6064f5[_0xb543('0x3c')];if(!_0x3ccc49[_0xb543('0x38')][_0xb543('0x55')]('nolimit')){_0x5030f2[_0xb543('0x3e')]=qs[_0xb543('0x3e')](_0x3ccc49['query'][_0xb543('0x3e')]);_0x5030f2[_0xb543('0x29')]=qs[_0xb543('0x29')](_0x3ccc49[_0xb543('0x38')][_0xb543('0x29')]);}return _0x16b61b[_0xb543('0x58')](_0x5030f2);}})[_0xb543('0x1d')](function(_0xecc699){if(_0xecc699){return _0xecc699?{'count':_0x537d79,'rows':_0xecc699}:null;}})[_0xb543('0x1d')](respondWithResult(_0x51d51b,null))['catch'](handleError(_0x51d51b,null));}; \ No newline at end of file +var _0xa5c1=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','merge','options','include','findAll','rows','show','params','includeAll','find','create','body','getFields','findOne','pick','filter','nolimit','getSubjects','ServicenowField','getDescriptions','hasOwnProperty','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','ServicenowConfiguration,\x20%s,\x20%s','debug'];(function(_0x4ff586,_0x41ebc7){var _0x25bbf9=function(_0x4bc73f){while(--_0x4bc73f){_0x4ff586['push'](_0x4ff586['shift']());}};_0x25bbf9(++_0x41ebc7);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x231397,_0x45ad7c){_0x231397=_0x231397-0x0;var _0x586b4b=_0xa5c1[_0x231397];return _0x586b4b;};'use strict';var pdf=require(_0x1a5c('0x0'));var emlformat=require(_0x1a5c('0x1'));var rimraf=require(_0x1a5c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1a5c('0x3'));var moment=require('moment');var BPromise=require(_0x1a5c('0x4'));var Mustache=require(_0x1a5c('0x5'));var util=require(_0x1a5c('0x6'));var path=require(_0x1a5c('0x7'));var sox=require(_0x1a5c('0x8'));var csv=require(_0x1a5c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1a5c('0xa'));var squel=require('squel');var crypto=require(_0x1a5c('0xb'));var jsforce=require(_0x1a5c('0xc'));var deskjs=require(_0x1a5c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1a5c('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a5c('0xf'));var authService=require(_0x1a5c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1a5c('0x11'));var hardwareService=require(_0x1a5c('0x12'));var logger=require('../../config/logger')(_0x1a5c('0x13'));var utils=require(_0x1a5c('0x14'));var config=require(_0x1a5c('0x15'));var licenseUtil=require(_0x1a5c('0x16'));var db=require(_0x1a5c('0x17'))['db'];var jayson=require(_0x1a5c('0x18'));var client=jayson[_0x1a5c('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fa5ae,_0x3ff425,_0x4b240a,_0x157ebb){return new BPromise(function(_0x207899,_0x5cfdb9){var _0x1588cd=_0x157ebb||client;return _0x1588cd[_0x1a5c('0x1a')](_0x2fa5ae,_0x4b240a)[_0x1a5c('0x1b')](function(_0x170112){logger['info'](_0x1a5c('0x1c'),_0x3ff425,'request\x20sent');logger[_0x1a5c('0x1d')](_0x1a5c('0x1e'),_0x3ff425,_0x1a5c('0x1f'),JSON['stringify'](_0x170112));if(_0x170112['error']){if(_0x170112[_0x1a5c('0x20')][_0x1a5c('0x21')]===0x1f4){logger[_0x1a5c('0x20')](_0x1a5c('0x1c'),_0x3ff425,_0x170112[_0x1a5c('0x20')]['message']);return _0x5cfdb9(_0x170112[_0x1a5c('0x20')]['message']);}logger[_0x1a5c('0x20')](_0x1a5c('0x1c'),_0x3ff425,_0x170112[_0x1a5c('0x20')]['message']);return _0x207899(_0x170112[_0x1a5c('0x20')][_0x1a5c('0x22')]);}else{logger[_0x1a5c('0x23')](_0x1a5c('0x1c'),_0x3ff425,_0x1a5c('0x1f'));_0x207899(_0x170112['result'][_0x1a5c('0x22')]);}})[_0x1a5c('0x24')](function(_0x8e81fa){logger[_0x1a5c('0x20')](_0x1a5c('0x1c'),_0x3ff425,_0x8e81fa);_0x5cfdb9(_0x8e81fa);});});}function respondWithStatusCode(_0x2a2f54,_0x1991f6){_0x1991f6=_0x1991f6||0xcc;return function(_0x414482){if(_0x414482){return _0x2a2f54[_0x1a5c('0x25')](_0x1991f6);}return _0x2a2f54[_0x1a5c('0x26')](_0x1991f6)[_0x1a5c('0x27')]();};}function respondWithResult(_0x323272,_0x4c6520){_0x4c6520=_0x4c6520||0xc8;return function(_0x15e334){if(_0x15e334){return _0x323272['status'](_0x4c6520)[_0x1a5c('0x28')](_0x15e334);}};}function respondWithFilteredResult(_0x5c60a4,_0xf96e74){return function(_0x4323f8){if(_0x4323f8){var _0x12784b=_0x4323f8[_0x1a5c('0x29')],_0x1ba1cf=_0xf96e74[_0x1a5c('0x2a')],_0xcd3e0a=_0xf96e74[_0x1a5c('0x2a')]+_0xf96e74[_0x1a5c('0x2b')],_0x1e5e87;if(_0xcd3e0a>=_0x12784b){_0xcd3e0a=_0x12784b;_0x1e5e87=0xc8;}else{_0x1e5e87=0xce;}_0x5c60a4[_0x1a5c('0x26')](_0x1e5e87);return _0x5c60a4['set'](_0x1a5c('0x2c'),_0x1ba1cf+'-'+_0xcd3e0a+'/'+_0x12784b)[_0x1a5c('0x28')](_0x4323f8);}return null;};}function patchUpdates(_0x299406){return function(_0x388f94){try{jsonpatch[_0x1a5c('0x2d')](_0x388f94,_0x299406,!![]);}catch(_0x36335c){return BPromise[_0x1a5c('0x2e')](_0x36335c);}return _0x388f94[_0x1a5c('0x2f')]();};}function saveUpdates(_0xb97acb,_0x523dfb){return function(_0x243c0c){if(_0x243c0c){return _0x243c0c[_0x1a5c('0x30')](_0xb97acb)[_0x1a5c('0x1b')](function(_0x131215){return _0x131215;});}return null;};}function removeEntity(_0x5cce0c,_0x10532b){return function(_0x1de419){if(_0x1de419){return _0x1de419[_0x1a5c('0x31')]()[_0x1a5c('0x1b')](function(){_0x5cce0c[_0x1a5c('0x26')](0xcc)[_0x1a5c('0x27')]();});}};}function handleEntityNotFound(_0x224c87,_0x4aa5c8){return function(_0x1a6dcf){if(!_0x1a6dcf){_0x224c87[_0x1a5c('0x25')](0x194);}return _0x1a6dcf;};}function handleError(_0x4a67a8,_0x2829b0){_0x2829b0=_0x2829b0||0x1f4;return function(_0x1e6854){logger[_0x1a5c('0x20')](_0x1e6854[_0x1a5c('0x32')]);if(_0x1e6854['name']){delete _0x1e6854[_0x1a5c('0x33')];}_0x4a67a8[_0x1a5c('0x26')](_0x2829b0)['send'](_0x1e6854);};}exports[_0x1a5c('0x34')]=function(_0x760252,_0xef9c26){var _0x1dbcbb={},_0x34dea4={},_0x4324e5={'count':0x0,'rows':[]};var _0x38e8cb=_[_0x1a5c('0x35')](db[_0x1a5c('0x36')][_0x1a5c('0x37')],function(_0x515780){return{'name':_0x515780[_0x1a5c('0x38')],'type':_0x515780[_0x1a5c('0x39')]['key']};});_0x34dea4[_0x1a5c('0x3a')]=_[_0x1a5c('0x35')](_0x38e8cb,'name');_0x34dea4['query']=_[_0x1a5c('0x3b')](_0x760252[_0x1a5c('0x3c')]);_0x34dea4[_0x1a5c('0x3d')]=_[_0x1a5c('0x3e')](_0x34dea4['model'],_0x34dea4['query']);_0x1dbcbb[_0x1a5c('0x3f')]=_[_0x1a5c('0x3e')](_0x34dea4[_0x1a5c('0x3a')],qs['fields'](_0x760252[_0x1a5c('0x3c')][_0x1a5c('0x40')]));_0x1dbcbb[_0x1a5c('0x3f')]=_0x1dbcbb[_0x1a5c('0x3f')][_0x1a5c('0x41')]?_0x1dbcbb[_0x1a5c('0x3f')]:_0x34dea4[_0x1a5c('0x3a')];if(!_0x760252[_0x1a5c('0x3c')]['hasOwnProperty']('nolimit')){_0x1dbcbb['limit']=qs[_0x1a5c('0x2b')](_0x760252['query'][_0x1a5c('0x2b')]);_0x1dbcbb[_0x1a5c('0x2a')]=qs[_0x1a5c('0x2a')](_0x760252[_0x1a5c('0x3c')][_0x1a5c('0x2a')]);}_0x1dbcbb[_0x1a5c('0x42')]=qs[_0x1a5c('0x43')](_0x760252['query'][_0x1a5c('0x43')]);_0x1dbcbb[_0x1a5c('0x44')]=qs[_0x1a5c('0x3d')](_['pick'](_0x760252[_0x1a5c('0x3c')],_0x34dea4[_0x1a5c('0x3d')]),_0x38e8cb);if(_0x760252[_0x1a5c('0x3c')]['filter']){_0x1dbcbb[_0x1a5c('0x44')]=_[_0x1a5c('0x45')](_0x1dbcbb['where'],{'$or':_[_0x1a5c('0x35')](_0x38e8cb,function(_0x194663){if(_0x194663['type']!=='VIRTUAL'){var _0x56dceb={};_0x56dceb[_0x194663[_0x1a5c('0x33')]]={'$like':'%'+_0x760252[_0x1a5c('0x3c')]['filter']+'%'};return _0x56dceb;}})});}_0x1dbcbb=_[_0x1a5c('0x45')]({},_0x1dbcbb,_0x760252[_0x1a5c('0x46')]);var _0x435d6a={'where':_0x1dbcbb[_0x1a5c('0x44')]};return db[_0x1a5c('0x36')][_0x1a5c('0x29')](_0x435d6a)[_0x1a5c('0x1b')](function(_0x1134ce){_0x4324e5[_0x1a5c('0x29')]=_0x1134ce;if(_0x760252[_0x1a5c('0x3c')]['includeAll']){_0x1dbcbb[_0x1a5c('0x47')]=[{'all':!![]}];}return db[_0x1a5c('0x36')][_0x1a5c('0x48')](_0x1dbcbb);})[_0x1a5c('0x1b')](function(_0x3244c5){_0x4324e5[_0x1a5c('0x49')]=_0x3244c5;return _0x4324e5;})[_0x1a5c('0x1b')](respondWithFilteredResult(_0xef9c26,_0x1dbcbb))[_0x1a5c('0x24')](handleError(_0xef9c26,null));};exports[_0x1a5c('0x4a')]=function(_0x4dcefb,_0x572a01){var _0x511c19={'raw':![],'where':{'id':_0x4dcefb[_0x1a5c('0x4b')]['id']}},_0x3d17ef={};_0x3d17ef[_0x1a5c('0x3a')]=_['keys'](db[_0x1a5c('0x36')][_0x1a5c('0x37')]);_0x3d17ef[_0x1a5c('0x3c')]=_[_0x1a5c('0x3b')](_0x4dcefb[_0x1a5c('0x3c')]);_0x3d17ef['filtears']=_[_0x1a5c('0x3e')](_0x3d17ef['model'],_0x3d17ef[_0x1a5c('0x3c')]);_0x511c19[_0x1a5c('0x3f')]=_[_0x1a5c('0x3e')](_0x3d17ef[_0x1a5c('0x3a')],qs['fields'](_0x4dcefb[_0x1a5c('0x3c')][_0x1a5c('0x40')]));_0x511c19[_0x1a5c('0x3f')]=_0x511c19[_0x1a5c('0x3f')][_0x1a5c('0x41')]?_0x511c19[_0x1a5c('0x3f')]:_0x3d17ef[_0x1a5c('0x3a')];if(_0x4dcefb['query'][_0x1a5c('0x4c')]){_0x511c19[_0x1a5c('0x47')]=[{'all':!![]}];}_0x511c19=_['merge']({},_0x511c19,_0x4dcefb[_0x1a5c('0x46')]);return db[_0x1a5c('0x36')][_0x1a5c('0x4d')](_0x511c19)[_0x1a5c('0x1b')](handleEntityNotFound(_0x572a01,null))[_0x1a5c('0x1b')](respondWithResult(_0x572a01,null))[_0x1a5c('0x24')](handleError(_0x572a01,null));};exports[_0x1a5c('0x4e')]=function(_0x18f9a8,_0x186dec){return db[_0x1a5c('0x36')][_0x1a5c('0x4e')](_0x18f9a8[_0x1a5c('0x4f')],{})[_0x1a5c('0x1b')](respondWithResult(_0x186dec,0xc9))[_0x1a5c('0x24')](handleError(_0x186dec,null));};exports[_0x1a5c('0x30')]=function(_0x1dc93c,_0x520d91){if(_0x1dc93c[_0x1a5c('0x4f')]['id']){delete _0x1dc93c['body']['id'];}return db[_0x1a5c('0x36')][_0x1a5c('0x4d')]({'where':{'id':_0x1dc93c[_0x1a5c('0x4b')]['id']}})[_0x1a5c('0x1b')](handleEntityNotFound(_0x520d91,null))[_0x1a5c('0x1b')](saveUpdates(_0x1dc93c[_0x1a5c('0x4f')],null))[_0x1a5c('0x1b')](respondWithResult(_0x520d91,null))[_0x1a5c('0x24')](handleError(_0x520d91,null));};exports[_0x1a5c('0x31')]=function(_0x214503,_0x4b9723){return db[_0x1a5c('0x36')][_0x1a5c('0x4d')]({'where':{'id':_0x214503[_0x1a5c('0x4b')]['id']}})[_0x1a5c('0x1b')](handleEntityNotFound(_0x4b9723,null))[_0x1a5c('0x1b')](removeEntity(_0x4b9723,null))[_0x1a5c('0x24')](handleError(_0x4b9723,null));};exports[_0x1a5c('0x50')]=function(_0x32f80b,_0x1a7aee,_0x306e4f){var _0x576c3d={};var _0x180bc2={};var _0x4c7ad3;var _0x4b3814;return db['ServicenowConfiguration'][_0x1a5c('0x51')]({'where':{'id':_0x32f80b[_0x1a5c('0x4b')]['id']}})[_0x1a5c('0x1b')](handleEntityNotFound(_0x1a7aee,null))['then'](function(_0x215ea4){if(_0x215ea4){_0x4c7ad3=_0x215ea4;_0x180bc2[_0x1a5c('0x3a')]=_['keys'](db['ServicenowField'][_0x1a5c('0x37')]);_0x180bc2[_0x1a5c('0x3c')]=_[_0x1a5c('0x3b')](_0x32f80b[_0x1a5c('0x3c')]);_0x180bc2[_0x1a5c('0x3d')]=_[_0x1a5c('0x3e')](_0x180bc2['model'],_0x180bc2['query']);_0x576c3d[_0x1a5c('0x3f')]=_['intersection'](_0x180bc2[_0x1a5c('0x3a')],qs[_0x1a5c('0x40')](_0x32f80b['query'][_0x1a5c('0x40')]));_0x576c3d['attributes']=_0x576c3d[_0x1a5c('0x3f')][_0x1a5c('0x41')]?_0x576c3d['attributes']:_0x180bc2[_0x1a5c('0x3a')];_0x576c3d[_0x1a5c('0x42')]=qs[_0x1a5c('0x43')](_0x32f80b['query']['sort']);_0x576c3d['where']=qs[_0x1a5c('0x3d')](_[_0x1a5c('0x52')](_0x32f80b['query'],_0x180bc2[_0x1a5c('0x3d')]));if(_0x32f80b['query']['filter']){_0x576c3d['where']=_['merge'](_0x576c3d[_0x1a5c('0x44')],{'$or':_[_0x1a5c('0x35')](_0x576c3d[_0x1a5c('0x3f')],function(_0x26e96c){var _0x35ffe5={};_0x35ffe5[_0x26e96c]={'$like':'%'+_0x32f80b[_0x1a5c('0x3c')][_0x1a5c('0x53')]+'%'};return _0x35ffe5;})});}_0x576c3d=_[_0x1a5c('0x45')]({},_0x576c3d,_0x32f80b['options']);return _0x4c7ad3[_0x1a5c('0x50')](_0x576c3d);}})[_0x1a5c('0x1b')](function(_0x3489ae){if(_0x3489ae){_0x4b3814=_0x3489ae[_0x1a5c('0x41')];if(!_0x32f80b[_0x1a5c('0x3c')]['hasOwnProperty'](_0x1a5c('0x54'))){_0x576c3d['limit']=qs['limit'](_0x32f80b[_0x1a5c('0x3c')][_0x1a5c('0x2b')]);_0x576c3d[_0x1a5c('0x2a')]=qs[_0x1a5c('0x2a')](_0x32f80b[_0x1a5c('0x3c')][_0x1a5c('0x2a')]);}return _0x4c7ad3[_0x1a5c('0x50')](_0x576c3d);}})[_0x1a5c('0x1b')](function(_0x16235f){if(_0x16235f){return _0x16235f?{'count':_0x4b3814,'rows':_0x16235f}:null;}})[_0x1a5c('0x1b')](respondWithResult(_0x1a7aee,null))[_0x1a5c('0x24')](handleError(_0x1a7aee,null));};exports[_0x1a5c('0x55')]=function(_0x349089,_0x4a33ee,_0x3e96f9){var _0xea522c={};var _0x29bd89={};var _0x249434;var _0x495fa4;return db[_0x1a5c('0x36')][_0x1a5c('0x51')]({'where':{'id':_0x349089[_0x1a5c('0x4b')]['id']}})[_0x1a5c('0x1b')](handleEntityNotFound(_0x4a33ee,null))[_0x1a5c('0x1b')](function(_0x252c85){if(_0x252c85){_0x249434=_0x252c85;_0x29bd89[_0x1a5c('0x3a')]=_['keys'](db[_0x1a5c('0x56')][_0x1a5c('0x37')]);_0x29bd89['query']=_[_0x1a5c('0x3b')](_0x349089[_0x1a5c('0x3c')]);_0x29bd89['filters']=_[_0x1a5c('0x3e')](_0x29bd89[_0x1a5c('0x3a')],_0x29bd89['query']);_0xea522c[_0x1a5c('0x3f')]=_['intersection'](_0x29bd89[_0x1a5c('0x3a')],qs['fields'](_0x349089[_0x1a5c('0x3c')][_0x1a5c('0x40')]));_0xea522c[_0x1a5c('0x3f')]=_0xea522c[_0x1a5c('0x3f')][_0x1a5c('0x41')]?_0xea522c[_0x1a5c('0x3f')]:_0x29bd89[_0x1a5c('0x3a')];_0xea522c[_0x1a5c('0x42')]=qs[_0x1a5c('0x43')](_0x349089['query'][_0x1a5c('0x43')]);_0xea522c[_0x1a5c('0x44')]=qs[_0x1a5c('0x3d')](_[_0x1a5c('0x52')](_0x349089[_0x1a5c('0x3c')],_0x29bd89[_0x1a5c('0x3d')]));if(_0x349089[_0x1a5c('0x3c')][_0x1a5c('0x53')]){_0xea522c[_0x1a5c('0x44')]=_['merge'](_0xea522c['where'],{'$or':_[_0x1a5c('0x35')](_0xea522c['attributes'],function(_0x2bb9b3){var _0x10e659={};_0x10e659[_0x2bb9b3]={'$like':'%'+_0x349089[_0x1a5c('0x3c')][_0x1a5c('0x53')]+'%'};return _0x10e659;})});}_0xea522c=_['merge']({},_0xea522c,_0x349089[_0x1a5c('0x46')]);return _0x249434[_0x1a5c('0x55')](_0xea522c);}})[_0x1a5c('0x1b')](function(_0x6b5df8){if(_0x6b5df8){_0x495fa4=_0x6b5df8[_0x1a5c('0x41')];if(!_0x349089['query']['hasOwnProperty'](_0x1a5c('0x54'))){_0xea522c[_0x1a5c('0x2b')]=qs[_0x1a5c('0x2b')](_0x349089['query'][_0x1a5c('0x2b')]);_0xea522c['offset']=qs[_0x1a5c('0x2a')](_0x349089[_0x1a5c('0x3c')][_0x1a5c('0x2a')]);}return _0x249434[_0x1a5c('0x55')](_0xea522c);}})[_0x1a5c('0x1b')](function(_0x947c90){if(_0x947c90){return _0x947c90?{'count':_0x495fa4,'rows':_0x947c90}:null;}})[_0x1a5c('0x1b')](respondWithResult(_0x4a33ee,null))[_0x1a5c('0x24')](handleError(_0x4a33ee,null));};exports[_0x1a5c('0x57')]=function(_0x490c84,_0x47652c,_0x10438b){var _0x12aa40={};var _0x16dd12={};var _0x2538bd;var _0x59c51e;return db[_0x1a5c('0x36')][_0x1a5c('0x51')]({'where':{'id':_0x490c84['params']['id']}})[_0x1a5c('0x1b')](handleEntityNotFound(_0x47652c,null))[_0x1a5c('0x1b')](function(_0x128671){if(_0x128671){_0x2538bd=_0x128671;_0x16dd12[_0x1a5c('0x3a')]=_[_0x1a5c('0x3b')](db['ServicenowField'][_0x1a5c('0x37')]);_0x16dd12[_0x1a5c('0x3c')]=_[_0x1a5c('0x3b')](_0x490c84[_0x1a5c('0x3c')]);_0x16dd12[_0x1a5c('0x3d')]=_[_0x1a5c('0x3e')](_0x16dd12[_0x1a5c('0x3a')],_0x16dd12[_0x1a5c('0x3c')]);_0x12aa40[_0x1a5c('0x3f')]=_[_0x1a5c('0x3e')](_0x16dd12[_0x1a5c('0x3a')],qs['fields'](_0x490c84['query'][_0x1a5c('0x40')]));_0x12aa40[_0x1a5c('0x3f')]=_0x12aa40[_0x1a5c('0x3f')][_0x1a5c('0x41')]?_0x12aa40['attributes']:_0x16dd12[_0x1a5c('0x3a')];_0x12aa40[_0x1a5c('0x42')]=qs[_0x1a5c('0x43')](_0x490c84[_0x1a5c('0x3c')][_0x1a5c('0x43')]);_0x12aa40[_0x1a5c('0x44')]=qs['filters'](_['pick'](_0x490c84[_0x1a5c('0x3c')],_0x16dd12[_0x1a5c('0x3d')]));if(_0x490c84[_0x1a5c('0x3c')][_0x1a5c('0x53')]){_0x12aa40[_0x1a5c('0x44')]=_[_0x1a5c('0x45')](_0x12aa40[_0x1a5c('0x44')],{'$or':_[_0x1a5c('0x35')](_0x12aa40['attributes'],function(_0x32cd93){var _0x1116a4={};_0x1116a4[_0x32cd93]={'$like':'%'+_0x490c84['query'][_0x1a5c('0x53')]+'%'};return _0x1116a4;})});}_0x12aa40=_[_0x1a5c('0x45')]({},_0x12aa40,_0x490c84[_0x1a5c('0x46')]);return _0x2538bd[_0x1a5c('0x57')](_0x12aa40);}})[_0x1a5c('0x1b')](function(_0x4c2917){if(_0x4c2917){_0x59c51e=_0x4c2917['length'];if(!_0x490c84[_0x1a5c('0x3c')][_0x1a5c('0x58')]('nolimit')){_0x12aa40[_0x1a5c('0x2b')]=qs[_0x1a5c('0x2b')](_0x490c84[_0x1a5c('0x3c')][_0x1a5c('0x2b')]);_0x12aa40[_0x1a5c('0x2a')]=qs['offset'](_0x490c84[_0x1a5c('0x3c')][_0x1a5c('0x2a')]);}return _0x2538bd[_0x1a5c('0x57')](_0x12aa40);}})[_0x1a5c('0x1b')](function(_0x2d49e1){if(_0x2d49e1){return _0x2d49e1?{'count':_0x59c51e,'rows':_0x2d49e1}:null;}})['then'](respondWithResult(_0x47652c,null))[_0x1a5c('0x24')](handleError(_0x47652c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 33cdb7f..84fce95 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 _0x047c=['lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations'];(function(_0x119eeb,_0x4d228b){var _0x446a5e=function(_0x472b82){while(--_0x472b82){_0x119eeb['push'](_0x119eeb['shift']());}};_0x446a5e(++_0x4d228b);}(_0x047c,0x18c));var _0xc047=function(_0x2fecbc,_0x5e8b04){_0x2fecbc=_0x2fecbc-0x0;var _0x2bab10=_0x047c[_0x2fecbc];return _0x2bab10;};'use strict';var _=require(_0xc047('0x0'));var util=require('util');var logger=require(_0xc047('0x1'))(_0xc047('0x2'));var moment=require(_0xc047('0x3'));var BPromise=require('bluebird');var rp=require(_0xc047('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc047('0x5'));var config=require(_0xc047('0x6'));var attributes=require(_0xc047('0x7'));module[_0xc047('0x8')]=function(_0x597aed,_0x1a7e00){return _0x597aed[_0xc047('0x9')](_0xc047('0xa'),attributes,{'tableName':_0xc047('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d29=['path','rimraf','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9d29,0xf8));var _0x99d2=function(_0xc2dde6,_0x1cccc9){_0xc2dde6=_0xc2dde6-0x0;var _0x9fc29c=_0x9d29[_0xc2dde6];return _0x9fc29c;};'use strict';var _=require(_0x99d2('0x0'));var util=require('util');var logger=require(_0x99d2('0x1'))(_0x99d2('0x2'));var moment=require('moment');var BPromise=require(_0x99d2('0x3'));var rp=require(_0x99d2('0x4'));var fs=require('fs');var path=require(_0x99d2('0x5'));var rimraf=require(_0x99d2('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module[_0x99d2('0x7')]=function(_0x5de53c,_0x2e0845){return _0x5de53c[_0x99d2('0x8')](_0x99d2('0x9'),attributes,{'tableName':_0x99d2('0xa'),'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 f8139f2..2112851 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 _0x8e73=['info','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x483f1b,_0x2891ec){var _0x1c3377=function(_0x5ba751){while(--_0x5ba751){_0x483f1b['push'](_0x483f1b['shift']());}};_0x1c3377(++_0x2891ec);}(_0x8e73,0x93));var _0x38e7=function(_0x5ecc30,_0x365f95){_0x5ecc30=_0x5ecc30-0x0;var _0x2fb12a=_0x8e73[_0x5ecc30];return _0x2fb12a;};'use strict';var _=require(_0x38e7('0x0'));var util=require('util');var moment=require(_0x38e7('0x1'));var BPromise=require(_0x38e7('0x2'));var rs=require(_0x38e7('0x3'));var fs=require('fs');var Redis=require(_0x38e7('0x4'));var db=require(_0x38e7('0x5'))['db'];var utils=require(_0x38e7('0x6'));var logger=require(_0x38e7('0x7'))(_0x38e7('0x8'));var config=require(_0x38e7('0x9'));var jayson=require(_0x38e7('0xa'));var client=jayson[_0x38e7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x314ca8,_0x43f4b4,_0x35f0f8){return new BPromise(function(_0x4d477d,_0x490c6e){return client[_0x38e7('0xc')](_0x314ca8,_0x35f0f8)[_0x38e7('0xd')](function(_0x69350d){logger[_0x38e7('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x43f4b4,'request\x20sent');logger['debug'](_0x38e7('0xf'),_0x43f4b4,_0x38e7('0x10'),JSON[_0x38e7('0x11')](_0x69350d));if(_0x69350d['error']){if(_0x69350d[_0x38e7('0x12')][_0x38e7('0x13')]===0x1f4){logger[_0x38e7('0x12')](_0x38e7('0x14'),_0x43f4b4,_0x69350d[_0x38e7('0x12')][_0x38e7('0x15')]);return _0x490c6e(_0x69350d[_0x38e7('0x12')][_0x38e7('0x15')]);}logger[_0x38e7('0x12')](_0x38e7('0x14'),_0x43f4b4,_0x69350d[_0x38e7('0x12')][_0x38e7('0x15')]);return _0x4d477d(_0x69350d[_0x38e7('0x12')]['message']);}else{logger[_0x38e7('0xe')](_0x38e7('0x14'),_0x43f4b4,_0x38e7('0x10'));_0x4d477d(_0x69350d[_0x38e7('0x16')][_0x38e7('0x15')]);}})['catch'](function(_0x16fda9){logger['error'](_0x38e7('0x14'),_0x43f4b4,_0x16fda9);_0x490c6e(_0x16fda9);});});} \ No newline at end of file +var _0x97da=['code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x36dcf1,_0xf5640a){var _0x2252c2=function(_0x4663b6){while(--_0x4663b6){_0x36dcf1['push'](_0x36dcf1['shift']());}};_0x2252c2(++_0xf5640a);}(_0x97da,0x10b));var _0xa97d=function(_0xadf241,_0x272a69){_0xadf241=_0xadf241-0x0;var _0x445ad2=_0x97da[_0xadf241];return _0x445ad2;};'use strict';var _=require(_0xa97d('0x0'));var util=require(_0xa97d('0x1'));var moment=require(_0xa97d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa97d('0x3'));var db=require(_0xa97d('0x4'))['db'];var utils=require(_0xa97d('0x5'));var logger=require(_0xa97d('0x6'))(_0xa97d('0x7'));var config=require('../../config/environment');var jayson=require(_0xa97d('0x8'));var client=jayson[_0xa97d('0x9')][_0xa97d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33b4af,_0x3ef8c0,_0x436ffb){return new BPromise(function(_0x31f284,_0x2b6e13){return client[_0xa97d('0xb')](_0x33b4af,_0x436ffb)['then'](function(_0x58d4e9){logger[_0xa97d('0xc')](_0xa97d('0xd'),_0x3ef8c0,_0xa97d('0xe'));logger[_0xa97d('0xf')](_0xa97d('0x10'),_0x3ef8c0,_0xa97d('0xe'),JSON[_0xa97d('0x11')](_0x58d4e9));if(_0x58d4e9[_0xa97d('0x12')]){if(_0x58d4e9[_0xa97d('0x12')][_0xa97d('0x13')]===0x1f4){logger['error'](_0xa97d('0xd'),_0x3ef8c0,_0x58d4e9[_0xa97d('0x12')][_0xa97d('0x14')]);return _0x2b6e13(_0x58d4e9['error'][_0xa97d('0x14')]);}logger['error'](_0xa97d('0xd'),_0x3ef8c0,_0x58d4e9[_0xa97d('0x12')]['message']);return _0x31f284(_0x58d4e9[_0xa97d('0x12')]['message']);}else{logger[_0xa97d('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3ef8c0,_0xa97d('0xe'));_0x31f284(_0x58d4e9[_0xa97d('0x15')][_0xa97d('0x14')]);}})['catch'](function(_0x7a48d2){logger[_0xa97d('0x12')](_0xa97d('0xd'),_0x3ef8c0,_0x7a48d2);_0x2b6e13(_0x7a48d2);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index d238f15..5b441c8 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 _0xa2ef=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id'];(function(_0x5a24f8,_0x5b517b){var _0x5bc49b=function(_0x59ecb0){while(--_0x59ecb0){_0x5a24f8['push'](_0x5a24f8['shift']());}};_0x5bc49b(++_0x5b517b);}(_0xa2ef,0x169));var _0xfa2e=function(_0x406edd,_0x2cc2f5){_0x406edd=_0x406edd-0x0;var _0x31ab49=_0xa2ef[_0x406edd];return _0x31ab49;};'use strict';var multer=require(_0xfa2e('0x0'));var util=require(_0xfa2e('0x1'));var path=require(_0xfa2e('0x2'));var timeout=require(_0xfa2e('0x3'));var express=require(_0xfa2e('0x4'));var router=express[_0xfa2e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xfa2e('0x6'));var config=require(_0xfa2e('0x7'));var controller=require(_0xfa2e('0x8'));router[_0xfa2e('0x9')]('/',auth[_0xfa2e('0xa')](),controller[_0xfa2e('0xb')]);router['get']('/:id',auth[_0xfa2e('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xfa2e('0xc'),auth[_0xfa2e('0xa')](),controller[_0xfa2e('0xd')]);router[_0xfa2e('0xe')](_0xfa2e('0xc'),auth[_0xfa2e('0xa')](),controller[_0xfa2e('0xf')]);module[_0xfa2e('0x10')]=router; \ No newline at end of file +var _0x9fb4=['../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','/:id','isAuthenticated','show','post','create','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service'];(function(_0x712ec9,_0x1c53f4){var _0x551f05=function(_0x54b94d){while(--_0x54b94d){_0x712ec9['push'](_0x712ec9['shift']());}};_0x551f05(++_0x1c53f4);}(_0x9fb4,0x1dc));var _0x49fb=function(_0x553150,_0x589ff3){_0x553150=_0x553150-0x0;var _0x18193d=_0x9fb4[_0x553150];return _0x18193d;};'use strict';var multer=require('multer');var util=require(_0x49fb('0x0'));var path=require('path');var timeout=require(_0x49fb('0x1'));var express=require('express');var router=express[_0x49fb('0x2')]();var auth=require(_0x49fb('0x3'));var interaction=require(_0x49fb('0x4'));var config=require(_0x49fb('0x5'));var controller=require(_0x49fb('0x6'));router[_0x49fb('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x49fb('0x7')](_0x49fb('0x8'),auth[_0x49fb('0x9')](),controller[_0x49fb('0xa')]);router[_0x49fb('0xb')]('/',auth[_0x49fb('0x9')](),controller[_0x49fb('0xc')]);router['put']('/:id',auth[_0x49fb('0x9')](),controller['update']);router[_0x49fb('0xd')]('/:id',auth[_0x49fb('0x9')](),controller[_0x49fb('0xe')]);module[_0x49fb('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 5ff2a1a..2c3e1a6 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 _0xef60=['sequelize','exports','ENUM','string','variable','customVariable','STRING','BOOLEAN'];(function(_0x15d1ee,_0x43d55a){var _0x4cc7f1=function(_0x948d4f){while(--_0x948d4f){_0x15d1ee['push'](_0x15d1ee['shift']());}};_0x4cc7f1(++_0x43d55a);}(_0xef60,0xa0));var _0x0ef6=function(_0x10d35f,_0x3ce365){_0x10d35f=_0x10d35f-0x0;var _0x5d708d=_0xef60[_0x10d35f];return _0x5d708d;};'use strict';var Sequelize=require(_0x0ef6('0x0'));module[_0x0ef6('0x1')]={'type':{'type':Sequelize[_0x0ef6('0x2')](_0x0ef6('0x3'),_0x0ef6('0x4'),_0x0ef6('0x5'),'keyValue'),'defaultValue':_0x0ef6('0x3')},'content':{'type':Sequelize[_0x0ef6('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0ef6('0x2')](_0x0ef6('0x3'),'variable',_0x0ef6('0x5'))},'keyContent':{'type':Sequelize[_0x0ef6('0x6')]},'idField':{'type':Sequelize[_0x0ef6('0x6')]},'nameField':{'type':Sequelize[_0x0ef6('0x6')]},'customField':{'type':Sequelize[_0x0ef6('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0ef6('0x6')]}}; \ No newline at end of file +var _0x16e4=['exports','ENUM','string','variable','customVariable','STRING','BOOLEAN','sequelize'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0x16e4,0x97));var _0x416e=function(_0x4ffbb1,_0x5a2a72){_0x4ffbb1=_0x4ffbb1-0x0;var _0x1fe455=_0x16e4[_0x4ffbb1];return _0x1fe455;};'use strict';var Sequelize=require(_0x416e('0x0'));module[_0x416e('0x1')]={'type':{'type':Sequelize[_0x416e('0x2')](_0x416e('0x3'),_0x416e('0x4'),_0x416e('0x5'),'keyValue'),'defaultValue':_0x416e('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x416e('0x6')]},'keyType':{'type':Sequelize[_0x416e('0x2')]('string',_0x416e('0x4'),_0x416e('0x5'))},'keyContent':{'type':Sequelize[_0x416e('0x6')]},'idField':{'type':Sequelize[_0x416e('0x6')]},'nameField':{'type':Sequelize[_0x416e('0x6')]},'customField':{'type':Sequelize[_0x416e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x416e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index aa6024e..aba7259 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 _0x0108=['pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','filtears','length','includeAll','create','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','reject','save','update','then','end','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where'];(function(_0x3c27d1,_0x5ae8c5){var _0x1f5586=function(_0x5cbde8){while(--_0x5cbde8){_0x3c27d1['push'](_0x3c27d1['shift']());}};_0x1f5586(++_0x5ae8c5);}(_0x0108,0xa3));var _0x8010=function(_0x401676,_0x3f1436){_0x401676=_0x401676-0x0;var _0x4f13fe=_0x0108[_0x401676];return _0x4f13fe;};'use strict';var pdf=require(_0x8010('0x0'));var emlformat=require(_0x8010('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8010('0x2'));var jsonpatch=require(_0x8010('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8010('0x4'));var util=require(_0x8010('0x5'));var path=require(_0x8010('0x6'));var sox=require(_0x8010('0x7'));var csv=require(_0x8010('0x8'));var ejs=require(_0x8010('0x9'));var fs=require('fs');var _=require(_0x8010('0xa'));var squel=require(_0x8010('0xb'));var crypto=require('crypto');var jsforce=require(_0x8010('0xc'));var deskjs=require(_0x8010('0xd'));var toCsv=require(_0x8010('0x8'));var querystring=require(_0x8010('0xe'));var Papa=require(_0x8010('0xf'));var Redis=require(_0x8010('0x10'));var authService=require(_0x8010('0x11'));var qs=require(_0x8010('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8010('0x13'));var logger=require('../../config/logger')(_0x8010('0x14'));var utils=require('../../config/utils');var config=require(_0x8010('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8010('0x16'))['db'];function respondWithStatusCode(_0x4ef440,_0x5a3cb2){_0x5a3cb2=_0x5a3cb2||0xcc;return function(_0x2d98a9){if(_0x2d98a9){return _0x4ef440[_0x8010('0x17')](_0x5a3cb2);}return _0x4ef440[_0x8010('0x18')](_0x5a3cb2)['end']();};}function respondWithResult(_0x2bba4b,_0x5302ef){_0x5302ef=_0x5302ef||0xc8;return function(_0x1c4b4e){if(_0x1c4b4e){return _0x2bba4b[_0x8010('0x18')](_0x5302ef)[_0x8010('0x19')](_0x1c4b4e);}};}function respondWithFilteredResult(_0x48e6ba,_0x7cbb61){return function(_0x3fb852){if(_0x3fb852){var _0x1da033=_0x3fb852[_0x8010('0x1a')],_0x180896=_0x7cbb61[_0x8010('0x1b')],_0x14d695=_0x7cbb61[_0x8010('0x1b')]+_0x7cbb61[_0x8010('0x1c')],_0x4909eb;if(_0x14d695>=_0x1da033){_0x14d695=_0x1da033;_0x4909eb=0xc8;}else{_0x4909eb=0xce;}_0x48e6ba[_0x8010('0x18')](_0x4909eb);return _0x48e6ba['set']('Content-Range',_0x180896+'-'+_0x14d695+'/'+_0x1da033)[_0x8010('0x19')](_0x3fb852);}return null;};}function patchUpdates(_0x409648){return function(_0x4e898c){try{jsonpatch['apply'](_0x4e898c,_0x409648,!![]);}catch(_0x19ab0f){return BPromise[_0x8010('0x1d')](_0x19ab0f);}return _0x4e898c[_0x8010('0x1e')]();};}function saveUpdates(_0x432612,_0x2044ff){return function(_0xe52b8){if(_0xe52b8){return _0xe52b8[_0x8010('0x1f')](_0x432612)[_0x8010('0x20')](function(_0x43da93){return _0x43da93;});}return null;};}function removeEntity(_0x383787,_0x50f2e9){return function(_0x14ebf9){if(_0x14ebf9){return _0x14ebf9['destroy']()['then'](function(){_0x383787[_0x8010('0x18')](0xcc)[_0x8010('0x21')]();});}};}function handleEntityNotFound(_0x200e48,_0x17265c){return function(_0x5799f3){if(!_0x5799f3){_0x200e48['sendStatus'](0x194);}return _0x5799f3;};}function handleError(_0xbfd2d2,_0x401309){_0x401309=_0x401309||0x1f4;return function(_0x2c57d0){logger[_0x8010('0x22')](_0x2c57d0[_0x8010('0x23')]);if(_0x2c57d0[_0x8010('0x24')]){delete _0x2c57d0['name'];}_0xbfd2d2[_0x8010('0x18')](_0x401309)[_0x8010('0x25')](_0x2c57d0);};}exports[_0x8010('0x26')]=function(_0x16a8f2,_0x5ec3ed){var _0x202eba={},_0x107b78={},_0x285642={'count':0x0,'rows':[]};var _0x2cfcc0=_[_0x8010('0x27')](db[_0x8010('0x28')][_0x8010('0x29')],function(_0x1d7e00){return{'name':_0x1d7e00[_0x8010('0x2a')],'type':_0x1d7e00[_0x8010('0x2b')][_0x8010('0x2c')]};});_0x107b78[_0x8010('0x2d')]=_[_0x8010('0x27')](_0x2cfcc0,'name');_0x107b78[_0x8010('0x2e')]=_[_0x8010('0x2f')](_0x16a8f2['query']);_0x107b78[_0x8010('0x30')]=_[_0x8010('0x31')](_0x107b78[_0x8010('0x2d')],_0x107b78[_0x8010('0x2e')]);_0x202eba[_0x8010('0x32')]=_[_0x8010('0x31')](_0x107b78['model'],qs[_0x8010('0x33')](_0x16a8f2[_0x8010('0x2e')][_0x8010('0x33')]));_0x202eba[_0x8010('0x32')]=_0x202eba['attributes']['length']?_0x202eba[_0x8010('0x32')]:_0x107b78[_0x8010('0x2d')];if(!_0x16a8f2['query'][_0x8010('0x34')](_0x8010('0x35'))){_0x202eba[_0x8010('0x1c')]=qs[_0x8010('0x1c')](_0x16a8f2['query'][_0x8010('0x1c')]);_0x202eba['offset']=qs[_0x8010('0x1b')](_0x16a8f2[_0x8010('0x2e')][_0x8010('0x1b')]);}_0x202eba['order']=qs[_0x8010('0x36')](_0x16a8f2[_0x8010('0x2e')][_0x8010('0x36')]);_0x202eba[_0x8010('0x37')]=qs[_0x8010('0x30')](_[_0x8010('0x38')](_0x16a8f2[_0x8010('0x2e')],_0x107b78[_0x8010('0x30')]),_0x2cfcc0);if(_0x16a8f2[_0x8010('0x2e')][_0x8010('0x39')]){_0x202eba['where']=_[_0x8010('0x3a')](_0x202eba[_0x8010('0x37')],{'$or':_['map'](_0x2cfcc0,function(_0x441c7e){if(_0x441c7e[_0x8010('0x2b')]!==_0x8010('0x3b')){var _0x26d49f={};_0x26d49f[_0x441c7e[_0x8010('0x24')]]={'$like':'%'+_0x16a8f2[_0x8010('0x2e')][_0x8010('0x39')]+'%'};return _0x26d49f;}})});}_0x202eba=_[_0x8010('0x3a')]({},_0x202eba,_0x16a8f2[_0x8010('0x3c')]);var _0x4d1cc0={'where':_0x202eba[_0x8010('0x37')]};return db[_0x8010('0x28')][_0x8010('0x1a')](_0x4d1cc0)[_0x8010('0x20')](function(_0x220d50){_0x285642['count']=_0x220d50;if(_0x16a8f2[_0x8010('0x2e')]['includeAll']){_0x202eba[_0x8010('0x3d')]=[{'all':!![]}];}return db[_0x8010('0x28')][_0x8010('0x3e')](_0x202eba);})[_0x8010('0x20')](function(_0x4a4a86){_0x285642[_0x8010('0x3f')]=_0x4a4a86;return _0x285642;})['then'](respondWithFilteredResult(_0x5ec3ed,_0x202eba))[_0x8010('0x40')](handleError(_0x5ec3ed,null));};exports[_0x8010('0x41')]=function(_0x3326f9,_0x2746b6){var _0x419cd5={'raw':!![],'where':{'id':_0x3326f9[_0x8010('0x42')]['id']}},_0x49341e={};_0x49341e['model']=_[_0x8010('0x2f')](db[_0x8010('0x28')][_0x8010('0x29')]);_0x49341e[_0x8010('0x2e')]=_['keys'](_0x3326f9[_0x8010('0x2e')]);_0x49341e[_0x8010('0x43')]=_[_0x8010('0x31')](_0x49341e[_0x8010('0x2d')],_0x49341e[_0x8010('0x2e')]);_0x419cd5[_0x8010('0x32')]=_['intersection'](_0x49341e[_0x8010('0x2d')],qs[_0x8010('0x33')](_0x3326f9[_0x8010('0x2e')]['fields']));_0x419cd5['attributes']=_0x419cd5[_0x8010('0x32')][_0x8010('0x44')]?_0x419cd5[_0x8010('0x32')]:_0x49341e[_0x8010('0x2d')];if(_0x3326f9[_0x8010('0x2e')][_0x8010('0x45')]){_0x419cd5[_0x8010('0x3d')]=[{'all':!![]}];}_0x419cd5=_['merge']({},_0x419cd5,_0x3326f9[_0x8010('0x3c')]);return db[_0x8010('0x28')]['find'](_0x419cd5)[_0x8010('0x20')](handleEntityNotFound(_0x2746b6,null))[_0x8010('0x20')](respondWithResult(_0x2746b6,null))[_0x8010('0x40')](handleError(_0x2746b6,null));};exports[_0x8010('0x46')]=function(_0x3fc3e8,_0x270341){return db[_0x8010('0x28')][_0x8010('0x46')](_0x3fc3e8[_0x8010('0x47')],{})['then'](respondWithResult(_0x270341,0xc9))['catch'](handleError(_0x270341,null));};exports['update']=function(_0x563d92,_0xfed86a){if(_0x563d92[_0x8010('0x47')]['id']){delete _0x563d92['body']['id'];}return db[_0x8010('0x28')][_0x8010('0x48')]({'where':{'id':_0x563d92[_0x8010('0x42')]['id']}})['then'](handleEntityNotFound(_0xfed86a,null))['then'](saveUpdates(_0x563d92[_0x8010('0x47')],null))['then'](respondWithResult(_0xfed86a,null))['catch'](handleError(_0xfed86a,null));};exports['destroy']=function(_0x238fc9,_0x830b73){return db['ServicenowField']['find']({'where':{'id':_0x238fc9[_0x8010('0x42')]['id']}})[_0x8010('0x20')](handleEntityNotFound(_0x830b73,null))[_0x8010('0x20')](removeEntity(_0x830b73,null))[_0x8010('0x40')](handleError(_0x830b73,null));}; \ No newline at end of file +var _0x76a9=['mustache','util','path','sox','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','offset','limit','status','set','Content-Range','apply','save','update','then','sendStatus','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','catch','keys','filtears','create','body','find','params','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0xdd491,_0x4cf861){var _0x1097fb=function(_0x21a997){while(--_0x21a997){_0xdd491['push'](_0xdd491['shift']());}};_0x1097fb(++_0x4cf861);}(_0x76a9,0x1f2));var _0x976a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x76a9[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x976a('0x0'));var emlformat=require(_0x976a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x976a('0x2'));var jsonpatch=require(_0x976a('0x3'));var rp=require(_0x976a('0x4'));var moment=require(_0x976a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x976a('0x6'));var util=require(_0x976a('0x7'));var path=require(_0x976a('0x8'));var sox=require(_0x976a('0x9'));var csv=require('to-csv');var ejs=require(_0x976a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x976a('0xb'));var deskjs=require(_0x976a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x976a('0xd'));var Papa=require(_0x976a('0xe'));var Redis=require(_0x976a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x976a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x976a('0x11'));var logger=require('../../config/logger')(_0x976a('0x12'));var utils=require(_0x976a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x976a('0x14'));var db=require(_0x976a('0x15'))['db'];function respondWithStatusCode(_0x139798,_0x5522b3){_0x5522b3=_0x5522b3||0xcc;return function(_0x5b185b){if(_0x5b185b){return _0x139798['sendStatus'](_0x5522b3);}return _0x139798['status'](_0x5522b3)[_0x976a('0x16')]();};}function respondWithResult(_0x4ab702,_0x1acc9e){_0x1acc9e=_0x1acc9e||0xc8;return function(_0x3d6669){if(_0x3d6669){return _0x4ab702['status'](_0x1acc9e)[_0x976a('0x17')](_0x3d6669);}};}function respondWithFilteredResult(_0x14720e,_0x1a284c){return function(_0x42f14d){if(_0x42f14d){var _0x195d4e=_0x42f14d['count'],_0x447888=_0x1a284c[_0x976a('0x18')],_0x3dae25=_0x1a284c['offset']+_0x1a284c[_0x976a('0x19')],_0x50abca;if(_0x3dae25>=_0x195d4e){_0x3dae25=_0x195d4e;_0x50abca=0xc8;}else{_0x50abca=0xce;}_0x14720e[_0x976a('0x1a')](_0x50abca);return _0x14720e[_0x976a('0x1b')](_0x976a('0x1c'),_0x447888+'-'+_0x3dae25+'/'+_0x195d4e)[_0x976a('0x17')](_0x42f14d);}return null;};}function patchUpdates(_0x3505d7){return function(_0x4385bb){try{jsonpatch[_0x976a('0x1d')](_0x4385bb,_0x3505d7,!![]);}catch(_0x357f90){return BPromise['reject'](_0x357f90);}return _0x4385bb[_0x976a('0x1e')]();};}function saveUpdates(_0xa59faa,_0x9bcd00){return function(_0x5ea139){if(_0x5ea139){return _0x5ea139[_0x976a('0x1f')](_0xa59faa)[_0x976a('0x20')](function(_0x8de4f3){return _0x8de4f3;});}return null;};}function removeEntity(_0x3cdbf4,_0x3f62ca){return function(_0x23cbba){if(_0x23cbba){return _0x23cbba['destroy']()[_0x976a('0x20')](function(){_0x3cdbf4[_0x976a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40d14d,_0x1fa9d2){return function(_0x474037){if(!_0x474037){_0x40d14d[_0x976a('0x21')](0x194);}return _0x474037;};}function handleError(_0x3b3e94,_0x31ee52){_0x31ee52=_0x31ee52||0x1f4;return function(_0x4aecdf){logger[_0x976a('0x22')](_0x4aecdf['stack']);if(_0x4aecdf[_0x976a('0x23')]){delete _0x4aecdf[_0x976a('0x23')];}_0x3b3e94[_0x976a('0x1a')](_0x31ee52)[_0x976a('0x24')](_0x4aecdf);};}exports[_0x976a('0x25')]=function(_0x57e9ec,_0x45fab2){var _0x2c15d0={},_0x1b0407={},_0x3524d9={'count':0x0,'rows':[]};var _0x4c2b93=_[_0x976a('0x26')](db[_0x976a('0x27')][_0x976a('0x28')],function(_0x12ab06){return{'name':_0x12ab06[_0x976a('0x29')],'type':_0x12ab06[_0x976a('0x2a')][_0x976a('0x2b')]};});_0x1b0407['model']=_[_0x976a('0x26')](_0x4c2b93,'name');_0x1b0407[_0x976a('0x2c')]=_['keys'](_0x57e9ec['query']);_0x1b0407[_0x976a('0x2d')]=_['intersection'](_0x1b0407[_0x976a('0x2e')],_0x1b0407[_0x976a('0x2c')]);_0x2c15d0[_0x976a('0x2f')]=_[_0x976a('0x30')](_0x1b0407[_0x976a('0x2e')],qs[_0x976a('0x31')](_0x57e9ec[_0x976a('0x2c')][_0x976a('0x31')]));_0x2c15d0[_0x976a('0x2f')]=_0x2c15d0[_0x976a('0x2f')]['length']?_0x2c15d0[_0x976a('0x2f')]:_0x1b0407[_0x976a('0x2e')];if(!_0x57e9ec[_0x976a('0x2c')][_0x976a('0x32')](_0x976a('0x33'))){_0x2c15d0['limit']=qs[_0x976a('0x19')](_0x57e9ec[_0x976a('0x2c')]['limit']);_0x2c15d0[_0x976a('0x18')]=qs['offset'](_0x57e9ec[_0x976a('0x2c')][_0x976a('0x18')]);}_0x2c15d0[_0x976a('0x34')]=qs[_0x976a('0x35')](_0x57e9ec[_0x976a('0x2c')][_0x976a('0x35')]);_0x2c15d0['where']=qs[_0x976a('0x2d')](_[_0x976a('0x36')](_0x57e9ec[_0x976a('0x2c')],_0x1b0407[_0x976a('0x2d')]),_0x4c2b93);if(_0x57e9ec['query'][_0x976a('0x37')]){_0x2c15d0[_0x976a('0x38')]=_['merge'](_0x2c15d0['where'],{'$or':_[_0x976a('0x26')](_0x4c2b93,function(_0x5c694f){if(_0x5c694f[_0x976a('0x2a')]!==_0x976a('0x39')){var _0x469811={};_0x469811[_0x5c694f[_0x976a('0x23')]]={'$like':'%'+_0x57e9ec[_0x976a('0x2c')]['filter']+'%'};return _0x469811;}})});}_0x2c15d0=_[_0x976a('0x3a')]({},_0x2c15d0,_0x57e9ec[_0x976a('0x3b')]);var _0xaa0e77={'where':_0x2c15d0['where']};return db[_0x976a('0x27')][_0x976a('0x3c')](_0xaa0e77)['then'](function(_0x2c7de4){_0x3524d9[_0x976a('0x3c')]=_0x2c7de4;if(_0x57e9ec[_0x976a('0x2c')][_0x976a('0x3d')]){_0x2c15d0[_0x976a('0x3e')]=[{'all':!![]}];}return db[_0x976a('0x27')][_0x976a('0x3f')](_0x2c15d0);})[_0x976a('0x20')](function(_0x552657){_0x3524d9['rows']=_0x552657;return _0x3524d9;})['then'](respondWithFilteredResult(_0x45fab2,_0x2c15d0))[_0x976a('0x40')](handleError(_0x45fab2,null));};exports['show']=function(_0x1093f5,_0x1ca1a4){var _0x5c6c09={'raw':!![],'where':{'id':_0x1093f5['params']['id']}},_0x34cf37={};_0x34cf37[_0x976a('0x2e')]=_[_0x976a('0x41')](db[_0x976a('0x27')]['rawAttributes']);_0x34cf37[_0x976a('0x2c')]=_[_0x976a('0x41')](_0x1093f5[_0x976a('0x2c')]);_0x34cf37[_0x976a('0x42')]=_[_0x976a('0x30')](_0x34cf37[_0x976a('0x2e')],_0x34cf37[_0x976a('0x2c')]);_0x5c6c09[_0x976a('0x2f')]=_[_0x976a('0x30')](_0x34cf37['model'],qs[_0x976a('0x31')](_0x1093f5[_0x976a('0x2c')][_0x976a('0x31')]));_0x5c6c09[_0x976a('0x2f')]=_0x5c6c09[_0x976a('0x2f')]['length']?_0x5c6c09[_0x976a('0x2f')]:_0x34cf37[_0x976a('0x2e')];if(_0x1093f5['query'][_0x976a('0x3d')]){_0x5c6c09['include']=[{'all':!![]}];}_0x5c6c09=_[_0x976a('0x3a')]({},_0x5c6c09,_0x1093f5[_0x976a('0x3b')]);return db[_0x976a('0x27')]['find'](_0x5c6c09)[_0x976a('0x20')](handleEntityNotFound(_0x1ca1a4,null))['then'](respondWithResult(_0x1ca1a4,null))[_0x976a('0x40')](handleError(_0x1ca1a4,null));};exports[_0x976a('0x43')]=function(_0x251797,_0x234d3a){return db[_0x976a('0x27')][_0x976a('0x43')](_0x251797[_0x976a('0x44')],{})[_0x976a('0x20')](respondWithResult(_0x234d3a,0xc9))[_0x976a('0x40')](handleError(_0x234d3a,null));};exports['update']=function(_0x22a0f4,_0x587cb2){if(_0x22a0f4[_0x976a('0x44')]['id']){delete _0x22a0f4[_0x976a('0x44')]['id'];}return db[_0x976a('0x27')][_0x976a('0x45')]({'where':{'id':_0x22a0f4[_0x976a('0x46')]['id']}})['then'](handleEntityNotFound(_0x587cb2,null))['then'](saveUpdates(_0x22a0f4[_0x976a('0x44')],null))[_0x976a('0x20')](respondWithResult(_0x587cb2,null))[_0x976a('0x40')](handleError(_0x587cb2,null));};exports[_0x976a('0x47')]=function(_0x1e3e34,_0x25f0ef){return db[_0x976a('0x27')][_0x976a('0x45')]({'where':{'id':_0x1e3e34[_0x976a('0x46')]['id']}})['then'](handleEntityNotFound(_0x25f0ef,null))['then'](removeEntity(_0x25f0ef,null))['catch'](handleError(_0x25f0ef,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 02eb9ed..ce84a78 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 _0xd7f8=['exports','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x56c27b,_0x38c92c){var _0x5b0411=function(_0x500fae){while(--_0x500fae){_0x56c27b['push'](_0x56c27b['shift']());}};_0x5b0411(++_0x38c92c);}(_0xd7f8,0x1da));var _0x8d7f=function(_0x372489,_0x358eb7){_0x372489=_0x372489-0x0;var _0x5628a8=_0xd7f8[_0x372489];return _0x5628a8;};'use strict';var _=require('lodash');var util=require(_0x8d7f('0x0'));var logger=require(_0x8d7f('0x1'))(_0x8d7f('0x2'));var moment=require('moment');var BPromise=require(_0x8d7f('0x3'));var rp=require(_0x8d7f('0x4'));var fs=require('fs');var path=require(_0x8d7f('0x5'));var rimraf=require(_0x8d7f('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowField.attributes');module[_0x8d7f('0x7')]=function(_0x2e5b0e,_0x4a65f4){return _0x2e5b0e[_0x8d7f('0x8')]('ServicenowField',attributes,{'tableName':_0x8d7f('0x9'),'paranoid':![],'indexes':[{'name':_0x8d7f('0xa'),'fields':[_0x8d7f('0xb'),_0x8d7f('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x44d6=['FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField'];(function(_0x1602a3,_0x31b813){var _0x1c88ae=function(_0x1efba7){while(--_0x1efba7){_0x1602a3['push'](_0x1602a3['shift']());}};_0x1c88ae(++_0x31b813);}(_0x44d6,0x81));var _0x644d=function(_0x29ac27,_0x525d68){_0x29ac27=_0x29ac27-0x0;var _0x3d7230=_0x44d6[_0x29ac27];return _0x3d7230;};'use strict';var _=require(_0x644d('0x0'));var util=require(_0x644d('0x1'));var logger=require(_0x644d('0x2'))(_0x644d('0x3'));var moment=require(_0x644d('0x4'));var BPromise=require('bluebird');var rp=require(_0x644d('0x5'));var fs=require('fs');var path=require(_0x644d('0x6'));var rimraf=require(_0x644d('0x7'));var config=require(_0x644d('0x8'));var attributes=require(_0x644d('0x9'));module[_0x644d('0xa')]=function(_0x208a03,_0x46e128){return _0x208a03['define'](_0x644d('0xb'),attributes,{'tableName':_0x644d('0xc'),'paranoid':![],'indexes':[{'name':_0x644d('0xd'),'fields':[_0x644d('0xe'),_0x644d('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 81e9a14..27991e3 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 _0x3e41=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','ServicenowField,\x20%s,\x20%s','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x5a06d9,_0x17e4ff){var _0x5ee5bf=function(_0xe9d59){while(--_0xe9d59){_0x5a06d9['push'](_0x5a06d9['shift']());}};_0x5ee5bf(++_0x17e4ff);}(_0x3e41,0x17b));var _0x13e4=function(_0x5d34a1,_0xc38069){_0x5d34a1=_0x5d34a1-0x0;var _0x2e407d=_0x3e41[_0x5d34a1];return _0x2e407d;};'use strict';var _=require(_0x13e4('0x0'));var util=require(_0x13e4('0x1'));var moment=require(_0x13e4('0x2'));var BPromise=require(_0x13e4('0x3'));var rs=require(_0x13e4('0x4'));var fs=require('fs');var Redis=require(_0x13e4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x13e4('0x6'));var logger=require(_0x13e4('0x7'))(_0x13e4('0x8'));var config=require('../../config/environment');var jayson=require(_0x13e4('0x9'));var client=jayson['client'][_0x13e4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x497816,_0x2bb6a0,_0xb0ea0){return new BPromise(function(_0x521c56,_0x2411ce){return client[_0x13e4('0xb')](_0x497816,_0xb0ea0)['then'](function(_0x2d449f){logger['info'](_0x13e4('0xc'),_0x2bb6a0,_0x13e4('0xd'));logger['debug'](_0x13e4('0xe'),_0x2bb6a0,'request\x20sent',JSON['stringify'](_0x2d449f));if(_0x2d449f[_0x13e4('0xf')]){if(_0x2d449f[_0x13e4('0xf')][_0x13e4('0x10')]===0x1f4){logger[_0x13e4('0xf')](_0x13e4('0xc'),_0x2bb6a0,_0x2d449f['error']['message']);return _0x2411ce(_0x2d449f[_0x13e4('0xf')][_0x13e4('0x11')]);}logger['error'](_0x13e4('0xc'),_0x2bb6a0,_0x2d449f[_0x13e4('0xf')]['message']);return _0x521c56(_0x2d449f[_0x13e4('0xf')][_0x13e4('0x11')]);}else{logger[_0x13e4('0x12')](_0x13e4('0xc'),_0x2bb6a0,_0x13e4('0xd'));_0x521c56(_0x2d449f[_0x13e4('0x13')][_0x13e4('0x11')]);}})[_0x13e4('0x14')](function(_0x2eb390){logger['error'](_0x13e4('0xc'),_0x2bb6a0,_0x2eb390);_0x2411ce(_0x2eb390);});});} \ No newline at end of file +var _0xb5f0=['stringify','error','code','message','result','catch','lodash','randomstring','../../config/utils','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0xb5f0,0xc1));var _0x0b5f=function(_0x1f398f,_0x1db69f){_0x1f398f=_0x1f398f-0x0;var _0x2c88d3=_0xb5f0[_0x1f398f];return _0x2c88d3;};'use strict';var _=require(_0x0b5f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0b5f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0b5f('0x2'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0b5f('0x3'));var client=jayson[_0x0b5f('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x203a56,_0x152742,_0x36e359){return new BPromise(function(_0x20212c,_0x1746dd){return client[_0x0b5f('0x5')](_0x203a56,_0x36e359)[_0x0b5f('0x6')](function(_0x1b8292){logger[_0x0b5f('0x7')](_0x0b5f('0x8'),_0x152742,'request\x20sent');logger[_0x0b5f('0x9')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x152742,_0x0b5f('0xa'),JSON[_0x0b5f('0xb')](_0x1b8292));if(_0x1b8292[_0x0b5f('0xc')]){if(_0x1b8292[_0x0b5f('0xc')][_0x0b5f('0xd')]===0x1f4){logger[_0x0b5f('0xc')](_0x0b5f('0x8'),_0x152742,_0x1b8292[_0x0b5f('0xc')][_0x0b5f('0xe')]);return _0x1746dd(_0x1b8292[_0x0b5f('0xc')][_0x0b5f('0xe')]);}logger[_0x0b5f('0xc')](_0x0b5f('0x8'),_0x152742,_0x1b8292[_0x0b5f('0xc')][_0x0b5f('0xe')]);return _0x20212c(_0x1b8292[_0x0b5f('0xc')][_0x0b5f('0xe')]);}else{logger[_0x0b5f('0x7')](_0x0b5f('0x8'),_0x152742,_0x0b5f('0xa'));_0x20212c(_0x1b8292[_0x0b5f('0xf')]['message']);}})[_0x0b5f('0x10')](function(_0x31b18d){logger[_0x0b5f('0xc')](_0x0b5f('0x8'),_0x152742,_0x31b18d);_0x1746dd(_0x31b18d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index a6cd59f..a23fdaa 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 _0x4b01=['create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x369825,_0x5b9329){var _0x170dc5=function(_0xa9b251){while(--_0xa9b251){_0x369825['push'](_0x369825['shift']());}};_0x170dc5(++_0x5b9329);}(_0x4b01,0x164));var _0x14b0=function(_0x3009c0,_0x23fee0){_0x3009c0=_0x3009c0-0x0;var _0x37b9f3=_0x4b01[_0x3009c0];return _0x37b9f3;};'use strict';var multer=require(_0x14b0('0x0'));var util=require(_0x14b0('0x1'));var path=require(_0x14b0('0x2'));var timeout=require(_0x14b0('0x3'));var express=require(_0x14b0('0x4'));var router=express[_0x14b0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x14b0('0x6'));var config=require(_0x14b0('0x7'));var controller=require(_0x14b0('0x8'));router['get']('/',auth[_0x14b0('0x9')](),controller[_0x14b0('0xa')]);router[_0x14b0('0xb')](_0x14b0('0xc'),auth[_0x14b0('0x9')](),controller[_0x14b0('0xd')]);router[_0x14b0('0xb')](_0x14b0('0xe'),auth[_0x14b0('0x9')](),controller[_0x14b0('0xf')]);router['get'](_0x14b0('0x10'),auth['isAuthenticated'](),controller[_0x14b0('0x11')]);router[_0x14b0('0x12')]('/',auth[_0x14b0('0x9')](),controller[_0x14b0('0x13')]);router[_0x14b0('0x12')](_0x14b0('0xe'),auth[_0x14b0('0x9')](),controller[_0x14b0('0x14')]);router[_0x14b0('0x15')]('/:id',auth[_0x14b0('0x9')](),controller['update']);router[_0x14b0('0x16')]('/:id',auth[_0x14b0('0x9')](),controller[_0x14b0('0x17')]);module[_0x14b0('0x18')]=router; \ No newline at end of file +var _0x68a2=['show','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x68a2,0xe4));var _0x268a=function(_0x4de14b,_0x24b84c){_0x4de14b=_0x4de14b-0x0;var _0x48a46a=_0x68a2[_0x4de14b];return _0x48a46a;};'use strict';var multer=require(_0x268a('0x0'));var util=require(_0x268a('0x1'));var path=require(_0x268a('0x2'));var timeout=require(_0x268a('0x3'));var express=require(_0x268a('0x4'));var router=express[_0x268a('0x5')]();var auth=require(_0x268a('0x6'));var interaction=require(_0x268a('0x7'));var config=require(_0x268a('0x8'));var controller=require('./intSugarcrmAccount.controller');router[_0x268a('0x9')]('/',auth['isAuthenticated'](),controller[_0x268a('0xa')]);router[_0x268a('0x9')]('/:id',auth[_0x268a('0xb')](),controller[_0x268a('0xc')]);router['get']('/:id/configurations',auth[_0x268a('0xb')](),controller['getConfigurations']);router[_0x268a('0x9')](_0x268a('0xd'),auth[_0x268a('0xb')](),controller[_0x268a('0xe')]);router['post']('/',auth[_0x268a('0xb')](),controller[_0x268a('0xf')]);router[_0x268a('0x10')](_0x268a('0x11'),auth[_0x268a('0xb')](),controller[_0x268a('0x12')]);router['put'](_0x268a('0x13'),auth['isAuthenticated'](),controller[_0x268a('0x14')]);router[_0x268a('0x15')](_0x268a('0x13'),auth[_0x268a('0xb')](),controller[_0x268a('0x16')]);module[_0x268a('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 342e08f..18b25dc 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 _0x6dd1=['remoteUri','sequelize','STRING','username'];(function(_0x137c54,_0x30762f){var _0x35b09c=function(_0x509f18){while(--_0x509f18){_0x137c54['push'](_0x137c54['shift']());}};_0x35b09c(++_0x30762f);}(_0x6dd1,0x111));var _0x16dd=function(_0x2c7bcd,_0x5e6000){_0x2c7bcd=_0x2c7bcd-0x0;var _0x4efcd7=_0x6dd1[_0x2c7bcd];return _0x4efcd7;};'use strict';var Sequelize=require(_0x16dd('0x0'));module['exports']={'name':{'type':Sequelize[_0x16dd('0x1')]},'description':{'type':Sequelize[_0x16dd('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x16dd('0x2')},'password':{'type':Sequelize[_0x16dd('0x1')]},'remoteUri':{'type':Sequelize[_0x16dd('0x1')],'unique':_0x16dd('0x3')},'serverUrl':{'type':Sequelize[_0x16dd('0x1')]}}; \ No newline at end of file +var _0x4c22=['STRING','username','remoteUri'];(function(_0x4d7c0f,_0xf7c774){var _0xb0c4f8=function(_0x2fc448){while(--_0x2fc448){_0x4d7c0f['push'](_0x4d7c0f['shift']());}};_0xb0c4f8(++_0xf7c774);}(_0x4c22,0x168));var _0x24c2=function(_0xd58639,_0x5d2220){_0xd58639=_0xd58639-0x0;var _0x4df322=_0x4c22[_0xd58639];return _0x4df322;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x24c2('0x0')]},'username':{'type':Sequelize[_0x24c2('0x0')],'unique':_0x24c2('0x1')},'password':{'type':Sequelize[_0x24c2('0x0')]},'remoteUri':{'type':Sequelize[_0x24c2('0x0')],'unique':_0x24c2('0x2')},'serverUrl':{'type':Sequelize[_0x24c2('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 6ac8748..a4d5d75 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 _0x07f6=['login','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','module_fields','remove','includes','values','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','info','request\x20sent','debug','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','SugarcrmAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','filtears','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','pick','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','direction','username','remoteUri','slice','POST','format','%s%s','/service/v4_1/rest.php'];(function(_0x2655a6,_0x1f1920){var _0x384a51=function(_0x544180){while(--_0x544180){_0x2655a6['push'](_0x2655a6['shift']());}};_0x384a51(++_0x1f1920);}(_0x07f6,0x115));var _0x607f=function(_0x2d2258,_0x2ce510){_0x2d2258=_0x2d2258-0x0;var _0x18e155=_0x07f6[_0x2d2258];return _0x18e155;};'use strict';var pdf=require(_0x607f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x607f('0x1'));var jsonpatch=require(_0x607f('0x2'));var rp=require(_0x607f('0x3'));var moment=require(_0x607f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x607f('0x5'));var util=require(_0x607f('0x6'));var path=require(_0x607f('0x7'));var sox=require('sox');var csv=require(_0x607f('0x8'));var ejs=require(_0x607f('0x9'));var fs=require('fs');var _=require(_0x607f('0xa'));var squel=require(_0x607f('0xb'));var crypto=require('crypto');var jsforce=require(_0x607f('0xc'));var deskjs=require(_0x607f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x607f('0xe'));var Papa=require(_0x607f('0xf'));var Redis=require('ioredis');var authService=require(_0x607f('0x10'));var qs=require(_0x607f('0x11'));var as=require(_0x607f('0x12'));var hardwareService=require(_0x607f('0x13'));var logger=require(_0x607f('0x14'))(_0x607f('0x15'));var utils=require(_0x607f('0x16'));var config=require(_0x607f('0x17'));var licenseUtil=require(_0x607f('0x18'));var db=require(_0x607f('0x19'))['db'];var integrations=require(_0x607f('0x1a'));var jayson=require(_0x607f('0x1b'));var client=jayson[_0x607f('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e8f90,_0x5a6cc8,_0x17d1e1,_0x4a76ac){return new BPromise(function(_0x293141,_0xd7b3cf){var _0x4bc53f=_0x4a76ac||client;return _0x4bc53f[_0x607f('0x1d')](_0x1e8f90,_0x17d1e1)['then'](function(_0x377d7a){logger[_0x607f('0x1e')]('SugarcrmAccount,\x20%s,\x20%s',_0x5a6cc8,_0x607f('0x1f'));logger[_0x607f('0x20')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x5a6cc8,_0x607f('0x1f'),JSON[_0x607f('0x21')](_0x377d7a));if(_0x377d7a['error']){if(_0x377d7a[_0x607f('0x22')][_0x607f('0x23')]===0x1f4){logger[_0x607f('0x22')](_0x607f('0x24'),_0x5a6cc8,_0x377d7a[_0x607f('0x22')][_0x607f('0x25')]);return _0xd7b3cf(_0x377d7a[_0x607f('0x22')]['message']);}logger[_0x607f('0x22')](_0x607f('0x24'),_0x5a6cc8,_0x377d7a[_0x607f('0x22')]['message']);return _0x293141(_0x377d7a['error'][_0x607f('0x25')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x5a6cc8,_0x607f('0x1f'));_0x293141(_0x377d7a[_0x607f('0x26')]['message']);}})[_0x607f('0x27')](function(_0x4ae2c7){logger[_0x607f('0x22')](_0x607f('0x24'),_0x5a6cc8,_0x4ae2c7);_0xd7b3cf(_0x4ae2c7);});});}function respondWithStatusCode(_0x52ec3d,_0x5294be){_0x5294be=_0x5294be||0xcc;return function(_0x187299){if(_0x187299){return _0x52ec3d[_0x607f('0x28')](_0x5294be);}return _0x52ec3d[_0x607f('0x29')](_0x5294be)[_0x607f('0x2a')]();};}function respondWithResult(_0x437077,_0x2cb1d8){_0x2cb1d8=_0x2cb1d8||0xc8;return function(_0x541637){if(_0x541637){return _0x437077[_0x607f('0x29')](_0x2cb1d8)[_0x607f('0x2b')](_0x541637);}};}function respondWithFilteredResult(_0x453b17,_0x16a36a){return function(_0x2f69f6){if(_0x2f69f6){var _0x41fe13=_0x2f69f6[_0x607f('0x2c')],_0x1ea6f2=_0x16a36a['offset'],_0x3f566c=_0x16a36a[_0x607f('0x2d')]+_0x16a36a[_0x607f('0x2e')],_0x292244;if(_0x3f566c>=_0x41fe13){_0x3f566c=_0x41fe13;_0x292244=0xc8;}else{_0x292244=0xce;}_0x453b17[_0x607f('0x29')](_0x292244);return _0x453b17[_0x607f('0x2f')]('Content-Range',_0x1ea6f2+'-'+_0x3f566c+'/'+_0x41fe13)[_0x607f('0x2b')](_0x2f69f6);}return null;};}function patchUpdates(_0x457c09){return function(_0xbccc35){try{jsonpatch[_0x607f('0x30')](_0xbccc35,_0x457c09,!![]);}catch(_0x215574){return BPromise[_0x607f('0x31')](_0x215574);}return _0xbccc35[_0x607f('0x32')]();};}function saveUpdates(_0x2ae4f6,_0x63382a){return function(_0x4acd91){if(_0x4acd91){return _0x4acd91[_0x607f('0x33')](_0x2ae4f6)[_0x607f('0x34')](function(_0x54855b){return _0x54855b;});}return null;};}function removeEntity(_0x5dc555,_0x2a5392){return function(_0x41edf7){if(_0x41edf7){return _0x41edf7[_0x607f('0x35')]()['then'](function(){_0x5dc555['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5048ed,_0x14033e){return function(_0x43d56e){if(!_0x43d56e){_0x5048ed['sendStatus'](0x194);}return _0x43d56e;};}function handleError(_0x5e275b,_0x23ffcc){_0x23ffcc=_0x23ffcc||0x1f4;return function(_0x3a851f){logger[_0x607f('0x22')](_0x3a851f[_0x607f('0x36')]);if(_0x3a851f[_0x607f('0x37')]){delete _0x3a851f[_0x607f('0x37')];}_0x5e275b[_0x607f('0x29')](_0x23ffcc)[_0x607f('0x38')](_0x3a851f);};}exports[_0x607f('0x39')]=function(_0x21fd43,_0x47b1b1){var _0x2d8bd6={},_0x3e6fed={},_0x128342={'count':0x0,'rows':[]};var _0x12a890=_[_0x607f('0x3a')](db[_0x607f('0x3b')][_0x607f('0x3c')],function(_0x5db164){return{'name':_0x5db164['fieldName'],'type':_0x5db164[_0x607f('0x3d')][_0x607f('0x3e')]};});_0x3e6fed[_0x607f('0x3f')]=_[_0x607f('0x3a')](_0x12a890,_0x607f('0x37'));_0x3e6fed[_0x607f('0x40')]=_['keys'](_0x21fd43[_0x607f('0x40')]);_0x3e6fed[_0x607f('0x41')]=_[_0x607f('0x42')](_0x3e6fed[_0x607f('0x3f')],_0x3e6fed[_0x607f('0x40')]);_0x2d8bd6[_0x607f('0x43')]=_['intersection'](_0x3e6fed[_0x607f('0x3f')],qs[_0x607f('0x44')](_0x21fd43[_0x607f('0x40')][_0x607f('0x44')]));_0x2d8bd6[_0x607f('0x43')]=_0x2d8bd6[_0x607f('0x43')][_0x607f('0x45')]?_0x2d8bd6[_0x607f('0x43')]:_0x3e6fed['model'];if(!_0x21fd43[_0x607f('0x40')][_0x607f('0x46')](_0x607f('0x47'))){_0x2d8bd6['limit']=qs['limit'](_0x21fd43[_0x607f('0x40')][_0x607f('0x2e')]);_0x2d8bd6[_0x607f('0x2d')]=qs[_0x607f('0x2d')](_0x21fd43['query']['offset']);}_0x2d8bd6[_0x607f('0x48')]=qs['sort'](_0x21fd43[_0x607f('0x40')][_0x607f('0x49')]);_0x2d8bd6[_0x607f('0x4a')]=qs[_0x607f('0x41')](_['pick'](_0x21fd43[_0x607f('0x40')],_0x3e6fed[_0x607f('0x41')]),_0x12a890);if(_0x21fd43[_0x607f('0x40')][_0x607f('0x4b')]){_0x2d8bd6[_0x607f('0x4a')]=_['merge'](_0x2d8bd6['where'],{'$or':_[_0x607f('0x3a')](_0x12a890,function(_0x26e92e){if(_0x26e92e[_0x607f('0x3d')]!=='VIRTUAL'){var _0x499c33={};_0x499c33[_0x26e92e['name']]={'$like':'%'+_0x21fd43['query'][_0x607f('0x4b')]+'%'};return _0x499c33;}})});}_0x2d8bd6=_[_0x607f('0x4c')]({},_0x2d8bd6,_0x21fd43[_0x607f('0x4d')]);var _0x2a17f3={'where':_0x2d8bd6['where']};return db['SugarcrmAccount'][_0x607f('0x2c')](_0x2a17f3)[_0x607f('0x34')](function(_0x2d9a1a){_0x128342[_0x607f('0x2c')]=_0x2d9a1a;if(_0x21fd43[_0x607f('0x40')][_0x607f('0x4e')]){_0x2d8bd6[_0x607f('0x4f')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x607f('0x50')](_0x2d8bd6);})[_0x607f('0x34')](function(_0x382a30){_0x128342[_0x607f('0x51')]=_0x382a30;return _0x128342;})[_0x607f('0x34')](respondWithFilteredResult(_0x47b1b1,_0x2d8bd6))[_0x607f('0x27')](handleError(_0x47b1b1,null));};exports[_0x607f('0x52')]=function(_0x355dd6,_0x859442){var _0x2819d4={'raw':![],'where':{'id':_0x355dd6[_0x607f('0x53')]['id']}},_0x592b45={};_0x592b45[_0x607f('0x3f')]=_['keys'](db[_0x607f('0x3b')][_0x607f('0x3c')]);_0x592b45[_0x607f('0x40')]=_[_0x607f('0x54')](_0x355dd6[_0x607f('0x40')]);_0x592b45[_0x607f('0x55')]=_[_0x607f('0x42')](_0x592b45['model'],_0x592b45[_0x607f('0x40')]);_0x2819d4[_0x607f('0x43')]=_[_0x607f('0x42')](_0x592b45[_0x607f('0x3f')],qs[_0x607f('0x44')](_0x355dd6[_0x607f('0x40')]['fields']));_0x2819d4[_0x607f('0x43')]=_0x2819d4[_0x607f('0x43')][_0x607f('0x45')]?_0x2819d4[_0x607f('0x43')]:_0x592b45[_0x607f('0x3f')];if(_0x355dd6['query'][_0x607f('0x4e')]){_0x2819d4['include']=[{'all':!![]}];}_0x2819d4=_[_0x607f('0x4c')]({},_0x2819d4,_0x355dd6['options']);return db['SugarcrmAccount']['find'](_0x2819d4)['then'](handleEntityNotFound(_0x859442,null))[_0x607f('0x34')](respondWithResult(_0x859442,null))[_0x607f('0x27')](handleError(_0x859442,null));};exports[_0x607f('0x56')]=function(_0x3d97e0,_0x3c5356){return db[_0x607f('0x3b')][_0x607f('0x56')](_0x3d97e0[_0x607f('0x57')],{})['then'](respondWithResult(_0x3c5356,0xc9))['catch'](handleError(_0x3c5356,null));};exports[_0x607f('0x33')]=function(_0x5e8a71,_0x5cfe89){if(_0x5e8a71['body']['id']){delete _0x5e8a71['body']['id'];}return db[_0x607f('0x3b')][_0x607f('0x58')]({'where':{'id':_0x5e8a71[_0x607f('0x53')]['id']}})[_0x607f('0x34')](handleEntityNotFound(_0x5cfe89,null))[_0x607f('0x34')](saveUpdates(_0x5e8a71[_0x607f('0x57')],null))[_0x607f('0x34')](respondWithResult(_0x5cfe89,null))[_0x607f('0x27')](handleError(_0x5cfe89,null));};exports[_0x607f('0x35')]=function(_0x16f576,_0x3ce454){return db[_0x607f('0x3b')][_0x607f('0x58')]({'where':{'id':_0x16f576[_0x607f('0x53')]['id']}})[_0x607f('0x34')](handleEntityNotFound(_0x3ce454,null))[_0x607f('0x34')](removeEntity(_0x3ce454,null))[_0x607f('0x27')](handleError(_0x3ce454,null));};exports[_0x607f('0x59')]=function(_0x462135,_0x23d225,_0x443a39){var _0x1520c4={};var _0xa285ef={};var _0x40cf70;var _0x253a31;return db[_0x607f('0x3b')][_0x607f('0x5a')]({'where':{'id':_0x462135[_0x607f('0x53')]['id']}})[_0x607f('0x34')](handleEntityNotFound(_0x23d225,null))[_0x607f('0x34')](function(_0x813a33){if(_0x813a33){_0x40cf70=_0x813a33;_0xa285ef[_0x607f('0x3f')]=_[_0x607f('0x54')](db[_0x607f('0x5b')][_0x607f('0x3c')]);_0xa285ef[_0x607f('0x40')]=_['keys'](_0x462135[_0x607f('0x40')]);_0xa285ef[_0x607f('0x41')]=_['intersection'](_0xa285ef[_0x607f('0x3f')],_0xa285ef[_0x607f('0x40')]);_0x1520c4[_0x607f('0x43')]=_[_0x607f('0x42')](_0xa285ef['model'],qs['fields'](_0x462135[_0x607f('0x40')][_0x607f('0x44')]));_0x1520c4[_0x607f('0x43')]=_0x1520c4['attributes'][_0x607f('0x45')]?_0x1520c4[_0x607f('0x43')]:_0xa285ef[_0x607f('0x3f')];_0x1520c4[_0x607f('0x48')]=qs['sort'](_0x462135[_0x607f('0x40')]['sort']);_0x1520c4[_0x607f('0x4a')]=qs[_0x607f('0x41')](_[_0x607f('0x5c')](_0x462135[_0x607f('0x40')],_0xa285ef[_0x607f('0x41')]));if(_0x462135['query'][_0x607f('0x4b')]){_0x1520c4['where']=_[_0x607f('0x4c')](_0x1520c4[_0x607f('0x4a')],{'$or':_[_0x607f('0x3a')](_0x1520c4[_0x607f('0x43')],function(_0x4ed157){var _0x1c647b={};_0x1c647b[_0x4ed157]={'$like':'%'+_0x462135[_0x607f('0x40')][_0x607f('0x4b')]+'%'};return _0x1c647b;})});}_0x1520c4=_[_0x607f('0x4c')]({},_0x1520c4,_0x462135['options']);return _0x40cf70['getConfigurations'](_0x1520c4);}})[_0x607f('0x34')](function(_0x142ec8){if(_0x142ec8){_0x253a31=_0x142ec8[_0x607f('0x45')];if(!_0x462135[_0x607f('0x40')][_0x607f('0x46')]('nolimit')){_0x1520c4[_0x607f('0x2e')]=qs['limit'](_0x462135[_0x607f('0x40')][_0x607f('0x2e')]);_0x1520c4[_0x607f('0x2d')]=qs[_0x607f('0x2d')](_0x462135[_0x607f('0x40')][_0x607f('0x2d')]);}return _0x40cf70[_0x607f('0x59')](_0x1520c4);}})[_0x607f('0x34')](function(_0x2a9752){if(_0x2a9752){return _0x2a9752?{'count':_0x253a31,'rows':_0x2a9752}:null;}})[_0x607f('0x34')](respondWithResult(_0x23d225,null))[_0x607f('0x27')](handleError(_0x23d225,null));};exports[_0x607f('0x5d')]=function(_0x3e0327,_0x2789fc,_0x2610db){if(_0x3e0327[_0x607f('0x57')]['id']){delete _0x3e0327['body']['id'];}return db[_0x607f('0x3b')][_0x607f('0x5a')]({'where':{'id':_0x3e0327[_0x607f('0x53')]['id']}})['then'](handleEntityNotFound(_0x2789fc,null))[_0x607f('0x34')](function(_0x21727b){if(_0x21727b){_0x3e0327[_0x607f('0x57')][_0x607f('0x5e')]=_0x21727b['id'];_0x3e0327['body']['Subjects']=integrations[_0x607f('0x5f')](_0x3e0327[_0x607f('0x57')][_0x607f('0x60')],_0x3e0327[_0x607f('0x57')][_0x607f('0x3d')]);_0x3e0327[_0x607f('0x57')][_0x607f('0x61')]=integrations[_0x607f('0x62')](_0x3e0327[_0x607f('0x57')][_0x607f('0x60')],_0x3e0327[_0x607f('0x57')][_0x607f('0x3d')]);return db['SugarcrmConfiguration'][_0x607f('0x56')](_0x3e0327['body'],{'include':[{'model':db[_0x607f('0x63')],'as':_0x607f('0x64')},{'model':db['SugarcrmField'],'as':_0x607f('0x61')}]});}return null;})['then'](respondWithResult(_0x2789fc,null))[_0x607f('0x27')](handleError(_0x2789fc,null));};exports[_0x607f('0x65')]=function(_0x3afdd2,_0x5977a9,_0x38b616){var _0x5b5871='';var _0x312a93=['id','name',_0x607f('0x66'),'created_by',_0x607f('0x67'),_0x607f('0x68'),_0x607f('0x69'),_0x607f('0x6a'),_0x607f('0x6b'),'parent_type','parent_name',_0x607f('0x6c')];return db[_0x607f('0x3b')][_0x607f('0x5a')]({'where':{'id':_0x3afdd2[_0x607f('0x53')]['id']},'attributes':['id',_0x607f('0x6d'),'password',_0x607f('0x6e')]})['then'](handleEntityNotFound(_0x5977a9,null))['then'](function(_0x44470d){if(_0x44470d){_0x5b5871=_0x44470d['remoteUri'];var _0x498903=_0x5b5871[_0x607f('0x6f')](-0x1);if(_0x498903==='/'){_0x5b5871=_0x5b5871['substring'](0x0,_0x5b5871['lastIndexOf'](_0x498903));}return rp({'method':_0x607f('0x70'),'uri':util[_0x607f('0x71')](_0x607f('0x72'),_0x5b5871,_0x607f('0x73')),'json':!![],'form':{'method':_0x607f('0x74'),'input_type':'JSON','response_type':_0x607f('0x75'),'rest_data':JSON[_0x607f('0x21')]({'user_auth':{'user_name':_0x44470d[_0x607f('0x6d')],'password':_0x44470d[_0x607f('0x76')],'encryption':_0x607f('0x77')},'application':_0x607f('0x78')})}});}})[_0x607f('0x34')](function(_0x124e01){if(_0x124e01&&_0x124e01[_0x607f('0x37')]!==_0x607f('0x79')&&_0x124e01[_0x607f('0x37')]!=='Password\x20Expired'){return rp({'method':_0x607f('0x70'),'uri':util[_0x607f('0x71')](_0x607f('0x72'),_0x5b5871,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x607f('0x7a'),'input_type':'JSON','response_type':_0x607f('0x75'),'rest_data':JSON['stringify']({'session':_0x124e01['id'],'module_name':'Calls'})}})[_0x607f('0x34')](function(_0x1a2d29){if(_0x1a2d29){var _0x15afb4=_['values'](_0x1a2d29[_0x607f('0x7b')]);_[_0x607f('0x7c')](_0x15afb4,function(_0x5ded65){return _0x312a93[_0x607f('0x7d')](_0x5ded65['name']);});return{'count':_0x15afb4[_0x607f('0x45')],'rows':_[_0x607f('0x3a')](_0x15afb4,function(_0xa50b52){return{'id':_0xa50b52['name'],'name':_0xa50b52['label'],'custom':_['endsWith'](_0xa50b52[_0x607f('0x37')],'_c')?!![]:![],'options':_0xa50b52[_0x607f('0x4d')]?_[_0x607f('0x3a')](_[_0x607f('0x7e')](_0xa50b52[_0x607f('0x4d')]),function(_0x5913b6){return{'name':_0x5913b6[_0x607f('0x7f')],'value':_0x5913b6[_0x607f('0x37')]};}):[]};})};}})[_0x607f('0x34')](respondWithResult(_0x5977a9,null))['catch'](function(_0x37872f){var _0x1a9531=_0x3afdd2[_0x607f('0x40')][_0x607f('0x80')]?0x1f4:_0x37872f[_0x607f('0x81')]||0x1f4;logger[_0x607f('0x22')](_0x607f('0x82'),_0x607f('0x65'),_0x1a9531,JSON[_0x607f('0x21')](_0x37872f));delete _0x37872f[_0x607f('0x37')];if(_0x1a9531===0x191){_0x1a9531=0x190;}_0x5977a9[_0x607f('0x29')](_0x1a9531)[_0x607f('0x38')](_0x3afdd2[_0x607f('0x40')][_0x607f('0x80')]?{'message':'Wrong\x20credentials','statusCode':_0x37872f[_0x607f('0x81')]}:_0x37872f);});}else{var _0x4d2d3b=0x1f4;_0x5977a9[_0x607f('0x29')](_0x4d2d3b)[_0x607f('0x38')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x410b=['%s%s','/service/v4_1/rest.php','login','JSON','Invalid\x20Login','Password\x20Expired','POST','Calls','values','module_fields','remove','includes','label','endsWith','test','statusCode','send','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','../../components/integrations/configuration','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','json','count','offset','set','Content-Range','destroy','end','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','filtears','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','type','Subjects','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x410b,0x8c));var _0xb410=function(_0x5173b7,_0x544251){_0x5173b7=_0x5173b7-0x0;var _0x5edd88=_0x410b[_0x5173b7];return _0x5edd88;};'use strict';var pdf=require(_0xb410('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb410('0x1'));var zipdir=require(_0xb410('0x2'));var jsonpatch=require(_0xb410('0x3'));var rp=require('request-promise');var moment=require(_0xb410('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xb410('0x5'));var csv=require(_0xb410('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb410('0x7'));var squel=require('squel');var crypto=require(_0xb410('0x8'));var jsforce=require(_0xb410('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xb410('0x6'));var querystring=require(_0xb410('0xa'));var Papa=require(_0xb410('0xb'));var Redis=require(_0xb410('0xc'));var authService=require(_0xb410('0xd'));var qs=require(_0xb410('0xe'));var as=require(_0xb410('0xf'));var hardwareService=require(_0xb410('0x10'));var logger=require(_0xb410('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb410('0x12'));var db=require(_0xb410('0x13'))['db'];var integrations=require(_0xb410('0x14'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x50ebb9,_0x3ef671,_0x7c759e,_0x542262){return new BPromise(function(_0x3fbf6f,_0x423ec4){var _0x15f93d=_0x542262||client;return _0x15f93d[_0xb410('0x15')](_0x50ebb9,_0x7c759e)[_0xb410('0x16')](function(_0x572cf9){logger[_0xb410('0x17')](_0xb410('0x18'),_0x3ef671,_0xb410('0x19'));logger[_0xb410('0x1a')](_0xb410('0x1b'),_0x3ef671,'request\x20sent',JSON[_0xb410('0x1c')](_0x572cf9));if(_0x572cf9[_0xb410('0x1d')]){if(_0x572cf9[_0xb410('0x1d')]['code']===0x1f4){logger[_0xb410('0x1d')]('SugarcrmAccount,\x20%s,\x20%s',_0x3ef671,_0x572cf9[_0xb410('0x1d')][_0xb410('0x1e')]);return _0x423ec4(_0x572cf9[_0xb410('0x1d')][_0xb410('0x1e')]);}logger[_0xb410('0x1d')](_0xb410('0x18'),_0x3ef671,_0x572cf9['error'][_0xb410('0x1e')]);return _0x3fbf6f(_0x572cf9[_0xb410('0x1d')][_0xb410('0x1e')]);}else{logger['info'](_0xb410('0x18'),_0x3ef671,_0xb410('0x19'));_0x3fbf6f(_0x572cf9['result'][_0xb410('0x1e')]);}})['catch'](function(_0x2faa20){logger['error'](_0xb410('0x18'),_0x3ef671,_0x2faa20);_0x423ec4(_0x2faa20);});});}function respondWithStatusCode(_0x43e43d,_0x567d7e){_0x567d7e=_0x567d7e||0xcc;return function(_0x2027a8){if(_0x2027a8){return _0x43e43d[_0xb410('0x1f')](_0x567d7e);}return _0x43e43d[_0xb410('0x20')](_0x567d7e)['end']();};}function respondWithResult(_0x54c2eb,_0x43c08b){_0x43c08b=_0x43c08b||0xc8;return function(_0x22b10b){if(_0x22b10b){return _0x54c2eb['status'](_0x43c08b)[_0xb410('0x21')](_0x22b10b);}};}function respondWithFilteredResult(_0x44581b,_0x3feef4){return function(_0x3bc098){if(_0x3bc098){var _0x28a1e2=_0x3bc098[_0xb410('0x22')],_0xd74fca=_0x3feef4[_0xb410('0x23')],_0xf3539f=_0x3feef4[_0xb410('0x23')]+_0x3feef4['limit'],_0x446442;if(_0xf3539f>=_0x28a1e2){_0xf3539f=_0x28a1e2;_0x446442=0xc8;}else{_0x446442=0xce;}_0x44581b[_0xb410('0x20')](_0x446442);return _0x44581b[_0xb410('0x24')](_0xb410('0x25'),_0xd74fca+'-'+_0xf3539f+'/'+_0x28a1e2)['json'](_0x3bc098);}return null;};}function patchUpdates(_0x41a7ef){return function(_0x37f9d7){try{jsonpatch['apply'](_0x37f9d7,_0x41a7ef,!![]);}catch(_0x485517){return BPromise['reject'](_0x485517);}return _0x37f9d7['save']();};}function saveUpdates(_0x30abae,_0x4cac13){return function(_0x47d0ca){if(_0x47d0ca){return _0x47d0ca['update'](_0x30abae)[_0xb410('0x16')](function(_0xa90fca){return _0xa90fca;});}return null;};}function removeEntity(_0x26398a,_0x46827d){return function(_0x2fe86){if(_0x2fe86){return _0x2fe86[_0xb410('0x26')]()[_0xb410('0x16')](function(){_0x26398a['status'](0xcc)[_0xb410('0x27')]();});}};}function handleEntityNotFound(_0xa4c4e2,_0x410fd1){return function(_0x5cb4e2){if(!_0x5cb4e2){_0xa4c4e2[_0xb410('0x1f')](0x194);}return _0x5cb4e2;};}function handleError(_0x48a0d7,_0x18c150){_0x18c150=_0x18c150||0x1f4;return function(_0x133805){logger[_0xb410('0x1d')](_0x133805[_0xb410('0x28')]);if(_0x133805['name']){delete _0x133805[_0xb410('0x29')];}_0x48a0d7['status'](_0x18c150)['send'](_0x133805);};}exports[_0xb410('0x2a')]=function(_0x28963c,_0x61fa98){var _0x99a35e={},_0x1910ad={},_0x1f2d43={'count':0x0,'rows':[]};var _0x2e7c59=_[_0xb410('0x2b')](db[_0xb410('0x2c')][_0xb410('0x2d')],function(_0x2c79ca){return{'name':_0x2c79ca[_0xb410('0x2e')],'type':_0x2c79ca['type']['key']};});_0x1910ad[_0xb410('0x2f')]=_['map'](_0x2e7c59,_0xb410('0x29'));_0x1910ad['query']=_[_0xb410('0x30')](_0x28963c['query']);_0x1910ad[_0xb410('0x31')]=_[_0xb410('0x32')](_0x1910ad[_0xb410('0x2f')],_0x1910ad[_0xb410('0x33')]);_0x99a35e['attributes']=_['intersection'](_0x1910ad[_0xb410('0x2f')],qs[_0xb410('0x34')](_0x28963c[_0xb410('0x33')][_0xb410('0x34')]));_0x99a35e[_0xb410('0x35')]=_0x99a35e['attributes'][_0xb410('0x36')]?_0x99a35e['attributes']:_0x1910ad['model'];if(!_0x28963c[_0xb410('0x33')][_0xb410('0x37')](_0xb410('0x38'))){_0x99a35e[_0xb410('0x39')]=qs[_0xb410('0x39')](_0x28963c[_0xb410('0x33')][_0xb410('0x39')]);_0x99a35e[_0xb410('0x23')]=qs[_0xb410('0x23')](_0x28963c['query'][_0xb410('0x23')]);}_0x99a35e[_0xb410('0x3a')]=qs['sort'](_0x28963c[_0xb410('0x33')][_0xb410('0x3b')]);_0x99a35e[_0xb410('0x3c')]=qs[_0xb410('0x31')](_[_0xb410('0x3d')](_0x28963c['query'],_0x1910ad[_0xb410('0x31')]),_0x2e7c59);if(_0x28963c[_0xb410('0x33')][_0xb410('0x3e')]){_0x99a35e[_0xb410('0x3c')]=_[_0xb410('0x3f')](_0x99a35e[_0xb410('0x3c')],{'$or':_[_0xb410('0x2b')](_0x2e7c59,function(_0x292621){if(_0x292621['type']!==_0xb410('0x40')){var _0x3f364e={};_0x3f364e[_0x292621[_0xb410('0x29')]]={'$like':'%'+_0x28963c['query'][_0xb410('0x3e')]+'%'};return _0x3f364e;}})});}_0x99a35e=_[_0xb410('0x3f')]({},_0x99a35e,_0x28963c[_0xb410('0x41')]);var _0x193ccc={'where':_0x99a35e[_0xb410('0x3c')]};return db['SugarcrmAccount'][_0xb410('0x22')](_0x193ccc)[_0xb410('0x16')](function(_0x40bc0c){_0x1f2d43[_0xb410('0x22')]=_0x40bc0c;if(_0x28963c['query'][_0xb410('0x42')]){_0x99a35e[_0xb410('0x43')]=[{'all':!![]}];}return db[_0xb410('0x2c')][_0xb410('0x44')](_0x99a35e);})['then'](function(_0x408771){_0x1f2d43[_0xb410('0x45')]=_0x408771;return _0x1f2d43;})[_0xb410('0x16')](respondWithFilteredResult(_0x61fa98,_0x99a35e))[_0xb410('0x46')](handleError(_0x61fa98,null));};exports['show']=function(_0x2af3d6,_0x54ebf3){var _0x230e78={'raw':![],'where':{'id':_0x2af3d6['params']['id']}},_0x17cc81={};_0x17cc81[_0xb410('0x2f')]=_['keys'](db[_0xb410('0x2c')]['rawAttributes']);_0x17cc81[_0xb410('0x33')]=_[_0xb410('0x30')](_0x2af3d6[_0xb410('0x33')]);_0x17cc81[_0xb410('0x47')]=_[_0xb410('0x32')](_0x17cc81['model'],_0x17cc81['query']);_0x230e78[_0xb410('0x35')]=_[_0xb410('0x32')](_0x17cc81[_0xb410('0x2f')],qs[_0xb410('0x34')](_0x2af3d6['query'][_0xb410('0x34')]));_0x230e78[_0xb410('0x35')]=_0x230e78[_0xb410('0x35')][_0xb410('0x36')]?_0x230e78['attributes']:_0x17cc81[_0xb410('0x2f')];if(_0x2af3d6[_0xb410('0x33')][_0xb410('0x42')]){_0x230e78['include']=[{'all':!![]}];}_0x230e78=_[_0xb410('0x3f')]({},_0x230e78,_0x2af3d6[_0xb410('0x41')]);return db['SugarcrmAccount'][_0xb410('0x48')](_0x230e78)[_0xb410('0x16')](handleEntityNotFound(_0x54ebf3,null))[_0xb410('0x16')](respondWithResult(_0x54ebf3,null))[_0xb410('0x46')](handleError(_0x54ebf3,null));};exports[_0xb410('0x49')]=function(_0x952401,_0x1011fe){return db[_0xb410('0x2c')][_0xb410('0x49')](_0x952401[_0xb410('0x4a')],{})[_0xb410('0x16')](respondWithResult(_0x1011fe,0xc9))[_0xb410('0x46')](handleError(_0x1011fe,null));};exports['update']=function(_0x4a0ab3,_0x565740){if(_0x4a0ab3[_0xb410('0x4a')]['id']){delete _0x4a0ab3[_0xb410('0x4a')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x4a0ab3[_0xb410('0x4b')]['id']}})['then'](handleEntityNotFound(_0x565740,null))[_0xb410('0x16')](saveUpdates(_0x4a0ab3[_0xb410('0x4a')],null))['then'](respondWithResult(_0x565740,null))[_0xb410('0x46')](handleError(_0x565740,null));};exports[_0xb410('0x26')]=function(_0x30db92,_0x59e49d){return db[_0xb410('0x2c')][_0xb410('0x48')]({'where':{'id':_0x30db92[_0xb410('0x4b')]['id']}})['then'](handleEntityNotFound(_0x59e49d,null))[_0xb410('0x16')](removeEntity(_0x59e49d,null))[_0xb410('0x46')](handleError(_0x59e49d,null));};exports[_0xb410('0x4c')]=function(_0x4fc5b6,_0x418953,_0x1b4e2f){var _0x57f352={};var _0x412b51={};var _0x1ac9fd;var _0x406198;return db[_0xb410('0x2c')][_0xb410('0x4d')]({'where':{'id':_0x4fc5b6['params']['id']}})[_0xb410('0x16')](handleEntityNotFound(_0x418953,null))['then'](function(_0xaae107){if(_0xaae107){_0x1ac9fd=_0xaae107;_0x412b51[_0xb410('0x2f')]=_[_0xb410('0x30')](db[_0xb410('0x4e')][_0xb410('0x2d')]);_0x412b51[_0xb410('0x33')]=_[_0xb410('0x30')](_0x4fc5b6[_0xb410('0x33')]);_0x412b51[_0xb410('0x31')]=_[_0xb410('0x32')](_0x412b51[_0xb410('0x2f')],_0x412b51[_0xb410('0x33')]);_0x57f352[_0xb410('0x35')]=_[_0xb410('0x32')](_0x412b51[_0xb410('0x2f')],qs['fields'](_0x4fc5b6[_0xb410('0x33')][_0xb410('0x34')]));_0x57f352[_0xb410('0x35')]=_0x57f352[_0xb410('0x35')]['length']?_0x57f352['attributes']:_0x412b51[_0xb410('0x2f')];_0x57f352[_0xb410('0x3a')]=qs[_0xb410('0x3b')](_0x4fc5b6[_0xb410('0x33')][_0xb410('0x3b')]);_0x57f352[_0xb410('0x3c')]=qs[_0xb410('0x31')](_[_0xb410('0x3d')](_0x4fc5b6[_0xb410('0x33')],_0x412b51['filters']));if(_0x4fc5b6['query'][_0xb410('0x3e')]){_0x57f352['where']=_['merge'](_0x57f352[_0xb410('0x3c')],{'$or':_[_0xb410('0x2b')](_0x57f352['attributes'],function(_0x4c7669){var _0x59fd6e={};_0x59fd6e[_0x4c7669]={'$like':'%'+_0x4fc5b6[_0xb410('0x33')][_0xb410('0x3e')]+'%'};return _0x59fd6e;})});}_0x57f352=_[_0xb410('0x3f')]({},_0x57f352,_0x4fc5b6[_0xb410('0x41')]);return _0x1ac9fd[_0xb410('0x4c')](_0x57f352);}})[_0xb410('0x16')](function(_0x2f11c3){if(_0x2f11c3){_0x406198=_0x2f11c3[_0xb410('0x36')];if(!_0x4fc5b6[_0xb410('0x33')][_0xb410('0x37')](_0xb410('0x38'))){_0x57f352[_0xb410('0x39')]=qs[_0xb410('0x39')](_0x4fc5b6['query'][_0xb410('0x39')]);_0x57f352[_0xb410('0x23')]=qs[_0xb410('0x23')](_0x4fc5b6[_0xb410('0x33')][_0xb410('0x23')]);}return _0x1ac9fd[_0xb410('0x4c')](_0x57f352);}})[_0xb410('0x16')](function(_0x2244e3){if(_0x2244e3){return _0x2244e3?{'count':_0x406198,'rows':_0x2244e3}:null;}})[_0xb410('0x16')](respondWithResult(_0x418953,null))[_0xb410('0x46')](handleError(_0x418953,null));};exports[_0xb410('0x4f')]=function(_0x4f2def,_0x4e6d5a,_0x546223){if(_0x4f2def[_0xb410('0x4a')]['id']){delete _0x4f2def[_0xb410('0x4a')]['id'];}return db[_0xb410('0x2c')][_0xb410('0x4d')]({'where':{'id':_0x4f2def[_0xb410('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4e6d5a,null))[_0xb410('0x16')](function(_0x276e59){if(_0x276e59){_0x4f2def[_0xb410('0x4a')][_0xb410('0x50')]=_0x276e59['id'];_0x4f2def[_0xb410('0x4a')]['Subjects']=integrations[_0xb410('0x51')](_0x4f2def[_0xb410('0x4a')]['channel'],_0x4f2def['body']['type']);_0x4f2def['body'][_0xb410('0x52')]=integrations[_0xb410('0x53')](_0x4f2def[_0xb410('0x4a')][_0xb410('0x54')],_0x4f2def['body'][_0xb410('0x55')]);return db['SugarcrmConfiguration'][_0xb410('0x49')](_0x4f2def[_0xb410('0x4a')],{'include':[{'model':db['SugarcrmField'],'as':_0xb410('0x56')},{'model':db[_0xb410('0x57')],'as':'Descriptions'}]});}return null;})[_0xb410('0x16')](respondWithResult(_0x4e6d5a,null))[_0xb410('0x46')](handleError(_0x4e6d5a,null));};exports[_0xb410('0x58')]=function(_0x30a75f,_0x5bd6f4,_0x4ee564){var _0x247ed4='';var _0x1e2a85=['id',_0xb410('0x29'),_0xb410('0x59'),'created_by',_0xb410('0x5a'),_0xb410('0x5b'),'duration_hours',_0xb410('0x5c'),_0xb410('0x5d'),_0xb410('0x5e'),_0xb410('0x5f'),_0xb410('0x60')];return db[_0xb410('0x2c')][_0xb410('0x4d')]({'where':{'id':_0x30a75f[_0xb410('0x4b')]['id']},'attributes':['id',_0xb410('0x61'),_0xb410('0x62'),_0xb410('0x63')]})[_0xb410('0x16')](handleEntityNotFound(_0x5bd6f4,null))[_0xb410('0x16')](function(_0x5670bb){if(_0x5670bb){_0x247ed4=_0x5670bb[_0xb410('0x63')];var _0x237dd7=_0x247ed4[_0xb410('0x64')](-0x1);if(_0x237dd7==='/'){_0x247ed4=_0x247ed4[_0xb410('0x65')](0x0,_0x247ed4[_0xb410('0x66')](_0x237dd7));}return rp({'method':'POST','uri':util[_0xb410('0x67')](_0xb410('0x68'),_0x247ed4,_0xb410('0x69')),'json':!![],'form':{'method':_0xb410('0x6a'),'input_type':_0xb410('0x6b'),'response_type':_0xb410('0x6b'),'rest_data':JSON[_0xb410('0x1c')]({'user_auth':{'user_name':_0x5670bb[_0xb410('0x61')],'password':_0x5670bb[_0xb410('0x62')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xb410('0x16')](function(_0x2cc14e){if(_0x2cc14e&&_0x2cc14e['name']!==_0xb410('0x6c')&&_0x2cc14e['name']!==_0xb410('0x6d')){return rp({'method':_0xb410('0x6e'),'uri':util[_0xb410('0x67')](_0xb410('0x68'),_0x247ed4,_0xb410('0x69')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xb410('0x6b'),'response_type':_0xb410('0x6b'),'rest_data':JSON[_0xb410('0x1c')]({'session':_0x2cc14e['id'],'module_name':_0xb410('0x6f')})}})['then'](function(_0x193be7){if(_0x193be7){var _0x355581=_[_0xb410('0x70')](_0x193be7[_0xb410('0x71')]);_[_0xb410('0x72')](_0x355581,function(_0x1fffc0){return _0x1e2a85[_0xb410('0x73')](_0x1fffc0['name']);});return{'count':_0x355581[_0xb410('0x36')],'rows':_['map'](_0x355581,function(_0x11fb28){return{'id':_0x11fb28[_0xb410('0x29')],'name':_0x11fb28[_0xb410('0x74')],'custom':_[_0xb410('0x75')](_0x11fb28[_0xb410('0x29')],'_c')?!![]:![],'options':_0x11fb28['options']?_['map'](_['values'](_0x11fb28[_0xb410('0x41')]),function(_0x458fcc){return{'name':_0x458fcc['value'],'value':_0x458fcc[_0xb410('0x29')]};}):[]};})};}})['then'](respondWithResult(_0x5bd6f4,null))[_0xb410('0x46')](function(_0x1d8cf2){var _0x468d16=_0x30a75f['query'][_0xb410('0x76')]?0x1f4:_0x1d8cf2[_0xb410('0x77')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x468d16,JSON['stringify'](_0x1d8cf2));delete _0x1d8cf2[_0xb410('0x29')];if(_0x468d16===0x191){_0x468d16=0x190;}_0x5bd6f4[_0xb410('0x20')](_0x468d16)[_0xb410('0x78')](_0x30a75f[_0xb410('0x33')][_0xb410('0x76')]?{'message':_0xb410('0x79'),'statusCode':_0x1d8cf2['statusCode']}:_0x1d8cf2);});}else{var _0x2efc4a=0x1f4;_0x5bd6f4[_0xb410('0x20')](_0x2efc4a)[_0xb410('0x78')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index e6a6797..f5422d1 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 _0x17e6=['../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x32b2d9,_0x432029){var _0xee33e=function(_0x5ac696){while(--_0x5ac696){_0x32b2d9['push'](_0x32b2d9['shift']());}};_0xee33e(++_0x432029);}(_0x17e6,0xba));var _0x617e=function(_0x1faa6e,_0x423197){_0x1faa6e=_0x1faa6e-0x0;var _0x15fc1d=_0x17e6[_0x1faa6e];return _0x15fc1d;};'use strict';var _=require(_0x617e('0x0'));var util=require(_0x617e('0x1'));var logger=require(_0x617e('0x2'))(_0x617e('0x3'));var moment=require(_0x617e('0x4'));var BPromise=require(_0x617e('0x5'));var rp=require(_0x617e('0x6'));var fs=require('fs');var path=require(_0x617e('0x7'));var rimraf=require(_0x617e('0x8'));var config=require(_0x617e('0x9'));var attributes=require(_0x617e('0xa'));var integrations=require('../../components/integrations/configuration');module[_0x617e('0xb')]=function(_0x32bda1,_0xd7bced){return _0x32bda1[_0x617e('0xc')](_0x617e('0xd'),attributes,{'tableName':_0x617e('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a65=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','../../config/logger'];(function(_0x60af13,_0x1fafc5){var _0x20c631=function(_0x1f69d6){while(--_0x1f69d6){_0x60af13['push'](_0x60af13['shift']());}};_0x20c631(++_0x1fafc5);}(_0x3a65,0x144));var _0x53a6=function(_0x45f0bf,_0x42346e){_0x45f0bf=_0x45f0bf-0x0;var _0x58b873=_0x3a65[_0x45f0bf];return _0x58b873;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x53a6('0x0'))(_0x53a6('0x1'));var moment=require(_0x53a6('0x2'));var BPromise=require(_0x53a6('0x3'));var rp=require(_0x53a6('0x4'));var fs=require('fs');var path=require(_0x53a6('0x5'));var rimraf=require(_0x53a6('0x6'));var config=require(_0x53a6('0x7'));var attributes=require(_0x53a6('0x8'));var integrations=require(_0x53a6('0x9'));module[_0x53a6('0xa')]=function(_0x1f3ab5,_0x22dd85){return _0x1f3ab5[_0x53a6('0xb')]('SugarcrmAccount',attributes,{'tableName':_0x53a6('0xc'),'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 d97764e..b885830 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 _0x7a30=['client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSugarcrmAccount','findAll','options','raw','where','attributes','limit','model','include','map','SugarcrmAccount','ShowSugarcrmAccount','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5def80,_0x4da06d){var _0x7f278b=function(_0x529832){while(--_0x529832){_0x5def80['push'](_0x5def80['shift']());}};_0x7f278b(++_0x4da06d);}(_0x7a30,0x15a));var _0x07a3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7a30[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x07a3('0x0'));var util=require('util');var moment=require(_0x07a3('0x1'));var BPromise=require('bluebird');var rs=require(_0x07a3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x07a3('0x3'))['db'];var utils=require(_0x07a3('0x4'));var logger=require(_0x07a3('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x07a3('0x6')][_0x07a3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4175d2,_0x4435fb,_0x4a180e){return new BPromise(function(_0x455247,_0x84523e){return client[_0x07a3('0x8')](_0x4175d2,_0x4a180e)[_0x07a3('0x9')](function(_0x23f81f){logger[_0x07a3('0xa')](_0x07a3('0xb'),_0x4435fb,_0x07a3('0xc'));logger[_0x07a3('0xd')](_0x07a3('0xe'),_0x4435fb,_0x07a3('0xc'),JSON[_0x07a3('0xf')](_0x23f81f));if(_0x23f81f[_0x07a3('0x10')]){if(_0x23f81f[_0x07a3('0x10')][_0x07a3('0x11')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x4435fb,_0x23f81f['error'][_0x07a3('0x12')]);return _0x84523e(_0x23f81f[_0x07a3('0x10')][_0x07a3('0x12')]);}logger[_0x07a3('0x10')](_0x07a3('0xb'),_0x4435fb,_0x23f81f[_0x07a3('0x10')][_0x07a3('0x12')]);return _0x455247(_0x23f81f[_0x07a3('0x10')][_0x07a3('0x12')]);}else{logger[_0x07a3('0xa')]('SugarcrmAccount,\x20%s,\x20%s',_0x4435fb,_0x07a3('0xc'));_0x455247(_0x23f81f['result'][_0x07a3('0x12')]);}})[_0x07a3('0x13')](function(_0x492bf9){logger[_0x07a3('0x10')](_0x07a3('0xb'),_0x4435fb,_0x492bf9);_0x84523e(_0x492bf9);});});}exports[_0x07a3('0x14')]=function(_0x58dae1){var _0x4c5b4d=this;return new Promise(function(_0x31b1a2,_0x58836a){return db['SugarcrmAccount'][_0x07a3('0x15')]({'raw':_0x58dae1[_0x07a3('0x16')]?_0x58dae1[_0x07a3('0x16')][_0x07a3('0x17')]===undefined?!![]:![]:!![],'where':_0x58dae1[_0x07a3('0x16')]?_0x58dae1['options'][_0x07a3('0x18')]||null:null,'attributes':_0x58dae1[_0x07a3('0x16')]?_0x58dae1[_0x07a3('0x16')][_0x07a3('0x19')]||null:null,'limit':_0x58dae1['options']?_0x58dae1[_0x07a3('0x16')][_0x07a3('0x1a')]||null:null,'include':_0x58dae1[_0x07a3('0x16')]?_0x58dae1['options']['include']?_['map'](_0x58dae1[_0x07a3('0x16')]['include'],function(_0x2e522b){return{'model':db[_0x2e522b[_0x07a3('0x1b')]],'as':_0x2e522b['as'],'attributes':_0x2e522b['attributes'],'include':_0x2e522b[_0x07a3('0x1c')]?_[_0x07a3('0x1d')](_0x2e522b[_0x07a3('0x1c')],function(_0x522dd0){return{'model':db[_0x522dd0[_0x07a3('0x1b')]],'as':_0x522dd0['as'],'attributes':_0x522dd0[_0x07a3('0x19')],'include':_0x522dd0[_0x07a3('0x1c')]?_[_0x07a3('0x1d')](_0x522dd0[_0x07a3('0x1c')],function(_0x5bcd7c){return{'model':db[_0x5bcd7c['model']],'as':_0x5bcd7c['as'],'attributes':_0x5bcd7c[_0x07a3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x07a3('0x9')](function(_0x59444f){logger[_0x07a3('0xa')](_0x07a3('0x14'),_0x58dae1);logger['debug'](_0x07a3('0x14'),_0x58dae1,JSON[_0x07a3('0xf')](_0x59444f));_0x31b1a2(_0x59444f);})[_0x07a3('0x13')](function(_0x4f4737){logger[_0x07a3('0x10')](_0x07a3('0x14'),_0x4f4737[_0x07a3('0x12')],_0x58dae1);_0x58836a(_0x4c5b4d[_0x07a3('0x10')](0x1f4,_0x4f4737[_0x07a3('0x12')]));});});};exports['ShowSugarcrmAccount']=function(_0x34a929){var _0x253d26=this;return new Promise(function(_0x44e9c5,_0x1f4b04){return db[_0x07a3('0x1e')]['find']({'raw':_0x34a929[_0x07a3('0x16')]?_0x34a929[_0x07a3('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x34a929['options']?_0x34a929[_0x07a3('0x16')][_0x07a3('0x18')]||null:null,'attributes':_0x34a929['options']?_0x34a929[_0x07a3('0x16')][_0x07a3('0x19')]||null:null,'include':_0x34a929[_0x07a3('0x16')]?_0x34a929[_0x07a3('0x16')][_0x07a3('0x1c')]?_[_0x07a3('0x1d')](_0x34a929[_0x07a3('0x16')][_0x07a3('0x1c')],function(_0x5ef721){return{'model':db[_0x5ef721[_0x07a3('0x1b')]],'as':_0x5ef721['as'],'attributes':_0x5ef721['attributes'],'include':_0x5ef721[_0x07a3('0x1c')]?_['map'](_0x5ef721[_0x07a3('0x1c')],function(_0x53a9e2){return{'model':db[_0x53a9e2[_0x07a3('0x1b')]],'as':_0x53a9e2['as'],'attributes':_0x53a9e2[_0x07a3('0x19')],'include':_0x53a9e2[_0x07a3('0x1c')]?_[_0x07a3('0x1d')](_0x53a9e2['include'],function(_0x466033){return{'model':db[_0x466033['model']],'as':_0x466033['as'],'attributes':_0x466033[_0x07a3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x07a3('0x9')](function(_0x2600ff){logger[_0x07a3('0xa')]('ShowSugarcrmAccount',_0x34a929);logger['debug'](_0x07a3('0x1f'),_0x34a929,JSON['stringify'](_0x2600ff));_0x44e9c5(_0x2600ff);})[_0x07a3('0x13')](function(_0x26c137){logger[_0x07a3('0x10')](_0x07a3('0x1f'),_0x26c137['message'],_0x34a929);_0x1f4b04(_0x253d26[_0x07a3('0x10')](0x1f4,_0x26c137[_0x07a3('0x12')]));});});}; \ No newline at end of file +var _0x96af=['stringify','error','code','message','result','catch','SugarcrmAccount','findAll','options','raw','where','include','map','model','attributes','GetSugarcrmAccount','ShowSugarcrmAccount','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x96af,0x7a));var _0xf96a=function(_0x24e0c9,_0x284109){_0x24e0c9=_0x24e0c9-0x0;var _0x4448f0=_0x96af[_0x24e0c9];return _0x4448f0;};'use strict';var _=require(_0xf96a('0x0'));var util=require(_0xf96a('0x1'));var moment=require('moment');var BPromise=require(_0xf96a('0x2'));var rs=require(_0xf96a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf96a('0x4'))['db'];var utils=require(_0xf96a('0x5'));var logger=require(_0xf96a('0x6'))('rpc');var config=require(_0xf96a('0x7'));var jayson=require(_0xf96a('0x8'));var client=jayson[_0xf96a('0x9')][_0xf96a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b5524,_0x51323d,_0x117044){return new BPromise(function(_0x1cc929,_0x2ceddf){return client[_0xf96a('0xb')](_0x2b5524,_0x117044)[_0xf96a('0xc')](function(_0x257320){logger[_0xf96a('0xd')](_0xf96a('0xe'),_0x51323d,_0xf96a('0xf'));logger[_0xf96a('0x10')](_0xf96a('0x11'),_0x51323d,_0xf96a('0xf'),JSON[_0xf96a('0x12')](_0x257320));if(_0x257320['error']){if(_0x257320[_0xf96a('0x13')][_0xf96a('0x14')]===0x1f4){logger[_0xf96a('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x51323d,_0x257320[_0xf96a('0x13')][_0xf96a('0x15')]);return _0x2ceddf(_0x257320[_0xf96a('0x13')][_0xf96a('0x15')]);}logger[_0xf96a('0x13')](_0xf96a('0xe'),_0x51323d,_0x257320[_0xf96a('0x13')][_0xf96a('0x15')]);return _0x1cc929(_0x257320[_0xf96a('0x13')][_0xf96a('0x15')]);}else{logger[_0xf96a('0xd')](_0xf96a('0xe'),_0x51323d,'request\x20sent');_0x1cc929(_0x257320[_0xf96a('0x16')][_0xf96a('0x15')]);}})[_0xf96a('0x17')](function(_0xc5ea73){logger['error'](_0xf96a('0xe'),_0x51323d,_0xc5ea73);_0x2ceddf(_0xc5ea73);});});}exports['GetSugarcrmAccount']=function(_0x1454d8){var _0x2f7c43=this;return new Promise(function(_0x55c250,_0x30552c){return db[_0xf96a('0x18')][_0xf96a('0x19')]({'raw':_0x1454d8[_0xf96a('0x1a')]?_0x1454d8[_0xf96a('0x1a')][_0xf96a('0x1b')]===undefined?!![]:![]:!![],'where':_0x1454d8[_0xf96a('0x1a')]?_0x1454d8[_0xf96a('0x1a')][_0xf96a('0x1c')]||null:null,'attributes':_0x1454d8[_0xf96a('0x1a')]?_0x1454d8[_0xf96a('0x1a')]['attributes']||null:null,'limit':_0x1454d8[_0xf96a('0x1a')]?_0x1454d8['options']['limit']||null:null,'include':_0x1454d8[_0xf96a('0x1a')]?_0x1454d8[_0xf96a('0x1a')][_0xf96a('0x1d')]?_[_0xf96a('0x1e')](_0x1454d8[_0xf96a('0x1a')][_0xf96a('0x1d')],function(_0x40e476){return{'model':db[_0x40e476[_0xf96a('0x1f')]],'as':_0x40e476['as'],'attributes':_0x40e476[_0xf96a('0x20')],'include':_0x40e476[_0xf96a('0x1d')]?_['map'](_0x40e476[_0xf96a('0x1d')],function(_0x479426){return{'model':db[_0x479426['model']],'as':_0x479426['as'],'attributes':_0x479426['attributes'],'include':_0x479426[_0xf96a('0x1d')]?_[_0xf96a('0x1e')](_0x479426[_0xf96a('0x1d')],function(_0x143658){return{'model':db[_0x143658['model']],'as':_0x143658['as'],'attributes':_0x143658[_0xf96a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf96a('0xc')](function(_0x6bc656){logger[_0xf96a('0xd')]('GetSugarcrmAccount',_0x1454d8);logger[_0xf96a('0x10')](_0xf96a('0x21'),_0x1454d8,JSON[_0xf96a('0x12')](_0x6bc656));_0x55c250(_0x6bc656);})[_0xf96a('0x17')](function(_0x179bf9){logger[_0xf96a('0x13')](_0xf96a('0x21'),_0x179bf9[_0xf96a('0x15')],_0x1454d8);_0x30552c(_0x2f7c43['error'](0x1f4,_0x179bf9['message']));});});};exports[_0xf96a('0x22')]=function(_0x119b6d){var _0x3b624d=this;return new Promise(function(_0x55005b,_0x29b113){return db[_0xf96a('0x18')]['find']({'raw':_0x119b6d[_0xf96a('0x1a')]?_0x119b6d[_0xf96a('0x1a')][_0xf96a('0x1b')]===undefined?!![]:![]:!![],'where':_0x119b6d[_0xf96a('0x1a')]?_0x119b6d[_0xf96a('0x1a')][_0xf96a('0x1c')]||null:null,'attributes':_0x119b6d[_0xf96a('0x1a')]?_0x119b6d['options'][_0xf96a('0x20')]||null:null,'include':_0x119b6d[_0xf96a('0x1a')]?_0x119b6d[_0xf96a('0x1a')][_0xf96a('0x1d')]?_[_0xf96a('0x1e')](_0x119b6d[_0xf96a('0x1a')][_0xf96a('0x1d')],function(_0x115408){return{'model':db[_0x115408[_0xf96a('0x1f')]],'as':_0x115408['as'],'attributes':_0x115408[_0xf96a('0x20')],'include':_0x115408[_0xf96a('0x1d')]?_[_0xf96a('0x1e')](_0x115408[_0xf96a('0x1d')],function(_0x4efc68){return{'model':db[_0x4efc68[_0xf96a('0x1f')]],'as':_0x4efc68['as'],'attributes':_0x4efc68[_0xf96a('0x20')],'include':_0x4efc68['include']?_['map'](_0x4efc68[_0xf96a('0x1d')],function(_0x296513){return{'model':db[_0x296513['model']],'as':_0x296513['as'],'attributes':_0x296513[_0xf96a('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f046b){logger[_0xf96a('0xd')]('ShowSugarcrmAccount',_0x119b6d);logger['debug'](_0xf96a('0x22'),_0x119b6d,JSON[_0xf96a('0x12')](_0x3f046b));_0x55005b(_0x3f046b);})['catch'](function(_0x13a94d){logger[_0xf96a('0x13')]('ShowSugarcrmAccount',_0x13a94d[_0xf96a('0x15')],_0x119b6d);_0x29b113(_0x3b624d['error'](0x1f4,_0x13a94d[_0xf96a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 6949c82..9556e89 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 _0x191e=['../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x443396,_0x543437){var _0x2c17e9=function(_0x28b0bb){while(--_0x28b0bb){_0x443396['push'](_0x443396['shift']());}};_0x2c17e9(++_0x543437);}(_0x191e,0x1c4));var _0xe191=function(_0x5777e9,_0x4efa7c){_0x5777e9=_0x5777e9-0x0;var _0x28f943=_0x191e[_0x5777e9];return _0x28f943;};'use strict';var multer=require(_0xe191('0x0'));var util=require(_0xe191('0x1'));var path=require(_0xe191('0x2'));var timeout=require(_0xe191('0x3'));var express=require(_0xe191('0x4'));var router=express[_0xe191('0x5')]();var auth=require(_0xe191('0x6'));var interaction=require(_0xe191('0x7'));var config=require(_0xe191('0x8'));var controller=require(_0xe191('0x9'));router['get']('/',auth[_0xe191('0xa')](),controller[_0xe191('0xb')]);router[_0xe191('0xc')](_0xe191('0xd'),auth[_0xe191('0xa')](),controller[_0xe191('0xe')]);router[_0xe191('0xc')](_0xe191('0xf'),auth['isAuthenticated'](),controller[_0xe191('0x10')]);router[_0xe191('0xc')](_0xe191('0x11'),auth[_0xe191('0xa')](),controller[_0xe191('0x12')]);router[_0xe191('0xc')](_0xe191('0x13'),auth[_0xe191('0xa')](),controller[_0xe191('0x14')]);router[_0xe191('0x15')]('/',auth[_0xe191('0xa')](),controller[_0xe191('0x16')]);router['put'](_0xe191('0xd'),auth[_0xe191('0xa')](),controller[_0xe191('0x17')]);router[_0xe191('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xe191('0x19')]);module[_0xe191('0x1a')]=router; \ No newline at end of file +var _0xe11c=['/:id/subjects','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','/:id','show','/:id/fields','getFields'];(function(_0x119940,_0x4f6830){var _0x158581=function(_0x2ce545){while(--_0x2ce545){_0x119940['push'](_0x119940['shift']());}};_0x158581(++_0x4f6830);}(_0xe11c,0xcf));var _0xce11=function(_0x2426c9,_0xecaec2){_0x2426c9=_0x2426c9-0x0;var _0x87f510=_0xe11c[_0x2426c9];return _0x87f510;};'use strict';var multer=require(_0xce11('0x0'));var util=require(_0xce11('0x1'));var path=require(_0xce11('0x2'));var timeout=require(_0xce11('0x3'));var express=require(_0xce11('0x4'));var router=express[_0xce11('0x5')]();var auth=require(_0xce11('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0xce11('0x7')]('/',auth[_0xce11('0x8')](),controller['index']);router[_0xce11('0x7')](_0xce11('0x9'),auth[_0xce11('0x8')](),controller[_0xce11('0xa')]);router['get'](_0xce11('0xb'),auth[_0xce11('0x8')](),controller[_0xce11('0xc')]);router[_0xce11('0x7')](_0xce11('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xce11('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0xce11('0xe')]('/',auth[_0xce11('0x8')](),controller[_0xce11('0xf')]);router[_0xce11('0x10')]('/:id',auth[_0xce11('0x8')](),controller[_0xce11('0x11')]);router['delete'](_0xce11('0x9'),auth['isAuthenticated'](),controller[_0xce11('0x12')]);module[_0xce11('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 3212e50..419056f 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 _0xf81e=['sequelize','STRING'];(function(_0x425e81,_0x1874e9){var _0x53047f=function(_0x1ca088){while(--_0x1ca088){_0x425e81['push'](_0x425e81['shift']());}};_0x53047f(++_0x1874e9);}(_0xf81e,0xa8));var _0xef81=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf81e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xef81('0x0'));module['exports']={'name':{'type':Sequelize[_0xef81('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdb76=['sequelize','STRING'];(function(_0x1de2bc,_0x5ec2a7){var _0x29facd=function(_0x205f16){while(--_0x205f16){_0x1de2bc['push'](_0x1de2bc['shift']());}};_0x29facd(++_0x5ec2a7);}(_0xdb76,0x10a));var _0x6db7=function(_0xddd61f,_0x4096dd){_0xddd61f=_0xddd61f-0x0;var _0x199b56=_0xdb76[_0xddd61f];return _0x199b56;};'use strict';var Sequelize=require(_0x6db7('0x0'));module['exports']={'name':{'type':Sequelize[_0x6db7('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 48737ed..4352675 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 _0x7959=['squel','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/license/util','../../mysqldb','jayson/promise','http','request','info','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','keys','merge','find','create','body','params','getFields','findOne','SugarcrmField','length','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','sox','ejs','lodash'];(function(_0x15de20,_0x3d5fae){var _0x27d0e9=function(_0x43be44){while(--_0x43be44){_0x15de20['push'](_0x15de20['shift']());}};_0x27d0e9(++_0x3d5fae);}(_0x7959,0x15f));var _0x9795=function(_0x53a34d,_0x3c700c){_0x53a34d=_0x53a34d-0x0;var _0x21c841=_0x7959[_0x53a34d];return _0x21c841;};'use strict';var pdf=require(_0x9795('0x0'));var emlformat=require(_0x9795('0x1'));var rimraf=require(_0x9795('0x2'));var zipdir=require(_0x9795('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9795('0x4'));var BPromise=require(_0x9795('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9795('0x6'));var csv=require('to-csv');var ejs=require(_0x9795('0x7'));var fs=require('fs');var _=require(_0x9795('0x8'));var squel=require(_0x9795('0x9'));var crypto=require(_0x9795('0xa'));var jsforce=require(_0x9795('0xb'));var deskjs=require(_0x9795('0xc'));var toCsv=require(_0x9795('0xd'));var querystring=require(_0x9795('0xe'));var Papa=require(_0x9795('0xf'));var Redis=require(_0x9795('0x10'));var authService=require(_0x9795('0x11'));var qs=require(_0x9795('0x12'));var as=require(_0x9795('0x13'));var hardwareService=require(_0x9795('0x14'));var logger=require('../../config/logger')(_0x9795('0x15'));var utils=require(_0x9795('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9795('0x17'));var db=require(_0x9795('0x18'))['db'];var jayson=require(_0x9795('0x19'));var client=jayson['client'][_0x9795('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2140e8,_0x253838,_0x279d3d,_0x58e991){return new BPromise(function(_0x9998d2,_0x2f16bf){var _0xdcd591=_0x58e991||client;return _0xdcd591[_0x9795('0x1b')](_0x2140e8,_0x279d3d)['then'](function(_0x22ca7b){logger[_0x9795('0x1c')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x253838,_0x9795('0x1d'));logger['debug'](_0x9795('0x1e'),_0x253838,_0x9795('0x1d'),JSON[_0x9795('0x1f')](_0x22ca7b));if(_0x22ca7b[_0x9795('0x20')]){if(_0x22ca7b['error']['code']===0x1f4){logger[_0x9795('0x20')](_0x9795('0x21'),_0x253838,_0x22ca7b[_0x9795('0x20')][_0x9795('0x22')]);return _0x2f16bf(_0x22ca7b['error'][_0x9795('0x22')]);}logger['error'](_0x9795('0x21'),_0x253838,_0x22ca7b[_0x9795('0x20')]['message']);return _0x9998d2(_0x22ca7b['error'][_0x9795('0x22')]);}else{logger[_0x9795('0x1c')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x253838,_0x9795('0x1d'));_0x9998d2(_0x22ca7b[_0x9795('0x23')][_0x9795('0x22')]);}})['catch'](function(_0x1dcf57){logger[_0x9795('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x253838,_0x1dcf57);_0x2f16bf(_0x1dcf57);});});}function respondWithStatusCode(_0x45eb12,_0x14abc9){_0x14abc9=_0x14abc9||0xcc;return function(_0x4e95f7){if(_0x4e95f7){return _0x45eb12[_0x9795('0x24')](_0x14abc9);}return _0x45eb12[_0x9795('0x25')](_0x14abc9)[_0x9795('0x26')]();};}function respondWithResult(_0x3e1c04,_0x2c1ee4){_0x2c1ee4=_0x2c1ee4||0xc8;return function(_0x1389af){if(_0x1389af){return _0x3e1c04[_0x9795('0x25')](_0x2c1ee4)[_0x9795('0x27')](_0x1389af);}};}function respondWithFilteredResult(_0x13717b,_0xc31d83){return function(_0x5ee865){if(_0x5ee865){var _0x199560=_0x5ee865[_0x9795('0x28')],_0x45c80c=_0xc31d83[_0x9795('0x29')],_0x5d2d59=_0xc31d83[_0x9795('0x29')]+_0xc31d83[_0x9795('0x2a')],_0x383a31;if(_0x5d2d59>=_0x199560){_0x5d2d59=_0x199560;_0x383a31=0xc8;}else{_0x383a31=0xce;}_0x13717b[_0x9795('0x25')](_0x383a31);return _0x13717b['set'](_0x9795('0x2b'),_0x45c80c+'-'+_0x5d2d59+'/'+_0x199560)[_0x9795('0x27')](_0x5ee865);}return null;};}function patchUpdates(_0x4fdd60){return function(_0x2d80e8){try{jsonpatch['apply'](_0x2d80e8,_0x4fdd60,!![]);}catch(_0x483de0){return BPromise[_0x9795('0x2c')](_0x483de0);}return _0x2d80e8[_0x9795('0x2d')]();};}function saveUpdates(_0x49d21d,_0x5caaaa){return function(_0x3c6586){if(_0x3c6586){return _0x3c6586[_0x9795('0x2e')](_0x49d21d)[_0x9795('0x2f')](function(_0x55cb16){return _0x55cb16;});}return null;};}function removeEntity(_0x2855e5,_0x1414a8){return function(_0x500c99){if(_0x500c99){return _0x500c99[_0x9795('0x30')]()[_0x9795('0x2f')](function(){_0x2855e5[_0x9795('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2699dc,_0x42951d){return function(_0xa822e8){if(!_0xa822e8){_0x2699dc[_0x9795('0x24')](0x194);}return _0xa822e8;};}function handleError(_0x39fdcb,_0xf82a9f){_0xf82a9f=_0xf82a9f||0x1f4;return function(_0x4df323){logger[_0x9795('0x20')](_0x4df323[_0x9795('0x31')]);if(_0x4df323['name']){delete _0x4df323[_0x9795('0x32')];}_0x39fdcb[_0x9795('0x25')](_0xf82a9f)[_0x9795('0x33')](_0x4df323);};}exports[_0x9795('0x34')]=function(_0x40b7ce,_0x11d0ca){var _0x1bdf9a={},_0x4350e9={},_0x445181={'count':0x0,'rows':[]};var _0x23b43d=_[_0x9795('0x35')](db[_0x9795('0x36')][_0x9795('0x37')],function(_0x4894ed){return{'name':_0x4894ed[_0x9795('0x38')],'type':_0x4894ed[_0x9795('0x39')]['key']};});_0x4350e9['model']=_[_0x9795('0x35')](_0x23b43d,_0x9795('0x32'));_0x4350e9[_0x9795('0x3a')]=_['keys'](_0x40b7ce[_0x9795('0x3a')]);_0x4350e9[_0x9795('0x3b')]=_[_0x9795('0x3c')](_0x4350e9['model'],_0x4350e9[_0x9795('0x3a')]);_0x1bdf9a['attributes']=_[_0x9795('0x3c')](_0x4350e9[_0x9795('0x3d')],qs[_0x9795('0x3e')](_0x40b7ce[_0x9795('0x3a')][_0x9795('0x3e')]));_0x1bdf9a[_0x9795('0x3f')]=_0x1bdf9a[_0x9795('0x3f')]['length']?_0x1bdf9a[_0x9795('0x3f')]:_0x4350e9['model'];if(!_0x40b7ce['query'][_0x9795('0x40')](_0x9795('0x41'))){_0x1bdf9a[_0x9795('0x2a')]=qs[_0x9795('0x2a')](_0x40b7ce[_0x9795('0x3a')][_0x9795('0x2a')]);_0x1bdf9a[_0x9795('0x29')]=qs[_0x9795('0x29')](_0x40b7ce[_0x9795('0x3a')][_0x9795('0x29')]);}_0x1bdf9a[_0x9795('0x42')]=qs['sort'](_0x40b7ce[_0x9795('0x3a')][_0x9795('0x43')]);_0x1bdf9a[_0x9795('0x44')]=qs[_0x9795('0x3b')](_[_0x9795('0x45')](_0x40b7ce[_0x9795('0x3a')],_0x4350e9[_0x9795('0x3b')]),_0x23b43d);if(_0x40b7ce[_0x9795('0x3a')][_0x9795('0x46')]){_0x1bdf9a[_0x9795('0x44')]=_['merge'](_0x1bdf9a[_0x9795('0x44')],{'$or':_[_0x9795('0x35')](_0x23b43d,function(_0x1aca64){if(_0x1aca64[_0x9795('0x39')]!=='VIRTUAL'){var _0x4e84bb={};_0x4e84bb[_0x1aca64[_0x9795('0x32')]]={'$like':'%'+_0x40b7ce[_0x9795('0x3a')][_0x9795('0x46')]+'%'};return _0x4e84bb;}})});}_0x1bdf9a=_['merge']({},_0x1bdf9a,_0x40b7ce[_0x9795('0x47')]);var _0x2451b7={'where':_0x1bdf9a['where']};return db[_0x9795('0x36')][_0x9795('0x28')](_0x2451b7)[_0x9795('0x2f')](function(_0x254871){_0x445181[_0x9795('0x28')]=_0x254871;if(_0x40b7ce['query'][_0x9795('0x48')]){_0x1bdf9a[_0x9795('0x49')]=[{'all':!![]}];}return db[_0x9795('0x36')][_0x9795('0x4a')](_0x1bdf9a);})[_0x9795('0x2f')](function(_0x3e2c50){_0x445181[_0x9795('0x4b')]=_0x3e2c50;return _0x445181;})[_0x9795('0x2f')](respondWithFilteredResult(_0x11d0ca,_0x1bdf9a))[_0x9795('0x4c')](handleError(_0x11d0ca,null));};exports[_0x9795('0x4d')]=function(_0x521d76,_0x47eaa0){var _0x320fc9={'raw':![],'where':{'id':_0x521d76['params']['id']}},_0x437575={};_0x437575['model']=_[_0x9795('0x4e')](db['SugarcrmConfiguration'][_0x9795('0x37')]);_0x437575[_0x9795('0x3a')]=_['keys'](_0x521d76['query']);_0x437575['filtears']=_[_0x9795('0x3c')](_0x437575[_0x9795('0x3d')],_0x437575[_0x9795('0x3a')]);_0x320fc9['attributes']=_['intersection'](_0x437575[_0x9795('0x3d')],qs[_0x9795('0x3e')](_0x521d76['query'][_0x9795('0x3e')]));_0x320fc9[_0x9795('0x3f')]=_0x320fc9[_0x9795('0x3f')]['length']?_0x320fc9[_0x9795('0x3f')]:_0x437575[_0x9795('0x3d')];if(_0x521d76['query'][_0x9795('0x48')]){_0x320fc9[_0x9795('0x49')]=[{'all':!![]}];}_0x320fc9=_[_0x9795('0x4f')]({},_0x320fc9,_0x521d76[_0x9795('0x47')]);return db['SugarcrmConfiguration'][_0x9795('0x50')](_0x320fc9)[_0x9795('0x2f')](handleEntityNotFound(_0x47eaa0,null))[_0x9795('0x2f')](respondWithResult(_0x47eaa0,null))[_0x9795('0x4c')](handleError(_0x47eaa0,null));};exports[_0x9795('0x51')]=function(_0x34d895,_0x191359){return db[_0x9795('0x36')]['create'](_0x34d895[_0x9795('0x52')],{})[_0x9795('0x2f')](respondWithResult(_0x191359,0xc9))['catch'](handleError(_0x191359,null));};exports[_0x9795('0x2e')]=function(_0x13679c,_0x318c91){if(_0x13679c[_0x9795('0x52')]['id']){delete _0x13679c[_0x9795('0x52')]['id'];}return db[_0x9795('0x36')][_0x9795('0x50')]({'where':{'id':_0x13679c['params']['id']}})[_0x9795('0x2f')](handleEntityNotFound(_0x318c91,null))[_0x9795('0x2f')](saveUpdates(_0x13679c[_0x9795('0x52')],null))[_0x9795('0x2f')](respondWithResult(_0x318c91,null))['catch'](handleError(_0x318c91,null));};exports['destroy']=function(_0x6b63a8,_0x1acab2){return db[_0x9795('0x36')][_0x9795('0x50')]({'where':{'id':_0x6b63a8[_0x9795('0x53')]['id']}})['then'](handleEntityNotFound(_0x1acab2,null))[_0x9795('0x2f')](removeEntity(_0x1acab2,null))[_0x9795('0x4c')](handleError(_0x1acab2,null));};exports[_0x9795('0x54')]=function(_0x239672,_0x2c5fa4,_0x430fe6){var _0xce8c90={};var _0x2ee10e={};var _0x443f32;var _0x55df59;return db[_0x9795('0x36')][_0x9795('0x55')]({'where':{'id':_0x239672[_0x9795('0x53')]['id']}})[_0x9795('0x2f')](handleEntityNotFound(_0x2c5fa4,null))[_0x9795('0x2f')](function(_0x486527){if(_0x486527){_0x443f32=_0x486527;_0x2ee10e[_0x9795('0x3d')]=_[_0x9795('0x4e')](db[_0x9795('0x56')]['rawAttributes']);_0x2ee10e['query']=_[_0x9795('0x4e')](_0x239672['query']);_0x2ee10e[_0x9795('0x3b')]=_['intersection'](_0x2ee10e[_0x9795('0x3d')],_0x2ee10e[_0x9795('0x3a')]);_0xce8c90[_0x9795('0x3f')]=_[_0x9795('0x3c')](_0x2ee10e['model'],qs['fields'](_0x239672[_0x9795('0x3a')]['fields']));_0xce8c90[_0x9795('0x3f')]=_0xce8c90[_0x9795('0x3f')]['length']?_0xce8c90['attributes']:_0x2ee10e[_0x9795('0x3d')];_0xce8c90[_0x9795('0x42')]=qs[_0x9795('0x43')](_0x239672[_0x9795('0x3a')][_0x9795('0x43')]);_0xce8c90[_0x9795('0x44')]=qs[_0x9795('0x3b')](_[_0x9795('0x45')](_0x239672['query'],_0x2ee10e[_0x9795('0x3b')]));if(_0x239672[_0x9795('0x3a')]['filter']){_0xce8c90[_0x9795('0x44')]=_['merge'](_0xce8c90[_0x9795('0x44')],{'$or':_[_0x9795('0x35')](_0xce8c90['attributes'],function(_0x73da62){var _0x5919c5={};_0x5919c5[_0x73da62]={'$like':'%'+_0x239672[_0x9795('0x3a')][_0x9795('0x46')]+'%'};return _0x5919c5;})});}_0xce8c90=_[_0x9795('0x4f')]({},_0xce8c90,_0x239672[_0x9795('0x47')]);return _0x443f32[_0x9795('0x54')](_0xce8c90);}})[_0x9795('0x2f')](function(_0x5731a1){if(_0x5731a1){_0x55df59=_0x5731a1[_0x9795('0x57')];if(!_0x239672[_0x9795('0x3a')][_0x9795('0x40')]('nolimit')){_0xce8c90[_0x9795('0x2a')]=qs[_0x9795('0x2a')](_0x239672['query'][_0x9795('0x2a')]);_0xce8c90[_0x9795('0x29')]=qs['offset'](_0x239672[_0x9795('0x3a')][_0x9795('0x29')]);}return _0x443f32[_0x9795('0x54')](_0xce8c90);}})['then'](function(_0x204b12){if(_0x204b12){return _0x204b12?{'count':_0x55df59,'rows':_0x204b12}:null;}})[_0x9795('0x2f')](respondWithResult(_0x2c5fa4,null))[_0x9795('0x4c')](handleError(_0x2c5fa4,null));};exports[_0x9795('0x58')]=function(_0x19b271,_0x20cdaa,_0x83907b){var _0x376ba8={};var _0x56eb9f={};var _0x522d7b;var _0xe3736b;return db[_0x9795('0x36')]['findOne']({'where':{'id':_0x19b271[_0x9795('0x53')]['id']}})['then'](handleEntityNotFound(_0x20cdaa,null))[_0x9795('0x2f')](function(_0x1ff0e1){if(_0x1ff0e1){_0x522d7b=_0x1ff0e1;_0x56eb9f['model']=_[_0x9795('0x4e')](db[_0x9795('0x56')][_0x9795('0x37')]);_0x56eb9f['query']=_[_0x9795('0x4e')](_0x19b271[_0x9795('0x3a')]);_0x56eb9f['filters']=_[_0x9795('0x3c')](_0x56eb9f[_0x9795('0x3d')],_0x56eb9f[_0x9795('0x3a')]);_0x376ba8[_0x9795('0x3f')]=_['intersection'](_0x56eb9f[_0x9795('0x3d')],qs['fields'](_0x19b271['query'][_0x9795('0x3e')]));_0x376ba8[_0x9795('0x3f')]=_0x376ba8[_0x9795('0x3f')][_0x9795('0x57')]?_0x376ba8[_0x9795('0x3f')]:_0x56eb9f[_0x9795('0x3d')];_0x376ba8[_0x9795('0x42')]=qs[_0x9795('0x43')](_0x19b271[_0x9795('0x3a')][_0x9795('0x43')]);_0x376ba8[_0x9795('0x44')]=qs['filters'](_[_0x9795('0x45')](_0x19b271[_0x9795('0x3a')],_0x56eb9f[_0x9795('0x3b')]));if(_0x19b271[_0x9795('0x3a')][_0x9795('0x46')]){_0x376ba8[_0x9795('0x44')]=_['merge'](_0x376ba8[_0x9795('0x44')],{'$or':_['map'](_0x376ba8[_0x9795('0x3f')],function(_0x2b008d){var _0x212106={};_0x212106[_0x2b008d]={'$like':'%'+_0x19b271['query'][_0x9795('0x46')]+'%'};return _0x212106;})});}_0x376ba8=_[_0x9795('0x4f')]({},_0x376ba8,_0x19b271[_0x9795('0x47')]);return _0x522d7b[_0x9795('0x58')](_0x376ba8);}})[_0x9795('0x2f')](function(_0x3a92fd){if(_0x3a92fd){_0xe3736b=_0x3a92fd['length'];if(!_0x19b271[_0x9795('0x3a')][_0x9795('0x40')](_0x9795('0x41'))){_0x376ba8['limit']=qs[_0x9795('0x2a')](_0x19b271[_0x9795('0x3a')][_0x9795('0x2a')]);_0x376ba8['offset']=qs['offset'](_0x19b271[_0x9795('0x3a')][_0x9795('0x29')]);}return _0x522d7b[_0x9795('0x58')](_0x376ba8);}})[_0x9795('0x2f')](function(_0x1e7096){if(_0x1e7096){return _0x1e7096?{'count':_0xe3736b,'rows':_0x1e7096}:null;}})[_0x9795('0x2f')](respondWithResult(_0x20cdaa,null))[_0x9795('0x4c')](handleError(_0x20cdaa,null));};exports[_0x9795('0x59')]=function(_0x21bd77,_0x52fb3c,_0x246df3){var _0x415e75={};var _0x553f4a={};var _0x12510a;var _0xa592f3;return db[_0x9795('0x36')][_0x9795('0x55')]({'where':{'id':_0x21bd77['params']['id']}})[_0x9795('0x2f')](handleEntityNotFound(_0x52fb3c,null))['then'](function(_0x3cbd18){if(_0x3cbd18){_0x12510a=_0x3cbd18;_0x553f4a[_0x9795('0x3d')]=_['keys'](db[_0x9795('0x56')][_0x9795('0x37')]);_0x553f4a[_0x9795('0x3a')]=_['keys'](_0x21bd77[_0x9795('0x3a')]);_0x553f4a[_0x9795('0x3b')]=_[_0x9795('0x3c')](_0x553f4a[_0x9795('0x3d')],_0x553f4a['query']);_0x415e75[_0x9795('0x3f')]=_['intersection'](_0x553f4a['model'],qs[_0x9795('0x3e')](_0x21bd77[_0x9795('0x3a')]['fields']));_0x415e75[_0x9795('0x3f')]=_0x415e75[_0x9795('0x3f')][_0x9795('0x57')]?_0x415e75['attributes']:_0x553f4a[_0x9795('0x3d')];_0x415e75[_0x9795('0x42')]=qs[_0x9795('0x43')](_0x21bd77[_0x9795('0x3a')][_0x9795('0x43')]);_0x415e75['where']=qs[_0x9795('0x3b')](_[_0x9795('0x45')](_0x21bd77[_0x9795('0x3a')],_0x553f4a[_0x9795('0x3b')]));if(_0x21bd77['query'][_0x9795('0x46')]){_0x415e75[_0x9795('0x44')]=_['merge'](_0x415e75[_0x9795('0x44')],{'$or':_[_0x9795('0x35')](_0x415e75[_0x9795('0x3f')],function(_0x530170){var _0x4858d2={};_0x4858d2[_0x530170]={'$like':'%'+_0x21bd77[_0x9795('0x3a')]['filter']+'%'};return _0x4858d2;})});}_0x415e75=_[_0x9795('0x4f')]({},_0x415e75,_0x21bd77[_0x9795('0x47')]);return _0x12510a['getDescriptions'](_0x415e75);}})[_0x9795('0x2f')](function(_0x2048e2){if(_0x2048e2){_0xa592f3=_0x2048e2[_0x9795('0x57')];if(!_0x21bd77[_0x9795('0x3a')]['hasOwnProperty'](_0x9795('0x41'))){_0x415e75[_0x9795('0x2a')]=qs[_0x9795('0x2a')](_0x21bd77[_0x9795('0x3a')]['limit']);_0x415e75[_0x9795('0x29')]=qs[_0x9795('0x29')](_0x21bd77[_0x9795('0x3a')][_0x9795('0x29')]);}return _0x12510a[_0x9795('0x59')](_0x415e75);}})[_0x9795('0x2f')](function(_0x126843){if(_0x126843){return _0x126843?{'count':_0xa592f3,'rows':_0x126843}:null;}})[_0x9795('0x2f')](respondWithResult(_0x52fb3c,null))[_0x9795('0x4c')](handleError(_0x52fb3c,null));}; \ No newline at end of file +var _0x38c9=['getSubjects','SugarcrmField','getDescriptions','pick','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','lodash','squel','jsforce','desk.js','querystring','../../config/license/hardware','../../config/utils','../../config/license/util','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','offset','json','apply','save','update','destroy','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','filter','merge','where','options','count','includeAll','include','params','keys','filtears','find','create','body','findOne','order','getFields'];(function(_0x20f175,_0x85b40e){var _0x502434=function(_0x5866b3){while(--_0x5866b3){_0x20f175['push'](_0x20f175['shift']());}};_0x502434(++_0x85b40e);}(_0x38c9,0x199));var _0x938c=function(_0xf55e73,_0x3fecc5){_0xf55e73=_0xf55e73-0x0;var _0x116b99=_0x38c9[_0xf55e73];return _0x116b99;};'use strict';var pdf=require(_0x938c('0x0'));var emlformat=require(_0x938c('0x1'));var rimraf=require(_0x938c('0x2'));var zipdir=require(_0x938c('0x3'));var jsonpatch=require(_0x938c('0x4'));var rp=require(_0x938c('0x5'));var moment=require('moment');var BPromise=require(_0x938c('0x6'));var Mustache=require('mustache');var util=require(_0x938c('0x7'));var path=require('path');var sox=require(_0x938c('0x8'));var csv=require('to-csv');var ejs=require(_0x938c('0x9'));var fs=require('fs');var _=require(_0x938c('0xa'));var squel=require(_0x938c('0xb'));var crypto=require('crypto');var jsforce=require(_0x938c('0xc'));var deskjs=require(_0x938c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x938c('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x938c('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x938c('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x938c('0x11'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x938c('0x12')][_0x938c('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x4c3f28,_0xc33839,_0x3fd608,_0x299cf8){return new BPromise(function(_0xa106c8,_0x159c08){var _0x1e7eb1=_0x299cf8||client;return _0x1e7eb1[_0x938c('0x14')](_0x4c3f28,_0x3fd608)[_0x938c('0x15')](function(_0x2b90e7){logger['info'](_0x938c('0x16'),_0xc33839,_0x938c('0x17'));logger[_0x938c('0x18')](_0x938c('0x19'),_0xc33839,_0x938c('0x17'),JSON[_0x938c('0x1a')](_0x2b90e7));if(_0x2b90e7[_0x938c('0x1b')]){if(_0x2b90e7['error']['code']===0x1f4){logger['error'](_0x938c('0x16'),_0xc33839,_0x2b90e7[_0x938c('0x1b')][_0x938c('0x1c')]);return _0x159c08(_0x2b90e7[_0x938c('0x1b')][_0x938c('0x1c')]);}logger[_0x938c('0x1b')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xc33839,_0x2b90e7[_0x938c('0x1b')][_0x938c('0x1c')]);return _0xa106c8(_0x2b90e7[_0x938c('0x1b')]['message']);}else{logger[_0x938c('0x1d')](_0x938c('0x16'),_0xc33839,'request\x20sent');_0xa106c8(_0x2b90e7[_0x938c('0x1e')]['message']);}})[_0x938c('0x1f')](function(_0x565381){logger[_0x938c('0x1b')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xc33839,_0x565381);_0x159c08(_0x565381);});});}function respondWithStatusCode(_0x4af122,_0x4de91d){_0x4de91d=_0x4de91d||0xcc;return function(_0x383e73){if(_0x383e73){return _0x4af122[_0x938c('0x20')](_0x4de91d);}return _0x4af122[_0x938c('0x21')](_0x4de91d)[_0x938c('0x22')]();};}function respondWithResult(_0x2e4fe6,_0x52c3e4){_0x52c3e4=_0x52c3e4||0xc8;return function(_0x139175){if(_0x139175){return _0x2e4fe6['status'](_0x52c3e4)['json'](_0x139175);}};}function respondWithFilteredResult(_0x4cf4df,_0xce9de6){return function(_0x58d82d){if(_0x58d82d){var _0x57fda4=_0x58d82d['count'],_0x52ec1a=_0xce9de6[_0x938c('0x23')],_0x5a77a0=_0xce9de6[_0x938c('0x23')]+_0xce9de6['limit'],_0x313e98;if(_0x5a77a0>=_0x57fda4){_0x5a77a0=_0x57fda4;_0x313e98=0xc8;}else{_0x313e98=0xce;}_0x4cf4df[_0x938c('0x21')](_0x313e98);return _0x4cf4df['set']('Content-Range',_0x52ec1a+'-'+_0x5a77a0+'/'+_0x57fda4)[_0x938c('0x24')](_0x58d82d);}return null;};}function patchUpdates(_0x23f9e9){return function(_0x249795){try{jsonpatch[_0x938c('0x25')](_0x249795,_0x23f9e9,!![]);}catch(_0x5523fd){return BPromise['reject'](_0x5523fd);}return _0x249795[_0x938c('0x26')]();};}function saveUpdates(_0x33a3af,_0x1f79f1){return function(_0x268db0){if(_0x268db0){return _0x268db0[_0x938c('0x27')](_0x33a3af)[_0x938c('0x15')](function(_0x119abc){return _0x119abc;});}return null;};}function removeEntity(_0x49e0f1,_0x4b6a30){return function(_0x46c646){if(_0x46c646){return _0x46c646[_0x938c('0x28')]()['then'](function(){_0x49e0f1[_0x938c('0x21')](0xcc)[_0x938c('0x22')]();});}};}function handleEntityNotFound(_0x43b76d,_0x930450){return function(_0x1603ac){if(!_0x1603ac){_0x43b76d[_0x938c('0x20')](0x194);}return _0x1603ac;};}function handleError(_0xc9af6d,_0x4ac520){_0x4ac520=_0x4ac520||0x1f4;return function(_0x3c562e){logger[_0x938c('0x1b')](_0x3c562e['stack']);if(_0x3c562e[_0x938c('0x29')]){delete _0x3c562e[_0x938c('0x29')];}_0xc9af6d['status'](_0x4ac520)[_0x938c('0x2a')](_0x3c562e);};}exports[_0x938c('0x2b')]=function(_0x5ed23b,_0x1fb323){var _0x230cc8={},_0x66af44={},_0xe94d3a={'count':0x0,'rows':[]};var _0x34cefa=_[_0x938c('0x2c')](db[_0x938c('0x2d')][_0x938c('0x2e')],function(_0x2224e8){return{'name':_0x2224e8[_0x938c('0x2f')],'type':_0x2224e8[_0x938c('0x30')][_0x938c('0x31')]};});_0x66af44[_0x938c('0x32')]=_[_0x938c('0x2c')](_0x34cefa,_0x938c('0x29'));_0x66af44['query']=_['keys'](_0x5ed23b[_0x938c('0x33')]);_0x66af44[_0x938c('0x34')]=_[_0x938c('0x35')](_0x66af44[_0x938c('0x32')],_0x66af44['query']);_0x230cc8['attributes']=_[_0x938c('0x35')](_0x66af44[_0x938c('0x32')],qs[_0x938c('0x36')](_0x5ed23b[_0x938c('0x33')]['fields']));_0x230cc8[_0x938c('0x37')]=_0x230cc8[_0x938c('0x37')][_0x938c('0x38')]?_0x230cc8[_0x938c('0x37')]:_0x66af44[_0x938c('0x32')];if(!_0x5ed23b[_0x938c('0x33')][_0x938c('0x39')](_0x938c('0x3a'))){_0x230cc8[_0x938c('0x3b')]=qs[_0x938c('0x3b')](_0x5ed23b[_0x938c('0x33')]['limit']);_0x230cc8[_0x938c('0x23')]=qs[_0x938c('0x23')](_0x5ed23b[_0x938c('0x33')][_0x938c('0x23')]);}_0x230cc8['order']=qs['sort'](_0x5ed23b[_0x938c('0x33')][_0x938c('0x3c')]);_0x230cc8['where']=qs['filters'](_['pick'](_0x5ed23b[_0x938c('0x33')],_0x66af44[_0x938c('0x34')]),_0x34cefa);if(_0x5ed23b[_0x938c('0x33')][_0x938c('0x3d')]){_0x230cc8['where']=_[_0x938c('0x3e')](_0x230cc8[_0x938c('0x3f')],{'$or':_[_0x938c('0x2c')](_0x34cefa,function(_0x57c239){if(_0x57c239[_0x938c('0x30')]!=='VIRTUAL'){var _0x3f30a4={};_0x3f30a4[_0x57c239['name']]={'$like':'%'+_0x5ed23b[_0x938c('0x33')][_0x938c('0x3d')]+'%'};return _0x3f30a4;}})});}_0x230cc8=_[_0x938c('0x3e')]({},_0x230cc8,_0x5ed23b[_0x938c('0x40')]);var _0x47d14c={'where':_0x230cc8['where']};return db[_0x938c('0x2d')]['count'](_0x47d14c)[_0x938c('0x15')](function(_0x5cb237){_0xe94d3a[_0x938c('0x41')]=_0x5cb237;if(_0x5ed23b['query'][_0x938c('0x42')]){_0x230cc8[_0x938c('0x43')]=[{'all':!![]}];}return db[_0x938c('0x2d')]['findAll'](_0x230cc8);})[_0x938c('0x15')](function(_0x47e5bc){_0xe94d3a['rows']=_0x47e5bc;return _0xe94d3a;})[_0x938c('0x15')](respondWithFilteredResult(_0x1fb323,_0x230cc8))[_0x938c('0x1f')](handleError(_0x1fb323,null));};exports['show']=function(_0x43b644,_0x2a8988){var _0x314dfc={'raw':![],'where':{'id':_0x43b644[_0x938c('0x44')]['id']}},_0x492c14={};_0x492c14[_0x938c('0x32')]=_[_0x938c('0x45')](db[_0x938c('0x2d')][_0x938c('0x2e')]);_0x492c14[_0x938c('0x33')]=_['keys'](_0x43b644[_0x938c('0x33')]);_0x492c14[_0x938c('0x46')]=_[_0x938c('0x35')](_0x492c14[_0x938c('0x32')],_0x492c14['query']);_0x314dfc[_0x938c('0x37')]=_[_0x938c('0x35')](_0x492c14[_0x938c('0x32')],qs[_0x938c('0x36')](_0x43b644[_0x938c('0x33')][_0x938c('0x36')]));_0x314dfc[_0x938c('0x37')]=_0x314dfc[_0x938c('0x37')]['length']?_0x314dfc[_0x938c('0x37')]:_0x492c14['model'];if(_0x43b644[_0x938c('0x33')][_0x938c('0x42')]){_0x314dfc[_0x938c('0x43')]=[{'all':!![]}];}_0x314dfc=_[_0x938c('0x3e')]({},_0x314dfc,_0x43b644[_0x938c('0x40')]);return db[_0x938c('0x2d')][_0x938c('0x47')](_0x314dfc)[_0x938c('0x15')](handleEntityNotFound(_0x2a8988,null))[_0x938c('0x15')](respondWithResult(_0x2a8988,null))[_0x938c('0x1f')](handleError(_0x2a8988,null));};exports[_0x938c('0x48')]=function(_0x48c48d,_0xa21251){return db[_0x938c('0x2d')][_0x938c('0x48')](_0x48c48d[_0x938c('0x49')],{})['then'](respondWithResult(_0xa21251,0xc9))[_0x938c('0x1f')](handleError(_0xa21251,null));};exports[_0x938c('0x27')]=function(_0x3b78d4,_0x6a624c){if(_0x3b78d4[_0x938c('0x49')]['id']){delete _0x3b78d4[_0x938c('0x49')]['id'];}return db['SugarcrmConfiguration'][_0x938c('0x47')]({'where':{'id':_0x3b78d4[_0x938c('0x44')]['id']}})[_0x938c('0x15')](handleEntityNotFound(_0x6a624c,null))[_0x938c('0x15')](saveUpdates(_0x3b78d4[_0x938c('0x49')],null))[_0x938c('0x15')](respondWithResult(_0x6a624c,null))[_0x938c('0x1f')](handleError(_0x6a624c,null));};exports[_0x938c('0x28')]=function(_0x3011fa,_0x68b7ca){return db[_0x938c('0x2d')][_0x938c('0x47')]({'where':{'id':_0x3011fa[_0x938c('0x44')]['id']}})[_0x938c('0x15')](handleEntityNotFound(_0x68b7ca,null))[_0x938c('0x15')](removeEntity(_0x68b7ca,null))[_0x938c('0x1f')](handleError(_0x68b7ca,null));};exports['getFields']=function(_0x83d51b,_0x58ea05,_0x2c5e83){var _0x131030={};var _0x5384b6={};var _0x107e7b;var _0x3599b5;return db[_0x938c('0x2d')][_0x938c('0x4a')]({'where':{'id':_0x83d51b[_0x938c('0x44')]['id']}})[_0x938c('0x15')](handleEntityNotFound(_0x58ea05,null))[_0x938c('0x15')](function(_0x234d2c){if(_0x234d2c){_0x107e7b=_0x234d2c;_0x5384b6[_0x938c('0x32')]=_[_0x938c('0x45')](db['SugarcrmField'][_0x938c('0x2e')]);_0x5384b6[_0x938c('0x33')]=_['keys'](_0x83d51b['query']);_0x5384b6[_0x938c('0x34')]=_[_0x938c('0x35')](_0x5384b6[_0x938c('0x32')],_0x5384b6[_0x938c('0x33')]);_0x131030[_0x938c('0x37')]=_[_0x938c('0x35')](_0x5384b6[_0x938c('0x32')],qs['fields'](_0x83d51b[_0x938c('0x33')]['fields']));_0x131030[_0x938c('0x37')]=_0x131030[_0x938c('0x37')][_0x938c('0x38')]?_0x131030[_0x938c('0x37')]:_0x5384b6[_0x938c('0x32')];_0x131030[_0x938c('0x4b')]=qs[_0x938c('0x3c')](_0x83d51b[_0x938c('0x33')]['sort']);_0x131030[_0x938c('0x3f')]=qs['filters'](_['pick'](_0x83d51b[_0x938c('0x33')],_0x5384b6['filters']));if(_0x83d51b[_0x938c('0x33')]['filter']){_0x131030['where']=_[_0x938c('0x3e')](_0x131030[_0x938c('0x3f')],{'$or':_[_0x938c('0x2c')](_0x131030['attributes'],function(_0x5a809c){var _0x2f1c7d={};_0x2f1c7d[_0x5a809c]={'$like':'%'+_0x83d51b[_0x938c('0x33')][_0x938c('0x3d')]+'%'};return _0x2f1c7d;})});}_0x131030=_[_0x938c('0x3e')]({},_0x131030,_0x83d51b[_0x938c('0x40')]);return _0x107e7b[_0x938c('0x4c')](_0x131030);}})['then'](function(_0x1947a8){if(_0x1947a8){_0x3599b5=_0x1947a8['length'];if(!_0x83d51b[_0x938c('0x33')]['hasOwnProperty'](_0x938c('0x3a'))){_0x131030[_0x938c('0x3b')]=qs[_0x938c('0x3b')](_0x83d51b[_0x938c('0x33')][_0x938c('0x3b')]);_0x131030[_0x938c('0x23')]=qs[_0x938c('0x23')](_0x83d51b['query'][_0x938c('0x23')]);}return _0x107e7b[_0x938c('0x4c')](_0x131030);}})[_0x938c('0x15')](function(_0xf09765){if(_0xf09765){return _0xf09765?{'count':_0x3599b5,'rows':_0xf09765}:null;}})[_0x938c('0x15')](respondWithResult(_0x58ea05,null))['catch'](handleError(_0x58ea05,null));};exports[_0x938c('0x4d')]=function(_0x164647,_0x49f478,_0x242135){var _0x469256={};var _0x271014={};var _0x57e59c;var _0x36da9b;return db[_0x938c('0x2d')][_0x938c('0x4a')]({'where':{'id':_0x164647['params']['id']}})['then'](handleEntityNotFound(_0x49f478,null))[_0x938c('0x15')](function(_0x28c4a5){if(_0x28c4a5){_0x57e59c=_0x28c4a5;_0x271014[_0x938c('0x32')]=_[_0x938c('0x45')](db[_0x938c('0x4e')][_0x938c('0x2e')]);_0x271014[_0x938c('0x33')]=_[_0x938c('0x45')](_0x164647[_0x938c('0x33')]);_0x271014[_0x938c('0x34')]=_[_0x938c('0x35')](_0x271014['model'],_0x271014[_0x938c('0x33')]);_0x469256[_0x938c('0x37')]=_[_0x938c('0x35')](_0x271014['model'],qs['fields'](_0x164647[_0x938c('0x33')]['fields']));_0x469256[_0x938c('0x37')]=_0x469256[_0x938c('0x37')][_0x938c('0x38')]?_0x469256[_0x938c('0x37')]:_0x271014[_0x938c('0x32')];_0x469256[_0x938c('0x4b')]=qs[_0x938c('0x3c')](_0x164647[_0x938c('0x33')]['sort']);_0x469256[_0x938c('0x3f')]=qs[_0x938c('0x34')](_['pick'](_0x164647[_0x938c('0x33')],_0x271014['filters']));if(_0x164647[_0x938c('0x33')]['filter']){_0x469256[_0x938c('0x3f')]=_[_0x938c('0x3e')](_0x469256[_0x938c('0x3f')],{'$or':_[_0x938c('0x2c')](_0x469256[_0x938c('0x37')],function(_0x2ffdff){var _0x1b4cc4={};_0x1b4cc4[_0x2ffdff]={'$like':'%'+_0x164647['query'][_0x938c('0x3d')]+'%'};return _0x1b4cc4;})});}_0x469256=_['merge']({},_0x469256,_0x164647[_0x938c('0x40')]);return _0x57e59c['getSubjects'](_0x469256);}})[_0x938c('0x15')](function(_0x1c3336){if(_0x1c3336){_0x36da9b=_0x1c3336['length'];if(!_0x164647[_0x938c('0x33')][_0x938c('0x39')](_0x938c('0x3a'))){_0x469256['limit']=qs[_0x938c('0x3b')](_0x164647[_0x938c('0x33')]['limit']);_0x469256['offset']=qs[_0x938c('0x23')](_0x164647[_0x938c('0x33')][_0x938c('0x23')]);}return _0x57e59c[_0x938c('0x4d')](_0x469256);}})[_0x938c('0x15')](function(_0x228c93){if(_0x228c93){return _0x228c93?{'count':_0x36da9b,'rows':_0x228c93}:null;}})[_0x938c('0x15')](respondWithResult(_0x49f478,null))[_0x938c('0x1f')](handleError(_0x49f478,null));};exports[_0x938c('0x4f')]=function(_0x4bc30e,_0x4468be,_0x56a411){var _0x3afaf7={};var _0x48a6e4={};var _0x232d40;var _0x473cf0;return db[_0x938c('0x2d')]['findOne']({'where':{'id':_0x4bc30e[_0x938c('0x44')]['id']}})['then'](handleEntityNotFound(_0x4468be,null))[_0x938c('0x15')](function(_0xd736c){if(_0xd736c){_0x232d40=_0xd736c;_0x48a6e4['model']=_[_0x938c('0x45')](db[_0x938c('0x4e')][_0x938c('0x2e')]);_0x48a6e4[_0x938c('0x33')]=_[_0x938c('0x45')](_0x4bc30e[_0x938c('0x33')]);_0x48a6e4[_0x938c('0x34')]=_[_0x938c('0x35')](_0x48a6e4[_0x938c('0x32')],_0x48a6e4['query']);_0x3afaf7[_0x938c('0x37')]=_['intersection'](_0x48a6e4['model'],qs[_0x938c('0x36')](_0x4bc30e[_0x938c('0x33')]['fields']));_0x3afaf7[_0x938c('0x37')]=_0x3afaf7[_0x938c('0x37')][_0x938c('0x38')]?_0x3afaf7[_0x938c('0x37')]:_0x48a6e4['model'];_0x3afaf7[_0x938c('0x4b')]=qs[_0x938c('0x3c')](_0x4bc30e[_0x938c('0x33')][_0x938c('0x3c')]);_0x3afaf7['where']=qs['filters'](_[_0x938c('0x50')](_0x4bc30e[_0x938c('0x33')],_0x48a6e4[_0x938c('0x34')]));if(_0x4bc30e[_0x938c('0x33')][_0x938c('0x3d')]){_0x3afaf7[_0x938c('0x3f')]=_[_0x938c('0x3e')](_0x3afaf7[_0x938c('0x3f')],{'$or':_[_0x938c('0x2c')](_0x3afaf7[_0x938c('0x37')],function(_0xc81402){var _0x5ae86c={};_0x5ae86c[_0xc81402]={'$like':'%'+_0x4bc30e[_0x938c('0x33')]['filter']+'%'};return _0x5ae86c;})});}_0x3afaf7=_[_0x938c('0x3e')]({},_0x3afaf7,_0x4bc30e[_0x938c('0x40')]);return _0x232d40[_0x938c('0x4f')](_0x3afaf7);}})[_0x938c('0x15')](function(_0xa2bde){if(_0xa2bde){_0x473cf0=_0xa2bde[_0x938c('0x38')];if(!_0x4bc30e[_0x938c('0x33')][_0x938c('0x39')]('nolimit')){_0x3afaf7[_0x938c('0x3b')]=qs[_0x938c('0x3b')](_0x4bc30e[_0x938c('0x33')][_0x938c('0x3b')]);_0x3afaf7['offset']=qs[_0x938c('0x23')](_0x4bc30e[_0x938c('0x33')][_0x938c('0x23')]);}return _0x232d40[_0x938c('0x4f')](_0x3afaf7);}})[_0x938c('0x15')](function(_0x53698d){if(_0x53698d){return _0x53698d?{'count':_0x473cf0,'rows':_0x53698d}:null;}})['then'](respondWithResult(_0x4468be,null))[_0x938c('0x1f')](handleError(_0x4468be,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 7b5bb15..9d3f8ea 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 _0x5f24=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','api','moment','request-promise','rimraf'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0x5f24,0x87));var _0x45f2=function(_0x2fa457,_0x7021df){_0x2fa457=_0x2fa457-0x0;var _0x4f250a=_0x5f24[_0x2fa457];return _0x4f250a;};'use strict';var _=require(_0x45f2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x45f2('0x1'));var moment=require(_0x45f2('0x2'));var BPromise=require('bluebird');var rp=require(_0x45f2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x45f2('0x4'));var config=require(_0x45f2('0x5'));var attributes=require(_0x45f2('0x6'));module[_0x45f2('0x7')]=function(_0x5281a9,_0x279c57){return _0x5281a9['define'](_0x45f2('0x8'),attributes,{'tableName':_0x45f2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a66=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a66,0x1d4));var _0x65a6=function(_0x9c3e67,_0x11e716){_0x9c3e67=_0x9c3e67-0x0;var _0x5af8ec=_0x5a66[_0x9c3e67];return _0x5af8ec;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x65a6('0x0'))(_0x65a6('0x1'));var moment=require(_0x65a6('0x2'));var BPromise=require(_0x65a6('0x3'));var rp=require(_0x65a6('0x4'));var fs=require('fs');var path=require(_0x65a6('0x5'));var rimraf=require(_0x65a6('0x6'));var config=require(_0x65a6('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x65a6('0x8')]=function(_0x3eba82,_0x1a5e40){return _0x3eba82[_0x65a6('0x9')](_0x65a6('0xa'),attributes,{'tableName':_0x65a6('0xb'),'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 4e81354..71b7eb8 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 _0x24a8=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x5b3721,_0x69e4cc){var _0x2a6e0d=function(_0x939051){while(--_0x939051){_0x5b3721['push'](_0x5b3721['shift']());}};_0x2a6e0d(++_0x69e4cc);}(_0x24a8,0x14a));var _0x824a=function(_0x513492,_0x5ca6f7){_0x513492=_0x513492-0x0;var _0x22f984=_0x24a8[_0x513492];return _0x22f984;};'use strict';var _=require(_0x824a('0x0'));var util=require(_0x824a('0x1'));var moment=require(_0x824a('0x2'));var BPromise=require(_0x824a('0x3'));var rs=require(_0x824a('0x4'));var fs=require('fs');var Redis=require(_0x824a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x824a('0x6'));var logger=require('../../config/logger')(_0x824a('0x7'));var config=require(_0x824a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x824a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x128c4f,_0xe68023,_0x5294df){return new BPromise(function(_0x1fb879,_0xdf717d){return client[_0x824a('0xa')](_0x128c4f,_0x5294df)[_0x824a('0xb')](function(_0x558d84){logger[_0x824a('0xc')](_0x824a('0xd'),_0xe68023,'request\x20sent');logger[_0x824a('0xe')](_0x824a('0xf'),_0xe68023,_0x824a('0x10'),JSON[_0x824a('0x11')](_0x558d84));if(_0x558d84['error']){if(_0x558d84[_0x824a('0x12')][_0x824a('0x13')]===0x1f4){logger[_0x824a('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xe68023,_0x558d84['error']['message']);return _0xdf717d(_0x558d84['error'][_0x824a('0x14')]);}logger[_0x824a('0x12')](_0x824a('0xd'),_0xe68023,_0x558d84['error'][_0x824a('0x14')]);return _0x1fb879(_0x558d84[_0x824a('0x12')][_0x824a('0x14')]);}else{logger[_0x824a('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xe68023,_0x824a('0x10'));_0x1fb879(_0x558d84['result'][_0x824a('0x14')]);}})[_0x824a('0x15')](function(_0x4f1e4){logger[_0x824a('0x12')](_0x824a('0xd'),_0xe68023,_0x4f1e4);_0xdf717d(_0x4f1e4);});});} \ No newline at end of file +var _0xc3c0=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xc3c0,0x7c));var _0x0c3c=function(_0xd0a234,_0x42f5b7){_0xd0a234=_0xd0a234-0x0;var _0x5e917c=_0xc3c0[_0xd0a234];return _0x5e917c;};'use strict';var _=require(_0x0c3c('0x0'));var util=require(_0x0c3c('0x1'));var moment=require(_0x0c3c('0x2'));var BPromise=require(_0x0c3c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c3c('0x4'));var db=require(_0x0c3c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0c3c('0x6'))('rpc');var config=require(_0x0c3c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0c3c('0x8')][_0x0c3c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12c314,_0x481a5f,_0x14e735){return new BPromise(function(_0x304fe2,_0x2e870e){return client[_0x0c3c('0xa')](_0x12c314,_0x14e735)[_0x0c3c('0xb')](function(_0x4cb7aa){logger[_0x0c3c('0xc')](_0x0c3c('0xd'),_0x481a5f,_0x0c3c('0xe'));logger[_0x0c3c('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x481a5f,_0x0c3c('0xe'),JSON[_0x0c3c('0x10')](_0x4cb7aa));if(_0x4cb7aa[_0x0c3c('0x11')]){if(_0x4cb7aa[_0x0c3c('0x11')]['code']===0x1f4){logger['error'](_0x0c3c('0xd'),_0x481a5f,_0x4cb7aa['error'][_0x0c3c('0x12')]);return _0x2e870e(_0x4cb7aa[_0x0c3c('0x11')][_0x0c3c('0x12')]);}logger[_0x0c3c('0x11')](_0x0c3c('0xd'),_0x481a5f,_0x4cb7aa[_0x0c3c('0x11')]['message']);return _0x304fe2(_0x4cb7aa[_0x0c3c('0x11')][_0x0c3c('0x12')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x481a5f,'request\x20sent');_0x304fe2(_0x4cb7aa[_0x0c3c('0x13')][_0x0c3c('0x12')]);}})[_0x0c3c('0x14')](function(_0x1f4e91){logger[_0x0c3c('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x481a5f,_0x1f4e91);_0x2e870e(_0x1f4e91);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index f8bdfdf..f0676af 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 _0xdb06=['index','get','/:id','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated'];(function(_0x1ef750,_0x3ac0df){var _0x24f8ad=function(_0x243394){while(--_0x243394){_0x1ef750['push'](_0x1ef750['shift']());}};_0x24f8ad(++_0x3ac0df);}(_0xdb06,0x128));var _0x6db0=function(_0x2357d7,_0x299940){_0x2357d7=_0x2357d7-0x0;var _0xfb7da0=_0xdb06[_0x2357d7];return _0xfb7da0;};'use strict';var multer=require(_0x6db0('0x0'));var util=require(_0x6db0('0x1'));var path=require(_0x6db0('0x2'));var timeout=require(_0x6db0('0x3'));var express=require(_0x6db0('0x4'));var router=express[_0x6db0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x6db0('0x6'));var config=require(_0x6db0('0x7'));var controller=require(_0x6db0('0x8'));router['get']('/',auth[_0x6db0('0x9')](),controller[_0x6db0('0xa')]);router[_0x6db0('0xb')](_0x6db0('0xc'),auth[_0x6db0('0x9')](),controller['show']);router['post']('/',auth[_0x6db0('0x9')](),controller[_0x6db0('0xd')]);router['put'](_0x6db0('0xc'),auth[_0x6db0('0x9')](),controller['update']);router[_0x6db0('0xe')](_0x6db0('0xc'),auth[_0x6db0('0x9')](),controller[_0x6db0('0xf')]);module[_0x6db0('0x10')]=router; \ No newline at end of file +var _0x023c=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x5af65b,_0x6e3343){var _0x14d76f=function(_0x1e000d){while(--_0x1e000d){_0x5af65b['push'](_0x5af65b['shift']());}};_0x14d76f(++_0x6e3343);}(_0x023c,0x152));var _0xc023=function(_0x34177c,_0x2c7a3f){_0x34177c=_0x34177c-0x0;var _0x11ddc1=_0x023c[_0x34177c];return _0x11ddc1;};'use strict';var multer=require('multer');var util=require(_0xc023('0x0'));var path=require(_0xc023('0x1'));var timeout=require(_0xc023('0x2'));var express=require(_0xc023('0x3'));var router=express['Router']();var auth=require(_0xc023('0x4'));var interaction=require(_0xc023('0x5'));var config=require(_0xc023('0x6'));var controller=require(_0xc023('0x7'));router[_0xc023('0x8')]('/',auth[_0xc023('0x9')](),controller[_0xc023('0xa')]);router[_0xc023('0x8')](_0xc023('0xb'),auth['isAuthenticated'](),controller[_0xc023('0xc')]);router[_0xc023('0xd')]('/',auth[_0xc023('0x9')](),controller[_0xc023('0xe')]);router[_0xc023('0xf')](_0xc023('0xb'),auth[_0xc023('0x9')](),controller[_0xc023('0x10')]);router[_0xc023('0x11')](_0xc023('0xb'),auth['isAuthenticated'](),controller[_0xc023('0x12')]);module[_0xc023('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index d5dfe2c..bee535a 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 _0x06bf=['string','variable','customVariable','keyValue','STRING','sequelize','exports','ENUM'];(function(_0x34d580,_0x4e13f5){var _0x10e679=function(_0x6c3345){while(--_0x6c3345){_0x34d580['push'](_0x34d580['shift']());}};_0x10e679(++_0x4e13f5);}(_0x06bf,0x105));var _0xf06b=function(_0x19616e,_0x4183db){_0x19616e=_0x19616e-0x0;var _0xe0958b=_0x06bf[_0x19616e];return _0xe0958b;};'use strict';var Sequelize=require(_0xf06b('0x0'));module[_0xf06b('0x1')]={'type':{'type':Sequelize[_0xf06b('0x2')](_0xf06b('0x3'),_0xf06b('0x4'),_0xf06b('0x5'),_0xf06b('0x6')),'defaultValue':_0xf06b('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf06b('0x7')]},'keyType':{'type':Sequelize[_0xf06b('0x2')](_0xf06b('0x3'),'variable',_0xf06b('0x5'))},'keyContent':{'type':Sequelize[_0xf06b('0x7')]},'idField':{'type':Sequelize[_0xf06b('0x7')]},'nameField':{'type':Sequelize[_0xf06b('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf06b('0x7')]}}; \ No newline at end of file +var _0xecd5=['exports','ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN'];(function(_0x2a084c,_0x4fee0f){var _0x1c55c4=function(_0x578d69){while(--_0x578d69){_0x2a084c['push'](_0x2a084c['shift']());}};_0x1c55c4(++_0x4fee0f);}(_0xecd5,0x110));var _0x5ecd=function(_0x1656c8,_0x1ab686){_0x1656c8=_0x1656c8-0x0;var _0x814a19=_0xecd5[_0x1656c8];return _0x814a19;};'use strict';var Sequelize=require('sequelize');module[_0x5ecd('0x0')]={'type':{'type':Sequelize[_0x5ecd('0x1')](_0x5ecd('0x2'),'variable',_0x5ecd('0x3'),_0x5ecd('0x4')),'defaultValue':_0x5ecd('0x2')},'content':{'type':Sequelize[_0x5ecd('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5ecd('0x1')]('string',_0x5ecd('0x6'),_0x5ecd('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5ecd('0x5')]},'nameField':{'type':Sequelize[_0x5ecd('0x5')]},'customField':{'type':Sequelize[_0x5ecd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5ecd('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 422cdb6..0e31b2b 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 _0xcf96=['hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','SugarcrmField','includeAll','include','findAll','catch','show','params','keys','filtears','length','options','find','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','Content-Range','json','apply','save','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes'];(function(_0x449dce,_0x4b7949){var _0x379376=function(_0x2d1784){while(--_0x2d1784){_0x449dce['push'](_0x449dce['shift']());}};_0x379376(++_0x4b7949);}(_0xcf96,0xf5));var _0x6cf9=function(_0x38bc4c,_0x42183d){_0x38bc4c=_0x38bc4c-0x0;var _0x176d7e=_0xcf96[_0x38bc4c];return _0x176d7e;};'use strict';var pdf=require(_0x6cf9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6cf9('0x1'));var zipdir=require(_0x6cf9('0x2'));var jsonpatch=require(_0x6cf9('0x3'));var rp=require(_0x6cf9('0x4'));var moment=require('moment');var BPromise=require(_0x6cf9('0x5'));var Mustache=require(_0x6cf9('0x6'));var util=require(_0x6cf9('0x7'));var path=require(_0x6cf9('0x8'));var sox=require('sox');var csv=require(_0x6cf9('0x9'));var ejs=require(_0x6cf9('0xa'));var fs=require('fs');var _=require(_0x6cf9('0xb'));var squel=require(_0x6cf9('0xc'));var crypto=require(_0x6cf9('0xd'));var jsforce=require(_0x6cf9('0xe'));var deskjs=require(_0x6cf9('0xf'));var toCsv=require(_0x6cf9('0x9'));var querystring=require(_0x6cf9('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6cf9('0x11'));var qs=require(_0x6cf9('0x12'));var as=require(_0x6cf9('0x13'));var hardwareService=require(_0x6cf9('0x14'));var logger=require(_0x6cf9('0x15'))(_0x6cf9('0x16'));var utils=require(_0x6cf9('0x17'));var config=require(_0x6cf9('0x18'));var licenseUtil=require(_0x6cf9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13bda1,_0x106469){_0x106469=_0x106469||0xcc;return function(_0xeacaad){if(_0xeacaad){return _0x13bda1[_0x6cf9('0x1a')](_0x106469);}return _0x13bda1[_0x6cf9('0x1b')](_0x106469)[_0x6cf9('0x1c')]();};}function respondWithResult(_0x9d6579,_0xec06df){_0xec06df=_0xec06df||0xc8;return function(_0x3f3d47){if(_0x3f3d47){return _0x9d6579[_0x6cf9('0x1b')](_0xec06df)['json'](_0x3f3d47);}};}function respondWithFilteredResult(_0x377b87,_0x3d8060){return function(_0x98ac3a){if(_0x98ac3a){var _0x7287ef=_0x98ac3a[_0x6cf9('0x1d')],_0x51ccd3=_0x3d8060[_0x6cf9('0x1e')],_0x28e910=_0x3d8060[_0x6cf9('0x1e')]+_0x3d8060['limit'],_0x4fdfa5;if(_0x28e910>=_0x7287ef){_0x28e910=_0x7287ef;_0x4fdfa5=0xc8;}else{_0x4fdfa5=0xce;}_0x377b87['status'](_0x4fdfa5);return _0x377b87['set'](_0x6cf9('0x1f'),_0x51ccd3+'-'+_0x28e910+'/'+_0x7287ef)[_0x6cf9('0x20')](_0x98ac3a);}return null;};}function patchUpdates(_0x385690){return function(_0x231697){try{jsonpatch[_0x6cf9('0x21')](_0x231697,_0x385690,!![]);}catch(_0x3806f6){return BPromise['reject'](_0x3806f6);}return _0x231697[_0x6cf9('0x22')]();};}function saveUpdates(_0x3a7774,_0xf95810){return function(_0x40b350){if(_0x40b350){return _0x40b350['update'](_0x3a7774)[_0x6cf9('0x23')](function(_0x3adeef){return _0x3adeef;});}return null;};}function removeEntity(_0x2c38f5,_0x39c0fa){return function(_0x3c5180){if(_0x3c5180){return _0x3c5180[_0x6cf9('0x24')]()[_0x6cf9('0x23')](function(){_0x2c38f5[_0x6cf9('0x1b')](0xcc)[_0x6cf9('0x1c')]();});}};}function handleEntityNotFound(_0x153a94,_0x109690){return function(_0x20a021){if(!_0x20a021){_0x153a94['sendStatus'](0x194);}return _0x20a021;};}function handleError(_0x42d6cd,_0x59a115){_0x59a115=_0x59a115||0x1f4;return function(_0x4eeabb){logger[_0x6cf9('0x25')](_0x4eeabb[_0x6cf9('0x26')]);if(_0x4eeabb[_0x6cf9('0x27')]){delete _0x4eeabb[_0x6cf9('0x27')];}_0x42d6cd[_0x6cf9('0x1b')](_0x59a115)['send'](_0x4eeabb);};}exports[_0x6cf9('0x28')]=function(_0x6c7783,_0x3903c7){var _0x380fef={},_0x470de3={},_0x389fe8={'count':0x0,'rows':[]};var _0x2e136c=_['map'](db['SugarcrmField'][_0x6cf9('0x29')],function(_0x121451){return{'name':_0x121451[_0x6cf9('0x2a')],'type':_0x121451[_0x6cf9('0x2b')][_0x6cf9('0x2c')]};});_0x470de3[_0x6cf9('0x2d')]=_[_0x6cf9('0x2e')](_0x2e136c,_0x6cf9('0x27'));_0x470de3[_0x6cf9('0x2f')]=_['keys'](_0x6c7783[_0x6cf9('0x2f')]);_0x470de3[_0x6cf9('0x30')]=_[_0x6cf9('0x31')](_0x470de3[_0x6cf9('0x2d')],_0x470de3['query']);_0x380fef[_0x6cf9('0x32')]=_[_0x6cf9('0x31')](_0x470de3['model'],qs['fields'](_0x6c7783[_0x6cf9('0x2f')]['fields']));_0x380fef['attributes']=_0x380fef['attributes']['length']?_0x380fef[_0x6cf9('0x32')]:_0x470de3[_0x6cf9('0x2d')];if(!_0x6c7783[_0x6cf9('0x2f')][_0x6cf9('0x33')]('nolimit')){_0x380fef['limit']=qs['limit'](_0x6c7783['query']['limit']);_0x380fef[_0x6cf9('0x1e')]=qs[_0x6cf9('0x1e')](_0x6c7783[_0x6cf9('0x2f')][_0x6cf9('0x1e')]);}_0x380fef[_0x6cf9('0x34')]=qs[_0x6cf9('0x35')](_0x6c7783[_0x6cf9('0x2f')][_0x6cf9('0x35')]);_0x380fef[_0x6cf9('0x36')]=qs[_0x6cf9('0x30')](_[_0x6cf9('0x37')](_0x6c7783[_0x6cf9('0x2f')],_0x470de3[_0x6cf9('0x30')]),_0x2e136c);if(_0x6c7783[_0x6cf9('0x2f')][_0x6cf9('0x38')]){_0x380fef['where']=_[_0x6cf9('0x39')](_0x380fef[_0x6cf9('0x36')],{'$or':_[_0x6cf9('0x2e')](_0x2e136c,function(_0x2281ed){if(_0x2281ed[_0x6cf9('0x2b')]!==_0x6cf9('0x3a')){var _0x365b78={};_0x365b78[_0x2281ed[_0x6cf9('0x27')]]={'$like':'%'+_0x6c7783[_0x6cf9('0x2f')][_0x6cf9('0x38')]+'%'};return _0x365b78;}})});}_0x380fef=_[_0x6cf9('0x39')]({},_0x380fef,_0x6c7783['options']);var _0x49c80c={'where':_0x380fef['where']};return db[_0x6cf9('0x3b')][_0x6cf9('0x1d')](_0x49c80c)[_0x6cf9('0x23')](function(_0x1c10ed){_0x389fe8[_0x6cf9('0x1d')]=_0x1c10ed;if(_0x6c7783['query'][_0x6cf9('0x3c')]){_0x380fef[_0x6cf9('0x3d')]=[{'all':!![]}];}return db[_0x6cf9('0x3b')][_0x6cf9('0x3e')](_0x380fef);})[_0x6cf9('0x23')](function(_0x5e52f5){_0x389fe8['rows']=_0x5e52f5;return _0x389fe8;})[_0x6cf9('0x23')](respondWithFilteredResult(_0x3903c7,_0x380fef))[_0x6cf9('0x3f')](handleError(_0x3903c7,null));};exports[_0x6cf9('0x40')]=function(_0x4b159f,_0x58c71a){var _0x18528d={'raw':!![],'where':{'id':_0x4b159f[_0x6cf9('0x41')]['id']}},_0xe3d8c6={};_0xe3d8c6[_0x6cf9('0x2d')]=_[_0x6cf9('0x42')](db[_0x6cf9('0x3b')][_0x6cf9('0x29')]);_0xe3d8c6[_0x6cf9('0x2f')]=_[_0x6cf9('0x42')](_0x4b159f[_0x6cf9('0x2f')]);_0xe3d8c6[_0x6cf9('0x43')]=_[_0x6cf9('0x31')](_0xe3d8c6[_0x6cf9('0x2d')],_0xe3d8c6[_0x6cf9('0x2f')]);_0x18528d[_0x6cf9('0x32')]=_[_0x6cf9('0x31')](_0xe3d8c6['model'],qs['fields'](_0x4b159f['query']['fields']));_0x18528d['attributes']=_0x18528d[_0x6cf9('0x32')][_0x6cf9('0x44')]?_0x18528d[_0x6cf9('0x32')]:_0xe3d8c6['model'];if(_0x4b159f['query'][_0x6cf9('0x3c')]){_0x18528d['include']=[{'all':!![]}];}_0x18528d=_[_0x6cf9('0x39')]({},_0x18528d,_0x4b159f[_0x6cf9('0x45')]);return db['SugarcrmField'][_0x6cf9('0x46')](_0x18528d)[_0x6cf9('0x23')](handleEntityNotFound(_0x58c71a,null))['then'](respondWithResult(_0x58c71a,null))['catch'](handleError(_0x58c71a,null));};exports['create']=function(_0x737856,_0x42f2ac){return db[_0x6cf9('0x3b')][_0x6cf9('0x47')](_0x737856[_0x6cf9('0x48')],{})[_0x6cf9('0x23')](respondWithResult(_0x42f2ac,0xc9))['catch'](handleError(_0x42f2ac,null));};exports[_0x6cf9('0x49')]=function(_0x1ad411,_0x5bf0ee){if(_0x1ad411[_0x6cf9('0x48')]['id']){delete _0x1ad411[_0x6cf9('0x48')]['id'];}return db['SugarcrmField'][_0x6cf9('0x46')]({'where':{'id':_0x1ad411[_0x6cf9('0x41')]['id']}})[_0x6cf9('0x23')](handleEntityNotFound(_0x5bf0ee,null))[_0x6cf9('0x23')](saveUpdates(_0x1ad411[_0x6cf9('0x48')],null))['then'](respondWithResult(_0x5bf0ee,null))['catch'](handleError(_0x5bf0ee,null));};exports['destroy']=function(_0x257c09,_0xa57be1){return db[_0x6cf9('0x3b')][_0x6cf9('0x46')]({'where':{'id':_0x257c09['params']['id']}})[_0x6cf9('0x23')](handleEntityNotFound(_0xa57be1,null))[_0x6cf9('0x23')](removeEntity(_0xa57be1,null))[_0x6cf9('0x3f')](handleError(_0xa57be1,null));}; \ No newline at end of file +var _0x5ef6=['rows','catch','show','create','body','params','find','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmField','rawAttributes','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','options','count','includeAll','include','findAll'];(function(_0x4fa606,_0x13a26c){var _0x1d42fc=function(_0xe2f392){while(--_0xe2f392){_0x4fa606['push'](_0x4fa606['shift']());}};_0x1d42fc(++_0x13a26c);}(_0x5ef6,0xe8));var _0x65ef=function(_0x422a6a,_0x34cc4){_0x422a6a=_0x422a6a-0x0;var _0x137714=_0x5ef6[_0x422a6a];return _0x137714;};'use strict';var pdf=require(_0x65ef('0x0'));var emlformat=require(_0x65ef('0x1'));var rimraf=require(_0x65ef('0x2'));var zipdir=require(_0x65ef('0x3'));var jsonpatch=require(_0x65ef('0x4'));var rp=require(_0x65ef('0x5'));var moment=require(_0x65ef('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x65ef('0x7'));var util=require(_0x65ef('0x8'));var path=require(_0x65ef('0x9'));var sox=require(_0x65ef('0xa'));var csv=require(_0x65ef('0xb'));var ejs=require(_0x65ef('0xc'));var fs=require('fs');var _=require(_0x65ef('0xd'));var squel=require('squel');var crypto=require(_0x65ef('0xe'));var jsforce=require(_0x65ef('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x65ef('0xb'));var querystring=require(_0x65ef('0x10'));var Papa=require(_0x65ef('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x65ef('0x12'));var as=require(_0x65ef('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65ef('0x14'))('api');var utils=require(_0x65ef('0x15'));var config=require(_0x65ef('0x16'));var licenseUtil=require(_0x65ef('0x17'));var db=require(_0x65ef('0x18'))['db'];function respondWithStatusCode(_0x5abd48,_0x3fc77c){_0x3fc77c=_0x3fc77c||0xcc;return function(_0x4bf04e){if(_0x4bf04e){return _0x5abd48['sendStatus'](_0x3fc77c);}return _0x5abd48[_0x65ef('0x19')](_0x3fc77c)[_0x65ef('0x1a')]();};}function respondWithResult(_0x227a4e,_0x2c4fee){_0x2c4fee=_0x2c4fee||0xc8;return function(_0x3d971b){if(_0x3d971b){return _0x227a4e[_0x65ef('0x19')](_0x2c4fee)['json'](_0x3d971b);}};}function respondWithFilteredResult(_0x1a441c,_0x542074){return function(_0x23db04){if(_0x23db04){var _0x81862=_0x23db04['count'],_0x4117da=_0x542074[_0x65ef('0x1b')],_0x3c06ca=_0x542074[_0x65ef('0x1b')]+_0x542074[_0x65ef('0x1c')],_0x22d4a9;if(_0x3c06ca>=_0x81862){_0x3c06ca=_0x81862;_0x22d4a9=0xc8;}else{_0x22d4a9=0xce;}_0x1a441c['status'](_0x22d4a9);return _0x1a441c[_0x65ef('0x1d')](_0x65ef('0x1e'),_0x4117da+'-'+_0x3c06ca+'/'+_0x81862)[_0x65ef('0x1f')](_0x23db04);}return null;};}function patchUpdates(_0x1a6db5){return function(_0x51d167){try{jsonpatch[_0x65ef('0x20')](_0x51d167,_0x1a6db5,!![]);}catch(_0x1d2608){return BPromise['reject'](_0x1d2608);}return _0x51d167[_0x65ef('0x21')]();};}function saveUpdates(_0xda0630,_0x5ef956){return function(_0x4b1234){if(_0x4b1234){return _0x4b1234[_0x65ef('0x22')](_0xda0630)[_0x65ef('0x23')](function(_0x32841b){return _0x32841b;});}return null;};}function removeEntity(_0x22df8b,_0x9b386a){return function(_0x5acdac){if(_0x5acdac){return _0x5acdac[_0x65ef('0x24')]()[_0x65ef('0x23')](function(){_0x22df8b[_0x65ef('0x19')](0xcc)[_0x65ef('0x1a')]();});}};}function handleEntityNotFound(_0x27a8f7,_0x42b35f){return function(_0x163616){if(!_0x163616){_0x27a8f7[_0x65ef('0x25')](0x194);}return _0x163616;};}function handleError(_0x57a57c,_0x566724){_0x566724=_0x566724||0x1f4;return function(_0x46a7f3){logger[_0x65ef('0x26')](_0x46a7f3[_0x65ef('0x27')]);if(_0x46a7f3[_0x65ef('0x28')]){delete _0x46a7f3[_0x65ef('0x28')];}_0x57a57c[_0x65ef('0x19')](_0x566724)[_0x65ef('0x29')](_0x46a7f3);};}exports[_0x65ef('0x2a')]=function(_0x1a4f3b,_0x31f78d){var _0x130334={},_0x2462c8={},_0x12bbeb={'count':0x0,'rows':[]};var _0x57b80a=_[_0x65ef('0x2b')](db[_0x65ef('0x2c')][_0x65ef('0x2d')],function(_0x2638fa){return{'name':_0x2638fa['fieldName'],'type':_0x2638fa[_0x65ef('0x2e')][_0x65ef('0x2f')]};});_0x2462c8[_0x65ef('0x30')]=_[_0x65ef('0x2b')](_0x57b80a,'name');_0x2462c8['query']=_[_0x65ef('0x31')](_0x1a4f3b['query']);_0x2462c8['filters']=_[_0x65ef('0x32')](_0x2462c8['model'],_0x2462c8[_0x65ef('0x33')]);_0x130334['attributes']=_[_0x65ef('0x32')](_0x2462c8['model'],qs[_0x65ef('0x34')](_0x1a4f3b[_0x65ef('0x33')][_0x65ef('0x34')]));_0x130334[_0x65ef('0x35')]=_0x130334['attributes'][_0x65ef('0x36')]?_0x130334[_0x65ef('0x35')]:_0x2462c8[_0x65ef('0x30')];if(!_0x1a4f3b[_0x65ef('0x33')][_0x65ef('0x37')]('nolimit')){_0x130334[_0x65ef('0x1c')]=qs[_0x65ef('0x1c')](_0x1a4f3b[_0x65ef('0x33')][_0x65ef('0x1c')]);_0x130334[_0x65ef('0x1b')]=qs['offset'](_0x1a4f3b[_0x65ef('0x33')][_0x65ef('0x1b')]);}_0x130334[_0x65ef('0x38')]=qs[_0x65ef('0x39')](_0x1a4f3b[_0x65ef('0x33')][_0x65ef('0x39')]);_0x130334[_0x65ef('0x3a')]=qs[_0x65ef('0x3b')](_[_0x65ef('0x3c')](_0x1a4f3b[_0x65ef('0x33')],_0x2462c8[_0x65ef('0x3b')]),_0x57b80a);if(_0x1a4f3b['query']['filter']){_0x130334[_0x65ef('0x3a')]=_[_0x65ef('0x3d')](_0x130334[_0x65ef('0x3a')],{'$or':_[_0x65ef('0x2b')](_0x57b80a,function(_0x5ba607){if(_0x5ba607[_0x65ef('0x2e')]!==_0x65ef('0x3e')){var _0x51e378={};_0x51e378[_0x5ba607[_0x65ef('0x28')]]={'$like':'%'+_0x1a4f3b[_0x65ef('0x33')]['filter']+'%'};return _0x51e378;}})});}_0x130334=_['merge']({},_0x130334,_0x1a4f3b[_0x65ef('0x3f')]);var _0x1ef92a={'where':_0x130334['where']};return db[_0x65ef('0x2c')][_0x65ef('0x40')](_0x1ef92a)[_0x65ef('0x23')](function(_0x297483){_0x12bbeb['count']=_0x297483;if(_0x1a4f3b[_0x65ef('0x33')][_0x65ef('0x41')]){_0x130334[_0x65ef('0x42')]=[{'all':!![]}];}return db[_0x65ef('0x2c')][_0x65ef('0x43')](_0x130334);})[_0x65ef('0x23')](function(_0x1a800e){_0x12bbeb[_0x65ef('0x44')]=_0x1a800e;return _0x12bbeb;})['then'](respondWithFilteredResult(_0x31f78d,_0x130334))[_0x65ef('0x45')](handleError(_0x31f78d,null));};exports[_0x65ef('0x46')]=function(_0x437491,_0x32ec9d){var _0x313f1e={'raw':!![],'where':{'id':_0x437491['params']['id']}},_0x59656b={};_0x59656b[_0x65ef('0x30')]=_['keys'](db[_0x65ef('0x2c')][_0x65ef('0x2d')]);_0x59656b[_0x65ef('0x33')]=_[_0x65ef('0x31')](_0x437491['query']);_0x59656b['filtears']=_[_0x65ef('0x32')](_0x59656b[_0x65ef('0x30')],_0x59656b[_0x65ef('0x33')]);_0x313f1e['attributes']=_['intersection'](_0x59656b['model'],qs[_0x65ef('0x34')](_0x437491['query']['fields']));_0x313f1e['attributes']=_0x313f1e['attributes']['length']?_0x313f1e[_0x65ef('0x35')]:_0x59656b['model'];if(_0x437491[_0x65ef('0x33')]['includeAll']){_0x313f1e[_0x65ef('0x42')]=[{'all':!![]}];}_0x313f1e=_[_0x65ef('0x3d')]({},_0x313f1e,_0x437491[_0x65ef('0x3f')]);return db[_0x65ef('0x2c')]['find'](_0x313f1e)[_0x65ef('0x23')](handleEntityNotFound(_0x32ec9d,null))[_0x65ef('0x23')](respondWithResult(_0x32ec9d,null))['catch'](handleError(_0x32ec9d,null));};exports['create']=function(_0x471eda,_0x40bf45){return db[_0x65ef('0x2c')][_0x65ef('0x47')](_0x471eda[_0x65ef('0x48')],{})['then'](respondWithResult(_0x40bf45,0xc9))['catch'](handleError(_0x40bf45,null));};exports[_0x65ef('0x22')]=function(_0x1d1135,_0x283e98){if(_0x1d1135[_0x65ef('0x48')]['id']){delete _0x1d1135['body']['id'];}return db[_0x65ef('0x2c')]['find']({'where':{'id':_0x1d1135[_0x65ef('0x49')]['id']}})[_0x65ef('0x23')](handleEntityNotFound(_0x283e98,null))['then'](saveUpdates(_0x1d1135[_0x65ef('0x48')],null))['then'](respondWithResult(_0x283e98,null))[_0x65ef('0x45')](handleError(_0x283e98,null));};exports[_0x65ef('0x24')]=function(_0x31e2df,_0x30caf0){return db[_0x65ef('0x2c')][_0x65ef('0x4a')]({'where':{'id':_0x31e2df['params']['id']}})[_0x65ef('0x23')](handleEntityNotFound(_0x30caf0,null))['then'](removeEntity(_0x30caf0,null))[_0x65ef('0x45')](handleError(_0x30caf0,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 02cf356..7923b1f 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 _0xe5cf=['define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes'];(function(_0x33080e,_0x1c600a){var _0x407395=function(_0x5b62fd){while(--_0x5b62fd){_0x33080e['push'](_0x33080e['shift']());}};_0x407395(++_0x1c600a);}(_0xe5cf,0xb6));var _0xfe5c=function(_0x21e249,_0x219d6a){_0x21e249=_0x21e249-0x0;var _0x2c79e5=_0xe5cf[_0x21e249];return _0x2c79e5;};'use strict';var _=require(_0xfe5c('0x0'));var util=require(_0xfe5c('0x1'));var logger=require(_0xfe5c('0x2'))(_0xfe5c('0x3'));var moment=require(_0xfe5c('0x4'));var BPromise=require(_0xfe5c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe5c('0x6'));var rimraf=require(_0xfe5c('0x7'));var config=require(_0xfe5c('0x8'));var attributes=require(_0xfe5c('0x9'));module['exports']=function(_0x383953,_0x5ce753){return _0x383953[_0xfe5c('0xa')](_0xfe5c('0xb'),attributes,{'tableName':_0xfe5c('0xc'),'paranoid':![],'indexes':[{'name':_0xfe5c('0xd'),'fields':[_0xfe5c('0xe'),_0xfe5c('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f19=['path','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x564eb4,_0x385cd6){var _0x2a8ed4=function(_0x12e0d9){while(--_0x12e0d9){_0x564eb4['push'](_0x564eb4['shift']());}};_0x2a8ed4(++_0x385cd6);}(_0x9f19,0x81));var _0x99f1=function(_0x561e76,_0x1465c2){_0x561e76=_0x561e76-0x0;var _0x20716b=_0x9f19[_0x561e76];return _0x20716b;};'use strict';var _=require(_0x99f1('0x0'));var util=require(_0x99f1('0x1'));var logger=require(_0x99f1('0x2'))(_0x99f1('0x3'));var moment=require(_0x99f1('0x4'));var BPromise=require('bluebird');var rp=require(_0x99f1('0x5'));var fs=require('fs');var path=require(_0x99f1('0x6'));var rimraf=require('rimraf');var config=require(_0x99f1('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0x99f1('0x8')]=function(_0x205c11,_0x4e9ac5){return _0x205c11[_0x99f1('0x9')](_0x99f1('0xa'),attributes,{'tableName':_0x99f1('0xb'),'paranoid':![],'indexes':[{'name':_0x99f1('0xc'),'fields':[_0x99f1('0xd'),_0x99f1('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index c0f42dc..7d0d15f 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 _0x5eb8=['info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\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(_0x463645,_0x1a6477){var _0x33c735=function(_0x404c81){while(--_0x404c81){_0x463645['push'](_0x463645['shift']());}};_0x33c735(++_0x1a6477);}(_0x5eb8,0xb0));var _0x85eb=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0x5eb8[_0x4fe19c];return _0x952ac7;};'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')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});} \ No newline at end of file +var _0xbaf0=['client','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x483102,_0x54e93d){var _0x5cc885=function(_0x54931c){while(--_0x54931c){_0x483102['push'](_0x483102['shift']());}};_0x5cc885(++_0x54e93d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'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')]('SugarcrmField,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index b3049f3..618e2bf 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 _0x5ece=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','path'];(function(_0x3a0ffc,_0x461c4f){var _0x4beb4a=function(_0x2b109e){while(--_0x2b109e){_0x3a0ffc['push'](_0x3a0ffc['shift']());}};_0x4beb4a(++_0x461c4f);}(_0x5ece,0xc4));var _0xe5ec=function(_0xcad50,_0x4ebcd3){_0xcad50=_0xcad50-0x0;var _0x64d2bc=_0x5ece[_0xcad50];return _0x64d2bc;};'use strict';var multer=require('multer');var util=require(_0xe5ec('0x0'));var path=require(_0xe5ec('0x1'));var timeout=require(_0xe5ec('0x2'));var express=require(_0xe5ec('0x3'));var router=express[_0xe5ec('0x4')]();var auth=require(_0xe5ec('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe5ec('0x6'));var controller=require('./intVtigerAccount.controller');router[_0xe5ec('0x7')]('/',auth[_0xe5ec('0x8')](),controller[_0xe5ec('0x9')]);router[_0xe5ec('0x7')](_0xe5ec('0xa'),auth[_0xe5ec('0x8')](),controller['show']);router[_0xe5ec('0x7')](_0xe5ec('0xb'),auth[_0xe5ec('0x8')](),controller['getConfigurations']);router['get'](_0xe5ec('0xc'),auth['isAuthenticated'](),controller[_0xe5ec('0xd')]);router[_0xe5ec('0xe')]('/',auth['isAuthenticated'](),controller[_0xe5ec('0xf')]);router[_0xe5ec('0xe')](_0xe5ec('0xb'),auth[_0xe5ec('0x8')](),controller[_0xe5ec('0x10')]);router[_0xe5ec('0x11')](_0xe5ec('0xa'),auth[_0xe5ec('0x8')](),controller[_0xe5ec('0x12')]);router[_0xe5ec('0x13')](_0xe5ec('0xa'),auth[_0xe5ec('0x8')](),controller[_0xe5ec('0x14')]);module[_0xe5ec('0x15')]=router; \ No newline at end of file +var _0x9ea3=['show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','update','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x3b76e9,_0x39efb2){var _0x43489c=function(_0x1040a9){while(--_0x1040a9){_0x3b76e9['push'](_0x3b76e9['shift']());}};_0x43489c(++_0x39efb2);}(_0x9ea3,0xf0));var _0x39ea=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x9ea3[_0x4dc7b9];return _0x3ab114;};'use strict';var multer=require(_0x39ea('0x0'));var util=require('util');var path=require(_0x39ea('0x1'));var timeout=require(_0x39ea('0x2'));var express=require(_0x39ea('0x3'));var router=express['Router']();var auth=require(_0x39ea('0x4'));var interaction=require(_0x39ea('0x5'));var config=require(_0x39ea('0x6'));var controller=require(_0x39ea('0x7'));router[_0x39ea('0x8')]('/',auth[_0x39ea('0x9')](),controller[_0x39ea('0xa')]);router[_0x39ea('0x8')](_0x39ea('0xb'),auth['isAuthenticated'](),controller[_0x39ea('0xc')]);router[_0x39ea('0x8')](_0x39ea('0xd'),auth[_0x39ea('0x9')](),controller['getConfigurations']);router[_0x39ea('0x8')](_0x39ea('0xe'),auth[_0x39ea('0x9')](),controller[_0x39ea('0xf')]);router[_0x39ea('0x10')]('/',auth[_0x39ea('0x9')](),controller['create']);router[_0x39ea('0x10')](_0x39ea('0xd'),auth[_0x39ea('0x9')](),controller[_0x39ea('0x11')]);router['put'](_0x39ea('0xb'),auth[_0x39ea('0x9')](),controller[_0x39ea('0x12')]);router[_0x39ea('0x13')]('/:id',auth[_0x39ea('0x9')](),controller[_0x39ea('0x14')]);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 2745927..dd3ffc9 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 _0xd606=['exports','STRING','sequelize'];(function(_0x39acc3,_0xf36e44){var _0x8a77ef=function(_0x4366e6){while(--_0x4366e6){_0x39acc3['push'](_0x39acc3['shift']());}};_0x8a77ef(++_0xf36e44);}(_0xd606,0x13d));var _0x6d60=function(_0x5d0e8a,_0x47424f){_0x5d0e8a=_0x5d0e8a-0x0;var _0x236da3=_0xd606[_0x5d0e8a];return _0x236da3;};'use strict';var Sequelize=require(_0x6d60('0x0'));module[_0x6d60('0x1')]={'name':{'type':Sequelize[_0x6d60('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6d60('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x6d60('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x6d60('0x2')]},'accessKey':{'type':Sequelize[_0x6d60('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x8a8c=['sequelize','exports','STRING'];(function(_0x14fad0,_0x278d75){var _0x5c665f=function(_0xe43a83){while(--_0xe43a83){_0x14fad0['push'](_0x14fad0['shift']());}};_0x5c665f(++_0x278d75);}(_0x8a8c,0x186));var _0xc8a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a8c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc8a8('0x0'));module[_0xc8a8('0x1')]={'name':{'type':Sequelize[_0xc8a8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc8a8('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xc8a8('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xc8a8('0x2')]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 00b1a1a..5a9cb10 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 _0x0814=['nolimit','limit','order','sort','pick','where','type','filter','merge','include','findAll','rows','show','params','keys','options','find','create','body','getConfigurations','VtigerConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerField','Descriptions','md5','description','moduleName','serverUrl','accessKey','username','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','token','describe','sessionName','reference','owner','includes','remove','false','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../components/integrations/configuration','client','request','then','debug','request\x20sent','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','count','offset','Content-Range','json','apply','update','destroy','end','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x4503df,_0xfec122){var _0x3f1b2b=function(_0x32b1de){while(--_0x32b1de){_0x4503df['push'](_0x4503df['shift']());}};_0x3f1b2b(++_0xfec122);}(_0x0814,0x138));var _0x4081=function(_0x5292f5,_0x39df8d){_0x5292f5=_0x5292f5-0x0;var _0x52d382=_0x0814[_0x5292f5];return _0x52d382;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4081('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4081('0x1'));var jsonpatch=require(_0x4081('0x2'));var rp=require(_0x4081('0x3'));var moment=require(_0x4081('0x4'));var BPromise=require(_0x4081('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4081('0x6'));var sox=require(_0x4081('0x7'));var csv=require(_0x4081('0x8'));var ejs=require(_0x4081('0x9'));var fs=require('fs');var _=require(_0x4081('0xa'));var squel=require(_0x4081('0xb'));var crypto=require('crypto');var jsforce=require(_0x4081('0xc'));var deskjs=require(_0x4081('0xd'));var toCsv=require(_0x4081('0x8'));var querystring=require(_0x4081('0xe'));var Papa=require(_0x4081('0xf'));var Redis=require(_0x4081('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4081('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4081('0x12'));var utils=require(_0x4081('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x4081('0x14'));var jayson=require('jayson/promise');var client=jayson[_0x4081('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e12c5,_0x588d0f,_0x7060b4,_0x53d2dd){return new BPromise(function(_0x305815,_0xce0837){var _0xbc250d=_0x53d2dd||client;return _0xbc250d[_0x4081('0x16')](_0x5e12c5,_0x7060b4)[_0x4081('0x17')](function(_0x3c84f3){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x588d0f,'request\x20sent');logger[_0x4081('0x18')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x588d0f,_0x4081('0x19'),JSON[_0x4081('0x1a')](_0x3c84f3));if(_0x3c84f3[_0x4081('0x1b')]){if(_0x3c84f3[_0x4081('0x1b')][_0x4081('0x1c')]===0x1f4){logger[_0x4081('0x1b')](_0x4081('0x1d'),_0x588d0f,_0x3c84f3[_0x4081('0x1b')][_0x4081('0x1e')]);return _0xce0837(_0x3c84f3[_0x4081('0x1b')][_0x4081('0x1e')]);}logger[_0x4081('0x1b')](_0x4081('0x1d'),_0x588d0f,_0x3c84f3[_0x4081('0x1b')][_0x4081('0x1e')]);return _0x305815(_0x3c84f3[_0x4081('0x1b')][_0x4081('0x1e')]);}else{logger[_0x4081('0x1f')]('VtigerAccount,\x20%s,\x20%s',_0x588d0f,_0x4081('0x19'));_0x305815(_0x3c84f3[_0x4081('0x20')][_0x4081('0x1e')]);}})[_0x4081('0x21')](function(_0x26ba2c){logger[_0x4081('0x1b')](_0x4081('0x1d'),_0x588d0f,_0x26ba2c);_0xce0837(_0x26ba2c);});});}function respondWithStatusCode(_0x1db0d0,_0x26172f){_0x26172f=_0x26172f||0xcc;return function(_0x1c16bc){if(_0x1c16bc){return _0x1db0d0[_0x4081('0x22')](_0x26172f);}return _0x1db0d0[_0x4081('0x23')](_0x26172f)['end']();};}function respondWithResult(_0x3cd569,_0x4e7e39){_0x4e7e39=_0x4e7e39||0xc8;return function(_0x517ba0){if(_0x517ba0){return _0x3cd569['status'](_0x4e7e39)['json'](_0x517ba0);}};}function respondWithFilteredResult(_0x46bd50,_0x1a73d9){return function(_0x2ef32e){if(_0x2ef32e){var _0x242a13=_0x2ef32e[_0x4081('0x24')],_0x1c33a7=_0x1a73d9[_0x4081('0x25')],_0x41e9de=_0x1a73d9[_0x4081('0x25')]+_0x1a73d9['limit'],_0x2e6b52;if(_0x41e9de>=_0x242a13){_0x41e9de=_0x242a13;_0x2e6b52=0xc8;}else{_0x2e6b52=0xce;}_0x46bd50[_0x4081('0x23')](_0x2e6b52);return _0x46bd50['set'](_0x4081('0x26'),_0x1c33a7+'-'+_0x41e9de+'/'+_0x242a13)[_0x4081('0x27')](_0x2ef32e);}return null;};}function patchUpdates(_0x400683){return function(_0x4470e9){try{jsonpatch[_0x4081('0x28')](_0x4470e9,_0x400683,!![]);}catch(_0xbc14f8){return BPromise['reject'](_0xbc14f8);}return _0x4470e9['save']();};}function saveUpdates(_0x5d58dd,_0x23b409){return function(_0xb281fb){if(_0xb281fb){return _0xb281fb[_0x4081('0x29')](_0x5d58dd)['then'](function(_0x477ff2){return _0x477ff2;});}return null;};}function removeEntity(_0x3578e5,_0x4a8c6b){return function(_0x34ee43){if(_0x34ee43){return _0x34ee43[_0x4081('0x2a')]()['then'](function(){_0x3578e5[_0x4081('0x23')](0xcc)[_0x4081('0x2b')]();});}};}function handleEntityNotFound(_0xc783e0,_0x3f9784){return function(_0x50031c){if(!_0x50031c){_0xc783e0[_0x4081('0x22')](0x194);}return _0x50031c;};}function handleError(_0x191d17,_0x49b69e){_0x49b69e=_0x49b69e||0x1f4;return function(_0x292ccb){logger[_0x4081('0x1b')](_0x292ccb[_0x4081('0x2c')]);if(_0x292ccb[_0x4081('0x2d')]){delete _0x292ccb[_0x4081('0x2d')];}_0x191d17['status'](_0x49b69e)[_0x4081('0x2e')](_0x292ccb);};}exports['index']=function(_0x26adbb,_0x3f4c1f){var _0xe4a82a={},_0x303d32={},_0x33b345={'count':0x0,'rows':[]};var _0x38e9f3=_[_0x4081('0x2f')](db[_0x4081('0x30')][_0x4081('0x31')],function(_0x1545a6){return{'name':_0x1545a6[_0x4081('0x32')],'type':_0x1545a6['type'][_0x4081('0x33')]};});_0x303d32['model']=_[_0x4081('0x2f')](_0x38e9f3,'name');_0x303d32[_0x4081('0x34')]=_['keys'](_0x26adbb[_0x4081('0x34')]);_0x303d32[_0x4081('0x35')]=_[_0x4081('0x36')](_0x303d32[_0x4081('0x37')],_0x303d32[_0x4081('0x34')]);_0xe4a82a['attributes']=_['intersection'](_0x303d32['model'],qs[_0x4081('0x38')](_0x26adbb[_0x4081('0x34')][_0x4081('0x38')]));_0xe4a82a['attributes']=_0xe4a82a[_0x4081('0x39')][_0x4081('0x3a')]?_0xe4a82a['attributes']:_0x303d32[_0x4081('0x37')];if(!_0x26adbb['query'][_0x4081('0x3b')](_0x4081('0x3c'))){_0xe4a82a[_0x4081('0x3d')]=qs[_0x4081('0x3d')](_0x26adbb[_0x4081('0x34')][_0x4081('0x3d')]);_0xe4a82a[_0x4081('0x25')]=qs[_0x4081('0x25')](_0x26adbb[_0x4081('0x34')][_0x4081('0x25')]);}_0xe4a82a[_0x4081('0x3e')]=qs[_0x4081('0x3f')](_0x26adbb[_0x4081('0x34')]['sort']);_0xe4a82a['where']=qs['filters'](_[_0x4081('0x40')](_0x26adbb[_0x4081('0x34')],_0x303d32[_0x4081('0x35')]),_0x38e9f3);if(_0x26adbb[_0x4081('0x34')]['filter']){_0xe4a82a['where']=_['merge'](_0xe4a82a[_0x4081('0x41')],{'$or':_['map'](_0x38e9f3,function(_0x112c50){if(_0x112c50[_0x4081('0x42')]!=='VIRTUAL'){var _0x5b2d2c={};_0x5b2d2c[_0x112c50[_0x4081('0x2d')]]={'$like':'%'+_0x26adbb[_0x4081('0x34')][_0x4081('0x43')]+'%'};return _0x5b2d2c;}})});}_0xe4a82a=_[_0x4081('0x44')]({},_0xe4a82a,_0x26adbb['options']);var _0x26d9c4={'where':_0xe4a82a[_0x4081('0x41')]};return db[_0x4081('0x30')]['count'](_0x26d9c4)['then'](function(_0x1e4f70){_0x33b345[_0x4081('0x24')]=_0x1e4f70;if(_0x26adbb[_0x4081('0x34')]['includeAll']){_0xe4a82a[_0x4081('0x45')]=[{'all':!![]}];}return db[_0x4081('0x30')][_0x4081('0x46')](_0xe4a82a);})[_0x4081('0x17')](function(_0x4d5e53){_0x33b345[_0x4081('0x47')]=_0x4d5e53;return _0x33b345;})[_0x4081('0x17')](respondWithFilteredResult(_0x3f4c1f,_0xe4a82a))[_0x4081('0x21')](handleError(_0x3f4c1f,null));};exports[_0x4081('0x48')]=function(_0x271de9,_0x53f300){var _0x2ef7ff={'raw':![],'where':{'id':_0x271de9[_0x4081('0x49')]['id']}},_0x5dfa11={};_0x5dfa11[_0x4081('0x37')]=_[_0x4081('0x4a')](db['VtigerAccount'][_0x4081('0x31')]);_0x5dfa11['query']=_['keys'](_0x271de9[_0x4081('0x34')]);_0x5dfa11['filtears']=_[_0x4081('0x36')](_0x5dfa11[_0x4081('0x37')],_0x5dfa11[_0x4081('0x34')]);_0x2ef7ff[_0x4081('0x39')]=_[_0x4081('0x36')](_0x5dfa11[_0x4081('0x37')],qs[_0x4081('0x38')](_0x271de9[_0x4081('0x34')][_0x4081('0x38')]));_0x2ef7ff['attributes']=_0x2ef7ff[_0x4081('0x39')][_0x4081('0x3a')]?_0x2ef7ff['attributes']:_0x5dfa11[_0x4081('0x37')];if(_0x271de9['query']['includeAll']){_0x2ef7ff[_0x4081('0x45')]=[{'all':!![]}];}_0x2ef7ff=_[_0x4081('0x44')]({},_0x2ef7ff,_0x271de9[_0x4081('0x4b')]);return db['VtigerAccount'][_0x4081('0x4c')](_0x2ef7ff)[_0x4081('0x17')](handleEntityNotFound(_0x53f300,null))[_0x4081('0x17')](respondWithResult(_0x53f300,null))['catch'](handleError(_0x53f300,null));};exports[_0x4081('0x4d')]=function(_0x4d8196,_0x512be6){return db[_0x4081('0x30')][_0x4081('0x4d')](_0x4d8196[_0x4081('0x4e')],{})['then'](respondWithResult(_0x512be6,0xc9))[_0x4081('0x21')](handleError(_0x512be6,null));};exports[_0x4081('0x29')]=function(_0xff5db6,_0x330d4f){if(_0xff5db6[_0x4081('0x4e')]['id']){delete _0xff5db6[_0x4081('0x4e')]['id'];}return db['VtigerAccount'][_0x4081('0x4c')]({'where':{'id':_0xff5db6['params']['id']}})[_0x4081('0x17')](handleEntityNotFound(_0x330d4f,null))[_0x4081('0x17')](saveUpdates(_0xff5db6[_0x4081('0x4e')],null))[_0x4081('0x17')](respondWithResult(_0x330d4f,null))['catch'](handleError(_0x330d4f,null));};exports['destroy']=function(_0x313f73,_0x3b2f10){return db[_0x4081('0x30')][_0x4081('0x4c')]({'where':{'id':_0x313f73[_0x4081('0x49')]['id']}})[_0x4081('0x17')](handleEntityNotFound(_0x3b2f10,null))['then'](removeEntity(_0x3b2f10,null))['catch'](handleError(_0x3b2f10,null));};exports[_0x4081('0x4f')]=function(_0x353452,_0x4e36cf,_0x11bc72){var _0x4a6c1e={};var _0x5224cb={};var _0x34f171;var _0x18a639;return db['VtigerAccount']['findOne']({'where':{'id':_0x353452[_0x4081('0x49')]['id']}})[_0x4081('0x17')](handleEntityNotFound(_0x4e36cf,null))[_0x4081('0x17')](function(_0x11567c){if(_0x11567c){_0x34f171=_0x11567c;_0x5224cb['model']=_[_0x4081('0x4a')](db[_0x4081('0x50')][_0x4081('0x31')]);_0x5224cb[_0x4081('0x34')]=_['keys'](_0x353452['query']);_0x5224cb['filters']=_['intersection'](_0x5224cb[_0x4081('0x37')],_0x5224cb['query']);_0x4a6c1e['attributes']=_[_0x4081('0x36')](_0x5224cb['model'],qs[_0x4081('0x38')](_0x353452[_0x4081('0x34')][_0x4081('0x38')]));_0x4a6c1e[_0x4081('0x39')]=_0x4a6c1e['attributes']['length']?_0x4a6c1e[_0x4081('0x39')]:_0x5224cb['model'];_0x4a6c1e['order']=qs['sort'](_0x353452['query'][_0x4081('0x3f')]);_0x4a6c1e[_0x4081('0x41')]=qs['filters'](_[_0x4081('0x40')](_0x353452[_0x4081('0x34')],_0x5224cb[_0x4081('0x35')]));if(_0x353452[_0x4081('0x34')][_0x4081('0x43')]){_0x4a6c1e[_0x4081('0x41')]=_['merge'](_0x4a6c1e['where'],{'$or':_[_0x4081('0x2f')](_0x4a6c1e[_0x4081('0x39')],function(_0xa547a7){var _0x5805f3={};_0x5805f3[_0xa547a7]={'$like':'%'+_0x353452[_0x4081('0x34')]['filter']+'%'};return _0x5805f3;})});}_0x4a6c1e=_[_0x4081('0x44')]({},_0x4a6c1e,_0x353452[_0x4081('0x4b')]);return _0x34f171[_0x4081('0x4f')](_0x4a6c1e);}})[_0x4081('0x17')](function(_0x6d5970){if(_0x6d5970){_0x18a639=_0x6d5970['length'];if(!_0x353452['query'][_0x4081('0x3b')]('nolimit')){_0x4a6c1e[_0x4081('0x3d')]=qs[_0x4081('0x3d')](_0x353452[_0x4081('0x34')]['limit']);_0x4a6c1e[_0x4081('0x25')]=qs['offset'](_0x353452[_0x4081('0x34')]['offset']);}return _0x34f171[_0x4081('0x4f')](_0x4a6c1e);}})[_0x4081('0x17')](function(_0x5829f2){if(_0x5829f2){return _0x5829f2?{'count':_0x18a639,'rows':_0x5829f2}:null;}})['then'](respondWithResult(_0x4e36cf,null))[_0x4081('0x21')](handleError(_0x4e36cf,null));};exports[_0x4081('0x51')]=function(_0x2e6338,_0x259d13,_0x5cf635){if(_0x2e6338['body']['id']){delete _0x2e6338[_0x4081('0x4e')]['id'];}return db[_0x4081('0x30')][_0x4081('0x52')]({'where':{'id':_0x2e6338['params']['id']}})[_0x4081('0x17')](handleEntityNotFound(_0x259d13,null))['then'](function(_0x1eee69){if(_0x1eee69){_0x2e6338[_0x4081('0x4e')][_0x4081('0x53')]=_0x1eee69['id'];_0x2e6338[_0x4081('0x4e')][_0x4081('0x54')]=integrations[_0x4081('0x55')](_0x2e6338['body'][_0x4081('0x56')],_0x2e6338[_0x4081('0x4e')][_0x4081('0x42')]);_0x2e6338[_0x4081('0x4e')]['Descriptions']=integrations[_0x4081('0x57')](_0x2e6338[_0x4081('0x4e')]['channel'],_0x2e6338[_0x4081('0x4e')][_0x4081('0x42')]);return db['VtigerConfiguration'][_0x4081('0x4d')](_0x2e6338[_0x4081('0x4e')],{'include':[{'model':db['VtigerField'],'as':_0x4081('0x54')},{'model':db[_0x4081('0x58')],'as':_0x4081('0x59')}]});}return null;})[_0x4081('0x17')](respondWithResult(_0x259d13,null))['catch'](handleError(_0x259d13,null));};var md5=require(_0x4081('0x5a'));exports['getFields']=function(_0x5c4576,_0x170527,_0x533011){var _0x299fe8=null;var _0x347eb7=null;var _0x25da6f=null;var _0x41c4ae=null;var _0x539d3c='';return db[_0x4081('0x30')]['findOne']({'where':{'id':_0x5c4576['params']['id']},'attributes':['id',_0x4081('0x2d'),'username',_0x4081('0x5b'),_0x4081('0x5c'),'remoteUri',_0x4081('0x5d'),_0x4081('0x5e')]})['then'](handleEntityNotFound(_0x170527,null))[_0x4081('0x17')](function(_0x507180){if(_0x507180){_0x299fe8=_0x507180[_0x4081('0x5f')];_0x347eb7=_0x507180[_0x4081('0x5e')];_0x25da6f=_0x507180[_0x4081('0x5c')];_0x539d3c=_0x507180[_0x4081('0x60')];var _0x44c5a4=_0x539d3c[_0x4081('0x61')](-0x1);if(_0x44c5a4==='/'){_0x539d3c=_0x539d3c[_0x4081('0x62')](0x0,_0x539d3c[_0x4081('0x63')](_0x44c5a4));}_0x41c4ae=util[_0x4081('0x64')](_0x4081('0x65'),_0x539d3c);var _0x599ebb={'method':_0x4081('0x66'),'uri':_0x41c4ae,'qs':{'operation':_0x4081('0x67'),'username':_0x507180[_0x4081('0x5f')]},'json':!![]};return rp(_0x599ebb);}})[_0x4081('0x17')](function(_0x5947ee){if(_0x5947ee[_0x4081('0x68')]){var _0x4236e6={'method':_0x4081('0x69'),'uri':_0x41c4ae,'form':{'operation':_0x4081('0x6a'),'username':_0x299fe8,'accessKey':md5(_0x5947ee['result'][_0x4081('0x6b')]+_0x347eb7)},'json':!![]};return rp(_0x4236e6);}})[_0x4081('0x17')](function(_0x565a54){if(_0x565a54[_0x4081('0x68')]){var _0x333044={'method':_0x4081('0x66'),'uri':_0x41c4ae,'qs':{'operation':_0x4081('0x6c'),'username':_0x299fe8,'sessionName':_0x565a54[_0x4081('0x20')][_0x4081('0x6d')],'elementType':_0x25da6f},'json':!![]};return rp(_0x333044);}})[_0x4081('0x17')](function(_0x91326c){if(_0x91326c[_0x4081('0x68')]){var _0x16d3bd=['autogenerated',_0x4081('0x6e'),_0x4081('0x6f')];_['remove'](_0x91326c[_0x4081('0x20')][_0x4081('0x38')],function(_0x7e1f76){return _0x16d3bd[_0x4081('0x70')](_0x7e1f76['type'][_0x4081('0x2d')]);});_[_0x4081('0x71')](_0x91326c[_0x4081('0x20')][_0x4081('0x38')],function(_0x419949){return _0x419949['editable']===_0x4081('0x72');});return{'count':_0x91326c[_0x4081('0x20')]['fields']['length'],'rows':_[_0x4081('0x2f')](_0x91326c[_0x4081('0x20')][_0x4081('0x38')],function(_0x189c25){return{'id':_0x189c25['name'],'name':_0x189c25['label'],'custom':_['startsWith'](_0x189c25[_0x4081('0x2d')],_0x4081('0x73'))?!![]:![],'options':_0x189c25[_0x4081('0x42')]['name']===_0x4081('0x74')&&_0x189c25[_0x4081('0x42')][_0x4081('0x75')]['length']>0x0?_[_0x4081('0x2f')](_0x189c25[_0x4081('0x42')][_0x4081('0x75')],function(_0x3722d3){return{'name':_0x3722d3['label'],'value':_0x3722d3[_0x4081('0x76')]};}):[]};})};}})['then'](respondWithResult(_0x170527,null))[_0x4081('0x21')](function(_0x197368){console[_0x4081('0x77')](_0x4081('0x78')+_0x197368);var _0x32d2a3=_0x5c4576['query']['test']?0x1f4:_0x197368[_0x4081('0x79')]||0x1f4;logger[_0x4081('0x1b')]('getFields,\x20%s,\x20%s,\x20%s',_0x4081('0x7a'),_0x32d2a3,JSON[_0x4081('0x1a')](_0x197368));delete _0x197368[_0x4081('0x2d')];if(_0x32d2a3===0x191){_0x32d2a3=0x190;}_0x170527[_0x4081('0x23')](_0x32d2a3)['send'](_0x5c4576[_0x4081('0x34')]['test']?{'message':_0x4081('0x7b'),'statusCode':_0x197368[_0x4081('0x79')]}:_0x197368);});}; \ No newline at end of file +var _0xe09e=['label','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','catch','sendStatus','status','count','offset','set','Content-Range','apply','save','update','then','end','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','params','filtears','options','create','body','find','destroy','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','description','remoteUri','serverUrl','accessKey','username','moduleName','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','describe','sessionName','autogenerated','owner','remove','editable','false'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0xe09e,0x8c));var _0xee09=function(_0x54bc19,_0x211e5e){_0x54bc19=_0x54bc19-0x0;var _0x471d8a=_0xe09e[_0x54bc19];return _0x471d8a;};'use strict';var pdf=require(_0xee09('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xee09('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xee09('0x2'));var rp=require('request-promise');var moment=require(_0xee09('0x3'));var BPromise=require(_0xee09('0x4'));var Mustache=require(_0xee09('0x5'));var util=require('util');var path=require('path');var sox=require(_0xee09('0x6'));var csv=require(_0xee09('0x7'));var ejs=require(_0xee09('0x8'));var fs=require('fs');var _=require(_0xee09('0x9'));var squel=require(_0xee09('0xa'));var crypto=require(_0xee09('0xb'));var jsforce=require(_0xee09('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xee09('0x7'));var querystring=require(_0xee09('0xd'));var Papa=require('papaparse');var Redis=require(_0xee09('0xe'));var authService=require(_0xee09('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xee09('0x10'));var hardwareService=require(_0xee09('0x11'));var logger=require(_0xee09('0x12'))(_0xee09('0x13'));var utils=require(_0xee09('0x14'));var config=require(_0xee09('0x15'));var licenseUtil=require(_0xee09('0x16'));var db=require(_0xee09('0x17'))['db'];var integrations=require(_0xee09('0x18'));var jayson=require(_0xee09('0x19'));var client=jayson['client'][_0xee09('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x474253,_0x3bc3b8,_0x21711f,_0x487eaf){return new BPromise(function(_0x24ffcf,_0x182353){var _0x555bbe=_0x487eaf||client;return _0x555bbe[_0xee09('0x1b')](_0x474253,_0x21711f)['then'](function(_0x28422c){logger[_0xee09('0x1c')]('VtigerAccount,\x20%s,\x20%s',_0x3bc3b8,_0xee09('0x1d'));logger[_0xee09('0x1e')](_0xee09('0x1f'),_0x3bc3b8,_0xee09('0x1d'),JSON[_0xee09('0x20')](_0x28422c));if(_0x28422c[_0xee09('0x21')]){if(_0x28422c['error'][_0xee09('0x22')]===0x1f4){logger['error'](_0xee09('0x23'),_0x3bc3b8,_0x28422c[_0xee09('0x21')][_0xee09('0x24')]);return _0x182353(_0x28422c['error'][_0xee09('0x24')]);}logger[_0xee09('0x21')](_0xee09('0x23'),_0x3bc3b8,_0x28422c[_0xee09('0x21')]['message']);return _0x24ffcf(_0x28422c['error'][_0xee09('0x24')]);}else{logger[_0xee09('0x1c')]('VtigerAccount,\x20%s,\x20%s',_0x3bc3b8,_0xee09('0x1d'));_0x24ffcf(_0x28422c['result'][_0xee09('0x24')]);}})[_0xee09('0x25')](function(_0x10c8a2){logger[_0xee09('0x21')](_0xee09('0x23'),_0x3bc3b8,_0x10c8a2);_0x182353(_0x10c8a2);});});}function respondWithStatusCode(_0x411722,_0x2f5d61){_0x2f5d61=_0x2f5d61||0xcc;return function(_0x3435da){if(_0x3435da){return _0x411722[_0xee09('0x26')](_0x2f5d61);}return _0x411722[_0xee09('0x27')](_0x2f5d61)['end']();};}function respondWithResult(_0x43ad25,_0x28d9e8){_0x28d9e8=_0x28d9e8||0xc8;return function(_0xc5e828){if(_0xc5e828){return _0x43ad25['status'](_0x28d9e8)['json'](_0xc5e828);}};}function respondWithFilteredResult(_0x42b6f0,_0x39c81e){return function(_0x1acd7f){if(_0x1acd7f){var _0x3df29e=_0x1acd7f[_0xee09('0x28')],_0x5720bf=_0x39c81e[_0xee09('0x29')],_0x34bf44=_0x39c81e[_0xee09('0x29')]+_0x39c81e['limit'],_0x53bc85;if(_0x34bf44>=_0x3df29e){_0x34bf44=_0x3df29e;_0x53bc85=0xc8;}else{_0x53bc85=0xce;}_0x42b6f0[_0xee09('0x27')](_0x53bc85);return _0x42b6f0[_0xee09('0x2a')](_0xee09('0x2b'),_0x5720bf+'-'+_0x34bf44+'/'+_0x3df29e)['json'](_0x1acd7f);}return null;};}function patchUpdates(_0xef10e1){return function(_0xe2ec1b){try{jsonpatch[_0xee09('0x2c')](_0xe2ec1b,_0xef10e1,!![]);}catch(_0x574927){return BPromise['reject'](_0x574927);}return _0xe2ec1b[_0xee09('0x2d')]();};}function saveUpdates(_0x221133,_0x5928f1){return function(_0x1297bf){if(_0x1297bf){return _0x1297bf[_0xee09('0x2e')](_0x221133)[_0xee09('0x2f')](function(_0x52b561){return _0x52b561;});}return null;};}function removeEntity(_0x4babe3,_0x243cb6){return function(_0x1ff746){if(_0x1ff746){return _0x1ff746['destroy']()['then'](function(){_0x4babe3[_0xee09('0x27')](0xcc)[_0xee09('0x30')]();});}};}function handleEntityNotFound(_0x262e3a,_0x5dbe03){return function(_0x434f12){if(!_0x434f12){_0x262e3a[_0xee09('0x26')](0x194);}return _0x434f12;};}function handleError(_0x3f43e0,_0x44c0ad){_0x44c0ad=_0x44c0ad||0x1f4;return function(_0x2354ce){logger[_0xee09('0x21')](_0x2354ce[_0xee09('0x31')]);if(_0x2354ce['name']){delete _0x2354ce[_0xee09('0x32')];}_0x3f43e0['status'](_0x44c0ad)[_0xee09('0x33')](_0x2354ce);};}exports[_0xee09('0x34')]=function(_0x539430,_0x47d9f0){var _0x25d220={},_0x3982fc={},_0x58a63e={'count':0x0,'rows':[]};var _0x366d98=_[_0xee09('0x35')](db[_0xee09('0x36')][_0xee09('0x37')],function(_0x3d5270){return{'name':_0x3d5270[_0xee09('0x38')],'type':_0x3d5270['type'][_0xee09('0x39')]};});_0x3982fc[_0xee09('0x3a')]=_['map'](_0x366d98,_0xee09('0x32'));_0x3982fc['query']=_[_0xee09('0x3b')](_0x539430['query']);_0x3982fc[_0xee09('0x3c')]=_[_0xee09('0x3d')](_0x3982fc[_0xee09('0x3a')],_0x3982fc[_0xee09('0x3e')]);_0x25d220[_0xee09('0x3f')]=_[_0xee09('0x3d')](_0x3982fc[_0xee09('0x3a')],qs['fields'](_0x539430[_0xee09('0x3e')][_0xee09('0x40')]));_0x25d220['attributes']=_0x25d220[_0xee09('0x3f')][_0xee09('0x41')]?_0x25d220[_0xee09('0x3f')]:_0x3982fc['model'];if(!_0x539430[_0xee09('0x3e')][_0xee09('0x42')](_0xee09('0x43'))){_0x25d220[_0xee09('0x44')]=qs[_0xee09('0x44')](_0x539430['query'][_0xee09('0x44')]);_0x25d220[_0xee09('0x29')]=qs[_0xee09('0x29')](_0x539430['query'][_0xee09('0x29')]);}_0x25d220[_0xee09('0x45')]=qs[_0xee09('0x46')](_0x539430[_0xee09('0x3e')][_0xee09('0x46')]);_0x25d220[_0xee09('0x47')]=qs[_0xee09('0x3c')](_[_0xee09('0x48')](_0x539430['query'],_0x3982fc['filters']),_0x366d98);if(_0x539430[_0xee09('0x3e')][_0xee09('0x49')]){_0x25d220[_0xee09('0x47')]=_[_0xee09('0x4a')](_0x25d220['where'],{'$or':_[_0xee09('0x35')](_0x366d98,function(_0xd90ee2){if(_0xd90ee2[_0xee09('0x4b')]!==_0xee09('0x4c')){var _0x4dbc6b={};_0x4dbc6b[_0xd90ee2['name']]={'$like':'%'+_0x539430[_0xee09('0x3e')][_0xee09('0x49')]+'%'};return _0x4dbc6b;}})});}_0x25d220=_[_0xee09('0x4a')]({},_0x25d220,_0x539430['options']);var _0x221277={'where':_0x25d220[_0xee09('0x47')]};return db[_0xee09('0x36')][_0xee09('0x28')](_0x221277)['then'](function(_0x173876){_0x58a63e[_0xee09('0x28')]=_0x173876;if(_0x539430[_0xee09('0x3e')][_0xee09('0x4d')]){_0x25d220[_0xee09('0x4e')]=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x25d220);})['then'](function(_0x41ca5c){_0x58a63e['rows']=_0x41ca5c;return _0x58a63e;})['then'](respondWithFilteredResult(_0x47d9f0,_0x25d220))[_0xee09('0x25')](handleError(_0x47d9f0,null));};exports['show']=function(_0x15d96c,_0x1daacb){var _0x5385f2={'raw':![],'where':{'id':_0x15d96c[_0xee09('0x4f')]['id']}},_0x46254f={};_0x46254f[_0xee09('0x3a')]=_[_0xee09('0x3b')](db[_0xee09('0x36')][_0xee09('0x37')]);_0x46254f[_0xee09('0x3e')]=_[_0xee09('0x3b')](_0x15d96c['query']);_0x46254f[_0xee09('0x50')]=_[_0xee09('0x3d')](_0x46254f['model'],_0x46254f[_0xee09('0x3e')]);_0x5385f2['attributes']=_[_0xee09('0x3d')](_0x46254f['model'],qs[_0xee09('0x40')](_0x15d96c[_0xee09('0x3e')][_0xee09('0x40')]));_0x5385f2[_0xee09('0x3f')]=_0x5385f2['attributes'][_0xee09('0x41')]?_0x5385f2[_0xee09('0x3f')]:_0x46254f[_0xee09('0x3a')];if(_0x15d96c['query'][_0xee09('0x4d')]){_0x5385f2[_0xee09('0x4e')]=[{'all':!![]}];}_0x5385f2=_[_0xee09('0x4a')]({},_0x5385f2,_0x15d96c[_0xee09('0x51')]);return db[_0xee09('0x36')]['find'](_0x5385f2)[_0xee09('0x2f')](handleEntityNotFound(_0x1daacb,null))[_0xee09('0x2f')](respondWithResult(_0x1daacb,null))[_0xee09('0x25')](handleError(_0x1daacb,null));};exports[_0xee09('0x52')]=function(_0x2065b2,_0xb84278){return db[_0xee09('0x36')][_0xee09('0x52')](_0x2065b2[_0xee09('0x53')],{})[_0xee09('0x2f')](respondWithResult(_0xb84278,0xc9))[_0xee09('0x25')](handleError(_0xb84278,null));};exports[_0xee09('0x2e')]=function(_0x2bc602,_0x305252){if(_0x2bc602['body']['id']){delete _0x2bc602['body']['id'];}return db[_0xee09('0x36')][_0xee09('0x54')]({'where':{'id':_0x2bc602[_0xee09('0x4f')]['id']}})[_0xee09('0x2f')](handleEntityNotFound(_0x305252,null))['then'](saveUpdates(_0x2bc602['body'],null))['then'](respondWithResult(_0x305252,null))[_0xee09('0x25')](handleError(_0x305252,null));};exports[_0xee09('0x55')]=function(_0x116acd,_0x45c790){return db[_0xee09('0x36')][_0xee09('0x54')]({'where':{'id':_0x116acd[_0xee09('0x4f')]['id']}})[_0xee09('0x2f')](handleEntityNotFound(_0x45c790,null))['then'](removeEntity(_0x45c790,null))[_0xee09('0x25')](handleError(_0x45c790,null));};exports[_0xee09('0x56')]=function(_0x1491d2,_0x41598f,_0x216817){var _0xe889ca={};var _0xb9ca88={};var _0xd54e;var _0x15a5ac;return db['VtigerAccount'][_0xee09('0x57')]({'where':{'id':_0x1491d2[_0xee09('0x4f')]['id']}})['then'](handleEntityNotFound(_0x41598f,null))[_0xee09('0x2f')](function(_0x93703d){if(_0x93703d){_0xd54e=_0x93703d;_0xb9ca88[_0xee09('0x3a')]=_[_0xee09('0x3b')](db[_0xee09('0x58')][_0xee09('0x37')]);_0xb9ca88['query']=_[_0xee09('0x3b')](_0x1491d2['query']);_0xb9ca88[_0xee09('0x3c')]=_[_0xee09('0x3d')](_0xb9ca88['model'],_0xb9ca88[_0xee09('0x3e')]);_0xe889ca[_0xee09('0x3f')]=_[_0xee09('0x3d')](_0xb9ca88[_0xee09('0x3a')],qs[_0xee09('0x40')](_0x1491d2[_0xee09('0x3e')][_0xee09('0x40')]));_0xe889ca['attributes']=_0xe889ca[_0xee09('0x3f')][_0xee09('0x41')]?_0xe889ca[_0xee09('0x3f')]:_0xb9ca88[_0xee09('0x3a')];_0xe889ca[_0xee09('0x45')]=qs[_0xee09('0x46')](_0x1491d2[_0xee09('0x3e')][_0xee09('0x46')]);_0xe889ca[_0xee09('0x47')]=qs['filters'](_[_0xee09('0x48')](_0x1491d2[_0xee09('0x3e')],_0xb9ca88[_0xee09('0x3c')]));if(_0x1491d2[_0xee09('0x3e')][_0xee09('0x49')]){_0xe889ca[_0xee09('0x47')]=_[_0xee09('0x4a')](_0xe889ca[_0xee09('0x47')],{'$or':_[_0xee09('0x35')](_0xe889ca[_0xee09('0x3f')],function(_0xe180f7){var _0x87ae11={};_0x87ae11[_0xe180f7]={'$like':'%'+_0x1491d2[_0xee09('0x3e')][_0xee09('0x49')]+'%'};return _0x87ae11;})});}_0xe889ca=_[_0xee09('0x4a')]({},_0xe889ca,_0x1491d2[_0xee09('0x51')]);return _0xd54e[_0xee09('0x56')](_0xe889ca);}})['then'](function(_0x12ed8d){if(_0x12ed8d){_0x15a5ac=_0x12ed8d[_0xee09('0x41')];if(!_0x1491d2['query']['hasOwnProperty']('nolimit')){_0xe889ca[_0xee09('0x44')]=qs[_0xee09('0x44')](_0x1491d2['query'][_0xee09('0x44')]);_0xe889ca[_0xee09('0x29')]=qs['offset'](_0x1491d2[_0xee09('0x3e')]['offset']);}return _0xd54e[_0xee09('0x56')](_0xe889ca);}})[_0xee09('0x2f')](function(_0x4bf5ff){if(_0x4bf5ff){return _0x4bf5ff?{'count':_0x15a5ac,'rows':_0x4bf5ff}:null;}})[_0xee09('0x2f')](respondWithResult(_0x41598f,null))[_0xee09('0x25')](handleError(_0x41598f,null));};exports[_0xee09('0x59')]=function(_0x1b5e14,_0x4625f5,_0x3f00a7){if(_0x1b5e14[_0xee09('0x53')]['id']){delete _0x1b5e14[_0xee09('0x53')]['id'];}return db['VtigerAccount'][_0xee09('0x57')]({'where':{'id':_0x1b5e14[_0xee09('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4625f5,null))[_0xee09('0x2f')](function(_0xd52ec3){if(_0xd52ec3){_0x1b5e14[_0xee09('0x53')][_0xee09('0x5a')]=_0xd52ec3['id'];_0x1b5e14['body'][_0xee09('0x5b')]=integrations[_0xee09('0x5c')](_0x1b5e14[_0xee09('0x53')][_0xee09('0x5d')],_0x1b5e14[_0xee09('0x53')][_0xee09('0x4b')]);_0x1b5e14[_0xee09('0x53')][_0xee09('0x5e')]=integrations[_0xee09('0x5f')](_0x1b5e14[_0xee09('0x53')][_0xee09('0x5d')],_0x1b5e14['body'][_0xee09('0x4b')]);return db[_0xee09('0x58')][_0xee09('0x52')](_0x1b5e14[_0xee09('0x53')],{'include':[{'model':db['VtigerField'],'as':_0xee09('0x5b')},{'model':db[_0xee09('0x60')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4625f5,null))[_0xee09('0x25')](handleError(_0x4625f5,null));};var md5=require(_0xee09('0x61'));exports[_0xee09('0x62')]=function(_0x17b9ba,_0x3749ca,_0x462179){var _0x25c4fb=null;var _0x5bc75a=null;var _0x16fcd6=null;var _0x75860e=null;var _0x488032='';return db['VtigerAccount'][_0xee09('0x57')]({'where':{'id':_0x17b9ba[_0xee09('0x4f')]['id']},'attributes':['id',_0xee09('0x32'),'username',_0xee09('0x63'),'moduleName',_0xee09('0x64'),_0xee09('0x65'),_0xee09('0x66')]})[_0xee09('0x2f')](handleEntityNotFound(_0x3749ca,null))['then'](function(_0x2b093c){if(_0x2b093c){_0x25c4fb=_0x2b093c[_0xee09('0x67')];_0x5bc75a=_0x2b093c[_0xee09('0x66')];_0x16fcd6=_0x2b093c[_0xee09('0x68')];_0x488032=_0x2b093c['remoteUri'];var _0x5d56dd=_0x488032[_0xee09('0x69')](-0x1);if(_0x5d56dd==='/'){_0x488032=_0x488032['substring'](0x0,_0x488032[_0xee09('0x6a')](_0x5d56dd));}_0x75860e=util[_0xee09('0x6b')](_0xee09('0x6c'),_0x488032);var _0x127e5e={'method':_0xee09('0x6d'),'uri':_0x75860e,'qs':{'operation':_0xee09('0x6e'),'username':_0x2b093c[_0xee09('0x67')]},'json':!![]};return rp(_0x127e5e);}})['then'](function(_0x47d395){if(_0x47d395[_0xee09('0x6f')]){var _0x4cbd73={'method':_0xee09('0x70'),'uri':_0x75860e,'form':{'operation':_0xee09('0x71'),'username':_0x25c4fb,'accessKey':md5(_0x47d395[_0xee09('0x72')]['token']+_0x5bc75a)},'json':!![]};return rp(_0x4cbd73);}})[_0xee09('0x2f')](function(_0x6dd4f1){if(_0x6dd4f1[_0xee09('0x6f')]){var _0x3a27cb={'method':'GET','uri':_0x75860e,'qs':{'operation':_0xee09('0x73'),'username':_0x25c4fb,'sessionName':_0x6dd4f1['result'][_0xee09('0x74')],'elementType':_0x16fcd6},'json':!![]};return rp(_0x3a27cb);}})[_0xee09('0x2f')](function(_0x390e77){if(_0x390e77[_0xee09('0x6f')]){var _0x4b398a=[_0xee09('0x75'),'reference',_0xee09('0x76')];_[_0xee09('0x77')](_0x390e77['result']['fields'],function(_0x455035){return _0x4b398a['includes'](_0x455035[_0xee09('0x4b')][_0xee09('0x32')]);});_[_0xee09('0x77')](_0x390e77['result'][_0xee09('0x40')],function(_0x3d22c1){return _0x3d22c1[_0xee09('0x78')]===_0xee09('0x79');});return{'count':_0x390e77[_0xee09('0x72')]['fields'][_0xee09('0x41')],'rows':_[_0xee09('0x35')](_0x390e77['result'][_0xee09('0x40')],function(_0x54bb57){return{'id':_0x54bb57['name'],'name':_0x54bb57[_0xee09('0x7a')],'custom':_['startsWith'](_0x54bb57[_0xee09('0x32')],_0xee09('0x7b'))?!![]:![],'options':_0x54bb57[_0xee09('0x4b')][_0xee09('0x32')]===_0xee09('0x7c')&&_0x54bb57[_0xee09('0x4b')][_0xee09('0x7d')][_0xee09('0x41')]>0x0?_['map'](_0x54bb57['type'][_0xee09('0x7d')],function(_0xe9195c){return{'name':_0xe9195c[_0xee09('0x7a')],'value':_0xe9195c[_0xee09('0x7e')]};}):[]};})};}})[_0xee09('0x2f')](respondWithResult(_0x3749ca,null))[_0xee09('0x25')](function(_0x5089b6){console[_0xee09('0x7f')](_0xee09('0x80')+_0x5089b6);var _0x3537ae=_0x17b9ba['query']['test']?0x1f4:_0x5089b6['statusCode']||0x1f4;logger[_0xee09('0x21')]('getFields,\x20%s,\x20%s,\x20%s',_0xee09('0x62'),_0x3537ae,JSON[_0xee09('0x20')](_0x5089b6));delete _0x5089b6[_0xee09('0x32')];if(_0x3537ae===0x191){_0x3537ae=0x190;}_0x3749ca['status'](_0x3537ae)[_0xee09('0x33')](_0x17b9ba[_0xee09('0x3e')][_0xee09('0x81')]?{'message':'Wrong\x20credentials','statusCode':_0x5089b6[_0xee09('0x82')]}:_0x5089b6);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 408587e..a1baad6 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 _0x58c6=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','lodash'];(function(_0x443782,_0x4d1791){var _0x188dcd=function(_0x389e44){while(--_0x389e44){_0x443782['push'](_0x443782['shift']());}};_0x188dcd(++_0x4d1791);}(_0x58c6,0xfb));var _0x658c=function(_0x55e1d1,_0x3c9376){_0x55e1d1=_0x55e1d1-0x0;var _0x1165db=_0x58c6[_0x55e1d1];return _0x1165db;};'use strict';var _=require(_0x658c('0x0'));var util=require('util');var logger=require(_0x658c('0x1'))(_0x658c('0x2'));var moment=require(_0x658c('0x3'));var BPromise=require(_0x658c('0x4'));var rp=require(_0x658c('0x5'));var fs=require('fs');var path=require(_0x658c('0x6'));var rimraf=require(_0x658c('0x7'));var config=require(_0x658c('0x8'));var attributes=require(_0x658c('0x9'));var integrations=require(_0x658c('0xa'));module[_0x658c('0xb')]=function(_0x4371dd,_0x3f89d9){return _0x4371dd[_0x658c('0xc')](_0x658c('0xd'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4530=['request-promise','rimraf','./intVtigerAccount.attributes','exports','define','VtigerAccount','lodash','../../config/logger','api','bluebird'];(function(_0x2d7687,_0x1a3119){var _0x3b114d=function(_0x58fd01){while(--_0x58fd01){_0x2d7687['push'](_0x2d7687['shift']());}};_0x3b114d(++_0x1a3119);}(_0x4530,0x114));var _0x0453=function(_0x1438f7,_0x27bb3d){_0x1438f7=_0x1438f7-0x0;var _0x81abc6=_0x4530[_0x1438f7];return _0x81abc6;};'use strict';var _=require(_0x0453('0x0'));var util=require('util');var logger=require(_0x0453('0x1'))(_0x0453('0x2'));var moment=require('moment');var BPromise=require(_0x0453('0x3'));var rp=require(_0x0453('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0453('0x5'));var config=require('../../config/environment');var attributes=require(_0x0453('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x0453('0x7')]=function(_0xbe05f3,_0x4f5bf5){return _0xbe05f3[_0x0453('0x8')](_0x0453('0x9'),attributes,{'tableName':'int_vtiger_accounts','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 fbc68df..c8e758e 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 _0xc1ab=['ShowVtigerAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetVtigerAccount','VtigerAccount','options','where','attributes','include','map','model','find','raw'];(function(_0x5752c8,_0x6576c5){var _0x2784d7=function(_0x3c37fe){while(--_0x3c37fe){_0x5752c8['push'](_0x5752c8['shift']());}};_0x2784d7(++_0x6576c5);}(_0xc1ab,0x1f0));var _0xbc1a=function(_0x26c4fc,_0x56d8ca){_0x26c4fc=_0x26c4fc-0x0;var _0x77c17c=_0xc1ab[_0x26c4fc];return _0x77c17c;};'use strict';var _=require(_0xbc1a('0x0'));var util=require(_0xbc1a('0x1'));var moment=require('moment');var BPromise=require(_0xbc1a('0x2'));var rs=require(_0xbc1a('0x3'));var fs=require('fs');var Redis=require(_0xbc1a('0x4'));var db=require(_0xbc1a('0x5'))['db'];var utils=require(_0xbc1a('0x6'));var logger=require(_0xbc1a('0x7'))(_0xbc1a('0x8'));var config=require(_0xbc1a('0x9'));var jayson=require(_0xbc1a('0xa'));var client=jayson[_0xbc1a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27fc03,_0x1c8f94,_0x5840e5){return new BPromise(function(_0x5cfde7,_0x5cfda5){return client[_0xbc1a('0xc')](_0x27fc03,_0x5840e5)[_0xbc1a('0xd')](function(_0x199e6c){logger[_0xbc1a('0xe')](_0xbc1a('0xf'),_0x1c8f94,_0xbc1a('0x10'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1c8f94,_0xbc1a('0x10'),JSON[_0xbc1a('0x11')](_0x199e6c));if(_0x199e6c[_0xbc1a('0x12')]){if(_0x199e6c[_0xbc1a('0x12')][_0xbc1a('0x13')]===0x1f4){logger[_0xbc1a('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x1c8f94,_0x199e6c[_0xbc1a('0x12')][_0xbc1a('0x14')]);return _0x5cfda5(_0x199e6c['error'][_0xbc1a('0x14')]);}logger[_0xbc1a('0x12')](_0xbc1a('0xf'),_0x1c8f94,_0x199e6c['error'][_0xbc1a('0x14')]);return _0x5cfde7(_0x199e6c[_0xbc1a('0x12')][_0xbc1a('0x14')]);}else{logger[_0xbc1a('0xe')](_0xbc1a('0xf'),_0x1c8f94,_0xbc1a('0x10'));_0x5cfde7(_0x199e6c['result'][_0xbc1a('0x14')]);}})[_0xbc1a('0x15')](function(_0x2b2f96){logger[_0xbc1a('0x12')](_0xbc1a('0xf'),_0x1c8f94,_0x2b2f96);_0x5cfda5(_0x2b2f96);});});}exports[_0xbc1a('0x16')]=function(_0x5ce444){var _0x34bb5a=this;return new Promise(function(_0x33f5a0,_0x577348){return db[_0xbc1a('0x17')]['findAll']({'raw':_0x5ce444[_0xbc1a('0x18')]?_0x5ce444[_0xbc1a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5ce444['options']?_0x5ce444[_0xbc1a('0x18')][_0xbc1a('0x19')]||null:null,'attributes':_0x5ce444[_0xbc1a('0x18')]?_0x5ce444[_0xbc1a('0x18')][_0xbc1a('0x1a')]||null:null,'limit':_0x5ce444[_0xbc1a('0x18')]?_0x5ce444['options']['limit']||null:null,'include':_0x5ce444[_0xbc1a('0x18')]?_0x5ce444[_0xbc1a('0x18')][_0xbc1a('0x1b')]?_[_0xbc1a('0x1c')](_0x5ce444[_0xbc1a('0x18')][_0xbc1a('0x1b')],function(_0x381e7c){return{'model':db[_0x381e7c[_0xbc1a('0x1d')]],'as':_0x381e7c['as'],'attributes':_0x381e7c['attributes'],'include':_0x381e7c[_0xbc1a('0x1b')]?_['map'](_0x381e7c[_0xbc1a('0x1b')],function(_0x5b602f){return{'model':db[_0x5b602f['model']],'as':_0x5b602f['as'],'attributes':_0x5b602f[_0xbc1a('0x1a')],'include':_0x5b602f[_0xbc1a('0x1b')]?_[_0xbc1a('0x1c')](_0x5b602f[_0xbc1a('0x1b')],function(_0x2798f1){return{'model':db[_0x2798f1[_0xbc1a('0x1d')]],'as':_0x2798f1['as'],'attributes':_0x2798f1[_0xbc1a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbc1a('0xd')](function(_0x637cf5){logger['info']('GetVtigerAccount',_0x5ce444);logger['debug']('GetVtigerAccount',_0x5ce444,JSON['stringify'](_0x637cf5));_0x33f5a0(_0x637cf5);})[_0xbc1a('0x15')](function(_0x1d3e15){logger['error'](_0xbc1a('0x16'),_0x1d3e15[_0xbc1a('0x14')],_0x5ce444);_0x577348(_0x34bb5a[_0xbc1a('0x12')](0x1f4,_0x1d3e15[_0xbc1a('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x18357f){var _0x3f78c1=this;return new Promise(function(_0x49d474,_0x677f63){return db[_0xbc1a('0x17')][_0xbc1a('0x1e')]({'raw':_0x18357f[_0xbc1a('0x18')]?_0x18357f[_0xbc1a('0x18')][_0xbc1a('0x1f')]===undefined?!![]:![]:!![],'where':_0x18357f[_0xbc1a('0x18')]?_0x18357f[_0xbc1a('0x18')][_0xbc1a('0x19')]||null:null,'attributes':_0x18357f[_0xbc1a('0x18')]?_0x18357f[_0xbc1a('0x18')][_0xbc1a('0x1a')]||null:null,'include':_0x18357f['options']?_0x18357f[_0xbc1a('0x18')]['include']?_['map'](_0x18357f[_0xbc1a('0x18')][_0xbc1a('0x1b')],function(_0x227884){return{'model':db[_0x227884[_0xbc1a('0x1d')]],'as':_0x227884['as'],'attributes':_0x227884['attributes'],'include':_0x227884['include']?_[_0xbc1a('0x1c')](_0x227884[_0xbc1a('0x1b')],function(_0x499d51){return{'model':db[_0x499d51['model']],'as':_0x499d51['as'],'attributes':_0x499d51['attributes'],'include':_0x499d51[_0xbc1a('0x1b')]?_['map'](_0x499d51['include'],function(_0x8e5c07){return{'model':db[_0x8e5c07[_0xbc1a('0x1d')]],'as':_0x8e5c07['as'],'attributes':_0x8e5c07[_0xbc1a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbc1a('0xd')](function(_0x57b5ee){logger['info'](_0xbc1a('0x20'),_0x18357f);logger['debug']('ShowVtigerAccount',_0x18357f,JSON[_0xbc1a('0x11')](_0x57b5ee));_0x49d474(_0x57b5ee);})[_0xbc1a('0x15')](function(_0x385cf1){logger[_0xbc1a('0x12')]('ShowVtigerAccount',_0x385cf1[_0xbc1a('0x14')],_0x18357f);_0x677f63(_0x3f78c1[_0xbc1a('0x12')](0x1f4,_0x385cf1[_0xbc1a('0x14')]));});});}; \ No newline at end of file +var _0xf26d=['where','attributes','limit','map','include','model','then','ShowVtigerAccount','find','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','request','request\x20sent','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','info','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw'];(function(_0x14e2ab,_0x12c1d5){var _0x2bb25=function(_0x2644d4){while(--_0x2644d4){_0x14e2ab['push'](_0x14e2ab['shift']());}};_0x2bb25(++_0x12c1d5);}(_0xf26d,0x1ae));var _0xdf26=function(_0x50fedb,_0x5d4a78){_0x50fedb=_0x50fedb-0x0;var _0x99325=_0xf26d[_0x50fedb];return _0x99325;};'use strict';var _=require(_0xdf26('0x0'));var util=require(_0xdf26('0x1'));var moment=require(_0xdf26('0x2'));var BPromise=require(_0xdf26('0x3'));var rs=require(_0xdf26('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf26('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xdf26('0x6'));var jayson=require(_0xdf26('0x7'));var client=jayson[_0xdf26('0x8')][_0xdf26('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x588107,_0x2de840,_0x191baa){return new BPromise(function(_0x257b83,_0x3a5725){return client[_0xdf26('0xa')](_0x588107,_0x191baa)['then'](function(_0x411df3){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x2de840,'request\x20sent');logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x2de840,_0xdf26('0xb'),JSON[_0xdf26('0xc')](_0x411df3));if(_0x411df3[_0xdf26('0xd')]){if(_0x411df3[_0xdf26('0xd')][_0xdf26('0xe')]===0x1f4){logger[_0xdf26('0xd')](_0xdf26('0xf'),_0x2de840,_0x411df3[_0xdf26('0xd')]['message']);return _0x3a5725(_0x411df3[_0xdf26('0xd')][_0xdf26('0x10')]);}logger['error'](_0xdf26('0xf'),_0x2de840,_0x411df3['error'][_0xdf26('0x10')]);return _0x257b83(_0x411df3[_0xdf26('0xd')][_0xdf26('0x10')]);}else{logger[_0xdf26('0x11')](_0xdf26('0xf'),_0x2de840,'request\x20sent');_0x257b83(_0x411df3[_0xdf26('0x12')][_0xdf26('0x10')]);}})[_0xdf26('0x13')](function(_0x15b210){logger[_0xdf26('0xd')](_0xdf26('0xf'),_0x2de840,_0x15b210);_0x3a5725(_0x15b210);});});}exports[_0xdf26('0x14')]=function(_0x35a5dc){var _0x4a8937=this;return new Promise(function(_0x3d299a,_0x5be4f8){return db[_0xdf26('0x15')][_0xdf26('0x16')]({'raw':_0x35a5dc[_0xdf26('0x17')]?_0x35a5dc['options'][_0xdf26('0x18')]===undefined?!![]:![]:!![],'where':_0x35a5dc[_0xdf26('0x17')]?_0x35a5dc[_0xdf26('0x17')][_0xdf26('0x19')]||null:null,'attributes':_0x35a5dc[_0xdf26('0x17')]?_0x35a5dc[_0xdf26('0x17')][_0xdf26('0x1a')]||null:null,'limit':_0x35a5dc['options']?_0x35a5dc[_0xdf26('0x17')][_0xdf26('0x1b')]||null:null,'include':_0x35a5dc['options']?_0x35a5dc[_0xdf26('0x17')]['include']?_[_0xdf26('0x1c')](_0x35a5dc[_0xdf26('0x17')][_0xdf26('0x1d')],function(_0x1dae04){return{'model':db[_0x1dae04[_0xdf26('0x1e')]],'as':_0x1dae04['as'],'attributes':_0x1dae04['attributes'],'include':_0x1dae04[_0xdf26('0x1d')]?_[_0xdf26('0x1c')](_0x1dae04[_0xdf26('0x1d')],function(_0x476dd5){return{'model':db[_0x476dd5[_0xdf26('0x1e')]],'as':_0x476dd5['as'],'attributes':_0x476dd5[_0xdf26('0x1a')],'include':_0x476dd5[_0xdf26('0x1d')]?_['map'](_0x476dd5[_0xdf26('0x1d')],function(_0xfe472a){return{'model':db[_0xfe472a[_0xdf26('0x1e')]],'as':_0xfe472a['as'],'attributes':_0xfe472a[_0xdf26('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdf26('0x1f')](function(_0x4fcf80){logger['info'](_0xdf26('0x14'),_0x35a5dc);logger['debug'](_0xdf26('0x14'),_0x35a5dc,JSON[_0xdf26('0xc')](_0x4fcf80));_0x3d299a(_0x4fcf80);})[_0xdf26('0x13')](function(_0x51eeae){logger['error'](_0xdf26('0x14'),_0x51eeae['message'],_0x35a5dc);_0x5be4f8(_0x4a8937[_0xdf26('0xd')](0x1f4,_0x51eeae[_0xdf26('0x10')]));});});};exports[_0xdf26('0x20')]=function(_0x4d84ed){var _0x3f14bf=this;return new Promise(function(_0x2f0a5b,_0xee8cc9){return db[_0xdf26('0x15')][_0xdf26('0x21')]({'raw':_0x4d84ed[_0xdf26('0x17')]?_0x4d84ed[_0xdf26('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4d84ed['options']?_0x4d84ed[_0xdf26('0x17')][_0xdf26('0x19')]||null:null,'attributes':_0x4d84ed[_0xdf26('0x17')]?_0x4d84ed[_0xdf26('0x17')][_0xdf26('0x1a')]||null:null,'include':_0x4d84ed['options']?_0x4d84ed['options'][_0xdf26('0x1d')]?_[_0xdf26('0x1c')](_0x4d84ed[_0xdf26('0x17')][_0xdf26('0x1d')],function(_0x532a71){return{'model':db[_0x532a71[_0xdf26('0x1e')]],'as':_0x532a71['as'],'attributes':_0x532a71[_0xdf26('0x1a')],'include':_0x532a71[_0xdf26('0x1d')]?_[_0xdf26('0x1c')](_0x532a71[_0xdf26('0x1d')],function(_0x13757b){return{'model':db[_0x13757b[_0xdf26('0x1e')]],'as':_0x13757b['as'],'attributes':_0x13757b[_0xdf26('0x1a')],'include':_0x13757b[_0xdf26('0x1d')]?_[_0xdf26('0x1c')](_0x13757b['include'],function(_0x5eea80){return{'model':db[_0x5eea80['model']],'as':_0x5eea80['as'],'attributes':_0x5eea80[_0xdf26('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdf26('0x1f')](function(_0x3d7e5c){logger[_0xdf26('0x11')](_0xdf26('0x20'),_0x4d84ed);logger[_0xdf26('0x22')](_0xdf26('0x20'),_0x4d84ed,JSON[_0xdf26('0xc')](_0x3d7e5c));_0x2f0a5b(_0x3d7e5c);})['catch'](function(_0x3ad736){logger[_0xdf26('0xd')](_0xdf26('0x20'),_0x3ad736[_0xdf26('0x10')],_0x4d84ed);_0xee8cc9(_0x3f14bf['error'](0x1f4,_0x3ad736['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 1da28cd..28c42cd 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getDescriptions','post','create'];(function(_0x8eb9d,_0x5d9609){var _0x107ee8=function(_0x4c8cc5){while(--_0x4c8cc5){_0x8eb9d['push'](_0x8eb9d['shift']());}};_0x107ee8(++_0x5d9609);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2181fc,_0x7283aa){_0x2181fc=_0x2181fc-0x0;var _0x315da1=_0x5f2f[_0x2181fc];return _0x315da1;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['getFields']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getSubjects']);router[_0xf5f2('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0xf')]('/',auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router[_0xf5f2('0x11')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file +var _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(_0x3043c6,_0x4ec16e){var _0x163010=function(_0x424a00){while(--_0x424a00){_0x3043c6['push'](_0x3043c6['shift']());}};_0x163010(++_0x4ec16e);}(_0xb10b,0x12a));var _0xbb10=function(_0x35b2a1,_0x4cdca8){_0x35b2a1=_0x35b2a1-0x0;var _0x6023da=_0xb10b[_0x35b2a1];return _0x6023da;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 9fd3ff0..b8979f6 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 _0x98d5=['sequelize','STRING'];(function(_0x35ef6b,_0x202c42){var _0x3ad145=function(_0x3092de){while(--_0x3092de){_0x35ef6b['push'](_0x35ef6b['shift']());}};_0x3ad145(++_0x202c42);}(_0x98d5,0x170));var _0x598d=function(_0x3fd6c8,_0x47416d){_0x3fd6c8=_0x3fd6c8-0x0;var _0x4769bd=_0x98d5[_0x3fd6c8];return _0x4769bd;};'use strict';var Sequelize=require(_0x598d('0x0'));module['exports']={'name':{'type':Sequelize[_0x598d('0x1')]},'description':{'type':Sequelize[_0x598d('0x1')]}}; \ No newline at end of file +var _0xb798=['sequelize','exports','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb798,0x1c5));var _0x8b79=function(_0x535606,_0x5d592b){_0x535606=_0x535606-0x0;var _0x1cce94=_0xb798[_0x535606];return _0x1cce94;};'use strict';var Sequelize=require(_0x8b79('0x0'));module[_0x8b79('0x1')]={'name':{'type':Sequelize[_0x8b79('0x2')]},'description':{'type':Sequelize[_0x8b79('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index ac585ee..ac3bde0 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 _0xdc1f=['send','index','map','VtigerConfiguration','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','length','find','create','body','destroy','findOne','VtigerField','order','sort','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','stack','name'];(function(_0xa83bed,_0x26bea3){var _0x4c2e44=function(_0x4a861d){while(--_0x4a861d){_0xa83bed['push'](_0xa83bed['shift']());}};_0x4c2e44(++_0x26bea3);}(_0xdc1f,0x84));var _0xfdc1=function(_0x3f9f7d,_0x10fd9b){_0x3f9f7d=_0x3f9f7d-0x0;var _0x29a11e=_0xdc1f[_0x3f9f7d];return _0x29a11e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfdc1('0x0'));var rimraf=require(_0xfdc1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfdc1('0x2'));var rp=require(_0xfdc1('0x3'));var moment=require('moment');var BPromise=require(_0xfdc1('0x4'));var Mustache=require(_0xfdc1('0x5'));var util=require(_0xfdc1('0x6'));var path=require(_0xfdc1('0x7'));var sox=require(_0xfdc1('0x8'));var csv=require(_0xfdc1('0x9'));var ejs=require(_0xfdc1('0xa'));var fs=require('fs');var _=require(_0xfdc1('0xb'));var squel=require(_0xfdc1('0xc'));var crypto=require('crypto');var jsforce=require(_0xfdc1('0xd'));var deskjs=require(_0xfdc1('0xe'));var toCsv=require(_0xfdc1('0x9'));var querystring=require(_0xfdc1('0xf'));var Papa=require(_0xfdc1('0x10'));var Redis=require(_0xfdc1('0x11'));var authService=require(_0xfdc1('0x12'));var qs=require(_0xfdc1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfdc1('0x14'))(_0xfdc1('0x15'));var utils=require(_0xfdc1('0x16'));var config=require(_0xfdc1('0x17'));var licenseUtil=require(_0xfdc1('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0xfdc1('0x19'));var client=jayson[_0xfdc1('0x1a')][_0xfdc1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2edfe2,_0x3f5a22,_0x343e53,_0x15ca99){return new BPromise(function(_0xd5b5b8,_0x849ac5){var _0x404011=_0x15ca99||client;return _0x404011[_0xfdc1('0x1c')](_0x2edfe2,_0x343e53)[_0xfdc1('0x1d')](function(_0x2de907){logger[_0xfdc1('0x1e')](_0xfdc1('0x1f'),_0x3f5a22,'request\x20sent');logger[_0xfdc1('0x20')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x3f5a22,_0xfdc1('0x21'),JSON[_0xfdc1('0x22')](_0x2de907));if(_0x2de907[_0xfdc1('0x23')]){if(_0x2de907[_0xfdc1('0x23')][_0xfdc1('0x24')]===0x1f4){logger[_0xfdc1('0x23')]('VtigerConfiguration,\x20%s,\x20%s',_0x3f5a22,_0x2de907['error'][_0xfdc1('0x25')]);return _0x849ac5(_0x2de907[_0xfdc1('0x23')]['message']);}logger[_0xfdc1('0x23')](_0xfdc1('0x1f'),_0x3f5a22,_0x2de907[_0xfdc1('0x23')][_0xfdc1('0x25')]);return _0xd5b5b8(_0x2de907['error'][_0xfdc1('0x25')]);}else{logger[_0xfdc1('0x1e')](_0xfdc1('0x1f'),_0x3f5a22,_0xfdc1('0x21'));_0xd5b5b8(_0x2de907[_0xfdc1('0x26')][_0xfdc1('0x25')]);}})[_0xfdc1('0x27')](function(_0x377935){logger[_0xfdc1('0x23')](_0xfdc1('0x1f'),_0x3f5a22,_0x377935);_0x849ac5(_0x377935);});});}function respondWithStatusCode(_0x576275,_0x1531f3){_0x1531f3=_0x1531f3||0xcc;return function(_0x3cfa21){if(_0x3cfa21){return _0x576275[_0xfdc1('0x28')](_0x1531f3);}return _0x576275['status'](_0x1531f3)[_0xfdc1('0x29')]();};}function respondWithResult(_0x42e6d5,_0x20e33f){_0x20e33f=_0x20e33f||0xc8;return function(_0x136d37){if(_0x136d37){return _0x42e6d5[_0xfdc1('0x2a')](_0x20e33f)[_0xfdc1('0x2b')](_0x136d37);}};}function respondWithFilteredResult(_0x5b317c,_0x28a119){return function(_0x28668f){if(_0x28668f){var _0x5646b2=_0x28668f[_0xfdc1('0x2c')],_0x53a2ec=_0x28a119[_0xfdc1('0x2d')],_0x99c926=_0x28a119[_0xfdc1('0x2d')]+_0x28a119[_0xfdc1('0x2e')],_0x1ddd3b;if(_0x99c926>=_0x5646b2){_0x99c926=_0x5646b2;_0x1ddd3b=0xc8;}else{_0x1ddd3b=0xce;}_0x5b317c[_0xfdc1('0x2a')](_0x1ddd3b);return _0x5b317c[_0xfdc1('0x2f')](_0xfdc1('0x30'),_0x53a2ec+'-'+_0x99c926+'/'+_0x5646b2)['json'](_0x28668f);}return null;};}function patchUpdates(_0x487c60){return function(_0x2e364e){try{jsonpatch['apply'](_0x2e364e,_0x487c60,!![]);}catch(_0x21969f){return BPromise[_0xfdc1('0x31')](_0x21969f);}return _0x2e364e[_0xfdc1('0x32')]();};}function saveUpdates(_0x465b30,_0x50d8e9){return function(_0x41bfd2){if(_0x41bfd2){return _0x41bfd2[_0xfdc1('0x33')](_0x465b30)['then'](function(_0x48cd94){return _0x48cd94;});}return null;};}function removeEntity(_0x4f0a32,_0x59c99e){return function(_0x2cadb6){if(_0x2cadb6){return _0x2cadb6['destroy']()[_0xfdc1('0x1d')](function(){_0x4f0a32[_0xfdc1('0x2a')](0xcc)[_0xfdc1('0x29')]();});}};}function handleEntityNotFound(_0x21e90a,_0x527a33){return function(_0x14fada){if(!_0x14fada){_0x21e90a['sendStatus'](0x194);}return _0x14fada;};}function handleError(_0x215afb,_0x491e59){_0x491e59=_0x491e59||0x1f4;return function(_0x5d27e3){logger[_0xfdc1('0x23')](_0x5d27e3[_0xfdc1('0x34')]);if(_0x5d27e3[_0xfdc1('0x35')]){delete _0x5d27e3[_0xfdc1('0x35')];}_0x215afb[_0xfdc1('0x2a')](_0x491e59)[_0xfdc1('0x36')](_0x5d27e3);};}exports[_0xfdc1('0x37')]=function(_0x537b75,_0x526cfb){var _0x2ad5dc={},_0x1589f2={},_0x50a23c={'count':0x0,'rows':[]};var _0xf6110d=_[_0xfdc1('0x38')](db[_0xfdc1('0x39')][_0xfdc1('0x3a')],function(_0x3d07b9){return{'name':_0x3d07b9['fieldName'],'type':_0x3d07b9['type']['key']};});_0x1589f2[_0xfdc1('0x3b')]=_['map'](_0xf6110d,_0xfdc1('0x35'));_0x1589f2['query']=_[_0xfdc1('0x3c')](_0x537b75[_0xfdc1('0x3d')]);_0x1589f2[_0xfdc1('0x3e')]=_[_0xfdc1('0x3f')](_0x1589f2[_0xfdc1('0x3b')],_0x1589f2[_0xfdc1('0x3d')]);_0x2ad5dc[_0xfdc1('0x40')]=_['intersection'](_0x1589f2['model'],qs[_0xfdc1('0x41')](_0x537b75[_0xfdc1('0x3d')][_0xfdc1('0x41')]));_0x2ad5dc[_0xfdc1('0x40')]=_0x2ad5dc[_0xfdc1('0x40')]['length']?_0x2ad5dc['attributes']:_0x1589f2[_0xfdc1('0x3b')];if(!_0x537b75[_0xfdc1('0x3d')][_0xfdc1('0x42')](_0xfdc1('0x43'))){_0x2ad5dc['limit']=qs['limit'](_0x537b75[_0xfdc1('0x3d')][_0xfdc1('0x2e')]);_0x2ad5dc[_0xfdc1('0x2d')]=qs['offset'](_0x537b75[_0xfdc1('0x3d')][_0xfdc1('0x2d')]);}_0x2ad5dc['order']=qs['sort'](_0x537b75[_0xfdc1('0x3d')]['sort']);_0x2ad5dc[_0xfdc1('0x44')]=qs[_0xfdc1('0x3e')](_[_0xfdc1('0x45')](_0x537b75[_0xfdc1('0x3d')],_0x1589f2['filters']),_0xf6110d);if(_0x537b75[_0xfdc1('0x3d')][_0xfdc1('0x46')]){_0x2ad5dc[_0xfdc1('0x44')]=_['merge'](_0x2ad5dc[_0xfdc1('0x44')],{'$or':_[_0xfdc1('0x38')](_0xf6110d,function(_0x11bd3c){if(_0x11bd3c[_0xfdc1('0x47')]!==_0xfdc1('0x48')){var _0x36bcfa={};_0x36bcfa[_0x11bd3c[_0xfdc1('0x35')]]={'$like':'%'+_0x537b75[_0xfdc1('0x3d')][_0xfdc1('0x46')]+'%'};return _0x36bcfa;}})});}_0x2ad5dc=_[_0xfdc1('0x49')]({},_0x2ad5dc,_0x537b75[_0xfdc1('0x4a')]);var _0x281f44={'where':_0x2ad5dc[_0xfdc1('0x44')]};return db[_0xfdc1('0x39')][_0xfdc1('0x2c')](_0x281f44)[_0xfdc1('0x1d')](function(_0x19f1f0){_0x50a23c[_0xfdc1('0x2c')]=_0x19f1f0;if(_0x537b75['query'][_0xfdc1('0x4b')]){_0x2ad5dc[_0xfdc1('0x4c')]=[{'all':!![]}];}return db[_0xfdc1('0x39')][_0xfdc1('0x4d')](_0x2ad5dc);})[_0xfdc1('0x1d')](function(_0x10eecc){_0x50a23c[_0xfdc1('0x4e')]=_0x10eecc;return _0x50a23c;})[_0xfdc1('0x1d')](respondWithFilteredResult(_0x526cfb,_0x2ad5dc))['catch'](handleError(_0x526cfb,null));};exports[_0xfdc1('0x4f')]=function(_0x450174,_0x135527){var _0x35f7b8={'raw':![],'where':{'id':_0x450174[_0xfdc1('0x50')]['id']}},_0xa10119={};_0xa10119['model']=_['keys'](db[_0xfdc1('0x39')][_0xfdc1('0x3a')]);_0xa10119[_0xfdc1('0x3d')]=_['keys'](_0x450174[_0xfdc1('0x3d')]);_0xa10119['filtears']=_['intersection'](_0xa10119['model'],_0xa10119['query']);_0x35f7b8['attributes']=_[_0xfdc1('0x3f')](_0xa10119[_0xfdc1('0x3b')],qs[_0xfdc1('0x41')](_0x450174[_0xfdc1('0x3d')][_0xfdc1('0x41')]));_0x35f7b8[_0xfdc1('0x40')]=_0x35f7b8[_0xfdc1('0x40')][_0xfdc1('0x51')]?_0x35f7b8['attributes']:_0xa10119[_0xfdc1('0x3b')];if(_0x450174[_0xfdc1('0x3d')][_0xfdc1('0x4b')]){_0x35f7b8[_0xfdc1('0x4c')]=[{'all':!![]}];}_0x35f7b8=_[_0xfdc1('0x49')]({},_0x35f7b8,_0x450174['options']);return db[_0xfdc1('0x39')][_0xfdc1('0x52')](_0x35f7b8)[_0xfdc1('0x1d')](handleEntityNotFound(_0x135527,null))[_0xfdc1('0x1d')](respondWithResult(_0x135527,null))[_0xfdc1('0x27')](handleError(_0x135527,null));};exports[_0xfdc1('0x53')]=function(_0x666caf,_0x96b993){return db[_0xfdc1('0x39')][_0xfdc1('0x53')](_0x666caf['body'],{})[_0xfdc1('0x1d')](respondWithResult(_0x96b993,0xc9))[_0xfdc1('0x27')](handleError(_0x96b993,null));};exports[_0xfdc1('0x33')]=function(_0x9a7de3,_0xc99992){if(_0x9a7de3[_0xfdc1('0x54')]['id']){delete _0x9a7de3['body']['id'];}return db[_0xfdc1('0x39')][_0xfdc1('0x52')]({'where':{'id':_0x9a7de3[_0xfdc1('0x50')]['id']}})[_0xfdc1('0x1d')](handleEntityNotFound(_0xc99992,null))[_0xfdc1('0x1d')](saveUpdates(_0x9a7de3[_0xfdc1('0x54')],null))[_0xfdc1('0x1d')](respondWithResult(_0xc99992,null))[_0xfdc1('0x27')](handleError(_0xc99992,null));};exports[_0xfdc1('0x55')]=function(_0x2b99d7,_0x5ec125){return db[_0xfdc1('0x39')][_0xfdc1('0x52')]({'where':{'id':_0x2b99d7[_0xfdc1('0x50')]['id']}})['then'](handleEntityNotFound(_0x5ec125,null))[_0xfdc1('0x1d')](removeEntity(_0x5ec125,null))[_0xfdc1('0x27')](handleError(_0x5ec125,null));};exports['getFields']=function(_0x1cfa4a,_0x358a4f,_0x562d2b){var _0x52cdfa={};var _0xce70cb={};var _0x45daea;var _0x2a63bb;return db[_0xfdc1('0x39')][_0xfdc1('0x56')]({'where':{'id':_0x1cfa4a[_0xfdc1('0x50')]['id']}})['then'](handleEntityNotFound(_0x358a4f,null))['then'](function(_0x3f1a21){if(_0x3f1a21){_0x45daea=_0x3f1a21;_0xce70cb['model']=_['keys'](db[_0xfdc1('0x57')][_0xfdc1('0x3a')]);_0xce70cb[_0xfdc1('0x3d')]=_[_0xfdc1('0x3c')](_0x1cfa4a[_0xfdc1('0x3d')]);_0xce70cb[_0xfdc1('0x3e')]=_['intersection'](_0xce70cb[_0xfdc1('0x3b')],_0xce70cb['query']);_0x52cdfa[_0xfdc1('0x40')]=_[_0xfdc1('0x3f')](_0xce70cb[_0xfdc1('0x3b')],qs[_0xfdc1('0x41')](_0x1cfa4a[_0xfdc1('0x3d')][_0xfdc1('0x41')]));_0x52cdfa['attributes']=_0x52cdfa['attributes'][_0xfdc1('0x51')]?_0x52cdfa[_0xfdc1('0x40')]:_0xce70cb[_0xfdc1('0x3b')];_0x52cdfa[_0xfdc1('0x58')]=qs[_0xfdc1('0x59')](_0x1cfa4a['query'][_0xfdc1('0x59')]);_0x52cdfa[_0xfdc1('0x44')]=qs['filters'](_[_0xfdc1('0x45')](_0x1cfa4a[_0xfdc1('0x3d')],_0xce70cb[_0xfdc1('0x3e')]));if(_0x1cfa4a[_0xfdc1('0x3d')][_0xfdc1('0x46')]){_0x52cdfa[_0xfdc1('0x44')]=_[_0xfdc1('0x49')](_0x52cdfa[_0xfdc1('0x44')],{'$or':_[_0xfdc1('0x38')](_0x52cdfa['attributes'],function(_0x191d1e){var _0x600155={};_0x600155[_0x191d1e]={'$like':'%'+_0x1cfa4a[_0xfdc1('0x3d')][_0xfdc1('0x46')]+'%'};return _0x600155;})});}_0x52cdfa=_['merge']({},_0x52cdfa,_0x1cfa4a['options']);return _0x45daea[_0xfdc1('0x5a')](_0x52cdfa);}})[_0xfdc1('0x1d')](function(_0x54feb6){if(_0x54feb6){_0x2a63bb=_0x54feb6[_0xfdc1('0x51')];if(!_0x1cfa4a[_0xfdc1('0x3d')]['hasOwnProperty'](_0xfdc1('0x43'))){_0x52cdfa[_0xfdc1('0x2e')]=qs[_0xfdc1('0x2e')](_0x1cfa4a['query']['limit']);_0x52cdfa[_0xfdc1('0x2d')]=qs[_0xfdc1('0x2d')](_0x1cfa4a['query']['offset']);}return _0x45daea[_0xfdc1('0x5a')](_0x52cdfa);}})['then'](function(_0x5a9c3f){if(_0x5a9c3f){return _0x5a9c3f?{'count':_0x2a63bb,'rows':_0x5a9c3f}:null;}})[_0xfdc1('0x1d')](respondWithResult(_0x358a4f,null))[_0xfdc1('0x27')](handleError(_0x358a4f,null));};exports[_0xfdc1('0x5b')]=function(_0x4647c5,_0x443eef,_0x1308ed){var _0x3205e8={};var _0x2e28b1={};var _0x2361fa;var _0x10cf63;return db[_0xfdc1('0x39')][_0xfdc1('0x56')]({'where':{'id':_0x4647c5[_0xfdc1('0x50')]['id']}})['then'](handleEntityNotFound(_0x443eef,null))[_0xfdc1('0x1d')](function(_0x1b0a2c){if(_0x1b0a2c){_0x2361fa=_0x1b0a2c;_0x2e28b1[_0xfdc1('0x3b')]=_[_0xfdc1('0x3c')](db[_0xfdc1('0x57')]['rawAttributes']);_0x2e28b1['query']=_[_0xfdc1('0x3c')](_0x4647c5[_0xfdc1('0x3d')]);_0x2e28b1['filters']=_[_0xfdc1('0x3f')](_0x2e28b1[_0xfdc1('0x3b')],_0x2e28b1['query']);_0x3205e8[_0xfdc1('0x40')]=_['intersection'](_0x2e28b1[_0xfdc1('0x3b')],qs[_0xfdc1('0x41')](_0x4647c5[_0xfdc1('0x3d')][_0xfdc1('0x41')]));_0x3205e8[_0xfdc1('0x40')]=_0x3205e8[_0xfdc1('0x40')][_0xfdc1('0x51')]?_0x3205e8[_0xfdc1('0x40')]:_0x2e28b1['model'];_0x3205e8[_0xfdc1('0x58')]=qs[_0xfdc1('0x59')](_0x4647c5[_0xfdc1('0x3d')]['sort']);_0x3205e8[_0xfdc1('0x44')]=qs[_0xfdc1('0x3e')](_['pick'](_0x4647c5[_0xfdc1('0x3d')],_0x2e28b1[_0xfdc1('0x3e')]));if(_0x4647c5['query'][_0xfdc1('0x46')]){_0x3205e8[_0xfdc1('0x44')]=_[_0xfdc1('0x49')](_0x3205e8[_0xfdc1('0x44')],{'$or':_[_0xfdc1('0x38')](_0x3205e8[_0xfdc1('0x40')],function(_0x2dc8b6){var _0x1f2876={};_0x1f2876[_0x2dc8b6]={'$like':'%'+_0x4647c5[_0xfdc1('0x3d')][_0xfdc1('0x46')]+'%'};return _0x1f2876;})});}_0x3205e8=_[_0xfdc1('0x49')]({},_0x3205e8,_0x4647c5[_0xfdc1('0x4a')]);return _0x2361fa[_0xfdc1('0x5b')](_0x3205e8);}})['then'](function(_0xd8990d){if(_0xd8990d){_0x10cf63=_0xd8990d[_0xfdc1('0x51')];if(!_0x4647c5[_0xfdc1('0x3d')][_0xfdc1('0x42')](_0xfdc1('0x43'))){_0x3205e8[_0xfdc1('0x2e')]=qs[_0xfdc1('0x2e')](_0x4647c5[_0xfdc1('0x3d')][_0xfdc1('0x2e')]);_0x3205e8[_0xfdc1('0x2d')]=qs[_0xfdc1('0x2d')](_0x4647c5['query'][_0xfdc1('0x2d')]);}return _0x2361fa[_0xfdc1('0x5b')](_0x3205e8);}})[_0xfdc1('0x1d')](function(_0xeeb005){if(_0xeeb005){return _0xeeb005?{'count':_0x10cf63,'rows':_0xeeb005}:null;}})['then'](respondWithResult(_0x443eef,null))['catch'](handleError(_0x443eef,null));};exports['getDescriptions']=function(_0x1b1d92,_0x5782ff,_0x205a93){var _0x2bbbc1={};var _0x34c414={};var _0x5f347b;var _0xaccc33;return db[_0xfdc1('0x39')]['findOne']({'where':{'id':_0x1b1d92[_0xfdc1('0x50')]['id']}})[_0xfdc1('0x1d')](handleEntityNotFound(_0x5782ff,null))['then'](function(_0x51988d){if(_0x51988d){_0x5f347b=_0x51988d;_0x34c414['model']=_['keys'](db[_0xfdc1('0x57')][_0xfdc1('0x3a')]);_0x34c414[_0xfdc1('0x3d')]=_[_0xfdc1('0x3c')](_0x1b1d92[_0xfdc1('0x3d')]);_0x34c414[_0xfdc1('0x3e')]=_[_0xfdc1('0x3f')](_0x34c414['model'],_0x34c414[_0xfdc1('0x3d')]);_0x2bbbc1[_0xfdc1('0x40')]=_[_0xfdc1('0x3f')](_0x34c414[_0xfdc1('0x3b')],qs[_0xfdc1('0x41')](_0x1b1d92[_0xfdc1('0x3d')][_0xfdc1('0x41')]));_0x2bbbc1[_0xfdc1('0x40')]=_0x2bbbc1[_0xfdc1('0x40')][_0xfdc1('0x51')]?_0x2bbbc1[_0xfdc1('0x40')]:_0x34c414[_0xfdc1('0x3b')];_0x2bbbc1['order']=qs[_0xfdc1('0x59')](_0x1b1d92[_0xfdc1('0x3d')][_0xfdc1('0x59')]);_0x2bbbc1[_0xfdc1('0x44')]=qs['filters'](_['pick'](_0x1b1d92[_0xfdc1('0x3d')],_0x34c414[_0xfdc1('0x3e')]));if(_0x1b1d92[_0xfdc1('0x3d')][_0xfdc1('0x46')]){_0x2bbbc1[_0xfdc1('0x44')]=_[_0xfdc1('0x49')](_0x2bbbc1[_0xfdc1('0x44')],{'$or':_[_0xfdc1('0x38')](_0x2bbbc1[_0xfdc1('0x40')],function(_0x54033d){var _0x19906d={};_0x19906d[_0x54033d]={'$like':'%'+_0x1b1d92[_0xfdc1('0x3d')][_0xfdc1('0x46')]+'%'};return _0x19906d;})});}_0x2bbbc1=_[_0xfdc1('0x49')]({},_0x2bbbc1,_0x1b1d92[_0xfdc1('0x4a')]);return _0x5f347b[_0xfdc1('0x5c')](_0x2bbbc1);}})[_0xfdc1('0x1d')](function(_0x1cad7a){if(_0x1cad7a){_0xaccc33=_0x1cad7a[_0xfdc1('0x51')];if(!_0x1b1d92[_0xfdc1('0x3d')][_0xfdc1('0x42')](_0xfdc1('0x43'))){_0x2bbbc1[_0xfdc1('0x2e')]=qs[_0xfdc1('0x2e')](_0x1b1d92[_0xfdc1('0x3d')][_0xfdc1('0x2e')]);_0x2bbbc1[_0xfdc1('0x2d')]=qs[_0xfdc1('0x2d')](_0x1b1d92[_0xfdc1('0x3d')][_0xfdc1('0x2d')]);}return _0x5f347b[_0xfdc1('0x5c')](_0x2bbbc1);}})[_0xfdc1('0x1d')](function(_0x29753e){if(_0x29753e){return _0x29753e?{'count':_0xaccc33,'rows':_0x29753e}:null;}})[_0xfdc1('0x1d')](respondWithResult(_0x5782ff,null))[_0xfdc1('0x27')](handleError(_0x5782ff,null));}; \ No newline at end of file +var _0xfbc4=['end','json','count','offset','limit','status','set','Content-Range','reject','save','update','destroy','then','stack','name','send','index','map','VtigerConfiguration','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','keys','filtears','find','create','body','getFields','findOne','options','getSubjects','VtigerField','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus'];(function(_0x2d29a4,_0x439251){var _0x3c8620=function(_0x50dc28){while(--_0x50dc28){_0x2d29a4['push'](_0x2d29a4['shift']());}};_0x3c8620(++_0x439251);}(_0xfbc4,0x96));var _0x4fbc=function(_0x321013,_0x5ec9f9){_0x321013=_0x321013-0x0;var _0x29ac89=_0xfbc4[_0x321013];return _0x29ac89;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4fbc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4fbc('0x1'));var rp=require(_0x4fbc('0x2'));var moment=require(_0x4fbc('0x3'));var BPromise=require(_0x4fbc('0x4'));var Mustache=require(_0x4fbc('0x5'));var util=require('util');var path=require(_0x4fbc('0x6'));var sox=require(_0x4fbc('0x7'));var csv=require('to-csv');var ejs=require(_0x4fbc('0x8'));var fs=require('fs');var _=require(_0x4fbc('0x9'));var squel=require(_0x4fbc('0xa'));var crypto=require(_0x4fbc('0xb'));var jsforce=require(_0x4fbc('0xc'));var deskjs=require(_0x4fbc('0xd'));var toCsv=require(_0x4fbc('0xe'));var querystring=require(_0x4fbc('0xf'));var Papa=require('papaparse');var Redis=require(_0x4fbc('0x10'));var authService=require(_0x4fbc('0x11'));var qs=require(_0x4fbc('0x12'));var as=require(_0x4fbc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4fbc('0x14'))(_0x4fbc('0x15'));var utils=require(_0x4fbc('0x16'));var config=require(_0x4fbc('0x17'));var licenseUtil=require(_0x4fbc('0x18'));var db=require(_0x4fbc('0x19'))['db'];var jayson=require(_0x4fbc('0x1a'));var client=jayson[_0x4fbc('0x1b')][_0x4fbc('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x337221,_0x3e17ea,_0x289b,_0x2fb9b0){return new BPromise(function(_0x536863,_0x38767e){var _0x1a29ad=_0x2fb9b0||client;return _0x1a29ad[_0x4fbc('0x1d')](_0x337221,_0x289b)['then'](function(_0x44f7b8){logger[_0x4fbc('0x1e')]('VtigerConfiguration,\x20%s,\x20%s',_0x3e17ea,'request\x20sent');logger['debug'](_0x4fbc('0x1f'),_0x3e17ea,_0x4fbc('0x20'),JSON[_0x4fbc('0x21')](_0x44f7b8));if(_0x44f7b8[_0x4fbc('0x22')]){if(_0x44f7b8[_0x4fbc('0x22')]['code']===0x1f4){logger[_0x4fbc('0x22')](_0x4fbc('0x23'),_0x3e17ea,_0x44f7b8['error'][_0x4fbc('0x24')]);return _0x38767e(_0x44f7b8[_0x4fbc('0x22')][_0x4fbc('0x24')]);}logger['error'](_0x4fbc('0x23'),_0x3e17ea,_0x44f7b8['error'][_0x4fbc('0x24')]);return _0x536863(_0x44f7b8['error'][_0x4fbc('0x24')]);}else{logger['info'](_0x4fbc('0x23'),_0x3e17ea,_0x4fbc('0x20'));_0x536863(_0x44f7b8[_0x4fbc('0x25')][_0x4fbc('0x24')]);}})[_0x4fbc('0x26')](function(_0x465ac7){logger['error'](_0x4fbc('0x23'),_0x3e17ea,_0x465ac7);_0x38767e(_0x465ac7);});});}function respondWithStatusCode(_0x597174,_0x355d18){_0x355d18=_0x355d18||0xcc;return function(_0x5d81a6){if(_0x5d81a6){return _0x597174[_0x4fbc('0x27')](_0x355d18);}return _0x597174['status'](_0x355d18)[_0x4fbc('0x28')]();};}function respondWithResult(_0x5f02f6,_0x2441f9){_0x2441f9=_0x2441f9||0xc8;return function(_0x384655){if(_0x384655){return _0x5f02f6['status'](_0x2441f9)[_0x4fbc('0x29')](_0x384655);}};}function respondWithFilteredResult(_0x584728,_0x54f7f2){return function(_0x204ba4){if(_0x204ba4){var _0x505224=_0x204ba4[_0x4fbc('0x2a')],_0x7aa7b8=_0x54f7f2[_0x4fbc('0x2b')],_0x366f66=_0x54f7f2[_0x4fbc('0x2b')]+_0x54f7f2[_0x4fbc('0x2c')],_0x58773e;if(_0x366f66>=_0x505224){_0x366f66=_0x505224;_0x58773e=0xc8;}else{_0x58773e=0xce;}_0x584728[_0x4fbc('0x2d')](_0x58773e);return _0x584728[_0x4fbc('0x2e')](_0x4fbc('0x2f'),_0x7aa7b8+'-'+_0x366f66+'/'+_0x505224)[_0x4fbc('0x29')](_0x204ba4);}return null;};}function patchUpdates(_0x49eb8e){return function(_0x5b6ab7){try{jsonpatch['apply'](_0x5b6ab7,_0x49eb8e,!![]);}catch(_0x21cda1){return BPromise[_0x4fbc('0x30')](_0x21cda1);}return _0x5b6ab7[_0x4fbc('0x31')]();};}function saveUpdates(_0x4f97d7,_0x232e18){return function(_0x5a49c9){if(_0x5a49c9){return _0x5a49c9[_0x4fbc('0x32')](_0x4f97d7)['then'](function(_0x1fb977){return _0x1fb977;});}return null;};}function removeEntity(_0x387b5d,_0x462b25){return function(_0x189e4c){if(_0x189e4c){return _0x189e4c[_0x4fbc('0x33')]()[_0x4fbc('0x34')](function(){_0x387b5d[_0x4fbc('0x2d')](0xcc)[_0x4fbc('0x28')]();});}};}function handleEntityNotFound(_0x30303c,_0x36f155){return function(_0x4e69b1){if(!_0x4e69b1){_0x30303c[_0x4fbc('0x27')](0x194);}return _0x4e69b1;};}function handleError(_0x3efef8,_0x401cf0){_0x401cf0=_0x401cf0||0x1f4;return function(_0x30c99e){logger[_0x4fbc('0x22')](_0x30c99e[_0x4fbc('0x35')]);if(_0x30c99e[_0x4fbc('0x36')]){delete _0x30c99e['name'];}_0x3efef8[_0x4fbc('0x2d')](_0x401cf0)[_0x4fbc('0x37')](_0x30c99e);};}exports[_0x4fbc('0x38')]=function(_0x2a955d,_0x188a1e){var _0x1ecaa6={},_0x205202={},_0x29b8ab={'count':0x0,'rows':[]};var _0x1d0169=_[_0x4fbc('0x39')](db[_0x4fbc('0x3a')][_0x4fbc('0x3b')],function(_0x3b87d9){return{'name':_0x3b87d9['fieldName'],'type':_0x3b87d9[_0x4fbc('0x3c')][_0x4fbc('0x3d')]};});_0x205202['model']=_[_0x4fbc('0x39')](_0x1d0169,'name');_0x205202[_0x4fbc('0x3e')]=_['keys'](_0x2a955d['query']);_0x205202[_0x4fbc('0x3f')]=_[_0x4fbc('0x40')](_0x205202[_0x4fbc('0x41')],_0x205202['query']);_0x1ecaa6[_0x4fbc('0x42')]=_[_0x4fbc('0x40')](_0x205202['model'],qs[_0x4fbc('0x43')](_0x2a955d[_0x4fbc('0x3e')]['fields']));_0x1ecaa6[_0x4fbc('0x42')]=_0x1ecaa6[_0x4fbc('0x42')][_0x4fbc('0x44')]?_0x1ecaa6[_0x4fbc('0x42')]:_0x205202['model'];if(!_0x2a955d['query'][_0x4fbc('0x45')](_0x4fbc('0x46'))){_0x1ecaa6[_0x4fbc('0x2c')]=qs[_0x4fbc('0x2c')](_0x2a955d[_0x4fbc('0x3e')][_0x4fbc('0x2c')]);_0x1ecaa6['offset']=qs[_0x4fbc('0x2b')](_0x2a955d['query'][_0x4fbc('0x2b')]);}_0x1ecaa6[_0x4fbc('0x47')]=qs[_0x4fbc('0x48')](_0x2a955d['query'][_0x4fbc('0x48')]);_0x1ecaa6['where']=qs[_0x4fbc('0x3f')](_[_0x4fbc('0x49')](_0x2a955d['query'],_0x205202[_0x4fbc('0x3f')]),_0x1d0169);if(_0x2a955d[_0x4fbc('0x3e')][_0x4fbc('0x4a')]){_0x1ecaa6[_0x4fbc('0x4b')]=_['merge'](_0x1ecaa6[_0x4fbc('0x4b')],{'$or':_[_0x4fbc('0x39')](_0x1d0169,function(_0x4166ae){if(_0x4166ae[_0x4fbc('0x3c')]!==_0x4fbc('0x4c')){var _0x53aa3f={};_0x53aa3f[_0x4166ae[_0x4fbc('0x36')]]={'$like':'%'+_0x2a955d[_0x4fbc('0x3e')][_0x4fbc('0x4a')]+'%'};return _0x53aa3f;}})});}_0x1ecaa6=_[_0x4fbc('0x4d')]({},_0x1ecaa6,_0x2a955d['options']);var _0x392669={'where':_0x1ecaa6[_0x4fbc('0x4b')]};return db[_0x4fbc('0x3a')][_0x4fbc('0x2a')](_0x392669)[_0x4fbc('0x34')](function(_0x97b744){_0x29b8ab[_0x4fbc('0x2a')]=_0x97b744;if(_0x2a955d[_0x4fbc('0x3e')][_0x4fbc('0x4e')]){_0x1ecaa6[_0x4fbc('0x4f')]=[{'all':!![]}];}return db[_0x4fbc('0x3a')][_0x4fbc('0x50')](_0x1ecaa6);})[_0x4fbc('0x34')](function(_0x34c438){_0x29b8ab[_0x4fbc('0x51')]=_0x34c438;return _0x29b8ab;})[_0x4fbc('0x34')](respondWithFilteredResult(_0x188a1e,_0x1ecaa6))[_0x4fbc('0x26')](handleError(_0x188a1e,null));};exports[_0x4fbc('0x52')]=function(_0x5dda7c,_0x31f923){var _0x38b092={'raw':![],'where':{'id':_0x5dda7c[_0x4fbc('0x53')]['id']}},_0x35ccc0={};_0x35ccc0['model']=_[_0x4fbc('0x54')](db['VtigerConfiguration'][_0x4fbc('0x3b')]);_0x35ccc0[_0x4fbc('0x3e')]=_[_0x4fbc('0x54')](_0x5dda7c[_0x4fbc('0x3e')]);_0x35ccc0[_0x4fbc('0x55')]=_['intersection'](_0x35ccc0['model'],_0x35ccc0[_0x4fbc('0x3e')]);_0x38b092[_0x4fbc('0x42')]=_['intersection'](_0x35ccc0['model'],qs[_0x4fbc('0x43')](_0x5dda7c[_0x4fbc('0x3e')][_0x4fbc('0x43')]));_0x38b092[_0x4fbc('0x42')]=_0x38b092[_0x4fbc('0x42')][_0x4fbc('0x44')]?_0x38b092['attributes']:_0x35ccc0[_0x4fbc('0x41')];if(_0x5dda7c[_0x4fbc('0x3e')][_0x4fbc('0x4e')]){_0x38b092['include']=[{'all':!![]}];}_0x38b092=_[_0x4fbc('0x4d')]({},_0x38b092,_0x5dda7c['options']);return db[_0x4fbc('0x3a')][_0x4fbc('0x56')](_0x38b092)[_0x4fbc('0x34')](handleEntityNotFound(_0x31f923,null))['then'](respondWithResult(_0x31f923,null))['catch'](handleError(_0x31f923,null));};exports[_0x4fbc('0x57')]=function(_0x59d0b6,_0x8df69f){return db[_0x4fbc('0x3a')][_0x4fbc('0x57')](_0x59d0b6[_0x4fbc('0x58')],{})[_0x4fbc('0x34')](respondWithResult(_0x8df69f,0xc9))[_0x4fbc('0x26')](handleError(_0x8df69f,null));};exports[_0x4fbc('0x32')]=function(_0x321d72,_0x51e57e){if(_0x321d72[_0x4fbc('0x58')]['id']){delete _0x321d72['body']['id'];}return db[_0x4fbc('0x3a')][_0x4fbc('0x56')]({'where':{'id':_0x321d72[_0x4fbc('0x53')]['id']}})[_0x4fbc('0x34')](handleEntityNotFound(_0x51e57e,null))[_0x4fbc('0x34')](saveUpdates(_0x321d72[_0x4fbc('0x58')],null))['then'](respondWithResult(_0x51e57e,null))[_0x4fbc('0x26')](handleError(_0x51e57e,null));};exports[_0x4fbc('0x33')]=function(_0x3de674,_0x19f4b5){return db[_0x4fbc('0x3a')][_0x4fbc('0x56')]({'where':{'id':_0x3de674[_0x4fbc('0x53')]['id']}})[_0x4fbc('0x34')](handleEntityNotFound(_0x19f4b5,null))[_0x4fbc('0x34')](removeEntity(_0x19f4b5,null))[_0x4fbc('0x26')](handleError(_0x19f4b5,null));};exports[_0x4fbc('0x59')]=function(_0x43980d,_0x1478c2,_0x61f3d4){var _0x5bb2f1={};var _0x5aeca5={};var _0x2b2615;var _0x54bb23;return db['VtigerConfiguration'][_0x4fbc('0x5a')]({'where':{'id':_0x43980d[_0x4fbc('0x53')]['id']}})[_0x4fbc('0x34')](handleEntityNotFound(_0x1478c2,null))[_0x4fbc('0x34')](function(_0x54f344){if(_0x54f344){_0x2b2615=_0x54f344;_0x5aeca5[_0x4fbc('0x41')]=_[_0x4fbc('0x54')](db['VtigerField'][_0x4fbc('0x3b')]);_0x5aeca5[_0x4fbc('0x3e')]=_['keys'](_0x43980d[_0x4fbc('0x3e')]);_0x5aeca5['filters']=_[_0x4fbc('0x40')](_0x5aeca5['model'],_0x5aeca5['query']);_0x5bb2f1[_0x4fbc('0x42')]=_[_0x4fbc('0x40')](_0x5aeca5[_0x4fbc('0x41')],qs['fields'](_0x43980d['query'][_0x4fbc('0x43')]));_0x5bb2f1[_0x4fbc('0x42')]=_0x5bb2f1[_0x4fbc('0x42')][_0x4fbc('0x44')]?_0x5bb2f1[_0x4fbc('0x42')]:_0x5aeca5[_0x4fbc('0x41')];_0x5bb2f1[_0x4fbc('0x47')]=qs['sort'](_0x43980d['query']['sort']);_0x5bb2f1[_0x4fbc('0x4b')]=qs['filters'](_['pick'](_0x43980d[_0x4fbc('0x3e')],_0x5aeca5[_0x4fbc('0x3f')]));if(_0x43980d[_0x4fbc('0x3e')][_0x4fbc('0x4a')]){_0x5bb2f1[_0x4fbc('0x4b')]=_[_0x4fbc('0x4d')](_0x5bb2f1[_0x4fbc('0x4b')],{'$or':_[_0x4fbc('0x39')](_0x5bb2f1[_0x4fbc('0x42')],function(_0x631737){var _0x528bd1={};_0x528bd1[_0x631737]={'$like':'%'+_0x43980d[_0x4fbc('0x3e')][_0x4fbc('0x4a')]+'%'};return _0x528bd1;})});}_0x5bb2f1=_[_0x4fbc('0x4d')]({},_0x5bb2f1,_0x43980d[_0x4fbc('0x5b')]);return _0x2b2615[_0x4fbc('0x59')](_0x5bb2f1);}})[_0x4fbc('0x34')](function(_0x7e06d5){if(_0x7e06d5){_0x54bb23=_0x7e06d5[_0x4fbc('0x44')];if(!_0x43980d[_0x4fbc('0x3e')][_0x4fbc('0x45')](_0x4fbc('0x46'))){_0x5bb2f1[_0x4fbc('0x2c')]=qs[_0x4fbc('0x2c')](_0x43980d[_0x4fbc('0x3e')][_0x4fbc('0x2c')]);_0x5bb2f1[_0x4fbc('0x2b')]=qs[_0x4fbc('0x2b')](_0x43980d['query'][_0x4fbc('0x2b')]);}return _0x2b2615[_0x4fbc('0x59')](_0x5bb2f1);}})[_0x4fbc('0x34')](function(_0x588e18){if(_0x588e18){return _0x588e18?{'count':_0x54bb23,'rows':_0x588e18}:null;}})['then'](respondWithResult(_0x1478c2,null))[_0x4fbc('0x26')](handleError(_0x1478c2,null));};exports[_0x4fbc('0x5c')]=function(_0x40c1f5,_0x807461,_0x211b4c){var _0x65314={};var _0x2ac878={};var _0x9e9a7;var _0xb4ad8;return db[_0x4fbc('0x3a')][_0x4fbc('0x5a')]({'where':{'id':_0x40c1f5['params']['id']}})[_0x4fbc('0x34')](handleEntityNotFound(_0x807461,null))[_0x4fbc('0x34')](function(_0x255e67){if(_0x255e67){_0x9e9a7=_0x255e67;_0x2ac878['model']=_[_0x4fbc('0x54')](db[_0x4fbc('0x5d')][_0x4fbc('0x3b')]);_0x2ac878[_0x4fbc('0x3e')]=_[_0x4fbc('0x54')](_0x40c1f5[_0x4fbc('0x3e')]);_0x2ac878['filters']=_['intersection'](_0x2ac878[_0x4fbc('0x41')],_0x2ac878['query']);_0x65314[_0x4fbc('0x42')]=_['intersection'](_0x2ac878[_0x4fbc('0x41')],qs[_0x4fbc('0x43')](_0x40c1f5[_0x4fbc('0x3e')][_0x4fbc('0x43')]));_0x65314[_0x4fbc('0x42')]=_0x65314[_0x4fbc('0x42')][_0x4fbc('0x44')]?_0x65314['attributes']:_0x2ac878[_0x4fbc('0x41')];_0x65314[_0x4fbc('0x47')]=qs[_0x4fbc('0x48')](_0x40c1f5['query'][_0x4fbc('0x48')]);_0x65314[_0x4fbc('0x4b')]=qs[_0x4fbc('0x3f')](_[_0x4fbc('0x49')](_0x40c1f5['query'],_0x2ac878[_0x4fbc('0x3f')]));if(_0x40c1f5[_0x4fbc('0x3e')][_0x4fbc('0x4a')]){_0x65314[_0x4fbc('0x4b')]=_[_0x4fbc('0x4d')](_0x65314['where'],{'$or':_['map'](_0x65314[_0x4fbc('0x42')],function(_0x39e7af){var _0x22d1eb={};_0x22d1eb[_0x39e7af]={'$like':'%'+_0x40c1f5['query'][_0x4fbc('0x4a')]+'%'};return _0x22d1eb;})});}_0x65314=_[_0x4fbc('0x4d')]({},_0x65314,_0x40c1f5['options']);return _0x9e9a7[_0x4fbc('0x5c')](_0x65314);}})[_0x4fbc('0x34')](function(_0x218d02){if(_0x218d02){_0xb4ad8=_0x218d02[_0x4fbc('0x44')];if(!_0x40c1f5[_0x4fbc('0x3e')][_0x4fbc('0x45')](_0x4fbc('0x46'))){_0x65314['limit']=qs['limit'](_0x40c1f5[_0x4fbc('0x3e')][_0x4fbc('0x2c')]);_0x65314[_0x4fbc('0x2b')]=qs[_0x4fbc('0x2b')](_0x40c1f5[_0x4fbc('0x3e')]['offset']);}return _0x9e9a7[_0x4fbc('0x5c')](_0x65314);}})[_0x4fbc('0x34')](function(_0xc4eb33){if(_0xc4eb33){return _0xc4eb33?{'count':_0xb4ad8,'rows':_0xc4eb33}:null;}})[_0x4fbc('0x34')](respondWithResult(_0x807461,null))[_0x4fbc('0x26')](handleError(_0x807461,null));};exports[_0x4fbc('0x5e')]=function(_0x437fd2,_0x3b2317,_0x2d63c9){var _0x15c684={};var _0x5867b4={};var _0x330862;var _0x7d420e;return db[_0x4fbc('0x3a')][_0x4fbc('0x5a')]({'where':{'id':_0x437fd2['params']['id']}})[_0x4fbc('0x34')](handleEntityNotFound(_0x3b2317,null))[_0x4fbc('0x34')](function(_0x3c5817){if(_0x3c5817){_0x330862=_0x3c5817;_0x5867b4['model']=_['keys'](db[_0x4fbc('0x5d')][_0x4fbc('0x3b')]);_0x5867b4[_0x4fbc('0x3e')]=_[_0x4fbc('0x54')](_0x437fd2['query']);_0x5867b4[_0x4fbc('0x3f')]=_['intersection'](_0x5867b4['model'],_0x5867b4['query']);_0x15c684[_0x4fbc('0x42')]=_[_0x4fbc('0x40')](_0x5867b4['model'],qs[_0x4fbc('0x43')](_0x437fd2[_0x4fbc('0x3e')][_0x4fbc('0x43')]));_0x15c684[_0x4fbc('0x42')]=_0x15c684[_0x4fbc('0x42')][_0x4fbc('0x44')]?_0x15c684[_0x4fbc('0x42')]:_0x5867b4[_0x4fbc('0x41')];_0x15c684[_0x4fbc('0x47')]=qs['sort'](_0x437fd2[_0x4fbc('0x3e')]['sort']);_0x15c684[_0x4fbc('0x4b')]=qs[_0x4fbc('0x3f')](_[_0x4fbc('0x49')](_0x437fd2[_0x4fbc('0x3e')],_0x5867b4['filters']));if(_0x437fd2[_0x4fbc('0x3e')][_0x4fbc('0x4a')]){_0x15c684[_0x4fbc('0x4b')]=_[_0x4fbc('0x4d')](_0x15c684[_0x4fbc('0x4b')],{'$or':_[_0x4fbc('0x39')](_0x15c684[_0x4fbc('0x42')],function(_0x23eb65){var _0x25d1de={};_0x25d1de[_0x23eb65]={'$like':'%'+_0x437fd2[_0x4fbc('0x3e')][_0x4fbc('0x4a')]+'%'};return _0x25d1de;})});}_0x15c684=_[_0x4fbc('0x4d')]({},_0x15c684,_0x437fd2['options']);return _0x330862['getDescriptions'](_0x15c684);}})[_0x4fbc('0x34')](function(_0x5cfa5e){if(_0x5cfa5e){_0x7d420e=_0x5cfa5e[_0x4fbc('0x44')];if(!_0x437fd2[_0x4fbc('0x3e')][_0x4fbc('0x45')]('nolimit')){_0x15c684['limit']=qs[_0x4fbc('0x2c')](_0x437fd2[_0x4fbc('0x3e')][_0x4fbc('0x2c')]);_0x15c684[_0x4fbc('0x2b')]=qs[_0x4fbc('0x2b')](_0x437fd2[_0x4fbc('0x3e')]['offset']);}return _0x330862[_0x4fbc('0x5e')](_0x15c684);}})['then'](function(_0x8f3675){if(_0x8f3675){return _0x8f3675?{'count':_0x7d420e,'rows':_0x8f3675}:null;}})[_0x4fbc('0x34')](respondWithResult(_0x3b2317,null))[_0x4fbc('0x26')](handleError(_0x3b2317,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 475e9cf..9e81bd9 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 _0x1853=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','lodash'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1853,0x1c7));var _0x3185=function(_0x4781b1,_0x109c44){_0x4781b1=_0x4781b1-0x0;var _0x13ecb1=_0x1853[_0x4781b1];return _0x13ecb1;};'use strict';var _=require(_0x3185('0x0'));var util=require(_0x3185('0x1'));var logger=require('../../config/logger')(_0x3185('0x2'));var moment=require(_0x3185('0x3'));var BPromise=require(_0x3185('0x4'));var rp=require(_0x3185('0x5'));var fs=require('fs');var path=require(_0x3185('0x6'));var rimraf=require(_0x3185('0x7'));var config=require(_0x3185('0x8'));var attributes=require(_0x3185('0x9'));module[_0x3185('0xa')]=function(_0x203b89,_0x56efe8){return _0x203b89[_0x3185('0xb')]('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf47a=['lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define','int_vtiger_configurations'];(function(_0x4e6518,_0x106499){var _0x1d48c1=function(_0x2eedb9){while(--_0x2eedb9){_0x4e6518['push'](_0x4e6518['shift']());}};_0x1d48c1(++_0x106499);}(_0xf47a,0x1ea));var _0xaf47=function(_0x389bd4,_0x4cb258){_0x389bd4=_0x389bd4-0x0;var _0x56b0cf=_0xf47a[_0x389bd4];return _0x56b0cf;};'use strict';var _=require(_0xaf47('0x0'));var util=require(_0xaf47('0x1'));var logger=require(_0xaf47('0x2'))('api');var moment=require('moment');var BPromise=require(_0xaf47('0x3'));var rp=require(_0xaf47('0x4'));var fs=require('fs');var path=require(_0xaf47('0x5'));var rimraf=require('rimraf');var config=require(_0xaf47('0x6'));var attributes=require('./intVtigerConfiguration.attributes');module[_0xaf47('0x7')]=function(_0x85cc84,_0x4de9d2){return _0x85cc84[_0xaf47('0x8')]('VtigerConfiguration',attributes,{'tableName':_0xaf47('0x9'),'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 4358c37..6bf0df5 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 _0xa680=['jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','VtigerConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xaf365b,_0x3b1ee2){var _0x608a9d=function(_0x2f0ab7){while(--_0x2f0ab7){_0xaf365b['push'](_0xaf365b['shift']());}};_0x608a9d(++_0x3b1ee2);}(_0xa680,0x16d));var _0x0a68=function(_0x16f947,_0x1622c7){_0x16f947=_0x16f947-0x0;var _0x5d22fb=_0xa680[_0x16f947];return _0x5d22fb;};'use strict';var _=require(_0x0a68('0x0'));var util=require(_0x0a68('0x1'));var moment=require(_0x0a68('0x2'));var BPromise=require('bluebird');var rs=require(_0x0a68('0x3'));var fs=require('fs');var Redis=require(_0x0a68('0x4'));var db=require(_0x0a68('0x5'))['db'];var utils=require(_0x0a68('0x6'));var logger=require(_0x0a68('0x7'))(_0x0a68('0x8'));var config=require(_0x0a68('0x9'));var jayson=require(_0x0a68('0xa'));var client=jayson[_0x0a68('0xb')][_0x0a68('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b64c,_0x579960,_0x167451){return new BPromise(function(_0x504527,_0xed0229){return client[_0x0a68('0xd')](_0x42b64c,_0x167451)[_0x0a68('0xe')](function(_0x3951b1){logger[_0x0a68('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x579960,_0x0a68('0x10'));logger[_0x0a68('0x11')](_0x0a68('0x12'),_0x579960,_0x0a68('0x10'),JSON['stringify'](_0x3951b1));if(_0x3951b1[_0x0a68('0x13')]){if(_0x3951b1['error'][_0x0a68('0x14')]===0x1f4){logger[_0x0a68('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x579960,_0x3951b1[_0x0a68('0x13')]['message']);return _0xed0229(_0x3951b1[_0x0a68('0x13')]['message']);}logger[_0x0a68('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x579960,_0x3951b1[_0x0a68('0x13')][_0x0a68('0x15')]);return _0x504527(_0x3951b1['error'][_0x0a68('0x15')]);}else{logger[_0x0a68('0xf')](_0x0a68('0x16'),_0x579960,_0x0a68('0x10'));_0x504527(_0x3951b1[_0x0a68('0x17')]['message']);}})[_0x0a68('0x18')](function(_0x469b22){logger['error'](_0x0a68('0x16'),_0x579960,_0x469b22);_0xed0229(_0x469b22);});});} \ No newline at end of file +var _0xbfab=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xbfab,0xd7));var _0xbbfa=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0xbfab[_0x1bb58c];return _0x277586;};'use strict';var _=require(_0xbbfa('0x0'));var util=require(_0xbbfa('0x1'));var moment=require(_0xbbfa('0x2'));var BPromise=require(_0xbbfa('0x3'));var rs=require(_0xbbfa('0x4'));var fs=require('fs');var Redis=require(_0xbbfa('0x5'));var db=require(_0xbbfa('0x6'))['db'];var utils=require(_0xbbfa('0x7'));var logger=require(_0xbbfa('0x8'))(_0xbbfa('0x9'));var config=require(_0xbbfa('0xa'));var jayson=require(_0xbbfa('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1af011,_0x3e922f,_0x3b1082){return new BPromise(function(_0x185b90,_0x35d422){return client['request'](_0x1af011,_0x3b1082)[_0xbbfa('0xc')](function(_0x4eade5){logger['info'](_0xbbfa('0xd'),_0x3e922f,_0xbbfa('0xe'));logger[_0xbbfa('0xf')](_0xbbfa('0x10'),_0x3e922f,_0xbbfa('0xe'),JSON[_0xbbfa('0x11')](_0x4eade5));if(_0x4eade5[_0xbbfa('0x12')]){if(_0x4eade5[_0xbbfa('0x12')]['code']===0x1f4){logger[_0xbbfa('0x12')](_0xbbfa('0xd'),_0x3e922f,_0x4eade5[_0xbbfa('0x12')]['message']);return _0x35d422(_0x4eade5['error'][_0xbbfa('0x13')]);}logger[_0xbbfa('0x12')](_0xbbfa('0xd'),_0x3e922f,_0x4eade5[_0xbbfa('0x12')][_0xbbfa('0x13')]);return _0x185b90(_0x4eade5['error'][_0xbbfa('0x13')]);}else{logger[_0xbbfa('0x14')](_0xbbfa('0xd'),_0x3e922f,_0xbbfa('0xe'));_0x185b90(_0x4eade5[_0xbbfa('0x15')][_0xbbfa('0x13')]);}})['catch'](function(_0x39173f){logger[_0xbbfa('0x12')](_0xbbfa('0xd'),_0x3e922f,_0x39173f);_0x35d422(_0x39173f);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 15b6e81..20904a1 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 _0xdfd5=['post','create','put','update','/:id','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show'];(function(_0x581081,_0x5ead3d){var _0x45ae38=function(_0x1cefd2){while(--_0x1cefd2){_0x581081['push'](_0x581081['shift']());}};_0x45ae38(++_0x5ead3d);}(_0xdfd5,0xa0));var _0x5dfd=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xdfd5[_0x1969a7];return _0x3d665f;};'use strict';var multer=require('multer');var util=require(_0x5dfd('0x0'));var path=require(_0x5dfd('0x1'));var timeout=require(_0x5dfd('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x5dfd('0x3'));var interaction=require(_0x5dfd('0x4'));var config=require(_0x5dfd('0x5'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x5dfd('0x6')](),controller[_0x5dfd('0x7')]);router[_0x5dfd('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x5dfd('0x9')]);router[_0x5dfd('0xa')]('/',auth[_0x5dfd('0x6')](),controller[_0x5dfd('0xb')]);router[_0x5dfd('0xc')]('/:id',auth[_0x5dfd('0x6')](),controller[_0x5dfd('0xd')]);router['delete'](_0x5dfd('0xe'),auth[_0x5dfd('0x6')](),controller[_0x5dfd('0xf')]);module[_0x5dfd('0x10')]=router; \ No newline at end of file +var _0x4122=['create','put','update','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','show','post'];(function(_0x45e434,_0x3f56be){var _0x70bfa8=function(_0xf85517){while(--_0xf85517){_0x45e434['push'](_0x45e434['shift']());}};_0x70bfa8(++_0x3f56be);}(_0x4122,0x185));var _0x2412=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4122[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x2412('0x0'));var util=require('util');var path=require(_0x2412('0x1'));var timeout=require(_0x2412('0x2'));var express=require('express');var router=express[_0x2412('0x3')]();var auth=require(_0x2412('0x4'));var interaction=require(_0x2412('0x5'));var config=require(_0x2412('0x6'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x2412('0x7')](),controller['index']);router['get'](_0x2412('0x8'),auth[_0x2412('0x7')](),controller[_0x2412('0x9')]);router[_0x2412('0xa')]('/',auth[_0x2412('0x7')](),controller[_0x2412('0xb')]);router[_0x2412('0xc')](_0x2412('0x8'),auth[_0x2412('0x7')](),controller[_0x2412('0xd')]);router[_0x2412('0xe')](_0x2412('0x8'),auth[_0x2412('0x7')](),controller['destroy']);module[_0x2412('0xf')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 4190537..5b17e52 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 _0xbbb8=['variable','keyValue','STRING','ENUM','customVariable','sequelize','exports','string'];(function(_0x18801d,_0x4add82){var _0x30e46a=function(_0x2da81e){while(--_0x2da81e){_0x18801d['push'](_0x18801d['shift']());}};_0x30e46a(++_0x4add82);}(_0xbbb8,0x7d));var _0x8bbb=function(_0x708c5f,_0x34c1e9){_0x708c5f=_0x708c5f-0x0;var _0xcea80f=_0xbbb8[_0x708c5f];return _0xcea80f;};'use strict';var Sequelize=require(_0x8bbb('0x0'));module[_0x8bbb('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8bbb('0x2'),_0x8bbb('0x3'),'customVariable',_0x8bbb('0x4')),'defaultValue':_0x8bbb('0x2')},'content':{'type':Sequelize[_0x8bbb('0x5')]},'key':{'type':Sequelize[_0x8bbb('0x5')]},'keyType':{'type':Sequelize[_0x8bbb('0x6')](_0x8bbb('0x2'),_0x8bbb('0x3'),_0x8bbb('0x7'))},'keyContent':{'type':Sequelize[_0x8bbb('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8bbb('0x5')]}}; \ No newline at end of file +var _0x1c55=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x92a987,_0x4415b6){var _0x331f4c=function(_0x223e9d){while(--_0x223e9d){_0x92a987['push'](_0x92a987['shift']());}};_0x331f4c(++_0x4415b6);}(_0x1c55,0x1e3));var _0x51c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c55[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x51c5('0x0'));module[_0x51c5('0x1')]={'type':{'type':Sequelize[_0x51c5('0x2')](_0x51c5('0x3'),_0x51c5('0x4'),_0x51c5('0x5'),_0x51c5('0x6')),'defaultValue':_0x51c5('0x3')},'content':{'type':Sequelize[_0x51c5('0x7')]},'key':{'type':Sequelize[_0x51c5('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x51c5('0x3'),_0x51c5('0x4'),_0x51c5('0x5'))},'keyContent':{'type':Sequelize[_0x51c5('0x7')]},'idField':{'type':Sequelize[_0x51c5('0x7')]},'nameField':{'type':Sequelize[_0x51c5('0x7')]},'customField':{'type':Sequelize[_0x51c5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x51c5('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index db28223..cb1b128 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 _0x9c5a=['params','keys','filtears','find','create','body','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','map','VtigerField','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch'];(function(_0x4d4c4c,_0x5b5d19){var _0x3c90e5=function(_0x28db59){while(--_0x28db59){_0x4d4c4c['push'](_0x4d4c4c['shift']());}};_0x3c90e5(++_0x5b5d19);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x4088c8,_0x1e67c4){_0x4088c8=_0x4088c8-0x0;var _0x373a4e=_0x9c5a[_0x4088c8];return _0x373a4e;};'use strict';var pdf=require(_0xa9c5('0x0'));var emlformat=require(_0xa9c5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa9c5('0x2'));var jsonpatch=require(_0xa9c5('0x3'));var rp=require(_0xa9c5('0x4'));var moment=require(_0xa9c5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa9c5('0x6'));var util=require(_0xa9c5('0x7'));var path=require('path');var sox=require(_0xa9c5('0x8'));var csv=require('to-csv');var ejs=require(_0xa9c5('0x9'));var fs=require('fs');var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=_0x19a43e[_0xa9c5('0x1b')],_0x4bb57e=_0x40b001['offset'],_0x2b0d73=_0x40b001[_0xa9c5('0x1c')]+_0x40b001[_0xa9c5('0x1d')],_0xd85c32;if(_0x2b0d73>=_0xcf13f2){_0x2b0d73=_0xcf13f2;_0xd85c32=0xc8;}else{_0xd85c32=0xce;}_0x251099[_0xa9c5('0x19')](_0xd85c32);return _0x251099[_0xa9c5('0x1e')](_0xa9c5('0x1f'),_0x4bb57e+'-'+_0x2b0d73+'/'+_0xcf13f2)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x3b8d4d){return function(_0x1e5ce6){try{jsonpatch[_0xa9c5('0x20')](_0x1e5ce6,_0x3b8d4d,!![]);}catch(_0x36c486){return BPromise[_0xa9c5('0x21')](_0x36c486);}return _0x1e5ce6[_0xa9c5('0x22')]();};}function saveUpdates(_0x54f8b9,_0x1115ad){return function(_0x21ab50){if(_0x21ab50){return _0x21ab50['update'](_0x54f8b9)['then'](function(_0xce9af6){return _0xce9af6;});}return null;};}function removeEntity(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')]()[_0xa9c5('0x24')](function(){_0x366f5c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d4e1b,_0x11d395){return function(_0x4b0f05){if(!_0x4b0f05){_0x3d4e1b[_0xa9c5('0x17')](0x194);}return _0x4b0f05;};}function handleError(_0x424b4c,_0x306c9b){_0x306c9b=_0x306c9b||0x1f4;return function(_0x32fc7d){logger[_0xa9c5('0x25')](_0x32fc7d[_0xa9c5('0x26')]);if(_0x32fc7d[_0xa9c5('0x27')]){delete _0x32fc7d['name'];}_0x424b4c['status'](_0x306c9b)[_0xa9c5('0x28')](_0x32fc7d);};}exports['index']=function(_0x1762ac,_0x830bad){var _0x4caefa={},_0x11a723={},_0x320dc0={'count':0x0,'rows':[]};var _0x5f468b=_[_0xa9c5('0x29')](db[_0xa9c5('0x2a')][_0xa9c5('0x2b')],function(_0x185eb8){return{'name':_0x185eb8[_0xa9c5('0x2c')],'type':_0x185eb8['type'][_0xa9c5('0x2d')]};});_0x11a723['model']=_[_0xa9c5('0x29')](_0x5f468b,_0xa9c5('0x27'));_0x11a723[_0xa9c5('0x2e')]=_['keys'](_0x1762ac[_0xa9c5('0x2e')]);_0x11a723[_0xa9c5('0x2f')]=_['intersection'](_0x11a723[_0xa9c5('0x30')],_0x11a723[_0xa9c5('0x2e')]);_0x4caefa[_0xa9c5('0x31')]=_[_0xa9c5('0x32')](_0x11a723[_0xa9c5('0x30')],qs[_0xa9c5('0x33')](_0x1762ac[_0xa9c5('0x2e')]['fields']));_0x4caefa[_0xa9c5('0x31')]=_0x4caefa[_0xa9c5('0x31')][_0xa9c5('0x34')]?_0x4caefa[_0xa9c5('0x31')]:_0x11a723[_0xa9c5('0x30')];if(!_0x1762ac[_0xa9c5('0x2e')][_0xa9c5('0x35')](_0xa9c5('0x36'))){_0x4caefa['limit']=qs['limit'](_0x1762ac[_0xa9c5('0x2e')][_0xa9c5('0x1d')]);_0x4caefa[_0xa9c5('0x1c')]=qs[_0xa9c5('0x1c')](_0x1762ac[_0xa9c5('0x2e')][_0xa9c5('0x1c')]);}_0x4caefa['order']=qs['sort'](_0x1762ac['query'][_0xa9c5('0x37')]);_0x4caefa[_0xa9c5('0x38')]=qs['filters'](_[_0xa9c5('0x39')](_0x1762ac['query'],_0x11a723[_0xa9c5('0x2f')]),_0x5f468b);if(_0x1762ac[_0xa9c5('0x2e')][_0xa9c5('0x3a')]){_0x4caefa[_0xa9c5('0x38')]=_['merge'](_0x4caefa[_0xa9c5('0x38')],{'$or':_[_0xa9c5('0x29')](_0x5f468b,function(_0x191153){if(_0x191153[_0xa9c5('0x3b')]!==_0xa9c5('0x3c')){var _0x17ef8e={};_0x17ef8e[_0x191153[_0xa9c5('0x27')]]={'$like':'%'+_0x1762ac[_0xa9c5('0x2e')]['filter']+'%'};return _0x17ef8e;}})});}_0x4caefa=_[_0xa9c5('0x3d')]({},_0x4caefa,_0x1762ac[_0xa9c5('0x3e')]);var _0x841c18={'where':_0x4caefa[_0xa9c5('0x38')]};return db[_0xa9c5('0x2a')][_0xa9c5('0x1b')](_0x841c18)['then'](function(_0x307736){_0x320dc0['count']=_0x307736;if(_0x1762ac[_0xa9c5('0x2e')]['includeAll']){_0x4caefa[_0xa9c5('0x3f')]=[{'all':!![]}];}return db[_0xa9c5('0x2a')][_0xa9c5('0x40')](_0x4caefa);})['then'](function(_0x12e19c){_0x320dc0[_0xa9c5('0x41')]=_0x12e19c;return _0x320dc0;})[_0xa9c5('0x24')](respondWithFilteredResult(_0x830bad,_0x4caefa))[_0xa9c5('0x42')](handleError(_0x830bad,null));};exports['show']=function(_0x2dbb48,_0x97803f){var _0x3db918={'raw':!![],'where':{'id':_0x2dbb48[_0xa9c5('0x43')]['id']}},_0x45668e={};_0x45668e['model']=_[_0xa9c5('0x44')](db['VtigerField'][_0xa9c5('0x2b')]);_0x45668e[_0xa9c5('0x2e')]=_[_0xa9c5('0x44')](_0x2dbb48[_0xa9c5('0x2e')]);_0x45668e[_0xa9c5('0x45')]=_[_0xa9c5('0x32')](_0x45668e[_0xa9c5('0x30')],_0x45668e[_0xa9c5('0x2e')]);_0x3db918[_0xa9c5('0x31')]=_[_0xa9c5('0x32')](_0x45668e['model'],qs[_0xa9c5('0x33')](_0x2dbb48[_0xa9c5('0x2e')][_0xa9c5('0x33')]));_0x3db918[_0xa9c5('0x31')]=_0x3db918[_0xa9c5('0x31')][_0xa9c5('0x34')]?_0x3db918['attributes']:_0x45668e[_0xa9c5('0x30')];if(_0x2dbb48[_0xa9c5('0x2e')]['includeAll']){_0x3db918['include']=[{'all':!![]}];}_0x3db918=_['merge']({},_0x3db918,_0x2dbb48['options']);return db['VtigerField'][_0xa9c5('0x46')](_0x3db918)[_0xa9c5('0x24')](handleEntityNotFound(_0x97803f,null))[_0xa9c5('0x24')](respondWithResult(_0x97803f,null))[_0xa9c5('0x42')](handleError(_0x97803f,null));};exports[_0xa9c5('0x47')]=function(_0x240c40,_0xec9c4){return db[_0xa9c5('0x2a')][_0xa9c5('0x47')](_0x240c40[_0xa9c5('0x48')],{})[_0xa9c5('0x24')](respondWithResult(_0xec9c4,0xc9))[_0xa9c5('0x42')](handleError(_0xec9c4,null));};exports[_0xa9c5('0x49')]=function(_0x4bf8b4,_0x1108f0){if(_0x4bf8b4['body']['id']){delete _0x4bf8b4[_0xa9c5('0x48')]['id'];}return db[_0xa9c5('0x2a')]['find']({'where':{'id':_0x4bf8b4['params']['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x1108f0,null))[_0xa9c5('0x24')](saveUpdates(_0x4bf8b4[_0xa9c5('0x48')],null))['then'](respondWithResult(_0x1108f0,null))['catch'](handleError(_0x1108f0,null));};exports[_0xa9c5('0x23')]=function(_0xd03cec,_0x481f9c){return db[_0xa9c5('0x2a')][_0xa9c5('0x46')]({'where':{'id':_0xd03cec[_0xa9c5('0x43')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x481f9c,null))[_0xa9c5('0x24')](removeEntity(_0x481f9c,null))[_0xa9c5('0x42')](handleError(_0x481f9c,null));}; \ No newline at end of file +var _0xf2ca=['util','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','merge','type','filter','options','VtigerField','count','includeAll','include','rows','catch','show','params','filtears','length','create','body','find','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x2152f3,_0x502ac8){var _0x3c8499=function(_0x154b5d){while(--_0x154b5d){_0x2152f3['push'](_0x2152f3['shift']());}};_0x3c8499(++_0x502ac8);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x4dda69,_0x2a0fe4){_0x4dda69=_0x4dda69-0x0;var _0x9014a9=_0xf2ca[_0x4dda69];return _0x9014a9;};'use strict';var pdf=require(_0xaf2c('0x0'));var emlformat=require(_0xaf2c('0x1'));var rimraf=require(_0xaf2c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf2c('0x3'));var rp=require(_0xaf2c('0x4'));var moment=require(_0xaf2c('0x5'));var BPromise=require(_0xaf2c('0x6'));var Mustache=require(_0xaf2c('0x7'));var util=require(_0xaf2c('0x8'));var path=require('path');var sox=require(_0xaf2c('0x9'));var csv=require(_0xaf2c('0xa'));var ejs=require(_0xaf2c('0xb'));var fs=require('fs');var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0xa'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=_0x6ac8e['count'],_0x26bf7b=_0x1d0633[_0xaf2c('0x1c')],_0x3432e4=_0x1d0633['offset']+_0x1d0633[_0xaf2c('0x1d')],_0x705d09;if(_0x3432e4>=_0x2b4d13){_0x3432e4=_0x2b4d13;_0x705d09=0xc8;}else{_0x705d09=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x705d09);return _0x2119c8[_0xaf2c('0x1e')]('Content-Range',_0x26bf7b+'-'+_0x3432e4+'/'+_0x2b4d13)[_0xaf2c('0x1b')](_0x6ac8e);}return null;};}function patchUpdates(_0x297bcd){return function(_0x1fec4c){try{jsonpatch[_0xaf2c('0x1f')](_0x1fec4c,_0x297bcd,!![]);}catch(_0x3f977c){return BPromise[_0xaf2c('0x20')](_0x3f977c);}return _0x1fec4c['save']();};}function saveUpdates(_0x35e712,_0x164bcb){return function(_0x8ffe13){if(_0x8ffe13){return _0x8ffe13[_0xaf2c('0x21')](_0x35e712)[_0xaf2c('0x22')](function(_0x486de2){return _0x486de2;});}return null;};}function removeEntity(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['destroy']()['then'](function(){_0x396646[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x1cafad,_0x99f78d){return function(_0x591aff){if(!_0x591aff){_0x1cafad[_0xaf2c('0x18')](0x194);}return _0x591aff;};}function handleError(_0xf1a7cf,_0x3a0145){_0x3a0145=_0x3a0145||0x1f4;return function(_0x3c1ae6){logger[_0xaf2c('0x23')](_0x3c1ae6[_0xaf2c('0x24')]);if(_0x3c1ae6[_0xaf2c('0x25')]){delete _0x3c1ae6['name'];}_0xf1a7cf[_0xaf2c('0x19')](_0x3a0145)[_0xaf2c('0x26')](_0x3c1ae6);};}exports[_0xaf2c('0x27')]=function(_0x410536,_0x4b7cf2){var _0x3fb190={},_0x589d47={},_0x38db1b={'count':0x0,'rows':[]};var _0x42f980=_[_0xaf2c('0x28')](db['VtigerField'][_0xaf2c('0x29')],function(_0x2ea490){return{'name':_0x2ea490[_0xaf2c('0x2a')],'type':_0x2ea490['type'][_0xaf2c('0x2b')]};});_0x589d47[_0xaf2c('0x2c')]=_[_0xaf2c('0x28')](_0x42f980,_0xaf2c('0x25'));_0x589d47['query']=_[_0xaf2c('0x2d')](_0x410536[_0xaf2c('0x2e')]);_0x589d47[_0xaf2c('0x2f')]=_['intersection'](_0x589d47['model'],_0x589d47[_0xaf2c('0x2e')]);_0x3fb190['attributes']=_[_0xaf2c('0x30')](_0x589d47['model'],qs[_0xaf2c('0x31')](_0x410536[_0xaf2c('0x2e')]['fields']));_0x3fb190[_0xaf2c('0x32')]=_0x3fb190[_0xaf2c('0x32')]['length']?_0x3fb190[_0xaf2c('0x32')]:_0x589d47[_0xaf2c('0x2c')];if(!_0x410536[_0xaf2c('0x2e')][_0xaf2c('0x33')](_0xaf2c('0x34'))){_0x3fb190[_0xaf2c('0x1d')]=qs['limit'](_0x410536[_0xaf2c('0x2e')]['limit']);_0x3fb190[_0xaf2c('0x1c')]=qs['offset'](_0x410536[_0xaf2c('0x2e')]['offset']);}_0x3fb190[_0xaf2c('0x35')]=qs['sort'](_0x410536[_0xaf2c('0x2e')]['sort']);_0x3fb190[_0xaf2c('0x36')]=qs[_0xaf2c('0x2f')](_[_0xaf2c('0x37')](_0x410536[_0xaf2c('0x2e')],_0x589d47[_0xaf2c('0x2f')]),_0x42f980);if(_0x410536['query']['filter']){_0x3fb190[_0xaf2c('0x36')]=_[_0xaf2c('0x38')](_0x3fb190[_0xaf2c('0x36')],{'$or':_[_0xaf2c('0x28')](_0x42f980,function(_0x4eeecf){if(_0x4eeecf[_0xaf2c('0x39')]!=='VIRTUAL'){var _0xa1248e={};_0xa1248e[_0x4eeecf[_0xaf2c('0x25')]]={'$like':'%'+_0x410536['query'][_0xaf2c('0x3a')]+'%'};return _0xa1248e;}})});}_0x3fb190=_[_0xaf2c('0x38')]({},_0x3fb190,_0x410536[_0xaf2c('0x3b')]);var _0x71c597={'where':_0x3fb190[_0xaf2c('0x36')]};return db[_0xaf2c('0x3c')][_0xaf2c('0x3d')](_0x71c597)[_0xaf2c('0x22')](function(_0x296ca8){_0x38db1b[_0xaf2c('0x3d')]=_0x296ca8;if(_0x410536[_0xaf2c('0x2e')][_0xaf2c('0x3e')]){_0x3fb190[_0xaf2c('0x3f')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x3fb190);})['then'](function(_0x189809){_0x38db1b[_0xaf2c('0x40')]=_0x189809;return _0x38db1b;})[_0xaf2c('0x22')](respondWithFilteredResult(_0x4b7cf2,_0x3fb190))[_0xaf2c('0x41')](handleError(_0x4b7cf2,null));};exports[_0xaf2c('0x42')]=function(_0x29460c,_0x51c441){var _0x1d58bd={'raw':!![],'where':{'id':_0x29460c[_0xaf2c('0x43')]['id']}},_0x78632a={};_0x78632a['model']=_['keys'](db[_0xaf2c('0x3c')]['rawAttributes']);_0x78632a[_0xaf2c('0x2e')]=_[_0xaf2c('0x2d')](_0x29460c[_0xaf2c('0x2e')]);_0x78632a[_0xaf2c('0x44')]=_['intersection'](_0x78632a[_0xaf2c('0x2c')],_0x78632a['query']);_0x1d58bd[_0xaf2c('0x32')]=_[_0xaf2c('0x30')](_0x78632a['model'],qs[_0xaf2c('0x31')](_0x29460c['query'][_0xaf2c('0x31')]));_0x1d58bd[_0xaf2c('0x32')]=_0x1d58bd[_0xaf2c('0x32')][_0xaf2c('0x45')]?_0x1d58bd[_0xaf2c('0x32')]:_0x78632a[_0xaf2c('0x2c')];if(_0x29460c[_0xaf2c('0x2e')][_0xaf2c('0x3e')]){_0x1d58bd[_0xaf2c('0x3f')]=[{'all':!![]}];}_0x1d58bd=_['merge']({},_0x1d58bd,_0x29460c['options']);return db[_0xaf2c('0x3c')]['find'](_0x1d58bd)['then'](handleEntityNotFound(_0x51c441,null))['then'](respondWithResult(_0x51c441,null))[_0xaf2c('0x41')](handleError(_0x51c441,null));};exports[_0xaf2c('0x46')]=function(_0x3cabd4,_0x35315e){return db['VtigerField'][_0xaf2c('0x46')](_0x3cabd4['body'],{})[_0xaf2c('0x22')](respondWithResult(_0x35315e,0xc9))['catch'](handleError(_0x35315e,null));};exports[_0xaf2c('0x21')]=function(_0x133e8c,_0x2d01b7){if(_0x133e8c[_0xaf2c('0x47')]['id']){delete _0x133e8c[_0xaf2c('0x47')]['id'];}return db['VtigerField'][_0xaf2c('0x48')]({'where':{'id':_0x133e8c[_0xaf2c('0x43')]['id']}})['then'](handleEntityNotFound(_0x2d01b7,null))['then'](saveUpdates(_0x133e8c[_0xaf2c('0x47')],null))['then'](respondWithResult(_0x2d01b7,null))[_0xaf2c('0x41')](handleError(_0x2d01b7,null));};exports[_0xaf2c('0x49')]=function(_0x17b9ec,_0x315b9f){return db[_0xaf2c('0x3c')][_0xaf2c('0x48')]({'where':{'id':_0x17b9ec[_0xaf2c('0x43')]['id']}})[_0xaf2c('0x22')](handleEntityNotFound(_0x315b9f,null))[_0xaf2c('0x22')](removeEntity(_0x315b9f,null))[_0xaf2c('0x41')](handleError(_0x315b9f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 6c90582..c46a1d0 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 _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 5e075d6..4dbbed8 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 _0x5ba3=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','VtigerField,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x5ba3,0x140));var _0x35ba=function(_0x33c368,_0x23a62f){_0x33c368=_0x33c368-0x0;var _0x427b4a=_0x5ba3[_0x33c368];return _0x427b4a;};'use strict';var _=require(_0x35ba('0x0'));var util=require('util');var moment=require(_0x35ba('0x1'));var BPromise=require(_0x35ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ba('0x3'));var db=require(_0x35ba('0x4'))['db'];var utils=require(_0x35ba('0x5'));var logger=require('../../config/logger')(_0x35ba('0x6'));var config=require(_0x35ba('0x7'));var jayson=require(_0x35ba('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20cd5f,_0x3264d3,_0x380ffb){return new BPromise(function(_0x4c55f3,_0x22bed8){return client['request'](_0x20cd5f,_0x380ffb)[_0x35ba('0x9')](function(_0x366ddc){logger[_0x35ba('0xa')](_0x35ba('0xb'),_0x3264d3,'request\x20sent');logger[_0x35ba('0xc')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x3264d3,'request\x20sent',JSON['stringify'](_0x366ddc));if(_0x366ddc[_0x35ba('0xd')]){if(_0x366ddc[_0x35ba('0xd')][_0x35ba('0xe')]===0x1f4){logger[_0x35ba('0xd')](_0x35ba('0xb'),_0x3264d3,_0x366ddc[_0x35ba('0xd')][_0x35ba('0xf')]);return _0x22bed8(_0x366ddc[_0x35ba('0xd')]['message']);}logger[_0x35ba('0xd')](_0x35ba('0xb'),_0x3264d3,_0x366ddc[_0x35ba('0xd')][_0x35ba('0xf')]);return _0x4c55f3(_0x366ddc['error'][_0x35ba('0xf')]);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x3264d3,_0x35ba('0x10'));_0x4c55f3(_0x366ddc[_0x35ba('0x11')]['message']);}})[_0x35ba('0x12')](function(_0x2b6b71){logger[_0x35ba('0xd')](_0x35ba('0xb'),_0x3264d3,_0x2b6b71);_0x22bed8(_0x2b6b71);});});} \ No newline at end of file +var _0xa908=['http','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','VtigerField,\x20%s,\x20%s','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xa908,0x1c3));var _0x8a90=function(_0x31c3ec,_0x41a015){_0x31c3ec=_0x31c3ec-0x0;var _0x319164=_0xa908[_0x31c3ec];return _0x319164;};'use strict';var _=require(_0x8a90('0x0'));var util=require('util');var moment=require(_0x8a90('0x1'));var BPromise=require('bluebird');var rs=require(_0x8a90('0x2'));var fs=require('fs');var Redis=require(_0x8a90('0x3'));var db=require(_0x8a90('0x4'))['db'];var utils=require(_0x8a90('0x5'));var logger=require(_0x8a90('0x6'))('rpc');var config=require(_0x8a90('0x7'));var jayson=require(_0x8a90('0x8'));var client=jayson['client'][_0x8a90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dc8f9,_0x12d376,_0x3faf88){return new BPromise(function(_0x20f8bf,_0x200f95){return client['request'](_0x1dc8f9,_0x3faf88)[_0x8a90('0xa')](function(_0x485401){logger[_0x8a90('0xb')]('VtigerField,\x20%s,\x20%s',_0x12d376,_0x8a90('0xc'));logger[_0x8a90('0xd')](_0x8a90('0xe'),_0x12d376,_0x8a90('0xc'),JSON[_0x8a90('0xf')](_0x485401));if(_0x485401[_0x8a90('0x10')]){if(_0x485401[_0x8a90('0x10')]['code']===0x1f4){logger['error'](_0x8a90('0x11'),_0x12d376,_0x485401[_0x8a90('0x10')][_0x8a90('0x12')]);return _0x200f95(_0x485401['error'][_0x8a90('0x12')]);}logger[_0x8a90('0x10')](_0x8a90('0x11'),_0x12d376,_0x485401['error'][_0x8a90('0x12')]);return _0x20f8bf(_0x485401[_0x8a90('0x10')]['message']);}else{logger[_0x8a90('0xb')](_0x8a90('0x11'),_0x12d376,_0x8a90('0xc'));_0x20f8bf(_0x485401[_0x8a90('0x13')]['message']);}})['catch'](function(_0x14db82){logger[_0x8a90('0x10')](_0x8a90('0x11'),_0x12d376,_0x14db82);_0x200f95(_0x14db82);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index c5f0653..97ce03a 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 _0xd149=['path','express','../../components/auth/service','./intZendeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util'];(function(_0x185d2a,_0x308609){var _0x4dea27=function(_0x513443){while(--_0x513443){_0x185d2a['push'](_0x185d2a['shift']());}};_0x4dea27(++_0x308609);}(_0xd149,0xf0));var _0x9d14=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xd149[_0x29d915];return _0x160f86;};'use strict';var multer=require(_0x9d14('0x0'));var util=require(_0x9d14('0x1'));var path=require(_0x9d14('0x2'));var timeout=require('connect-timeout');var express=require(_0x9d14('0x3'));var router=express['Router']();var auth=require(_0x9d14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9d14('0x5'));router['get']('/',auth[_0x9d14('0x6')](),controller[_0x9d14('0x7')]);router[_0x9d14('0x8')](_0x9d14('0x9'),auth['isAuthenticated'](),controller[_0x9d14('0xa')]);router[_0x9d14('0x8')](_0x9d14('0xb'),auth[_0x9d14('0x6')](),controller[_0x9d14('0xc')]);router['get'](_0x9d14('0xd'),auth[_0x9d14('0x6')](),controller[_0x9d14('0xe')]);router[_0x9d14('0xf')]('/',auth[_0x9d14('0x6')](),controller[_0x9d14('0x10')]);router[_0x9d14('0xf')](_0x9d14('0xb'),auth[_0x9d14('0x6')](),controller[_0x9d14('0x11')]);router[_0x9d14('0x12')](_0x9d14('0x9'),auth[_0x9d14('0x6')](),controller[_0x9d14('0x13')]);router['delete'](_0x9d14('0x9'),auth[_0x9d14('0x6')](),controller[_0x9d14('0x14')]);module[_0x9d14('0x15')]=router; \ No newline at end of file +var _0xe7d0=['./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0x4c9cb7,_0x599eab){var _0x11fc34=function(_0x2f3f7f){while(--_0x2f3f7f){_0x4c9cb7['push'](_0x4c9cb7['shift']());}};_0x11fc34(++_0x599eab);}(_0xe7d0,0x1b2));var _0x0e7d=function(_0x19b7c0,_0x1ed54c){_0x19b7c0=_0x19b7c0-0x0;var _0x5e80c0=_0xe7d0[_0x19b7c0];return _0x5e80c0;};'use strict';var multer=require('multer');var util=require(_0x0e7d('0x0'));var path=require(_0x0e7d('0x1'));var timeout=require(_0x0e7d('0x2'));var express=require(_0x0e7d('0x3'));var router=express[_0x0e7d('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0e7d('0x5'));var controller=require(_0x0e7d('0x6'));router[_0x0e7d('0x7')]('/',auth[_0x0e7d('0x8')](),controller[_0x0e7d('0x9')]);router[_0x0e7d('0x7')](_0x0e7d('0xa'),auth['isAuthenticated'](),controller[_0x0e7d('0xb')]);router['get'](_0x0e7d('0xc'),auth[_0x0e7d('0x8')](),controller[_0x0e7d('0xd')]);router[_0x0e7d('0x7')](_0x0e7d('0xe'),auth[_0x0e7d('0x8')](),controller[_0x0e7d('0xf')]);router[_0x0e7d('0x10')]('/',auth[_0x0e7d('0x8')](),controller[_0x0e7d('0x11')]);router[_0x0e7d('0x10')](_0x0e7d('0xc'),auth[_0x0e7d('0x8')](),controller['addConfiguration']);router[_0x0e7d('0x12')](_0x0e7d('0xa'),auth[_0x0e7d('0x8')](),controller[_0x0e7d('0x13')]);router[_0x0e7d('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x0e7d('0x15')]);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 881cdbb..202ba14 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 _0x4574=['STRING','remoteUri','password','ENUM','integrationTab'];(function(_0x5be7aa,_0x5de661){var _0x215408=function(_0x353715){while(--_0x353715){_0x5be7aa['push'](_0x5be7aa['shift']());}};_0x215408(++_0x5de661);}(_0x4574,0xeb));var _0x4457=function(_0x212019,_0x16dd57){_0x212019=_0x212019-0x0;var _0x42a232=_0x4574[_0x212019];return _0x42a232;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4457('0x0')]},'description':{'type':Sequelize[_0x4457('0x0')]},'username':{'type':Sequelize[_0x4457('0x0')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4457('0x0')],'unique':_0x4457('0x1')},'authType':{'type':Sequelize['ENUM'](_0x4457('0x2'),'token'),'defaultValue':_0x4457('0x2')},'serverUrl':{'type':Sequelize[_0x4457('0x0')]},'type':{'type':Sequelize[_0x4457('0x3')](_0x4457('0x4'),'newTab'),'defaultValue':_0x4457('0x4')}}; \ No newline at end of file +var _0x1044=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username','token','password'];(function(_0x2e4fc4,_0x4cfcfa){var _0x413dcd=function(_0x200cdc){while(--_0x200cdc){_0x2e4fc4['push'](_0x2e4fc4['shift']());}};_0x413dcd(++_0x4cfcfa);}(_0x1044,0x111));var _0x4104=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x1044[_0x3305de];return _0x3b5a84;};'use strict';var Sequelize=require(_0x4104('0x0'));module[_0x4104('0x1')]={'name':{'type':Sequelize[_0x4104('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x4104('0x3')},'password':{'type':Sequelize[_0x4104('0x2')]},'token':{'type':Sequelize[_0x4104('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM']('password',_0x4104('0x4')),'defaultValue':_0x4104('0x5')},'serverUrl':{'type':Sequelize[_0x4104('0x2')]},'type':{'type':Sequelize[_0x4104('0x6')](_0x4104('0x7'),_0x4104('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 1b1adc2..42181b8 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 _0x6d19=['findOne','ZendeskConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','headers','%s:%s','toString','base64','Basic\x20%s','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','subject','group','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','end','json','offset','limit','set','reject','save','update','destroy','sendStatus','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','count','include','findAll','params','filtears','includeAll','options','find','create','body','getConfigurations'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x6d19,0x1a5));var _0x96d1=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x6d19[_0x1b6186];return _0x186121;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x96d1('0x0'));var rimraf=require(_0x96d1('0x1'));var zipdir=require(_0x96d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x96d1('0x3'));var moment=require(_0x96d1('0x4'));var BPromise=require(_0x96d1('0x5'));var Mustache=require('mustache');var util=require(_0x96d1('0x6'));var path=require(_0x96d1('0x7'));var sox=require('sox');var csv=require(_0x96d1('0x8'));var ejs=require(_0x96d1('0x9'));var fs=require('fs');var _=require(_0x96d1('0xa'));var squel=require(_0x96d1('0xb'));var crypto=require(_0x96d1('0xc'));var jsforce=require(_0x96d1('0xd'));var deskjs=require(_0x96d1('0xe'));var toCsv=require(_0x96d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x96d1('0xf'));var as=require(_0x96d1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x96d1('0x11'))(_0x96d1('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x96d1('0x13'));var db=require(_0x96d1('0x14'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x96d1('0x15'));var client=jayson[_0x96d1('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29f875,_0x51e0a7,_0x5cb83d,_0x2c310d){return new BPromise(function(_0x1fc55a,_0x470e5f){var _0x1ef52d=_0x2c310d||client;return _0x1ef52d[_0x96d1('0x17')](_0x29f875,_0x5cb83d)[_0x96d1('0x18')](function(_0x5694a7){logger[_0x96d1('0x19')](_0x96d1('0x1a'),_0x51e0a7,'request\x20sent');logger[_0x96d1('0x1b')](_0x96d1('0x1c'),_0x51e0a7,'request\x20sent',JSON[_0x96d1('0x1d')](_0x5694a7));if(_0x5694a7[_0x96d1('0x1e')]){if(_0x5694a7['error'][_0x96d1('0x1f')]===0x1f4){logger[_0x96d1('0x1e')](_0x96d1('0x1a'),_0x51e0a7,_0x5694a7[_0x96d1('0x1e')][_0x96d1('0x20')]);return _0x470e5f(_0x5694a7[_0x96d1('0x1e')][_0x96d1('0x20')]);}logger[_0x96d1('0x1e')]('ZendeskAccount,\x20%s,\x20%s',_0x51e0a7,_0x5694a7[_0x96d1('0x1e')]['message']);return _0x1fc55a(_0x5694a7[_0x96d1('0x1e')][_0x96d1('0x20')]);}else{logger[_0x96d1('0x19')](_0x96d1('0x1a'),_0x51e0a7,_0x96d1('0x21'));_0x1fc55a(_0x5694a7[_0x96d1('0x22')][_0x96d1('0x20')]);}})[_0x96d1('0x23')](function(_0x2ac9d4){logger[_0x96d1('0x1e')](_0x96d1('0x1a'),_0x51e0a7,_0x2ac9d4);_0x470e5f(_0x2ac9d4);});});}function respondWithStatusCode(_0x2aac66,_0x114b69){_0x114b69=_0x114b69||0xcc;return function(_0x23230c){if(_0x23230c){return _0x2aac66['sendStatus'](_0x114b69);}return _0x2aac66[_0x96d1('0x24')](_0x114b69)[_0x96d1('0x25')]();};}function respondWithResult(_0x2dd846,_0x55e053){_0x55e053=_0x55e053||0xc8;return function(_0x2a17cb){if(_0x2a17cb){return _0x2dd846[_0x96d1('0x24')](_0x55e053)[_0x96d1('0x26')](_0x2a17cb);}};}function respondWithFilteredResult(_0x19a568,_0x25ff3d){return function(_0x3c7448){if(_0x3c7448){var _0x4ad251=_0x3c7448['count'],_0x595983=_0x25ff3d['offset'],_0x37ee66=_0x25ff3d[_0x96d1('0x27')]+_0x25ff3d[_0x96d1('0x28')],_0x4127a5;if(_0x37ee66>=_0x4ad251){_0x37ee66=_0x4ad251;_0x4127a5=0xc8;}else{_0x4127a5=0xce;}_0x19a568[_0x96d1('0x24')](_0x4127a5);return _0x19a568[_0x96d1('0x29')]('Content-Range',_0x595983+'-'+_0x37ee66+'/'+_0x4ad251)[_0x96d1('0x26')](_0x3c7448);}return null;};}function patchUpdates(_0x3039e3){return function(_0x261c64){try{jsonpatch['apply'](_0x261c64,_0x3039e3,!![]);}catch(_0xfcbad4){return BPromise[_0x96d1('0x2a')](_0xfcbad4);}return _0x261c64[_0x96d1('0x2b')]();};}function saveUpdates(_0x3352e5,_0x51f724){return function(_0x1bfe43){if(_0x1bfe43){return _0x1bfe43[_0x96d1('0x2c')](_0x3352e5)['then'](function(_0x1e5937){return _0x1e5937;});}return null;};}function removeEntity(_0x5ba424,_0x548fc2){return function(_0x5caae0){if(_0x5caae0){return _0x5caae0[_0x96d1('0x2d')]()[_0x96d1('0x18')](function(){_0x5ba424[_0x96d1('0x24')](0xcc)[_0x96d1('0x25')]();});}};}function handleEntityNotFound(_0x273656,_0x4d73c0){return function(_0x45a8dc){if(!_0x45a8dc){_0x273656[_0x96d1('0x2e')](0x194);}return _0x45a8dc;};}function handleError(_0x95ac9e,_0x15024b){_0x15024b=_0x15024b||0x1f4;return function(_0x13588d){logger[_0x96d1('0x1e')](_0x13588d[_0x96d1('0x2f')]);if(_0x13588d[_0x96d1('0x30')]){delete _0x13588d[_0x96d1('0x30')];}_0x95ac9e[_0x96d1('0x24')](_0x15024b)[_0x96d1('0x31')](_0x13588d);};}exports[_0x96d1('0x32')]=function(_0x3f5883,_0x50bba7){var _0x3edbd1={},_0x32fe69={},_0x49ef02={'count':0x0,'rows':[]};var _0x5059ae=_['map'](db[_0x96d1('0x33')][_0x96d1('0x34')],function(_0x34ae25){return{'name':_0x34ae25[_0x96d1('0x35')],'type':_0x34ae25[_0x96d1('0x36')]['key']};});_0x32fe69[_0x96d1('0x37')]=_[_0x96d1('0x38')](_0x5059ae,_0x96d1('0x30'));_0x32fe69[_0x96d1('0x39')]=_[_0x96d1('0x3a')](_0x3f5883[_0x96d1('0x39')]);_0x32fe69[_0x96d1('0x3b')]=_[_0x96d1('0x3c')](_0x32fe69[_0x96d1('0x37')],_0x32fe69[_0x96d1('0x39')]);_0x3edbd1[_0x96d1('0x3d')]=_['intersection'](_0x32fe69[_0x96d1('0x37')],qs['fields'](_0x3f5883[_0x96d1('0x39')][_0x96d1('0x3e')]));_0x3edbd1['attributes']=_0x3edbd1[_0x96d1('0x3d')][_0x96d1('0x3f')]?_0x3edbd1[_0x96d1('0x3d')]:_0x32fe69[_0x96d1('0x37')];if(!_0x3f5883[_0x96d1('0x39')]['hasOwnProperty'](_0x96d1('0x40'))){_0x3edbd1['limit']=qs[_0x96d1('0x28')](_0x3f5883['query'][_0x96d1('0x28')]);_0x3edbd1[_0x96d1('0x27')]=qs[_0x96d1('0x27')](_0x3f5883[_0x96d1('0x39')]['offset']);}_0x3edbd1[_0x96d1('0x41')]=qs[_0x96d1('0x42')](_0x3f5883[_0x96d1('0x39')]['sort']);_0x3edbd1[_0x96d1('0x43')]=qs[_0x96d1('0x3b')](_[_0x96d1('0x44')](_0x3f5883[_0x96d1('0x39')],_0x32fe69['filters']),_0x5059ae);if(_0x3f5883[_0x96d1('0x39')]['filter']){_0x3edbd1['where']=_[_0x96d1('0x45')](_0x3edbd1['where'],{'$or':_[_0x96d1('0x38')](_0x5059ae,function(_0x3bd16d){if(_0x3bd16d[_0x96d1('0x36')]!==_0x96d1('0x46')){var _0x1641f8={};_0x1641f8[_0x3bd16d['name']]={'$like':'%'+_0x3f5883[_0x96d1('0x39')][_0x96d1('0x47')]+'%'};return _0x1641f8;}})});}_0x3edbd1=_[_0x96d1('0x45')]({},_0x3edbd1,_0x3f5883['options']);var _0x2fea3a={'where':_0x3edbd1['where']};return db['ZendeskAccount'][_0x96d1('0x48')](_0x2fea3a)[_0x96d1('0x18')](function(_0x33b20c){_0x49ef02['count']=_0x33b20c;if(_0x3f5883[_0x96d1('0x39')]['includeAll']){_0x3edbd1[_0x96d1('0x49')]=[{'all':!![]}];}return db[_0x96d1('0x33')][_0x96d1('0x4a')](_0x3edbd1);})[_0x96d1('0x18')](function(_0x361a06){_0x49ef02['rows']=_0x361a06;return _0x49ef02;})[_0x96d1('0x18')](respondWithFilteredResult(_0x50bba7,_0x3edbd1))[_0x96d1('0x23')](handleError(_0x50bba7,null));};exports['show']=function(_0x2f3987,_0x246887){var _0x5244b2={'raw':![],'where':{'id':_0x2f3987[_0x96d1('0x4b')]['id']}},_0x51597a={};_0x51597a[_0x96d1('0x37')]=_[_0x96d1('0x3a')](db[_0x96d1('0x33')][_0x96d1('0x34')]);_0x51597a[_0x96d1('0x39')]=_[_0x96d1('0x3a')](_0x2f3987[_0x96d1('0x39')]);_0x51597a[_0x96d1('0x4c')]=_[_0x96d1('0x3c')](_0x51597a[_0x96d1('0x37')],_0x51597a[_0x96d1('0x39')]);_0x5244b2[_0x96d1('0x3d')]=_[_0x96d1('0x3c')](_0x51597a['model'],qs[_0x96d1('0x3e')](_0x2f3987[_0x96d1('0x39')][_0x96d1('0x3e')]));_0x5244b2[_0x96d1('0x3d')]=_0x5244b2[_0x96d1('0x3d')][_0x96d1('0x3f')]?_0x5244b2[_0x96d1('0x3d')]:_0x51597a[_0x96d1('0x37')];if(_0x2f3987[_0x96d1('0x39')][_0x96d1('0x4d')]){_0x5244b2[_0x96d1('0x49')]=[{'all':!![]}];}_0x5244b2=_[_0x96d1('0x45')]({},_0x5244b2,_0x2f3987[_0x96d1('0x4e')]);return db['ZendeskAccount'][_0x96d1('0x4f')](_0x5244b2)[_0x96d1('0x18')](handleEntityNotFound(_0x246887,null))[_0x96d1('0x18')](respondWithResult(_0x246887,null))[_0x96d1('0x23')](handleError(_0x246887,null));};exports[_0x96d1('0x50')]=function(_0x9b1aa1,_0x41f2e6){return db[_0x96d1('0x33')][_0x96d1('0x50')](_0x9b1aa1[_0x96d1('0x51')],{})['then'](respondWithResult(_0x41f2e6,0xc9))[_0x96d1('0x23')](handleError(_0x41f2e6,null));};exports[_0x96d1('0x2c')]=function(_0x3a5b6f,_0x414509){if(_0x3a5b6f['body']['id']){delete _0x3a5b6f[_0x96d1('0x51')]['id'];}return db[_0x96d1('0x33')]['find']({'where':{'id':_0x3a5b6f['params']['id']}})[_0x96d1('0x18')](handleEntityNotFound(_0x414509,null))[_0x96d1('0x18')](saveUpdates(_0x3a5b6f['body'],null))[_0x96d1('0x18')](respondWithResult(_0x414509,null))['catch'](handleError(_0x414509,null));};exports[_0x96d1('0x2d')]=function(_0x3192f5,_0x3c8769){return db['ZendeskAccount'][_0x96d1('0x4f')]({'where':{'id':_0x3192f5['params']['id']}})[_0x96d1('0x18')](handleEntityNotFound(_0x3c8769,null))[_0x96d1('0x18')](removeEntity(_0x3c8769,null))[_0x96d1('0x23')](handleError(_0x3c8769,null));};exports[_0x96d1('0x52')]=function(_0x267cfc,_0x3c098f,_0x186329){var _0xee122b={};var _0x325024={};var _0x1e0875;var _0x45cf48;return db[_0x96d1('0x33')][_0x96d1('0x53')]({'where':{'id':_0x267cfc['params']['id']}})['then'](handleEntityNotFound(_0x3c098f,null))[_0x96d1('0x18')](function(_0x2523c1){if(_0x2523c1){_0x1e0875=_0x2523c1;_0x325024[_0x96d1('0x37')]=_[_0x96d1('0x3a')](db[_0x96d1('0x54')][_0x96d1('0x34')]);_0x325024['query']=_[_0x96d1('0x3a')](_0x267cfc[_0x96d1('0x39')]);_0x325024[_0x96d1('0x3b')]=_[_0x96d1('0x3c')](_0x325024[_0x96d1('0x37')],_0x325024[_0x96d1('0x39')]);_0xee122b[_0x96d1('0x3d')]=_[_0x96d1('0x3c')](_0x325024['model'],qs[_0x96d1('0x3e')](_0x267cfc[_0x96d1('0x39')]['fields']));_0xee122b[_0x96d1('0x3d')]=_0xee122b[_0x96d1('0x3d')]['length']?_0xee122b['attributes']:_0x325024['model'];_0xee122b[_0x96d1('0x41')]=qs['sort'](_0x267cfc[_0x96d1('0x39')][_0x96d1('0x42')]);_0xee122b[_0x96d1('0x43')]=qs['filters'](_['pick'](_0x267cfc['query'],_0x325024[_0x96d1('0x3b')]));if(_0x267cfc[_0x96d1('0x39')]['filter']){_0xee122b[_0x96d1('0x43')]=_[_0x96d1('0x45')](_0xee122b[_0x96d1('0x43')],{'$or':_[_0x96d1('0x38')](_0xee122b[_0x96d1('0x3d')],function(_0x2c7589){var _0x28ac66={};_0x28ac66[_0x2c7589]={'$like':'%'+_0x267cfc['query'][_0x96d1('0x47')]+'%'};return _0x28ac66;})});}_0xee122b=_[_0x96d1('0x45')]({},_0xee122b,_0x267cfc['options']);return _0x1e0875[_0x96d1('0x52')](_0xee122b);}})[_0x96d1('0x18')](function(_0x36f639){if(_0x36f639){_0x45cf48=_0x36f639[_0x96d1('0x3f')];if(!_0x267cfc['query'][_0x96d1('0x55')](_0x96d1('0x40'))){_0xee122b[_0x96d1('0x28')]=qs[_0x96d1('0x28')](_0x267cfc[_0x96d1('0x39')][_0x96d1('0x28')]);_0xee122b[_0x96d1('0x27')]=qs[_0x96d1('0x27')](_0x267cfc[_0x96d1('0x39')][_0x96d1('0x27')]);}return _0x1e0875[_0x96d1('0x52')](_0xee122b);}})['then'](function(_0x522c95){if(_0x522c95){return _0x522c95?{'count':_0x45cf48,'rows':_0x522c95}:null;}})[_0x96d1('0x18')](respondWithResult(_0x3c098f,null))[_0x96d1('0x23')](handleError(_0x3c098f,null));};exports[_0x96d1('0x56')]=function(_0x2e3cd8,_0x12f627,_0x41a273){if(_0x2e3cd8[_0x96d1('0x51')]['id']){delete _0x2e3cd8[_0x96d1('0x51')]['id'];}return db[_0x96d1('0x33')][_0x96d1('0x53')]({'where':{'id':_0x2e3cd8[_0x96d1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x12f627,null))['then'](function(_0x170973){if(_0x170973){_0x2e3cd8[_0x96d1('0x51')][_0x96d1('0x57')]=_0x170973['id'];_0x2e3cd8[_0x96d1('0x51')][_0x96d1('0x58')]=integrations['getSubjects'](_0x2e3cd8['body']['channel'],_0x2e3cd8[_0x96d1('0x51')]['type']);_0x2e3cd8[_0x96d1('0x51')][_0x96d1('0x59')]=integrations[_0x96d1('0x5a')](_0x2e3cd8['body'][_0x96d1('0x5b')],_0x2e3cd8[_0x96d1('0x51')][_0x96d1('0x36')]);return db['ZendeskConfiguration'][_0x96d1('0x50')](_0x2e3cd8[_0x96d1('0x51')],{'include':[{'model':db['ZendeskField'],'as':_0x96d1('0x58')},{'model':db[_0x96d1('0x5c')],'as':_0x96d1('0x59')}]});}return null;})[_0x96d1('0x18')](respondWithResult(_0x12f627,null))[_0x96d1('0x23')](handleError(_0x12f627,null));};exports[_0x96d1('0x5d')]=function(_0x5b5493,_0x49fd41,_0x33a4cb){var _0x47db88='';return db['ZendeskAccount'][_0x96d1('0x53')]({'where':{'id':_0x5b5493['params']['id']},'attributes':['id',_0x96d1('0x5e'),_0x96d1('0x5f'),_0x96d1('0x60'),_0x96d1('0x61'),_0x96d1('0x62')]})[_0x96d1('0x18')](handleEntityNotFound(_0x49fd41,null))[_0x96d1('0x18')](function(_0x3feff5){if(_0x3feff5){_0x47db88=_0x3feff5['remoteUri'];var _0x36a8c4=_0x47db88[_0x96d1('0x63')](-0x1);if(_0x36a8c4==='/'){_0x47db88=_0x47db88[_0x96d1('0x64')](0x0,_0x47db88[_0x96d1('0x65')](_0x36a8c4));}var _0x5c1071={'method':_0x96d1('0x66'),'uri':util[_0x96d1('0x67')](_0x96d1('0x68'),_0x47db88,'ticket_fields'),'json':!![]};switch(_0x3feff5[_0x96d1('0x61')]){case _0x96d1('0x5f'):_0x5c1071[_0x96d1('0x69')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x96d1('0x67')](_0x96d1('0x6a'),_0x3feff5[_0x96d1('0x5e')],_0x3feff5[_0x96d1('0x5f')]))[_0x96d1('0x6b')](_0x96d1('0x6c')))};break;case _0x96d1('0x60'):_0x5c1071[_0x96d1('0x69')]={'Authorization':util['format'](_0x96d1('0x6d'),new Buffer(util[_0x96d1('0x67')](_0x96d1('0x6e'),_0x3feff5[_0x96d1('0x5e')],_0x3feff5[_0x96d1('0x60')]))['toString'](_0x96d1('0x6c')))};break;default:throw new db[(_0x96d1('0x6f'))]['ValidationError'](_0x96d1('0x70'));}return rp(_0x5c1071);}})[_0x96d1('0x18')](function(_0x56d600){if(_0x56d600){var _0x51030c=[_0x96d1('0x71'),'description',_0x96d1('0x72'),'assignee'];_[_0x96d1('0x73')](_0x56d600[_0x96d1('0x74')],function(_0x206e71){return _0x51030c[_0x96d1('0x75')](_0x206e71['type']);});return{'count':_0x56d600[_0x96d1('0x74')]['length'],'rows':_[_0x96d1('0x38')](_0x56d600[_0x96d1('0x74')],function(_0x31b558){return{'id':_0x31b558['id'],'name':_0x31b558[_0x96d1('0x76')]>0x7?_0x31b558[_0x96d1('0x77')]:_0x31b558[_0x96d1('0x36')],'custom':_0x31b558[_0x96d1('0x76')]>0x7?!![]:![],'options':_0x31b558['system_field_options']?_0x31b558[_0x96d1('0x78')]:_0x31b558[_0x96d1('0x79')]?_0x31b558[_0x96d1('0x79')]:[]};})};}})[_0x96d1('0x18')](respondWithResult(_0x49fd41,null))[_0x96d1('0x23')](function(_0x332e3f){var _0x155817=_0x5b5493[_0x96d1('0x39')][_0x96d1('0x7a')]?0x1f4:_0x332e3f[_0x96d1('0x7b')]||0x1f4;logger[_0x96d1('0x1e')](_0x96d1('0x7c'),_0x96d1('0x5d'),_0x155817,JSON['stringify'](_0x332e3f));delete _0x332e3f[_0x96d1('0x30')];if(_0x155817===0x191){_0x155817=0x190;}_0x49fd41[_0x96d1('0x24')](_0x155817)[_0x96d1('0x31')](_0x5b5493['query'][_0x96d1('0x7a')]?{'message':_0x96d1('0x7d'),'statusCode':_0x332e3f[_0x96d1('0x7b')]}:_0x332e3f);});}; \ No newline at end of file +var _0xdda2=['attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','filter','options','includeAll','include','rows','show','params','keys','filtears','find','create','body','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','ZendeskField','Descriptions','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','ticket_fields','base64','headers','Basic\x20%s','%s/token:%s','toString','Sequelize','ValidationError','subject','assignee','remove','position','title','system_field_options','custom_field_options','test','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','request','then','request\x20sent','code','error','ZendeskAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','name','send','index','map','ZendeskAccount','rawAttributes','type','key','query','filters','intersection','model'];(function(_0x5187c0,_0x410e5b){var _0x2251a6=function(_0x97d573){while(--_0x97d573){_0x5187c0['push'](_0x5187c0['shift']());}};_0x2251a6(++_0x410e5b);}(_0xdda2,0x1ab));var _0x2dda=function(_0x5797be,_0x4abaab){_0x5797be=_0x5797be-0x0;var _0x38f9e0=_0xdda2[_0x5797be];return _0x38f9e0;};'use strict';var pdf=require(_0x2dda('0x0'));var emlformat=require(_0x2dda('0x1'));var rimraf=require(_0x2dda('0x2'));var zipdir=require(_0x2dda('0x3'));var jsonpatch=require(_0x2dda('0x4'));var rp=require(_0x2dda('0x5'));var moment=require(_0x2dda('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x2dda('0x7'));var util=require(_0x2dda('0x8'));var path=require(_0x2dda('0x9'));var sox=require(_0x2dda('0xa'));var csv=require(_0x2dda('0xb'));var ejs=require(_0x2dda('0xc'));var fs=require('fs');var _=require(_0x2dda('0xd'));var squel=require(_0x2dda('0xe'));var crypto=require(_0x2dda('0xf'));var jsforce=require(_0x2dda('0x10'));var deskjs=require(_0x2dda('0x11'));var toCsv=require(_0x2dda('0xb'));var querystring=require(_0x2dda('0x12'));var Papa=require('papaparse');var Redis=require(_0x2dda('0x13'));var authService=require(_0x2dda('0x14'));var qs=require(_0x2dda('0x15'));var as=require(_0x2dda('0x16'));var hardwareService=require(_0x2dda('0x17'));var logger=require(_0x2dda('0x18'))('api');var utils=require(_0x2dda('0x19'));var config=require(_0x2dda('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x2dda('0x1b'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2bd0cf,_0x3080ef,_0x47348e,_0x2054b6){return new BPromise(function(_0x402753,_0x2e0a52){var _0x229e6f=_0x2054b6||client;return _0x229e6f[_0x2dda('0x1c')](_0x2bd0cf,_0x47348e)[_0x2dda('0x1d')](function(_0x28d97e){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x3080ef,_0x2dda('0x1e'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x3080ef,_0x2dda('0x1e'),JSON['stringify'](_0x28d97e));if(_0x28d97e['error']){if(_0x28d97e['error'][_0x2dda('0x1f')]===0x1f4){logger[_0x2dda('0x20')](_0x2dda('0x21'),_0x3080ef,_0x28d97e[_0x2dda('0x20')][_0x2dda('0x22')]);return _0x2e0a52(_0x28d97e[_0x2dda('0x20')][_0x2dda('0x22')]);}logger[_0x2dda('0x20')](_0x2dda('0x21'),_0x3080ef,_0x28d97e[_0x2dda('0x20')][_0x2dda('0x22')]);return _0x402753(_0x28d97e[_0x2dda('0x20')][_0x2dda('0x22')]);}else{logger[_0x2dda('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x3080ef,_0x2dda('0x1e'));_0x402753(_0x28d97e[_0x2dda('0x24')][_0x2dda('0x22')]);}})[_0x2dda('0x25')](function(_0x31e64b){logger[_0x2dda('0x20')](_0x2dda('0x21'),_0x3080ef,_0x31e64b);_0x2e0a52(_0x31e64b);});});}function respondWithStatusCode(_0x53755a,_0x3ef0ae){_0x3ef0ae=_0x3ef0ae||0xcc;return function(_0x16c903){if(_0x16c903){return _0x53755a[_0x2dda('0x26')](_0x3ef0ae);}return _0x53755a['status'](_0x3ef0ae)['end']();};}function respondWithResult(_0x42ae89,_0x422af7){_0x422af7=_0x422af7||0xc8;return function(_0x49cbd5){if(_0x49cbd5){return _0x42ae89[_0x2dda('0x27')](_0x422af7)[_0x2dda('0x28')](_0x49cbd5);}};}function respondWithFilteredResult(_0xb2db7,_0x14c877){return function(_0xea6945){if(_0xea6945){var _0x1a68f6=_0xea6945[_0x2dda('0x29')],_0x2c7ef5=_0x14c877[_0x2dda('0x2a')],_0x87f46b=_0x14c877['offset']+_0x14c877['limit'],_0x4da267;if(_0x87f46b>=_0x1a68f6){_0x87f46b=_0x1a68f6;_0x4da267=0xc8;}else{_0x4da267=0xce;}_0xb2db7[_0x2dda('0x27')](_0x4da267);return _0xb2db7[_0x2dda('0x2b')](_0x2dda('0x2c'),_0x2c7ef5+'-'+_0x87f46b+'/'+_0x1a68f6)[_0x2dda('0x28')](_0xea6945);}return null;};}function patchUpdates(_0x25eca6){return function(_0x3711f0){try{jsonpatch[_0x2dda('0x2d')](_0x3711f0,_0x25eca6,!![]);}catch(_0x54a0d8){return BPromise[_0x2dda('0x2e')](_0x54a0d8);}return _0x3711f0['save']();};}function saveUpdates(_0x365a8a,_0x5e39e1){return function(_0x3dd1d7){if(_0x3dd1d7){return _0x3dd1d7[_0x2dda('0x2f')](_0x365a8a)[_0x2dda('0x1d')](function(_0x4e15b5){return _0x4e15b5;});}return null;};}function removeEntity(_0x1f9e1e,_0x53a2bc){return function(_0x5835c8){if(_0x5835c8){return _0x5835c8[_0x2dda('0x30')]()[_0x2dda('0x1d')](function(){_0x1f9e1e[_0x2dda('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46be3a,_0xfd34c0){return function(_0x12086f){if(!_0x12086f){_0x46be3a[_0x2dda('0x26')](0x194);}return _0x12086f;};}function handleError(_0xc03b71,_0x2fb1a4){_0x2fb1a4=_0x2fb1a4||0x1f4;return function(_0x3eeb5b){logger[_0x2dda('0x20')](_0x3eeb5b['stack']);if(_0x3eeb5b[_0x2dda('0x31')]){delete _0x3eeb5b[_0x2dda('0x31')];}_0xc03b71['status'](_0x2fb1a4)[_0x2dda('0x32')](_0x3eeb5b);};}exports[_0x2dda('0x33')]=function(_0x41055c,_0x48bcdc){var _0x333d03={},_0x5ebbc8={},_0x4f7376={'count':0x0,'rows':[]};var _0x485a1d=_[_0x2dda('0x34')](db[_0x2dda('0x35')][_0x2dda('0x36')],function(_0xe36712){return{'name':_0xe36712['fieldName'],'type':_0xe36712[_0x2dda('0x37')][_0x2dda('0x38')]};});_0x5ebbc8['model']=_[_0x2dda('0x34')](_0x485a1d,'name');_0x5ebbc8[_0x2dda('0x39')]=_['keys'](_0x41055c[_0x2dda('0x39')]);_0x5ebbc8[_0x2dda('0x3a')]=_[_0x2dda('0x3b')](_0x5ebbc8[_0x2dda('0x3c')],_0x5ebbc8[_0x2dda('0x39')]);_0x333d03[_0x2dda('0x3d')]=_[_0x2dda('0x3b')](_0x5ebbc8[_0x2dda('0x3c')],qs['fields'](_0x41055c[_0x2dda('0x39')][_0x2dda('0x3e')]));_0x333d03[_0x2dda('0x3d')]=_0x333d03[_0x2dda('0x3d')][_0x2dda('0x3f')]?_0x333d03['attributes']:_0x5ebbc8[_0x2dda('0x3c')];if(!_0x41055c[_0x2dda('0x39')][_0x2dda('0x40')](_0x2dda('0x41'))){_0x333d03[_0x2dda('0x42')]=qs[_0x2dda('0x42')](_0x41055c['query']['limit']);_0x333d03[_0x2dda('0x2a')]=qs[_0x2dda('0x2a')](_0x41055c[_0x2dda('0x39')][_0x2dda('0x2a')]);}_0x333d03[_0x2dda('0x43')]=qs[_0x2dda('0x44')](_0x41055c[_0x2dda('0x39')][_0x2dda('0x44')]);_0x333d03[_0x2dda('0x45')]=qs[_0x2dda('0x3a')](_['pick'](_0x41055c[_0x2dda('0x39')],_0x5ebbc8['filters']),_0x485a1d);if(_0x41055c[_0x2dda('0x39')]['filter']){_0x333d03[_0x2dda('0x45')]=_[_0x2dda('0x46')](_0x333d03['where'],{'$or':_[_0x2dda('0x34')](_0x485a1d,function(_0x5e6cfc){if(_0x5e6cfc[_0x2dda('0x37')]!=='VIRTUAL'){var _0x2af311={};_0x2af311[_0x5e6cfc[_0x2dda('0x31')]]={'$like':'%'+_0x41055c['query'][_0x2dda('0x47')]+'%'};return _0x2af311;}})});}_0x333d03=_[_0x2dda('0x46')]({},_0x333d03,_0x41055c[_0x2dda('0x48')]);var _0x209e69={'where':_0x333d03[_0x2dda('0x45')]};return db[_0x2dda('0x35')][_0x2dda('0x29')](_0x209e69)['then'](function(_0x2c3e97){_0x4f7376[_0x2dda('0x29')]=_0x2c3e97;if(_0x41055c['query'][_0x2dda('0x49')]){_0x333d03[_0x2dda('0x4a')]=[{'all':!![]}];}return db[_0x2dda('0x35')]['findAll'](_0x333d03);})[_0x2dda('0x1d')](function(_0x118dc6){_0x4f7376[_0x2dda('0x4b')]=_0x118dc6;return _0x4f7376;})['then'](respondWithFilteredResult(_0x48bcdc,_0x333d03))[_0x2dda('0x25')](handleError(_0x48bcdc,null));};exports[_0x2dda('0x4c')]=function(_0xbdf693,_0x286013){var _0x4174af={'raw':![],'where':{'id':_0xbdf693[_0x2dda('0x4d')]['id']}},_0x2cf383={};_0x2cf383['model']=_[_0x2dda('0x4e')](db[_0x2dda('0x35')]['rawAttributes']);_0x2cf383['query']=_[_0x2dda('0x4e')](_0xbdf693[_0x2dda('0x39')]);_0x2cf383[_0x2dda('0x4f')]=_[_0x2dda('0x3b')](_0x2cf383['model'],_0x2cf383['query']);_0x4174af[_0x2dda('0x3d')]=_[_0x2dda('0x3b')](_0x2cf383[_0x2dda('0x3c')],qs[_0x2dda('0x3e')](_0xbdf693['query'][_0x2dda('0x3e')]));_0x4174af[_0x2dda('0x3d')]=_0x4174af[_0x2dda('0x3d')][_0x2dda('0x3f')]?_0x4174af['attributes']:_0x2cf383[_0x2dda('0x3c')];if(_0xbdf693['query'][_0x2dda('0x49')]){_0x4174af[_0x2dda('0x4a')]=[{'all':!![]}];}_0x4174af=_['merge']({},_0x4174af,_0xbdf693[_0x2dda('0x48')]);return db[_0x2dda('0x35')][_0x2dda('0x50')](_0x4174af)[_0x2dda('0x1d')](handleEntityNotFound(_0x286013,null))[_0x2dda('0x1d')](respondWithResult(_0x286013,null))['catch'](handleError(_0x286013,null));};exports[_0x2dda('0x51')]=function(_0x358638,_0x125691){return db[_0x2dda('0x35')][_0x2dda('0x51')](_0x358638[_0x2dda('0x52')],{})['then'](respondWithResult(_0x125691,0xc9))['catch'](handleError(_0x125691,null));};exports[_0x2dda('0x2f')]=function(_0x195c76,_0x471e89){if(_0x195c76[_0x2dda('0x52')]['id']){delete _0x195c76[_0x2dda('0x52')]['id'];}return db[_0x2dda('0x35')][_0x2dda('0x50')]({'where':{'id':_0x195c76[_0x2dda('0x4d')]['id']}})[_0x2dda('0x1d')](handleEntityNotFound(_0x471e89,null))[_0x2dda('0x1d')](saveUpdates(_0x195c76[_0x2dda('0x52')],null))['then'](respondWithResult(_0x471e89,null))[_0x2dda('0x25')](handleError(_0x471e89,null));};exports[_0x2dda('0x30')]=function(_0xdfd3e4,_0x31a4ba){return db[_0x2dda('0x35')]['find']({'where':{'id':_0xdfd3e4[_0x2dda('0x4d')]['id']}})[_0x2dda('0x1d')](handleEntityNotFound(_0x31a4ba,null))[_0x2dda('0x1d')](removeEntity(_0x31a4ba,null))['catch'](handleError(_0x31a4ba,null));};exports[_0x2dda('0x53')]=function(_0x373310,_0x5ad288,_0x21cef7){var _0x522f6c={};var _0x9acf5a={};var _0x3d7ab0;var _0x42ec0c;return db['ZendeskAccount'][_0x2dda('0x54')]({'where':{'id':_0x373310[_0x2dda('0x4d')]['id']}})[_0x2dda('0x1d')](handleEntityNotFound(_0x5ad288,null))[_0x2dda('0x1d')](function(_0x368fed){if(_0x368fed){_0x3d7ab0=_0x368fed;_0x9acf5a[_0x2dda('0x3c')]=_[_0x2dda('0x4e')](db[_0x2dda('0x55')][_0x2dda('0x36')]);_0x9acf5a[_0x2dda('0x39')]=_[_0x2dda('0x4e')](_0x373310['query']);_0x9acf5a['filters']=_[_0x2dda('0x3b')](_0x9acf5a['model'],_0x9acf5a['query']);_0x522f6c[_0x2dda('0x3d')]=_[_0x2dda('0x3b')](_0x9acf5a[_0x2dda('0x3c')],qs['fields'](_0x373310[_0x2dda('0x39')][_0x2dda('0x3e')]));_0x522f6c['attributes']=_0x522f6c['attributes'][_0x2dda('0x3f')]?_0x522f6c[_0x2dda('0x3d')]:_0x9acf5a[_0x2dda('0x3c')];_0x522f6c[_0x2dda('0x43')]=qs[_0x2dda('0x44')](_0x373310[_0x2dda('0x39')]['sort']);_0x522f6c['where']=qs['filters'](_[_0x2dda('0x56')](_0x373310[_0x2dda('0x39')],_0x9acf5a[_0x2dda('0x3a')]));if(_0x373310[_0x2dda('0x39')]['filter']){_0x522f6c[_0x2dda('0x45')]=_['merge'](_0x522f6c[_0x2dda('0x45')],{'$or':_['map'](_0x522f6c[_0x2dda('0x3d')],function(_0x2d4be7){var _0x793e11={};_0x793e11[_0x2d4be7]={'$like':'%'+_0x373310[_0x2dda('0x39')][_0x2dda('0x47')]+'%'};return _0x793e11;})});}_0x522f6c=_[_0x2dda('0x46')]({},_0x522f6c,_0x373310['options']);return _0x3d7ab0[_0x2dda('0x53')](_0x522f6c);}})['then'](function(_0x2f75b1){if(_0x2f75b1){_0x42ec0c=_0x2f75b1['length'];if(!_0x373310[_0x2dda('0x39')]['hasOwnProperty'](_0x2dda('0x41'))){_0x522f6c[_0x2dda('0x42')]=qs[_0x2dda('0x42')](_0x373310[_0x2dda('0x39')][_0x2dda('0x42')]);_0x522f6c[_0x2dda('0x2a')]=qs[_0x2dda('0x2a')](_0x373310[_0x2dda('0x39')][_0x2dda('0x2a')]);}return _0x3d7ab0[_0x2dda('0x53')](_0x522f6c);}})[_0x2dda('0x1d')](function(_0x3c1ab8){if(_0x3c1ab8){return _0x3c1ab8?{'count':_0x42ec0c,'rows':_0x3c1ab8}:null;}})['then'](respondWithResult(_0x5ad288,null))[_0x2dda('0x25')](handleError(_0x5ad288,null));};exports[_0x2dda('0x57')]=function(_0xf2c185,_0x37ca56,_0x3ff5d2){if(_0xf2c185['body']['id']){delete _0xf2c185[_0x2dda('0x52')]['id'];}return db[_0x2dda('0x35')][_0x2dda('0x54')]({'where':{'id':_0xf2c185[_0x2dda('0x4d')]['id']}})[_0x2dda('0x1d')](handleEntityNotFound(_0x37ca56,null))[_0x2dda('0x1d')](function(_0x344108){if(_0x344108){_0xf2c185[_0x2dda('0x52')][_0x2dda('0x58')]=_0x344108['id'];_0xf2c185[_0x2dda('0x52')][_0x2dda('0x59')]=integrations[_0x2dda('0x5a')](_0xf2c185[_0x2dda('0x52')]['channel'],_0xf2c185[_0x2dda('0x52')]['type']);_0xf2c185[_0x2dda('0x52')]['Descriptions']=integrations[_0x2dda('0x5b')](_0xf2c185[_0x2dda('0x52')][_0x2dda('0x5c')],_0xf2c185['body'][_0x2dda('0x37')]);return db[_0x2dda('0x55')]['create'](_0xf2c185[_0x2dda('0x52')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0x2dda('0x5d')],'as':_0x2dda('0x5e')}]});}return null;})[_0x2dda('0x1d')](respondWithResult(_0x37ca56,null))[_0x2dda('0x25')](handleError(_0x37ca56,null));};exports['getFields']=function(_0x3fb820,_0x18a2cc,_0x1fbf24){var _0x583cb4='';return db[_0x2dda('0x35')][_0x2dda('0x54')]({'where':{'id':_0x3fb820[_0x2dda('0x4d')]['id']},'attributes':['id',_0x2dda('0x5f'),_0x2dda('0x60'),_0x2dda('0x61'),_0x2dda('0x62'),_0x2dda('0x63')]})[_0x2dda('0x1d')](handleEntityNotFound(_0x18a2cc,null))[_0x2dda('0x1d')](function(_0x5688b8){if(_0x5688b8){_0x583cb4=_0x5688b8[_0x2dda('0x63')];var _0x40186b=_0x583cb4[_0x2dda('0x64')](-0x1);if(_0x40186b==='/'){_0x583cb4=_0x583cb4[_0x2dda('0x65')](0x0,_0x583cb4[_0x2dda('0x66')](_0x40186b));}var _0xee8865={'method':_0x2dda('0x67'),'uri':util[_0x2dda('0x68')]('%s/%s',_0x583cb4,_0x2dda('0x69')),'json':!![]};switch(_0x5688b8[_0x2dda('0x62')]){case'password':_0xee8865['headers']={'Authorization':util[_0x2dda('0x68')]('Basic\x20%s',new Buffer(util[_0x2dda('0x68')]('%s:%s',_0x5688b8[_0x2dda('0x5f')],_0x5688b8['password']))['toString'](_0x2dda('0x6a')))};break;case _0x2dda('0x61'):_0xee8865[_0x2dda('0x6b')]={'Authorization':util[_0x2dda('0x68')](_0x2dda('0x6c'),new Buffer(util[_0x2dda('0x68')](_0x2dda('0x6d'),_0x5688b8[_0x2dda('0x5f')],_0x5688b8[_0x2dda('0x61')]))[_0x2dda('0x6e')](_0x2dda('0x6a')))};break;default:throw new db[(_0x2dda('0x6f'))][(_0x2dda('0x70'))]('Unknown\x20authentication\x20type');}return rp(_0xee8865);}})[_0x2dda('0x1d')](function(_0x58e626){if(_0x58e626){var _0x1c2899=[_0x2dda('0x71'),'description','group',_0x2dda('0x72')];_[_0x2dda('0x73')](_0x58e626[_0x2dda('0x69')],function(_0x373c7e){return _0x1c2899['includes'](_0x373c7e['type']);});return{'count':_0x58e626[_0x2dda('0x69')][_0x2dda('0x3f')],'rows':_[_0x2dda('0x34')](_0x58e626[_0x2dda('0x69')],function(_0x118740){return{'id':_0x118740['id'],'name':_0x118740[_0x2dda('0x74')]>0x7?_0x118740[_0x2dda('0x75')]:_0x118740[_0x2dda('0x37')],'custom':_0x118740[_0x2dda('0x74')]>0x7?!![]:![],'options':_0x118740['system_field_options']?_0x118740[_0x2dda('0x76')]:_0x118740[_0x2dda('0x77')]?_0x118740[_0x2dda('0x77')]:[]};})};}})[_0x2dda('0x1d')](respondWithResult(_0x18a2cc,null))[_0x2dda('0x25')](function(_0xe66f89){var _0x243992=_0x3fb820['query'][_0x2dda('0x78')]?0x1f4:_0xe66f89[_0x2dda('0x79')]||0x1f4;logger[_0x2dda('0x20')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x243992,JSON['stringify'](_0xe66f89));delete _0xe66f89[_0x2dda('0x31')];if(_0x243992===0x191){_0x243992=0x190;}_0x18a2cc[_0x2dda('0x27')](_0x243992)[_0x2dda('0x32')](_0x3fb820[_0x2dda('0x39')]['test']?{'message':'Wrong\x20credentials','statusCode':_0xe66f89[_0x2dda('0x79')]}:_0xe66f89);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index db7ffbf..1adf8a7 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 _0xf15a=['path','rimraf','../../config/environment','./intZendeskAccount.attributes','exports','define','ZendeskAccount','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x51731f,_0x15b4ce){var _0x35d00b=function(_0x3031d2){while(--_0x3031d2){_0x51731f['push'](_0x51731f['shift']());}};_0x35d00b(++_0x15b4ce);}(_0xf15a,0x18d));var _0xaf15=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf15a[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xaf15('0x0'));var util=require(_0xaf15('0x1'));var logger=require(_0xaf15('0x2'))(_0xaf15('0x3'));var moment=require('moment');var BPromise=require(_0xaf15('0x4'));var rp=require(_0xaf15('0x5'));var fs=require('fs');var path=require(_0xaf15('0x6'));var rimraf=require(_0xaf15('0x7'));var config=require(_0xaf15('0x8'));var attributes=require(_0xaf15('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xaf15('0xa')]=function(_0x25f3a4,_0x56ed9f){return _0x25f3a4[_0xaf15('0xb')](_0xaf15('0xc'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf7e=['exports','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','bluebird','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x2e9e5d,_0x8271fa){var _0x15cc51=function(_0xc1a936){while(--_0xc1a936){_0x2e9e5d['push'](_0x2e9e5d['shift']());}};_0x15cc51(++_0x8271fa);}(_0xcf7e,0x101));var _0xecf7=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xcf7e[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var util=require(_0xecf7('0x0'));var logger=require(_0xecf7('0x1'))('api');var moment=require('moment');var BPromise=require(_0xecf7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xecf7('0x3'));var config=require(_0xecf7('0x4'));var attributes=require(_0xecf7('0x5'));var integrations=require(_0xecf7('0x6'));module[_0xecf7('0x7')]=function(_0x1aa7b1,_0x3cb401){return _0x1aa7b1[_0xecf7('0x8')](_0xecf7('0x9'),attributes,{'tableName':_0xecf7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index affc396..c3e5961 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x26f95e,_0x20bf5a){var _0x3af1b6=function(_0x3b8125){while(--_0x3b8125){_0x26f95e['push'](_0x26f95e['shift']());}};_0x3af1b6(++_0x20bf5a);}(_0x757a,0xde));var _0xa757=function(_0x542f9e,_0xd9b957){_0x542f9e=_0x542f9e-0x0;var _0x1493f0=_0x757a[_0x542f9e];return _0x1493f0;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetZendeskAccount',_0x4d9f58);logger['debug']('GetZendeskAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetZendeskAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file +var _0xb7e7=['request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','find','where','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x234b7e,_0x3a94ac){var _0x4673f4=function(_0x454fc4){while(--_0x454fc4){_0x234b7e['push'](_0x234b7e['shift']());}};_0x4673f4(++_0x3a94ac);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0xb7e7[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});}exports[_0x7b7e('0x14')]=function(_0x242368){var _0x200ef7=this;return new Promise(function(_0x2acb8c,_0x429a0e){return db[_0x7b7e('0x15')][_0x7b7e('0x16')]({'raw':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')]['where']||null:null,'attributes':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x19')]||null:null,'limit':_0x242368['options']?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1a')]||null:null,'include':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x53bbb3){return{'model':db[_0x53bbb3['model']],'as':_0x53bbb3['as'],'attributes':_0x53bbb3['attributes'],'include':_0x53bbb3[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x53bbb3[_0x7b7e('0x1b')],function(_0x483c6f){return{'model':db[_0x483c6f['model']],'as':_0x483c6f['as'],'attributes':_0x483c6f['attributes'],'include':_0x483c6f[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x483c6f[_0x7b7e('0x1b')],function(_0x7aa71){return{'model':db[_0x7aa71[_0x7b7e('0x1d')]],'as':_0x7aa71['as'],'attributes':_0x7aa71['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x21a15){logger['info']('GetZendeskAccount',_0x242368);logger['debug'](_0x7b7e('0x14'),_0x242368,JSON[_0x7b7e('0xf')](_0x21a15));_0x2acb8c(_0x21a15);})['catch'](function(_0x3db8c4){logger['error'](_0x7b7e('0x14'),_0x3db8c4[_0x7b7e('0x12')],_0x242368);_0x429a0e(_0x200ef7[_0x7b7e('0x10')](0x1f4,_0x3db8c4['message']));});});};exports[_0x7b7e('0x1e')]=function(_0xe31336){var _0x35602a=this;return new Promise(function(_0x326dd2,_0x33f9a1){return db['ZendeskAccount'][_0x7b7e('0x1f')]({'raw':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x20')]||null:null,'attributes':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')]['attributes']||null:null,'include':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_['map'](_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x2ca366){return{'model':db[_0x2ca366['model']],'as':_0x2ca366['as'],'attributes':_0x2ca366[_0x7b7e('0x19')],'include':_0x2ca366[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x2ca366[_0x7b7e('0x1b')],function(_0x31043a){return{'model':db[_0x31043a[_0x7b7e('0x1d')]],'as':_0x31043a['as'],'attributes':_0x31043a[_0x7b7e('0x19')],'include':_0x31043a[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x31043a[_0x7b7e('0x1b')],function(_0xd5a64d){return{'model':db[_0xd5a64d[_0x7b7e('0x1d')]],'as':_0xd5a64d['as'],'attributes':_0xd5a64d[_0x7b7e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x116563){logger[_0x7b7e('0xa')]('ShowZendeskAccount',_0xe31336);logger[_0x7b7e('0xc')](_0x7b7e('0x1e'),_0xe31336,JSON[_0x7b7e('0xf')](_0x116563));_0x326dd2(_0x116563);})[_0x7b7e('0x13')](function(_0x36abfc){logger[_0x7b7e('0x10')](_0x7b7e('0x1e'),_0x36abfc[_0x7b7e('0x12')],_0xe31336);_0x33f9a1(_0x35602a[_0x7b7e('0x10')](0x1f4,_0x36abfc[_0x7b7e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 4a82538..b0c593d 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 _0xc9ab=['update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','show','get','getFields','getSubjects','/:id/descriptions','post','/:id/tags','put','/:id'];(function(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0xc9ab,0xf3));var _0xbc9a=function(_0x4edb2c,_0x15d29d){_0x4edb2c=_0x4edb2c-0x0;var _0xdc6421=_0xc9ab[_0x4edb2c];return _0xdc6421;};'use strict';var multer=require('multer');var util=require(_0xbc9a('0x0'));var path=require(_0xbc9a('0x1'));var timeout=require(_0xbc9a('0x2'));var express=require(_0xbc9a('0x3'));var router=express[_0xbc9a('0x4')]();var auth=require(_0xbc9a('0x5'));var interaction=require(_0xbc9a('0x6'));var config=require('../../config/environment');var controller=require('./intZendeskConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xbc9a('0x7')](),controller[_0xbc9a('0x8')]);router[_0xbc9a('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xbc9a('0xa')]);router['get']('/:id/subjects',auth[_0xbc9a('0x7')](),controller[_0xbc9a('0xb')]);router['get'](_0xbc9a('0xc'),auth[_0xbc9a('0x7')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0xbc9a('0xd')]('/',auth[_0xbc9a('0x7')](),controller['create']);router['post'](_0xbc9a('0xe'),auth[_0xbc9a('0x7')](),controller['setTags']);router[_0xbc9a('0xf')](_0xbc9a('0x10'),auth[_0xbc9a('0x7')](),controller[_0xbc9a('0x11')]);router['delete'](_0xbc9a('0x10'),auth[_0xbc9a('0x7')](),controller[_0xbc9a('0x12')]);module[_0xbc9a('0x13')]=router; \ No newline at end of file +var _0xf2c3=['post','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','show','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create'];(function(_0x2b2b53,_0x201fb2){var _0x405e84=function(_0x3704f5){while(--_0x3704f5){_0x2b2b53['push'](_0x2b2b53['shift']());}};_0x405e84(++_0x201fb2);}(_0xf2c3,0x13b));var _0x3f2c=function(_0x20990f,_0x3d14e5){_0x20990f=_0x20990f-0x0;var _0x5eb143=_0xf2c3[_0x20990f];return _0x5eb143;};'use strict';var multer=require(_0x3f2c('0x0'));var util=require(_0x3f2c('0x1'));var path=require(_0x3f2c('0x2'));var timeout=require(_0x3f2c('0x3'));var express=require(_0x3f2c('0x4'));var router=express[_0x3f2c('0x5')]();var auth=require(_0x3f2c('0x6'));var interaction=require(_0x3f2c('0x7'));var config=require(_0x3f2c('0x8'));var controller=require(_0x3f2c('0x9'));router[_0x3f2c('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3f2c('0xb'),auth['isAuthenticated'](),controller[_0x3f2c('0xc')]);router[_0x3f2c('0xa')]('/:id/fields',auth[_0x3f2c('0xd')](),controller[_0x3f2c('0xe')]);router[_0x3f2c('0xa')](_0x3f2c('0xf'),auth[_0x3f2c('0xd')](),controller[_0x3f2c('0x10')]);router[_0x3f2c('0xa')](_0x3f2c('0x11'),auth['isAuthenticated'](),controller[_0x3f2c('0x12')]);router[_0x3f2c('0xa')](_0x3f2c('0x13'),auth[_0x3f2c('0xd')](),controller['getTags']);router['post']('/',auth[_0x3f2c('0xd')](),controller[_0x3f2c('0x14')]);router[_0x3f2c('0x15')](_0x3f2c('0x13'),auth[_0x3f2c('0xd')](),controller[_0x3f2c('0x16')]);router[_0x3f2c('0x17')](_0x3f2c('0xb'),auth['isAuthenticated'](),controller[_0x3f2c('0x18')]);router[_0x3f2c('0x19')](_0x3f2c('0xb'),auth[_0x3f2c('0xd')](),controller[_0x3f2c('0x1a')]);module[_0x3f2c('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index d4182d2..80f5550 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 _0xd2b6=['exports','STRING','sequelize'];(function(_0x56e8fa,_0x10db02){var _0x713b09=function(_0x232730){while(--_0x232730){_0x56e8fa['push'](_0x56e8fa['shift']());}};_0x713b09(++_0x10db02);}(_0xd2b6,0x74));var _0x6d2b=function(_0x5e686b,_0x32db3b){_0x5e686b=_0x5e686b-0x0;var _0x574b48=_0xd2b6[_0x5e686b];return _0x574b48;};'use strict';var Sequelize=require(_0x6d2b('0x0'));module[_0x6d2b('0x1')]={'name':{'type':Sequelize[_0x6d2b('0x2')]},'description':{'type':Sequelize[_0x6d2b('0x2')]}}; \ No newline at end of file +var _0xf02e=['STRING','sequelize'];(function(_0x4d5c9f,_0x24f58c){var _0x3fad6f=function(_0x44d130){while(--_0x44d130){_0x4d5c9f['push'](_0x4d5c9f['shift']());}};_0x3fad6f(++_0x24f58c);}(_0xf02e,0xe1));var _0xef02=function(_0x4f6588,_0x34099a){_0x4f6588=_0x4f6588-0x0;var _0xc62e9f=_0xf02e[_0x4f6588];return _0xc62e9f;};'use strict';var Sequelize=require(_0xef02('0x0'));module['exports']={'name':{'type':Sequelize[_0xef02('0x1')]},'description':{'type':Sequelize[_0xef02('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index d6b7daf..1a7c01a 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 _0x8c8b=['code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','include','show','params','filtears','includeAll','find','create','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','zip-dir','fast-json-patch','request-promise','moment','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','../../config/license/util','../../mysqldb','client','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x53b7c3,_0x3d0fbb){var _0x457aec=function(_0x18546a){while(--_0x18546a){_0x53b7c3['push'](_0x53b7c3['shift']());}};_0x457aec(++_0x3d0fbb);}(_0x8c8b,0x106));var _0xb8c8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8c8b[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xb8c8('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb8c8('0x1'));var jsonpatch=require(_0xb8c8('0x2'));var rp=require(_0xb8c8('0x3'));var moment=require(_0xb8c8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb8c8('0x5'));var path=require(_0xb8c8('0x6'));var sox=require(_0xb8c8('0x7'));var csv=require(_0xb8c8('0x8'));var ejs=require(_0xb8c8('0x9'));var fs=require('fs');var _=require(_0xb8c8('0xa'));var squel=require(_0xb8c8('0xb'));var crypto=require(_0xb8c8('0xc'));var jsforce=require(_0xb8c8('0xd'));var deskjs=require(_0xb8c8('0xe'));var toCsv=require(_0xb8c8('0x8'));var querystring=require('querystring');var Papa=require(_0xb8c8('0xf'));var Redis=require(_0xb8c8('0x10'));var authService=require(_0xb8c8('0x11'));var qs=require(_0xb8c8('0x12'));var as=require(_0xb8c8('0x13'));var hardwareService=require(_0xb8c8('0x14'));var logger=require(_0xb8c8('0x15'))(_0xb8c8('0x16'));var utils=require(_0xb8c8('0x17'));var config=require(_0xb8c8('0x18'));var licenseUtil=require(_0xb8c8('0x19'));var db=require(_0xb8c8('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb8c8('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa5e893,_0x57efd1,_0x4f4715,_0x3df583){return new BPromise(function(_0x2efe06,_0x306a92){var _0x5a3298=_0x3df583||client;return _0x5a3298[_0xb8c8('0x1c')](_0xa5e893,_0x4f4715)[_0xb8c8('0x1d')](function(_0x1c12c2){logger[_0xb8c8('0x1e')]('ZendeskConfiguration,\x20%s,\x20%s',_0x57efd1,_0xb8c8('0x1f'));logger[_0xb8c8('0x20')](_0xb8c8('0x21'),_0x57efd1,_0xb8c8('0x1f'),JSON['stringify'](_0x1c12c2));if(_0x1c12c2[_0xb8c8('0x22')]){if(_0x1c12c2[_0xb8c8('0x22')][_0xb8c8('0x23')]===0x1f4){logger[_0xb8c8('0x22')](_0xb8c8('0x24'),_0x57efd1,_0x1c12c2[_0xb8c8('0x22')][_0xb8c8('0x25')]);return _0x306a92(_0x1c12c2[_0xb8c8('0x22')][_0xb8c8('0x25')]);}logger[_0xb8c8('0x22')](_0xb8c8('0x24'),_0x57efd1,_0x1c12c2[_0xb8c8('0x22')][_0xb8c8('0x25')]);return _0x2efe06(_0x1c12c2[_0xb8c8('0x22')][_0xb8c8('0x25')]);}else{logger['info'](_0xb8c8('0x24'),_0x57efd1,_0xb8c8('0x1f'));_0x2efe06(_0x1c12c2[_0xb8c8('0x26')][_0xb8c8('0x25')]);}})[_0xb8c8('0x27')](function(_0x50be0a){logger[_0xb8c8('0x22')]('ZendeskConfiguration,\x20%s,\x20%s',_0x57efd1,_0x50be0a);_0x306a92(_0x50be0a);});});}function respondWithStatusCode(_0x58d7c0,_0x2b3629){_0x2b3629=_0x2b3629||0xcc;return function(_0x38c13a){if(_0x38c13a){return _0x58d7c0[_0xb8c8('0x28')](_0x2b3629);}return _0x58d7c0[_0xb8c8('0x29')](_0x2b3629)[_0xb8c8('0x2a')]();};}function respondWithResult(_0x4a7392,_0x1682ba){_0x1682ba=_0x1682ba||0xc8;return function(_0x200f06){if(_0x200f06){return _0x4a7392[_0xb8c8('0x29')](_0x1682ba)[_0xb8c8('0x2b')](_0x200f06);}};}function respondWithFilteredResult(_0x4d8418,_0x3c4b44){return function(_0x1b3007){if(_0x1b3007){var _0x54e2d6=_0x1b3007['count'],_0x2814ed=_0x3c4b44['offset'],_0x9c9563=_0x3c4b44[_0xb8c8('0x2c')]+_0x3c4b44[_0xb8c8('0x2d')],_0x2ee78c;if(_0x9c9563>=_0x54e2d6){_0x9c9563=_0x54e2d6;_0x2ee78c=0xc8;}else{_0x2ee78c=0xce;}_0x4d8418['status'](_0x2ee78c);return _0x4d8418[_0xb8c8('0x2e')](_0xb8c8('0x2f'),_0x2814ed+'-'+_0x9c9563+'/'+_0x54e2d6)['json'](_0x1b3007);}return null;};}function patchUpdates(_0x3211c3){return function(_0x4bd15f){try{jsonpatch[_0xb8c8('0x30')](_0x4bd15f,_0x3211c3,!![]);}catch(_0xcccbee){return BPromise[_0xb8c8('0x31')](_0xcccbee);}return _0x4bd15f[_0xb8c8('0x32')]();};}function saveUpdates(_0x107de0,_0x29ad0b){return function(_0x23c2d3){if(_0x23c2d3){return _0x23c2d3[_0xb8c8('0x33')](_0x107de0)[_0xb8c8('0x1d')](function(_0x585a61){return _0x585a61;});}return null;};}function removeEntity(_0x1d00ce,_0x570895){return function(_0x25149c){if(_0x25149c){return _0x25149c[_0xb8c8('0x34')]()[_0xb8c8('0x1d')](function(){_0x1d00ce['status'](0xcc)[_0xb8c8('0x2a')]();});}};}function handleEntityNotFound(_0x4c7635,_0x125d58){return function(_0x8b8b6){if(!_0x8b8b6){_0x4c7635[_0xb8c8('0x28')](0x194);}return _0x8b8b6;};}function handleError(_0x3819b2,_0x2b57f8){_0x2b57f8=_0x2b57f8||0x1f4;return function(_0xfac18e){logger[_0xb8c8('0x22')](_0xfac18e[_0xb8c8('0x35')]);if(_0xfac18e['name']){delete _0xfac18e[_0xb8c8('0x36')];}_0x3819b2[_0xb8c8('0x29')](_0x2b57f8)[_0xb8c8('0x37')](_0xfac18e);};}exports[_0xb8c8('0x38')]=function(_0x3b889e,_0x45dbeb){var _0x366be8={},_0x3f0063={},_0x4ff58e={'count':0x0,'rows':[]};var _0x178aa2=_['map'](db[_0xb8c8('0x39')][_0xb8c8('0x3a')],function(_0x3d99cf){return{'name':_0x3d99cf[_0xb8c8('0x3b')],'type':_0x3d99cf[_0xb8c8('0x3c')][_0xb8c8('0x3d')]};});_0x3f0063['model']=_[_0xb8c8('0x3e')](_0x178aa2,_0xb8c8('0x36'));_0x3f0063[_0xb8c8('0x3f')]=_[_0xb8c8('0x40')](_0x3b889e[_0xb8c8('0x3f')]);_0x3f0063['filters']=_['intersection'](_0x3f0063[_0xb8c8('0x41')],_0x3f0063[_0xb8c8('0x3f')]);_0x366be8[_0xb8c8('0x42')]=_[_0xb8c8('0x43')](_0x3f0063[_0xb8c8('0x41')],qs[_0xb8c8('0x44')](_0x3b889e[_0xb8c8('0x3f')][_0xb8c8('0x44')]));_0x366be8[_0xb8c8('0x42')]=_0x366be8['attributes'][_0xb8c8('0x45')]?_0x366be8['attributes']:_0x3f0063[_0xb8c8('0x41')];if(!_0x3b889e[_0xb8c8('0x3f')][_0xb8c8('0x46')](_0xb8c8('0x47'))){_0x366be8[_0xb8c8('0x2d')]=qs[_0xb8c8('0x2d')](_0x3b889e[_0xb8c8('0x3f')][_0xb8c8('0x2d')]);_0x366be8[_0xb8c8('0x2c')]=qs['offset'](_0x3b889e[_0xb8c8('0x3f')][_0xb8c8('0x2c')]);}_0x366be8[_0xb8c8('0x48')]=qs[_0xb8c8('0x49')](_0x3b889e[_0xb8c8('0x3f')][_0xb8c8('0x49')]);_0x366be8[_0xb8c8('0x4a')]=qs[_0xb8c8('0x4b')](_[_0xb8c8('0x4c')](_0x3b889e[_0xb8c8('0x3f')],_0x3f0063[_0xb8c8('0x4b')]),_0x178aa2);if(_0x3b889e[_0xb8c8('0x3f')][_0xb8c8('0x4d')]){_0x366be8[_0xb8c8('0x4a')]=_[_0xb8c8('0x4e')](_0x366be8[_0xb8c8('0x4a')],{'$or':_[_0xb8c8('0x3e')](_0x178aa2,function(_0x47ec38){if(_0x47ec38['type']!==_0xb8c8('0x4f')){var _0x23f687={};_0x23f687[_0x47ec38[_0xb8c8('0x36')]]={'$like':'%'+_0x3b889e[_0xb8c8('0x3f')][_0xb8c8('0x4d')]+'%'};return _0x23f687;}})});}_0x366be8=_[_0xb8c8('0x4e')]({},_0x366be8,_0x3b889e[_0xb8c8('0x50')]);var _0x55fbf3={'where':_0x366be8[_0xb8c8('0x4a')]};return db['ZendeskConfiguration']['count'](_0x55fbf3)[_0xb8c8('0x1d')](function(_0x16d991){_0x4ff58e[_0xb8c8('0x51')]=_0x16d991;if(_0x3b889e[_0xb8c8('0x3f')]['includeAll']){_0x366be8[_0xb8c8('0x52')]=[{'all':!![]}];}return db[_0xb8c8('0x39')]['findAll'](_0x366be8);})[_0xb8c8('0x1d')](function(_0x5bfec7){_0x4ff58e['rows']=_0x5bfec7;return _0x4ff58e;})['then'](respondWithFilteredResult(_0x45dbeb,_0x366be8))[_0xb8c8('0x27')](handleError(_0x45dbeb,null));};exports[_0xb8c8('0x53')]=function(_0x47f219,_0x15e51c){var _0x562b52={'raw':![],'where':{'id':_0x47f219[_0xb8c8('0x54')]['id']}},_0x6ba25b={};_0x6ba25b[_0xb8c8('0x41')]=_['keys'](db[_0xb8c8('0x39')][_0xb8c8('0x3a')]);_0x6ba25b['query']=_[_0xb8c8('0x40')](_0x47f219[_0xb8c8('0x3f')]);_0x6ba25b[_0xb8c8('0x55')]=_[_0xb8c8('0x43')](_0x6ba25b[_0xb8c8('0x41')],_0x6ba25b[_0xb8c8('0x3f')]);_0x562b52['attributes']=_[_0xb8c8('0x43')](_0x6ba25b['model'],qs[_0xb8c8('0x44')](_0x47f219['query'][_0xb8c8('0x44')]));_0x562b52[_0xb8c8('0x42')]=_0x562b52[_0xb8c8('0x42')]['length']?_0x562b52['attributes']:_0x6ba25b[_0xb8c8('0x41')];if(_0x47f219['query'][_0xb8c8('0x56')]){_0x562b52['include']=[{'all':!![]}];}_0x562b52=_[_0xb8c8('0x4e')]({},_0x562b52,_0x47f219[_0xb8c8('0x50')]);return db['ZendeskConfiguration'][_0xb8c8('0x57')](_0x562b52)[_0xb8c8('0x1d')](handleEntityNotFound(_0x15e51c,null))[_0xb8c8('0x1d')](respondWithResult(_0x15e51c,null))[_0xb8c8('0x27')](handleError(_0x15e51c,null));};exports[_0xb8c8('0x58')]=function(_0x319746,_0x1cf975){return db[_0xb8c8('0x39')]['create'](_0x319746[_0xb8c8('0x59')],{})[_0xb8c8('0x1d')](respondWithResult(_0x1cf975,0xc9))['catch'](handleError(_0x1cf975,null));};exports[_0xb8c8('0x33')]=function(_0x11ffd7,_0x3f541f){if(_0x11ffd7[_0xb8c8('0x59')]['id']){delete _0x11ffd7[_0xb8c8('0x59')]['id'];}return db[_0xb8c8('0x39')]['find']({'where':{'id':_0x11ffd7['params']['id']}})[_0xb8c8('0x1d')](handleEntityNotFound(_0x3f541f,null))[_0xb8c8('0x1d')](saveUpdates(_0x11ffd7[_0xb8c8('0x59')],null))['then'](respondWithResult(_0x3f541f,null))[_0xb8c8('0x27')](handleError(_0x3f541f,null));};exports[_0xb8c8('0x34')]=function(_0x1410d1,_0x35624e){return db[_0xb8c8('0x39')][_0xb8c8('0x57')]({'where':{'id':_0x1410d1[_0xb8c8('0x54')]['id']}})[_0xb8c8('0x1d')](handleEntityNotFound(_0x35624e,null))['then'](removeEntity(_0x35624e,null))['catch'](handleError(_0x35624e,null));};exports[_0xb8c8('0x5a')]=function(_0xff3489,_0x9ad901,_0x3d4d48){var _0x150870={};var _0x119130={};var _0x35b2f0;var _0x5af85b;return db[_0xb8c8('0x39')][_0xb8c8('0x5b')]({'where':{'id':_0xff3489[_0xb8c8('0x54')]['id']}})[_0xb8c8('0x1d')](handleEntityNotFound(_0x9ad901,null))[_0xb8c8('0x1d')](function(_0x94539d){if(_0x94539d){_0x35b2f0=_0x94539d;_0x119130[_0xb8c8('0x41')]=_[_0xb8c8('0x40')](db[_0xb8c8('0x5c')][_0xb8c8('0x3a')]);_0x119130[_0xb8c8('0x3f')]=_['keys'](_0xff3489[_0xb8c8('0x3f')]);_0x119130[_0xb8c8('0x4b')]=_[_0xb8c8('0x43')](_0x119130[_0xb8c8('0x41')],_0x119130[_0xb8c8('0x3f')]);_0x150870[_0xb8c8('0x42')]=_[_0xb8c8('0x43')](_0x119130[_0xb8c8('0x41')],qs[_0xb8c8('0x44')](_0xff3489['query'][_0xb8c8('0x44')]));_0x150870[_0xb8c8('0x42')]=_0x150870['attributes'][_0xb8c8('0x45')]?_0x150870['attributes']:_0x119130[_0xb8c8('0x41')];_0x150870[_0xb8c8('0x48')]=qs[_0xb8c8('0x49')](_0xff3489[_0xb8c8('0x3f')][_0xb8c8('0x49')]);_0x150870['where']=qs['filters'](_[_0xb8c8('0x4c')](_0xff3489['query'],_0x119130[_0xb8c8('0x4b')]));if(_0xff3489[_0xb8c8('0x3f')][_0xb8c8('0x4d')]){_0x150870[_0xb8c8('0x4a')]=_[_0xb8c8('0x4e')](_0x150870['where'],{'$or':_['map'](_0x150870['attributes'],function(_0x2e7b0f){var _0x5a3c38={};_0x5a3c38[_0x2e7b0f]={'$like':'%'+_0xff3489[_0xb8c8('0x3f')][_0xb8c8('0x4d')]+'%'};return _0x5a3c38;})});}_0x150870=_['merge']({},_0x150870,_0xff3489[_0xb8c8('0x50')]);return _0x35b2f0[_0xb8c8('0x5a')](_0x150870);}})['then'](function(_0x2f49fd){if(_0x2f49fd){_0x5af85b=_0x2f49fd[_0xb8c8('0x45')];if(!_0xff3489[_0xb8c8('0x3f')][_0xb8c8('0x46')](_0xb8c8('0x47'))){_0x150870[_0xb8c8('0x2d')]=qs['limit'](_0xff3489[_0xb8c8('0x3f')][_0xb8c8('0x2d')]);_0x150870[_0xb8c8('0x2c')]=qs[_0xb8c8('0x2c')](_0xff3489[_0xb8c8('0x3f')][_0xb8c8('0x2c')]);}return _0x35b2f0['getFields'](_0x150870);}})['then'](function(_0x5814f0){if(_0x5814f0){return _0x5814f0?{'count':_0x5af85b,'rows':_0x5814f0}:null;}})[_0xb8c8('0x1d')](respondWithResult(_0x9ad901,null))[_0xb8c8('0x27')](handleError(_0x9ad901,null));};exports[_0xb8c8('0x5d')]=function(_0xaf8fa8,_0xc3b636,_0x83c237){var _0xcb7c3e={};var _0xef5377={};var _0x2ac944;var _0x47840f;return db[_0xb8c8('0x39')][_0xb8c8('0x5b')]({'where':{'id':_0xaf8fa8['params']['id']}})[_0xb8c8('0x1d')](handleEntityNotFound(_0xc3b636,null))[_0xb8c8('0x1d')](function(_0x56607f){if(_0x56607f){_0x2ac944=_0x56607f;_0xef5377['model']=_[_0xb8c8('0x40')](db[_0xb8c8('0x5c')][_0xb8c8('0x3a')]);_0xef5377['query']=_[_0xb8c8('0x40')](_0xaf8fa8['query']);_0xef5377[_0xb8c8('0x4b')]=_[_0xb8c8('0x43')](_0xef5377[_0xb8c8('0x41')],_0xef5377[_0xb8c8('0x3f')]);_0xcb7c3e[_0xb8c8('0x42')]=_['intersection'](_0xef5377[_0xb8c8('0x41')],qs[_0xb8c8('0x44')](_0xaf8fa8[_0xb8c8('0x3f')]['fields']));_0xcb7c3e['attributes']=_0xcb7c3e[_0xb8c8('0x42')][_0xb8c8('0x45')]?_0xcb7c3e[_0xb8c8('0x42')]:_0xef5377[_0xb8c8('0x41')];_0xcb7c3e[_0xb8c8('0x48')]=qs[_0xb8c8('0x49')](_0xaf8fa8[_0xb8c8('0x3f')][_0xb8c8('0x49')]);_0xcb7c3e[_0xb8c8('0x4a')]=qs[_0xb8c8('0x4b')](_[_0xb8c8('0x4c')](_0xaf8fa8[_0xb8c8('0x3f')],_0xef5377[_0xb8c8('0x4b')]));if(_0xaf8fa8['query'][_0xb8c8('0x4d')]){_0xcb7c3e[_0xb8c8('0x4a')]=_[_0xb8c8('0x4e')](_0xcb7c3e['where'],{'$or':_[_0xb8c8('0x3e')](_0xcb7c3e[_0xb8c8('0x42')],function(_0x2587bb){var _0x3f6deb={};_0x3f6deb[_0x2587bb]={'$like':'%'+_0xaf8fa8['query'][_0xb8c8('0x4d')]+'%'};return _0x3f6deb;})});}_0xcb7c3e=_['merge']({},_0xcb7c3e,_0xaf8fa8[_0xb8c8('0x50')]);return _0x2ac944[_0xb8c8('0x5d')](_0xcb7c3e);}})['then'](function(_0xefb9a0){if(_0xefb9a0){_0x47840f=_0xefb9a0[_0xb8c8('0x45')];if(!_0xaf8fa8['query'][_0xb8c8('0x46')](_0xb8c8('0x47'))){_0xcb7c3e[_0xb8c8('0x2d')]=qs[_0xb8c8('0x2d')](_0xaf8fa8['query'][_0xb8c8('0x2d')]);_0xcb7c3e[_0xb8c8('0x2c')]=qs[_0xb8c8('0x2c')](_0xaf8fa8[_0xb8c8('0x3f')]['offset']);}return _0x2ac944[_0xb8c8('0x5d')](_0xcb7c3e);}})['then'](function(_0x69bb69){if(_0x69bb69){return _0x69bb69?{'count':_0x47840f,'rows':_0x69bb69}:null;}})[_0xb8c8('0x1d')](respondWithResult(_0xc3b636,null))[_0xb8c8('0x27')](handleError(_0xc3b636,null));};exports['getDescriptions']=function(_0x284425,_0x2abc4b,_0x35dea4){var _0x6e871e={};var _0x1a2dd2={};var _0x297dc9;var _0x42a505;return db[_0xb8c8('0x39')][_0xb8c8('0x5b')]({'where':{'id':_0x284425[_0xb8c8('0x54')]['id']}})[_0xb8c8('0x1d')](handleEntityNotFound(_0x2abc4b,null))[_0xb8c8('0x1d')](function(_0x4cd4fc){if(_0x4cd4fc){_0x297dc9=_0x4cd4fc;_0x1a2dd2['model']=_[_0xb8c8('0x40')](db[_0xb8c8('0x5c')][_0xb8c8('0x3a')]);_0x1a2dd2[_0xb8c8('0x3f')]=_['keys'](_0x284425[_0xb8c8('0x3f')]);_0x1a2dd2[_0xb8c8('0x4b')]=_[_0xb8c8('0x43')](_0x1a2dd2[_0xb8c8('0x41')],_0x1a2dd2[_0xb8c8('0x3f')]);_0x6e871e[_0xb8c8('0x42')]=_[_0xb8c8('0x43')](_0x1a2dd2['model'],qs[_0xb8c8('0x44')](_0x284425['query'][_0xb8c8('0x44')]));_0x6e871e[_0xb8c8('0x42')]=_0x6e871e[_0xb8c8('0x42')][_0xb8c8('0x45')]?_0x6e871e['attributes']:_0x1a2dd2[_0xb8c8('0x41')];_0x6e871e['order']=qs[_0xb8c8('0x49')](_0x284425['query']['sort']);_0x6e871e[_0xb8c8('0x4a')]=qs[_0xb8c8('0x4b')](_[_0xb8c8('0x4c')](_0x284425[_0xb8c8('0x3f')],_0x1a2dd2[_0xb8c8('0x4b')]));if(_0x284425['query']['filter']){_0x6e871e[_0xb8c8('0x4a')]=_[_0xb8c8('0x4e')](_0x6e871e[_0xb8c8('0x4a')],{'$or':_['map'](_0x6e871e['attributes'],function(_0xfe7ab9){var _0x2e40c5={};_0x2e40c5[_0xfe7ab9]={'$like':'%'+_0x284425[_0xb8c8('0x3f')][_0xb8c8('0x4d')]+'%'};return _0x2e40c5;})});}_0x6e871e=_[_0xb8c8('0x4e')]({},_0x6e871e,_0x284425['options']);return _0x297dc9[_0xb8c8('0x5e')](_0x6e871e);}})[_0xb8c8('0x1d')](function(_0x52e9e4){if(_0x52e9e4){_0x42a505=_0x52e9e4[_0xb8c8('0x45')];if(!_0x284425['query'][_0xb8c8('0x46')](_0xb8c8('0x47'))){_0x6e871e[_0xb8c8('0x2d')]=qs[_0xb8c8('0x2d')](_0x284425[_0xb8c8('0x3f')][_0xb8c8('0x2d')]);_0x6e871e['offset']=qs[_0xb8c8('0x2c')](_0x284425[_0xb8c8('0x3f')][_0xb8c8('0x2c')]);}return _0x297dc9[_0xb8c8('0x5e')](_0x6e871e);}})[_0xb8c8('0x1d')](function(_0x44abfc){if(_0x44abfc){return _0x44abfc?{'count':_0x42a505,'rows':_0x44abfc}:null;}})[_0xb8c8('0x1d')](respondWithResult(_0x2abc4b,null))['catch'](handleError(_0x2abc4b,null));};exports[_0xb8c8('0x5f')]=function(_0x35b7c7,_0x5c2ac3,_0x5b279d){var _0x3f30f5={};var _0x59e8ba={};var _0x1db647;var _0x392696;return db['ZendeskConfiguration'][_0xb8c8('0x5b')]({'where':{'id':_0x35b7c7['params']['id']}})[_0xb8c8('0x1d')](handleEntityNotFound(_0x5c2ac3,null))['then'](function(_0x5b991a){if(_0x5b991a){_0x1db647=_0x5b991a;_0x59e8ba['model']=_[_0xb8c8('0x40')](db[_0xb8c8('0x60')][_0xb8c8('0x3a')]);_0x59e8ba[_0xb8c8('0x3f')]=_[_0xb8c8('0x40')](_0x35b7c7[_0xb8c8('0x3f')]);_0x59e8ba[_0xb8c8('0x4b')]=_[_0xb8c8('0x43')](_0x59e8ba[_0xb8c8('0x41')],_0x59e8ba[_0xb8c8('0x3f')]);_0x3f30f5[_0xb8c8('0x42')]=_[_0xb8c8('0x43')](_0x59e8ba[_0xb8c8('0x41')],qs[_0xb8c8('0x44')](_0x35b7c7['query']['fields']));_0x3f30f5[_0xb8c8('0x42')]=_0x3f30f5[_0xb8c8('0x42')][_0xb8c8('0x45')]?_0x3f30f5[_0xb8c8('0x42')]:_0x59e8ba[_0xb8c8('0x41')];_0x3f30f5[_0xb8c8('0x48')]=qs[_0xb8c8('0x49')](_0x35b7c7[_0xb8c8('0x3f')][_0xb8c8('0x49')]);_0x3f30f5[_0xb8c8('0x4a')]=qs['filters'](_['pick'](_0x35b7c7['query'],_0x59e8ba['filters']));if(_0x35b7c7[_0xb8c8('0x3f')]['filter']){_0x3f30f5[_0xb8c8('0x4a')]=_[_0xb8c8('0x4e')](_0x3f30f5['where'],{'$or':_[_0xb8c8('0x3e')](_0x3f30f5['attributes'],function(_0x485d76){var _0xcf9d1={};_0xcf9d1[_0x485d76]={'$like':'%'+_0x35b7c7[_0xb8c8('0x3f')][_0xb8c8('0x4d')]+'%'};return _0xcf9d1;})});}_0x3f30f5=_['merge']({},_0x3f30f5,_0x35b7c7['options']);return _0x1db647[_0xb8c8('0x5f')](_0x3f30f5);}})[_0xb8c8('0x1d')](function(_0x15af5a){if(_0x15af5a){_0x392696=_0x15af5a[_0xb8c8('0x45')];if(!_0x35b7c7[_0xb8c8('0x3f')]['hasOwnProperty'](_0xb8c8('0x47'))){_0x3f30f5[_0xb8c8('0x2d')]=qs[_0xb8c8('0x2d')](_0x35b7c7['query'][_0xb8c8('0x2d')]);_0x3f30f5[_0xb8c8('0x2c')]=qs[_0xb8c8('0x2c')](_0x35b7c7['query'][_0xb8c8('0x2c')]);}return _0x1db647['getTags'](_0x3f30f5);}})[_0xb8c8('0x1d')](function(_0x3cd481){if(_0x3cd481){return _0x3cd481?{'count':_0x392696,'rows':_0x3cd481}:null;}})['then'](respondWithResult(_0x5c2ac3,null))[_0xb8c8('0x27')](handleError(_0x5c2ac3,null));};exports[_0xb8c8('0x61')]=function(_0x24b4c7,_0x30b2a9,_0x3a3163){if(_0x24b4c7[_0xb8c8('0x59')]['id']){delete _0x24b4c7[_0xb8c8('0x59')]['id'];}return db[_0xb8c8('0x39')][_0xb8c8('0x5b')]({'where':{'id':_0x24b4c7['params']['id']}})[_0xb8c8('0x1d')](handleEntityNotFound(_0x30b2a9,null))[_0xb8c8('0x1d')](function(_0x3c4d29){if(_0x3c4d29){return _0x3c4d29[_0xb8c8('0x61')](_0x24b4c7[_0xb8c8('0x59')][_0xb8c8('0x62')]||[]);}return null;})[_0xb8c8('0x1d')](respondWithResult(_0x30b2a9,null))['catch'](handleError(_0x30b2a9,null));}; \ No newline at end of file +var _0x1280=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','client','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','status','json','count','offset','set','reject','save','update','destroy','end','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','ZendeskConfiguration','includeAll','rows','catch','show','params','keys','filtears','include','options','find','body','getFields','findOne','ZendeskField','getSubjects','order','getDescriptions','getTags','Tag','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce'];(function(_0x2f2526,_0x2d32cd){var _0x160820=function(_0x285f8c){while(--_0x285f8c){_0x2f2526['push'](_0x2f2526['shift']());}};_0x160820(++_0x2d32cd);}(_0x1280,0xac));var _0x0128=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0x1280[_0x51ac09];return _0x3f827d;};'use strict';var pdf=require(_0x0128('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0128('0x1'));var zipdir=require(_0x0128('0x2'));var jsonpatch=require(_0x0128('0x3'));var rp=require(_0x0128('0x4'));var moment=require(_0x0128('0x5'));var BPromise=require(_0x0128('0x6'));var Mustache=require('mustache');var util=require(_0x0128('0x7'));var path=require(_0x0128('0x8'));var sox=require(_0x0128('0x9'));var csv=require(_0x0128('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0128('0xb'));var crypto=require(_0x0128('0xc'));var jsforce=require(_0x0128('0xd'));var deskjs=require(_0x0128('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0128('0xf'));var Papa=require(_0x0128('0x10'));var Redis=require('ioredis');var authService=require(_0x0128('0x11'));var qs=require(_0x0128('0x12'));var as=require(_0x0128('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0128('0x14'));var utils=require(_0x0128('0x15'));var config=require(_0x0128('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0128('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x0128('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12e97d,_0x4d24c4,_0xbc843d,_0x4bad0a){return new BPromise(function(_0x4615bb,_0xdd7b60){var _0x3f6a3c=_0x4bad0a||client;return _0x3f6a3c[_0x0128('0x19')](_0x12e97d,_0xbc843d)[_0x0128('0x1a')](function(_0x43f107){logger['info'](_0x0128('0x1b'),_0x4d24c4,_0x0128('0x1c'));logger[_0x0128('0x1d')](_0x0128('0x1e'),_0x4d24c4,_0x0128('0x1c'),JSON[_0x0128('0x1f')](_0x43f107));if(_0x43f107['error']){if(_0x43f107[_0x0128('0x20')][_0x0128('0x21')]===0x1f4){logger[_0x0128('0x20')](_0x0128('0x1b'),_0x4d24c4,_0x43f107[_0x0128('0x20')][_0x0128('0x22')]);return _0xdd7b60(_0x43f107['error'][_0x0128('0x22')]);}logger[_0x0128('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4d24c4,_0x43f107['error'][_0x0128('0x22')]);return _0x4615bb(_0x43f107[_0x0128('0x20')][_0x0128('0x22')]);}else{logger[_0x0128('0x23')](_0x0128('0x1b'),_0x4d24c4,_0x0128('0x1c'));_0x4615bb(_0x43f107[_0x0128('0x24')][_0x0128('0x22')]);}})['catch'](function(_0x50f0d5){logger[_0x0128('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4d24c4,_0x50f0d5);_0xdd7b60(_0x50f0d5);});});}function respondWithStatusCode(_0x3638e3,_0x33354b){_0x33354b=_0x33354b||0xcc;return function(_0x22f70c){if(_0x22f70c){return _0x3638e3['sendStatus'](_0x33354b);}return _0x3638e3[_0x0128('0x25')](_0x33354b)['end']();};}function respondWithResult(_0x170f4b,_0x1dc125){_0x1dc125=_0x1dc125||0xc8;return function(_0x4190e2){if(_0x4190e2){return _0x170f4b[_0x0128('0x25')](_0x1dc125)[_0x0128('0x26')](_0x4190e2);}};}function respondWithFilteredResult(_0x545a05,_0x14cd68){return function(_0x3a9e26){if(_0x3a9e26){var _0x4f5090=_0x3a9e26[_0x0128('0x27')],_0x2b1819=_0x14cd68[_0x0128('0x28')],_0x976553=_0x14cd68[_0x0128('0x28')]+_0x14cd68['limit'],_0x4ee634;if(_0x976553>=_0x4f5090){_0x976553=_0x4f5090;_0x4ee634=0xc8;}else{_0x4ee634=0xce;}_0x545a05['status'](_0x4ee634);return _0x545a05[_0x0128('0x29')]('Content-Range',_0x2b1819+'-'+_0x976553+'/'+_0x4f5090)['json'](_0x3a9e26);}return null;};}function patchUpdates(_0x5f07c7){return function(_0x28b27c){try{jsonpatch['apply'](_0x28b27c,_0x5f07c7,!![]);}catch(_0x4449b9){return BPromise[_0x0128('0x2a')](_0x4449b9);}return _0x28b27c[_0x0128('0x2b')]();};}function saveUpdates(_0x41f198,_0x5a021f){return function(_0x24dad5){if(_0x24dad5){return _0x24dad5[_0x0128('0x2c')](_0x41f198)[_0x0128('0x1a')](function(_0x4772e4){return _0x4772e4;});}return null;};}function removeEntity(_0x59d8da,_0x45278e){return function(_0x40b088){if(_0x40b088){return _0x40b088[_0x0128('0x2d')]()[_0x0128('0x1a')](function(){_0x59d8da[_0x0128('0x25')](0xcc)[_0x0128('0x2e')]();});}};}function handleEntityNotFound(_0x459552,_0x599f72){return function(_0x4c2903){if(!_0x4c2903){_0x459552['sendStatus'](0x194);}return _0x4c2903;};}function handleError(_0xee41c7,_0x17bb19){_0x17bb19=_0x17bb19||0x1f4;return function(_0x2456af){logger['error'](_0x2456af[_0x0128('0x2f')]);if(_0x2456af['name']){delete _0x2456af[_0x0128('0x30')];}_0xee41c7[_0x0128('0x25')](_0x17bb19)[_0x0128('0x31')](_0x2456af);};}exports[_0x0128('0x32')]=function(_0x5ab89b,_0x5b354e){var _0x28f4dc={},_0x15742b={},_0x4204ed={'count':0x0,'rows':[]};var _0xe9d2b4=_['map'](db['ZendeskConfiguration'][_0x0128('0x33')],function(_0x313da8){return{'name':_0x313da8[_0x0128('0x34')],'type':_0x313da8[_0x0128('0x35')][_0x0128('0x36')]};});_0x15742b['model']=_[_0x0128('0x37')](_0xe9d2b4,_0x0128('0x30'));_0x15742b[_0x0128('0x38')]=_['keys'](_0x5ab89b['query']);_0x15742b[_0x0128('0x39')]=_[_0x0128('0x3a')](_0x15742b[_0x0128('0x3b')],_0x15742b[_0x0128('0x38')]);_0x28f4dc[_0x0128('0x3c')]=_['intersection'](_0x15742b[_0x0128('0x3b')],qs[_0x0128('0x3d')](_0x5ab89b['query'][_0x0128('0x3d')]));_0x28f4dc[_0x0128('0x3c')]=_0x28f4dc['attributes'][_0x0128('0x3e')]?_0x28f4dc['attributes']:_0x15742b[_0x0128('0x3b')];if(!_0x5ab89b[_0x0128('0x38')][_0x0128('0x3f')](_0x0128('0x40'))){_0x28f4dc[_0x0128('0x41')]=qs[_0x0128('0x41')](_0x5ab89b['query']['limit']);_0x28f4dc[_0x0128('0x28')]=qs['offset'](_0x5ab89b['query'][_0x0128('0x28')]);}_0x28f4dc['order']=qs[_0x0128('0x42')](_0x5ab89b[_0x0128('0x38')][_0x0128('0x42')]);_0x28f4dc[_0x0128('0x43')]=qs[_0x0128('0x39')](_[_0x0128('0x44')](_0x5ab89b[_0x0128('0x38')],_0x15742b[_0x0128('0x39')]),_0xe9d2b4);if(_0x5ab89b[_0x0128('0x38')][_0x0128('0x45')]){_0x28f4dc[_0x0128('0x43')]=_[_0x0128('0x46')](_0x28f4dc[_0x0128('0x43')],{'$or':_['map'](_0xe9d2b4,function(_0x1b5514){if(_0x1b5514[_0x0128('0x35')]!=='VIRTUAL'){var _0x21bfe8={};_0x21bfe8[_0x1b5514[_0x0128('0x30')]]={'$like':'%'+_0x5ab89b[_0x0128('0x38')][_0x0128('0x45')]+'%'};return _0x21bfe8;}})});}_0x28f4dc=_[_0x0128('0x46')]({},_0x28f4dc,_0x5ab89b['options']);var _0x361202={'where':_0x28f4dc[_0x0128('0x43')]};return db[_0x0128('0x47')][_0x0128('0x27')](_0x361202)[_0x0128('0x1a')](function(_0x3555bc){_0x4204ed[_0x0128('0x27')]=_0x3555bc;if(_0x5ab89b[_0x0128('0x38')][_0x0128('0x48')]){_0x28f4dc['include']=[{'all':!![]}];}return db[_0x0128('0x47')]['findAll'](_0x28f4dc);})[_0x0128('0x1a')](function(_0x7105f8){_0x4204ed[_0x0128('0x49')]=_0x7105f8;return _0x4204ed;})[_0x0128('0x1a')](respondWithFilteredResult(_0x5b354e,_0x28f4dc))[_0x0128('0x4a')](handleError(_0x5b354e,null));};exports[_0x0128('0x4b')]=function(_0x178f22,_0x4789b2){var _0x4be6f8={'raw':![],'where':{'id':_0x178f22[_0x0128('0x4c')]['id']}},_0x574f64={};_0x574f64[_0x0128('0x3b')]=_['keys'](db[_0x0128('0x47')][_0x0128('0x33')]);_0x574f64['query']=_[_0x0128('0x4d')](_0x178f22[_0x0128('0x38')]);_0x574f64[_0x0128('0x4e')]=_[_0x0128('0x3a')](_0x574f64['model'],_0x574f64['query']);_0x4be6f8[_0x0128('0x3c')]=_['intersection'](_0x574f64[_0x0128('0x3b')],qs['fields'](_0x178f22[_0x0128('0x38')][_0x0128('0x3d')]));_0x4be6f8[_0x0128('0x3c')]=_0x4be6f8[_0x0128('0x3c')]['length']?_0x4be6f8[_0x0128('0x3c')]:_0x574f64[_0x0128('0x3b')];if(_0x178f22[_0x0128('0x38')][_0x0128('0x48')]){_0x4be6f8[_0x0128('0x4f')]=[{'all':!![]}];}_0x4be6f8=_['merge']({},_0x4be6f8,_0x178f22[_0x0128('0x50')]);return db[_0x0128('0x47')][_0x0128('0x51')](_0x4be6f8)[_0x0128('0x1a')](handleEntityNotFound(_0x4789b2,null))[_0x0128('0x1a')](respondWithResult(_0x4789b2,null))['catch'](handleError(_0x4789b2,null));};exports['create']=function(_0x7531e,_0x59b44b){return db[_0x0128('0x47')]['create'](_0x7531e[_0x0128('0x52')],{})[_0x0128('0x1a')](respondWithResult(_0x59b44b,0xc9))['catch'](handleError(_0x59b44b,null));};exports['update']=function(_0x44a1ed,_0x13aaa3){if(_0x44a1ed[_0x0128('0x52')]['id']){delete _0x44a1ed[_0x0128('0x52')]['id'];}return db['ZendeskConfiguration'][_0x0128('0x51')]({'where':{'id':_0x44a1ed[_0x0128('0x4c')]['id']}})[_0x0128('0x1a')](handleEntityNotFound(_0x13aaa3,null))[_0x0128('0x1a')](saveUpdates(_0x44a1ed[_0x0128('0x52')],null))['then'](respondWithResult(_0x13aaa3,null))['catch'](handleError(_0x13aaa3,null));};exports[_0x0128('0x2d')]=function(_0x21a695,_0x597e9a){return db[_0x0128('0x47')][_0x0128('0x51')]({'where':{'id':_0x21a695['params']['id']}})[_0x0128('0x1a')](handleEntityNotFound(_0x597e9a,null))[_0x0128('0x1a')](removeEntity(_0x597e9a,null))[_0x0128('0x4a')](handleError(_0x597e9a,null));};exports[_0x0128('0x53')]=function(_0x3160ad,_0x15b65f,_0x1fa4df){var _0x553beb={};var _0x5531ec={};var _0x440851;var _0x363c7f;return db[_0x0128('0x47')][_0x0128('0x54')]({'where':{'id':_0x3160ad[_0x0128('0x4c')]['id']}})[_0x0128('0x1a')](handleEntityNotFound(_0x15b65f,null))[_0x0128('0x1a')](function(_0x113439){if(_0x113439){_0x440851=_0x113439;_0x5531ec[_0x0128('0x3b')]=_[_0x0128('0x4d')](db[_0x0128('0x55')]['rawAttributes']);_0x5531ec[_0x0128('0x38')]=_[_0x0128('0x4d')](_0x3160ad[_0x0128('0x38')]);_0x5531ec[_0x0128('0x39')]=_[_0x0128('0x3a')](_0x5531ec['model'],_0x5531ec['query']);_0x553beb['attributes']=_[_0x0128('0x3a')](_0x5531ec[_0x0128('0x3b')],qs[_0x0128('0x3d')](_0x3160ad[_0x0128('0x38')][_0x0128('0x3d')]));_0x553beb[_0x0128('0x3c')]=_0x553beb['attributes'][_0x0128('0x3e')]?_0x553beb[_0x0128('0x3c')]:_0x5531ec[_0x0128('0x3b')];_0x553beb['order']=qs['sort'](_0x3160ad[_0x0128('0x38')]['sort']);_0x553beb['where']=qs[_0x0128('0x39')](_['pick'](_0x3160ad['query'],_0x5531ec[_0x0128('0x39')]));if(_0x3160ad[_0x0128('0x38')][_0x0128('0x45')]){_0x553beb[_0x0128('0x43')]=_[_0x0128('0x46')](_0x553beb[_0x0128('0x43')],{'$or':_[_0x0128('0x37')](_0x553beb[_0x0128('0x3c')],function(_0x578a90){var _0x3468f7={};_0x3468f7[_0x578a90]={'$like':'%'+_0x3160ad[_0x0128('0x38')][_0x0128('0x45')]+'%'};return _0x3468f7;})});}_0x553beb=_[_0x0128('0x46')]({},_0x553beb,_0x3160ad['options']);return _0x440851[_0x0128('0x53')](_0x553beb);}})[_0x0128('0x1a')](function(_0x2cd4f1){if(_0x2cd4f1){_0x363c7f=_0x2cd4f1[_0x0128('0x3e')];if(!_0x3160ad['query'][_0x0128('0x3f')](_0x0128('0x40'))){_0x553beb[_0x0128('0x41')]=qs[_0x0128('0x41')](_0x3160ad[_0x0128('0x38')][_0x0128('0x41')]);_0x553beb[_0x0128('0x28')]=qs[_0x0128('0x28')](_0x3160ad['query'][_0x0128('0x28')]);}return _0x440851['getFields'](_0x553beb);}})['then'](function(_0x47814a){if(_0x47814a){return _0x47814a?{'count':_0x363c7f,'rows':_0x47814a}:null;}})[_0x0128('0x1a')](respondWithResult(_0x15b65f,null))[_0x0128('0x4a')](handleError(_0x15b65f,null));};exports[_0x0128('0x56')]=function(_0x3e9fa6,_0x5d77a9,_0x58ea62){var _0x4aedf0={};var _0x4bc2b6={};var _0x36743e;var _0x554fa6;return db['ZendeskConfiguration'][_0x0128('0x54')]({'where':{'id':_0x3e9fa6[_0x0128('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5d77a9,null))[_0x0128('0x1a')](function(_0x5bb236){if(_0x5bb236){_0x36743e=_0x5bb236;_0x4bc2b6['model']=_[_0x0128('0x4d')](db[_0x0128('0x55')]['rawAttributes']);_0x4bc2b6[_0x0128('0x38')]=_['keys'](_0x3e9fa6[_0x0128('0x38')]);_0x4bc2b6[_0x0128('0x39')]=_['intersection'](_0x4bc2b6[_0x0128('0x3b')],_0x4bc2b6[_0x0128('0x38')]);_0x4aedf0[_0x0128('0x3c')]=_['intersection'](_0x4bc2b6[_0x0128('0x3b')],qs[_0x0128('0x3d')](_0x3e9fa6[_0x0128('0x38')][_0x0128('0x3d')]));_0x4aedf0[_0x0128('0x3c')]=_0x4aedf0[_0x0128('0x3c')][_0x0128('0x3e')]?_0x4aedf0['attributes']:_0x4bc2b6[_0x0128('0x3b')];_0x4aedf0[_0x0128('0x57')]=qs[_0x0128('0x42')](_0x3e9fa6[_0x0128('0x38')][_0x0128('0x42')]);_0x4aedf0['where']=qs[_0x0128('0x39')](_[_0x0128('0x44')](_0x3e9fa6['query'],_0x4bc2b6[_0x0128('0x39')]));if(_0x3e9fa6['query']['filter']){_0x4aedf0[_0x0128('0x43')]=_[_0x0128('0x46')](_0x4aedf0[_0x0128('0x43')],{'$or':_['map'](_0x4aedf0[_0x0128('0x3c')],function(_0x4b9c13){var _0x1b9b54={};_0x1b9b54[_0x4b9c13]={'$like':'%'+_0x3e9fa6[_0x0128('0x38')][_0x0128('0x45')]+'%'};return _0x1b9b54;})});}_0x4aedf0=_[_0x0128('0x46')]({},_0x4aedf0,_0x3e9fa6[_0x0128('0x50')]);return _0x36743e[_0x0128('0x56')](_0x4aedf0);}})['then'](function(_0x3f8e78){if(_0x3f8e78){_0x554fa6=_0x3f8e78[_0x0128('0x3e')];if(!_0x3e9fa6[_0x0128('0x38')][_0x0128('0x3f')]('nolimit')){_0x4aedf0['limit']=qs[_0x0128('0x41')](_0x3e9fa6[_0x0128('0x38')][_0x0128('0x41')]);_0x4aedf0[_0x0128('0x28')]=qs[_0x0128('0x28')](_0x3e9fa6[_0x0128('0x38')]['offset']);}return _0x36743e[_0x0128('0x56')](_0x4aedf0);}})['then'](function(_0x615d34){if(_0x615d34){return _0x615d34?{'count':_0x554fa6,'rows':_0x615d34}:null;}})[_0x0128('0x1a')](respondWithResult(_0x5d77a9,null))[_0x0128('0x4a')](handleError(_0x5d77a9,null));};exports['getDescriptions']=function(_0x57bb3e,_0x4ec7f1,_0x58acaf){var _0x38ed8e={};var _0xa9d84f={};var _0x418f9f;var _0x3da2da;return db['ZendeskConfiguration'][_0x0128('0x54')]({'where':{'id':_0x57bb3e[_0x0128('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4ec7f1,null))[_0x0128('0x1a')](function(_0x13fdcf){if(_0x13fdcf){_0x418f9f=_0x13fdcf;_0xa9d84f[_0x0128('0x3b')]=_[_0x0128('0x4d')](db[_0x0128('0x55')][_0x0128('0x33')]);_0xa9d84f[_0x0128('0x38')]=_[_0x0128('0x4d')](_0x57bb3e[_0x0128('0x38')]);_0xa9d84f[_0x0128('0x39')]=_['intersection'](_0xa9d84f[_0x0128('0x3b')],_0xa9d84f[_0x0128('0x38')]);_0x38ed8e[_0x0128('0x3c')]=_['intersection'](_0xa9d84f[_0x0128('0x3b')],qs[_0x0128('0x3d')](_0x57bb3e[_0x0128('0x38')]['fields']));_0x38ed8e[_0x0128('0x3c')]=_0x38ed8e['attributes'][_0x0128('0x3e')]?_0x38ed8e[_0x0128('0x3c')]:_0xa9d84f[_0x0128('0x3b')];_0x38ed8e['order']=qs[_0x0128('0x42')](_0x57bb3e[_0x0128('0x38')][_0x0128('0x42')]);_0x38ed8e['where']=qs['filters'](_[_0x0128('0x44')](_0x57bb3e[_0x0128('0x38')],_0xa9d84f['filters']));if(_0x57bb3e[_0x0128('0x38')][_0x0128('0x45')]){_0x38ed8e[_0x0128('0x43')]=_[_0x0128('0x46')](_0x38ed8e[_0x0128('0x43')],{'$or':_['map'](_0x38ed8e[_0x0128('0x3c')],function(_0x54662d){var _0x2df0e7={};_0x2df0e7[_0x54662d]={'$like':'%'+_0x57bb3e[_0x0128('0x38')][_0x0128('0x45')]+'%'};return _0x2df0e7;})});}_0x38ed8e=_['merge']({},_0x38ed8e,_0x57bb3e[_0x0128('0x50')]);return _0x418f9f[_0x0128('0x58')](_0x38ed8e);}})[_0x0128('0x1a')](function(_0x16d2f1){if(_0x16d2f1){_0x3da2da=_0x16d2f1['length'];if(!_0x57bb3e['query'][_0x0128('0x3f')]('nolimit')){_0x38ed8e[_0x0128('0x41')]=qs[_0x0128('0x41')](_0x57bb3e[_0x0128('0x38')]['limit']);_0x38ed8e[_0x0128('0x28')]=qs[_0x0128('0x28')](_0x57bb3e[_0x0128('0x38')][_0x0128('0x28')]);}return _0x418f9f[_0x0128('0x58')](_0x38ed8e);}})[_0x0128('0x1a')](function(_0x60d60b){if(_0x60d60b){return _0x60d60b?{'count':_0x3da2da,'rows':_0x60d60b}:null;}})[_0x0128('0x1a')](respondWithResult(_0x4ec7f1,null))[_0x0128('0x4a')](handleError(_0x4ec7f1,null));};exports[_0x0128('0x59')]=function(_0x1c8f02,_0x3ffecb,_0x2b5500){var _0x9f42f2={};var _0x36e695={};var _0x46e041;var _0x36cb65;return db[_0x0128('0x47')][_0x0128('0x54')]({'where':{'id':_0x1c8f02['params']['id']}})[_0x0128('0x1a')](handleEntityNotFound(_0x3ffecb,null))[_0x0128('0x1a')](function(_0x52096e){if(_0x52096e){_0x46e041=_0x52096e;_0x36e695[_0x0128('0x3b')]=_['keys'](db[_0x0128('0x5a')]['rawAttributes']);_0x36e695[_0x0128('0x38')]=_[_0x0128('0x4d')](_0x1c8f02[_0x0128('0x38')]);_0x36e695[_0x0128('0x39')]=_[_0x0128('0x3a')](_0x36e695['model'],_0x36e695['query']);_0x9f42f2[_0x0128('0x3c')]=_[_0x0128('0x3a')](_0x36e695[_0x0128('0x3b')],qs[_0x0128('0x3d')](_0x1c8f02[_0x0128('0x38')][_0x0128('0x3d')]));_0x9f42f2['attributes']=_0x9f42f2[_0x0128('0x3c')]['length']?_0x9f42f2[_0x0128('0x3c')]:_0x36e695[_0x0128('0x3b')];_0x9f42f2[_0x0128('0x57')]=qs[_0x0128('0x42')](_0x1c8f02[_0x0128('0x38')][_0x0128('0x42')]);_0x9f42f2[_0x0128('0x43')]=qs[_0x0128('0x39')](_['pick'](_0x1c8f02[_0x0128('0x38')],_0x36e695[_0x0128('0x39')]));if(_0x1c8f02[_0x0128('0x38')][_0x0128('0x45')]){_0x9f42f2[_0x0128('0x43')]=_[_0x0128('0x46')](_0x9f42f2[_0x0128('0x43')],{'$or':_[_0x0128('0x37')](_0x9f42f2[_0x0128('0x3c')],function(_0x10a7cd){var _0x4217ee={};_0x4217ee[_0x10a7cd]={'$like':'%'+_0x1c8f02[_0x0128('0x38')][_0x0128('0x45')]+'%'};return _0x4217ee;})});}_0x9f42f2=_[_0x0128('0x46')]({},_0x9f42f2,_0x1c8f02[_0x0128('0x50')]);return _0x46e041['getTags'](_0x9f42f2);}})[_0x0128('0x1a')](function(_0x5e14df){if(_0x5e14df){_0x36cb65=_0x5e14df['length'];if(!_0x1c8f02[_0x0128('0x38')][_0x0128('0x3f')](_0x0128('0x40'))){_0x9f42f2['limit']=qs[_0x0128('0x41')](_0x1c8f02[_0x0128('0x38')][_0x0128('0x41')]);_0x9f42f2[_0x0128('0x28')]=qs[_0x0128('0x28')](_0x1c8f02[_0x0128('0x38')][_0x0128('0x28')]);}return _0x46e041[_0x0128('0x59')](_0x9f42f2);}})['then'](function(_0x1d5861){if(_0x1d5861){return _0x1d5861?{'count':_0x36cb65,'rows':_0x1d5861}:null;}})[_0x0128('0x1a')](respondWithResult(_0x3ffecb,null))['catch'](handleError(_0x3ffecb,null));};exports['setTags']=function(_0x3079f9,_0x701c15,_0x57b6c8){if(_0x3079f9[_0x0128('0x52')]['id']){delete _0x3079f9[_0x0128('0x52')]['id'];}return db[_0x0128('0x47')]['findOne']({'where':{'id':_0x3079f9[_0x0128('0x4c')]['id']}})[_0x0128('0x1a')](handleEntityNotFound(_0x701c15,null))[_0x0128('0x1a')](function(_0x20039c){if(_0x20039c){return _0x20039c[_0x0128('0x5b')](_0x3079f9['body'][_0x0128('0x5c')]||[]);}return null;})[_0x0128('0x1a')](respondWithResult(_0x701c15,null))[_0x0128('0x4a')](handleError(_0x701c15,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 36b388d..96c0e46 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 _0xf23f=['exports','define','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskConfiguration.attributes'];(function(_0x1fd379,_0x2a4771){var _0x5978d2=function(_0x442011){while(--_0x442011){_0x1fd379['push'](_0x1fd379['shift']());}};_0x5978d2(++_0x2a4771);}(_0xf23f,0x12e));var _0xff23=function(_0x2dd970,_0x316ea1){_0x2dd970=_0x2dd970-0x0;var _0x109177=_0xf23f[_0x2dd970];return _0x109177;};'use strict';var _=require(_0xff23('0x0'));var util=require(_0xff23('0x1'));var logger=require(_0xff23('0x2'))(_0xff23('0x3'));var moment=require(_0xff23('0x4'));var BPromise=require(_0xff23('0x5'));var rp=require(_0xff23('0x6'));var fs=require('fs');var path=require(_0xff23('0x7'));var rimraf=require(_0xff23('0x8'));var config=require('../../config/environment');var attributes=require(_0xff23('0x9'));module[_0xff23('0xa')]=function(_0x315c35,_0x34e9b5){return _0x315c35[_0xff23('0xb')]('ZendeskConfiguration',attributes,{'tableName':_0xff23('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1182=['ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x127bb3,_0x276879){var _0x46d46e=function(_0x4a7dba){while(--_0x4a7dba){_0x127bb3['push'](_0x127bb3['shift']());}};_0x46d46e(++_0x276879);}(_0x1182,0xaa));var _0x2118=function(_0x3beea0,_0x416691){_0x3beea0=_0x3beea0-0x0;var _0x314eb1=_0x1182[_0x3beea0];return _0x314eb1;};'use strict';var _=require(_0x2118('0x0'));var util=require(_0x2118('0x1'));var logger=require(_0x2118('0x2'))(_0x2118('0x3'));var moment=require(_0x2118('0x4'));var BPromise=require(_0x2118('0x5'));var rp=require(_0x2118('0x6'));var fs=require('fs');var path=require(_0x2118('0x7'));var rimraf=require(_0x2118('0x8'));var config=require(_0x2118('0x9'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x2118('0xa')]=function(_0x27c737,_0x3d5852){return _0x27c737[_0x2118('0xb')](_0x2118('0xc'),attributes,{'tableName':_0x2118('0xd'),'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 06d14da..d70be91 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 _0x51f1=['error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5ca644,_0x3d2165){var _0x5c87a2=function(_0x3dc7d9){while(--_0x3dc7d9){_0x5ca644['push'](_0x5ca644['shift']());}};_0x5c87a2(++_0x3d2165);}(_0x51f1,0x1ba));var _0x151f=function(_0x3aac69,_0x81d09f){_0x3aac69=_0x3aac69-0x0;var _0x38d35b=_0x51f1[_0x3aac69];return _0x38d35b;};'use strict';var _=require(_0x151f('0x0'));var util=require(_0x151f('0x1'));var moment=require(_0x151f('0x2'));var BPromise=require(_0x151f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x151f('0x4'))['db'];var utils=require(_0x151f('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x151f('0x6')][_0x151f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x17e23d,_0x430902,_0x5d5300){return new BPromise(function(_0xa3ee70,_0x2a9ade){return client['request'](_0x17e23d,_0x5d5300)[_0x151f('0x8')](function(_0x591ee4){logger[_0x151f('0x9')](_0x151f('0xa'),_0x430902,'request\x20sent');logger[_0x151f('0xb')](_0x151f('0xc'),_0x430902,_0x151f('0xd'),JSON['stringify'](_0x591ee4));if(_0x591ee4[_0x151f('0xe')]){if(_0x591ee4['error'][_0x151f('0xf')]===0x1f4){logger[_0x151f('0xe')](_0x151f('0xa'),_0x430902,_0x591ee4[_0x151f('0xe')][_0x151f('0x10')]);return _0x2a9ade(_0x591ee4[_0x151f('0xe')]['message']);}logger['error'](_0x151f('0xa'),_0x430902,_0x591ee4[_0x151f('0xe')][_0x151f('0x10')]);return _0xa3ee70(_0x591ee4[_0x151f('0xe')]['message']);}else{logger[_0x151f('0x9')]('ZendeskConfiguration,\x20%s,\x20%s',_0x430902,_0x151f('0xd'));_0xa3ee70(_0x591ee4[_0x151f('0x11')]['message']);}})[_0x151f('0x12')](function(_0x13a52d){logger[_0x151f('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x430902,_0x13a52d);_0x2a9ade(_0x13a52d);});});} \ No newline at end of file +var _0x142d=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x580ef3,_0x471646){var _0x46a603=function(_0x39e7e1){while(--_0x39e7e1){_0x580ef3['push'](_0x580ef3['shift']());}};_0x46a603(++_0x471646);}(_0x142d,0x140));var _0xd142=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x142d[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0xd142('0x0'));var util=require(_0xd142('0x1'));var moment=require('moment');var BPromise=require(_0xd142('0x2'));var rs=require(_0xd142('0x3'));var fs=require('fs');var Redis=require(_0xd142('0x4'));var db=require(_0xd142('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd142('0x6'));var config=require(_0xd142('0x7'));var jayson=require(_0xd142('0x8'));var client=jayson[_0xd142('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa9cd2,_0xa909c8,_0x2c7024){return new BPromise(function(_0x4b04e4,_0x4106bb){return client['request'](_0xa9cd2,_0x2c7024)[_0xd142('0xa')](function(_0x4318d8){logger['info'](_0xd142('0xb'),_0xa909c8,_0xd142('0xc'));logger[_0xd142('0xd')](_0xd142('0xe'),_0xa909c8,_0xd142('0xc'),JSON[_0xd142('0xf')](_0x4318d8));if(_0x4318d8['error']){if(_0x4318d8[_0xd142('0x10')][_0xd142('0x11')]===0x1f4){logger[_0xd142('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0xa909c8,_0x4318d8[_0xd142('0x10')][_0xd142('0x12')]);return _0x4106bb(_0x4318d8['error'][_0xd142('0x12')]);}logger[_0xd142('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0xa909c8,_0x4318d8[_0xd142('0x10')][_0xd142('0x12')]);return _0x4b04e4(_0x4318d8[_0xd142('0x10')][_0xd142('0x12')]);}else{logger['info'](_0xd142('0xb'),_0xa909c8,'request\x20sent');_0x4b04e4(_0x4318d8[_0xd142('0x13')][_0xd142('0x12')]);}})['catch'](function(_0x5bc7a9){logger[_0xd142('0x10')](_0xd142('0xb'),_0xa909c8,_0x5bc7a9);_0x4106bb(_0x5bc7a9);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index a991105..81ade61 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 _0x742e=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports'];(function(_0x3c0480,_0x5d0dcd){var _0x3818ff=function(_0x1f776f){while(--_0x1f776f){_0x3c0480['push'](_0x3c0480['shift']());}};_0x3818ff(++_0x5d0dcd);}(_0x742e,0xa2));var _0xe742=function(_0x14d850,_0x4c2804){_0x14d850=_0x14d850-0x0;var _0x57572b=_0x742e[_0x14d850];return _0x57572b;};'use strict';var multer=require(_0xe742('0x0'));var util=require(_0xe742('0x1'));var path=require('path');var timeout=require(_0xe742('0x2'));var express=require(_0xe742('0x3'));var router=express[_0xe742('0x4')]();var auth=require(_0xe742('0x5'));var interaction=require(_0xe742('0x6'));var config=require(_0xe742('0x7'));var controller=require(_0xe742('0x8'));router['get']('/',auth[_0xe742('0x9')](),controller[_0xe742('0xa')]);router['get'](_0xe742('0xb'),auth[_0xe742('0x9')](),controller[_0xe742('0xc')]);router[_0xe742('0xd')]('/',auth[_0xe742('0x9')](),controller[_0xe742('0xe')]);router['put']('/:id',auth[_0xe742('0x9')](),controller['update']);router[_0xe742('0xf')](_0xe742('0xb'),auth['isAuthenticated'](),controller[_0xe742('0x10')]);module[_0xe742('0x11')]=router; \ No newline at end of file +var _0xd41f=['put','update','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id','show','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd41f,0xf1));var _0xfd41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd41f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xfd41('0x0'));var path=require(_0xfd41('0x1'));var timeout=require('connect-timeout');var express=require(_0xfd41('0x2'));var router=express[_0xfd41('0x3')]();var auth=require(_0xfd41('0x4'));var interaction=require(_0xfd41('0x5'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router['get']('/',auth[_0xfd41('0x6')](),controller['index']);router[_0xfd41('0x7')](_0xfd41('0x8'),auth[_0xfd41('0x6')](),controller[_0xfd41('0x9')]);router['post']('/',auth[_0xfd41('0x6')](),controller[_0xfd41('0xa')]);router[_0xfd41('0xb')]('/:id',auth[_0xfd41('0x6')](),controller[_0xfd41('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xfd41('0xd')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 3a77b61..b8612fd 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 _0x590c=['sequelize','string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN'];(function(_0x383fac,_0xeda6b6){var _0x38d3b6=function(_0x481966){while(--_0x481966){_0x383fac['push'](_0x383fac['shift']());}};_0x38d3b6(++_0xeda6b6);}(_0x590c,0x80));var _0xc590=function(_0x441ff7,_0x3f8a12){_0x441ff7=_0x441ff7-0x0;var _0x12eff2=_0x590c[_0x441ff7];return _0x12eff2;};'use strict';var Sequelize=require(_0xc590('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xc590('0x1'),_0xc590('0x2'),_0xc590('0x3'),_0xc590('0x4')),'defaultValue':_0xc590('0x1')},'content':{'type':Sequelize[_0xc590('0x5')]},'key':{'type':Sequelize[_0xc590('0x5')]},'keyType':{'type':Sequelize[_0xc590('0x6')](_0xc590('0x1'),_0xc590('0x2'),_0xc590('0x3'))},'keyContent':{'type':Sequelize[_0xc590('0x5')]},'idField':{'type':Sequelize[_0xc590('0x5')]},'nameField':{'type':Sequelize[_0xc590('0x5')]},'customField':{'type':Sequelize[_0xc590('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9c48=['BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0xeed797,_0x2f2e1b){var _0x530555=function(_0x565989){while(--_0x565989){_0xeed797['push'](_0xeed797['shift']());}};_0x530555(++_0x2f2e1b);}(_0x9c48,0xb1));var _0x89c4=function(_0x52436d,_0x524535){_0x52436d=_0x52436d-0x0;var _0x198162=_0x9c48[_0x52436d];return _0x198162;};'use strict';var Sequelize=require(_0x89c4('0x0'));module['exports']={'type':{'type':Sequelize[_0x89c4('0x1')](_0x89c4('0x2'),_0x89c4('0x3'),_0x89c4('0x4'),_0x89c4('0x5')),'defaultValue':_0x89c4('0x2')},'content':{'type':Sequelize[_0x89c4('0x6')]},'key':{'type':Sequelize[_0x89c4('0x6')]},'keyType':{'type':Sequelize[_0x89c4('0x1')](_0x89c4('0x2'),_0x89c4('0x3'),_0x89c4('0x4'))},'keyContent':{'type':Sequelize[_0x89c4('0x6')]},'idField':{'type':Sequelize[_0x89c4('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x89c4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x89c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index a7436c4..0332c30 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 _0x3178=['count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','index','map','ZendeskField','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','merge','find','create','body','update','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','lodash','squel','desk.js','to-csv','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'];(function(_0x593d1d,_0x4e1320){var _0x4e2e04=function(_0x120ddc){while(--_0x120ddc){_0x593d1d['push'](_0x593d1d['shift']());}};_0x4e2e04(++_0x4e1320);}(_0x3178,0x70));var _0x8317=function(_0x1191ca,_0x33d91e){_0x1191ca=_0x1191ca-0x0;var _0x56216a=_0x3178[_0x1191ca];return _0x56216a;};'use strict';var pdf=require(_0x8317('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8317('0x1'));var jsonpatch=require(_0x8317('0x2'));var rp=require(_0x8317('0x3'));var moment=require(_0x8317('0x4'));var BPromise=require(_0x8317('0x5'));var Mustache=require(_0x8317('0x6'));var util=require('util');var path=require(_0x8317('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8317('0x8'));var squel=require(_0x8317('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8317('0xa'));var toCsv=require(_0x8317('0xb'));var querystring=require('querystring');var Papa=require(_0x8317('0xc'));var Redis=require(_0x8317('0xd'));var authService=require(_0x8317('0xe'));var qs=require(_0x8317('0xf'));var as=require(_0x8317('0x10'));var hardwareService=require(_0x8317('0x11'));var logger=require(_0x8317('0x12'))('api');var utils=require(_0x8317('0x13'));var config=require(_0x8317('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8317('0x15'))['db'];function respondWithStatusCode(_0x3a8e6f,_0x553563){_0x553563=_0x553563||0xcc;return function(_0x6da738){if(_0x6da738){return _0x3a8e6f[_0x8317('0x16')](_0x553563);}return _0x3a8e6f[_0x8317('0x17')](_0x553563)[_0x8317('0x18')]();};}function respondWithResult(_0x4c407f,_0x502935){_0x502935=_0x502935||0xc8;return function(_0xad85cc){if(_0xad85cc){return _0x4c407f[_0x8317('0x17')](_0x502935)[_0x8317('0x19')](_0xad85cc);}};}function respondWithFilteredResult(_0x2824a4,_0x379952){return function(_0x2fa505){if(_0x2fa505){var _0x25db81=_0x2fa505[_0x8317('0x1a')],_0x10e8be=_0x379952[_0x8317('0x1b')],_0x4903f6=_0x379952['offset']+_0x379952[_0x8317('0x1c')],_0x304bf1;if(_0x4903f6>=_0x25db81){_0x4903f6=_0x25db81;_0x304bf1=0xc8;}else{_0x304bf1=0xce;}_0x2824a4[_0x8317('0x17')](_0x304bf1);return _0x2824a4['set'](_0x8317('0x1d'),_0x10e8be+'-'+_0x4903f6+'/'+_0x25db81)['json'](_0x2fa505);}return null;};}function patchUpdates(_0x20ebc8){return function(_0x458121){try{jsonpatch[_0x8317('0x1e')](_0x458121,_0x20ebc8,!![]);}catch(_0x4459de){return BPromise[_0x8317('0x1f')](_0x4459de);}return _0x458121[_0x8317('0x20')]();};}function saveUpdates(_0x1a5bcb,_0x290a13){return function(_0x28f4bf){if(_0x28f4bf){return _0x28f4bf['update'](_0x1a5bcb)[_0x8317('0x21')](function(_0x7b2717){return _0x7b2717;});}return null;};}function removeEntity(_0x2773c6,_0x5e6859){return function(_0x54b26c){if(_0x54b26c){return _0x54b26c[_0x8317('0x22')]()[_0x8317('0x21')](function(){_0x2773c6[_0x8317('0x17')](0xcc)[_0x8317('0x18')]();});}};}function handleEntityNotFound(_0x35952d,_0x235d14){return function(_0x3f4f18){if(!_0x3f4f18){_0x35952d['sendStatus'](0x194);}return _0x3f4f18;};}function handleError(_0x1122ec,_0x128ee3){_0x128ee3=_0x128ee3||0x1f4;return function(_0x351d81){logger[_0x8317('0x23')](_0x351d81[_0x8317('0x24')]);if(_0x351d81['name']){delete _0x351d81['name'];}_0x1122ec[_0x8317('0x17')](_0x128ee3)['send'](_0x351d81);};}exports[_0x8317('0x25')]=function(_0x5298f7,_0x313ec1){var _0x3ad44a={},_0x36cb81={},_0x9998ec={'count':0x0,'rows':[]};var _0x58d3df=_[_0x8317('0x26')](db[_0x8317('0x27')][_0x8317('0x28')],function(_0x61fd8b){return{'name':_0x61fd8b['fieldName'],'type':_0x61fd8b[_0x8317('0x29')][_0x8317('0x2a')]};});_0x36cb81[_0x8317('0x2b')]=_[_0x8317('0x26')](_0x58d3df,_0x8317('0x2c'));_0x36cb81[_0x8317('0x2d')]=_[_0x8317('0x2e')](_0x5298f7[_0x8317('0x2d')]);_0x36cb81[_0x8317('0x2f')]=_[_0x8317('0x30')](_0x36cb81[_0x8317('0x2b')],_0x36cb81[_0x8317('0x2d')]);_0x3ad44a[_0x8317('0x31')]=_[_0x8317('0x30')](_0x36cb81[_0x8317('0x2b')],qs[_0x8317('0x32')](_0x5298f7[_0x8317('0x2d')][_0x8317('0x32')]));_0x3ad44a['attributes']=_0x3ad44a['attributes'][_0x8317('0x33')]?_0x3ad44a[_0x8317('0x31')]:_0x36cb81[_0x8317('0x2b')];if(!_0x5298f7['query']['hasOwnProperty']('nolimit')){_0x3ad44a[_0x8317('0x1c')]=qs[_0x8317('0x1c')](_0x5298f7['query'][_0x8317('0x1c')]);_0x3ad44a[_0x8317('0x1b')]=qs[_0x8317('0x1b')](_0x5298f7[_0x8317('0x2d')][_0x8317('0x1b')]);}_0x3ad44a[_0x8317('0x34')]=qs['sort'](_0x5298f7[_0x8317('0x2d')][_0x8317('0x35')]);_0x3ad44a[_0x8317('0x36')]=qs[_0x8317('0x2f')](_['pick'](_0x5298f7[_0x8317('0x2d')],_0x36cb81[_0x8317('0x2f')]),_0x58d3df);if(_0x5298f7[_0x8317('0x2d')][_0x8317('0x37')]){_0x3ad44a[_0x8317('0x36')]=_['merge'](_0x3ad44a['where'],{'$or':_['map'](_0x58d3df,function(_0x56173c){if(_0x56173c['type']!==_0x8317('0x38')){var _0x2dbde1={};_0x2dbde1[_0x56173c[_0x8317('0x2c')]]={'$like':'%'+_0x5298f7[_0x8317('0x2d')][_0x8317('0x37')]+'%'};return _0x2dbde1;}})});}_0x3ad44a=_['merge']({},_0x3ad44a,_0x5298f7[_0x8317('0x39')]);var _0x2d47dd={'where':_0x3ad44a[_0x8317('0x36')]};return db[_0x8317('0x27')][_0x8317('0x1a')](_0x2d47dd)[_0x8317('0x21')](function(_0x36d031){_0x9998ec[_0x8317('0x1a')]=_0x36d031;if(_0x5298f7['query'][_0x8317('0x3a')]){_0x3ad44a['include']=[{'all':!![]}];}return db['ZendeskField'][_0x8317('0x3b')](_0x3ad44a);})[_0x8317('0x21')](function(_0xb575e2){_0x9998ec[_0x8317('0x3c')]=_0xb575e2;return _0x9998ec;})[_0x8317('0x21')](respondWithFilteredResult(_0x313ec1,_0x3ad44a))[_0x8317('0x3d')](handleError(_0x313ec1,null));};exports['show']=function(_0x5753f3,_0x4af573){var _0x3d5311={'raw':!![],'where':{'id':_0x5753f3[_0x8317('0x3e')]['id']}},_0x32535d={};_0x32535d[_0x8317('0x2b')]=_['keys'](db[_0x8317('0x27')]['rawAttributes']);_0x32535d[_0x8317('0x2d')]=_[_0x8317('0x2e')](_0x5753f3[_0x8317('0x2d')]);_0x32535d['filtears']=_[_0x8317('0x30')](_0x32535d[_0x8317('0x2b')],_0x32535d[_0x8317('0x2d')]);_0x3d5311[_0x8317('0x31')]=_['intersection'](_0x32535d[_0x8317('0x2b')],qs[_0x8317('0x32')](_0x5753f3[_0x8317('0x2d')][_0x8317('0x32')]));_0x3d5311['attributes']=_0x3d5311[_0x8317('0x31')]['length']?_0x3d5311[_0x8317('0x31')]:_0x32535d['model'];if(_0x5753f3['query'][_0x8317('0x3a')]){_0x3d5311[_0x8317('0x3f')]=[{'all':!![]}];}_0x3d5311=_[_0x8317('0x40')]({},_0x3d5311,_0x5753f3[_0x8317('0x39')]);return db[_0x8317('0x27')][_0x8317('0x41')](_0x3d5311)['then'](handleEntityNotFound(_0x4af573,null))[_0x8317('0x21')](respondWithResult(_0x4af573,null))[_0x8317('0x3d')](handleError(_0x4af573,null));};exports[_0x8317('0x42')]=function(_0x217bf5,_0x1b10d1){return db[_0x8317('0x27')][_0x8317('0x42')](_0x217bf5[_0x8317('0x43')],{})['then'](respondWithResult(_0x1b10d1,0xc9))[_0x8317('0x3d')](handleError(_0x1b10d1,null));};exports[_0x8317('0x44')]=function(_0x26f78c,_0x20be2c){if(_0x26f78c[_0x8317('0x43')]['id']){delete _0x26f78c[_0x8317('0x43')]['id'];}return db[_0x8317('0x27')][_0x8317('0x41')]({'where':{'id':_0x26f78c[_0x8317('0x3e')]['id']}})['then'](handleEntityNotFound(_0x20be2c,null))[_0x8317('0x21')](saveUpdates(_0x26f78c['body'],null))[_0x8317('0x21')](respondWithResult(_0x20be2c,null))[_0x8317('0x3d')](handleError(_0x20be2c,null));};exports[_0x8317('0x22')]=function(_0x3dbd12,_0x234053){return db[_0x8317('0x27')][_0x8317('0x41')]({'where':{'id':_0x3dbd12[_0x8317('0x3e')]['id']}})[_0x8317('0x21')](handleEntityNotFound(_0x234053,null))[_0x8317('0x21')](removeEntity(_0x234053,null))['catch'](handleError(_0x234053,null));}; \ No newline at end of file +var _0x7326=['create','body','find','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','name','send','map','ZendeskField','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','include','findAll','catch','show','params','options'];(function(_0x388914,_0x3c63f9){var _0x1f9111=function(_0x23dd69){while(--_0x23dd69){_0x388914['push'](_0x388914['shift']());}};_0x1f9111(++_0x3c63f9);}(_0x7326,0xd2));var _0x6732=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x7326[_0x30ae5e];return _0x1f2e93;};'use strict';var pdf=require(_0x6732('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6732('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6732('0x2'));var moment=require(_0x6732('0x3'));var BPromise=require(_0x6732('0x4'));var Mustache=require(_0x6732('0x5'));var util=require(_0x6732('0x6'));var path=require(_0x6732('0x7'));var sox=require(_0x6732('0x8'));var csv=require(_0x6732('0x9'));var ejs=require(_0x6732('0xa'));var fs=require('fs');var _=require(_0x6732('0xb'));var squel=require('squel');var crypto=require(_0x6732('0xc'));var jsforce=require(_0x6732('0xd'));var deskjs=require(_0x6732('0xe'));var toCsv=require(_0x6732('0x9'));var querystring=require('querystring');var Papa=require(_0x6732('0xf'));var Redis=require('ioredis');var authService=require(_0x6732('0x10'));var qs=require(_0x6732('0x11'));var as=require(_0x6732('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6732('0x13'))('api');var utils=require(_0x6732('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6732('0x15'));var db=require(_0x6732('0x16'))['db'];function respondWithStatusCode(_0x3ee0fd,_0x7d1c78){_0x7d1c78=_0x7d1c78||0xcc;return function(_0x330750){if(_0x330750){return _0x3ee0fd[_0x6732('0x17')](_0x7d1c78);}return _0x3ee0fd[_0x6732('0x18')](_0x7d1c78)[_0x6732('0x19')]();};}function respondWithResult(_0x4349ec,_0x430e21){_0x430e21=_0x430e21||0xc8;return function(_0x35a4eb){if(_0x35a4eb){return _0x4349ec[_0x6732('0x18')](_0x430e21)[_0x6732('0x1a')](_0x35a4eb);}};}function respondWithFilteredResult(_0xe318da,_0x300c7b){return function(_0x4cb93a){if(_0x4cb93a){var _0x148a81=_0x4cb93a[_0x6732('0x1b')],_0x387c2f=_0x300c7b[_0x6732('0x1c')],_0x5ca047=_0x300c7b[_0x6732('0x1c')]+_0x300c7b[_0x6732('0x1d')],_0x27c108;if(_0x5ca047>=_0x148a81){_0x5ca047=_0x148a81;_0x27c108=0xc8;}else{_0x27c108=0xce;}_0xe318da[_0x6732('0x18')](_0x27c108);return _0xe318da[_0x6732('0x1e')](_0x6732('0x1f'),_0x387c2f+'-'+_0x5ca047+'/'+_0x148a81)[_0x6732('0x1a')](_0x4cb93a);}return null;};}function patchUpdates(_0x4238c6){return function(_0x43d354){try{jsonpatch[_0x6732('0x20')](_0x43d354,_0x4238c6,!![]);}catch(_0x27da22){return BPromise[_0x6732('0x21')](_0x27da22);}return _0x43d354['save']();};}function saveUpdates(_0x576985,_0x44a8cd){return function(_0x5d8a2d){if(_0x5d8a2d){return _0x5d8a2d[_0x6732('0x22')](_0x576985)['then'](function(_0x373c67){return _0x373c67;});}return null;};}function removeEntity(_0x3f473d,_0x5a0663){return function(_0x2feb94){if(_0x2feb94){return _0x2feb94[_0x6732('0x23')]()[_0x6732('0x24')](function(){_0x3f473d[_0x6732('0x18')](0xcc)[_0x6732('0x19')]();});}};}function handleEntityNotFound(_0xe0cbc9,_0x49ccff){return function(_0x329a86){if(!_0x329a86){_0xe0cbc9[_0x6732('0x17')](0x194);}return _0x329a86;};}function handleError(_0x40dc34,_0x3bbcf7){_0x3bbcf7=_0x3bbcf7||0x1f4;return function(_0x15d192){logger['error'](_0x15d192['stack']);if(_0x15d192['name']){delete _0x15d192[_0x6732('0x25')];}_0x40dc34[_0x6732('0x18')](_0x3bbcf7)[_0x6732('0x26')](_0x15d192);};}exports['index']=function(_0xed60b1,_0x3bb5dc){var _0x3423e2={},_0x296863={},_0x23f0dc={'count':0x0,'rows':[]};var _0x283a8a=_[_0x6732('0x27')](db[_0x6732('0x28')][_0x6732('0x29')],function(_0x1a48b9){return{'name':_0x1a48b9[_0x6732('0x2a')],'type':_0x1a48b9[_0x6732('0x2b')][_0x6732('0x2c')]};});_0x296863['model']=_[_0x6732('0x27')](_0x283a8a,_0x6732('0x25'));_0x296863[_0x6732('0x2d')]=_[_0x6732('0x2e')](_0xed60b1[_0x6732('0x2d')]);_0x296863[_0x6732('0x2f')]=_['intersection'](_0x296863[_0x6732('0x30')],_0x296863[_0x6732('0x2d')]);_0x3423e2[_0x6732('0x31')]=_[_0x6732('0x32')](_0x296863[_0x6732('0x30')],qs[_0x6732('0x33')](_0xed60b1['query']['fields']));_0x3423e2[_0x6732('0x31')]=_0x3423e2['attributes'][_0x6732('0x34')]?_0x3423e2[_0x6732('0x31')]:_0x296863[_0x6732('0x30')];if(!_0xed60b1[_0x6732('0x2d')][_0x6732('0x35')](_0x6732('0x36'))){_0x3423e2[_0x6732('0x1d')]=qs[_0x6732('0x1d')](_0xed60b1['query'][_0x6732('0x1d')]);_0x3423e2[_0x6732('0x1c')]=qs[_0x6732('0x1c')](_0xed60b1[_0x6732('0x2d')]['offset']);}_0x3423e2[_0x6732('0x37')]=qs['sort'](_0xed60b1['query'][_0x6732('0x38')]);_0x3423e2['where']=qs[_0x6732('0x2f')](_['pick'](_0xed60b1[_0x6732('0x2d')],_0x296863[_0x6732('0x2f')]),_0x283a8a);if(_0xed60b1[_0x6732('0x2d')][_0x6732('0x39')]){_0x3423e2[_0x6732('0x3a')]=_['merge'](_0x3423e2[_0x6732('0x3a')],{'$or':_['map'](_0x283a8a,function(_0x58ce11){if(_0x58ce11[_0x6732('0x2b')]!=='VIRTUAL'){var _0x4b0f03={};_0x4b0f03[_0x58ce11[_0x6732('0x25')]]={'$like':'%'+_0xed60b1[_0x6732('0x2d')][_0x6732('0x39')]+'%'};return _0x4b0f03;}})});}_0x3423e2=_[_0x6732('0x3b')]({},_0x3423e2,_0xed60b1['options']);var _0x5a1e7e={'where':_0x3423e2['where']};return db[_0x6732('0x28')]['count'](_0x5a1e7e)[_0x6732('0x24')](function(_0x40927f){_0x23f0dc[_0x6732('0x1b')]=_0x40927f;if(_0xed60b1[_0x6732('0x2d')]['includeAll']){_0x3423e2[_0x6732('0x3c')]=[{'all':!![]}];}return db[_0x6732('0x28')][_0x6732('0x3d')](_0x3423e2);})[_0x6732('0x24')](function(_0x41be66){_0x23f0dc['rows']=_0x41be66;return _0x23f0dc;})['then'](respondWithFilteredResult(_0x3bb5dc,_0x3423e2))[_0x6732('0x3e')](handleError(_0x3bb5dc,null));};exports[_0x6732('0x3f')]=function(_0x12ceaa,_0x4aedcd){var _0x27bade={'raw':!![],'where':{'id':_0x12ceaa[_0x6732('0x40')]['id']}},_0x2e10de={};_0x2e10de[_0x6732('0x30')]=_[_0x6732('0x2e')](db[_0x6732('0x28')][_0x6732('0x29')]);_0x2e10de[_0x6732('0x2d')]=_['keys'](_0x12ceaa[_0x6732('0x2d')]);_0x2e10de['filtears']=_['intersection'](_0x2e10de['model'],_0x2e10de[_0x6732('0x2d')]);_0x27bade[_0x6732('0x31')]=_[_0x6732('0x32')](_0x2e10de['model'],qs[_0x6732('0x33')](_0x12ceaa['query'][_0x6732('0x33')]));_0x27bade[_0x6732('0x31')]=_0x27bade['attributes'][_0x6732('0x34')]?_0x27bade['attributes']:_0x2e10de[_0x6732('0x30')];if(_0x12ceaa[_0x6732('0x2d')]['includeAll']){_0x27bade[_0x6732('0x3c')]=[{'all':!![]}];}_0x27bade=_[_0x6732('0x3b')]({},_0x27bade,_0x12ceaa[_0x6732('0x41')]);return db[_0x6732('0x28')]['find'](_0x27bade)[_0x6732('0x24')](handleEntityNotFound(_0x4aedcd,null))[_0x6732('0x24')](respondWithResult(_0x4aedcd,null))[_0x6732('0x3e')](handleError(_0x4aedcd,null));};exports[_0x6732('0x42')]=function(_0xc86b01,_0xa215a3){return db[_0x6732('0x28')]['create'](_0xc86b01[_0x6732('0x43')],{})[_0x6732('0x24')](respondWithResult(_0xa215a3,0xc9))[_0x6732('0x3e')](handleError(_0xa215a3,null));};exports[_0x6732('0x22')]=function(_0x12ebcc,_0x3d9df4){if(_0x12ebcc[_0x6732('0x43')]['id']){delete _0x12ebcc[_0x6732('0x43')]['id'];}return db[_0x6732('0x28')][_0x6732('0x44')]({'where':{'id':_0x12ebcc[_0x6732('0x40')]['id']}})[_0x6732('0x24')](handleEntityNotFound(_0x3d9df4,null))[_0x6732('0x24')](saveUpdates(_0x12ebcc['body'],null))[_0x6732('0x24')](respondWithResult(_0x3d9df4,null))['catch'](handleError(_0x3d9df4,null));};exports['destroy']=function(_0x5cbb4d,_0x785d41){return db[_0x6732('0x28')][_0x6732('0x44')]({'where':{'id':_0x5cbb4d[_0x6732('0x40')]['id']}})[_0x6732('0x24')](handleEntityNotFound(_0x785d41,null))[_0x6732('0x24')](removeEntity(_0x785d41,null))[_0x6732('0x3e')](handleError(_0x785d41,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 46de3fd..2dceff2 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 _0x2cae=['zendesk_unique_index','idField','FieldId','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./intZendeskField.attributes','ZendeskField'];(function(_0x80ab9e,_0x32c636){var _0x7605e6=function(_0x207f0d){while(--_0x207f0d){_0x80ab9e['push'](_0x80ab9e['shift']());}};_0x7605e6(++_0x32c636);}(_0x2cae,0x16b));var _0xe2ca=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0x2cae[_0x470bfb];return _0x2f5d97;};'use strict';var _=require(_0xe2ca('0x0'));var util=require(_0xe2ca('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe2ca('0x2'));var BPromise=require(_0xe2ca('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe2ca('0x4'));var rimraf=require(_0xe2ca('0x5'));var config=require(_0xe2ca('0x6'));var attributes=require(_0xe2ca('0x7'));module['exports']=function(_0x2b4c70,_0x3cabde){return _0x2b4c70['define'](_0xe2ca('0x8'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xe2ca('0x9'),'fields':[_0xe2ca('0xa'),_0xe2ca('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d37=['ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports'];(function(_0xd5a9cb,_0xf33a0f){var _0x1de93a=function(_0x4b32bd){while(--_0x4b32bd){_0xd5a9cb['push'](_0xd5a9cb['shift']());}};_0x1de93a(++_0xf33a0f);}(_0x8d37,0x1d5));var _0x78d3=function(_0x471668,_0x26c911){_0x471668=_0x471668-0x0;var _0x313309=_0x8d37[_0x471668];return _0x313309;};'use strict';var _=require(_0x78d3('0x0'));var util=require(_0x78d3('0x1'));var logger=require(_0x78d3('0x2'))(_0x78d3('0x3'));var moment=require(_0x78d3('0x4'));var BPromise=require('bluebird');var rp=require(_0x78d3('0x5'));var fs=require('fs');var path=require(_0x78d3('0x6'));var rimraf=require(_0x78d3('0x7'));var config=require(_0x78d3('0x8'));var attributes=require(_0x78d3('0x9'));module[_0x78d3('0xa')]=function(_0xe9d481,_0x24f7b9){return _0xe9d481['define'](_0x78d3('0xb'),attributes,{'tableName':_0x78d3('0xc'),'paranoid':![],'indexes':[{'name':_0x78d3('0xd'),'fields':[_0x78d3('0xe'),_0x78d3('0xf')],'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 9de5422..a07f6b9 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 _0x86f6=['util','moment','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x86f6,0xaa));var _0x686f=function(_0x879424,_0x4ea69a){_0x879424=_0x879424-0x0;var _0x497f15=_0x86f6[_0x879424];return _0x497f15;};'use strict';var _=require('lodash');var util=require(_0x686f('0x0'));var moment=require(_0x686f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x686f('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x686f('0x3'))(_0x686f('0x4'));var config=require(_0x686f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x686f('0x6')][_0x686f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x45d60f,_0x472e8a,_0x39a8c2){return new BPromise(function(_0x29c8d2,_0x306b1f){return client[_0x686f('0x8')](_0x45d60f,_0x39a8c2)[_0x686f('0x9')](function(_0xc49fda){logger['info'](_0x686f('0xa'),_0x472e8a,_0x686f('0xb'));logger[_0x686f('0xc')](_0x686f('0xd'),_0x472e8a,_0x686f('0xb'),JSON[_0x686f('0xe')](_0xc49fda));if(_0xc49fda[_0x686f('0xf')]){if(_0xc49fda[_0x686f('0xf')]['code']===0x1f4){logger[_0x686f('0xf')](_0x686f('0xa'),_0x472e8a,_0xc49fda[_0x686f('0xf')][_0x686f('0x10')]);return _0x306b1f(_0xc49fda[_0x686f('0xf')]['message']);}logger['error'](_0x686f('0xa'),_0x472e8a,_0xc49fda['error'][_0x686f('0x10')]);return _0x29c8d2(_0xc49fda[_0x686f('0xf')][_0x686f('0x10')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x472e8a,'request\x20sent');_0x29c8d2(_0xc49fda['result'][_0x686f('0x10')]);}})['catch'](function(_0x3365a7){logger['error'](_0x686f('0xa'),_0x472e8a,_0x3365a7);_0x306b1f(_0x3365a7);});});} \ No newline at end of file +var _0x4827=['result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x4827,0x157));var _0x7482=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4827[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7482('0x0'));var BPromise=require(_0x7482('0x1'));var rs=require(_0x7482('0x2'));var fs=require('fs');var Redis=require(_0x7482('0x3'));var db=require(_0x7482('0x4'))['db'];var utils=require(_0x7482('0x5'));var logger=require(_0x7482('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7482('0x7'));var client=jayson[_0x7482('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21a4ba,_0x3efe69,_0x2ff739){return new BPromise(function(_0x208fc1,_0x28287e){return client[_0x7482('0x9')](_0x21a4ba,_0x2ff739)[_0x7482('0xa')](function(_0x3bbb55){logger[_0x7482('0xb')](_0x7482('0xc'),_0x3efe69,_0x7482('0xd'));logger['debug'](_0x7482('0xe'),_0x3efe69,_0x7482('0xd'),JSON['stringify'](_0x3bbb55));if(_0x3bbb55[_0x7482('0xf')]){if(_0x3bbb55[_0x7482('0xf')][_0x7482('0x10')]===0x1f4){logger[_0x7482('0xf')](_0x7482('0xc'),_0x3efe69,_0x3bbb55[_0x7482('0xf')][_0x7482('0x11')]);return _0x28287e(_0x3bbb55[_0x7482('0xf')][_0x7482('0x11')]);}logger[_0x7482('0xf')](_0x7482('0xc'),_0x3efe69,_0x3bbb55[_0x7482('0xf')][_0x7482('0x11')]);return _0x208fc1(_0x3bbb55['error']['message']);}else{logger[_0x7482('0xb')](_0x7482('0xc'),_0x3efe69,'request\x20sent');_0x208fc1(_0x3bbb55[_0x7482('0x12')]['message']);}})['catch'](function(_0x12b588){logger['error'](_0x7482('0xc'),_0x3efe69,_0x12b588);_0x28287e(_0x12b588);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index f5e1485..5068f3f 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 _0xd040=['../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','post','addConfiguration','put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0xaa5eb8,_0x2477e9){var _0x857caf=function(_0x505417){while(--_0x505417){_0xaa5eb8['push'](_0xaa5eb8['shift']());}};_0x857caf(++_0x2477e9);}(_0xd040,0x7e));var _0x0d04=function(_0x215847,_0x4b66c0){_0x215847=_0x215847-0x0;var _0x1e079b=_0xd040[_0x215847];return _0x1e079b;};'use strict';var multer=require(_0x0d04('0x0'));var util=require('util');var path=require(_0x0d04('0x1'));var timeout=require(_0x0d04('0x2'));var express=require(_0x0d04('0x3'));var router=express[_0x0d04('0x4')]();var auth=require(_0x0d04('0x5'));var interaction=require(_0x0d04('0x6'));var config=require(_0x0d04('0x7'));var controller=require(_0x0d04('0x8'));router[_0x0d04('0x9')]('/',auth['isAuthenticated'](),controller[_0x0d04('0xa')]);router[_0x0d04('0x9')](_0x0d04('0xb'),auth['isAuthenticated'](),controller[_0x0d04('0xc')]);router[_0x0d04('0x9')](_0x0d04('0xd'),auth[_0x0d04('0xe')](),controller[_0x0d04('0xf')]);router[_0x0d04('0x9')](_0x0d04('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x0d04('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0d04('0x11')]('/:id/configurations',auth[_0x0d04('0xe')](),controller[_0x0d04('0x12')]);router[_0x0d04('0x13')](_0x0d04('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0d04('0x14')](_0x0d04('0xb'),auth[_0x0d04('0xe')](),controller[_0x0d04('0x15')]);module['exports']=router; \ No newline at end of file +var _0xb5ed=['destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','put','/:id','delete'];(function(_0x1f23b1,_0x57c83f){var _0x3c9197=function(_0x2f6e4a){while(--_0x2f6e4a){_0x1f23b1['push'](_0x1f23b1['shift']());}};_0x3c9197(++_0x57c83f);}(_0xb5ed,0xc8));var _0xdb5e=function(_0xfd5cc9,_0x4a2816){_0xfd5cc9=_0xfd5cc9-0x0;var _0x1e52be=_0xb5ed[_0xfd5cc9];return _0x1e52be;};'use strict';var multer=require(_0xdb5e('0x0'));var util=require('util');var path=require(_0xdb5e('0x1'));var timeout=require(_0xdb5e('0x2'));var express=require('express');var router=express[_0xdb5e('0x3')]();var auth=require(_0xdb5e('0x4'));var interaction=require(_0xdb5e('0x5'));var config=require('../../config/environment');var controller=require(_0xdb5e('0x6'));router[_0xdb5e('0x7')]('/',auth[_0xdb5e('0x8')](),controller[_0xdb5e('0x9')]);router[_0xdb5e('0x7')]('/:id',auth[_0xdb5e('0x8')](),controller[_0xdb5e('0xa')]);router[_0xdb5e('0x7')](_0xdb5e('0xb'),auth[_0xdb5e('0x8')](),controller[_0xdb5e('0xc')]);router['get'](_0xdb5e('0xd'),auth[_0xdb5e('0x8')](),controller[_0xdb5e('0xe')]);router['post']('/',auth[_0xdb5e('0x8')](),controller[_0xdb5e('0xf')]);router[_0xdb5e('0x10')](_0xdb5e('0xb'),auth[_0xdb5e('0x8')](),controller['addConfiguration']);router[_0xdb5e('0x11')](_0xdb5e('0x12'),auth[_0xdb5e('0x8')](),controller['update']);router[_0xdb5e('0x13')](_0xdb5e('0x12'),auth['isAuthenticated'](),controller[_0xdb5e('0x14')]);module[_0xdb5e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 8d4d597..74bafc1 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 _0xf54b=['sequelize','exports','STRING'];(function(_0xe84805,_0x2702d9){var _0x398efd=function(_0x37cfad){while(--_0x37cfad){_0xe84805['push'](_0xe84805['shift']());}};_0x398efd(++_0x2702d9);}(_0xf54b,0xb4));var _0xbf54=function(_0x2508fd,_0xa8375b){_0x2508fd=_0x2508fd-0x0;var _0x3ce952=_0xf54b[_0x2508fd];return _0x3ce952;};'use strict';var Sequelize=require(_0xbf54('0x0'));module[_0xbf54('0x1')]={'name':{'type':Sequelize[_0xbf54('0x2')]},'description':{'type':Sequelize[_0xbf54('0x2')]},'host':{'type':Sequelize[_0xbf54('0x2')]},'zone':{'type':Sequelize[_0xbf54('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xbf54('0x2')]},'code':{'type':Sequelize[_0xbf54('0x2')]},'refreshToken':{'type':Sequelize[_0xbf54('0x2')]}}; \ No newline at end of file +var _0x427f=['STRING','sequelize','exports'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x427f,0xc4));var _0xf427=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x427f[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0xf427('0x0'));module[_0xf427('0x1')]={'name':{'type':Sequelize[_0xf427('0x2')]},'description':{'type':Sequelize[_0xf427('0x2')]},'host':{'type':Sequelize[_0xf427('0x2')]},'zone':{'type':Sequelize[_0xf427('0x2')]},'clientId':{'type':Sequelize[_0xf427('0x2')]},'clientSecret':{'type':Sequelize[_0xf427('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'code':{'type':Sequelize[_0xf427('0x2')]},'refreshToken':{'type':Sequelize[_0xf427('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 3c93a79..ce21afa 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 _0xdffd=['filter','merge','VIRTUAL','options','include','findAll','rows','show','params','filtears','length','includeAll','create','body','find','getConfigurations','findOne','ZohoConfiguration','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','serverUrl','host','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','includes','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','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','apply','reject','update','destroy','stack','name','send','index','map','ZohoAccount','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick'];(function(_0x5c0f6c,_0xb7a1e8){var _0x476d84=function(_0x474d74){while(--_0x474d74){_0x5c0f6c['push'](_0x5c0f6c['shift']());}};_0x476d84(++_0xb7a1e8);}(_0xdffd,0x153));var _0xddff=function(_0x2fcb85,_0x4db9f2){_0x2fcb85=_0x2fcb85-0x0;var _0x18b386=_0xdffd[_0x2fcb85];return _0x18b386;};'use strict';var pdf=require(_0xddff('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xddff('0x1'));var zipdir=require(_0xddff('0x2'));var jsonpatch=require(_0xddff('0x3'));var rp=require(_0xddff('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xddff('0x5'));var util=require(_0xddff('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xddff('0x7'));var ejs=require(_0xddff('0x8'));var fs=require('fs');var _=require(_0xddff('0x9'));var squel=require(_0xddff('0xa'));var crypto=require(_0xddff('0xb'));var jsforce=require(_0xddff('0xc'));var deskjs=require(_0xddff('0xd'));var toCsv=require(_0xddff('0x7'));var querystring=require(_0xddff('0xe'));var Papa=require(_0xddff('0xf'));var Redis=require('ioredis');var authService=require(_0xddff('0x10'));var qs=require(_0xddff('0x11'));var as=require(_0xddff('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xddff('0x13'))(_0xddff('0x14'));var utils=require(_0xddff('0x15'));var config=require(_0xddff('0x16'));var licenseUtil=require(_0xddff('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xddff('0x18'));var client=jayson[_0xddff('0x19')][_0xddff('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x9318cc,_0x480051,_0x1d68d9,_0x495957){return new BPromise(function(_0x516999,_0x56817e){var _0x424393=_0x495957||client;return _0x424393[_0xddff('0x1b')](_0x9318cc,_0x1d68d9)[_0xddff('0x1c')](function(_0x29e601){logger[_0xddff('0x1d')](_0xddff('0x1e'),_0x480051,_0xddff('0x1f'));logger[_0xddff('0x20')](_0xddff('0x21'),_0x480051,'request\x20sent',JSON[_0xddff('0x22')](_0x29e601));if(_0x29e601[_0xddff('0x23')]){if(_0x29e601[_0xddff('0x23')][_0xddff('0x24')]===0x1f4){logger[_0xddff('0x23')]('ZohoAccount,\x20%s,\x20%s',_0x480051,_0x29e601[_0xddff('0x23')][_0xddff('0x25')]);return _0x56817e(_0x29e601['error']['message']);}logger[_0xddff('0x23')](_0xddff('0x1e'),_0x480051,_0x29e601['error'][_0xddff('0x25')]);return _0x516999(_0x29e601['error'][_0xddff('0x25')]);}else{logger[_0xddff('0x1d')]('ZohoAccount,\x20%s,\x20%s',_0x480051,_0xddff('0x1f'));_0x516999(_0x29e601[_0xddff('0x26')][_0xddff('0x25')]);}})[_0xddff('0x27')](function(_0x5b7520){logger[_0xddff('0x23')](_0xddff('0x1e'),_0x480051,_0x5b7520);_0x56817e(_0x5b7520);});});}function respondWithStatusCode(_0xebbc32,_0x505e7e){_0x505e7e=_0x505e7e||0xcc;return function(_0x3a2afe){if(_0x3a2afe){return _0xebbc32[_0xddff('0x28')](_0x505e7e);}return _0xebbc32[_0xddff('0x29')](_0x505e7e)[_0xddff('0x2a')]();};}function respondWithResult(_0x1c695f,_0x422b6e){_0x422b6e=_0x422b6e||0xc8;return function(_0x2070c4){if(_0x2070c4){return _0x1c695f[_0xddff('0x29')](_0x422b6e)[_0xddff('0x2b')](_0x2070c4);}};}function respondWithFilteredResult(_0x3773a0,_0x3e53af){return function(_0x436095){if(_0x436095){var _0x48f539=_0x436095[_0xddff('0x2c')],_0x5e1919=_0x3e53af['offset'],_0x19ce0d=_0x3e53af[_0xddff('0x2d')]+_0x3e53af[_0xddff('0x2e')],_0x3881c1;if(_0x19ce0d>=_0x48f539){_0x19ce0d=_0x48f539;_0x3881c1=0xc8;}else{_0x3881c1=0xce;}_0x3773a0[_0xddff('0x29')](_0x3881c1);return _0x3773a0['set']('Content-Range',_0x5e1919+'-'+_0x19ce0d+'/'+_0x48f539)[_0xddff('0x2b')](_0x436095);}return null;};}function patchUpdates(_0x5c1f9e){return function(_0x5a5365){try{jsonpatch[_0xddff('0x2f')](_0x5a5365,_0x5c1f9e,!![]);}catch(_0x3d3ed5){return BPromise[_0xddff('0x30')](_0x3d3ed5);}return _0x5a5365['save']();};}function saveUpdates(_0x154a8d,_0x5518e0){return function(_0xd29a77){if(_0xd29a77){return _0xd29a77[_0xddff('0x31')](_0x154a8d)[_0xddff('0x1c')](function(_0xf89bb1){return _0xf89bb1;});}return null;};}function removeEntity(_0x723c68,_0x244529){return function(_0x39c4c2){if(_0x39c4c2){return _0x39c4c2[_0xddff('0x32')]()[_0xddff('0x1c')](function(){_0x723c68[_0xddff('0x29')](0xcc)[_0xddff('0x2a')]();});}};}function handleEntityNotFound(_0x554c9b,_0x13dd06){return function(_0x39adb1){if(!_0x39adb1){_0x554c9b[_0xddff('0x28')](0x194);}return _0x39adb1;};}function handleError(_0x243c4e,_0x41208a){_0x41208a=_0x41208a||0x1f4;return function(_0x281020){logger[_0xddff('0x23')](_0x281020[_0xddff('0x33')]);if(_0x281020[_0xddff('0x34')]){delete _0x281020[_0xddff('0x34')];}_0x243c4e[_0xddff('0x29')](_0x41208a)[_0xddff('0x35')](_0x281020);};}exports[_0xddff('0x36')]=function(_0x5c090c,_0x22a369){var _0x4c452d={},_0x470458={},_0x4bd238={'count':0x0,'rows':[]};var _0x529d79=_[_0xddff('0x37')](db[_0xddff('0x38')][_0xddff('0x39')],function(_0x48a22d){return{'name':_0x48a22d['fieldName'],'type':_0x48a22d[_0xddff('0x3a')][_0xddff('0x3b')]};});_0x470458[_0xddff('0x3c')]=_['map'](_0x529d79,_0xddff('0x34'));_0x470458['query']=_[_0xddff('0x3d')](_0x5c090c[_0xddff('0x3e')]);_0x470458[_0xddff('0x3f')]=_[_0xddff('0x40')](_0x470458['model'],_0x470458[_0xddff('0x3e')]);_0x4c452d[_0xddff('0x41')]=_[_0xddff('0x40')](_0x470458[_0xddff('0x3c')],qs['fields'](_0x5c090c['query'][_0xddff('0x42')]));_0x4c452d[_0xddff('0x41')]=_0x4c452d[_0xddff('0x41')]['length']?_0x4c452d[_0xddff('0x41')]:_0x470458[_0xddff('0x3c')];if(!_0x5c090c['query']['hasOwnProperty'](_0xddff('0x43'))){_0x4c452d['limit']=qs['limit'](_0x5c090c['query'][_0xddff('0x2e')]);_0x4c452d[_0xddff('0x2d')]=qs[_0xddff('0x2d')](_0x5c090c[_0xddff('0x3e')][_0xddff('0x2d')]);}_0x4c452d[_0xddff('0x44')]=qs['sort'](_0x5c090c[_0xddff('0x3e')][_0xddff('0x45')]);_0x4c452d[_0xddff('0x46')]=qs[_0xddff('0x3f')](_[_0xddff('0x47')](_0x5c090c[_0xddff('0x3e')],_0x470458[_0xddff('0x3f')]),_0x529d79);if(_0x5c090c[_0xddff('0x3e')][_0xddff('0x48')]){_0x4c452d[_0xddff('0x46')]=_[_0xddff('0x49')](_0x4c452d['where'],{'$or':_[_0xddff('0x37')](_0x529d79,function(_0x27d1c7){if(_0x27d1c7[_0xddff('0x3a')]!==_0xddff('0x4a')){var _0x56f911={};_0x56f911[_0x27d1c7[_0xddff('0x34')]]={'$like':'%'+_0x5c090c[_0xddff('0x3e')][_0xddff('0x48')]+'%'};return _0x56f911;}})});}_0x4c452d=_[_0xddff('0x49')]({},_0x4c452d,_0x5c090c[_0xddff('0x4b')]);var _0x2f6cb1={'where':_0x4c452d[_0xddff('0x46')]};return db['ZohoAccount'][_0xddff('0x2c')](_0x2f6cb1)['then'](function(_0x4780ec){_0x4bd238[_0xddff('0x2c')]=_0x4780ec;if(_0x5c090c[_0xddff('0x3e')]['includeAll']){_0x4c452d[_0xddff('0x4c')]=[{'all':!![]}];}return db[_0xddff('0x38')][_0xddff('0x4d')](_0x4c452d);})[_0xddff('0x1c')](function(_0x38c53f){_0x4bd238[_0xddff('0x4e')]=_0x38c53f;return _0x4bd238;})['then'](respondWithFilteredResult(_0x22a369,_0x4c452d))[_0xddff('0x27')](handleError(_0x22a369,null));};exports[_0xddff('0x4f')]=function(_0x25d977,_0x521880){var _0x4395e8={'raw':![],'where':{'id':_0x25d977[_0xddff('0x50')]['id']}},_0xacbf01={};_0xacbf01[_0xddff('0x3c')]=_['keys'](db[_0xddff('0x38')][_0xddff('0x39')]);_0xacbf01[_0xddff('0x3e')]=_[_0xddff('0x3d')](_0x25d977[_0xddff('0x3e')]);_0xacbf01[_0xddff('0x51')]=_[_0xddff('0x40')](_0xacbf01[_0xddff('0x3c')],_0xacbf01[_0xddff('0x3e')]);_0x4395e8[_0xddff('0x41')]=_[_0xddff('0x40')](_0xacbf01['model'],qs[_0xddff('0x42')](_0x25d977[_0xddff('0x3e')][_0xddff('0x42')]));_0x4395e8['attributes']=_0x4395e8[_0xddff('0x41')][_0xddff('0x52')]?_0x4395e8[_0xddff('0x41')]:_0xacbf01['model'];if(_0x25d977[_0xddff('0x3e')][_0xddff('0x53')]){_0x4395e8['include']=[{'all':!![]}];}_0x4395e8=_['merge']({},_0x4395e8,_0x25d977[_0xddff('0x4b')]);return db[_0xddff('0x38')]['find'](_0x4395e8)[_0xddff('0x1c')](handleEntityNotFound(_0x521880,null))[_0xddff('0x1c')](respondWithResult(_0x521880,null))[_0xddff('0x27')](handleError(_0x521880,null));};exports['create']=function(_0x5e9c2c,_0x3a6072){return db[_0xddff('0x38')][_0xddff('0x54')](_0x5e9c2c['body'],{})[_0xddff('0x1c')](respondWithResult(_0x3a6072,0xc9))[_0xddff('0x27')](handleError(_0x3a6072,null));};exports[_0xddff('0x31')]=function(_0xae417c,_0x22faa5){if(_0xae417c[_0xddff('0x55')]['id']){delete _0xae417c[_0xddff('0x55')]['id'];}return db[_0xddff('0x38')]['find']({'where':{'id':_0xae417c['params']['id']}})[_0xddff('0x1c')](handleEntityNotFound(_0x22faa5,null))[_0xddff('0x1c')](saveUpdates(_0xae417c[_0xddff('0x55')],null))[_0xddff('0x1c')](respondWithResult(_0x22faa5,null))[_0xddff('0x27')](handleError(_0x22faa5,null));};exports[_0xddff('0x32')]=function(_0x5ee30f,_0x105fa7){return db[_0xddff('0x38')][_0xddff('0x56')]({'where':{'id':_0x5ee30f[_0xddff('0x50')]['id']}})[_0xddff('0x1c')](handleEntityNotFound(_0x105fa7,null))['then'](removeEntity(_0x105fa7,null))[_0xddff('0x27')](handleError(_0x105fa7,null));};exports[_0xddff('0x57')]=function(_0xb5cbb7,_0xbd7fc7,_0x11b60d){var _0x3f0db1={};var _0x45c085={};var _0x15bef0;var _0x2e237b;return db[_0xddff('0x38')][_0xddff('0x58')]({'where':{'id':_0xb5cbb7[_0xddff('0x50')]['id']}})[_0xddff('0x1c')](handleEntityNotFound(_0xbd7fc7,null))['then'](function(_0x4a40f4){if(_0x4a40f4){_0x15bef0=_0x4a40f4;_0x45c085[_0xddff('0x3c')]=_[_0xddff('0x3d')](db[_0xddff('0x59')][_0xddff('0x39')]);_0x45c085[_0xddff('0x3e')]=_[_0xddff('0x3d')](_0xb5cbb7[_0xddff('0x3e')]);_0x45c085[_0xddff('0x3f')]=_[_0xddff('0x40')](_0x45c085[_0xddff('0x3c')],_0x45c085[_0xddff('0x3e')]);_0x3f0db1['attributes']=_[_0xddff('0x40')](_0x45c085[_0xddff('0x3c')],qs[_0xddff('0x42')](_0xb5cbb7[_0xddff('0x3e')]['fields']));_0x3f0db1['attributes']=_0x3f0db1[_0xddff('0x41')]['length']?_0x3f0db1[_0xddff('0x41')]:_0x45c085[_0xddff('0x3c')];_0x3f0db1[_0xddff('0x44')]=qs['sort'](_0xb5cbb7[_0xddff('0x3e')][_0xddff('0x45')]);_0x3f0db1[_0xddff('0x46')]=qs[_0xddff('0x3f')](_['pick'](_0xb5cbb7[_0xddff('0x3e')],_0x45c085[_0xddff('0x3f')]));if(_0xb5cbb7['query'][_0xddff('0x48')]){_0x3f0db1['where']=_[_0xddff('0x49')](_0x3f0db1[_0xddff('0x46')],{'$or':_[_0xddff('0x37')](_0x3f0db1[_0xddff('0x41')],function(_0x4bcfc4){var _0x2add95={};_0x2add95[_0x4bcfc4]={'$like':'%'+_0xb5cbb7[_0xddff('0x3e')][_0xddff('0x48')]+'%'};return _0x2add95;})});}_0x3f0db1=_[_0xddff('0x49')]({},_0x3f0db1,_0xb5cbb7['options']);return _0x15bef0[_0xddff('0x57')](_0x3f0db1);}})['then'](function(_0x4432c6){if(_0x4432c6){_0x2e237b=_0x4432c6[_0xddff('0x52')];if(!_0xb5cbb7[_0xddff('0x3e')][_0xddff('0x5a')]('nolimit')){_0x3f0db1[_0xddff('0x2e')]=qs['limit'](_0xb5cbb7[_0xddff('0x3e')][_0xddff('0x2e')]);_0x3f0db1[_0xddff('0x2d')]=qs['offset'](_0xb5cbb7[_0xddff('0x3e')][_0xddff('0x2d')]);}return _0x15bef0['getConfigurations'](_0x3f0db1);}})[_0xddff('0x1c')](function(_0x476c4e){if(_0x476c4e){return _0x476c4e?{'count':_0x2e237b,'rows':_0x476c4e}:null;}})['then'](respondWithResult(_0xbd7fc7,null))['catch'](handleError(_0xbd7fc7,null));};exports[_0xddff('0x5b')]=function(_0x39afd4,_0x54dbcc,_0x1276f4){if(_0x39afd4[_0xddff('0x55')]['id']){delete _0x39afd4[_0xddff('0x55')]['id'];}return db[_0xddff('0x38')][_0xddff('0x58')]({'where':{'id':_0x39afd4[_0xddff('0x50')]['id']}})[_0xddff('0x1c')](handleEntityNotFound(_0x54dbcc,null))['then'](function(_0x382f1d){if(_0x382f1d){_0x39afd4[_0xddff('0x55')]['AccountId']=_0x382f1d['id'];_0x39afd4[_0xddff('0x55')][_0xddff('0x5c')]=integrations[_0xddff('0x5d')](_0x39afd4[_0xddff('0x55')][_0xddff('0x5e')],_0x39afd4[_0xddff('0x55')][_0xddff('0x3a')]);_0x39afd4[_0xddff('0x55')]['Descriptions']=integrations[_0xddff('0x5f')](_0x39afd4[_0xddff('0x55')][_0xddff('0x5e')],_0x39afd4[_0xddff('0x55')][_0xddff('0x3a')]);return db[_0xddff('0x59')]['create'](_0x39afd4[_0xddff('0x55')],{'include':[{'model':db[_0xddff('0x60')],'as':_0xddff('0x5c')},{'model':db['ZohoField'],'as':_0xddff('0x61')}]});}return null;})['then'](respondWithResult(_0x54dbcc,null))[_0xddff('0x27')](handleError(_0x54dbcc,null));};function getAccessToken(_0x26b50a){return new Promise(function(_0x3b183a,_0x5b5009){var _0x4d8b28;switch(_0x26b50a[_0xddff('0x62')]){case'US':_0x4d8b28=_0xddff('0x63');break;case'AU':_0x4d8b28=_0xddff('0x64');break;case'EU':_0x4d8b28=_0xddff('0x65');break;case'IN':_0x4d8b28=_0xddff('0x66');break;case'CN':_0x4d8b28='https://accounts.zoho.com.cn';break;default:_0x4d8b28='https://accounts.zoho.eu';break;}var _0x3dad90={'method':_0xddff('0x67'),'uri':_0x4d8b28+'/oauth/v2/token','qs':{'refresh_token':_0x26b50a[_0xddff('0x68')],'client_id':_0x26b50a[_0xddff('0x69')],'client_secret':_0x26b50a[_0xddff('0x6a')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3dad90)[_0xddff('0x1c')](function(_0xaef613){if(_0xaef613[_0xddff('0x6b')]){_0x3b183a(_0xaef613[_0xddff('0x6b')]);}else{_0x5b5009(_0xddff('0x6c'));}})[_0xddff('0x27')](function(_0x311ea6){_0x5b5009(_0x311ea6);});});}exports[_0xddff('0x6d')]=function(_0x4cd0e7,_0x40fd72,_0x3deb64){var _0x35fe77,_0x5ecc9c,_0x397cba,_0x1a0f59,_0x50342b;return db[_0xddff('0x38')][_0xddff('0x58')]({'where':{'id':_0x4cd0e7['params']['id']},'attributes':['id','host','zone',_0xddff('0x69'),_0xddff('0x6a'),_0xddff('0x6e'),_0xddff('0x24'),_0xddff('0x68')]})['then'](handleEntityNotFound(_0x40fd72,null))[_0xddff('0x1c')](function(_0x19ce89){_0x50342b=_0x19ce89;_0x35fe77=_0x50342b[_0xddff('0x6f')];_0x5ecc9c=_0x35fe77===_0xddff('0x70')?'eu':'com';_0x397cba=_0x50342b[_0xddff('0x6e')];var _0x103428=_0x397cba[_0xddff('0x71')](-0x1);if(_0x103428==='/'||_0x103428==='\x5c'||_0x103428===':'){_0x397cba=_0x397cba[_0xddff('0x72')](0x0,_0x397cba[_0xddff('0x73')](_0x103428));}if(!_0x50342b[_0xddff('0x68')]){throw new Error(_0xddff('0x74'));}return getAccessToken(_0x50342b);})[_0xddff('0x1c')](function(_0x31d80d){if(_0x31d80d){return rp({'method':'GET','uri':util[_0xddff('0x75')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x5ecc9c),'qs':{'module':'Calls'},'headers':{'Authorization':_0xddff('0x76')+_0x31d80d},'json':!![]});}})[_0xddff('0x1c')](function(_0x285732){if(_0x285732){if(_0x285732[_0xddff('0x77')]&&_0x285732[_0xddff('0x77')][_0xddff('0x23')]){throw new Error(_0x285732[_0xddff('0x77')][_0xddff('0x23')]['message']);}var _0xcb181d=[];var _0x1e35e6=[];var _0x3536b5=[_0xddff('0x78'),_0xddff('0x79'),_0xddff('0x7a'),_0xddff('0x7b'),'Call_Duration',_0xddff('0x7c'),_0xddff('0x7d'),_0xddff('0x7e')];_0x1e35e6=_['remove'](_0x285732[_0xddff('0x42')],function(_0x3bb3a2){return _0x3536b5[_0xddff('0x7f')](_0x3bb3a2['api_name']);});for(var _0x378615=0x0;_0x378615<_0x1e35e6[_0xddff('0x52')];_0x378615++){if(_0x1e35e6[_0x378615][_0xddff('0x80')]===![]){_0xcb181d[_0xddff('0x81')]({'id':_0x1e35e6[_0x378615]['id'],'name':_0x1e35e6[_0x378615][_0xddff('0x82')],'custom':_0x1e35e6[_0x378615][_0xddff('0x83')],'options':_0x1e35e6[_0x378615][_0xddff('0x84')]===_0xddff('0x85')&&_0x1e35e6[_0x378615][_0xddff('0x86')][_0xddff('0x52')]>-0x1?_['map'](_0x1e35e6[_0x378615][_0xddff('0x86')],function(_0x3bec44){return{'name':_0x3bec44,'value':_0x3bec44};}):[]});}}return{'count':_0xcb181d[_0xddff('0x52')],'rows':_0xcb181d};}else{return{'count':0x0,'rows':[]};}})[_0xddff('0x1c')](respondWithResult(_0x40fd72,null))[_0xddff('0x27')](function(_0x3620f6){var _0x116fc9=_0x4cd0e7[_0xddff('0x3e')]['test']?0x1f4:_0x3620f6[_0xddff('0x87')]||0x1f4;logger[_0xddff('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xddff('0x6d'),_0x116fc9,JSON[_0xddff('0x22')](_0x3620f6));delete _0x3620f6[_0xddff('0x34')];if(_0x116fc9===0x191){_0x116fc9=0x190;}_0x40fd72[_0xddff('0x29')](_0x116fc9)['send'](_0x4cd0e7[_0xddff('0x3e')]['test']?{'message':_0xddff('0x88'),'statusCode':_0x3620f6[_0xddff('0x87')]}:_0x3620f6);});}; \ No newline at end of file +var _0xac82=['includeAll','findAll','rows','params','keys','filtears','length','include','body','update','find','getConfigurations','findOne','addConfiguration','AccountId','channel','getDescriptions','create','ZohoField','Subjects','Descriptions','zone','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','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','serverUrl','zoho.eu','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','filters','intersection','query','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x542c73,_0x307b9c){var _0x7d5f0e=function(_0x4d5bbb){while(--_0x4d5bbb){_0x542c73['push'](_0x542c73['shift']());}};_0x7d5f0e(++_0x307b9c);}(_0xac82,0x15c));var _0x2ac8=function(_0x17db92,_0x334692){_0x17db92=_0x17db92-0x0;var _0x153f5c=_0xac82[_0x17db92];return _0x153f5c;};'use strict';var pdf=require(_0x2ac8('0x0'));var emlformat=require(_0x2ac8('0x1'));var rimraf=require(_0x2ac8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ac8('0x3'));var rp=require(_0x2ac8('0x4'));var moment=require(_0x2ac8('0x5'));var BPromise=require(_0x2ac8('0x6'));var Mustache=require(_0x2ac8('0x7'));var util=require(_0x2ac8('0x8'));var path=require(_0x2ac8('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2ac8('0xa'));var fs=require('fs');var _=require(_0x2ac8('0xb'));var squel=require(_0x2ac8('0xc'));var crypto=require(_0x2ac8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2ac8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2ac8('0xf'));var Papa=require(_0x2ac8('0x10'));var Redis=require(_0x2ac8('0x11'));var authService=require(_0x2ac8('0x12'));var qs=require(_0x2ac8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ac8('0x14'));var logger=require(_0x2ac8('0x15'))(_0x2ac8('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2ac8('0x17'));var db=require(_0x2ac8('0x18'))['db'];var integrations=require(_0x2ac8('0x19'));var jayson=require('jayson/promise');var client=jayson[_0x2ac8('0x1a')][_0x2ac8('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x32137c,_0x30b194,_0x2ac1bc,_0x47390f){return new BPromise(function(_0xc43120,_0x4fd654){var _0x1d170b=_0x47390f||client;return _0x1d170b[_0x2ac8('0x1c')](_0x32137c,_0x2ac1bc)[_0x2ac8('0x1d')](function(_0x241c98){logger[_0x2ac8('0x1e')](_0x2ac8('0x1f'),_0x30b194,'request\x20sent');logger['debug'](_0x2ac8('0x20'),_0x30b194,_0x2ac8('0x21'),JSON[_0x2ac8('0x22')](_0x241c98));if(_0x241c98[_0x2ac8('0x23')]){if(_0x241c98[_0x2ac8('0x23')][_0x2ac8('0x24')]===0x1f4){logger['error'](_0x2ac8('0x1f'),_0x30b194,_0x241c98[_0x2ac8('0x23')][_0x2ac8('0x25')]);return _0x4fd654(_0x241c98[_0x2ac8('0x23')][_0x2ac8('0x25')]);}logger['error'](_0x2ac8('0x1f'),_0x30b194,_0x241c98[_0x2ac8('0x23')][_0x2ac8('0x25')]);return _0xc43120(_0x241c98['error'][_0x2ac8('0x25')]);}else{logger[_0x2ac8('0x1e')](_0x2ac8('0x1f'),_0x30b194,_0x2ac8('0x21'));_0xc43120(_0x241c98[_0x2ac8('0x26')][_0x2ac8('0x25')]);}})[_0x2ac8('0x27')](function(_0xbc9811){logger[_0x2ac8('0x23')](_0x2ac8('0x1f'),_0x30b194,_0xbc9811);_0x4fd654(_0xbc9811);});});}function respondWithStatusCode(_0x3e222c,_0x4e5fe2){_0x4e5fe2=_0x4e5fe2||0xcc;return function(_0x10a378){if(_0x10a378){return _0x3e222c[_0x2ac8('0x28')](_0x4e5fe2);}return _0x3e222c[_0x2ac8('0x29')](_0x4e5fe2)[_0x2ac8('0x2a')]();};}function respondWithResult(_0x4da081,_0xa8d96f){_0xa8d96f=_0xa8d96f||0xc8;return function(_0x56da31){if(_0x56da31){return _0x4da081[_0x2ac8('0x29')](_0xa8d96f)['json'](_0x56da31);}};}function respondWithFilteredResult(_0x5c08a9,_0x4a81ec){return function(_0x51b36c){if(_0x51b36c){var _0x5756e7=_0x51b36c[_0x2ac8('0x2b')],_0x40634c=_0x4a81ec[_0x2ac8('0x2c')],_0x37bffe=_0x4a81ec['offset']+_0x4a81ec[_0x2ac8('0x2d')],_0x4acc35;if(_0x37bffe>=_0x5756e7){_0x37bffe=_0x5756e7;_0x4acc35=0xc8;}else{_0x4acc35=0xce;}_0x5c08a9['status'](_0x4acc35);return _0x5c08a9[_0x2ac8('0x2e')](_0x2ac8('0x2f'),_0x40634c+'-'+_0x37bffe+'/'+_0x5756e7)[_0x2ac8('0x30')](_0x51b36c);}return null;};}function patchUpdates(_0x876baa){return function(_0x25da8b){try{jsonpatch[_0x2ac8('0x31')](_0x25da8b,_0x876baa,!![]);}catch(_0x2919f8){return BPromise[_0x2ac8('0x32')](_0x2919f8);}return _0x25da8b[_0x2ac8('0x33')]();};}function saveUpdates(_0x196531,_0x45c38f){return function(_0x2d3436){if(_0x2d3436){return _0x2d3436['update'](_0x196531)['then'](function(_0x45bf24){return _0x45bf24;});}return null;};}function removeEntity(_0x23274c,_0x507999){return function(_0x2b36cf){if(_0x2b36cf){return _0x2b36cf[_0x2ac8('0x34')]()[_0x2ac8('0x1d')](function(){_0x23274c[_0x2ac8('0x29')](0xcc)[_0x2ac8('0x2a')]();});}};}function handleEntityNotFound(_0x1f3576,_0x35bedc){return function(_0x3614e6){if(!_0x3614e6){_0x1f3576[_0x2ac8('0x28')](0x194);}return _0x3614e6;};}function handleError(_0x57885d,_0x5912c6){_0x5912c6=_0x5912c6||0x1f4;return function(_0x51beb0){logger[_0x2ac8('0x23')](_0x51beb0[_0x2ac8('0x35')]);if(_0x51beb0['name']){delete _0x51beb0[_0x2ac8('0x36')];}_0x57885d[_0x2ac8('0x29')](_0x5912c6)[_0x2ac8('0x37')](_0x51beb0);};}exports[_0x2ac8('0x38')]=function(_0x1ff2e2,_0x2b9eb3){var _0x20dc5d={},_0x5921d8={},_0x262a9e={'count':0x0,'rows':[]};var _0x4920ea=_[_0x2ac8('0x39')](db[_0x2ac8('0x3a')][_0x2ac8('0x3b')],function(_0x428283){return{'name':_0x428283[_0x2ac8('0x3c')],'type':_0x428283[_0x2ac8('0x3d')]['key']};});_0x5921d8['model']=_[_0x2ac8('0x39')](_0x4920ea,'name');_0x5921d8['query']=_['keys'](_0x1ff2e2['query']);_0x5921d8[_0x2ac8('0x3e')]=_[_0x2ac8('0x3f')](_0x5921d8['model'],_0x5921d8[_0x2ac8('0x40')]);_0x20dc5d[_0x2ac8('0x41')]=_[_0x2ac8('0x3f')](_0x5921d8[_0x2ac8('0x42')],qs[_0x2ac8('0x43')](_0x1ff2e2[_0x2ac8('0x40')][_0x2ac8('0x43')]));_0x20dc5d[_0x2ac8('0x41')]=_0x20dc5d[_0x2ac8('0x41')]['length']?_0x20dc5d[_0x2ac8('0x41')]:_0x5921d8[_0x2ac8('0x42')];if(!_0x1ff2e2[_0x2ac8('0x40')][_0x2ac8('0x44')](_0x2ac8('0x45'))){_0x20dc5d[_0x2ac8('0x2d')]=qs[_0x2ac8('0x2d')](_0x1ff2e2[_0x2ac8('0x40')][_0x2ac8('0x2d')]);_0x20dc5d['offset']=qs[_0x2ac8('0x2c')](_0x1ff2e2['query'][_0x2ac8('0x2c')]);}_0x20dc5d[_0x2ac8('0x46')]=qs[_0x2ac8('0x47')](_0x1ff2e2['query']['sort']);_0x20dc5d[_0x2ac8('0x48')]=qs['filters'](_[_0x2ac8('0x49')](_0x1ff2e2[_0x2ac8('0x40')],_0x5921d8[_0x2ac8('0x3e')]),_0x4920ea);if(_0x1ff2e2[_0x2ac8('0x40')][_0x2ac8('0x4a')]){_0x20dc5d['where']=_[_0x2ac8('0x4b')](_0x20dc5d[_0x2ac8('0x48')],{'$or':_['map'](_0x4920ea,function(_0x4bf9ce){if(_0x4bf9ce['type']!==_0x2ac8('0x4c')){var _0x159587={};_0x159587[_0x4bf9ce[_0x2ac8('0x36')]]={'$like':'%'+_0x1ff2e2[_0x2ac8('0x40')][_0x2ac8('0x4a')]+'%'};return _0x159587;}})});}_0x20dc5d=_[_0x2ac8('0x4b')]({},_0x20dc5d,_0x1ff2e2[_0x2ac8('0x4d')]);var _0x291ba={'where':_0x20dc5d[_0x2ac8('0x48')]};return db[_0x2ac8('0x3a')]['count'](_0x291ba)[_0x2ac8('0x1d')](function(_0x36adea){_0x262a9e[_0x2ac8('0x2b')]=_0x36adea;if(_0x1ff2e2[_0x2ac8('0x40')][_0x2ac8('0x4e')]){_0x20dc5d['include']=[{'all':!![]}];}return db[_0x2ac8('0x3a')][_0x2ac8('0x4f')](_0x20dc5d);})[_0x2ac8('0x1d')](function(_0x41cbbb){_0x262a9e[_0x2ac8('0x50')]=_0x41cbbb;return _0x262a9e;})[_0x2ac8('0x1d')](respondWithFilteredResult(_0x2b9eb3,_0x20dc5d))[_0x2ac8('0x27')](handleError(_0x2b9eb3,null));};exports['show']=function(_0x1a8cd1,_0x11cf76){var _0x590de3={'raw':![],'where':{'id':_0x1a8cd1[_0x2ac8('0x51')]['id']}},_0x374d34={};_0x374d34['model']=_[_0x2ac8('0x52')](db['ZohoAccount'][_0x2ac8('0x3b')]);_0x374d34[_0x2ac8('0x40')]=_['keys'](_0x1a8cd1[_0x2ac8('0x40')]);_0x374d34[_0x2ac8('0x53')]=_[_0x2ac8('0x3f')](_0x374d34['model'],_0x374d34['query']);_0x590de3['attributes']=_[_0x2ac8('0x3f')](_0x374d34[_0x2ac8('0x42')],qs[_0x2ac8('0x43')](_0x1a8cd1[_0x2ac8('0x40')]['fields']));_0x590de3[_0x2ac8('0x41')]=_0x590de3['attributes'][_0x2ac8('0x54')]?_0x590de3[_0x2ac8('0x41')]:_0x374d34[_0x2ac8('0x42')];if(_0x1a8cd1['query'][_0x2ac8('0x4e')]){_0x590de3[_0x2ac8('0x55')]=[{'all':!![]}];}_0x590de3=_[_0x2ac8('0x4b')]({},_0x590de3,_0x1a8cd1['options']);return db[_0x2ac8('0x3a')]['find'](_0x590de3)[_0x2ac8('0x1d')](handleEntityNotFound(_0x11cf76,null))[_0x2ac8('0x1d')](respondWithResult(_0x11cf76,null))[_0x2ac8('0x27')](handleError(_0x11cf76,null));};exports['create']=function(_0x456a42,_0x3e9621){return db[_0x2ac8('0x3a')]['create'](_0x456a42[_0x2ac8('0x56')],{})[_0x2ac8('0x1d')](respondWithResult(_0x3e9621,0xc9))[_0x2ac8('0x27')](handleError(_0x3e9621,null));};exports[_0x2ac8('0x57')]=function(_0x5e6e48,_0x18dff6){if(_0x5e6e48[_0x2ac8('0x56')]['id']){delete _0x5e6e48[_0x2ac8('0x56')]['id'];}return db[_0x2ac8('0x3a')][_0x2ac8('0x58')]({'where':{'id':_0x5e6e48['params']['id']}})[_0x2ac8('0x1d')](handleEntityNotFound(_0x18dff6,null))[_0x2ac8('0x1d')](saveUpdates(_0x5e6e48[_0x2ac8('0x56')],null))[_0x2ac8('0x1d')](respondWithResult(_0x18dff6,null))[_0x2ac8('0x27')](handleError(_0x18dff6,null));};exports[_0x2ac8('0x34')]=function(_0x70d6e7,_0x156c4d){return db[_0x2ac8('0x3a')][_0x2ac8('0x58')]({'where':{'id':_0x70d6e7[_0x2ac8('0x51')]['id']}})[_0x2ac8('0x1d')](handleEntityNotFound(_0x156c4d,null))['then'](removeEntity(_0x156c4d,null))[_0x2ac8('0x27')](handleError(_0x156c4d,null));};exports[_0x2ac8('0x59')]=function(_0x32cc4c,_0x5ef442,_0x10f6f8){var _0x51fd00={};var _0x5854d6={};var _0x2949ff;var _0x273368;return db[_0x2ac8('0x3a')][_0x2ac8('0x5a')]({'where':{'id':_0x32cc4c[_0x2ac8('0x51')]['id']}})[_0x2ac8('0x1d')](handleEntityNotFound(_0x5ef442,null))['then'](function(_0x5548c9){if(_0x5548c9){_0x2949ff=_0x5548c9;_0x5854d6[_0x2ac8('0x42')]=_['keys'](db['ZohoConfiguration'][_0x2ac8('0x3b')]);_0x5854d6[_0x2ac8('0x40')]=_['keys'](_0x32cc4c[_0x2ac8('0x40')]);_0x5854d6['filters']=_[_0x2ac8('0x3f')](_0x5854d6[_0x2ac8('0x42')],_0x5854d6['query']);_0x51fd00[_0x2ac8('0x41')]=_[_0x2ac8('0x3f')](_0x5854d6[_0x2ac8('0x42')],qs['fields'](_0x32cc4c['query'][_0x2ac8('0x43')]));_0x51fd00[_0x2ac8('0x41')]=_0x51fd00[_0x2ac8('0x41')][_0x2ac8('0x54')]?_0x51fd00[_0x2ac8('0x41')]:_0x5854d6[_0x2ac8('0x42')];_0x51fd00[_0x2ac8('0x46')]=qs[_0x2ac8('0x47')](_0x32cc4c[_0x2ac8('0x40')]['sort']);_0x51fd00[_0x2ac8('0x48')]=qs[_0x2ac8('0x3e')](_[_0x2ac8('0x49')](_0x32cc4c['query'],_0x5854d6['filters']));if(_0x32cc4c['query']['filter']){_0x51fd00[_0x2ac8('0x48')]=_[_0x2ac8('0x4b')](_0x51fd00[_0x2ac8('0x48')],{'$or':_[_0x2ac8('0x39')](_0x51fd00[_0x2ac8('0x41')],function(_0x476705){var _0x4d43ea={};_0x4d43ea[_0x476705]={'$like':'%'+_0x32cc4c[_0x2ac8('0x40')][_0x2ac8('0x4a')]+'%'};return _0x4d43ea;})});}_0x51fd00=_[_0x2ac8('0x4b')]({},_0x51fd00,_0x32cc4c['options']);return _0x2949ff['getConfigurations'](_0x51fd00);}})[_0x2ac8('0x1d')](function(_0x3dcafb){if(_0x3dcafb){_0x273368=_0x3dcafb['length'];if(!_0x32cc4c['query'][_0x2ac8('0x44')](_0x2ac8('0x45'))){_0x51fd00[_0x2ac8('0x2d')]=qs['limit'](_0x32cc4c[_0x2ac8('0x40')][_0x2ac8('0x2d')]);_0x51fd00[_0x2ac8('0x2c')]=qs['offset'](_0x32cc4c['query'][_0x2ac8('0x2c')]);}return _0x2949ff[_0x2ac8('0x59')](_0x51fd00);}})[_0x2ac8('0x1d')](function(_0x1e5880){if(_0x1e5880){return _0x1e5880?{'count':_0x273368,'rows':_0x1e5880}:null;}})['then'](respondWithResult(_0x5ef442,null))['catch'](handleError(_0x5ef442,null));};exports[_0x2ac8('0x5b')]=function(_0x13f04a,_0x19cbbc,_0x219bb6){if(_0x13f04a[_0x2ac8('0x56')]['id']){delete _0x13f04a['body']['id'];}return db[_0x2ac8('0x3a')][_0x2ac8('0x5a')]({'where':{'id':_0x13f04a[_0x2ac8('0x51')]['id']}})[_0x2ac8('0x1d')](handleEntityNotFound(_0x19cbbc,null))[_0x2ac8('0x1d')](function(_0x396a80){if(_0x396a80){_0x13f04a[_0x2ac8('0x56')][_0x2ac8('0x5c')]=_0x396a80['id'];_0x13f04a[_0x2ac8('0x56')]['Subjects']=integrations['getSubjects'](_0x13f04a[_0x2ac8('0x56')][_0x2ac8('0x5d')],_0x13f04a[_0x2ac8('0x56')][_0x2ac8('0x3d')]);_0x13f04a[_0x2ac8('0x56')]['Descriptions']=integrations[_0x2ac8('0x5e')](_0x13f04a[_0x2ac8('0x56')][_0x2ac8('0x5d')],_0x13f04a[_0x2ac8('0x56')][_0x2ac8('0x3d')]);return db['ZohoConfiguration'][_0x2ac8('0x5f')](_0x13f04a[_0x2ac8('0x56')],{'include':[{'model':db[_0x2ac8('0x60')],'as':_0x2ac8('0x61')},{'model':db[_0x2ac8('0x60')],'as':_0x2ac8('0x62')}]});}return null;})[_0x2ac8('0x1d')](respondWithResult(_0x19cbbc,null))[_0x2ac8('0x27')](handleError(_0x19cbbc,null));};function getAccessToken(_0x2b4d16){return new Promise(function(_0xfb9241,_0x5a4122){var _0x407ab9;switch(_0x2b4d16[_0x2ac8('0x63')]){case'US':_0x407ab9=_0x2ac8('0x64');break;case'AU':_0x407ab9=_0x2ac8('0x65');break;case'EU':_0x407ab9='https://accounts.zoho.eu';break;case'IN':_0x407ab9=_0x2ac8('0x66');break;case'CN':_0x407ab9=_0x2ac8('0x67');break;default:_0x407ab9=_0x2ac8('0x68');break;}var _0x1f4ea5={'method':_0x2ac8('0x69'),'uri':_0x407ab9+_0x2ac8('0x6a'),'qs':{'refresh_token':_0x2b4d16[_0x2ac8('0x6b')],'client_id':_0x2b4d16[_0x2ac8('0x6c')],'client_secret':_0x2b4d16[_0x2ac8('0x6d')],'grant_type':_0x2ac8('0x6e')},'json':!![]};return rp(_0x1f4ea5)[_0x2ac8('0x1d')](function(_0x363959){if(_0x363959[_0x2ac8('0x6f')]){_0xfb9241(_0x363959[_0x2ac8('0x6f')]);}else{_0x5a4122(_0x2ac8('0x70'));}})[_0x2ac8('0x27')](function(_0x45b055){_0x5a4122(_0x45b055);});});}exports[_0x2ac8('0x71')]=function(_0x2dc4b2,_0x24d6f9,_0x9ffb2d){var _0x1632f7,_0x44d010,_0x38206b,_0x44ef54,_0x3ac640;return db[_0x2ac8('0x3a')][_0x2ac8('0x5a')]({'where':{'id':_0x2dc4b2[_0x2ac8('0x51')]['id']},'attributes':['id','host','zone','clientId',_0x2ac8('0x6d'),_0x2ac8('0x72'),_0x2ac8('0x24'),_0x2ac8('0x6b')]})[_0x2ac8('0x1d')](handleEntityNotFound(_0x24d6f9,null))['then'](function(_0x48b46c){_0x3ac640=_0x48b46c;_0x1632f7=_0x3ac640['host'];_0x44d010=_0x1632f7===_0x2ac8('0x73')?'eu':_0x2ac8('0x74');_0x38206b=_0x3ac640['serverUrl'];var _0x2cdf8f=_0x38206b['slice'](-0x1);if(_0x2cdf8f==='/'||_0x2cdf8f==='\x5c'||_0x2cdf8f===':'){_0x38206b=_0x38206b[_0x2ac8('0x75')](0x0,_0x38206b[_0x2ac8('0x76')](_0x2cdf8f));}if(!_0x3ac640[_0x2ac8('0x6b')]){throw new Error(_0x2ac8('0x77'));}return getAccessToken(_0x3ac640);})[_0x2ac8('0x1d')](function(_0x11c4b0){if(_0x11c4b0){return rp({'method':_0x2ac8('0x78'),'uri':util[_0x2ac8('0x79')](_0x2ac8('0x7a'),_0x44d010),'qs':{'module':_0x2ac8('0x7b')},'headers':{'Authorization':_0x2ac8('0x7c')+_0x11c4b0},'json':!![]});}})[_0x2ac8('0x1d')](function(_0x40cb09){if(_0x40cb09){if(_0x40cb09['response']&&_0x40cb09['response']['error']){throw new Error(_0x40cb09[_0x2ac8('0x7d')][_0x2ac8('0x23')][_0x2ac8('0x25')]);}var _0x1a7c19=[];var _0x38d973=[];var _0x3c4464=[_0x2ac8('0x7e'),_0x2ac8('0x7f'),_0x2ac8('0x80'),_0x2ac8('0x81'),_0x2ac8('0x82'),_0x2ac8('0x83'),_0x2ac8('0x84'),'Call_Type'];_0x38d973=_[_0x2ac8('0x85')](_0x40cb09[_0x2ac8('0x43')],function(_0x46784f){return _0x3c4464[_0x2ac8('0x86')](_0x46784f[_0x2ac8('0x87')]);});for(var _0x48d106=0x0;_0x48d106<_0x38d973['length'];_0x48d106++){if(_0x38d973[_0x48d106]['system_mandatory']===![]){_0x1a7c19['push']({'id':_0x38d973[_0x48d106]['id'],'name':_0x38d973[_0x48d106]['display_label'],'custom':_0x38d973[_0x48d106]['custom_field'],'options':_0x38d973[_0x48d106][_0x2ac8('0x88')]==='picklist'&&_0x38d973[_0x48d106][_0x2ac8('0x89')][_0x2ac8('0x54')]>-0x1?_['map'](_0x38d973[_0x48d106][_0x2ac8('0x89')],function(_0x22ce86){return{'name':_0x22ce86,'value':_0x22ce86};}):[]});}}return{'count':_0x1a7c19[_0x2ac8('0x54')],'rows':_0x1a7c19};}else{return{'count':0x0,'rows':[]};}})[_0x2ac8('0x1d')](respondWithResult(_0x24d6f9,null))[_0x2ac8('0x27')](function(_0x599d59){var _0x4f5763=_0x2dc4b2['query'][_0x2ac8('0x8a')]?0x1f4:_0x599d59[_0x2ac8('0x8b')]||0x1f4;logger[_0x2ac8('0x23')](_0x2ac8('0x8c'),_0x2ac8('0x71'),_0x4f5763,JSON['stringify'](_0x599d59));delete _0x599d59[_0x2ac8('0x36')];if(_0x4f5763===0x191){_0x4f5763=0x190;}_0x24d6f9['status'](_0x4f5763)['send'](_0x2dc4b2['query'][_0x2ac8('0x8a')]?{'message':_0x2ac8('0x8d'),'statusCode':_0x599d59[_0x2ac8('0x8b')]}:_0x599d59);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 92e0bc3..34d77df 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 _0x956e=['exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientSecret','host','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','parse','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','code','then','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration'];(function(_0x2232fb,_0x25f5c2){var _0x24acba=function(_0x432d9e){while(--_0x432d9e){_0x2232fb['push'](_0x2232fb['shift']());}};_0x24acba(++_0x25f5c2);}(_0x956e,0x15e));var _0xe956=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0x956e[_0x4d21ff];return _0x22b554;};'use strict';var _=require(_0xe956('0x0'));var util=require(_0xe956('0x1'));var logger=require(_0xe956('0x2'))('api');var moment=require(_0xe956('0x3'));var BPromise=require(_0xe956('0x4'));var rp=require(_0xe956('0x5'));var fs=require('fs');var path=require(_0xe956('0x6'));var rimraf=require(_0xe956('0x7'));var config=require('../../config/environment');var attributes=require(_0xe956('0x8'));var integrations=require(_0xe956('0x9'));module[_0xe956('0xa')]=function(_0x4aedeb,_0x34503f){return _0x4aedeb[_0xe956('0xb')](_0xe956('0xc'),attributes,{'tableName':_0xe956('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x41d3e2,_0x14b0e6,_0x5a3959){if(_0x41d3e2[_0xe956('0xe')](_0xe956('0xf'))||_0x41d3e2[_0xe956('0xe')](_0xe956('0x10'))||_0x41d3e2[_0xe956('0xe')]('clientId')||_0x41d3e2[_0xe956('0xe')](_0xe956('0x11'))||_0x41d3e2[_0xe956('0xe')]('code')||_0x41d3e2[_0xe956('0xe')](_0xe956('0x12'))){var _0x238744,_0x50da90;_0x238744=_0x41d3e2[_0xe956('0x10')];var _0x11526c=_0x238744[_0xe956('0x13')](-0x1);if(_0x11526c==='/'||_0x11526c==='\x5c'||_0x11526c===':'){_0x238744=_0x238744[_0xe956('0x14')](0x0,_0x238744[_0xe956('0x15')](_0x11526c));}switch(_0x41d3e2[_0xe956('0xf')]){case'US':_0x50da90=_0xe956('0x16');break;case'AU':_0x50da90=_0xe956('0x17');break;case'IN':_0x50da90=_0xe956('0x18');break;case'CN':_0x50da90=_0xe956('0x19');break;default:_0x50da90=_0xe956('0x1a');break;}var _0xafeabc={'method':_0xe956('0x1b'),'uri':_0x50da90+_0xe956('0x1c'),'form':{'grant_type':_0xe956('0x1d'),'client_id':_0x41d3e2[_0xe956('0x1e')],'client_secret':_0x41d3e2[_0xe956('0x11')],'redirect_uri':_0x41d3e2['serverUrl'],'code':_0x41d3e2['code']},'headers':{'Content-Type':_0xe956('0x1f')}};return rp(_0xafeabc)['then'](function(_0x2b1f57){var _0x5ce2f2=JSON[_0xe956('0x20')](_0x2b1f57);if(_0x5ce2f2['refresh_token']){_0x41d3e2[_0xe956('0x21')]=_0x5ce2f2[_0xe956('0x22')];logger[_0xe956('0x23')](util[_0xe956('0x24')](_0xe956('0x25'),_0x41d3e2[_0xe956('0x26')],_0x41d3e2['id']));}else{logger[_0xe956('0x27')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x41d3e2[_0xe956('0x26')],_0x41d3e2['id']),util[_0xe956('0x28')](_0x5ce2f2,{'showHidden':![],'depth':null}));}return _0x5a3959(null,_0x14b0e6);})[_0xe956('0x29')](function(_0x25efdc){logger['error'](util[_0xe956('0x24')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x41d3e2[_0xe956('0x26')],_0x41d3e2['id']),util[_0xe956('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x5a3959(_0x25efdc);});}else{return _0x5a3959(null,_0x14b0e6);}},'beforeUpdate':function(_0x5bcb99,_0x4d5ca2,_0x5c3433){if(_0x5bcb99[_0xe956('0xe')]('zone')||_0x5bcb99['changed'](_0xe956('0x10'))||_0x5bcb99[_0xe956('0xe')](_0xe956('0x1e'))||_0x5bcb99[_0xe956('0xe')](_0xe956('0x11'))||_0x5bcb99[_0xe956('0xe')](_0xe956('0x2a'))||_0x5bcb99[_0xe956('0xe')]('host')){var _0xdb659,_0x2e7e13;_0xdb659=_0x5bcb99[_0xe956('0x10')];var _0x3496c6=_0xdb659['slice'](-0x1);if(_0x3496c6==='/'||_0x3496c6==='\x5c'||_0x3496c6===':'){_0xdb659=_0xdb659['substring'](0x0,_0xdb659[_0xe956('0x15')](_0x3496c6));}switch(_0x5bcb99[_0xe956('0xf')]){case'US':_0x2e7e13=_0xe956('0x16');break;case'AU':_0x2e7e13=_0xe956('0x17');break;case'IN':_0x2e7e13=_0xe956('0x18');break;case'CN':_0x2e7e13='https://accounts.zoho.com.cn';break;default:_0x2e7e13='https://accounts.zoho.eu';break;}var _0x513d5e={'method':'POST','uri':_0x2e7e13+_0xe956('0x1c'),'form':{'grant_type':_0xe956('0x1d'),'client_id':_0x5bcb99[_0xe956('0x1e')],'client_secret':_0x5bcb99[_0xe956('0x11')],'redirect_uri':_0x5bcb99['serverUrl'],'code':_0x5bcb99[_0xe956('0x2a')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x513d5e)[_0xe956('0x2b')](function(_0x436f9e){var _0x133533=JSON[_0xe956('0x20')](_0x436f9e);if(_0x133533[_0xe956('0x22')]){_0x5bcb99['refreshToken']=_0x133533[_0xe956('0x22')];logger[_0xe956('0x23')](util['format'](_0xe956('0x25'),_0x5bcb99[_0xe956('0x26')],_0x5bcb99['id']));}else{logger[_0xe956('0x27')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5bcb99[_0xe956('0x26')],_0x5bcb99['id']),util[_0xe956('0x28')](_0x133533,{'showHidden':![],'depth':null}));}return _0x5c3433(null,_0x4d5ca2);})[_0xe956('0x29')](function(_0xe14fe0){logger[_0xe956('0x27')](util[_0xe956('0x24')](_0xe956('0x2c'),_0x5bcb99['name'],_0x5bcb99['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x5c3433(_0xe14fe0);});}else{return _0x5c3433(null,_0x4d5ca2);}}}});}; \ No newline at end of file +var _0x5cb8=['https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','parse','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','error','inspect','https://accounts.zoho.com','POST','catch','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x5cb8,0xc8));var _0x85cb=function(_0x24deb1,_0x5e7460){_0x24deb1=_0x24deb1-0x0;var _0x4fcd6c=_0x5cb8[_0x24deb1];return _0x4fcd6c;};'use strict';var _=require(_0x85cb('0x0'));var util=require(_0x85cb('0x1'));var logger=require(_0x85cb('0x2'))(_0x85cb('0x3'));var moment=require(_0x85cb('0x4'));var BPromise=require(_0x85cb('0x5'));var rp=require(_0x85cb('0x6'));var fs=require('fs');var path=require(_0x85cb('0x7'));var rimraf=require(_0x85cb('0x8'));var config=require(_0x85cb('0x9'));var attributes=require(_0x85cb('0xa'));var integrations=require(_0x85cb('0xb'));module[_0x85cb('0xc')]=function(_0xb36765,_0x19cf89){return _0xb36765[_0x85cb('0xd')]('ZohoAccount',attributes,{'tableName':_0x85cb('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x41ee0b,_0x36f09d,_0x27ca3c){if(_0x41ee0b[_0x85cb('0xf')](_0x85cb('0x10'))||_0x41ee0b[_0x85cb('0xf')](_0x85cb('0x11'))||_0x41ee0b['changed'](_0x85cb('0x12'))||_0x41ee0b[_0x85cb('0xf')](_0x85cb('0x13'))||_0x41ee0b[_0x85cb('0xf')](_0x85cb('0x14'))||_0x41ee0b[_0x85cb('0xf')](_0x85cb('0x15'))){var _0x2ef7f8,_0x8c51a0;_0x2ef7f8=_0x41ee0b[_0x85cb('0x11')];var _0x3171d4=_0x2ef7f8[_0x85cb('0x16')](-0x1);if(_0x3171d4==='/'||_0x3171d4==='\x5c'||_0x3171d4===':'){_0x2ef7f8=_0x2ef7f8[_0x85cb('0x17')](0x0,_0x2ef7f8[_0x85cb('0x18')](_0x3171d4));}switch(_0x41ee0b[_0x85cb('0x10')]){case'US':_0x8c51a0='https://accounts.zoho.com';break;case'AU':_0x8c51a0=_0x85cb('0x19');break;case'IN':_0x8c51a0=_0x85cb('0x1a');break;case'CN':_0x8c51a0=_0x85cb('0x1b');break;default:_0x8c51a0=_0x85cb('0x1c');break;}var _0x612fc2={'method':'POST','uri':_0x8c51a0+_0x85cb('0x1d'),'form':{'grant_type':_0x85cb('0x1e'),'client_id':_0x41ee0b[_0x85cb('0x12')],'client_secret':_0x41ee0b['clientSecret'],'redirect_uri':_0x41ee0b['serverUrl'],'code':_0x41ee0b[_0x85cb('0x14')]},'headers':{'Content-Type':_0x85cb('0x1f')}};return rp(_0x612fc2)['then'](function(_0x1bd186){var _0x434adf=JSON[_0x85cb('0x20')](_0x1bd186);if(_0x434adf['refresh_token']){_0x41ee0b[_0x85cb('0x21')]=_0x434adf[_0x85cb('0x22')];logger[_0x85cb('0x23')](util[_0x85cb('0x24')](_0x85cb('0x25'),_0x41ee0b[_0x85cb('0x26')],_0x41ee0b['id']));}else{logger['error'](util[_0x85cb('0x24')](_0x85cb('0x27'),_0x41ee0b[_0x85cb('0x26')],_0x41ee0b['id']),util['inspect'](_0x434adf,{'showHidden':![],'depth':null}));}return _0x27ca3c(null,_0x36f09d);})['catch'](function(_0x5691e0){logger[_0x85cb('0x28')](util[_0x85cb('0x24')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x41ee0b[_0x85cb('0x26')],_0x41ee0b['id']),util[_0x85cb('0x29')](parsedResult,{'showHidden':![],'depth':null}));return _0x27ca3c(_0x5691e0);});}else{return _0x27ca3c(null,_0x36f09d);}},'beforeUpdate':function(_0x1571f9,_0x73c548,_0x4f4d64){if(_0x1571f9[_0x85cb('0xf')](_0x85cb('0x10'))||_0x1571f9['changed'](_0x85cb('0x11'))||_0x1571f9[_0x85cb('0xf')](_0x85cb('0x12'))||_0x1571f9[_0x85cb('0xf')](_0x85cb('0x13'))||_0x1571f9[_0x85cb('0xf')](_0x85cb('0x14'))||_0x1571f9[_0x85cb('0xf')](_0x85cb('0x15'))){var _0x54baa4,_0x1b30fd;_0x54baa4=_0x1571f9[_0x85cb('0x11')];var _0x3ed7c1=_0x54baa4[_0x85cb('0x16')](-0x1);if(_0x3ed7c1==='/'||_0x3ed7c1==='\x5c'||_0x3ed7c1===':'){_0x54baa4=_0x54baa4[_0x85cb('0x17')](0x0,_0x54baa4[_0x85cb('0x18')](_0x3ed7c1));}switch(_0x1571f9['zone']){case'US':_0x1b30fd=_0x85cb('0x2a');break;case'AU':_0x1b30fd='https://accounts.zoho.com.au';break;case'IN':_0x1b30fd=_0x85cb('0x1a');break;case'CN':_0x1b30fd=_0x85cb('0x1b');break;default:_0x1b30fd=_0x85cb('0x1c');break;}var _0x2eb9e8={'method':_0x85cb('0x2b'),'uri':_0x1b30fd+_0x85cb('0x1d'),'form':{'grant_type':_0x85cb('0x1e'),'client_id':_0x1571f9[_0x85cb('0x12')],'client_secret':_0x1571f9[_0x85cb('0x13')],'redirect_uri':_0x1571f9[_0x85cb('0x11')],'code':_0x1571f9[_0x85cb('0x14')]},'headers':{'Content-Type':_0x85cb('0x1f')}};return rp(_0x2eb9e8)['then'](function(_0x3b4404){var _0xbb3aa1=JSON[_0x85cb('0x20')](_0x3b4404);if(_0xbb3aa1[_0x85cb('0x22')]){_0x1571f9['refreshToken']=_0xbb3aa1['refresh_token'];logger[_0x85cb('0x23')](util[_0x85cb('0x24')](_0x85cb('0x25'),_0x1571f9[_0x85cb('0x26')],_0x1571f9['id']));}else{logger[_0x85cb('0x28')](util[_0x85cb('0x24')](_0x85cb('0x27'),_0x1571f9['name'],_0x1571f9['id']),util[_0x85cb('0x29')](_0xbb3aa1,{'showHidden':![],'depth':null}));}return _0x4f4d64(null,_0x73c548);})[_0x85cb('0x2c')](function(_0x234d77){logger[_0x85cb('0x28')](util['format'](_0x85cb('0x27'),_0x1571f9[_0x85cb('0x26')],_0x1571f9['id']),util[_0x85cb('0x29')](parsedResult,{'showHidden':![],'depth':null}));return _0x4f4d64(_0x234d77);});}else{return _0x4f4d64(null,_0x73c548);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 4d35721..44a39bf 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 _0xc103=['http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','findAll','options','include','map','model','attributes','then','ShowZohoAccount','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4ba9df,_0x2dacb0){var _0x1307bc=function(_0x201c19){while(--_0x201c19){_0x4ba9df['push'](_0x4ba9df['shift']());}};_0x1307bc(++_0x2dacb0);}(_0xc103,0x7e));var _0x3c10=function(_0xda640d,_0xb7dff){_0xda640d=_0xda640d-0x0;var _0x3830c6=_0xc103[_0xda640d];return _0x3830c6;};'use strict';var _=require(_0x3c10('0x0'));var util=require('util');var moment=require(_0x3c10('0x1'));var BPromise=require(_0x3c10('0x2'));var rs=require(_0x3c10('0x3'));var fs=require('fs');var Redis=require(_0x3c10('0x4'));var db=require(_0x3c10('0x5'))['db'];var utils=require(_0x3c10('0x6'));var logger=require('../../config/logger')(_0x3c10('0x7'));var config=require(_0x3c10('0x8'));var jayson=require(_0x3c10('0x9'));var client=jayson['client'][_0x3c10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b2d4c,_0x1212eb,_0x46685d){return new BPromise(function(_0x3748b1,_0x5f1a4f){return client[_0x3c10('0xb')](_0x4b2d4c,_0x46685d)['then'](function(_0x4449b5){logger[_0x3c10('0xc')](_0x3c10('0xd'),_0x1212eb,_0x3c10('0xe'));logger[_0x3c10('0xf')](_0x3c10('0x10'),_0x1212eb,_0x3c10('0xe'),JSON[_0x3c10('0x11')](_0x4449b5));if(_0x4449b5[_0x3c10('0x12')]){if(_0x4449b5[_0x3c10('0x12')][_0x3c10('0x13')]===0x1f4){logger[_0x3c10('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x1212eb,_0x4449b5[_0x3c10('0x12')]['message']);return _0x5f1a4f(_0x4449b5['error'][_0x3c10('0x14')]);}logger[_0x3c10('0x12')](_0x3c10('0xd'),_0x1212eb,_0x4449b5[_0x3c10('0x12')]['message']);return _0x3748b1(_0x4449b5[_0x3c10('0x12')][_0x3c10('0x14')]);}else{logger[_0x3c10('0xc')](_0x3c10('0xd'),_0x1212eb,'request\x20sent');_0x3748b1(_0x4449b5[_0x3c10('0x15')][_0x3c10('0x14')]);}})[_0x3c10('0x16')](function(_0x2d524d){logger[_0x3c10('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x1212eb,_0x2d524d);_0x5f1a4f(_0x2d524d);});});}exports[_0x3c10('0x17')]=function(_0x368765){var _0x28598d=this;return new Promise(function(_0x48b5d8,_0x1675a4){return db['ZohoAccount'][_0x3c10('0x18')]({'raw':_0x368765[_0x3c10('0x19')]?_0x368765['options']['raw']===undefined?!![]:![]:!![],'where':_0x368765['options']?_0x368765[_0x3c10('0x19')]['where']||null:null,'attributes':_0x368765[_0x3c10('0x19')]?_0x368765[_0x3c10('0x19')]['attributes']||null:null,'limit':_0x368765[_0x3c10('0x19')]?_0x368765['options']['limit']||null:null,'include':_0x368765[_0x3c10('0x19')]?_0x368765[_0x3c10('0x19')][_0x3c10('0x1a')]?_[_0x3c10('0x1b')](_0x368765[_0x3c10('0x19')][_0x3c10('0x1a')],function(_0xf7a763){return{'model':db[_0xf7a763[_0x3c10('0x1c')]],'as':_0xf7a763['as'],'attributes':_0xf7a763[_0x3c10('0x1d')],'include':_0xf7a763['include']?_[_0x3c10('0x1b')](_0xf7a763[_0x3c10('0x1a')],function(_0x39e953){return{'model':db[_0x39e953[_0x3c10('0x1c')]],'as':_0x39e953['as'],'attributes':_0x39e953[_0x3c10('0x1d')],'include':_0x39e953[_0x3c10('0x1a')]?_[_0x3c10('0x1b')](_0x39e953['include'],function(_0x4d8507){return{'model':db[_0x4d8507[_0x3c10('0x1c')]],'as':_0x4d8507['as'],'attributes':_0x4d8507['attributes']};}):[]};}):[]};}):[]:[]})[_0x3c10('0x1e')](function(_0x39c775){logger[_0x3c10('0xc')]('GetZohoAccount',_0x368765);logger[_0x3c10('0xf')](_0x3c10('0x17'),_0x368765,JSON[_0x3c10('0x11')](_0x39c775));_0x48b5d8(_0x39c775);})['catch'](function(_0x402098){logger['error']('GetZohoAccount',_0x402098['message'],_0x368765);_0x1675a4(_0x28598d[_0x3c10('0x12')](0x1f4,_0x402098[_0x3c10('0x14')]));});});};exports[_0x3c10('0x1f')]=function(_0x5964f1){var _0x4c8fd8=this;return new Promise(function(_0x544a14,_0x4c35d6){return db['ZohoAccount'][_0x3c10('0x20')]({'raw':_0x5964f1['options']?_0x5964f1[_0x3c10('0x19')][_0x3c10('0x21')]===undefined?!![]:![]:!![],'where':_0x5964f1[_0x3c10('0x19')]?_0x5964f1[_0x3c10('0x19')]['where']||null:null,'attributes':_0x5964f1[_0x3c10('0x19')]?_0x5964f1[_0x3c10('0x19')][_0x3c10('0x1d')]||null:null,'include':_0x5964f1[_0x3c10('0x19')]?_0x5964f1[_0x3c10('0x19')][_0x3c10('0x1a')]?_[_0x3c10('0x1b')](_0x5964f1[_0x3c10('0x19')]['include'],function(_0x2d2d7b){return{'model':db[_0x2d2d7b[_0x3c10('0x1c')]],'as':_0x2d2d7b['as'],'attributes':_0x2d2d7b[_0x3c10('0x1d')],'include':_0x2d2d7b[_0x3c10('0x1a')]?_['map'](_0x2d2d7b[_0x3c10('0x1a')],function(_0x5e3004){return{'model':db[_0x5e3004[_0x3c10('0x1c')]],'as':_0x5e3004['as'],'attributes':_0x5e3004['attributes'],'include':_0x5e3004[_0x3c10('0x1a')]?_[_0x3c10('0x1b')](_0x5e3004['include'],function(_0x371fd8){return{'model':db[_0x371fd8[_0x3c10('0x1c')]],'as':_0x371fd8['as'],'attributes':_0x371fd8[_0x3c10('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3c10('0x1e')](function(_0x486e1f){logger[_0x3c10('0xc')]('ShowZohoAccount',_0x5964f1);logger[_0x3c10('0xf')]('ShowZohoAccount',_0x5964f1,JSON[_0x3c10('0x11')](_0x486e1f));_0x544a14(_0x486e1f);})[_0x3c10('0x16')](function(_0x5eae32){logger[_0x3c10('0x12')](_0x3c10('0x1f'),_0x5eae32[_0x3c10('0x14')],_0x5964f1);_0x4c35d6(_0x4c8fd8[_0x3c10('0x12')](0x1f4,_0x5eae32[_0x3c10('0x14')]));});});}; \ No newline at end of file +var _0x3f0a=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','limit','include','model','map','stringify','ShowZohoAccount','raw'];(function(_0x3032e5,_0x1bce9f){var _0xf2ff47=function(_0x3dd401){while(--_0x3dd401){_0x3032e5['push'](_0x3032e5['shift']());}};_0xf2ff47(++_0x1bce9f);}(_0x3f0a,0x132));var _0xa3f0=function(_0x45b0e0,_0x29729c){_0x45b0e0=_0x45b0e0-0x0;var _0x6aefba=_0x3f0a[_0x45b0e0];return _0x6aefba;};'use strict';var _=require(_0xa3f0('0x0'));var util=require(_0xa3f0('0x1'));var moment=require(_0xa3f0('0x2'));var BPromise=require(_0xa3f0('0x3'));var rs=require(_0xa3f0('0x4'));var fs=require('fs');var Redis=require(_0xa3f0('0x5'));var db=require(_0xa3f0('0x6'))['db'];var utils=require(_0xa3f0('0x7'));var logger=require(_0xa3f0('0x8'))(_0xa3f0('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa3f0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x64e869,_0x44ad88,_0x2040fc){return new BPromise(function(_0x216290,_0x402298){return client['request'](_0x64e869,_0x2040fc)[_0xa3f0('0xb')](function(_0xd63e36){logger['info'](_0xa3f0('0xc'),_0x44ad88,_0xa3f0('0xd'));logger[_0xa3f0('0xe')](_0xa3f0('0xf'),_0x44ad88,_0xa3f0('0xd'),JSON['stringify'](_0xd63e36));if(_0xd63e36[_0xa3f0('0x10')]){if(_0xd63e36['error'][_0xa3f0('0x11')]===0x1f4){logger['error'](_0xa3f0('0xc'),_0x44ad88,_0xd63e36[_0xa3f0('0x10')][_0xa3f0('0x12')]);return _0x402298(_0xd63e36[_0xa3f0('0x10')][_0xa3f0('0x12')]);}logger[_0xa3f0('0x10')](_0xa3f0('0xc'),_0x44ad88,_0xd63e36['error'][_0xa3f0('0x12')]);return _0x216290(_0xd63e36[_0xa3f0('0x10')][_0xa3f0('0x12')]);}else{logger[_0xa3f0('0x13')](_0xa3f0('0xc'),_0x44ad88,_0xa3f0('0xd'));_0x216290(_0xd63e36['result']['message']);}})[_0xa3f0('0x14')](function(_0x3ff77d){logger[_0xa3f0('0x10')](_0xa3f0('0xc'),_0x44ad88,_0x3ff77d);_0x402298(_0x3ff77d);});});}exports[_0xa3f0('0x15')]=function(_0x3aa82b){var _0x54dd8e=this;return new Promise(function(_0x443cd3,_0x389885){return db[_0xa3f0('0x16')][_0xa3f0('0x17')]({'raw':_0x3aa82b[_0xa3f0('0x18')]?_0x3aa82b[_0xa3f0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3aa82b['options']?_0x3aa82b['options'][_0xa3f0('0x19')]||null:null,'attributes':_0x3aa82b[_0xa3f0('0x18')]?_0x3aa82b['options'][_0xa3f0('0x1a')]||null:null,'limit':_0x3aa82b[_0xa3f0('0x18')]?_0x3aa82b['options'][_0xa3f0('0x1b')]||null:null,'include':_0x3aa82b['options']?_0x3aa82b[_0xa3f0('0x18')][_0xa3f0('0x1c')]?_['map'](_0x3aa82b[_0xa3f0('0x18')]['include'],function(_0x57d720){return{'model':db[_0x57d720[_0xa3f0('0x1d')]],'as':_0x57d720['as'],'attributes':_0x57d720[_0xa3f0('0x1a')],'include':_0x57d720[_0xa3f0('0x1c')]?_[_0xa3f0('0x1e')](_0x57d720[_0xa3f0('0x1c')],function(_0x642555){return{'model':db[_0x642555[_0xa3f0('0x1d')]],'as':_0x642555['as'],'attributes':_0x642555[_0xa3f0('0x1a')],'include':_0x642555[_0xa3f0('0x1c')]?_[_0xa3f0('0x1e')](_0x642555['include'],function(_0x5e1998){return{'model':db[_0x5e1998[_0xa3f0('0x1d')]],'as':_0x5e1998['as'],'attributes':_0x5e1998['attributes']};}):[]};}):[]};}):[]:[]})[_0xa3f0('0xb')](function(_0x1a46c8){logger[_0xa3f0('0x13')](_0xa3f0('0x15'),_0x3aa82b);logger[_0xa3f0('0xe')](_0xa3f0('0x15'),_0x3aa82b,JSON[_0xa3f0('0x1f')](_0x1a46c8));_0x443cd3(_0x1a46c8);})['catch'](function(_0x3977d6){logger[_0xa3f0('0x10')]('GetZohoAccount',_0x3977d6[_0xa3f0('0x12')],_0x3aa82b);_0x389885(_0x54dd8e[_0xa3f0('0x10')](0x1f4,_0x3977d6['message']));});});};exports[_0xa3f0('0x20')]=function(_0x5d85ab){var _0x3dd38f=this;return new Promise(function(_0x2d8447,_0x218589){return db[_0xa3f0('0x16')]['find']({'raw':_0x5d85ab['options']?_0x5d85ab[_0xa3f0('0x18')][_0xa3f0('0x21')]===undefined?!![]:![]:!![],'where':_0x5d85ab[_0xa3f0('0x18')]?_0x5d85ab[_0xa3f0('0x18')][_0xa3f0('0x19')]||null:null,'attributes':_0x5d85ab[_0xa3f0('0x18')]?_0x5d85ab[_0xa3f0('0x18')][_0xa3f0('0x1a')]||null:null,'include':_0x5d85ab['options']?_0x5d85ab[_0xa3f0('0x18')][_0xa3f0('0x1c')]?_[_0xa3f0('0x1e')](_0x5d85ab[_0xa3f0('0x18')][_0xa3f0('0x1c')],function(_0xc10f0a){return{'model':db[_0xc10f0a[_0xa3f0('0x1d')]],'as':_0xc10f0a['as'],'attributes':_0xc10f0a[_0xa3f0('0x1a')],'include':_0xc10f0a['include']?_[_0xa3f0('0x1e')](_0xc10f0a['include'],function(_0x63de0a){return{'model':db[_0x63de0a[_0xa3f0('0x1d')]],'as':_0x63de0a['as'],'attributes':_0x63de0a[_0xa3f0('0x1a')],'include':_0x63de0a['include']?_['map'](_0x63de0a[_0xa3f0('0x1c')],function(_0x370f1f){return{'model':db[_0x370f1f[_0xa3f0('0x1d')]],'as':_0x370f1f['as'],'attributes':_0x370f1f[_0xa3f0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa3f0('0xb')](function(_0x2675ec){logger[_0xa3f0('0x13')](_0xa3f0('0x20'),_0x5d85ab);logger[_0xa3f0('0xe')](_0xa3f0('0x20'),_0x5d85ab,JSON[_0xa3f0('0x1f')](_0x2675ec));_0x2d8447(_0x2675ec);})[_0xa3f0('0x14')](function(_0x5dac48){logger[_0xa3f0('0x10')](_0xa3f0('0x20'),_0x5dac48[_0xa3f0('0x12')],_0x5d85ab);_0x218589(_0x3dd38f[_0xa3f0('0x10')](0x1f4,_0x5dac48[_0xa3f0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index d8d05f6..17e550e 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 _0xb458=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete'];(function(_0x4f8a41,_0x19cd53){var _0x10d1f9=function(_0x4df5b7){while(--_0x4df5b7){_0x4f8a41['push'](_0x4f8a41['shift']());}};_0x10d1f9(++_0x19cd53);}(_0xb458,0xca));var _0x8b45=function(_0x1b0452,_0x3c69a5){_0x1b0452=_0x1b0452-0x0;var _0x140bb1=_0xb458[_0x1b0452];return _0x140bb1;};'use strict';var multer=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var timeout=require(_0x8b45('0x3'));var express=require('express');var router=express[_0x8b45('0x4')]();var auth=require(_0x8b45('0x5'));var interaction=require(_0x8b45('0x6'));var config=require(_0x8b45('0x7'));var controller=require(_0x8b45('0x8'));router[_0x8b45('0x9')]('/',auth[_0x8b45('0xa')](),controller[_0x8b45('0xb')]);router[_0x8b45('0x9')](_0x8b45('0xc'),auth[_0x8b45('0xa')](),controller[_0x8b45('0xd')]);router[_0x8b45('0x9')]('/:id/fields',auth[_0x8b45('0xa')](),controller['getFields']);router['get'](_0x8b45('0xe'),auth[_0x8b45('0xa')](),controller[_0x8b45('0xf')]);router['get'](_0x8b45('0x10'),auth['isAuthenticated'](),controller[_0x8b45('0x11')]);router[_0x8b45('0x12')]('/',auth[_0x8b45('0xa')](),controller[_0x8b45('0x13')]);router[_0x8b45('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x8b45('0x15')]);router[_0x8b45('0x16')](_0x8b45('0xc'),auth[_0x8b45('0xa')](),controller[_0x8b45('0x17')]);module[_0x8b45('0x18')]=router; \ No newline at end of file +var _0x5525=['update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','post','create','put'];(function(_0x5f3510,_0x514682){var _0x39b160=function(_0x1fbaa5){while(--_0x1fbaa5){_0x5f3510['push'](_0x5f3510['shift']());}};_0x39b160(++_0x514682);}(_0x5525,0xd1));var _0x5552=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5525[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x5552('0x0'));var util=require(_0x5552('0x1'));var path=require(_0x5552('0x2'));var timeout=require(_0x5552('0x3'));var express=require(_0x5552('0x4'));var router=express[_0x5552('0x5')]();var auth=require(_0x5552('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5552('0x7'));var controller=require(_0x5552('0x8'));router['get']('/',auth[_0x5552('0x9')](),controller[_0x5552('0xa')]);router[_0x5552('0xb')](_0x5552('0xc'),auth[_0x5552('0x9')](),controller[_0x5552('0xd')]);router[_0x5552('0xb')](_0x5552('0xe'),auth['isAuthenticated'](),controller[_0x5552('0xf')]);router['get'](_0x5552('0x10'),auth['isAuthenticated'](),controller[_0x5552('0x11')]);router['get']('/:id/descriptions',auth[_0x5552('0x9')](),controller['getDescriptions']);router[_0x5552('0x12')]('/',auth[_0x5552('0x9')](),controller[_0x5552('0x13')]);router[_0x5552('0x14')](_0x5552('0xc'),auth['isAuthenticated'](),controller[_0x5552('0x15')]);router['delete']('/:id',auth[_0x5552('0x9')](),controller[_0x5552('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 5c1369a..dc87024 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 _0xd04d=['ENUM','lead','contact','nothing','contact_lead','sequelize','exports','STRING'];(function(_0x43d872,_0x246d0c){var _0x4f1ca8=function(_0x5643d7){while(--_0x5643d7){_0x43d872['push'](_0x43d872['shift']());}};_0x4f1ca8(++_0x246d0c);}(_0xd04d,0x165));var _0xdd04=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd04d[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xdd04('0x0'));module[_0xdd04('0x1')]={'name':{'type':Sequelize[_0xdd04('0x2')]},'moduleCreate':{'type':Sequelize[_0xdd04('0x3')](_0xdd04('0x4'),_0xdd04('0x5'),_0xdd04('0x6')),'defaultValue':_0xdd04('0x4')},'moduleSearch':{'type':Sequelize[_0xdd04('0x3')]('contact_lead',_0xdd04('0x5'),_0xdd04('0x4')),'defaultValue':_0xdd04('0x7')},'description':{'type':Sequelize[_0xdd04('0x2')]}}; \ No newline at end of file +var _0x5729=['lead','contact','nothing','contact_lead','exports','STRING','ENUM'];(function(_0x3d6821,_0x18b38a){var _0x3062ba=function(_0x51aa68){while(--_0x51aa68){_0x3d6821['push'](_0x3d6821['shift']());}};_0x3062ba(++_0x18b38a);}(_0x5729,0x1cb));var _0x9572=function(_0x67b97a,_0x503a86){_0x67b97a=_0x67b97a-0x0;var _0x1c50b2=_0x5729[_0x67b97a];return _0x1c50b2;};'use strict';var Sequelize=require('sequelize');module[_0x9572('0x0')]={'name':{'type':Sequelize[_0x9572('0x1')]},'moduleCreate':{'type':Sequelize[_0x9572('0x2')](_0x9572('0x3'),_0x9572('0x4'),_0x9572('0x5')),'defaultValue':_0x9572('0x3')},'moduleSearch':{'type':Sequelize[_0x9572('0x2')](_0x9572('0x6'),_0x9572('0x4'),_0x9572('0x3')),'defaultValue':_0x9572('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 1b789db..43992af 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 _0x5075=['sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','getFields','ZohoField','rawAttributes','getSubjects','findOne','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','ZohoConfiguration','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order'];(function(_0x4dec3b,_0x1acb3d){var _0x76fe18=function(_0x5f5b17){while(--_0x5f5b17){_0x4dec3b['push'](_0x4dec3b['shift']());}};_0x76fe18(++_0x1acb3d);}(_0x5075,0x73));var _0x5507=function(_0x5046cf,_0x44c493){_0x5046cf=_0x5046cf-0x0;var _0x2fb819=_0x5075[_0x5046cf];return _0x2fb819;};'use strict';var pdf=require(_0x5507('0x0'));var emlformat=require(_0x5507('0x1'));var rimraf=require(_0x5507('0x2'));var zipdir=require(_0x5507('0x3'));var jsonpatch=require(_0x5507('0x4'));var rp=require(_0x5507('0x5'));var moment=require(_0x5507('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x5507('0x7'));var util=require(_0x5507('0x8'));var path=require(_0x5507('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5507('0xa'));var fs=require('fs');var _=require(_0x5507('0xb'));var squel=require('squel');var crypto=require(_0x5507('0xc'));var jsforce=require(_0x5507('0xd'));var deskjs=require(_0x5507('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5507('0xf'));var Redis=require(_0x5507('0x10'));var authService=require(_0x5507('0x11'));var qs=require(_0x5507('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5507('0x13'));var logger=require(_0x5507('0x14'))('api');var utils=require(_0x5507('0x15'));var config=require(_0x5507('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5507('0x17'))['db'];var jayson=require(_0x5507('0x18'));var client=jayson[_0x5507('0x19')][_0x5507('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x13b60a,_0x1f3886,_0x59889b,_0x9cc3f9){return new BPromise(function(_0x2b7c43,_0xc828e5){var _0x46545d=_0x9cc3f9||client;return _0x46545d['request'](_0x13b60a,_0x59889b)[_0x5507('0x1b')](function(_0x10d7b9){logger[_0x5507('0x1c')](_0x5507('0x1d'),_0x1f3886,_0x5507('0x1e'));logger[_0x5507('0x1f')](_0x5507('0x20'),_0x1f3886,_0x5507('0x1e'),JSON[_0x5507('0x21')](_0x10d7b9));if(_0x10d7b9[_0x5507('0x22')]){if(_0x10d7b9[_0x5507('0x22')][_0x5507('0x23')]===0x1f4){logger[_0x5507('0x22')]('ZohoConfiguration,\x20%s,\x20%s',_0x1f3886,_0x10d7b9[_0x5507('0x22')][_0x5507('0x24')]);return _0xc828e5(_0x10d7b9[_0x5507('0x22')][_0x5507('0x24')]);}logger['error'](_0x5507('0x1d'),_0x1f3886,_0x10d7b9[_0x5507('0x22')][_0x5507('0x24')]);return _0x2b7c43(_0x10d7b9[_0x5507('0x22')][_0x5507('0x24')]);}else{logger[_0x5507('0x1c')]('ZohoConfiguration,\x20%s,\x20%s',_0x1f3886,_0x5507('0x1e'));_0x2b7c43(_0x10d7b9[_0x5507('0x25')][_0x5507('0x24')]);}})[_0x5507('0x26')](function(_0x141d22){logger[_0x5507('0x22')](_0x5507('0x1d'),_0x1f3886,_0x141d22);_0xc828e5(_0x141d22);});});}function respondWithStatusCode(_0x10f149,_0x398911){_0x398911=_0x398911||0xcc;return function(_0xa47641){if(_0xa47641){return _0x10f149[_0x5507('0x27')](_0x398911);}return _0x10f149[_0x5507('0x28')](_0x398911)[_0x5507('0x29')]();};}function respondWithResult(_0x2ee6ed,_0x1a2203){_0x1a2203=_0x1a2203||0xc8;return function(_0x4915ed){if(_0x4915ed){return _0x2ee6ed[_0x5507('0x28')](_0x1a2203)['json'](_0x4915ed);}};}function respondWithFilteredResult(_0x26335e,_0x4ea271){return function(_0xa66a01){if(_0xa66a01){var _0x24668b=_0xa66a01[_0x5507('0x2a')],_0x4beb0a=_0x4ea271['offset'],_0x5cbb09=_0x4ea271[_0x5507('0x2b')]+_0x4ea271[_0x5507('0x2c')],_0xbe8d32;if(_0x5cbb09>=_0x24668b){_0x5cbb09=_0x24668b;_0xbe8d32=0xc8;}else{_0xbe8d32=0xce;}_0x26335e[_0x5507('0x28')](_0xbe8d32);return _0x26335e[_0x5507('0x2d')](_0x5507('0x2e'),_0x4beb0a+'-'+_0x5cbb09+'/'+_0x24668b)[_0x5507('0x2f')](_0xa66a01);}return null;};}function patchUpdates(_0x55e889){return function(_0x4422ef){try{jsonpatch[_0x5507('0x30')](_0x4422ef,_0x55e889,!![]);}catch(_0x106b11){return BPromise[_0x5507('0x31')](_0x106b11);}return _0x4422ef[_0x5507('0x32')]();};}function saveUpdates(_0x495bbe,_0x51e692){return function(_0x3b09be){if(_0x3b09be){return _0x3b09be[_0x5507('0x33')](_0x495bbe)[_0x5507('0x1b')](function(_0x10704d){return _0x10704d;});}return null;};}function removeEntity(_0x5e6f25,_0x777eb7){return function(_0x13b6e5){if(_0x13b6e5){return _0x13b6e5[_0x5507('0x34')]()[_0x5507('0x1b')](function(){_0x5e6f25[_0x5507('0x28')](0xcc)[_0x5507('0x29')]();});}};}function handleEntityNotFound(_0x1c689e,_0x27c8c8){return function(_0x5ede36){if(!_0x5ede36){_0x1c689e[_0x5507('0x27')](0x194);}return _0x5ede36;};}function handleError(_0x423426,_0x1b69f3){_0x1b69f3=_0x1b69f3||0x1f4;return function(_0x51ca35){logger['error'](_0x51ca35[_0x5507('0x35')]);if(_0x51ca35[_0x5507('0x36')]){delete _0x51ca35[_0x5507('0x36')];}_0x423426[_0x5507('0x28')](_0x1b69f3)[_0x5507('0x37')](_0x51ca35);};}exports['index']=function(_0x5cc72c,_0x10bfb2){var _0x1f1974={},_0x3a452d={},_0x1b9115={'count':0x0,'rows':[]};var _0x5dcd57=_['map'](db[_0x5507('0x38')]['rawAttributes'],function(_0x304daf){return{'name':_0x304daf[_0x5507('0x39')],'type':_0x304daf[_0x5507('0x3a')][_0x5507('0x3b')]};});_0x3a452d[_0x5507('0x3c')]=_[_0x5507('0x3d')](_0x5dcd57,_0x5507('0x36'));_0x3a452d[_0x5507('0x3e')]=_[_0x5507('0x3f')](_0x5cc72c[_0x5507('0x3e')]);_0x3a452d['filters']=_['intersection'](_0x3a452d['model'],_0x3a452d['query']);_0x1f1974[_0x5507('0x40')]=_[_0x5507('0x41')](_0x3a452d[_0x5507('0x3c')],qs[_0x5507('0x42')](_0x5cc72c[_0x5507('0x3e')][_0x5507('0x42')]));_0x1f1974[_0x5507('0x40')]=_0x1f1974[_0x5507('0x40')][_0x5507('0x43')]?_0x1f1974[_0x5507('0x40')]:_0x3a452d[_0x5507('0x3c')];if(!_0x5cc72c[_0x5507('0x3e')][_0x5507('0x44')](_0x5507('0x45'))){_0x1f1974['limit']=qs['limit'](_0x5cc72c['query'][_0x5507('0x2c')]);_0x1f1974[_0x5507('0x2b')]=qs[_0x5507('0x2b')](_0x5cc72c[_0x5507('0x3e')][_0x5507('0x2b')]);}_0x1f1974[_0x5507('0x46')]=qs[_0x5507('0x47')](_0x5cc72c[_0x5507('0x3e')][_0x5507('0x47')]);_0x1f1974[_0x5507('0x48')]=qs[_0x5507('0x49')](_[_0x5507('0x4a')](_0x5cc72c[_0x5507('0x3e')],_0x3a452d[_0x5507('0x49')]),_0x5dcd57);if(_0x5cc72c[_0x5507('0x3e')][_0x5507('0x4b')]){_0x1f1974[_0x5507('0x48')]=_[_0x5507('0x4c')](_0x1f1974[_0x5507('0x48')],{'$or':_['map'](_0x5dcd57,function(_0x21f162){if(_0x21f162[_0x5507('0x3a')]!=='VIRTUAL'){var _0x4dc669={};_0x4dc669[_0x21f162[_0x5507('0x36')]]={'$like':'%'+_0x5cc72c[_0x5507('0x3e')][_0x5507('0x4b')]+'%'};return _0x4dc669;}})});}_0x1f1974=_[_0x5507('0x4c')]({},_0x1f1974,_0x5cc72c[_0x5507('0x4d')]);var _0x54be04={'where':_0x1f1974[_0x5507('0x48')]};return db[_0x5507('0x38')][_0x5507('0x2a')](_0x54be04)['then'](function(_0x9e8ee2){_0x1b9115[_0x5507('0x2a')]=_0x9e8ee2;if(_0x5cc72c[_0x5507('0x3e')][_0x5507('0x4e')]){_0x1f1974[_0x5507('0x4f')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x5507('0x50')](_0x1f1974);})['then'](function(_0x36c29f){_0x1b9115[_0x5507('0x51')]=_0x36c29f;return _0x1b9115;})[_0x5507('0x1b')](respondWithFilteredResult(_0x10bfb2,_0x1f1974))[_0x5507('0x26')](handleError(_0x10bfb2,null));};exports[_0x5507('0x52')]=function(_0xe2e58c,_0x418c2e){var _0x3452e4={'raw':![],'where':{'id':_0xe2e58c[_0x5507('0x53')]['id']}},_0x549cf0={};_0x549cf0[_0x5507('0x3c')]=_['keys'](db['ZohoConfiguration']['rawAttributes']);_0x549cf0[_0x5507('0x3e')]=_['keys'](_0xe2e58c[_0x5507('0x3e')]);_0x549cf0['filtears']=_[_0x5507('0x41')](_0x549cf0['model'],_0x549cf0['query']);_0x3452e4[_0x5507('0x40')]=_[_0x5507('0x41')](_0x549cf0[_0x5507('0x3c')],qs[_0x5507('0x42')](_0xe2e58c[_0x5507('0x3e')][_0x5507('0x42')]));_0x3452e4['attributes']=_0x3452e4[_0x5507('0x40')][_0x5507('0x43')]?_0x3452e4[_0x5507('0x40')]:_0x549cf0['model'];if(_0xe2e58c[_0x5507('0x3e')][_0x5507('0x4e')]){_0x3452e4[_0x5507('0x4f')]=[{'all':!![]}];}_0x3452e4=_[_0x5507('0x4c')]({},_0x3452e4,_0xe2e58c[_0x5507('0x4d')]);return db[_0x5507('0x38')][_0x5507('0x54')](_0x3452e4)[_0x5507('0x1b')](handleEntityNotFound(_0x418c2e,null))[_0x5507('0x1b')](respondWithResult(_0x418c2e,null))[_0x5507('0x26')](handleError(_0x418c2e,null));};exports[_0x5507('0x55')]=function(_0x49a2f8,_0x570928){return db[_0x5507('0x38')][_0x5507('0x55')](_0x49a2f8[_0x5507('0x56')],{})[_0x5507('0x1b')](respondWithResult(_0x570928,0xc9))[_0x5507('0x26')](handleError(_0x570928,null));};exports[_0x5507('0x33')]=function(_0x18b566,_0x2686ce){if(_0x18b566[_0x5507('0x56')]['id']){delete _0x18b566[_0x5507('0x56')]['id'];}return db[_0x5507('0x38')][_0x5507('0x54')]({'where':{'id':_0x18b566[_0x5507('0x53')]['id']}})[_0x5507('0x1b')](handleEntityNotFound(_0x2686ce,null))[_0x5507('0x1b')](saveUpdates(_0x18b566[_0x5507('0x56')],null))['then'](respondWithResult(_0x2686ce,null))[_0x5507('0x26')](handleError(_0x2686ce,null));};exports['destroy']=function(_0x5af5f5,_0x42be15){return db[_0x5507('0x38')][_0x5507('0x54')]({'where':{'id':_0x5af5f5[_0x5507('0x53')]['id']}})['then'](handleEntityNotFound(_0x42be15,null))[_0x5507('0x1b')](removeEntity(_0x42be15,null))[_0x5507('0x26')](handleError(_0x42be15,null));};exports[_0x5507('0x57')]=function(_0x34276a,_0x2a8d18,_0x3a272f){var _0x5d2881={};var _0x36b485={};var _0x46e589;var _0x3a2f9f;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x34276a[_0x5507('0x53')]['id']}})['then'](handleEntityNotFound(_0x2a8d18,null))[_0x5507('0x1b')](function(_0x1e1a65){if(_0x1e1a65){_0x46e589=_0x1e1a65;_0x36b485['model']=_[_0x5507('0x3f')](db[_0x5507('0x58')][_0x5507('0x59')]);_0x36b485[_0x5507('0x3e')]=_[_0x5507('0x3f')](_0x34276a[_0x5507('0x3e')]);_0x36b485[_0x5507('0x49')]=_[_0x5507('0x41')](_0x36b485[_0x5507('0x3c')],_0x36b485[_0x5507('0x3e')]);_0x5d2881[_0x5507('0x40')]=_[_0x5507('0x41')](_0x36b485['model'],qs[_0x5507('0x42')](_0x34276a[_0x5507('0x3e')][_0x5507('0x42')]));_0x5d2881[_0x5507('0x40')]=_0x5d2881[_0x5507('0x40')]['length']?_0x5d2881[_0x5507('0x40')]:_0x36b485['model'];_0x5d2881[_0x5507('0x46')]=qs[_0x5507('0x47')](_0x34276a[_0x5507('0x3e')]['sort']);_0x5d2881[_0x5507('0x48')]=qs[_0x5507('0x49')](_[_0x5507('0x4a')](_0x34276a['query'],_0x36b485[_0x5507('0x49')]));if(_0x34276a['query'][_0x5507('0x4b')]){_0x5d2881['where']=_['merge'](_0x5d2881[_0x5507('0x48')],{'$or':_[_0x5507('0x3d')](_0x5d2881[_0x5507('0x40')],function(_0x144107){var _0x2d7729={};_0x2d7729[_0x144107]={'$like':'%'+_0x34276a[_0x5507('0x3e')]['filter']+'%'};return _0x2d7729;})});}_0x5d2881=_['merge']({},_0x5d2881,_0x34276a[_0x5507('0x4d')]);return _0x46e589[_0x5507('0x57')](_0x5d2881);}})[_0x5507('0x1b')](function(_0x18fc17){if(_0x18fc17){_0x3a2f9f=_0x18fc17['length'];if(!_0x34276a[_0x5507('0x3e')][_0x5507('0x44')](_0x5507('0x45'))){_0x5d2881[_0x5507('0x2c')]=qs[_0x5507('0x2c')](_0x34276a[_0x5507('0x3e')][_0x5507('0x2c')]);_0x5d2881['offset']=qs[_0x5507('0x2b')](_0x34276a[_0x5507('0x3e')][_0x5507('0x2b')]);}return _0x46e589['getFields'](_0x5d2881);}})[_0x5507('0x1b')](function(_0x4d3f1a){if(_0x4d3f1a){return _0x4d3f1a?{'count':_0x3a2f9f,'rows':_0x4d3f1a}:null;}})['then'](respondWithResult(_0x2a8d18,null))['catch'](handleError(_0x2a8d18,null));};exports[_0x5507('0x5a')]=function(_0x158f22,_0xb622bd,_0x10e409){var _0x399370={};var _0xebaa44={};var _0x21d76b;var _0x4ce21e;return db[_0x5507('0x38')]['findOne']({'where':{'id':_0x158f22[_0x5507('0x53')]['id']}})[_0x5507('0x1b')](handleEntityNotFound(_0xb622bd,null))[_0x5507('0x1b')](function(_0x98768c){if(_0x98768c){_0x21d76b=_0x98768c;_0xebaa44[_0x5507('0x3c')]=_[_0x5507('0x3f')](db[_0x5507('0x58')][_0x5507('0x59')]);_0xebaa44[_0x5507('0x3e')]=_[_0x5507('0x3f')](_0x158f22[_0x5507('0x3e')]);_0xebaa44['filters']=_[_0x5507('0x41')](_0xebaa44[_0x5507('0x3c')],_0xebaa44[_0x5507('0x3e')]);_0x399370['attributes']=_[_0x5507('0x41')](_0xebaa44[_0x5507('0x3c')],qs['fields'](_0x158f22[_0x5507('0x3e')]['fields']));_0x399370['attributes']=_0x399370[_0x5507('0x40')]['length']?_0x399370[_0x5507('0x40')]:_0xebaa44[_0x5507('0x3c')];_0x399370[_0x5507('0x46')]=qs[_0x5507('0x47')](_0x158f22[_0x5507('0x3e')][_0x5507('0x47')]);_0x399370['where']=qs[_0x5507('0x49')](_[_0x5507('0x4a')](_0x158f22[_0x5507('0x3e')],_0xebaa44[_0x5507('0x49')]));if(_0x158f22[_0x5507('0x3e')][_0x5507('0x4b')]){_0x399370[_0x5507('0x48')]=_[_0x5507('0x4c')](_0x399370[_0x5507('0x48')],{'$or':_[_0x5507('0x3d')](_0x399370[_0x5507('0x40')],function(_0x430a03){var _0x4985e9={};_0x4985e9[_0x430a03]={'$like':'%'+_0x158f22[_0x5507('0x3e')][_0x5507('0x4b')]+'%'};return _0x4985e9;})});}_0x399370=_[_0x5507('0x4c')]({},_0x399370,_0x158f22[_0x5507('0x4d')]);return _0x21d76b[_0x5507('0x5a')](_0x399370);}})[_0x5507('0x1b')](function(_0x4e078a){if(_0x4e078a){_0x4ce21e=_0x4e078a[_0x5507('0x43')];if(!_0x158f22['query'][_0x5507('0x44')]('nolimit')){_0x399370['limit']=qs[_0x5507('0x2c')](_0x158f22[_0x5507('0x3e')][_0x5507('0x2c')]);_0x399370[_0x5507('0x2b')]=qs[_0x5507('0x2b')](_0x158f22['query'][_0x5507('0x2b')]);}return _0x21d76b['getSubjects'](_0x399370);}})[_0x5507('0x1b')](function(_0x471142){if(_0x471142){return _0x471142?{'count':_0x4ce21e,'rows':_0x471142}:null;}})[_0x5507('0x1b')](respondWithResult(_0xb622bd,null))[_0x5507('0x26')](handleError(_0xb622bd,null));};exports['getDescriptions']=function(_0x2470ed,_0x3b61b3,_0x42bef4){var _0x5a8a1b={};var _0x56500e={};var _0x1396fc;var _0x10f905;return db[_0x5507('0x38')][_0x5507('0x5b')]({'where':{'id':_0x2470ed[_0x5507('0x53')]['id']}})[_0x5507('0x1b')](handleEntityNotFound(_0x3b61b3,null))[_0x5507('0x1b')](function(_0x10b62e){if(_0x10b62e){_0x1396fc=_0x10b62e;_0x56500e[_0x5507('0x3c')]=_[_0x5507('0x3f')](db[_0x5507('0x58')][_0x5507('0x59')]);_0x56500e['query']=_[_0x5507('0x3f')](_0x2470ed[_0x5507('0x3e')]);_0x56500e[_0x5507('0x49')]=_[_0x5507('0x41')](_0x56500e[_0x5507('0x3c')],_0x56500e[_0x5507('0x3e')]);_0x5a8a1b[_0x5507('0x40')]=_['intersection'](_0x56500e[_0x5507('0x3c')],qs[_0x5507('0x42')](_0x2470ed[_0x5507('0x3e')][_0x5507('0x42')]));_0x5a8a1b['attributes']=_0x5a8a1b[_0x5507('0x40')][_0x5507('0x43')]?_0x5a8a1b[_0x5507('0x40')]:_0x56500e[_0x5507('0x3c')];_0x5a8a1b[_0x5507('0x46')]=qs[_0x5507('0x47')](_0x2470ed[_0x5507('0x3e')]['sort']);_0x5a8a1b[_0x5507('0x48')]=qs[_0x5507('0x49')](_[_0x5507('0x4a')](_0x2470ed[_0x5507('0x3e')],_0x56500e[_0x5507('0x49')]));if(_0x2470ed['query'][_0x5507('0x4b')]){_0x5a8a1b[_0x5507('0x48')]=_[_0x5507('0x4c')](_0x5a8a1b[_0x5507('0x48')],{'$or':_[_0x5507('0x3d')](_0x5a8a1b[_0x5507('0x40')],function(_0x30d392){var _0x40eb5a={};_0x40eb5a[_0x30d392]={'$like':'%'+_0x2470ed[_0x5507('0x3e')][_0x5507('0x4b')]+'%'};return _0x40eb5a;})});}_0x5a8a1b=_[_0x5507('0x4c')]({},_0x5a8a1b,_0x2470ed[_0x5507('0x4d')]);return _0x1396fc[_0x5507('0x5c')](_0x5a8a1b);}})['then'](function(_0x47ee77){if(_0x47ee77){_0x10f905=_0x47ee77['length'];if(!_0x2470ed[_0x5507('0x3e')][_0x5507('0x44')](_0x5507('0x45'))){_0x5a8a1b[_0x5507('0x2c')]=qs[_0x5507('0x2c')](_0x2470ed['query'][_0x5507('0x2c')]);_0x5a8a1b[_0x5507('0x2b')]=qs[_0x5507('0x2b')](_0x2470ed['query'][_0x5507('0x2b')]);}return _0x1396fc['getDescriptions'](_0x5a8a1b);}})['then'](function(_0x1e330c){if(_0x1e330c){return _0x1e330c?{'count':_0x10f905,'rows':_0x1e330c}:null;}})['then'](respondWithResult(_0x3b61b3,null))[_0x5507('0x26')](handleError(_0x3b61b3,null));}; \ No newline at end of file +var _0x2eb2=['ZohoConfiguration,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','ZohoConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','options','find','body','params','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','error','code'];(function(_0x4bf19b,_0x1982fd){var _0x583aac=function(_0x3584cd){while(--_0x3584cd){_0x4bf19b['push'](_0x4bf19b['shift']());}};_0x583aac(++_0x1982fd);}(_0x2eb2,0x19f));var _0x22eb=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x2eb2[_0xbb091];return _0x467a04;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x22eb('0x0'));var rimraf=require(_0x22eb('0x1'));var zipdir=require(_0x22eb('0x2'));var jsonpatch=require(_0x22eb('0x3'));var rp=require(_0x22eb('0x4'));var moment=require(_0x22eb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x22eb('0x6'));var util=require('util');var path=require('path');var sox=require(_0x22eb('0x7'));var csv=require(_0x22eb('0x8'));var ejs=require(_0x22eb('0x9'));var fs=require('fs');var _=require(_0x22eb('0xa'));var squel=require(_0x22eb('0xb'));var crypto=require(_0x22eb('0xc'));var jsforce=require(_0x22eb('0xd'));var deskjs=require(_0x22eb('0xe'));var toCsv=require(_0x22eb('0x8'));var querystring=require(_0x22eb('0xf'));var Papa=require(_0x22eb('0x10'));var Redis=require(_0x22eb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x22eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22eb('0x13'))('api');var utils=require(_0x22eb('0x14'));var config=require(_0x22eb('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x22eb('0x16'));var client=jayson[_0x22eb('0x17')][_0x22eb('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1e2a53,_0x427439,_0x49e37e,_0x350ade){return new BPromise(function(_0x53f14e,_0x1f5089){var _0x55ede8=_0x350ade||client;return _0x55ede8[_0x22eb('0x19')](_0x1e2a53,_0x49e37e)[_0x22eb('0x1a')](function(_0x53abbf){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x427439,_0x22eb('0x1b'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x427439,_0x22eb('0x1b'),JSON['stringify'](_0x53abbf));if(_0x53abbf['error']){if(_0x53abbf[_0x22eb('0x1c')][_0x22eb('0x1d')]===0x1f4){logger[_0x22eb('0x1c')](_0x22eb('0x1e'),_0x427439,_0x53abbf[_0x22eb('0x1c')]['message']);return _0x1f5089(_0x53abbf[_0x22eb('0x1c')][_0x22eb('0x1f')]);}logger[_0x22eb('0x1c')](_0x22eb('0x1e'),_0x427439,_0x53abbf[_0x22eb('0x1c')]['message']);return _0x53f14e(_0x53abbf[_0x22eb('0x1c')][_0x22eb('0x1f')]);}else{logger[_0x22eb('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x427439,'request\x20sent');_0x53f14e(_0x53abbf[_0x22eb('0x21')][_0x22eb('0x1f')]);}})[_0x22eb('0x22')](function(_0x44639a){logger[_0x22eb('0x1c')](_0x22eb('0x1e'),_0x427439,_0x44639a);_0x1f5089(_0x44639a);});});}function respondWithStatusCode(_0x43dacb,_0x4e7e69){_0x4e7e69=_0x4e7e69||0xcc;return function(_0x2e8f7c){if(_0x2e8f7c){return _0x43dacb[_0x22eb('0x23')](_0x4e7e69);}return _0x43dacb[_0x22eb('0x24')](_0x4e7e69)[_0x22eb('0x25')]();};}function respondWithResult(_0x420d4f,_0x4da252){_0x4da252=_0x4da252||0xc8;return function(_0x12c133){if(_0x12c133){return _0x420d4f[_0x22eb('0x24')](_0x4da252)[_0x22eb('0x26')](_0x12c133);}};}function respondWithFilteredResult(_0x5a001e,_0xe0783c){return function(_0x259847){if(_0x259847){var _0x4b409a=_0x259847[_0x22eb('0x27')],_0x32a4b6=_0xe0783c[_0x22eb('0x28')],_0x222ef3=_0xe0783c['offset']+_0xe0783c['limit'],_0x1e3015;if(_0x222ef3>=_0x4b409a){_0x222ef3=_0x4b409a;_0x1e3015=0xc8;}else{_0x1e3015=0xce;}_0x5a001e[_0x22eb('0x24')](_0x1e3015);return _0x5a001e[_0x22eb('0x29')](_0x22eb('0x2a'),_0x32a4b6+'-'+_0x222ef3+'/'+_0x4b409a)[_0x22eb('0x26')](_0x259847);}return null;};}function patchUpdates(_0x1599c7){return function(_0x14724e){try{jsonpatch[_0x22eb('0x2b')](_0x14724e,_0x1599c7,!![]);}catch(_0x13814f){return BPromise[_0x22eb('0x2c')](_0x13814f);}return _0x14724e[_0x22eb('0x2d')]();};}function saveUpdates(_0x24e9dc,_0x5a37f8){return function(_0x54f401){if(_0x54f401){return _0x54f401[_0x22eb('0x2e')](_0x24e9dc)['then'](function(_0x1dd660){return _0x1dd660;});}return null;};}function removeEntity(_0x1e035a,_0xd564a9){return function(_0x11199f){if(_0x11199f){return _0x11199f[_0x22eb('0x2f')]()[_0x22eb('0x1a')](function(){_0x1e035a[_0x22eb('0x24')](0xcc)[_0x22eb('0x25')]();});}};}function handleEntityNotFound(_0x22354d,_0x232af4){return function(_0x509bb7){if(!_0x509bb7){_0x22354d['sendStatus'](0x194);}return _0x509bb7;};}function handleError(_0x239a41,_0x5ceec1){_0x5ceec1=_0x5ceec1||0x1f4;return function(_0x55ee20){logger[_0x22eb('0x1c')](_0x55ee20[_0x22eb('0x30')]);if(_0x55ee20[_0x22eb('0x31')]){delete _0x55ee20[_0x22eb('0x31')];}_0x239a41[_0x22eb('0x24')](_0x5ceec1)[_0x22eb('0x32')](_0x55ee20);};}exports[_0x22eb('0x33')]=function(_0x42a6d6,_0x7f169){var _0x21e66b={},_0x5e8167={},_0x9c8193={'count':0x0,'rows':[]};var _0x47be01=_['map'](db[_0x22eb('0x34')][_0x22eb('0x35')],function(_0x48e47e){return{'name':_0x48e47e[_0x22eb('0x36')],'type':_0x48e47e[_0x22eb('0x37')][_0x22eb('0x38')]};});_0x5e8167[_0x22eb('0x39')]=_[_0x22eb('0x3a')](_0x47be01,'name');_0x5e8167[_0x22eb('0x3b')]=_[_0x22eb('0x3c')](_0x42a6d6['query']);_0x5e8167[_0x22eb('0x3d')]=_[_0x22eb('0x3e')](_0x5e8167[_0x22eb('0x39')],_0x5e8167[_0x22eb('0x3b')]);_0x21e66b[_0x22eb('0x3f')]=_['intersection'](_0x5e8167['model'],qs[_0x22eb('0x40')](_0x42a6d6[_0x22eb('0x3b')]['fields']));_0x21e66b[_0x22eb('0x3f')]=_0x21e66b[_0x22eb('0x3f')][_0x22eb('0x41')]?_0x21e66b['attributes']:_0x5e8167[_0x22eb('0x39')];if(!_0x42a6d6[_0x22eb('0x3b')][_0x22eb('0x42')](_0x22eb('0x43'))){_0x21e66b[_0x22eb('0x44')]=qs[_0x22eb('0x44')](_0x42a6d6['query'][_0x22eb('0x44')]);_0x21e66b[_0x22eb('0x28')]=qs['offset'](_0x42a6d6[_0x22eb('0x3b')][_0x22eb('0x28')]);}_0x21e66b[_0x22eb('0x45')]=qs[_0x22eb('0x46')](_0x42a6d6[_0x22eb('0x3b')][_0x22eb('0x46')]);_0x21e66b[_0x22eb('0x47')]=qs[_0x22eb('0x3d')](_[_0x22eb('0x48')](_0x42a6d6[_0x22eb('0x3b')],_0x5e8167[_0x22eb('0x3d')]),_0x47be01);if(_0x42a6d6[_0x22eb('0x3b')][_0x22eb('0x49')]){_0x21e66b[_0x22eb('0x47')]=_[_0x22eb('0x4a')](_0x21e66b[_0x22eb('0x47')],{'$or':_[_0x22eb('0x3a')](_0x47be01,function(_0x46e3ec){if(_0x46e3ec['type']!==_0x22eb('0x4b')){var _0x445140={};_0x445140[_0x46e3ec['name']]={'$like':'%'+_0x42a6d6[_0x22eb('0x3b')][_0x22eb('0x49')]+'%'};return _0x445140;}})});}_0x21e66b=_['merge']({},_0x21e66b,_0x42a6d6['options']);var _0x5c18d1={'where':_0x21e66b[_0x22eb('0x47')]};return db[_0x22eb('0x34')]['count'](_0x5c18d1)['then'](function(_0xa7c642){_0x9c8193[_0x22eb('0x27')]=_0xa7c642;if(_0x42a6d6[_0x22eb('0x3b')][_0x22eb('0x4c')]){_0x21e66b[_0x22eb('0x4d')]=[{'all':!![]}];}return db[_0x22eb('0x34')][_0x22eb('0x4e')](_0x21e66b);})[_0x22eb('0x1a')](function(_0x5e55c6){_0x9c8193['rows']=_0x5e55c6;return _0x9c8193;})[_0x22eb('0x1a')](respondWithFilteredResult(_0x7f169,_0x21e66b))['catch'](handleError(_0x7f169,null));};exports[_0x22eb('0x4f')]=function(_0x4bd819,_0x8a2b2c){var _0x5c41c0={'raw':![],'where':{'id':_0x4bd819['params']['id']}},_0x4b2f86={};_0x4b2f86['model']=_[_0x22eb('0x3c')](db['ZohoConfiguration'][_0x22eb('0x35')]);_0x4b2f86[_0x22eb('0x3b')]=_['keys'](_0x4bd819[_0x22eb('0x3b')]);_0x4b2f86['filtears']=_[_0x22eb('0x3e')](_0x4b2f86[_0x22eb('0x39')],_0x4b2f86[_0x22eb('0x3b')]);_0x5c41c0[_0x22eb('0x3f')]=_[_0x22eb('0x3e')](_0x4b2f86[_0x22eb('0x39')],qs[_0x22eb('0x40')](_0x4bd819[_0x22eb('0x3b')][_0x22eb('0x40')]));_0x5c41c0['attributes']=_0x5c41c0[_0x22eb('0x3f')][_0x22eb('0x41')]?_0x5c41c0['attributes']:_0x4b2f86[_0x22eb('0x39')];if(_0x4bd819[_0x22eb('0x3b')][_0x22eb('0x4c')]){_0x5c41c0[_0x22eb('0x4d')]=[{'all':!![]}];}_0x5c41c0=_['merge']({},_0x5c41c0,_0x4bd819[_0x22eb('0x50')]);return db[_0x22eb('0x34')][_0x22eb('0x51')](_0x5c41c0)[_0x22eb('0x1a')](handleEntityNotFound(_0x8a2b2c,null))[_0x22eb('0x1a')](respondWithResult(_0x8a2b2c,null))[_0x22eb('0x22')](handleError(_0x8a2b2c,null));};exports['create']=function(_0x29d7ca,_0x4e5b9f){return db[_0x22eb('0x34')]['create'](_0x29d7ca[_0x22eb('0x52')],{})[_0x22eb('0x1a')](respondWithResult(_0x4e5b9f,0xc9))[_0x22eb('0x22')](handleError(_0x4e5b9f,null));};exports[_0x22eb('0x2e')]=function(_0x3f03df,_0x4aa0c5){if(_0x3f03df['body']['id']){delete _0x3f03df[_0x22eb('0x52')]['id'];}return db[_0x22eb('0x34')]['find']({'where':{'id':_0x3f03df[_0x22eb('0x53')]['id']}})[_0x22eb('0x1a')](handleEntityNotFound(_0x4aa0c5,null))[_0x22eb('0x1a')](saveUpdates(_0x3f03df[_0x22eb('0x52')],null))[_0x22eb('0x1a')](respondWithResult(_0x4aa0c5,null))[_0x22eb('0x22')](handleError(_0x4aa0c5,null));};exports[_0x22eb('0x2f')]=function(_0x35c997,_0x19f496){return db[_0x22eb('0x34')][_0x22eb('0x51')]({'where':{'id':_0x35c997['params']['id']}})[_0x22eb('0x1a')](handleEntityNotFound(_0x19f496,null))[_0x22eb('0x1a')](removeEntity(_0x19f496,null))[_0x22eb('0x22')](handleError(_0x19f496,null));};exports[_0x22eb('0x54')]=function(_0x45c682,_0x24465a,_0x15d191){var _0x3871ef={};var _0x26fc89={};var _0x9f8465;var _0x3e9ab5;return db[_0x22eb('0x34')][_0x22eb('0x55')]({'where':{'id':_0x45c682[_0x22eb('0x53')]['id']}})['then'](handleEntityNotFound(_0x24465a,null))['then'](function(_0x36ee0d){if(_0x36ee0d){_0x9f8465=_0x36ee0d;_0x26fc89[_0x22eb('0x39')]=_[_0x22eb('0x3c')](db[_0x22eb('0x56')][_0x22eb('0x35')]);_0x26fc89['query']=_[_0x22eb('0x3c')](_0x45c682[_0x22eb('0x3b')]);_0x26fc89['filters']=_['intersection'](_0x26fc89[_0x22eb('0x39')],_0x26fc89[_0x22eb('0x3b')]);_0x3871ef[_0x22eb('0x3f')]=_[_0x22eb('0x3e')](_0x26fc89[_0x22eb('0x39')],qs[_0x22eb('0x40')](_0x45c682[_0x22eb('0x3b')][_0x22eb('0x40')]));_0x3871ef[_0x22eb('0x3f')]=_0x3871ef[_0x22eb('0x3f')][_0x22eb('0x41')]?_0x3871ef[_0x22eb('0x3f')]:_0x26fc89[_0x22eb('0x39')];_0x3871ef[_0x22eb('0x45')]=qs['sort'](_0x45c682[_0x22eb('0x3b')][_0x22eb('0x46')]);_0x3871ef[_0x22eb('0x47')]=qs['filters'](_[_0x22eb('0x48')](_0x45c682['query'],_0x26fc89[_0x22eb('0x3d')]));if(_0x45c682['query'][_0x22eb('0x49')]){_0x3871ef[_0x22eb('0x47')]=_['merge'](_0x3871ef[_0x22eb('0x47')],{'$or':_[_0x22eb('0x3a')](_0x3871ef['attributes'],function(_0x4ccd29){var _0x32819b={};_0x32819b[_0x4ccd29]={'$like':'%'+_0x45c682[_0x22eb('0x3b')][_0x22eb('0x49')]+'%'};return _0x32819b;})});}_0x3871ef=_[_0x22eb('0x4a')]({},_0x3871ef,_0x45c682[_0x22eb('0x50')]);return _0x9f8465[_0x22eb('0x54')](_0x3871ef);}})['then'](function(_0x2e77c6){if(_0x2e77c6){_0x3e9ab5=_0x2e77c6['length'];if(!_0x45c682['query'][_0x22eb('0x42')](_0x22eb('0x43'))){_0x3871ef[_0x22eb('0x44')]=qs[_0x22eb('0x44')](_0x45c682[_0x22eb('0x3b')][_0x22eb('0x44')]);_0x3871ef[_0x22eb('0x28')]=qs[_0x22eb('0x28')](_0x45c682['query']['offset']);}return _0x9f8465[_0x22eb('0x54')](_0x3871ef);}})[_0x22eb('0x1a')](function(_0x49f182){if(_0x49f182){return _0x49f182?{'count':_0x3e9ab5,'rows':_0x49f182}:null;}})[_0x22eb('0x1a')](respondWithResult(_0x24465a,null))[_0x22eb('0x22')](handleError(_0x24465a,null));};exports[_0x22eb('0x57')]=function(_0x27e3d2,_0x40faf6,_0x3ff700){var _0x5ce4ea={};var _0x3dd49b={};var _0x29d4a7;var _0x37fa5e;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x27e3d2[_0x22eb('0x53')]['id']}})[_0x22eb('0x1a')](handleEntityNotFound(_0x40faf6,null))[_0x22eb('0x1a')](function(_0x5ebeb5){if(_0x5ebeb5){_0x29d4a7=_0x5ebeb5;_0x3dd49b[_0x22eb('0x39')]=_['keys'](db[_0x22eb('0x56')][_0x22eb('0x35')]);_0x3dd49b[_0x22eb('0x3b')]=_[_0x22eb('0x3c')](_0x27e3d2['query']);_0x3dd49b[_0x22eb('0x3d')]=_[_0x22eb('0x3e')](_0x3dd49b[_0x22eb('0x39')],_0x3dd49b[_0x22eb('0x3b')]);_0x5ce4ea[_0x22eb('0x3f')]=_[_0x22eb('0x3e')](_0x3dd49b[_0x22eb('0x39')],qs[_0x22eb('0x40')](_0x27e3d2[_0x22eb('0x3b')][_0x22eb('0x40')]));_0x5ce4ea[_0x22eb('0x3f')]=_0x5ce4ea['attributes'][_0x22eb('0x41')]?_0x5ce4ea[_0x22eb('0x3f')]:_0x3dd49b['model'];_0x5ce4ea['order']=qs['sort'](_0x27e3d2[_0x22eb('0x3b')][_0x22eb('0x46')]);_0x5ce4ea['where']=qs[_0x22eb('0x3d')](_[_0x22eb('0x48')](_0x27e3d2[_0x22eb('0x3b')],_0x3dd49b[_0x22eb('0x3d')]));if(_0x27e3d2[_0x22eb('0x3b')]['filter']){_0x5ce4ea['where']=_[_0x22eb('0x4a')](_0x5ce4ea[_0x22eb('0x47')],{'$or':_[_0x22eb('0x3a')](_0x5ce4ea['attributes'],function(_0x5a5a51){var _0xc6af66={};_0xc6af66[_0x5a5a51]={'$like':'%'+_0x27e3d2['query']['filter']+'%'};return _0xc6af66;})});}_0x5ce4ea=_[_0x22eb('0x4a')]({},_0x5ce4ea,_0x27e3d2[_0x22eb('0x50')]);return _0x29d4a7['getSubjects'](_0x5ce4ea);}})['then'](function(_0x1e393a){if(_0x1e393a){_0x37fa5e=_0x1e393a[_0x22eb('0x41')];if(!_0x27e3d2['query'][_0x22eb('0x42')](_0x22eb('0x43'))){_0x5ce4ea[_0x22eb('0x44')]=qs['limit'](_0x27e3d2[_0x22eb('0x3b')][_0x22eb('0x44')]);_0x5ce4ea[_0x22eb('0x28')]=qs[_0x22eb('0x28')](_0x27e3d2[_0x22eb('0x3b')]['offset']);}return _0x29d4a7[_0x22eb('0x57')](_0x5ce4ea);}})[_0x22eb('0x1a')](function(_0x3f429b){if(_0x3f429b){return _0x3f429b?{'count':_0x37fa5e,'rows':_0x3f429b}:null;}})['then'](respondWithResult(_0x40faf6,null))['catch'](handleError(_0x40faf6,null));};exports[_0x22eb('0x58')]=function(_0xc44944,_0x40db2a,_0x557c03){var _0x215472={};var _0x33df26={};var _0x2a0062;var _0x5b797e;return db[_0x22eb('0x34')]['findOne']({'where':{'id':_0xc44944['params']['id']}})[_0x22eb('0x1a')](handleEntityNotFound(_0x40db2a,null))[_0x22eb('0x1a')](function(_0x1057f2){if(_0x1057f2){_0x2a0062=_0x1057f2;_0x33df26['model']=_[_0x22eb('0x3c')](db[_0x22eb('0x56')][_0x22eb('0x35')]);_0x33df26[_0x22eb('0x3b')]=_[_0x22eb('0x3c')](_0xc44944['query']);_0x33df26[_0x22eb('0x3d')]=_['intersection'](_0x33df26[_0x22eb('0x39')],_0x33df26[_0x22eb('0x3b')]);_0x215472[_0x22eb('0x3f')]=_['intersection'](_0x33df26[_0x22eb('0x39')],qs[_0x22eb('0x40')](_0xc44944[_0x22eb('0x3b')][_0x22eb('0x40')]));_0x215472[_0x22eb('0x3f')]=_0x215472[_0x22eb('0x3f')][_0x22eb('0x41')]?_0x215472[_0x22eb('0x3f')]:_0x33df26[_0x22eb('0x39')];_0x215472[_0x22eb('0x45')]=qs[_0x22eb('0x46')](_0xc44944['query'][_0x22eb('0x46')]);_0x215472[_0x22eb('0x47')]=qs[_0x22eb('0x3d')](_[_0x22eb('0x48')](_0xc44944['query'],_0x33df26[_0x22eb('0x3d')]));if(_0xc44944[_0x22eb('0x3b')]['filter']){_0x215472[_0x22eb('0x47')]=_[_0x22eb('0x4a')](_0x215472[_0x22eb('0x47')],{'$or':_[_0x22eb('0x3a')](_0x215472[_0x22eb('0x3f')],function(_0x3a172e){var _0x502a2a={};_0x502a2a[_0x3a172e]={'$like':'%'+_0xc44944['query'][_0x22eb('0x49')]+'%'};return _0x502a2a;})});}_0x215472=_[_0x22eb('0x4a')]({},_0x215472,_0xc44944['options']);return _0x2a0062['getDescriptions'](_0x215472);}})[_0x22eb('0x1a')](function(_0x31c40a){if(_0x31c40a){_0x5b797e=_0x31c40a[_0x22eb('0x41')];if(!_0xc44944[_0x22eb('0x3b')][_0x22eb('0x42')]('nolimit')){_0x215472['limit']=qs[_0x22eb('0x44')](_0xc44944[_0x22eb('0x3b')]['limit']);_0x215472[_0x22eb('0x28')]=qs[_0x22eb('0x28')](_0xc44944[_0x22eb('0x3b')]['offset']);}return _0x2a0062[_0x22eb('0x58')](_0x215472);}})[_0x22eb('0x1a')](function(_0x204238){if(_0x204238){return _0x204238?{'count':_0x5b797e,'rows':_0x204238}:null;}})[_0x22eb('0x1a')](respondWithResult(_0x40db2a,null))[_0x22eb('0x22')](handleError(_0x40db2a,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index c0a405d..7657bbb 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 _0xe204=['util','../../config/logger','api','moment','bluebird','rimraf','ZohoConfiguration','lodash'];(function(_0x5b3499,_0x3c0285){var _0x34bb24=function(_0xf0d40f){while(--_0xf0d40f){_0x5b3499['push'](_0x5b3499['shift']());}};_0x34bb24(++_0x3c0285);}(_0xe204,0x8f));var _0x4e20=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe204[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x4e20('0x0'));var util=require(_0x4e20('0x1'));var logger=require(_0x4e20('0x2'))(_0x4e20('0x3'));var moment=require(_0x4e20('0x4'));var BPromise=require(_0x4e20('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4e20('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x41a88a,_0x3692da){return _0x41a88a['define'](_0x4e20('0x7'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26a8=['util','../../config/logger','api','bluebird','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x26a8,0x10d));var _0x826a=function(_0x34e824,_0x99108f){_0x34e824=_0x34e824-0x0;var _0x359760=_0x26a8[_0x34e824];return _0x359760;};'use strict';var _=require(_0x826a('0x0'));var util=require(_0x826a('0x1'));var logger=require(_0x826a('0x2'))(_0x826a('0x3'));var moment=require('moment');var BPromise=require(_0x826a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x826a('0x5'));var attributes=require(_0x826a('0x6'));module[_0x826a('0x7')]=function(_0x14fc8d,_0x3ac202){return _0x14fc8d[_0x826a('0x8')]('ZohoConfiguration',attributes,{'tableName':_0x826a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 6633fe2..e84c32f 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 _0x92a2=['code','message','result','catch','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x92a2,0x144));var _0x292a=function(_0x38eb9a,_0x567550){_0x38eb9a=_0x38eb9a-0x0;var _0x37fab3=_0x92a2[_0x38eb9a];return _0x37fab3;};'use strict';var _=require(_0x292a('0x0'));var util=require(_0x292a('0x1'));var moment=require(_0x292a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x292a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x292a('0x4'))(_0x292a('0x5'));var config=require(_0x292a('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x292a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x485481,_0x5c0d34,_0x3581e2){return new BPromise(function(_0xe8ec57,_0x5b5287){return client[_0x292a('0x8')](_0x485481,_0x3581e2)[_0x292a('0x9')](function(_0x314119){logger['info'](_0x292a('0xa'),_0x5c0d34,_0x292a('0xb'));logger[_0x292a('0xc')](_0x292a('0xd'),_0x5c0d34,_0x292a('0xb'),JSON[_0x292a('0xe')](_0x314119));if(_0x314119[_0x292a('0xf')]){if(_0x314119[_0x292a('0xf')][_0x292a('0x10')]===0x1f4){logger[_0x292a('0xf')](_0x292a('0xa'),_0x5c0d34,_0x314119['error'][_0x292a('0x11')]);return _0x5b5287(_0x314119['error'][_0x292a('0x11')]);}logger[_0x292a('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x5c0d34,_0x314119[_0x292a('0xf')]['message']);return _0xe8ec57(_0x314119['error'][_0x292a('0x11')]);}else{logger['info'](_0x292a('0xa'),_0x5c0d34,_0x292a('0xb'));_0xe8ec57(_0x314119[_0x292a('0x12')][_0x292a('0x11')]);}})[_0x292a('0x13')](function(_0x4bfc78){logger[_0x292a('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x5c0d34,_0x4bfc78);_0x5b5287(_0x4bfc78);});});} \ No newline at end of file +var _0x96fd=['catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x185334,_0x4630ac){var _0xf2e59a=function(_0x3cc497){while(--_0x3cc497){_0x185334['push'](_0x185334['shift']());}};_0xf2e59a(++_0x4630ac);}(_0x96fd,0xeb));var _0xd96f=function(_0x4b9019,_0x2bce61){_0x4b9019=_0x4b9019-0x0;var _0x26571f=_0x96fd[_0x4b9019];return _0x26571f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd96f('0x0'));var BPromise=require('bluebird');var rs=require(_0xd96f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd96f('0x2'))['db'];var utils=require(_0xd96f('0x3'));var logger=require(_0xd96f('0x4'))(_0xd96f('0x5'));var config=require(_0xd96f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd96f('0x7')][_0xd96f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x485cd0,_0x455191,_0x7fc56e){return new BPromise(function(_0x33cce7,_0x1be362){return client[_0xd96f('0x9')](_0x485cd0,_0x7fc56e)['then'](function(_0x5c780a){logger['info'](_0xd96f('0xa'),_0x455191,'request\x20sent');logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x455191,_0xd96f('0xb'),JSON[_0xd96f('0xc')](_0x5c780a));if(_0x5c780a[_0xd96f('0xd')]){if(_0x5c780a['error'][_0xd96f('0xe')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x455191,_0x5c780a[_0xd96f('0xd')]['message']);return _0x1be362(_0x5c780a[_0xd96f('0xd')][_0xd96f('0xf')]);}logger['error'](_0xd96f('0xa'),_0x455191,_0x5c780a[_0xd96f('0xd')][_0xd96f('0xf')]);return _0x33cce7(_0x5c780a['error'][_0xd96f('0xf')]);}else{logger[_0xd96f('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x455191,_0xd96f('0xb'));_0x33cce7(_0x5c780a['result'][_0xd96f('0xf')]);}})[_0xd96f('0x11')](function(_0x38129e){logger[_0xd96f('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x455191,_0x38129e);_0x1be362(_0x38129e);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index a14991e..5946e6a 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 _0x3423=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','path','connect-timeout','express','Router'];(function(_0x34c651,_0x2d6cf0){var _0x37c29e=function(_0x25e4cc){while(--_0x25e4cc){_0x34c651['push'](_0x34c651['shift']());}};_0x37c29e(++_0x2d6cf0);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var auth=require(_0x3342('0x4'));var interaction=require(_0x3342('0x5'));var config=require(_0x3342('0x6'));var controller=require(_0x3342('0x7'));router[_0x3342('0x8')]('/',auth[_0x3342('0x9')](),controller[_0x3342('0xa')]);router[_0x3342('0x8')](_0x3342('0xb'),auth[_0x3342('0x9')](),controller[_0x3342('0xc')]);router[_0x3342('0xd')]('/',auth[_0x3342('0x9')](),controller[_0x3342('0xe')]);router[_0x3342('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3342('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3342('0x11')]=router; \ No newline at end of file +var _0xd117=['get','isAuthenticated','index','/:id','post','create','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0xb68285,_0x28012b){var _0x4b6a60=function(_0x5b88de){while(--_0x5b88de){_0xb68285['push'](_0xb68285['shift']());}};_0x4b6a60(++_0x28012b);}(_0xd117,0x182));var _0x7d11=function(_0x1c7b4c,_0x5b85b2){_0x1c7b4c=_0x1c7b4c-0x0;var _0x18daf6=_0xd117[_0x1c7b4c];return _0x18daf6;};'use strict';var multer=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var path=require(_0x7d11('0x2'));var timeout=require(_0x7d11('0x3'));var express=require(_0x7d11('0x4'));var router=express[_0x7d11('0x5')]();var auth=require(_0x7d11('0x6'));var interaction=require(_0x7d11('0x7'));var config=require(_0x7d11('0x8'));var controller=require(_0x7d11('0x9'));router[_0x7d11('0xa')]('/',auth[_0x7d11('0xb')](),controller[_0x7d11('0xc')]);router[_0x7d11('0xa')](_0x7d11('0xd'),auth[_0x7d11('0xb')](),controller['show']);router[_0x7d11('0xe')]('/',auth[_0x7d11('0xb')](),controller[_0x7d11('0xf')]);router['put'](_0x7d11('0xd'),auth[_0x7d11('0xb')](),controller[_0x7d11('0x10')]);router['delete'](_0x7d11('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x7d11('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 87b0d08..b3cc1a0 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 _0x919e=['STRING','customVariable','sequelize','exports','ENUM','variable','string'];(function(_0x424b9d,_0x44fc12){var _0x5a5d4f=function(_0x367ef0){while(--_0x367ef0){_0x424b9d['push'](_0x424b9d['shift']());}};_0x5a5d4f(++_0x44fc12);}(_0x919e,0x1d7));var _0xe919=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x919e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe919('0x0'));module[_0xe919('0x1')]={'type':{'type':Sequelize[_0xe919('0x2')]('string',_0xe919('0x3'),'customVariable','keyValue'),'defaultValue':_0xe919('0x4')},'content':{'type':Sequelize[_0xe919('0x5')]},'key':{'type':Sequelize[_0xe919('0x5')]},'keyType':{'type':Sequelize[_0xe919('0x2')](_0xe919('0x4'),_0xe919('0x3'),_0xe919('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe919('0x5')]},'nameField':{'type':Sequelize[_0xe919('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe919('0x5')]}}; \ No newline at end of file +var _0xae79=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0xae79,0x1d3));var _0x9ae7=function(_0x4bbf3e,_0x2b940d){_0x4bbf3e=_0x4bbf3e-0x0;var _0x15687f=_0xae79[_0x4bbf3e];return _0x15687f;};'use strict';var Sequelize=require(_0x9ae7('0x0'));module[_0x9ae7('0x1')]={'type':{'type':Sequelize[_0x9ae7('0x2')](_0x9ae7('0x3'),_0x9ae7('0x4'),_0x9ae7('0x5'),_0x9ae7('0x6')),'defaultValue':_0x9ae7('0x3')},'content':{'type':Sequelize[_0x9ae7('0x7')]},'key':{'type':Sequelize[_0x9ae7('0x7')]},'keyType':{'type':Sequelize[_0x9ae7('0x2')](_0x9ae7('0x3'),_0x9ae7('0x4'),_0x9ae7('0x5'))},'keyContent':{'type':Sequelize[_0x9ae7('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9ae7('0x7')]},'customField':{'type':Sequelize[_0x9ae7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9ae7('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 699b026..5dc4437 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 _0x8581=['fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','filtears','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','count','offset','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','ZohoField','rawAttributes'];(function(_0x1759b5,_0x16bd58){var _0x436cf2=function(_0xee5171){while(--_0xee5171){_0x1759b5['push'](_0x1759b5['shift']());}};_0x436cf2(++_0x16bd58);}(_0x8581,0x6a));var _0x1858=function(_0x435c89,_0x2b6da8){_0x435c89=_0x435c89-0x0;var _0x183449=_0x8581[_0x435c89];return _0x183449;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1858('0x0'));var rimraf=require(_0x1858('0x1'));var zipdir=require(_0x1858('0x2'));var jsonpatch=require(_0x1858('0x3'));var rp=require(_0x1858('0x4'));var moment=require(_0x1858('0x5'));var BPromise=require(_0x1858('0x6'));var Mustache=require(_0x1858('0x7'));var util=require('util');var path=require(_0x1858('0x8'));var sox=require(_0x1858('0x9'));var csv=require(_0x1858('0xa'));var ejs=require(_0x1858('0xb'));var fs=require('fs');var _=require(_0x1858('0xc'));var squel=require(_0x1858('0xd'));var crypto=require(_0x1858('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1858('0xf'));var toCsv=require(_0x1858('0xa'));var querystring=require(_0x1858('0x10'));var Papa=require(_0x1858('0x11'));var Redis=require(_0x1858('0x12'));var authService=require(_0x1858('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1858('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1858('0x15'))(_0x1858('0x16'));var utils=require(_0x1858('0x17'));var config=require(_0x1858('0x18'));var licenseUtil=require(_0x1858('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x227cff,_0x49e142){_0x49e142=_0x49e142||0xcc;return function(_0x541f80){if(_0x541f80){return _0x227cff['sendStatus'](_0x49e142);}return _0x227cff[_0x1858('0x1a')](_0x49e142)[_0x1858('0x1b')]();};}function respondWithResult(_0xc825fc,_0x190e35){_0x190e35=_0x190e35||0xc8;return function(_0x38699c){if(_0x38699c){return _0xc825fc[_0x1858('0x1a')](_0x190e35)[_0x1858('0x1c')](_0x38699c);}};}function respondWithFilteredResult(_0x4c14b1,_0x282b78){return function(_0x41e2fd){if(_0x41e2fd){var _0x106e35=_0x41e2fd[_0x1858('0x1d')],_0x594452=_0x282b78[_0x1858('0x1e')],_0x489bf4=_0x282b78['offset']+_0x282b78['limit'],_0x5a43b5;if(_0x489bf4>=_0x106e35){_0x489bf4=_0x106e35;_0x5a43b5=0xc8;}else{_0x5a43b5=0xce;}_0x4c14b1['status'](_0x5a43b5);return _0x4c14b1['set']('Content-Range',_0x594452+'-'+_0x489bf4+'/'+_0x106e35)[_0x1858('0x1c')](_0x41e2fd);}return null;};}function patchUpdates(_0xf32a09){return function(_0x4dcf9b){try{jsonpatch[_0x1858('0x1f')](_0x4dcf9b,_0xf32a09,!![]);}catch(_0x1acddc){return BPromise['reject'](_0x1acddc);}return _0x4dcf9b[_0x1858('0x20')]();};}function saveUpdates(_0x216e1a,_0x5cb8bb){return function(_0x5e5403){if(_0x5e5403){return _0x5e5403[_0x1858('0x21')](_0x216e1a)[_0x1858('0x22')](function(_0x5d82f6){return _0x5d82f6;});}return null;};}function removeEntity(_0x498a30,_0xdf5e63){return function(_0x2f46e8){if(_0x2f46e8){return _0x2f46e8[_0x1858('0x23')]()['then'](function(){_0x498a30['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c8d04,_0xfc5db0){return function(_0x2fb474){if(!_0x2fb474){_0x3c8d04[_0x1858('0x24')](0x194);}return _0x2fb474;};}function handleError(_0x57203f,_0x4a00b6){_0x4a00b6=_0x4a00b6||0x1f4;return function(_0x54630e){logger[_0x1858('0x25')](_0x54630e['stack']);if(_0x54630e[_0x1858('0x26')]){delete _0x54630e[_0x1858('0x26')];}_0x57203f['status'](_0x4a00b6)[_0x1858('0x27')](_0x54630e);};}exports[_0x1858('0x28')]=function(_0x109271,_0x383a63){var _0x2d7a95={},_0x5e255f={},_0x4bcc36={'count':0x0,'rows':[]};var _0x3545ef=_[_0x1858('0x29')](db[_0x1858('0x2a')][_0x1858('0x2b')],function(_0xb3bc0b){return{'name':_0xb3bc0b[_0x1858('0x2c')],'type':_0xb3bc0b['type']['key']};});_0x5e255f[_0x1858('0x2d')]=_['map'](_0x3545ef,'name');_0x5e255f[_0x1858('0x2e')]=_[_0x1858('0x2f')](_0x109271[_0x1858('0x2e')]);_0x5e255f['filters']=_[_0x1858('0x30')](_0x5e255f[_0x1858('0x2d')],_0x5e255f['query']);_0x2d7a95[_0x1858('0x31')]=_['intersection'](_0x5e255f[_0x1858('0x2d')],qs[_0x1858('0x32')](_0x109271['query'][_0x1858('0x32')]));_0x2d7a95['attributes']=_0x2d7a95['attributes'][_0x1858('0x33')]?_0x2d7a95[_0x1858('0x31')]:_0x5e255f[_0x1858('0x2d')];if(!_0x109271[_0x1858('0x2e')][_0x1858('0x34')](_0x1858('0x35'))){_0x2d7a95[_0x1858('0x36')]=qs[_0x1858('0x36')](_0x109271[_0x1858('0x2e')][_0x1858('0x36')]);_0x2d7a95['offset']=qs[_0x1858('0x1e')](_0x109271[_0x1858('0x2e')][_0x1858('0x1e')]);}_0x2d7a95[_0x1858('0x37')]=qs['sort'](_0x109271[_0x1858('0x2e')][_0x1858('0x38')]);_0x2d7a95[_0x1858('0x39')]=qs[_0x1858('0x3a')](_[_0x1858('0x3b')](_0x109271[_0x1858('0x2e')],_0x5e255f[_0x1858('0x3a')]),_0x3545ef);if(_0x109271['query'][_0x1858('0x3c')]){_0x2d7a95[_0x1858('0x39')]=_[_0x1858('0x3d')](_0x2d7a95['where'],{'$or':_[_0x1858('0x29')](_0x3545ef,function(_0x20be39){if(_0x20be39['type']!==_0x1858('0x3e')){var _0x53ba26={};_0x53ba26[_0x20be39[_0x1858('0x26')]]={'$like':'%'+_0x109271[_0x1858('0x2e')][_0x1858('0x3c')]+'%'};return _0x53ba26;}})});}_0x2d7a95=_[_0x1858('0x3d')]({},_0x2d7a95,_0x109271['options']);var _0x551850={'where':_0x2d7a95[_0x1858('0x39')]};return db['ZohoField'][_0x1858('0x1d')](_0x551850)[_0x1858('0x22')](function(_0x32dffe){_0x4bcc36[_0x1858('0x1d')]=_0x32dffe;if(_0x109271[_0x1858('0x2e')][_0x1858('0x3f')]){_0x2d7a95[_0x1858('0x40')]=[{'all':!![]}];}return db[_0x1858('0x2a')][_0x1858('0x41')](_0x2d7a95);})[_0x1858('0x22')](function(_0x380265){_0x4bcc36[_0x1858('0x42')]=_0x380265;return _0x4bcc36;})[_0x1858('0x22')](respondWithFilteredResult(_0x383a63,_0x2d7a95))[_0x1858('0x43')](handleError(_0x383a63,null));};exports[_0x1858('0x44')]=function(_0x1813e2,_0x368913){var _0x9cd727={'raw':!![],'where':{'id':_0x1813e2[_0x1858('0x45')]['id']}},_0x4915f0={};_0x4915f0[_0x1858('0x2d')]=_[_0x1858('0x2f')](db['ZohoField'][_0x1858('0x2b')]);_0x4915f0['query']=_[_0x1858('0x2f')](_0x1813e2['query']);_0x4915f0[_0x1858('0x46')]=_['intersection'](_0x4915f0[_0x1858('0x2d')],_0x4915f0['query']);_0x9cd727[_0x1858('0x31')]=_[_0x1858('0x30')](_0x4915f0['model'],qs[_0x1858('0x32')](_0x1813e2[_0x1858('0x2e')][_0x1858('0x32')]));_0x9cd727[_0x1858('0x31')]=_0x9cd727[_0x1858('0x31')]['length']?_0x9cd727[_0x1858('0x31')]:_0x4915f0[_0x1858('0x2d')];if(_0x1813e2[_0x1858('0x2e')][_0x1858('0x3f')]){_0x9cd727[_0x1858('0x40')]=[{'all':!![]}];}_0x9cd727=_[_0x1858('0x3d')]({},_0x9cd727,_0x1813e2[_0x1858('0x47')]);return db[_0x1858('0x2a')]['find'](_0x9cd727)[_0x1858('0x22')](handleEntityNotFound(_0x368913,null))[_0x1858('0x22')](respondWithResult(_0x368913,null))[_0x1858('0x43')](handleError(_0x368913,null));};exports[_0x1858('0x48')]=function(_0x43d24f,_0xbe1271){return db[_0x1858('0x2a')][_0x1858('0x48')](_0x43d24f[_0x1858('0x49')],{})[_0x1858('0x22')](respondWithResult(_0xbe1271,0xc9))[_0x1858('0x43')](handleError(_0xbe1271,null));};exports['update']=function(_0x164602,_0x49d43b){if(_0x164602[_0x1858('0x49')]['id']){delete _0x164602[_0x1858('0x49')]['id'];}return db[_0x1858('0x2a')][_0x1858('0x4a')]({'where':{'id':_0x164602[_0x1858('0x45')]['id']}})['then'](handleEntityNotFound(_0x49d43b,null))['then'](saveUpdates(_0x164602[_0x1858('0x49')],null))['then'](respondWithResult(_0x49d43b,null))[_0x1858('0x43')](handleError(_0x49d43b,null));};exports['destroy']=function(_0x305c27,_0x1fa74b){return db[_0x1858('0x2a')][_0x1858('0x4a')]({'where':{'id':_0x305c27['params']['id']}})[_0x1858('0x22')](handleEntityNotFound(_0x1fa74b,null))[_0x1858('0x22')](removeEntity(_0x1fa74b,null))[_0x1858('0x43')](handleError(_0x1fa74b,null));}; \ No newline at end of file +var _0x1d20=['find','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','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','../../config/environment','sendStatus','status','json','count','limit','set','Content-Range','apply','then','destroy','end','error','stack','name','send','index','map','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','VIRTUAL','options','includeAll','include','ZohoField','rows','catch','show','params','rawAttributes','merge','create','body','update'];(function(_0x1fbf63,_0x3f8400){var _0x218beb=function(_0x2a7711){while(--_0x2a7711){_0x1fbf63['push'](_0x1fbf63['shift']());}};_0x218beb(++_0x3f8400);}(_0x1d20,0x121));var _0x01d2=function(_0x41bf3f,_0x4db20b){_0x41bf3f=_0x41bf3f-0x0;var _0x51dd57=_0x1d20[_0x41bf3f];return _0x51dd57;};'use strict';var pdf=require(_0x01d2('0x0'));var emlformat=require(_0x01d2('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x01d2('0x2'));var rp=require('request-promise');var moment=require(_0x01d2('0x3'));var BPromise=require(_0x01d2('0x4'));var Mustache=require(_0x01d2('0x5'));var util=require(_0x01d2('0x6'));var path=require(_0x01d2('0x7'));var sox=require('sox');var csv=require(_0x01d2('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x01d2('0x9'));var squel=require(_0x01d2('0xa'));var crypto=require(_0x01d2('0xb'));var jsforce=require(_0x01d2('0xc'));var deskjs=require(_0x01d2('0xd'));var toCsv=require(_0x01d2('0x8'));var querystring=require(_0x01d2('0xe'));var Papa=require(_0x01d2('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x01d2('0x10'));var as=require(_0x01d2('0x11'));var hardwareService=require(_0x01d2('0x12'));var logger=require(_0x01d2('0x13'))(_0x01d2('0x14'));var utils=require(_0x01d2('0x15'));var config=require(_0x01d2('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36a5b6,_0x1f982c){_0x1f982c=_0x1f982c||0xcc;return function(_0x48473f){if(_0x48473f){return _0x36a5b6[_0x01d2('0x17')](_0x1f982c);}return _0x36a5b6[_0x01d2('0x18')](_0x1f982c)['end']();};}function respondWithResult(_0x1a3a8f,_0x3e54b2){_0x3e54b2=_0x3e54b2||0xc8;return function(_0x4d55ff){if(_0x4d55ff){return _0x1a3a8f[_0x01d2('0x18')](_0x3e54b2)[_0x01d2('0x19')](_0x4d55ff);}};}function respondWithFilteredResult(_0x19b66d,_0x1be41b){return function(_0x1dd644){if(_0x1dd644){var _0x1a7a15=_0x1dd644[_0x01d2('0x1a')],_0x49ce33=_0x1be41b['offset'],_0x216a2f=_0x1be41b['offset']+_0x1be41b[_0x01d2('0x1b')],_0x80b92c;if(_0x216a2f>=_0x1a7a15){_0x216a2f=_0x1a7a15;_0x80b92c=0xc8;}else{_0x80b92c=0xce;}_0x19b66d[_0x01d2('0x18')](_0x80b92c);return _0x19b66d[_0x01d2('0x1c')](_0x01d2('0x1d'),_0x49ce33+'-'+_0x216a2f+'/'+_0x1a7a15)[_0x01d2('0x19')](_0x1dd644);}return null;};}function patchUpdates(_0x2808a0){return function(_0x3d7cb9){try{jsonpatch[_0x01d2('0x1e')](_0x3d7cb9,_0x2808a0,!![]);}catch(_0x999784){return BPromise['reject'](_0x999784);}return _0x3d7cb9['save']();};}function saveUpdates(_0x153f1c,_0x6ef9ee){return function(_0x3c11b0){if(_0x3c11b0){return _0x3c11b0['update'](_0x153f1c)[_0x01d2('0x1f')](function(_0x26674e){return _0x26674e;});}return null;};}function removeEntity(_0x53cb43,_0x25ff78){return function(_0x30290e){if(_0x30290e){return _0x30290e[_0x01d2('0x20')]()[_0x01d2('0x1f')](function(){_0x53cb43[_0x01d2('0x18')](0xcc)[_0x01d2('0x21')]();});}};}function handleEntityNotFound(_0x115c2b,_0x453969){return function(_0x2dce1c){if(!_0x2dce1c){_0x115c2b['sendStatus'](0x194);}return _0x2dce1c;};}function handleError(_0x1a3977,_0x46eb7f){_0x46eb7f=_0x46eb7f||0x1f4;return function(_0x1d878e){logger[_0x01d2('0x22')](_0x1d878e[_0x01d2('0x23')]);if(_0x1d878e[_0x01d2('0x24')]){delete _0x1d878e[_0x01d2('0x24')];}_0x1a3977[_0x01d2('0x18')](_0x46eb7f)[_0x01d2('0x25')](_0x1d878e);};}exports[_0x01d2('0x26')]=function(_0x55c5a4,_0x23ec39){var _0x28893b={},_0x1694f6={},_0x5e9e4d={'count':0x0,'rows':[]};var _0x2ebb61=_[_0x01d2('0x27')](db['ZohoField']['rawAttributes'],function(_0xdcaba){return{'name':_0xdcaba['fieldName'],'type':_0xdcaba[_0x01d2('0x28')][_0x01d2('0x29')]};});_0x1694f6[_0x01d2('0x2a')]=_['map'](_0x2ebb61,_0x01d2('0x24'));_0x1694f6['query']=_[_0x01d2('0x2b')](_0x55c5a4['query']);_0x1694f6[_0x01d2('0x2c')]=_[_0x01d2('0x2d')](_0x1694f6[_0x01d2('0x2a')],_0x1694f6[_0x01d2('0x2e')]);_0x28893b['attributes']=_[_0x01d2('0x2d')](_0x1694f6[_0x01d2('0x2a')],qs[_0x01d2('0x2f')](_0x55c5a4[_0x01d2('0x2e')][_0x01d2('0x2f')]));_0x28893b[_0x01d2('0x30')]=_0x28893b[_0x01d2('0x30')][_0x01d2('0x31')]?_0x28893b['attributes']:_0x1694f6[_0x01d2('0x2a')];if(!_0x55c5a4[_0x01d2('0x2e')][_0x01d2('0x32')](_0x01d2('0x33'))){_0x28893b[_0x01d2('0x1b')]=qs[_0x01d2('0x1b')](_0x55c5a4['query'][_0x01d2('0x1b')]);_0x28893b[_0x01d2('0x34')]=qs[_0x01d2('0x34')](_0x55c5a4[_0x01d2('0x2e')][_0x01d2('0x34')]);}_0x28893b['order']=qs[_0x01d2('0x35')](_0x55c5a4[_0x01d2('0x2e')][_0x01d2('0x35')]);_0x28893b[_0x01d2('0x36')]=qs[_0x01d2('0x2c')](_[_0x01d2('0x37')](_0x55c5a4[_0x01d2('0x2e')],_0x1694f6['filters']),_0x2ebb61);if(_0x55c5a4[_0x01d2('0x2e')][_0x01d2('0x38')]){_0x28893b[_0x01d2('0x36')]=_['merge'](_0x28893b[_0x01d2('0x36')],{'$or':_[_0x01d2('0x27')](_0x2ebb61,function(_0x11dff8){if(_0x11dff8[_0x01d2('0x28')]!==_0x01d2('0x39')){var _0x2f6aa4={};_0x2f6aa4[_0x11dff8[_0x01d2('0x24')]]={'$like':'%'+_0x55c5a4[_0x01d2('0x2e')][_0x01d2('0x38')]+'%'};return _0x2f6aa4;}})});}_0x28893b=_['merge']({},_0x28893b,_0x55c5a4[_0x01d2('0x3a')]);var _0x5b9ad1={'where':_0x28893b[_0x01d2('0x36')]};return db['ZohoField'][_0x01d2('0x1a')](_0x5b9ad1)[_0x01d2('0x1f')](function(_0x2993a8){_0x5e9e4d[_0x01d2('0x1a')]=_0x2993a8;if(_0x55c5a4[_0x01d2('0x2e')][_0x01d2('0x3b')]){_0x28893b[_0x01d2('0x3c')]=[{'all':!![]}];}return db[_0x01d2('0x3d')]['findAll'](_0x28893b);})[_0x01d2('0x1f')](function(_0x32a1fc){_0x5e9e4d[_0x01d2('0x3e')]=_0x32a1fc;return _0x5e9e4d;})['then'](respondWithFilteredResult(_0x23ec39,_0x28893b))[_0x01d2('0x3f')](handleError(_0x23ec39,null));};exports[_0x01d2('0x40')]=function(_0x5f4390,_0xe7dd0a){var _0x3e0929={'raw':!![],'where':{'id':_0x5f4390[_0x01d2('0x41')]['id']}},_0x5ca021={};_0x5ca021[_0x01d2('0x2a')]=_[_0x01d2('0x2b')](db['ZohoField'][_0x01d2('0x42')]);_0x5ca021[_0x01d2('0x2e')]=_[_0x01d2('0x2b')](_0x5f4390[_0x01d2('0x2e')]);_0x5ca021['filtears']=_['intersection'](_0x5ca021['model'],_0x5ca021[_0x01d2('0x2e')]);_0x3e0929[_0x01d2('0x30')]=_[_0x01d2('0x2d')](_0x5ca021[_0x01d2('0x2a')],qs['fields'](_0x5f4390[_0x01d2('0x2e')][_0x01d2('0x2f')]));_0x3e0929[_0x01d2('0x30')]=_0x3e0929[_0x01d2('0x30')][_0x01d2('0x31')]?_0x3e0929[_0x01d2('0x30')]:_0x5ca021[_0x01d2('0x2a')];if(_0x5f4390[_0x01d2('0x2e')][_0x01d2('0x3b')]){_0x3e0929[_0x01d2('0x3c')]=[{'all':!![]}];}_0x3e0929=_[_0x01d2('0x43')]({},_0x3e0929,_0x5f4390[_0x01d2('0x3a')]);return db[_0x01d2('0x3d')]['find'](_0x3e0929)[_0x01d2('0x1f')](handleEntityNotFound(_0xe7dd0a,null))[_0x01d2('0x1f')](respondWithResult(_0xe7dd0a,null))[_0x01d2('0x3f')](handleError(_0xe7dd0a,null));};exports['create']=function(_0x5f0991,_0x1bf869){return db[_0x01d2('0x3d')][_0x01d2('0x44')](_0x5f0991[_0x01d2('0x45')],{})[_0x01d2('0x1f')](respondWithResult(_0x1bf869,0xc9))[_0x01d2('0x3f')](handleError(_0x1bf869,null));};exports[_0x01d2('0x46')]=function(_0xeb1ca5,_0x17ad73){if(_0xeb1ca5[_0x01d2('0x45')]['id']){delete _0xeb1ca5[_0x01d2('0x45')]['id'];}return db[_0x01d2('0x3d')][_0x01d2('0x47')]({'where':{'id':_0xeb1ca5[_0x01d2('0x41')]['id']}})[_0x01d2('0x1f')](handleEntityNotFound(_0x17ad73,null))[_0x01d2('0x1f')](saveUpdates(_0xeb1ca5[_0x01d2('0x45')],null))['then'](respondWithResult(_0x17ad73,null))[_0x01d2('0x3f')](handleError(_0x17ad73,null));};exports['destroy']=function(_0x15c160,_0x5dd39a){return db['ZohoField'][_0x01d2('0x47')]({'where':{'id':_0x15c160[_0x01d2('0x41')]['id']}})[_0x01d2('0x1f')](handleEntityNotFound(_0x5dd39a,null))['then'](removeEntity(_0x5dd39a,null))[_0x01d2('0x3f')](handleError(_0x5dd39a,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 668799e..9b65c1e 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 _0x9444=['path','../../config/environment','./intZohoField.attributes','define','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x292f93,_0x2c6e8e){var _0x5a94b1=function(_0x25735e){while(--_0x25735e){_0x292f93['push'](_0x292f93['shift']());}};_0x5a94b1(++_0x2c6e8e);}(_0x9444,0x140));var _0x4944=function(_0x1b91c7,_0x539acd){_0x1b91c7=_0x1b91c7-0x0;var _0xbbe014=_0x9444[_0x1b91c7];return _0xbbe014;};'use strict';var _=require(_0x4944('0x0'));var util=require(_0x4944('0x1'));var logger=require('../../config/logger')(_0x4944('0x2'));var moment=require(_0x4944('0x3'));var BPromise=require(_0x4944('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4944('0x5'));var rimraf=require('rimraf');var config=require(_0x4944('0x6'));var attributes=require(_0x4944('0x7'));module['exports']=function(_0x325f08,_0x3debd6){return _0x325f08[_0x4944('0x8')](_0x4944('0x9'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x4944('0xa'),'fields':[_0x4944('0xb'),_0x4944('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x97d1=['moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash','util','../../config/logger','api'];(function(_0x3296f2,_0xa17c5b){var _0x226c1c=function(_0x3b2288){while(--_0x3b2288){_0x3296f2['push'](_0x3296f2['shift']());}};_0x226c1c(++_0xa17c5b);}(_0x97d1,0x119));var _0x197d=function(_0x1defb2,_0x429099){_0x1defb2=_0x1defb2-0x0;var _0xad8973=_0x97d1[_0x1defb2];return _0xad8973;};'use strict';var _=require(_0x197d('0x0'));var util=require(_0x197d('0x1'));var logger=require(_0x197d('0x2'))(_0x197d('0x3'));var moment=require(_0x197d('0x4'));var BPromise=require(_0x197d('0x5'));var rp=require(_0x197d('0x6'));var fs=require('fs');var path=require(_0x197d('0x7'));var rimraf=require('rimraf');var config=require(_0x197d('0x8'));var attributes=require(_0x197d('0x9'));module['exports']=function(_0x140dac,_0x187b0d){return _0x140dac[_0x197d('0xa')](_0x197d('0xb'),attributes,{'tableName':_0x197d('0xc'),'paranoid':![],'indexes':[{'name':_0x197d('0xd'),'fields':['idField',_0x197d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 2b60ca6..53af176 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 _0x207c=['message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error'];(function(_0x270b6e,_0x163d77){var _0x5b8a43=function(_0x120742){while(--_0x120742){_0x270b6e['push'](_0x270b6e['shift']());}};_0x5b8a43(++_0x163d77);}(_0x207c,0x1e8));var _0xc207=function(_0x19f8ee,_0x3e08c2){_0x19f8ee=_0x19f8ee-0x0;var _0x3b68f2=_0x207c[_0x19f8ee];return _0x3b68f2;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var BPromise=require(_0xc207('0x2'));var rs=require(_0xc207('0x3'));var fs=require('fs');var Redis=require(_0xc207('0x4'));var db=require(_0xc207('0x5'))['db'];var utils=require(_0xc207('0x6'));var logger=require('../../config/logger')(_0xc207('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc207('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x314561,_0x3395e4,_0x59ff6f){return new BPromise(function(_0x25cb97,_0xad159b){return client[_0xc207('0x9')](_0x314561,_0x59ff6f)['then'](function(_0xffae6c){logger[_0xc207('0xa')](_0xc207('0xb'),_0x3395e4,_0xc207('0xc'));logger[_0xc207('0xd')](_0xc207('0xe'),_0x3395e4,'request\x20sent',JSON['stringify'](_0xffae6c));if(_0xffae6c['error']){if(_0xffae6c[_0xc207('0xf')]['code']===0x1f4){logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0xad159b(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0x25cb97(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}else{logger[_0xc207('0xa')]('ZohoField,\x20%s,\x20%s',_0x3395e4,'request\x20sent');_0x25cb97(_0xffae6c['result'][_0xc207('0x10')]);}})[_0xc207('0x11')](function(_0x3d9c7b){logger[_0xc207('0xf')]('ZohoField,\x20%s,\x20%s',_0x3395e4,_0x3d9c7b);_0xad159b(_0x3d9c7b);});});} \ No newline at end of file +var _0xee14=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','ZohoField,\x20%s,\x20%s','message','result','catch','moment'];(function(_0x8774bd,_0x59a02d){var _0x3df1cb=function(_0x4f7bf3){while(--_0x4f7bf3){_0x8774bd['push'](_0x8774bd['shift']());}};_0x3df1cb(++_0x59a02d);}(_0xee14,0x13a));var _0x4ee1=function(_0x413673,_0xfd6a9b){_0x413673=_0x413673-0x0;var _0x5b5960=_0xee14[_0x413673];return _0x5b5960;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ee1('0x0'));var BPromise=require(_0x4ee1('0x1'));var rs=require(_0x4ee1('0x2'));var fs=require('fs');var Redis=require(_0x4ee1('0x3'));var db=require(_0x4ee1('0x4'))['db'];var utils=require(_0x4ee1('0x5'));var logger=require(_0x4ee1('0x6'))(_0x4ee1('0x7'));var config=require(_0x4ee1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4ee1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x327c18,_0x3a45a3,_0x187656){return new BPromise(function(_0x293d5f,_0xdfe9c1){return client[_0x4ee1('0xa')](_0x327c18,_0x187656)['then'](function(_0x33dbe6){logger[_0x4ee1('0xb')]('ZohoField,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));logger[_0x4ee1('0xd')](_0x4ee1('0xe'),_0x3a45a3,_0x4ee1('0xc'),JSON['stringify'](_0x33dbe6));if(_0x33dbe6[_0x4ee1('0xf')]){if(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x10')]===0x1f4){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')]['message']);return _0xdfe9c1(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);return _0x293d5f(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}else{logger[_0x4ee1('0xb')]('ZohoField,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));_0x293d5f(_0x33dbe6[_0x4ee1('0x13')][_0x4ee1('0x12')]);}})[_0x4ee1('0x14')](function(_0x123c5e){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x123c5e);_0xdfe9c1(_0x123c5e);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index f67dc92..5f4387a 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 _0x142f=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','connect-timeout'];(function(_0xd15fda,_0x434eb2){var _0x135177=function(_0x16b4cd){while(--_0x16b4cd){_0xd15fda['push'](_0xd15fda['shift']());}};_0x135177(++_0x434eb2);}(_0x142f,0x136));var _0xf142=function(_0x4072ec,_0x46066d){_0x4072ec=_0x4072ec-0x0;var _0x4053c2=_0x142f[_0x4072ec];return _0x4053c2;};'use strict';var multer=require(_0xf142('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf142('0x1'));var express=require(_0xf142('0x2'));var router=express[_0xf142('0x3')]();var auth=require(_0xf142('0x4'));var interaction=require(_0xf142('0x5'));var config=require(_0xf142('0x6'));module[_0xf142('0x7')]=router; \ No newline at end of file +var _0xc0b5=['multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x3541e3,_0x5e6812){var _0xbe2f25=function(_0x4e007c){while(--_0x4e007c){_0x3541e3['push'](_0x3541e3['shift']());}};_0xbe2f25(++_0x5e6812);}(_0xc0b5,0x118));var _0x5c0b=function(_0x21ef6c,_0x763675){_0x21ef6c=_0x21ef6c-0x0;var _0x509458=_0xc0b5[_0x21ef6c];return _0x509458;};'use strict';var multer=require(_0x5c0b('0x0'));var util=require('util');var path=require(_0x5c0b('0x1'));var timeout=require(_0x5c0b('0x2'));var express=require(_0x5c0b('0x3'));var router=express['Router']();var auth=require(_0x5c0b('0x4'));var interaction=require(_0x5c0b('0x5'));var config=require(_0x5c0b('0x6'));module[_0x5c0b('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 156eb07..3f3a676 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 _0x3775=['state','sequelize','exports','unique_name_and_version','STRING','INTEGER','BOOLEAN'];(function(_0x3ff4a3,_0xa5bfa6){var _0x38676f=function(_0x3ab2b1){while(--_0x3ab2b1){_0x3ff4a3['push'](_0x3ff4a3['shift']());}};_0x38676f(++_0xa5bfa6);}(_0x3775,0x94));var _0x5377=function(_0x3d83f2,_0x1a743c){_0x3d83f2=_0x3d83f2-0x0;var _0x497879=_0x3775[_0x3d83f2];return _0x497879;};'use strict';var Sequelize=require(_0x5377('0x0'));module[_0x5377('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5377('0x2')},'version':{'type':Sequelize[_0x5377('0x3')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x5377('0x3')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x5377('0x3')]},'path':{'type':Sequelize[_0x5377('0x3')]},'type':{'type':Sequelize[_0x5377('0x3')]},'size':{'type':Sequelize[_0x5377('0x4')]},'active':{'type':Sequelize[_0x5377('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x5377('0x3')]},'logo':{'type':Sequelize[_0x5377('0x3')]},'state':{'type':Sequelize[_0x5377('0x3')],'unique':_0x5377('0x6')},'description':{'type':Sequelize[_0x5377('0x3')]},'title':{'type':Sequelize[_0x5377('0x3')]},'remoteUri':{'type':Sequelize[_0x5377('0x3')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xe4fa=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x36f6e8,_0x32888b){var _0xd7ecd9=function(_0x2144d4){while(--_0x2144d4){_0x36f6e8['push'](_0x36f6e8['shift']());}};_0xd7ecd9(++_0x32888b);}(_0xe4fa,0x73));var _0xae4f=function(_0x4c9561,_0x11c762){_0x4c9561=_0x4c9561-0x0;var _0x526eb2=_0xe4fa[_0x4c9561];return _0x526eb2;};'use strict';var Sequelize=require(_0xae4f('0x0'));module[_0xae4f('0x1')]={'name':{'type':Sequelize[_0xae4f('0x2')],'allowNull':![],'unique':_0xae4f('0x3')},'version':{'type':Sequelize[_0xae4f('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xae4f('0x2')],'defaultValue':_0xae4f('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xae4f('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xae4f('0x5')]},'active':{'type':Sequelize[_0xae4f('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xae4f('0x2')]},'logo':{'type':Sequelize[_0xae4f('0x2')]},'state':{'type':Sequelize[_0xae4f('0x2')],'unique':_0xae4f('0x7')},'description':{'type':Sequelize[_0xae4f('0x2')]},'title':{'type':Sequelize[_0xae4f('0x2')]},'remoteUri':{'type':Sequelize[_0xae4f('0x2')]},'link':{'type':Sequelize[_0xae4f('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 6cc9a3c..3d46767 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 _0xf354=['options','Integration','includeAll','include','findAll','rows','catch','show','keys','filtears','length','create','body','find','params','html-pdf','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','Content-Range','reject','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xf354,0x17c));var _0x4f35=function(_0x365e10,_0x2227c8){_0x365e10=_0x365e10-0x0;var _0x448c0b=_0xf354[_0x365e10];return _0x448c0b;};'use strict';var pdf=require(_0x4f35('0x0'));var emlformat=require(_0x4f35('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4f35('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f35('0x3'));var moment=require(_0x4f35('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4f35('0x5'));var path=require(_0x4f35('0x6'));var sox=require(_0x4f35('0x7'));var csv=require(_0x4f35('0x8'));var ejs=require(_0x4f35('0x9'));var fs=require('fs');var _=require(_0x4f35('0xa'));var squel=require(_0x4f35('0xb'));var crypto=require(_0x4f35('0xc'));var jsforce=require(_0x4f35('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4f35('0x8'));var querystring=require(_0x4f35('0xe'));var Papa=require(_0x4f35('0xf'));var Redis=require(_0x4f35('0x10'));var authService=require(_0x4f35('0x11'));var qs=require(_0x4f35('0x12'));var as=require(_0x4f35('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f35('0x14'))(_0x4f35('0x15'));var utils=require(_0x4f35('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f35('0x17'))['db'];function respondWithStatusCode(_0x3b8db0,_0x1a4326){_0x1a4326=_0x1a4326||0xcc;return function(_0x54efc8){if(_0x54efc8){return _0x3b8db0[_0x4f35('0x18')](_0x1a4326);}return _0x3b8db0['status'](_0x1a4326)[_0x4f35('0x19')]();};}function respondWithResult(_0x53d4ca,_0x1c40cb){_0x1c40cb=_0x1c40cb||0xc8;return function(_0xb74384){if(_0xb74384){return _0x53d4ca[_0x4f35('0x1a')](_0x1c40cb)[_0x4f35('0x1b')](_0xb74384);}};}function respondWithFilteredResult(_0x2c27bc,_0x144ba9){return function(_0x3135a1){if(_0x3135a1){var _0x140794=_0x3135a1[_0x4f35('0x1c')],_0x4df36d=_0x144ba9[_0x4f35('0x1d')],_0x532908=_0x144ba9[_0x4f35('0x1d')]+_0x144ba9['limit'],_0x24ce4b;if(_0x532908>=_0x140794){_0x532908=_0x140794;_0x24ce4b=0xc8;}else{_0x24ce4b=0xce;}_0x2c27bc['status'](_0x24ce4b);return _0x2c27bc['set'](_0x4f35('0x1e'),_0x4df36d+'-'+_0x532908+'/'+_0x140794)[_0x4f35('0x1b')](_0x3135a1);}return null;};}function patchUpdates(_0x2e6dfc){return function(_0x756820){try{jsonpatch['apply'](_0x756820,_0x2e6dfc,!![]);}catch(_0x36666f){return BPromise[_0x4f35('0x1f')](_0x36666f);}return _0x756820['save']();};}function saveUpdates(_0x126175,_0x521224){return function(_0x4e60b5){if(_0x4e60b5){return _0x4e60b5[_0x4f35('0x20')](_0x126175)[_0x4f35('0x21')](function(_0x137a33){return _0x137a33;});}return null;};}function removeEntity(_0x5151af,_0x5f4564){return function(_0x19f131){if(_0x19f131){return _0x19f131[_0x4f35('0x22')]()['then'](function(){_0x5151af[_0x4f35('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x407e18,_0x41619b){return function(_0x1f0de8){if(!_0x1f0de8){_0x407e18[_0x4f35('0x18')](0x194);}return _0x1f0de8;};}function handleError(_0x46fd89,_0x1ee688){_0x1ee688=_0x1ee688||0x1f4;return function(_0x54e8d9){logger[_0x4f35('0x23')](_0x54e8d9['stack']);if(_0x54e8d9[_0x4f35('0x24')]){delete _0x54e8d9['name'];}_0x46fd89['status'](_0x1ee688)[_0x4f35('0x25')](_0x54e8d9);};}exports[_0x4f35('0x26')]=function(_0x11bdba,_0x4e853a){var _0xf01660={},_0x44c466={},_0x4c4978={'count':0x0,'rows':[]};var _0x24e8fe=_[_0x4f35('0x27')](db['Integration'][_0x4f35('0x28')],function(_0x559e7b){return{'name':_0x559e7b['fieldName'],'type':_0x559e7b[_0x4f35('0x29')][_0x4f35('0x2a')]};});_0x44c466[_0x4f35('0x2b')]=_[_0x4f35('0x27')](_0x24e8fe,_0x4f35('0x24'));_0x44c466[_0x4f35('0x2c')]=_['keys'](_0x11bdba[_0x4f35('0x2c')]);_0x44c466[_0x4f35('0x2d')]=_[_0x4f35('0x2e')](_0x44c466['model'],_0x44c466[_0x4f35('0x2c')]);_0xf01660['attributes']=_[_0x4f35('0x2e')](_0x44c466[_0x4f35('0x2b')],qs[_0x4f35('0x2f')](_0x11bdba['query'][_0x4f35('0x2f')]));_0xf01660['attributes']=_0xf01660[_0x4f35('0x30')]['length']?_0xf01660[_0x4f35('0x30')]:_0x44c466[_0x4f35('0x2b')];if(!_0x11bdba['query'][_0x4f35('0x31')](_0x4f35('0x32'))){_0xf01660[_0x4f35('0x33')]=qs[_0x4f35('0x33')](_0x11bdba['query'][_0x4f35('0x33')]);_0xf01660[_0x4f35('0x1d')]=qs['offset'](_0x11bdba['query'][_0x4f35('0x1d')]);}_0xf01660['order']=qs[_0x4f35('0x34')](_0x11bdba[_0x4f35('0x2c')]['sort']);_0xf01660[_0x4f35('0x35')]=qs[_0x4f35('0x2d')](_[_0x4f35('0x36')](_0x11bdba[_0x4f35('0x2c')],_0x44c466['filters']),_0x24e8fe);if(_0x11bdba[_0x4f35('0x2c')][_0x4f35('0x37')]){_0xf01660[_0x4f35('0x35')]=_['merge'](_0xf01660[_0x4f35('0x35')],{'$or':_[_0x4f35('0x27')](_0x24e8fe,function(_0xf7b98){if(_0xf7b98[_0x4f35('0x29')]!==_0x4f35('0x38')){var _0x475cfc={};_0x475cfc[_0xf7b98['name']]={'$like':'%'+_0x11bdba['query']['filter']+'%'};return _0x475cfc;}})});}_0xf01660=_[_0x4f35('0x39')]({},_0xf01660,_0x11bdba[_0x4f35('0x3a')]);var _0x136f36={'where':_0xf01660['where']};return db[_0x4f35('0x3b')][_0x4f35('0x1c')](_0x136f36)[_0x4f35('0x21')](function(_0x3d3914){_0x4c4978[_0x4f35('0x1c')]=_0x3d3914;if(_0x11bdba['query'][_0x4f35('0x3c')]){_0xf01660[_0x4f35('0x3d')]=[{'all':!![]}];}return db[_0x4f35('0x3b')][_0x4f35('0x3e')](_0xf01660);})[_0x4f35('0x21')](function(_0x516ddd){_0x4c4978[_0x4f35('0x3f')]=_0x516ddd;return _0x4c4978;})['then'](respondWithFilteredResult(_0x4e853a,_0xf01660))[_0x4f35('0x40')](handleError(_0x4e853a,null));};exports[_0x4f35('0x41')]=function(_0x5a58a3,_0x281d0b){var _0x500f4f={'raw':![],'where':{'id':_0x5a58a3['params']['id']}},_0x4a678b={};_0x4a678b[_0x4f35('0x2b')]=_[_0x4f35('0x42')](db[_0x4f35('0x3b')]['rawAttributes']);_0x4a678b[_0x4f35('0x2c')]=_[_0x4f35('0x42')](_0x5a58a3[_0x4f35('0x2c')]);_0x4a678b[_0x4f35('0x43')]=_[_0x4f35('0x2e')](_0x4a678b['model'],_0x4a678b[_0x4f35('0x2c')]);_0x500f4f[_0x4f35('0x30')]=_[_0x4f35('0x2e')](_0x4a678b[_0x4f35('0x2b')],qs[_0x4f35('0x2f')](_0x5a58a3[_0x4f35('0x2c')]['fields']));_0x500f4f['attributes']=_0x500f4f[_0x4f35('0x30')][_0x4f35('0x44')]?_0x500f4f['attributes']:_0x4a678b[_0x4f35('0x2b')];if(_0x5a58a3[_0x4f35('0x2c')]['includeAll']){_0x500f4f['include']=[{'all':!![]}];}_0x500f4f=_['merge']({},_0x500f4f,_0x5a58a3[_0x4f35('0x3a')]);return db['Integration']['find'](_0x500f4f)['then'](handleEntityNotFound(_0x281d0b,null))[_0x4f35('0x21')](respondWithResult(_0x281d0b,null))[_0x4f35('0x40')](handleError(_0x281d0b,null));};exports[_0x4f35('0x45')]=function(_0x45fa68,_0x5a2d30){return db['Integration'][_0x4f35('0x45')](_0x45fa68['body'],{})['then'](respondWithResult(_0x5a2d30,0xc9))[_0x4f35('0x40')](handleError(_0x5a2d30,null));};exports[_0x4f35('0x20')]=function(_0xdeb3a8,_0x5b4772){if(_0xdeb3a8[_0x4f35('0x46')]['id']){delete _0xdeb3a8[_0x4f35('0x46')]['id'];}return db[_0x4f35('0x3b')][_0x4f35('0x47')]({'where':{'id':_0xdeb3a8[_0x4f35('0x48')]['id']}})[_0x4f35('0x21')](handleEntityNotFound(_0x5b4772,null))['then'](saveUpdates(_0xdeb3a8['body'],null))[_0x4f35('0x21')](respondWithResult(_0x5b4772,null))['catch'](handleError(_0x5b4772,null));};exports[_0x4f35('0x22')]=function(_0x20c6ea,_0x45c990){return db['Integration'][_0x4f35('0x47')]({'where':{'id':_0x20c6ea[_0x4f35('0x48')]['id']}})[_0x4f35('0x21')](handleEntityNotFound(_0x45c990,null))[_0x4f35('0x21')](removeEntity(_0x45c990,null))[_0x4f35('0x40')](handleError(_0x45c990,null));}; \ No newline at end of file +var _0x3be5=['key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','keys','filtears','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','Integration','rawAttributes','fieldName','type'];(function(_0x2867d8,_0xef3ee0){var _0x3b8176=function(_0x2b9eb8){while(--_0x2b9eb8){_0x2867d8['push'](_0x2867d8['shift']());}};_0x3b8176(++_0xef3ee0);}(_0x3be5,0x1e3));var _0x53be=function(_0x273260,_0x279d5c){_0x273260=_0x273260-0x0;var _0x285f9c=_0x3be5[_0x273260];return _0x285f9c;};'use strict';var pdf=require(_0x53be('0x0'));var emlformat=require(_0x53be('0x1'));var rimraf=require(_0x53be('0x2'));var zipdir=require(_0x53be('0x3'));var jsonpatch=require(_0x53be('0x4'));var rp=require(_0x53be('0x5'));var moment=require(_0x53be('0x6'));var BPromise=require(_0x53be('0x7'));var Mustache=require(_0x53be('0x8'));var util=require(_0x53be('0x9'));var path=require('path');var sox=require(_0x53be('0xa'));var csv=require(_0x53be('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x53be('0xc'));var squel=require(_0x53be('0xd'));var crypto=require('crypto');var jsforce=require(_0x53be('0xe'));var deskjs=require(_0x53be('0xf'));var toCsv=require('to-csv');var querystring=require(_0x53be('0x10'));var Papa=require('papaparse');var Redis=require(_0x53be('0x11'));var authService=require(_0x53be('0x12'));var qs=require(_0x53be('0x13'));var as=require(_0x53be('0x14'));var hardwareService=require(_0x53be('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x53be('0x16'));var config=require(_0x53be('0x17'));var licenseUtil=require(_0x53be('0x18'));var db=require(_0x53be('0x19'))['db'];function respondWithStatusCode(_0x392b48,_0x43cc24){_0x43cc24=_0x43cc24||0xcc;return function(_0x247143){if(_0x247143){return _0x392b48[_0x53be('0x1a')](_0x43cc24);}return _0x392b48[_0x53be('0x1b')](_0x43cc24)[_0x53be('0x1c')]();};}function respondWithResult(_0x21c6d9,_0x3ad5ec){_0x3ad5ec=_0x3ad5ec||0xc8;return function(_0x42a6f4){if(_0x42a6f4){return _0x21c6d9['status'](_0x3ad5ec)['json'](_0x42a6f4);}};}function respondWithFilteredResult(_0xb554ea,_0x685b24){return function(_0x5aaaac){if(_0x5aaaac){var _0x535825=_0x5aaaac[_0x53be('0x1d')],_0x83f1f7=_0x685b24[_0x53be('0x1e')],_0x26db49=_0x685b24[_0x53be('0x1e')]+_0x685b24[_0x53be('0x1f')],_0xce866e;if(_0x26db49>=_0x535825){_0x26db49=_0x535825;_0xce866e=0xc8;}else{_0xce866e=0xce;}_0xb554ea[_0x53be('0x1b')](_0xce866e);return _0xb554ea[_0x53be('0x20')](_0x53be('0x21'),_0x83f1f7+'-'+_0x26db49+'/'+_0x535825)['json'](_0x5aaaac);}return null;};}function patchUpdates(_0x2880c0){return function(_0x51d932){try{jsonpatch[_0x53be('0x22')](_0x51d932,_0x2880c0,!![]);}catch(_0x2d187e){return BPromise[_0x53be('0x23')](_0x2d187e);}return _0x51d932[_0x53be('0x24')]();};}function saveUpdates(_0x39875e,_0x295ab5){return function(_0x5cbd31){if(_0x5cbd31){return _0x5cbd31[_0x53be('0x25')](_0x39875e)[_0x53be('0x26')](function(_0x538f8){return _0x538f8;});}return null;};}function removeEntity(_0x1933af,_0x44e66c){return function(_0x13d5e2){if(_0x13d5e2){return _0x13d5e2[_0x53be('0x27')]()[_0x53be('0x26')](function(){_0x1933af[_0x53be('0x1b')](0xcc)[_0x53be('0x1c')]();});}};}function handleEntityNotFound(_0x4d161f,_0x54f1e1){return function(_0x3fce6a){if(!_0x3fce6a){_0x4d161f[_0x53be('0x1a')](0x194);}return _0x3fce6a;};}function handleError(_0x3a903f,_0x57d944){_0x57d944=_0x57d944||0x1f4;return function(_0x5f57b5){logger[_0x53be('0x28')](_0x5f57b5[_0x53be('0x29')]);if(_0x5f57b5[_0x53be('0x2a')]){delete _0x5f57b5[_0x53be('0x2a')];}_0x3a903f['status'](_0x57d944)['send'](_0x5f57b5);};}exports[_0x53be('0x2b')]=function(_0x241de7,_0x59355e){var _0x584018={},_0x595ccd={},_0x4114d1={'count':0x0,'rows':[]};var _0x284011=_[_0x53be('0x2c')](db[_0x53be('0x2d')][_0x53be('0x2e')],function(_0x3bfce8){return{'name':_0x3bfce8[_0x53be('0x2f')],'type':_0x3bfce8[_0x53be('0x30')][_0x53be('0x31')]};});_0x595ccd['model']=_['map'](_0x284011,'name');_0x595ccd[_0x53be('0x32')]=_['keys'](_0x241de7[_0x53be('0x32')]);_0x595ccd['filters']=_[_0x53be('0x33')](_0x595ccd[_0x53be('0x34')],_0x595ccd[_0x53be('0x32')]);_0x584018[_0x53be('0x35')]=_[_0x53be('0x33')](_0x595ccd[_0x53be('0x34')],qs[_0x53be('0x36')](_0x241de7[_0x53be('0x32')][_0x53be('0x36')]));_0x584018[_0x53be('0x35')]=_0x584018[_0x53be('0x35')][_0x53be('0x37')]?_0x584018[_0x53be('0x35')]:_0x595ccd['model'];if(!_0x241de7['query'][_0x53be('0x38')](_0x53be('0x39'))){_0x584018[_0x53be('0x1f')]=qs[_0x53be('0x1f')](_0x241de7[_0x53be('0x32')][_0x53be('0x1f')]);_0x584018[_0x53be('0x1e')]=qs[_0x53be('0x1e')](_0x241de7[_0x53be('0x32')][_0x53be('0x1e')]);}_0x584018['order']=qs[_0x53be('0x3a')](_0x241de7[_0x53be('0x32')][_0x53be('0x3a')]);_0x584018[_0x53be('0x3b')]=qs[_0x53be('0x3c')](_[_0x53be('0x3d')](_0x241de7[_0x53be('0x32')],_0x595ccd[_0x53be('0x3c')]),_0x284011);if(_0x241de7[_0x53be('0x32')]['filter']){_0x584018[_0x53be('0x3b')]=_['merge'](_0x584018[_0x53be('0x3b')],{'$or':_[_0x53be('0x2c')](_0x284011,function(_0x5d34fb){if(_0x5d34fb[_0x53be('0x30')]!==_0x53be('0x3e')){var _0x4afe12={};_0x4afe12[_0x5d34fb['name']]={'$like':'%'+_0x241de7['query'][_0x53be('0x3f')]+'%'};return _0x4afe12;}})});}_0x584018=_[_0x53be('0x40')]({},_0x584018,_0x241de7[_0x53be('0x41')]);var _0x67378d={'where':_0x584018['where']};return db[_0x53be('0x2d')][_0x53be('0x1d')](_0x67378d)['then'](function(_0x363620){_0x4114d1[_0x53be('0x1d')]=_0x363620;if(_0x241de7[_0x53be('0x32')][_0x53be('0x42')]){_0x584018[_0x53be('0x43')]=[{'all':!![]}];}return db[_0x53be('0x2d')]['findAll'](_0x584018);})[_0x53be('0x26')](function(_0x164530){_0x4114d1[_0x53be('0x44')]=_0x164530;return _0x4114d1;})['then'](respondWithFilteredResult(_0x59355e,_0x584018))[_0x53be('0x45')](handleError(_0x59355e,null));};exports['show']=function(_0x247a0b,_0x2ea084){var _0x3ffa25={'raw':![],'where':{'id':_0x247a0b['params']['id']}},_0x15bb83={};_0x15bb83[_0x53be('0x34')]=_['keys'](db['Integration']['rawAttributes']);_0x15bb83[_0x53be('0x32')]=_[_0x53be('0x46')](_0x247a0b[_0x53be('0x32')]);_0x15bb83[_0x53be('0x47')]=_['intersection'](_0x15bb83[_0x53be('0x34')],_0x15bb83[_0x53be('0x32')]);_0x3ffa25[_0x53be('0x35')]=_[_0x53be('0x33')](_0x15bb83[_0x53be('0x34')],qs[_0x53be('0x36')](_0x247a0b['query']['fields']));_0x3ffa25[_0x53be('0x35')]=_0x3ffa25['attributes'][_0x53be('0x37')]?_0x3ffa25['attributes']:_0x15bb83[_0x53be('0x34')];if(_0x247a0b['query'][_0x53be('0x42')]){_0x3ffa25['include']=[{'all':!![]}];}_0x3ffa25=_[_0x53be('0x40')]({},_0x3ffa25,_0x247a0b['options']);return db[_0x53be('0x2d')][_0x53be('0x48')](_0x3ffa25)[_0x53be('0x26')](handleEntityNotFound(_0x2ea084,null))['then'](respondWithResult(_0x2ea084,null))[_0x53be('0x45')](handleError(_0x2ea084,null));};exports[_0x53be('0x49')]=function(_0x215956,_0x816c12){return db[_0x53be('0x2d')][_0x53be('0x49')](_0x215956[_0x53be('0x4a')],{})[_0x53be('0x26')](respondWithResult(_0x816c12,0xc9))[_0x53be('0x45')](handleError(_0x816c12,null));};exports[_0x53be('0x25')]=function(_0x3f3158,_0x2dd837){if(_0x3f3158[_0x53be('0x4a')]['id']){delete _0x3f3158['body']['id'];}return db[_0x53be('0x2d')][_0x53be('0x48')]({'where':{'id':_0x3f3158[_0x53be('0x4b')]['id']}})[_0x53be('0x26')](handleEntityNotFound(_0x2dd837,null))[_0x53be('0x26')](saveUpdates(_0x3f3158[_0x53be('0x4a')],null))[_0x53be('0x26')](respondWithResult(_0x2dd837,null))[_0x53be('0x45')](handleError(_0x2dd837,null));};exports[_0x53be('0x27')]=function(_0x4da947,_0x5451a3){return db[_0x53be('0x2d')][_0x53be('0x48')]({'where':{'id':_0x4da947['params']['id']}})[_0x53be('0x26')](handleEntityNotFound(_0x5451a3,null))[_0x53be('0x26')](removeEntity(_0x5451a3,null))[_0x53be('0x45')](handleError(_0x5451a3,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 55eb6f7..b222f17 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 _0xef11=['../../config/logger','api','moment','bluebird','path','../../config/environment','./integration.attributes','exports','define','Integration','lodash','util'];(function(_0x403f3c,_0x4f9396){var _0x22e4da=function(_0x490845){while(--_0x490845){_0x403f3c['push'](_0x403f3c['shift']());}};_0x22e4da(++_0x4f9396);}(_0xef11,0xd6));var _0x1ef1=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xef11[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x1ef1('0x0'));var util=require(_0x1ef1('0x1'));var logger=require(_0x1ef1('0x2'))(_0x1ef1('0x3'));var moment=require(_0x1ef1('0x4'));var BPromise=require(_0x1ef1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ef1('0x6'));var rimraf=require('rimraf');var config=require(_0x1ef1('0x7'));var attributes=require(_0x1ef1('0x8'));module[_0x1ef1('0x9')]=function(_0x32dadf,_0x4a17e3){return _0x32dadf[_0x1ef1('0xa')](_0x1ef1('0xb'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8a7=['../../config/logger','api','moment','path','rimraf','../../config/environment','./integration.attributes','util'];(function(_0x3feb66,_0x2f2c30){var _0x266f03=function(_0x190464){while(--_0x190464){_0x3feb66['push'](_0x3feb66['shift']());}};_0x266f03(++_0x2f2c30);}(_0xb8a7,0x167));var _0x7b8a=function(_0x326c2d,_0x353f82){_0x326c2d=_0x326c2d-0x0;var _0x1dea28=_0xb8a7[_0x326c2d];return _0x1dea28;};'use strict';var _=require('lodash');var util=require(_0x7b8a('0x0'));var logger=require(_0x7b8a('0x1'))(_0x7b8a('0x2'));var moment=require(_0x7b8a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b8a('0x4'));var rimraf=require(_0x7b8a('0x5'));var config=require(_0x7b8a('0x6'));var attributes=require(_0x7b8a('0x7'));module['exports']=function(_0x3717bf,_0x272cc3){return _0x3717bf['define']('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 9c19522..6bab755 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 _0x6208=['code','message','result','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','error'];(function(_0x3e5608,_0x8b6979){var _0x4128d3=function(_0x137c60){while(--_0x137c60){_0x3e5608['push'](_0x3e5608['shift']());}};_0x4128d3(++_0x8b6979);}(_0x6208,0x17d));var _0x8620=function(_0x1e8b1e,_0x407bbd){_0x1e8b1e=_0x1e8b1e-0x0;var _0x4a0fde=_0x6208[_0x1e8b1e];return _0x4a0fde;};'use strict';var _=require(_0x8620('0x0'));var util=require('util');var moment=require(_0x8620('0x1'));var BPromise=require(_0x8620('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8620('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8620('0x4'));var logger=require(_0x8620('0x5'))(_0x8620('0x6'));var config=require(_0x8620('0x7'));var jayson=require(_0x8620('0x8'));var client=jayson[_0x8620('0x9')][_0x8620('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x525095,_0x270a35,_0x1a6e9e){return new BPromise(function(_0x92a9cb,_0x4694f2){return client[_0x8620('0xb')](_0x525095,_0x1a6e9e)[_0x8620('0xc')](function(_0x10f234){logger[_0x8620('0xd')](_0x8620('0xe'),_0x270a35,'request\x20sent');logger[_0x8620('0xf')](_0x8620('0x10'),_0x270a35,'request\x20sent',JSON['stringify'](_0x10f234));if(_0x10f234[_0x8620('0x11')]){if(_0x10f234[_0x8620('0x11')][_0x8620('0x12')]===0x1f4){logger[_0x8620('0x11')](_0x8620('0xe'),_0x270a35,_0x10f234[_0x8620('0x11')]['message']);return _0x4694f2(_0x10f234[_0x8620('0x11')]['message']);}logger[_0x8620('0x11')](_0x8620('0xe'),_0x270a35,_0x10f234[_0x8620('0x11')][_0x8620('0x13')]);return _0x92a9cb(_0x10f234['error'][_0x8620('0x13')]);}else{logger[_0x8620('0xd')]('Integration,\x20%s,\x20%s',_0x270a35,'request\x20sent');_0x92a9cb(_0x10f234[_0x8620('0x14')][_0x8620('0x13')]);}})['catch'](function(_0x23c8e4){logger['error'](_0x8620('0xe'),_0x270a35,_0x23c8e4);_0x4694f2(_0x23c8e4);});});} \ No newline at end of file +var _0x7d7f=['error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/environment','http','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s'];(function(_0x4f77fe,_0x5d218e){var _0x4261e2=function(_0x3f9114){while(--_0x3f9114){_0x4f77fe['push'](_0x4f77fe['shift']());}};_0x4261e2(++_0x5d218e);}(_0x7d7f,0xa3));var _0xf7d7=function(_0x54f43c,_0x3869c0){_0x54f43c=_0x54f43c-0x0;var _0x18f69a=_0x7d7f[_0x54f43c];return _0x18f69a;};'use strict';var _=require(_0xf7d7('0x0'));var util=require(_0xf7d7('0x1'));var moment=require('moment');var BPromise=require(_0xf7d7('0x2'));var rs=require(_0xf7d7('0x3'));var fs=require('fs');var Redis=require(_0xf7d7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf7d7('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf7d7('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xa46787,_0x3c8e45,_0x1a1d70){return new BPromise(function(_0x25989c,_0x54e740){return client['request'](_0xa46787,_0x1a1d70)[_0xf7d7('0x7')](function(_0x496bab){logger[_0xf7d7('0x8')](_0xf7d7('0x9'),_0x3c8e45,_0xf7d7('0xa'));logger[_0xf7d7('0xb')](_0xf7d7('0xc'),_0x3c8e45,_0xf7d7('0xa'),JSON['stringify'](_0x496bab));if(_0x496bab['error']){if(_0x496bab[_0xf7d7('0xd')]['code']===0x1f4){logger[_0xf7d7('0xd')](_0xf7d7('0x9'),_0x3c8e45,_0x496bab[_0xf7d7('0xd')][_0xf7d7('0xe')]);return _0x54e740(_0x496bab[_0xf7d7('0xd')][_0xf7d7('0xe')]);}logger[_0xf7d7('0xd')](_0xf7d7('0x9'),_0x3c8e45,_0x496bab[_0xf7d7('0xd')][_0xf7d7('0xe')]);return _0x25989c(_0x496bab['error'][_0xf7d7('0xe')]);}else{logger['info']('Integration,\x20%s,\x20%s',_0x3c8e45,_0xf7d7('0xa'));_0x25989c(_0x496bab['result'][_0xf7d7('0xe')]);}})[_0xf7d7('0xf')](function(_0x48533e){logger[_0xf7d7('0xd')](_0xf7d7('0x9'),_0x3c8e45,_0x48533e);_0x54e740(_0x48533e);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 742f6c6..4496fc2 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 _0xe36f=['destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','delete'];(function(_0x352bf7,_0x2a12a1){var _0x1f3176=function(_0xa6d803){while(--_0xa6d803){_0x352bf7['push'](_0x352bf7['shift']());}};_0x1f3176(++_0x2a12a1);}(_0xe36f,0x189));var _0xfe36=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe36f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xfe36('0x0'));var util=require(_0xfe36('0x1'));var path=require('path');var timeout=require(_0xfe36('0x2'));var express=require('express');var router=express[_0xfe36('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xfe36('0x4'));var config=require('../../config/environment');var controller=require(_0xfe36('0x5'));router[_0xfe36('0x6')]('/',auth[_0xfe36('0x7')](),controller['index']);router['get'](_0xfe36('0x8'),auth[_0xfe36('0x7')](),controller[_0xfe36('0x9')]);router['get'](_0xfe36('0xa'),auth[_0xfe36('0x7')](),controller[_0xfe36('0xb')]);router[_0xfe36('0xc')]('/',auth[_0xfe36('0x7')](),controller['create']);router[_0xfe36('0xd')](_0xfe36('0xa'),auth[_0xfe36('0x7')](),controller['update']);router[_0xfe36('0xe')](_0xfe36('0xa'),auth[_0xfe36('0x7')](),controller[_0xfe36('0xf')]);module[_0xfe36('0x10')]=router; \ No newline at end of file +var _0x77fd=['isAuthenticated','/describe','describe','show','create','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get'];(function(_0x452725,_0x21ac31){var _0x16d15d=function(_0x1874b4){while(--_0x1874b4){_0x452725['push'](_0x452725['shift']());}};_0x16d15d(++_0x21ac31);}(_0x77fd,0xb4));var _0xd77f=function(_0xbde1ba,_0x2f2a8e){_0xbde1ba=_0xbde1ba-0x0;var _0x3da47a=_0x77fd[_0xbde1ba];return _0x3da47a;};'use strict';var multer=require(_0xd77f('0x0'));var util=require(_0xd77f('0x1'));var path=require(_0xd77f('0x2'));var timeout=require(_0xd77f('0x3'));var express=require(_0xd77f('0x4'));var router=express[_0xd77f('0x5')]();var auth=require(_0xd77f('0x6'));var interaction=require(_0xd77f('0x7'));var config=require('../../config/environment');var controller=require(_0xd77f('0x8'));router[_0xd77f('0x9')]('/',auth[_0xd77f('0xa')](),controller['index']);router[_0xd77f('0x9')](_0xd77f('0xb'),auth[_0xd77f('0xa')](),controller[_0xd77f('0xc')]);router[_0xd77f('0x9')]('/:id',auth[_0xd77f('0xa')](),controller[_0xd77f('0xd')]);router['post']('/',auth[_0xd77f('0xa')](),controller[_0xd77f('0xe')]);router[_0xd77f('0xf')](_0xd77f('0x10'),auth[_0xd77f('0xa')](),controller[_0xd77f('0x11')]);router[_0xd77f('0x12')](_0xd77f('0x10'),auth[_0xd77f('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 266b247..5e50392 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 _0x6aa0=['STRING','DATE','BOOLEAN','INTEGER','TEXT','ENUM','SENT','RECEIVED','FAILED','exports'];(function(_0x4fc5df,_0x3acaab){var _0x4a18f5=function(_0x241409){while(--_0x241409){_0x4fc5df['push'](_0x4fc5df['shift']());}};_0x4a18f5(++_0x3acaab);}(_0x6aa0,0x117));var _0x06aa=function(_0x1ae4a9,_0x4c0ed9){_0x1ae4a9=_0x1ae4a9-0x0;var _0x54d0b0=_0x6aa0[_0x1ae4a9];return _0x54d0b0;};'use strict';var Sequelize=require('sequelize');module[_0x06aa('0x0')]={'integration':{'type':Sequelize[_0x06aa('0x1')]},'eventChannel':{'type':Sequelize[_0x06aa('0x1')]},'exitStatus':{'type':Sequelize[_0x06aa('0x1')]},'ticketId':{'type':Sequelize[_0x06aa('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x06aa('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x06aa('0x1')]},'calleridname':{'type':Sequelize[_0x06aa('0x1')]},'queue':{'type':Sequelize[_0x06aa('0x1')]},'interface':{'type':Sequelize[_0x06aa('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x06aa('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x06aa('0x2')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x06aa('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x06aa('0x4')]},'reason':{'type':Sequelize[_0x06aa('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x06aa('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x06aa('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x06aa('0x2')]},'lastevent':{'type':Sequelize[_0x06aa('0x1')]},'channel':{'type':Sequelize[_0x06aa('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x06aa('0x1')]},'connectedlinenum':{'type':Sequelize[_0x06aa('0x1')]},'connectedlinename':{'type':Sequelize[_0x06aa('0x1')]},'language':{'type':Sequelize[_0x06aa('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x06aa('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x06aa('0x1')]},'destchannel':{'type':Sequelize[_0x06aa('0x1')]},'destchannelstate':{'type':Sequelize[_0x06aa('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x06aa('0x1')]},'destcalleridnum':{'type':Sequelize[_0x06aa('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x06aa('0x1')]},'destcontext':{'type':Sequelize[_0x06aa('0x1')]},'destexten':{'type':Sequelize[_0x06aa('0x1')]},'destpriority':{'type':Sequelize[_0x06aa('0x1')]},'destuniqueid':{'type':Sequelize[_0x06aa('0x1')]},'messageId':{'type':Sequelize[_0x06aa('0x1')]},'inReplyTo':{'type':Sequelize[_0x06aa('0x1')]},'subject':{'type':Sequelize[_0x06aa('0x1')]},'from':{'type':Sequelize[_0x06aa('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x06aa('0x5')]},'text':{'type':Sequelize[_0x06aa('0x5')]},'status':{'type':Sequelize[_0x06aa('0x6')](_0x06aa('0x7'),'SENDING',_0x06aa('0x8'),_0x06aa('0x9'))},'url':{'type':Sequelize[_0x06aa('0x1')]},'app':{'type':Sequelize[_0x06aa('0x1')]},'appdata':{'type':Sequelize[_0x06aa('0x1')]},'projectId':{'type':Sequelize[_0x06aa('0x4')]}}; \ No newline at end of file +var _0x3a58=['FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED'];(function(_0x39a2d6,_0x477459){var _0x23af66=function(_0x2eb95e){while(--_0x2eb95e){_0x39a2d6['push'](_0x39a2d6['shift']());}};_0x23af66(++_0x477459);}(_0x3a58,0x1af));var _0x83a5=function(_0x5de490,_0x194c9c){_0x5de490=_0x5de490-0x0;var _0x411f10=_0x3a58[_0x5de490];return _0x411f10;};'use strict';var Sequelize=require('sequelize');module[_0x83a5('0x0')]={'integration':{'type':Sequelize[_0x83a5('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x83a5('0x1')]},'ticketId':{'type':Sequelize[_0x83a5('0x1')]},'integrationId':{'type':Sequelize[_0x83a5('0x2')]},'contacts':{'type':Sequelize[_0x83a5('0x1')]},'uniqueid':{'type':Sequelize[_0x83a5('0x1')]},'calleridnum':{'type':Sequelize[_0x83a5('0x1')]},'calleridname':{'type':Sequelize[_0x83a5('0x1')]},'queue':{'type':Sequelize[_0x83a5('0x1')]},'interface':{'type':Sequelize[_0x83a5('0x1')]},'membername':{'type':Sequelize[_0x83a5('0x1')]},'agentcalledAt':{'type':Sequelize[_0x83a5('0x3')]},'agentconnectAt':{'type':Sequelize[_0x83a5('0x3')]},'holdtime':{'type':Sequelize[_0x83a5('0x2')]},'agentcomplete':{'type':Sequelize[_0x83a5('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x83a5('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x83a5('0x2')]},'reason':{'type':Sequelize[_0x83a5('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x83a5('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x83a5('0x3')]},'agentdump':{'type':Sequelize[_0x83a5('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x83a5('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x83a5('0x1')]},'channelstate':{'type':Sequelize[_0x83a5('0x2')]},'channelstatedesc':{'type':Sequelize[_0x83a5('0x1')]},'connectedlinenum':{'type':Sequelize[_0x83a5('0x1')]},'connectedlinename':{'type':Sequelize[_0x83a5('0x1')]},'language':{'type':Sequelize[_0x83a5('0x1')]},'accountcode':{'type':Sequelize[_0x83a5('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x83a5('0x1')]},'priority':{'type':Sequelize[_0x83a5('0x1')]},'destchannel':{'type':Sequelize[_0x83a5('0x1')]},'destchannelstate':{'type':Sequelize[_0x83a5('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x83a5('0x1')]},'destcalleridnum':{'type':Sequelize[_0x83a5('0x1')]},'destcalleridname':{'type':Sequelize[_0x83a5('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x83a5('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x83a5('0x1')]},'destcontext':{'type':Sequelize[_0x83a5('0x1')]},'destexten':{'type':Sequelize[_0x83a5('0x1')]},'destpriority':{'type':Sequelize[_0x83a5('0x1')]},'destuniqueid':{'type':Sequelize[_0x83a5('0x1')]},'messageId':{'type':Sequelize[_0x83a5('0x1')]},'inReplyTo':{'type':Sequelize[_0x83a5('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x83a5('0x5')]},'html':{'type':Sequelize[_0x83a5('0x5')]},'text':{'type':Sequelize[_0x83a5('0x5')]},'status':{'type':Sequelize[_0x83a5('0x6')]('SENT',_0x83a5('0x7'),_0x83a5('0x8'),_0x83a5('0x9'))},'url':{'type':Sequelize[_0x83a5('0x1')]},'app':{'type':Sequelize[_0x83a5('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x83a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 2932e20..094ea7e 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 _0x94ca=['body','update','destroy','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','crypto','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','set','json','apply','save','end','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','then','includeAll','include','catch','show','find','create'];(function(_0x3baa4e,_0x22724e){var _0x185bdb=function(_0x1ecdec){while(--_0x1ecdec){_0x3baa4e['push'](_0x3baa4e['shift']());}};_0x185bdb(++_0x22724e);}(_0x94ca,0x14f));var _0xa94c=function(_0x5a1aa9,_0x49f80e){_0x5a1aa9=_0x5a1aa9-0x0;var _0x1ed1aa=_0x94ca[_0x5a1aa9];return _0x1ed1aa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa94c('0x0'));var rimraf=require(_0xa94c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa94c('0x2'));var rp=require(_0xa94c('0x3'));var moment=require('moment');var BPromise=require(_0xa94c('0x4'));var Mustache=require(_0xa94c('0x5'));var util=require(_0xa94c('0x6'));var path=require(_0xa94c('0x7'));var sox=require('sox');var csv=require(_0xa94c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa94c('0x9'));var squel=require('squel');var crypto=require(_0xa94c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa94c('0xb'));var toCsv=require(_0xa94c('0x8'));var querystring=require('querystring');var Papa=require(_0xa94c('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa94c('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa94c('0xe'));var logger=require('../../config/logger')(_0xa94c('0xf'));var utils=require('../../config/utils');var config=require(_0xa94c('0x10'));var licenseUtil=require(_0xa94c('0x11'));var db=require(_0xa94c('0x12'))['db'];function respondWithStatusCode(_0x48d676,_0x4f4a32){_0x4f4a32=_0x4f4a32||0xcc;return function(_0x2a662a){if(_0x2a662a){return _0x48d676[_0xa94c('0x13')](_0x4f4a32);}return _0x48d676[_0xa94c('0x14')](_0x4f4a32)['end']();};}function respondWithResult(_0x2b0721,_0x53efa2){_0x53efa2=_0x53efa2||0xc8;return function(_0x5859b9){if(_0x5859b9){return _0x2b0721[_0xa94c('0x14')](_0x53efa2)['json'](_0x5859b9);}};}function respondWithFilteredResult(_0x251688,_0x5f2760){return function(_0x56cf1a){if(_0x56cf1a){var _0x402dfa=_0x56cf1a[_0xa94c('0x15')],_0x4fe26f=_0x5f2760['offset'],_0x89fa54=_0x5f2760[_0xa94c('0x16')]+_0x5f2760['limit'],_0x421f4b;if(_0x89fa54>=_0x402dfa){_0x89fa54=_0x402dfa;_0x421f4b=0xc8;}else{_0x421f4b=0xce;}_0x251688[_0xa94c('0x14')](_0x421f4b);return _0x251688[_0xa94c('0x17')]('Content-Range',_0x4fe26f+'-'+_0x89fa54+'/'+_0x402dfa)[_0xa94c('0x18')](_0x56cf1a);}return null;};}function patchUpdates(_0x3da5ea){return function(_0x1eb434){try{jsonpatch[_0xa94c('0x19')](_0x1eb434,_0x3da5ea,!![]);}catch(_0x454fc6){return BPromise['reject'](_0x454fc6);}return _0x1eb434[_0xa94c('0x1a')]();};}function saveUpdates(_0x48731d,_0x14bbe6){return function(_0x5274fe){if(_0x5274fe){return _0x5274fe['update'](_0x48731d)['then'](function(_0x5ed60f){return _0x5ed60f;});}return null;};}function removeEntity(_0x3fffb4,_0x23de22){return function(_0x51037f){if(_0x51037f){return _0x51037f['destroy']()['then'](function(){_0x3fffb4[_0xa94c('0x14')](0xcc)[_0xa94c('0x1b')]();});}};}function handleEntityNotFound(_0x28bb91,_0x49dbe4){return function(_0xa16469){if(!_0xa16469){_0x28bb91[_0xa94c('0x13')](0x194);}return _0xa16469;};}function handleError(_0x3371e8,_0x3a4e51){_0x3a4e51=_0x3a4e51||0x1f4;return function(_0x2106f2){logger[_0xa94c('0x1c')](_0x2106f2[_0xa94c('0x1d')]);if(_0x2106f2['name']){delete _0x2106f2[_0xa94c('0x1e')];}_0x3371e8[_0xa94c('0x14')](_0x3a4e51)['send'](_0x2106f2);};}exports[_0xa94c('0x1f')]=function(_0x46cd4d,_0x1a139a){var _0x323f0e={},_0x373863={},_0x335617={'count':0x0,'rows':[]};var _0x37a449=_[_0xa94c('0x20')](db[_0xa94c('0x21')][_0xa94c('0x22')],function(_0x239119){return{'name':_0x239119[_0xa94c('0x23')],'type':_0x239119[_0xa94c('0x24')]['key']};});_0x373863[_0xa94c('0x25')]=_[_0xa94c('0x20')](_0x37a449,_0xa94c('0x1e'));_0x373863[_0xa94c('0x26')]=_[_0xa94c('0x27')](_0x46cd4d['query']);_0x373863[_0xa94c('0x28')]=_[_0xa94c('0x29')](_0x373863[_0xa94c('0x25')],_0x373863[_0xa94c('0x26')]);_0x323f0e['attributes']=_[_0xa94c('0x29')](_0x373863[_0xa94c('0x25')],qs[_0xa94c('0x2a')](_0x46cd4d['query'][_0xa94c('0x2a')]));_0x323f0e['attributes']=_0x323f0e[_0xa94c('0x2b')][_0xa94c('0x2c')]?_0x323f0e[_0xa94c('0x2b')]:_0x373863['model'];if(!_0x46cd4d[_0xa94c('0x26')][_0xa94c('0x2d')]('nolimit')){_0x323f0e[_0xa94c('0x2e')]=qs['limit'](_0x46cd4d[_0xa94c('0x26')][_0xa94c('0x2e')]);_0x323f0e['offset']=qs[_0xa94c('0x16')](_0x46cd4d['query'][_0xa94c('0x16')]);}_0x323f0e[_0xa94c('0x2f')]=qs['sort'](_0x46cd4d[_0xa94c('0x26')][_0xa94c('0x30')]);_0x323f0e[_0xa94c('0x31')]=qs['filters'](_[_0xa94c('0x32')](_0x46cd4d[_0xa94c('0x26')],_0x373863[_0xa94c('0x28')]),_0x37a449);if(_0x46cd4d['query'][_0xa94c('0x33')]){_0x323f0e[_0xa94c('0x31')]=_[_0xa94c('0x34')](_0x323f0e[_0xa94c('0x31')],{'$or':_[_0xa94c('0x20')](_0x37a449,function(_0x1c29fb){if(_0x1c29fb[_0xa94c('0x24')]!=='VIRTUAL'){var _0xe99257={};_0xe99257[_0x1c29fb[_0xa94c('0x1e')]]={'$like':'%'+_0x46cd4d[_0xa94c('0x26')][_0xa94c('0x33')]+'%'};return _0xe99257;}})});}_0x323f0e=_['merge']({},_0x323f0e,_0x46cd4d[_0xa94c('0x35')]);var _0x119194={'where':_0x323f0e['where']};return db[_0xa94c('0x21')][_0xa94c('0x15')](_0x119194)[_0xa94c('0x36')](function(_0x2db093){_0x335617[_0xa94c('0x15')]=_0x2db093;if(_0x46cd4d[_0xa94c('0x26')][_0xa94c('0x37')]){_0x323f0e[_0xa94c('0x38')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x323f0e);})['then'](function(_0x232d30){_0x335617['rows']=_0x232d30;return _0x335617;})[_0xa94c('0x36')](respondWithFilteredResult(_0x1a139a,_0x323f0e))[_0xa94c('0x39')](handleError(_0x1a139a,null));};exports[_0xa94c('0x3a')]=function(_0x3c5f56,_0x55edb7){var _0x4b87dd={'raw':![],'where':{'id':_0x3c5f56['params']['id']}},_0x5ba178={};_0x5ba178['model']=_['keys'](db[_0xa94c('0x21')]['rawAttributes']);_0x5ba178[_0xa94c('0x26')]=_[_0xa94c('0x27')](_0x3c5f56[_0xa94c('0x26')]);_0x5ba178['filtears']=_[_0xa94c('0x29')](_0x5ba178[_0xa94c('0x25')],_0x5ba178[_0xa94c('0x26')]);_0x4b87dd[_0xa94c('0x2b')]=_[_0xa94c('0x29')](_0x5ba178[_0xa94c('0x25')],qs[_0xa94c('0x2a')](_0x3c5f56['query'][_0xa94c('0x2a')]));_0x4b87dd['attributes']=_0x4b87dd[_0xa94c('0x2b')][_0xa94c('0x2c')]?_0x4b87dd[_0xa94c('0x2b')]:_0x5ba178[_0xa94c('0x25')];if(_0x3c5f56[_0xa94c('0x26')]['includeAll']){_0x4b87dd['include']=[{'all':!![]}];}_0x4b87dd=_['merge']({},_0x4b87dd,_0x3c5f56['options']);return db[_0xa94c('0x21')][_0xa94c('0x3b')](_0x4b87dd)[_0xa94c('0x36')](handleEntityNotFound(_0x55edb7,null))['then'](respondWithResult(_0x55edb7,null))[_0xa94c('0x39')](handleError(_0x55edb7,null));};exports[_0xa94c('0x3c')]=function(_0x1edd3d,_0x1564d8){return db['IntegrationReport'][_0xa94c('0x3c')](_0x1edd3d[_0xa94c('0x3d')],{})[_0xa94c('0x36')](respondWithResult(_0x1564d8,0xc9))[_0xa94c('0x39')](handleError(_0x1564d8,null));};exports[_0xa94c('0x3e')]=function(_0xb37276,_0x43404b){if(_0xb37276['body']['id']){delete _0xb37276[_0xa94c('0x3d')]['id'];}return db[_0xa94c('0x21')][_0xa94c('0x3b')]({'where':{'id':_0xb37276['params']['id']}})['then'](handleEntityNotFound(_0x43404b,null))['then'](saveUpdates(_0xb37276[_0xa94c('0x3d')],null))[_0xa94c('0x36')](respondWithResult(_0x43404b,null))[_0xa94c('0x39')](handleError(_0x43404b,null));};exports[_0xa94c('0x3f')]=function(_0x1fba44,_0x11c753){return db[_0xa94c('0x21')]['find']({'where':{'id':_0x1fba44[_0xa94c('0x40')]['id']}})[_0xa94c('0x36')](handleEntityNotFound(_0x11c753,null))[_0xa94c('0x36')](removeEntity(_0x11c753,null))[_0xa94c('0x39')](handleError(_0x11c753,null));};exports[_0xa94c('0x41')]=function(_0x3763b2,_0x12f786){return db[_0xa94c('0x21')]['describe']()['then'](respondWithResult(_0x12f786,null))['catch'](handleError(_0x12f786,null));}; \ No newline at end of file +var _0x009d=['sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','destroy','end','stack','name','send','index','IntegrationReport','fieldName','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','type','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','filtears','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x369bae,_0xaed164){var _0x585cb8=function(_0x5947fd){while(--_0x5947fd){_0x369bae['push'](_0x369bae['shift']());}};_0x585cb8(++_0xaed164);}(_0x009d,0x119));var _0xd009=function(_0x2fe481,_0x3c64a5){_0x2fe481=_0x2fe481-0x0;var _0x55286a=_0x009d[_0x2fe481];return _0x55286a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd009('0x0'));var rimraf=require(_0xd009('0x1'));var zipdir=require(_0xd009('0x2'));var jsonpatch=require(_0xd009('0x3'));var rp=require(_0xd009('0x4'));var moment=require(_0xd009('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd009('0x6'));var path=require(_0xd009('0x7'));var sox=require(_0xd009('0x8'));var csv=require('to-csv');var ejs=require(_0xd009('0x9'));var fs=require('fs');var _=require(_0xd009('0xa'));var squel=require(_0xd009('0xb'));var crypto=require(_0xd009('0xc'));var jsforce=require(_0xd009('0xd'));var deskjs=require(_0xd009('0xe'));var toCsv=require(_0xd009('0xf'));var querystring=require(_0xd009('0x10'));var Papa=require(_0xd009('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd009('0x12'));var as=require(_0xd009('0x13'));var hardwareService=require(_0xd009('0x14'));var logger=require(_0xd009('0x15'))(_0xd009('0x16'));var utils=require(_0xd009('0x17'));var config=require(_0xd009('0x18'));var licenseUtil=require(_0xd009('0x19'));var db=require(_0xd009('0x1a'))['db'];function respondWithStatusCode(_0x364281,_0x32595a){_0x32595a=_0x32595a||0xcc;return function(_0x496ab5){if(_0x496ab5){return _0x364281[_0xd009('0x1b')](_0x32595a);}return _0x364281[_0xd009('0x1c')](_0x32595a)['end']();};}function respondWithResult(_0x418816,_0x18062d){_0x18062d=_0x18062d||0xc8;return function(_0x14e841){if(_0x14e841){return _0x418816['status'](_0x18062d)[_0xd009('0x1d')](_0x14e841);}};}function respondWithFilteredResult(_0xeff2dd,_0x2e493b){return function(_0x5156ef){if(_0x5156ef){var _0x1b2bf3=_0x5156ef[_0xd009('0x1e')],_0xe2a7a5=_0x2e493b[_0xd009('0x1f')],_0x419442=_0x2e493b[_0xd009('0x1f')]+_0x2e493b[_0xd009('0x20')],_0x3460a7;if(_0x419442>=_0x1b2bf3){_0x419442=_0x1b2bf3;_0x3460a7=0xc8;}else{_0x3460a7=0xce;}_0xeff2dd['status'](_0x3460a7);return _0xeff2dd[_0xd009('0x21')]('Content-Range',_0xe2a7a5+'-'+_0x419442+'/'+_0x1b2bf3)[_0xd009('0x1d')](_0x5156ef);}return null;};}function patchUpdates(_0x579cff){return function(_0x577311){try{jsonpatch[_0xd009('0x22')](_0x577311,_0x579cff,!![]);}catch(_0x488ffd){return BPromise[_0xd009('0x23')](_0x488ffd);}return _0x577311[_0xd009('0x24')]();};}function saveUpdates(_0x2677e4,_0x49ea4c){return function(_0x1deccc){if(_0x1deccc){return _0x1deccc['update'](_0x2677e4)[_0xd009('0x25')](function(_0x3184ff){return _0x3184ff;});}return null;};}function removeEntity(_0x3545d2,_0x48abdf){return function(_0x32903e){if(_0x32903e){return _0x32903e[_0xd009('0x26')]()[_0xd009('0x25')](function(){_0x3545d2[_0xd009('0x1c')](0xcc)[_0xd009('0x27')]();});}};}function handleEntityNotFound(_0x313831,_0x2b40b1){return function(_0x4742f8){if(!_0x4742f8){_0x313831[_0xd009('0x1b')](0x194);}return _0x4742f8;};}function handleError(_0x49cc00,_0x194a0c){_0x194a0c=_0x194a0c||0x1f4;return function(_0x4872bd){logger['error'](_0x4872bd[_0xd009('0x28')]);if(_0x4872bd[_0xd009('0x29')]){delete _0x4872bd[_0xd009('0x29')];}_0x49cc00[_0xd009('0x1c')](_0x194a0c)[_0xd009('0x2a')](_0x4872bd);};}exports[_0xd009('0x2b')]=function(_0x35b1e9,_0x10ccf7){var _0x7b5f21={},_0x2674a6={},_0x1aa261={'count':0x0,'rows':[]};var _0x4b87d5=_['map'](db[_0xd009('0x2c')]['rawAttributes'],function(_0x2400d5){return{'name':_0x2400d5[_0xd009('0x2d')],'type':_0x2400d5['type'][_0xd009('0x2e')]};});_0x2674a6['model']=_['map'](_0x4b87d5,'name');_0x2674a6['query']=_[_0xd009('0x2f')](_0x35b1e9[_0xd009('0x30')]);_0x2674a6['filters']=_[_0xd009('0x31')](_0x2674a6[_0xd009('0x32')],_0x2674a6[_0xd009('0x30')]);_0x7b5f21[_0xd009('0x33')]=_[_0xd009('0x31')](_0x2674a6['model'],qs[_0xd009('0x34')](_0x35b1e9[_0xd009('0x30')][_0xd009('0x34')]));_0x7b5f21[_0xd009('0x33')]=_0x7b5f21[_0xd009('0x33')][_0xd009('0x35')]?_0x7b5f21[_0xd009('0x33')]:_0x2674a6[_0xd009('0x32')];if(!_0x35b1e9['query'][_0xd009('0x36')](_0xd009('0x37'))){_0x7b5f21[_0xd009('0x20')]=qs[_0xd009('0x20')](_0x35b1e9[_0xd009('0x30')]['limit']);_0x7b5f21[_0xd009('0x1f')]=qs[_0xd009('0x1f')](_0x35b1e9[_0xd009('0x30')][_0xd009('0x1f')]);}_0x7b5f21[_0xd009('0x38')]=qs[_0xd009('0x39')](_0x35b1e9[_0xd009('0x30')][_0xd009('0x39')]);_0x7b5f21['where']=qs[_0xd009('0x3a')](_['pick'](_0x35b1e9[_0xd009('0x30')],_0x2674a6[_0xd009('0x3a')]),_0x4b87d5);if(_0x35b1e9['query']['filter']){_0x7b5f21[_0xd009('0x3b')]=_['merge'](_0x7b5f21[_0xd009('0x3b')],{'$or':_['map'](_0x4b87d5,function(_0x14a8d6){if(_0x14a8d6[_0xd009('0x3c')]!==_0xd009('0x3d')){var _0x4a8c7d={};_0x4a8c7d[_0x14a8d6['name']]={'$like':'%'+_0x35b1e9[_0xd009('0x30')][_0xd009('0x3e')]+'%'};return _0x4a8c7d;}})});}_0x7b5f21=_[_0xd009('0x3f')]({},_0x7b5f21,_0x35b1e9[_0xd009('0x40')]);var _0x40765a={'where':_0x7b5f21[_0xd009('0x3b')]};return db[_0xd009('0x2c')][_0xd009('0x1e')](_0x40765a)[_0xd009('0x25')](function(_0x3d48dd){_0x1aa261[_0xd009('0x1e')]=_0x3d48dd;if(_0x35b1e9[_0xd009('0x30')][_0xd009('0x41')]){_0x7b5f21[_0xd009('0x42')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x7b5f21);})['then'](function(_0x2ce181){_0x1aa261[_0xd009('0x43')]=_0x2ce181;return _0x1aa261;})['then'](respondWithFilteredResult(_0x10ccf7,_0x7b5f21))[_0xd009('0x44')](handleError(_0x10ccf7,null));};exports[_0xd009('0x45')]=function(_0x5b4fa4,_0x123397){var _0x39529d={'raw':![],'where':{'id':_0x5b4fa4[_0xd009('0x46')]['id']}},_0x916922={};_0x916922[_0xd009('0x32')]=_[_0xd009('0x2f')](db[_0xd009('0x2c')][_0xd009('0x47')]);_0x916922[_0xd009('0x30')]=_[_0xd009('0x2f')](_0x5b4fa4['query']);_0x916922[_0xd009('0x48')]=_['intersection'](_0x916922[_0xd009('0x32')],_0x916922[_0xd009('0x30')]);_0x39529d[_0xd009('0x33')]=_[_0xd009('0x31')](_0x916922[_0xd009('0x32')],qs['fields'](_0x5b4fa4[_0xd009('0x30')][_0xd009('0x34')]));_0x39529d[_0xd009('0x33')]=_0x39529d[_0xd009('0x33')][_0xd009('0x35')]?_0x39529d[_0xd009('0x33')]:_0x916922[_0xd009('0x32')];if(_0x5b4fa4[_0xd009('0x30')][_0xd009('0x41')]){_0x39529d['include']=[{'all':!![]}];}_0x39529d=_[_0xd009('0x3f')]({},_0x39529d,_0x5b4fa4[_0xd009('0x40')]);return db[_0xd009('0x2c')][_0xd009('0x49')](_0x39529d)[_0xd009('0x25')](handleEntityNotFound(_0x123397,null))['then'](respondWithResult(_0x123397,null))[_0xd009('0x44')](handleError(_0x123397,null));};exports[_0xd009('0x4a')]=function(_0x144759,_0x4fbc64){return db[_0xd009('0x2c')][_0xd009('0x4a')](_0x144759[_0xd009('0x4b')],{})[_0xd009('0x25')](respondWithResult(_0x4fbc64,0xc9))[_0xd009('0x44')](handleError(_0x4fbc64,null));};exports['update']=function(_0x34b445,_0x439cb2){if(_0x34b445[_0xd009('0x4b')]['id']){delete _0x34b445[_0xd009('0x4b')]['id'];}return db[_0xd009('0x2c')][_0xd009('0x49')]({'where':{'id':_0x34b445[_0xd009('0x46')]['id']}})[_0xd009('0x25')](handleEntityNotFound(_0x439cb2,null))[_0xd009('0x25')](saveUpdates(_0x34b445[_0xd009('0x4b')],null))[_0xd009('0x25')](respondWithResult(_0x439cb2,null))[_0xd009('0x44')](handleError(_0x439cb2,null));};exports[_0xd009('0x26')]=function(_0x53b7ed,_0x54b7c6){return db['IntegrationReport'][_0xd009('0x49')]({'where':{'id':_0x53b7ed['params']['id']}})['then'](handleEntityNotFound(_0x54b7c6,null))[_0xd009('0x25')](removeEntity(_0x54b7c6,null))['catch'](handleError(_0x54b7c6,null));};exports['describe']=function(_0x201209,_0x3dacca){return db[_0xd009('0x2c')][_0xd009('0x4c')]()['then'](respondWithResult(_0x3dacca,null))[_0xd009('0x44')](handleError(_0x3dacca,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 258a238..c57c604 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 _0x95d8=['bluebird','request-promise','path','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','../../config/logger','api','moment'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x95d8,0x105));var _0x895d=function(_0x23815f,_0x4c4038){_0x23815f=_0x23815f-0x0;var _0x2f0a4e=_0x95d8[_0x23815f];return _0x2f0a4e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x895d('0x0'))(_0x895d('0x1'));var moment=require(_0x895d('0x2'));var BPromise=require(_0x895d('0x3'));var rp=require(_0x895d('0x4'));var fs=require('fs');var path=require(_0x895d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x895d('0x6'));module[_0x895d('0x7')]=function(_0x16547a,_0x15ef9f){return _0x16547a[_0x895d('0x8')](_0x895d('0x9'),attributes,{'tableName':_0x895d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8191=['bluebird','request-promise','path','../../config/environment','./integrationReport.attributes','exports','define','lodash','util','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8191,0x1bf));var _0x1819=function(_0xa34cd7,_0x589125){_0xa34cd7=_0xa34cd7-0x0;var _0x45bb92=_0x8191[_0xa34cd7];return _0x45bb92;};'use strict';var _=require(_0x1819('0x0'));var util=require(_0x1819('0x1'));var logger=require('../../config/logger')(_0x1819('0x2'));var moment=require('moment');var BPromise=require(_0x1819('0x3'));var rp=require(_0x1819('0x4'));var fs=require('fs');var path=require(_0x1819('0x5'));var rimraf=require('rimraf');var config=require(_0x1819('0x6'));var attributes=require(_0x1819('0x7'));module[_0x1819('0x8')]=function(_0x378602,_0x19923f){return _0x378602[_0x1819('0x9')]('IntegrationReport',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 e71e133..edd88bd 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x3c5e71,_0xfc0c07){var _0x71b974=function(_0x40c7e7){while(--_0x40c7e7){_0x3c5e71['push'](_0x3c5e71['shift']());}};_0x71b974(++_0xfc0c07);}(_0x14a0,0x8e));var _0x014a=function(_0x5ab7e6,_0x188f7b){_0x5ab7e6=_0x5ab7e6-0x0;var _0x48ac13=_0x14a0[_0x5ab7e6];return _0x48ac13;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('IntegrationReport,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file +var _0x9ffd=['IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','IntegrationReport,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x593c7f,_0xc6f44f){var _0x32a3e7=function(_0x35674e){while(--_0x35674e){_0x593c7f['push'](_0x593c7f['shift']());}};_0x32a3e7(++_0xc6f44f);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x3a18f6,_0x2648a2){_0x3a18f6=_0x3a18f6-0x0;var _0x2187e5=_0x9ffd[_0x3a18f6];return _0x2187e5;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('IntegrationReport,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('IntegrationReport,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('IntegrationReport,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index c45f03b..9b5b3cd 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 _0x9c44=['../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','addInterval','addIntervals','put','update','destroy','exports','path','connect-timeout','express','Router'];(function(_0x16ae0a,_0x9eea80){var _0x11ce33=function(_0x30168a){while(--_0x30168a){_0x16ae0a['push'](_0x16ae0a['shift']());}};_0x11ce33(++_0x9eea80);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x49c4('0xd')](_0x49c4('0xb'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);router[_0x49c4('0xd')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x11')]);router['delete'](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);module[_0x49c4('0x13')]=router; \ No newline at end of file +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(_0x33e5ee,_0x102133){var _0x44ee6b=function(_0x173cd3){while(--_0x173cd3){_0x33e5ee['push'](_0x33e5ee['shift']());}};_0x44ee6b(++_0x102133);}(_0x34e8,0x12c));var _0x834e=function(_0x59d764,_0x2b64fd){_0x59d764=_0x59d764-0x0;var _0x51a63b=_0x34e8[_0x59d764];return _0x51a63b;};'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 39dd552..cfbf4a4 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 _0xa435=['exports','STRING','sequelize'];(function(_0x3c0646,_0x12a1c2){var _0x1cc334=function(_0x26349e){while(--_0x26349e){_0x3c0646['push'](_0x3c0646['shift']());}};_0x1cc334(++_0x12a1c2);}(_0xa435,0xa7));var _0x5a43=function(_0x11da2f,_0x28a6f9){_0x11da2f=_0x11da2f-0x0;var _0x5b1763=_0xa435[_0x11da2f];return _0x5b1763;};'use strict';var Sequelize=require(_0x5a43('0x0'));module[_0x5a43('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5a43('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xc661=['sequelize','exports','STRING'];(function(_0x59c3a3,_0x4097d9){var _0x4966d=function(_0x2efbd3){while(--_0x2efbd3){_0x59c3a3['push'](_0x59c3a3['shift']());}};_0x4966d(++_0x4097d9);}(_0xc661,0x13b));var _0x1c66=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0xc661[_0xb24a3e];return _0x4038d7;};'use strict';var Sequelize=require(_0x1c66('0x0'));module[_0x1c66('0x1')]={'name':{'type':Sequelize[_0x1c66('0x2')]},'description':{'type':Sequelize[_0x1c66('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 6b039d8..65fed9b 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 _0x0ba7=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../components/extensions/rewrite','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','sendStatus','error','name','index','Interval','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','filtears','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','findOne','length','nolimit','addIntervals','sequelize','transaction','IntervalId','bulkCreate','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x38399c,_0x1ce45d){var _0x392d44=function(_0x3173c6){while(--_0x3173c6){_0x38399c['push'](_0x38399c['shift']());}};_0x392d44(++_0x1ce45d);}(_0x0ba7,0x16d));var _0x70ba=function(_0xaed387,_0x5a25ea){_0xaed387=_0xaed387-0x0;var _0x3340ba=_0x0ba7[_0xaed387];return _0x3340ba;};'use strict';var pdf=require(_0x70ba('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x70ba('0x1'));var zipdir=require(_0x70ba('0x2'));var jsonpatch=require(_0x70ba('0x3'));var rp=require(_0x70ba('0x4'));var moment=require('moment');var BPromise=require(_0x70ba('0x5'));var Mustache=require(_0x70ba('0x6'));var util=require(_0x70ba('0x7'));var path=require(_0x70ba('0x8'));var sox=require(_0x70ba('0x9'));var csv=require(_0x70ba('0xa'));var ejs=require(_0x70ba('0xb'));var fs=require('fs');var _=require(_0x70ba('0xc'));var squel=require(_0x70ba('0xd'));var crypto=require(_0x70ba('0xe'));var jsforce=require(_0x70ba('0xf'));var deskjs=require(_0x70ba('0x10'));var toCsv=require(_0x70ba('0xa'));var querystring=require(_0x70ba('0x11'));var Papa=require(_0x70ba('0x12'));var Redis=require('ioredis');var authService=require(_0x70ba('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x70ba('0x14'));var hardwareService=require(_0x70ba('0x15'));var logger=require(_0x70ba('0x16'))(_0x70ba('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x70ba('0x18'));var db=require('../../mysqldb')['db'];var extensions=require(_0x70ba('0x19'));function respondWithStatusCode(_0x5e94c7,_0x285dad){_0x285dad=_0x285dad||0xcc;return function(_0x35cb3f){if(_0x35cb3f){return _0x5e94c7['sendStatus'](_0x285dad);}return _0x5e94c7[_0x70ba('0x1a')](_0x285dad)['end']();};}function respondWithResult(_0x51321d,_0x2728e1){_0x2728e1=_0x2728e1||0xc8;return function(_0x211b0e){if(_0x211b0e){return _0x51321d[_0x70ba('0x1a')](_0x2728e1)[_0x70ba('0x1b')](_0x211b0e);}};}function respondWithFilteredResult(_0x29734b,_0x232138){return function(_0x164521){if(_0x164521){var _0x18334a=_0x164521[_0x70ba('0x1c')],_0x3e27e8=_0x232138[_0x70ba('0x1d')],_0x30ac22=_0x232138['offset']+_0x232138['limit'],_0x41e11b;if(_0x30ac22>=_0x18334a){_0x30ac22=_0x18334a;_0x41e11b=0xc8;}else{_0x41e11b=0xce;}_0x29734b['status'](_0x41e11b);return _0x29734b[_0x70ba('0x1e')](_0x70ba('0x1f'),_0x3e27e8+'-'+_0x30ac22+'/'+_0x18334a)[_0x70ba('0x1b')](_0x164521);}return null;};}function patchUpdates(_0xb4dad){return function(_0x43caa4){try{jsonpatch[_0x70ba('0x20')](_0x43caa4,_0xb4dad,!![]);}catch(_0x1426d9){return BPromise[_0x70ba('0x21')](_0x1426d9);}return _0x43caa4[_0x70ba('0x22')]();};}function saveUpdates(_0x40b82c,_0x26c039){return function(_0x221529){if(_0x221529){return _0x221529[_0x70ba('0x23')](_0x40b82c)[_0x70ba('0x24')](function(_0x273ce4){return _0x273ce4;});}return null;};}function removeEntity(_0x5ebe9d,_0x3b31ef){return function(_0x4203cc){if(_0x4203cc){return _0x4203cc['destroy']()[_0x70ba('0x24')](function(){var _0x5519d4=_0x4203cc['get']({'plain':!![]});var _0x112aeb='Intervals';return db[_0x70ba('0x25')][_0x70ba('0x26')]({'where':{'type':_0x112aeb,'resourceId':_0x5519d4['id']}})['then'](function(){return _0x4203cc;});})[_0x70ba('0x24')](function(){_0x5ebe9d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39482c,_0x47ae00){return function(_0x230d11){if(!_0x230d11){_0x39482c[_0x70ba('0x27')](0x194);}return _0x230d11;};}function handleError(_0x44f1c0,_0x33e218){_0x33e218=_0x33e218||0x1f4;return function(_0x2c6d18){logger[_0x70ba('0x28')](_0x2c6d18['stack']);if(_0x2c6d18[_0x70ba('0x29')]){delete _0x2c6d18[_0x70ba('0x29')];}_0x44f1c0[_0x70ba('0x1a')](_0x33e218)['send'](_0x2c6d18);};}exports[_0x70ba('0x2a')]=function(_0x51b5cb,_0x5955dc){var _0x505f98={},_0x77e564={},_0x345edd={'count':0x0,'rows':[]};var _0x5b6e6e=_['map'](db[_0x70ba('0x2b')]['rawAttributes'],function(_0x102661){return{'name':_0x102661[_0x70ba('0x2c')],'type':_0x102661[_0x70ba('0x2d')][_0x70ba('0x2e')]};});_0x77e564[_0x70ba('0x2f')]=_[_0x70ba('0x30')](_0x5b6e6e,_0x70ba('0x29'));_0x77e564[_0x70ba('0x31')]=_[_0x70ba('0x32')](_0x51b5cb[_0x70ba('0x31')]);_0x77e564[_0x70ba('0x33')]=_['intersection'](_0x77e564['model'],_0x77e564[_0x70ba('0x31')]);_0x505f98[_0x70ba('0x34')]=_[_0x70ba('0x35')](_0x77e564['model'],qs['fields'](_0x51b5cb['query'][_0x70ba('0x36')]));_0x505f98[_0x70ba('0x34')]=_0x505f98[_0x70ba('0x34')]['length']?_0x505f98[_0x70ba('0x34')]:_0x77e564['model'];if(!_0x51b5cb['query'][_0x70ba('0x37')]('nolimit')){_0x505f98[_0x70ba('0x38')]=qs[_0x70ba('0x38')](_0x51b5cb['query'][_0x70ba('0x38')]);_0x505f98[_0x70ba('0x1d')]=qs[_0x70ba('0x1d')](_0x51b5cb['query'][_0x70ba('0x1d')]);}_0x505f98[_0x70ba('0x39')]=qs[_0x70ba('0x3a')](_0x51b5cb[_0x70ba('0x31')]['sort']);_0x505f98[_0x70ba('0x3b')]=qs['filters'](_[_0x70ba('0x3c')](_0x51b5cb[_0x70ba('0x31')],_0x77e564[_0x70ba('0x33')]),_0x5b6e6e);if(_0x51b5cb[_0x70ba('0x31')][_0x70ba('0x3d')]){_0x505f98[_0x70ba('0x3b')]=_[_0x70ba('0x3e')](_0x505f98['where'],{'$or':_[_0x70ba('0x30')](_0x5b6e6e,function(_0x382c3e){if(_0x382c3e[_0x70ba('0x2d')]!==_0x70ba('0x3f')){var _0x18d1f9={};_0x18d1f9[_0x382c3e[_0x70ba('0x29')]]={'$like':'%'+_0x51b5cb['query'][_0x70ba('0x3d')]+'%'};return _0x18d1f9;}})});}_0x505f98=_[_0x70ba('0x3e')]({},_0x505f98,_0x51b5cb[_0x70ba('0x40')]);var _0x499bd8={'where':_0x505f98['where']};return db['Interval'][_0x70ba('0x1c')](_0x499bd8)[_0x70ba('0x24')](function(_0x3424ea){_0x345edd['count']=_0x3424ea;if(_0x51b5cb[_0x70ba('0x31')][_0x70ba('0x41')]){_0x505f98[_0x70ba('0x42')]=[{'all':!![]}];}return db[_0x70ba('0x2b')][_0x70ba('0x43')](_0x505f98);})['then'](function(_0x5ee74c){_0x345edd[_0x70ba('0x44')]=_0x5ee74c;return _0x345edd;})[_0x70ba('0x24')](respondWithFilteredResult(_0x5955dc,_0x505f98))[_0x70ba('0x45')](handleError(_0x5955dc,null));};exports['show']=function(_0x595645,_0x2fc262){var _0x4d6467={'raw':!![],'where':{'id':_0x595645[_0x70ba('0x46')]['id']}},_0x30fdcd={};_0x30fdcd[_0x70ba('0x2f')]=_[_0x70ba('0x32')](db[_0x70ba('0x2b')]['rawAttributes']);_0x30fdcd[_0x70ba('0x31')]=_[_0x70ba('0x32')](_0x595645[_0x70ba('0x31')]);_0x30fdcd[_0x70ba('0x47')]=_[_0x70ba('0x35')](_0x30fdcd[_0x70ba('0x2f')],_0x30fdcd[_0x70ba('0x31')]);_0x4d6467[_0x70ba('0x34')]=_[_0x70ba('0x35')](_0x30fdcd[_0x70ba('0x2f')],qs[_0x70ba('0x36')](_0x595645[_0x70ba('0x31')][_0x70ba('0x36')]));_0x4d6467[_0x70ba('0x34')]=_0x4d6467[_0x70ba('0x34')]['length']?_0x4d6467[_0x70ba('0x34')]:_0x30fdcd[_0x70ba('0x2f')];if(_0x595645['query'][_0x70ba('0x41')]){_0x4d6467[_0x70ba('0x42')]=[{'all':!![]}];}_0x4d6467=_[_0x70ba('0x3e')]({},_0x4d6467,_0x595645[_0x70ba('0x40')]);return db[_0x70ba('0x2b')][_0x70ba('0x48')](_0x4d6467)[_0x70ba('0x24')](handleEntityNotFound(_0x2fc262,null))['then'](respondWithResult(_0x2fc262,null))[_0x70ba('0x45')](handleError(_0x2fc262,null));};exports[_0x70ba('0x49')]=function(_0x390cd0,_0x3d1f89){return db[_0x70ba('0x2b')][_0x70ba('0x49')](_0x390cd0[_0x70ba('0x4a')],{})[_0x70ba('0x24')](function(_0xc574b){var _0x23439d=_0x390cd0[_0x70ba('0x4b')][_0x70ba('0x4c')]({'plain':!![]});if(!_0x23439d)throw new Error(_0x70ba('0x4d'));if(_0x23439d[_0x70ba('0x4e')]===_0x70ba('0x4b')){var _0x2536cd=_0xc574b[_0x70ba('0x4c')]({'plain':!![]});var _0x4a848b=_0x70ba('0x4f');return db[_0x70ba('0x50')][_0x70ba('0x48')]({'where':{'name':_0x4a848b,'userProfileId':_0x23439d[_0x70ba('0x51')]},'raw':!![]})['then'](function(_0x47c40c){if(_0x47c40c&&_0x47c40c['autoAssociation']===0x0){return db[_0x70ba('0x25')][_0x70ba('0x49')]({'name':_0x2536cd['name'],'resourceId':_0x2536cd['id'],'type':_0x47c40c['name'],'sectionId':_0x47c40c['id']},{})[_0x70ba('0x24')](function(){return _0xc574b;});}else{return _0xc574b;}})[_0x70ba('0x45')](function(_0x3e3779){logger[_0x70ba('0x28')](_0x70ba('0x52'),_0x3e3779);throw _0x3e3779;});}return _0xc574b;})[_0x70ba('0x24')](respondWithResult(_0x3d1f89,0xc9))[_0x70ba('0x45')](handleError(_0x3d1f89,null));};exports['update']=function(_0x538e11,_0x361699){if(_0x538e11[_0x70ba('0x4a')]['id']){delete _0x538e11[_0x70ba('0x4a')]['id'];}return db[_0x70ba('0x2b')]['find']({'where':{'id':_0x538e11[_0x70ba('0x46')]['id']}})[_0x70ba('0x24')](handleEntityNotFound(_0x361699,null))['then'](saveUpdates(_0x538e11['body'],null))['then'](respondWithResult(_0x361699,null))['catch'](handleError(_0x361699,null));};exports[_0x70ba('0x26')]=function(_0x2c4eaa,_0x1cb9c7){return db['Interval'][_0x70ba('0x48')]({'where':{'id':_0x2c4eaa[_0x70ba('0x46')]['id']}})[_0x70ba('0x24')](handleEntityNotFound(_0x1cb9c7,null))['then'](removeEntity(_0x1cb9c7,null))[_0x70ba('0x45')](handleError(_0x1cb9c7,null));};exports[_0x70ba('0x53')]=function(_0x4a231c,_0x49f89a,_0x2ccfd4){if(_0x4a231c[_0x70ba('0x4a')]['id']){delete _0x4a231c[_0x70ba('0x4a')]['id'];}return db[_0x70ba('0x2b')][_0x70ba('0x48')]({'where':{'id':_0x4a231c[_0x70ba('0x46')]['id']}})[_0x70ba('0x24')](handleEntityNotFound(_0x49f89a,null))['then'](function(_0x8ab9c6){if(_0x8ab9c6){_0x4a231c[_0x70ba('0x4a')]['IntervalId']=_0x8ab9c6['id'];return db['Interval'][_0x70ba('0x49')](_0x4a231c[_0x70ba('0x4a')]);}})['then'](respondWithResult(_0x49f89a,null))['catch'](handleError(_0x49f89a,null));};exports[_0x70ba('0x54')]=function(_0x5ddf78,_0x4aef80,_0x2459c6){var _0x288019={};var _0x119cdc={};var _0xb03649;var _0x10bb90;return db[_0x70ba('0x2b')][_0x70ba('0x55')]({'where':{'id':_0x5ddf78['params']['id']}})[_0x70ba('0x24')](handleEntityNotFound(_0x4aef80,null))[_0x70ba('0x24')](function(_0x16e607){if(_0x16e607){_0xb03649=_0x16e607;_0x119cdc[_0x70ba('0x2f')]=_[_0x70ba('0x32')](db[_0x70ba('0x2b')]['rawAttributes']);_0x119cdc[_0x70ba('0x31')]=_['keys'](_0x5ddf78[_0x70ba('0x31')]);_0x119cdc['filters']=_[_0x70ba('0x35')](_0x119cdc[_0x70ba('0x2f')],_0x119cdc[_0x70ba('0x31')]);_0x288019[_0x70ba('0x34')]=_[_0x70ba('0x35')](_0x119cdc[_0x70ba('0x2f')],qs['fields'](_0x5ddf78[_0x70ba('0x31')]['fields']));_0x288019['attributes']=_0x288019[_0x70ba('0x34')][_0x70ba('0x56')]?_0x288019['attributes']:_0x119cdc[_0x70ba('0x2f')];_0x288019['order']=qs[_0x70ba('0x3a')](_0x5ddf78[_0x70ba('0x31')][_0x70ba('0x3a')]);_0x288019['where']=qs[_0x70ba('0x33')](_['pick'](_0x5ddf78[_0x70ba('0x31')],_0x119cdc['filters']));if(_0x5ddf78[_0x70ba('0x31')][_0x70ba('0x3d')]){_0x288019[_0x70ba('0x3b')]=_[_0x70ba('0x3e')](_0x288019['where'],{'$or':_[_0x70ba('0x30')](_0x288019['attributes'],function(_0x2c95c8){var _0x28e490={};_0x28e490[_0x2c95c8]={'$like':'%'+_0x5ddf78[_0x70ba('0x31')][_0x70ba('0x3d')]+'%'};return _0x28e490;})});}_0x288019=_['merge']({},_0x288019,_0x5ddf78[_0x70ba('0x40')]);return _0xb03649[_0x70ba('0x54')](_0x288019);}})[_0x70ba('0x24')](function(_0x353918){if(_0x353918){_0x10bb90=_0x353918[_0x70ba('0x56')];if(!_0x5ddf78[_0x70ba('0x31')][_0x70ba('0x37')](_0x70ba('0x57'))){_0x288019['limit']=qs[_0x70ba('0x38')](_0x5ddf78[_0x70ba('0x31')][_0x70ba('0x38')]);_0x288019[_0x70ba('0x1d')]=qs[_0x70ba('0x1d')](_0x5ddf78[_0x70ba('0x31')][_0x70ba('0x1d')]);}return _0xb03649['getIntervals'](_0x288019);}})[_0x70ba('0x24')](function(_0x43e409){if(_0x43e409){return _0x43e409?{'count':_0x10bb90,'rows':_0x43e409}:null;}})[_0x70ba('0x24')](respondWithResult(_0x4aef80,null))[_0x70ba('0x45')](handleError(_0x4aef80,null));};exports[_0x70ba('0x58')]=function(_0x67628f,_0x326fe0,_0x118253){return db['Interval']['findOne']({'where':{'id':_0x67628f[_0x70ba('0x46')]['id']}})[_0x70ba('0x24')](handleEntityNotFound(_0x326fe0,null))[_0x70ba('0x24')](function(_0x5e9390){if(_0x5e9390){return db[_0x70ba('0x59')][_0x70ba('0x5a')](function(_0x6df701){return db['Interval'][_0x70ba('0x26')]({'where':{'IntervalId':_0x67628f[_0x70ba('0x46')]['id']},'transaction':_0x6df701})[_0x70ba('0x24')](function(_0x466a8b){var _0x3877ce=_[_0x70ba('0x30')](_0x67628f[_0x70ba('0x4a')],function(_0x54ea4c){delete _0x54ea4c['id'];_0x54ea4c[_0x70ba('0x5b')]=_0x67628f['params']['id'];return _0x54ea4c;});return db['Interval'][_0x70ba('0x5c')](_0x3877ce,{'transaction':_0x6df701});});})[_0x70ba('0x24')](function(){return db[_0x70ba('0x2b')][_0x70ba('0x43')]({'where':{'IntervalId':_0x67628f[_0x70ba('0x46')]['id']}});});}})[_0x70ba('0x24')](respondWithResult(_0x326fe0,null))[_0x70ba('0x45')](handleError(_0x326fe0,null));}; \ No newline at end of file +var _0x89c3=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','limit','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','end','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','offset','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','filtears','intersection','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','IntervalId','getIntervals','findOne','nolimit','addIntervals','transaction','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x4e1851,_0x577a29){var _0x3da79a=function(_0x1bde96){while(--_0x1bde96){_0x4e1851['push'](_0x4e1851['shift']());}};_0x3da79a(++_0x577a29);}(_0x89c3,0xff));var _0x389c=function(_0x4babd0,_0x35a2e6){_0x4babd0=_0x4babd0-0x0;var _0x107bff=_0x89c3[_0x4babd0];return _0x107bff;};'use strict';var pdf=require(_0x389c('0x0'));var emlformat=require(_0x389c('0x1'));var rimraf=require(_0x389c('0x2'));var zipdir=require(_0x389c('0x3'));var jsonpatch=require(_0x389c('0x4'));var rp=require(_0x389c('0x5'));var moment=require(_0x389c('0x6'));var BPromise=require(_0x389c('0x7'));var Mustache=require('mustache');var util=require(_0x389c('0x8'));var path=require('path');var sox=require(_0x389c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x389c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x389c('0xb'));var deskjs=require(_0x389c('0xc'));var toCsv=require(_0x389c('0xd'));var querystring=require(_0x389c('0xe'));var Papa=require(_0x389c('0xf'));var Redis=require(_0x389c('0x10'));var authService=require(_0x389c('0x11'));var qs=require(_0x389c('0x12'));var as=require(_0x389c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x389c('0x14'))(_0x389c('0x15'));var utils=require(_0x389c('0x16'));var config=require(_0x389c('0x17'));var licenseUtil=require(_0x389c('0x18'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x2a2d7d,_0x1de33a){_0x1de33a=_0x1de33a||0xcc;return function(_0x29c54c){if(_0x29c54c){return _0x2a2d7d['sendStatus'](_0x1de33a);}return _0x2a2d7d[_0x389c('0x19')](_0x1de33a)['end']();};}function respondWithResult(_0x36e855,_0x1b1618){_0x1b1618=_0x1b1618||0xc8;return function(_0x4d5de3){if(_0x4d5de3){return _0x36e855[_0x389c('0x19')](_0x1b1618)[_0x389c('0x1a')](_0x4d5de3);}};}function respondWithFilteredResult(_0x36c118,_0x5c0756){return function(_0x4238e6){if(_0x4238e6){var _0x1ecb4c=_0x4238e6['count'],_0xf3bc0d=_0x5c0756['offset'],_0x3d6099=_0x5c0756['offset']+_0x5c0756[_0x389c('0x1b')],_0x2d900b;if(_0x3d6099>=_0x1ecb4c){_0x3d6099=_0x1ecb4c;_0x2d900b=0xc8;}else{_0x2d900b=0xce;}_0x36c118[_0x389c('0x19')](_0x2d900b);return _0x36c118['set'](_0x389c('0x1c'),_0xf3bc0d+'-'+_0x3d6099+'/'+_0x1ecb4c)[_0x389c('0x1a')](_0x4238e6);}return null;};}function patchUpdates(_0x421f5f){return function(_0x102637){try{jsonpatch[_0x389c('0x1d')](_0x102637,_0x421f5f,!![]);}catch(_0x45dbbb){return BPromise[_0x389c('0x1e')](_0x45dbbb);}return _0x102637[_0x389c('0x1f')]();};}function saveUpdates(_0x239de1,_0x4fc960){return function(_0x3d5fd1){if(_0x3d5fd1){return _0x3d5fd1[_0x389c('0x20')](_0x239de1)[_0x389c('0x21')](function(_0xef720){return _0xef720;});}return null;};}function removeEntity(_0x34bd04,_0x2e1012){return function(_0x5284e9){if(_0x5284e9){return _0x5284e9[_0x389c('0x22')]()[_0x389c('0x21')](function(){var _0xfe443c=_0x5284e9[_0x389c('0x23')]({'plain':!![]});var _0x54869a=_0x389c('0x24');return db[_0x389c('0x25')]['destroy']({'where':{'type':_0x54869a,'resourceId':_0xfe443c['id']}})[_0x389c('0x21')](function(){return _0x5284e9;});})['then'](function(){_0x34bd04[_0x389c('0x19')](0xcc)[_0x389c('0x26')]();});}};}function handleEntityNotFound(_0x423d65,_0x18aa3e){return function(_0x21ab93){if(!_0x21ab93){_0x423d65['sendStatus'](0x194);}return _0x21ab93;};}function handleError(_0x32ccc1,_0xcc1b60){_0xcc1b60=_0xcc1b60||0x1f4;return function(_0x29e9f8){logger[_0x389c('0x27')](_0x29e9f8[_0x389c('0x28')]);if(_0x29e9f8['name']){delete _0x29e9f8[_0x389c('0x29')];}_0x32ccc1['status'](_0xcc1b60)[_0x389c('0x2a')](_0x29e9f8);};}exports[_0x389c('0x2b')]=function(_0x16f5bf,_0xeac171){var _0x5582af={},_0xe34d6c={},_0x80a2e1={'count':0x0,'rows':[]};var _0x594f6a=_[_0x389c('0x2c')](db[_0x389c('0x2d')][_0x389c('0x2e')],function(_0xa1cf2b){return{'name':_0xa1cf2b[_0x389c('0x2f')],'type':_0xa1cf2b[_0x389c('0x30')][_0x389c('0x31')]};});_0xe34d6c[_0x389c('0x32')]=_[_0x389c('0x2c')](_0x594f6a,_0x389c('0x29'));_0xe34d6c[_0x389c('0x33')]=_[_0x389c('0x34')](_0x16f5bf['query']);_0xe34d6c['filters']=_['intersection'](_0xe34d6c[_0x389c('0x32')],_0xe34d6c['query']);_0x5582af[_0x389c('0x35')]=_['intersection'](_0xe34d6c[_0x389c('0x32')],qs[_0x389c('0x36')](_0x16f5bf[_0x389c('0x33')][_0x389c('0x36')]));_0x5582af['attributes']=_0x5582af[_0x389c('0x35')][_0x389c('0x37')]?_0x5582af[_0x389c('0x35')]:_0xe34d6c[_0x389c('0x32')];if(!_0x16f5bf[_0x389c('0x33')][_0x389c('0x38')]('nolimit')){_0x5582af['limit']=qs[_0x389c('0x1b')](_0x16f5bf[_0x389c('0x33')][_0x389c('0x1b')]);_0x5582af[_0x389c('0x39')]=qs[_0x389c('0x39')](_0x16f5bf[_0x389c('0x33')][_0x389c('0x39')]);}_0x5582af[_0x389c('0x3a')]=qs[_0x389c('0x3b')](_0x16f5bf[_0x389c('0x33')][_0x389c('0x3b')]);_0x5582af[_0x389c('0x3c')]=qs[_0x389c('0x3d')](_['pick'](_0x16f5bf['query'],_0xe34d6c[_0x389c('0x3d')]),_0x594f6a);if(_0x16f5bf[_0x389c('0x33')][_0x389c('0x3e')]){_0x5582af[_0x389c('0x3c')]=_[_0x389c('0x3f')](_0x5582af[_0x389c('0x3c')],{'$or':_['map'](_0x594f6a,function(_0x57853f){if(_0x57853f[_0x389c('0x30')]!==_0x389c('0x40')){var _0x378c00={};_0x378c00[_0x57853f['name']]={'$like':'%'+_0x16f5bf[_0x389c('0x33')][_0x389c('0x3e')]+'%'};return _0x378c00;}})});}_0x5582af=_[_0x389c('0x3f')]({},_0x5582af,_0x16f5bf[_0x389c('0x41')]);var _0x1a3ba9={'where':_0x5582af[_0x389c('0x3c')]};return db['Interval'][_0x389c('0x42')](_0x1a3ba9)[_0x389c('0x21')](function(_0x3bb25e){_0x80a2e1[_0x389c('0x42')]=_0x3bb25e;if(_0x16f5bf['query'][_0x389c('0x43')]){_0x5582af['include']=[{'all':!![]}];}return db[_0x389c('0x2d')][_0x389c('0x44')](_0x5582af);})[_0x389c('0x21')](function(_0x44e7e8){_0x80a2e1[_0x389c('0x45')]=_0x44e7e8;return _0x80a2e1;})[_0x389c('0x21')](respondWithFilteredResult(_0xeac171,_0x5582af))[_0x389c('0x46')](handleError(_0xeac171,null));};exports[_0x389c('0x47')]=function(_0x2fc644,_0x213bd9){var _0x1eb402={'raw':!![],'where':{'id':_0x2fc644[_0x389c('0x48')]['id']}},_0x4ec6e4={};_0x4ec6e4[_0x389c('0x32')]=_['keys'](db[_0x389c('0x2d')]['rawAttributes']);_0x4ec6e4[_0x389c('0x33')]=_[_0x389c('0x34')](_0x2fc644[_0x389c('0x33')]);_0x4ec6e4[_0x389c('0x49')]=_[_0x389c('0x4a')](_0x4ec6e4[_0x389c('0x32')],_0x4ec6e4[_0x389c('0x33')]);_0x1eb402[_0x389c('0x35')]=_[_0x389c('0x4a')](_0x4ec6e4[_0x389c('0x32')],qs[_0x389c('0x36')](_0x2fc644[_0x389c('0x33')][_0x389c('0x36')]));_0x1eb402['attributes']=_0x1eb402['attributes'][_0x389c('0x37')]?_0x1eb402[_0x389c('0x35')]:_0x4ec6e4[_0x389c('0x32')];if(_0x2fc644['query'][_0x389c('0x43')]){_0x1eb402[_0x389c('0x4b')]=[{'all':!![]}];}_0x1eb402=_[_0x389c('0x3f')]({},_0x1eb402,_0x2fc644[_0x389c('0x41')]);return db['Interval']['find'](_0x1eb402)['then'](handleEntityNotFound(_0x213bd9,null))['then'](respondWithResult(_0x213bd9,null))[_0x389c('0x46')](handleError(_0x213bd9,null));};exports['create']=function(_0x4ffe40,_0x1b1732){return db[_0x389c('0x2d')][_0x389c('0x4c')](_0x4ffe40[_0x389c('0x4d')],{})[_0x389c('0x21')](function(_0xd37a48){var _0x3302b8=_0x4ffe40['user'][_0x389c('0x23')]({'plain':!![]});if(!_0x3302b8)throw new Error(_0x389c('0x4e'));if(_0x3302b8[_0x389c('0x4f')]===_0x389c('0x50')){var _0x3efa0f=_0xd37a48[_0x389c('0x23')]({'plain':!![]});var _0x483eb8=_0x389c('0x24');return db['UserProfileSection'][_0x389c('0x51')]({'where':{'name':_0x483eb8,'userProfileId':_0x3302b8['userProfileId']},'raw':!![]})[_0x389c('0x21')](function(_0x1589eb){if(_0x1589eb&&_0x1589eb[_0x389c('0x52')]===0x0){return db[_0x389c('0x25')][_0x389c('0x4c')]({'name':_0x3efa0f[_0x389c('0x29')],'resourceId':_0x3efa0f['id'],'type':_0x1589eb['name'],'sectionId':_0x1589eb['id']},{})[_0x389c('0x21')](function(){return _0xd37a48;});}else{return _0xd37a48;}})[_0x389c('0x46')](function(_0x5e1ca3){logger[_0x389c('0x27')](_0x389c('0x53'),_0x5e1ca3);throw _0x5e1ca3;});}return _0xd37a48;})[_0x389c('0x21')](respondWithResult(_0x1b1732,0xc9))['catch'](handleError(_0x1b1732,null));};exports[_0x389c('0x20')]=function(_0x3325a6,_0x585897){if(_0x3325a6[_0x389c('0x4d')]['id']){delete _0x3325a6[_0x389c('0x4d')]['id'];}return db['Interval'][_0x389c('0x51')]({'where':{'id':_0x3325a6[_0x389c('0x48')]['id']}})[_0x389c('0x21')](handleEntityNotFound(_0x585897,null))[_0x389c('0x21')](saveUpdates(_0x3325a6[_0x389c('0x4d')],null))[_0x389c('0x21')](respondWithResult(_0x585897,null))[_0x389c('0x46')](handleError(_0x585897,null));};exports[_0x389c('0x22')]=function(_0x37e535,_0x317216){return db['Interval'][_0x389c('0x51')]({'where':{'id':_0x37e535[_0x389c('0x48')]['id']}})[_0x389c('0x21')](handleEntityNotFound(_0x317216,null))['then'](removeEntity(_0x317216,null))[_0x389c('0x46')](handleError(_0x317216,null));};exports['addInterval']=function(_0x4c1448,_0x37cac6,_0x33a7a1){if(_0x4c1448[_0x389c('0x4d')]['id']){delete _0x4c1448[_0x389c('0x4d')]['id'];}return db[_0x389c('0x2d')]['find']({'where':{'id':_0x4c1448[_0x389c('0x48')]['id']}})[_0x389c('0x21')](handleEntityNotFound(_0x37cac6,null))[_0x389c('0x21')](function(_0x5c62e3){if(_0x5c62e3){_0x4c1448[_0x389c('0x4d')][_0x389c('0x54')]=_0x5c62e3['id'];return db[_0x389c('0x2d')][_0x389c('0x4c')](_0x4c1448['body']);}})[_0x389c('0x21')](respondWithResult(_0x37cac6,null))[_0x389c('0x46')](handleError(_0x37cac6,null));};exports[_0x389c('0x55')]=function(_0x2a0130,_0x104983,_0x52e988){var _0x5359f5={};var _0x2d3b5f={};var _0x4bf9ec;var _0x4c7b77;return db[_0x389c('0x2d')][_0x389c('0x56')]({'where':{'id':_0x2a0130['params']['id']}})[_0x389c('0x21')](handleEntityNotFound(_0x104983,null))['then'](function(_0x18d3d7){if(_0x18d3d7){_0x4bf9ec=_0x18d3d7;_0x2d3b5f['model']=_[_0x389c('0x34')](db['Interval'][_0x389c('0x2e')]);_0x2d3b5f[_0x389c('0x33')]=_[_0x389c('0x34')](_0x2a0130[_0x389c('0x33')]);_0x2d3b5f['filters']=_[_0x389c('0x4a')](_0x2d3b5f[_0x389c('0x32')],_0x2d3b5f['query']);_0x5359f5[_0x389c('0x35')]=_['intersection'](_0x2d3b5f['model'],qs[_0x389c('0x36')](_0x2a0130[_0x389c('0x33')][_0x389c('0x36')]));_0x5359f5['attributes']=_0x5359f5[_0x389c('0x35')][_0x389c('0x37')]?_0x5359f5[_0x389c('0x35')]:_0x2d3b5f[_0x389c('0x32')];_0x5359f5['order']=qs[_0x389c('0x3b')](_0x2a0130['query']['sort']);_0x5359f5[_0x389c('0x3c')]=qs[_0x389c('0x3d')](_['pick'](_0x2a0130[_0x389c('0x33')],_0x2d3b5f[_0x389c('0x3d')]));if(_0x2a0130['query']['filter']){_0x5359f5[_0x389c('0x3c')]=_[_0x389c('0x3f')](_0x5359f5[_0x389c('0x3c')],{'$or':_[_0x389c('0x2c')](_0x5359f5[_0x389c('0x35')],function(_0x261dfb){var _0x15990e={};_0x15990e[_0x261dfb]={'$like':'%'+_0x2a0130[_0x389c('0x33')][_0x389c('0x3e')]+'%'};return _0x15990e;})});}_0x5359f5=_[_0x389c('0x3f')]({},_0x5359f5,_0x2a0130[_0x389c('0x41')]);return _0x4bf9ec['getIntervals'](_0x5359f5);}})[_0x389c('0x21')](function(_0x404e8e){if(_0x404e8e){_0x4c7b77=_0x404e8e[_0x389c('0x37')];if(!_0x2a0130['query'][_0x389c('0x38')](_0x389c('0x57'))){_0x5359f5[_0x389c('0x1b')]=qs[_0x389c('0x1b')](_0x2a0130['query'][_0x389c('0x1b')]);_0x5359f5[_0x389c('0x39')]=qs['offset'](_0x2a0130[_0x389c('0x33')][_0x389c('0x39')]);}return _0x4bf9ec[_0x389c('0x55')](_0x5359f5);}})[_0x389c('0x21')](function(_0x199ed9){if(_0x199ed9){return _0x199ed9?{'count':_0x4c7b77,'rows':_0x199ed9}:null;}})[_0x389c('0x21')](respondWithResult(_0x104983,null))[_0x389c('0x46')](handleError(_0x104983,null));};exports[_0x389c('0x58')]=function(_0x33ef0c,_0x164787,_0x40980d){return db['Interval'][_0x389c('0x56')]({'where':{'id':_0x33ef0c['params']['id']}})[_0x389c('0x21')](handleEntityNotFound(_0x164787,null))[_0x389c('0x21')](function(_0x1ddbf8){if(_0x1ddbf8){return db['sequelize'][_0x389c('0x59')](function(_0x21a890){return db['Interval'][_0x389c('0x22')]({'where':{'IntervalId':_0x33ef0c['params']['id']},'transaction':_0x21a890})['then'](function(_0x99a978){var _0x12f602=_['map'](_0x33ef0c['body'],function(_0x29dea4){delete _0x29dea4['id'];_0x29dea4[_0x389c('0x54')]=_0x33ef0c[_0x389c('0x48')]['id'];return _0x29dea4;});return db[_0x389c('0x2d')][_0x389c('0x5a')](_0x12f602,{'transaction':_0x21a890});});})[_0x389c('0x21')](function(){return db['Interval'][_0x389c('0x44')]({'where':{'IntervalId':_0x33ef0c[_0x389c('0x48')]['id']}});});}})[_0x389c('0x21')](respondWithResult(_0x164787,null))[_0x389c('0x46')](handleError(_0x164787,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 14c000f..c0f1a08 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 _0x9e3f=['./interval.attributes','../../components/extensions/rewrite','define','Interval','tools_intervals','rewrite','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4d82e1,_0x5ac72b){var _0x5f3bd9=function(_0x5380db){while(--_0x5380db){_0x4d82e1['push'](_0x4d82e1['shift']());}};_0x5f3bd9(++_0x5ac72b);}(_0x9e3f,0x1f0));var _0xf9e3=function(_0x241a7c,_0x4eddfb){_0x241a7c=_0x241a7c-0x0;var _0x5f5d99=_0x9e3f[_0x241a7c];return _0x5f5d99;};'use strict';var _=require(_0xf9e3('0x0'));var util=require('util');var logger=require(_0xf9e3('0x1'))(_0xf9e3('0x2'));var moment=require(_0xf9e3('0x3'));var BPromise=require(_0xf9e3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf9e3('0x5'));var rimraf=require(_0xf9e3('0x6'));var config=require(_0xf9e3('0x7'));var attributes=require(_0xf9e3('0x8'));var extensions=require(_0xf9e3('0x9'));module['exports']=function(_0x49a778,_0x2bcb44){return _0x49a778[_0xf9e3('0xa')](_0xf9e3('0xb'),attributes,{'tableName':_0xf9e3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x58d2ba,_0x40d078){extensions[_0xf9e3('0xd')](_0x49a778,_0x58d2ba);},'afterBulkCreate':function(_0x3f7ccd,_0x2b707c,_0x49a0ef){_0x49a0ef();extensions['rewrite'](_0x49a778,_0x3f7ccd[0x0]);},'afterUpdate':function(_0x41298f,_0x5eefbe){extensions[_0xf9e3('0xd')](_0x49a778,_0x41298f);},'afterDestroy':function(_0x3c9977,_0x307e52){extensions[_0xf9e3('0xd')](_0x49a778,_0x3c9977);}}});}; \ No newline at end of file +var _0x4787=['Interval','tools_intervals','rewrite','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','define'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4787,0x148));var _0x7478=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4787[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x7478('0x0'));var logger=require(_0x7478('0x1'))(_0x7478('0x2'));var moment=require('moment');var BPromise=require(_0x7478('0x3'));var rp=require(_0x7478('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7478('0x5'));var config=require(_0x7478('0x6'));var attributes=require(_0x7478('0x7'));var extensions=require(_0x7478('0x8'));module['exports']=function(_0x4e03f4,_0x4042a3){return _0x4e03f4[_0x7478('0x9')](_0x7478('0xa'),attributes,{'tableName':_0x7478('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x135ae9,_0x13cbb2){extensions[_0x7478('0xc')](_0x4e03f4,_0x135ae9);},'afterBulkCreate':function(_0x3a5afd,_0x504edc,_0x56f028){_0x56f028();extensions[_0x7478('0xc')](_0x4e03f4,_0x3a5afd[0x0]);},'afterUpdate':function(_0x4eecb1,_0x3e10b2){extensions['rewrite'](_0x4e03f4,_0x4eecb1);},'afterDestroy':function(_0x3233a2,_0x582534){extensions[_0x7478('0xc')](_0x4e03f4,_0x3233a2);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 76c7f5c..9835c4d 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 _0xa3fb=['stringify','error','Interval,\x20%s,\x20%s','message','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowInterval','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x48228a,_0xce5bfe){var _0x4c52c0=function(_0x56e0dd){while(--_0x56e0dd){_0x48228a['push'](_0x48228a['shift']());}};_0x4c52c0(++_0xce5bfe);}(_0xa3fb,0x78));var _0xba3f=function(_0x5b8db3,_0x52df20){_0x5b8db3=_0x5b8db3-0x0;var _0x2f6743=_0xa3fb[_0x5b8db3];return _0x2f6743;};'use strict';var _=require(_0xba3f('0x0'));var util=require(_0xba3f('0x1'));var moment=require(_0xba3f('0x2'));var BPromise=require(_0xba3f('0x3'));var rs=require(_0xba3f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba3f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xba3f('0x6'))('rpc');var config=require(_0xba3f('0x7'));var jayson=require(_0xba3f('0x8'));var client=jayson[_0xba3f('0x9')][_0xba3f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e385e,_0xa9662b,_0x586036){return new BPromise(function(_0x57c8a5,_0x325c8a){return client[_0xba3f('0xb')](_0x5e385e,_0x586036)[_0xba3f('0xc')](function(_0xc617ba){logger[_0xba3f('0xd')]('Interval,\x20%s,\x20%s',_0xa9662b,_0xba3f('0xe'));logger[_0xba3f('0xf')]('Interval,\x20%s,\x20%s,\x20%s',_0xa9662b,'request\x20sent',JSON[_0xba3f('0x10')](_0xc617ba));if(_0xc617ba[_0xba3f('0x11')]){if(_0xc617ba[_0xba3f('0x11')]['code']===0x1f4){logger[_0xba3f('0x11')](_0xba3f('0x12'),_0xa9662b,_0xc617ba[_0xba3f('0x11')][_0xba3f('0x13')]);return _0x325c8a(_0xc617ba[_0xba3f('0x11')][_0xba3f('0x13')]);}logger['error'](_0xba3f('0x12'),_0xa9662b,_0xc617ba[_0xba3f('0x11')][_0xba3f('0x13')]);return _0x57c8a5(_0xc617ba[_0xba3f('0x11')][_0xba3f('0x13')]);}else{logger['info'](_0xba3f('0x12'),_0xa9662b,_0xba3f('0xe'));_0x57c8a5(_0xc617ba['result'][_0xba3f('0x13')]);}})['catch'](function(_0x30bf1c){logger[_0xba3f('0x11')](_0xba3f('0x12'),_0xa9662b,_0x30bf1c);_0x325c8a(_0x30bf1c);});});}exports[_0xba3f('0x14')]=function(_0x2284b4){var _0x2e8b21=this;return new Promise(function(_0x396fa6,_0x1f72ef){return db[_0xba3f('0x15')][_0xba3f('0x16')]({'raw':_0x2284b4[_0xba3f('0x17')]?_0x2284b4[_0xba3f('0x17')][_0xba3f('0x18')]===undefined?!![]:![]:!![],'where':_0x2284b4['options']?_0x2284b4[_0xba3f('0x17')][_0xba3f('0x19')]||null:null,'attributes':_0x2284b4[_0xba3f('0x17')]?_0x2284b4[_0xba3f('0x17')][_0xba3f('0x1a')]||null:null,'limit':_0x2284b4[_0xba3f('0x17')]?_0x2284b4[_0xba3f('0x17')][_0xba3f('0x1b')]||null:null,'include':_0x2284b4['options']?_0x2284b4[_0xba3f('0x17')][_0xba3f('0x1c')]?_[_0xba3f('0x1d')](_0x2284b4['options'][_0xba3f('0x1c')],function(_0x28a9bd){return{'model':db[_0x28a9bd[_0xba3f('0x1e')]],'as':_0x28a9bd['as'],'attributes':_0x28a9bd[_0xba3f('0x1a')],'include':_0x28a9bd['include']?_['map'](_0x28a9bd['include'],function(_0x2c7ed0){return{'model':db[_0x2c7ed0[_0xba3f('0x1e')]],'as':_0x2c7ed0['as'],'attributes':_0x2c7ed0[_0xba3f('0x1a')],'include':_0x2c7ed0[_0xba3f('0x1c')]?_[_0xba3f('0x1d')](_0x2c7ed0[_0xba3f('0x1c')],function(_0x3f2522){return{'model':db[_0x3f2522[_0xba3f('0x1e')]],'as':_0x3f2522['as'],'attributes':_0x3f2522['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xbf83fc){logger[_0xba3f('0xd')](_0xba3f('0x14'),_0x2284b4);logger['debug'](_0xba3f('0x14'),_0x2284b4,JSON[_0xba3f('0x10')](_0xbf83fc));_0x396fa6(_0xbf83fc);})[_0xba3f('0x1f')](function(_0x18cdd2){logger[_0xba3f('0x11')]('GetInterval',_0x18cdd2[_0xba3f('0x13')],_0x2284b4);_0x1f72ef(_0x2e8b21[_0xba3f('0x11')](0x1f4,_0x18cdd2[_0xba3f('0x13')]));});});};exports[_0xba3f('0x20')]=function(_0x203e5a){var _0x540e87=this;return new Promise(function(_0x46d50a,_0x5ca15d){return db[_0xba3f('0x15')][_0xba3f('0x21')]({'raw':_0x203e5a['options']?_0x203e5a[_0xba3f('0x17')][_0xba3f('0x18')]===undefined?!![]:![]:!![],'where':_0x203e5a['options']?_0x203e5a[_0xba3f('0x17')][_0xba3f('0x19')]||null:null,'attributes':_0x203e5a[_0xba3f('0x17')]?_0x203e5a[_0xba3f('0x17')][_0xba3f('0x1a')]||null:null,'include':_0x203e5a['options']?_0x203e5a['options'][_0xba3f('0x1c')]?_[_0xba3f('0x1d')](_0x203e5a[_0xba3f('0x17')][_0xba3f('0x1c')],function(_0x4b04c4){return{'model':db[_0x4b04c4[_0xba3f('0x1e')]],'as':_0x4b04c4['as'],'attributes':_0x4b04c4[_0xba3f('0x1a')],'include':_0x4b04c4['include']?_[_0xba3f('0x1d')](_0x4b04c4['include'],function(_0x5447b0){return{'model':db[_0x5447b0[_0xba3f('0x1e')]],'as':_0x5447b0['as'],'attributes':_0x5447b0[_0xba3f('0x1a')],'include':_0x5447b0[_0xba3f('0x1c')]?_[_0xba3f('0x1d')](_0x5447b0['include'],function(_0x1f7805){return{'model':db[_0x1f7805[_0xba3f('0x1e')]],'as':_0x1f7805['as'],'attributes':_0x1f7805['attributes']};}):[]};}):[]};}):[]:[]})[_0xba3f('0xc')](function(_0x460628){logger['info'](_0xba3f('0x20'),_0x203e5a);logger[_0xba3f('0xf')](_0xba3f('0x20'),_0x203e5a,JSON[_0xba3f('0x10')](_0x460628));_0x46d50a(_0x460628);})[_0xba3f('0x1f')](function(_0x6ae31e){logger[_0xba3f('0x11')](_0xba3f('0x20'),_0x6ae31e['message'],_0x203e5a);_0x5ca15d(_0x540e87[_0xba3f('0x11')](0x1f4,_0x6ae31e[_0xba3f('0x13')]));});});}; \ No newline at end of file +var _0x0d7a=['Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetInterval','Interval','options','where','attributes','limit','include','model','map','then','ShowInterval','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x14476b,_0xd1a7a4){var _0x24e2e8=function(_0x52ed26){while(--_0x52ed26){_0x14476b['push'](_0x14476b['shift']());}};_0x24e2e8(++_0xd1a7a4);}(_0x0d7a,0x164));var _0xa0d7=function(_0x2c2781,_0x5f1153){_0x2c2781=_0x2c2781-0x0;var _0x3fe469=_0x0d7a[_0x2c2781];return _0x3fe469;};'use strict';var _=require(_0xa0d7('0x0'));var util=require(_0xa0d7('0x1'));var moment=require(_0xa0d7('0x2'));var BPromise=require(_0xa0d7('0x3'));var rs=require(_0xa0d7('0x4'));var fs=require('fs');var Redis=require(_0xa0d7('0x5'));var db=require(_0xa0d7('0x6'))['db'];var utils=require(_0xa0d7('0x7'));var logger=require(_0xa0d7('0x8'))(_0xa0d7('0x9'));var config=require(_0xa0d7('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa0d7('0xb')][_0xa0d7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41f358,_0x90972e,_0x11ccee){return new BPromise(function(_0x5a6332,_0x25fd74){return client[_0xa0d7('0xd')](_0x41f358,_0x11ccee)['then'](function(_0x746960){logger['info'](_0xa0d7('0xe'),_0x90972e,_0xa0d7('0xf'));logger[_0xa0d7('0x10')](_0xa0d7('0x11'),_0x90972e,_0xa0d7('0xf'),JSON[_0xa0d7('0x12')](_0x746960));if(_0x746960[_0xa0d7('0x13')]){if(_0x746960['error'][_0xa0d7('0x14')]===0x1f4){logger[_0xa0d7('0x13')](_0xa0d7('0xe'),_0x90972e,_0x746960['error']['message']);return _0x25fd74(_0x746960[_0xa0d7('0x13')][_0xa0d7('0x15')]);}logger[_0xa0d7('0x13')](_0xa0d7('0xe'),_0x90972e,_0x746960[_0xa0d7('0x13')][_0xa0d7('0x15')]);return _0x5a6332(_0x746960[_0xa0d7('0x13')]['message']);}else{logger[_0xa0d7('0x16')](_0xa0d7('0xe'),_0x90972e,_0xa0d7('0xf'));_0x5a6332(_0x746960['result'][_0xa0d7('0x15')]);}})[_0xa0d7('0x17')](function(_0x1deacc){logger['error'](_0xa0d7('0xe'),_0x90972e,_0x1deacc);_0x25fd74(_0x1deacc);});});}exports[_0xa0d7('0x18')]=function(_0x466fa2){var _0x2b4887=this;return new Promise(function(_0x54d7a9,_0x56fd01){return db[_0xa0d7('0x19')]['findAll']({'raw':_0x466fa2[_0xa0d7('0x1a')]?_0x466fa2[_0xa0d7('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x466fa2[_0xa0d7('0x1a')]?_0x466fa2[_0xa0d7('0x1a')][_0xa0d7('0x1b')]||null:null,'attributes':_0x466fa2[_0xa0d7('0x1a')]?_0x466fa2[_0xa0d7('0x1a')][_0xa0d7('0x1c')]||null:null,'limit':_0x466fa2[_0xa0d7('0x1a')]?_0x466fa2[_0xa0d7('0x1a')][_0xa0d7('0x1d')]||null:null,'include':_0x466fa2[_0xa0d7('0x1a')]?_0x466fa2[_0xa0d7('0x1a')][_0xa0d7('0x1e')]?_['map'](_0x466fa2[_0xa0d7('0x1a')][_0xa0d7('0x1e')],function(_0x305029){return{'model':db[_0x305029[_0xa0d7('0x1f')]],'as':_0x305029['as'],'attributes':_0x305029['attributes'],'include':_0x305029[_0xa0d7('0x1e')]?_[_0xa0d7('0x20')](_0x305029[_0xa0d7('0x1e')],function(_0x23cc01){return{'model':db[_0x23cc01[_0xa0d7('0x1f')]],'as':_0x23cc01['as'],'attributes':_0x23cc01[_0xa0d7('0x1c')],'include':_0x23cc01[_0xa0d7('0x1e')]?_[_0xa0d7('0x20')](_0x23cc01[_0xa0d7('0x1e')],function(_0x35c7fa){return{'model':db[_0x35c7fa['model']],'as':_0x35c7fa['as'],'attributes':_0x35c7fa[_0xa0d7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa0d7('0x21')](function(_0x4d2f4c){logger['info'](_0xa0d7('0x18'),_0x466fa2);logger[_0xa0d7('0x10')](_0xa0d7('0x18'),_0x466fa2,JSON[_0xa0d7('0x12')](_0x4d2f4c));_0x54d7a9(_0x4d2f4c);})['catch'](function(_0x3a24d5){logger[_0xa0d7('0x13')]('GetInterval',_0x3a24d5['message'],_0x466fa2);_0x56fd01(_0x2b4887['error'](0x1f4,_0x3a24d5[_0xa0d7('0x15')]));});});};exports[_0xa0d7('0x22')]=function(_0x503182){var _0x14a7aa=this;return new Promise(function(_0x4c20d0,_0x4fbed0){return db['Interval'][_0xa0d7('0x23')]({'raw':_0x503182[_0xa0d7('0x1a')]?_0x503182[_0xa0d7('0x1a')][_0xa0d7('0x24')]===undefined?!![]:![]:!![],'where':_0x503182[_0xa0d7('0x1a')]?_0x503182[_0xa0d7('0x1a')][_0xa0d7('0x1b')]||null:null,'attributes':_0x503182['options']?_0x503182[_0xa0d7('0x1a')][_0xa0d7('0x1c')]||null:null,'include':_0x503182['options']?_0x503182['options'][_0xa0d7('0x1e')]?_[_0xa0d7('0x20')](_0x503182[_0xa0d7('0x1a')][_0xa0d7('0x1e')],function(_0x389af5){return{'model':db[_0x389af5[_0xa0d7('0x1f')]],'as':_0x389af5['as'],'attributes':_0x389af5['attributes'],'include':_0x389af5[_0xa0d7('0x1e')]?_['map'](_0x389af5[_0xa0d7('0x1e')],function(_0x4ac323){return{'model':db[_0x4ac323[_0xa0d7('0x1f')]],'as':_0x4ac323['as'],'attributes':_0x4ac323[_0xa0d7('0x1c')],'include':_0x4ac323[_0xa0d7('0x1e')]?_[_0xa0d7('0x20')](_0x4ac323['include'],function(_0x48d455){return{'model':db[_0x48d455['model']],'as':_0x48d455['as'],'attributes':_0x48d455['attributes']};}):[]};}):[]};}):[]:[]})[_0xa0d7('0x21')](function(_0x172b6f){logger[_0xa0d7('0x16')](_0xa0d7('0x22'),_0x503182);logger[_0xa0d7('0x10')](_0xa0d7('0x22'),_0x503182,JSON[_0xa0d7('0x12')](_0x172b6f));_0x4c20d0(_0x172b6f);})[_0xa0d7('0x17')](function(_0x3585ad){logger[_0xa0d7('0x13')]('ShowInterval',_0x3585ad[_0xa0d7('0x15')],_0x503182);_0x4fbed0(_0x14a7aa[_0xa0d7('0x13')](0x1f4,_0x3585ad[_0xa0d7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index d4509ed..27d54c9 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 _0xf379=['send','exports','express','Router','./jira.controller','post'];(function(_0x4ea413,_0x51ff3a){var _0x51cf25=function(_0x3c6456){while(--_0x3c6456){_0x4ea413['push'](_0x4ea413['shift']());}};_0x51cf25(++_0x51ff3a);}(_0xf379,0x7a));var _0x9f37=function(_0x3493da,_0x2fa4a1){_0x3493da=_0x3493da-0x0;var _0x538908=_0xf379[_0x3493da];return _0x538908;};'use strict';var express=require(_0x9f37('0x0'));var router=express[_0x9f37('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x9f37('0x2'));router[_0x9f37('0x3')]('/',auth['isAuthenticated'](),controller[_0x9f37('0x4')]);module[_0x9f37('0x5')]=router; \ No newline at end of file +var _0xdae9=['Router','post','isAuthenticated','exports','express'];(function(_0x4b352a,_0x477531){var _0x11bd8d=function(_0x5e7c7a){while(--_0x5e7c7a){_0x4b352a['push'](_0x4b352a['shift']());}};_0x11bd8d(++_0x477531);}(_0xdae9,0x12b));var _0x9dae=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xdae9[_0x1eda20];return _0x31b953;};'use strict';var express=require(_0x9dae('0x0'));var router=express[_0x9dae('0x1')]();var auth=require('../../components/auth/service');var controller=require('./jira.controller');router[_0x9dae('0x2')]('/',auth[_0x9dae('0x3')](),controller['send']);module[_0x9dae('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index c1ec535..7eeed45 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 _0x723a=['summary','Report','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','newToken','name','customfield_11504','reason','track.xcallymotion.com','POST','application/json','Basic\x20','toString','base64','setEncoding','data','end','status','statusCode','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','key','MOTGUI'];(function(_0x52980f,_0x47b3b0){var _0x1f52a1=function(_0x51dd63){while(--_0x51dd63){_0x52980f['push'](_0x52980f['shift']());}};_0x1f52a1(++_0x47b3b0);}(_0x723a,0x149));var _0xa723=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x723a[_0x62c958];return _0x57ec61;};'use strict';var BPromise=require(_0xa723('0x0'));var https=require(_0xa723('0x1'));var logger=require(_0xa723('0x2'))(_0xa723('0x3'));var USERNAME=_0xa723('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x4286aa,_0x5093fb){var _0x3f1bd4={'fields':{'project':{'key':_0x4286aa[_0xa723('0x5')]||_0xa723('0x6')},'summary':(_0x4286aa[_0xa723('0x7')]||_0xa723('0x8'))+_0xa723('0x9')+_0x4286aa['ip'],'description':_0x4286aa['description']||JSON[_0xa723('0xa')](_0x4286aa),'issuetype':{'name':_0x4286aa[_0xa723('0xb')]||_0xa723('0xc')}}};_0x3f1bd4[_0xa723('0xd')][_0xa723('0xe')]=_0x4286aa['email'];_0x3f1bd4[_0xa723('0xd')][_0xa723('0xf')]=_0x4286aa['oldToken'];_0x3f1bd4[_0xa723('0xd')]['customfield_11502']=_0x4286aa[_0xa723('0x10')];_0x3f1bd4[_0xa723('0xd')]['customfield_11503']=_0x4286aa[_0xa723('0x11')];_0x3f1bd4['fields'][_0xa723('0x12')]=_0x4286aa[_0xa723('0x13')];_0x3f1bd4[_0xa723('0xd')]['customfield_10102']=_0x4286aa['ip'];var _0x20aceb={'host':_0xa723('0x14'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xa723('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0xa723('0x16'),'Authorization':_0xa723('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0xa723('0x18')](_0xa723('0x19'))}};var _0x4f3f48=JSON['stringify'](_0x3f1bd4);var _0x3ccec7=https['request'](_0x20aceb,function(_0x31445f){_0x31445f[_0xa723('0x1a')]('utf8');var _0x47d4d3='';_0x31445f['on'](_0xa723('0x1b'),function(_0x97ea14){_0x47d4d3+=_0x97ea14;});_0x31445f['on'](_0xa723('0x1c'),function(){if(_0x5093fb){return _0x5093fb[_0xa723('0x1d')](_0x31445f[_0xa723('0x1e')])['json'](JSON[_0xa723('0x1f')](_0x47d4d3));}});});_0x3ccec7['on'](_0xa723('0x20'),function(_0x19c020){if(_0x5093fb){return _0x5093fb[_0xa723('0x1d')](0x1f4)[_0xa723('0x21')]({'errors':[{'message':_0xa723('0x22'),'type':'api.jira'}]});}});_0x3ccec7[_0xa723('0x23')](_0x4f3f48);_0x3ccec7['end']();}exports['openIssue']=openIssue;exports[_0xa723('0x24')]=function(_0xe34b11,_0x5171f8){_0xe34b11[_0xa723('0x25')]['ip']=_0xe34b11['headers'][_0xa723('0x26')]||_0xe34b11[_0xa723('0x27')]['remoteAddress']||_0xe34b11['socket'][_0xa723('0x28')]||_0xe34b11[_0xa723('0x27')][_0xa723('0x29')][_0xa723('0x28')];return openIssue(_0xe34b11['body'],_0x5171f8);}; \ No newline at end of file +var _0x777c=['error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','description','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_11504','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','stringify','setEncoding','utf8','data','status','statusCode','json'];(function(_0xe9c0fe,_0xe39dcc){var _0x129d23=function(_0x1af1d6){while(--_0x1af1d6){_0xe9c0fe['push'](_0xe9c0fe['shift']());}};_0x129d23(++_0xe39dcc);}(_0x777c,0x15a));var _0xc777=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x777c[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var https=require(_0xc777('0x0'));var logger=require(_0xc777('0x1'))(_0xc777('0x2'));var USERNAME=_0xc777('0x3');var PASSWORD=_0xc777('0x4');function openIssue(_0x5080bb,_0x5e5de8){var _0x3eccb3={'fields':{'project':{'key':_0x5080bb[_0xc777('0x5')]||_0xc777('0x6')},'summary':(_0x5080bb[_0xc777('0x7')]||'Report')+_0xc777('0x8')+_0x5080bb['ip'],'description':_0x5080bb[_0xc777('0x9')]||JSON['stringify'](_0x5080bb),'issuetype':{'name':_0x5080bb['issuetype']||_0xc777('0xa')}}};_0x3eccb3[_0xc777('0xb')][_0xc777('0xc')]=_0x5080bb[_0xc777('0xd')];_0x3eccb3[_0xc777('0xb')][_0xc777('0xe')]=_0x5080bb[_0xc777('0xf')];_0x3eccb3[_0xc777('0xb')][_0xc777('0x10')]=_0x5080bb[_0xc777('0x11')];_0x3eccb3[_0xc777('0xb')]['customfield_11503']=_0x5080bb[_0xc777('0x12')];_0x3eccb3['fields'][_0xc777('0x13')]=_0x5080bb['reason'];_0x3eccb3['fields']['customfield_10102']=_0x5080bb['ip'];var _0x5a8fe8={'host':_0xc777('0x14'),'port':0x1bb,'path':_0xc777('0x15'),'method':_0xc777('0x16'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xc777('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0xc777('0x18')]('base64')}};var _0xfc3e1=JSON[_0xc777('0x19')](_0x3eccb3);var _0x230f85=https['request'](_0x5a8fe8,function(_0x122947){_0x122947[_0xc777('0x1a')](_0xc777('0x1b'));var _0x2cf85f='';_0x122947['on'](_0xc777('0x1c'),function(_0x38dcf8){_0x2cf85f+=_0x38dcf8;});_0x122947['on']('end',function(){if(_0x5e5de8){return _0x5e5de8[_0xc777('0x1d')](_0x122947[_0xc777('0x1e')])[_0xc777('0x1f')](JSON['parse'](_0x2cf85f));}});});_0x230f85['on'](_0xc777('0x20'),function(_0x290663){if(_0x5e5de8){return _0x5e5de8[_0xc777('0x1d')](0x1f4)['json']({'errors':[{'message':_0xc777('0x21'),'type':_0xc777('0x22')}]});}});_0x230f85['write'](_0xfc3e1);_0x230f85['end']();}exports[_0xc777('0x23')]=openIssue;exports[_0xc777('0x24')]=function(_0x1f1268,_0x1d7cd2){_0x1f1268['body']['ip']=_0x1f1268[_0xc777('0x25')][_0xc777('0x26')]||_0x1f1268[_0xc777('0x27')][_0xc777('0x28')]||_0x1f1268[_0xc777('0x29')][_0xc777('0x28')]||_0x1f1268[_0xc777('0x27')][_0xc777('0x29')][_0xc777('0x28')];return openIssue(_0x1f1268['body'],_0x1d7cd2);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 8f8253a..ed984bf 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 _0xb603=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x4b2d8c,_0x1c4f0b){var _0x407237=function(_0x494419){while(--_0x494419){_0x4b2d8c['push'](_0x4b2d8c['shift']());}};_0x407237(++_0x1c4f0b);}(_0xb603,0x78));var _0x3b60=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb603[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x3b60('0x0'));var util=require(_0x3b60('0x1'));var path=require('path');var timeout=require(_0x3b60('0x2'));var express=require(_0x3b60('0x3'));var router=express[_0x3b60('0x4')]();var auth=require(_0x3b60('0x5'));var interaction=require(_0x3b60('0x6'));var config=require(_0x3b60('0x7'));var controller=require(_0x3b60('0x8'));router[_0x3b60('0x9')]('/',auth[_0x3b60('0xa')](),controller[_0x3b60('0xb')]);router[_0x3b60('0x9')](_0x3b60('0xc'),auth[_0x3b60('0xa')](),controller[_0x3b60('0xd')]);router[_0x3b60('0x9')](_0x3b60('0xe'),auth[_0x3b60('0xa')](),controller[_0x3b60('0xf')]);router['post']('/',auth[_0x3b60('0xa')](),controller[_0x3b60('0x10')]);router[_0x3b60('0x11')](_0x3b60('0xe'),auth['isAuthenticated'](),controller[_0x3b60('0x12')]);router[_0x3b60('0x13')](_0x3b60('0xe'),auth[_0x3b60('0xa')](),controller[_0x3b60('0x14')]);module[_0x3b60('0x15')]=router; \ No newline at end of file +var _0x9549=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','destroy','multer','util','path'];(function(_0x432a5e,_0x522f16){var _0x57654c=function(_0x5d49d0){while(--_0x5d49d0){_0x432a5e['push'](_0x432a5e['shift']());}};_0x57654c(++_0x522f16);}(_0x9549,0xa8));var _0x9954=function(_0x752093,_0x2e2670){_0x752093=_0x752093-0x0;var _0x3a6ab5=_0x9549[_0x752093];return _0x3a6ab5;};'use strict';var multer=require(_0x9954('0x0'));var util=require(_0x9954('0x1'));var path=require(_0x9954('0x2'));var timeout=require(_0x9954('0x3'));var express=require(_0x9954('0x4'));var router=express[_0x9954('0x5')]();var auth=require(_0x9954('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9954('0x7'));var controller=require('./jscriptyAnswerReport.controller');router[_0x9954('0x8')]('/',auth[_0x9954('0x9')](),controller[_0x9954('0xa')]);router[_0x9954('0x8')](_0x9954('0xb'),auth[_0x9954('0x9')](),controller['describe']);router[_0x9954('0x8')]('/:id',auth[_0x9954('0x9')](),controller[_0x9954('0xc')]);router[_0x9954('0xd')]('/',auth['isAuthenticated'](),controller[_0x9954('0xe')]);router[_0x9954('0xf')](_0x9954('0x10'),auth[_0x9954('0x9')](),controller[_0x9954('0x11')]);router['delete'](_0x9954('0x10'),auth['isAuthenticated'](),controller[_0x9954('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index dc29b2a..a33f4b5 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 _0xe7c7=['STRING','TEXT','long','sequelize','exports'];(function(_0x22d33b,_0x15491a){var _0x80b3ab=function(_0x4425de){while(--_0x4425de){_0x22d33b['push'](_0x22d33b['shift']());}};_0x80b3ab(++_0x15491a);}(_0xe7c7,0x139));var _0x7e7c=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xe7c7[_0x342baa];return _0x1208f3;};'use strict';var Sequelize=require(_0x7e7c('0x0'));module[_0x7e7c('0x1')]={'question':{'type':Sequelize[_0x7e7c('0x2')]},'answer':{'type':Sequelize[_0x7e7c('0x3')](_0x7e7c('0x4'))},'membername':{'type':Sequelize[_0x7e7c('0x2')]},'projectname':{'type':Sequelize[_0x7e7c('0x2')]},'queue':{'type':Sequelize[_0x7e7c('0x2')]},'uniqueid':{'type':Sequelize[_0x7e7c('0x2')]},'calleridname':{'type':Sequelize[_0x7e7c('0x2')]},'calleridnum':{'type':Sequelize[_0x7e7c('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4514=['STRING','exports'];(function(_0x24c15e,_0x2961dc){var _0x1e321f=function(_0x2999f6){while(--_0x2999f6){_0x24c15e['push'](_0x24c15e['shift']());}};_0x1e321f(++_0x2961dc);}(_0x4514,0x71));var _0x4451=function(_0x2e7c00,_0x2a306d){_0x2e7c00=_0x2e7c00-0x0;var _0x327edf=_0x4514[_0x2e7c00];return _0x327edf;};'use strict';var Sequelize=require('sequelize');module[_0x4451('0x0')]={'question':{'type':Sequelize[_0x4451('0x1')]},'answer':{'type':Sequelize['TEXT']('long')},'membername':{'type':Sequelize[_0x4451('0x1')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4451('0x1')]},'calleridname':{'type':Sequelize[_0x4451('0x1')]},'calleridnum':{'type':Sequelize[_0x4451('0x1')]},'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 eb28304..d384d13 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 _0xfd87=['desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','type','model','keys','filters','intersection','query','attributes','fields','length','order','sort','where','pick','count','findAll','rows','catch','show','params','filtears','includeAll','include','options','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce'];(function(_0x170a91,_0x1e7f80){var _0x610fa3=function(_0x45e64f){while(--_0x45e64f){_0x170a91['push'](_0x170a91['shift']());}};_0x610fa3(++_0x1e7f80);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x7fd8('0x0'));var emlformat=require(_0x7fd8('0x1'));var rimraf=require(_0x7fd8('0x2'));var zipdir=require(_0x7fd8('0x3'));var jsonpatch=require(_0x7fd8('0x4'));var rp=require(_0x7fd8('0x5'));var moment=require(_0x7fd8('0x6'));var BPromise=require(_0x7fd8('0x7'));var Mustache=require(_0x7fd8('0x8'));var util=require(_0x7fd8('0x9'));var path=require(_0x7fd8('0xa'));var sox=require('sox');var csv=require(_0x7fd8('0xb'));var ejs=require(_0x7fd8('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7fd8('0xd'));var crypto=require(_0x7fd8('0xe'));var jsforce=require(_0x7fd8('0xf'));var deskjs=require(_0x7fd8('0x10'));var toCsv=require(_0x7fd8('0xb'));var querystring=require('querystring');var Papa=require(_0x7fd8('0x11'));var Redis=require(_0x7fd8('0x12'));var authService=require(_0x7fd8('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fd8('0x14'))('api');var utils=require(_0x7fd8('0x15'));var config=require(_0x7fd8('0x16'));var licenseUtil=require(_0x7fd8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x136770,_0x2cccdb){_0x2cccdb=_0x2cccdb||0xcc;return function(_0xe84aa7){if(_0xe84aa7){return _0x136770[_0x7fd8('0x18')](_0x2cccdb);}return _0x136770[_0x7fd8('0x19')](_0x2cccdb)['end']();};}function respondWithResult(_0x1af365,_0x17a3a1){_0x17a3a1=_0x17a3a1||0xc8;return function(_0x1d481a){if(_0x1d481a){return _0x1af365[_0x7fd8('0x19')](_0x17a3a1)[_0x7fd8('0x1a')](_0x1d481a);}};}function respondWithFilteredResult(_0x38d45a,_0x1a4a52){return function(_0x33c8f9){if(_0x33c8f9){var _0x2a8818=_0x33c8f9['count'],_0x1461ed=_0x1a4a52['offset'],_0x416158=_0x1a4a52[_0x7fd8('0x1b')]+_0x1a4a52[_0x7fd8('0x1c')],_0x5837ef;if(_0x416158>=_0x2a8818){_0x416158=_0x2a8818;_0x5837ef=0xc8;}else{_0x5837ef=0xce;}_0x38d45a['status'](_0x5837ef);return _0x38d45a[_0x7fd8('0x1d')](_0x7fd8('0x1e'),_0x1461ed+'-'+_0x416158+'/'+_0x2a8818)[_0x7fd8('0x1a')](_0x33c8f9);}return null;};}function patchUpdates(_0x13b5be){return function(_0x3ab724){try{jsonpatch[_0x7fd8('0x1f')](_0x3ab724,_0x13b5be,!![]);}catch(_0x2edf31){return BPromise[_0x7fd8('0x20')](_0x2edf31);}return _0x3ab724['save']();};}function saveUpdates(_0x34bc09,_0x3b7b49){return function(_0x223e62){if(_0x223e62){return _0x223e62[_0x7fd8('0x21')](_0x34bc09)[_0x7fd8('0x22')](function(_0x7d1205){return _0x7d1205;});}return null;};}function removeEntity(_0x4f8563,_0xecd3f3){return function(_0x1d26d4){if(_0x1d26d4){return _0x1d26d4[_0x7fd8('0x23')]()[_0x7fd8('0x22')](function(){_0x4f8563['status'](0xcc)[_0x7fd8('0x24')]();});}};}function handleEntityNotFound(_0x402fa1,_0x2e7520){return function(_0x33ab3d){if(!_0x33ab3d){_0x402fa1[_0x7fd8('0x18')](0x194);}return _0x33ab3d;};}function handleError(_0x49f6cf,_0x54b7f0){_0x54b7f0=_0x54b7f0||0x1f4;return function(_0x3650cb){logger[_0x7fd8('0x25')](_0x3650cb[_0x7fd8('0x26')]);if(_0x3650cb[_0x7fd8('0x27')]){delete _0x3650cb[_0x7fd8('0x27')];}_0x49f6cf['status'](_0x54b7f0)[_0x7fd8('0x28')](_0x3650cb);};}exports[_0x7fd8('0x29')]=function(_0xda5f2a,_0x40b79b){var _0xa7da6b={},_0x52e1ed={},_0x544179={'count':0x0,'rows':[]};var _0x22a845=_[_0x7fd8('0x2a')](db[_0x7fd8('0x2b')][_0x7fd8('0x2c')],function(_0x573ed0){return{'name':_0x573ed0['fieldName'],'type':_0x573ed0[_0x7fd8('0x2d')]['key']};});_0x52e1ed[_0x7fd8('0x2e')]=_[_0x7fd8('0x2a')](_0x22a845,_0x7fd8('0x27'));_0x52e1ed['query']=_[_0x7fd8('0x2f')](_0xda5f2a['query']);_0x52e1ed[_0x7fd8('0x30')]=_[_0x7fd8('0x31')](_0x52e1ed[_0x7fd8('0x2e')],_0x52e1ed[_0x7fd8('0x32')]);_0xa7da6b[_0x7fd8('0x33')]=_[_0x7fd8('0x31')](_0x52e1ed[_0x7fd8('0x2e')],qs['fields'](_0xda5f2a[_0x7fd8('0x32')][_0x7fd8('0x34')]));_0xa7da6b[_0x7fd8('0x33')]=_0xa7da6b[_0x7fd8('0x33')][_0x7fd8('0x35')]?_0xa7da6b[_0x7fd8('0x33')]:_0x52e1ed[_0x7fd8('0x2e')];if(!_0xda5f2a[_0x7fd8('0x32')]['hasOwnProperty']('nolimit')){_0xa7da6b[_0x7fd8('0x1c')]=qs[_0x7fd8('0x1c')](_0xda5f2a[_0x7fd8('0x32')]['limit']);_0xa7da6b[_0x7fd8('0x1b')]=qs['offset'](_0xda5f2a['query'][_0x7fd8('0x1b')]);}_0xa7da6b[_0x7fd8('0x36')]=qs[_0x7fd8('0x37')](_0xda5f2a[_0x7fd8('0x32')][_0x7fd8('0x37')]);_0xa7da6b[_0x7fd8('0x38')]=qs[_0x7fd8('0x30')](_[_0x7fd8('0x39')](_0xda5f2a['query'],_0x52e1ed[_0x7fd8('0x30')]),_0x22a845);if(_0xda5f2a['query']['filter']){_0xa7da6b[_0x7fd8('0x38')]=_['merge'](_0xa7da6b['where'],{'$or':_['map'](_0x22a845,function(_0x6c5e52){if(_0x6c5e52[_0x7fd8('0x2d')]!=='VIRTUAL'){var _0x2e751d={};_0x2e751d[_0x6c5e52[_0x7fd8('0x27')]]={'$like':'%'+_0xda5f2a[_0x7fd8('0x32')]['filter']+'%'};return _0x2e751d;}})});}_0xa7da6b=_['merge']({},_0xa7da6b,_0xda5f2a['options']);var _0x1cc1d5={'where':_0xa7da6b[_0x7fd8('0x38')]};return db[_0x7fd8('0x2b')][_0x7fd8('0x3a')](_0x1cc1d5)[_0x7fd8('0x22')](function(_0x1b8737){_0x544179[_0x7fd8('0x3a')]=_0x1b8737;if(_0xda5f2a['query']['includeAll']){_0xa7da6b['include']=[{'all':!![]}];}return db[_0x7fd8('0x2b')][_0x7fd8('0x3b')](_0xa7da6b);})[_0x7fd8('0x22')](function(_0x558874){_0x544179[_0x7fd8('0x3c')]=_0x558874;return _0x544179;})[_0x7fd8('0x22')](respondWithFilteredResult(_0x40b79b,_0xa7da6b))[_0x7fd8('0x3d')](handleError(_0x40b79b,null));};exports[_0x7fd8('0x3e')]=function(_0x582393,_0x2f480c){var _0x1225ec={'raw':!![],'where':{'id':_0x582393[_0x7fd8('0x3f')]['id']}},_0x5bd31d={};_0x5bd31d['model']=_[_0x7fd8('0x2f')](db[_0x7fd8('0x2b')][_0x7fd8('0x2c')]);_0x5bd31d[_0x7fd8('0x32')]=_['keys'](_0x582393[_0x7fd8('0x32')]);_0x5bd31d[_0x7fd8('0x40')]=_[_0x7fd8('0x31')](_0x5bd31d[_0x7fd8('0x2e')],_0x5bd31d[_0x7fd8('0x32')]);_0x1225ec[_0x7fd8('0x33')]=_['intersection'](_0x5bd31d['model'],qs['fields'](_0x582393[_0x7fd8('0x32')][_0x7fd8('0x34')]));_0x1225ec['attributes']=_0x1225ec['attributes'][_0x7fd8('0x35')]?_0x1225ec[_0x7fd8('0x33')]:_0x5bd31d['model'];if(_0x582393[_0x7fd8('0x32')][_0x7fd8('0x41')]){_0x1225ec[_0x7fd8('0x42')]=[{'all':!![]}];}_0x1225ec=_['merge']({},_0x1225ec,_0x582393[_0x7fd8('0x43')]);return db[_0x7fd8('0x2b')]['find'](_0x1225ec)[_0x7fd8('0x22')](handleEntityNotFound(_0x2f480c,null))['then'](respondWithResult(_0x2f480c,null))[_0x7fd8('0x3d')](handleError(_0x2f480c,null));};exports[_0x7fd8('0x44')]=function(_0xe2c207,_0x43722f){return db[_0x7fd8('0x2b')][_0x7fd8('0x44')](_0xe2c207[_0x7fd8('0x45')],{})[_0x7fd8('0x22')](respondWithResult(_0x43722f,0xc9))['catch'](handleError(_0x43722f,null));};exports[_0x7fd8('0x21')]=function(_0x5ca89e,_0x1f6727){if(_0x5ca89e[_0x7fd8('0x45')]['id']){delete _0x5ca89e['body']['id'];}return db[_0x7fd8('0x2b')][_0x7fd8('0x46')]({'where':{'id':_0x5ca89e['params']['id']}})['then'](handleEntityNotFound(_0x1f6727,null))['then'](saveUpdates(_0x5ca89e[_0x7fd8('0x45')],null))['then'](respondWithResult(_0x1f6727,null))[_0x7fd8('0x3d')](handleError(_0x1f6727,null));};exports[_0x7fd8('0x23')]=function(_0x1690d9,_0x3d9920){return db[_0x7fd8('0x2b')]['find']({'where':{'id':_0x1690d9['params']['id']}})[_0x7fd8('0x22')](handleEntityNotFound(_0x3d9920,null))[_0x7fd8('0x22')](removeEntity(_0x3d9920,null))[_0x7fd8('0x3d')](handleError(_0x3d9920,null));};exports[_0x7fd8('0x47')]=function(_0x5bd26a,_0x31e5a1){return db['JscriptyAnswerReport'][_0x7fd8('0x47')]()[_0x7fd8('0x22')](respondWithResult(_0x31e5a1,null))[_0x7fd8('0x3d')](handleError(_0x31e5a1,null));}; \ No newline at end of file +var _0xbcc7=['mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','save','then','destroy','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','count','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','describe','html-pdf','eml-format','zip-dir','moment'];(function(_0x3f175a,_0x25795f){var _0xdf263d=function(_0x851c9b){while(--_0x851c9b){_0x3f175a['push'](_0x3f175a['shift']());}};_0xdf263d(++_0x25795f);}(_0xbcc7,0x19a));var _0x7bcc=function(_0x39eaa6,_0x360b97){_0x39eaa6=_0x39eaa6-0x0;var _0xdeae9b=_0xbcc7[_0x39eaa6];return _0xdeae9b;};'use strict';var pdf=require(_0x7bcc('0x0'));var emlformat=require(_0x7bcc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7bcc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7bcc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7bcc('0x4'));var util=require(_0x7bcc('0x5'));var path=require('path');var sox=require(_0x7bcc('0x6'));var csv=require(_0x7bcc('0x7'));var ejs=require(_0x7bcc('0x8'));var fs=require('fs');var _=require(_0x7bcc('0x9'));var squel=require(_0x7bcc('0xa'));var crypto=require(_0x7bcc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7bcc('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7bcc('0xd'));var Papa=require(_0x7bcc('0xe'));var Redis=require('ioredis');var authService=require(_0x7bcc('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7bcc('0x10'))(_0x7bcc('0x11'));var utils=require(_0x7bcc('0x12'));var config=require(_0x7bcc('0x13'));var licenseUtil=require(_0x7bcc('0x14'));var db=require(_0x7bcc('0x15'))['db'];function respondWithStatusCode(_0xae46e8,_0x51b0e8){_0x51b0e8=_0x51b0e8||0xcc;return function(_0x3e3580){if(_0x3e3580){return _0xae46e8[_0x7bcc('0x16')](_0x51b0e8);}return _0xae46e8[_0x7bcc('0x17')](_0x51b0e8)[_0x7bcc('0x18')]();};}function respondWithResult(_0x39f912,_0x217896){_0x217896=_0x217896||0xc8;return function(_0x4a2539){if(_0x4a2539){return _0x39f912[_0x7bcc('0x17')](_0x217896)[_0x7bcc('0x19')](_0x4a2539);}};}function respondWithFilteredResult(_0x148618,_0x461ff7){return function(_0x30caa2){if(_0x30caa2){var _0x134d55=_0x30caa2['count'],_0x432960=_0x461ff7[_0x7bcc('0x1a')],_0x49adcd=_0x461ff7[_0x7bcc('0x1a')]+_0x461ff7[_0x7bcc('0x1b')],_0x20105e;if(_0x49adcd>=_0x134d55){_0x49adcd=_0x134d55;_0x20105e=0xc8;}else{_0x20105e=0xce;}_0x148618[_0x7bcc('0x17')](_0x20105e);return _0x148618['set']('Content-Range',_0x432960+'-'+_0x49adcd+'/'+_0x134d55)[_0x7bcc('0x19')](_0x30caa2);}return null;};}function patchUpdates(_0x41e6d3){return function(_0x1a1b7f){try{jsonpatch[_0x7bcc('0x1c')](_0x1a1b7f,_0x41e6d3,!![]);}catch(_0x1df8ad){return BPromise[_0x7bcc('0x1d')](_0x1df8ad);}return _0x1a1b7f[_0x7bcc('0x1e')]();};}function saveUpdates(_0x3d0719,_0x15b2c3){return function(_0x5d3409){if(_0x5d3409){return _0x5d3409['update'](_0x3d0719)[_0x7bcc('0x1f')](function(_0x2848f3){return _0x2848f3;});}return null;};}function removeEntity(_0x34ee2a,_0x3050cf){return function(_0x201f40){if(_0x201f40){return _0x201f40[_0x7bcc('0x20')]()[_0x7bcc('0x1f')](function(){_0x34ee2a[_0x7bcc('0x17')](0xcc)[_0x7bcc('0x18')]();});}};}function handleEntityNotFound(_0x54c611,_0x2d25b8){return function(_0x2b3d01){if(!_0x2b3d01){_0x54c611[_0x7bcc('0x16')](0x194);}return _0x2b3d01;};}function handleError(_0x3875df,_0x247461){_0x247461=_0x247461||0x1f4;return function(_0x1d085c){logger['error'](_0x1d085c['stack']);if(_0x1d085c[_0x7bcc('0x21')]){delete _0x1d085c['name'];}_0x3875df['status'](_0x247461)[_0x7bcc('0x22')](_0x1d085c);};}exports['index']=function(_0x3f79a0,_0xe594c6){var _0x1725e5={},_0x5b919f={},_0x17c3ce={'count':0x0,'rows':[]};var _0x1dea55=_[_0x7bcc('0x23')](db[_0x7bcc('0x24')][_0x7bcc('0x25')],function(_0x1ecf95){return{'name':_0x1ecf95[_0x7bcc('0x26')],'type':_0x1ecf95['type'][_0x7bcc('0x27')]};});_0x5b919f[_0x7bcc('0x28')]=_['map'](_0x1dea55,'name');_0x5b919f[_0x7bcc('0x29')]=_['keys'](_0x3f79a0[_0x7bcc('0x29')]);_0x5b919f[_0x7bcc('0x2a')]=_[_0x7bcc('0x2b')](_0x5b919f[_0x7bcc('0x28')],_0x5b919f['query']);_0x1725e5[_0x7bcc('0x2c')]=_[_0x7bcc('0x2b')](_0x5b919f[_0x7bcc('0x28')],qs['fields'](_0x3f79a0[_0x7bcc('0x29')][_0x7bcc('0x2d')]));_0x1725e5[_0x7bcc('0x2c')]=_0x1725e5[_0x7bcc('0x2c')][_0x7bcc('0x2e')]?_0x1725e5[_0x7bcc('0x2c')]:_0x5b919f[_0x7bcc('0x28')];if(!_0x3f79a0[_0x7bcc('0x29')][_0x7bcc('0x2f')](_0x7bcc('0x30'))){_0x1725e5[_0x7bcc('0x1b')]=qs['limit'](_0x3f79a0[_0x7bcc('0x29')][_0x7bcc('0x1b')]);_0x1725e5[_0x7bcc('0x1a')]=qs['offset'](_0x3f79a0['query'][_0x7bcc('0x1a')]);}_0x1725e5[_0x7bcc('0x31')]=qs[_0x7bcc('0x32')](_0x3f79a0[_0x7bcc('0x29')][_0x7bcc('0x32')]);_0x1725e5[_0x7bcc('0x33')]=qs[_0x7bcc('0x2a')](_['pick'](_0x3f79a0['query'],_0x5b919f['filters']),_0x1dea55);if(_0x3f79a0['query'][_0x7bcc('0x34')]){_0x1725e5[_0x7bcc('0x33')]=_[_0x7bcc('0x35')](_0x1725e5['where'],{'$or':_[_0x7bcc('0x23')](_0x1dea55,function(_0x1a7ba2){if(_0x1a7ba2[_0x7bcc('0x36')]!=='VIRTUAL'){var _0x5cc11b={};_0x5cc11b[_0x1a7ba2[_0x7bcc('0x21')]]={'$like':'%'+_0x3f79a0[_0x7bcc('0x29')][_0x7bcc('0x34')]+'%'};return _0x5cc11b;}})});}_0x1725e5=_['merge']({},_0x1725e5,_0x3f79a0['options']);var _0x44a71e={'where':_0x1725e5[_0x7bcc('0x33')]};return db[_0x7bcc('0x24')]['count'](_0x44a71e)[_0x7bcc('0x1f')](function(_0x3f3357){_0x17c3ce[_0x7bcc('0x37')]=_0x3f3357;if(_0x3f79a0[_0x7bcc('0x29')][_0x7bcc('0x38')]){_0x1725e5[_0x7bcc('0x39')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x7bcc('0x3a')](_0x1725e5);})[_0x7bcc('0x1f')](function(_0x4ac44b){_0x17c3ce[_0x7bcc('0x3b')]=_0x4ac44b;return _0x17c3ce;})[_0x7bcc('0x1f')](respondWithFilteredResult(_0xe594c6,_0x1725e5))[_0x7bcc('0x3c')](handleError(_0xe594c6,null));};exports[_0x7bcc('0x3d')]=function(_0x467f92,_0x1b4d75){var _0x632cff={'raw':!![],'where':{'id':_0x467f92['params']['id']}},_0xeaeac5={};_0xeaeac5[_0x7bcc('0x28')]=_[_0x7bcc('0x3e')](db[_0x7bcc('0x24')][_0x7bcc('0x25')]);_0xeaeac5[_0x7bcc('0x29')]=_[_0x7bcc('0x3e')](_0x467f92['query']);_0xeaeac5['filtears']=_[_0x7bcc('0x2b')](_0xeaeac5[_0x7bcc('0x28')],_0xeaeac5['query']);_0x632cff[_0x7bcc('0x2c')]=_[_0x7bcc('0x2b')](_0xeaeac5[_0x7bcc('0x28')],qs[_0x7bcc('0x2d')](_0x467f92[_0x7bcc('0x29')][_0x7bcc('0x2d')]));_0x632cff[_0x7bcc('0x2c')]=_0x632cff['attributes'][_0x7bcc('0x2e')]?_0x632cff[_0x7bcc('0x2c')]:_0xeaeac5[_0x7bcc('0x28')];if(_0x467f92[_0x7bcc('0x29')][_0x7bcc('0x38')]){_0x632cff['include']=[{'all':!![]}];}_0x632cff=_[_0x7bcc('0x35')]({},_0x632cff,_0x467f92[_0x7bcc('0x3f')]);return db['JscriptyAnswerReport'][_0x7bcc('0x40')](_0x632cff)[_0x7bcc('0x1f')](handleEntityNotFound(_0x1b4d75,null))[_0x7bcc('0x1f')](respondWithResult(_0x1b4d75,null))['catch'](handleError(_0x1b4d75,null));};exports[_0x7bcc('0x41')]=function(_0x2ec005,_0x4d5a4d){return db[_0x7bcc('0x24')][_0x7bcc('0x41')](_0x2ec005[_0x7bcc('0x42')],{})[_0x7bcc('0x1f')](respondWithResult(_0x4d5a4d,0xc9))[_0x7bcc('0x3c')](handleError(_0x4d5a4d,null));};exports['update']=function(_0x2c552b,_0x152369){if(_0x2c552b['body']['id']){delete _0x2c552b[_0x7bcc('0x42')]['id'];}return db['JscriptyAnswerReport'][_0x7bcc('0x40')]({'where':{'id':_0x2c552b['params']['id']}})[_0x7bcc('0x1f')](handleEntityNotFound(_0x152369,null))['then'](saveUpdates(_0x2c552b['body'],null))[_0x7bcc('0x1f')](respondWithResult(_0x152369,null))[_0x7bcc('0x3c')](handleError(_0x152369,null));};exports[_0x7bcc('0x20')]=function(_0x16e40d,_0x268cf1){return db[_0x7bcc('0x24')][_0x7bcc('0x40')]({'where':{'id':_0x16e40d[_0x7bcc('0x43')]['id']}})[_0x7bcc('0x1f')](handleEntityNotFound(_0x268cf1,null))[_0x7bcc('0x1f')](removeEntity(_0x268cf1,null))[_0x7bcc('0x3c')](handleError(_0x268cf1,null));};exports[_0x7bcc('0x44')]=function(_0x3d5405,_0x3eb865){return db[_0x7bcc('0x24')]['describe']()[_0x7bcc('0x1f')](respondWithResult(_0x3eb865,null))[_0x7bcc('0x3c')](handleError(_0x3eb865,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index ad43950..5adeb7b 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 _0x11d0=['path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0xc479fd,_0x55cbec){var _0x165dd8=function(_0x5d8112){while(--_0x5d8112){_0xc479fd['push'](_0xc479fd['shift']());}};_0x165dd8(++_0x55cbec);}(_0x11d0,0x126));var _0x011d=function(_0x1228ba,_0x160075){_0x1228ba=_0x1228ba-0x0;var _0x5b05db=_0x11d0[_0x1228ba];return _0x5b05db;};'use strict';var _=require(_0x011d('0x0'));var util=require(_0x011d('0x1'));var logger=require(_0x011d('0x2'))(_0x011d('0x3'));var moment=require(_0x011d('0x4'));var BPromise=require('bluebird');var rp=require(_0x011d('0x5'));var fs=require('fs');var path=require(_0x011d('0x6'));var rimraf=require(_0x011d('0x7'));var config=require(_0x011d('0x8'));var attributes=require(_0x011d('0x9'));module['exports']=function(_0x354763,_0x5650c9){return _0x354763[_0x011d('0xa')](_0x011d('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1690=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','JscriptyAnswerReport','report_jscripty_answers'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x1690,0x108));var _0x0169=function(_0x3a2a74,_0x3b4775){_0x3a2a74=_0x3a2a74-0x0;var _0x5a2c55=_0x1690[_0x3a2a74];return _0x5a2c55;};'use strict';var _=require(_0x0169('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0169('0x1'));var moment=require(_0x0169('0x2'));var BPromise=require(_0x0169('0x3'));var rp=require(_0x0169('0x4'));var fs=require('fs');var path=require(_0x0169('0x5'));var rimraf=require('rimraf');var config=require(_0x0169('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x0169('0x7')]=function(_0x4d3655,_0x1d97f4){return _0x4d3655[_0x0169('0x8')](_0x0169('0x9'),attributes,{'tableName':_0x0169('0xa'),'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 b7037cb..43bdd22 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 _0x0b70=['bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','JscriptyAnswerReport,\x20%s,\x20%s','lodash'];(function(_0x32c8cb,_0x4f2a46){var _0x49d671=function(_0x185988){while(--_0x185988){_0x32c8cb['push'](_0x32c8cb['shift']());}};_0x49d671(++_0x4f2a46);}(_0x0b70,0xe0));var _0x00b7=function(_0x4e6f90,_0x44c6a3){_0x4e6f90=_0x4e6f90-0x0;var _0x3a3b2b=_0x0b70[_0x4e6f90];return _0x3a3b2b;};'use strict';var _=require(_0x00b7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x00b7('0x1'));var rs=require(_0x00b7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x00b7('0x3'))['db'];var utils=require(_0x00b7('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x00b7('0x5'));var client=jayson['client'][_0x00b7('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1d3505,_0x9fa814,_0x5c74fd){return new BPromise(function(_0x55f234,_0xe746fe){return client['request'](_0x1d3505,_0x5c74fd)[_0x00b7('0x7')](function(_0x45df2d){logger[_0x00b7('0x8')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x9fa814,'request\x20sent');logger['debug'](_0x00b7('0x9'),_0x9fa814,_0x00b7('0xa'),JSON['stringify'](_0x45df2d));if(_0x45df2d['error']){if(_0x45df2d[_0x00b7('0xb')][_0x00b7('0xc')]===0x1f4){logger[_0x00b7('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x9fa814,_0x45df2d[_0x00b7('0xb')][_0x00b7('0xd')]);return _0xe746fe(_0x45df2d[_0x00b7('0xb')][_0x00b7('0xd')]);}logger[_0x00b7('0xb')](_0x00b7('0xe'),_0x9fa814,_0x45df2d['error'][_0x00b7('0xd')]);return _0x55f234(_0x45df2d['error'][_0x00b7('0xd')]);}else{logger['info'](_0x00b7('0xe'),_0x9fa814,_0x00b7('0xa'));_0x55f234(_0x45df2d['result'][_0x00b7('0xd')]);}})['catch'](function(_0x6b3383){logger['error'](_0x00b7('0xe'),_0x9fa814,_0x6b3383);_0xe746fe(_0x6b3383);});});} \ No newline at end of file +var _0x75e5=['then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request'];(function(_0x54b568,_0x393b4d){var _0x25087b=function(_0x42126f){while(--_0x42126f){_0x54b568['push'](_0x54b568['shift']());}};_0x25087b(++_0x393b4d);}(_0x75e5,0x1c2));var _0x575e=function(_0x5a3d95,_0x16bee6){_0x5a3d95=_0x5a3d95-0x0;var _0x2928e9=_0x75e5[_0x5a3d95];return _0x2928e9;};'use strict';var _=require(_0x575e('0x0'));var util=require(_0x575e('0x1'));var moment=require(_0x575e('0x2'));var BPromise=require(_0x575e('0x3'));var rs=require(_0x575e('0x4'));var fs=require('fs');var Redis=require(_0x575e('0x5'));var db=require(_0x575e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x575e('0x7'))(_0x575e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x575e('0x9')][_0x575e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd1f31a,_0x360c9a,_0x146416){return new BPromise(function(_0x531c28,_0x228f7e){return client[_0x575e('0xb')](_0xd1f31a,_0x146416)[_0x575e('0xc')](function(_0x50608c){logger[_0x575e('0xd')](_0x575e('0xe'),_0x360c9a,_0x575e('0xf'));logger[_0x575e('0x10')](_0x575e('0x11'),_0x360c9a,'request\x20sent',JSON[_0x575e('0x12')](_0x50608c));if(_0x50608c['error']){if(_0x50608c[_0x575e('0x13')]['code']===0x1f4){logger[_0x575e('0x13')](_0x575e('0xe'),_0x360c9a,_0x50608c[_0x575e('0x13')]['message']);return _0x228f7e(_0x50608c[_0x575e('0x13')][_0x575e('0x14')]);}logger[_0x575e('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x360c9a,_0x50608c[_0x575e('0x13')]['message']);return _0x531c28(_0x50608c[_0x575e('0x13')][_0x575e('0x14')]);}else{logger[_0x575e('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x360c9a,_0x575e('0xf'));_0x531c28(_0x50608c[_0x575e('0x15')][_0x575e('0x14')]);}})['catch'](function(_0x3086f1){logger[_0x575e('0x13')](_0x575e('0xe'),_0x360c9a,_0x3086f1);_0x228f7e(_0x3086f1);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 4f23797..50bb52a 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 _0x9561=['clone','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','index','isAuthenticated','show','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone'];(function(_0x295a3d,_0x56d487){var _0x23a732=function(_0x15cfc2){while(--_0x15cfc2){_0x295a3d['push'](_0x295a3d['shift']());}};_0x23a732(++_0x56d487);}(_0x9561,0x17f));var _0x1956=function(_0x28de75,_0x103055){_0x28de75=_0x28de75-0x0;var _0xa1b275=_0x9561[_0x28de75];return _0xa1b275;};'use strict';var multer=require(_0x1956('0x0'));var util=require(_0x1956('0x1'));var path=require(_0x1956('0x2'));var timeout=require(_0x1956('0x3'));var express=require(_0x1956('0x4'));var router=express[_0x1956('0x5')]();var auth=require(_0x1956('0x6'));var interaction=require(_0x1956('0x7'));var config=require('../../config/environment');var controller=require(_0x1956('0x8'));router[_0x1956('0x9')]('/',auth['isAuthenticated'](),controller[_0x1956('0xa')]);router[_0x1956('0x9')]('/:id',auth[_0x1956('0xb')](),controller[_0x1956('0xc')]);router['get']('/:id/sessions',auth[_0x1956('0xb')](),controller[_0x1956('0xd')]);router[_0x1956('0x9')](_0x1956('0xe'),auth[_0x1956('0xb')](),controller[_0x1956('0xf')]);router['get'](_0x1956('0x10'),auth[_0x1956('0xb')](),timeout(_0x1956('0x11')),controller[_0x1956('0x12')]);router[_0x1956('0x13')]('/',auth['isAuthenticated'](),controller[_0x1956('0x14')]);router[_0x1956('0x13')](_0x1956('0x15'),auth[_0x1956('0xb')](),controller[_0x1956('0x16')]);router[_0x1956('0x17')](_0x1956('0x18'),auth[_0x1956('0xb')](),controller[_0x1956('0x19')]);router['delete'](_0x1956('0x18'),auth[_0x1956('0xb')](),controller[_0x1956('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xc669=['get','isAuthenticated','index','/:id','show','getSessions','/:id/answers','getAnswers','30s','getSummary','post','create','/:id/clone','clone','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller'];(function(_0x476088,_0x4fba11){var _0x185c43=function(_0x1c5965){while(--_0x1c5965){_0x476088['push'](_0x476088['shift']());}};_0x185c43(++_0x4fba11);}(_0xc669,0xcf));var _0x9c66=function(_0x36b9dd,_0x506f6a){_0x36b9dd=_0x36b9dd-0x0;var _0x5e3144=_0xc669[_0x36b9dd];return _0x5e3144;};'use strict';var multer=require('multer');var util=require(_0x9c66('0x0'));var path=require(_0x9c66('0x1'));var timeout=require(_0x9c66('0x2'));var express=require(_0x9c66('0x3'));var router=express[_0x9c66('0x4')]();var auth=require(_0x9c66('0x5'));var interaction=require(_0x9c66('0x6'));var config=require(_0x9c66('0x7'));var controller=require(_0x9c66('0x8'));router[_0x9c66('0x9')]('/',auth[_0x9c66('0xa')](),controller[_0x9c66('0xb')]);router[_0x9c66('0x9')](_0x9c66('0xc'),auth[_0x9c66('0xa')](),controller[_0x9c66('0xd')]);router[_0x9c66('0x9')]('/:id/sessions',auth['isAuthenticated'](),controller[_0x9c66('0xe')]);router[_0x9c66('0x9')](_0x9c66('0xf'),auth[_0x9c66('0xa')](),controller[_0x9c66('0x10')]);router[_0x9c66('0x9')]('/:id/summary',auth[_0x9c66('0xa')](),timeout(_0x9c66('0x11')),controller[_0x9c66('0x12')]);router[_0x9c66('0x13')]('/',auth['isAuthenticated'](),controller[_0x9c66('0x14')]);router[_0x9c66('0x13')](_0x9c66('0x15'),auth[_0x9c66('0xa')](),controller[_0x9c66('0x16')]);router[_0x9c66('0x17')]('/:id',auth[_0x9c66('0xa')](),controller[_0x9c66('0x18')]);router['delete']('/:id',auth[_0x9c66('0xa')](),controller[_0x9c66('0x19')]);module[_0x9c66('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 b81a2f0..0f81171 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 _0xb480=['formData','format','getDataValue','description','BOOLEAN','util','STRING','name','long','isObjectLike','setDataValue','stringify','isString'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb480,0xbb));var _0x0b48=function(_0x50a0d3,_0x10f307){_0x50a0d3=_0x50a0d3-0x0;var _0x34e5f0=_0xb480[_0x50a0d3];return _0x34e5f0;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0x0b48('0x0'));module['exports']={'name':{'type':Sequelize[_0x0b48('0x1')],'unique':_0x0b48('0x2')},'description':{'type':Sequelize[_0x0b48('0x1')]},'formData':{'type':Sequelize['TEXT'](_0x0b48('0x3')),'set':function(_0x5dd23e){if(_[_0x0b48('0x4')](_0x5dd23e)){this[_0x0b48('0x5')]('formData',JSON[_0x0b48('0x6')](_0x5dd23e));}else if(_[_0x0b48('0x7')](_0x5dd23e)){this[_0x0b48('0x5')](_0x0b48('0x8'),_0x5dd23e);}else{this[_0x0b48('0x5')](_0x0b48('0x8'),util[_0x0b48('0x9')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x0b48('0xa')]('name')||'',this[_0x0b48('0xa')](_0x0b48('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x0b48('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x0b48('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0x1328=['isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','util','STRING','name','TEXT','long','setDataValue','stringify'];(function(_0x5f3e67,_0x402bf9){var _0x595286=function(_0xc60c6f){while(--_0xc60c6f){_0x5f3e67['push'](_0x5f3e67['shift']());}};_0x595286(++_0x402bf9);}(_0x1328,0x1e7));var _0x8132=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0x1328[_0xbc4560];return _0x298cfb;};'use strict';var Sequelize=require(_0x8132('0x0'));var _=require('lodash');var util=require(_0x8132('0x1'));module['exports']={'name':{'type':Sequelize[_0x8132('0x2')],'unique':_0x8132('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x8132('0x4')](_0x8132('0x5')),'set':function(_0x361229){if(_['isObjectLike'](_0x361229)){this[_0x8132('0x6')]('formData',JSON[_0x8132('0x7')](_0x361229));}else if(_[_0x8132('0x8')](_0x361229)){this[_0x8132('0x6')](_0x8132('0x9'),_0x361229);}else{this['setDataValue'](_0x8132('0x9'),util[_0x8132('0xa')](_0x8132('0xb'),this[_0x8132('0xc')](_0x8132('0x3'))||'',this[_0x8132('0xc')](_0x8132('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x8132('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x8132('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index eaefab6..ada85a2 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 _0xd48f=['now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','get','Projects','UserProfileResource','error','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','map','type','name','options','JscriptyProject','includeAll','include','findAll','show','params','keys','filtears','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','destroy','getSessions','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','filter','rows','getAnswers','JscriptyAnswerReport','order','fromCharCode','toString','indexOf','replace','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty'];(function(_0x26214c,_0x9fa0fa){var _0x4a20ab=function(_0x20f46b){while(--_0x20f46b){_0x26214c['push'](_0x26214c['shift']());}};_0x4a20ab(++_0x9fa0fa);}(_0xd48f,0xf6));var _0xfd48=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xd48f[_0x2b9b7f];return _0x4ed19a;};'use strict';var pdf=require(_0xfd48('0x0'));var emlformat=require(_0xfd48('0x1'));var rimraf=require(_0xfd48('0x2'));var zipdir=require(_0xfd48('0x3'));var jsonpatch=require(_0xfd48('0x4'));var rp=require(_0xfd48('0x5'));var moment=require(_0xfd48('0x6'));var BPromise=require(_0xfd48('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfd48('0x8'));var sox=require(_0xfd48('0x9'));var csv=require(_0xfd48('0xa'));var ejs=require(_0xfd48('0xb'));var fs=require('fs');var _=require(_0xfd48('0xc'));var squel=require('squel');var crypto=require(_0xfd48('0xd'));var jsforce=require(_0xfd48('0xe'));var deskjs=require(_0xfd48('0xf'));var toCsv=require(_0xfd48('0xa'));var querystring=require(_0xfd48('0x10'));var Papa=require(_0xfd48('0x11'));var Redis=require(_0xfd48('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfd48('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfd48('0x14'));var utils=require(_0xfd48('0x15'));var config=require(_0xfd48('0x16'));var licenseUtil=require(_0xfd48('0x17'));var db=require(_0xfd48('0x18'))['db'];function respondWithStatusCode(_0x3e5415,_0x5c63c9){_0x5c63c9=_0x5c63c9||0xcc;return function(_0x4f1a91){if(_0x4f1a91){return _0x3e5415[_0xfd48('0x19')](_0x5c63c9);}return _0x3e5415[_0xfd48('0x1a')](_0x5c63c9)[_0xfd48('0x1b')]();};}function respondWithResult(_0x37633e,_0x9e0662){_0x9e0662=_0x9e0662||0xc8;return function(_0x8edf39){if(_0x8edf39){return _0x37633e[_0xfd48('0x1a')](_0x9e0662)[_0xfd48('0x1c')](_0x8edf39);}};}function respondWithFilteredResult(_0x5713a0,_0x41ff64){return function(_0x451011){if(_0x451011){var _0x4a65cf=_0x451011[_0xfd48('0x1d')],_0xb6f70e=_0x41ff64[_0xfd48('0x1e')],_0x3f4c81=_0x41ff64[_0xfd48('0x1e')]+_0x41ff64[_0xfd48('0x1f')],_0x2d7837;if(_0x3f4c81>=_0x4a65cf){_0x3f4c81=_0x4a65cf;_0x2d7837=0xc8;}else{_0x2d7837=0xce;}_0x5713a0[_0xfd48('0x1a')](_0x2d7837);return _0x5713a0[_0xfd48('0x20')]('Content-Range',_0xb6f70e+'-'+_0x3f4c81+'/'+_0x4a65cf)[_0xfd48('0x1c')](_0x451011);}return null;};}function patchUpdates(_0x179ca6){return function(_0x5db83e){try{jsonpatch[_0xfd48('0x21')](_0x5db83e,_0x179ca6,!![]);}catch(_0xe687e7){return BPromise['reject'](_0xe687e7);}return _0x5db83e[_0xfd48('0x22')]();};}function saveUpdates(_0x5e3993,_0x4aa738){return function(_0x1e2910){if(_0x1e2910){return _0x1e2910[_0xfd48('0x23')](_0x5e3993)[_0xfd48('0x24')](function(_0x5e21b4){return _0x5e21b4;});}return null;};}function removeEntity(_0x4c7765,_0x4fd797){return function(_0x4af7ac){if(_0x4af7ac){return _0x4af7ac['destroy']()[_0xfd48('0x24')](function(){var _0xc364c8=_0x4af7ac[_0xfd48('0x25')]({'plain':!![]});var _0x21cc26=_0xfd48('0x26');return db[_0xfd48('0x27')]['destroy']({'where':{'type':_0x21cc26,'resourceId':_0xc364c8['id']}})[_0xfd48('0x24')](function(){return _0x4af7ac;});})[_0xfd48('0x24')](function(){_0x4c7765[_0xfd48('0x1a')](0xcc)[_0xfd48('0x1b')]();});}};}function handleEntityNotFound(_0x5c6200,_0x1f296b){return function(_0x57b71d){if(!_0x57b71d){_0x5c6200[_0xfd48('0x19')](0x194);}return _0x57b71d;};}function handleError(_0x5e6082,_0xdce34d){_0xdce34d=_0xdce34d||0x1f4;return function(_0xbed89f){logger[_0xfd48('0x28')](_0xbed89f['stack']);if(_0xbed89f['name']){delete _0xbed89f['name'];}_0x5e6082[_0xfd48('0x1a')](_0xdce34d)['send'](_0xbed89f);};}exports[_0xfd48('0x29')]=function(_0xee9cbf,_0x439ca7){var _0x244594={},_0x39dacd={},_0x3bce78={'count':0x0,'rows':[]};var _0x1abc05=_['map'](db['JscriptyProject'][_0xfd48('0x2a')],function(_0x1e59e1){return{'name':_0x1e59e1[_0xfd48('0x2b')],'type':_0x1e59e1['type'][_0xfd48('0x2c')]};});_0x39dacd[_0xfd48('0x2d')]=_['map'](_0x1abc05,'name');_0x39dacd[_0xfd48('0x2e')]=_['keys'](_0xee9cbf[_0xfd48('0x2e')]);_0x39dacd[_0xfd48('0x2f')]=_[_0xfd48('0x30')](_0x39dacd[_0xfd48('0x2d')],_0x39dacd[_0xfd48('0x2e')]);_0x244594[_0xfd48('0x31')]=_[_0xfd48('0x30')](_0x39dacd[_0xfd48('0x2d')],qs[_0xfd48('0x32')](_0xee9cbf[_0xfd48('0x2e')][_0xfd48('0x32')]));_0x244594['attributes']=_0x244594['attributes'][_0xfd48('0x33')]?_0x244594[_0xfd48('0x31')]:_0x39dacd[_0xfd48('0x2d')];if(!_0xee9cbf[_0xfd48('0x2e')]['hasOwnProperty'](_0xfd48('0x34'))){_0x244594[_0xfd48('0x1f')]=qs['limit'](_0xee9cbf['query'][_0xfd48('0x1f')]);_0x244594['offset']=qs[_0xfd48('0x1e')](_0xee9cbf[_0xfd48('0x2e')][_0xfd48('0x1e')]);}_0x244594['order']=qs['sort'](_0xee9cbf[_0xfd48('0x2e')][_0xfd48('0x35')]);_0x244594[_0xfd48('0x36')]=qs[_0xfd48('0x2f')](_[_0xfd48('0x37')](_0xee9cbf[_0xfd48('0x2e')],_0x39dacd[_0xfd48('0x2f')]),_0x1abc05);if(_0xee9cbf[_0xfd48('0x2e')]['filter']){_0x244594[_0xfd48('0x36')]=_[_0xfd48('0x38')](_0x244594[_0xfd48('0x36')],{'$or':_[_0xfd48('0x39')](_0x1abc05,function(_0x2f5c7c){if(_0x2f5c7c[_0xfd48('0x3a')]!=='VIRTUAL'){var _0x32b64c={};_0x32b64c[_0x2f5c7c[_0xfd48('0x3b')]]={'$like':'%'+_0xee9cbf[_0xfd48('0x2e')]['filter']+'%'};return _0x32b64c;}})});}_0x244594=_[_0xfd48('0x38')]({},_0x244594,_0xee9cbf[_0xfd48('0x3c')]);var _0x253cc6={'where':_0x244594[_0xfd48('0x36')]};return db[_0xfd48('0x3d')][_0xfd48('0x1d')](_0x253cc6)[_0xfd48('0x24')](function(_0x64e89){_0x3bce78[_0xfd48('0x1d')]=_0x64e89;if(_0xee9cbf[_0xfd48('0x2e')][_0xfd48('0x3e')]){_0x244594[_0xfd48('0x3f')]=[{'all':!![]}];}return db[_0xfd48('0x3d')][_0xfd48('0x40')](_0x244594);})[_0xfd48('0x24')](function(_0xff650){_0x3bce78['rows']=_0xff650;return _0x3bce78;})[_0xfd48('0x24')](respondWithFilteredResult(_0x439ca7,_0x244594))['catch'](handleError(_0x439ca7,null));};exports[_0xfd48('0x41')]=function(_0x12ad24,_0x3c8fdc){var _0x6364d2={'raw':![],'where':{'id':_0x12ad24[_0xfd48('0x42')]['id']}},_0x7f225a={};_0x7f225a['model']=_['keys'](db['JscriptyProject']['rawAttributes']);_0x7f225a[_0xfd48('0x2e')]=_[_0xfd48('0x43')](_0x12ad24[_0xfd48('0x2e')]);_0x7f225a[_0xfd48('0x44')]=_['intersection'](_0x7f225a[_0xfd48('0x2d')],_0x7f225a[_0xfd48('0x2e')]);_0x6364d2[_0xfd48('0x31')]=_[_0xfd48('0x30')](_0x7f225a['model'],qs['fields'](_0x12ad24[_0xfd48('0x2e')]['fields']));_0x6364d2['attributes']=_0x6364d2[_0xfd48('0x31')][_0xfd48('0x33')]?_0x6364d2['attributes']:_0x7f225a[_0xfd48('0x2d')];if(_0x12ad24['query'][_0xfd48('0x3e')]){_0x6364d2[_0xfd48('0x3f')]=[{'all':!![]}];}_0x6364d2=_[_0xfd48('0x38')]({},_0x6364d2,_0x12ad24[_0xfd48('0x3c')]);return db[_0xfd48('0x3d')][_0xfd48('0x45')](_0x6364d2)[_0xfd48('0x24')](handleEntityNotFound(_0x3c8fdc,null))['then'](respondWithResult(_0x3c8fdc,null))[_0xfd48('0x46')](handleError(_0x3c8fdc,null));};exports[_0xfd48('0x47')]=function(_0x1435eb,_0x572bf3){return db[_0xfd48('0x3d')]['create'](_0x1435eb[_0xfd48('0x48')],{})[_0xfd48('0x24')](function(_0x38efa1){var _0x88e99c=_0x1435eb[_0xfd48('0x49')][_0xfd48('0x25')]({'plain':!![]});if(!_0x88e99c)throw new Error(_0xfd48('0x4a'));if(_0x88e99c[_0xfd48('0x4b')]==='user'){var _0x1534ec=_0x38efa1[_0xfd48('0x25')]({'plain':!![]});var _0x29fd4d=_0xfd48('0x26');return db[_0xfd48('0x4c')][_0xfd48('0x45')]({'where':{'name':_0x29fd4d,'userProfileId':_0x88e99c[_0xfd48('0x4d')]},'raw':!![]})['then'](function(_0xfe18e2){if(_0xfe18e2&&_0xfe18e2[_0xfd48('0x4e')]===0x0){return db[_0xfd48('0x27')][_0xfd48('0x47')]({'name':_0x1534ec['name'],'resourceId':_0x1534ec['id'],'type':_0xfe18e2['name'],'sectionId':_0xfe18e2['id']},{})['then'](function(){return _0x38efa1;});}else{return _0x38efa1;}})[_0xfd48('0x46')](function(_0x10c693){logger['error'](_0xfd48('0x4f'),_0x10c693);throw _0x10c693;});}return _0x38efa1;})['then'](respondWithResult(_0x572bf3,0xc9))['catch'](handleError(_0x572bf3,null));};exports[_0xfd48('0x50')]=function(_0x25359e,_0x4af05a){var _0x5aa4c7={'where':{'id':_0x25359e[_0xfd48('0x42')]['id']}},_0x30366f={};_0x30366f[_0xfd48('0x2d')]=_[_0xfd48('0x43')](db[_0xfd48('0x3d')][_0xfd48('0x2a')]);_0x5aa4c7[_0xfd48('0x31')]=_[_0xfd48('0x30')](_0x30366f[_0xfd48('0x2d')],qs[_0xfd48('0x32')](_0x25359e['query'][_0xfd48('0x32')]));_0x5aa4c7[_0xfd48('0x31')]=_0x5aa4c7[_0xfd48('0x31')]['length']?_0x5aa4c7[_0xfd48('0x31')]:_0x30366f[_0xfd48('0x2d')];if(_0x25359e['query']['includeAll']){_0x5aa4c7[_0xfd48('0x3f')]=[{'all':!![]}];}_0x5aa4c7=_[_0xfd48('0x38')]({},_0x5aa4c7,_0x25359e[_0xfd48('0x3c')]);return db[_0xfd48('0x3d')]['find'](_0x5aa4c7)[_0xfd48('0x24')](handleEntityNotFound(_0x4af05a,null))[_0xfd48('0x24')](function(_0xba05bd){if(_0xba05bd){var _0x194b36=_0xba05bd[_0xfd48('0x25')]({'plain':!![]});_0x194b36=qs['omit'](_0x194b36,['id',_0xfd48('0x51'),_0xfd48('0x52')]);_0x25359e[_0xfd48('0x48')]=_[_0xfd48('0x53')](_0x25359e[_0xfd48('0x48')],['id',_0xfd48('0x51'),_0xfd48('0x52')]);return db[_0xfd48('0x3d')]['create'](_['merge'](_0x194b36,_0x25359e[_0xfd48('0x48')]),{'include':_0x25359e[_0xfd48('0x2e')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x1460ab){var _0x317b93=_0x25359e[_0xfd48('0x49')]['get']({'plain':!![]});if(!_0x317b93)throw new Error(_0xfd48('0x4a'));if(_0x317b93[_0xfd48('0x4b')]===_0xfd48('0x49')){var _0x4cfbfc=_0x1460ab[_0xfd48('0x25')]({'plain':!![]});var _0x204352=_0xfd48('0x26');return db[_0xfd48('0x4c')][_0xfd48('0x45')]({'where':{'name':_0x204352,'userProfileId':_0x317b93[_0xfd48('0x4d')]},'raw':!![]})[_0xfd48('0x24')](function(_0x292e44){if(_0x292e44&&_0x292e44[_0xfd48('0x4e')]===0x0){return db['UserProfileResource'][_0xfd48('0x47')]({'name':_0x4cfbfc[_0xfd48('0x3b')],'resourceId':_0x4cfbfc['id'],'type':_0x292e44[_0xfd48('0x3b')],'sectionId':_0x292e44['id']},{})[_0xfd48('0x24')](function(){return _0x1460ab;});}else{return _0x1460ab;}})[_0xfd48('0x46')](function(_0xef81f1){logger[_0xfd48('0x28')](_0xfd48('0x4f'),_0xef81f1);throw _0xef81f1;});}return _0x1460ab;});}})[_0xfd48('0x24')](respondWithResult(_0x4af05a,0xc9))[_0xfd48('0x46')](handleError(_0x4af05a,null));};exports[_0xfd48('0x23')]=function(_0x18b3be,_0xe76bde){if(_0x18b3be['body']['id']){delete _0x18b3be[_0xfd48('0x48')]['id'];}return db['JscriptyProject'][_0xfd48('0x45')]({'where':{'id':_0x18b3be[_0xfd48('0x42')]['id']}})[_0xfd48('0x24')](handleEntityNotFound(_0xe76bde,null))[_0xfd48('0x24')](saveUpdates(_0x18b3be[_0xfd48('0x48')],null))[_0xfd48('0x24')](respondWithResult(_0xe76bde,null))[_0xfd48('0x46')](handleError(_0xe76bde,null));};exports[_0xfd48('0x54')]=function(_0x5998ff,_0x32abcd){return db['JscriptyProject'][_0xfd48('0x45')]({'where':{'id':_0x5998ff[_0xfd48('0x42')]['id']}})[_0xfd48('0x24')](handleEntityNotFound(_0x32abcd,null))['then'](removeEntity(_0x32abcd,null))[_0xfd48('0x46')](handleError(_0x32abcd,null));};exports[_0xfd48('0x55')]=function(_0x5b5819,_0x5bc2c6,_0x119de2){var _0x2e4bce={'raw':!![],'where':{}};var _0x1709ab={};var _0x493a08={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xfd48('0x56')]({'where':{'id':_0x5b5819['params']['id']}})[_0xfd48('0x24')](handleEntityNotFound(_0x5bc2c6,null))[_0xfd48('0x24')](function(_0x2fc38a){if(_0x2fc38a){_0x1709ab['model']=_[_0xfd48('0x43')](db[_0xfd48('0x57')][_0xfd48('0x2a')]);_0x1709ab['query']=_[_0xfd48('0x43')](_0x5b5819['query']);_0x1709ab[_0xfd48('0x2f')]=_[_0xfd48('0x30')](_0x1709ab['model'],_0x1709ab[_0xfd48('0x2e')]);_0x2e4bce[_0xfd48('0x31')]=_[_0xfd48('0x30')](_0x1709ab['model'],qs['fields'](_0x5b5819['query'][_0xfd48('0x32')]));_0x2e4bce[_0xfd48('0x31')]=_0x2e4bce[_0xfd48('0x31')][_0xfd48('0x33')]?_0x2e4bce[_0xfd48('0x31')]:_0x1709ab[_0xfd48('0x2d')];if(!_0x5b5819[_0xfd48('0x2e')][_0xfd48('0x58')](_0xfd48('0x34'))){_0x2e4bce[_0xfd48('0x1f')]=qs['limit'](_0x5b5819[_0xfd48('0x2e')][_0xfd48('0x1f')]);_0x2e4bce[_0xfd48('0x1e')]=qs[_0xfd48('0x1e')](_0x5b5819[_0xfd48('0x2e')][_0xfd48('0x1e')]);}_0x2e4bce['order']=qs[_0xfd48('0x35')](_0x5b5819[_0xfd48('0x2e')]['sort']);_0x2e4bce[_0xfd48('0x36')]=qs[_0xfd48('0x2f')](_[_0xfd48('0x37')](_0x5b5819[_0xfd48('0x2e')],_0x1709ab[_0xfd48('0x2f')]));_0x2e4bce[_0xfd48('0x36')][_0xfd48('0x59')]=_0x2fc38a['id'];if(_0x5b5819['query'][_0xfd48('0x5a')]){_0x2e4bce[_0xfd48('0x36')]=_[_0xfd48('0x38')](_0x2e4bce[_0xfd48('0x36')],{'$or':_['map'](_0x2e4bce[_0xfd48('0x31')],function(_0x469460){var _0xdfd0ea={};_0xdfd0ea[_0x469460]={'$like':'%'+_0x5b5819['query'][_0xfd48('0x5a')]+'%'};return _0xdfd0ea;})});}_0x2e4bce=_[_0xfd48('0x38')]({},_0x2e4bce,_0x5b5819[_0xfd48('0x3c')]);return db[_0xfd48('0x57')][_0xfd48('0x1d')]({'where':_0x2e4bce[_0xfd48('0x36')]})[_0xfd48('0x24')](function(_0x267184){_0x493a08[_0xfd48('0x1d')]=_0x267184;if(_0x5b5819[_0xfd48('0x2e')][_0xfd48('0x3e')]){_0x2e4bce[_0xfd48('0x3f')]=[{'all':!![]}];}return db[_0xfd48('0x57')][_0xfd48('0x40')](_0x2e4bce);})['then'](function(_0xeb0382){_0x493a08[_0xfd48('0x5b')]=_0xeb0382;return _0x493a08;});}})[_0xfd48('0x24')](respondWithFilteredResult(_0x5bc2c6,_0x2e4bce))[_0xfd48('0x46')](handleError(_0x5bc2c6,null));};exports[_0xfd48('0x5c')]=function(_0x22fe98,_0x2eb2ce,_0x56d056){var _0x42a09f={'raw':!![],'where':{}};var _0x2a58bc={};var _0x2d867b={'count':0x0,'rows':[]};return db[_0xfd48('0x3d')][_0xfd48('0x56')]({'where':{'id':_0x22fe98['params']['id']}})[_0xfd48('0x24')](handleEntityNotFound(_0x2eb2ce,null))[_0xfd48('0x24')](function(_0x1e2de2){if(_0x1e2de2){_0x2a58bc[_0xfd48('0x2d')]=_[_0xfd48('0x43')](db[_0xfd48('0x5d')][_0xfd48('0x2a')]);_0x2a58bc['query']=_['keys'](_0x22fe98['query']);_0x2a58bc['filters']=_[_0xfd48('0x30')](_0x2a58bc['model'],_0x2a58bc[_0xfd48('0x2e')]);_0x42a09f[_0xfd48('0x31')]=_[_0xfd48('0x30')](_0x2a58bc[_0xfd48('0x2d')],qs['fields'](_0x22fe98['query'][_0xfd48('0x32')]));_0x42a09f['attributes']=_0x42a09f[_0xfd48('0x31')][_0xfd48('0x33')]?_0x42a09f['attributes']:_0x2a58bc[_0xfd48('0x2d')];if(!_0x22fe98[_0xfd48('0x2e')][_0xfd48('0x58')](_0xfd48('0x34'))){_0x42a09f[_0xfd48('0x1f')]=qs[_0xfd48('0x1f')](_0x22fe98[_0xfd48('0x2e')][_0xfd48('0x1f')]);_0x42a09f[_0xfd48('0x1e')]=qs['offset'](_0x22fe98[_0xfd48('0x2e')][_0xfd48('0x1e')]);}_0x42a09f[_0xfd48('0x5e')]=qs[_0xfd48('0x35')](_0x22fe98[_0xfd48('0x2e')][_0xfd48('0x35')]);_0x42a09f[_0xfd48('0x36')]=qs[_0xfd48('0x2f')](_['pick'](_0x22fe98[_0xfd48('0x2e')],_0x2a58bc['filters']));_0x42a09f[_0xfd48('0x36')][_0xfd48('0x59')]=_0x1e2de2['id'];if(_0x22fe98[_0xfd48('0x2e')][_0xfd48('0x5a')]){_0x42a09f[_0xfd48('0x36')]=_['merge'](_0x42a09f[_0xfd48('0x36')],{'$or':_[_0xfd48('0x39')](_0x42a09f[_0xfd48('0x31')],function(_0x54837f){var _0x2a9821={};_0x2a9821[_0x54837f]={'$like':'%'+_0x22fe98[_0xfd48('0x2e')][_0xfd48('0x5a')]+'%'};return _0x2a9821;})});}_0x42a09f=_['merge']({},_0x42a09f,_0x22fe98[_0xfd48('0x3c')]);return db['JscriptyAnswerReport']['count']({'where':_0x42a09f[_0xfd48('0x36')]})[_0xfd48('0x24')](function(_0x431a7e){_0x2d867b[_0xfd48('0x1d')]=_0x431a7e;if(_0x22fe98[_0xfd48('0x2e')][_0xfd48('0x3e')]){_0x42a09f[_0xfd48('0x3f')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xfd48('0x40')](_0x42a09f);})[_0xfd48('0x24')](function(_0x2addcb){_0x2d867b[_0xfd48('0x5b')]=_0x2addcb;return _0x2d867b;});}})[_0xfd48('0x24')](respondWithFilteredResult(_0x2eb2ce,_0x42a09f))[_0xfd48('0x46')](handleError(_0x2eb2ce,null));};function char(_0x5484bc){return'number'===typeof _0x5484bc?String[_0xfd48('0x5f')]['apply'](null,arguments):_0x5484bc;}function needsEncapsulation(_0xff9cba){return!!_0xff9cba&&(_0xff9cba[_0xfd48('0x60')]()['indexOf'](char(0xd))>=0x0||_0xff9cba['toString']()[_0xfd48('0x61')](char(0xa))>=0x0||_0xff9cba[_0xfd48('0x60')]()['indexOf'](char(0x2c))>=0x0||_0xff9cba['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x2d54a7){var _0x3aa538=char(0x22),_0x316bfb='\x5c'+char(0x22),_0x3c6a07=_0x2d54a7[_0xfd48('0x60')]()[_0xfd48('0x62')](new RegExp(_0x3aa538,'g'),_0x316bfb);return _0x3aa538+_0x3c6a07+_0x3aa538;}exports['getSummary']=function(_0xe9390b,_0xda6c02,_0x333f1f){var _0x4decf1,_0x4a5196;var _0xe269ca={'where':{'ProjectId':_0xe9390b[_0xfd48('0x42')]['id']}};if(_0xe9390b[_0xfd48('0x2e')][_0xfd48('0x63')]){_0xe269ca[_0xfd48('0x36')][_0xfd48('0x64')]=JSON[_0xfd48('0x65')](_0xe9390b[_0xfd48('0x2e')][_0xfd48('0x63')]);}return db[_0xfd48('0x57')]['findAll'](_0xe269ca)['then'](handleEntityNotFound(_0xda6c02,null))['then'](function(_0x8cbc14){if(_0x8cbc14){_0x4decf1=_0x8cbc14;return db[_0xfd48('0x66')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x4decf1,'id')},'ProjectId':_0xe9390b[_0xfd48('0x42')]['id']},'order':_0xfd48('0x67')});}})['then'](handleEntityNotFound(_0xda6c02,null))[_0xfd48('0x24')](function(_0x38b703){if(_0x38b703){_0x4a5196=_0x38b703;var _0x42c4f1={};for(var _0xa94779=0x0,_0xb543c6=_0x4a5196[_0xfd48('0x33')];_0xa94779<_0xb543c6;_0xa94779++){if(!_0x42c4f1[_0xfd48('0x58')](_0x4a5196[_0xa94779][_0xfd48('0x68')])){_0x42c4f1[_0x4a5196[_0xa94779][_0xfd48('0x68')]]=needsEncapsulation(_0x4a5196[_0xa94779][_0xfd48('0x69')])?encapsulate(_0x4a5196[_0xa94779][_0xfd48('0x69')]):_0x4a5196[_0xa94779][_0xfd48('0x69')];}}var _0x283f5e=[],_0x37e311={};for(var _0xfd0596=0x0,_0x1154d0=_0x4decf1[_0xfd48('0x33')];_0xfd0596<_0x1154d0;_0xfd0596++){_0x37e311={'ProjectId':_0xe9390b[_0xfd48('0x42')]['id'],'SessionId':_0x4decf1[_0xfd0596]['id'],'StartTime':moment(_0x4decf1[_0xfd0596][_0xfd48('0x64')])[_0xfd48('0x6a')](_0xfd48('0x6b'))};for(var _0x3dab68=0x0,_0x3692c8=_0x4a5196[_0xfd48('0x33')];_0x3dab68<_0x3692c8;_0x3dab68++){if(_0x4a5196[_0x3dab68][_0xfd48('0x6c')]==_0x4decf1[_0xfd0596]['id']&&_0x42c4f1['hasOwnProperty'](_0x4a5196[_0x3dab68][_0xfd48('0x68')])){_0x37e311[_0x42c4f1[_0x4a5196[_0x3dab68]['questionId']]]=_0x4a5196[_0x3dab68][_0xfd48('0x6d')];}}for(var _0x5a7740 in _0x42c4f1){if(!_0x37e311[_0xfd48('0x58')](_0x42c4f1[_0x5a7740])){_0x37e311[_0x42c4f1[_0x5a7740]]=null;}}_0x283f5e['push'](_0x37e311);}return _0x283f5e;}})[_0xfd48('0x24')](function(_0x5403de){if(!_[_0xfd48('0x6e')](_0x5403de)){var _0x33bd67=toCsv(_0x5403de);var _0x3b87ee=Date[_0xfd48('0x6f')]();fs[_0xfd48('0x70')](util[_0xfd48('0x6a')](_0xfd48('0x71'),_0xe9390b[_0xfd48('0x42')]['id'],_0x3b87ee),_0x33bd67);_0xda6c02[_0xfd48('0x72')]('Content-disposition',_0xfd48('0x73')+util[_0xfd48('0x6a')](_0xfd48('0x74'),_0xe9390b[_0xfd48('0x42')]['id'],_0x3b87ee));_0xda6c02[_0xfd48('0x72')](_0xfd48('0x75'),_0xfd48('0x76'));return _0xda6c02['download'](util[_0xfd48('0x6a')](_0xfd48('0x71'),_0xe9390b[_0xfd48('0x42')]['id'],_0x3b87ee));}else{return _0xda6c02[_0xfd48('0x19')](0xcc);}})['catch'](handleError(_0xda6c02,null));}; \ No newline at end of file +var _0xbad9=['intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','map','VIRTUAL','options','findAll','rows','catch','show','keys','filtears','length','includeAll','include','find','create','body','role','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','getSessions','findOne','nolimit','order','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','SessionId','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','sendStatus','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Projects','UserProfileResource','error','stack','name','index','JscriptyProject','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x2f4f41,_0x38bde2){var _0x4f44d6=function(_0xfaf540){while(--_0xfaf540){_0x2f4f41['push'](_0x2f4f41['shift']());}};_0x4f44d6(++_0x38bde2);}(_0xbad9,0xbf));var _0x9bad=function(_0x16307e,_0x2200a0){_0x16307e=_0x16307e-0x0;var _0xadc49d=_0xbad9[_0x16307e];return _0xadc49d;};'use strict';var pdf=require(_0x9bad('0x0'));var emlformat=require(_0x9bad('0x1'));var rimraf=require(_0x9bad('0x2'));var zipdir=require(_0x9bad('0x3'));var jsonpatch=require(_0x9bad('0x4'));var rp=require(_0x9bad('0x5'));var moment=require(_0x9bad('0x6'));var BPromise=require(_0x9bad('0x7'));var Mustache=require(_0x9bad('0x8'));var util=require(_0x9bad('0x9'));var path=require(_0x9bad('0xa'));var sox=require(_0x9bad('0xb'));var csv=require(_0x9bad('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9bad('0xd'));var crypto=require(_0x9bad('0xe'));var jsforce=require(_0x9bad('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9bad('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9bad('0x11'));var as=require(_0x9bad('0x12'));var hardwareService=require(_0x9bad('0x13'));var logger=require(_0x9bad('0x14'))(_0x9bad('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9bad('0x16'));var db=require(_0x9bad('0x17'))['db'];function respondWithStatusCode(_0x143b3a,_0x193025){_0x193025=_0x193025||0xcc;return function(_0x33d1d6){if(_0x33d1d6){return _0x143b3a['sendStatus'](_0x193025);}return _0x143b3a[_0x9bad('0x18')](_0x193025)['end']();};}function respondWithResult(_0x40b2ee,_0x5ce96a){_0x5ce96a=_0x5ce96a||0xc8;return function(_0xd6b5cf){if(_0xd6b5cf){return _0x40b2ee[_0x9bad('0x18')](_0x5ce96a)[_0x9bad('0x19')](_0xd6b5cf);}};}function respondWithFilteredResult(_0x49c5d0,_0x2a3804){return function(_0x96fa00){if(_0x96fa00){var _0x5dda33=_0x96fa00[_0x9bad('0x1a')],_0x2923b0=_0x2a3804[_0x9bad('0x1b')],_0x36bc5c=_0x2a3804[_0x9bad('0x1b')]+_0x2a3804[_0x9bad('0x1c')],_0x2625ac;if(_0x36bc5c>=_0x5dda33){_0x36bc5c=_0x5dda33;_0x2625ac=0xc8;}else{_0x2625ac=0xce;}_0x49c5d0[_0x9bad('0x18')](_0x2625ac);return _0x49c5d0[_0x9bad('0x1d')](_0x9bad('0x1e'),_0x2923b0+'-'+_0x36bc5c+'/'+_0x5dda33)[_0x9bad('0x19')](_0x96fa00);}return null;};}function patchUpdates(_0x2d93f7){return function(_0x356a33){try{jsonpatch[_0x9bad('0x1f')](_0x356a33,_0x2d93f7,!![]);}catch(_0x45eda2){return BPromise[_0x9bad('0x20')](_0x45eda2);}return _0x356a33[_0x9bad('0x21')]();};}function saveUpdates(_0xb322d0,_0x41230d){return function(_0x56fcb6){if(_0x56fcb6){return _0x56fcb6[_0x9bad('0x22')](_0xb322d0)[_0x9bad('0x23')](function(_0x4e2223){return _0x4e2223;});}return null;};}function removeEntity(_0x536f4f,_0x5dfe34){return function(_0x5b904c){if(_0x5b904c){return _0x5b904c[_0x9bad('0x24')]()[_0x9bad('0x23')](function(){var _0x4f372f=_0x5b904c['get']({'plain':!![]});var _0x115d26=_0x9bad('0x25');return db[_0x9bad('0x26')][_0x9bad('0x24')]({'where':{'type':_0x115d26,'resourceId':_0x4f372f['id']}})['then'](function(){return _0x5b904c;});})[_0x9bad('0x23')](function(){_0x536f4f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd224d,_0x155a30){return function(_0x1683fd){if(!_0x1683fd){_0xd224d['sendStatus'](0x194);}return _0x1683fd;};}function handleError(_0x8685fe,_0x154242){_0x154242=_0x154242||0x1f4;return function(_0x5c2c1e){logger[_0x9bad('0x27')](_0x5c2c1e[_0x9bad('0x28')]);if(_0x5c2c1e[_0x9bad('0x29')]){delete _0x5c2c1e[_0x9bad('0x29')];}_0x8685fe[_0x9bad('0x18')](_0x154242)['send'](_0x5c2c1e);};}exports[_0x9bad('0x2a')]=function(_0x4df8b6,_0x5c6e6d){var _0x31abe0={},_0x2ba636={},_0x2edb91={'count':0x0,'rows':[]};var _0x13d1cf=_['map'](db[_0x9bad('0x2b')][_0x9bad('0x2c')],function(_0xe0203f){return{'name':_0xe0203f[_0x9bad('0x2d')],'type':_0xe0203f[_0x9bad('0x2e')][_0x9bad('0x2f')]};});_0x2ba636[_0x9bad('0x30')]=_['map'](_0x13d1cf,_0x9bad('0x29'));_0x2ba636[_0x9bad('0x31')]=_['keys'](_0x4df8b6[_0x9bad('0x31')]);_0x2ba636[_0x9bad('0x32')]=_[_0x9bad('0x33')](_0x2ba636[_0x9bad('0x30')],_0x2ba636[_0x9bad('0x31')]);_0x31abe0[_0x9bad('0x34')]=_[_0x9bad('0x33')](_0x2ba636['model'],qs[_0x9bad('0x35')](_0x4df8b6[_0x9bad('0x31')][_0x9bad('0x35')]));_0x31abe0[_0x9bad('0x34')]=_0x31abe0[_0x9bad('0x34')]['length']?_0x31abe0[_0x9bad('0x34')]:_0x2ba636[_0x9bad('0x30')];if(!_0x4df8b6[_0x9bad('0x31')][_0x9bad('0x36')]('nolimit')){_0x31abe0[_0x9bad('0x1c')]=qs[_0x9bad('0x1c')](_0x4df8b6[_0x9bad('0x31')][_0x9bad('0x1c')]);_0x31abe0[_0x9bad('0x1b')]=qs['offset'](_0x4df8b6[_0x9bad('0x31')]['offset']);}_0x31abe0['order']=qs[_0x9bad('0x37')](_0x4df8b6[_0x9bad('0x31')][_0x9bad('0x37')]);_0x31abe0[_0x9bad('0x38')]=qs[_0x9bad('0x32')](_[_0x9bad('0x39')](_0x4df8b6[_0x9bad('0x31')],_0x2ba636['filters']),_0x13d1cf);if(_0x4df8b6[_0x9bad('0x31')][_0x9bad('0x3a')]){_0x31abe0['where']=_[_0x9bad('0x3b')](_0x31abe0['where'],{'$or':_[_0x9bad('0x3c')](_0x13d1cf,function(_0x14845f){if(_0x14845f['type']!==_0x9bad('0x3d')){var _0x462550={};_0x462550[_0x14845f['name']]={'$like':'%'+_0x4df8b6['query'][_0x9bad('0x3a')]+'%'};return _0x462550;}})});}_0x31abe0=_[_0x9bad('0x3b')]({},_0x31abe0,_0x4df8b6[_0x9bad('0x3e')]);var _0x18a88b={'where':_0x31abe0[_0x9bad('0x38')]};return db[_0x9bad('0x2b')][_0x9bad('0x1a')](_0x18a88b)[_0x9bad('0x23')](function(_0x3782bf){_0x2edb91['count']=_0x3782bf;if(_0x4df8b6['query']['includeAll']){_0x31abe0['include']=[{'all':!![]}];}return db[_0x9bad('0x2b')][_0x9bad('0x3f')](_0x31abe0);})[_0x9bad('0x23')](function(_0x42a5a5){_0x2edb91[_0x9bad('0x40')]=_0x42a5a5;return _0x2edb91;})[_0x9bad('0x23')](respondWithFilteredResult(_0x5c6e6d,_0x31abe0))[_0x9bad('0x41')](handleError(_0x5c6e6d,null));};exports[_0x9bad('0x42')]=function(_0x104478,_0x219bca){var _0x1aed9e={'raw':![],'where':{'id':_0x104478['params']['id']}},_0x5766a1={};_0x5766a1[_0x9bad('0x30')]=_[_0x9bad('0x43')](db[_0x9bad('0x2b')][_0x9bad('0x2c')]);_0x5766a1[_0x9bad('0x31')]=_['keys'](_0x104478[_0x9bad('0x31')]);_0x5766a1[_0x9bad('0x44')]=_[_0x9bad('0x33')](_0x5766a1[_0x9bad('0x30')],_0x5766a1[_0x9bad('0x31')]);_0x1aed9e[_0x9bad('0x34')]=_[_0x9bad('0x33')](_0x5766a1[_0x9bad('0x30')],qs['fields'](_0x104478[_0x9bad('0x31')][_0x9bad('0x35')]));_0x1aed9e[_0x9bad('0x34')]=_0x1aed9e[_0x9bad('0x34')][_0x9bad('0x45')]?_0x1aed9e[_0x9bad('0x34')]:_0x5766a1[_0x9bad('0x30')];if(_0x104478[_0x9bad('0x31')][_0x9bad('0x46')]){_0x1aed9e[_0x9bad('0x47')]=[{'all':!![]}];}_0x1aed9e=_['merge']({},_0x1aed9e,_0x104478[_0x9bad('0x3e')]);return db['JscriptyProject'][_0x9bad('0x48')](_0x1aed9e)[_0x9bad('0x23')](handleEntityNotFound(_0x219bca,null))[_0x9bad('0x23')](respondWithResult(_0x219bca,null))[_0x9bad('0x41')](handleError(_0x219bca,null));};exports[_0x9bad('0x49')]=function(_0x3a2626,_0x3e76c8){return db[_0x9bad('0x2b')]['create'](_0x3a2626[_0x9bad('0x4a')],{})['then'](function(_0x559ddf){var _0x40d601=_0x3a2626['user']['get']({'plain':!![]});if(!_0x40d601)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40d601[_0x9bad('0x4b')]===_0x9bad('0x4c')){var _0x1df902=_0x559ddf[_0x9bad('0x4d')]({'plain':!![]});var _0x572d51=_0x9bad('0x25');return db[_0x9bad('0x4e')][_0x9bad('0x48')]({'where':{'name':_0x572d51,'userProfileId':_0x40d601[_0x9bad('0x4f')]},'raw':!![]})[_0x9bad('0x23')](function(_0x46977b){if(_0x46977b&&_0x46977b[_0x9bad('0x50')]===0x0){return db[_0x9bad('0x26')][_0x9bad('0x49')]({'name':_0x1df902[_0x9bad('0x29')],'resourceId':_0x1df902['id'],'type':_0x46977b[_0x9bad('0x29')],'sectionId':_0x46977b['id']},{})[_0x9bad('0x23')](function(){return _0x559ddf;});}else{return _0x559ddf;}})['catch'](function(_0x48673c){logger['error'](_0x9bad('0x51'),_0x48673c);throw _0x48673c;});}return _0x559ddf;})[_0x9bad('0x23')](respondWithResult(_0x3e76c8,0xc9))[_0x9bad('0x41')](handleError(_0x3e76c8,null));};exports[_0x9bad('0x52')]=function(_0xc1625f,_0x38098c){var _0xbbdf94={'where':{'id':_0xc1625f[_0x9bad('0x53')]['id']}},_0x14bf10={};_0x14bf10['model']=_[_0x9bad('0x43')](db[_0x9bad('0x2b')]['rawAttributes']);_0xbbdf94[_0x9bad('0x34')]=_[_0x9bad('0x33')](_0x14bf10['model'],qs[_0x9bad('0x35')](_0xc1625f[_0x9bad('0x31')]['fields']));_0xbbdf94['attributes']=_0xbbdf94['attributes']['length']?_0xbbdf94['attributes']:_0x14bf10[_0x9bad('0x30')];if(_0xc1625f[_0x9bad('0x31')]['includeAll']){_0xbbdf94['include']=[{'all':!![]}];}_0xbbdf94=_[_0x9bad('0x3b')]({},_0xbbdf94,_0xc1625f[_0x9bad('0x3e')]);return db[_0x9bad('0x2b')][_0x9bad('0x48')](_0xbbdf94)[_0x9bad('0x23')](handleEntityNotFound(_0x38098c,null))[_0x9bad('0x23')](function(_0x46173c){if(_0x46173c){var _0x13087c=_0x46173c[_0x9bad('0x4d')]({'plain':!![]});_0x13087c=qs[_0x9bad('0x54')](_0x13087c,['id',_0x9bad('0x55'),_0x9bad('0x56')]);_0xc1625f[_0x9bad('0x4a')]=_[_0x9bad('0x54')](_0xc1625f['body'],['id','createdAt','updatedAt']);return db[_0x9bad('0x2b')]['create'](_[_0x9bad('0x3b')](_0x13087c,_0xc1625f[_0x9bad('0x4a')]),{'include':_0xc1625f[_0x9bad('0x31')][_0x9bad('0x46')]?[{'all':!![]}]:undefined})[_0x9bad('0x23')](function(_0x5cb5ff){var _0x584ff0=_0xc1625f[_0x9bad('0x4c')]['get']({'plain':!![]});if(!_0x584ff0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x584ff0[_0x9bad('0x4b')]===_0x9bad('0x4c')){var _0x3dd116=_0x5cb5ff[_0x9bad('0x4d')]({'plain':!![]});var _0x3fa39d=_0x9bad('0x25');return db[_0x9bad('0x4e')]['find']({'where':{'name':_0x3fa39d,'userProfileId':_0x584ff0['userProfileId']},'raw':!![]})[_0x9bad('0x23')](function(_0x266a1d){if(_0x266a1d&&_0x266a1d[_0x9bad('0x50')]===0x0){return db[_0x9bad('0x26')][_0x9bad('0x49')]({'name':_0x3dd116[_0x9bad('0x29')],'resourceId':_0x3dd116['id'],'type':_0x266a1d[_0x9bad('0x29')],'sectionId':_0x266a1d['id']},{})[_0x9bad('0x23')](function(){return _0x5cb5ff;});}else{return _0x5cb5ff;}})[_0x9bad('0x41')](function(_0x25a6f7){logger[_0x9bad('0x27')](_0x9bad('0x51'),_0x25a6f7);throw _0x25a6f7;});}return _0x5cb5ff;});}})['then'](respondWithResult(_0x38098c,0xc9))['catch'](handleError(_0x38098c,null));};exports[_0x9bad('0x22')]=function(_0x347969,_0x34277d){if(_0x347969[_0x9bad('0x4a')]['id']){delete _0x347969['body']['id'];}return db[_0x9bad('0x2b')][_0x9bad('0x48')]({'where':{'id':_0x347969['params']['id']}})[_0x9bad('0x23')](handleEntityNotFound(_0x34277d,null))['then'](saveUpdates(_0x347969[_0x9bad('0x4a')],null))['then'](respondWithResult(_0x34277d,null))['catch'](handleError(_0x34277d,null));};exports[_0x9bad('0x24')]=function(_0x3cd8d4,_0xa438a2){return db[_0x9bad('0x2b')]['find']({'where':{'id':_0x3cd8d4[_0x9bad('0x53')]['id']}})[_0x9bad('0x23')](handleEntityNotFound(_0xa438a2,null))[_0x9bad('0x23')](removeEntity(_0xa438a2,null))['catch'](handleError(_0xa438a2,null));};exports[_0x9bad('0x57')]=function(_0x19c906,_0x36d112,_0x59e012){var _0x3c694b={'raw':!![],'where':{}};var _0xcf5015={};var _0x191731={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x9bad('0x58')]({'where':{'id':_0x19c906[_0x9bad('0x53')]['id']}})[_0x9bad('0x23')](handleEntityNotFound(_0x36d112,null))[_0x9bad('0x23')](function(_0x3bcc12){if(_0x3bcc12){_0xcf5015['model']=_[_0x9bad('0x43')](db['JscriptySessionReport'][_0x9bad('0x2c')]);_0xcf5015[_0x9bad('0x31')]=_['keys'](_0x19c906['query']);_0xcf5015[_0x9bad('0x32')]=_['intersection'](_0xcf5015[_0x9bad('0x30')],_0xcf5015[_0x9bad('0x31')]);_0x3c694b[_0x9bad('0x34')]=_[_0x9bad('0x33')](_0xcf5015[_0x9bad('0x30')],qs[_0x9bad('0x35')](_0x19c906['query'][_0x9bad('0x35')]));_0x3c694b[_0x9bad('0x34')]=_0x3c694b['attributes'][_0x9bad('0x45')]?_0x3c694b[_0x9bad('0x34')]:_0xcf5015[_0x9bad('0x30')];if(!_0x19c906[_0x9bad('0x31')][_0x9bad('0x36')](_0x9bad('0x59'))){_0x3c694b[_0x9bad('0x1c')]=qs[_0x9bad('0x1c')](_0x19c906['query'][_0x9bad('0x1c')]);_0x3c694b['offset']=qs[_0x9bad('0x1b')](_0x19c906[_0x9bad('0x31')]['offset']);}_0x3c694b[_0x9bad('0x5a')]=qs['sort'](_0x19c906['query']['sort']);_0x3c694b[_0x9bad('0x38')]=qs[_0x9bad('0x32')](_[_0x9bad('0x39')](_0x19c906[_0x9bad('0x31')],_0xcf5015[_0x9bad('0x32')]));_0x3c694b[_0x9bad('0x38')][_0x9bad('0x5b')]=_0x3bcc12['id'];if(_0x19c906['query']['filter']){_0x3c694b[_0x9bad('0x38')]=_[_0x9bad('0x3b')](_0x3c694b[_0x9bad('0x38')],{'$or':_[_0x9bad('0x3c')](_0x3c694b[_0x9bad('0x34')],function(_0x1d979f){var _0x54ed69={};_0x54ed69[_0x1d979f]={'$like':'%'+_0x19c906[_0x9bad('0x31')]['filter']+'%'};return _0x54ed69;})});}_0x3c694b=_[_0x9bad('0x3b')]({},_0x3c694b,_0x19c906[_0x9bad('0x3e')]);return db[_0x9bad('0x5c')][_0x9bad('0x1a')]({'where':_0x3c694b['where']})[_0x9bad('0x23')](function(_0x516daf){_0x191731[_0x9bad('0x1a')]=_0x516daf;if(_0x19c906[_0x9bad('0x31')][_0x9bad('0x46')]){_0x3c694b[_0x9bad('0x47')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x3c694b);})[_0x9bad('0x23')](function(_0x8a448e){_0x191731['rows']=_0x8a448e;return _0x191731;});}})['then'](respondWithFilteredResult(_0x36d112,_0x3c694b))[_0x9bad('0x41')](handleError(_0x36d112,null));};exports[_0x9bad('0x5d')]=function(_0x122b19,_0x3f63b3,_0x535f48){var _0xa0545b={'raw':!![],'where':{}};var _0x26cf0d={};var _0x34bc35={'count':0x0,'rows':[]};return db[_0x9bad('0x2b')]['findOne']({'where':{'id':_0x122b19[_0x9bad('0x53')]['id']}})['then'](handleEntityNotFound(_0x3f63b3,null))[_0x9bad('0x23')](function(_0x273e4e){if(_0x273e4e){_0x26cf0d['model']=_['keys'](db['JscriptyAnswerReport'][_0x9bad('0x2c')]);_0x26cf0d[_0x9bad('0x31')]=_[_0x9bad('0x43')](_0x122b19[_0x9bad('0x31')]);_0x26cf0d[_0x9bad('0x32')]=_[_0x9bad('0x33')](_0x26cf0d['model'],_0x26cf0d[_0x9bad('0x31')]);_0xa0545b['attributes']=_[_0x9bad('0x33')](_0x26cf0d[_0x9bad('0x30')],qs[_0x9bad('0x35')](_0x122b19[_0x9bad('0x31')]['fields']));_0xa0545b['attributes']=_0xa0545b[_0x9bad('0x34')][_0x9bad('0x45')]?_0xa0545b['attributes']:_0x26cf0d[_0x9bad('0x30')];if(!_0x122b19[_0x9bad('0x31')]['hasOwnProperty'](_0x9bad('0x59'))){_0xa0545b['limit']=qs[_0x9bad('0x1c')](_0x122b19[_0x9bad('0x31')][_0x9bad('0x1c')]);_0xa0545b[_0x9bad('0x1b')]=qs[_0x9bad('0x1b')](_0x122b19[_0x9bad('0x31')]['offset']);}_0xa0545b[_0x9bad('0x5a')]=qs['sort'](_0x122b19[_0x9bad('0x31')][_0x9bad('0x37')]);_0xa0545b['where']=qs[_0x9bad('0x32')](_[_0x9bad('0x39')](_0x122b19[_0x9bad('0x31')],_0x26cf0d['filters']));_0xa0545b[_0x9bad('0x38')]['ProjectId']=_0x273e4e['id'];if(_0x122b19[_0x9bad('0x31')][_0x9bad('0x3a')]){_0xa0545b[_0x9bad('0x38')]=_['merge'](_0xa0545b[_0x9bad('0x38')],{'$or':_[_0x9bad('0x3c')](_0xa0545b['attributes'],function(_0x578da8){var _0x55f2c0={};_0x55f2c0[_0x578da8]={'$like':'%'+_0x122b19['query'][_0x9bad('0x3a')]+'%'};return _0x55f2c0;})});}_0xa0545b=_['merge']({},_0xa0545b,_0x122b19['options']);return db[_0x9bad('0x5e')][_0x9bad('0x1a')]({'where':_0xa0545b[_0x9bad('0x38')]})[_0x9bad('0x23')](function(_0x3eae64){_0x34bc35[_0x9bad('0x1a')]=_0x3eae64;if(_0x122b19[_0x9bad('0x31')][_0x9bad('0x46')]){_0xa0545b[_0x9bad('0x47')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0xa0545b);})[_0x9bad('0x23')](function(_0x28580f){_0x34bc35[_0x9bad('0x40')]=_0x28580f;return _0x34bc35;});}})[_0x9bad('0x23')](respondWithFilteredResult(_0x3f63b3,_0xa0545b))['catch'](handleError(_0x3f63b3,null));};function char(_0x36983e){return _0x9bad('0x5f')===typeof _0x36983e?String[_0x9bad('0x60')][_0x9bad('0x1f')](null,arguments):_0x36983e;}function needsEncapsulation(_0x5bb3e4){return!!_0x5bb3e4&&(_0x5bb3e4[_0x9bad('0x61')]()[_0x9bad('0x62')](char(0xd))>=0x0||_0x5bb3e4[_0x9bad('0x61')]()[_0x9bad('0x62')](char(0xa))>=0x0||_0x5bb3e4[_0x9bad('0x61')]()[_0x9bad('0x62')](char(0x2c))>=0x0||_0x5bb3e4[_0x9bad('0x61')]()[_0x9bad('0x62')](char(0x22))>=0x0);}function encapsulate(_0x627075){var _0x11033f=char(0x22),_0x2e39c6='\x5c'+char(0x22),_0x32a21d=_0x627075[_0x9bad('0x61')]()[_0x9bad('0x63')](new RegExp(_0x11033f,'g'),_0x2e39c6);return _0x11033f+_0x32a21d+_0x11033f;}exports[_0x9bad('0x64')]=function(_0x1c2c1e,_0x166944,_0x1961e5){var _0x2a3a8e,_0x55cb38;var _0x5a6ea6={'where':{'ProjectId':_0x1c2c1e['params']['id']}};if(_0x1c2c1e['query']['startTime']){_0x5a6ea6['where'][_0x9bad('0x65')]=JSON[_0x9bad('0x66')](_0x1c2c1e[_0x9bad('0x31')][_0x9bad('0x67')]);}return db[_0x9bad('0x5c')][_0x9bad('0x3f')](_0x5a6ea6)['then'](handleEntityNotFound(_0x166944,null))[_0x9bad('0x23')](function(_0x4a103f){if(_0x4a103f){_0x2a3a8e=_0x4a103f;return db[_0x9bad('0x68')][_0x9bad('0x3f')]({'where':{'SessionId':{'$in':_[_0x9bad('0x3c')](_0x2a3a8e,'id')},'ProjectId':_0x1c2c1e[_0x9bad('0x53')]['id']},'order':_0x9bad('0x69')});}})[_0x9bad('0x23')](handleEntityNotFound(_0x166944,null))['then'](function(_0x859b4c){if(_0x859b4c){_0x55cb38=_0x859b4c;var _0x1c9969={};for(var _0x48cb7b=0x0,_0x3f45c1=_0x55cb38[_0x9bad('0x45')];_0x48cb7b<_0x3f45c1;_0x48cb7b++){if(!_0x1c9969['hasOwnProperty'](_0x55cb38[_0x48cb7b][_0x9bad('0x6a')])){_0x1c9969[_0x55cb38[_0x48cb7b][_0x9bad('0x6a')]]=needsEncapsulation(_0x55cb38[_0x48cb7b]['question'])?encapsulate(_0x55cb38[_0x48cb7b]['question']):_0x55cb38[_0x48cb7b][_0x9bad('0x6b')];}}var _0x3547b7=[],_0x44ec13={};for(var _0x5779fd=0x0,_0x3fa928=_0x2a3a8e['length'];_0x5779fd<_0x3fa928;_0x5779fd++){_0x44ec13={'ProjectId':_0x1c2c1e['params']['id'],'SessionId':_0x2a3a8e[_0x5779fd]['id'],'StartTime':moment(_0x2a3a8e[_0x5779fd][_0x9bad('0x65')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x116fb3=0x0,_0x15b9ec=_0x55cb38[_0x9bad('0x45')];_0x116fb3<_0x15b9ec;_0x116fb3++){if(_0x55cb38[_0x116fb3][_0x9bad('0x6c')]==_0x2a3a8e[_0x5779fd]['id']&&_0x1c9969[_0x9bad('0x36')](_0x55cb38[_0x116fb3][_0x9bad('0x6a')])){_0x44ec13[_0x1c9969[_0x55cb38[_0x116fb3][_0x9bad('0x6a')]]]=_0x55cb38[_0x116fb3]['answer'];}}for(var _0x3a2abe in _0x1c9969){if(!_0x44ec13[_0x9bad('0x36')](_0x1c9969[_0x3a2abe])){_0x44ec13[_0x1c9969[_0x3a2abe]]=null;}}_0x3547b7['push'](_0x44ec13);}return _0x3547b7;}})[_0x9bad('0x23')](function(_0x1f2df8){if(!_[_0x9bad('0x6d')](_0x1f2df8)){var _0x173f0c=toCsv(_0x1f2df8);var _0x3ff22a=Date[_0x9bad('0x6e')]();fs[_0x9bad('0x6f')](util[_0x9bad('0x70')](_0x9bad('0x71'),_0x1c2c1e['params']['id'],_0x3ff22a),_0x173f0c);_0x166944[_0x9bad('0x72')](_0x9bad('0x73'),_0x9bad('0x74')+util[_0x9bad('0x70')](_0x9bad('0x75'),_0x1c2c1e['params']['id'],_0x3ff22a));_0x166944[_0x9bad('0x72')](_0x9bad('0x76'),_0x9bad('0x77'));return _0x166944['download'](util['format'](_0x9bad('0x71'),_0x1c2c1e['params']['id'],_0x3ff22a));}else{return _0x166944[_0x9bad('0x78')](0xcc);}})[_0x9bad('0x41')](handleError(_0x166944,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 705be8f..2a9035d 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 _0x9616=['../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x43c8b8,_0x5e8934){var _0x413be3=function(_0x23969c){while(--_0x23969c){_0x43c8b8['push'](_0x43c8b8['shift']());}};_0x413be3(++_0x5e8934);}(_0x9616,0x1e7));var _0x6961=function(_0x487a0b,_0x33c302){_0x487a0b=_0x487a0b-0x0;var _0x4cb1ba=_0x9616[_0x487a0b];return _0x4cb1ba;};'use strict';var _=require(_0x6961('0x0'));var util=require(_0x6961('0x1'));var logger=require('../../config/logger')(_0x6961('0x2'));var moment=require('moment');var BPromise=require(_0x6961('0x3'));var rp=require(_0x6961('0x4'));var fs=require('fs');var path=require(_0x6961('0x5'));var rimraf=require(_0x6961('0x6'));var config=require(_0x6961('0x7'));var attributes=require(_0x6961('0x8'));module[_0x6961('0x9')]=function(_0x5824cf,_0xae3704){return _0x5824cf[_0x6961('0xa')](_0x6961('0xb'),attributes,{'tableName':_0x6961('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48f0=['../../config/logger','moment','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','util'];(function(_0x52ce38,_0x50f008){var _0x5c0c6f=function(_0x4ce7d6){while(--_0x4ce7d6){_0x52ce38['push'](_0x52ce38['shift']());}};_0x5c0c6f(++_0x50f008);}(_0x48f0,0x1ab));var _0x048f=function(_0x163ffa,_0x19d509){_0x163ffa=_0x163ffa-0x0;var _0x2edbd1=_0x48f0[_0x163ffa];return _0x2edbd1;};'use strict';var _=require(_0x048f('0x0'));var util=require(_0x048f('0x1'));var logger=require(_0x048f('0x2'))('api');var moment=require(_0x048f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x048f('0x4'));var rimraf=require(_0x048f('0x5'));var config=require(_0x048f('0x6'));var attributes=require(_0x048f('0x7'));module[_0x048f('0x8')]=function(_0x37f770,_0x41ff56){return _0x37f770[_0x048f('0x9')](_0x048f('0xa'),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 f40b6bd..65a6ce9 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 _0xf55b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3d8bb2,_0xfb97b1){var _0x3ad1f5=function(_0x293ef3){while(--_0x293ef3){_0x3d8bb2['push'](_0x3d8bb2['shift']());}};_0x3ad1f5(++_0xfb97b1);}(_0xf55b,0xaf));var _0xbf55=function(_0x46d173,_0x2c25e6){_0x46d173=_0x46d173-0x0;var _0x2a3f6b=_0xf55b[_0x46d173];return _0x2a3f6b;};'use strict';var _=require(_0xbf55('0x0'));var util=require(_0xbf55('0x1'));var moment=require(_0xbf55('0x2'));var BPromise=require(_0xbf55('0x3'));var rs=require(_0xbf55('0x4'));var fs=require('fs');var Redis=require(_0xbf55('0x5'));var db=require(_0xbf55('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf55('0x7'))(_0xbf55('0x8'));var config=require(_0xbf55('0x9'));var jayson=require(_0xbf55('0xa'));var client=jayson[_0xbf55('0xb')][_0xbf55('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39ecec,_0x11b474,_0x3355cf){return new BPromise(function(_0x430091,_0x4118d2){return client[_0xbf55('0xd')](_0x39ecec,_0x3355cf)[_0xbf55('0xe')](function(_0x35c12d){logger[_0xbf55('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x11b474,_0xbf55('0x10'));logger[_0xbf55('0x11')](_0xbf55('0x12'),_0x11b474,'request\x20sent',JSON[_0xbf55('0x13')](_0x35c12d));if(_0x35c12d['error']){if(_0x35c12d[_0xbf55('0x14')][_0xbf55('0x15')]===0x1f4){logger[_0xbf55('0x14')](_0xbf55('0x16'),_0x11b474,_0x35c12d[_0xbf55('0x14')][_0xbf55('0x17')]);return _0x4118d2(_0x35c12d[_0xbf55('0x14')][_0xbf55('0x17')]);}logger[_0xbf55('0x14')](_0xbf55('0x16'),_0x11b474,_0x35c12d[_0xbf55('0x14')][_0xbf55('0x17')]);return _0x430091(_0x35c12d['error']['message']);}else{logger[_0xbf55('0xf')](_0xbf55('0x16'),_0x11b474,_0xbf55('0x10'));_0x430091(_0x35c12d[_0xbf55('0x18')][_0xbf55('0x17')]);}})[_0xbf55('0x19')](function(_0x9667f){logger['error'](_0xbf55('0x16'),_0x11b474,_0x9667f);_0x4118d2(_0x9667f);});});} \ No newline at end of file +var _0x6f88=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x51ec61,_0xf9d1e3){var _0x223200=function(_0x3bd510){while(--_0x3bd510){_0x51ec61['push'](_0x51ec61['shift']());}};_0x223200(++_0xf9d1e3);}(_0x6f88,0x96));var _0x86f8=function(_0x163315,_0x4a0dbe){_0x163315=_0x163315-0x0;var _0x5d3c72=_0x6f88[_0x163315];return _0x5d3c72;};'use strict';var _=require(_0x86f8('0x0'));var util=require(_0x86f8('0x1'));var moment=require(_0x86f8('0x2'));var BPromise=require(_0x86f8('0x3'));var rs=require(_0x86f8('0x4'));var fs=require('fs');var Redis=require(_0x86f8('0x5'));var db=require(_0x86f8('0x6'))['db'];var utils=require(_0x86f8('0x7'));var logger=require(_0x86f8('0x8'))('rpc');var config=require(_0x86f8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x86f8('0xa')][_0x86f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xecb2e4,_0xb93ee3,_0x3bdd07){return new BPromise(function(_0x37f88,_0x4d37e9){return client['request'](_0xecb2e4,_0x3bdd07)['then'](function(_0x4de7ff){logger[_0x86f8('0xc')](_0x86f8('0xd'),_0xb93ee3,_0x86f8('0xe'));logger[_0x86f8('0xf')](_0x86f8('0x10'),_0xb93ee3,_0x86f8('0xe'),JSON['stringify'](_0x4de7ff));if(_0x4de7ff[_0x86f8('0x11')]){if(_0x4de7ff[_0x86f8('0x11')][_0x86f8('0x12')]===0x1f4){logger[_0x86f8('0x11')]('JscriptyProject,\x20%s,\x20%s',_0xb93ee3,_0x4de7ff[_0x86f8('0x11')]['message']);return _0x4d37e9(_0x4de7ff[_0x86f8('0x11')][_0x86f8('0x13')]);}logger[_0x86f8('0x11')](_0x86f8('0xd'),_0xb93ee3,_0x4de7ff[_0x86f8('0x11')][_0x86f8('0x13')]);return _0x37f88(_0x4de7ff[_0x86f8('0x11')][_0x86f8('0x13')]);}else{logger['info'](_0x86f8('0xd'),_0xb93ee3,_0x86f8('0xe'));_0x37f88(_0x4de7ff[_0x86f8('0x14')][_0x86f8('0x13')]);}})[_0x86f8('0x15')](function(_0x3c1c85){logger[_0x86f8('0x11')](_0x86f8('0xd'),_0xb93ee3,_0x3c1c85);_0x4d37e9(_0x3c1c85);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index e749535..7475636 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 _0xa87a=['../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xd9cda6,_0x373130){var _0x39b8ee=function(_0x56adf6){while(--_0x56adf6){_0xd9cda6['push'](_0xd9cda6['shift']());}};_0x39b8ee(++_0x373130);}(_0xa87a,0xcc));var _0xaa87=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa87a[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xaa87('0x0'));var util=require(_0xaa87('0x1'));var path=require(_0xaa87('0x2'));var timeout=require(_0xaa87('0x3'));var express=require(_0xaa87('0x4'));var router=express['Router']();var auth=require(_0xaa87('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaa87('0x6'));var controller=require(_0xaa87('0x7'));router[_0xaa87('0x8')]('/',auth[_0xaa87('0x9')](),controller[_0xaa87('0xa')]);router['get'](_0xaa87('0xb'),auth[_0xaa87('0x9')](),controller['describe']);router[_0xaa87('0x8')](_0xaa87('0xc'),auth[_0xaa87('0x9')](),controller['show']);router[_0xaa87('0xd')]('/',auth['isAuthenticated'](),controller[_0xaa87('0xe')]);router['put']('/:id',auth[_0xaa87('0x9')](),controller[_0xaa87('0xf')]);router[_0xaa87('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xaa87('0x11')]);module[_0xaa87('0x12')]=router; \ No newline at end of file +var _0x3157=['get','isAuthenticated','index','/describe','/:id','post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller'];(function(_0x45f111,_0x3a1a4a){var _0x483508=function(_0x3131ab){while(--_0x3131ab){_0x45f111['push'](_0x45f111['shift']());}};_0x483508(++_0x3a1a4a);}(_0x3157,0x196));var _0x7315=function(_0x3a3731,_0x2d573a){_0x3a3731=_0x3a3731-0x0;var _0x23ee93=_0x3157[_0x3a3731];return _0x23ee93;};'use strict';var multer=require(_0x7315('0x0'));var util=require('util');var path=require(_0x7315('0x1'));var timeout=require(_0x7315('0x2'));var express=require(_0x7315('0x3'));var router=express[_0x7315('0x4')]();var auth=require(_0x7315('0x5'));var interaction=require(_0x7315('0x6'));var config=require('../../config/environment');var controller=require(_0x7315('0x7'));router[_0x7315('0x8')]('/',auth[_0x7315('0x9')](),controller[_0x7315('0xa')]);router['get'](_0x7315('0xb'),auth[_0x7315('0x9')](),controller['describe']);router[_0x7315('0x8')](_0x7315('0xc'),auth[_0x7315('0x9')](),controller['show']);router[_0x7315('0xd')]('/',auth[_0x7315('0x9')](),controller['create']);router[_0x7315('0xe')](_0x7315('0xc'),auth[_0x7315('0x9')](),controller[_0x7315('0xf')]);router[_0x7315('0x10')](_0x7315('0xc'),auth[_0x7315('0x9')](),controller[_0x7315('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 139c3b8..00d75c0 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 _0xe683=['TEXT','long','sequelize','exports','STRING'];(function(_0x5bbb8e,_0x543ec3){var _0x243ab3=function(_0x2405d5){while(--_0x2405d5){_0x5bbb8e['push'](_0x5bbb8e['shift']());}};_0x243ab3(++_0x543ec3);}(_0xe683,0x10b));var _0x3e68=function(_0x14e8a2,_0x104e91){_0x14e8a2=_0x14e8a2-0x0;var _0x1ed76a=_0xe683[_0x14e8a2];return _0x1ed76a;};'use strict';var Sequelize=require(_0x3e68('0x0'));module[_0x3e68('0x1')]={'question':{'type':Sequelize[_0x3e68('0x2')]},'answer':{'type':Sequelize[_0x3e68('0x3')](_0x3e68('0x4'))},'membername':{'type':Sequelize[_0x3e68('0x2')]},'projectname':{'type':Sequelize[_0x3e68('0x2')]},'queue':{'type':Sequelize[_0x3e68('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3e68('0x2')]},'questionId':{'type':Sequelize[_0x3e68('0x2')]}}; \ No newline at end of file +var _0x756b=['exports','STRING','TEXT','long'];(function(_0x4018b5,_0x5417ea){var _0x5e884e=function(_0x5b3ffa){while(--_0x5b3ffa){_0x4018b5['push'](_0x4018b5['shift']());}};_0x5e884e(++_0x5417ea);}(_0x756b,0xe8));var _0xb756=function(_0xe9829b,_0x428f4a){_0xe9829b=_0xe9829b-0x0;var _0x31efac=_0x756b[_0xe9829b];return _0x31efac;};'use strict';var Sequelize=require('sequelize');module[_0xb756('0x0')]={'question':{'type':Sequelize[_0xb756('0x1')]},'answer':{'type':Sequelize[_0xb756('0x2')](_0xb756('0x3'))},'membername':{'type':Sequelize[_0xb756('0x1')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xb756('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb756('0x1')]},'calleridnum':{'type':Sequelize[_0xb756('0x1')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 429a860..bc72631 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 _0x455c=['then','destroy','sendStatus','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','type','key','model','map','keys','filters','intersection','fields','query','attributes','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','filtears','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','count','offset','limit','status','Content-Range','apply','reject','update'];(function(_0x1f5c90,_0xadcfd4){var _0x1ddf38=function(_0x374ec2){while(--_0x374ec2){_0x1f5c90['push'](_0x1f5c90['shift']());}};_0x1ddf38(++_0xadcfd4);}(_0x455c,0xbe));var _0xc455=function(_0x5fe7ce,_0x1a0d39){_0x5fe7ce=_0x5fe7ce-0x0;var _0x3b5793=_0x455c[_0x5fe7ce];return _0x3b5793;};'use strict';var pdf=require(_0xc455('0x0'));var emlformat=require(_0xc455('0x1'));var rimraf=require(_0xc455('0x2'));var zipdir=require(_0xc455('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc455('0x4'));var moment=require('moment');var BPromise=require(_0xc455('0x5'));var Mustache=require(_0xc455('0x6'));var util=require(_0xc455('0x7'));var path=require(_0xc455('0x8'));var sox=require('sox');var csv=require(_0xc455('0x9'));var ejs=require(_0xc455('0xa'));var fs=require('fs');var _=require(_0xc455('0xb'));var squel=require(_0xc455('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc455('0x9'));var querystring=require('querystring');var Papa=require(_0xc455('0xd'));var Redis=require(_0xc455('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc455('0xf'));var as=require(_0xc455('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc455('0x11'))('api');var utils=require(_0xc455('0x12'));var config=require(_0xc455('0x13'));var licenseUtil=require(_0xc455('0x14'));var db=require(_0xc455('0x15'))['db'];function respondWithStatusCode(_0x507a33,_0x1f43d3){_0x1f43d3=_0x1f43d3||0xcc;return function(_0x3146a8){if(_0x3146a8){return _0x507a33['sendStatus'](_0x1f43d3);}return _0x507a33['status'](_0x1f43d3)[_0xc455('0x16')]();};}function respondWithResult(_0x36c4fb,_0x96de17){_0x96de17=_0x96de17||0xc8;return function(_0x23df21){if(_0x23df21){return _0x36c4fb['status'](_0x96de17)[_0xc455('0x17')](_0x23df21);}};}function respondWithFilteredResult(_0xc7784c,_0x29e542){return function(_0x41b3a2){if(_0x41b3a2){var _0x4f0108=_0x41b3a2[_0xc455('0x18')],_0x214d9b=_0x29e542[_0xc455('0x19')],_0x5a1ff7=_0x29e542[_0xc455('0x19')]+_0x29e542[_0xc455('0x1a')],_0x292fbc;if(_0x5a1ff7>=_0x4f0108){_0x5a1ff7=_0x4f0108;_0x292fbc=0xc8;}else{_0x292fbc=0xce;}_0xc7784c[_0xc455('0x1b')](_0x292fbc);return _0xc7784c['set'](_0xc455('0x1c'),_0x214d9b+'-'+_0x5a1ff7+'/'+_0x4f0108)['json'](_0x41b3a2);}return null;};}function patchUpdates(_0x34e86d){return function(_0x115d26){try{jsonpatch[_0xc455('0x1d')](_0x115d26,_0x34e86d,!![]);}catch(_0x23906f){return BPromise[_0xc455('0x1e')](_0x23906f);}return _0x115d26['save']();};}function saveUpdates(_0x1b4e97,_0x3637d3){return function(_0x17a334){if(_0x17a334){return _0x17a334[_0xc455('0x1f')](_0x1b4e97)[_0xc455('0x20')](function(_0x3e6898){return _0x3e6898;});}return null;};}function removeEntity(_0x14abff,_0x36d743){return function(_0xb0d4b5){if(_0xb0d4b5){return _0xb0d4b5[_0xc455('0x21')]()[_0xc455('0x20')](function(){_0x14abff[_0xc455('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x291517,_0x2b1715){return function(_0x10f3e0){if(!_0x10f3e0){_0x291517[_0xc455('0x22')](0x194);}return _0x10f3e0;};}function handleError(_0xe56529,_0x4bef5d){_0x4bef5d=_0x4bef5d||0x1f4;return function(_0x2efccf){logger[_0xc455('0x23')](_0x2efccf[_0xc455('0x24')]);if(_0x2efccf[_0xc455('0x25')]){delete _0x2efccf[_0xc455('0x25')];}_0xe56529[_0xc455('0x1b')](_0x4bef5d)[_0xc455('0x26')](_0x2efccf);};}exports[_0xc455('0x27')]=function(_0x5ea7fb,_0x563f27){var _0x365cc3={},_0x131cdc={},_0x39ff50={'count':0x0,'rows':[]};var _0x3abcae=_['map'](db[_0xc455('0x28')][_0xc455('0x29')],function(_0x176830){return{'name':_0x176830['fieldName'],'type':_0x176830[_0xc455('0x2a')][_0xc455('0x2b')]};});_0x131cdc[_0xc455('0x2c')]=_[_0xc455('0x2d')](_0x3abcae,_0xc455('0x25'));_0x131cdc['query']=_[_0xc455('0x2e')](_0x5ea7fb['query']);_0x131cdc[_0xc455('0x2f')]=_['intersection'](_0x131cdc['model'],_0x131cdc['query']);_0x365cc3['attributes']=_[_0xc455('0x30')](_0x131cdc[_0xc455('0x2c')],qs[_0xc455('0x31')](_0x5ea7fb[_0xc455('0x32')][_0xc455('0x31')]));_0x365cc3[_0xc455('0x33')]=_0x365cc3['attributes'][_0xc455('0x34')]?_0x365cc3[_0xc455('0x33')]:_0x131cdc[_0xc455('0x2c')];if(!_0x5ea7fb['query']['hasOwnProperty'](_0xc455('0x35'))){_0x365cc3[_0xc455('0x1a')]=qs['limit'](_0x5ea7fb[_0xc455('0x32')][_0xc455('0x1a')]);_0x365cc3[_0xc455('0x19')]=qs[_0xc455('0x19')](_0x5ea7fb[_0xc455('0x32')][_0xc455('0x19')]);}_0x365cc3[_0xc455('0x36')]=qs['sort'](_0x5ea7fb[_0xc455('0x32')][_0xc455('0x37')]);_0x365cc3['where']=qs[_0xc455('0x2f')](_[_0xc455('0x38')](_0x5ea7fb[_0xc455('0x32')],_0x131cdc[_0xc455('0x2f')]),_0x3abcae);if(_0x5ea7fb[_0xc455('0x32')][_0xc455('0x39')]){_0x365cc3['where']=_[_0xc455('0x3a')](_0x365cc3[_0xc455('0x3b')],{'$or':_['map'](_0x3abcae,function(_0x375fa9){if(_0x375fa9['type']!==_0xc455('0x3c')){var _0x41bdc2={};_0x41bdc2[_0x375fa9[_0xc455('0x25')]]={'$like':'%'+_0x5ea7fb[_0xc455('0x32')][_0xc455('0x39')]+'%'};return _0x41bdc2;}})});}_0x365cc3=_[_0xc455('0x3a')]({},_0x365cc3,_0x5ea7fb[_0xc455('0x3d')]);var _0xe8d660={'where':_0x365cc3['where']};return db[_0xc455('0x28')]['count'](_0xe8d660)['then'](function(_0x3475dc){_0x39ff50['count']=_0x3475dc;if(_0x5ea7fb[_0xc455('0x32')][_0xc455('0x3e')]){_0x365cc3['include']=[{'all':!![]}];}return db[_0xc455('0x28')][_0xc455('0x3f')](_0x365cc3);})[_0xc455('0x20')](function(_0x205496){_0x39ff50[_0xc455('0x40')]=_0x205496;return _0x39ff50;})[_0xc455('0x20')](respondWithFilteredResult(_0x563f27,_0x365cc3))[_0xc455('0x41')](handleError(_0x563f27,null));};exports[_0xc455('0x42')]=function(_0xb91beb,_0x1d4b24){var _0x3a42c6={'raw':!![],'where':{'id':_0xb91beb[_0xc455('0x43')]['id']}},_0x388c91={};_0x388c91[_0xc455('0x2c')]=_[_0xc455('0x2e')](db[_0xc455('0x28')]['rawAttributes']);_0x388c91[_0xc455('0x32')]=_[_0xc455('0x2e')](_0xb91beb['query']);_0x388c91[_0xc455('0x44')]=_[_0xc455('0x30')](_0x388c91[_0xc455('0x2c')],_0x388c91[_0xc455('0x32')]);_0x3a42c6[_0xc455('0x33')]=_[_0xc455('0x30')](_0x388c91[_0xc455('0x2c')],qs[_0xc455('0x31')](_0xb91beb[_0xc455('0x32')][_0xc455('0x31')]));_0x3a42c6[_0xc455('0x33')]=_0x3a42c6['attributes'][_0xc455('0x34')]?_0x3a42c6[_0xc455('0x33')]:_0x388c91[_0xc455('0x2c')];if(_0xb91beb[_0xc455('0x32')][_0xc455('0x3e')]){_0x3a42c6[_0xc455('0x45')]=[{'all':!![]}];}_0x3a42c6=_[_0xc455('0x3a')]({},_0x3a42c6,_0xb91beb[_0xc455('0x3d')]);return db[_0xc455('0x28')][_0xc455('0x46')](_0x3a42c6)[_0xc455('0x20')](handleEntityNotFound(_0x1d4b24,null))['then'](respondWithResult(_0x1d4b24,null))[_0xc455('0x41')](handleError(_0x1d4b24,null));};exports[_0xc455('0x47')]=function(_0x39eddf,_0x4688ce){return db[_0xc455('0x28')][_0xc455('0x47')](_0x39eddf[_0xc455('0x48')],{})[_0xc455('0x20')](respondWithResult(_0x4688ce,0xc9))[_0xc455('0x41')](handleError(_0x4688ce,null));};exports[_0xc455('0x1f')]=function(_0xdeee03,_0x22035f){if(_0xdeee03[_0xc455('0x48')]['id']){delete _0xdeee03[_0xc455('0x48')]['id'];}return db['JscriptyQuestionReport'][_0xc455('0x46')]({'where':{'id':_0xdeee03[_0xc455('0x43')]['id']}})[_0xc455('0x20')](handleEntityNotFound(_0x22035f,null))[_0xc455('0x20')](saveUpdates(_0xdeee03[_0xc455('0x48')],null))[_0xc455('0x20')](respondWithResult(_0x22035f,null))[_0xc455('0x41')](handleError(_0x22035f,null));};exports[_0xc455('0x21')]=function(_0xf5d5b7,_0xd29fc){return db[_0xc455('0x28')]['find']({'where':{'id':_0xf5d5b7[_0xc455('0x43')]['id']}})[_0xc455('0x20')](handleEntityNotFound(_0xd29fc,null))[_0xc455('0x20')](removeEntity(_0xd29fc,null))[_0xc455('0x41')](handleError(_0xd29fc,null));};exports[_0xc455('0x49')]=function(_0x54ce71,_0x42fd6a){return db[_0xc455('0x28')][_0xc455('0x49')]()[_0xc455('0x20')](respondWithResult(_0x42fd6a,null))[_0xc455('0x41')](handleError(_0x42fd6a,null));}; \ No newline at end of file +var _0x5e19=['limit','order','sort','where','filter','merge','VIRTUAL','options','JscriptyQuestionReport','count','includeAll','include','findAll','rows','catch','show','params','keys','filtears','find','create','body','update','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','offset','json','reject','save','then','destroy','status','end','sendStatus','error','name','send','map','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','nolimit'];(function(_0x331b25,_0x5ac483){var _0x2fbe48=function(_0x5380fe){while(--_0x5380fe){_0x331b25['push'](_0x331b25['shift']());}};_0x2fbe48(++_0x5ac483);}(_0x5e19,0x64));var _0x95e1=function(_0x48c1a2,_0x229627){_0x48c1a2=_0x48c1a2-0x0;var _0x5454e1=_0x5e19[_0x48c1a2];return _0x5454e1;};'use strict';var pdf=require(_0x95e1('0x0'));var emlformat=require(_0x95e1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x95e1('0x2'));var jsonpatch=require(_0x95e1('0x3'));var rp=require(_0x95e1('0x4'));var moment=require(_0x95e1('0x5'));var BPromise=require(_0x95e1('0x6'));var Mustache=require(_0x95e1('0x7'));var util=require('util');var path=require(_0x95e1('0x8'));var sox=require('sox');var csv=require(_0x95e1('0x9'));var ejs=require(_0x95e1('0xa'));var fs=require('fs');var _=require(_0x95e1('0xb'));var squel=require(_0x95e1('0xc'));var crypto=require(_0x95e1('0xd'));var jsforce=require(_0x95e1('0xe'));var deskjs=require(_0x95e1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x95e1('0x10'));var Papa=require(_0x95e1('0x11'));var Redis=require(_0x95e1('0x12'));var authService=require(_0x95e1('0x13'));var qs=require(_0x95e1('0x14'));var as=require(_0x95e1('0x15'));var hardwareService=require(_0x95e1('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x95e1('0x17'));var config=require(_0x95e1('0x18'));var licenseUtil=require(_0x95e1('0x19'));var db=require(_0x95e1('0x1a'))['db'];function respondWithStatusCode(_0xcaed68,_0x191051){_0x191051=_0x191051||0xcc;return function(_0x450b7a){if(_0x450b7a){return _0xcaed68['sendStatus'](_0x191051);}return _0xcaed68['status'](_0x191051)['end']();};}function respondWithResult(_0x85369,_0x3d17b9){_0x3d17b9=_0x3d17b9||0xc8;return function(_0x2f2638){if(_0x2f2638){return _0x85369['status'](_0x3d17b9)['json'](_0x2f2638);}};}function respondWithFilteredResult(_0x46d08e,_0x23f2ab){return function(_0x5dd3c7){if(_0x5dd3c7){var _0x370de7=_0x5dd3c7['count'],_0x49858d=_0x23f2ab[_0x95e1('0x1b')],_0x9b8235=_0x23f2ab[_0x95e1('0x1b')]+_0x23f2ab['limit'],_0x25370e;if(_0x9b8235>=_0x370de7){_0x9b8235=_0x370de7;_0x25370e=0xc8;}else{_0x25370e=0xce;}_0x46d08e['status'](_0x25370e);return _0x46d08e['set']('Content-Range',_0x49858d+'-'+_0x9b8235+'/'+_0x370de7)[_0x95e1('0x1c')](_0x5dd3c7);}return null;};}function patchUpdates(_0x616de7){return function(_0x394ab6){try{jsonpatch['apply'](_0x394ab6,_0x616de7,!![]);}catch(_0x43e819){return BPromise[_0x95e1('0x1d')](_0x43e819);}return _0x394ab6[_0x95e1('0x1e')]();};}function saveUpdates(_0x1d4ad8,_0x1600d9){return function(_0x339ca8){if(_0x339ca8){return _0x339ca8['update'](_0x1d4ad8)[_0x95e1('0x1f')](function(_0x57c353){return _0x57c353;});}return null;};}function removeEntity(_0x12bc88,_0x335cc8){return function(_0x495aa9){if(_0x495aa9){return _0x495aa9[_0x95e1('0x20')]()[_0x95e1('0x1f')](function(){_0x12bc88[_0x95e1('0x21')](0xcc)[_0x95e1('0x22')]();});}};}function handleEntityNotFound(_0xfc0146,_0x16c9bd){return function(_0x29ebaa){if(!_0x29ebaa){_0xfc0146[_0x95e1('0x23')](0x194);}return _0x29ebaa;};}function handleError(_0x17b8cb,_0x3dc5b9){_0x3dc5b9=_0x3dc5b9||0x1f4;return function(_0x2fde4f){logger[_0x95e1('0x24')](_0x2fde4f['stack']);if(_0x2fde4f[_0x95e1('0x25')]){delete _0x2fde4f[_0x95e1('0x25')];}_0x17b8cb[_0x95e1('0x21')](_0x3dc5b9)[_0x95e1('0x26')](_0x2fde4f);};}exports['index']=function(_0x2eb056,_0x1b9e8c){var _0x577cbd={},_0x39182c={},_0x34d967={'count':0x0,'rows':[]};var _0x24a6b3=_[_0x95e1('0x27')](db['JscriptyQuestionReport'][_0x95e1('0x28')],function(_0x5ec60c){return{'name':_0x5ec60c[_0x95e1('0x29')],'type':_0x5ec60c[_0x95e1('0x2a')][_0x95e1('0x2b')]};});_0x39182c['model']=_[_0x95e1('0x27')](_0x24a6b3,_0x95e1('0x25'));_0x39182c[_0x95e1('0x2c')]=_['keys'](_0x2eb056[_0x95e1('0x2c')]);_0x39182c[_0x95e1('0x2d')]=_['intersection'](_0x39182c[_0x95e1('0x2e')],_0x39182c[_0x95e1('0x2c')]);_0x577cbd['attributes']=_[_0x95e1('0x2f')](_0x39182c[_0x95e1('0x2e')],qs[_0x95e1('0x30')](_0x2eb056[_0x95e1('0x2c')]['fields']));_0x577cbd[_0x95e1('0x31')]=_0x577cbd[_0x95e1('0x31')][_0x95e1('0x32')]?_0x577cbd[_0x95e1('0x31')]:_0x39182c['model'];if(!_0x2eb056['query']['hasOwnProperty'](_0x95e1('0x33'))){_0x577cbd[_0x95e1('0x34')]=qs['limit'](_0x2eb056[_0x95e1('0x2c')]['limit']);_0x577cbd[_0x95e1('0x1b')]=qs['offset'](_0x2eb056[_0x95e1('0x2c')][_0x95e1('0x1b')]);}_0x577cbd[_0x95e1('0x35')]=qs['sort'](_0x2eb056[_0x95e1('0x2c')][_0x95e1('0x36')]);_0x577cbd[_0x95e1('0x37')]=qs['filters'](_['pick'](_0x2eb056[_0x95e1('0x2c')],_0x39182c[_0x95e1('0x2d')]),_0x24a6b3);if(_0x2eb056[_0x95e1('0x2c')][_0x95e1('0x38')]){_0x577cbd[_0x95e1('0x37')]=_[_0x95e1('0x39')](_0x577cbd[_0x95e1('0x37')],{'$or':_['map'](_0x24a6b3,function(_0x1fe3af){if(_0x1fe3af[_0x95e1('0x2a')]!==_0x95e1('0x3a')){var _0x1d7062={};_0x1d7062[_0x1fe3af[_0x95e1('0x25')]]={'$like':'%'+_0x2eb056[_0x95e1('0x2c')][_0x95e1('0x38')]+'%'};return _0x1d7062;}})});}_0x577cbd=_['merge']({},_0x577cbd,_0x2eb056[_0x95e1('0x3b')]);var _0x3dc2c0={'where':_0x577cbd[_0x95e1('0x37')]};return db[_0x95e1('0x3c')]['count'](_0x3dc2c0)[_0x95e1('0x1f')](function(_0x547d64){_0x34d967[_0x95e1('0x3d')]=_0x547d64;if(_0x2eb056[_0x95e1('0x2c')][_0x95e1('0x3e')]){_0x577cbd[_0x95e1('0x3f')]=[{'all':!![]}];}return db[_0x95e1('0x3c')][_0x95e1('0x40')](_0x577cbd);})['then'](function(_0x27d856){_0x34d967[_0x95e1('0x41')]=_0x27d856;return _0x34d967;})[_0x95e1('0x1f')](respondWithFilteredResult(_0x1b9e8c,_0x577cbd))[_0x95e1('0x42')](handleError(_0x1b9e8c,null));};exports[_0x95e1('0x43')]=function(_0x169a30,_0x2612a0){var _0x1cedcc={'raw':!![],'where':{'id':_0x169a30[_0x95e1('0x44')]['id']}},_0x1260d1={};_0x1260d1[_0x95e1('0x2e')]=_[_0x95e1('0x45')](db['JscriptyQuestionReport'][_0x95e1('0x28')]);_0x1260d1['query']=_['keys'](_0x169a30[_0x95e1('0x2c')]);_0x1260d1[_0x95e1('0x46')]=_[_0x95e1('0x2f')](_0x1260d1[_0x95e1('0x2e')],_0x1260d1[_0x95e1('0x2c')]);_0x1cedcc[_0x95e1('0x31')]=_[_0x95e1('0x2f')](_0x1260d1[_0x95e1('0x2e')],qs[_0x95e1('0x30')](_0x169a30[_0x95e1('0x2c')][_0x95e1('0x30')]));_0x1cedcc[_0x95e1('0x31')]=_0x1cedcc[_0x95e1('0x31')]['length']?_0x1cedcc[_0x95e1('0x31')]:_0x1260d1['model'];if(_0x169a30[_0x95e1('0x2c')][_0x95e1('0x3e')]){_0x1cedcc[_0x95e1('0x3f')]=[{'all':!![]}];}_0x1cedcc=_[_0x95e1('0x39')]({},_0x1cedcc,_0x169a30['options']);return db['JscriptyQuestionReport'][_0x95e1('0x47')](_0x1cedcc)[_0x95e1('0x1f')](handleEntityNotFound(_0x2612a0,null))['then'](respondWithResult(_0x2612a0,null))['catch'](handleError(_0x2612a0,null));};exports[_0x95e1('0x48')]=function(_0x4cf41a,_0x52b959){return db[_0x95e1('0x3c')][_0x95e1('0x48')](_0x4cf41a[_0x95e1('0x49')],{})[_0x95e1('0x1f')](respondWithResult(_0x52b959,0xc9))['catch'](handleError(_0x52b959,null));};exports[_0x95e1('0x4a')]=function(_0x5c6086,_0x3ab55c){if(_0x5c6086['body']['id']){delete _0x5c6086[_0x95e1('0x49')]['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x5c6086[_0x95e1('0x44')]['id']}})[_0x95e1('0x1f')](handleEntityNotFound(_0x3ab55c,null))[_0x95e1('0x1f')](saveUpdates(_0x5c6086[_0x95e1('0x49')],null))[_0x95e1('0x1f')](respondWithResult(_0x3ab55c,null))['catch'](handleError(_0x3ab55c,null));};exports[_0x95e1('0x20')]=function(_0x52c721,_0x4ce398){return db[_0x95e1('0x3c')][_0x95e1('0x47')]({'where':{'id':_0x52c721['params']['id']}})[_0x95e1('0x1f')](handleEntityNotFound(_0x4ce398,null))['then'](removeEntity(_0x4ce398,null))[_0x95e1('0x42')](handleError(_0x4ce398,null));};exports[_0x95e1('0x4b')]=function(_0x5927a2,_0x4168e9){return db[_0x95e1('0x3c')][_0x95e1('0x4b')]()[_0x95e1('0x1f')](respondWithResult(_0x4168e9,null))[_0x95e1('0x42')](handleError(_0x4168e9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index dd7c8ec..5f27c84 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 _0xa9c4=['request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x28056c,_0x5d0f7a){var _0xd90346=function(_0x5990ec){while(--_0x5990ec){_0x28056c['push'](_0x28056c['shift']());}};_0xd90346(++_0x5d0f7a);}(_0xa9c4,0xcc));var _0x4a9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9c4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4a9c('0x0'));var util=require(_0x4a9c('0x1'));var logger=require(_0x4a9c('0x2'))(_0x4a9c('0x3'));var moment=require(_0x4a9c('0x4'));var BPromise=require(_0x4a9c('0x5'));var rp=require(_0x4a9c('0x6'));var fs=require('fs');var path=require(_0x4a9c('0x7'));var rimraf=require(_0x4a9c('0x8'));var config=require(_0x4a9c('0x9'));var attributes=require(_0x4a9c('0xa'));module['exports']=function(_0x1a1719,_0x181257){return _0x1a1719[_0x4a9c('0xb')](_0x4a9c('0xc'),attributes,{'tableName':_0x4a9c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6105=['rimraf','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','lodash','../../config/logger','bluebird','request-promise','path'];(function(_0x573927,_0x24e5e8){var _0xee11df=function(_0x416c69){while(--_0x416c69){_0x573927['push'](_0x573927['shift']());}};_0xee11df(++_0x24e5e8);}(_0x6105,0x13f));var _0x5610=function(_0x3e3cce,_0x55a3ba){_0x3e3cce=_0x3e3cce-0x0;var _0xf472f=_0x6105[_0x3e3cce];return _0xf472f;};'use strict';var _=require(_0x5610('0x0'));var util=require('util');var logger=require(_0x5610('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5610('0x2'));var rp=require(_0x5610('0x3'));var fs=require('fs');var path=require(_0x5610('0x4'));var rimraf=require(_0x5610('0x5'));var config=require('../../config/environment');var attributes=require(_0x5610('0x6'));module[_0x5610('0x7')]=function(_0xfa91e9,_0x234d59){return _0xfa91e9['define'](_0x5610('0x8'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 1dc7a62..dd7b84d 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 _0xe3ff=['JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xe3ff,0x6d));var _0xfe3f=function(_0x160441,_0x244eae){_0x160441=_0x160441-0x0;var _0x2ca0c5=_0xe3ff[_0x160441];return _0x2ca0c5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfe3f('0x0'));var BPromise=require(_0xfe3f('0x1'));var rs=require(_0xfe3f('0x2'));var fs=require('fs');var Redis=require(_0xfe3f('0x3'));var db=require(_0xfe3f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfe3f('0x5'));var config=require(_0xfe3f('0x6'));var jayson=require(_0xfe3f('0x7'));var client=jayson[_0xfe3f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e9b9f,_0x78402e,_0x5be2d0){return new BPromise(function(_0x46c35d,_0x96d6bf){return client[_0xfe3f('0x9')](_0x1e9b9f,_0x5be2d0)[_0xfe3f('0xa')](function(_0x578603){logger['info'](_0xfe3f('0xb'),_0x78402e,_0xfe3f('0xc'));logger[_0xfe3f('0xd')](_0xfe3f('0xe'),_0x78402e,'request\x20sent',JSON[_0xfe3f('0xf')](_0x578603));if(_0x578603[_0xfe3f('0x10')]){if(_0x578603[_0xfe3f('0x10')][_0xfe3f('0x11')]===0x1f4){logger[_0xfe3f('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x78402e,_0x578603[_0xfe3f('0x10')]['message']);return _0x96d6bf(_0x578603['error'][_0xfe3f('0x12')]);}logger[_0xfe3f('0x10')](_0xfe3f('0xb'),_0x78402e,_0x578603[_0xfe3f('0x10')]['message']);return _0x46c35d(_0x578603[_0xfe3f('0x10')][_0xfe3f('0x12')]);}else{logger['info'](_0xfe3f('0xb'),_0x78402e,_0xfe3f('0xc'));_0x46c35d(_0x578603[_0xfe3f('0x13')][_0xfe3f('0x12')]);}})['catch'](function(_0x4b06c6){logger[_0xfe3f('0x10')](_0xfe3f('0xb'),_0x78402e,_0x4b06c6);_0x96d6bf(_0x4b06c6);});});} \ No newline at end of file +var _0xcde9=['jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x599214,_0x578f89){var _0x3d94fc=function(_0x50b36f){while(--_0x50b36f){_0x599214['push'](_0x599214['shift']());}};_0x3d94fc(++_0x578f89);}(_0xcde9,0x109));var _0x9cde=function(_0x611b30,_0x3d0d48){_0x611b30=_0x611b30-0x0;var _0x5e3eec=_0xcde9[_0x611b30];return _0x5e3eec;};'use strict';var _=require(_0x9cde('0x0'));var util=require(_0x9cde('0x1'));var moment=require('moment');var BPromise=require(_0x9cde('0x2'));var rs=require(_0x9cde('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9cde('0x4'))['db'];var utils=require(_0x9cde('0x5'));var logger=require(_0x9cde('0x6'))(_0x9cde('0x7'));var config=require('../../config/environment');var jayson=require(_0x9cde('0x8'));var client=jayson[_0x9cde('0x9')][_0x9cde('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x196d44,_0x49940b,_0x2435ef){return new BPromise(function(_0x407cc8,_0x38689a){return client[_0x9cde('0xb')](_0x196d44,_0x2435ef)['then'](function(_0x54a74a){logger[_0x9cde('0xc')](_0x9cde('0xd'),_0x49940b,_0x9cde('0xe'));logger[_0x9cde('0xf')](_0x9cde('0x10'),_0x49940b,_0x9cde('0xe'),JSON[_0x9cde('0x11')](_0x54a74a));if(_0x54a74a[_0x9cde('0x12')]){if(_0x54a74a[_0x9cde('0x12')]['code']===0x1f4){logger[_0x9cde('0x12')](_0x9cde('0xd'),_0x49940b,_0x54a74a[_0x9cde('0x12')][_0x9cde('0x13')]);return _0x38689a(_0x54a74a['error']['message']);}logger[_0x9cde('0x12')](_0x9cde('0xd'),_0x49940b,_0x54a74a[_0x9cde('0x12')][_0x9cde('0x13')]);return _0x407cc8(_0x54a74a[_0x9cde('0x12')][_0x9cde('0x13')]);}else{logger[_0x9cde('0xc')](_0x9cde('0xd'),_0x49940b,_0x9cde('0xe'));_0x407cc8(_0x54a74a[_0x9cde('0x14')][_0x9cde('0x13')]);}})['catch'](function(_0x59b22f){logger['error'](_0x9cde('0xd'),_0x49940b,_0x59b22f);_0x38689a(_0x59b22f);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index f9c0e7e..32f08fc 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 _0x1e69=['getQuestions','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/questions'];(function(_0x189b3b,_0x484de8){var _0x7c4721=function(_0x1ca32b){while(--_0x1ca32b){_0x189b3b['push'](_0x189b3b['shift']());}};_0x7c4721(++_0x484de8);}(_0x1e69,0x85));var _0x91e6=function(_0x53056c,_0x1d56a9){_0x53056c=_0x53056c-0x0;var _0x5cec88=_0x1e69[_0x53056c];return _0x5cec88;};'use strict';var multer=require('multer');var util=require(_0x91e6('0x0'));var path=require(_0x91e6('0x1'));var timeout=require(_0x91e6('0x2'));var express=require(_0x91e6('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x91e6('0x4'));var config=require(_0x91e6('0x5'));var controller=require(_0x91e6('0x6'));router[_0x91e6('0x7')]('/',auth[_0x91e6('0x8')](),controller[_0x91e6('0x9')]);router[_0x91e6('0x7')](_0x91e6('0xa'),auth[_0x91e6('0x8')](),controller[_0x91e6('0xb')]);router[_0x91e6('0x7')](_0x91e6('0xc'),auth[_0x91e6('0x8')](),controller['show']);router['get'](_0x91e6('0xd'),auth[_0x91e6('0x8')](),controller[_0x91e6('0xe')]);router[_0x91e6('0xf')]('/',auth['isAuthenticated'](),controller[_0x91e6('0x10')]);router[_0x91e6('0x11')](_0x91e6('0xc'),auth[_0x91e6('0x8')](),controller['update']);router[_0x91e6('0x12')](_0x91e6('0xc'),auth[_0x91e6('0x8')](),controller[_0x91e6('0x13')]);module[_0x91e6('0x14')]=router; \ No newline at end of file +var _0x5645=['../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','/:id','show','getQuestions','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5645,0x19e));var _0x5564=function(_0x60da0b,_0x396627){_0x60da0b=_0x60da0b-0x0;var _0x3c6d42=_0x5645[_0x60da0b];return _0x3c6d42;};'use strict';var multer=require(_0x5564('0x0'));var util=require(_0x5564('0x1'));var path=require(_0x5564('0x2'));var timeout=require(_0x5564('0x3'));var express=require(_0x5564('0x4'));var router=express['Router']();var auth=require(_0x5564('0x5'));var interaction=require(_0x5564('0x6'));var config=require(_0x5564('0x7'));var controller=require(_0x5564('0x8'));router[_0x5564('0x9')]('/',auth[_0x5564('0xa')](),controller[_0x5564('0xb')]);router[_0x5564('0x9')](_0x5564('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x5564('0x9')](_0x5564('0xd'),auth[_0x5564('0xa')](),controller[_0x5564('0xe')]);router[_0x5564('0x9')]('/:id/questions',auth[_0x5564('0xa')](),controller[_0x5564('0xf')]);router['post']('/',auth[_0x5564('0xa')](),controller[_0x5564('0x10')]);router[_0x5564('0x11')](_0x5564('0xd'),auth[_0x5564('0xa')](),controller[_0x5564('0x12')]);router[_0x5564('0x13')](_0x5564('0xd'),auth['isAuthenticated'](),controller[_0x5564('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index b7239bc..cd657f2 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 _0x303b=['exports','DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize'];(function(_0x365c8a,_0x4c101c){var _0x5a9a04=function(_0x295490){while(--_0x295490){_0x365c8a['push'](_0x365c8a['shift']());}};_0x5a9a04(++_0x4c101c);}(_0x303b,0x15e));var _0xb303=function(_0x47cf16,_0x38f42b){_0x47cf16=_0x47cf16-0x0;var _0x4afe7e=_0x303b[_0x47cf16];return _0x4afe7e;};'use strict';var moment=require('moment');var Sequelize=require(_0xb303('0x0'));module[_0xb303('0x1')]={'starttime':{'type':Sequelize[_0xb303('0x2')],'set':function(_0x30188d){this[_0xb303('0x3')](_0xb303('0x4'),_0x30188d);this[_0xb303('0x3')](_0xb303('0x5'),moment()['format'](_0xb303('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xb303('0x7')]},'projectname':{'type':Sequelize[_0xb303('0x7')]},'queue':{'type':Sequelize[_0xb303('0x7')]},'uniqueid':{'type':Sequelize[_0xb303('0x7')]},'calleridname':{'type':Sequelize[_0xb303('0x7')]},'calleridnum':{'type':Sequelize[_0xb303('0x7')]},'completed':{'type':Sequelize[_0xb303('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x608e=['DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x4ca4af,_0x2d4438){var _0x4f2253=function(_0x16cd00){while(--_0x16cd00){_0x4ca4af['push'](_0x4ca4af['shift']());}};_0x4f2253(++_0x2d4438);}(_0x608e,0x1dd));var _0xe608=function(_0x519cdd,_0x35c09e){_0x519cdd=_0x519cdd-0x0;var _0x339945=_0x608e[_0x519cdd];return _0x339945;};'use strict';var moment=require(_0xe608('0x0'));var Sequelize=require(_0xe608('0x1'));module[_0xe608('0x2')]={'starttime':{'type':Sequelize[_0xe608('0x3')],'set':function(_0x53684a){this[_0xe608('0x4')](_0xe608('0x5'),_0x53684a);this['setDataValue'](_0xe608('0x6'),moment()['format'](_0xe608('0x7')));}},'endtime':{'type':Sequelize[_0xe608('0x3')]},'membername':{'type':Sequelize[_0xe608('0x8')]},'projectname':{'type':Sequelize[_0xe608('0x8')]},'queue':{'type':Sequelize[_0xe608('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe608('0x8')]},'calleridnum':{'type':Sequelize[_0xe608('0x8')]},'completed':{'type':Sequelize[_0xe608('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 f00ccc4..f713719 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 _0x3670=['keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','findAll','catch','show','params','filtears','length','include','merge','find','create','body','describe','getQuestions','JscriptyQuestionReport','SessionId','includeAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','set','Content-Range','json','apply','reject','destroy','then','sendStatus','error','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3670,0x16c));var _0x0367=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3670[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0367('0x0'));var rimraf=require(_0x0367('0x1'));var zipdir=require(_0x0367('0x2'));var jsonpatch=require(_0x0367('0x3'));var rp=require(_0x0367('0x4'));var moment=require(_0x0367('0x5'));var BPromise=require(_0x0367('0x6'));var Mustache=require('mustache');var util=require(_0x0367('0x7'));var path=require(_0x0367('0x8'));var sox=require(_0x0367('0x9'));var csv=require(_0x0367('0xa'));var ejs=require(_0x0367('0xb'));var fs=require('fs');var _=require(_0x0367('0xc'));var squel=require(_0x0367('0xd'));var crypto=require(_0x0367('0xe'));var jsforce=require(_0x0367('0xf'));var deskjs=require(_0x0367('0x10'));var toCsv=require(_0x0367('0xa'));var querystring=require(_0x0367('0x11'));var Papa=require(_0x0367('0x12'));var Redis=require(_0x0367('0x13'));var authService=require(_0x0367('0x14'));var qs=require(_0x0367('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0367('0x16'));var logger=require('../../config/logger')(_0x0367('0x17'));var utils=require(_0x0367('0x18'));var config=require(_0x0367('0x19'));var licenseUtil=require(_0x0367('0x1a'));var db=require(_0x0367('0x1b'))['db'];function respondWithStatusCode(_0x20a7ce,_0x15a55c){_0x15a55c=_0x15a55c||0xcc;return function(_0xf54c3f){if(_0xf54c3f){return _0x20a7ce['sendStatus'](_0x15a55c);}return _0x20a7ce[_0x0367('0x1c')](_0x15a55c)[_0x0367('0x1d')]();};}function respondWithResult(_0x537439,_0x30c673){_0x30c673=_0x30c673||0xc8;return function(_0x2b7b12){if(_0x2b7b12){return _0x537439[_0x0367('0x1c')](_0x30c673)['json'](_0x2b7b12);}};}function respondWithFilteredResult(_0x314841,_0x14090f){return function(_0x435e6f){if(_0x435e6f){var _0x32391b=_0x435e6f[_0x0367('0x1e')],_0x4eb840=_0x14090f[_0x0367('0x1f')],_0x5dc051=_0x14090f['offset']+_0x14090f['limit'],_0x2109ee;if(_0x5dc051>=_0x32391b){_0x5dc051=_0x32391b;_0x2109ee=0xc8;}else{_0x2109ee=0xce;}_0x314841[_0x0367('0x1c')](_0x2109ee);return _0x314841[_0x0367('0x20')](_0x0367('0x21'),_0x4eb840+'-'+_0x5dc051+'/'+_0x32391b)[_0x0367('0x22')](_0x435e6f);}return null;};}function patchUpdates(_0x551581){return function(_0x2073f4){try{jsonpatch[_0x0367('0x23')](_0x2073f4,_0x551581,!![]);}catch(_0x14ddf2){return BPromise[_0x0367('0x24')](_0x14ddf2);}return _0x2073f4['save']();};}function saveUpdates(_0x5de2fd,_0xbed137){return function(_0x28cb87){if(_0x28cb87){return _0x28cb87['update'](_0x5de2fd)['then'](function(_0x2ed47f){return _0x2ed47f;});}return null;};}function removeEntity(_0x1d7463,_0x3fbe62){return function(_0x8f0784){if(_0x8f0784){return _0x8f0784[_0x0367('0x25')]()[_0x0367('0x26')](function(){_0x1d7463[_0x0367('0x1c')](0xcc)[_0x0367('0x1d')]();});}};}function handleEntityNotFound(_0x56e057,_0x5ee1c7){return function(_0x26f498){if(!_0x26f498){_0x56e057[_0x0367('0x27')](0x194);}return _0x26f498;};}function handleError(_0x1fc0a5,_0x5bd452){_0x5bd452=_0x5bd452||0x1f4;return function(_0x5b5dce){logger[_0x0367('0x28')](_0x5b5dce['stack']);if(_0x5b5dce[_0x0367('0x29')]){delete _0x5b5dce[_0x0367('0x29')];}_0x1fc0a5[_0x0367('0x1c')](_0x5bd452)[_0x0367('0x2a')](_0x5b5dce);};}exports[_0x0367('0x2b')]=function(_0x5c2905,_0x1aa320){var _0x13d20f={},_0x33d22e={},_0x247793={'count':0x0,'rows':[]};var _0x5933de=_[_0x0367('0x2c')](db[_0x0367('0x2d')][_0x0367('0x2e')],function(_0x4f19a0){return{'name':_0x4f19a0[_0x0367('0x2f')],'type':_0x4f19a0[_0x0367('0x30')]['key']};});_0x33d22e[_0x0367('0x31')]=_[_0x0367('0x2c')](_0x5933de,_0x0367('0x29'));_0x33d22e[_0x0367('0x32')]=_[_0x0367('0x33')](_0x5c2905['query']);_0x33d22e[_0x0367('0x34')]=_['intersection'](_0x33d22e[_0x0367('0x31')],_0x33d22e[_0x0367('0x32')]);_0x13d20f[_0x0367('0x35')]=_[_0x0367('0x36')](_0x33d22e[_0x0367('0x31')],qs[_0x0367('0x37')](_0x5c2905['query'][_0x0367('0x37')]));_0x13d20f[_0x0367('0x35')]=_0x13d20f[_0x0367('0x35')]['length']?_0x13d20f[_0x0367('0x35')]:_0x33d22e[_0x0367('0x31')];if(!_0x5c2905[_0x0367('0x32')][_0x0367('0x38')](_0x0367('0x39'))){_0x13d20f[_0x0367('0x3a')]=qs['limit'](_0x5c2905[_0x0367('0x32')]['limit']);_0x13d20f[_0x0367('0x1f')]=qs[_0x0367('0x1f')](_0x5c2905[_0x0367('0x32')]['offset']);}_0x13d20f[_0x0367('0x3b')]=qs['sort'](_0x5c2905['query'][_0x0367('0x3c')]);_0x13d20f[_0x0367('0x3d')]=qs[_0x0367('0x34')](_[_0x0367('0x3e')](_0x5c2905['query'],_0x33d22e[_0x0367('0x34')]),_0x5933de);if(_0x5c2905[_0x0367('0x32')][_0x0367('0x3f')]){_0x13d20f[_0x0367('0x3d')]=_['merge'](_0x13d20f['where'],{'$or':_[_0x0367('0x2c')](_0x5933de,function(_0x1855e9){if(_0x1855e9[_0x0367('0x30')]!==_0x0367('0x40')){var _0x6096bb={};_0x6096bb[_0x1855e9[_0x0367('0x29')]]={'$like':'%'+_0x5c2905[_0x0367('0x32')]['filter']+'%'};return _0x6096bb;}})});}_0x13d20f=_['merge']({},_0x13d20f,_0x5c2905[_0x0367('0x41')]);var _0x2e810d={'where':_0x13d20f[_0x0367('0x3d')]};return db[_0x0367('0x2d')][_0x0367('0x1e')](_0x2e810d)[_0x0367('0x26')](function(_0x316058){_0x247793[_0x0367('0x1e')]=_0x316058;if(_0x5c2905[_0x0367('0x32')]['includeAll']){_0x13d20f['include']=[{'all':!![]}];}return db[_0x0367('0x2d')][_0x0367('0x42')](_0x13d20f);})['then'](function(_0x304ce5){_0x247793['rows']=_0x304ce5;return _0x247793;})[_0x0367('0x26')](respondWithFilteredResult(_0x1aa320,_0x13d20f))[_0x0367('0x43')](handleError(_0x1aa320,null));};exports[_0x0367('0x44')]=function(_0x4dab6f,_0x133048){var _0x2c0c65={'raw':!![],'where':{'id':_0x4dab6f[_0x0367('0x45')]['id']}},_0x3d88fd={};_0x3d88fd[_0x0367('0x31')]=_['keys'](db[_0x0367('0x2d')][_0x0367('0x2e')]);_0x3d88fd[_0x0367('0x32')]=_['keys'](_0x4dab6f[_0x0367('0x32')]);_0x3d88fd[_0x0367('0x46')]=_[_0x0367('0x36')](_0x3d88fd[_0x0367('0x31')],_0x3d88fd[_0x0367('0x32')]);_0x2c0c65[_0x0367('0x35')]=_[_0x0367('0x36')](_0x3d88fd[_0x0367('0x31')],qs[_0x0367('0x37')](_0x4dab6f[_0x0367('0x32')][_0x0367('0x37')]));_0x2c0c65[_0x0367('0x35')]=_0x2c0c65[_0x0367('0x35')][_0x0367('0x47')]?_0x2c0c65[_0x0367('0x35')]:_0x3d88fd[_0x0367('0x31')];if(_0x4dab6f[_0x0367('0x32')]['includeAll']){_0x2c0c65[_0x0367('0x48')]=[{'all':!![]}];}_0x2c0c65=_[_0x0367('0x49')]({},_0x2c0c65,_0x4dab6f[_0x0367('0x41')]);return db[_0x0367('0x2d')][_0x0367('0x4a')](_0x2c0c65)['then'](handleEntityNotFound(_0x133048,null))[_0x0367('0x26')](respondWithResult(_0x133048,null))[_0x0367('0x43')](handleError(_0x133048,null));};exports[_0x0367('0x4b')]=function(_0x4cc5ec,_0x21b926){return db[_0x0367('0x2d')]['create'](_0x4cc5ec[_0x0367('0x4c')],{})['then'](respondWithResult(_0x21b926,0xc9))[_0x0367('0x43')](handleError(_0x21b926,null));};exports['update']=function(_0x2a7866,_0x49ba4f){if(_0x2a7866['body']['id']){delete _0x2a7866[_0x0367('0x4c')]['id'];}return db['JscriptySessionReport'][_0x0367('0x4a')]({'where':{'id':_0x2a7866[_0x0367('0x45')]['id']}})[_0x0367('0x26')](handleEntityNotFound(_0x49ba4f,null))[_0x0367('0x26')](saveUpdates(_0x2a7866[_0x0367('0x4c')],null))['then'](respondWithResult(_0x49ba4f,null))[_0x0367('0x43')](handleError(_0x49ba4f,null));};exports[_0x0367('0x25')]=function(_0x4d10f9,_0x3be081){return db[_0x0367('0x2d')][_0x0367('0x4a')]({'where':{'id':_0x4d10f9[_0x0367('0x45')]['id']}})[_0x0367('0x26')](handleEntityNotFound(_0x3be081,null))[_0x0367('0x26')](removeEntity(_0x3be081,null))[_0x0367('0x43')](handleError(_0x3be081,null));};exports[_0x0367('0x4d')]=function(_0x4ec930,_0x16986d){return db[_0x0367('0x2d')]['describe']()[_0x0367('0x26')](respondWithResult(_0x16986d,null))[_0x0367('0x43')](handleError(_0x16986d,null));};exports[_0x0367('0x4e')]=function(_0x4585da,_0x3b1c52,_0x65434f){var _0x4171ed={'raw':!![],'where':{}};var _0x4619c0={};var _0x3f5add={'count':0x0,'rows':[]};return db[_0x0367('0x2d')]['findOne']({'where':{'id':_0x4585da[_0x0367('0x45')]['id']}})[_0x0367('0x26')](handleEntityNotFound(_0x3b1c52,null))['then'](function(_0x536bae){if(_0x536bae){_0x4619c0[_0x0367('0x31')]=_[_0x0367('0x33')](db[_0x0367('0x4f')][_0x0367('0x2e')]);_0x4619c0['query']=_[_0x0367('0x33')](_0x4585da[_0x0367('0x32')]);_0x4619c0[_0x0367('0x34')]=_[_0x0367('0x36')](_0x4619c0[_0x0367('0x31')],_0x4619c0['query']);_0x4171ed[_0x0367('0x35')]=_[_0x0367('0x36')](_0x4619c0[_0x0367('0x31')],qs[_0x0367('0x37')](_0x4585da[_0x0367('0x32')][_0x0367('0x37')]));_0x4171ed[_0x0367('0x35')]=_0x4171ed[_0x0367('0x35')][_0x0367('0x47')]?_0x4171ed[_0x0367('0x35')]:_0x4619c0['model'];if(!_0x4585da[_0x0367('0x32')][_0x0367('0x38')]('nolimit')){_0x4171ed['limit']=qs[_0x0367('0x3a')](_0x4585da['query'][_0x0367('0x3a')]);_0x4171ed[_0x0367('0x1f')]=qs[_0x0367('0x1f')](_0x4585da[_0x0367('0x32')][_0x0367('0x1f')]);}_0x4171ed[_0x0367('0x3b')]=qs[_0x0367('0x3c')](_0x4585da['query']['sort']);_0x4171ed[_0x0367('0x3d')]=qs[_0x0367('0x34')](_[_0x0367('0x3e')](_0x4585da[_0x0367('0x32')],_0x4619c0[_0x0367('0x34')]));_0x4171ed['where'][_0x0367('0x50')]=_0x536bae['id'];if(_0x4585da['query']['filter']){_0x4171ed['where']=_[_0x0367('0x49')](_0x4171ed['where'],{'$or':_[_0x0367('0x2c')](_0x4171ed['attributes'],function(_0x2b9e7e){var _0x17d748={};_0x17d748[_0x2b9e7e]={'$like':'%'+_0x4585da['query']['filter']+'%'};return _0x17d748;})});}_0x4171ed=_[_0x0367('0x49')]({},_0x4171ed,_0x4585da['options']);return db[_0x0367('0x4f')][_0x0367('0x1e')]({'where':_0x4171ed['where']})[_0x0367('0x26')](function(_0x3c8d2e){_0x3f5add[_0x0367('0x1e')]=_0x3c8d2e;if(_0x4585da[_0x0367('0x32')][_0x0367('0x51')]){_0x4171ed[_0x0367('0x48')]=[{'all':!![]}];}return db[_0x0367('0x4f')][_0x0367('0x42')](_0x4171ed);})['then'](function(_0x3fd2d5){_0x3f5add[_0x0367('0x52')]=_0x3fd2d5;return _0x3f5add;});}})[_0x0367('0x26')](respondWithFilteredResult(_0x3b1c52,_0x4171ed))[_0x0367('0x43')](handleError(_0x3b1c52,null));}; \ No newline at end of file +var _0xfbac=['../../config/utils','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','JscriptySessionReport','rawAttributes','type','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','keys','fields','length','includeAll','find','create','body','params','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x26222d,_0x1d2de1){var _0x16bf9f=function(_0x43892a){while(--_0x43892a){_0x26222d['push'](_0x26222d['shift']());}};_0x16bf9f(++_0x1d2de1);}(_0xfbac,0x167));var _0xcfba=function(_0x2c5495,_0x42e4b5){_0x2c5495=_0x2c5495-0x0;var _0x153fd5=_0xfbac[_0x2c5495];return _0x153fd5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcfba('0x0'));var rimraf=require(_0xcfba('0x1'));var zipdir=require(_0xcfba('0x2'));var jsonpatch=require(_0xcfba('0x3'));var rp=require(_0xcfba('0x4'));var moment=require(_0xcfba('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcfba('0x6'));var path=require(_0xcfba('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcfba('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcfba('0x9'));var crypto=require('crypto');var jsforce=require(_0xcfba('0xa'));var deskjs=require(_0xcfba('0xb'));var toCsv=require('to-csv');var querystring=require(_0xcfba('0xc'));var Papa=require(_0xcfba('0xd'));var Redis=require(_0xcfba('0xe'));var authService=require(_0xcfba('0xf'));var qs=require(_0xcfba('0x10'));var as=require(_0xcfba('0x11'));var hardwareService=require(_0xcfba('0x12'));var logger=require(_0xcfba('0x13'))(_0xcfba('0x14'));var utils=require(_0xcfba('0x15'));var config=require(_0xcfba('0x16'));var licenseUtil=require(_0xcfba('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48d6f1,_0x1f590b){_0x1f590b=_0x1f590b||0xcc;return function(_0x24168c){if(_0x24168c){return _0x48d6f1['sendStatus'](_0x1f590b);}return _0x48d6f1[_0xcfba('0x18')](_0x1f590b)[_0xcfba('0x19')]();};}function respondWithResult(_0x335bfd,_0x226e89){_0x226e89=_0x226e89||0xc8;return function(_0x2333ee){if(_0x2333ee){return _0x335bfd[_0xcfba('0x18')](_0x226e89)[_0xcfba('0x1a')](_0x2333ee);}};}function respondWithFilteredResult(_0xa0508d,_0x2f497b){return function(_0x18d1d6){if(_0x18d1d6){var _0x231192=_0x18d1d6[_0xcfba('0x1b')],_0x37a850=_0x2f497b[_0xcfba('0x1c')],_0x3fa029=_0x2f497b[_0xcfba('0x1c')]+_0x2f497b[_0xcfba('0x1d')],_0x5bff45;if(_0x3fa029>=_0x231192){_0x3fa029=_0x231192;_0x5bff45=0xc8;}else{_0x5bff45=0xce;}_0xa0508d[_0xcfba('0x18')](_0x5bff45);return _0xa0508d[_0xcfba('0x1e')](_0xcfba('0x1f'),_0x37a850+'-'+_0x3fa029+'/'+_0x231192)['json'](_0x18d1d6);}return null;};}function patchUpdates(_0x116bf5){return function(_0x35c1e4){try{jsonpatch[_0xcfba('0x20')](_0x35c1e4,_0x116bf5,!![]);}catch(_0x47aa59){return BPromise['reject'](_0x47aa59);}return _0x35c1e4[_0xcfba('0x21')]();};}function saveUpdates(_0x43b745,_0x40a0df){return function(_0x467762){if(_0x467762){return _0x467762[_0xcfba('0x22')](_0x43b745)[_0xcfba('0x23')](function(_0x4a2c5e){return _0x4a2c5e;});}return null;};}function removeEntity(_0x1d4d83,_0x5d4c92){return function(_0x286d20){if(_0x286d20){return _0x286d20[_0xcfba('0x24')]()['then'](function(){_0x1d4d83[_0xcfba('0x18')](0xcc)[_0xcfba('0x19')]();});}};}function handleEntityNotFound(_0x14850f,_0x3fb061){return function(_0x5f4e17){if(!_0x5f4e17){_0x14850f['sendStatus'](0x194);}return _0x5f4e17;};}function handleError(_0x387a32,_0x119c6e){_0x119c6e=_0x119c6e||0x1f4;return function(_0x200a77){logger['error'](_0x200a77[_0xcfba('0x25')]);if(_0x200a77['name']){delete _0x200a77[_0xcfba('0x26')];}_0x387a32['status'](_0x119c6e)['send'](_0x200a77);};}exports[_0xcfba('0x27')]=function(_0x11f949,_0x5a13ae){var _0x2f7ac0={},_0x3d05c2={},_0x69bb2f={'count':0x0,'rows':[]};var _0x334d97=_[_0xcfba('0x28')](db[_0xcfba('0x29')][_0xcfba('0x2a')],function(_0x4585ec){return{'name':_0x4585ec['fieldName'],'type':_0x4585ec[_0xcfba('0x2b')]['key']};});_0x3d05c2['model']=_[_0xcfba('0x28')](_0x334d97,'name');_0x3d05c2[_0xcfba('0x2c')]=_['keys'](_0x11f949[_0xcfba('0x2c')]);_0x3d05c2[_0xcfba('0x2d')]=_[_0xcfba('0x2e')](_0x3d05c2[_0xcfba('0x2f')],_0x3d05c2[_0xcfba('0x2c')]);_0x2f7ac0[_0xcfba('0x30')]=_[_0xcfba('0x2e')](_0x3d05c2[_0xcfba('0x2f')],qs['fields'](_0x11f949['query']['fields']));_0x2f7ac0[_0xcfba('0x30')]=_0x2f7ac0[_0xcfba('0x30')]['length']?_0x2f7ac0[_0xcfba('0x30')]:_0x3d05c2['model'];if(!_0x11f949[_0xcfba('0x2c')][_0xcfba('0x31')](_0xcfba('0x32'))){_0x2f7ac0[_0xcfba('0x1d')]=qs[_0xcfba('0x1d')](_0x11f949[_0xcfba('0x2c')][_0xcfba('0x1d')]);_0x2f7ac0[_0xcfba('0x1c')]=qs['offset'](_0x11f949[_0xcfba('0x2c')][_0xcfba('0x1c')]);}_0x2f7ac0[_0xcfba('0x33')]=qs[_0xcfba('0x34')](_0x11f949[_0xcfba('0x2c')][_0xcfba('0x34')]);_0x2f7ac0[_0xcfba('0x35')]=qs['filters'](_[_0xcfba('0x36')](_0x11f949[_0xcfba('0x2c')],_0x3d05c2[_0xcfba('0x2d')]),_0x334d97);if(_0x11f949[_0xcfba('0x2c')][_0xcfba('0x37')]){_0x2f7ac0['where']=_['merge'](_0x2f7ac0[_0xcfba('0x35')],{'$or':_[_0xcfba('0x28')](_0x334d97,function(_0x476dc3){if(_0x476dc3[_0xcfba('0x2b')]!=='VIRTUAL'){var _0x40a6ae={};_0x40a6ae[_0x476dc3[_0xcfba('0x26')]]={'$like':'%'+_0x11f949['query']['filter']+'%'};return _0x40a6ae;}})});}_0x2f7ac0=_[_0xcfba('0x38')]({},_0x2f7ac0,_0x11f949[_0xcfba('0x39')]);var _0x335f28={'where':_0x2f7ac0[_0xcfba('0x35')]};return db[_0xcfba('0x29')][_0xcfba('0x1b')](_0x335f28)[_0xcfba('0x23')](function(_0x497fcc){_0x69bb2f[_0xcfba('0x1b')]=_0x497fcc;if(_0x11f949[_0xcfba('0x2c')]['includeAll']){_0x2f7ac0[_0xcfba('0x3a')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xcfba('0x3b')](_0x2f7ac0);})['then'](function(_0x3f827f){_0x69bb2f[_0xcfba('0x3c')]=_0x3f827f;return _0x69bb2f;})[_0xcfba('0x23')](respondWithFilteredResult(_0x5a13ae,_0x2f7ac0))[_0xcfba('0x3d')](handleError(_0x5a13ae,null));};exports[_0xcfba('0x3e')]=function(_0xff8dc0,_0x54f5f8){var _0x3be84d={'raw':!![],'where':{'id':_0xff8dc0['params']['id']}},_0x572971={};_0x572971[_0xcfba('0x2f')]=_[_0xcfba('0x3f')](db[_0xcfba('0x29')][_0xcfba('0x2a')]);_0x572971[_0xcfba('0x2c')]=_[_0xcfba('0x3f')](_0xff8dc0['query']);_0x572971['filtears']=_['intersection'](_0x572971[_0xcfba('0x2f')],_0x572971[_0xcfba('0x2c')]);_0x3be84d[_0xcfba('0x30')]=_[_0xcfba('0x2e')](_0x572971[_0xcfba('0x2f')],qs[_0xcfba('0x40')](_0xff8dc0[_0xcfba('0x2c')][_0xcfba('0x40')]));_0x3be84d[_0xcfba('0x30')]=_0x3be84d['attributes'][_0xcfba('0x41')]?_0x3be84d[_0xcfba('0x30')]:_0x572971[_0xcfba('0x2f')];if(_0xff8dc0[_0xcfba('0x2c')][_0xcfba('0x42')]){_0x3be84d[_0xcfba('0x3a')]=[{'all':!![]}];}_0x3be84d=_[_0xcfba('0x38')]({},_0x3be84d,_0xff8dc0['options']);return db[_0xcfba('0x29')][_0xcfba('0x43')](_0x3be84d)[_0xcfba('0x23')](handleEntityNotFound(_0x54f5f8,null))[_0xcfba('0x23')](respondWithResult(_0x54f5f8,null))['catch'](handleError(_0x54f5f8,null));};exports[_0xcfba('0x44')]=function(_0x3d5dd6,_0x3090d2){return db[_0xcfba('0x29')][_0xcfba('0x44')](_0x3d5dd6[_0xcfba('0x45')],{})[_0xcfba('0x23')](respondWithResult(_0x3090d2,0xc9))['catch'](handleError(_0x3090d2,null));};exports['update']=function(_0x11ad05,_0x10ad7f){if(_0x11ad05[_0xcfba('0x45')]['id']){delete _0x11ad05[_0xcfba('0x45')]['id'];}return db[_0xcfba('0x29')][_0xcfba('0x43')]({'where':{'id':_0x11ad05['params']['id']}})['then'](handleEntityNotFound(_0x10ad7f,null))['then'](saveUpdates(_0x11ad05[_0xcfba('0x45')],null))['then'](respondWithResult(_0x10ad7f,null))[_0xcfba('0x3d')](handleError(_0x10ad7f,null));};exports[_0xcfba('0x24')]=function(_0x39f0e6,_0x1eabb5){return db['JscriptySessionReport']['find']({'where':{'id':_0x39f0e6[_0xcfba('0x46')]['id']}})[_0xcfba('0x23')](handleEntityNotFound(_0x1eabb5,null))[_0xcfba('0x23')](removeEntity(_0x1eabb5,null))[_0xcfba('0x3d')](handleError(_0x1eabb5,null));};exports[_0xcfba('0x47')]=function(_0x1918c7,_0x3eab35){return db[_0xcfba('0x29')]['describe']()['then'](respondWithResult(_0x3eab35,null))[_0xcfba('0x3d')](handleError(_0x3eab35,null));};exports[_0xcfba('0x48')]=function(_0x358477,_0x1193c3,_0x47056f){var _0x187711={'raw':!![],'where':{}};var _0x3fc544={};var _0x3c76a4={'count':0x0,'rows':[]};return db[_0xcfba('0x29')][_0xcfba('0x49')]({'where':{'id':_0x358477[_0xcfba('0x46')]['id']}})[_0xcfba('0x23')](handleEntityNotFound(_0x1193c3,null))[_0xcfba('0x23')](function(_0xbf1c0a){if(_0xbf1c0a){_0x3fc544['model']=_['keys'](db[_0xcfba('0x4a')][_0xcfba('0x2a')]);_0x3fc544[_0xcfba('0x2c')]=_[_0xcfba('0x3f')](_0x358477['query']);_0x3fc544[_0xcfba('0x2d')]=_[_0xcfba('0x2e')](_0x3fc544[_0xcfba('0x2f')],_0x3fc544['query']);_0x187711[_0xcfba('0x30')]=_[_0xcfba('0x2e')](_0x3fc544[_0xcfba('0x2f')],qs['fields'](_0x358477[_0xcfba('0x2c')][_0xcfba('0x40')]));_0x187711[_0xcfba('0x30')]=_0x187711[_0xcfba('0x30')]['length']?_0x187711['attributes']:_0x3fc544[_0xcfba('0x2f')];if(!_0x358477[_0xcfba('0x2c')]['hasOwnProperty']('nolimit')){_0x187711[_0xcfba('0x1d')]=qs['limit'](_0x358477[_0xcfba('0x2c')][_0xcfba('0x1d')]);_0x187711[_0xcfba('0x1c')]=qs['offset'](_0x358477[_0xcfba('0x2c')][_0xcfba('0x1c')]);}_0x187711[_0xcfba('0x33')]=qs[_0xcfba('0x34')](_0x358477['query'][_0xcfba('0x34')]);_0x187711[_0xcfba('0x35')]=qs[_0xcfba('0x2d')](_[_0xcfba('0x36')](_0x358477[_0xcfba('0x2c')],_0x3fc544[_0xcfba('0x2d')]));_0x187711['where'][_0xcfba('0x4b')]=_0xbf1c0a['id'];if(_0x358477[_0xcfba('0x2c')][_0xcfba('0x37')]){_0x187711['where']=_[_0xcfba('0x38')](_0x187711['where'],{'$or':_[_0xcfba('0x28')](_0x187711[_0xcfba('0x30')],function(_0xa8ee59){var _0x43ea7c={};_0x43ea7c[_0xa8ee59]={'$like':'%'+_0x358477['query'][_0xcfba('0x37')]+'%'};return _0x43ea7c;})});}_0x187711=_[_0xcfba('0x38')]({},_0x187711,_0x358477[_0xcfba('0x39')]);return db[_0xcfba('0x4a')]['count']({'where':_0x187711[_0xcfba('0x35')]})['then'](function(_0xb9d1bf){_0x3c76a4[_0xcfba('0x1b')]=_0xb9d1bf;if(_0x358477[_0xcfba('0x2c')][_0xcfba('0x42')]){_0x187711[_0xcfba('0x3a')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xcfba('0x3b')](_0x187711);})['then'](function(_0x4112d6){_0x3c76a4[_0xcfba('0x3c')]=_0x4112d6;return _0x3c76a4;});}})[_0xcfba('0x23')](respondWithFilteredResult(_0x1193c3,_0x187711))[_0xcfba('0x3d')](handleError(_0x1193c3,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index d70886d..cffd176 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 _0x76fa=['JscriptySessionReport','util','../../config/logger','api','moment','request-promise','path','rimraf','./jscriptySessionReport.attributes','exports','define'];(function(_0x3744a7,_0x275890){var _0x451d1a=function(_0x4917a2){while(--_0x4917a2){_0x3744a7['push'](_0x3744a7['shift']());}};_0x451d1a(++_0x275890);}(_0x76fa,0x1e5));var _0xa76f=function(_0x2a7983,_0x44aa9d){_0x2a7983=_0x2a7983-0x0;var _0xd55f99=_0x76fa[_0x2a7983];return _0xd55f99;};'use strict';var _=require('lodash');var util=require(_0xa76f('0x0'));var logger=require(_0xa76f('0x1'))(_0xa76f('0x2'));var moment=require(_0xa76f('0x3'));var BPromise=require('bluebird');var rp=require(_0xa76f('0x4'));var fs=require('fs');var path=require(_0xa76f('0x5'));var rimraf=require(_0xa76f('0x6'));var config=require('../../config/environment');var attributes=require(_0xa76f('0x7'));module[_0xa76f('0x8')]=function(_0x3f9450,_0xf075f2){return _0x3f9450[_0xa76f('0x9')](_0xa76f('0xa'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3642=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash','util'];(function(_0x4fd5e,_0x55e839){var _0x5ebd78=function(_0x3b406a){while(--_0x3b406a){_0x4fd5e['push'](_0x4fd5e['shift']());}};_0x5ebd78(++_0x55e839);}(_0x3642,0x1ab));var _0x2364=function(_0x36940e,_0x11f338){_0x36940e=_0x36940e-0x0;var _0x3283f2=_0x3642[_0x36940e];return _0x3283f2;};'use strict';var _=require(_0x2364('0x0'));var util=require(_0x2364('0x1'));var logger=require(_0x2364('0x2'))(_0x2364('0x3'));var moment=require(_0x2364('0x4'));var BPromise=require(_0x2364('0x5'));var rp=require(_0x2364('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2364('0x7'));var config=require(_0x2364('0x8'));var attributes=require(_0x2364('0x9'));module[_0x2364('0xa')]=function(_0x19f120,_0x43fd7d){return _0x19f120[_0x2364('0xb')](_0x2364('0xc'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index e5c5c8a..b7a0e31 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 _0x0e7a=['jayson/promise','client','http','request','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x0e7a,0xff));var _0xa0e7=function(_0x3a7618,_0x58a9b9){_0x3a7618=_0x3a7618-0x0;var _0x9fc98=_0x0e7a[_0x3a7618];return _0x9fc98;};'use strict';var _=require(_0xa0e7('0x0'));var util=require(_0xa0e7('0x1'));var moment=require(_0xa0e7('0x2'));var BPromise=require(_0xa0e7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa0e7('0x4'));var db=require(_0xa0e7('0x5'))['db'];var utils=require(_0xa0e7('0x6'));var logger=require(_0xa0e7('0x7'))(_0xa0e7('0x8'));var config=require('../../config/environment');var jayson=require(_0xa0e7('0x9'));var client=jayson[_0xa0e7('0xa')][_0xa0e7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fab03,_0x44559b,_0x147631){return new BPromise(function(_0x3a1986,_0x4f7a98){return client[_0xa0e7('0xc')](_0x3fab03,_0x147631)['then'](function(_0xdab967){logger[_0xa0e7('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x44559b,_0xa0e7('0xe'));logger[_0xa0e7('0xf')](_0xa0e7('0x10'),_0x44559b,_0xa0e7('0xe'),JSON[_0xa0e7('0x11')](_0xdab967));if(_0xdab967[_0xa0e7('0x12')]){if(_0xdab967[_0xa0e7('0x12')][_0xa0e7('0x13')]===0x1f4){logger[_0xa0e7('0x12')](_0xa0e7('0x14'),_0x44559b,_0xdab967['error'][_0xa0e7('0x15')]);return _0x4f7a98(_0xdab967[_0xa0e7('0x12')][_0xa0e7('0x15')]);}logger[_0xa0e7('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x44559b,_0xdab967['error'][_0xa0e7('0x15')]);return _0x3a1986(_0xdab967[_0xa0e7('0x12')][_0xa0e7('0x15')]);}else{logger[_0xa0e7('0xd')](_0xa0e7('0x14'),_0x44559b,_0xa0e7('0xe'));_0x3a1986(_0xdab967[_0xa0e7('0x16')]['message']);}})[_0xa0e7('0x17')](function(_0x5dd012){logger[_0xa0e7('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x44559b,_0x5dd012);_0x4f7a98(_0x5dd012);});});} \ No newline at end of file +var _0x4343=['debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x23746a,_0x3f83d0){var _0x4abfed=function(_0x3e9505){while(--_0x3e9505){_0x23746a['push'](_0x23746a['shift']());}};_0x4abfed(++_0x3f83d0);}(_0x4343,0x158));var _0x3434=function(_0x2ff24e,_0x58cdb6){_0x2ff24e=_0x2ff24e-0x0;var _0x420a66=_0x4343[_0x2ff24e];return _0x420a66;};'use strict';var _=require(_0x3434('0x0'));var util=require('util');var moment=require(_0x3434('0x1'));var BPromise=require(_0x3434('0x2'));var rs=require(_0x3434('0x3'));var fs=require('fs');var Redis=require(_0x3434('0x4'));var db=require(_0x3434('0x5'))['db'];var utils=require(_0x3434('0x6'));var logger=require(_0x3434('0x7'))('rpc');var config=require(_0x3434('0x8'));var jayson=require(_0x3434('0x9'));var client=jayson[_0x3434('0xa')][_0x3434('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56145b,_0x5b1528,_0x17525d){return new BPromise(function(_0xb886da,_0x1ea9f1){return client['request'](_0x56145b,_0x17525d)[_0x3434('0xc')](function(_0x4aaa6c){logger[_0x3434('0xd')](_0x3434('0xe'),_0x5b1528,_0x3434('0xf'));logger[_0x3434('0x10')](_0x3434('0x11'),_0x5b1528,_0x3434('0xf'),JSON[_0x3434('0x12')](_0x4aaa6c));if(_0x4aaa6c[_0x3434('0x13')]){if(_0x4aaa6c[_0x3434('0x13')][_0x3434('0x14')]===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x5b1528,_0x4aaa6c['error']['message']);return _0x1ea9f1(_0x4aaa6c['error'][_0x3434('0x15')]);}logger['error'](_0x3434('0xe'),_0x5b1528,_0x4aaa6c[_0x3434('0x13')][_0x3434('0x15')]);return _0xb886da(_0x4aaa6c[_0x3434('0x13')][_0x3434('0x15')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x5b1528,_0x3434('0xf'));_0xb886da(_0x4aaa6c[_0x3434('0x16')][_0x3434('0x15')]);}})[_0x3434('0x17')](function(_0xbc143f){logger[_0x3434('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x5b1528,_0xbc143f);_0x1ea9f1(_0xbc143f);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index a349c75..aeb57a2 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 _0xaad2=['update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','put','/:id','isAuthenticated'];(function(_0x46e394,_0xa143a){var _0x45f020=function(_0x4d56ca){while(--_0x4d56ca){_0x46e394['push'](_0x46e394['shift']());}};_0x45f020(++_0xa143a);}(_0xaad2,0x188));var _0x2aad=function(_0x3df9dd,_0x26f5cd){_0x3df9dd=_0x3df9dd-0x0;var _0x4f11e4=_0xaad2[_0x3df9dd];return _0x4f11e4;};'use strict';var multer=require('multer');var util=require(_0x2aad('0x0'));var path=require(_0x2aad('0x1'));var timeout=require(_0x2aad('0x2'));var express=require(_0x2aad('0x3'));var router=express[_0x2aad('0x4')]();var auth=require(_0x2aad('0x5'));var interaction=require(_0x2aad('0x6'));var config=require(_0x2aad('0x7'));var controller=require('./license.controller');router[_0x2aad('0x8')]('/',controller[_0x2aad('0x9')]);router[_0x2aad('0xa')](_0x2aad('0xb'),auth[_0x2aad('0xc')](),controller[_0x2aad('0xd')]);module[_0x2aad('0xe')]=router; \ No newline at end of file +var _0xb0dd=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','put','/:id','isAuthenticated','update'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0xb0dd,0x119));var _0xdb0d=function(_0x563436,_0x369432){_0x563436=_0x563436-0x0;var _0x2cdf05=_0xb0dd[_0x563436];return _0x2cdf05;};'use strict';var multer=require(_0xdb0d('0x0'));var util=require(_0xdb0d('0x1'));var path=require(_0xdb0d('0x2'));var timeout=require('connect-timeout');var express=require(_0xdb0d('0x3'));var router=express[_0xdb0d('0x4')]();var auth=require(_0xdb0d('0x5'));var interaction=require(_0xdb0d('0x6'));var config=require(_0xdb0d('0x7'));var controller=require(_0xdb0d('0x8'));router['get']('/',controller['index']);router[_0xdb0d('0x9')](_0xdb0d('0xa'),auth[_0xdb0d('0xb')](),controller[_0xdb0d('0xc')]);module[_0xdb0d('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 9db52de..93fe0a6 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 _0x1cb9=['STRING','INTEGER','sequelize','TEXT'];(function(_0x58df05,_0x8d2b65){var _0xcf0a07=function(_0x283d60){while(--_0x283d60){_0x58df05['push'](_0x58df05['shift']());}};_0xcf0a07(++_0x8d2b65);}(_0x1cb9,0x14e));var _0x91cb=function(_0x28443d,_0x51c748){_0x28443d=_0x28443d-0x0;var _0x5f1651=_0x1cb9[_0x28443d];return _0x5f1651;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'license':{'type':Sequelize[_0x91cb('0x1')]},'data1':{'type':Sequelize[_0x91cb('0x2')]},'data2':{'type':Sequelize[_0x91cb('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x91cb('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5fab=['exports','STRING','INTEGER','sequelize'];(function(_0x4f851d,_0xeccdf4){var _0x59e183=function(_0xf803b3){while(--_0xf803b3){_0x4f851d['push'](_0x4f851d['shift']());}};_0x59e183(++_0xeccdf4);}(_0x5fab,0x177));var _0xb5fa=function(_0x5e43d3,_0x4ac566){_0x5e43d3=_0x5e43d3-0x0;var _0x374f2e=_0x5fab[_0x5e43d3];return _0x374f2e;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xb5fa('0x2')]},'data2':{'type':Sequelize[_0xb5fa('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xb5fa('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 8af8766..972b05e 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 _0xfb82=['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/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','json','apply','reject','save','then','destroy','error','stack','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','length','merge','options','getLicense','body','find','params','get','checkLicense','key','demo','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x32c22e,_0x3beffd){var _0x32cfc6=function(_0x5ee9cc){while(--_0x5ee9cc){_0x32c22e['push'](_0x32c22e['shift']());}};_0x32cfc6(++_0x3beffd);}(_0xfb82,0x17f));var _0x2fb8=function(_0x529c0f,_0x93ab24){_0x529c0f=_0x529c0f-0x0;var _0x581205=_0xfb82[_0x529c0f];return _0x581205;};'use strict';var pdf=require(_0x2fb8('0x0'));var emlformat=require(_0x2fb8('0x1'));var rimraf=require(_0x2fb8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2fb8('0x3'));var rp=require(_0x2fb8('0x4'));var moment=require('moment');var BPromise=require(_0x2fb8('0x5'));var Mustache=require(_0x2fb8('0x6'));var util=require(_0x2fb8('0x7'));var path=require(_0x2fb8('0x8'));var sox=require(_0x2fb8('0x9'));var csv=require(_0x2fb8('0xa'));var ejs=require(_0x2fb8('0xb'));var fs=require('fs');var _=require(_0x2fb8('0xc'));var squel=require(_0x2fb8('0xd'));var crypto=require(_0x2fb8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2fb8('0xf'));var toCsv=require(_0x2fb8('0xa'));var querystring=require(_0x2fb8('0x10'));var Papa=require(_0x2fb8('0x11'));var Redis=require(_0x2fb8('0x12'));var authService=require(_0x2fb8('0x13'));var qs=require(_0x2fb8('0x14'));var as=require(_0x2fb8('0x15'));var hardwareService=require(_0x2fb8('0x16'));var logger=require(_0x2fb8('0x17'))(_0x2fb8('0x18'));var utils=require('../../config/utils');var config=require(_0x2fb8('0x19'));var licenseUtil=require(_0x2fb8('0x1a'));var db=require(_0x2fb8('0x1b'))['db'];function respondWithStatusCode(_0xab96fc,_0x54cc1d){_0x54cc1d=_0x54cc1d||0xcc;return function(_0x58d8ff){if(_0x58d8ff){return _0xab96fc[_0x2fb8('0x1c')](_0x54cc1d);}return _0xab96fc['status'](_0x54cc1d)[_0x2fb8('0x1d')]();};}function respondWithResult(_0x4e70f9,_0x5cb3ec){_0x5cb3ec=_0x5cb3ec||0xc8;return function(_0x222e0d){if(_0x222e0d){return _0x4e70f9[_0x2fb8('0x1e')](_0x5cb3ec)['json'](_0x222e0d);}};}function respondWithFilteredResult(_0x59f271,_0x205dd8){return function(_0x392d31){if(_0x392d31){var _0x3fa923=_0x392d31[_0x2fb8('0x1f')],_0x42a607=_0x205dd8['offset'],_0x55337d=_0x205dd8[_0x2fb8('0x20')]+_0x205dd8[_0x2fb8('0x21')],_0x3fda1b;if(_0x55337d>=_0x3fa923){_0x55337d=_0x3fa923;_0x3fda1b=0xc8;}else{_0x3fda1b=0xce;}_0x59f271[_0x2fb8('0x1e')](_0x3fda1b);return _0x59f271['set']('Content-Range',_0x42a607+'-'+_0x55337d+'/'+_0x3fa923)[_0x2fb8('0x22')](_0x392d31);}return null;};}function patchUpdates(_0x56b338){return function(_0x428292){try{jsonpatch[_0x2fb8('0x23')](_0x428292,_0x56b338,!![]);}catch(_0x49396f){return BPromise[_0x2fb8('0x24')](_0x49396f);}return _0x428292[_0x2fb8('0x25')]();};}function saveUpdates(_0x1aa17e,_0x18f5ed){return function(_0x2f7768){if(_0x2f7768){return _0x2f7768['update'](_0x1aa17e)[_0x2fb8('0x26')](function(_0x1e28cd){return _0x1e28cd;});}return null;};}function removeEntity(_0x3890f3,_0x564fb3){return function(_0x4a4576){if(_0x4a4576){return _0x4a4576[_0x2fb8('0x27')]()[_0x2fb8('0x26')](function(){_0x3890f3[_0x2fb8('0x1e')](0xcc)[_0x2fb8('0x1d')]();});}};}function handleEntityNotFound(_0x475883,_0x4d6a94){return function(_0x33e50e){if(!_0x33e50e){_0x475883[_0x2fb8('0x1c')](0x194);}return _0x33e50e;};}function handleError(_0x3f3399,_0x38c0dc){_0x38c0dc=_0x38c0dc||0x1f4;return function(_0x3bfc46){logger[_0x2fb8('0x28')](_0x3bfc46[_0x2fb8('0x29')]);if(_0x3bfc46['name']){delete _0x3bfc46[_0x2fb8('0x2a')];}_0x3f3399['status'](_0x38c0dc)[_0x2fb8('0x2b')](_0x3bfc46);};}var utilLicense=require(_0x2fb8('0x1a'));exports[_0x2fb8('0x2c')]=function(_0x3b86de,_0x2054c9){var _0x2b779c={'raw':!![],'where':{'id':0x1}},_0x98892e={};_0x98892e[_0x2fb8('0x2d')]=_[_0x2fb8('0x2e')](db[_0x2fb8('0x2f')][_0x2fb8('0x30')]);_0x98892e[_0x2fb8('0x31')]=_[_0x2fb8('0x2e')](_0x3b86de[_0x2fb8('0x31')]);_0x98892e[_0x2fb8('0x32')]=_[_0x2fb8('0x33')](_0x98892e['model'],_0x98892e['query']);_0x2b779c[_0x2fb8('0x34')]=_[_0x2fb8('0x33')](_0x98892e['model'],qs['fields'](_0x3b86de[_0x2fb8('0x31')]['fields']));_0x2b779c['attributes']=_0x2b779c[_0x2fb8('0x34')][_0x2fb8('0x35')]?_0x2b779c[_0x2fb8('0x34')]:_0x98892e[_0x2fb8('0x2d')];_0x2b779c=_[_0x2fb8('0x36')]({},_0x2b779c,_0x3b86de[_0x2fb8('0x37')]);return utilLicense[_0x2fb8('0x38')](_0x2b779c)[_0x2fb8('0x26')](respondWithResult(_0x2054c9,null))['catch'](handleError(_0x2054c9,null));};exports['update']=function(_0x40b851,_0x7a1729){if(_0x40b851[_0x2fb8('0x39')]['id']){delete _0x40b851[_0x2fb8('0x39')]['id'];}return db[_0x2fb8('0x2f')][_0x2fb8('0x3a')]({'where':{'id':_0x40b851[_0x2fb8('0x3b')]['id']}})['then'](handleEntityNotFound(_0x7a1729,null))[_0x2fb8('0x26')](function(_0x12ca46){var _0x4602cf=_0x12ca46[_0x2fb8('0x3c')]({'plain':!![]});return utilLicense[_0x2fb8('0x3d')](_0x4602cf,_0x40b851[_0x2fb8('0x39')][_0x2fb8('0x3e')]);})['then'](function(_0xfb1c5b){if(!_0xfb1c5b[_0x2fb8('0x3f')]){return saveUpdates(_0x40b851[_0x2fb8('0x39')],null);}return _0xfb1c5b;})['then'](respondWithResult(_0x7a1729,null))[_0x2fb8('0x40')](handleError(_0x7a1729,null));}; \ No newline at end of file +var _0x10dc=['limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','../../config/license/util','index','model','License','query','intersection','attributes','fields','length','merge','options','catch','update','body','find','params','get','checkLicense','key','demo','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x4ac1d9,_0x2d792c){var _0x444401=function(_0x4436f8){while(--_0x4436f8){_0x4ac1d9['push'](_0x4ac1d9['shift']());}};_0x444401(++_0x2d792c);}(_0x10dc,0x107));var _0xc10d=function(_0x5a9130,_0x1a32f3){_0x5a9130=_0x5a9130-0x0;var _0x53580d=_0x10dc[_0x5a9130];return _0x53580d;};'use strict';var pdf=require(_0xc10d('0x0'));var emlformat=require(_0xc10d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc10d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc10d('0x3'));var moment=require(_0xc10d('0x4'));var BPromise=require(_0xc10d('0x5'));var Mustache=require(_0xc10d('0x6'));var util=require(_0xc10d('0x7'));var path=require(_0xc10d('0x8'));var sox=require(_0xc10d('0x9'));var csv=require(_0xc10d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc10d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc10d('0xc'));var deskjs=require(_0xc10d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc10d('0xe'));var Redis=require(_0xc10d('0xf'));var authService=require(_0xc10d('0x10'));var qs=require(_0xc10d('0x11'));var as=require(_0xc10d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc10d('0x13'));var utils=require('../../config/utils');var config=require(_0xc10d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc10d('0x15'))['db'];function respondWithStatusCode(_0x4c763c,_0xe5a687){_0xe5a687=_0xe5a687||0xcc;return function(_0xeaa75f){if(_0xeaa75f){return _0x4c763c[_0xc10d('0x16')](_0xe5a687);}return _0x4c763c[_0xc10d('0x17')](_0xe5a687)[_0xc10d('0x18')]();};}function respondWithResult(_0x511ef8,_0x382ed0){_0x382ed0=_0x382ed0||0xc8;return function(_0x517c43){if(_0x517c43){return _0x511ef8[_0xc10d('0x17')](_0x382ed0)[_0xc10d('0x19')](_0x517c43);}};}function respondWithFilteredResult(_0x3cfa24,_0x42b006){return function(_0x3fc902){if(_0x3fc902){var _0x163e1c=_0x3fc902['count'],_0x45de57=_0x42b006[_0xc10d('0x1a')],_0x3210a8=_0x42b006[_0xc10d('0x1a')]+_0x42b006[_0xc10d('0x1b')],_0x4f6352;if(_0x3210a8>=_0x163e1c){_0x3210a8=_0x163e1c;_0x4f6352=0xc8;}else{_0x4f6352=0xce;}_0x3cfa24[_0xc10d('0x17')](_0x4f6352);return _0x3cfa24[_0xc10d('0x1c')](_0xc10d('0x1d'),_0x45de57+'-'+_0x3210a8+'/'+_0x163e1c)[_0xc10d('0x19')](_0x3fc902);}return null;};}function patchUpdates(_0x382452){return function(_0x2688d2){try{jsonpatch[_0xc10d('0x1e')](_0x2688d2,_0x382452,!![]);}catch(_0x28f7b5){return BPromise[_0xc10d('0x1f')](_0x28f7b5);}return _0x2688d2[_0xc10d('0x20')]();};}function saveUpdates(_0x49d9d5,_0x1f2321){return function(_0x812a5e){if(_0x812a5e){return _0x812a5e['update'](_0x49d9d5)[_0xc10d('0x21')](function(_0x382843){return _0x382843;});}return null;};}function removeEntity(_0x489b64,_0xeb6db6){return function(_0x4f8b05){if(_0x4f8b05){return _0x4f8b05['destroy']()[_0xc10d('0x21')](function(){_0x489b64['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7dd427,_0x3c206c){return function(_0x2ded8c){if(!_0x2ded8c){_0x7dd427[_0xc10d('0x16')](0x194);}return _0x2ded8c;};}function handleError(_0x25c6c5,_0x557c38){_0x557c38=_0x557c38||0x1f4;return function(_0x572959){logger[_0xc10d('0x22')](_0x572959[_0xc10d('0x23')]);if(_0x572959[_0xc10d('0x24')]){delete _0x572959[_0xc10d('0x24')];}_0x25c6c5['status'](_0x557c38)[_0xc10d('0x25')](_0x572959);};}var utilLicense=require(_0xc10d('0x26'));exports[_0xc10d('0x27')]=function(_0x4fc35d,_0x54e830){var _0xabef03={'raw':!![],'where':{'id':0x1}},_0x21ccbb={};_0x21ccbb[_0xc10d('0x28')]=_['keys'](db[_0xc10d('0x29')]['rawAttributes']);_0x21ccbb[_0xc10d('0x2a')]=_['keys'](_0x4fc35d['query']);_0x21ccbb['filters']=_[_0xc10d('0x2b')](_0x21ccbb[_0xc10d('0x28')],_0x21ccbb[_0xc10d('0x2a')]);_0xabef03[_0xc10d('0x2c')]=_['intersection'](_0x21ccbb[_0xc10d('0x28')],qs[_0xc10d('0x2d')](_0x4fc35d[_0xc10d('0x2a')][_0xc10d('0x2d')]));_0xabef03[_0xc10d('0x2c')]=_0xabef03[_0xc10d('0x2c')][_0xc10d('0x2e')]?_0xabef03[_0xc10d('0x2c')]:_0x21ccbb[_0xc10d('0x28')];_0xabef03=_[_0xc10d('0x2f')]({},_0xabef03,_0x4fc35d[_0xc10d('0x30')]);return utilLicense['getLicense'](_0xabef03)[_0xc10d('0x21')](respondWithResult(_0x54e830,null))[_0xc10d('0x31')](handleError(_0x54e830,null));};exports[_0xc10d('0x32')]=function(_0xf6128,_0x23c6e2){if(_0xf6128[_0xc10d('0x33')]['id']){delete _0xf6128['body']['id'];}return db['License'][_0xc10d('0x34')]({'where':{'id':_0xf6128[_0xc10d('0x35')]['id']}})[_0xc10d('0x21')](handleEntityNotFound(_0x23c6e2,null))[_0xc10d('0x21')](function(_0x297906){var _0x32a33a=_0x297906[_0xc10d('0x36')]({'plain':!![]});return utilLicense[_0xc10d('0x37')](_0x32a33a,_0xf6128[_0xc10d('0x33')][_0xc10d('0x38')]);})[_0xc10d('0x21')](function(_0x397451){if(!_0x397451[_0xc10d('0x39')]){return saveUpdates(_0xf6128[_0xc10d('0x33')],null);}return _0x397451;})['then'](respondWithResult(_0x23c6e2,null))[_0xc10d('0x31')](handleError(_0x23c6e2,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index d7662be..8c1813a 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 _0xffa2=['rimraf','../../config/environment','./license.attributes','exports','define','License','lodash','util','moment','bluebird','request-promise'];(function(_0x27883d,_0x1f7a1e){var _0x3be2fe=function(_0x2a38d3){while(--_0x2a38d3){_0x27883d['push'](_0x27883d['shift']());}};_0x3be2fe(++_0x1f7a1e);}(_0xffa2,0x150));var _0x2ffa=function(_0x49ac7f,_0x551640){_0x49ac7f=_0x49ac7f-0x0;var _0xd99282=_0xffa2[_0x49ac7f];return _0xd99282;};'use strict';var _=require(_0x2ffa('0x0'));var util=require(_0x2ffa('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2ffa('0x2'));var BPromise=require(_0x2ffa('0x3'));var rp=require(_0x2ffa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2ffa('0x5'));var config=require(_0x2ffa('0x6'));var attributes=require(_0x2ffa('0x7'));module[_0x2ffa('0x8')]=function(_0x3c092b,_0x595e10){return _0x3c092b[_0x2ffa('0x9')](_0x2ffa('0xa'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee24=['License','license','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./license.attributes','exports','define'];(function(_0xa68d79,_0x47afe4){var _0x4927eb=function(_0x5e8f19){while(--_0x5e8f19){_0xa68d79['push'](_0xa68d79['shift']());}};_0x4927eb(++_0x47afe4);}(_0xee24,0x1a6));var _0x4ee2=function(_0x1fe005,_0x21b0c8){_0x1fe005=_0x1fe005-0x0;var _0x166592=_0xee24[_0x1fe005];return _0x166592;};'use strict';var _=require('lodash');var util=require(_0x4ee2('0x0'));var logger=require(_0x4ee2('0x1'))('api');var moment=require(_0x4ee2('0x2'));var BPromise=require(_0x4ee2('0x3'));var rp=require(_0x4ee2('0x4'));var fs=require('fs');var path=require(_0x4ee2('0x5'));var rimraf=require('rimraf');var config=require(_0x4ee2('0x6'));var attributes=require(_0x4ee2('0x7'));module[_0x4ee2('0x8')]=function(_0x1993de,_0x5c778f){return _0x1993de[_0x4ee2('0x9')](_0x4ee2('0xa'),attributes,{'tableName':_0x4ee2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 54f3fbd..0edb5be 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 _0x50c1=['message','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5c38cd,_0x5a6b4e){var _0xc985ef=function(_0x4aa1df){while(--_0x4aa1df){_0x5c38cd['push'](_0x5c38cd['shift']());}};_0xc985ef(++_0x5a6b4e);}(_0x50c1,0x1a5));var _0x150c=function(_0x42fa3a,_0x22b315){_0x42fa3a=_0x42fa3a-0x0;var _0x344c2f=_0x50c1[_0x42fa3a];return _0x344c2f;};'use strict';var _=require(_0x150c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x150c('0x1'));var rs=require(_0x150c('0x2'));var fs=require('fs');var Redis=require(_0x150c('0x3'));var db=require(_0x150c('0x4'))['db'];var utils=require(_0x150c('0x5'));var logger=require(_0x150c('0x6'))(_0x150c('0x7'));var config=require(_0x150c('0x8'));var jayson=require(_0x150c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x367215,_0x55833c,_0x5b10b4){return new BPromise(function(_0xb16344,_0x2c8053){return client[_0x150c('0xa')](_0x367215,_0x5b10b4)[_0x150c('0xb')](function(_0x17b609){logger[_0x150c('0xc')](_0x150c('0xd'),_0x55833c,_0x150c('0xe'));logger[_0x150c('0xf')](_0x150c('0x10'),_0x55833c,'request\x20sent',JSON[_0x150c('0x11')](_0x17b609));if(_0x17b609[_0x150c('0x12')]){if(_0x17b609[_0x150c('0x12')]['code']===0x1f4){logger[_0x150c('0x12')]('License,\x20%s,\x20%s',_0x55833c,_0x17b609['error'][_0x150c('0x13')]);return _0x2c8053(_0x17b609[_0x150c('0x12')][_0x150c('0x13')]);}logger[_0x150c('0x12')](_0x150c('0xd'),_0x55833c,_0x17b609[_0x150c('0x12')][_0x150c('0x13')]);return _0xb16344(_0x17b609[_0x150c('0x12')][_0x150c('0x13')]);}else{logger[_0x150c('0xc')](_0x150c('0xd'),_0x55833c,_0x150c('0xe'));_0xb16344(_0x17b609['result'][_0x150c('0x13')]);}})['catch'](function(_0x338759){logger['error']('License,\x20%s,\x20%s',_0x55833c,_0x338759);_0x2c8053(_0x338759);});});} \ No newline at end of file +var _0xc2e8=['client','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x510c60,_0x50247e){var _0x49c4aa=function(_0x3149c7){while(--_0x3149c7){_0x510c60['push'](_0x510c60['shift']());}};_0x49c4aa(++_0x50247e);}(_0xc2e8,0x70));var _0x8c2e=function(_0x5a9148,_0x221b2f){_0x5a9148=_0x5a9148-0x0;var _0x275ab1=_0xc2e8[_0x5a9148];return _0x275ab1;};'use strict';var _=require(_0x8c2e('0x0'));var util=require(_0x8c2e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8c2e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c2e('0x3'))['db'];var utils=require(_0x8c2e('0x4'));var logger=require(_0x8c2e('0x5'))('rpc');var config=require(_0x8c2e('0x6'));var jayson=require(_0x8c2e('0x7'));var client=jayson[_0x8c2e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bf5d0,_0x4b8f44,_0x487731){return new BPromise(function(_0x4abd39,_0xcc200c){return client[_0x8c2e('0x9')](_0x4bf5d0,_0x487731)[_0x8c2e('0xa')](function(_0x331e6d){logger[_0x8c2e('0xb')](_0x8c2e('0xc'),_0x4b8f44,_0x8c2e('0xd'));logger[_0x8c2e('0xe')]('License,\x20%s,\x20%s,\x20%s',_0x4b8f44,_0x8c2e('0xd'),JSON[_0x8c2e('0xf')](_0x331e6d));if(_0x331e6d[_0x8c2e('0x10')]){if(_0x331e6d['error']['code']===0x1f4){logger['error'](_0x8c2e('0xc'),_0x4b8f44,_0x331e6d[_0x8c2e('0x10')][_0x8c2e('0x11')]);return _0xcc200c(_0x331e6d[_0x8c2e('0x10')][_0x8c2e('0x11')]);}logger[_0x8c2e('0x10')](_0x8c2e('0xc'),_0x4b8f44,_0x331e6d['error']['message']);return _0x4abd39(_0x331e6d[_0x8c2e('0x10')][_0x8c2e('0x11')]);}else{logger[_0x8c2e('0xb')](_0x8c2e('0xc'),_0x4b8f44,_0x8c2e('0xd'));_0x4abd39(_0x331e6d[_0x8c2e('0x12')]['message']);}})[_0x8c2e('0x13')](function(_0x10d610){logger[_0x8c2e('0x10')](_0x8c2e('0xc'),_0x4b8f44,_0x10d610);_0xcc200c(_0x10d610);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 23f90af..564d931 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 _0x0618=['isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','getAnswers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/canned_answers','create','/:id/in_servers','addInteraction','addApplications','send','put','/:id','update','delete','removeAnswers','removeImap','destroy','removeAgents','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailAccount.controller','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0618,0x1c6));var _0x8061=function(_0x570294,_0x139ae4){_0x570294=_0x570294-0x0;var _0x41b542=_0x0618[_0x570294];return _0x41b542;};'use strict';var multer=require(_0x8061('0x0'));var util=require(_0x8061('0x1'));var path=require('path');var timeout=require(_0x8061('0x2'));var express=require(_0x8061('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8061('0x4'));var config=require(_0x8061('0x5'));var controller=require(_0x8061('0x6'));router[_0x8061('0x7')]('/',auth[_0x8061('0x8')](),controller[_0x8061('0x9')]);router[_0x8061('0x7')](_0x8061('0xa'),auth[_0x8061('0x8')](),controller[_0x8061('0xb')]);router[_0x8061('0x7')]('/:id',auth[_0x8061('0x8')](),controller['show']);router[_0x8061('0x7')](_0x8061('0xc'),auth[_0x8061('0x8')](),controller[_0x8061('0xd')]);router[_0x8061('0x7')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x8061('0xe')]);router[_0x8061('0x7')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x8061('0xf')]);router[_0x8061('0x7')](_0x8061('0x10'),auth[_0x8061('0x8')](),controller[_0x8061('0x11')]);router[_0x8061('0x7')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x8061('0x12')]);router[_0x8061('0x7')](_0x8061('0x13'),auth[_0x8061('0x8')](),controller['getApplications']);router['get'](_0x8061('0x14'),auth[_0x8061('0x8')](),controller[_0x8061('0x15')]);router[_0x8061('0x7')](_0x8061('0x16'),auth[_0x8061('0x8')](),controller[_0x8061('0x17')]);router[_0x8061('0x7')](_0x8061('0x18'),auth[_0x8061('0x8')](),controller[_0x8061('0x19')]);router[_0x8061('0x1a')](_0x8061('0xc'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x8061('0x1a')](_0x8061('0x1b'),auth[_0x8061('0x8')](),controller['addAnswer']);router['post']('/',auth[_0x8061('0x8')](),controller[_0x8061('0x1c')]);router[_0x8061('0x1a')](_0x8061('0x1d'),auth['isAuthenticated'](),controller['addImap']);router[_0x8061('0x1a')](_0x8061('0x10'),auth['isAuthenticated'](),controller['addSmtp']);router[_0x8061('0x1a')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x8061('0x1e')]);router[_0x8061('0x1a')]('/:id/applications',auth['isAuthenticated'](),controller[_0x8061('0x1f')]);router[_0x8061('0x1a')]('/:id/send',auth[_0x8061('0x8')](),controller[_0x8061('0x20')]);router[_0x8061('0x1a')](_0x8061('0x18'),auth['isAuthenticated'](),controller['addAgents']);router[_0x8061('0x21')](_0x8061('0x22'),auth[_0x8061('0x8')](),controller[_0x8061('0x23')]);router[_0x8061('0x24')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x8061('0x1b'),auth[_0x8061('0x8')](),controller[_0x8061('0x25')]);router[_0x8061('0x24')](_0x8061('0x1d'),auth[_0x8061('0x8')](),controller[_0x8061('0x26')]);router[_0x8061('0x24')](_0x8061('0x10'),auth[_0x8061('0x8')](),controller['removeSmtp']);router['delete'](_0x8061('0x22'),auth[_0x8061('0x8')](),controller[_0x8061('0x27')]);router[_0x8061('0x24')](_0x8061('0x18'),auth['isAuthenticated'](),controller[_0x8061('0x28')]);module[_0x8061('0x29')]=router; \ No newline at end of file +var _0xa24d=['/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addAnswer','create','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','send','put','update','/:id/dispositions','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getImap','getSmtp','/:id/interactions','getInteractions'];(function(_0x31295c,_0x2f2b82){var _0x2c150e=function(_0x957f1){while(--_0x957f1){_0x31295c['push'](_0x31295c['shift']());}};_0x2c150e(++_0x2f2b82);}(_0xa24d,0x1c1));var _0xda24=function(_0x99facc,_0x548cd6){_0x99facc=_0x99facc-0x0;var _0xd39ed0=_0xa24d[_0x99facc];return _0xd39ed0;};'use strict';var multer=require(_0xda24('0x0'));var util=require(_0xda24('0x1'));var path=require(_0xda24('0x2'));var timeout=require(_0xda24('0x3'));var express=require(_0xda24('0x4'));var router=express[_0xda24('0x5')]();var auth=require(_0xda24('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xda24('0x7'));var controller=require(_0xda24('0x8'));router[_0xda24('0x9')]('/',auth[_0xda24('0xa')](),controller['index']);router[_0xda24('0x9')](_0xda24('0xb'),auth['isAuthenticated'](),controller[_0xda24('0xc')]);router['get'](_0xda24('0xd'),auth[_0xda24('0xa')](),controller[_0xda24('0xe')]);router[_0xda24('0x9')]('/:id/dispositions',auth[_0xda24('0xa')](),controller[_0xda24('0xf')]);router[_0xda24('0x9')](_0xda24('0x10'),auth[_0xda24('0xa')](),controller['getAnswers']);router[_0xda24('0x9')]('/:id/in_servers',auth[_0xda24('0xa')](),controller[_0xda24('0x11')]);router['get']('/:id/out_servers',auth[_0xda24('0xa')](),controller[_0xda24('0x12')]);router[_0xda24('0x9')](_0xda24('0x13'),auth['isAuthenticated'](),controller[_0xda24('0x14')]);router['get'](_0xda24('0x15'),auth[_0xda24('0xa')](),controller['getApplications']);router['get'](_0xda24('0x16'),auth[_0xda24('0xa')](),controller[_0xda24('0x17')]);router[_0xda24('0x9')](_0xda24('0x18'),auth[_0xda24('0xa')](),controller[_0xda24('0x19')]);router[_0xda24('0x9')](_0xda24('0x1a'),auth['isAuthenticated'](),controller[_0xda24('0x1b')]);router[_0xda24('0x1c')]('/:id/dispositions',auth[_0xda24('0xa')](),controller['addDisposition']);router['post'](_0xda24('0x10'),auth[_0xda24('0xa')](),controller[_0xda24('0x1d')]);router[_0xda24('0x1c')]('/',auth[_0xda24('0xa')](),controller[_0xda24('0x1e')]);router[_0xda24('0x1c')]('/:id/in_servers',auth[_0xda24('0xa')](),controller['addImap']);router[_0xda24('0x1c')](_0xda24('0x1f'),auth[_0xda24('0xa')](),controller[_0xda24('0x20')]);router[_0xda24('0x1c')](_0xda24('0x13'),auth[_0xda24('0xa')](),controller[_0xda24('0x21')]);router[_0xda24('0x1c')](_0xda24('0x15'),auth[_0xda24('0xa')](),controller[_0xda24('0x22')]);router['post'](_0xda24('0x23'),auth[_0xda24('0xa')](),controller[_0xda24('0x24')]);router[_0xda24('0x1c')](_0xda24('0x1a'),auth[_0xda24('0xa')](),controller['addAgents']);router[_0xda24('0x25')]('/:id',auth[_0xda24('0xa')](),controller[_0xda24('0x26')]);router['delete'](_0xda24('0x27'),auth[_0xda24('0xa')](),controller['removeDispositions']);router[_0xda24('0x28')](_0xda24('0x10'),auth[_0xda24('0xa')](),controller[_0xda24('0x29')]);router[_0xda24('0x28')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xda24('0x2a')]);router['delete']('/:id/out_servers',auth[_0xda24('0xa')](),controller[_0xda24('0x2b')]);router['delete']('/:id',auth[_0xda24('0xa')](),controller[_0xda24('0x2c')]);router['delete']('/:id/users',auth[_0xda24('0xa')](),controller[_0xda24('0x2d')]);module[_0xda24('0x2e')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index f7314e2..7cc77ff 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 _0x784c=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x482fa3,_0x12e47e){var _0x12dab9=function(_0x1396fc){while(--_0x1396fc){_0x482fa3['push'](_0x482fa3['shift']());}};_0x12dab9(++_0x12e47e);}(_0x784c,0x106));var _0xc784=function(_0x4043cd,_0x23e938){_0x4043cd=_0x4043cd-0x0;var _0x4a7341=_0x784c[_0x4043cd];return _0x4a7341;};'use strict';var Sequelize=require(_0xc784('0x0'));module['exports']={'description':{'type':Sequelize[_0xc784('0x1')]},'name':{'type':Sequelize[_0xc784('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xc784('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xc784('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xc784('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xc784('0x3')]},'markAsUnread':{'type':Sequelize[_0xc784('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xc784('0x1')],'allowNull':![],'defaultValue':_0xc784('0x4')},'fontSize':{'type':Sequelize[_0xc784('0x5')](0x2)[_0xc784('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xc784('0x3')],'defaultValue':function(){return _0xc784('0x7');}},'notificationSound':{'type':Sequelize[_0xc784('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc784('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc784('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc784('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc784('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc784('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc784('0x2')],'defaultValue':![],'comment':_0xc784('0x8'),'set':function(_0x4f7f61){if(!_0x4f7f61)this['setDataValue'](_0xc784('0x9'),null);this['setDataValue']('mandatoryDisposition',_0x4f7f61);}}}; \ No newline at end of file +var _0xd27d=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif'];(function(_0x9a591d,_0x3c61f6){var _0x12d228=function(_0x21d45a){while(--_0x21d45a){_0x9a591d['push'](_0x9a591d['shift']());}};_0x12d228(++_0x3c61f6);}(_0xd27d,0x10e));var _0xdd27=function(_0x39fdad,_0x1b8980){_0x39fdad=_0x39fdad-0x0;var _0x2089a1=_0xd27d[_0x39fdad];return _0x2089a1;};'use strict';var Sequelize=require(_0xdd27('0x0'));module[_0xdd27('0x1')]={'description':{'type':Sequelize[_0xdd27('0x2')]},'name':{'type':Sequelize[_0xdd27('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xdd27('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xdd27('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xdd27('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xdd27('0x4')]},'markAsUnread':{'type':Sequelize[_0xdd27('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xdd27('0x2')],'allowNull':![],'defaultValue':_0xdd27('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xdd27('0x4')],'defaultValue':function(){return _0xdd27('0x6');}},'notificationSound':{'type':Sequelize[_0xdd27('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdd27('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdd27('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdd27('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdd27('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdd27('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xdd27('0x3')],'defaultValue':![],'comment':_0xdd27('0x8'),'set':function(_0x23d659){if(!_0x23d659)this[_0xdd27('0x9')](_0xdd27('0xa'),null);this[_0xdd27('0x9')](_0xdd27('0xb'),_0x23d659);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 25003ea..7a99f19 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 _0x1762=['body','find','MailServerIn','MailAccountId','Disposition','create','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','cauthentication','user','cuser','pass','authentication','host','port','cservice','password','cpassword','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','Owner','internal','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','format','split','CmList','List','CmContact','Contacts','updatedAt','from','attachments','root','service','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','ValidationError','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','MailAccounts','UserProfileResource','stack','send','index','MailServerOut','Smtp','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','key','model','map','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','includeAll','include','findAll','rows','show','params','Imap','keys','options'];(function(_0x30d60e,_0x57405c){var _0xb6b320=function(_0x2eff63){while(--_0x2eff63){_0x30d60e['push'](_0x30d60e['shift']());}};_0xb6b320(++_0x57405c);}(_0x1762,0x11a));var _0x2176=function(_0x581814,_0x1a3246){_0x581814=_0x581814-0x0;var _0x557505=_0x1762[_0x581814];return _0x557505;};'use strict';var pdf=require(_0x2176('0x0'));var emlformat=require(_0x2176('0x1'));var rimraf=require(_0x2176('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2176('0x3'));var rp=require(_0x2176('0x4'));var moment=require(_0x2176('0x5'));var BPromise=require(_0x2176('0x6'));var Mustache=require(_0x2176('0x7'));var util=require('util');var path=require(_0x2176('0x8'));var sox=require('sox');var csv=require(_0x2176('0x9'));var ejs=require(_0x2176('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2176('0xb'));var crypto=require(_0x2176('0xc'));var jsforce=require(_0x2176('0xd'));var deskjs=require(_0x2176('0xe'));var toCsv=require(_0x2176('0x9'));var querystring=require(_0x2176('0xf'));var Papa=require(_0x2176('0x10'));var Redis=require(_0x2176('0x11'));var authService=require(_0x2176('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2176('0x13'));var hardwareService=require(_0x2176('0x14'));var logger=require(_0x2176('0x15'))(_0x2176('0x16'));var utils=require(_0x2176('0x17'));var config=require(_0x2176('0x18'));var licenseUtil=require(_0x2176('0x19'));var db=require(_0x2176('0x1a'))['db'];config[_0x2176('0x1b')]=_[_0x2176('0x1c')](config[_0x2176('0x1b')],{'host':_0x2176('0x1d'),'port':0x18eb});var socket=require(_0x2176('0x1e'))(new Redis(config['redis']));require(_0x2176('0x1f'))['register'](socket);var jayson=require(_0x2176('0x20'));var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x3fc60c,_0x21e636,_0x314657,_0x81aa05){return new BPromise(function(_0x209f64,_0x4a59b4){var _0x470a17=_0x81aa05||client;return _0x470a17[_0x2176('0x21')](_0x3fc60c,_0x314657)['then'](function(_0x5afbb8){logger[_0x2176('0x22')](_0x2176('0x23'),_0x21e636,_0x2176('0x24'));logger[_0x2176('0x25')](_0x2176('0x26'),_0x21e636,_0x2176('0x24'),JSON[_0x2176('0x27')](_0x5afbb8));if(_0x5afbb8[_0x2176('0x28')]){if(_0x5afbb8[_0x2176('0x28')][_0x2176('0x29')]===0x1f4){logger[_0x2176('0x28')](_0x2176('0x23'),_0x21e636,_0x5afbb8[_0x2176('0x28')][_0x2176('0x2a')]);return _0x4a59b4(_0x5afbb8[_0x2176('0x28')][_0x2176('0x2a')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x21e636,_0x5afbb8[_0x2176('0x28')][_0x2176('0x2a')]);return _0x209f64(_0x5afbb8['error'][_0x2176('0x2a')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x21e636,_0x2176('0x24'));_0x209f64(_0x5afbb8[_0x2176('0x2b')][_0x2176('0x2a')]);}})[_0x2176('0x2c')](function(_0x43c809){logger[_0x2176('0x28')](_0x2176('0x23'),_0x21e636,_0x43c809);_0x4a59b4(_0x43c809);});});}function respondWithStatusCode(_0x476d36,_0x820f65){_0x820f65=_0x820f65||0xcc;return function(_0x1491d9){if(_0x1491d9){return _0x476d36[_0x2176('0x2d')](_0x820f65);}return _0x476d36['status'](_0x820f65)[_0x2176('0x2e')]();};}function respondWithResult(_0x2f3bcb,_0x22f44e){_0x22f44e=_0x22f44e||0xc8;return function(_0x458f15){if(_0x458f15){return _0x2f3bcb[_0x2176('0x2f')](_0x22f44e)[_0x2176('0x30')](_0x458f15);}};}function respondWithFilteredResult(_0x2b6fbc,_0x2908ec){return function(_0x286106){if(_0x286106){var _0x3abcbb=_0x286106[_0x2176('0x31')],_0x2f890e=_0x2908ec[_0x2176('0x32')],_0x2012ae=_0x2908ec[_0x2176('0x32')]+_0x2908ec[_0x2176('0x33')],_0x34b483;if(_0x2012ae>=_0x3abcbb){_0x2012ae=_0x3abcbb;_0x34b483=0xc8;}else{_0x34b483=0xce;}_0x2b6fbc[_0x2176('0x2f')](_0x34b483);return _0x2b6fbc[_0x2176('0x34')](_0x2176('0x35'),_0x2f890e+'-'+_0x2012ae+'/'+_0x3abcbb)[_0x2176('0x30')](_0x286106);}return null;};}function patchUpdates(_0x1ec02e){return function(_0x396e92){try{jsonpatch[_0x2176('0x36')](_0x396e92,_0x1ec02e,!![]);}catch(_0x5e35d1){return BPromise[_0x2176('0x37')](_0x5e35d1);}return _0x396e92[_0x2176('0x38')]();};}function saveUpdates(_0x2ec326,_0x4173a7){return function(_0x17a01f){if(_0x17a01f){return _0x17a01f[_0x2176('0x39')](_0x2ec326)[_0x2176('0x3a')](function(_0xb3c6b8){return _0xb3c6b8;});}return null;};}function removeEntity(_0x2e0b0a,_0x19d515){return function(_0x443b5d){if(_0x443b5d){return _0x443b5d[_0x2176('0x3b')]()['then'](function(){var _0x101563=_0x443b5d['get']({'plain':!![]});var _0x4fa680=_0x2176('0x3c');return db[_0x2176('0x3d')][_0x2176('0x3b')]({'where':{'type':_0x4fa680,'resourceId':_0x101563['id']}})[_0x2176('0x3a')](function(){return _0x443b5d;});})['then'](function(){_0x2e0b0a[_0x2176('0x2f')](0xcc)[_0x2176('0x2e')]();});}};}function handleEntityNotFound(_0xe2d65d,_0xba7a63){return function(_0xe9edd6){if(!_0xe9edd6){_0xe2d65d[_0x2176('0x2d')](0x194);}return _0xe9edd6;};}function handleError(_0x1772f9,_0x2cbe9b){_0x2cbe9b=_0x2cbe9b||0x1f4;return function(_0x35ff1d){logger[_0x2176('0x28')](_0x35ff1d[_0x2176('0x3e')]);if(_0x35ff1d['name']){delete _0x35ff1d['name'];}_0x1772f9['status'](_0x2cbe9b)[_0x2176('0x3f')](_0x35ff1d);};}exports[_0x2176('0x40')]=function(_0x1a14d8,_0x11d06d){var _0x2cd4f6={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x2176('0x41')],'as':_0x2176('0x42')},{'model':db[_0x2176('0x43')],'as':_0x2176('0x44')}]},_0x59e9d8={},_0x2f2057={'count':0x0,'rows':[]};var _0x37f43c=_['map'](db[_0x2176('0x45')][_0x2176('0x46')],function(_0x1ef93e){return{'name':_0x1ef93e[_0x2176('0x47')],'type':_0x1ef93e['type'][_0x2176('0x48')]};});_0x59e9d8[_0x2176('0x49')]=_[_0x2176('0x4a')](_0x37f43c,'name');_0x59e9d8['query']=_['keys'](_0x1a14d8['query']);_0x59e9d8[_0x2176('0x4b')]=_[_0x2176('0x4c')](_0x59e9d8[_0x2176('0x49')],_0x59e9d8[_0x2176('0x4d')]);_0x2cd4f6['attributes']=_[_0x2176('0x4c')](_0x59e9d8[_0x2176('0x49')],qs[_0x2176('0x4e')](_0x1a14d8[_0x2176('0x4d')][_0x2176('0x4e')]));_0x2cd4f6[_0x2176('0x4f')]=_0x2cd4f6[_0x2176('0x4f')][_0x2176('0x50')]?_0x2cd4f6['attributes']:_0x59e9d8['model'];if(!_0x1a14d8[_0x2176('0x4d')][_0x2176('0x51')](_0x2176('0x52'))){_0x2cd4f6[_0x2176('0x33')]=qs[_0x2176('0x33')](_0x1a14d8[_0x2176('0x4d')][_0x2176('0x33')]);_0x2cd4f6[_0x2176('0x32')]=qs[_0x2176('0x32')](_0x1a14d8[_0x2176('0x4d')][_0x2176('0x32')]);}_0x2cd4f6[_0x2176('0x53')]=qs[_0x2176('0x54')](_0x1a14d8[_0x2176('0x4d')][_0x2176('0x54')]);_0x2cd4f6[_0x2176('0x55')]=qs[_0x2176('0x4b')](_[_0x2176('0x56')](_0x1a14d8[_0x2176('0x4d')],_0x59e9d8[_0x2176('0x4b')]),_0x37f43c);if(_0x1a14d8[_0x2176('0x4d')][_0x2176('0x57')]){_0x2cd4f6['where']=_[_0x2176('0x58')](_0x2cd4f6[_0x2176('0x55')],{'$or':_[_0x2176('0x4a')](_0x37f43c,function(_0x2ed1c8){if(_0x2ed1c8['type']!==_0x2176('0x59')){var _0x249760={};_0x249760[_0x2ed1c8[_0x2176('0x5a')]]={'$like':'%'+_0x1a14d8[_0x2176('0x4d')][_0x2176('0x57')]+'%'};return _0x249760;}})});}_0x2cd4f6=_['merge']({},_0x2cd4f6,_0x1a14d8['options']);var _0x1579cd={'where':_0x2cd4f6[_0x2176('0x55')]};return db[_0x2176('0x45')][_0x2176('0x31')](_0x1579cd)[_0x2176('0x3a')](function(_0xcf7b88){_0x2f2057[_0x2176('0x31')]=_0xcf7b88;if(_0x1a14d8['query'][_0x2176('0x5b')]){_0x2cd4f6[_0x2176('0x5c')]=[{'all':!![]}];}return db[_0x2176('0x45')][_0x2176('0x5d')](_0x2cd4f6);})[_0x2176('0x3a')](function(_0x5b0ba4){_0x2f2057[_0x2176('0x5e')]=_0x5b0ba4;return _0x2f2057;})[_0x2176('0x3a')](respondWithFilteredResult(_0x11d06d,_0x2cd4f6))[_0x2176('0x2c')](handleError(_0x11d06d,null));};exports[_0x2176('0x5f')]=function(_0x994218,_0x1d270b){var _0x4b7a49={'raw':![],'where':{'id':_0x994218[_0x2176('0x60')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x2176('0x61')},{'model':db[_0x2176('0x41')],'as':_0x2176('0x42')},{'model':db[_0x2176('0x43')],'as':_0x2176('0x44')}]},_0x2d47b6={};_0x2d47b6[_0x2176('0x49')]=_[_0x2176('0x62')](db[_0x2176('0x45')][_0x2176('0x46')]);_0x2d47b6[_0x2176('0x4d')]=_[_0x2176('0x62')](_0x994218['query']);_0x2d47b6['filtears']=_[_0x2176('0x4c')](_0x2d47b6[_0x2176('0x49')],_0x2d47b6[_0x2176('0x4d')]);_0x4b7a49[_0x2176('0x4f')]=_['intersection'](_0x2d47b6['model'],qs['fields'](_0x994218[_0x2176('0x4d')][_0x2176('0x4e')]));_0x4b7a49[_0x2176('0x4f')]=_0x4b7a49[_0x2176('0x4f')]['length']?_0x4b7a49[_0x2176('0x4f')]:_0x2d47b6[_0x2176('0x49')];if(_0x994218[_0x2176('0x4d')][_0x2176('0x5b')]){_0x4b7a49[_0x2176('0x5c')]=[{'all':!![]}];}_0x4b7a49=_[_0x2176('0x58')]({},_0x4b7a49,_0x994218[_0x2176('0x63')]);return db['MailAccount']['find'](_0x4b7a49)[_0x2176('0x3a')](handleEntityNotFound(_0x1d270b,null))[_0x2176('0x3a')](respondWithResult(_0x1d270b,null))[_0x2176('0x2c')](handleError(_0x1d270b,null));};exports['update']=function(_0x29619c,_0x4c55a7){if(_0x29619c[_0x2176('0x64')]['id']){delete _0x29619c[_0x2176('0x64')]['id'];}return db[_0x2176('0x45')][_0x2176('0x65')]({'where':{'id':_0x29619c['params']['id']},'include':[{'model':db[_0x2176('0x66')],'as':'Imap'},{'model':db[_0x2176('0x41')],'as':_0x2176('0x42')},{'model':db[_0x2176('0x43')],'as':_0x2176('0x44')}]})[_0x2176('0x3a')](handleEntityNotFound(_0x4c55a7,null))['then'](saveUpdates(_0x29619c['body'],null))[_0x2176('0x3a')](function(_0x58b58b){if(_0x58b58b&&_0x29619c['body'][_0x2176('0x61')]){return db[_0x2176('0x66')]['update'](_0x29619c[_0x2176('0x64')][_0x2176('0x61')],{'where':{'MailAccountId':_0x58b58b['id']}})['then'](function(){return _0x58b58b;});}return _0x58b58b;})[_0x2176('0x3a')](function(_0x2b5a05){if(_0x2b5a05&&_0x29619c[_0x2176('0x64')][_0x2176('0x42')]){return db['MailServerOut'][_0x2176('0x39')](_0x29619c['body'][_0x2176('0x42')],{'where':{'MailAccountId':_0x2b5a05['id']}})[_0x2176('0x3a')](function(){return _0x2b5a05;});}return _0x2b5a05;})[_0x2176('0x3a')](respondWithResult(_0x4c55a7,null))[_0x2176('0x2c')](handleError(_0x4c55a7,null));};exports['describe']=function(_0x311a39,_0x47cf73){return db[_0x2176('0x45')]['describe']()[_0x2176('0x3a')](respondWithResult(_0x47cf73,null))[_0x2176('0x2c')](handleError(_0x47cf73,null));};exports['addDisposition']=function(_0x2fab61,_0x2ef89c,_0x7d0c32){if(_0x2fab61[_0x2176('0x64')]['id']){delete _0x2fab61[_0x2176('0x64')]['id'];}return db[_0x2176('0x45')][_0x2176('0x65')]({'where':{'id':_0x2fab61['params']['id']}})[_0x2176('0x3a')](handleEntityNotFound(_0x2ef89c,null))['then'](function(_0x829e50){if(_0x829e50){_0x2fab61[_0x2176('0x64')][_0x2176('0x67')]=_0x829e50['id'];return db[_0x2176('0x68')][_0x2176('0x69')](_0x2fab61[_0x2176('0x64')]);}})[_0x2176('0x3a')](respondWithResult(_0x2ef89c,null))[_0x2176('0x2c')](handleError(_0x2ef89c,null));};exports['getDispositions']=function(_0x82388c,_0x5b91a8,_0x2280a4){var _0x35adbc={'raw':![],'where':{}};var _0x19f4d4={};var _0x5512fd={'count':0x0,'rows':[]};return db[_0x2176('0x45')][_0x2176('0x6a')]({'where':{'id':_0x82388c['params']['id']}})[_0x2176('0x3a')](handleEntityNotFound(_0x5b91a8,null))['then'](function(_0x249663){if(_0x249663){_0x19f4d4[_0x2176('0x49')]=_[_0x2176('0x62')](db[_0x2176('0x68')][_0x2176('0x46')]);_0x19f4d4[_0x2176('0x4d')]=_[_0x2176('0x62')](_0x82388c[_0x2176('0x4d')]);_0x19f4d4[_0x2176('0x4b')]=_[_0x2176('0x4c')](_0x19f4d4[_0x2176('0x49')],_0x19f4d4[_0x2176('0x4d')]);_0x35adbc['attributes']=_[_0x2176('0x4c')](_0x19f4d4[_0x2176('0x49')],qs[_0x2176('0x4e')](_0x82388c[_0x2176('0x4d')][_0x2176('0x4e')]));_0x35adbc[_0x2176('0x4f')]=_0x35adbc['attributes'][_0x2176('0x50')]?_0x35adbc['attributes']:_0x19f4d4['model'];if(!_0x82388c[_0x2176('0x4d')][_0x2176('0x51')](_0x2176('0x52'))){_0x35adbc['limit']=qs[_0x2176('0x33')](_0x82388c[_0x2176('0x4d')]['limit']);_0x35adbc[_0x2176('0x32')]=qs[_0x2176('0x32')](_0x82388c[_0x2176('0x4d')][_0x2176('0x32')]);}_0x35adbc[_0x2176('0x53')]=qs['sort'](_0x82388c[_0x2176('0x4d')][_0x2176('0x54')]);_0x35adbc[_0x2176('0x55')]=qs[_0x2176('0x4b')](_[_0x2176('0x56')](_0x82388c[_0x2176('0x4d')],_0x19f4d4['filters']));_0x35adbc[_0x2176('0x55')][_0x2176('0x67')]=_0x249663['id'];if(_0x82388c[_0x2176('0x4d')][_0x2176('0x57')]){_0x35adbc['where']=_[_0x2176('0x58')](_0x35adbc[_0x2176('0x55')],{'$or':_['map'](_0x35adbc['attributes'],function(_0x1d9896){var _0x55fab5={};_0x55fab5[_0x1d9896]={'$like':'%'+_0x82388c['query'][_0x2176('0x57')]+'%'};return _0x55fab5;})});}_0x35adbc=_[_0x2176('0x58')]({},_0x35adbc,_0x82388c[_0x2176('0x63')]);return db[_0x2176('0x68')][_0x2176('0x31')]({'where':_0x35adbc[_0x2176('0x55')]})[_0x2176('0x3a')](function(_0x36c9d1){_0x5512fd[_0x2176('0x31')]=_0x36c9d1;if(_0x82388c[_0x2176('0x4d')][_0x2176('0x5b')]){_0x35adbc[_0x2176('0x5c')]=[{'all':!![]}];}return db[_0x2176('0x68')][_0x2176('0x5d')](_0x35adbc);})['then'](function(_0x80e47d){_0x5512fd['rows']=_0x80e47d;return _0x5512fd;});}})['then'](respondWithFilteredResult(_0x5b91a8,_0x35adbc))[_0x2176('0x2c')](handleError(_0x5b91a8,null));};exports['removeDispositions']=function(_0x45e0a3,_0x1fdb24,_0x33085e){return db[_0x2176('0x45')][_0x2176('0x65')]({'where':{'id':_0x45e0a3[_0x2176('0x60')]['id']}})[_0x2176('0x3a')](handleEntityNotFound(_0x1fdb24,null))[_0x2176('0x3a')](function(_0x4615dc){if(_0x4615dc){return _0x4615dc[_0x2176('0x6b')](_0x45e0a3[_0x2176('0x4d')][_0x2176('0x6c')]);}})[_0x2176('0x3a')](respondWithStatusCode(_0x1fdb24,null))[_0x2176('0x2c')](handleError(_0x1fdb24,null));};exports[_0x2176('0x6d')]=function(_0x2bf141,_0x3720a2,_0x4214fe){if(_0x2bf141[_0x2176('0x64')]['id']){delete _0x2bf141['body']['id'];}return db[_0x2176('0x45')][_0x2176('0x65')]({'where':{'id':_0x2bf141[_0x2176('0x60')]['id']}})[_0x2176('0x3a')](handleEntityNotFound(_0x3720a2,null))[_0x2176('0x3a')](function(_0x46b424){if(_0x46b424){_0x2bf141[_0x2176('0x64')]['MailAccountId']=_0x46b424['id'];return db[_0x2176('0x6e')][_0x2176('0x69')](_0x2bf141[_0x2176('0x64')]);}})[_0x2176('0x3a')](respondWithResult(_0x3720a2,null))[_0x2176('0x2c')](handleError(_0x3720a2,null));};exports[_0x2176('0x6f')]=function(_0x14cbfd,_0x488c1b,_0x18981e){var _0x3b8198={'raw':![],'where':{}};var _0x1b2711={};var _0x2c55bc={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x14cbfd[_0x2176('0x60')]['id']}})['then'](handleEntityNotFound(_0x488c1b,null))[_0x2176('0x3a')](function(_0x5a3c66){if(_0x5a3c66){_0x1b2711[_0x2176('0x49')]=_[_0x2176('0x62')](db[_0x2176('0x6e')][_0x2176('0x46')]);_0x1b2711[_0x2176('0x4d')]=_[_0x2176('0x62')](_0x14cbfd[_0x2176('0x4d')]);_0x1b2711['filters']=_['intersection'](_0x1b2711[_0x2176('0x49')],_0x1b2711[_0x2176('0x4d')]);_0x3b8198[_0x2176('0x4f')]=_[_0x2176('0x4c')](_0x1b2711[_0x2176('0x49')],qs['fields'](_0x14cbfd['query'][_0x2176('0x4e')]));_0x3b8198['attributes']=_0x3b8198[_0x2176('0x4f')]['length']?_0x3b8198[_0x2176('0x4f')]:_0x1b2711[_0x2176('0x49')];if(!_0x14cbfd[_0x2176('0x4d')][_0x2176('0x51')](_0x2176('0x52'))){_0x3b8198[_0x2176('0x33')]=qs[_0x2176('0x33')](_0x14cbfd['query'][_0x2176('0x33')]);_0x3b8198['offset']=qs['offset'](_0x14cbfd[_0x2176('0x4d')][_0x2176('0x32')]);}_0x3b8198[_0x2176('0x53')]=qs[_0x2176('0x54')](_0x14cbfd[_0x2176('0x4d')][_0x2176('0x54')]);_0x3b8198[_0x2176('0x55')]=qs[_0x2176('0x4b')](_[_0x2176('0x56')](_0x14cbfd[_0x2176('0x4d')],_0x1b2711[_0x2176('0x4b')]));_0x3b8198[_0x2176('0x55')][_0x2176('0x67')]=_0x5a3c66['id'];if(_0x14cbfd[_0x2176('0x4d')][_0x2176('0x57')]){_0x3b8198[_0x2176('0x55')]=_[_0x2176('0x58')](_0x3b8198['where'],{'$or':_['map'](_0x3b8198['attributes'],function(_0x536eaa){var _0x34be64={};_0x34be64[_0x536eaa]={'$like':'%'+_0x14cbfd[_0x2176('0x4d')]['filter']+'%'};return _0x34be64;})});}_0x3b8198=_['merge']({},_0x3b8198,_0x14cbfd[_0x2176('0x63')]);return db[_0x2176('0x6e')][_0x2176('0x31')]({'where':_0x3b8198[_0x2176('0x55')]})[_0x2176('0x3a')](function(_0x105064){_0x2c55bc['count']=_0x105064;if(_0x14cbfd[_0x2176('0x4d')][_0x2176('0x5b')]){_0x3b8198[_0x2176('0x5c')]=[{'all':!![]}];}return db[_0x2176('0x6e')][_0x2176('0x5d')](_0x3b8198);})[_0x2176('0x3a')](function(_0x1a2296){_0x2c55bc[_0x2176('0x5e')]=_0x1a2296;return _0x2c55bc;});}})[_0x2176('0x3a')](respondWithFilteredResult(_0x488c1b,_0x3b8198))[_0x2176('0x2c')](handleError(_0x488c1b,null));};exports[_0x2176('0x70')]=function(_0x529bc8,_0xa72054,_0x222f93){return db[_0x2176('0x45')][_0x2176('0x65')]({'where':{'id':_0x529bc8[_0x2176('0x60')]['id']}})[_0x2176('0x3a')](handleEntityNotFound(_0xa72054,null))[_0x2176('0x3a')](function(_0x551a73){if(_0x551a73){return _0x551a73[_0x2176('0x70')](_0x529bc8[_0x2176('0x4d')][_0x2176('0x6c')]);}})[_0x2176('0x3a')](respondWithStatusCode(_0xa72054,null))[_0x2176('0x2c')](handleError(_0xa72054,null));};exports[_0x2176('0x69')]=function(_0x4e9221,_0x40be0d){var _0xdbc46b={'name':_0x4e9221[_0x2176('0x64')][_0x2176('0x5a')],'key':_0x4e9221[_0x2176('0x64')][_0x2176('0x48')],'email':_0x4e9221[_0x2176('0x64')][_0x2176('0x71')],'ListId':_0x4e9221[_0x2176('0x64')][_0x2176('0x72')],'active':!_[_0x2176('0x73')](_0x4e9221[_0x2176('0x64')][_0x2176('0x74')])?_0x4e9221[_0x2176('0x64')][_0x2176('0x74')]:!![],'description':_0x4e9221[_0x2176('0x64')][_0x2176('0x75')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x4e9221[_0x2176('0x64')]['cservice'])){if(_0x4e9221[_0x2176('0x64')][_0x2176('0x76')]){_0xdbc46b['Imap'][_0x2176('0x77')]=_0xdbc46b[_0x2176('0x42')][_0x2176('0x77')]=_0x4e9221['body'][_0x2176('0x78')];_0xdbc46b[_0x2176('0x61')]['password']=_0xdbc46b[_0x2176('0x42')][_0x2176('0x79')]=_0x4e9221['body']['cpassword'];}else{_0xdbc46b[_0x2176('0x61')][_0x2176('0x7a')]=_0xdbc46b[_0x2176('0x42')]['authentication']=![];}_0xdbc46b['Imap'][_0x2176('0x7b')]=_0x4e9221[_0x2176('0x64')][_0x2176('0x61')]['host'];_0xdbc46b[_0x2176('0x61')][_0x2176('0x7c')]=_0x4e9221['body'][_0x2176('0x61')][_0x2176('0x7c')];_0xdbc46b['Smtp']['host']=_0x4e9221['body'][_0x2176('0x42')][_0x2176('0x7b')];_0xdbc46b[_0x2176('0x42')]['port']=_0x4e9221[_0x2176('0x64')][_0x2176('0x42')][_0x2176('0x7c')];}else{_0xdbc46b[_0x2176('0x61')]['service']=_0xdbc46b['Smtp']['service']=_0x4e9221[_0x2176('0x64')][_0x2176('0x7d')];_0xdbc46b[_0x2176('0x61')][_0x2176('0x77')]=_0xdbc46b[_0x2176('0x42')][_0x2176('0x77')]=_0x4e9221['body'][_0x2176('0x78')];_0xdbc46b[_0x2176('0x61')][_0x2176('0x7e')]=_0xdbc46b[_0x2176('0x42')]['pass']=_0x4e9221[_0x2176('0x64')][_0x2176('0x7f')];}return db[_0x2176('0x45')][_0x2176('0x69')](_0xdbc46b,{'include':[{'model':db[_0x2176('0x41')],'as':'Smtp'},{'model':db[_0x2176('0x66')],'as':_0x2176('0x61')}]})[_0x2176('0x3a')](function(_0x46b750){var _0x9391d2=_0x4e9221[_0x2176('0x77')][_0x2176('0x80')]({'plain':!![]});if(!_0x9391d2)throw new Error(_0x2176('0x81'));if(_0x9391d2[_0x2176('0x82')]==='user'){var _0x1e8c38=_0x46b750['get']({'plain':!![]});return db['UserProfileSection'][_0x2176('0x65')]({'where':{'name':'MailAccounts','userProfileId':_0x9391d2[_0x2176('0x83')]},'raw':!![]})['then'](function(_0x46e454){if(_0x46e454&&_0x46e454['autoAssociation']===0x0){return db[_0x2176('0x3d')][_0x2176('0x69')]({'name':_0x1e8c38[_0x2176('0x5a')],'resourceId':_0x1e8c38['id'],'type':_0x46e454[_0x2176('0x5a')],'sectionId':_0x46e454['id']},{})[_0x2176('0x3a')](function(){return _0x46b750;});}else{return _0x46b750;}})[_0x2176('0x2c')](function(_0x37ad23){logger[_0x2176('0x28')](_0x2176('0x84'),_0x37ad23);throw _0x37ad23;});}return _0x46b750;})[_0x2176('0x3a')](respondWithResult(_0x40be0d,0xc9))[_0x2176('0x2c')](handleError(_0x40be0d,null));};exports[_0x2176('0x85')]=function(_0xc29c8c,_0x4b6583,_0x4a6ebf){return db[_0x2176('0x45')][_0x2176('0x6a')]({'where':{'id':_0xc29c8c['params']['id']}})['then'](handleEntityNotFound(_0x4b6583,null))[_0x2176('0x3a')](function(_0x39eb37){if(_0x39eb37){return _0x39eb37['getImap']();}return null;})[_0x2176('0x3a')](respondWithResult(_0x4b6583,null))[_0x2176('0x2c')](handleError(_0x4b6583,null));};exports[_0x2176('0x86')]=function(_0x1d96d5,_0xbc8e69,_0x1f87a2){if(_0x1d96d5['body']['id']){delete _0x1d96d5[_0x2176('0x64')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x1d96d5[_0x2176('0x60')]['id']}})[_0x2176('0x3a')](handleEntityNotFound(_0xbc8e69,null))[_0x2176('0x3a')](function(_0x180677){if(_0x180677){_0x1d96d5['body'][_0x2176('0x67')]=_0x180677['id'];return db['MailServerIn'][_0x2176('0x69')](_0x1d96d5[_0x2176('0x64')]);}})[_0x2176('0x3a')](respondWithResult(_0xbc8e69,null))[_0x2176('0x2c')](handleError(_0xbc8e69,null));};exports[_0x2176('0x87')]=function(_0x4ca278,_0xc81cc3,_0x4716eb){return db[_0x2176('0x45')][_0x2176('0x6a')]({'where':{'id':_0x4ca278['params']['id']}})[_0x2176('0x3a')](handleEntityNotFound(_0xc81cc3,null))[_0x2176('0x3a')](function(_0x843853){if(_0x843853){return _0x843853['setImap'](null);}return null;})[_0x2176('0x3a')](respondWithStatusCode(_0xc81cc3,null))[_0x2176('0x2c')](handleError(_0xc81cc3,null));};exports[_0x2176('0x88')]=function(_0x4ccda8,_0x3bb519,_0x1f85db){return db['MailAccount'][_0x2176('0x6a')]({'where':{'id':_0x4ccda8['params']['id']}})[_0x2176('0x3a')](handleEntityNotFound(_0x3bb519,null))['then'](function(_0x4e21e9){if(_0x4e21e9){return _0x4e21e9[_0x2176('0x88')]();}return null;})[_0x2176('0x3a')](respondWithResult(_0x3bb519,null))[_0x2176('0x2c')](handleError(_0x3bb519,null));};exports[_0x2176('0x89')]=function(_0x232207,_0x259612,_0x47e23a){if(_0x232207['body']['id']){delete _0x232207[_0x2176('0x64')]['id'];}return db[_0x2176('0x45')][_0x2176('0x65')]({'where':{'id':_0x232207[_0x2176('0x60')]['id']}})[_0x2176('0x3a')](handleEntityNotFound(_0x259612,null))[_0x2176('0x3a')](function(_0x13c794){if(_0x13c794){_0x232207['body'][_0x2176('0x67')]=_0x13c794['id'];return db[_0x2176('0x41')][_0x2176('0x69')](_0x232207[_0x2176('0x64')]);}})[_0x2176('0x3a')](respondWithResult(_0x259612,null))[_0x2176('0x2c')](handleError(_0x259612,null));};exports[_0x2176('0x8a')]=function(_0x39957c,_0x22dd32,_0x1d0a07){return db[_0x2176('0x45')][_0x2176('0x6a')]({'where':{'id':_0x39957c[_0x2176('0x60')]['id']}})[_0x2176('0x3a')](handleEntityNotFound(_0x22dd32,null))['then'](function(_0x2cdb1c){if(_0x2cdb1c){return _0x2cdb1c[_0x2176('0x8b')](null);}return null;})[_0x2176('0x3a')](respondWithStatusCode(_0x22dd32,null))[_0x2176('0x2c')](handleError(_0x22dd32,null));};exports[_0x2176('0x8c')]=function(_0x456ef9,_0x3bc153,_0x1396f8){return db[_0x2176('0x8d')][_0x2176('0x65')]({'where':{'id':_0x456ef9['params']['id']}})[_0x2176('0x3a')](handleEntityNotFound(_0x3bc153,null))[_0x2176('0x3a')](function(_0x117874){if(_0x117874){return _0x117874[_0x2176('0x8c')](_0x456ef9[_0x2176('0x64')][_0x2176('0x6c')],_[_0x2176('0x8e')](_0x456ef9[_0x2176('0x64')],['ids','id'])||{});}})['then'](respondWithResult(_0x3bc153,null))[_0x2176('0x2c')](handleError(_0x3bc153,null));};exports[_0x2176('0x8f')]=function(_0x26a491,_0x3e51b6,_0x7fbc47){var _0x28137f={'raw':![],'where':{}};var _0xa44bf6={};var _0x2ec193={'count':0x0,'rows':[]};return db['MailAccount'][_0x2176('0x6a')]({'where':{'id':_0x26a491[_0x2176('0x60')]['id']}})[_0x2176('0x3a')](handleEntityNotFound(_0x3e51b6,null))['then'](function(_0x2a5391){if(_0x2a5391){_0xa44bf6[_0x2176('0x49')]=_[_0x2176('0x62')](db[_0x2176('0x8d')]['rawAttributes']);_0xa44bf6[_0x2176('0x4d')]=_[_0x2176('0x62')](_0x26a491[_0x2176('0x4d')]);_0xa44bf6[_0x2176('0x4b')]=_['intersection'](_0xa44bf6[_0x2176('0x49')],_0xa44bf6['query']);_0x28137f[_0x2176('0x4f')]=_[_0x2176('0x4c')](_0xa44bf6[_0x2176('0x49')],qs[_0x2176('0x4e')](_0x26a491['query'][_0x2176('0x4e')]));_0x28137f[_0x2176('0x4f')]=_0x28137f[_0x2176('0x4f')][_0x2176('0x50')]?_0x28137f['attributes']:_0xa44bf6['model'];if(!_0x26a491[_0x2176('0x4d')][_0x2176('0x51')]('nolimit')){_0x28137f[_0x2176('0x33')]=qs[_0x2176('0x33')](_0x26a491[_0x2176('0x4d')][_0x2176('0x33')]);_0x28137f[_0x2176('0x32')]=qs[_0x2176('0x32')](_0x26a491['query']['offset']);}_0x28137f[_0x2176('0x53')]=qs[_0x2176('0x54')](_0x26a491[_0x2176('0x4d')][_0x2176('0x54')]);_0x28137f[_0x2176('0x55')]=qs[_0x2176('0x4b')](_[_0x2176('0x56')](_0x26a491['query'],_0xa44bf6[_0x2176('0x4b')]));_0x28137f['where'][_0x2176('0x67')]=_0x2a5391['id'];if(_0x26a491[_0x2176('0x4d')][_0x2176('0x57')]){_0x28137f[_0x2176('0x55')]=_[_0x2176('0x58')](_0x28137f[_0x2176('0x55')],{'$or':_[_0x2176('0x4a')](_0x28137f[_0x2176('0x4f')],function(_0x1cd9b6){var _0x2cae17={};_0x2cae17[_0x1cd9b6]={'$like':'%'+_0x26a491[_0x2176('0x4d')][_0x2176('0x57')]+'%'};return _0x2cae17;})});}_0x28137f=_[_0x2176('0x58')]({},_0x28137f,_0x26a491[_0x2176('0x63')]);return db[_0x2176('0x8d')][_0x2176('0x31')]({'where':_0x28137f[_0x2176('0x55')]})['then'](function(_0xbcea3c){_0x2ec193[_0x2176('0x31')]=_0xbcea3c;if(_0x26a491[_0x2176('0x4d')]['includeAll']){_0x28137f['include']=[{'model':db['CmContact'],'as':_0x2176('0x90'),'required':![]},{'model':db['User'],'as':_0x2176('0x91'),'attributes':[_0x2176('0x5a'),'fullname',_0x2176('0x92')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x2176('0x5a'),_0x2176('0x93')],'where':_0x26a491[_0x2176('0x4d')][_0x2176('0x94')]?{'id':_0x26a491['query'][_0x2176('0x94')]}:undefined,'required':_0x26a491['query'][_0x2176('0x94')]?!![]:![]}];}return db[_0x2176('0x8d')][_0x2176('0x5d')](_0x28137f);})[_0x2176('0x3a')](function(_0x10cec2){_0x2ec193[_0x2176('0x5e')]=_0x10cec2;return _0x2ec193;});}})[_0x2176('0x3a')](respondWithFilteredResult(_0x3e51b6,_0x28137f))[_0x2176('0x2c')](handleError(_0x3e51b6,null));};exports[_0x2176('0x95')]=function(_0x4163ed,_0x4f5b43,_0x37d5bb){return db['MailAccount'][_0x2176('0x6a')]({'where':{'id':_0x4163ed[_0x2176('0x60')]['id']}})['then'](handleEntityNotFound(_0x4f5b43,null))[_0x2176('0x3a')](function(_0x12f700){if(_0x12f700){return db[_0x2176('0x96')][_0x2176('0x97')](function(_0x3dbe04){return db[_0x2176('0x98')][_0x2176('0x3b')]({'where':{'MailAccountId':_0x4163ed[_0x2176('0x60')]['id']},'transaction':_0x3dbe04})[_0x2176('0x3a')](function(_0x37dda1){var _0x5701c4=_[_0x2176('0x4a')](_0x4163ed['body'],function(_0x1dab1d){_0x1dab1d['MailAccountId']=_0x4163ed['params']['id'];return _0x1dab1d;});return db[_0x2176('0x98')][_0x2176('0x99')](_0x5701c4,{'transaction':_0x3dbe04});});})[_0x2176('0x3a')](function(){return db[_0x2176('0x98')][_0x2176('0x9a')]({'where':{'MailAccountId':_0x4163ed[_0x2176('0x60')]['id']},'order':_0x2176('0x9b')});});}})['then'](respondWithResult(_0x4f5b43,null))[_0x2176('0x2c')](handleError(_0x4f5b43,null));};exports[_0x2176('0x9c')]=function(_0xfe295,_0x30e013,_0xa933b2){var _0xf2f335={};var _0x59a8e1={};var _0xa0a590;var _0x467775;return db['MailAccount']['findOne']({'where':{'id':_0xfe295[_0x2176('0x60')]['id']}})[_0x2176('0x3a')](handleEntityNotFound(_0x30e013,null))[_0x2176('0x3a')](function(_0x145deb){if(_0x145deb){_0xa0a590=_0x145deb;_0x59a8e1[_0x2176('0x49')]=_[_0x2176('0x62')](db[_0x2176('0x98')][_0x2176('0x46')]);_0x59a8e1[_0x2176('0x4d')]=_[_0x2176('0x62')](_0xfe295[_0x2176('0x4d')]);_0x59a8e1['filters']=_[_0x2176('0x4c')](_0x59a8e1[_0x2176('0x49')],_0x59a8e1[_0x2176('0x4d')]);_0xf2f335[_0x2176('0x4f')]=_[_0x2176('0x4c')](_0x59a8e1[_0x2176('0x49')],qs[_0x2176('0x4e')](_0xfe295[_0x2176('0x4d')][_0x2176('0x4e')]));_0xf2f335['attributes']=_0xf2f335[_0x2176('0x4f')][_0x2176('0x50')]?_0xf2f335[_0x2176('0x4f')]:_0x59a8e1['model'];_0xf2f335['order']=qs['sort'](_0xfe295[_0x2176('0x4d')][_0x2176('0x54')]);_0xf2f335['where']=qs[_0x2176('0x4b')](_[_0x2176('0x56')](_0xfe295[_0x2176('0x4d')],_0x59a8e1['filters']));if(_0xfe295['query'][_0x2176('0x57')]){_0xf2f335[_0x2176('0x55')]=_[_0x2176('0x58')](_0xf2f335[_0x2176('0x55')],{'$or':_['map'](_0xf2f335[_0x2176('0x4f')],function(_0x3b062e){var _0x3685e6={};_0x3685e6[_0x3b062e]={'$like':'%'+_0xfe295['query'][_0x2176('0x57')]+'%'};return _0x3685e6;})});}_0xf2f335=_[_0x2176('0x58')]({},_0xf2f335,_0xfe295[_0x2176('0x63')]);return _0xa0a590[_0x2176('0x9c')](_0xf2f335);}})[_0x2176('0x3a')](function(_0x1419e3){if(_0x1419e3){_0x467775=_0x1419e3[_0x2176('0x50')];if(!_0xfe295[_0x2176('0x4d')][_0x2176('0x51')]('nolimit')){_0xf2f335[_0x2176('0x33')]=qs[_0x2176('0x33')](_0xfe295[_0x2176('0x4d')]['limit']);_0xf2f335['offset']=qs['offset'](_0xfe295[_0x2176('0x4d')][_0x2176('0x32')]);}return _0xa0a590[_0x2176('0x9c')](_0xf2f335);}})['then'](function(_0x1c59b1){if(_0x1c59b1){return _0x1c59b1?{'count':_0x467775,'rows':_0x1c59b1}:null;}})['then'](respondWithResult(_0x30e013,null))[_0x2176('0x2c')](handleError(_0x30e013,null));};exports[_0x2176('0x9d')]=function(_0x1a080a,_0x2afdd7,_0x324ebf){var _0x1118e8={'raw':!![],'where':{}};var _0x362237={};var _0x182d77={'count':0x0,'rows':[]};return db[_0x2176('0x45')][_0x2176('0x6a')]({'where':{'id':_0x1a080a[_0x2176('0x60')]['id']}})['then'](handleEntityNotFound(_0x2afdd7,null))[_0x2176('0x3a')](function(_0x158f75){if(_0x158f75){_0x362237[_0x2176('0x49')]=_[_0x2176('0x62')](db[_0x2176('0x9e')][_0x2176('0x46')]);_0x362237[_0x2176('0x4d')]=_['keys'](_0x1a080a[_0x2176('0x4d')]);_0x362237[_0x2176('0x4b')]=_[_0x2176('0x4c')](_0x362237['model'],_0x362237[_0x2176('0x4d')]);_0x1118e8[_0x2176('0x4f')]=_['intersection'](_0x362237['model'],qs[_0x2176('0x4e')](_0x1a080a[_0x2176('0x4d')][_0x2176('0x4e')]));_0x1118e8[_0x2176('0x4f')]=_0x1118e8['attributes'][_0x2176('0x50')]?_0x1118e8[_0x2176('0x4f')]:_0x362237[_0x2176('0x49')];if(!_0x1a080a[_0x2176('0x4d')][_0x2176('0x51')](_0x2176('0x52'))){_0x1118e8[_0x2176('0x33')]=qs[_0x2176('0x33')](_0x1a080a[_0x2176('0x4d')][_0x2176('0x33')]);_0x1118e8[_0x2176('0x32')]=qs[_0x2176('0x32')](_0x1a080a[_0x2176('0x4d')][_0x2176('0x32')]);}_0x1118e8[_0x2176('0x53')]=qs['sort'](_0x1a080a[_0x2176('0x4d')][_0x2176('0x54')]);_0x1118e8[_0x2176('0x55')]=qs[_0x2176('0x4b')](_[_0x2176('0x56')](_0x1a080a[_0x2176('0x4d')],_0x362237['filters']));_0x1118e8[_0x2176('0x55')][_0x2176('0x67')]=_0x158f75['id'];if(_0x1a080a[_0x2176('0x4d')]['filter']){_0x1118e8[_0x2176('0x55')]=_[_0x2176('0x58')](_0x1118e8['where'],{'$or':_[_0x2176('0x4a')](_0x1118e8[_0x2176('0x4f')],function(_0x1cd3c2){var _0x4b3411={};_0x4b3411[_0x1cd3c2]={'$like':'%'+_0x1a080a[_0x2176('0x4d')]['filter']+'%'};return _0x4b3411;})});}if(_0x1a080a[_0x2176('0x4d')]['$gte']){var _0x1296e7=_0x1a080a[_0x2176('0x4d')][_0x2176('0x9f')]['split'](',');var _0x925743={};_0x925743[_0x1296e7[0x0]]={'$gte':moment(_0x1296e7[0x1])[_0x2176('0xa0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1118e8[_0x2176('0x55')]=_[_0x2176('0x58')](_0x1118e8['where'],_0x925743);}_0x1118e8=_[_0x2176('0x58')]({},_0x1118e8,_0x1a080a[_0x2176('0x63')]);return db[_0x2176('0x9e')][_0x2176('0x31')]({'where':_0x1118e8[_0x2176('0x55')]})['then'](function(_0x2b1abc){_0x182d77[_0x2176('0x31')]=_0x2b1abc;if(_0x1a080a[_0x2176('0x4d')][_0x2176('0x5b')]){_0x1118e8[_0x2176('0x5c')]=[{'all':!![]}];}return db[_0x2176('0x9e')][_0x2176('0x5d')](_0x1118e8);})[_0x2176('0x3a')](function(_0x39f5af){_0x182d77[_0x2176('0x5e')]=_0x39f5af;return _0x182d77;});}})['then'](respondWithFilteredResult(_0x2afdd7,_0x1118e8))[_0x2176('0x2c')](handleError(_0x2afdd7,null));};exports['send']=function(_0x450286,_0xcdac7b,_0x2117c7){var _0x5eea83,_0x12ffb0={},_0x5296ea;if(_0x450286[_0x2176('0x64')]['to']){_0x5296ea=_0x450286['body']['to'][_0x2176('0xa1')](',')[0x0];}return db[_0x2176('0x45')]['find']({'where':{'id':_0x450286['params']['id']},'include':[{'model':db[_0x2176('0xa2')],'as':_0x2176('0xa3'),'include':[{'model':db[_0x2176('0xa4')],'as':_0x2176('0xa5'),'where':{'email':_0x5296ea},'limit':0x1,'order':[[_0x2176('0xa6'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x2176('0x42'),'raw':!![]}]})['then'](handleEntityNotFound(_0xcdac7b,null))[_0x2176('0x3a')](function(_0x1969a7){if(_0x1969a7){_0x5eea83=_0x1969a7;if(_0x1969a7[_0x2176('0x42')]){if(_['isNil'](_0x450286[_0x2176('0x64')][_0x2176('0xa7')])){_0x450286[_0x2176('0x64')][_0x2176('0xa7')]=util[_0x2176('0xa0')]('%s\x20<%s>',_0x1969a7[_0x2176('0x5a')],_0x1969a7[_0x2176('0x71')]||_0x1969a7[_0x2176('0x42')][_0x2176('0x77')]);}if(_0x450286[_0x2176('0x64')][_0x2176('0xa8')]&&_0x450286[_0x2176('0x64')][_0x2176('0xa8')]['length']){for(var _0x57a993=0x0;_0x57a993<_0x450286[_0x2176('0x64')][_0x2176('0xa8')]['length'];_0x57a993+=0x1){_0x450286[_0x2176('0x64')][_0x2176('0xa8')][_0x57a993]={'filename':_0x450286['body'][_0x2176('0xa8')][_0x57a993][_0x2176('0x5a')],'path':path['join'](config[_0x2176('0xa9')],'server/files/attachments',_0x450286[_0x2176('0x64')][_0x2176('0xa8')][_0x57a993]['basename'])};}}var _0x5d07c0={'tls':{'rejectUnauthorized':![]}};if(_[_0x2176('0x73')](_0x1969a7[_0x2176('0x42')][_0x2176('0xaa')])){if(_0x1969a7[_0x2176('0x42')][_0x2176('0x7a')]){_0x5d07c0[_0x2176('0xab')]={'user':_0x1969a7['Smtp'][_0x2176('0x77')],'pass':_0x1969a7[_0x2176('0x42')][_0x2176('0x79')]};}_0x5d07c0[_0x2176('0x7b')]=_0x1969a7['Smtp']['host'];_0x5d07c0[_0x2176('0x7c')]=_0x1969a7[_0x2176('0x42')][_0x2176('0x7c')];_0x5d07c0[_0x2176('0xac')]=_0x1969a7['Smtp'][_0x2176('0xac')];}else{_0x5d07c0[_0x2176('0xaa')]=_0x1969a7[_0x2176('0x42')]['service'];_0x5d07c0[_0x2176('0xab')]={'user':_0x1969a7[_0x2176('0x42')][_0x2176('0x77')],'pass':_0x1969a7['Smtp']['pass']};}return respondWithRpcPromise(_0x2176('0xad'),_0x2176('0xae'),{'account':_0x5d07c0,'message':_0x450286[_0x2176('0x64')]});}else{throw new Error(_0x2176('0xaf'));}}})[_0x2176('0x3a')](function(_0x45a36a){if(_0x45a36a){_0x12ffb0=_0x45a36a;if(_0x5eea83[_0x2176('0xa3')]){if(_0x5eea83[_0x2176('0xa3')][_0x2176('0xa5')][_0x2176('0x50')]){return _0x5eea83[_0x2176('0xa3')][_0x2176('0xa5')][0x0];}else{return db[_0x2176('0xa4')][_0x2176('0x69')](_['defaults'](_0x450286[_0x2176('0x64')],{'firstName':_0x450286['body']['to'],'email':_0x450286[_0x2176('0x64')]['to'],'phone':_0x450286[_0x2176('0x64')]['to'],'ListId':_0x5eea83['ListId']}));}}else{throw new Error(_0x2176('0xaf'));}}})[_0x2176('0x3a')](function(_0x2ba88a){if(_0x2ba88a){var _0x43489b={'UserId':_0x450286[_0x2176('0x77')]['id'],'ContactId':_0x2ba88a['id'],'MailAccountId':_0x5eea83['id'],'inReplyTo':_0x12ffb0[_0x2176('0xb0')],'to':_0x450286['body']['from'],'cc':_0x450286[_0x2176('0x64')]['cc'],'subject':_0x450286[_0x2176('0x64')][_0x2176('0xb1')],'attach':_0x450286[_0x2176('0x64')]['attach'],'firstMsgDirection':_0x2176('0xb2'),'lastMsgAt':moment()[_0x2176('0xa0')](_0x2176('0xb3')),'lastMsgDirection':_0x2176('0xb2'),'lastMsgBody':_0x450286['body'][_0x2176('0x64')],'Messages':[_['merge'](_0x450286[_0x2176('0x64')],{'messageId':_0x12ffb0[_0x2176('0xb0')],'sentAt':moment()['format'](_0x2176('0xb3')),'read':!![],'MailAccountId':_0x5eea83['id'],'UserId':_0x450286[_0x2176('0x77')]['id'],'ContactId':_0x2ba88a['id']})]};if(_0x450286[_0x2176('0x64')][_0x2176('0xb4')]){_0x43489b=_[_0x2176('0x58')](_0x43489b,_0x450286['body'][_0x2176('0xb4')]);}return db['MailInteraction']['create'](_0x43489b,{'include':[{'model':db[_0x2176('0x9e')],'as':_0x2176('0xb5')}]});}})['then'](respondWithResult(_0xcdac7b,null))[_0x2176('0x2c')](handleError(_0xcdac7b,null));};exports['verifySmtp']=function(_0x5c6409,_0x1445a9,_0x49f1a2){return db['MailAccount'][_0x2176('0x65')]({'where':{'id':_0x5c6409['params']['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x2176('0x3a')](handleEntityNotFound(_0x1445a9,null))[_0x2176('0x3a')](function(_0x5b963f){if(_0x5b963f&&_0x5b963f[_0x2176('0x42')]){var _0x24e01a={'id':_0x5b963f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5b963f[_0x2176('0x42')]['service']){_0x24e01a[_0x2176('0xaa')]=_0x5b963f[_0x2176('0x42')]['service'];}else{_0x24e01a[_0x2176('0x7b')]=_0x5b963f[_0x2176('0x42')][_0x2176('0x7b')];_0x24e01a['port']=_0x5b963f['Smtp'][_0x2176('0x7c')];_0x24e01a['secure']=_0x5b963f[_0x2176('0x42')][_0x2176('0xac')];}if(_0x5b963f[_0x2176('0x42')][_0x2176('0x7a')]){_0x24e01a[_0x2176('0xab')]={'user':_0x5b963f[_0x2176('0x42')][_0x2176('0x77')],'pass':_0x5b963f[_0x2176('0x42')]['pass']};}return respondWithRpcPromise('VerifySmtp',_0x2176('0xb6'),{'account':_0x24e01a});}})['then'](respondWithResult(_0x1445a9,null))[_0x2176('0x2c')](handleError(_0x1445a9,null));};exports[_0x2176('0x3b')]=function(_0x1b70fa,_0x4526aa){return db[_0x2176('0x45')][_0x2176('0x65')]({'where':{'id':_0x1b70fa[_0x2176('0x60')]['id']}})[_0x2176('0x3a')](handleEntityNotFound(_0x4526aa,null))[_0x2176('0x3a')](function(_0x32879d){if(_0x32879d&&_0x32879d[_0x2176('0xaa')]){throw new db['Sequelize'][(_0x2176('0xb7'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x32879d;})['then'](removeEntity(_0x4526aa,null))[_0x2176('0x2c')](handleError(_0x4526aa,null));};exports['addAgents']=function(_0x131d67,_0x1a9bed,_0x462797){return db[_0x2176('0x45')][_0x2176('0x65')]({'where':{'id':_0x131d67['params']['id']}})[_0x2176('0x3a')](handleEntityNotFound(_0x1a9bed,null))[_0x2176('0x3a')](function(_0x449c44){if(_0x449c44){return _0x449c44[_0x2176('0xb8')](_0x131d67[_0x2176('0x64')]['ids'],_[_0x2176('0x8e')](_0x131d67[_0x2176('0x64')],[_0x2176('0x6c'),'id'])||{})['spread'](function(_0x15300c){for(var _0x3bd0b=0x0;_0x3bd0b<_0x131d67[_0x2176('0x64')][_0x2176('0x6c')][_0x2176('0x50')];_0x3bd0b+=0x1){socket[_0x2176('0xb9')](_0x2176('0xba'),{'UserId':_0x131d67[_0x2176('0x64')][_0x2176('0x6c')][_0x3bd0b],'MailAccountId':_0x131d67[_0x2176('0x60')]['id']});}return _0x15300c;});}})[_0x2176('0x3a')](respondWithResult(_0x1a9bed,null))[_0x2176('0x2c')](handleError(_0x1a9bed,null));};exports[_0x2176('0xbb')]=function(_0x2faf0c,_0x51f786,_0x41c943){return db[_0x2176('0x45')]['find']({'where':{'id':_0x2faf0c[_0x2176('0x60')]['id']}})[_0x2176('0x3a')](handleEntityNotFound(_0x51f786,null))[_0x2176('0x3a')](function(_0x382d22){if(_0x382d22){return _0x382d22[_0x2176('0xbb')](_0x2faf0c['query']['ids'])[_0x2176('0x3a')](function(){if(_[_0x2176('0xbc')](_0x2faf0c[_0x2176('0x4d')][_0x2176('0x6c')])){for(var _0x8d6d27=0x0;_0x8d6d27<_0x2faf0c['query']['ids'][_0x2176('0x50')];_0x8d6d27+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x2faf0c[_0x2176('0x4d')]['ids'][_0x8d6d27]),'MailAccountId':Number(_0x2faf0c['params']['id'])});}}else{socket[_0x2176('0xb9')](_0x2176('0xbd'),{'UserId':Number(_0x2faf0c['query'][_0x2176('0x6c')]),'MailAccountId':Number(_0x2faf0c[_0x2176('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x51f786,null))[_0x2176('0x2c')](handleError(_0x51f786,null));};exports['getAgents']=function(_0x51b23e,_0x6b27cd,_0xa6b0b0){var _0x4b4484={};var _0x105e5a={};var _0x519178;var _0xcc1b71;return db['MailAccount'][_0x2176('0x6a')]({'where':{'id':_0x51b23e['params']['id']}})['then'](handleEntityNotFound(_0x6b27cd,null))[_0x2176('0x3a')](function(_0x455f01){if(_0x455f01){_0x519178=_0x455f01;_0x105e5a[_0x2176('0x49')]=_[_0x2176('0x62')](db['User'][_0x2176('0x46')]);_0x105e5a[_0x2176('0x4d')]=_[_0x2176('0x62')](_0x51b23e[_0x2176('0x4d')]);_0x105e5a[_0x2176('0x4b')]=_[_0x2176('0x4c')](_0x105e5a[_0x2176('0x49')],_0x105e5a['query']);_0x4b4484[_0x2176('0x4f')]=_['intersection'](_0x105e5a[_0x2176('0x49')],qs['fields'](_0x51b23e[_0x2176('0x4d')]['fields']));_0x4b4484[_0x2176('0x4f')]=_0x4b4484[_0x2176('0x4f')][_0x2176('0x50')]?_0x4b4484[_0x2176('0x4f')]:_0x105e5a[_0x2176('0x49')];_0x4b4484[_0x2176('0x53')]=qs['sort'](_0x51b23e[_0x2176('0x4d')][_0x2176('0x54')]);_0x4b4484[_0x2176('0x55')]=qs[_0x2176('0x4b')](_[_0x2176('0x56')](_0x51b23e[_0x2176('0x4d')],_0x105e5a[_0x2176('0x4b')]));if(_0x51b23e['query'][_0x2176('0x57')]){_0x4b4484[_0x2176('0x55')]=_[_0x2176('0x58')](_0x4b4484['where'],{'$or':_['map'](_0x4b4484[_0x2176('0x4f')],function(_0x12b6b2){var _0x8b1834={};_0x8b1834[_0x12b6b2]={'$like':'%'+_0x51b23e[_0x2176('0x4d')][_0x2176('0x57')]+'%'};return _0x8b1834;})});}_0x4b4484=_['merge']({},_0x4b4484,_0x51b23e[_0x2176('0x63')]);return _0x519178[_0x2176('0xbe')](_0x4b4484);}})[_0x2176('0x3a')](function(_0x3f955c){if(_0x3f955c){_0xcc1b71=_0x3f955c[_0x2176('0x50')];if(!_0x51b23e[_0x2176('0x4d')][_0x2176('0x51')]('nolimit')){_0x4b4484['limit']=qs[_0x2176('0x33')](_0x51b23e[_0x2176('0x4d')][_0x2176('0x33')]);_0x4b4484['offset']=qs[_0x2176('0x32')](_0x51b23e[_0x2176('0x4d')][_0x2176('0x32')]);}return _0x519178[_0x2176('0xbe')](_0x4b4484);}})[_0x2176('0x3a')](function(_0x4bcba5){if(_0x4bcba5){return _0x4bcba5?{'count':_0xcc1b71,'rows':_0x4bcba5}:null;}})[_0x2176('0x3a')](respondWithResult(_0x6b27cd,null))[_0x2176('0x2c')](handleError(_0x6b27cd,null));}; \ No newline at end of file +var _0xae0f=['create','getDispositions','findOne','removeDispositions','ids','CannedAnswer','getAnswers','order','removeAnswers','key','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tag','sequelize','MailApplication','MailAccountId','bulkCreate','priority','getApplications','$gte','format','MailMessage','split','CmList','List','updatedAt','from','%s\x20<%s>','attachments','join','root','basename','auth','secure','SendMail','Contacts','messageId','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./mailAccount.socket','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','get','MailAccounts','UserProfileResource','end','stack','name','send','Imap','MailServerOut','Smtp','Pause','map','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','options','MailAccount','includeAll','include','findAll','rows','show','MailServerIn','mandatoryDispositionPause','rawAttributes','filtears','find','body','params','describe','addDisposition','Disposition'];(function(_0x28ba9b,_0x3c0681){var _0x3c0068=function(_0x35ecb9){while(--_0x35ecb9){_0x28ba9b['push'](_0x28ba9b['shift']());}};_0x3c0068(++_0x3c0681);}(_0xae0f,0x1ce));var _0xfae0=function(_0x2ab205,_0x6cf020){_0x2ab205=_0x2ab205-0x0;var _0x20eb2e=_0xae0f[_0x2ab205];return _0x20eb2e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfae0('0x0'));var rimraf=require(_0xfae0('0x1'));var zipdir=require(_0xfae0('0x2'));var jsonpatch=require(_0xfae0('0x3'));var rp=require(_0xfae0('0x4'));var moment=require('moment');var BPromise=require(_0xfae0('0x5'));var Mustache=require(_0xfae0('0x6'));var util=require(_0xfae0('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xfae0('0x8'));var ejs=require(_0xfae0('0x9'));var fs=require('fs');var _=require(_0xfae0('0xa'));var squel=require(_0xfae0('0xb'));var crypto=require(_0xfae0('0xc'));var jsforce=require(_0xfae0('0xd'));var deskjs=require(_0xfae0('0xe'));var toCsv=require(_0xfae0('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfae0('0xf'));var authService=require(_0xfae0('0x10'));var qs=require(_0xfae0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfae0('0x12'))(_0xfae0('0x13'));var utils=require(_0xfae0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfae0('0x15'));var db=require(_0xfae0('0x16'))['db'];config['redis']=_[_0xfae0('0x17')](config[_0xfae0('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xfae0('0x19'))(new Redis(config[_0xfae0('0x18')]));require(_0xfae0('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xfae0('0x1b')][_0xfae0('0x1c')]({'port':0x232b});function respondWithRpcPromise(_0x464458,_0x1eb2fa,_0x51c510,_0x49f6ec){return new BPromise(function(_0x376a99,_0x31b70f){var _0x2cc663=_0x49f6ec||client;return _0x2cc663[_0xfae0('0x1d')](_0x464458,_0x51c510)[_0xfae0('0x1e')](function(_0x408b14){logger[_0xfae0('0x1f')](_0xfae0('0x20'),_0x1eb2fa,_0xfae0('0x21'));logger[_0xfae0('0x22')](_0xfae0('0x23'),_0x1eb2fa,_0xfae0('0x21'),JSON[_0xfae0('0x24')](_0x408b14));if(_0x408b14[_0xfae0('0x25')]){if(_0x408b14['error'][_0xfae0('0x26')]===0x1f4){logger[_0xfae0('0x25')](_0xfae0('0x20'),_0x1eb2fa,_0x408b14[_0xfae0('0x25')][_0xfae0('0x27')]);return _0x31b70f(_0x408b14[_0xfae0('0x25')]['message']);}logger[_0xfae0('0x25')]('MailAccount,\x20%s,\x20%s',_0x1eb2fa,_0x408b14[_0xfae0('0x25')][_0xfae0('0x27')]);return _0x376a99(_0x408b14['error'][_0xfae0('0x27')]);}else{logger['info'](_0xfae0('0x20'),_0x1eb2fa,'request\x20sent');_0x376a99(_0x408b14[_0xfae0('0x28')][_0xfae0('0x27')]);}})[_0xfae0('0x29')](function(_0x45955b){logger[_0xfae0('0x25')]('MailAccount,\x20%s,\x20%s',_0x1eb2fa,_0x45955b);_0x31b70f(_0x45955b);});});}function respondWithStatusCode(_0x366ba0,_0x302fa2){_0x302fa2=_0x302fa2||0xcc;return function(_0x40a3ca){if(_0x40a3ca){return _0x366ba0[_0xfae0('0x2a')](_0x302fa2);}return _0x366ba0[_0xfae0('0x2b')](_0x302fa2)['end']();};}function respondWithResult(_0x1ed7aa,_0x1a8469){_0x1a8469=_0x1a8469||0xc8;return function(_0x4469ea){if(_0x4469ea){return _0x1ed7aa[_0xfae0('0x2b')](_0x1a8469)[_0xfae0('0x2c')](_0x4469ea);}};}function respondWithFilteredResult(_0x3d75dc,_0x26c2de){return function(_0x55d028){if(_0x55d028){var _0x2f2095=_0x55d028[_0xfae0('0x2d')],_0xd3b2f7=_0x26c2de[_0xfae0('0x2e')],_0x5bf0e0=_0x26c2de['offset']+_0x26c2de[_0xfae0('0x2f')],_0x74d2b9;if(_0x5bf0e0>=_0x2f2095){_0x5bf0e0=_0x2f2095;_0x74d2b9=0xc8;}else{_0x74d2b9=0xce;}_0x3d75dc['status'](_0x74d2b9);return _0x3d75dc['set'](_0xfae0('0x30'),_0xd3b2f7+'-'+_0x5bf0e0+'/'+_0x2f2095)[_0xfae0('0x2c')](_0x55d028);}return null;};}function patchUpdates(_0xb4a1bd){return function(_0x333a39){try{jsonpatch[_0xfae0('0x31')](_0x333a39,_0xb4a1bd,!![]);}catch(_0x50080b){return BPromise[_0xfae0('0x32')](_0x50080b);}return _0x333a39[_0xfae0('0x33')]();};}function saveUpdates(_0xacfe92,_0x5b3120){return function(_0x28bb42){if(_0x28bb42){return _0x28bb42[_0xfae0('0x34')](_0xacfe92)[_0xfae0('0x1e')](function(_0x20f328){return _0x20f328;});}return null;};}function removeEntity(_0x150e3d,_0x4d3dbf){return function(_0x1e002c){if(_0x1e002c){return _0x1e002c[_0xfae0('0x35')]()[_0xfae0('0x1e')](function(){var _0x526a26=_0x1e002c[_0xfae0('0x36')]({'plain':!![]});var _0x46a565=_0xfae0('0x37');return db[_0xfae0('0x38')][_0xfae0('0x35')]({'where':{'type':_0x46a565,'resourceId':_0x526a26['id']}})['then'](function(){return _0x1e002c;});})[_0xfae0('0x1e')](function(){_0x150e3d[_0xfae0('0x2b')](0xcc)[_0xfae0('0x39')]();});}};}function handleEntityNotFound(_0x4e91d6,_0x316a7c){return function(_0x378db9){if(!_0x378db9){_0x4e91d6[_0xfae0('0x2a')](0x194);}return _0x378db9;};}function handleError(_0x3f99d5,_0x5299d2){_0x5299d2=_0x5299d2||0x1f4;return function(_0x3307cd){logger[_0xfae0('0x25')](_0x3307cd[_0xfae0('0x3a')]);if(_0x3307cd[_0xfae0('0x3b')]){delete _0x3307cd[_0xfae0('0x3b')];}_0x3f99d5[_0xfae0('0x2b')](_0x5299d2)[_0xfae0('0x3c')](_0x3307cd);};}exports['index']=function(_0x23ec95,_0x10c669){var _0x54cb67={'include':[{'model':db['MailServerIn'],'as':_0xfae0('0x3d')},{'model':db[_0xfae0('0x3e')],'as':_0xfae0('0x3f')},{'model':db[_0xfae0('0x40')],'as':'mandatoryDispositionPause'}]},_0x1eec67={},_0x487729={'count':0x0,'rows':[]};var _0x5d44d2=_[_0xfae0('0x41')](db['MailAccount']['rawAttributes'],function(_0x407e86){return{'name':_0x407e86['fieldName'],'type':_0x407e86['type']['key']};});_0x1eec67[_0xfae0('0x42')]=_[_0xfae0('0x41')](_0x5d44d2,_0xfae0('0x3b'));_0x1eec67[_0xfae0('0x43')]=_[_0xfae0('0x44')](_0x23ec95[_0xfae0('0x43')]);_0x1eec67[_0xfae0('0x45')]=_[_0xfae0('0x46')](_0x1eec67[_0xfae0('0x42')],_0x1eec67[_0xfae0('0x43')]);_0x54cb67[_0xfae0('0x47')]=_[_0xfae0('0x46')](_0x1eec67[_0xfae0('0x42')],qs[_0xfae0('0x48')](_0x23ec95[_0xfae0('0x43')][_0xfae0('0x48')]));_0x54cb67[_0xfae0('0x47')]=_0x54cb67[_0xfae0('0x47')][_0xfae0('0x49')]?_0x54cb67[_0xfae0('0x47')]:_0x1eec67[_0xfae0('0x42')];if(!_0x23ec95[_0xfae0('0x43')][_0xfae0('0x4a')](_0xfae0('0x4b'))){_0x54cb67[_0xfae0('0x2f')]=qs[_0xfae0('0x2f')](_0x23ec95[_0xfae0('0x43')][_0xfae0('0x2f')]);_0x54cb67[_0xfae0('0x2e')]=qs[_0xfae0('0x2e')](_0x23ec95['query']['offset']);}_0x54cb67['order']=qs['sort'](_0x23ec95[_0xfae0('0x43')][_0xfae0('0x4c')]);_0x54cb67['where']=qs[_0xfae0('0x45')](_[_0xfae0('0x4d')](_0x23ec95[_0xfae0('0x43')],_0x1eec67[_0xfae0('0x45')]),_0x5d44d2);if(_0x23ec95['query'][_0xfae0('0x4e')]){_0x54cb67[_0xfae0('0x4f')]=_[_0xfae0('0x50')](_0x54cb67['where'],{'$or':_[_0xfae0('0x41')](_0x5d44d2,function(_0x29a993){if(_0x29a993[_0xfae0('0x51')]!=='VIRTUAL'){var _0x2e1286={};_0x2e1286[_0x29a993[_0xfae0('0x3b')]]={'$like':'%'+_0x23ec95[_0xfae0('0x43')][_0xfae0('0x4e')]+'%'};return _0x2e1286;}})});}_0x54cb67=_[_0xfae0('0x50')]({},_0x54cb67,_0x23ec95[_0xfae0('0x52')]);var _0x2b2588={'where':_0x54cb67[_0xfae0('0x4f')]};return db[_0xfae0('0x53')][_0xfae0('0x2d')](_0x2b2588)[_0xfae0('0x1e')](function(_0x3c7fcb){_0x487729[_0xfae0('0x2d')]=_0x3c7fcb;if(_0x23ec95['query'][_0xfae0('0x54')]){_0x54cb67[_0xfae0('0x55')]=[{'all':!![]}];}return db[_0xfae0('0x53')][_0xfae0('0x56')](_0x54cb67);})[_0xfae0('0x1e')](function(_0x3a187a){_0x487729[_0xfae0('0x57')]=_0x3a187a;return _0x487729;})[_0xfae0('0x1e')](respondWithFilteredResult(_0x10c669,_0x54cb67))[_0xfae0('0x29')](handleError(_0x10c669,null));};exports[_0xfae0('0x58')]=function(_0x12d4b5,_0x49a513){var _0x220ec9={'raw':![],'where':{'id':_0x12d4b5['params']['id']},'include':[{'model':db[_0xfae0('0x59')],'as':'Imap'},{'model':db[_0xfae0('0x3e')],'as':_0xfae0('0x3f')},{'model':db[_0xfae0('0x40')],'as':_0xfae0('0x5a')}]},_0x3f9175={};_0x3f9175[_0xfae0('0x42')]=_[_0xfae0('0x44')](db[_0xfae0('0x53')][_0xfae0('0x5b')]);_0x3f9175[_0xfae0('0x43')]=_[_0xfae0('0x44')](_0x12d4b5['query']);_0x3f9175[_0xfae0('0x5c')]=_[_0xfae0('0x46')](_0x3f9175[_0xfae0('0x42')],_0x3f9175[_0xfae0('0x43')]);_0x220ec9['attributes']=_[_0xfae0('0x46')](_0x3f9175[_0xfae0('0x42')],qs[_0xfae0('0x48')](_0x12d4b5['query'][_0xfae0('0x48')]));_0x220ec9[_0xfae0('0x47')]=_0x220ec9[_0xfae0('0x47')][_0xfae0('0x49')]?_0x220ec9[_0xfae0('0x47')]:_0x3f9175[_0xfae0('0x42')];if(_0x12d4b5['query'][_0xfae0('0x54')]){_0x220ec9[_0xfae0('0x55')]=[{'all':!![]}];}_0x220ec9=_[_0xfae0('0x50')]({},_0x220ec9,_0x12d4b5[_0xfae0('0x52')]);return db['MailAccount'][_0xfae0('0x5d')](_0x220ec9)['then'](handleEntityNotFound(_0x49a513,null))[_0xfae0('0x1e')](respondWithResult(_0x49a513,null))[_0xfae0('0x29')](handleError(_0x49a513,null));};exports[_0xfae0('0x34')]=function(_0x42d719,_0x33d80d){if(_0x42d719[_0xfae0('0x5e')]['id']){delete _0x42d719[_0xfae0('0x5e')]['id'];}return db['MailAccount'][_0xfae0('0x5d')]({'where':{'id':_0x42d719[_0xfae0('0x5f')]['id']},'include':[{'model':db[_0xfae0('0x59')],'as':_0xfae0('0x3d')},{'model':db['MailServerOut'],'as':_0xfae0('0x3f')},{'model':db[_0xfae0('0x40')],'as':_0xfae0('0x5a')}]})[_0xfae0('0x1e')](handleEntityNotFound(_0x33d80d,null))['then'](saveUpdates(_0x42d719[_0xfae0('0x5e')],null))[_0xfae0('0x1e')](function(_0x125807){if(_0x125807&&_0x42d719[_0xfae0('0x5e')][_0xfae0('0x3d')]){return db[_0xfae0('0x59')][_0xfae0('0x34')](_0x42d719[_0xfae0('0x5e')][_0xfae0('0x3d')],{'where':{'MailAccountId':_0x125807['id']}})[_0xfae0('0x1e')](function(){return _0x125807;});}return _0x125807;})[_0xfae0('0x1e')](function(_0x34eee9){if(_0x34eee9&&_0x42d719[_0xfae0('0x5e')][_0xfae0('0x3f')]){return db[_0xfae0('0x3e')][_0xfae0('0x34')](_0x42d719[_0xfae0('0x5e')][_0xfae0('0x3f')],{'where':{'MailAccountId':_0x34eee9['id']}})[_0xfae0('0x1e')](function(){return _0x34eee9;});}return _0x34eee9;})[_0xfae0('0x1e')](respondWithResult(_0x33d80d,null))[_0xfae0('0x29')](handleError(_0x33d80d,null));};exports[_0xfae0('0x60')]=function(_0x539e1d,_0x522535){return db['MailAccount']['describe']()[_0xfae0('0x1e')](respondWithResult(_0x522535,null))[_0xfae0('0x29')](handleError(_0x522535,null));};exports[_0xfae0('0x61')]=function(_0x4c1585,_0x243e5a,_0x554494){if(_0x4c1585[_0xfae0('0x5e')]['id']){delete _0x4c1585[_0xfae0('0x5e')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x4c1585[_0xfae0('0x5f')]['id']}})['then'](handleEntityNotFound(_0x243e5a,null))[_0xfae0('0x1e')](function(_0x134557){if(_0x134557){_0x4c1585[_0xfae0('0x5e')]['MailAccountId']=_0x134557['id'];return db[_0xfae0('0x62')][_0xfae0('0x63')](_0x4c1585[_0xfae0('0x5e')]);}})['then'](respondWithResult(_0x243e5a,null))[_0xfae0('0x29')](handleError(_0x243e5a,null));};exports[_0xfae0('0x64')]=function(_0x39ee56,_0x42f951,_0xf72386){var _0x44a4db={'raw':![],'where':{}};var _0x3b2f72={};var _0x2454b9={'count':0x0,'rows':[]};return db[_0xfae0('0x53')][_0xfae0('0x65')]({'where':{'id':_0x39ee56['params']['id']}})[_0xfae0('0x1e')](handleEntityNotFound(_0x42f951,null))[_0xfae0('0x1e')](function(_0x4a2b8b){if(_0x4a2b8b){_0x3b2f72['model']=_[_0xfae0('0x44')](db[_0xfae0('0x62')]['rawAttributes']);_0x3b2f72[_0xfae0('0x43')]=_[_0xfae0('0x44')](_0x39ee56[_0xfae0('0x43')]);_0x3b2f72[_0xfae0('0x45')]=_[_0xfae0('0x46')](_0x3b2f72[_0xfae0('0x42')],_0x3b2f72[_0xfae0('0x43')]);_0x44a4db[_0xfae0('0x47')]=_['intersection'](_0x3b2f72[_0xfae0('0x42')],qs[_0xfae0('0x48')](_0x39ee56[_0xfae0('0x43')][_0xfae0('0x48')]));_0x44a4db[_0xfae0('0x47')]=_0x44a4db['attributes'][_0xfae0('0x49')]?_0x44a4db[_0xfae0('0x47')]:_0x3b2f72[_0xfae0('0x42')];if(!_0x39ee56['query'][_0xfae0('0x4a')]('nolimit')){_0x44a4db[_0xfae0('0x2f')]=qs[_0xfae0('0x2f')](_0x39ee56['query']['limit']);_0x44a4db[_0xfae0('0x2e')]=qs['offset'](_0x39ee56['query']['offset']);}_0x44a4db['order']=qs[_0xfae0('0x4c')](_0x39ee56[_0xfae0('0x43')][_0xfae0('0x4c')]);_0x44a4db[_0xfae0('0x4f')]=qs['filters'](_[_0xfae0('0x4d')](_0x39ee56[_0xfae0('0x43')],_0x3b2f72[_0xfae0('0x45')]));_0x44a4db['where']['MailAccountId']=_0x4a2b8b['id'];if(_0x39ee56[_0xfae0('0x43')]['filter']){_0x44a4db[_0xfae0('0x4f')]=_['merge'](_0x44a4db[_0xfae0('0x4f')],{'$or':_['map'](_0x44a4db[_0xfae0('0x47')],function(_0x185c71){var _0x4ad787={};_0x4ad787[_0x185c71]={'$like':'%'+_0x39ee56['query']['filter']+'%'};return _0x4ad787;})});}_0x44a4db=_[_0xfae0('0x50')]({},_0x44a4db,_0x39ee56[_0xfae0('0x52')]);return db[_0xfae0('0x62')][_0xfae0('0x2d')]({'where':_0x44a4db[_0xfae0('0x4f')]})['then'](function(_0x25d55c){_0x2454b9[_0xfae0('0x2d')]=_0x25d55c;if(_0x39ee56[_0xfae0('0x43')][_0xfae0('0x54')]){_0x44a4db[_0xfae0('0x55')]=[{'all':!![]}];}return db[_0xfae0('0x62')]['findAll'](_0x44a4db);})[_0xfae0('0x1e')](function(_0x1a5003){_0x2454b9[_0xfae0('0x57')]=_0x1a5003;return _0x2454b9;});}})[_0xfae0('0x1e')](respondWithFilteredResult(_0x42f951,_0x44a4db))[_0xfae0('0x29')](handleError(_0x42f951,null));};exports[_0xfae0('0x66')]=function(_0x496ad8,_0x152da5,_0x4bde63){return db[_0xfae0('0x53')][_0xfae0('0x5d')]({'where':{'id':_0x496ad8[_0xfae0('0x5f')]['id']}})[_0xfae0('0x1e')](handleEntityNotFound(_0x152da5,null))[_0xfae0('0x1e')](function(_0x33a000){if(_0x33a000){return _0x33a000[_0xfae0('0x66')](_0x496ad8[_0xfae0('0x43')][_0xfae0('0x67')]);}})[_0xfae0('0x1e')](respondWithStatusCode(_0x152da5,null))[_0xfae0('0x29')](handleError(_0x152da5,null));};exports['addAnswer']=function(_0x42b98d,_0x2f8794,_0x55c499){if(_0x42b98d['body']['id']){delete _0x42b98d['body']['id'];}return db[_0xfae0('0x53')][_0xfae0('0x5d')]({'where':{'id':_0x42b98d['params']['id']}})['then'](handleEntityNotFound(_0x2f8794,null))[_0xfae0('0x1e')](function(_0x334a2a){if(_0x334a2a){_0x42b98d[_0xfae0('0x5e')]['MailAccountId']=_0x334a2a['id'];return db[_0xfae0('0x68')]['create'](_0x42b98d[_0xfae0('0x5e')]);}})[_0xfae0('0x1e')](respondWithResult(_0x2f8794,null))[_0xfae0('0x29')](handleError(_0x2f8794,null));};exports[_0xfae0('0x69')]=function(_0x269562,_0x326e53,_0x506b6f){var _0x31f766={'raw':![],'where':{}};var _0xb3ad4f={};var _0x65c87c={'count':0x0,'rows':[]};return db[_0xfae0('0x53')][_0xfae0('0x65')]({'where':{'id':_0x269562[_0xfae0('0x5f')]['id']}})[_0xfae0('0x1e')](handleEntityNotFound(_0x326e53,null))[_0xfae0('0x1e')](function(_0x39cbcf){if(_0x39cbcf){_0xb3ad4f[_0xfae0('0x42')]=_[_0xfae0('0x44')](db[_0xfae0('0x68')]['rawAttributes']);_0xb3ad4f[_0xfae0('0x43')]=_[_0xfae0('0x44')](_0x269562['query']);_0xb3ad4f['filters']=_[_0xfae0('0x46')](_0xb3ad4f[_0xfae0('0x42')],_0xb3ad4f[_0xfae0('0x43')]);_0x31f766[_0xfae0('0x47')]=_['intersection'](_0xb3ad4f['model'],qs[_0xfae0('0x48')](_0x269562[_0xfae0('0x43')][_0xfae0('0x48')]));_0x31f766[_0xfae0('0x47')]=_0x31f766[_0xfae0('0x47')]['length']?_0x31f766[_0xfae0('0x47')]:_0xb3ad4f[_0xfae0('0x42')];if(!_0x269562[_0xfae0('0x43')][_0xfae0('0x4a')](_0xfae0('0x4b'))){_0x31f766[_0xfae0('0x2f')]=qs[_0xfae0('0x2f')](_0x269562[_0xfae0('0x43')]['limit']);_0x31f766[_0xfae0('0x2e')]=qs[_0xfae0('0x2e')](_0x269562[_0xfae0('0x43')][_0xfae0('0x2e')]);}_0x31f766[_0xfae0('0x6a')]=qs[_0xfae0('0x4c')](_0x269562[_0xfae0('0x43')]['sort']);_0x31f766[_0xfae0('0x4f')]=qs[_0xfae0('0x45')](_['pick'](_0x269562['query'],_0xb3ad4f['filters']));_0x31f766[_0xfae0('0x4f')]['MailAccountId']=_0x39cbcf['id'];if(_0x269562['query']['filter']){_0x31f766['where']=_[_0xfae0('0x50')](_0x31f766[_0xfae0('0x4f')],{'$or':_[_0xfae0('0x41')](_0x31f766[_0xfae0('0x47')],function(_0x165694){var _0x346d96={};_0x346d96[_0x165694]={'$like':'%'+_0x269562['query'][_0xfae0('0x4e')]+'%'};return _0x346d96;})});}_0x31f766=_[_0xfae0('0x50')]({},_0x31f766,_0x269562[_0xfae0('0x52')]);return db[_0xfae0('0x68')]['count']({'where':_0x31f766[_0xfae0('0x4f')]})['then'](function(_0x23f8a1){_0x65c87c[_0xfae0('0x2d')]=_0x23f8a1;if(_0x269562['query'][_0xfae0('0x54')]){_0x31f766[_0xfae0('0x55')]=[{'all':!![]}];}return db[_0xfae0('0x68')][_0xfae0('0x56')](_0x31f766);})[_0xfae0('0x1e')](function(_0x2865ea){_0x65c87c['rows']=_0x2865ea;return _0x65c87c;});}})['then'](respondWithFilteredResult(_0x326e53,_0x31f766))[_0xfae0('0x29')](handleError(_0x326e53,null));};exports[_0xfae0('0x6b')]=function(_0x5ed8e0,_0x356abf,_0x42cf12){return db[_0xfae0('0x53')][_0xfae0('0x5d')]({'where':{'id':_0x5ed8e0[_0xfae0('0x5f')]['id']}})[_0xfae0('0x1e')](handleEntityNotFound(_0x356abf,null))[_0xfae0('0x1e')](function(_0x786e6d){if(_0x786e6d){return _0x786e6d[_0xfae0('0x6b')](_0x5ed8e0[_0xfae0('0x43')][_0xfae0('0x67')]);}})[_0xfae0('0x1e')](respondWithStatusCode(_0x356abf,null))[_0xfae0('0x29')](handleError(_0x356abf,null));};exports[_0xfae0('0x63')]=function(_0x192b45,_0x4ca3c8){var _0x5e2fb1={'name':_0x192b45[_0xfae0('0x5e')][_0xfae0('0x3b')],'key':_0x192b45['body'][_0xfae0('0x6c')],'email':_0x192b45[_0xfae0('0x5e')][_0xfae0('0x6d')],'ListId':_0x192b45[_0xfae0('0x5e')][_0xfae0('0x6e')],'active':!_[_0xfae0('0x6f')](_0x192b45['body']['active'])?_0x192b45[_0xfae0('0x5e')][_0xfae0('0x70')]:!![],'description':_0x192b45[_0xfae0('0x5e')][_0xfae0('0x71')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x192b45[_0xfae0('0x5e')][_0xfae0('0x72')])){if(_0x192b45[_0xfae0('0x5e')][_0xfae0('0x73')]){_0x5e2fb1['Imap'][_0xfae0('0x74')]=_0x5e2fb1[_0xfae0('0x3f')][_0xfae0('0x74')]=_0x192b45[_0xfae0('0x5e')][_0xfae0('0x75')];_0x5e2fb1['Imap'][_0xfae0('0x76')]=_0x5e2fb1[_0xfae0('0x3f')][_0xfae0('0x77')]=_0x192b45[_0xfae0('0x5e')]['cpassword'];}else{_0x5e2fb1[_0xfae0('0x3d')][_0xfae0('0x78')]=_0x5e2fb1['Smtp'][_0xfae0('0x78')]=![];}_0x5e2fb1[_0xfae0('0x3d')][_0xfae0('0x79')]=_0x192b45[_0xfae0('0x5e')][_0xfae0('0x3d')][_0xfae0('0x79')];_0x5e2fb1[_0xfae0('0x3d')][_0xfae0('0x7a')]=_0x192b45['body'][_0xfae0('0x3d')][_0xfae0('0x7a')];_0x5e2fb1['Smtp'][_0xfae0('0x79')]=_0x192b45[_0xfae0('0x5e')][_0xfae0('0x3f')][_0xfae0('0x79')];_0x5e2fb1[_0xfae0('0x3f')][_0xfae0('0x7a')]=_0x192b45[_0xfae0('0x5e')][_0xfae0('0x3f')][_0xfae0('0x7a')];}else{_0x5e2fb1[_0xfae0('0x3d')][_0xfae0('0x7b')]=_0x5e2fb1[_0xfae0('0x3f')][_0xfae0('0x7b')]=_0x192b45[_0xfae0('0x5e')][_0xfae0('0x72')];_0x5e2fb1[_0xfae0('0x3d')]['user']=_0x5e2fb1[_0xfae0('0x3f')][_0xfae0('0x74')]=_0x192b45[_0xfae0('0x5e')][_0xfae0('0x75')];_0x5e2fb1[_0xfae0('0x3d')][_0xfae0('0x76')]=_0x5e2fb1[_0xfae0('0x3f')]['pass']=_0x192b45[_0xfae0('0x5e')]['cpassword'];}return db['MailAccount']['create'](_0x5e2fb1,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0xfae0('0x3d')}]})['then'](function(_0x5ef751){var _0x3800d6=_0x192b45['user']['get']({'plain':!![]});if(!_0x3800d6)throw new Error(_0xfae0('0x7c'));if(_0x3800d6[_0xfae0('0x7d')]===_0xfae0('0x74')){var _0x377c3b=_0x5ef751[_0xfae0('0x36')]({'plain':!![]});return db[_0xfae0('0x7e')]['find']({'where':{'name':_0xfae0('0x37'),'userProfileId':_0x3800d6[_0xfae0('0x7f')]},'raw':!![]})[_0xfae0('0x1e')](function(_0x511c31){if(_0x511c31&&_0x511c31[_0xfae0('0x80')]===0x0){return db[_0xfae0('0x38')]['create']({'name':_0x377c3b[_0xfae0('0x3b')],'resourceId':_0x377c3b['id'],'type':_0x511c31[_0xfae0('0x3b')],'sectionId':_0x511c31['id']},{})[_0xfae0('0x1e')](function(){return _0x5ef751;});}else{return _0x5ef751;}})[_0xfae0('0x29')](function(_0x3cf8f9){logger['error'](_0xfae0('0x81'),_0x3cf8f9);throw _0x3cf8f9;});}return _0x5ef751;})['then'](respondWithResult(_0x4ca3c8,0xc9))[_0xfae0('0x29')](handleError(_0x4ca3c8,null));};exports[_0xfae0('0x82')]=function(_0x5a9432,_0x32dbc3,_0x35582b){return db[_0xfae0('0x53')][_0xfae0('0x65')]({'where':{'id':_0x5a9432[_0xfae0('0x5f')]['id']}})[_0xfae0('0x1e')](handleEntityNotFound(_0x32dbc3,null))[_0xfae0('0x1e')](function(_0x2199d5){if(_0x2199d5){return _0x2199d5[_0xfae0('0x82')]();}return null;})['then'](respondWithResult(_0x32dbc3,null))[_0xfae0('0x29')](handleError(_0x32dbc3,null));};exports[_0xfae0('0x83')]=function(_0x448d4d,_0x1666a4,_0x513d9d){if(_0x448d4d['body']['id']){delete _0x448d4d[_0xfae0('0x5e')]['id'];}return db[_0xfae0('0x53')]['find']({'where':{'id':_0x448d4d['params']['id']}})['then'](handleEntityNotFound(_0x1666a4,null))[_0xfae0('0x1e')](function(_0x38f069){if(_0x38f069){_0x448d4d['body']['MailAccountId']=_0x38f069['id'];return db[_0xfae0('0x59')][_0xfae0('0x63')](_0x448d4d[_0xfae0('0x5e')]);}})[_0xfae0('0x1e')](respondWithResult(_0x1666a4,null))[_0xfae0('0x29')](handleError(_0x1666a4,null));};exports[_0xfae0('0x84')]=function(_0x330737,_0x8b4ac0,_0x1f7beb){return db[_0xfae0('0x53')][_0xfae0('0x65')]({'where':{'id':_0x330737[_0xfae0('0x5f')]['id']}})['then'](handleEntityNotFound(_0x8b4ac0,null))[_0xfae0('0x1e')](function(_0x3b027f){if(_0x3b027f){return _0x3b027f['setImap'](null);}return null;})[_0xfae0('0x1e')](respondWithStatusCode(_0x8b4ac0,null))['catch'](handleError(_0x8b4ac0,null));};exports[_0xfae0('0x85')]=function(_0x41e6cb,_0x2133ce,_0x51eaa4){return db[_0xfae0('0x53')][_0xfae0('0x65')]({'where':{'id':_0x41e6cb['params']['id']}})[_0xfae0('0x1e')](handleEntityNotFound(_0x2133ce,null))['then'](function(_0x31a246){if(_0x31a246){return _0x31a246['getSmtp']();}return null;})[_0xfae0('0x1e')](respondWithResult(_0x2133ce,null))[_0xfae0('0x29')](handleError(_0x2133ce,null));};exports[_0xfae0('0x86')]=function(_0x1b3404,_0x8690ae,_0x302fba){if(_0x1b3404[_0xfae0('0x5e')]['id']){delete _0x1b3404['body']['id'];}return db['MailAccount'][_0xfae0('0x5d')]({'where':{'id':_0x1b3404[_0xfae0('0x5f')]['id']}})[_0xfae0('0x1e')](handleEntityNotFound(_0x8690ae,null))[_0xfae0('0x1e')](function(_0xc6f4a7){if(_0xc6f4a7){_0x1b3404['body']['MailAccountId']=_0xc6f4a7['id'];return db['MailServerOut'][_0xfae0('0x63')](_0x1b3404[_0xfae0('0x5e')]);}})['then'](respondWithResult(_0x8690ae,null))['catch'](handleError(_0x8690ae,null));};exports[_0xfae0('0x87')]=function(_0x14f946,_0xfea26f,_0x2fcc7f){return db[_0xfae0('0x53')][_0xfae0('0x65')]({'where':{'id':_0x14f946[_0xfae0('0x5f')]['id']}})[_0xfae0('0x1e')](handleEntityNotFound(_0xfea26f,null))[_0xfae0('0x1e')](function(_0x389cfd){if(_0x389cfd){return _0x389cfd[_0xfae0('0x88')](null);}return null;})[_0xfae0('0x1e')](respondWithStatusCode(_0xfea26f,null))['catch'](handleError(_0xfea26f,null));};exports[_0xfae0('0x89')]=function(_0x2b92ce,_0x3ef7ba,_0x58141c){return db[_0xfae0('0x8a')][_0xfae0('0x5d')]({'where':{'id':_0x2b92ce[_0xfae0('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3ef7ba,null))['then'](function(_0x2e7d09){if(_0x2e7d09){return _0x2e7d09[_0xfae0('0x89')](_0x2b92ce[_0xfae0('0x5e')][_0xfae0('0x67')],_[_0xfae0('0x8b')](_0x2b92ce[_0xfae0('0x5e')],[_0xfae0('0x67'),'id'])||{});}})[_0xfae0('0x1e')](respondWithResult(_0x3ef7ba,null))[_0xfae0('0x29')](handleError(_0x3ef7ba,null));};exports['getInteractions']=function(_0x3a7f14,_0x5d39ed,_0x4bf268){var _0x27faee={'raw':![],'where':{}};var _0x36faa0={};var _0x2f09fe={'count':0x0,'rows':[]};return db[_0xfae0('0x53')][_0xfae0('0x65')]({'where':{'id':_0x3a7f14[_0xfae0('0x5f')]['id']}})[_0xfae0('0x1e')](handleEntityNotFound(_0x5d39ed,null))[_0xfae0('0x1e')](function(_0x23b1b8){if(_0x23b1b8){_0x36faa0['model']=_[_0xfae0('0x44')](db['MailInteraction'][_0xfae0('0x5b')]);_0x36faa0[_0xfae0('0x43')]=_['keys'](_0x3a7f14[_0xfae0('0x43')]);_0x36faa0[_0xfae0('0x45')]=_[_0xfae0('0x46')](_0x36faa0[_0xfae0('0x42')],_0x36faa0[_0xfae0('0x43')]);_0x27faee[_0xfae0('0x47')]=_['intersection'](_0x36faa0[_0xfae0('0x42')],qs['fields'](_0x3a7f14['query'][_0xfae0('0x48')]));_0x27faee[_0xfae0('0x47')]=_0x27faee[_0xfae0('0x47')][_0xfae0('0x49')]?_0x27faee[_0xfae0('0x47')]:_0x36faa0[_0xfae0('0x42')];if(!_0x3a7f14['query'][_0xfae0('0x4a')](_0xfae0('0x4b'))){_0x27faee[_0xfae0('0x2f')]=qs[_0xfae0('0x2f')](_0x3a7f14[_0xfae0('0x43')][_0xfae0('0x2f')]);_0x27faee[_0xfae0('0x2e')]=qs[_0xfae0('0x2e')](_0x3a7f14['query']['offset']);}_0x27faee[_0xfae0('0x6a')]=qs[_0xfae0('0x4c')](_0x3a7f14[_0xfae0('0x43')]['sort']);_0x27faee[_0xfae0('0x4f')]=qs['filters'](_[_0xfae0('0x4d')](_0x3a7f14[_0xfae0('0x43')],_0x36faa0['filters']));_0x27faee[_0xfae0('0x4f')]['MailAccountId']=_0x23b1b8['id'];if(_0x3a7f14[_0xfae0('0x43')][_0xfae0('0x4e')]){_0x27faee[_0xfae0('0x4f')]=_['merge'](_0x27faee[_0xfae0('0x4f')],{'$or':_['map'](_0x27faee[_0xfae0('0x47')],function(_0x2fc234){var _0x2abcea={};_0x2abcea[_0x2fc234]={'$like':'%'+_0x3a7f14[_0xfae0('0x43')][_0xfae0('0x4e')]+'%'};return _0x2abcea;})});}_0x27faee=_[_0xfae0('0x50')]({},_0x27faee,_0x3a7f14[_0xfae0('0x52')]);return db[_0xfae0('0x8a')][_0xfae0('0x2d')]({'where':_0x27faee['where']})[_0xfae0('0x1e')](function(_0x5cc679){_0x2f09fe[_0xfae0('0x2d')]=_0x5cc679;if(_0x3a7f14[_0xfae0('0x43')][_0xfae0('0x54')]){_0x27faee['include']=[{'model':db[_0xfae0('0x8c')],'as':_0xfae0('0x8d'),'required':![]},{'model':db[_0xfae0('0x8e')],'as':_0xfae0('0x8f'),'attributes':[_0xfae0('0x3b'),_0xfae0('0x90'),_0xfae0('0x91')],'required':![]},{'model':db[_0xfae0('0x92')],'as':'Tags','attributes':['id',_0xfae0('0x3b'),'color'],'where':_0x3a7f14['query']['tag']?{'id':_0x3a7f14[_0xfae0('0x43')]['tag']}:undefined,'required':_0x3a7f14['query']['tag']?!![]:![]}];}return db[_0xfae0('0x8a')][_0xfae0('0x56')](_0x27faee);})[_0xfae0('0x1e')](function(_0x2882f7){_0x2f09fe[_0xfae0('0x57')]=_0x2882f7;return _0x2f09fe;});}})['then'](respondWithFilteredResult(_0x5d39ed,_0x27faee))[_0xfae0('0x29')](handleError(_0x5d39ed,null));};exports['addApplications']=function(_0x5e0ce1,_0x2848f0,_0x2398d3){return db[_0xfae0('0x53')]['findOne']({'where':{'id':_0x5e0ce1[_0xfae0('0x5f')]['id']}})[_0xfae0('0x1e')](handleEntityNotFound(_0x2848f0,null))[_0xfae0('0x1e')](function(_0x36b37f){if(_0x36b37f){return db[_0xfae0('0x93')]['transaction'](function(_0x6dcb2b){return db[_0xfae0('0x94')]['destroy']({'where':{'MailAccountId':_0x5e0ce1[_0xfae0('0x5f')]['id']},'transaction':_0x6dcb2b})[_0xfae0('0x1e')](function(_0x31f5cf){var _0x33a0b5=_[_0xfae0('0x41')](_0x5e0ce1[_0xfae0('0x5e')],function(_0xb1bc1b){_0xb1bc1b[_0xfae0('0x95')]=_0x5e0ce1[_0xfae0('0x5f')]['id'];return _0xb1bc1b;});return db[_0xfae0('0x94')][_0xfae0('0x96')](_0x33a0b5,{'transaction':_0x6dcb2b});});})['then'](function(){return db[_0xfae0('0x94')]['findAndCountAll']({'where':{'MailAccountId':_0x5e0ce1[_0xfae0('0x5f')]['id']},'order':_0xfae0('0x97')});});}})[_0xfae0('0x1e')](respondWithResult(_0x2848f0,null))[_0xfae0('0x29')](handleError(_0x2848f0,null));};exports[_0xfae0('0x98')]=function(_0x40d54e,_0x48f249,_0x5adbb4){var _0x2bf398={};var _0x4b6df9={};var _0x3aa21d;var _0x20a04e;return db[_0xfae0('0x53')][_0xfae0('0x65')]({'where':{'id':_0x40d54e['params']['id']}})[_0xfae0('0x1e')](handleEntityNotFound(_0x48f249,null))['then'](function(_0x1593ee){if(_0x1593ee){_0x3aa21d=_0x1593ee;_0x4b6df9[_0xfae0('0x42')]=_['keys'](db[_0xfae0('0x94')][_0xfae0('0x5b')]);_0x4b6df9[_0xfae0('0x43')]=_['keys'](_0x40d54e[_0xfae0('0x43')]);_0x4b6df9[_0xfae0('0x45')]=_[_0xfae0('0x46')](_0x4b6df9[_0xfae0('0x42')],_0x4b6df9['query']);_0x2bf398[_0xfae0('0x47')]=_[_0xfae0('0x46')](_0x4b6df9[_0xfae0('0x42')],qs[_0xfae0('0x48')](_0x40d54e[_0xfae0('0x43')][_0xfae0('0x48')]));_0x2bf398[_0xfae0('0x47')]=_0x2bf398[_0xfae0('0x47')]['length']?_0x2bf398[_0xfae0('0x47')]:_0x4b6df9['model'];_0x2bf398['order']=qs[_0xfae0('0x4c')](_0x40d54e[_0xfae0('0x43')][_0xfae0('0x4c')]);_0x2bf398[_0xfae0('0x4f')]=qs[_0xfae0('0x45')](_['pick'](_0x40d54e[_0xfae0('0x43')],_0x4b6df9[_0xfae0('0x45')]));if(_0x40d54e['query'][_0xfae0('0x4e')]){_0x2bf398[_0xfae0('0x4f')]=_[_0xfae0('0x50')](_0x2bf398[_0xfae0('0x4f')],{'$or':_[_0xfae0('0x41')](_0x2bf398[_0xfae0('0x47')],function(_0x46158a){var _0x454895={};_0x454895[_0x46158a]={'$like':'%'+_0x40d54e[_0xfae0('0x43')]['filter']+'%'};return _0x454895;})});}_0x2bf398=_[_0xfae0('0x50')]({},_0x2bf398,_0x40d54e['options']);return _0x3aa21d[_0xfae0('0x98')](_0x2bf398);}})[_0xfae0('0x1e')](function(_0x328851){if(_0x328851){_0x20a04e=_0x328851['length'];if(!_0x40d54e[_0xfae0('0x43')][_0xfae0('0x4a')](_0xfae0('0x4b'))){_0x2bf398[_0xfae0('0x2f')]=qs[_0xfae0('0x2f')](_0x40d54e[_0xfae0('0x43')][_0xfae0('0x2f')]);_0x2bf398['offset']=qs[_0xfae0('0x2e')](_0x40d54e[_0xfae0('0x43')][_0xfae0('0x2e')]);}return _0x3aa21d[_0xfae0('0x98')](_0x2bf398);}})[_0xfae0('0x1e')](function(_0x465031){if(_0x465031){return _0x465031?{'count':_0x20a04e,'rows':_0x465031}:null;}})['then'](respondWithResult(_0x48f249,null))['catch'](handleError(_0x48f249,null));};exports['getMessages']=function(_0x1e8956,_0x42aa24,_0x222e47){var _0x393813={'raw':!![],'where':{}};var _0x11cc07={};var _0x599fcb={'count':0x0,'rows':[]};return db[_0xfae0('0x53')][_0xfae0('0x65')]({'where':{'id':_0x1e8956['params']['id']}})[_0xfae0('0x1e')](handleEntityNotFound(_0x42aa24,null))[_0xfae0('0x1e')](function(_0x472918){if(_0x472918){_0x11cc07[_0xfae0('0x42')]=_[_0xfae0('0x44')](db['MailMessage'][_0xfae0('0x5b')]);_0x11cc07[_0xfae0('0x43')]=_[_0xfae0('0x44')](_0x1e8956[_0xfae0('0x43')]);_0x11cc07[_0xfae0('0x45')]=_[_0xfae0('0x46')](_0x11cc07['model'],_0x11cc07[_0xfae0('0x43')]);_0x393813[_0xfae0('0x47')]=_[_0xfae0('0x46')](_0x11cc07[_0xfae0('0x42')],qs[_0xfae0('0x48')](_0x1e8956[_0xfae0('0x43')][_0xfae0('0x48')]));_0x393813[_0xfae0('0x47')]=_0x393813['attributes'][_0xfae0('0x49')]?_0x393813['attributes']:_0x11cc07[_0xfae0('0x42')];if(!_0x1e8956[_0xfae0('0x43')][_0xfae0('0x4a')](_0xfae0('0x4b'))){_0x393813['limit']=qs[_0xfae0('0x2f')](_0x1e8956[_0xfae0('0x43')][_0xfae0('0x2f')]);_0x393813[_0xfae0('0x2e')]=qs[_0xfae0('0x2e')](_0x1e8956[_0xfae0('0x43')][_0xfae0('0x2e')]);}_0x393813[_0xfae0('0x6a')]=qs[_0xfae0('0x4c')](_0x1e8956[_0xfae0('0x43')][_0xfae0('0x4c')]);_0x393813[_0xfae0('0x4f')]=qs['filters'](_['pick'](_0x1e8956[_0xfae0('0x43')],_0x11cc07[_0xfae0('0x45')]));_0x393813[_0xfae0('0x4f')][_0xfae0('0x95')]=_0x472918['id'];if(_0x1e8956[_0xfae0('0x43')]['filter']){_0x393813[_0xfae0('0x4f')]=_[_0xfae0('0x50')](_0x393813[_0xfae0('0x4f')],{'$or':_['map'](_0x393813[_0xfae0('0x47')],function(_0x52a794){var _0x4634b5={};_0x4634b5[_0x52a794]={'$like':'%'+_0x1e8956[_0xfae0('0x43')][_0xfae0('0x4e')]+'%'};return _0x4634b5;})});}if(_0x1e8956['query']['$gte']){var _0x28d9f1=_0x1e8956[_0xfae0('0x43')][_0xfae0('0x99')]['split'](',');var _0x5f50e3={};_0x5f50e3[_0x28d9f1[0x0]]={'$gte':moment(_0x28d9f1[0x1])[_0xfae0('0x9a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x393813[_0xfae0('0x4f')]=_[_0xfae0('0x50')](_0x393813[_0xfae0('0x4f')],_0x5f50e3);}_0x393813=_[_0xfae0('0x50')]({},_0x393813,_0x1e8956['options']);return db[_0xfae0('0x9b')][_0xfae0('0x2d')]({'where':_0x393813[_0xfae0('0x4f')]})[_0xfae0('0x1e')](function(_0x2d478b){_0x599fcb[_0xfae0('0x2d')]=_0x2d478b;if(_0x1e8956[_0xfae0('0x43')][_0xfae0('0x54')]){_0x393813['include']=[{'all':!![]}];}return db[_0xfae0('0x9b')][_0xfae0('0x56')](_0x393813);})[_0xfae0('0x1e')](function(_0xb4b08e){_0x599fcb[_0xfae0('0x57')]=_0xb4b08e;return _0x599fcb;});}})['then'](respondWithFilteredResult(_0x42aa24,_0x393813))[_0xfae0('0x29')](handleError(_0x42aa24,null));};exports[_0xfae0('0x3c')]=function(_0x5b9c4c,_0x4f5b97,_0x629022){var _0x4b3461,_0x30c816={},_0x2e6bab;if(_0x5b9c4c['body']['to']){_0x2e6bab=_0x5b9c4c['body']['to'][_0xfae0('0x9c')](',')[0x0];}return db['MailAccount'][_0xfae0('0x5d')]({'where':{'id':_0x5b9c4c[_0xfae0('0x5f')]['id']},'include':[{'model':db[_0xfae0('0x9d')],'as':_0xfae0('0x9e'),'include':[{'model':db[_0xfae0('0x8c')],'as':'Contacts','where':{'email':_0x2e6bab},'limit':0x1,'order':[[_0xfae0('0x9f'),'DESC']]}]},{'model':db[_0xfae0('0x3e')],'as':_0xfae0('0x3f'),'raw':!![]}]})[_0xfae0('0x1e')](handleEntityNotFound(_0x4f5b97,null))[_0xfae0('0x1e')](function(_0x2e1407){if(_0x2e1407){_0x4b3461=_0x2e1407;if(_0x2e1407[_0xfae0('0x3f')]){if(_[_0xfae0('0x6f')](_0x5b9c4c[_0xfae0('0x5e')][_0xfae0('0xa0')])){_0x5b9c4c['body'][_0xfae0('0xa0')]=util[_0xfae0('0x9a')](_0xfae0('0xa1'),_0x2e1407[_0xfae0('0x3b')],_0x2e1407['email']||_0x2e1407[_0xfae0('0x3f')]['user']);}if(_0x5b9c4c[_0xfae0('0x5e')][_0xfae0('0xa2')]&&_0x5b9c4c[_0xfae0('0x5e')][_0xfae0('0xa2')][_0xfae0('0x49')]){for(var _0x17fb3b=0x0;_0x17fb3b<_0x5b9c4c[_0xfae0('0x5e')][_0xfae0('0xa2')][_0xfae0('0x49')];_0x17fb3b+=0x1){_0x5b9c4c[_0xfae0('0x5e')]['attachments'][_0x17fb3b]={'filename':_0x5b9c4c[_0xfae0('0x5e')][_0xfae0('0xa2')][_0x17fb3b]['name'],'path':path[_0xfae0('0xa3')](config[_0xfae0('0xa4')],'server/files/attachments',_0x5b9c4c[_0xfae0('0x5e')][_0xfae0('0xa2')][_0x17fb3b][_0xfae0('0xa5')])};}}var _0x1cb550={'tls':{'rejectUnauthorized':![]}};if(_[_0xfae0('0x6f')](_0x2e1407[_0xfae0('0x3f')][_0xfae0('0x7b')])){if(_0x2e1407[_0xfae0('0x3f')]['authentication']){_0x1cb550[_0xfae0('0xa6')]={'user':_0x2e1407['Smtp'][_0xfae0('0x74')],'pass':_0x2e1407[_0xfae0('0x3f')][_0xfae0('0x77')]};}_0x1cb550['host']=_0x2e1407[_0xfae0('0x3f')][_0xfae0('0x79')];_0x1cb550[_0xfae0('0x7a')]=_0x2e1407[_0xfae0('0x3f')]['port'];_0x1cb550[_0xfae0('0xa7')]=_0x2e1407['Smtp']['secure'];}else{_0x1cb550[_0xfae0('0x7b')]=_0x2e1407[_0xfae0('0x3f')][_0xfae0('0x7b')];_0x1cb550[_0xfae0('0xa6')]={'user':_0x2e1407[_0xfae0('0x3f')][_0xfae0('0x74')],'pass':_0x2e1407[_0xfae0('0x3f')][_0xfae0('0x77')]};}return respondWithRpcPromise(_0xfae0('0xa8'),'sendMail',{'account':_0x1cb550,'message':_0x5b9c4c[_0xfae0('0x5e')]});}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x32f8a7){if(_0x32f8a7){_0x30c816=_0x32f8a7;if(_0x4b3461[_0xfae0('0x9e')]){if(_0x4b3461[_0xfae0('0x9e')][_0xfae0('0xa9')][_0xfae0('0x49')]){return _0x4b3461['List'][_0xfae0('0xa9')][0x0];}else{return db['CmContact'][_0xfae0('0x63')](_[_0xfae0('0x17')](_0x5b9c4c['body'],{'firstName':_0x5b9c4c[_0xfae0('0x5e')]['to'],'email':_0x5b9c4c[_0xfae0('0x5e')]['to'],'phone':_0x5b9c4c[_0xfae0('0x5e')]['to'],'ListId':_0x4b3461[_0xfae0('0x6e')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0xfae0('0x1e')](function(_0x197f52){if(_0x197f52){var _0x3d9ede={'UserId':_0x5b9c4c[_0xfae0('0x74')]['id'],'ContactId':_0x197f52['id'],'MailAccountId':_0x4b3461['id'],'inReplyTo':_0x30c816[_0xfae0('0xaa')],'to':_0x5b9c4c[_0xfae0('0x5e')]['from'],'cc':_0x5b9c4c[_0xfae0('0x5e')]['cc'],'subject':_0x5b9c4c['body']['subject'],'attach':_0x5b9c4c[_0xfae0('0x5e')][_0xfae0('0xab')],'firstMsgDirection':_0xfae0('0xac'),'lastMsgAt':moment()[_0xfae0('0x9a')](_0xfae0('0xad')),'lastMsgDirection':'out','lastMsgBody':_0x5b9c4c[_0xfae0('0x5e')][_0xfae0('0x5e')],'Messages':[_[_0xfae0('0x50')](_0x5b9c4c[_0xfae0('0x5e')],{'messageId':_0x30c816[_0xfae0('0xaa')],'sentAt':moment()['format'](_0xfae0('0xad')),'read':!![],'MailAccountId':_0x4b3461['id'],'UserId':_0x5b9c4c[_0xfae0('0x74')]['id'],'ContactId':_0x197f52['id']})]};if(_0x5b9c4c[_0xfae0('0x5e')][_0xfae0('0xae')]){_0x3d9ede=_['merge'](_0x3d9ede,_0x5b9c4c[_0xfae0('0x5e')]['Interaction']);}return db[_0xfae0('0x8a')]['create'](_0x3d9ede,{'include':[{'model':db[_0xfae0('0x9b')],'as':_0xfae0('0xaf')}]});}})[_0xfae0('0x1e')](respondWithResult(_0x4f5b97,null))[_0xfae0('0x29')](handleError(_0x4f5b97,null));};exports['verifySmtp']=function(_0x41ffbb,_0x5c1df3,_0x5cc02c){return db[_0xfae0('0x53')]['find']({'where':{'id':_0x41ffbb[_0xfae0('0x5f')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xfae0('0x3f'),'raw':!![]}]})[_0xfae0('0x1e')](handleEntityNotFound(_0x5c1df3,null))[_0xfae0('0x1e')](function(_0x5bf449){if(_0x5bf449&&_0x5bf449[_0xfae0('0x3f')]){var _0x3ac2fc={'id':_0x5bf449['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5bf449[_0xfae0('0x3f')][_0xfae0('0x7b')]){_0x3ac2fc[_0xfae0('0x7b')]=_0x5bf449[_0xfae0('0x3f')][_0xfae0('0x7b')];}else{_0x3ac2fc[_0xfae0('0x79')]=_0x5bf449[_0xfae0('0x3f')][_0xfae0('0x79')];_0x3ac2fc[_0xfae0('0x7a')]=_0x5bf449[_0xfae0('0x3f')][_0xfae0('0x7a')];_0x3ac2fc['secure']=_0x5bf449['Smtp'][_0xfae0('0xa7')];}if(_0x5bf449[_0xfae0('0x3f')][_0xfae0('0x78')]){_0x3ac2fc[_0xfae0('0xa6')]={'user':_0x5bf449[_0xfae0('0x3f')][_0xfae0('0x74')],'pass':_0x5bf449[_0xfae0('0x3f')]['pass']};}return respondWithRpcPromise('VerifySmtp',_0xfae0('0xb0'),{'account':_0x3ac2fc});}})[_0xfae0('0x1e')](respondWithResult(_0x5c1df3,null))[_0xfae0('0x29')](handleError(_0x5c1df3,null));};exports[_0xfae0('0x35')]=function(_0x4c0de9,_0x5a65a2){return db[_0xfae0('0x53')][_0xfae0('0x5d')]({'where':{'id':_0x4c0de9['params']['id']}})[_0xfae0('0x1e')](handleEntityNotFound(_0x5a65a2,null))[_0xfae0('0x1e')](function(_0x3069ac){if(_0x3069ac&&_0x3069ac['service']){throw new db['Sequelize'][(_0xfae0('0xb1'))](_0xfae0('0xb2'));}return _0x3069ac;})[_0xfae0('0x1e')](removeEntity(_0x5a65a2,null))[_0xfae0('0x29')](handleError(_0x5a65a2,null));};exports[_0xfae0('0xb3')]=function(_0x126ceb,_0x26997a,_0xe85604){return db[_0xfae0('0x53')][_0xfae0('0x5d')]({'where':{'id':_0x126ceb[_0xfae0('0x5f')]['id']}})[_0xfae0('0x1e')](handleEntityNotFound(_0x26997a,null))['then'](function(_0x53a32a){if(_0x53a32a){return _0x53a32a[_0xfae0('0xb3')](_0x126ceb['body'][_0xfae0('0x67')],_[_0xfae0('0x8b')](_0x126ceb[_0xfae0('0x5e')],[_0xfae0('0x67'),'id'])||{})[_0xfae0('0xb4')](function(_0xfcf7b2){for(var _0x355a63=0x0;_0x355a63<_0x126ceb[_0xfae0('0x5e')][_0xfae0('0x67')][_0xfae0('0x49')];_0x355a63+=0x1){socket['emit'](_0xfae0('0xb5'),{'UserId':_0x126ceb[_0xfae0('0x5e')][_0xfae0('0x67')][_0x355a63],'MailAccountId':_0x126ceb[_0xfae0('0x5f')]['id']});}return _0xfcf7b2;});}})['then'](respondWithResult(_0x26997a,null))[_0xfae0('0x29')](handleError(_0x26997a,null));};exports['removeAgents']=function(_0x2d0b8a,_0x39486e,_0x853b9a){return db[_0xfae0('0x53')][_0xfae0('0x5d')]({'where':{'id':_0x2d0b8a[_0xfae0('0x5f')]['id']}})[_0xfae0('0x1e')](handleEntityNotFound(_0x39486e,null))[_0xfae0('0x1e')](function(_0x691464){if(_0x691464){return _0x691464[_0xfae0('0xb6')](_0x2d0b8a['query'][_0xfae0('0x67')])['then'](function(){if(_[_0xfae0('0xb7')](_0x2d0b8a[_0xfae0('0x43')][_0xfae0('0x67')])){for(var _0x25939a=0x0;_0x25939a<_0x2d0b8a['query'][_0xfae0('0x67')][_0xfae0('0x49')];_0x25939a+=0x1){socket[_0xfae0('0xb8')]('userMailAccount:remove',{'UserId':Number(_0x2d0b8a[_0xfae0('0x43')][_0xfae0('0x67')][_0x25939a]),'MailAccountId':Number(_0x2d0b8a['params']['id'])});}}else{socket['emit'](_0xfae0('0xb9'),{'UserId':Number(_0x2d0b8a['query'][_0xfae0('0x67')]),'MailAccountId':Number(_0x2d0b8a[_0xfae0('0x5f')]['id'])});}});}})[_0xfae0('0x1e')](respondWithStatusCode(_0x39486e,null))['catch'](handleError(_0x39486e,null));};exports[_0xfae0('0xba')]=function(_0x25b73e,_0x12a5ec,_0x5c3610){var _0x2ca847={};var _0x55b088={};var _0xdd8deb;var _0x1863b1;return db[_0xfae0('0x53')]['findOne']({'where':{'id':_0x25b73e[_0xfae0('0x5f')]['id']}})[_0xfae0('0x1e')](handleEntityNotFound(_0x12a5ec,null))[_0xfae0('0x1e')](function(_0x38dbc7){if(_0x38dbc7){_0xdd8deb=_0x38dbc7;_0x55b088[_0xfae0('0x42')]=_[_0xfae0('0x44')](db[_0xfae0('0x8e')]['rawAttributes']);_0x55b088[_0xfae0('0x43')]=_['keys'](_0x25b73e[_0xfae0('0x43')]);_0x55b088[_0xfae0('0x45')]=_[_0xfae0('0x46')](_0x55b088[_0xfae0('0x42')],_0x55b088[_0xfae0('0x43')]);_0x2ca847[_0xfae0('0x47')]=_['intersection'](_0x55b088[_0xfae0('0x42')],qs[_0xfae0('0x48')](_0x25b73e['query'][_0xfae0('0x48')]));_0x2ca847['attributes']=_0x2ca847[_0xfae0('0x47')][_0xfae0('0x49')]?_0x2ca847[_0xfae0('0x47')]:_0x55b088[_0xfae0('0x42')];_0x2ca847[_0xfae0('0x6a')]=qs['sort'](_0x25b73e[_0xfae0('0x43')][_0xfae0('0x4c')]);_0x2ca847[_0xfae0('0x4f')]=qs[_0xfae0('0x45')](_[_0xfae0('0x4d')](_0x25b73e[_0xfae0('0x43')],_0x55b088[_0xfae0('0x45')]));if(_0x25b73e[_0xfae0('0x43')]['filter']){_0x2ca847[_0xfae0('0x4f')]=_[_0xfae0('0x50')](_0x2ca847[_0xfae0('0x4f')],{'$or':_[_0xfae0('0x41')](_0x2ca847['attributes'],function(_0x148e16){var _0xdfcec5={};_0xdfcec5[_0x148e16]={'$like':'%'+_0x25b73e[_0xfae0('0x43')]['filter']+'%'};return _0xdfcec5;})});}_0x2ca847=_[_0xfae0('0x50')]({},_0x2ca847,_0x25b73e['options']);return _0xdd8deb[_0xfae0('0xba')](_0x2ca847);}})[_0xfae0('0x1e')](function(_0x541e4d){if(_0x541e4d){_0x1863b1=_0x541e4d[_0xfae0('0x49')];if(!_0x25b73e['query'][_0xfae0('0x4a')]('nolimit')){_0x2ca847[_0xfae0('0x2f')]=qs[_0xfae0('0x2f')](_0x25b73e['query'][_0xfae0('0x2f')]);_0x2ca847[_0xfae0('0x2e')]=qs[_0xfae0('0x2e')](_0x25b73e[_0xfae0('0x43')][_0xfae0('0x2e')]);}return _0xdd8deb[_0xfae0('0xba')](_0x2ca847);}})[_0xfae0('0x1e')](function(_0x152ddf){if(_0x152ddf){return _0x152ddf?{'count':_0x1863b1,'rows':_0x152ddf}:null;}})[_0xfae0('0x1e')](respondWithResult(_0x12a5ec,null))[_0xfae0('0x29')](handleError(_0x12a5ec,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 85a687e..36166c0 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 _0x5ace=['MailAccount','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0xb5ed5f,_0x4927c7){var _0x40a78b=function(_0x56a65d){while(--_0x56a65d){_0xb5ed5f['push'](_0xb5ed5f['shift']());}};_0x40a78b(++_0x4927c7);}(_0x5ace,0xb7));var _0xe5ac=function(_0x49ca6b,_0x3ba842){_0x49ca6b=_0x49ca6b-0x0;var _0x1d957f=_0x5ace[_0x49ca6b];return _0x1d957f;};'use strict';var EventEmitter=require(_0xe5ac('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xe5ac('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xe5ac('0x2')](0x0);var events={'afterCreate':_0xe5ac('0x3'),'afterUpdate':_0xe5ac('0x4'),'afterDestroy':_0xe5ac('0x5')};function emitEvent(_0x490f26){return function(_0x2bf278,_0x1c1f01,_0x1dd2ac){MailAccountEvents[_0xe5ac('0x6')](_0x490f26+':'+_0x2bf278['id'],_0x2bf278);MailAccountEvents[_0xe5ac('0x6')](_0x490f26,_0x2bf278);_0x1dd2ac(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xe5ac('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x8ad0=['setMaxListeners','update','emit','hasOwnProperty','hook','events','../../mysqldb','MailAccount'];(function(_0x52928b,_0x28a481){var _0x570034=function(_0x3f9a28){while(--_0x3f9a28){_0x52928b['push'](_0x52928b['shift']());}};_0x570034(++_0x28a481);}(_0x8ad0,0x105));var _0x08ad=function(_0x382f87,_0xe58a7e){_0x382f87=_0x382f87-0x0;var _0x1a7007=_0x8ad0[_0x382f87];return _0x1a7007;};'use strict';var EventEmitter=require(_0x08ad('0x0'));var MailAccount=require(_0x08ad('0x1'))['db'][_0x08ad('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x08ad('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x08ad('0x4'),'afterDestroy':'remove'};function emitEvent(_0x491c5b){return function(_0xdaa861,_0x403747,_0x363222){MailAccountEvents[_0x08ad('0x5')](_0x491c5b+':'+_0xdaa861['id'],_0xdaa861);MailAccountEvents['emit'](_0x491c5b,_0xdaa861);_0x363222(null);};}for(var e in events){if(events[_0x08ad('0x6')](e)){var event=events[e];MailAccount[_0x08ad('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 8460690..38d2ca9 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 _0x0286=['path','rimraf','../../config/environment','exports','define','MailAccount','mail_accounts','util','../../config/logger','api','moment','request-promise'];(function(_0xe5b3e1,_0x57a645){var _0x121dad=function(_0x3aa300){while(--_0x3aa300){_0xe5b3e1['push'](_0xe5b3e1['shift']());}};_0x121dad(++_0x57a645);}(_0x0286,0x7f));var _0x6028=function(_0x5b0647,_0xb6acae){_0x5b0647=_0x5b0647-0x0;var _0x3f2654=_0x0286[_0x5b0647];return _0x3f2654;};'use strict';var _=require('lodash');var util=require(_0x6028('0x0'));var logger=require(_0x6028('0x1'))(_0x6028('0x2'));var moment=require(_0x6028('0x3'));var BPromise=require('bluebird');var rp=require(_0x6028('0x4'));var fs=require('fs');var path=require(_0x6028('0x5'));var rimraf=require(_0x6028('0x6'));var config=require(_0x6028('0x7'));var attributes=require('./mailAccount.attributes');module[_0x6028('0x8')]=function(_0x4b9b65,_0x398959){return _0x4b9b65[_0x6028('0x9')](_0x6028('0xa'),attributes,{'tableName':_0x6028('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec37=['util','../../config/logger','api','moment','bluebird','path','rimraf','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash'];(function(_0x5ce33c,_0x5c75a9){var _0x40c7d4=function(_0xdc973a){while(--_0xdc973a){_0x5ce33c['push'](_0x5ce33c['shift']());}};_0x40c7d4(++_0x5c75a9);}(_0xec37,0x1e0));var _0x7ec3=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0xec37[_0x2ff238];return _0x204a56;};'use strict';var _=require(_0x7ec3('0x0'));var util=require(_0x7ec3('0x1'));var logger=require(_0x7ec3('0x2'))(_0x7ec3('0x3'));var moment=require(_0x7ec3('0x4'));var BPromise=require(_0x7ec3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ec3('0x6'));var rimraf=require(_0x7ec3('0x7'));var config=require('../../config/environment');var attributes=require(_0x7ec3('0x8'));module[_0x7ec3('0x9')]=function(_0x4debfb,_0x22b9ac){return _0x4debfb[_0x7ec3('0xa')](_0x7ec3('0xb'),attributes,{'tableName':_0x7ec3('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 e4dd70b..9d3cd35 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 _0x544a=['request\x20sent','stringify','error','message','info','result','catch','GetMailAccount','MailAccount','findAll','options','where','attributes','limit','include','map','model','debug','ShowMailAccount','find','raw','mail','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','MailApplication','Smtp','get','account','omit','Applications','applications','list','orderBy','asc','autoclose','push','close','*,*,*,*','length','List\x20not\x20found','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','Contact\x20not\x20found','update','interaction','created','MailMessage','create','attachments','bcc','Attachment','Attachments','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','MailAccount,\x20%s,\x20%s'];(function(_0x2fd2b9,_0x379706){var _0x316276=function(_0xda88f0){while(--_0xda88f0){_0x2fd2b9['push'](_0x2fd2b9['shift']());}};_0x316276(++_0x379706);}(_0x544a,0x118));var _0xa544=function(_0x28db62,_0xfe11c1){_0x28db62=_0x28db62-0x0;var _0xbc95be=_0x544a[_0x28db62];return _0xbc95be;};'use strict';var _=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var moment=require(_0xa544('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa544('0x3'));var db=require(_0xa544('0x4'))['db'];var utils=require(_0xa544('0x5'));var logger=require(_0xa544('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa544('0x7')][_0xa544('0x8')]({'port':0x232c});config[_0xa544('0x9')]=_['defaults'](config[_0xa544('0x9')],{'host':_0xa544('0xa'),'port':0x18eb});var socket=require(_0xa544('0xb'))(new Redis(config['redis']));require(_0xa544('0xc'))[_0xa544('0xd')](socket);function respondWithRpcPromise(_0x35abd7,_0x9e886d,_0x4d2796){return new BPromise(function(_0x295267,_0x1c961e){return client[_0xa544('0xe')](_0x35abd7,_0x4d2796)[_0xa544('0xf')](function(_0x2c22df){logger['info'](_0xa544('0x10'),_0x9e886d,'request\x20sent');logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x9e886d,_0xa544('0x11'),JSON[_0xa544('0x12')](_0x2c22df));if(_0x2c22df['error']){if(_0x2c22df['error']['code']===0x1f4){logger[_0xa544('0x13')](_0xa544('0x10'),_0x9e886d,_0x2c22df[_0xa544('0x13')]['message']);return _0x1c961e(_0x2c22df[_0xa544('0x13')][_0xa544('0x14')]);}logger[_0xa544('0x13')](_0xa544('0x10'),_0x9e886d,_0x2c22df[_0xa544('0x13')][_0xa544('0x14')]);return _0x295267(_0x2c22df['error'][_0xa544('0x14')]);}else{logger[_0xa544('0x15')]('MailAccount,\x20%s,\x20%s',_0x9e886d,'request\x20sent');_0x295267(_0x2c22df[_0xa544('0x16')][_0xa544('0x14')]);}})[_0xa544('0x17')](function(_0x112262){logger[_0xa544('0x13')](_0xa544('0x10'),_0x9e886d,_0x112262);_0x1c961e(_0x112262);});});}exports[_0xa544('0x18')]=function(_0x327820){var _0x34ed6d=this;return new Promise(function(_0x3da515,_0x19912e){return db[_0xa544('0x19')][_0xa544('0x1a')]({'raw':_0x327820[_0xa544('0x1b')]?_0x327820[_0xa544('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x327820['options']?_0x327820[_0xa544('0x1b')][_0xa544('0x1c')]||null:null,'attributes':_0x327820['options']?_0x327820[_0xa544('0x1b')][_0xa544('0x1d')]||null:null,'limit':_0x327820[_0xa544('0x1b')]?_0x327820[_0xa544('0x1b')][_0xa544('0x1e')]||null:null,'include':_0x327820['options']?_0x327820['options'][_0xa544('0x1f')]?_[_0xa544('0x20')](_0x327820[_0xa544('0x1b')][_0xa544('0x1f')],function(_0x20eee9){return{'model':db[_0x20eee9[_0xa544('0x21')]],'as':_0x20eee9['as'],'attributes':_0x20eee9['attributes'],'include':_0x20eee9[_0xa544('0x1f')]?_[_0xa544('0x20')](_0x20eee9[_0xa544('0x1f')],function(_0x453e37){return{'model':db[_0x453e37[_0xa544('0x21')]],'as':_0x453e37['as'],'attributes':_0x453e37[_0xa544('0x1d')],'include':_0x453e37[_0xa544('0x1f')]?_[_0xa544('0x20')](_0x453e37[_0xa544('0x1f')],function(_0x17d6bb){return{'model':db[_0x17d6bb['model']],'as':_0x17d6bb['as'],'attributes':_0x17d6bb['attributes']};}):[]};}):[]};}):[]:[]})[_0xa544('0xf')](function(_0x416e88){logger[_0xa544('0x15')](_0xa544('0x18'),_0x327820);logger[_0xa544('0x22')](_0xa544('0x18'),_0x327820,JSON['stringify'](_0x416e88));_0x3da515(_0x416e88);})[_0xa544('0x17')](function(_0x4478ec){logger['error']('GetMailAccount',_0x4478ec['message'],_0x327820);_0x19912e(_0x34ed6d[_0xa544('0x13')](0x1f4,_0x4478ec[_0xa544('0x14')]));});});};exports[_0xa544('0x23')]=function(_0x268067){var _0x534c41=this;return new Promise(function(_0x5dd8c7,_0x3e7380){return db[_0xa544('0x19')][_0xa544('0x24')]({'raw':_0x268067['options']?_0x268067[_0xa544('0x1b')][_0xa544('0x25')]===undefined?!![]:![]:!![],'where':_0x268067[_0xa544('0x1b')]?_0x268067[_0xa544('0x1b')][_0xa544('0x1c')]||null:null,'attributes':_0x268067[_0xa544('0x1b')]?_0x268067['options'][_0xa544('0x1d')]||null:null,'include':_0x268067[_0xa544('0x1b')]?_0x268067['options']['include']?_[_0xa544('0x20')](_0x268067[_0xa544('0x1b')][_0xa544('0x1f')],function(_0x11d7d2){return{'model':db[_0x11d7d2[_0xa544('0x21')]],'as':_0x11d7d2['as'],'attributes':_0x11d7d2[_0xa544('0x1d')],'include':_0x11d7d2[_0xa544('0x1f')]?_[_0xa544('0x20')](_0x11d7d2['include'],function(_0x54da8c){return{'model':db[_0x54da8c[_0xa544('0x21')]],'as':_0x54da8c['as'],'attributes':_0x54da8c[_0xa544('0x1d')],'include':_0x54da8c[_0xa544('0x1f')]?_[_0xa544('0x20')](_0x54da8c[_0xa544('0x1f')],function(_0x30ea82){return{'model':db[_0x30ea82[_0xa544('0x21')]],'as':_0x30ea82['as'],'attributes':_0x30ea82[_0xa544('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa544('0xf')](function(_0xd01d5d){logger['info'](_0xa544('0x23'),_0x268067);logger['debug']('ShowMailAccount',_0x268067,JSON[_0xa544('0x12')](_0xd01d5d));_0x5dd8c7(_0xd01d5d);})[_0xa544('0x17')](function(_0x3c6ed3){logger[_0xa544('0x13')](_0xa544('0x23'),_0x3c6ed3[_0xa544('0x14')],_0x268067);_0x3e7380(_0x534c41[_0xa544('0x13')](0x1f4,_0x3c6ed3['message']));});});};exports['NotifyMailAccount']=function(_0x586b02){var _0x42d9b6=this;return new Promise(function(_0x20b5f1,_0x527a3b){var _0x247392={'body':_0x586b02['body'],'channel':_0xa544('0x26')};var _0x5e3e91=_['difference'](_[_0xa544('0x27')](db[_0xa544('0x28')][_0xa544('0x29')]),[_0xa544('0x2a'),_0xa544('0x2b'),_0xa544('0x2c'),_0xa544('0x2d')]);var _0x9c8585=![];if(_0x586b02[_0xa544('0x2e')]['id']){delete _0x586b02[_0xa544('0x2e')]['id'];}if(_['isNil'](_0x586b02[_0xa544('0x2e')][_0xa544('0x2f')])){return _0x527a3b(_0x42d9b6[_0xa544('0x13')](0x1f4,_0xa544('0x30')));}if(_[_0xa544('0x31')](_0x586b02[_0xa544('0x2e')][_0xa544('0x2e')])||_0x586b02['body'][_0xa544('0x2e')]===''){return _0x527a3b(_0x42d9b6[_0xa544('0x13')](0x1f4,_0xa544('0x32')));}if(_['isNil'](_0x586b02['body'][_0xa544('0x33')])){return _0x527a3b(_0x42d9b6['error'](0x1f4,_0xa544('0x34')+_0x5e3e91));}if(!_[_0xa544('0x35')](_0x5e3e91,_0x586b02[_0xa544('0x2e')][_0xa544('0x33')])){return _0x527a3b(_0x42d9b6['error'](0x1f4,_0xa544('0x36')+_0x5e3e91));}var _0xb2b4c8={};_0xb2b4c8[_0x586b02['body'][_0xa544('0x33')]]=_0x586b02[_0xa544('0x2e')][_0xa544('0x2f')];return db[_0xa544('0x19')][_0xa544('0x24')]({'where':{'id':_0x586b02['account']['id']},'include':[{'model':db[_0xa544('0x37')],'as':_0xa544('0x38'),'include':[{'model':db[_0xa544('0x28')],'as':_0xa544('0x39'),'where':_0xb2b4c8,'limit':0x1,'order':[[_0xa544('0x2b'),'DESC']]}]},{'model':db[_0xa544('0x3a')],'as':'Applications'},{'model':db['MailServerOut'],'as':_0xa544('0x3b')}]})[_0xa544('0xf')](function(_0x356cd1){if(_0x356cd1&&_0x356cd1['List']){var _0x1e85c9=_0x356cd1[_0xa544('0x3c')]({'plain':!![]});_0x247392[_0xa544('0x3d')]=_[_0xa544('0x3e')](_0x1e85c9,[_0xa544('0x3f'),_0xa544('0x38')]);_0x247392[_0xa544('0x40')]=_0x1e85c9['Applications'];_0x247392[_0xa544('0x41')]=_0x1e85c9['List'];_0x247392[_0xa544('0x40')]=_[_0xa544('0x42')](_0x247392[_0xa544('0x40')],['priority'],[_0xa544('0x43')]);if(_0x247392[_0xa544('0x3d')]&&_0x247392[_0xa544('0x3d')][_0xa544('0x44')]){_0x247392[_0xa544('0x40')][_0xa544('0x45')]({'id':0x0,'priority':_0x247392['applications']['length']+0x1,'app':_0xa544('0x46'),'appdata':'autoclose','interval':_0xa544('0x47')});}if(_0x247392[_0xa544('0x3d')]['Applications']){delete _0x247392[_0xa544('0x3d')][_0xa544('0x3f')];}if(_0x247392[_0xa544('0x3d')][_0xa544('0x38')]){delete _0x247392[_0xa544('0x3d')][_0xa544('0x38')];}if(_0x1e85c9[_0xa544('0x38')][_0xa544('0x39')][_0xa544('0x48')]){return _0x1e85c9[_0xa544('0x38')][_0xa544('0x39')][0x0];}var _0x307119=_['defaults'](_0x586b02['body'],{'firstName':_0x586b02[_0xa544('0x2e')][_0xa544('0x2f')],'ListId':_0x1e85c9[_0xa544('0x2d')]});_0x307119[_0x586b02['body']['mapKey']]=_0x586b02['body'][_0xa544('0x2f')];return db[_0xa544('0x28')]['create'](_0x307119);}else{throw new Error(_0xa544('0x49'));}})['then'](function(_0x532ece){_0x247392[_0xa544('0x4a')]=_0x532ece;if(_0x532ece){if(!_0x586b02['body'][_0xa544('0x14')]['messageId']){_0x586b02['body'][_0xa544('0x14')][_0xa544('0x4b')]=rs['generate']()+'\x20'+_0x586b02[_0xa544('0x2e')][_0xa544('0x14')]['from'];}var _0xa7df6f={'ContactId':_0x532ece['id'],'MailAccountId':_0x586b02[_0xa544('0x3d')]['id'],'inReplyTo':_0x586b02[_0xa544('0x2e')][_0xa544('0x14')][_0xa544('0x4b')],'to':_0x586b02[_0xa544('0x2e')]['message'][_0xa544('0x2f')],'cc':_0x586b02['body'][_0xa544('0x14')]['cc'],'subject':_0x586b02[_0xa544('0x2e')][_0xa544('0x14')][_0xa544('0x4c')],'attach':_0x586b02[_0xa544('0x2e')][_0xa544('0x14')][_0xa544('0x4d')],'lastMsgAt':moment()[_0xa544('0x4e')](_0xa544('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x586b02[_0xa544('0x2e')][_0xa544('0x2e')]};return db[_0xa544('0x50')][_0xa544('0x24')]({'where':{'closed':![],'MailAccountId':_0x586b02[_0xa544('0x3d')]['id']},'include':[{'model':db['MailMessage'],'as':_0xa544('0x51'),'attributes':[_0xa544('0x4b')],'where':{'messageId':_0x586b02['body'][_0xa544('0x14')]['inReplyTo']}}]})[_0xa544('0xf')](function(_0x27144f){if(_0x27144f){return[_0x27144f,![]];}return db[_0xa544('0x50')]['create'](_0xa7df6f)[_0xa544('0xf')](function(_0x4e75c0){return[_0x4e75c0,!![]];});});}else{throw new Error(_0xa544('0x52'));}})['spread'](function(_0x540e8f,_0x293e94){if(_0x540e8f){_0x9c8585=_0x293e94;if(!_0x293e94){return _0x540e8f[_0xa544('0x53')]({'inReplyTo':_0x586b02['body'][_0xa544('0x14')][_0xa544('0x4b')],'to':_0x586b02[_0xa544('0x2e')][_0xa544('0x14')][_0xa544('0x2f')],'cc':_0x586b02[_0xa544('0x2e')][_0xa544('0x14')]['cc'],'subject':_0x586b02[_0xa544('0x2e')][_0xa544('0x14')][_0xa544('0x4c')],'attach':_0x540e8f['attach']?_0x540e8f[_0xa544('0x4d')]:_0x586b02[_0xa544('0x2e')][_0xa544('0x14')][_0xa544('0x4d')],'substatus':null,'substatusAt':moment()[_0xa544('0x4e')](_0xa544('0x4f')),'lastMsgAt':moment()[_0xa544('0x4e')](_0xa544('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x586b02[_0xa544('0x2e')][_0xa544('0x2e')]});}else{return _0x540e8f;}}})['then'](function(_0x5c8f80){_0x247392[_0xa544('0x54')]=_0x5c8f80[_0xa544('0x3c')]({'plain':!![]});_0x247392[_0xa544('0x54')][_0xa544('0x55')]=_0x9c8585;return db[_0xa544('0x56')][_0xa544('0x57')]({'body':_0x586b02[_0xa544('0x2e')][_0xa544('0x2e')],'MailAccountId':_0x586b02['account']['id'],'MailInteractionId':_0x5c8f80['id'],'direction':'in','ContactId':_0x247392[_0xa544('0x4a')]['id'],'messageId':_0x586b02['body'][_0xa544('0x14')]['messageId'],'from':_0x586b02['body']['message'][_0xa544('0x2f')],'to':_0x586b02[_0xa544('0x2e')]['message']['to'],'cc':_0x586b02[_0xa544('0x2e')][_0xa544('0x14')]['cc'],'subject':_0x586b02[_0xa544('0x2e')][_0xa544('0x14')][_0xa544('0x4c')],'attach':_0x586b02[_0xa544('0x2e')][_0xa544('0x14')][_0xa544('0x4d')],'Attachments':_0x586b02[_0xa544('0x2e')][_0xa544('0x14')][_0xa544('0x58')],'originTo':_0x586b02[_0xa544('0x2e')]['message']['originTo'],'originCc':_0x586b02[_0xa544('0x2e')][_0xa544('0x14')]['originCc'],'bcc':_0x586b02[_0xa544('0x2e')][_0xa544('0x14')][_0xa544('0x59')]},{'include':[{'model':db[_0xa544('0x5a')],'as':_0xa544('0x5b')}]});})[_0xa544('0xf')](function(_0x5a6261){_0x247392[_0xa544('0x14')]=_0x5a6261;if(_0x247392[_0xa544('0x54')][_0xa544('0x5c')]){return db['User'][_0xa544('0x24')]({'attributes':['id',_0xa544('0x5d')],'where':{'id':_0x247392[_0xa544('0x54')][_0xa544('0x5c')]}})[_0xa544('0xf')](function(_0x4afaa9){if(_0x4afaa9){_0x247392[_0xa544('0x40')][_0xa544('0x5e')]({'id':0x0,'priority':0x0,'app':_0xa544('0x5f'),'appdata':_0x4afaa9['name']+','+(_0x247392[_0xa544('0x3d')][_0xa544('0x60')]||0xa),'interval':_0xa544('0x47')});}return respondWithRpcPromise(_0xa544('0x61'),'startRouting',_0x247392);});}return respondWithRpcPromise(_0xa544('0x61'),_0xa544('0x62'),_0x247392);})['then'](function(_0x294af4){_0x20b5f1(_0x294af4);})[_0xa544('0x17')](function(_0x563038){_0x527a3b(_0x42d9b6[_0xa544('0x13')](0x1f4,_0x563038[_0xa544('0x14')]));});});}; \ No newline at end of file +var _0x26bc=['MailServerOut','Smtp','get','omit','Applications','applications','list','orderBy','priority','asc','push','length','Contacts','from','ListId','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','spread','update','interaction','originTo','bcc','Attachment','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MailAccount','findAll','options','where','attributes','limit','include','model','map','debug','stringify','GetMailAccount','ShowMailAccount','find','raw','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','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','account','CmList','List','DESC'];(function(_0x42bafd,_0x3f0fe3){var _0x2ed705=function(_0x4311ea){while(--_0x4311ea){_0x42bafd['push'](_0x42bafd['shift']());}};_0x2ed705(++_0x3f0fe3);}(_0x26bc,0x162));var _0xc26b=function(_0xb17c3d,_0x18e52a){_0xb17c3d=_0xb17c3d-0x0;var _0x11e725=_0x26bc[_0xb17c3d];return _0x11e725;};'use strict';var _=require(_0xc26b('0x0'));var util=require(_0xc26b('0x1'));var moment=require(_0xc26b('0x2'));var BPromise=require(_0xc26b('0x3'));var rs=require(_0xc26b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc26b('0x5'))['db'];var utils=require(_0xc26b('0x6'));var logger=require(_0xc26b('0x7'))('rpc');var config=require(_0xc26b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc26b('0x9')][_0xc26b('0xa')]({'port':0x232c});config[_0xc26b('0xb')]=_['defaults'](config[_0xc26b('0xb')],{'host':_0xc26b('0xc'),'port':0x18eb});var socket=require(_0xc26b('0xd'))(new Redis(config[_0xc26b('0xb')]));require(_0xc26b('0xe'))[_0xc26b('0xf')](socket);function respondWithRpcPromise(_0x22af41,_0x9deb12,_0x373372){return new BPromise(function(_0x468863,_0x51d46c){return client[_0xc26b('0x10')](_0x22af41,_0x373372)[_0xc26b('0x11')](function(_0x196bb0){logger[_0xc26b('0x12')](_0xc26b('0x13'),_0x9deb12,_0xc26b('0x14'));logger['debug'](_0xc26b('0x15'),_0x9deb12,'request\x20sent',JSON['stringify'](_0x196bb0));if(_0x196bb0[_0xc26b('0x16')]){if(_0x196bb0[_0xc26b('0x16')][_0xc26b('0x17')]===0x1f4){logger[_0xc26b('0x16')]('MailAccount,\x20%s,\x20%s',_0x9deb12,_0x196bb0[_0xc26b('0x16')][_0xc26b('0x18')]);return _0x51d46c(_0x196bb0[_0xc26b('0x16')][_0xc26b('0x18')]);}logger[_0xc26b('0x16')](_0xc26b('0x13'),_0x9deb12,_0x196bb0['error'][_0xc26b('0x18')]);return _0x468863(_0x196bb0[_0xc26b('0x16')]['message']);}else{logger[_0xc26b('0x12')]('MailAccount,\x20%s,\x20%s',_0x9deb12,'request\x20sent');_0x468863(_0x196bb0[_0xc26b('0x19')]['message']);}})[_0xc26b('0x1a')](function(_0x3e5e8b){logger[_0xc26b('0x16')](_0xc26b('0x13'),_0x9deb12,_0x3e5e8b);_0x51d46c(_0x3e5e8b);});});}exports['GetMailAccount']=function(_0x1c7f1b){var _0x42d60a=this;return new Promise(function(_0x2523b5,_0x8531d6){return db[_0xc26b('0x1b')][_0xc26b('0x1c')]({'raw':_0x1c7f1b['options']?_0x1c7f1b[_0xc26b('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1c7f1b[_0xc26b('0x1d')]?_0x1c7f1b[_0xc26b('0x1d')][_0xc26b('0x1e')]||null:null,'attributes':_0x1c7f1b[_0xc26b('0x1d')]?_0x1c7f1b['options'][_0xc26b('0x1f')]||null:null,'limit':_0x1c7f1b[_0xc26b('0x1d')]?_0x1c7f1b[_0xc26b('0x1d')][_0xc26b('0x20')]||null:null,'include':_0x1c7f1b['options']?_0x1c7f1b[_0xc26b('0x1d')][_0xc26b('0x21')]?_['map'](_0x1c7f1b['options'][_0xc26b('0x21')],function(_0x1bb8e5){return{'model':db[_0x1bb8e5[_0xc26b('0x22')]],'as':_0x1bb8e5['as'],'attributes':_0x1bb8e5[_0xc26b('0x1f')],'include':_0x1bb8e5[_0xc26b('0x21')]?_[_0xc26b('0x23')](_0x1bb8e5['include'],function(_0x3eea3b){return{'model':db[_0x3eea3b['model']],'as':_0x3eea3b['as'],'attributes':_0x3eea3b[_0xc26b('0x1f')],'include':_0x3eea3b[_0xc26b('0x21')]?_[_0xc26b('0x23')](_0x3eea3b['include'],function(_0x1f7d2e){return{'model':db[_0x1f7d2e[_0xc26b('0x22')]],'as':_0x1f7d2e['as'],'attributes':_0x1f7d2e[_0xc26b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc26b('0x11')](function(_0x34148e){logger[_0xc26b('0x12')]('GetMailAccount',_0x1c7f1b);logger[_0xc26b('0x24')]('GetMailAccount',_0x1c7f1b,JSON[_0xc26b('0x25')](_0x34148e));_0x2523b5(_0x34148e);})['catch'](function(_0x4a4bb0){logger[_0xc26b('0x16')](_0xc26b('0x26'),_0x4a4bb0[_0xc26b('0x18')],_0x1c7f1b);_0x8531d6(_0x42d60a['error'](0x1f4,_0x4a4bb0[_0xc26b('0x18')]));});});};exports[_0xc26b('0x27')]=function(_0x555907){var _0x16479a=this;return new Promise(function(_0x764fef,_0x16fc15){return db[_0xc26b('0x1b')][_0xc26b('0x28')]({'raw':_0x555907[_0xc26b('0x1d')]?_0x555907[_0xc26b('0x1d')][_0xc26b('0x29')]===undefined?!![]:![]:!![],'where':_0x555907[_0xc26b('0x1d')]?_0x555907[_0xc26b('0x1d')]['where']||null:null,'attributes':_0x555907[_0xc26b('0x1d')]?_0x555907['options'][_0xc26b('0x1f')]||null:null,'include':_0x555907[_0xc26b('0x1d')]?_0x555907['options'][_0xc26b('0x21')]?_[_0xc26b('0x23')](_0x555907[_0xc26b('0x1d')][_0xc26b('0x21')],function(_0x270bbf){return{'model':db[_0x270bbf[_0xc26b('0x22')]],'as':_0x270bbf['as'],'attributes':_0x270bbf[_0xc26b('0x1f')],'include':_0x270bbf[_0xc26b('0x21')]?_[_0xc26b('0x23')](_0x270bbf[_0xc26b('0x21')],function(_0x4c969f){return{'model':db[_0x4c969f[_0xc26b('0x22')]],'as':_0x4c969f['as'],'attributes':_0x4c969f[_0xc26b('0x1f')],'include':_0x4c969f[_0xc26b('0x21')]?_[_0xc26b('0x23')](_0x4c969f[_0xc26b('0x21')],function(_0x2d8a62){return{'model':db[_0x2d8a62[_0xc26b('0x22')]],'as':_0x2d8a62['as'],'attributes':_0x2d8a62[_0xc26b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc26b('0x11')](function(_0x108046){logger[_0xc26b('0x12')](_0xc26b('0x27'),_0x555907);logger[_0xc26b('0x24')](_0xc26b('0x27'),_0x555907,JSON[_0xc26b('0x25')](_0x108046));_0x764fef(_0x108046);})['catch'](function(_0x780465){logger['error'](_0xc26b('0x27'),_0x780465[_0xc26b('0x18')],_0x555907);_0x16fc15(_0x16479a['error'](0x1f4,_0x780465['message']));});});};exports[_0xc26b('0x2a')]=function(_0x4143fb){var _0x197d79=this;return new Promise(function(_0x5093a4,_0x5c764e){var _0x5df073={'body':_0x4143fb[_0xc26b('0x2b')],'channel':_0xc26b('0x2c')};var _0x29f098=_[_0xc26b('0x2d')](_[_0xc26b('0x2e')](db[_0xc26b('0x2f')][_0xc26b('0x30')]),[_0xc26b('0x31'),_0xc26b('0x32'),_0xc26b('0x33'),'ListId']);var _0x436661=![];if(_0x4143fb[_0xc26b('0x2b')]['id']){delete _0x4143fb[_0xc26b('0x2b')]['id'];}if(_[_0xc26b('0x34')](_0x4143fb['body']['from'])){return _0x5c764e(_0x197d79[_0xc26b('0x16')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xc26b('0x34')](_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x2b')])||_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x2b')]===''){return _0x5c764e(_0x197d79[_0xc26b('0x16')](0x1f4,_0xc26b('0x35')));}if(_['isNil'](_0x4143fb['body'][_0xc26b('0x36')])){return _0x5c764e(_0x197d79[_0xc26b('0x16')](0x1f4,_0xc26b('0x37')+_0x29f098));}if(!_[_0xc26b('0x38')](_0x29f098,_0x4143fb['body'][_0xc26b('0x36')])){return _0x5c764e(_0x197d79['error'](0x1f4,_0xc26b('0x39')+_0x29f098));}var _0x442bec={};_0x442bec[_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x36')]]=_0x4143fb[_0xc26b('0x2b')]['from'];return db[_0xc26b('0x1b')]['find']({'where':{'id':_0x4143fb[_0xc26b('0x3a')]['id']},'include':[{'model':db[_0xc26b('0x3b')],'as':_0xc26b('0x3c'),'include':[{'model':db[_0xc26b('0x2f')],'as':'Contacts','where':_0x442bec,'limit':0x1,'order':[['updatedAt',_0xc26b('0x3d')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db[_0xc26b('0x3e')],'as':_0xc26b('0x3f')}]})[_0xc26b('0x11')](function(_0x365260){if(_0x365260&&_0x365260[_0xc26b('0x3c')]){var _0x1eb4ae=_0x365260[_0xc26b('0x40')]({'plain':!![]});_0x5df073[_0xc26b('0x3a')]=_[_0xc26b('0x41')](_0x1eb4ae,[_0xc26b('0x42'),_0xc26b('0x3c')]);_0x5df073[_0xc26b('0x43')]=_0x1eb4ae[_0xc26b('0x42')];_0x5df073[_0xc26b('0x44')]=_0x1eb4ae['List'];_0x5df073['applications']=_[_0xc26b('0x45')](_0x5df073[_0xc26b('0x43')],[_0xc26b('0x46')],[_0xc26b('0x47')]);if(_0x5df073['account']&&_0x5df073[_0xc26b('0x3a')]['autoclose']){_0x5df073[_0xc26b('0x43')][_0xc26b('0x48')]({'id':0x0,'priority':_0x5df073['applications'][_0xc26b('0x49')]+0x1,'app':'close','appdata':'autoclose','interval':'*,*,*,*'});}if(_0x5df073['account'][_0xc26b('0x42')]){delete _0x5df073[_0xc26b('0x3a')][_0xc26b('0x42')];}if(_0x5df073[_0xc26b('0x3a')]['List']){delete _0x5df073['account'][_0xc26b('0x3c')];}if(_0x1eb4ae['List'][_0xc26b('0x4a')][_0xc26b('0x49')]){return _0x1eb4ae['List'][_0xc26b('0x4a')][0x0];}var _0x3ab92a=_['defaults'](_0x4143fb[_0xc26b('0x2b')],{'firstName':_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x4b')],'ListId':_0x1eb4ae[_0xc26b('0x4c')]});_0x3ab92a[_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x36')]]=_0x4143fb[_0xc26b('0x2b')]['from'];return db[_0xc26b('0x2f')][_0xc26b('0x4d')](_0x3ab92a);}else{throw new Error(_0xc26b('0x4e'));}})[_0xc26b('0x11')](function(_0x37fe69){_0x5df073[_0xc26b('0x4f')]=_0x37fe69;if(_0x37fe69){if(!_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x18')][_0xc26b('0x50')]){_0x4143fb[_0xc26b('0x2b')]['message'][_0xc26b('0x50')]=rs[_0xc26b('0x51')]()+'\x20'+_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x18')][_0xc26b('0x4b')];}var _0xe121fa={'ContactId':_0x37fe69['id'],'MailAccountId':_0x4143fb[_0xc26b('0x3a')]['id'],'inReplyTo':_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x18')][_0xc26b('0x50')],'to':_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x18')]['from'],'cc':_0x4143fb[_0xc26b('0x2b')]['message']['cc'],'subject':_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x18')][_0xc26b('0x52')],'attach':_0x4143fb[_0xc26b('0x2b')]['message'][_0xc26b('0x53')],'lastMsgAt':moment()[_0xc26b('0x54')](_0xc26b('0x55')),'lastMsgDirection':'in','lastMsgBody':_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x2b')]};return db[_0xc26b('0x56')]['find']({'where':{'closed':![],'MailAccountId':_0x4143fb[_0xc26b('0x3a')]['id']},'include':[{'model':db[_0xc26b('0x57')],'as':'Messages','attributes':[_0xc26b('0x50')],'where':{'messageId':_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x18')][_0xc26b('0x58')]}}]})[_0xc26b('0x11')](function(_0x5f7777){if(_0x5f7777){return[_0x5f7777,![]];}return db[_0xc26b('0x56')][_0xc26b('0x4d')](_0xe121fa)[_0xc26b('0x11')](function(_0x419274){return[_0x419274,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xc26b('0x59')](function(_0x54321d,_0x4e99e7){if(_0x54321d){_0x436661=_0x4e99e7;if(!_0x4e99e7){return _0x54321d[_0xc26b('0x5a')]({'inReplyTo':_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x18')][_0xc26b('0x50')],'to':_0x4143fb[_0xc26b('0x2b')]['message']['from'],'cc':_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x18')]['cc'],'subject':_0x4143fb['body']['message'][_0xc26b('0x52')],'attach':_0x54321d['attach']?_0x54321d['attach']:_0x4143fb['body'][_0xc26b('0x18')][_0xc26b('0x53')],'substatus':null,'substatusAt':moment()[_0xc26b('0x54')](_0xc26b('0x55')),'lastMsgAt':moment()['format'](_0xc26b('0x55')),'lastMsgDirection':'in','lastMsgBody':_0x4143fb['body'][_0xc26b('0x2b')]});}else{return _0x54321d;}}})[_0xc26b('0x11')](function(_0x105102){_0x5df073[_0xc26b('0x5b')]=_0x105102['get']({'plain':!![]});_0x5df073[_0xc26b('0x5b')]['created']=_0x436661;return db[_0xc26b('0x57')][_0xc26b('0x4d')]({'body':_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x2b')],'MailAccountId':_0x4143fb[_0xc26b('0x3a')]['id'],'MailInteractionId':_0x105102['id'],'direction':'in','ContactId':_0x5df073[_0xc26b('0x4f')]['id'],'messageId':_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x18')][_0xc26b('0x50')],'from':_0x4143fb[_0xc26b('0x2b')]['message'][_0xc26b('0x4b')],'to':_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x18')]['to'],'cc':_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x18')]['cc'],'subject':_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x18')][_0xc26b('0x52')],'attach':_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x18')][_0xc26b('0x53')],'Attachments':_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x18')]['attachments'],'originTo':_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x18')][_0xc26b('0x5c')],'originCc':_0x4143fb[_0xc26b('0x2b')][_0xc26b('0x18')]['originCc'],'bcc':_0x4143fb[_0xc26b('0x2b')]['message'][_0xc26b('0x5d')]},{'include':[{'model':db[_0xc26b('0x5e')],'as':'Attachments'}]});})[_0xc26b('0x11')](function(_0x2a06f0){_0x5df073[_0xc26b('0x18')]=_0x2a06f0;if(_0x5df073[_0xc26b('0x5b')][_0xc26b('0x5f')]){return db[_0xc26b('0x60')][_0xc26b('0x28')]({'attributes':['id',_0xc26b('0x61')],'where':{'id':_0x5df073[_0xc26b('0x5b')][_0xc26b('0x5f')]}})[_0xc26b('0x11')](function(_0x144840){if(_0x144840){_0x5df073['applications'][_0xc26b('0x62')]({'id':0x0,'priority':0x0,'app':_0xc26b('0x63'),'appdata':_0x144840['name']+','+(_0x5df073['account'][_0xc26b('0x64')]||0xa),'interval':_0xc26b('0x65')});}return respondWithRpcPromise(_0xc26b('0x66'),_0xc26b('0x67'),_0x5df073);});}return respondWithRpcPromise('Start',_0xc26b('0x67'),_0x5df073);})[_0xc26b('0x11')](function(_0x4b8831){_0x5093a4(_0x4b8831);})[_0xc26b('0x1a')](function(_0x52070e){_0x5c764e(_0x197d79[_0xc26b('0x16')](0x1f4,_0x52070e[_0xc26b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index b191964..d38d896 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 _0x2123=['./mailAccount.events','save','remove','update','emit','removeListener','register','length'];(function(_0x27f38e,_0x297566){var _0x1cffb3=function(_0x51e5b7){while(--_0x51e5b7){_0x27f38e['push'](_0x27f38e['shift']());}};_0x1cffb3(++_0x297566);}(_0x2123,0x190));var _0x3212=function(_0xc6499f,_0x536333){_0xc6499f=_0xc6499f-0x0;var _0x5e2394=_0x2123[_0xc6499f];return _0x5e2394;};'use strict';var MailAccountEvents=require(_0x3212('0x0'));var events=[_0x3212('0x1'),_0x3212('0x2'),_0x3212('0x3')];function createListener(_0x7158b8,_0x2ff863){return function(_0x8c047){_0x2ff863[_0x3212('0x4')](_0x7158b8,_0x8c047);};}function removeListener(_0x304f80,_0x6ca653){return function(){MailAccountEvents[_0x3212('0x5')](_0x304f80,_0x6ca653);};}exports[_0x3212('0x6')]=function(_0x5d9d36){for(var _0x3859e4=0x0,_0x2b1302=events[_0x3212('0x7')];_0x3859e4<_0x2b1302;_0x3859e4++){var _0x4b35e9=events[_0x3859e4];var _0x3e17a3=createListener('mailAccount:'+_0x4b35e9,_0x5d9d36);MailAccountEvents['on'](_0x4b35e9,_0x3e17a3);}}; \ No newline at end of file +var _0xf494=['save','remove','emit','removeListener','register','mailAccount:','./mailAccount.events'];(function(_0x180cef,_0x4be3c0){var _0x226335=function(_0x3cc0a5){while(--_0x3cc0a5){_0x180cef['push'](_0x180cef['shift']());}};_0x226335(++_0x4be3c0);}(_0xf494,0x1c6));var _0x4f49=function(_0x55b6ae,_0x51f1c8){_0x55b6ae=_0x55b6ae-0x0;var _0x25447c=_0xf494[_0x55b6ae];return _0x25447c;};'use strict';var MailAccountEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){MailAccountEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);MailAccountEvents['on'](_0x58e9a0,_0x169c95);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index b9c5c1f..1b1bab4 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 _0xd404=['update','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put'];(function(_0x5673f2,_0x74fc53){var _0x1d457d=function(_0x3e514e){while(--_0x3e514e){_0x5673f2['push'](_0x5673f2['shift']());}};_0x1d457d(++_0x74fc53);}(_0xd404,0x15b));var _0x4d40=function(_0x438ba8,_0x56911b){_0x438ba8=_0x438ba8-0x0;var _0x199ff6=_0xd404[_0x438ba8];return _0x199ff6;};'use strict';var multer=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var path=require('path');var timeout=require(_0x4d40('0x2'));var express=require(_0x4d40('0x3'));var router=express['Router']();var auth=require(_0x4d40('0x4'));var interaction=require(_0x4d40('0x5'));var config=require(_0x4d40('0x6'));var controller=require(_0x4d40('0x7'));router[_0x4d40('0x8')](_0x4d40('0x9'),auth[_0x4d40('0xa')](),controller[_0x4d40('0xb')]);router[_0x4d40('0xc')]('/:id',auth[_0x4d40('0xa')](),controller[_0x4d40('0xd')]);router['delete'](_0x4d40('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x4d40('0xe')]=router; \ No newline at end of file +var _0x91a7=['delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','get','/:id','show','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x91a7,0xe7));var _0x791a=function(_0xbba744,_0xe9c2b8){_0xbba744=_0xbba744-0x0;var _0x41e6cb=_0x91a7[_0xbba744];return _0x41e6cb;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x791a('0x4'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0x791a('0x5')](_0x791a('0x6'),auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['put'](_0x791a('0x6'),auth[_0x791a('0x8')](),controller['update']);router[_0x791a('0x9')](_0x791a('0x6'),auth[_0x791a('0x8')](),controller[_0x791a('0xa')]);module[_0x791a('0xb')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 74e7a60..ef71739 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 _0x1ab2=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x4cf5c5,_0x55da3d){var _0x3b4caf=function(_0x23fc67){while(--_0x23fc67){_0x4cf5c5['push'](_0x4cf5c5['shift']());}};_0x3b4caf(++_0x55da3d);}(_0x1ab2,0x14c));var _0x21ab=function(_0x52c251,_0x2526ce){_0x52c251=_0x52c251-0x0;var _0x1a5689=_0x1ab2[_0x52c251];return _0x1a5689;};'use strict';var Sequelize=require(_0x21ab('0x0'));module[_0x21ab('0x1')]={'priority':{'type':Sequelize[_0x21ab('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x21ab('0x3')],'allowNull':![],'defaultValue':_0x21ab('0x4')},'appdata':{'type':Sequelize[_0x21ab('0x5')]()},'description':{'type':Sequelize[_0x21ab('0x3')]},'interval':{'type':Sequelize[_0x21ab('0x3')],'defaultValue':_0x21ab('0x6')}}; \ No newline at end of file +var _0xe348=['STRING','noop','TEXT','exports','INTEGER'];(function(_0x4076aa,_0x3beff8){var _0x3a7a4b=function(_0x254035){while(--_0x254035){_0x4076aa['push'](_0x4076aa['shift']());}};_0x3a7a4b(++_0x3beff8);}(_0xe348,0xe9));var _0x8e34=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0xe348[_0x4ae829];return _0x256b31;};'use strict';var Sequelize=require('sequelize');module[_0x8e34('0x0')]={'priority':{'type':Sequelize[_0x8e34('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x8e34('0x2')],'allowNull':![],'defaultValue':_0x8e34('0x3')},'appdata':{'type':Sequelize[_0x8e34('0x4')]()},'description':{'type':Sequelize[_0x8e34('0x2')]},'interval':{'type':Sequelize[_0x8e34('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 93a878c..af1ec9e 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 _0x089f=['body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','show','params','model','keys','query','filtears','attributes','intersection','fields','merge','options','MailApplication','find','catch'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x089f,0x73));var _0xf089=function(_0x3689c6,_0x29eb20){_0x3689c6=_0x3689c6-0x0;var _0x4b13b6=_0x089f[_0x3689c6];return _0x4b13b6;};'use strict';var pdf=require(_0xf089('0x0'));var emlformat=require(_0xf089('0x1'));var rimraf=require(_0xf089('0x2'));var zipdir=require(_0xf089('0x3'));var jsonpatch=require(_0xf089('0x4'));var rp=require(_0xf089('0x5'));var moment=require(_0xf089('0x6'));var BPromise=require(_0xf089('0x7'));var Mustache=require(_0xf089('0x8'));var util=require(_0xf089('0x9'));var path=require(_0xf089('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf089('0xb'));var fs=require('fs');var _=require(_0xf089('0xc'));var squel=require(_0xf089('0xd'));var crypto=require(_0xf089('0xe'));var jsforce=require(_0xf089('0xf'));var deskjs=require(_0xf089('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf089('0x11'));var Papa=require(_0xf089('0x12'));var Redis=require(_0xf089('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf089('0x14'));var as=require(_0xf089('0x15'));var hardwareService=require(_0xf089('0x16'));var logger=require(_0xf089('0x17'))(_0xf089('0x18'));var utils=require(_0xf089('0x19'));var config=require(_0xf089('0x1a'));var licenseUtil=require(_0xf089('0x1b'));var db=require(_0xf089('0x1c'))['db'];function respondWithStatusCode(_0x12d6f5,_0x579320){_0x579320=_0x579320||0xcc;return function(_0x210bd1){if(_0x210bd1){return _0x12d6f5[_0xf089('0x1d')](_0x579320);}return _0x12d6f5[_0xf089('0x1e')](_0x579320)['end']();};}function respondWithResult(_0x23635e,_0x42741a){_0x42741a=_0x42741a||0xc8;return function(_0x26fdff){if(_0x26fdff){return _0x23635e[_0xf089('0x1e')](_0x42741a)[_0xf089('0x1f')](_0x26fdff);}};}function respondWithFilteredResult(_0x337e6f,_0x250962){return function(_0x2462e7){if(_0x2462e7){var _0x273b12=_0x2462e7['count'],_0x10e623=_0x250962['offset'],_0x417a06=_0x250962[_0xf089('0x20')]+_0x250962['limit'],_0x349072;if(_0x417a06>=_0x273b12){_0x417a06=_0x273b12;_0x349072=0xc8;}else{_0x349072=0xce;}_0x337e6f[_0xf089('0x1e')](_0x349072);return _0x337e6f[_0xf089('0x21')](_0xf089('0x22'),_0x10e623+'-'+_0x417a06+'/'+_0x273b12)[_0xf089('0x1f')](_0x2462e7);}return null;};}function patchUpdates(_0x4ecad3){return function(_0x59ecc9){try{jsonpatch[_0xf089('0x23')](_0x59ecc9,_0x4ecad3,!![]);}catch(_0x393610){return BPromise[_0xf089('0x24')](_0x393610);}return _0x59ecc9[_0xf089('0x25')]();};}function saveUpdates(_0x2e90b5,_0x2bd054){return function(_0x90866d){if(_0x90866d){return _0x90866d[_0xf089('0x26')](_0x2e90b5)[_0xf089('0x27')](function(_0x56e9ac){return _0x56e9ac;});}return null;};}function removeEntity(_0x57620a,_0x2ed56a){return function(_0x1ec160){if(_0x1ec160){return _0x1ec160[_0xf089('0x28')]()[_0xf089('0x27')](function(){_0x57620a[_0xf089('0x1e')](0xcc)[_0xf089('0x29')]();});}};}function handleEntityNotFound(_0x20a43f,_0x525dba){return function(_0x5b40e0){if(!_0x5b40e0){_0x20a43f['sendStatus'](0x194);}return _0x5b40e0;};}function handleError(_0x2d0dd7,_0x15ebd2){_0x15ebd2=_0x15ebd2||0x1f4;return function(_0x594307){logger['error'](_0x594307['stack']);if(_0x594307['name']){delete _0x594307['name'];}_0x2d0dd7[_0xf089('0x1e')](_0x15ebd2)['send'](_0x594307);};}exports[_0xf089('0x2a')]=function(_0x14d130,_0x4fb64b){var _0x1f1f27={'raw':!![],'where':{'id':_0x14d130[_0xf089('0x2b')]['id']}},_0x5298a2={};_0x5298a2[_0xf089('0x2c')]=_[_0xf089('0x2d')](db['MailApplication']['rawAttributes']);_0x5298a2[_0xf089('0x2e')]=_[_0xf089('0x2d')](_0x14d130[_0xf089('0x2e')]);_0x5298a2[_0xf089('0x2f')]=_['intersection'](_0x5298a2['model'],_0x5298a2[_0xf089('0x2e')]);_0x1f1f27[_0xf089('0x30')]=_[_0xf089('0x31')](_0x5298a2['model'],qs[_0xf089('0x32')](_0x14d130[_0xf089('0x2e')]['fields']));_0x1f1f27[_0xf089('0x30')]=_0x1f1f27['attributes']['length']?_0x1f1f27[_0xf089('0x30')]:_0x5298a2[_0xf089('0x2c')];if(_0x14d130[_0xf089('0x2e')]['includeAll']){_0x1f1f27['include']=[{'all':!![]}];}_0x1f1f27=_[_0xf089('0x33')]({},_0x1f1f27,_0x14d130[_0xf089('0x34')]);return db[_0xf089('0x35')][_0xf089('0x36')](_0x1f1f27)[_0xf089('0x27')](handleEntityNotFound(_0x4fb64b,null))[_0xf089('0x27')](respondWithResult(_0x4fb64b,null))[_0xf089('0x37')](handleError(_0x4fb64b,null));};exports[_0xf089('0x26')]=function(_0x101635,_0x51239b){if(_0x101635[_0xf089('0x38')]['id']){delete _0x101635[_0xf089('0x38')]['id'];}return db['MailApplication']['find']({'where':{'id':_0x101635['params']['id']}})['then'](handleEntityNotFound(_0x51239b,null))[_0xf089('0x27')](saveUpdates(_0x101635['body'],null))[_0xf089('0x27')](respondWithResult(_0x51239b,null))['catch'](handleError(_0x51239b,null));};exports[_0xf089('0x28')]=function(_0x57a54f,_0x20c7e4){return db[_0xf089('0x35')][_0xf089('0x36')]({'where':{'id':_0x57a54f[_0xf089('0x2b')]['id']}})[_0xf089('0x27')](handleEntityNotFound(_0x20c7e4,null))[_0xf089('0x27')](removeEntity(_0x20c7e4,null))['catch'](handleError(_0x20c7e4,null));}; \ No newline at end of file +var _0x32a3=['path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','count','offset','Content-Range','apply','reject','save','update','destroy','sendStatus','error','name','show','params','keys','MailApplication','rawAttributes','query','filtears','intersection','model','fields','attributes','includeAll','include','merge','options','then','catch','find','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0x32a3,0x194));var _0x332a=function(_0x37d8be,_0xfea614){_0x37d8be=_0x37d8be-0x0;var _0x1be3ac=_0x32a3[_0x37d8be];return _0x1be3ac;};'use strict';var pdf=require(_0x332a('0x0'));var emlformat=require(_0x332a('0x1'));var rimraf=require(_0x332a('0x2'));var zipdir=require(_0x332a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x332a('0x4'));var moment=require(_0x332a('0x5'));var BPromise=require(_0x332a('0x6'));var Mustache=require(_0x332a('0x7'));var util=require(_0x332a('0x8'));var path=require(_0x332a('0x9'));var sox=require('sox');var csv=require(_0x332a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x332a('0xb'));var squel=require(_0x332a('0xc'));var crypto=require(_0x332a('0xd'));var jsforce=require(_0x332a('0xe'));var deskjs=require(_0x332a('0xf'));var toCsv=require(_0x332a('0xa'));var querystring=require(_0x332a('0x10'));var Papa=require(_0x332a('0x11'));var Redis=require('ioredis');var authService=require(_0x332a('0x12'));var qs=require(_0x332a('0x13'));var as=require(_0x332a('0x14'));var hardwareService=require(_0x332a('0x15'));var logger=require('../../config/logger')(_0x332a('0x16'));var utils=require(_0x332a('0x17'));var config=require(_0x332a('0x18'));var licenseUtil=require(_0x332a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5738ac,_0x3a2444){_0x3a2444=_0x3a2444||0xcc;return function(_0x34a941){if(_0x34a941){return _0x5738ac['sendStatus'](_0x3a2444);}return _0x5738ac['status'](_0x3a2444)[_0x332a('0x1a')]();};}function respondWithResult(_0x31574d,_0x5970db){_0x5970db=_0x5970db||0xc8;return function(_0x5d1680){if(_0x5d1680){return _0x31574d[_0x332a('0x1b')](_0x5970db)[_0x332a('0x1c')](_0x5d1680);}};}function respondWithFilteredResult(_0x2337d6,_0x4d19ee){return function(_0x454c94){if(_0x454c94){var _0x5c61e1=_0x454c94[_0x332a('0x1d')],_0x5b8a30=_0x4d19ee[_0x332a('0x1e')],_0x2d2199=_0x4d19ee[_0x332a('0x1e')]+_0x4d19ee['limit'],_0x5193d2;if(_0x2d2199>=_0x5c61e1){_0x2d2199=_0x5c61e1;_0x5193d2=0xc8;}else{_0x5193d2=0xce;}_0x2337d6[_0x332a('0x1b')](_0x5193d2);return _0x2337d6['set'](_0x332a('0x1f'),_0x5b8a30+'-'+_0x2d2199+'/'+_0x5c61e1)[_0x332a('0x1c')](_0x454c94);}return null;};}function patchUpdates(_0x320985){return function(_0x9be618){try{jsonpatch[_0x332a('0x20')](_0x9be618,_0x320985,!![]);}catch(_0x42ceb7){return BPromise[_0x332a('0x21')](_0x42ceb7);}return _0x9be618[_0x332a('0x22')]();};}function saveUpdates(_0x450b01,_0x5a8b9e){return function(_0x3eabba){if(_0x3eabba){return _0x3eabba[_0x332a('0x23')](_0x450b01)['then'](function(_0x3f67e6){return _0x3f67e6;});}return null;};}function removeEntity(_0x4bc96b,_0x1a489e){return function(_0x569d49){if(_0x569d49){return _0x569d49[_0x332a('0x24')]()['then'](function(){_0x4bc96b['status'](0xcc)[_0x332a('0x1a')]();});}};}function handleEntityNotFound(_0xca464c,_0x56fcf8){return function(_0x334706){if(!_0x334706){_0xca464c[_0x332a('0x25')](0x194);}return _0x334706;};}function handleError(_0x50321b,_0x5900e5){_0x5900e5=_0x5900e5||0x1f4;return function(_0x4d6833){logger[_0x332a('0x26')](_0x4d6833['stack']);if(_0x4d6833[_0x332a('0x27')]){delete _0x4d6833[_0x332a('0x27')];}_0x50321b[_0x332a('0x1b')](_0x5900e5)['send'](_0x4d6833);};}exports[_0x332a('0x28')]=function(_0x435b22,_0x4df37f){var _0x2a82ff={'raw':!![],'where':{'id':_0x435b22[_0x332a('0x29')]['id']}},_0x467e0e={};_0x467e0e['model']=_[_0x332a('0x2a')](db[_0x332a('0x2b')][_0x332a('0x2c')]);_0x467e0e[_0x332a('0x2d')]=_[_0x332a('0x2a')](_0x435b22['query']);_0x467e0e[_0x332a('0x2e')]=_[_0x332a('0x2f')](_0x467e0e['model'],_0x467e0e['query']);_0x2a82ff['attributes']=_[_0x332a('0x2f')](_0x467e0e[_0x332a('0x30')],qs[_0x332a('0x31')](_0x435b22[_0x332a('0x2d')][_0x332a('0x31')]));_0x2a82ff[_0x332a('0x32')]=_0x2a82ff[_0x332a('0x32')]['length']?_0x2a82ff['attributes']:_0x467e0e[_0x332a('0x30')];if(_0x435b22[_0x332a('0x2d')][_0x332a('0x33')]){_0x2a82ff[_0x332a('0x34')]=[{'all':!![]}];}_0x2a82ff=_[_0x332a('0x35')]({},_0x2a82ff,_0x435b22[_0x332a('0x36')]);return db[_0x332a('0x2b')]['find'](_0x2a82ff)[_0x332a('0x37')](handleEntityNotFound(_0x4df37f,null))[_0x332a('0x37')](respondWithResult(_0x4df37f,null))[_0x332a('0x38')](handleError(_0x4df37f,null));};exports[_0x332a('0x23')]=function(_0x59b5cd,_0x786cce){if(_0x59b5cd['body']['id']){delete _0x59b5cd['body']['id'];}return db[_0x332a('0x2b')][_0x332a('0x39')]({'where':{'id':_0x59b5cd[_0x332a('0x29')]['id']}})[_0x332a('0x37')](handleEntityNotFound(_0x786cce,null))['then'](saveUpdates(_0x59b5cd[_0x332a('0x3a')],null))[_0x332a('0x37')](respondWithResult(_0x786cce,null))[_0x332a('0x38')](handleError(_0x786cce,null));};exports[_0x332a('0x24')]=function(_0x5a9e48,_0x5713c2){return db[_0x332a('0x2b')][_0x332a('0x39')]({'where':{'id':_0x5a9e48['params']['id']}})['then'](handleEntityNotFound(_0x5713c2,null))[_0x332a('0x37')](removeEntity(_0x5713c2,null))[_0x332a('0x38')](handleError(_0x5713c2,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index a50e775..2aa0ba8 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 _0xa988=['MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports'];(function(_0x1bd00d,_0x296e82){var _0x1d1d8f=function(_0x273ab5){while(--_0x273ab5){_0x1bd00d['push'](_0x1bd00d['shift']());}};_0x1d1d8f(++_0x296e82);}(_0xa988,0x1a7));var _0x8a98=function(_0x49063e,_0x4a6d30){_0x49063e=_0x49063e-0x0;var _0x52876d=_0xa988[_0x49063e];return _0x52876d;};'use strict';var _=require(_0x8a98('0x0'));var util=require(_0x8a98('0x1'));var logger=require(_0x8a98('0x2'))(_0x8a98('0x3'));var moment=require(_0x8a98('0x4'));var BPromise=require('bluebird');var rp=require(_0x8a98('0x5'));var fs=require('fs');var path=require(_0x8a98('0x6'));var rimraf=require(_0x8a98('0x7'));var config=require(_0x8a98('0x8'));var attributes=require(_0x8a98('0x9'));module[_0x8a98('0xa')]=function(_0x3eb5cf,_0x3fcd06){return _0x3eb5cf['define'](_0x8a98('0xb'),attributes,{'tableName':_0x8a98('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8a98('0xd')});}; \ No newline at end of file +var _0xea4e=['define','MailApplication','mail_applications','utf8mb4','lodash','moment','request-promise','path','../../config/environment','./mailApplication.attributes','exports'];(function(_0x159298,_0xddf03c){var _0xe97c57=function(_0x2a0098){while(--_0x2a0098){_0x159298['push'](_0x159298['shift']());}};_0xe97c57(++_0xddf03c);}(_0xea4e,0x10c));var _0xeea4=function(_0x1877e2,_0x2b76d4){_0x1877e2=_0x1877e2-0x0;var _0x44e96a=_0xea4e[_0x1877e2];return _0x44e96a;};'use strict';var _=require(_0xeea4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xeea4('0x1'));var BPromise=require('bluebird');var rp=require(_0xeea4('0x2'));var fs=require('fs');var path=require(_0xeea4('0x3'));var rimraf=require('rimraf');var config=require(_0xeea4('0x4'));var attributes=require(_0xeea4('0x5'));module[_0xeea4('0x6')]=function(_0x12e419,_0x297af5){return _0x12e419[_0xeea4('0x7')](_0xeea4('0x8'),attributes,{'tableName':_0xeea4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeea4('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index a79600e..39f0eff 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 _0xde77=['bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','UpdateMailApplication','MailApplication','body','options','attributes','limit','moment'];(function(_0x1ee351,_0x54261b){var _0x245aaf=function(_0x3e4b65){while(--_0x3e4b65){_0x1ee351['push'](_0x1ee351['shift']());}};_0x245aaf(++_0x54261b);}(_0xde77,0x1c1));var _0x7de7=function(_0x20422d,_0x43ee37){_0x20422d=_0x20422d-0x0;var _0x469adc=_0xde77[_0x20422d];return _0x469adc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7de7('0x0'));var BPromise=require(_0x7de7('0x1'));var rs=require(_0x7de7('0x2'));var fs=require('fs');var Redis=require(_0x7de7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7de7('0x4'))('rpc');var config=require(_0x7de7('0x5'));var jayson=require(_0x7de7('0x6'));var client=jayson[_0x7de7('0x7')][_0x7de7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1be6d4,_0x2e170c,_0x15879e){return new BPromise(function(_0xfcdf88,_0x1cac5f){return client[_0x7de7('0x9')](_0x1be6d4,_0x15879e)[_0x7de7('0xa')](function(_0x4b81fb){logger[_0x7de7('0xb')](_0x7de7('0xc'),_0x2e170c,_0x7de7('0xd'));logger[_0x7de7('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x2e170c,_0x7de7('0xd'),JSON['stringify'](_0x4b81fb));if(_0x4b81fb['error']){if(_0x4b81fb[_0x7de7('0xf')]['code']===0x1f4){logger['error'](_0x7de7('0xc'),_0x2e170c,_0x4b81fb[_0x7de7('0xf')]['message']);return _0x1cac5f(_0x4b81fb['error'][_0x7de7('0x10')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x2e170c,_0x4b81fb[_0x7de7('0xf')]['message']);return _0xfcdf88(_0x4b81fb[_0x7de7('0xf')]['message']);}else{logger[_0x7de7('0xb')](_0x7de7('0xc'),_0x2e170c,_0x7de7('0xd'));_0xfcdf88(_0x4b81fb[_0x7de7('0x11')][_0x7de7('0x10')]);}})[_0x7de7('0x12')](function(_0x6d3e61){logger[_0x7de7('0xf')]('MailApplication,\x20%s,\x20%s',_0x2e170c,_0x6d3e61);_0x1cac5f(_0x6d3e61);});});}exports[_0x7de7('0x13')]=function(_0x417139){var _0x333871=this;return new Promise(function(_0x56b0e3,_0x40b0fd){return db[_0x7de7('0x14')]['update'](_0x417139[_0x7de7('0x15')],{'raw':_0x417139[_0x7de7('0x16')]?_0x417139[_0x7de7('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x417139['options']?_0x417139[_0x7de7('0x16')]['where']||null:null,'attributes':_0x417139[_0x7de7('0x16')]?_0x417139['options'][_0x7de7('0x17')]||null:null,'limit':_0x417139[_0x7de7('0x16')]?_0x417139[_0x7de7('0x16')][_0x7de7('0x18')]||null:null})[_0x7de7('0xa')](function(_0x1ce663){logger['info']('UpdateMailApplication',_0x417139);logger['debug'](_0x7de7('0x13'),_0x417139,JSON['stringify'](_0x1ce663));_0x56b0e3(_0x1ce663);})[_0x7de7('0x12')](function(_0x418553){logger[_0x7de7('0xf')]('UpdateMailApplication',_0x418553[_0x7de7('0x10')],_0x417139);_0x40b0fd(_0x333871[_0x7de7('0xf')](0x1f4,_0x418553[_0x7de7('0x10')]));});});}; \ No newline at end of file +var _0xdb0c=['catch','MailApplication','update','body','options','raw','where','UpdateMailApplication','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x56cb5f,_0x322668){var _0x35a04f=function(_0xf41877){while(--_0xf41877){_0x56cb5f['push'](_0x56cb5f['shift']());}};_0x35a04f(++_0x322668);}(_0xdb0c,0xcc));var _0xcdb0=function(_0x143483,_0x3667e2){_0x143483=_0x143483-0x0;var _0x58724c=_0xdb0c[_0x143483];return _0x58724c;};'use strict';var _=require('lodash');var util=require(_0xcdb0('0x0'));var moment=require('moment');var BPromise=require(_0xcdb0('0x1'));var rs=require(_0xcdb0('0x2'));var fs=require('fs');var Redis=require(_0xcdb0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcdb0('0x4'));var logger=require('../../config/logger')(_0xcdb0('0x5'));var config=require('../../config/environment');var jayson=require(_0xcdb0('0x6'));var client=jayson[_0xcdb0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59b569,_0x11a510,_0x46a27d){return new BPromise(function(_0x4802bc,_0x9d079){return client[_0xcdb0('0x8')](_0x59b569,_0x46a27d)[_0xcdb0('0x9')](function(_0x4c5f7e){logger[_0xcdb0('0xa')](_0xcdb0('0xb'),_0x11a510,'request\x20sent');logger[_0xcdb0('0xc')](_0xcdb0('0xd'),_0x11a510,_0xcdb0('0xe'),JSON[_0xcdb0('0xf')](_0x4c5f7e));if(_0x4c5f7e[_0xcdb0('0x10')]){if(_0x4c5f7e[_0xcdb0('0x10')][_0xcdb0('0x11')]===0x1f4){logger[_0xcdb0('0x10')](_0xcdb0('0xb'),_0x11a510,_0x4c5f7e[_0xcdb0('0x10')]['message']);return _0x9d079(_0x4c5f7e['error'][_0xcdb0('0x12')]);}logger[_0xcdb0('0x10')](_0xcdb0('0xb'),_0x11a510,_0x4c5f7e[_0xcdb0('0x10')]['message']);return _0x4802bc(_0x4c5f7e[_0xcdb0('0x10')][_0xcdb0('0x12')]);}else{logger['info'](_0xcdb0('0xb'),_0x11a510,_0xcdb0('0xe'));_0x4802bc(_0x4c5f7e[_0xcdb0('0x13')][_0xcdb0('0x12')]);}})[_0xcdb0('0x14')](function(_0x1bdbf6){logger[_0xcdb0('0x10')](_0xcdb0('0xb'),_0x11a510,_0x1bdbf6);_0x9d079(_0x1bdbf6);});});}exports['UpdateMailApplication']=function(_0x130b46){var _0x17de25=this;return new Promise(function(_0x3d8131,_0x89dd2f){return db[_0xcdb0('0x15')][_0xcdb0('0x16')](_0x130b46[_0xcdb0('0x17')],{'raw':_0x130b46[_0xcdb0('0x18')]?_0x130b46['options'][_0xcdb0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x130b46[_0xcdb0('0x18')]?_0x130b46['options'][_0xcdb0('0x1a')]||null:null,'attributes':_0x130b46[_0xcdb0('0x18')]?_0x130b46[_0xcdb0('0x18')]['attributes']||null:null,'limit':_0x130b46[_0xcdb0('0x18')]?_0x130b46[_0xcdb0('0x18')]['limit']||null:null})[_0xcdb0('0x9')](function(_0xeead7a){logger[_0xcdb0('0xa')]('UpdateMailApplication',_0x130b46);logger[_0xcdb0('0xc')](_0xcdb0('0x1b'),_0x130b46,JSON['stringify'](_0xeead7a));_0x3d8131(_0xeead7a);})[_0xcdb0('0x14')](function(_0x440e79){logger[_0xcdb0('0x10')](_0xcdb0('0x1b'),_0x440e79[_0xcdb0('0x12')],_0x130b46);_0x89dd2f(_0x17de25[_0xcdb0('0x10')](0x1f4,_0x440e79['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index dde7adb..0104c42 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 _0x34e8=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','mailinteraction:addtags','addTags','mail','update','delete','mailinteraction:destroy','destroy','exports'];(function(_0x447a1c,_0x55bdb2){var _0x3d71eb=function(_0xf5ff7){while(--_0xf5ff7){_0x447a1c['push'](_0x447a1c['shift']());}};_0x3d71eb(++_0x55bdb2);}(_0x34e8,0x12c));var _0x834e=function(_0x56047f,_0x1d1f8d){_0x56047f=_0x56047f-0x0;var _0x454da1=_0x34e8[_0x56047f];return _0x454da1;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/describe',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0x9')](_0x834e('0xe'),auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0x9')](_0x834e('0x10'),auth[_0x834e('0xa')](),controller[_0x834e('0x11')]);router[_0x834e('0x12')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0x13')]);router['post'](_0x834e('0xe'),auth[_0x834e('0xa')](),controller['addMessage']);router[_0x834e('0x12')](_0x834e('0x14'),auth[_0x834e('0xa')](),interaction[_0x834e('0x15')]('mail',_0x834e('0x16')),controller[_0x834e('0x17')]);router['put'](_0x834e('0xc'),auth['isAuthenticated'](),interaction[_0x834e('0x15')](_0x834e('0x18'),'mailinteraction:update'),controller[_0x834e('0x19')]);router[_0x834e('0x1a')](_0x834e('0xc'),auth['isAuthenticated'](),interaction[_0x834e('0x15')](_0x834e('0x18'),_0x834e('0x1b')),controller[_0x834e('0x1c')]);router[_0x834e('0x1a')](_0x834e('0x14'),auth[_0x834e('0xa')](),controller['removeTags']);module[_0x834e('0x1d')]=router; \ No newline at end of file +var _0xacfe=['get','isAuthenticated','index','/describe','describe','/:id','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','update','delete','mailinteraction:destroy','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller'];(function(_0x31f837,_0x180e86){var _0x271d11=function(_0x1d9c74){while(--_0x1d9c74){_0x31f837['push'](_0x31f837['shift']());}};_0x271d11(++_0x180e86);}(_0xacfe,0xfd));var _0xeacf=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xacfe[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeacf('0x0'));var timeout=require(_0xeacf('0x1'));var express=require(_0xeacf('0x2'));var router=express[_0xeacf('0x3')]();var auth=require(_0xeacf('0x4'));var interaction=require(_0xeacf('0x5'));var config=require(_0xeacf('0x6'));var controller=require(_0xeacf('0x7'));router[_0xeacf('0x8')]('/',auth[_0xeacf('0x9')](),controller[_0xeacf('0xa')]);router[_0xeacf('0x8')](_0xeacf('0xb'),auth['isAuthenticated'](),controller[_0xeacf('0xc')]);router[_0xeacf('0x8')](_0xeacf('0xd'),auth[_0xeacf('0x9')](),controller['show']);router[_0xeacf('0x8')]('/:id/messages',auth[_0xeacf('0x9')](),controller[_0xeacf('0xe')]);router[_0xeacf('0x8')](_0xeacf('0xf'),auth[_0xeacf('0x9')](),controller[_0xeacf('0x10')]);router[_0xeacf('0x11')]('/',auth[_0xeacf('0x9')](),controller[_0xeacf('0x12')]);router[_0xeacf('0x11')]('/:id/messages',auth[_0xeacf('0x9')](),controller[_0xeacf('0x13')]);router[_0xeacf('0x11')](_0xeacf('0x14'),auth['isAuthenticated'](),interaction[_0xeacf('0x15')](_0xeacf('0x16'),_0xeacf('0x17')),controller['addTags']);router['put'](_0xeacf('0xd'),auth[_0xeacf('0x9')](),interaction['tracked'](_0xeacf('0x16'),'mailinteraction:update'),controller[_0xeacf('0x18')]);router[_0xeacf('0x19')]('/:id',auth[_0xeacf('0x9')](),interaction['tracked'](_0xeacf('0x16'),_0xeacf('0x1a')),controller[_0xeacf('0x1b')]);router[_0xeacf('0x19')]('/:id/tags',auth[_0xeacf('0x9')](),controller['removeTags']);module[_0xeacf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index c2784a5..a8c668c 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 _0xc938=['out','sequelize','exports','DATE','STRING','TEXT','long','BOOLEAN','ENUM'];(function(_0x1f475a,_0x5b215e){var _0x2edac8=function(_0x29af89){while(--_0x29af89){_0x1f475a['push'](_0x1f475a['shift']());}};_0x2edac8(++_0x5b215e);}(_0xc938,0xe2));var _0x8c93=function(_0x462266,_0x559dd3){_0x462266=_0x462266-0x0;var _0x170b0b=_0xc938[_0x462266];return _0x170b0b;};'use strict';var Sequelize=require(_0x8c93('0x0'));var iconv=require('iconv');module[_0x8c93('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8c93('0x2')]},'disposition':{'type':Sequelize[_0x8c93('0x3')]},'secondDisposition':{'type':Sequelize[_0x8c93('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8c93('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x8c93('0x3')]},'cc':{'type':Sequelize[_0x8c93('0x4')](_0x8c93('0x5'))},'subject':{'type':Sequelize[_0x8c93('0x4')]()},'attach':{'type':Sequelize[_0x8c93('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x8c93('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x8c93('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x8c93('0x7')]('in',_0x8c93('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x8c93('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x8c93('0x4')](_0x8c93('0x5'))},'lastMsgText':{'type':Sequelize[_0x8c93('0x4')](_0x8c93('0x5'))}}; \ No newline at end of file +var _0xa9e6=['TEXT','long','out','DATE','ENUM','exports','BOOLEAN','STRING'];(function(_0x466683,_0xa91db8){var _0x4aa0e9=function(_0x9ddf10){while(--_0x9ddf10){_0x466683['push'](_0x466683['shift']());}};_0x4aa0e9(++_0xa91db8);}(_0xa9e6,0x14d));var _0x6a9e=function(_0x450029,_0x12eafd){_0x450029=_0x450029-0x0;var _0x2caded=_0xa9e6[_0x450029];return _0x2caded;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0x6a9e('0x0')]={'closed':{'type':Sequelize[_0x6a9e('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6a9e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x6a9e('0x2')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x6a9e('0x2')](0x1fe)},'to':{'type':Sequelize[_0x6a9e('0x2')]},'cc':{'type':Sequelize[_0x6a9e('0x3')](_0x6a9e('0x4'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x6a9e('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x6a9e('0x2')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6a9e('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6a9e('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x6a9e('0x7')]('in',_0x6a9e('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x6a9e('0x3')](_0x6a9e('0x4'))},'lastMsgText':{'type':Sequelize['TEXT'](_0x6a9e('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 4d86ee5..482799e 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 _0x56c3=['c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','plainBody','some','compact','isEmpty','MailAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','count','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.id','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','Contact.mobile','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','filtears','includeAll','include','options','create','body','params','destroy','describe','addMessage','MailMessage','ids','getMessages','merge','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','omit','spread','Tag','emit','removeTags','download','unix','join','files','tmp','root','server','attachments','format','transcript-%d-%s.zip','Attachments','Messages','bcc','subject','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','./mailInteraction.socket','register','sendStatus','status','end','json','offset','set','apply','reject','save','update','then','error','stack','name','Users','map','fullname','TagIds','Tags','forEach','push','MailInteraction','findOne','lastMsgBody','lastMsgText','fromString','catch','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','operator','$substring','split','getFullTextValue'];(function(_0x596284,_0x1cd02b){var _0x5313c6=function(_0x77db49){while(--_0x77db49){_0x596284['push'](_0x596284['shift']());}};_0x5313c6(++_0x1cd02b);}(_0x56c3,0x176));var _0x356c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56c3[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x356c('0x0'));var emlformat=require(_0x356c('0x1'));var rimraf=require(_0x356c('0x2'));var zipdir=require(_0x356c('0x3'));var jsonpatch=require(_0x356c('0x4'));var rp=require(_0x356c('0x5'));var moment=require(_0x356c('0x6'));var BPromise=require(_0x356c('0x7'));var Mustache=require(_0x356c('0x8'));var util=require(_0x356c('0x9'));var path=require(_0x356c('0xa'));var sox=require('sox');var csv=require(_0x356c('0xb'));var ejs=require(_0x356c('0xc'));var fs=require('fs');var _=require(_0x356c('0xd'));var squel=require(_0x356c('0xe'));var crypto=require(_0x356c('0xf'));var jsforce=require(_0x356c('0x10'));var deskjs=require(_0x356c('0x11'));var toCsv=require(_0x356c('0xb'));var querystring=require(_0x356c('0x12'));var Papa=require('papaparse');var htmlToText=require(_0x356c('0x13'));var Redis=require(_0x356c('0x14'));var authService=require(_0x356c('0x15'));var qs=require(_0x356c('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x356c('0x17'));var logger=require(_0x356c('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x356c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x356c('0x1a'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x356c('0x1b')]));require(_0x356c('0x1c'))[_0x356c('0x1d')](socket);function respondWithStatusCode(_0x2902ea,_0x516860){_0x516860=_0x516860||0xcc;return function(_0x3b15a1){if(_0x3b15a1){return _0x2902ea[_0x356c('0x1e')](_0x516860);}return _0x2902ea[_0x356c('0x1f')](_0x516860)[_0x356c('0x20')]();};}function respondWithResult(_0x3d5b72,_0x37516c){_0x37516c=_0x37516c||0xc8;return function(_0x38286b){if(_0x38286b){return _0x3d5b72[_0x356c('0x1f')](_0x37516c)[_0x356c('0x21')](_0x38286b);}};}function respondWithFilteredResult(_0x322a55,_0xd81d15){return function(_0x34b6ba){if(_0x34b6ba){var _0x595d7a=_0x34b6ba['count'],_0x594eeb=_0xd81d15[_0x356c('0x22')],_0x3289da=_0xd81d15['offset']+_0xd81d15['limit'],_0x3cc2c4;if(_0x3289da>=_0x595d7a){_0x3289da=_0x595d7a;_0x3cc2c4=0xc8;}else{_0x3cc2c4=0xce;}_0x322a55[_0x356c('0x1f')](_0x3cc2c4);return _0x322a55[_0x356c('0x23')]('Content-Range',_0x594eeb+'-'+_0x3289da+'/'+_0x595d7a)[_0x356c('0x21')](_0x34b6ba);}return null;};}function patchUpdates(_0x3d57f9){return function(_0x326606){try{jsonpatch[_0x356c('0x24')](_0x326606,_0x3d57f9,!![]);}catch(_0xca88a6){return BPromise[_0x356c('0x25')](_0xca88a6);}return _0x326606[_0x356c('0x26')]();};}function saveUpdates(_0x27efcf,_0x39501e){return function(_0x229262){if(_0x229262){return _0x229262[_0x356c('0x27')](_0x27efcf)[_0x356c('0x28')](function(_0x3a40de){return _0x3a40de;});}return null;};}function removeEntity(_0x30ded5,_0x2c0a48){return function(_0xcf1333){if(_0xcf1333){return _0xcf1333['destroy']()['then'](function(){_0x30ded5[_0x356c('0x1f')](0xcc)[_0x356c('0x20')]();});}};}function handleEntityNotFound(_0x28af42,_0x4b875d){return function(_0x35be09){if(!_0x35be09){_0x28af42['sendStatus'](0x194);}return _0x35be09;};}function handleError(_0x5d36a8,_0xb38e7){_0xb38e7=_0xb38e7||0x1f4;return function(_0x1d7c6e){logger[_0x356c('0x29')](_0x1d7c6e[_0x356c('0x2a')]);if(_0x1d7c6e['name']){delete _0x1d7c6e[_0x356c('0x2b')];}_0x5d36a8[_0x356c('0x1f')](_0xb38e7)['send'](_0x1d7c6e);};}function getInteractionUsers(_0xb817c4,_0x29bb02){return new BPromise(function(_0x5584fb,_0x5e7104){try{if(_0x29bb02[_0xb817c4['id']]){_0xb817c4[_0x356c('0x2c')]=_[_0x356c('0x2d')](_0x29bb02[_0xb817c4['id']],function(_0x450220){return{'id':_0x450220['id'],'fullname':_0x450220[_0x356c('0x2e')]};});}}catch(_0x5c9baa){_0x5e7104(_0x5c9baa);}_0x5584fb(_0xb817c4);});}function getInteractionTags(_0x59dc97,_0x976ab0){return new BPromise(function(_0x36792a,_0x1dd4bd){try{if(_0x59dc97[_0x356c('0x2f')]){_0x59dc97[_0x356c('0x30')]=[];_0x59dc97['TagIds']['split'](',')[_0x356c('0x31')](function(_0x2fe35a){_0x59dc97[_0x356c('0x30')][_0x356c('0x32')](_0x976ab0[_0x2fe35a]);});}delete _0x59dc97['TagIds'];}catch(_0x451e65){_0x1dd4bd(_0x451e65);}_0x36792a(_0x59dc97);});}function getLastMessageText(_0x5a58a7){return new BPromise(function(_0x29f12c,_0x12d4b5){return db[_0x356c('0x33')][_0x356c('0x34')]({'where':{'id':_0x5a58a7['id']},'attributes':[_0x356c('0x35'),_0x356c('0x36')],'raw':!![]})[_0x356c('0x28')](function(_0x10e6b8){if(!_0x10e6b8[_0x356c('0x36')]){_0x5a58a7[_0x356c('0x36')]=_['trimStart'](htmlToText[_0x356c('0x37')](_0x10e6b8[_0x356c('0x35')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x5a58a7[_0x356c('0x36')]=_0x10e6b8[_0x356c('0x36')];}_0x29f12c(_0x5a58a7);})[_0x356c('0x38')](function(_0x5f235c){_0x12d4b5(_0x5f235c);});});}function updateMailInteraction(_0x3efd8f,_0x26cb6d,_0x23c52b,_0x21cfba){return new BPromise(function(_0x24e107,_0x2c2400){return getInteractionUsers(_0x3efd8f,_0x23c52b)[_0x356c('0x28')](function(_0x25add5){return getInteractionTags(_0x25add5,_0x26cb6d);})[_0x356c('0x28')](function(_0x428af9){if(_0x21cfba){_0x24e107(getLastMessageText(_0x428af9));}else{_0x24e107(_0x428af9);}})[_0x356c('0x38')](function(_0x104528){_0x2c2400(_0x104528);});});}exports['index']=function(_0x4c019c,_0x37bee2){var _0x3a18ce={},_0x5489fd={},_0x385565={'count':0x0,'rows':[]};var _0x740d77=_[_0x356c('0x2d')](db[_0x356c('0x33')][_0x356c('0x39')],function(_0x501c30){return{'name':_0x501c30[_0x356c('0x3a')],'type':_0x501c30[_0x356c('0x3b')]['key']};});_0x5489fd['model']=_[_0x356c('0x2d')](_0x740d77,'name');_0x5489fd[_0x356c('0x3c')]=_[_0x356c('0x3d')](_0x4c019c[_0x356c('0x3c')]);_0x5489fd[_0x356c('0x3e')]=_[_0x356c('0x3f')](_0x5489fd['model'],_0x5489fd[_0x356c('0x3c')]);_0x3a18ce[_0x356c('0x40')]=_[_0x356c('0x3f')](_0x5489fd[_0x356c('0x41')],qs[_0x356c('0x42')](_0x4c019c['query']['fields']));_0x3a18ce[_0x356c('0x40')]=_0x3a18ce[_0x356c('0x40')][_0x356c('0x43')]?_0x3a18ce[_0x356c('0x40')]:_0x5489fd['model'];if(!_0x4c019c[_0x356c('0x3c')][_0x356c('0x44')](_0x356c('0x45'))){_0x3a18ce[_0x356c('0x46')]=qs[_0x356c('0x46')](_0x4c019c[_0x356c('0x3c')][_0x356c('0x46')]);_0x3a18ce['offset']=qs[_0x356c('0x22')](_0x4c019c[_0x356c('0x3c')][_0x356c('0x22')]);}_0x3a18ce[_0x356c('0x47')]=qs['sort'](_0x4c019c['query'][_0x356c('0x48')]);_0x3a18ce[_0x356c('0x49')]=qs[_0x356c('0x3e')](_[_0x356c('0x4a')](_0x4c019c[_0x356c('0x3c')],_0x5489fd['filters']),_0x740d77);var _0x2f0c40=[];var _0x2b4e8d=squel[_0x356c('0x4b')]()[_0x356c('0x4c')]('id')[_0x356c('0x4c')](_0x356c('0x2b'))['field'](_0x356c('0x4d'))[_0x356c('0x4e')](_0x356c('0x4f'));var _0x5b0398=squel[_0x356c('0x4b')]()['field'](_0x356c('0x50'))['field'](_0x356c('0x51'))[_0x356c('0x4c')](_0x356c('0x52'))['from'](_0x356c('0x53'),'ui')[_0x356c('0x54')](_0x356c('0x55'),'u',_0x356c('0x56'));var _0xf7bb5e=squel[_0x356c('0x4b')]()['from'](_0x356c('0x57'),'i')[_0x356c('0x54')](_0x356c('0x58'),'c',_0x356c('0x59'))[_0x356c('0x54')](_0x356c('0x55'),'o','o.id\x20=\x20i.UserId')[_0x356c('0x54')](_0x356c('0x5a'),'a','a.id\x20=\x20i.MailAccountId')[_0x356c('0x54')](_0x356c('0x5b'),'me',_0x356c('0x5c'))[_0x356c('0x54')](_0x356c('0x5d'),'it',_0x356c('0x5e'))[_0x356c('0x54')](_0x356c('0x4f'),'t',_0x356c('0x5f'));var _0x2f3b66=squel[_0x356c('0x60')]();var _0x593889=[];var _0x522b41=squel[_0x356c('0x60')]();var _0x22652b;if(_0x4c019c[_0x356c('0x3c')]['search']){_0x22652b=as[_0x356c('0x61')](_0x4c019c[_0x356c('0x3c')][_0x356c('0x62')]);var _0x5a6a69=_0x22652b[_0x356c('0x63')];for(var _0x4cf358=0x0;_0x4cf358<_0x22652b[_0x356c('0x64')][_0x356c('0x43')];_0x4cf358++){var _0x501ba3=_0x22652b[_0x356c('0x64')][_0x4cf358];var _0x39a8dd='i';var _0x2bc889=_[_0x356c('0x65')](_0x740d77,[_0x356c('0x2b'),_0x501ba3[_0x356c('0x4c')]]);if(!_0x2bc889){switch(_0x501ba3['field']){case _0x356c('0x66'):if(_0x501ba3[_0x356c('0x67')]==0x1){_0xf7bb5e['having']('`'+_0x501ba3[_0x356c('0x4c')]+'`\x20=\x200');}else{_0xf7bb5e[_0x356c('0x68')]('`'+_0x501ba3[_0x356c('0x4c')]+_0x356c('0x69'));}break;case'Contact':if(_0x501ba3[_0x356c('0x6a')]===_0x356c('0x6b')){if(_0x501ba3[_0x356c('0x67')][_0x356c('0x6c')]('\x20')['length']>0x1){_0x2f3b66[_0x5a6a69]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x356c('0x6d')](_0x501ba3[_0x356c('0x67')]),null);}else{var _0x4a4c45='%'+_0x501ba3['value']+'%';_0x2f3b66[_0x5a6a69](_0x356c('0x6e'),_0x4a4c45,_0x4a4c45,_0x4a4c45);}}else{_0x2bc889=_['find'](_0x740d77,[_0x356c('0x2b'),_0x356c('0x6f')]);_0x501ba3[_0x356c('0x4c')]=_0x356c('0x6f');_0x5b5f3d=as[_0x356c('0x70')](_0x39a8dd,_0x2bc889[_0x356c('0x3b')],_0x501ba3);_0x2f3b66[_0x5a6a69](_0x5b5f3d['text'],_0x5b5f3d[_0x356c('0x67')]['start'],_0x5b5f3d['value']['end']);}break;case'Tag':var _0x9445e3=_0x501ba3[_0x356c('0x67')][_0x356c('0x6c')](',')[_0x356c('0x2d')](function(_0x3ebd93){return Number(_0x3ebd93);});_0x9445e3['forEach'](function(_0xc5884b){_0x522b41['or'](_0x356c('0x71'),'%,'+_0xc5884b+',%');});_0x593889=_[_0x356c('0x72')](_0x593889,_0x9445e3);break;case'User':if(_0x501ba3[_0x356c('0x6a')]==='$substring'){_0x2f3b66[_0x5a6a69](_0x356c('0x73'),'%'+_0x501ba3['value']+'%',null);}else{_0x2bc889=_[_0x356c('0x65')](_0x740d77,[_0x356c('0x2b'),_0x356c('0x74')]);_0x501ba3['field']=_0x356c('0x74');_0x5b5f3d=as[_0x356c('0x70')](_0x39a8dd,_0x2bc889[_0x356c('0x3b')],_0x501ba3);_0x2f3b66[_0x5a6a69](_0x5b5f3d[_0x356c('0x75')],_0x5b5f3d[_0x356c('0x67')][_0x356c('0x76')],_0x5b5f3d[_0x356c('0x67')][_0x356c('0x20')]);}break;case _0x356c('0x77'):_0x5b5f3d=as[_0x356c('0x70')]('me',null,_0x501ba3);_0x2f3b66[_0x5a6a69](_0x5b5f3d[_0x356c('0x75')],_0x5b5f3d[_0x356c('0x67')]['start'],_0x5b5f3d[_0x356c('0x67')]['end']);break;}}else{var _0x5b5f3d=as[_0x356c('0x70')](_0x39a8dd,_0x2bc889['type'],_0x501ba3);_0x2f3b66[_0x5a6a69](_0x5b5f3d[_0x356c('0x75')],_0x5b5f3d['value'][_0x356c('0x76')],_0x5b5f3d[_0x356c('0x67')]['end']);}}}else{var _0x383ad2=_(_0x4c019c['query'])[_0x356c('0x3d')]()[_0x356c('0x2d')](function(_0x2b0de9){return _[_0x356c('0x78')](_0x740d77,['name',_0x2b0de9])?_0x2b0de9:undefined;})[_0x356c('0x79')]()[_0x356c('0x67')]();if(!_[_0x356c('0x7a')](_0x383ad2)){_0x383ad2[_0x356c('0x31')](function(_0x16f877){if(_0x16f877===_0x356c('0x7b')){_0xf7bb5e['where']('i.MailAccountId\x20IN\x20?',[][_0x356c('0x7c')](_0x4c019c[_0x356c('0x3c')][_0x16f877]));}else if(_0x16f877===_0x356c('0x7d')){var _0x11896e=JSON[_0x356c('0x7e')](_0x4c019c[_0x356c('0x3c')][_0x16f877])[_0x356c('0x7f')];var _0x37bb6c=JSON['parse'](_0x4c019c[_0x356c('0x3c')][_0x16f877])[_0x356c('0x80')];_0xf7bb5e[_0x356c('0x49')](_0x356c('0x81'),_0x11896e,_0x37bb6c);}else{if(_0x4c019c['query'][_0x16f877]===_0x356c('0x82')){_0xf7bb5e['where']('i.'+_0x16f877+'\x20IS\x20NULL');}else{_0xf7bb5e[_0x356c('0x49')]('i.'+_0x16f877+_0x356c('0x83'),_0x4c019c[_0x356c('0x3c')][_0x16f877]);}}});}if(_0x4c019c[_0x356c('0x3c')][_0x356c('0x84')]){if(_0x4c019c[_0x356c('0x3c')]['read']==0x1){_0xf7bb5e[_0x356c('0x68')](_0x356c('0x85'));}else{_0xf7bb5e['having'](_0x356c('0x86'));}}if(_0x4c019c['query'][_0x356c('0x87')]){_0x593889=_[_0x356c('0x88')](_0x4c019c[_0x356c('0x3c')][_0x356c('0x87')])?_0x4c019c[_0x356c('0x3c')][_0x356c('0x87')]:new Array(_0x4c019c[_0x356c('0x3c')]['tag']);_0x593889['forEach'](function(_0x3d966f){_0x522b41['or'](_0x356c('0x71'),'%,'+_0x3d966f+',%');});}if(_0x4c019c['query']['filter']){var _0x1b5261=_0x4c019c[_0x356c('0x3c')][_0x356c('0x89')][_0x356c('0x8a')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x356c('0x8b'));if(qs[_0x356c('0x8c')](_0x1b5261)){_0x2f3b66['or']('i.id\x20LIKE\x20?',_0x1b5261+'%');}else if(qs[_0x356c('0x8d')](_0x1b5261)){_0x2f3b66['or'](_0x356c('0x8e'),_0x1b5261+'%');}else{_0x2f3b66['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x356c('0x6d')](_0x1b5261))['or'](_0x356c('0x8f'),qs[_0x356c('0x6d')](_0x1b5261));}}}_0xf7bb5e[_0x356c('0x49')](_0x2f3b66);_0xf7bb5e[_0x356c('0x90')]('i.id');var _0x24ef3b={'type':db[_0x356c('0x91')][_0x356c('0x92')][_0x356c('0x93')],'raw':!![]};var _0x120927=_0xf7bb5e[_0x356c('0x94')]();_0x120927[_0x356c('0x4c')]('i.id');_0x120927[_0x356c('0x4c')](_0x356c('0x95'),_0x356c('0x66'));if(_0x3a18ce[_0x356c('0x47')]){_0x3a18ce[_0x356c('0x47')][_0x356c('0x31')](function(_0x16c6a8){_0xf7bb5e['order']('i.'+_0x16c6a8[0x0],_0x16c6a8[0x1]===_0x356c('0x96')?![]:!![]);});}if(!_[_0x356c('0x7a')](_0x593889)){_0xf7bb5e['having'](_0x522b41);_0x120927[_0x356c('0x49')](_0x356c('0x97'),_0x593889);}BPromise[_0x356c('0x98')]()[_0x356c('0x28')](function(){if(!_0x22652b){if(_0x4c019c[_0x356c('0x3c')][_0x356c('0x7b')]||_0x4c019c[_0x356c('0x3c')]['journey'])return;_0x120927[_0x356c('0x49')](_0x356c('0x99'));_0xf7bb5e[_0x356c('0x49')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x4c019c[_0x356c('0x9a')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0x356c('0x28')](function(_0x11d45c){if(_[_0x356c('0x7a')](_0x11d45c)){_0x120927[_0x356c('0x49')](_0x356c('0x9b'));_0xf7bb5e[_0x356c('0x49')]('i.MailAccountId\x20IS\x20NULL');}else{_0x120927[_0x356c('0x49')](_0x356c('0x9c'),_[_0x356c('0x2d')](_0x11d45c,'id'));_0xf7bb5e[_0x356c('0x49')]('i.MailAccountId\x20IN\x20?',_[_0x356c('0x2d')](_0x11d45c,'id'));}});})[_0x356c('0x28')](function(){db[_0x356c('0x9d')]['query'](_0x120927[_0x356c('0x9e')](),_0x24ef3b)[_0x356c('0x28')](function(_0x38bffd){_0x385565[_0x356c('0x9f')]=_0x38bffd[_0x356c('0x43')];if(_0x385565[_0x356c('0x9f')]===0x0)return[];return db[_0x356c('0x9d')]['query'](_0x2b4e8d[_0x356c('0x9e')](),_0x24ef3b)[_0x356c('0x28')](function(_0x179984){_0x2f0c40=_[_0x356c('0xa0')](_0x179984,'id');_0x24ef3b=_['merge'](_0x24ef3b,{'model':db[_0x356c('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4c019c[_0x356c('0x3c')][_0x356c('0x42')]){_0x3a18ce['attributes']['forEach'](function(_0x1503b9){_0xf7bb5e['field']('i.'+_0x1503b9);});}else{_0xf7bb5e['field'](_0x356c('0x95'),_0x356c('0x66'));_0xf7bb5e[_0x356c('0x4c')]('a.key',_0x356c('0xa1'));_0xf7bb5e[_0x356c('0x4c')](_0x356c('0xa2'),_0x356c('0xa3'));_0xf7bb5e['field'](_0x356c('0xa4'));_0xf7bb5e[_0x356c('0x4c')]('i.createdAt');_0xf7bb5e[_0x356c('0x4c')](_0x356c('0xa5'));_0xf7bb5e[_0x356c('0x4c')](_0x356c('0xa6'));_0xf7bb5e[_0x356c('0x4c')](_0x356c('0xa7'));_0xf7bb5e[_0x356c('0x4c')]('i.attach');_0xf7bb5e[_0x356c('0x4c')](_0x356c('0xa8'));_0xf7bb5e['field']('i.lastMsgDirection');_0xf7bb5e[_0x356c('0x4c')](_0x356c('0xa9'));_0xf7bb5e['field'](_0x356c('0xaa'));_0xf7bb5e[_0x356c('0x4c')](_0x356c('0xab'));_0xf7bb5e[_0x356c('0x4c')](_0x356c('0xac'));_0xf7bb5e[_0x356c('0x4c')](_0x356c('0xad'));_0xf7bb5e[_0x356c('0x4c')](_0x356c('0xae'));_0xf7bb5e[_0x356c('0x4c')]('i.ContactId');_0xf7bb5e[_0x356c('0x4c')]('i.MailAccountId');_0xf7bb5e[_0x356c('0x4c')](_0x356c('0xaf'));_0xf7bb5e[_0x356c('0x4c')](_0x356c('0xb0'),_0x356c('0xb1'));_0xf7bb5e[_0x356c('0x4c')](_0x356c('0xb2'),_0x356c('0xb3'));_0xf7bb5e[_0x356c('0x4c')]('c.email',_0x356c('0xb4'));_0xf7bb5e['field']('c.phone',_0x356c('0xb5'));_0xf7bb5e[_0x356c('0x4c')]('c.mobile',_0x356c('0xb6'));_0xf7bb5e[_0x356c('0x4c')]('c.fax','Contact.fax');_0xf7bb5e[_0x356c('0x4c')](_0x356c('0xb7'),_0x356c('0xb8'));_0xf7bb5e['field'](_0x356c('0xb9'),'Owner.internal');_0xf7bb5e[_0x356c('0x4c')](_0x356c('0xba'),'TagIds');}if(_0x3a18ce[_0x356c('0x46')])_0xf7bb5e[_0x356c('0x46')](_0x3a18ce[_0x356c('0x46')]);if(_0x3a18ce[_0x356c('0x22')])_0xf7bb5e[_0x356c('0x22')](_0x3a18ce['offset']);return db['sequelize'][_0x356c('0x3c')](_0xf7bb5e[_0x356c('0x9e')](),_0x24ef3b);})[_0x356c('0x28')](function(_0x55b2aa){_0x5b0398[_0x356c('0x49')](_0x356c('0xbb'),_[_0x356c('0x2d')](_0x55b2aa,'id'));return db[_0x356c('0x9d')][_0x356c('0x3c')](_0x5b0398['toString'](),_0x24ef3b)[_0x356c('0x28')](function(_0x248d56){var _0x110f6d=_[_0x356c('0xbc')](_0x248d56,_0x356c('0xbd'));var _0x19d725=[];return db[_0x356c('0xbe')][_0x356c('0x34')]({'attributes':[_0x356c('0xbf')],'raw':!![]})[_0x356c('0x28')](function(_0xe5e35){var _0xe9e155=_0xe5e35[_0x356c('0xbf')];_0x55b2aa[_0x356c('0x31')](function(_0x5dd156){_0x19d725[_0x356c('0x32')](updateMailInteraction(_0x5dd156,_0x2f0c40,_0x110f6d,_0xe9e155));});return BPromise[_0x356c('0xc0')](_0x19d725);});});});})[_0x356c('0x28')](function(_0x1390fb){_0x385565[_0x356c('0xc1')]=_0x1390fb;return _0x385565;})['then'](respondWithFilteredResult(_0x37bee2,_0x3a18ce));})[_0x356c('0x38')](handleError(_0x37bee2,null));};exports['show']=function(_0x4eb0fe,_0x3499d6){var _0x1a3ad4={'raw':![],'where':{'id':_0x4eb0fe['params']['id']}},_0x26271f={};_0x26271f[_0x356c('0x41')]=_[_0x356c('0x3d')](db['MailInteraction']['rawAttributes']);_0x26271f[_0x356c('0x3c')]=_[_0x356c('0x3d')](_0x4eb0fe[_0x356c('0x3c')]);_0x26271f[_0x356c('0xc2')]=_[_0x356c('0x3f')](_0x26271f['model'],_0x26271f[_0x356c('0x3c')]);_0x1a3ad4[_0x356c('0x40')]=_['intersection'](_0x26271f[_0x356c('0x41')],qs[_0x356c('0x42')](_0x4eb0fe[_0x356c('0x3c')][_0x356c('0x42')]));_0x1a3ad4[_0x356c('0x40')]=_0x1a3ad4[_0x356c('0x40')][_0x356c('0x43')]?_0x1a3ad4[_0x356c('0x40')]:_0x26271f['model'];if(_0x4eb0fe['query'][_0x356c('0xc3')]){_0x1a3ad4[_0x356c('0xc4')]=[{'all':!![]}];}_0x1a3ad4=_['merge']({},_0x1a3ad4,_0x4eb0fe[_0x356c('0xc5')]);return db[_0x356c('0x33')][_0x356c('0x65')](_0x1a3ad4)[_0x356c('0x28')](handleEntityNotFound(_0x3499d6,null))[_0x356c('0x28')](respondWithResult(_0x3499d6,null))[_0x356c('0x38')](handleError(_0x3499d6,null));};exports[_0x356c('0xc6')]=function(_0x3fc56a,_0x5c0aac){return db[_0x356c('0x33')][_0x356c('0xc6')](_0x3fc56a[_0x356c('0xc7')],{})['then'](respondWithResult(_0x5c0aac,0xc9))[_0x356c('0x38')](handleError(_0x5c0aac,null));};exports[_0x356c('0x27')]=function(_0x5acab7,_0x370063){if(_0x5acab7['body']['id']){delete _0x5acab7['body']['id'];}return db[_0x356c('0x33')][_0x356c('0x65')]({'where':{'id':_0x5acab7[_0x356c('0xc8')]['id']}})[_0x356c('0x28')](handleEntityNotFound(_0x370063,null))[_0x356c('0x28')](saveUpdates(_0x5acab7[_0x356c('0xc7')],null))['then'](respondWithResult(_0x370063,null))[_0x356c('0x38')](handleError(_0x370063,null));};exports[_0x356c('0xc9')]=function(_0x1caec1,_0x5d419c){return db[_0x356c('0x33')][_0x356c('0x65')]({'where':{'id':_0x1caec1[_0x356c('0xc8')]['id']}})[_0x356c('0x28')](handleEntityNotFound(_0x5d419c,null))[_0x356c('0x28')](removeEntity(_0x5d419c,null))[_0x356c('0x38')](handleError(_0x5d419c,null));};exports[_0x356c('0xca')]=function(_0x13fd0d,_0x31bc7e){return db['MailInteraction'][_0x356c('0xca')]()['then'](respondWithResult(_0x31bc7e,null))[_0x356c('0x38')](handleError(_0x31bc7e,null));};exports[_0x356c('0xcb')]=function(_0xbd692c,_0x5532b2,_0x4f9bae){return db[_0x356c('0xcc')][_0x356c('0x65')]({'where':{'id':_0xbd692c['params']['id']}})[_0x356c('0x28')](handleEntityNotFound(_0x5532b2,null))[_0x356c('0x28')](function(_0x25f6f0){if(_0x25f6f0){return _0x25f6f0[_0x356c('0xcb')](_0xbd692c[_0x356c('0xc7')][_0x356c('0xcd')],_['omit'](_0xbd692c[_0x356c('0xc7')],['ids','id'])||{});}})[_0x356c('0x28')](respondWithResult(_0x5532b2,null))[_0x356c('0x38')](handleError(_0x5532b2,null));};exports[_0x356c('0xce')]=function(_0x3e2ea4,_0x270aa4,_0x457d20){var _0xe89a87={'raw':![],'where':{}};var _0x5b158f={};var _0x599cfa={'count':0x0,'rows':[]};return db[_0x356c('0x33')][_0x356c('0x34')]({'where':{'id':_0x3e2ea4[_0x356c('0xc8')]['id']}})[_0x356c('0x28')](handleEntityNotFound(_0x270aa4,null))[_0x356c('0x28')](function(_0x6b0c22){if(_0x6b0c22){_0x5b158f[_0x356c('0x41')]=_[_0x356c('0x3d')](db[_0x356c('0xcc')][_0x356c('0x39')]);_0x5b158f[_0x356c('0x3c')]=_[_0x356c('0x3d')](_0x3e2ea4['query']);_0x5b158f[_0x356c('0x3e')]=_[_0x356c('0x3f')](_0x5b158f[_0x356c('0x41')],_0x5b158f[_0x356c('0x3c')]);_0xe89a87['attributes']=_['intersection'](_0x5b158f[_0x356c('0x41')],qs['fields'](_0x3e2ea4[_0x356c('0x3c')][_0x356c('0x42')]));_0xe89a87[_0x356c('0x40')]=_0xe89a87['attributes'][_0x356c('0x43')]?_0xe89a87[_0x356c('0x40')]:_0x5b158f[_0x356c('0x41')];if(!_0x3e2ea4[_0x356c('0x3c')][_0x356c('0x44')](_0x356c('0x45'))){_0xe89a87[_0x356c('0x46')]=qs[_0x356c('0x46')](_0x3e2ea4[_0x356c('0x3c')][_0x356c('0x46')]);_0xe89a87['offset']=qs[_0x356c('0x22')](_0x3e2ea4['query'][_0x356c('0x22')]);}_0xe89a87[_0x356c('0x47')]=qs[_0x356c('0x48')](_0x3e2ea4[_0x356c('0x3c')][_0x356c('0x48')]);_0xe89a87['where']=qs[_0x356c('0x3e')](_['pick'](_0x3e2ea4['query'],_0x5b158f[_0x356c('0x3e')]));_0xe89a87[_0x356c('0x49')][_0x356c('0xbd')]=_0x6b0c22['id'];if(_0x3e2ea4[_0x356c('0x3c')]['filter']){_0xe89a87['where']=_[_0x356c('0xcf')](_0xe89a87[_0x356c('0x49')],{'$or':_[_0x356c('0x2d')](_0xe89a87[_0x356c('0x40')],function(_0x21e008){var _0x4cddc3={};_0x4cddc3[_0x21e008]={'$like':'%'+_0x3e2ea4[_0x356c('0x3c')][_0x356c('0x89')]+'%'};return _0x4cddc3;})});}if(_0x3e2ea4[_0x356c('0x3c')][_0x356c('0x7f')]){var _0x4887ba=_0x3e2ea4[_0x356c('0x3c')]['$gte'][_0x356c('0x6c')](',');var _0x5d5572={};_0x5d5572[_0x4887ba[0x0]]={'$gte':moment(_0x4887ba[0x1])['format'](_0x356c('0xd0'))};_0xe89a87[_0x356c('0x49')]=_[_0x356c('0xcf')](_0xe89a87[_0x356c('0x49')],_0x5d5572);}_0xe89a87=_[_0x356c('0xcf')]({},_0xe89a87,_0x3e2ea4['options']);return db[_0x356c('0xcc')]['count']({'where':_0xe89a87['where']})[_0x356c('0x28')](function(_0x205d36){_0x599cfa['count']=_0x205d36;if(_0x3e2ea4[_0x356c('0x3c')][_0x356c('0xc3')]){_0xe89a87['include']=[{'all':!![]}];}return db[_0x356c('0xcc')][_0x356c('0xd1')](_0xe89a87);})[_0x356c('0x28')](function(_0x10ae2a){_0x599cfa[_0x356c('0xc1')]=_0x10ae2a;return _0x599cfa;});}})['then'](respondWithFilteredResult(_0x270aa4,_0xe89a87))[_0x356c('0x38')](handleError(_0x270aa4,null));};exports['addTags']=function(_0x1e068e,_0x38593e,_0x191c37){return db[_0x356c('0x33')][_0x356c('0x65')]({'where':{'id':_0x1e068e['params']['id']}})[_0x356c('0x28')](handleEntityNotFound(_0x38593e,null))[_0x356c('0x28')](function(_0xc96b13){if(_0xc96b13){return _0xc96b13[_0x356c('0xd2')](_0x1e068e[_0x356c('0xc7')][_0x356c('0xcd')],_[_0x356c('0xd3')](_0x1e068e[_0x356c('0xc7')],['ids','id'])||{})[_0x356c('0xd4')](function(){return db[_0x356c('0xd5')][_0x356c('0xd1')]({'attributes':['id',_0x356c('0x2b'),'color'],'where':{'id':_0x1e068e[_0x356c('0xc7')][_0x356c('0xcd')]}});})['then'](function(_0x177386){socket[_0x356c('0xd6')]('mailInteractionTags:save',{'id':Number(_0x1e068e[_0x356c('0xc8')]['id']),'tags':_0x177386||[]});return{'id':Number(_0x1e068e[_0x356c('0xc8')]['id']),'tags':_0x177386||[]};});}})[_0x356c('0x28')](respondWithResult(_0x38593e,null))['catch'](handleError(_0x38593e,null));};exports['removeTags']=function(_0x920305,_0x2ab791,_0x465aed){return db[_0x356c('0x33')][_0x356c('0x65')]({'where':{'id':_0x920305['params']['id']}})[_0x356c('0x28')](handleEntityNotFound(_0x2ab791,null))[_0x356c('0x28')](function(_0x126f6e){if(_0x126f6e){return _0x126f6e[_0x356c('0xd7')](_0x920305[_0x356c('0x3c')][_0x356c('0xcd')]);}})[_0x356c('0x28')](respondWithStatusCode(_0x2ab791,null))[_0x356c('0x38')](handleError(_0x2ab791,null));};exports[_0x356c('0xd8')]=function(_0x5533bb,_0x33a455){var _0xd91891=moment()[_0x356c('0xd9')]()[_0x356c('0x9e')]();var _0x1217f2=path[_0x356c('0xda')](config['root'],'server',_0x356c('0xdb'),_0x356c('0xdc'));var _0x212411=path['join'](config[_0x356c('0xdd')],_0x356c('0xde'),_0x356c('0xdb'),_0x356c('0xdf'));var _0x26fa21=path['join'](_0x1217f2,_0xd91891);var _0x1c1f66=util[_0x356c('0xe0')](_0x356c('0xe1'),_0x5533bb[_0x356c('0xc8')]['id'],_0xd91891);var _0x5861ba=path[_0x356c('0xda')](_0x1217f2,_0x1c1f66);var _0x69fce6=[];if(_0x5533bb['query'][_0x356c('0xdf')]){_0x69fce6[_0x356c('0x32')]({'model':db['Attachment'],'as':_0x356c('0xe2'),'raw':!![]});}var _0x2f0e4f=[{'model':db[_0x356c('0xcc')],'as':_0x356c('0xe3'),'attributes':['id','body',_0x356c('0x4e'),'to','cc',_0x356c('0xe4'),_0x356c('0xe5'),_0x356c('0x7d')],'where':{'secret':![]},'order':qs[_0x356c('0x48')]('id'),'include':_0x69fce6}];return db[_0x356c('0x33')][_0x356c('0x65')]({'where':{'id':_0x5533bb['params']['id']},'include':_0x2f0e4f})[_0x356c('0x28')](handleEntityNotFound(_0x33a455,null))[_0x356c('0x28')](function(_0x38d3dc){if(_0x38d3dc&&_0x38d3dc[_0x356c('0xe3')]){var _0x21f089=_0x38d3dc[_0x356c('0xe6')]({'plain':!![]});fs[_0x356c('0xe7')](_0x26fa21);return BPromise[_0x356c('0xe8')](_0x21f089['Messages'],function(_0x2a06c0,_0x56c578){var _0x3e0904={'from':_0x2a06c0['from'],'to':_0x2a06c0['to'],'subject':_0x2a06c0[_0x356c('0xe5')],'html':_0x2a06c0[_0x356c('0xc7')],'headers':{'Date':moment(_0x2a06c0[_0x356c('0x7d')])[_0x356c('0xe0')](_0x356c('0xe9'))},'attachments':[]};if(_0x2a06c0['cc']){_0x3e0904[_0x356c('0xea')]['Cc']=_0x2a06c0['cc'];}if(_0x2a06c0[_0x356c('0xe4')]){_0x3e0904[_0x356c('0xea')]['Bcc']=_0x2a06c0[_0x356c('0xe4')];}return new BPromise(function(_0x4097f4,_0x5098bb){if(_0x2a06c0[_0x356c('0xe2')]){for(var _0xec73e3=0x0;_0xec73e3<_0x2a06c0[_0x356c('0xe2')][_0x356c('0x43')];_0xec73e3++){var _0x3e2545=_0x2a06c0[_0x356c('0xe2')][_0xec73e3];var _0x2f81c0=path[_0x356c('0xda')](_0x212411,_0x3e2545[_0x356c('0xeb')]);if(fs['existsSync'](_0x2f81c0)){_0x3e0904[_0x356c('0xdf')][_0x356c('0x32')]({'name':_0x3e2545[_0x356c('0x2b')],'contentType':_0x3e2545[_0x356c('0x3b')],'data':fs[_0x356c('0xec')](_0x2f81c0)});}}}emlformat[_0x356c('0xed')](_0x3e0904,function(_0x470ade,_0x452c6a){if(_0x470ade)return _0x5098bb(_0x470ade);fs[_0x356c('0xee')](path['join'](_0x26fa21,util['format']('message%d.eml',_0x56c578)),_0x452c6a);return _0x4097f4(_0x452c6a);});});})[_0x356c('0x28')](function(){return new BPromise(function(_0x5c3dda,_0x52f537){zipdir(_0x26fa21,{'saveTo':_0x5861ba},function(_0x3774a3,_0x2019b8){if(_0x3774a3)return _0x52f537(_0x3774a3);return _0x5c3dda(_0x2019b8);});})[_0x356c('0x28')](function(){return new BPromise(function(_0x3a1367,_0x5bc232){rimraf(_0x26fa21,function(_0x1d1e1a){if(_0x1d1e1a)_0x5bc232(_0x1d1e1a);return _0x3a1367();});});})[_0x356c('0x28')](function(){return _0x33a455[_0x356c('0xd8')](_0x5861ba,_0x1c1f66,function(_0x2a3724){if(_0x2a3724){console[_0x356c('0xef')](_0x356c('0xf0'),_0x2a3724);}else{fs[_0x356c('0xf1')](_0x5861ba);}});});});}else{return _0x33a455['sendStatus'](0xc8);}})[_0x356c('0x38')](handleError(_0x33a455,null));}; \ No newline at end of file +var _0x7674=['findOne','lastMsgBody','lastMsgText','fromString','catch','index','fieldName','type','keys','query','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','mail_interactions','users','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','expr','parseSearch','search','sqlOperator','conditions','find','value','having','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','union','operator','UserId','buildExpression','start','plainBody','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','parse','$gte','$lte','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','t.id\x20IN\x20?','resolve','MailAccountId','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.subject','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','enableEmailPreview','push','rows','show','params','rawAttributes','filtears','intersection','include','create','update','body','destroy','describe','addMessage','MailMessage','omit','ids','getMessages','format','options','includeAll','findAll','setTags','spread','Tag','emit','mailInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','Attachment','Attachments','subject','createdAt','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','log','err','unlinkSync','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','redis','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','then','error','stack','name','send','map','fullname','Tags','split','forEach','TagIds','MailInteraction'];(function(_0x3d0880,_0x4822f5){var _0x1d69e2=function(_0xd72d50){while(--_0xd72d50){_0x3d0880['push'](_0x3d0880['shift']());}};_0x1d69e2(++_0x4822f5);}(_0x7674,0xbd));var _0x4767=function(_0x2a2799,_0x5e25a8){_0x2a2799=_0x2a2799-0x0;var _0x17f761=_0x7674[_0x2a2799];return _0x17f761;};'use strict';var pdf=require(_0x4767('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4767('0x1'));var jsonpatch=require(_0x4767('0x2'));var rp=require(_0x4767('0x3'));var moment=require(_0x4767('0x4'));var BPromise=require(_0x4767('0x5'));var Mustache=require(_0x4767('0x6'));var util=require(_0x4767('0x7'));var path=require(_0x4767('0x8'));var sox=require(_0x4767('0x9'));var csv=require('to-csv');var ejs=require(_0x4767('0xa'));var fs=require('fs');var _=require(_0x4767('0xb'));var squel=require(_0x4767('0xc'));var crypto=require(_0x4767('0xd'));var jsforce=require(_0x4767('0xe'));var deskjs=require(_0x4767('0xf'));var toCsv=require(_0x4767('0x10'));var querystring=require(_0x4767('0x11'));var Papa=require(_0x4767('0x12'));var htmlToText=require('html-to-text');var Redis=require(_0x4767('0x13'));var authService=require(_0x4767('0x14'));var qs=require(_0x4767('0x15'));var as=require(_0x4767('0x16'));var hardwareService=require(_0x4767('0x17'));var logger=require(_0x4767('0x18'))('api');var utils=require(_0x4767('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4767('0x1a')]=_['defaults'](config[_0x4767('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x4767('0x1b'))(new Redis(config['redis']));require(_0x4767('0x1c'))['register'](socket);function respondWithStatusCode(_0x596d0a,_0xfb3014){_0xfb3014=_0xfb3014||0xcc;return function(_0x487feb){if(_0x487feb){return _0x596d0a[_0x4767('0x1d')](_0xfb3014);}return _0x596d0a['status'](_0xfb3014)[_0x4767('0x1e')]();};}function respondWithResult(_0x56b010,_0x139f65){_0x139f65=_0x139f65||0xc8;return function(_0x33d0ae){if(_0x33d0ae){return _0x56b010[_0x4767('0x1f')](_0x139f65)[_0x4767('0x20')](_0x33d0ae);}};}function respondWithFilteredResult(_0x10560c,_0x5813fb){return function(_0x297308){if(_0x297308){var _0x1ca06b=_0x297308[_0x4767('0x21')],_0x283f90=_0x5813fb['offset'],_0x4725f4=_0x5813fb[_0x4767('0x22')]+_0x5813fb[_0x4767('0x23')],_0x4177af;if(_0x4725f4>=_0x1ca06b){_0x4725f4=_0x1ca06b;_0x4177af=0xc8;}else{_0x4177af=0xce;}_0x10560c[_0x4767('0x1f')](_0x4177af);return _0x10560c['set'](_0x4767('0x24'),_0x283f90+'-'+_0x4725f4+'/'+_0x1ca06b)[_0x4767('0x20')](_0x297308);}return null;};}function patchUpdates(_0x81f530){return function(_0x1562ab){try{jsonpatch[_0x4767('0x25')](_0x1562ab,_0x81f530,!![]);}catch(_0x4685a1){return BPromise[_0x4767('0x26')](_0x4685a1);}return _0x1562ab[_0x4767('0x27')]();};}function saveUpdates(_0x236346,_0x5e2830){return function(_0x484f36){if(_0x484f36){return _0x484f36['update'](_0x236346)['then'](function(_0x418fef){return _0x418fef;});}return null;};}function removeEntity(_0x55bc2c,_0x49c0b4){return function(_0x1bdbb0){if(_0x1bdbb0){return _0x1bdbb0['destroy']()[_0x4767('0x28')](function(){_0x55bc2c[_0x4767('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21dd23,_0x2c21af){return function(_0x3d6115){if(!_0x3d6115){_0x21dd23[_0x4767('0x1d')](0x194);}return _0x3d6115;};}function handleError(_0x1b7178,_0x54c39d){_0x54c39d=_0x54c39d||0x1f4;return function(_0x32604e){logger[_0x4767('0x29')](_0x32604e[_0x4767('0x2a')]);if(_0x32604e[_0x4767('0x2b')]){delete _0x32604e[_0x4767('0x2b')];}_0x1b7178[_0x4767('0x1f')](_0x54c39d)[_0x4767('0x2c')](_0x32604e);};}function getInteractionUsers(_0x4df333,_0x5a2d95){return new BPromise(function(_0x2090fe,_0x4466f0){try{if(_0x5a2d95[_0x4df333['id']]){_0x4df333['Users']=_[_0x4767('0x2d')](_0x5a2d95[_0x4df333['id']],function(_0x29a915){return{'id':_0x29a915['id'],'fullname':_0x29a915[_0x4767('0x2e')]};});}}catch(_0x130a97){_0x4466f0(_0x130a97);}_0x2090fe(_0x4df333);});}function getInteractionTags(_0x12751d,_0x5685e4){return new BPromise(function(_0xd75d9e,_0x46e51f){try{if(_0x12751d['TagIds']){_0x12751d[_0x4767('0x2f')]=[];_0x12751d['TagIds'][_0x4767('0x30')](',')[_0x4767('0x31')](function(_0x563586){_0x12751d[_0x4767('0x2f')]['push'](_0x5685e4[_0x563586]);});}delete _0x12751d[_0x4767('0x32')];}catch(_0x400707){_0x46e51f(_0x400707);}_0xd75d9e(_0x12751d);});}function getLastMessageText(_0x5a96b4){return new BPromise(function(_0x31f1f5,_0x5505c7){return db[_0x4767('0x33')][_0x4767('0x34')]({'where':{'id':_0x5a96b4['id']},'attributes':[_0x4767('0x35'),'lastMsgText'],'raw':!![]})[_0x4767('0x28')](function(_0x58fbd6){if(!_0x58fbd6['lastMsgText']){_0x5a96b4[_0x4767('0x36')]=_['trimStart'](htmlToText[_0x4767('0x37')](_0x58fbd6[_0x4767('0x35')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x5a96b4[_0x4767('0x36')]=_0x58fbd6[_0x4767('0x36')];}_0x31f1f5(_0x5a96b4);})[_0x4767('0x38')](function(_0x21b66d){_0x5505c7(_0x21b66d);});});}function updateMailInteraction(_0x3a7cd2,_0x371e71,_0x2b5382,_0x11465f){return new BPromise(function(_0xfde5d5,_0x4182d7){return getInteractionUsers(_0x3a7cd2,_0x2b5382)[_0x4767('0x28')](function(_0x1b5d82){return getInteractionTags(_0x1b5d82,_0x371e71);})['then'](function(_0x15f352){if(_0x11465f){_0xfde5d5(getLastMessageText(_0x15f352));}else{_0xfde5d5(_0x15f352);}})[_0x4767('0x38')](function(_0x5b1012){_0x4182d7(_0x5b1012);});});}exports[_0x4767('0x39')]=function(_0x111616,_0x287486){var _0x3d216e={},_0x320bb3={},_0x2ac119={'count':0x0,'rows':[]};var _0x18d875=_[_0x4767('0x2d')](db['MailInteraction']['rawAttributes'],function(_0x299d49){return{'name':_0x299d49[_0x4767('0x3a')],'type':_0x299d49[_0x4767('0x3b')]['key']};});_0x320bb3['model']=_[_0x4767('0x2d')](_0x18d875,_0x4767('0x2b'));_0x320bb3['query']=_[_0x4767('0x3c')](_0x111616[_0x4767('0x3d')]);_0x320bb3['filters']=_['intersection'](_0x320bb3[_0x4767('0x3e')],_0x320bb3[_0x4767('0x3d')]);_0x3d216e[_0x4767('0x3f')]=_['intersection'](_0x320bb3[_0x4767('0x3e')],qs[_0x4767('0x40')](_0x111616['query'][_0x4767('0x40')]));_0x3d216e['attributes']=_0x3d216e['attributes'][_0x4767('0x41')]?_0x3d216e[_0x4767('0x3f')]:_0x320bb3[_0x4767('0x3e')];if(!_0x111616[_0x4767('0x3d')][_0x4767('0x42')](_0x4767('0x43'))){_0x3d216e['limit']=qs['limit'](_0x111616[_0x4767('0x3d')]['limit']);_0x3d216e['offset']=qs[_0x4767('0x22')](_0x111616['query'][_0x4767('0x22')]);}_0x3d216e[_0x4767('0x44')]=qs[_0x4767('0x45')](_0x111616['query'][_0x4767('0x45')]);_0x3d216e[_0x4767('0x46')]=qs[_0x4767('0x47')](_[_0x4767('0x48')](_0x111616[_0x4767('0x3d')],_0x320bb3[_0x4767('0x47')]),_0x18d875);var _0x554e83=[];var _0x372f43=squel['select']()[_0x4767('0x49')]('id')[_0x4767('0x49')](_0x4767('0x2b'))[_0x4767('0x49')](_0x4767('0x4a'))[_0x4767('0x4b')](_0x4767('0x4c'));var _0xae73df=squel[_0x4767('0x4d')]()['field'](_0x4767('0x4e'))['field'](_0x4767('0x4f'))[_0x4767('0x49')](_0x4767('0x50'))[_0x4767('0x4b')](_0x4767('0x51'),'ui')[_0x4767('0x52')]('users','u',_0x4767('0x53'));var _0x16d0f9=squel[_0x4767('0x4d')]()['from'](_0x4767('0x54'),'i')[_0x4767('0x52')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4767('0x52')](_0x4767('0x55'),'o',_0x4767('0x56'))[_0x4767('0x52')](_0x4767('0x57'),'a',_0x4767('0x58'))[_0x4767('0x52')](_0x4767('0x59'),'me',_0x4767('0x5a'))[_0x4767('0x52')](_0x4767('0x5b'),'it','it.MailInteractionId\x20=\x20i.id')[_0x4767('0x52')](_0x4767('0x4c'),'t','t.id\x20=\x20it.TagId');var _0xd67382=squel['expr']();var _0x5125e2=[];var _0x444c74=squel[_0x4767('0x5c')]();var _0x23292e;if(_0x111616['query']['search']){_0x23292e=as[_0x4767('0x5d')](_0x111616[_0x4767('0x3d')][_0x4767('0x5e')]);var _0x564791=_0x23292e[_0x4767('0x5f')];for(var _0x50937f=0x0;_0x50937f<_0x23292e[_0x4767('0x60')][_0x4767('0x41')];_0x50937f++){var _0x1b6272=_0x23292e[_0x4767('0x60')][_0x50937f];var _0x4a9469='i';var _0x53e83a=_[_0x4767('0x61')](_0x18d875,[_0x4767('0x2b'),_0x1b6272['field']]);if(!_0x53e83a){switch(_0x1b6272[_0x4767('0x49')]){case'unreadMessages':if(_0x1b6272[_0x4767('0x62')]==0x1){_0x16d0f9[_0x4767('0x63')]('`'+_0x1b6272[_0x4767('0x49')]+'`\x20=\x200');}else{_0x16d0f9['having']('`'+_0x1b6272[_0x4767('0x49')]+'`\x20>\x200');}break;case _0x4767('0x64'):if(_0x1b6272['operator']===_0x4767('0x65')){if(_0x1b6272[_0x4767('0x62')][_0x4767('0x30')]('\x20')[_0x4767('0x41')]>0x1){_0xd67382[_0x564791](_0x4767('0x66'),qs[_0x4767('0x67')](_0x1b6272[_0x4767('0x62')]),null);}else{var _0x1a5abb='%'+_0x1b6272[_0x4767('0x62')]+'%';_0xd67382[_0x564791]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1a5abb,_0x1a5abb,_0x1a5abb);}}else{_0x53e83a=_[_0x4767('0x61')](_0x18d875,[_0x4767('0x2b'),_0x4767('0x68')]);_0x1b6272[_0x4767('0x49')]='ContactId';_0x3ac90b=as['buildExpression'](_0x4a9469,_0x53e83a[_0x4767('0x3b')],_0x1b6272);_0xd67382[_0x564791](_0x3ac90b[_0x4767('0x69')],_0x3ac90b['value']['start'],_0x3ac90b[_0x4767('0x62')][_0x4767('0x1e')]);}break;case'Tag':var _0x26392f=_0x1b6272[_0x4767('0x62')]['split'](',')[_0x4767('0x2d')](function(_0x36916b){return Number(_0x36916b);});_0x26392f[_0x4767('0x31')](function(_0x36ccd1){_0x444c74['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x36ccd1+',%');});_0x5125e2=_[_0x4767('0x6a')](_0x5125e2,_0x26392f);break;case'User':if(_0x1b6272[_0x4767('0x6b')]===_0x4767('0x65')){_0xd67382[_0x564791]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1b6272[_0x4767('0x62')]+'%',null);}else{_0x53e83a=_['find'](_0x18d875,[_0x4767('0x2b'),_0x4767('0x6c')]);_0x1b6272[_0x4767('0x49')]=_0x4767('0x6c');_0x3ac90b=as[_0x4767('0x6d')](_0x4a9469,_0x53e83a[_0x4767('0x3b')],_0x1b6272);_0xd67382[_0x564791](_0x3ac90b[_0x4767('0x69')],_0x3ac90b[_0x4767('0x62')][_0x4767('0x6e')],_0x3ac90b[_0x4767('0x62')]['end']);}break;case _0x4767('0x6f'):_0x3ac90b=as[_0x4767('0x6d')]('me',null,_0x1b6272);_0xd67382[_0x564791](_0x3ac90b[_0x4767('0x69')],_0x3ac90b[_0x4767('0x62')][_0x4767('0x6e')],_0x3ac90b[_0x4767('0x62')][_0x4767('0x1e')]);break;}}else{var _0x3ac90b=as[_0x4767('0x6d')](_0x4a9469,_0x53e83a[_0x4767('0x3b')],_0x1b6272);_0xd67382[_0x564791](_0x3ac90b[_0x4767('0x69')],_0x3ac90b['value'][_0x4767('0x6e')],_0x3ac90b['value'][_0x4767('0x1e')]);}}}else{var _0x2113bc=_(_0x111616[_0x4767('0x3d')])['keys']()[_0x4767('0x2d')](function(_0xc8ed71){return _[_0x4767('0x70')](_0x18d875,[_0x4767('0x2b'),_0xc8ed71])?_0xc8ed71:undefined;})[_0x4767('0x71')]()['value']();if(!_[_0x4767('0x72')](_0x2113bc)){_0x2113bc[_0x4767('0x31')](function(_0x38ea92){if(_0x38ea92==='MailAccountId'){_0x16d0f9[_0x4767('0x46')](_0x4767('0x73'),[][_0x4767('0x74')](_0x111616[_0x4767('0x3d')][_0x38ea92]));}else if(_0x38ea92==='createdAt'){var _0x2b455a=JSON[_0x4767('0x75')](_0x111616[_0x4767('0x3d')][_0x38ea92])[_0x4767('0x76')];var _0x4646be=JSON[_0x4767('0x75')](_0x111616[_0x4767('0x3d')][_0x38ea92])[_0x4767('0x77')];_0x16d0f9['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b455a,_0x4646be);}else{if(_0x111616['query'][_0x38ea92]===_0x4767('0x78')){_0x16d0f9[_0x4767('0x46')]('i.'+_0x38ea92+'\x20IS\x20NULL');}else{_0x16d0f9[_0x4767('0x46')]('i.'+_0x38ea92+'\x20=\x20?',_0x111616[_0x4767('0x3d')][_0x38ea92]);}}});}if(_0x111616[_0x4767('0x3d')][_0x4767('0x79')]){if(_0x111616[_0x4767('0x3d')]['read']==0x1){_0x16d0f9[_0x4767('0x63')](_0x4767('0x7a'));}else{_0x16d0f9[_0x4767('0x63')](_0x4767('0x7b'));}}if(_0x111616[_0x4767('0x3d')][_0x4767('0x7c')]){_0x5125e2=_[_0x4767('0x7d')](_0x111616[_0x4767('0x3d')][_0x4767('0x7c')])?_0x111616[_0x4767('0x3d')]['tag']:new Array(_0x111616['query'][_0x4767('0x7c')]);_0x5125e2[_0x4767('0x31')](function(_0x40b4da){_0x444c74['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x40b4da+',%');});}if(_0x111616[_0x4767('0x3d')]['filter']){var _0x334dbf=_0x111616[_0x4767('0x3d')]['filter'][_0x4767('0x7e')]('\x5c','\x5c\x5c')[_0x4767('0x7e')]('\x27\x27',_0x4767('0x7f'));if(qs[_0x4767('0x80')](_0x334dbf)){_0xd67382['or'](_0x4767('0x81'),_0x334dbf+'%');}else if(qs[_0x4767('0x82')](_0x334dbf)){_0xd67382['or'](_0x4767('0x83'),_0x334dbf+'%');}else{_0xd67382['or'](_0x4767('0x84'),qs['getFullTextValue'](_0x334dbf))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4767('0x67')](_0x334dbf));}}}_0x16d0f9[_0x4767('0x46')](_0xd67382);_0x16d0f9[_0x4767('0x85')](_0x4767('0x86'));var _0x939ee2={'type':db[_0x4767('0x87')][_0x4767('0x88')][_0x4767('0x89')],'raw':!![]};var _0x5cf5c1=_0x16d0f9[_0x4767('0x8a')]();_0x5cf5c1['field'](_0x4767('0x86'));_0x5cf5c1[_0x4767('0x49')](_0x4767('0x8b'),_0x4767('0x8c'));if(_0x3d216e['order']){_0x3d216e[_0x4767('0x44')][_0x4767('0x31')](function(_0x24f95d){_0x16d0f9[_0x4767('0x44')]('i.'+_0x24f95d[0x0],_0x24f95d[0x1]==='DESC'?![]:!![]);});}if(!_[_0x4767('0x72')](_0x5125e2)){_0x16d0f9[_0x4767('0x63')](_0x444c74);_0x5cf5c1[_0x4767('0x46')](_0x4767('0x8d'),_0x5125e2);}BPromise[_0x4767('0x8e')]()[_0x4767('0x28')](function(){if(!_0x23292e){if(_0x111616['query'][_0x4767('0x8f')]||_0x111616[_0x4767('0x3d')][_0x4767('0x90')])return;_0x5cf5c1[_0x4767('0x46')](_0x4767('0x91'));_0x16d0f9[_0x4767('0x46')](_0x4767('0x91'));return;}return _0x111616[_0x4767('0x92')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0x4767('0x28')](function(_0x40ec68){if(_['isEmpty'](_0x40ec68)){_0x5cf5c1[_0x4767('0x46')](_0x4767('0x93'));_0x16d0f9[_0x4767('0x46')](_0x4767('0x93'));}else{_0x5cf5c1['where'](_0x4767('0x73'),_['map'](_0x40ec68,'id'));_0x16d0f9[_0x4767('0x46')](_0x4767('0x73'),_['map'](_0x40ec68,'id'));}});})[_0x4767('0x28')](function(){db[_0x4767('0x94')][_0x4767('0x3d')](_0x5cf5c1[_0x4767('0x95')](),_0x939ee2)[_0x4767('0x28')](function(_0x40a5d6){_0x2ac119[_0x4767('0x21')]=_0x40a5d6[_0x4767('0x41')];if(_0x2ac119[_0x4767('0x21')]===0x0)return[];return db[_0x4767('0x94')][_0x4767('0x3d')](_0x372f43[_0x4767('0x95')](),_0x939ee2)[_0x4767('0x28')](function(_0x1be556){_0x554e83=_[_0x4767('0x96')](_0x1be556,'id');_0x939ee2=_[_0x4767('0x97')](_0x939ee2,{'model':db[_0x4767('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x111616[_0x4767('0x3d')][_0x4767('0x40')]){_0x3d216e['attributes'][_0x4767('0x31')](function(_0x29c18c){_0x16d0f9[_0x4767('0x49')]('i.'+_0x29c18c);});}else{_0x16d0f9[_0x4767('0x49')](_0x4767('0x8b'),_0x4767('0x8c'));_0x16d0f9['field'](_0x4767('0x98'),_0x4767('0x99'));_0x16d0f9[_0x4767('0x49')](_0x4767('0x9a'),_0x4767('0x9b'));_0x16d0f9[_0x4767('0x49')](_0x4767('0x86'));_0x16d0f9[_0x4767('0x49')](_0x4767('0x9c'));_0x16d0f9[_0x4767('0x49')](_0x4767('0x9d'));_0x16d0f9[_0x4767('0x49')](_0x4767('0x9e'));_0x16d0f9['field'](_0x4767('0x9f'));_0x16d0f9['field']('i.attach');_0x16d0f9[_0x4767('0x49')]('i.lastMsgAt');_0x16d0f9[_0x4767('0x49')]('i.lastMsgDirection');_0x16d0f9['field'](_0x4767('0xa0'));_0x16d0f9[_0x4767('0x49')]('i.disposition');_0x16d0f9[_0x4767('0x49')](_0x4767('0xa1'));_0x16d0f9['field'](_0x4767('0xa2'));_0x16d0f9[_0x4767('0x49')](_0x4767('0xa3'));_0x16d0f9[_0x4767('0x49')](_0x4767('0xa4'));_0x16d0f9[_0x4767('0x49')](_0x4767('0xa5'));_0x16d0f9[_0x4767('0x49')]('i.MailAccountId');_0x16d0f9[_0x4767('0x49')](_0x4767('0xa6'));_0x16d0f9[_0x4767('0x49')](_0x4767('0xa7'),_0x4767('0xa8'));_0x16d0f9[_0x4767('0x49')](_0x4767('0xa9'),_0x4767('0xaa'));_0x16d0f9['field']('c.email',_0x4767('0xab'));_0x16d0f9[_0x4767('0x49')](_0x4767('0xac'),'Contact.phone');_0x16d0f9['field'](_0x4767('0xad'),_0x4767('0xae'));_0x16d0f9[_0x4767('0x49')](_0x4767('0xaf'),_0x4767('0xb0'));_0x16d0f9['field'](_0x4767('0xb1'),'Owner.fullname');_0x16d0f9['field'](_0x4767('0xb2'),_0x4767('0xb3'));_0x16d0f9[_0x4767('0x49')](_0x4767('0xb4'),_0x4767('0x32'));}if(_0x3d216e[_0x4767('0x23')])_0x16d0f9[_0x4767('0x23')](_0x3d216e['limit']);if(_0x3d216e[_0x4767('0x22')])_0x16d0f9[_0x4767('0x22')](_0x3d216e[_0x4767('0x22')]);return db[_0x4767('0x94')][_0x4767('0x3d')](_0x16d0f9[_0x4767('0x95')](),_0x939ee2);})[_0x4767('0x28')](function(_0x5c499e){_0xae73df[_0x4767('0x46')](_0x4767('0xb5'),_[_0x4767('0x2d')](_0x5c499e,'id'));return db['sequelize']['query'](_0xae73df['toString'](),_0x939ee2)['then'](function(_0x47e9d8){var _0x1f6d89=_[_0x4767('0xb6')](_0x47e9d8,_0x4767('0xb7'));var _0x2361eb=[];return db['Setting']['findOne']({'attributes':[_0x4767('0xb8')],'raw':!![]})[_0x4767('0x28')](function(_0x24eb49){var _0x1caeed=_0x24eb49[_0x4767('0xb8')];_0x5c499e[_0x4767('0x31')](function(_0x1b8ced){_0x2361eb[_0x4767('0xb9')](updateMailInteraction(_0x1b8ced,_0x554e83,_0x1f6d89,_0x1caeed));});return BPromise['all'](_0x2361eb);});});});})[_0x4767('0x28')](function(_0x918f8b){_0x2ac119[_0x4767('0xba')]=_0x918f8b;return _0x2ac119;})['then'](respondWithFilteredResult(_0x287486,_0x3d216e));})[_0x4767('0x38')](handleError(_0x287486,null));};exports[_0x4767('0xbb')]=function(_0x2c56e2,_0x151225){var _0x175611={'raw':![],'where':{'id':_0x2c56e2[_0x4767('0xbc')]['id']}},_0x2ccc8c={};_0x2ccc8c[_0x4767('0x3e')]=_[_0x4767('0x3c')](db['MailInteraction'][_0x4767('0xbd')]);_0x2ccc8c[_0x4767('0x3d')]=_[_0x4767('0x3c')](_0x2c56e2[_0x4767('0x3d')]);_0x2ccc8c[_0x4767('0xbe')]=_[_0x4767('0xbf')](_0x2ccc8c[_0x4767('0x3e')],_0x2ccc8c[_0x4767('0x3d')]);_0x175611['attributes']=_[_0x4767('0xbf')](_0x2ccc8c[_0x4767('0x3e')],qs[_0x4767('0x40')](_0x2c56e2[_0x4767('0x3d')][_0x4767('0x40')]));_0x175611[_0x4767('0x3f')]=_0x175611['attributes'][_0x4767('0x41')]?_0x175611[_0x4767('0x3f')]:_0x2ccc8c['model'];if(_0x2c56e2['query']['includeAll']){_0x175611[_0x4767('0xc0')]=[{'all':!![]}];}_0x175611=_[_0x4767('0x97')]({},_0x175611,_0x2c56e2['options']);return db[_0x4767('0x33')][_0x4767('0x61')](_0x175611)[_0x4767('0x28')](handleEntityNotFound(_0x151225,null))[_0x4767('0x28')](respondWithResult(_0x151225,null))[_0x4767('0x38')](handleError(_0x151225,null));};exports[_0x4767('0xc1')]=function(_0x4aaefb,_0x1b20e6){return db[_0x4767('0x33')][_0x4767('0xc1')](_0x4aaefb['body'],{})[_0x4767('0x28')](respondWithResult(_0x1b20e6,0xc9))[_0x4767('0x38')](handleError(_0x1b20e6,null));};exports[_0x4767('0xc2')]=function(_0x806924,_0x5c472d){if(_0x806924[_0x4767('0xc3')]['id']){delete _0x806924[_0x4767('0xc3')]['id'];}return db['MailInteraction'][_0x4767('0x61')]({'where':{'id':_0x806924['params']['id']}})['then'](handleEntityNotFound(_0x5c472d,null))['then'](saveUpdates(_0x806924[_0x4767('0xc3')],null))[_0x4767('0x28')](respondWithResult(_0x5c472d,null))[_0x4767('0x38')](handleError(_0x5c472d,null));};exports[_0x4767('0xc4')]=function(_0x77b960,_0xf2f020){return db[_0x4767('0x33')]['find']({'where':{'id':_0x77b960['params']['id']}})[_0x4767('0x28')](handleEntityNotFound(_0xf2f020,null))[_0x4767('0x28')](removeEntity(_0xf2f020,null))[_0x4767('0x38')](handleError(_0xf2f020,null));};exports[_0x4767('0xc5')]=function(_0x41902d,_0x15410c){return db['MailInteraction'][_0x4767('0xc5')]()[_0x4767('0x28')](respondWithResult(_0x15410c,null))[_0x4767('0x38')](handleError(_0x15410c,null));};exports[_0x4767('0xc6')]=function(_0x239053,_0x203a40,_0x35f68f){return db[_0x4767('0xc7')][_0x4767('0x61')]({'where':{'id':_0x239053[_0x4767('0xbc')]['id']}})[_0x4767('0x28')](handleEntityNotFound(_0x203a40,null))['then'](function(_0x26fb7e){if(_0x26fb7e){return _0x26fb7e[_0x4767('0xc6')](_0x239053[_0x4767('0xc3')]['ids'],_[_0x4767('0xc8')](_0x239053[_0x4767('0xc3')],[_0x4767('0xc9'),'id'])||{});}})[_0x4767('0x28')](respondWithResult(_0x203a40,null))[_0x4767('0x38')](handleError(_0x203a40,null));};exports[_0x4767('0xca')]=function(_0x41ca5b,_0x1cde7a,_0x201666){var _0x561510={'raw':![],'where':{}};var _0x1baa95={};var _0x15b638={'count':0x0,'rows':[]};return db[_0x4767('0x33')][_0x4767('0x34')]({'where':{'id':_0x41ca5b[_0x4767('0xbc')]['id']}})[_0x4767('0x28')](handleEntityNotFound(_0x1cde7a,null))[_0x4767('0x28')](function(_0x94a927){if(_0x94a927){_0x1baa95[_0x4767('0x3e')]=_[_0x4767('0x3c')](db[_0x4767('0xc7')][_0x4767('0xbd')]);_0x1baa95[_0x4767('0x3d')]=_['keys'](_0x41ca5b[_0x4767('0x3d')]);_0x1baa95[_0x4767('0x47')]=_['intersection'](_0x1baa95[_0x4767('0x3e')],_0x1baa95[_0x4767('0x3d')]);_0x561510[_0x4767('0x3f')]=_[_0x4767('0xbf')](_0x1baa95[_0x4767('0x3e')],qs['fields'](_0x41ca5b[_0x4767('0x3d')][_0x4767('0x40')]));_0x561510[_0x4767('0x3f')]=_0x561510[_0x4767('0x3f')]['length']?_0x561510[_0x4767('0x3f')]:_0x1baa95[_0x4767('0x3e')];if(!_0x41ca5b[_0x4767('0x3d')][_0x4767('0x42')](_0x4767('0x43'))){_0x561510[_0x4767('0x23')]=qs['limit'](_0x41ca5b[_0x4767('0x3d')]['limit']);_0x561510[_0x4767('0x22')]=qs[_0x4767('0x22')](_0x41ca5b[_0x4767('0x3d')][_0x4767('0x22')]);}_0x561510[_0x4767('0x44')]=qs[_0x4767('0x45')](_0x41ca5b[_0x4767('0x3d')][_0x4767('0x45')]);_0x561510['where']=qs[_0x4767('0x47')](_[_0x4767('0x48')](_0x41ca5b[_0x4767('0x3d')],_0x1baa95['filters']));_0x561510[_0x4767('0x46')]['MailInteractionId']=_0x94a927['id'];if(_0x41ca5b[_0x4767('0x3d')]['filter']){_0x561510[_0x4767('0x46')]=_[_0x4767('0x97')](_0x561510['where'],{'$or':_['map'](_0x561510[_0x4767('0x3f')],function(_0x338e14){var _0x3d0f25={};_0x3d0f25[_0x338e14]={'$like':'%'+_0x41ca5b[_0x4767('0x3d')]['filter']+'%'};return _0x3d0f25;})});}if(_0x41ca5b[_0x4767('0x3d')]['$gte']){var _0x16104d=_0x41ca5b[_0x4767('0x3d')]['$gte'][_0x4767('0x30')](',');var _0x4d0a80={};_0x4d0a80[_0x16104d[0x0]]={'$gte':moment(_0x16104d[0x1])[_0x4767('0xcb')]('YYYY-MM-DD\x20HH:mm:ss')};_0x561510['where']=_[_0x4767('0x97')](_0x561510['where'],_0x4d0a80);}_0x561510=_['merge']({},_0x561510,_0x41ca5b[_0x4767('0xcc')]);return db[_0x4767('0xc7')]['count']({'where':_0x561510[_0x4767('0x46')]})[_0x4767('0x28')](function(_0x390a7f){_0x15b638[_0x4767('0x21')]=_0x390a7f;if(_0x41ca5b[_0x4767('0x3d')][_0x4767('0xcd')]){_0x561510[_0x4767('0xc0')]=[{'all':!![]}];}return db[_0x4767('0xc7')][_0x4767('0xce')](_0x561510);})['then'](function(_0x3f56bd){_0x15b638[_0x4767('0xba')]=_0x3f56bd;return _0x15b638;});}})[_0x4767('0x28')](respondWithFilteredResult(_0x1cde7a,_0x561510))[_0x4767('0x38')](handleError(_0x1cde7a,null));};exports['addTags']=function(_0x1ac9ec,_0x2bcffa,_0x11d07c){return db['MailInteraction']['find']({'where':{'id':_0x1ac9ec[_0x4767('0xbc')]['id']}})['then'](handleEntityNotFound(_0x2bcffa,null))[_0x4767('0x28')](function(_0x22aa56){if(_0x22aa56){return _0x22aa56[_0x4767('0xcf')](_0x1ac9ec[_0x4767('0xc3')][_0x4767('0xc9')],_[_0x4767('0xc8')](_0x1ac9ec[_0x4767('0xc3')],[_0x4767('0xc9'),'id'])||{})[_0x4767('0xd0')](function(){return db[_0x4767('0xd1')][_0x4767('0xce')]({'attributes':['id',_0x4767('0x2b'),_0x4767('0x4a')],'where':{'id':_0x1ac9ec['body'][_0x4767('0xc9')]}});})['then'](function(_0x5e44e7){socket[_0x4767('0xd2')](_0x4767('0xd3'),{'id':Number(_0x1ac9ec[_0x4767('0xbc')]['id']),'tags':_0x5e44e7||[]});return{'id':Number(_0x1ac9ec['params']['id']),'tags':_0x5e44e7||[]};});}})[_0x4767('0x28')](respondWithResult(_0x2bcffa,null))[_0x4767('0x38')](handleError(_0x2bcffa,null));};exports[_0x4767('0xd4')]=function(_0x427b8c,_0x316d19,_0x553462){return db[_0x4767('0x33')][_0x4767('0x61')]({'where':{'id':_0x427b8c[_0x4767('0xbc')]['id']}})['then'](handleEntityNotFound(_0x316d19,null))[_0x4767('0x28')](function(_0x349093){if(_0x349093){return _0x349093[_0x4767('0xd4')](_0x427b8c['query']['ids']);}})['then'](respondWithStatusCode(_0x316d19,null))[_0x4767('0x38')](handleError(_0x316d19,null));};exports[_0x4767('0xd5')]=function(_0x26b23b,_0x5a0ce6){var _0x3207f0=moment()['unix']()[_0x4767('0x95')]();var _0x2f6eec=path[_0x4767('0xd6')](config[_0x4767('0xd7')],_0x4767('0xd8'),_0x4767('0xd9'),_0x4767('0xda'));var _0x332434=path[_0x4767('0xd6')](config[_0x4767('0xd7')],'server',_0x4767('0xd9'),'attachments');var _0x1605f4=path['join'](_0x2f6eec,_0x3207f0);var _0x11c8a0=util['format']('transcript-%d-%s.zip',_0x26b23b['params']['id'],_0x3207f0);var _0xb1d82f=path['join'](_0x2f6eec,_0x11c8a0);var _0x5909d4=[];if(_0x26b23b[_0x4767('0x3d')][_0x4767('0xdb')]){_0x5909d4[_0x4767('0xb9')]({'model':db[_0x4767('0xdc')],'as':_0x4767('0xdd'),'raw':!![]});}var _0xe479d5=[{'model':db[_0x4767('0xc7')],'as':'Messages','attributes':['id',_0x4767('0xc3'),_0x4767('0x4b'),'to','cc','bcc',_0x4767('0xde'),_0x4767('0xdf')],'where':{'secret':![]},'order':qs[_0x4767('0x45')]('id'),'include':_0x5909d4}];return db['MailInteraction']['find']({'where':{'id':_0x26b23b['params']['id']},'include':_0xe479d5})[_0x4767('0x28')](handleEntityNotFound(_0x5a0ce6,null))[_0x4767('0x28')](function(_0x4d1b6a){if(_0x4d1b6a&&_0x4d1b6a[_0x4767('0xe0')]){var _0x13cb5a=_0x4d1b6a[_0x4767('0xe1')]({'plain':!![]});fs[_0x4767('0xe2')](_0x1605f4);return BPromise[_0x4767('0xe3')](_0x13cb5a[_0x4767('0xe0')],function(_0x3d086c,_0x23c6fb){var _0x56d577={'from':_0x3d086c[_0x4767('0x4b')],'to':_0x3d086c['to'],'subject':_0x3d086c[_0x4767('0xde')],'html':_0x3d086c[_0x4767('0xc3')],'headers':{'Date':moment(_0x3d086c['createdAt'])[_0x4767('0xcb')](_0x4767('0xe4'))},'attachments':[]};if(_0x3d086c['cc']){_0x56d577[_0x4767('0xe5')]['Cc']=_0x3d086c['cc'];}if(_0x3d086c[_0x4767('0xe6')]){_0x56d577[_0x4767('0xe5')][_0x4767('0xe7')]=_0x3d086c['bcc'];}return new BPromise(function(_0x224c8c,_0x16a328){if(_0x3d086c[_0x4767('0xdd')]){for(var _0x38ca2e=0x0;_0x38ca2e<_0x3d086c[_0x4767('0xdd')]['length'];_0x38ca2e++){var _0x4828a0=_0x3d086c[_0x4767('0xdd')][_0x38ca2e];var _0x5e08bb=path['join'](_0x332434,_0x4828a0[_0x4767('0xe8')]);if(fs[_0x4767('0xe9')](_0x5e08bb)){_0x56d577['attachments'][_0x4767('0xb9')]({'name':_0x4828a0[_0x4767('0x2b')],'contentType':_0x4828a0[_0x4767('0x3b')],'data':fs[_0x4767('0xea')](_0x5e08bb)});}}}emlformat[_0x4767('0xeb')](_0x56d577,function(_0x6f14ab,_0x4d71f4){if(_0x6f14ab)return _0x16a328(_0x6f14ab);fs[_0x4767('0xec')](path[_0x4767('0xd6')](_0x1605f4,util[_0x4767('0xcb')](_0x4767('0xed'),_0x23c6fb)),_0x4d71f4);return _0x224c8c(_0x4d71f4);});});})['then'](function(){return new BPromise(function(_0x4d8db6,_0x5ee003){zipdir(_0x1605f4,{'saveTo':_0xb1d82f},function(_0x531c4a,_0x558c74){if(_0x531c4a)return _0x5ee003(_0x531c4a);return _0x4d8db6(_0x558c74);});})[_0x4767('0x28')](function(){return new BPromise(function(_0xa627ff,_0x2aae24){rimraf(_0x1605f4,function(_0x16ca1a){if(_0x16ca1a)_0x2aae24(_0x16ca1a);return _0xa627ff();});});})['then'](function(){return _0x5a0ce6[_0x4767('0xd5')](_0xb1d82f,_0x11c8a0,function(_0x474a6e){if(_0x474a6e){console[_0x4767('0xee')](_0x4767('0xef'),_0x474a6e);}else{fs[_0x4767('0xf0')](_0xb1d82f);}});});});}else{return _0x5a0ce6[_0x4767('0x1d')](0xc8);}})['catch'](handleError(_0x5a0ce6,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 1e06cf3..59e6ead 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 _0x2f06=['MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction'];(function(_0x5309ff,_0x31aef9){var _0x5b3464=function(_0x1bb090){while(--_0x1bb090){_0x5309ff['push'](_0x5309ff['shift']());}};_0x5b3464(++_0x31aef9);}(_0x2f06,0xd9));var _0x62f0=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2f06[_0x1ac595];return _0x455fff;};'use strict';var EventEmitter=require(_0x62f0('0x0'));var MailInteraction=require(_0x62f0('0x1'))['db'][_0x62f0('0x2')];var MailMessage=require(_0x62f0('0x1'))['db'][_0x62f0('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x62f0('0x4')](0x0);var events={'afterCreate':_0x62f0('0x5'),'afterUpdate':_0x62f0('0x6'),'afterDestroy':_0x62f0('0x7')};function emitEvent(_0x53e673){return function(_0x231b1e,_0x3af55e,_0x835604){_0x231b1e[_0x62f0('0x8')]({'attributes':['id'],'raw':!![]})[_0x62f0('0x9')](function(_0x3ccd9e){_0x231b1e[_0x62f0('0xa')](_0x62f0('0xb'),_0x3ccd9e[_0x62f0('0xc')](function(_0x53badc){return{'id':_0x53badc['id']};}));return MailMessage[_0x62f0('0xd')]({'where':{'MailInteractionId':_0x231b1e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x62f0('0x9')](function(_0x23c543){_0x231b1e[_0x62f0('0xa')]('unreadMessages',_0x23c543[_0x62f0('0xe')]);MailInteractionEvents[_0x62f0('0xf')](_0x53e673+':'+_0x231b1e['id'],_0x231b1e);MailInteractionEvents[_0x62f0('0xf')](_0x53e673,_0x231b1e);_0x835604(null);})[_0x62f0('0x10')](_0x835604(null));};}for(var e in events){if(events[_0x62f0('0x11')](e)){var event=events[e];MailInteraction[_0x62f0('0x12')](e,emitEvent(event));}}module[_0x62f0('0x13')]=MailInteractionEvents; \ No newline at end of file +var _0x6d4f=['exports','events','../../mysqldb','MailMessage','save','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','catch','hook'];(function(_0x3eb630,_0x552586){var _0x1b840d=function(_0x2594a8){while(--_0x2594a8){_0x3eb630['push'](_0x3eb630['shift']());}};_0x1b840d(++_0x552586);}(_0x6d4f,0x100));var _0xf6d4=function(_0x5b5199,_0x58a8e5){_0x5b5199=_0x5b5199-0x0;var _0x2f5736=_0x6d4f[_0x5b5199];return _0x2f5736;};'use strict';var EventEmitter=require(_0xf6d4('0x0'));var MailInteraction=require(_0xf6d4('0x1'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0xf6d4('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf6d4('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x32bdb9){return function(_0x49cb50,_0x2ab279,_0x222d68){_0x49cb50[_0xf6d4('0x4')]({'attributes':['id'],'raw':!![]})[_0xf6d4('0x5')](function(_0x1fbc31){_0x49cb50['setDataValue'](_0xf6d4('0x6'),_0x1fbc31['map'](function(_0x213824){return{'id':_0x213824['id']};}));return MailMessage[_0xf6d4('0x7')]({'where':{'MailInteractionId':_0x49cb50['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf6d4('0x5')](function(_0x5783e3){_0x49cb50[_0xf6d4('0x8')](_0xf6d4('0x9'),_0x5783e3[_0xf6d4('0xa')]);MailInteractionEvents[_0xf6d4('0xb')](_0x32bdb9+':'+_0x49cb50['id'],_0x49cb50);MailInteractionEvents[_0xf6d4('0xb')](_0x32bdb9,_0x49cb50);_0x222d68(null);})[_0xf6d4('0xc')](_0x222d68(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xf6d4('0xd')](e,emitEvent(event));}}module[_0xf6d4('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index d9f205c..3bce3f8 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 _0xf403=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','MailInteraction','fti_mail_interactions','format','YYYY-MM-DD\x20HH:mm:ss','closed','substatus','substatusAt','changed','closedAt','models','get','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xf403,0x1d3));var _0x3f40=function(_0x3af74d,_0x1e7e2d){_0x3af74d=_0x3af74d-0x0;var _0x3811a7=_0xf403[_0x3af74d];return _0x3811a7;};'use strict';var _=require(_0x3f40('0x0'));var util=require('util');var logger=require(_0x3f40('0x1'))(_0x3f40('0x2'));var moment=require(_0x3f40('0x3'));var BPromise=require(_0x3f40('0x4'));var rp=require(_0x3f40('0x5'));var fs=require('fs');var path=require(_0x3f40('0x6'));var rimraf=require(_0x3f40('0x7'));var config=require(_0x3f40('0x8'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x33f742,_0x22d5e6){return _0x33f742[_0x3f40('0x9')](_0x3f40('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x3f40('0xb'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x26fc90,_0xb4a314,_0x40d198){if(_0x26fc90['substatus']){_0x26fc90['substatusAt']=moment()[_0x3f40('0xc')](_0x3f40('0xd'));}if(_0x26fc90[_0x3f40('0xe')]){_0x26fc90['closedAt']=moment()[_0x3f40('0xc')](_0x3f40('0xd'));}_0x40d198(null,_0xb4a314);},'beforeUpdate':function(_0x196db3,_0x5b54cf,_0x332635){if(_0x196db3['changed'](_0x3f40('0xf'))){_0x196db3[_0x3f40('0x10')]=_0x196db3[_0x3f40('0xf')]?moment()[_0x3f40('0xc')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x196db3[_0x3f40('0x11')](_0x3f40('0xe'))){_0x196db3[_0x3f40('0x12')]=moment()[_0x3f40('0xc')](_0x3f40('0xd'));_0x196db3['substatus']=null;_0x196db3[_0x3f40('0x10')]=null;}_0x332635(null,_0x196db3);},'afterUpdate':function(_0x3d11c9,_0x535f85,_0x4ef80e){var _0x54f596=_0x33f742[_0x3f40('0x13')];var _0x13b950=_0x3d11c9[_0x3f40('0x14')]({'plain':!![]});if(_0x13b950[_0x3f40('0xe')]){return _0x54f596[_0x3f40('0x15')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x13b950['id']}})[_0x3f40('0x16')](function(){_0x4ef80e();})[_0x3f40('0x17')](function(_0x464b26){_0x4ef80e(_0x464b26);});}else{_0x4ef80e();}}},'charset':_0x3f40('0x18'),'collate':_0x3f40('0x19')});}; \ No newline at end of file +var _0x70e0=['update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','mail_interactions','fti_mail_interactions','subject','FULLTEXT','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','substatusAt','get','MailMessage'];(function(_0x2947e3,_0xf4a577){var _0x729d08=function(_0x4a6d12){while(--_0x4a6d12){_0x2947e3['push'](_0x2947e3['shift']());}};_0x729d08(++_0xf4a577);}(_0x70e0,0x17b));var _0x070e=function(_0x59bfec,_0x29b1ca){_0x59bfec=_0x59bfec-0x0;var _0x1ccee6=_0x70e0[_0x59bfec];return _0x1ccee6;};'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']('MailInteraction',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0xa'),'to'],'type':_0x070e('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x111743,_0x68a09e,_0x11ffa8){if(_0x111743['substatus']){_0x111743['substatusAt']=moment()[_0x070e('0xc')](_0x070e('0xd'));}if(_0x111743[_0x070e('0xe')]){_0x111743[_0x070e('0xf')]=moment()[_0x070e('0xc')](_0x070e('0xd'));}_0x11ffa8(null,_0x68a09e);},'beforeUpdate':function(_0x25cfe1,_0x1baa12,_0x39d2b9){if(_0x25cfe1[_0x070e('0x10')](_0x070e('0x11'))){_0x25cfe1['substatusAt']=_0x25cfe1['substatus']?moment()[_0x070e('0xc')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x25cfe1['changed']('closed')){_0x25cfe1[_0x070e('0xf')]=moment()[_0x070e('0xc')]('YYYY-MM-DD\x20HH:mm:ss');_0x25cfe1['substatus']=null;_0x25cfe1[_0x070e('0x12')]=null;}_0x39d2b9(null,_0x25cfe1);},'afterUpdate':function(_0xeae1a5,_0x180897,_0x19d9da){var _0x5bc71e=_0x46fe68['models'];var _0x17e2e4=_0xeae1a5[_0x070e('0x13')]({'plain':!![]});if(_0x17e2e4[_0x070e('0xe')]){return _0x5bc71e[_0x070e('0x14')][_0x070e('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x17e2e4['id']}})['then'](function(){_0x19d9da();})[_0x070e('0x16')](function(_0x168dc6){_0x19d9da(_0x168dc6);});}else{_0x19d9da();}}},'charset':_0x070e('0x17'),'collate':_0x070e('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 8886328..f211b02 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 _0xa74f=['where','body','omit','ids','spread','AddTags','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','options','raw','limit','AddTagsToMailInteraction','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa74f,0x9a));var _0xfa74=function(_0x33155c,_0x3fdde1){_0x33155c=_0x33155c-0x0;var _0x5becf7=_0xa74f[_0x33155c];return _0x5becf7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa74('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa74('0x1'));var db=require(_0xfa74('0x2'))['db'];var utils=require(_0xfa74('0x3'));var logger=require(_0xfa74('0x4'))('rpc');var config=require(_0xfa74('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa74('0x6')]({'port':0x232a});config[_0xfa74('0x7')]=_[_0xfa74('0x8')](config[_0xfa74('0x7')],{'host':_0xfa74('0x9'),'port':0x18eb});var socket=require(_0xfa74('0xa'))(new Redis(config['redis']));require(_0xfa74('0xb'))[_0xfa74('0xc')](socket);function respondWithRpcPromise(_0x355e37,_0x2a405e,_0x4d118c){return new BPromise(function(_0x46117e,_0x4f8891){return client['request'](_0x355e37,_0x4d118c)[_0xfa74('0xd')](function(_0x1d919d){logger[_0xfa74('0xe')](_0xfa74('0xf'),_0x2a405e,'request\x20sent');logger[_0xfa74('0x10')](_0xfa74('0x11'),_0x2a405e,_0xfa74('0x12'),JSON[_0xfa74('0x13')](_0x1d919d));if(_0x1d919d['error']){if(_0x1d919d[_0xfa74('0x14')][_0xfa74('0x15')]===0x1f4){logger[_0xfa74('0x14')](_0xfa74('0xf'),_0x2a405e,_0x1d919d[_0xfa74('0x14')]['message']);return _0x4f8891(_0x1d919d[_0xfa74('0x14')][_0xfa74('0x16')]);}logger[_0xfa74('0x14')](_0xfa74('0xf'),_0x2a405e,_0x1d919d[_0xfa74('0x14')][_0xfa74('0x16')]);return _0x46117e(_0x1d919d[_0xfa74('0x14')]['message']);}else{logger[_0xfa74('0xe')](_0xfa74('0xf'),_0x2a405e,'request\x20sent');_0x46117e(_0x1d919d['result'][_0xfa74('0x16')]);}})[_0xfa74('0x17')](function(_0xb8fe6b){logger['error'](_0xfa74('0xf'),_0x2a405e,_0xb8fe6b);_0x4f8891(_0xb8fe6b);});});}exports[_0xfa74('0x18')]=function(_0x3f9f40){var _0x59a00c=this;return new Promise(function(_0xd35110,_0x302eb4){return db[_0xfa74('0x19')]['update'](_0x3f9f40['body'],{'raw':_0x3f9f40[_0xfa74('0x1a')]?_0x3f9f40[_0xfa74('0x1a')][_0xfa74('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f9f40[_0xfa74('0x1a')]?_0x3f9f40[_0xfa74('0x1a')]['where']||null:null,'attributes':_0x3f9f40['options']?_0x3f9f40[_0xfa74('0x1a')]['attributes']||null:null,'limit':_0x3f9f40['options']?_0x3f9f40['options'][_0xfa74('0x1c')]||null:null})[_0xfa74('0xd')](function(_0x42d9bf){logger['info']('UpdateMailInteraction',_0x3f9f40);logger[_0xfa74('0x10')](_0xfa74('0x18'),_0x3f9f40,JSON['stringify'](_0x42d9bf));_0xd35110(_0x42d9bf);})[_0xfa74('0x17')](function(_0x5d3b26){logger[_0xfa74('0x14')](_0xfa74('0x18'),_0x5d3b26['message'],_0x3f9f40);_0x302eb4(_0x59a00c[_0xfa74('0x14')](0x1f4,_0x5d3b26[_0xfa74('0x16')]));});});};exports[_0xfa74('0x1d')]=function(_0x218c86){return new Promise(function(_0x4f7337,_0xd9c55d){return db[_0xfa74('0x19')][_0xfa74('0x1e')]({'where':_0x218c86['options']?_0x218c86['options'][_0xfa74('0x1f')]||null:null})[_0xfa74('0xd')](function(_0x5df5cd){if(_0x5df5cd){return _0x5df5cd['addTags'](_0x218c86[_0xfa74('0x20')]['ids'],_[_0xfa74('0x21')](_0x218c86['body'],[_0xfa74('0x22'),'id'])||{});}})[_0xfa74('0x23')](function(_0x3c4cd1){logger[_0xfa74('0xe')]('AddTags',_0x218c86);logger[_0xfa74('0x10')](_0xfa74('0x24'),_0x218c86,JSON[_0xfa74('0x13')](_0x3c4cd1));_0x4f7337(_0x3c4cd1);})[_0xfa74('0x17')](function(_0x21f9fb){logger[_0xfa74('0x14')](_0xfa74('0x24'),_0x21f9fb['message'],_0x218c86);_0xd9c55d(_this[_0xfa74('0x14')](0x1f4,_0x21f9fb['message']));});});}; \ No newline at end of file +var _0xc36d=['AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','update','body','options','where','attributes','limit','MailInteraction','find','addTags','omit','ids','info'];(function(_0x20ef4,_0x5e6c54){var _0x4eecf7=function(_0x4ab84c){while(--_0x4ab84c){_0x20ef4['push'](_0x20ef4['shift']());}};_0x4eecf7(++_0x5e6c54);}(_0xc36d,0x7d));var _0xdc36=function(_0x3ae4bf,_0x554978){_0x3ae4bf=_0x3ae4bf-0x0;var _0x27f7dd=_0xc36d[_0x3ae4bf];return _0x27f7dd;};'use strict';var _=require(_0xdc36('0x0'));var util=require(_0xdc36('0x1'));var moment=require(_0xdc36('0x2'));var BPromise=require(_0xdc36('0x3'));var rs=require(_0xdc36('0x4'));var fs=require('fs');var Redis=require(_0xdc36('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc36('0x6'));var logger=require(_0xdc36('0x7'))('rpc');var config=require(_0xdc36('0x8'));var jayson=require(_0xdc36('0x9'));var client=jayson[_0xdc36('0xa')][_0xdc36('0xb')]({'port':0x232a});config[_0xdc36('0xc')]=_['defaults'](config[_0xdc36('0xc')],{'host':_0xdc36('0xd'),'port':0x18eb});var socket=require(_0xdc36('0xe'))(new Redis(config[_0xdc36('0xc')]));require('./mailInteraction.socket')[_0xdc36('0xf')](socket);function respondWithRpcPromise(_0x23956b,_0x573f8e,_0x1d0035){return new BPromise(function(_0x1cb73d,_0x2483bd){return client['request'](_0x23956b,_0x1d0035)[_0xdc36('0x10')](function(_0x18707d){logger['info']('MailInteraction,\x20%s,\x20%s',_0x573f8e,_0xdc36('0x11'));logger[_0xdc36('0x12')](_0xdc36('0x13'),_0x573f8e,_0xdc36('0x11'),JSON['stringify'](_0x18707d));if(_0x18707d[_0xdc36('0x14')]){if(_0x18707d[_0xdc36('0x14')][_0xdc36('0x15')]===0x1f4){logger[_0xdc36('0x14')](_0xdc36('0x16'),_0x573f8e,_0x18707d[_0xdc36('0x14')][_0xdc36('0x17')]);return _0x2483bd(_0x18707d[_0xdc36('0x14')]['message']);}logger[_0xdc36('0x14')]('MailInteraction,\x20%s,\x20%s',_0x573f8e,_0x18707d['error']['message']);return _0x1cb73d(_0x18707d[_0xdc36('0x14')][_0xdc36('0x17')]);}else{logger['info'](_0xdc36('0x16'),_0x573f8e,_0xdc36('0x11'));_0x1cb73d(_0x18707d[_0xdc36('0x18')][_0xdc36('0x17')]);}})[_0xdc36('0x19')](function(_0x46783d){logger['error'](_0xdc36('0x16'),_0x573f8e,_0x46783d);_0x2483bd(_0x46783d);});});}exports[_0xdc36('0x1a')]=function(_0x58eefb){var _0x414953=this;return new Promise(function(_0x197924,_0x3f25f0){return db['MailInteraction'][_0xdc36('0x1b')](_0x58eefb[_0xdc36('0x1c')],{'raw':_0x58eefb['options']?_0x58eefb[_0xdc36('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58eefb['options']?_0x58eefb[_0xdc36('0x1d')][_0xdc36('0x1e')]||null:null,'attributes':_0x58eefb[_0xdc36('0x1d')]?_0x58eefb[_0xdc36('0x1d')][_0xdc36('0x1f')]||null:null,'limit':_0x58eefb[_0xdc36('0x1d')]?_0x58eefb[_0xdc36('0x1d')][_0xdc36('0x20')]||null:null})['then'](function(_0x34057e){logger['info'](_0xdc36('0x1a'),_0x58eefb);logger[_0xdc36('0x12')](_0xdc36('0x1a'),_0x58eefb,JSON['stringify'](_0x34057e));_0x197924(_0x34057e);})[_0xdc36('0x19')](function(_0x6e3906){logger[_0xdc36('0x14')]('UpdateMailInteraction',_0x6e3906[_0xdc36('0x17')],_0x58eefb);_0x3f25f0(_0x414953[_0xdc36('0x14')](0x1f4,_0x6e3906[_0xdc36('0x17')]));});});};exports['AddTagsToMailInteraction']=function(_0x3c39e3){return new Promise(function(_0x2dcef7,_0x4b15b4){return db[_0xdc36('0x21')][_0xdc36('0x22')]({'where':_0x3c39e3['options']?_0x3c39e3[_0xdc36('0x1d')]['where']||null:null})['then'](function(_0x57785d){if(_0x57785d){return _0x57785d[_0xdc36('0x23')](_0x3c39e3[_0xdc36('0x1c')]['ids'],_[_0xdc36('0x24')](_0x3c39e3[_0xdc36('0x1c')],[_0xdc36('0x25'),'id'])||{});}})['spread'](function(_0x2a4451){logger[_0xdc36('0x26')](_0xdc36('0x27'),_0x3c39e3);logger[_0xdc36('0x12')](_0xdc36('0x27'),_0x3c39e3,JSON[_0xdc36('0x28')](_0x2a4451));_0x2dcef7(_0x2a4451);})[_0xdc36('0x19')](function(_0x54eb86){logger[_0xdc36('0x14')](_0xdc36('0x27'),_0x54eb86['message'],_0x3c39e3);_0x4b15b4(_this['error'](0x1f4,_0x54eb86[_0xdc36('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index c9fdba7..9d201c8 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 _0x3fe1=['register','length','mailInteraction:','./mailInteraction.events','remove','update','emit','removeListener'];(function(_0x56a74a,_0x1ebcc4){var _0x136f4d=function(_0x3287e6){while(--_0x3287e6){_0x56a74a['push'](_0x56a74a['shift']());}};_0x136f4d(++_0x1ebcc4);}(_0x3fe1,0xfb));var _0x13fe=function(_0x4fde0b,_0x4b4289){_0x4fde0b=_0x4fde0b-0x0;var _0x3f3b38=_0x3fe1[_0x4fde0b];return _0x3f3b38;};'use strict';var MailInteractionEvents=require(_0x13fe('0x0'));var events=['save',_0x13fe('0x1'),_0x13fe('0x2')];function createListener(_0x1bdd7b,_0x193668){return function(_0x454a39){_0x193668[_0x13fe('0x3')](_0x1bdd7b,_0x454a39);};}function removeListener(_0x4eb9b1,_0x2f3cea){return function(){MailInteractionEvents[_0x13fe('0x4')](_0x4eb9b1,_0x2f3cea);};}exports[_0x13fe('0x5')]=function(_0x1f981a){for(var _0x55efec=0x0,_0x3bcac9=events[_0x13fe('0x6')];_0x55efec<_0x3bcac9;_0x55efec++){var _0x23cade=events[_0x55efec];var _0x3349ae=createListener(_0x13fe('0x7')+_0x23cade,_0x1f981a);MailInteractionEvents['on'](_0x23cade,_0x3349ae);}}; \ No newline at end of file +var _0xa900=['emit','register','length','mailInteraction:','./mailInteraction.events','save','remove','update'];(function(_0x40348a,_0x5c0bb3){var _0x290d46=function(_0x5dc702){while(--_0x5dc702){_0x40348a['push'](_0x40348a['shift']());}};_0x290d46(++_0x5c0bb3);}(_0xa900,0x18c));var _0x0a90=function(_0x1a48a0,_0x3c95f5){_0x1a48a0=_0x1a48a0-0x0;var _0x269714=_0xa900[_0x1a48a0];return _0x269714;};'use strict';var MailInteractionEvents=require(_0x0a90('0x0'));var events=[_0x0a90('0x1'),_0x0a90('0x2'),_0x0a90('0x3')];function createListener(_0x4d1dec,_0x22de66){return function(_0xaeac4){_0x22de66[_0x0a90('0x4')](_0x4d1dec,_0xaeac4);};}function removeListener(_0x58644f,_0x4f22eb){return function(){MailInteractionEvents['removeListener'](_0x58644f,_0x4f22eb);};}exports[_0x0a90('0x5')]=function(_0x563995){for(var _0x57d19b=0x0,_0x3e8f9f=events[_0x0a90('0x6')];_0x57d19b<_0x3e8f9f;_0x57d19b++){var _0x2bc593=events[_0x57d19b];var _0xbf4c2b=createListener(_0x0a90('0x7')+_0x2bc593,_0x563995);MailInteractionEvents['on'](_0x2bc593,_0xbf4c2b);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index a4b7efb..2ff992d 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 _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(_0x5d220d,_0x44381c){var _0x4ebf39=function(_0x41dadb){while(--_0x41dadb){_0x5d220d['push'](_0x5d220d['shift']());}};_0x4ebf39(++_0x44381c);}(_0x3e74,0x175));var _0x43e7=function(_0x24e5ec,_0x168ff5){_0x24e5ec=_0x24e5ec-0x0;var _0x3f181a=_0x3e74[_0x24e5ec];return _0x3f181a;};'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 +var _0x24ca=['../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','update','put','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0xca560b,_0x3431a7){var _0x27f67=function(_0x5d9ad2){while(--_0x5d9ad2){_0xca560b['push'](_0xca560b['shift']());}};_0x27f67(++_0x3431a7);}(_0x24ca,0x1bc));var _0xa24c=function(_0x1f9f5f,_0x509fb7){_0x1f9f5f=_0x1f9f5f-0x0;var _0x51d649=_0x24ca[_0x1f9f5f];return _0x51d649;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var auth=require(_0xa24c('0x4'));var interaction=require(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var controller=require(_0xa24c('0x7'));router[_0xa24c('0x8')]('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xa')]);router[_0xa24c('0x8')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xc')]);router['get'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xe')]);router['get'](_0xa24c('0xf'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x10')]);router[_0xa24c('0x11')]('/',auth[_0xa24c('0x9')](),interaction[_0xa24c('0x12')](_0xa24c('0x13'),_0xa24c('0x14')),controller[_0xa24c('0x15')]);router['put'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x16')]);router[_0xa24c('0x17')]('/:id/accept',auth[_0xa24c('0x9')](),controller[_0xa24c('0x18')]);router[_0xa24c('0x17')](_0xa24c('0x19'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x1a')]);router[_0xa24c('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xa24c('0x1c')]);module[_0xa24c('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 964ed28..8effe19 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 _0xbc36=['TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','sequelize','exports'];(function(_0x3319d3,_0x3400ce){var _0x409e29=function(_0x4c50f0){while(--_0x4c50f0){_0x3319d3['push'](_0x3319d3['shift']());}};_0x409e29(++_0x3400ce);}(_0xbc36,0x169));var _0x6bc3=function(_0x489a5c,_0x50c191){_0x489a5c=_0x489a5c-0x0;var _0x44a2ea=_0xbc36[_0x489a5c];return _0x44a2ea;};'use strict';var Sequelize=require(_0x6bc3('0x0'));var _=require('lodash');module[_0x6bc3('0x1')]={'body':{'type':Sequelize[_0x6bc3('0x2')](_0x6bc3('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x6bc3('0x2')](_0x6bc3('0x4'))},'read':{'type':Sequelize[_0x6bc3('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6bc3('0x6')]('in',_0x6bc3('0x7')),'defaultValue':_0x6bc3('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x6bc3('0x8')]},'to':{'type':Sequelize[_0x6bc3('0x2')]('long')},'cc':{'type':Sequelize[_0x6bc3('0x2')](_0x6bc3('0x3'))},'bcc':{'type':Sequelize[_0x6bc3('0x2')]('long')},'subject':{'type':Sequelize[_0x6bc3('0x2')]},'sentAt':{'type':Sequelize[_0x6bc3('0x9')]},'attach':{'type':Sequelize[_0x6bc3('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x6bc3('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x6bc3('0x2')](_0x6bc3('0x3'))},'originCc':{'type':Sequelize[_0x6bc3('0x2')](_0x6bc3('0x3'))}}; \ No newline at end of file +var _0x7b84=['long','medium','ENUM','out','STRING','DATE','INTEGER','BOOLEAN','sequelize','lodash','exports','TEXT'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7b84,0x17c));var _0x47b8=function(_0x3f1a6d,_0x5eb08d){_0x3f1a6d=_0x3f1a6d-0x0;var _0x53bedb=_0x7b84[_0x3f1a6d];return _0x53bedb;};'use strict';var Sequelize=require(_0x47b8('0x0'));var _=require(_0x47b8('0x1'));module[_0x47b8('0x2')]={'body':{'type':Sequelize[_0x47b8('0x3')](_0x47b8('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x47b8('0x3')](_0x47b8('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x47b8('0x6')]('in',_0x47b8('0x7')),'defaultValue':_0x47b8('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x47b8('0x8')](0x1fe)},'from':{'type':Sequelize[_0x47b8('0x8')]},'to':{'type':Sequelize[_0x47b8('0x3')]('long')},'cc':{'type':Sequelize[_0x47b8('0x3')](_0x47b8('0x4'))},'bcc':{'type':Sequelize[_0x47b8('0x3')](_0x47b8('0x4'))},'subject':{'type':Sequelize[_0x47b8('0x3')]},'sentAt':{'type':Sequelize[_0x47b8('0x9')]},'attach':{'type':Sequelize[_0x47b8('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x47b8('0xb')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x47b8('0x9')]},'originTo':{'type':Sequelize[_0x47b8('0x3')](_0x47b8('0x4'))},'originCc':{'type':Sequelize[_0x47b8('0x3')](_0x47b8('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index b9168e1..d2d2379 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 _0xd71d=['pick','filter','merge','options','includeAll','include','findAll','show','params','keys','filtears','find','body','destroy','describe','create','direction','out','secret','split','MailAccount','findOne','CmList','CmContact','updatedAt','DESC','MailServerOut','Smtp','service','host','port','secure','authentication','user','pass','auth','attachments','root','basename','List','Contacts','ListId','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','UserId','Contact','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','download','unix','toString','join','server','files','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','type','readFileSync','writeFileSync','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailMessage.socket','register','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','count','offset','limit','set','apply','reject','update','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0xd71d,0x1a5));var _0xdd71=function(_0x4d8789,_0x3fdff1){_0x4d8789=_0x4d8789-0x0;var _0x404e41=_0xd71d[_0x4d8789];return _0x404e41;};'use strict';var pdf=require(_0xdd71('0x0'));var emlformat=require(_0xdd71('0x1'));var rimraf=require(_0xdd71('0x2'));var zipdir=require(_0xdd71('0x3'));var jsonpatch=require(_0xdd71('0x4'));var rp=require('request-promise');var moment=require(_0xdd71('0x5'));var BPromise=require(_0xdd71('0x6'));var Mustache=require(_0xdd71('0x7'));var util=require('util');var path=require(_0xdd71('0x8'));var sox=require(_0xdd71('0x9'));var csv=require(_0xdd71('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdd71('0xb'));var squel=require(_0xdd71('0xc'));var crypto=require(_0xdd71('0xd'));var jsforce=require(_0xdd71('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xdd71('0xa'));var querystring=require(_0xdd71('0xf'));var Papa=require(_0xdd71('0x10'));var Redis=require(_0xdd71('0x11'));var authService=require(_0xdd71('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdd71('0x13'));var hardwareService=require(_0xdd71('0x14'));var logger=require(_0xdd71('0x15'))(_0xdd71('0x16'));var utils=require('../../config/utils');var config=require(_0xdd71('0x17'));var licenseUtil=require(_0xdd71('0x18'));var db=require(_0xdd71('0x19'))['db'];config[_0xdd71('0x1a')]=_[_0xdd71('0x1b')](config[_0xdd71('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xdd71('0x1c'))(new Redis(config[_0xdd71('0x1a')]));require(_0xdd71('0x1d'))[_0xdd71('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdd71('0x1f')][_0xdd71('0x20')]({'port':0x232c});var client9003=jayson[_0xdd71('0x1f')][_0xdd71('0x20')]({'port':0x232b});var client9002=jayson[_0xdd71('0x1f')][_0xdd71('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x407a7b,_0x553ae4,_0x389ce1,_0x219b23){return new BPromise(function(_0x11accc,_0x58eae4){var _0x4c3601=_0x219b23||client;return _0x4c3601[_0xdd71('0x21')](_0x407a7b,_0x389ce1)[_0xdd71('0x22')](function(_0x17a2da){logger[_0xdd71('0x23')](_0xdd71('0x24'),_0x553ae4,_0xdd71('0x25'));logger['debug'](_0xdd71('0x26'),_0x553ae4,_0xdd71('0x25'),JSON[_0xdd71('0x27')](_0x17a2da));if(_0x17a2da[_0xdd71('0x28')]){if(_0x17a2da[_0xdd71('0x28')][_0xdd71('0x29')]===0x1f4){logger[_0xdd71('0x28')](_0xdd71('0x24'),_0x553ae4,_0x17a2da[_0xdd71('0x28')][_0xdd71('0x2a')]);return _0x58eae4(_0x17a2da[_0xdd71('0x28')][_0xdd71('0x2a')]);}logger['error'](_0xdd71('0x24'),_0x553ae4,_0x17a2da[_0xdd71('0x28')]['message']);return _0x11accc(_0x17a2da[_0xdd71('0x28')]['message']);}else{logger[_0xdd71('0x23')]('MailMessage,\x20%s,\x20%s',_0x553ae4,'request\x20sent');_0x11accc(_0x17a2da['result']['message']);}})[_0xdd71('0x2b')](function(_0x5bb250){logger[_0xdd71('0x28')](_0xdd71('0x24'),_0x553ae4,_0x5bb250);_0x58eae4(_0x5bb250);});});}function respondWithStatusCode(_0xd8739d,_0x11850a){_0x11850a=_0x11850a||0xcc;return function(_0x5562dc){if(_0x5562dc){return _0xd8739d['sendStatus'](_0x11850a);}return _0xd8739d[_0xdd71('0x2c')](_0x11850a)[_0xdd71('0x2d')]();};}function respondWithResult(_0x43b6e1,_0x5a240e){_0x5a240e=_0x5a240e||0xc8;return function(_0x4432af){if(_0x4432af){return _0x43b6e1[_0xdd71('0x2c')](_0x5a240e)[_0xdd71('0x2e')](_0x4432af);}};}function respondWithFilteredResult(_0x5f1d12,_0x9eb773){return function(_0x5b8848){if(_0x5b8848){var _0x5d4ff5=_0x5b8848[_0xdd71('0x2f')],_0x1ee00f=_0x9eb773[_0xdd71('0x30')],_0x43588c=_0x9eb773[_0xdd71('0x30')]+_0x9eb773[_0xdd71('0x31')],_0xd0a207;if(_0x43588c>=_0x5d4ff5){_0x43588c=_0x5d4ff5;_0xd0a207=0xc8;}else{_0xd0a207=0xce;}_0x5f1d12[_0xdd71('0x2c')](_0xd0a207);return _0x5f1d12[_0xdd71('0x32')]('Content-Range',_0x1ee00f+'-'+_0x43588c+'/'+_0x5d4ff5)[_0xdd71('0x2e')](_0x5b8848);}return null;};}function patchUpdates(_0x2f3b51){return function(_0x2c2a73){try{jsonpatch[_0xdd71('0x33')](_0x2c2a73,_0x2f3b51,!![]);}catch(_0x5a1698){return BPromise[_0xdd71('0x34')](_0x5a1698);}return _0x2c2a73['save']();};}function saveUpdates(_0x5c7e76,_0x43de1e){return function(_0x35ebd9){if(_0x35ebd9){return _0x35ebd9[_0xdd71('0x35')](_0x5c7e76)['then'](function(_0x3be7c9){return _0x3be7c9;});}return null;};}function removeEntity(_0x4ffe6f,_0x80286d){return function(_0x5663f3){if(_0x5663f3){return _0x5663f3['destroy']()[_0xdd71('0x22')](function(){_0x4ffe6f[_0xdd71('0x2c')](0xcc)[_0xdd71('0x2d')]();});}};}function handleEntityNotFound(_0x499f76,_0x525b74){return function(_0x1ce984){if(!_0x1ce984){_0x499f76['sendStatus'](0x194);}return _0x1ce984;};}function handleError(_0x4d05d4,_0x35929e){_0x35929e=_0x35929e||0x1f4;return function(_0x59183d){logger['error'](_0x59183d[_0xdd71('0x36')]);if(_0x59183d[_0xdd71('0x37')]){delete _0x59183d[_0xdd71('0x37')];}_0x4d05d4[_0xdd71('0x2c')](_0x35929e)[_0xdd71('0x38')](_0x59183d);};}exports[_0xdd71('0x39')]=function(_0x244fd9,_0x45ec8d){var _0x4650b6={},_0x395a94={},_0x300b89={'count':0x0,'rows':[]};var _0x3f0da5=_[_0xdd71('0x3a')](db[_0xdd71('0x3b')][_0xdd71('0x3c')],function(_0x3a0706){return{'name':_0x3a0706[_0xdd71('0x3d')],'type':_0x3a0706['type']['key']};});_0x395a94[_0xdd71('0x3e')]=_[_0xdd71('0x3a')](_0x3f0da5,_0xdd71('0x37'));_0x395a94['query']=_['keys'](_0x244fd9[_0xdd71('0x3f')]);_0x395a94[_0xdd71('0x40')]=_[_0xdd71('0x41')](_0x395a94['model'],_0x395a94['query']);_0x4650b6[_0xdd71('0x42')]=_['intersection'](_0x395a94[_0xdd71('0x3e')],qs[_0xdd71('0x43')](_0x244fd9[_0xdd71('0x3f')]['fields']));_0x4650b6[_0xdd71('0x42')]=_0x4650b6[_0xdd71('0x42')][_0xdd71('0x44')]?_0x4650b6[_0xdd71('0x42')]:_0x395a94[_0xdd71('0x3e')];if(!_0x244fd9[_0xdd71('0x3f')][_0xdd71('0x45')](_0xdd71('0x46'))){_0x4650b6[_0xdd71('0x31')]=qs[_0xdd71('0x31')](_0x244fd9['query'][_0xdd71('0x31')]);_0x4650b6[_0xdd71('0x30')]=qs[_0xdd71('0x30')](_0x244fd9[_0xdd71('0x3f')][_0xdd71('0x30')]);}_0x4650b6[_0xdd71('0x47')]=qs[_0xdd71('0x48')](_0x244fd9[_0xdd71('0x3f')][_0xdd71('0x48')]);_0x4650b6[_0xdd71('0x49')]=qs[_0xdd71('0x40')](_[_0xdd71('0x4a')](_0x244fd9[_0xdd71('0x3f')],_0x395a94[_0xdd71('0x40')]),_0x3f0da5);if(_0x244fd9[_0xdd71('0x3f')][_0xdd71('0x4b')]){_0x4650b6[_0xdd71('0x49')]=_[_0xdd71('0x4c')](_0x4650b6[_0xdd71('0x49')],{'$or':_[_0xdd71('0x3a')](_0x3f0da5,function(_0x3d3ba9){if(_0x3d3ba9['type']!=='VIRTUAL'){var _0x781fb={};_0x781fb[_0x3d3ba9[_0xdd71('0x37')]]={'$like':'%'+_0x244fd9[_0xdd71('0x3f')][_0xdd71('0x4b')]+'%'};return _0x781fb;}})});}_0x4650b6=_[_0xdd71('0x4c')]({},_0x4650b6,_0x244fd9[_0xdd71('0x4d')]);var _0x1d74fd={'where':_0x4650b6[_0xdd71('0x49')]};return db['MailMessage']['count'](_0x1d74fd)[_0xdd71('0x22')](function(_0x19a7d7){_0x300b89[_0xdd71('0x2f')]=_0x19a7d7;if(_0x244fd9[_0xdd71('0x3f')][_0xdd71('0x4e')]){_0x4650b6[_0xdd71('0x4f')]=[{'all':!![]}];}return db['MailMessage'][_0xdd71('0x50')](_0x4650b6);})[_0xdd71('0x22')](function(_0x836009){_0x300b89['rows']=_0x836009;return _0x300b89;})[_0xdd71('0x22')](respondWithFilteredResult(_0x45ec8d,_0x4650b6))[_0xdd71('0x2b')](handleError(_0x45ec8d,null));};exports[_0xdd71('0x51')]=function(_0xac21bf,_0x76a2a4){var _0x3b8895={'raw':!![],'where':{'id':_0xac21bf[_0xdd71('0x52')]['id']}},_0x5a20d1={};_0x5a20d1[_0xdd71('0x3e')]=_['keys'](db[_0xdd71('0x3b')][_0xdd71('0x3c')]);_0x5a20d1[_0xdd71('0x3f')]=_[_0xdd71('0x53')](_0xac21bf[_0xdd71('0x3f')]);_0x5a20d1[_0xdd71('0x54')]=_[_0xdd71('0x41')](_0x5a20d1[_0xdd71('0x3e')],_0x5a20d1[_0xdd71('0x3f')]);_0x3b8895[_0xdd71('0x42')]=_[_0xdd71('0x41')](_0x5a20d1[_0xdd71('0x3e')],qs['fields'](_0xac21bf[_0xdd71('0x3f')]['fields']));_0x3b8895[_0xdd71('0x42')]=_0x3b8895['attributes'][_0xdd71('0x44')]?_0x3b8895['attributes']:_0x5a20d1['model'];if(_0xac21bf[_0xdd71('0x3f')][_0xdd71('0x4e')]){_0x3b8895[_0xdd71('0x4f')]=[{'all':!![]}];}_0x3b8895=_[_0xdd71('0x4c')]({},_0x3b8895,_0xac21bf['options']);return db[_0xdd71('0x3b')][_0xdd71('0x55')](_0x3b8895)[_0xdd71('0x22')](handleEntityNotFound(_0x76a2a4,null))[_0xdd71('0x22')](respondWithResult(_0x76a2a4,null))[_0xdd71('0x2b')](handleError(_0x76a2a4,null));};exports[_0xdd71('0x35')]=function(_0x527e7d,_0x231057){if(_0x527e7d[_0xdd71('0x56')]['id']){delete _0x527e7d[_0xdd71('0x56')]['id'];}return db[_0xdd71('0x3b')][_0xdd71('0x55')]({'where':{'id':_0x527e7d[_0xdd71('0x52')]['id']}})[_0xdd71('0x22')](handleEntityNotFound(_0x231057,null))['then'](saveUpdates(_0x527e7d[_0xdd71('0x56')],null))[_0xdd71('0x22')](respondWithResult(_0x231057,null))['catch'](handleError(_0x231057,null));};exports[_0xdd71('0x57')]=function(_0xd2da91,_0x3e09e2){return db[_0xdd71('0x3b')]['find']({'where':{'id':_0xd2da91['params']['id']}})[_0xdd71('0x22')](handleEntityNotFound(_0x3e09e2,null))[_0xdd71('0x22')](removeEntity(_0x3e09e2,null))[_0xdd71('0x2b')](handleError(_0x3e09e2,null));};exports['describe']=function(_0x1d3e7a,_0x2773b6){return db[_0xdd71('0x3b')][_0xdd71('0x58')]()[_0xdd71('0x22')](respondWithResult(_0x2773b6,null))[_0xdd71('0x2b')](handleError(_0x2773b6,null));};exports['create']=function(_0x7a764,_0x41dca0){return db[_0xdd71('0x3b')][_0xdd71('0x59')](_0x7a764[_0xdd71('0x56')])['then'](function(_0x5bbf6d){if(_0x5bbf6d){if(_0x5bbf6d[_0xdd71('0x5a')]===_0xdd71('0x5b')&&!_0x5bbf6d[_0xdd71('0x5c')]){var _0x4cfb0d,_0x1e7695,_0x1a01f8;if(_0x7a764[_0xdd71('0x56')]['to']){_0x1e7695=_0x7a764['body']['to'][_0xdd71('0x5d')](',')[0x0];}return db[_0xdd71('0x5e')][_0xdd71('0x5f')]({'where':{'id':_0x5bbf6d['MailAccountId']},'include':[{'model':db[_0xdd71('0x60')],'as':'List','include':[{'model':db[_0xdd71('0x61')],'as':'Contacts','where':{'email':_0x1e7695},'limit':0x1,'order':[[_0xdd71('0x62'),_0xdd71('0x63')]]}]},{'model':db[_0xdd71('0x64')],'as':_0xdd71('0x65'),'raw':!![]}]})[_0xdd71('0x22')](function(_0x2141bf){_0x4cfb0d=_0x2141bf;if(_0x4cfb0d&&_0x4cfb0d['Smtp']){var _0x2d20d5={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x4cfb0d[_0xdd71('0x65')][_0xdd71('0x66')])){_0x2d20d5[_0xdd71('0x67')]=_0x4cfb0d[_0xdd71('0x65')][_0xdd71('0x67')];_0x2d20d5[_0xdd71('0x68')]=_0x4cfb0d['Smtp']['port'];_0x2d20d5[_0xdd71('0x69')]=_0x4cfb0d['Smtp'][_0xdd71('0x69')];if(_0x4cfb0d[_0xdd71('0x65')][_0xdd71('0x6a')]){_0x2d20d5['auth']={'user':_0x4cfb0d[_0xdd71('0x65')][_0xdd71('0x6b')],'pass':_0x4cfb0d['Smtp'][_0xdd71('0x6c')]};}}else{_0x2d20d5['service']=_0x4cfb0d[_0xdd71('0x65')][_0xdd71('0x66')];_0x2d20d5[_0xdd71('0x6d')]={'user':_0x4cfb0d[_0xdd71('0x65')][_0xdd71('0x6b')],'pass':_0x4cfb0d['Smtp'][_0xdd71('0x6c')]};_0x2d20d5[_0xdd71('0x69')]=_0x4cfb0d['Smtp'][_0xdd71('0x69')];}if(_0x7a764['body'][_0xdd71('0x6e')]&&_0x7a764[_0xdd71('0x56')][_0xdd71('0x6e')][_0xdd71('0x44')]){for(var _0x415063=0x0;_0x415063<_0x7a764[_0xdd71('0x56')][_0xdd71('0x6e')][_0xdd71('0x44')];_0x415063+=0x1){_0x7a764[_0xdd71('0x56')][_0xdd71('0x6e')][_0x415063]={'filename':_0x7a764['body']['attachments'][_0x415063][_0xdd71('0x37')],'path':path['join'](config[_0xdd71('0x6f')],'server/files/attachments',_0x7a764[_0xdd71('0x56')][_0xdd71('0x6e')][_0x415063][_0xdd71('0x70')])};}}_0x1a01f8={'account':_0x2d20d5,'message':_0x7a764[_0xdd71('0x56')]};return;}})[_0xdd71('0x22')](function(){if(_0x4cfb0d[_0xdd71('0x71')]){if(_0x4cfb0d['List'][_0xdd71('0x72')][_0xdd71('0x44')]){return _0x4cfb0d[_0xdd71('0x71')][_0xdd71('0x72')][0x0];}else{return db['CmContact'][_0xdd71('0x59')](_['defaults'](_0x7a764[_0xdd71('0x56')],{'firstName':_0x7a764[_0xdd71('0x56')]['to'],'email':_0x7a764[_0xdd71('0x56')]['to'],'phone':_0x7a764['body']['to'],'ListId':_0x4cfb0d[_0xdd71('0x73')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xdd71('0x22')](function(){if(_0x1a01f8){return respondWithRpcPromise(_0xdd71('0x74'),'sendMail',_0x1a01f8,client9003)['then'](function(_0x104b30){return _0x5bbf6d[_0xdd71('0x35')]({'read':!![],'messageId':_0x104b30[_0xdd71('0x75')],'sentAt':moment()[_0xdd71('0x76')](_0xdd71('0x77'))});})[_0xdd71('0x2b')](function(_0x389cd3){logger[_0xdd71('0x28')]('%s',JSON['stringify'](_0x389cd3));return _0x5bbf6d;});}return _0x5bbf6d;});}return _0x5bbf6d;}})[_0xdd71('0x22')](respondWithResult(_0x41dca0,0xc9))[_0xdd71('0x2b')](handleError(_0x41dca0,null));};var interaction_log=require(_0xdd71('0x15'))(_0xdd71('0x78'));exports[_0xdd71('0x79')]=function(_0x4ec76c,_0x5c83bc,_0x232248){var _0x4b53eb={'channel':_0xdd71('0x7a')};if(_0x4ec76c[_0xdd71('0x56')]['id']){delete _0x4ec76c[_0xdd71('0x56')]['id'];}_0x4ec76c['body']['read']=!![];_0x4ec76c[_0xdd71('0x56')]['readAt']=moment()[_0xdd71('0x76')](_0xdd71('0x77'));_0x4ec76c[_0xdd71('0x56')]['UserId']=_0x4ec76c['body'][_0xdd71('0x7b')]||_0x4ec76c[_0xdd71('0x6b')]['id'];return db[_0xdd71('0x3b')]['find']({'where':{'id':_0x4ec76c[_0xdd71('0x52')]['id'],'UserId':null},'include':[{'model':db[_0xdd71('0x61')],'as':_0xdd71('0x7c')}]})[_0xdd71('0x22')](handleEntityNotFound(_0x5c83bc,null))[_0xdd71('0x22')](saveUpdates(_0x4ec76c['body'],null))[_0xdd71('0x22')](function(_0x18cc9f){if(_0x18cc9f){_0x4b53eb[_0xdd71('0x2a')]=_0x18cc9f[_0xdd71('0x7d')]({'plain':!![]});return db[_0xdd71('0x7e')]['find']({'where':{'id':_0x18cc9f[_0xdd71('0x7f')]}});}return null;})[_0xdd71('0x22')](handleEntityNotFound(_0x5c83bc,null))['then'](function(_0x2f2ca6){if(_0x2f2ca6){return _0x2f2ca6[_0xdd71('0x35')]({'UserId':_0x4ec76c[_0xdd71('0x56')][_0xdd71('0x7b')],'read1stAt':_[_0xdd71('0x80')](_0x2f2ca6[_0xdd71('0x81')])?moment()[_0xdd71('0x76')](_0xdd71('0x77')):undefined});}return null;})['then'](function(_0x189849){if(_0x189849){_0x4b53eb[_0xdd71('0x82')]=_0x189849[_0xdd71('0x7d')]({'plain':!![]});interaction_log['info'](_0xdd71('0x83'),_0x4ec76c['user']['id'],_0x4ec76c[_0xdd71('0x6b')][_0xdd71('0x37')],_0x4ec76c[_0xdd71('0x6b')][_0xdd71('0x84')],_0x4b53eb[_0xdd71('0x82')]['id'],_0x4ec76c[_0xdd71('0x56')]?JSON['stringify'](_0x4ec76c[_0xdd71('0x56')]):'null');return respondWithRpcPromise(_0xdd71('0x85'),_0xdd71('0x86'),_0x4b53eb);}return null;})[_0xdd71('0x22')](function(_0x5c65b9){if(_0x5c65b9){if(_0x4ec76c[_0xdd71('0x56')]['manual']){_0x4b53eb[_0xdd71('0x2a')][_0xdd71('0x87')]=util[_0xdd71('0x76')](_0xdd71('0x88'),_0x4ec76c[_0xdd71('0x6b')][_0xdd71('0x37')]);_0x4b53eb['message'][_0xdd71('0x89')]=_0x4b53eb[_0xdd71('0x89')];_0x4b53eb[_0xdd71('0x2a')][_0xdd71('0x8a')]='accept';return respondWithRpcPromise(_0xdd71('0x8b'),'EventManager',{'event':_0xdd71('0x8c'),'message':_0x4b53eb[_0xdd71('0x2a')]},client9002)[_0xdd71('0x22')](function(){return _0x4b53eb;});}return _0x4b53eb;}return null;})[_0xdd71('0x22')](respondWithResult(_0x5c83bc,null))['catch'](handleError(_0x5c83bc,null));};var interaction_log=require(_0xdd71('0x15'))(_0xdd71('0x78'));exports[_0xdd71('0x34')]=function(_0x34d83d,_0x4d732d,_0x412148){var _0x3ff718={'agent':{},'channel':_0xdd71('0x7a')};if(_0x34d83d['body']['id']){delete _0x34d83d['body']['id'];}_0x34d83d[_0xdd71('0x56')][_0xdd71('0x7b')]=_0x34d83d['body'][_0xdd71('0x7b')]||_0x34d83d[_0xdd71('0x6b')]['id'];_0x3ff718[_0xdd71('0x8d')]['id']=_0x34d83d[_0xdd71('0x56')][_0xdd71('0x7b')];return db[_0xdd71('0x3b')]['find']({'where':{'id':_0x34d83d[_0xdd71('0x52')]['id'],'UserId':null}})[_0xdd71('0x22')](handleEntityNotFound(_0x4d732d,null))['then'](function(_0x24eeb8){if(_0x24eeb8){_0x3ff718[_0xdd71('0x2a')]=_0x24eeb8[_0xdd71('0x7d')]({'plain':!![]});return db[_0xdd71('0x7e')][_0xdd71('0x55')]({'where':{'id':_0x24eeb8[_0xdd71('0x7f')]}});}return null;})['then'](handleEntityNotFound(_0x4d732d,null))[_0xdd71('0x22')](function(_0x15400e){if(_0x15400e){_0x3ff718['interaction']=_0x15400e[_0xdd71('0x7d')]({'plain':!![]});interaction_log[_0xdd71('0x23')](_0xdd71('0x8e'),_0x34d83d[_0xdd71('0x6b')]['id'],_0x34d83d['user']['name'],_0x34d83d[_0xdd71('0x6b')][_0xdd71('0x84')],_0x3ff718[_0xdd71('0x82')]['id'],_0x34d83d[_0xdd71('0x56')]?JSON[_0xdd71('0x27')](_0x34d83d['body']):'null');return respondWithRpcPromise('RejectMessage',_0xdd71('0x8f'),_0x3ff718);}return null;})[_0xdd71('0x22')](function(_0x30f96d){if(_0x30f96d){_0x30f96d[_0xdd71('0x2a')]['interface']=util[_0xdd71('0x76')](_0xdd71('0x88'),_0x34d83d[_0xdd71('0x6b')][_0xdd71('0x37')]);_0x30f96d[_0xdd71('0x2a')]['channel']=_0x3ff718[_0xdd71('0x89')];_0x30f96d['message'][_0xdd71('0x8a')]=_0xdd71('0x34');respondWithRpcPromise(_0xdd71('0x8b'),'EventManager',{'event':_0xdd71('0x90'),'message':_0x30f96d[_0xdd71('0x2a')]},client9002);return _0x3ff718;}return null;})[_0xdd71('0x22')](respondWithResult(_0x4d732d,null))['catch'](handleError(_0x4d732d,null));};exports[_0xdd71('0x91')]=function(_0x46265f,_0x23f0a8){var _0x2a5ef4=moment()[_0xdd71('0x92')]()[_0xdd71('0x93')]();var _0x5970fb=path[_0xdd71('0x94')](config['root'],_0xdd71('0x95'),_0xdd71('0x96'),'tmp');var _0x4b6efa=path['join'](config[_0xdd71('0x6f')],_0xdd71('0x95'),_0xdd71('0x96'),_0xdd71('0x6e'));var _0x606c9=util[_0xdd71('0x76')](_0xdd71('0x97'),_0x2a5ef4);return db[_0xdd71('0x3b')][_0xdd71('0x55')]({'where':{'id':_0x46265f[_0xdd71('0x52')]['id']},'attributes':['id',_0xdd71('0x56'),_0xdd71('0x98'),'to','cc',_0xdd71('0x99'),'subject',_0xdd71('0x9a')],'include':_0x46265f[_0xdd71('0x3f')][_0xdd71('0x6e')]?[{'model':db[_0xdd71('0x9b')],'as':_0xdd71('0x9c')}]:undefined})[_0xdd71('0x22')](handleEntityNotFound(_0x23f0a8,null))[_0xdd71('0x22')](function(_0x3bcaa4){if(_0x3bcaa4){var _0x555a57=_0x3bcaa4;var _0x19c60e={'from':_0x555a57[_0xdd71('0x98')],'to':_0x555a57['to'],'subject':_0x555a57['subject'],'html':_0x555a57[_0xdd71('0x56')],'headers':{'Date':moment(_0x555a57[_0xdd71('0x9a')])['format'](_0xdd71('0x9d'))},'attachments':[]};if(_0x3bcaa4['cc']){_0x19c60e[_0xdd71('0x9e')]['Cc']=_0x3bcaa4['cc'];}if(_0x3bcaa4[_0xdd71('0x99')]){_0x19c60e[_0xdd71('0x9e')][_0xdd71('0x9f')]=_0x3bcaa4['bcc'];}return new BPromise(function(_0x2b3773,_0x389fe4){if(_0x3bcaa4['Attachments']){for(var _0x4fd70f=0x0;_0x4fd70f<_0x3bcaa4['Attachments']['length'];_0x4fd70f++){var _0x490b90=_0x3bcaa4[_0xdd71('0x9c')][_0x4fd70f];var _0x42b074=path[_0xdd71('0x94')](_0x4b6efa,_0x490b90[_0xdd71('0x70')]);if(fs['existsSync'](_0x42b074)){_0x19c60e[_0xdd71('0x6e')][_0xdd71('0xa0')]({'name':_0x490b90[_0xdd71('0x37')],'contentType':_0x490b90[_0xdd71('0xa1')],'data':fs[_0xdd71('0xa2')](_0x42b074)});}}}emlformat['build'](_0x19c60e,function(_0x5b7239,_0x8fda01){if(_0x5b7239)return _0x389fe4(_0x5b7239);fs[_0xdd71('0xa3')](path[_0xdd71('0x94')](_0x5970fb,_0x606c9),_0x8fda01);return _0x2b3773(_0x8fda01);});});}})[_0xdd71('0x22')](function(_0x41a259){if(_0x41a259){return _0x23f0a8[_0xdd71('0x91')](path['join'](_0x5970fb,_0x606c9),_0x606c9,function(_0x42b2ab){if(_0x42b2ab){console['log']('err',_0x42b2ab);}else{fs[_0xdd71('0xa4')](path[_0xdd71('0x94')](_0x5970fb,_0x606c9));}});}})[_0xdd71('0x2b')](handleError(_0x23f0a8,null));}; \ No newline at end of file +var _0x867f=['root','basename','Contacts','create','defaults','ListId','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','readAt','UserId','get','MailInteraction','MailInteractionId','interaction','role','null','AcceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','reject','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','download','unix','toString','files','message-%s.eml','from','bcc','Attachment','Attachments','subject','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','readFileSync','build','log','err','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','count','offset','limit','set','Content-Range','json','update','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','MailMessage','includeAll','include','rows','params','filtears','body','destroy','find','describe','direction','out','secret','split','MailAccount','findOne','MailAccountId','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','isNil','host','port','secure','authentication','auth','user','service','attachments','join'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x867f,0xdc));var _0xf867=function(_0x151732,_0x82b764){_0x151732=_0x151732-0x0;var _0x1cda86=_0x867f[_0x151732];return _0x1cda86;};'use strict';var pdf=require(_0xf867('0x0'));var emlformat=require(_0xf867('0x1'));var rimraf=require(_0xf867('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf867('0x3'));var rp=require(_0xf867('0x4'));var moment=require(_0xf867('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf867('0x6'));var util=require('util');var path=require(_0xf867('0x7'));var sox=require(_0xf867('0x8'));var csv=require(_0xf867('0x9'));var ejs=require(_0xf867('0xa'));var fs=require('fs');var _=require(_0xf867('0xb'));var squel=require(_0xf867('0xc'));var crypto=require(_0xf867('0xd'));var jsforce=require(_0xf867('0xe'));var deskjs=require(_0xf867('0xf'));var toCsv=require(_0xf867('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf867('0x10'));var authService=require(_0xf867('0x11'));var qs=require(_0xf867('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf867('0x13'))(_0xf867('0x14'));var utils=require('../../config/utils');var config=require(_0xf867('0x15'));var licenseUtil=require(_0xf867('0x16'));var db=require(_0xf867('0x17'))['db'];config[_0xf867('0x18')]=_['defaults'](config[_0xf867('0x18')],{'host':_0xf867('0x19'),'port':0x18eb});var socket=require(_0xf867('0x1a'))(new Redis(config[_0xf867('0x18')]));require(_0xf867('0x1b'))[_0xf867('0x1c')](socket);var jayson=require(_0xf867('0x1d'));var client=jayson[_0xf867('0x1e')][_0xf867('0x1f')]({'port':0x232c});var client9003=jayson[_0xf867('0x1e')]['http']({'port':0x232b});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46d844,_0x45541a,_0x42179b,_0x3bc89a){return new BPromise(function(_0x13f08f,_0x29b42f){var _0x2b98cd=_0x3bc89a||client;return _0x2b98cd['request'](_0x46d844,_0x42179b)[_0xf867('0x20')](function(_0x20586d){logger[_0xf867('0x21')](_0xf867('0x22'),_0x45541a,_0xf867('0x23'));logger['debug'](_0xf867('0x24'),_0x45541a,'request\x20sent',JSON[_0xf867('0x25')](_0x20586d));if(_0x20586d[_0xf867('0x26')]){if(_0x20586d[_0xf867('0x26')]['code']===0x1f4){logger[_0xf867('0x26')](_0xf867('0x22'),_0x45541a,_0x20586d[_0xf867('0x26')][_0xf867('0x27')]);return _0x29b42f(_0x20586d[_0xf867('0x26')][_0xf867('0x27')]);}logger[_0xf867('0x26')](_0xf867('0x22'),_0x45541a,_0x20586d['error'][_0xf867('0x27')]);return _0x13f08f(_0x20586d[_0xf867('0x26')][_0xf867('0x27')]);}else{logger['info'](_0xf867('0x22'),_0x45541a,_0xf867('0x23'));_0x13f08f(_0x20586d[_0xf867('0x28')][_0xf867('0x27')]);}})[_0xf867('0x29')](function(_0x550f54){logger[_0xf867('0x26')](_0xf867('0x22'),_0x45541a,_0x550f54);_0x29b42f(_0x550f54);});});}function respondWithStatusCode(_0x2c6e8e,_0x165e63){_0x165e63=_0x165e63||0xcc;return function(_0x16a903){if(_0x16a903){return _0x2c6e8e['sendStatus'](_0x165e63);}return _0x2c6e8e[_0xf867('0x2a')](_0x165e63)[_0xf867('0x2b')]();};}function respondWithResult(_0x13a202,_0x20594e){_0x20594e=_0x20594e||0xc8;return function(_0x2765cf){if(_0x2765cf){return _0x13a202[_0xf867('0x2a')](_0x20594e)['json'](_0x2765cf);}};}function respondWithFilteredResult(_0x3d4b18,_0x28fb90){return function(_0x169578){if(_0x169578){var _0x4c0f0c=_0x169578[_0xf867('0x2c')],_0x1553fc=_0x28fb90['offset'],_0x1b7509=_0x28fb90[_0xf867('0x2d')]+_0x28fb90[_0xf867('0x2e')],_0x298406;if(_0x1b7509>=_0x4c0f0c){_0x1b7509=_0x4c0f0c;_0x298406=0xc8;}else{_0x298406=0xce;}_0x3d4b18[_0xf867('0x2a')](_0x298406);return _0x3d4b18[_0xf867('0x2f')](_0xf867('0x30'),_0x1553fc+'-'+_0x1b7509+'/'+_0x4c0f0c)[_0xf867('0x31')](_0x169578);}return null;};}function patchUpdates(_0x3ec1fc){return function(_0x20321a){try{jsonpatch['apply'](_0x20321a,_0x3ec1fc,!![]);}catch(_0x1bfdcf){return BPromise['reject'](_0x1bfdcf);}return _0x20321a['save']();};}function saveUpdates(_0x4d7666,_0x1a48c4){return function(_0x8a7c99){if(_0x8a7c99){return _0x8a7c99[_0xf867('0x32')](_0x4d7666)[_0xf867('0x20')](function(_0x5da8bb){return _0x5da8bb;});}return null;};}function removeEntity(_0x390a74,_0x382309){return function(_0x574979){if(_0x574979){return _0x574979['destroy']()[_0xf867('0x20')](function(){_0x390a74['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ae8f6,_0x13cb27){return function(_0x531ee5){if(!_0x531ee5){_0x5ae8f6[_0xf867('0x33')](0x194);}return _0x531ee5;};}function handleError(_0x41bc1b,_0x5f9ab0){_0x5f9ab0=_0x5f9ab0||0x1f4;return function(_0x332ca5){logger[_0xf867('0x26')](_0x332ca5[_0xf867('0x34')]);if(_0x332ca5[_0xf867('0x35')]){delete _0x332ca5['name'];}_0x41bc1b[_0xf867('0x2a')](_0x5f9ab0)['send'](_0x332ca5);};}exports[_0xf867('0x36')]=function(_0x1cb4e1,_0x5919a8){var _0x33d428={},_0x57eff1={},_0x3321c9={'count':0x0,'rows':[]};var _0x6d0131=_[_0xf867('0x37')](db['MailMessage'][_0xf867('0x38')],function(_0x5f2980){return{'name':_0x5f2980[_0xf867('0x39')],'type':_0x5f2980[_0xf867('0x3a')]['key']};});_0x57eff1['model']=_['map'](_0x6d0131,_0xf867('0x35'));_0x57eff1[_0xf867('0x3b')]=_[_0xf867('0x3c')](_0x1cb4e1['query']);_0x57eff1[_0xf867('0x3d')]=_['intersection'](_0x57eff1['model'],_0x57eff1[_0xf867('0x3b')]);_0x33d428[_0xf867('0x3e')]=_[_0xf867('0x3f')](_0x57eff1[_0xf867('0x40')],qs[_0xf867('0x41')](_0x1cb4e1['query']['fields']));_0x33d428['attributes']=_0x33d428[_0xf867('0x3e')][_0xf867('0x42')]?_0x33d428[_0xf867('0x3e')]:_0x57eff1[_0xf867('0x40')];if(!_0x1cb4e1[_0xf867('0x3b')][_0xf867('0x43')](_0xf867('0x44'))){_0x33d428[_0xf867('0x2e')]=qs['limit'](_0x1cb4e1[_0xf867('0x3b')][_0xf867('0x2e')]);_0x33d428['offset']=qs[_0xf867('0x2d')](_0x1cb4e1[_0xf867('0x3b')][_0xf867('0x2d')]);}_0x33d428[_0xf867('0x45')]=qs[_0xf867('0x46')](_0x1cb4e1[_0xf867('0x3b')][_0xf867('0x46')]);_0x33d428[_0xf867('0x47')]=qs[_0xf867('0x3d')](_[_0xf867('0x48')](_0x1cb4e1[_0xf867('0x3b')],_0x57eff1[_0xf867('0x3d')]),_0x6d0131);if(_0x1cb4e1[_0xf867('0x3b')][_0xf867('0x49')]){_0x33d428[_0xf867('0x47')]=_['merge'](_0x33d428[_0xf867('0x47')],{'$or':_[_0xf867('0x37')](_0x6d0131,function(_0x462764){if(_0x462764[_0xf867('0x3a')]!==_0xf867('0x4a')){var _0x350426={};_0x350426[_0x462764[_0xf867('0x35')]]={'$like':'%'+_0x1cb4e1[_0xf867('0x3b')][_0xf867('0x49')]+'%'};return _0x350426;}})});}_0x33d428=_[_0xf867('0x4b')]({},_0x33d428,_0x1cb4e1[_0xf867('0x4c')]);var _0x83324c={'where':_0x33d428[_0xf867('0x47')]};return db[_0xf867('0x4d')][_0xf867('0x2c')](_0x83324c)[_0xf867('0x20')](function(_0x13d0b5){_0x3321c9['count']=_0x13d0b5;if(_0x1cb4e1[_0xf867('0x3b')][_0xf867('0x4e')]){_0x33d428[_0xf867('0x4f')]=[{'all':!![]}];}return db[_0xf867('0x4d')]['findAll'](_0x33d428);})[_0xf867('0x20')](function(_0x1931ae){_0x3321c9[_0xf867('0x50')]=_0x1931ae;return _0x3321c9;})[_0xf867('0x20')](respondWithFilteredResult(_0x5919a8,_0x33d428))[_0xf867('0x29')](handleError(_0x5919a8,null));};exports['show']=function(_0x53dba7,_0x18ed38){var _0x26275e={'raw':!![],'where':{'id':_0x53dba7[_0xf867('0x51')]['id']}},_0x1e0810={};_0x1e0810[_0xf867('0x40')]=_['keys'](db[_0xf867('0x4d')][_0xf867('0x38')]);_0x1e0810[_0xf867('0x3b')]=_['keys'](_0x53dba7['query']);_0x1e0810[_0xf867('0x52')]=_[_0xf867('0x3f')](_0x1e0810['model'],_0x1e0810['query']);_0x26275e['attributes']=_[_0xf867('0x3f')](_0x1e0810[_0xf867('0x40')],qs[_0xf867('0x41')](_0x53dba7[_0xf867('0x3b')]['fields']));_0x26275e[_0xf867('0x3e')]=_0x26275e[_0xf867('0x3e')][_0xf867('0x42')]?_0x26275e[_0xf867('0x3e')]:_0x1e0810[_0xf867('0x40')];if(_0x53dba7[_0xf867('0x3b')][_0xf867('0x4e')]){_0x26275e[_0xf867('0x4f')]=[{'all':!![]}];}_0x26275e=_[_0xf867('0x4b')]({},_0x26275e,_0x53dba7[_0xf867('0x4c')]);return db[_0xf867('0x4d')]['find'](_0x26275e)[_0xf867('0x20')](handleEntityNotFound(_0x18ed38,null))[_0xf867('0x20')](respondWithResult(_0x18ed38,null))['catch'](handleError(_0x18ed38,null));};exports[_0xf867('0x32')]=function(_0x279187,_0x5396b4){if(_0x279187[_0xf867('0x53')]['id']){delete _0x279187['body']['id'];}return db['MailMessage']['find']({'where':{'id':_0x279187[_0xf867('0x51')]['id']}})[_0xf867('0x20')](handleEntityNotFound(_0x5396b4,null))[_0xf867('0x20')](saveUpdates(_0x279187[_0xf867('0x53')],null))['then'](respondWithResult(_0x5396b4,null))[_0xf867('0x29')](handleError(_0x5396b4,null));};exports[_0xf867('0x54')]=function(_0xe5b12e,_0x317afc){return db[_0xf867('0x4d')][_0xf867('0x55')]({'where':{'id':_0xe5b12e[_0xf867('0x51')]['id']}})[_0xf867('0x20')](handleEntityNotFound(_0x317afc,null))['then'](removeEntity(_0x317afc,null))[_0xf867('0x29')](handleError(_0x317afc,null));};exports[_0xf867('0x56')]=function(_0x27906c,_0x5964ea){return db[_0xf867('0x4d')][_0xf867('0x56')]()[_0xf867('0x20')](respondWithResult(_0x5964ea,null))[_0xf867('0x29')](handleError(_0x5964ea,null));};exports['create']=function(_0x4bfa11,_0x246d40){return db['MailMessage']['create'](_0x4bfa11[_0xf867('0x53')])[_0xf867('0x20')](function(_0x5b7cbe){if(_0x5b7cbe){if(_0x5b7cbe[_0xf867('0x57')]===_0xf867('0x58')&&!_0x5b7cbe[_0xf867('0x59')]){var _0x33a70d,_0x307cbb,_0x544170;if(_0x4bfa11[_0xf867('0x53')]['to']){_0x307cbb=_0x4bfa11[_0xf867('0x53')]['to'][_0xf867('0x5a')](',')[0x0];}return db[_0xf867('0x5b')][_0xf867('0x5c')]({'where':{'id':_0x5b7cbe[_0xf867('0x5d')]},'include':[{'model':db['CmList'],'as':_0xf867('0x5e'),'include':[{'model':db[_0xf867('0x5f')],'as':'Contacts','where':{'email':_0x307cbb},'limit':0x1,'order':[[_0xf867('0x60'),_0xf867('0x61')]]}]},{'model':db[_0xf867('0x62')],'as':_0xf867('0x63'),'raw':!![]}]})[_0xf867('0x20')](function(_0x18baed){_0x33a70d=_0x18baed;if(_0x33a70d&&_0x33a70d[_0xf867('0x63')]){var _0x4800a0={'tls':{'rejectUnauthorized':![]}};if(_[_0xf867('0x64')](_0x33a70d[_0xf867('0x63')]['service'])){_0x4800a0[_0xf867('0x65')]=_0x33a70d[_0xf867('0x63')][_0xf867('0x65')];_0x4800a0['port']=_0x33a70d[_0xf867('0x63')][_0xf867('0x66')];_0x4800a0[_0xf867('0x67')]=_0x33a70d[_0xf867('0x63')][_0xf867('0x67')];if(_0x33a70d[_0xf867('0x63')][_0xf867('0x68')]){_0x4800a0[_0xf867('0x69')]={'user':_0x33a70d[_0xf867('0x63')][_0xf867('0x6a')],'pass':_0x33a70d[_0xf867('0x63')]['pass']};}}else{_0x4800a0[_0xf867('0x6b')]=_0x33a70d[_0xf867('0x63')][_0xf867('0x6b')];_0x4800a0[_0xf867('0x69')]={'user':_0x33a70d[_0xf867('0x63')][_0xf867('0x6a')],'pass':_0x33a70d[_0xf867('0x63')]['pass']};_0x4800a0[_0xf867('0x67')]=_0x33a70d['Smtp'][_0xf867('0x67')];}if(_0x4bfa11[_0xf867('0x53')][_0xf867('0x6c')]&&_0x4bfa11[_0xf867('0x53')][_0xf867('0x6c')][_0xf867('0x42')]){for(var _0x428a49=0x0;_0x428a49<_0x4bfa11[_0xf867('0x53')][_0xf867('0x6c')]['length'];_0x428a49+=0x1){_0x4bfa11[_0xf867('0x53')][_0xf867('0x6c')][_0x428a49]={'filename':_0x4bfa11[_0xf867('0x53')][_0xf867('0x6c')][_0x428a49][_0xf867('0x35')],'path':path[_0xf867('0x6d')](config[_0xf867('0x6e')],'server/files/attachments',_0x4bfa11[_0xf867('0x53')][_0xf867('0x6c')][_0x428a49][_0xf867('0x6f')])};}}_0x544170={'account':_0x4800a0,'message':_0x4bfa11[_0xf867('0x53')]};return;}})[_0xf867('0x20')](function(){if(_0x33a70d[_0xf867('0x5e')]){if(_0x33a70d[_0xf867('0x5e')][_0xf867('0x70')][_0xf867('0x42')]){return _0x33a70d[_0xf867('0x5e')]['Contacts'][0x0];}else{return db['CmContact'][_0xf867('0x71')](_[_0xf867('0x72')](_0x4bfa11[_0xf867('0x53')],{'firstName':_0x4bfa11[_0xf867('0x53')]['to'],'email':_0x4bfa11[_0xf867('0x53')]['to'],'phone':_0x4bfa11['body']['to'],'ListId':_0x33a70d[_0xf867('0x73')]}));}}else{throw new Error(_0xf867('0x74'));}})['then'](function(){if(_0x544170){return respondWithRpcPromise(_0xf867('0x75'),_0xf867('0x76'),_0x544170,client9003)[_0xf867('0x20')](function(_0x30c1b8){return _0x5b7cbe[_0xf867('0x32')]({'read':!![],'messageId':_0x30c1b8['messageId'],'sentAt':moment()[_0xf867('0x77')](_0xf867('0x78'))});})[_0xf867('0x29')](function(_0x10d51f){logger['error']('%s',JSON['stringify'](_0x10d51f));return _0x5b7cbe;});}return _0x5b7cbe;});}return _0x5b7cbe;}})['then'](respondWithResult(_0x246d40,0xc9))['catch'](handleError(_0x246d40,null));};var interaction_log=require(_0xf867('0x13'))(_0xf867('0x79'));exports[_0xf867('0x7a')]=function(_0x59d6c3,_0x26dc06,_0x3b4719){var _0x10cb95={'channel':_0xf867('0x7b')};if(_0x59d6c3['body']['id']){delete _0x59d6c3['body']['id'];}_0x59d6c3[_0xf867('0x53')]['read']=!![];_0x59d6c3[_0xf867('0x53')][_0xf867('0x7c')]=moment()[_0xf867('0x77')](_0xf867('0x78'));_0x59d6c3[_0xf867('0x53')]['UserId']=_0x59d6c3['body'][_0xf867('0x7d')]||_0x59d6c3[_0xf867('0x6a')]['id'];return db[_0xf867('0x4d')][_0xf867('0x55')]({'where':{'id':_0x59d6c3[_0xf867('0x51')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xf867('0x20')](handleEntityNotFound(_0x26dc06,null))[_0xf867('0x20')](saveUpdates(_0x59d6c3[_0xf867('0x53')],null))[_0xf867('0x20')](function(_0x5bc6c0){if(_0x5bc6c0){_0x10cb95['message']=_0x5bc6c0[_0xf867('0x7e')]({'plain':!![]});return db[_0xf867('0x7f')]['find']({'where':{'id':_0x5bc6c0[_0xf867('0x80')]}});}return null;})[_0xf867('0x20')](handleEntityNotFound(_0x26dc06,null))['then'](function(_0x220568){if(_0x220568){return _0x220568[_0xf867('0x32')]({'UserId':_0x59d6c3[_0xf867('0x53')][_0xf867('0x7d')],'read1stAt':_[_0xf867('0x64')](_0x220568['read1stAt'])?moment()[_0xf867('0x77')](_0xf867('0x78')):undefined});}return null;})[_0xf867('0x20')](function(_0x4af735){if(_0x4af735){_0x10cb95[_0xf867('0x81')]=_0x4af735[_0xf867('0x7e')]({'plain':!![]});interaction_log[_0xf867('0x21')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x59d6c3['user']['id'],_0x59d6c3['user'][_0xf867('0x35')],_0x59d6c3[_0xf867('0x6a')][_0xf867('0x82')],_0x10cb95['interaction']['id'],_0x59d6c3['body']?JSON['stringify'](_0x59d6c3['body']):_0xf867('0x83'));return respondWithRpcPromise(_0xf867('0x84'),'acceptMessage',_0x10cb95);}return null;})[_0xf867('0x20')](function(_0xbf4efd){if(_0xbf4efd){if(_0x59d6c3[_0xf867('0x53')][_0xf867('0x85')]){_0x10cb95['message'][_0xf867('0x86')]=util['format'](_0xf867('0x87'),_0x59d6c3['user'][_0xf867('0x35')]);_0x10cb95[_0xf867('0x27')][_0xf867('0x88')]=_0x10cb95[_0xf867('0x88')];_0x10cb95[_0xf867('0x27')]['event']=_0xf867('0x7a');return respondWithRpcPromise(_0xf867('0x89'),'EventManager',{'event':_0xf867('0x8a'),'message':_0x10cb95[_0xf867('0x27')]},client9002)[_0xf867('0x20')](function(){return _0x10cb95;});}return _0x10cb95;}return null;})[_0xf867('0x20')](respondWithResult(_0x26dc06,null))['catch'](handleError(_0x26dc06,null));};var interaction_log=require(_0xf867('0x13'))('mail-interactions');exports[_0xf867('0x8b')]=function(_0x4dff7d,_0x4d45ab,_0x1cb161){var _0x592c6d={'agent':{},'channel':'mail'};if(_0x4dff7d['body']['id']){delete _0x4dff7d[_0xf867('0x53')]['id'];}_0x4dff7d[_0xf867('0x53')][_0xf867('0x7d')]=_0x4dff7d['body'][_0xf867('0x7d')]||_0x4dff7d['user']['id'];_0x592c6d[_0xf867('0x8c')]['id']=_0x4dff7d['body']['UserId'];return db[_0xf867('0x4d')][_0xf867('0x55')]({'where':{'id':_0x4dff7d[_0xf867('0x51')]['id'],'UserId':null}})[_0xf867('0x20')](handleEntityNotFound(_0x4d45ab,null))[_0xf867('0x20')](function(_0x3910c4){if(_0x3910c4){_0x592c6d['message']=_0x3910c4['get']({'plain':!![]});return db[_0xf867('0x7f')][_0xf867('0x55')]({'where':{'id':_0x3910c4[_0xf867('0x80')]}});}return null;})[_0xf867('0x20')](handleEntityNotFound(_0x4d45ab,null))['then'](function(_0x3aef1b){if(_0x3aef1b){_0x592c6d['interaction']=_0x3aef1b[_0xf867('0x7e')]({'plain':!![]});interaction_log['info'](_0xf867('0x8d'),_0x4dff7d[_0xf867('0x6a')]['id'],_0x4dff7d[_0xf867('0x6a')][_0xf867('0x35')],_0x4dff7d['user'][_0xf867('0x82')],_0x592c6d['interaction']['id'],_0x4dff7d[_0xf867('0x53')]?JSON[_0xf867('0x25')](_0x4dff7d['body']):_0xf867('0x83'));return respondWithRpcPromise(_0xf867('0x8e'),_0xf867('0x8f'),_0x592c6d);}return null;})[_0xf867('0x20')](function(_0x1aa7cc){if(_0x1aa7cc){_0x1aa7cc[_0xf867('0x27')][_0xf867('0x86')]=util[_0xf867('0x77')](_0xf867('0x87'),_0x4dff7d[_0xf867('0x6a')]['name']);_0x1aa7cc[_0xf867('0x27')][_0xf867('0x88')]=_0x592c6d[_0xf867('0x88')];_0x1aa7cc[_0xf867('0x27')][_0xf867('0x90')]=_0xf867('0x8b');respondWithRpcPromise(_0xf867('0x89'),'EventManager',{'event':_0xf867('0x91'),'message':_0x1aa7cc[_0xf867('0x27')]},client9002);return _0x592c6d;}return null;})['then'](respondWithResult(_0x4d45ab,null))['catch'](handleError(_0x4d45ab,null));};exports[_0xf867('0x92')]=function(_0xb494b2,_0x58484e){var _0x54084d=moment()[_0xf867('0x93')]()[_0xf867('0x94')]();var _0x5c6ab5=path[_0xf867('0x6d')](config[_0xf867('0x6e')],'server',_0xf867('0x95'),'tmp');var _0x132848=path[_0xf867('0x6d')](config[_0xf867('0x6e')],'server',_0xf867('0x95'),_0xf867('0x6c'));var _0x159cb1=util['format'](_0xf867('0x96'),_0x54084d);return db[_0xf867('0x4d')]['find']({'where':{'id':_0xb494b2[_0xf867('0x51')]['id']},'attributes':['id',_0xf867('0x53'),_0xf867('0x97'),'to','cc',_0xf867('0x98'),'subject','createdAt'],'include':_0xb494b2[_0xf867('0x3b')]['attachments']?[{'model':db[_0xf867('0x99')],'as':_0xf867('0x9a')}]:undefined})[_0xf867('0x20')](handleEntityNotFound(_0x58484e,null))[_0xf867('0x20')](function(_0x1d6ac9){if(_0x1d6ac9){var _0xfd924f=_0x1d6ac9;var _0x48b523={'from':_0xfd924f[_0xf867('0x97')],'to':_0xfd924f['to'],'subject':_0xfd924f[_0xf867('0x9b')],'html':_0xfd924f[_0xf867('0x53')],'headers':{'Date':moment(_0xfd924f[_0xf867('0x9c')])[_0xf867('0x77')](_0xf867('0x9d'))},'attachments':[]};if(_0x1d6ac9['cc']){_0x48b523[_0xf867('0x9e')]['Cc']=_0x1d6ac9['cc'];}if(_0x1d6ac9[_0xf867('0x98')]){_0x48b523['headers'][_0xf867('0x9f')]=_0x1d6ac9[_0xf867('0x98')];}return new BPromise(function(_0x24c950,_0x765dbc){if(_0x1d6ac9['Attachments']){for(var _0x31fa81=0x0;_0x31fa81<_0x1d6ac9[_0xf867('0x9a')][_0xf867('0x42')];_0x31fa81++){var _0x353758=_0x1d6ac9['Attachments'][_0x31fa81];var _0x2c0103=path[_0xf867('0x6d')](_0x132848,_0x353758['basename']);if(fs['existsSync'](_0x2c0103)){_0x48b523[_0xf867('0x6c')][_0xf867('0xa0')]({'name':_0x353758[_0xf867('0x35')],'contentType':_0x353758[_0xf867('0x3a')],'data':fs[_0xf867('0xa1')](_0x2c0103)});}}}emlformat[_0xf867('0xa2')](_0x48b523,function(_0x1fc35a,_0x5f1fed){if(_0x1fc35a)return _0x765dbc(_0x1fc35a);fs['writeFileSync'](path[_0xf867('0x6d')](_0x5c6ab5,_0x159cb1),_0x5f1fed);return _0x24c950(_0x5f1fed);});});}})[_0xf867('0x20')](function(_0x55a559){if(_0x55a559){return _0x58484e[_0xf867('0x92')](path[_0xf867('0x6d')](_0x5c6ab5,_0x159cb1),_0x159cb1,function(_0xb28320){if(_0xb28320){console[_0xf867('0xa3')](_0xf867('0xa4'),_0xb28320);}else{fs['unlinkSync'](path[_0xf867('0x6d')](_0x5c6ab5,_0x159cb1));}});}})[_0xf867('0x29')](handleError(_0x58484e,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 10259a3..d0ad08b 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 _0x4141=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x4141,0x1f0));var _0x1414=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4141[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require(_0x1414('0x0'));var MailMessage=require(_0x1414('0x1'))['db'][_0x1414('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x1414('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1414('0x4'),'afterDestroy':_0x1414('0x5')};function emitEvent(_0x1ea4a1){return function(_0x4c80e3,_0x477f24,_0x57fb27){MailMessageEvents[_0x1414('0x6')](_0x1ea4a1+':'+_0x4c80e3['id'],_0x4c80e3);MailMessageEvents[_0x1414('0x6')](_0x1ea4a1,_0x4c80e3);_0x57fb27(null);};}for(var e in events){if(events[_0x1414('0x7')](e)){var event=events[e];MailMessage[_0x1414('0x8')](e,emitEvent(event));}}module[_0x1414('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x1645=['../../mysqldb','setMaxListeners','save','update','remove','hook','events'];(function(_0x22cdf2,_0x5cc4e4){var _0x108207=function(_0x19ce8e){while(--_0x19ce8e){_0x22cdf2['push'](_0x22cdf2['shift']());}};_0x108207(++_0x5cc4e4);}(_0x1645,0x117));var _0x5164=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1645[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x5164('0x0'));var MailMessage=require(_0x5164('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x5164('0x2')](0x0);var events={'afterCreate':_0x5164('0x3'),'afterUpdate':_0x5164('0x4'),'afterDestroy':_0x5164('0x5')};function emitEvent(_0x50eda2){return function(_0x3490cf,_0x76b08f,_0x50e95c){MailMessageEvents['emit'](_0x50eda2+':'+_0x3490cf['id'],_0x3490cf);MailMessageEvents['emit'](_0x50eda2,_0x3490cf);_0x50e95c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x5164('0x6')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 548208f..f3e37a5 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 _0xe8b1=['get','direction','toLowerCase','secret','UserId','MailInteraction','MailInteractionId','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','html-to-text','rimraf','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','models'];(function(_0x546044,_0x5b8849){var _0x365064=function(_0x337b3d){while(--_0x337b3d){_0x546044['push'](_0x546044['shift']());}};_0x365064(++_0x5b8849);}(_0xe8b1,0xde));var _0x1e8b=function(_0x5a6744,_0x144876){_0x5a6744=_0x5a6744-0x0;var _0xff7177=_0xe8b1[_0x5a6744];return _0xff7177;};'use strict';var _=require(_0x1e8b('0x0'));var util=require(_0x1e8b('0x1'));var logger=require(_0x1e8b('0x2'))(_0x1e8b('0x3'));var moment=require(_0x1e8b('0x4'));var BPromise=require('bluebird');var rp=require(_0x1e8b('0x5'));var htmlToText=require(_0x1e8b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e8b('0x7'));var config=require('../../config/environment');var attributes=require(_0x1e8b('0x8'));module['exports']=function(_0xf1e8b,_0x30b329){return _0xf1e8b[_0x1e8b('0x9')](_0x1e8b('0xa'),attributes,{'tableName':_0x1e8b('0xb'),'paranoid':![],'indexes':[{'name':_0x1e8b('0xc'),'fields':[_0x1e8b('0xc')]},{'name':_0x1e8b('0xd'),'fields':[_0x1e8b('0xe'),'subject'],'type':_0x1e8b('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x44cbab,_0x385576,_0x9266a5){if(_0x44cbab['body']){_0x44cbab[_0x1e8b('0xe')]=htmlToText['fromString'](_0x44cbab[_0x1e8b('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x9266a5(null,_0x385576);},'afterCreate':function(_0x3d97f8,_0x4aebc0,_0x3c57d5){var _0x1cebb5=_0xf1e8b[_0x1e8b('0x11')];var _0x38d730=_0x3d97f8[_0x1e8b('0x12')]({'plain':!![]});if(_0x38d730[_0x1e8b('0x13')]['toLowerCase']()==='in'||_0x38d730[_0x1e8b('0x13')][_0x1e8b('0x14')]()==='out'&&!_0x38d730[_0x1e8b('0x15')]&&!_['isNil'](_0x38d730[_0x1e8b('0x16')])){_0x1cebb5[_0x1e8b('0x17')]['findOne']({'where':{'id':_0x38d730[_0x1e8b('0x18')]}})['then'](function(_0x275fbf){if(_0x275fbf){_0x275fbf[_0x1e8b('0x19')]({'lastMsgAt':_0x38d730[_0x1e8b('0x1a')],'lastMsgDirection':_0x38d730[_0x1e8b('0x13')]['toLowerCase'](),'lastMsgBody':_0x38d730[_0x1e8b('0x10')]});}})[_0x1e8b('0x1b')](function(_0x15bb24){console[_0x1e8b('0x1c')](_0x15bb24);});}_0x3c57d5();}},'charset':_0x1e8b('0x1d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5420=['body','fromString','get','toLowerCase','direction','out','secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','html-to-text','path','rimraf','../../config/environment','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody'];(function(_0x4c2dfc,_0x4814c0){var _0xfd728d=function(_0x5b8d81){while(--_0x5b8d81){_0x4c2dfc['push'](_0x4c2dfc['shift']());}};_0xfd728d(++_0x4814c0);}(_0x5420,0x96));var _0x0542=function(_0x191791,_0x555b5a){_0x191791=_0x191791-0x0;var _0xa13f70=_0x5420[_0x191791];return _0xa13f70;};'use strict';var _=require(_0x0542('0x0'));var util=require(_0x0542('0x1'));var logger=require(_0x0542('0x2'))(_0x0542('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0542('0x4'));var htmlToText=require(_0x0542('0x5'));var fs=require('fs');var path=require(_0x0542('0x6'));var rimraf=require(_0x0542('0x7'));var config=require(_0x0542('0x8'));var attributes=require('./mailMessage.attributes');module['exports']=function(_0x18b72a,_0x2c304c){return _0x18b72a[_0x0542('0x9')](_0x0542('0xa'),attributes,{'tableName':_0x0542('0xb'),'paranoid':![],'indexes':[{'name':_0x0542('0xc'),'fields':[_0x0542('0xc')]},{'name':_0x0542('0xd'),'fields':[_0x0542('0xe'),'subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4f4ecf,_0x1ecee7,_0xe85e0c){if(_0x4f4ecf[_0x0542('0xf')]){_0x4f4ecf[_0x0542('0xe')]=htmlToText[_0x0542('0x10')](_0x4f4ecf[_0x0542('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xe85e0c(null,_0x1ecee7);},'afterCreate':function(_0x24ec84,_0x3d0f4c,_0x2f9e44){var _0xd1de80=_0x18b72a['models'];var _0x51214f=_0x24ec84[_0x0542('0x11')]({'plain':!![]});if(_0x51214f['direction'][_0x0542('0x12')]()==='in'||_0x51214f[_0x0542('0x13')][_0x0542('0x12')]()===_0x0542('0x14')&&!_0x51214f[_0x0542('0x15')]&&!_[_0x0542('0x16')](_0x51214f[_0x0542('0x17')])){_0xd1de80[_0x0542('0x18')]['findOne']({'where':{'id':_0x51214f[_0x0542('0x19')]}})[_0x0542('0x1a')](function(_0x1ab5f5){if(_0x1ab5f5){_0x1ab5f5[_0x0542('0x1b')]({'lastMsgAt':_0x51214f[_0x0542('0x1c')],'lastMsgDirection':_0x51214f[_0x0542('0x13')][_0x0542('0x12')](),'lastMsgBody':_0x51214f[_0x0542('0xf')]});}})[_0x0542('0x1d')](function(_0x2a9e1e){console[_0x0542('0x1e')](_0x2a9e1e);});}_0x2f9e44();}},'charset':_0x0542('0x1f'),'collate':_0x0542('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index c4ab651..a804737 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 _0xe50e=['stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','MailMessage','create','body','options','CreateMailMessage','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x492535,_0x46524a){var _0x256620=function(_0x3015f8){while(--_0x3015f8){_0x492535['push'](_0x492535['shift']());}};_0x256620(++_0x46524a);}(_0xe50e,0xf9));var _0xee50=function(_0x5575ae,_0x2eb3c0){_0x5575ae=_0x5575ae-0x0;var _0xd1701c=_0xe50e[_0x5575ae];return _0xd1701c;};'use strict';var _=require(_0xee50('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xee50('0x1'));var fs=require('fs');var Redis=require(_0xee50('0x2'));var db=require(_0xee50('0x3'))['db'];var utils=require(_0xee50('0x4'));var logger=require(_0xee50('0x5'))(_0xee50('0x6'));var config=require(_0xee50('0x7'));var jayson=require(_0xee50('0x8'));var client=jayson[_0xee50('0x9')][_0xee50('0xa')]({'port':0x232a});config[_0xee50('0xb')]=_[_0xee50('0xc')](config[_0xee50('0xb')],{'host':_0xee50('0xd'),'port':0x18eb});var socket=require(_0xee50('0xe'))(new Redis(config[_0xee50('0xb')]));require(_0xee50('0xf'))[_0xee50('0x10')](socket);function respondWithRpcPromise(_0x2cd326,_0x385e89,_0x5c7734){return new BPromise(function(_0x527d89,_0xff8ad7){return client[_0xee50('0x11')](_0x2cd326,_0x5c7734)[_0xee50('0x12')](function(_0x32c855){logger[_0xee50('0x13')]('MailMessage,\x20%s,\x20%s',_0x385e89,_0xee50('0x14'));logger[_0xee50('0x15')](_0xee50('0x16'),_0x385e89,_0xee50('0x14'),JSON[_0xee50('0x17')](_0x32c855));if(_0x32c855[_0xee50('0x18')]){if(_0x32c855[_0xee50('0x18')][_0xee50('0x19')]===0x1f4){logger['error'](_0xee50('0x1a'),_0x385e89,_0x32c855[_0xee50('0x18')][_0xee50('0x1b')]);return _0xff8ad7(_0x32c855[_0xee50('0x18')]['message']);}logger[_0xee50('0x18')](_0xee50('0x1a'),_0x385e89,_0x32c855[_0xee50('0x18')][_0xee50('0x1b')]);return _0x527d89(_0x32c855['error'][_0xee50('0x1b')]);}else{logger[_0xee50('0x13')](_0xee50('0x1a'),_0x385e89,_0xee50('0x14'));_0x527d89(_0x32c855[_0xee50('0x1c')][_0xee50('0x1b')]);}})['catch'](function(_0x4080ba){logger[_0xee50('0x18')](_0xee50('0x1a'),_0x385e89,_0x4080ba);_0xff8ad7(_0x4080ba);});});}exports['CreateMailMessage']=function(_0x4445fa){var _0x4346c5=this;return new Promise(function(_0x14229d,_0x5c0a6f){return db[_0xee50('0x1d')][_0xee50('0x1e')](_0x4445fa[_0xee50('0x1f')],{'raw':_0x4445fa[_0xee50('0x20')]?_0x4445fa[_0xee50('0x20')]['raw']===undefined?!![]:![]:!![]})[_0xee50('0x12')](function(_0x1990f2){logger[_0xee50('0x13')]('CreateMailMessage',_0x4445fa);logger[_0xee50('0x15')](_0xee50('0x21'),_0x4445fa,JSON[_0xee50('0x17')](_0x1990f2));_0x14229d(_0x1990f2);})['catch'](function(_0x5d33e0){logger['error'](_0xee50('0x21'),_0x5d33e0[_0xee50('0x1b')],_0x4445fa);_0x5c0a6f(_0x4346c5['error'](0x1f4,_0x5d33e0['message']));});});}; \ No newline at end of file +var _0xa4fa=['client','http','redis','localhost','socket.io-emitter','./mailMessage.socket','register','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MailMessage','body','options','raw','CreateMailMessage','debug','stringify','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x3ff757,_0x5895b7){var _0x14beab=function(_0x31ec5b){while(--_0x31ec5b){_0x3ff757['push'](_0x3ff757['shift']());}};_0x14beab(++_0x5895b7);}(_0xa4fa,0x1ca));var _0xaa4f=function(_0x363744,_0x21b288){_0x363744=_0x363744-0x0;var _0x5df74e=_0xa4fa[_0x363744];return _0x5df74e;};'use strict';var _=require(_0xaa4f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaa4f('0x1'));var rs=require(_0xaa4f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa4f('0x3'))['db'];var utils=require(_0xaa4f('0x4'));var logger=require('../../config/logger')(_0xaa4f('0x5'));var config=require('../../config/environment');var jayson=require(_0xaa4f('0x6'));var client=jayson[_0xaa4f('0x7')][_0xaa4f('0x8')]({'port':0x232a});config[_0xaa4f('0x9')]=_['defaults'](config['redis'],{'host':_0xaa4f('0xa'),'port':0x18eb});var socket=require(_0xaa4f('0xb'))(new Redis(config[_0xaa4f('0x9')]));require(_0xaa4f('0xc'))[_0xaa4f('0xd')](socket);function respondWithRpcPromise(_0x14869c,_0x4baccf,_0x491ec2){return new BPromise(function(_0x5c9038,_0x38637d){return client['request'](_0x14869c,_0x491ec2)[_0xaa4f('0xe')](function(_0x2a8100){logger[_0xaa4f('0xf')](_0xaa4f('0x10'),_0x4baccf,_0xaa4f('0x11'));logger['debug'](_0xaa4f('0x12'),_0x4baccf,'request\x20sent',JSON['stringify'](_0x2a8100));if(_0x2a8100[_0xaa4f('0x13')]){if(_0x2a8100['error'][_0xaa4f('0x14')]===0x1f4){logger['error'](_0xaa4f('0x10'),_0x4baccf,_0x2a8100[_0xaa4f('0x13')][_0xaa4f('0x15')]);return _0x38637d(_0x2a8100[_0xaa4f('0x13')][_0xaa4f('0x15')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x4baccf,_0x2a8100[_0xaa4f('0x13')][_0xaa4f('0x15')]);return _0x5c9038(_0x2a8100[_0xaa4f('0x13')][_0xaa4f('0x15')]);}else{logger['info'](_0xaa4f('0x10'),_0x4baccf,_0xaa4f('0x11'));_0x5c9038(_0x2a8100[_0xaa4f('0x16')][_0xaa4f('0x15')]);}})[_0xaa4f('0x17')](function(_0x48f2c0){logger['error'](_0xaa4f('0x10'),_0x4baccf,_0x48f2c0);_0x38637d(_0x48f2c0);});});}exports['CreateMailMessage']=function(_0x25503b){var _0x41465b=this;return new Promise(function(_0x177dd0,_0xa6f9f5){return db[_0xaa4f('0x18')]['create'](_0x25503b[_0xaa4f('0x19')],{'raw':_0x25503b[_0xaa4f('0x1a')]?_0x25503b[_0xaa4f('0x1a')][_0xaa4f('0x1b')]===undefined?!![]:![]:!![]})[_0xaa4f('0xe')](function(_0x50e03d){logger['info'](_0xaa4f('0x1c'),_0x25503b);logger[_0xaa4f('0x1d')](_0xaa4f('0x1c'),_0x25503b,JSON[_0xaa4f('0x1e')](_0x50e03d));_0x177dd0(_0x50e03d);})[_0xaa4f('0x17')](function(_0x2ec887){logger[_0xaa4f('0x13')](_0xaa4f('0x1c'),_0x2ec887[_0xaa4f('0x15')],_0x25503b);_0xa6f9f5(_0x41465b[_0xaa4f('0x13')](0x1f4,_0x2ec887[_0xaa4f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 59ed843..95f2de2 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 _0xc092=['register','length','mailMessage:','./mailMessage.events','save','remove','emit'];(function(_0x3a73bc,_0x550aef){var _0x32891b=function(_0x20b4cb){while(--_0x20b4cb){_0x3a73bc['push'](_0x3a73bc['shift']());}};_0x32891b(++_0x550aef);}(_0xc092,0x122));var _0x2c09=function(_0xcce543,_0x7b26a0){_0xcce543=_0xcce543-0x0;var _0x5d782a=_0xc092[_0xcce543];return _0x5d782a;};'use strict';var MailMessageEvents=require(_0x2c09('0x0'));var events=[_0x2c09('0x1'),_0x2c09('0x2'),'update'];function createListener(_0x47cb01,_0x21d536){return function(_0x4c05bd){_0x21d536[_0x2c09('0x3')](_0x47cb01,_0x4c05bd);};}function removeListener(_0x2a2358,_0x34c898){return function(){MailMessageEvents['removeListener'](_0x2a2358,_0x34c898);};}exports[_0x2c09('0x4')]=function(_0x36443f){for(var _0x41bbb9=0x0,_0x1fe23b=events[_0x2c09('0x5')];_0x41bbb9<_0x1fe23b;_0x41bbb9++){var _0x442912=events[_0x41bbb9];var _0x2e898e=createListener(_0x2c09('0x6')+_0x442912,_0x36443f);MailMessageEvents['on'](_0x442912,_0x2e898e);}}; \ No newline at end of file +var _0xfb10=['emit','register','length','mailMessage:','./mailMessage.events','save','remove','update'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xfb10,0x13c));var _0x0fb1=function(_0xd691a2,_0x331efe){_0xd691a2=_0xd691a2-0x0;var _0x4f8442=_0xfb10[_0xd691a2];return _0x4f8442;};'use strict';var MailMessageEvents=require(_0x0fb1('0x0'));var events=[_0x0fb1('0x1'),_0x0fb1('0x2'),_0x0fb1('0x3')];function createListener(_0x68aae7,_0x284f09){return function(_0x51d377){_0x284f09[_0x0fb1('0x4')](_0x68aae7,_0x51d377);};}function removeListener(_0x1e2f33,_0x179caa){return function(){MailMessageEvents['removeListener'](_0x1e2f33,_0x179caa);};}exports[_0x0fb1('0x5')]=function(_0x1cc310){for(var _0xd6a46e=0x0,_0x47ffbd=events[_0x0fb1('0x6')];_0xd6a46e<_0x47ffbd;_0xd6a46e++){var _0x241855=events[_0xd6a46e];var _0x1eeb30=createListener(_0x0fb1('0x7')+_0x241855,_0x1cc310);MailMessageEvents['on'](_0x241855,_0x1eeb30);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 9365c7d..28a28dc 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 _0x241a=['/describe','describe','/:id','isAuthenticated','show','getMembers','/:id/teams','/:id/users','getAgents','create','post','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x385c76,_0xb97335){var _0x5c8367=function(_0xdfcd3){while(--_0xdfcd3){_0x385c76['push'](_0x385c76['shift']());}};_0x5c8367(++_0xb97335);}(_0x241a,0x82));var _0xa241=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x241a[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0xa241('0x0'));var util=require(_0xa241('0x1'));var path=require(_0xa241('0x2'));var timeout=require(_0xa241('0x3'));var express=require('express');var router=express[_0xa241('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa241('0x5'));var config=require(_0xa241('0x6'));var controller=require('./mailQueue.controller');router[_0xa241('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa241('0x7')](_0xa241('0x8'),auth['isAuthenticated'](),controller[_0xa241('0x9')]);router[_0xa241('0x7')](_0xa241('0xa'),auth[_0xa241('0xb')](),controller[_0xa241('0xc')]);router[_0xa241('0x7')]('/:id/members',auth[_0xa241('0xb')](),controller[_0xa241('0xd')]);router[_0xa241('0x7')](_0xa241('0xe'),auth[_0xa241('0xb')](),controller['getTeams']);router[_0xa241('0x7')](_0xa241('0xf'),auth[_0xa241('0xb')](),controller[_0xa241('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa241('0x11')]);router[_0xa241('0x12')](_0xa241('0xe'),auth['isAuthenticated'](),controller['addTeams']);router[_0xa241('0x12')]('/:id/users',auth[_0xa241('0xb')](),controller['addAgents']);router['put'](_0xa241('0xa'),auth[_0xa241('0xb')](),controller['update']);router[_0xa241('0x13')]('/:id',auth[_0xa241('0xb')](),controller[_0xa241('0x14')]);router[_0xa241('0x13')]('/:id/teams',auth[_0xa241('0xb')](),controller[_0xa241('0x15')]);router['delete'](_0xa241('0xf'),auth[_0xa241('0xb')](),controller['removeAgents']);module[_0xa241('0x16')]=router; \ No newline at end of file +var _0xb79a=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/users','post','create','addTeams','addAgents','put','update','delete','/:id/teams','removeTeams'];(function(_0x2972cf,_0x343fde){var _0x4c173f=function(_0x30eb3a){while(--_0x30eb3a){_0x2972cf['push'](_0x2972cf['shift']());}};_0x4c173f(++_0x343fde);}(_0xb79a,0x1dc));var _0xab79=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb79a[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xab79('0x0'));var util=require(_0xab79('0x1'));var path=require(_0xab79('0x2'));var timeout=require(_0xab79('0x3'));var express=require(_0xab79('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xab79('0x5'));var config=require('../../config/environment');var controller=require(_0xab79('0x6'));router[_0xab79('0x7')]('/',auth[_0xab79('0x8')](),controller['index']);router[_0xab79('0x7')](_0xab79('0x9'),auth[_0xab79('0x8')](),controller[_0xab79('0xa')]);router[_0xab79('0x7')](_0xab79('0xb'),auth[_0xab79('0x8')](),controller[_0xab79('0xc')]);router['get'](_0xab79('0xd'),auth[_0xab79('0x8')](),controller['getMembers']);router[_0xab79('0x7')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0xab79('0x7')](_0xab79('0xe'),auth[_0xab79('0x8')](),controller['getAgents']);router[_0xab79('0xf')]('/',auth[_0xab79('0x8')](),controller[_0xab79('0x10')]);router[_0xab79('0xf')]('/:id/teams',auth[_0xab79('0x8')](),controller[_0xab79('0x11')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xab79('0x12')]);router[_0xab79('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xab79('0x14')]);router['delete'](_0xab79('0xb'),auth[_0xab79('0x8')](),controller['destroy']);router[_0xab79('0x15')](_0xab79('0x16'),auth[_0xab79('0x8')](),controller[_0xab79('0x17')]);router[_0xab79('0x15')](_0xab79('0xe'),auth[_0xab79('0x8')](),controller['removeAgents']);module[_0xab79('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 03043b0..920b07e 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 _0x9c1e=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x54095b,_0x80ad9d){var _0x29e1fd=function(_0x4964b6){while(--_0x4964b6){_0x54095b['push'](_0x54095b['shift']());}};_0x29e1fd(++_0x80ad9d);}(_0x9c1e,0x66));var _0xe9c1=function(_0x2d2073,_0x4468b7){_0x2d2073=_0x2d2073-0x0;var _0x3c4296=_0x9c1e[_0x2d2073];return _0x3c4296;};'use strict';var Sequelize=require(_0xe9c1('0x0'));module['exports']={'name':{'type':Sequelize[_0xe9c1('0x1')],'unique':_0xe9c1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe9c1('0x1')]},'timeout':{'type':Sequelize[_0xe9c1('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe9c1('0x4')](_0xe9c1('0x5'),_0xe9c1('0x6'),_0xe9c1('0x7'))}}; \ No newline at end of file +var _0x3c85=['ENUM','rrmemory','beepall','sequelize','exports','STRING','name'];(function(_0x1d7231,_0x45c9d6){var _0x146c86=function(_0x6b4cd2){while(--_0x6b4cd2){_0x1d7231['push'](_0x1d7231['shift']());}};_0x146c86(++_0x45c9d6);}(_0x3c85,0x1a0));var _0x53c8=function(_0x560f88,_0x220773){_0x560f88=_0x560f88-0x0;var _0x247ab6=_0x3c85[_0x560f88];return _0x247ab6;};'use strict';var Sequelize=require(_0x53c8('0x0'));module[_0x53c8('0x1')]={'name':{'type':Sequelize[_0x53c8('0x2')],'unique':_0x53c8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x53c8('0x4')](_0x53c8('0x5'),_0x53c8('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 89e0e32..22ebed4 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 _0xd81d=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','findOne','params','UserMailQueue','nolimit','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','rows','format','SIP','createdAt','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','each','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','TeamId','includes','all','union','value','transaction','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','limit','Content-Range','apply','save','then','destroy','MailQueues','UserProfileResource','end','name','send','index','map','MailQueue','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','count','includeAll','findAll','catch','show','filtears','include','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xd81d,0x1ec));var _0xdd81=function(_0x4b2266,_0x3778bd){_0x4b2266=_0x4b2266-0x0;var _0x3711ab=_0xd81d[_0x4b2266];return _0x3711ab;};'use strict';var pdf=require(_0xdd81('0x0'));var emlformat=require(_0xdd81('0x1'));var rimraf=require(_0xdd81('0x2'));var zipdir=require(_0xdd81('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd81('0x4'));var moment=require(_0xdd81('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdd81('0x6'));var util=require(_0xdd81('0x7'));var path=require(_0xdd81('0x8'));var sox=require(_0xdd81('0x9'));var csv=require(_0xdd81('0xa'));var ejs=require(_0xdd81('0xb'));var fs=require('fs');var _=require(_0xdd81('0xc'));var squel=require(_0xdd81('0xd'));var crypto=require(_0xdd81('0xe'));var jsforce=require(_0xdd81('0xf'));var deskjs=require(_0xdd81('0x10'));var toCsv=require(_0xdd81('0xa'));var querystring=require(_0xdd81('0x11'));var Papa=require(_0xdd81('0x12'));var Redis=require(_0xdd81('0x13'));var authService=require(_0xdd81('0x14'));var qs=require(_0xdd81('0x15'));var as=require(_0xdd81('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd81('0x17'))(_0xdd81('0x18'));var utils=require(_0xdd81('0x19'));var config=require(_0xdd81('0x1a'));var licenseUtil=require(_0xdd81('0x1b'));var db=require(_0xdd81('0x1c'))['db'];config['redis']=_[_0xdd81('0x1d')](config['redis'],{'host':_0xdd81('0x1e'),'port':0x18eb});var socket=require(_0xdd81('0x1f'))(new Redis(config['redis']));require('./mailQueue.socket')[_0xdd81('0x20')](socket);function respondWithStatusCode(_0x322936,_0x3f60c0){_0x3f60c0=_0x3f60c0||0xcc;return function(_0x36170e){if(_0x36170e){return _0x322936[_0xdd81('0x21')](_0x3f60c0);}return _0x322936['status'](_0x3f60c0)['end']();};}function respondWithResult(_0x48ec53,_0x1d7a1e){_0x1d7a1e=_0x1d7a1e||0xc8;return function(_0x37b2c4){if(_0x37b2c4){return _0x48ec53[_0xdd81('0x22')](_0x1d7a1e)[_0xdd81('0x23')](_0x37b2c4);}};}function respondWithFilteredResult(_0x4ea41d,_0x43752f){return function(_0x13989b){if(_0x13989b){var _0x37ec53=_0x13989b['count'],_0x3e34f4=_0x43752f['offset'],_0x346f06=_0x43752f[_0xdd81('0x24')]+_0x43752f[_0xdd81('0x25')],_0x5e0d24;if(_0x346f06>=_0x37ec53){_0x346f06=_0x37ec53;_0x5e0d24=0xc8;}else{_0x5e0d24=0xce;}_0x4ea41d[_0xdd81('0x22')](_0x5e0d24);return _0x4ea41d['set'](_0xdd81('0x26'),_0x3e34f4+'-'+_0x346f06+'/'+_0x37ec53)[_0xdd81('0x23')](_0x13989b);}return null;};}function patchUpdates(_0x385a3d){return function(_0x384429){try{jsonpatch[_0xdd81('0x27')](_0x384429,_0x385a3d,!![]);}catch(_0x11c380){return BPromise['reject'](_0x11c380);}return _0x384429[_0xdd81('0x28')]();};}function saveUpdates(_0x3da467,_0x153615){return function(_0xbd063e){if(_0xbd063e){return _0xbd063e['update'](_0x3da467)[_0xdd81('0x29')](function(_0x5180f6){return _0x5180f6;});}return null;};}function removeEntity(_0x2a6fe7,_0x2094ac){return function(_0x5cf92d){if(_0x5cf92d){return _0x5cf92d[_0xdd81('0x2a')]()['then'](function(){var _0x2aa1c8=_0x5cf92d['get']({'plain':!![]});var _0xde6f9=_0xdd81('0x2b');return db[_0xdd81('0x2c')][_0xdd81('0x2a')]({'where':{'type':_0xde6f9,'resourceId':_0x2aa1c8['id']}})[_0xdd81('0x29')](function(){return _0x5cf92d;});})[_0xdd81('0x29')](function(){_0x2a6fe7[_0xdd81('0x22')](0xcc)[_0xdd81('0x2d')]();});}};}function handleEntityNotFound(_0xf39d7d,_0xc5ef00){return function(_0x1631b8){if(!_0x1631b8){_0xf39d7d['sendStatus'](0x194);}return _0x1631b8;};}function handleError(_0xe7e297,_0x49adce){_0x49adce=_0x49adce||0x1f4;return function(_0x38ebfe){logger['error'](_0x38ebfe['stack']);if(_0x38ebfe[_0xdd81('0x2e')]){delete _0x38ebfe['name'];}_0xe7e297[_0xdd81('0x22')](_0x49adce)[_0xdd81('0x2f')](_0x38ebfe);};}exports[_0xdd81('0x30')]=function(_0xa71c74,_0xdce66f){var _0x46c622={},_0x1b3c20={},_0xda54ea={'count':0x0,'rows':[]};var _0x3816cb=_[_0xdd81('0x31')](db[_0xdd81('0x32')][_0xdd81('0x33')],function(_0x3b3cc4){return{'name':_0x3b3cc4[_0xdd81('0x34')],'type':_0x3b3cc4[_0xdd81('0x35')]['key']};});_0x1b3c20[_0xdd81('0x36')]=_[_0xdd81('0x31')](_0x3816cb,_0xdd81('0x2e'));_0x1b3c20[_0xdd81('0x37')]=_[_0xdd81('0x38')](_0xa71c74[_0xdd81('0x37')]);_0x1b3c20['filters']=_[_0xdd81('0x39')](_0x1b3c20[_0xdd81('0x36')],_0x1b3c20[_0xdd81('0x37')]);_0x46c622['attributes']=_[_0xdd81('0x39')](_0x1b3c20[_0xdd81('0x36')],qs['fields'](_0xa71c74[_0xdd81('0x37')][_0xdd81('0x3a')]));_0x46c622['attributes']=_0x46c622[_0xdd81('0x3b')][_0xdd81('0x3c')]?_0x46c622['attributes']:_0x1b3c20[_0xdd81('0x36')];if(!_0xa71c74['query'][_0xdd81('0x3d')]('nolimit')){_0x46c622[_0xdd81('0x25')]=qs['limit'](_0xa71c74[_0xdd81('0x37')][_0xdd81('0x25')]);_0x46c622['offset']=qs[_0xdd81('0x24')](_0xa71c74[_0xdd81('0x37')][_0xdd81('0x24')]);}_0x46c622[_0xdd81('0x3e')]=qs[_0xdd81('0x3f')](_0xa71c74[_0xdd81('0x37')]['sort']);_0x46c622[_0xdd81('0x40')]=qs[_0xdd81('0x41')](_[_0xdd81('0x42')](_0xa71c74[_0xdd81('0x37')],_0x1b3c20[_0xdd81('0x41')]),_0x3816cb);if(_0xa71c74[_0xdd81('0x37')][_0xdd81('0x43')]){_0x46c622[_0xdd81('0x40')]=_[_0xdd81('0x44')](_0x46c622[_0xdd81('0x40')],{'$or':_[_0xdd81('0x31')](_0x3816cb,function(_0x5f2d0d){if(_0x5f2d0d[_0xdd81('0x35')]!=='VIRTUAL'){var _0x31388b={};_0x31388b[_0x5f2d0d[_0xdd81('0x2e')]]={'$like':'%'+_0xa71c74[_0xdd81('0x37')][_0xdd81('0x43')]+'%'};return _0x31388b;}})});}_0x46c622=_[_0xdd81('0x44')]({},_0x46c622,_0xa71c74[_0xdd81('0x45')]);var _0x416ece={'where':_0x46c622[_0xdd81('0x40')]};return db[_0xdd81('0x32')]['count'](_0x416ece)[_0xdd81('0x29')](function(_0x3eb4e3){_0xda54ea[_0xdd81('0x46')]=_0x3eb4e3;if(_0xa71c74[_0xdd81('0x37')][_0xdd81('0x47')]){_0x46c622['include']=[{'all':!![]}];}return db[_0xdd81('0x32')][_0xdd81('0x48')](_0x46c622);})[_0xdd81('0x29')](function(_0x5a2af2){_0xda54ea['rows']=_0x5a2af2;return _0xda54ea;})[_0xdd81('0x29')](respondWithFilteredResult(_0xdce66f,_0x46c622))[_0xdd81('0x49')](handleError(_0xdce66f,null));};exports[_0xdd81('0x4a')]=function(_0x378f3f,_0x342e04){var _0x333f1c={'raw':!![],'where':{'id':_0x378f3f['params']['id']}},_0x472354={};_0x472354['model']=_['keys'](db[_0xdd81('0x32')][_0xdd81('0x33')]);_0x472354[_0xdd81('0x37')]=_[_0xdd81('0x38')](_0x378f3f[_0xdd81('0x37')]);_0x472354[_0xdd81('0x4b')]=_['intersection'](_0x472354[_0xdd81('0x36')],_0x472354['query']);_0x333f1c['attributes']=_[_0xdd81('0x39')](_0x472354[_0xdd81('0x36')],qs['fields'](_0x378f3f[_0xdd81('0x37')][_0xdd81('0x3a')]));_0x333f1c[_0xdd81('0x3b')]=_0x333f1c[_0xdd81('0x3b')]['length']?_0x333f1c[_0xdd81('0x3b')]:_0x472354[_0xdd81('0x36')];if(_0x378f3f[_0xdd81('0x37')][_0xdd81('0x47')]){_0x333f1c[_0xdd81('0x4c')]=[{'all':!![]}];}_0x333f1c=_['merge']({},_0x333f1c,_0x378f3f[_0xdd81('0x45')]);return db[_0xdd81('0x32')]['find'](_0x333f1c)[_0xdd81('0x29')](handleEntityNotFound(_0x342e04,null))[_0xdd81('0x29')](respondWithResult(_0x342e04,null))[_0xdd81('0x49')](handleError(_0x342e04,null));};exports[_0xdd81('0x4d')]=function(_0x13f637,_0x389016){return db[_0xdd81('0x32')][_0xdd81('0x4d')](_0x13f637[_0xdd81('0x4e')],{})[_0xdd81('0x29')](function(_0xe2b364){var _0x38e746=_0x13f637['user'][_0xdd81('0x4f')]({'plain':!![]});if(!_0x38e746)throw new Error(_0xdd81('0x50'));if(_0x38e746[_0xdd81('0x51')]==='user'){var _0x6b3b11=_0xe2b364[_0xdd81('0x4f')]({'plain':!![]});var _0x27b979=_0xdd81('0x2b');return db[_0xdd81('0x52')]['find']({'where':{'name':_0x27b979,'userProfileId':_0x38e746['userProfileId']},'raw':!![]})[_0xdd81('0x29')](function(_0x6305b){if(_0x6305b&&_0x6305b[_0xdd81('0x53')]===0x0){return db[_0xdd81('0x2c')][_0xdd81('0x4d')]({'name':_0x6b3b11[_0xdd81('0x2e')],'resourceId':_0x6b3b11['id'],'type':_0x6305b[_0xdd81('0x2e')],'sectionId':_0x6305b['id']},{})[_0xdd81('0x29')](function(){return _0xe2b364;});}else{return _0xe2b364;}})['catch'](function(_0x251d57){logger['error'](_0xdd81('0x54'),_0x251d57);throw _0x251d57;});}return _0xe2b364;})[_0xdd81('0x29')](respondWithResult(_0x389016,0xc9))['catch'](handleError(_0x389016,null));};exports['update']=function(_0x4a9b37,_0x275eed){if(_0x4a9b37[_0xdd81('0x4e')]['id']){delete _0x4a9b37['body']['id'];}return db[_0xdd81('0x32')][_0xdd81('0x55')]({'where':{'id':_0x4a9b37['params']['id']}})[_0xdd81('0x29')](handleEntityNotFound(_0x275eed,null))['then'](saveUpdates(_0x4a9b37[_0xdd81('0x4e')],null))[_0xdd81('0x29')](respondWithResult(_0x275eed,null))[_0xdd81('0x49')](handleError(_0x275eed,null));};exports['destroy']=function(_0x164c29,_0x1c59d8){return db[_0xdd81('0x32')][_0xdd81('0x55')]({'where':{'id':_0x164c29['params']['id']}})[_0xdd81('0x29')](handleEntityNotFound(_0x1c59d8,null))[_0xdd81('0x29')](removeEntity(_0x1c59d8,null))[_0xdd81('0x49')](handleError(_0x1c59d8,null));};exports[_0xdd81('0x56')]=function(_0x270638,_0x28c5f2){return db[_0xdd81('0x32')][_0xdd81('0x56')]()['then'](respondWithResult(_0x28c5f2,null))[_0xdd81('0x49')](handleError(_0x28c5f2,null));};exports[_0xdd81('0x57')]=function(_0x4fcdc4,_0x41e5c8,_0x3cb247){var _0x5c2193={'raw':!![],'where':{}},_0x490e00={},_0x3812c0;return db[_0xdd81('0x32')][_0xdd81('0x58')]({'where':{'id':_0x4fcdc4[_0xdd81('0x59')]['id']}})[_0xdd81('0x29')](handleEntityNotFound(_0x41e5c8,null))[_0xdd81('0x29')](function(_0x5ba05d){if(_0x5ba05d){_0x3812c0=_0x5ba05d[_0xdd81('0x4f')]({'plain':!![]});_0x490e00['model']=_[_0xdd81('0x38')](db[_0xdd81('0x5a')][_0xdd81('0x33')]);_0x490e00[_0xdd81('0x37')]=_[_0xdd81('0x38')](_0x4fcdc4[_0xdd81('0x37')]);_0x490e00[_0xdd81('0x41')]=_[_0xdd81('0x39')](_0x490e00[_0xdd81('0x36')],_0x490e00[_0xdd81('0x37')]);_0x5c2193['attributes']=_[_0xdd81('0x39')](_0x490e00['model'],qs['fields'](_0x4fcdc4['query'][_0xdd81('0x3a')]));_0x5c2193[_0xdd81('0x3b')]=_0x5c2193['attributes'][_0xdd81('0x3c')]?_0x5c2193[_0xdd81('0x3b')]:_0x490e00[_0xdd81('0x36')];if(!_0x4fcdc4['query'][_0xdd81('0x3d')](_0xdd81('0x5b'))){_0x5c2193['limit']=qs[_0xdd81('0x25')](_0x4fcdc4['query']['limit']);_0x5c2193[_0xdd81('0x24')]=qs[_0xdd81('0x24')](_0x4fcdc4[_0xdd81('0x37')][_0xdd81('0x24')]);}_0x5c2193[_0xdd81('0x3e')]=qs['sort'](_0x4fcdc4['query'][_0xdd81('0x3f')]);_0x5c2193['where']=qs[_0xdd81('0x41')](_[_0xdd81('0x42')](_0x4fcdc4[_0xdd81('0x37')],_0x490e00['filters']));_0x5c2193[_0xdd81('0x40')][_0xdd81('0x5c')]=_0x5ba05d['id'];if(_0x4fcdc4['query'][_0xdd81('0x43')]){_0x5c2193[_0xdd81('0x40')]=_[_0xdd81('0x44')](_0x5c2193[_0xdd81('0x40')],{'$or':_[_0xdd81('0x31')](_0x5c2193['attributes'],function(_0x22b6cd){var _0x1aa46f={};_0x1aa46f[_0x22b6cd]={'$like':'%'+_0x4fcdc4[_0xdd81('0x37')]['filter']+'%'};return _0x1aa46f;})});}_0x5c2193=_[_0xdd81('0x44')]({},_0x5c2193,_0x4fcdc4[_0xdd81('0x45')]);return db[_0xdd81('0x5a')][_0xdd81('0x48')](_0x5c2193);}})[_0xdd81('0x29')](function(_0x497b97){if(_0x497b97){return db[_0xdd81('0x5d')][_0xdd81('0x5e')]({'where':{'id':_[_0xdd81('0x31')](_0x497b97,_0xdd81('0x5f')),'role':_0xdd81('0x60')},'attributes':['id',_0xdd81('0x2e'),_0xdd81('0x61'),_0xdd81('0x62'),'createdAt']});}})[_0xdd81('0x29')](function(_0x13685e){if(_0x13685e){return{'count':_0x13685e[_0xdd81('0x46')],'rows':_[_0xdd81('0x31')](_0x13685e[_0xdd81('0x63')],function(_0x38c9ff){return{'membername':_0x38c9ff[_0xdd81('0x2e')],'UserId':_0x38c9ff['id'],'queue_name':_0x3812c0[_0xdd81('0x2e')],'MailQueueId':_0x3812c0['id'],'interface':util[_0xdd81('0x64')]('%s/%s',_0xdd81('0x65'),_0x38c9ff[_0xdd81('0x2e')]),'penalty':0x0,'paused':_0x38c9ff[_0xdd81('0x61')],'createdAt':_0x38c9ff[_0xdd81('0x66')],'updatedAt':_0x38c9ff[_0xdd81('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdd81('0x29')](respondWithFilteredResult(_0x41e5c8,_0x5c2193))[_0xdd81('0x49')](handleError(_0x41e5c8,null));};exports[_0xdd81('0x67')]=function(_0x41774c,_0x31e33f,_0x4d029a){var _0x14eb64={};var _0xa40dc4={};var _0x1ae3ad;var _0x5b09f4;return db[_0xdd81('0x32')][_0xdd81('0x58')]({'where':{'id':_0x41774c[_0xdd81('0x59')]['id']}})[_0xdd81('0x29')](handleEntityNotFound(_0x31e33f,null))['then'](function(_0x444f31){if(_0x444f31){_0x1ae3ad=_0x444f31;_0xa40dc4[_0xdd81('0x36')]=_['keys'](db['Team']['rawAttributes']);_0xa40dc4['query']=_[_0xdd81('0x38')](_0x41774c[_0xdd81('0x37')]);_0xa40dc4['filters']=_[_0xdd81('0x39')](_0xa40dc4[_0xdd81('0x36')],_0xa40dc4[_0xdd81('0x37')]);_0x14eb64[_0xdd81('0x3b')]=_[_0xdd81('0x39')](_0xa40dc4['model'],qs[_0xdd81('0x3a')](_0x41774c[_0xdd81('0x37')][_0xdd81('0x3a')]));_0x14eb64[_0xdd81('0x3b')]=_0x14eb64[_0xdd81('0x3b')]['length']?_0x14eb64['attributes']:_0xa40dc4['model'];_0x14eb64[_0xdd81('0x3e')]=qs[_0xdd81('0x3f')](_0x41774c[_0xdd81('0x37')]['sort']);_0x14eb64['where']=qs[_0xdd81('0x41')](_[_0xdd81('0x42')](_0x41774c[_0xdd81('0x37')],_0xa40dc4[_0xdd81('0x41')]));if(_0x41774c[_0xdd81('0x37')][_0xdd81('0x43')]){_0x14eb64[_0xdd81('0x40')]=_['merge'](_0x14eb64[_0xdd81('0x40')],{'$or':_[_0xdd81('0x31')](_0x14eb64[_0xdd81('0x3b')],function(_0x4c27c7){var _0x1dbbe2={};_0x1dbbe2[_0x4c27c7]={'$like':'%'+_0x41774c[_0xdd81('0x37')]['filter']+'%'};return _0x1dbbe2;})});}_0x14eb64=_[_0xdd81('0x44')]({},_0x14eb64,_0x41774c[_0xdd81('0x45')]);return _0x1ae3ad[_0xdd81('0x67')](_0x14eb64);}})[_0xdd81('0x29')](function(_0x2c9b04){if(_0x2c9b04){_0x5b09f4=_0x2c9b04[_0xdd81('0x3c')];if(!_0x41774c[_0xdd81('0x37')][_0xdd81('0x3d')](_0xdd81('0x5b'))){_0x14eb64['limit']=qs[_0xdd81('0x25')](_0x41774c[_0xdd81('0x37')][_0xdd81('0x25')]);_0x14eb64[_0xdd81('0x24')]=qs['offset'](_0x41774c[_0xdd81('0x37')]['offset']);}return _0x1ae3ad[_0xdd81('0x67')](_0x14eb64);}})[_0xdd81('0x29')](function(_0x70163a){if(_0x70163a){return _0x70163a?{'count':_0x5b09f4,'rows':_0x70163a}:null;}})[_0xdd81('0x29')](respondWithResult(_0x31e33f,null))[_0xdd81('0x49')](handleError(_0x31e33f,null));};exports[_0xdd81('0x68')]=function(_0x5671f4,_0xd9bf53,_0x53ace1){var _0x1df2dd=_0x5671f4[_0xdd81('0x4e')][_0xdd81('0x69')];return db[_0xdd81('0x6a')][_0xdd81('0x48')]({'where':{'id':_0x1df2dd},'attributes':['id'],'include':[{'model':db[_0xdd81('0x5d')],'as':_0xdd81('0x6b'),'attributes':['id','name',_0xdd81('0x6c'),_0xdd81('0x6d'),_0xdd81('0x6e')],'raw':!![]}]})['then'](function(_0xef762c){if(_0xef762c){var _0x5d0cbd=_[_0xdd81('0x6f')](_0xef762c,function(_0x251cc5){var _0x19af98=_0x251cc5[_0xdd81('0x4f')]({'plain':!![]});return _0x19af98[_0xdd81('0x6b')];});return db[_0xdd81('0x32')][_0xdd81('0x55')]({'where':{'id':_0x5671f4[_0xdd81('0x59')]['id']}})[_0xdd81('0x29')](function(_0x48c481){return db[_0xdd81('0x70')]['transaction'](function(_0x27ee4b){return _0x48c481[_0xdd81('0x68')](_0x1df2dd,{'transaction':_0x27ee4b})[_0xdd81('0x29')](function(){return BPromise[_0xdd81('0x71')](_0x5d0cbd,function(_0xd4232e){return db[_0xdd81('0x5a')]['findOrCreate']({'where':{'UserId':_0xd4232e['id'],'MailQueueId':_0x5671f4[_0xdd81('0x59')]['id']},'transaction':_0x27ee4b});});})[_0xdd81('0x29')](function(){_0x5d0cbd[_0xdd81('0x72')](function(_0x103351){socket[_0xdd81('0x73')](_0xdd81('0x74'),{'UserId':_0x103351['id'],'MailQueueId':_0x48c481['id']});});});});});}})[_0xdd81('0x29')](respondWithStatusCode(_0xd9bf53,null))[_0xdd81('0x49')](handleError(_0xd9bf53,null));};exports[_0xdd81('0x75')]=function(_0x226909,_0x523ce1,_0x1d16b7){return db['Team'][_0xdd81('0x48')]({'where':{'id':_0x226909[_0xdd81('0x37')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdd81('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xdd81('0x29')](handleEntityNotFound(_0x523ce1,null))[_0xdd81('0x29')](function(_0x4c1313){var _0xbec74a=_['map'](_0x4c1313,'id');var _0x37fcf0=[];var _0x4fada3=[];var _0x3ccec0=squel[_0xdd81('0x76')]();_0x3ccec0[_0xdd81('0x77')](_0xdd81('0x78'))[_0xdd81('0x79')](_0xdd81('0x7a'),'tq')[_0xdd81('0x7b')](_0xdd81('0x7c'),'ut',_0xdd81('0x7d'))['where']('MailQueueId\x20=\x20?',_0x226909[_0xdd81('0x59')]['id']);for(var _0x3fd6a6=0x0;_0x3fd6a6<_0x4c1313[_0xdd81('0x3c')];_0x3fd6a6+=0x1){let _0x5df560=_0x4c1313[_0x3fd6a6];for(var _0x43fb3e=0x0;_0x43fb3e<_0x5df560[_0xdd81('0x6b')][_0xdd81('0x3c')];_0x43fb3e+=0x1){let _0x5b429e=_0x5df560[_0xdd81('0x6b')][_0x43fb3e];var _0xfa9e1b=_0x3ccec0[_0xdd81('0x7e')]();_0xfa9e1b[_0xdd81('0x40')](_0xdd81('0x7f'),_0x5b429e['id']);_0x4fada3['push'](db[_0xdd81('0x70')][_0xdd81('0x37')](_0xfa9e1b['toString'](),{'type':db['sequelize'][_0xdd81('0x80')][_0xdd81('0x81')]})[_0xdd81('0x29')](function(_0x362476){if(_0x362476[_0xdd81('0x3c')]===0x1){return _0x5b429e['id'];}else{var _0x1dd4e0=_['every'](_[_0xdd81('0x31')](_0x362476,_0xdd81('0x82')),function(_0x2fcc95){return _[_0xdd81('0x83')](_0xbec74a,_0x2fcc95);});if(_0x1dd4e0){return _0x5b429e['id'];}}}));}}return BPromise[_0xdd81('0x84')](_0x4fada3)['then'](function(_0x58a005){_0x37fcf0=_(_0x37fcf0)[_0xdd81('0x85')](_0x58a005)['compact']()[_0xdd81('0x86')]();return db['MailQueue'][_0xdd81('0x55')]({'where':{'id':_0x226909[_0xdd81('0x59')]['id']}})['then'](function(_0x32c81b){return db[_0xdd81('0x70')][_0xdd81('0x87')](function(_0x520b4c){return _0x32c81b['removeTeams'](_0x226909[_0xdd81('0x37')]['ids'],{'transaction':_0x520b4c})[_0xdd81('0x29')](function(){if(!_[_0xdd81('0x88')](_0x37fcf0)){return _0x32c81b[_0xdd81('0x89')](_0x37fcf0,{'transaction':_0x520b4c});}})['then'](function(){_0x37fcf0[_0xdd81('0x72')](function(_0x11b38f){socket[_0xdd81('0x73')](_0xdd81('0x8a'),{'UserId':_0x11b38f,'MailQueueId':_0x32c81b['id']});});});});});});})[_0xdd81('0x29')](respondWithStatusCode(_0x523ce1,null))[_0xdd81('0x49')](handleError(_0x523ce1,null));};exports[_0xdd81('0x8b')]=function(_0x303696,_0x5d6710,_0x1d405e){return db[_0xdd81('0x32')][_0xdd81('0x55')]({'where':{'id':_0x303696[_0xdd81('0x59')]['id']}})[_0xdd81('0x29')](handleEntityNotFound(_0x5d6710,null))[_0xdd81('0x29')](function(_0x5c9e43){if(_0x5c9e43){return _0x5c9e43[_0xdd81('0x8b')](_0x303696[_0xdd81('0x4e')][_0xdd81('0x69')],_[_0xdd81('0x8c')](_0x303696[_0xdd81('0x4e')],[_0xdd81('0x69'),'id'])||{})[_0xdd81('0x8d')](function(_0x19c18a){for(var _0x43a438=0x0;_0x43a438<_0x303696[_0xdd81('0x4e')]['ids'][_0xdd81('0x3c')];_0x43a438+=0x1){socket[_0xdd81('0x73')](_0xdd81('0x74'),{'UserId':_0x303696[_0xdd81('0x4e')][_0xdd81('0x69')][_0x43a438],'MailQueueId':_0x303696[_0xdd81('0x59')]['id']});}return _0x19c18a;});}})[_0xdd81('0x29')](respondWithResult(_0x5d6710,null))['catch'](handleError(_0x5d6710,null));};exports[_0xdd81('0x89')]=function(_0x12db80,_0x266836,_0xb3a8a0){return db['MailQueue']['find']({'where':{'id':_0x12db80[_0xdd81('0x59')]['id']}})[_0xdd81('0x29')](handleEntityNotFound(_0x266836,null))['then'](function(_0x1d51bd){if(_0x1d51bd){return _0x1d51bd[_0xdd81('0x89')](_0x12db80[_0xdd81('0x37')][_0xdd81('0x69')])['then'](function(){if(_[_0xdd81('0x8e')](_0x12db80[_0xdd81('0x37')]['ids'])){for(var _0x1c5a35=0x0;_0x1c5a35<_0x12db80[_0xdd81('0x37')][_0xdd81('0x69')]['length'];_0x1c5a35+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x12db80[_0xdd81('0x37')][_0xdd81('0x69')][_0x1c5a35]),'MailQueueId':Number(_0x12db80[_0xdd81('0x59')]['id'])});}}else{socket[_0xdd81('0x73')](_0xdd81('0x8a'),{'UserId':Number(_0x12db80[_0xdd81('0x37')][_0xdd81('0x69')]),'MailQueueId':Number(_0x12db80[_0xdd81('0x59')]['id'])});}});}})[_0xdd81('0x29')](respondWithStatusCode(_0x266836,null))[_0xdd81('0x49')](handleError(_0x266836,null));};exports[_0xdd81('0x8f')]=function(_0x46672e,_0x3552d8,_0x147234){var _0xa8401b={};var _0x3f1129={};var _0x66a3c9;var _0x33dce0;return db[_0xdd81('0x32')][_0xdd81('0x58')]({'where':{'id':_0x46672e[_0xdd81('0x59')]['id']}})[_0xdd81('0x29')](handleEntityNotFound(_0x3552d8,null))['then'](function(_0x5758d9){if(_0x5758d9){_0x66a3c9=_0x5758d9;_0x3f1129[_0xdd81('0x36')]=_['keys'](db[_0xdd81('0x5d')]['rawAttributes']);_0x3f1129[_0xdd81('0x37')]=_[_0xdd81('0x38')](_0x46672e[_0xdd81('0x37')]);_0x3f1129[_0xdd81('0x41')]=_['intersection'](_0x3f1129[_0xdd81('0x36')],_0x3f1129['query']);_0xa8401b['attributes']=_['intersection'](_0x3f1129[_0xdd81('0x36')],qs[_0xdd81('0x3a')](_0x46672e[_0xdd81('0x37')][_0xdd81('0x3a')]));_0xa8401b[_0xdd81('0x3b')]=_0xa8401b[_0xdd81('0x3b')][_0xdd81('0x3c')]?_0xa8401b[_0xdd81('0x3b')]:_0x3f1129[_0xdd81('0x36')];_0xa8401b[_0xdd81('0x3e')]=qs[_0xdd81('0x3f')](_0x46672e[_0xdd81('0x37')]['sort']);_0xa8401b[_0xdd81('0x40')]=qs[_0xdd81('0x41')](_['pick'](_0x46672e[_0xdd81('0x37')],_0x3f1129['filters']));if(_0x46672e[_0xdd81('0x37')][_0xdd81('0x43')]){_0xa8401b[_0xdd81('0x40')]=_[_0xdd81('0x44')](_0xa8401b[_0xdd81('0x40')],{'$or':_[_0xdd81('0x31')](_0xa8401b[_0xdd81('0x3b')],function(_0x32941d){var _0x30c459={};_0x30c459[_0x32941d]={'$like':'%'+_0x46672e['query']['filter']+'%'};return _0x30c459;})});}_0xa8401b=_[_0xdd81('0x44')]({},_0xa8401b,_0x46672e[_0xdd81('0x45')]);return _0x66a3c9[_0xdd81('0x8f')](_0xa8401b);}})[_0xdd81('0x29')](function(_0xc30d97){if(_0xc30d97){_0x33dce0=_0xc30d97['length'];if(!_0x46672e['query'][_0xdd81('0x3d')](_0xdd81('0x5b'))){_0xa8401b['limit']=qs[_0xdd81('0x25')](_0x46672e[_0xdd81('0x37')][_0xdd81('0x25')]);_0xa8401b[_0xdd81('0x24')]=qs[_0xdd81('0x24')](_0x46672e[_0xdd81('0x37')][_0xdd81('0x24')]);}return _0x66a3c9[_0xdd81('0x8f')](_0xa8401b);}})[_0xdd81('0x29')](function(_0x85936a){if(_0x85936a){return _0x85936a?{'count':_0x33dce0,'rows':_0x85936a}:null;}})[_0xdd81('0x29')](respondWithResult(_0x3552d8,null))[_0xdd81('0x49')](handleError(_0x3552d8,null));}; \ No newline at end of file +var _0xa024=['spread','isArray','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','MailQueues','sendStatus','error','name','send','index','map','MailQueue','fieldName','type','key','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','filtears','intersection','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','MailQueueId','User','agent','mailPause','updatedAt','createdAt','format','findOne','Team','rawAttributes','getTeams','addTeams','body','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','TeamId','includes','all','union','value','removeAgents','userMailQueue:remove','addAgents','omit'];(function(_0x276c8d,_0x437fa6){var _0x51c99f=function(_0x474eb5){while(--_0x474eb5){_0x276c8d['push'](_0x276c8d['shift']());}};_0x51c99f(++_0x437fa6);}(_0xa024,0x8f));var _0x4a02=function(_0x3da826,_0x4a5592){_0x3da826=_0x3da826-0x0;var _0x3b22d2=_0xa024[_0x3da826];return _0x3b22d2;};'use strict';var pdf=require(_0x4a02('0x0'));var emlformat=require(_0x4a02('0x1'));var rimraf=require(_0x4a02('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a02('0x3'));var rp=require(_0x4a02('0x4'));var moment=require(_0x4a02('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4a02('0x6'));var util=require(_0x4a02('0x7'));var path=require(_0x4a02('0x8'));var sox=require(_0x4a02('0x9'));var csv=require(_0x4a02('0xa'));var ejs=require(_0x4a02('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4a02('0xc'));var crypto=require(_0x4a02('0xd'));var jsforce=require(_0x4a02('0xe'));var deskjs=require(_0x4a02('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4a02('0x10'));var Papa=require(_0x4a02('0x11'));var Redis=require(_0x4a02('0x12'));var authService=require(_0x4a02('0x13'));var qs=require(_0x4a02('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a02('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x4a02('0x16'));var config=require(_0x4a02('0x17'));var licenseUtil=require(_0x4a02('0x18'));var db=require(_0x4a02('0x19'))['db'];config[_0x4a02('0x1a')]=_[_0x4a02('0x1b')](config['redis'],{'host':_0x4a02('0x1c'),'port':0x18eb});var socket=require(_0x4a02('0x1d'))(new Redis(config[_0x4a02('0x1a')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x5370a4,_0x169d2e){_0x169d2e=_0x169d2e||0xcc;return function(_0x400739){if(_0x400739){return _0x5370a4['sendStatus'](_0x169d2e);}return _0x5370a4[_0x4a02('0x1e')](_0x169d2e)[_0x4a02('0x1f')]();};}function respondWithResult(_0x144447,_0x26ab04){_0x26ab04=_0x26ab04||0xc8;return function(_0xbc827a){if(_0xbc827a){return _0x144447[_0x4a02('0x1e')](_0x26ab04)[_0x4a02('0x20')](_0xbc827a);}};}function respondWithFilteredResult(_0x5d7cdd,_0x5c4d41){return function(_0x4180cd){if(_0x4180cd){var _0x46aa4f=_0x4180cd[_0x4a02('0x21')],_0x12fd71=_0x5c4d41[_0x4a02('0x22')],_0x3a3b1f=_0x5c4d41[_0x4a02('0x22')]+_0x5c4d41[_0x4a02('0x23')],_0x130d0b;if(_0x3a3b1f>=_0x46aa4f){_0x3a3b1f=_0x46aa4f;_0x130d0b=0xc8;}else{_0x130d0b=0xce;}_0x5d7cdd['status'](_0x130d0b);return _0x5d7cdd['set'](_0x4a02('0x24'),_0x12fd71+'-'+_0x3a3b1f+'/'+_0x46aa4f)[_0x4a02('0x20')](_0x4180cd);}return null;};}function patchUpdates(_0x2e79fd){return function(_0x52ea19){try{jsonpatch[_0x4a02('0x25')](_0x52ea19,_0x2e79fd,!![]);}catch(_0x553e6b){return BPromise[_0x4a02('0x26')](_0x553e6b);}return _0x52ea19['save']();};}function saveUpdates(_0x42cf4f,_0x30e65f){return function(_0x2db545){if(_0x2db545){return _0x2db545[_0x4a02('0x27')](_0x42cf4f)[_0x4a02('0x28')](function(_0x1dbe2a){return _0x1dbe2a;});}return null;};}function removeEntity(_0x43bb66,_0x3bb82c){return function(_0x19b9c7){if(_0x19b9c7){return _0x19b9c7[_0x4a02('0x29')]()['then'](function(){var _0x17b57e=_0x19b9c7['get']({'plain':!![]});var _0xfe1193=_0x4a02('0x2a');return db['UserProfileResource'][_0x4a02('0x29')]({'where':{'type':_0xfe1193,'resourceId':_0x17b57e['id']}})[_0x4a02('0x28')](function(){return _0x19b9c7;});})['then'](function(){_0x43bb66[_0x4a02('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26dedf,_0x302e68){return function(_0x18dd14){if(!_0x18dd14){_0x26dedf[_0x4a02('0x2b')](0x194);}return _0x18dd14;};}function handleError(_0x3301eb,_0x53605e){_0x53605e=_0x53605e||0x1f4;return function(_0x605de4){logger[_0x4a02('0x2c')](_0x605de4['stack']);if(_0x605de4[_0x4a02('0x2d')]){delete _0x605de4[_0x4a02('0x2d')];}_0x3301eb['status'](_0x53605e)[_0x4a02('0x2e')](_0x605de4);};}exports[_0x4a02('0x2f')]=function(_0x41dbb3,_0x3c42d3){var _0x797d0={},_0x2bd9fa={},_0x27b291={'count':0x0,'rows':[]};var _0x4ebebd=_[_0x4a02('0x30')](db[_0x4a02('0x31')]['rawAttributes'],function(_0x1edb87){return{'name':_0x1edb87[_0x4a02('0x32')],'type':_0x1edb87[_0x4a02('0x33')][_0x4a02('0x34')]};});_0x2bd9fa[_0x4a02('0x35')]=_[_0x4a02('0x30')](_0x4ebebd,_0x4a02('0x2d'));_0x2bd9fa['query']=_[_0x4a02('0x36')](_0x41dbb3[_0x4a02('0x37')]);_0x2bd9fa['filters']=_['intersection'](_0x2bd9fa[_0x4a02('0x35')],_0x2bd9fa[_0x4a02('0x37')]);_0x797d0[_0x4a02('0x38')]=_['intersection'](_0x2bd9fa['model'],qs[_0x4a02('0x39')](_0x41dbb3['query'][_0x4a02('0x39')]));_0x797d0[_0x4a02('0x38')]=_0x797d0['attributes'][_0x4a02('0x3a')]?_0x797d0['attributes']:_0x2bd9fa['model'];if(!_0x41dbb3[_0x4a02('0x37')][_0x4a02('0x3b')](_0x4a02('0x3c'))){_0x797d0[_0x4a02('0x23')]=qs['limit'](_0x41dbb3[_0x4a02('0x37')][_0x4a02('0x23')]);_0x797d0[_0x4a02('0x22')]=qs[_0x4a02('0x22')](_0x41dbb3[_0x4a02('0x37')][_0x4a02('0x22')]);}_0x797d0[_0x4a02('0x3d')]=qs[_0x4a02('0x3e')](_0x41dbb3[_0x4a02('0x37')][_0x4a02('0x3e')]);_0x797d0[_0x4a02('0x3f')]=qs[_0x4a02('0x40')](_[_0x4a02('0x41')](_0x41dbb3[_0x4a02('0x37')],_0x2bd9fa[_0x4a02('0x40')]),_0x4ebebd);if(_0x41dbb3[_0x4a02('0x37')][_0x4a02('0x42')]){_0x797d0[_0x4a02('0x3f')]=_['merge'](_0x797d0['where'],{'$or':_[_0x4a02('0x30')](_0x4ebebd,function(_0x4eacf5){if(_0x4eacf5[_0x4a02('0x33')]!==_0x4a02('0x43')){var _0x55d7e0={};_0x55d7e0[_0x4eacf5[_0x4a02('0x2d')]]={'$like':'%'+_0x41dbb3[_0x4a02('0x37')][_0x4a02('0x42')]+'%'};return _0x55d7e0;}})});}_0x797d0=_[_0x4a02('0x44')]({},_0x797d0,_0x41dbb3[_0x4a02('0x45')]);var _0x5271b8={'where':_0x797d0[_0x4a02('0x3f')]};return db[_0x4a02('0x31')]['count'](_0x5271b8)[_0x4a02('0x28')](function(_0x16225f){_0x27b291[_0x4a02('0x21')]=_0x16225f;if(_0x41dbb3[_0x4a02('0x37')][_0x4a02('0x46')]){_0x797d0[_0x4a02('0x47')]=[{'all':!![]}];}return db[_0x4a02('0x31')][_0x4a02('0x48')](_0x797d0);})['then'](function(_0x13dda4){_0x27b291[_0x4a02('0x49')]=_0x13dda4;return _0x27b291;})[_0x4a02('0x28')](respondWithFilteredResult(_0x3c42d3,_0x797d0))[_0x4a02('0x4a')](handleError(_0x3c42d3,null));};exports[_0x4a02('0x4b')]=function(_0x1e3bae,_0x45f637){var _0x2413da={'raw':!![],'where':{'id':_0x1e3bae[_0x4a02('0x4c')]['id']}},_0x17b91b={};_0x17b91b[_0x4a02('0x35')]=_[_0x4a02('0x36')](db['MailQueue']['rawAttributes']);_0x17b91b[_0x4a02('0x37')]=_['keys'](_0x1e3bae['query']);_0x17b91b[_0x4a02('0x4d')]=_[_0x4a02('0x4e')](_0x17b91b['model'],_0x17b91b[_0x4a02('0x37')]);_0x2413da[_0x4a02('0x38')]=_[_0x4a02('0x4e')](_0x17b91b[_0x4a02('0x35')],qs['fields'](_0x1e3bae[_0x4a02('0x37')][_0x4a02('0x39')]));_0x2413da[_0x4a02('0x38')]=_0x2413da[_0x4a02('0x38')]['length']?_0x2413da[_0x4a02('0x38')]:_0x17b91b[_0x4a02('0x35')];if(_0x1e3bae['query']['includeAll']){_0x2413da[_0x4a02('0x47')]=[{'all':!![]}];}_0x2413da=_[_0x4a02('0x44')]({},_0x2413da,_0x1e3bae[_0x4a02('0x45')]);return db[_0x4a02('0x31')]['find'](_0x2413da)[_0x4a02('0x28')](handleEntityNotFound(_0x45f637,null))['then'](respondWithResult(_0x45f637,null))['catch'](handleError(_0x45f637,null));};exports[_0x4a02('0x4f')]=function(_0x209dd2,_0x56f73f){return db[_0x4a02('0x31')]['create'](_0x209dd2['body'],{})[_0x4a02('0x28')](function(_0x5b31f3){var _0x2307c2=_0x209dd2['user'][_0x4a02('0x50')]({'plain':!![]});if(!_0x2307c2)throw new Error(_0x4a02('0x51'));if(_0x2307c2['role']===_0x4a02('0x52')){var _0x48b1ab=_0x5b31f3[_0x4a02('0x50')]({'plain':!![]});var _0x4de8af=_0x4a02('0x2a');return db[_0x4a02('0x53')][_0x4a02('0x54')]({'where':{'name':_0x4de8af,'userProfileId':_0x2307c2[_0x4a02('0x55')]},'raw':!![]})[_0x4a02('0x28')](function(_0x480611){if(_0x480611&&_0x480611[_0x4a02('0x56')]===0x0){return db[_0x4a02('0x57')][_0x4a02('0x4f')]({'name':_0x48b1ab[_0x4a02('0x2d')],'resourceId':_0x48b1ab['id'],'type':_0x480611[_0x4a02('0x2d')],'sectionId':_0x480611['id']},{})[_0x4a02('0x28')](function(){return _0x5b31f3;});}else{return _0x5b31f3;}})[_0x4a02('0x4a')](function(_0x56047f){logger[_0x4a02('0x2c')](_0x4a02('0x58'),_0x56047f);throw _0x56047f;});}return _0x5b31f3;})[_0x4a02('0x28')](respondWithResult(_0x56f73f,0xc9))['catch'](handleError(_0x56f73f,null));};exports['update']=function(_0x21d571,_0x3da7a4){if(_0x21d571['body']['id']){delete _0x21d571['body']['id'];}return db[_0x4a02('0x31')][_0x4a02('0x54')]({'where':{'id':_0x21d571[_0x4a02('0x4c')]['id']}})[_0x4a02('0x28')](handleEntityNotFound(_0x3da7a4,null))[_0x4a02('0x28')](saveUpdates(_0x21d571['body'],null))[_0x4a02('0x28')](respondWithResult(_0x3da7a4,null))[_0x4a02('0x4a')](handleError(_0x3da7a4,null));};exports[_0x4a02('0x29')]=function(_0x13516d,_0x2742c2){return db[_0x4a02('0x31')][_0x4a02('0x54')]({'where':{'id':_0x13516d[_0x4a02('0x4c')]['id']}})[_0x4a02('0x28')](handleEntityNotFound(_0x2742c2,null))[_0x4a02('0x28')](removeEntity(_0x2742c2,null))[_0x4a02('0x4a')](handleError(_0x2742c2,null));};exports[_0x4a02('0x59')]=function(_0x4d2d5f,_0x9b7b1e){return db[_0x4a02('0x31')][_0x4a02('0x59')]()[_0x4a02('0x28')](respondWithResult(_0x9b7b1e,null))[_0x4a02('0x4a')](handleError(_0x9b7b1e,null));};exports[_0x4a02('0x5a')]=function(_0x6ef57e,_0x137864,_0x1e301){var _0x11b8dd={'raw':!![],'where':{}},_0x2a9881={},_0x139ef4;return db[_0x4a02('0x31')]['findOne']({'where':{'id':_0x6ef57e['params']['id']}})[_0x4a02('0x28')](handleEntityNotFound(_0x137864,null))['then'](function(_0x58a7d2){if(_0x58a7d2){_0x139ef4=_0x58a7d2[_0x4a02('0x50')]({'plain':!![]});_0x2a9881['model']=_[_0x4a02('0x36')](db[_0x4a02('0x5b')]['rawAttributes']);_0x2a9881['query']=_[_0x4a02('0x36')](_0x6ef57e[_0x4a02('0x37')]);_0x2a9881[_0x4a02('0x40')]=_[_0x4a02('0x4e')](_0x2a9881[_0x4a02('0x35')],_0x2a9881[_0x4a02('0x37')]);_0x11b8dd[_0x4a02('0x38')]=_['intersection'](_0x2a9881[_0x4a02('0x35')],qs[_0x4a02('0x39')](_0x6ef57e[_0x4a02('0x37')][_0x4a02('0x39')]));_0x11b8dd['attributes']=_0x11b8dd['attributes']['length']?_0x11b8dd['attributes']:_0x2a9881[_0x4a02('0x35')];if(!_0x6ef57e[_0x4a02('0x37')][_0x4a02('0x3b')](_0x4a02('0x3c'))){_0x11b8dd['limit']=qs[_0x4a02('0x23')](_0x6ef57e['query']['limit']);_0x11b8dd[_0x4a02('0x22')]=qs[_0x4a02('0x22')](_0x6ef57e['query'][_0x4a02('0x22')]);}_0x11b8dd['order']=qs[_0x4a02('0x3e')](_0x6ef57e[_0x4a02('0x37')][_0x4a02('0x3e')]);_0x11b8dd['where']=qs['filters'](_['pick'](_0x6ef57e['query'],_0x2a9881[_0x4a02('0x40')]));_0x11b8dd[_0x4a02('0x3f')][_0x4a02('0x5c')]=_0x58a7d2['id'];if(_0x6ef57e[_0x4a02('0x37')]['filter']){_0x11b8dd[_0x4a02('0x3f')]=_[_0x4a02('0x44')](_0x11b8dd[_0x4a02('0x3f')],{'$or':_[_0x4a02('0x30')](_0x11b8dd[_0x4a02('0x38')],function(_0x1ca267){var _0x20cafb={};_0x20cafb[_0x1ca267]={'$like':'%'+_0x6ef57e[_0x4a02('0x37')][_0x4a02('0x42')]+'%'};return _0x20cafb;})});}_0x11b8dd=_[_0x4a02('0x44')]({},_0x11b8dd,_0x6ef57e[_0x4a02('0x45')]);return db[_0x4a02('0x5b')][_0x4a02('0x48')](_0x11b8dd);}})[_0x4a02('0x28')](function(_0x3e68e2){if(_0x3e68e2){return db[_0x4a02('0x5d')]['findAndCountAll']({'where':{'id':_['map'](_0x3e68e2,'UserId'),'role':_0x4a02('0x5e')},'attributes':['id','name',_0x4a02('0x5f'),_0x4a02('0x60'),_0x4a02('0x61')]});}})[_0x4a02('0x28')](function(_0x51950a){if(_0x51950a){return{'count':_0x51950a[_0x4a02('0x21')],'rows':_['map'](_0x51950a[_0x4a02('0x49')],function(_0x1b0627){return{'membername':_0x1b0627[_0x4a02('0x2d')],'UserId':_0x1b0627['id'],'queue_name':_0x139ef4[_0x4a02('0x2d')],'MailQueueId':_0x139ef4['id'],'interface':util[_0x4a02('0x62')]('%s/%s','SIP',_0x1b0627['name']),'penalty':0x0,'paused':_0x1b0627[_0x4a02('0x5f')],'createdAt':_0x1b0627['createdAt'],'updatedAt':_0x1b0627[_0x4a02('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4a02('0x28')](respondWithFilteredResult(_0x137864,_0x11b8dd))[_0x4a02('0x4a')](handleError(_0x137864,null));};exports['getTeams']=function(_0x2d8ba2,_0x131b61,_0x4df5ee){var _0x1d4dac={};var _0x3ca84f={};var _0x1dcd36;var _0x29dfe7;return db[_0x4a02('0x31')][_0x4a02('0x63')]({'where':{'id':_0x2d8ba2['params']['id']}})[_0x4a02('0x28')](handleEntityNotFound(_0x131b61,null))[_0x4a02('0x28')](function(_0x38be02){if(_0x38be02){_0x1dcd36=_0x38be02;_0x3ca84f[_0x4a02('0x35')]=_[_0x4a02('0x36')](db[_0x4a02('0x64')][_0x4a02('0x65')]);_0x3ca84f[_0x4a02('0x37')]=_['keys'](_0x2d8ba2[_0x4a02('0x37')]);_0x3ca84f[_0x4a02('0x40')]=_['intersection'](_0x3ca84f['model'],_0x3ca84f[_0x4a02('0x37')]);_0x1d4dac[_0x4a02('0x38')]=_['intersection'](_0x3ca84f[_0x4a02('0x35')],qs[_0x4a02('0x39')](_0x2d8ba2[_0x4a02('0x37')][_0x4a02('0x39')]));_0x1d4dac['attributes']=_0x1d4dac[_0x4a02('0x38')]['length']?_0x1d4dac[_0x4a02('0x38')]:_0x3ca84f[_0x4a02('0x35')];_0x1d4dac[_0x4a02('0x3d')]=qs[_0x4a02('0x3e')](_0x2d8ba2[_0x4a02('0x37')][_0x4a02('0x3e')]);_0x1d4dac[_0x4a02('0x3f')]=qs[_0x4a02('0x40')](_[_0x4a02('0x41')](_0x2d8ba2['query'],_0x3ca84f['filters']));if(_0x2d8ba2[_0x4a02('0x37')][_0x4a02('0x42')]){_0x1d4dac['where']=_[_0x4a02('0x44')](_0x1d4dac[_0x4a02('0x3f')],{'$or':_[_0x4a02('0x30')](_0x1d4dac['attributes'],function(_0x57e3df){var _0x39d1fd={};_0x39d1fd[_0x57e3df]={'$like':'%'+_0x2d8ba2['query'][_0x4a02('0x42')]+'%'};return _0x39d1fd;})});}_0x1d4dac=_[_0x4a02('0x44')]({},_0x1d4dac,_0x2d8ba2[_0x4a02('0x45')]);return _0x1dcd36['getTeams'](_0x1d4dac);}})[_0x4a02('0x28')](function(_0x4122a5){if(_0x4122a5){_0x29dfe7=_0x4122a5[_0x4a02('0x3a')];if(!_0x2d8ba2[_0x4a02('0x37')]['hasOwnProperty'](_0x4a02('0x3c'))){_0x1d4dac['limit']=qs[_0x4a02('0x23')](_0x2d8ba2[_0x4a02('0x37')]['limit']);_0x1d4dac[_0x4a02('0x22')]=qs[_0x4a02('0x22')](_0x2d8ba2[_0x4a02('0x37')][_0x4a02('0x22')]);}return _0x1dcd36[_0x4a02('0x66')](_0x1d4dac);}})[_0x4a02('0x28')](function(_0xb4ce06){if(_0xb4ce06){return _0xb4ce06?{'count':_0x29dfe7,'rows':_0xb4ce06}:null;}})[_0x4a02('0x28')](respondWithResult(_0x131b61,null))[_0x4a02('0x4a')](handleError(_0x131b61,null));};exports[_0x4a02('0x67')]=function(_0x450649,_0x36aa4e,_0x5a90a2){var _0x4f1fd6=_0x450649[_0x4a02('0x68')]['ids'];return db[_0x4a02('0x64')][_0x4a02('0x48')]({'where':{'id':_0x4f1fd6},'attributes':['id'],'include':[{'model':db[_0x4a02('0x5d')],'as':'Agents','attributes':['id','name',_0x4a02('0x69'),_0x4a02('0x6a'),_0x4a02('0x6b')],'raw':!![]}]})[_0x4a02('0x28')](function(_0x4fd098){if(_0x4fd098){var _0xb425dc=_[_0x4a02('0x6c')](_0x4fd098,function(_0x17b8a6){var _0x5a15c1=_0x17b8a6['get']({'plain':!![]});return _0x5a15c1[_0x4a02('0x6d')];});return db[_0x4a02('0x31')][_0x4a02('0x54')]({'where':{'id':_0x450649['params']['id']}})[_0x4a02('0x28')](function(_0x59cc95){return db[_0x4a02('0x6e')][_0x4a02('0x6f')](function(_0x5096af){return _0x59cc95['addTeams'](_0x4f1fd6,{'transaction':_0x5096af})[_0x4a02('0x28')](function(){return BPromise[_0x4a02('0x70')](_0xb425dc,function(_0x4b3388){return db[_0x4a02('0x5b')][_0x4a02('0x71')]({'where':{'UserId':_0x4b3388['id'],'MailQueueId':_0x450649[_0x4a02('0x4c')]['id']},'transaction':_0x5096af});});})['then'](function(){_0xb425dc['forEach'](function(_0xaf83f8){socket[_0x4a02('0x72')](_0x4a02('0x73'),{'UserId':_0xaf83f8['id'],'MailQueueId':_0x59cc95['id']});});});});});}})['then'](respondWithStatusCode(_0x36aa4e,null))[_0x4a02('0x4a')](handleError(_0x36aa4e,null));};exports[_0x4a02('0x74')]=function(_0x4f21c9,_0x2562c9,_0xf018b4){return db[_0x4a02('0x64')][_0x4a02('0x48')]({'where':{'id':_0x4f21c9['query'][_0x4a02('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4a02('0x28')](handleEntityNotFound(_0x2562c9,null))[_0x4a02('0x28')](function(_0x33d185){var _0x48e139=_['map'](_0x33d185,'id');var _0x13e08a=[];var _0x33a576=[];var _0x4d5ce8=squel[_0x4a02('0x76')]();_0x4d5ce8[_0x4a02('0x77')](_0x4a02('0x78'))[_0x4a02('0x79')]('team_has_mail_queues','tq')[_0x4a02('0x7a')](_0x4a02('0x7b'),'ut',_0x4a02('0x7c'))['where']('MailQueueId\x20=\x20?',_0x4f21c9[_0x4a02('0x4c')]['id']);for(var _0x154c63=0x0;_0x154c63<_0x33d185[_0x4a02('0x3a')];_0x154c63+=0x1){let _0x14bcd6=_0x33d185[_0x154c63];for(var _0x121abe=0x0;_0x121abe<_0x14bcd6['Agents'][_0x4a02('0x3a')];_0x121abe+=0x1){let _0x3b10bb=_0x14bcd6[_0x4a02('0x6d')][_0x121abe];var _0x5b9450=_0x4d5ce8['clone']();_0x5b9450[_0x4a02('0x3f')](_0x4a02('0x7d'),_0x3b10bb['id']);_0x33a576[_0x4a02('0x7e')](db['sequelize'][_0x4a02('0x37')](_0x5b9450[_0x4a02('0x7f')](),{'type':db[_0x4a02('0x6e')]['QueryTypes']['SELECT']})[_0x4a02('0x28')](function(_0x124911){if(_0x124911[_0x4a02('0x3a')]===0x1){return _0x3b10bb['id'];}else{var _0x4b34cc=_['every'](_[_0x4a02('0x30')](_0x124911,_0x4a02('0x80')),function(_0x566ed9){return _[_0x4a02('0x81')](_0x48e139,_0x566ed9);});if(_0x4b34cc){return _0x3b10bb['id'];}}}));}}return BPromise[_0x4a02('0x82')](_0x33a576)[_0x4a02('0x28')](function(_0x2e1293){_0x13e08a=_(_0x13e08a)[_0x4a02('0x83')](_0x2e1293)['compact']()[_0x4a02('0x84')]();return db[_0x4a02('0x31')]['find']({'where':{'id':_0x4f21c9[_0x4a02('0x4c')]['id']}})[_0x4a02('0x28')](function(_0x319d2d){return db[_0x4a02('0x6e')][_0x4a02('0x6f')](function(_0x3bb7a1){return _0x319d2d[_0x4a02('0x74')](_0x4f21c9[_0x4a02('0x37')][_0x4a02('0x75')],{'transaction':_0x3bb7a1})[_0x4a02('0x28')](function(){if(!_['isEmpty'](_0x13e08a)){return _0x319d2d[_0x4a02('0x85')](_0x13e08a,{'transaction':_0x3bb7a1});}})['then'](function(){_0x13e08a['forEach'](function(_0x24f459){socket['emit'](_0x4a02('0x86'),{'UserId':_0x24f459,'MailQueueId':_0x319d2d['id']});});});});});});})[_0x4a02('0x28')](respondWithStatusCode(_0x2562c9,null))[_0x4a02('0x4a')](handleError(_0x2562c9,null));};exports[_0x4a02('0x87')]=function(_0x524353,_0x298dee,_0x4b9163){return db[_0x4a02('0x31')][_0x4a02('0x54')]({'where':{'id':_0x524353['params']['id']}})['then'](handleEntityNotFound(_0x298dee,null))[_0x4a02('0x28')](function(_0x16e60b){if(_0x16e60b){return _0x16e60b['addAgents'](_0x524353[_0x4a02('0x68')][_0x4a02('0x75')],_[_0x4a02('0x88')](_0x524353[_0x4a02('0x68')],[_0x4a02('0x75'),'id'])||{})[_0x4a02('0x89')](function(_0x2df1fb){for(var _0x89916f=0x0;_0x89916f<_0x524353[_0x4a02('0x68')][_0x4a02('0x75')][_0x4a02('0x3a')];_0x89916f+=0x1){socket['emit'](_0x4a02('0x73'),{'UserId':_0x524353[_0x4a02('0x68')]['ids'][_0x89916f],'MailQueueId':_0x524353['params']['id']});}return _0x2df1fb;});}})['then'](respondWithResult(_0x298dee,null))[_0x4a02('0x4a')](handleError(_0x298dee,null));};exports[_0x4a02('0x85')]=function(_0x14d513,_0x3456e1,_0x4c3496){return db[_0x4a02('0x31')][_0x4a02('0x54')]({'where':{'id':_0x14d513['params']['id']}})[_0x4a02('0x28')](handleEntityNotFound(_0x3456e1,null))['then'](function(_0x1c3e06){if(_0x1c3e06){return _0x1c3e06[_0x4a02('0x85')](_0x14d513[_0x4a02('0x37')][_0x4a02('0x75')])['then'](function(){if(_[_0x4a02('0x8a')](_0x14d513['query']['ids'])){for(var _0x52474d=0x0;_0x52474d<_0x14d513[_0x4a02('0x37')]['ids'][_0x4a02('0x3a')];_0x52474d+=0x1){socket[_0x4a02('0x72')](_0x4a02('0x86'),{'UserId':Number(_0x14d513['query'][_0x4a02('0x75')][_0x52474d]),'MailQueueId':Number(_0x14d513[_0x4a02('0x4c')]['id'])});}}else{socket[_0x4a02('0x72')]('userMailQueue:remove',{'UserId':Number(_0x14d513[_0x4a02('0x37')][_0x4a02('0x75')]),'MailQueueId':Number(_0x14d513[_0x4a02('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x3456e1,null))[_0x4a02('0x4a')](handleError(_0x3456e1,null));};exports[_0x4a02('0x8b')]=function(_0x313e89,_0x1897b8,_0x5f1b22){var _0x5224a6={};var _0x5dfe88={};var _0x512da2;var _0x989b83;return db[_0x4a02('0x31')]['findOne']({'where':{'id':_0x313e89[_0x4a02('0x4c')]['id']}})[_0x4a02('0x28')](handleEntityNotFound(_0x1897b8,null))['then'](function(_0x2bb89a){if(_0x2bb89a){_0x512da2=_0x2bb89a;_0x5dfe88['model']=_[_0x4a02('0x36')](db[_0x4a02('0x5d')][_0x4a02('0x65')]);_0x5dfe88[_0x4a02('0x37')]=_[_0x4a02('0x36')](_0x313e89[_0x4a02('0x37')]);_0x5dfe88[_0x4a02('0x40')]=_['intersection'](_0x5dfe88[_0x4a02('0x35')],_0x5dfe88[_0x4a02('0x37')]);_0x5224a6['attributes']=_[_0x4a02('0x4e')](_0x5dfe88[_0x4a02('0x35')],qs[_0x4a02('0x39')](_0x313e89[_0x4a02('0x37')]['fields']));_0x5224a6[_0x4a02('0x38')]=_0x5224a6[_0x4a02('0x38')][_0x4a02('0x3a')]?_0x5224a6[_0x4a02('0x38')]:_0x5dfe88[_0x4a02('0x35')];_0x5224a6['order']=qs[_0x4a02('0x3e')](_0x313e89[_0x4a02('0x37')]['sort']);_0x5224a6['where']=qs[_0x4a02('0x40')](_['pick'](_0x313e89[_0x4a02('0x37')],_0x5dfe88['filters']));if(_0x313e89['query'][_0x4a02('0x42')]){_0x5224a6['where']=_[_0x4a02('0x44')](_0x5224a6[_0x4a02('0x3f')],{'$or':_['map'](_0x5224a6[_0x4a02('0x38')],function(_0x2d1cbe){var _0x2f68c5={};_0x2f68c5[_0x2d1cbe]={'$like':'%'+_0x313e89[_0x4a02('0x37')][_0x4a02('0x42')]+'%'};return _0x2f68c5;})});}_0x5224a6=_[_0x4a02('0x44')]({},_0x5224a6,_0x313e89[_0x4a02('0x45')]);return _0x512da2['getAgents'](_0x5224a6);}})[_0x4a02('0x28')](function(_0x44291b){if(_0x44291b){_0x989b83=_0x44291b[_0x4a02('0x3a')];if(!_0x313e89[_0x4a02('0x37')][_0x4a02('0x3b')](_0x4a02('0x3c'))){_0x5224a6[_0x4a02('0x23')]=qs[_0x4a02('0x23')](_0x313e89['query'][_0x4a02('0x23')]);_0x5224a6[_0x4a02('0x22')]=qs[_0x4a02('0x22')](_0x313e89[_0x4a02('0x37')][_0x4a02('0x22')]);}return _0x512da2[_0x4a02('0x8b')](_0x5224a6);}})['then'](function(_0x1a5a11){if(_0x1a5a11){return _0x1a5a11?{'count':_0x989b83,'rows':_0x1a5a11}:null;}})[_0x4a02('0x28')](respondWithResult(_0x1897b8,null))[_0x4a02('0x4a')](handleError(_0x1897b8,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 9252e08..4a8a4aa 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 _0x1c0c=['MailQueue','setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x101982,_0x5a8ce8){var _0x17d1ea=function(_0x32a61a){while(--_0x32a61a){_0x101982['push'](_0x101982['shift']());}};_0x17d1ea(++_0x5a8ce8);}(_0x1c0c,0x14b));var _0xc1c0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1c0c[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0xc1c0('0x0'));var MailQueue=require(_0xc1c0('0x1'))['db'][_0xc1c0('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xc1c0('0x3')](0x0);var events={'afterCreate':_0xc1c0('0x4'),'afterUpdate':'update','afterDestroy':_0xc1c0('0x5')};function emitEvent(_0x14d6f1){return function(_0x4e59e1,_0x28449e,_0x115fcc){MailQueueEvents['emit'](_0x14d6f1+':'+_0x4e59e1['id'],_0x4e59e1);MailQueueEvents[_0xc1c0('0x6')](_0x14d6f1,_0x4e59e1);_0x115fcc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xc1c0('0x7')](e,emitEvent(event));}}module[_0xc1c0('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x3577=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','update'];(function(_0xc06a0a,_0x3f0fc7){var _0x13d147=function(_0x45f85f){while(--_0x45f85f){_0xc06a0a['push'](_0xc06a0a['shift']());}};_0x13d147(++_0x3f0fc7);}(_0x3577,0x15b));var _0x7357=function(_0x426e17,_0x42a50f){_0x426e17=_0x426e17-0x0;var _0x3bfd7b=_0x3577[_0x426e17];return _0x3bfd7b;};'use strict';var EventEmitter=require(_0x7357('0x0'));var MailQueue=require(_0x7357('0x1'))['db'][_0x7357('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7357('0x3'),'afterDestroy':_0x7357('0x4')};function emitEvent(_0x4ad4d3){return function(_0x3ee774,_0x28b681,_0x19a160){MailQueueEvents[_0x7357('0x5')](_0x4ad4d3+':'+_0x3ee774['id'],_0x3ee774);MailQueueEvents['emit'](_0x4ad4d3,_0x3ee774);_0x19a160(null);};}for(var e in events){if(events[_0x7357('0x6')](e)){var event=events[e];MailQueue[_0x7357('0x7')](e,emitEvent(event));}}module[_0x7357('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 41775b1..3b47819 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 _0x30d4=['api','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','lodash'];(function(_0x24f046,_0x5c3218){var _0x5a7f91=function(_0x4bbc29){while(--_0x4bbc29){_0x24f046['push'](_0x24f046['shift']());}};_0x5a7f91(++_0x5c3218);}(_0x30d4,0x179));var _0x430d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x30d4[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x430d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x430d('0x1'));var moment=require('moment');var BPromise=require(_0x430d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x430d('0x3'));var rimraf=require(_0x430d('0x4'));var config=require(_0x430d('0x5'));var attributes=require(_0x430d('0x6'));module[_0x430d('0x7')]=function(_0x5b744c,_0x54fef9){return _0x5b744c['define'](_0x430d('0x8'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7ad=['./mailQueue.attributes','exports','define','mail_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x30414f,_0x117f14){var _0x25e767=function(_0x4523fb){while(--_0x4523fb){_0x30414f['push'](_0x30414f['shift']());}};_0x25e767(++_0x117f14);}(_0xa7ad,0x11b));var _0xda7a=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xa7ad[_0x26462c];return _0x509a42;};'use strict';var _=require(_0xda7a('0x0'));var util=require(_0xda7a('0x1'));var logger=require(_0xda7a('0x2'))(_0xda7a('0x3'));var moment=require('moment');var BPromise=require(_0xda7a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xda7a('0x5'));module[_0xda7a('0x6')]=function(_0x5201e1,_0x14c8c0){return _0x5201e1[_0xda7a('0x7')]('MailQueue',attributes,{'tableName':_0xda7a('0x8'),'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 de4e377..a1eb80c 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 _0xcb39=['http','redis','defaults','localhost','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','options','raw','attributes','limit','include','map','model','MailQueue','find','where','ShowMailQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x51b2f0,_0x153fc3){var _0x3e2857=function(_0x3fb31c){while(--_0x3fb31c){_0x51b2f0['push'](_0x51b2f0['shift']());}};_0x3e2857(++_0x153fc3);}(_0xcb39,0x1b8));var _0x9cb3=function(_0x3f63b5,_0x461236){_0x3f63b5=_0x3f63b5-0x0;var _0x577d84=_0xcb39[_0x3f63b5];return _0x577d84;};'use strict';var _=require(_0x9cb3('0x0'));var util=require(_0x9cb3('0x1'));var moment=require('moment');var BPromise=require(_0x9cb3('0x2'));var rs=require(_0x9cb3('0x3'));var fs=require('fs');var Redis=require(_0x9cb3('0x4'));var db=require(_0x9cb3('0x5'))['db'];var utils=require(_0x9cb3('0x6'));var logger=require(_0x9cb3('0x7'))(_0x9cb3('0x8'));var config=require(_0x9cb3('0x9'));var jayson=require(_0x9cb3('0xa'));var client=jayson['client'][_0x9cb3('0xb')]({'port':0x232a});config[_0x9cb3('0xc')]=_[_0x9cb3('0xd')](config['redis'],{'host':_0x9cb3('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')[_0x9cb3('0xf')](socket);function respondWithRpcPromise(_0x434741,_0x252359,_0x3040f5){return new BPromise(function(_0x43ae91,_0x45a277){return client[_0x9cb3('0x10')](_0x434741,_0x3040f5)[_0x9cb3('0x11')](function(_0x14ec8e){logger[_0x9cb3('0x12')](_0x9cb3('0x13'),_0x252359,_0x9cb3('0x14'));logger[_0x9cb3('0x15')](_0x9cb3('0x16'),_0x252359,_0x9cb3('0x14'),JSON[_0x9cb3('0x17')](_0x14ec8e));if(_0x14ec8e[_0x9cb3('0x18')]){if(_0x14ec8e[_0x9cb3('0x18')][_0x9cb3('0x19')]===0x1f4){logger[_0x9cb3('0x18')](_0x9cb3('0x13'),_0x252359,_0x14ec8e[_0x9cb3('0x18')]['message']);return _0x45a277(_0x14ec8e['error']['message']);}logger[_0x9cb3('0x18')]('MailQueue,\x20%s,\x20%s',_0x252359,_0x14ec8e[_0x9cb3('0x18')]['message']);return _0x43ae91(_0x14ec8e['error'][_0x9cb3('0x1a')]);}else{logger['info'](_0x9cb3('0x13'),_0x252359,_0x9cb3('0x14'));_0x43ae91(_0x14ec8e[_0x9cb3('0x1b')][_0x9cb3('0x1a')]);}})[_0x9cb3('0x1c')](function(_0x1688d7){logger[_0x9cb3('0x18')](_0x9cb3('0x13'),_0x252359,_0x1688d7);_0x45a277(_0x1688d7);});});}exports[_0x9cb3('0x1d')]=function(_0x4758f9){var _0x23472a=this;return new Promise(function(_0x1e4ba6,_0x2ec660){return db['MailQueue']['findAll']({'raw':_0x4758f9[_0x9cb3('0x1e')]?_0x4758f9[_0x9cb3('0x1e')][_0x9cb3('0x1f')]===undefined?!![]:![]:!![],'where':_0x4758f9[_0x9cb3('0x1e')]?_0x4758f9[_0x9cb3('0x1e')]['where']||null:null,'attributes':_0x4758f9[_0x9cb3('0x1e')]?_0x4758f9[_0x9cb3('0x1e')][_0x9cb3('0x20')]||null:null,'limit':_0x4758f9[_0x9cb3('0x1e')]?_0x4758f9['options'][_0x9cb3('0x21')]||null:null,'include':_0x4758f9[_0x9cb3('0x1e')]?_0x4758f9[_0x9cb3('0x1e')][_0x9cb3('0x22')]?_[_0x9cb3('0x23')](_0x4758f9[_0x9cb3('0x1e')][_0x9cb3('0x22')],function(_0x4a037e){return{'model':db[_0x4a037e[_0x9cb3('0x24')]],'as':_0x4a037e['as'],'attributes':_0x4a037e[_0x9cb3('0x20')],'include':_0x4a037e[_0x9cb3('0x22')]?_[_0x9cb3('0x23')](_0x4a037e[_0x9cb3('0x22')],function(_0xec764f){return{'model':db[_0xec764f[_0x9cb3('0x24')]],'as':_0xec764f['as'],'attributes':_0xec764f[_0x9cb3('0x20')],'include':_0xec764f[_0x9cb3('0x22')]?_[_0x9cb3('0x23')](_0xec764f['include'],function(_0x162fb4){return{'model':db[_0x162fb4['model']],'as':_0x162fb4['as'],'attributes':_0x162fb4['attributes']};}):[]};}):[]};}):[]:[]})[_0x9cb3('0x11')](function(_0x490f97){logger[_0x9cb3('0x12')](_0x9cb3('0x1d'),_0x4758f9);logger['debug']('GetMailQueue',_0x4758f9,JSON['stringify'](_0x490f97));_0x1e4ba6(_0x490f97);})[_0x9cb3('0x1c')](function(_0x12101a){logger[_0x9cb3('0x18')]('GetMailQueue',_0x12101a['message'],_0x4758f9);_0x2ec660(_0x23472a[_0x9cb3('0x18')](0x1f4,_0x12101a['message']));});});};exports['ShowMailQueue']=function(_0x178dff){var _0x3e1a69=this;return new Promise(function(_0x1baa5d,_0x1ea11c){return db[_0x9cb3('0x25')][_0x9cb3('0x26')]({'raw':_0x178dff[_0x9cb3('0x1e')]?_0x178dff[_0x9cb3('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x178dff[_0x9cb3('0x1e')]?_0x178dff[_0x9cb3('0x1e')][_0x9cb3('0x27')]||null:null,'attributes':_0x178dff[_0x9cb3('0x1e')]?_0x178dff[_0x9cb3('0x1e')][_0x9cb3('0x20')]||null:null,'include':_0x178dff[_0x9cb3('0x1e')]?_0x178dff[_0x9cb3('0x1e')][_0x9cb3('0x22')]?_['map'](_0x178dff[_0x9cb3('0x1e')][_0x9cb3('0x22')],function(_0x5675ab){return{'model':db[_0x5675ab[_0x9cb3('0x24')]],'as':_0x5675ab['as'],'attributes':_0x5675ab[_0x9cb3('0x20')],'include':_0x5675ab[_0x9cb3('0x22')]?_[_0x9cb3('0x23')](_0x5675ab[_0x9cb3('0x22')],function(_0x719601){return{'model':db[_0x719601['model']],'as':_0x719601['as'],'attributes':_0x719601[_0x9cb3('0x20')],'include':_0x719601[_0x9cb3('0x22')]?_['map'](_0x719601[_0x9cb3('0x22')],function(_0x4a61c7){return{'model':db[_0x4a61c7[_0x9cb3('0x24')]],'as':_0x4a61c7['as'],'attributes':_0x4a61c7[_0x9cb3('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9cb3('0x11')](function(_0x3cb323){logger[_0x9cb3('0x12')](_0x9cb3('0x28'),_0x178dff);logger['debug'](_0x9cb3('0x28'),_0x178dff,JSON[_0x9cb3('0x17')](_0x3cb323));_0x1baa5d(_0x3cb323);})['catch'](function(_0x2bb518){logger[_0x9cb3('0x18')](_0x9cb3('0x28'),_0x2bb518[_0x9cb3('0x1a')],_0x178dff);_0x1ea11c(_0x3e1a69[_0x9cb3('0x18')](0x1f4,_0x2bb518[_0x9cb3('0x1a')]));});});}; \ No newline at end of file +var _0x075e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','limit','map','model','include','attributes','stringify','ShowMailQueue','find','util','moment','randomstring'];(function(_0x40e6e1,_0x583cad){var _0x68692e=function(_0x544006){while(--_0x544006){_0x40e6e1['push'](_0x40e6e1['shift']());}};_0x68692e(++_0x583cad);}(_0x075e,0x99));var _0xe075=function(_0x545657,_0x1fb942){_0x545657=_0x545657-0x0;var _0x3f899e=_0x075e[_0x545657];return _0x3f899e;};'use strict';var _=require('lodash');var util=require(_0xe075('0x0'));var moment=require(_0xe075('0x1'));var BPromise=require('bluebird');var rs=require(_0xe075('0x2'));var fs=require('fs');var Redis=require(_0xe075('0x3'));var db=require(_0xe075('0x4'))['db'];var utils=require(_0xe075('0x5'));var logger=require(_0xe075('0x6'))(_0xe075('0x7'));var config=require('../../config/environment');var jayson=require(_0xe075('0x8'));var client=jayson['client'][_0xe075('0x9')]({'port':0x232a});config[_0xe075('0xa')]=_[_0xe075('0xb')](config[_0xe075('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe075('0xc'))[_0xe075('0xd')](socket);function respondWithRpcPromise(_0x26f01a,_0x305cd8,_0x1eaee7){return new BPromise(function(_0x58797a,_0x842c92){return client['request'](_0x26f01a,_0x1eaee7)[_0xe075('0xe')](function(_0x2c14be){logger[_0xe075('0xf')](_0xe075('0x10'),_0x305cd8,_0xe075('0x11'));logger[_0xe075('0x12')](_0xe075('0x13'),_0x305cd8,_0xe075('0x11'),JSON['stringify'](_0x2c14be));if(_0x2c14be[_0xe075('0x14')]){if(_0x2c14be[_0xe075('0x14')][_0xe075('0x15')]===0x1f4){logger[_0xe075('0x14')]('MailQueue,\x20%s,\x20%s',_0x305cd8,_0x2c14be[_0xe075('0x14')]['message']);return _0x842c92(_0x2c14be[_0xe075('0x14')][_0xe075('0x16')]);}logger['error'](_0xe075('0x10'),_0x305cd8,_0x2c14be[_0xe075('0x14')]['message']);return _0x58797a(_0x2c14be[_0xe075('0x14')]['message']);}else{logger[_0xe075('0xf')](_0xe075('0x10'),_0x305cd8,_0xe075('0x11'));_0x58797a(_0x2c14be[_0xe075('0x17')][_0xe075('0x16')]);}})[_0xe075('0x18')](function(_0x4d0587){logger[_0xe075('0x14')](_0xe075('0x10'),_0x305cd8,_0x4d0587);_0x842c92(_0x4d0587);});});}exports[_0xe075('0x19')]=function(_0x585d61){var _0x548aab=this;return new Promise(function(_0x45887b,_0x2e81d4){return db[_0xe075('0x1a')][_0xe075('0x1b')]({'raw':_0x585d61['options']?_0x585d61[_0xe075('0x1c')][_0xe075('0x1d')]===undefined?!![]:![]:!![],'where':_0x585d61[_0xe075('0x1c')]?_0x585d61['options'][_0xe075('0x1e')]||null:null,'attributes':_0x585d61[_0xe075('0x1c')]?_0x585d61['options']['attributes']||null:null,'limit':_0x585d61[_0xe075('0x1c')]?_0x585d61['options'][_0xe075('0x1f')]||null:null,'include':_0x585d61[_0xe075('0x1c')]?_0x585d61[_0xe075('0x1c')]['include']?_[_0xe075('0x20')](_0x585d61[_0xe075('0x1c')]['include'],function(_0x28e36c){return{'model':db[_0x28e36c[_0xe075('0x21')]],'as':_0x28e36c['as'],'attributes':_0x28e36c['attributes'],'include':_0x28e36c[_0xe075('0x22')]?_[_0xe075('0x20')](_0x28e36c[_0xe075('0x22')],function(_0x10cea9){return{'model':db[_0x10cea9[_0xe075('0x21')]],'as':_0x10cea9['as'],'attributes':_0x10cea9[_0xe075('0x23')],'include':_0x10cea9['include']?_[_0xe075('0x20')](_0x10cea9[_0xe075('0x22')],function(_0x4a95e2){return{'model':db[_0x4a95e2[_0xe075('0x21')]],'as':_0x4a95e2['as'],'attributes':_0x4a95e2[_0xe075('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a0474){logger[_0xe075('0xf')](_0xe075('0x19'),_0x585d61);logger[_0xe075('0x12')]('GetMailQueue',_0x585d61,JSON[_0xe075('0x24')](_0x1a0474));_0x45887b(_0x1a0474);})[_0xe075('0x18')](function(_0xbb50e2){logger[_0xe075('0x14')](_0xe075('0x19'),_0xbb50e2[_0xe075('0x16')],_0x585d61);_0x2e81d4(_0x548aab['error'](0x1f4,_0xbb50e2[_0xe075('0x16')]));});});};exports[_0xe075('0x25')]=function(_0x32e1fe){var _0x149c20=this;return new Promise(function(_0x4d1935,_0xac06bd){return db[_0xe075('0x1a')][_0xe075('0x26')]({'raw':_0x32e1fe[_0xe075('0x1c')]?_0x32e1fe[_0xe075('0x1c')][_0xe075('0x1d')]===undefined?!![]:![]:!![],'where':_0x32e1fe[_0xe075('0x1c')]?_0x32e1fe[_0xe075('0x1c')]['where']||null:null,'attributes':_0x32e1fe[_0xe075('0x1c')]?_0x32e1fe[_0xe075('0x1c')][_0xe075('0x23')]||null:null,'include':_0x32e1fe[_0xe075('0x1c')]?_0x32e1fe['options'][_0xe075('0x22')]?_[_0xe075('0x20')](_0x32e1fe['options'][_0xe075('0x22')],function(_0x40cd2a){return{'model':db[_0x40cd2a[_0xe075('0x21')]],'as':_0x40cd2a['as'],'attributes':_0x40cd2a[_0xe075('0x23')],'include':_0x40cd2a[_0xe075('0x22')]?_[_0xe075('0x20')](_0x40cd2a[_0xe075('0x22')],function(_0x221055){return{'model':db[_0x221055[_0xe075('0x21')]],'as':_0x221055['as'],'attributes':_0x221055[_0xe075('0x23')],'include':_0x221055[_0xe075('0x22')]?_['map'](_0x221055[_0xe075('0x22')],function(_0x42ba11){return{'model':db[_0x42ba11[_0xe075('0x21')]],'as':_0x42ba11['as'],'attributes':_0x42ba11[_0xe075('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x271da3){logger[_0xe075('0xf')](_0xe075('0x25'),_0x32e1fe);logger['debug'](_0xe075('0x25'),_0x32e1fe,JSON[_0xe075('0x24')](_0x271da3));_0x4d1935(_0x271da3);})['catch'](function(_0x43cac3){logger[_0xe075('0x14')]('ShowMailQueue',_0x43cac3[_0xe075('0x16')],_0x32e1fe);_0xac06bd(_0x149c20[_0xe075('0x14')](0x1f4,_0x43cac3['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 1c3fd79..bb19e79 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 _0xf102=['length','./mailQueue.events','save','remove','emit','register'];(function(_0x3e9fef,_0x5d7140){var _0x4f0aac=function(_0x4f0fdd){while(--_0x4f0fdd){_0x3e9fef['push'](_0x3e9fef['shift']());}};_0x4f0aac(++_0x5d7140);}(_0xf102,0x109));var _0x2f10=function(_0xf20b6,_0x49ddbb){_0xf20b6=_0xf20b6-0x0;var _0x4ff567=_0xf102[_0xf20b6];return _0x4ff567;};'use strict';var MailQueueEvents=require(_0x2f10('0x0'));var events=[_0x2f10('0x1'),_0x2f10('0x2'),'update'];function createListener(_0x5cfbb9,_0x2e17ff){return function(_0x5f1fb7){_0x2e17ff[_0x2f10('0x3')](_0x5cfbb9,_0x5f1fb7);};}function removeListener(_0xcd6f9,_0x42dcce){return function(){MailQueueEvents['removeListener'](_0xcd6f9,_0x42dcce);};}exports[_0x2f10('0x4')]=function(_0x491084){for(var _0x1fb256=0x0,_0x35a28e=events[_0x2f10('0x5')];_0x1fb256<_0x35a28e;_0x1fb256++){var _0x37808d=events[_0x1fb256];var _0x38e956=createListener('mailQueue:'+_0x37808d,_0x491084);MailQueueEvents['on'](_0x37808d,_0x38e956);}}; \ No newline at end of file +var _0xe8d8=['mailQueue:','./mailQueue.events','save','emit','register','length'];(function(_0x1389ba,_0x1e8e5d){var _0x12743e=function(_0x9bdf43){while(--_0x9bdf43){_0x1389ba['push'](_0x1389ba['shift']());}};_0x12743e(++_0x1e8e5d);}(_0xe8d8,0x97));var _0x8e8d=function(_0x16691d,_0x17922f){_0x16691d=_0x16691d-0x0;var _0x27ab5f=_0xe8d8[_0x16691d];return _0x27ab5f;};'use strict';var MailQueueEvents=require(_0x8e8d('0x0'));var events=[_0x8e8d('0x1'),'remove','update'];function createListener(_0x223f50,_0x364275){return function(_0x25461c){_0x364275[_0x8e8d('0x2')](_0x223f50,_0x25461c);};}function removeListener(_0x1c954d,_0x377a98){return function(){MailQueueEvents['removeListener'](_0x1c954d,_0x377a98);};}exports[_0x8e8d('0x3')]=function(_0x59f2ab){for(var _0x3e22e9=0x0,_0x29f432=events[_0x8e8d('0x4')];_0x3e22e9<_0x29f432;_0x3e22e9++){var _0x488157=events[_0x3e22e9];var _0x1acd02=createListener(_0x8e8d('0x5')+_0x488157,_0x59f2ab);MailQueueEvents['on'](_0x488157,_0x1acd02);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 5e65632..552c198 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 _0x2c49=['Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x2c49,0x1b4));var _0x92c4=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0x2c49[_0x50bf5a];return _0x4ddc1d;};'use strict';var multer=require('multer');var util=require(_0x92c4('0x0'));var path=require(_0x92c4('0x1'));var timeout=require(_0x92c4('0x2'));var express=require(_0x92c4('0x3'));var router=express[_0x92c4('0x4')]();var auth=require(_0x92c4('0x5'));var interaction=require(_0x92c4('0x6'));var config=require('../../config/environment');var controller=require(_0x92c4('0x7'));router[_0x92c4('0x8')]('/',auth[_0x92c4('0x9')](),controller[_0x92c4('0xa')]);router[_0x92c4('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x92c4('0xb')]);router[_0x92c4('0x8')](_0x92c4('0xc'),auth[_0x92c4('0x9')](),controller[_0x92c4('0xd')]);router[_0x92c4('0xe')]('/',auth[_0x92c4('0x9')](),controller[_0x92c4('0xf')]);router[_0x92c4('0x10')](_0x92c4('0xc'),auth[_0x92c4('0x9')](),controller[_0x92c4('0x11')]);router[_0x92c4('0x12')](_0x92c4('0xc'),auth[_0x92c4('0x9')](),controller['destroy']);module[_0x92c4('0x13')]=router; \ No newline at end of file +var _0x2dc8=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy'];(function(_0x40f20a,_0x33a40c){var _0x3dbfc6=function(_0x5f57e3){while(--_0x5f57e3){_0x40f20a['push'](_0x40f20a['shift']());}};_0x3dbfc6(++_0x33a40c);}(_0x2dc8,0x6a));var _0x82dc=function(_0x1eda88,_0x555454){_0x1eda88=_0x1eda88-0x0;var _0x2eb594=_0x2dc8[_0x1eda88];return _0x2eb594;};'use strict';var multer=require(_0x82dc('0x0'));var util=require(_0x82dc('0x1'));var path=require(_0x82dc('0x2'));var timeout=require(_0x82dc('0x3'));var express=require('express');var router=express[_0x82dc('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x82dc('0x5'));var config=require(_0x82dc('0x6'));var controller=require(_0x82dc('0x7'));router[_0x82dc('0x8')]('/',auth[_0x82dc('0x9')](),controller[_0x82dc('0xa')]);router[_0x82dc('0x8')](_0x82dc('0xb'),auth['isAuthenticated'](),controller[_0x82dc('0xc')]);router[_0x82dc('0x8')](_0x82dc('0xd'),auth[_0x82dc('0x9')](),controller[_0x82dc('0xe')]);router[_0x82dc('0xf')]('/',auth['isAuthenticated'](),controller[_0x82dc('0x10')]);router[_0x82dc('0x11')](_0x82dc('0xd'),auth[_0x82dc('0x9')](),controller[_0x82dc('0x12')]);router['delete'](_0x82dc('0xd'),auth['isAuthenticated'](),controller[_0x82dc('0x13')]);module[_0x82dc('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 8a394ea..67838e5 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 _0x22d4=['DATE','moment','exports','STRING'];(function(_0x1e243b,_0x6ab858){var _0x2c7e5d=function(_0x1c20ab){while(--_0x1c20ab){_0x1e243b['push'](_0x1e243b['shift']());}};_0x2c7e5d(++_0x6ab858);}(_0x22d4,0xb5));var _0x422d=function(_0x2cfd0b,_0x12c7b2){_0x2cfd0b=_0x2cfd0b-0x0;var _0x57906e=_0x22d4[_0x2cfd0b];return _0x57906e;};'use strict';var moment=require(_0x422d('0x0'));var Sequelize=require('sequelize');module[_0x422d('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x422d('0x2')]},'joinAt':{'type':Sequelize[_0x422d('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x422d('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x422d('0x2')]}}; \ No newline at end of file +var _0x8768=['STRING','DATE','moment','sequelize','exports'];(function(_0x2046dd,_0x40a9ab){var _0x2eb055=function(_0x1c65e8){while(--_0x1c65e8){_0x2046dd['push'](_0x2046dd['shift']());}};_0x2eb055(++_0x40a9ab);}(_0x8768,0x11f));var _0x8876=function(_0x55a712,_0x2c5da6){_0x55a712=_0x55a712-0x0;var _0x4d75f5=_0x8768[_0x55a712];return _0x4d75f5;};'use strict';var moment=require(_0x8876('0x0'));var Sequelize=require(_0x8876('0x1'));module[_0x8876('0x2')]={'uniqueid':{'type':Sequelize[_0x8876('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8876('0x3')]},'joinAt':{'type':Sequelize[_0x8876('0x4')]},'leaveAt':{'type':Sequelize[_0x8876('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x8876('0x4')]},'reason':{'type':Sequelize[_0x8876('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 8464231..01036da 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 _0x0d70=['to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','limit','set','apply','reject','save','update','then','destroy','status','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','filtears','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x2cc96a,_0x5952d4){var _0x5237d7=function(_0x1eb668){while(--_0x1eb668){_0x2cc96a['push'](_0x2cc96a['shift']());}};_0x5237d7(++_0x5952d4);}(_0x0d70,0x12d));var _0x00d7=function(_0x452ac8,_0x382b4c){_0x452ac8=_0x452ac8-0x0;var _0x16b3df=_0x0d70[_0x452ac8];return _0x16b3df;};'use strict';var pdf=require(_0x00d7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x00d7('0x1'));var zipdir=require(_0x00d7('0x2'));var jsonpatch=require(_0x00d7('0x3'));var rp=require(_0x00d7('0x4'));var moment=require(_0x00d7('0x5'));var BPromise=require(_0x00d7('0x6'));var Mustache=require(_0x00d7('0x7'));var util=require(_0x00d7('0x8'));var path=require(_0x00d7('0x9'));var sox=require(_0x00d7('0xa'));var csv=require(_0x00d7('0xb'));var ejs=require(_0x00d7('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x00d7('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x00d7('0xe'));var toCsv=require(_0x00d7('0xb'));var querystring=require(_0x00d7('0xf'));var Papa=require(_0x00d7('0x10'));var Redis=require(_0x00d7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x00d7('0x12'));var as=require(_0x00d7('0x13'));var hardwareService=require(_0x00d7('0x14'));var logger=require(_0x00d7('0x15'))(_0x00d7('0x16'));var utils=require(_0x00d7('0x17'));var config=require(_0x00d7('0x18'));var licenseUtil=require(_0x00d7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12cf9f,_0x41f326){_0x41f326=_0x41f326||0xcc;return function(_0x51f208){if(_0x51f208){return _0x12cf9f[_0x00d7('0x1a')](_0x41f326);}return _0x12cf9f['status'](_0x41f326)[_0x00d7('0x1b')]();};}function respondWithResult(_0x425275,_0x592990){_0x592990=_0x592990||0xc8;return function(_0x5da888){if(_0x5da888){return _0x425275['status'](_0x592990)[_0x00d7('0x1c')](_0x5da888);}};}function respondWithFilteredResult(_0x53fdf9,_0x4991ad){return function(_0x3df3f3){if(_0x3df3f3){var _0x36ee5e=_0x3df3f3['count'],_0x2eafc6=_0x4991ad[_0x00d7('0x1d')],_0x1e6622=_0x4991ad[_0x00d7('0x1d')]+_0x4991ad[_0x00d7('0x1e')],_0x2280f0;if(_0x1e6622>=_0x36ee5e){_0x1e6622=_0x36ee5e;_0x2280f0=0xc8;}else{_0x2280f0=0xce;}_0x53fdf9['status'](_0x2280f0);return _0x53fdf9[_0x00d7('0x1f')]('Content-Range',_0x2eafc6+'-'+_0x1e6622+'/'+_0x36ee5e)[_0x00d7('0x1c')](_0x3df3f3);}return null;};}function patchUpdates(_0x3a9f36){return function(_0x289467){try{jsonpatch[_0x00d7('0x20')](_0x289467,_0x3a9f36,!![]);}catch(_0x1b8cd1){return BPromise[_0x00d7('0x21')](_0x1b8cd1);}return _0x289467[_0x00d7('0x22')]();};}function saveUpdates(_0x2c3701,_0x31d85e){return function(_0x2318a2){if(_0x2318a2){return _0x2318a2[_0x00d7('0x23')](_0x2c3701)[_0x00d7('0x24')](function(_0x325578){return _0x325578;});}return null;};}function removeEntity(_0x37800f,_0x5f5b2c){return function(_0x22c740){if(_0x22c740){return _0x22c740[_0x00d7('0x25')]()[_0x00d7('0x24')](function(){_0x37800f[_0x00d7('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31519f,_0x227bde){return function(_0xb0ba4c){if(!_0xb0ba4c){_0x31519f['sendStatus'](0x194);}return _0xb0ba4c;};}function handleError(_0x1d744f,_0x335f87){_0x335f87=_0x335f87||0x1f4;return function(_0x294b56){logger[_0x00d7('0x27')](_0x294b56[_0x00d7('0x28')]);if(_0x294b56[_0x00d7('0x29')]){delete _0x294b56['name'];}_0x1d744f[_0x00d7('0x26')](_0x335f87)[_0x00d7('0x2a')](_0x294b56);};}exports[_0x00d7('0x2b')]=function(_0x41e7fe,_0x5d6c93){var _0x57411f={},_0x1adce9={},_0x474140={'count':0x0,'rows':[]};var _0x43205d=_[_0x00d7('0x2c')](db[_0x00d7('0x2d')][_0x00d7('0x2e')],function(_0xd7d1dd){return{'name':_0xd7d1dd[_0x00d7('0x2f')],'type':_0xd7d1dd[_0x00d7('0x30')]['key']};});_0x1adce9['model']=_[_0x00d7('0x2c')](_0x43205d,_0x00d7('0x29'));_0x1adce9[_0x00d7('0x31')]=_[_0x00d7('0x32')](_0x41e7fe[_0x00d7('0x31')]);_0x1adce9[_0x00d7('0x33')]=_[_0x00d7('0x34')](_0x1adce9['model'],_0x1adce9[_0x00d7('0x31')]);_0x57411f[_0x00d7('0x35')]=_[_0x00d7('0x34')](_0x1adce9[_0x00d7('0x36')],qs[_0x00d7('0x37')](_0x41e7fe[_0x00d7('0x31')][_0x00d7('0x37')]));_0x57411f[_0x00d7('0x35')]=_0x57411f[_0x00d7('0x35')][_0x00d7('0x38')]?_0x57411f[_0x00d7('0x35')]:_0x1adce9[_0x00d7('0x36')];if(!_0x41e7fe['query']['hasOwnProperty'](_0x00d7('0x39'))){_0x57411f[_0x00d7('0x1e')]=qs[_0x00d7('0x1e')](_0x41e7fe[_0x00d7('0x31')][_0x00d7('0x1e')]);_0x57411f[_0x00d7('0x1d')]=qs[_0x00d7('0x1d')](_0x41e7fe[_0x00d7('0x31')]['offset']);}_0x57411f[_0x00d7('0x3a')]=qs['sort'](_0x41e7fe[_0x00d7('0x31')][_0x00d7('0x3b')]);_0x57411f['where']=qs[_0x00d7('0x33')](_[_0x00d7('0x3c')](_0x41e7fe[_0x00d7('0x31')],_0x1adce9[_0x00d7('0x33')]),_0x43205d);if(_0x41e7fe[_0x00d7('0x31')][_0x00d7('0x3d')]){_0x57411f[_0x00d7('0x3e')]=_[_0x00d7('0x3f')](_0x57411f[_0x00d7('0x3e')],{'$or':_[_0x00d7('0x2c')](_0x43205d,function(_0x259903){if(_0x259903[_0x00d7('0x30')]!==_0x00d7('0x40')){var _0x3ad2e6={};_0x3ad2e6[_0x259903[_0x00d7('0x29')]]={'$like':'%'+_0x41e7fe[_0x00d7('0x31')][_0x00d7('0x3d')]+'%'};return _0x3ad2e6;}})});}_0x57411f=_[_0x00d7('0x3f')]({},_0x57411f,_0x41e7fe[_0x00d7('0x41')]);var _0x254d51={'where':_0x57411f[_0x00d7('0x3e')]};return db['MailQueueReport']['count'](_0x254d51)['then'](function(_0xe9ce26){_0x474140[_0x00d7('0x42')]=_0xe9ce26;if(_0x41e7fe[_0x00d7('0x31')][_0x00d7('0x43')]){_0x57411f[_0x00d7('0x44')]=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x57411f);})[_0x00d7('0x24')](function(_0x420993){_0x474140[_0x00d7('0x45')]=_0x420993;return _0x474140;})['then'](respondWithFilteredResult(_0x5d6c93,_0x57411f))[_0x00d7('0x46')](handleError(_0x5d6c93,null));};exports[_0x00d7('0x47')]=function(_0x986ed,_0x12ce60){var _0x4bdcb0={'raw':!![],'where':{'id':_0x986ed[_0x00d7('0x48')]['id']}},_0x35230f={};_0x35230f['model']=_[_0x00d7('0x32')](db[_0x00d7('0x2d')][_0x00d7('0x2e')]);_0x35230f['query']=_[_0x00d7('0x32')](_0x986ed['query']);_0x35230f[_0x00d7('0x49')]=_[_0x00d7('0x34')](_0x35230f[_0x00d7('0x36')],_0x35230f[_0x00d7('0x31')]);_0x4bdcb0['attributes']=_[_0x00d7('0x34')](_0x35230f[_0x00d7('0x36')],qs[_0x00d7('0x37')](_0x986ed[_0x00d7('0x31')][_0x00d7('0x37')]));_0x4bdcb0[_0x00d7('0x35')]=_0x4bdcb0[_0x00d7('0x35')][_0x00d7('0x38')]?_0x4bdcb0[_0x00d7('0x35')]:_0x35230f[_0x00d7('0x36')];if(_0x986ed[_0x00d7('0x31')]['includeAll']){_0x4bdcb0[_0x00d7('0x44')]=[{'all':!![]}];}_0x4bdcb0=_[_0x00d7('0x3f')]({},_0x4bdcb0,_0x986ed[_0x00d7('0x41')]);return db[_0x00d7('0x2d')][_0x00d7('0x4a')](_0x4bdcb0)['then'](handleEntityNotFound(_0x12ce60,null))[_0x00d7('0x24')](respondWithResult(_0x12ce60,null))[_0x00d7('0x46')](handleError(_0x12ce60,null));};exports[_0x00d7('0x4b')]=function(_0x55ee09,_0x292f78){return db[_0x00d7('0x2d')][_0x00d7('0x4b')](_0x55ee09[_0x00d7('0x4c')],{})[_0x00d7('0x24')](respondWithResult(_0x292f78,0xc9))[_0x00d7('0x46')](handleError(_0x292f78,null));};exports[_0x00d7('0x23')]=function(_0x4f4617,_0x5c3e1d){if(_0x4f4617[_0x00d7('0x4c')]['id']){delete _0x4f4617[_0x00d7('0x4c')]['id'];}return db[_0x00d7('0x2d')]['find']({'where':{'id':_0x4f4617[_0x00d7('0x48')]['id']}})['then'](handleEntityNotFound(_0x5c3e1d,null))[_0x00d7('0x24')](saveUpdates(_0x4f4617[_0x00d7('0x4c')],null))[_0x00d7('0x24')](respondWithResult(_0x5c3e1d,null))[_0x00d7('0x46')](handleError(_0x5c3e1d,null));};exports[_0x00d7('0x25')]=function(_0x125330,_0x4c9b51){return db[_0x00d7('0x2d')][_0x00d7('0x4a')]({'where':{'id':_0x125330[_0x00d7('0x48')]['id']}})[_0x00d7('0x24')](handleEntityNotFound(_0x4c9b51,null))[_0x00d7('0x24')](removeEntity(_0x4c9b51,null))[_0x00d7('0x46')](handleError(_0x4c9b51,null));};exports[_0x00d7('0x4d')]=function(_0x4a068c,_0x55e03d){return db[_0x00d7('0x2d')][_0x00d7('0x4d')]()[_0x00d7('0x24')](respondWithResult(_0x55e03d,null))[_0x00d7('0x46')](handleError(_0x55e03d,null));}; \ No newline at end of file +var _0x4c3a=['keys','filtears','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','nolimit','order','pick','where','type','VIRTUAL','filter','merge','MailQueueReport','count','includeAll','findAll','rows','catch','show','params'];(function(_0x5c1f25,_0x37d6a7){var _0x1178a4=function(_0x2fdff0){while(--_0x2fdff0){_0x5c1f25['push'](_0x5c1f25['shift']());}};_0x1178a4(++_0x37d6a7);}(_0x4c3a,0x9e));var _0xa4c3=function(_0x1e2072,_0xe3cc90){_0x1e2072=_0x1e2072-0x0;var _0x22956b=_0x4c3a[_0x1e2072];return _0x22956b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa4c3('0x0'));var zipdir=require(_0xa4c3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa4c3('0x2'));var moment=require(_0xa4c3('0x3'));var BPromise=require(_0xa4c3('0x4'));var Mustache=require(_0xa4c3('0x5'));var util=require(_0xa4c3('0x6'));var path=require(_0xa4c3('0x7'));var sox=require(_0xa4c3('0x8'));var csv=require(_0xa4c3('0x9'));var ejs=require(_0xa4c3('0xa'));var fs=require('fs');var _=require(_0xa4c3('0xb'));var squel=require('squel');var crypto=require(_0xa4c3('0xc'));var jsforce=require(_0xa4c3('0xd'));var deskjs=require(_0xa4c3('0xe'));var toCsv=require(_0xa4c3('0x9'));var querystring=require(_0xa4c3('0xf'));var Papa=require(_0xa4c3('0x10'));var Redis=require(_0xa4c3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa4c3('0x12'));var as=require(_0xa4c3('0x13'));var hardwareService=require(_0xa4c3('0x14'));var logger=require(_0xa4c3('0x15'))(_0xa4c3('0x16'));var utils=require(_0xa4c3('0x17'));var config=require(_0xa4c3('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa4c3('0x19'))['db'];function respondWithStatusCode(_0x434c30,_0x301c30){_0x301c30=_0x301c30||0xcc;return function(_0x46f3e6){if(_0x46f3e6){return _0x434c30[_0xa4c3('0x1a')](_0x301c30);}return _0x434c30[_0xa4c3('0x1b')](_0x301c30)[_0xa4c3('0x1c')]();};}function respondWithResult(_0x4efa4f,_0x5439d1){_0x5439d1=_0x5439d1||0xc8;return function(_0x3ec7a4){if(_0x3ec7a4){return _0x4efa4f[_0xa4c3('0x1b')](_0x5439d1)[_0xa4c3('0x1d')](_0x3ec7a4);}};}function respondWithFilteredResult(_0x473041,_0x4bb63b){return function(_0x48912e){if(_0x48912e){var _0x4e0c6f=_0x48912e['count'],_0x13d48=_0x4bb63b[_0xa4c3('0x1e')],_0x51d616=_0x4bb63b[_0xa4c3('0x1e')]+_0x4bb63b[_0xa4c3('0x1f')],_0x11add0;if(_0x51d616>=_0x4e0c6f){_0x51d616=_0x4e0c6f;_0x11add0=0xc8;}else{_0x11add0=0xce;}_0x473041[_0xa4c3('0x1b')](_0x11add0);return _0x473041[_0xa4c3('0x20')](_0xa4c3('0x21'),_0x13d48+'-'+_0x51d616+'/'+_0x4e0c6f)['json'](_0x48912e);}return null;};}function patchUpdates(_0x3cca02){return function(_0x4f8a69){try{jsonpatch[_0xa4c3('0x22')](_0x4f8a69,_0x3cca02,!![]);}catch(_0x357e7f){return BPromise['reject'](_0x357e7f);}return _0x4f8a69[_0xa4c3('0x23')]();};}function saveUpdates(_0x16ddec,_0x4ed890){return function(_0x37e4ee){if(_0x37e4ee){return _0x37e4ee[_0xa4c3('0x24')](_0x16ddec)[_0xa4c3('0x25')](function(_0x5fe935){return _0x5fe935;});}return null;};}function removeEntity(_0x3d66de,_0x311384){return function(_0x2cfe90){if(_0x2cfe90){return _0x2cfe90[_0xa4c3('0x26')]()[_0xa4c3('0x25')](function(){_0x3d66de['status'](0xcc)[_0xa4c3('0x1c')]();});}};}function handleEntityNotFound(_0xcf25ae,_0x3b0ec0){return function(_0x5e68b6){if(!_0x5e68b6){_0xcf25ae['sendStatus'](0x194);}return _0x5e68b6;};}function handleError(_0x3cfa82,_0x2c47c7){_0x2c47c7=_0x2c47c7||0x1f4;return function(_0x464309){logger[_0xa4c3('0x27')](_0x464309[_0xa4c3('0x28')]);if(_0x464309['name']){delete _0x464309[_0xa4c3('0x29')];}_0x3cfa82[_0xa4c3('0x1b')](_0x2c47c7)[_0xa4c3('0x2a')](_0x464309);};}exports[_0xa4c3('0x2b')]=function(_0x1a7ad0,_0x523f19){var _0x305646={},_0x138b07={},_0x48d577={'count':0x0,'rows':[]};var _0x7776da=_[_0xa4c3('0x2c')](db['MailQueueReport'][_0xa4c3('0x2d')],function(_0x5dcb5e){return{'name':_0x5dcb5e[_0xa4c3('0x2e')],'type':_0x5dcb5e['type']['key']};});_0x138b07[_0xa4c3('0x2f')]=_[_0xa4c3('0x2c')](_0x7776da,_0xa4c3('0x29'));_0x138b07[_0xa4c3('0x30')]=_['keys'](_0x1a7ad0[_0xa4c3('0x30')]);_0x138b07[_0xa4c3('0x31')]=_[_0xa4c3('0x32')](_0x138b07[_0xa4c3('0x2f')],_0x138b07[_0xa4c3('0x30')]);_0x305646[_0xa4c3('0x33')]=_[_0xa4c3('0x32')](_0x138b07[_0xa4c3('0x2f')],qs[_0xa4c3('0x34')](_0x1a7ad0[_0xa4c3('0x30')][_0xa4c3('0x34')]));_0x305646[_0xa4c3('0x33')]=_0x305646[_0xa4c3('0x33')][_0xa4c3('0x35')]?_0x305646[_0xa4c3('0x33')]:_0x138b07[_0xa4c3('0x2f')];if(!_0x1a7ad0[_0xa4c3('0x30')]['hasOwnProperty'](_0xa4c3('0x36'))){_0x305646[_0xa4c3('0x1f')]=qs[_0xa4c3('0x1f')](_0x1a7ad0[_0xa4c3('0x30')][_0xa4c3('0x1f')]);_0x305646[_0xa4c3('0x1e')]=qs[_0xa4c3('0x1e')](_0x1a7ad0[_0xa4c3('0x30')][_0xa4c3('0x1e')]);}_0x305646[_0xa4c3('0x37')]=qs['sort'](_0x1a7ad0['query']['sort']);_0x305646['where']=qs[_0xa4c3('0x31')](_[_0xa4c3('0x38')](_0x1a7ad0[_0xa4c3('0x30')],_0x138b07[_0xa4c3('0x31')]),_0x7776da);if(_0x1a7ad0[_0xa4c3('0x30')]['filter']){_0x305646[_0xa4c3('0x39')]=_['merge'](_0x305646[_0xa4c3('0x39')],{'$or':_[_0xa4c3('0x2c')](_0x7776da,function(_0x47e97f){if(_0x47e97f[_0xa4c3('0x3a')]!==_0xa4c3('0x3b')){var _0x4e204a={};_0x4e204a[_0x47e97f[_0xa4c3('0x29')]]={'$like':'%'+_0x1a7ad0[_0xa4c3('0x30')][_0xa4c3('0x3c')]+'%'};return _0x4e204a;}})});}_0x305646=_[_0xa4c3('0x3d')]({},_0x305646,_0x1a7ad0['options']);var _0xc78e32={'where':_0x305646['where']};return db[_0xa4c3('0x3e')][_0xa4c3('0x3f')](_0xc78e32)[_0xa4c3('0x25')](function(_0x2a902a){_0x48d577[_0xa4c3('0x3f')]=_0x2a902a;if(_0x1a7ad0[_0xa4c3('0x30')][_0xa4c3('0x40')]){_0x305646['include']=[{'all':!![]}];}return db[_0xa4c3('0x3e')][_0xa4c3('0x41')](_0x305646);})[_0xa4c3('0x25')](function(_0x1f21e2){_0x48d577[_0xa4c3('0x42')]=_0x1f21e2;return _0x48d577;})[_0xa4c3('0x25')](respondWithFilteredResult(_0x523f19,_0x305646))[_0xa4c3('0x43')](handleError(_0x523f19,null));};exports[_0xa4c3('0x44')]=function(_0x52ab9f,_0x2e019d){var _0xa510ed={'raw':!![],'where':{'id':_0x52ab9f[_0xa4c3('0x45')]['id']}},_0x2774ed={};_0x2774ed[_0xa4c3('0x2f')]=_[_0xa4c3('0x46')](db['MailQueueReport']['rawAttributes']);_0x2774ed['query']=_[_0xa4c3('0x46')](_0x52ab9f[_0xa4c3('0x30')]);_0x2774ed[_0xa4c3('0x47')]=_[_0xa4c3('0x32')](_0x2774ed[_0xa4c3('0x2f')],_0x2774ed[_0xa4c3('0x30')]);_0xa510ed[_0xa4c3('0x33')]=_[_0xa4c3('0x32')](_0x2774ed[_0xa4c3('0x2f')],qs[_0xa4c3('0x34')](_0x52ab9f['query'][_0xa4c3('0x34')]));_0xa510ed[_0xa4c3('0x33')]=_0xa510ed['attributes'][_0xa4c3('0x35')]?_0xa510ed[_0xa4c3('0x33')]:_0x2774ed[_0xa4c3('0x2f')];if(_0x52ab9f[_0xa4c3('0x30')][_0xa4c3('0x40')]){_0xa510ed['include']=[{'all':!![]}];}_0xa510ed=_[_0xa4c3('0x3d')]({},_0xa510ed,_0x52ab9f['options']);return db[_0xa4c3('0x3e')][_0xa4c3('0x48')](_0xa510ed)[_0xa4c3('0x25')](handleEntityNotFound(_0x2e019d,null))[_0xa4c3('0x25')](respondWithResult(_0x2e019d,null))['catch'](handleError(_0x2e019d,null));};exports[_0xa4c3('0x49')]=function(_0xc308aa,_0x4f35ba){return db[_0xa4c3('0x3e')]['create'](_0xc308aa[_0xa4c3('0x4a')],{})[_0xa4c3('0x25')](respondWithResult(_0x4f35ba,0xc9))[_0xa4c3('0x43')](handleError(_0x4f35ba,null));};exports[_0xa4c3('0x24')]=function(_0x5384d5,_0x42434e){if(_0x5384d5['body']['id']){delete _0x5384d5[_0xa4c3('0x4a')]['id'];}return db[_0xa4c3('0x3e')]['find']({'where':{'id':_0x5384d5[_0xa4c3('0x45')]['id']}})[_0xa4c3('0x25')](handleEntityNotFound(_0x42434e,null))['then'](saveUpdates(_0x5384d5[_0xa4c3('0x4a')],null))['then'](respondWithResult(_0x42434e,null))[_0xa4c3('0x43')](handleError(_0x42434e,null));};exports['destroy']=function(_0x21a8bc,_0x1ba903){return db[_0xa4c3('0x3e')][_0xa4c3('0x48')]({'where':{'id':_0x21a8bc['params']['id']}})[_0xa4c3('0x25')](handleEntityNotFound(_0x1ba903,null))[_0xa4c3('0x25')](removeEntity(_0x1ba903,null))[_0xa4c3('0x43')](handleError(_0x1ba903,null));};exports[_0xa4c3('0x4b')]=function(_0x129170,_0xa4a2b3){return db['MailQueueReport'][_0xa4c3('0x4b')]()[_0xa4c3('0x25')](respondWithResult(_0xa4a2b3,null))[_0xa4c3('0x43')](handleError(_0xa4a2b3,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 29d7e24..ceb5e12 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 _0x1029=['path','rimraf','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','moment','bluebird'];(function(_0x462ad4,_0x22ded5){var _0x580516=function(_0x133c21){while(--_0x133c21){_0x462ad4['push'](_0x462ad4['shift']());}};_0x580516(++_0x22ded5);}(_0x1029,0xcd));var _0x9102=function(_0xa711b,_0x81a280){_0xa711b=_0xa711b-0x0;var _0x1f061d=_0x1029[_0xa711b];return _0x1f061d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9102('0x0'));var BPromise=require(_0x9102('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9102('0x2'));var rimraf=require(_0x9102('0x3'));var config=require('../../config/environment');var attributes=require(_0x9102('0x4'));module['exports']=function(_0x40b0c0,_0x3f9a8f){return _0x40b0c0[_0x9102('0x5')](_0x9102('0x6'),attributes,{'tableName':_0x9102('0x7'),'paranoid':![],'indexes':[{'name':_0x9102('0x8'),'fields':[_0x9102('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9745=['../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x1c30bf,_0x247c31){var _0x255b5e=function(_0x70c22b){while(--_0x70c22b){_0x1c30bf['push'](_0x1c30bf['shift']());}};_0x255b5e(++_0x247c31);}(_0x9745,0x12d));var _0x5974=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x9745[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0x5974('0x0'));var util=require(_0x5974('0x1'));var logger=require(_0x5974('0x2'))(_0x5974('0x3'));var moment=require(_0x5974('0x4'));var BPromise=require('bluebird');var rp=require(_0x5974('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5974('0x6'));var config=require(_0x5974('0x7'));var attributes=require(_0x5974('0x8'));module[_0x5974('0x9')]=function(_0x535ae8,_0x4667bb){return _0x535ae8['define'](_0x5974('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 0a6c0b8..ce016f2 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 _0xdc56=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateMailQueueReport','MailQueueReport','create','options','debug','UpdateMailQueueReport','update','raw','where','limit','lodash'];(function(_0x5058f1,_0x450cbf){var _0x4b0e31=function(_0x218b97){while(--_0x218b97){_0x5058f1['push'](_0x5058f1['shift']());}};_0x4b0e31(++_0x450cbf);}(_0xdc56,0x15f));var _0x6dc5=function(_0x400b43,_0x55da4e){_0x400b43=_0x400b43-0x0;var _0x3c330f=_0xdc56[_0x400b43];return _0x3c330f;};'use strict';var _=require(_0x6dc5('0x0'));var util=require(_0x6dc5('0x1'));var moment=require(_0x6dc5('0x2'));var BPromise=require(_0x6dc5('0x3'));var rs=require(_0x6dc5('0x4'));var fs=require('fs');var Redis=require(_0x6dc5('0x5'));var db=require(_0x6dc5('0x6'))['db'];var utils=require(_0x6dc5('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6dc5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6dc5('0x9')][_0x6dc5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x212a5d,_0x3979b4,_0x3e9c66){return new BPromise(function(_0x5cc562,_0x330d4e){return client[_0x6dc5('0xb')](_0x212a5d,_0x3e9c66)[_0x6dc5('0xc')](function(_0xf9176a){logger[_0x6dc5('0xd')](_0x6dc5('0xe'),_0x3979b4,_0x6dc5('0xf'));logger['debug'](_0x6dc5('0x10'),_0x3979b4,_0x6dc5('0xf'),JSON[_0x6dc5('0x11')](_0xf9176a));if(_0xf9176a[_0x6dc5('0x12')]){if(_0xf9176a[_0x6dc5('0x12')][_0x6dc5('0x13')]===0x1f4){logger[_0x6dc5('0x12')](_0x6dc5('0xe'),_0x3979b4,_0xf9176a[_0x6dc5('0x12')][_0x6dc5('0x14')]);return _0x330d4e(_0xf9176a[_0x6dc5('0x12')][_0x6dc5('0x14')]);}logger[_0x6dc5('0x12')]('MailQueueReport,\x20%s,\x20%s',_0x3979b4,_0xf9176a[_0x6dc5('0x12')][_0x6dc5('0x14')]);return _0x5cc562(_0xf9176a[_0x6dc5('0x12')][_0x6dc5('0x14')]);}else{logger[_0x6dc5('0xd')](_0x6dc5('0xe'),_0x3979b4,_0x6dc5('0xf'));_0x5cc562(_0xf9176a[_0x6dc5('0x15')]['message']);}})['catch'](function(_0x2d4d52){logger[_0x6dc5('0x12')](_0x6dc5('0xe'),_0x3979b4,_0x2d4d52);_0x330d4e(_0x2d4d52);});});}exports[_0x6dc5('0x16')]=function(_0x10e161){var _0x15f202=this;return new Promise(function(_0x41dc44,_0x34985c){return db[_0x6dc5('0x17')][_0x6dc5('0x18')](_0x10e161['body'],{'raw':_0x10e161[_0x6dc5('0x19')]?_0x10e161[_0x6dc5('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x6dc5('0xc')](function(_0x320567){logger[_0x6dc5('0xd')](_0x6dc5('0x16'),_0x10e161);logger[_0x6dc5('0x1a')](_0x6dc5('0x16'),_0x10e161,JSON['stringify'](_0x320567));_0x41dc44(_0x320567);})['catch'](function(_0x5ec8d7){logger[_0x6dc5('0x12')](_0x6dc5('0x16'),_0x5ec8d7['message'],_0x10e161);_0x34985c(_0x15f202['error'](0x1f4,_0x5ec8d7['message']));});});};exports[_0x6dc5('0x1b')]=function(_0x334961){var _0x3f7a08=this;return new Promise(function(_0x37d544,_0x4e3b31){return db[_0x6dc5('0x17')][_0x6dc5('0x1c')](_0x334961['body'],{'raw':_0x334961['options']?_0x334961['options'][_0x6dc5('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x334961[_0x6dc5('0x19')]?_0x334961['options'][_0x6dc5('0x1e')]||null:null,'attributes':_0x334961[_0x6dc5('0x19')]?_0x334961['options']['attributes']||null:null,'limit':_0x334961['options']?_0x334961['options'][_0x6dc5('0x1f')]||null:null})['then'](function(_0x451e29){logger[_0x6dc5('0xd')](_0x6dc5('0x1b'),_0x334961);logger[_0x6dc5('0x1a')]('UpdateMailQueueReport',_0x334961,JSON['stringify'](_0x451e29));_0x37d544(_0x451e29);})['catch'](function(_0x2a3245){logger[_0x6dc5('0x12')]('UpdateMailQueueReport',_0x2a3245[_0x6dc5('0x14')],_0x334961);_0x4e3b31(_0x3f7a08['error'](0x1f4,_0x2a3245[_0x6dc5('0x14')]));});});}; \ No newline at end of file +var _0x4042=['catch','CreateMailQueueReport','MailQueueReport','body','options','then','raw','attributes','limit','UpdateMailQueueReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0x4042,0xea));var _0x2404=function(_0x586aa0,_0x538856){_0x586aa0=_0x586aa0-0x0;var _0x333010=_0x4042[_0x586aa0];return _0x333010;};'use strict';var _=require(_0x2404('0x0'));var util=require('util');var moment=require(_0x2404('0x1'));var BPromise=require('bluebird');var rs=require(_0x2404('0x2'));var fs=require('fs');var Redis=require(_0x2404('0x3'));var db=require(_0x2404('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2404('0x5'))(_0x2404('0x6'));var config=require(_0x2404('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2404('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19f6dc,_0x6b1a52,_0x374c52){return new BPromise(function(_0x169292,_0x4f3852){return client[_0x2404('0x9')](_0x19f6dc,_0x374c52)['then'](function(_0x313a9e){logger[_0x2404('0xa')](_0x2404('0xb'),_0x6b1a52,_0x2404('0xc'));logger[_0x2404('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x6b1a52,_0x2404('0xc'),JSON[_0x2404('0xe')](_0x313a9e));if(_0x313a9e[_0x2404('0xf')]){if(_0x313a9e[_0x2404('0xf')][_0x2404('0x10')]===0x1f4){logger[_0x2404('0xf')](_0x2404('0xb'),_0x6b1a52,_0x313a9e['error'][_0x2404('0x11')]);return _0x4f3852(_0x313a9e[_0x2404('0xf')]['message']);}logger[_0x2404('0xf')](_0x2404('0xb'),_0x6b1a52,_0x313a9e[_0x2404('0xf')][_0x2404('0x11')]);return _0x169292(_0x313a9e[_0x2404('0xf')][_0x2404('0x11')]);}else{logger[_0x2404('0xa')](_0x2404('0xb'),_0x6b1a52,_0x2404('0xc'));_0x169292(_0x313a9e['result'][_0x2404('0x11')]);}})[_0x2404('0x12')](function(_0x3d253f){logger[_0x2404('0xf')](_0x2404('0xb'),_0x6b1a52,_0x3d253f);_0x4f3852(_0x3d253f);});});}exports[_0x2404('0x13')]=function(_0x4de800){var _0x23709a=this;return new Promise(function(_0x5c87af,_0xf02d2b){return db[_0x2404('0x14')]['create'](_0x4de800[_0x2404('0x15')],{'raw':_0x4de800[_0x2404('0x16')]?_0x4de800['options']['raw']===undefined?!![]:![]:!![]})[_0x2404('0x17')](function(_0x563927){logger[_0x2404('0xa')](_0x2404('0x13'),_0x4de800);logger[_0x2404('0xd')]('CreateMailQueueReport',_0x4de800,JSON[_0x2404('0xe')](_0x563927));_0x5c87af(_0x563927);})['catch'](function(_0x3c53b0){logger[_0x2404('0xf')](_0x2404('0x13'),_0x3c53b0['message'],_0x4de800);_0xf02d2b(_0x23709a['error'](0x1f4,_0x3c53b0[_0x2404('0x11')]));});});};exports['UpdateMailQueueReport']=function(_0x46b648){var _0x40c2d3=this;return new Promise(function(_0x3efb2a,_0x41f4e7){return db[_0x2404('0x14')]['update'](_0x46b648['body'],{'raw':_0x46b648[_0x2404('0x16')]?_0x46b648[_0x2404('0x16')][_0x2404('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46b648[_0x2404('0x16')]?_0x46b648[_0x2404('0x16')]['where']||null:null,'attributes':_0x46b648[_0x2404('0x16')]?_0x46b648['options'][_0x2404('0x19')]||null:null,'limit':_0x46b648['options']?_0x46b648[_0x2404('0x16')][_0x2404('0x1a')]||null:null})[_0x2404('0x17')](function(_0x1bf09d){logger[_0x2404('0xa')](_0x2404('0x1b'),_0x46b648);logger[_0x2404('0xd')](_0x2404('0x1b'),_0x46b648,JSON[_0x2404('0xe')](_0x1bf09d));_0x3efb2a(_0x1bf09d);})[_0x2404('0x12')](function(_0x37792e){logger[_0x2404('0xf')](_0x2404('0x1b'),_0x37792e[_0x2404('0x11')],_0x46b648);_0x41f4e7(_0x40c2d3['error'](0x1f4,_0x37792e['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 131c75e..e806d0c 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 _0xe545=['multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x61724b,_0x5cdc99){var _0x2d59d3=function(_0x45b4c3){while(--_0x45b4c3){_0x61724b['push'](_0x61724b['shift']());}};_0x2d59d3(++_0x5cdc99);}(_0xe545,0x6c));var _0x5e54=function(_0x2cb019,_0x19931a){_0x2cb019=_0x2cb019-0x0;var _0x49c344=_0xe545[_0x2cb019];return _0x49c344;};'use strict';var multer=require(_0x5e54('0x0'));var util=require(_0x5e54('0x1'));var path=require('path');var timeout=require(_0x5e54('0x2'));var express=require(_0x5e54('0x3'));var router=express[_0x5e54('0x4')]();var auth=require(_0x5e54('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x28cd=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','multer'];(function(_0x61c477,_0x1e4da0){var _0x425a33=function(_0x40795b){while(--_0x40795b){_0x61c477['push'](_0x61c477['shift']());}};_0x425a33(++_0x1e4da0);}(_0x28cd,0x1bf));var _0xd28c=function(_0x137efe,_0x52910e){_0x137efe=_0x137efe-0x0;var _0x48fdfb=_0x28cd[_0x137efe];return _0x48fdfb;};'use strict';var multer=require(_0xd28c('0x0'));var util=require(_0xd28c('0x1'));var path=require(_0xd28c('0x2'));var timeout=require(_0xd28c('0x3'));var express=require('express');var router=express[_0xd28c('0x4')]();var auth=require(_0xd28c('0x5'));var interaction=require(_0xd28c('0x6'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index c8a93e0..3d2f409 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 _0xdab0=['BOOLEAN','STRING','username','INTEGER','INBOX','sequelize','exports'];(function(_0x46b31e,_0x29ef50){var _0x2e1f24=function(_0x57c121){while(--_0x57c121){_0x46b31e['push'](_0x46b31e['shift']());}};_0x2e1f24(++_0x29ef50);}(_0xdab0,0xc9));var _0x0dab=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xdab0[_0x263a74];return _0x2aa86c;};'use strict';var Sequelize=require(_0x0dab('0x0'));module[_0x0dab('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x0dab('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x0dab('0x3')],'unique':_0x0dab('0x4')},'password':{'type':Sequelize[_0x0dab('0x3')]},'port':{'type':Sequelize[_0x0dab('0x5')]},'tls':{'type':Sequelize[_0x0dab('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x0dab('0x3')],'defaultValue':_0x0dab('0x6')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x0dab('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x0dab('0x3')]}}; \ No newline at end of file +var _0xcd14=['username','INBOX','INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x3661dc,_0x3ee317){var _0x4cfe83=function(_0x50953b){while(--_0x50953b){_0x3661dc['push'](_0x3661dc['shift']());}};_0x4cfe83(++_0x3ee317);}(_0xcd14,0x114));var _0x4cd1=function(_0x23a0a1,_0x2a7f36){_0x23a0a1=_0x23a0a1-0x0;var _0x704b9f=_0xcd14[_0x23a0a1];return _0x704b9f;};'use strict';var Sequelize=require(_0x4cd1('0x0'));module[_0x4cd1('0x1')]={'description':{'type':Sequelize[_0x4cd1('0x2')]},'host':{'type':Sequelize[_0x4cd1('0x2')]},'authentication':{'type':Sequelize[_0x4cd1('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x4cd1('0x2')],'unique':_0x4cd1('0x4')},'password':{'type':Sequelize[_0x4cd1('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x4cd1('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x4cd1('0x5')},'connTimeout':{'type':Sequelize[_0x4cd1('0x6')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x4cd1('0x6')],'defaultValue':0x5},'service':{'type':Sequelize[_0x4cd1('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 74c0eaa..826b85f 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 _0x15b8=['moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','util','../../config/logger','api'];(function(_0xe043ab,_0x3d3d46){var _0x377f8b=function(_0x2df594){while(--_0x2df594){_0xe043ab['push'](_0xe043ab['shift']());}};_0x377f8b(++_0x3d3d46);}(_0x15b8,0xcd));var _0x815b=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x15b8[_0x334841];return _0x5beb4b;};'use strict';var _=require('lodash');var util=require(_0x815b('0x0'));var logger=require(_0x815b('0x1'))(_0x815b('0x2'));var moment=require(_0x815b('0x3'));var BPromise=require(_0x815b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x815b('0x5'));var rimraf=require(_0x815b('0x6'));var config=require(_0x815b('0x7'));var attributes=require(_0x815b('0x8'));module[_0x815b('0x9')]=function(_0x37a503,_0x581869){return _0x37a503[_0x815b('0xa')](_0x815b('0xb'),attributes,{'tableName':_0x815b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a95=['bluebird','request-promise','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','lodash','util','../../config/logger','api','moment'];(function(_0x540b32,_0x1f302e){var _0x3afc58=function(_0x5afb0e){while(--_0x5afb0e){_0x540b32['push'](_0x540b32['shift']());}};_0x3afc58(++_0x1f302e);}(_0x6a95,0x1db));var _0x56a9=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x6a95[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var logger=require(_0x56a9('0x2'))(_0x56a9('0x3'));var moment=require(_0x56a9('0x4'));var BPromise=require(_0x56a9('0x5'));var rp=require(_0x56a9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x56a9('0x7'));var attributes=require(_0x56a9('0x8'));module[_0x56a9('0x9')]=function(_0x2eb132,_0x3c15b6){return _0x2eb132[_0x56a9('0xa')](_0x56a9('0xb'),attributes,{'tableName':'mail_servers_in','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 b1103dd..ec2f9a5 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 _0x5a9a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetMailServerIn','MailServerIn','findAll','options','raw','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2282c0,_0x216557){var _0x52294a=function(_0x26ce7f){while(--_0x26ce7f){_0x2282c0['push'](_0x2282c0['shift']());}};_0x52294a(++_0x216557);}(_0x5a9a,0x1ac));var _0xa5a9=function(_0xd676ca,_0x2a2746){_0xd676ca=_0xd676ca-0x0;var _0x30478e=_0x5a9a[_0xd676ca];return _0x30478e;};'use strict';var _=require(_0xa5a9('0x0'));var util=require(_0xa5a9('0x1'));var moment=require(_0xa5a9('0x2'));var BPromise=require(_0xa5a9('0x3'));var rs=require(_0xa5a9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5a9('0x5'))['db'];var utils=require(_0xa5a9('0x6'));var logger=require(_0xa5a9('0x7'))(_0xa5a9('0x8'));var config=require(_0xa5a9('0x9'));var jayson=require(_0xa5a9('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3206ac,_0x32d5f4,_0x3c8c46){return new BPromise(function(_0x47cd6d,_0x4dc780){return client[_0xa5a9('0xb')](_0x3206ac,_0x3c8c46)[_0xa5a9('0xc')](function(_0x333123){logger[_0xa5a9('0xd')](_0xa5a9('0xe'),_0x32d5f4,'request\x20sent');logger[_0xa5a9('0xf')](_0xa5a9('0x10'),_0x32d5f4,'request\x20sent',JSON[_0xa5a9('0x11')](_0x333123));if(_0x333123[_0xa5a9('0x12')]){if(_0x333123[_0xa5a9('0x12')][_0xa5a9('0x13')]===0x1f4){logger[_0xa5a9('0x12')](_0xa5a9('0xe'),_0x32d5f4,_0x333123['error'][_0xa5a9('0x14')]);return _0x4dc780(_0x333123['error'][_0xa5a9('0x14')]);}logger[_0xa5a9('0x12')](_0xa5a9('0xe'),_0x32d5f4,_0x333123['error']['message']);return _0x47cd6d(_0x333123[_0xa5a9('0x12')][_0xa5a9('0x14')]);}else{logger[_0xa5a9('0xd')](_0xa5a9('0xe'),_0x32d5f4,'request\x20sent');_0x47cd6d(_0x333123['result'][_0xa5a9('0x14')]);}})['catch'](function(_0x1352dd){logger[_0xa5a9('0x12')](_0xa5a9('0xe'),_0x32d5f4,_0x1352dd);_0x4dc780(_0x1352dd);});});}exports[_0xa5a9('0x15')]=function(_0x22ca78){var _0x2585d6=this;return new Promise(function(_0x46ac6d,_0x43564f){return db[_0xa5a9('0x16')][_0xa5a9('0x17')]({'raw':_0x22ca78[_0xa5a9('0x18')]?_0x22ca78[_0xa5a9('0x18')][_0xa5a9('0x19')]===undefined?!![]:![]:!![],'where':_0x22ca78[_0xa5a9('0x18')]?_0x22ca78[_0xa5a9('0x18')]['where']||null:null,'attributes':_0x22ca78['options']?_0x22ca78[_0xa5a9('0x18')][_0xa5a9('0x1a')]||null:null,'limit':_0x22ca78['options']?_0x22ca78['options'][_0xa5a9('0x1b')]||null:null,'include':_0x22ca78[_0xa5a9('0x18')]?_0x22ca78[_0xa5a9('0x18')][_0xa5a9('0x1c')]?_[_0xa5a9('0x1d')](_0x22ca78[_0xa5a9('0x18')][_0xa5a9('0x1c')],function(_0x2c811f){return{'model':db[_0x2c811f[_0xa5a9('0x1e')]],'as':_0x2c811f['as'],'attributes':_0x2c811f[_0xa5a9('0x1a')],'include':_0x2c811f[_0xa5a9('0x1c')]?_['map'](_0x2c811f[_0xa5a9('0x1c')],function(_0x271014){return{'model':db[_0x271014[_0xa5a9('0x1e')]],'as':_0x271014['as'],'attributes':_0x271014[_0xa5a9('0x1a')],'include':_0x271014[_0xa5a9('0x1c')]?_['map'](_0x271014[_0xa5a9('0x1c')],function(_0x174cb1){return{'model':db[_0x174cb1['model']],'as':_0x174cb1['as'],'attributes':_0x174cb1['attributes']};}):[]};}):[]};}):[]:[]})[_0xa5a9('0xc')](function(_0x4fd25d){logger[_0xa5a9('0xd')](_0xa5a9('0x15'),_0x22ca78);logger[_0xa5a9('0xf')]('GetMailServerIn',_0x22ca78,JSON[_0xa5a9('0x11')](_0x4fd25d));_0x46ac6d(_0x4fd25d);})['catch'](function(_0x321376){logger[_0xa5a9('0x12')](_0xa5a9('0x15'),_0x321376['message'],_0x22ca78);_0x43564f(_0x2585d6[_0xa5a9('0x12')](0x1f4,_0x321376['message']));});});}; \ No newline at end of file +var _0xb21b=['where','attributes','limit','include','map','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xb21b,0x69));var _0xbb21=function(_0x227b0e,_0x4638ce){_0x227b0e=_0x227b0e-0x0;var _0x3aa6cc=_0xb21b[_0x227b0e];return _0x3aa6cc;};'use strict';var _=require(_0xbb21('0x0'));var util=require(_0xbb21('0x1'));var moment=require(_0xbb21('0x2'));var BPromise=require(_0xbb21('0x3'));var rs=require(_0xbb21('0x4'));var fs=require('fs');var Redis=require(_0xbb21('0x5'));var db=require(_0xbb21('0x6'))['db'];var utils=require(_0xbb21('0x7'));var logger=require(_0xbb21('0x8'))(_0xbb21('0x9'));var config=require(_0xbb21('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb21('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d5680,_0x4bcd5f,_0xa6ea74){return new BPromise(function(_0x4a8a29,_0xe77031){return client[_0xbb21('0xc')](_0x5d5680,_0xa6ea74)['then'](function(_0xbe49a2){logger['info'](_0xbb21('0xd'),_0x4bcd5f,'request\x20sent');logger[_0xbb21('0xe')](_0xbb21('0xf'),_0x4bcd5f,'request\x20sent',JSON[_0xbb21('0x10')](_0xbe49a2));if(_0xbe49a2[_0xbb21('0x11')]){if(_0xbe49a2[_0xbb21('0x11')]['code']===0x1f4){logger[_0xbb21('0x11')]('MailServerIn,\x20%s,\x20%s',_0x4bcd5f,_0xbe49a2['error'][_0xbb21('0x12')]);return _0xe77031(_0xbe49a2[_0xbb21('0x11')][_0xbb21('0x12')]);}logger[_0xbb21('0x11')]('MailServerIn,\x20%s,\x20%s',_0x4bcd5f,_0xbe49a2['error'][_0xbb21('0x12')]);return _0x4a8a29(_0xbe49a2[_0xbb21('0x11')]['message']);}else{logger[_0xbb21('0x13')](_0xbb21('0xd'),_0x4bcd5f,'request\x20sent');_0x4a8a29(_0xbe49a2[_0xbb21('0x14')][_0xbb21('0x12')]);}})[_0xbb21('0x15')](function(_0x32d6f7){logger['error'](_0xbb21('0xd'),_0x4bcd5f,_0x32d6f7);_0xe77031(_0x32d6f7);});});}exports[_0xbb21('0x16')]=function(_0x458b5f){var _0x232b10=this;return new Promise(function(_0x263cc8,_0x4891fd){return db[_0xbb21('0x17')][_0xbb21('0x18')]({'raw':_0x458b5f[_0xbb21('0x19')]?_0x458b5f[_0xbb21('0x19')][_0xbb21('0x1a')]===undefined?!![]:![]:!![],'where':_0x458b5f[_0xbb21('0x19')]?_0x458b5f[_0xbb21('0x19')][_0xbb21('0x1b')]||null:null,'attributes':_0x458b5f['options']?_0x458b5f[_0xbb21('0x19')][_0xbb21('0x1c')]||null:null,'limit':_0x458b5f[_0xbb21('0x19')]?_0x458b5f['options'][_0xbb21('0x1d')]||null:null,'include':_0x458b5f[_0xbb21('0x19')]?_0x458b5f[_0xbb21('0x19')][_0xbb21('0x1e')]?_[_0xbb21('0x1f')](_0x458b5f[_0xbb21('0x19')][_0xbb21('0x1e')],function(_0xaa773d){return{'model':db[_0xaa773d['model']],'as':_0xaa773d['as'],'attributes':_0xaa773d[_0xbb21('0x1c')],'include':_0xaa773d[_0xbb21('0x1e')]?_[_0xbb21('0x1f')](_0xaa773d[_0xbb21('0x1e')],function(_0x411925){return{'model':db[_0x411925['model']],'as':_0x411925['as'],'attributes':_0x411925[_0xbb21('0x1c')],'include':_0x411925[_0xbb21('0x1e')]?_[_0xbb21('0x1f')](_0x411925['include'],function(_0x40c77e){return{'model':db[_0x40c77e['model']],'as':_0x40c77e['as'],'attributes':_0x40c77e[_0xbb21('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbb21('0x20')](function(_0x32638b){logger[_0xbb21('0x13')](_0xbb21('0x16'),_0x458b5f);logger[_0xbb21('0xe')](_0xbb21('0x16'),_0x458b5f,JSON['stringify'](_0x32638b));_0x263cc8(_0x32638b);})['catch'](function(_0x1ceca0){logger[_0xbb21('0x11')](_0xbb21('0x16'),_0x1ceca0[_0xbb21('0x12')],_0x458b5f);_0x4891fd(_0x232b10[_0xbb21('0x11')](0x1f4,_0x1ceca0[_0xbb21('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 394e228..b0d2d12 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 _0xc711=['get','index','/:id','isAuthenticated','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailServerOut.controller'];(function(_0x505a81,_0x2d4ff5){var _0x386643=function(_0x338de6){while(--_0x338de6){_0x505a81['push'](_0x505a81['shift']());}};_0x386643(++_0x2d4ff5);}(_0xc711,0x129));var _0x1c71=function(_0x15942a,_0x13b58c){_0x15942a=_0x15942a-0x0;var _0x36a9fb=_0xc711[_0x15942a];return _0x36a9fb;};'use strict';var multer=require(_0x1c71('0x0'));var util=require(_0x1c71('0x1'));var path=require(_0x1c71('0x2'));var timeout=require(_0x1c71('0x3'));var express=require(_0x1c71('0x4'));var router=express[_0x1c71('0x5')]();var auth=require(_0x1c71('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1c71('0x7'));var controller=require(_0x1c71('0x8'));router[_0x1c71('0x9')]('/',auth['isAuthenticated'](),controller[_0x1c71('0xa')]);router[_0x1c71('0x9')](_0x1c71('0xb'),auth[_0x1c71('0xc')](),controller['show']);router['post']('/',auth[_0x1c71('0xc')](),controller[_0x1c71('0xd')]);router[_0x1c71('0xe')](_0x1c71('0xb'),auth['isAuthenticated'](),controller[_0x1c71('0xf')]);router[_0x1c71('0x10')](_0x1c71('0xb'),auth['isAuthenticated'](),controller[_0x1c71('0x11')]);module['exports']=router; \ No newline at end of file +var _0x295c=['delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x350ec0,_0x4f0e95){var _0x34f7f9=function(_0x29539c){while(--_0x29539c){_0x350ec0['push'](_0x350ec0['shift']());}};_0x34f7f9(++_0x4f0e95);}(_0x295c,0x158));var _0xc295=function(_0x41b820,_0x2ca0a5){_0x41b820=_0x41b820-0x0;var _0x4022db=_0x295c[_0x41b820];return _0x4022db;};'use strict';var multer=require(_0xc295('0x0'));var util=require('util');var path=require(_0xc295('0x1'));var timeout=require(_0xc295('0x2'));var express=require(_0xc295('0x3'));var router=express[_0xc295('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc295('0x5'));var config=require(_0xc295('0x6'));var controller=require(_0xc295('0x7'));router[_0xc295('0x8')]('/',auth[_0xc295('0x9')](),controller[_0xc295('0xa')]);router['get'](_0xc295('0xb'),auth[_0xc295('0x9')](),controller[_0xc295('0xc')]);router[_0xc295('0xd')]('/',auth[_0xc295('0x9')](),controller['create']);router[_0xc295('0xe')]('/:id',auth[_0xc295('0x9')](),controller[_0xc295('0xf')]);router[_0xc295('0x10')](_0xc295('0xb'),auth[_0xc295('0x9')](),controller[_0xc295('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 55bb31b..c9ffd8a 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 _0x9432=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x3f8972,_0x41c50b){var _0x12efeb=function(_0x3308d6){while(--_0x3308d6){_0x3f8972['push'](_0x3f8972['shift']());}};_0x12efeb(++_0x41c50b);}(_0x9432,0x1e3));var _0x2943=function(_0x3cac20,_0x45140c){_0x3cac20=_0x3cac20-0x0;var _0x3b51d0=_0x9432[_0x3cac20];return _0x3b51d0;};'use strict';var Sequelize=require(_0x2943('0x0'));module[_0x2943('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x2943('0x2')]},'user':{'type':Sequelize[_0x2943('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x2943('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x2943('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1228=['STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x1ca9eb,_0x99a10b){var _0x2e284e=function(_0x1196a4){while(--_0x1196a4){_0x1ca9eb['push'](_0x1ca9eb['shift']());}};_0x2e284e(++_0x99a10b);}(_0x1228,0x12f));var _0x8122=function(_0x2544bc,_0x59a778){_0x2544bc=_0x2544bc-0x0;var _0x1431d5=_0x1228[_0x2544bc];return _0x1431d5;};'use strict';var Sequelize=require(_0x8122('0x0'));module['exports']={'description':{'type':Sequelize[_0x8122('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x8122('0x1')]},'pass':{'type':Sequelize[_0x8122('0x1')]},'port':{'type':Sequelize[_0x8122('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x8122('0x1')]},'authentication':{'type':Sequelize[_0x8122('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 6236513..f66a8c8 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 _0x7275=['status','end','offset','limit','Content-Range','json','apply','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','MailServerOut','count','includeAll','findAll','rows','catch','show','params','filtears','include','options','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x2236dc,_0x43c7f9){var _0x20583f=function(_0x293e36){while(--_0x293e36){_0x2236dc['push'](_0x2236dc['shift']());}};_0x20583f(++_0x43c7f9);}(_0x7275,0x143));var _0x5727=function(_0x42f5d5,_0x5b70b9){_0x42f5d5=_0x42f5d5-0x0;var _0x5e9214=_0x7275[_0x42f5d5];return _0x5e9214;};'use strict';var pdf=require(_0x5727('0x0'));var emlformat=require(_0x5727('0x1'));var rimraf=require(_0x5727('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5727('0x3'));var rp=require('request-promise');var moment=require(_0x5727('0x4'));var BPromise=require(_0x5727('0x5'));var Mustache=require('mustache');var util=require(_0x5727('0x6'));var path=require(_0x5727('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5727('0x8'));var squel=require('squel');var crypto=require(_0x5727('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x5727('0xa'));var toCsv=require('to-csv');var querystring=require(_0x5727('0xb'));var Papa=require(_0x5727('0xc'));var Redis=require('ioredis');var authService=require(_0x5727('0xd'));var qs=require(_0x5727('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5727('0xf'));var logger=require(_0x5727('0x10'))('api');var utils=require(_0x5727('0x11'));var config=require(_0x5727('0x12'));var licenseUtil=require(_0x5727('0x13'));var db=require(_0x5727('0x14'))['db'];function respondWithStatusCode(_0x362b0e,_0x45ec3c){_0x45ec3c=_0x45ec3c||0xcc;return function(_0x48c6f4){if(_0x48c6f4){return _0x362b0e[_0x5727('0x15')](_0x45ec3c);}return _0x362b0e[_0x5727('0x16')](_0x45ec3c)[_0x5727('0x17')]();};}function respondWithResult(_0x242b6a,_0x2a01df){_0x2a01df=_0x2a01df||0xc8;return function(_0x463721){if(_0x463721){return _0x242b6a[_0x5727('0x16')](_0x2a01df)['json'](_0x463721);}};}function respondWithFilteredResult(_0x24e514,_0x284633){return function(_0x1dcefc){if(_0x1dcefc){var _0x12b045=_0x1dcefc['count'],_0xbc76a4=_0x284633[_0x5727('0x18')],_0x31b6c0=_0x284633['offset']+_0x284633[_0x5727('0x19')],_0x273dc9;if(_0x31b6c0>=_0x12b045){_0x31b6c0=_0x12b045;_0x273dc9=0xc8;}else{_0x273dc9=0xce;}_0x24e514[_0x5727('0x16')](_0x273dc9);return _0x24e514['set'](_0x5727('0x1a'),_0xbc76a4+'-'+_0x31b6c0+'/'+_0x12b045)[_0x5727('0x1b')](_0x1dcefc);}return null;};}function patchUpdates(_0x15f25b){return function(_0x35e30f){try{jsonpatch[_0x5727('0x1c')](_0x35e30f,_0x15f25b,!![]);}catch(_0x497f94){return BPromise['reject'](_0x497f94);}return _0x35e30f[_0x5727('0x1d')]();};}function saveUpdates(_0xb99c6e,_0x84c9e2){return function(_0x18f638){if(_0x18f638){return _0x18f638[_0x5727('0x1e')](_0xb99c6e)[_0x5727('0x1f')](function(_0x3159e8){return _0x3159e8;});}return null;};}function removeEntity(_0x5c63ef,_0x4aa3af){return function(_0x476a47){if(_0x476a47){return _0x476a47[_0x5727('0x20')]()['then'](function(){_0x5c63ef[_0x5727('0x16')](0xcc)[_0x5727('0x17')]();});}};}function handleEntityNotFound(_0x3775b5,_0x4a3e6b){return function(_0x56d44b){if(!_0x56d44b){_0x3775b5[_0x5727('0x15')](0x194);}return _0x56d44b;};}function handleError(_0x179e74,_0x5d33bb){_0x5d33bb=_0x5d33bb||0x1f4;return function(_0x41cd74){logger['error'](_0x41cd74[_0x5727('0x21')]);if(_0x41cd74[_0x5727('0x22')]){delete _0x41cd74['name'];}_0x179e74['status'](_0x5d33bb)[_0x5727('0x23')](_0x41cd74);};}exports['index']=function(_0x4c5305,_0x3dd7d2){var _0x161f5={},_0x28888d={},_0xf82573={'count':0x0,'rows':[]};var _0x3afd59=_['map'](db['MailServerOut'][_0x5727('0x24')],function(_0x1d58ea){return{'name':_0x1d58ea[_0x5727('0x25')],'type':_0x1d58ea[_0x5727('0x26')]['key']};});_0x28888d[_0x5727('0x27')]=_['map'](_0x3afd59,_0x5727('0x22'));_0x28888d['query']=_[_0x5727('0x28')](_0x4c5305['query']);_0x28888d[_0x5727('0x29')]=_[_0x5727('0x2a')](_0x28888d[_0x5727('0x27')],_0x28888d[_0x5727('0x2b')]);_0x161f5['attributes']=_[_0x5727('0x2a')](_0x28888d[_0x5727('0x27')],qs['fields'](_0x4c5305['query'][_0x5727('0x2c')]));_0x161f5[_0x5727('0x2d')]=_0x161f5[_0x5727('0x2d')][_0x5727('0x2e')]?_0x161f5[_0x5727('0x2d')]:_0x28888d['model'];if(!_0x4c5305[_0x5727('0x2b')][_0x5727('0x2f')](_0x5727('0x30'))){_0x161f5[_0x5727('0x19')]=qs[_0x5727('0x19')](_0x4c5305[_0x5727('0x2b')][_0x5727('0x19')]);_0x161f5[_0x5727('0x18')]=qs[_0x5727('0x18')](_0x4c5305[_0x5727('0x2b')][_0x5727('0x18')]);}_0x161f5[_0x5727('0x31')]=qs[_0x5727('0x32')](_0x4c5305[_0x5727('0x2b')]['sort']);_0x161f5[_0x5727('0x33')]=qs[_0x5727('0x29')](_[_0x5727('0x34')](_0x4c5305[_0x5727('0x2b')],_0x28888d[_0x5727('0x29')]),_0x3afd59);if(_0x4c5305['query'][_0x5727('0x35')]){_0x161f5[_0x5727('0x33')]=_[_0x5727('0x36')](_0x161f5['where'],{'$or':_['map'](_0x3afd59,function(_0x34a78a){if(_0x34a78a['type']!=='VIRTUAL'){var _0x4a7d4e={};_0x4a7d4e[_0x34a78a['name']]={'$like':'%'+_0x4c5305[_0x5727('0x2b')][_0x5727('0x35')]+'%'};return _0x4a7d4e;}})});}_0x161f5=_[_0x5727('0x36')]({},_0x161f5,_0x4c5305['options']);var _0x1f4022={'where':_0x161f5[_0x5727('0x33')]};return db[_0x5727('0x37')]['count'](_0x1f4022)[_0x5727('0x1f')](function(_0x1eeac5){_0xf82573[_0x5727('0x38')]=_0x1eeac5;if(_0x4c5305['query'][_0x5727('0x39')]){_0x161f5['include']=[{'all':!![]}];}return db[_0x5727('0x37')][_0x5727('0x3a')](_0x161f5);})['then'](function(_0x25d6b2){_0xf82573[_0x5727('0x3b')]=_0x25d6b2;return _0xf82573;})[_0x5727('0x1f')](respondWithFilteredResult(_0x3dd7d2,_0x161f5))[_0x5727('0x3c')](handleError(_0x3dd7d2,null));};exports[_0x5727('0x3d')]=function(_0x2dfaab,_0x1e580f){var _0x5a88c1={'raw':!![],'where':{'id':_0x2dfaab[_0x5727('0x3e')]['id']}},_0xcb90a0={};_0xcb90a0[_0x5727('0x27')]=_['keys'](db[_0x5727('0x37')][_0x5727('0x24')]);_0xcb90a0[_0x5727('0x2b')]=_[_0x5727('0x28')](_0x2dfaab[_0x5727('0x2b')]);_0xcb90a0[_0x5727('0x3f')]=_[_0x5727('0x2a')](_0xcb90a0['model'],_0xcb90a0[_0x5727('0x2b')]);_0x5a88c1[_0x5727('0x2d')]=_[_0x5727('0x2a')](_0xcb90a0[_0x5727('0x27')],qs[_0x5727('0x2c')](_0x2dfaab[_0x5727('0x2b')][_0x5727('0x2c')]));_0x5a88c1[_0x5727('0x2d')]=_0x5a88c1[_0x5727('0x2d')][_0x5727('0x2e')]?_0x5a88c1[_0x5727('0x2d')]:_0xcb90a0[_0x5727('0x27')];if(_0x2dfaab[_0x5727('0x2b')][_0x5727('0x39')]){_0x5a88c1[_0x5727('0x40')]=[{'all':!![]}];}_0x5a88c1=_[_0x5727('0x36')]({},_0x5a88c1,_0x2dfaab[_0x5727('0x41')]);return db[_0x5727('0x37')]['find'](_0x5a88c1)['then'](handleEntityNotFound(_0x1e580f,null))[_0x5727('0x1f')](respondWithResult(_0x1e580f,null))[_0x5727('0x3c')](handleError(_0x1e580f,null));};exports['create']=function(_0x1e25f1,_0x5ca576){return db[_0x5727('0x37')][_0x5727('0x42')](_0x1e25f1[_0x5727('0x43')],{})[_0x5727('0x1f')](respondWithResult(_0x5ca576,0xc9))['catch'](handleError(_0x5ca576,null));};exports['update']=function(_0x2404e8,_0x423037){if(_0x2404e8[_0x5727('0x43')]['id']){delete _0x2404e8[_0x5727('0x43')]['id'];}return db[_0x5727('0x37')]['find']({'where':{'id':_0x2404e8[_0x5727('0x3e')]['id']}})[_0x5727('0x1f')](handleEntityNotFound(_0x423037,null))[_0x5727('0x1f')](saveUpdates(_0x2404e8['body'],null))[_0x5727('0x1f')](respondWithResult(_0x423037,null))[_0x5727('0x3c')](handleError(_0x423037,null));};exports[_0x5727('0x20')]=function(_0x43cb66,_0x3ff5c7){return db[_0x5727('0x37')][_0x5727('0x44')]({'where':{'id':_0x43cb66[_0x5727('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3ff5c7,null))[_0x5727('0x1f')](removeEntity(_0x3ff5c7,null))[_0x5727('0x3c')](handleError(_0x3ff5c7,null));}; \ No newline at end of file +var _0x8eba=['Content-Range','json','apply','update','destroy','then','sendStatus','error','stack','name','send','index','map','MailServerOut','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','filtears','find','create','body','catch','html-pdf','eml-format','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','count','offset','set'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x8eba,0xc3));var _0xa8eb=function(_0x23c73d,_0x357b21){_0x23c73d=_0x23c73d-0x0;var _0x36ba47=_0x8eba[_0x23c73d];return _0x36ba47;};'use strict';var pdf=require(_0xa8eb('0x0'));var emlformat=require(_0xa8eb('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa8eb('0x2'));var moment=require(_0xa8eb('0x3'));var BPromise=require(_0xa8eb('0x4'));var Mustache=require(_0xa8eb('0x5'));var util=require('util');var path=require(_0xa8eb('0x6'));var sox=require(_0xa8eb('0x7'));var csv=require('to-csv');var ejs=require(_0xa8eb('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa8eb('0x9'));var crypto=require(_0xa8eb('0xa'));var jsforce=require(_0xa8eb('0xb'));var deskjs=require(_0xa8eb('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa8eb('0xd'));var Papa=require(_0xa8eb('0xe'));var Redis=require('ioredis');var authService=require(_0xa8eb('0xf'));var qs=require(_0xa8eb('0x10'));var as=require(_0xa8eb('0x11'));var hardwareService=require(_0xa8eb('0x12'));var logger=require('../../config/logger')(_0xa8eb('0x13'));var utils=require('../../config/utils');var config=require(_0xa8eb('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa8eb('0x15'))['db'];function respondWithStatusCode(_0x47149c,_0x5b21fc){_0x5b21fc=_0x5b21fc||0xcc;return function(_0x2c7cff){if(_0x2c7cff){return _0x47149c['sendStatus'](_0x5b21fc);}return _0x47149c[_0xa8eb('0x16')](_0x5b21fc)[_0xa8eb('0x17')]();};}function respondWithResult(_0xa38acb,_0x1a014a){_0x1a014a=_0x1a014a||0xc8;return function(_0x557bb0){if(_0x557bb0){return _0xa38acb[_0xa8eb('0x16')](_0x1a014a)['json'](_0x557bb0);}};}function respondWithFilteredResult(_0x2b2d65,_0x401cd5){return function(_0x40ec36){if(_0x40ec36){var _0x102a81=_0x40ec36[_0xa8eb('0x18')],_0x538313=_0x401cd5[_0xa8eb('0x19')],_0x115017=_0x401cd5[_0xa8eb('0x19')]+_0x401cd5['limit'],_0x3c4786;if(_0x115017>=_0x102a81){_0x115017=_0x102a81;_0x3c4786=0xc8;}else{_0x3c4786=0xce;}_0x2b2d65[_0xa8eb('0x16')](_0x3c4786);return _0x2b2d65[_0xa8eb('0x1a')](_0xa8eb('0x1b'),_0x538313+'-'+_0x115017+'/'+_0x102a81)[_0xa8eb('0x1c')](_0x40ec36);}return null;};}function patchUpdates(_0x1f7205){return function(_0x27bf23){try{jsonpatch[_0xa8eb('0x1d')](_0x27bf23,_0x1f7205,!![]);}catch(_0x12284e){return BPromise['reject'](_0x12284e);}return _0x27bf23['save']();};}function saveUpdates(_0x4fe96c,_0x1f6d6d){return function(_0x3f3e49){if(_0x3f3e49){return _0x3f3e49[_0xa8eb('0x1e')](_0x4fe96c)['then'](function(_0xf9d099){return _0xf9d099;});}return null;};}function removeEntity(_0x1025ef,_0x449f76){return function(_0x453b69){if(_0x453b69){return _0x453b69[_0xa8eb('0x1f')]()[_0xa8eb('0x20')](function(){_0x1025ef[_0xa8eb('0x16')](0xcc)[_0xa8eb('0x17')]();});}};}function handleEntityNotFound(_0x4557fc,_0x387d49){return function(_0xf55fd4){if(!_0xf55fd4){_0x4557fc[_0xa8eb('0x21')](0x194);}return _0xf55fd4;};}function handleError(_0xee9db2,_0x5d7213){_0x5d7213=_0x5d7213||0x1f4;return function(_0x15b149){logger[_0xa8eb('0x22')](_0x15b149[_0xa8eb('0x23')]);if(_0x15b149[_0xa8eb('0x24')]){delete _0x15b149[_0xa8eb('0x24')];}_0xee9db2['status'](_0x5d7213)[_0xa8eb('0x25')](_0x15b149);};}exports[_0xa8eb('0x26')]=function(_0x3a2a2f,_0x26bec0){var _0xdf010b={},_0x54792a={},_0x52e54a={'count':0x0,'rows':[]};var _0x16f882=_[_0xa8eb('0x27')](db[_0xa8eb('0x28')][_0xa8eb('0x29')],function(_0x418200){return{'name':_0x418200['fieldName'],'type':_0x418200[_0xa8eb('0x2a')][_0xa8eb('0x2b')]};});_0x54792a[_0xa8eb('0x2c')]=_[_0xa8eb('0x27')](_0x16f882,_0xa8eb('0x24'));_0x54792a[_0xa8eb('0x2d')]=_[_0xa8eb('0x2e')](_0x3a2a2f['query']);_0x54792a[_0xa8eb('0x2f')]=_['intersection'](_0x54792a[_0xa8eb('0x2c')],_0x54792a[_0xa8eb('0x2d')]);_0xdf010b['attributes']=_[_0xa8eb('0x30')](_0x54792a['model'],qs[_0xa8eb('0x31')](_0x3a2a2f[_0xa8eb('0x2d')][_0xa8eb('0x31')]));_0xdf010b[_0xa8eb('0x32')]=_0xdf010b['attributes'][_0xa8eb('0x33')]?_0xdf010b[_0xa8eb('0x32')]:_0x54792a[_0xa8eb('0x2c')];if(!_0x3a2a2f[_0xa8eb('0x2d')][_0xa8eb('0x34')](_0xa8eb('0x35'))){_0xdf010b['limit']=qs[_0xa8eb('0x36')](_0x3a2a2f['query']['limit']);_0xdf010b['offset']=qs[_0xa8eb('0x19')](_0x3a2a2f[_0xa8eb('0x2d')][_0xa8eb('0x19')]);}_0xdf010b[_0xa8eb('0x37')]=qs[_0xa8eb('0x38')](_0x3a2a2f['query']['sort']);_0xdf010b[_0xa8eb('0x39')]=qs[_0xa8eb('0x2f')](_[_0xa8eb('0x3a')](_0x3a2a2f[_0xa8eb('0x2d')],_0x54792a[_0xa8eb('0x2f')]),_0x16f882);if(_0x3a2a2f['query'][_0xa8eb('0x3b')]){_0xdf010b['where']=_[_0xa8eb('0x3c')](_0xdf010b['where'],{'$or':_[_0xa8eb('0x27')](_0x16f882,function(_0xda83d2){if(_0xda83d2[_0xa8eb('0x2a')]!==_0xa8eb('0x3d')){var _0x47b5a8={};_0x47b5a8[_0xda83d2[_0xa8eb('0x24')]]={'$like':'%'+_0x3a2a2f['query'][_0xa8eb('0x3b')]+'%'};return _0x47b5a8;}})});}_0xdf010b=_[_0xa8eb('0x3c')]({},_0xdf010b,_0x3a2a2f[_0xa8eb('0x3e')]);var _0x1a0e50={'where':_0xdf010b['where']};return db[_0xa8eb('0x28')][_0xa8eb('0x18')](_0x1a0e50)['then'](function(_0x19d6c6){_0x52e54a['count']=_0x19d6c6;if(_0x3a2a2f[_0xa8eb('0x2d')][_0xa8eb('0x3f')]){_0xdf010b[_0xa8eb('0x40')]=[{'all':!![]}];}return db['MailServerOut'][_0xa8eb('0x41')](_0xdf010b);})['then'](function(_0x5c9bf8){_0x52e54a[_0xa8eb('0x42')]=_0x5c9bf8;return _0x52e54a;})[_0xa8eb('0x20')](respondWithFilteredResult(_0x26bec0,_0xdf010b))['catch'](handleError(_0x26bec0,null));};exports[_0xa8eb('0x43')]=function(_0x2ed550,_0x2dcedc){var _0x1f4e99={'raw':!![],'where':{'id':_0x2ed550[_0xa8eb('0x44')]['id']}},_0x41162c={};_0x41162c[_0xa8eb('0x2c')]=_[_0xa8eb('0x2e')](db[_0xa8eb('0x28')][_0xa8eb('0x29')]);_0x41162c['query']=_['keys'](_0x2ed550[_0xa8eb('0x2d')]);_0x41162c[_0xa8eb('0x45')]=_[_0xa8eb('0x30')](_0x41162c[_0xa8eb('0x2c')],_0x41162c[_0xa8eb('0x2d')]);_0x1f4e99[_0xa8eb('0x32')]=_[_0xa8eb('0x30')](_0x41162c[_0xa8eb('0x2c')],qs['fields'](_0x2ed550['query'][_0xa8eb('0x31')]));_0x1f4e99[_0xa8eb('0x32')]=_0x1f4e99[_0xa8eb('0x32')]['length']?_0x1f4e99[_0xa8eb('0x32')]:_0x41162c[_0xa8eb('0x2c')];if(_0x2ed550[_0xa8eb('0x2d')][_0xa8eb('0x3f')]){_0x1f4e99[_0xa8eb('0x40')]=[{'all':!![]}];}_0x1f4e99=_[_0xa8eb('0x3c')]({},_0x1f4e99,_0x2ed550[_0xa8eb('0x3e')]);return db[_0xa8eb('0x28')][_0xa8eb('0x46')](_0x1f4e99)['then'](handleEntityNotFound(_0x2dcedc,null))[_0xa8eb('0x20')](respondWithResult(_0x2dcedc,null))['catch'](handleError(_0x2dcedc,null));};exports[_0xa8eb('0x47')]=function(_0x35e6ff,_0x2c2c74){return db['MailServerOut'][_0xa8eb('0x47')](_0x35e6ff[_0xa8eb('0x48')],{})[_0xa8eb('0x20')](respondWithResult(_0x2c2c74,0xc9))[_0xa8eb('0x49')](handleError(_0x2c2c74,null));};exports[_0xa8eb('0x1e')]=function(_0x3b9a75,_0x3eb3e9){if(_0x3b9a75[_0xa8eb('0x48')]['id']){delete _0x3b9a75[_0xa8eb('0x48')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x3b9a75[_0xa8eb('0x44')]['id']}})[_0xa8eb('0x20')](handleEntityNotFound(_0x3eb3e9,null))[_0xa8eb('0x20')](saveUpdates(_0x3b9a75[_0xa8eb('0x48')],null))['then'](respondWithResult(_0x3eb3e9,null))['catch'](handleError(_0x3eb3e9,null));};exports['destroy']=function(_0x9f3756,_0x4cbe81){return db[_0xa8eb('0x28')][_0xa8eb('0x46')]({'where':{'id':_0x9f3756[_0xa8eb('0x44')]['id']}})[_0xa8eb('0x20')](handleEntityNotFound(_0x4cbe81,null))[_0xa8eb('0x20')](removeEntity(_0x4cbe81,null))[_0xa8eb('0x49')](handleError(_0x4cbe81,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index e8fe64b..3df9e12 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 _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','lodash','util'];(function(_0x2a7533,_0xe96a8f){var _0x1a3c4f=function(_0x57ed15){while(--_0x57ed15){_0x2a7533['push'](_0x2a7533['shift']());}};_0x1a3c4f(++_0xe96a8f);}(_0xf494,0x1c6));var _0x4f49=function(_0xa29a60,_0x375d75){_0xa29a60=_0xa29a60-0x0;var _0x3658f0=_0xf494[_0xa29a60];return _0x3658f0;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','moment'];(function(_0x5b7229,_0xf3f50d){var _0x2d2789=function(_0x14e1c8){while(--_0x14e1c8){_0x5b7229['push'](_0x5b7229['shift']());}};_0x2d2789(++_0xf3f50d);}(_0xe14b,0x93));var _0xbe14=function(_0x25b9a9,_0x2aeeb4){_0x25b9a9=_0x25b9a9-0x0;var _0x3bceb6=_0xe14b[_0x25b9a9];return _0x3bceb6;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'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 7f0c3f9..f0dcd31 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 _0xcce4=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','request\x20sent','stringify','error','code','message','MailServerOut,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring'];(function(_0x777753,_0x20391b){var _0x2d227c=function(_0x27cc51){while(--_0x27cc51){_0x777753['push'](_0x777753['shift']());}};_0x2d227c(++_0x20391b);}(_0xcce4,0x19e));var _0x4cce=function(_0x595604,_0x2cc998){_0x595604=_0x595604-0x0;var _0x1466f3=_0xcce4[_0x595604];return _0x1466f3;};'use strict';var _=require(_0x4cce('0x0'));var util=require(_0x4cce('0x1'));var moment=require('moment');var BPromise=require(_0x4cce('0x2'));var rs=require(_0x4cce('0x3'));var fs=require('fs');var Redis=require(_0x4cce('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4cce('0x5'));var logger=require('../../config/logger')(_0x4cce('0x6'));var config=require(_0x4cce('0x7'));var jayson=require(_0x4cce('0x8'));var client=jayson[_0x4cce('0x9')][_0x4cce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d2a7b,_0x3dcf9a,_0x1820f7){return new BPromise(function(_0x8960e0,_0x2f1155){return client[_0x4cce('0xb')](_0x1d2a7b,_0x1820f7)['then'](function(_0x372204){logger[_0x4cce('0xc')]('MailServerOut,\x20%s,\x20%s',_0x3dcf9a,'request\x20sent');logger[_0x4cce('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3dcf9a,_0x4cce('0xe'),JSON[_0x4cce('0xf')](_0x372204));if(_0x372204[_0x4cce('0x10')]){if(_0x372204[_0x4cce('0x10')][_0x4cce('0x11')]===0x1f4){logger[_0x4cce('0x10')]('MailServerOut,\x20%s,\x20%s',_0x3dcf9a,_0x372204['error'][_0x4cce('0x12')]);return _0x2f1155(_0x372204[_0x4cce('0x10')][_0x4cce('0x12')]);}logger[_0x4cce('0x10')](_0x4cce('0x13'),_0x3dcf9a,_0x372204[_0x4cce('0x10')][_0x4cce('0x12')]);return _0x8960e0(_0x372204[_0x4cce('0x10')][_0x4cce('0x12')]);}else{logger[_0x4cce('0xc')](_0x4cce('0x13'),_0x3dcf9a,'request\x20sent');_0x8960e0(_0x372204[_0x4cce('0x14')][_0x4cce('0x12')]);}})[_0x4cce('0x15')](function(_0x3b7bfe){logger[_0x4cce('0x10')](_0x4cce('0x13'),_0x3dcf9a,_0x3b7bfe);_0x2f1155(_0x3b7bfe);});});} \ No newline at end of file +var _0xe8da=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring'];(function(_0x29bef7,_0x5127f0){var _0x1ba0c1=function(_0x90b156){while(--_0x90b156){_0x29bef7['push'](_0x29bef7['shift']());}};_0x1ba0c1(++_0x5127f0);}(_0xe8da,0x1f4));var _0xae8d=function(_0x877b99,_0x444664){_0x877b99=_0x877b99-0x0;var _0x4f6cbd=_0xe8da[_0x877b99];return _0x4f6cbd;};'use strict';var _=require(_0xae8d('0x0'));var util=require('util');var moment=require(_0xae8d('0x1'));var BPromise=require(_0xae8d('0x2'));var rs=require(_0xae8d('0x3'));var fs=require('fs');var Redis=require(_0xae8d('0x4'));var db=require(_0xae8d('0x5'))['db'];var utils=require(_0xae8d('0x6'));var logger=require(_0xae8d('0x7'))(_0xae8d('0x8'));var config=require(_0xae8d('0x9'));var jayson=require(_0xae8d('0xa'));var client=jayson[_0xae8d('0xb')][_0xae8d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x197126,_0x4f239a,_0x38efac){return new BPromise(function(_0x4b74e0,_0x30199e){return client[_0xae8d('0xd')](_0x197126,_0x38efac)[_0xae8d('0xe')](function(_0x34b9ec){logger[_0xae8d('0xf')](_0xae8d('0x10'),_0x4f239a,_0xae8d('0x11'));logger['debug'](_0xae8d('0x12'),_0x4f239a,_0xae8d('0x11'),JSON[_0xae8d('0x13')](_0x34b9ec));if(_0x34b9ec[_0xae8d('0x14')]){if(_0x34b9ec[_0xae8d('0x14')][_0xae8d('0x15')]===0x1f4){logger[_0xae8d('0x14')](_0xae8d('0x10'),_0x4f239a,_0x34b9ec[_0xae8d('0x14')][_0xae8d('0x16')]);return _0x30199e(_0x34b9ec[_0xae8d('0x14')][_0xae8d('0x16')]);}logger[_0xae8d('0x14')]('MailServerOut,\x20%s,\x20%s',_0x4f239a,_0x34b9ec[_0xae8d('0x14')][_0xae8d('0x16')]);return _0x4b74e0(_0x34b9ec['error'][_0xae8d('0x16')]);}else{logger['info'](_0xae8d('0x10'),_0x4f239a,_0xae8d('0x11'));_0x4b74e0(_0x34b9ec[_0xae8d('0x17')][_0xae8d('0x16')]);}})['catch'](function(_0x34ae84){logger['error'](_0xae8d('0x10'),_0x4f239a,_0x34ae84);_0x30199e(_0x34ae84);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 1f63554..e4eff5d 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 _0xc6a8=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','describe','/:id','show','post','create','delete','destroy'];(function(_0x34217f,_0x4954d9){var _0x533721=function(_0x5ea689){while(--_0x5ea689){_0x34217f['push'](_0x34217f['shift']());}};_0x533721(++_0x4954d9);}(_0xc6a8,0x157));var _0x8c6a=function(_0x1492e7,_0x26a2b2){_0x1492e7=_0x1492e7-0x0;var _0xf7a233=_0xc6a8[_0x1492e7];return _0xf7a233;};'use strict';var multer=require(_0x8c6a('0x0'));var util=require(_0x8c6a('0x1'));var path=require(_0x8c6a('0x2'));var timeout=require('connect-timeout');var express=require(_0x8c6a('0x3'));var router=express[_0x8c6a('0x4')]();var auth=require(_0x8c6a('0x5'));var interaction=require(_0x8c6a('0x6'));var config=require(_0x8c6a('0x7'));var controller=require(_0x8c6a('0x8'));router[_0x8c6a('0x9')]('/',auth[_0x8c6a('0xa')](),controller['index']);router[_0x8c6a('0x9')]('/describe',auth[_0x8c6a('0xa')](),controller[_0x8c6a('0xb')]);router[_0x8c6a('0x9')](_0x8c6a('0xc'),auth[_0x8c6a('0xa')](),controller[_0x8c6a('0xd')]);router[_0x8c6a('0xe')]('/',auth[_0x8c6a('0xa')](),controller[_0x8c6a('0xf')]);router['put'](_0x8c6a('0xc'),auth[_0x8c6a('0xa')](),controller['update']);router[_0x8c6a('0x10')](_0x8c6a('0xc'),auth[_0x8c6a('0xa')](),controller[_0x8c6a('0x11')]);module[_0x8c6a('0x12')]=router; \ No newline at end of file +var _0x676a=['isAuthenticated','index','/describe','describe','show','post','create','put','delete','/:id','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get'];(function(_0x4c73ac,_0x46b73c){var _0x9839ee=function(_0x2076fb){while(--_0x2076fb){_0x4c73ac['push'](_0x4c73ac['shift']());}};_0x9839ee(++_0x46b73c);}(_0x676a,0x122));var _0xa676=function(_0x1e3c02,_0x5c07a2){_0x1e3c02=_0x1e3c02-0x0;var _0x4d26d7=_0x676a[_0x1e3c02];return _0x4d26d7;};'use strict';var multer=require(_0xa676('0x0'));var util=require(_0xa676('0x1'));var path=require(_0xa676('0x2'));var timeout=require(_0xa676('0x3'));var express=require(_0xa676('0x4'));var router=express[_0xa676('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa676('0x6'));var config=require(_0xa676('0x7'));var controller=require(_0xa676('0x8'));router[_0xa676('0x9')]('/',auth[_0xa676('0xa')](),controller[_0xa676('0xb')]);router['get'](_0xa676('0xc'),auth[_0xa676('0xa')](),controller[_0xa676('0xd')]);router[_0xa676('0x9')]('/:id',auth[_0xa676('0xa')](),controller[_0xa676('0xe')]);router[_0xa676('0xf')]('/',auth['isAuthenticated'](),controller[_0xa676('0x10')]);router[_0xa676('0x11')]('/:id',auth[_0xa676('0xa')](),controller['update']);router[_0xa676('0x12')](_0xa676('0x13'),auth[_0xa676('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 2c7d38d..f4f5125 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 _0xc5b3=['STRING','name','sequelize','exports'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xc5b3,0x1ee));var _0x3c5b=function(_0x2b6600,_0x24c497){_0x2b6600=_0x2b6600-0x0;var _0x912ee2=_0xc5b3[_0x2b6600];return _0x912ee2;};'use strict';var Sequelize=require(_0x3c5b('0x0'));module[_0x3c5b('0x1')]={'name':{'type':Sequelize[_0x3c5b('0x2')],'unique':_0x3c5b('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3c5b('0x2')]}}; \ No newline at end of file +var _0x9d76=['name','sequelize','STRING'];(function(_0x5b78fe,_0x44542c){var _0x24ac3c=function(_0x552b51){while(--_0x552b51){_0x5b78fe['push'](_0x5b78fe['shift']());}};_0x24ac3c(++_0x44542c);}(_0x9d76,0x76));var _0x69d7=function(_0x16ba97,_0x4c8a50){_0x16ba97=_0x16ba97-0x0;var _0x5a2297=_0x9d76[_0x16ba97];return _0x5a2297;};'use strict';var Sequelize=require(_0x69d7('0x0'));module['exports']={'name':{'type':Sequelize[_0x69d7('0x1')],'unique':_0x69d7('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x69d7('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index f5fef78..877697e 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 _0x0f42=['sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','index','fieldName','type','key','model','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','VIRTUAL','name','MailSubstatus','includeAll','include','show','params','keys','filtears','length','options','find','create','body','catch','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0x273790,_0x493437){var _0x7efe27=function(_0x3d72c2){while(--_0x3d72c2){_0x273790['push'](_0x273790['shift']());}};_0x7efe27(++_0x493437);}(_0x0f42,0xda));var _0x20f4=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x0f42[_0x13d07a];return _0x5ee0ee;};'use strict';var pdf=require(_0x20f4('0x0'));var emlformat=require(_0x20f4('0x1'));var rimraf=require(_0x20f4('0x2'));var zipdir=require(_0x20f4('0x3'));var jsonpatch=require(_0x20f4('0x4'));var rp=require(_0x20f4('0x5'));var moment=require(_0x20f4('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x20f4('0x7'));var util=require(_0x20f4('0x8'));var path=require(_0x20f4('0x9'));var sox=require(_0x20f4('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x20f4('0xb'));var squel=require(_0x20f4('0xc'));var crypto=require(_0x20f4('0xd'));var jsforce=require(_0x20f4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x20f4('0xf'));var querystring=require(_0x20f4('0x10'));var Papa=require(_0x20f4('0x11'));var Redis=require(_0x20f4('0x12'));var authService=require(_0x20f4('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x20f4('0x14'))(_0x20f4('0x15'));var utils=require(_0x20f4('0x16'));var config=require(_0x20f4('0x17'));var licenseUtil=require(_0x20f4('0x18'));var db=require(_0x20f4('0x19'))['db'];function respondWithStatusCode(_0xbeedd9,_0x5cf1f7){_0x5cf1f7=_0x5cf1f7||0xcc;return function(_0x53a4c0){if(_0x53a4c0){return _0xbeedd9[_0x20f4('0x1a')](_0x5cf1f7);}return _0xbeedd9[_0x20f4('0x1b')](_0x5cf1f7)[_0x20f4('0x1c')]();};}function respondWithResult(_0xc241dd,_0x275199){_0x275199=_0x275199||0xc8;return function(_0x4c2840){if(_0x4c2840){return _0xc241dd['status'](_0x275199)[_0x20f4('0x1d')](_0x4c2840);}};}function respondWithFilteredResult(_0x9d02d0,_0x46843a){return function(_0x3370ba){if(_0x3370ba){var _0x1da008=_0x3370ba[_0x20f4('0x1e')],_0x177970=_0x46843a[_0x20f4('0x1f')],_0x42732f=_0x46843a[_0x20f4('0x1f')]+_0x46843a[_0x20f4('0x20')],_0xaf5bf5;if(_0x42732f>=_0x1da008){_0x42732f=_0x1da008;_0xaf5bf5=0xc8;}else{_0xaf5bf5=0xce;}_0x9d02d0['status'](_0xaf5bf5);return _0x9d02d0[_0x20f4('0x21')](_0x20f4('0x22'),_0x177970+'-'+_0x42732f+'/'+_0x1da008)['json'](_0x3370ba);}return null;};}function patchUpdates(_0x2f52dd){return function(_0x4e5aff){try{jsonpatch['apply'](_0x4e5aff,_0x2f52dd,!![]);}catch(_0x1dbcdc){return BPromise[_0x20f4('0x23')](_0x1dbcdc);}return _0x4e5aff[_0x20f4('0x24')]();};}function saveUpdates(_0x4ac76c,_0x55df20){return function(_0x4c2786){if(_0x4c2786){return _0x4c2786[_0x20f4('0x25')](_0x4ac76c)[_0x20f4('0x26')](function(_0x2833b6){return _0x2833b6;});}return null;};}function removeEntity(_0x3d2f68,_0x2ff491){return function(_0x2522f7){if(_0x2522f7){return _0x2522f7[_0x20f4('0x27')]()['then'](function(){_0x3d2f68[_0x20f4('0x1b')](0xcc)[_0x20f4('0x1c')]();});}};}function handleEntityNotFound(_0x4c007d,_0x457c3a){return function(_0x4e5444){if(!_0x4e5444){_0x4c007d[_0x20f4('0x1a')](0x194);}return _0x4e5444;};}function handleError(_0x4ef167,_0x5979ce){_0x5979ce=_0x5979ce||0x1f4;return function(_0x48f5d4){logger[_0x20f4('0x28')](_0x48f5d4[_0x20f4('0x29')]);if(_0x48f5d4['name']){delete _0x48f5d4['name'];}_0x4ef167[_0x20f4('0x1b')](_0x5979ce)['send'](_0x48f5d4);};}exports[_0x20f4('0x2a')]=function(_0x2522f3,_0x192df2){var _0x9230e2={},_0x3b9fc8={},_0x16d361={'count':0x0,'rows':[]};var _0x39a85c=_['map'](db['MailSubstatus']['rawAttributes'],function(_0x1bc9d5){return{'name':_0x1bc9d5[_0x20f4('0x2b')],'type':_0x1bc9d5[_0x20f4('0x2c')][_0x20f4('0x2d')]};});_0x3b9fc8[_0x20f4('0x2e')]=_['map'](_0x39a85c,'name');_0x3b9fc8['query']=_['keys'](_0x2522f3['query']);_0x3b9fc8['filters']=_[_0x20f4('0x2f')](_0x3b9fc8[_0x20f4('0x2e')],_0x3b9fc8[_0x20f4('0x30')]);_0x9230e2['attributes']=_[_0x20f4('0x2f')](_0x3b9fc8[_0x20f4('0x2e')],qs[_0x20f4('0x31')](_0x2522f3[_0x20f4('0x30')]['fields']));_0x9230e2[_0x20f4('0x32')]=_0x9230e2['attributes']['length']?_0x9230e2[_0x20f4('0x32')]:_0x3b9fc8[_0x20f4('0x2e')];if(!_0x2522f3[_0x20f4('0x30')][_0x20f4('0x33')](_0x20f4('0x34'))){_0x9230e2[_0x20f4('0x20')]=qs[_0x20f4('0x20')](_0x2522f3['query']['limit']);_0x9230e2[_0x20f4('0x1f')]=qs[_0x20f4('0x1f')](_0x2522f3[_0x20f4('0x30')]['offset']);}_0x9230e2[_0x20f4('0x35')]=qs['sort'](_0x2522f3['query'][_0x20f4('0x36')]);_0x9230e2[_0x20f4('0x37')]=qs[_0x20f4('0x38')](_['pick'](_0x2522f3[_0x20f4('0x30')],_0x3b9fc8[_0x20f4('0x38')]),_0x39a85c);if(_0x2522f3[_0x20f4('0x30')][_0x20f4('0x39')]){_0x9230e2['where']=_[_0x20f4('0x3a')](_0x9230e2[_0x20f4('0x37')],{'$or':_[_0x20f4('0x3b')](_0x39a85c,function(_0x546627){if(_0x546627[_0x20f4('0x2c')]!==_0x20f4('0x3c')){var _0x52b445={};_0x52b445[_0x546627[_0x20f4('0x3d')]]={'$like':'%'+_0x2522f3[_0x20f4('0x30')]['filter']+'%'};return _0x52b445;}})});}_0x9230e2=_['merge']({},_0x9230e2,_0x2522f3['options']);var _0xd6352e={'where':_0x9230e2[_0x20f4('0x37')]};return db[_0x20f4('0x3e')][_0x20f4('0x1e')](_0xd6352e)[_0x20f4('0x26')](function(_0xd0e47e){_0x16d361[_0x20f4('0x1e')]=_0xd0e47e;if(_0x2522f3[_0x20f4('0x30')][_0x20f4('0x3f')]){_0x9230e2[_0x20f4('0x40')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x9230e2);})[_0x20f4('0x26')](function(_0x3c9f94){_0x16d361['rows']=_0x3c9f94;return _0x16d361;})[_0x20f4('0x26')](respondWithFilteredResult(_0x192df2,_0x9230e2))['catch'](handleError(_0x192df2,null));};exports[_0x20f4('0x41')]=function(_0x42a5b7,_0x21a29c){var _0x4a783a={'raw':!![],'where':{'id':_0x42a5b7[_0x20f4('0x42')]['id']}},_0x91e598={};_0x91e598[_0x20f4('0x2e')]=_[_0x20f4('0x43')](db[_0x20f4('0x3e')]['rawAttributes']);_0x91e598[_0x20f4('0x30')]=_[_0x20f4('0x43')](_0x42a5b7[_0x20f4('0x30')]);_0x91e598[_0x20f4('0x44')]=_[_0x20f4('0x2f')](_0x91e598['model'],_0x91e598[_0x20f4('0x30')]);_0x4a783a[_0x20f4('0x32')]=_[_0x20f4('0x2f')](_0x91e598[_0x20f4('0x2e')],qs[_0x20f4('0x31')](_0x42a5b7[_0x20f4('0x30')][_0x20f4('0x31')]));_0x4a783a[_0x20f4('0x32')]=_0x4a783a['attributes'][_0x20f4('0x45')]?_0x4a783a['attributes']:_0x91e598[_0x20f4('0x2e')];if(_0x42a5b7['query'][_0x20f4('0x3f')]){_0x4a783a[_0x20f4('0x40')]=[{'all':!![]}];}_0x4a783a=_['merge']({},_0x4a783a,_0x42a5b7[_0x20f4('0x46')]);return db[_0x20f4('0x3e')][_0x20f4('0x47')](_0x4a783a)[_0x20f4('0x26')](handleEntityNotFound(_0x21a29c,null))[_0x20f4('0x26')](respondWithResult(_0x21a29c,null))['catch'](handleError(_0x21a29c,null));};exports[_0x20f4('0x48')]=function(_0xc2c251,_0x2c9aa2){return db[_0x20f4('0x3e')][_0x20f4('0x48')](_0xc2c251[_0x20f4('0x49')],{})[_0x20f4('0x26')](respondWithResult(_0x2c9aa2,0xc9))['catch'](handleError(_0x2c9aa2,null));};exports[_0x20f4('0x25')]=function(_0x43444a,_0x3bccc5){if(_0x43444a[_0x20f4('0x49')]['id']){delete _0x43444a['body']['id'];}return db[_0x20f4('0x3e')][_0x20f4('0x47')]({'where':{'id':_0x43444a[_0x20f4('0x42')]['id']}})[_0x20f4('0x26')](handleEntityNotFound(_0x3bccc5,null))['then'](saveUpdates(_0x43444a[_0x20f4('0x49')],null))[_0x20f4('0x26')](respondWithResult(_0x3bccc5,null))[_0x20f4('0x4a')](handleError(_0x3bccc5,null));};exports[_0x20f4('0x27')]=function(_0x383332,_0x15b305){return db['MailSubstatus'][_0x20f4('0x47')]({'where':{'id':_0x383332['params']['id']}})[_0x20f4('0x26')](handleEntityNotFound(_0x15b305,null))[_0x20f4('0x26')](removeEntity(_0x15b305,null))['catch'](handleError(_0x15b305,null));};exports[_0x20f4('0x4b')]=function(_0x2c5462,_0x13a49c){return db[_0x20f4('0x3e')][_0x20f4('0x4b')]()[_0x20f4('0x26')](respondWithResult(_0x13a49c,null))[_0x20f4('0x4a')](handleError(_0x13a49c,null));}; \ No newline at end of file +var _0x98d5=['../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','then','error','stack','name','send','index','map','MailSubstatus','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','keys','rawAttributes','filtears','catch','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','lodash','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x57486e,_0x32283b){var _0x5f110b=function(_0xa18fc3){while(--_0xa18fc3){_0x57486e['push'](_0x57486e['shift']());}};_0x5f110b(++_0x32283b);}(_0x98d5,0x7a));var _0x598d=function(_0x4cb225,_0x4178f9){_0x4cb225=_0x4cb225-0x0;var _0x1a5d42=_0x98d5[_0x4cb225];return _0x1a5d42;};'use strict';var pdf=require(_0x598d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x598d('0x1'));var zipdir=require(_0x598d('0x2'));var jsonpatch=require(_0x598d('0x3'));var rp=require(_0x598d('0x4'));var moment=require(_0x598d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x598d('0x6'));var util=require(_0x598d('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x598d('0x8'));var fs=require('fs');var _=require(_0x598d('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x598d('0xa'));var toCsv=require('to-csv');var querystring=require(_0x598d('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x598d('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x598d('0xd'));var hardwareService=require(_0x598d('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x598d('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0x598d('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16e4c2,_0x566d41){_0x566d41=_0x566d41||0xcc;return function(_0x58d4ef){if(_0x58d4ef){return _0x16e4c2[_0x598d('0x11')](_0x566d41);}return _0x16e4c2[_0x598d('0x12')](_0x566d41)[_0x598d('0x13')]();};}function respondWithResult(_0x18b90b,_0x4cf94c){_0x4cf94c=_0x4cf94c||0xc8;return function(_0x3127e7){if(_0x3127e7){return _0x18b90b[_0x598d('0x12')](_0x4cf94c)[_0x598d('0x14')](_0x3127e7);}};}function respondWithFilteredResult(_0x187f80,_0x71dec3){return function(_0x5134e3){if(_0x5134e3){var _0x3ae8fc=_0x5134e3[_0x598d('0x15')],_0x579e1b=_0x71dec3['offset'],_0x28419d=_0x71dec3[_0x598d('0x16')]+_0x71dec3[_0x598d('0x17')],_0x462d8b;if(_0x28419d>=_0x3ae8fc){_0x28419d=_0x3ae8fc;_0x462d8b=0xc8;}else{_0x462d8b=0xce;}_0x187f80['status'](_0x462d8b);return _0x187f80[_0x598d('0x18')]('Content-Range',_0x579e1b+'-'+_0x28419d+'/'+_0x3ae8fc)[_0x598d('0x14')](_0x5134e3);}return null;};}function patchUpdates(_0x351366){return function(_0x1762b1){try{jsonpatch['apply'](_0x1762b1,_0x351366,!![]);}catch(_0x270e3d){return BPromise[_0x598d('0x19')](_0x270e3d);}return _0x1762b1[_0x598d('0x1a')]();};}function saveUpdates(_0x46b674,_0x5f59e2){return function(_0x1bae08){if(_0x1bae08){return _0x1bae08[_0x598d('0x1b')](_0x46b674)['then'](function(_0x522bb6){return _0x522bb6;});}return null;};}function removeEntity(_0x7dd207,_0x49ef32){return function(_0x351780){if(_0x351780){return _0x351780[_0x598d('0x1c')]()[_0x598d('0x1d')](function(){_0x7dd207['status'](0xcc)[_0x598d('0x13')]();});}};}function handleEntityNotFound(_0x5dea4a,_0x228a29){return function(_0x41e92d){if(!_0x41e92d){_0x5dea4a[_0x598d('0x11')](0x194);}return _0x41e92d;};}function handleError(_0x5c9c3c,_0x39a5f5){_0x39a5f5=_0x39a5f5||0x1f4;return function(_0x385054){logger[_0x598d('0x1e')](_0x385054[_0x598d('0x1f')]);if(_0x385054['name']){delete _0x385054[_0x598d('0x20')];}_0x5c9c3c['status'](_0x39a5f5)[_0x598d('0x21')](_0x385054);};}exports[_0x598d('0x22')]=function(_0x219e2c,_0x39d1c7){var _0x56b6bb={},_0x403eb3={},_0x114a11={'count':0x0,'rows':[]};var _0x2d158a=_[_0x598d('0x23')](db[_0x598d('0x24')]['rawAttributes'],function(_0x473f71){return{'name':_0x473f71[_0x598d('0x25')],'type':_0x473f71[_0x598d('0x26')][_0x598d('0x27')]};});_0x403eb3[_0x598d('0x28')]=_[_0x598d('0x23')](_0x2d158a,_0x598d('0x20'));_0x403eb3[_0x598d('0x29')]=_['keys'](_0x219e2c[_0x598d('0x29')]);_0x403eb3[_0x598d('0x2a')]=_['intersection'](_0x403eb3['model'],_0x403eb3[_0x598d('0x29')]);_0x56b6bb[_0x598d('0x2b')]=_[_0x598d('0x2c')](_0x403eb3['model'],qs['fields'](_0x219e2c[_0x598d('0x29')][_0x598d('0x2d')]));_0x56b6bb[_0x598d('0x2b')]=_0x56b6bb[_0x598d('0x2b')][_0x598d('0x2e')]?_0x56b6bb['attributes']:_0x403eb3['model'];if(!_0x219e2c[_0x598d('0x29')][_0x598d('0x2f')]('nolimit')){_0x56b6bb[_0x598d('0x17')]=qs[_0x598d('0x17')](_0x219e2c['query'][_0x598d('0x17')]);_0x56b6bb[_0x598d('0x16')]=qs[_0x598d('0x16')](_0x219e2c[_0x598d('0x29')]['offset']);}_0x56b6bb[_0x598d('0x30')]=qs[_0x598d('0x31')](_0x219e2c['query'][_0x598d('0x31')]);_0x56b6bb[_0x598d('0x32')]=qs[_0x598d('0x2a')](_[_0x598d('0x33')](_0x219e2c[_0x598d('0x29')],_0x403eb3[_0x598d('0x2a')]),_0x2d158a);if(_0x219e2c[_0x598d('0x29')][_0x598d('0x34')]){_0x56b6bb['where']=_[_0x598d('0x35')](_0x56b6bb[_0x598d('0x32')],{'$or':_[_0x598d('0x23')](_0x2d158a,function(_0x1d5661){if(_0x1d5661[_0x598d('0x26')]!=='VIRTUAL'){var _0x609e82={};_0x609e82[_0x1d5661['name']]={'$like':'%'+_0x219e2c[_0x598d('0x29')][_0x598d('0x34')]+'%'};return _0x609e82;}})});}_0x56b6bb=_[_0x598d('0x35')]({},_0x56b6bb,_0x219e2c[_0x598d('0x36')]);var _0x546fda={'where':_0x56b6bb[_0x598d('0x32')]};return db['MailSubstatus']['count'](_0x546fda)[_0x598d('0x1d')](function(_0x1f50d2){_0x114a11['count']=_0x1f50d2;if(_0x219e2c[_0x598d('0x29')][_0x598d('0x37')]){_0x56b6bb[_0x598d('0x38')]=[{'all':!![]}];}return db[_0x598d('0x24')]['findAll'](_0x56b6bb);})[_0x598d('0x1d')](function(_0xd7c533){_0x114a11[_0x598d('0x39')]=_0xd7c533;return _0x114a11;})[_0x598d('0x1d')](respondWithFilteredResult(_0x39d1c7,_0x56b6bb))['catch'](handleError(_0x39d1c7,null));};exports[_0x598d('0x3a')]=function(_0x1b3afb,_0x390baa){var _0x525fe3={'raw':!![],'where':{'id':_0x1b3afb[_0x598d('0x3b')]['id']}},_0x314e89={};_0x314e89[_0x598d('0x28')]=_[_0x598d('0x3c')](db[_0x598d('0x24')][_0x598d('0x3d')]);_0x314e89[_0x598d('0x29')]=_[_0x598d('0x3c')](_0x1b3afb[_0x598d('0x29')]);_0x314e89[_0x598d('0x3e')]=_[_0x598d('0x2c')](_0x314e89[_0x598d('0x28')],_0x314e89['query']);_0x525fe3[_0x598d('0x2b')]=_[_0x598d('0x2c')](_0x314e89['model'],qs['fields'](_0x1b3afb[_0x598d('0x29')][_0x598d('0x2d')]));_0x525fe3['attributes']=_0x525fe3[_0x598d('0x2b')][_0x598d('0x2e')]?_0x525fe3[_0x598d('0x2b')]:_0x314e89[_0x598d('0x28')];if(_0x1b3afb['query'][_0x598d('0x37')]){_0x525fe3[_0x598d('0x38')]=[{'all':!![]}];}_0x525fe3=_[_0x598d('0x35')]({},_0x525fe3,_0x1b3afb[_0x598d('0x36')]);return db[_0x598d('0x24')]['find'](_0x525fe3)[_0x598d('0x1d')](handleEntityNotFound(_0x390baa,null))[_0x598d('0x1d')](respondWithResult(_0x390baa,null))[_0x598d('0x3f')](handleError(_0x390baa,null));};exports[_0x598d('0x40')]=function(_0x496a1b,_0x5adf96){return db[_0x598d('0x24')][_0x598d('0x40')](_0x496a1b[_0x598d('0x41')],{})['then'](respondWithResult(_0x5adf96,0xc9))[_0x598d('0x3f')](handleError(_0x5adf96,null));};exports[_0x598d('0x1b')]=function(_0xe60ad5,_0xece092){if(_0xe60ad5[_0x598d('0x41')]['id']){delete _0xe60ad5['body']['id'];}return db['MailSubstatus'][_0x598d('0x42')]({'where':{'id':_0xe60ad5[_0x598d('0x3b')]['id']}})[_0x598d('0x1d')](handleEntityNotFound(_0xece092,null))[_0x598d('0x1d')](saveUpdates(_0xe60ad5['body'],null))[_0x598d('0x1d')](respondWithResult(_0xece092,null))[_0x598d('0x3f')](handleError(_0xece092,null));};exports[_0x598d('0x1c')]=function(_0xb8214a,_0x733f6b){return db['MailSubstatus'][_0x598d('0x42')]({'where':{'id':_0xb8214a[_0x598d('0x3b')]['id']}})[_0x598d('0x1d')](handleEntityNotFound(_0x733f6b,null))[_0x598d('0x1d')](removeEntity(_0x733f6b,null))['catch'](handleError(_0x733f6b,null));};exports[_0x598d('0x43')]=function(_0x69866a,_0x227184){return db[_0x598d('0x24')][_0x598d('0x43')]()[_0x598d('0x1d')](respondWithResult(_0x227184,null))[_0x598d('0x3f')](handleError(_0x227184,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 9f22a4a..56f021c 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 _0x32f4=['./mailSubstatus.attributes','exports','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x32f4,0x154));var _0x432f=function(_0x406876,_0x4e0b70){_0x406876=_0x406876-0x0;var _0x221ac7=_0x32f4[_0x406876];return _0x221ac7;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var logger=require(_0x432f('0x2'))(_0x432f('0x3'));var moment=require('moment');var BPromise=require(_0x432f('0x4'));var rp=require(_0x432f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var attributes=require(_0x432f('0x8'));module[_0x432f('0x9')]=function(_0x2f5f03,_0x5d8cc0){return _0x2f5f03['define'](_0x432f('0xa'),attributes,{'tableName':_0x432f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe77c=['MailSubstatus','mail_substatuses','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes'];(function(_0x8f8823,_0x45198f){var _0x29d400=function(_0x1602b0){while(--_0x1602b0){_0x8f8823['push'](_0x8f8823['shift']());}};_0x29d400(++_0x45198f);}(_0xe77c,0x176));var _0xce77=function(_0x3bf925,_0x4dd8e4){_0x3bf925=_0x3bf925-0x0;var _0x2128a1=_0xe77c[_0x3bf925];return _0x2128a1;};'use strict';var _=require(_0xce77('0x0'));var util=require(_0xce77('0x1'));var logger=require(_0xce77('0x2'))('api');var moment=require(_0xce77('0x3'));var BPromise=require(_0xce77('0x4'));var rp=require(_0xce77('0x5'));var fs=require('fs');var path=require(_0xce77('0x6'));var rimraf=require(_0xce77('0x7'));var config=require(_0xce77('0x8'));var attributes=require(_0xce77('0x9'));module['exports']=function(_0x5aea39,_0xed47c5){return _0x5aea39['define'](_0xce77('0xa'),attributes,{'tableName':_0xce77('0xb'),'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 f9cac34..788278b 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 _0xd2ea=['../../config/environment','jayson/promise','client','request','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2c837c,_0x21300e){var _0x124e78=function(_0x20fde0){while(--_0x20fde0){_0x2c837c['push'](_0x2c837c['shift']());}};_0x124e78(++_0x21300e);}(_0xd2ea,0x15f));var _0xad2e=function(_0x389fb0,_0x40ccad){_0x389fb0=_0x389fb0-0x0;var _0x142b70=_0xd2ea[_0x389fb0];return _0x142b70;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var moment=require(_0xad2e('0x2'));var BPromise=require(_0xad2e('0x3'));var rs=require(_0xad2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad2e('0x5'))['db'];var utils=require(_0xad2e('0x6'));var logger=require(_0xad2e('0x7'))(_0xad2e('0x8'));var config=require(_0xad2e('0x9'));var jayson=require(_0xad2e('0xa'));var client=jayson[_0xad2e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5170,_0x3e3d1f,_0x2ff7b2){return new BPromise(function(_0x5710ac,_0x1e0e9e){return client[_0xad2e('0xc')](_0x3b5170,_0x2ff7b2)['then'](function(_0x1eed2f){logger['info'](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));logger[_0xad2e('0xf')](_0xad2e('0x10'),_0x3e3d1f,'request\x20sent',JSON[_0xad2e('0x11')](_0x1eed2f));if(_0x1eed2f['error']){if(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x13')]===0x1f4){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0x1eed2f['error'][_0xad2e('0x14')]);return _0x1e0e9e(_0x1eed2f['error'][_0xad2e('0x14')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x3e3d1f,_0x1eed2f['error']['message']);return _0x5710ac(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x14')]);}else{logger[_0xad2e('0x15')](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));_0x5710ac(_0x1eed2f[_0xad2e('0x16')][_0xad2e('0x14')]);}})[_0xad2e('0x17')](function(_0xd40b31){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0xd40b31);_0x1e0e9e(_0xd40b31);});});} \ No newline at end of file +var _0x0713=['MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2dd936,_0x417bde){var _0x4bf81c=function(_0x50aa74){while(--_0x50aa74){_0x2dd936['push'](_0x2dd936['shift']());}};_0x4bf81c(++_0x417bde);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index f894794..0d38b8f 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 _0x81a2=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id','destroy','exports'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x81a2,0x84));var _0x281a=function(_0x4f6ff7,_0x3c7b9d){_0x4f6ff7=_0x4f6ff7-0x0;var _0x190559=_0x81a2[_0x4f6ff7];return _0x190559;};'use strict';var multer=require(_0x281a('0x0'));var util=require(_0x281a('0x1'));var path=require(_0x281a('0x2'));var timeout=require(_0x281a('0x3'));var express=require(_0x281a('0x4'));var router=express[_0x281a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x281a('0x6'));var config=require(_0x281a('0x7'));var controller=require('./mailTransferReport.controller');router[_0x281a('0x8')]('/',auth[_0x281a('0x9')](),controller[_0x281a('0xa')]);router[_0x281a('0x8')](_0x281a('0xb'),auth['isAuthenticated'](),controller[_0x281a('0xc')]);router[_0x281a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x281a('0xd')]);router[_0x281a('0xe')]('/',auth[_0x281a('0x9')](),controller[_0x281a('0xf')]);router[_0x281a('0x10')]('/:id',auth[_0x281a('0x9')](),controller[_0x281a('0x11')]);router[_0x281a('0x12')](_0x281a('0x13'),auth[_0x281a('0x9')](),controller[_0x281a('0x14')]);module[_0x281a('0x15')]=router; \ No newline at end of file +var _0xe0c8=['/:id','show','post','put','delete','destroy','exports','express','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','isAuthenticated','get','/describe','describe'];(function(_0x1f821f,_0x379b81){var _0x4a9f96=function(_0x2f0cda){while(--_0x2f0cda){_0x1f821f['push'](_0x1f821f['shift']());}};_0x4a9f96(++_0x379b81);}(_0xe0c8,0x9d));var _0x8e0c=function(_0x3a10d8,_0x4d0ac7){_0x3a10d8=_0x3a10d8-0x0;var _0x216e6f=_0xe0c8[_0x3a10d8];return _0x216e6f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8e0c('0x0'));var router=express['Router']();var auth=require(_0x8e0c('0x1'));var interaction=require(_0x8e0c('0x2'));var config=require('../../config/environment');var controller=require(_0x8e0c('0x3'));router['get']('/',auth[_0x8e0c('0x4')](),controller['index']);router[_0x8e0c('0x5')](_0x8e0c('0x6'),auth['isAuthenticated'](),controller[_0x8e0c('0x7')]);router[_0x8e0c('0x5')](_0x8e0c('0x8'),auth[_0x8e0c('0x4')](),controller[_0x8e0c('0x9')]);router[_0x8e0c('0xa')]('/',auth[_0x8e0c('0x4')](),controller['create']);router[_0x8e0c('0xb')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8e0c('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x8e0c('0xd')]);module[_0x8e0c('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index cca31b1..cc1c1b2 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 _0xa251=['account','queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM'];(function(_0x5d8018,_0x588592){var _0x151ac4=function(_0x548679){while(--_0x548679){_0x5d8018['push'](_0x5d8018['shift']());}};_0x151ac4(++_0x588592);}(_0xa251,0x11b));var _0x1a25=function(_0x487a0b,_0x33c302){_0x487a0b=_0x487a0b-0x0;var _0x4cb1ba=_0xa251[_0x487a0b];return _0x4cb1ba;};'use strict';var moment=require(_0x1a25('0x0'));var Sequelize=require(_0x1a25('0x1'));module[_0x1a25('0x2')]={'uniqueid':{'type':Sequelize[_0x1a25('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1a25('0x4')](_0x1a25('0x5'),'agent',_0x1a25('0x6')),'allowNull':![],'defaultValue':_0x1a25('0x6')},'transferredAt':{'type':Sequelize[_0x1a25('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x1a25('0x8')]}}; \ No newline at end of file +var _0x22e6=['sequelize','exports','STRING','ENUM','account','queue','DATE','NOW','moment'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x22e6,0x14c));var _0x622e=function(_0x55a8cf,_0x27ef42){_0x55a8cf=_0x55a8cf-0x0;var _0x7a1bc9=_0x22e6[_0x55a8cf];return _0x7a1bc9;};'use strict';var moment=require(_0x622e('0x0'));var Sequelize=require(_0x622e('0x1'));module[_0x622e('0x2')]={'uniqueid':{'type':Sequelize[_0x622e('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x622e('0x4')](_0x622e('0x5'),'agent',_0x622e('0x6')),'allowNull':![],'defaultValue':_0x622e('0x6')},'transferredAt':{'type':Sequelize[_0x622e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x622e('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index b6d7195..2b45ecf 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 _0x4788=['util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','status','end','json','offset','set','reject','update','then','destroy','sendStatus','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','type','options','count','includeAll','include','findAll','params','keys','filtears','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x4788,0x14c));var _0x8478=function(_0x3fef56,_0x386b57){_0x3fef56=_0x3fef56-0x0;var _0x1c087e=_0x4788[_0x3fef56];return _0x1c087e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8478('0x0'));var rimraf=require(_0x8478('0x1'));var zipdir=require(_0x8478('0x2'));var jsonpatch=require(_0x8478('0x3'));var rp=require(_0x8478('0x4'));var moment=require(_0x8478('0x5'));var BPromise=require(_0x8478('0x6'));var Mustache=require(_0x8478('0x7'));var util=require(_0x8478('0x8'));var path=require('path');var sox=require(_0x8478('0x9'));var csv=require(_0x8478('0xa'));var ejs=require(_0x8478('0xb'));var fs=require('fs');var _=require(_0x8478('0xc'));var squel=require('squel');var crypto=require(_0x8478('0xd'));var jsforce=require(_0x8478('0xe'));var deskjs=require(_0x8478('0xf'));var toCsv=require(_0x8478('0xa'));var querystring=require(_0x8478('0x10'));var Papa=require(_0x8478('0x11'));var Redis=require(_0x8478('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8478('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8478('0x14'))(_0x8478('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c4960,_0x1d4836){_0x1d4836=_0x1d4836||0xcc;return function(_0x45edaf){if(_0x45edaf){return _0x3c4960['sendStatus'](_0x1d4836);}return _0x3c4960[_0x8478('0x16')](_0x1d4836)[_0x8478('0x17')]();};}function respondWithResult(_0x24aa9a,_0x30040d){_0x30040d=_0x30040d||0xc8;return function(_0x5f3688){if(_0x5f3688){return _0x24aa9a[_0x8478('0x16')](_0x30040d)[_0x8478('0x18')](_0x5f3688);}};}function respondWithFilteredResult(_0x5baf1b,_0x5e1700){return function(_0x1451eb){if(_0x1451eb){var _0x412aef=_0x1451eb['count'],_0x4319d4=_0x5e1700[_0x8478('0x19')],_0x13d55c=_0x5e1700[_0x8478('0x19')]+_0x5e1700['limit'],_0x3376b1;if(_0x13d55c>=_0x412aef){_0x13d55c=_0x412aef;_0x3376b1=0xc8;}else{_0x3376b1=0xce;}_0x5baf1b['status'](_0x3376b1);return _0x5baf1b[_0x8478('0x1a')]('Content-Range',_0x4319d4+'-'+_0x13d55c+'/'+_0x412aef)['json'](_0x1451eb);}return null;};}function patchUpdates(_0x5184ab){return function(_0x48d31a){try{jsonpatch['apply'](_0x48d31a,_0x5184ab,!![]);}catch(_0x5cf496){return BPromise[_0x8478('0x1b')](_0x5cf496);}return _0x48d31a['save']();};}function saveUpdates(_0xb6d56b,_0x55ea66){return function(_0x4ae10b){if(_0x4ae10b){return _0x4ae10b[_0x8478('0x1c')](_0xb6d56b)[_0x8478('0x1d')](function(_0x407d82){return _0x407d82;});}return null;};}function removeEntity(_0x458433,_0x52fd80){return function(_0x406d66){if(_0x406d66){return _0x406d66[_0x8478('0x1e')]()[_0x8478('0x1d')](function(){_0x458433[_0x8478('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51805c,_0x5dfa36){return function(_0x599a1a){if(!_0x599a1a){_0x51805c[_0x8478('0x1f')](0x194);}return _0x599a1a;};}function handleError(_0x2201f1,_0xc59a3e){_0xc59a3e=_0xc59a3e||0x1f4;return function(_0x608199){logger['error'](_0x608199[_0x8478('0x20')]);if(_0x608199[_0x8478('0x21')]){delete _0x608199[_0x8478('0x21')];}_0x2201f1[_0x8478('0x16')](_0xc59a3e)['send'](_0x608199);};}exports[_0x8478('0x22')]=function(_0x57f670,_0x3a2cbb){var _0x5e5b13={},_0x1b2dae={},_0x306e86={'count':0x0,'rows':[]};var _0x4dda33=_[_0x8478('0x23')](db[_0x8478('0x24')][_0x8478('0x25')],function(_0x26ed93){return{'name':_0x26ed93[_0x8478('0x26')],'type':_0x26ed93['type'][_0x8478('0x27')]};});_0x1b2dae[_0x8478('0x28')]=_[_0x8478('0x23')](_0x4dda33,_0x8478('0x21'));_0x1b2dae[_0x8478('0x29')]=_['keys'](_0x57f670[_0x8478('0x29')]);_0x1b2dae[_0x8478('0x2a')]=_[_0x8478('0x2b')](_0x1b2dae['model'],_0x1b2dae[_0x8478('0x29')]);_0x5e5b13[_0x8478('0x2c')]=_[_0x8478('0x2b')](_0x1b2dae[_0x8478('0x28')],qs[_0x8478('0x2d')](_0x57f670[_0x8478('0x29')]['fields']));_0x5e5b13['attributes']=_0x5e5b13[_0x8478('0x2c')][_0x8478('0x2e')]?_0x5e5b13[_0x8478('0x2c')]:_0x1b2dae[_0x8478('0x28')];if(!_0x57f670[_0x8478('0x29')][_0x8478('0x2f')](_0x8478('0x30'))){_0x5e5b13[_0x8478('0x31')]=qs[_0x8478('0x31')](_0x57f670['query'][_0x8478('0x31')]);_0x5e5b13['offset']=qs[_0x8478('0x19')](_0x57f670[_0x8478('0x29')][_0x8478('0x19')]);}_0x5e5b13[_0x8478('0x32')]=qs[_0x8478('0x33')](_0x57f670[_0x8478('0x29')]['sort']);_0x5e5b13['where']=qs['filters'](_[_0x8478('0x34')](_0x57f670[_0x8478('0x29')],_0x1b2dae[_0x8478('0x2a')]),_0x4dda33);if(_0x57f670[_0x8478('0x29')]['filter']){_0x5e5b13[_0x8478('0x35')]=_[_0x8478('0x36')](_0x5e5b13[_0x8478('0x35')],{'$or':_[_0x8478('0x23')](_0x4dda33,function(_0x1ff868){if(_0x1ff868[_0x8478('0x37')]!=='VIRTUAL'){var _0xa6a8ce={};_0xa6a8ce[_0x1ff868[_0x8478('0x21')]]={'$like':'%'+_0x57f670[_0x8478('0x29')]['filter']+'%'};return _0xa6a8ce;}})});}_0x5e5b13=_[_0x8478('0x36')]({},_0x5e5b13,_0x57f670[_0x8478('0x38')]);var _0x441159={'where':_0x5e5b13[_0x8478('0x35')]};return db['MailTransferReport'][_0x8478('0x39')](_0x441159)[_0x8478('0x1d')](function(_0x1298df){_0x306e86[_0x8478('0x39')]=_0x1298df;if(_0x57f670['query'][_0x8478('0x3a')]){_0x5e5b13[_0x8478('0x3b')]=[{'all':!![]}];}return db[_0x8478('0x24')][_0x8478('0x3c')](_0x5e5b13);})[_0x8478('0x1d')](function(_0x10f951){_0x306e86['rows']=_0x10f951;return _0x306e86;})[_0x8478('0x1d')](respondWithFilteredResult(_0x3a2cbb,_0x5e5b13))['catch'](handleError(_0x3a2cbb,null));};exports['show']=function(_0x43d743,_0x5b4329){var _0x2ac676={'raw':!![],'where':{'id':_0x43d743[_0x8478('0x3d')]['id']}},_0x5c633c={};_0x5c633c['model']=_[_0x8478('0x3e')](db[_0x8478('0x24')][_0x8478('0x25')]);_0x5c633c[_0x8478('0x29')]=_[_0x8478('0x3e')](_0x43d743[_0x8478('0x29')]);_0x5c633c[_0x8478('0x3f')]=_[_0x8478('0x2b')](_0x5c633c[_0x8478('0x28')],_0x5c633c[_0x8478('0x29')]);_0x2ac676[_0x8478('0x2c')]=_[_0x8478('0x2b')](_0x5c633c[_0x8478('0x28')],qs[_0x8478('0x2d')](_0x43d743[_0x8478('0x29')][_0x8478('0x2d')]));_0x2ac676['attributes']=_0x2ac676[_0x8478('0x2c')][_0x8478('0x2e')]?_0x2ac676['attributes']:_0x5c633c['model'];if(_0x43d743['query']['includeAll']){_0x2ac676[_0x8478('0x3b')]=[{'all':!![]}];}_0x2ac676=_['merge']({},_0x2ac676,_0x43d743[_0x8478('0x38')]);return db['MailTransferReport'][_0x8478('0x40')](_0x2ac676)['then'](handleEntityNotFound(_0x5b4329,null))[_0x8478('0x1d')](respondWithResult(_0x5b4329,null))['catch'](handleError(_0x5b4329,null));};exports[_0x8478('0x41')]=function(_0x5cf1f3,_0x16d6d2){return db[_0x8478('0x24')][_0x8478('0x41')](_0x5cf1f3[_0x8478('0x42')],{})[_0x8478('0x1d')](respondWithResult(_0x16d6d2,0xc9))[_0x8478('0x43')](handleError(_0x16d6d2,null));};exports[_0x8478('0x1c')]=function(_0x5b2a15,_0x127fb8){if(_0x5b2a15[_0x8478('0x42')]['id']){delete _0x5b2a15[_0x8478('0x42')]['id'];}return db[_0x8478('0x24')][_0x8478('0x40')]({'where':{'id':_0x5b2a15['params']['id']}})['then'](handleEntityNotFound(_0x127fb8,null))[_0x8478('0x1d')](saveUpdates(_0x5b2a15[_0x8478('0x42')],null))[_0x8478('0x1d')](respondWithResult(_0x127fb8,null))[_0x8478('0x43')](handleError(_0x127fb8,null));};exports[_0x8478('0x1e')]=function(_0x5d791e,_0x3ce346){return db[_0x8478('0x24')]['find']({'where':{'id':_0x5d791e['params']['id']}})[_0x8478('0x1d')](handleEntityNotFound(_0x3ce346,null))[_0x8478('0x1d')](removeEntity(_0x3ce346,null))[_0x8478('0x43')](handleError(_0x3ce346,null));};exports['describe']=function(_0x153145,_0x5e4b7f){return db['MailTransferReport']['describe']()[_0x8478('0x1d')](respondWithResult(_0x5e4b7f,null))[_0x8478('0x43')](handleError(_0x5e4b7f,null));}; \ No newline at end of file +var _0x79c4=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','set','json','apply','save','update','then','destroy','stack','name','send','map','MailTransferReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','filtears','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','squel','crypto','desk.js','querystring'];(function(_0x4fda33,_0x6094b6){var _0x59f391=function(_0x476840){while(--_0x476840){_0x4fda33['push'](_0x4fda33['shift']());}};_0x59f391(++_0x6094b6);}(_0x79c4,0x11f));var _0x479c=function(_0x145032,_0x587f89){_0x145032=_0x145032-0x0;var _0x544504=_0x79c4[_0x145032];return _0x544504;};'use strict';var pdf=require(_0x479c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x479c('0x1'));var zipdir=require(_0x479c('0x2'));var jsonpatch=require(_0x479c('0x3'));var rp=require('request-promise');var moment=require(_0x479c('0x4'));var BPromise=require(_0x479c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x479c('0x6'));var sox=require(_0x479c('0x7'));var csv=require(_0x479c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x479c('0x9'));var crypto=require(_0x479c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x479c('0xb'));var toCsv=require(_0x479c('0x8'));var querystring=require(_0x479c('0xc'));var Papa=require('papaparse');var Redis=require(_0x479c('0xd'));var authService=require(_0x479c('0xe'));var qs=require(_0x479c('0xf'));var as=require(_0x479c('0x10'));var hardwareService=require(_0x479c('0x11'));var logger=require(_0x479c('0x12'))(_0x479c('0x13'));var utils=require('../../config/utils');var config=require(_0x479c('0x14'));var licenseUtil=require(_0x479c('0x15'));var db=require(_0x479c('0x16'))['db'];function respondWithStatusCode(_0x33f0f8,_0x8111e3){_0x8111e3=_0x8111e3||0xcc;return function(_0x44791e){if(_0x44791e){return _0x33f0f8[_0x479c('0x17')](_0x8111e3);}return _0x33f0f8[_0x479c('0x18')](_0x8111e3)[_0x479c('0x19')]();};}function respondWithResult(_0x2c6473,_0x4353a){_0x4353a=_0x4353a||0xc8;return function(_0x16c9af){if(_0x16c9af){return _0x2c6473['status'](_0x4353a)['json'](_0x16c9af);}};}function respondWithFilteredResult(_0x10fed4,_0xa8563){return function(_0x20a70b){if(_0x20a70b){var _0x463391=_0x20a70b['count'],_0x5000c3=_0xa8563[_0x479c('0x1a')],_0x98c4c7=_0xa8563[_0x479c('0x1a')]+_0xa8563['limit'],_0x358a38;if(_0x98c4c7>=_0x463391){_0x98c4c7=_0x463391;_0x358a38=0xc8;}else{_0x358a38=0xce;}_0x10fed4[_0x479c('0x18')](_0x358a38);return _0x10fed4[_0x479c('0x1b')]('Content-Range',_0x5000c3+'-'+_0x98c4c7+'/'+_0x463391)[_0x479c('0x1c')](_0x20a70b);}return null;};}function patchUpdates(_0x4192de){return function(_0x4b5fbe){try{jsonpatch[_0x479c('0x1d')](_0x4b5fbe,_0x4192de,!![]);}catch(_0x558314){return BPromise['reject'](_0x558314);}return _0x4b5fbe[_0x479c('0x1e')]();};}function saveUpdates(_0x1909a5,_0x5a8724){return function(_0x1d7595){if(_0x1d7595){return _0x1d7595[_0x479c('0x1f')](_0x1909a5)[_0x479c('0x20')](function(_0x5817f0){return _0x5817f0;});}return null;};}function removeEntity(_0x1b27da,_0x34a00e){return function(_0x5c04d6){if(_0x5c04d6){return _0x5c04d6[_0x479c('0x21')]()[_0x479c('0x20')](function(){_0x1b27da[_0x479c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2510f6,_0x181513){return function(_0x50bd51){if(!_0x50bd51){_0x2510f6[_0x479c('0x17')](0x194);}return _0x50bd51;};}function handleError(_0x41813b,_0x54684f){_0x54684f=_0x54684f||0x1f4;return function(_0x3b7bd0){logger['error'](_0x3b7bd0[_0x479c('0x22')]);if(_0x3b7bd0[_0x479c('0x23')]){delete _0x3b7bd0['name'];}_0x41813b[_0x479c('0x18')](_0x54684f)[_0x479c('0x24')](_0x3b7bd0);};}exports['index']=function(_0x85296a,_0x2750e8){var _0xb7ae4d={},_0xf3a23c={},_0x258225={'count':0x0,'rows':[]};var _0x2a968a=_[_0x479c('0x25')](db[_0x479c('0x26')]['rawAttributes'],function(_0x41078d){return{'name':_0x41078d[_0x479c('0x27')],'type':_0x41078d[_0x479c('0x28')][_0x479c('0x29')]};});_0xf3a23c[_0x479c('0x2a')]=_[_0x479c('0x25')](_0x2a968a,'name');_0xf3a23c[_0x479c('0x2b')]=_[_0x479c('0x2c')](_0x85296a[_0x479c('0x2b')]);_0xf3a23c['filters']=_[_0x479c('0x2d')](_0xf3a23c[_0x479c('0x2a')],_0xf3a23c[_0x479c('0x2b')]);_0xb7ae4d[_0x479c('0x2e')]=_[_0x479c('0x2d')](_0xf3a23c[_0x479c('0x2a')],qs[_0x479c('0x2f')](_0x85296a[_0x479c('0x2b')][_0x479c('0x2f')]));_0xb7ae4d[_0x479c('0x2e')]=_0xb7ae4d[_0x479c('0x2e')][_0x479c('0x30')]?_0xb7ae4d[_0x479c('0x2e')]:_0xf3a23c[_0x479c('0x2a')];if(!_0x85296a['query'][_0x479c('0x31')](_0x479c('0x32'))){_0xb7ae4d[_0x479c('0x33')]=qs[_0x479c('0x33')](_0x85296a[_0x479c('0x2b')][_0x479c('0x33')]);_0xb7ae4d[_0x479c('0x1a')]=qs[_0x479c('0x1a')](_0x85296a[_0x479c('0x2b')][_0x479c('0x1a')]);}_0xb7ae4d[_0x479c('0x34')]=qs[_0x479c('0x35')](_0x85296a['query'][_0x479c('0x35')]);_0xb7ae4d[_0x479c('0x36')]=qs[_0x479c('0x37')](_[_0x479c('0x38')](_0x85296a[_0x479c('0x2b')],_0xf3a23c[_0x479c('0x37')]),_0x2a968a);if(_0x85296a[_0x479c('0x2b')][_0x479c('0x39')]){_0xb7ae4d['where']=_[_0x479c('0x3a')](_0xb7ae4d[_0x479c('0x36')],{'$or':_[_0x479c('0x25')](_0x2a968a,function(_0x5ed77e){if(_0x5ed77e['type']!==_0x479c('0x3b')){var _0x3f0532={};_0x3f0532[_0x5ed77e[_0x479c('0x23')]]={'$like':'%'+_0x85296a[_0x479c('0x2b')]['filter']+'%'};return _0x3f0532;}})});}_0xb7ae4d=_[_0x479c('0x3a')]({},_0xb7ae4d,_0x85296a[_0x479c('0x3c')]);var _0x7aad93={'where':_0xb7ae4d[_0x479c('0x36')]};return db['MailTransferReport'][_0x479c('0x3d')](_0x7aad93)[_0x479c('0x20')](function(_0x232da0){_0x258225[_0x479c('0x3d')]=_0x232da0;if(_0x85296a[_0x479c('0x2b')][_0x479c('0x3e')]){_0xb7ae4d[_0x479c('0x3f')]=[{'all':!![]}];}return db[_0x479c('0x26')][_0x479c('0x40')](_0xb7ae4d);})[_0x479c('0x20')](function(_0x4a7262){_0x258225[_0x479c('0x41')]=_0x4a7262;return _0x258225;})[_0x479c('0x20')](respondWithFilteredResult(_0x2750e8,_0xb7ae4d))[_0x479c('0x42')](handleError(_0x2750e8,null));};exports[_0x479c('0x43')]=function(_0x2710b4,_0x377131){var _0x7c4a51={'raw':!![],'where':{'id':_0x2710b4[_0x479c('0x44')]['id']}},_0x30e3ba={};_0x30e3ba[_0x479c('0x2a')]=_[_0x479c('0x2c')](db[_0x479c('0x26')][_0x479c('0x45')]);_0x30e3ba[_0x479c('0x2b')]=_['keys'](_0x2710b4[_0x479c('0x2b')]);_0x30e3ba[_0x479c('0x46')]=_[_0x479c('0x2d')](_0x30e3ba[_0x479c('0x2a')],_0x30e3ba[_0x479c('0x2b')]);_0x7c4a51['attributes']=_[_0x479c('0x2d')](_0x30e3ba[_0x479c('0x2a')],qs['fields'](_0x2710b4['query'][_0x479c('0x2f')]));_0x7c4a51[_0x479c('0x2e')]=_0x7c4a51[_0x479c('0x2e')][_0x479c('0x30')]?_0x7c4a51[_0x479c('0x2e')]:_0x30e3ba[_0x479c('0x2a')];if(_0x2710b4[_0x479c('0x2b')][_0x479c('0x3e')]){_0x7c4a51[_0x479c('0x3f')]=[{'all':!![]}];}_0x7c4a51=_[_0x479c('0x3a')]({},_0x7c4a51,_0x2710b4['options']);return db[_0x479c('0x26')]['find'](_0x7c4a51)['then'](handleEntityNotFound(_0x377131,null))[_0x479c('0x20')](respondWithResult(_0x377131,null))[_0x479c('0x42')](handleError(_0x377131,null));};exports['create']=function(_0x5ec24c,_0x2d2599){return db[_0x479c('0x26')][_0x479c('0x47')](_0x5ec24c[_0x479c('0x48')],{})[_0x479c('0x20')](respondWithResult(_0x2d2599,0xc9))[_0x479c('0x42')](handleError(_0x2d2599,null));};exports[_0x479c('0x1f')]=function(_0x5dac10,_0x488d85){if(_0x5dac10[_0x479c('0x48')]['id']){delete _0x5dac10[_0x479c('0x48')]['id'];}return db[_0x479c('0x26')][_0x479c('0x49')]({'where':{'id':_0x5dac10[_0x479c('0x44')]['id']}})[_0x479c('0x20')](handleEntityNotFound(_0x488d85,null))[_0x479c('0x20')](saveUpdates(_0x5dac10[_0x479c('0x48')],null))[_0x479c('0x20')](respondWithResult(_0x488d85,null))[_0x479c('0x42')](handleError(_0x488d85,null));};exports[_0x479c('0x21')]=function(_0x3aab96,_0x3f7675){return db[_0x479c('0x26')][_0x479c('0x49')]({'where':{'id':_0x3aab96[_0x479c('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f7675,null))[_0x479c('0x20')](removeEntity(_0x3f7675,null))['catch'](handleError(_0x3f7675,null));};exports[_0x479c('0x4a')]=function(_0x28585a,_0x289b94){return db[_0x479c('0x26')][_0x479c('0x4a')]()[_0x479c('0x20')](respondWithResult(_0x289b94,null))[_0x479c('0x42')](handleError(_0x289b94,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 82c48c2..34138d0 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 _0x5f9f=['lodash','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x5c725c,_0x2106b5){var _0x59a1e2=function(_0x243882){while(--_0x243882){_0x5c725c['push'](_0x5c725c['shift']());}};_0x59a1e2(++_0x2106b5);}(_0x5f9f,0x19a));var _0xf5f9=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x5f9f[_0x481bf7];return _0x461787;};'use strict';var _=require(_0xf5f9('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf5f9('0x1'));var rp=require(_0xf5f9('0x2'));var fs=require('fs');var path=require(_0xf5f9('0x3'));var rimraf=require(_0xf5f9('0x4'));var config=require(_0xf5f9('0x5'));var attributes=require(_0xf5f9('0x6'));module['exports']=function(_0x5da6a6,_0x28ff4c){return _0x5da6a6['define'](_0xf5f9('0x7'),attributes,{'tableName':_0xf5f9('0x8'),'paranoid':![],'indexes':[{'name':_0xf5f9('0x9'),'fields':[_0xf5f9('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd1d9=['define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes'];(function(_0x462eb3,_0x2af151){var _0x1f926d=function(_0x51959e){while(--_0x51959e){_0x462eb3['push'](_0x462eb3['shift']());}};_0x1f926d(++_0x2af151);}(_0xd1d9,0x6c));var _0x9d1d=function(_0x3e98d1,_0x45e559){_0x3e98d1=_0x3e98d1-0x0;var _0x2fcfb0=_0xd1d9[_0x3e98d1];return _0x2fcfb0;};'use strict';var _=require(_0x9d1d('0x0'));var util=require(_0x9d1d('0x1'));var logger=require('../../config/logger')(_0x9d1d('0x2'));var moment=require(_0x9d1d('0x3'));var BPromise=require('bluebird');var rp=require(_0x9d1d('0x4'));var fs=require('fs');var path=require(_0x9d1d('0x5'));var rimraf=require(_0x9d1d('0x6'));var config=require(_0x9d1d('0x7'));var attributes=require(_0x9d1d('0x8'));module['exports']=function(_0x29d6bb,_0xd78b45){return _0x29d6bb[_0x9d1d('0x9')](_0x9d1d('0xa'),attributes,{'tableName':_0x9d1d('0xb'),'paranoid':![],'indexes':[{'name':_0x9d1d('0xc'),'fields':[_0x9d1d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 158cc76..9c2540e 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 _0x3dd5=['request','request\x20sent','debug','stringify','error','MailTransferReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3f2228,_0x3b27d5){var _0x285ae4=function(_0x5e1f23){while(--_0x5e1f23){_0x3f2228['push'](_0x3f2228['shift']());}};_0x285ae4(++_0x3b27d5);}(_0x3dd5,0x169));var _0x53dd=function(_0x38054b,_0x15fd39){_0x38054b=_0x38054b-0x0;var _0x1236ed=_0x3dd5[_0x38054b];return _0x1236ed;};'use strict';var _=require(_0x53dd('0x0'));var util=require(_0x53dd('0x1'));var moment=require(_0x53dd('0x2'));var BPromise=require(_0x53dd('0x3'));var rs=require(_0x53dd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53dd('0x5'))['db'];var utils=require(_0x53dd('0x6'));var logger=require(_0x53dd('0x7'))(_0x53dd('0x8'));var config=require(_0x53dd('0x9'));var jayson=require(_0x53dd('0xa'));var client=jayson[_0x53dd('0xb')][_0x53dd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21c29a,_0x381b39,_0x33c28b){return new BPromise(function(_0x1a0432,_0x55fc60){return client[_0x53dd('0xd')](_0x21c29a,_0x33c28b)['then'](function(_0x518d04){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x381b39,_0x53dd('0xe'));logger[_0x53dd('0xf')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x381b39,_0x53dd('0xe'),JSON[_0x53dd('0x10')](_0x518d04));if(_0x518d04[_0x53dd('0x11')]){if(_0x518d04[_0x53dd('0x11')]['code']===0x1f4){logger[_0x53dd('0x11')](_0x53dd('0x12'),_0x381b39,_0x518d04['error'][_0x53dd('0x13')]);return _0x55fc60(_0x518d04[_0x53dd('0x11')]['message']);}logger[_0x53dd('0x11')](_0x53dd('0x12'),_0x381b39,_0x518d04['error']['message']);return _0x1a0432(_0x518d04[_0x53dd('0x11')][_0x53dd('0x13')]);}else{logger[_0x53dd('0x14')](_0x53dd('0x12'),_0x381b39,'request\x20sent');_0x1a0432(_0x518d04[_0x53dd('0x15')][_0x53dd('0x13')]);}})['catch'](function(_0x4b4991){logger[_0x53dd('0x11')](_0x53dd('0x12'),_0x381b39,_0x4b4991);_0x55fc60(_0x4b4991);});});} \ No newline at end of file +var _0x956c=['code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x5b7887,_0x38a5fb){var _0x12c4ab=function(_0x57a840){while(--_0x57a840){_0x5b7887['push'](_0x5b7887['shift']());}};_0x12c4ab(++_0x38a5fb);}(_0x956c,0x1a6));var _0xc956=function(_0x5274d7,_0x4dc197){_0x5274d7=_0x5274d7-0x0;var _0x5c805b=_0x956c[_0x5274d7];return _0x5c805b;};'use strict';var _=require(_0xc956('0x0'));var util=require(_0xc956('0x1'));var moment=require('moment');var BPromise=require(_0xc956('0x2'));var rs=require(_0xc956('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc956('0x4'))['db'];var utils=require(_0xc956('0x5'));var logger=require(_0xc956('0x6'))(_0xc956('0x7'));var config=require(_0xc956('0x8'));var jayson=require(_0xc956('0x9'));var client=jayson['client'][_0xc956('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5705e9,_0x19e8ef,_0x29c4c6){return new BPromise(function(_0x4f3ab6,_0x34e6e1){return client[_0xc956('0xb')](_0x5705e9,_0x29c4c6)['then'](function(_0x37d34f){logger[_0xc956('0xc')](_0xc956('0xd'),_0x19e8ef,_0xc956('0xe'));logger[_0xc956('0xf')](_0xc956('0x10'),_0x19e8ef,'request\x20sent',JSON['stringify'](_0x37d34f));if(_0x37d34f['error']){if(_0x37d34f[_0xc956('0x11')][_0xc956('0x12')]===0x1f4){logger[_0xc956('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x19e8ef,_0x37d34f[_0xc956('0x11')][_0xc956('0x13')]);return _0x34e6e1(_0x37d34f[_0xc956('0x11')][_0xc956('0x13')]);}logger[_0xc956('0x11')](_0xc956('0xd'),_0x19e8ef,_0x37d34f[_0xc956('0x11')][_0xc956('0x13')]);return _0x4f3ab6(_0x37d34f[_0xc956('0x11')][_0xc956('0x13')]);}else{logger[_0xc956('0xc')](_0xc956('0xd'),_0x19e8ef,_0xc956('0xe'));_0x4f3ab6(_0x37d34f[_0xc956('0x14')][_0xc956('0x13')]);}})[_0xc956('0x15')](function(_0x1626fd){logger['error'](_0xc956('0xd'),_0x19e8ef,_0x1626fd);_0x34e6e1(_0x1626fd);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 78613e9..f076099 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 _0xef67=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','delete','destroy'];(function(_0x374f68,_0xf10e14){var _0x4acbb9=function(_0x372230){while(--_0x372230){_0x374f68['push'](_0x374f68['shift']());}};_0x4acbb9(++_0xf10e14);}(_0xef67,0x99));var _0x7ef6=function(_0x1f109c,_0xd9952e){_0x1f109c=_0x1f109c-0x0;var _0x3984e8=_0xef67[_0x1f109c];return _0x3984e8;};'use strict';var multer=require(_0x7ef6('0x0'));var util=require(_0x7ef6('0x1'));var path=require(_0x7ef6('0x2'));var timeout=require(_0x7ef6('0x3'));var express=require('express');var router=express[_0x7ef6('0x4')]();var auth=require(_0x7ef6('0x5'));var interaction=require(_0x7ef6('0x6'));var config=require(_0x7ef6('0x7'));var controller=require(_0x7ef6('0x8'));router[_0x7ef6('0x9')]('/',auth['isAuthenticated'](),controller[_0x7ef6('0xa')]);router['get'](_0x7ef6('0xb'),auth[_0x7ef6('0xc')](),controller[_0x7ef6('0xd')]);router[_0x7ef6('0x9')](_0x7ef6('0xe'),auth[_0x7ef6('0xc')](),controller[_0x7ef6('0xf')]);router['post']('/',auth[_0x7ef6('0xc')](),controller['create']);router['put'](_0x7ef6('0xe'),auth[_0x7ef6('0xc')](),controller['update']);router[_0x7ef6('0x10')](_0x7ef6('0xe'),auth[_0x7ef6('0xc')](),controller[_0x7ef6('0x11')]);module[_0x7ef6('0x12')]=router; \ No newline at end of file +var _0x53f0=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x30c92b,_0x154324){var _0x33837b=function(_0x3366e6){while(--_0x3366e6){_0x30c92b['push'](_0x30c92b['shift']());}};_0x33837b(++_0x154324);}(_0x53f0,0x14c));var _0x053f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x53f0[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x053f('0x0'));var util=require(_0x053f('0x1'));var path=require(_0x053f('0x2'));var timeout=require(_0x053f('0x3'));var express=require(_0x053f('0x4'));var router=express[_0x053f('0x5')]();var auth=require(_0x053f('0x6'));var interaction=require(_0x053f('0x7'));var config=require(_0x053f('0x8'));var controller=require(_0x053f('0x9'));router[_0x053f('0xa')]('/',auth[_0x053f('0xb')](),controller['index']);router[_0x053f('0xa')](_0x053f('0xc'),auth[_0x053f('0xb')](),controller[_0x053f('0xd')]);router[_0x053f('0xa')](_0x053f('0xe'),auth[_0x053f('0xb')](),controller['show']);router[_0x053f('0xf')]('/',auth[_0x053f('0xb')](),controller[_0x053f('0x10')]);router[_0x053f('0x11')](_0x053f('0xe'),auth[_0x053f('0xb')](),controller['update']);router[_0x053f('0x12')]('/:id',auth[_0x053f('0xb')](),controller[_0x053f('0x13')]);module[_0x053f('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 0f6bb82..65e2160 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 _0x363f=['sequelize','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]'];(function(_0x489f48,_0x591226){var _0x28f576=function(_0x14528f){while(--_0x14528f){_0x489f48['push'](_0x489f48['shift']());}};_0x28f576(++_0x591226);}(_0x363f,0x1b0));var _0xf363=function(_0x5441ec,_0x2b8ea7){_0x5441ec=_0x5441ec-0x0;var _0x1c134f=_0x363f[_0x5441ec];return _0x1c134f;};'use strict';var Sequelize=require(_0xf363('0x0'));var moment=require('moment');module[_0xf363('0x1')]={'channel':{'type':Sequelize[_0xf363('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xf363('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xf363('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xf363('0x4')]},'enterAt':{'type':Sequelize[_0xf363('0x5')]},'exitAt':{'type':Sequelize[_0xf363('0x5')],'set':function(_0x1ec297){var _0x25bc60=moment(_0x1ec297);var _0x4a2fb3=moment(this[_0xf363('0x6')](_0xf363('0x7')));var _0x636102=_0x25bc60[_0xf363('0x8')](_0x4a2fb3,_0xf363('0x9'));this[_0xf363('0xa')](_0xf363('0xb'),_0x1ec297);this['setDataValue']('duration',_0x636102||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xf363('0xc')},'data2':{'type':Sequelize[_0xf363('0x2')],'comment':_0xf363('0xd')},'data3':{'type':Sequelize[_0xf363('0x2')],'comment':_0xf363('0xe')},'data4':{'type':Sequelize[_0xf363('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xf363('0x2')],'comment':_0xf363('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xf363('0x4')]},'uniqueid':{'type':Sequelize[_0xf363('0x2')]}}; \ No newline at end of file +var _0xedac=['getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x1c9671,_0x3cf964){var _0x1dd552=function(_0x4e5c7f){while(--_0x4e5c7f){_0x1c9671['push'](_0x1c9671['shift']());}};_0x1dd552(++_0x3cf964);}(_0xedac,0xe2));var _0xceda=function(_0x1fa614,_0x49d879){_0x1fa614=_0x1fa614-0x0;var _0x1f4eae=_0xedac[_0x1fa614];return _0x1f4eae;};'use strict';var Sequelize=require(_0xceda('0x0'));var moment=require(_0xceda('0x1'));module[_0xceda('0x2')]={'channel':{'type':Sequelize[_0xceda('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0xceda('0x4'),'comment':_0xceda('0x5')},'duration':{'type':Sequelize[_0xceda('0x6')]},'enterAt':{'type':Sequelize[_0xceda('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0xa14d8){var _0x3e7cef=moment(_0xa14d8);var _0x178fc0=moment(this[_0xceda('0x8')](_0xceda('0x9')));var _0x50b2a3=_0x3e7cef[_0xceda('0xa')](_0x178fc0,_0xceda('0xb'));this[_0xceda('0xc')](_0xceda('0xd'),_0xa14d8);this['setDataValue'](_0xceda('0xe'),_0x50b2a3||null);}},'data1':{'type':Sequelize[_0xceda('0x3')],'comment':_0xceda('0xf')},'data2':{'type':Sequelize[_0xceda('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0xceda('0x10')},'data4':{'type':Sequelize[_0xceda('0x3')],'comment':_0xceda('0x11')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xceda('0x3')]},'internal':{'type':Sequelize[_0xceda('0x6')]},'uniqueid':{'type':Sequelize[_0xceda('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index f1c3332..9bcc151 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 _0x5885=['save','update','then','destroy','error','stack','name','index','MemberReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filter','where','merge','map','VIRTUAL','options','count','includeAll','include','findAll','show','params','rawAttributes','length','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','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','set','Content-Range','apply','reject'];(function(_0xe0f8d4,_0x5b55e3){var _0x329f3a=function(_0x1e552f){while(--_0x1e552f){_0xe0f8d4['push'](_0xe0f8d4['shift']());}};_0x329f3a(++_0x5b55e3);}(_0x5885,0x7a));var _0x5588=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5885[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x5588('0x0'));var emlformat=require(_0x5588('0x1'));var rimraf=require(_0x5588('0x2'));var zipdir=require(_0x5588('0x3'));var jsonpatch=require(_0x5588('0x4'));var rp=require(_0x5588('0x5'));var moment=require('moment');var BPromise=require(_0x5588('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5588('0x7'));var sox=require(_0x5588('0x8'));var csv=require(_0x5588('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5588('0xa'));var squel=require(_0x5588('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5588('0xc'));var Papa=require(_0x5588('0xd'));var Redis=require(_0x5588('0xe'));var authService=require(_0x5588('0xf'));var qs=require(_0x5588('0x10'));var as=require(_0x5588('0x11'));var hardwareService=require(_0x5588('0x12'));var logger=require(_0x5588('0x13'))(_0x5588('0x14'));var utils=require(_0x5588('0x15'));var config=require(_0x5588('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5588('0x17'))['db'];function respondWithStatusCode(_0x1d51ed,_0x564196){_0x564196=_0x564196||0xcc;return function(_0x37ce78){if(_0x37ce78){return _0x1d51ed[_0x5588('0x18')](_0x564196);}return _0x1d51ed[_0x5588('0x19')](_0x564196)[_0x5588('0x1a')]();};}function respondWithResult(_0x16fac9,_0x1b4d4e){_0x1b4d4e=_0x1b4d4e||0xc8;return function(_0x3501e1){if(_0x3501e1){return _0x16fac9[_0x5588('0x19')](_0x1b4d4e)[_0x5588('0x1b')](_0x3501e1);}};}function respondWithFilteredResult(_0x5e731c,_0x2ad601){return function(_0x313a6d){if(_0x313a6d){var _0x3fa129=_0x313a6d['count'],_0x42bdb6=_0x2ad601['offset'],_0x12e8d5=_0x2ad601['offset']+_0x2ad601['limit'],_0x85417b;if(_0x12e8d5>=_0x3fa129){_0x12e8d5=_0x3fa129;_0x85417b=0xc8;}else{_0x85417b=0xce;}_0x5e731c['status'](_0x85417b);return _0x5e731c[_0x5588('0x1c')](_0x5588('0x1d'),_0x42bdb6+'-'+_0x12e8d5+'/'+_0x3fa129)[_0x5588('0x1b')](_0x313a6d);}return null;};}function patchUpdates(_0x1e7501){return function(_0x308d71){try{jsonpatch[_0x5588('0x1e')](_0x308d71,_0x1e7501,!![]);}catch(_0x37bb50){return BPromise[_0x5588('0x1f')](_0x37bb50);}return _0x308d71[_0x5588('0x20')]();};}function saveUpdates(_0x348c7b,_0xe2c7ea){return function(_0x110bb7){if(_0x110bb7){return _0x110bb7[_0x5588('0x21')](_0x348c7b)[_0x5588('0x22')](function(_0x488d2a){return _0x488d2a;});}return null;};}function removeEntity(_0x1d0b6d,_0x533c85){return function(_0x529d60){if(_0x529d60){return _0x529d60[_0x5588('0x23')]()[_0x5588('0x22')](function(){_0x1d0b6d[_0x5588('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6f4a60,_0x8aab3c){return function(_0x25ec75){if(!_0x25ec75){_0x6f4a60[_0x5588('0x18')](0x194);}return _0x25ec75;};}function handleError(_0x22ec1d,_0x31d75e){_0x31d75e=_0x31d75e||0x1f4;return function(_0x1c260b){logger[_0x5588('0x24')](_0x1c260b[_0x5588('0x25')]);if(_0x1c260b[_0x5588('0x26')]){delete _0x1c260b[_0x5588('0x26')];}_0x22ec1d[_0x5588('0x19')](_0x31d75e)['send'](_0x1c260b);};}exports[_0x5588('0x27')]=function(_0x45cf9b,_0x39de94){var _0xa326={},_0x8ee723={},_0x199fb8={'count':0x0,'rows':[]};var _0x40d3e7=_['map'](db[_0x5588('0x28')]['rawAttributes'],function(_0x5d7e0f){return{'name':_0x5d7e0f[_0x5588('0x29')],'type':_0x5d7e0f[_0x5588('0x2a')][_0x5588('0x2b')]};});_0x8ee723[_0x5588('0x2c')]=_['map'](_0x40d3e7,_0x5588('0x26'));_0x8ee723[_0x5588('0x2d')]=_[_0x5588('0x2e')](_0x45cf9b['query']);_0x8ee723[_0x5588('0x2f')]=_['intersection'](_0x8ee723[_0x5588('0x2c')],_0x8ee723['query']);_0xa326[_0x5588('0x30')]=_[_0x5588('0x31')](_0x8ee723['model'],qs['fields'](_0x45cf9b[_0x5588('0x2d')][_0x5588('0x32')]));_0xa326[_0x5588('0x30')]=_0xa326[_0x5588('0x30')]['length']?_0xa326['attributes']:_0x8ee723[_0x5588('0x2c')];if(!_0x45cf9b[_0x5588('0x2d')][_0x5588('0x33')](_0x5588('0x34'))){_0xa326['limit']=qs[_0x5588('0x35')](_0x45cf9b[_0x5588('0x2d')][_0x5588('0x35')]);_0xa326['offset']=qs[_0x5588('0x36')](_0x45cf9b['query']['offset']);}_0xa326[_0x5588('0x37')]=qs['sort'](_0x45cf9b[_0x5588('0x2d')][_0x5588('0x38')]);_0xa326['where']=qs['filters'](_[_0x5588('0x39')](_0x45cf9b[_0x5588('0x2d')],_0x8ee723[_0x5588('0x2f')]),_0x40d3e7);if(_0x45cf9b[_0x5588('0x2d')][_0x5588('0x3a')]){_0xa326[_0x5588('0x3b')]=_[_0x5588('0x3c')](_0xa326[_0x5588('0x3b')],{'$or':_[_0x5588('0x3d')](_0x40d3e7,function(_0x4c5309){if(_0x4c5309[_0x5588('0x2a')]!==_0x5588('0x3e')){var _0x1a6547={};_0x1a6547[_0x4c5309['name']]={'$like':'%'+_0x45cf9b['query'][_0x5588('0x3a')]+'%'};return _0x1a6547;}})});}_0xa326=_[_0x5588('0x3c')]({},_0xa326,_0x45cf9b[_0x5588('0x3f')]);var _0x2ff0c7={'where':_0xa326[_0x5588('0x3b')]};return db['MemberReport'][_0x5588('0x40')](_0x2ff0c7)['then'](function(_0x2b3a73){_0x199fb8['count']=_0x2b3a73;if(_0x45cf9b['query'][_0x5588('0x41')]){_0xa326[_0x5588('0x42')]=[{'all':!![]}];}return db['MemberReport'][_0x5588('0x43')](_0xa326);})[_0x5588('0x22')](function(_0x19ec58){_0x199fb8['rows']=_0x19ec58;return _0x199fb8;})[_0x5588('0x22')](respondWithFilteredResult(_0x39de94,_0xa326))['catch'](handleError(_0x39de94,null));};exports[_0x5588('0x44')]=function(_0x3cb85d,_0x3a8c8b){var _0x5a190e={'raw':!![],'where':{'id':_0x3cb85d[_0x5588('0x45')]['id']}},_0x1ae515={};_0x1ae515[_0x5588('0x2c')]=_[_0x5588('0x2e')](db[_0x5588('0x28')][_0x5588('0x46')]);_0x1ae515['query']=_[_0x5588('0x2e')](_0x3cb85d[_0x5588('0x2d')]);_0x1ae515['filtears']=_['intersection'](_0x1ae515[_0x5588('0x2c')],_0x1ae515[_0x5588('0x2d')]);_0x5a190e['attributes']=_[_0x5588('0x31')](_0x1ae515[_0x5588('0x2c')],qs[_0x5588('0x32')](_0x3cb85d[_0x5588('0x2d')]['fields']));_0x5a190e[_0x5588('0x30')]=_0x5a190e['attributes'][_0x5588('0x47')]?_0x5a190e['attributes']:_0x1ae515['model'];if(_0x3cb85d[_0x5588('0x2d')][_0x5588('0x41')]){_0x5a190e['include']=[{'all':!![]}];}_0x5a190e=_[_0x5588('0x3c')]({},_0x5a190e,_0x3cb85d['options']);return db['MemberReport'][_0x5588('0x48')](_0x5a190e)[_0x5588('0x22')](handleEntityNotFound(_0x3a8c8b,null))['then'](respondWithResult(_0x3a8c8b,null))[_0x5588('0x49')](handleError(_0x3a8c8b,null));};exports[_0x5588('0x4a')]=function(_0x139459,_0x445d94){return db['MemberReport'][_0x5588('0x4a')](_0x139459[_0x5588('0x4b')],{})['then'](respondWithResult(_0x445d94,0xc9))['catch'](handleError(_0x445d94,null));};exports[_0x5588('0x21')]=function(_0x2f5493,_0x1f2f66){if(_0x2f5493[_0x5588('0x4b')]['id']){delete _0x2f5493[_0x5588('0x4b')]['id'];}return db[_0x5588('0x28')][_0x5588('0x48')]({'where':{'id':_0x2f5493['params']['id']}})['then'](handleEntityNotFound(_0x1f2f66,null))[_0x5588('0x22')](saveUpdates(_0x2f5493[_0x5588('0x4b')],null))[_0x5588('0x22')](respondWithResult(_0x1f2f66,null))[_0x5588('0x49')](handleError(_0x1f2f66,null));};exports[_0x5588('0x23')]=function(_0xde47df,_0x2d2561){return db['MemberReport'][_0x5588('0x48')]({'where':{'id':_0xde47df[_0x5588('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d2561,null))[_0x5588('0x22')](removeEntity(_0x2d2561,null))['catch'](handleError(_0x2d2561,null));};exports[_0x5588('0x4c')]=function(_0x2388ef,_0x1e21be){return db[_0x5588('0x28')][_0x5588('0x4c')]()[_0x5588('0x22')](respondWithResult(_0x1e21be,null))['catch'](handleError(_0x1e21be,null));}; \ No newline at end of file +var _0xf161=['key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','filtears','find','create','update','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','count','offset','limit','set','Content-Range','json','apply','reject','then','destroy','sendStatus','error','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf161,0xb8));var _0x1f16=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0xf161[_0x49d41c];return _0xb64c5f;};'use strict';var pdf=require(_0x1f16('0x0'));var emlformat=require(_0x1f16('0x1'));var rimraf=require(_0x1f16('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f16('0x3'));var rp=require('request-promise');var moment=require(_0x1f16('0x4'));var BPromise=require(_0x1f16('0x5'));var Mustache=require(_0x1f16('0x6'));var util=require(_0x1f16('0x7'));var path=require(_0x1f16('0x8'));var sox=require(_0x1f16('0x9'));var csv=require(_0x1f16('0xa'));var ejs=require(_0x1f16('0xb'));var fs=require('fs');var _=require(_0x1f16('0xc'));var squel=require(_0x1f16('0xd'));var crypto=require(_0x1f16('0xe'));var jsforce=require(_0x1f16('0xf'));var deskjs=require(_0x1f16('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1f16('0x11'));var Papa=require(_0x1f16('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f16('0x13'))(_0x1f16('0x14'));var utils=require(_0x1f16('0x15'));var config=require(_0x1f16('0x16'));var licenseUtil=require(_0x1f16('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x143f78,_0x34f638){_0x34f638=_0x34f638||0xcc;return function(_0x18e2d5){if(_0x18e2d5){return _0x143f78['sendStatus'](_0x34f638);}return _0x143f78[_0x1f16('0x18')](_0x34f638)[_0x1f16('0x19')]();};}function respondWithResult(_0x1afd47,_0xc61089){_0xc61089=_0xc61089||0xc8;return function(_0x3a92ac){if(_0x3a92ac){return _0x1afd47[_0x1f16('0x18')](_0xc61089)['json'](_0x3a92ac);}};}function respondWithFilteredResult(_0x143979,_0x1e9bcc){return function(_0x15fe63){if(_0x15fe63){var _0x5842c4=_0x15fe63[_0x1f16('0x1a')],_0x2d54ef=_0x1e9bcc[_0x1f16('0x1b')],_0x110ad4=_0x1e9bcc[_0x1f16('0x1b')]+_0x1e9bcc[_0x1f16('0x1c')],_0x11e95a;if(_0x110ad4>=_0x5842c4){_0x110ad4=_0x5842c4;_0x11e95a=0xc8;}else{_0x11e95a=0xce;}_0x143979[_0x1f16('0x18')](_0x11e95a);return _0x143979[_0x1f16('0x1d')](_0x1f16('0x1e'),_0x2d54ef+'-'+_0x110ad4+'/'+_0x5842c4)[_0x1f16('0x1f')](_0x15fe63);}return null;};}function patchUpdates(_0x1a58cd){return function(_0x18ae88){try{jsonpatch[_0x1f16('0x20')](_0x18ae88,_0x1a58cd,!![]);}catch(_0x5be38f){return BPromise[_0x1f16('0x21')](_0x5be38f);}return _0x18ae88['save']();};}function saveUpdates(_0x4c48fc,_0x31f696){return function(_0x19e5f5){if(_0x19e5f5){return _0x19e5f5['update'](_0x4c48fc)[_0x1f16('0x22')](function(_0x4e3237){return _0x4e3237;});}return null;};}function removeEntity(_0x4d124e,_0x401340){return function(_0x1c0597){if(_0x1c0597){return _0x1c0597[_0x1f16('0x23')]()[_0x1f16('0x22')](function(){_0x4d124e[_0x1f16('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1439b5,_0x250f76){return function(_0x3e4330){if(!_0x3e4330){_0x1439b5[_0x1f16('0x24')](0x194);}return _0x3e4330;};}function handleError(_0x16a039,_0x1c076d){_0x1c076d=_0x1c076d||0x1f4;return function(_0x2a4add){logger[_0x1f16('0x25')](_0x2a4add[_0x1f16('0x26')]);if(_0x2a4add[_0x1f16('0x27')]){delete _0x2a4add[_0x1f16('0x27')];}_0x16a039[_0x1f16('0x18')](_0x1c076d)[_0x1f16('0x28')](_0x2a4add);};}exports[_0x1f16('0x29')]=function(_0x45cd7b,_0x4d29eb){var _0x4ffa9b={},_0x5eceb5={},_0x4fbca2={'count':0x0,'rows':[]};var _0x1cc914=_[_0x1f16('0x2a')](db[_0x1f16('0x2b')][_0x1f16('0x2c')],function(_0x5a91fa){return{'name':_0x5a91fa[_0x1f16('0x2d')],'type':_0x5a91fa[_0x1f16('0x2e')][_0x1f16('0x2f')]};});_0x5eceb5['model']=_[_0x1f16('0x2a')](_0x1cc914,_0x1f16('0x27'));_0x5eceb5[_0x1f16('0x30')]=_[_0x1f16('0x31')](_0x45cd7b[_0x1f16('0x30')]);_0x5eceb5[_0x1f16('0x32')]=_[_0x1f16('0x33')](_0x5eceb5[_0x1f16('0x34')],_0x5eceb5[_0x1f16('0x30')]);_0x4ffa9b[_0x1f16('0x35')]=_['intersection'](_0x5eceb5['model'],qs[_0x1f16('0x36')](_0x45cd7b[_0x1f16('0x30')][_0x1f16('0x36')]));_0x4ffa9b[_0x1f16('0x35')]=_0x4ffa9b[_0x1f16('0x35')][_0x1f16('0x37')]?_0x4ffa9b[_0x1f16('0x35')]:_0x5eceb5[_0x1f16('0x34')];if(!_0x45cd7b[_0x1f16('0x30')]['hasOwnProperty'](_0x1f16('0x38'))){_0x4ffa9b['limit']=qs['limit'](_0x45cd7b['query'][_0x1f16('0x1c')]);_0x4ffa9b[_0x1f16('0x1b')]=qs[_0x1f16('0x1b')](_0x45cd7b[_0x1f16('0x30')][_0x1f16('0x1b')]);}_0x4ffa9b[_0x1f16('0x39')]=qs[_0x1f16('0x3a')](_0x45cd7b[_0x1f16('0x30')]['sort']);_0x4ffa9b[_0x1f16('0x3b')]=qs[_0x1f16('0x32')](_[_0x1f16('0x3c')](_0x45cd7b[_0x1f16('0x30')],_0x5eceb5[_0x1f16('0x32')]),_0x1cc914);if(_0x45cd7b[_0x1f16('0x30')][_0x1f16('0x3d')]){_0x4ffa9b[_0x1f16('0x3b')]=_[_0x1f16('0x3e')](_0x4ffa9b[_0x1f16('0x3b')],{'$or':_[_0x1f16('0x2a')](_0x1cc914,function(_0x56edcf){if(_0x56edcf[_0x1f16('0x2e')]!==_0x1f16('0x3f')){var _0x267f3e={};_0x267f3e[_0x56edcf[_0x1f16('0x27')]]={'$like':'%'+_0x45cd7b[_0x1f16('0x30')][_0x1f16('0x3d')]+'%'};return _0x267f3e;}})});}_0x4ffa9b=_[_0x1f16('0x3e')]({},_0x4ffa9b,_0x45cd7b[_0x1f16('0x40')]);var _0x21747c={'where':_0x4ffa9b['where']};return db[_0x1f16('0x2b')][_0x1f16('0x1a')](_0x21747c)[_0x1f16('0x22')](function(_0x53e15d){_0x4fbca2[_0x1f16('0x1a')]=_0x53e15d;if(_0x45cd7b[_0x1f16('0x30')][_0x1f16('0x41')]){_0x4ffa9b[_0x1f16('0x42')]=[{'all':!![]}];}return db['MemberReport'][_0x1f16('0x43')](_0x4ffa9b);})[_0x1f16('0x22')](function(_0x544d0a){_0x4fbca2['rows']=_0x544d0a;return _0x4fbca2;})[_0x1f16('0x22')](respondWithFilteredResult(_0x4d29eb,_0x4ffa9b))[_0x1f16('0x44')](handleError(_0x4d29eb,null));};exports[_0x1f16('0x45')]=function(_0x33cb04,_0x48a097){var _0x21c422={'raw':!![],'where':{'id':_0x33cb04[_0x1f16('0x46')]['id']}},_0x50047f={};_0x50047f['model']=_[_0x1f16('0x31')](db[_0x1f16('0x2b')][_0x1f16('0x2c')]);_0x50047f[_0x1f16('0x30')]=_[_0x1f16('0x31')](_0x33cb04['query']);_0x50047f[_0x1f16('0x47')]=_[_0x1f16('0x33')](_0x50047f[_0x1f16('0x34')],_0x50047f[_0x1f16('0x30')]);_0x21c422[_0x1f16('0x35')]=_[_0x1f16('0x33')](_0x50047f[_0x1f16('0x34')],qs[_0x1f16('0x36')](_0x33cb04[_0x1f16('0x30')]['fields']));_0x21c422['attributes']=_0x21c422[_0x1f16('0x35')][_0x1f16('0x37')]?_0x21c422['attributes']:_0x50047f[_0x1f16('0x34')];if(_0x33cb04[_0x1f16('0x30')][_0x1f16('0x41')]){_0x21c422['include']=[{'all':!![]}];}_0x21c422=_[_0x1f16('0x3e')]({},_0x21c422,_0x33cb04['options']);return db['MemberReport'][_0x1f16('0x48')](_0x21c422)[_0x1f16('0x22')](handleEntityNotFound(_0x48a097,null))[_0x1f16('0x22')](respondWithResult(_0x48a097,null))[_0x1f16('0x44')](handleError(_0x48a097,null));};exports[_0x1f16('0x49')]=function(_0x795293,_0x1063d7){return db[_0x1f16('0x2b')][_0x1f16('0x49')](_0x795293['body'],{})[_0x1f16('0x22')](respondWithResult(_0x1063d7,0xc9))[_0x1f16('0x44')](handleError(_0x1063d7,null));};exports[_0x1f16('0x4a')]=function(_0x252fe7,_0x33a0ce){if(_0x252fe7['body']['id']){delete _0x252fe7[_0x1f16('0x4b')]['id'];}return db[_0x1f16('0x2b')][_0x1f16('0x48')]({'where':{'id':_0x252fe7[_0x1f16('0x46')]['id']}})[_0x1f16('0x22')](handleEntityNotFound(_0x33a0ce,null))[_0x1f16('0x22')](saveUpdates(_0x252fe7[_0x1f16('0x4b')],null))[_0x1f16('0x22')](respondWithResult(_0x33a0ce,null))[_0x1f16('0x44')](handleError(_0x33a0ce,null));};exports[_0x1f16('0x23')]=function(_0x44132c,_0x46ba10){return db['MemberReport'][_0x1f16('0x48')]({'where':{'id':_0x44132c[_0x1f16('0x46')]['id']}})[_0x1f16('0x22')](handleEntityNotFound(_0x46ba10,null))[_0x1f16('0x22')](removeEntity(_0x46ba10,null))['catch'](handleError(_0x46ba10,null));};exports[_0x1f16('0x4c')]=function(_0x467884,_0x33b048){return db[_0x1f16('0x2b')][_0x1f16('0x4c')]()['then'](respondWithResult(_0x33b048,null))[_0x1f16('0x44')](handleError(_0x33b048,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 600d501..88a58e6 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 _0xe917=['bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','interface','util','../../config/logger','api','moment'];(function(_0x37512b,_0x18bd74){var _0x5d5a12=function(_0x271f0f){while(--_0x271f0f){_0x37512b['push'](_0x37512b['shift']());}};_0x5d5a12(++_0x18bd74);}(_0xe917,0xce));var _0x7e91=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xe917[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require('lodash');var util=require(_0x7e91('0x0'));var logger=require(_0x7e91('0x1'))(_0x7e91('0x2'));var moment=require(_0x7e91('0x3'));var BPromise=require(_0x7e91('0x4'));var rp=require(_0x7e91('0x5'));var fs=require('fs');var path=require(_0x7e91('0x6'));var rimraf=require('rimraf');var config=require(_0x7e91('0x7'));var attributes=require(_0x7e91('0x8'));module[_0x7e91('0x9')]=function(_0x3a4adf,_0x4f1390){return _0x3a4adf[_0x7e91('0xa')](_0x7e91('0xb'),attributes,{'tableName':_0x7e91('0xc'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0x7e91('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6e82=['define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./memberReport.attributes'];(function(_0x2ec28d,_0x3f9e14){var _0x52c3b2=function(_0x51b76b){while(--_0x51b76b){_0x2ec28d['push'](_0x2ec28d['shift']());}};_0x52c3b2(++_0x3f9e14);}(_0x6e82,0x16e));var _0x26e8=function(_0x2bb3c2,_0x58aa3a){_0x2bb3c2=_0x2bb3c2-0x0;var _0x269cdd=_0x6e82[_0x2bb3c2];return _0x269cdd;};'use strict';var _=require(_0x26e8('0x0'));var util=require(_0x26e8('0x1'));var logger=require(_0x26e8('0x2'))(_0x26e8('0x3'));var moment=require(_0x26e8('0x4'));var BPromise=require(_0x26e8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x26e8('0x6'));var rimraf=require('rimraf');var config=require(_0x26e8('0x7'));var attributes=require(_0x26e8('0x8'));module['exports']=function(_0x5222c0,_0x9b96bb){return _0x5222c0[_0x26e8('0x9')](_0x26e8('0xa'),attributes,{'tableName':_0x26e8('0xb'),'paranoid':![],'indexes':[{'name':_0x26e8('0xc'),'fields':[_0x26e8('0xd'),_0x26e8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 18d1e29..0d91bff 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 _0x1623=['attributes','limit','include','map','model','CreateMemberReport','create','UpdateMemberReport','update','body','where','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetMemberReport','MemberReport','options','raw'];(function(_0x2b5b44,_0x17189c){var _0x32cb66=function(_0x4ce183){while(--_0x4ce183){_0x2b5b44['push'](_0x2b5b44['shift']());}};_0x32cb66(++_0x17189c);}(_0x1623,0x158));var _0x3162=function(_0x4836fd,_0x2223b7){_0x4836fd=_0x4836fd-0x0;var _0xb7b3b9=_0x1623[_0x4836fd];return _0xb7b3b9;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require(_0x3162('0x1'));var BPromise=require('bluebird');var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require(_0x3162('0x6'))(_0x3162('0x7'));var config=require(_0x3162('0x8'));var jayson=require(_0x3162('0x9'));var client=jayson[_0x3162('0xa')][_0x3162('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fe3ac,_0x1f6c96,_0x1a549d){return new BPromise(function(_0xb8f442,_0x432f73){return client['request'](_0x4fe3ac,_0x1a549d)[_0x3162('0xc')](function(_0x485351){logger['info'](_0x3162('0xd'),_0x1f6c96,'request\x20sent');logger[_0x3162('0xe')](_0x3162('0xf'),_0x1f6c96,'request\x20sent',JSON[_0x3162('0x10')](_0x485351));if(_0x485351['error']){if(_0x485351['error']['code']===0x1f4){logger[_0x3162('0x11')](_0x3162('0xd'),_0x1f6c96,_0x485351[_0x3162('0x11')]['message']);return _0x432f73(_0x485351[_0x3162('0x11')][_0x3162('0x12')]);}logger[_0x3162('0x11')](_0x3162('0xd'),_0x1f6c96,_0x485351[_0x3162('0x11')]['message']);return _0xb8f442(_0x485351[_0x3162('0x11')][_0x3162('0x12')]);}else{logger[_0x3162('0x13')](_0x3162('0xd'),_0x1f6c96,'request\x20sent');_0xb8f442(_0x485351[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x1e38a1){logger[_0x3162('0x11')]('MemberReport,\x20%s,\x20%s',_0x1f6c96,_0x1e38a1);_0x432f73(_0x1e38a1);});});}exports[_0x3162('0x16')]=function(_0x3b77fd){var _0x5c1c40=this;return new Promise(function(_0x3fadb1,_0xf7d61f){return db[_0x3162('0x17')]['findAll']({'raw':_0x3b77fd[_0x3162('0x18')]?_0x3b77fd[_0x3162('0x18')][_0x3162('0x19')]===undefined?!![]:![]:!![],'where':_0x3b77fd[_0x3162('0x18')]?_0x3b77fd[_0x3162('0x18')]['where']||null:null,'attributes':_0x3b77fd[_0x3162('0x18')]?_0x3b77fd[_0x3162('0x18')][_0x3162('0x1a')]||null:null,'limit':_0x3b77fd[_0x3162('0x18')]?_0x3b77fd[_0x3162('0x18')][_0x3162('0x1b')]||null:null,'include':_0x3b77fd[_0x3162('0x18')]?_0x3b77fd['options'][_0x3162('0x1c')]?_[_0x3162('0x1d')](_0x3b77fd[_0x3162('0x18')][_0x3162('0x1c')],function(_0x32d875){return{'model':db[_0x32d875[_0x3162('0x1e')]],'as':_0x32d875['as'],'attributes':_0x32d875['attributes'],'include':_0x32d875['include']?_[_0x3162('0x1d')](_0x32d875['include'],function(_0x4c76da){return{'model':db[_0x4c76da[_0x3162('0x1e')]],'as':_0x4c76da['as'],'attributes':_0x4c76da[_0x3162('0x1a')],'include':_0x4c76da['include']?_[_0x3162('0x1d')](_0x4c76da['include'],function(_0x472112){return{'model':db[_0x472112[_0x3162('0x1e')]],'as':_0x472112['as'],'attributes':_0x472112[_0x3162('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3162('0xc')](function(_0x61f3c7){logger[_0x3162('0x13')](_0x3162('0x16'),_0x3b77fd);logger[_0x3162('0xe')](_0x3162('0x16'),_0x3b77fd,JSON[_0x3162('0x10')](_0x61f3c7));_0x3fadb1(_0x61f3c7);})['catch'](function(_0x158b6e){logger['error'](_0x3162('0x16'),_0x158b6e[_0x3162('0x12')],_0x3b77fd);_0xf7d61f(_0x5c1c40[_0x3162('0x11')](0x1f4,_0x158b6e[_0x3162('0x12')]));});});};exports[_0x3162('0x1f')]=function(_0x250fb3){var _0x447c2b=this;return new Promise(function(_0xbda35f,_0x405c88){return db[_0x3162('0x17')][_0x3162('0x20')](_0x250fb3['body'],{'raw':_0x250fb3[_0x3162('0x18')]?_0x250fb3[_0x3162('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x3162('0xc')](function(_0x24c881){logger[_0x3162('0x13')](_0x3162('0x1f'),_0x250fb3);logger[_0x3162('0xe')](_0x3162('0x1f'),_0x250fb3,JSON[_0x3162('0x10')](_0x24c881));_0xbda35f(_0x24c881);})[_0x3162('0x15')](function(_0x1e7c6c){logger[_0x3162('0x11')]('CreateMemberReport',_0x1e7c6c[_0x3162('0x12')],_0x250fb3);_0x405c88(_0x447c2b[_0x3162('0x11')](0x1f4,_0x1e7c6c['message']));});});};exports[_0x3162('0x21')]=function(_0x33324b){var _0x28710c=this;return new Promise(function(_0x2f29df,_0x47124b){return db[_0x3162('0x17')][_0x3162('0x22')](_0x33324b[_0x3162('0x23')],{'raw':_0x33324b[_0x3162('0x18')]?_0x33324b['options'][_0x3162('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33324b[_0x3162('0x18')]?_0x33324b['options'][_0x3162('0x24')]||null:null,'attributes':_0x33324b[_0x3162('0x18')]?_0x33324b[_0x3162('0x18')]['attributes']||null:null,'limit':_0x33324b['options']?_0x33324b[_0x3162('0x18')][_0x3162('0x1b')]||null:null})['then'](function(_0x4c8caf){logger[_0x3162('0x13')](_0x3162('0x21'),_0x33324b);logger['debug']('UpdateMemberReport',_0x33324b,JSON['stringify'](_0x4c8caf));_0x2f29df(_0x4c8caf);})[_0x3162('0x15')](function(_0x410a86){logger[_0x3162('0x11')](_0x3162('0x21'),_0x410a86[_0x3162('0x12')],_0x33324b);_0x47124b(_0x28710c[_0x3162('0x11')](0x1f4,_0x410a86[_0x3162('0x12')]));});});}; \ No newline at end of file +var _0x8210=['util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMemberReport','findAll','options','where','limit','include','model','attributes','map','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','update','raw','lodash'];(function(_0x51b7f8,_0x25d223){var _0xc46c89=function(_0x251bb8){while(--_0x251bb8){_0x51b7f8['push'](_0x51b7f8['shift']());}};_0xc46c89(++_0x25d223);}(_0x8210,0x137));var _0x0821=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x8210[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x0821('0x0'));var util=require(_0x0821('0x1'));var moment=require(_0x0821('0x2'));var BPromise=require(_0x0821('0x3'));var rs=require(_0x0821('0x4'));var fs=require('fs');var Redis=require(_0x0821('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0821('0x6'));var config=require(_0x0821('0x7'));var jayson=require(_0x0821('0x8'));var client=jayson[_0x0821('0x9')][_0x0821('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f0850,_0x383f91,_0x187c13){return new BPromise(function(_0x60fed4,_0x569339){return client[_0x0821('0xb')](_0x5f0850,_0x187c13)[_0x0821('0xc')](function(_0xf1dcd9){logger[_0x0821('0xd')](_0x0821('0xe'),_0x383f91,_0x0821('0xf'));logger[_0x0821('0x10')](_0x0821('0x11'),_0x383f91,'request\x20sent',JSON[_0x0821('0x12')](_0xf1dcd9));if(_0xf1dcd9[_0x0821('0x13')]){if(_0xf1dcd9[_0x0821('0x13')]['code']===0x1f4){logger[_0x0821('0x13')](_0x0821('0xe'),_0x383f91,_0xf1dcd9[_0x0821('0x13')]['message']);return _0x569339(_0xf1dcd9[_0x0821('0x13')][_0x0821('0x14')]);}logger[_0x0821('0x13')](_0x0821('0xe'),_0x383f91,_0xf1dcd9[_0x0821('0x13')][_0x0821('0x14')]);return _0x60fed4(_0xf1dcd9[_0x0821('0x13')][_0x0821('0x14')]);}else{logger[_0x0821('0xd')](_0x0821('0xe'),_0x383f91,_0x0821('0xf'));_0x60fed4(_0xf1dcd9[_0x0821('0x15')]['message']);}})[_0x0821('0x16')](function(_0x11de3b){logger[_0x0821('0x13')](_0x0821('0xe'),_0x383f91,_0x11de3b);_0x569339(_0x11de3b);});});}exports[_0x0821('0x17')]=function(_0x22a2c1){var _0x1f95c0=this;return new Promise(function(_0x103768,_0x47c8ce){return db['MemberReport'][_0x0821('0x18')]({'raw':_0x22a2c1['options']?_0x22a2c1[_0x0821('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x22a2c1['options']?_0x22a2c1[_0x0821('0x19')][_0x0821('0x1a')]||null:null,'attributes':_0x22a2c1['options']?_0x22a2c1[_0x0821('0x19')]['attributes']||null:null,'limit':_0x22a2c1[_0x0821('0x19')]?_0x22a2c1[_0x0821('0x19')][_0x0821('0x1b')]||null:null,'include':_0x22a2c1['options']?_0x22a2c1[_0x0821('0x19')]['include']?_['map'](_0x22a2c1['options'][_0x0821('0x1c')],function(_0x2a3db9){return{'model':db[_0x2a3db9[_0x0821('0x1d')]],'as':_0x2a3db9['as'],'attributes':_0x2a3db9[_0x0821('0x1e')],'include':_0x2a3db9[_0x0821('0x1c')]?_['map'](_0x2a3db9[_0x0821('0x1c')],function(_0x4cf342){return{'model':db[_0x4cf342[_0x0821('0x1d')]],'as':_0x4cf342['as'],'attributes':_0x4cf342[_0x0821('0x1e')],'include':_0x4cf342[_0x0821('0x1c')]?_[_0x0821('0x1f')](_0x4cf342[_0x0821('0x1c')],function(_0x9963d5){return{'model':db[_0x9963d5['model']],'as':_0x9963d5['as'],'attributes':_0x9963d5[_0x0821('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d6f2b){logger[_0x0821('0xd')](_0x0821('0x17'),_0x22a2c1);logger[_0x0821('0x10')](_0x0821('0x17'),_0x22a2c1,JSON[_0x0821('0x12')](_0x3d6f2b));_0x103768(_0x3d6f2b);})[_0x0821('0x16')](function(_0x4dfc04){logger[_0x0821('0x13')]('GetMemberReport',_0x4dfc04[_0x0821('0x14')],_0x22a2c1);_0x47c8ce(_0x1f95c0[_0x0821('0x13')](0x1f4,_0x4dfc04['message']));});});};exports[_0x0821('0x20')]=function(_0x26d047){var _0x32c0a3=this;return new Promise(function(_0x3d3efe,_0x2d15dc){return db[_0x0821('0x21')][_0x0821('0x22')](_0x26d047[_0x0821('0x23')],{'raw':_0x26d047[_0x0821('0x19')]?_0x26d047['options']['raw']===undefined?!![]:![]:!![]})[_0x0821('0xc')](function(_0x1853d0){logger[_0x0821('0xd')](_0x0821('0x20'),_0x26d047);logger[_0x0821('0x10')]('CreateMemberReport',_0x26d047,JSON['stringify'](_0x1853d0));_0x3d3efe(_0x1853d0);})['catch'](function(_0x2b86b8){logger[_0x0821('0x13')](_0x0821('0x20'),_0x2b86b8[_0x0821('0x14')],_0x26d047);_0x2d15dc(_0x32c0a3['error'](0x1f4,_0x2b86b8[_0x0821('0x14')]));});});};exports[_0x0821('0x24')]=function(_0x5c2d9d){var _0x44556a=this;return new Promise(function(_0x49e4cb,_0x223b32){return db['MemberReport'][_0x0821('0x25')](_0x5c2d9d[_0x0821('0x23')],{'raw':_0x5c2d9d[_0x0821('0x19')]?_0x5c2d9d[_0x0821('0x19')][_0x0821('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c2d9d[_0x0821('0x19')]?_0x5c2d9d[_0x0821('0x19')][_0x0821('0x1a')]||null:null,'attributes':_0x5c2d9d['options']?_0x5c2d9d[_0x0821('0x19')][_0x0821('0x1e')]||null:null,'limit':_0x5c2d9d[_0x0821('0x19')]?_0x5c2d9d['options'][_0x0821('0x1b')]||null:null})['then'](function(_0x252050){logger['info'](_0x0821('0x24'),_0x5c2d9d);logger['debug'](_0x0821('0x24'),_0x5c2d9d,JSON[_0x0821('0x12')](_0x252050));_0x49e4cb(_0x252050);})[_0x0821('0x16')](function(_0x181788){logger[_0x0821('0x13')](_0x0821('0x24'),_0x181788[_0x0821('0x14')],_0x5c2d9d);_0x223b32(_0x44556a[_0x0821('0x13')](0x1f4,_0x181788['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index cf70de9..158a9f8 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 _0xa478=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','multer','util'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa478,0x136));var _0x8a47=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xa478[_0xefd519];return _0x4bb882;};'use strict';var multer=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var path=require(_0x8a47('0x2'));var timeout=require(_0x8a47('0x3'));var express=require(_0x8a47('0x4'));var router=express[_0x8a47('0x5')]();var auth=require(_0x8a47('0x6'));var interaction=require(_0x8a47('0x7'));var config=require(_0x8a47('0x8'));var controller=require(_0x8a47('0x9'));router[_0x8a47('0xa')]('/',controller[_0x8a47('0xb')]);module['exports']=router; \ No newline at end of file +var _0x58a4=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path','connect-timeout'];(function(_0x19baca,_0x50e62c){var _0x5012e1=function(_0x4908e1){while(--_0x4908e1){_0x19baca['push'](_0x19baca['shift']());}};_0x5012e1(++_0x50e62c);}(_0x58a4,0xbf));var _0x458a=function(_0x3d34f0,_0x4a5dc0){_0x3d34f0=_0x3d34f0-0x0;var _0x135ecd=_0x58a4[_0x3d34f0];return _0x135ecd;};'use strict';var multer=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var path=require(_0x458a('0x2'));var timeout=require(_0x458a('0x3'));var express=require(_0x458a('0x4'));var router=express[_0x458a('0x5')]();var auth=require(_0x458a('0x6'));var interaction=require(_0x458a('0x7'));var config=require(_0x458a('0x8'));var controller=require(_0x458a('0x9'));router[_0x458a('0xa')]('/',controller[_0x458a('0xb')]);module[_0x458a('0xc')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index ae74fdc..0e83305 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 _0x61d9=['sequelize','exports','STRING'];(function(_0x298598,_0xc32a77){var _0x5e23f3=function(_0x10c10d){while(--_0x10c10d){_0x298598['push'](_0x298598['shift']());}};_0x5e23f3(++_0xc32a77);}(_0x61d9,0x69));var _0x961d=function(_0x58c3ef,_0x386b78){_0x58c3ef=_0x58c3ef-0x0;var _0x20d06a=_0x61d9[_0x58c3ef];return _0x20d06a;};'use strict';var Sequelize=require(_0x961d('0x0'));module[_0x961d('0x1')]={'version':{'type':Sequelize[_0x961d('0x2')],'unique':'version'}}; \ No newline at end of file +var _0xd5e3=['exports','STRING','version','sequelize'];(function(_0x2d6df9,_0x45da50){var _0x429b18=function(_0x5b3c09){while(--_0x5b3c09){_0x2d6df9['push'](_0x2d6df9['shift']());}};_0x429b18(++_0x45da50);}(_0xd5e3,0x13b));var _0x3d5e=function(_0x44c9a8,_0xcf56b2){_0x44c9a8=_0x44c9a8-0x0;var _0xd14b17=_0xd5e3[_0x44c9a8];return _0xd14b17;};'use strict';var Sequelize=require(_0x3d5e('0x0'));module[_0x3d5e('0x1')]={'version':{'type':Sequelize[_0x3d5e('0x2')],'unique':_0x3d5e('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index edab50c..dcfc85e 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 _0xcb37=['options','then','include','rows','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','error','name','send','index','map','Migration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge'];(function(_0x33f22b,_0x25019d){var _0x1d15aa=function(_0x24b5e2){while(--_0x24b5e2){_0x33f22b['push'](_0x33f22b['shift']());}};_0x1d15aa(++_0x25019d);}(_0xcb37,0x115));var _0x7cb3=function(_0x4760e9,_0x4f7e94){_0x4760e9=_0x4760e9-0x0;var _0x564456=_0xcb37[_0x4760e9];return _0x564456;};'use strict';var pdf=require(_0x7cb3('0x0'));var emlformat=require(_0x7cb3('0x1'));var rimraf=require(_0x7cb3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7cb3('0x3'));var rp=require(_0x7cb3('0x4'));var moment=require(_0x7cb3('0x5'));var BPromise=require(_0x7cb3('0x6'));var Mustache=require(_0x7cb3('0x7'));var util=require(_0x7cb3('0x8'));var path=require('path');var sox=require(_0x7cb3('0x9'));var csv=require(_0x7cb3('0xa'));var ejs=require(_0x7cb3('0xb'));var fs=require('fs');var _=require(_0x7cb3('0xc'));var squel=require(_0x7cb3('0xd'));var crypto=require('crypto');var jsforce=require(_0x7cb3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7cb3('0xa'));var querystring=require(_0x7cb3('0xf'));var Papa=require(_0x7cb3('0x10'));var Redis=require('ioredis');var authService=require(_0x7cb3('0x11'));var qs=require(_0x7cb3('0x12'));var as=require(_0x7cb3('0x13'));var hardwareService=require(_0x7cb3('0x14'));var logger=require('../../config/logger')(_0x7cb3('0x15'));var utils=require(_0x7cb3('0x16'));var config=require(_0x7cb3('0x17'));var licenseUtil=require(_0x7cb3('0x18'));var db=require(_0x7cb3('0x19'))['db'];function respondWithStatusCode(_0x46d5df,_0x4938bd){_0x4938bd=_0x4938bd||0xcc;return function(_0x1c2400){if(_0x1c2400){return _0x46d5df[_0x7cb3('0x1a')](_0x4938bd);}return _0x46d5df[_0x7cb3('0x1b')](_0x4938bd)[_0x7cb3('0x1c')]();};}function respondWithResult(_0x4f8f1e,_0x1296c7){_0x1296c7=_0x1296c7||0xc8;return function(_0x39806e){if(_0x39806e){return _0x4f8f1e['status'](_0x1296c7)[_0x7cb3('0x1d')](_0x39806e);}};}function respondWithFilteredResult(_0x12e796,_0x14a200){return function(_0x4176d7){if(_0x4176d7){var _0x1c9989=_0x4176d7[_0x7cb3('0x1e')],_0x41bbd0=_0x14a200['offset'],_0x377d19=_0x14a200[_0x7cb3('0x1f')]+_0x14a200[_0x7cb3('0x20')],_0xb592d4;if(_0x377d19>=_0x1c9989){_0x377d19=_0x1c9989;_0xb592d4=0xc8;}else{_0xb592d4=0xce;}_0x12e796[_0x7cb3('0x1b')](_0xb592d4);return _0x12e796[_0x7cb3('0x21')](_0x7cb3('0x22'),_0x41bbd0+'-'+_0x377d19+'/'+_0x1c9989)[_0x7cb3('0x1d')](_0x4176d7);}return null;};}function patchUpdates(_0x444b19){return function(_0x1168a9){try{jsonpatch['apply'](_0x1168a9,_0x444b19,!![]);}catch(_0x5956d4){return BPromise[_0x7cb3('0x23')](_0x5956d4);}return _0x1168a9[_0x7cb3('0x24')]();};}function saveUpdates(_0x563f32,_0x4a7ec1){return function(_0x54caac){if(_0x54caac){return _0x54caac[_0x7cb3('0x25')](_0x563f32)['then'](function(_0x4a2160){return _0x4a2160;});}return null;};}function removeEntity(_0x43242b,_0x32b83e){return function(_0x1bbb36){if(_0x1bbb36){return _0x1bbb36['destroy']()['then'](function(){_0x43242b[_0x7cb3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4efb7f,_0x86cc48){return function(_0x10e1b7){if(!_0x10e1b7){_0x4efb7f['sendStatus'](0x194);}return _0x10e1b7;};}function handleError(_0x486102,_0x422557){_0x422557=_0x422557||0x1f4;return function(_0x5b7235){logger[_0x7cb3('0x26')](_0x5b7235['stack']);if(_0x5b7235[_0x7cb3('0x27')]){delete _0x5b7235['name'];}_0x486102[_0x7cb3('0x1b')](_0x422557)[_0x7cb3('0x28')](_0x5b7235);};}exports[_0x7cb3('0x29')]=function(_0x430080,_0xf07ac9){var _0x440757={},_0x5cb998={},_0x6f66cd={'count':0x0,'rows':[]};var _0x5e4f03=_[_0x7cb3('0x2a')](db[_0x7cb3('0x2b')][_0x7cb3('0x2c')],function(_0x521809){return{'name':_0x521809['fieldName'],'type':_0x521809[_0x7cb3('0x2d')][_0x7cb3('0x2e')]};});_0x5cb998[_0x7cb3('0x2f')]=_[_0x7cb3('0x2a')](_0x5e4f03,_0x7cb3('0x27'));_0x5cb998[_0x7cb3('0x30')]=_[_0x7cb3('0x31')](_0x430080[_0x7cb3('0x30')]);_0x5cb998[_0x7cb3('0x32')]=_[_0x7cb3('0x33')](_0x5cb998[_0x7cb3('0x2f')],_0x5cb998[_0x7cb3('0x30')]);_0x440757['attributes']=_[_0x7cb3('0x33')](_0x5cb998[_0x7cb3('0x2f')],qs[_0x7cb3('0x34')](_0x430080[_0x7cb3('0x30')][_0x7cb3('0x34')]));_0x440757['attributes']=_0x440757[_0x7cb3('0x35')][_0x7cb3('0x36')]?_0x440757[_0x7cb3('0x35')]:_0x5cb998[_0x7cb3('0x2f')];if(!_0x430080['query'][_0x7cb3('0x37')](_0x7cb3('0x38'))){_0x440757[_0x7cb3('0x20')]=qs[_0x7cb3('0x20')](_0x430080[_0x7cb3('0x30')]['limit']);_0x440757[_0x7cb3('0x1f')]=qs[_0x7cb3('0x1f')](_0x430080[_0x7cb3('0x30')][_0x7cb3('0x1f')]);}_0x440757[_0x7cb3('0x39')]=qs[_0x7cb3('0x3a')](_0x430080[_0x7cb3('0x30')][_0x7cb3('0x3a')]);_0x440757['where']=qs[_0x7cb3('0x32')](_[_0x7cb3('0x3b')](_0x430080[_0x7cb3('0x30')],_0x5cb998[_0x7cb3('0x32')]),_0x5e4f03);if(_0x430080['query'][_0x7cb3('0x3c')]){_0x440757[_0x7cb3('0x3d')]=_[_0x7cb3('0x3e')](_0x440757['where'],{'$or':_[_0x7cb3('0x2a')](_0x5e4f03,function(_0x5bcb28){if(_0x5bcb28[_0x7cb3('0x2d')]!=='VIRTUAL'){var _0x523141={};_0x523141[_0x5bcb28['name']]={'$like':'%'+_0x430080[_0x7cb3('0x30')]['filter']+'%'};return _0x523141;}})});}_0x440757=_[_0x7cb3('0x3e')]({},_0x440757,_0x430080[_0x7cb3('0x3f')]);var _0x677272={'where':_0x440757['where']};return db['Migration'][_0x7cb3('0x1e')](_0x677272)[_0x7cb3('0x40')](function(_0x171732){_0x6f66cd[_0x7cb3('0x1e')]=_0x171732;if(_0x430080[_0x7cb3('0x30')]['includeAll']){_0x440757[_0x7cb3('0x41')]=[{'all':!![]}];}return db[_0x7cb3('0x2b')]['findAll'](_0x440757);})['then'](function(_0x472198){_0x6f66cd[_0x7cb3('0x42')]=_0x472198;return _0x6f66cd;})[_0x7cb3('0x40')](respondWithFilteredResult(_0xf07ac9,_0x440757))[_0x7cb3('0x43')](handleError(_0xf07ac9,null));}; \ No newline at end of file +var _0x929b=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','map','Migration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x1f73e3,_0x39c009){var _0xfc6bfe=function(_0x3a8bbd){while(--_0x3a8bbd){_0x1f73e3['push'](_0x1f73e3['shift']());}};_0xfc6bfe(++_0x39c009);}(_0x929b,0x1e8));var _0xb929=function(_0x233eab,_0x5c910f){_0x233eab=_0x233eab-0x0;var _0x288cc3=_0x929b[_0x233eab];return _0x288cc3;};'use strict';var pdf=require(_0xb929('0x0'));var emlformat=require(_0xb929('0x1'));var rimraf=require(_0xb929('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb929('0x3'));var rp=require(_0xb929('0x4'));var moment=require(_0xb929('0x5'));var BPromise=require(_0xb929('0x6'));var Mustache=require(_0xb929('0x7'));var util=require('util');var path=require(_0xb929('0x8'));var sox=require(_0xb929('0x9'));var csv=require(_0xb929('0xa'));var ejs=require(_0xb929('0xb'));var fs=require('fs');var _=require(_0xb929('0xc'));var squel=require(_0xb929('0xd'));var crypto=require(_0xb929('0xe'));var jsforce=require(_0xb929('0xf'));var deskjs=require(_0xb929('0x10'));var toCsv=require(_0xb929('0xa'));var querystring=require(_0xb929('0x11'));var Papa=require(_0xb929('0x12'));var Redis=require('ioredis');var authService=require(_0xb929('0x13'));var qs=require(_0xb929('0x14'));var as=require(_0xb929('0x15'));var hardwareService=require(_0xb929('0x16'));var logger=require(_0xb929('0x17'))(_0xb929('0x18'));var utils=require(_0xb929('0x19'));var config=require(_0xb929('0x1a'));var licenseUtil=require(_0xb929('0x1b'));var db=require(_0xb929('0x1c'))['db'];function respondWithStatusCode(_0x41929f,_0x2ac9d5){_0x2ac9d5=_0x2ac9d5||0xcc;return function(_0x253891){if(_0x253891){return _0x41929f[_0xb929('0x1d')](_0x2ac9d5);}return _0x41929f[_0xb929('0x1e')](_0x2ac9d5)[_0xb929('0x1f')]();};}function respondWithResult(_0x50860a,_0x25a40c){_0x25a40c=_0x25a40c||0xc8;return function(_0x1af7be){if(_0x1af7be){return _0x50860a[_0xb929('0x1e')](_0x25a40c)[_0xb929('0x20')](_0x1af7be);}};}function respondWithFilteredResult(_0x89e6af,_0x17bb08){return function(_0x5f5556){if(_0x5f5556){var _0x2fa437=_0x5f5556['count'],_0x938049=_0x17bb08[_0xb929('0x21')],_0x4909bf=_0x17bb08[_0xb929('0x21')]+_0x17bb08[_0xb929('0x22')],_0x54381c;if(_0x4909bf>=_0x2fa437){_0x4909bf=_0x2fa437;_0x54381c=0xc8;}else{_0x54381c=0xce;}_0x89e6af[_0xb929('0x1e')](_0x54381c);return _0x89e6af[_0xb929('0x23')](_0xb929('0x24'),_0x938049+'-'+_0x4909bf+'/'+_0x2fa437)[_0xb929('0x20')](_0x5f5556);}return null;};}function patchUpdates(_0x4cb6fc){return function(_0x229382){try{jsonpatch['apply'](_0x229382,_0x4cb6fc,!![]);}catch(_0x443c58){return BPromise[_0xb929('0x25')](_0x443c58);}return _0x229382[_0xb929('0x26')]();};}function saveUpdates(_0x26cf50,_0x1e37e3){return function(_0x2d36ac){if(_0x2d36ac){return _0x2d36ac[_0xb929('0x27')](_0x26cf50)[_0xb929('0x28')](function(_0x38d831){return _0x38d831;});}return null;};}function removeEntity(_0x2f1ba1,_0x5c9544){return function(_0x594976){if(_0x594976){return _0x594976[_0xb929('0x29')]()[_0xb929('0x28')](function(){_0x2f1ba1[_0xb929('0x1e')](0xcc)[_0xb929('0x1f')]();});}};}function handleEntityNotFound(_0x2d987d,_0x7d8e62){return function(_0x5edd7a){if(!_0x5edd7a){_0x2d987d[_0xb929('0x1d')](0x194);}return _0x5edd7a;};}function handleError(_0x1dc4f2,_0x23824f){_0x23824f=_0x23824f||0x1f4;return function(_0x272226){logger[_0xb929('0x2a')](_0x272226['stack']);if(_0x272226[_0xb929('0x2b')]){delete _0x272226[_0xb929('0x2b')];}_0x1dc4f2[_0xb929('0x1e')](_0x23824f)[_0xb929('0x2c')](_0x272226);};}exports['index']=function(_0x216333,_0x4917f1){var _0x4a5123={},_0x3a3f02={},_0x53c480={'count':0x0,'rows':[]};var _0x30086b=_[_0xb929('0x2d')](db[_0xb929('0x2e')][_0xb929('0x2f')],function(_0x5a8036){return{'name':_0x5a8036[_0xb929('0x30')],'type':_0x5a8036[_0xb929('0x31')]['key']};});_0x3a3f02[_0xb929('0x32')]=_[_0xb929('0x2d')](_0x30086b,_0xb929('0x2b'));_0x3a3f02[_0xb929('0x33')]=_[_0xb929('0x34')](_0x216333[_0xb929('0x33')]);_0x3a3f02[_0xb929('0x35')]=_[_0xb929('0x36')](_0x3a3f02[_0xb929('0x32')],_0x3a3f02[_0xb929('0x33')]);_0x4a5123[_0xb929('0x37')]=_[_0xb929('0x36')](_0x3a3f02['model'],qs[_0xb929('0x38')](_0x216333[_0xb929('0x33')][_0xb929('0x38')]));_0x4a5123[_0xb929('0x37')]=_0x4a5123[_0xb929('0x37')]['length']?_0x4a5123[_0xb929('0x37')]:_0x3a3f02[_0xb929('0x32')];if(!_0x216333['query'][_0xb929('0x39')](_0xb929('0x3a'))){_0x4a5123[_0xb929('0x22')]=qs[_0xb929('0x22')](_0x216333['query'][_0xb929('0x22')]);_0x4a5123[_0xb929('0x21')]=qs['offset'](_0x216333['query']['offset']);}_0x4a5123[_0xb929('0x3b')]=qs[_0xb929('0x3c')](_0x216333[_0xb929('0x33')][_0xb929('0x3c')]);_0x4a5123[_0xb929('0x3d')]=qs[_0xb929('0x35')](_[_0xb929('0x3e')](_0x216333['query'],_0x3a3f02[_0xb929('0x35')]),_0x30086b);if(_0x216333[_0xb929('0x33')][_0xb929('0x3f')]){_0x4a5123[_0xb929('0x3d')]=_[_0xb929('0x40')](_0x4a5123['where'],{'$or':_['map'](_0x30086b,function(_0x24e624){if(_0x24e624[_0xb929('0x31')]!=='VIRTUAL'){var _0x3fd937={};_0x3fd937[_0x24e624[_0xb929('0x2b')]]={'$like':'%'+_0x216333['query'][_0xb929('0x3f')]+'%'};return _0x3fd937;}})});}_0x4a5123=_[_0xb929('0x40')]({},_0x4a5123,_0x216333[_0xb929('0x41')]);var _0x3d3b14={'where':_0x4a5123[_0xb929('0x3d')]};return db['Migration']['count'](_0x3d3b14)[_0xb929('0x28')](function(_0x50a135){_0x53c480[_0xb929('0x42')]=_0x50a135;if(_0x216333[_0xb929('0x33')][_0xb929('0x43')]){_0x4a5123[_0xb929('0x44')]=[{'all':!![]}];}return db[_0xb929('0x2e')][_0xb929('0x45')](_0x4a5123);})[_0xb929('0x28')](function(_0x79a7ed){_0x53c480[_0xb929('0x46')]=_0x79a7ed;return _0x53c480;})[_0xb929('0x28')](respondWithFilteredResult(_0x4917f1,_0x4a5123))[_0xb929('0x47')](handleError(_0x4917f1,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index c77e755..ba63ff8 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 _0xd115=['rimraf','./migration.attributes','define','Migration','migrations','util','api','moment','bluebird','request-promise'];(function(_0x4bedf5,_0x243cfa){var _0x49a217=function(_0x5b476e){while(--_0x5b476e){_0x4bedf5['push'](_0x4bedf5['shift']());}};_0x49a217(++_0x243cfa);}(_0xd115,0x195));var _0x5d11=function(_0x3db4fe,_0x22d896){_0x3db4fe=_0x3db4fe-0x0;var _0xe9a02a=_0xd115[_0x3db4fe];return _0xe9a02a;};'use strict';var _=require('lodash');var util=require(_0x5d11('0x0'));var logger=require('../../config/logger')(_0x5d11('0x1'));var moment=require(_0x5d11('0x2'));var BPromise=require(_0x5d11('0x3'));var rp=require(_0x5d11('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d11('0x5'));var config=require('../../config/environment');var attributes=require(_0x5d11('0x6'));module['exports']=function(_0x35a779,_0x128e9f){return _0x35a779[_0x5d11('0x7')](_0x5d11('0x8'),attributes,{'tableName':_0x5d11('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee09=['exports','define','migrations','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./migration.attributes'];(function(_0x205ed2,_0x248ed0){var _0x540c3b=function(_0x9a7918){while(--_0x9a7918){_0x205ed2['push'](_0x205ed2['shift']());}};_0x540c3b(++_0x248ed0);}(_0xee09,0xb3));var _0x9ee0=function(_0x5a4671,_0xc670a2){_0x5a4671=_0x5a4671-0x0;var _0x3cd6f9=_0xee09[_0x5a4671];return _0x3cd6f9;};'use strict';var _=require(_0x9ee0('0x0'));var util=require('util');var logger=require(_0x9ee0('0x1'))(_0x9ee0('0x2'));var moment=require(_0x9ee0('0x3'));var BPromise=require(_0x9ee0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ee0('0x5'));var rimraf=require(_0x9ee0('0x6'));var config=require('../../config/environment');var attributes=require(_0x9ee0('0x7'));module[_0x9ee0('0x8')]=function(_0x39163f,_0x4fe166){return _0x39163f[_0x9ee0('0x9')]('Migration',attributes,{'tableName':_0x9ee0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index da3b4b1..8b6cbc9 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 _0xe667=['code','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x78c980,_0x23d1ae){var _0x6e7886=function(_0x1c9a66){while(--_0x1c9a66){_0x78c980['push'](_0x78c980['shift']());}};_0x6e7886(++_0x23d1ae);}(_0xe667,0x17c));var _0x7e66=function(_0x2c9dec,_0x2ce619){_0x2c9dec=_0x2c9dec-0x0;var _0x373f0a=_0xe667[_0x2c9dec];return _0x373f0a;};'use strict';var _=require('lodash');var util=require(_0x7e66('0x0'));var moment=require(_0x7e66('0x1'));var BPromise=require(_0x7e66('0x2'));var rs=require(_0x7e66('0x3'));var fs=require('fs');var Redis=require(_0x7e66('0x4'));var db=require(_0x7e66('0x5'))['db'];var utils=require(_0x7e66('0x6'));var logger=require(_0x7e66('0x7'))(_0x7e66('0x8'));var config=require(_0x7e66('0x9'));var jayson=require(_0x7e66('0xa'));var client=jayson[_0x7e66('0xb')][_0x7e66('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3ba29a,_0x39e3e4,_0x23417f){return new BPromise(function(_0x19e707,_0x51b4b3){return client[_0x7e66('0xd')](_0x3ba29a,_0x23417f)[_0x7e66('0xe')](function(_0x3fa242){logger[_0x7e66('0xf')](_0x7e66('0x10'),_0x39e3e4,'request\x20sent');logger[_0x7e66('0x11')](_0x7e66('0x12'),_0x39e3e4,_0x7e66('0x13'),JSON['stringify'](_0x3fa242));if(_0x3fa242['error']){if(_0x3fa242['error'][_0x7e66('0x14')]===0x1f4){logger[_0x7e66('0x15')]('Migration,\x20%s,\x20%s',_0x39e3e4,_0x3fa242['error'][_0x7e66('0x16')]);return _0x51b4b3(_0x3fa242[_0x7e66('0x15')][_0x7e66('0x16')]);}logger['error'](_0x7e66('0x10'),_0x39e3e4,_0x3fa242[_0x7e66('0x15')][_0x7e66('0x16')]);return _0x19e707(_0x3fa242[_0x7e66('0x15')]['message']);}else{logger[_0x7e66('0xf')]('Migration,\x20%s,\x20%s',_0x39e3e4,_0x7e66('0x13'));_0x19e707(_0x3fa242[_0x7e66('0x17')][_0x7e66('0x16')]);}})[_0x7e66('0x18')](function(_0x5bd2cd){logger[_0x7e66('0x15')](_0x7e66('0x10'),_0x39e3e4,_0x5bd2cd);_0x51b4b3(_0x5bd2cd);});});} \ No newline at end of file +var _0x8f4c=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x12ed67,_0x1a5083){var _0x197263=function(_0x2cf3d5){while(--_0x2cf3d5){_0x12ed67['push'](_0x12ed67['shift']());}};_0x197263(++_0x1a5083);}(_0x8f4c,0x113));var _0xc8f4=function(_0x20cab1,_0x4f7269){_0x20cab1=_0x20cab1-0x0;var _0x3296b9=_0x8f4c[_0x20cab1];return _0x3296b9;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 7f607d0..fdd09d9 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 _0x6ce6=['show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index'];(function(_0x438685,_0x4ec0c0){var _0x41cca2=function(_0x532003){while(--_0x532003){_0x438685['push'](_0x438685['shift']());}};_0x41cca2(++_0x4ec0c0);}(_0x6ce6,0x72));var _0x66ce=function(_0x422b4b,_0x3009d4){_0x422b4b=_0x422b4b-0x0;var _0x5ee08a=_0x6ce6[_0x422b4b];return _0x5ee08a;};'use strict';var multer=require('multer');var util=require(_0x66ce('0x0'));var path=require(_0x66ce('0x1'));var timeout=require(_0x66ce('0x2'));var express=require(_0x66ce('0x3'));var router=express[_0x66ce('0x4')]();var auth=require(_0x66ce('0x5'));var interaction=require(_0x66ce('0x6'));var config=require(_0x66ce('0x7'));var controller=require(_0x66ce('0x8'));router[_0x66ce('0x9')]('/',auth[_0x66ce('0xa')](),controller[_0x66ce('0xb')]);router[_0x66ce('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x66ce('0xc')]);router[_0x66ce('0xd')]('/',auth[_0x66ce('0xa')](),controller[_0x66ce('0xe')]);router[_0x66ce('0xf')](_0x66ce('0x10'),auth['isAuthenticated'](),controller[_0x66ce('0x11')]);router[_0x66ce('0x12')]('/:id',auth[_0x66ce('0xa')](),controller[_0x66ce('0x13')]);module[_0x66ce('0x14')]=router; \ No newline at end of file +var _0xf935=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports','multer','util'];(function(_0x3be4a1,_0xbaed7b){var _0x5647f7=function(_0x5c995d){while(--_0x5c995d){_0x3be4a1['push'](_0x3be4a1['shift']());}};_0x5647f7(++_0xbaed7b);}(_0xf935,0xbc));var _0x5f93=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf935[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x5f93('0x0'));var util=require(_0x5f93('0x1'));var path=require(_0x5f93('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5f93('0x3')]();var auth=require(_0x5f93('0x4'));var interaction=require(_0x5f93('0x5'));var config=require(_0x5f93('0x6'));var controller=require(_0x5f93('0x7'));router[_0x5f93('0x8')]('/',auth[_0x5f93('0x9')](),controller[_0x5f93('0xa')]);router[_0x5f93('0x8')]('/:id',auth[_0x5f93('0x9')](),controller[_0x5f93('0xb')]);router[_0x5f93('0xc')]('/',auth[_0x5f93('0x9')](),controller[_0x5f93('0xd')]);router[_0x5f93('0xe')](_0x5f93('0xf'),auth[_0x5f93('0x9')](),controller[_0x5f93('0x10')]);router['delete'](_0x5f93('0xf'),auth[_0x5f93('0x9')](),controller[_0x5f93('0x11')]);module[_0x5f93('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index e775523..707b853 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(_0xa80716,_0x18bb7d){var _0x2e41e4=function(_0xb8f9d0){while(--_0xb8f9d0){_0xa80716['push'](_0xa80716['shift']());}};_0x2e41e4(++_0x18bb7d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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(_0x4ae4ee,_0x4d98fb){var _0x421654=function(_0x30706a){while(--_0x30706a){_0x4ae4ee['push'](_0x4ae4ee['shift']());}};_0x421654(++_0x4d98fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 247fda8..f096396 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 _0xa9e0=['Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','Network','count','includeAll','include','findAll','rows','params','filtears','intersection','find','sequelize','transaction','create','body','STUN','join','server/files/templates/stun_multiple.ejs','Reload','res_stun_monitor.so','toUpperCase','TURN','readFileSync','root','utf8','render','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','/etc/asterisk/stun_xcally.conf','server/files/templates/turn_multiple.ejs','format','chan_sip.so','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','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','Network,\x20%s,\x20%s','debug'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('Network,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['Network'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':!![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x4f')]=_[_0x0a9e('0x50')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x50')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x51')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173,_0x14d602){var _0x5bb3ed;return db[_0x0a9e('0x52')][_0x0a9e('0x53')](function(_0x53d113){return db['Network'][_0x0a9e('0x54')](_0x39d77d['body'],{'raw':!![]})[_0x0a9e('0x2f')](function(_0x4c3845){_0x5bb3ed=_0x4c3845;return db[_0x0a9e('0x48')][_0x0a9e('0x4c')]({'where':{'type':_0x39d77d[_0x0a9e('0x55')]['type']},'raw':!![]});})[_0x0a9e('0x2f')](function(_0x1bf38a){if(_0x5bb3ed['type']['toUpperCase']()==_0x0a9e('0x56')){var _0x3aedd0=fs['readFileSync'](path[_0x0a9e('0x57')](config['root'],_0x0a9e('0x58')),'utf8');var _0xe22ccc=ejs['render'](_0x3aedd0,{'networks':_0x1bf38a||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0xe22ccc);return respondWithRpcPromise(_0x0a9e('0x59'),'create',{'module':_0x0a9e('0x5a')});}else if(_0x5bb3ed[_0x0a9e('0x38')][_0x0a9e('0x5b')]()==_0x0a9e('0x5c')){var _0x232830=fs[_0x0a9e('0x5d')](path[_0x0a9e('0x57')](config[_0x0a9e('0x5e')],'server/files/templates/turn_multiple.ejs'),_0x0a9e('0x5f'));var _0x121cef=ejs[_0x0a9e('0x60')](_0x232830,{'networks':_0x1bf38a||[]});fs[_0x0a9e('0x61')](_0x0a9e('0x62'),_0x121cef);return respondWithRpcPromise(_0x0a9e('0x59'),'create',{'module':_0x0a9e('0x5a')});}else{var _0x26bc80=fs['readFileSync'](path[_0x0a9e('0x57')](config['root'],_0x0a9e('0x63')),'utf8');var _0x4b3c1a=ejs['render'](_0x26bc80,{'networks':_0x1bf38a||[]});fs[_0x0a9e('0x61')](util['format'](_0x0a9e('0x64'),_0x39d77d[_0x0a9e('0x55')][_0x0a9e('0x38')][_0x0a9e('0x65')]()),_0x4b3c1a);return respondWithRpcPromise(_0x0a9e('0x59'),_0x0a9e('0x54'),{'module':'chan_sip.so'});}return null;})[_0x0a9e('0x2f')](function(){return _0x5bb3ed;});})['then'](respondWithResult(_0x204173,0xc9))[_0x0a9e('0x22')](handleError(_0x204173,null));};exports[_0x0a9e('0x2e')]=function(_0x51aaf7,_0x5adf8f,_0x453360){var _0x156f1c;return db[_0x0a9e('0x52')][_0x0a9e('0x53')](function(_0x497d91){return db[_0x0a9e('0x48')][_0x0a9e('0x51')]({'where':{'id':_0x51aaf7['params']['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x5adf8f,null))[_0x0a9e('0x2f')](saveUpdates(_0x51aaf7[_0x0a9e('0x55')],null))[_0x0a9e('0x2f')](function(_0x401837){if(_0x401837){_0x156f1c=_0x401837;return db['Network'][_0x0a9e('0x4c')]({'where':{'type':_0x156f1c[_0x0a9e('0x38')]},'raw':!![]});}return null;})[_0x0a9e('0x2f')](function(_0x47bb43){if(_0x156f1c[_0x0a9e('0x38')]['toUpperCase']()=='STUN'){var _0x242745=fs[_0x0a9e('0x5d')](path[_0x0a9e('0x57')](config[_0x0a9e('0x5e')],_0x0a9e('0x58')),_0x0a9e('0x5f'));var _0x387489=ejs[_0x0a9e('0x60')](_0x242745,{'networks':_0x47bb43||[]});fs[_0x0a9e('0x61')](_0x0a9e('0x66'),_0x387489);return respondWithRpcPromise(_0x0a9e('0x59'),_0x0a9e('0x2e'),{'module':_0x0a9e('0x5a')});}else if(_0x156f1c[_0x0a9e('0x38')][_0x0a9e('0x5b')]()==_0x0a9e('0x5c')){var _0x2a28c0=fs[_0x0a9e('0x5d')](path['join'](config[_0x0a9e('0x5e')],_0x0a9e('0x67')),_0x0a9e('0x5f'));var _0x4edbb0=ejs[_0x0a9e('0x60')](_0x2a28c0,{'networks':_0x47bb43||[]});fs[_0x0a9e('0x61')]('/etc/asterisk/turn_xcally.conf',_0x4edbb0);return respondWithRpcPromise(_0x0a9e('0x59'),_0x0a9e('0x2e'),{'module':_0x0a9e('0x5a')});}else{var _0x427946=fs[_0x0a9e('0x5d')](path['join'](config['root'],'server/files/templates/network.ejs'),_0x0a9e('0x5f'));var _0x18bf5d=ejs[_0x0a9e('0x60')](_0x427946,{'networks':_0x47bb43||[]});fs[_0x0a9e('0x61')](util[_0x0a9e('0x68')](_0x0a9e('0x64'),_0x51aaf7[_0x0a9e('0x55')][_0x0a9e('0x38')]['toLowerCase']()),_0x18bf5d);return respondWithRpcPromise(_0x0a9e('0x59'),_0x0a9e('0x2e'),{'module':_0x0a9e('0x69')});}return null;})['then'](function(_0x2bdc44){if(_0x2bdc44){return _0x156f1c;}return null;});})['then'](respondWithResult(_0x5adf8f,null))[_0x0a9e('0x22')](handleError(_0x5adf8f,null));};exports[_0x0a9e('0x30')]=function(_0x4c46c1,_0x2ed01e,_0x75912a){var _0x2cc7a7;return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x4c46c1[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](function(_0x371533){_0x2cc7a7=_0x371533;return _0x371533;})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2ed01e,null))['then'](removeEntity(_0x2ed01e,null))[_0x0a9e('0x2f')](function(){if(_0x2cc7a7){return db[_0x0a9e('0x48')][_0x0a9e('0x4c')]({'where':{'type':_0x2cc7a7[_0x0a9e('0x38')]},'raw':!![]});}})['then'](function(_0x290d43){if(_0x2cc7a7[_0x0a9e('0x38')][_0x0a9e('0x5b')]()==_0x0a9e('0x56')){var _0x332367=fs[_0x0a9e('0x5d')](path[_0x0a9e('0x57')](config[_0x0a9e('0x5e')],_0x0a9e('0x58')),_0x0a9e('0x5f'));var _0xc4c230=ejs[_0x0a9e('0x60')](_0x332367,{'networks':_0x290d43||[]});fs[_0x0a9e('0x61')](_0x0a9e('0x66'),_0xc4c230);return respondWithRpcPromise('Reload',_0x0a9e('0x30'),{'module':_0x0a9e('0x5a')});}else if(_0x2cc7a7[_0x0a9e('0x38')]['toUpperCase']()==_0x0a9e('0x5c')){var _0x33dda0=fs[_0x0a9e('0x5d')](path[_0x0a9e('0x57')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x0a9e('0x5f'));var _0x2bbdb5=ejs['render'](_0x33dda0,{'networks':_0x290d43||[]});fs[_0x0a9e('0x61')]('/etc/asterisk/turn_xcally.conf',_0x2bbdb5);return respondWithRpcPromise(_0x0a9e('0x59'),_0x0a9e('0x30'),{'module':'res_stun_monitor.so'});}else{var _0x28a942=fs[_0x0a9e('0x5d')](path[_0x0a9e('0x57')](config[_0x0a9e('0x5e')],_0x0a9e('0x63')),_0x0a9e('0x5f'));var _0x444f1f=ejs['render'](_0x28a942,{'networks':_0x290d43||[]});fs[_0x0a9e('0x61')](util[_0x0a9e('0x68')](_0x0a9e('0x64'),_0x4c46c1[_0x0a9e('0x55')]['type'][_0x0a9e('0x65')]()),_0x444f1f);return respondWithRpcPromise(_0x0a9e('0x59'),'destroy',{'module':_0x0a9e('0x69')});}return null;})['catch'](handleError(_0x2ed01e,null));}; \ No newline at end of file +var _0xa9e0=['Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','Network','count','includeAll','include','findAll','rows','params','filtears','intersection','find','sequelize','transaction','create','body','STUN','join','server/files/templates/stun_multiple.ejs','Reload','res_stun_monitor.so','toUpperCase','TURN','readFileSync','root','utf8','render','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','/etc/asterisk/stun_xcally.conf','server/files/templates/turn_multiple.ejs','format','chan_sip.so','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','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','Network,\x20%s,\x20%s','debug'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('Network,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['Network'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':!![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x4f')]=_[_0x0a9e('0x50')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x50')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x51')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173,_0x14d602){var _0x5bb3ed;return db[_0x0a9e('0x52')][_0x0a9e('0x53')](function(_0x53d113){return db['Network'][_0x0a9e('0x54')](_0x39d77d['body'],{'raw':!![]})[_0x0a9e('0x2f')](function(_0x4c3845){_0x5bb3ed=_0x4c3845;return db[_0x0a9e('0x48')][_0x0a9e('0x4c')]({'where':{'type':_0x39d77d[_0x0a9e('0x55')]['type']},'raw':!![]});})[_0x0a9e('0x2f')](function(_0x1bf38a){if(_0x5bb3ed['type']['toUpperCase']()==_0x0a9e('0x56')){var _0x3aedd0=fs['readFileSync'](path[_0x0a9e('0x57')](config['root'],_0x0a9e('0x58')),'utf8');var _0xe22ccc=ejs['render'](_0x3aedd0,{'networks':_0x1bf38a||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0xe22ccc);return respondWithRpcPromise(_0x0a9e('0x59'),'create',{'module':_0x0a9e('0x5a')});}else if(_0x5bb3ed[_0x0a9e('0x38')][_0x0a9e('0x5b')]()==_0x0a9e('0x5c')){var _0x232830=fs[_0x0a9e('0x5d')](path[_0x0a9e('0x57')](config[_0x0a9e('0x5e')],'server/files/templates/turn_multiple.ejs'),_0x0a9e('0x5f'));var _0x121cef=ejs[_0x0a9e('0x60')](_0x232830,{'networks':_0x1bf38a||[]});fs[_0x0a9e('0x61')](_0x0a9e('0x62'),_0x121cef);return respondWithRpcPromise(_0x0a9e('0x59'),'create',{'module':_0x0a9e('0x5a')});}else{var _0x26bc80=fs['readFileSync'](path[_0x0a9e('0x57')](config['root'],_0x0a9e('0x63')),'utf8');var _0x4b3c1a=ejs['render'](_0x26bc80,{'networks':_0x1bf38a||[]});fs[_0x0a9e('0x61')](util['format'](_0x0a9e('0x64'),_0x39d77d[_0x0a9e('0x55')][_0x0a9e('0x38')][_0x0a9e('0x65')]()),_0x4b3c1a);return respondWithRpcPromise(_0x0a9e('0x59'),_0x0a9e('0x54'),{'module':'chan_sip.so'});}return null;})[_0x0a9e('0x2f')](function(){return _0x5bb3ed;});})['then'](respondWithResult(_0x204173,0xc9))[_0x0a9e('0x22')](handleError(_0x204173,null));};exports[_0x0a9e('0x2e')]=function(_0x51aaf7,_0x5adf8f,_0x453360){var _0x156f1c;return db[_0x0a9e('0x52')][_0x0a9e('0x53')](function(_0x497d91){return db[_0x0a9e('0x48')][_0x0a9e('0x51')]({'where':{'id':_0x51aaf7['params']['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x5adf8f,null))[_0x0a9e('0x2f')](saveUpdates(_0x51aaf7[_0x0a9e('0x55')],null))[_0x0a9e('0x2f')](function(_0x401837){if(_0x401837){_0x156f1c=_0x401837;return db['Network'][_0x0a9e('0x4c')]({'where':{'type':_0x156f1c[_0x0a9e('0x38')]},'raw':!![]});}return null;})[_0x0a9e('0x2f')](function(_0x47bb43){if(_0x156f1c[_0x0a9e('0x38')]['toUpperCase']()=='STUN'){var _0x242745=fs[_0x0a9e('0x5d')](path[_0x0a9e('0x57')](config[_0x0a9e('0x5e')],_0x0a9e('0x58')),_0x0a9e('0x5f'));var _0x387489=ejs[_0x0a9e('0x60')](_0x242745,{'networks':_0x47bb43||[]});fs[_0x0a9e('0x61')](_0x0a9e('0x66'),_0x387489);return respondWithRpcPromise(_0x0a9e('0x59'),_0x0a9e('0x2e'),{'module':_0x0a9e('0x5a')});}else if(_0x156f1c[_0x0a9e('0x38')][_0x0a9e('0x5b')]()==_0x0a9e('0x5c')){var _0x2a28c0=fs[_0x0a9e('0x5d')](path['join'](config[_0x0a9e('0x5e')],_0x0a9e('0x67')),_0x0a9e('0x5f'));var _0x4edbb0=ejs[_0x0a9e('0x60')](_0x2a28c0,{'networks':_0x47bb43||[]});fs[_0x0a9e('0x61')]('/etc/asterisk/turn_xcally.conf',_0x4edbb0);return respondWithRpcPromise(_0x0a9e('0x59'),_0x0a9e('0x2e'),{'module':_0x0a9e('0x5a')});}else{var _0x427946=fs[_0x0a9e('0x5d')](path['join'](config['root'],'server/files/templates/network.ejs'),_0x0a9e('0x5f'));var _0x18bf5d=ejs[_0x0a9e('0x60')](_0x427946,{'networks':_0x47bb43||[]});fs[_0x0a9e('0x61')](util[_0x0a9e('0x68')](_0x0a9e('0x64'),_0x51aaf7[_0x0a9e('0x55')][_0x0a9e('0x38')]['toLowerCase']()),_0x18bf5d);return respondWithRpcPromise(_0x0a9e('0x59'),_0x0a9e('0x2e'),{'module':_0x0a9e('0x69')});}return null;})['then'](function(_0x2bdc44){if(_0x2bdc44){return _0x156f1c;}return null;});})['then'](respondWithResult(_0x5adf8f,null))[_0x0a9e('0x22')](handleError(_0x5adf8f,null));};exports[_0x0a9e('0x30')]=function(_0x4c46c1,_0x2ed01e,_0x75912a){var _0x2cc7a7;return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x4c46c1[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](function(_0x371533){_0x2cc7a7=_0x371533;return _0x371533;})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2ed01e,null))['then'](removeEntity(_0x2ed01e,null))[_0x0a9e('0x2f')](function(){if(_0x2cc7a7){return db[_0x0a9e('0x48')][_0x0a9e('0x4c')]({'where':{'type':_0x2cc7a7[_0x0a9e('0x38')]},'raw':!![]});}})['then'](function(_0x290d43){if(_0x2cc7a7[_0x0a9e('0x38')][_0x0a9e('0x5b')]()==_0x0a9e('0x56')){var _0x332367=fs[_0x0a9e('0x5d')](path[_0x0a9e('0x57')](config[_0x0a9e('0x5e')],_0x0a9e('0x58')),_0x0a9e('0x5f'));var _0xc4c230=ejs[_0x0a9e('0x60')](_0x332367,{'networks':_0x290d43||[]});fs[_0x0a9e('0x61')](_0x0a9e('0x66'),_0xc4c230);return respondWithRpcPromise('Reload',_0x0a9e('0x30'),{'module':_0x0a9e('0x5a')});}else if(_0x2cc7a7[_0x0a9e('0x38')]['toUpperCase']()==_0x0a9e('0x5c')){var _0x33dda0=fs[_0x0a9e('0x5d')](path[_0x0a9e('0x57')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x0a9e('0x5f'));var _0x2bbdb5=ejs['render'](_0x33dda0,{'networks':_0x290d43||[]});fs[_0x0a9e('0x61')]('/etc/asterisk/turn_xcally.conf',_0x2bbdb5);return respondWithRpcPromise(_0x0a9e('0x59'),_0x0a9e('0x30'),{'module':'res_stun_monitor.so'});}else{var _0x28a942=fs[_0x0a9e('0x5d')](path[_0x0a9e('0x57')](config[_0x0a9e('0x5e')],_0x0a9e('0x63')),_0x0a9e('0x5f'));var _0x444f1f=ejs['render'](_0x28a942,{'networks':_0x290d43||[]});fs[_0x0a9e('0x61')](util[_0x0a9e('0x68')](_0x0a9e('0x64'),_0x4c46c1[_0x0a9e('0x55')]['type'][_0x0a9e('0x65')]()),_0x444f1f);return respondWithRpcPromise(_0x0a9e('0x59'),'destroy',{'module':_0x0a9e('0x69')});}return null;})['catch'](handleError(_0x2ed01e,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 95a5eb5..ee3b26a 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 _0x587e=['./network.attributes','exports','define','Network','network','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5ff505,_0x53e2bd){var _0x97e96=function(_0x34cf7b){while(--_0x34cf7b){_0x5ff505['push'](_0x5ff505['shift']());}};_0x97e96(++_0x53e2bd);}(_0x587e,0xef));var _0xe587=function(_0x17fd8b,_0x4f552d){_0x17fd8b=_0x17fd8b-0x0;var _0x183951=_0x587e[_0x17fd8b];return _0x183951;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe587('0x0'))(_0xe587('0x1'));var moment=require(_0xe587('0x2'));var BPromise=require(_0xe587('0x3'));var rp=require(_0xe587('0x4'));var fs=require('fs');var path=require(_0xe587('0x5'));var rimraf=require(_0xe587('0x6'));var config=require(_0xe587('0x7'));var attributes=require(_0xe587('0x8'));module[_0xe587('0x9')]=function(_0x20db7,_0x4ab036){return _0x20db7[_0xe587('0xa')](_0xe587('0xb'),attributes,{'tableName':_0xe587('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf7e=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Network','lodash','api'];(function(_0x27362c,_0x37a9ba){var _0x5e764c=function(_0x127053){while(--_0x127053){_0x27362c['push'](_0x27362c['shift']());}};_0x5e764c(++_0x37a9ba);}(_0xbf7e,0xf8));var _0xebf7=function(_0x437f93,_0x5eb17e){_0x437f93=_0x437f93-0x0;var _0x37349f=_0xbf7e[_0x437f93];return _0x37349f;};'use strict';var _=require(_0xebf7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xebf7('0x1'));var moment=require(_0xebf7('0x2'));var BPromise=require(_0xebf7('0x3'));var rp=require(_0xebf7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xebf7('0x5'));var config=require(_0xebf7('0x6'));var attributes=require('./network.attributes');module[_0xebf7('0x7')]=function(_0x2b9bb7,_0x438f7a){return _0x2b9bb7[_0xebf7('0x8')](_0xebf7('0x9'),attributes,{'tableName':'network','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 7e268c1..240bad9 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 _0x6702=['request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s'];(function(_0x1f64e1,_0x105e22){var _0x286848=function(_0xcb2c30){while(--_0xcb2c30){_0x1f64e1['push'](_0x1f64e1['shift']());}};_0x286848(++_0x105e22);}(_0x6702,0x85));var _0x2670=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x6702[_0x1203f];return _0x365f0a;};'use strict';var _=require('lodash');var util=require(_0x2670('0x0'));var moment=require(_0x2670('0x1'));var BPromise=require(_0x2670('0x2'));var rs=require(_0x2670('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2670('0x4'))['db'];var utils=require(_0x2670('0x5'));var logger=require(_0x2670('0x6'))('rpc');var config=require(_0x2670('0x7'));var jayson=require(_0x2670('0x8'));var client=jayson[_0x2670('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4584cb,_0x2fe2f3,_0x3ee339){return new BPromise(function(_0x3d73e8,_0x387ebe){return client[_0x2670('0xa')](_0x4584cb,_0x3ee339)[_0x2670('0xb')](function(_0x3fee80){logger[_0x2670('0xc')](_0x2670('0xd'),_0x2fe2f3,'request\x20sent');logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x2fe2f3,_0x2670('0xe'),JSON[_0x2670('0xf')](_0x3fee80));if(_0x3fee80[_0x2670('0x10')]){if(_0x3fee80[_0x2670('0x10')][_0x2670('0x11')]===0x1f4){logger[_0x2670('0x10')](_0x2670('0xd'),_0x2fe2f3,_0x3fee80[_0x2670('0x10')][_0x2670('0x12')]);return _0x387ebe(_0x3fee80['error']['message']);}logger[_0x2670('0x10')](_0x2670('0xd'),_0x2fe2f3,_0x3fee80[_0x2670('0x10')][_0x2670('0x12')]);return _0x3d73e8(_0x3fee80['error'][_0x2670('0x12')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x2fe2f3,_0x2670('0xe'));_0x3d73e8(_0x3fee80[_0x2670('0x13')][_0x2670('0x12')]);}})[_0x2670('0x14')](function(_0x1a45e9){logger[_0x2670('0x10')](_0x2670('0xd'),_0x2fe2f3,_0x1a45e9);_0x387ebe(_0x1a45e9);});});} \ No newline at end of file +var _0x1cc7=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x1cc7,0x1b9));var _0x71cc=function(_0x3fef8d,_0xc93a5){_0x3fef8d=_0x3fef8d-0x0;var _0x283487=_0x1cc7[_0x3fef8d];return _0x283487;};'use strict';var _=require(_0x71cc('0x0'));var util=require(_0x71cc('0x1'));var moment=require(_0x71cc('0x2'));var BPromise=require(_0x71cc('0x3'));var rs=require(_0x71cc('0x4'));var fs=require('fs');var Redis=require(_0x71cc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x71cc('0x6'));var logger=require(_0x71cc('0x7'))('rpc');var config=require(_0x71cc('0x8'));var jayson=require(_0x71cc('0x9'));var client=jayson[_0x71cc('0xa')][_0x71cc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2eee72,_0x516f84,_0x3c05b6){return new BPromise(function(_0x100678,_0x1b70de){return client[_0x71cc('0xc')](_0x2eee72,_0x3c05b6)['then'](function(_0x563086){logger[_0x71cc('0xd')](_0x71cc('0xe'),_0x516f84,_0x71cc('0xf'));logger[_0x71cc('0x10')](_0x71cc('0x11'),_0x516f84,_0x71cc('0xf'),JSON['stringify'](_0x563086));if(_0x563086[_0x71cc('0x12')]){if(_0x563086[_0x71cc('0x12')][_0x71cc('0x13')]===0x1f4){logger[_0x71cc('0x12')](_0x71cc('0xe'),_0x516f84,_0x563086[_0x71cc('0x12')][_0x71cc('0x14')]);return _0x1b70de(_0x563086['error'][_0x71cc('0x14')]);}logger[_0x71cc('0x12')](_0x71cc('0xe'),_0x516f84,_0x563086['error'][_0x71cc('0x14')]);return _0x100678(_0x563086[_0x71cc('0x12')]['message']);}else{logger[_0x71cc('0xd')](_0x71cc('0xe'),_0x516f84,'request\x20sent');_0x100678(_0x563086[_0x71cc('0x15')][_0x71cc('0x14')]);}})[_0x71cc('0x16')](function(_0x1988fe){logger[_0x71cc('0x12')](_0x71cc('0xe'),_0x516f84,_0x1988fe);_0x1b70de(_0x1988fe);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index b5d131c..f3fdc9f 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 _0xaaae=['isAuthenticated','sendNotification','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./notification.controller'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xaaae,0x71));var _0xeaaa=function(_0x57f38e,_0x5f197c){_0x57f38e=_0x57f38e-0x0;var _0x553259=_0xaaae[_0x57f38e];return _0x553259;};'use strict';var multer=require(_0xeaaa('0x0'));var util=require(_0xeaaa('0x1'));var path=require(_0xeaaa('0x2'));var timeout=require(_0xeaaa('0x3'));var express=require(_0xeaaa('0x4'));var router=express['Router']();var auth=require(_0xeaaa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xeaaa('0x6'));var controller=require(_0xeaaa('0x7'));router['post']('/',auth[_0xeaaa('0x8')](),controller[_0xeaaa('0x9')]);module[_0xeaaa('0xa')]=router; \ No newline at end of file +var _0x8bf4=['isAuthenticated','sendNotification','exports','util','path','connect-timeout','Router','post'];(function(_0x51a176,_0x2e3f64){var _0x2df5cc=function(_0x1f2dc1){while(--_0x1f2dc1){_0x51a176['push'](_0x51a176['shift']());}};_0x2df5cc(++_0x2e3f64);}(_0x8bf4,0x163));var _0x48bf=function(_0x561d9f,_0x447dea){_0x561d9f=_0x561d9f-0x0;var _0x4ecca0=_0x8bf4[_0x561d9f];return _0x4ecca0;};'use strict';var multer=require('multer');var util=require(_0x48bf('0x0'));var path=require(_0x48bf('0x1'));var timeout=require(_0x48bf('0x2'));var express=require('express');var router=express[_0x48bf('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./notification.controller');router[_0x48bf('0x4')]('/',auth[_0x48bf('0x5')](),controller[_0x48bf('0x6')]);module[_0x48bf('0x7')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index b595d70..60c79bd 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 _0x14d6=['BOOLEAN','sequelize','exports','TEXT'];(function(_0x488fa1,_0x3b9e8c){var _0x4f79c4=function(_0xb2d600){while(--_0xb2d600){_0x488fa1['push'](_0x488fa1['shift']());}};_0x4f79c4(++_0x3b9e8c);}(_0x14d6,0x18d));var _0x614d=function(_0x4f729a,_0x2e4488){_0x4f729a=_0x4f729a-0x0;var _0x3b7141=_0x14d6[_0x4f729a];return _0x3b7141;};'use strict';var Sequelize=require(_0x614d('0x0'));module[_0x614d('0x1')]={'body':{'type':Sequelize[_0x614d('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x614d('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x614d('0x3')]}}; \ No newline at end of file +var _0x9d63=['TEXT','STRING','BOOLEAN'];(function(_0x17c483,_0xc69535){var _0x112bdb=function(_0x19adb9){while(--_0x19adb9){_0x17c483['push'](_0x17c483['shift']());}};_0x112bdb(++_0xc69535);}(_0x9d63,0x1da));var _0x39d6=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0x9d63[_0x37a79c];return _0x561d89;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x39d6('0x0')]},'senderName':{'type':Sequelize[_0x39d6('0x1')]},'recipientsId':{'type':Sequelize[_0x39d6('0x0')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x39d6('0x2')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 7cdcd6c..14b9902 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 _0x65bd=['sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./notification.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','body','hasOwnProperty','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','ValidationError','parse','recipients','Invalid\x20\x27recipients\x27\x20object','mailqueue','smsqueue','whatsappqueue','team','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','sequelize','transaction','forEach','recipient','emit','notification:send','text','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','catch','startCase','model','ids','queue','replace','push','union','flatten','getAgents','map','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x1bc989,_0x4130ce){var _0x488ead=function(_0xf5c90c){while(--_0xf5c90c){_0x1bc989['push'](_0x1bc989['shift']());}};_0x488ead(++_0x4130ce);}(_0x65bd,0xb3));var _0xd65b=function(_0x2e676d,_0x12a15e){_0x2e676d=_0x2e676d-0x0;var _0x3a0efd=_0x65bd[_0x2e676d];return _0x3a0efd;};'use strict';var pdf=require(_0xd65b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd65b('0x1'));var jsonpatch=require(_0xd65b('0x2'));var rp=require(_0xd65b('0x3'));var moment=require('moment');var BPromise=require(_0xd65b('0x4'));var Mustache=require(_0xd65b('0x5'));var util=require(_0xd65b('0x6'));var path=require('path');var sox=require(_0xd65b('0x7'));var csv=require(_0xd65b('0x8'));var ejs=require(_0xd65b('0x9'));var fs=require('fs');var _=require(_0xd65b('0xa'));var squel=require(_0xd65b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd65b('0xc'));var toCsv=require(_0xd65b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd65b('0xd'));var authService=require(_0xd65b('0xe'));var qs=require(_0xd65b('0xf'));var as=require(_0xd65b('0x10'));var hardwareService=require(_0xd65b('0x11'));var logger=require(_0xd65b('0x12'))(_0xd65b('0x13'));var utils=require(_0xd65b('0x14'));var config=require(_0xd65b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd65b('0x16'))['db'];config[_0xd65b('0x17')]=_['defaults'](config[_0xd65b('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xd65b('0x18'))(new Redis(config[_0xd65b('0x17')]));require(_0xd65b('0x19'))[_0xd65b('0x1a')](socket);function respondWithStatusCode(_0x1991e3,_0x1c260b){_0x1c260b=_0x1c260b||0xcc;return function(_0x4a2018){if(_0x4a2018){return _0x1991e3[_0xd65b('0x1b')](_0x1c260b);}return _0x1991e3[_0xd65b('0x1c')](_0x1c260b)[_0xd65b('0x1d')]();};}function respondWithResult(_0x3a3f59,_0x580214){_0x580214=_0x580214||0xc8;return function(_0xba8d57){if(_0xba8d57){return _0x3a3f59[_0xd65b('0x1c')](_0x580214)[_0xd65b('0x1e')](_0xba8d57);}};}function respondWithFilteredResult(_0xf9bddd,_0x3ddfb1){return function(_0x29b1ce){if(_0x29b1ce){var _0x385953=_0x29b1ce[_0xd65b('0x1f')],_0x5249f8=_0x3ddfb1[_0xd65b('0x20')],_0x30ab4e=_0x3ddfb1['offset']+_0x3ddfb1['limit'],_0x166849;if(_0x30ab4e>=_0x385953){_0x30ab4e=_0x385953;_0x166849=0xc8;}else{_0x166849=0xce;}_0xf9bddd[_0xd65b('0x1c')](_0x166849);return _0xf9bddd[_0xd65b('0x21')](_0xd65b('0x22'),_0x5249f8+'-'+_0x30ab4e+'/'+_0x385953)['json'](_0x29b1ce);}return null;};}function patchUpdates(_0x113cd8){return function(_0x243be3){try{jsonpatch[_0xd65b('0x23')](_0x243be3,_0x113cd8,!![]);}catch(_0x203c04){return BPromise['reject'](_0x203c04);}return _0x243be3[_0xd65b('0x24')]();};}function saveUpdates(_0x42df14,_0x32ced6){return function(_0x55a2e3){if(_0x55a2e3){return _0x55a2e3[_0xd65b('0x25')](_0x42df14)[_0xd65b('0x26')](function(_0x520000){return _0x520000;});}return null;};}function removeEntity(_0x4eeb6f,_0x3a9d82){return function(_0x407899){if(_0x407899){return _0x407899[_0xd65b('0x27')]()[_0xd65b('0x26')](function(){_0x4eeb6f['status'](0xcc)[_0xd65b('0x1d')]();});}};}function handleEntityNotFound(_0xe0c243,_0x7b821c){return function(_0x2432f6){if(!_0x2432f6){_0xe0c243[_0xd65b('0x1b')](0x194);}return _0x2432f6;};}function handleError(_0x6e6266,_0x2f4dc0){_0x2f4dc0=_0x2f4dc0||0x1f4;return function(_0x2cb6d7){logger[_0xd65b('0x28')](_0x2cb6d7[_0xd65b('0x29')]);if(_0x2cb6d7[_0xd65b('0x2a')]){delete _0x2cb6d7['name'];}_0x6e6266[_0xd65b('0x1c')](_0x2f4dc0)[_0xd65b('0x2b')](_0x2cb6d7);};}exports['sendNotification']=function(_0xdec980,_0x18209,_0x114d95){if(!_0xdec980[_0xd65b('0x2c')][_0xd65b('0x2d')]('text')&&!_0xdec980['body'][_0xd65b('0x2d')](_0xd65b('0x2e'))){throw new db[(_0xd65b('0x2f'))]['ValidationError'](_0xd65b('0x30'));}else{if(_0xdec980[_0xd65b('0x2c')][_0xd65b('0x2d')](_0xd65b('0x2e'))&&!_0xdec980[_0xd65b('0x2c')][_0xd65b('0x2d')](_0xd65b('0x31'))){throw new db[(_0xd65b('0x2f'))]['ValidationError'](_0xd65b('0x32'));}if(!_0xdec980[_0xd65b('0x2c')][_0xd65b('0x2d')]('recipients')){throw new db[(_0xd65b('0x2f'))][(_0xd65b('0x33'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x3da8c3=JSON[_0xd65b('0x34')](_0xdec980['body'][_0xd65b('0x35')]);}catch(_0x4cd953){logger[_0xd65b('0x28')](_0x4cd953);throw new db['Sequelize'][(_0xd65b('0x33'))](_0xd65b('0x36'));}var _0x5be635=['chatqueue','faxqueue',_0xd65b('0x37'),'openchannelqueue',_0xd65b('0x38'),'voicequeue',_0xd65b('0x39'),_0xd65b('0x3a'),'user'];if(_['some'](_0x3da8c3,function(_0x14e672){return!_[_0xd65b('0x3b')](_0x5be635,_0x14e672['model'][_0xd65b('0x3c')]());})){throw new db[(_0xd65b('0x2f'))][(_0xd65b('0x33'))](_0xd65b('0x3d'));}}}var _0x247f92={};_0x247f92[_0xd65b('0x3e')]=_0xdec980[_0xd65b('0x2c')][_0xd65b('0x2d')](_0xd65b('0x3e'))?_0xdec980[_0xd65b('0x2c')][_0xd65b('0x3e')]:_0xdec980[_0xd65b('0x3f')][_0xd65b('0x40')];_0x247f92[_0xd65b('0x41')]=_[_0xd65b('0x42')](_0xdec980[_0xd65b('0x2c')][_0xd65b('0x41')])?null:_0xdec980[_0xd65b('0x2c')][_0xd65b('0x41')];_0x247f92[_0xd65b('0x43')]=_0xdec980[_0xd65b('0x2c')]['beep']||![];_0x247f92[_0xd65b('0x44')]=_0xdec980['user']['id'];return getContent(_0xdec980[_0xd65b('0x2c')])['then'](function(_0x1e2d9d){_0x247f92[_0xd65b('0x2c')]=_0x1e2d9d;return getRecipients(_0x3da8c3);})[_0xd65b('0x26')](function(_0x164c0e){_0x247f92[_0xd65b('0x45')]=_['sortBy'](_0x164c0e)[_0xd65b('0x46')](',');return db[_0xd65b('0x47')][_0xd65b('0x48')](function(_0x336a20){return db['Notification']['create'](_0x247f92,{'raw':!![],'transaction':_0x336a20})[_0xd65b('0x26')](function(_0x487e73){var _0x30e628={'sender':_0x247f92[_0xd65b('0x3e')],'description':_0x247f92[_0xd65b('0x41')],'content':_0x247f92['body'],'beep':_0x247f92[_0xd65b('0x43')]};_0x164c0e[_0xd65b('0x49')](function(_0x4a32ee){_0x30e628[_0xd65b('0x4a')]=_0x4a32ee;socket[_0xd65b('0x4b')](_0xd65b('0x4c'),_0x30e628);});return _0x487e73;});});})['then'](respondWithResult(_0x18209,0xc9))['catch'](handleError(_0x18209,null));};function getContent(_0x1436c9){return new BPromise(function(_0x300d57,_0x3101c8){if(_0x1436c9['text']){_0x300d57(_0x1436c9[_0xd65b('0x4d')]);return;}return db['Template'][_0xd65b('0x4e')]({'attributes':['html'],'where':{'id':_0x1436c9['TemplateId']},'raw':!![]})[_0xd65b('0x26')](function(_0x44f3c4){if(!_0x44f3c4)throw new db['Sequelize'][(_0xd65b('0x33'))](_0xd65b('0x4f'));var _0x458383=Mustache[_0xd65b('0x50')](_0x44f3c4[_0xd65b('0x51')],_0x1436c9[_0xd65b('0x31')]);_0x300d57(_0x458383);})[_0xd65b('0x52')](function(_0x12cae4){_0x3101c8(_0x12cae4);});});}function getRecipients(_0x938210){return new BPromise(function(_0x38bbe1,_0xbeb609){var _0x402c9e=[];var _0x21c956=[];_0x938210[_0xd65b('0x49')](function(_0x3ebb73){var _0x22932a=_[_0xd65b('0x53')](_0x3ebb73[_0xd65b('0x54')][_0xd65b('0x3c')]());if(_0x22932a==='User'){_0x402c9e=_['union'](_0x402c9e,_0x3ebb73[_0xd65b('0x55')]);}else{if(_[_0xd65b('0x3b')](_0x22932a,_0xd65b('0x56')))_0x22932a=_0x22932a[_0xd65b('0x57')](_0xd65b('0x56'),'Queue');_0x3ebb73['ids'][_0xd65b('0x49')](function(_0x47886d){_0x21c956[_0xd65b('0x58')](getAgents(_0x22932a,_0x47886d));});}});return BPromise['all'](_0x21c956)[_0xd65b('0x26')](function(_0x51f689){_0x402c9e=_[_0xd65b('0x59')](_0x402c9e,_[_0xd65b('0x5a')](_0x51f689));_0x38bbe1(_0x402c9e);})[_0xd65b('0x52')](function(_0x20a2b7){_0xbeb609(_0x20a2b7);});});}function getAgents(_0x13a482,_0x2c6640){return new BPromise(function(_0x515888,_0x2c840b){return db[_0x13a482][_0xd65b('0x4e')]({'where':{'id':_0x2c6640}})[_0xd65b('0x26')](function(_0xbb0f4c){return _0xbb0f4c[_0xd65b('0x5b')]({'attributes':['id'],'raw':!![]})[_0xd65b('0x26')](function(_0x29ed87){var _0xbd61e2=_[_0xd65b('0x5c')](_0x29ed87,'id');_0x515888(_0xbd61e2);});})['catch'](function(_0xb54929){_0x2c840b(_0xb54929);});});} \ No newline at end of file +var _0x4b68=['forEach','recipient','notification:send','Template','findOne','TemplateId','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','catch','startCase','User','queue','ids','all','union','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','body','hasOwnProperty','text','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','team','user','some','includes','model','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','sortBy','Notification','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b68,0xc8));var _0x84b6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4b68[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x84b6('0x0'));var rimraf=require(_0x84b6('0x1'));var zipdir=require(_0x84b6('0x2'));var jsonpatch=require(_0x84b6('0x3'));var rp=require(_0x84b6('0x4'));var moment=require(_0x84b6('0x5'));var BPromise=require(_0x84b6('0x6'));var Mustache=require(_0x84b6('0x7'));var util=require(_0x84b6('0x8'));var path=require(_0x84b6('0x9'));var sox=require(_0x84b6('0xa'));var csv=require('to-csv');var ejs=require(_0x84b6('0xb'));var fs=require('fs');var _=require(_0x84b6('0xc'));var squel=require(_0x84b6('0xd'));var crypto=require(_0x84b6('0xe'));var jsforce=require(_0x84b6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x84b6('0x10'));var querystring=require(_0x84b6('0x11'));var Papa=require(_0x84b6('0x12'));var Redis=require(_0x84b6('0x13'));var authService=require(_0x84b6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x84b6('0x15'));var hardwareService=require(_0x84b6('0x16'));var logger=require(_0x84b6('0x17'))(_0x84b6('0x18'));var utils=require('../../config/utils');var config=require(_0x84b6('0x19'));var licenseUtil=require(_0x84b6('0x1a'));var db=require(_0x84b6('0x1b'))['db'];config[_0x84b6('0x1c')]=_['defaults'](config[_0x84b6('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x84b6('0x1d'))(new Redis(config[_0x84b6('0x1c')]));require('./notification.socket')['register'](socket);function respondWithStatusCode(_0x3c3705,_0x293127){_0x293127=_0x293127||0xcc;return function(_0x5921ef){if(_0x5921ef){return _0x3c3705[_0x84b6('0x1e')](_0x293127);}return _0x3c3705[_0x84b6('0x1f')](_0x293127)[_0x84b6('0x20')]();};}function respondWithResult(_0x457111,_0x2565ac){_0x2565ac=_0x2565ac||0xc8;return function(_0x8a7d43){if(_0x8a7d43){return _0x457111[_0x84b6('0x1f')](_0x2565ac)[_0x84b6('0x21')](_0x8a7d43);}};}function respondWithFilteredResult(_0x29a2fa,_0x3205a3){return function(_0x1c275){if(_0x1c275){var _0x5dfef6=_0x1c275[_0x84b6('0x22')],_0x49ff3b=_0x3205a3['offset'],_0x5a17e1=_0x3205a3['offset']+_0x3205a3[_0x84b6('0x23')],_0x47b95f;if(_0x5a17e1>=_0x5dfef6){_0x5a17e1=_0x5dfef6;_0x47b95f=0xc8;}else{_0x47b95f=0xce;}_0x29a2fa[_0x84b6('0x1f')](_0x47b95f);return _0x29a2fa[_0x84b6('0x24')](_0x84b6('0x25'),_0x49ff3b+'-'+_0x5a17e1+'/'+_0x5dfef6)[_0x84b6('0x21')](_0x1c275);}return null;};}function patchUpdates(_0x1fcb72){return function(_0x2a88b8){try{jsonpatch[_0x84b6('0x26')](_0x2a88b8,_0x1fcb72,!![]);}catch(_0x1001f7){return BPromise[_0x84b6('0x27')](_0x1001f7);}return _0x2a88b8[_0x84b6('0x28')]();};}function saveUpdates(_0x493c73,_0x33fce7){return function(_0x2e6258){if(_0x2e6258){return _0x2e6258[_0x84b6('0x29')](_0x493c73)[_0x84b6('0x2a')](function(_0x2b71c5){return _0x2b71c5;});}return null;};}function removeEntity(_0x488e1a,_0x1de9db){return function(_0x20d64d){if(_0x20d64d){return _0x20d64d['destroy']()[_0x84b6('0x2a')](function(){_0x488e1a[_0x84b6('0x1f')](0xcc)[_0x84b6('0x20')]();});}};}function handleEntityNotFound(_0x15cc03,_0x514161){return function(_0x3da219){if(!_0x3da219){_0x15cc03[_0x84b6('0x1e')](0x194);}return _0x3da219;};}function handleError(_0x2c1cf5,_0x3595d7){_0x3595d7=_0x3595d7||0x1f4;return function(_0x52cf7e){logger[_0x84b6('0x2b')](_0x52cf7e[_0x84b6('0x2c')]);if(_0x52cf7e['name']){delete _0x52cf7e['name'];}_0x2c1cf5[_0x84b6('0x1f')](_0x3595d7)['send'](_0x52cf7e);};}exports['sendNotification']=function(_0x461d43,_0x14ce7d,_0x286796){if(!_0x461d43[_0x84b6('0x2d')][_0x84b6('0x2e')](_0x84b6('0x2f'))&&!_0x461d43['body'][_0x84b6('0x2e')]('TemplateId')){throw new db[(_0x84b6('0x30'))][(_0x84b6('0x31'))](_0x84b6('0x32'));}else{if(_0x461d43[_0x84b6('0x2d')][_0x84b6('0x2e')]('TemplateId')&&!_0x461d43[_0x84b6('0x2d')][_0x84b6('0x2e')](_0x84b6('0x33'))){throw new db['Sequelize'][(_0x84b6('0x31'))](_0x84b6('0x34'));}if(!_0x461d43['body'][_0x84b6('0x2e')]('recipients')){throw new db[(_0x84b6('0x30'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x5129d5=JSON['parse'](_0x461d43[_0x84b6('0x2d')]['recipients']);}catch(_0x4b776a){logger[_0x84b6('0x2b')](_0x4b776a);throw new db['Sequelize'][(_0x84b6('0x31'))](_0x84b6('0x35'));}var _0x49df79=[_0x84b6('0x36'),_0x84b6('0x37'),_0x84b6('0x38'),_0x84b6('0x39'),_0x84b6('0x3a'),'voicequeue','whatsappqueue',_0x84b6('0x3b'),_0x84b6('0x3c')];if(_[_0x84b6('0x3d')](_0x5129d5,function(_0x17f72a){return!_[_0x84b6('0x3e')](_0x49df79,_0x17f72a[_0x84b6('0x3f')][_0x84b6('0x40')]());})){throw new db[(_0x84b6('0x30'))][(_0x84b6('0x31'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x5990d2={};_0x5990d2[_0x84b6('0x41')]=_0x461d43[_0x84b6('0x2d')][_0x84b6('0x2e')](_0x84b6('0x41'))?_0x461d43[_0x84b6('0x2d')][_0x84b6('0x41')]:_0x461d43[_0x84b6('0x3c')][_0x84b6('0x42')];_0x5990d2[_0x84b6('0x43')]=_[_0x84b6('0x44')](_0x461d43[_0x84b6('0x2d')][_0x84b6('0x43')])?null:_0x461d43[_0x84b6('0x2d')]['recipientsDescription'];_0x5990d2[_0x84b6('0x45')]=_0x461d43[_0x84b6('0x2d')][_0x84b6('0x45')]||![];_0x5990d2['SenderId']=_0x461d43[_0x84b6('0x3c')]['id'];return getContent(_0x461d43[_0x84b6('0x2d')])['then'](function(_0x286de3){_0x5990d2[_0x84b6('0x2d')]=_0x286de3;return getRecipients(_0x5129d5);})[_0x84b6('0x2a')](function(_0x1c9c5e){_0x5990d2['recipientsId']=_[_0x84b6('0x46')](_0x1c9c5e)['join'](',');return db['sequelize']['transaction'](function(_0x3f0e4e){return db[_0x84b6('0x47')][_0x84b6('0x48')](_0x5990d2,{'raw':!![],'transaction':_0x3f0e4e})[_0x84b6('0x2a')](function(_0x48ca22){var _0x1dc356={'sender':_0x5990d2['senderName'],'description':_0x5990d2['recipientsDescription'],'content':_0x5990d2[_0x84b6('0x2d')],'beep':_0x5990d2[_0x84b6('0x45')]};_0x1c9c5e[_0x84b6('0x49')](function(_0x3ee948){_0x1dc356[_0x84b6('0x4a')]=_0x3ee948;socket['emit'](_0x84b6('0x4b'),_0x1dc356);});return _0x48ca22;});});})['then'](respondWithResult(_0x14ce7d,0xc9))['catch'](handleError(_0x14ce7d,null));};function getContent(_0x5ac316){return new BPromise(function(_0x4d0f20,_0x25a7ee){if(_0x5ac316['text']){_0x4d0f20(_0x5ac316[_0x84b6('0x2f')]);return;}return db[_0x84b6('0x4c')][_0x84b6('0x4d')]({'attributes':['html'],'where':{'id':_0x5ac316[_0x84b6('0x4e')]},'raw':!![]})[_0x84b6('0x2a')](function(_0x463e90){if(!_0x463e90)throw new db[(_0x84b6('0x30'))][(_0x84b6('0x31'))](_0x84b6('0x4f'));var _0x435add=Mustache[_0x84b6('0x50')](_0x463e90[_0x84b6('0x51')],_0x5ac316[_0x84b6('0x33')]);_0x4d0f20(_0x435add);})[_0x84b6('0x52')](function(_0x15669b){_0x25a7ee(_0x15669b);});});}function getRecipients(_0x2d2cee){return new BPromise(function(_0x4a8213,_0x44ca91){var _0x3dc1fc=[];var _0x369d60=[];_0x2d2cee[_0x84b6('0x49')](function(_0x5723a8){var _0x5a10a7=_[_0x84b6('0x53')](_0x5723a8[_0x84b6('0x3f')][_0x84b6('0x40')]());if(_0x5a10a7===_0x84b6('0x54')){_0x3dc1fc=_['union'](_0x3dc1fc,_0x5723a8['ids']);}else{if(_[_0x84b6('0x3e')](_0x5a10a7,_0x84b6('0x55')))_0x5a10a7=_0x5a10a7['replace']('queue','Queue');_0x5723a8[_0x84b6('0x56')][_0x84b6('0x49')](function(_0x40fe5d){_0x369d60['push'](getAgents(_0x5a10a7,_0x40fe5d));});}});return BPromise[_0x84b6('0x57')](_0x369d60)['then'](function(_0x3057e0){_0x3dc1fc=_[_0x84b6('0x58')](_0x3dc1fc,_['flatten'](_0x3057e0));_0x4a8213(_0x3dc1fc);})['catch'](function(_0x4a8034){_0x44ca91(_0x4a8034);});});}function getAgents(_0x60f952,_0x5570d2){return new BPromise(function(_0x263d42,_0x200b61){return db[_0x60f952][_0x84b6('0x4d')]({'where':{'id':_0x5570d2}})[_0x84b6('0x2a')](function(_0x4e0405){return _0x4e0405[_0x84b6('0x59')]({'attributes':['id'],'raw':!![]})[_0x84b6('0x2a')](function(_0x274c86){var _0x5378fc=_[_0x84b6('0x5a')](_0x274c86,'id');_0x263d42(_0x5378fc);});})['catch'](function(_0x344018){_0x200b61(_0x344018);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 5a0bcfa..2f02347 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 _0xb10b=['hasOwnProperty','hook','events','Notification','setMaxListeners','save','remove','emit'];(function(_0x51ebfe,_0x45408d){var _0x42221e=function(_0xe181cd){while(--_0xe181cd){_0x51ebfe['push'](_0x51ebfe['shift']());}};_0x42221e(++_0x45408d);}(_0xb10b,0x12a));var _0xbb10=function(_0x29e398,_0x890225){_0x29e398=_0x29e398-0x0;var _0xd799e2=_0xb10b[_0x29e398];return _0xd799e2;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var Notification=require('../../mysqldb')['db'][_0xbb10('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){NotificationEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);NotificationEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];Notification[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file +var _0x0b0e=['Notification','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x8d5d16,_0xa9e056){var _0x552d9d=function(_0x3d1e57){while(--_0x3d1e57){_0x8d5d16['push'](_0x8d5d16['shift']());}};_0x552d9d(++_0xa9e056);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4e518d,_0x32a45d){_0x4e518d=_0x4e518d-0x0;var _0x458ff2=_0x0b0e[_0x4e518d];return _0x458ff2;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var Notification=require('../../mysqldb')['db'][_0xe0b0('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){NotificationEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);NotificationEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];Notification[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 24bf25a..c7fd893 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 _0x0e9a=['../../config/environment','exports','define','Notification','notifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','path'];(function(_0x50bd62,_0x217adb){var _0x3384f3=function(_0x45813a){while(--_0x45813a){_0x50bd62['push'](_0x50bd62['shift']());}};_0x3384f3(++_0x217adb);}(_0x0e9a,0x157));var _0xa0e9=function(_0x59d5ba,_0x558402){_0x59d5ba=_0x59d5ba-0x0;var _0x199be0=_0x0e9a[_0x59d5ba];return _0x199be0;};'use strict';var _=require(_0xa0e9('0x0'));var util=require(_0xa0e9('0x1'));var logger=require(_0xa0e9('0x2'))(_0xa0e9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0e9('0x4'));var rimraf=require('rimraf');var config=require(_0xa0e9('0x5'));var attributes=require('./notification.attributes');module[_0xa0e9('0x6')]=function(_0xccd647,_0xcb3d18){return _0xccd647[_0xa0e9('0x7')](_0xa0e9('0x8'),attributes,{'tableName':_0xa0e9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa0e9('0xa'),'collate':_0xa0e9('0xb')});}; \ No newline at end of file +var _0x895e=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./notification.attributes','exports','define','notifications','utf8mb4','lodash','util'];(function(_0xee05c6,_0x544c85){var _0xe21efc=function(_0x4f81fb){while(--_0x4f81fb){_0xee05c6['push'](_0xee05c6['shift']());}};_0xe21efc(++_0x544c85);}(_0x895e,0xa6));var _0xe895=function(_0x56a20e,_0x44589d){_0x56a20e=_0x56a20e-0x0;var _0x5d3f0a=_0x895e[_0x56a20e];return _0x5d3f0a;};'use strict';var _=require(_0xe895('0x0'));var util=require(_0xe895('0x1'));var logger=require(_0xe895('0x2'))(_0xe895('0x3'));var moment=require(_0xe895('0x4'));var BPromise=require(_0xe895('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe895('0x6'));var rimraf=require(_0xe895('0x7'));var config=require(_0xe895('0x8'));var attributes=require(_0xe895('0x9'));module[_0xe895('0xa')]=function(_0x14dc74,_0x552f36){return _0x14dc74[_0xe895('0xb')]('Notification',attributes,{'tableName':_0xe895('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe895('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 1cdc415..100f66c 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 _0xf343=['redis','localhost','./notification.socket','register','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xf343,0xbb));var _0x3f34=function(_0xbb012e,_0x4e6b6f){_0xbb012e=_0xbb012e-0x0;var _0x14e7fc=_0xf343[_0xbb012e];return _0x14e7fc;};'use strict';var _=require(_0x3f34('0x0'));var util=require(_0x3f34('0x1'));var moment=require(_0x3f34('0x2'));var BPromise=require(_0x3f34('0x3'));var rs=require(_0x3f34('0x4'));var fs=require('fs');var Redis=require(_0x3f34('0x5'));var db=require(_0x3f34('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3f34('0x7'))(_0x3f34('0x8'));var config=require(_0x3f34('0x9'));var jayson=require(_0x3f34('0xa'));var client=jayson[_0x3f34('0xb')][_0x3f34('0xc')]({'port':0x232a});config[_0x3f34('0xd')]=_['defaults'](config[_0x3f34('0xd')],{'host':_0x3f34('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3f34('0xf'))[_0x3f34('0x10')](socket);function respondWithRpcPromise(_0x3bc7e7,_0x5ef6d3,_0x389573){return new BPromise(function(_0x53bbeb,_0x2bb3f2){return client['request'](_0x3bc7e7,_0x389573)['then'](function(_0xd2388c){logger[_0x3f34('0x11')](_0x3f34('0x12'),_0x5ef6d3,_0x3f34('0x13'));logger[_0x3f34('0x14')](_0x3f34('0x15'),_0x5ef6d3,_0x3f34('0x13'),JSON['stringify'](_0xd2388c));if(_0xd2388c[_0x3f34('0x16')]){if(_0xd2388c[_0x3f34('0x16')]['code']===0x1f4){logger['error'](_0x3f34('0x12'),_0x5ef6d3,_0xd2388c['error'][_0x3f34('0x17')]);return _0x2bb3f2(_0xd2388c[_0x3f34('0x16')][_0x3f34('0x17')]);}logger[_0x3f34('0x16')](_0x3f34('0x12'),_0x5ef6d3,_0xd2388c[_0x3f34('0x16')][_0x3f34('0x17')]);return _0x53bbeb(_0xd2388c[_0x3f34('0x16')]['message']);}else{logger['info']('Notification,\x20%s,\x20%s',_0x5ef6d3,_0x3f34('0x13'));_0x53bbeb(_0xd2388c[_0x3f34('0x18')][_0x3f34('0x17')]);}})['catch'](function(_0x17a2d1){logger[_0x3f34('0x16')](_0x3f34('0x12'),_0x5ef6d3,_0x17a2d1);_0x2bb3f2(_0x17a2d1);});});} \ No newline at end of file +var _0xb996=['Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','../../mysqldb','../../config/logger','rpc','defaults','redis','socket.io-emitter','./notification.socket','register','request','info'];(function(_0x4f59b9,_0x3b0af0){var _0x3755fe=function(_0x4527f4){while(--_0x4527f4){_0x4f59b9['push'](_0x4f59b9['shift']());}};_0x3755fe(++_0x3b0af0);}(_0xb996,0x12f));var _0x6b99=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xb996[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x6b99('0x0'));var util=require('util');var moment=require(_0x6b99('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b99('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b99('0x3'))(_0x6b99('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x6b99('0x5')](config[_0x6b99('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x6b99('0x7'))(new Redis(config[_0x6b99('0x6')]));require(_0x6b99('0x8'))[_0x6b99('0x9')](socket);function respondWithRpcPromise(_0x337834,_0x2ef003,_0x3a2815){return new BPromise(function(_0x32f00e,_0x264408){return client[_0x6b99('0xa')](_0x337834,_0x3a2815)['then'](function(_0x106960){logger[_0x6b99('0xb')](_0x6b99('0xc'),_0x2ef003,_0x6b99('0xd'));logger[_0x6b99('0xe')](_0x6b99('0xf'),_0x2ef003,_0x6b99('0xd'),JSON[_0x6b99('0x10')](_0x106960));if(_0x106960[_0x6b99('0x11')]){if(_0x106960['error'][_0x6b99('0x12')]===0x1f4){logger[_0x6b99('0x11')](_0x6b99('0xc'),_0x2ef003,_0x106960[_0x6b99('0x11')][_0x6b99('0x13')]);return _0x264408(_0x106960[_0x6b99('0x11')]['message']);}logger[_0x6b99('0x11')](_0x6b99('0xc'),_0x2ef003,_0x106960[_0x6b99('0x11')][_0x6b99('0x13')]);return _0x32f00e(_0x106960[_0x6b99('0x11')][_0x6b99('0x13')]);}else{logger[_0x6b99('0xb')](_0x6b99('0xc'),_0x2ef003,_0x6b99('0xd'));_0x32f00e(_0x106960[_0x6b99('0x14')][_0x6b99('0x13')]);}})['catch'](function(_0x397cf0){logger[_0x6b99('0x11')]('Notification,\x20%s,\x20%s',_0x2ef003,_0x397cf0);_0x264408(_0x397cf0);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 05efb0d..abe7ad6 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 _0xce05=['notification:','remove','emit','removeListener','register','length'];(function(_0x5a1c75,_0x40cd29){var _0x13931e=function(_0x4f84c0){while(--_0x4f84c0){_0x5a1c75['push'](_0x5a1c75['shift']());}};_0x13931e(++_0x40cd29);}(_0xce05,0x175));var _0x5ce0=function(_0x1a980c,_0x50369f){_0x1a980c=_0x1a980c-0x0;var _0x4353df=_0xce05[_0x1a980c];return _0x4353df;};'use strict';var NotificationEvents=require('./notification.events');var events=['save',_0x5ce0('0x0'),'update'];function createListener(_0x48b63b,_0x4c84aa){return function(_0x5e7048){_0x4c84aa[_0x5ce0('0x1')](_0x48b63b,_0x5e7048);};}function removeListener(_0x42a140,_0x301d07){return function(){NotificationEvents[_0x5ce0('0x2')](_0x42a140,_0x301d07);};}exports[_0x5ce0('0x3')]=function(_0x2884b1){for(var _0x103b5c=0x0,_0x45287e=events[_0x5ce0('0x4')];_0x103b5c<_0x45287e;_0x103b5c++){var _0x5b5b4e=events[_0x103b5c];var _0x15b813=createListener(_0x5ce0('0x5')+_0x5b5b4e,_0x2884b1);NotificationEvents['on'](_0x5b5b4e,_0x15b813);}}; \ No newline at end of file +var _0x480f=['update','length','notification:','./notification.events','remove'];(function(_0x41d584,_0x5c1267){var _0x3ed78f=function(_0xdc4489){while(--_0xdc4489){_0x41d584['push'](_0x41d584['shift']());}};_0x3ed78f(++_0x5c1267);}(_0x480f,0x107));var _0xf480=function(_0x2ccc71,_0x1c458a){_0x2ccc71=_0x2ccc71-0x0;var _0x20fa15=_0x480f[_0x2ccc71];return _0x20fa15;};'use strict';var NotificationEvents=require(_0xf480('0x0'));var events=['save',_0xf480('0x1'),_0xf480('0x2')];function createListener(_0x55a9e8,_0x2efa46){return function(_0x3539df){_0x2efa46['emit'](_0x55a9e8,_0x3539df);};}function removeListener(_0x346e1f,_0x1f4a6d){return function(){NotificationEvents['removeListener'](_0x346e1f,_0x1f4a6d);};}exports['register']=function(_0x23e926){for(var _0x2e1f85=0x0,_0x1a90a8=events[_0xf480('0x3')];_0x2e1f85<_0x1a90a8;_0x2e1f85++){var _0x56eb6d=events[_0x2e1f85];var _0x351808=createListener(_0xf480('0x4')+_0x56eb6d,_0x23e926);NotificationEvents['on'](_0x56eb6d,_0x351808);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index cd5811f..e8413d0 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 _0x441b=['addAnswer','/:id/notify','addApplications','addAgents','/:id/send','put','/:id','update','delete','destroy','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','show','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addDisposition'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x441b,0x14f));var _0xb441=function(_0x595bd1,_0xb1e7a){_0x595bd1=_0x595bd1-0x0;var _0xd0344f=_0x441b[_0x595bd1];return _0xd0344f;};'use strict';var multer=require(_0xb441('0x0'));var util=require(_0xb441('0x1'));var path=require('path');var timeout=require(_0xb441('0x2'));var express=require(_0xb441('0x3'));var router=express[_0xb441('0x4')]();var auth=require(_0xb441('0x5'));var interaction=require(_0xb441('0x6'));var config=require(_0xb441('0x7'));var controller=require(_0xb441('0x8'));router[_0xb441('0x9')]('/',auth[_0xb441('0xa')](),controller[_0xb441('0xb')]);router[_0xb441('0x9')](_0xb441('0xc'),auth[_0xb441('0xa')](),controller[_0xb441('0xd')]);router[_0xb441('0x9')]('/:id',auth[_0xb441('0xa')](),controller[_0xb441('0xe')]);router[_0xb441('0x9')]('/:id/dispositions',auth[_0xb441('0xa')](),controller[_0xb441('0xf')]);router[_0xb441('0x9')](_0xb441('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xb441('0x9')](_0xb441('0x11'),auth['isAuthenticated'](),controller[_0xb441('0x12')]);router[_0xb441('0x9')](_0xb441('0x13'),auth[_0xb441('0xa')](),controller[_0xb441('0x14')]);router[_0xb441('0x9')](_0xb441('0x15'),auth[_0xb441('0xa')](),controller['getAgents']);router[_0xb441('0x16')]('/',auth[_0xb441('0xa')](),controller[_0xb441('0x17')]);router[_0xb441('0x16')]('/:id/dispositions',auth[_0xb441('0xa')](),controller[_0xb441('0x18')]);router[_0xb441('0x16')](_0xb441('0x10'),auth[_0xb441('0xa')](),controller[_0xb441('0x19')]);router['post'](_0xb441('0x1a'),controller['notify']);router[_0xb441('0x16')](_0xb441('0x11'),auth['isAuthenticated'](),controller[_0xb441('0x1b')]);router[_0xb441('0x16')](_0xb441('0x15'),auth[_0xb441('0xa')](),controller[_0xb441('0x1c')]);router[_0xb441('0x16')](_0xb441('0x1d'),auth[_0xb441('0xa')](),controller['send']);router[_0xb441('0x1e')](_0xb441('0x1f'),auth['isAuthenticated'](),controller[_0xb441('0x20')]);router[_0xb441('0x21')]('/:id',auth[_0xb441('0xa')](),controller[_0xb441('0x22')]);router[_0xb441('0x21')](_0xb441('0x23'),auth['isAuthenticated'](),controller[_0xb441('0x24')]);router[_0xb441('0x21')](_0xb441('0x10'),auth[_0xb441('0xa')](),controller[_0xb441('0x25')]);router[_0xb441('0x21')](_0xb441('0x15'),auth['isAuthenticated'](),controller[_0xb441('0x26')]);module[_0xb441('0x27')]=router; \ No newline at end of file +var _0x4075=['./openchannelAccount.controller','get','isAuthenticated','describe','/:id','show','/:id/dispositions','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1b6563,_0x3bf0f1){var _0xdea7b8=function(_0x49e6c6){while(--_0x49e6c6){_0x1b6563['push'](_0x1b6563['shift']());}};_0xdea7b8(++_0x3bf0f1);}(_0x4075,0x111));var _0x5407=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0x4075[_0x34ad72];return _0x5c9aa8;};'use strict';var multer=require(_0x5407('0x0'));var util=require(_0x5407('0x1'));var path=require(_0x5407('0x2'));var timeout=require(_0x5407('0x3'));var express=require(_0x5407('0x4'));var router=express[_0x5407('0x5')]();var auth=require(_0x5407('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5407('0x7'));router[_0x5407('0x8')]('/',auth[_0x5407('0x9')](),controller['index']);router[_0x5407('0x8')]('/describe',auth[_0x5407('0x9')](),controller[_0x5407('0xa')]);router[_0x5407('0x8')](_0x5407('0xb'),auth[_0x5407('0x9')](),controller[_0x5407('0xc')]);router[_0x5407('0x8')](_0x5407('0xd'),auth[_0x5407('0x9')](),controller['getDispositions']);router[_0x5407('0x8')]('/:id/canned_answers',auth[_0x5407('0x9')](),controller[_0x5407('0xe')]);router[_0x5407('0x8')]('/:id/applications',auth['isAuthenticated'](),controller[_0x5407('0xf')]);router[_0x5407('0x8')](_0x5407('0x10'),auth['isAuthenticated'](),controller[_0x5407('0x11')]);router['get'](_0x5407('0x12'),auth['isAuthenticated'](),controller[_0x5407('0x13')]);router['post']('/',auth[_0x5407('0x9')](),controller['create']);router[_0x5407('0x14')](_0x5407('0xd'),auth[_0x5407('0x9')](),controller[_0x5407('0x15')]);router[_0x5407('0x14')](_0x5407('0x16'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x5407('0x14')](_0x5407('0x17'),controller[_0x5407('0x18')]);router[_0x5407('0x14')]('/:id/applications',auth[_0x5407('0x9')](),controller[_0x5407('0x19')]);router[_0x5407('0x14')](_0x5407('0x12'),auth[_0x5407('0x9')](),controller[_0x5407('0x1a')]);router[_0x5407('0x14')](_0x5407('0x1b'),auth[_0x5407('0x9')](),controller[_0x5407('0x1c')]);router[_0x5407('0x1d')](_0x5407('0xb'),auth[_0x5407('0x9')](),controller[_0x5407('0x1e')]);router['delete']('/:id',auth[_0x5407('0x9')](),controller[_0x5407('0x1f')]);router[_0x5407('0x20')](_0x5407('0xd'),auth[_0x5407('0x9')](),controller[_0x5407('0x21')]);router[_0x5407('0x20')](_0x5407('0x16'),auth['isAuthenticated'](),controller[_0x5407('0x22')]);router[_0x5407('0x20')](_0x5407('0x12'),auth[_0x5407('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index f93e7a8..9ce48a4 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 _0x6565=['generate','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x6565,0xbc));var _0x5656=function(_0x14aaae,_0x1a261){_0x14aaae=_0x14aaae-0x0;var _0x5a1189=_0x6565[_0x14aaae];return _0x5a1189;};'use strict';var Sequelize=require(_0x5656('0x0'));var rs=require('randomstring');module[_0x5656('0x1')]={'name':{'type':Sequelize[_0x5656('0x2')],'unique':_0x5656('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x5656('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x5656('0x4')]();}},'replyUri':{'type':Sequelize[_0x5656('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5656('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5656('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5656('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5656('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5656('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x5656('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5656('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5656('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5656('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5656('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5656('0x6')],'defaultValue':![],'comment':_0x5656('0x8'),'set':function(_0x5352f6){if(!_0x5352f6)this[_0x5656('0x9')](_0x5656('0xa'),null);this[_0x5656('0x9')](_0x5656('0xb'),_0x5352f6);}}}; \ No newline at end of file +var _0x5cf2=['setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','generate','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x58fecb,_0x32065a){var _0x4f0295=function(_0x595235){while(--_0x595235){_0x58fecb['push'](_0x58fecb['shift']());}};_0x4f0295(++_0x32065a);}(_0x5cf2,0xaa));var _0x25cf=function(_0x3074f3,_0x4f2c03){_0x3074f3=_0x3074f3-0x0;var _0x53f112=_0x5cf2[_0x3074f3];return _0x53f112;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x25cf('0x0'));module[_0x25cf('0x1')]={'name':{'type':Sequelize[_0x25cf('0x2')],'unique':_0x25cf('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x25cf('0x2')]},'token':{'type':Sequelize[_0x25cf('0x2')],'defaultValue':function(){return rs[_0x25cf('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x25cf('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x25cf('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x25cf('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x25cf('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x25cf('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x25cf('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x25cf('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x25cf('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x25cf('0x5')],'defaultValue':![],'comment':_0x25cf('0x8'),'set':function(_0x2ddd7c){if(!_0x2ddd7c)this['setDataValue'](_0x25cf('0x9'),null);this[_0x25cf('0xa')](_0x25cf('0xb'),_0x2ddd7c);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 34e74a3..a350100 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 _0x99e9=['Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./openchannelAccount.socket','jayson/promise','http','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','then','destroy','get','UserProfileResource','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filter','where','name','includeAll','keys','include','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OpenchannelAccounts','UserProfileSection','userProfileId','update','params','describe','getDispositions','Disposition','sort','pick','findAll','rows','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','difference','updatedAt','createdAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','defaults','contact','firstName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','lastName','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','findOne','sequelize','bulkCreate','findAndCountAll','getApplications','getInteractions','Owner','fullname','Tags','color','tag','addAgents','omit','emit','removeAgents','userOpenchannelAccount:remove','getAgents','out'];(function(_0xe3b998,_0x3207b8){var _0x59f4c5=function(_0x4854cb){while(--_0x4854cb){_0xe3b998['push'](_0xe3b998['shift']());}};_0x59f4c5(++_0x3207b8);}(_0x99e9,0xb4));var _0x999e=function(_0x5c6022,_0x5cd10b){_0x5c6022=_0x5c6022-0x0;var _0x4ab5af=_0x99e9[_0x5c6022];return _0x4ab5af;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x999e('0x0'));var rimraf=require(_0x999e('0x1'));var zipdir=require(_0x999e('0x2'));var jsonpatch=require(_0x999e('0x3'));var rp=require('request-promise');var moment=require(_0x999e('0x4'));var BPromise=require(_0x999e('0x5'));var Mustache=require(_0x999e('0x6'));var util=require('util');var path=require(_0x999e('0x7'));var sox=require('sox');var csv=require(_0x999e('0x8'));var ejs=require(_0x999e('0x9'));var fs=require('fs');var _=require(_0x999e('0xa'));var squel=require(_0x999e('0xb'));var crypto=require('crypto');var jsforce=require(_0x999e('0xc'));var deskjs=require(_0x999e('0xd'));var toCsv=require(_0x999e('0x8'));var querystring=require(_0x999e('0xe'));var Papa=require(_0x999e('0xf'));var Redis=require(_0x999e('0x10'));var authService=require(_0x999e('0x11'));var qs=require(_0x999e('0x12'));var as=require(_0x999e('0x13'));var hardwareService=require(_0x999e('0x14'));var logger=require(_0x999e('0x15'))(_0x999e('0x16'));var utils=require(_0x999e('0x17'));var config=require(_0x999e('0x18'));var licenseUtil=require(_0x999e('0x19'));var db=require(_0x999e('0x1a'))['db'];config[_0x999e('0x1b')]=_['defaults'](config[_0x999e('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x999e('0x1c'))(new Redis(config[_0x999e('0x1b')]));require(_0x999e('0x1d'))['register'](socket);var jayson=require(_0x999e('0x1e'));var client=jayson['client'][_0x999e('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1eee64,_0x22feac,_0x2dd5f4,_0x289e0e){return new BPromise(function(_0x1e9bff,_0x39ce36){var _0x4aac66=_0x289e0e||client;return _0x4aac66['request'](_0x1eee64,_0x2dd5f4)['then'](function(_0x3153ce){logger[_0x999e('0x20')](_0x999e('0x21'),_0x22feac,_0x999e('0x22'));logger[_0x999e('0x23')](_0x999e('0x24'),_0x22feac,'request\x20sent',JSON['stringify'](_0x3153ce));if(_0x3153ce[_0x999e('0x25')]){if(_0x3153ce[_0x999e('0x25')][_0x999e('0x26')]===0x1f4){logger['error'](_0x999e('0x21'),_0x22feac,_0x3153ce[_0x999e('0x25')][_0x999e('0x27')]);return _0x39ce36(_0x3153ce[_0x999e('0x25')][_0x999e('0x27')]);}logger[_0x999e('0x25')](_0x999e('0x21'),_0x22feac,_0x3153ce['error']['message']);return _0x1e9bff(_0x3153ce[_0x999e('0x25')][_0x999e('0x27')]);}else{logger['info'](_0x999e('0x21'),_0x22feac,_0x999e('0x22'));_0x1e9bff(_0x3153ce[_0x999e('0x28')][_0x999e('0x27')]);}})[_0x999e('0x29')](function(_0x320634){logger['error'](_0x999e('0x21'),_0x22feac,_0x320634);_0x39ce36(_0x320634);});});}function respondWithStatusCode(_0x4199ff,_0x11068e){_0x11068e=_0x11068e||0xcc;return function(_0x12b9ad){if(_0x12b9ad){return _0x4199ff[_0x999e('0x2a')](_0x11068e);}return _0x4199ff[_0x999e('0x2b')](_0x11068e)[_0x999e('0x2c')]();};}function respondWithResult(_0x5798f3,_0x28f803){_0x28f803=_0x28f803||0xc8;return function(_0x5ba8b0){if(_0x5ba8b0){return _0x5798f3['status'](_0x28f803)[_0x999e('0x2d')](_0x5ba8b0);}};}function respondWithFilteredResult(_0x1059bd,_0x1f89f2){return function(_0x555ca0){if(_0x555ca0){var _0x1ea0e4=_0x555ca0[_0x999e('0x2e')],_0x28f7ba=_0x1f89f2[_0x999e('0x2f')],_0x22cd81=_0x1f89f2[_0x999e('0x2f')]+_0x1f89f2[_0x999e('0x30')],_0x4339bf;if(_0x22cd81>=_0x1ea0e4){_0x22cd81=_0x1ea0e4;_0x4339bf=0xc8;}else{_0x4339bf=0xce;}_0x1059bd[_0x999e('0x2b')](_0x4339bf);return _0x1059bd[_0x999e('0x31')]('Content-Range',_0x28f7ba+'-'+_0x22cd81+'/'+_0x1ea0e4)[_0x999e('0x2d')](_0x555ca0);}return null;};}function patchUpdates(_0x1cd206){return function(_0x371613){try{jsonpatch['apply'](_0x371613,_0x1cd206,!![]);}catch(_0x2ca5b8){return BPromise['reject'](_0x2ca5b8);}return _0x371613['save']();};}function saveUpdates(_0x28a228,_0x332195){return function(_0x5aa206){if(_0x5aa206){return _0x5aa206['update'](_0x28a228)[_0x999e('0x32')](function(_0x12eb93){return _0x12eb93;});}return null;};}function removeEntity(_0x10a17d,_0x56cb7a){return function(_0x59baab){if(_0x59baab){return _0x59baab[_0x999e('0x33')]()[_0x999e('0x32')](function(){var _0x37f662=_0x59baab[_0x999e('0x34')]({'plain':!![]});var _0x4f861f='OpenchannelAccounts';return db[_0x999e('0x35')]['destroy']({'where':{'type':_0x4f861f,'resourceId':_0x37f662['id']}})[_0x999e('0x32')](function(){return _0x59baab;});})[_0x999e('0x32')](function(){_0x10a17d[_0x999e('0x2b')](0xcc)[_0x999e('0x2c')]();});}};}function handleEntityNotFound(_0x5ad3f1,_0xebda67){return function(_0x28df26){if(!_0x28df26){_0x5ad3f1['sendStatus'](0x194);}return _0x28df26;};}function handleError(_0x4808d1,_0x327866){_0x327866=_0x327866||0x1f4;return function(_0x4aa98c){logger[_0x999e('0x25')](_0x4aa98c['stack']);if(_0x4aa98c['name']){delete _0x4aa98c['name'];}_0x4808d1['status'](_0x327866)[_0x999e('0x36')](_0x4aa98c);};}exports['index']=function(_0x1be117,_0x5240a7){var _0x4cfa34={'include':[{'model':db[_0x999e('0x37')],'as':_0x999e('0x38')}]},_0x4e6bde={},_0x2f7d79={'count':0x0,'rows':[]};var _0xe3c089=_[_0x999e('0x39')](db[_0x999e('0x3a')][_0x999e('0x3b')],function(_0x176a8c){return{'name':_0x176a8c['fieldName'],'type':_0x176a8c[_0x999e('0x3c')][_0x999e('0x3d')]};});_0x4e6bde[_0x999e('0x3e')]=_[_0x999e('0x39')](_0xe3c089,'name');_0x4e6bde[_0x999e('0x3f')]=_['keys'](_0x1be117[_0x999e('0x3f')]);_0x4e6bde[_0x999e('0x40')]=_[_0x999e('0x41')](_0x4e6bde[_0x999e('0x3e')],_0x4e6bde['query']);_0x4cfa34[_0x999e('0x42')]=_[_0x999e('0x41')](_0x4e6bde[_0x999e('0x3e')],qs['fields'](_0x1be117['query'][_0x999e('0x43')]));_0x4cfa34[_0x999e('0x42')]=_0x4cfa34[_0x999e('0x42')][_0x999e('0x44')]?_0x4cfa34[_0x999e('0x42')]:_0x4e6bde[_0x999e('0x3e')];if(!_0x1be117[_0x999e('0x3f')][_0x999e('0x45')](_0x999e('0x46'))){_0x4cfa34[_0x999e('0x30')]=qs['limit'](_0x1be117['query'][_0x999e('0x30')]);_0x4cfa34[_0x999e('0x2f')]=qs[_0x999e('0x2f')](_0x1be117[_0x999e('0x3f')][_0x999e('0x2f')]);}_0x4cfa34[_0x999e('0x47')]=qs['sort'](_0x1be117[_0x999e('0x3f')]['sort']);_0x4cfa34['where']=qs[_0x999e('0x40')](_['pick'](_0x1be117['query'],_0x4e6bde['filters']),_0xe3c089);if(_0x1be117['query'][_0x999e('0x48')]){_0x4cfa34[_0x999e('0x49')]=_['merge'](_0x4cfa34[_0x999e('0x49')],{'$or':_[_0x999e('0x39')](_0xe3c089,function(_0x2aa9ca){if(_0x2aa9ca['type']!=='VIRTUAL'){var _0x415d4f={};_0x415d4f[_0x2aa9ca[_0x999e('0x4a')]]={'$like':'%'+_0x1be117[_0x999e('0x3f')]['filter']+'%'};return _0x415d4f;}})});}_0x4cfa34=_['merge']({},_0x4cfa34,_0x1be117['options']);var _0x5ee14d={'where':_0x4cfa34[_0x999e('0x49')]};return db['OpenchannelAccount']['count'](_0x5ee14d)[_0x999e('0x32')](function(_0x29a27f){_0x2f7d79['count']=_0x29a27f;if(_0x1be117[_0x999e('0x3f')][_0x999e('0x4b')]){_0x4cfa34['include']=[{'all':!![]}];}return db[_0x999e('0x3a')]['findAll'](_0x4cfa34);})[_0x999e('0x32')](function(_0x42dfea){_0x2f7d79['rows']=_0x42dfea;return _0x2f7d79;})[_0x999e('0x32')](respondWithFilteredResult(_0x5240a7,_0x4cfa34))[_0x999e('0x29')](handleError(_0x5240a7,null));};exports['show']=function(_0x56c6b2,_0x254292){var _0x561fb4={'raw':![],'where':{'id':_0x56c6b2['params']['id']},'include':[{'model':db[_0x999e('0x37')],'as':_0x999e('0x38')}]},_0x5ebc95={};_0x5ebc95[_0x999e('0x3e')]=_[_0x999e('0x4c')](db[_0x999e('0x3a')][_0x999e('0x3b')]);_0x5ebc95['query']=_[_0x999e('0x4c')](_0x56c6b2[_0x999e('0x3f')]);_0x5ebc95['filtears']=_[_0x999e('0x41')](_0x5ebc95[_0x999e('0x3e')],_0x5ebc95[_0x999e('0x3f')]);_0x561fb4[_0x999e('0x42')]=_[_0x999e('0x41')](_0x5ebc95[_0x999e('0x3e')],qs[_0x999e('0x43')](_0x56c6b2[_0x999e('0x3f')][_0x999e('0x43')]));_0x561fb4['attributes']=_0x561fb4[_0x999e('0x42')][_0x999e('0x44')]?_0x561fb4[_0x999e('0x42')]:_0x5ebc95[_0x999e('0x3e')];if(_0x56c6b2['query'][_0x999e('0x4b')]){_0x561fb4[_0x999e('0x4d')]=[{'all':!![]}];}_0x561fb4=_[_0x999e('0x4e')]({},_0x561fb4,_0x56c6b2[_0x999e('0x4f')]);return db[_0x999e('0x3a')][_0x999e('0x50')](_0x561fb4)[_0x999e('0x32')](handleEntityNotFound(_0x254292,null))[_0x999e('0x32')](respondWithResult(_0x254292,null))['catch'](handleError(_0x254292,null));};exports['create']=function(_0xd118f9,_0x297b0e){return db[_0x999e('0x3a')][_0x999e('0x51')](_0xd118f9[_0x999e('0x52')],{})[_0x999e('0x32')](function(_0x23c5fb){var _0x56d4b2=_0xd118f9['user'][_0x999e('0x34')]({'plain':!![]});if(!_0x56d4b2)throw new Error(_0x999e('0x53'));if(_0x56d4b2[_0x999e('0x54')]===_0x999e('0x55')){var _0x25176f=_0x23c5fb['get']({'plain':!![]});var _0x10f82f=_0x999e('0x56');return db[_0x999e('0x57')][_0x999e('0x50')]({'where':{'name':_0x10f82f,'userProfileId':_0x56d4b2[_0x999e('0x58')]},'raw':!![]})[_0x999e('0x32')](function(_0x2b4bbe){if(_0x2b4bbe&&_0x2b4bbe['autoAssociation']===0x0){return db[_0x999e('0x35')]['create']({'name':_0x25176f[_0x999e('0x4a')],'resourceId':_0x25176f['id'],'type':_0x2b4bbe[_0x999e('0x4a')],'sectionId':_0x2b4bbe['id']},{})[_0x999e('0x32')](function(){return _0x23c5fb;});}else{return _0x23c5fb;}})[_0x999e('0x29')](function(_0x440a3c){logger[_0x999e('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x440a3c);throw _0x440a3c;});}return _0x23c5fb;})[_0x999e('0x32')](respondWithResult(_0x297b0e,0xc9))[_0x999e('0x29')](handleError(_0x297b0e,null));};exports[_0x999e('0x59')]=function(_0xe39e00,_0x470e51){if(_0xe39e00[_0x999e('0x52')]['id']){delete _0xe39e00[_0x999e('0x52')]['id'];}return db[_0x999e('0x3a')][_0x999e('0x50')]({'where':{'id':_0xe39e00[_0x999e('0x5a')]['id']},'include':[{'model':db[_0x999e('0x37')],'as':_0x999e('0x38')}]})[_0x999e('0x32')](handleEntityNotFound(_0x470e51,null))[_0x999e('0x32')](saveUpdates(_0xe39e00[_0x999e('0x52')],null))['then'](respondWithResult(_0x470e51,null))[_0x999e('0x29')](handleError(_0x470e51,null));};exports[_0x999e('0x33')]=function(_0x296d59,_0x3f18fb){return db['OpenchannelAccount']['find']({'where':{'id':_0x296d59[_0x999e('0x5a')]['id']}})[_0x999e('0x32')](handleEntityNotFound(_0x3f18fb,null))[_0x999e('0x32')](removeEntity(_0x3f18fb,null))[_0x999e('0x29')](handleError(_0x3f18fb,null));};exports[_0x999e('0x5b')]=function(_0x19d934,_0x1596bb){return db[_0x999e('0x3a')][_0x999e('0x5b')]()['then'](respondWithResult(_0x1596bb,null))[_0x999e('0x29')](handleError(_0x1596bb,null));};exports['addDisposition']=function(_0x184b3e,_0x21a04a,_0x4941e0){if(_0x184b3e[_0x999e('0x52')]['id']){delete _0x184b3e[_0x999e('0x52')]['id'];}return db[_0x999e('0x3a')][_0x999e('0x50')]({'where':{'id':_0x184b3e[_0x999e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x21a04a,null))[_0x999e('0x32')](function(_0x21e706){if(_0x21e706){_0x184b3e['body']['OpenchannelAccountId']=_0x21e706['id'];return db['Disposition'][_0x999e('0x51')](_0x184b3e[_0x999e('0x52')]);}})[_0x999e('0x32')](respondWithResult(_0x21a04a,null))[_0x999e('0x29')](handleError(_0x21a04a,null));};exports[_0x999e('0x5c')]=function(_0x5c06cb,_0x492a5a,_0x4e229e){var _0x49293d={'raw':![],'where':{}};var _0x513580={};var _0x53ba16={'count':0x0,'rows':[]};return db[_0x999e('0x3a')]['findOne']({'where':{'id':_0x5c06cb[_0x999e('0x5a')]['id']}})[_0x999e('0x32')](handleEntityNotFound(_0x492a5a,null))[_0x999e('0x32')](function(_0x5b8a0d){if(_0x5b8a0d){_0x513580[_0x999e('0x3e')]=_[_0x999e('0x4c')](db[_0x999e('0x5d')][_0x999e('0x3b')]);_0x513580[_0x999e('0x3f')]=_[_0x999e('0x4c')](_0x5c06cb[_0x999e('0x3f')]);_0x513580['filters']=_[_0x999e('0x41')](_0x513580[_0x999e('0x3e')],_0x513580[_0x999e('0x3f')]);_0x49293d['attributes']=_[_0x999e('0x41')](_0x513580[_0x999e('0x3e')],qs['fields'](_0x5c06cb[_0x999e('0x3f')][_0x999e('0x43')]));_0x49293d[_0x999e('0x42')]=_0x49293d[_0x999e('0x42')][_0x999e('0x44')]?_0x49293d[_0x999e('0x42')]:_0x513580[_0x999e('0x3e')];if(!_0x5c06cb[_0x999e('0x3f')][_0x999e('0x45')]('nolimit')){_0x49293d[_0x999e('0x30')]=qs[_0x999e('0x30')](_0x5c06cb[_0x999e('0x3f')]['limit']);_0x49293d[_0x999e('0x2f')]=qs['offset'](_0x5c06cb[_0x999e('0x3f')][_0x999e('0x2f')]);}_0x49293d[_0x999e('0x47')]=qs['sort'](_0x5c06cb[_0x999e('0x3f')][_0x999e('0x5e')]);_0x49293d[_0x999e('0x49')]=qs[_0x999e('0x40')](_[_0x999e('0x5f')](_0x5c06cb[_0x999e('0x3f')],_0x513580['filters']));_0x49293d[_0x999e('0x49')]['OpenchannelAccountId']=_0x5b8a0d['id'];if(_0x5c06cb[_0x999e('0x3f')]['filter']){_0x49293d['where']=_[_0x999e('0x4e')](_0x49293d['where'],{'$or':_[_0x999e('0x39')](_0x49293d[_0x999e('0x42')],function(_0x5adf0c){var _0x15c83f={};_0x15c83f[_0x5adf0c]={'$like':'%'+_0x5c06cb[_0x999e('0x3f')]['filter']+'%'};return _0x15c83f;})});}_0x49293d=_[_0x999e('0x4e')]({},_0x49293d,_0x5c06cb[_0x999e('0x4f')]);return db[_0x999e('0x5d')][_0x999e('0x2e')]({'where':_0x49293d[_0x999e('0x49')]})[_0x999e('0x32')](function(_0x4f22a6){_0x53ba16[_0x999e('0x2e')]=_0x4f22a6;if(_0x5c06cb['query']['includeAll']){_0x49293d[_0x999e('0x4d')]=[{'all':!![]}];}return db[_0x999e('0x5d')][_0x999e('0x60')](_0x49293d);})[_0x999e('0x32')](function(_0x142843){_0x53ba16[_0x999e('0x61')]=_0x142843;return _0x53ba16;});}})['then'](respondWithFilteredResult(_0x492a5a,_0x49293d))[_0x999e('0x29')](handleError(_0x492a5a,null));};exports[_0x999e('0x62')]=function(_0x5c9439,_0x2405f5,_0x404391){return db[_0x999e('0x3a')]['find']({'where':{'id':_0x5c9439[_0x999e('0x5a')]['id']}})[_0x999e('0x32')](handleEntityNotFound(_0x2405f5,null))[_0x999e('0x32')](function(_0x47eac1){if(_0x47eac1){return _0x47eac1[_0x999e('0x62')](_0x5c9439[_0x999e('0x3f')][_0x999e('0x63')]);}})['then'](respondWithStatusCode(_0x2405f5,null))['catch'](handleError(_0x2405f5,null));};exports[_0x999e('0x64')]=function(_0x47e5ce,_0x3175c1,_0x86e553){if(_0x47e5ce[_0x999e('0x52')]['id']){delete _0x47e5ce[_0x999e('0x52')]['id'];}return db[_0x999e('0x3a')][_0x999e('0x50')]({'where':{'id':_0x47e5ce[_0x999e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3175c1,null))[_0x999e('0x32')](function(_0x540a9e){if(_0x540a9e){_0x47e5ce['body'][_0x999e('0x65')]=_0x540a9e['id'];return db[_0x999e('0x66')][_0x999e('0x51')](_0x47e5ce[_0x999e('0x52')]);}})[_0x999e('0x32')](respondWithResult(_0x3175c1,null))[_0x999e('0x29')](handleError(_0x3175c1,null));};exports['getAnswers']=function(_0x47530d,_0x58106b,_0x302161){var _0x1f39c0={'raw':![],'where':{}};var _0x3f82db={};var _0x55cd53={'count':0x0,'rows':[]};return db[_0x999e('0x3a')]['findOne']({'where':{'id':_0x47530d[_0x999e('0x5a')]['id']}})[_0x999e('0x32')](handleEntityNotFound(_0x58106b,null))[_0x999e('0x32')](function(_0xe7f809){if(_0xe7f809){_0x3f82db[_0x999e('0x3e')]=_['keys'](db['CannedAnswer'][_0x999e('0x3b')]);_0x3f82db[_0x999e('0x3f')]=_[_0x999e('0x4c')](_0x47530d[_0x999e('0x3f')]);_0x3f82db[_0x999e('0x40')]=_[_0x999e('0x41')](_0x3f82db[_0x999e('0x3e')],_0x3f82db[_0x999e('0x3f')]);_0x1f39c0['attributes']=_[_0x999e('0x41')](_0x3f82db[_0x999e('0x3e')],qs[_0x999e('0x43')](_0x47530d[_0x999e('0x3f')][_0x999e('0x43')]));_0x1f39c0[_0x999e('0x42')]=_0x1f39c0[_0x999e('0x42')][_0x999e('0x44')]?_0x1f39c0['attributes']:_0x3f82db[_0x999e('0x3e')];if(!_0x47530d[_0x999e('0x3f')][_0x999e('0x45')](_0x999e('0x46'))){_0x1f39c0[_0x999e('0x30')]=qs[_0x999e('0x30')](_0x47530d[_0x999e('0x3f')][_0x999e('0x30')]);_0x1f39c0['offset']=qs[_0x999e('0x2f')](_0x47530d[_0x999e('0x3f')][_0x999e('0x2f')]);}_0x1f39c0['order']=qs[_0x999e('0x5e')](_0x47530d[_0x999e('0x3f')][_0x999e('0x5e')]);_0x1f39c0[_0x999e('0x49')]=qs[_0x999e('0x40')](_[_0x999e('0x5f')](_0x47530d[_0x999e('0x3f')],_0x3f82db[_0x999e('0x40')]));_0x1f39c0[_0x999e('0x49')]['OpenchannelAccountId']=_0xe7f809['id'];if(_0x47530d[_0x999e('0x3f')][_0x999e('0x48')]){_0x1f39c0[_0x999e('0x49')]=_['merge'](_0x1f39c0['where'],{'$or':_[_0x999e('0x39')](_0x1f39c0[_0x999e('0x42')],function(_0x421f60){var _0x544755={};_0x544755[_0x421f60]={'$like':'%'+_0x47530d[_0x999e('0x3f')][_0x999e('0x48')]+'%'};return _0x544755;})});}_0x1f39c0=_[_0x999e('0x4e')]({},_0x1f39c0,_0x47530d['options']);return db[_0x999e('0x66')][_0x999e('0x2e')]({'where':_0x1f39c0['where']})[_0x999e('0x32')](function(_0x5ac17e){_0x55cd53['count']=_0x5ac17e;if(_0x47530d[_0x999e('0x3f')][_0x999e('0x4b')]){_0x1f39c0[_0x999e('0x4d')]=[{'all':!![]}];}return db[_0x999e('0x66')]['findAll'](_0x1f39c0);})[_0x999e('0x32')](function(_0x351c85){_0x55cd53[_0x999e('0x61')]=_0x351c85;return _0x55cd53;});}})[_0x999e('0x32')](respondWithFilteredResult(_0x58106b,_0x1f39c0))[_0x999e('0x29')](handleError(_0x58106b,null));};exports['removeAnswers']=function(_0x34608b,_0x85f7e3,_0x3b1a00){return db['OpenchannelAccount'][_0x999e('0x50')]({'where':{'id':_0x34608b[_0x999e('0x5a')]['id']}})[_0x999e('0x32')](handleEntityNotFound(_0x85f7e3,null))[_0x999e('0x32')](function(_0xca785b){if(_0xca785b){return _0xca785b[_0x999e('0x67')](_0x34608b[_0x999e('0x3f')][_0x999e('0x63')]);}})['then'](respondWithStatusCode(_0x85f7e3,null))[_0x999e('0x29')](handleError(_0x85f7e3,null));};exports[_0x999e('0x68')]=function(_0x270e37,_0x6711f2,_0x4787d3){var _0x1c663f={'body':_0x270e37[_0x999e('0x52')],'channel':_0x999e('0x69')};var _0x411a6b=[];var _0x1bca25=[];var _0x57001f={};var _0x205025=![];return db[_0x999e('0x6a')][_0x999e('0x5b')]()[_0x999e('0x32')](function(_0x35a4e6){if(!_0x35a4e6){throw new db[(_0x999e('0x6b'))]['ValidationError']('no\x20available\x20attributes');}_0x411a6b=_[_0x999e('0x6c')](_[_0x999e('0x4c')](_0x35a4e6),['createdAt',_0x999e('0x6d')]);_0x1bca25=_[_0x999e('0x6c')](_['keys'](_0x35a4e6),[_0x999e('0x6e'),_0x999e('0x6d'),_0x999e('0x6f'),_0x999e('0x70')]);if(_0x270e37[_0x999e('0x52')]['id']){delete _0x270e37['body']['id'];}if(_[_0x999e('0x71')](_0x270e37[_0x999e('0x52')][_0x999e('0x72')])){throw new db[(_0x999e('0x6b'))][(_0x999e('0x73'))](_0x999e('0x74'));}if(_[_0x999e('0x71')](_0x270e37['body'][_0x999e('0x52')])||_0x270e37['body'][_0x999e('0x52')]===''){throw new db[(_0x999e('0x6b'))][(_0x999e('0x73'))](_0x999e('0x75'));}if(_[_0x999e('0x71')](_0x270e37[_0x999e('0x52')][_0x999e('0x76')])){throw new db[(_0x999e('0x6b'))][(_0x999e('0x73'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1bca25);}if(!_[_0x999e('0x77')](_0x1bca25,_0x270e37['body'][_0x999e('0x76')])){throw new db['Sequelize'][(_0x999e('0x73'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1bca25);}_0x57001f[_0x270e37['body'][_0x999e('0x76')]]=_0x270e37[_0x999e('0x52')]['from'];})['then'](function(){return db[_0x999e('0x3a')][_0x999e('0x50')]({'where':{'id':_0x270e37[_0x999e('0x5a')]['id']},'include':[{'model':db[_0x999e('0x78')],'as':_0x999e('0x79'),'include':[{'model':db['CmContact'],'as':_0x999e('0x7a'),'where':_0x57001f,'limit':0x1,'order':[['updatedAt',_0x999e('0x7b')]]}]},{'model':db[_0x999e('0x7c')],'as':_0x999e('0x7d')}]});})[_0x999e('0x32')](handleEntityNotFound(_0x6711f2,null))['then'](function(_0x121a36){if(_0x121a36&&_0x121a36[_0x999e('0x79')]){_0x1c663f[_0x999e('0x7e')]=_0x121a36;_0x1c663f[_0x999e('0x7f')]=_0x121a36[_0x999e('0x7d')];_0x1c663f[_0x999e('0x80')]=_0x121a36[_0x999e('0x79')];_0x1c663f[_0x999e('0x7f')]=_[_0x999e('0x81')](_0x1c663f['applications'],[_0x999e('0x82')],[_0x999e('0x83')]);if(_0x1c663f[_0x999e('0x7e')][_0x999e('0x7d')]){delete _0x1c663f[_0x999e('0x7e')][_0x999e('0x7d')];}if(_0x1c663f[_0x999e('0x7e')][_0x999e('0x79')]&&_0x1c663f['account'][_0x999e('0x79')]['Contacts'][_0x999e('0x44')]){return _0x1c663f[_0x999e('0x7e')]['List'][_0x999e('0x7a')][0x0];}var _0x1daa73=_[_0x999e('0x84')](_0x270e37[_0x999e('0x52')],{'firstName':_0x270e37[_0x999e('0x52')]['from'],'ListId':_0x121a36[_0x999e('0x70')]});_0x1daa73[_0x270e37['body']['mapKey']]=_0x270e37[_0x999e('0x52')][_0x999e('0x72')];return db[_0x999e('0x6a')]['create'](_0x1daa73,{'fields':_0x411a6b,'raw':!![]});}})[_0x999e('0x32')](handleEntityNotFound(_0x6711f2,null))[_0x999e('0x32')](function(_0x3a0f8a){_0x1c663f[_0x999e('0x85')]=_0x3a0f8a;if(_0x3a0f8a){var _0x28a9fe={'ContactId':_0x3a0f8a['id'],'OpenchannelAccountId':_0x270e37[_0x999e('0x5a')]['id'],'from':(_0x3a0f8a[_0x999e('0x86')]||'')+'\x20'+(_0x3a0f8a['lastName']||'')};var _0xe325ef={'OpenchannelAccountId':_0x270e37[_0x999e('0x5a')]['id'],'closed':![]};if(_0x270e37['body'][_0x999e('0x87')]){_0xe325ef['threadId']=_0x270e37[_0x999e('0x52')][_0x999e('0x87')];return db['OpenchannelInteraction']['find']({'where':_0xe325ef})['then'](function(_0x4ef767){if(_0x4ef767){return[_0x4ef767,![]];}_0x28a9fe['threadId']=_0x270e37['body'][_0x999e('0x87')];_0x28a9fe[_0x999e('0x88')]=_0x270e37[_0x999e('0x52')][_0x999e('0x88')];return db[_0x999e('0x89')][_0x999e('0x51')](_0x28a9fe)[_0x999e('0x32')](function(_0x308833){return[_0x308833,!![]];});});}else{_0xe325ef[_0x999e('0x87')]=null;}_0xe325ef[_0x999e('0x8a')]=_0x3a0f8a['id'];return db['OpenchannelInteraction'][_0x999e('0x50')]({'where':_0xe325ef})[_0x999e('0x32')](function(_0x47bd4f){if(_0x47bd4f){return[_0x47bd4f,![]];}return db[_0x999e('0x89')][_0x999e('0x51')](_0x28a9fe)[_0x999e('0x32')](function(_0x679600){return[_0x679600,!![]];});});}})[_0x999e('0x8b')](function(_0x3ba75b,_0x2f078a){if(_0x3ba75b){_0x205025=_0x2f078a;if(!_0x2f078a){var _0x283293={'from':(_0x1c663f[_0x999e('0x85')][_0x999e('0x86')]||'')+'\x20'+(_0x1c663f[_0x999e('0x85')][_0x999e('0x8c')]||'')};if(_0x270e37[_0x999e('0x52')]['threadId']&&_0x270e37[_0x999e('0x52')]['messageId']&&_0x270e37['body'][_0x999e('0x87')]!=_0x270e37['body'][_0x999e('0x8d')]){_0x283293['threadId']=_0x270e37[_0x999e('0x52')]['messageId'];}return _0x3ba75b[_0x999e('0x59')](_0x283293);}else{return _0x3ba75b;}}})['then'](function(_0x1f426f){_0x1c663f[_0x999e('0x8e')]=_0x1f426f['get']({'plain':!![]});_0x1c663f['interaction']['created']=_0x205025;if(_0x1c663f[_0x999e('0x8e')][_0x999e('0x8f')]){if(_0x1c663f[_0x999e('0x7e')]['autoclose']){_0x1c663f['applications'][_0x999e('0x90')]({'id':0x0,'priority':_0x1c663f['applications'][_0x999e('0x44')]+0x1,'app':_0x999e('0x91'),'appdata':_0x999e('0x92'),'interval':_0x999e('0x93')});}}return db[_0x999e('0x94')][_0x999e('0x51')]({'body':_0x270e37[_0x999e('0x52')][_0x999e('0x52')],'OpenchannelAccountId':_0x270e37[_0x999e('0x5a')]['id'],'OpenchannelInteractionId':_0x1f426f['id'],'direction':'in','ContactId':_0x1c663f[_0x999e('0x85')]['id'],'AttachmentId':_0x270e37['body'][_0x999e('0x95')]});})['then'](function(_0x916b94){_0x1c663f[_0x999e('0x27')]=_0x916b94;if(_0x1c663f['interaction'][_0x999e('0x96')]){return db[_0x999e('0x97')][_0x999e('0x50')]({'attributes':['id',_0x999e('0x4a')],'where':{'id':_0x1c663f['interaction'][_0x999e('0x96')]}})[_0x999e('0x32')](function(_0xf55b51){if(_0xf55b51){_0x1c663f[_0x999e('0x7f')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xf55b51[_0x999e('0x4a')]+','+(_0x1c663f[_0x999e('0x7e')][_0x999e('0x98')]||0xa),'interval':_0x999e('0x93')});_0x1c663f[_0x999e('0x99')]=![];}return respondWithRpcPromise(_0x999e('0x9a'),'startRouting',_0x1c663f);});}return respondWithRpcPromise(_0x999e('0x9a'),_0x999e('0x9b'),_0x1c663f);})['then'](function(_0x48add0){respondWithRpcPromise(_0x999e('0x9c'),_0x999e('0x9c'),{'event':_0x999e('0x68'),'message':_0x48add0},client9002);return _0x48add0;})['then'](respondWithResult(_0x6711f2,null))[_0x999e('0x29')](handleError(_0x6711f2,null));};exports[_0x999e('0x9d')]=function(_0x3aa0f5,_0x35801a,_0x53274d){return db[_0x999e('0x3a')][_0x999e('0x9e')]({'where':{'id':_0x3aa0f5[_0x999e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x35801a,null))['then'](function(_0x5bddbe){if(_0x5bddbe){return db[_0x999e('0x9f')]['transaction'](function(_0x46dc64){return db[_0x999e('0x7c')][_0x999e('0x33')]({'where':{'OpenchannelAccountId':_0x3aa0f5[_0x999e('0x5a')]['id']},'transaction':_0x46dc64})[_0x999e('0x32')](function(_0x40d565){var _0xe5807a=_[_0x999e('0x39')](_0x3aa0f5['body'],function(_0x54c72a){_0x54c72a[_0x999e('0x65')]=_0x3aa0f5[_0x999e('0x5a')]['id'];return _0x54c72a;});return db['OpenchannelApplication'][_0x999e('0xa0')](_0xe5807a,{'transaction':_0x46dc64});});})['then'](function(){return db['OpenchannelApplication'][_0x999e('0xa1')]({'where':{'OpenchannelAccountId':_0x3aa0f5[_0x999e('0x5a')]['id']},'order':_0x999e('0x82')});});}})[_0x999e('0x32')](respondWithResult(_0x35801a,null))[_0x999e('0x29')](handleError(_0x35801a,null));};exports[_0x999e('0xa2')]=function(_0x9adcb0,_0x3131a2,_0x31fa6c){var _0x4537ed={};var _0x173ce5={};var _0x4d1b2d;var _0x595b1e;return db[_0x999e('0x3a')][_0x999e('0x9e')]({'where':{'id':_0x9adcb0['params']['id']}})[_0x999e('0x32')](handleEntityNotFound(_0x3131a2,null))['then'](function(_0x437a8a){if(_0x437a8a){_0x4d1b2d=_0x437a8a;_0x173ce5[_0x999e('0x3e')]=_[_0x999e('0x4c')](db['OpenchannelApplication'][_0x999e('0x3b')]);_0x173ce5[_0x999e('0x3f')]=_[_0x999e('0x4c')](_0x9adcb0[_0x999e('0x3f')]);_0x173ce5[_0x999e('0x40')]=_['intersection'](_0x173ce5['model'],_0x173ce5[_0x999e('0x3f')]);_0x4537ed[_0x999e('0x42')]=_[_0x999e('0x41')](_0x173ce5[_0x999e('0x3e')],qs[_0x999e('0x43')](_0x9adcb0[_0x999e('0x3f')][_0x999e('0x43')]));_0x4537ed[_0x999e('0x42')]=_0x4537ed['attributes'][_0x999e('0x44')]?_0x4537ed[_0x999e('0x42')]:_0x173ce5[_0x999e('0x3e')];_0x4537ed[_0x999e('0x47')]=qs[_0x999e('0x5e')](_0x9adcb0[_0x999e('0x3f')]['sort']);_0x4537ed['where']=qs[_0x999e('0x40')](_[_0x999e('0x5f')](_0x9adcb0[_0x999e('0x3f')],_0x173ce5[_0x999e('0x40')]));if(_0x9adcb0[_0x999e('0x3f')][_0x999e('0x48')]){_0x4537ed[_0x999e('0x49')]=_[_0x999e('0x4e')](_0x4537ed[_0x999e('0x49')],{'$or':_[_0x999e('0x39')](_0x4537ed[_0x999e('0x42')],function(_0xc9f205){var _0xa94265={};_0xa94265[_0xc9f205]={'$like':'%'+_0x9adcb0['query'][_0x999e('0x48')]+'%'};return _0xa94265;})});}_0x4537ed=_[_0x999e('0x4e')]({},_0x4537ed,_0x9adcb0['options']);return _0x4d1b2d[_0x999e('0xa2')](_0x4537ed);}})[_0x999e('0x32')](function(_0x3f9e14){if(_0x3f9e14){_0x595b1e=_0x3f9e14[_0x999e('0x44')];if(!_0x9adcb0[_0x999e('0x3f')][_0x999e('0x45')](_0x999e('0x46'))){_0x4537ed[_0x999e('0x30')]=qs['limit'](_0x9adcb0[_0x999e('0x3f')][_0x999e('0x30')]);_0x4537ed['offset']=qs[_0x999e('0x2f')](_0x9adcb0[_0x999e('0x3f')][_0x999e('0x2f')]);}return _0x4d1b2d[_0x999e('0xa2')](_0x4537ed);}})['then'](function(_0x572d81){if(_0x572d81){return _0x572d81?{'count':_0x595b1e,'rows':_0x572d81}:null;}})[_0x999e('0x32')](respondWithResult(_0x3131a2,null))[_0x999e('0x29')](handleError(_0x3131a2,null));};exports[_0x999e('0xa3')]=function(_0x298c2c,_0x4c5a0c,_0x523113){var _0x69bc0={'raw':![],'where':{}};var _0x4ac5df={};var _0x5ce3ae={'count':0x0,'rows':[]};return db[_0x999e('0x3a')]['findOne']({'where':{'id':_0x298c2c['params']['id']}})[_0x999e('0x32')](handleEntityNotFound(_0x4c5a0c,null))['then'](function(_0x280f90){if(_0x280f90){_0x4ac5df[_0x999e('0x3e')]=_[_0x999e('0x4c')](db[_0x999e('0x89')][_0x999e('0x3b')]);_0x4ac5df['query']=_[_0x999e('0x4c')](_0x298c2c['query']);_0x4ac5df[_0x999e('0x40')]=_[_0x999e('0x41')](_0x4ac5df[_0x999e('0x3e')],_0x4ac5df[_0x999e('0x3f')]);_0x69bc0[_0x999e('0x42')]=_[_0x999e('0x41')](_0x4ac5df['model'],qs[_0x999e('0x43')](_0x298c2c[_0x999e('0x3f')][_0x999e('0x43')]));_0x69bc0[_0x999e('0x42')]=_0x69bc0[_0x999e('0x42')][_0x999e('0x44')]?_0x69bc0['attributes']:_0x4ac5df[_0x999e('0x3e')];if(!_0x298c2c[_0x999e('0x3f')]['hasOwnProperty'](_0x999e('0x46'))){_0x69bc0[_0x999e('0x30')]=qs[_0x999e('0x30')](_0x298c2c['query'][_0x999e('0x30')]);_0x69bc0[_0x999e('0x2f')]=qs['offset'](_0x298c2c['query'][_0x999e('0x2f')]);}_0x69bc0['order']=qs[_0x999e('0x5e')](_0x298c2c[_0x999e('0x3f')][_0x999e('0x5e')]);_0x69bc0[_0x999e('0x49')]=qs[_0x999e('0x40')](_['pick'](_0x298c2c['query'],_0x4ac5df[_0x999e('0x40')]));_0x69bc0[_0x999e('0x49')]['OpenchannelAccountId']=_0x280f90['id'];if(_0x298c2c[_0x999e('0x3f')][_0x999e('0x48')]){_0x69bc0['where']=_[_0x999e('0x4e')](_0x69bc0['where'],{'$or':_['map'](_0x69bc0['attributes'],function(_0x417e02){var _0x3c045e={};_0x3c045e[_0x417e02]={'$like':'%'+_0x298c2c['query']['filter']+'%'};return _0x3c045e;})});}_0x69bc0=_['merge']({},_0x69bc0,_0x298c2c[_0x999e('0x4f')]);return db['OpenchannelInteraction'][_0x999e('0x2e')]({'where':_0x69bc0[_0x999e('0x49')]})[_0x999e('0x32')](function(_0x978354){_0x5ce3ae[_0x999e('0x2e')]=_0x978354;if(_0x298c2c[_0x999e('0x3f')][_0x999e('0x4b')]){_0x69bc0[_0x999e('0x4d')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x999e('0x97')],'as':_0x999e('0xa4'),'attributes':[_0x999e('0x4a'),_0x999e('0xa5'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x999e('0xa6'),'attributes':['id',_0x999e('0x4a'),_0x999e('0xa7')],'where':_0x298c2c[_0x999e('0x3f')][_0x999e('0xa8')]?{'id':_0x298c2c['query'][_0x999e('0xa8')]}:undefined,'required':_0x298c2c[_0x999e('0x3f')][_0x999e('0xa8')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x999e('0x60')](_0x69bc0);})[_0x999e('0x32')](function(_0x5e2e22){_0x5ce3ae['rows']=_0x5e2e22;return _0x5ce3ae;});}})[_0x999e('0x32')](respondWithFilteredResult(_0x4c5a0c,_0x69bc0))['catch'](handleError(_0x4c5a0c,null));};exports['addAgents']=function(_0x237a69,_0x3729e1,_0x4f1e06){return db['OpenchannelAccount']['find']({'where':{'id':_0x237a69['params']['id']}})['then'](handleEntityNotFound(_0x3729e1,null))['then'](function(_0xd62f58){if(_0xd62f58){return _0xd62f58[_0x999e('0xa9')](_0x237a69[_0x999e('0x52')]['ids'],_[_0x999e('0xaa')](_0x237a69[_0x999e('0x52')],[_0x999e('0x63'),'id'])||{})['spread'](function(_0x3880cf){for(var _0x9934b1=0x0;_0x9934b1<_0x237a69[_0x999e('0x52')][_0x999e('0x63')][_0x999e('0x44')];_0x9934b1+=0x1){socket[_0x999e('0xab')]('userOpenchannelAccount:save',{'UserId':_0x237a69[_0x999e('0x52')]['ids'][_0x9934b1],'OpenchannelAccountId':_0x237a69[_0x999e('0x5a')]['id']});}return _0x3880cf;});}})[_0x999e('0x32')](respondWithResult(_0x3729e1,null))[_0x999e('0x29')](handleError(_0x3729e1,null));};exports[_0x999e('0xac')]=function(_0xd11363,_0x2ce8f2,_0x571eb6){return db[_0x999e('0x3a')][_0x999e('0x50')]({'where':{'id':_0xd11363['params']['id']}})[_0x999e('0x32')](handleEntityNotFound(_0x2ce8f2,null))['then'](function(_0x4b9bb6){if(_0x4b9bb6){return _0x4b9bb6[_0x999e('0xac')](_0xd11363[_0x999e('0x3f')][_0x999e('0x63')])['then'](function(){if(_['isArray'](_0xd11363[_0x999e('0x3f')][_0x999e('0x63')])){for(var _0x2b0cef=0x0;_0x2b0cef<_0xd11363[_0x999e('0x3f')][_0x999e('0x63')]['length'];_0x2b0cef+=0x1){socket[_0x999e('0xab')](_0x999e('0xad'),{'UserId':Number(_0xd11363[_0x999e('0x3f')][_0x999e('0x63')][_0x2b0cef]),'OpenchannelAccountId':Number(_0xd11363[_0x999e('0x5a')]['id'])});}}else{socket['emit'](_0x999e('0xad'),{'UserId':Number(_0xd11363[_0x999e('0x3f')][_0x999e('0x63')]),'OpenchannelAccountId':Number(_0xd11363[_0x999e('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2ce8f2,null))[_0x999e('0x29')](handleError(_0x2ce8f2,null));};exports['getAgents']=function(_0x1f78e5,_0x29925d,_0x5e4997){var _0x57ef3b={};var _0x2c7f82={};var _0x16e0e7;var _0x8ac34a;return db[_0x999e('0x3a')][_0x999e('0x9e')]({'where':{'id':_0x1f78e5['params']['id']}})[_0x999e('0x32')](handleEntityNotFound(_0x29925d,null))[_0x999e('0x32')](function(_0xdfed5){if(_0xdfed5){_0x16e0e7=_0xdfed5;_0x2c7f82['model']=_[_0x999e('0x4c')](db['User'][_0x999e('0x3b')]);_0x2c7f82[_0x999e('0x3f')]=_[_0x999e('0x4c')](_0x1f78e5[_0x999e('0x3f')]);_0x2c7f82['filters']=_['intersection'](_0x2c7f82[_0x999e('0x3e')],_0x2c7f82[_0x999e('0x3f')]);_0x57ef3b[_0x999e('0x42')]=_[_0x999e('0x41')](_0x2c7f82[_0x999e('0x3e')],qs[_0x999e('0x43')](_0x1f78e5[_0x999e('0x3f')]['fields']));_0x57ef3b[_0x999e('0x42')]=_0x57ef3b['attributes']['length']?_0x57ef3b[_0x999e('0x42')]:_0x2c7f82[_0x999e('0x3e')];_0x57ef3b[_0x999e('0x47')]=qs[_0x999e('0x5e')](_0x1f78e5[_0x999e('0x3f')]['sort']);_0x57ef3b[_0x999e('0x49')]=qs[_0x999e('0x40')](_[_0x999e('0x5f')](_0x1f78e5[_0x999e('0x3f')],_0x2c7f82['filters']));if(_0x1f78e5[_0x999e('0x3f')][_0x999e('0x48')]){_0x57ef3b[_0x999e('0x49')]=_['merge'](_0x57ef3b[_0x999e('0x49')],{'$or':_[_0x999e('0x39')](_0x57ef3b[_0x999e('0x42')],function(_0x1eb6a8){var _0x506e79={};_0x506e79[_0x1eb6a8]={'$like':'%'+_0x1f78e5[_0x999e('0x3f')][_0x999e('0x48')]+'%'};return _0x506e79;})});}_0x57ef3b=_[_0x999e('0x4e')]({},_0x57ef3b,_0x1f78e5[_0x999e('0x4f')]);return _0x16e0e7[_0x999e('0xae')](_0x57ef3b);}})[_0x999e('0x32')](function(_0x2b3da2){if(_0x2b3da2){_0x8ac34a=_0x2b3da2[_0x999e('0x44')];if(!_0x1f78e5['query'][_0x999e('0x45')]('nolimit')){_0x57ef3b['limit']=qs[_0x999e('0x30')](_0x1f78e5[_0x999e('0x3f')][_0x999e('0x30')]);_0x57ef3b[_0x999e('0x2f')]=qs['offset'](_0x1f78e5[_0x999e('0x3f')][_0x999e('0x2f')]);}return _0x16e0e7['getAgents'](_0x57ef3b);}})[_0x999e('0x32')](function(_0x4362d5){if(_0x4362d5){return _0x4362d5?{'count':_0x8ac34a,'rows':_0x4362d5}:null;}})[_0x999e('0x32')](respondWithResult(_0x29925d,null))[_0x999e('0x29')](handleError(_0x29925d,null));};exports[_0x999e('0x36')]=function(_0x558aa6,_0xdba71,_0x5ea583){var _0x11ea45,_0x416e80,_0x462025;if(_[_0x999e('0x71')](_0x558aa6[_0x999e('0x52')][_0x999e('0x52')])||_0x558aa6[_0x999e('0x52')][_0x999e('0x52')]===''){throw new db['Sequelize'][(_0x999e('0x73'))](_0x999e('0x75'));}if(_['isNil'](_0x558aa6[_0x999e('0x52')]['to'])){}_0x11ea45=_0x558aa6['body']['to'];return db[_0x999e('0x3a')]['findOne']({'where':{'id':_0x558aa6['params']['id']}})[_0x999e('0x32')](handleEntityNotFound(_0xdba71,null))[_0x999e('0x32')](function(_0x4b26eb){if(_0x4b26eb){return db[_0x999e('0x3a')][_0x999e('0x50')]({'where':{'id':_0x4b26eb['id']},'include':[{'model':db[_0x999e('0x78')],'as':_0x999e('0x79'),'include':[{'model':db[_0x999e('0x6a')],'as':_0x999e('0x7a'),'where':{[_0x4b26eb[_0x999e('0x76')]]:_0x11ea45},'limit':0x1,'order':[[_0x999e('0x6d'),'DESC']]}]}]})[_0x999e('0x32')](handleEntityNotFound(_0xdba71,null))[_0x999e('0x32')](function(_0x4ac842){if(_0x4ac842&&_0x4ac842['List']){_0x416e80=_0x4ac842[_0x999e('0x34')]({'plain':!![]});if(_0x416e80['List']&&_0x416e80[_0x999e('0x79')][_0x999e('0x7a')][_0x999e('0x44')]){return _0x416e80[_0x999e('0x79')]['Contacts'][0x0];}return db['CmContact'][_0x999e('0x51')](_[_0x999e('0x84')](_0x558aa6[_0x999e('0x52')],{'firstName':_0x11ea45,[_0x4ac842[_0x999e('0x76')]]:_0x11ea45,'phone':_0x11ea45,'ListId':_0x416e80[_0x999e('0x70')]}));}})[_0x999e('0x32')](handleEntityNotFound(_0xdba71,null))[_0x999e('0x32')](function(_0x1caedb){if(_0x1caedb){_0x462025=_0x1caedb;return db['OpenchannelInteraction'][_0x999e('0x50')]({'where':{'ContactId':_0x462025['id'],'closed':![],'OpenchannelAccountId':_0x416e80['id']}})[_0x999e('0x32')](function(_0x4da0bc){if(_0x4da0bc){return[_0x4da0bc,![]];}return db[_0x999e('0x89')][_0x999e('0x51')]({'UserId':_0x558aa6['user']['id'],'ContactId':_0x462025['id'],'OpenchannelAccountId':_0x416e80['id'],'lastMsgDirection':_0x999e('0xaf'),'Messages':[_[_0x999e('0x4e')](_0x558aa6[_0x999e('0x52')],{'read':![],'body':_0x558aa6[_0x999e('0x52')]['body'],'OpenchannelAccountId':_0x416e80['id'],'UserId':_0x558aa6[_0x999e('0x55')]['id'],'ContactId':_0x462025['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x999e('0xb0')}]})[_0x999e('0x32')](function(_0x443796){return[_0x443796,!![]];});});}})['spread'](function(_0x5ef7ba,_0x3f3c6c){if(_0x3f3c6c){return _0x5ef7ba;}return db[_0x999e('0x94')]['create'](_[_0x999e('0x4e')](_0x558aa6[_0x999e('0x52')],{'read':![],'body':_0x558aa6[_0x999e('0x52')][_0x999e('0x52')],'OpenchannelAccountId':_0x416e80['id'],'OpenchannelInteractionId':_0x5ef7ba['id'],'UserId':_0x558aa6['user']['id'],'ContactId':_0x462025['id']}))[_0x999e('0x32')](function(_0x4952cc){_0x5ef7ba[_0x999e('0xb1')][_0x999e('0xb0')]=[];_0x5ef7ba[_0x999e('0xb1')][_0x999e('0xb0')][_0x999e('0x90')](_0x4952cc[_0x999e('0xb1')]);return _0x5ef7ba;});});}})[_0x999e('0x32')](respondWithResult(_0xdba71,null))[_0x999e('0x29')](handleError(_0xdba71,null));}; \ No newline at end of file +var _0x00b3=['CmList','updatedAt','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','end','status','json','offset','limit','Content-Range','apply','save','then','destroy','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','count','include','findAll','rows','show','params','filtears','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','update','body','describe','addDisposition','Disposition','OpenchannelAccountId','filter','removeDispositions','ids','getAnswers','findOne','CannedAnswer','notify','openchannel','CmContact','Sequelize','ValidationError','difference','createdAt','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','List','Contacts','DESC','account','list','applications','priority','asc','Applications','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','autoclose','push','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','addApplications','sequelize','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents'];(function(_0x15f343,_0x13f3d8){var _0x1d9c11=function(_0x294848){while(--_0x294848){_0x15f343['push'](_0x15f343['shift']());}};_0x1d9c11(++_0x13f3d8);}(_0x00b3,0x17a));var _0x300b=function(_0xcd0cd8,_0x53845a){_0xcd0cd8=_0xcd0cd8-0x0;var _0x4154f0=_0x00b3[_0xcd0cd8];return _0x4154f0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x300b('0x0'));var rimraf=require(_0x300b('0x1'));var zipdir=require(_0x300b('0x2'));var jsonpatch=require(_0x300b('0x3'));var rp=require('request-promise');var moment=require(_0x300b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x300b('0x5'));var util=require('util');var path=require(_0x300b('0x6'));var sox=require(_0x300b('0x7'));var csv=require(_0x300b('0x8'));var ejs=require(_0x300b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x300b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x300b('0x8'));var querystring=require(_0x300b('0xb'));var Papa=require(_0x300b('0xc'));var Redis=require('ioredis');var authService=require(_0x300b('0xd'));var qs=require(_0x300b('0xe'));var as=require(_0x300b('0xf'));var hardwareService=require(_0x300b('0x10'));var logger=require('../../config/logger')(_0x300b('0x11'));var utils=require(_0x300b('0x12'));var config=require(_0x300b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x300b('0x14'))['db'];config[_0x300b('0x15')]=_[_0x300b('0x16')](config[_0x300b('0x15')],{'host':_0x300b('0x17'),'port':0x18eb});var socket=require(_0x300b('0x18'))(new Redis(config[_0x300b('0x15')]));require(_0x300b('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x300b('0x1a')][_0x300b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xfb49f,_0xd252fa,_0x51186d,_0x509089){return new BPromise(function(_0x35b1d7,_0x2d4455){var _0x2fed99=_0x509089||client;return _0x2fed99[_0x300b('0x1c')](_0xfb49f,_0x51186d)['then'](function(_0x1fbf16){logger[_0x300b('0x1d')](_0x300b('0x1e'),_0xd252fa,'request\x20sent');logger[_0x300b('0x1f')](_0x300b('0x20'),_0xd252fa,_0x300b('0x21'),JSON[_0x300b('0x22')](_0x1fbf16));if(_0x1fbf16['error']){if(_0x1fbf16[_0x300b('0x23')][_0x300b('0x24')]===0x1f4){logger[_0x300b('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0xd252fa,_0x1fbf16[_0x300b('0x23')][_0x300b('0x25')]);return _0x2d4455(_0x1fbf16[_0x300b('0x23')][_0x300b('0x25')]);}logger[_0x300b('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0xd252fa,_0x1fbf16['error'][_0x300b('0x25')]);return _0x35b1d7(_0x1fbf16[_0x300b('0x23')][_0x300b('0x25')]);}else{logger[_0x300b('0x1d')](_0x300b('0x1e'),_0xd252fa,_0x300b('0x21'));_0x35b1d7(_0x1fbf16[_0x300b('0x26')][_0x300b('0x25')]);}})[_0x300b('0x27')](function(_0x544658){logger[_0x300b('0x23')](_0x300b('0x1e'),_0xd252fa,_0x544658);_0x2d4455(_0x544658);});});}function respondWithStatusCode(_0x260bdc,_0x43c480){_0x43c480=_0x43c480||0xcc;return function(_0x4cce77){if(_0x4cce77){return _0x260bdc['sendStatus'](_0x43c480);}return _0x260bdc['status'](_0x43c480)[_0x300b('0x28')]();};}function respondWithResult(_0x4a1300,_0x1241c7){_0x1241c7=_0x1241c7||0xc8;return function(_0x2496e0){if(_0x2496e0){return _0x4a1300[_0x300b('0x29')](_0x1241c7)[_0x300b('0x2a')](_0x2496e0);}};}function respondWithFilteredResult(_0x2d2ea7,_0x10ed6b){return function(_0x165f56){if(_0x165f56){var _0x159b63=_0x165f56['count'],_0x1cdc8b=_0x10ed6b[_0x300b('0x2b')],_0x3210cd=_0x10ed6b[_0x300b('0x2b')]+_0x10ed6b[_0x300b('0x2c')],_0x485952;if(_0x3210cd>=_0x159b63){_0x3210cd=_0x159b63;_0x485952=0xc8;}else{_0x485952=0xce;}_0x2d2ea7[_0x300b('0x29')](_0x485952);return _0x2d2ea7['set'](_0x300b('0x2d'),_0x1cdc8b+'-'+_0x3210cd+'/'+_0x159b63)['json'](_0x165f56);}return null;};}function patchUpdates(_0x4907da){return function(_0x53ed0c){try{jsonpatch[_0x300b('0x2e')](_0x53ed0c,_0x4907da,!![]);}catch(_0x1475e7){return BPromise['reject'](_0x1475e7);}return _0x53ed0c[_0x300b('0x2f')]();};}function saveUpdates(_0x39007c,_0x4f3cbf){return function(_0x44be92){if(_0x44be92){return _0x44be92['update'](_0x39007c)[_0x300b('0x30')](function(_0x2572c7){return _0x2572c7;});}return null;};}function removeEntity(_0xdad35f,_0x226be8){return function(_0x8ff6e7){if(_0x8ff6e7){return _0x8ff6e7[_0x300b('0x31')]()[_0x300b('0x30')](function(){var _0x4bac3b=_0x8ff6e7[_0x300b('0x32')]({'plain':!![]});var _0x57c44e=_0x300b('0x33');return db[_0x300b('0x34')]['destroy']({'where':{'type':_0x57c44e,'resourceId':_0x4bac3b['id']}})[_0x300b('0x30')](function(){return _0x8ff6e7;});})[_0x300b('0x30')](function(){_0xdad35f['status'](0xcc)[_0x300b('0x28')]();});}};}function handleEntityNotFound(_0x105865,_0x2e0bc2){return function(_0x534874){if(!_0x534874){_0x105865[_0x300b('0x35')](0x194);}return _0x534874;};}function handleError(_0x9f9c82,_0xf5874){_0xf5874=_0xf5874||0x1f4;return function(_0xfe18bc){logger[_0x300b('0x23')](_0xfe18bc[_0x300b('0x36')]);if(_0xfe18bc[_0x300b('0x37')]){delete _0xfe18bc['name'];}_0x9f9c82[_0x300b('0x29')](_0xf5874)[_0x300b('0x38')](_0xfe18bc);};}exports['index']=function(_0x3364e5,_0x5dc5e2){var _0x5987da={'include':[{'model':db[_0x300b('0x39')],'as':_0x300b('0x3a')}]},_0x2db646={},_0x393017={'count':0x0,'rows':[]};var _0xa9c0bf=_['map'](db[_0x300b('0x3b')][_0x300b('0x3c')],function(_0x55b4da){return{'name':_0x55b4da[_0x300b('0x3d')],'type':_0x55b4da['type'][_0x300b('0x3e')]};});_0x2db646[_0x300b('0x3f')]=_[_0x300b('0x40')](_0xa9c0bf,_0x300b('0x37'));_0x2db646[_0x300b('0x41')]=_[_0x300b('0x42')](_0x3364e5[_0x300b('0x41')]);_0x2db646[_0x300b('0x43')]=_[_0x300b('0x44')](_0x2db646[_0x300b('0x3f')],_0x2db646[_0x300b('0x41')]);_0x5987da['attributes']=_['intersection'](_0x2db646[_0x300b('0x3f')],qs['fields'](_0x3364e5['query'][_0x300b('0x45')]));_0x5987da[_0x300b('0x46')]=_0x5987da[_0x300b('0x46')]['length']?_0x5987da[_0x300b('0x46')]:_0x2db646['model'];if(!_0x3364e5['query'][_0x300b('0x47')](_0x300b('0x48'))){_0x5987da['limit']=qs[_0x300b('0x2c')](_0x3364e5[_0x300b('0x41')]['limit']);_0x5987da[_0x300b('0x2b')]=qs[_0x300b('0x2b')](_0x3364e5['query'][_0x300b('0x2b')]);}_0x5987da[_0x300b('0x49')]=qs[_0x300b('0x4a')](_0x3364e5[_0x300b('0x41')][_0x300b('0x4a')]);_0x5987da[_0x300b('0x4b')]=qs[_0x300b('0x43')](_[_0x300b('0x4c')](_0x3364e5['query'],_0x2db646['filters']),_0xa9c0bf);if(_0x3364e5[_0x300b('0x41')]['filter']){_0x5987da['where']=_[_0x300b('0x4d')](_0x5987da[_0x300b('0x4b')],{'$or':_[_0x300b('0x40')](_0xa9c0bf,function(_0x291581){if(_0x291581[_0x300b('0x4e')]!==_0x300b('0x4f')){var _0x54c705={};_0x54c705[_0x291581[_0x300b('0x37')]]={'$like':'%'+_0x3364e5['query']['filter']+'%'};return _0x54c705;}})});}_0x5987da=_[_0x300b('0x4d')]({},_0x5987da,_0x3364e5[_0x300b('0x50')]);var _0x5814dc={'where':_0x5987da[_0x300b('0x4b')]};return db[_0x300b('0x3b')][_0x300b('0x51')](_0x5814dc)[_0x300b('0x30')](function(_0x5e1c1a){_0x393017[_0x300b('0x51')]=_0x5e1c1a;if(_0x3364e5[_0x300b('0x41')]['includeAll']){_0x5987da[_0x300b('0x52')]=[{'all':!![]}];}return db[_0x300b('0x3b')][_0x300b('0x53')](_0x5987da);})['then'](function(_0x27c57d){_0x393017[_0x300b('0x54')]=_0x27c57d;return _0x393017;})[_0x300b('0x30')](respondWithFilteredResult(_0x5dc5e2,_0x5987da))[_0x300b('0x27')](handleError(_0x5dc5e2,null));};exports[_0x300b('0x55')]=function(_0x44da96,_0x418ac3){var _0x3dd25c={'raw':![],'where':{'id':_0x44da96[_0x300b('0x56')]['id']},'include':[{'model':db[_0x300b('0x39')],'as':_0x300b('0x3a')}]},_0x186519={};_0x186519[_0x300b('0x3f')]=_['keys'](db['OpenchannelAccount'][_0x300b('0x3c')]);_0x186519[_0x300b('0x41')]=_[_0x300b('0x42')](_0x44da96['query']);_0x186519[_0x300b('0x57')]=_['intersection'](_0x186519[_0x300b('0x3f')],_0x186519[_0x300b('0x41')]);_0x3dd25c['attributes']=_[_0x300b('0x44')](_0x186519[_0x300b('0x3f')],qs[_0x300b('0x45')](_0x44da96[_0x300b('0x41')]['fields']));_0x3dd25c[_0x300b('0x46')]=_0x3dd25c['attributes'][_0x300b('0x58')]?_0x3dd25c[_0x300b('0x46')]:_0x186519[_0x300b('0x3f')];if(_0x44da96[_0x300b('0x41')][_0x300b('0x59')]){_0x3dd25c[_0x300b('0x52')]=[{'all':!![]}];}_0x3dd25c=_[_0x300b('0x4d')]({},_0x3dd25c,_0x44da96[_0x300b('0x50')]);return db[_0x300b('0x3b')][_0x300b('0x5a')](_0x3dd25c)[_0x300b('0x30')](handleEntityNotFound(_0x418ac3,null))[_0x300b('0x30')](respondWithResult(_0x418ac3,null))[_0x300b('0x27')](handleError(_0x418ac3,null));};exports[_0x300b('0x5b')]=function(_0x545255,_0x35c20d){return db[_0x300b('0x3b')]['create'](_0x545255['body'],{})[_0x300b('0x30')](function(_0x23e11e){var _0x1b98bc=_0x545255[_0x300b('0x5c')][_0x300b('0x32')]({'plain':!![]});if(!_0x1b98bc)throw new Error(_0x300b('0x5d'));if(_0x1b98bc[_0x300b('0x5e')]==='user'){var _0xff003a=_0x23e11e[_0x300b('0x32')]({'plain':!![]});var _0x48be98=_0x300b('0x33');return db['UserProfileSection'][_0x300b('0x5a')]({'where':{'name':_0x48be98,'userProfileId':_0x1b98bc[_0x300b('0x5f')]},'raw':!![]})[_0x300b('0x30')](function(_0x551bb3){if(_0x551bb3&&_0x551bb3[_0x300b('0x60')]===0x0){return db[_0x300b('0x34')][_0x300b('0x5b')]({'name':_0xff003a[_0x300b('0x37')],'resourceId':_0xff003a['id'],'type':_0x551bb3['name'],'sectionId':_0x551bb3['id']},{})[_0x300b('0x30')](function(){return _0x23e11e;});}else{return _0x23e11e;}})['catch'](function(_0x18b763){logger[_0x300b('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18b763);throw _0x18b763;});}return _0x23e11e;})[_0x300b('0x30')](respondWithResult(_0x35c20d,0xc9))[_0x300b('0x27')](handleError(_0x35c20d,null));};exports[_0x300b('0x61')]=function(_0x4f8881,_0xd71d40){if(_0x4f8881[_0x300b('0x62')]['id']){delete _0x4f8881['body']['id'];}return db[_0x300b('0x3b')]['find']({'where':{'id':_0x4f8881[_0x300b('0x56')]['id']},'include':[{'model':db[_0x300b('0x39')],'as':_0x300b('0x3a')}]})[_0x300b('0x30')](handleEntityNotFound(_0xd71d40,null))[_0x300b('0x30')](saveUpdates(_0x4f8881[_0x300b('0x62')],null))[_0x300b('0x30')](respondWithResult(_0xd71d40,null))[_0x300b('0x27')](handleError(_0xd71d40,null));};exports[_0x300b('0x31')]=function(_0x3d7e4d,_0x187203){return db[_0x300b('0x3b')][_0x300b('0x5a')]({'where':{'id':_0x3d7e4d[_0x300b('0x56')]['id']}})[_0x300b('0x30')](handleEntityNotFound(_0x187203,null))[_0x300b('0x30')](removeEntity(_0x187203,null))[_0x300b('0x27')](handleError(_0x187203,null));};exports[_0x300b('0x63')]=function(_0x36b300,_0x105e1e){return db[_0x300b('0x3b')][_0x300b('0x63')]()[_0x300b('0x30')](respondWithResult(_0x105e1e,null))['catch'](handleError(_0x105e1e,null));};exports[_0x300b('0x64')]=function(_0x5022d5,_0x1db494,_0x157d8e){if(_0x5022d5[_0x300b('0x62')]['id']){delete _0x5022d5[_0x300b('0x62')]['id'];}return db[_0x300b('0x3b')][_0x300b('0x5a')]({'where':{'id':_0x5022d5[_0x300b('0x56')]['id']}})[_0x300b('0x30')](handleEntityNotFound(_0x1db494,null))['then'](function(_0xd7a047){if(_0xd7a047){_0x5022d5['body']['OpenchannelAccountId']=_0xd7a047['id'];return db[_0x300b('0x65')][_0x300b('0x5b')](_0x5022d5[_0x300b('0x62')]);}})[_0x300b('0x30')](respondWithResult(_0x1db494,null))[_0x300b('0x27')](handleError(_0x1db494,null));};exports['getDispositions']=function(_0x413c0d,_0x33f571,_0x28fa1f){var _0x24c09f={'raw':![],'where':{}};var _0x135a4a={};var _0x2760a5={'count':0x0,'rows':[]};return db[_0x300b('0x3b')]['findOne']({'where':{'id':_0x413c0d[_0x300b('0x56')]['id']}})[_0x300b('0x30')](handleEntityNotFound(_0x33f571,null))[_0x300b('0x30')](function(_0x2d15c5){if(_0x2d15c5){_0x135a4a[_0x300b('0x3f')]=_[_0x300b('0x42')](db[_0x300b('0x65')][_0x300b('0x3c')]);_0x135a4a['query']=_['keys'](_0x413c0d[_0x300b('0x41')]);_0x135a4a[_0x300b('0x43')]=_[_0x300b('0x44')](_0x135a4a[_0x300b('0x3f')],_0x135a4a[_0x300b('0x41')]);_0x24c09f[_0x300b('0x46')]=_[_0x300b('0x44')](_0x135a4a[_0x300b('0x3f')],qs[_0x300b('0x45')](_0x413c0d[_0x300b('0x41')][_0x300b('0x45')]));_0x24c09f['attributes']=_0x24c09f['attributes'][_0x300b('0x58')]?_0x24c09f[_0x300b('0x46')]:_0x135a4a[_0x300b('0x3f')];if(!_0x413c0d['query'][_0x300b('0x47')]('nolimit')){_0x24c09f['limit']=qs[_0x300b('0x2c')](_0x413c0d[_0x300b('0x41')][_0x300b('0x2c')]);_0x24c09f[_0x300b('0x2b')]=qs['offset'](_0x413c0d['query'][_0x300b('0x2b')]);}_0x24c09f[_0x300b('0x49')]=qs[_0x300b('0x4a')](_0x413c0d[_0x300b('0x41')][_0x300b('0x4a')]);_0x24c09f[_0x300b('0x4b')]=qs[_0x300b('0x43')](_[_0x300b('0x4c')](_0x413c0d[_0x300b('0x41')],_0x135a4a['filters']));_0x24c09f['where'][_0x300b('0x66')]=_0x2d15c5['id'];if(_0x413c0d['query']['filter']){_0x24c09f[_0x300b('0x4b')]=_[_0x300b('0x4d')](_0x24c09f[_0x300b('0x4b')],{'$or':_['map'](_0x24c09f[_0x300b('0x46')],function(_0x2521ba){var _0x58f104={};_0x58f104[_0x2521ba]={'$like':'%'+_0x413c0d[_0x300b('0x41')][_0x300b('0x67')]+'%'};return _0x58f104;})});}_0x24c09f=_[_0x300b('0x4d')]({},_0x24c09f,_0x413c0d[_0x300b('0x50')]);return db[_0x300b('0x65')][_0x300b('0x51')]({'where':_0x24c09f['where']})['then'](function(_0x4d515d){_0x2760a5[_0x300b('0x51')]=_0x4d515d;if(_0x413c0d[_0x300b('0x41')][_0x300b('0x59')]){_0x24c09f[_0x300b('0x52')]=[{'all':!![]}];}return db[_0x300b('0x65')]['findAll'](_0x24c09f);})[_0x300b('0x30')](function(_0x4668e3){_0x2760a5['rows']=_0x4668e3;return _0x2760a5;});}})[_0x300b('0x30')](respondWithFilteredResult(_0x33f571,_0x24c09f))[_0x300b('0x27')](handleError(_0x33f571,null));};exports[_0x300b('0x68')]=function(_0x24b158,_0x348e2c,_0x44d48a){return db[_0x300b('0x3b')]['find']({'where':{'id':_0x24b158['params']['id']}})[_0x300b('0x30')](handleEntityNotFound(_0x348e2c,null))[_0x300b('0x30')](function(_0x3032d2){if(_0x3032d2){return _0x3032d2[_0x300b('0x68')](_0x24b158['query'][_0x300b('0x69')]);}})['then'](respondWithStatusCode(_0x348e2c,null))[_0x300b('0x27')](handleError(_0x348e2c,null));};exports['addAnswer']=function(_0x546cbc,_0x390850,_0x4b9d4e){if(_0x546cbc['body']['id']){delete _0x546cbc[_0x300b('0x62')]['id'];}return db[_0x300b('0x3b')][_0x300b('0x5a')]({'where':{'id':_0x546cbc[_0x300b('0x56')]['id']}})[_0x300b('0x30')](handleEntityNotFound(_0x390850,null))[_0x300b('0x30')](function(_0x23e93e){if(_0x23e93e){_0x546cbc[_0x300b('0x62')][_0x300b('0x66')]=_0x23e93e['id'];return db['CannedAnswer'][_0x300b('0x5b')](_0x546cbc[_0x300b('0x62')]);}})[_0x300b('0x30')](respondWithResult(_0x390850,null))[_0x300b('0x27')](handleError(_0x390850,null));};exports[_0x300b('0x6a')]=function(_0x4a9197,_0x3fd0f8,_0x42f7c6){var _0x1ec36d={'raw':![],'where':{}};var _0x1090df={};var _0x2761f2={'count':0x0,'rows':[]};return db[_0x300b('0x3b')][_0x300b('0x6b')]({'where':{'id':_0x4a9197[_0x300b('0x56')]['id']}})[_0x300b('0x30')](handleEntityNotFound(_0x3fd0f8,null))[_0x300b('0x30')](function(_0x23481b){if(_0x23481b){_0x1090df[_0x300b('0x3f')]=_[_0x300b('0x42')](db[_0x300b('0x6c')]['rawAttributes']);_0x1090df[_0x300b('0x41')]=_[_0x300b('0x42')](_0x4a9197[_0x300b('0x41')]);_0x1090df[_0x300b('0x43')]=_[_0x300b('0x44')](_0x1090df[_0x300b('0x3f')],_0x1090df[_0x300b('0x41')]);_0x1ec36d[_0x300b('0x46')]=_[_0x300b('0x44')](_0x1090df['model'],qs[_0x300b('0x45')](_0x4a9197[_0x300b('0x41')][_0x300b('0x45')]));_0x1ec36d['attributes']=_0x1ec36d['attributes'][_0x300b('0x58')]?_0x1ec36d[_0x300b('0x46')]:_0x1090df[_0x300b('0x3f')];if(!_0x4a9197[_0x300b('0x41')]['hasOwnProperty']('nolimit')){_0x1ec36d['limit']=qs[_0x300b('0x2c')](_0x4a9197['query'][_0x300b('0x2c')]);_0x1ec36d[_0x300b('0x2b')]=qs['offset'](_0x4a9197[_0x300b('0x41')]['offset']);}_0x1ec36d[_0x300b('0x49')]=qs[_0x300b('0x4a')](_0x4a9197['query'][_0x300b('0x4a')]);_0x1ec36d[_0x300b('0x4b')]=qs[_0x300b('0x43')](_[_0x300b('0x4c')](_0x4a9197[_0x300b('0x41')],_0x1090df['filters']));_0x1ec36d['where']['OpenchannelAccountId']=_0x23481b['id'];if(_0x4a9197['query']['filter']){_0x1ec36d[_0x300b('0x4b')]=_[_0x300b('0x4d')](_0x1ec36d['where'],{'$or':_['map'](_0x1ec36d[_0x300b('0x46')],function(_0x1b9f16){var _0x191754={};_0x191754[_0x1b9f16]={'$like':'%'+_0x4a9197[_0x300b('0x41')][_0x300b('0x67')]+'%'};return _0x191754;})});}_0x1ec36d=_[_0x300b('0x4d')]({},_0x1ec36d,_0x4a9197[_0x300b('0x50')]);return db['CannedAnswer']['count']({'where':_0x1ec36d[_0x300b('0x4b')]})[_0x300b('0x30')](function(_0x1d3701){_0x2761f2[_0x300b('0x51')]=_0x1d3701;if(_0x4a9197[_0x300b('0x41')]['includeAll']){_0x1ec36d[_0x300b('0x52')]=[{'all':!![]}];}return db[_0x300b('0x6c')][_0x300b('0x53')](_0x1ec36d);})[_0x300b('0x30')](function(_0x1bda9b){_0x2761f2[_0x300b('0x54')]=_0x1bda9b;return _0x2761f2;});}})[_0x300b('0x30')](respondWithFilteredResult(_0x3fd0f8,_0x1ec36d))[_0x300b('0x27')](handleError(_0x3fd0f8,null));};exports['removeAnswers']=function(_0x50e09f,_0x53a16e,_0x9d2d6a){return db[_0x300b('0x3b')][_0x300b('0x5a')]({'where':{'id':_0x50e09f[_0x300b('0x56')]['id']}})[_0x300b('0x30')](handleEntityNotFound(_0x53a16e,null))[_0x300b('0x30')](function(_0x467f81){if(_0x467f81){return _0x467f81['removeAnswers'](_0x50e09f[_0x300b('0x41')][_0x300b('0x69')]);}})[_0x300b('0x30')](respondWithStatusCode(_0x53a16e,null))[_0x300b('0x27')](handleError(_0x53a16e,null));};exports[_0x300b('0x6d')]=function(_0x1a1843,_0x546321,_0x4b0eef){var _0x2b8fe3={'body':_0x1a1843[_0x300b('0x62')],'channel':_0x300b('0x6e')};var _0x1f2325=[];var _0x51807d=[];var _0x3c3f30={};var _0x2f2722=![];return db[_0x300b('0x6f')]['describe']()[_0x300b('0x30')](function(_0x49973f){if(!_0x49973f){throw new db[(_0x300b('0x70'))][(_0x300b('0x71'))]('no\x20available\x20attributes');}_0x1f2325=_[_0x300b('0x72')](_['keys'](_0x49973f),['createdAt','updatedAt']);_0x51807d=_[_0x300b('0x72')](_[_0x300b('0x42')](_0x49973f),[_0x300b('0x73'),'updatedAt','CompanyId',_0x300b('0x74')]);if(_0x1a1843[_0x300b('0x62')]['id']){delete _0x1a1843[_0x300b('0x62')]['id'];}if(_[_0x300b('0x75')](_0x1a1843[_0x300b('0x62')][_0x300b('0x76')])){throw new db[(_0x300b('0x70'))][(_0x300b('0x71'))](_0x300b('0x77'));}if(_[_0x300b('0x75')](_0x1a1843['body'][_0x300b('0x62')])||_0x1a1843[_0x300b('0x62')][_0x300b('0x62')]===''){throw new db[(_0x300b('0x70'))][(_0x300b('0x71'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x300b('0x75')](_0x1a1843[_0x300b('0x62')][_0x300b('0x78')])){throw new db[(_0x300b('0x70'))][(_0x300b('0x71'))](_0x300b('0x79')+_0x51807d);}if(!_[_0x300b('0x7a')](_0x51807d,_0x1a1843[_0x300b('0x62')][_0x300b('0x78')])){throw new db[(_0x300b('0x70'))][(_0x300b('0x71'))](_0x300b('0x7b')+_0x51807d);}_0x3c3f30[_0x1a1843[_0x300b('0x62')][_0x300b('0x78')]]=_0x1a1843[_0x300b('0x62')][_0x300b('0x76')];})[_0x300b('0x30')](function(){return db['OpenchannelAccount'][_0x300b('0x5a')]({'where':{'id':_0x1a1843[_0x300b('0x56')]['id']},'include':[{'model':db['CmList'],'as':_0x300b('0x7c'),'include':[{'model':db[_0x300b('0x6f')],'as':_0x300b('0x7d'),'where':_0x3c3f30,'limit':0x1,'order':[['updatedAt',_0x300b('0x7e')]]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})[_0x300b('0x30')](handleEntityNotFound(_0x546321,null))['then'](function(_0x58f809){if(_0x58f809&&_0x58f809[_0x300b('0x7c')]){_0x2b8fe3[_0x300b('0x7f')]=_0x58f809;_0x2b8fe3['applications']=_0x58f809['Applications'];_0x2b8fe3[_0x300b('0x80')]=_0x58f809[_0x300b('0x7c')];_0x2b8fe3[_0x300b('0x81')]=_['orderBy'](_0x2b8fe3[_0x300b('0x81')],[_0x300b('0x82')],[_0x300b('0x83')]);if(_0x2b8fe3[_0x300b('0x7f')][_0x300b('0x84')]){delete _0x2b8fe3[_0x300b('0x7f')][_0x300b('0x84')];}if(_0x2b8fe3[_0x300b('0x7f')][_0x300b('0x7c')]&&_0x2b8fe3[_0x300b('0x7f')][_0x300b('0x7c')][_0x300b('0x7d')][_0x300b('0x58')]){return _0x2b8fe3[_0x300b('0x7f')][_0x300b('0x7c')][_0x300b('0x7d')][0x0];}var _0x1ab82d=_['defaults'](_0x1a1843['body'],{'firstName':_0x1a1843[_0x300b('0x62')][_0x300b('0x76')],'ListId':_0x58f809[_0x300b('0x74')]});_0x1ab82d[_0x1a1843['body'][_0x300b('0x78')]]=_0x1a1843[_0x300b('0x62')][_0x300b('0x76')];return db[_0x300b('0x6f')][_0x300b('0x5b')](_0x1ab82d,{'fields':_0x1f2325,'raw':!![]});}})[_0x300b('0x30')](handleEntityNotFound(_0x546321,null))[_0x300b('0x30')](function(_0x32a56d){_0x2b8fe3[_0x300b('0x85')]=_0x32a56d;if(_0x32a56d){var _0x50968f={'ContactId':_0x32a56d['id'],'OpenchannelAccountId':_0x1a1843['params']['id'],'from':(_0x32a56d[_0x300b('0x86')]||'')+'\x20'+(_0x32a56d[_0x300b('0x87')]||'')};var _0x242d6f={'OpenchannelAccountId':_0x1a1843[_0x300b('0x56')]['id'],'closed':![]};if(_0x1a1843[_0x300b('0x62')][_0x300b('0x88')]){_0x242d6f[_0x300b('0x88')]=_0x1a1843[_0x300b('0x62')]['threadId'];return db[_0x300b('0x89')][_0x300b('0x5a')]({'where':_0x242d6f})[_0x300b('0x30')](function(_0x3057f1){if(_0x3057f1){return[_0x3057f1,![]];}_0x50968f[_0x300b('0x88')]=_0x1a1843[_0x300b('0x62')]['threadId'];_0x50968f[_0x300b('0x8a')]=_0x1a1843['body'][_0x300b('0x8a')];return db[_0x300b('0x89')][_0x300b('0x5b')](_0x50968f)[_0x300b('0x30')](function(_0x47e7b4){return[_0x47e7b4,!![]];});});}else{_0x242d6f[_0x300b('0x88')]=null;}_0x242d6f[_0x300b('0x8b')]=_0x32a56d['id'];return db[_0x300b('0x89')][_0x300b('0x5a')]({'where':_0x242d6f})['then'](function(_0x2ce737){if(_0x2ce737){return[_0x2ce737,![]];}return db[_0x300b('0x89')][_0x300b('0x5b')](_0x50968f)[_0x300b('0x30')](function(_0x2be5a9){return[_0x2be5a9,!![]];});});}})['spread'](function(_0x42fe93,_0x223d4d){if(_0x42fe93){_0x2f2722=_0x223d4d;if(!_0x223d4d){var _0x4f95c7={'from':(_0x2b8fe3[_0x300b('0x85')]['firstName']||'')+'\x20'+(_0x2b8fe3['contact'][_0x300b('0x87')]||'')};if(_0x1a1843['body']['threadId']&&_0x1a1843['body'][_0x300b('0x8c')]&&_0x1a1843[_0x300b('0x62')]['threadId']!=_0x1a1843[_0x300b('0x62')][_0x300b('0x8c')]){_0x4f95c7['threadId']=_0x1a1843[_0x300b('0x62')][_0x300b('0x8c')];}return _0x42fe93[_0x300b('0x61')](_0x4f95c7);}else{return _0x42fe93;}}})[_0x300b('0x30')](function(_0x4c97c5){_0x2b8fe3['interaction']=_0x4c97c5[_0x300b('0x32')]({'plain':!![]});_0x2b8fe3[_0x300b('0x8d')][_0x300b('0x8e')]=_0x2f2722;if(_0x2b8fe3[_0x300b('0x8d')]['created']){if(_0x2b8fe3[_0x300b('0x7f')][_0x300b('0x8f')]){_0x2b8fe3[_0x300b('0x81')][_0x300b('0x90')]({'id':0x0,'priority':_0x2b8fe3[_0x300b('0x81')][_0x300b('0x58')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x300b('0x91')});}}return db['OpenchannelMessage'][_0x300b('0x5b')]({'body':_0x1a1843['body'][_0x300b('0x62')],'OpenchannelAccountId':_0x1a1843[_0x300b('0x56')]['id'],'OpenchannelInteractionId':_0x4c97c5['id'],'direction':'in','ContactId':_0x2b8fe3['contact']['id'],'AttachmentId':_0x1a1843['body'][_0x300b('0x92')]});})[_0x300b('0x30')](function(_0x52b623){_0x2b8fe3[_0x300b('0x25')]=_0x52b623;if(_0x2b8fe3[_0x300b('0x8d')][_0x300b('0x93')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x2b8fe3['interaction'][_0x300b('0x93')]}})['then'](function(_0x3655ac){if(_0x3655ac){_0x2b8fe3[_0x300b('0x81')][_0x300b('0x94')]({'id':0x0,'priority':0x0,'app':_0x300b('0x95'),'appdata':_0x3655ac[_0x300b('0x37')]+','+(_0x2b8fe3['account'][_0x300b('0x96')]||0xa),'interval':_0x300b('0x91')});_0x2b8fe3[_0x300b('0x97')]=![];}return respondWithRpcPromise('Start',_0x300b('0x98'),_0x2b8fe3);});}return respondWithRpcPromise(_0x300b('0x99'),'startRouting',_0x2b8fe3);})[_0x300b('0x30')](function(_0x58bae4){respondWithRpcPromise(_0x300b('0x9a'),'EventManager',{'event':_0x300b('0x6d'),'message':_0x58bae4},client9002);return _0x58bae4;})[_0x300b('0x30')](respondWithResult(_0x546321,null))['catch'](handleError(_0x546321,null));};exports[_0x300b('0x9b')]=function(_0x1beedd,_0xd075c2,_0x227689){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1beedd[_0x300b('0x56')]['id']}})[_0x300b('0x30')](handleEntityNotFound(_0xd075c2,null))['then'](function(_0x49c772){if(_0x49c772){return db[_0x300b('0x9c')][_0x300b('0x9d')](function(_0x580dd1){return db[_0x300b('0x9e')][_0x300b('0x31')]({'where':{'OpenchannelAccountId':_0x1beedd[_0x300b('0x56')]['id']},'transaction':_0x580dd1})[_0x300b('0x30')](function(_0x4b3b73){var _0x7e9c08=_[_0x300b('0x40')](_0x1beedd[_0x300b('0x62')],function(_0x4fd899){_0x4fd899['OpenchannelAccountId']=_0x1beedd[_0x300b('0x56')]['id'];return _0x4fd899;});return db['OpenchannelApplication'][_0x300b('0x9f')](_0x7e9c08,{'transaction':_0x580dd1});});})[_0x300b('0x30')](function(){return db[_0x300b('0x9e')][_0x300b('0xa0')]({'where':{'OpenchannelAccountId':_0x1beedd[_0x300b('0x56')]['id']},'order':_0x300b('0x82')});});}})[_0x300b('0x30')](respondWithResult(_0xd075c2,null))[_0x300b('0x27')](handleError(_0xd075c2,null));};exports[_0x300b('0xa1')]=function(_0x32cc32,_0x3b0853,_0x2a00b9){var _0x5fb005={};var _0x30ef59={};var _0x4a14f7;var _0x5ea1aa;return db['OpenchannelAccount'][_0x300b('0x6b')]({'where':{'id':_0x32cc32[_0x300b('0x56')]['id']}})[_0x300b('0x30')](handleEntityNotFound(_0x3b0853,null))[_0x300b('0x30')](function(_0x2040ce){if(_0x2040ce){_0x4a14f7=_0x2040ce;_0x30ef59[_0x300b('0x3f')]=_[_0x300b('0x42')](db[_0x300b('0x9e')][_0x300b('0x3c')]);_0x30ef59[_0x300b('0x41')]=_[_0x300b('0x42')](_0x32cc32[_0x300b('0x41')]);_0x30ef59[_0x300b('0x43')]=_[_0x300b('0x44')](_0x30ef59['model'],_0x30ef59[_0x300b('0x41')]);_0x5fb005[_0x300b('0x46')]=_[_0x300b('0x44')](_0x30ef59[_0x300b('0x3f')],qs[_0x300b('0x45')](_0x32cc32['query'][_0x300b('0x45')]));_0x5fb005[_0x300b('0x46')]=_0x5fb005[_0x300b('0x46')][_0x300b('0x58')]?_0x5fb005[_0x300b('0x46')]:_0x30ef59[_0x300b('0x3f')];_0x5fb005['order']=qs['sort'](_0x32cc32[_0x300b('0x41')][_0x300b('0x4a')]);_0x5fb005[_0x300b('0x4b')]=qs[_0x300b('0x43')](_['pick'](_0x32cc32['query'],_0x30ef59[_0x300b('0x43')]));if(_0x32cc32[_0x300b('0x41')]['filter']){_0x5fb005['where']=_['merge'](_0x5fb005[_0x300b('0x4b')],{'$or':_['map'](_0x5fb005['attributes'],function(_0x29be29){var _0x58cca4={};_0x58cca4[_0x29be29]={'$like':'%'+_0x32cc32[_0x300b('0x41')][_0x300b('0x67')]+'%'};return _0x58cca4;})});}_0x5fb005=_[_0x300b('0x4d')]({},_0x5fb005,_0x32cc32['options']);return _0x4a14f7['getApplications'](_0x5fb005);}})['then'](function(_0x4bcdd2){if(_0x4bcdd2){_0x5ea1aa=_0x4bcdd2[_0x300b('0x58')];if(!_0x32cc32[_0x300b('0x41')][_0x300b('0x47')](_0x300b('0x48'))){_0x5fb005['limit']=qs['limit'](_0x32cc32[_0x300b('0x41')][_0x300b('0x2c')]);_0x5fb005[_0x300b('0x2b')]=qs['offset'](_0x32cc32[_0x300b('0x41')][_0x300b('0x2b')]);}return _0x4a14f7[_0x300b('0xa1')](_0x5fb005);}})[_0x300b('0x30')](function(_0x1c5651){if(_0x1c5651){return _0x1c5651?{'count':_0x5ea1aa,'rows':_0x1c5651}:null;}})[_0x300b('0x30')](respondWithResult(_0x3b0853,null))[_0x300b('0x27')](handleError(_0x3b0853,null));};exports[_0x300b('0xa2')]=function(_0x9844df,_0x3d5fb9,_0x53f209){var _0x3fc5d3={'raw':![],'where':{}};var _0x29bcfc={};var _0x1f651d={'count':0x0,'rows':[]};return db[_0x300b('0x3b')][_0x300b('0x6b')]({'where':{'id':_0x9844df[_0x300b('0x56')]['id']}})[_0x300b('0x30')](handleEntityNotFound(_0x3d5fb9,null))[_0x300b('0x30')](function(_0x3b4384){if(_0x3b4384){_0x29bcfc[_0x300b('0x3f')]=_[_0x300b('0x42')](db[_0x300b('0x89')][_0x300b('0x3c')]);_0x29bcfc[_0x300b('0x41')]=_[_0x300b('0x42')](_0x9844df['query']);_0x29bcfc[_0x300b('0x43')]=_['intersection'](_0x29bcfc[_0x300b('0x3f')],_0x29bcfc['query']);_0x3fc5d3[_0x300b('0x46')]=_[_0x300b('0x44')](_0x29bcfc['model'],qs[_0x300b('0x45')](_0x9844df[_0x300b('0x41')][_0x300b('0x45')]));_0x3fc5d3[_0x300b('0x46')]=_0x3fc5d3[_0x300b('0x46')]['length']?_0x3fc5d3[_0x300b('0x46')]:_0x29bcfc[_0x300b('0x3f')];if(!_0x9844df['query'][_0x300b('0x47')]('nolimit')){_0x3fc5d3[_0x300b('0x2c')]=qs['limit'](_0x9844df[_0x300b('0x41')][_0x300b('0x2c')]);_0x3fc5d3[_0x300b('0x2b')]=qs[_0x300b('0x2b')](_0x9844df[_0x300b('0x41')]['offset']);}_0x3fc5d3[_0x300b('0x49')]=qs[_0x300b('0x4a')](_0x9844df[_0x300b('0x41')]['sort']);_0x3fc5d3['where']=qs[_0x300b('0x43')](_['pick'](_0x9844df['query'],_0x29bcfc[_0x300b('0x43')]));_0x3fc5d3[_0x300b('0x4b')][_0x300b('0x66')]=_0x3b4384['id'];if(_0x9844df['query'][_0x300b('0x67')]){_0x3fc5d3[_0x300b('0x4b')]=_[_0x300b('0x4d')](_0x3fc5d3['where'],{'$or':_[_0x300b('0x40')](_0x3fc5d3[_0x300b('0x46')],function(_0x2e9be2){var _0xadc9f8={};_0xadc9f8[_0x2e9be2]={'$like':'%'+_0x9844df['query'][_0x300b('0x67')]+'%'};return _0xadc9f8;})});}_0x3fc5d3=_[_0x300b('0x4d')]({},_0x3fc5d3,_0x9844df['options']);return db[_0x300b('0x89')][_0x300b('0x51')]({'where':_0x3fc5d3[_0x300b('0x4b')]})[_0x300b('0x30')](function(_0x23fe83){_0x1f651d[_0x300b('0x51')]=_0x23fe83;if(_0x9844df[_0x300b('0x41')]['includeAll']){_0x3fc5d3[_0x300b('0x52')]=[{'model':db[_0x300b('0x6f')],'as':_0x300b('0xa3'),'required':![]},{'model':db[_0x300b('0xa4')],'as':_0x300b('0xa5'),'attributes':[_0x300b('0x37'),_0x300b('0xa6'),_0x300b('0xa7')],'required':![]},{'model':db[_0x300b('0xa8')],'as':_0x300b('0xa9'),'attributes':['id',_0x300b('0x37'),_0x300b('0xaa')],'where':_0x9844df['query']['tag']?{'id':_0x9844df[_0x300b('0x41')][_0x300b('0xab')]}:undefined,'required':_0x9844df[_0x300b('0x41')][_0x300b('0xab')]?!![]:![]}];}return db[_0x300b('0x89')][_0x300b('0x53')](_0x3fc5d3);})['then'](function(_0x42393a){_0x1f651d[_0x300b('0x54')]=_0x42393a;return _0x1f651d;});}})[_0x300b('0x30')](respondWithFilteredResult(_0x3d5fb9,_0x3fc5d3))[_0x300b('0x27')](handleError(_0x3d5fb9,null));};exports[_0x300b('0xac')]=function(_0x2d955a,_0x470f6a,_0x3fa887){return db['OpenchannelAccount'][_0x300b('0x5a')]({'where':{'id':_0x2d955a[_0x300b('0x56')]['id']}})[_0x300b('0x30')](handleEntityNotFound(_0x470f6a,null))['then'](function(_0x51d88e){if(_0x51d88e){return _0x51d88e['addAgents'](_0x2d955a[_0x300b('0x62')][_0x300b('0x69')],_['omit'](_0x2d955a[_0x300b('0x62')],['ids','id'])||{})[_0x300b('0xad')](function(_0xfde8f9){for(var _0x55bcf5=0x0;_0x55bcf5<_0x2d955a[_0x300b('0x62')][_0x300b('0x69')][_0x300b('0x58')];_0x55bcf5+=0x1){socket[_0x300b('0xae')](_0x300b('0xaf'),{'UserId':_0x2d955a['body'][_0x300b('0x69')][_0x55bcf5],'OpenchannelAccountId':_0x2d955a[_0x300b('0x56')]['id']});}return _0xfde8f9;});}})[_0x300b('0x30')](respondWithResult(_0x470f6a,null))['catch'](handleError(_0x470f6a,null));};exports[_0x300b('0xb0')]=function(_0x3be492,_0x1163fc,_0x2c69ff){return db[_0x300b('0x3b')]['find']({'where':{'id':_0x3be492[_0x300b('0x56')]['id']}})['then'](handleEntityNotFound(_0x1163fc,null))[_0x300b('0x30')](function(_0x5d2738){if(_0x5d2738){return _0x5d2738[_0x300b('0xb0')](_0x3be492[_0x300b('0x41')][_0x300b('0x69')])['then'](function(){if(_[_0x300b('0xb1')](_0x3be492[_0x300b('0x41')]['ids'])){for(var _0x4d85ac=0x0;_0x4d85ac<_0x3be492['query']['ids'][_0x300b('0x58')];_0x4d85ac+=0x1){socket[_0x300b('0xae')](_0x300b('0xb2'),{'UserId':Number(_0x3be492[_0x300b('0x41')][_0x300b('0x69')][_0x4d85ac]),'OpenchannelAccountId':Number(_0x3be492[_0x300b('0x56')]['id'])});}}else{socket['emit'](_0x300b('0xb2'),{'UserId':Number(_0x3be492['query']['ids']),'OpenchannelAccountId':Number(_0x3be492['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1163fc,null))[_0x300b('0x27')](handleError(_0x1163fc,null));};exports[_0x300b('0xb3')]=function(_0x5dd94a,_0x19d0af,_0x120441){var _0x2d7a30={};var _0x17d1f2={};var _0x1d8900;var _0x476f67;return db[_0x300b('0x3b')][_0x300b('0x6b')]({'where':{'id':_0x5dd94a['params']['id']}})[_0x300b('0x30')](handleEntityNotFound(_0x19d0af,null))[_0x300b('0x30')](function(_0x30e7dd){if(_0x30e7dd){_0x1d8900=_0x30e7dd;_0x17d1f2[_0x300b('0x3f')]=_[_0x300b('0x42')](db[_0x300b('0xa4')]['rawAttributes']);_0x17d1f2[_0x300b('0x41')]=_[_0x300b('0x42')](_0x5dd94a[_0x300b('0x41')]);_0x17d1f2[_0x300b('0x43')]=_[_0x300b('0x44')](_0x17d1f2[_0x300b('0x3f')],_0x17d1f2['query']);_0x2d7a30['attributes']=_['intersection'](_0x17d1f2[_0x300b('0x3f')],qs[_0x300b('0x45')](_0x5dd94a[_0x300b('0x41')][_0x300b('0x45')]));_0x2d7a30[_0x300b('0x46')]=_0x2d7a30[_0x300b('0x46')][_0x300b('0x58')]?_0x2d7a30['attributes']:_0x17d1f2[_0x300b('0x3f')];_0x2d7a30['order']=qs[_0x300b('0x4a')](_0x5dd94a[_0x300b('0x41')][_0x300b('0x4a')]);_0x2d7a30[_0x300b('0x4b')]=qs[_0x300b('0x43')](_[_0x300b('0x4c')](_0x5dd94a[_0x300b('0x41')],_0x17d1f2[_0x300b('0x43')]));if(_0x5dd94a['query']['filter']){_0x2d7a30['where']=_[_0x300b('0x4d')](_0x2d7a30['where'],{'$or':_[_0x300b('0x40')](_0x2d7a30[_0x300b('0x46')],function(_0x2197ce){var _0x31e918={};_0x31e918[_0x2197ce]={'$like':'%'+_0x5dd94a[_0x300b('0x41')][_0x300b('0x67')]+'%'};return _0x31e918;})});}_0x2d7a30=_['merge']({},_0x2d7a30,_0x5dd94a['options']);return _0x1d8900[_0x300b('0xb3')](_0x2d7a30);}})['then'](function(_0x3b26d0){if(_0x3b26d0){_0x476f67=_0x3b26d0[_0x300b('0x58')];if(!_0x5dd94a[_0x300b('0x41')][_0x300b('0x47')](_0x300b('0x48'))){_0x2d7a30[_0x300b('0x2c')]=qs[_0x300b('0x2c')](_0x5dd94a[_0x300b('0x41')]['limit']);_0x2d7a30[_0x300b('0x2b')]=qs['offset'](_0x5dd94a['query'][_0x300b('0x2b')]);}return _0x1d8900[_0x300b('0xb3')](_0x2d7a30);}})['then'](function(_0x20e415){if(_0x20e415){return _0x20e415?{'count':_0x476f67,'rows':_0x20e415}:null;}})[_0x300b('0x30')](respondWithResult(_0x19d0af,null))['catch'](handleError(_0x19d0af,null));};exports['send']=function(_0x3b52cc,_0x4e73b0,_0x4daade){var _0x111b3d,_0x1ea650,_0x11cbe0;if(_['isNil'](_0x3b52cc[_0x300b('0x62')][_0x300b('0x62')])||_0x3b52cc['body']['body']===''){throw new db[(_0x300b('0x70'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x300b('0x75')](_0x3b52cc[_0x300b('0x62')]['to'])){}_0x111b3d=_0x3b52cc[_0x300b('0x62')]['to'];return db[_0x300b('0x3b')]['findOne']({'where':{'id':_0x3b52cc['params']['id']}})[_0x300b('0x30')](handleEntityNotFound(_0x4e73b0,null))['then'](function(_0x4ffa31){if(_0x4ffa31){return db['OpenchannelAccount'][_0x300b('0x5a')]({'where':{'id':_0x4ffa31['id']},'include':[{'model':db[_0x300b('0xb4')],'as':_0x300b('0x7c'),'include':[{'model':db['CmContact'],'as':_0x300b('0x7d'),'where':{[_0x4ffa31[_0x300b('0x78')]]:_0x111b3d},'limit':0x1,'order':[[_0x300b('0xb5'),_0x300b('0x7e')]]}]}]})[_0x300b('0x30')](handleEntityNotFound(_0x4e73b0,null))[_0x300b('0x30')](function(_0xc9bb4a){if(_0xc9bb4a&&_0xc9bb4a[_0x300b('0x7c')]){_0x1ea650=_0xc9bb4a[_0x300b('0x32')]({'plain':!![]});if(_0x1ea650[_0x300b('0x7c')]&&_0x1ea650[_0x300b('0x7c')]['Contacts'][_0x300b('0x58')]){return _0x1ea650[_0x300b('0x7c')][_0x300b('0x7d')][0x0];}return db[_0x300b('0x6f')]['create'](_[_0x300b('0x16')](_0x3b52cc['body'],{'firstName':_0x111b3d,[_0xc9bb4a[_0x300b('0x78')]]:_0x111b3d,'phone':_0x111b3d,'ListId':_0x1ea650[_0x300b('0x74')]}));}})[_0x300b('0x30')](handleEntityNotFound(_0x4e73b0,null))[_0x300b('0x30')](function(_0x4edb6e){if(_0x4edb6e){_0x11cbe0=_0x4edb6e;return db[_0x300b('0x89')][_0x300b('0x5a')]({'where':{'ContactId':_0x11cbe0['id'],'closed':![],'OpenchannelAccountId':_0x1ea650['id']}})[_0x300b('0x30')](function(_0x335ba1){if(_0x335ba1){return[_0x335ba1,![]];}return db['OpenchannelInteraction'][_0x300b('0x5b')]({'UserId':_0x3b52cc[_0x300b('0x5c')]['id'],'ContactId':_0x11cbe0['id'],'OpenchannelAccountId':_0x1ea650['id'],'lastMsgDirection':_0x300b('0xb6'),'Messages':[_['merge'](_0x3b52cc['body'],{'read':![],'body':_0x3b52cc[_0x300b('0x62')][_0x300b('0x62')],'OpenchannelAccountId':_0x1ea650['id'],'UserId':_0x3b52cc[_0x300b('0x5c')]['id'],'ContactId':_0x11cbe0['id']})]},{'include':[{'model':db[_0x300b('0xb7')],'as':_0x300b('0xb8')}]})[_0x300b('0x30')](function(_0x25b1f6){return[_0x25b1f6,!![]];});});}})[_0x300b('0xad')](function(_0x360860,_0x2a9280){if(_0x2a9280){return _0x360860;}return db[_0x300b('0xb7')]['create'](_[_0x300b('0x4d')](_0x3b52cc['body'],{'read':![],'body':_0x3b52cc[_0x300b('0x62')][_0x300b('0x62')],'OpenchannelAccountId':_0x1ea650['id'],'OpenchannelInteractionId':_0x360860['id'],'UserId':_0x3b52cc['user']['id'],'ContactId':_0x11cbe0['id']}))['then'](function(_0x230a19){_0x360860['dataValues'][_0x300b('0xb8')]=[];_0x360860['dataValues'][_0x300b('0xb8')][_0x300b('0x90')](_0x230a19[_0x300b('0xb9')]);return _0x360860;});});}})[_0x300b('0x30')](respondWithResult(_0x4e73b0,null))[_0x300b('0x27')](handleError(_0x4e73b0,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 24b53b8..0307cd9 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 _0x7dcd=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x4a8418,_0x39078a){var _0x390174=function(_0x173ea6){while(--_0x173ea6){_0x4a8418['push'](_0x4a8418['shift']());}};_0x390174(++_0x39078a);}(_0x7dcd,0xee));var _0xd7dc=function(_0x29a40a,_0x234214){_0x29a40a=_0x29a40a-0x0;var _0x6182e9=_0x7dcd[_0x29a40a];return _0x6182e9;};'use strict';var EventEmitter=require(_0xd7dc('0x0'));var OpenchannelAccount=require(_0xd7dc('0x1'))['db'][_0xd7dc('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xd7dc('0x3')](0x0);var events={'afterCreate':_0xd7dc('0x4'),'afterUpdate':_0xd7dc('0x5'),'afterDestroy':_0xd7dc('0x6')};function emitEvent(_0x1be0c3){return function(_0x1bd25b,_0x506884,_0x184571){OpenchannelAccountEvents[_0xd7dc('0x7')](_0x1be0c3+':'+_0x1bd25b['id'],_0x1bd25b);OpenchannelAccountEvents[_0xd7dc('0x7')](_0x1be0c3,_0x1bd25b);_0x184571(null);};}for(var e in events){if(events[_0xd7dc('0x8')](e)){var event=events[e];OpenchannelAccount[_0xd7dc('0x9')](e,emitEvent(event));}}module[_0xd7dc('0xa')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xaaa3=['hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x38092a,_0x4b6695){var _0x352749=function(_0x1239c6){while(--_0x1239c6){_0x38092a['push'](_0x38092a['shift']());}};_0x352749(++_0x4b6695);}(_0xaaa3,0x10a));var _0x3aaa=function(_0x114a50,_0x589093){_0x114a50=_0x114a50-0x0;var _0x2fea9d=_0xaaa3[_0x114a50];return _0x2fea9d;};'use strict';var EventEmitter=require(_0x3aaa('0x0'));var OpenchannelAccount=require(_0x3aaa('0x1'))['db'][_0x3aaa('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x3aaa('0x3')](0x0);var events={'afterCreate':_0x3aaa('0x4'),'afterUpdate':_0x3aaa('0x5'),'afterDestroy':_0x3aaa('0x6')};function emitEvent(_0x323830){return function(_0x5aa1fb,_0x5b46a5,_0x57c667){OpenchannelAccountEvents['emit'](_0x323830+':'+_0x5aa1fb['id'],_0x5aa1fb);OpenchannelAccountEvents[_0x3aaa('0x7')](_0x323830,_0x5aa1fb);_0x57c667(null);};}for(var e in events){if(events[_0x3aaa('0x8')](e)){var event=events[e];OpenchannelAccount[_0x3aaa('0x9')](e,emitEvent(event));}}module[_0x3aaa('0xa')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index c6e53f9..9018da4 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 _0x0c4b=['lodash','api','moment','path','rimraf','../../config/environment','exports','define','OpenchannelAccount','openchannel_accounts'];(function(_0x39ea42,_0x3c1f50){var _0x33f5b7=function(_0x5d8e73){while(--_0x5d8e73){_0x39ea42['push'](_0x39ea42['shift']());}};_0x33f5b7(++_0x3c1f50);}(_0x0c4b,0x96));var _0xb0c4=function(_0x591717,_0x1eb6b6){_0x591717=_0x591717-0x0;var _0x28374e=_0x0c4b[_0x591717];return _0x28374e;};'use strict';var _=require(_0xb0c4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb0c4('0x1'));var moment=require(_0xb0c4('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb0c4('0x3'));var rimraf=require(_0xb0c4('0x4'));var config=require(_0xb0c4('0x5'));var attributes=require('./openchannelAccount.attributes');module[_0xb0c4('0x6')]=function(_0x23adb7,_0x340f60){return _0x23adb7[_0xb0c4('0x7')](_0xb0c4('0x8'),attributes,{'tableName':_0xb0c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6483=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes','OpenchannelAccount','openchannel_accounts','lodash','util'];(function(_0x6182ff,_0x59d492){var _0x1cec22=function(_0x2e96f8){while(--_0x2e96f8){_0x6182ff['push'](_0x6182ff['shift']());}};_0x1cec22(++_0x59d492);}(_0x6483,0x1e2));var _0x3648=function(_0x4cdf19,_0x1d78cf){_0x4cdf19=_0x4cdf19-0x0;var _0x4d5a0f=_0x6483[_0x4cdf19];return _0x4d5a0f;};'use strict';var _=require(_0x3648('0x0'));var util=require(_0x3648('0x1'));var logger=require(_0x3648('0x2'))('api');var moment=require(_0x3648('0x3'));var BPromise=require('bluebird');var rp=require(_0x3648('0x4'));var fs=require('fs');var path=require(_0x3648('0x5'));var rimraf=require(_0x3648('0x6'));var config=require(_0x3648('0x7'));var attributes=require(_0x3648('0x8'));module['exports']=function(_0x513772,_0x1f453c){return _0x513772['define'](_0x3648('0x9'),attributes,{'tableName':_0x3648('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index e25962d..0d83b5b 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 _0x7ef5=['ioredis','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','bluebird','randomstring'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x7ef5,0xc6));var _0x57ef=function(_0x482ee9,_0xa76d51){_0x482ee9=_0x482ee9-0x0;var _0x5dc792=_0x7ef5[_0x482ee9];return _0x5dc792;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x57ef('0x0'));var rs=require(_0x57ef('0x1'));var fs=require('fs');var Redis=require(_0x57ef('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x57ef('0x3'))(_0x57ef('0x4'));var config=require('../../config/environment');var jayson=require(_0x57ef('0x5'));var client=jayson[_0x57ef('0x6')][_0x57ef('0x7')]({'port':0x232a});config['redis']=_[_0x57ef('0x8')](config[_0x57ef('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x57ef('0xa'))(new Redis(config[_0x57ef('0x9')]));require(_0x57ef('0xb'))[_0x57ef('0xc')](socket);function respondWithRpcPromise(_0x2af978,_0x4b5956,_0x32be10){return new BPromise(function(_0x3a6d29,_0x224bad){return client[_0x57ef('0xd')](_0x2af978,_0x32be10)[_0x57ef('0xe')](function(_0xf6a6f2){logger[_0x57ef('0xf')](_0x57ef('0x10'),_0x4b5956,_0x57ef('0x11'));logger[_0x57ef('0x12')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x4b5956,_0x57ef('0x11'),JSON[_0x57ef('0x13')](_0xf6a6f2));if(_0xf6a6f2[_0x57ef('0x14')]){if(_0xf6a6f2[_0x57ef('0x14')][_0x57ef('0x15')]===0x1f4){logger[_0x57ef('0x14')](_0x57ef('0x10'),_0x4b5956,_0xf6a6f2['error'][_0x57ef('0x16')]);return _0x224bad(_0xf6a6f2[_0x57ef('0x14')]['message']);}logger[_0x57ef('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x4b5956,_0xf6a6f2['error'][_0x57ef('0x16')]);return _0x3a6d29(_0xf6a6f2[_0x57ef('0x14')][_0x57ef('0x16')]);}else{logger[_0x57ef('0xf')](_0x57ef('0x10'),_0x4b5956,_0x57ef('0x11'));_0x3a6d29(_0xf6a6f2[_0x57ef('0x17')][_0x57ef('0x16')]);}})[_0x57ef('0x18')](function(_0x787479){logger[_0x57ef('0x14')](_0x57ef('0x10'),_0x4b5956,_0x787479);_0x224bad(_0x787479);});});} \ No newline at end of file +var _0xd1fe=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s'];(function(_0x1744e1,_0x1d5cd9){var _0x5166a0=function(_0x5f28dd){while(--_0x5f28dd){_0x1744e1['push'](_0x1744e1['shift']());}};_0x5166a0(++_0x1d5cd9);}(_0xd1fe,0x113));var _0xed1f=function(_0x22db11,_0x1543b8){_0x22db11=_0x22db11-0x0;var _0x4251cd=_0xd1fe[_0x22db11];return _0x4251cd;};'use strict';var _=require(_0xed1f('0x0'));var util=require(_0xed1f('0x1'));var moment=require(_0xed1f('0x2'));var BPromise=require(_0xed1f('0x3'));var rs=require(_0xed1f('0x4'));var fs=require('fs');var Redis=require(_0xed1f('0x5'));var db=require(_0xed1f('0x6'))['db'];var utils=require(_0xed1f('0x7'));var logger=require(_0xed1f('0x8'))('rpc');var config=require(_0xed1f('0x9'));var jayson=require(_0xed1f('0xa'));var client=jayson['client'][_0xed1f('0xb')]({'port':0x232a});config[_0xed1f('0xc')]=_[_0xed1f('0xd')](config[_0xed1f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xed1f('0xe'))(new Redis(config[_0xed1f('0xc')]));require(_0xed1f('0xf'))[_0xed1f('0x10')](socket);function respondWithRpcPromise(_0x4e3120,_0x521f3a,_0x140873){return new BPromise(function(_0x54ed1e,_0x296ba9){return client['request'](_0x4e3120,_0x140873)['then'](function(_0x2b5409){logger[_0xed1f('0x11')](_0xed1f('0x12'),_0x521f3a,_0xed1f('0x13'));logger[_0xed1f('0x14')](_0xed1f('0x15'),_0x521f3a,_0xed1f('0x13'),JSON['stringify'](_0x2b5409));if(_0x2b5409[_0xed1f('0x16')]){if(_0x2b5409['error'][_0xed1f('0x17')]===0x1f4){logger[_0xed1f('0x16')](_0xed1f('0x12'),_0x521f3a,_0x2b5409[_0xed1f('0x16')][_0xed1f('0x18')]);return _0x296ba9(_0x2b5409[_0xed1f('0x16')][_0xed1f('0x18')]);}logger[_0xed1f('0x16')](_0xed1f('0x12'),_0x521f3a,_0x2b5409[_0xed1f('0x16')][_0xed1f('0x18')]);return _0x54ed1e(_0x2b5409['error'][_0xed1f('0x18')]);}else{logger[_0xed1f('0x11')](_0xed1f('0x12'),_0x521f3a,_0xed1f('0x13'));_0x54ed1e(_0x2b5409[_0xed1f('0x19')][_0xed1f('0x18')]);}})[_0xed1f('0x1a')](function(_0x5ea1c0){logger[_0xed1f('0x16')](_0xed1f('0x12'),_0x521f3a,_0x5ea1c0);_0x296ba9(_0x5ea1c0);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 057ded3..6cf05f2 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 _0xbcf7=['remove','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0xc76959,_0xc46cd1){var _0x28aa72=function(_0x214752){while(--_0x214752){_0xc76959['push'](_0xc76959['shift']());}};_0x28aa72(++_0xc46cd1);}(_0xbcf7,0x134));var _0x7bcf=function(_0x4e1f08,_0x9166bf){_0x4e1f08=_0x4e1f08-0x0;var _0x17f8d2=_0xbcf7[_0x4e1f08];return _0x17f8d2;};'use strict';var OpenchannelAccountEvents=require(_0x7bcf('0x0'));var events=[_0x7bcf('0x1'),_0x7bcf('0x2'),'update'];function createListener(_0x179a0b,_0x1290af){return function(_0x24dad8){_0x1290af['emit'](_0x179a0b,_0x24dad8);};}function removeListener(_0x47a7a4,_0x50b831){return function(){OpenchannelAccountEvents['removeListener'](_0x47a7a4,_0x50b831);};}exports['register']=function(_0x2a98e6){for(var _0x3e31b1=0x0,_0xf1e271=events[_0x7bcf('0x3')];_0x3e31b1<_0xf1e271;_0x3e31b1++){var _0xf81b99=events[_0x3e31b1];var _0x1cd914=createListener(_0x7bcf('0x4')+_0xf81b99,_0x2a98e6);OpenchannelAccountEvents['on'](_0xf81b99,_0x1cd914);}}; \ No newline at end of file +var _0x1df0=['register','length','./openchannelAccount.events','save','remove','update','removeListener'];(function(_0x532685,_0x1a38c2){var _0x21426a=function(_0xa48343){while(--_0xa48343){_0x532685['push'](_0x532685['shift']());}};_0x21426a(++_0x1a38c2);}(_0x1df0,0x6b));var _0x01df=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1df0[_0x3947c9];return _0x2e7871;};'use strict';var OpenchannelAccountEvents=require(_0x01df('0x0'));var events=[_0x01df('0x1'),_0x01df('0x2'),_0x01df('0x3')];function createListener(_0x391d82,_0x2e1ff0){return function(_0x5ad260){_0x2e1ff0['emit'](_0x391d82,_0x5ad260);};}function removeListener(_0x4e6841,_0x5839e6){return function(){OpenchannelAccountEvents[_0x01df('0x4')](_0x4e6841,_0x5839e6);};}exports[_0x01df('0x5')]=function(_0x4773b6){for(var _0x3bb221=0x0,_0x6bf741=events[_0x01df('0x6')];_0x3bb221<_0x6bf741;_0x3bb221++){var _0xcc523f=events[_0x3bb221];var _0x170c7e=createListener('openchannelAccount:'+_0xcc523f,_0x4773b6);OpenchannelAccountEvents['on'](_0xcc523f,_0x170c7e);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 3836884..56f50be 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 _0x3d7c=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x1daebd,_0x79a89){var _0x462a89=function(_0x32f800){while(--_0x32f800){_0x1daebd['push'](_0x1daebd['shift']());}};_0x462a89(++_0x79a89);}(_0x3d7c,0x19c));var _0xc3d7=function(_0x3a4061,_0x4971e2){_0x3a4061=_0x3a4061-0x0;var _0x453d29=_0x3d7c[_0x3a4061];return _0x453d29;};'use strict';var multer=require(_0xc3d7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc3d7('0x1'));var express=require(_0xc3d7('0x2'));var router=express[_0xc3d7('0x3')]();var auth=require(_0xc3d7('0x4'));var interaction=require(_0xc3d7('0x5'));var config=require(_0xc3d7('0x6'));var controller=require('./openchannelApplication.controller');router[_0xc3d7('0x7')]('/',auth['isAuthenticated'](),controller[_0xc3d7('0x8')]);router[_0xc3d7('0x7')](_0xc3d7('0x9'),auth[_0xc3d7('0xa')](),controller['show']);router[_0xc3d7('0xb')]('/',auth[_0xc3d7('0xa')](),controller[_0xc3d7('0xc')]);router[_0xc3d7('0xd')](_0xc3d7('0x9'),auth[_0xc3d7('0xa')](),controller[_0xc3d7('0xe')]);router[_0xc3d7('0xf')](_0xc3d7('0x9'),auth['isAuthenticated'](),controller[_0xc3d7('0x10')]);module[_0xc3d7('0x11')]=router; \ No newline at end of file +var _0x6724=['isAuthenticated','index','get','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x489c95,_0x53159c){var _0x10e7a7=function(_0xcb4342){while(--_0xcb4342){_0x489c95['push'](_0x489c95['shift']());}};_0x10e7a7(++_0x53159c);}(_0x6724,0x101));var _0x4672=function(_0x5397e3,_0x47177b){_0x5397e3=_0x5397e3-0x0;var _0x18077a=_0x6724[_0x5397e3];return _0x18077a;};'use strict';var multer=require(_0x4672('0x0'));var util=require(_0x4672('0x1'));var path=require(_0x4672('0x2'));var timeout=require(_0x4672('0x3'));var express=require(_0x4672('0x4'));var router=express[_0x4672('0x5')]();var auth=require(_0x4672('0x6'));var interaction=require(_0x4672('0x7'));var config=require(_0x4672('0x8'));var controller=require('./openchannelApplication.controller');router['get']('/',auth[_0x4672('0x9')](),controller[_0x4672('0xa')]);router[_0x4672('0xb')](_0x4672('0xc'),auth[_0x4672('0x9')](),controller[_0x4672('0xd')]);router['post']('/',auth[_0x4672('0x9')](),controller[_0x4672('0xe')]);router['put'](_0x4672('0xc'),auth['isAuthenticated'](),controller[_0x4672('0xf')]);router[_0x4672('0x10')](_0x4672('0xc'),auth[_0x4672('0x9')](),controller[_0x4672('0x11')]);module[_0x4672('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index f5cd7f7..0501581 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 _0xcd6d=['noop','TEXT','STRING','*,*,*,*','exports','INTEGER'];(function(_0x40ff3b,_0x238af7){var _0x3ccf4f=function(_0x397ae0){while(--_0x397ae0){_0x40ff3b['push'](_0x40ff3b['shift']());}};_0x3ccf4f(++_0x238af7);}(_0xcd6d,0x16c));var _0xdcd6=function(_0x11bb91,_0x5ac844){_0x11bb91=_0x11bb91-0x0;var _0x20a0cb=_0xcd6d[_0x11bb91];return _0x20a0cb;};'use strict';var Sequelize=require('sequelize');module[_0xdcd6('0x0')]={'priority':{'type':Sequelize[_0xdcd6('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdcd6('0x2')},'appdata':{'type':Sequelize[_0xdcd6('0x3')]()},'description':{'type':Sequelize[_0xdcd6('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xdcd6('0x5')}}; \ No newline at end of file +var _0x786b=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x243587,_0x2cba3c){var _0x286efa=function(_0x20ed96){while(--_0x20ed96){_0x243587['push'](_0x243587['shift']());}};_0x286efa(++_0x2cba3c);}(_0x786b,0x188));var _0xb786=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x786b[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require(_0xb786('0x0'));module[_0xb786('0x1')]={'priority':{'type':Sequelize[_0xb786('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb786('0x3')],'allowNull':![],'defaultValue':_0xb786('0x4')},'appdata':{'type':Sequelize[_0xb786('0x5')]()},'description':{'type':Sequelize[_0xb786('0x3')]},'interval':{'type':Sequelize[_0xb786('0x3')],'defaultValue':_0xb786('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 3b674e8..5e9deea 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 _0x21ac=['update','then','destroy','end','error','name','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','count','includeAll','include','catch','show','params','filtears','options','find','create','body','html-pdf','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/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','Content-Range','apply','reject'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x21ac,0x1f1));var _0xc21a=function(_0x4ddedd,_0x363574){_0x4ddedd=_0x4ddedd-0x0;var _0x2c978f=_0x21ac[_0x4ddedd];return _0x2c978f;};'use strict';var pdf=require(_0xc21a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc21a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc21a('0x2'));var rp=require(_0xc21a('0x3'));var moment=require(_0xc21a('0x4'));var BPromise=require(_0xc21a('0x5'));var Mustache=require(_0xc21a('0x6'));var util=require(_0xc21a('0x7'));var path=require(_0xc21a('0x8'));var sox=require(_0xc21a('0x9'));var csv=require(_0xc21a('0xa'));var ejs=require(_0xc21a('0xb'));var fs=require('fs');var _=require(_0xc21a('0xc'));var squel=require(_0xc21a('0xd'));var crypto=require(_0xc21a('0xe'));var jsforce=require(_0xc21a('0xf'));var deskjs=require(_0xc21a('0x10'));var toCsv=require(_0xc21a('0xa'));var querystring=require(_0xc21a('0x11'));var Papa=require(_0xc21a('0x12'));var Redis=require(_0xc21a('0x13'));var authService=require(_0xc21a('0x14'));var qs=require(_0xc21a('0x15'));var as=require(_0xc21a('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc21a('0x17'))(_0xc21a('0x18'));var utils=require('../../config/utils');var config=require(_0xc21a('0x19'));var licenseUtil=require(_0xc21a('0x1a'));var db=require(_0xc21a('0x1b'))['db'];function respondWithStatusCode(_0xdcf1f7,_0x4e7d53){_0x4e7d53=_0x4e7d53||0xcc;return function(_0x3e0dd4){if(_0x3e0dd4){return _0xdcf1f7[_0xc21a('0x1c')](_0x4e7d53);}return _0xdcf1f7[_0xc21a('0x1d')](_0x4e7d53)['end']();};}function respondWithResult(_0x5d8939,_0x28be9c){_0x28be9c=_0x28be9c||0xc8;return function(_0xce6433){if(_0xce6433){return _0x5d8939[_0xc21a('0x1d')](_0x28be9c)[_0xc21a('0x1e')](_0xce6433);}};}function respondWithFilteredResult(_0x497d5d,_0x262268){return function(_0x245ec7){if(_0x245ec7){var _0x1e7ed8=_0x245ec7['count'],_0x257b03=_0x262268[_0xc21a('0x1f')],_0x818bd2=_0x262268[_0xc21a('0x1f')]+_0x262268['limit'],_0x36539f;if(_0x818bd2>=_0x1e7ed8){_0x818bd2=_0x1e7ed8;_0x36539f=0xc8;}else{_0x36539f=0xce;}_0x497d5d[_0xc21a('0x1d')](_0x36539f);return _0x497d5d['set'](_0xc21a('0x20'),_0x257b03+'-'+_0x818bd2+'/'+_0x1e7ed8)[_0xc21a('0x1e')](_0x245ec7);}return null;};}function patchUpdates(_0x3a597e){return function(_0x401804){try{jsonpatch[_0xc21a('0x21')](_0x401804,_0x3a597e,!![]);}catch(_0x3207e3){return BPromise[_0xc21a('0x22')](_0x3207e3);}return _0x401804['save']();};}function saveUpdates(_0x2deb7d,_0x4d2c64){return function(_0x4092d4){if(_0x4092d4){return _0x4092d4[_0xc21a('0x23')](_0x2deb7d)[_0xc21a('0x24')](function(_0x19982f){return _0x19982f;});}return null;};}function removeEntity(_0xf0e71a,_0x10fd66){return function(_0x25ecd6){if(_0x25ecd6){return _0x25ecd6[_0xc21a('0x25')]()[_0xc21a('0x24')](function(){_0xf0e71a[_0xc21a('0x1d')](0xcc)[_0xc21a('0x26')]();});}};}function handleEntityNotFound(_0x458c31,_0x524582){return function(_0x4b0d1d){if(!_0x4b0d1d){_0x458c31[_0xc21a('0x1c')](0x194);}return _0x4b0d1d;};}function handleError(_0x2a3373,_0x5b47ca){_0x5b47ca=_0x5b47ca||0x1f4;return function(_0x50d0e6){logger[_0xc21a('0x27')](_0x50d0e6['stack']);if(_0x50d0e6[_0xc21a('0x28')]){delete _0x50d0e6['name'];}_0x2a3373[_0xc21a('0x1d')](_0x5b47ca)['send'](_0x50d0e6);};}exports[_0xc21a('0x29')]=function(_0x4aca89,_0xd68a06){var _0x311bff={},_0x37bdf3={},_0x377134={'count':0x0,'rows':[]};var _0x4b5d4f=_[_0xc21a('0x2a')](db[_0xc21a('0x2b')][_0xc21a('0x2c')],function(_0x1a4bd9){return{'name':_0x1a4bd9[_0xc21a('0x2d')],'type':_0x1a4bd9[_0xc21a('0x2e')][_0xc21a('0x2f')]};});_0x37bdf3[_0xc21a('0x30')]=_[_0xc21a('0x2a')](_0x4b5d4f,_0xc21a('0x28'));_0x37bdf3[_0xc21a('0x31')]=_[_0xc21a('0x32')](_0x4aca89['query']);_0x37bdf3[_0xc21a('0x33')]=_['intersection'](_0x37bdf3['model'],_0x37bdf3[_0xc21a('0x31')]);_0x311bff[_0xc21a('0x34')]=_[_0xc21a('0x35')](_0x37bdf3[_0xc21a('0x30')],qs[_0xc21a('0x36')](_0x4aca89['query'][_0xc21a('0x36')]));_0x311bff['attributes']=_0x311bff['attributes'][_0xc21a('0x37')]?_0x311bff[_0xc21a('0x34')]:_0x37bdf3[_0xc21a('0x30')];if(!_0x4aca89[_0xc21a('0x31')][_0xc21a('0x38')](_0xc21a('0x39'))){_0x311bff['limit']=qs[_0xc21a('0x3a')](_0x4aca89[_0xc21a('0x31')][_0xc21a('0x3a')]);_0x311bff[_0xc21a('0x1f')]=qs[_0xc21a('0x1f')](_0x4aca89[_0xc21a('0x31')]['offset']);}_0x311bff[_0xc21a('0x3b')]=qs[_0xc21a('0x3c')](_0x4aca89[_0xc21a('0x31')][_0xc21a('0x3c')]);_0x311bff[_0xc21a('0x3d')]=qs[_0xc21a('0x33')](_[_0xc21a('0x3e')](_0x4aca89[_0xc21a('0x31')],_0x37bdf3[_0xc21a('0x33')]),_0x4b5d4f);if(_0x4aca89[_0xc21a('0x31')][_0xc21a('0x3f')]){_0x311bff['where']=_['merge'](_0x311bff[_0xc21a('0x3d')],{'$or':_['map'](_0x4b5d4f,function(_0x408e87){if(_0x408e87[_0xc21a('0x2e')]!=='VIRTUAL'){var _0x4d607e={};_0x4d607e[_0x408e87[_0xc21a('0x28')]]={'$like':'%'+_0x4aca89[_0xc21a('0x31')][_0xc21a('0x3f')]+'%'};return _0x4d607e;}})});}_0x311bff=_[_0xc21a('0x40')]({},_0x311bff,_0x4aca89['options']);var _0x39dabf={'where':_0x311bff[_0xc21a('0x3d')]};return db[_0xc21a('0x2b')][_0xc21a('0x41')](_0x39dabf)[_0xc21a('0x24')](function(_0x5db7f1){_0x377134[_0xc21a('0x41')]=_0x5db7f1;if(_0x4aca89[_0xc21a('0x31')][_0xc21a('0x42')]){_0x311bff[_0xc21a('0x43')]=[{'all':!![]}];}return db[_0xc21a('0x2b')]['findAll'](_0x311bff);})['then'](function(_0x11adc2){_0x377134['rows']=_0x11adc2;return _0x377134;})[_0xc21a('0x24')](respondWithFilteredResult(_0xd68a06,_0x311bff))[_0xc21a('0x44')](handleError(_0xd68a06,null));};exports[_0xc21a('0x45')]=function(_0x44043a,_0x9f0b15){var _0x173bbe={'raw':!![],'where':{'id':_0x44043a[_0xc21a('0x46')]['id']}},_0xc9bc27={};_0xc9bc27[_0xc21a('0x30')]=_[_0xc21a('0x32')](db[_0xc21a('0x2b')][_0xc21a('0x2c')]);_0xc9bc27[_0xc21a('0x31')]=_[_0xc21a('0x32')](_0x44043a[_0xc21a('0x31')]);_0xc9bc27[_0xc21a('0x47')]=_[_0xc21a('0x35')](_0xc9bc27[_0xc21a('0x30')],_0xc9bc27['query']);_0x173bbe[_0xc21a('0x34')]=_[_0xc21a('0x35')](_0xc9bc27[_0xc21a('0x30')],qs['fields'](_0x44043a[_0xc21a('0x31')][_0xc21a('0x36')]));_0x173bbe[_0xc21a('0x34')]=_0x173bbe['attributes'][_0xc21a('0x37')]?_0x173bbe[_0xc21a('0x34')]:_0xc9bc27[_0xc21a('0x30')];if(_0x44043a['query'][_0xc21a('0x42')]){_0x173bbe[_0xc21a('0x43')]=[{'all':!![]}];}_0x173bbe=_[_0xc21a('0x40')]({},_0x173bbe,_0x44043a[_0xc21a('0x48')]);return db[_0xc21a('0x2b')][_0xc21a('0x49')](_0x173bbe)[_0xc21a('0x24')](handleEntityNotFound(_0x9f0b15,null))[_0xc21a('0x24')](respondWithResult(_0x9f0b15,null))[_0xc21a('0x44')](handleError(_0x9f0b15,null));};exports[_0xc21a('0x4a')]=function(_0x404671,_0x367ad8){return db[_0xc21a('0x2b')][_0xc21a('0x4a')](_0x404671['body'],{})[_0xc21a('0x24')](respondWithResult(_0x367ad8,0xc9))['catch'](handleError(_0x367ad8,null));};exports[_0xc21a('0x23')]=function(_0x3ff624,_0x53c0bc){if(_0x3ff624[_0xc21a('0x4b')]['id']){delete _0x3ff624['body']['id'];}return db[_0xc21a('0x2b')]['find']({'where':{'id':_0x3ff624[_0xc21a('0x46')]['id']}})[_0xc21a('0x24')](handleEntityNotFound(_0x53c0bc,null))[_0xc21a('0x24')](saveUpdates(_0x3ff624['body'],null))[_0xc21a('0x24')](respondWithResult(_0x53c0bc,null))[_0xc21a('0x44')](handleError(_0x53c0bc,null));};exports[_0xc21a('0x25')]=function(_0x2522a6,_0x274bd3){return db[_0xc21a('0x2b')][_0xc21a('0x49')]({'where':{'id':_0x2522a6[_0xc21a('0x46')]['id']}})[_0xc21a('0x24')](handleEntityNotFound(_0x274bd3,null))[_0xc21a('0x24')](removeEntity(_0x274bd3,null))[_0xc21a('0x44')](handleError(_0x274bd3,null));}; \ No newline at end of file +var _0xd906=['options','find','create','body','update','eml-format','rimraf','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','limit','Content-Range','json','apply','reject','then','destroy','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','OpenchannelApplication','includeAll','include','findAll','rows','catch','show','params'];(function(_0x8295c,_0x565c2b){var _0x44d59a=function(_0x1efdb3){while(--_0x1efdb3){_0x8295c['push'](_0x8295c['shift']());}};_0x44d59a(++_0x565c2b);}(_0xd906,0x121));var _0x6d90=function(_0x3e7f5a,_0x120038){_0x3e7f5a=_0x3e7f5a-0x0;var _0x20d3d5=_0xd906[_0x3e7f5a];return _0x20d3d5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6d90('0x0'));var rimraf=require(_0x6d90('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6d90('0x2'));var Mustache=require('mustache');var util=require(_0x6d90('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x6d90('0x4'));var ejs=require(_0x6d90('0x5'));var fs=require('fs');var _=require(_0x6d90('0x6'));var squel=require(_0x6d90('0x7'));var crypto=require(_0x6d90('0x8'));var jsforce=require(_0x6d90('0x9'));var deskjs=require(_0x6d90('0xa'));var toCsv=require(_0x6d90('0x4'));var querystring=require(_0x6d90('0xb'));var Papa=require(_0x6d90('0xc'));var Redis=require(_0x6d90('0xd'));var authService=require(_0x6d90('0xe'));var qs=require(_0x6d90('0xf'));var as=require(_0x6d90('0x10'));var hardwareService=require(_0x6d90('0x11'));var logger=require(_0x6d90('0x12'))('api');var utils=require(_0x6d90('0x13'));var config=require(_0x6d90('0x14'));var licenseUtil=require(_0x6d90('0x15'));var db=require(_0x6d90('0x16'))['db'];function respondWithStatusCode(_0x9c25b0,_0x2cac54){_0x2cac54=_0x2cac54||0xcc;return function(_0x55b27d){if(_0x55b27d){return _0x9c25b0['sendStatus'](_0x2cac54);}return _0x9c25b0[_0x6d90('0x17')](_0x2cac54)['end']();};}function respondWithResult(_0x1e47c5,_0x3cfab3){_0x3cfab3=_0x3cfab3||0xc8;return function(_0x18be04){if(_0x18be04){return _0x1e47c5[_0x6d90('0x17')](_0x3cfab3)['json'](_0x18be04);}};}function respondWithFilteredResult(_0x3001fd,_0x2c4ab0){return function(_0x5047d9){if(_0x5047d9){var _0x4e79fc=_0x5047d9[_0x6d90('0x18')],_0x42925e=_0x2c4ab0[_0x6d90('0x19')],_0x2c8f63=_0x2c4ab0[_0x6d90('0x19')]+_0x2c4ab0[_0x6d90('0x1a')],_0x578319;if(_0x2c8f63>=_0x4e79fc){_0x2c8f63=_0x4e79fc;_0x578319=0xc8;}else{_0x578319=0xce;}_0x3001fd['status'](_0x578319);return _0x3001fd['set'](_0x6d90('0x1b'),_0x42925e+'-'+_0x2c8f63+'/'+_0x4e79fc)[_0x6d90('0x1c')](_0x5047d9);}return null;};}function patchUpdates(_0x5e1e83){return function(_0x1720ac){try{jsonpatch[_0x6d90('0x1d')](_0x1720ac,_0x5e1e83,!![]);}catch(_0x3ff644){return BPromise[_0x6d90('0x1e')](_0x3ff644);}return _0x1720ac['save']();};}function saveUpdates(_0xdba027,_0x459a0f){return function(_0x3a3429){if(_0x3a3429){return _0x3a3429['update'](_0xdba027)[_0x6d90('0x1f')](function(_0x427b07){return _0x427b07;});}return null;};}function removeEntity(_0x41a5d3,_0x4b9f4e){return function(_0x4f6066){if(_0x4f6066){return _0x4f6066[_0x6d90('0x20')]()[_0x6d90('0x1f')](function(){_0x41a5d3[_0x6d90('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ed32c,_0x358f7b){return function(_0x57f356){if(!_0x57f356){_0x2ed32c[_0x6d90('0x21')](0x194);}return _0x57f356;};}function handleError(_0xf9763,_0x41ea34){_0x41ea34=_0x41ea34||0x1f4;return function(_0x359f8a){logger[_0x6d90('0x22')](_0x359f8a[_0x6d90('0x23')]);if(_0x359f8a[_0x6d90('0x24')]){delete _0x359f8a[_0x6d90('0x24')];}_0xf9763[_0x6d90('0x17')](_0x41ea34)['send'](_0x359f8a);};}exports[_0x6d90('0x25')]=function(_0x571331,_0x564494){var _0xf0611e={},_0x25a5c4={},_0x294851={'count':0x0,'rows':[]};var _0x4d1ff1=_['map'](db['OpenchannelApplication'][_0x6d90('0x26')],function(_0x2060e3){return{'name':_0x2060e3[_0x6d90('0x27')],'type':_0x2060e3[_0x6d90('0x28')][_0x6d90('0x29')]};});_0x25a5c4[_0x6d90('0x2a')]=_[_0x6d90('0x2b')](_0x4d1ff1,_0x6d90('0x24'));_0x25a5c4[_0x6d90('0x2c')]=_[_0x6d90('0x2d')](_0x571331[_0x6d90('0x2c')]);_0x25a5c4[_0x6d90('0x2e')]=_[_0x6d90('0x2f')](_0x25a5c4[_0x6d90('0x2a')],_0x25a5c4[_0x6d90('0x2c')]);_0xf0611e[_0x6d90('0x30')]=_['intersection'](_0x25a5c4['model'],qs[_0x6d90('0x31')](_0x571331[_0x6d90('0x2c')]['fields']));_0xf0611e['attributes']=_0xf0611e[_0x6d90('0x30')][_0x6d90('0x32')]?_0xf0611e[_0x6d90('0x30')]:_0x25a5c4[_0x6d90('0x2a')];if(!_0x571331['query']['hasOwnProperty'](_0x6d90('0x33'))){_0xf0611e[_0x6d90('0x1a')]=qs[_0x6d90('0x1a')](_0x571331['query'][_0x6d90('0x1a')]);_0xf0611e[_0x6d90('0x19')]=qs[_0x6d90('0x19')](_0x571331[_0x6d90('0x2c')][_0x6d90('0x19')]);}_0xf0611e['order']=qs[_0x6d90('0x34')](_0x571331[_0x6d90('0x2c')][_0x6d90('0x34')]);_0xf0611e['where']=qs[_0x6d90('0x2e')](_[_0x6d90('0x35')](_0x571331[_0x6d90('0x2c')],_0x25a5c4['filters']),_0x4d1ff1);if(_0x571331['query'][_0x6d90('0x36')]){_0xf0611e[_0x6d90('0x37')]=_[_0x6d90('0x38')](_0xf0611e[_0x6d90('0x37')],{'$or':_['map'](_0x4d1ff1,function(_0x232435){if(_0x232435[_0x6d90('0x28')]!==_0x6d90('0x39')){var _0x3d8f3a={};_0x3d8f3a[_0x232435[_0x6d90('0x24')]]={'$like':'%'+_0x571331['query'][_0x6d90('0x36')]+'%'};return _0x3d8f3a;}})});}_0xf0611e=_[_0x6d90('0x38')]({},_0xf0611e,_0x571331['options']);var _0x4029c3={'where':_0xf0611e[_0x6d90('0x37')]};return db[_0x6d90('0x3a')]['count'](_0x4029c3)[_0x6d90('0x1f')](function(_0x2a2674){_0x294851['count']=_0x2a2674;if(_0x571331['query'][_0x6d90('0x3b')]){_0xf0611e[_0x6d90('0x3c')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x6d90('0x3d')](_0xf0611e);})[_0x6d90('0x1f')](function(_0x2a408b){_0x294851[_0x6d90('0x3e')]=_0x2a408b;return _0x294851;})[_0x6d90('0x1f')](respondWithFilteredResult(_0x564494,_0xf0611e))[_0x6d90('0x3f')](handleError(_0x564494,null));};exports[_0x6d90('0x40')]=function(_0x1cf7bb,_0x54e8ad){var _0x9b5ab5={'raw':!![],'where':{'id':_0x1cf7bb[_0x6d90('0x41')]['id']}},_0x2b5508={};_0x2b5508[_0x6d90('0x2a')]=_[_0x6d90('0x2d')](db[_0x6d90('0x3a')][_0x6d90('0x26')]);_0x2b5508[_0x6d90('0x2c')]=_['keys'](_0x1cf7bb['query']);_0x2b5508['filtears']=_[_0x6d90('0x2f')](_0x2b5508[_0x6d90('0x2a')],_0x2b5508[_0x6d90('0x2c')]);_0x9b5ab5['attributes']=_[_0x6d90('0x2f')](_0x2b5508[_0x6d90('0x2a')],qs[_0x6d90('0x31')](_0x1cf7bb['query'][_0x6d90('0x31')]));_0x9b5ab5[_0x6d90('0x30')]=_0x9b5ab5[_0x6d90('0x30')][_0x6d90('0x32')]?_0x9b5ab5[_0x6d90('0x30')]:_0x2b5508[_0x6d90('0x2a')];if(_0x1cf7bb[_0x6d90('0x2c')][_0x6d90('0x3b')]){_0x9b5ab5[_0x6d90('0x3c')]=[{'all':!![]}];}_0x9b5ab5=_[_0x6d90('0x38')]({},_0x9b5ab5,_0x1cf7bb[_0x6d90('0x42')]);return db[_0x6d90('0x3a')][_0x6d90('0x43')](_0x9b5ab5)[_0x6d90('0x1f')](handleEntityNotFound(_0x54e8ad,null))[_0x6d90('0x1f')](respondWithResult(_0x54e8ad,null))['catch'](handleError(_0x54e8ad,null));};exports[_0x6d90('0x44')]=function(_0x4f94aa,_0x4493d9){return db[_0x6d90('0x3a')][_0x6d90('0x44')](_0x4f94aa[_0x6d90('0x45')],{})[_0x6d90('0x1f')](respondWithResult(_0x4493d9,0xc9))[_0x6d90('0x3f')](handleError(_0x4493d9,null));};exports[_0x6d90('0x46')]=function(_0x3b2bef,_0x35edaf){if(_0x3b2bef[_0x6d90('0x45')]['id']){delete _0x3b2bef[_0x6d90('0x45')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x3b2bef[_0x6d90('0x41')]['id']}})['then'](handleEntityNotFound(_0x35edaf,null))[_0x6d90('0x1f')](saveUpdates(_0x3b2bef[_0x6d90('0x45')],null))['then'](respondWithResult(_0x35edaf,null))[_0x6d90('0x3f')](handleError(_0x35edaf,null));};exports[_0x6d90('0x20')]=function(_0xdbe6c5,_0xad5987){return db[_0x6d90('0x3a')]['find']({'where':{'id':_0xdbe6c5[_0x6d90('0x41')]['id']}})[_0x6d90('0x1f')](handleEntityNotFound(_0xad5987,null))['then'](removeEntity(_0xad5987,null))['catch'](handleError(_0xad5987,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 3c2b605..8b018b7 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 _0xff50=['request-promise','path','../../config/environment','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird'];(function(_0x414531,_0x1854c8){var _0x26baec=function(_0x21c0ef){while(--_0x21c0ef){_0x414531['push'](_0x414531['shift']());}};_0x26baec(++_0x1854c8);}(_0xff50,0xb0));var _0x0ff5=function(_0x2867d8,_0xef3ee0){_0x2867d8=_0x2867d8-0x0;var _0x3b8176=_0xff50[_0x2867d8];return _0x3b8176;};'use strict';var _=require(_0x0ff5('0x0'));var util=require(_0x0ff5('0x1'));var logger=require('../../config/logger')(_0x0ff5('0x2'));var moment=require('moment');var BPromise=require(_0x0ff5('0x3'));var rp=require(_0x0ff5('0x4'));var fs=require('fs');var path=require(_0x0ff5('0x5'));var rimraf=require('rimraf');var config=require(_0x0ff5('0x6'));var attributes=require('./openchannelApplication.attributes');module[_0x0ff5('0x7')]=function(_0x21049b,_0x50dfe8){return _0x21049b[_0x0ff5('0x8')]('OpenchannelApplication',attributes,{'tableName':_0x0ff5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0ff5('0xa'),'collate':_0x0ff5('0xb')});}; \ No newline at end of file +var _0x9454=['./openchannelApplication.attributes','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9454,0xb9));var _0x4945=function(_0x1fc634,_0x2980bf){_0x1fc634=_0x1fc634-0x0;var _0x2a65fa=_0x9454[_0x1fc634];return _0x2a65fa;};'use strict';var _=require(_0x4945('0x0'));var util=require(_0x4945('0x1'));var logger=require(_0x4945('0x2'))('api');var moment=require(_0x4945('0x3'));var BPromise=require('bluebird');var rp=require(_0x4945('0x4'));var fs=require('fs');var path=require(_0x4945('0x5'));var rimraf=require(_0x4945('0x6'));var config=require('../../config/environment');var attributes=require(_0x4945('0x7'));module['exports']=function(_0x34c94d,_0x416a7a){return _0x34c94d['define'](_0x4945('0x8'),attributes,{'tableName':_0x4945('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4945('0xa'),'collate':_0x4945('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 04a6b55..cdf2edb 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(_0x37c0ac,_0xa6f090){var _0xf22837=function(_0x3e5340){while(--_0x3e5340){_0x37c0ac['push'](_0x37c0ac['shift']());}};_0xf22837(++_0xa6f090);}(_0xb10b,0x12a));var _0xbb10=function(_0x51aee3,_0x30c7e4){_0x51aee3=_0x51aee3-0x0;var _0x346280=_0xb10b[_0x51aee3];return _0x346280;};'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(_0x2ed311,_0x47a90f){var _0x520e64=function(_0x48eaad){while(--_0x48eaad){_0x2ed311['push'](_0x2ed311['shift']());}};_0x520e64(++_0x47a90f);}(_0xb10b,0x12a));var _0xbb10=function(_0x52b62b,_0x1100cd){_0x52b62b=_0x52b62b-0x0;var _0x3d14d0=_0xb10b[_0x52b62b];return _0x3d14d0;};'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 1f27f9a..55dd428 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 _0xd34b=['show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','openchannelinteraction:update','update','delete','/:id','openchannelinteraction:destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x41207b,_0x339607){var _0x3f6a4d=function(_0x57f694){while(--_0x57f694){_0x41207b['push'](_0x41207b['shift']());}};_0x3f6a4d(++_0x339607);}(_0xd34b,0xdb));var _0xbd34=function(_0x77fd31,_0x102dcd){_0x77fd31=_0x77fd31-0x0;var _0x3069ba=_0xd34b[_0x77fd31];return _0x3069ba;};'use strict';var multer=require(_0xbd34('0x0'));var util=require(_0xbd34('0x1'));var path=require('path');var timeout=require(_0xbd34('0x2'));var express=require(_0xbd34('0x3'));var router=express[_0xbd34('0x4')]();var auth=require(_0xbd34('0x5'));var interaction=require(_0xbd34('0x6'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0xbd34('0x7')]('/',auth[_0xbd34('0x8')](),controller[_0xbd34('0x9')]);router[_0xbd34('0x7')](_0xbd34('0xa'),auth['isAuthenticated'](),controller[_0xbd34('0xb')]);router['get']('/:id',auth[_0xbd34('0x8')](),controller[_0xbd34('0xc')]);router[_0xbd34('0x7')]('/:id/messages',auth[_0xbd34('0x8')](),controller[_0xbd34('0xd')]);router[_0xbd34('0x7')](_0xbd34('0xe'),auth['isAuthenticated'](),controller[_0xbd34('0xf')]);router[_0xbd34('0x10')]('/',auth[_0xbd34('0x8')](),controller[_0xbd34('0x11')]);router[_0xbd34('0x10')](_0xbd34('0x12'),auth[_0xbd34('0x8')](),controller[_0xbd34('0x13')]);router[_0xbd34('0x10')](_0xbd34('0x14'),auth[_0xbd34('0x8')](),interaction[_0xbd34('0x15')]('openchannel',_0xbd34('0x16')),controller[_0xbd34('0x17')]);router[_0xbd34('0x18')]('/:id',auth[_0xbd34('0x8')](),interaction['tracked'](_0xbd34('0x19'),_0xbd34('0x1a')),controller[_0xbd34('0x1b')]);router[_0xbd34('0x1c')](_0xbd34('0x1d'),auth[_0xbd34('0x8')](),interaction['tracked'](_0xbd34('0x19'),_0xbd34('0x1e')),controller['destroy']);router[_0xbd34('0x1c')]('/:id/tags',auth[_0xbd34('0x8')](),controller[_0xbd34('0x1f')]);module[_0xbd34('0x20')]=router; \ No newline at end of file +var _0x6bbf=['addMessage','/:id/tags','openchannelinteraction:addtags','put','tracked','openchannel','openchannelinteraction:update','/:id','openchannelinteraction:destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','show','/:id/messages','/:id/download','download','post','create'];(function(_0x41ab1b,_0x57d88d){var _0x1eb81f=function(_0x1d24be){while(--_0x1d24be){_0x41ab1b['push'](_0x41ab1b['shift']());}};_0x1eb81f(++_0x57d88d);}(_0x6bbf,0x1ec));var _0xf6bb=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x6bbf[_0xd09668];return _0x68726;};'use strict';var multer=require(_0xf6bb('0x0'));var util=require(_0xf6bb('0x1'));var path=require(_0xf6bb('0x2'));var timeout=require(_0xf6bb('0x3'));var express=require(_0xf6bb('0x4'));var router=express[_0xf6bb('0x5')]();var auth=require(_0xf6bb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf6bb('0x7'));var controller=require(_0xf6bb('0x8'));router[_0xf6bb('0x9')]('/',auth[_0xf6bb('0xa')](),controller[_0xf6bb('0xb')]);router[_0xf6bb('0x9')]('/describe',auth[_0xf6bb('0xa')](),controller['describe']);router[_0xf6bb('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xf6bb('0xc')]);router[_0xf6bb('0x9')](_0xf6bb('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0xf6bb('0x9')](_0xf6bb('0xe'),auth['isAuthenticated'](),controller[_0xf6bb('0xf')]);router[_0xf6bb('0x10')]('/',auth[_0xf6bb('0xa')](),controller[_0xf6bb('0x11')]);router[_0xf6bb('0x10')](_0xf6bb('0xd'),auth[_0xf6bb('0xa')](),controller[_0xf6bb('0x12')]);router['post'](_0xf6bb('0x13'),auth[_0xf6bb('0xa')](),interaction['tracked']('openchannel',_0xf6bb('0x14')),controller['addTags']);router[_0xf6bb('0x15')]('/:id',auth['isAuthenticated'](),interaction[_0xf6bb('0x16')](_0xf6bb('0x17'),_0xf6bb('0x18')),controller['update']);router['delete'](_0xf6bb('0x19'),auth[_0xf6bb('0xa')](),interaction[_0xf6bb('0x16')](_0xf6bb('0x17'),_0xf6bb('0x1a')),controller['destroy']);router[_0xf6bb('0x1b')](_0xf6bb('0x13'),auth[_0xf6bb('0xa')](),controller[_0xf6bb('0x1c')]);module[_0xf6bb('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index a0dafb8..6578c06 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 _0x77ff=['exports','STRING','DATE','out'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x77ff,0x168));var _0xf77f=function(_0x252105,_0x4c3399){_0x252105=_0x252105-0x0;var _0xaaf6=_0x77ff[_0x252105];return _0xaaf6;};'use strict';var Sequelize=require('sequelize');module[_0xf77f('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xf77f('0x1')]},'note':{'type':Sequelize[_0xf77f('0x1')]},'read1stAt':{'type':Sequelize[_0xf77f('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xf77f('0x1')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf77f('0x3')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8fd6=['ENUM','out','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x8fd6,0x1ec));var _0x68fd=function(_0x1416fc,_0x72e155){_0x1416fc=_0x1416fc-0x0;var _0x3a4b34=_0x8fd6[_0x1416fc];return _0x3a4b34;};'use strict';var Sequelize=require(_0x68fd('0x0'));module[_0x68fd('0x1')]={'closed':{'type':Sequelize[_0x68fd('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x68fd('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x68fd('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x68fd('0x3')]},'externalUrl':{'type':Sequelize[_0x68fd('0x3')]},'lastMsgAt':{'type':Sequelize[_0x68fd('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x68fd('0x5')]('in',_0x68fd('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x68fd('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index bc1509c..9146f7e 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 _0xb3ce=['params','rawAttributes','intersection','includeAll','merge','create','body','describe','addMessage','ids','omit','findOne','YYYY-MM-DD\x20HH:mm:ss','options','OpenchannelMessage','findAll','setTags','Tag','emit','removeTags','download','unix','join','root','server','files','format','transcript-%d-%s.zip','User','CmContact','attachments','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','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.','closedAt','Public','Private','existsSync','createReadStream','pipe','createWriteStream','out','System','Contact','lastName','basename','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','status','end','json','offset','limit','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','Users','fullname','split','forEach','push','catch','index','map','OpenchannelInteraction','fieldName','key','model','query','keys','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','field','color','from','tools_tags','select','u.id','u.fullname','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','UserId','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\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','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','count','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','toString','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','rows','show'];(function(_0x2e5c32,_0x181a62){var _0x18d1be=function(_0x27e88c){while(--_0x27e88c){_0x2e5c32['push'](_0x2e5c32['shift']());}};_0x18d1be(++_0x181a62);}(_0xb3ce,0x12f));var _0xeb3c=function(_0x3369a8,_0xfea8b1){_0x3369a8=_0x3369a8-0x0;var _0x4b5e69=_0xb3ce[_0x3369a8];return _0x4b5e69;};'use strict';var pdf=require(_0xeb3c('0x0'));var emlformat=require(_0xeb3c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xeb3c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb3c('0x3'));var moment=require(_0xeb3c('0x4'));var BPromise=require(_0xeb3c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xeb3c('0x6'));var sox=require(_0xeb3c('0x7'));var csv=require(_0xeb3c('0x8'));var ejs=require(_0xeb3c('0x9'));var fs=require('fs');var _=require(_0xeb3c('0xa'));var squel=require(_0xeb3c('0xb'));var crypto=require(_0xeb3c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xeb3c('0x8'));var querystring=require(_0xeb3c('0xd'));var Papa=require(_0xeb3c('0xe'));var Redis=require(_0xeb3c('0xf'));var authService=require(_0xeb3c('0x10'));var qs=require(_0xeb3c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb3c('0x12'));var logger=require(_0xeb3c('0x13'))(_0xeb3c('0x14'));var utils=require('../../config/utils');var config=require(_0xeb3c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xeb3c('0x16'))['db'];config[_0xeb3c('0x17')]=_[_0xeb3c('0x18')](config[_0xeb3c('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xeb3c('0x19'))(new Redis(config[_0xeb3c('0x17')]));require('./openchannelInteraction.socket')[_0xeb3c('0x1a')](socket);function respondWithStatusCode(_0x4353d7,_0x547c0e){_0x547c0e=_0x547c0e||0xcc;return function(_0x32d522){if(_0x32d522){return _0x4353d7['sendStatus'](_0x547c0e);}return _0x4353d7[_0xeb3c('0x1b')](_0x547c0e)[_0xeb3c('0x1c')]();};}function respondWithResult(_0x3c987f,_0x134af1){_0x134af1=_0x134af1||0xc8;return function(_0xbedd96){if(_0xbedd96){return _0x3c987f['status'](_0x134af1)[_0xeb3c('0x1d')](_0xbedd96);}};}function respondWithFilteredResult(_0x2125a7,_0x3aa7a7){return function(_0x1577b2){if(_0x1577b2){var _0x3ad113=_0x1577b2['count'],_0x2ceef9=_0x3aa7a7[_0xeb3c('0x1e')],_0x200de4=_0x3aa7a7[_0xeb3c('0x1e')]+_0x3aa7a7[_0xeb3c('0x1f')],_0x5c0c5c;if(_0x200de4>=_0x3ad113){_0x200de4=_0x3ad113;_0x5c0c5c=0xc8;}else{_0x5c0c5c=0xce;}_0x2125a7[_0xeb3c('0x1b')](_0x5c0c5c);return _0x2125a7['set'](_0xeb3c('0x20'),_0x2ceef9+'-'+_0x200de4+'/'+_0x3ad113)['json'](_0x1577b2);}return null;};}function patchUpdates(_0x4d83df){return function(_0x1cfb29){try{jsonpatch[_0xeb3c('0x21')](_0x1cfb29,_0x4d83df,!![]);}catch(_0x3a55ce){return BPromise[_0xeb3c('0x22')](_0x3a55ce);}return _0x1cfb29[_0xeb3c('0x23')]();};}function saveUpdates(_0x1be348,_0x1017db){return function(_0x8a8824){if(_0x8a8824){return _0x8a8824[_0xeb3c('0x24')](_0x1be348)['then'](function(_0x5be5bd){return _0x5be5bd;});}return null;};}function removeEntity(_0x2f3559,_0x7eab75){return function(_0x5cad54){if(_0x5cad54){return _0x5cad54[_0xeb3c('0x25')]()[_0xeb3c('0x26')](function(){_0x2f3559[_0xeb3c('0x1b')](0xcc)[_0xeb3c('0x1c')]();});}};}function handleEntityNotFound(_0x504442,_0x8bcac4){return function(_0x2a2d5c){if(!_0x2a2d5c){_0x504442[_0xeb3c('0x27')](0x194);}return _0x2a2d5c;};}function handleError(_0x515d8d,_0x25c546){_0x25c546=_0x25c546||0x1f4;return function(_0x1e7b69){logger['error'](_0x1e7b69[_0xeb3c('0x28')]);if(_0x1e7b69[_0xeb3c('0x29')]){delete _0x1e7b69[_0xeb3c('0x29')];}_0x515d8d[_0xeb3c('0x1b')](_0x25c546)['send'](_0x1e7b69);};}function getInteractionUsers(_0x35b801,_0x2fd971){return new BPromise(function(_0xd0f615,_0xf04400){try{if(_0x2fd971[_0x35b801['id']]){_0x35b801[_0xeb3c('0x2a')]=_['map'](_0x2fd971[_0x35b801['id']],function(_0x59e939){return{'id':_0x59e939['id'],'fullname':_0x59e939[_0xeb3c('0x2b')]};});}}catch(_0x4ba858){_0xf04400(_0x4ba858);}_0xd0f615(_0x35b801);});}function getInteractionTags(_0x2b2d8c,_0x3a14ca){return new BPromise(function(_0x40b999,_0x5cafc7){try{if(_0x2b2d8c['TagIds']){_0x2b2d8c['Tags']=[];_0x2b2d8c['TagIds'][_0xeb3c('0x2c')](',')[_0xeb3c('0x2d')](function(_0x54a12d){_0x2b2d8c['Tags'][_0xeb3c('0x2e')](_0x3a14ca[_0x54a12d]);});}delete _0x2b2d8c['TagIds'];}catch(_0x5051be){_0x5cafc7(_0x5051be);}_0x40b999(_0x2b2d8c);});}function updateOpenchannelInteraction(_0x4d8402,_0x26cb92,_0x44c38d){return new BPromise(function(_0x7b4068,_0x86976){return getInteractionUsers(_0x4d8402,_0x44c38d)[_0xeb3c('0x26')](function(_0x34033b){return getInteractionTags(_0x34033b,_0x26cb92);})[_0xeb3c('0x26')](function(_0x56b5b0){_0x7b4068(_0x56b5b0);})[_0xeb3c('0x2f')](function(_0x1afd95){_0x86976(_0x1afd95);});});}exports[_0xeb3c('0x30')]=function(_0x275faa,_0x1fa3c3){var _0x5b159b={},_0xa82d36={},_0x5d9540={'count':0x0,'rows':[]};var _0x394be1=_[_0xeb3c('0x31')](db[_0xeb3c('0x32')]['rawAttributes'],function(_0x2c0d99){return{'name':_0x2c0d99[_0xeb3c('0x33')],'type':_0x2c0d99['type'][_0xeb3c('0x34')]};});_0xa82d36[_0xeb3c('0x35')]=_[_0xeb3c('0x31')](_0x394be1,_0xeb3c('0x29'));_0xa82d36[_0xeb3c('0x36')]=_[_0xeb3c('0x37')](_0x275faa[_0xeb3c('0x36')]);_0xa82d36['filters']=_['intersection'](_0xa82d36[_0xeb3c('0x35')],_0xa82d36[_0xeb3c('0x36')]);_0x5b159b[_0xeb3c('0x38')]=_['intersection'](_0xa82d36['model'],qs[_0xeb3c('0x39')](_0x275faa[_0xeb3c('0x36')][_0xeb3c('0x39')]));_0x5b159b[_0xeb3c('0x38')]=_0x5b159b['attributes']['length']?_0x5b159b[_0xeb3c('0x38')]:_0xa82d36[_0xeb3c('0x35')];if(!_0x275faa[_0xeb3c('0x36')][_0xeb3c('0x3a')](_0xeb3c('0x3b'))){_0x5b159b[_0xeb3c('0x1f')]=qs[_0xeb3c('0x1f')](_0x275faa[_0xeb3c('0x36')][_0xeb3c('0x1f')]);_0x5b159b[_0xeb3c('0x1e')]=qs[_0xeb3c('0x1e')](_0x275faa[_0xeb3c('0x36')][_0xeb3c('0x1e')]);}_0x5b159b['order']=qs[_0xeb3c('0x3c')](_0x275faa[_0xeb3c('0x36')][_0xeb3c('0x3c')]);_0x5b159b[_0xeb3c('0x3d')]=qs[_0xeb3c('0x3e')](_[_0xeb3c('0x3f')](_0x275faa[_0xeb3c('0x36')],_0xa82d36[_0xeb3c('0x3e')]),_0x394be1);var _0x5e5524=[];var _0x36c338=squel['select']()[_0xeb3c('0x40')]('id')[_0xeb3c('0x40')]('name')['field'](_0xeb3c('0x41'))[_0xeb3c('0x42')](_0xeb3c('0x43'));var _0x4e33bf=squel[_0xeb3c('0x44')]()[_0xeb3c('0x40')](_0xeb3c('0x45'))[_0xeb3c('0x40')](_0xeb3c('0x46'))['field']('ui.OpenchannelInteractionId')[_0xeb3c('0x42')]('user_has_openchannel_interactions','ui')[_0xeb3c('0x47')]('users','u','u.id\x20=\x20ui.UserId');var _0x30c020=squel[_0xeb3c('0x44')]()[_0xeb3c('0x42')]('openchannel_interactions','i')['left_join'](_0xeb3c('0x48'),'c',_0xeb3c('0x49'))[_0xeb3c('0x47')](_0xeb3c('0x4a'),'o','o.id\x20=\x20i.UserId')[_0xeb3c('0x47')](_0xeb3c('0x4b'),'a',_0xeb3c('0x4c'))[_0xeb3c('0x47')](_0xeb3c('0x4d'),'me',_0xeb3c('0x4e'))[_0xeb3c('0x47')](_0xeb3c('0x4f'),'it',_0xeb3c('0x50'))[_0xeb3c('0x47')](_0xeb3c('0x43'),'t','t.id\x20=\x20it.TagId');var _0x5ebbb6=squel['expr']();var _0x14c05a=[];var _0x272b3e=squel[_0xeb3c('0x51')]();var _0x4cf0da;if(_0x275faa[_0xeb3c('0x36')]['search']){_0x4cf0da=as[_0xeb3c('0x52')](_0x275faa[_0xeb3c('0x36')]['search']);var _0x2ab51e=_0x4cf0da[_0xeb3c('0x53')];for(var _0x34ff5f=0x0;_0x34ff5f<_0x4cf0da[_0xeb3c('0x54')][_0xeb3c('0x55')];_0x34ff5f++){var _0x210d00=_0x4cf0da[_0xeb3c('0x54')][_0x34ff5f];var _0x7efbe8='i';var _0x4878fc=_[_0xeb3c('0x56')](_0x394be1,['name',_0x210d00['field']]);if(!_0x4878fc){switch(_0x210d00[_0xeb3c('0x40')]){case _0xeb3c('0x57'):if(_0x210d00[_0xeb3c('0x58')]==0x1){_0x30c020[_0xeb3c('0x59')]('`'+_0x210d00[_0xeb3c('0x40')]+'`\x20=\x200');}else{_0x30c020[_0xeb3c('0x59')]('`'+_0x210d00[_0xeb3c('0x40')]+_0xeb3c('0x5a'));}break;case'Contact':if(_0x210d00[_0xeb3c('0x5b')]===_0xeb3c('0x5c')){if(_0x210d00[_0xeb3c('0x58')]['split']('\x20')['length']>0x1){_0x5ebbb6[_0x2ab51e](_0xeb3c('0x5d'),qs[_0xeb3c('0x5e')](_0x210d00[_0xeb3c('0x58')]),null);}else{var _0xc248a='%'+_0x210d00['value']+'%';_0x5ebbb6[_0x2ab51e](_0xeb3c('0x5f'),_0xc248a,_0xc248a,_0xc248a);}}else{_0x4878fc=_[_0xeb3c('0x56')](_0x394be1,['name',_0xeb3c('0x60')]);_0x210d00[_0xeb3c('0x40')]=_0xeb3c('0x60');_0x104361=as[_0xeb3c('0x61')](_0x7efbe8,_0x4878fc[_0xeb3c('0x62')],_0x210d00);_0x5ebbb6[_0x2ab51e](_0x104361[_0xeb3c('0x63')],_0x104361[_0xeb3c('0x58')][_0xeb3c('0x64')],_0x104361[_0xeb3c('0x58')][_0xeb3c('0x1c')]);}break;case'Tag':var _0x1f7e5c=_0x210d00[_0xeb3c('0x58')]['split'](',')[_0xeb3c('0x31')](function(_0x2c8021){return Number(_0x2c8021);});_0x1f7e5c[_0xeb3c('0x2d')](function(_0x3901c0){_0x272b3e['or'](_0xeb3c('0x65'),'%,'+_0x3901c0+',%');});_0x14c05a=_['union'](_0x14c05a,_0x1f7e5c);break;case'User':if(_0x210d00['operator']===_0xeb3c('0x5c')){_0x5ebbb6[_0x2ab51e]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x210d00[_0xeb3c('0x58')]+'%',null);}else{_0x4878fc=_[_0xeb3c('0x56')](_0x394be1,[_0xeb3c('0x29'),_0xeb3c('0x66')]);_0x210d00[_0xeb3c('0x40')]=_0xeb3c('0x66');_0x104361=as['buildExpression'](_0x7efbe8,_0x4878fc[_0xeb3c('0x62')],_0x210d00);_0x5ebbb6[_0x2ab51e](_0x104361[_0xeb3c('0x63')],_0x104361[_0xeb3c('0x58')][_0xeb3c('0x64')],_0x104361['value'][_0xeb3c('0x1c')]);}break;case'body':_0x104361=as[_0xeb3c('0x61')]('me',null,_0x210d00);_0x5ebbb6[_0x2ab51e](_0x104361[_0xeb3c('0x63')],_0x104361[_0xeb3c('0x58')][_0xeb3c('0x64')],_0x104361[_0xeb3c('0x58')]['end']);break;}}else{var _0x104361=as[_0xeb3c('0x61')](_0x7efbe8,_0x4878fc[_0xeb3c('0x62')],_0x210d00);_0x5ebbb6[_0x2ab51e](_0x104361[_0xeb3c('0x63')],_0x104361['value'][_0xeb3c('0x64')],_0x104361[_0xeb3c('0x58')]['end']);}}}else{var _0x27879a=_(_0x275faa['query'])[_0xeb3c('0x37')]()[_0xeb3c('0x31')](function(_0x9b12da){return _[_0xeb3c('0x67')](_0x394be1,[_0xeb3c('0x29'),_0x9b12da])?_0x9b12da:undefined;})[_0xeb3c('0x68')]()[_0xeb3c('0x58')]();if(!_[_0xeb3c('0x69')](_0x27879a)){_0x27879a[_0xeb3c('0x2d')](function(_0x2f86b6){if(_0x2f86b6===_0xeb3c('0x6a')){_0x30c020[_0xeb3c('0x3d')](_0xeb3c('0x6b'),[][_0xeb3c('0x6c')](_0x275faa[_0xeb3c('0x36')][_0x2f86b6]));}else if(_0x2f86b6===_0xeb3c('0x6d')){var _0x5cfbd0=JSON[_0xeb3c('0x6e')](_0x275faa['query'][_0x2f86b6])[_0xeb3c('0x6f')];var _0x998b07=JSON['parse'](_0x275faa[_0xeb3c('0x36')][_0x2f86b6])[_0xeb3c('0x70')];_0x30c020[_0xeb3c('0x3d')](_0xeb3c('0x71'),_0x5cfbd0,_0x998b07);}else{if(_0x275faa['query'][_0x2f86b6]===_0xeb3c('0x72')){_0x30c020[_0xeb3c('0x3d')]('i.'+_0x2f86b6+_0xeb3c('0x73'));}else{_0x30c020['where']('i.'+_0x2f86b6+_0xeb3c('0x74'),_0x275faa[_0xeb3c('0x36')][_0x2f86b6]);}}});}if(_0x275faa[_0xeb3c('0x36')][_0xeb3c('0x75')]){if(_0x275faa[_0xeb3c('0x36')][_0xeb3c('0x75')]==0x1){_0x30c020[_0xeb3c('0x59')](_0xeb3c('0x76'));}else{_0x30c020[_0xeb3c('0x59')](_0xeb3c('0x77'));}}if(_0x275faa['query'][_0xeb3c('0x78')]){_0x14c05a=_[_0xeb3c('0x79')](_0x275faa[_0xeb3c('0x36')][_0xeb3c('0x78')])?_0x275faa[_0xeb3c('0x36')][_0xeb3c('0x78')]:new Array(_0x275faa[_0xeb3c('0x36')][_0xeb3c('0x78')]);_0x14c05a['forEach'](function(_0x18988e){_0x272b3e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x18988e+',%');});}if(_0x275faa['query'][_0xeb3c('0x7a')]){var _0x5c063e=_0x275faa[_0xeb3c('0x36')][_0xeb3c('0x7a')]['replace']('\x5c','\x5c\x5c')[_0xeb3c('0x7b')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0xeb3c('0x7c')](_0x5c063e)){_0x5ebbb6['or'](_0xeb3c('0x7d'),_0x5c063e+'%');}else{_0x5ebbb6['or'](_0xeb3c('0x7e'),qs['getFullTextValue'](_0x5c063e))['or']('i.from\x20LIKE\x20?',_0x5c063e+'%')['or'](_0xeb3c('0x7f'),_0x5c063e+'%');}}}_0x30c020[_0xeb3c('0x3d')](_0x5ebbb6);_0x30c020['group'](_0xeb3c('0x80'));var _0x10ff26={'type':db[_0xeb3c('0x81')][_0xeb3c('0x82')]['SELECT'],'raw':!![]};var _0x4f48e3=_0x30c020[_0xeb3c('0x83')]();_0x4f48e3['field'](_0xeb3c('0x80'));_0x4f48e3['field'](_0xeb3c('0x84'),_0xeb3c('0x57'));if(_0x5b159b[_0xeb3c('0x85')]){_0x5b159b[_0xeb3c('0x85')][_0xeb3c('0x2d')](function(_0x3a4d92){_0x30c020[_0xeb3c('0x85')]('i.'+_0x3a4d92[0x0],_0x3a4d92[0x1]==='DESC'?![]:!![]);});}if(!_[_0xeb3c('0x69')](_0x14c05a)){_0x30c020['having'](_0x272b3e);_0x4f48e3['where'](_0xeb3c('0x86'),_0x14c05a);}BPromise[_0xeb3c('0x87')]()[_0xeb3c('0x26')](function(){if(!_0x4cf0da){if(_0x275faa['query'][_0xeb3c('0x6a')]||_0x275faa[_0xeb3c('0x36')]['journey'])return;_0x4f48e3[_0xeb3c('0x3d')](_0xeb3c('0x88'));_0x30c020['where'](_0xeb3c('0x88'));return;}return _0x275faa[_0xeb3c('0x89')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xeb3c('0x26')](function(_0x135adf){if(_[_0xeb3c('0x69')](_0x135adf)){_0x4f48e3[_0xeb3c('0x3d')](_0xeb3c('0x8a'));_0x30c020['where'](_0xeb3c('0x8a'));}else{_0x4f48e3['where'](_0xeb3c('0x6b'),_[_0xeb3c('0x31')](_0x135adf,'id'));_0x30c020[_0xeb3c('0x3d')](_0xeb3c('0x6b'),_[_0xeb3c('0x31')](_0x135adf,'id'));}});})['then'](function(){db[_0xeb3c('0x8b')][_0xeb3c('0x36')](_0x4f48e3['toString'](),_0x10ff26)[_0xeb3c('0x26')](function(_0x54e609){_0x5d9540[_0xeb3c('0x8c')]=_0x54e609[_0xeb3c('0x55')];if(_0x5d9540[_0xeb3c('0x8c')]===0x0)return[];return db['sequelize'][_0xeb3c('0x36')](_0x36c338['toString'](),_0x10ff26)['then'](function(_0x1cc3fe){_0x5e5524=_[_0xeb3c('0x8d')](_0x1cc3fe,'id');_0x10ff26=_['merge'](_0x10ff26,{'model':db[_0xeb3c('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x275faa[_0xeb3c('0x36')]['fields']){_0x5b159b[_0xeb3c('0x38')][_0xeb3c('0x2d')](function(_0x545d19){_0x30c020[_0xeb3c('0x40')]('i.'+_0x545d19);});}else{_0x30c020[_0xeb3c('0x40')](_0xeb3c('0x84'),_0xeb3c('0x57'));_0x30c020[_0xeb3c('0x40')](_0xeb3c('0x8e'),'Account.key');_0x30c020['field'](_0xeb3c('0x8f'),_0xeb3c('0x90'));_0x30c020[_0xeb3c('0x40')](_0xeb3c('0x91'));_0x30c020[_0xeb3c('0x40')](_0xeb3c('0x92'),_0xeb3c('0x93'));_0x30c020['field'](_0xeb3c('0x94'),'Contact.lastName');_0x30c020[_0xeb3c('0x40')](_0xeb3c('0x95'),_0xeb3c('0x96'));_0x30c020[_0xeb3c('0x40')](_0xeb3c('0x97'),_0xeb3c('0x98'));_0x30c020[_0xeb3c('0x40')](_0xeb3c('0x99'),_0xeb3c('0x9a'));_0x30c020[_0xeb3c('0x40')](_0xeb3c('0x9b'),_0xeb3c('0x9c'));_0x30c020[_0xeb3c('0x40')](_0xeb3c('0x9d'),_0xeb3c('0x9e'));_0x30c020[_0xeb3c('0x40')](_0xeb3c('0x9f'),_0xeb3c('0xa0'));_0x30c020[_0xeb3c('0x40')](_0xeb3c('0xa1'),_0xeb3c('0xa2'));}if(_0x5b159b[_0xeb3c('0x1f')])_0x30c020[_0xeb3c('0x1f')](_0x5b159b[_0xeb3c('0x1f')]);if(_0x5b159b[_0xeb3c('0x1e')])_0x30c020['offset'](_0x5b159b[_0xeb3c('0x1e')]);return db[_0xeb3c('0x8b')]['query'](_0x30c020[_0xeb3c('0xa3')](),_0x10ff26);})[_0xeb3c('0x26')](function(_0x465713){_0x4e33bf[_0xeb3c('0x3d')](_0xeb3c('0xa4'),_[_0xeb3c('0x31')](_0x465713,'id'));return db['sequelize'][_0xeb3c('0x36')](_0x4e33bf[_0xeb3c('0xa3')](),_0x10ff26)['then'](function(_0x11fb2a){var _0x326ece=_[_0xeb3c('0xa5')](_0x11fb2a,_0xeb3c('0xa6'));var _0x2e3f8e=[];_0x465713[_0xeb3c('0x2d')](function(_0x3580be){_0x2e3f8e['push'](updateOpenchannelInteraction(_0x3580be,_0x5e5524,_0x326ece));});return BPromise['all'](_0x2e3f8e);});});})[_0xeb3c('0x26')](function(_0xcb8d9e){_0x5d9540[_0xeb3c('0xa7')]=_0xcb8d9e;return _0x5d9540;})[_0xeb3c('0x26')](respondWithFilteredResult(_0x1fa3c3,_0x5b159b));})[_0xeb3c('0x2f')](handleError(_0x1fa3c3,null));};exports[_0xeb3c('0xa8')]=function(_0x349740,_0x20e84f){var _0x3fc479={};if(_0x349740[_0xeb3c('0x36')][_0xeb3c('0x62')]&&_0x349740[_0xeb3c('0x36')][_0xeb3c('0x62')]===_0xeb3c('0x42')){_0x3fc479[_0xeb3c('0x42')]=_0x349740['params']['id'];}else{_0x3fc479['id']=_0x349740[_0xeb3c('0xa9')]['id'];}var _0x4614e4={'raw':![],'where':_0x3fc479},_0x32999d={};_0x32999d[_0xeb3c('0x35')]=_[_0xeb3c('0x37')](db[_0xeb3c('0x32')][_0xeb3c('0xaa')]);_0x32999d[_0xeb3c('0x36')]=_[_0xeb3c('0x37')](_0x349740[_0xeb3c('0x36')]);_0x32999d['filtears']=_[_0xeb3c('0xab')](_0x32999d['model'],_0x32999d[_0xeb3c('0x36')]);_0x4614e4[_0xeb3c('0x38')]=_[_0xeb3c('0xab')](_0x32999d['model'],qs[_0xeb3c('0x39')](_0x349740[_0xeb3c('0x36')][_0xeb3c('0x39')]));_0x4614e4[_0xeb3c('0x38')]=_0x4614e4[_0xeb3c('0x38')][_0xeb3c('0x55')]?_0x4614e4[_0xeb3c('0x38')]:_0x32999d[_0xeb3c('0x35')];if(_0x349740['query'][_0xeb3c('0xac')]){_0x4614e4['include']=[{'all':!![]}];}_0x4614e4=_[_0xeb3c('0xad')]({},_0x4614e4,_0x349740['options']);return db[_0xeb3c('0x32')][_0xeb3c('0x56')](_0x4614e4)['then'](handleEntityNotFound(_0x20e84f,null))[_0xeb3c('0x26')](respondWithResult(_0x20e84f,null))[_0xeb3c('0x2f')](handleError(_0x20e84f,null));};exports[_0xeb3c('0xae')]=function(_0x119c37,_0x2262b8){return db[_0xeb3c('0x32')]['create'](_0x119c37[_0xeb3c('0xaf')],{})['then'](respondWithResult(_0x2262b8,0xc9))['catch'](handleError(_0x2262b8,null));};exports['update']=function(_0x11dba7,_0x4d01c6){if(_0x11dba7['body']['id']){delete _0x11dba7[_0xeb3c('0xaf')]['id'];}return db[_0xeb3c('0x32')][_0xeb3c('0x56')]({'where':{'id':_0x11dba7[_0xeb3c('0xa9')]['id']}})[_0xeb3c('0x26')](handleEntityNotFound(_0x4d01c6,null))[_0xeb3c('0x26')](saveUpdates(_0x11dba7[_0xeb3c('0xaf')],null))[_0xeb3c('0x26')](respondWithResult(_0x4d01c6,null))[_0xeb3c('0x2f')](handleError(_0x4d01c6,null));};exports[_0xeb3c('0x25')]=function(_0x341d5c,_0x2a73bd){return db[_0xeb3c('0x32')][_0xeb3c('0x56')]({'where':{'id':_0x341d5c[_0xeb3c('0xa9')]['id']}})['then'](handleEntityNotFound(_0x2a73bd,null))[_0xeb3c('0x26')](removeEntity(_0x2a73bd,null))[_0xeb3c('0x2f')](handleError(_0x2a73bd,null));};exports[_0xeb3c('0xb0')]=function(_0x3d563f,_0x464476){return db[_0xeb3c('0x32')][_0xeb3c('0xb0')]()[_0xeb3c('0x26')](respondWithResult(_0x464476,null))[_0xeb3c('0x2f')](handleError(_0x464476,null));};exports[_0xeb3c('0xb1')]=function(_0x4f508f,_0x51973a,_0x2513c2){return db['OpenchannelMessage'][_0xeb3c('0x56')]({'where':{'id':_0x4f508f[_0xeb3c('0xa9')]['id']}})[_0xeb3c('0x26')](handleEntityNotFound(_0x51973a,null))[_0xeb3c('0x26')](function(_0x4bfef3){if(_0x4bfef3){return _0x4bfef3[_0xeb3c('0xb1')](_0x4f508f[_0xeb3c('0xaf')][_0xeb3c('0xb2')],_[_0xeb3c('0xb3')](_0x4f508f[_0xeb3c('0xaf')],[_0xeb3c('0xb2'),'id'])||{});}})[_0xeb3c('0x26')](respondWithResult(_0x51973a,null))[_0xeb3c('0x2f')](handleError(_0x51973a,null));};exports['getMessages']=function(_0x5996c4,_0x5e78bc,_0x3fa132){var _0x1a2dd9={'raw':![],'where':{}};var _0x145e3c={};var _0x2d2a3d={'count':0x0,'rows':[]};return db[_0xeb3c('0x32')][_0xeb3c('0xb4')]({'where':{'id':_0x5996c4[_0xeb3c('0xa9')]['id']}})[_0xeb3c('0x26')](handleEntityNotFound(_0x5e78bc,null))[_0xeb3c('0x26')](function(_0x212580){if(_0x212580){_0x145e3c[_0xeb3c('0x35')]=_[_0xeb3c('0x37')](db['OpenchannelMessage'][_0xeb3c('0xaa')]);_0x145e3c[_0xeb3c('0x36')]=_[_0xeb3c('0x37')](_0x5996c4[_0xeb3c('0x36')]);_0x145e3c[_0xeb3c('0x3e')]=_[_0xeb3c('0xab')](_0x145e3c[_0xeb3c('0x35')],_0x145e3c[_0xeb3c('0x36')]);_0x1a2dd9[_0xeb3c('0x38')]=_[_0xeb3c('0xab')](_0x145e3c[_0xeb3c('0x35')],qs[_0xeb3c('0x39')](_0x5996c4['query']['fields']));_0x1a2dd9[_0xeb3c('0x38')]=_0x1a2dd9[_0xeb3c('0x38')][_0xeb3c('0x55')]?_0x1a2dd9[_0xeb3c('0x38')]:_0x145e3c['model'];if(!_0x5996c4[_0xeb3c('0x36')][_0xeb3c('0x3a')]('nolimit')){_0x1a2dd9[_0xeb3c('0x1f')]=qs[_0xeb3c('0x1f')](_0x5996c4[_0xeb3c('0x36')]['limit']);_0x1a2dd9['offset']=qs['offset'](_0x5996c4[_0xeb3c('0x36')][_0xeb3c('0x1e')]);}_0x1a2dd9[_0xeb3c('0x85')]=qs['sort'](_0x5996c4['query'][_0xeb3c('0x3c')]);_0x1a2dd9[_0xeb3c('0x3d')]=qs[_0xeb3c('0x3e')](_[_0xeb3c('0x3f')](_0x5996c4[_0xeb3c('0x36')],_0x145e3c['filters']));_0x1a2dd9['where']['OpenchannelInteractionId']=_0x212580['id'];if(_0x5996c4['query']['filter']){_0x1a2dd9[_0xeb3c('0x3d')]=_[_0xeb3c('0xad')](_0x1a2dd9[_0xeb3c('0x3d')],{'$or':_['map'](_0x1a2dd9[_0xeb3c('0x38')],function(_0xe673e9){var _0x2bbb47={};_0x2bbb47[_0xe673e9]={'$like':'%'+_0x5996c4[_0xeb3c('0x36')]['filter']+'%'};return _0x2bbb47;})});}if(_0x5996c4['query'][_0xeb3c('0x6f')]){var _0x2c2638=_0x5996c4[_0xeb3c('0x36')][_0xeb3c('0x6f')][_0xeb3c('0x2c')](',');var _0x7048a8={};_0x7048a8[_0x2c2638[0x0]]={'$gte':moment(_0x2c2638[0x1])['format'](_0xeb3c('0xb5'))};_0x1a2dd9[_0xeb3c('0x3d')]=_[_0xeb3c('0xad')](_0x1a2dd9['where'],_0x7048a8);}_0x1a2dd9=_[_0xeb3c('0xad')]({},_0x1a2dd9,_0x5996c4[_0xeb3c('0xb6')]);return db['OpenchannelMessage'][_0xeb3c('0x8c')]({'where':_0x1a2dd9[_0xeb3c('0x3d')]})[_0xeb3c('0x26')](function(_0x27a980){_0x2d2a3d[_0xeb3c('0x8c')]=_0x27a980;if(_0x5996c4[_0xeb3c('0x36')]['includeAll']){_0x1a2dd9['include']=[{'all':!![]}];}return db[_0xeb3c('0xb7')][_0xeb3c('0xb8')](_0x1a2dd9);})[_0xeb3c('0x26')](function(_0x436b1e){_0x2d2a3d[_0xeb3c('0xa7')]=_0x436b1e;return _0x2d2a3d;});}})['then'](respondWithFilteredResult(_0x5e78bc,_0x1a2dd9))[_0xeb3c('0x2f')](handleError(_0x5e78bc,null));};exports['addTags']=function(_0x53b02c,_0x2a6033,_0x4192c8){return db[_0xeb3c('0x32')][_0xeb3c('0x56')]({'where':{'id':_0x53b02c[_0xeb3c('0xa9')]['id']}})[_0xeb3c('0x26')](handleEntityNotFound(_0x2a6033,null))[_0xeb3c('0x26')](function(_0x46afbd){if(_0x46afbd){return _0x46afbd[_0xeb3c('0xb9')](_0x53b02c['body'][_0xeb3c('0xb2')],_['omit'](_0x53b02c[_0xeb3c('0xaf')],[_0xeb3c('0xb2'),'id'])||{})['spread'](function(){return db[_0xeb3c('0xba')][_0xeb3c('0xb8')]({'attributes':['id',_0xeb3c('0x29'),_0xeb3c('0x41')],'where':{'id':_0x53b02c['body']['ids']}});})[_0xeb3c('0x26')](function(_0xe3bf66){socket[_0xeb3c('0xbb')]('openchannelInteractionTags:save',{'id':Number(_0x53b02c[_0xeb3c('0xa9')]['id']),'tags':_0xe3bf66||[]});return{'id':Number(_0x53b02c[_0xeb3c('0xa9')]['id']),'tags':_0xe3bf66||[]};});}})[_0xeb3c('0x26')](respondWithResult(_0x2a6033,null))[_0xeb3c('0x2f')](handleError(_0x2a6033,null));};exports['removeTags']=function(_0x268a28,_0x483db3,_0x5eb4a5){return db[_0xeb3c('0x32')][_0xeb3c('0x56')]({'where':{'id':_0x268a28[_0xeb3c('0xa9')]['id']}})['then'](handleEntityNotFound(_0x483db3,null))[_0xeb3c('0x26')](function(_0x5078ec){if(_0x5078ec){return _0x5078ec[_0xeb3c('0xbc')](_0x268a28[_0xeb3c('0x36')][_0xeb3c('0xb2')]);}})[_0xeb3c('0x26')](respondWithStatusCode(_0x483db3,null))[_0xeb3c('0x2f')](handleError(_0x483db3,null));};exports[_0xeb3c('0xbd')]=function(_0x2ed763,_0xe72074){var _0x2898fd=moment()[_0xeb3c('0xbe')]()[_0xeb3c('0xa3')]();var _0x4ec316=path[_0xeb3c('0xbf')](config[_0xeb3c('0xc0')],_0xeb3c('0xc1'),_0xeb3c('0xc2'),'tmp');var _0x1b460a=path['join'](config[_0xeb3c('0xc0')],_0xeb3c('0xc1'),'files','attachments');var _0x5f17b2=path[_0xeb3c('0xbf')](_0x4ec316,_0x2898fd);var _0x503387=util[_0xeb3c('0xc3')](_0xeb3c('0xc4'),_0x2ed763['params']['id'],_0x2898fd);var _0x344d0c=path[_0xeb3c('0xbf')](_0x4ec316,_0x503387);var _0x4a8da3=[];_0x4a8da3[_0xeb3c('0x2e')]({'model':db[_0xeb3c('0xc5')],'as':_0xeb3c('0xc5'),'attributes':['id',_0xeb3c('0x2b')],'raw':!![]});_0x4a8da3[_0xeb3c('0x2e')]({'model':db[_0xeb3c('0xc6')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x2ed763['query'][_0xeb3c('0xc7')]){_0x4a8da3[_0xeb3c('0x2e')]({'model':db[_0xeb3c('0xc8')],'as':'Attachment','raw':!![]});}var _0x3f7920=[{'model':db[_0xeb3c('0xb7')],'as':_0xeb3c('0xc9'),'attributes':['id',_0xeb3c('0xaf'),'createdAt',_0xeb3c('0xca'),_0xeb3c('0xcb'),_0xeb3c('0x75')],'include':_0x4a8da3}];_0x3f7920['push']({'model':db[_0xeb3c('0xcc')],'as':_0xeb3c('0xcd'),'attributes':['id',_0xeb3c('0x29')]});_0x3f7920[_0xeb3c('0x2e')]({'model':db[_0xeb3c('0xc5')],'as':_0xeb3c('0xce'),'attributes':['id',_0xeb3c('0x2b')]});return db[_0xeb3c('0x32')][_0xeb3c('0x56')]({'where':{'id':_0x2ed763[_0xeb3c('0xa9')]['id']},'include':_0x3f7920})['then'](handleEntityNotFound(_0xe72074,null))[_0xeb3c('0x26')](function(_0x56de84){if(_0x56de84){var _0x405356=_0x56de84['get']({'plain':!![]});fs['mkdirSync'](_0x5f17b2);var _0x132a72={'format':'A4','border':_0xeb3c('0xcf'),'header':{'height':_0xeb3c('0xd0'),'contents':{'first':_0xeb3c('0xd1')}},'footer':{'height':_0xeb3c('0xd2'),'contents':{'default':util[_0xeb3c('0xc3')](_0xeb3c('0xd3'),util[_0xeb3c('0xc3')](_0xeb3c('0xd4'),_0xeb3c('0xd5'),_0x405356['id']),moment()[_0xeb3c('0xc3')](_0xeb3c('0xd6'))[_0xeb3c('0xa3')]())}}};var _0x526b39={'channel':_0xeb3c('0xd5'),'account':_0x405356['Account'][_0xeb3c('0x29')],'agent':_0x405356['Owner']?_0x405356['Owner'][_0xeb3c('0x2b')]:_0xeb3c('0xd7'),'createdAt':moment(_0x405356[_0xeb3c('0x6d')])['format'](_0xeb3c('0xb5'))[_0xeb3c('0xa3')](),'closedAt':_0x405356['closed']?moment(_0x405356[_0xeb3c('0xd8')])[_0xeb3c('0xc3')]('YYYY-MM-DD\x20HH:mm:ss')[_0xeb3c('0xa3')]():'','disposition':_0x405356['disposition'],'visibility':_0x405356['threadId']?_0xeb3c('0xd9'):_0xeb3c('0xda'),'messages':_(_0x405356['Messages'])['filter']({'secret':![]})[_0xeb3c('0x31')](function(_0x2ebf13){if(_0x2ebf13[_0xeb3c('0xc8')]){var _0x5e98fd=path[_0xeb3c('0xbf')](_0x1b460a,_0x2ebf13[_0xeb3c('0xc8')]['basename']);if(fs[_0xeb3c('0xdb')](_0x5e98fd)){fs[_0xeb3c('0xdc')](_0x5e98fd)[_0xeb3c('0xdd')](fs[_0xeb3c('0xde')](path[_0xeb3c('0xbf')](_0x5f17b2,_0x2ebf13[_0xeb3c('0xc8')]['basename'])));}}return{'date':moment(_0x2ebf13['createdAt'])[_0xeb3c('0xc3')](_0xeb3c('0xb5'))[_0xeb3c('0xa3')](),'sender':_0x2ebf13[_0xeb3c('0xca')]===_0xeb3c('0xdf')?_0x2ebf13[_0xeb3c('0xc5')]?_0x2ebf13[_0xeb3c('0xc5')][_0xeb3c('0x2b')]:_0xeb3c('0xe0'):_0x2ebf13[_0xeb3c('0xe1')]['firstName']+(_0x2ebf13['Contact'][_0xeb3c('0xe2')]?'\x20'+_0x2ebf13['Contact']['lastName']:''),'body':_0x2ebf13[_0xeb3c('0xc8')]?_0x2ebf13['Attachment'][_0xeb3c('0xe3')]:_0x2ebf13[_0xeb3c('0xaf')],'direction':_0x2ebf13[_0xeb3c('0xca')]===_0xeb3c('0xdf')?'A':'C','secret':_0x2ebf13[_0xeb3c('0xcb')],'read':_0x2ebf13['read'],'attachment':_0x2ebf13[_0xeb3c('0xc8')]};})[_0xeb3c('0x58')]()};return ejs[_0xeb3c('0xe4')](path['join'](config[_0xeb3c('0xc0')],_0xeb3c('0xc1'),_0xeb3c('0xe5'),_0xeb3c('0xe6')),{'interaction':_0x526b39})[_0xeb3c('0x26')](function(_0x2eef98){return new BPromise(function(_0x2f8c6e,_0x30076b){pdf[_0xeb3c('0xae')](_0x2eef98,_0x132a72)[_0xeb3c('0xe7')](path[_0xeb3c('0xbf')](_0x5f17b2,_0xeb3c('0xe8')+_0x405356['id']+'-'+_0x2898fd+_0xeb3c('0xe9')),function(_0x2c606b,_0x4abf9a){if(_0x2c606b)return _0x30076b(_0x2c606b);_0x2f8c6e(_0x4abf9a);});});})['then'](function(){return new BPromise(function(_0x31f0d0,_0x176f90){zipdir(_0x5f17b2,{'saveTo':_0x344d0c},function(_0x392d79,_0x564aaf){if(_0x392d79)return _0x176f90(_0x392d79);return _0x31f0d0(_0x564aaf);});})[_0xeb3c('0x26')](function(){return new BPromise(function(_0x4cc8e4,_0x5988f4){rimraf(_0x5f17b2,function(_0x501e99){if(_0x501e99)_0x5988f4(_0x501e99);return _0x4cc8e4();});});})[_0xeb3c('0x26')](function(){return _0xe72074[_0xeb3c('0xbd')](_0x344d0c,_0x503387,function(_0xb22e4b){if(_0xb22e4b){console[_0xeb3c('0xea')]('err',_0xb22e4b);}else{fs[_0xeb3c('0xeb')](_0x344d0c);}});});});}else{return _0xe72074[_0xeb3c('0x27')](0xc8);}})[_0xeb3c('0x2f')](handleError(_0xe72074,null));}; \ No newline at end of file +var _0xf367=['$substring','value','split','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','start','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','text','body','some','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','where','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','push','all','catch','show','params','filtears','include','options','create','destroy','describe','addMessage','OpenchannelMessage','omit','getMessages','findOne','rawAttributes','pick','OpenchannelInteractionId','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','setTags','ids','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','User','fullname','CmContact','firstName','Attachment','Messages','direction','secret','Account','Owner','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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','disposition','threadId','Public','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','lastName','renderFile','views','toFile','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset','Content-Range','apply','save','update','then','stack','name','Users','TagIds','Tags','forEach','index','OpenchannelInteraction','fieldName','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','select','field','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','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','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','unreadMessages','having','`\x20>\x200','Contact','operator'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xf367,0x9d));var _0x7f36=function(_0x5a0ff3,_0x23364e){_0x5a0ff3=_0x5a0ff3-0x0;var _0xa852f=_0xf367[_0x5a0ff3];return _0xa852f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7f36('0x0'));var rimraf=require(_0x7f36('0x1'));var zipdir=require(_0x7f36('0x2'));var jsonpatch=require(_0x7f36('0x3'));var rp=require(_0x7f36('0x4'));var moment=require(_0x7f36('0x5'));var BPromise=require(_0x7f36('0x6'));var Mustache=require(_0x7f36('0x7'));var util=require('util');var path=require(_0x7f36('0x8'));var sox=require(_0x7f36('0x9'));var csv=require(_0x7f36('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7f36('0xb'));var squel=require(_0x7f36('0xc'));var crypto=require(_0x7f36('0xd'));var jsforce=require(_0x7f36('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7f36('0xa'));var querystring=require(_0x7f36('0xf'));var Papa=require('papaparse');var Redis=require(_0x7f36('0x10'));var authService=require(_0x7f36('0x11'));var qs=require(_0x7f36('0x12'));var as=require(_0x7f36('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7f36('0x14'));var utils=require(_0x7f36('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7f36('0x16'));var db=require(_0x7f36('0x17'))['db'];config[_0x7f36('0x18')]=_[_0x7f36('0x19')](config[_0x7f36('0x18')],{'host':_0x7f36('0x1a'),'port':0x18eb});var socket=require(_0x7f36('0x1b'))(new Redis(config[_0x7f36('0x18')]));require('./openchannelInteraction.socket')[_0x7f36('0x1c')](socket);function respondWithStatusCode(_0x27f6ce,_0x204ad7){_0x204ad7=_0x204ad7||0xcc;return function(_0x1dfc20){if(_0x1dfc20){return _0x27f6ce[_0x7f36('0x1d')](_0x204ad7);}return _0x27f6ce['status'](_0x204ad7)[_0x7f36('0x1e')]();};}function respondWithResult(_0x3dc625,_0x571f02){_0x571f02=_0x571f02||0xc8;return function(_0x27267b){if(_0x27267b){return _0x3dc625[_0x7f36('0x1f')](_0x571f02)[_0x7f36('0x20')](_0x27267b);}};}function respondWithFilteredResult(_0x9e5e47,_0x33408e){return function(_0x1099e6){if(_0x1099e6){var _0x5a2d7a=_0x1099e6[_0x7f36('0x21')],_0x184a80=_0x33408e[_0x7f36('0x22')],_0x34a1de=_0x33408e[_0x7f36('0x22')]+_0x33408e['limit'],_0x1b86c3;if(_0x34a1de>=_0x5a2d7a){_0x34a1de=_0x5a2d7a;_0x1b86c3=0xc8;}else{_0x1b86c3=0xce;}_0x9e5e47[_0x7f36('0x1f')](_0x1b86c3);return _0x9e5e47['set'](_0x7f36('0x23'),_0x184a80+'-'+_0x34a1de+'/'+_0x5a2d7a)[_0x7f36('0x20')](_0x1099e6);}return null;};}function patchUpdates(_0x1ca5a3){return function(_0x278692){try{jsonpatch[_0x7f36('0x24')](_0x278692,_0x1ca5a3,!![]);}catch(_0x947e60){return BPromise['reject'](_0x947e60);}return _0x278692[_0x7f36('0x25')]();};}function saveUpdates(_0xd11ff7,_0x7fe5a0){return function(_0x224892){if(_0x224892){return _0x224892[_0x7f36('0x26')](_0xd11ff7)[_0x7f36('0x27')](function(_0x59bc85){return _0x59bc85;});}return null;};}function removeEntity(_0x4b020f,_0x486b7b){return function(_0x4d1e29){if(_0x4d1e29){return _0x4d1e29['destroy']()[_0x7f36('0x27')](function(){_0x4b020f['status'](0xcc)[_0x7f36('0x1e')]();});}};}function handleEntityNotFound(_0x51e92c,_0x19d096){return function(_0x4f5b57){if(!_0x4f5b57){_0x51e92c[_0x7f36('0x1d')](0x194);}return _0x4f5b57;};}function handleError(_0x10d1c7,_0x207239){_0x207239=_0x207239||0x1f4;return function(_0x523593){logger['error'](_0x523593[_0x7f36('0x28')]);if(_0x523593[_0x7f36('0x29')]){delete _0x523593['name'];}_0x10d1c7[_0x7f36('0x1f')](_0x207239)['send'](_0x523593);};}function getInteractionUsers(_0x43894a,_0x513580){return new BPromise(function(_0x3d2245,_0x4b4a60){try{if(_0x513580[_0x43894a['id']]){_0x43894a[_0x7f36('0x2a')]=_['map'](_0x513580[_0x43894a['id']],function(_0x1d901c){return{'id':_0x1d901c['id'],'fullname':_0x1d901c['fullname']};});}}catch(_0x50979f){_0x4b4a60(_0x50979f);}_0x3d2245(_0x43894a);});}function getInteractionTags(_0x1a7ae4,_0x491aa8){return new BPromise(function(_0x2bb16d,_0x32bb84){try{if(_0x1a7ae4[_0x7f36('0x2b')]){_0x1a7ae4[_0x7f36('0x2c')]=[];_0x1a7ae4[_0x7f36('0x2b')]['split'](',')[_0x7f36('0x2d')](function(_0x4350d6){_0x1a7ae4['Tags']['push'](_0x491aa8[_0x4350d6]);});}delete _0x1a7ae4[_0x7f36('0x2b')];}catch(_0x1d476d){_0x32bb84(_0x1d476d);}_0x2bb16d(_0x1a7ae4);});}function updateOpenchannelInteraction(_0x45c42a,_0x465fdd,_0x350f12){return new BPromise(function(_0x429f10,_0x5115a9){return getInteractionUsers(_0x45c42a,_0x350f12)[_0x7f36('0x27')](function(_0x2cb8b9){return getInteractionTags(_0x2cb8b9,_0x465fdd);})[_0x7f36('0x27')](function(_0x5f4458){_0x429f10(_0x5f4458);})['catch'](function(_0x47f046){_0x5115a9(_0x47f046);});});}exports[_0x7f36('0x2e')]=function(_0x5cee4e,_0x297778){var _0x23a19c={},_0x170115={},_0x5eb406={'count':0x0,'rows':[]};var _0x1dad82=_['map'](db[_0x7f36('0x2f')]['rawAttributes'],function(_0x4f3c3f){return{'name':_0x4f3c3f[_0x7f36('0x30')],'type':_0x4f3c3f['type'][_0x7f36('0x31')]};});_0x170115['model']=_[_0x7f36('0x32')](_0x1dad82,_0x7f36('0x29'));_0x170115[_0x7f36('0x33')]=_[_0x7f36('0x34')](_0x5cee4e[_0x7f36('0x33')]);_0x170115[_0x7f36('0x35')]=_[_0x7f36('0x36')](_0x170115['model'],_0x170115[_0x7f36('0x33')]);_0x23a19c['attributes']=_[_0x7f36('0x36')](_0x170115[_0x7f36('0x37')],qs[_0x7f36('0x38')](_0x5cee4e['query'][_0x7f36('0x38')]));_0x23a19c['attributes']=_0x23a19c[_0x7f36('0x39')][_0x7f36('0x3a')]?_0x23a19c[_0x7f36('0x39')]:_0x170115[_0x7f36('0x37')];if(!_0x5cee4e[_0x7f36('0x33')][_0x7f36('0x3b')](_0x7f36('0x3c'))){_0x23a19c[_0x7f36('0x3d')]=qs[_0x7f36('0x3d')](_0x5cee4e['query'][_0x7f36('0x3d')]);_0x23a19c[_0x7f36('0x22')]=qs[_0x7f36('0x22')](_0x5cee4e[_0x7f36('0x33')][_0x7f36('0x22')]);}_0x23a19c[_0x7f36('0x3e')]=qs[_0x7f36('0x3f')](_0x5cee4e[_0x7f36('0x33')][_0x7f36('0x3f')]);_0x23a19c['where']=qs[_0x7f36('0x35')](_['pick'](_0x5cee4e['query'],_0x170115['filters']),_0x1dad82);var _0x49c41b=[];var _0x49aed3=squel[_0x7f36('0x40')]()[_0x7f36('0x41')]('id')['field']('name')['field']('color')[_0x7f36('0x42')](_0x7f36('0x43'));var _0x340fd6=squel[_0x7f36('0x40')]()[_0x7f36('0x41')](_0x7f36('0x44'))[_0x7f36('0x41')](_0x7f36('0x45'))['field'](_0x7f36('0x46'))[_0x7f36('0x42')](_0x7f36('0x47'),'ui')[_0x7f36('0x48')](_0x7f36('0x49'),'u',_0x7f36('0x4a'));var _0x18bc77=squel[_0x7f36('0x40')]()['from'](_0x7f36('0x4b'),'i')[_0x7f36('0x48')](_0x7f36('0x4c'),'c',_0x7f36('0x4d'))['left_join']('users','o',_0x7f36('0x4e'))[_0x7f36('0x48')](_0x7f36('0x4f'),'a',_0x7f36('0x50'))['left_join'](_0x7f36('0x51'),'me',_0x7f36('0x52'))[_0x7f36('0x48')](_0x7f36('0x53'),'it',_0x7f36('0x54'))[_0x7f36('0x48')](_0x7f36('0x43'),'t','t.id\x20=\x20it.TagId');var _0x1abd6d=squel[_0x7f36('0x55')]();var _0x2fa78d=[];var _0x547722=squel[_0x7f36('0x55')]();var _0x4d7f10;if(_0x5cee4e[_0x7f36('0x33')][_0x7f36('0x56')]){_0x4d7f10=as['parseSearch'](_0x5cee4e[_0x7f36('0x33')][_0x7f36('0x56')]);var _0x444fd3=_0x4d7f10[_0x7f36('0x57')];for(var _0x2350db=0x0;_0x2350db<_0x4d7f10[_0x7f36('0x58')][_0x7f36('0x3a')];_0x2350db++){var _0x14cea3=_0x4d7f10[_0x7f36('0x58')][_0x2350db];var _0x861425='i';var _0x35acc8=_['find'](_0x1dad82,[_0x7f36('0x29'),_0x14cea3['field']]);if(!_0x35acc8){switch(_0x14cea3[_0x7f36('0x41')]){case _0x7f36('0x59'):if(_0x14cea3['value']==0x1){_0x18bc77['having']('`'+_0x14cea3[_0x7f36('0x41')]+'`\x20=\x200');}else{_0x18bc77[_0x7f36('0x5a')]('`'+_0x14cea3[_0x7f36('0x41')]+_0x7f36('0x5b'));}break;case _0x7f36('0x5c'):if(_0x14cea3[_0x7f36('0x5d')]===_0x7f36('0x5e')){if(_0x14cea3[_0x7f36('0x5f')][_0x7f36('0x60')]('\x20')[_0x7f36('0x3a')]>0x1){_0x1abd6d[_0x444fd3]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x14cea3[_0x7f36('0x5f')]),null);}else{var _0x200704='%'+_0x14cea3[_0x7f36('0x5f')]+'%';_0x1abd6d[_0x444fd3](_0x7f36('0x61'),_0x200704,_0x200704,_0x200704);}}else{_0x35acc8=_[_0x7f36('0x62')](_0x1dad82,[_0x7f36('0x29'),_0x7f36('0x63')]);_0x14cea3[_0x7f36('0x41')]='ContactId';_0x7daa8c=as[_0x7f36('0x64')](_0x861425,_0x35acc8['type'],_0x14cea3);_0x1abd6d[_0x444fd3](_0x7daa8c['text'],_0x7daa8c[_0x7f36('0x5f')][_0x7f36('0x65')],_0x7daa8c[_0x7f36('0x5f')][_0x7f36('0x1e')]);}break;case'Tag':var _0x5298f3=_0x14cea3[_0x7f36('0x5f')]['split'](',')[_0x7f36('0x32')](function(_0x4c1106){return Number(_0x4c1106);});_0x5298f3[_0x7f36('0x2d')](function(_0x3491bf){_0x547722['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3491bf+',%');});_0x2fa78d=_['union'](_0x2fa78d,_0x5298f3);break;case'User':if(_0x14cea3[_0x7f36('0x5d')]==='$substring'){_0x1abd6d[_0x444fd3](_0x7f36('0x66'),'%'+_0x14cea3[_0x7f36('0x5f')]+'%',null);}else{_0x35acc8=_[_0x7f36('0x62')](_0x1dad82,[_0x7f36('0x29'),_0x7f36('0x67')]);_0x14cea3[_0x7f36('0x41')]=_0x7f36('0x67');_0x7daa8c=as[_0x7f36('0x64')](_0x861425,_0x35acc8[_0x7f36('0x68')],_0x14cea3);_0x1abd6d[_0x444fd3](_0x7daa8c[_0x7f36('0x69')],_0x7daa8c[_0x7f36('0x5f')][_0x7f36('0x65')],_0x7daa8c[_0x7f36('0x5f')]['end']);}break;case _0x7f36('0x6a'):_0x7daa8c=as[_0x7f36('0x64')]('me',null,_0x14cea3);_0x1abd6d[_0x444fd3](_0x7daa8c['text'],_0x7daa8c[_0x7f36('0x5f')]['start'],_0x7daa8c[_0x7f36('0x5f')]['end']);break;}}else{var _0x7daa8c=as[_0x7f36('0x64')](_0x861425,_0x35acc8[_0x7f36('0x68')],_0x14cea3);_0x1abd6d[_0x444fd3](_0x7daa8c[_0x7f36('0x69')],_0x7daa8c[_0x7f36('0x5f')][_0x7f36('0x65')],_0x7daa8c['value']['end']);}}}else{var _0x5e9662=_(_0x5cee4e[_0x7f36('0x33')])[_0x7f36('0x34')]()[_0x7f36('0x32')](function(_0x36308b){return _[_0x7f36('0x6b')](_0x1dad82,[_0x7f36('0x29'),_0x36308b])?_0x36308b:undefined;})['compact']()['value']();if(!_[_0x7f36('0x6c')](_0x5e9662)){_0x5e9662[_0x7f36('0x2d')](function(_0x29d7a0){if(_0x29d7a0==='OpenchannelAccountId'){_0x18bc77['where'](_0x7f36('0x6d'),[][_0x7f36('0x6e')](_0x5cee4e[_0x7f36('0x33')][_0x29d7a0]));}else if(_0x29d7a0===_0x7f36('0x6f')){var _0x5d59e5=JSON[_0x7f36('0x70')](_0x5cee4e[_0x7f36('0x33')][_0x29d7a0])[_0x7f36('0x71')];var _0x55b45a=JSON['parse'](_0x5cee4e[_0x7f36('0x33')][_0x29d7a0])[_0x7f36('0x72')];_0x18bc77[_0x7f36('0x73')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5d59e5,_0x55b45a);}else{if(_0x5cee4e[_0x7f36('0x33')][_0x29d7a0]===_0x7f36('0x74')){_0x18bc77[_0x7f36('0x73')]('i.'+_0x29d7a0+_0x7f36('0x75'));}else{_0x18bc77['where']('i.'+_0x29d7a0+_0x7f36('0x76'),_0x5cee4e[_0x7f36('0x33')][_0x29d7a0]);}}});}if(_0x5cee4e['query'][_0x7f36('0x77')]){if(_0x5cee4e[_0x7f36('0x33')][_0x7f36('0x77')]==0x1){_0x18bc77[_0x7f36('0x5a')](_0x7f36('0x78'));}else{_0x18bc77[_0x7f36('0x5a')](_0x7f36('0x79'));}}if(_0x5cee4e[_0x7f36('0x33')][_0x7f36('0x7a')]){_0x2fa78d=_[_0x7f36('0x7b')](_0x5cee4e[_0x7f36('0x33')][_0x7f36('0x7a')])?_0x5cee4e[_0x7f36('0x33')]['tag']:new Array(_0x5cee4e[_0x7f36('0x33')][_0x7f36('0x7a')]);_0x2fa78d[_0x7f36('0x2d')](function(_0x3d4b49){_0x547722['or'](_0x7f36('0x7c'),'%,'+_0x3d4b49+',%');});}if(_0x5cee4e['query'][_0x7f36('0x7d')]){var _0x3284f9=_0x5cee4e['query'][_0x7f36('0x7d')][_0x7f36('0x7e')]('\x5c','\x5c\x5c')[_0x7f36('0x7e')]('\x27\x27',_0x7f36('0x7f'));if(qs[_0x7f36('0x80')](_0x3284f9)){_0x1abd6d['or']('i.id\x20LIKE\x20?',_0x3284f9+'%');}else{_0x1abd6d['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7f36('0x81')](_0x3284f9))['or'](_0x7f36('0x82'),_0x3284f9+'%')['or'](_0x7f36('0x83'),_0x3284f9+'%');}}}_0x18bc77[_0x7f36('0x73')](_0x1abd6d);_0x18bc77[_0x7f36('0x84')](_0x7f36('0x85'));var _0x4196ff={'type':db['Sequelize'][_0x7f36('0x86')][_0x7f36('0x87')],'raw':!![]};var _0x3a69a8=_0x18bc77[_0x7f36('0x88')]();_0x3a69a8[_0x7f36('0x41')](_0x7f36('0x85'));_0x3a69a8[_0x7f36('0x41')](_0x7f36('0x89'),'unreadMessages');if(_0x23a19c[_0x7f36('0x3e')]){_0x23a19c[_0x7f36('0x3e')][_0x7f36('0x2d')](function(_0x18c122){_0x18bc77[_0x7f36('0x3e')]('i.'+_0x18c122[0x0],_0x18c122[0x1]===_0x7f36('0x8a')?![]:!![]);});}if(!_[_0x7f36('0x6c')](_0x2fa78d)){_0x18bc77['having'](_0x547722);_0x3a69a8[_0x7f36('0x73')](_0x7f36('0x8b'),_0x2fa78d);}BPromise[_0x7f36('0x8c')]()[_0x7f36('0x27')](function(){if(!_0x4d7f10){if(_0x5cee4e[_0x7f36('0x33')][_0x7f36('0x8d')]||_0x5cee4e[_0x7f36('0x33')][_0x7f36('0x8e')])return;_0x3a69a8[_0x7f36('0x73')](_0x7f36('0x8f'));_0x18bc77[_0x7f36('0x73')](_0x7f36('0x8f'));return;}return _0x5cee4e[_0x7f36('0x90')][_0x7f36('0x91')]({'attributes':['id'],'raw':!![]})[_0x7f36('0x27')](function(_0x18d58e){if(_[_0x7f36('0x6c')](_0x18d58e)){_0x3a69a8[_0x7f36('0x73')](_0x7f36('0x92'));_0x18bc77['where'](_0x7f36('0x92'));}else{_0x3a69a8[_0x7f36('0x73')](_0x7f36('0x6d'),_[_0x7f36('0x32')](_0x18d58e,'id'));_0x18bc77[_0x7f36('0x73')](_0x7f36('0x6d'),_[_0x7f36('0x32')](_0x18d58e,'id'));}});})[_0x7f36('0x27')](function(){db['sequelize'][_0x7f36('0x33')](_0x3a69a8[_0x7f36('0x93')](),_0x4196ff)[_0x7f36('0x27')](function(_0xa415f1){_0x5eb406[_0x7f36('0x21')]=_0xa415f1[_0x7f36('0x3a')];if(_0x5eb406[_0x7f36('0x21')]===0x0)return[];return db[_0x7f36('0x94')][_0x7f36('0x33')](_0x49aed3['toString'](),_0x4196ff)[_0x7f36('0x27')](function(_0x2fcd43){_0x49c41b=_[_0x7f36('0x95')](_0x2fcd43,'id');_0x4196ff=_[_0x7f36('0x96')](_0x4196ff,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5cee4e[_0x7f36('0x33')][_0x7f36('0x38')]){_0x23a19c[_0x7f36('0x39')][_0x7f36('0x2d')](function(_0x2e702c){_0x18bc77['field']('i.'+_0x2e702c);});}else{_0x18bc77[_0x7f36('0x41')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x7f36('0x59'));_0x18bc77[_0x7f36('0x41')]('a.key',_0x7f36('0x97'));_0x18bc77['field'](_0x7f36('0x98'),_0x7f36('0x99'));_0x18bc77['field'](_0x7f36('0x9a'));_0x18bc77[_0x7f36('0x41')](_0x7f36('0x9b'),'Contact.firstName');_0x18bc77[_0x7f36('0x41')](_0x7f36('0x9c'),'Contact.lastName');_0x18bc77[_0x7f36('0x41')](_0x7f36('0x9d'),_0x7f36('0x9e'));_0x18bc77[_0x7f36('0x41')](_0x7f36('0x9f'),'Contact.phone');_0x18bc77['field'](_0x7f36('0xa0'),'Contact.mobile');_0x18bc77[_0x7f36('0x41')]('c.fax',_0x7f36('0xa1'));_0x18bc77[_0x7f36('0x41')](_0x7f36('0xa2'),_0x7f36('0xa3'));_0x18bc77[_0x7f36('0x41')](_0x7f36('0xa4'),_0x7f36('0xa5'));_0x18bc77['field'](_0x7f36('0xa6'),_0x7f36('0x2b'));}if(_0x23a19c[_0x7f36('0x3d')])_0x18bc77[_0x7f36('0x3d')](_0x23a19c['limit']);if(_0x23a19c[_0x7f36('0x22')])_0x18bc77[_0x7f36('0x22')](_0x23a19c[_0x7f36('0x22')]);return db[_0x7f36('0x94')][_0x7f36('0x33')](_0x18bc77[_0x7f36('0x93')](),_0x4196ff);})[_0x7f36('0x27')](function(_0xfaa76b){_0x340fd6['where'](_0x7f36('0xa7'),_['map'](_0xfaa76b,'id'));return db[_0x7f36('0x94')]['query'](_0x340fd6[_0x7f36('0x93')](),_0x4196ff)['then'](function(_0x3b8945){var _0x368df1=_[_0x7f36('0xa8')](_0x3b8945,'OpenchannelInteractionId');var _0x538652=[];_0xfaa76b[_0x7f36('0x2d')](function(_0x135543){_0x538652[_0x7f36('0xa9')](updateOpenchannelInteraction(_0x135543,_0x49c41b,_0x368df1));});return BPromise[_0x7f36('0xaa')](_0x538652);});});})[_0x7f36('0x27')](function(_0x48db0c){_0x5eb406['rows']=_0x48db0c;return _0x5eb406;})[_0x7f36('0x27')](respondWithFilteredResult(_0x297778,_0x23a19c));})[_0x7f36('0xab')](handleError(_0x297778,null));};exports[_0x7f36('0xac')]=function(_0x3d15dd,_0xbfe54){var _0x4e18aa={};if(_0x3d15dd[_0x7f36('0x33')][_0x7f36('0x68')]&&_0x3d15dd[_0x7f36('0x33')][_0x7f36('0x68')]==='from'){_0x4e18aa[_0x7f36('0x42')]=_0x3d15dd[_0x7f36('0xad')]['id'];}else{_0x4e18aa['id']=_0x3d15dd[_0x7f36('0xad')]['id'];}var _0xe590b8={'raw':![],'where':_0x4e18aa},_0x57fa2a={};_0x57fa2a[_0x7f36('0x37')]=_[_0x7f36('0x34')](db[_0x7f36('0x2f')]['rawAttributes']);_0x57fa2a[_0x7f36('0x33')]=_[_0x7f36('0x34')](_0x3d15dd['query']);_0x57fa2a[_0x7f36('0xae')]=_[_0x7f36('0x36')](_0x57fa2a[_0x7f36('0x37')],_0x57fa2a[_0x7f36('0x33')]);_0xe590b8[_0x7f36('0x39')]=_[_0x7f36('0x36')](_0x57fa2a[_0x7f36('0x37')],qs[_0x7f36('0x38')](_0x3d15dd[_0x7f36('0x33')][_0x7f36('0x38')]));_0xe590b8[_0x7f36('0x39')]=_0xe590b8[_0x7f36('0x39')][_0x7f36('0x3a')]?_0xe590b8[_0x7f36('0x39')]:_0x57fa2a[_0x7f36('0x37')];if(_0x3d15dd[_0x7f36('0x33')]['includeAll']){_0xe590b8[_0x7f36('0xaf')]=[{'all':!![]}];}_0xe590b8=_[_0x7f36('0x96')]({},_0xe590b8,_0x3d15dd[_0x7f36('0xb0')]);return db[_0x7f36('0x2f')][_0x7f36('0x62')](_0xe590b8)[_0x7f36('0x27')](handleEntityNotFound(_0xbfe54,null))[_0x7f36('0x27')](respondWithResult(_0xbfe54,null))[_0x7f36('0xab')](handleError(_0xbfe54,null));};exports[_0x7f36('0xb1')]=function(_0x325f6f,_0x4ccd07){return db[_0x7f36('0x2f')][_0x7f36('0xb1')](_0x325f6f[_0x7f36('0x6a')],{})[_0x7f36('0x27')](respondWithResult(_0x4ccd07,0xc9))['catch'](handleError(_0x4ccd07,null));};exports[_0x7f36('0x26')]=function(_0x5b9cbe,_0x584ac6){if(_0x5b9cbe[_0x7f36('0x6a')]['id']){delete _0x5b9cbe[_0x7f36('0x6a')]['id'];}return db['OpenchannelInteraction'][_0x7f36('0x62')]({'where':{'id':_0x5b9cbe[_0x7f36('0xad')]['id']}})[_0x7f36('0x27')](handleEntityNotFound(_0x584ac6,null))[_0x7f36('0x27')](saveUpdates(_0x5b9cbe[_0x7f36('0x6a')],null))[_0x7f36('0x27')](respondWithResult(_0x584ac6,null))[_0x7f36('0xab')](handleError(_0x584ac6,null));};exports[_0x7f36('0xb2')]=function(_0x3427d2,_0x226876){return db[_0x7f36('0x2f')][_0x7f36('0x62')]({'where':{'id':_0x3427d2['params']['id']}})[_0x7f36('0x27')](handleEntityNotFound(_0x226876,null))[_0x7f36('0x27')](removeEntity(_0x226876,null))[_0x7f36('0xab')](handleError(_0x226876,null));};exports[_0x7f36('0xb3')]=function(_0x8e218f,_0x421e02){return db[_0x7f36('0x2f')][_0x7f36('0xb3')]()[_0x7f36('0x27')](respondWithResult(_0x421e02,null))[_0x7f36('0xab')](handleError(_0x421e02,null));};exports[_0x7f36('0xb4')]=function(_0x49af81,_0x44f782,_0x41eebc){return db[_0x7f36('0xb5')][_0x7f36('0x62')]({'where':{'id':_0x49af81[_0x7f36('0xad')]['id']}})['then'](handleEntityNotFound(_0x44f782,null))[_0x7f36('0x27')](function(_0x3ea9ea){if(_0x3ea9ea){return _0x3ea9ea[_0x7f36('0xb4')](_0x49af81[_0x7f36('0x6a')]['ids'],_[_0x7f36('0xb6')](_0x49af81['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x44f782,null))[_0x7f36('0xab')](handleError(_0x44f782,null));};exports[_0x7f36('0xb7')]=function(_0x30d0ef,_0x5a8c79,_0x4d5a56){var _0x4459a7={'raw':![],'where':{}};var _0x178719={};var _0x5460ea={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x7f36('0xb8')]({'where':{'id':_0x30d0ef[_0x7f36('0xad')]['id']}})[_0x7f36('0x27')](handleEntityNotFound(_0x5a8c79,null))[_0x7f36('0x27')](function(_0x11faef){if(_0x11faef){_0x178719['model']=_[_0x7f36('0x34')](db[_0x7f36('0xb5')][_0x7f36('0xb9')]);_0x178719[_0x7f36('0x33')]=_[_0x7f36('0x34')](_0x30d0ef[_0x7f36('0x33')]);_0x178719[_0x7f36('0x35')]=_[_0x7f36('0x36')](_0x178719[_0x7f36('0x37')],_0x178719['query']);_0x4459a7['attributes']=_[_0x7f36('0x36')](_0x178719[_0x7f36('0x37')],qs[_0x7f36('0x38')](_0x30d0ef['query']['fields']));_0x4459a7['attributes']=_0x4459a7[_0x7f36('0x39')][_0x7f36('0x3a')]?_0x4459a7[_0x7f36('0x39')]:_0x178719['model'];if(!_0x30d0ef[_0x7f36('0x33')]['hasOwnProperty'](_0x7f36('0x3c'))){_0x4459a7[_0x7f36('0x3d')]=qs[_0x7f36('0x3d')](_0x30d0ef['query'][_0x7f36('0x3d')]);_0x4459a7[_0x7f36('0x22')]=qs[_0x7f36('0x22')](_0x30d0ef[_0x7f36('0x33')][_0x7f36('0x22')]);}_0x4459a7['order']=qs[_0x7f36('0x3f')](_0x30d0ef[_0x7f36('0x33')][_0x7f36('0x3f')]);_0x4459a7[_0x7f36('0x73')]=qs['filters'](_[_0x7f36('0xba')](_0x30d0ef['query'],_0x178719[_0x7f36('0x35')]));_0x4459a7[_0x7f36('0x73')][_0x7f36('0xbb')]=_0x11faef['id'];if(_0x30d0ef['query'][_0x7f36('0x7d')]){_0x4459a7[_0x7f36('0x73')]=_['merge'](_0x4459a7[_0x7f36('0x73')],{'$or':_[_0x7f36('0x32')](_0x4459a7[_0x7f36('0x39')],function(_0xcbfcf7){var _0x197c8f={};_0x197c8f[_0xcbfcf7]={'$like':'%'+_0x30d0ef['query'][_0x7f36('0x7d')]+'%'};return _0x197c8f;})});}if(_0x30d0ef[_0x7f36('0x33')][_0x7f36('0x71')]){var _0x409e8f=_0x30d0ef[_0x7f36('0x33')][_0x7f36('0x71')][_0x7f36('0x60')](',');var _0xc808a8={};_0xc808a8[_0x409e8f[0x0]]={'$gte':moment(_0x409e8f[0x1])['format'](_0x7f36('0xbc'))};_0x4459a7[_0x7f36('0x73')]=_[_0x7f36('0x96')](_0x4459a7[_0x7f36('0x73')],_0xc808a8);}_0x4459a7=_[_0x7f36('0x96')]({},_0x4459a7,_0x30d0ef[_0x7f36('0xb0')]);return db[_0x7f36('0xb5')][_0x7f36('0x21')]({'where':_0x4459a7[_0x7f36('0x73')]})[_0x7f36('0x27')](function(_0x2670d1){_0x5460ea[_0x7f36('0x21')]=_0x2670d1;if(_0x30d0ef[_0x7f36('0x33')][_0x7f36('0xbd')]){_0x4459a7[_0x7f36('0xaf')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x7f36('0xbe')](_0x4459a7);})[_0x7f36('0x27')](function(_0x5533f7){_0x5460ea[_0x7f36('0xbf')]=_0x5533f7;return _0x5460ea;});}})[_0x7f36('0x27')](respondWithFilteredResult(_0x5a8c79,_0x4459a7))[_0x7f36('0xab')](handleError(_0x5a8c79,null));};exports['addTags']=function(_0x17464f,_0x22f7f8,_0xa44a2e){return db[_0x7f36('0x2f')][_0x7f36('0x62')]({'where':{'id':_0x17464f[_0x7f36('0xad')]['id']}})[_0x7f36('0x27')](handleEntityNotFound(_0x22f7f8,null))[_0x7f36('0x27')](function(_0x1c0ecc){if(_0x1c0ecc){return _0x1c0ecc[_0x7f36('0xc0')](_0x17464f[_0x7f36('0x6a')][_0x7f36('0xc1')],_[_0x7f36('0xb6')](_0x17464f[_0x7f36('0x6a')],['ids','id'])||{})[_0x7f36('0xc2')](function(){return db[_0x7f36('0xc3')][_0x7f36('0xbe')]({'attributes':['id',_0x7f36('0x29'),_0x7f36('0xc4')],'where':{'id':_0x17464f[_0x7f36('0x6a')][_0x7f36('0xc1')]}});})[_0x7f36('0x27')](function(_0x2cfaad){socket[_0x7f36('0xc5')](_0x7f36('0xc6'),{'id':Number(_0x17464f[_0x7f36('0xad')]['id']),'tags':_0x2cfaad||[]});return{'id':Number(_0x17464f[_0x7f36('0xad')]['id']),'tags':_0x2cfaad||[]};});}})[_0x7f36('0x27')](respondWithResult(_0x22f7f8,null))[_0x7f36('0xab')](handleError(_0x22f7f8,null));};exports['removeTags']=function(_0x5574a0,_0x380aa1,_0x34925b){return db['OpenchannelInteraction'][_0x7f36('0x62')]({'where':{'id':_0x5574a0[_0x7f36('0xad')]['id']}})[_0x7f36('0x27')](handleEntityNotFound(_0x380aa1,null))[_0x7f36('0x27')](function(_0x4b883c){if(_0x4b883c){return _0x4b883c[_0x7f36('0xc7')](_0x5574a0[_0x7f36('0x33')][_0x7f36('0xc1')]);}})['then'](respondWithStatusCode(_0x380aa1,null))[_0x7f36('0xab')](handleError(_0x380aa1,null));};exports[_0x7f36('0xc8')]=function(_0x2ecbad,_0x520fd5){var _0x44e419=moment()[_0x7f36('0xc9')]()[_0x7f36('0x93')]();var _0x4afff3=path[_0x7f36('0xca')](config[_0x7f36('0xcb')],_0x7f36('0xcc'),_0x7f36('0xcd'),_0x7f36('0xce'));var _0x45418a=path[_0x7f36('0xca')](config[_0x7f36('0xcb')],_0x7f36('0xcc'),'files',_0x7f36('0xcf'));var _0x3208c7=path[_0x7f36('0xca')](_0x4afff3,_0x44e419);var _0x3d36ad=util[_0x7f36('0xd0')](_0x7f36('0xd1'),_0x2ecbad['params']['id'],_0x44e419);var _0x653adb=path[_0x7f36('0xca')](_0x4afff3,_0x3d36ad);var _0x13afc4=[];_0x13afc4['push']({'model':db[_0x7f36('0xd2')],'as':_0x7f36('0xd2'),'attributes':['id',_0x7f36('0xd3')],'raw':!![]});_0x13afc4[_0x7f36('0xa9')]({'model':db[_0x7f36('0xd4')],'as':_0x7f36('0x5c'),'attributes':['id',_0x7f36('0xd5'),'lastName'],'raw':!![]});if(_0x2ecbad['query'][_0x7f36('0xcf')]){_0x13afc4[_0x7f36('0xa9')]({'model':db[_0x7f36('0xd6')],'as':'Attachment','raw':!![]});}var _0xc27a=[{'model':db[_0x7f36('0xb5')],'as':_0x7f36('0xd7'),'attributes':['id',_0x7f36('0x6a'),_0x7f36('0x6f'),_0x7f36('0xd8'),_0x7f36('0xd9'),_0x7f36('0x77')],'include':_0x13afc4}];_0xc27a[_0x7f36('0xa9')]({'model':db['OpenchannelAccount'],'as':_0x7f36('0xda'),'attributes':['id','name']});_0xc27a['push']({'model':db[_0x7f36('0xd2')],'as':_0x7f36('0xdb'),'attributes':['id',_0x7f36('0xd3')]});return db[_0x7f36('0x2f')][_0x7f36('0x62')]({'where':{'id':_0x2ecbad[_0x7f36('0xad')]['id']},'include':_0xc27a})[_0x7f36('0x27')](handleEntityNotFound(_0x520fd5,null))[_0x7f36('0x27')](function(_0x65c92e){if(_0x65c92e){var _0x267661=_0x65c92e[_0x7f36('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x3208c7);var _0x5b6042={'format':'A4','border':_0x7f36('0xdd'),'header':{'height':_0x7f36('0xde'),'contents':{'first':_0x7f36('0xdf')}},'footer':{'height':_0x7f36('0xe0'),'contents':{'default':util['format'](_0x7f36('0xe1'),util[_0x7f36('0xd0')](_0x7f36('0xe2'),_0x7f36('0xe3'),_0x267661['id']),moment()[_0x7f36('0xd0')](_0x7f36('0xe4'))[_0x7f36('0x93')]())}}};var _0x178c30={'channel':_0x7f36('0xe3'),'account':_0x267661['Account'][_0x7f36('0x29')],'agent':_0x267661['Owner']?_0x267661[_0x7f36('0xdb')][_0x7f36('0xd3')]:_0x7f36('0xe5'),'createdAt':moment(_0x267661[_0x7f36('0x6f')])[_0x7f36('0xd0')](_0x7f36('0xbc'))[_0x7f36('0x93')](),'closedAt':_0x267661[_0x7f36('0xe6')]?moment(_0x267661[_0x7f36('0xe7')])[_0x7f36('0xd0')](_0x7f36('0xbc'))[_0x7f36('0x93')]():'','disposition':_0x267661[_0x7f36('0xe8')],'visibility':_0x267661[_0x7f36('0xe9')]?_0x7f36('0xea'):'Private','messages':_(_0x267661[_0x7f36('0xd7')])[_0x7f36('0x7d')]({'secret':![]})['map'](function(_0x5c53ae){if(_0x5c53ae[_0x7f36('0xd6')]){var _0x246f1d=path[_0x7f36('0xca')](_0x45418a,_0x5c53ae['Attachment'][_0x7f36('0xeb')]);if(fs[_0x7f36('0xec')](_0x246f1d)){fs[_0x7f36('0xed')](_0x246f1d)[_0x7f36('0xee')](fs[_0x7f36('0xef')](path[_0x7f36('0xca')](_0x3208c7,_0x5c53ae[_0x7f36('0xd6')][_0x7f36('0xeb')])));}}return{'date':moment(_0x5c53ae[_0x7f36('0x6f')])[_0x7f36('0xd0')](_0x7f36('0xbc'))['toString'](),'sender':_0x5c53ae[_0x7f36('0xd8')]===_0x7f36('0xf0')?_0x5c53ae[_0x7f36('0xd2')]?_0x5c53ae['User'][_0x7f36('0xd3')]:_0x7f36('0xf1'):_0x5c53ae['Contact']['firstName']+(_0x5c53ae[_0x7f36('0x5c')][_0x7f36('0xf2')]?'\x20'+_0x5c53ae[_0x7f36('0x5c')]['lastName']:''),'body':_0x5c53ae[_0x7f36('0xd6')]?_0x5c53ae[_0x7f36('0xd6')]['basename']:_0x5c53ae['body'],'direction':_0x5c53ae[_0x7f36('0xd8')]===_0x7f36('0xf0')?'A':'C','secret':_0x5c53ae['secret'],'read':_0x5c53ae['read'],'attachment':_0x5c53ae[_0x7f36('0xd6')]};})[_0x7f36('0x5f')]()};return ejs[_0x7f36('0xf3')](path[_0x7f36('0xca')](config[_0x7f36('0xcb')],_0x7f36('0xcc'),_0x7f36('0xf4'),'downloadInteraction.html'),{'interaction':_0x178c30})[_0x7f36('0x27')](function(_0x152f13){return new BPromise(function(_0x5158bc,_0x514afe){pdf['create'](_0x152f13,_0x5b6042)[_0x7f36('0xf5')](path[_0x7f36('0xca')](_0x3208c7,_0x7f36('0xf6')+_0x267661['id']+'-'+_0x44e419+_0x7f36('0xf7')),function(_0x4ce3ed,_0xb7f761){if(_0x4ce3ed)return _0x514afe(_0x4ce3ed);_0x5158bc(_0xb7f761);});});})[_0x7f36('0x27')](function(){return new BPromise(function(_0xe8a4d9,_0x10d67d){zipdir(_0x3208c7,{'saveTo':_0x653adb},function(_0x1f7bea,_0x5debe7){if(_0x1f7bea)return _0x10d67d(_0x1f7bea);return _0xe8a4d9(_0x5debe7);});})[_0x7f36('0x27')](function(){return new BPromise(function(_0x4bae2b,_0x3534d0){rimraf(_0x3208c7,function(_0x1619fd){if(_0x1619fd)_0x3534d0(_0x1619fd);return _0x4bae2b();});});})[_0x7f36('0x27')](function(){return _0x520fd5[_0x7f36('0xc8')](_0x653adb,_0x3d36ad,function(_0x3299b5){if(_0x3299b5){console[_0x7f36('0xf8')](_0x7f36('0xf9'),_0x3299b5);}else{fs[_0x7f36('0xfa')](_0x653adb);}});});});}else{return _0x520fd5[_0x7f36('0x1d')](0xc8);}})[_0x7f36('0xab')](handleError(_0x520fd5,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 5493756..a0e5788 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 _0x48a2=['hook','exports','../../mysqldb','OpenchannelInteraction','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','emit','catch','hasOwnProperty'];(function(_0x123686,_0x189a25){var _0x112e7d=function(_0x2bc67a){while(--_0x2bc67a){_0x123686['push'](_0x123686['shift']());}};_0x112e7d(++_0x189a25);}(_0x48a2,0x172));var _0x248a=function(_0xc5cd18,_0x251c74){_0xc5cd18=_0xc5cd18-0x0;var _0x37a5cb=_0x48a2[_0xc5cd18];return _0x37a5cb;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x248a('0x0'))['db'][_0x248a('0x1')];var OpenchannelMessage=require(_0x248a('0x0'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x248a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x248a('0x3'),'afterDestroy':_0x248a('0x4')};function emitEvent(_0x3d2c08){return function(_0x4a8df0,_0x46363f,_0xe74919){_0x4a8df0[_0x248a('0x5')]({'attributes':['id'],'raw':!![]})[_0x248a('0x6')](function(_0x55e4f5){_0x4a8df0[_0x248a('0x7')](_0x248a('0x8'),_0x55e4f5[_0x248a('0x9')](function(_0x163c06){return{'id':_0x163c06['id']};}));return OpenchannelMessage[_0x248a('0xa')]({'where':{'OpenchannelInteractionId':_0x4a8df0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x248a('0x6')](function(_0x2544ef){_0x4a8df0[_0x248a('0x7')]('unreadMessages',_0x2544ef['length']);OpenchannelInteractionEvents[_0x248a('0xb')](_0x3d2c08+':'+_0x4a8df0['id'],_0x4a8df0);OpenchannelInteractionEvents[_0x248a('0xb')](_0x3d2c08,_0x4a8df0);_0xe74919(null);})[_0x248a('0xc')](_0xe74919(null));};}for(var e in events){if(events[_0x248a('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x248a('0xe')](e,emitEvent(event));}}module[_0x248a('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x3047=['OpenchannelInteraction','OpenchannelMessage','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','catch','hook','events'];(function(_0x4fb09b,_0x35058e){var _0x3bd3ea=function(_0x2c17eb){while(--_0x2c17eb){_0x4fb09b['push'](_0x4fb09b['shift']());}};_0x3bd3ea(++_0x35058e);}(_0x3047,0x77));var _0x7304=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3047[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0x7304('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x7304('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x7304('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7304('0x3'),'afterDestroy':_0x7304('0x4')};function emitEvent(_0x2ca7b3){return function(_0x59ac3e,_0x2f7db9,_0x576f47){_0x59ac3e[_0x7304('0x5')]({'attributes':['id'],'raw':!![]})[_0x7304('0x6')](function(_0x5d2a38){_0x59ac3e['setDataValue'](_0x7304('0x7'),_0x5d2a38['map'](function(_0x39d9d6){return{'id':_0x39d9d6['id']};}));return OpenchannelMessage[_0x7304('0x8')]({'where':{'OpenchannelInteractionId':_0x59ac3e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7304('0x6')](function(_0x2aae2b){_0x59ac3e[_0x7304('0x9')](_0x7304('0xa'),_0x2aae2b[_0x7304('0xb')]);OpenchannelInteractionEvents[_0x7304('0xc')](_0x2ca7b3+':'+_0x59ac3e['id'],_0x59ac3e);OpenchannelInteractionEvents[_0x7304('0xc')](_0x2ca7b3,_0x59ac3e);_0x576f47(null);})[_0x7304('0xd')](_0x576f47(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x7304('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 2187394..35ceac6 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 _0xcca7=['openchannel_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports'];(function(_0xd34966,_0x13d58d){var _0x100536=function(_0x38a51f){while(--_0x38a51f){_0xd34966['push'](_0xd34966['shift']());}};_0x100536(++_0x13d58d);}(_0xcca7,0x1aa));var _0x7cca=function(_0x1c3652,_0x4e4efb){_0x1c3652=_0x1c3652-0x0;var _0x27fddb=_0xcca7[_0x1c3652];return _0x27fddb;};'use strict';var _=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var logger=require(_0x7cca('0x2'))(_0x7cca('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7cca('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7cca('0x5'));var config=require(_0x7cca('0x6'));var attributes=require(_0x7cca('0x7'));module[_0x7cca('0x8')]=function(_0x1c6c95,_0xe70805){return _0x1c6c95['define']('OpenchannelInteraction',attributes,{'tableName':_0x7cca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd7a28d,_0x1aed1b,_0x1e8cb9){if(_0xd7a28d[_0x7cca('0xa')](_0x7cca('0xb'))){_0xd7a28d[_0x7cca('0xc')]=moment()[_0x7cca('0xd')](_0x7cca('0xe'));}_0x1e8cb9(null,_0xd7a28d);}}});}; \ No newline at end of file +var _0xe198=['util','moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0xca41dc,_0x22936e){var _0x3e125c=function(_0x1ef024){while(--_0x1ef024){_0xca41dc['push'](_0xca41dc['shift']());}};_0x3e125c(++_0x22936e);}(_0xe198,0x6f));var _0x8e19=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xe198[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x8e19('0x0'));var util=require(_0x8e19('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8e19('0x2'));var BPromise=require(_0x8e19('0x3'));var rp=require(_0x8e19('0x4'));var fs=require('fs');var path=require(_0x8e19('0x5'));var rimraf=require(_0x8e19('0x6'));var config=require('../../config/environment');var attributes=require(_0x8e19('0x7'));module[_0x8e19('0x8')]=function(_0x2fb138,_0x188ce0){return _0x2fb138[_0x8e19('0x9')](_0x8e19('0xa'),attributes,{'tableName':_0x8e19('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xfc45e,_0xfc4670,_0x1646d4){if(_0xfc45e[_0x8e19('0xc')](_0x8e19('0xd'))){_0xfc45e[_0x8e19('0xe')]=moment()['format'](_0x8e19('0xf'));}_0x1646d4(null,_0xfc45e);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index ac9293b..8b2bc89 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 _0x069c=['request','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','result','catch','UpdateOpenchannelInteraction','update','options','raw','where','attributes','limit','find','addTags','ids','omit','body','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x201e7a,_0x7675a1){var _0x2afc38=function(_0x5727a0){while(--_0x5727a0){_0x201e7a['push'](_0x201e7a['shift']());}};_0x2afc38(++_0x7675a1);}(_0x069c,0x93));var _0xc069=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x069c[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require('lodash');var util=require(_0xc069('0x0'));var moment=require(_0xc069('0x1'));var BPromise=require(_0xc069('0x2'));var rs=require(_0xc069('0x3'));var fs=require('fs');var Redis=require(_0xc069('0x4'));var db=require(_0xc069('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc069('0x6'))('rpc');var config=require(_0xc069('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc069('0x8')][_0xc069('0x9')]({'port':0x232a});config[_0xc069('0xa')]=_[_0xc069('0xb')](config['redis'],{'host':_0xc069('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc069('0xa')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2afb94,_0x59cf58,_0x1b9ecc){return new BPromise(function(_0x2089ea,_0xa79cbe){return client[_0xc069('0xd')](_0x2afb94,_0x1b9ecc)[_0xc069('0xe')](function(_0x4a6356){logger[_0xc069('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x59cf58,_0xc069('0x10'));logger[_0xc069('0x11')](_0xc069('0x12'),_0x59cf58,'request\x20sent',JSON[_0xc069('0x13')](_0x4a6356));if(_0x4a6356[_0xc069('0x14')]){if(_0x4a6356[_0xc069('0x14')][_0xc069('0x15')]===0x1f4){logger[_0xc069('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x59cf58,_0x4a6356[_0xc069('0x14')]['message']);return _0xa79cbe(_0x4a6356[_0xc069('0x14')][_0xc069('0x16')]);}logger[_0xc069('0x14')](_0xc069('0x17'),_0x59cf58,_0x4a6356[_0xc069('0x14')][_0xc069('0x16')]);return _0x2089ea(_0x4a6356['error'][_0xc069('0x16')]);}else{logger[_0xc069('0xf')](_0xc069('0x17'),_0x59cf58,'request\x20sent');_0x2089ea(_0x4a6356[_0xc069('0x18')]['message']);}})[_0xc069('0x19')](function(_0x8ee189){logger[_0xc069('0x14')](_0xc069('0x17'),_0x59cf58,_0x8ee189);_0xa79cbe(_0x8ee189);});});}exports[_0xc069('0x1a')]=function(_0x2506ae){var _0x3bb65b=this;return new Promise(function(_0x26833e,_0x953dc3){return db['OpenchannelInteraction'][_0xc069('0x1b')](_0x2506ae['body'],{'raw':_0x2506ae[_0xc069('0x1c')]?_0x2506ae[_0xc069('0x1c')][_0xc069('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2506ae[_0xc069('0x1c')]?_0x2506ae[_0xc069('0x1c')][_0xc069('0x1e')]||null:null,'attributes':_0x2506ae['options']?_0x2506ae['options'][_0xc069('0x1f')]||null:null,'limit':_0x2506ae['options']?_0x2506ae['options'][_0xc069('0x20')]||null:null})[_0xc069('0xe')](function(_0x508ea3){logger['info'](_0xc069('0x1a'),_0x2506ae);logger[_0xc069('0x11')]('UpdateOpenchannelInteraction',_0x2506ae,JSON[_0xc069('0x13')](_0x508ea3));_0x26833e(_0x508ea3);})['catch'](function(_0x4c6523){logger[_0xc069('0x14')](_0xc069('0x1a'),_0x4c6523[_0xc069('0x16')],_0x2506ae);_0x953dc3(_0x3bb65b[_0xc069('0x14')](0x1f4,_0x4c6523[_0xc069('0x16')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x4e00ed){return new Promise(function(_0x279d0f,_0x11b981){return db['OpenchannelInteraction'][_0xc069('0x21')]({'where':_0x4e00ed['options']?_0x4e00ed[_0xc069('0x1c')]['where']||null:null})[_0xc069('0xe')](function(_0x1db6ea){if(_0x1db6ea){return _0x1db6ea[_0xc069('0x22')](_0x4e00ed['body'][_0xc069('0x23')],_[_0xc069('0x24')](_0x4e00ed[_0xc069('0x25')],[_0xc069('0x23'),'id'])||{});}})[_0xc069('0x26')](function(_0x271fcb){logger['info']('AddTags',_0x4e00ed);logger[_0xc069('0x11')](_0xc069('0x27'),_0x4e00ed,JSON['stringify'](_0x271fcb));_0x279d0f(_0x271fcb);})[_0xc069('0x19')](function(_0x24f7d2){logger['error'](_0xc069('0x27'),_0x24f7d2['message'],_0x4e00ed);_0x11b981(_this['error'](0x1f4,_0x24f7d2[_0xc069('0x16')]));});});}; \ No newline at end of file +var _0x105b=['result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','then','stringify','AddTagsToOpenchannelInteraction','find','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelInteraction,\x20%s,\x20%s'];(function(_0x5bf7b1,_0x466be2){var _0x150d10=function(_0x37ad27){while(--_0x37ad27){_0x5bf7b1['push'](_0x5bf7b1['shift']());}};_0x150d10(++_0x466be2);}(_0x105b,0x1a7));var _0xb105=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x105b[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xb105('0x0'));var util=require(_0xb105('0x1'));var moment=require(_0xb105('0x2'));var BPromise=require(_0xb105('0x3'));var rs=require(_0xb105('0x4'));var fs=require('fs');var Redis=require(_0xb105('0x5'));var db=require(_0xb105('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb105('0x7'))(_0xb105('0x8'));var config=require(_0xb105('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb105('0xa')][_0xb105('0xb')]({'port':0x232a});config[_0xb105('0xc')]=_[_0xb105('0xd')](config[_0xb105('0xc')],{'host':_0xb105('0xe'),'port':0x18eb});var socket=require(_0xb105('0xf'))(new Redis(config['redis']));require(_0xb105('0x10'))[_0xb105('0x11')](socket);function respondWithRpcPromise(_0x5b6689,_0x34ab27,_0x1af8b1){return new BPromise(function(_0x1e4ef3,_0x3bee43){return client[_0xb105('0x12')](_0x5b6689,_0x1af8b1)['then'](function(_0x1b9843){logger[_0xb105('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x34ab27,_0xb105('0x14'));logger[_0xb105('0x15')](_0xb105('0x16'),_0x34ab27,_0xb105('0x14'),JSON['stringify'](_0x1b9843));if(_0x1b9843['error']){if(_0x1b9843[_0xb105('0x17')][_0xb105('0x18')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x34ab27,_0x1b9843[_0xb105('0x17')][_0xb105('0x19')]);return _0x3bee43(_0x1b9843[_0xb105('0x17')][_0xb105('0x19')]);}logger[_0xb105('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x34ab27,_0x1b9843['error'][_0xb105('0x19')]);return _0x1e4ef3(_0x1b9843['error']['message']);}else{logger[_0xb105('0x13')](_0xb105('0x1a'),_0x34ab27,_0xb105('0x14'));_0x1e4ef3(_0x1b9843[_0xb105('0x1b')]['message']);}})[_0xb105('0x1c')](function(_0x1441db){logger[_0xb105('0x17')](_0xb105('0x1a'),_0x34ab27,_0x1441db);_0x3bee43(_0x1441db);});});}exports[_0xb105('0x1d')]=function(_0x5b2290){var _0xdd5134=this;return new Promise(function(_0x422265,_0x7bff86){return db[_0xb105('0x1e')][_0xb105('0x1f')](_0x5b2290[_0xb105('0x20')],{'raw':_0x5b2290['options']?_0x5b2290[_0xb105('0x21')][_0xb105('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b2290[_0xb105('0x21')]?_0x5b2290['options'][_0xb105('0x23')]||null:null,'attributes':_0x5b2290[_0xb105('0x21')]?_0x5b2290[_0xb105('0x21')][_0xb105('0x24')]||null:null,'limit':_0x5b2290['options']?_0x5b2290[_0xb105('0x21')][_0xb105('0x25')]||null:null})[_0xb105('0x26')](function(_0x237e70){logger[_0xb105('0x13')](_0xb105('0x1d'),_0x5b2290);logger[_0xb105('0x15')]('UpdateOpenchannelInteraction',_0x5b2290,JSON[_0xb105('0x27')](_0x237e70));_0x422265(_0x237e70);})[_0xb105('0x1c')](function(_0x53ab1a){logger[_0xb105('0x17')](_0xb105('0x1d'),_0x53ab1a[_0xb105('0x19')],_0x5b2290);_0x7bff86(_0xdd5134[_0xb105('0x17')](0x1f4,_0x53ab1a['message']));});});};exports[_0xb105('0x28')]=function(_0x67e8fb){return new Promise(function(_0x5061d7,_0xcfd15){return db[_0xb105('0x1e')][_0xb105('0x29')]({'where':_0x67e8fb['options']?_0x67e8fb[_0xb105('0x21')][_0xb105('0x23')]||null:null})[_0xb105('0x26')](function(_0x2ba3eb){if(_0x2ba3eb){return _0x2ba3eb['addTags'](_0x67e8fb[_0xb105('0x20')][_0xb105('0x2a')],_['omit'](_0x67e8fb[_0xb105('0x20')],['ids','id'])||{});}})[_0xb105('0x2b')](function(_0x1ba87a){logger[_0xb105('0x13')](_0xb105('0x2c'),_0x67e8fb);logger[_0xb105('0x15')](_0xb105('0x2c'),_0x67e8fb,JSON[_0xb105('0x27')](_0x1ba87a));_0x5061d7(_0x1ba87a);})[_0xb105('0x1c')](function(_0x185402){logger[_0xb105('0x17')](_0xb105('0x2c'),_0x185402[_0xb105('0x19')],_0x67e8fb);_0xcfd15(_this[_0xb105('0x17')](0x1f4,_0x185402[_0xb105('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index cd7a5e1..f37ba86 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 _0x31ee=['save','remove','update','emit','removeListener','length'];(function(_0x807d71,_0x42d9a6){var _0xd16d2b=function(_0x42c05b){while(--_0x42c05b){_0x807d71['push'](_0x807d71['shift']());}};_0xd16d2b(++_0x42d9a6);}(_0x31ee,0x180));var _0xe31e=function(_0x552c8d,_0x1b0083){_0x552c8d=_0x552c8d-0x0;var _0x1fb1cb=_0x31ee[_0x552c8d];return _0x1fb1cb;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xe31e('0x0'),_0xe31e('0x1'),_0xe31e('0x2')];function createListener(_0x2d7be8,_0x51a349){return function(_0x1fc9fa){_0x51a349[_0xe31e('0x3')](_0x2d7be8,_0x1fc9fa);};}function removeListener(_0x17a686,_0x5e010c){return function(){OpenchannelInteractionEvents[_0xe31e('0x4')](_0x17a686,_0x5e010c);};}exports['register']=function(_0x4d7272){for(var _0x5a4454=0x0,_0x63f4f4=events[_0xe31e('0x5')];_0x5a4454<_0x63f4f4;_0x5a4454++){var _0x25de71=events[_0x5a4454];var _0xae6fb9=createListener('openchannelInteraction:'+_0x25de71,_0x4d7272);OpenchannelInteractionEvents['on'](_0x25de71,_0xae6fb9);}}; \ No newline at end of file +var _0x8b29=['openchannelInteraction:','./openchannelInteraction.events','save','remove','update','register'];(function(_0x39f978,_0x20e4a9){var _0x16f9b1=function(_0x372b85){while(--_0x372b85){_0x39f978['push'](_0x39f978['shift']());}};_0x16f9b1(++_0x20e4a9);}(_0x8b29,0x145));var _0x98b2=function(_0x24fd2a,_0x1c5da1){_0x24fd2a=_0x24fd2a-0x0;var _0x50f3ed=_0x8b29[_0x24fd2a];return _0x50f3ed;};'use strict';var OpenchannelInteractionEvents=require(_0x98b2('0x0'));var events=[_0x98b2('0x1'),_0x98b2('0x2'),_0x98b2('0x3')];function createListener(_0x2419dd,_0x51a31e){return function(_0x2a12f9){_0x51a31e['emit'](_0x2419dd,_0x2a12f9);};}function removeListener(_0x19fab1,_0x347aee){return function(){OpenchannelInteractionEvents['removeListener'](_0x19fab1,_0x347aee);};}exports[_0x98b2('0x4')]=function(_0x4d87e2){for(var _0x1fd06d=0x0,_0x1791db=events['length'];_0x1fd06d<_0x1791db;_0x1fd06d++){var _0x465d81=events[_0x1fd06d];var _0x38ee84=createListener(_0x98b2('0x5')+_0x465d81,_0x4d87e2);OpenchannelInteractionEvents['on'](_0x465d81,_0x38ee84);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 23b11ef..84c4e88 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 _0xdb13=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','/describe','isAuthenticated','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','reject','exports'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xdb13,0xb8));var _0x3db1=function(_0x38d201,_0x17e5d2){_0x38d201=_0x38d201-0x0;var _0x4457c6=_0xdb13[_0x38d201];return _0x4457c6;};'use strict';var multer=require('multer');var util=require(_0x3db1('0x0'));var path=require(_0x3db1('0x1'));var timeout=require(_0x3db1('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x3db1('0x3'));var interaction=require(_0x3db1('0x4'));var config=require(_0x3db1('0x5'));var controller=require(_0x3db1('0x6'));router[_0x3db1('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3db1('0x8'),auth[_0x3db1('0x9')](),controller['describe']);router[_0x3db1('0x7')](_0x3db1('0xa'),auth['isAuthenticated'](),controller[_0x3db1('0xb')]);router[_0x3db1('0xc')]('/',auth[_0x3db1('0x9')](),interaction[_0x3db1('0xd')](_0x3db1('0xe'),_0x3db1('0xf')),controller[_0x3db1('0x10')]);router['put']('/:id',auth[_0x3db1('0x9')](),controller[_0x3db1('0x11')]);router[_0x3db1('0x12')](_0x3db1('0x13'),auth[_0x3db1('0x9')](),controller[_0x3db1('0x14')]);router[_0x3db1('0x12')]('/:id/reject',auth['isAuthenticated'](),controller[_0x3db1('0x15')]);router['delete'](_0x3db1('0xa'),auth[_0x3db1('0x9')](),controller['destroy']);module[_0x3db1('0x16')]=router; \ No newline at end of file +var _0x5531=['put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','tracked','openchannel','openchannelmessage:create','create'];(function(_0x571926,_0x559259){var _0x36342c=function(_0x135ccd){while(--_0x135ccd){_0x571926['push'](_0x571926['shift']());}};_0x36342c(++_0x559259);}(_0x5531,0x126));var _0x1553=function(_0x2d460d,_0x18fe45){_0x2d460d=_0x2d460d-0x0;var _0x748df0=_0x5531[_0x2d460d];return _0x748df0;};'use strict';var multer=require(_0x1553('0x0'));var util=require(_0x1553('0x1'));var path=require(_0x1553('0x2'));var timeout=require(_0x1553('0x3'));var express=require('express');var router=express[_0x1553('0x4')]();var auth=require(_0x1553('0x5'));var interaction=require(_0x1553('0x6'));var config=require(_0x1553('0x7'));var controller=require('./openchannelMessage.controller');router[_0x1553('0x8')]('/',auth[_0x1553('0x9')](),controller['index']);router[_0x1553('0x8')](_0x1553('0xa'),auth[_0x1553('0x9')](),controller[_0x1553('0xb')]);router['get'](_0x1553('0xc'),auth[_0x1553('0x9')](),controller[_0x1553('0xd')]);router['post']('/',auth[_0x1553('0x9')](),interaction[_0x1553('0xe')](_0x1553('0xf'),_0x1553('0x10')),controller[_0x1553('0x11')]);router[_0x1553('0x12')](_0x1553('0xc'),auth['isAuthenticated'](),controller[_0x1553('0x13')]);router[_0x1553('0x12')](_0x1553('0x14'),auth['isAuthenticated'](),controller[_0x1553('0x15')]);router[_0x1553('0x12')](_0x1553('0x16'),auth[_0x1553('0x9')](),controller[_0x1553('0x17')]);router[_0x1553('0x18')]('/:id',auth[_0x1553('0x9')](),controller[_0x1553('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 432f722..7e12bb8 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 _0x9444=['medium','BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x9444,0xdd));var _0x4944=function(_0x1168a1,_0xa0d8c9){_0x1168a1=_0x1168a1-0x0;var _0xcc5ad8=_0x9444[_0x1168a1];return _0xcc5ad8;};'use strict';var Sequelize=require(_0x4944('0x0'));module[_0x4944('0x1')]={'body':{'type':Sequelize[_0x4944('0x2')](_0x4944('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4944('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4944('0x5')]('in',_0x4944('0x6')),'defaultValue':_0x4944('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4944('0x7')]}}; \ No newline at end of file +var _0x515b=['sequelize','exports','BOOLEAN','out'];(function(_0x25c326,_0x250137){var _0x762452=function(_0x50ce5e){while(--_0x50ce5e){_0x25c326['push'](_0x25c326['shift']());}};_0x762452(++_0x250137);}(_0x515b,0x1b0));var _0xb515=function(_0x37b248,_0x40854a){_0x37b248=_0x37b248-0x0;var _0x5617f8=_0x515b[_0x37b248];return _0x5617f8;};'use strict';var Sequelize=require(_0xb515('0x0'));module[_0xb515('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb515('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb515('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb515('0x3')),'defaultValue':_0xb515('0x3'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 44768f6..2ad8186 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 _0x34a7=['catch','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','destroy','name','map','OpenchannelMessage','rawAttributes','fieldName','type','key','query','filters','model','attributes','fields','length','hasOwnProperty','offset','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','intersection','find','create','body','describe','openchannel-interactions','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','format','interaction','user','role','null','acceptMessage','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','agent','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./openchannelMessage.socket','register','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x16061d,_0x81a1e3){var _0x565d64=function(_0x2babac){while(--_0x2babac){_0x16061d['push'](_0x16061d['shift']());}};_0x565d64(++_0x81a1e3);}(_0x34a7,0xc7));var _0x734a=function(_0x5a0bb7,_0x1adf06){_0x5a0bb7=_0x5a0bb7-0x0;var _0x5d2000=_0x34a7[_0x5a0bb7];return _0x5d2000;};'use strict';var pdf=require(_0x734a('0x0'));var emlformat=require(_0x734a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x734a('0x2'));var rp=require(_0x734a('0x3'));var moment=require(_0x734a('0x4'));var BPromise=require(_0x734a('0x5'));var Mustache=require(_0x734a('0x6'));var util=require('util');var path=require(_0x734a('0x7'));var sox=require(_0x734a('0x8'));var csv=require('to-csv');var ejs=require(_0x734a('0x9'));var fs=require('fs');var _=require(_0x734a('0xa'));var squel=require(_0x734a('0xb'));var crypto=require(_0x734a('0xc'));var jsforce=require(_0x734a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x734a('0xe'));var querystring=require(_0x734a('0xf'));var Papa=require(_0x734a('0x10'));var Redis=require(_0x734a('0x11'));var authService=require(_0x734a('0x12'));var qs=require(_0x734a('0x13'));var as=require(_0x734a('0x14'));var hardwareService=require(_0x734a('0x15'));var logger=require(_0x734a('0x16'))('api');var utils=require(_0x734a('0x17'));var config=require(_0x734a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x734a('0x19'))['db'];config['redis']=_[_0x734a('0x1a')](config[_0x734a('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x734a('0x1c'))(new Redis(config[_0x734a('0x1b')]));require(_0x734a('0x1d'))[_0x734a('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x734a('0x1f')][_0x734a('0x20')]({'port':0x232c});var client9002=jayson[_0x734a('0x1f')][_0x734a('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x4a839c,_0x1ac9fb,_0x4b07d9,_0x188273){return new BPromise(function(_0x107bf3,_0x49b57e){var _0x597d36=_0x188273||client;return _0x597d36['request'](_0x4a839c,_0x4b07d9)[_0x734a('0x21')](function(_0x46ce4f){logger[_0x734a('0x22')](_0x734a('0x23'),_0x1ac9fb,_0x734a('0x24'));logger[_0x734a('0x25')](_0x734a('0x26'),_0x1ac9fb,_0x734a('0x24'),JSON[_0x734a('0x27')](_0x46ce4f));if(_0x46ce4f[_0x734a('0x28')]){if(_0x46ce4f[_0x734a('0x28')][_0x734a('0x29')]===0x1f4){logger[_0x734a('0x28')](_0x734a('0x23'),_0x1ac9fb,_0x46ce4f['error'][_0x734a('0x2a')]);return _0x49b57e(_0x46ce4f[_0x734a('0x28')]['message']);}logger[_0x734a('0x28')](_0x734a('0x23'),_0x1ac9fb,_0x46ce4f[_0x734a('0x28')][_0x734a('0x2a')]);return _0x107bf3(_0x46ce4f[_0x734a('0x28')][_0x734a('0x2a')]);}else{logger['info'](_0x734a('0x23'),_0x1ac9fb,_0x734a('0x24'));_0x107bf3(_0x46ce4f['result'][_0x734a('0x2a')]);}})[_0x734a('0x2b')](function(_0x194907){logger[_0x734a('0x28')](_0x734a('0x23'),_0x1ac9fb,_0x194907);_0x49b57e(_0x194907);});});}function respondWithStatusCode(_0x16ad28,_0x1eab5a){_0x1eab5a=_0x1eab5a||0xcc;return function(_0x34ef1f){if(_0x34ef1f){return _0x16ad28[_0x734a('0x2c')](_0x1eab5a);}return _0x16ad28[_0x734a('0x2d')](_0x1eab5a)[_0x734a('0x2e')]();};}function respondWithResult(_0x1e4bcd,_0x246459){_0x246459=_0x246459||0xc8;return function(_0x3cc509){if(_0x3cc509){return _0x1e4bcd[_0x734a('0x2d')](_0x246459)[_0x734a('0x2f')](_0x3cc509);}};}function respondWithFilteredResult(_0x45ac87,_0x3cc60c){return function(_0x5461f3){if(_0x5461f3){var _0x1af4f0=_0x5461f3[_0x734a('0x30')],_0x56452f=_0x3cc60c['offset'],_0x69c620=_0x3cc60c['offset']+_0x3cc60c[_0x734a('0x31')],_0x24c3a9;if(_0x69c620>=_0x1af4f0){_0x69c620=_0x1af4f0;_0x24c3a9=0xc8;}else{_0x24c3a9=0xce;}_0x45ac87[_0x734a('0x2d')](_0x24c3a9);return _0x45ac87[_0x734a('0x32')](_0x734a('0x33'),_0x56452f+'-'+_0x69c620+'/'+_0x1af4f0)[_0x734a('0x2f')](_0x5461f3);}return null;};}function patchUpdates(_0x53245a){return function(_0xc9223b){try{jsonpatch[_0x734a('0x34')](_0xc9223b,_0x53245a,!![]);}catch(_0x5ad96c){return BPromise[_0x734a('0x35')](_0x5ad96c);}return _0xc9223b[_0x734a('0x36')]();};}function saveUpdates(_0x42f339,_0x23d8ea){return function(_0x4c0dde){if(_0x4c0dde){return _0x4c0dde[_0x734a('0x37')](_0x42f339)[_0x734a('0x21')](function(_0x1726dc){return _0x1726dc;});}return null;};}function removeEntity(_0x931ec2,_0x3ae86c){return function(_0x3d80a6){if(_0x3d80a6){return _0x3d80a6[_0x734a('0x38')]()[_0x734a('0x21')](function(){_0x931ec2[_0x734a('0x2d')](0xcc)[_0x734a('0x2e')]();});}};}function handleEntityNotFound(_0x2b3dd6,_0x422870){return function(_0x1b1c45){if(!_0x1b1c45){_0x2b3dd6[_0x734a('0x2c')](0x194);}return _0x1b1c45;};}function handleError(_0x3ff764,_0x4944bd){_0x4944bd=_0x4944bd||0x1f4;return function(_0x30dc31){logger[_0x734a('0x28')](_0x30dc31['stack']);if(_0x30dc31[_0x734a('0x39')]){delete _0x30dc31[_0x734a('0x39')];}_0x3ff764['status'](_0x4944bd)['send'](_0x30dc31);};}exports['index']=function(_0x245909,_0x4e2055){var _0x1b537b={},_0x5e7f3e={},_0x447666={'count':0x0,'rows':[]};var _0x2502b8=_[_0x734a('0x3a')](db[_0x734a('0x3b')][_0x734a('0x3c')],function(_0x399924){return{'name':_0x399924[_0x734a('0x3d')],'type':_0x399924[_0x734a('0x3e')][_0x734a('0x3f')]};});_0x5e7f3e['model']=_[_0x734a('0x3a')](_0x2502b8,_0x734a('0x39'));_0x5e7f3e['query']=_['keys'](_0x245909[_0x734a('0x40')]);_0x5e7f3e[_0x734a('0x41')]=_['intersection'](_0x5e7f3e[_0x734a('0x42')],_0x5e7f3e[_0x734a('0x40')]);_0x1b537b[_0x734a('0x43')]=_['intersection'](_0x5e7f3e[_0x734a('0x42')],qs[_0x734a('0x44')](_0x245909['query'][_0x734a('0x44')]));_0x1b537b['attributes']=_0x1b537b['attributes'][_0x734a('0x45')]?_0x1b537b['attributes']:_0x5e7f3e[_0x734a('0x42')];if(!_0x245909[_0x734a('0x40')][_0x734a('0x46')]('nolimit')){_0x1b537b[_0x734a('0x31')]=qs[_0x734a('0x31')](_0x245909[_0x734a('0x40')]['limit']);_0x1b537b[_0x734a('0x47')]=qs[_0x734a('0x47')](_0x245909['query'][_0x734a('0x47')]);}_0x1b537b[_0x734a('0x48')]=qs[_0x734a('0x49')](_0x245909[_0x734a('0x40')][_0x734a('0x49')]);_0x1b537b['where']=qs[_0x734a('0x41')](_[_0x734a('0x4a')](_0x245909['query'],_0x5e7f3e[_0x734a('0x41')]),_0x2502b8);if(_0x245909[_0x734a('0x40')][_0x734a('0x4b')]){_0x1b537b['where']=_['merge'](_0x1b537b[_0x734a('0x4c')],{'$or':_[_0x734a('0x3a')](_0x2502b8,function(_0x1d9dbc){if(_0x1d9dbc['type']!==_0x734a('0x4d')){var _0x4b924e={};_0x4b924e[_0x1d9dbc[_0x734a('0x39')]]={'$like':'%'+_0x245909[_0x734a('0x40')][_0x734a('0x4b')]+'%'};return _0x4b924e;}})});}_0x1b537b=_[_0x734a('0x4e')]({},_0x1b537b,_0x245909[_0x734a('0x4f')]);var _0x3cbe2d={'where':_0x1b537b[_0x734a('0x4c')]};return db[_0x734a('0x3b')][_0x734a('0x30')](_0x3cbe2d)[_0x734a('0x21')](function(_0x43d7af){_0x447666[_0x734a('0x30')]=_0x43d7af;if(_0x245909['query'][_0x734a('0x50')]){_0x1b537b[_0x734a('0x51')]=[{'all':!![]}];}return db[_0x734a('0x3b')][_0x734a('0x52')](_0x1b537b);})['then'](function(_0x1ffeb4){_0x447666[_0x734a('0x53')]=_0x1ffeb4;return _0x447666;})['then'](respondWithFilteredResult(_0x4e2055,_0x1b537b))[_0x734a('0x2b')](handleError(_0x4e2055,null));};exports[_0x734a('0x54')]=function(_0x241934,_0x5df11b){var _0x1b8cb8={'raw':!![],'where':{'id':_0x241934[_0x734a('0x55')]['id']}},_0x2cd375={};_0x2cd375[_0x734a('0x42')]=_[_0x734a('0x56')](db[_0x734a('0x3b')][_0x734a('0x3c')]);_0x2cd375['query']=_[_0x734a('0x56')](_0x241934['query']);_0x2cd375['filtears']=_[_0x734a('0x57')](_0x2cd375[_0x734a('0x42')],_0x2cd375['query']);_0x1b8cb8[_0x734a('0x43')]=_[_0x734a('0x57')](_0x2cd375[_0x734a('0x42')],qs['fields'](_0x241934[_0x734a('0x40')][_0x734a('0x44')]));_0x1b8cb8[_0x734a('0x43')]=_0x1b8cb8['attributes'][_0x734a('0x45')]?_0x1b8cb8[_0x734a('0x43')]:_0x2cd375['model'];if(_0x241934[_0x734a('0x40')]['includeAll']){_0x1b8cb8[_0x734a('0x51')]=[{'all':!![]}];}_0x1b8cb8=_['merge']({},_0x1b8cb8,_0x241934['options']);return db[_0x734a('0x3b')][_0x734a('0x58')](_0x1b8cb8)[_0x734a('0x21')](handleEntityNotFound(_0x5df11b,null))[_0x734a('0x21')](respondWithResult(_0x5df11b,null))[_0x734a('0x2b')](handleError(_0x5df11b,null));};exports[_0x734a('0x59')]=function(_0x5d93a7,_0x58c0f5){return db[_0x734a('0x3b')][_0x734a('0x59')](_0x5d93a7['body'],{})['then'](respondWithResult(_0x58c0f5,0xc9))[_0x734a('0x2b')](handleError(_0x58c0f5,null));};exports[_0x734a('0x37')]=function(_0x535955,_0x4e890f){if(_0x535955[_0x734a('0x5a')]['id']){delete _0x535955[_0x734a('0x5a')]['id'];}return db[_0x734a('0x3b')][_0x734a('0x58')]({'where':{'id':_0x535955[_0x734a('0x55')]['id']}})[_0x734a('0x21')](handleEntityNotFound(_0x4e890f,null))['then'](saveUpdates(_0x535955[_0x734a('0x5a')],null))[_0x734a('0x21')](respondWithResult(_0x4e890f,null))[_0x734a('0x2b')](handleError(_0x4e890f,null));};exports[_0x734a('0x38')]=function(_0x542135,_0x4240d1){return db[_0x734a('0x3b')][_0x734a('0x58')]({'where':{'id':_0x542135[_0x734a('0x55')]['id']}})['then'](handleEntityNotFound(_0x4240d1,null))[_0x734a('0x21')](removeEntity(_0x4240d1,null))['catch'](handleError(_0x4240d1,null));};exports[_0x734a('0x5b')]=function(_0x30fa12,_0x1504c6){return db[_0x734a('0x3b')][_0x734a('0x5b')]()[_0x734a('0x21')](respondWithResult(_0x1504c6,null))[_0x734a('0x2b')](handleError(_0x1504c6,null));};var interaction_log=require('../../config/logger')(_0x734a('0x5c'));exports['accept']=function(_0x25e572,_0x808301,_0x1652b7){var _0x155c33={'channel':_0x734a('0x5d')};if(_0x25e572[_0x734a('0x5a')]['id']){delete _0x25e572[_0x734a('0x5a')]['id'];}_0x25e572[_0x734a('0x5a')][_0x734a('0x5e')]=!![];_0x25e572[_0x734a('0x5a')][_0x734a('0x5f')]=moment()['format'](_0x734a('0x60'));_0x25e572[_0x734a('0x5a')]['UserId']=_0x25e572[_0x734a('0x5a')][_0x734a('0x61')]||_0x25e572['user']['id'];return db['OpenchannelMessage']['find']({'where':{'id':_0x25e572['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x734a('0x62')}]})[_0x734a('0x21')](handleEntityNotFound(_0x808301,null))[_0x734a('0x21')](saveUpdates(_0x25e572[_0x734a('0x5a')],null))[_0x734a('0x21')](function(_0x4d4905){if(_0x4d4905){_0x155c33['message']=_0x4d4905['get']({'plain':!![]});return db[_0x734a('0x63')][_0x734a('0x58')]({'where':{'id':_0x4d4905[_0x734a('0x64')]}});}return null;})[_0x734a('0x21')](handleEntityNotFound(_0x808301,null))[_0x734a('0x21')](function(_0x2a7ac9){if(_0x2a7ac9){return _0x2a7ac9[_0x734a('0x37')]({'UserId':_0x25e572[_0x734a('0x5a')]['UserId'],'read1stAt':_['isNil'](_0x2a7ac9[_0x734a('0x65')])?moment()[_0x734a('0x66')](_0x734a('0x60')):undefined});}return null;})[_0x734a('0x21')](function(_0x9f6084){if(_0x9f6084){_0x155c33[_0x734a('0x67')]=_0x9f6084['get']({'plain':!![]});interaction_log[_0x734a('0x22')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x25e572[_0x734a('0x68')]['id'],_0x25e572[_0x734a('0x68')][_0x734a('0x39')],_0x25e572[_0x734a('0x68')][_0x734a('0x69')],_0x155c33[_0x734a('0x67')]['id'],_0x25e572[_0x734a('0x5a')]?JSON[_0x734a('0x27')](_0x25e572[_0x734a('0x5a')]):_0x734a('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x734a('0x6b'),_0x155c33);}return null;})['then'](function(_0x500131){if(_0x500131){if(_0x25e572[_0x734a('0x5a')]['manual']){_0x155c33[_0x734a('0x2a')][_0x734a('0x6c')]=util[_0x734a('0x66')](_0x734a('0x6d'),_0x25e572[_0x734a('0x68')][_0x734a('0x39')]);_0x155c33[_0x734a('0x2a')][_0x734a('0x6e')]=_0x155c33[_0x734a('0x6e')];_0x155c33[_0x734a('0x2a')][_0x734a('0x6f')]=_0x734a('0x70');return respondWithRpcPromise(_0x734a('0x71'),'EventManager',{'event':_0x734a('0x72'),'message':_0x155c33[_0x734a('0x2a')]},client9002)[_0x734a('0x21')](function(){return _0x155c33;});}return _0x155c33;}return null;})[_0x734a('0x21')](respondWithResult(_0x808301,null))['catch'](handleError(_0x808301,null));};var interaction_log=require(_0x734a('0x16'))(_0x734a('0x5c'));exports['reject']=function(_0x2db2e0,_0x21e9b6,_0x8c896e){var _0x30f9e7={'agent':{},'channel':_0x734a('0x5d')};if(_0x2db2e0['body']['id']){delete _0x2db2e0[_0x734a('0x5a')]['id'];}_0x2db2e0[_0x734a('0x5a')][_0x734a('0x61')]=_0x2db2e0[_0x734a('0x5a')]['UserId']||_0x2db2e0['user']['id'];_0x30f9e7[_0x734a('0x73')]['id']=_0x2db2e0['body'][_0x734a('0x61')];return db[_0x734a('0x3b')][_0x734a('0x58')]({'where':{'id':_0x2db2e0[_0x734a('0x55')]['id'],'UserId':null}})[_0x734a('0x21')](handleEntityNotFound(_0x21e9b6,null))[_0x734a('0x21')](function(_0xd3eb81){if(_0xd3eb81){_0x30f9e7[_0x734a('0x2a')]=_0xd3eb81[_0x734a('0x74')]({'plain':!![]});return db[_0x734a('0x63')][_0x734a('0x58')]({'where':{'id':_0xd3eb81['OpenchannelInteractionId']}});}return null;})[_0x734a('0x21')](handleEntityNotFound(_0x21e9b6,null))[_0x734a('0x21')](function(_0x5d5614){if(_0x5d5614){_0x30f9e7['interaction']=_0x5d5614[_0x734a('0x74')]({'plain':!![]});interaction_log[_0x734a('0x22')](_0x734a('0x75'),_0x2db2e0[_0x734a('0x68')]['id'],_0x2db2e0['user'][_0x734a('0x39')],_0x2db2e0['user']['role'],_0x30f9e7[_0x734a('0x67')]['id'],_0x2db2e0[_0x734a('0x5a')]?JSON[_0x734a('0x27')](_0x2db2e0[_0x734a('0x5a')]):_0x734a('0x6a'));return respondWithRpcPromise(_0x734a('0x76'),_0x734a('0x77'),_0x30f9e7);}return null;})[_0x734a('0x21')](function(_0x3d6cef){if(_0x3d6cef){_0x3d6cef[_0x734a('0x2a')][_0x734a('0x6c')]=util[_0x734a('0x66')](_0x734a('0x6d'),_0x2db2e0[_0x734a('0x68')][_0x734a('0x39')]);_0x3d6cef[_0x734a('0x2a')]['channel']=_0x30f9e7[_0x734a('0x6e')];_0x3d6cef[_0x734a('0x2a')][_0x734a('0x6f')]=_0x734a('0x35');respondWithRpcPromise(_0x734a('0x71'),'EventManager',{'event':_0x734a('0x78'),'message':_0x3d6cef['message']},client9002);return _0x30f9e7;}return null;})[_0x734a('0x21')](respondWithResult(_0x21e9b6,null))['catch'](handleError(_0x21e9b6,null));}; \ No newline at end of file +var _0x4f5b=['Contact','isNil','read1stAt','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SIP/%s','channel','event','EventManager','acceptmessage','openchannel-interactions','agent','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','request-promise','moment','bluebird','mustache','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','../../config/license/util','../../mysqldb','redis','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','end','status','json','count','offset','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filtears','find','create','body','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x4f5b,0x186));var _0xb4f5=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4f5b[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0xb4f5('0x0'));var emlformat=require(_0xb4f5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb4f5('0x2'));var moment=require(_0xb4f5('0x3'));var BPromise=require(_0xb4f5('0x4'));var Mustache=require(_0xb4f5('0x5'));var util=require('util');var path=require('path');var sox=require(_0xb4f5('0x6'));var csv=require(_0xb4f5('0x7'));var ejs=require(_0xb4f5('0x8'));var fs=require('fs');var _=require(_0xb4f5('0x9'));var squel=require(_0xb4f5('0xa'));var crypto=require(_0xb4f5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb4f5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb4f5('0xd'));var Papa=require(_0xb4f5('0xe'));var Redis=require(_0xb4f5('0xf'));var authService=require(_0xb4f5('0x10'));var qs=require(_0xb4f5('0x11'));var as=require(_0xb4f5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb4f5('0x13'))(_0xb4f5('0x14'));var utils=require(_0xb4f5('0x15'));var config=require(_0xb4f5('0x16'));var licenseUtil=require(_0xb4f5('0x17'));var db=require(_0xb4f5('0x18'))['db'];config[_0xb4f5('0x19')]=_['defaults'](config['redis'],{'host':_0xb4f5('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb4f5('0x19')]));require(_0xb4f5('0x1b'))[_0xb4f5('0x1c')](socket);var jayson=require(_0xb4f5('0x1d'));var client=jayson[_0xb4f5('0x1e')][_0xb4f5('0x1f')]({'port':0x232c});var client9002=jayson[_0xb4f5('0x1e')][_0xb4f5('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x37af4b,_0x22b615,_0x2e4c8c,_0x42709a){return new BPromise(function(_0x5313ac,_0x29a68f){var _0x28090b=_0x42709a||client;return _0x28090b[_0xb4f5('0x20')](_0x37af4b,_0x2e4c8c)[_0xb4f5('0x21')](function(_0x51821d){logger[_0xb4f5('0x22')](_0xb4f5('0x23'),_0x22b615,_0xb4f5('0x24'));logger[_0xb4f5('0x25')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x22b615,_0xb4f5('0x24'),JSON[_0xb4f5('0x26')](_0x51821d));if(_0x51821d[_0xb4f5('0x27')]){if(_0x51821d[_0xb4f5('0x27')][_0xb4f5('0x28')]===0x1f4){logger['error'](_0xb4f5('0x23'),_0x22b615,_0x51821d[_0xb4f5('0x27')][_0xb4f5('0x29')]);return _0x29a68f(_0x51821d[_0xb4f5('0x27')][_0xb4f5('0x29')]);}logger[_0xb4f5('0x27')](_0xb4f5('0x23'),_0x22b615,_0x51821d[_0xb4f5('0x27')][_0xb4f5('0x29')]);return _0x5313ac(_0x51821d['error'][_0xb4f5('0x29')]);}else{logger[_0xb4f5('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x22b615,_0xb4f5('0x24'));_0x5313ac(_0x51821d[_0xb4f5('0x2a')][_0xb4f5('0x29')]);}})['catch'](function(_0x54c2e5){logger[_0xb4f5('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x22b615,_0x54c2e5);_0x29a68f(_0x54c2e5);});});}function respondWithStatusCode(_0x2a8eb7,_0x5f0047){_0x5f0047=_0x5f0047||0xcc;return function(_0x3a285b){if(_0x3a285b){return _0x2a8eb7['sendStatus'](_0x5f0047);}return _0x2a8eb7['status'](_0x5f0047)[_0xb4f5('0x2b')]();};}function respondWithResult(_0x1c3b75,_0x151b5e){_0x151b5e=_0x151b5e||0xc8;return function(_0x59e1e4){if(_0x59e1e4){return _0x1c3b75[_0xb4f5('0x2c')](_0x151b5e)[_0xb4f5('0x2d')](_0x59e1e4);}};}function respondWithFilteredResult(_0x5de140,_0x2c30d9){return function(_0x5ed430){if(_0x5ed430){var _0x4421d0=_0x5ed430[_0xb4f5('0x2e')],_0x6b7d79=_0x2c30d9[_0xb4f5('0x2f')],_0x2799b1=_0x2c30d9[_0xb4f5('0x2f')]+_0x2c30d9['limit'],_0x4599f3;if(_0x2799b1>=_0x4421d0){_0x2799b1=_0x4421d0;_0x4599f3=0xc8;}else{_0x4599f3=0xce;}_0x5de140[_0xb4f5('0x2c')](_0x4599f3);return _0x5de140[_0xb4f5('0x30')](_0xb4f5('0x31'),_0x6b7d79+'-'+_0x2799b1+'/'+_0x4421d0)['json'](_0x5ed430);}return null;};}function patchUpdates(_0x3913a2){return function(_0xc96ee8){try{jsonpatch['apply'](_0xc96ee8,_0x3913a2,!![]);}catch(_0x45dcc1){return BPromise[_0xb4f5('0x32')](_0x45dcc1);}return _0xc96ee8[_0xb4f5('0x33')]();};}function saveUpdates(_0x318778,_0x5bf8b4){return function(_0x280ac5){if(_0x280ac5){return _0x280ac5[_0xb4f5('0x34')](_0x318778)[_0xb4f5('0x21')](function(_0x4304da){return _0x4304da;});}return null;};}function removeEntity(_0x3d1116,_0x64adc8){return function(_0x53f4ea){if(_0x53f4ea){return _0x53f4ea[_0xb4f5('0x35')]()['then'](function(){_0x3d1116[_0xb4f5('0x2c')](0xcc)[_0xb4f5('0x2b')]();});}};}function handleEntityNotFound(_0x5baff0,_0x5316fa){return function(_0x114bc1){if(!_0x114bc1){_0x5baff0['sendStatus'](0x194);}return _0x114bc1;};}function handleError(_0x458d53,_0x187dbc){_0x187dbc=_0x187dbc||0x1f4;return function(_0x326b84){logger[_0xb4f5('0x27')](_0x326b84[_0xb4f5('0x36')]);if(_0x326b84[_0xb4f5('0x37')]){delete _0x326b84[_0xb4f5('0x37')];}_0x458d53[_0xb4f5('0x2c')](_0x187dbc)[_0xb4f5('0x38')](_0x326b84);};}exports[_0xb4f5('0x39')]=function(_0x2d82b6,_0x2a843a){var _0x4d5ed3={},_0x4daa63={},_0x1ccaac={'count':0x0,'rows':[]};var _0x3d4eac=_[_0xb4f5('0x3a')](db[_0xb4f5('0x3b')][_0xb4f5('0x3c')],function(_0x2db39e){return{'name':_0x2db39e[_0xb4f5('0x3d')],'type':_0x2db39e[_0xb4f5('0x3e')][_0xb4f5('0x3f')]};});_0x4daa63['model']=_[_0xb4f5('0x3a')](_0x3d4eac,_0xb4f5('0x37'));_0x4daa63[_0xb4f5('0x40')]=_[_0xb4f5('0x41')](_0x2d82b6[_0xb4f5('0x40')]);_0x4daa63[_0xb4f5('0x42')]=_['intersection'](_0x4daa63[_0xb4f5('0x43')],_0x4daa63['query']);_0x4d5ed3['attributes']=_[_0xb4f5('0x44')](_0x4daa63[_0xb4f5('0x43')],qs['fields'](_0x2d82b6[_0xb4f5('0x40')][_0xb4f5('0x45')]));_0x4d5ed3['attributes']=_0x4d5ed3[_0xb4f5('0x46')][_0xb4f5('0x47')]?_0x4d5ed3['attributes']:_0x4daa63['model'];if(!_0x2d82b6[_0xb4f5('0x40')]['hasOwnProperty'](_0xb4f5('0x48'))){_0x4d5ed3[_0xb4f5('0x49')]=qs[_0xb4f5('0x49')](_0x2d82b6['query'][_0xb4f5('0x49')]);_0x4d5ed3[_0xb4f5('0x2f')]=qs[_0xb4f5('0x2f')](_0x2d82b6['query'][_0xb4f5('0x2f')]);}_0x4d5ed3[_0xb4f5('0x4a')]=qs[_0xb4f5('0x4b')](_0x2d82b6[_0xb4f5('0x40')][_0xb4f5('0x4b')]);_0x4d5ed3[_0xb4f5('0x4c')]=qs[_0xb4f5('0x42')](_['pick'](_0x2d82b6[_0xb4f5('0x40')],_0x4daa63[_0xb4f5('0x42')]),_0x3d4eac);if(_0x2d82b6['query'][_0xb4f5('0x4d')]){_0x4d5ed3[_0xb4f5('0x4c')]=_[_0xb4f5('0x4e')](_0x4d5ed3[_0xb4f5('0x4c')],{'$or':_[_0xb4f5('0x3a')](_0x3d4eac,function(_0x29538b){if(_0x29538b[_0xb4f5('0x3e')]!==_0xb4f5('0x4f')){var _0x2a4045={};_0x2a4045[_0x29538b['name']]={'$like':'%'+_0x2d82b6[_0xb4f5('0x40')][_0xb4f5('0x4d')]+'%'};return _0x2a4045;}})});}_0x4d5ed3=_[_0xb4f5('0x4e')]({},_0x4d5ed3,_0x2d82b6[_0xb4f5('0x50')]);var _0x40981c={'where':_0x4d5ed3[_0xb4f5('0x4c')]};return db[_0xb4f5('0x3b')][_0xb4f5('0x2e')](_0x40981c)[_0xb4f5('0x21')](function(_0x21a2d4){_0x1ccaac[_0xb4f5('0x2e')]=_0x21a2d4;if(_0x2d82b6['query'][_0xb4f5('0x51')]){_0x4d5ed3[_0xb4f5('0x52')]=[{'all':!![]}];}return db[_0xb4f5('0x3b')][_0xb4f5('0x53')](_0x4d5ed3);})[_0xb4f5('0x21')](function(_0x2c0c37){_0x1ccaac[_0xb4f5('0x54')]=_0x2c0c37;return _0x1ccaac;})['then'](respondWithFilteredResult(_0x2a843a,_0x4d5ed3))[_0xb4f5('0x55')](handleError(_0x2a843a,null));};exports[_0xb4f5('0x56')]=function(_0x127b4b,_0x1c0eaa){var _0x174550={'raw':!![],'where':{'id':_0x127b4b[_0xb4f5('0x57')]['id']}},_0x1f9cbf={};_0x1f9cbf['model']=_[_0xb4f5('0x41')](db[_0xb4f5('0x3b')]['rawAttributes']);_0x1f9cbf['query']=_[_0xb4f5('0x41')](_0x127b4b[_0xb4f5('0x40')]);_0x1f9cbf[_0xb4f5('0x58')]=_['intersection'](_0x1f9cbf[_0xb4f5('0x43')],_0x1f9cbf['query']);_0x174550['attributes']=_['intersection'](_0x1f9cbf[_0xb4f5('0x43')],qs[_0xb4f5('0x45')](_0x127b4b['query'][_0xb4f5('0x45')]));_0x174550[_0xb4f5('0x46')]=_0x174550[_0xb4f5('0x46')][_0xb4f5('0x47')]?_0x174550[_0xb4f5('0x46')]:_0x1f9cbf[_0xb4f5('0x43')];if(_0x127b4b[_0xb4f5('0x40')][_0xb4f5('0x51')]){_0x174550[_0xb4f5('0x52')]=[{'all':!![]}];}_0x174550=_[_0xb4f5('0x4e')]({},_0x174550,_0x127b4b[_0xb4f5('0x50')]);return db[_0xb4f5('0x3b')][_0xb4f5('0x59')](_0x174550)[_0xb4f5('0x21')](handleEntityNotFound(_0x1c0eaa,null))[_0xb4f5('0x21')](respondWithResult(_0x1c0eaa,null))[_0xb4f5('0x55')](handleError(_0x1c0eaa,null));};exports['create']=function(_0x14c4c3,_0x2ff87f){return db[_0xb4f5('0x3b')][_0xb4f5('0x5a')](_0x14c4c3['body'],{})[_0xb4f5('0x21')](respondWithResult(_0x2ff87f,0xc9))[_0xb4f5('0x55')](handleError(_0x2ff87f,null));};exports[_0xb4f5('0x34')]=function(_0x17e9a1,_0x3e0a3f){if(_0x17e9a1['body']['id']){delete _0x17e9a1[_0xb4f5('0x5b')]['id'];}return db[_0xb4f5('0x3b')]['find']({'where':{'id':_0x17e9a1[_0xb4f5('0x57')]['id']}})[_0xb4f5('0x21')](handleEntityNotFound(_0x3e0a3f,null))[_0xb4f5('0x21')](saveUpdates(_0x17e9a1['body'],null))[_0xb4f5('0x21')](respondWithResult(_0x3e0a3f,null))[_0xb4f5('0x55')](handleError(_0x3e0a3f,null));};exports['destroy']=function(_0x56c34b,_0x27502e){return db[_0xb4f5('0x3b')][_0xb4f5('0x59')]({'where':{'id':_0x56c34b[_0xb4f5('0x57')]['id']}})['then'](handleEntityNotFound(_0x27502e,null))['then'](removeEntity(_0x27502e,null))[_0xb4f5('0x55')](handleError(_0x27502e,null));};exports[_0xb4f5('0x5c')]=function(_0x1073fb,_0x1312f4){return db['OpenchannelMessage'][_0xb4f5('0x5c')]()[_0xb4f5('0x21')](respondWithResult(_0x1312f4,null))['catch'](handleError(_0x1312f4,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0xb4f5('0x5d')]=function(_0x87eae7,_0x4de28c,_0x2201d9){var _0x8d6d3c={'channel':_0xb4f5('0x5e')};if(_0x87eae7[_0xb4f5('0x5b')]['id']){delete _0x87eae7[_0xb4f5('0x5b')]['id'];}_0x87eae7[_0xb4f5('0x5b')][_0xb4f5('0x5f')]=!![];_0x87eae7[_0xb4f5('0x5b')][_0xb4f5('0x60')]=moment()[_0xb4f5('0x61')](_0xb4f5('0x62'));_0x87eae7[_0xb4f5('0x5b')]['UserId']=_0x87eae7[_0xb4f5('0x5b')][_0xb4f5('0x63')]||_0x87eae7[_0xb4f5('0x64')]['id'];return db['OpenchannelMessage']['find']({'where':{'id':_0x87eae7[_0xb4f5('0x57')]['id'],'UserId':null},'include':[{'model':db[_0xb4f5('0x65')],'as':_0xb4f5('0x66')}]})[_0xb4f5('0x21')](handleEntityNotFound(_0x4de28c,null))[_0xb4f5('0x21')](saveUpdates(_0x87eae7[_0xb4f5('0x5b')],null))[_0xb4f5('0x21')](function(_0x2eef0e){if(_0x2eef0e){_0x8d6d3c['message']=_0x2eef0e['get']({'plain':!![]});return db['OpenchannelInteraction'][_0xb4f5('0x59')]({'where':{'id':_0x2eef0e['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4de28c,null))[_0xb4f5('0x21')](function(_0xacc736){if(_0xacc736){return _0xacc736[_0xb4f5('0x34')]({'UserId':_0x87eae7['body'][_0xb4f5('0x63')],'read1stAt':_[_0xb4f5('0x67')](_0xacc736[_0xb4f5('0x68')])?moment()['format'](_0xb4f5('0x62')):undefined});}return null;})['then'](function(_0x4d8fc1){if(_0x4d8fc1){_0x8d6d3c[_0xb4f5('0x69')]=_0x4d8fc1[_0xb4f5('0x6a')]({'plain':!![]});interaction_log[_0xb4f5('0x22')](_0xb4f5('0x6b'),_0x87eae7[_0xb4f5('0x64')]['id'],_0x87eae7['user'][_0xb4f5('0x37')],_0x87eae7[_0xb4f5('0x64')][_0xb4f5('0x6c')],_0x8d6d3c[_0xb4f5('0x69')]['id'],_0x87eae7['body']?JSON[_0xb4f5('0x26')](_0x87eae7['body']):_0xb4f5('0x6d'));return respondWithRpcPromise('AcceptMessage',_0xb4f5('0x6e'),_0x8d6d3c);}return null;})[_0xb4f5('0x21')](function(_0x312206){if(_0x312206){if(_0x87eae7[_0xb4f5('0x5b')]['manual']){_0x8d6d3c[_0xb4f5('0x29')]['interface']=util[_0xb4f5('0x61')](_0xb4f5('0x6f'),_0x87eae7[_0xb4f5('0x64')][_0xb4f5('0x37')]);_0x8d6d3c[_0xb4f5('0x29')]['channel']=_0x8d6d3c[_0xb4f5('0x70')];_0x8d6d3c[_0xb4f5('0x29')][_0xb4f5('0x71')]=_0xb4f5('0x5d');return respondWithRpcPromise('EventManager',_0xb4f5('0x72'),{'event':_0xb4f5('0x73'),'message':_0x8d6d3c[_0xb4f5('0x29')]},client9002)[_0xb4f5('0x21')](function(){return _0x8d6d3c;});}return _0x8d6d3c;}return null;})[_0xb4f5('0x21')](respondWithResult(_0x4de28c,null))['catch'](handleError(_0x4de28c,null));};var interaction_log=require('../../config/logger')(_0xb4f5('0x74'));exports['reject']=function(_0x106461,_0x2e3b1b,_0x1e60eb){var _0x489637={'agent':{},'channel':_0xb4f5('0x5e')};if(_0x106461[_0xb4f5('0x5b')]['id']){delete _0x106461[_0xb4f5('0x5b')]['id'];}_0x106461[_0xb4f5('0x5b')][_0xb4f5('0x63')]=_0x106461[_0xb4f5('0x5b')][_0xb4f5('0x63')]||_0x106461[_0xb4f5('0x64')]['id'];_0x489637[_0xb4f5('0x75')]['id']=_0x106461[_0xb4f5('0x5b')][_0xb4f5('0x63')];return db[_0xb4f5('0x3b')][_0xb4f5('0x59')]({'where':{'id':_0x106461[_0xb4f5('0x57')]['id'],'UserId':null}})[_0xb4f5('0x21')](handleEntityNotFound(_0x2e3b1b,null))[_0xb4f5('0x21')](function(_0x1c75a5){if(_0x1c75a5){_0x489637[_0xb4f5('0x29')]=_0x1c75a5[_0xb4f5('0x6a')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x1c75a5[_0xb4f5('0x76')]}});}return null;})[_0xb4f5('0x21')](handleEntityNotFound(_0x2e3b1b,null))[_0xb4f5('0x21')](function(_0x4ffd8d){if(_0x4ffd8d){_0x489637[_0xb4f5('0x69')]=_0x4ffd8d[_0xb4f5('0x6a')]({'plain':!![]});interaction_log[_0xb4f5('0x22')](_0xb4f5('0x77'),_0x106461[_0xb4f5('0x64')]['id'],_0x106461[_0xb4f5('0x64')][_0xb4f5('0x37')],_0x106461['user'][_0xb4f5('0x6c')],_0x489637[_0xb4f5('0x69')]['id'],_0x106461[_0xb4f5('0x5b')]?JSON[_0xb4f5('0x26')](_0x106461['body']):'null');return respondWithRpcPromise(_0xb4f5('0x78'),_0xb4f5('0x79'),_0x489637);}return null;})[_0xb4f5('0x21')](function(_0x430caa){if(_0x430caa){_0x430caa[_0xb4f5('0x29')]['interface']=util[_0xb4f5('0x61')]('SIP/%s',_0x106461[_0xb4f5('0x64')]['name']);_0x430caa[_0xb4f5('0x29')][_0xb4f5('0x70')]=_0x489637[_0xb4f5('0x70')];_0x430caa[_0xb4f5('0x29')][_0xb4f5('0x71')]='reject';respondWithRpcPromise(_0xb4f5('0x72'),_0xb4f5('0x72'),{'event':_0xb4f5('0x7a'),'message':_0x430caa['message']},client9002);return _0x489637;}return null;})[_0xb4f5('0x21')](respondWithResult(_0x2e3b1b,null))[_0xb4f5('0x55')](handleError(_0x2e3b1b,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index b672fee..d9a4910 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 _0x94fa=['hook','exports','events','setMaxListeners','save','update','remove','emit'];(function(_0x349d5b,_0x1026b7){var _0x18dd40=function(_0x1bd4e0){while(--_0x1bd4e0){_0x349d5b['push'](_0x349d5b['shift']());}};_0x18dd40(++_0x1026b7);}(_0x94fa,0x1a2));var _0xa94f=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x94fa[_0x298ed3];return _0x5aad28;};'use strict';var EventEmitter=require(_0xa94f('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xa94f('0x1')](0x0);var events={'afterCreate':_0xa94f('0x2'),'afterUpdate':_0xa94f('0x3'),'afterDestroy':_0xa94f('0x4')};function emitEvent(_0x11a7cf){return function(_0xf91d20,_0x83f346,_0x177093){OpenchannelMessageEvents[_0xa94f('0x5')](_0x11a7cf+':'+_0xf91d20['id'],_0xf91d20);OpenchannelMessageEvents[_0xa94f('0x5')](_0x11a7cf,_0xf91d20);_0x177093(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xa94f('0x6')](e,emitEvent(event));}}module[_0xa94f('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x6978=['hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6978,0x18e));var _0x8697=function(_0x4715d2,_0x3371b2){_0x4715d2=_0x4715d2-0x0;var _0x141811=_0x6978[_0x4715d2];return _0x141811;};'use strict';var EventEmitter=require(_0x8697('0x0'));var OpenchannelMessage=require(_0x8697('0x1'))['db'][_0x8697('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8697('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8697('0x4')};function emitEvent(_0x12ac17){return function(_0x2d79c1,_0x4ab962,_0x3274ca){OpenchannelMessageEvents[_0x8697('0x5')](_0x12ac17+':'+_0x2d79c1['id'],_0x2d79c1);OpenchannelMessageEvents['emit'](_0x12ac17,_0x2d79c1);_0x3274ca(null);};}for(var e in events){if(events[_0x8697('0x6')](e)){var event=events[e];OpenchannelMessage[_0x8697('0x7')](e,emitEvent(event));}}module[_0x8697('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 65c0509..441bf48 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 _0x2aa8=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','error','CmContact','describe','find','OpenchannelAccountId','Interactions','Contact','keys','info','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','Interaction','omit','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x4d2993,_0x1c9473){var _0x427374=function(_0x149dfd){while(--_0x149dfd){_0x4d2993['push'](_0x4d2993['shift']());}};_0x427374(++_0x1c9473);}(_0x2aa8,0xd2));var _0x82aa=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2aa8[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x82aa('0x0'));var logger=require(_0x82aa('0x1'))(_0x82aa('0x2'));var moment=require(_0x82aa('0x3'));var BPromise=require(_0x82aa('0x4'));var rp=require(_0x82aa('0x5'));var fs=require('fs');var path=require(_0x82aa('0x6'));var rimraf=require(_0x82aa('0x7'));var config=require(_0x82aa('0x8'));var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x5c6abc,_0x4ad4e9){return _0x5c6abc[_0x82aa('0x9')](_0x82aa('0xa'),attributes,{'tableName':_0x82aa('0xb'),'paranoid':![],'indexes':[{'name':_0x82aa('0xc'),'fields':[_0x82aa('0xd')],'type':_0x82aa('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xb5808c,_0x24a110,_0x3eee94){var _0x52c867=_0x5c6abc[_0x82aa('0xf')];var _0x23f131=_0xb5808c[_0x82aa('0x10')]({'plain':!![]});if(_0x23f131[_0x82aa('0x11')][_0x82aa('0x12')]()==='in'||_0x23f131[_0x82aa('0x11')][_0x82aa('0x12')]()===_0x82aa('0x13')&&!_0x23f131[_0x82aa('0x14')]&&!_[_0x82aa('0x15')](_0x23f131[_0x82aa('0x16')])){_0x52c867[_0x82aa('0x17')][_0x82aa('0x18')]({'where':{'id':_0x23f131[_0x82aa('0x19')]}})[_0x82aa('0x1a')](function(_0x236423){if(_0x236423){_0x236423[_0x82aa('0x1b')]({'lastMsgAt':_0x23f131[_0x82aa('0x1c')],'lastMsgDirection':_0x23f131[_0x82aa('0x11')][_0x82aa('0x12')]()});}})['catch'](function(_0x583a49){console[_0x82aa('0x1d')](_0x583a49);});}if(_0x23f131['direction']===_0x82aa('0x13')&&!_0x23f131[_0x82aa('0x14')]){var _0x2ba645;_0x52c867[_0x82aa('0x1e')][_0x82aa('0x1f')]()[_0x82aa('0x1a')](function(_0x40f7b2){return _0x52c867['OpenchannelAccount'][_0x82aa('0x20')]({'where':{'id':_0x23f131[_0x82aa('0x21')]},'include':[{'model':_0x52c867[_0x82aa('0x17')],'as':_0x82aa('0x22'),'where':{'id':_0x23f131[_0x82aa('0x19')]},'limit':0x1,'include':[{'model':_0x52c867[_0x82aa('0x1e')],'as':_0x82aa('0x23'),'attributes':_[_0x82aa('0x24')](_0x40f7b2)}]}]});})[_0x82aa('0x1a')](function(_0x1f9f4f){_0x2ba645=_0x1f9f4f[_0x82aa('0x10')]({'plain':!![]});if(_0x2ba645&&_0x2ba645['replyUri']){logger[_0x82aa('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x82aa('0x26'),util['format'](_0x82aa('0x27'),_0x23f131['id'],_0x2ba645[_0x82aa('0x28')]));if(_0x2ba645[_0x82aa('0x22')]&&_0x2ba645[_0x82aa('0x22')]['length']){_0x23f131[_0x82aa('0x29')]=_[_0x82aa('0x2a')](_0x2ba645[_0x82aa('0x22')][0x0],_0x82aa('0x23'));_0x23f131[_0x82aa('0x23')]=_0x2ba645[_0x82aa('0x22')][0x0][_0x82aa('0x23')];}var _0x24a110={'method':_0x82aa('0x2b'),'uri':encodeURI(_0x2ba645['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x24a110[_0x82aa('0x2c')]){case _0x82aa('0x2d'):_0x24a110['qs']=_0x23f131;break;case _0x82aa('0x2b'):_0x24a110['body']=_0x23f131;break;}return rp(_0x24a110)[_0x82aa('0x1a')](function(_0x265dd0){logger['info'](_0x82aa('0x2e'),'afterCreate',util[_0x82aa('0x2f')](_0x82aa('0x30'),_0x23f131['id'],_0x2ba645[_0x82aa('0x28')]));if(_0x265dd0['body'][_0x82aa('0x31')]&&_0x265dd0[_0x82aa('0xd')][_0x82aa('0x31')]!=_0x23f131[_0x82aa('0x29')][_0x82aa('0x31')]){return _0x52c867[_0x82aa('0x17')][_0x82aa('0x1b')]({'threadId':_0x265dd0[_0x82aa('0xd')][_0x82aa('0x31')]},{'logging':!![],'where':{'id':_0x23f131[_0x82aa('0x29')]['id']}});}else{return;}})['then'](function(){return _0xb5808c[_0x82aa('0x1b')]({'read':!![]});})['catch'](function(_0x5a91f1){logger[_0x82aa('0x1d')]('OpenchannelMessage,\x20%s,\x20%s',_0x82aa('0x26'),util[_0x82aa('0x32')](_0x5a91f1,{'showHidden':![],'depth':null}));_0x3eee94();});}else{_0x3eee94();}})[_0x82aa('0x33')](function(){_0x3eee94();});}else{_0x3eee94();}}},'charset':'utf8mb4','collate':_0x82aa('0x34')});}; \ No newline at end of file +var _0xd9f5=['isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','describe','find','OpenchannelAccountId','Interactions','CmContact','Contact','keys','replyUri','info','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','method','GET','POST','OpenchannelMessage,\x20%s,\x20%s','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','finally','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./openchannelMessage.attributes','exports','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret'];(function(_0x5b34c0,_0x3ad403){var _0x242bd3=function(_0x51d0ce){while(--_0x51d0ce){_0x5b34c0['push'](_0x5b34c0['shift']());}};_0x242bd3(++_0x3ad403);}(_0xd9f5,0x152));var _0x5d9f=function(_0x92713a,_0x68f8b0){_0x92713a=_0x92713a-0x0;var _0x1893e1=_0xd9f5[_0x92713a];return _0x1893e1;};'use strict';var _=require(_0x5d9f('0x0'));var util=require(_0x5d9f('0x1'));var logger=require(_0x5d9f('0x2'))(_0x5d9f('0x3'));var moment=require(_0x5d9f('0x4'));var BPromise=require('bluebird');var rp=require(_0x5d9f('0x5'));var fs=require('fs');var path=require(_0x5d9f('0x6'));var rimraf=require(_0x5d9f('0x7'));var config=require('../../config/environment');var attributes=require(_0x5d9f('0x8'));module[_0x5d9f('0x9')]=function(_0xdb8369,_0x484df7){return _0xdb8369['define'](_0x5d9f('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x5d9f('0xb'),'fields':[_0x5d9f('0xc')],'type':_0x5d9f('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ba015,_0x2b4a4b,_0x4b5b90){var _0x59f0f4=_0xdb8369['models'];var _0x343661=_0x5ba015[_0x5d9f('0xe')]({'plain':!![]});if(_0x343661[_0x5d9f('0xf')]['toLowerCase']()==='in'||_0x343661['direction'][_0x5d9f('0x10')]()===_0x5d9f('0x11')&&!_0x343661[_0x5d9f('0x12')]&&!_[_0x5d9f('0x13')](_0x343661[_0x5d9f('0x14')])){_0x59f0f4[_0x5d9f('0x15')][_0x5d9f('0x16')]({'where':{'id':_0x343661[_0x5d9f('0x17')]}})[_0x5d9f('0x18')](function(_0x1600e9){if(_0x1600e9){_0x1600e9[_0x5d9f('0x19')]({'lastMsgAt':_0x343661[_0x5d9f('0x1a')],'lastMsgDirection':_0x343661[_0x5d9f('0xf')][_0x5d9f('0x10')]()});}})[_0x5d9f('0x1b')](function(_0x35e461){console['error'](_0x35e461);});}if(_0x343661[_0x5d9f('0xf')]===_0x5d9f('0x11')&&!_0x343661[_0x5d9f('0x12')]){var _0xd5cb2d;_0x59f0f4['CmContact'][_0x5d9f('0x1c')]()[_0x5d9f('0x18')](function(_0x2e31cc){return _0x59f0f4['OpenchannelAccount'][_0x5d9f('0x1d')]({'where':{'id':_0x343661[_0x5d9f('0x1e')]},'include':[{'model':_0x59f0f4[_0x5d9f('0x15')],'as':_0x5d9f('0x1f'),'where':{'id':_0x343661[_0x5d9f('0x17')]},'limit':0x1,'include':[{'model':_0x59f0f4[_0x5d9f('0x20')],'as':_0x5d9f('0x21'),'attributes':_[_0x5d9f('0x22')](_0x2e31cc)}]}]});})[_0x5d9f('0x18')](function(_0xd3b75c){_0xd5cb2d=_0xd3b75c[_0x5d9f('0xe')]({'plain':!![]});if(_0xd5cb2d&&_0xd5cb2d[_0x5d9f('0x23')]){logger[_0x5d9f('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x5d9f('0x25'),util['format'](_0x5d9f('0x26'),_0x343661['id'],_0xd5cb2d[_0x5d9f('0x23')]));if(_0xd5cb2d[_0x5d9f('0x1f')]&&_0xd5cb2d[_0x5d9f('0x1f')][_0x5d9f('0x27')]){_0x343661['Interaction']=_[_0x5d9f('0x28')](_0xd5cb2d[_0x5d9f('0x1f')][0x0],'Contact');_0x343661[_0x5d9f('0x21')]=_0xd5cb2d[_0x5d9f('0x1f')][0x0][_0x5d9f('0x21')];}var _0x2b4a4b={'method':'POST','uri':encodeURI(_0xd5cb2d[_0x5d9f('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2b4a4b[_0x5d9f('0x29')]){case _0x5d9f('0x2a'):_0x2b4a4b['qs']=_0x343661;break;case _0x5d9f('0x2b'):_0x2b4a4b[_0x5d9f('0xc')]=_0x343661;break;}return rp(_0x2b4a4b)[_0x5d9f('0x18')](function(_0x197b78){logger[_0x5d9f('0x24')](_0x5d9f('0x2c'),_0x5d9f('0x25'),util[_0x5d9f('0x2d')](_0x5d9f('0x2e'),_0x343661['id'],_0xd5cb2d[_0x5d9f('0x23')]));if(_0x197b78['body'][_0x5d9f('0x2f')]&&_0x197b78[_0x5d9f('0xc')][_0x5d9f('0x2f')]!=_0x343661['Interaction'][_0x5d9f('0x2f')]){return _0x59f0f4[_0x5d9f('0x15')][_0x5d9f('0x19')]({'threadId':_0x197b78[_0x5d9f('0xc')][_0x5d9f('0x2f')]},{'logging':!![],'where':{'id':_0x343661['Interaction']['id']}});}else{return;}})[_0x5d9f('0x18')](function(){return _0x5ba015[_0x5d9f('0x19')]({'read':!![]});})['catch'](function(_0x378875){logger[_0x5d9f('0x30')]('OpenchannelMessage,\x20%s,\x20%s',_0x5d9f('0x25'),util['inspect'](_0x378875,{'showHidden':![],'depth':null}));_0x4b5b90();});}else{_0x4b5b90();}})[_0x5d9f('0x31')](function(){_0x4b5b90();});}else{_0x4b5b90();}}},'charset':_0x5d9f('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 3f6805f..51f513c 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 _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0x266743,_0x341d46){var _0x3b13a2=function(_0x1f98cc){while(--_0x1f98cc){_0x266743['push'](_0x266743['shift']());}};_0x3b13a2(++_0x341d46);}(_0xb10b,0x12a));var _0xbb10=function(_0x26f1c4,_0x2bbc6a){_0x26f1c4=_0x26f1c4-0x0;var _0x393a70=_0xb10b[_0x26f1c4];return _0x393a70;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file +var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0x1b4ada,_0x3cf76c){var _0x2c2453=function(_0x20c49a){while(--_0x20c49a){_0x1b4ada['push'](_0x1b4ada['shift']());}};_0x2c2453(++_0x3cf76c);}(_0xb10b,0x12a));var _0xbb10=function(_0x14e00a,_0x50dcc0){_0x14e00a=_0x14e00a-0x0;var _0x3f57fb=_0xb10b[_0x14e00a];return _0x3f57fb;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 2f9c4eb..c9dfeda 100644 --- a/server/api/openchannelMessage/openchannelMessage.socket.js +++ b/server/api/openchannelMessage/openchannelMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['removeListener','register','./openchannelMessage.events'];(function(_0x5d7bf6,_0x12b796){var _0xb7075c=function(_0xb0d4b9){while(--_0xb0d4b9){_0x5d7bf6['push'](_0x5d7bf6['shift']());}};_0xb7075c(++_0x12b796);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1e1b76,_0x189cfd){_0x1e1b76=_0x1e1b76-0x0;var _0x1f091d=_0xf4eb[_0x1e1b76];return _0x1f091d;};'use strict';var OpenchannelMessageEvents=require(_0xbf4e('0x0'));var events=['save','remove','update'];function createListener(_0x5ed5b9,_0xbbbf01){return function(_0x49d80e){_0xbbbf01['emit'](_0x5ed5b9,_0x49d80e);};}function removeListener(_0x2e3070,_0x1c7606){return function(){OpenchannelMessageEvents[_0xbf4e('0x1')](_0x2e3070,_0x1c7606);};}exports[_0xbf4e('0x2')]=function(_0xa4dcf5){for(var _0x2fcfed=0x0,_0x15b99f=events['length'];_0x2fcfed<_0x15b99f;_0x2fcfed++){var _0x449d55=events[_0x2fcfed];var _0x5013c2=createListener('openchannelMessage:'+_0x449d55,_0xa4dcf5);OpenchannelMessageEvents['on'](_0x449d55,_0x5013c2);}}; \ No newline at end of file +var _0xaa88=['save','remove','update','emit','removeListener','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x48ac17,_0x1147b5){var _0x12c118=function(_0x1b9bdc){while(--_0x1b9bdc){_0x48ac17['push'](_0x48ac17['shift']());}};_0x12c118(++_0x1147b5);}(_0xaa88,0x137));var _0x8aa8=function(_0x330723,_0x8de382){_0x330723=_0x330723-0x0;var _0x60c546=_0xaa88[_0x330723];return _0x60c546;};'use strict';var OpenchannelMessageEvents=require(_0x8aa8('0x0'));var events=[_0x8aa8('0x1'),_0x8aa8('0x2'),_0x8aa8('0x3')];function createListener(_0x4aee38,_0x4ba9dd){return function(_0x3a5b12){_0x4ba9dd[_0x8aa8('0x4')](_0x4aee38,_0x3a5b12);};}function removeListener(_0x3b2c88,_0x3e3b70){return function(){OpenchannelMessageEvents[_0x8aa8('0x5')](_0x3b2c88,_0x3e3b70);};}exports['register']=function(_0x5bda0d){for(var _0x460042=0x0,_0x5264ff=events[_0x8aa8('0x6')];_0x460042<_0x5264ff;_0x460042++){var _0x1ed84d=events[_0x460042];var _0x27c08d=createListener(_0x8aa8('0x7')+_0x1ed84d,_0x5bda0d);OpenchannelMessageEvents['on'](_0x1ed84d,_0x27c08d);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index de57f5f..43d5887 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 _0x8c52=['get','isAuthenticated','index','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller'];(function(_0x365e54,_0x44be74){var _0x13317a=function(_0x2d917f){while(--_0x2d917f){_0x365e54['push'](_0x365e54['shift']());}};_0x13317a(++_0x44be74);}(_0x8c52,0x7e));var _0x28c5=function(_0x22e690,_0x5f570e){_0x22e690=_0x22e690-0x0;var _0x2b515f=_0x8c52[_0x22e690];return _0x2b515f;};'use strict';var multer=require(_0x28c5('0x0'));var util=require('util');var path=require(_0x28c5('0x1'));var timeout=require(_0x28c5('0x2'));var express=require(_0x28c5('0x3'));var router=express[_0x28c5('0x4')]();var auth=require(_0x28c5('0x5'));var interaction=require(_0x28c5('0x6'));var config=require(_0x28c5('0x7'));var controller=require(_0x28c5('0x8'));router[_0x28c5('0x9')]('/',auth[_0x28c5('0xa')](),controller[_0x28c5('0xb')]);router[_0x28c5('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x28c5('0xc'),auth[_0x28c5('0xa')](),controller[_0x28c5('0xd')]);router['get'](_0x28c5('0xe'),auth[_0x28c5('0xa')](),controller['getMembers']);router[_0x28c5('0x9')](_0x28c5('0xf'),auth[_0x28c5('0xa')](),controller[_0x28c5('0x10')]);router[_0x28c5('0x9')](_0x28c5('0x11'),auth[_0x28c5('0xa')](),controller[_0x28c5('0x12')]);router[_0x28c5('0x13')]('/',auth[_0x28c5('0xa')](),controller['create']);router[_0x28c5('0x13')](_0x28c5('0xf'),auth[_0x28c5('0xa')](),controller[_0x28c5('0x14')]);router['post'](_0x28c5('0x11'),auth[_0x28c5('0xa')](),controller[_0x28c5('0x15')]);router[_0x28c5('0x16')](_0x28c5('0xc'),auth[_0x28c5('0xa')](),controller[_0x28c5('0x17')]);router[_0x28c5('0x18')]('/:id',auth[_0x28c5('0xa')](),controller[_0x28c5('0x19')]);router[_0x28c5('0x18')](_0x28c5('0xf'),auth[_0x28c5('0xa')](),controller['removeTeams']);router['delete'](_0x28c5('0x11'),auth[_0x28c5('0xa')](),controller['removeAgents']);module[_0x28c5('0x1a')]=router; \ No newline at end of file +var _0x891b=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','path','connect-timeout','Router'];(function(_0x545e8c,_0x151714){var _0x3203f4=function(_0x56881b){while(--_0x56881b){_0x545e8c['push'](_0x545e8c['shift']());}};_0x3203f4(++_0x151714);}(_0x891b,0xc5));var _0xb891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x891b[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb891('0x0'));var timeout=require(_0xb891('0x1'));var express=require('express');var router=express[_0xb891('0x2')]();var auth=require(_0xb891('0x3'));var interaction=require(_0xb891('0x4'));var config=require(_0xb891('0x5'));var controller=require('./openchannelQueue.controller');router[_0xb891('0x6')]('/',auth[_0xb891('0x7')](),controller['index']);router[_0xb891('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xb891('0x6')](_0xb891('0x8'),auth[_0xb891('0x7')](),controller[_0xb891('0x9')]);router[_0xb891('0x6')](_0xb891('0xa'),auth[_0xb891('0x7')](),controller['getMembers']);router[_0xb891('0x6')](_0xb891('0xb'),auth[_0xb891('0x7')](),controller[_0xb891('0xc')]);router[_0xb891('0x6')](_0xb891('0xd'),auth[_0xb891('0x7')](),controller[_0xb891('0xe')]);router[_0xb891('0xf')]('/',auth[_0xb891('0x7')](),controller[_0xb891('0x10')]);router['post'](_0xb891('0xb'),auth[_0xb891('0x7')](),controller[_0xb891('0x11')]);router['post'](_0xb891('0xd'),auth[_0xb891('0x7')](),controller['addAgents']);router[_0xb891('0x12')]('/:id',auth[_0xb891('0x7')](),controller[_0xb891('0x13')]);router[_0xb891('0x14')](_0xb891('0x8'),auth[_0xb891('0x7')](),controller[_0xb891('0x15')]);router['delete']('/:id/teams',auth[_0xb891('0x7')](),controller[_0xb891('0x16')]);router[_0xb891('0x14')](_0xb891('0xd'),auth[_0xb891('0x7')](),controller[_0xb891('0x17')]);module[_0xb891('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 03b0a68..99d9881 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 _0x16a8=['name','ENUM','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x52f95d,_0x4d5473){var _0x352901=function(_0x552cc6){while(--_0x552cc6){_0x52f95d['push'](_0x52f95d['shift']());}};_0x352901(++_0x4d5473);}(_0x16a8,0xb4));var _0x816a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x16a8[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0x816a('0x0'));module['exports']={'name':{'type':Sequelize[_0x816a('0x1')],'unique':_0x816a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x816a('0x3')](_0x816a('0x4'),_0x816a('0x5'),_0x816a('0x6'))}}; \ No newline at end of file +var _0x3e24=['rrmemory','roundrobin','sequelize','exports','STRING','name','ENUM'];(function(_0x4ecda5,_0x404c32){var _0x1b8865=function(_0x16d3b4){while(--_0x16d3b4){_0x4ecda5['push'](_0x4ecda5['shift']());}};_0x1b8865(++_0x404c32);}(_0x3e24,0x167));var _0x43e2=function(_0x484f06,_0x36e4ac){_0x484f06=_0x484f06-0x0;var _0x332d44=_0x3e24[_0x484f06];return _0x332d44;};'use strict';var Sequelize=require(_0x43e2('0x0'));module[_0x43e2('0x1')]={'name':{'type':Sequelize[_0x43e2('0x2')],'unique':_0x43e2('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x43e2('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x43e2('0x4')](_0x43e2('0x5'),'beepall',_0x43e2('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 5053885..768773b 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 _0x4f3c=['options','include','findAll','rows','catch','show','params','filtears','includeAll','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelQueues','UserProfileSection','find','userProfileId','describe','UserOpenchannelQueue','pick','OpenchannelQueueId','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','ids','User','Agents','online','voicePause','interface','sequelize','addTeams','each','findOrCreate','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','emit','userOpenchannelQueue:save','getAgents','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','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./openchannelQueue.socket','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','send','map','OpenchannelQueue','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','name'];(function(_0x1d930e,_0x20d8b8){var _0x5bbd66=function(_0x3c7488){while(--_0x3c7488){_0x1d930e['push'](_0x1d930e['shift']());}};_0x5bbd66(++_0x20d8b8);}(_0x4f3c,0x15d));var _0xc4f3=function(_0x4ed37d,_0x1a84c9){_0x4ed37d=_0x4ed37d-0x0;var _0x4fb2c5=_0x4f3c[_0x4ed37d];return _0x4fb2c5;};'use strict';var pdf=require(_0xc4f3('0x0'));var emlformat=require(_0xc4f3('0x1'));var rimraf=require(_0xc4f3('0x2'));var zipdir=require(_0xc4f3('0x3'));var jsonpatch=require(_0xc4f3('0x4'));var rp=require(_0xc4f3('0x5'));var moment=require(_0xc4f3('0x6'));var BPromise=require(_0xc4f3('0x7'));var Mustache=require(_0xc4f3('0x8'));var util=require(_0xc4f3('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xc4f3('0xa'));var ejs=require(_0xc4f3('0xb'));var fs=require('fs');var _=require(_0xc4f3('0xc'));var squel=require(_0xc4f3('0xd'));var crypto=require(_0xc4f3('0xe'));var jsforce=require(_0xc4f3('0xf'));var deskjs=require(_0xc4f3('0x10'));var toCsv=require(_0xc4f3('0xa'));var querystring=require(_0xc4f3('0x11'));var Papa=require(_0xc4f3('0x12'));var Redis=require('ioredis');var authService=require(_0xc4f3('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4f3('0x14'));var logger=require('../../config/logger')(_0xc4f3('0x15'));var utils=require(_0xc4f3('0x16'));var config=require(_0xc4f3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc4f3('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xc4f3('0x19'),'port':0x18eb});var socket=require(_0xc4f3('0x1a'))(new Redis(config[_0xc4f3('0x1b')]));require(_0xc4f3('0x1c'))['register'](socket);function respondWithStatusCode(_0x12981d,_0x387e4d){_0x387e4d=_0x387e4d||0xcc;return function(_0xb31105){if(_0xb31105){return _0x12981d[_0xc4f3('0x1d')](_0x387e4d);}return _0x12981d['status'](_0x387e4d)[_0xc4f3('0x1e')]();};}function respondWithResult(_0x3a4ff3,_0x52bd89){_0x52bd89=_0x52bd89||0xc8;return function(_0x2fdcb3){if(_0x2fdcb3){return _0x3a4ff3[_0xc4f3('0x1f')](_0x52bd89)[_0xc4f3('0x20')](_0x2fdcb3);}};}function respondWithFilteredResult(_0x53b0b6,_0x4ea86d){return function(_0xbc5595){if(_0xbc5595){var _0x22f779=_0xbc5595[_0xc4f3('0x21')],_0x1dc5a8=_0x4ea86d[_0xc4f3('0x22')],_0x3a27b7=_0x4ea86d[_0xc4f3('0x22')]+_0x4ea86d[_0xc4f3('0x23')],_0x5d8e32;if(_0x3a27b7>=_0x22f779){_0x3a27b7=_0x22f779;_0x5d8e32=0xc8;}else{_0x5d8e32=0xce;}_0x53b0b6[_0xc4f3('0x1f')](_0x5d8e32);return _0x53b0b6[_0xc4f3('0x24')](_0xc4f3('0x25'),_0x1dc5a8+'-'+_0x3a27b7+'/'+_0x22f779)[_0xc4f3('0x20')](_0xbc5595);}return null;};}function patchUpdates(_0x12b2c4){return function(_0x16e4e7){try{jsonpatch[_0xc4f3('0x26')](_0x16e4e7,_0x12b2c4,!![]);}catch(_0x502fbe){return BPromise[_0xc4f3('0x27')](_0x502fbe);}return _0x16e4e7[_0xc4f3('0x28')]();};}function saveUpdates(_0x4b19a3,_0x5c9d3d){return function(_0x20399c){if(_0x20399c){return _0x20399c[_0xc4f3('0x29')](_0x4b19a3)['then'](function(_0x5b3ac3){return _0x5b3ac3;});}return null;};}function removeEntity(_0x1f04a7,_0x1c6b53){return function(_0xd2fa46){if(_0xd2fa46){return _0xd2fa46['destroy']()[_0xc4f3('0x2a')](function(){var _0x460ee7=_0xd2fa46[_0xc4f3('0x2b')]({'plain':!![]});var _0x11ea96='OpenchannelQueues';return db[_0xc4f3('0x2c')][_0xc4f3('0x2d')]({'where':{'type':_0x11ea96,'resourceId':_0x460ee7['id']}})[_0xc4f3('0x2a')](function(){return _0xd2fa46;});})[_0xc4f3('0x2a')](function(){_0x1f04a7[_0xc4f3('0x1f')](0xcc)[_0xc4f3('0x1e')]();});}};}function handleEntityNotFound(_0x2912e4,_0x541946){return function(_0x45c294){if(!_0x45c294){_0x2912e4[_0xc4f3('0x1d')](0x194);}return _0x45c294;};}function handleError(_0x7e4227,_0x4125be){_0x4125be=_0x4125be||0x1f4;return function(_0x5aa950){logger[_0xc4f3('0x2e')](_0x5aa950[_0xc4f3('0x2f')]);if(_0x5aa950['name']){delete _0x5aa950['name'];}_0x7e4227[_0xc4f3('0x1f')](_0x4125be)[_0xc4f3('0x30')](_0x5aa950);};}exports['index']=function(_0x3c1722,_0x1bcb2a){var _0x303b12={},_0x393953={},_0x4a5b7d={'count':0x0,'rows':[]};var _0x16306c=_[_0xc4f3('0x31')](db[_0xc4f3('0x32')][_0xc4f3('0x33')],function(_0x4438e8){return{'name':_0x4438e8[_0xc4f3('0x34')],'type':_0x4438e8[_0xc4f3('0x35')]['key']};});_0x393953[_0xc4f3('0x36')]=_[_0xc4f3('0x31')](_0x16306c,'name');_0x393953[_0xc4f3('0x37')]=_[_0xc4f3('0x38')](_0x3c1722[_0xc4f3('0x37')]);_0x393953['filters']=_['intersection'](_0x393953[_0xc4f3('0x36')],_0x393953[_0xc4f3('0x37')]);_0x303b12[_0xc4f3('0x39')]=_[_0xc4f3('0x3a')](_0x393953[_0xc4f3('0x36')],qs[_0xc4f3('0x3b')](_0x3c1722[_0xc4f3('0x37')][_0xc4f3('0x3b')]));_0x303b12[_0xc4f3('0x39')]=_0x303b12[_0xc4f3('0x39')][_0xc4f3('0x3c')]?_0x303b12[_0xc4f3('0x39')]:_0x393953['model'];if(!_0x3c1722['query'][_0xc4f3('0x3d')](_0xc4f3('0x3e'))){_0x303b12[_0xc4f3('0x23')]=qs[_0xc4f3('0x23')](_0x3c1722[_0xc4f3('0x37')][_0xc4f3('0x23')]);_0x303b12[_0xc4f3('0x22')]=qs[_0xc4f3('0x22')](_0x3c1722[_0xc4f3('0x37')]['offset']);}_0x303b12[_0xc4f3('0x3f')]=qs[_0xc4f3('0x40')](_0x3c1722['query']['sort']);_0x303b12[_0xc4f3('0x41')]=qs[_0xc4f3('0x42')](_['pick'](_0x3c1722[_0xc4f3('0x37')],_0x393953[_0xc4f3('0x42')]),_0x16306c);if(_0x3c1722[_0xc4f3('0x37')][_0xc4f3('0x43')]){_0x303b12[_0xc4f3('0x41')]=_[_0xc4f3('0x44')](_0x303b12['where'],{'$or':_[_0xc4f3('0x31')](_0x16306c,function(_0x17336a){if(_0x17336a[_0xc4f3('0x35')]!==_0xc4f3('0x45')){var _0x184f23={};_0x184f23[_0x17336a[_0xc4f3('0x46')]]={'$like':'%'+_0x3c1722['query'][_0xc4f3('0x43')]+'%'};return _0x184f23;}})});}_0x303b12=_[_0xc4f3('0x44')]({},_0x303b12,_0x3c1722[_0xc4f3('0x47')]);var _0x459e25={'where':_0x303b12[_0xc4f3('0x41')]};return db['OpenchannelQueue'][_0xc4f3('0x21')](_0x459e25)[_0xc4f3('0x2a')](function(_0x5b5f74){_0x4a5b7d[_0xc4f3('0x21')]=_0x5b5f74;if(_0x3c1722['query']['includeAll']){_0x303b12[_0xc4f3('0x48')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0xc4f3('0x49')](_0x303b12);})['then'](function(_0x234362){_0x4a5b7d[_0xc4f3('0x4a')]=_0x234362;return _0x4a5b7d;})[_0xc4f3('0x2a')](respondWithFilteredResult(_0x1bcb2a,_0x303b12))[_0xc4f3('0x4b')](handleError(_0x1bcb2a,null));};exports[_0xc4f3('0x4c')]=function(_0x26b04b,_0x325425){var _0x1771c9={'raw':!![],'where':{'id':_0x26b04b[_0xc4f3('0x4d')]['id']}},_0x2c108f={};_0x2c108f[_0xc4f3('0x36')]=_['keys'](db[_0xc4f3('0x32')]['rawAttributes']);_0x2c108f[_0xc4f3('0x37')]=_[_0xc4f3('0x38')](_0x26b04b[_0xc4f3('0x37')]);_0x2c108f[_0xc4f3('0x4e')]=_[_0xc4f3('0x3a')](_0x2c108f[_0xc4f3('0x36')],_0x2c108f['query']);_0x1771c9[_0xc4f3('0x39')]=_[_0xc4f3('0x3a')](_0x2c108f[_0xc4f3('0x36')],qs[_0xc4f3('0x3b')](_0x26b04b[_0xc4f3('0x37')][_0xc4f3('0x3b')]));_0x1771c9[_0xc4f3('0x39')]=_0x1771c9[_0xc4f3('0x39')][_0xc4f3('0x3c')]?_0x1771c9[_0xc4f3('0x39')]:_0x2c108f[_0xc4f3('0x36')];if(_0x26b04b['query'][_0xc4f3('0x4f')]){_0x1771c9[_0xc4f3('0x48')]=[{'all':!![]}];}_0x1771c9=_[_0xc4f3('0x44')]({},_0x1771c9,_0x26b04b[_0xc4f3('0x47')]);return db['OpenchannelQueue']['find'](_0x1771c9)[_0xc4f3('0x2a')](handleEntityNotFound(_0x325425,null))[_0xc4f3('0x2a')](respondWithResult(_0x325425,null))[_0xc4f3('0x4b')](handleError(_0x325425,null));};exports['create']=function(_0xad242c,_0x4497dd){return db['OpenchannelQueue']['create'](_0xad242c[_0xc4f3('0x50')],{})[_0xc4f3('0x2a')](function(_0x1e9fa5){var _0x2c159c=_0xad242c[_0xc4f3('0x51')][_0xc4f3('0x2b')]({'plain':!![]});if(!_0x2c159c)throw new Error(_0xc4f3('0x52'));if(_0x2c159c['role']===_0xc4f3('0x51')){var _0x21ab57=_0x1e9fa5[_0xc4f3('0x2b')]({'plain':!![]});var _0x50f3ab=_0xc4f3('0x53');return db[_0xc4f3('0x54')][_0xc4f3('0x55')]({'where':{'name':_0x50f3ab,'userProfileId':_0x2c159c[_0xc4f3('0x56')]},'raw':!![]})['then'](function(_0x2c321d){if(_0x2c321d&&_0x2c321d['autoAssociation']===0x0){return db[_0xc4f3('0x2c')]['create']({'name':_0x21ab57[_0xc4f3('0x46')],'resourceId':_0x21ab57['id'],'type':_0x2c321d[_0xc4f3('0x46')],'sectionId':_0x2c321d['id']},{})[_0xc4f3('0x2a')](function(){return _0x1e9fa5;});}else{return _0x1e9fa5;}})['catch'](function(_0x149424){logger[_0xc4f3('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x149424);throw _0x149424;});}return _0x1e9fa5;})[_0xc4f3('0x2a')](respondWithResult(_0x4497dd,0xc9))[_0xc4f3('0x4b')](handleError(_0x4497dd,null));};exports['update']=function(_0x440b26,_0x46e658){if(_0x440b26[_0xc4f3('0x50')]['id']){delete _0x440b26[_0xc4f3('0x50')]['id'];}return db[_0xc4f3('0x32')][_0xc4f3('0x55')]({'where':{'id':_0x440b26[_0xc4f3('0x4d')]['id']}})['then'](handleEntityNotFound(_0x46e658,null))[_0xc4f3('0x2a')](saveUpdates(_0x440b26['body'],null))[_0xc4f3('0x2a')](respondWithResult(_0x46e658,null))['catch'](handleError(_0x46e658,null));};exports[_0xc4f3('0x2d')]=function(_0x51425b,_0xd2aa09){return db[_0xc4f3('0x32')][_0xc4f3('0x55')]({'where':{'id':_0x51425b[_0xc4f3('0x4d')]['id']}})[_0xc4f3('0x2a')](handleEntityNotFound(_0xd2aa09,null))[_0xc4f3('0x2a')](removeEntity(_0xd2aa09,null))[_0xc4f3('0x4b')](handleError(_0xd2aa09,null));};exports[_0xc4f3('0x57')]=function(_0x581a5b,_0x2dda15){return db[_0xc4f3('0x32')]['describe']()[_0xc4f3('0x2a')](respondWithResult(_0x2dda15,null))['catch'](handleError(_0x2dda15,null));};exports['getMembers']=function(_0xa2f3f5,_0x2ba4d7,_0x1987c1){var _0x1cc075={'raw':!![],'where':{}},_0xeff976={},_0x2a8233;return db[_0xc4f3('0x32')]['findOne']({'where':{'id':_0xa2f3f5[_0xc4f3('0x4d')]['id']}})[_0xc4f3('0x2a')](handleEntityNotFound(_0x2ba4d7,null))[_0xc4f3('0x2a')](function(_0x594956){if(_0x594956){_0x2a8233=_0x594956[_0xc4f3('0x2b')]({'plain':!![]});_0xeff976[_0xc4f3('0x36')]=_['keys'](db[_0xc4f3('0x58')]['rawAttributes']);_0xeff976[_0xc4f3('0x37')]=_[_0xc4f3('0x38')](_0xa2f3f5[_0xc4f3('0x37')]);_0xeff976[_0xc4f3('0x42')]=_[_0xc4f3('0x3a')](_0xeff976[_0xc4f3('0x36')],_0xeff976[_0xc4f3('0x37')]);_0x1cc075['attributes']=_['intersection'](_0xeff976[_0xc4f3('0x36')],qs[_0xc4f3('0x3b')](_0xa2f3f5[_0xc4f3('0x37')][_0xc4f3('0x3b')]));_0x1cc075['attributes']=_0x1cc075[_0xc4f3('0x39')][_0xc4f3('0x3c')]?_0x1cc075[_0xc4f3('0x39')]:_0xeff976['model'];if(!_0xa2f3f5[_0xc4f3('0x37')][_0xc4f3('0x3d')](_0xc4f3('0x3e'))){_0x1cc075['limit']=qs[_0xc4f3('0x23')](_0xa2f3f5[_0xc4f3('0x37')][_0xc4f3('0x23')]);_0x1cc075[_0xc4f3('0x22')]=qs['offset'](_0xa2f3f5['query'][_0xc4f3('0x22')]);}_0x1cc075['order']=qs['sort'](_0xa2f3f5[_0xc4f3('0x37')]['sort']);_0x1cc075[_0xc4f3('0x41')]=qs[_0xc4f3('0x42')](_[_0xc4f3('0x59')](_0xa2f3f5[_0xc4f3('0x37')],_0xeff976[_0xc4f3('0x42')]));_0x1cc075[_0xc4f3('0x41')][_0xc4f3('0x5a')]=_0x594956['id'];if(_0xa2f3f5['query'][_0xc4f3('0x43')]){_0x1cc075['where']=_['merge'](_0x1cc075[_0xc4f3('0x41')],{'$or':_[_0xc4f3('0x31')](_0x1cc075[_0xc4f3('0x39')],function(_0x4a47ac){var _0x45a388={};_0x45a388[_0x4a47ac]={'$like':'%'+_0xa2f3f5['query'][_0xc4f3('0x43')]+'%'};return _0x45a388;})});}_0x1cc075=_[_0xc4f3('0x44')]({},_0x1cc075,_0xa2f3f5['options']);return db['UserOpenchannelQueue']['findAll'](_0x1cc075);}})['then'](function(_0xf60001){if(_0xf60001){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0xf60001,_0xc4f3('0x5b')),'role':_0xc4f3('0x5c')},'attributes':['id','name',_0xc4f3('0x5d'),_0xc4f3('0x5e'),_0xc4f3('0x5f')]});}})[_0xc4f3('0x2a')](function(_0x52585b){if(_0x52585b){return{'count':_0x52585b[_0xc4f3('0x21')],'rows':_[_0xc4f3('0x31')](_0x52585b[_0xc4f3('0x4a')],function(_0x1d8fa5){return{'membername':_0x1d8fa5[_0xc4f3('0x46')],'UserId':_0x1d8fa5['id'],'queue_name':_0x2a8233[_0xc4f3('0x46')],'OpenchannelQueueId':_0x2a8233['id'],'interface':util[_0xc4f3('0x60')](_0xc4f3('0x61'),_0xc4f3('0x62'),_0x1d8fa5[_0xc4f3('0x46')]),'penalty':0x0,'paused':_0x1d8fa5[_0xc4f3('0x5d')],'createdAt':_0x1d8fa5[_0xc4f3('0x5f')],'updatedAt':_0x1d8fa5[_0xc4f3('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2ba4d7,_0x1cc075))[_0xc4f3('0x4b')](handleError(_0x2ba4d7,null));};exports[_0xc4f3('0x63')]=function(_0x355b9b,_0x139c2f,_0x5038e3){var _0x4fcd26={};var _0x181557={};var _0x27f888;var _0x4e0d3d;return db['OpenchannelQueue'][_0xc4f3('0x64')]({'where':{'id':_0x355b9b['params']['id']}})[_0xc4f3('0x2a')](handleEntityNotFound(_0x139c2f,null))['then'](function(_0x55c3e2){if(_0x55c3e2){_0x27f888=_0x55c3e2;_0x181557['model']=_[_0xc4f3('0x38')](db[_0xc4f3('0x65')]['rawAttributes']);_0x181557['query']=_[_0xc4f3('0x38')](_0x355b9b[_0xc4f3('0x37')]);_0x181557['filters']=_[_0xc4f3('0x3a')](_0x181557[_0xc4f3('0x36')],_0x181557['query']);_0x4fcd26['attributes']=_[_0xc4f3('0x3a')](_0x181557[_0xc4f3('0x36')],qs[_0xc4f3('0x3b')](_0x355b9b[_0xc4f3('0x37')][_0xc4f3('0x3b')]));_0x4fcd26[_0xc4f3('0x39')]=_0x4fcd26[_0xc4f3('0x39')]['length']?_0x4fcd26[_0xc4f3('0x39')]:_0x181557['model'];_0x4fcd26[_0xc4f3('0x3f')]=qs[_0xc4f3('0x40')](_0x355b9b[_0xc4f3('0x37')]['sort']);_0x4fcd26[_0xc4f3('0x41')]=qs[_0xc4f3('0x42')](_[_0xc4f3('0x59')](_0x355b9b[_0xc4f3('0x37')],_0x181557[_0xc4f3('0x42')]));if(_0x355b9b[_0xc4f3('0x37')][_0xc4f3('0x43')]){_0x4fcd26['where']=_[_0xc4f3('0x44')](_0x4fcd26[_0xc4f3('0x41')],{'$or':_[_0xc4f3('0x31')](_0x4fcd26[_0xc4f3('0x39')],function(_0x4944aa){var _0x45b2a7={};_0x45b2a7[_0x4944aa]={'$like':'%'+_0x355b9b[_0xc4f3('0x37')][_0xc4f3('0x43')]+'%'};return _0x45b2a7;})});}_0x4fcd26=_['merge']({},_0x4fcd26,_0x355b9b[_0xc4f3('0x47')]);return _0x27f888['getTeams'](_0x4fcd26);}})['then'](function(_0x555810){if(_0x555810){_0x4e0d3d=_0x555810[_0xc4f3('0x3c')];if(!_0x355b9b[_0xc4f3('0x37')][_0xc4f3('0x3d')](_0xc4f3('0x3e'))){_0x4fcd26['limit']=qs[_0xc4f3('0x23')](_0x355b9b[_0xc4f3('0x37')][_0xc4f3('0x23')]);_0x4fcd26[_0xc4f3('0x22')]=qs[_0xc4f3('0x22')](_0x355b9b[_0xc4f3('0x37')][_0xc4f3('0x22')]);}return _0x27f888['getTeams'](_0x4fcd26);}})[_0xc4f3('0x2a')](function(_0x3c5c2d){if(_0x3c5c2d){return _0x3c5c2d?{'count':_0x4e0d3d,'rows':_0x3c5c2d}:null;}})['then'](respondWithResult(_0x139c2f,null))['catch'](handleError(_0x139c2f,null));};exports['addTeams']=function(_0x5629df,_0xb24913,_0x341b3f){var _0x63c1bd=_0x5629df[_0xc4f3('0x50')][_0xc4f3('0x66')];return db[_0xc4f3('0x65')]['findAll']({'where':{'id':_0x63c1bd},'attributes':['id'],'include':[{'model':db[_0xc4f3('0x67')],'as':_0xc4f3('0x68'),'attributes':['id','name',_0xc4f3('0x69'),_0xc4f3('0x6a'),_0xc4f3('0x6b')],'raw':!![]}]})['then'](function(_0x3e000a){if(_0x3e000a){var _0x54ac6c=_['flatMap'](_0x3e000a,function(_0x2bf8cc){var _0x1c64b5=_0x2bf8cc['get']({'plain':!![]});return _0x1c64b5[_0xc4f3('0x68')];});return db[_0xc4f3('0x32')][_0xc4f3('0x55')]({'where':{'id':_0x5629df[_0xc4f3('0x4d')]['id']}})[_0xc4f3('0x2a')](function(_0x425b46){return db[_0xc4f3('0x6c')]['transaction'](function(_0x18311c){return _0x425b46[_0xc4f3('0x6d')](_0x63c1bd,{'transaction':_0x18311c})[_0xc4f3('0x2a')](function(){return BPromise[_0xc4f3('0x6e')](_0x54ac6c,function(_0x18d147){return db[_0xc4f3('0x58')][_0xc4f3('0x6f')]({'where':{'UserId':_0x18d147['id'],'OpenchannelQueueId':_0x5629df['params']['id']},'transaction':_0x18311c});});})[_0xc4f3('0x2a')](function(){_0x54ac6c['forEach'](function(_0x2b9c28){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x2b9c28['id'],'OpenchannelQueueId':_0x425b46['id']});});});});});}})[_0xc4f3('0x2a')](respondWithStatusCode(_0xb24913,null))[_0xc4f3('0x4b')](handleError(_0xb24913,null));};exports[_0xc4f3('0x70')]=function(_0x26b738,_0x127bb1,_0x59eb46){return db[_0xc4f3('0x65')]['findAll']({'where':{'id':_0x26b738['query'][_0xc4f3('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc4f3('0x68'),'attributes':['id'],'raw':!![]}]})[_0xc4f3('0x2a')](handleEntityNotFound(_0x127bb1,null))[_0xc4f3('0x2a')](function(_0x2d28f4){var _0x4b2008=_[_0xc4f3('0x31')](_0x2d28f4,'id');var _0x4e95e0=[];var _0x9bb390=[];var _0x42197e=squel[_0xc4f3('0x71')]();_0x42197e[_0xc4f3('0x72')](_0xc4f3('0x73'))[_0xc4f3('0x74')](_0xc4f3('0x75'),'tq')[_0xc4f3('0x76')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc4f3('0x41')](_0xc4f3('0x77'),_0x26b738[_0xc4f3('0x4d')]['id']);for(var _0x207384=0x0;_0x207384<_0x2d28f4[_0xc4f3('0x3c')];_0x207384+=0x1){let _0x5aceb7=_0x2d28f4[_0x207384];for(var _0x3ad1ef=0x0;_0x3ad1ef<_0x5aceb7[_0xc4f3('0x68')]['length'];_0x3ad1ef+=0x1){let _0x35a91f=_0x5aceb7['Agents'][_0x3ad1ef];var _0x86fe96=_0x42197e['clone']();_0x86fe96[_0xc4f3('0x41')](_0xc4f3('0x78'),_0x35a91f['id']);_0x9bb390['push'](db['sequelize'][_0xc4f3('0x37')](_0x86fe96[_0xc4f3('0x79')](),{'type':db[_0xc4f3('0x6c')][_0xc4f3('0x7a')]['SELECT']})[_0xc4f3('0x2a')](function(_0x45203f){if(_0x45203f[_0xc4f3('0x3c')]===0x1){return _0x35a91f['id'];}else{var _0x2b9e20=_[_0xc4f3('0x7b')](_[_0xc4f3('0x31')](_0x45203f,_0xc4f3('0x7c')),function(_0x433433){return _[_0xc4f3('0x7d')](_0x4b2008,_0x433433);});if(_0x2b9e20){return _0x35a91f['id'];}}}));}}return BPromise[_0xc4f3('0x7e')](_0x9bb390)['then'](function(_0xbeac01){_0x4e95e0=_(_0x4e95e0)[_0xc4f3('0x7f')](_0xbeac01)[_0xc4f3('0x80')]()[_0xc4f3('0x81')]();return db[_0xc4f3('0x32')]['find']({'where':{'id':_0x26b738['params']['id']}})[_0xc4f3('0x2a')](function(_0x13f49c){return db[_0xc4f3('0x6c')]['transaction'](function(_0x2c0c1a){return _0x13f49c[_0xc4f3('0x70')](_0x26b738[_0xc4f3('0x37')][_0xc4f3('0x66')],{'transaction':_0x2c0c1a})[_0xc4f3('0x2a')](function(){if(!_[_0xc4f3('0x82')](_0x4e95e0)){return _0x13f49c[_0xc4f3('0x83')](_0x4e95e0,{'transaction':_0x2c0c1a});}})[_0xc4f3('0x2a')](function(){_0x4e95e0[_0xc4f3('0x84')](function(_0x161f81){socket['emit'](_0xc4f3('0x85'),{'UserId':_0x161f81,'OpenchannelQueueId':_0x13f49c['id']});});});});});});})[_0xc4f3('0x2a')](respondWithStatusCode(_0x127bb1,null))['catch'](handleError(_0x127bb1,null));};exports[_0xc4f3('0x86')]=function(_0x484f69,_0xd91d28,_0x4d02d3){return db[_0xc4f3('0x32')][_0xc4f3('0x55')]({'where':{'id':_0x484f69[_0xc4f3('0x4d')]['id']}})[_0xc4f3('0x2a')](handleEntityNotFound(_0xd91d28,null))[_0xc4f3('0x2a')](function(_0x40938a){if(_0x40938a){return _0x40938a[_0xc4f3('0x86')](_0x484f69['body'][_0xc4f3('0x66')],_[_0xc4f3('0x87')](_0x484f69[_0xc4f3('0x50')],[_0xc4f3('0x66'),'id'])||{})[_0xc4f3('0x88')](function(_0x3c0d81){for(var _0x534062=0x0;_0x534062<_0x484f69[_0xc4f3('0x50')]['ids']['length'];_0x534062+=0x1){socket[_0xc4f3('0x89')](_0xc4f3('0x8a'),{'UserId':_0x484f69[_0xc4f3('0x50')][_0xc4f3('0x66')][_0x534062],'OpenchannelQueueId':_0x484f69['params']['id']});}return _0x3c0d81;});}})['then'](respondWithResult(_0xd91d28,null))['catch'](handleError(_0xd91d28,null));};exports[_0xc4f3('0x83')]=function(_0x4222d1,_0x8859ce,_0x44fd9b){return db[_0xc4f3('0x32')][_0xc4f3('0x55')]({'where':{'id':_0x4222d1[_0xc4f3('0x4d')]['id']}})['then'](handleEntityNotFound(_0x8859ce,null))[_0xc4f3('0x2a')](function(_0x248ec0){if(_0x248ec0){return _0x248ec0[_0xc4f3('0x83')](_0x4222d1[_0xc4f3('0x37')][_0xc4f3('0x66')])[_0xc4f3('0x2a')](function(){if(_['isArray'](_0x4222d1[_0xc4f3('0x37')][_0xc4f3('0x66')])){for(var _0x5899a2=0x0;_0x5899a2<_0x4222d1[_0xc4f3('0x37')][_0xc4f3('0x66')]['length'];_0x5899a2+=0x1){socket['emit'](_0xc4f3('0x85'),{'UserId':Number(_0x4222d1[_0xc4f3('0x37')]['ids'][_0x5899a2]),'OpenchannelQueueId':Number(_0x4222d1[_0xc4f3('0x4d')]['id'])});}}else{socket[_0xc4f3('0x89')](_0xc4f3('0x85'),{'UserId':Number(_0x4222d1['query'][_0xc4f3('0x66')]),'OpenchannelQueueId':Number(_0x4222d1['params']['id'])});}});}})[_0xc4f3('0x2a')](respondWithStatusCode(_0x8859ce,null))[_0xc4f3('0x4b')](handleError(_0x8859ce,null));};exports[_0xc4f3('0x8b')]=function(_0x4db4eb,_0x2e3d4f,_0x1f86d9){var _0xd741bd={};var _0x584f68={};var _0x29ccdc;var _0x9accdb;return db[_0xc4f3('0x32')]['findOne']({'where':{'id':_0x4db4eb[_0xc4f3('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2e3d4f,null))[_0xc4f3('0x2a')](function(_0xb2f4f9){if(_0xb2f4f9){_0x29ccdc=_0xb2f4f9;_0x584f68[_0xc4f3('0x36')]=_[_0xc4f3('0x38')](db[_0xc4f3('0x67')]['rawAttributes']);_0x584f68['query']=_[_0xc4f3('0x38')](_0x4db4eb[_0xc4f3('0x37')]);_0x584f68[_0xc4f3('0x42')]=_[_0xc4f3('0x3a')](_0x584f68['model'],_0x584f68['query']);_0xd741bd['attributes']=_[_0xc4f3('0x3a')](_0x584f68[_0xc4f3('0x36')],qs[_0xc4f3('0x3b')](_0x4db4eb['query'][_0xc4f3('0x3b')]));_0xd741bd[_0xc4f3('0x39')]=_0xd741bd['attributes'][_0xc4f3('0x3c')]?_0xd741bd[_0xc4f3('0x39')]:_0x584f68[_0xc4f3('0x36')];_0xd741bd['order']=qs[_0xc4f3('0x40')](_0x4db4eb[_0xc4f3('0x37')]['sort']);_0xd741bd[_0xc4f3('0x41')]=qs[_0xc4f3('0x42')](_[_0xc4f3('0x59')](_0x4db4eb[_0xc4f3('0x37')],_0x584f68[_0xc4f3('0x42')]));if(_0x4db4eb[_0xc4f3('0x37')][_0xc4f3('0x43')]){_0xd741bd[_0xc4f3('0x41')]=_[_0xc4f3('0x44')](_0xd741bd[_0xc4f3('0x41')],{'$or':_[_0xc4f3('0x31')](_0xd741bd[_0xc4f3('0x39')],function(_0x4b1221){var _0x450cd6={};_0x450cd6[_0x4b1221]={'$like':'%'+_0x4db4eb['query'][_0xc4f3('0x43')]+'%'};return _0x450cd6;})});}_0xd741bd=_[_0xc4f3('0x44')]({},_0xd741bd,_0x4db4eb[_0xc4f3('0x47')]);return _0x29ccdc[_0xc4f3('0x8b')](_0xd741bd);}})[_0xc4f3('0x2a')](function(_0x4e2cc7){if(_0x4e2cc7){_0x9accdb=_0x4e2cc7[_0xc4f3('0x3c')];if(!_0x4db4eb[_0xc4f3('0x37')][_0xc4f3('0x3d')](_0xc4f3('0x3e'))){_0xd741bd[_0xc4f3('0x23')]=qs['limit'](_0x4db4eb['query']['limit']);_0xd741bd[_0xc4f3('0x22')]=qs[_0xc4f3('0x22')](_0x4db4eb['query'][_0xc4f3('0x22')]);}return _0x29ccdc[_0xc4f3('0x8b')](_0xd741bd);}})[_0xc4f3('0x2a')](function(_0x488f5d){if(_0x488f5d){return _0x488f5d?{'count':_0x9accdb,'rows':_0x488f5d}:null;}})[_0xc4f3('0x2a')](respondWithResult(_0x2e3d4f,null))[_0xc4f3('0x4b')](handleError(_0x2e3d4f,null));}; \ No newline at end of file +var _0xa7b5=['fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','keys','filtears','find','create','body','get','role','user','UserProfileSection','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getMembers','OpenchannelQueueId','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','createdAt','format','%s/%s','openchannelPause','getTeams','findOne','order','addTeams','ids','Team','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','field','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','json','count','offset','set','Content-Range','reject','then','destroy','OpenchannelQueues','UserProfileResource','error','stack','name','OpenchannelQueue','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes'];(function(_0x5b4c14,_0x4d8a49){var _0x4108e8=function(_0x4a4f98){while(--_0x4a4f98){_0x5b4c14['push'](_0x5b4c14['shift']());}};_0x4108e8(++_0x4d8a49);}(_0xa7b5,0x162));var _0x5a7b=function(_0x3fce16,_0x108437){_0x3fce16=_0x3fce16-0x0;var _0x5c6c8f=_0xa7b5[_0x3fce16];return _0x5c6c8f;};'use strict';var pdf=require(_0x5a7b('0x0'));var emlformat=require(_0x5a7b('0x1'));var rimraf=require(_0x5a7b('0x2'));var zipdir=require(_0x5a7b('0x3'));var jsonpatch=require(_0x5a7b('0x4'));var rp=require('request-promise');var moment=require(_0x5a7b('0x5'));var BPromise=require(_0x5a7b('0x6'));var Mustache=require(_0x5a7b('0x7'));var util=require('util');var path=require('path');var sox=require(_0x5a7b('0x8'));var csv=require(_0x5a7b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5a7b('0xa'));var squel=require(_0x5a7b('0xb'));var crypto=require(_0x5a7b('0xc'));var jsforce=require(_0x5a7b('0xd'));var deskjs=require(_0x5a7b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5a7b('0xf'));var Papa=require('papaparse');var Redis=require(_0x5a7b('0x10'));var authService=require(_0x5a7b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5a7b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a7b('0x13'))(_0x5a7b('0x14'));var utils=require(_0x5a7b('0x15'));var config=require(_0x5a7b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5a7b('0x17')]=_['defaults'](config['redis'],{'host':_0x5a7b('0x18'),'port':0x18eb});var socket=require(_0x5a7b('0x19'))(new Redis(config['redis']));require(_0x5a7b('0x1a'))[_0x5a7b('0x1b')](socket);function respondWithStatusCode(_0x359e6a,_0x5a58e8){_0x5a58e8=_0x5a58e8||0xcc;return function(_0x5081){if(_0x5081){return _0x359e6a[_0x5a7b('0x1c')](_0x5a58e8);}return _0x359e6a['status'](_0x5a58e8)[_0x5a7b('0x1d')]();};}function respondWithResult(_0x4ce3d8,_0x1fde20){_0x1fde20=_0x1fde20||0xc8;return function(_0x5039dc){if(_0x5039dc){return _0x4ce3d8[_0x5a7b('0x1e')](_0x1fde20)[_0x5a7b('0x1f')](_0x5039dc);}};}function respondWithFilteredResult(_0x237b91,_0x4eaa47){return function(_0xe59f65){if(_0xe59f65){var _0x2dd166=_0xe59f65[_0x5a7b('0x20')],_0x466758=_0x4eaa47['offset'],_0x47ce0f=_0x4eaa47[_0x5a7b('0x21')]+_0x4eaa47['limit'],_0x492eb9;if(_0x47ce0f>=_0x2dd166){_0x47ce0f=_0x2dd166;_0x492eb9=0xc8;}else{_0x492eb9=0xce;}_0x237b91[_0x5a7b('0x1e')](_0x492eb9);return _0x237b91[_0x5a7b('0x22')](_0x5a7b('0x23'),_0x466758+'-'+_0x47ce0f+'/'+_0x2dd166)['json'](_0xe59f65);}return null;};}function patchUpdates(_0x385cd1){return function(_0x458511){try{jsonpatch['apply'](_0x458511,_0x385cd1,!![]);}catch(_0x178cd2){return BPromise[_0x5a7b('0x24')](_0x178cd2);}return _0x458511['save']();};}function saveUpdates(_0x3298ed,_0x247723){return function(_0x52c3a9){if(_0x52c3a9){return _0x52c3a9['update'](_0x3298ed)[_0x5a7b('0x25')](function(_0x32cc44){return _0x32cc44;});}return null;};}function removeEntity(_0x54d4f8,_0x266d2f){return function(_0x88d248){if(_0x88d248){return _0x88d248[_0x5a7b('0x26')]()[_0x5a7b('0x25')](function(){var _0x4f204d=_0x88d248['get']({'plain':!![]});var _0x30d4be=_0x5a7b('0x27');return db[_0x5a7b('0x28')][_0x5a7b('0x26')]({'where':{'type':_0x30d4be,'resourceId':_0x4f204d['id']}})[_0x5a7b('0x25')](function(){return _0x88d248;});})[_0x5a7b('0x25')](function(){_0x54d4f8['status'](0xcc)[_0x5a7b('0x1d')]();});}};}function handleEntityNotFound(_0x3531cf,_0x3d505f){return function(_0x10f937){if(!_0x10f937){_0x3531cf['sendStatus'](0x194);}return _0x10f937;};}function handleError(_0xb0ce2b,_0x1147c0){_0x1147c0=_0x1147c0||0x1f4;return function(_0xe1de2a){logger[_0x5a7b('0x29')](_0xe1de2a[_0x5a7b('0x2a')]);if(_0xe1de2a['name']){delete _0xe1de2a[_0x5a7b('0x2b')];}_0xb0ce2b['status'](_0x1147c0)['send'](_0xe1de2a);};}exports['index']=function(_0x5adf16,_0x1f1622){var _0x42f901={},_0x564afa={},_0x56faae={'count':0x0,'rows':[]};var _0x3d7400=_['map'](db[_0x5a7b('0x2c')][_0x5a7b('0x2d')],function(_0x53ecc6){return{'name':_0x53ecc6[_0x5a7b('0x2e')],'type':_0x53ecc6[_0x5a7b('0x2f')][_0x5a7b('0x30')]};});_0x564afa[_0x5a7b('0x31')]=_[_0x5a7b('0x32')](_0x3d7400,'name');_0x564afa[_0x5a7b('0x33')]=_['keys'](_0x5adf16[_0x5a7b('0x33')]);_0x564afa['filters']=_[_0x5a7b('0x34')](_0x564afa['model'],_0x564afa[_0x5a7b('0x33')]);_0x42f901[_0x5a7b('0x35')]=_[_0x5a7b('0x34')](_0x564afa[_0x5a7b('0x31')],qs[_0x5a7b('0x36')](_0x5adf16[_0x5a7b('0x33')]['fields']));_0x42f901[_0x5a7b('0x35')]=_0x42f901[_0x5a7b('0x35')][_0x5a7b('0x37')]?_0x42f901['attributes']:_0x564afa[_0x5a7b('0x31')];if(!_0x5adf16['query'][_0x5a7b('0x38')](_0x5a7b('0x39'))){_0x42f901[_0x5a7b('0x3a')]=qs[_0x5a7b('0x3a')](_0x5adf16[_0x5a7b('0x33')][_0x5a7b('0x3a')]);_0x42f901[_0x5a7b('0x21')]=qs[_0x5a7b('0x21')](_0x5adf16[_0x5a7b('0x33')][_0x5a7b('0x21')]);}_0x42f901['order']=qs[_0x5a7b('0x3b')](_0x5adf16[_0x5a7b('0x33')][_0x5a7b('0x3b')]);_0x42f901[_0x5a7b('0x3c')]=qs['filters'](_[_0x5a7b('0x3d')](_0x5adf16['query'],_0x564afa[_0x5a7b('0x3e')]),_0x3d7400);if(_0x5adf16[_0x5a7b('0x33')]['filter']){_0x42f901['where']=_[_0x5a7b('0x3f')](_0x42f901['where'],{'$or':_[_0x5a7b('0x32')](_0x3d7400,function(_0x1b1b8a){if(_0x1b1b8a[_0x5a7b('0x2f')]!==_0x5a7b('0x40')){var _0x18800b={};_0x18800b[_0x1b1b8a['name']]={'$like':'%'+_0x5adf16['query'][_0x5a7b('0x41')]+'%'};return _0x18800b;}})});}_0x42f901=_[_0x5a7b('0x3f')]({},_0x42f901,_0x5adf16[_0x5a7b('0x42')]);var _0x3ac3bc={'where':_0x42f901[_0x5a7b('0x3c')]};return db['OpenchannelQueue'][_0x5a7b('0x20')](_0x3ac3bc)['then'](function(_0x505f8e){_0x56faae[_0x5a7b('0x20')]=_0x505f8e;if(_0x5adf16[_0x5a7b('0x33')][_0x5a7b('0x43')]){_0x42f901[_0x5a7b('0x44')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x5a7b('0x45')](_0x42f901);})[_0x5a7b('0x25')](function(_0x2a8516){_0x56faae[_0x5a7b('0x46')]=_0x2a8516;return _0x56faae;})['then'](respondWithFilteredResult(_0x1f1622,_0x42f901))['catch'](handleError(_0x1f1622,null));};exports[_0x5a7b('0x47')]=function(_0xbc6641,_0x5cee3b){var _0x2eceb7={'raw':!![],'where':{'id':_0xbc6641['params']['id']}},_0x26fa70={};_0x26fa70[_0x5a7b('0x31')]=_[_0x5a7b('0x48')](db['OpenchannelQueue'][_0x5a7b('0x2d')]);_0x26fa70['query']=_[_0x5a7b('0x48')](_0xbc6641[_0x5a7b('0x33')]);_0x26fa70[_0x5a7b('0x49')]=_['intersection'](_0x26fa70['model'],_0x26fa70['query']);_0x2eceb7['attributes']=_['intersection'](_0x26fa70['model'],qs[_0x5a7b('0x36')](_0xbc6641[_0x5a7b('0x33')][_0x5a7b('0x36')]));_0x2eceb7[_0x5a7b('0x35')]=_0x2eceb7[_0x5a7b('0x35')]['length']?_0x2eceb7[_0x5a7b('0x35')]:_0x26fa70[_0x5a7b('0x31')];if(_0xbc6641[_0x5a7b('0x33')][_0x5a7b('0x43')]){_0x2eceb7[_0x5a7b('0x44')]=[{'all':!![]}];}_0x2eceb7=_[_0x5a7b('0x3f')]({},_0x2eceb7,_0xbc6641[_0x5a7b('0x42')]);return db['OpenchannelQueue'][_0x5a7b('0x4a')](_0x2eceb7)[_0x5a7b('0x25')](handleEntityNotFound(_0x5cee3b,null))[_0x5a7b('0x25')](respondWithResult(_0x5cee3b,null))['catch'](handleError(_0x5cee3b,null));};exports[_0x5a7b('0x4b')]=function(_0x324ab3,_0x5361ee){return db['OpenchannelQueue']['create'](_0x324ab3[_0x5a7b('0x4c')],{})[_0x5a7b('0x25')](function(_0x390ff0){var _0x57d6c6=_0x324ab3['user'][_0x5a7b('0x4d')]({'plain':!![]});if(!_0x57d6c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57d6c6[_0x5a7b('0x4e')]===_0x5a7b('0x4f')){var _0x375155=_0x390ff0[_0x5a7b('0x4d')]({'plain':!![]});var _0x7837fd=_0x5a7b('0x27');return db[_0x5a7b('0x50')][_0x5a7b('0x4a')]({'where':{'name':_0x7837fd,'userProfileId':_0x57d6c6['userProfileId']},'raw':!![]})[_0x5a7b('0x25')](function(_0x837524){if(_0x837524&&_0x837524['autoAssociation']===0x0){return db[_0x5a7b('0x28')][_0x5a7b('0x4b')]({'name':_0x375155[_0x5a7b('0x2b')],'resourceId':_0x375155['id'],'type':_0x837524['name'],'sectionId':_0x837524['id']},{})[_0x5a7b('0x25')](function(){return _0x390ff0;});}else{return _0x390ff0;}})[_0x5a7b('0x51')](function(_0x5960cc){logger[_0x5a7b('0x29')](_0x5a7b('0x52'),_0x5960cc);throw _0x5960cc;});}return _0x390ff0;})['then'](respondWithResult(_0x5361ee,0xc9))['catch'](handleError(_0x5361ee,null));};exports[_0x5a7b('0x53')]=function(_0x3c3571,_0x2d4218){if(_0x3c3571['body']['id']){delete _0x3c3571[_0x5a7b('0x4c')]['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x3c3571['params']['id']}})['then'](handleEntityNotFound(_0x2d4218,null))[_0x5a7b('0x25')](saveUpdates(_0x3c3571[_0x5a7b('0x4c')],null))['then'](respondWithResult(_0x2d4218,null))[_0x5a7b('0x51')](handleError(_0x2d4218,null));};exports[_0x5a7b('0x26')]=function(_0x1b1b1f,_0x5b1441){return db['OpenchannelQueue']['find']({'where':{'id':_0x1b1b1f[_0x5a7b('0x54')]['id']}})[_0x5a7b('0x25')](handleEntityNotFound(_0x5b1441,null))['then'](removeEntity(_0x5b1441,null))[_0x5a7b('0x51')](handleError(_0x5b1441,null));};exports['describe']=function(_0x16391f,_0x1bd112){return db['OpenchannelQueue']['describe']()[_0x5a7b('0x25')](respondWithResult(_0x1bd112,null))[_0x5a7b('0x51')](handleError(_0x1bd112,null));};exports[_0x5a7b('0x55')]=function(_0x46aa17,_0x71bc6c,_0x5ab3a7){var _0x33e11e={'raw':!![],'where':{}},_0x2f1962={},_0xe44a84;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x46aa17[_0x5a7b('0x54')]['id']}})[_0x5a7b('0x25')](handleEntityNotFound(_0x71bc6c,null))['then'](function(_0x59da48){if(_0x59da48){_0xe44a84=_0x59da48[_0x5a7b('0x4d')]({'plain':!![]});_0x2f1962[_0x5a7b('0x31')]=_[_0x5a7b('0x48')](db['UserOpenchannelQueue']['rawAttributes']);_0x2f1962[_0x5a7b('0x33')]=_[_0x5a7b('0x48')](_0x46aa17['query']);_0x2f1962['filters']=_['intersection'](_0x2f1962[_0x5a7b('0x31')],_0x2f1962['query']);_0x33e11e['attributes']=_[_0x5a7b('0x34')](_0x2f1962[_0x5a7b('0x31')],qs[_0x5a7b('0x36')](_0x46aa17['query'][_0x5a7b('0x36')]));_0x33e11e[_0x5a7b('0x35')]=_0x33e11e['attributes'][_0x5a7b('0x37')]?_0x33e11e['attributes']:_0x2f1962[_0x5a7b('0x31')];if(!_0x46aa17['query'][_0x5a7b('0x38')](_0x5a7b('0x39'))){_0x33e11e[_0x5a7b('0x3a')]=qs[_0x5a7b('0x3a')](_0x46aa17['query']['limit']);_0x33e11e['offset']=qs[_0x5a7b('0x21')](_0x46aa17[_0x5a7b('0x33')][_0x5a7b('0x21')]);}_0x33e11e['order']=qs[_0x5a7b('0x3b')](_0x46aa17[_0x5a7b('0x33')][_0x5a7b('0x3b')]);_0x33e11e['where']=qs[_0x5a7b('0x3e')](_[_0x5a7b('0x3d')](_0x46aa17['query'],_0x2f1962[_0x5a7b('0x3e')]));_0x33e11e[_0x5a7b('0x3c')][_0x5a7b('0x56')]=_0x59da48['id'];if(_0x46aa17['query'][_0x5a7b('0x41')]){_0x33e11e[_0x5a7b('0x3c')]=_[_0x5a7b('0x3f')](_0x33e11e[_0x5a7b('0x3c')],{'$or':_[_0x5a7b('0x32')](_0x33e11e[_0x5a7b('0x35')],function(_0x48b922){var _0x10beab={};_0x10beab[_0x48b922]={'$like':'%'+_0x46aa17[_0x5a7b('0x33')][_0x5a7b('0x41')]+'%'};return _0x10beab;})});}_0x33e11e=_['merge']({},_0x33e11e,_0x46aa17['options']);return db[_0x5a7b('0x57')][_0x5a7b('0x45')](_0x33e11e);}})[_0x5a7b('0x25')](function(_0x17a656){if(_0x17a656){return db[_0x5a7b('0x58')][_0x5a7b('0x59')]({'where':{'id':_[_0x5a7b('0x32')](_0x17a656,_0x5a7b('0x5a')),'role':_0x5a7b('0x5b')},'attributes':['id',_0x5a7b('0x2b'),'openchannelPause','updatedAt',_0x5a7b('0x5c')]});}})['then'](function(_0x1c1752){if(_0x1c1752){return{'count':_0x1c1752[_0x5a7b('0x20')],'rows':_[_0x5a7b('0x32')](_0x1c1752[_0x5a7b('0x46')],function(_0x24f2c1){return{'membername':_0x24f2c1[_0x5a7b('0x2b')],'UserId':_0x24f2c1['id'],'queue_name':_0xe44a84['name'],'OpenchannelQueueId':_0xe44a84['id'],'interface':util[_0x5a7b('0x5d')](_0x5a7b('0x5e'),'SIP',_0x24f2c1[_0x5a7b('0x2b')]),'penalty':0x0,'paused':_0x24f2c1[_0x5a7b('0x5f')],'createdAt':_0x24f2c1[_0x5a7b('0x5c')],'updatedAt':_0x24f2c1['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x71bc6c,_0x33e11e))['catch'](handleError(_0x71bc6c,null));};exports[_0x5a7b('0x60')]=function(_0x527515,_0x408105,_0x329923){var _0x5098c7={};var _0x49780f={};var _0x3eb8a6;var _0xe9017a;return db[_0x5a7b('0x2c')][_0x5a7b('0x61')]({'where':{'id':_0x527515[_0x5a7b('0x54')]['id']}})[_0x5a7b('0x25')](handleEntityNotFound(_0x408105,null))[_0x5a7b('0x25')](function(_0x456222){if(_0x456222){_0x3eb8a6=_0x456222;_0x49780f[_0x5a7b('0x31')]=_[_0x5a7b('0x48')](db['Team'][_0x5a7b('0x2d')]);_0x49780f[_0x5a7b('0x33')]=_['keys'](_0x527515[_0x5a7b('0x33')]);_0x49780f[_0x5a7b('0x3e')]=_[_0x5a7b('0x34')](_0x49780f[_0x5a7b('0x31')],_0x49780f[_0x5a7b('0x33')]);_0x5098c7[_0x5a7b('0x35')]=_[_0x5a7b('0x34')](_0x49780f['model'],qs[_0x5a7b('0x36')](_0x527515[_0x5a7b('0x33')]['fields']));_0x5098c7['attributes']=_0x5098c7['attributes'][_0x5a7b('0x37')]?_0x5098c7['attributes']:_0x49780f[_0x5a7b('0x31')];_0x5098c7[_0x5a7b('0x62')]=qs['sort'](_0x527515[_0x5a7b('0x33')]['sort']);_0x5098c7[_0x5a7b('0x3c')]=qs[_0x5a7b('0x3e')](_[_0x5a7b('0x3d')](_0x527515[_0x5a7b('0x33')],_0x49780f[_0x5a7b('0x3e')]));if(_0x527515['query']['filter']){_0x5098c7[_0x5a7b('0x3c')]=_[_0x5a7b('0x3f')](_0x5098c7[_0x5a7b('0x3c')],{'$or':_[_0x5a7b('0x32')](_0x5098c7[_0x5a7b('0x35')],function(_0x9c8a9){var _0x24a9df={};_0x24a9df[_0x9c8a9]={'$like':'%'+_0x527515['query'][_0x5a7b('0x41')]+'%'};return _0x24a9df;})});}_0x5098c7=_[_0x5a7b('0x3f')]({},_0x5098c7,_0x527515[_0x5a7b('0x42')]);return _0x3eb8a6[_0x5a7b('0x60')](_0x5098c7);}})[_0x5a7b('0x25')](function(_0x4e6998){if(_0x4e6998){_0xe9017a=_0x4e6998[_0x5a7b('0x37')];if(!_0x527515[_0x5a7b('0x33')][_0x5a7b('0x38')](_0x5a7b('0x39'))){_0x5098c7[_0x5a7b('0x3a')]=qs[_0x5a7b('0x3a')](_0x527515['query'][_0x5a7b('0x3a')]);_0x5098c7[_0x5a7b('0x21')]=qs['offset'](_0x527515['query']['offset']);}return _0x3eb8a6[_0x5a7b('0x60')](_0x5098c7);}})[_0x5a7b('0x25')](function(_0x392ce5){if(_0x392ce5){return _0x392ce5?{'count':_0xe9017a,'rows':_0x392ce5}:null;}})['then'](respondWithResult(_0x408105,null))[_0x5a7b('0x51')](handleError(_0x408105,null));};exports[_0x5a7b('0x63')]=function(_0x506f27,_0x25d132,_0x57fb1f){var _0xaf82e2=_0x506f27['body'][_0x5a7b('0x64')];return db[_0x5a7b('0x65')][_0x5a7b('0x45')]({'where':{'id':_0xaf82e2},'attributes':['id'],'include':[{'model':db[_0x5a7b('0x58')],'as':'Agents','attributes':['id',_0x5a7b('0x2b'),'online','voicePause',_0x5a7b('0x66')],'raw':!![]}]})[_0x5a7b('0x25')](function(_0x1fea34){if(_0x1fea34){var _0x357f76=_[_0x5a7b('0x67')](_0x1fea34,function(_0x3fe1fe){var _0x390b2a=_0x3fe1fe[_0x5a7b('0x4d')]({'plain':!![]});return _0x390b2a[_0x5a7b('0x68')];});return db['OpenchannelQueue'][_0x5a7b('0x4a')]({'where':{'id':_0x506f27['params']['id']}})['then'](function(_0x1936c4){return db[_0x5a7b('0x69')][_0x5a7b('0x6a')](function(_0x252dcb){return _0x1936c4[_0x5a7b('0x63')](_0xaf82e2,{'transaction':_0x252dcb})[_0x5a7b('0x25')](function(){return BPromise[_0x5a7b('0x6b')](_0x357f76,function(_0x27b87f){return db[_0x5a7b('0x57')][_0x5a7b('0x6c')]({'where':{'UserId':_0x27b87f['id'],'OpenchannelQueueId':_0x506f27[_0x5a7b('0x54')]['id']},'transaction':_0x252dcb});});})['then'](function(){_0x357f76[_0x5a7b('0x6d')](function(_0x209cab){socket['emit'](_0x5a7b('0x6e'),{'UserId':_0x209cab['id'],'OpenchannelQueueId':_0x1936c4['id']});});});});});}})[_0x5a7b('0x25')](respondWithStatusCode(_0x25d132,null))[_0x5a7b('0x51')](handleError(_0x25d132,null));};exports[_0x5a7b('0x6f')]=function(_0x4ee048,_0xd8127d,_0xa23ae6){return db[_0x5a7b('0x65')]['findAll']({'where':{'id':_0x4ee048[_0x5a7b('0x33')][_0x5a7b('0x64')]},'attributes':['id'],'include':[{'model':db[_0x5a7b('0x58')],'as':_0x5a7b('0x68'),'attributes':['id'],'raw':!![]}]})[_0x5a7b('0x25')](handleEntityNotFound(_0xd8127d,null))[_0x5a7b('0x25')](function(_0x464f8c){var _0x4d18ef=_['map'](_0x464f8c,'id');var _0x146764=[];var _0xb320e0=[];var _0x51f4a2=squel['select']();_0x51f4a2[_0x5a7b('0x70')]('tq.TeamId')[_0x5a7b('0x71')](_0x5a7b('0x72'),'tq')[_0x5a7b('0x73')]('user_has_teams','ut',_0x5a7b('0x74'))[_0x5a7b('0x3c')](_0x5a7b('0x75'),_0x4ee048[_0x5a7b('0x54')]['id']);for(var _0x3894a2=0x0;_0x3894a2<_0x464f8c[_0x5a7b('0x37')];_0x3894a2+=0x1){let _0x57cfec=_0x464f8c[_0x3894a2];for(var _0x4ae9f6=0x0;_0x4ae9f6<_0x57cfec[_0x5a7b('0x68')][_0x5a7b('0x37')];_0x4ae9f6+=0x1){let _0x7855d6=_0x57cfec[_0x5a7b('0x68')][_0x4ae9f6];var _0x38b086=_0x51f4a2[_0x5a7b('0x76')]();_0x38b086['where']('ut.UserId\x20=\x20?',_0x7855d6['id']);_0xb320e0[_0x5a7b('0x77')](db[_0x5a7b('0x69')]['query'](_0x38b086['toString'](),{'type':db[_0x5a7b('0x69')][_0x5a7b('0x78')][_0x5a7b('0x79')]})['then'](function(_0x13ec67){if(_0x13ec67['length']===0x1){return _0x7855d6['id'];}else{var _0x123903=_[_0x5a7b('0x7a')](_['map'](_0x13ec67,'TeamId'),function(_0xbf0223){return _[_0x5a7b('0x7b')](_0x4d18ef,_0xbf0223);});if(_0x123903){return _0x7855d6['id'];}}}));}}return BPromise[_0x5a7b('0x7c')](_0xb320e0)[_0x5a7b('0x25')](function(_0x20dadd){_0x146764=_(_0x146764)[_0x5a7b('0x7d')](_0x20dadd)[_0x5a7b('0x7e')]()[_0x5a7b('0x7f')]();return db[_0x5a7b('0x2c')][_0x5a7b('0x4a')]({'where':{'id':_0x4ee048[_0x5a7b('0x54')]['id']}})[_0x5a7b('0x25')](function(_0x2bf33c){return db['sequelize'][_0x5a7b('0x6a')](function(_0x341b6d){return _0x2bf33c[_0x5a7b('0x6f')](_0x4ee048[_0x5a7b('0x33')][_0x5a7b('0x64')],{'transaction':_0x341b6d})[_0x5a7b('0x25')](function(){if(!_[_0x5a7b('0x80')](_0x146764)){return _0x2bf33c[_0x5a7b('0x81')](_0x146764,{'transaction':_0x341b6d});}})['then'](function(){_0x146764['forEach'](function(_0x4596f8){socket[_0x5a7b('0x82')](_0x5a7b('0x83'),{'UserId':_0x4596f8,'OpenchannelQueueId':_0x2bf33c['id']});});});});});});})['then'](respondWithStatusCode(_0xd8127d,null))[_0x5a7b('0x51')](handleError(_0xd8127d,null));};exports[_0x5a7b('0x84')]=function(_0x473d63,_0x30565c,_0x883727){return db[_0x5a7b('0x2c')]['find']({'where':{'id':_0x473d63[_0x5a7b('0x54')]['id']}})[_0x5a7b('0x25')](handleEntityNotFound(_0x30565c,null))[_0x5a7b('0x25')](function(_0x466f21){if(_0x466f21){return _0x466f21['addAgents'](_0x473d63[_0x5a7b('0x4c')][_0x5a7b('0x64')],_['omit'](_0x473d63[_0x5a7b('0x4c')],[_0x5a7b('0x64'),'id'])||{})[_0x5a7b('0x85')](function(_0x426cc2){for(var _0x964caf=0x0;_0x964caf<_0x473d63[_0x5a7b('0x4c')][_0x5a7b('0x64')][_0x5a7b('0x37')];_0x964caf+=0x1){socket[_0x5a7b('0x82')]('userOpenchannelQueue:save',{'UserId':_0x473d63[_0x5a7b('0x4c')][_0x5a7b('0x64')][_0x964caf],'OpenchannelQueueId':_0x473d63[_0x5a7b('0x54')]['id']});}return _0x426cc2;});}})[_0x5a7b('0x25')](respondWithResult(_0x30565c,null))[_0x5a7b('0x51')](handleError(_0x30565c,null));};exports[_0x5a7b('0x81')]=function(_0x442fe5,_0x5157af,_0x4b6634){return db[_0x5a7b('0x2c')][_0x5a7b('0x4a')]({'where':{'id':_0x442fe5[_0x5a7b('0x54')]['id']}})[_0x5a7b('0x25')](handleEntityNotFound(_0x5157af,null))['then'](function(_0x12762a){if(_0x12762a){return _0x12762a[_0x5a7b('0x81')](_0x442fe5[_0x5a7b('0x33')]['ids'])[_0x5a7b('0x25')](function(){if(_[_0x5a7b('0x86')](_0x442fe5[_0x5a7b('0x33')]['ids'])){for(var _0x244318=0x0;_0x244318<_0x442fe5['query'][_0x5a7b('0x64')][_0x5a7b('0x37')];_0x244318+=0x1){socket[_0x5a7b('0x82')](_0x5a7b('0x83'),{'UserId':Number(_0x442fe5[_0x5a7b('0x33')]['ids'][_0x244318]),'OpenchannelQueueId':Number(_0x442fe5[_0x5a7b('0x54')]['id'])});}}else{socket[_0x5a7b('0x82')]('userOpenchannelQueue:remove',{'UserId':Number(_0x442fe5[_0x5a7b('0x33')][_0x5a7b('0x64')]),'OpenchannelQueueId':Number(_0x442fe5[_0x5a7b('0x54')]['id'])});}});}})[_0x5a7b('0x25')](respondWithStatusCode(_0x5157af,null))[_0x5a7b('0x51')](handleError(_0x5157af,null));};exports[_0x5a7b('0x87')]=function(_0x137dc1,_0x124239,_0x3ac915){var _0x2b1475={};var _0x3f2169={};var _0x5cc9b1;var _0x339458;return db[_0x5a7b('0x2c')][_0x5a7b('0x61')]({'where':{'id':_0x137dc1[_0x5a7b('0x54')]['id']}})[_0x5a7b('0x25')](handleEntityNotFound(_0x124239,null))[_0x5a7b('0x25')](function(_0x72845b){if(_0x72845b){_0x5cc9b1=_0x72845b;_0x3f2169['model']=_['keys'](db[_0x5a7b('0x58')]['rawAttributes']);_0x3f2169[_0x5a7b('0x33')]=_[_0x5a7b('0x48')](_0x137dc1[_0x5a7b('0x33')]);_0x3f2169[_0x5a7b('0x3e')]=_[_0x5a7b('0x34')](_0x3f2169['model'],_0x3f2169[_0x5a7b('0x33')]);_0x2b1475[_0x5a7b('0x35')]=_[_0x5a7b('0x34')](_0x3f2169[_0x5a7b('0x31')],qs['fields'](_0x137dc1[_0x5a7b('0x33')]['fields']));_0x2b1475[_0x5a7b('0x35')]=_0x2b1475[_0x5a7b('0x35')][_0x5a7b('0x37')]?_0x2b1475[_0x5a7b('0x35')]:_0x3f2169['model'];_0x2b1475[_0x5a7b('0x62')]=qs[_0x5a7b('0x3b')](_0x137dc1[_0x5a7b('0x33')][_0x5a7b('0x3b')]);_0x2b1475[_0x5a7b('0x3c')]=qs[_0x5a7b('0x3e')](_[_0x5a7b('0x3d')](_0x137dc1[_0x5a7b('0x33')],_0x3f2169[_0x5a7b('0x3e')]));if(_0x137dc1[_0x5a7b('0x33')][_0x5a7b('0x41')]){_0x2b1475['where']=_[_0x5a7b('0x3f')](_0x2b1475[_0x5a7b('0x3c')],{'$or':_['map'](_0x2b1475[_0x5a7b('0x35')],function(_0x3c869b){var _0x3b3365={};_0x3b3365[_0x3c869b]={'$like':'%'+_0x137dc1[_0x5a7b('0x33')][_0x5a7b('0x41')]+'%'};return _0x3b3365;})});}_0x2b1475=_[_0x5a7b('0x3f')]({},_0x2b1475,_0x137dc1[_0x5a7b('0x42')]);return _0x5cc9b1[_0x5a7b('0x87')](_0x2b1475);}})['then'](function(_0x1cbf4f){if(_0x1cbf4f){_0x339458=_0x1cbf4f['length'];if(!_0x137dc1[_0x5a7b('0x33')]['hasOwnProperty'](_0x5a7b('0x39'))){_0x2b1475[_0x5a7b('0x3a')]=qs['limit'](_0x137dc1[_0x5a7b('0x33')][_0x5a7b('0x3a')]);_0x2b1475[_0x5a7b('0x21')]=qs['offset'](_0x137dc1[_0x5a7b('0x33')][_0x5a7b('0x21')]);}return _0x5cc9b1[_0x5a7b('0x87')](_0x2b1475);}})[_0x5a7b('0x25')](function(_0x3805e3){if(_0x3805e3){return _0x3805e3?{'count':_0x339458,'rows':_0x3805e3}:null;}})[_0x5a7b('0x25')](respondWithResult(_0x124239,null))['catch'](handleError(_0x124239,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 7bb3598..ed36481 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 _0xf2c1=['exports','events','../../mysqldb','save','update','remove','hasOwnProperty','hook'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0xf2c1,0x99));var _0x1f2c=function(_0xc513b5,_0x165cc8){_0xc513b5=_0xc513b5-0x0;var _0x535d24=_0xf2c1[_0xc513b5];return _0x535d24;};'use strict';var EventEmitter=require(_0x1f2c('0x0'));var OpenchannelQueue=require(_0x1f2c('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1f2c('0x2'),'afterUpdate':_0x1f2c('0x3'),'afterDestroy':_0x1f2c('0x4')};function emitEvent(_0x3242a0){return function(_0x4ec0fa,_0x20bf28,_0x452b0a){OpenchannelQueueEvents['emit'](_0x3242a0+':'+_0x4ec0fa['id'],_0x4ec0fa);OpenchannelQueueEvents['emit'](_0x3242a0,_0x4ec0fa);_0x452b0a(null);};}for(var e in events){if(events[_0x1f2c('0x5')](e)){var event=events[e];OpenchannelQueue[_0x1f2c('0x6')](e,emitEvent(event));}}module[_0x1f2c('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xde6d=['../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','hasOwnProperty','hook','exports'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xde6d,0x78));var _0xdde6=function(_0x5d17df,_0x25d404){_0x5d17df=_0x5d17df-0x0;var _0x3683b9=_0xde6d[_0x5d17df];return _0x3683b9;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xdde6('0x0'))['db'][_0xdde6('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xdde6('0x2')](0x0);var events={'afterCreate':_0xdde6('0x3'),'afterUpdate':_0xdde6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x51d7bd){return function(_0x1fe8f4,_0x894f9a,_0x382988){OpenchannelQueueEvents['emit'](_0x51d7bd+':'+_0x1fe8f4['id'],_0x1fe8f4);OpenchannelQueueEvents['emit'](_0x51d7bd,_0x1fe8f4);_0x382988(null);};}for(var e in events){if(events[_0xdde6('0x5')](e)){var event=events[e];OpenchannelQueue[_0xdde6('0x6')](e,emitEvent(event));}}module[_0xdde6('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 54fa1e2..b58ef51 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 _0xf248=['./openchannelQueue.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4e8234,_0x5cd831){var _0x4b4715=function(_0x51f597){while(--_0x51f597){_0x4e8234['push'](_0x4e8234['shift']());}};_0x4b4715(++_0x5cd831);}(_0xf248,0xfc));var _0x8f24=function(_0x183ce5,_0x1de949){_0x183ce5=_0x183ce5-0x0;var _0x35b371=_0xf248[_0x183ce5];return _0x35b371;};'use strict';var _=require(_0x8f24('0x0'));var util=require(_0x8f24('0x1'));var logger=require(_0x8f24('0x2'))(_0x8f24('0x3'));var moment=require(_0x8f24('0x4'));var BPromise=require(_0x8f24('0x5'));var rp=require(_0x8f24('0x6'));var fs=require('fs');var path=require(_0x8f24('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8f24('0x8'));module['exports']=function(_0x4696ea,_0x1236fe){return _0x4696ea[_0x8f24('0x9')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b8f=['../../config/environment','./openchannelQueue.attributes','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x332c13,_0x18e04a){var _0x501f25=function(_0x9c71fc){while(--_0x9c71fc){_0x332c13['push'](_0x332c13['shift']());}};_0x501f25(++_0x18e04a);}(_0x6b8f,0x1d6));var _0xf6b8=function(_0x4f2d1f,_0x4a6152){_0x4f2d1f=_0x4f2d1f-0x0;var _0x3dd244=_0x6b8f[_0x4f2d1f];return _0x3dd244;};'use strict';var _=require(_0xf6b8('0x0'));var util=require(_0xf6b8('0x1'));var logger=require(_0xf6b8('0x2'))('api');var moment=require(_0xf6b8('0x3'));var BPromise=require(_0xf6b8('0x4'));var rp=require(_0xf6b8('0x5'));var fs=require('fs');var path=require(_0xf6b8('0x6'));var rimraf=require('rimraf');var config=require(_0xf6b8('0x7'));var attributes=require(_0xf6b8('0x8'));module['exports']=function(_0x5f5199,_0x1ece4c){return _0x5f5199['define']('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','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 e4e4cec..133d8a9 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 _0x1672=['attributes','map','ShowOpenchannelQueue','OpenchannelQueue','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./openchannelQueue.socket','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetOpenchannelQueue','findAll','options','raw','where','include','model'];(function(_0x49f30e,_0xf28439){var _0x2cafd5=function(_0x581d4c){while(--_0x581d4c){_0x49f30e['push'](_0x49f30e['shift']());}};_0x2cafd5(++_0xf28439);}(_0x1672,0x1c0));var _0x2167=function(_0x1676ef,_0x5b3930){_0x1676ef=_0x1676ef-0x0;var _0x1ab971=_0x1672[_0x1676ef];return _0x1ab971;};'use strict';var _=require(_0x2167('0x0'));var util=require(_0x2167('0x1'));var moment=require(_0x2167('0x2'));var BPromise=require(_0x2167('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2167('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2167('0x5'));var config=require(_0x2167('0x6'));var jayson=require(_0x2167('0x7'));var client=jayson[_0x2167('0x8')][_0x2167('0x9')]({'port':0x232a});config['redis']=_[_0x2167('0xa')](config[_0x2167('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2167('0xc'))(new Redis(config[_0x2167('0xb')]));require(_0x2167('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e7229,_0x11d450,_0x405dff){return new BPromise(function(_0x4f912b,_0x7e250f){return client[_0x2167('0xe')](_0x2e7229,_0x405dff)[_0x2167('0xf')](function(_0x89cb42){logger[_0x2167('0x10')](_0x2167('0x11'),_0x11d450,_0x2167('0x12'));logger[_0x2167('0x13')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x11d450,_0x2167('0x12'),JSON[_0x2167('0x14')](_0x89cb42));if(_0x89cb42[_0x2167('0x15')]){if(_0x89cb42['error'][_0x2167('0x16')]===0x1f4){logger[_0x2167('0x15')](_0x2167('0x11'),_0x11d450,_0x89cb42[_0x2167('0x15')][_0x2167('0x17')]);return _0x7e250f(_0x89cb42['error'][_0x2167('0x17')]);}logger[_0x2167('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x11d450,_0x89cb42[_0x2167('0x15')][_0x2167('0x17')]);return _0x4f912b(_0x89cb42[_0x2167('0x15')][_0x2167('0x17')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x11d450,_0x2167('0x12'));_0x4f912b(_0x89cb42[_0x2167('0x18')][_0x2167('0x17')]);}})[_0x2167('0x19')](function(_0x5ad457){logger[_0x2167('0x15')](_0x2167('0x11'),_0x11d450,_0x5ad457);_0x7e250f(_0x5ad457);});});}exports[_0x2167('0x1a')]=function(_0x9d9da3){var _0x310f05=this;return new Promise(function(_0x4b8c5b,_0x7ca0dc){return db['OpenchannelQueue'][_0x2167('0x1b')]({'raw':_0x9d9da3[_0x2167('0x1c')]?_0x9d9da3['options'][_0x2167('0x1d')]===undefined?!![]:![]:!![],'where':_0x9d9da3[_0x2167('0x1c')]?_0x9d9da3[_0x2167('0x1c')][_0x2167('0x1e')]||null:null,'attributes':_0x9d9da3[_0x2167('0x1c')]?_0x9d9da3[_0x2167('0x1c')]['attributes']||null:null,'limit':_0x9d9da3['options']?_0x9d9da3[_0x2167('0x1c')]['limit']||null:null,'include':_0x9d9da3[_0x2167('0x1c')]?_0x9d9da3[_0x2167('0x1c')][_0x2167('0x1f')]?_['map'](_0x9d9da3[_0x2167('0x1c')][_0x2167('0x1f')],function(_0x5982f7){return{'model':db[_0x5982f7[_0x2167('0x20')]],'as':_0x5982f7['as'],'attributes':_0x5982f7[_0x2167('0x21')],'include':_0x5982f7['include']?_[_0x2167('0x22')](_0x5982f7[_0x2167('0x1f')],function(_0xb6166f){return{'model':db[_0xb6166f['model']],'as':_0xb6166f['as'],'attributes':_0xb6166f[_0x2167('0x21')],'include':_0xb6166f[_0x2167('0x1f')]?_[_0x2167('0x22')](_0xb6166f[_0x2167('0x1f')],function(_0x541718){return{'model':db[_0x541718['model']],'as':_0x541718['as'],'attributes':_0x541718[_0x2167('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1625ae){logger['info']('GetOpenchannelQueue',_0x9d9da3);logger[_0x2167('0x13')]('GetOpenchannelQueue',_0x9d9da3,JSON[_0x2167('0x14')](_0x1625ae));_0x4b8c5b(_0x1625ae);})[_0x2167('0x19')](function(_0x158ac4){logger[_0x2167('0x15')](_0x2167('0x1a'),_0x158ac4['message'],_0x9d9da3);_0x7ca0dc(_0x310f05['error'](0x1f4,_0x158ac4['message']));});});};exports[_0x2167('0x23')]=function(_0x3d98e7){var _0x2dd205=this;return new Promise(function(_0x325bd1,_0x3477d8){return db[_0x2167('0x24')]['find']({'raw':_0x3d98e7[_0x2167('0x1c')]?_0x3d98e7[_0x2167('0x1c')][_0x2167('0x1d')]===undefined?!![]:![]:!![],'where':_0x3d98e7[_0x2167('0x1c')]?_0x3d98e7[_0x2167('0x1c')][_0x2167('0x1e')]||null:null,'attributes':_0x3d98e7[_0x2167('0x1c')]?_0x3d98e7['options'][_0x2167('0x21')]||null:null,'include':_0x3d98e7[_0x2167('0x1c')]?_0x3d98e7[_0x2167('0x1c')][_0x2167('0x1f')]?_['map'](_0x3d98e7[_0x2167('0x1c')][_0x2167('0x1f')],function(_0x12a373){return{'model':db[_0x12a373['model']],'as':_0x12a373['as'],'attributes':_0x12a373[_0x2167('0x21')],'include':_0x12a373[_0x2167('0x1f')]?_['map'](_0x12a373[_0x2167('0x1f')],function(_0x19cebb){return{'model':db[_0x19cebb[_0x2167('0x20')]],'as':_0x19cebb['as'],'attributes':_0x19cebb[_0x2167('0x21')],'include':_0x19cebb[_0x2167('0x1f')]?_[_0x2167('0x22')](_0x19cebb[_0x2167('0x1f')],function(_0x177939){return{'model':db[_0x177939[_0x2167('0x20')]],'as':_0x177939['as'],'attributes':_0x177939[_0x2167('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x166d18){logger[_0x2167('0x10')]('ShowOpenchannelQueue',_0x3d98e7);logger[_0x2167('0x13')](_0x2167('0x23'),_0x3d98e7,JSON['stringify'](_0x166d18));_0x325bd1(_0x166d18);})[_0x2167('0x19')](function(_0xd2b9fb){logger[_0x2167('0x15')](_0x2167('0x23'),_0xd2b9fb[_0x2167('0x17')],_0x3d98e7);_0x3477d8(_0x2dd205[_0x2167('0x15')](0x1f4,_0xd2b9fb[_0x2167('0x17')]));});});}; \ No newline at end of file +var _0xefc1=['socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','limit','include','attributes','map','model','ShowOpenchannelQueue','find','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x1b5335,_0x4c291e){var _0x4fbfb5=function(_0x421e9a){while(--_0x421e9a){_0x1b5335['push'](_0x1b5335['shift']());}};_0x4fbfb5(++_0x4c291e);}(_0xefc1,0x9d));var _0x1efc=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xefc1[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x1efc('0x0'));var util=require('util');var moment=require(_0x1efc('0x1'));var BPromise=require(_0x1efc('0x2'));var rs=require(_0x1efc('0x3'));var fs=require('fs');var Redis=require(_0x1efc('0x4'));var db=require(_0x1efc('0x5'))['db'];var utils=require(_0x1efc('0x6'));var logger=require(_0x1efc('0x7'))('rpc');var config=require(_0x1efc('0x8'));var jayson=require(_0x1efc('0x9'));var client=jayson[_0x1efc('0xa')][_0x1efc('0xb')]({'port':0x232a});config[_0x1efc('0xc')]=_[_0x1efc('0xd')](config[_0x1efc('0xc')],{'host':_0x1efc('0xe'),'port':0x18eb});var socket=require(_0x1efc('0xf'))(new Redis(config[_0x1efc('0xc')]));require(_0x1efc('0x10'))[_0x1efc('0x11')](socket);function respondWithRpcPromise(_0x401349,_0x4117a0,_0x495b1f){return new BPromise(function(_0x5db1c1,_0x3dec1a){return client[_0x1efc('0x12')](_0x401349,_0x495b1f)[_0x1efc('0x13')](function(_0x3a67bd){logger[_0x1efc('0x14')](_0x1efc('0x15'),_0x4117a0,'request\x20sent');logger[_0x1efc('0x16')](_0x1efc('0x17'),_0x4117a0,_0x1efc('0x18'),JSON[_0x1efc('0x19')](_0x3a67bd));if(_0x3a67bd[_0x1efc('0x1a')]){if(_0x3a67bd['error']['code']===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x4117a0,_0x3a67bd[_0x1efc('0x1a')]['message']);return _0x3dec1a(_0x3a67bd[_0x1efc('0x1a')][_0x1efc('0x1b')]);}logger[_0x1efc('0x1a')](_0x1efc('0x15'),_0x4117a0,_0x3a67bd[_0x1efc('0x1a')][_0x1efc('0x1b')]);return _0x5db1c1(_0x3a67bd['error'][_0x1efc('0x1b')]);}else{logger[_0x1efc('0x14')](_0x1efc('0x15'),_0x4117a0,'request\x20sent');_0x5db1c1(_0x3a67bd[_0x1efc('0x1c')][_0x1efc('0x1b')]);}})[_0x1efc('0x1d')](function(_0x53a508){logger[_0x1efc('0x1a')](_0x1efc('0x15'),_0x4117a0,_0x53a508);_0x3dec1a(_0x53a508);});});}exports[_0x1efc('0x1e')]=function(_0x18cdea){var _0x29a590=this;return new Promise(function(_0x4137e1,_0x1c7aff){return db[_0x1efc('0x1f')][_0x1efc('0x20')]({'raw':_0x18cdea['options']?_0x18cdea[_0x1efc('0x21')][_0x1efc('0x22')]===undefined?!![]:![]:!![],'where':_0x18cdea[_0x1efc('0x21')]?_0x18cdea[_0x1efc('0x21')]['where']||null:null,'attributes':_0x18cdea[_0x1efc('0x21')]?_0x18cdea[_0x1efc('0x21')]['attributes']||null:null,'limit':_0x18cdea['options']?_0x18cdea[_0x1efc('0x21')][_0x1efc('0x23')]||null:null,'include':_0x18cdea[_0x1efc('0x21')]?_0x18cdea[_0x1efc('0x21')][_0x1efc('0x24')]?_['map'](_0x18cdea[_0x1efc('0x21')]['include'],function(_0x15689e){return{'model':db[_0x15689e['model']],'as':_0x15689e['as'],'attributes':_0x15689e[_0x1efc('0x25')],'include':_0x15689e['include']?_[_0x1efc('0x26')](_0x15689e[_0x1efc('0x24')],function(_0x5d13f6){return{'model':db[_0x5d13f6['model']],'as':_0x5d13f6['as'],'attributes':_0x5d13f6[_0x1efc('0x25')],'include':_0x5d13f6['include']?_[_0x1efc('0x26')](_0x5d13f6['include'],function(_0x584b95){return{'model':db[_0x584b95[_0x1efc('0x27')]],'as':_0x584b95['as'],'attributes':_0x584b95[_0x1efc('0x25')]};}):[]};}):[]};}):[]:[]})[_0x1efc('0x13')](function(_0x1ee4cf){logger['info'](_0x1efc('0x1e'),_0x18cdea);logger['debug'](_0x1efc('0x1e'),_0x18cdea,JSON[_0x1efc('0x19')](_0x1ee4cf));_0x4137e1(_0x1ee4cf);})[_0x1efc('0x1d')](function(_0x36c4f6){logger[_0x1efc('0x1a')](_0x1efc('0x1e'),_0x36c4f6[_0x1efc('0x1b')],_0x18cdea);_0x1c7aff(_0x29a590[_0x1efc('0x1a')](0x1f4,_0x36c4f6['message']));});});};exports[_0x1efc('0x28')]=function(_0x2e2de2){var _0x491206=this;return new Promise(function(_0x8645f4,_0x3797c4){return db[_0x1efc('0x1f')][_0x1efc('0x29')]({'raw':_0x2e2de2[_0x1efc('0x21')]?_0x2e2de2[_0x1efc('0x21')][_0x1efc('0x22')]===undefined?!![]:![]:!![],'where':_0x2e2de2[_0x1efc('0x21')]?_0x2e2de2['options'][_0x1efc('0x2a')]||null:null,'attributes':_0x2e2de2[_0x1efc('0x21')]?_0x2e2de2['options']['attributes']||null:null,'include':_0x2e2de2[_0x1efc('0x21')]?_0x2e2de2[_0x1efc('0x21')][_0x1efc('0x24')]?_[_0x1efc('0x26')](_0x2e2de2[_0x1efc('0x21')][_0x1efc('0x24')],function(_0x5b00a3){return{'model':db[_0x5b00a3[_0x1efc('0x27')]],'as':_0x5b00a3['as'],'attributes':_0x5b00a3[_0x1efc('0x25')],'include':_0x5b00a3[_0x1efc('0x24')]?_[_0x1efc('0x26')](_0x5b00a3['include'],function(_0x514588){return{'model':db[_0x514588[_0x1efc('0x27')]],'as':_0x514588['as'],'attributes':_0x514588[_0x1efc('0x25')],'include':_0x514588[_0x1efc('0x24')]?_[_0x1efc('0x26')](_0x514588[_0x1efc('0x24')],function(_0x20848c){return{'model':db[_0x20848c[_0x1efc('0x27')]],'as':_0x20848c['as'],'attributes':_0x20848c[_0x1efc('0x25')]};}):[]};}):[]};}):[]:[]})[_0x1efc('0x13')](function(_0x4e3a48){logger[_0x1efc('0x14')]('ShowOpenchannelQueue',_0x2e2de2);logger['debug'](_0x1efc('0x28'),_0x2e2de2,JSON[_0x1efc('0x19')](_0x4e3a48));_0x8645f4(_0x4e3a48);})[_0x1efc('0x1d')](function(_0x4577c3){logger['error']('ShowOpenchannelQueue',_0x4577c3[_0x1efc('0x1b')],_0x2e2de2);_0x3797c4(_0x491206['error'](0x1f4,_0x4577c3[_0x1efc('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index cfab655..7bc7f75 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 _0x3209=['register','length','./openchannelQueue.events','save','remove','update','removeListener'];(function(_0x518b60,_0x30d151){var _0x2682d5=function(_0x28c39e){while(--_0x28c39e){_0x518b60['push'](_0x518b60['shift']());}};_0x2682d5(++_0x30d151);}(_0x3209,0x113));var _0x9320=function(_0x2981e7,_0x3c5796){_0x2981e7=_0x2981e7-0x0;var _0x2874ff=_0x3209[_0x2981e7];return _0x2874ff;};'use strict';var OpenchannelQueueEvents=require(_0x9320('0x0'));var events=[_0x9320('0x1'),_0x9320('0x2'),_0x9320('0x3')];function createListener(_0x23639f,_0x46051e){return function(_0x532700){_0x46051e['emit'](_0x23639f,_0x532700);};}function removeListener(_0x4306f4,_0x244209){return function(){OpenchannelQueueEvents[_0x9320('0x4')](_0x4306f4,_0x244209);};}exports[_0x9320('0x5')]=function(_0x536ade){for(var _0x437a7c=0x0,_0x1327b5=events[_0x9320('0x6')];_0x437a7c<_0x1327b5;_0x437a7c++){var _0x51a31d=events[_0x437a7c];var _0x230f73=createListener('openchannelQueue:'+_0x51a31d,_0x536ade);OpenchannelQueueEvents['on'](_0x51a31d,_0x230f73);}}; \ No newline at end of file +var _0xf1df=['update','emit','removeListener','openchannelQueue:','./openchannelQueue.events','remove'];(function(_0x3b1ce3,_0x3173fa){var _0x2961fc=function(_0x401243){while(--_0x401243){_0x3b1ce3['push'](_0x3b1ce3['shift']());}};_0x2961fc(++_0x3173fa);}(_0xf1df,0x1e4));var _0xff1d=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xf1df[_0x484e36];return _0xafc85d;};'use strict';var OpenchannelQueueEvents=require(_0xff1d('0x0'));var events=['save',_0xff1d('0x1'),_0xff1d('0x2')];function createListener(_0x1ef6c3,_0x24bbfa){return function(_0x693056){_0x24bbfa[_0xff1d('0x3')](_0x1ef6c3,_0x693056);};}function removeListener(_0x3c600d,_0x4bf9f7){return function(){OpenchannelQueueEvents[_0xff1d('0x4')](_0x3c600d,_0x4bf9f7);};}exports['register']=function(_0x1839fd){for(var _0x5e04b7=0x0,_0x549d22=events['length'];_0x5e04b7<_0x549d22;_0x5e04b7++){var _0x26eb2d=events[_0x5e04b7];var _0x55fc68=createListener(_0xff1d('0x5')+_0x26eb2d,_0x1839fd);OpenchannelQueueEvents['on'](_0x26eb2d,_0x55fc68);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index c3ed029..4a22a88 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 _0x3f6f=['describe','/:id','show','create','put','update','delete','destroy','path','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated'];(function(_0x1a60b4,_0x281fe7){var _0x494486=function(_0x3f5fc3){while(--_0x3f5fc3){_0x1a60b4['push'](_0x1a60b4['shift']());}};_0x494486(++_0x281fe7);}(_0x3f6f,0xc8));var _0xf3f6=function(_0x29207d,_0xd46f54){_0x29207d=_0x29207d-0x0;var _0x50a843=_0x3f6f[_0x29207d];return _0x50a843;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf3f6('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xf3f6('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0xf3f6('0x2'));var controller=require(_0xf3f6('0x3'));router[_0xf3f6('0x4')]('/',auth['isAuthenticated'](),controller[_0xf3f6('0x5')]);router[_0xf3f6('0x4')](_0xf3f6('0x6'),auth[_0xf3f6('0x7')](),controller[_0xf3f6('0x8')]);router[_0xf3f6('0x4')](_0xf3f6('0x9'),auth[_0xf3f6('0x7')](),controller[_0xf3f6('0xa')]);router['post']('/',auth[_0xf3f6('0x7')](),controller[_0xf3f6('0xb')]);router[_0xf3f6('0xc')]('/:id',auth[_0xf3f6('0x7')](),controller[_0xf3f6('0xd')]);router[_0xf3f6('0xe')](_0xf3f6('0x9'),auth[_0xf3f6('0x7')](),controller[_0xf3f6('0xf')]);module['exports']=router; \ No newline at end of file +var _0xdc4c=['post','create','update','delete','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','/:id','show'];(function(_0x478c3c,_0x3d530e){var _0x3a0711=function(_0x3bc563){while(--_0x3bc563){_0x478c3c['push'](_0x478c3c['shift']());}};_0x3a0711(++_0x3d530e);}(_0xdc4c,0xa4));var _0xcdc4=function(_0x56d6a0,_0x34b7da){_0x56d6a0=_0x56d6a0-0x0;var _0x2a1111=_0xdc4c[_0x56d6a0];return _0x2a1111;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcdc4('0x0'));var timeout=require(_0xcdc4('0x1'));var express=require(_0xcdc4('0x2'));var router=express[_0xcdc4('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xcdc4('0x4'));var config=require(_0xcdc4('0x5'));var controller=require(_0xcdc4('0x6'));router[_0xcdc4('0x7')]('/',auth[_0xcdc4('0x8')](),controller['index']);router[_0xcdc4('0x7')](_0xcdc4('0x9'),auth[_0xcdc4('0x8')](),controller['describe']);router[_0xcdc4('0x7')](_0xcdc4('0xa'),auth[_0xcdc4('0x8')](),controller[_0xcdc4('0xb')]);router[_0xcdc4('0xc')]('/',auth[_0xcdc4('0x8')](),controller[_0xcdc4('0xd')]);router['put']('/:id',auth[_0xcdc4('0x8')](),controller[_0xcdc4('0xe')]);router[_0xcdc4('0xf')](_0xcdc4('0xa'),auth[_0xcdc4('0x8')](),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 06d2353..357a7e3 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 _0x28bd=['exports','STRING','DATE','moment'];(function(_0x10d011,_0x3adcc5){var _0x31a8cb=function(_0x345770){while(--_0x345770){_0x10d011['push'](_0x10d011['shift']());}};_0x31a8cb(++_0x3adcc5);}(_0x28bd,0x187));var _0xd28b=function(_0x4cdcfb,_0x489c3b){_0x4cdcfb=_0x4cdcfb-0x0;var _0x5c240f=_0x28bd[_0x4cdcfb];return _0x5c240f;};'use strict';var moment=require(_0xd28b('0x0'));var Sequelize=require('sequelize');module[_0xd28b('0x1')]={'uniqueid':{'type':Sequelize[_0xd28b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd28b('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xd28b('0x3')]},'exitAt':{'type':Sequelize[_0xd28b('0x3')]},'reason':{'type':Sequelize[_0xd28b('0x2')]}}; \ No newline at end of file +var _0x9667=['DATE','moment','sequelize','STRING'];(function(_0x3f0b15,_0x29a0c6){var _0x371196=function(_0x39ea4e){while(--_0x39ea4e){_0x3f0b15['push'](_0x3f0b15['shift']());}};_0x371196(++_0x29a0c6);}(_0x9667,0x1c1));var _0x7966=function(_0x1a033a,_0x3f0372){_0x1a033a=_0x1a033a-0x0;var _0x1125a0=_0x9667[_0x1a033a];return _0x1125a0;};'use strict';var moment=require(_0x7966('0x0'));var Sequelize=require(_0x7966('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x7966('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x7966('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x7966('0x3')]},'exitAt':{'type':Sequelize[_0x7966('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 5b1f652..cd27afe 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 _0xe14b=['catch','create','body','params','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','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','pick','filter','where','merge','VIRTUAL','then','includeAll','findAll','rows','show','fields','length','include','options','find'];(function(_0xe421f7,_0x4db955){var _0x1d8da3=function(_0x1ed0a9){while(--_0x1ed0a9){_0xe421f7['push'](_0xe421f7['shift']());}};_0x1d8da3(++_0x4db955);}(_0xe14b,0x93));var _0xbe14=function(_0x4b9131,_0x37b6c5){_0x4b9131=_0x4b9131-0x0;var _0x143ac2=_0xe14b[_0x4b9131];return _0x143ac2;};'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 licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=_0xf4ac9[_0xbe14('0x19')],_0x4e8f34=_0x3dc4a9[_0xbe14('0x1a')],_0x21c789=_0x3dc4a9[_0xbe14('0x1a')]+_0x3dc4a9[_0xbe14('0x1b')],_0xe9c3ec;if(_0x21c789>=_0x37ce4e){_0x21c789=_0x37ce4e;_0xe9c3ec=0xc8;}else{_0xe9c3ec=0xce;}_0x3f58f5[_0xbe14('0x17')](_0xe9c3ec);return _0x3f58f5['set'](_0xbe14('0x1c'),_0x4e8f34+'-'+_0x21c789+'/'+_0x37ce4e)[_0xbe14('0x1d')](_0xf4ac9);}return null;};}function patchUpdates(_0x329588){return function(_0x433459){try{jsonpatch[_0xbe14('0x1e')](_0x433459,_0x329588,!![]);}catch(_0x37e4c1){return BPromise['reject'](_0x37e4c1);}return _0x433459[_0xbe14('0x1f')]();};}function saveUpdates(_0x4a1bbd,_0x417c8d){return function(_0xc12977){if(_0xc12977){return _0xc12977[_0xbe14('0x20')](_0x4a1bbd)['then'](function(_0xe60f42){return _0xe60f42;});}return null;};}function removeEntity(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')]()['then'](function(){_0x56d845[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x505dbd,_0x2da350){return function(_0x4d4190){if(!_0x4d4190){_0x505dbd[_0xbe14('0x16')](0x194);}return _0x4d4190;};}function handleError(_0x4851f8,_0x36a21e){_0x36a21e=_0x36a21e||0x1f4;return function(_0x5fa043){logger[_0xbe14('0x22')](_0x5fa043[_0xbe14('0x23')]);if(_0x5fa043[_0xbe14('0x24')]){delete _0x5fa043[_0xbe14('0x24')];}_0x4851f8['status'](_0x36a21e)[_0xbe14('0x25')](_0x5fa043);};}exports[_0xbe14('0x26')]=function(_0x391556,_0x169369){var _0x5dd475={},_0x16f884={},_0x29fc64={'count':0x0,'rows':[]};var _0x59bf34=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x19252f){return{'name':_0x19252f[_0xbe14('0x2a')],'type':_0x19252f[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x16f884[_0xbe14('0x2d')]=_[_0xbe14('0x27')](_0x59bf34,_0xbe14('0x24'));_0x16f884[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x391556[_0xbe14('0x2e')]);_0x16f884[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x16f884[_0xbe14('0x2d')],_0x16f884[_0xbe14('0x2e')]);_0x5dd475[_0xbe14('0x32')]=_[_0xbe14('0x31')](_0x16f884[_0xbe14('0x2d')],qs['fields'](_0x391556[_0xbe14('0x2e')]['fields']));_0x5dd475['attributes']=_0x5dd475[_0xbe14('0x32')]['length']?_0x5dd475[_0xbe14('0x32')]:_0x16f884[_0xbe14('0x2d')];if(!_0x391556['query']['hasOwnProperty']('nolimit')){_0x5dd475[_0xbe14('0x1b')]=qs[_0xbe14('0x1b')](_0x391556['query'][_0xbe14('0x1b')]);_0x5dd475[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x391556[_0xbe14('0x2e')][_0xbe14('0x1a')]);}_0x5dd475['order']=qs['sort'](_0x391556[_0xbe14('0x2e')]['sort']);_0x5dd475['where']=qs['filters'](_[_0xbe14('0x33')](_0x391556[_0xbe14('0x2e')],_0x16f884[_0xbe14('0x30')]),_0x59bf34);if(_0x391556[_0xbe14('0x2e')][_0xbe14('0x34')]){_0x5dd475[_0xbe14('0x35')]=_[_0xbe14('0x36')](_0x5dd475[_0xbe14('0x35')],{'$or':_[_0xbe14('0x27')](_0x59bf34,function(_0x2dfd5a){if(_0x2dfd5a[_0xbe14('0x2b')]!==_0xbe14('0x37')){var _0x539c41={};_0x539c41[_0x2dfd5a['name']]={'$like':'%'+_0x391556[_0xbe14('0x2e')][_0xbe14('0x34')]+'%'};return _0x539c41;}})});}_0x5dd475=_[_0xbe14('0x36')]({},_0x5dd475,_0x391556['options']);var _0x326329={'where':_0x5dd475[_0xbe14('0x35')]};return db[_0xbe14('0x28')][_0xbe14('0x19')](_0x326329)[_0xbe14('0x38')](function(_0x25ee1f){_0x29fc64[_0xbe14('0x19')]=_0x25ee1f;if(_0x391556[_0xbe14('0x2e')][_0xbe14('0x39')]){_0x5dd475['include']=[{'all':!![]}];}return db[_0xbe14('0x28')][_0xbe14('0x3a')](_0x5dd475);})[_0xbe14('0x38')](function(_0x1b3118){_0x29fc64[_0xbe14('0x3b')]=_0x1b3118;return _0x29fc64;})[_0xbe14('0x38')](respondWithFilteredResult(_0x169369,_0x5dd475))['catch'](handleError(_0x169369,null));};exports[_0xbe14('0x3c')]=function(_0x1974a4,_0x1220c9){var _0x36263c={'raw':!![],'where':{'id':_0x1974a4['params']['id']}},_0x5cf713={};_0x5cf713[_0xbe14('0x2d')]=_[_0xbe14('0x2f')](db[_0xbe14('0x28')]['rawAttributes']);_0x5cf713['query']=_[_0xbe14('0x2f')](_0x1974a4['query']);_0x5cf713['filtears']=_[_0xbe14('0x31')](_0x5cf713[_0xbe14('0x2d')],_0x5cf713[_0xbe14('0x2e')]);_0x36263c['attributes']=_['intersection'](_0x5cf713['model'],qs[_0xbe14('0x3d')](_0x1974a4[_0xbe14('0x2e')][_0xbe14('0x3d')]));_0x36263c['attributes']=_0x36263c[_0xbe14('0x32')][_0xbe14('0x3e')]?_0x36263c[_0xbe14('0x32')]:_0x5cf713[_0xbe14('0x2d')];if(_0x1974a4['query']['includeAll']){_0x36263c[_0xbe14('0x3f')]=[{'all':!![]}];}_0x36263c=_[_0xbe14('0x36')]({},_0x36263c,_0x1974a4[_0xbe14('0x40')]);return db[_0xbe14('0x28')][_0xbe14('0x41')](_0x36263c)['then'](handleEntityNotFound(_0x1220c9,null))['then'](respondWithResult(_0x1220c9,null))[_0xbe14('0x42')](handleError(_0x1220c9,null));};exports[_0xbe14('0x43')]=function(_0x238c60,_0x2a3b35){return db['OpenchannelQueueReport'][_0xbe14('0x43')](_0x238c60[_0xbe14('0x44')],{})['then'](respondWithResult(_0x2a3b35,0xc9))[_0xbe14('0x42')](handleError(_0x2a3b35,null));};exports[_0xbe14('0x20')]=function(_0x2d6ee8,_0x36c20c){if(_0x2d6ee8['body']['id']){delete _0x2d6ee8['body']['id'];}return db[_0xbe14('0x28')][_0xbe14('0x41')]({'where':{'id':_0x2d6ee8['params']['id']}})['then'](handleEntityNotFound(_0x36c20c,null))[_0xbe14('0x38')](saveUpdates(_0x2d6ee8[_0xbe14('0x44')],null))[_0xbe14('0x38')](respondWithResult(_0x36c20c,null))[_0xbe14('0x42')](handleError(_0x36c20c,null));};exports[_0xbe14('0x21')]=function(_0xd04fd5,_0x10cd86){return db['OpenchannelQueueReport'][_0xbe14('0x41')]({'where':{'id':_0xd04fd5[_0xbe14('0x45')]['id']}})[_0xbe14('0x38')](handleEntityNotFound(_0x10cd86,null))[_0xbe14('0x38')](removeEntity(_0x10cd86,null))[_0xbe14('0x42')](handleError(_0x10cd86,null));};exports['describe']=function(_0x3a221b,_0x3d419a){return db[_0xbe14('0x28')][_0xbe14('0x46')]()[_0xbe14('0x38')](respondWithResult(_0x3d419a,null))[_0xbe14('0x42')](handleError(_0x3d419a,null));}; \ No newline at end of file +var _0xadb5=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','OpenchannelQueueReport','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','count','offset','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','fieldName','type','key','model','query','keys'];(function(_0x5b8a39,_0x18eb9c){var _0x12394d=function(_0x1f646a){while(--_0x1f646a){_0x5b8a39['push'](_0x5b8a39['shift']());}};_0x12394d(++_0x18eb9c);}(_0xadb5,0xad));var _0x5adb=function(_0x522077,_0x4a457e){_0x522077=_0x522077-0x0;var _0x4a597a=_0xadb5[_0x522077];return _0x4a597a;};'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 licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=_0x42a482[_0x5adb('0x1b')],_0x304784=_0x367d82[_0x5adb('0x1c')],_0x1c0f97=_0x367d82[_0x5adb('0x1c')]+_0x367d82['limit'],_0x39d24d;if(_0x1c0f97>=_0x30614e){_0x1c0f97=_0x30614e;_0x39d24d=0xc8;}else{_0x39d24d=0xce;}_0x518823[_0x5adb('0x19')](_0x39d24d);return _0x518823['set'](_0x5adb('0x1d'),_0x304784+'-'+_0x1c0f97+'/'+_0x30614e)['json'](_0x42a482);}return null;};}function patchUpdates(_0x3ef465){return function(_0x50e84f){try{jsonpatch['apply'](_0x50e84f,_0x3ef465,!![]);}catch(_0x1fbaa5){return BPromise[_0x5adb('0x1e')](_0x1fbaa5);}return _0x50e84f[_0x5adb('0x1f')]();};}function saveUpdates(_0x1fd4a7,_0x99bc6c){return function(_0x5af69d){if(_0x5af69d){return _0x5af69d[_0x5adb('0x20')](_0x1fd4a7)['then'](function(_0x4e9f16){return _0x4e9f16;});}return null;};}function removeEntity(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')]()[_0x5adb('0x22')](function(){_0x3754cc[_0x5adb('0x19')](0xcc)[_0x5adb('0x23')]();});}};}function handleEntityNotFound(_0x4ca150,_0x4b1957){return function(_0x373cc3){if(!_0x373cc3){_0x4ca150[_0x5adb('0x18')](0x194);}return _0x373cc3;};}function handleError(_0x3839fb,_0xeb556c){_0xeb556c=_0xeb556c||0x1f4;return function(_0x49f203){logger[_0x5adb('0x24')](_0x49f203[_0x5adb('0x25')]);if(_0x49f203['name']){delete _0x49f203[_0x5adb('0x26')];}_0x3839fb[_0x5adb('0x19')](_0xeb556c)[_0x5adb('0x27')](_0x49f203);};}exports['index']=function(_0x13ad1d,_0xbe21b1){var _0x3a4fca={},_0x2c64a3={},_0x36459b={'count':0x0,'rows':[]};var _0x1c06c4=_['map'](db['OpenchannelQueueReport']['rawAttributes'],function(_0x39bddd){return{'name':_0x39bddd[_0x5adb('0x28')],'type':_0x39bddd[_0x5adb('0x29')][_0x5adb('0x2a')]};});_0x2c64a3[_0x5adb('0x2b')]=_['map'](_0x1c06c4,_0x5adb('0x26'));_0x2c64a3[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](_0x13ad1d[_0x5adb('0x2c')]);_0x2c64a3[_0x5adb('0x2e')]=_[_0x5adb('0x2f')](_0x2c64a3[_0x5adb('0x2b')],_0x2c64a3[_0x5adb('0x2c')]);_0x3a4fca[_0x5adb('0x30')]=_[_0x5adb('0x2f')](_0x2c64a3['model'],qs[_0x5adb('0x31')](_0x13ad1d['query'][_0x5adb('0x31')]));_0x3a4fca[_0x5adb('0x30')]=_0x3a4fca['attributes'][_0x5adb('0x32')]?_0x3a4fca[_0x5adb('0x30')]:_0x2c64a3[_0x5adb('0x2b')];if(!_0x13ad1d['query'][_0x5adb('0x33')](_0x5adb('0x34'))){_0x3a4fca['limit']=qs['limit'](_0x13ad1d[_0x5adb('0x2c')]['limit']);_0x3a4fca[_0x5adb('0x1c')]=qs[_0x5adb('0x1c')](_0x13ad1d[_0x5adb('0x2c')][_0x5adb('0x1c')]);}_0x3a4fca[_0x5adb('0x35')]=qs['sort'](_0x13ad1d[_0x5adb('0x2c')][_0x5adb('0x36')]);_0x3a4fca[_0x5adb('0x37')]=qs['filters'](_['pick'](_0x13ad1d[_0x5adb('0x2c')],_0x2c64a3[_0x5adb('0x2e')]),_0x1c06c4);if(_0x13ad1d['query'][_0x5adb('0x38')]){_0x3a4fca['where']=_[_0x5adb('0x39')](_0x3a4fca['where'],{'$or':_[_0x5adb('0x3a')](_0x1c06c4,function(_0x4d052f){if(_0x4d052f[_0x5adb('0x29')]!==_0x5adb('0x3b')){var _0x4ccb27={};_0x4ccb27[_0x4d052f[_0x5adb('0x26')]]={'$like':'%'+_0x13ad1d['query'][_0x5adb('0x38')]+'%'};return _0x4ccb27;}})});}_0x3a4fca=_[_0x5adb('0x39')]({},_0x3a4fca,_0x13ad1d[_0x5adb('0x3c')]);var _0x50edd1={'where':_0x3a4fca[_0x5adb('0x37')]};return db[_0x5adb('0x3d')][_0x5adb('0x1b')](_0x50edd1)[_0x5adb('0x22')](function(_0x22aa95){_0x36459b['count']=_0x22aa95;if(_0x13ad1d['query']['includeAll']){_0x3a4fca['include']=[{'all':!![]}];}return db[_0x5adb('0x3d')][_0x5adb('0x3e')](_0x3a4fca);})[_0x5adb('0x22')](function(_0x399489){_0x36459b[_0x5adb('0x3f')]=_0x399489;return _0x36459b;})[_0x5adb('0x22')](respondWithFilteredResult(_0xbe21b1,_0x3a4fca))[_0x5adb('0x40')](handleError(_0xbe21b1,null));};exports[_0x5adb('0x41')]=function(_0x478a70,_0x53f2c6){var _0x27dbb7={'raw':!![],'where':{'id':_0x478a70[_0x5adb('0x42')]['id']}},_0x48eb26={};_0x48eb26[_0x5adb('0x2b')]=_[_0x5adb('0x2d')](db[_0x5adb('0x3d')][_0x5adb('0x43')]);_0x48eb26['query']=_[_0x5adb('0x2d')](_0x478a70[_0x5adb('0x2c')]);_0x48eb26['filtears']=_[_0x5adb('0x2f')](_0x48eb26[_0x5adb('0x2b')],_0x48eb26['query']);_0x27dbb7[_0x5adb('0x30')]=_[_0x5adb('0x2f')](_0x48eb26[_0x5adb('0x2b')],qs[_0x5adb('0x31')](_0x478a70[_0x5adb('0x2c')][_0x5adb('0x31')]));_0x27dbb7[_0x5adb('0x30')]=_0x27dbb7['attributes']['length']?_0x27dbb7[_0x5adb('0x30')]:_0x48eb26[_0x5adb('0x2b')];if(_0x478a70[_0x5adb('0x2c')][_0x5adb('0x44')]){_0x27dbb7['include']=[{'all':!![]}];}_0x27dbb7=_['merge']({},_0x27dbb7,_0x478a70[_0x5adb('0x3c')]);return db[_0x5adb('0x3d')][_0x5adb('0x45')](_0x27dbb7)[_0x5adb('0x22')](handleEntityNotFound(_0x53f2c6,null))[_0x5adb('0x22')](respondWithResult(_0x53f2c6,null))['catch'](handleError(_0x53f2c6,null));};exports[_0x5adb('0x46')]=function(_0x437f52,_0x5b574c){return db[_0x5adb('0x3d')][_0x5adb('0x46')](_0x437f52[_0x5adb('0x47')],{})[_0x5adb('0x22')](respondWithResult(_0x5b574c,0xc9))[_0x5adb('0x40')](handleError(_0x5b574c,null));};exports[_0x5adb('0x20')]=function(_0x39840e,_0x54252){if(_0x39840e['body']['id']){delete _0x39840e[_0x5adb('0x47')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x39840e['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x54252,null))[_0x5adb('0x22')](saveUpdates(_0x39840e[_0x5adb('0x47')],null))['then'](respondWithResult(_0x54252,null))[_0x5adb('0x40')](handleError(_0x54252,null));};exports['destroy']=function(_0x177a81,_0x2c3f21){return db[_0x5adb('0x3d')]['find']({'where':{'id':_0x177a81[_0x5adb('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c3f21,null))[_0x5adb('0x22')](removeEntity(_0x2c3f21,null))[_0x5adb('0x40')](handleError(_0x2c3f21,null));};exports['describe']=function(_0x2402a3,_0x1ab97b){return db[_0x5adb('0x3d')][_0x5adb('0x48')]()[_0x5adb('0x22')](respondWithResult(_0x1ab97b,null))['catch'](handleError(_0x1ab97b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 4b15560..eb9dc12 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 _0x14f8=['path','rimraf','../../config/environment','exports','define','report_openchannel_queue','uniqueid','lodash','../../config/logger','api','moment','request-promise'];(function(_0x3c9736,_0x4470ce){var _0x43043d=function(_0xc9058e){while(--_0xc9058e){_0x3c9736['push'](_0x3c9736['shift']());}};_0x43043d(++_0x4470ce);}(_0x14f8,0x193));var _0x814f=function(_0x32a06f,_0x48c836){_0x32a06f=_0x32a06f-0x0;var _0x10759e=_0x14f8[_0x32a06f];return _0x10759e;};'use strict';var _=require(_0x814f('0x0'));var util=require('util');var logger=require(_0x814f('0x1'))(_0x814f('0x2'));var moment=require(_0x814f('0x3'));var BPromise=require('bluebird');var rp=require(_0x814f('0x4'));var fs=require('fs');var path=require(_0x814f('0x5'));var rimraf=require(_0x814f('0x6'));var config=require(_0x814f('0x7'));var attributes=require('./openchannelQueueReport.attributes');module[_0x814f('0x8')]=function(_0x1df8b8,_0x1b8890){return _0x1df8b8[_0x814f('0x9')]('OpenchannelQueueReport',attributes,{'tableName':_0x814f('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x814f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc743=['request-promise','path','rimraf','../../config/environment','define','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5e0b88,_0x5dc2b9){var _0x892a66=function(_0x4e9018){while(--_0x4e9018){_0x5e0b88['push'](_0x5e0b88['shift']());}};_0x892a66(++_0x5dc2b9);}(_0xc743,0x103));var _0x3c74=function(_0x3fd081,_0x2edd53){_0x3fd081=_0x3fd081-0x0;var _0x24822e=_0xc743[_0x3fd081];return _0x24822e;};'use strict';var _=require(_0x3c74('0x0'));var util=require(_0x3c74('0x1'));var logger=require(_0x3c74('0x2'))('api');var moment=require(_0x3c74('0x3'));var BPromise=require(_0x3c74('0x4'));var rp=require(_0x3c74('0x5'));var fs=require('fs');var path=require(_0x3c74('0x6'));var rimraf=require(_0x3c74('0x7'));var config=require(_0x3c74('0x8'));var attributes=require('./openchannelQueueReport.attributes');module['exports']=function(_0xce3828,_0x3dfee6){return _0xce3828[_0x3c74('0x9')]('OpenchannelQueueReport',attributes,{'tableName':_0x3c74('0xa'),'paranoid':![],'indexes':[{'name':_0x3c74('0xb'),'fields':[_0x3c74('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 29f04a9..e013ad4 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 _0x0407=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','catch','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash'];(function(_0x1306d2,_0x427f54){var _0x56e962=function(_0x40e0d3){while(--_0x40e0d3){_0x1306d2['push'](_0x1306d2['shift']());}};_0x56e962(++_0x427f54);}(_0x0407,0x11f));var _0x7040=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0x0407[_0x541ea6];return _0x3c3e84;};'use strict';var _=require(_0x7040('0x0'));var util=require(_0x7040('0x1'));var moment=require(_0x7040('0x2'));var BPromise=require(_0x7040('0x3'));var rs=require(_0x7040('0x4'));var fs=require('fs');var Redis=require(_0x7040('0x5'));var db=require(_0x7040('0x6'))['db'];var utils=require(_0x7040('0x7'));var logger=require(_0x7040('0x8'))(_0x7040('0x9'));var config=require(_0x7040('0xa'));var jayson=require(_0x7040('0xb'));var client=jayson[_0x7040('0xc')][_0x7040('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1d2fd5,_0x232be7,_0x1fd3a4){return new BPromise(function(_0x4e6008,_0xadd725){return client['request'](_0x1d2fd5,_0x1fd3a4)[_0x7040('0xe')](function(_0x2e2c2a){logger[_0x7040('0xf')](_0x7040('0x10'),_0x232be7,_0x7040('0x11'));logger[_0x7040('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x232be7,_0x7040('0x11'),JSON[_0x7040('0x13')](_0x2e2c2a));if(_0x2e2c2a['error']){if(_0x2e2c2a[_0x7040('0x14')][_0x7040('0x15')]===0x1f4){logger[_0x7040('0x14')](_0x7040('0x10'),_0x232be7,_0x2e2c2a[_0x7040('0x14')][_0x7040('0x16')]);return _0xadd725(_0x2e2c2a[_0x7040('0x14')]['message']);}logger['error'](_0x7040('0x10'),_0x232be7,_0x2e2c2a[_0x7040('0x14')][_0x7040('0x16')]);return _0x4e6008(_0x2e2c2a[_0x7040('0x14')][_0x7040('0x16')]);}else{logger['info'](_0x7040('0x10'),_0x232be7,_0x7040('0x11'));_0x4e6008(_0x2e2c2a[_0x7040('0x17')][_0x7040('0x16')]);}})['catch'](function(_0x4544b9){logger['error'](_0x7040('0x10'),_0x232be7,_0x4544b9);_0xadd725(_0x4544b9);});});}exports[_0x7040('0x18')]=function(_0x448e9a){var _0x40a2ee=this;return new Promise(function(_0x5dabd0,_0x4e4bf8){return db[_0x7040('0x19')][_0x7040('0x1a')](_0x448e9a[_0x7040('0x1b')],{'raw':_0x448e9a[_0x7040('0x1c')]?_0x448e9a[_0x7040('0x1c')][_0x7040('0x1d')]===undefined?!![]:![]:!![]})[_0x7040('0xe')](function(_0x532a23){logger[_0x7040('0xf')]('CreateOpenchannelQueueReport',_0x448e9a);logger[_0x7040('0x12')](_0x7040('0x18'),_0x448e9a,JSON[_0x7040('0x13')](_0x532a23));_0x5dabd0(_0x532a23);})[_0x7040('0x1e')](function(_0x3d4256){logger[_0x7040('0x14')](_0x7040('0x18'),_0x3d4256['message'],_0x448e9a);_0x4e4bf8(_0x40a2ee['error'](0x1f4,_0x3d4256[_0x7040('0x16')]));});});};exports[_0x7040('0x1f')]=function(_0x5baca4){var _0x23ace7=this;return new Promise(function(_0x1a4418,_0x3a83d6){return db[_0x7040('0x19')][_0x7040('0x20')](_0x5baca4[_0x7040('0x1b')],{'raw':_0x5baca4['options']?_0x5baca4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5baca4[_0x7040('0x1c')]?_0x5baca4[_0x7040('0x1c')][_0x7040('0x21')]||null:null,'attributes':_0x5baca4['options']?_0x5baca4['options'][_0x7040('0x22')]||null:null,'limit':_0x5baca4[_0x7040('0x1c')]?_0x5baca4['options'][_0x7040('0x23')]||null:null})[_0x7040('0xe')](function(_0x2a3dd0){logger[_0x7040('0xf')]('UpdateOpenchannelQueueReport',_0x5baca4);logger[_0x7040('0x12')](_0x7040('0x1f'),_0x5baca4,JSON[_0x7040('0x13')](_0x2a3dd0));_0x1a4418(_0x2a3dd0);})[_0x7040('0x1e')](function(_0x3cf85b){logger['error']('UpdateOpenchannelQueueReport',_0x3cf85b['message'],_0x5baca4);_0x3a83d6(_0x23ace7[_0x7040('0x14')](0x1f4,_0x3cf85b[_0x7040('0x16')]));});});}; \ No newline at end of file +var _0x74dd=['randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','OpenchannelQueueReport','create','body','options','raw','then','CreateOpenchannelQueueReport','debug','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash','util','moment'];(function(_0x288536,_0x369b51){var _0x525e94=function(_0x2fe9db){while(--_0x2fe9db){_0x288536['push'](_0x288536['shift']());}};_0x525e94(++_0x369b51);}(_0x74dd,0xc3));var _0xd74d=function(_0x49348a,_0x2ca546){_0x49348a=_0x49348a-0x0;var _0x209919=_0x74dd[_0x49348a];return _0x209919;};'use strict';var _=require(_0xd74d('0x0'));var util=require(_0xd74d('0x1'));var moment=require(_0xd74d('0x2'));var BPromise=require('bluebird');var rs=require(_0xd74d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd74d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd74d('0x5'))(_0xd74d('0x6'));var config=require('../../config/environment');var jayson=require(_0xd74d('0x7'));var client=jayson[_0xd74d('0x8')][_0xd74d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2afe4c,_0x5da3cc,_0x2a6d2b){return new BPromise(function(_0x1f620d,_0x1cb013){return client[_0xd74d('0xa')](_0x2afe4c,_0x2a6d2b)['then'](function(_0x367e1f){logger[_0xd74d('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5da3cc,'request\x20sent');logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x5da3cc,_0xd74d('0xc'),JSON[_0xd74d('0xd')](_0x367e1f));if(_0x367e1f[_0xd74d('0xe')]){if(_0x367e1f[_0xd74d('0xe')][_0xd74d('0xf')]===0x1f4){logger[_0xd74d('0xe')](_0xd74d('0x10'),_0x5da3cc,_0x367e1f[_0xd74d('0xe')][_0xd74d('0x11')]);return _0x1cb013(_0x367e1f[_0xd74d('0xe')][_0xd74d('0x11')]);}logger[_0xd74d('0xe')](_0xd74d('0x10'),_0x5da3cc,_0x367e1f[_0xd74d('0xe')][_0xd74d('0x11')]);return _0x1f620d(_0x367e1f[_0xd74d('0xe')][_0xd74d('0x11')]);}else{logger[_0xd74d('0xb')](_0xd74d('0x10'),_0x5da3cc,_0xd74d('0xc'));_0x1f620d(_0x367e1f[_0xd74d('0x12')]['message']);}})[_0xd74d('0x13')](function(_0x2ce920){logger[_0xd74d('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5da3cc,_0x2ce920);_0x1cb013(_0x2ce920);});});}exports['CreateOpenchannelQueueReport']=function(_0x263e3e){var _0x357d68=this;return new Promise(function(_0xa88fb2,_0x395119){return db[_0xd74d('0x14')][_0xd74d('0x15')](_0x263e3e[_0xd74d('0x16')],{'raw':_0x263e3e[_0xd74d('0x17')]?_0x263e3e[_0xd74d('0x17')][_0xd74d('0x18')]===undefined?!![]:![]:!![]})[_0xd74d('0x19')](function(_0x47136f){logger[_0xd74d('0xb')](_0xd74d('0x1a'),_0x263e3e);logger[_0xd74d('0x1b')]('CreateOpenchannelQueueReport',_0x263e3e,JSON[_0xd74d('0xd')](_0x47136f));_0xa88fb2(_0x47136f);})[_0xd74d('0x13')](function(_0x43b7e1){logger['error'](_0xd74d('0x1a'),_0x43b7e1[_0xd74d('0x11')],_0x263e3e);_0x395119(_0x357d68[_0xd74d('0xe')](0x1f4,_0x43b7e1['message']));});});};exports[_0xd74d('0x1c')]=function(_0x43ad0b){var _0x54454e=this;return new Promise(function(_0x350d61,_0x49789c){return db[_0xd74d('0x14')][_0xd74d('0x1d')](_0x43ad0b[_0xd74d('0x16')],{'raw':_0x43ad0b[_0xd74d('0x17')]?_0x43ad0b[_0xd74d('0x17')][_0xd74d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43ad0b[_0xd74d('0x17')]?_0x43ad0b['options'][_0xd74d('0x1e')]||null:null,'attributes':_0x43ad0b[_0xd74d('0x17')]?_0x43ad0b[_0xd74d('0x17')][_0xd74d('0x1f')]||null:null,'limit':_0x43ad0b[_0xd74d('0x17')]?_0x43ad0b['options'][_0xd74d('0x20')]||null:null})['then'](function(_0x2897ec){logger[_0xd74d('0xb')](_0xd74d('0x1c'),_0x43ad0b);logger[_0xd74d('0x1b')](_0xd74d('0x1c'),_0x43ad0b,JSON['stringify'](_0x2897ec));_0x350d61(_0x2897ec);})['catch'](function(_0x5938e2){logger[_0xd74d('0xe')](_0xd74d('0x1c'),_0x5938e2[_0xd74d('0x11')],_0x43ad0b);_0x49789c(_0x54454e[_0xd74d('0xe')](0x1f4,_0x5938e2[_0xd74d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 6d10a5c..a7a1143 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(_0x54c9dd,_0x233a86){var _0x855156=function(_0x2dd60b){while(--_0x2dd60b){_0x54c9dd['push'](_0x54c9dd['shift']());}};_0x855156(++_0x233a86);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x1f8053,_0x111077){var _0x174fd8=function(_0x2f92fc){while(--_0x2f92fc){_0x1f8053['push'](_0x1f8053['shift']());}};_0x174fd8(++_0x111077);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 2079389..a8b8778 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 _0x8ddf=['queue','DATE','moment','sequelize','exports','STRING','ENUM','account','agent'];(function(_0x548ad6,_0x1486a1){var _0x1e5656=function(_0x493678){while(--_0x493678){_0x548ad6['push'](_0x548ad6['shift']());}};_0x1e5656(++_0x1486a1);}(_0x8ddf,0x1cd));var _0xf8dd=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x8ddf[_0xf0bcac];return _0x4e4c65;};'use strict';var moment=require(_0xf8dd('0x0'));var Sequelize=require(_0xf8dd('0x1'));module[_0xf8dd('0x2')]={'uniqueid':{'type':Sequelize[_0xf8dd('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xf8dd('0x4')](_0xf8dd('0x5'),_0xf8dd('0x6'),_0xf8dd('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xf8dd('0x8')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x100e=['sequelize','exports','STRING','account','queue','moment'];(function(_0x4aa29e,_0x263652){var _0x35d526=function(_0x46edc2){while(--_0x46edc2){_0x4aa29e['push'](_0x4aa29e['shift']());}};_0x35d526(++_0x263652);}(_0x100e,0xcb));var _0xe100=function(_0x25b24a,_0x1c0163){_0x25b24a=_0x25b24a-0x0;var _0x224e68=_0x100e[_0x25b24a];return _0x224e68;};'use strict';var moment=require(_0xe100('0x0'));var Sequelize=require(_0xe100('0x1'));module[_0xe100('0x2')]={'uniqueid':{'type':Sequelize[_0xe100('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe100('0x4'),'agent',_0xe100('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index c74979b..55418de 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 _0xa902=['to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','key','map','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','sort','pick','where','type','merge','options','OpenchannelTransferReport','include','findAll','rows','catch','show','params','filtears','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox'];(function(_0x43a436,_0x25a539){var _0x1ff4fc=function(_0x3226ad){while(--_0x3226ad){_0x43a436['push'](_0x43a436['shift']());}};_0x1ff4fc(++_0x25a539);}(_0xa902,0x8d));var _0x2a90=function(_0x1183a8,_0x50a28c){_0x1183a8=_0x1183a8-0x0;var _0x319a53=_0xa902[_0x1183a8];return _0x319a53;};'use strict';var pdf=require(_0x2a90('0x0'));var emlformat=require(_0x2a90('0x1'));var rimraf=require(_0x2a90('0x2'));var zipdir=require(_0x2a90('0x3'));var jsonpatch=require(_0x2a90('0x4'));var rp=require('request-promise');var moment=require(_0x2a90('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2a90('0x6'));var path=require(_0x2a90('0x7'));var sox=require(_0x2a90('0x8'));var csv=require(_0x2a90('0x9'));var ejs=require(_0x2a90('0xa'));var fs=require('fs');var _=require(_0x2a90('0xb'));var squel=require('squel');var crypto=require(_0x2a90('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2a90('0x9'));var querystring=require(_0x2a90('0xd'));var Papa=require(_0x2a90('0xe'));var Redis=require(_0x2a90('0xf'));var authService=require(_0x2a90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2a90('0x11'));var hardwareService=require(_0x2a90('0x12'));var logger=require(_0x2a90('0x13'))(_0x2a90('0x14'));var utils=require('../../config/utils');var config=require(_0x2a90('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a90('0x16'))['db'];function respondWithStatusCode(_0x57458a,_0x1f6953){_0x1f6953=_0x1f6953||0xcc;return function(_0x57aee3){if(_0x57aee3){return _0x57458a[_0x2a90('0x17')](_0x1f6953);}return _0x57458a[_0x2a90('0x18')](_0x1f6953)[_0x2a90('0x19')]();};}function respondWithResult(_0x4c328b,_0x56d1b8){_0x56d1b8=_0x56d1b8||0xc8;return function(_0x57227c){if(_0x57227c){return _0x4c328b[_0x2a90('0x18')](_0x56d1b8)[_0x2a90('0x1a')](_0x57227c);}};}function respondWithFilteredResult(_0x5a2682,_0x1ff63d){return function(_0x21c648){if(_0x21c648){var _0x312782=_0x21c648[_0x2a90('0x1b')],_0x25bd0e=_0x1ff63d[_0x2a90('0x1c')],_0x3200b4=_0x1ff63d[_0x2a90('0x1c')]+_0x1ff63d['limit'],_0x37858e;if(_0x3200b4>=_0x312782){_0x3200b4=_0x312782;_0x37858e=0xc8;}else{_0x37858e=0xce;}_0x5a2682[_0x2a90('0x18')](_0x37858e);return _0x5a2682[_0x2a90('0x1d')](_0x2a90('0x1e'),_0x25bd0e+'-'+_0x3200b4+'/'+_0x312782)['json'](_0x21c648);}return null;};}function patchUpdates(_0x1facfb){return function(_0x1f51a6){try{jsonpatch[_0x2a90('0x1f')](_0x1f51a6,_0x1facfb,!![]);}catch(_0x149a2f){return BPromise[_0x2a90('0x20')](_0x149a2f);}return _0x1f51a6[_0x2a90('0x21')]();};}function saveUpdates(_0x312cd5,_0x114d42){return function(_0xf97adb){if(_0xf97adb){return _0xf97adb[_0x2a90('0x22')](_0x312cd5)[_0x2a90('0x23')](function(_0x3ba52a){return _0x3ba52a;});}return null;};}function removeEntity(_0x4fdd62,_0x3da7d0){return function(_0x217873){if(_0x217873){return _0x217873[_0x2a90('0x24')]()[_0x2a90('0x23')](function(){_0x4fdd62['status'](0xcc)[_0x2a90('0x19')]();});}};}function handleEntityNotFound(_0xd033d,_0x4ed9e6){return function(_0x1bcfd7){if(!_0x1bcfd7){_0xd033d[_0x2a90('0x17')](0x194);}return _0x1bcfd7;};}function handleError(_0x10a6dd,_0x2a4e28){_0x2a4e28=_0x2a4e28||0x1f4;return function(_0x2a212c){logger[_0x2a90('0x25')](_0x2a212c[_0x2a90('0x26')]);if(_0x2a212c[_0x2a90('0x27')]){delete _0x2a212c['name'];}_0x10a6dd[_0x2a90('0x18')](_0x2a4e28)[_0x2a90('0x28')](_0x2a212c);};}exports[_0x2a90('0x29')]=function(_0x40c61a,_0x8544e5){var _0x5208d8={},_0x5a51f7={},_0x293765={'count':0x0,'rows':[]};var _0x4ed64a=_['map'](db['OpenchannelTransferReport'][_0x2a90('0x2a')],function(_0x3c78f5){return{'name':_0x3c78f5['fieldName'],'type':_0x3c78f5['type'][_0x2a90('0x2b')]};});_0x5a51f7['model']=_[_0x2a90('0x2c')](_0x4ed64a,_0x2a90('0x27'));_0x5a51f7[_0x2a90('0x2d')]=_[_0x2a90('0x2e')](_0x40c61a[_0x2a90('0x2d')]);_0x5a51f7[_0x2a90('0x2f')]=_[_0x2a90('0x30')](_0x5a51f7['model'],_0x5a51f7[_0x2a90('0x2d')]);_0x5208d8[_0x2a90('0x31')]=_[_0x2a90('0x30')](_0x5a51f7['model'],qs[_0x2a90('0x32')](_0x40c61a[_0x2a90('0x2d')][_0x2a90('0x32')]));_0x5208d8[_0x2a90('0x31')]=_0x5208d8['attributes'][_0x2a90('0x33')]?_0x5208d8[_0x2a90('0x31')]:_0x5a51f7[_0x2a90('0x34')];if(!_0x40c61a[_0x2a90('0x2d')][_0x2a90('0x35')](_0x2a90('0x36'))){_0x5208d8['limit']=qs[_0x2a90('0x37')](_0x40c61a[_0x2a90('0x2d')][_0x2a90('0x37')]);_0x5208d8[_0x2a90('0x1c')]=qs['offset'](_0x40c61a[_0x2a90('0x2d')][_0x2a90('0x1c')]);}_0x5208d8['order']=qs[_0x2a90('0x38')](_0x40c61a[_0x2a90('0x2d')]['sort']);_0x5208d8['where']=qs[_0x2a90('0x2f')](_[_0x2a90('0x39')](_0x40c61a[_0x2a90('0x2d')],_0x5a51f7['filters']),_0x4ed64a);if(_0x40c61a[_0x2a90('0x2d')]['filter']){_0x5208d8[_0x2a90('0x3a')]=_['merge'](_0x5208d8[_0x2a90('0x3a')],{'$or':_['map'](_0x4ed64a,function(_0x5322dc){if(_0x5322dc[_0x2a90('0x3b')]!=='VIRTUAL'){var _0x463721={};_0x463721[_0x5322dc[_0x2a90('0x27')]]={'$like':'%'+_0x40c61a[_0x2a90('0x2d')]['filter']+'%'};return _0x463721;}})});}_0x5208d8=_[_0x2a90('0x3c')]({},_0x5208d8,_0x40c61a[_0x2a90('0x3d')]);var _0x3be438={'where':_0x5208d8['where']};return db[_0x2a90('0x3e')][_0x2a90('0x1b')](_0x3be438)[_0x2a90('0x23')](function(_0x580667){_0x293765[_0x2a90('0x1b')]=_0x580667;if(_0x40c61a[_0x2a90('0x2d')]['includeAll']){_0x5208d8[_0x2a90('0x3f')]=[{'all':!![]}];}return db[_0x2a90('0x3e')][_0x2a90('0x40')](_0x5208d8);})[_0x2a90('0x23')](function(_0x1af955){_0x293765[_0x2a90('0x41')]=_0x1af955;return _0x293765;})[_0x2a90('0x23')](respondWithFilteredResult(_0x8544e5,_0x5208d8))[_0x2a90('0x42')](handleError(_0x8544e5,null));};exports[_0x2a90('0x43')]=function(_0x18e1b9,_0x45b41c){var _0x3dba8a={'raw':!![],'where':{'id':_0x18e1b9[_0x2a90('0x44')]['id']}},_0x319610={};_0x319610['model']=_[_0x2a90('0x2e')](db[_0x2a90('0x3e')]['rawAttributes']);_0x319610[_0x2a90('0x2d')]=_[_0x2a90('0x2e')](_0x18e1b9[_0x2a90('0x2d')]);_0x319610[_0x2a90('0x45')]=_[_0x2a90('0x30')](_0x319610['model'],_0x319610[_0x2a90('0x2d')]);_0x3dba8a['attributes']=_[_0x2a90('0x30')](_0x319610['model'],qs[_0x2a90('0x32')](_0x18e1b9[_0x2a90('0x2d')][_0x2a90('0x32')]));_0x3dba8a[_0x2a90('0x31')]=_0x3dba8a[_0x2a90('0x31')][_0x2a90('0x33')]?_0x3dba8a[_0x2a90('0x31')]:_0x319610['model'];if(_0x18e1b9['query'][_0x2a90('0x46')]){_0x3dba8a[_0x2a90('0x3f')]=[{'all':!![]}];}_0x3dba8a=_[_0x2a90('0x3c')]({},_0x3dba8a,_0x18e1b9[_0x2a90('0x3d')]);return db[_0x2a90('0x3e')][_0x2a90('0x47')](_0x3dba8a)[_0x2a90('0x23')](handleEntityNotFound(_0x45b41c,null))[_0x2a90('0x23')](respondWithResult(_0x45b41c,null))['catch'](handleError(_0x45b41c,null));};exports[_0x2a90('0x48')]=function(_0x502f48,_0x3e0380){return db[_0x2a90('0x3e')]['create'](_0x502f48[_0x2a90('0x49')],{})[_0x2a90('0x23')](respondWithResult(_0x3e0380,0xc9))[_0x2a90('0x42')](handleError(_0x3e0380,null));};exports[_0x2a90('0x22')]=function(_0x175d59,_0x43a931){if(_0x175d59[_0x2a90('0x49')]['id']){delete _0x175d59['body']['id'];}return db['OpenchannelTransferReport'][_0x2a90('0x47')]({'where':{'id':_0x175d59[_0x2a90('0x44')]['id']}})[_0x2a90('0x23')](handleEntityNotFound(_0x43a931,null))[_0x2a90('0x23')](saveUpdates(_0x175d59[_0x2a90('0x49')],null))['then'](respondWithResult(_0x43a931,null))['catch'](handleError(_0x43a931,null));};exports[_0x2a90('0x24')]=function(_0x386e75,_0x53d682){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x386e75[_0x2a90('0x44')]['id']}})['then'](handleEntityNotFound(_0x53d682,null))[_0x2a90('0x23')](removeEntity(_0x53d682,null))[_0x2a90('0x42')](handleError(_0x53d682,null));};exports[_0x2a90('0x4a')]=function(_0x19e997,_0x3b2630){return db[_0x2a90('0x3e')]['describe']()[_0x2a90('0x23')](respondWithResult(_0x3b2630,null))[_0x2a90('0x42')](handleError(_0x3b2630,null));}; \ No newline at end of file +var _0x5eb1=['offset','limit','set','Content-Range','reject','save','then','end','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','OpenchannelTransferReport','count','includeAll','include','findAll','rows','catch','show','params','filtears','fields','options','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status'];(function(_0x15b294,_0x20f343){var _0x4322b7=function(_0x11b562){while(--_0x11b562){_0x15b294['push'](_0x15b294['shift']());}};_0x4322b7(++_0x20f343);}(_0x5eb1,0x7c));var _0x15eb=function(_0x5a516a,_0x541200){_0x5a516a=_0x5a516a-0x0;var _0x38c0d9=_0x5eb1[_0x5a516a];return _0x38c0d9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x15eb('0x0'));var rimraf=require(_0x15eb('0x1'));var zipdir=require(_0x15eb('0x2'));var jsonpatch=require(_0x15eb('0x3'));var rp=require(_0x15eb('0x4'));var moment=require(_0x15eb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x15eb('0x6'));var util=require(_0x15eb('0x7'));var path=require(_0x15eb('0x8'));var sox=require(_0x15eb('0x9'));var csv=require('to-csv');var ejs=require(_0x15eb('0xa'));var fs=require('fs');var _=require(_0x15eb('0xb'));var squel=require('squel');var crypto=require(_0x15eb('0xc'));var jsforce=require(_0x15eb('0xd'));var deskjs=require(_0x15eb('0xe'));var toCsv=require(_0x15eb('0xf'));var querystring=require(_0x15eb('0x10'));var Papa=require(_0x15eb('0x11'));var Redis=require(_0x15eb('0x12'));var authService=require(_0x15eb('0x13'));var qs=require(_0x15eb('0x14'));var as=require(_0x15eb('0x15'));var hardwareService=require(_0x15eb('0x16'));var logger=require(_0x15eb('0x17'))(_0x15eb('0x18'));var utils=require('../../config/utils');var config=require(_0x15eb('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x498a0c,_0xda1ddf){_0xda1ddf=_0xda1ddf||0xcc;return function(_0x330436){if(_0x330436){return _0x498a0c[_0x15eb('0x1a')](_0xda1ddf);}return _0x498a0c[_0x15eb('0x1b')](_0xda1ddf)['end']();};}function respondWithResult(_0x1d5326,_0x3b921c){_0x3b921c=_0x3b921c||0xc8;return function(_0x212f04){if(_0x212f04){return _0x1d5326[_0x15eb('0x1b')](_0x3b921c)['json'](_0x212f04);}};}function respondWithFilteredResult(_0x48aed7,_0x544e7c){return function(_0x500d58){if(_0x500d58){var _0x1188e0=_0x500d58['count'],_0x52223c=_0x544e7c[_0x15eb('0x1c')],_0x53efa1=_0x544e7c['offset']+_0x544e7c[_0x15eb('0x1d')],_0x3a78e9;if(_0x53efa1>=_0x1188e0){_0x53efa1=_0x1188e0;_0x3a78e9=0xc8;}else{_0x3a78e9=0xce;}_0x48aed7['status'](_0x3a78e9);return _0x48aed7[_0x15eb('0x1e')](_0x15eb('0x1f'),_0x52223c+'-'+_0x53efa1+'/'+_0x1188e0)['json'](_0x500d58);}return null;};}function patchUpdates(_0xa1def8){return function(_0x431ba8){try{jsonpatch['apply'](_0x431ba8,_0xa1def8,!![]);}catch(_0x12f52d){return BPromise[_0x15eb('0x20')](_0x12f52d);}return _0x431ba8[_0x15eb('0x21')]();};}function saveUpdates(_0x149332,_0xb66333){return function(_0x148b93){if(_0x148b93){return _0x148b93['update'](_0x149332)[_0x15eb('0x22')](function(_0x4e4d75){return _0x4e4d75;});}return null;};}function removeEntity(_0x2603fe,_0x49915b){return function(_0x195ae2){if(_0x195ae2){return _0x195ae2['destroy']()[_0x15eb('0x22')](function(){_0x2603fe[_0x15eb('0x1b')](0xcc)[_0x15eb('0x23')]();});}};}function handleEntityNotFound(_0x9b0a52,_0x14d66e){return function(_0x1ac1fe){if(!_0x1ac1fe){_0x9b0a52[_0x15eb('0x1a')](0x194);}return _0x1ac1fe;};}function handleError(_0x44207c,_0x1fa175){_0x1fa175=_0x1fa175||0x1f4;return function(_0x17c2ef){logger['error'](_0x17c2ef[_0x15eb('0x24')]);if(_0x17c2ef[_0x15eb('0x25')]){delete _0x17c2ef[_0x15eb('0x25')];}_0x44207c[_0x15eb('0x1b')](_0x1fa175)[_0x15eb('0x26')](_0x17c2ef);};}exports[_0x15eb('0x27')]=function(_0x155fa2,_0x512007){var _0x4da36d={},_0x1706ed={},_0x1def52={'count':0x0,'rows':[]};var _0x62c8ff=_[_0x15eb('0x28')](db['OpenchannelTransferReport'][_0x15eb('0x29')],function(_0x5f2df5){return{'name':_0x5f2df5[_0x15eb('0x2a')],'type':_0x5f2df5['type'][_0x15eb('0x2b')]};});_0x1706ed[_0x15eb('0x2c')]=_[_0x15eb('0x28')](_0x62c8ff,_0x15eb('0x25'));_0x1706ed[_0x15eb('0x2d')]=_[_0x15eb('0x2e')](_0x155fa2['query']);_0x1706ed[_0x15eb('0x2f')]=_[_0x15eb('0x30')](_0x1706ed[_0x15eb('0x2c')],_0x1706ed['query']);_0x4da36d['attributes']=_[_0x15eb('0x30')](_0x1706ed[_0x15eb('0x2c')],qs['fields'](_0x155fa2['query']['fields']));_0x4da36d[_0x15eb('0x31')]=_0x4da36d['attributes'][_0x15eb('0x32')]?_0x4da36d[_0x15eb('0x31')]:_0x1706ed['model'];if(!_0x155fa2[_0x15eb('0x2d')][_0x15eb('0x33')](_0x15eb('0x34'))){_0x4da36d[_0x15eb('0x1d')]=qs[_0x15eb('0x1d')](_0x155fa2[_0x15eb('0x2d')]['limit']);_0x4da36d[_0x15eb('0x1c')]=qs[_0x15eb('0x1c')](_0x155fa2[_0x15eb('0x2d')][_0x15eb('0x1c')]);}_0x4da36d[_0x15eb('0x35')]=qs['sort'](_0x155fa2[_0x15eb('0x2d')][_0x15eb('0x36')]);_0x4da36d['where']=qs[_0x15eb('0x2f')](_[_0x15eb('0x37')](_0x155fa2['query'],_0x1706ed[_0x15eb('0x2f')]),_0x62c8ff);if(_0x155fa2['query'][_0x15eb('0x38')]){_0x4da36d['where']=_[_0x15eb('0x39')](_0x4da36d['where'],{'$or':_[_0x15eb('0x28')](_0x62c8ff,function(_0x401bbd){if(_0x401bbd['type']!=='VIRTUAL'){var _0x3774dd={};_0x3774dd[_0x401bbd[_0x15eb('0x25')]]={'$like':'%'+_0x155fa2[_0x15eb('0x2d')]['filter']+'%'};return _0x3774dd;}})});}_0x4da36d=_[_0x15eb('0x39')]({},_0x4da36d,_0x155fa2['options']);var _0x2830={'where':_0x4da36d['where']};return db[_0x15eb('0x3a')][_0x15eb('0x3b')](_0x2830)[_0x15eb('0x22')](function(_0x2f76ed){_0x1def52[_0x15eb('0x3b')]=_0x2f76ed;if(_0x155fa2[_0x15eb('0x2d')][_0x15eb('0x3c')]){_0x4da36d[_0x15eb('0x3d')]=[{'all':!![]}];}return db[_0x15eb('0x3a')][_0x15eb('0x3e')](_0x4da36d);})[_0x15eb('0x22')](function(_0x55edab){_0x1def52[_0x15eb('0x3f')]=_0x55edab;return _0x1def52;})[_0x15eb('0x22')](respondWithFilteredResult(_0x512007,_0x4da36d))[_0x15eb('0x40')](handleError(_0x512007,null));};exports[_0x15eb('0x41')]=function(_0x4b5ce1,_0x1618e5){var _0x63b7e8={'raw':!![],'where':{'id':_0x4b5ce1[_0x15eb('0x42')]['id']}},_0x414a5e={};_0x414a5e[_0x15eb('0x2c')]=_['keys'](db[_0x15eb('0x3a')][_0x15eb('0x29')]);_0x414a5e['query']=_['keys'](_0x4b5ce1[_0x15eb('0x2d')]);_0x414a5e[_0x15eb('0x43')]=_[_0x15eb('0x30')](_0x414a5e['model'],_0x414a5e[_0x15eb('0x2d')]);_0x63b7e8[_0x15eb('0x31')]=_['intersection'](_0x414a5e[_0x15eb('0x2c')],qs[_0x15eb('0x44')](_0x4b5ce1[_0x15eb('0x2d')][_0x15eb('0x44')]));_0x63b7e8[_0x15eb('0x31')]=_0x63b7e8[_0x15eb('0x31')]['length']?_0x63b7e8[_0x15eb('0x31')]:_0x414a5e[_0x15eb('0x2c')];if(_0x4b5ce1['query'][_0x15eb('0x3c')]){_0x63b7e8[_0x15eb('0x3d')]=[{'all':!![]}];}_0x63b7e8=_[_0x15eb('0x39')]({},_0x63b7e8,_0x4b5ce1[_0x15eb('0x45')]);return db[_0x15eb('0x3a')][_0x15eb('0x46')](_0x63b7e8)['then'](handleEntityNotFound(_0x1618e5,null))[_0x15eb('0x22')](respondWithResult(_0x1618e5,null))['catch'](handleError(_0x1618e5,null));};exports[_0x15eb('0x47')]=function(_0x5aa14d,_0x58765f){return db[_0x15eb('0x3a')][_0x15eb('0x47')](_0x5aa14d[_0x15eb('0x48')],{})['then'](respondWithResult(_0x58765f,0xc9))['catch'](handleError(_0x58765f,null));};exports[_0x15eb('0x49')]=function(_0x47978c,_0x100c2f){if(_0x47978c['body']['id']){delete _0x47978c[_0x15eb('0x48')]['id'];}return db[_0x15eb('0x3a')][_0x15eb('0x46')]({'where':{'id':_0x47978c[_0x15eb('0x42')]['id']}})['then'](handleEntityNotFound(_0x100c2f,null))[_0x15eb('0x22')](saveUpdates(_0x47978c[_0x15eb('0x48')],null))['then'](respondWithResult(_0x100c2f,null))[_0x15eb('0x40')](handleError(_0x100c2f,null));};exports[_0x15eb('0x4a')]=function(_0x31423e,_0x26fb24){return db[_0x15eb('0x3a')][_0x15eb('0x46')]({'where':{'id':_0x31423e[_0x15eb('0x42')]['id']}})[_0x15eb('0x22')](handleEntityNotFound(_0x26fb24,null))[_0x15eb('0x22')](removeEntity(_0x26fb24,null))[_0x15eb('0x40')](handleError(_0x26fb24,null));};exports[_0x15eb('0x4b')]=function(_0x5ef1d8,_0x4474fc){return db[_0x15eb('0x3a')]['describe']()[_0x15eb('0x22')](respondWithResult(_0x4474fc,null))[_0x15eb('0x40')](handleError(_0x4474fc,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index c38be3e..3b761ef 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 _0x200d=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','exports','OpenchannelTransferReport','report_openchannel_transfer'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x200d,0x114));var _0xd200=function(_0x2d2623,_0x1aaea0){_0x2d2623=_0x2d2623-0x0;var _0x28f6c1=_0x200d[_0x2d2623];return _0x28f6c1;};'use strict';var _=require(_0xd200('0x0'));var util=require(_0xd200('0x1'));var logger=require(_0xd200('0x2'))(_0xd200('0x3'));var moment=require('moment');var BPromise=require(_0xd200('0x4'));var rp=require(_0xd200('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd200('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0xd200('0x7')]=function(_0x1523c3,_0x3f0669){return _0x1523c3['define'](_0xd200('0x8'),attributes,{'tableName':_0xd200('0x9'),'paranoid':![],'indexes':[{'name':_0xd200('0xa'),'fields':[_0xd200('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cad=['../../config/environment','define','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x40bc01,_0x22a9a9){var _0x42365b=function(_0x2d3d88){while(--_0x2d3d88){_0x40bc01['push'](_0x40bc01['shift']());}};_0x42365b(++_0x22a9a9);}(_0x1cad,0x1a7));var _0xd1ca=function(_0x24f672,_0x134611){_0x24f672=_0x24f672-0x0;var _0x5590fa=_0x1cad[_0x24f672];return _0x5590fa;};'use strict';var _=require(_0xd1ca('0x0'));var util=require(_0xd1ca('0x1'));var logger=require(_0xd1ca('0x2'))(_0xd1ca('0x3'));var moment=require(_0xd1ca('0x4'));var BPromise=require(_0xd1ca('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd1ca('0x6'));var config=require(_0xd1ca('0x7'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x4aa1e0,_0x2630fc){return _0x4aa1e0[_0xd1ca('0x8')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xd1ca('0x9'),'fields':[_0xd1ca('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 4b61d81..afce296 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 _0xa8f4=['client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa8f4,0x194));var _0x4a8f=function(_0x58e36b,_0x3a1d01){_0x58e36b=_0x58e36b-0x0;var _0x3706a8=_0xa8f4[_0x58e36b];return _0x3706a8;};'use strict';var _=require(_0x4a8f('0x0'));var util=require(_0x4a8f('0x1'));var moment=require('moment');var BPromise=require(_0x4a8f('0x2'));var rs=require(_0x4a8f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a8f('0x4'))['db'];var utils=require(_0x4a8f('0x5'));var logger=require(_0x4a8f('0x6'))(_0x4a8f('0x7'));var config=require(_0x4a8f('0x8'));var jayson=require(_0x4a8f('0x9'));var client=jayson[_0x4a8f('0xa')][_0x4a8f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16714b,_0x5b692b,_0x311e5d){return new BPromise(function(_0x832f02,_0x377639){return client[_0x4a8f('0xc')](_0x16714b,_0x311e5d)[_0x4a8f('0xd')](function(_0x3670be){logger[_0x4a8f('0xe')](_0x4a8f('0xf'),_0x5b692b,_0x4a8f('0x10'));logger['debug'](_0x4a8f('0x11'),_0x5b692b,'request\x20sent',JSON[_0x4a8f('0x12')](_0x3670be));if(_0x3670be[_0x4a8f('0x13')]){if(_0x3670be['error']['code']===0x1f4){logger[_0x4a8f('0x13')](_0x4a8f('0xf'),_0x5b692b,_0x3670be[_0x4a8f('0x13')]['message']);return _0x377639(_0x3670be[_0x4a8f('0x13')][_0x4a8f('0x14')]);}logger[_0x4a8f('0x13')](_0x4a8f('0xf'),_0x5b692b,_0x3670be['error']['message']);return _0x832f02(_0x3670be[_0x4a8f('0x13')]['message']);}else{logger['info'](_0x4a8f('0xf'),_0x5b692b,_0x4a8f('0x10'));_0x832f02(_0x3670be[_0x4a8f('0x15')][_0x4a8f('0x14')]);}})[_0x4a8f('0x16')](function(_0x32a26f){logger[_0x4a8f('0x13')](_0x4a8f('0xf'),_0x5b692b,_0x32a26f);_0x377639(_0x32a26f);});});} \ No newline at end of file +var _0xbfa3=['info','OpenchannelTransferReport,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x4df04b,_0x52b8cb){var _0x5ce10e=function(_0x1dd148){while(--_0x1dd148){_0x4df04b['push'](_0x4df04b['shift']());}};_0x5ce10e(++_0x52b8cb);}(_0xbfa3,0x70));var _0x3bfa=function(_0x3a7be9,_0x17d289){_0x3a7be9=_0x3a7be9-0x0;var _0x240707=_0xbfa3[_0x3a7be9];return _0x240707;};'use strict';var _=require(_0x3bfa('0x0'));var util=require(_0x3bfa('0x1'));var moment=require(_0x3bfa('0x2'));var BPromise=require(_0x3bfa('0x3'));var rs=require(_0x3bfa('0x4'));var fs=require('fs');var Redis=require(_0x3bfa('0x5'));var db=require(_0x3bfa('0x6'))['db'];var utils=require(_0x3bfa('0x7'));var logger=require(_0x3bfa('0x8'))(_0x3bfa('0x9'));var config=require(_0x3bfa('0xa'));var jayson=require(_0x3bfa('0xb'));var client=jayson[_0x3bfa('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bf77c,_0x9b6101,_0x4f2721){return new BPromise(function(_0x289d72,_0x396e4b){return client[_0x3bfa('0xd')](_0x1bf77c,_0x4f2721)['then'](function(_0x3978c3){logger[_0x3bfa('0xe')](_0x3bfa('0xf'),_0x9b6101,'request\x20sent');logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x9b6101,'request\x20sent',JSON[_0x3bfa('0x10')](_0x3978c3));if(_0x3978c3[_0x3bfa('0x11')]){if(_0x3978c3['error'][_0x3bfa('0x12')]===0x1f4){logger[_0x3bfa('0x11')](_0x3bfa('0xf'),_0x9b6101,_0x3978c3[_0x3bfa('0x11')][_0x3bfa('0x13')]);return _0x396e4b(_0x3978c3[_0x3bfa('0x11')][_0x3bfa('0x13')]);}logger[_0x3bfa('0x11')](_0x3bfa('0xf'),_0x9b6101,_0x3978c3[_0x3bfa('0x11')][_0x3bfa('0x13')]);return _0x289d72(_0x3978c3['error'][_0x3bfa('0x13')]);}else{logger[_0x3bfa('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x9b6101,'request\x20sent');_0x289d72(_0x3978c3[_0x3bfa('0x14')][_0x3bfa('0x13')]);}})['catch'](function(_0x45a989){logger[_0x3bfa('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x9b6101,_0x45a989);_0x396e4b(_0x45a989);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index a5acd30..b2240d5 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 _0x568a=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','path','connect-timeout'];(function(_0x35783b,_0x1be2fa){var _0x19e19b=function(_0x3fd261){while(--_0x3fd261){_0x35783b['push'](_0x35783b['shift']());}};_0x19e19b(++_0x1be2fa);}(_0x568a,0x10c));var _0xa568=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x568a[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa568('0x0'));var timeout=require(_0xa568('0x1'));var express=require(_0xa568('0x2'));var router=express[_0xa568('0x3')]();var auth=require(_0xa568('0x4'));var interaction=require(_0xa568('0x5'));var config=require(_0xa568('0x6'));var controller=require('./pause.controller');router[_0xa568('0x7')]('/',auth['isAuthenticated'](),controller[_0xa568('0x8')]);router[_0xa568('0x7')](_0xa568('0x9'),auth[_0xa568('0xa')](),controller[_0xa568('0xb')]);router[_0xa568('0xc')]('/',auth['isAuthenticated'](),controller[_0xa568('0xd')]);router[_0xa568('0xe')](_0xa568('0x9'),auth[_0xa568('0xa')](),controller[_0xa568('0xf')]);router['delete'](_0xa568('0x9'),auth[_0xa568('0xa')](),controller[_0xa568('0x10')]);module[_0xa568('0x11')]=router; \ No newline at end of file +var _0xefdf=['multer','util','path','connect-timeout','express','../../components/interaction/service','./pause.controller','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports'];(function(_0x176865,_0x465e53){var _0x2bc1e1=function(_0x185001){while(--_0x185001){_0x176865['push'](_0x176865['shift']());}};_0x2bc1e1(++_0x465e53);}(_0xefdf,0x1dc));var _0xfefd=function(_0x12085d,_0x896e5e){_0x12085d=_0x12085d-0x0;var _0x3c0c45=_0xefdf[_0x12085d];return _0x3c0c45;};'use strict';var multer=require(_0xfefd('0x0'));var util=require(_0xfefd('0x1'));var path=require(_0xfefd('0x2'));var timeout=require(_0xfefd('0x3'));var express=require(_0xfefd('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfefd('0x5'));var config=require('../../config/environment');var controller=require(_0xfefd('0x6'));router['get']('/',auth[_0xfefd('0x7')](),controller[_0xfefd('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xfefd('0x9')]);router[_0xfefd('0xa')]('/',auth[_0xfefd('0x7')](),controller[_0xfefd('0xb')]);router[_0xfefd('0xc')](_0xfefd('0xd'),auth[_0xfefd('0x7')](),controller[_0xfefd('0xe')]);router[_0xfefd('0xf')](_0xfefd('0xd'),auth[_0xfefd('0x7')](),controller['destroy']);module[_0xfefd('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 843cd9e..ad0b60e 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 _0xfa23=['STRING','name','sequelize','exports'];(function(_0x51f575,_0x49918f){var _0x47e06d=function(_0x31c535){while(--_0x31c535){_0x51f575['push'](_0x51f575['shift']());}};_0x47e06d(++_0x49918f);}(_0xfa23,0xe2));var _0x3fa2=function(_0x26333b,_0x56470d){_0x26333b=_0x26333b-0x0;var _0x404306=_0xfa23[_0x26333b];return _0x404306;};'use strict';var Sequelize=require(_0x3fa2('0x0'));module[_0x3fa2('0x1')]={'name':{'type':Sequelize[_0x3fa2('0x2')],'unique':_0x3fa2('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3fa2('0x2')]}}; \ No newline at end of file +var _0x243a=['STRING','name','sequelize'];(function(_0x1b8b03,_0x3e7d34){var _0x58797d=function(_0x133b2a){while(--_0x133b2a){_0x1b8b03['push'](_0x1b8b03['shift']());}};_0x58797d(++_0x3e7d34);}(_0x243a,0x10d));var _0xa243=function(_0x762db0,_0x2a64e7){_0x762db0=_0x762db0-0x0;var _0x5522e1=_0x243a[_0x762db0];return _0x5522e1;};'use strict';var Sequelize=require(_0xa243('0x0'));module['exports']={'name':{'type':Sequelize[_0xa243('0x1')],'unique':_0xa243('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xa243('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 43035de..90c53fd 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 _0xdcff=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','update','destroy','then','get','Pauses','UserProfileResource','sendStatus','error','name','send','index','map','Pause','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','filtears','length','create','user'];(function(_0x1f3fc0,_0x49c377){var _0x420399=function(_0x44c3e5){while(--_0x44c3e5){_0x1f3fc0['push'](_0x1f3fc0['shift']());}};_0x420399(++_0x49c377);}(_0xdcff,0x1e1));var _0xfdcf=function(_0x4ec6ac,_0x1fdd0f){_0x4ec6ac=_0x4ec6ac-0x0;var _0x4c8a8b=_0xdcff[_0x4ec6ac];return _0x4c8a8b;};'use strict';var pdf=require(_0xfdcf('0x0'));var emlformat=require(_0xfdcf('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfdcf('0x2'));var jsonpatch=require(_0xfdcf('0x3'));var rp=require('request-promise');var moment=require(_0xfdcf('0x4'));var BPromise=require(_0xfdcf('0x5'));var Mustache=require('mustache');var util=require(_0xfdcf('0x6'));var path=require(_0xfdcf('0x7'));var sox=require('sox');var csv=require(_0xfdcf('0x8'));var ejs=require(_0xfdcf('0x9'));var fs=require('fs');var _=require(_0xfdcf('0xa'));var squel=require('squel');var crypto=require(_0xfdcf('0xb'));var jsforce=require(_0xfdcf('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfdcf('0xd'));var Redis=require(_0xfdcf('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfdcf('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfdcf('0x10'))(_0xfdcf('0x11'));var utils=require(_0xfdcf('0x12'));var config=require(_0xfdcf('0x13'));var licenseUtil=require(_0xfdcf('0x14'));var db=require(_0xfdcf('0x15'))['db'];function respondWithStatusCode(_0x4bfb6d,_0x25f6c1){_0x25f6c1=_0x25f6c1||0xcc;return function(_0x2216ec){if(_0x2216ec){return _0x4bfb6d['sendStatus'](_0x25f6c1);}return _0x4bfb6d[_0xfdcf('0x16')](_0x25f6c1)['end']();};}function respondWithResult(_0x2e2596,_0x1ddf68){_0x1ddf68=_0x1ddf68||0xc8;return function(_0x94de40){if(_0x94de40){return _0x2e2596[_0xfdcf('0x16')](_0x1ddf68)[_0xfdcf('0x17')](_0x94de40);}};}function respondWithFilteredResult(_0xa6c79,_0x27edfc){return function(_0x25ebcc){if(_0x25ebcc){var _0x230fb6=_0x25ebcc[_0xfdcf('0x18')],_0x161c90=_0x27edfc[_0xfdcf('0x19')],_0x25df12=_0x27edfc[_0xfdcf('0x19')]+_0x27edfc[_0xfdcf('0x1a')],_0x7d7670;if(_0x25df12>=_0x230fb6){_0x25df12=_0x230fb6;_0x7d7670=0xc8;}else{_0x7d7670=0xce;}_0xa6c79[_0xfdcf('0x16')](_0x7d7670);return _0xa6c79[_0xfdcf('0x1b')]('Content-Range',_0x161c90+'-'+_0x25df12+'/'+_0x230fb6)[_0xfdcf('0x17')](_0x25ebcc);}return null;};}function patchUpdates(_0x4d9947){return function(_0x360937){try{jsonpatch['apply'](_0x360937,_0x4d9947,!![]);}catch(_0x4e6a27){return BPromise['reject'](_0x4e6a27);}return _0x360937['save']();};}function saveUpdates(_0x41e9ff,_0x4e1061){return function(_0x3681b9){if(_0x3681b9){return _0x3681b9[_0xfdcf('0x1c')](_0x41e9ff)['then'](function(_0x51f545){return _0x51f545;});}return null;};}function removeEntity(_0x458453,_0x1fd7f5){return function(_0x139256){if(_0x139256){return _0x139256[_0xfdcf('0x1d')]()[_0xfdcf('0x1e')](function(){var _0x14acef=_0x139256[_0xfdcf('0x1f')]({'plain':!![]});var _0x490eb3=_0xfdcf('0x20');return db[_0xfdcf('0x21')][_0xfdcf('0x1d')]({'where':{'type':_0x490eb3,'resourceId':_0x14acef['id']}})[_0xfdcf('0x1e')](function(){return _0x139256;});})[_0xfdcf('0x1e')](function(){_0x458453[_0xfdcf('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fd1ec,_0x39d0a3){return function(_0x53b33c){if(!_0x53b33c){_0x2fd1ec[_0xfdcf('0x22')](0x194);}return _0x53b33c;};}function handleError(_0x205769,_0x3369c5){_0x3369c5=_0x3369c5||0x1f4;return function(_0x100144){logger[_0xfdcf('0x23')](_0x100144['stack']);if(_0x100144['name']){delete _0x100144[_0xfdcf('0x24')];}_0x205769[_0xfdcf('0x16')](_0x3369c5)[_0xfdcf('0x25')](_0x100144);};}exports[_0xfdcf('0x26')]=function(_0x482fd5,_0x5ae9a2){var _0x277488={},_0x5d3feb={},_0x519ee4={'count':0x0,'rows':[]};var _0x2a0511=_[_0xfdcf('0x27')](db[_0xfdcf('0x28')][_0xfdcf('0x29')],function(_0x2635e7){return{'name':_0x2635e7[_0xfdcf('0x2a')],'type':_0x2635e7['type'][_0xfdcf('0x2b')]};});_0x5d3feb['model']=_['map'](_0x2a0511,_0xfdcf('0x24'));_0x5d3feb[_0xfdcf('0x2c')]=_[_0xfdcf('0x2d')](_0x482fd5['query']);_0x5d3feb[_0xfdcf('0x2e')]=_[_0xfdcf('0x2f')](_0x5d3feb[_0xfdcf('0x30')],_0x5d3feb[_0xfdcf('0x2c')]);_0x277488[_0xfdcf('0x31')]=_[_0xfdcf('0x2f')](_0x5d3feb[_0xfdcf('0x30')],qs[_0xfdcf('0x32')](_0x482fd5[_0xfdcf('0x2c')][_0xfdcf('0x32')]));_0x277488['attributes']=_0x277488[_0xfdcf('0x31')]['length']?_0x277488[_0xfdcf('0x31')]:_0x5d3feb[_0xfdcf('0x30')];if(!_0x482fd5[_0xfdcf('0x2c')]['hasOwnProperty'](_0xfdcf('0x33'))){_0x277488[_0xfdcf('0x1a')]=qs[_0xfdcf('0x1a')](_0x482fd5[_0xfdcf('0x2c')]['limit']);_0x277488['offset']=qs[_0xfdcf('0x19')](_0x482fd5[_0xfdcf('0x2c')][_0xfdcf('0x19')]);}_0x277488[_0xfdcf('0x34')]=qs[_0xfdcf('0x35')](_0x482fd5[_0xfdcf('0x2c')][_0xfdcf('0x35')]);_0x277488[_0xfdcf('0x36')]=qs[_0xfdcf('0x2e')](_[_0xfdcf('0x37')](_0x482fd5[_0xfdcf('0x2c')],_0x5d3feb[_0xfdcf('0x2e')]),_0x2a0511);if(_0x482fd5[_0xfdcf('0x2c')]['filter']){_0x277488[_0xfdcf('0x36')]=_[_0xfdcf('0x38')](_0x277488[_0xfdcf('0x36')],{'$or':_[_0xfdcf('0x27')](_0x2a0511,function(_0x59065a){if(_0x59065a[_0xfdcf('0x39')]!==_0xfdcf('0x3a')){var _0xcdb6b9={};_0xcdb6b9[_0x59065a['name']]={'$like':'%'+_0x482fd5[_0xfdcf('0x2c')][_0xfdcf('0x3b')]+'%'};return _0xcdb6b9;}})});}_0x277488=_['merge']({},_0x277488,_0x482fd5[_0xfdcf('0x3c')]);var _0x38c968={'where':_0x277488[_0xfdcf('0x36')]};return db['Pause']['count'](_0x38c968)['then'](function(_0x7da616){_0x519ee4[_0xfdcf('0x18')]=_0x7da616;if(_0x482fd5[_0xfdcf('0x2c')][_0xfdcf('0x3d')]){_0x277488[_0xfdcf('0x3e')]=[{'all':!![]}];}return db[_0xfdcf('0x28')][_0xfdcf('0x3f')](_0x277488);})[_0xfdcf('0x1e')](function(_0x42a2ee){_0x519ee4[_0xfdcf('0x40')]=_0x42a2ee;return _0x519ee4;})[_0xfdcf('0x1e')](respondWithFilteredResult(_0x5ae9a2,_0x277488))[_0xfdcf('0x41')](handleError(_0x5ae9a2,null));};exports[_0xfdcf('0x42')]=function(_0x50acd5,_0x40f010){var _0x5902c3={'raw':!![],'where':{'id':_0x50acd5[_0xfdcf('0x43')]['id']}},_0x70a801={};_0x70a801[_0xfdcf('0x30')]=_[_0xfdcf('0x2d')](db[_0xfdcf('0x28')][_0xfdcf('0x29')]);_0x70a801['query']=_['keys'](_0x50acd5[_0xfdcf('0x2c')]);_0x70a801[_0xfdcf('0x44')]=_[_0xfdcf('0x2f')](_0x70a801[_0xfdcf('0x30')],_0x70a801['query']);_0x5902c3[_0xfdcf('0x31')]=_[_0xfdcf('0x2f')](_0x70a801['model'],qs[_0xfdcf('0x32')](_0x50acd5[_0xfdcf('0x2c')][_0xfdcf('0x32')]));_0x5902c3[_0xfdcf('0x31')]=_0x5902c3['attributes'][_0xfdcf('0x45')]?_0x5902c3['attributes']:_0x70a801[_0xfdcf('0x30')];if(_0x50acd5[_0xfdcf('0x2c')][_0xfdcf('0x3d')]){_0x5902c3['include']=[{'all':!![]}];}_0x5902c3=_['merge']({},_0x5902c3,_0x50acd5[_0xfdcf('0x3c')]);return db[_0xfdcf('0x28')]['find'](_0x5902c3)[_0xfdcf('0x1e')](handleEntityNotFound(_0x40f010,null))[_0xfdcf('0x1e')](respondWithResult(_0x40f010,null))[_0xfdcf('0x41')](handleError(_0x40f010,null));};exports[_0xfdcf('0x46')]=function(_0x7e0b48,_0x58c7a1){return db[_0xfdcf('0x28')]['create'](_0x7e0b48['body'],{})[_0xfdcf('0x1e')](function(_0x17b1e2){var _0x1de7cf=_0x7e0b48[_0xfdcf('0x47')][_0xfdcf('0x1f')]({'plain':!![]});if(!_0x1de7cf)throw new Error(_0xfdcf('0x48'));if(_0x1de7cf[_0xfdcf('0x49')]===_0xfdcf('0x47')){var _0x38a7bf=_0x17b1e2[_0xfdcf('0x1f')]({'plain':!![]});var _0x31e24f='Pauses';return db[_0xfdcf('0x4a')]['find']({'where':{'name':_0x31e24f,'userProfileId':_0x1de7cf[_0xfdcf('0x4b')]},'raw':!![]})[_0xfdcf('0x1e')](function(_0x5f22c5){if(_0x5f22c5&&_0x5f22c5[_0xfdcf('0x4c')]===0x0){return db[_0xfdcf('0x21')][_0xfdcf('0x46')]({'name':_0x38a7bf[_0xfdcf('0x24')],'resourceId':_0x38a7bf['id'],'type':_0x5f22c5[_0xfdcf('0x24')],'sectionId':_0x5f22c5['id']},{})[_0xfdcf('0x1e')](function(){return _0x17b1e2;});}else{return _0x17b1e2;}})[_0xfdcf('0x41')](function(_0x5857e1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5857e1);throw _0x5857e1;});}return _0x17b1e2;})[_0xfdcf('0x1e')](respondWithResult(_0x58c7a1,0xc9))['catch'](handleError(_0x58c7a1,null));};exports[_0xfdcf('0x1c')]=function(_0x3d580f,_0x3860f5){if(_0x3d580f[_0xfdcf('0x4d')]['id']){delete _0x3d580f[_0xfdcf('0x4d')]['id'];}return db[_0xfdcf('0x28')][_0xfdcf('0x4e')]({'where':{'id':_0x3d580f[_0xfdcf('0x43')]['id']}})['then'](handleEntityNotFound(_0x3860f5,null))[_0xfdcf('0x1e')](saveUpdates(_0x3d580f[_0xfdcf('0x4d')],null))[_0xfdcf('0x1e')](respondWithResult(_0x3860f5,null))['catch'](handleError(_0x3860f5,null));};exports[_0xfdcf('0x1d')]=function(_0x4b46bb,_0x56b7a0){return db[_0xfdcf('0x28')][_0xfdcf('0x4e')]({'where':{'id':_0x4b46bb[_0xfdcf('0x43')]['id']}})[_0xfdcf('0x1e')](handleEntityNotFound(_0x56b7a0,null))['then'](removeEntity(_0x56b7a0,null))[_0xfdcf('0x41')](handleError(_0x56b7a0,null));}; \ No newline at end of file +var _0x3b65=['Pauses','UserProfileResource','destroy','then','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','rows','catch','params','keys','filtears','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','get'];(function(_0x146a97,_0x2d8483){var _0x259d5c=function(_0x3ca436){while(--_0x3ca436){_0x146a97['push'](_0x146a97['shift']());}};_0x259d5c(++_0x2d8483);}(_0x3b65,0xd9));var _0x53b6=function(_0x166feb,_0x1dd207){_0x166feb=_0x166feb-0x0;var _0x468e02=_0x3b65[_0x166feb];return _0x468e02;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x53b6('0x0'));var rimraf=require(_0x53b6('0x1'));var zipdir=require(_0x53b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x53b6('0x3'));var BPromise=require(_0x53b6('0x4'));var Mustache=require(_0x53b6('0x5'));var util=require('util');var path=require(_0x53b6('0x6'));var sox=require(_0x53b6('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x53b6('0x8'));var squel=require(_0x53b6('0x9'));var crypto=require(_0x53b6('0xa'));var jsforce=require(_0x53b6('0xb'));var deskjs=require(_0x53b6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x53b6('0xd'));var Papa=require('papaparse');var Redis=require(_0x53b6('0xe'));var authService=require(_0x53b6('0xf'));var qs=require(_0x53b6('0x10'));var as=require(_0x53b6('0x11'));var hardwareService=require(_0x53b6('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x53b6('0x13'));var config=require(_0x53b6('0x14'));var licenseUtil=require(_0x53b6('0x15'));var db=require(_0x53b6('0x16'))['db'];function respondWithStatusCode(_0x48d4f8,_0x14302e){_0x14302e=_0x14302e||0xcc;return function(_0x2924ad){if(_0x2924ad){return _0x48d4f8[_0x53b6('0x17')](_0x14302e);}return _0x48d4f8[_0x53b6('0x18')](_0x14302e)[_0x53b6('0x19')]();};}function respondWithResult(_0x5aa690,_0x2addc2){_0x2addc2=_0x2addc2||0xc8;return function(_0x3da91d){if(_0x3da91d){return _0x5aa690[_0x53b6('0x18')](_0x2addc2)[_0x53b6('0x1a')](_0x3da91d);}};}function respondWithFilteredResult(_0x3d2389,_0x9fff2c){return function(_0x2fc2b1){if(_0x2fc2b1){var _0x143ed0=_0x2fc2b1[_0x53b6('0x1b')],_0x5d2b42=_0x9fff2c[_0x53b6('0x1c')],_0x1677df=_0x9fff2c[_0x53b6('0x1c')]+_0x9fff2c['limit'],_0x5af6a9;if(_0x1677df>=_0x143ed0){_0x1677df=_0x143ed0;_0x5af6a9=0xc8;}else{_0x5af6a9=0xce;}_0x3d2389[_0x53b6('0x18')](_0x5af6a9);return _0x3d2389[_0x53b6('0x1d')](_0x53b6('0x1e'),_0x5d2b42+'-'+_0x1677df+'/'+_0x143ed0)[_0x53b6('0x1a')](_0x2fc2b1);}return null;};}function patchUpdates(_0x48edba){return function(_0x276b32){try{jsonpatch['apply'](_0x276b32,_0x48edba,!![]);}catch(_0x310e96){return BPromise[_0x53b6('0x1f')](_0x310e96);}return _0x276b32[_0x53b6('0x20')]();};}function saveUpdates(_0x96b814,_0x49c0b7){return function(_0xae9205){if(_0xae9205){return _0xae9205[_0x53b6('0x21')](_0x96b814)['then'](function(_0x186741){return _0x186741;});}return null;};}function removeEntity(_0x755465,_0x5740ed){return function(_0x29a539){if(_0x29a539){return _0x29a539['destroy']()['then'](function(){var _0xb9684=_0x29a539[_0x53b6('0x22')]({'plain':!![]});var _0x175156=_0x53b6('0x23');return db[_0x53b6('0x24')][_0x53b6('0x25')]({'where':{'type':_0x175156,'resourceId':_0xb9684['id']}})['then'](function(){return _0x29a539;});})[_0x53b6('0x26')](function(){_0x755465[_0x53b6('0x18')](0xcc)[_0x53b6('0x19')]();});}};}function handleEntityNotFound(_0x3a07fd,_0x94de63){return function(_0x86eb6d){if(!_0x86eb6d){_0x3a07fd['sendStatus'](0x194);}return _0x86eb6d;};}function handleError(_0x3d058b,_0x1e198c){_0x1e198c=_0x1e198c||0x1f4;return function(_0x5a61b2){logger['error'](_0x5a61b2[_0x53b6('0x27')]);if(_0x5a61b2[_0x53b6('0x28')]){delete _0x5a61b2[_0x53b6('0x28')];}_0x3d058b[_0x53b6('0x18')](_0x1e198c)[_0x53b6('0x29')](_0x5a61b2);};}exports[_0x53b6('0x2a')]=function(_0x56730c,_0x2bcc0d){var _0x59ba04={},_0x708c0c={},_0x441f1d={'count':0x0,'rows':[]};var _0x35fd25=_[_0x53b6('0x2b')](db[_0x53b6('0x2c')][_0x53b6('0x2d')],function(_0x503177){return{'name':_0x503177[_0x53b6('0x2e')],'type':_0x503177[_0x53b6('0x2f')][_0x53b6('0x30')]};});_0x708c0c[_0x53b6('0x31')]=_['map'](_0x35fd25,_0x53b6('0x28'));_0x708c0c[_0x53b6('0x32')]=_['keys'](_0x56730c[_0x53b6('0x32')]);_0x708c0c[_0x53b6('0x33')]=_[_0x53b6('0x34')](_0x708c0c[_0x53b6('0x31')],_0x708c0c[_0x53b6('0x32')]);_0x59ba04['attributes']=_[_0x53b6('0x34')](_0x708c0c[_0x53b6('0x31')],qs['fields'](_0x56730c[_0x53b6('0x32')][_0x53b6('0x35')]));_0x59ba04[_0x53b6('0x36')]=_0x59ba04[_0x53b6('0x36')][_0x53b6('0x37')]?_0x59ba04['attributes']:_0x708c0c['model'];if(!_0x56730c['query'][_0x53b6('0x38')]('nolimit')){_0x59ba04['limit']=qs[_0x53b6('0x39')](_0x56730c[_0x53b6('0x32')][_0x53b6('0x39')]);_0x59ba04[_0x53b6('0x1c')]=qs[_0x53b6('0x1c')](_0x56730c[_0x53b6('0x32')]['offset']);}_0x59ba04[_0x53b6('0x3a')]=qs[_0x53b6('0x3b')](_0x56730c['query'][_0x53b6('0x3b')]);_0x59ba04['where']=qs[_0x53b6('0x33')](_[_0x53b6('0x3c')](_0x56730c[_0x53b6('0x32')],_0x708c0c['filters']),_0x35fd25);if(_0x56730c['query'][_0x53b6('0x3d')]){_0x59ba04['where']=_[_0x53b6('0x3e')](_0x59ba04['where'],{'$or':_['map'](_0x35fd25,function(_0x194309){if(_0x194309['type']!==_0x53b6('0x3f')){var _0x42630f={};_0x42630f[_0x194309[_0x53b6('0x28')]]={'$like':'%'+_0x56730c[_0x53b6('0x32')]['filter']+'%'};return _0x42630f;}})});}_0x59ba04=_['merge']({},_0x59ba04,_0x56730c[_0x53b6('0x40')]);var _0x415542={'where':_0x59ba04[_0x53b6('0x41')]};return db['Pause'][_0x53b6('0x1b')](_0x415542)[_0x53b6('0x26')](function(_0x1de0a0){_0x441f1d[_0x53b6('0x1b')]=_0x1de0a0;if(_0x56730c[_0x53b6('0x32')][_0x53b6('0x42')]){_0x59ba04[_0x53b6('0x43')]=[{'all':!![]}];}return db['Pause']['findAll'](_0x59ba04);})[_0x53b6('0x26')](function(_0x5008a7){_0x441f1d[_0x53b6('0x44')]=_0x5008a7;return _0x441f1d;})[_0x53b6('0x26')](respondWithFilteredResult(_0x2bcc0d,_0x59ba04))[_0x53b6('0x45')](handleError(_0x2bcc0d,null));};exports['show']=function(_0x3ffa9b,_0x21a679){var _0x5552ce={'raw':!![],'where':{'id':_0x3ffa9b[_0x53b6('0x46')]['id']}},_0x3389e0={};_0x3389e0[_0x53b6('0x31')]=_[_0x53b6('0x47')](db['Pause'][_0x53b6('0x2d')]);_0x3389e0[_0x53b6('0x32')]=_[_0x53b6('0x47')](_0x3ffa9b[_0x53b6('0x32')]);_0x3389e0[_0x53b6('0x48')]=_[_0x53b6('0x34')](_0x3389e0['model'],_0x3389e0['query']);_0x5552ce[_0x53b6('0x36')]=_[_0x53b6('0x34')](_0x3389e0['model'],qs[_0x53b6('0x35')](_0x3ffa9b['query'][_0x53b6('0x35')]));_0x5552ce[_0x53b6('0x36')]=_0x5552ce[_0x53b6('0x36')][_0x53b6('0x37')]?_0x5552ce[_0x53b6('0x36')]:_0x3389e0[_0x53b6('0x31')];if(_0x3ffa9b[_0x53b6('0x32')][_0x53b6('0x42')]){_0x5552ce[_0x53b6('0x43')]=[{'all':!![]}];}_0x5552ce=_['merge']({},_0x5552ce,_0x3ffa9b[_0x53b6('0x40')]);return db[_0x53b6('0x2c')][_0x53b6('0x49')](_0x5552ce)[_0x53b6('0x26')](handleEntityNotFound(_0x21a679,null))[_0x53b6('0x26')](respondWithResult(_0x21a679,null))['catch'](handleError(_0x21a679,null));};exports['create']=function(_0x4f1c91,_0x33ef13){return db[_0x53b6('0x2c')]['create'](_0x4f1c91[_0x53b6('0x4a')],{})[_0x53b6('0x26')](function(_0x518331){var _0x3dda41=_0x4f1c91[_0x53b6('0x4b')][_0x53b6('0x22')]({'plain':!![]});if(!_0x3dda41)throw new Error(_0x53b6('0x4c'));if(_0x3dda41[_0x53b6('0x4d')]===_0x53b6('0x4b')){var _0xf9a49c=_0x518331[_0x53b6('0x22')]({'plain':!![]});var _0x4d0fc6=_0x53b6('0x23');return db[_0x53b6('0x4e')][_0x53b6('0x49')]({'where':{'name':_0x4d0fc6,'userProfileId':_0x3dda41[_0x53b6('0x4f')]},'raw':!![]})['then'](function(_0x6c784f){if(_0x6c784f&&_0x6c784f[_0x53b6('0x50')]===0x0){return db[_0x53b6('0x24')][_0x53b6('0x51')]({'name':_0xf9a49c[_0x53b6('0x28')],'resourceId':_0xf9a49c['id'],'type':_0x6c784f[_0x53b6('0x28')],'sectionId':_0x6c784f['id']},{})[_0x53b6('0x26')](function(){return _0x518331;});}else{return _0x518331;}})['catch'](function(_0x11ef11){logger[_0x53b6('0x52')](_0x53b6('0x53'),_0x11ef11);throw _0x11ef11;});}return _0x518331;})['then'](respondWithResult(_0x33ef13,0xc9))['catch'](handleError(_0x33ef13,null));};exports['update']=function(_0x5dc6ee,_0x376704){if(_0x5dc6ee[_0x53b6('0x4a')]['id']){delete _0x5dc6ee[_0x53b6('0x4a')]['id'];}return db['Pause'][_0x53b6('0x49')]({'where':{'id':_0x5dc6ee[_0x53b6('0x46')]['id']}})[_0x53b6('0x26')](handleEntityNotFound(_0x376704,null))[_0x53b6('0x26')](saveUpdates(_0x5dc6ee[_0x53b6('0x4a')],null))[_0x53b6('0x26')](respondWithResult(_0x376704,null))[_0x53b6('0x45')](handleError(_0x376704,null));};exports[_0x53b6('0x25')]=function(_0x34f4fd,_0x23acc7){return db[_0x53b6('0x2c')][_0x53b6('0x49')]({'where':{'id':_0x34f4fd[_0x53b6('0x46')]['id']}})[_0x53b6('0x26')](handleEntityNotFound(_0x23acc7,null))[_0x53b6('0x26')](removeEntity(_0x23acc7,null))[_0x53b6('0x45')](handleError(_0x23acc7,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 89235ce..f746ff1 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 _0x6132=['./pause.attributes','define','tools_pauses','util','api','moment','bluebird','rimraf'];(function(_0x4c974e,_0x513d9e){var _0x31327b=function(_0x5db97c){while(--_0x5db97c){_0x4c974e['push'](_0x4c974e['shift']());}};_0x31327b(++_0x513d9e);}(_0x6132,0xf3));var _0x2613=function(_0xfed1b5,_0x5c3629){_0xfed1b5=_0xfed1b5-0x0;var _0x1367f0=_0x6132[_0xfed1b5];return _0x1367f0;};'use strict';var _=require('lodash');var util=require(_0x2613('0x0'));var logger=require('../../config/logger')(_0x2613('0x1'));var moment=require(_0x2613('0x2'));var BPromise=require(_0x2613('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2613('0x4'));var config=require('../../config/environment');var attributes=require(_0x2613('0x5'));module['exports']=function(_0x4479f6,_0x3f8ef6){return _0x4479f6[_0x2613('0x6')]('Pause',attributes,{'tableName':_0x2613('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a1c=['request-promise','path','rimraf','../../config/environment','exports','Pause','tools_pauses','lodash','util','moment'];(function(_0x38d9fb,_0x4d38b8){var _0x55e5ad=function(_0x249b96){while(--_0x249b96){_0x38d9fb['push'](_0x38d9fb['shift']());}};_0x55e5ad(++_0x4d38b8);}(_0x5a1c,0x1b5));var _0xc5a1=function(_0x3f898a,_0xfd047f){_0x3f898a=_0x3f898a-0x0;var _0x1a146f=_0x5a1c[_0x3f898a];return _0x1a146f;};'use strict';var _=require(_0xc5a1('0x0'));var util=require(_0xc5a1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc5a1('0x2'));var BPromise=require('bluebird');var rp=require(_0xc5a1('0x3'));var fs=require('fs');var path=require(_0xc5a1('0x4'));var rimraf=require(_0xc5a1('0x5'));var config=require(_0xc5a1('0x6'));var attributes=require('./pause.attributes');module[_0xc5a1('0x7')]=function(_0x3d356e,_0x1ed54a){return _0x3d356e['define'](_0xc5a1('0x8'),attributes,{'tableName':_0xc5a1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 62789b8..fdf23fa 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 _0x014e=['map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','ShowPause','Pause','find','options','where','attributes','include'];(function(_0x5ca502,_0x16fe88){var _0x2d2ae5=function(_0x1a7e43){while(--_0x1a7e43){_0x5ca502['push'](_0x5ca502['shift']());}};_0x2d2ae5(++_0x16fe88);}(_0x014e,0x16d));var _0xe014=function(_0x2842e9,_0x55311a){_0x2842e9=_0x2842e9-0x0;var _0x41be05=_0x014e[_0x2842e9];return _0x41be05;};'use strict';var _=require('lodash');var util=require(_0xe014('0x0'));var moment=require(_0xe014('0x1'));var BPromise=require(_0xe014('0x2'));var rs=require(_0xe014('0x3'));var fs=require('fs');var Redis=require(_0xe014('0x4'));var db=require(_0xe014('0x5'))['db'];var utils=require(_0xe014('0x6'));var logger=require(_0xe014('0x7'))(_0xe014('0x8'));var config=require('../../config/environment');var jayson=require(_0xe014('0x9'));var client=jayson[_0xe014('0xa')][_0xe014('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x347a3b,_0x4739e9,_0x2f2200){return new BPromise(function(_0x4d1c06,_0x40b9ea){return client[_0xe014('0xc')](_0x347a3b,_0x2f2200)[_0xe014('0xd')](function(_0x2f4217){logger[_0xe014('0xe')](_0xe014('0xf'),_0x4739e9,_0xe014('0x10'));logger[_0xe014('0x11')](_0xe014('0x12'),_0x4739e9,_0xe014('0x10'),JSON[_0xe014('0x13')](_0x2f4217));if(_0x2f4217['error']){if(_0x2f4217['error'][_0xe014('0x14')]===0x1f4){logger[_0xe014('0x15')](_0xe014('0xf'),_0x4739e9,_0x2f4217['error'][_0xe014('0x16')]);return _0x40b9ea(_0x2f4217['error']['message']);}logger[_0xe014('0x15')](_0xe014('0xf'),_0x4739e9,_0x2f4217['error'][_0xe014('0x16')]);return _0x4d1c06(_0x2f4217[_0xe014('0x15')][_0xe014('0x16')]);}else{logger[_0xe014('0xe')](_0xe014('0xf'),_0x4739e9,_0xe014('0x10'));_0x4d1c06(_0x2f4217['result']['message']);}})[_0xe014('0x17')](function(_0x32d596){logger[_0xe014('0x15')](_0xe014('0xf'),_0x4739e9,_0x32d596);_0x40b9ea(_0x32d596);});});}exports[_0xe014('0x18')]=function(_0x22248f){var _0xdc7ead=this;return new Promise(function(_0x38808f,_0x45cb3f){return db[_0xe014('0x19')][_0xe014('0x1a')]({'raw':_0x22248f[_0xe014('0x1b')]?_0x22248f[_0xe014('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x22248f[_0xe014('0x1b')]?_0x22248f[_0xe014('0x1b')][_0xe014('0x1c')]||null:null,'attributes':_0x22248f[_0xe014('0x1b')]?_0x22248f[_0xe014('0x1b')][_0xe014('0x1d')]||null:null,'include':_0x22248f[_0xe014('0x1b')]?_0x22248f['options'][_0xe014('0x1e')]?_[_0xe014('0x1f')](_0x22248f[_0xe014('0x1b')][_0xe014('0x1e')],function(_0xf774ea){return{'model':db[_0xf774ea['model']],'as':_0xf774ea['as'],'attributes':_0xf774ea['attributes'],'include':_0xf774ea[_0xe014('0x1e')]?_[_0xe014('0x1f')](_0xf774ea[_0xe014('0x1e')],function(_0x5d9355){return{'model':db[_0x5d9355[_0xe014('0x20')]],'as':_0x5d9355['as'],'attributes':_0x5d9355[_0xe014('0x1d')],'include':_0x5d9355['include']?_[_0xe014('0x1f')](_0x5d9355[_0xe014('0x1e')],function(_0x7be509){return{'model':db[_0x7be509[_0xe014('0x20')]],'as':_0x7be509['as'],'attributes':_0x7be509[_0xe014('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe014('0xd')](function(_0x5215b9){logger[_0xe014('0xe')](_0xe014('0x18'),_0x22248f);logger[_0xe014('0x11')](_0xe014('0x18'),_0x22248f,JSON['stringify'](_0x5215b9));_0x38808f(_0x5215b9);})['catch'](function(_0x17623e){logger[_0xe014('0x15')](_0xe014('0x18'),_0x17623e['message'],_0x22248f);_0x45cb3f(_0xdc7ead[_0xe014('0x15')](0x1f4,_0x17623e[_0xe014('0x16')]));});});}; \ No newline at end of file +var _0x0178=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','request\x20sent','error','code','Pause,\x20%s,\x20%s','message','result','ShowPause','Pause','options','attributes','include','map','model','debug','stringify'];(function(_0x10acc2,_0x381818){var _0x5159f0=function(_0x272676){while(--_0x272676){_0x10acc2['push'](_0x10acc2['shift']());}};_0x5159f0(++_0x381818);}(_0x0178,0x1e6));var _0x8017=function(_0x23ee63,_0x1ada94){_0x23ee63=_0x23ee63-0x0;var _0x15e611=_0x0178[_0x23ee63];return _0x15e611;};'use strict';var _=require(_0x8017('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8017('0x1'));var rs=require(_0x8017('0x2'));var fs=require('fs');var Redis=require(_0x8017('0x3'));var db=require(_0x8017('0x4'))['db'];var utils=require(_0x8017('0x5'));var logger=require(_0x8017('0x6'))('rpc');var config=require(_0x8017('0x7'));var jayson=require(_0x8017('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5dab34,_0x3a21c0,_0x1c110c){return new BPromise(function(_0xf0776c,_0x49190c){return client[_0x8017('0x9')](_0x5dab34,_0x1c110c)[_0x8017('0xa')](function(_0x9c9d4c){logger[_0x8017('0xb')]('Pause,\x20%s,\x20%s',_0x3a21c0,_0x8017('0xc'));logger['debug']('Pause,\x20%s,\x20%s,\x20%s',_0x3a21c0,_0x8017('0xc'),JSON['stringify'](_0x9c9d4c));if(_0x9c9d4c[_0x8017('0xd')]){if(_0x9c9d4c[_0x8017('0xd')][_0x8017('0xe')]===0x1f4){logger[_0x8017('0xd')](_0x8017('0xf'),_0x3a21c0,_0x9c9d4c[_0x8017('0xd')]['message']);return _0x49190c(_0x9c9d4c[_0x8017('0xd')][_0x8017('0x10')]);}logger[_0x8017('0xd')]('Pause,\x20%s,\x20%s',_0x3a21c0,_0x9c9d4c[_0x8017('0xd')][_0x8017('0x10')]);return _0xf0776c(_0x9c9d4c['error']['message']);}else{logger[_0x8017('0xb')](_0x8017('0xf'),_0x3a21c0,_0x8017('0xc'));_0xf0776c(_0x9c9d4c[_0x8017('0x11')][_0x8017('0x10')]);}})['catch'](function(_0x5e4c15){logger[_0x8017('0xd')](_0x8017('0xf'),_0x3a21c0,_0x5e4c15);_0x49190c(_0x5e4c15);});});}exports[_0x8017('0x12')]=function(_0x1538e6){var _0x3d676b=this;return new Promise(function(_0x1f5c5c,_0x9038f5){return db[_0x8017('0x13')]['find']({'raw':_0x1538e6[_0x8017('0x14')]?_0x1538e6[_0x8017('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x1538e6[_0x8017('0x14')]?_0x1538e6['options']['where']||null:null,'attributes':_0x1538e6[_0x8017('0x14')]?_0x1538e6['options'][_0x8017('0x15')]||null:null,'include':_0x1538e6[_0x8017('0x14')]?_0x1538e6[_0x8017('0x14')][_0x8017('0x16')]?_[_0x8017('0x17')](_0x1538e6[_0x8017('0x14')][_0x8017('0x16')],function(_0x5714d0){return{'model':db[_0x5714d0['model']],'as':_0x5714d0['as'],'attributes':_0x5714d0[_0x8017('0x15')],'include':_0x5714d0[_0x8017('0x16')]?_[_0x8017('0x17')](_0x5714d0[_0x8017('0x16')],function(_0xedd838){return{'model':db[_0xedd838[_0x8017('0x18')]],'as':_0xedd838['as'],'attributes':_0xedd838['attributes'],'include':_0xedd838[_0x8017('0x16')]?_[_0x8017('0x17')](_0xedd838[_0x8017('0x16')],function(_0x2a482c){return{'model':db[_0x2a482c[_0x8017('0x18')]],'as':_0x2a482c['as'],'attributes':_0x2a482c[_0x8017('0x15')]};}):[]};}):[]};}):[]:[]})[_0x8017('0xa')](function(_0x366815){logger[_0x8017('0xb')](_0x8017('0x12'),_0x1538e6);logger[_0x8017('0x19')](_0x8017('0x12'),_0x1538e6,JSON[_0x8017('0x1a')](_0x366815));_0x1f5c5c(_0x366815);})['catch'](function(_0x1b4596){logger[_0x8017('0xd')](_0x8017('0x12'),_0x1b4596['message'],_0x1538e6);_0x9038f5(_0x3d676b[_0x8017('0xd')](0x1f4,_0x1b4596[_0x8017('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index d52945c..86dfcc6 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 _0x718b=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','/:id','download','join','root','server/files/plugins','originalname','format','%s-%s%s','extname','now','single','file','webhookPost','put','update','delete'];(function(_0x4452dc,_0x479149){var _0x52b892=function(_0x4a0098){while(--_0x4a0098){_0x4452dc['push'](_0x4452dc['shift']());}};_0x52b892(++_0x479149);}(_0x718b,0x10f));var _0xb718=function(_0x52c4e9,_0x5412d0){_0x52c4e9=_0x52c4e9-0x0;var _0x252a03=_0x718b[_0x52c4e9];return _0x252a03;};'use strict';var multer=require('multer');var util=require(_0xb718('0x0'));var path=require(_0xb718('0x1'));var timeout=require(_0xb718('0x2'));var express=require(_0xb718('0x3'));var router=express[_0xb718('0x4')]();var auth=require(_0xb718('0x5'));var interaction=require(_0xb718('0x6'));var config=require(_0xb718('0x7'));var controller=require(_0xb718('0x8'));router[_0xb718('0x9')]('/',auth[_0xb718('0xa')](),controller[_0xb718('0xb')]);router[_0xb718('0x9')](_0xb718('0xc'),controller['webhookGet']);router['get'](_0xb718('0xd'),auth[_0xb718('0xa')](),controller['show']);router[_0xb718('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0xb718('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x44273d,_0x5767fc,_0xa23a27){_0xa23a27(null,path[_0xb718('0xf')](config[_0xb718('0x10')],_0xb718('0x11')));},'filename':function(_0x398731,_0x1d345c,_0x424942){_0x1d345c[_0xb718('0x12')]=_0x1d345c[_0xb718('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x424942(null,util[_0xb718('0x13')](_0xb718('0x14'),path['basename'](_0x1d345c[_0xb718('0x12')],path[_0xb718('0x15')](_0x1d345c['originalname'])),Date[_0xb718('0x16')](),path[_0xb718('0x15')](_0x1d345c[_0xb718('0x12')])));}})});router['post']('/',upload[_0xb718('0x17')](_0xb718('0x18')),controller['upload']);router['post'](_0xb718('0xc'),controller[_0xb718('0x19')]);router[_0xb718('0x1a')](_0xb718('0xd'),auth[_0xb718('0xa')](),controller[_0xb718('0x1b')]);router[_0xb718('0x1c')](_0xb718('0xd'),auth[_0xb718('0xa')](),controller[_0xb718('0x1c')]);module[_0xb718('0x1d')]=router; \ No newline at end of file +var _0x06bc=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','webhookGet','/:id/download','download','join','root','server/files/plugins','originalname','format','%s-%s%s','basename','now','extname','post','single','file','upload','/webhook','webhookPost','/:id','update','delete','exports','multer','path','express'];(function(_0x4ccb54,_0x4a34bf){var _0x57bfb1=function(_0x201e30){while(--_0x201e30){_0x4ccb54['push'](_0x4ccb54['shift']());}};_0x57bfb1(++_0x4a34bf);}(_0x06bc,0x152));var _0xc06b=function(_0x2312b9,_0x5a2341){_0x2312b9=_0x2312b9-0x0;var _0x315853=_0x06bc[_0x2312b9];return _0x315853;};'use strict';var multer=require(_0xc06b('0x0'));var util=require('util');var path=require(_0xc06b('0x1'));var timeout=require('connect-timeout');var express=require(_0xc06b('0x2'));var router=express[_0xc06b('0x3')]();var auth=require(_0xc06b('0x4'));var interaction=require(_0xc06b('0x5'));var config=require(_0xc06b('0x6'));var controller=require('./plugin.controller');router[_0xc06b('0x7')]('/',auth[_0xc06b('0x8')](),controller['index']);router[_0xc06b('0x7')]('/webhook',controller[_0xc06b('0x9')]);router['get']('/:id',auth[_0xc06b('0x8')](),controller['show']);router[_0xc06b('0x7')](_0xc06b('0xa'),auth[_0xc06b('0x8')](),controller[_0xc06b('0xb')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2238e8,_0x8b8c40,_0x1e42be){_0x1e42be(null,path[_0xc06b('0xc')](config[_0xc06b('0xd')],_0xc06b('0xe')));},'filename':function(_0x21cfd6,_0x3f2a34,_0x2e2b0c){_0x3f2a34['originalname']=_0x3f2a34[_0xc06b('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2e2b0c(null,util[_0xc06b('0x10')](_0xc06b('0x11'),path[_0xc06b('0x12')](_0x3f2a34['originalname'],path['extname'](_0x3f2a34[_0xc06b('0xf')])),Date[_0xc06b('0x13')](),path[_0xc06b('0x14')](_0x3f2a34[_0xc06b('0xf')])));}})});router[_0xc06b('0x15')]('/',upload[_0xc06b('0x16')](_0xc06b('0x17')),controller[_0xc06b('0x18')]);router['post'](_0xc06b('0x19'),controller[_0xc06b('0x1a')]);router['put'](_0xc06b('0x1b'),auth[_0xc06b('0x8')](),controller[_0xc06b('0x1c')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc06b('0x1d')]);module[_0xc06b('0x1e')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index ae6b3c1..f1fd7ac 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 _0xd9ef=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never'];(function(_0x569b39,_0x3847e1){var _0x5dbd6c=function(_0x2e4110){while(--_0x2e4110){_0x569b39['push'](_0x569b39['shift']());}};_0x5dbd6c(++_0x3847e1);}(_0xd9ef,0x1dd));var _0xfd9e=function(_0xe209a0,_0x49ed6d){_0xe209a0=_0xe209a0-0x0;var _0x19779c=_0xd9ef[_0xe209a0];return _0x19779c;};'use strict';var Sequelize=require(_0xfd9e('0x0'));module[_0xfd9e('0x1')]={'name':{'type':Sequelize[_0xfd9e('0x2')]},'type':{'type':Sequelize[_0xfd9e('0x3')]('html',_0xfd9e('0x4'))},'description':{'type':Sequelize[_0xfd9e('0x5')]},'version':{'type':Sequelize[_0xfd9e('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0xfd9e('0x6')},'active':{'type':Sequelize[_0xfd9e('0x7')],'defaultValue':0x0,'comment':_0xfd9e('0x8')},'sidebar':{'type':Sequelize[_0xfd9e('0x3')](_0xfd9e('0x9'),_0xfd9e('0xa'),_0xfd9e('0xb'),_0xfd9e('0xc')),'defaultValue':_0xfd9e('0xb'),'comment':_0xfd9e('0xd')},'icon':{'type':Sequelize[_0xfd9e('0x2')]},'adminUrl':{'type':Sequelize[_0xfd9e('0x2')]},'agentUrl':{'type':Sequelize[_0xfd9e('0x2')]},'scriptName':{'type':Sequelize[_0xfd9e('0x2')]},'scriptPath':{'type':Sequelize[_0xfd9e('0x2')]}}; \ No newline at end of file +var _0x6eef=['never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always'];(function(_0x24fa88,_0x4007b2){var _0x2a7377=function(_0x32b955){while(--_0x32b955){_0x24fa88['push'](_0x24fa88['shift']());}};_0x2a7377(++_0x4007b2);}(_0x6eef,0x16e));var _0xf6ee=function(_0x32b30c,_0x2d5ec8){_0x32b30c=_0x32b30c-0x0;var _0xcfc212=_0x6eef[_0x32b30c];return _0xcfc212;};'use strict';var Sequelize=require(_0xf6ee('0x0'));module[_0xf6ee('0x1')]={'name':{'type':Sequelize[_0xf6ee('0x2')]},'type':{'type':Sequelize[_0xf6ee('0x3')]('html','script')},'description':{'type':Sequelize[_0xf6ee('0x4')]},'version':{'type':Sequelize[_0xf6ee('0x4')]},'path':{'type':Sequelize[_0xf6ee('0x2')],'comment':_0xf6ee('0x5')},'active':{'type':Sequelize[_0xf6ee('0x6')],'defaultValue':0x0,'comment':_0xf6ee('0x7')},'sidebar':{'type':Sequelize[_0xf6ee('0x3')](_0xf6ee('0x8'),_0xf6ee('0x9'),_0xf6ee('0xa'),_0xf6ee('0xb')),'defaultValue':'always','comment':_0xf6ee('0xc')},'icon':{'type':Sequelize[_0xf6ee('0x2')]},'adminUrl':{'type':Sequelize[_0xf6ee('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xf6ee('0x2')]},'scriptPath':{'type':Sequelize[_0xf6ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 6a9f513..b8f9028 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 _0xa50d=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','headers','content-length','content-type','statusCode','webhookPost','html-pdf','zip-dir','fast-json-patch','bluebird','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Plugins','UserProfileResource','error','stack','name','send','index','map','fieldName','type','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','merge','options','Plugin','includeAll','rows','catch','params','keys','rawAttributes','include','download','find','path','join','root','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','extname','server/files/plugins','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','isDirectory','manifest.json','Plugin\x20manifest\x20missing','parse','undefined','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0xf30ddf,_0x45f535){var _0x3da04a=function(_0x679fcd){while(--_0x679fcd){_0xf30ddf['push'](_0xf30ddf['shift']());}};_0x3da04a(++_0x45f535);}(_0xa50d,0xb6));var _0xda50=function(_0x3a8434,_0x1b63dc){_0x3a8434=_0x3a8434-0x0;var _0x49a612=_0xa50d[_0x3a8434];return _0x49a612;};'use strict';var pdf=require(_0xda50('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xda50('0x1'));var jsonpatch=require(_0xda50('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xda50('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xda50('0x4'));var csv=require(_0xda50('0x5'));var ejs=require(_0xda50('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xda50('0x7'));var crypto=require('crypto');var jsforce=require(_0xda50('0x8'));var deskjs=require(_0xda50('0x9'));var toCsv=require(_0xda50('0x5'));var querystring=require(_0xda50('0xa'));var Papa=require(_0xda50('0xb'));var extract=require(_0xda50('0xc'));var rimraf=require(_0xda50('0xd'));var archiver=require(_0xda50('0xe'));var Redis=require(_0xda50('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xda50('0x10'));var as=require(_0xda50('0x11'));var hardwareService=require(_0xda50('0x12'));var logger=require(_0xda50('0x13'))(_0xda50('0x14'));var utils=require(_0xda50('0x15'));var config=require(_0xda50('0x16'));var licenseUtil=require(_0xda50('0x17'));var db=require(_0xda50('0x18'))['db'];config[_0xda50('0x19')]=_[_0xda50('0x1a')](config['redis'],{'host':_0xda50('0x1b'),'port':0x18eb});var socket=require(_0xda50('0x1c'))(new Redis(config[_0xda50('0x19')]));require('./plugin.socket')[_0xda50('0x1d')](socket);function respondWithStatusCode(_0x5ac6e6,_0x4b4d9e){_0x4b4d9e=_0x4b4d9e||0xcc;return function(_0x41cb4c){if(_0x41cb4c){return _0x5ac6e6[_0xda50('0x1e')](_0x4b4d9e);}return _0x5ac6e6[_0xda50('0x1f')](_0x4b4d9e)[_0xda50('0x20')]();};}function respondWithResult(_0x41dc48,_0x57b496){_0x57b496=_0x57b496||0xc8;return function(_0x47ef97){if(_0x47ef97){return _0x41dc48[_0xda50('0x1f')](_0x57b496)[_0xda50('0x21')](_0x47ef97);}};}function respondWithFilteredResult(_0x29172a,_0x18c5c2){return function(_0x4f75b3){if(_0x4f75b3){var _0x1ce453=_0x4f75b3[_0xda50('0x22')],_0x2ccbca=_0x18c5c2[_0xda50('0x23')],_0x50f185=_0x18c5c2['offset']+_0x18c5c2[_0xda50('0x24')],_0x277767;if(_0x50f185>=_0x1ce453){_0x50f185=_0x1ce453;_0x277767=0xc8;}else{_0x277767=0xce;}_0x29172a[_0xda50('0x1f')](_0x277767);return _0x29172a[_0xda50('0x25')](_0xda50('0x26'),_0x2ccbca+'-'+_0x50f185+'/'+_0x1ce453)['json'](_0x4f75b3);}return null;};}function patchUpdates(_0x5ce97f){return function(_0x409cc2){try{jsonpatch[_0xda50('0x27')](_0x409cc2,_0x5ce97f,!![]);}catch(_0x2633a1){return BPromise[_0xda50('0x28')](_0x2633a1);}return _0x409cc2[_0xda50('0x29')]();};}function saveUpdates(_0xf40af6,_0x1de5fe){return function(_0x1be0a5){if(_0x1be0a5){return _0x1be0a5[_0xda50('0x2a')](_0xf40af6)['then'](function(_0x2d5929){return _0x2d5929;});}return null;};}function removeEntity(_0x3b983a,_0x3952f3){return function(_0x45a3bb){if(_0x45a3bb){return _0x45a3bb[_0xda50('0x2b')]()[_0xda50('0x2c')](function(){var _0x385b08=_0x45a3bb[_0xda50('0x2d')]({'plain':!![]});var _0x35d2f3=_0xda50('0x2e');return db[_0xda50('0x2f')][_0xda50('0x2b')]({'where':{'type':_0x35d2f3,'resourceId':_0x385b08['id']}})['then'](function(){return _0x45a3bb;});})[_0xda50('0x2c')](function(){_0x3b983a[_0xda50('0x1f')](0xcc)[_0xda50('0x20')]();});}};}function handleEntityNotFound(_0xc1ae72,_0x3d9e19){return function(_0x5b8dab){if(!_0x5b8dab){_0xc1ae72['sendStatus'](0x194);}return _0x5b8dab;};}function handleError(_0x5b2ffb,_0x472298){_0x472298=_0x472298||0x1f4;return function(_0x4c5c19){logger[_0xda50('0x30')](_0x4c5c19[_0xda50('0x31')]);if(_0x4c5c19['name']){delete _0x4c5c19[_0xda50('0x32')];}_0x5b2ffb[_0xda50('0x1f')](_0x472298)[_0xda50('0x33')](_0x4c5c19);};}exports[_0xda50('0x34')]=function(_0x59d3df,_0x1af834){var _0x4f7668={},_0x41ecfd={},_0x512f1c={'count':0x0,'rows':[]};var _0x9a6f7=_[_0xda50('0x35')](db['Plugin']['rawAttributes'],function(_0x12ce59){return{'name':_0x12ce59[_0xda50('0x36')],'type':_0x12ce59[_0xda50('0x37')]['key']};});_0x41ecfd[_0xda50('0x38')]=_[_0xda50('0x35')](_0x9a6f7,_0xda50('0x32'));_0x41ecfd[_0xda50('0x39')]=_['keys'](_0x59d3df[_0xda50('0x39')]);_0x41ecfd[_0xda50('0x3a')]=_[_0xda50('0x3b')](_0x41ecfd[_0xda50('0x38')],_0x41ecfd['query']);_0x4f7668['attributes']=_[_0xda50('0x3b')](_0x41ecfd[_0xda50('0x38')],qs[_0xda50('0x3c')](_0x59d3df['query'][_0xda50('0x3c')]));_0x4f7668['attributes']=_0x4f7668[_0xda50('0x3d')][_0xda50('0x3e')]?_0x4f7668['attributes']:_0x41ecfd['model'];if(!_0x59d3df[_0xda50('0x39')]['hasOwnProperty'](_0xda50('0x3f'))){_0x4f7668[_0xda50('0x24')]=qs[_0xda50('0x24')](_0x59d3df[_0xda50('0x39')][_0xda50('0x24')]);_0x4f7668[_0xda50('0x23')]=qs['offset'](_0x59d3df[_0xda50('0x39')]['offset']);}_0x4f7668[_0xda50('0x40')]=qs[_0xda50('0x41')](_0x59d3df['query'][_0xda50('0x41')]);_0x4f7668[_0xda50('0x42')]=qs[_0xda50('0x3a')](_[_0xda50('0x43')](_0x59d3df['query'],_0x41ecfd['filters']),_0x9a6f7);if(_0x59d3df[_0xda50('0x39')]['filter']){_0x4f7668[_0xda50('0x42')]=_['merge'](_0x4f7668[_0xda50('0x42')],{'$or':_[_0xda50('0x35')](_0x9a6f7,function(_0x16b3cf){if(_0x16b3cf[_0xda50('0x37')]!==_0xda50('0x44')){var _0x30c5ef={};_0x30c5ef[_0x16b3cf[_0xda50('0x32')]]={'$like':'%'+_0x59d3df[_0xda50('0x39')]['filter']+'%'};return _0x30c5ef;}})});}_0x4f7668=_[_0xda50('0x45')]({},_0x4f7668,_0x59d3df[_0xda50('0x46')]);var _0x341835={'where':_0x4f7668[_0xda50('0x42')]};return db[_0xda50('0x47')][_0xda50('0x22')](_0x341835)[_0xda50('0x2c')](function(_0x18ed38){_0x512f1c[_0xda50('0x22')]=_0x18ed38;if(_0x59d3df['query'][_0xda50('0x48')]){_0x4f7668['include']=[{'all':!![]}];}return db[_0xda50('0x47')]['findAll'](_0x4f7668);})[_0xda50('0x2c')](function(_0x596ad1){_0x512f1c[_0xda50('0x49')]=_0x596ad1;return _0x512f1c;})[_0xda50('0x2c')](respondWithFilteredResult(_0x1af834,_0x4f7668))[_0xda50('0x4a')](handleError(_0x1af834,null));};exports['show']=function(_0x2064ec,_0x5409c9){var _0x42affd={'raw':!![],'where':{'id':_0x2064ec[_0xda50('0x4b')]['id']}},_0x612151={};_0x612151[_0xda50('0x38')]=_[_0xda50('0x4c')](db['Plugin'][_0xda50('0x4d')]);_0x612151[_0xda50('0x39')]=_[_0xda50('0x4c')](_0x2064ec[_0xda50('0x39')]);_0x612151['filtears']=_['intersection'](_0x612151['model'],_0x612151[_0xda50('0x39')]);_0x42affd['attributes']=_[_0xda50('0x3b')](_0x612151[_0xda50('0x38')],qs['fields'](_0x2064ec['query'][_0xda50('0x3c')]));_0x42affd[_0xda50('0x3d')]=_0x42affd[_0xda50('0x3d')]['length']?_0x42affd[_0xda50('0x3d')]:_0x612151['model'];if(_0x2064ec[_0xda50('0x39')][_0xda50('0x48')]){_0x42affd[_0xda50('0x4e')]=[{'all':!![]}];}_0x42affd=_[_0xda50('0x45')]({},_0x42affd,_0x2064ec[_0xda50('0x46')]);return db['Plugin']['find'](_0x42affd)[_0xda50('0x2c')](handleEntityNotFound(_0x5409c9,null))[_0xda50('0x2c')](respondWithResult(_0x5409c9,null))['catch'](handleError(_0x5409c9,null));};exports[_0xda50('0x4f')]=function(_0x123cca,_0xaa22a3,_0x2e4d11){return db['Plugin'][_0xda50('0x50')]({'where':{'id':_0x123cca[_0xda50('0x4b')]['id']},'attributes':['name',_0xda50('0x51')],'raw':!![]})[_0xda50('0x2c')](handleEntityNotFound(_0xaa22a3,null))[_0xda50('0x2c')](function(_0x5304d1){if(_0x5304d1){var _0x23b5fc=path[_0xda50('0x52')](config[_0xda50('0x53')],'server/files/plugins',util[_0xda50('0x54')](_0xda50('0x55'),path[_0xda50('0x56')](_0x5304d1[_0xda50('0x51')])));var _0x121c48=fs[_0xda50('0x57')](_0x23b5fc);var _0x4e7939=archiver(_0xda50('0x58'),{'zlib':{'level':0x9}});_0x4e7939['on'](_0xda50('0x59'),function(_0x33d147){if(_0x33d147[_0xda50('0x5a')]===_0xda50('0x5b')){logger[_0xda50('0x30')](_0x33d147);}else{throw new db[(_0xda50('0x5c'))][(_0xda50('0x5d'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x4e7939['on'](_0xda50('0x30'),function(_0x3f26d5){throw new db['Sequelize'][(_0xda50('0x5d'))](_0xda50('0x5e'));});_0x4e7939['pipe'](_0x121c48);_0x4e7939['glob']('**/*',{'cwd':path[_0xda50('0x52')](config[_0xda50('0x53')],'server/files/plugins',path[_0xda50('0x5f')](_0x5304d1['path'])),'ignore':[path[_0xda50('0x52')](path[_0xda50('0x56')](_0x5304d1[_0xda50('0x51')]),_0xda50('0x60')),path['join'](path[_0xda50('0x56')](_0x5304d1[_0xda50('0x51')]),_0xda50('0x61'))],'nodir':!![]})[_0xda50('0x62')]();_0x121c48['on']('close',function(){if(!fs[_0xda50('0x63')](_0x23b5fc)){throw new db[(_0xda50('0x5c'))][(_0xda50('0x5d'))](_0xda50('0x64'));}return _0xaa22a3[_0xda50('0x4f')](_0x23b5fc,util['format'](_0xda50('0x55'),path[_0xda50('0x56')](_0x5304d1['path'])),function(_0x344804){if(_0x344804){throw new db[(_0xda50('0x5c'))][(_0xda50('0x5d'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xda50('0x65')](_0x23b5fc);logger['info'](_0xda50('0x66'));logger[_0xda50('0x67')](_0xda50('0x68'));});});}return null;})['catch'](handleError(_0xaa22a3,null));};exports[_0xda50('0x69')]=function(_0x230711,_0x4b4b40,_0x803ebc){var _0x1735c0=path['basename'](_0x230711[_0xda50('0x6a')][_0xda50('0x6b')],path[_0xda50('0x6c')](_0x230711[_0xda50('0x6a')][_0xda50('0x6b')]));var _0x5a25d8=path[_0xda50('0x52')](config[_0xda50('0x53')],_0xda50('0x6d'),_0x230711[_0xda50('0x6a')][_0xda50('0x6b')]);var _0x4f76c8=path[_0xda50('0x52')](config['root'],'server/files/plugins',_0x1735c0);logger[_0xda50('0x67')]('Plugin\x20upload\x20filepath:\x20%s',_0x5a25d8);logger['info'](_0xda50('0x6e'),_0x4f76c8);try{fs[_0xda50('0x6f')](_0x5a25d8,parseInt('0777',0x8));extract(_0x5a25d8,{'dir':_0x4f76c8},function(_0x50357f){if(_0x50357f){logger['error'](_0x50357f);handleError(_0x50357f,!![]);};var _0x1e9c8d=fs[_0xda50('0x70')](_0x4f76c8);if(_0x1e9c8d[_0xda50('0x3e')]>0x1){removeReferences(_0x5a25d8,_0x4f76c8);logger['error'](_0xda50('0x71'));return _0x803ebc(new Error(_0xda50('0x71')));}var _0x4aeec6=fs['lstatSync'](path['join'](_0x4f76c8,_0x1e9c8d[0x0]));if(_0x4aeec6['isFile']()){removeReferences(_0x5a25d8,_0x4f76c8);logger['error'](_0xda50('0x71'));return _0x803ebc(new Error(_0xda50('0x71')));}if(_0x4aeec6[_0xda50('0x72')]()){var _0x47de34=fs['readdirSync'](path[_0xda50('0x52')](_0x4f76c8,_0x1e9c8d[0x0]));if(_0x47de34[_0xda50('0x3e')]===0x0){removeReferences(_0x5a25d8,_0x4f76c8);logger[_0xda50('0x30')](_0xda50('0x71'));return _0x803ebc(new Error(_0xda50('0x71')));}var _0x2ef387=_0x47de34['some'](function(_0x5a0db9){return _0x5a0db9===_0xda50('0x73');});if(!_0x2ef387){return _0x803ebc(new Error(_0xda50('0x74')));}var _0x4c2f7e=fs['readFileSync'](path[_0xda50('0x52')](_0x4f76c8,_0x1e9c8d[0x0],_0xda50('0x73')));var _0x1a9b68=JSON[_0xda50('0x75')](_0x4c2f7e);if(_0xda50('0x76')==typeof _0x1a9b68[_0xda50('0x32')]){return _0x803ebc(new Error(_0xda50('0x77')));}if(_0xda50('0x76')==typeof _0x1a9b68[_0xda50('0x37')]){return _0x803ebc(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xda50('0x76')==typeof _0x1a9b68[_0xda50('0x78')]){return _0x803ebc(new Error(_0xda50('0x79')));}if(_0xda50('0x76')==typeof _0x1a9b68['parameters']){return _0x803ebc(new Error(_0xda50('0x7a')));}if(_0x1a9b68[_0xda50('0x37')]===_0xda50('0x7b')){if(_0xda50('0x76')==typeof _0x1a9b68[_0xda50('0x7c')][_0xda50('0x7d')]){return _0x803ebc(new Error(_0xda50('0x7e')));}if(_0xda50('0x76')==typeof _0x1a9b68[_0xda50('0x7c')]['views'][_0xda50('0x7f')]&&_0xda50('0x76')==typeof _0x1a9b68['parameters'][_0xda50('0x7d')][_0xda50('0x80')]){return _0x803ebc(new Error(_0xda50('0x81')));}}else if(_0x1a9b68[_0xda50('0x37')]===_0xda50('0x82')){if(_0xda50('0x76')==typeof _0x1a9b68[_0xda50('0x7c')][_0xda50('0x83')]){return _0x803ebc(new Error(_0xda50('0x84')));}if(_0xda50('0x76')==typeof _0x1a9b68[_0xda50('0x7c')][_0xda50('0x85')]){return _0x803ebc(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x803ebc(new Error(_0xda50('0x86')));}var _0x34d3ec=_0x1a9b68[_0xda50('0x32')];var _0x5b8699=_0x1a9b68[_0xda50('0x87')];var _0x53f334=_0x1a9b68['type'];var _0x1a7126=_0x1a9b68['sidebar']?_0x1a9b68[_0xda50('0x88')]:_0xda50('0x89');var _0x4dda4e=_0x1a9b68['icon']?_0x1a9b68['icon']:_0xda50('0x8a');var _0xf0dd5d='';var _0x46426a='';var _0xcc6146='';var _0x563e0a='';var _0x338ccb=_0x1a9b68[_0xda50('0x78')];if(_0x53f334===_0xda50('0x7b')){if(_0xda50('0x76')!=typeof _0x1a9b68['parameters']['views'][_0xda50('0x7f')]){var _0x3154f2=_0x1a9b68[_0xda50('0x7c')]['views'][_0xda50('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xda50('0x8b')](_0x3154f2)){_0xf0dd5d=path[_0xda50('0x52')](_0xda50('0x8c'),_0x1735c0,_0x1e9c8d[0x0],_0x3154f2);}else{_0xf0dd5d=_0x3154f2;}}else{logger[_0xda50('0x67')](_0xda50('0x8d'));}if(_0xda50('0x76')!=typeof _0x1a9b68[_0xda50('0x7c')][_0xda50('0x7d')][_0xda50('0x80')]){var _0x248360=_0x1a9b68['parameters'][_0xda50('0x7d')][_0xda50('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x248360)){_0x46426a=path[_0xda50('0x52')](_0xda50('0x8c'),_0x1735c0,_0x1e9c8d[0x0],_0x248360);}else{_0x46426a=_0x248360;}}else{logger[_0xda50('0x67')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x53f334===_0xda50('0x82')){_0xcc6146=_0x1a9b68[_0xda50('0x7c')][_0xda50('0x83')];_0x563e0a=_0x1a9b68[_0xda50('0x7c')][_0xda50('0x85')];if('undefined'!=typeof _0x1a9b68['parameters'][_0xda50('0x7d')]){if(_0xda50('0x76')!=typeof _0x1a9b68[_0xda50('0x7c')][_0xda50('0x7d')][_0xda50('0x7f')]){var _0x3154f2=_0x1a9b68['parameters'][_0xda50('0x7d')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xda50('0x8b')](_0x3154f2)){_0xf0dd5d=path[_0xda50('0x52')](_0xda50('0x8c'),_0x1735c0,_0x1e9c8d[0x0],_0x3154f2);}else{_0xf0dd5d=_0x3154f2;}}if(_0xda50('0x76')!=typeof _0x1a9b68[_0xda50('0x7c')][_0xda50('0x7d')][_0xda50('0x80')]){var _0x248360=_0x1a9b68[_0xda50('0x7c')][_0xda50('0x7d')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x248360)){_0x46426a=path['join'](_0xda50('0x8c'),_0x1735c0,_0x1e9c8d[0x0],_0x248360);}else{_0x46426a=_0x248360;}}}}var _0x89f638={'name':_0x34d3ec,'description':_0x5b8699,'path':path['join'](_0x1735c0,_0x1e9c8d[0x0]),'type':_0x53f334,'sidebar':_0x1a7126,'icon':_0x4dda4e,'adminUrl':_0xf0dd5d,'agentUrl':_0x46426a,'scriptName':_0xcc6146,'scriptPath':_0x563e0a,'version':_0x338ccb};removeReferences(_0x5a25d8,null);return db[_0xda50('0x47')][_0xda50('0x8e')](_0x89f638)[_0xda50('0x2c')](function(_0x54b87a){var _0x218e4d={'role':_0x230711[_0xda50('0x8f')]['role'],'userProfileId':_0x230711[_0xda50('0x8f')]['userProfileId']};if(!_0x218e4d)throw new Error(_0xda50('0x90'));if(_0x218e4d[_0xda50('0x91')]==='user'){var _0x42f7b7=_0x54b87a[_0xda50('0x2d')]({'plain':!![]});return db[_0xda50('0x92')]['find']({'where':{'name':_0xda50('0x2e'),'userProfileId':_0x218e4d[_0xda50('0x93')]},'raw':!![]})['then'](function(_0x307f07){if(_0x307f07&&_0x307f07[_0xda50('0x94')]===0x0){return db[_0xda50('0x2f')]['create']({'name':_0x42f7b7[_0xda50('0x32')],'resourceId':_0x42f7b7['id'],'type':_0x307f07['name'],'sectionId':_0x307f07['id']},{})[_0xda50('0x2c')](function(){return _0x54b87a;});}else{return _0x54b87a;}})[_0xda50('0x4a')](function(_0x137f28){logger[_0xda50('0x30')](_0xda50('0x95'),_0x137f28);throw _0x137f28;});}return _0x54b87a;})['then'](respondWithResult(_0x4b4b40,null))['catch'](handleError(_0x4b4b40,null));}});}catch(_0x353afe){_0x4b4b40['status'](0x1f4)['send'](_0x353afe);}};function removeReferences(_0x5b8b09,_0x4ad396){try{if(_0x5b8b09){fs['unlinkSync'](_0x5b8b09);logger['info'](_0xda50('0x96'));}if(_0x4ad396){rimraf(_0x4ad396,function(){});logger[_0xda50('0x67')]('Extracted\x20folder\x20removed');}}catch(_0xc98ef){logger[_0xda50('0x30')](_0xc98ef);}}exports[_0xda50('0x2a')]=function(_0x5ceb64,_0x101ae0,_0x2d6457){return db['Plugin'][_0xda50('0x50')]({'where':{'id':_0x5ceb64[_0xda50('0x4b')]['id']}})[_0xda50('0x2c')](handleEntityNotFound(_0x101ae0,null))[_0xda50('0x2c')](saveUpdates(_0x5ceb64[_0xda50('0x8f')],null))[_0xda50('0x2c')](respondWithResult(_0x101ae0,null))[_0xda50('0x4a')](handleError(_0x101ae0,null));};exports[_0xda50('0x97')]=function(_0x491bed,_0xb6d0fb,_0x56053c){return db['Plugin'][_0xda50('0x50')]({'where':{'id':_0x491bed[_0xda50('0x4b')]['id']}})['then'](function(_0x374b48){if(_0x374b48){return _0x374b48[_0xda50('0x2b')]();}})[_0xda50('0x2c')](function(_0x35f43d){rimraf(path[_0xda50('0x52')](config[_0xda50('0x53')],_0xda50('0x6d'),path[_0xda50('0x5f')](_0x35f43d[_0xda50('0x51')])),function(){});return _0x35f43d;})['then'](handleEntityNotFound(_0xb6d0fb,null))[_0xda50('0x2c')](respondWithStatusCode(_0xb6d0fb,null))['catch'](handleError(_0xb6d0fb,null));};exports['webhookGet']=function(_0x2b9cd3,_0x58fa69,_0x1f2ec0){return BPromise[_0xda50('0x98')]()[_0xda50('0x2c')](function(){if(!_0x2b9cd3['query'][_0xda50('0x51')]){throw new Error(_0xda50('0x99'));}if(!_0x2b9cd3[_0xda50('0x39')][_0xda50('0x9a')]){throw new Error(_0xda50('0x9b'));}var _0x71c991=_0x2b9cd3['query'][_0xda50('0x9c')]?_0x2b9cd3['query']['hostname']+':'+_0x2b9cd3[_0xda50('0x39')]['port']:'http://localhost:'+_0x2b9cd3[_0xda50('0x39')]['port'];var _0x2a113f=_0x2b9cd3['query'][_0xda50('0x21')]?_0x2b9cd3['query'][_0xda50('0x21')]:!![];var _0x2878c5=_0x2b9cd3[_0xda50('0x39')][_0xda50('0x9d')]?_0x2b9cd3[_0xda50('0x39')][_0xda50('0x9d')]:null;var _0x4bf1e2={'method':_0x2b9cd3[_0xda50('0x9e')],'uri':util[_0xda50('0x54')]('%s%s',_0x71c991,_0x2b9cd3[_0xda50('0x39')][_0xda50('0x51')]),'json':_0x2a113f,'resolveWithFullResponse':!![],'encoding':_0x2878c5,'qs':_0x2b9cd3['query']};if(_0x2b9cd3[_0xda50('0x9f')]){_0x4bf1e2['headers']=_0x2b9cd3[_0xda50('0x9f')];if(_0x4bf1e2[_0xda50('0x9f')][_0xda50('0xa0')]){delete _0x4bf1e2['headers'][_0xda50('0xa0')];}}if(_0x4bf1e2['headers'][_0xda50('0xa1')]){delete _0x4bf1e2['headers'][_0xda50('0xa1')];}return rp(_0x4bf1e2);})[_0xda50('0x2c')](function(_0xe94efe){if(_0xe94efe){_0x58fa69[_0xda50('0x25')](_0xe94efe[_0xda50('0x9f')]);logger[_0xda50('0x67')](_0xe94efe[_0xda50('0x8f')]);if(_['endsWith'](_0x2b9cd3[_0xda50('0x39')][_0xda50('0x51')],_0xda50('0x4f'))&&_0xe94efe['statusCode']==0x1f4){return _0x58fa69['sendStatus'](_0xe94efe[_0xda50('0xa2')]);}else{return _0x58fa69[_0xda50('0x1f')](_0xe94efe[_0xda50('0xa2')])[_0xda50('0x33')](_0xe94efe[_0xda50('0x8f')]);}}else{return _0x58fa69[_0xda50('0x1e')](0xc8);}})[_0xda50('0x4a')](handleError(_0x58fa69,null));};exports[_0xda50('0xa3')]=function(_0x926d7d,_0x1f72cc,_0x1e14ba){return BPromise[_0xda50('0x98')]()[_0xda50('0x2c')](function(){if(!_0x926d7d['query'][_0xda50('0x51')]){throw new Error(_0xda50('0x99'));}if(!_0x926d7d['query']['port']){throw new Error(_0xda50('0x9b'));}var _0xaf48e2=_0x926d7d[_0xda50('0x39')][_0xda50('0x9c')]?_0x926d7d[_0xda50('0x39')]['hostname']+':'+_0x926d7d[_0xda50('0x39')][_0xda50('0x9a')]:'http://localhost:'+_0x926d7d[_0xda50('0x39')][_0xda50('0x9a')];var _0x2f3105=_0x926d7d['query'][_0xda50('0x21')]?_0x926d7d['query'][_0xda50('0x21')]:!![];var _0x5783f1=_0x926d7d[_0xda50('0x39')][_0xda50('0x9d')]?_0x926d7d['query'][_0xda50('0x9d')]:null;var _0x23f199={'method':_0x926d7d[_0xda50('0x9e')],'uri':util[_0xda50('0x54')]('%s%s',_0xaf48e2,_0x926d7d['query'][_0xda50('0x51')]),'json':_0x2f3105,'resolveWithFullResponse':!![],'encoding':_0x5783f1,'body':_0x926d7d[_0xda50('0x8f')]};if(_0x926d7d[_0xda50('0x9f')]){_0x23f199[_0xda50('0x9f')]=_0x926d7d['headers'];if(_0x23f199['headers'][_0xda50('0xa0')]){delete _0x23f199[_0xda50('0x9f')][_0xda50('0xa0')];}}if(_0x23f199[_0xda50('0x9f')]['content-type']){delete _0x23f199[_0xda50('0x9f')][_0xda50('0xa1')];}return rp(_0x23f199);})[_0xda50('0x2c')](function(_0x4dc28e){if(_0x4dc28e){_0x1f72cc[_0xda50('0x25')](_0x4dc28e['headers']);logger[_0xda50('0x67')](_0x4dc28e[_0xda50('0x8f')]);return _0x1f72cc['status'](_0x4dc28e[_0xda50('0xa2')])[_0xda50('0x33')](_0x4dc28e[_0xda50('0x8f')]);}else{return _0x1f72cc['sendStatus'](0xc8);}})[_0xda50('0x4a')](handleError(_0x1f72cc,null));}; \ No newline at end of file +var _0x4cf6=['user','UserProfileSection','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','encoding','method','%s%s','headers','set','endsWith','statusCode','resolve','hostname','content-length','content-type','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','redis','defaults','./plugin.socket','register','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','then','get','Plugins','sendStatus','stack','name','send','index','Plugin','rawAttributes','fieldName','type','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','filtears','find','catch','download','params','join','server/files/plugins','format','%s.zip','basename','warning','ENOENT','error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','root','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','undefined','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x3b444f,_0x4bb0b2){var _0x17de94=function(_0x5aa6ca){while(--_0x5aa6ca){_0x3b444f['push'](_0x3b444f['shift']());}};_0x17de94(++_0x4bb0b2);}(_0x4cf6,0x16e));var _0x64cf=function(_0x202f37,_0x3e14c9){_0x202f37=_0x202f37-0x0;var _0x54cbf7=_0x4cf6[_0x202f37];return _0x54cbf7;};'use strict';var pdf=require(_0x64cf('0x0'));var emlformat=require(_0x64cf('0x1'));var rimraf=require(_0x64cf('0x2'));var zipdir=require(_0x64cf('0x3'));var jsonpatch=require(_0x64cf('0x4'));var rp=require('request-promise');var moment=require(_0x64cf('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x64cf('0x6'));var path=require(_0x64cf('0x7'));var sox=require(_0x64cf('0x8'));var csv=require(_0x64cf('0x9'));var ejs=require(_0x64cf('0xa'));var fs=require('fs');var _=require(_0x64cf('0xb'));var squel=require(_0x64cf('0xc'));var crypto=require('crypto');var jsforce=require(_0x64cf('0xd'));var deskjs=require(_0x64cf('0xe'));var toCsv=require(_0x64cf('0x9'));var querystring=require(_0x64cf('0xf'));var Papa=require(_0x64cf('0x10'));var extract=require(_0x64cf('0x11'));var rimraf=require(_0x64cf('0x2'));var archiver=require(_0x64cf('0x12'));var Redis=require(_0x64cf('0x13'));var authService=require(_0x64cf('0x14'));var qs=require(_0x64cf('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x64cf('0x16'))('api');var utils=require(_0x64cf('0x17'));var config=require(_0x64cf('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x64cf('0x19')]=_[_0x64cf('0x1a')](config[_0x64cf('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x64cf('0x1b'))[_0x64cf('0x1c')](socket);function respondWithStatusCode(_0x60b79e,_0x1929d0){_0x1929d0=_0x1929d0||0xcc;return function(_0x24ebf1){if(_0x24ebf1){return _0x60b79e['sendStatus'](_0x1929d0);}return _0x60b79e[_0x64cf('0x1d')](_0x1929d0)[_0x64cf('0x1e')]();};}function respondWithResult(_0x4958c8,_0x1d0543){_0x1d0543=_0x1d0543||0xc8;return function(_0x576ef9){if(_0x576ef9){return _0x4958c8[_0x64cf('0x1d')](_0x1d0543)['json'](_0x576ef9);}};}function respondWithFilteredResult(_0x5146a9,_0xc05dbe){return function(_0xff1940){if(_0xff1940){var _0x22ae42=_0xff1940[_0x64cf('0x1f')],_0xd99427=_0xc05dbe[_0x64cf('0x20')],_0x414345=_0xc05dbe[_0x64cf('0x20')]+_0xc05dbe[_0x64cf('0x21')],_0x53b0a0;if(_0x414345>=_0x22ae42){_0x414345=_0x22ae42;_0x53b0a0=0xc8;}else{_0x53b0a0=0xce;}_0x5146a9[_0x64cf('0x1d')](_0x53b0a0);return _0x5146a9['set'](_0x64cf('0x22'),_0xd99427+'-'+_0x414345+'/'+_0x22ae42)[_0x64cf('0x23')](_0xff1940);}return null;};}function patchUpdates(_0x2e6b5d){return function(_0x28ad1b){try{jsonpatch[_0x64cf('0x24')](_0x28ad1b,_0x2e6b5d,!![]);}catch(_0x2d58e9){return BPromise['reject'](_0x2d58e9);}return _0x28ad1b[_0x64cf('0x25')]();};}function saveUpdates(_0x348b09,_0x2144e9){return function(_0x50f7fb){if(_0x50f7fb){return _0x50f7fb[_0x64cf('0x26')](_0x348b09)['then'](function(_0xc285c6){return _0xc285c6;});}return null;};}function removeEntity(_0x5fd64,_0x49d8e5){return function(_0x3927e9){if(_0x3927e9){return _0x3927e9[_0x64cf('0x27')]()[_0x64cf('0x28')](function(){var _0x38aa4c=_0x3927e9[_0x64cf('0x29')]({'plain':!![]});var _0x349d17=_0x64cf('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x349d17,'resourceId':_0x38aa4c['id']}})[_0x64cf('0x28')](function(){return _0x3927e9;});})['then'](function(){_0x5fd64[_0x64cf('0x1d')](0xcc)[_0x64cf('0x1e')]();});}};}function handleEntityNotFound(_0x5c4064,_0x567f1b){return function(_0x10ce52){if(!_0x10ce52){_0x5c4064[_0x64cf('0x2b')](0x194);}return _0x10ce52;};}function handleError(_0x2a49ea,_0x510c6d){_0x510c6d=_0x510c6d||0x1f4;return function(_0x4e6288){logger['error'](_0x4e6288[_0x64cf('0x2c')]);if(_0x4e6288['name']){delete _0x4e6288[_0x64cf('0x2d')];}_0x2a49ea[_0x64cf('0x1d')](_0x510c6d)[_0x64cf('0x2e')](_0x4e6288);};}exports[_0x64cf('0x2f')]=function(_0x2b63b5,_0x742a3c){var _0x527320={},_0x6a81ea={},_0x30f3dc={'count':0x0,'rows':[]};var _0x42958f=_['map'](db[_0x64cf('0x30')][_0x64cf('0x31')],function(_0x38da65){return{'name':_0x38da65[_0x64cf('0x32')],'type':_0x38da65[_0x64cf('0x33')]['key']};});_0x6a81ea['model']=_[_0x64cf('0x34')](_0x42958f,'name');_0x6a81ea[_0x64cf('0x35')]=_[_0x64cf('0x36')](_0x2b63b5[_0x64cf('0x35')]);_0x6a81ea[_0x64cf('0x37')]=_[_0x64cf('0x38')](_0x6a81ea['model'],_0x6a81ea['query']);_0x527320[_0x64cf('0x39')]=_['intersection'](_0x6a81ea[_0x64cf('0x3a')],qs[_0x64cf('0x3b')](_0x2b63b5['query'][_0x64cf('0x3b')]));_0x527320[_0x64cf('0x39')]=_0x527320[_0x64cf('0x39')][_0x64cf('0x3c')]?_0x527320[_0x64cf('0x39')]:_0x6a81ea[_0x64cf('0x3a')];if(!_0x2b63b5[_0x64cf('0x35')][_0x64cf('0x3d')](_0x64cf('0x3e'))){_0x527320[_0x64cf('0x21')]=qs[_0x64cf('0x21')](_0x2b63b5[_0x64cf('0x35')]['limit']);_0x527320[_0x64cf('0x20')]=qs[_0x64cf('0x20')](_0x2b63b5[_0x64cf('0x35')]['offset']);}_0x527320[_0x64cf('0x3f')]=qs['sort'](_0x2b63b5[_0x64cf('0x35')][_0x64cf('0x40')]);_0x527320[_0x64cf('0x41')]=qs['filters'](_[_0x64cf('0x42')](_0x2b63b5[_0x64cf('0x35')],_0x6a81ea[_0x64cf('0x37')]),_0x42958f);if(_0x2b63b5['query'][_0x64cf('0x43')]){_0x527320['where']=_[_0x64cf('0x44')](_0x527320[_0x64cf('0x41')],{'$or':_['map'](_0x42958f,function(_0x470969){if(_0x470969[_0x64cf('0x33')]!==_0x64cf('0x45')){var _0x5168b4={};_0x5168b4[_0x470969[_0x64cf('0x2d')]]={'$like':'%'+_0x2b63b5[_0x64cf('0x35')][_0x64cf('0x43')]+'%'};return _0x5168b4;}})});}_0x527320=_[_0x64cf('0x44')]({},_0x527320,_0x2b63b5[_0x64cf('0x46')]);var _0x5db9d1={'where':_0x527320[_0x64cf('0x41')]};return db[_0x64cf('0x30')][_0x64cf('0x1f')](_0x5db9d1)['then'](function(_0x5a3d7e){_0x30f3dc[_0x64cf('0x1f')]=_0x5a3d7e;if(_0x2b63b5['query'][_0x64cf('0x47')]){_0x527320[_0x64cf('0x48')]=[{'all':!![]}];}return db[_0x64cf('0x30')][_0x64cf('0x49')](_0x527320);})[_0x64cf('0x28')](function(_0x305b92){_0x30f3dc[_0x64cf('0x4a')]=_0x305b92;return _0x30f3dc;})[_0x64cf('0x28')](respondWithFilteredResult(_0x742a3c,_0x527320))['catch'](handleError(_0x742a3c,null));};exports[_0x64cf('0x4b')]=function(_0x5c8231,_0x50c59f){var _0x24b90c={'raw':!![],'where':{'id':_0x5c8231['params']['id']}},_0x405176={};_0x405176[_0x64cf('0x3a')]=_[_0x64cf('0x36')](db[_0x64cf('0x30')][_0x64cf('0x31')]);_0x405176[_0x64cf('0x35')]=_[_0x64cf('0x36')](_0x5c8231['query']);_0x405176[_0x64cf('0x4c')]=_[_0x64cf('0x38')](_0x405176[_0x64cf('0x3a')],_0x405176[_0x64cf('0x35')]);_0x24b90c['attributes']=_['intersection'](_0x405176[_0x64cf('0x3a')],qs[_0x64cf('0x3b')](_0x5c8231[_0x64cf('0x35')]['fields']));_0x24b90c[_0x64cf('0x39')]=_0x24b90c[_0x64cf('0x39')][_0x64cf('0x3c')]?_0x24b90c[_0x64cf('0x39')]:_0x405176['model'];if(_0x5c8231[_0x64cf('0x35')][_0x64cf('0x47')]){_0x24b90c[_0x64cf('0x48')]=[{'all':!![]}];}_0x24b90c=_[_0x64cf('0x44')]({},_0x24b90c,_0x5c8231[_0x64cf('0x46')]);return db[_0x64cf('0x30')][_0x64cf('0x4d')](_0x24b90c)[_0x64cf('0x28')](handleEntityNotFound(_0x50c59f,null))[_0x64cf('0x28')](respondWithResult(_0x50c59f,null))[_0x64cf('0x4e')](handleError(_0x50c59f,null));};exports[_0x64cf('0x4f')]=function(_0x1e64b5,_0x362f92,_0x32d2ec){return db[_0x64cf('0x30')][_0x64cf('0x4d')]({'where':{'id':_0x1e64b5[_0x64cf('0x50')]['id']},'attributes':['name','path'],'raw':!![]})['then'](handleEntityNotFound(_0x362f92,null))[_0x64cf('0x28')](function(_0xd6df5){if(_0xd6df5){var _0x4e2cda=path[_0x64cf('0x51')](config['root'],_0x64cf('0x52'),util[_0x64cf('0x53')](_0x64cf('0x54'),path[_0x64cf('0x55')](_0xd6df5[_0x64cf('0x7')])));var _0x3fc198=fs['createWriteStream'](_0x4e2cda);var _0x18aa52=archiver('zip',{'zlib':{'level':0x9}});_0x18aa52['on'](_0x64cf('0x56'),function(_0x197fc7){if(_0x197fc7['code']===_0x64cf('0x57')){logger[_0x64cf('0x58')](_0x197fc7);}else{throw new db[(_0x64cf('0x59'))]['Error'](_0x64cf('0x5a'));}});_0x18aa52['on'](_0x64cf('0x58'),function(_0xfccc02){throw new db['Sequelize'][(_0x64cf('0x5b'))](_0x64cf('0x5a'));});_0x18aa52[_0x64cf('0x5c')](_0x3fc198);_0x18aa52[_0x64cf('0x5d')](_0x64cf('0x5e'),{'cwd':path[_0x64cf('0x51')](config[_0x64cf('0x5f')],_0x64cf('0x52'),path[_0x64cf('0x60')](_0xd6df5['path'])),'ignore':[path['join'](path[_0x64cf('0x55')](_0xd6df5[_0x64cf('0x7')]),_0x64cf('0x61')),path['join'](path[_0x64cf('0x55')](_0xd6df5[_0x64cf('0x7')]),_0x64cf('0x62'))],'nodir':!![]})[_0x64cf('0x63')]();_0x3fc198['on'](_0x64cf('0x64'),function(){if(!fs[_0x64cf('0x65')](_0x4e2cda)){throw new db[(_0x64cf('0x59'))]['Error'](_0x64cf('0x66'));}return _0x362f92['download'](_0x4e2cda,util[_0x64cf('0x53')](_0x64cf('0x54'),path[_0x64cf('0x55')](_0xd6df5[_0x64cf('0x7')])),function(_0x3bb342){if(_0x3bb342){throw new db[(_0x64cf('0x59'))][(_0x64cf('0x5b'))](_0x64cf('0x67'));}fs[_0x64cf('0x68')](_0x4e2cda);logger[_0x64cf('0x69')](_0x64cf('0x6a'));logger['info'](_0x64cf('0x6b'));});});}return null;})[_0x64cf('0x4e')](handleError(_0x362f92,null));};exports[_0x64cf('0x6c')]=function(_0x1a8b03,_0x1ff31b,_0x3dc2d9){var _0x36055f=path['basename'](_0x1a8b03[_0x64cf('0x6d')][_0x64cf('0x6e')],path[_0x64cf('0x6f')](_0x1a8b03[_0x64cf('0x6d')][_0x64cf('0x6e')]));var _0x1d782c=path[_0x64cf('0x51')](config['root'],_0x64cf('0x52'),_0x1a8b03['file'][_0x64cf('0x6e')]);var _0x539705=path[_0x64cf('0x51')](config[_0x64cf('0x5f')],_0x64cf('0x52'),_0x36055f);logger[_0x64cf('0x69')](_0x64cf('0x70'),_0x1d782c);logger[_0x64cf('0x69')](_0x64cf('0x71'),_0x539705);try{fs['chmodSync'](_0x1d782c,parseInt(_0x64cf('0x72'),0x8));extract(_0x1d782c,{'dir':_0x539705},function(_0x474c4f){if(_0x474c4f){logger[_0x64cf('0x58')](_0x474c4f);handleError(_0x474c4f,!![]);};var _0xe8bf35=fs[_0x64cf('0x73')](_0x539705);if(_0xe8bf35[_0x64cf('0x3c')]>0x1){removeReferences(_0x1d782c,_0x539705);logger[_0x64cf('0x58')]('Invalid\x20plugin\x20structure');return _0x3dc2d9(new Error(_0x64cf('0x74')));}var _0x227c57=fs[_0x64cf('0x75')](path[_0x64cf('0x51')](_0x539705,_0xe8bf35[0x0]));if(_0x227c57['isFile']()){removeReferences(_0x1d782c,_0x539705);logger[_0x64cf('0x58')](_0x64cf('0x74'));return _0x3dc2d9(new Error(_0x64cf('0x74')));}if(_0x227c57[_0x64cf('0x76')]()){var _0x390140=fs[_0x64cf('0x73')](path[_0x64cf('0x51')](_0x539705,_0xe8bf35[0x0]));if(_0x390140[_0x64cf('0x3c')]===0x0){removeReferences(_0x1d782c,_0x539705);logger[_0x64cf('0x58')]('Invalid\x20plugin\x20structure');return _0x3dc2d9(new Error(_0x64cf('0x74')));}var _0x1ac7f3=_0x390140[_0x64cf('0x77')](function(_0x4b6cd1){return _0x4b6cd1===_0x64cf('0x78');});if(!_0x1ac7f3){return _0x3dc2d9(new Error(_0x64cf('0x79')));}var _0x2aff8d=fs[_0x64cf('0x7a')](path['join'](_0x539705,_0xe8bf35[0x0],_0x64cf('0x78')));var _0x14996e=JSON[_0x64cf('0x7b')](_0x2aff8d);if('undefined'==typeof _0x14996e[_0x64cf('0x2d')]){return _0x3dc2d9(new Error(_0x64cf('0x7c')));}if(_0x64cf('0x7d')==typeof _0x14996e[_0x64cf('0x33')]){return _0x3dc2d9(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x64cf('0x7d')==typeof _0x14996e[_0x64cf('0x7e')]){return _0x3dc2d9(new Error(_0x64cf('0x7f')));}if(_0x64cf('0x7d')==typeof _0x14996e[_0x64cf('0x80')]){return _0x3dc2d9(new Error(_0x64cf('0x81')));}if(_0x14996e[_0x64cf('0x33')]==='html'){if(_0x64cf('0x7d')==typeof _0x14996e[_0x64cf('0x80')][_0x64cf('0x82')]){return _0x3dc2d9(new Error(_0x64cf('0x83')));}if(_0x64cf('0x7d')==typeof _0x14996e[_0x64cf('0x80')][_0x64cf('0x82')][_0x64cf('0x84')]&&_0x64cf('0x7d')==typeof _0x14996e[_0x64cf('0x80')]['views'][_0x64cf('0x85')]){return _0x3dc2d9(new Error(_0x64cf('0x86')));}}else if(_0x14996e['type']===_0x64cf('0x87')){if(_0x64cf('0x7d')==typeof _0x14996e[_0x64cf('0x80')]['scriptName']){return _0x3dc2d9(new Error(_0x64cf('0x88')));}if(_0x64cf('0x7d')==typeof _0x14996e[_0x64cf('0x80')]['scriptPath']){return _0x3dc2d9(new Error(_0x64cf('0x89')));}}else{return _0x3dc2d9(new Error(_0x64cf('0x8a')));}var _0x14f218=_0x14996e[_0x64cf('0x2d')];var _0x5a2a92=_0x14996e[_0x64cf('0x8b')];var _0xed6e02=_0x14996e[_0x64cf('0x33')];var _0x5931b3=_0x14996e[_0x64cf('0x8c')]?_0x14996e[_0x64cf('0x8c')]:_0x64cf('0x8d');var _0x27488d=_0x14996e['icon']?_0x14996e['icon']:_0x64cf('0x8e');var _0x347205='';var _0x147348='';var _0x12e5cd='';var _0xeae3e4='';var _0x3b1c9e=_0x14996e[_0x64cf('0x7e')];if(_0xed6e02==='html'){if(_0x64cf('0x7d')!=typeof _0x14996e['parameters']['views'][_0x64cf('0x84')]){var _0x1d26cd=_0x14996e['parameters'][_0x64cf('0x82')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x64cf('0x8f')](_0x1d26cd)){_0x347205=path[_0x64cf('0x51')](_0x64cf('0x90'),_0x36055f,_0xe8bf35[0x0],_0x1d26cd);}else{_0x347205=_0x1d26cd;}}else{logger[_0x64cf('0x69')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x64cf('0x7d')!=typeof _0x14996e['parameters'][_0x64cf('0x82')]['agent']){var _0x487bc3=_0x14996e[_0x64cf('0x80')][_0x64cf('0x82')][_0x64cf('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x64cf('0x8f')](_0x487bc3)){_0x147348=path['join'](_0x64cf('0x90'),_0x36055f,_0xe8bf35[0x0],_0x487bc3);}else{_0x147348=_0x487bc3;}}else{logger[_0x64cf('0x69')](_0x64cf('0x91'));}}else if(_0xed6e02===_0x64cf('0x87')){_0x12e5cd=_0x14996e[_0x64cf('0x80')]['scriptName'];_0xeae3e4=_0x14996e[_0x64cf('0x80')]['scriptPath'];if(_0x64cf('0x7d')!=typeof _0x14996e[_0x64cf('0x80')]['views']){if(_0x64cf('0x7d')!=typeof _0x14996e[_0x64cf('0x80')]['views'][_0x64cf('0x84')]){var _0x1d26cd=_0x14996e[_0x64cf('0x80')][_0x64cf('0x82')][_0x64cf('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x64cf('0x8f')](_0x1d26cd)){_0x347205=path['join'](_0x64cf('0x90'),_0x36055f,_0xe8bf35[0x0],_0x1d26cd);}else{_0x347205=_0x1d26cd;}}if(_0x64cf('0x7d')!=typeof _0x14996e[_0x64cf('0x80')][_0x64cf('0x82')]['agent']){var _0x487bc3=_0x14996e[_0x64cf('0x80')][_0x64cf('0x82')][_0x64cf('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x64cf('0x8f')](_0x487bc3)){_0x147348=path[_0x64cf('0x51')](_0x64cf('0x90'),_0x36055f,_0xe8bf35[0x0],_0x487bc3);}else{_0x147348=_0x487bc3;}}}}var _0x12dc19={'name':_0x14f218,'description':_0x5a2a92,'path':path[_0x64cf('0x51')](_0x36055f,_0xe8bf35[0x0]),'type':_0xed6e02,'sidebar':_0x5931b3,'icon':_0x27488d,'adminUrl':_0x347205,'agentUrl':_0x147348,'scriptName':_0x12e5cd,'scriptPath':_0xeae3e4,'version':_0x3b1c9e};removeReferences(_0x1d782c,null);return db[_0x64cf('0x30')]['create'](_0x12dc19)[_0x64cf('0x28')](function(_0x5a9d15){var _0x46b48c={'role':_0x1a8b03[_0x64cf('0x92')][_0x64cf('0x93')],'userProfileId':_0x1a8b03[_0x64cf('0x92')][_0x64cf('0x94')]};if(!_0x46b48c)throw new Error(_0x64cf('0x95'));if(_0x46b48c['role']===_0x64cf('0x96')){var _0x3f3595=_0x5a9d15[_0x64cf('0x29')]({'plain':!![]});return db[_0x64cf('0x97')][_0x64cf('0x4d')]({'where':{'name':_0x64cf('0x2a'),'userProfileId':_0x46b48c[_0x64cf('0x94')]},'raw':!![]})[_0x64cf('0x28')](function(_0x50e62f){if(_0x50e62f&&_0x50e62f[_0x64cf('0x98')]===0x0){return db[_0x64cf('0x99')][_0x64cf('0x9a')]({'name':_0x3f3595[_0x64cf('0x2d')],'resourceId':_0x3f3595['id'],'type':_0x50e62f[_0x64cf('0x2d')],'sectionId':_0x50e62f['id']},{})[_0x64cf('0x28')](function(){return _0x5a9d15;});}else{return _0x5a9d15;}})['catch'](function(_0x5eb05){logger['error'](_0x64cf('0x9b'),_0x5eb05);throw _0x5eb05;});}return _0x5a9d15;})[_0x64cf('0x28')](respondWithResult(_0x1ff31b,null))['catch'](handleError(_0x1ff31b,null));}});}catch(_0xece15){_0x1ff31b[_0x64cf('0x1d')](0x1f4)[_0x64cf('0x2e')](_0xece15);}};function removeReferences(_0x4f6b4d,_0x8368cc){try{if(_0x4f6b4d){fs[_0x64cf('0x68')](_0x4f6b4d);logger[_0x64cf('0x69')](_0x64cf('0x9c'));}if(_0x8368cc){rimraf(_0x8368cc,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x1c33c3){logger[_0x64cf('0x58')](_0x1c33c3);}}exports['update']=function(_0x219b24,_0x1784e3,_0xfd39cf){return db['Plugin']['find']({'where':{'id':_0x219b24[_0x64cf('0x50')]['id']}})['then'](handleEntityNotFound(_0x1784e3,null))[_0x64cf('0x28')](saveUpdates(_0x219b24['body'],null))['then'](respondWithResult(_0x1784e3,null))['catch'](handleError(_0x1784e3,null));};exports['delete']=function(_0x12c056,_0x24fea4,_0x42e73a){return db['Plugin'][_0x64cf('0x4d')]({'where':{'id':_0x12c056[_0x64cf('0x50')]['id']}})[_0x64cf('0x28')](function(_0x377941){if(_0x377941){return _0x377941[_0x64cf('0x27')]();}})[_0x64cf('0x28')](function(_0x230264){rimraf(path[_0x64cf('0x51')](config['root'],_0x64cf('0x52'),path[_0x64cf('0x60')](_0x230264[_0x64cf('0x7')])),function(){});return _0x230264;})['then'](handleEntityNotFound(_0x24fea4,null))[_0x64cf('0x28')](respondWithStatusCode(_0x24fea4,null))[_0x64cf('0x4e')](handleError(_0x24fea4,null));};exports['webhookGet']=function(_0xcbe0a9,_0x238711,_0x20158b){return BPromise['resolve']()[_0x64cf('0x28')](function(){if(!_0xcbe0a9[_0x64cf('0x35')][_0x64cf('0x7')]){throw new Error(_0x64cf('0x9d'));}if(!_0xcbe0a9['query'][_0x64cf('0x9e')]){throw new Error(_0x64cf('0x9f'));}var _0x3d5c52=_0xcbe0a9[_0x64cf('0x35')]['hostname']?_0xcbe0a9['query']['hostname']+':'+_0xcbe0a9['query'][_0x64cf('0x9e')]:_0x64cf('0xa0')+_0xcbe0a9[_0x64cf('0x35')]['port'];var _0x915f8d=_0xcbe0a9[_0x64cf('0x35')]['json']?_0xcbe0a9['query'][_0x64cf('0x23')]:!![];var _0x1352a9=_0xcbe0a9['query'][_0x64cf('0xa1')]?_0xcbe0a9[_0x64cf('0x35')][_0x64cf('0xa1')]:null;var _0x460426={'method':_0xcbe0a9[_0x64cf('0xa2')],'uri':util['format'](_0x64cf('0xa3'),_0x3d5c52,_0xcbe0a9[_0x64cf('0x35')]['path']),'json':_0x915f8d,'resolveWithFullResponse':!![],'encoding':_0x1352a9,'qs':_0xcbe0a9[_0x64cf('0x35')]};if(_0xcbe0a9[_0x64cf('0xa4')]){_0x460426[_0x64cf('0xa4')]=_0xcbe0a9[_0x64cf('0xa4')];if(_0x460426[_0x64cf('0xa4')]['content-length']){delete _0x460426[_0x64cf('0xa4')]['content-length'];}}if(_0x460426[_0x64cf('0xa4')]['content-type']){delete _0x460426['headers']['content-type'];}return rp(_0x460426);})['then'](function(_0x13123b){if(_0x13123b){_0x238711[_0x64cf('0xa5')](_0x13123b[_0x64cf('0xa4')]);logger['info'](_0x13123b[_0x64cf('0x92')]);if(_[_0x64cf('0xa6')](_0xcbe0a9[_0x64cf('0x35')][_0x64cf('0x7')],_0x64cf('0x4f'))&&_0x13123b[_0x64cf('0xa7')]==0x1f4){return _0x238711[_0x64cf('0x2b')](_0x13123b[_0x64cf('0xa7')]);}else{return _0x238711[_0x64cf('0x1d')](_0x13123b[_0x64cf('0xa7')])['send'](_0x13123b[_0x64cf('0x92')]);}}else{return _0x238711[_0x64cf('0x2b')](0xc8);}})['catch'](handleError(_0x238711,null));};exports['webhookPost']=function(_0x20acb2,_0x2bd1a6,_0x93dfb6){return BPromise[_0x64cf('0xa8')]()[_0x64cf('0x28')](function(){if(!_0x20acb2[_0x64cf('0x35')][_0x64cf('0x7')]){throw new Error(_0x64cf('0x9d'));}if(!_0x20acb2[_0x64cf('0x35')][_0x64cf('0x9e')]){throw new Error(_0x64cf('0x9f'));}var _0x60baca=_0x20acb2['query'][_0x64cf('0xa9')]?_0x20acb2[_0x64cf('0x35')][_0x64cf('0xa9')]+':'+_0x20acb2[_0x64cf('0x35')][_0x64cf('0x9e')]:_0x64cf('0xa0')+_0x20acb2['query'][_0x64cf('0x9e')];var _0x2f1d66=_0x20acb2[_0x64cf('0x35')][_0x64cf('0x23')]?_0x20acb2[_0x64cf('0x35')]['json']:!![];var _0x214add=_0x20acb2[_0x64cf('0x35')][_0x64cf('0xa1')]?_0x20acb2[_0x64cf('0x35')]['encoding']:null;var _0x144eb7={'method':_0x20acb2[_0x64cf('0xa2')],'uri':util['format'](_0x64cf('0xa3'),_0x60baca,_0x20acb2[_0x64cf('0x35')][_0x64cf('0x7')]),'json':_0x2f1d66,'resolveWithFullResponse':!![],'encoding':_0x214add,'body':_0x20acb2[_0x64cf('0x92')]};if(_0x20acb2[_0x64cf('0xa4')]){_0x144eb7['headers']=_0x20acb2['headers'];if(_0x144eb7[_0x64cf('0xa4')]['content-length']){delete _0x144eb7[_0x64cf('0xa4')][_0x64cf('0xaa')];}}if(_0x144eb7[_0x64cf('0xa4')][_0x64cf('0xab')]){delete _0x144eb7['headers'][_0x64cf('0xab')];}return rp(_0x144eb7);})[_0x64cf('0x28')](function(_0x4b4038){if(_0x4b4038){_0x2bd1a6[_0x64cf('0xa5')](_0x4b4038[_0x64cf('0xa4')]);logger['info'](_0x4b4038[_0x64cf('0x92')]);return _0x2bd1a6[_0x64cf('0x1d')](_0x4b4038[_0x64cf('0xa7')])['send'](_0x4b4038[_0x64cf('0x92')]);}else{return _0x2bd1a6[_0x64cf('0x2b')](0xc8);}})[_0x64cf('0x4e')](handleError(_0x2bd1a6,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index e724ada..b85146f 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 _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x3816c2,_0xb221e1){var _0x144669=function(_0x149c29){while(--_0x149c29){_0x3816c2['push'](_0x3816c2['shift']());}};_0x144669(++_0xb221e1);}(_0xadb5,0xad));var _0x5adb=function(_0x239fa5,_0x212390){_0x239fa5=_0x239fa5-0x0;var _0x324459=_0xadb5[_0x239fa5];return _0x324459;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x5adb('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){PluginEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);PluginEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];Plugin[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=PluginEvents; \ No newline at end of file +var _0x9536=['../../mysqldb','Plugin','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9536,0x179));var _0x6953=function(_0x9a3e0f,_0x2f796d){_0x9a3e0f=_0x9a3e0f-0x0;var _0x3d2a9a=_0x9536[_0x9a3e0f];return _0x3d2a9a;};'use strict';var EventEmitter=require(_0x6953('0x0'));var Plugin=require(_0x6953('0x1'))['db'][_0x6953('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x6953('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6953('0x4'),'afterDestroy':'remove'};function emitEvent(_0x42fb54){return function(_0x3c32c7,_0x1dee7c,_0x3ba964){PluginEvents[_0x6953('0x5')](_0x42fb54+':'+_0x3c32c7['id'],_0x3c32c7);PluginEvents['emit'](_0x42fb54,_0x3c32c7);_0x3ba964(null);};}for(var e in events){if(events[_0x6953('0x6')](e)){var event=events[e];Plugin[_0x6953('0x7')](e,emitEvent(event));}}module[_0x6953('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 4c14cdb..bbfb4e6 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 _0xee14=['Plugin','plugins','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','define'];(function(_0x25049a,_0x1f3225){var _0x48328d=function(_0x970515){while(--_0x970515){_0x25049a['push'](_0x25049a['shift']());}};_0x48328d(++_0x1f3225);}(_0xee14,0x13a));var _0x4ee1=function(_0x24d881,_0x446dd2){_0x24d881=_0x24d881-0x0;var _0x501c10=_0xee14[_0x24d881];return _0x501c10;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ee1('0x0'))(_0x4ee1('0x1'));var moment=require(_0x4ee1('0x2'));var BPromise=require(_0x4ee1('0x3'));var rp=require(_0x4ee1('0x4'));var fs=require('fs');var path=require(_0x4ee1('0x5'));var rimraf=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var attributes=require(_0x4ee1('0x8'));module['exports']=function(_0xba6d36,_0x573700){return _0xba6d36[_0x4ee1('0x9')](_0x4ee1('0xa'),attributes,{'tableName':_0x4ee1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac31=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','Plugin','plugins','lodash','util'];(function(_0x17cfa5,_0x3cf1d3){var _0x5a9f1f=function(_0x3682ee){while(--_0x3682ee){_0x17cfa5['push'](_0x17cfa5['shift']());}};_0x5a9f1f(++_0x3cf1d3);}(_0xac31,0xca));var _0x1ac3=function(_0x183ccb,_0x29292d){_0x183ccb=_0x183ccb-0x0;var _0x516c56=_0xac31[_0x183ccb];return _0x516c56;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var logger=require(_0x1ac3('0x2'))(_0x1ac3('0x3'));var moment=require(_0x1ac3('0x4'));var BPromise=require(_0x1ac3('0x5'));var rp=require(_0x1ac3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var attributes=require('./plugin.attributes');module['exports']=function(_0xbe22b7,_0x20027f){return _0xbe22b7[_0x1ac3('0x9')](_0x1ac3('0xa'),attributes,{'tableName':_0x1ac3('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 4d5bf3f..01d9b9c 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 _0x4434=['CreatePlugin','create','body','options','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','register','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4434,0x95));var _0x4443=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4434[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x4443('0x0'));var moment=require(_0x4443('0x1'));var BPromise=require('bluebird');var rs=require(_0x4443('0x2'));var fs=require('fs');var Redis=require(_0x4443('0x3'));var db=require(_0x4443('0x4'))['db'];var utils=require(_0x4443('0x5'));var logger=require('../../config/logger')(_0x4443('0x6'));var config=require(_0x4443('0x7'));var jayson=require(_0x4443('0x8'));var client=jayson[_0x4443('0x9')][_0x4443('0xa')]({'port':0x232a});config['redis']=_[_0x4443('0xb')](config['redis'],{'host':_0x4443('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4443('0xd')]));require('./plugin.socket')[_0x4443('0xe')](socket);function respondWithRpcPromise(_0x9dd68,_0x4df9c2,_0x405def){return new BPromise(function(_0x1f0870,_0x3d9602){return client['request'](_0x9dd68,_0x405def)['then'](function(_0xf56f01){logger[_0x4443('0xf')](_0x4443('0x10'),_0x4df9c2,_0x4443('0x11'));logger[_0x4443('0x12')]('Plugin,\x20%s,\x20%s,\x20%s',_0x4df9c2,_0x4443('0x11'),JSON[_0x4443('0x13')](_0xf56f01));if(_0xf56f01[_0x4443('0x14')]){if(_0xf56f01[_0x4443('0x14')][_0x4443('0x15')]===0x1f4){logger['error'](_0x4443('0x10'),_0x4df9c2,_0xf56f01['error'][_0x4443('0x16')]);return _0x3d9602(_0xf56f01[_0x4443('0x14')][_0x4443('0x16')]);}logger[_0x4443('0x14')](_0x4443('0x10'),_0x4df9c2,_0xf56f01[_0x4443('0x14')]['message']);return _0x1f0870(_0xf56f01[_0x4443('0x14')]['message']);}else{logger[_0x4443('0xf')](_0x4443('0x10'),_0x4df9c2,_0x4443('0x11'));_0x1f0870(_0xf56f01[_0x4443('0x17')][_0x4443('0x16')]);}})[_0x4443('0x18')](function(_0x19e3f3){logger['error'](_0x4443('0x10'),_0x4df9c2,_0x19e3f3);_0x3d9602(_0x19e3f3);});});}exports[_0x4443('0x19')]=function(_0x12a369){var _0x3adae8=this;return new Promise(function(_0x53e183,_0x4c3fe7){return db['Plugin'][_0x4443('0x1a')](_0x12a369[_0x4443('0x1b')],{'raw':_0x12a369[_0x4443('0x1c')]?_0x12a369[_0x4443('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3ff10d){logger['info'](_0x4443('0x19'),_0x12a369);logger[_0x4443('0x12')](_0x4443('0x19'),_0x12a369,JSON[_0x4443('0x13')](_0x3ff10d));_0x53e183(_0x3ff10d);})['catch'](function(_0x18c99e){logger[_0x4443('0x14')](_0x4443('0x19'),_0x18c99e[_0x4443('0x16')],_0x12a369);_0x4c3fe7(_0x3adae8[_0x4443('0x14')](0x1f4,_0x18c99e[_0x4443('0x16')]));});});}; \ No newline at end of file +var _0xf2a0=['http','redis','defaults','localhost','register','request','then','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','info','result','catch','Plugin','create','body','options','CreatePlugin','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x26e225,_0x250043){var _0x25fff1=function(_0x43994a){while(--_0x43994a){_0x26e225['push'](_0x26e225['shift']());}};_0x25fff1(++_0x250043);}(_0xf2a0,0x74));var _0x0f2a=function(_0x802997,_0x5534a2){_0x802997=_0x802997-0x0;var _0x35c641=_0xf2a0[_0x802997];return _0x35c641;};'use strict';var _=require(_0x0f2a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0f2a('0x1'));var rs=require(_0x0f2a('0x2'));var fs=require('fs');var Redis=require(_0x0f2a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0f2a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x0f2a('0x5'));var jayson=require(_0x0f2a('0x6'));var client=jayson[_0x0f2a('0x7')][_0x0f2a('0x8')]({'port':0x232a});config[_0x0f2a('0x9')]=_[_0x0f2a('0xa')](config[_0x0f2a('0x9')],{'host':_0x0f2a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./plugin.socket')[_0x0f2a('0xc')](socket);function respondWithRpcPromise(_0x448cd7,_0x588d10,_0x50f213){return new BPromise(function(_0x5290bd,_0x5525){return client[_0x0f2a('0xd')](_0x448cd7,_0x50f213)[_0x0f2a('0xe')](function(_0x33fbd1){logger['info']('Plugin,\x20%s,\x20%s',_0x588d10,_0x0f2a('0xf'));logger[_0x0f2a('0x10')](_0x0f2a('0x11'),_0x588d10,'request\x20sent',JSON[_0x0f2a('0x12')](_0x33fbd1));if(_0x33fbd1[_0x0f2a('0x13')]){if(_0x33fbd1['error'][_0x0f2a('0x14')]===0x1f4){logger[_0x0f2a('0x13')](_0x0f2a('0x15'),_0x588d10,_0x33fbd1[_0x0f2a('0x13')]['message']);return _0x5525(_0x33fbd1[_0x0f2a('0x13')][_0x0f2a('0x16')]);}logger[_0x0f2a('0x13')](_0x0f2a('0x15'),_0x588d10,_0x33fbd1[_0x0f2a('0x13')][_0x0f2a('0x16')]);return _0x5290bd(_0x33fbd1[_0x0f2a('0x13')]['message']);}else{logger[_0x0f2a('0x17')](_0x0f2a('0x15'),_0x588d10,_0x0f2a('0xf'));_0x5290bd(_0x33fbd1[_0x0f2a('0x18')]['message']);}})[_0x0f2a('0x19')](function(_0x43cd55){logger[_0x0f2a('0x13')](_0x0f2a('0x15'),_0x588d10,_0x43cd55);_0x5525(_0x43cd55);});});}exports['CreatePlugin']=function(_0x52923f){var _0x1ea89b=this;return new Promise(function(_0x3f96f3,_0x2d8b4e){return db[_0x0f2a('0x1a')][_0x0f2a('0x1b')](_0x52923f[_0x0f2a('0x1c')],{'raw':_0x52923f['options']?_0x52923f[_0x0f2a('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x0f2a('0xe')](function(_0xae0740){logger['info']('CreatePlugin',_0x52923f);logger[_0x0f2a('0x10')](_0x0f2a('0x1e'),_0x52923f,JSON[_0x0f2a('0x12')](_0xae0740));_0x3f96f3(_0xae0740);})['catch'](function(_0x339445){logger[_0x0f2a('0x13')](_0x0f2a('0x1e'),_0x339445[_0x0f2a('0x16')],_0x52923f);_0x2d8b4e(_0x1ea89b['error'](0x1f4,_0x339445[_0x0f2a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 9b6f427..304fea9 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 _0x9a2a=['save','remove','emit','removeListener','register','length','plugin:','./plugin.events'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9a2a,0xa7));var _0xa9a2=function(_0x2c6a0d,_0x28a135){_0x2c6a0d=_0x2c6a0d-0x0;var _0x4f9bde=_0x9a2a[_0x2c6a0d];return _0x4f9bde;};'use strict';var PluginEvents=require(_0xa9a2('0x0'));var events=[_0xa9a2('0x1'),_0xa9a2('0x2'),'update'];function createListener(_0x59c1e6,_0x57ed98){return function(_0x9b1ff5){_0x57ed98[_0xa9a2('0x3')](_0x59c1e6,_0x9b1ff5);};}function removeListener(_0x196f84,_0xc11eab){return function(){PluginEvents[_0xa9a2('0x4')](_0x196f84,_0xc11eab);};}exports[_0xa9a2('0x5')]=function(_0x4d5f04){for(var _0x5c5e56=0x0,_0x388689=events[_0xa9a2('0x6')];_0x5c5e56<_0x388689;_0x5c5e56++){var _0xedae90=events[_0x5c5e56];var _0x287343=createListener(_0xa9a2('0x7')+_0xedae90,_0x4d5f04);PluginEvents['on'](_0xedae90,_0x287343);}}; \ No newline at end of file +var _0x8cdb=['remove','update','emit','removeListener','register','length','plugin:','./plugin.events','save'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8cdb,0x193));var _0xb8cd=function(_0x3f690f,_0x44d3fd){_0x3f690f=_0x3f690f-0x0;var _0xcf60c9=_0x8cdb[_0x3f690f];return _0xcf60c9;};'use strict';var PluginEvents=require(_0xb8cd('0x0'));var events=[_0xb8cd('0x1'),_0xb8cd('0x2'),_0xb8cd('0x3')];function createListener(_0x5598df,_0x9a5b16){return function(_0x3405c8){_0x9a5b16[_0xb8cd('0x4')](_0x5598df,_0x3405c8);};}function removeListener(_0x45bf4e,_0x453a74){return function(){PluginEvents[_0xb8cd('0x5')](_0x45bf4e,_0x453a74);};}exports[_0xb8cd('0x6')]=function(_0x4e3830){for(var _0x39931b=0x0,_0x16194f=events[_0xb8cd('0x7')];_0x39931b<_0x16194f;_0x39931b++){var _0x197189=events[_0x39931b];var _0x2046df=createListener(_0xb8cd('0x8')+_0x197189,_0x4e3830);PluginEvents['on'](_0x197189,_0x2046df);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index da82533..af36a27 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 _0xf3e9=['./pm2.controller','isAuthenticated','index','show','create','/:id','delete','exports','express','Router','../../components/auth/service'];(function(_0x1810a8,_0x265be1){var _0x164ee4=function(_0x357780){while(--_0x357780){_0x1810a8['push'](_0x1810a8['shift']());}};_0x164ee4(++_0x265be1);}(_0xf3e9,0xc3));var _0x9f3e=function(_0x5f5648,_0x174130){_0x5f5648=_0x5f5648-0x0;var _0x31f28a=_0xf3e9[_0x5f5648];return _0x31f28a;};'use strict';var express=require(_0x9f3e('0x0'));var router=express[_0x9f3e('0x1')]();var auth=require(_0x9f3e('0x2'));var controller=require(_0x9f3e('0x3'));router['get']('/',auth[_0x9f3e('0x4')](),controller[_0x9f3e('0x5')]);router['get']('/:id',auth[_0x9f3e('0x4')](),controller[_0x9f3e('0x6')]);router['post']('/',auth[_0x9f3e('0x4')](),controller[_0x9f3e('0x7')]);router['put'](_0x9f3e('0x8'),auth[_0x9f3e('0x4')](),controller['update']);router[_0x9f3e('0x9')]('/:id',auth[_0x9f3e('0x4')](),controller['destroy']);module[_0x9f3e('0xa')]=router; \ No newline at end of file +var _0x65b9=['isAuthenticated','index','show','create','put','/:id','update','exports','express','Router','../../components/auth/service','get'];(function(_0x448b67,_0x51e880){var _0x25e99c=function(_0x4aed7f){while(--_0x4aed7f){_0x448b67['push'](_0x448b67['shift']());}};_0x25e99c(++_0x51e880);}(_0x65b9,0x104));var _0x965b=function(_0x3900c5,_0x47d0b2){_0x3900c5=_0x3900c5-0x0;var _0xf7a638=_0x65b9[_0x3900c5];return _0xf7a638;};'use strict';var express=require(_0x965b('0x0'));var router=express[_0x965b('0x1')]();var auth=require(_0x965b('0x2'));var controller=require('./pm2.controller');router[_0x965b('0x3')]('/',auth[_0x965b('0x4')](),controller[_0x965b('0x5')]);router[_0x965b('0x3')]('/:id',auth['isAuthenticated'](),controller[_0x965b('0x6')]);router['post']('/',auth[_0x965b('0x4')](),controller[_0x965b('0x7')]);router[_0x965b('0x8')](_0x965b('0x9'),auth[_0x965b('0x4')](),controller[_0x965b('0xa')]);router['delete'](_0x965b('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x965b('0xb')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 581a017..c3e7fd6 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 _0x3079=['../../config/logger','path','child_process','exec','sendStatus','status','json','error','stack','name','send','info','index','list','then','reject','catch','show','params','create','body','script','join','../../files/plugins','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','Unknown\x20status','delete','Unknown\x20id','lodash'];(function(_0x3748dd,_0x8c08eb){var _0x4b4a37=function(_0x3daba8){while(--_0x3daba8){_0x3748dd['push'](_0x3748dd['shift']());}};_0x4b4a37(++_0x8c08eb);}(_0x3079,0x87));var _0x9307=function(_0x3b4df9,_0x18ad5c){_0x3b4df9=_0x3b4df9-0x0;var _0x2d226d=_0x3079[_0x3b4df9];return _0x2d226d;};'use strict';var _=require(_0x9307('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x9307('0x1'))('api');var path=require(_0x9307('0x2'));var exec=require(_0x9307('0x3'))[_0x9307('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x41a441,_0x4b9e6f){return function(_0x32a9d6){if(!_0x32a9d6){_0x41a441[_0x9307('0x5')](0x194);;}return _0x32a9d6;};}function respondWithResult(_0x162e8e,_0x4d7251){_0x4d7251=_0x4d7251||0xc8;return function(_0x2a42ae){if(_0x2a42ae){return _0x162e8e[_0x9307('0x6')](_0x4d7251)[_0x9307('0x7')](_0x2a42ae);}return null;};}function handleError(_0x2e4d80,_0x4ac0e8){_0x4ac0e8=_0x4ac0e8||0x1f4;return function(_0x50f642){logger[_0x9307('0x8')](_0x50f642[_0x9307('0x9')]);if(_0x50f642['name']){delete _0x50f642[_0x9307('0xa')];}_0x2e4d80[_0x9307('0x6')](_0x4ac0e8)[_0x9307('0xb')](_0x50f642);};}function execChildProcess(){return new BPromise(function(_0x2a3ffc,_0x56b30a){exec('npm\x20install',function(_0x335fab,_0x9ef1ad,_0x1ce32c){logger[_0x9307('0xc')](_0x9ef1ad);logger[_0x9307('0xc')](_0x1ce32c);if(_0x335fab){logger[_0x9307('0x8')](_0x335fab);return _0x56b30a(_0x335fab);}return _0x2a3ffc(_0x9ef1ad);});});}exports[_0x9307('0xd')]=function(_0x34f411,_0x53c5b0){return pm2[_0x9307('0xe')]()[_0x9307('0xf')](function(_0x413d9d){if(_0x413d9d){var _0x5ae507=_[_0x9307('0x10')](_0x413d9d,function(_0x2a5369){return _0x2a5369[_0x9307('0xa')]==='express'||_0x2a5369[_0x9307('0xa')]==='motion2';});return{'rows':_0x5ae507,'count':_0x5ae507['length']};}return null;})[_0x9307('0xf')](respondWithResult(_0x53c5b0,null))[_0x9307('0x11')](handleError(_0x53c5b0,null));};exports[_0x9307('0x12')]=function(_0x519e7d,_0x1fd73d){return pm2['describe'](_0x519e7d[_0x9307('0x13')]['id'])[_0x9307('0xf')](respondWithResult(_0x1fd73d,null))['then'](handleEntityNotFound(_0x1fd73d,null))['catch'](handleError(_0x1fd73d,null));};exports[_0x9307('0x14')]=function(_0x464e7e,_0xe03f50){if(_0x464e7e['body'][_0x9307('0xa')]&&_0x464e7e[_0x9307('0x15')][_0x9307('0x16')]){var _0x58755f=path[_0x9307('0x17')](__dirname,_0x9307('0x18'),_0x464e7e['body']['script']);var _0x41a6f9=process['cwd']();process[_0x9307('0x19')](path[_0x9307('0x1a')](_0x58755f));return execChildProcess()[_0x9307('0xf')](function(_0x5c2867){process['chdir'](_0x41a6f9);return pm2[_0x9307('0x1b')]({'name':_0x464e7e[_0x9307('0x15')][_0x9307('0xa')],'script':_0x58755f});})[_0x9307('0xf')](function(_0x7c2c6d){pm2[_0x9307('0x1c')]();return _0x7c2c6d[0x0];})[_0x9307('0xf')](respondWithResult(_0xe03f50,0xc9))[_0x9307('0x11')](handleError(_0xe03f50,null));}else{return _0xe03f50[_0x9307('0x6')](0x1f4)[_0x9307('0xb')]({'message':_0x9307('0x1d')});}};exports[_0x9307('0x1e')]=function(_0x25175d,_0x26c6b8){if(_0x25175d['body']['id']){delete _0x25175d[_0x9307('0x15')]['id'];}var _0x18db58={'online':'restart','stopped':'stop'};if(_0x18db58['hasOwnProperty'](_0x25175d['body'][_0x9307('0x6')])){return pm2[_0x18db58[_0x25175d[_0x9307('0x15')]['status']]](_0x25175d[_0x9307('0x13')]['id'])[_0x9307('0xf')](respondWithResult(_0x26c6b8,0xc8))[_0x9307('0x11')](handleError(_0x26c6b8,null));}else{return _0x26c6b8[_0x9307('0x6')](0x1f4)[_0x9307('0xb')]({'message':_0x9307('0x1f')});}};exports['destroy']=function(_0x5803e3,_0x1ac363){if(_0x5803e3[_0x9307('0x15')]['id']){delete _0x5803e3[_0x9307('0x15')]['id'];}if(_0x5803e3[_0x9307('0x13')]['id']){return pm2[_0x9307('0x20')](_0x5803e3['params']['id'])[_0x9307('0xf')](function(_0x56aa11){pm2[_0x9307('0x1c')]();return _0x56aa11[0x0];})[_0x9307('0xf')](respondWithResult(_0x1ac363,null))[_0x9307('0x11')](handleError(_0x1ac363,null));}else{return _0x1ac363[_0x9307('0x6')](0x1f4)[_0x9307('0xb')]({'message':_0x9307('0x21')});}}; \ No newline at end of file +var _0x5014=['status','error','stack','name','send','info','list','then','express','length','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','dirname','chdir','start','dump','update','restart','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/logger','api','path','exec','bluebird','sendStatus'];(function(_0x11b1b3,_0xf3cc69){var _0x437029=function(_0x40499a){while(--_0x40499a){_0x11b1b3['push'](_0x11b1b3['shift']());}};_0x437029(++_0xf3cc69);}(_0x5014,0x14f));var _0x4501=function(_0x2c508c,_0x2a365b){_0x2c508c=_0x2c508c-0x0;var _0x5af45a=_0x5014[_0x2c508c];return _0x5af45a;};'use strict';var _=require(_0x4501('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x4501('0x1'))(_0x4501('0x2'));var path=require(_0x4501('0x3'));var exec=require('child_process')[_0x4501('0x4')];var BPromise=require(_0x4501('0x5'));function handleEntityNotFound(_0x3c21fb,_0x277ada){return function(_0x2857e5){if(!_0x2857e5){_0x3c21fb[_0x4501('0x6')](0x194);;}return _0x2857e5;};}function respondWithResult(_0x6702ef,_0x8581c0){_0x8581c0=_0x8581c0||0xc8;return function(_0x48d75a){if(_0x48d75a){return _0x6702ef[_0x4501('0x7')](_0x8581c0)['json'](_0x48d75a);}return null;};}function handleError(_0x226a45,_0x1c341e){_0x1c341e=_0x1c341e||0x1f4;return function(_0x899892){logger[_0x4501('0x8')](_0x899892[_0x4501('0x9')]);if(_0x899892['name']){delete _0x899892[_0x4501('0xa')];}_0x226a45[_0x4501('0x7')](_0x1c341e)[_0x4501('0xb')](_0x899892);};}function execChildProcess(){return new BPromise(function(_0x48777c,_0x4db51f){exec('npm\x20install',function(_0x1142ad,_0x3957a2,_0x1cb2fb){logger[_0x4501('0xc')](_0x3957a2);logger[_0x4501('0xc')](_0x1cb2fb);if(_0x1142ad){logger['error'](_0x1142ad);return _0x4db51f(_0x1142ad);}return _0x48777c(_0x3957a2);});});}exports['index']=function(_0xc225c,_0x2bad52){return pm2[_0x4501('0xd')]()[_0x4501('0xe')](function(_0x8005e5){if(_0x8005e5){var _0x5358de=_['reject'](_0x8005e5,function(_0x4ccd68){return _0x4ccd68[_0x4501('0xa')]===_0x4501('0xf')||_0x4ccd68[_0x4501('0xa')]==='motion2';});return{'rows':_0x5358de,'count':_0x5358de[_0x4501('0x10')]};}return null;})['then'](respondWithResult(_0x2bad52,null))[_0x4501('0x11')](handleError(_0x2bad52,null));};exports[_0x4501('0x12')]=function(_0x29dbae,_0x34139f){return pm2[_0x4501('0x13')](_0x29dbae[_0x4501('0x14')]['id'])['then'](respondWithResult(_0x34139f,null))[_0x4501('0xe')](handleEntityNotFound(_0x34139f,null))['catch'](handleError(_0x34139f,null));};exports[_0x4501('0x15')]=function(_0x3b244a,_0x50e3bb){if(_0x3b244a[_0x4501('0x16')][_0x4501('0xa')]&&_0x3b244a['body'][_0x4501('0x17')]){var _0x4f9b06=path[_0x4501('0x18')](__dirname,_0x4501('0x19'),_0x3b244a['body']['script']);var _0x1e9cba=process[_0x4501('0x1a')]();process['chdir'](path[_0x4501('0x1b')](_0x4f9b06));return execChildProcess()[_0x4501('0xe')](function(_0x3aa390){process[_0x4501('0x1c')](_0x1e9cba);return pm2[_0x4501('0x1d')]({'name':_0x3b244a[_0x4501('0x16')][_0x4501('0xa')],'script':_0x4f9b06});})['then'](function(_0x43464b){pm2[_0x4501('0x1e')]();return _0x43464b[0x0];})[_0x4501('0xe')](respondWithResult(_0x50e3bb,0xc9))[_0x4501('0x11')](handleError(_0x50e3bb,null));}else{return _0x50e3bb[_0x4501('0x7')](0x1f4)[_0x4501('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x4501('0x1f')]=function(_0x5cea28,_0x1532b8){if(_0x5cea28[_0x4501('0x16')]['id']){delete _0x5cea28[_0x4501('0x16')]['id'];}var _0x58a3ba={'online':_0x4501('0x20'),'stopped':_0x4501('0x21')};if(_0x58a3ba['hasOwnProperty'](_0x5cea28['body'][_0x4501('0x7')])){return pm2[_0x58a3ba[_0x5cea28[_0x4501('0x16')][_0x4501('0x7')]]](_0x5cea28[_0x4501('0x14')]['id'])[_0x4501('0xe')](respondWithResult(_0x1532b8,0xc8))[_0x4501('0x11')](handleError(_0x1532b8,null));}else{return _0x1532b8['status'](0x1f4)[_0x4501('0xb')]({'message':_0x4501('0x22')});}};exports[_0x4501('0x23')]=function(_0x5b01b3,_0x243eb4){if(_0x5b01b3[_0x4501('0x16')]['id']){delete _0x5b01b3['body']['id'];}if(_0x5b01b3['params']['id']){return pm2[_0x4501('0x24')](_0x5b01b3['params']['id'])[_0x4501('0xe')](function(_0x2c60ca){pm2[_0x4501('0x1e')]();return _0x2c60ca[0x0];})[_0x4501('0xe')](respondWithResult(_0x243eb4,null))[_0x4501('0x11')](handleError(_0x243eb4,null));}else{return _0x243eb4[_0x4501('0x7')](0x1f4)[_0x4501('0xb')]({'message':_0x4501('0x25')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index f65fbe5..ba6e25f 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 _0xe83f=['util','path','express','../../components/auth/service','../../components/interaction/service','exports','multer'];(function(_0x2175d2,_0x3b5dc5){var _0x410132=function(_0x50dfd5){while(--_0x50dfd5){_0x2175d2['push'](_0x2175d2['shift']());}};_0x410132(++_0x3b5dc5);}(_0xe83f,0x1b8));var _0xfe83=function(_0x1208cc,_0x3de835){_0x1208cc=_0x1208cc-0x0;var _0x48114b=_0xe83f[_0x1208cc];return _0x48114b;};'use strict';var multer=require(_0xfe83('0x0'));var util=require(_0xfe83('0x1'));var path=require(_0xfe83('0x2'));var timeout=require('connect-timeout');var express=require(_0xfe83('0x3'));var router=express['Router']();var auth=require(_0xfe83('0x4'));var interaction=require(_0xfe83('0x5'));var config=require('../../config/environment');module[_0xfe83('0x6')]=router; \ No newline at end of file +var _0x6d12=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','multer','util'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x6d12,0x9e));var _0x26d1=function(_0x1654f5,_0x5e1214){_0x1654f5=_0x1654f5-0x0;var _0x37cd7d=_0x6d12[_0x1654f5];return _0x37cd7d;};'use strict';var multer=require(_0x26d1('0x0'));var util=require(_0x26d1('0x1'));var path=require(_0x26d1('0x2'));var timeout=require(_0x26d1('0x3'));var express=require(_0x26d1('0x4'));var router=express[_0x26d1('0x5')]();var auth=require(_0x26d1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x26d1('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index ce6132b..0f0009e 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 _0x549a=['STRING','DATE','exports','INTEGER'];(function(_0x2c0baa,_0x25cca9){var _0x5add30=function(_0x2e8417){while(--_0x2e8417){_0x2c0baa['push'](_0x2c0baa['shift']());}};_0x5add30(++_0x25cca9);}(_0x549a,0x72));var _0xa549=function(_0x231568,_0x2b3e7b){_0x231568=_0x231568-0x0;var _0x9d96c8=_0x549a[_0x231568];return _0x9d96c8;};'use strict';var Sequelize=require('sequelize');module[_0xa549('0x0')]={'state':{'type':Sequelize[_0xa549('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xa549('0x2')]},'scheduledat':{'type':Sequelize[_0xa549('0x3')]},'uniqueid':{'type':Sequelize[_0xa549('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xa549('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xa549('0x2')]},'campaigntype':{'type':Sequelize[_0xa549('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3bf9=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x18991a,_0x1a32a0){var _0x54ecd1=function(_0x53e597){while(--_0x53e597){_0x18991a['push'](_0x18991a['shift']());}};_0x54ecd1(++_0x1a32a0);}(_0x3bf9,0x1e4));var _0x93bf=function(_0x230628,_0x4b01f9){_0x230628=_0x230628-0x0;var _0xd221b1=_0x3bf9[_0x230628];return _0xd221b1;};'use strict';var Sequelize=require(_0x93bf('0x0'));module[_0x93bf('0x1')]={'state':{'type':Sequelize[_0x93bf('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x93bf('0x3')]},'scheduledat':{'type':Sequelize[_0x93bf('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x93bf('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x93bf('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x93bf('0x3')]},'membername':{'type':Sequelize[_0x93bf('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 5ae8eb0..7d68c9b 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 _0xbf07=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','ReportAgentPreview','report_agent_preview'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xbf07,0x1a4));var _0x7bf0=function(_0xae1a83,_0x1980d4){_0xae1a83=_0xae1a83-0x0;var _0xdb9da8=_0xbf07[_0xae1a83];return _0xdb9da8;};'use strict';var _=require(_0x7bf0('0x0'));var util=require(_0x7bf0('0x1'));var logger=require(_0x7bf0('0x2'))(_0x7bf0('0x3'));var moment=require(_0x7bf0('0x4'));var BPromise=require('bluebird');var rp=require(_0x7bf0('0x5'));var fs=require('fs');var path=require(_0x7bf0('0x6'));var rimraf=require(_0x7bf0('0x7'));var config=require(_0x7bf0('0x8'));var attributes=require('./reportAgentPreview.attributes');module[_0x7bf0('0x9')]=function(_0x20fcfd,_0x32c344){return _0x20fcfd['define'](_0x7bf0('0xa'),attributes,{'tableName':_0x7bf0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd87c=['exports','define','report_agent_preview','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0x4aceca,_0x664876){var _0x5ba693=function(_0x45d5bf){while(--_0x45d5bf){_0x4aceca['push'](_0x4aceca['shift']());}};_0x5ba693(++_0x664876);}(_0xd87c,0x107));var _0xcd87=function(_0x485d05,_0x44c1c5){_0x485d05=_0x485d05-0x0;var _0x4dde37=_0xd87c[_0x485d05];return _0x4dde37;};'use strict';var _=require(_0xcd87('0x0'));var util=require(_0xcd87('0x1'));var logger=require(_0xcd87('0x2'))(_0xcd87('0x3'));var moment=require('moment');var BPromise=require(_0xcd87('0x4'));var rp=require(_0xcd87('0x5'));var fs=require('fs');var path=require(_0xcd87('0x6'));var rimraf=require(_0xcd87('0x7'));var config=require(_0xcd87('0x8'));var attributes=require(_0xcd87('0x9'));module[_0xcd87('0xa')]=function(_0x391258,_0x479b8b){return _0x391258[_0xcd87('0xb')]('ReportAgentPreview',attributes,{'tableName':_0xcd87('0xc'),'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 4df1834..c07f5a4 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 _0x7b01=['client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','message','result','catch','ReportAgentPreview','create','body','CreateReportAgentPreview','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x19c2ed,_0x1c3355){var _0x33c696=function(_0x4f53b7){while(--_0x4f53b7){_0x19c2ed['push'](_0x19c2ed['shift']());}};_0x33c696(++_0x1c3355);}(_0x7b01,0x1e5));var _0x17b0=function(_0x4bc584,_0x2e7c93){_0x4bc584=_0x4bc584-0x0;var _0x3b50f3=_0x7b01[_0x4bc584];return _0x3b50f3;};'use strict';var _=require(_0x17b0('0x0'));var util=require('util');var moment=require(_0x17b0('0x1'));var BPromise=require(_0x17b0('0x2'));var rs=require(_0x17b0('0x3'));var fs=require('fs');var Redis=require(_0x17b0('0x4'));var db=require(_0x17b0('0x5'))['db'];var utils=require(_0x17b0('0x6'));var logger=require(_0x17b0('0x7'))(_0x17b0('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x17b0('0x9')][_0x17b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12947d,_0x311a03,_0x1edaac){return new BPromise(function(_0x2f40bb,_0x4088e4){return client[_0x17b0('0xb')](_0x12947d,_0x1edaac)[_0x17b0('0xc')](function(_0x1f81cb){logger[_0x17b0('0xd')](_0x17b0('0xe'),_0x311a03,_0x17b0('0xf'));logger[_0x17b0('0x10')](_0x17b0('0x11'),_0x311a03,_0x17b0('0xf'),JSON['stringify'](_0x1f81cb));if(_0x1f81cb[_0x17b0('0x12')]){if(_0x1f81cb[_0x17b0('0x12')]['code']===0x1f4){logger['error'](_0x17b0('0xe'),_0x311a03,_0x1f81cb[_0x17b0('0x12')][_0x17b0('0x13')]);return _0x4088e4(_0x1f81cb[_0x17b0('0x12')][_0x17b0('0x13')]);}logger[_0x17b0('0x12')](_0x17b0('0xe'),_0x311a03,_0x1f81cb[_0x17b0('0x12')]['message']);return _0x2f40bb(_0x1f81cb[_0x17b0('0x12')][_0x17b0('0x13')]);}else{logger[_0x17b0('0xd')](_0x17b0('0xe'),_0x311a03,'request\x20sent');_0x2f40bb(_0x1f81cb[_0x17b0('0x14')]['message']);}})[_0x17b0('0x15')](function(_0x1bb67f){logger[_0x17b0('0x12')](_0x17b0('0xe'),_0x311a03,_0x1bb67f);_0x4088e4(_0x1bb67f);});});}exports['CreateReportAgentPreview']=function(_0x596f40){var _0x1c5bf2=this;return new Promise(function(_0x199ad5,_0x902428){return db[_0x17b0('0x16')][_0x17b0('0x17')](_0x596f40[_0x17b0('0x18')],{'raw':_0x596f40['options']?_0x596f40['options']['raw']===undefined?!![]:![]:!![]})[_0x17b0('0xc')](function(_0x628b79){logger[_0x17b0('0xd')](_0x17b0('0x19'),_0x596f40);logger[_0x17b0('0x10')](_0x17b0('0x19'),_0x596f40,JSON['stringify'](_0x628b79));_0x199ad5(_0x628b79);})[_0x17b0('0x15')](function(_0x18ef65){logger[_0x17b0('0x12')]('CreateReportAgentPreview',_0x18ef65['message'],_0x596f40);_0x902428(_0x1c5bf2[_0x17b0('0x12')](0x1f4,_0x18ef65[_0x17b0('0x13')]));});});}; \ No newline at end of file +var _0xc172=['catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','ReportAgentPreview','create','body','options','raw','then','CreateReportAgentPreview'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xc172,0x75));var _0x2c17=function(_0xd11832,_0x329abf){_0xd11832=_0xd11832-0x0;var _0x15c05c=_0xc172[_0xd11832];return _0x15c05c;};'use strict';var _=require(_0x2c17('0x0'));var util=require(_0x2c17('0x1'));var moment=require(_0x2c17('0x2'));var BPromise=require(_0x2c17('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c17('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c17('0x5'))(_0x2c17('0x6'));var config=require(_0x2c17('0x7'));var jayson=require(_0x2c17('0x8'));var client=jayson[_0x2c17('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ae4b1,_0x275a07,_0x4a9ade){return new BPromise(function(_0x44ddd4,_0x16e4cd){return client[_0x2c17('0xa')](_0x1ae4b1,_0x4a9ade)['then'](function(_0x32abe5){logger[_0x2c17('0xb')](_0x2c17('0xc'),_0x275a07,'request\x20sent');logger[_0x2c17('0xd')](_0x2c17('0xe'),_0x275a07,'request\x20sent',JSON[_0x2c17('0xf')](_0x32abe5));if(_0x32abe5[_0x2c17('0x10')]){if(_0x32abe5[_0x2c17('0x10')][_0x2c17('0x11')]===0x1f4){logger['error'](_0x2c17('0xc'),_0x275a07,_0x32abe5[_0x2c17('0x10')][_0x2c17('0x12')]);return _0x16e4cd(_0x32abe5[_0x2c17('0x10')][_0x2c17('0x12')]);}logger[_0x2c17('0x10')](_0x2c17('0xc'),_0x275a07,_0x32abe5[_0x2c17('0x10')]['message']);return _0x44ddd4(_0x32abe5[_0x2c17('0x10')][_0x2c17('0x12')]);}else{logger[_0x2c17('0xb')](_0x2c17('0xc'),_0x275a07,_0x2c17('0x13'));_0x44ddd4(_0x32abe5[_0x2c17('0x14')]['message']);}})['catch'](function(_0x504d23){logger['error'](_0x2c17('0xc'),_0x275a07,_0x504d23);_0x16e4cd(_0x504d23);});});}exports['CreateReportAgentPreview']=function(_0x1b5edf){var _0x140b8e=this;return new Promise(function(_0x8d4bab,_0x17586f){return db[_0x2c17('0x15')][_0x2c17('0x16')](_0x1b5edf[_0x2c17('0x17')],{'raw':_0x1b5edf['options']?_0x1b5edf[_0x2c17('0x18')][_0x2c17('0x19')]===undefined?!![]:![]:!![]})[_0x2c17('0x1a')](function(_0x241b21){logger[_0x2c17('0xb')](_0x2c17('0x1b'),_0x1b5edf);logger[_0x2c17('0xd')](_0x2c17('0x1b'),_0x1b5edf,JSON[_0x2c17('0xf')](_0x241b21));_0x8d4bab(_0x241b21);})[_0x2c17('0x1c')](function(_0x154159){logger[_0x2c17('0x10')](_0x2c17('0x1b'),_0x154159[_0x2c17('0x12')],_0x1b5edf);_0x17586f(_0x140b8e[_0x2c17('0x10')](0x1f4,_0x154159[_0x2c17('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index df6d1a4..f54bcf9 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 _0x7c7e=['/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/trunks','trunks','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','mail','showMailQueues','post','/chat/queues/:id/notify','queueNotify','chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','whatsapp','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','multer','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailAccounts'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x7c7e,0xd4));var _0xe7c7=function(_0xc90e24,_0x28ca42){_0xc90e24=_0xc90e24-0x0;var _0x4f974c=_0x7c7e[_0xc90e24];return _0x4f974c;};'use strict';var multer=require(_0xe7c7('0x0'));var util=require('util');var path=require(_0xe7c7('0x1'));var express=require(_0xe7c7('0x2'));var router=express[_0xe7c7('0x3')]();var auth=require(_0xe7c7('0x4'));var controller=require('./rpc.controller');router[_0xe7c7('0x5')](_0xe7c7('0x6'),auth[_0xe7c7('0x7')](),controller[_0xe7c7('0x8')]);router[_0xe7c7('0x5')](_0xe7c7('0x9'),auth[_0xe7c7('0x7')](),controller[_0xe7c7('0xa')]);router[_0xe7c7('0x5')](_0xe7c7('0xb'),auth[_0xe7c7('0x7')](),controller[_0xe7c7('0xc')]);router[_0xe7c7('0x5')](_0xe7c7('0xd'),auth[_0xe7c7('0x7')](),controller[_0xe7c7('0xe')]);router[_0xe7c7('0x5')](_0xe7c7('0xf'),auth[_0xe7c7('0x7')](),controller[_0xe7c7('0x10')]);router[_0xe7c7('0x5')](_0xe7c7('0x11'),auth[_0xe7c7('0x7')](),controller['mailQueues']);router['get']('/mail/accounts',auth['isAuthenticated'](),controller[_0xe7c7('0x12')]);router[_0xe7c7('0x5')](_0xe7c7('0x13'),auth[_0xe7c7('0x7')](),controller['openchannelQueues']);router['get'](_0xe7c7('0x14'),auth['isAuthenticated'](),controller[_0xe7c7('0x15')]);router[_0xe7c7('0x5')](_0xe7c7('0x16'),auth[_0xe7c7('0x7')](),controller['whatsappQueues']);router[_0xe7c7('0x5')](_0xe7c7('0x17'),auth['isAuthenticated'](),controller[_0xe7c7('0x18')]);router[_0xe7c7('0x5')](_0xe7c7('0x19'),auth[_0xe7c7('0x7')](),controller['voiceQueuesPreview']);router['get'](_0xe7c7('0x1a'),auth['isAuthenticated'](),controller[_0xe7c7('0x1b')]);router[_0xe7c7('0x5')](_0xe7c7('0x1c'),auth[_0xe7c7('0x7')](),controller[_0xe7c7('0x1d')]);router[_0xe7c7('0x5')](_0xe7c7('0x1e'),auth['isAuthenticated'](),controller[_0xe7c7('0x1f')]);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xe7c7('0x7')](),controller[_0xe7c7('0x20')]);router[_0xe7c7('0x5')](_0xe7c7('0x21'),auth[_0xe7c7('0x7')](),controller['showVoiceQueues']);router[_0xe7c7('0x5')]('/outbound',auth[_0xe7c7('0x7')](),controller[_0xe7c7('0x22')]);router[_0xe7c7('0x5')](_0xe7c7('0x23'),auth[_0xe7c7('0x7')](),controller[_0xe7c7('0x24')]);router[_0xe7c7('0x5')](_0xe7c7('0x25'),auth[_0xe7c7('0x7')](),controller[_0xe7c7('0x26')]);router[_0xe7c7('0x27')](_0xe7c7('0x28'),auth['isAuthenticated'](),controller[_0xe7c7('0x29')]);router[_0xe7c7('0x5')]('/telephones',auth['isAuthenticated'](),controller['telephones']);router[_0xe7c7('0x5')](_0xe7c7('0x2a'),auth[_0xe7c7('0x7')](),controller[_0xe7c7('0x2b')]);router[_0xe7c7('0x5')]('/campaigns',auth[_0xe7c7('0x7')](),controller['campaigns']);router[_0xe7c7('0x5')](_0xe7c7('0x2c'),auth[_0xe7c7('0x7')](),controller[_0xe7c7('0x2d')]);router[_0xe7c7('0x5')](_0xe7c7('0x2e'),auth[_0xe7c7('0x7')](),controller[_0xe7c7('0x2f')]);router[_0xe7c7('0x5')](_0xe7c7('0x30'),auth[_0xe7c7('0x7')](),controller[_0xe7c7('0x31')]);router['get'](_0xe7c7('0x32'),auth[_0xe7c7('0x7')](),controller[_0xe7c7('0x33')]);router[_0xe7c7('0x5')](_0xe7c7('0x34'),auth[_0xe7c7('0x7')](),controller[_0xe7c7('0x35')]);router[_0xe7c7('0x5')](_0xe7c7('0x36'),auth[_0xe7c7('0x7')](),controller['whatsappQueuesWaitingInteractions']);router[_0xe7c7('0x5')](_0xe7c7('0x37'),auth['isAuthenticated'](),controller[_0xe7c7('0x38')]);router['post']('/mail/queues/:id/notify',auth[_0xe7c7('0x7')](),controller['queueNotify'](_0xe7c7('0x39')));router['get']('/mail/queues/:id',auth[_0xe7c7('0x7')](),controller[_0xe7c7('0x3a')]);router[_0xe7c7('0x3b')](_0xe7c7('0x3c'),auth['isAuthenticated'](),controller[_0xe7c7('0x3d')](_0xe7c7('0x3e')));router[_0xe7c7('0x5')]('/chat/queues/:id',auth[_0xe7c7('0x7')](),controller[_0xe7c7('0x3f')]);router['post'](_0xe7c7('0x40'),auth[_0xe7c7('0x7')](),controller[_0xe7c7('0x3d')](_0xe7c7('0x41')));router[_0xe7c7('0x5')](_0xe7c7('0x42'),auth[_0xe7c7('0x7')](),controller['showFaxQueues']);router[_0xe7c7('0x3b')](_0xe7c7('0x43'),auth[_0xe7c7('0x7')](),controller[_0xe7c7('0x3d')](_0xe7c7('0x44')));router[_0xe7c7('0x5')](_0xe7c7('0x45'),auth[_0xe7c7('0x7')](),controller[_0xe7c7('0x46')]);router['post']('/sms/queues/:id/notify',auth[_0xe7c7('0x7')](),controller[_0xe7c7('0x3d')](_0xe7c7('0x47')));router['post']('/whatsapp/queues/:id/notify',auth[_0xe7c7('0x7')](),controller['queueNotify'](_0xe7c7('0x48')));router['get']('/sms/queues/:id',auth['isAuthenticated'](),controller[_0xe7c7('0x49')]);router[_0xe7c7('0x5')](_0xe7c7('0x4a'),auth[_0xe7c7('0x7')](),controller['showWhatsappQueues']);router[_0xe7c7('0x3b')](_0xe7c7('0x4b'),auth[_0xe7c7('0x7')](),controller[_0xe7c7('0x4c')]);module['exports']=router; \ No newline at end of file +var _0x6cb3=['/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','/outbound','/agents','agents','put','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels'];(function(_0x280c03,_0x5ba994){var _0x5e271e=function(_0x2fbc31){while(--_0x2fbc31){_0x280c03['push'](_0x280c03['shift']());}};_0x5e271e(++_0x5ba994);}(_0x6cb3,0x7e));var _0x36cb=function(_0x51fe02,_0x4e7b57){_0x51fe02=_0x51fe02-0x0;var _0x24146e=_0x6cb3[_0x51fe02];return _0x24146e;};'use strict';var multer=require(_0x36cb('0x0'));var util=require(_0x36cb('0x1'));var path=require(_0x36cb('0x2'));var express=require(_0x36cb('0x3'));var router=express['Router']();var auth=require(_0x36cb('0x4'));var controller=require(_0x36cb('0x5'));router[_0x36cb('0x6')](_0x36cb('0x7'),auth[_0x36cb('0x8')](),controller[_0x36cb('0x9')]);router[_0x36cb('0x6')](_0x36cb('0xa'),auth[_0x36cb('0x8')](),controller[_0x36cb('0xb')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x36cb('0x8')](),controller[_0x36cb('0xc')]);router[_0x36cb('0x6')](_0x36cb('0xd'),auth[_0x36cb('0x8')](),controller[_0x36cb('0xe')]);router[_0x36cb('0x6')](_0x36cb('0xf'),auth[_0x36cb('0x8')](),controller[_0x36cb('0x10')]);router[_0x36cb('0x6')](_0x36cb('0x11'),auth[_0x36cb('0x8')](),controller['mailQueues']);router[_0x36cb('0x6')](_0x36cb('0x12'),auth[_0x36cb('0x8')](),controller['mailAccounts']);router[_0x36cb('0x6')]('/openchannel/queues',auth[_0x36cb('0x8')](),controller['openchannelQueues']);router[_0x36cb('0x6')]('/sms/queues',auth[_0x36cb('0x8')](),controller[_0x36cb('0x13')]);router[_0x36cb('0x6')](_0x36cb('0x14'),auth[_0x36cb('0x8')](),controller[_0x36cb('0x15')]);router[_0x36cb('0x6')](_0x36cb('0x16'),auth[_0x36cb('0x8')](),controller[_0x36cb('0x17')]);router[_0x36cb('0x6')](_0x36cb('0x18'),auth[_0x36cb('0x8')](),controller[_0x36cb('0x19')]);router[_0x36cb('0x6')](_0x36cb('0x1a'),auth[_0x36cb('0x8')](),controller[_0x36cb('0x1b')]);router[_0x36cb('0x6')](_0x36cb('0x1c'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0x36cb('0x6')](_0x36cb('0x1d'),auth[_0x36cb('0x8')](),controller['voiceQueuesChannelHangup']);router[_0x36cb('0x6')](_0x36cb('0x1e'),auth[_0x36cb('0x8')](),controller['voiceQueuesChannelRedirect']);router[_0x36cb('0x6')](_0x36cb('0x1f'),auth[_0x36cb('0x8')](),controller[_0x36cb('0x20')]);router['get'](_0x36cb('0x21'),auth[_0x36cb('0x8')](),controller['outbound']);router[_0x36cb('0x6')]('/outbound/channels',auth[_0x36cb('0x8')](),controller['outboundChannels']);router[_0x36cb('0x6')](_0x36cb('0x22'),auth['isAuthenticated'](),controller[_0x36cb('0x23')]);router[_0x36cb('0x24')]('/agents/:id/capacity',auth[_0x36cb('0x8')](),controller[_0x36cb('0x25')]);router['get'](_0x36cb('0x26'),auth[_0x36cb('0x8')](),controller[_0x36cb('0x27')]);router['get'](_0x36cb('0x28'),auth[_0x36cb('0x8')](),controller[_0x36cb('0x29')]);router[_0x36cb('0x6')](_0x36cb('0x2a'),auth[_0x36cb('0x8')](),controller[_0x36cb('0x2b')]);router['get'](_0x36cb('0x2c'),auth[_0x36cb('0x8')](),controller['faxAccounts']);router['get'](_0x36cb('0x2d'),auth[_0x36cb('0x8')](),controller[_0x36cb('0x2e')]);router['get']('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x36cb('0x2f')]);router[_0x36cb('0x6')](_0x36cb('0x30'),auth[_0x36cb('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0x36cb('0x6')]('/sms/queues/waitinginteractions',auth[_0x36cb('0x8')](),controller[_0x36cb('0x31')]);router[_0x36cb('0x6')](_0x36cb('0x32'),auth[_0x36cb('0x8')](),controller[_0x36cb('0x33')]);router[_0x36cb('0x6')](_0x36cb('0x34'),auth['isAuthenticated'](),controller[_0x36cb('0x35')]);router[_0x36cb('0x36')]('/mail/queues/:id/notify',auth[_0x36cb('0x8')](),controller[_0x36cb('0x37')]('mail'));router[_0x36cb('0x6')](_0x36cb('0x38'),auth['isAuthenticated'](),controller[_0x36cb('0x39')]);router[_0x36cb('0x36')]('/chat/queues/:id/notify',auth[_0x36cb('0x8')](),controller[_0x36cb('0x37')](_0x36cb('0x3a')));router[_0x36cb('0x6')](_0x36cb('0x3b'),auth[_0x36cb('0x8')](),controller[_0x36cb('0x3c')]);router[_0x36cb('0x36')](_0x36cb('0x3d'),auth[_0x36cb('0x8')](),controller['queueNotify'](_0x36cb('0x3e')));router[_0x36cb('0x6')](_0x36cb('0x3f'),auth[_0x36cb('0x8')](),controller[_0x36cb('0x40')]);router[_0x36cb('0x36')]('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0x36cb('0x37')](_0x36cb('0x41')));router[_0x36cb('0x6')](_0x36cb('0x42'),auth[_0x36cb('0x8')](),controller[_0x36cb('0x43')]);router[_0x36cb('0x36')](_0x36cb('0x44'),auth[_0x36cb('0x8')](),controller['queueNotify'](_0x36cb('0x45')));router['post']('/whatsapp/queues/:id/notify',auth[_0x36cb('0x8')](),controller['queueNotify'](_0x36cb('0x46')));router[_0x36cb('0x6')](_0x36cb('0x47'),auth[_0x36cb('0x8')](),controller[_0x36cb('0x48')]);router[_0x36cb('0x6')](_0x36cb('0x49'),auth[_0x36cb('0x8')](),controller[_0x36cb('0x4a')]);router['post'](_0x36cb('0x4b'),auth[_0x36cb('0x8')](),controller['agentNotify']);module[_0x36cb('0x4c')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 40b33ed..765791a 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 _0xa5f1=['ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','capitalize','chat','Website','Account','Queue','findOne','Message','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','QueueId','create','queueTransferTimeout','*,*,*,*','channel','User','Agent\x20not\x20found','TransferReport','Start','bluebird','moment','lodash','util','../../config/logger','api','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','VoiceChannelMixMonitor','merge','query','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','SIP/%s','interface','agent','internal','capacity','telephones','Telephones','trunks','Trunks','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions'];(function(_0x5787ca,_0x4f6e1c){var _0x4222c8=function(_0xdff944){while(--_0xdff944){_0x5787ca['push'](_0x5787ca['shift']());}};_0x4222c8(++_0x4f6e1c);}(_0xa5f1,0xff));var _0x1a5f=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa5f1[_0x4243a3];return _0x1b2a33;};'use strict';var BPromise=require(_0x1a5f('0x0'));var moment=require(_0x1a5f('0x1'));var _=require(_0x1a5f('0x2'));var util=require(_0x1a5f('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x1a5f('0x4'))(_0x1a5f('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x1a5f('0x6')][_0x1a5f('0x7')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x1a5f('0x6')][_0x1a5f('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x567455,_0x15f9f3,_0x828f17){return new BPromise(function(_0x25ce09,_0x40dd28){var _0x8ba164=_0x828f17?_0x828f17:amiClient;return _0x8ba164[_0x1a5f('0x8')](_0x567455,_0x15f9f3)[_0x1a5f('0x9')](function(_0x13f1bf){if(_0x13f1bf[_0x1a5f('0xa')]){if(_0x13f1bf['error'][_0x1a5f('0xb')]===0x1f4){return _0x40dd28(_0x13f1bf[_0x1a5f('0xa')][_0x1a5f('0xc')]);}return _0x25ce09(_0x13f1bf['error']['message']);}else{_0x25ce09(_0x13f1bf[_0x1a5f('0xd')]);}})[_0x1a5f('0xe')](function(_0x3589e0){_0x40dd28(_0x3589e0);});});}function respondWithResult(_0x13344c,_0x1c9c15){_0x1c9c15=_0x1c9c15||0xc8;return function(_0x489ff2){if(_0x489ff2){return _0x13344c[_0x1a5f('0xf')](_0x1c9c15)[_0x1a5f('0x10')](_0x489ff2);}return _0x13344c[_0x1a5f('0x11')](0x194);};}function handleError(_0x313992,_0x1b9835){_0x1b9835=_0x1b9835||0x1f4;return function(_0x2f5ee7){logger[_0x1a5f('0xa')](_0x2f5ee7[_0x1a5f('0x12')]);if(_0x2f5ee7[_0x1a5f('0x13')]){delete _0x2f5ee7[_0x1a5f('0x13')];}_0x313992[_0x1a5f('0xf')](_0x1b9835)[_0x1a5f('0x14')](_0x2f5ee7);};}function findById(_0x2fb853){return function(_0x7b4cc6){if(!_[_0x1a5f('0x15')](_0x2fb853)&&!_[_0x1a5f('0x15')](_0x7b4cc6)&&!_['isNil'](_0x7b4cc6[_0x1a5f('0x16')])){return _[_0x1a5f('0x17')](_0x7b4cc6[_0x1a5f('0x16')],function(_0x536fbb){return _0x536fbb['id']==_0x2fb853;});}return null;};}exports['voiceChannels']=function(_0x35135c,_0x375c60){return respondWithRpcPromise('VoiceChannels',_0x35135c['query'])[_0x1a5f('0x9')](respondWithResult(_0x375c60,null))['catch'](handleError(_0x375c60,null));};exports['voiceChannelMixMonitor']=function(_0x11946b,_0x4b9eee){return respondWithRpcPromise(_0x1a5f('0x18'),_[_0x1a5f('0x19')](_0x11946b[_0x1a5f('0x1a')],_0x11946b['params']))[_0x1a5f('0x9')](respondWithResult(_0x4b9eee,null))['catch'](handleError(_0x4b9eee,null));};exports[_0x1a5f('0x1b')]=function(_0x52663e,_0x3c14e4){return respondWithRpcPromise(_0x1a5f('0x1c'),_[_0x1a5f('0x19')](_0x52663e['query'],_0x52663e[_0x1a5f('0x1d')]))['then'](respondWithResult(_0x3c14e4,null))[_0x1a5f('0xe')](handleError(_0x3c14e4,null));};exports[_0x1a5f('0x1e')]=function(_0x17bf05,_0x2ebbcf){return respondWithRpcPromise(_0x1a5f('0x1f'),_0x17bf05[_0x1a5f('0x1a')])[_0x1a5f('0x9')](respondWithResult(_0x2ebbcf,null))['catch'](handleError(_0x2ebbcf,null));};exports[_0x1a5f('0x20')]=function(_0x4fb943,_0xf989f8){return respondWithRpcPromise(_0x1a5f('0x1f'),_0x4fb943[_0x1a5f('0x1a')])['then'](findById(_0x4fb943[_0x1a5f('0x1d')]['id']))[_0x1a5f('0x9')](respondWithResult(_0xf989f8,null))[_0x1a5f('0xe')](handleError(_0xf989f8,null));};exports[_0x1a5f('0x21')]=function(_0x35e48f,_0x33ee0f){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x1a5f('0x19')](_0x35e48f[_0x1a5f('0x1a')],_0x35e48f[_0x1a5f('0x1d')]))['then'](respondWithResult(_0x33ee0f,null))['catch'](handleError(_0x33ee0f,null));};exports['voiceQueuesChannels']=function(_0x842e38,_0x569298){return respondWithRpcPromise('VoiceQueuesChannels',_0x842e38[_0x1a5f('0x1a')])[_0x1a5f('0x9')](respondWithResult(_0x569298,null))[_0x1a5f('0xe')](handleError(_0x569298,null));};exports[_0x1a5f('0x22')]=function(_0x5ec001,_0x39e8d8){return respondWithRpcPromise(_0x1a5f('0x23'),_[_0x1a5f('0x19')](_0x5ec001[_0x1a5f('0x1a')],_0x5ec001[_0x1a5f('0x1d')]))[_0x1a5f('0x9')](respondWithResult(_0x39e8d8,null))[_0x1a5f('0xe')](handleError(_0x39e8d8,null));};exports[_0x1a5f('0x24')]=function(_0x4c2b86,_0x50152e){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x1a5f('0x19')](_0x4c2b86[_0x1a5f('0x1a')],_0x4c2b86[_0x1a5f('0x1d')]))[_0x1a5f('0x9')](respondWithResult(_0x50152e,null))['catch'](handleError(_0x50152e,null));};exports[_0x1a5f('0x25')]=function(_0x4eecf5,_0x546f7c){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_['merge'](_0x4eecf5[_0x1a5f('0x1a')],_0x4eecf5['params']))[_0x1a5f('0x9')](respondWithResult(_0x546f7c,null))[_0x1a5f('0xe')](handleError(_0x546f7c,null));};exports[_0x1a5f('0x26')]=function(_0x59365a,_0x2b2b88){return respondWithRpcPromise('Outbound',_0x59365a[_0x1a5f('0x1a')])[_0x1a5f('0x9')](respondWithResult(_0x2b2b88,null))[_0x1a5f('0xe')](handleError(_0x2b2b88,null));};exports[_0x1a5f('0x27')]=function(_0xde1e7b,_0x1ac22e){return respondWithRpcPromise(_0x1a5f('0x28'),_0xde1e7b['query'])[_0x1a5f('0x9')](respondWithResult(_0x1ac22e,null))['catch'](handleError(_0x1ac22e,null));};exports[_0x1a5f('0x29')]=function(_0x4cb4b0,_0x48bea4){var _0x1c24b5;return respondWithRpcPromise(_0x1a5f('0x2a'),_0x4cb4b0['query'])[_0x1a5f('0x9')](function(_0x11fc0e){_0x1c24b5=_0x11fc0e;return respondWithRpcPromise(_0x1a5f('0x2a'),_0x4cb4b0['query'],routingClient);})[_0x1a5f('0x9')](function(_0x15bf23){return _[_0x1a5f('0x19')]({},_0x15bf23,_0x1c24b5);})[_0x1a5f('0x9')](respondWithResult(_0x48bea4,null))[_0x1a5f('0xe')](handleError(_0x48bea4,null));};exports[_0x1a5f('0x2b')]=function(_0x23b5bb,_0x120e95){if(_0x23b5bb[_0x1a5f('0x2c')]&&_0x23b5bb[_0x1a5f('0x2c')][_0x1a5f('0x2d')]&&_0x23b5bb[_0x1a5f('0x2e')]&&_0x23b5bb[_0x1a5f('0x2e')][_0x1a5f('0x13')]){for(var _0x15f53d in _0x23b5bb[_0x1a5f('0x2c')]['interaction']){if(_0x23b5bb['body'][_0x1a5f('0x2d')][_0x1a5f('0x2f')](_0x15f53d)){db['MemberReport'][_0x1a5f('0x30')]({'where':{'channel':_0x15f53d,'membername':_0x23b5bb['user'][_0x1a5f('0x13')],'type':_0x1a5f('0x31'),'exitAt':null,'uniqueid':_0x23b5bb[_0x1a5f('0x2c')][_0x1a5f('0x2d')][_0x15f53d]&&_0x23b5bb['body'][_0x1a5f('0x2d')][_0x15f53d][_0x1a5f('0x32')]?{'$notIn':_0x23b5bb[_0x1a5f('0x2c')][_0x1a5f('0x2d')][_0x15f53d]}:{'$ne':null}}})['then'](function(_0x1a1605){var _0x5696ab=moment()[_0x1a5f('0x33')](_0x1a5f('0x34'));for(var _0x114e72=0x0,_0x12fec1=_0x1a1605[_0x1a5f('0x32')];_0x114e72<_0x12fec1;_0x114e72+=0x1){_0x1a1605[_0x114e72][_0x1a5f('0x35')]({'exitAt':_0x5696ab});}});for(var _0x408122=0x0;_0x408122<_0x23b5bb['body'][_0x1a5f('0x2d')][_0x15f53d]['length'];_0x408122+=0x1){db['MemberReport'][_0x1a5f('0x36')]({'where':{'channel':_0x15f53d,'membername':_0x23b5bb[_0x1a5f('0x2e')]['name'],'type':_0x1a5f('0x31'),'uniqueid':_0x23b5bb[_0x1a5f('0x2c')][_0x1a5f('0x2d')][_0x15f53d][_0x408122],'exitAt':null},'defaults':{'channel':_0x15f53d,'membername':_0x23b5bb[_0x1a5f('0x2e')]['name'],'interface':_[_0x1a5f('0x15')](_0x23b5bb[_0x1a5f('0x2e')]['interface'])?util['format'](_0x1a5f('0x37'),_0x23b5bb[_0x1a5f('0x2e')][_0x1a5f('0x13')]):_0x23b5bb[_0x1a5f('0x2e')][_0x1a5f('0x38')],'type':_0x1a5f('0x31'),'enterAt':moment()[_0x1a5f('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1a5f('0x39'),'internal':_0x23b5bb[_0x1a5f('0x2e')][_0x1a5f('0x3a')],'uniqueid':_0x23b5bb[_0x1a5f('0x2c')][_0x1a5f('0x2d')][_0x15f53d][_0x408122]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x23b5bb[_0x1a5f('0x1d')]['id'],'capacity':_0x23b5bb[_0x1a5f('0x2c')][_0x1a5f('0x3b')]},routingClient)[_0x1a5f('0x9')](respondWithResult(_0x120e95,null))['catch'](handleError(_0x120e95,null));};exports[_0x1a5f('0x3c')]=function(_0x143374,_0x517eae){return respondWithRpcPromise(_0x1a5f('0x3d'),_0x143374[_0x1a5f('0x1a')])[_0x1a5f('0x9')](respondWithResult(_0x517eae,null))[_0x1a5f('0xe')](handleError(_0x517eae,null));};exports[_0x1a5f('0x3e')]=function(_0x55d8bc,_0xd9a32a){return respondWithRpcPromise(_0x1a5f('0x3f'),_0x55d8bc[_0x1a5f('0x1a')])[_0x1a5f('0x9')](respondWithResult(_0xd9a32a,null))[_0x1a5f('0xe')](handleError(_0xd9a32a,null));};exports['campaigns']=function(_0x53a2c7,_0x41428a){return respondWithRpcPromise('Campaigns',_0x53a2c7[_0x1a5f('0x1a')])[_0x1a5f('0x9')](respondWithResult(_0x41428a,null))['catch'](handleError(_0x41428a,null));};exports[_0x1a5f('0x40')]=function(_0x1ac252,_0x3c94cf){return respondWithRpcPromise(_0x1a5f('0x41'),_0x1ac252[_0x1a5f('0x1a')],routingClient)[_0x1a5f('0x9')](respondWithResult(_0x3c94cf,null))[_0x1a5f('0xe')](handleError(_0x3c94cf,null));};exports[_0x1a5f('0x42')]=function(_0x12e067,_0x3267e3){return respondWithRpcPromise(_0x1a5f('0x41'),_0x12e067[_0x1a5f('0x1a')],routingClient)['then'](findById(_0x12e067[_0x1a5f('0x1d')]['id']))[_0x1a5f('0x9')](respondWithResult(_0x3267e3,null))[_0x1a5f('0xe')](handleError(_0x3267e3,null));};exports[_0x1a5f('0x43')]=function(_0x2eb286,_0x103360){return respondWithRpcPromise(_0x1a5f('0x44'),_0x2eb286[_0x1a5f('0x1a')],routingClient)[_0x1a5f('0x9')](respondWithResult(_0x103360,null))['catch'](handleError(_0x103360,null));};exports[_0x1a5f('0x45')]=function(_0x533ad6,_0xb14e69){return respondWithRpcPromise(_0x1a5f('0x44'),_0x533ad6[_0x1a5f('0x1a')],routingClient)[_0x1a5f('0x9')](findById(_0x533ad6[_0x1a5f('0x1d')]['id']))[_0x1a5f('0x9')](respondWithResult(_0xb14e69,null))[_0x1a5f('0xe')](handleError(_0xb14e69,null));};exports[_0x1a5f('0x46')]=function(_0x47da5e,_0x552e9f){return respondWithRpcPromise('MailAccounts',_0x47da5e[_0x1a5f('0x1a')],mailClient)[_0x1a5f('0x9')](respondWithResult(_0x552e9f,null))[_0x1a5f('0xe')](handleError(_0x552e9f,null));};exports['openchannelQueues']=function(_0x45403d,_0x9daddc){return respondWithRpcPromise(_0x1a5f('0x47'),_0x45403d[_0x1a5f('0x1a')],routingClient)[_0x1a5f('0x9')](respondWithResult(_0x9daddc,null))['catch'](handleError(_0x9daddc,null));};exports[_0x1a5f('0x48')]=function(_0x1fccb4,_0x207a16){return respondWithRpcPromise(_0x1a5f('0x47'),_0x1fccb4['query'],routingClient)[_0x1a5f('0x9')](findById(_0x1fccb4[_0x1a5f('0x1d')]['id']))['then'](respondWithResult(_0x207a16,null))['catch'](handleError(_0x207a16,null));};exports[_0x1a5f('0x49')]=function(_0x3c2718,_0x2b6099){return respondWithRpcPromise('SmsQueues',_0x3c2718[_0x1a5f('0x1a')],routingClient)[_0x1a5f('0x9')](respondWithResult(_0x2b6099,null))[_0x1a5f('0xe')](handleError(_0x2b6099,null));};exports[_0x1a5f('0x4a')]=function(_0x27e082,_0x35f6db){return respondWithRpcPromise(_0x1a5f('0x4b'),_0x27e082[_0x1a5f('0x1a')],routingClient)[_0x1a5f('0x9')](findById(_0x27e082[_0x1a5f('0x1d')]['id']))['then'](respondWithResult(_0x35f6db,null))['catch'](handleError(_0x35f6db,null));};exports[_0x1a5f('0x4c')]=function(_0x137e1c,_0x977ecb){return respondWithRpcPromise(_0x1a5f('0x4d'),_0x137e1c[_0x1a5f('0x1a')],routingClient)[_0x1a5f('0x9')](respondWithResult(_0x977ecb,null))['catch'](handleError(_0x977ecb,null));};exports[_0x1a5f('0x4e')]=function(_0x3b4162,_0x4e296a){return respondWithRpcPromise('WhatsappQueues',_0x3b4162[_0x1a5f('0x1a')],routingClient)['then'](findById(_0x3b4162[_0x1a5f('0x1d')]['id']))['then'](respondWithResult(_0x4e296a,null))[_0x1a5f('0xe')](handleError(_0x4e296a,null));};exports['faxQueues']=function(_0x2f87c7,_0x41dd43){return respondWithRpcPromise(_0x1a5f('0x4f'),_0x2f87c7[_0x1a5f('0x1a')],routingClient)[_0x1a5f('0x9')](respondWithResult(_0x41dd43,null))['catch'](handleError(_0x41dd43,null));};exports[_0x1a5f('0x50')]=function(_0x36582a,_0x2e8e0b){return respondWithRpcPromise(_0x1a5f('0x4f'),_0x36582a['query'],routingClient)[_0x1a5f('0x9')](findById(_0x36582a[_0x1a5f('0x1d')]['id']))[_0x1a5f('0x9')](respondWithResult(_0x2e8e0b,null))[_0x1a5f('0xe')](handleError(_0x2e8e0b,null));};exports[_0x1a5f('0x51')]=function(_0x4bb419,_0x273a8e){return respondWithRpcPromise(_0x1a5f('0x52'),_0x4bb419['query'])['then'](respondWithResult(_0x273a8e,null))[_0x1a5f('0xe')](handleError(_0x273a8e,null));};exports[_0x1a5f('0x53')]=function(_0x74415c,_0x5ff7f3){return respondWithRpcPromise(_0x1a5f('0x54'),_0x74415c[_0x1a5f('0x1a')],routingClient)['then'](respondWithResult(_0x5ff7f3,null))[_0x1a5f('0xe')](handleError(_0x5ff7f3,null));};exports[_0x1a5f('0x55')]=function(_0x2909d1,_0x3d0f38){return respondWithRpcPromise(_0x1a5f('0x56'),_0x2909d1[_0x1a5f('0x1a')],routingClient)['then'](respondWithResult(_0x3d0f38,null))[_0x1a5f('0xe')](handleError(_0x3d0f38,null));};exports[_0x1a5f('0x57')]=function(_0x1e5d2d,_0x48a846){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x1e5d2d[_0x1a5f('0x1a')],routingClient)['then'](respondWithResult(_0x48a846,null))[_0x1a5f('0xe')](handleError(_0x48a846,null));};exports[_0x1a5f('0x58')]=function(_0x34da4c,_0x2bdd38){return respondWithRpcPromise(_0x1a5f('0x59'),_0x34da4c[_0x1a5f('0x1a')],routingClient)['then'](respondWithResult(_0x2bdd38,null))[_0x1a5f('0xe')](handleError(_0x2bdd38,null));};exports[_0x1a5f('0x5a')]=function(_0x4413b3,_0x43da78){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x4413b3[_0x1a5f('0x1a')],routingClient)[_0x1a5f('0x9')](respondWithResult(_0x43da78,null))[_0x1a5f('0xe')](handleError(_0x43da78,null));};exports['faxQueuesWaitingInteractions']=function(_0x56aa8c,_0x44c566){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x56aa8c['query'],routingClient)[_0x1a5f('0x9')](respondWithResult(_0x44c566,null))[_0x1a5f('0xe')](handleError(_0x44c566,null));};exports['queueNotify']=function(_0x208d33){return function(_0x5bc68d,_0x23a53f){var _0x4ea234,_0x44269c;var _0x23fadd=_[_0x1a5f('0x5b')](_0x208d33);var _0xc7d17=_0x208d33===_0x1a5f('0x5c')?_0x1a5f('0x5d'):_0x1a5f('0x5e');return db[_0x23fadd+_0x1a5f('0x5f')][_0x1a5f('0x60')]({'raw':!![],'where':{'id':_0x5bc68d[_0x1a5f('0x1d')]['id']}})[_0x1a5f('0x9')](function(_0xf1caa0){if(_[_0x1a5f('0x15')](_0xf1caa0)){throw new Error(_0x23fadd+'\x20Queue\x20not\x20found');}_0x4ea234=_0xf1caa0;return db[_0x23fadd+_0x1a5f('0x61')][_0x1a5f('0x60')]({'where':{'id':_0x5bc68d[_0x1a5f('0x2c')]['messageId']},'include':[{'model':db[_0x23fadd+_0x1a5f('0x62')],'as':_0x1a5f('0x62')},{'model':db[_0x23fadd+_0xc7d17],'as':'Account'}]});})['then'](function(_0x5edaa9){if(_[_0x1a5f('0x15')](_0x5edaa9)){throw new Error(_0x23fadd+_0x1a5f('0x63'));}_0x44269c=_0x5edaa9;return _0x5edaa9[_0x1a5f('0x64')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x13dc91={'uniqueid':_0x208d33+'.'+_0x44269c['id']+'.'+_0x44269c[_0x1a5f('0x62')]['id'],'FromUserId':_0x5bc68d[_0x1a5f('0x2e')]['id'],'type':_0x1a5f('0x65')};_0x13dc91[_0x23fadd+_0x1a5f('0x66')]=_0x44269c['id'];_0x13dc91[_0x23fadd+_0x1a5f('0x67')]=_0x44269c[_0x1a5f('0x62')]['id'];_0x13dc91['From'+_0x23fadd+_0xc7d17+'Id']=_0x44269c[_0x1a5f('0x5e')]['id'];_0x13dc91['To'+_0x23fadd+_0x1a5f('0x68')]=_0x4ea234['id'];return db[_0x23fadd+'TransferReport'][_0x1a5f('0x69')](_0x13dc91);})[_0x1a5f('0x9')](function(){return respondWithRpcPromise('Start',{'channel':_0x208d33,'interaction':_0x44269c['Interaction'],'message':_0x44269c,'account':_0x44269c['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x1a5f('0x65'),'appdata':_0x4ea234[_0x1a5f('0x13')]+','+(_0x44269c['Account'][_0x1a5f('0x6a')]||0x12c),'interval':_0x1a5f('0x6b')}]},routingClient);})[_0x1a5f('0x9')](respondWithResult(_0x23a53f,null))[_0x1a5f('0xe')](handleError(_0x23a53f,null));};};exports['agentNotify']=function(_0x5c555e,_0x452924){var _0x45a26a,_0x390669;if(_[_0x1a5f('0x15')](_0x5c555e['body']['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x25b853=_0x5c555e[_0x1a5f('0x2c')][_0x1a5f('0x6c')];var _0x1ac247=_[_0x1a5f('0x5b')](_0x25b853);var _0x5b4a45=_0x25b853===_0x1a5f('0x5c')?'Website':_0x1a5f('0x5e');return db[_0x1a5f('0x6d')]['findOne']({'raw':!![],'where':{'id':_0x5c555e[_0x1a5f('0x1d')]['id'],'role':'agent'}})[_0x1a5f('0x9')](function(_0x1bcde3){if(_['isNil'](_0x1bcde3)){throw new Error(_0x1a5f('0x6e'));}_0x45a26a=_0x1bcde3;return db[_0x1ac247+'Message'][_0x1a5f('0x60')]({'where':{'id':_0x5c555e[_0x1a5f('0x2c')]['messageId']},'include':[{'model':db[_0x1ac247+_0x1a5f('0x62')],'as':_0x1a5f('0x62')},{'model':db[_0x1ac247+_0x5b4a45],'as':_0x1a5f('0x5e')}]});})[_0x1a5f('0x9')](function(_0x4125a5){if(_[_0x1a5f('0x15')](_0x4125a5)){throw new Error(_0x1ac247+_0x1a5f('0x63'));}_0x390669=_0x4125a5;return _0x4125a5[_0x1a5f('0x64')]({'read':0x0,'readAt':null,'UserId':null});})[_0x1a5f('0x9')](function(){var _0x114d4c={'uniqueid':_0x25b853+'.'+_0x390669['id']+'.'+_0x390669[_0x1a5f('0x62')]['id'],'FromUserId':_0x5c555e[_0x1a5f('0x2e')]['id'],'type':_0x1a5f('0x65'),'ToUserId':_0x45a26a['id']};_0x114d4c[_0x1ac247+_0x1a5f('0x66')]=_0x390669['id'];_0x114d4c[_0x1ac247+'InteractionId']=_0x390669[_0x1a5f('0x62')]['id'];_0x114d4c['From'+_0x1ac247+_0x5b4a45+'Id']=_0x390669[_0x1a5f('0x5e')]['id'];return db[_0x1ac247+_0x1a5f('0x6f')][_0x1a5f('0x69')](_0x114d4c);})[_0x1a5f('0x9')](function(){return respondWithRpcPromise(_0x1a5f('0x70'),{'channel':_0x25b853,'interaction':_0x390669[_0x1a5f('0x62')],'message':_0x390669,'account':_0x390669[_0x1a5f('0x5e')],'applications':[{'id':0x0,'priority':0x1,'app':_0x1a5f('0x39'),'appdata':_0x45a26a[_0x1a5f('0x13')]+','+(_0x390669[_0x1a5f('0x5e')]['agentTransferTimeout']||0x12c),'interval':_0x1a5f('0x6b')}]},routingClient);})[_0x1a5f('0x9')](respondWithResult(_0x452924,null))[_0x1a5f('0xe')](handleError(_0x452924,null));}; \ No newline at end of file +var _0x7602=['jayson/promise','client','http','then','error','code','message','status','sendStatus','stack','isNil','rows','find','VoiceChannels','query','params','catch','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','showVoiceQueues','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','user','name','interaction','hasOwnProperty','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','MemberReport','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Account','\x20Message\x20not\x20found','update','Interaction','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','agentNotify','Agent\x20not\x20found','queue','*,*,*,*','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api'];(function(_0x47df54,_0x1aeb61){var _0x261b87=function(_0x54bc77){while(--_0x54bc77){_0x47df54['push'](_0x47df54['shift']());}};_0x261b87(++_0x1aeb61);}(_0x7602,0x15e));var _0x2760=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x7602[_0x3305de];return _0x3b5a84;};'use strict';var BPromise=require(_0x2760('0x0'));var moment=require(_0x2760('0x1'));var _=require(_0x2760('0x2'));var util=require(_0x2760('0x3'));var db=require(_0x2760('0x4'))['db'];var logger=require(_0x2760('0x5'))(_0x2760('0x6'));var jayson=require(_0x2760('0x7'));var amiClient=jayson[_0x2760('0x8')][_0x2760('0x9')]({'port':0x232a});var mailClient=jayson[_0x2760('0x8')][_0x2760('0x9')]({'port':0x232b});var routingClient=jayson[_0x2760('0x8')][_0x2760('0x9')]({'port':0x232c});function respondWithRpcPromise(_0x320064,_0x4cc2a5,_0x5e0c99){return new BPromise(function(_0x5e0ac6,_0x41ad79){var _0x4dd9b3=_0x5e0c99?_0x5e0c99:amiClient;return _0x4dd9b3['request'](_0x320064,_0x4cc2a5)[_0x2760('0xa')](function(_0x3bc032){if(_0x3bc032[_0x2760('0xb')]){if(_0x3bc032[_0x2760('0xb')][_0x2760('0xc')]===0x1f4){return _0x41ad79(_0x3bc032[_0x2760('0xb')]['message']);}return _0x5e0ac6(_0x3bc032[_0x2760('0xb')][_0x2760('0xd')]);}else{_0x5e0ac6(_0x3bc032['result']);}})['catch'](function(_0x13c0ca){_0x41ad79(_0x13c0ca);});});}function respondWithResult(_0x1a8e6e,_0x101cb6){_0x101cb6=_0x101cb6||0xc8;return function(_0x284a76){if(_0x284a76){return _0x1a8e6e[_0x2760('0xe')](_0x101cb6)['json'](_0x284a76);}return _0x1a8e6e[_0x2760('0xf')](0x194);};}function handleError(_0x78ace7,_0x1ef12e){_0x1ef12e=_0x1ef12e||0x1f4;return function(_0xa6cd5){logger[_0x2760('0xb')](_0xa6cd5[_0x2760('0x10')]);if(_0xa6cd5['name']){delete _0xa6cd5['name'];}_0x78ace7[_0x2760('0xe')](_0x1ef12e)['send'](_0xa6cd5);};}function findById(_0x48db6d){return function(_0x539d8a){if(!_[_0x2760('0x11')](_0x48db6d)&&!_[_0x2760('0x11')](_0x539d8a)&&!_[_0x2760('0x11')](_0x539d8a[_0x2760('0x12')])){return _[_0x2760('0x13')](_0x539d8a[_0x2760('0x12')],function(_0xad3664){return _0xad3664['id']==_0x48db6d;});}return null;};}exports['voiceChannels']=function(_0x13811c,_0x108fa7){return respondWithRpcPromise(_0x2760('0x14'),_0x13811c['query'])[_0x2760('0xa')](respondWithResult(_0x108fa7,null))['catch'](handleError(_0x108fa7,null));};exports['voiceChannelMixMonitor']=function(_0xd54f5a,_0x5b9222){return respondWithRpcPromise('VoiceChannelMixMonitor',_['merge'](_0xd54f5a[_0x2760('0x15')],_0xd54f5a[_0x2760('0x16')]))[_0x2760('0xa')](respondWithResult(_0x5b9222,null))[_0x2760('0x17')](handleError(_0x5b9222,null));};exports[_0x2760('0x18')]=function(_0x26dde4,_0x579734){return respondWithRpcPromise(_0x2760('0x19'),_[_0x2760('0x1a')](_0x26dde4['query'],_0x26dde4['params']))[_0x2760('0xa')](respondWithResult(_0x579734,null))['catch'](handleError(_0x579734,null));};exports['voiceQueues']=function(_0x46f7f0,_0x2bfbd2){return respondWithRpcPromise('VoiceQueues',_0x46f7f0[_0x2760('0x15')])[_0x2760('0xa')](respondWithResult(_0x2bfbd2,null))[_0x2760('0x17')](handleError(_0x2bfbd2,null));};exports[_0x2760('0x1b')]=function(_0x4569dd,_0x10b6f7){return respondWithRpcPromise('VoiceQueues',_0x4569dd[_0x2760('0x15')])[_0x2760('0xa')](findById(_0x4569dd['params']['id']))['then'](respondWithResult(_0x10b6f7,null))[_0x2760('0x17')](handleError(_0x10b6f7,null));};exports['voiceQueuesPreview']=function(_0x13262c,_0x3e4535){return respondWithRpcPromise(_0x2760('0x1c'),_[_0x2760('0x1a')](_0x13262c[_0x2760('0x15')],_0x13262c[_0x2760('0x16')]))['then'](respondWithResult(_0x3e4535,null))[_0x2760('0x17')](handleError(_0x3e4535,null));};exports['voiceQueuesChannels']=function(_0x34ad13,_0x1a9cbc){return respondWithRpcPromise(_0x2760('0x1d'),_0x34ad13[_0x2760('0x15')])[_0x2760('0xa')](respondWithResult(_0x1a9cbc,null))[_0x2760('0x17')](handleError(_0x1a9cbc,null));};exports[_0x2760('0x1e')]=function(_0x1a5470,_0x1deeac){return respondWithRpcPromise(_0x2760('0x1f'),_['merge'](_0x1a5470[_0x2760('0x15')],_0x1a5470[_0x2760('0x16')]))['then'](respondWithResult(_0x1deeac,null))[_0x2760('0x17')](handleError(_0x1deeac,null));};exports['voiceQueuesChannelHangup']=function(_0x129055,_0x4a0da7){return respondWithRpcPromise(_0x2760('0x20'),_[_0x2760('0x1a')](_0x129055[_0x2760('0x15')],_0x129055[_0x2760('0x16')]))[_0x2760('0xa')](respondWithResult(_0x4a0da7,null))[_0x2760('0x17')](handleError(_0x4a0da7,null));};exports[_0x2760('0x21')]=function(_0x17c1ae,_0x1b0b2a){return respondWithRpcPromise(_0x2760('0x22'),_[_0x2760('0x1a')](_0x17c1ae[_0x2760('0x15')],_0x17c1ae[_0x2760('0x16')]))[_0x2760('0xa')](respondWithResult(_0x1b0b2a,null))[_0x2760('0x17')](handleError(_0x1b0b2a,null));};exports[_0x2760('0x23')]=function(_0x244627,_0x5f178b){return respondWithRpcPromise('Outbound',_0x244627[_0x2760('0x15')])[_0x2760('0xa')](respondWithResult(_0x5f178b,null))[_0x2760('0x17')](handleError(_0x5f178b,null));};exports[_0x2760('0x24')]=function(_0x4f0133,_0x457ed5){return respondWithRpcPromise(_0x2760('0x25'),_0x4f0133[_0x2760('0x15')])[_0x2760('0xa')](respondWithResult(_0x457ed5,null))[_0x2760('0x17')](handleError(_0x457ed5,null));};exports[_0x2760('0x26')]=function(_0x628fe4,_0x52e278){var _0x376c41;return respondWithRpcPromise(_0x2760('0x27'),_0x628fe4[_0x2760('0x15')])[_0x2760('0xa')](function(_0x5e4e2b){_0x376c41=_0x5e4e2b;return respondWithRpcPromise('Agents',_0x628fe4[_0x2760('0x15')],routingClient);})[_0x2760('0xa')](function(_0xb8ad3){return _[_0x2760('0x1a')]({},_0xb8ad3,_0x376c41);})[_0x2760('0xa')](respondWithResult(_0x52e278,null))['catch'](handleError(_0x52e278,null));};exports[_0x2760('0x28')]=function(_0x6f9750,_0x23dbe5){if(_0x6f9750[_0x2760('0x29')]&&_0x6f9750['body']['interaction']&&_0x6f9750[_0x2760('0x2a')]&&_0x6f9750[_0x2760('0x2a')][_0x2760('0x2b')]){for(var _0x5acc76 in _0x6f9750[_0x2760('0x29')][_0x2760('0x2c')]){if(_0x6f9750[_0x2760('0x29')][_0x2760('0x2c')][_0x2760('0x2d')](_0x5acc76)){db['MemberReport'][_0x2760('0x2e')]({'where':{'channel':_0x5acc76,'membername':_0x6f9750[_0x2760('0x2a')]['name'],'type':_0x2760('0x2f'),'exitAt':null,'uniqueid':_0x6f9750[_0x2760('0x29')][_0x2760('0x2c')][_0x5acc76]&&_0x6f9750[_0x2760('0x29')]['interaction'][_0x5acc76]['length']?{'$notIn':_0x6f9750['body']['interaction'][_0x5acc76]}:{'$ne':null}}})['then'](function(_0x5ece01){var _0x33bb6f=moment()[_0x2760('0x30')](_0x2760('0x31'));for(var _0x2081a1=0x0,_0x1d40f7=_0x5ece01[_0x2760('0x32')];_0x2081a1<_0x1d40f7;_0x2081a1+=0x1){_0x5ece01[_0x2081a1][_0x2760('0x33')]({'exitAt':_0x33bb6f});}});for(var _0x57d810=0x0;_0x57d810<_0x6f9750['body']['interaction'][_0x5acc76]['length'];_0x57d810+=0x1){db[_0x2760('0x34')][_0x2760('0x35')]({'where':{'channel':_0x5acc76,'membername':_0x6f9750['user']['name'],'type':_0x2760('0x2f'),'uniqueid':_0x6f9750['body'][_0x2760('0x2c')][_0x5acc76][_0x57d810],'exitAt':null},'defaults':{'channel':_0x5acc76,'membername':_0x6f9750[_0x2760('0x2a')][_0x2760('0x2b')],'interface':_[_0x2760('0x11')](_0x6f9750['user'][_0x2760('0x36')])?util[_0x2760('0x30')](_0x2760('0x37'),_0x6f9750[_0x2760('0x2a')][_0x2760('0x2b')]):_0x6f9750[_0x2760('0x2a')][_0x2760('0x36')],'type':_0x2760('0x2f'),'enterAt':moment()['format'](_0x2760('0x31')),'role':_0x2760('0x38'),'internal':_0x6f9750[_0x2760('0x2a')][_0x2760('0x39')],'uniqueid':_0x6f9750['body'][_0x2760('0x2c')][_0x5acc76][_0x57d810]}});}}}}return respondWithRpcPromise(_0x2760('0x3a'),{'id':_0x6f9750[_0x2760('0x16')]['id'],'capacity':_0x6f9750[_0x2760('0x29')][_0x2760('0x3b')]},routingClient)[_0x2760('0xa')](respondWithResult(_0x23dbe5,null))[_0x2760('0x17')](handleError(_0x23dbe5,null));};exports[_0x2760('0x3c')]=function(_0x18aee7,_0x5c9ce2){return respondWithRpcPromise(_0x2760('0x3d'),_0x18aee7[_0x2760('0x15')])[_0x2760('0xa')](respondWithResult(_0x5c9ce2,null))[_0x2760('0x17')](handleError(_0x5c9ce2,null));};exports[_0x2760('0x3e')]=function(_0x14b06a,_0xc5bf80){return respondWithRpcPromise('Trunks',_0x14b06a[_0x2760('0x15')])[_0x2760('0xa')](respondWithResult(_0xc5bf80,null))[_0x2760('0x17')](handleError(_0xc5bf80,null));};exports[_0x2760('0x3f')]=function(_0x3ffbe9,_0x26805a){return respondWithRpcPromise(_0x2760('0x40'),_0x3ffbe9[_0x2760('0x15')])[_0x2760('0xa')](respondWithResult(_0x26805a,null))[_0x2760('0x17')](handleError(_0x26805a,null));};exports[_0x2760('0x41')]=function(_0x3f4c99,_0x2b5474){return respondWithRpcPromise(_0x2760('0x42'),_0x3f4c99['query'],routingClient)[_0x2760('0xa')](respondWithResult(_0x2b5474,null))['catch'](handleError(_0x2b5474,null));};exports[_0x2760('0x43')]=function(_0x4baefe,_0x33214a){return respondWithRpcPromise(_0x2760('0x42'),_0x4baefe[_0x2760('0x15')],routingClient)[_0x2760('0xa')](findById(_0x4baefe[_0x2760('0x16')]['id']))[_0x2760('0xa')](respondWithResult(_0x33214a,null))['catch'](handleError(_0x33214a,null));};exports[_0x2760('0x44')]=function(_0x4fa23f,_0x1abe28){return respondWithRpcPromise(_0x2760('0x45'),_0x4fa23f[_0x2760('0x15')],routingClient)[_0x2760('0xa')](respondWithResult(_0x1abe28,null))[_0x2760('0x17')](handleError(_0x1abe28,null));};exports[_0x2760('0x46')]=function(_0x328459,_0x25745e){return respondWithRpcPromise(_0x2760('0x45'),_0x328459[_0x2760('0x15')],routingClient)[_0x2760('0xa')](findById(_0x328459[_0x2760('0x16')]['id']))[_0x2760('0xa')](respondWithResult(_0x25745e,null))['catch'](handleError(_0x25745e,null));};exports['mailAccounts']=function(_0x364b6c,_0x48f0bb){return respondWithRpcPromise(_0x2760('0x47'),_0x364b6c[_0x2760('0x15')],mailClient)['then'](respondWithResult(_0x48f0bb,null))[_0x2760('0x17')](handleError(_0x48f0bb,null));};exports[_0x2760('0x48')]=function(_0x75ef45,_0x31b84c){return respondWithRpcPromise('OpenchannelQueues',_0x75ef45[_0x2760('0x15')],routingClient)[_0x2760('0xa')](respondWithResult(_0x31b84c,null))['catch'](handleError(_0x31b84c,null));};exports[_0x2760('0x49')]=function(_0xf35a28,_0xc60004){return respondWithRpcPromise('OpenchannelQueues',_0xf35a28['query'],routingClient)[_0x2760('0xa')](findById(_0xf35a28[_0x2760('0x16')]['id']))['then'](respondWithResult(_0xc60004,null))[_0x2760('0x17')](handleError(_0xc60004,null));};exports[_0x2760('0x4a')]=function(_0x542ba5,_0x5f6666){return respondWithRpcPromise('SmsQueues',_0x542ba5['query'],routingClient)[_0x2760('0xa')](respondWithResult(_0x5f6666,null))['catch'](handleError(_0x5f6666,null));};exports[_0x2760('0x4b')]=function(_0x245b41,_0x4d2747){return respondWithRpcPromise(_0x2760('0x4c'),_0x245b41[_0x2760('0x15')],routingClient)[_0x2760('0xa')](findById(_0x245b41['params']['id']))[_0x2760('0xa')](respondWithResult(_0x4d2747,null))[_0x2760('0x17')](handleError(_0x4d2747,null));};exports[_0x2760('0x4d')]=function(_0x3d82eb,_0xe9d157){return respondWithRpcPromise('WhatsappQueues',_0x3d82eb[_0x2760('0x15')],routingClient)[_0x2760('0xa')](respondWithResult(_0xe9d157,null))['catch'](handleError(_0xe9d157,null));};exports[_0x2760('0x4e')]=function(_0x54a3fd,_0x4d8bb6){return respondWithRpcPromise(_0x2760('0x4f'),_0x54a3fd[_0x2760('0x15')],routingClient)[_0x2760('0xa')](findById(_0x54a3fd[_0x2760('0x16')]['id']))[_0x2760('0xa')](respondWithResult(_0x4d8bb6,null))[_0x2760('0x17')](handleError(_0x4d8bb6,null));};exports[_0x2760('0x50')]=function(_0x209ce2,_0x343223){return respondWithRpcPromise(_0x2760('0x51'),_0x209ce2[_0x2760('0x15')],routingClient)[_0x2760('0xa')](respondWithResult(_0x343223,null))[_0x2760('0x17')](handleError(_0x343223,null));};exports[_0x2760('0x52')]=function(_0x26f3e3,_0x5331c0){return respondWithRpcPromise(_0x2760('0x51'),_0x26f3e3[_0x2760('0x15')],routingClient)[_0x2760('0xa')](findById(_0x26f3e3[_0x2760('0x16')]['id']))[_0x2760('0xa')](respondWithResult(_0x5331c0,null))[_0x2760('0x17')](handleError(_0x5331c0,null));};exports[_0x2760('0x53')]=function(_0x471d1a,_0x574d5f){return respondWithRpcPromise(_0x2760('0x54'),_0x471d1a[_0x2760('0x15')])['then'](respondWithResult(_0x574d5f,null))[_0x2760('0x17')](handleError(_0x574d5f,null));};exports[_0x2760('0x55')]=function(_0x2a3145,_0x35778f){return respondWithRpcPromise(_0x2760('0x56'),_0x2a3145[_0x2760('0x15')],routingClient)[_0x2760('0xa')](respondWithResult(_0x35778f,null))[_0x2760('0x17')](handleError(_0x35778f,null));};exports[_0x2760('0x57')]=function(_0x28f412,_0x3d60c2){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x28f412['query'],routingClient)[_0x2760('0xa')](respondWithResult(_0x3d60c2,null))[_0x2760('0x17')](handleError(_0x3d60c2,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x42b06e,_0x23cc92){return respondWithRpcPromise(_0x2760('0x58'),_0x42b06e[_0x2760('0x15')],routingClient)[_0x2760('0xa')](respondWithResult(_0x23cc92,null))[_0x2760('0x17')](handleError(_0x23cc92,null));};exports[_0x2760('0x59')]=function(_0x10fff0,_0x7239c5){return respondWithRpcPromise(_0x2760('0x5a'),_0x10fff0[_0x2760('0x15')],routingClient)[_0x2760('0xa')](respondWithResult(_0x7239c5,null))['catch'](handleError(_0x7239c5,null));};exports['whatsappQueuesWaitingInteractions']=function(_0xea19cf,_0x3a0d47){return respondWithRpcPromise(_0x2760('0x5b'),_0xea19cf[_0x2760('0x15')],routingClient)[_0x2760('0xa')](respondWithResult(_0x3a0d47,null))[_0x2760('0x17')](handleError(_0x3a0d47,null));};exports[_0x2760('0x5c')]=function(_0x2662f9,_0xde0860){return respondWithRpcPromise(_0x2760('0x5d'),_0x2662f9['query'],routingClient)[_0x2760('0xa')](respondWithResult(_0xde0860,null))[_0x2760('0x17')](handleError(_0xde0860,null));};exports[_0x2760('0x5e')]=function(_0x59a486){return function(_0x1d0d88,_0x129999){var _0x32e07b,_0x3c01e8;var _0x187d47=_[_0x2760('0x5f')](_0x59a486);var _0x1697f9=_0x59a486===_0x2760('0x60')?_0x2760('0x61'):'Account';return db[_0x187d47+_0x2760('0x62')][_0x2760('0x63')]({'raw':!![],'where':{'id':_0x1d0d88['params']['id']}})['then'](function(_0x37fa44){if(_['isNil'](_0x37fa44)){throw new Error(_0x187d47+_0x2760('0x64'));}_0x32e07b=_0x37fa44;return db[_0x187d47+_0x2760('0x65')][_0x2760('0x63')]({'where':{'id':_0x1d0d88['body'][_0x2760('0x66')]},'include':[{'model':db[_0x187d47+'Interaction'],'as':'Interaction'},{'model':db[_0x187d47+_0x1697f9],'as':_0x2760('0x67')}]});})[_0x2760('0xa')](function(_0x16bce5){if(_[_0x2760('0x11')](_0x16bce5)){throw new Error(_0x187d47+_0x2760('0x68'));}_0x3c01e8=_0x16bce5;return _0x16bce5[_0x2760('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x2760('0xa')](function(){var _0x1a704f={'uniqueid':_0x59a486+'.'+_0x3c01e8['id']+'.'+_0x3c01e8[_0x2760('0x6a')]['id'],'FromUserId':_0x1d0d88['user']['id'],'type':'queue'};_0x1a704f[_0x187d47+_0x2760('0x6b')]=_0x3c01e8['id'];_0x1a704f[_0x187d47+_0x2760('0x6c')]=_0x3c01e8[_0x2760('0x6a')]['id'];_0x1a704f[_0x2760('0x6d')+_0x187d47+_0x1697f9+'Id']=_0x3c01e8[_0x2760('0x67')]['id'];_0x1a704f['To'+_0x187d47+_0x2760('0x6e')]=_0x32e07b['id'];return db[_0x187d47+_0x2760('0x6f')][_0x2760('0x70')](_0x1a704f);})[_0x2760('0xa')](function(){return respondWithRpcPromise(_0x2760('0x71'),{'channel':_0x59a486,'interaction':_0x3c01e8['Interaction'],'message':_0x3c01e8,'account':_0x3c01e8[_0x2760('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x32e07b[_0x2760('0x2b')]+','+(_0x3c01e8[_0x2760('0x67')][_0x2760('0x72')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x2760('0xa')](respondWithResult(_0x129999,null))[_0x2760('0x17')](handleError(_0x129999,null));};};exports[_0x2760('0x73')]=function(_0x1b2c93,_0x4320b5){var _0x37e5dc,_0x4dc7c5;if(_[_0x2760('0x11')](_0x1b2c93['body']['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0xd89c1c=_0x1b2c93[_0x2760('0x29')]['channel'];var _0x1f8b43=_[_0x2760('0x5f')](_0xd89c1c);var _0x4a7aea=_0xd89c1c===_0x2760('0x60')?_0x2760('0x61'):_0x2760('0x67');return db['User'][_0x2760('0x63')]({'raw':!![],'where':{'id':_0x1b2c93['params']['id'],'role':_0x2760('0x38')}})[_0x2760('0xa')](function(_0x4462d1){if(_[_0x2760('0x11')](_0x4462d1)){throw new Error(_0x2760('0x74'));}_0x37e5dc=_0x4462d1;return db[_0x1f8b43+_0x2760('0x65')]['findOne']({'where':{'id':_0x1b2c93[_0x2760('0x29')]['messageId']},'include':[{'model':db[_0x1f8b43+_0x2760('0x6a')],'as':_0x2760('0x6a')},{'model':db[_0x1f8b43+_0x4a7aea],'as':_0x2760('0x67')}]});})[_0x2760('0xa')](function(_0x196c95){if(_[_0x2760('0x11')](_0x196c95)){throw new Error(_0x1f8b43+_0x2760('0x68'));}_0x4dc7c5=_0x196c95;return _0x196c95[_0x2760('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x2760('0xa')](function(){var _0x1072d8={'uniqueid':_0xd89c1c+'.'+_0x4dc7c5['id']+'.'+_0x4dc7c5[_0x2760('0x6a')]['id'],'FromUserId':_0x1b2c93['user']['id'],'type':_0x2760('0x75'),'ToUserId':_0x37e5dc['id']};_0x1072d8[_0x1f8b43+_0x2760('0x6b')]=_0x4dc7c5['id'];_0x1072d8[_0x1f8b43+_0x2760('0x6c')]=_0x4dc7c5[_0x2760('0x6a')]['id'];_0x1072d8['From'+_0x1f8b43+_0x4a7aea+'Id']=_0x4dc7c5['Account']['id'];return db[_0x1f8b43+_0x2760('0x6f')][_0x2760('0x70')](_0x1072d8);})[_0x2760('0xa')](function(){return respondWithRpcPromise(_0x2760('0x71'),{'channel':_0xd89c1c,'interaction':_0x4dc7c5[_0x2760('0x6a')],'message':_0x4dc7c5,'account':_0x4dc7c5['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x2760('0x38'),'appdata':_0x37e5dc['name']+','+(_0x4dc7c5[_0x2760('0x67')]['agentTransferTimeout']||0x12c),'interval':_0x2760('0x76')}]},routingClient);})[_0x2760('0xa')](respondWithResult(_0x4320b5,null))['catch'](handleError(_0x4320b5,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 3682275..489a6d4 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 _0xd95e=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','run','post','create','update','delete','destroy','exports','multer','util'];(function(_0xd25c51,_0x5027ed){var _0x4802cd=function(_0x171b5e){while(--_0x171b5e){_0xd25c51['push'](_0xd25c51['shift']());}};_0x4802cd(++_0x5027ed);}(_0xd95e,0xc4));var _0xed95=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd95e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xed95('0x0'));var util=require(_0xed95('0x1'));var path=require('path');var timeout=require(_0xed95('0x2'));var express=require(_0xed95('0x3'));var router=express[_0xed95('0x4')]();var auth=require(_0xed95('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xed95('0x6'));var controller=require('./schedule.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xed95('0x7')](_0xed95('0x8'),auth[_0xed95('0x9')](),controller[_0xed95('0xa')]);router[_0xed95('0x7')]('/:id/run',auth['isAuthenticated'](),controller[_0xed95('0xb')]);router[_0xed95('0xc')]('/',auth[_0xed95('0x9')](),controller[_0xed95('0xd')]);router['put'](_0xed95('0x8'),auth[_0xed95('0x9')](),controller[_0xed95('0xe')]);router[_0xed95('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xed95('0x10')]);module[_0xed95('0x11')]=router; \ No newline at end of file +var _0x3ef6=['Router','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','show','get','/:id/run','run','post','create','update','delete','exports','multer','util','connect-timeout','express'];(function(_0x549e72,_0x5b0cd0){var _0x5746dd=function(_0x178370){while(--_0x178370){_0x549e72['push'](_0x549e72['shift']());}};_0x5746dd(++_0x5b0cd0);}(_0x3ef6,0x18b));var _0x63ef=function(_0xcf69e4,_0x22359f){_0xcf69e4=_0xcf69e4-0x0;var _0x3ae183=_0x3ef6[_0xcf69e4];return _0x3ae183;};'use strict';var multer=require(_0x63ef('0x0'));var util=require(_0x63ef('0x1'));var path=require('path');var timeout=require(_0x63ef('0x2'));var express=require(_0x63ef('0x3'));var router=express[_0x63ef('0x4')]();var auth=require(_0x63ef('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x63ef('0x6'));var controller=require('./schedule.controller');router['get']('/',auth[_0x63ef('0x7')](),controller[_0x63ef('0x8')]);router['get'](_0x63ef('0x9'),auth[_0x63ef('0x7')](),controller[_0x63ef('0xa')]);router[_0x63ef('0xb')](_0x63ef('0xc'),auth[_0x63ef('0x7')](),controller[_0x63ef('0xd')]);router[_0x63ef('0xe')]('/',auth[_0x63ef('0x7')](),controller[_0x63ef('0xf')]);router['put'](_0x63ef('0x9'),auth[_0x63ef('0x7')](),controller[_0x63ef('0x10')]);router[_0x63ef('0x11')](_0x63ef('0x9'),auth[_0x63ef('0x7')](),controller['destroy']);module[_0x63ef('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index b227c3f..f679d1d 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 _0xa899=['exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','csv','xlsx','custom','default','TEXT','sequelize'];(function(_0x38484a,_0x5dcc4b){var _0xc4df67=function(_0xf3f2b3){while(--_0xf3f2b3){_0x38484a['push'](_0x38484a['shift']());}};_0xc4df67(++_0x5dcc4b);}(_0xa899,0x155));var _0x9a89=function(_0x4503df,_0xfec122){_0x4503df=_0x4503df-0x0;var _0x3f1b2b=_0xa899[_0x4503df];return _0x3f1b2b;};'use strict';var Sequelize=require(_0x9a89('0x0'));module[_0x9a89('0x1')]={'name':{'type':Sequelize[_0x9a89('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x9a89('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x9a89('0x2')],'allowNull':![],'defaultValue':_0x9a89('0x4')},'startAt':{'type':Sequelize[_0x9a89('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x9a89('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x9a89('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x9a89('0x7')](_0x9a89('0x8'),_0x9a89('0x9'),_0x9a89('0xa'),_0x9a89('0xb'),_0x9a89('0xc'),_0x9a89('0xd'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x9a89('0x7')](_0x9a89('0xe'),'pdf',_0x9a89('0xf')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x9a89('0x7')](_0x9a89('0x10'),_0x9a89('0x11')),'allowNull':![],'defaultValue':_0x9a89('0x10')},'sendMail':{'type':Sequelize[_0x9a89('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x9a89('0x2')]},'cc':{'type':Sequelize[_0x9a89('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xba18=['0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','hours','minutes','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN'];(function(_0x121d9e,_0x11b966){var _0x5df466=function(_0x519340){while(--_0x519340){_0x121d9e['push'](_0x121d9e['shift']());}};_0x5df466(++_0x11b966);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8ba1('0x0'));module[_0x8ba1('0x1')]={'name':{'type':Sequelize[_0x8ba1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8ba1('0x2')]},'active':{'type':Sequelize[_0x8ba1('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x8ba1('0x2')],'allowNull':![],'defaultValue':_0x8ba1('0x4')},'startAt':{'type':Sequelize[_0x8ba1('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x8ba1('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x8ba1('0x7')](_0x8ba1('0x8'),_0x8ba1('0x9'),_0x8ba1('0xa'),_0x8ba1('0xb'),'days',_0x8ba1('0xc'),_0x8ba1('0xd')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM']('csv',_0x8ba1('0xe'),_0x8ba1('0xf')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x8ba1('0x7')](_0x8ba1('0x10'),_0x8ba1('0x11')),'allowNull':![],'defaultValue':_0x8ba1('0x10')},'sendMail':{'type':Sequelize[_0x8ba1('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x8ba1('0x12')]},'bcc':{'type':Sequelize[_0x8ba1('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x8ba1('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 8a34a02..afc3ab7 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 _0xfe57=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','save','update','then','destroy','get','Scheduler','error','stack','name','send','Schedule','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','filtears','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','html-pdf','eml-format','fast-json-patch','request-promise','moment'];(function(_0x49cf8f,_0x195e04){var _0x3bbc1b=function(_0x4b3879){while(--_0x4b3879){_0x49cf8f['push'](_0x49cf8f['shift']());}};_0x3bbc1b(++_0x195e04);}(_0xfe57,0x195));var _0x7fe5=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xfe57[_0x422905];return _0x33dc6c;};'use strict';var pdf=require(_0x7fe5('0x0'));var emlformat=require(_0x7fe5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7fe5('0x2'));var rp=require(_0x7fe5('0x3'));var moment=require(_0x7fe5('0x4'));var BPromise=require(_0x7fe5('0x5'));var Mustache=require(_0x7fe5('0x6'));var util=require(_0x7fe5('0x7'));var path=require(_0x7fe5('0x8'));var sox=require(_0x7fe5('0x9'));var csv=require(_0x7fe5('0xa'));var ejs=require(_0x7fe5('0xb'));var fs=require('fs');var _=require(_0x7fe5('0xc'));var squel=require(_0x7fe5('0xd'));var crypto=require(_0x7fe5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7fe5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7fe5('0x10'));var Papa=require(_0x7fe5('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7fe5('0x12'));var as=require(_0x7fe5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fe5('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7fe5('0x15'));var licenseUtil=require(_0x7fe5('0x16'));var db=require(_0x7fe5('0x17'))['db'];function respondWithStatusCode(_0x225fc3,_0x53f76c){_0x53f76c=_0x53f76c||0xcc;return function(_0x329c95){if(_0x329c95){return _0x225fc3[_0x7fe5('0x18')](_0x53f76c);}return _0x225fc3['status'](_0x53f76c)[_0x7fe5('0x19')]();};}function respondWithResult(_0x54cfb2,_0x1f84b5){_0x1f84b5=_0x1f84b5||0xc8;return function(_0x2d297b){if(_0x2d297b){return _0x54cfb2['status'](_0x1f84b5)[_0x7fe5('0x1a')](_0x2d297b);}};}function respondWithFilteredResult(_0x56e76f,_0x39f175){return function(_0x221ab2){if(_0x221ab2){var _0xbdf0a4=_0x221ab2['count'],_0x4989a=_0x39f175[_0x7fe5('0x1b')],_0x3f699b=_0x39f175[_0x7fe5('0x1b')]+_0x39f175[_0x7fe5('0x1c')],_0x104bc8;if(_0x3f699b>=_0xbdf0a4){_0x3f699b=_0xbdf0a4;_0x104bc8=0xc8;}else{_0x104bc8=0xce;}_0x56e76f[_0x7fe5('0x1d')](_0x104bc8);return _0x56e76f[_0x7fe5('0x1e')](_0x7fe5('0x1f'),_0x4989a+'-'+_0x3f699b+'/'+_0xbdf0a4)[_0x7fe5('0x1a')](_0x221ab2);}return null;};}function patchUpdates(_0x29b0bd){return function(_0x478523){try{jsonpatch[_0x7fe5('0x20')](_0x478523,_0x29b0bd,!![]);}catch(_0x53e996){return BPromise['reject'](_0x53e996);}return _0x478523[_0x7fe5('0x21')]();};}function saveUpdates(_0x459c2d,_0x2f6592){return function(_0x327301){if(_0x327301){return _0x327301[_0x7fe5('0x22')](_0x459c2d)[_0x7fe5('0x23')](function(_0x24efbb){return _0x24efbb;});}return null;};}function removeEntity(_0xdd9df7,_0x1b271c){return function(_0x28a7fd){if(_0x28a7fd){return _0x28a7fd[_0x7fe5('0x24')]()[_0x7fe5('0x23')](function(){var _0x54ee98=_0x28a7fd[_0x7fe5('0x25')]({'plain':!![]});var _0x2f39e0=_0x7fe5('0x26');return db['UserProfileResource'][_0x7fe5('0x24')]({'where':{'type':_0x2f39e0,'resourceId':_0x54ee98['id']}})['then'](function(){return _0x28a7fd;});})[_0x7fe5('0x23')](function(){_0xdd9df7['status'](0xcc)[_0x7fe5('0x19')]();});}};}function handleEntityNotFound(_0x190355,_0x134876){return function(_0x2a96f4){if(!_0x2a96f4){_0x190355[_0x7fe5('0x18')](0x194);}return _0x2a96f4;};}function handleError(_0x4393c3,_0x5bfe23){_0x5bfe23=_0x5bfe23||0x1f4;return function(_0x5f2d25){logger[_0x7fe5('0x27')](_0x5f2d25[_0x7fe5('0x28')]);if(_0x5f2d25[_0x7fe5('0x29')]){delete _0x5f2d25[_0x7fe5('0x29')];}_0x4393c3['status'](_0x5bfe23)[_0x7fe5('0x2a')](_0x5f2d25);};}exports['index']=function(_0x150ab9,_0x1420de){var _0x204bc8={},_0x28a689={},_0x1f8572={'count':0x0,'rows':[]};var _0x45b32b=_['map'](db[_0x7fe5('0x2b')][_0x7fe5('0x2c')],function(_0x5ec0b4){return{'name':_0x5ec0b4[_0x7fe5('0x2d')],'type':_0x5ec0b4[_0x7fe5('0x2e')][_0x7fe5('0x2f')]};});_0x28a689[_0x7fe5('0x30')]=_[_0x7fe5('0x31')](_0x45b32b,'name');_0x28a689['query']=_[_0x7fe5('0x32')](_0x150ab9[_0x7fe5('0x33')]);_0x28a689[_0x7fe5('0x34')]=_[_0x7fe5('0x35')](_0x28a689['model'],_0x28a689[_0x7fe5('0x33')]);_0x204bc8[_0x7fe5('0x36')]=_[_0x7fe5('0x35')](_0x28a689[_0x7fe5('0x30')],qs[_0x7fe5('0x37')](_0x150ab9[_0x7fe5('0x33')]['fields']));_0x204bc8[_0x7fe5('0x36')]=_0x204bc8[_0x7fe5('0x36')][_0x7fe5('0x38')]?_0x204bc8[_0x7fe5('0x36')]:_0x28a689['model'];if(!_0x150ab9['query'][_0x7fe5('0x39')]('nolimit')){_0x204bc8[_0x7fe5('0x1c')]=qs['limit'](_0x150ab9[_0x7fe5('0x33')]['limit']);_0x204bc8['offset']=qs['offset'](_0x150ab9['query'][_0x7fe5('0x1b')]);}_0x204bc8[_0x7fe5('0x3a')]=qs['sort'](_0x150ab9[_0x7fe5('0x33')][_0x7fe5('0x3b')]);_0x204bc8['where']=qs[_0x7fe5('0x34')](_['pick'](_0x150ab9['query'],_0x28a689[_0x7fe5('0x34')]),_0x45b32b);if(_0x150ab9[_0x7fe5('0x33')][_0x7fe5('0x3c')]){_0x204bc8[_0x7fe5('0x3d')]=_[_0x7fe5('0x3e')](_0x204bc8['where'],{'$or':_[_0x7fe5('0x31')](_0x45b32b,function(_0x15cf56){if(_0x15cf56['type']!==_0x7fe5('0x3f')){var _0x2d8ed0={};_0x2d8ed0[_0x15cf56[_0x7fe5('0x29')]]={'$like':'%'+_0x150ab9[_0x7fe5('0x33')][_0x7fe5('0x3c')]+'%'};return _0x2d8ed0;}})});}_0x204bc8=_[_0x7fe5('0x3e')]({},_0x204bc8,_0x150ab9[_0x7fe5('0x40')]);var _0x50cfa5={'where':_0x204bc8['where']};return db[_0x7fe5('0x2b')]['count'](_0x50cfa5)[_0x7fe5('0x23')](function(_0x26be07){_0x1f8572['count']=_0x26be07;if(_0x150ab9[_0x7fe5('0x33')][_0x7fe5('0x41')]){_0x204bc8[_0x7fe5('0x42')]=[{'all':!![]}];}return db[_0x7fe5('0x2b')][_0x7fe5('0x43')](_0x204bc8);})[_0x7fe5('0x23')](function(_0x1cd6d3){_0x1f8572['rows']=_0x1cd6d3;return _0x1f8572;})['then'](respondWithFilteredResult(_0x1420de,_0x204bc8))[_0x7fe5('0x44')](handleError(_0x1420de,null));};exports['show']=function(_0xad0b05,_0x1a3e0d){var _0x453066={'raw':![],'where':{'id':_0xad0b05['params']['id']}},_0x36450d={};_0x36450d[_0x7fe5('0x30')]=_['keys'](db['Schedule'][_0x7fe5('0x2c')]);_0x36450d[_0x7fe5('0x33')]=_['keys'](_0xad0b05[_0x7fe5('0x33')]);_0x36450d[_0x7fe5('0x45')]=_[_0x7fe5('0x35')](_0x36450d[_0x7fe5('0x30')],_0x36450d[_0x7fe5('0x33')]);_0x453066['attributes']=_[_0x7fe5('0x35')](_0x36450d[_0x7fe5('0x30')],qs['fields'](_0xad0b05[_0x7fe5('0x33')][_0x7fe5('0x37')]));_0x453066[_0x7fe5('0x36')]=_0x453066[_0x7fe5('0x36')]['length']?_0x453066[_0x7fe5('0x36')]:_0x36450d[_0x7fe5('0x30')];if(_0xad0b05[_0x7fe5('0x33')]['includeAll']){_0x453066[_0x7fe5('0x42')]=[{'all':!![]}];}_0x453066=_[_0x7fe5('0x3e')]({},_0x453066,_0xad0b05[_0x7fe5('0x40')]);return db['Schedule'][_0x7fe5('0x46')](_0x453066)[_0x7fe5('0x23')](handleEntityNotFound(_0x1a3e0d,null))[_0x7fe5('0x23')](respondWithResult(_0x1a3e0d,null))['catch'](handleError(_0x1a3e0d,null));};exports[_0x7fe5('0x47')]=function(_0x211933,_0x1ac93a){return db[_0x7fe5('0x2b')][_0x7fe5('0x47')](_0x211933[_0x7fe5('0x48')],{})[_0x7fe5('0x23')](function(_0x447b57){var _0x446f01=_0x211933[_0x7fe5('0x49')][_0x7fe5('0x25')]({'plain':!![]});if(!_0x446f01)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x446f01['role']==='user'){var _0x5f2232=_0x447b57[_0x7fe5('0x25')]({'plain':!![]});var _0x5c4f3e=_0x7fe5('0x26');return db[_0x7fe5('0x4a')][_0x7fe5('0x46')]({'where':{'name':_0x5c4f3e,'userProfileId':_0x446f01[_0x7fe5('0x4b')]},'raw':!![]})[_0x7fe5('0x23')](function(_0x5b24a4){if(_0x5b24a4&&_0x5b24a4[_0x7fe5('0x4c')]===0x0){return db[_0x7fe5('0x4d')][_0x7fe5('0x47')]({'name':_0x5f2232[_0x7fe5('0x29')],'resourceId':_0x5f2232['id'],'type':_0x5b24a4[_0x7fe5('0x29')],'sectionId':_0x5b24a4['id']},{})[_0x7fe5('0x23')](function(){return _0x447b57;});}else{return _0x447b57;}})[_0x7fe5('0x44')](function(_0x2165b0){logger[_0x7fe5('0x27')](_0x7fe5('0x4e'),_0x2165b0);throw _0x2165b0;});}return _0x447b57;})['then'](respondWithResult(_0x1ac93a,0xc9))[_0x7fe5('0x44')](handleError(_0x1ac93a,null));};exports[_0x7fe5('0x22')]=function(_0x2aa38d,_0x18781c){if(_0x2aa38d[_0x7fe5('0x48')]['id']){delete _0x2aa38d[_0x7fe5('0x48')]['id'];}return db['Schedule'][_0x7fe5('0x46')]({'where':{'id':_0x2aa38d[_0x7fe5('0x4f')]['id']}})[_0x7fe5('0x23')](handleEntityNotFound(_0x18781c,null))[_0x7fe5('0x23')](saveUpdates(_0x2aa38d[_0x7fe5('0x48')],null))[_0x7fe5('0x23')](respondWithResult(_0x18781c,null))[_0x7fe5('0x44')](handleError(_0x18781c,null));};exports['destroy']=function(_0x2298e2,_0xbdaceb){return db[_0x7fe5('0x2b')][_0x7fe5('0x46')]({'where':{'id':_0x2298e2[_0x7fe5('0x4f')]['id']}})['then'](handleEntityNotFound(_0xbdaceb,null))[_0x7fe5('0x23')](removeEntity(_0xbdaceb,null))[_0x7fe5('0x44')](handleError(_0xbdaceb,null));};exports[_0x7fe5('0x50')]=function(_0x33ce77,_0x4d3035,_0x20317e){var _0x32c25d=require(_0x7fe5('0x51'));return db[_0x7fe5('0x2b')][_0x7fe5('0x46')]({'where':{'id':_0x33ce77[_0x7fe5('0x4f')]['id']},'raw':!![]})[_0x7fe5('0x23')](handleEntityNotFound(_0x4d3035,null))[_0x7fe5('0x23')](function(){_0x32c25d[_0x7fe5('0x50')](_0x33ce77[_0x7fe5('0x4f')]['id']);})[_0x7fe5('0x23')](respondWithStatusCode(_0x4d3035,null))['catch'](handleError(_0x4d3035,null));}; \ No newline at end of file +var _0x6ae0=['limit','status','set','Content-Range','json','reject','save','update','then','destroy','get','UserProfileResource','stack','name','index','Schedule','rawAttributes','fieldName','key','map','query','attributes','model','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','filtears','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset'];(function(_0x146a85,_0x529b52){var _0x1b59bf=function(_0x4af0fd){while(--_0x4af0fd){_0x146a85['push'](_0x146a85['shift']());}};_0x1b59bf(++_0x529b52);}(_0x6ae0,0x192));var _0x06ae=function(_0xe7a81f,_0x458b3d){_0xe7a81f=_0xe7a81f-0x0;var _0x13e1f0=_0x6ae0[_0xe7a81f];return _0x13e1f0;};'use strict';var pdf=require(_0x06ae('0x0'));var emlformat=require(_0x06ae('0x1'));var rimraf=require(_0x06ae('0x2'));var zipdir=require(_0x06ae('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x06ae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x06ae('0x5'));var util=require('util');var path=require(_0x06ae('0x6'));var sox=require(_0x06ae('0x7'));var csv=require('to-csv');var ejs=require(_0x06ae('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x06ae('0x9'));var crypto=require(_0x06ae('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x06ae('0xb'));var toCsv=require(_0x06ae('0xc'));var querystring=require(_0x06ae('0xd'));var Papa=require(_0x06ae('0xe'));var Redis=require(_0x06ae('0xf'));var authService=require(_0x06ae('0x10'));var qs=require(_0x06ae('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06ae('0x12'));var logger=require(_0x06ae('0x13'))(_0x06ae('0x14'));var utils=require(_0x06ae('0x15'));var config=require(_0x06ae('0x16'));var licenseUtil=require(_0x06ae('0x17'));var db=require(_0x06ae('0x18'))['db'];function respondWithStatusCode(_0x4eb845,_0x5cd65f){_0x5cd65f=_0x5cd65f||0xcc;return function(_0x55ec89){if(_0x55ec89){return _0x4eb845[_0x06ae('0x19')](_0x5cd65f);}return _0x4eb845['status'](_0x5cd65f)[_0x06ae('0x1a')]();};}function respondWithResult(_0xa858d2,_0x46dab3){_0x46dab3=_0x46dab3||0xc8;return function(_0x279e03){if(_0x279e03){return _0xa858d2['status'](_0x46dab3)['json'](_0x279e03);}};}function respondWithFilteredResult(_0x3f6ce2,_0x5f44a2){return function(_0x1c8fd7){if(_0x1c8fd7){var _0xf59273=_0x1c8fd7['count'],_0x3a541a=_0x5f44a2[_0x06ae('0x1b')],_0x504598=_0x5f44a2[_0x06ae('0x1b')]+_0x5f44a2[_0x06ae('0x1c')],_0x4ec020;if(_0x504598>=_0xf59273){_0x504598=_0xf59273;_0x4ec020=0xc8;}else{_0x4ec020=0xce;}_0x3f6ce2[_0x06ae('0x1d')](_0x4ec020);return _0x3f6ce2[_0x06ae('0x1e')](_0x06ae('0x1f'),_0x3a541a+'-'+_0x504598+'/'+_0xf59273)[_0x06ae('0x20')](_0x1c8fd7);}return null;};}function patchUpdates(_0x5b18a9){return function(_0x490cd0){try{jsonpatch['apply'](_0x490cd0,_0x5b18a9,!![]);}catch(_0x48fb16){return BPromise[_0x06ae('0x21')](_0x48fb16);}return _0x490cd0[_0x06ae('0x22')]();};}function saveUpdates(_0x5c65b6,_0xd42b1c){return function(_0x235873){if(_0x235873){return _0x235873[_0x06ae('0x23')](_0x5c65b6)[_0x06ae('0x24')](function(_0x5ef463){return _0x5ef463;});}return null;};}function removeEntity(_0xfa1c6f,_0x54b8c7){return function(_0x14b374){if(_0x14b374){return _0x14b374[_0x06ae('0x25')]()['then'](function(){var _0x32c535=_0x14b374[_0x06ae('0x26')]({'plain':!![]});var _0x2c4480='Scheduler';return db[_0x06ae('0x27')][_0x06ae('0x25')]({'where':{'type':_0x2c4480,'resourceId':_0x32c535['id']}})['then'](function(){return _0x14b374;});})[_0x06ae('0x24')](function(){_0xfa1c6f[_0x06ae('0x1d')](0xcc)[_0x06ae('0x1a')]();});}};}function handleEntityNotFound(_0x4f69f2,_0x2e0bfa){return function(_0x47c5ca){if(!_0x47c5ca){_0x4f69f2[_0x06ae('0x19')](0x194);}return _0x47c5ca;};}function handleError(_0x24410a,_0x3e6e9f){_0x3e6e9f=_0x3e6e9f||0x1f4;return function(_0x27cafc){logger['error'](_0x27cafc[_0x06ae('0x28')]);if(_0x27cafc[_0x06ae('0x29')]){delete _0x27cafc[_0x06ae('0x29')];}_0x24410a[_0x06ae('0x1d')](_0x3e6e9f)['send'](_0x27cafc);};}exports[_0x06ae('0x2a')]=function(_0x5ca32b,_0x1baff9){var _0xa6c16b={},_0x11b569={},_0x1d0f70={'count':0x0,'rows':[]};var _0x7ffa60=_['map'](db[_0x06ae('0x2b')][_0x06ae('0x2c')],function(_0x56bf5d){return{'name':_0x56bf5d[_0x06ae('0x2d')],'type':_0x56bf5d['type'][_0x06ae('0x2e')]};});_0x11b569['model']=_[_0x06ae('0x2f')](_0x7ffa60,_0x06ae('0x29'));_0x11b569[_0x06ae('0x30')]=_['keys'](_0x5ca32b[_0x06ae('0x30')]);_0x11b569['filters']=_['intersection'](_0x11b569['model'],_0x11b569[_0x06ae('0x30')]);_0xa6c16b[_0x06ae('0x31')]=_['intersection'](_0x11b569[_0x06ae('0x32')],qs[_0x06ae('0x33')](_0x5ca32b['query'][_0x06ae('0x33')]));_0xa6c16b[_0x06ae('0x31')]=_0xa6c16b['attributes']['length']?_0xa6c16b['attributes']:_0x11b569[_0x06ae('0x32')];if(!_0x5ca32b[_0x06ae('0x30')][_0x06ae('0x34')]('nolimit')){_0xa6c16b['limit']=qs[_0x06ae('0x1c')](_0x5ca32b['query']['limit']);_0xa6c16b[_0x06ae('0x1b')]=qs[_0x06ae('0x1b')](_0x5ca32b[_0x06ae('0x30')][_0x06ae('0x1b')]);}_0xa6c16b['order']=qs[_0x06ae('0x35')](_0x5ca32b[_0x06ae('0x30')][_0x06ae('0x35')]);_0xa6c16b[_0x06ae('0x36')]=qs[_0x06ae('0x37')](_[_0x06ae('0x38')](_0x5ca32b[_0x06ae('0x30')],_0x11b569[_0x06ae('0x37')]),_0x7ffa60);if(_0x5ca32b[_0x06ae('0x30')][_0x06ae('0x39')]){_0xa6c16b[_0x06ae('0x36')]=_[_0x06ae('0x3a')](_0xa6c16b[_0x06ae('0x36')],{'$or':_['map'](_0x7ffa60,function(_0x477c29){if(_0x477c29[_0x06ae('0x3b')]!==_0x06ae('0x3c')){var _0xf11ea9={};_0xf11ea9[_0x477c29[_0x06ae('0x29')]]={'$like':'%'+_0x5ca32b['query'][_0x06ae('0x39')]+'%'};return _0xf11ea9;}})});}_0xa6c16b=_['merge']({},_0xa6c16b,_0x5ca32b[_0x06ae('0x3d')]);var _0x25801b={'where':_0xa6c16b[_0x06ae('0x36')]};return db[_0x06ae('0x2b')][_0x06ae('0x3e')](_0x25801b)['then'](function(_0x2de58d){_0x1d0f70[_0x06ae('0x3e')]=_0x2de58d;if(_0x5ca32b[_0x06ae('0x30')][_0x06ae('0x3f')]){_0xa6c16b[_0x06ae('0x40')]=[{'all':!![]}];}return db['Schedule'][_0x06ae('0x41')](_0xa6c16b);})['then'](function(_0x441127){_0x1d0f70[_0x06ae('0x42')]=_0x441127;return _0x1d0f70;})[_0x06ae('0x24')](respondWithFilteredResult(_0x1baff9,_0xa6c16b))[_0x06ae('0x43')](handleError(_0x1baff9,null));};exports[_0x06ae('0x44')]=function(_0x4e9c3e,_0x3d982a){var _0x401dac={'raw':![],'where':{'id':_0x4e9c3e[_0x06ae('0x45')]['id']}},_0x4effa1={};_0x4effa1[_0x06ae('0x32')]=_['keys'](db[_0x06ae('0x2b')]['rawAttributes']);_0x4effa1['query']=_['keys'](_0x4e9c3e[_0x06ae('0x30')]);_0x4effa1[_0x06ae('0x46')]=_[_0x06ae('0x47')](_0x4effa1[_0x06ae('0x32')],_0x4effa1[_0x06ae('0x30')]);_0x401dac[_0x06ae('0x31')]=_[_0x06ae('0x47')](_0x4effa1[_0x06ae('0x32')],qs['fields'](_0x4e9c3e[_0x06ae('0x30')][_0x06ae('0x33')]));_0x401dac[_0x06ae('0x31')]=_0x401dac[_0x06ae('0x31')]['length']?_0x401dac[_0x06ae('0x31')]:_0x4effa1[_0x06ae('0x32')];if(_0x4e9c3e[_0x06ae('0x30')][_0x06ae('0x3f')]){_0x401dac[_0x06ae('0x40')]=[{'all':!![]}];}_0x401dac=_[_0x06ae('0x3a')]({},_0x401dac,_0x4e9c3e[_0x06ae('0x3d')]);return db[_0x06ae('0x2b')][_0x06ae('0x48')](_0x401dac)[_0x06ae('0x24')](handleEntityNotFound(_0x3d982a,null))[_0x06ae('0x24')](respondWithResult(_0x3d982a,null))[_0x06ae('0x43')](handleError(_0x3d982a,null));};exports[_0x06ae('0x49')]=function(_0x21b49f,_0x1c3717){return db[_0x06ae('0x2b')][_0x06ae('0x49')](_0x21b49f[_0x06ae('0x4a')],{})[_0x06ae('0x24')](function(_0x509969){var _0xa2b743=_0x21b49f[_0x06ae('0x4b')][_0x06ae('0x26')]({'plain':!![]});if(!_0xa2b743)throw new Error(_0x06ae('0x4c'));if(_0xa2b743[_0x06ae('0x4d')]===_0x06ae('0x4b')){var _0x2451db=_0x509969[_0x06ae('0x26')]({'plain':!![]});var _0x5e06b1=_0x06ae('0x4e');return db[_0x06ae('0x4f')][_0x06ae('0x48')]({'where':{'name':_0x5e06b1,'userProfileId':_0xa2b743[_0x06ae('0x50')]},'raw':!![]})['then'](function(_0x5df691){if(_0x5df691&&_0x5df691[_0x06ae('0x51')]===0x0){return db[_0x06ae('0x27')][_0x06ae('0x49')]({'name':_0x2451db[_0x06ae('0x29')],'resourceId':_0x2451db['id'],'type':_0x5df691[_0x06ae('0x29')],'sectionId':_0x5df691['id']},{})['then'](function(){return _0x509969;});}else{return _0x509969;}})[_0x06ae('0x43')](function(_0x43bca9){logger[_0x06ae('0x52')](_0x06ae('0x53'),_0x43bca9);throw _0x43bca9;});}return _0x509969;})['then'](respondWithResult(_0x1c3717,0xc9))[_0x06ae('0x43')](handleError(_0x1c3717,null));};exports[_0x06ae('0x23')]=function(_0x29f27c,_0x57de18){if(_0x29f27c[_0x06ae('0x4a')]['id']){delete _0x29f27c[_0x06ae('0x4a')]['id'];}return db[_0x06ae('0x2b')]['find']({'where':{'id':_0x29f27c[_0x06ae('0x45')]['id']}})['then'](handleEntityNotFound(_0x57de18,null))[_0x06ae('0x24')](saveUpdates(_0x29f27c[_0x06ae('0x4a')],null))[_0x06ae('0x24')](respondWithResult(_0x57de18,null))[_0x06ae('0x43')](handleError(_0x57de18,null));};exports[_0x06ae('0x25')]=function(_0xee6b8f,_0x3195a9){return db[_0x06ae('0x2b')][_0x06ae('0x48')]({'where':{'id':_0xee6b8f[_0x06ae('0x45')]['id']}})[_0x06ae('0x24')](handleEntityNotFound(_0x3195a9,null))['then'](removeEntity(_0x3195a9,null))[_0x06ae('0x43')](handleError(_0x3195a9,null));};exports[_0x06ae('0x54')]=function(_0xb0f455,_0xdb98a,_0x2d6958){var _0x795db9=require(_0x06ae('0x55'));return db['Schedule'][_0x06ae('0x48')]({'where':{'id':_0xb0f455[_0x06ae('0x45')]['id']},'raw':!![]})[_0x06ae('0x24')](handleEntityNotFound(_0xdb98a,null))['then'](function(){_0x795db9[_0x06ae('0x54')](_0xb0f455[_0x06ae('0x45')]['id']);})[_0x06ae('0x24')](respondWithStatusCode(_0xdb98a,null))[_0x06ae('0x43')](handleError(_0xdb98a,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 747e238..43b3c1d 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 _0x0a69=['exports','define','Schedule','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./schedule.attributes'];(function(_0x36738f,_0x304e9e){var _0x11b857=function(_0x20346b){while(--_0x20346b){_0x36738f['push'](_0x36738f['shift']());}};_0x11b857(++_0x304e9e);}(_0x0a69,0x153));var _0x90a6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a69[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x90a6('0x0'));var util=require('util');var logger=require(_0x90a6('0x1'))(_0x90a6('0x2'));var moment=require(_0x90a6('0x3'));var BPromise=require('bluebird');var rp=require(_0x90a6('0x4'));var fs=require('fs');var path=require(_0x90a6('0x5'));var rimraf=require(_0x90a6('0x6'));var config=require(_0x90a6('0x7'));var attributes=require(_0x90a6('0x8'));module[_0x90a6('0x9')]=function(_0x39b746,_0x3475e0){return _0x39b746[_0x90a6('0xa')](_0x90a6('0xb'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63c3=['moment','bluebird','path','rimraf','../../config/environment','./schedule.attributes','exports','define','tools_schedules','lodash','util','../../config/logger','api'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x63c3,0x127));var _0x363c=function(_0x1b43fb,_0x169e3a){_0x1b43fb=_0x1b43fb-0x0;var _0x31f43e=_0x63c3[_0x1b43fb];return _0x31f43e;};'use strict';var _=require(_0x363c('0x0'));var util=require(_0x363c('0x1'));var logger=require(_0x363c('0x2'))(_0x363c('0x3'));var moment=require(_0x363c('0x4'));var BPromise=require(_0x363c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x363c('0x6'));var rimraf=require(_0x363c('0x7'));var config=require(_0x363c('0x8'));var attributes=require(_0x363c('0x9'));module[_0x363c('0xa')]=function(_0x3042b7,_0x3a197e){return _0x3042b7[_0x363c('0xb')]('Schedule',attributes,{'tableName':_0x363c('0xc'),'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 3c40b86..dc48226 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 _0x1ae0=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','bluebird'];(function(_0x24d071,_0x363982){var _0x5c36dc=function(_0x239348){while(--_0x239348){_0x24d071['push'](_0x24d071['shift']());}};_0x5c36dc(++_0x363982);}(_0x1ae0,0x165));var _0x01ae=function(_0x2b522e,_0xf42ddc){_0x2b522e=_0x2b522e-0x0;var _0x3ade0e=_0x1ae0[_0x2b522e];return _0x3ade0e;};'use strict';var _=require('lodash');var util=require(_0x01ae('0x0'));var moment=require(_0x01ae('0x1'));var BPromise=require(_0x01ae('0x2'));var rs=require(_0x01ae('0x3'));var fs=require('fs');var Redis=require(_0x01ae('0x4'));var db=require(_0x01ae('0x5'))['db'];var utils=require(_0x01ae('0x6'));var logger=require(_0x01ae('0x7'))(_0x01ae('0x8'));var config=require(_0x01ae('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x01ae('0xa')][_0x01ae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbbbe79,_0x354036,_0x200fc3){return new BPromise(function(_0x1904d3,_0x5ad315){return client[_0x01ae('0xc')](_0xbbbe79,_0x200fc3)[_0x01ae('0xd')](function(_0x1d7920){logger['info'](_0x01ae('0xe'),_0x354036,_0x01ae('0xf'));logger[_0x01ae('0x10')](_0x01ae('0x11'),_0x354036,_0x01ae('0xf'),JSON[_0x01ae('0x12')](_0x1d7920));if(_0x1d7920[_0x01ae('0x13')]){if(_0x1d7920[_0x01ae('0x13')]['code']===0x1f4){logger['error'](_0x01ae('0xe'),_0x354036,_0x1d7920[_0x01ae('0x13')][_0x01ae('0x14')]);return _0x5ad315(_0x1d7920[_0x01ae('0x13')][_0x01ae('0x14')]);}logger[_0x01ae('0x13')](_0x01ae('0xe'),_0x354036,_0x1d7920[_0x01ae('0x13')][_0x01ae('0x14')]);return _0x1904d3(_0x1d7920[_0x01ae('0x13')]['message']);}else{logger[_0x01ae('0x15')](_0x01ae('0xe'),_0x354036,_0x01ae('0xf'));_0x1904d3(_0x1d7920[_0x01ae('0x16')][_0x01ae('0x14')]);}})[_0x01ae('0x17')](function(_0x471ab6){logger[_0x01ae('0x13')](_0x01ae('0xe'),_0x354036,_0x471ab6);_0x5ad315(_0x471ab6);});});} \ No newline at end of file +var _0x24a0=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x497759,_0x4bbdce){var _0x32c544=function(_0x263b21){while(--_0x263b21){_0x497759['push'](_0x497759['shift']());}};_0x32c544(++_0x4bbdce);}(_0x24a0,0xec));var _0x024a=function(_0x16e2ca,_0x137f8a){_0x16e2ca=_0x16e2ca-0x0;var _0x475760=_0x24a0[_0x16e2ca];return _0x475760;};'use strict';var _=require(_0x024a('0x0'));var util=require(_0x024a('0x1'));var moment=require(_0x024a('0x2'));var BPromise=require(_0x024a('0x3'));var rs=require(_0x024a('0x4'));var fs=require('fs');var Redis=require(_0x024a('0x5'));var db=require(_0x024a('0x6'))['db'];var utils=require(_0x024a('0x7'));var logger=require(_0x024a('0x8'))('rpc');var config=require(_0x024a('0x9'));var jayson=require(_0x024a('0xa'));var client=jayson['client'][_0x024a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44255d,_0x3e0e5d,_0x29e3c1){return new BPromise(function(_0x1cf0c3,_0x55d9be){return client[_0x024a('0xc')](_0x44255d,_0x29e3c1)['then'](function(_0x5bb5cd){logger[_0x024a('0xd')](_0x024a('0xe'),_0x3e0e5d,'request\x20sent');logger[_0x024a('0xf')](_0x024a('0x10'),_0x3e0e5d,_0x024a('0x11'),JSON[_0x024a('0x12')](_0x5bb5cd));if(_0x5bb5cd[_0x024a('0x13')]){if(_0x5bb5cd[_0x024a('0x13')][_0x024a('0x14')]===0x1f4){logger[_0x024a('0x13')](_0x024a('0xe'),_0x3e0e5d,_0x5bb5cd[_0x024a('0x13')][_0x024a('0x15')]);return _0x55d9be(_0x5bb5cd[_0x024a('0x13')][_0x024a('0x15')]);}logger[_0x024a('0x13')](_0x024a('0xe'),_0x3e0e5d,_0x5bb5cd['error'][_0x024a('0x15')]);return _0x1cf0c3(_0x5bb5cd['error'][_0x024a('0x15')]);}else{logger['info'](_0x024a('0xe'),_0x3e0e5d,'request\x20sent');_0x1cf0c3(_0x5bb5cd[_0x024a('0x16')][_0x024a('0x15')]);}})[_0x024a('0x17')](function(_0x8fde2c){logger[_0x024a('0x13')]('Schedule,\x20%s,\x20%s',_0x3e0e5d,_0x8fde2c);_0x55d9be(_0x8fde2c);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 5899bd9..ef797ad 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 _0x5a68=['post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x5a68,0xb6));var _0x85a6=function(_0x47deb3,_0x73b4a6){_0x47deb3=_0x47deb3-0x0;var _0x1f1b05=_0x5a68[_0x47deb3];return _0x1f1b05;};'use strict';var multer=require(_0x85a6('0x0'));var util=require('util');var path=require(_0x85a6('0x1'));var timeout=require(_0x85a6('0x2'));var express=require(_0x85a6('0x3'));var router=express[_0x85a6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x85a6('0x5'));var config=require(_0x85a6('0x6'));var controller=require(_0x85a6('0x7'));router[_0x85a6('0x8')]('/',auth[_0x85a6('0x9')](),controller[_0x85a6('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x85a6('0xb')]);router['get'](_0x85a6('0xc'),auth[_0x85a6('0x9')](),controller[_0x85a6('0xd')]);router[_0x85a6('0x8')](_0x85a6('0xe'),auth[_0x85a6('0x9')](),controller[_0x85a6('0xf')]);router[_0x85a6('0x10')]('/',auth[_0x85a6('0x9')](),controller[_0x85a6('0x11')]);router[_0x85a6('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x85a6('0x13')]('/:id',auth[_0x85a6('0x9')](),controller[_0x85a6('0x14')]);module[_0x85a6('0x15')]=router; \ No newline at end of file +var _0x04a6=['put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/download','download','post','create'];(function(_0x439664,_0x15f2a8){var _0x11b5b7=function(_0x5058a7){while(--_0x5058a7){_0x439664['push'](_0x439664['shift']());}};_0x11b5b7(++_0x15f2a8);}(_0x04a6,0x164));var _0x604a=function(_0xb75aa8,_0x5357c0){_0xb75aa8=_0xb75aa8-0x0;var _0x13999b=_0x04a6[_0xb75aa8];return _0x13999b;};'use strict';var multer=require(_0x604a('0x0'));var util=require('util');var path=require(_0x604a('0x1'));var timeout=require(_0x604a('0x2'));var express=require(_0x604a('0x3'));var router=express[_0x604a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x604a('0x5'));var config=require(_0x604a('0x6'));var controller=require(_0x604a('0x7'));router['get']('/',auth[_0x604a('0x8')](),controller[_0x604a('0x9')]);router[_0x604a('0xa')](_0x604a('0xb'),auth[_0x604a('0x8')](),controller['describe']);router[_0x604a('0xa')](_0x604a('0xc'),auth[_0x604a('0x8')](),controller[_0x604a('0xd')]);router[_0x604a('0xa')](_0x604a('0xe'),auth[_0x604a('0x8')](),controller[_0x604a('0xf')]);router[_0x604a('0x10')]('/',auth[_0x604a('0x8')](),controller[_0x604a('0x11')]);router[_0x604a('0x12')](_0x604a('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x604a('0x13')](_0x604a('0xc'),auth[_0x604a('0x8')](),controller[_0x604a('0x14')]);module[_0x604a('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 4e98222..41cddd1 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 _0x7fbe=['setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING'];(function(_0x277e67,_0x2b0c68){var _0x1e4b0e=function(_0x130da4){while(--_0x130da4){_0x277e67['push'](_0x277e67['shift']());}};_0x1e4b0e(++_0x2b0c68);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2fa06e,_0x228d80){_0x2fa06e=_0x2fa06e-0x0;var _0x2df3f2=_0x7fbe[_0x2fa06e];return _0x2df3f2;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0xe7fb('0x0'));var config=require(_0xe7fb('0x1'));module[_0xe7fb('0x2')]={'format':{'type':Sequelize[_0xe7fb('0x3')],'get':function(){return this[_0xe7fb('0x4')](_0xe7fb('0x5'))?path[_0xe7fb('0x6')](this[_0xe7fb('0x4')](_0xe7fb('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0xe7fb('0x7')]},'channel':{'type':Sequelize[_0xe7fb('0x7')]},'value':{'type':Sequelize[_0xe7fb('0x7')],'set':function(_0x24cd67){var _0x1f943f=_0x24cd67['replace'](/\\/g,'/');this[_0xe7fb('0x8')](_0xe7fb('0x5'),_0x1f943f);}},'rating':{'type':Sequelize[_0xe7fb('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xe7fb('0x9')],'set':function(_0x4ba197){this['setDataValue'](_0xe7fb('0xa'),moment()[_0xe7fb('0xb')](_0x4ba197,'ms'));this[_0xe7fb('0x8')](_0xe7fb('0xc'),moment());this[_0xe7fb('0x8')](_0xe7fb('0xd'),_0x4ba197);}},'startedAt':{'type':Sequelize[_0xe7fb('0xe')],'get':function(){return moment(this[_0xe7fb('0x4')](_0xe7fb('0xa')))[_0xe7fb('0xf')](_0xe7fb('0x10'))[_0xe7fb('0x11')]();}},'closedAt':{'type':Sequelize[_0xe7fb('0xe')],'get':function(){return moment(this[_0xe7fb('0x4')](_0xe7fb('0xc')))['format'](_0xe7fb('0x10'))[_0xe7fb('0x11')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xe7fb('0x4')](_0xe7fb('0x12')))['format'](_0xe7fb('0x10'))['toString']();}},'updatedAt':{'type':Sequelize[_0xe7fb('0xe')],'get':function(){return moment(this[_0xe7fb('0x4')](_0xe7fb('0x13')))[_0xe7fb('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xe7fb('0x11')]();}}}; \ No newline at end of file +var _0x98a8=['updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','extname','value','STRING','replace','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt'];(function(_0x321470,_0x28a5aa){var _0x403c20=function(_0x4e213e){while(--_0x4e213e){_0x321470['push'](_0x321470['shift']());}};_0x403c20(++_0x28a5aa);}(_0x98a8,0x12c));var _0x898a=function(_0x1e3421,_0x58b734){_0x1e3421=_0x1e3421-0x0;var _0x42b1dc=_0x98a8[_0x1e3421];return _0x42b1dc;};'use strict';var Sequelize=require(_0x898a('0x0'));var moment=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var config=require(_0x898a('0x3'));module[_0x898a('0x4')]={'format':{'type':Sequelize[_0x898a('0x5')],'get':function(){return this[_0x898a('0x6')]('value')?path[_0x898a('0x7')](this[_0x898a('0x6')](_0x898a('0x8'))):undefined;}},'interactionid':{'type':Sequelize[_0x898a('0x9')]},'channel':{'type':Sequelize[_0x898a('0x9')]},'value':{'type':Sequelize['STRING'],'set':function(_0x3aadc2){var _0x564583=_0x3aadc2[_0x898a('0xa')](/\\/g,'/');this['setDataValue'](_0x898a('0x8'),_0x564583);}},'rating':{'type':Sequelize[_0x898a('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x898a('0xb')],'set':function(_0x96b636){this[_0x898a('0xc')](_0x898a('0xd'),moment()[_0x898a('0xe')](_0x96b636,'ms'));this[_0x898a('0xc')](_0x898a('0xf'),moment());this['setDataValue'](_0x898a('0x10'),_0x96b636);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x898a('0x6')]('startedAt'))[_0x898a('0x11')](_0x898a('0x12'))[_0x898a('0x13')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('closedAt'))[_0x898a('0x11')](_0x898a('0x12'))[_0x898a('0x13')]();}},'createdAt':{'type':Sequelize[_0x898a('0x14')],'get':function(){return moment(this[_0x898a('0x6')](_0x898a('0x15')))['format'](_0x898a('0x12'))['toString']();}},'updatedAt':{'type':Sequelize[_0x898a('0x14')],'get':function(){return moment(this['getDataValue'](_0x898a('0x16')))['format'](_0x898a('0x12'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 018a46c..4df937f 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 _0x0c2b=['format','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','filtears','find','create','body','duration','createdAt','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','join','root','server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','send','destroy','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','info','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','sendStatus','error','name','index','map','ScreenRecording','fieldName','type','key','model','differenceBy'];(function(_0x2faaba,_0x3f2b50){var _0x7099d9=function(_0xffe9fb){while(--_0xffe9fb){_0x2faaba['push'](_0x2faaba['shift']());}};_0x7099d9(++_0x3f2b50);}(_0x0c2b,0x1d6));var _0xb0c2=function(_0x13fe7b,_0xc1d405){_0x13fe7b=_0x13fe7b-0x0;var _0x2f773e=_0x0c2b[_0x13fe7b];return _0x2f773e;};'use strict';var pdf=require(_0xb0c2('0x0'));var emlformat=require(_0xb0c2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb0c2('0x2'));var jsonpatch=require(_0xb0c2('0x3'));var rp=require(_0xb0c2('0x4'));var moment=require(_0xb0c2('0x5'));var BPromise=require(_0xb0c2('0x6'));var Mustache=require(_0xb0c2('0x7'));var util=require('util');var path=require(_0xb0c2('0x8'));var sox=require(_0xb0c2('0x9'));var csv=require(_0xb0c2('0xa'));var ejs=require(_0xb0c2('0xb'));var fs=require('fs');var _=require(_0xb0c2('0xc'));var squel=require(_0xb0c2('0xd'));var crypto=require(_0xb0c2('0xe'));var jsforce=require(_0xb0c2('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb0c2('0xa'));var querystring=require(_0xb0c2('0x10'));var Papa=require(_0xb0c2('0x11'));var Redis=require('ioredis');var authService=require(_0xb0c2('0x12'));var qs=require(_0xb0c2('0x13'));var as=require(_0xb0c2('0x14'));var hardwareService=require(_0xb0c2('0x15'));var logger=require(_0xb0c2('0x16'))(_0xb0c2('0x17'));var utils=require(_0xb0c2('0x18'));var config=require(_0xb0c2('0x19'));var licenseUtil=require(_0xb0c2('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c3c62,_0x1740e6){_0x1740e6=_0x1740e6||0xcc;return function(_0x47a1ba){if(_0x47a1ba){return _0x4c3c62['sendStatus'](_0x1740e6);}return _0x4c3c62['status'](_0x1740e6)[_0xb0c2('0x1b')]();};}function respondWithResult(_0x33bc0e,_0xb41243){_0xb41243=_0xb41243||0xc8;return function(_0x3eae62){if(_0x3eae62){return _0x33bc0e[_0xb0c2('0x1c')](_0xb41243)[_0xb0c2('0x1d')](_0x3eae62);}};}function respondWithFilteredResult(_0x357cd2,_0x3157e6){return function(_0x4254fb){if(_0x4254fb){var _0x1f7582=_0x4254fb[_0xb0c2('0x1e')],_0x562ad3=_0x3157e6[_0xb0c2('0x1f')],_0x36ed7f=_0x3157e6[_0xb0c2('0x1f')]+_0x3157e6[_0xb0c2('0x20')],_0x3e4d99;if(_0x36ed7f>=_0x1f7582){_0x36ed7f=_0x1f7582;_0x3e4d99=0xc8;}else{_0x3e4d99=0xce;}_0x357cd2[_0xb0c2('0x1c')](_0x3e4d99);return _0x357cd2[_0xb0c2('0x21')](_0xb0c2('0x22'),_0x562ad3+'-'+_0x36ed7f+'/'+_0x1f7582)[_0xb0c2('0x1d')](_0x4254fb);}return null;};}function patchUpdates(_0x52f393){return function(_0x5619e8){try{jsonpatch[_0xb0c2('0x23')](_0x5619e8,_0x52f393,!![]);}catch(_0x303948){return BPromise['reject'](_0x303948);}return _0x5619e8[_0xb0c2('0x24')]();};}function saveUpdates(_0x170ce9,_0x22c683){return function(_0x87d8e9){if(_0x87d8e9){return _0x87d8e9[_0xb0c2('0x25')](_0x170ce9)[_0xb0c2('0x26')](function(_0x669120){return _0x669120;});}return null;};}function removeEntity(_0x1e44fa,_0x404d81){return function(_0xe03eb){if(_0xe03eb){return _0xe03eb['destroy']()['then'](function(){_0x1e44fa[_0xb0c2('0x1c')](0xcc)[_0xb0c2('0x1b')]();});}};}function handleEntityNotFound(_0x128a39,_0x583418){return function(_0x4951ba){if(!_0x4951ba){_0x128a39[_0xb0c2('0x27')](0x194);}return _0x4951ba;};}function handleError(_0x2b8488,_0x5327d5){_0x5327d5=_0x5327d5||0x1f4;return function(_0x22a674){logger[_0xb0c2('0x28')](_0x22a674['stack']);if(_0x22a674['name']){delete _0x22a674[_0xb0c2('0x29')];}_0x2b8488[_0xb0c2('0x1c')](_0x5327d5)['send'](_0x22a674);};}exports[_0xb0c2('0x2a')]=function(_0x17bb14,_0x250b77){var _0x1dcac9={},_0xcf8c2b={},_0x436259={'count':0x0,'rows':[]};var _0x5c3f5b=_[_0xb0c2('0x2b')](db[_0xb0c2('0x2c')]['rawAttributes'],function(_0x4f0ea7){return{'name':_0x4f0ea7[_0xb0c2('0x2d')],'type':_0x4f0ea7[_0xb0c2('0x2e')][_0xb0c2('0x2f')]};});_0xcf8c2b[_0xb0c2('0x30')]=_[_0xb0c2('0x31')](_[_0xb0c2('0x2b')](_0x5c3f5b,_0xb0c2('0x29')),[_0xb0c2('0x32')]);_0xcf8c2b[_0xb0c2('0x33')]=_[_0xb0c2('0x34')](_0x17bb14[_0xb0c2('0x33')]);_0xcf8c2b['filters']=_[_0xb0c2('0x35')](_0xcf8c2b[_0xb0c2('0x30')],_0xcf8c2b[_0xb0c2('0x33')]);_0x1dcac9[_0xb0c2('0x36')]=_[_0xb0c2('0x35')](_0xcf8c2b[_0xb0c2('0x30')],qs['fields'](_0x17bb14[_0xb0c2('0x33')][_0xb0c2('0x37')]));_0x1dcac9[_0xb0c2('0x36')]=_0x1dcac9[_0xb0c2('0x36')][_0xb0c2('0x38')]?_0x1dcac9[_0xb0c2('0x36')]:_0xcf8c2b[_0xb0c2('0x30')];if(!_0x17bb14[_0xb0c2('0x33')][_0xb0c2('0x39')](_0xb0c2('0x3a'))){_0x1dcac9['limit']=qs[_0xb0c2('0x20')](_0x17bb14['query'][_0xb0c2('0x20')]);_0x1dcac9[_0xb0c2('0x1f')]=qs[_0xb0c2('0x1f')](_0x17bb14['query']['offset']);}_0x1dcac9[_0xb0c2('0x3b')]=qs[_0xb0c2('0x3c')](_0x17bb14[_0xb0c2('0x33')][_0xb0c2('0x3c')]);_0x1dcac9[_0xb0c2('0x3d')]=qs['filters'](_['pick'](_0x17bb14[_0xb0c2('0x33')],_0xcf8c2b[_0xb0c2('0x3e')]),_0x5c3f5b);if(_0x17bb14[_0xb0c2('0x33')][_0xb0c2('0x3f')]){_0x1dcac9[_0xb0c2('0x3d')]=_[_0xb0c2('0x40')](_0x1dcac9[_0xb0c2('0x3d')],{'$or':_['map'](_0x5c3f5b,function(_0x566345){if(_0x566345[_0xb0c2('0x2e')]!=='VIRTUAL'){var _0x469748={};_0x469748[_0x566345[_0xb0c2('0x29')]]={'$like':'%'+_0x17bb14[_0xb0c2('0x33')][_0xb0c2('0x3f')]+'%'};return _0x469748;}})});}_0x1dcac9=_[_0xb0c2('0x40')]({},_0x1dcac9,_0x17bb14[_0xb0c2('0x41')]);var _0x5cd385={'where':_0x1dcac9[_0xb0c2('0x3d')]};return db[_0xb0c2('0x2c')]['count'](_0x5cd385)[_0xb0c2('0x26')](function(_0x2ae862){_0x436259[_0xb0c2('0x1e')]=_0x2ae862;if(_0x17bb14[_0xb0c2('0x33')][_0xb0c2('0x42')]){_0x1dcac9[_0xb0c2('0x43')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x1dcac9);})[_0xb0c2('0x26')](function(_0x27d02b){_0x436259[_0xb0c2('0x44')]=_0x27d02b;return _0x436259;})[_0xb0c2('0x26')](respondWithFilteredResult(_0x250b77,_0x1dcac9))[_0xb0c2('0x45')](handleError(_0x250b77,null));};exports[_0xb0c2('0x46')]=function(_0x14cb68,_0x5e4a51){var _0xcadc31={'raw':![],'where':{'id':_0x14cb68[_0xb0c2('0x47')]['id']}},_0x397e09={};_0x397e09[_0xb0c2('0x30')]=_[_0xb0c2('0x34')](db[_0xb0c2('0x2c')][_0xb0c2('0x48')]);_0x397e09['query']=_[_0xb0c2('0x34')](_0x14cb68[_0xb0c2('0x33')]);_0x397e09[_0xb0c2('0x49')]=_[_0xb0c2('0x35')](_0x397e09[_0xb0c2('0x30')],_0x397e09[_0xb0c2('0x33')]);_0xcadc31[_0xb0c2('0x36')]=_[_0xb0c2('0x35')](_0x397e09[_0xb0c2('0x30')],qs[_0xb0c2('0x37')](_0x14cb68['query'][_0xb0c2('0x37')]));_0xcadc31[_0xb0c2('0x36')]=_0xcadc31[_0xb0c2('0x36')][_0xb0c2('0x38')]?_0xcadc31['attributes']:_0x397e09['model'];if(_0x14cb68[_0xb0c2('0x33')][_0xb0c2('0x42')]){_0xcadc31[_0xb0c2('0x43')]=[{'all':!![]}];}_0xcadc31=_[_0xb0c2('0x40')]({},_0xcadc31,_0x14cb68[_0xb0c2('0x41')]);return db[_0xb0c2('0x2c')][_0xb0c2('0x4a')](_0xcadc31)[_0xb0c2('0x26')](handleEntityNotFound(_0x5e4a51,null))[_0xb0c2('0x26')](respondWithResult(_0x5e4a51,null))['catch'](handleError(_0x5e4a51,null));};exports[_0xb0c2('0x4b')]=function(_0x261acb,_0x694c55){return db[_0xb0c2('0x2c')][_0xb0c2('0x4b')](_0x261acb[_0xb0c2('0x4c')],{})[_0xb0c2('0x26')](respondWithResult(_0x694c55,0xc9))[_0xb0c2('0x45')](handleError(_0x694c55,null));};exports[_0xb0c2('0x25')]=function(_0x456e72,_0x5c7e47){if(_0x456e72[_0xb0c2('0x4c')]['id']){delete _0x456e72[_0xb0c2('0x4c')]['id'];}delete _0x456e72[_0xb0c2('0x4c')][_0xb0c2('0x4d')];delete _0x456e72[_0xb0c2('0x4c')][_0xb0c2('0x4e')];delete _0x456e72[_0xb0c2('0x4c')]['closedAt'];delete _0x456e72['body']['value'];return db[_0xb0c2('0x2c')]['find']({'where':{'id':_0x456e72[_0xb0c2('0x47')]['id']}})[_0xb0c2('0x26')](handleEntityNotFound(_0x5c7e47,null))[_0xb0c2('0x26')](saveUpdates(_0x456e72[_0xb0c2('0x4c')],null))[_0xb0c2('0x26')](respondWithResult(_0x5c7e47,null))[_0xb0c2('0x45')](handleError(_0x5c7e47,null));};exports[_0xb0c2('0x4f')]=function(_0xb36d38,_0x4bcf27){return db[_0xb0c2('0x2c')][_0xb0c2('0x4f')]()['then'](respondWithResult(_0x4bcf27,null))[_0xb0c2('0x45')](handleError(_0x4bcf27,null));};exports[_0xb0c2('0x50')]=function(_0x428494,_0x30cd1b,_0x52ea8c){var _0x21796b=require('../../components/encryptor');var _0x1fa768=![];var _0x349714={};if(_0x428494[_0xb0c2('0x33')]['type']&&_0x428494['query']['type']===_0xb0c2('0x51')){_0x349714[_0xb0c2('0x51')]=_0x428494[_0xb0c2('0x47')]['id'];}else{_0x349714['id']=_0x428494[_0xb0c2('0x47')]['id'];}return db[_0xb0c2('0x2c')][_0xb0c2('0x4a')]({'where':_0x349714,'attributes':['id','value'],'raw':!![]})[_0xb0c2('0x26')](handleEntityNotFound(_0x30cd1b,null))[_0xb0c2('0x26')](function(_0x3fd206){if(_0x3fd206){var _0x5556fd=path['join'](config['root'],'server/files/screen_recordings',_0x3fd206[_0xb0c2('0x52')]);var _0x40f4c6=util[_0xb0c2('0x32')](_0xb0c2('0x53'),_0x5556fd);if(fs[_0xb0c2('0x54')](_0x40f4c6)){_0x1fa768=!![];return _0x21796b[_0xb0c2('0x55')](_0x40f4c6,_0x5556fd,config['secrets'][_0xb0c2('0x56')])[_0xb0c2('0x26')](function(){return _0x3fd206;});}return _0x3fd206;}})[_0xb0c2('0x26')](function(_0x3b3ffb){if(_0x3b3ffb){var _0x53a36e=path[_0xb0c2('0x57')](config[_0xb0c2('0x58')],_0xb0c2('0x59'),_0x3b3ffb[_0xb0c2('0x52')]);if(!fs[_0xb0c2('0x54')](_0x53a36e)){throw new db[(_0xb0c2('0x5a'))]['ValidationError'](_0xb0c2('0x5b'));}if(_0x3b3ffb['filename']){return _0x30cd1b['download'](_0x53a36e,_0x3b3ffb[_0xb0c2('0x5c')]+path['extname'](_0x53a36e),function(){if(_0x1fa768){fs['unlink'](_0x53a36e);}});}else{return _0x30cd1b[_0xb0c2('0x50')](_0x53a36e,function(_0x2031f5){if(_0x1fa768){fs[_0xb0c2('0x5d')](_0x53a36e);}});}}})[_0xb0c2('0x45')](function(_0x4cb8c8){if(_0x4cb8c8[_0xb0c2('0x5e')]===_0xb0c2('0x5b')){_0x30cd1b[_0xb0c2('0x1c')](0x194)[_0xb0c2('0x5f')]('Not\x20found');}else{return handleError(_0x30cd1b,null);}});};exports[_0xb0c2('0x60')]=function(_0x3acf1b,_0x10fd7b){return db[_0xb0c2('0x2c')][_0xb0c2('0x4a')]({'where':{'id':_0x3acf1b[_0xb0c2('0x47')]['id']}})['then'](function(_0x2c45c3){if(!_0x2c45c3)throw new ReferenceError(_0xb0c2('0x61'));return _0x2c45c3;})[_0xb0c2('0x26')](function(_0x4b8890){var _0x37cb88=path[_0xb0c2('0x57')](config[_0xb0c2('0x58')],_0xb0c2('0x59'),_0x4b8890[_0xb0c2('0x52')]);logger['info'](_0xb0c2('0x62'),_0x37cb88);if(!_[_0xb0c2('0x63')](_0x4b8890['value'])&&fs['existsSync'](_0x37cb88)){logger['info'](_0xb0c2('0x64')+_0x37cb88+_0xb0c2('0x65'));fs[_0xb0c2('0x66')](_0x37cb88);}_0x37cb88=_0x37cb88+'.cypher';if(!_[_0xb0c2('0x63')](_0x4b8890['value'])&&fs[_0xb0c2('0x54')](_0x37cb88)){logger[_0xb0c2('0x67')](_0xb0c2('0x64')+_0x37cb88+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xb0c2('0x66')](_0x37cb88);}return _0x4b8890;})[_0xb0c2('0x26')](function(_0x1128c9){if(!_0x1128c9)throw new InternalError();return _0x1128c9[_0xb0c2('0x60')]();})[_0xb0c2('0x26')](function(){_0x10fd7b[_0xb0c2('0x1c')](0xcc)['end']();})['catch'](handleError(_0x10fd7b,null));}; \ No newline at end of file +var _0x16b3=['body','duration','createdAt','closedAt','params','describe','download','../../components/encryptor','uniqueid','value','root','existsSync','decryptFile','secrets','recording','join','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','destroy','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','index','map','ScreenRecording','fieldName','type','key','model','differenceBy','format','query','keys','intersection','attributes','fields','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','include','rows','catch','show','filtears','length','find','create'];(function(_0x3fb030,_0x12aebe){var _0xd6899b=function(_0x327646){while(--_0x327646){_0x3fb030['push'](_0x3fb030['shift']());}};_0xd6899b(++_0x12aebe);}(_0x16b3,0x15a));var _0x316b=function(_0x1d3f95,_0x4bde08){_0x1d3f95=_0x1d3f95-0x0;var _0x17c0ae=_0x16b3[_0x1d3f95];return _0x17c0ae;};'use strict';var pdf=require(_0x316b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x316b('0x1'));var zipdir=require(_0x316b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x316b('0x3'));var moment=require(_0x316b('0x4'));var BPromise=require(_0x316b('0x5'));var Mustache=require(_0x316b('0x6'));var util=require(_0x316b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x316b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x316b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x316b('0xa'));var deskjs=require(_0x316b('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x316b('0xc'));var Redis=require(_0x316b('0xd'));var authService=require(_0x316b('0xe'));var qs=require(_0x316b('0xf'));var as=require(_0x316b('0x10'));var hardwareService=require(_0x316b('0x11'));var logger=require(_0x316b('0x12'))('api');var utils=require(_0x316b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x316b('0x14'));var db=require(_0x316b('0x15'))['db'];function respondWithStatusCode(_0x2f69a0,_0x1195c5){_0x1195c5=_0x1195c5||0xcc;return function(_0x5cf3e7){if(_0x5cf3e7){return _0x2f69a0[_0x316b('0x16')](_0x1195c5);}return _0x2f69a0[_0x316b('0x17')](_0x1195c5)[_0x316b('0x18')]();};}function respondWithResult(_0x387c36,_0x360da3){_0x360da3=_0x360da3||0xc8;return function(_0x2995fd){if(_0x2995fd){return _0x387c36['status'](_0x360da3)[_0x316b('0x19')](_0x2995fd);}};}function respondWithFilteredResult(_0xfe6509,_0x175d34){return function(_0x3d0404){if(_0x3d0404){var _0x30a9dc=_0x3d0404['count'],_0x176b2d=_0x175d34[_0x316b('0x1a')],_0x5760f4=_0x175d34['offset']+_0x175d34[_0x316b('0x1b')],_0x93f7e1;if(_0x5760f4>=_0x30a9dc){_0x5760f4=_0x30a9dc;_0x93f7e1=0xc8;}else{_0x93f7e1=0xce;}_0xfe6509[_0x316b('0x17')](_0x93f7e1);return _0xfe6509[_0x316b('0x1c')](_0x316b('0x1d'),_0x176b2d+'-'+_0x5760f4+'/'+_0x30a9dc)['json'](_0x3d0404);}return null;};}function patchUpdates(_0x337055){return function(_0x4a0085){try{jsonpatch[_0x316b('0x1e')](_0x4a0085,_0x337055,!![]);}catch(_0x2389a5){return BPromise[_0x316b('0x1f')](_0x2389a5);}return _0x4a0085['save']();};}function saveUpdates(_0x2dd63,_0x373e07){return function(_0x21bab){if(_0x21bab){return _0x21bab[_0x316b('0x20')](_0x2dd63)['then'](function(_0x364771){return _0x364771;});}return null;};}function removeEntity(_0x3a802f,_0x49c67e){return function(_0xeee587){if(_0xeee587){return _0xeee587['destroy']()[_0x316b('0x21')](function(){_0x3a802f[_0x316b('0x17')](0xcc)[_0x316b('0x18')]();});}};}function handleEntityNotFound(_0x23c99e,_0x515a8e){return function(_0x5bffd5){if(!_0x5bffd5){_0x23c99e[_0x316b('0x16')](0x194);}return _0x5bffd5;};}function handleError(_0x5e6e59,_0x3c6ae1){_0x3c6ae1=_0x3c6ae1||0x1f4;return function(_0x410670){logger[_0x316b('0x22')](_0x410670[_0x316b('0x23')]);if(_0x410670['name']){delete _0x410670[_0x316b('0x24')];}_0x5e6e59[_0x316b('0x17')](_0x3c6ae1)['send'](_0x410670);};}exports[_0x316b('0x25')]=function(_0x424478,_0x961928){var _0x2e5d79={},_0x5a1983={},_0x211b74={'count':0x0,'rows':[]};var _0x2095a2=_[_0x316b('0x26')](db[_0x316b('0x27')]['rawAttributes'],function(_0x288070){return{'name':_0x288070[_0x316b('0x28')],'type':_0x288070[_0x316b('0x29')][_0x316b('0x2a')]};});_0x5a1983[_0x316b('0x2b')]=_[_0x316b('0x2c')](_[_0x316b('0x26')](_0x2095a2,_0x316b('0x24')),[_0x316b('0x2d')]);_0x5a1983[_0x316b('0x2e')]=_[_0x316b('0x2f')](_0x424478['query']);_0x5a1983['filters']=_[_0x316b('0x30')](_0x5a1983[_0x316b('0x2b')],_0x5a1983[_0x316b('0x2e')]);_0x2e5d79[_0x316b('0x31')]=_[_0x316b('0x30')](_0x5a1983[_0x316b('0x2b')],qs[_0x316b('0x32')](_0x424478[_0x316b('0x2e')][_0x316b('0x32')]));_0x2e5d79[_0x316b('0x31')]=_0x2e5d79[_0x316b('0x31')]['length']?_0x2e5d79[_0x316b('0x31')]:_0x5a1983['model'];if(!_0x424478[_0x316b('0x2e')]['hasOwnProperty'](_0x316b('0x33'))){_0x2e5d79['limit']=qs[_0x316b('0x1b')](_0x424478['query']['limit']);_0x2e5d79[_0x316b('0x1a')]=qs['offset'](_0x424478[_0x316b('0x2e')]['offset']);}_0x2e5d79[_0x316b('0x34')]=qs['sort'](_0x424478[_0x316b('0x2e')][_0x316b('0x35')]);_0x2e5d79['where']=qs[_0x316b('0x36')](_['pick'](_0x424478[_0x316b('0x2e')],_0x5a1983['filters']),_0x2095a2);if(_0x424478[_0x316b('0x2e')][_0x316b('0x37')]){_0x2e5d79['where']=_[_0x316b('0x38')](_0x2e5d79[_0x316b('0x39')],{'$or':_[_0x316b('0x26')](_0x2095a2,function(_0x3c4057){if(_0x3c4057['type']!==_0x316b('0x3a')){var _0x276254={};_0x276254[_0x3c4057['name']]={'$like':'%'+_0x424478[_0x316b('0x2e')][_0x316b('0x37')]+'%'};return _0x276254;}})});}_0x2e5d79=_[_0x316b('0x38')]({},_0x2e5d79,_0x424478[_0x316b('0x3b')]);var _0xb12b34={'where':_0x2e5d79[_0x316b('0x39')]};return db[_0x316b('0x27')][_0x316b('0x3c')](_0xb12b34)[_0x316b('0x21')](function(_0x54d9c4){_0x211b74[_0x316b('0x3c')]=_0x54d9c4;if(_0x424478[_0x316b('0x2e')][_0x316b('0x3d')]){_0x2e5d79[_0x316b('0x3e')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x2e5d79);})[_0x316b('0x21')](function(_0x1a0f0a){_0x211b74[_0x316b('0x3f')]=_0x1a0f0a;return _0x211b74;})['then'](respondWithFilteredResult(_0x961928,_0x2e5d79))[_0x316b('0x40')](handleError(_0x961928,null));};exports[_0x316b('0x41')]=function(_0x14a030,_0x16d318){var _0x7ff0c={'raw':![],'where':{'id':_0x14a030['params']['id']}},_0x455cbc={};_0x455cbc[_0x316b('0x2b')]=_[_0x316b('0x2f')](db['ScreenRecording']['rawAttributes']);_0x455cbc[_0x316b('0x2e')]=_[_0x316b('0x2f')](_0x14a030[_0x316b('0x2e')]);_0x455cbc[_0x316b('0x42')]=_[_0x316b('0x30')](_0x455cbc[_0x316b('0x2b')],_0x455cbc[_0x316b('0x2e')]);_0x7ff0c[_0x316b('0x31')]=_[_0x316b('0x30')](_0x455cbc[_0x316b('0x2b')],qs[_0x316b('0x32')](_0x14a030[_0x316b('0x2e')]['fields']));_0x7ff0c['attributes']=_0x7ff0c[_0x316b('0x31')][_0x316b('0x43')]?_0x7ff0c['attributes']:_0x455cbc['model'];if(_0x14a030['query'][_0x316b('0x3d')]){_0x7ff0c['include']=[{'all':!![]}];}_0x7ff0c=_[_0x316b('0x38')]({},_0x7ff0c,_0x14a030[_0x316b('0x3b')]);return db[_0x316b('0x27')][_0x316b('0x44')](_0x7ff0c)['then'](handleEntityNotFound(_0x16d318,null))[_0x316b('0x21')](respondWithResult(_0x16d318,null))[_0x316b('0x40')](handleError(_0x16d318,null));};exports[_0x316b('0x45')]=function(_0x4911b2,_0x5b2dfd){return db[_0x316b('0x27')][_0x316b('0x45')](_0x4911b2['body'],{})[_0x316b('0x21')](respondWithResult(_0x5b2dfd,0xc9))['catch'](handleError(_0x5b2dfd,null));};exports[_0x316b('0x20')]=function(_0x2b3cd4,_0x5d6757){if(_0x2b3cd4['body']['id']){delete _0x2b3cd4[_0x316b('0x46')]['id'];}delete _0x2b3cd4[_0x316b('0x46')][_0x316b('0x47')];delete _0x2b3cd4['body'][_0x316b('0x48')];delete _0x2b3cd4['body'][_0x316b('0x49')];delete _0x2b3cd4[_0x316b('0x46')]['value'];return db[_0x316b('0x27')]['find']({'where':{'id':_0x2b3cd4[_0x316b('0x4a')]['id']}})[_0x316b('0x21')](handleEntityNotFound(_0x5d6757,null))[_0x316b('0x21')](saveUpdates(_0x2b3cd4['body'],null))['then'](respondWithResult(_0x5d6757,null))[_0x316b('0x40')](handleError(_0x5d6757,null));};exports[_0x316b('0x4b')]=function(_0x1d9d4b,_0x573b93){return db[_0x316b('0x27')][_0x316b('0x4b')]()[_0x316b('0x21')](respondWithResult(_0x573b93,null))[_0x316b('0x40')](handleError(_0x573b93,null));};exports[_0x316b('0x4c')]=function(_0xf4b139,_0x2df707,_0xc6a786){var _0x4f5a2f=require(_0x316b('0x4d'));var _0x50e811=![];var _0xbff6e2={};if(_0xf4b139[_0x316b('0x2e')][_0x316b('0x29')]&&_0xf4b139['query'][_0x316b('0x29')]==='uniqueid'){_0xbff6e2[_0x316b('0x4e')]=_0xf4b139[_0x316b('0x4a')]['id'];}else{_0xbff6e2['id']=_0xf4b139[_0x316b('0x4a')]['id'];}return db[_0x316b('0x27')][_0x316b('0x44')]({'where':_0xbff6e2,'attributes':['id',_0x316b('0x4f')],'raw':!![]})[_0x316b('0x21')](handleEntityNotFound(_0x2df707,null))[_0x316b('0x21')](function(_0x1fa184){if(_0x1fa184){var _0x589cc8=path['join'](config[_0x316b('0x50')],'server/files/screen_recordings',_0x1fa184[_0x316b('0x4f')]);var _0x2b6ed8=util[_0x316b('0x2d')]('%s.cypher',_0x589cc8);if(fs[_0x316b('0x51')](_0x2b6ed8)){_0x50e811=!![];return _0x4f5a2f[_0x316b('0x52')](_0x2b6ed8,_0x589cc8,config[_0x316b('0x53')][_0x316b('0x54')])[_0x316b('0x21')](function(){return _0x1fa184;});}return _0x1fa184;}})[_0x316b('0x21')](function(_0x492e72){if(_0x492e72){var _0x1f8099=path[_0x316b('0x55')](config['root'],_0x316b('0x56'),_0x492e72[_0x316b('0x4f')]);if(!fs[_0x316b('0x51')](_0x1f8099)){throw new db[(_0x316b('0x57'))][(_0x316b('0x58'))](_0x316b('0x59'));}if(_0x492e72[_0x316b('0x5a')]){return _0x2df707[_0x316b('0x4c')](_0x1f8099,_0x492e72['filename']+path[_0x316b('0x5b')](_0x1f8099),function(){if(_0x50e811){fs[_0x316b('0x5c')](_0x1f8099);}});}else{return _0x2df707['download'](_0x1f8099,function(_0x4ce679){if(_0x50e811){fs[_0x316b('0x5c')](_0x1f8099);}});}}})['catch'](function(_0x4d36a5){if(_0x4d36a5[_0x316b('0x5d')]===_0x316b('0x59')){_0x2df707['status'](0x194)[_0x316b('0x5e')](_0x316b('0x5f'));}else{return handleError(_0x2df707,null);}});};exports[_0x316b('0x60')]=function(_0x39066d,_0xf0cd91){return db[_0x316b('0x27')]['find']({'where':{'id':_0x39066d[_0x316b('0x4a')]['id']}})[_0x316b('0x21')](function(_0x382d14){if(!_0x382d14)throw new ReferenceError(_0x316b('0x61'));return _0x382d14;})[_0x316b('0x21')](function(_0x344581){var _0x5a0b65=path[_0x316b('0x55')](config[_0x316b('0x50')],_0x316b('0x56'),_0x344581[_0x316b('0x4f')]);logger[_0x316b('0x62')]('cancellazione\x20fisica\x20documento\x20%s',_0x5a0b65);if(!_[_0x316b('0x63')](_0x344581[_0x316b('0x4f')])&&fs[_0x316b('0x51')](_0x5a0b65)){logger[_0x316b('0x62')](_0x316b('0x64')+_0x5a0b65+_0x316b('0x65'));fs[_0x316b('0x66')](_0x5a0b65);}_0x5a0b65=_0x5a0b65+_0x316b('0x67');if(!_[_0x316b('0x63')](_0x344581['value'])&&fs['existsSync'](_0x5a0b65)){logger[_0x316b('0x62')](_0x316b('0x64')+_0x5a0b65+_0x316b('0x65'));fs['unlinkSync'](_0x5a0b65);}return _0x344581;})[_0x316b('0x21')](function(_0x1cd610){if(!_0x1cd610)throw new InternalError();return _0x1cd610[_0x316b('0x60')]();})[_0x316b('0x21')](function(){_0xf0cd91[_0x316b('0x17')](0xcc)[_0x316b('0x18')]();})['catch'](handleError(_0xf0cd91,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 265c61c..eddbc65 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 _0xa05c=['define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','request-promise','path','./screenRecording.attributes','exports'];(function(_0x8aa883,_0x505c3d){var _0x2d6f90=function(_0x1e29bb){while(--_0x1e29bb){_0x8aa883['push'](_0x8aa883['shift']());}};_0x2d6f90(++_0x505c3d);}(_0xa05c,0x197));var _0xca05=function(_0x27511b,_0x579019){_0x27511b=_0x27511b-0x0;var _0x5065e3=_0xa05c[_0x27511b];return _0x5065e3;};'use strict';var _=require(_0xca05('0x0'));var util=require(_0xca05('0x1'));var logger=require(_0xca05('0x2'))(_0xca05('0x3'));var moment=require(_0xca05('0x4'));var BPromise=require('bluebird');var rp=require(_0xca05('0x5'));var fs=require('fs');var path=require(_0xca05('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xca05('0x7'));module[_0xca05('0x8')]=function(_0x3bbf53,_0x2be545){return _0x3bbf53[_0xca05('0x9')](_0xca05('0xa'),attributes,{'tableName':_0xca05('0xb'),'paranoid':![],'indexes':[{'name':_0xca05('0xc'),'fields':[_0xca05('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x67d8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api'];(function(_0x18c6f6,_0x53144a){var _0x28f019=function(_0x191b87){while(--_0x191b87){_0x18c6f6['push'](_0x18c6f6['shift']());}};_0x28f019(++_0x53144a);}(_0x67d8,0x11c));var _0x867d=function(_0x3b0e5c,_0x2a7eeb){_0x3b0e5c=_0x3b0e5c-0x0;var _0x128da7=_0x67d8[_0x3b0e5c];return _0x128da7;};'use strict';var _=require(_0x867d('0x0'));var util=require(_0x867d('0x1'));var logger=require(_0x867d('0x2'))(_0x867d('0x3'));var moment=require(_0x867d('0x4'));var BPromise=require(_0x867d('0x5'));var rp=require(_0x867d('0x6'));var fs=require('fs');var path=require(_0x867d('0x7'));var rimraf=require(_0x867d('0x8'));var config=require(_0x867d('0x9'));var attributes=require(_0x867d('0xa'));module[_0x867d('0xb')]=function(_0x5abe69,_0x235926){return _0x5abe69[_0x867d('0xc')](_0x867d('0xd'),attributes,{'tableName':_0x867d('0xe'),'paranoid':![],'indexes':[{'name':_0x867d('0xf'),'fields':[_0x867d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index d5cdcf6..2cbd95b 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(_0x314091,_0x2a91c4){var _0x390dc4=function(_0x34bf7b){while(--_0x34bf7b){_0x314091['push'](_0x314091['shift']());}};_0x390dc4(++_0x2a91c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_0x3255cc,_0x164f3f){var _0xc33c11=function(_0x3ddc95){while(--_0x3ddc95){_0x3255cc['push'](_0x3255cc['shift']());}};_0xc33c11(++_0x164f3f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 687c2d7..a4d3749 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 _0x02a1=['favicon','addFavicon','put','isAuthenticated','update','exports','multer','util','path','./setting.controller','get','index','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','server/files/images/logos/','format','%s%s','extname','originalname','post','single','file','join','root','logologin','preferred','addPreferred'];(function(_0x230e39,_0x5341){var _0xa804e=function(_0xe14796){while(--_0xe14796){_0x230e39['push'](_0x230e39['shift']());}};_0xa804e(++_0x5341);}(_0x02a1,0x109));var _0x102a=function(_0x429fde,_0x2752c1){_0x429fde=_0x429fde-0x0;var _0x5951fb=_0x02a1[_0x429fde];return _0x5951fb;};'use strict';var multer=require(_0x102a('0x0'));var util=require(_0x102a('0x1'));var path=require(_0x102a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x102a('0x3'));router[_0x102a('0x4')]('/',auth['isAuthenticated'](),controller[_0x102a('0x5')]);router['get'](_0x102a('0x6'),controller[_0x102a('0x7')]);router[_0x102a('0x4')]('/:id/logo',controller[_0x102a('0x8')]);router[_0x102a('0x4')](_0x102a('0x9'),controller[_0x102a('0xa')]);router[_0x102a('0x4')](_0x102a('0xb'),controller[_0x102a('0xc')]);router['get'](_0x102a('0xd'),controller[_0x102a('0xe')]);router[_0x102a('0x4')](_0x102a('0xf'),controller[_0x102a('0x10')]);var upload=multer({'storage':multer[_0x102a('0x11')]({'destination':function(_0x49c49c,_0x35df59,_0x4d1344){_0x4d1344(null,path['join'](config['root'],_0x102a('0x12')));},'filename':function(_0x549edf,_0x44f53f,_0x1f15cf){_0x1f15cf(null,util[_0x102a('0x13')](_0x102a('0x14'),'logo',path[_0x102a('0x15')](_0x44f53f[_0x102a('0x16')])));}})});router[_0x102a('0x17')]('/:id/logo',upload[_0x102a('0x18')](_0x102a('0x19')),controller['addLogo']);var upload=multer({'storage':multer[_0x102a('0x11')]({'destination':function(_0x162221,_0x33ac21,_0x16cc0e){_0x16cc0e(null,path[_0x102a('0x1a')](config[_0x102a('0x1b')],_0x102a('0x12')));},'filename':function(_0x18be01,_0xb49495,_0x47b9ef){_0x47b9ef(null,util[_0x102a('0x13')](_0x102a('0x14'),_0x102a('0x1c'),path['extname'](_0xb49495['originalname'])));}})});router[_0x102a('0x17')](_0x102a('0x9'),upload['single'](_0x102a('0x19')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x217def,_0x259e4b,_0x2705b2){_0x2705b2(null,path[_0x102a('0x1a')](config[_0x102a('0x1b')],_0x102a('0x12')));},'filename':function(_0x193746,_0x2c9bb6,_0xd8a77){_0xd8a77(null,util[_0x102a('0x13')](_0x102a('0x14'),_0x102a('0x1d'),path[_0x102a('0x15')](_0x2c9bb6[_0x102a('0x16')])));}})});router['post'](_0x102a('0xd'),upload[_0x102a('0x18')]('file'),controller[_0x102a('0x1e')]);var upload=multer({'storage':multer[_0x102a('0x11')]({'destination':function(_0x4bc5b6,_0x2ad965,_0x4663b0){_0x4663b0(null,path[_0x102a('0x1a')](config[_0x102a('0x1b')],_0x102a('0x12')));},'filename':function(_0x203f7f,_0x19a71b,_0x59c218){_0x59c218(null,util[_0x102a('0x13')](_0x102a('0x14'),_0x102a('0x1f'),path[_0x102a('0x15')](_0x19a71b[_0x102a('0x16')])));}})});router['post'](_0x102a('0xf'),upload['single'](_0x102a('0x19')),controller[_0x102a('0x20')]);router[_0x102a('0x21')](_0x102a('0x6'),auth[_0x102a('0x22')](),controller[_0x102a('0x23')]);module[_0x102a('0x24')]=router; \ No newline at end of file +var _0x6033=['/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','post','addLogo','format','logologin','extname','originalname','single','addLogoLogin','%s%s','addPreferred','addFavicon','put','/:id','update','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x6033,0x1e9));var _0x3603=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6033[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3603('0x0'));var timeout=require(_0x3603('0x1'));var express=require(_0x3603('0x2'));var router=express[_0x3603('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3603('0x4'));var config=require(_0x3603('0x5'));var controller=require(_0x3603('0x6'));router[_0x3603('0x7')]('/',auth[_0x3603('0x8')](),controller[_0x3603('0x9')]);router[_0x3603('0x7')]('/:id',controller['show']);router['get'](_0x3603('0xa'),controller[_0x3603('0xb')]);router[_0x3603('0x7')](_0x3603('0xc'),controller[_0x3603('0xd')]);router[_0x3603('0x7')](_0x3603('0xe'),controller[_0x3603('0xf')]);router[_0x3603('0x7')](_0x3603('0x10'),controller[_0x3603('0x11')]);router[_0x3603('0x7')](_0x3603('0x12'),controller[_0x3603('0x13')]);var upload=multer({'storage':multer[_0x3603('0x14')]({'destination':function(_0x4bee49,_0x346730,_0x5e610f){_0x5e610f(null,path[_0x3603('0x15')](config[_0x3603('0x16')],_0x3603('0x17')));},'filename':function(_0x159ec9,_0x4e4579,_0x5727a0){_0x5727a0(null,util['format']('%s%s','logo',path['extname'](_0x4e4579['originalname'])));}})});router[_0x3603('0x18')]('/:id/logo',upload['single']('file'),controller[_0x3603('0x19')]);var upload=multer({'storage':multer[_0x3603('0x14')]({'destination':function(_0x372fb7,_0x58bfe0,_0x446c0a){_0x446c0a(null,path[_0x3603('0x15')](config['root'],_0x3603('0x17')));},'filename':function(_0x150690,_0x3400c2,_0x477c7d){_0x477c7d(null,util[_0x3603('0x1a')]('%s%s',_0x3603('0x1b'),path[_0x3603('0x1c')](_0x3400c2[_0x3603('0x1d')])));}})});router[_0x3603('0x18')]('/:id/logo_login',upload[_0x3603('0x1e')]('file'),controller[_0x3603('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3a72cc,_0x3e2450,_0x1cf24a){_0x1cf24a(null,path['join'](config['root'],_0x3603('0x17')));},'filename':function(_0x18c17b,_0x1a6cc9,_0x3786be){_0x3786be(null,util['format'](_0x3603('0x20'),'preferred',path[_0x3603('0x1c')](_0x1a6cc9[_0x3603('0x1d')])));}})});router[_0x3603('0x18')](_0x3603('0x10'),upload[_0x3603('0x1e')]('file'),controller[_0x3603('0x21')]);var upload=multer({'storage':multer[_0x3603('0x14')]({'destination':function(_0x303561,_0x30f441,_0x16bc4b){_0x16bc4b(null,path[_0x3603('0x15')](config['root'],_0x3603('0x17')));},'filename':function(_0x33c369,_0x5f40f2,_0x30eef6){_0x30eef6(null,util['format']('%s%s','favicon',path[_0x3603('0x1c')](_0x5f40f2[_0x3603('0x1d')])));}})});router[_0x3603('0x18')](_0x3603('0x12'),upload[_0x3603('0x1e')]('file'),controller[_0x3603('0x22')]);router[_0x3603('0x23')](_0x3603('0x24'),auth[_0x3603('0x8')](),controller[_0x3603('0x25')]);module[_0x3603('0x26')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index d7eed5f..0b0f6b7 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 _0x8900=['sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate'];(function(_0x3248c0,_0x685790){var _0x37136b=function(_0x34cd33){while(--_0x34cd33){_0x3248c0['push'](_0x3248c0['shift']());}};_0x37136b(++_0x685790);}(_0x8900,0x87));var _0x0890=function(_0x262e24,_0x5108a4){_0x262e24=_0x262e24-0x0;var _0x1ee2d0=_0x8900[_0x262e24];return _0x1ee2d0;};'use strict';var Sequelize=require(_0x0890('0x0'));module[_0x0890('0x1')]={'min_internal':{'type':Sequelize[_0x0890('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x0890('0x2')](0xb),'unique':_0x0890('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x0890('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0890('0x4')],'defaultValue':_0x0890('0x5')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x0890('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0890('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x0890('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0890('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0890('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0890('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x0890('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x0890('0x4')]},'turnaddr':{'type':Sequelize[_0x0890('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x0890('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0890('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0890('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0890('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0890('0x4')],'defaultValue':_0x0890('0x7')},'enableEmailPreview':{'type':Sequelize[_0x0890('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x0890('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x0890('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0890('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0890('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0890('0x4')],'defaultValue':_0x0890('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0890('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0890('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0890('0x4')]},'defaultFavicon':{'type':Sequelize[_0x0890('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0890('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0890('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x0890('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x0890('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x0890('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0890('0x2')]},'sentimentRegion':{'type':Sequelize[_0x0890('0x4')]},'language':{'type':Sequelize[_0x0890('0x4')]},'bucket':{'type':Sequelize[_0x0890('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0890('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0890('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0890('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}}}; \ No newline at end of file +var _0x44c2=['STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x44c2,0x100));var _0x244c=function(_0x4f3c9b,_0x28e078){_0x4f3c9b=_0x4f3c9b-0x0;var _0x84e58a=_0x44c2[_0x4f3c9b];return _0x84e58a;};'use strict';var Sequelize=require(_0x244c('0x0'));module[_0x244c('0x1')]={'min_internal':{'type':Sequelize[_0x244c('0x2')](0xb),'unique':_0x244c('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x244c('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x244c('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x244c('0x5')],'defaultValue':_0x244c('0x6')},'logo':{'type':Sequelize[_0x244c('0x5')]},'defaultLogo':{'type':Sequelize[_0x244c('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x244c('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x244c('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x244c('0x5')]},'turnusername':{'type':Sequelize[_0x244c('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x244c('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x244c('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x244c('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x244c('0x7')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x244c('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x244c('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x244c('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x244c('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x244c('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x244c('0x5')]},'defaultPreferred':{'type':Sequelize[_0x244c('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x244c('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x244c('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x244c('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x244c('0x5')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x244c('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x244c('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x244c('0x2')]},'transcribeRegion':{'type':Sequelize[_0x244c('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x244c('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x244c('0x2')]},'sentimentRegion':{'type':Sequelize[_0x244c('0x5')]},'language':{'type':Sequelize[_0x244c('0x5')]},'bucket':{'type':Sequelize[_0x244c('0x5')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x244c('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x244c('0x2')](0x2)[_0x244c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 27344d3..55220a6 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 _0x123f=['filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','Setting','includeAll','findAll','rows','filtears','intersection','include','find','body','addLogo','file','filename','logo','params','addLogoLogin','loginLogo','getLogo','server/files/images/logos','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','getLicense','preferred','defaultFavicon','default_loginLogo.svg','ValidationError','gdpr','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','update','destroy','end','stack','name','index','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x594210,_0x5706cc){var _0x5cb33e=function(_0x36d409){while(--_0x36d409){_0x594210['push'](_0x594210['shift']());}};_0x5cb33e(++_0x5706cc);}(_0x123f,0x126));var _0xf123=function(_0x337a10,_0x5191c7){_0x337a10=_0x337a10-0x0;var _0x575f98=_0x123f[_0x337a10];return _0x575f98;};'use strict';var pdf=require(_0xf123('0x0'));var emlformat=require(_0xf123('0x1'));var rimraf=require(_0xf123('0x2'));var zipdir=require(_0xf123('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf123('0x4'));var moment=require(_0xf123('0x5'));var BPromise=require(_0xf123('0x6'));var Mustache=require(_0xf123('0x7'));var util=require(_0xf123('0x8'));var path=require(_0xf123('0x9'));var sox=require('sox');var csv=require(_0xf123('0xa'));var ejs=require(_0xf123('0xb'));var fs=require('fs');var _=require(_0xf123('0xc'));var squel=require('squel');var crypto=require(_0xf123('0xd'));var jsforce=require(_0xf123('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf123('0xf'));var Papa=require(_0xf123('0x10'));var Redis=require(_0xf123('0x11'));var authService=require(_0xf123('0x12'));var qs=require(_0xf123('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf123('0x14'));var logger=require(_0xf123('0x15'))('api');var utils=require(_0xf123('0x16'));var config=require(_0xf123('0x17'));var licenseUtil=require(_0xf123('0x18'));var db=require(_0xf123('0x19'))['db'];var jayson=require(_0xf123('0x1a'));var client=jayson[_0xf123('0x1b')][_0xf123('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3f6483,_0x18aa2d,_0x18cc77,_0x5d3547){return new BPromise(function(_0x2e4cdf,_0x2b4f28){var _0x12373a=_0x5d3547||client;return _0x12373a['request'](_0x3f6483,_0x18cc77)[_0xf123('0x1d')](function(_0xa3aa0a){logger[_0xf123('0x1e')](_0xf123('0x1f'),_0x18aa2d,'request\x20sent');logger[_0xf123('0x20')](_0xf123('0x21'),_0x18aa2d,_0xf123('0x22'),JSON[_0xf123('0x23')](_0xa3aa0a));if(_0xa3aa0a[_0xf123('0x24')]){if(_0xa3aa0a['error'][_0xf123('0x25')]===0x1f4){logger[_0xf123('0x24')](_0xf123('0x1f'),_0x18aa2d,_0xa3aa0a[_0xf123('0x24')][_0xf123('0x26')]);return _0x2b4f28(_0xa3aa0a[_0xf123('0x24')][_0xf123('0x26')]);}logger[_0xf123('0x24')](_0xf123('0x1f'),_0x18aa2d,_0xa3aa0a['error'][_0xf123('0x26')]);return _0x2e4cdf(_0xa3aa0a['error'][_0xf123('0x26')]);}else{logger[_0xf123('0x1e')](_0xf123('0x1f'),_0x18aa2d,_0xf123('0x22'));_0x2e4cdf(_0xa3aa0a[_0xf123('0x27')][_0xf123('0x26')]);}})[_0xf123('0x28')](function(_0x8c41d6){logger['error'](_0xf123('0x1f'),_0x18aa2d,_0x8c41d6);_0x2b4f28(_0x8c41d6);});});}function respondWithStatusCode(_0x17476d,_0x2eaf04){_0x2eaf04=_0x2eaf04||0xcc;return function(_0x16ca1c){if(_0x16ca1c){return _0x17476d[_0xf123('0x29')](_0x2eaf04);}return _0x17476d[_0xf123('0x2a')](_0x2eaf04)['end']();};}function respondWithResult(_0x411659,_0xb0bafc){_0xb0bafc=_0xb0bafc||0xc8;return function(_0x38da01){if(_0x38da01){return _0x411659[_0xf123('0x2a')](_0xb0bafc)[_0xf123('0x2b')](_0x38da01);}};}function respondWithFilteredResult(_0x5aa1da,_0x1b0250){return function(_0x5e1dd7){if(_0x5e1dd7){var _0x5121b9=_0x5e1dd7[_0xf123('0x2c')],_0x1ca663=_0x1b0250[_0xf123('0x2d')],_0x176f16=_0x1b0250[_0xf123('0x2d')]+_0x1b0250[_0xf123('0x2e')],_0x4b3b13;if(_0x176f16>=_0x5121b9){_0x176f16=_0x5121b9;_0x4b3b13=0xc8;}else{_0x4b3b13=0xce;}_0x5aa1da['status'](_0x4b3b13);return _0x5aa1da['set'](_0xf123('0x2f'),_0x1ca663+'-'+_0x176f16+'/'+_0x5121b9)[_0xf123('0x2b')](_0x5e1dd7);}return null;};}function patchUpdates(_0x50716c){return function(_0x36b0cf){try{jsonpatch[_0xf123('0x30')](_0x36b0cf,_0x50716c,!![]);}catch(_0x1fd6a4){return BPromise['reject'](_0x1fd6a4);}return _0x36b0cf[_0xf123('0x31')]();};}function saveUpdates(_0x42fd69,_0x3833a5){return function(_0x15324d){if(_0x15324d){return _0x15324d[_0xf123('0x32')](_0x42fd69)['then'](function(_0x5ac942){return _0x5ac942;});}return null;};}function removeEntity(_0x3414c6,_0x4450f6){return function(_0x2ee502){if(_0x2ee502){return _0x2ee502[_0xf123('0x33')]()[_0xf123('0x1d')](function(){_0x3414c6[_0xf123('0x2a')](0xcc)[_0xf123('0x34')]();});}};}function handleEntityNotFound(_0x402bb7,_0x197bf9){return function(_0xc87dcb){if(!_0xc87dcb){_0x402bb7['sendStatus'](0x194);}return _0xc87dcb;};}function handleError(_0x20d764,_0x3454eb){_0x3454eb=_0x3454eb||0x1f4;return function(_0x31c19f){logger[_0xf123('0x24')](_0x31c19f[_0xf123('0x35')]);if(_0x31c19f[_0xf123('0x36')]){delete _0x31c19f['name'];}_0x20d764[_0xf123('0x2a')](_0x3454eb)['send'](_0x31c19f);};}exports[_0xf123('0x37')]=function(_0x44f696,_0x59fb80){var _0x8d97d3={},_0x2dfd2d={},_0x34cc85={'count':0x0,'rows':[]};var _0x2ced4a=_[_0xf123('0x38')](db['Setting'][_0xf123('0x39')],function(_0x21f10d){return{'name':_0x21f10d[_0xf123('0x3a')],'type':_0x21f10d[_0xf123('0x3b')][_0xf123('0x3c')]};});_0x2dfd2d[_0xf123('0x3d')]=_[_0xf123('0x38')](_0x2ced4a,_0xf123('0x36'));_0x2dfd2d[_0xf123('0x3e')]=_['keys'](_0x44f696[_0xf123('0x3e')]);_0x2dfd2d[_0xf123('0x3f')]=_['intersection'](_0x2dfd2d['model'],_0x2dfd2d['query']);_0x8d97d3['attributes']=_['intersection'](_0x2dfd2d[_0xf123('0x3d')],qs[_0xf123('0x40')](_0x44f696[_0xf123('0x3e')][_0xf123('0x40')]));_0x8d97d3['attributes']=_0x8d97d3[_0xf123('0x41')]['length']?_0x8d97d3[_0xf123('0x41')]:_0x2dfd2d[_0xf123('0x3d')];if(!_0x44f696[_0xf123('0x3e')][_0xf123('0x42')](_0xf123('0x43'))){_0x8d97d3[_0xf123('0x2e')]=qs[_0xf123('0x2e')](_0x44f696[_0xf123('0x3e')][_0xf123('0x2e')]);_0x8d97d3[_0xf123('0x2d')]=qs[_0xf123('0x2d')](_0x44f696[_0xf123('0x3e')][_0xf123('0x2d')]);}_0x8d97d3[_0xf123('0x44')]=qs['sort'](_0x44f696[_0xf123('0x3e')][_0xf123('0x45')]);_0x8d97d3[_0xf123('0x46')]=qs[_0xf123('0x3f')](_['pick'](_0x44f696[_0xf123('0x3e')],_0x2dfd2d[_0xf123('0x3f')]),_0x2ced4a);if(_0x44f696[_0xf123('0x3e')]['filter']){_0x8d97d3[_0xf123('0x46')]=_[_0xf123('0x47')](_0x8d97d3[_0xf123('0x46')],{'$or':_[_0xf123('0x38')](_0x2ced4a,function(_0xa258c8){if(_0xa258c8[_0xf123('0x3b')]!==_0xf123('0x48')){var _0x477881={};_0x477881[_0xa258c8['name']]={'$like':'%'+_0x44f696[_0xf123('0x3e')][_0xf123('0x49')]+'%'};return _0x477881;}})});}_0x8d97d3=_[_0xf123('0x47')]({},_0x8d97d3,_0x44f696[_0xf123('0x4a')]);var _0x9883dc={'where':_0x8d97d3['where']};return db[_0xf123('0x4b')][_0xf123('0x2c')](_0x9883dc)[_0xf123('0x1d')](function(_0x1120e8){_0x34cc85[_0xf123('0x2c')]=_0x1120e8;if(_0x44f696[_0xf123('0x3e')][_0xf123('0x4c')]){_0x8d97d3['include']=[{'all':!![]}];}return db['Setting'][_0xf123('0x4d')](_0x8d97d3);})[_0xf123('0x1d')](function(_0x25efbb){_0x34cc85[_0xf123('0x4e')]=_0x25efbb;return _0x34cc85;})['then'](respondWithFilteredResult(_0x59fb80,_0x8d97d3))[_0xf123('0x28')](handleError(_0x59fb80,null));};exports['show']=function(_0x2101d8,_0x1852e3){var _0x5c899a={'raw':![],'where':{'id':_0x2101d8['params']['id']}},_0x40acb8={};_0x40acb8[_0xf123('0x3d')]=_['keys'](db[_0xf123('0x4b')][_0xf123('0x39')]);_0x40acb8['query']=_['keys'](_0x2101d8[_0xf123('0x3e')]);_0x40acb8[_0xf123('0x4f')]=_[_0xf123('0x50')](_0x40acb8[_0xf123('0x3d')],_0x40acb8[_0xf123('0x3e')]);_0x5c899a[_0xf123('0x41')]=_[_0xf123('0x50')](_0x40acb8[_0xf123('0x3d')],qs[_0xf123('0x40')](_0x2101d8[_0xf123('0x3e')][_0xf123('0x40')]));_0x5c899a[_0xf123('0x41')]=_0x5c899a[_0xf123('0x41')]['length']?_0x5c899a[_0xf123('0x41')]:_0x40acb8[_0xf123('0x3d')];if(_0x2101d8['query'][_0xf123('0x4c')]){_0x5c899a[_0xf123('0x51')]=[{'all':!![]}];}_0x5c899a=_[_0xf123('0x47')]({},_0x5c899a,_0x2101d8[_0xf123('0x4a')]);return db[_0xf123('0x4b')][_0xf123('0x52')](_0x5c899a)[_0xf123('0x1d')](handleEntityNotFound(_0x1852e3,null))[_0xf123('0x1d')](respondWithResult(_0x1852e3,null))[_0xf123('0x28')](handleError(_0x1852e3,null));};exports[_0xf123('0x32')]=function(_0x3efdf6,_0x37a431){if(_0x3efdf6[_0xf123('0x53')]['id']){delete _0x3efdf6[_0xf123('0x53')]['id'];}return db[_0xf123('0x4b')]['find']({'where':{'id':_0x3efdf6['params']['id']}})[_0xf123('0x1d')](handleEntityNotFound(_0x37a431,null))[_0xf123('0x1d')](saveUpdates(_0x3efdf6['body'],null))['then'](respondWithResult(_0x37a431,null))[_0xf123('0x28')](handleError(_0x37a431,null));};exports[_0xf123('0x54')]=function(_0x2fe7f3,_0x4e19d3,_0x3b51ee){if(_0x2fe7f3[_0xf123('0x55')]&&_0x2fe7f3[_0xf123('0x55')][_0xf123('0x56')]){_0x2fe7f3['body'][_0xf123('0x57')]=_0x2fe7f3[_0xf123('0x55')][_0xf123('0x56')];}return db[_0xf123('0x4b')]['find']({'where':{'id':_0x2fe7f3[_0xf123('0x58')]['id']}})[_0xf123('0x1d')](handleEntityNotFound(_0x4e19d3,null))[_0xf123('0x1d')](saveUpdates(_0x2fe7f3[_0xf123('0x53')],null))[_0xf123('0x1d')](respondWithResult(_0x4e19d3,null))[_0xf123('0x28')](handleError(_0x4e19d3,null));};exports[_0xf123('0x59')]=function(_0x55ae27,_0x428a03,_0x3eec82){if(_0x55ae27[_0xf123('0x55')]&&_0x55ae27[_0xf123('0x55')][_0xf123('0x56')]){_0x55ae27[_0xf123('0x53')][_0xf123('0x5a')]=_0x55ae27[_0xf123('0x55')][_0xf123('0x56')];}return db[_0xf123('0x4b')][_0xf123('0x52')]({'where':{'id':_0x55ae27[_0xf123('0x58')]['id']}})[_0xf123('0x1d')](handleEntityNotFound(_0x428a03,null))[_0xf123('0x1d')](saveUpdates(_0x55ae27[_0xf123('0x53')],null))[_0xf123('0x1d')](respondWithResult(_0x428a03,null))[_0xf123('0x28')](handleError(_0x428a03,null));};var utilLicense=require('../../config/license/util');exports[_0xf123('0x5b')]=function(_0x1d6bf9,_0x5c7fe6,_0x49d5ca){var _0x3d3b23=_0xf123('0x5c');var _0x2d6e19={'custom':![]};return utilLicense['getLicense']()['then'](function(_0xa76e12){if(_0xa76e12){_0x2d6e19=_0xa76e12;}return db[_0xf123('0x4b')][_0xf123('0x52')]({'where':{'id':_0x1d6bf9[_0xf123('0x58')]['id']},'attributes':[_0xf123('0x57'),_0xf123('0x5a'),'preferred',_0xf123('0x5d'),_0xf123('0x5e'),_0xf123('0x5f'),_0xf123('0x60'),'defaultFavicon'],'raw':!![]});})[_0xf123('0x1d')](handleEntityNotFound(_0x5c7fe6,null))[_0xf123('0x1d')](function(_0x5ae389){if(_0x5ae389){var _0x3f4c66=_0x5ae389[_0xf123('0x57')]&&fs[_0xf123('0x61')](path[_0xf123('0x62')](config['root'],_0x3d3b23,_['toLower'](_0x5ae389['logo'])))?path['join'](config['root'],_0x3d3b23,_[_0xf123('0x63')](_0x5ae389[_0xf123('0x57')])):path[_0xf123('0x62')](config[_0xf123('0x64')],_0x3d3b23,_[_0xf123('0x63')](_0xf123('0x65')));var _0x15f3b4=_0xf123('0x66')+_[_0xf123('0x67')]('logo');if(_0x5ae389[_0x15f3b4]||!_0x2d6e19[_0xf123('0x68')]){_0x3f4c66=path[_0xf123('0x62')](config[_0xf123('0x64')],_0x3d3b23,_[_0xf123('0x63')]('default_logo.svg'));}if(!fs['existsSync'](_0x3f4c66)){throw new db[(_0xf123('0x69'))]['ValidationError'](_[_0xf123('0x67')](_0xf123('0x57'))+_0xf123('0x6a'));}return _0x5c7fe6[_0xf123('0x6b')](_0x3f4c66);}})[_0xf123('0x28')](handleError(_0x5c7fe6,null));};var utilLicense=require('../../config/license/util');exports[_0xf123('0x6c')]=function(_0x186354,_0x1b190e,_0x1e13aa){var _0x47b394='server/files/images/logos';var _0x5cef58={'custom':![]};return utilLicense[_0xf123('0x6d')]()[_0xf123('0x1d')](function(_0x2c6b6d){if(_0x2c6b6d){_0x5cef58=_0x2c6b6d;}return db[_0xf123('0x4b')][_0xf123('0x52')]({'where':{'id':_0x186354[_0xf123('0x58')]['id']},'attributes':[_0xf123('0x57'),_0xf123('0x5a'),_0xf123('0x6e'),_0xf123('0x5d'),_0xf123('0x5e'),_0xf123('0x5f'),_0xf123('0x60'),_0xf123('0x6f')],'raw':!![]});})['then'](handleEntityNotFound(_0x1b190e,null))[_0xf123('0x1d')](function(_0x564a92){if(_0x564a92){var _0x283908=_0x564a92[_0xf123('0x5a')]&&fs[_0xf123('0x61')](path[_0xf123('0x62')](config[_0xf123('0x64')],_0x47b394,_[_0xf123('0x63')](_0x564a92[_0xf123('0x5a')])))?path['join'](config[_0xf123('0x64')],_0x47b394,_[_0xf123('0x63')](_0x564a92['loginLogo'])):path[_0xf123('0x62')](config[_0xf123('0x64')],_0x47b394,_[_0xf123('0x63')]('default_loginLogo.svg'));var _0x1233d7=_0xf123('0x66')+_[_0xf123('0x67')]('loginLogo');if(_0x564a92[_0x1233d7]||!_0x5cef58[_0xf123('0x68')]){_0x283908=path[_0xf123('0x62')](config['root'],_0x47b394,_[_0xf123('0x63')](_0xf123('0x70')));}if(!fs[_0xf123('0x61')](_0x283908)){throw new db[(_0xf123('0x69'))][(_0xf123('0x71'))](_[_0xf123('0x67')]('loginLogo')+_0xf123('0x6a'));}return _0x1b190e[_0xf123('0x6b')](_0x283908);}})[_0xf123('0x28')](handleError(_0x1b190e,null));};exports[_0xf123('0x72')]=function(_0x5ea6a4,_0x108e5a){return db[_0xf123('0x4b')][_0xf123('0x52')]({'where':{'id':_0x5ea6a4[_0xf123('0x58')]['id']},'attributes':['securePassword']})[_0xf123('0x1d')](respondWithResult(_0x108e5a,null))[_0xf123('0x28')](handleError(_0x108e5a,null));};exports['addPreferred']=function(_0x161020,_0xaa8635,_0x47350e){if(_0x161020['file']&&_0x161020[_0xf123('0x55')][_0xf123('0x56')]){_0x161020[_0xf123('0x53')][_0xf123('0x6e')]=_0x161020[_0xf123('0x55')][_0xf123('0x56')];}return db[_0xf123('0x4b')]['find']({'where':{'id':_0x161020[_0xf123('0x58')]['id']}})[_0xf123('0x1d')](handleEntityNotFound(_0xaa8635,null))[_0xf123('0x1d')](saveUpdates(_0x161020[_0xf123('0x53')],null))['then'](respondWithResult(_0xaa8635,null))[_0xf123('0x28')](handleError(_0xaa8635,null));};var utilLicense=require(_0xf123('0x18'));exports['getPreferred']=function(_0x401217,_0x5b4d0f,_0x2f8179){var _0x5bd620=_0xf123('0x5c');var _0x5be2c1={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x45bbe7){if(_0x45bbe7){_0x5be2c1=_0x45bbe7;}return db[_0xf123('0x4b')][_0xf123('0x52')]({'where':{'id':_0x401217[_0xf123('0x58')]['id']},'attributes':[_0xf123('0x57'),_0xf123('0x5a'),_0xf123('0x6e'),_0xf123('0x5d'),'defaultLogo',_0xf123('0x5f'),'defaultPreferred',_0xf123('0x6f')],'raw':!![]});})[_0xf123('0x1d')](handleEntityNotFound(_0x5b4d0f,null))[_0xf123('0x1d')](function(_0x2d2bc1){if(_0x2d2bc1){var _0x58aba9=_0x2d2bc1[_0xf123('0x6e')]&&fs['existsSync'](path[_0xf123('0x62')](config[_0xf123('0x64')],_0x5bd620,_['toLower'](_0x2d2bc1[_0xf123('0x6e')])))?path[_0xf123('0x62')](config[_0xf123('0x64')],_0x5bd620,_[_0xf123('0x63')](_0x2d2bc1[_0xf123('0x6e')])):path[_0xf123('0x62')](config[_0xf123('0x64')],_0x5bd620,_['toLower'](_0xf123('0x73')));var _0x17dc47='default'+_['upperFirst'](_0xf123('0x6e'));if(_0x2d2bc1[_0x17dc47]||!_0x5be2c1[_0xf123('0x68')]||!_0x5be2c1[_0xf123('0x6e')]){_0x58aba9=path[_0xf123('0x62')](config['root'],_0x5bd620,_[_0xf123('0x63')]('default_preferred.png'));}if(!fs['existsSync'](_0x58aba9)){throw new db[(_0xf123('0x69'))][(_0xf123('0x71'))](_['upperFirst'](_0xf123('0x6e'))+'\x20not\x20found');}return _0x5b4d0f['download'](_0x58aba9);}})[_0xf123('0x28')](handleError(_0x5b4d0f,null));};exports[_0xf123('0x74')]=function(_0x1ab2ce,_0x2841ce,_0x38d26c){if(_0x1ab2ce[_0xf123('0x55')]&&_0x1ab2ce[_0xf123('0x55')][_0xf123('0x56')]){_0x1ab2ce[_0xf123('0x53')][_0xf123('0x5d')]=_0x1ab2ce[_0xf123('0x55')][_0xf123('0x56')];}return db[_0xf123('0x4b')][_0xf123('0x52')]({'where':{'id':_0x1ab2ce[_0xf123('0x58')]['id']}})['then'](handleEntityNotFound(_0x2841ce,null))[_0xf123('0x1d')](saveUpdates(_0x1ab2ce['body'],null))[_0xf123('0x1d')](respondWithResult(_0x2841ce,null))[_0xf123('0x28')](handleError(_0x2841ce,null));};var utilLicense=require(_0xf123('0x18'));exports[_0xf123('0x75')]=function(_0x5d802b,_0x3505cd,_0xde653c){var _0x57fdcd=_0xf123('0x5c');var _0x1fc120={'custom':![]};return utilLicense['getLicense']()[_0xf123('0x1d')](function(_0x2929aa){if(_0x2929aa){_0x1fc120=_0x2929aa;}return db['Setting'][_0xf123('0x52')]({'where':{'id':_0x5d802b[_0xf123('0x58')]['id']},'attributes':[_0xf123('0x57'),_0xf123('0x5a'),_0xf123('0x6e'),_0xf123('0x5d'),_0xf123('0x5e'),_0xf123('0x5f'),_0xf123('0x60'),'defaultFavicon'],'raw':!![]});})[_0xf123('0x1d')](handleEntityNotFound(_0x3505cd,null))[_0xf123('0x1d')](function(_0x3d2829){if(_0x3d2829){var _0x1abbfb=_0x3d2829[_0xf123('0x5d')]&&fs[_0xf123('0x61')](path[_0xf123('0x62')](config[_0xf123('0x64')],_0x57fdcd,_[_0xf123('0x63')](_0x3d2829[_0xf123('0x5d')])))?path[_0xf123('0x62')](config[_0xf123('0x64')],_0x57fdcd,_[_0xf123('0x63')](_0x3d2829[_0xf123('0x5d')])):path['join'](config[_0xf123('0x64')],_0x57fdcd,_[_0xf123('0x63')](_0xf123('0x76')));var _0xa7d92d=_0xf123('0x66')+_[_0xf123('0x67')]('favicon');if(_0x3d2829[_0xa7d92d]||!_0x1fc120[_0xf123('0x68')]){_0x1abbfb=path[_0xf123('0x62')](config['root'],_0x57fdcd,_[_0xf123('0x63')]('default_favicon.ico'));}if(!fs[_0xf123('0x61')](_0x1abbfb)){throw new db[(_0xf123('0x69'))][(_0xf123('0x71'))](_[_0xf123('0x67')](_0xf123('0x5d'))+_0xf123('0x6a'));}return _0x3505cd[_0xf123('0x6b')](_0x1abbfb);}})[_0xf123('0x28')](handleError(_0x3505cd,null));}; \ No newline at end of file +var _0xa226=['loginLogo','getLogo','server/files/images/logos','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','join','root','toLower','default_logo.svg','default','upperFirst','custom','existsSync','Sequelize','ValidationError','\x20not\x20found','download','getLicense','favicon','default_loginLogo.svg','gdpr','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','defaultFavicon','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','request\x20sent','stringify','error','message','Setting,\x20%s,\x20%s','result','catch','sendStatus','end','status','count','offset','limit','set','json','apply','update','stack','name','send','Setting','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','findAll','rows','filtears','length','find','body','addLogo','file','filename','logo','params'];(function(_0xeee6c7,_0x408226){var _0x35f402=function(_0x2b5bcc){while(--_0x2b5bcc){_0xeee6c7['push'](_0xeee6c7['shift']());}};_0x35f402(++_0x408226);}(_0xa226,0xf9));var _0x6a22=function(_0x2fbdb3,_0x35456a){_0x2fbdb3=_0x2fbdb3-0x0;var _0xb4ff1a=_0xa226[_0x2fbdb3];return _0xb4ff1a;};'use strict';var pdf=require(_0x6a22('0x0'));var emlformat=require(_0x6a22('0x1'));var rimraf=require(_0x6a22('0x2'));var zipdir=require(_0x6a22('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a22('0x4'));var moment=require(_0x6a22('0x5'));var BPromise=require(_0x6a22('0x6'));var Mustache=require(_0x6a22('0x7'));var util=require(_0x6a22('0x8'));var path=require(_0x6a22('0x9'));var sox=require(_0x6a22('0xa'));var csv=require(_0x6a22('0xb'));var ejs=require(_0x6a22('0xc'));var fs=require('fs');var _=require(_0x6a22('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6a22('0xe'));var Papa=require(_0x6a22('0xf'));var Redis=require(_0x6a22('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6a22('0x11'));var hardwareService=require(_0x6a22('0x12'));var logger=require(_0x6a22('0x13'))(_0x6a22('0x14'));var utils=require(_0x6a22('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6a22('0x16'));var db=require(_0x6a22('0x17'))['db'];var jayson=require(_0x6a22('0x18'));var client=jayson['client'][_0x6a22('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x427c01,_0x1dc999,_0x1f02a2,_0x42f00d){return new BPromise(function(_0x401c6f,_0x475cd0){var _0x1dd38e=_0x42f00d||client;return _0x1dd38e['request'](_0x427c01,_0x1f02a2)[_0x6a22('0x1a')](function(_0x436d11){logger[_0x6a22('0x1b')]('Setting,\x20%s,\x20%s',_0x1dc999,_0x6a22('0x1c'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x1dc999,'request\x20sent',JSON[_0x6a22('0x1d')](_0x436d11));if(_0x436d11[_0x6a22('0x1e')]){if(_0x436d11['error']['code']===0x1f4){logger[_0x6a22('0x1e')]('Setting,\x20%s,\x20%s',_0x1dc999,_0x436d11[_0x6a22('0x1e')]['message']);return _0x475cd0(_0x436d11['error'][_0x6a22('0x1f')]);}logger[_0x6a22('0x1e')](_0x6a22('0x20'),_0x1dc999,_0x436d11[_0x6a22('0x1e')]['message']);return _0x401c6f(_0x436d11[_0x6a22('0x1e')][_0x6a22('0x1f')]);}else{logger[_0x6a22('0x1b')](_0x6a22('0x20'),_0x1dc999,_0x6a22('0x1c'));_0x401c6f(_0x436d11[_0x6a22('0x21')][_0x6a22('0x1f')]);}})[_0x6a22('0x22')](function(_0x4a2391){logger[_0x6a22('0x1e')](_0x6a22('0x20'),_0x1dc999,_0x4a2391);_0x475cd0(_0x4a2391);});});}function respondWithStatusCode(_0x2aa3bd,_0x1b8cec){_0x1b8cec=_0x1b8cec||0xcc;return function(_0x41b8f0){if(_0x41b8f0){return _0x2aa3bd[_0x6a22('0x23')](_0x1b8cec);}return _0x2aa3bd['status'](_0x1b8cec)[_0x6a22('0x24')]();};}function respondWithResult(_0x273708,_0x38ceea){_0x38ceea=_0x38ceea||0xc8;return function(_0x4318ba){if(_0x4318ba){return _0x273708[_0x6a22('0x25')](_0x38ceea)['json'](_0x4318ba);}};}function respondWithFilteredResult(_0x21ca69,_0x4d4182){return function(_0xe9c71e){if(_0xe9c71e){var _0x51deb3=_0xe9c71e[_0x6a22('0x26')],_0x22e186=_0x4d4182['offset'],_0x4a2b09=_0x4d4182[_0x6a22('0x27')]+_0x4d4182[_0x6a22('0x28')],_0x15f1fb;if(_0x4a2b09>=_0x51deb3){_0x4a2b09=_0x51deb3;_0x15f1fb=0xc8;}else{_0x15f1fb=0xce;}_0x21ca69['status'](_0x15f1fb);return _0x21ca69[_0x6a22('0x29')]('Content-Range',_0x22e186+'-'+_0x4a2b09+'/'+_0x51deb3)[_0x6a22('0x2a')](_0xe9c71e);}return null;};}function patchUpdates(_0x4b46c3){return function(_0x3a2c80){try{jsonpatch[_0x6a22('0x2b')](_0x3a2c80,_0x4b46c3,!![]);}catch(_0x68d634){return BPromise['reject'](_0x68d634);}return _0x3a2c80['save']();};}function saveUpdates(_0x5bdbec,_0x5ed2a0){return function(_0x47bb66){if(_0x47bb66){return _0x47bb66[_0x6a22('0x2c')](_0x5bdbec)[_0x6a22('0x1a')](function(_0x8d4d3c){return _0x8d4d3c;});}return null;};}function removeEntity(_0x599e4d,_0x54404c){return function(_0x51b3af){if(_0x51b3af){return _0x51b3af['destroy']()[_0x6a22('0x1a')](function(){_0x599e4d[_0x6a22('0x25')](0xcc)[_0x6a22('0x24')]();});}};}function handleEntityNotFound(_0x217e46,_0x2877d3){return function(_0x10caa0){if(!_0x10caa0){_0x217e46[_0x6a22('0x23')](0x194);}return _0x10caa0;};}function handleError(_0x55467a,_0x151b89){_0x151b89=_0x151b89||0x1f4;return function(_0x206562){logger[_0x6a22('0x1e')](_0x206562[_0x6a22('0x2d')]);if(_0x206562[_0x6a22('0x2e')]){delete _0x206562[_0x6a22('0x2e')];}_0x55467a[_0x6a22('0x25')](_0x151b89)[_0x6a22('0x2f')](_0x206562);};}exports['index']=function(_0x12c1db,_0xe2fb70){var _0x95fb15={},_0x5f3ef4={},_0x109e90={'count':0x0,'rows':[]};var _0x3d8928=_['map'](db[_0x6a22('0x30')][_0x6a22('0x31')],function(_0x142eaf){return{'name':_0x142eaf[_0x6a22('0x32')],'type':_0x142eaf[_0x6a22('0x33')][_0x6a22('0x34')]};});_0x5f3ef4['model']=_[_0x6a22('0x35')](_0x3d8928,'name');_0x5f3ef4[_0x6a22('0x36')]=_[_0x6a22('0x37')](_0x12c1db[_0x6a22('0x36')]);_0x5f3ef4[_0x6a22('0x38')]=_[_0x6a22('0x39')](_0x5f3ef4[_0x6a22('0x3a')],_0x5f3ef4['query']);_0x95fb15[_0x6a22('0x3b')]=_[_0x6a22('0x39')](_0x5f3ef4['model'],qs[_0x6a22('0x3c')](_0x12c1db[_0x6a22('0x36')][_0x6a22('0x3c')]));_0x95fb15[_0x6a22('0x3b')]=_0x95fb15[_0x6a22('0x3b')]['length']?_0x95fb15[_0x6a22('0x3b')]:_0x5f3ef4[_0x6a22('0x3a')];if(!_0x12c1db[_0x6a22('0x36')][_0x6a22('0x3d')](_0x6a22('0x3e'))){_0x95fb15[_0x6a22('0x28')]=qs[_0x6a22('0x28')](_0x12c1db[_0x6a22('0x36')]['limit']);_0x95fb15['offset']=qs[_0x6a22('0x27')](_0x12c1db[_0x6a22('0x36')][_0x6a22('0x27')]);}_0x95fb15[_0x6a22('0x3f')]=qs[_0x6a22('0x40')](_0x12c1db[_0x6a22('0x36')][_0x6a22('0x40')]);_0x95fb15['where']=qs[_0x6a22('0x38')](_['pick'](_0x12c1db[_0x6a22('0x36')],_0x5f3ef4[_0x6a22('0x38')]),_0x3d8928);if(_0x12c1db['query'][_0x6a22('0x41')]){_0x95fb15[_0x6a22('0x42')]=_['merge'](_0x95fb15[_0x6a22('0x42')],{'$or':_[_0x6a22('0x35')](_0x3d8928,function(_0x59a3fb){if(_0x59a3fb['type']!=='VIRTUAL'){var _0x2e141e={};_0x2e141e[_0x59a3fb[_0x6a22('0x2e')]]={'$like':'%'+_0x12c1db[_0x6a22('0x36')][_0x6a22('0x41')]+'%'};return _0x2e141e;}})});}_0x95fb15=_[_0x6a22('0x43')]({},_0x95fb15,_0x12c1db[_0x6a22('0x44')]);var _0x18bbec={'where':_0x95fb15['where']};return db[_0x6a22('0x30')][_0x6a22('0x26')](_0x18bbec)[_0x6a22('0x1a')](function(_0x2e929b){_0x109e90[_0x6a22('0x26')]=_0x2e929b;if(_0x12c1db['query'][_0x6a22('0x45')]){_0x95fb15['include']=[{'all':!![]}];}return db[_0x6a22('0x30')][_0x6a22('0x46')](_0x95fb15);})[_0x6a22('0x1a')](function(_0x4c3eb3){_0x109e90[_0x6a22('0x47')]=_0x4c3eb3;return _0x109e90;})[_0x6a22('0x1a')](respondWithFilteredResult(_0xe2fb70,_0x95fb15))[_0x6a22('0x22')](handleError(_0xe2fb70,null));};exports['show']=function(_0x136a81,_0x2f7580){var _0x3272d6={'raw':![],'where':{'id':_0x136a81['params']['id']}},_0x101098={};_0x101098['model']=_[_0x6a22('0x37')](db[_0x6a22('0x30')][_0x6a22('0x31')]);_0x101098[_0x6a22('0x36')]=_['keys'](_0x136a81[_0x6a22('0x36')]);_0x101098[_0x6a22('0x48')]=_[_0x6a22('0x39')](_0x101098[_0x6a22('0x3a')],_0x101098[_0x6a22('0x36')]);_0x3272d6[_0x6a22('0x3b')]=_['intersection'](_0x101098[_0x6a22('0x3a')],qs[_0x6a22('0x3c')](_0x136a81[_0x6a22('0x36')]['fields']));_0x3272d6[_0x6a22('0x3b')]=_0x3272d6[_0x6a22('0x3b')][_0x6a22('0x49')]?_0x3272d6[_0x6a22('0x3b')]:_0x101098[_0x6a22('0x3a')];if(_0x136a81[_0x6a22('0x36')][_0x6a22('0x45')]){_0x3272d6['include']=[{'all':!![]}];}_0x3272d6=_[_0x6a22('0x43')]({},_0x3272d6,_0x136a81[_0x6a22('0x44')]);return db[_0x6a22('0x30')][_0x6a22('0x4a')](_0x3272d6)[_0x6a22('0x1a')](handleEntityNotFound(_0x2f7580,null))[_0x6a22('0x1a')](respondWithResult(_0x2f7580,null))[_0x6a22('0x22')](handleError(_0x2f7580,null));};exports[_0x6a22('0x2c')]=function(_0x5c16fc,_0x36d319){if(_0x5c16fc['body']['id']){delete _0x5c16fc[_0x6a22('0x4b')]['id'];}return db[_0x6a22('0x30')][_0x6a22('0x4a')]({'where':{'id':_0x5c16fc['params']['id']}})[_0x6a22('0x1a')](handleEntityNotFound(_0x36d319,null))[_0x6a22('0x1a')](saveUpdates(_0x5c16fc[_0x6a22('0x4b')],null))[_0x6a22('0x1a')](respondWithResult(_0x36d319,null))[_0x6a22('0x22')](handleError(_0x36d319,null));};exports[_0x6a22('0x4c')]=function(_0x17bd76,_0xb0c370,_0x40653f){if(_0x17bd76[_0x6a22('0x4d')]&&_0x17bd76['file'][_0x6a22('0x4e')]){_0x17bd76[_0x6a22('0x4b')][_0x6a22('0x4f')]=_0x17bd76[_0x6a22('0x4d')][_0x6a22('0x4e')];}return db[_0x6a22('0x30')][_0x6a22('0x4a')]({'where':{'id':_0x17bd76[_0x6a22('0x50')]['id']}})[_0x6a22('0x1a')](handleEntityNotFound(_0xb0c370,null))['then'](saveUpdates(_0x17bd76[_0x6a22('0x4b')],null))['then'](respondWithResult(_0xb0c370,null))[_0x6a22('0x22')](handleError(_0xb0c370,null));};exports['addLogoLogin']=function(_0x3cfd08,_0x4e8fa5,_0x46f2bf){if(_0x3cfd08[_0x6a22('0x4d')]&&_0x3cfd08[_0x6a22('0x4d')]['filename']){_0x3cfd08[_0x6a22('0x4b')][_0x6a22('0x51')]=_0x3cfd08[_0x6a22('0x4d')][_0x6a22('0x4e')];}return db[_0x6a22('0x30')][_0x6a22('0x4a')]({'where':{'id':_0x3cfd08[_0x6a22('0x50')]['id']}})[_0x6a22('0x1a')](handleEntityNotFound(_0x4e8fa5,null))[_0x6a22('0x1a')](saveUpdates(_0x3cfd08[_0x6a22('0x4b')],null))[_0x6a22('0x1a')](respondWithResult(_0x4e8fa5,null))['catch'](handleError(_0x4e8fa5,null));};var utilLicense=require('../../config/license/util');exports[_0x6a22('0x52')]=function(_0x1d0bff,_0x56054f,_0x3f01fc){var _0x5af843=_0x6a22('0x53');var _0x286f83={'custom':![]};return utilLicense['getLicense']()[_0x6a22('0x1a')](function(_0x292d0a){if(_0x292d0a){_0x286f83=_0x292d0a;}return db[_0x6a22('0x30')][_0x6a22('0x4a')]({'where':{'id':_0x1d0bff[_0x6a22('0x50')]['id']},'attributes':[_0x6a22('0x4f'),_0x6a22('0x51'),_0x6a22('0x54'),'favicon',_0x6a22('0x55'),_0x6a22('0x56'),_0x6a22('0x57'),'defaultFavicon'],'raw':!![]});})[_0x6a22('0x1a')](handleEntityNotFound(_0x56054f,null))[_0x6a22('0x1a')](function(_0x2ab1cf){if(_0x2ab1cf){var _0x3200d8=_0x2ab1cf[_0x6a22('0x4f')]&&fs['existsSync'](path[_0x6a22('0x58')](config[_0x6a22('0x59')],_0x5af843,_['toLower'](_0x2ab1cf[_0x6a22('0x4f')])))?path['join'](config[_0x6a22('0x59')],_0x5af843,_[_0x6a22('0x5a')](_0x2ab1cf[_0x6a22('0x4f')])):path[_0x6a22('0x58')](config['root'],_0x5af843,_[_0x6a22('0x5a')](_0x6a22('0x5b')));var _0x48849f=_0x6a22('0x5c')+_[_0x6a22('0x5d')](_0x6a22('0x4f'));if(_0x2ab1cf[_0x48849f]||!_0x286f83[_0x6a22('0x5e')]){_0x3200d8=path[_0x6a22('0x58')](config['root'],_0x5af843,_['toLower'](_0x6a22('0x5b')));}if(!fs[_0x6a22('0x5f')](_0x3200d8)){throw new db[(_0x6a22('0x60'))][(_0x6a22('0x61'))](_[_0x6a22('0x5d')](_0x6a22('0x4f'))+_0x6a22('0x62'));}return _0x56054f[_0x6a22('0x63')](_0x3200d8);}})['catch'](handleError(_0x56054f,null));};var utilLicense=require(_0x6a22('0x16'));exports['getLogoLogin']=function(_0x2932a9,_0x359a31,_0x2899e3){var _0x1fda06='server/files/images/logos';var _0x328e0d={'custom':![]};return utilLicense[_0x6a22('0x64')]()[_0x6a22('0x1a')](function(_0x7dcd4b){if(_0x7dcd4b){_0x328e0d=_0x7dcd4b;}return db[_0x6a22('0x30')]['find']({'where':{'id':_0x2932a9[_0x6a22('0x50')]['id']},'attributes':[_0x6a22('0x4f'),'loginLogo',_0x6a22('0x54'),_0x6a22('0x65'),'defaultLogo',_0x6a22('0x56'),_0x6a22('0x57'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x359a31,null))[_0x6a22('0x1a')](function(_0xacc911){if(_0xacc911){var _0x4bbffd=_0xacc911[_0x6a22('0x51')]&&fs[_0x6a22('0x5f')](path['join'](config[_0x6a22('0x59')],_0x1fda06,_['toLower'](_0xacc911['loginLogo'])))?path[_0x6a22('0x58')](config[_0x6a22('0x59')],_0x1fda06,_[_0x6a22('0x5a')](_0xacc911['loginLogo'])):path[_0x6a22('0x58')](config[_0x6a22('0x59')],_0x1fda06,_[_0x6a22('0x5a')](_0x6a22('0x66')));var _0x5ae56d=_0x6a22('0x5c')+_[_0x6a22('0x5d')](_0x6a22('0x51'));if(_0xacc911[_0x5ae56d]||!_0x328e0d[_0x6a22('0x5e')]){_0x4bbffd=path[_0x6a22('0x58')](config[_0x6a22('0x59')],_0x1fda06,_[_0x6a22('0x5a')](_0x6a22('0x66')));}if(!fs[_0x6a22('0x5f')](_0x4bbffd)){throw new db[(_0x6a22('0x60'))][(_0x6a22('0x61'))](_[_0x6a22('0x5d')](_0x6a22('0x51'))+_0x6a22('0x62'));}return _0x359a31[_0x6a22('0x63')](_0x4bbffd);}})['catch'](handleError(_0x359a31,null));};exports[_0x6a22('0x67')]=function(_0x54045c,_0x38bbb5){return db['Setting'][_0x6a22('0x4a')]({'where':{'id':_0x54045c[_0x6a22('0x50')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x38bbb5,null))[_0x6a22('0x22')](handleError(_0x38bbb5,null));};exports[_0x6a22('0x68')]=function(_0x29be8b,_0x123792,_0x5f2fe9){if(_0x29be8b['file']&&_0x29be8b[_0x6a22('0x4d')][_0x6a22('0x4e')]){_0x29be8b[_0x6a22('0x4b')][_0x6a22('0x54')]=_0x29be8b[_0x6a22('0x4d')][_0x6a22('0x4e')];}return db['Setting']['find']({'where':{'id':_0x29be8b[_0x6a22('0x50')]['id']}})[_0x6a22('0x1a')](handleEntityNotFound(_0x123792,null))['then'](saveUpdates(_0x29be8b[_0x6a22('0x4b')],null))['then'](respondWithResult(_0x123792,null))[_0x6a22('0x22')](handleError(_0x123792,null));};var utilLicense=require('../../config/license/util');exports[_0x6a22('0x69')]=function(_0x194f36,_0x59292c,_0x4e4e4b){var _0x1c0418=_0x6a22('0x53');var _0x5d665e={'custom':![]};return utilLicense[_0x6a22('0x64')]()[_0x6a22('0x1a')](function(_0x395075){if(_0x395075){_0x5d665e=_0x395075;}return db[_0x6a22('0x30')][_0x6a22('0x4a')]({'where':{'id':_0x194f36[_0x6a22('0x50')]['id']},'attributes':[_0x6a22('0x4f'),_0x6a22('0x51'),_0x6a22('0x54'),'favicon','defaultLogo',_0x6a22('0x56'),_0x6a22('0x57'),'defaultFavicon'],'raw':!![]});})[_0x6a22('0x1a')](handleEntityNotFound(_0x59292c,null))[_0x6a22('0x1a')](function(_0x42e0fa){if(_0x42e0fa){var _0x2bc019=_0x42e0fa[_0x6a22('0x54')]&&fs[_0x6a22('0x5f')](path[_0x6a22('0x58')](config[_0x6a22('0x59')],_0x1c0418,_[_0x6a22('0x5a')](_0x42e0fa[_0x6a22('0x54')])))?path[_0x6a22('0x58')](config[_0x6a22('0x59')],_0x1c0418,_[_0x6a22('0x5a')](_0x42e0fa[_0x6a22('0x54')])):path[_0x6a22('0x58')](config[_0x6a22('0x59')],_0x1c0418,_[_0x6a22('0x5a')]('default_preferred.png'));var _0x135f59=_0x6a22('0x5c')+_[_0x6a22('0x5d')]('preferred');if(_0x42e0fa[_0x135f59]||!_0x5d665e[_0x6a22('0x5e')]||!_0x5d665e[_0x6a22('0x54')]){_0x2bc019=path[_0x6a22('0x58')](config['root'],_0x1c0418,_[_0x6a22('0x5a')](_0x6a22('0x6a')));}if(!fs[_0x6a22('0x5f')](_0x2bc019)){throw new db[(_0x6a22('0x60'))][(_0x6a22('0x61'))](_['upperFirst']('preferred')+_0x6a22('0x62'));}return _0x59292c['download'](_0x2bc019);}})[_0x6a22('0x22')](handleError(_0x59292c,null));};exports[_0x6a22('0x6b')]=function(_0x522652,_0x4d17a0,_0x2db93){if(_0x522652[_0x6a22('0x4d')]&&_0x522652[_0x6a22('0x4d')][_0x6a22('0x4e')]){_0x522652[_0x6a22('0x4b')][_0x6a22('0x65')]=_0x522652[_0x6a22('0x4d')]['filename'];}return db[_0x6a22('0x30')][_0x6a22('0x4a')]({'where':{'id':_0x522652[_0x6a22('0x50')]['id']}})[_0x6a22('0x1a')](handleEntityNotFound(_0x4d17a0,null))['then'](saveUpdates(_0x522652[_0x6a22('0x4b')],null))[_0x6a22('0x1a')](respondWithResult(_0x4d17a0,null))[_0x6a22('0x22')](handleError(_0x4d17a0,null));};var utilLicense=require(_0x6a22('0x16'));exports[_0x6a22('0x6c')]=function(_0x2fc07a,_0x173e81,_0x10e7fa){var _0x2a3f3c=_0x6a22('0x53');var _0x17251e={'custom':![]};return utilLicense[_0x6a22('0x64')]()[_0x6a22('0x1a')](function(_0x1406f2){if(_0x1406f2){_0x17251e=_0x1406f2;}return db[_0x6a22('0x30')][_0x6a22('0x4a')]({'where':{'id':_0x2fc07a[_0x6a22('0x50')]['id']},'attributes':[_0x6a22('0x4f'),_0x6a22('0x51'),_0x6a22('0x54'),'favicon',_0x6a22('0x55'),_0x6a22('0x56'),'defaultPreferred',_0x6a22('0x6d')],'raw':!![]});})['then'](handleEntityNotFound(_0x173e81,null))[_0x6a22('0x1a')](function(_0x1af1db){if(_0x1af1db){var _0x3fbf35=_0x1af1db['favicon']&&fs[_0x6a22('0x5f')](path['join'](config['root'],_0x2a3f3c,_[_0x6a22('0x5a')](_0x1af1db['favicon'])))?path['join'](config[_0x6a22('0x59')],_0x2a3f3c,_[_0x6a22('0x5a')](_0x1af1db['favicon'])):path[_0x6a22('0x58')](config[_0x6a22('0x59')],_0x2a3f3c,_[_0x6a22('0x5a')]('default_favicon.ico'));var _0x9416f=_0x6a22('0x5c')+_[_0x6a22('0x5d')](_0x6a22('0x65'));if(_0x1af1db[_0x9416f]||!_0x17251e[_0x6a22('0x5e')]){_0x3fbf35=path[_0x6a22('0x58')](config['root'],_0x2a3f3c,_['toLower']('default_favicon.ico'));}if(!fs[_0x6a22('0x5f')](_0x3fbf35)){throw new db[(_0x6a22('0x60'))][(_0x6a22('0x61'))](_[_0x6a22('0x5d')](_0x6a22('0x65'))+_0x6a22('0x62'));}return _0x173e81[_0x6a22('0x63')](_0x3fbf35);}})[_0x6a22('0x22')](handleError(_0x173e81,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 580b695..5f93115 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 _0xd1c7=['./setting.attributes','exports','define','util','../../config/logger','moment','bluebird','path'];(function(_0x2f52f6,_0x463684){var _0xc2dc78=function(_0x5ea46e){while(--_0x5ea46e){_0x2f52f6['push'](_0x2f52f6['shift']());}};_0xc2dc78(++_0x463684);}(_0xd1c7,0x7b));var _0x7d1c=function(_0x21bb01,_0x4988f2){_0x21bb01=_0x21bb01-0x0;var _0x4a8035=_0xd1c7[_0x21bb01];return _0x4a8035;};'use strict';var _=require('lodash');var util=require(_0x7d1c('0x0'));var logger=require(_0x7d1c('0x1'))('api');var moment=require(_0x7d1c('0x2'));var BPromise=require(_0x7d1c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d1c('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7d1c('0x5'));module[_0x7d1c('0x6')]=function(_0x402614,_0x3b0ba1){return _0x402614[_0x7d1c('0x7')]('Setting',attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1cc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Setting','settings','lodash','../../config/logger','api'];(function(_0x8aed7f,_0x1a8713){var _0x37da8a=function(_0x49d0a8){while(--_0x49d0a8){_0x8aed7f['push'](_0x8aed7f['shift']());}};_0x37da8a(++_0x1a8713);}(_0xe1cc,0xf9));var _0xce1c=function(_0x3472fb,_0x510fa3){_0x3472fb=_0x3472fb-0x0;var _0x3a0135=_0xe1cc[_0x3472fb];return _0x3a0135;};'use strict';var _=require(_0xce1c('0x0'));var util=require('util');var logger=require(_0xce1c('0x1'))(_0xce1c('0x2'));var moment=require(_0xce1c('0x3'));var BPromise=require(_0xce1c('0x4'));var rp=require(_0xce1c('0x5'));var fs=require('fs');var path=require(_0xce1c('0x6'));var rimraf=require(_0xce1c('0x7'));var config=require(_0xce1c('0x8'));var attributes=require('./setting.attributes');module[_0xce1c('0x9')]=function(_0x2e8c12,_0x452e53){return _0x2e8c12['define'](_0xce1c('0xa'),attributes,{'tableName':_0xce1c('0xb'),'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 59f3d04..24273a6 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 _0x703b=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x703b,0xc5));var _0xb703=function(_0x14cb80,_0x5df3e9){_0x14cb80=_0x14cb80-0x0;var _0x57cb80=_0x703b[_0x14cb80];return _0x57cb80;};'use strict';var _=require(_0xb703('0x0'));var util=require(_0xb703('0x1'));var moment=require(_0xb703('0x2'));var BPromise=require(_0xb703('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb703('0x4'));var db=require(_0xb703('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb703('0x6'))(_0xb703('0x7'));var config=require(_0xb703('0x8'));var jayson=require(_0xb703('0x9'));var client=jayson[_0xb703('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21c408,_0x228408,_0x2f33e1){return new BPromise(function(_0x3dcb77,_0x36162a){return client['request'](_0x21c408,_0x2f33e1)[_0xb703('0xb')](function(_0x3ddb4f){logger['info'](_0xb703('0xc'),_0x228408,_0xb703('0xd'));logger[_0xb703('0xe')](_0xb703('0xf'),_0x228408,_0xb703('0xd'),JSON['stringify'](_0x3ddb4f));if(_0x3ddb4f[_0xb703('0x10')]){if(_0x3ddb4f[_0xb703('0x10')]['code']===0x1f4){logger[_0xb703('0x10')](_0xb703('0xc'),_0x228408,_0x3ddb4f['error'][_0xb703('0x11')]);return _0x36162a(_0x3ddb4f[_0xb703('0x10')][_0xb703('0x11')]);}logger[_0xb703('0x10')](_0xb703('0xc'),_0x228408,_0x3ddb4f[_0xb703('0x10')][_0xb703('0x11')]);return _0x3dcb77(_0x3ddb4f['error'][_0xb703('0x11')]);}else{logger['info'](_0xb703('0xc'),_0x228408,'request\x20sent');_0x3dcb77(_0x3ddb4f[_0xb703('0x12')][_0xb703('0x11')]);}})[_0xb703('0x13')](function(_0x5be588){logger['error'](_0xb703('0xc'),_0x228408,_0x5be588);_0x36162a(_0x5be588);});});} \ No newline at end of file +var _0x31b6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment'];(function(_0x5e4b14,_0xbf4833){var _0x411020=function(_0x223758){while(--_0x223758){_0x5e4b14['push'](_0x5e4b14['shift']());}};_0x411020(++_0xbf4833);}(_0x31b6,0xb6));var _0x631b=function(_0x5b9875,_0x590bb7){_0x5b9875=_0x5b9875-0x0;var _0x325246=_0x31b6[_0x5b9875];return _0x325246;};'use strict';var _=require('lodash');var util=require(_0x631b('0x0'));var moment=require(_0x631b('0x1'));var BPromise=require(_0x631b('0x2'));var rs=require(_0x631b('0x3'));var fs=require('fs');var Redis=require(_0x631b('0x4'));var db=require(_0x631b('0x5'))['db'];var utils=require(_0x631b('0x6'));var logger=require('../../config/logger')(_0x631b('0x7'));var config=require(_0x631b('0x8'));var jayson=require(_0x631b('0x9'));var client=jayson[_0x631b('0xa')][_0x631b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a4ac2,_0x4d0f08,_0xc4fd99){return new BPromise(function(_0x13d278,_0x4976ea){return client['request'](_0x1a4ac2,_0xc4fd99)[_0x631b('0xc')](function(_0x5d2d04){logger[_0x631b('0xd')](_0x631b('0xe'),_0x4d0f08,_0x631b('0xf'));logger[_0x631b('0x10')](_0x631b('0x11'),_0x4d0f08,_0x631b('0xf'),JSON[_0x631b('0x12')](_0x5d2d04));if(_0x5d2d04['error']){if(_0x5d2d04[_0x631b('0x13')][_0x631b('0x14')]===0x1f4){logger[_0x631b('0x13')](_0x631b('0xe'),_0x4d0f08,_0x5d2d04[_0x631b('0x13')][_0x631b('0x15')]);return _0x4976ea(_0x5d2d04[_0x631b('0x13')][_0x631b('0x15')]);}logger[_0x631b('0x13')](_0x631b('0xe'),_0x4d0f08,_0x5d2d04[_0x631b('0x13')][_0x631b('0x15')]);return _0x13d278(_0x5d2d04[_0x631b('0x13')][_0x631b('0x15')]);}else{logger[_0x631b('0xd')](_0x631b('0xe'),_0x4d0f08,_0x631b('0xf'));_0x13d278(_0x5d2d04['result']['message']);}})[_0x631b('0x16')](function(_0xec4390){logger['error'](_0x631b('0xe'),_0x4d0f08,_0xec4390);_0x4976ea(_0xec4390);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 22336f7..6802f2b 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 _0xbaf0=['show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post','addDisposition','/:id/notify','notify','/:id/send','send','status','addAgents','update','removeDispositions','delete','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4bf17a,_0x24d74c){var _0xe22657=function(_0x3e8cca){while(--_0x3e8cca){_0x4bf17a['push'](_0x4bf17a['shift']());}};_0xe22657(++_0x24d74c);}(_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('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getApplications']);router[_0x0baf('0x8')](_0x0baf('0x14'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router['get'](_0x0baf('0x16'),controller['statusGet']);router[_0x0baf('0x8')](_0x0baf('0x17'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/',auth[_0x0baf('0x9')](),controller['create']);router['post'](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x19')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller['addAnswer']);router[_0x0baf('0x19')](_0x0baf('0x1b'),controller[_0x0baf('0x1c')]);router[_0x0baf('0x19')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller['addApplications']);router['post'](_0x0baf('0x1d'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1e')]);router[_0x0baf('0x19')](_0x0baf('0x16'),controller[_0x0baf('0x1f')]);router[_0x0baf('0x19')](_0x0baf('0x17'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x20')]);router['put'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0x21')]);router['delete']('/:id',auth[_0x0baf('0x9')](),controller['destroy']);router['delete'](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x22')]);router[_0x0baf('0x23')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x24')]);router[_0x0baf('0x23')](_0x0baf('0x17'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x25')]);module[_0x0baf('0x26')]=router; \ No newline at end of file +var _0x757a=['/:id/interactions','/:id/users','getAgents','post','create','/:id/notify','notify','/:id/applications','addApplications','/:id/send','send','/:id/status','status','addAgents','put','update','delete','removeAgents','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers'];(function(_0x37c2f6,_0x281f1c){var _0x25cb7b=function(_0x29835c){while(--_0x29835c){_0x37c2f6['push'](_0x37c2f6['shift']());}};_0x25cb7b(++_0x281f1c);}(_0x757a,0xde));var _0xa757=function(_0x3e1c47,_0x3d72d4){_0x3e1c47=_0x3e1c47-0x0;var _0x589547=_0x757a[_0x3e1c47];return _0x589547;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa757('0x2'));var interaction=require(_0xa757('0x3'));var config=require(_0xa757('0x4'));var controller=require(_0xa757('0x5'));router[_0xa757('0x6')]('/',auth[_0xa757('0x7')](),controller['index']);router[_0xa757('0x6')](_0xa757('0x8'),auth['isAuthenticated'](),controller[_0xa757('0x9')]);router[_0xa757('0x6')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xb')]);router['get'](_0xa757('0xc'),auth[_0xa757('0x7')](),controller[_0xa757('0xd')]);router[_0xa757('0x6')](_0xa757('0xe'),auth[_0xa757('0x7')](),controller[_0xa757('0xf')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router['get'](_0xa757('0x10'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xa757('0x6')]('/:id/status',controller['statusGet']);router[_0xa757('0x6')](_0xa757('0x11'),auth[_0xa757('0x7')](),controller[_0xa757('0x12')]);router[_0xa757('0x13')]('/',auth[_0xa757('0x7')](),controller[_0xa757('0x14')]);router[_0xa757('0x13')](_0xa757('0xc'),auth[_0xa757('0x7')](),controller['addDisposition']);router[_0xa757('0x13')](_0xa757('0xe'),auth[_0xa757('0x7')](),controller['addAnswer']);router['post'](_0xa757('0x15'),controller[_0xa757('0x16')]);router[_0xa757('0x13')](_0xa757('0x17'),auth[_0xa757('0x7')](),controller[_0xa757('0x18')]);router['post'](_0xa757('0x19'),auth['isAuthenticated'](),controller[_0xa757('0x1a')]);router[_0xa757('0x13')](_0xa757('0x1b'),controller[_0xa757('0x1c')]);router['post']('/:id/users',auth[_0xa757('0x7')](),controller[_0xa757('0x1d')]);router[_0xa757('0x1e')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0x1f')]);router[_0xa757('0x20')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller['destroy']);router[_0xa757('0x20')]('/:id/dispositions',auth[_0xa757('0x7')](),controller['removeDispositions']);router[_0xa757('0x20')](_0xa757('0xe'),auth[_0xa757('0x7')](),controller['removeAnswers']);router[_0xa757('0x20')](_0xa757('0x11'),auth[_0xa757('0x7')](),controller[_0xa757('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 858c453..e6d0f2e 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 _0x72ba=['BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','skebby','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer'];(function(_0xe74f92,_0x4cb9e5){var _0x18929f=function(_0x544fff){while(--_0x544fff){_0xe74f92['push'](_0xe74f92['shift']());}};_0x18929f(++_0x4cb9e5);}(_0x72ba,0x1be));var _0xa72b=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x72ba[_0x24259d];return _0x5a701;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xa72b('0x0'));module[_0xa72b('0x1')]={'name':{'type':Sequelize[_0xa72b('0x2')],'unique':_0xa72b('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xa72b('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xa72b('0x2')],'defaultValue':function(){return rs[_0xa72b('0x4')]();}},'phone':{'type':Sequelize[_0xa72b('0x2')]},'type':{'type':Sequelize[_0xa72b('0x5')]('twilio',_0xa72b('0x6'),_0xa72b('0x7'),_0xa72b('0x8'),_0xa72b('0x9'),_0xa72b('0xa'),_0xa72b('0xb'),_0xa72b('0xc'),_0xa72b('0xd'))},'accountSid':{'type':Sequelize[_0xa72b('0x2')]},'authId':{'type':Sequelize[_0xa72b('0x2')]},'authToken':{'type':Sequelize[_0xa72b('0x2')]},'smsMethod':{'type':Sequelize[_0xa72b('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xa72b('0x2')]},'password':{'type':Sequelize[_0xa72b('0x2')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xa72b('0x2')]},'deliveryReport':{'type':Sequelize[_0xa72b('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xa72b('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa72b('0xf');}},'notificationSound':{'type':Sequelize[_0xa72b('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa72b('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa72b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa72b('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa72b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa72b('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xa72b('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa72b('0x10')],'comment':_0xa72b('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xa72b('0xe')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x358ae5){if(!_0x358ae5)this[_0xa72b('0x12')]('mandatoryDispositionPauseId',null);this[_0xa72b('0x12')](_0xa72b('0x13'),_0x358ae5);}}}; \ No newline at end of file +var _0x0592=['ENUM','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','STRING','name','twilio','clicksend','clickatell','csc','infobip','intelepeer'];(function(_0xc77a23,_0x193d2e){var _0x453073=function(_0x5eb3f9){while(--_0x5eb3f9){_0xc77a23['push'](_0xc77a23['shift']());}};_0x453073(++_0x193d2e);}(_0x0592,0x137));var _0x2059=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0592[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x2059('0x0'));module['exports']={'name':{'type':Sequelize[_0x2059('0x1')],'unique':_0x2059('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x2059('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x2059('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x2059('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x2059('0x1')]},'type':{'type':Sequelize['ENUM'](_0x2059('0x3'),'skebby','connectel',_0x2059('0x4'),'plivo',_0x2059('0x5'),_0x2059('0x6'),_0x2059('0x7'),_0x2059('0x8'))},'accountSid':{'type':Sequelize[_0x2059('0x1')]},'authId':{'type':Sequelize[_0x2059('0x1')]},'authToken':{'type':Sequelize[_0x2059('0x1')]},'smsMethod':{'type':Sequelize[_0x2059('0x9')]('SI','TI','GP')},'username':{'type':Sequelize[_0x2059('0x1')]},'password':{'type':Sequelize[_0x2059('0x1')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x2059('0x1')]},'deliveryReport':{'type':Sequelize[_0x2059('0xa')],'defaultValue':![]},'description':{'type':Sequelize[_0x2059('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x2059('0xb');}},'notificationSound':{'type':Sequelize[_0x2059('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2059('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2059('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2059('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2059('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x2059('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x2059('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x206733){if(!_0x206733)this['setDataValue'](_0x2059('0xd'),null);this[_0x2059('0xe')](_0x2059('0xf'),_0x206733);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 49aab37..31cd804 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 _0x77c0=['length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','SmsApplication','Applications','account','orderBy','asc','difference','updatedAt','createdAt','ListId','mobile','twilio','from','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','From','Text','results','csc','segmentedMessage','clickatell','fromNumber','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','omit','defaults','contact','SmsInteraction','spread','interaction','created','applications','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','sequelize','transaction','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','fullname','internal','Tag','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','SmsMessage','dataValues','push','endpoint\x20/status\x20POST\x20/','inspect','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','redif','error_code','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','statusGet','received\x20delivery\x20report\x20from','message-id','state','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./smsAccount.socket','register','request','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','map','SmsAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','mandatoryDispositionPause','filtears','fields'];(function(_0x1e2f10,_0x435420){var _0x5bc29a=function(_0x477421){while(--_0x477421){_0x1e2f10['push'](_0x1e2f10['shift']());}};_0x5bc29a(++_0x435420);}(_0x77c0,0x166));var _0x077c=function(_0x3dedfb,_0x10be20){_0x3dedfb=_0x3dedfb-0x0;var _0x198541=_0x77c0[_0x3dedfb];return _0x198541;};'use strict';var pdf=require(_0x077c('0x0'));var emlformat=require(_0x077c('0x1'));var rimraf=require(_0x077c('0x2'));var zipdir=require(_0x077c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x077c('0x4'));var moment=require(_0x077c('0x5'));var BPromise=require(_0x077c('0x6'));var Mustache=require(_0x077c('0x7'));var util=require(_0x077c('0x8'));var path=require(_0x077c('0x9'));var sox=require(_0x077c('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x077c('0xb'));var squel=require('squel');var crypto=require(_0x077c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x077c('0xd'));var toCsv=require(_0x077c('0xe'));var querystring=require(_0x077c('0xf'));var Papa=require(_0x077c('0x10'));var Redis=require('ioredis');var authService=require(_0x077c('0x11'));var qs=require(_0x077c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x077c('0x13'))(_0x077c('0x14'));var utils=require(_0x077c('0x15'));var config=require(_0x077c('0x16'));var licenseUtil=require(_0x077c('0x17'));var db=require(_0x077c('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x077c('0x19'),'port':0x18eb});var socket=require(_0x077c('0x1a'))(new Redis(config[_0x077c('0x1b')]));require(_0x077c('0x1c'))[_0x077c('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x5a92ef,_0x55ed32,_0x499438,_0x38fcc8){return new BPromise(function(_0x2bddc8,_0x2e727b){var _0x3e08d0=_0x38fcc8||client;return _0x3e08d0[_0x077c('0x1e')](_0x5a92ef,_0x499438)['then'](function(_0x5a3be6){logger['info'](_0x077c('0x1f'),_0x55ed32,'request\x20sent');logger[_0x077c('0x20')](_0x077c('0x21'),_0x55ed32,_0x077c('0x22'),JSON[_0x077c('0x23')](_0x5a3be6));if(_0x5a3be6[_0x077c('0x24')]){if(_0x5a3be6[_0x077c('0x24')][_0x077c('0x25')]===0x1f4){logger[_0x077c('0x24')]('SmsAccount,\x20%s,\x20%s',_0x55ed32,_0x5a3be6[_0x077c('0x24')][_0x077c('0x26')]);return _0x2e727b(_0x5a3be6[_0x077c('0x24')]['message']);}logger[_0x077c('0x24')](_0x077c('0x1f'),_0x55ed32,_0x5a3be6[_0x077c('0x24')][_0x077c('0x26')]);return _0x2bddc8(_0x5a3be6[_0x077c('0x24')][_0x077c('0x26')]);}else{logger[_0x077c('0x27')](_0x077c('0x1f'),_0x55ed32,_0x077c('0x22'));_0x2bddc8(_0x5a3be6[_0x077c('0x28')]['message']);}})[_0x077c('0x29')](function(_0x35cbb6){logger[_0x077c('0x24')](_0x077c('0x1f'),_0x55ed32,_0x35cbb6);_0x2e727b(_0x35cbb6);});});}function respondWithStatusCode(_0x25e2d3,_0x2d83bb){_0x2d83bb=_0x2d83bb||0xcc;return function(_0x2a7b15){if(_0x2a7b15){return _0x25e2d3[_0x077c('0x2a')](_0x2d83bb);}return _0x25e2d3[_0x077c('0x2b')](_0x2d83bb)[_0x077c('0x2c')]();};}function respondWithResult(_0xd555a3,_0x4316c9){_0x4316c9=_0x4316c9||0xc8;return function(_0x5ca08d){if(_0x5ca08d){return _0xd555a3[_0x077c('0x2b')](_0x4316c9)['json'](_0x5ca08d);}};}function respondWithFilteredResult(_0x4bb436,_0x5f7428){return function(_0x55a723){if(_0x55a723){var _0x414c1a=_0x55a723[_0x077c('0x2d')],_0x4b50aa=_0x5f7428['offset'],_0x5cb473=_0x5f7428[_0x077c('0x2e')]+_0x5f7428[_0x077c('0x2f')],_0x10adbd;if(_0x5cb473>=_0x414c1a){_0x5cb473=_0x414c1a;_0x10adbd=0xc8;}else{_0x10adbd=0xce;}_0x4bb436[_0x077c('0x2b')](_0x10adbd);return _0x4bb436[_0x077c('0x30')](_0x077c('0x31'),_0x4b50aa+'-'+_0x5cb473+'/'+_0x414c1a)[_0x077c('0x32')](_0x55a723);}return null;};}function patchUpdates(_0x289e27){return function(_0x2c02a0){try{jsonpatch[_0x077c('0x33')](_0x2c02a0,_0x289e27,!![]);}catch(_0x3acb6b){return BPromise['reject'](_0x3acb6b);}return _0x2c02a0[_0x077c('0x34')]();};}function saveUpdates(_0x47ab54,_0x5dd6d2){return function(_0x4165d2){if(_0x4165d2){return _0x4165d2[_0x077c('0x35')](_0x47ab54)[_0x077c('0x36')](function(_0x43f3bc){return _0x43f3bc;});}return null;};}function removeEntity(_0x4771bb,_0x2a5dc7){return function(_0x51da8a){if(_0x51da8a){return _0x51da8a[_0x077c('0x37')]()[_0x077c('0x36')](function(){var _0x507969=_0x51da8a['get']({'plain':!![]});var _0x218c8b=_0x077c('0x38');return db[_0x077c('0x39')]['destroy']({'where':{'type':_0x218c8b,'resourceId':_0x507969['id']}})[_0x077c('0x36')](function(){return _0x51da8a;});})['then'](function(){_0x4771bb[_0x077c('0x2b')](0xcc)[_0x077c('0x2c')]();});}};}function handleEntityNotFound(_0x3d9f37,_0x192601){return function(_0x47f092){if(!_0x47f092){_0x3d9f37[_0x077c('0x2a')](0x194);}return _0x47f092;};}function handleError(_0x42f98a,_0x56b6df){_0x56b6df=_0x56b6df||0x1f4;return function(_0x38d1f6){logger['error'](_0x38d1f6[_0x077c('0x3a')]);if(_0x38d1f6[_0x077c('0x3b')]){delete _0x38d1f6[_0x077c('0x3b')];}_0x42f98a[_0x077c('0x2b')](_0x56b6df)[_0x077c('0x3c')](_0x38d1f6);};}exports[_0x077c('0x3d')]=function(_0x1ae971,_0x17e3f7){var _0x59c061={'include':[{'model':db[_0x077c('0x3e')],'as':'mandatoryDispositionPause'}]},_0x56c640={},_0x4d09eb={'count':0x0,'rows':[]};var _0x292d1a=_[_0x077c('0x3f')](db[_0x077c('0x40')][_0x077c('0x41')],function(_0x18637e){return{'name':_0x18637e[_0x077c('0x42')],'type':_0x18637e[_0x077c('0x43')]['key']};});_0x56c640[_0x077c('0x44')]=_[_0x077c('0x3f')](_0x292d1a,_0x077c('0x3b'));_0x56c640[_0x077c('0x45')]=_[_0x077c('0x46')](_0x1ae971['query']);_0x56c640[_0x077c('0x47')]=_[_0x077c('0x48')](_0x56c640[_0x077c('0x44')],_0x56c640[_0x077c('0x45')]);_0x59c061[_0x077c('0x49')]=_[_0x077c('0x48')](_0x56c640['model'],qs['fields'](_0x1ae971[_0x077c('0x45')]['fields']));_0x59c061[_0x077c('0x49')]=_0x59c061[_0x077c('0x49')]['length']?_0x59c061[_0x077c('0x49')]:_0x56c640[_0x077c('0x44')];if(!_0x1ae971['query'][_0x077c('0x4a')]('nolimit')){_0x59c061[_0x077c('0x2f')]=qs['limit'](_0x1ae971[_0x077c('0x45')][_0x077c('0x2f')]);_0x59c061[_0x077c('0x2e')]=qs[_0x077c('0x2e')](_0x1ae971[_0x077c('0x45')][_0x077c('0x2e')]);}_0x59c061[_0x077c('0x4b')]=qs[_0x077c('0x4c')](_0x1ae971[_0x077c('0x45')]['sort']);_0x59c061['where']=qs['filters'](_[_0x077c('0x4d')](_0x1ae971['query'],_0x56c640[_0x077c('0x47')]),_0x292d1a);if(_0x1ae971['query'][_0x077c('0x4e')]){_0x59c061[_0x077c('0x4f')]=_[_0x077c('0x50')](_0x59c061[_0x077c('0x4f')],{'$or':_['map'](_0x292d1a,function(_0x8424e7){if(_0x8424e7[_0x077c('0x43')]!==_0x077c('0x51')){var _0x29e634={};_0x29e634[_0x8424e7[_0x077c('0x3b')]]={'$like':'%'+_0x1ae971[_0x077c('0x45')][_0x077c('0x4e')]+'%'};return _0x29e634;}})});}_0x59c061=_[_0x077c('0x50')]({},_0x59c061,_0x1ae971[_0x077c('0x52')]);var _0x184ad5={'where':_0x59c061[_0x077c('0x4f')]};return db['SmsAccount']['count'](_0x184ad5)[_0x077c('0x36')](function(_0x434aab){_0x4d09eb[_0x077c('0x2d')]=_0x434aab;if(_0x1ae971[_0x077c('0x45')][_0x077c('0x53')]){_0x59c061[_0x077c('0x54')]=[{'all':!![]}];}return db[_0x077c('0x40')]['findAll'](_0x59c061);})[_0x077c('0x36')](function(_0x37ea1e){_0x4d09eb[_0x077c('0x55')]=_0x37ea1e;return _0x4d09eb;})['then'](respondWithFilteredResult(_0x17e3f7,_0x59c061))[_0x077c('0x29')](handleError(_0x17e3f7,null));};exports[_0x077c('0x56')]=function(_0x495c4b,_0x4e572e){var _0x3f5449={'raw':![],'where':{'id':_0x495c4b['params']['id']},'include':[{'model':db[_0x077c('0x3e')],'as':_0x077c('0x57')}]},_0x410ba5={};_0x410ba5[_0x077c('0x44')]=_[_0x077c('0x46')](db[_0x077c('0x40')][_0x077c('0x41')]);_0x410ba5[_0x077c('0x45')]=_[_0x077c('0x46')](_0x495c4b[_0x077c('0x45')]);_0x410ba5[_0x077c('0x58')]=_['intersection'](_0x410ba5[_0x077c('0x44')],_0x410ba5['query']);_0x3f5449['attributes']=_[_0x077c('0x48')](_0x410ba5[_0x077c('0x44')],qs[_0x077c('0x59')](_0x495c4b[_0x077c('0x45')]['fields']));_0x3f5449[_0x077c('0x49')]=_0x3f5449[_0x077c('0x49')][_0x077c('0x5a')]?_0x3f5449[_0x077c('0x49')]:_0x410ba5[_0x077c('0x44')];if(_0x495c4b[_0x077c('0x45')]['includeAll']){_0x3f5449[_0x077c('0x54')]=[{'all':!![]}];}_0x3f5449=_[_0x077c('0x50')]({},_0x3f5449,_0x495c4b[_0x077c('0x52')]);return db[_0x077c('0x40')][_0x077c('0x5b')](_0x3f5449)[_0x077c('0x36')](handleEntityNotFound(_0x4e572e,null))[_0x077c('0x36')](respondWithResult(_0x4e572e,null))['catch'](handleError(_0x4e572e,null));};exports[_0x077c('0x5c')]=function(_0x305d97,_0x5880e2){return db[_0x077c('0x40')][_0x077c('0x5c')](_0x305d97['body'],{})['then'](function(_0x38006f){var _0x3e0104=_0x305d97[_0x077c('0x5d')][_0x077c('0x5e')]({'plain':!![]});if(!_0x3e0104)throw new Error(_0x077c('0x5f'));if(_0x3e0104[_0x077c('0x60')]===_0x077c('0x5d')){var _0x2c6f1f=_0x38006f['get']({'plain':!![]});var _0x384fd5=_0x077c('0x38');return db['UserProfileSection'][_0x077c('0x5b')]({'where':{'name':_0x384fd5,'userProfileId':_0x3e0104['userProfileId']},'raw':!![]})[_0x077c('0x36')](function(_0x47d667){if(_0x47d667&&_0x47d667['autoAssociation']===0x0){return db[_0x077c('0x39')][_0x077c('0x5c')]({'name':_0x2c6f1f[_0x077c('0x3b')],'resourceId':_0x2c6f1f['id'],'type':_0x47d667[_0x077c('0x3b')],'sectionId':_0x47d667['id']},{})['then'](function(){return _0x38006f;});}else{return _0x38006f;}})[_0x077c('0x29')](function(_0x229f33){logger[_0x077c('0x24')](_0x077c('0x61'),_0x229f33);throw _0x229f33;});}return _0x38006f;})[_0x077c('0x36')](respondWithResult(_0x5880e2,0xc9))[_0x077c('0x29')](handleError(_0x5880e2,null));};exports[_0x077c('0x35')]=function(_0x2d0e79,_0x5baa43){if(_0x2d0e79[_0x077c('0x62')]['id']){delete _0x2d0e79[_0x077c('0x62')]['id'];}return db[_0x077c('0x40')][_0x077c('0x5b')]({'where':{'id':_0x2d0e79[_0x077c('0x63')]['id']},'include':[{'model':db[_0x077c('0x3e')],'as':_0x077c('0x57')}]})['then'](handleEntityNotFound(_0x5baa43,null))['then'](saveUpdates(_0x2d0e79[_0x077c('0x62')],null))[_0x077c('0x36')](respondWithResult(_0x5baa43,null))[_0x077c('0x29')](handleError(_0x5baa43,null));};exports[_0x077c('0x37')]=function(_0x6c788b,_0x8734ef){return db[_0x077c('0x40')]['find']({'where':{'id':_0x6c788b[_0x077c('0x63')]['id']}})['then'](handleEntityNotFound(_0x8734ef,null))[_0x077c('0x36')](removeEntity(_0x8734ef,null))[_0x077c('0x29')](handleError(_0x8734ef,null));};exports[_0x077c('0x64')]=function(_0x164d71,_0x1cd7c5){return db[_0x077c('0x40')][_0x077c('0x64')]()[_0x077c('0x36')](respondWithResult(_0x1cd7c5,null))['catch'](handleError(_0x1cd7c5,null));};exports[_0x077c('0x65')]=function(_0x53be4c,_0x2fd820,_0x3e2d04){if(_0x53be4c['body']['id']){delete _0x53be4c[_0x077c('0x62')]['id'];}return db[_0x077c('0x40')][_0x077c('0x5b')]({'where':{'id':_0x53be4c['params']['id']}})[_0x077c('0x36')](handleEntityNotFound(_0x2fd820,null))[_0x077c('0x36')](function(_0x49f62){if(_0x49f62){_0x53be4c[_0x077c('0x62')][_0x077c('0x66')]=_0x49f62['id'];return db[_0x077c('0x67')][_0x077c('0x5c')](_0x53be4c[_0x077c('0x62')]);}})[_0x077c('0x36')](respondWithResult(_0x2fd820,null))[_0x077c('0x29')](handleError(_0x2fd820,null));};exports[_0x077c('0x68')]=function(_0x449446,_0x3aac46,_0xc0f80){var _0x25193d={'raw':![],'where':{}};var _0xf1190f={};var _0x23e700={'count':0x0,'rows':[]};return db[_0x077c('0x40')][_0x077c('0x69')]({'where':{'id':_0x449446[_0x077c('0x63')]['id']}})[_0x077c('0x36')](handleEntityNotFound(_0x3aac46,null))[_0x077c('0x36')](function(_0x58c121){if(_0x58c121){_0xf1190f[_0x077c('0x44')]=_[_0x077c('0x46')](db[_0x077c('0x67')][_0x077c('0x41')]);_0xf1190f[_0x077c('0x45')]=_['keys'](_0x449446[_0x077c('0x45')]);_0xf1190f['filters']=_[_0x077c('0x48')](_0xf1190f[_0x077c('0x44')],_0xf1190f['query']);_0x25193d[_0x077c('0x49')]=_['intersection'](_0xf1190f['model'],qs[_0x077c('0x59')](_0x449446[_0x077c('0x45')][_0x077c('0x59')]));_0x25193d[_0x077c('0x49')]=_0x25193d[_0x077c('0x49')]['length']?_0x25193d[_0x077c('0x49')]:_0xf1190f[_0x077c('0x44')];if(!_0x449446[_0x077c('0x45')][_0x077c('0x4a')](_0x077c('0x6a'))){_0x25193d['limit']=qs[_0x077c('0x2f')](_0x449446['query'][_0x077c('0x2f')]);_0x25193d[_0x077c('0x2e')]=qs[_0x077c('0x2e')](_0x449446[_0x077c('0x45')]['offset']);}_0x25193d[_0x077c('0x4b')]=qs[_0x077c('0x4c')](_0x449446[_0x077c('0x45')][_0x077c('0x4c')]);_0x25193d['where']=qs['filters'](_['pick'](_0x449446[_0x077c('0x45')],_0xf1190f['filters']));_0x25193d[_0x077c('0x4f')][_0x077c('0x66')]=_0x58c121['id'];if(_0x449446[_0x077c('0x45')]['filter']){_0x25193d[_0x077c('0x4f')]=_[_0x077c('0x50')](_0x25193d[_0x077c('0x4f')],{'$or':_[_0x077c('0x3f')](_0x25193d['attributes'],function(_0x2299f0){var _0x1c75b6={};_0x1c75b6[_0x2299f0]={'$like':'%'+_0x449446[_0x077c('0x45')]['filter']+'%'};return _0x1c75b6;})});}_0x25193d=_[_0x077c('0x50')]({},_0x25193d,_0x449446['options']);return db[_0x077c('0x67')]['count']({'where':_0x25193d['where']})[_0x077c('0x36')](function(_0x54cb02){_0x23e700[_0x077c('0x2d')]=_0x54cb02;if(_0x449446[_0x077c('0x45')][_0x077c('0x53')]){_0x25193d['include']=[{'all':!![]}];}return db[_0x077c('0x67')][_0x077c('0x6b')](_0x25193d);})[_0x077c('0x36')](function(_0x479eeb){_0x23e700[_0x077c('0x55')]=_0x479eeb;return _0x23e700;});}})[_0x077c('0x36')](respondWithFilteredResult(_0x3aac46,_0x25193d))['catch'](handleError(_0x3aac46,null));};exports[_0x077c('0x6c')]=function(_0x472398,_0x2e3c13,_0x2cd933){return db[_0x077c('0x40')][_0x077c('0x5b')]({'where':{'id':_0x472398[_0x077c('0x63')]['id']}})['then'](handleEntityNotFound(_0x2e3c13,null))[_0x077c('0x36')](function(_0x3c08a5){if(_0x3c08a5){return _0x3c08a5[_0x077c('0x6c')](_0x472398[_0x077c('0x45')][_0x077c('0x6d')]);}})[_0x077c('0x36')](respondWithStatusCode(_0x2e3c13,null))[_0x077c('0x29')](handleError(_0x2e3c13,null));};exports[_0x077c('0x6e')]=function(_0x320aed,_0x207cc2,_0x903745){if(_0x320aed['body']['id']){delete _0x320aed[_0x077c('0x62')]['id'];}return db['SmsAccount'][_0x077c('0x5b')]({'where':{'id':_0x320aed['params']['id']}})['then'](handleEntityNotFound(_0x207cc2,null))[_0x077c('0x36')](function(_0x15890a){if(_0x15890a){_0x320aed[_0x077c('0x62')][_0x077c('0x66')]=_0x15890a['id'];return db[_0x077c('0x6f')][_0x077c('0x5c')](_0x320aed['body']);}})[_0x077c('0x36')](respondWithResult(_0x207cc2,null))[_0x077c('0x29')](handleError(_0x207cc2,null));};exports[_0x077c('0x70')]=function(_0x1f0419,_0x27bc06,_0x45b264){var _0x4bee6b={'raw':![],'where':{}};var _0x435a9c={};var _0x4e957f={'count':0x0,'rows':[]};return db[_0x077c('0x40')][_0x077c('0x69')]({'where':{'id':_0x1f0419[_0x077c('0x63')]['id']}})['then'](handleEntityNotFound(_0x27bc06,null))['then'](function(_0x353c4f){if(_0x353c4f){_0x435a9c['model']=_[_0x077c('0x46')](db[_0x077c('0x6f')][_0x077c('0x41')]);_0x435a9c['query']=_['keys'](_0x1f0419[_0x077c('0x45')]);_0x435a9c[_0x077c('0x47')]=_[_0x077c('0x48')](_0x435a9c['model'],_0x435a9c[_0x077c('0x45')]);_0x4bee6b[_0x077c('0x49')]=_['intersection'](_0x435a9c[_0x077c('0x44')],qs[_0x077c('0x59')](_0x1f0419[_0x077c('0x45')][_0x077c('0x59')]));_0x4bee6b[_0x077c('0x49')]=_0x4bee6b[_0x077c('0x49')][_0x077c('0x5a')]?_0x4bee6b[_0x077c('0x49')]:_0x435a9c[_0x077c('0x44')];if(!_0x1f0419[_0x077c('0x45')]['hasOwnProperty']('nolimit')){_0x4bee6b[_0x077c('0x2f')]=qs[_0x077c('0x2f')](_0x1f0419[_0x077c('0x45')][_0x077c('0x2f')]);_0x4bee6b['offset']=qs['offset'](_0x1f0419['query'][_0x077c('0x2e')]);}_0x4bee6b[_0x077c('0x4b')]=qs[_0x077c('0x4c')](_0x1f0419[_0x077c('0x45')]['sort']);_0x4bee6b[_0x077c('0x4f')]=qs[_0x077c('0x47')](_['pick'](_0x1f0419['query'],_0x435a9c[_0x077c('0x47')]));_0x4bee6b[_0x077c('0x4f')][_0x077c('0x66')]=_0x353c4f['id'];if(_0x1f0419['query'][_0x077c('0x4e')]){_0x4bee6b[_0x077c('0x4f')]=_[_0x077c('0x50')](_0x4bee6b[_0x077c('0x4f')],{'$or':_[_0x077c('0x3f')](_0x4bee6b[_0x077c('0x49')],function(_0x296205){var _0x3c9ce8={};_0x3c9ce8[_0x296205]={'$like':'%'+_0x1f0419[_0x077c('0x45')]['filter']+'%'};return _0x3c9ce8;})});}_0x4bee6b=_['merge']({},_0x4bee6b,_0x1f0419[_0x077c('0x52')]);return db[_0x077c('0x6f')]['count']({'where':_0x4bee6b[_0x077c('0x4f')]})['then'](function(_0xcd6141){_0x4e957f[_0x077c('0x2d')]=_0xcd6141;if(_0x1f0419[_0x077c('0x45')][_0x077c('0x53')]){_0x4bee6b[_0x077c('0x54')]=[{'all':!![]}];}return db[_0x077c('0x6f')]['findAll'](_0x4bee6b);})[_0x077c('0x36')](function(_0x5cd7a1){_0x4e957f['rows']=_0x5cd7a1;return _0x4e957f;});}})[_0x077c('0x36')](respondWithFilteredResult(_0x27bc06,_0x4bee6b))['catch'](handleError(_0x27bc06,null));};exports[_0x077c('0x71')]=function(_0x15ca2c,_0x418180,_0x2425d6){return db[_0x077c('0x40')]['find']({'where':{'id':_0x15ca2c[_0x077c('0x63')]['id']}})[_0x077c('0x36')](handleEntityNotFound(_0x418180,null))[_0x077c('0x36')](function(_0x31d77a){if(_0x31d77a){return _0x31d77a['removeAnswers'](_0x15ca2c[_0x077c('0x45')][_0x077c('0x6d')]);}})[_0x077c('0x36')](respondWithStatusCode(_0x418180,null))[_0x077c('0x29')](handleError(_0x418180,null));};exports[_0x077c('0x72')]=function(_0x2be461,_0xce6ab4,_0x2d7143){var _0x25b214={'channel':'sms'};var _0x918469=[];var _0x5ec26f=[];var _0x5e1e56={};return db[_0x077c('0x40')][_0x077c('0x5b')]({'where':{'id':_0x2be461[_0x077c('0x63')]['id']},'include':[{'model':db[_0x077c('0x73')],'as':_0x077c('0x74')}]})[_0x077c('0x36')](handleEntityNotFound(_0xce6ab4,null))[_0x077c('0x36')](function(_0x1f8b25){_0x25b214[_0x077c('0x75')]=_0x1f8b25;_0x25b214['applications']=_[_0x077c('0x76')](_0x1f8b25[_0x077c('0x74')],['priority'],[_0x077c('0x77')]);if(_0x25b214[_0x077c('0x75')][_0x077c('0x74')]){delete _0x25b214[_0x077c('0x75')]['Applications'];}return db['CmContact'][_0x077c('0x64')]();})[_0x077c('0x36')](function(_0x27fce2){if(!_0x27fce2){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x918469=_[_0x077c('0x78')](_[_0x077c('0x46')](_0x27fce2),['createdAt',_0x077c('0x79')]);_0x5ec26f=_[_0x077c('0x78')](_[_0x077c('0x46')](_0x27fce2),[_0x077c('0x7a'),'updatedAt','CompanyId',_0x077c('0x7b')]);_0x25b214[_0x077c('0x62')]={'mapKey':_0x077c('0x7c')};if(_0x25b214[_0x077c('0x75')][_0x077c('0x43')]){switch(_0x25b214[_0x077c('0x75')][_0x077c('0x43')]){case _0x077c('0x7d'):_0x25b214[_0x077c('0x62')][_0x077c('0x7e')]=_0x2be461['body']['From'];_0x25b214[_0x077c('0x62')][_0x077c('0x62')]=_0x2be461['body']['Body'];_0x25b214[_0x077c('0x62')][_0x077c('0x7f')]=_0x2be461[_0x077c('0x62')][_0x077c('0x80')];break;case _0x077c('0x81'):_0x25b214[_0x077c('0x62')][_0x077c('0x7e')]='+'+_0x2be461['body'][_0x077c('0x82')];_0x25b214[_0x077c('0x62')][_0x077c('0x62')]=_0x2be461[_0x077c('0x62')][_0x077c('0x83')];break;case _0x077c('0x84'):_0x25b214['body']['from']=_0x2be461[_0x077c('0x62')]['from'];_0x25b214[_0x077c('0x62')][_0x077c('0x62')]=_0x2be461[_0x077c('0x62')][_0x077c('0x26')];break;case _0x077c('0x85'):_0x25b214[_0x077c('0x62')][_0x077c('0x7e')]=_0x2be461[_0x077c('0x62')][_0x077c('0x7e')];_0x25b214[_0x077c('0x62')][_0x077c('0x62')]=_0x2be461['body'][_0x077c('0x62')];_0x25b214[_0x077c('0x62')][_0x077c('0x7f')]=_0x2be461[_0x077c('0x62')][_0x077c('0x86')];break;case _0x077c('0x87'):_0x25b214['body'][_0x077c('0x7e')]=_0x2be461[_0x077c('0x62')][_0x077c('0x88')];_0x25b214[_0x077c('0x62')][_0x077c('0x62')]=_0x2be461[_0x077c('0x62')][_0x077c('0x89')];_0x25b214[_0x077c('0x62')][_0x077c('0x7f')]=_0x2be461[_0x077c('0x62')]['MessageUUID'];break;case'infobip':_0x25b214[_0x077c('0x62')]['from']='+'+_0x2be461['body'][_0x077c('0x8a')][0x0][_0x077c('0x7e')];_0x25b214['body'][_0x077c('0x62')]=_0x2be461[_0x077c('0x62')][_0x077c('0x8a')][0x0][_0x077c('0x83')];_0x25b214['body'][_0x077c('0x7f')]=_0x2be461[_0x077c('0x62')][_0x077c('0x8a')][0x0]['messageId'];break;case _0x077c('0x8b'):_0x25b214[_0x077c('0x62')][_0x077c('0x7e')]=_0x2be461[_0x077c('0x62')]['originatingAddress'];_0x25b214[_0x077c('0x62')]['body']=_0x2be461[_0x077c('0x62')][_0x077c('0x8c')][_0x077c('0x26')];break;case _0x077c('0x8d'):_0x25b214[_0x077c('0x62')][_0x077c('0x7e')]=_0x2be461[_0x077c('0x62')][_0x077c('0x8e')];_0x25b214[_0x077c('0x62')]['body']=_0x2be461[_0x077c('0x62')][_0x077c('0x83')];_0x25b214[_0x077c('0x62')][_0x077c('0x7f')]=_0x2be461['body']['replyMessageId'];break;case _0x077c('0x8f'):_0x25b214[_0x077c('0x62')]['from']=_0x2be461[_0x077c('0x62')][_0x077c('0x7e')];_0x25b214[_0x077c('0x62')][_0x077c('0x62')]=_0x2be461[_0x077c('0x62')][_0x077c('0x26')];_0x25b214[_0x077c('0x62')][_0x077c('0x7f')]=_0x2be461[_0x077c('0x62')][_0x077c('0x90')];break;}}if(_0x25b214['body']['id']){delete _0x25b214['body']['id'];}if(_[_0x077c('0x91')](_0x25b214[_0x077c('0x62')][_0x077c('0x7e')])){throw new db[(_0x077c('0x92'))]['ValidationError'](_0x077c('0x93'));}if(_[_0x077c('0x91')](_0x25b214[_0x077c('0x62')][_0x077c('0x62')])||_0x25b214[_0x077c('0x62')][_0x077c('0x62')]===''){throw new db[(_0x077c('0x92'))][(_0x077c('0x94'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x077c('0x91')](_0x25b214[_0x077c('0x62')]['mapKey'])){throw new db[(_0x077c('0x92'))][(_0x077c('0x94'))](_0x077c('0x95')+_0x5ec26f);}if(!_['includes'](_0x5ec26f,_0x25b214['body'][_0x077c('0x96')])){throw new db[(_0x077c('0x92'))]['ValidationError'](_0x077c('0x97')+_0x5ec26f);}_0x5e1e56[_0x25b214['body'][_0x077c('0x96')]]=_0x25b214[_0x077c('0x62')][_0x077c('0x7e')];return db[_0x077c('0x98')]['find']({'where':{'id':_0x25b214['account'][_0x077c('0x7b')]},'include':[{'model':db[_0x077c('0x99')],'as':_0x077c('0x9a'),'where':_0x5e1e56,'limit':0x1,'order':[[_0x077c('0x79'),_0x077c('0x9b')]]}]});})[_0x077c('0x36')](handleEntityNotFound(_0xce6ab4,null))['then'](function(_0x4c4cba){if(_0x4c4cba){_0x25b214['list']=_[_0x077c('0x9c')](_0x4c4cba,[_0x077c('0x9a')]);if(_0x4c4cba['Contacts'][_0x077c('0x5a')]){return _0x4c4cba[_0x077c('0x9a')][0x0];}var _0x2346ee=_[_0x077c('0x9d')](_0x25b214[_0x077c('0x62')],{'firstName':_0x25b214['body']['from'],'ListId':_0x4c4cba['id']});_0x2346ee[_0x25b214['body']['mapKey']]=_0x25b214['body']['from'];return db[_0x077c('0x99')][_0x077c('0x5c')](_0x2346ee,{'fields':_0x918469,'raw':!![]});}})[_0x077c('0x36')](handleEntityNotFound(_0xce6ab4,null))[_0x077c('0x36')](function(_0x443b98){if(_0x443b98){_0x25b214[_0x077c('0x9e')]=_0x443b98;var _0xf15b17={'ContactId':_0x443b98['id'],'phone':_0x25b214['body'][_0x077c('0x7e')],'SmsAccountId':_0x2be461[_0x077c('0x63')]['id']};var _0x3ede91={'ContactId':_0x443b98['id'],'SmsAccountId':_0x2be461[_0x077c('0x63')]['id'],'closed':![]};return db[_0x077c('0x9f')]['find']({'where':_0x3ede91})[_0x077c('0x36')](function(_0x578eb9){if(_0x578eb9){return[_0x578eb9,![]];}return db[_0x077c('0x9f')][_0x077c('0x5c')](_0xf15b17)[_0x077c('0x36')](function(_0x28307c){return[_0x28307c,!![]];});});}})[_0x077c('0xa0')](function(_0x52d216,_0x5dc90d){_0x25b214[_0x077c('0xa1')]=_0x52d216['get']({'plain':!![]});_0x25b214['interaction'][_0x077c('0xa2')]=![];if(_0x5dc90d){if(_0x25b214[_0x077c('0x75')]['autoclose']){_0x25b214[_0x077c('0xa3')]['push']({'id':0x0,'priority':_0x25b214[_0x077c('0xa3')][_0x077c('0x5a')]+0x1,'app':_0x077c('0xa4'),'appdata':_0x077c('0xa5'),'interval':_0x077c('0xa6')});}_0x25b214['interaction'][_0x077c('0xa2')]=!![];}return db['SmsMessage'][_0x077c('0x5c')]({'phone':_0x25b214[_0x077c('0x62')]['from'],'messageId':_0x25b214[_0x077c('0x62')][_0x077c('0x7f')],'body':_0x25b214[_0x077c('0x62')][_0x077c('0x62')],'SmsAccountId':_0x2be461[_0x077c('0x63')]['id'],'SmsInteractionId':_0x52d216['id'],'direction':'in','ContactId':_0x52d216[_0x077c('0xa7')],'AttachmentId':_0x25b214['body'][_0x077c('0xa8')]});})[_0x077c('0x36')](function(_0x58581a){_0x25b214['message']=_0x58581a;if(_0x25b214[_0x077c('0xa1')][_0x077c('0xa9')]){return db[_0x077c('0xaa')][_0x077c('0x5b')]({'attributes':['id',_0x077c('0x3b')],'where':{'id':_0x25b214[_0x077c('0xa1')][_0x077c('0xa9')]}})[_0x077c('0x36')](function(_0x426140){if(_0x426140){_0x25b214[_0x077c('0xa3')][_0x077c('0xab')]({'id':0x0,'priority':0x0,'app':_0x077c('0xac'),'appdata':_0x426140['name']+','+(_0x25b214['account'][_0x077c('0xad')]||0xa),'interval':_0x077c('0xa6')});}return respondWithRpcPromise(_0x077c('0xae'),_0x077c('0xaf'),_0x25b214);});}return respondWithRpcPromise('Start','startRouting',_0x25b214);})['then'](function(_0x31ae85){if(_0x31ae85){var _0x82ffe7=0xc8;var _0x38ce21=_0x077c('0xb0');logger[_0x077c('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x38ce21,_0x82ffe7,_0x077c('0xb1'));logger[_0x077c('0x20')](_0x077c('0xb2'),_0x38ce21,_0x82ffe7,_0x077c('0xb1'),JSON[_0x077c('0x23')](_0x31ae85));if(_0x25b214[_0x077c('0x75')][_0x077c('0x43')]===_0x077c('0x7d')){return _0xce6ab4['status'](_0x82ffe7)[_0x077c('0x30')](_0x077c('0xb3'),_0x077c('0xb4'))[_0x077c('0x3c')]('\x0a');}else{return _0xce6ab4['status'](_0x82ffe7)[_0x077c('0x32')](_0x31ae85);}}})[_0x077c('0x29')](handleError(_0xce6ab4,null));};exports['addApplications']=function(_0xad4aeb,_0x2f0463,_0x38f0f6){return db['SmsAccount'][_0x077c('0x69')]({'where':{'id':_0xad4aeb[_0x077c('0x63')]['id']}})[_0x077c('0x36')](handleEntityNotFound(_0x2f0463,null))[_0x077c('0x36')](function(_0x1819d6){if(_0x1819d6){return db[_0x077c('0xb5')][_0x077c('0xb6')](function(_0x5604c3){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0xad4aeb[_0x077c('0x63')]['id']},'transaction':_0x5604c3})[_0x077c('0x36')](function(_0xab7019){var _0x34b642=_['map'](_0xad4aeb['body'],function(_0x4f6d7a){_0x4f6d7a[_0x077c('0x66')]=_0xad4aeb[_0x077c('0x63')]['id'];return _0x4f6d7a;});return db[_0x077c('0x73')][_0x077c('0xb7')](_0x34b642,{'transaction':_0x5604c3});});})['then'](function(){return db['SmsApplication'][_0x077c('0xb8')]({'where':{'SmsAccountId':_0xad4aeb[_0x077c('0x63')]['id']},'order':_0x077c('0xb9')});});}})[_0x077c('0x36')](respondWithResult(_0x2f0463,null))[_0x077c('0x29')](handleError(_0x2f0463,null));};exports[_0x077c('0xba')]=function(_0x39b248,_0x5cd5d8,_0x2637e5){var _0x16af43={};var _0x4cfee2={};var _0x3528bd;var _0x8b54dd;return db[_0x077c('0x40')][_0x077c('0x69')]({'where':{'id':_0x39b248[_0x077c('0x63')]['id']}})[_0x077c('0x36')](handleEntityNotFound(_0x5cd5d8,null))[_0x077c('0x36')](function(_0x314ad4){if(_0x314ad4){_0x3528bd=_0x314ad4;_0x4cfee2[_0x077c('0x44')]=_[_0x077c('0x46')](db[_0x077c('0x73')]['rawAttributes']);_0x4cfee2[_0x077c('0x45')]=_['keys'](_0x39b248[_0x077c('0x45')]);_0x4cfee2['filters']=_['intersection'](_0x4cfee2[_0x077c('0x44')],_0x4cfee2[_0x077c('0x45')]);_0x16af43[_0x077c('0x49')]=_['intersection'](_0x4cfee2['model'],qs[_0x077c('0x59')](_0x39b248[_0x077c('0x45')]['fields']));_0x16af43[_0x077c('0x49')]=_0x16af43[_0x077c('0x49')][_0x077c('0x5a')]?_0x16af43[_0x077c('0x49')]:_0x4cfee2[_0x077c('0x44')];_0x16af43['order']=qs[_0x077c('0x4c')](_0x39b248[_0x077c('0x45')]['sort']);_0x16af43[_0x077c('0x4f')]=qs['filters'](_[_0x077c('0x4d')](_0x39b248[_0x077c('0x45')],_0x4cfee2['filters']));if(_0x39b248['query'][_0x077c('0x4e')]){_0x16af43[_0x077c('0x4f')]=_[_0x077c('0x50')](_0x16af43[_0x077c('0x4f')],{'$or':_[_0x077c('0x3f')](_0x16af43[_0x077c('0x49')],function(_0x3a4fc0){var _0x5a29d1={};_0x5a29d1[_0x3a4fc0]={'$like':'%'+_0x39b248['query']['filter']+'%'};return _0x5a29d1;})});}_0x16af43=_[_0x077c('0x50')]({},_0x16af43,_0x39b248[_0x077c('0x52')]);return _0x3528bd[_0x077c('0xba')](_0x16af43);}})[_0x077c('0x36')](function(_0x33ce3e){if(_0x33ce3e){_0x8b54dd=_0x33ce3e[_0x077c('0x5a')];if(!_0x39b248[_0x077c('0x45')][_0x077c('0x4a')](_0x077c('0x6a'))){_0x16af43[_0x077c('0x2f')]=qs[_0x077c('0x2f')](_0x39b248[_0x077c('0x45')][_0x077c('0x2f')]);_0x16af43[_0x077c('0x2e')]=qs['offset'](_0x39b248[_0x077c('0x45')][_0x077c('0x2e')]);}return _0x3528bd['getApplications'](_0x16af43);}})[_0x077c('0x36')](function(_0x77c3c5){if(_0x77c3c5){return _0x77c3c5?{'count':_0x8b54dd,'rows':_0x77c3c5}:null;}})[_0x077c('0x36')](respondWithResult(_0x5cd5d8,null))['catch'](handleError(_0x5cd5d8,null));};exports[_0x077c('0xbb')]=function(_0x346714,_0x19f6f7,_0x12d895){var _0x3631e3={'raw':![],'where':{}};var _0x44132b={};var _0x2f12da={'count':0x0,'rows':[]};return db['SmsAccount'][_0x077c('0x69')]({'where':{'id':_0x346714['params']['id']}})[_0x077c('0x36')](handleEntityNotFound(_0x19f6f7,null))[_0x077c('0x36')](function(_0x5cef22){if(_0x5cef22){_0x44132b[_0x077c('0x44')]=_['keys'](db['SmsInteraction'][_0x077c('0x41')]);_0x44132b[_0x077c('0x45')]=_[_0x077c('0x46')](_0x346714[_0x077c('0x45')]);_0x44132b[_0x077c('0x47')]=_['intersection'](_0x44132b[_0x077c('0x44')],_0x44132b['query']);_0x3631e3[_0x077c('0x49')]=_[_0x077c('0x48')](_0x44132b['model'],qs[_0x077c('0x59')](_0x346714[_0x077c('0x45')][_0x077c('0x59')]));_0x3631e3['attributes']=_0x3631e3[_0x077c('0x49')][_0x077c('0x5a')]?_0x3631e3[_0x077c('0x49')]:_0x44132b['model'];if(!_0x346714[_0x077c('0x45')][_0x077c('0x4a')](_0x077c('0x6a'))){_0x3631e3[_0x077c('0x2f')]=qs[_0x077c('0x2f')](_0x346714[_0x077c('0x45')][_0x077c('0x2f')]);_0x3631e3[_0x077c('0x2e')]=qs[_0x077c('0x2e')](_0x346714[_0x077c('0x45')][_0x077c('0x2e')]);}_0x3631e3[_0x077c('0x4b')]=qs[_0x077c('0x4c')](_0x346714[_0x077c('0x45')][_0x077c('0x4c')]);_0x3631e3[_0x077c('0x4f')]=qs[_0x077c('0x47')](_[_0x077c('0x4d')](_0x346714[_0x077c('0x45')],_0x44132b[_0x077c('0x47')]));_0x3631e3[_0x077c('0x4f')][_0x077c('0x66')]=_0x5cef22['id'];if(_0x346714[_0x077c('0x45')][_0x077c('0x4e')]){_0x3631e3[_0x077c('0x4f')]=_[_0x077c('0x50')](_0x3631e3[_0x077c('0x4f')],{'$or':_['map'](_0x3631e3[_0x077c('0x49')],function(_0x1ed6cc){var _0x5e03e9={};_0x5e03e9[_0x1ed6cc]={'$like':'%'+_0x346714[_0x077c('0x45')][_0x077c('0x4e')]+'%'};return _0x5e03e9;})});}_0x3631e3=_[_0x077c('0x50')]({},_0x3631e3,_0x346714['options']);return db['SmsInteraction'][_0x077c('0x2d')]({'where':_0x3631e3[_0x077c('0x4f')]})[_0x077c('0x36')](function(_0x255afe){_0x2f12da[_0x077c('0x2d')]=_0x255afe;if(_0x346714[_0x077c('0x45')][_0x077c('0x53')]){_0x3631e3['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x077c('0xaa')],'as':'Owner','attributes':[_0x077c('0x3b'),_0x077c('0xbc'),_0x077c('0xbd')],'required':![]},{'model':db[_0x077c('0xbe')],'as':'Tags','attributes':['id',_0x077c('0x3b'),_0x077c('0xbf')],'where':_0x346714[_0x077c('0x45')][_0x077c('0xc0')]?{'id':_0x346714[_0x077c('0x45')][_0x077c('0xc0')]}:undefined,'required':_0x346714['query'][_0x077c('0xc0')]?!![]:![]}];}return db[_0x077c('0x9f')][_0x077c('0x6b')](_0x3631e3);})[_0x077c('0x36')](function(_0x9acc6a){_0x2f12da['rows']=_0x9acc6a;return _0x2f12da;});}})['then'](respondWithFilteredResult(_0x19f6f7,_0x3631e3))['catch'](handleError(_0x19f6f7,null));};exports[_0x077c('0x3c')]=function(_0x4a0393,_0x4023be,_0x46e717){var _0x509c76,_0x15e38c,_0x5027a5;if(_[_0x077c('0x91')](_0x4a0393['body'][_0x077c('0x62')])||_0x4a0393[_0x077c('0x62')]['body']===''){throw new db[(_0x077c('0x92'))][(_0x077c('0x94'))](_0x077c('0xc1'));}if(_[_0x077c('0x91')](_0x4a0393[_0x077c('0x62')]['to'])){throw new db['Sequelize'][(_0x077c('0x94'))](_0x077c('0xc2'));}_0x509c76=_0x4a0393[_0x077c('0x62')]['to'];return db[_0x077c('0x40')][_0x077c('0x5b')]({'where':{'id':_0x4a0393[_0x077c('0x63')]['id']},'include':[{'model':db[_0x077c('0x98')],'as':'List','include':[{'model':db[_0x077c('0x99')],'as':_0x077c('0x9a'),'where':{'mobile':_0x509c76},'limit':0x1,'order':[[_0x077c('0x79'),_0x077c('0x9b')]]}]}]})[_0x077c('0x36')](handleEntityNotFound(_0x4023be,null))['then'](function(_0x39d1b8){if(_0x39d1b8&&_0x39d1b8[_0x077c('0xc3')]){_0x15e38c=_0x39d1b8[_0x077c('0x5e')]({'plain':!![]});if(_0x15e38c[_0x077c('0xc3')]&&_0x15e38c[_0x077c('0xc3')]['Contacts'][_0x077c('0x5a')]){return _0x15e38c[_0x077c('0xc3')]['Contacts'][0x0];}return db['CmContact'][_0x077c('0x5c')](_[_0x077c('0x9d')](_0x4a0393[_0x077c('0x62')],{'firstName':_0x509c76,'mobile':_0x509c76,'phone':_0x509c76,'ListId':_0x15e38c[_0x077c('0x7b')]}));}})[_0x077c('0x36')](handleEntityNotFound(_0x4023be,null))[_0x077c('0x36')](function(_0x21dfba){if(_0x21dfba){_0x5027a5=_0x21dfba;return db[_0x077c('0x9f')][_0x077c('0x5b')]({'where':{'ContactId':_0x5027a5['id'],'closed':![],'SmsAccountId':_0x15e38c['id']}})[_0x077c('0x36')](function(_0x4318bc){if(_0x4318bc){return[_0x4318bc,![]];}return db[_0x077c('0x9f')][_0x077c('0x5c')]({'UserId':_0x4a0393['user']['id'],'ContactId':_0x5027a5['id'],'SmsAccountId':_0x15e38c['id'],'phone':_0x509c76,'firstMsgDirection':_0x077c('0xc4'),'Messages':[_[_0x077c('0x50')](_0x4a0393[_0x077c('0x62')],{'read':![],'body':_0x4a0393[_0x077c('0x62')][_0x077c('0x62')],'phone':_0x509c76,'SmsAccountId':_0x15e38c['id'],'UserId':_0x4a0393[_0x077c('0x5d')]['id'],'ContactId':_0x5027a5['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x077c('0xc5')}]})[_0x077c('0x36')](function(_0x40210d){return[_0x40210d,!![]];});});}})['spread'](function(_0x3f20fe,_0x3a8566){if(_0x3a8566){return _0x3f20fe;}return db[_0x077c('0xc6')][_0x077c('0x5c')](_['merge'](_0x4a0393[_0x077c('0x62')],{'read':![],'body':_0x4a0393[_0x077c('0x62')][_0x077c('0x62')],'phone':_0x509c76,'SmsAccountId':_0x15e38c['id'],'SmsInteractionId':_0x3f20fe['id'],'UserId':_0x4a0393['user']['id'],'ContactId':_0x5027a5['id']}))[_0x077c('0x36')](function(_0x6673e4){_0x3f20fe[_0x077c('0xc7')][_0x077c('0xc5')]=[];_0x3f20fe[_0x077c('0xc7')][_0x077c('0xc5')][_0x077c('0xc8')](_0x6673e4[_0x077c('0xc7')]);return _0x3f20fe;});})[_0x077c('0x36')](respondWithResult(_0x4023be,null))[_0x077c('0x29')](handleError(_0x4023be,null));};exports[_0x077c('0x2b')]=function(_0x10aa37,_0x29e693,_0x4646c1){if(_0x10aa37[_0x077c('0x62')]['id']){delete _0x10aa37[_0x077c('0x62')]['id'];}console['log'](_0x077c('0xc9'),_0x10aa37[_0x077c('0x62')]);var _0x182c8e,_0x258b23,_0x319b43;return db[_0x077c('0x40')][_0x077c('0x5b')]({'where':{'id':_0x10aa37[_0x077c('0x63')]['id']}})['then'](handleEntityNotFound(_0x29e693,null))[_0x077c('0x36')](function(_0x57be20){if(_0x57be20){_0x319b43=_0x57be20;logger[_0x077c('0x20')](_0x077c('0x21'),_0x077c('0x2b'),'received\x20delivery\x20report\x20from',_0x57be20[_0x077c('0x43')],util[_0x077c('0xca')](_0x10aa37[_0x077c('0x62')],{'showHidden':![],'depth':null}));switch(_0x57be20[_0x077c('0x43')]){case'skebby':if(_0x10aa37[_0x077c('0x62')][_0x077c('0xcb')]&&_0x10aa37[_0x077c('0x62')]['status']){_0x258b23=_0x10aa37[_0x077c('0x62')][_0x077c('0x2b')];return db[_0x077c('0xc6')][_0x077c('0x5b')]({'where':{'messageId':_0x10aa37[_0x077c('0x62')]['skebby_dispatch_id']}});}break;case _0x077c('0x84'):if(_0x10aa37[_0x077c('0x62')][_0x077c('0xcc')]&&_0x10aa37[_0x077c('0x62')][_0x077c('0xcd')]){_0x258b23=_0x10aa37['body']['statusInt'];return db[_0x077c('0xc6')][_0x077c('0x5b')]({'where':{'messageId':_0x10aa37[_0x077c('0x62')][_0x077c('0xcc')]}});}break;case _0x077c('0x85'):if(_0x10aa37[_0x077c('0x62')][_0x077c('0x86')]&&_0x10aa37[_0x077c('0x62')][_0x077c('0xce')]){_0x258b23=_0x10aa37['body']['status_code'];return db['SmsMessage']['find']({'where':{'messageId':_0x10aa37[_0x077c('0x62')][_0x077c('0x86')]}});}break;case _0x077c('0xcf'):var _0x338185=_0x10aa37[_0x077c('0x62')][_0x077c('0x8a')][0x0];if(_0x338185[_0x077c('0x7f')]&&_0x338185[_0x077c('0x2b')]['groupName']==='DELIVERED'){_0x258b23=_0x338185[_0x077c('0x2b')][_0x077c('0xd0')];return db[_0x077c('0xc6')][_0x077c('0x5b')]({'where':{'messageId':_0x338185['messageId']}});}break;case'clickatell':if(_0x10aa37['body'][_0x077c('0x7f')]&&_0x10aa37[_0x077c('0x62')][_0x077c('0x2b')]){_0x258b23=_0x10aa37['body'][_0x077c('0x2b')];return db[_0x077c('0xc6')][_0x077c('0x5b')]({'where':{'messageId':_0x10aa37[_0x077c('0x62')][_0x077c('0x7f')]}});}break;case _0x077c('0x8f'):if(_0x10aa37[_0x077c('0x62')]['redif']&&_0x10aa37['body'][_0x077c('0x2b')]){_0x258b23=_0x10aa37[_0x077c('0x62')][_0x077c('0x2b')];return db[_0x077c('0xc6')][_0x077c('0x5b')]({'where':{'messageId':_0x10aa37['body'][_0x077c('0xd1')]}});}break;}}})[_0x077c('0x36')](handleEntityNotFound(_0x29e693,null))[_0x077c('0x36')](function(_0x21f91d){if(_0x21f91d){_0x182c8e=_0x21f91d;switch(_0x319b43[_0x077c('0x43')]){case _0x077c('0x81'):if(_0x258b23==='DELIVERED'){return _0x182c8e[_0x077c('0x35')]({'read':!![]});}else{logger[_0x077c('0x24')](_0x077c('0x21'),_0x077c('0x2b'),_0x077c('0x81'),util['inspect'](_0x10aa37[_0x077c('0x62')],{'showHidden':![],'depth':null}));}break;case _0x077c('0x84'):if(_0x258b23==='1'){return _0x182c8e[_0x077c('0x35')]({'read':!![]});}else{logger[_0x077c('0x24')](_0x077c('0x21'),_0x077c('0x2b'),_0x077c('0x81'),util[_0x077c('0xca')](_0x10aa37['body'],{'showHidden':![],'depth':null}));}break;case _0x077c('0x85'):if(!_0x10aa37[_0x077c('0x62')][_0x077c('0xd2')]&&_0x258b23>=0xc8&&_0x258b23<=0xce){return _0x182c8e[_0x077c('0x35')]({'read':!![]});}else{logger[_0x077c('0x24')](_0x077c('0x21'),_0x077c('0x2b'),_0x077c('0x85'),util[_0x077c('0xca')](_0x10aa37[_0x077c('0x62')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x22df14=_0x10aa37[_0x077c('0x62')]['results'][0x0];if(_0x22df14[_0x077c('0x2b')]['groupName']===_0x077c('0xd3')){return _0x182c8e[_0x077c('0x35')]({'read':!![]});}else{logger[_0x077c('0x24')](_0x077c('0x21'),_0x077c('0x2b'),_0x077c('0xcf'),util[_0x077c('0xca')](_0x10aa37[_0x077c('0x62')],{'showHidden':![],'depth':null}));}break;case _0x077c('0x8d'):if(_0x258b23==_0x077c('0xd4')||_0x258b23==_0x077c('0xd5')){return _0x182c8e[_0x077c('0x35')]({'read':!![]});}else{logger['error'](_0x077c('0x21'),_0x077c('0x2b'),_0x077c('0x8d'),util[_0x077c('0xca')](_0x10aa37[_0x077c('0x62')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x258b23===_0x077c('0xd6')||_0x258b23==='ACCEPTD'){return _0x182c8e[_0x077c('0x35')]({'read':!![]});}else{logger['error'](_0x077c('0x21'),_0x077c('0x2b'),'intelepeer',util[_0x077c('0xca')](_0x10aa37['body'],{'showHidden':![],'depth':null}));}break;}return _0x182c8e;}})[_0x077c('0x36')](respondWithResult(_0x29e693,null))[_0x077c('0x29')](handleError(_0x29e693,null));};exports[_0x077c('0xd7')]=function(_0x3d5b63,_0x3eabd4,_0x3b4c6d){var _0xc39383,_0x4be2e1,_0x41d495;return db['SmsAccount'][_0x077c('0x5b')]({'where':{'id':_0x3d5b63[_0x077c('0x63')]['id']}})[_0x077c('0x36')](handleEntityNotFound(_0x3eabd4,null))[_0x077c('0x36')](function(_0x1ebb37){if(_0x1ebb37){_0x41d495=_0x1ebb37;logger[_0x077c('0x20')](_0x077c('0x21'),_0x077c('0x2b'),_0x077c('0xd8'),_0x1ebb37[_0x077c('0x43')],util[_0x077c('0xca')](_0x3d5b63[_0x077c('0x45')],{'showHidden':![],'depth':null}));switch(_0x1ebb37[_0x077c('0x43')]){case _0x077c('0x8b'):if(_0x3d5b63[_0x077c('0x45')][_0x077c('0xd9')]&&_0x3d5b63[_0x077c('0x45')][_0x077c('0xda')]){_0x4be2e1=_0x3d5b63[_0x077c('0x45')][_0x077c('0xda')];return db[_0x077c('0xc6')][_0x077c('0x5b')]({'where':{'messageId':_0x3d5b63[_0x077c('0x45')][_0x077c('0xd9')]}});}break;}}})['then'](handleEntityNotFound(_0x3eabd4,null))['then'](function(_0x4b7005){if(_0x4b7005){_0xc39383=_0x4b7005;switch(_0x41d495['type']){case _0x077c('0x8b'):if(_0x4be2e1==='2'||_0x4be2e1==='6'){return _0xc39383[_0x077c('0x35')]({'read':!![]});}else{logger[_0x077c('0x24')](_0x077c('0x21'),'status',_0x077c('0x8b'),util[_0x077c('0xca')](_0x3d5b63[_0x077c('0x45')],{'showHidden':![],'depth':null}));};break;}return _0xc39383;}})[_0x077c('0x36')](respondWithResult(_0x3eabd4,null))['catch'](handleError(_0x3eabd4,null));};exports['addAgents']=function(_0xa5d76d,_0xe0169a,_0x8b368c){return db[_0x077c('0x40')][_0x077c('0x5b')]({'where':{'id':_0xa5d76d['params']['id']}})['then'](handleEntityNotFound(_0xe0169a,null))['then'](function(_0x5803dd){if(_0x5803dd){return _0x5803dd['addAgents'](_0xa5d76d[_0x077c('0x62')]['ids'],_[_0x077c('0x9c')](_0xa5d76d[_0x077c('0x62')],['ids','id'])||{})[_0x077c('0xa0')](function(_0x9a43a0){for(var _0x2cae2e=0x0;_0x2cae2e<_0xa5d76d[_0x077c('0x62')][_0x077c('0x6d')][_0x077c('0x5a')];_0x2cae2e+=0x1){socket[_0x077c('0xdb')](_0x077c('0xdc'),{'UserId':_0xa5d76d['body']['ids'][_0x2cae2e],'SmsAccountId':_0xa5d76d[_0x077c('0x63')]['id']});}return _0x9a43a0;});}})[_0x077c('0x36')](respondWithResult(_0xe0169a,null))['catch'](handleError(_0xe0169a,null));};exports[_0x077c('0xdd')]=function(_0x3347d9,_0x45e45f,_0xf0404){return db[_0x077c('0x40')][_0x077c('0x5b')]({'where':{'id':_0x3347d9['params']['id']}})[_0x077c('0x36')](handleEntityNotFound(_0x45e45f,null))[_0x077c('0x36')](function(_0x4ecd28){if(_0x4ecd28){return _0x4ecd28[_0x077c('0xdd')](_0x3347d9[_0x077c('0x45')]['ids'])[_0x077c('0x36')](function(){if(_['isArray'](_0x3347d9['query'][_0x077c('0x6d')])){for(var _0x13aa58=0x0;_0x13aa58<_0x3347d9['query'][_0x077c('0x6d')]['length'];_0x13aa58+=0x1){socket['emit'](_0x077c('0xde'),{'UserId':Number(_0x3347d9['query'][_0x077c('0x6d')][_0x13aa58]),'SmsAccountId':Number(_0x3347d9['params']['id'])});}}else{socket[_0x077c('0xdb')](_0x077c('0xde'),{'UserId':Number(_0x3347d9[_0x077c('0x45')]['ids']),'SmsAccountId':Number(_0x3347d9[_0x077c('0x63')]['id'])});}});}})[_0x077c('0x36')](respondWithStatusCode(_0x45e45f,null))[_0x077c('0x29')](handleError(_0x45e45f,null));};exports[_0x077c('0xdf')]=function(_0xd3ab34,_0x237553,_0x4808c9){var _0x47c627={};var _0xafb684={};var _0x1d5308;var _0x19e642;return db[_0x077c('0x40')]['findOne']({'where':{'id':_0xd3ab34[_0x077c('0x63')]['id']}})[_0x077c('0x36')](handleEntityNotFound(_0x237553,null))[_0x077c('0x36')](function(_0x380006){if(_0x380006){_0x1d5308=_0x380006;_0xafb684[_0x077c('0x44')]=_[_0x077c('0x46')](db[_0x077c('0xaa')][_0x077c('0x41')]);_0xafb684[_0x077c('0x45')]=_['keys'](_0xd3ab34[_0x077c('0x45')]);_0xafb684[_0x077c('0x47')]=_['intersection'](_0xafb684[_0x077c('0x44')],_0xafb684[_0x077c('0x45')]);_0x47c627[_0x077c('0x49')]=_[_0x077c('0x48')](_0xafb684[_0x077c('0x44')],qs[_0x077c('0x59')](_0xd3ab34[_0x077c('0x45')][_0x077c('0x59')]));_0x47c627[_0x077c('0x49')]=_0x47c627[_0x077c('0x49')][_0x077c('0x5a')]?_0x47c627['attributes']:_0xafb684[_0x077c('0x44')];_0x47c627['order']=qs[_0x077c('0x4c')](_0xd3ab34[_0x077c('0x45')][_0x077c('0x4c')]);_0x47c627[_0x077c('0x4f')]=qs[_0x077c('0x47')](_[_0x077c('0x4d')](_0xd3ab34['query'],_0xafb684[_0x077c('0x47')]));if(_0xd3ab34[_0x077c('0x45')][_0x077c('0x4e')]){_0x47c627[_0x077c('0x4f')]=_['merge'](_0x47c627[_0x077c('0x4f')],{'$or':_[_0x077c('0x3f')](_0x47c627[_0x077c('0x49')],function(_0x1ac528){var _0x1411d0={};_0x1411d0[_0x1ac528]={'$like':'%'+_0xd3ab34[_0x077c('0x45')]['filter']+'%'};return _0x1411d0;})});}_0x47c627=_[_0x077c('0x50')]({},_0x47c627,_0xd3ab34[_0x077c('0x52')]);return _0x1d5308[_0x077c('0xdf')](_0x47c627);}})[_0x077c('0x36')](function(_0x35a645){if(_0x35a645){_0x19e642=_0x35a645[_0x077c('0x5a')];if(!_0xd3ab34['query'][_0x077c('0x4a')](_0x077c('0x6a'))){_0x47c627['limit']=qs[_0x077c('0x2f')](_0xd3ab34['query'][_0x077c('0x2f')]);_0x47c627[_0x077c('0x2e')]=qs['offset'](_0xd3ab34[_0x077c('0x45')][_0x077c('0x2e')]);}return _0x1d5308[_0x077c('0xdf')](_0x47c627);}})[_0x077c('0x36')](function(_0x2b7522){if(_0x2b7522){return _0x2b7522?{'count':_0x19e642,'rows':_0x2b7522}:null;}})['then'](respondWithResult(_0x237553,null))[_0x077c('0x29')](handleError(_0x237553,null));}; \ No newline at end of file +var _0x489a=['Applications','account','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','from','Body','MessageSid','skebby','sender','text','clicksend','messageId','plivo','Text','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','sequelize','transaction','bulkCreate','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','List','out','Messages','dataValues','endpoint\x20/status\x20POST\x20/','debug','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','message_id','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','statusGet','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','client','http','request','info','stringify','error','message','SmsAccount,\x20%s,\x20%s','request\x20sent','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','name','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','type','options','count','includeAll','rows','params','filtears','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','addDisposition','SmsAccountId','findOne','Disposition','nolimit','pick','include','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','sms','SmsApplication'];(function(_0xd4470d,_0x47318d){var _0x5544c5=function(_0x3486cb){while(--_0x3486cb){_0xd4470d['push'](_0xd4470d['shift']());}};_0x5544c5(++_0x47318d);}(_0x489a,0x72));var _0xa489=function(_0x2a0755,_0xdf6bac){_0x2a0755=_0x2a0755-0x0;var _0x3eaf4f=_0x489a[_0x2a0755];return _0x3eaf4f;};'use strict';var pdf=require(_0xa489('0x0'));var emlformat=require(_0xa489('0x1'));var rimraf=require(_0xa489('0x2'));var zipdir=require(_0xa489('0x3'));var jsonpatch=require(_0xa489('0x4'));var rp=require(_0xa489('0x5'));var moment=require(_0xa489('0x6'));var BPromise=require(_0xa489('0x7'));var Mustache=require(_0xa489('0x8'));var util=require(_0xa489('0x9'));var path=require(_0xa489('0xa'));var sox=require(_0xa489('0xb'));var csv=require(_0xa489('0xc'));var ejs=require(_0xa489('0xd'));var fs=require('fs');var _=require(_0xa489('0xe'));var squel=require('squel');var crypto=require(_0xa489('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xa489('0x10'));var toCsv=require(_0xa489('0xc'));var querystring=require('querystring');var Papa=require(_0xa489('0x11'));var Redis=require(_0xa489('0x12'));var authService=require(_0xa489('0x13'));var qs=require(_0xa489('0x14'));var as=require(_0xa489('0x15'));var hardwareService=require(_0xa489('0x16'));var logger=require(_0xa489('0x17'))('api');var utils=require(_0xa489('0x18'));var config=require(_0xa489('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa489('0x1a'))['db'];config[_0xa489('0x1b')]=_[_0xa489('0x1c')](config['redis'],{'host':_0xa489('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa489('0x1b')]));require(_0xa489('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xa489('0x1f')][_0xa489('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x1faee3,_0x34ec8f,_0x260c86,_0x4f7a81){return new BPromise(function(_0x1f1c50,_0x241735){var _0x332361=_0x4f7a81||client;return _0x332361[_0xa489('0x21')](_0x1faee3,_0x260c86)['then'](function(_0x2d4fe6){logger[_0xa489('0x22')]('SmsAccount,\x20%s,\x20%s',_0x34ec8f,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x34ec8f,'request\x20sent',JSON[_0xa489('0x23')](_0x2d4fe6));if(_0x2d4fe6[_0xa489('0x24')]){if(_0x2d4fe6['error']['code']===0x1f4){logger[_0xa489('0x24')]('SmsAccount,\x20%s,\x20%s',_0x34ec8f,_0x2d4fe6['error'][_0xa489('0x25')]);return _0x241735(_0x2d4fe6[_0xa489('0x24')][_0xa489('0x25')]);}logger['error'](_0xa489('0x26'),_0x34ec8f,_0x2d4fe6[_0xa489('0x24')][_0xa489('0x25')]);return _0x1f1c50(_0x2d4fe6['error'][_0xa489('0x25')]);}else{logger[_0xa489('0x22')]('SmsAccount,\x20%s,\x20%s',_0x34ec8f,_0xa489('0x27'));_0x1f1c50(_0x2d4fe6[_0xa489('0x28')][_0xa489('0x25')]);}})[_0xa489('0x29')](function(_0x5988ad){logger[_0xa489('0x24')](_0xa489('0x26'),_0x34ec8f,_0x5988ad);_0x241735(_0x5988ad);});});}function respondWithStatusCode(_0x4c42a0,_0x3153a5){_0x3153a5=_0x3153a5||0xcc;return function(_0x33dfd5){if(_0x33dfd5){return _0x4c42a0[_0xa489('0x2a')](_0x3153a5);}return _0x4c42a0[_0xa489('0x2b')](_0x3153a5)[_0xa489('0x2c')]();};}function respondWithResult(_0x4e3e84,_0x229343){_0x229343=_0x229343||0xc8;return function(_0x1e65ac){if(_0x1e65ac){return _0x4e3e84['status'](_0x229343)['json'](_0x1e65ac);}};}function respondWithFilteredResult(_0x408855,_0x5bd9f6){return function(_0x17fc82){if(_0x17fc82){var _0x5ed703=_0x17fc82['count'],_0x591400=_0x5bd9f6[_0xa489('0x2d')],_0x4521d0=_0x5bd9f6[_0xa489('0x2d')]+_0x5bd9f6[_0xa489('0x2e')],_0x29980b;if(_0x4521d0>=_0x5ed703){_0x4521d0=_0x5ed703;_0x29980b=0xc8;}else{_0x29980b=0xce;}_0x408855[_0xa489('0x2b')](_0x29980b);return _0x408855[_0xa489('0x2f')](_0xa489('0x30'),_0x591400+'-'+_0x4521d0+'/'+_0x5ed703)[_0xa489('0x31')](_0x17fc82);}return null;};}function patchUpdates(_0x26b4d4){return function(_0x4a45b5){try{jsonpatch[_0xa489('0x32')](_0x4a45b5,_0x26b4d4,!![]);}catch(_0x509553){return BPromise[_0xa489('0x33')](_0x509553);}return _0x4a45b5['save']();};}function saveUpdates(_0x48322e,_0x4d65a2){return function(_0x5e8ace){if(_0x5e8ace){return _0x5e8ace[_0xa489('0x34')](_0x48322e)[_0xa489('0x35')](function(_0x49ac67){return _0x49ac67;});}return null;};}function removeEntity(_0x3d692e,_0x297998){return function(_0x176c57){if(_0x176c57){return _0x176c57[_0xa489('0x36')]()['then'](function(){var _0x38880e=_0x176c57[_0xa489('0x37')]({'plain':!![]});var _0x3ca0ef='SmsAccounts';return db['UserProfileResource'][_0xa489('0x36')]({'where':{'type':_0x3ca0ef,'resourceId':_0x38880e['id']}})[_0xa489('0x35')](function(){return _0x176c57;});})['then'](function(){_0x3d692e[_0xa489('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x98e8f1,_0x49b8cd){return function(_0x4da7c5){if(!_0x4da7c5){_0x98e8f1[_0xa489('0x2a')](0x194);}return _0x4da7c5;};}function handleError(_0x495e06,_0x5c3607){_0x5c3607=_0x5c3607||0x1f4;return function(_0x210e9d){logger[_0xa489('0x24')](_0x210e9d['stack']);if(_0x210e9d[_0xa489('0x38')]){delete _0x210e9d[_0xa489('0x38')];}_0x495e06[_0xa489('0x2b')](_0x5c3607)['send'](_0x210e9d);};}exports['index']=function(_0x22e6fb,_0x2b7403){var _0x102c97={'include':[{'model':db[_0xa489('0x39')],'as':_0xa489('0x3a')}]},_0x5daf99={},_0x5e3aca={'count':0x0,'rows':[]};var _0x2dcff9=_[_0xa489('0x3b')](db[_0xa489('0x3c')][_0xa489('0x3d')],function(_0x9f9d7e){return{'name':_0x9f9d7e[_0xa489('0x3e')],'type':_0x9f9d7e['type']['key']};});_0x5daf99[_0xa489('0x3f')]=_[_0xa489('0x3b')](_0x2dcff9,_0xa489('0x38'));_0x5daf99[_0xa489('0x40')]=_[_0xa489('0x41')](_0x22e6fb[_0xa489('0x40')]);_0x5daf99[_0xa489('0x42')]=_[_0xa489('0x43')](_0x5daf99[_0xa489('0x3f')],_0x5daf99['query']);_0x102c97[_0xa489('0x44')]=_[_0xa489('0x43')](_0x5daf99[_0xa489('0x3f')],qs[_0xa489('0x45')](_0x22e6fb['query'][_0xa489('0x45')]));_0x102c97[_0xa489('0x44')]=_0x102c97[_0xa489('0x44')][_0xa489('0x46')]?_0x102c97['attributes']:_0x5daf99[_0xa489('0x3f')];if(!_0x22e6fb[_0xa489('0x40')][_0xa489('0x47')]('nolimit')){_0x102c97['limit']=qs[_0xa489('0x2e')](_0x22e6fb['query'][_0xa489('0x2e')]);_0x102c97[_0xa489('0x2d')]=qs[_0xa489('0x2d')](_0x22e6fb[_0xa489('0x40')]['offset']);}_0x102c97[_0xa489('0x48')]=qs['sort'](_0x22e6fb[_0xa489('0x40')][_0xa489('0x49')]);_0x102c97['where']=qs[_0xa489('0x42')](_['pick'](_0x22e6fb[_0xa489('0x40')],_0x5daf99[_0xa489('0x42')]),_0x2dcff9);if(_0x22e6fb[_0xa489('0x40')][_0xa489('0x4a')]){_0x102c97[_0xa489('0x4b')]=_[_0xa489('0x4c')](_0x102c97[_0xa489('0x4b')],{'$or':_[_0xa489('0x3b')](_0x2dcff9,function(_0x213d64){if(_0x213d64[_0xa489('0x4d')]!=='VIRTUAL'){var _0x47b354={};_0x47b354[_0x213d64[_0xa489('0x38')]]={'$like':'%'+_0x22e6fb['query']['filter']+'%'};return _0x47b354;}})});}_0x102c97=_['merge']({},_0x102c97,_0x22e6fb[_0xa489('0x4e')]);var _0x59e028={'where':_0x102c97[_0xa489('0x4b')]};return db['SmsAccount'][_0xa489('0x4f')](_0x59e028)[_0xa489('0x35')](function(_0x231a11){_0x5e3aca[_0xa489('0x4f')]=_0x231a11;if(_0x22e6fb[_0xa489('0x40')][_0xa489('0x50')]){_0x102c97['include']=[{'all':!![]}];}return db[_0xa489('0x3c')]['findAll'](_0x102c97);})[_0xa489('0x35')](function(_0x2b464f){_0x5e3aca[_0xa489('0x51')]=_0x2b464f;return _0x5e3aca;})[_0xa489('0x35')](respondWithFilteredResult(_0x2b7403,_0x102c97))[_0xa489('0x29')](handleError(_0x2b7403,null));};exports['show']=function(_0xc65376,_0xbf1467){var _0x249856={'raw':![],'where':{'id':_0xc65376[_0xa489('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0xa489('0x3a')}]},_0x144b45={};_0x144b45[_0xa489('0x3f')]=_[_0xa489('0x41')](db[_0xa489('0x3c')]['rawAttributes']);_0x144b45[_0xa489('0x40')]=_[_0xa489('0x41')](_0xc65376[_0xa489('0x40')]);_0x144b45[_0xa489('0x53')]=_['intersection'](_0x144b45[_0xa489('0x3f')],_0x144b45[_0xa489('0x40')]);_0x249856[_0xa489('0x44')]=_[_0xa489('0x43')](_0x144b45['model'],qs['fields'](_0xc65376[_0xa489('0x40')][_0xa489('0x45')]));_0x249856[_0xa489('0x44')]=_0x249856[_0xa489('0x44')]['length']?_0x249856[_0xa489('0x44')]:_0x144b45[_0xa489('0x3f')];if(_0xc65376[_0xa489('0x40')][_0xa489('0x50')]){_0x249856['include']=[{'all':!![]}];}_0x249856=_[_0xa489('0x4c')]({},_0x249856,_0xc65376[_0xa489('0x4e')]);return db[_0xa489('0x3c')]['find'](_0x249856)['then'](handleEntityNotFound(_0xbf1467,null))[_0xa489('0x35')](respondWithResult(_0xbf1467,null))['catch'](handleError(_0xbf1467,null));};exports[_0xa489('0x54')]=function(_0x41214e,_0xd1cf70){return db[_0xa489('0x3c')][_0xa489('0x54')](_0x41214e['body'],{})[_0xa489('0x35')](function(_0x7d69e5){var _0x4eb4f7=_0x41214e['user'][_0xa489('0x37')]({'plain':!![]});if(!_0x4eb4f7)throw new Error(_0xa489('0x55'));if(_0x4eb4f7[_0xa489('0x56')]===_0xa489('0x57')){var _0x3b9ed0=_0x7d69e5[_0xa489('0x37')]({'plain':!![]});var _0x280d88='SmsAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x280d88,'userProfileId':_0x4eb4f7[_0xa489('0x58')]},'raw':!![]})['then'](function(_0x5318ec){if(_0x5318ec&&_0x5318ec[_0xa489('0x59')]===0x0){return db[_0xa489('0x5a')][_0xa489('0x54')]({'name':_0x3b9ed0[_0xa489('0x38')],'resourceId':_0x3b9ed0['id'],'type':_0x5318ec[_0xa489('0x38')],'sectionId':_0x5318ec['id']},{})['then'](function(){return _0x7d69e5;});}else{return _0x7d69e5;}})[_0xa489('0x29')](function(_0x27f34d){logger[_0xa489('0x24')](_0xa489('0x5b'),_0x27f34d);throw _0x27f34d;});}return _0x7d69e5;})[_0xa489('0x35')](respondWithResult(_0xd1cf70,0xc9))[_0xa489('0x29')](handleError(_0xd1cf70,null));};exports['update']=function(_0x38bab8,_0x6b15da){if(_0x38bab8[_0xa489('0x5c')]['id']){delete _0x38bab8['body']['id'];}return db[_0xa489('0x3c')][_0xa489('0x5d')]({'where':{'id':_0x38bab8['params']['id']},'include':[{'model':db[_0xa489('0x39')],'as':_0xa489('0x3a')}]})[_0xa489('0x35')](handleEntityNotFound(_0x6b15da,null))['then'](saveUpdates(_0x38bab8[_0xa489('0x5c')],null))[_0xa489('0x35')](respondWithResult(_0x6b15da,null))[_0xa489('0x29')](handleError(_0x6b15da,null));};exports['destroy']=function(_0x56e58d,_0x4af3fd){return db[_0xa489('0x3c')][_0xa489('0x5d')]({'where':{'id':_0x56e58d['params']['id']}})[_0xa489('0x35')](handleEntityNotFound(_0x4af3fd,null))[_0xa489('0x35')](removeEntity(_0x4af3fd,null))['catch'](handleError(_0x4af3fd,null));};exports[_0xa489('0x5e')]=function(_0x4ad9e5,_0x4832ec){return db[_0xa489('0x3c')][_0xa489('0x5e')]()['then'](respondWithResult(_0x4832ec,null))['catch'](handleError(_0x4832ec,null));};exports[_0xa489('0x5f')]=function(_0x36da22,_0x55cc5c,_0x122341){if(_0x36da22[_0xa489('0x5c')]['id']){delete _0x36da22['body']['id'];}return db['SmsAccount'][_0xa489('0x5d')]({'where':{'id':_0x36da22[_0xa489('0x52')]['id']}})[_0xa489('0x35')](handleEntityNotFound(_0x55cc5c,null))[_0xa489('0x35')](function(_0x41fc6e){if(_0x41fc6e){_0x36da22[_0xa489('0x5c')][_0xa489('0x60')]=_0x41fc6e['id'];return db['Disposition'][_0xa489('0x54')](_0x36da22[_0xa489('0x5c')]);}})['then'](respondWithResult(_0x55cc5c,null))[_0xa489('0x29')](handleError(_0x55cc5c,null));};exports['getDispositions']=function(_0x35ac45,_0x475494,_0xe5740){var _0x5ab7c5={'raw':![],'where':{}};var _0x36f2ae={};var _0xe63295={'count':0x0,'rows':[]};return db[_0xa489('0x3c')][_0xa489('0x61')]({'where':{'id':_0x35ac45['params']['id']}})[_0xa489('0x35')](handleEntityNotFound(_0x475494,null))[_0xa489('0x35')](function(_0x38e93e){if(_0x38e93e){_0x36f2ae[_0xa489('0x3f')]=_['keys'](db[_0xa489('0x62')][_0xa489('0x3d')]);_0x36f2ae[_0xa489('0x40')]=_[_0xa489('0x41')](_0x35ac45['query']);_0x36f2ae[_0xa489('0x42')]=_[_0xa489('0x43')](_0x36f2ae[_0xa489('0x3f')],_0x36f2ae['query']);_0x5ab7c5[_0xa489('0x44')]=_['intersection'](_0x36f2ae[_0xa489('0x3f')],qs[_0xa489('0x45')](_0x35ac45[_0xa489('0x40')]['fields']));_0x5ab7c5[_0xa489('0x44')]=_0x5ab7c5[_0xa489('0x44')]['length']?_0x5ab7c5[_0xa489('0x44')]:_0x36f2ae['model'];if(!_0x35ac45[_0xa489('0x40')][_0xa489('0x47')](_0xa489('0x63'))){_0x5ab7c5[_0xa489('0x2e')]=qs[_0xa489('0x2e')](_0x35ac45['query']['limit']);_0x5ab7c5[_0xa489('0x2d')]=qs[_0xa489('0x2d')](_0x35ac45[_0xa489('0x40')][_0xa489('0x2d')]);}_0x5ab7c5['order']=qs['sort'](_0x35ac45[_0xa489('0x40')]['sort']);_0x5ab7c5[_0xa489('0x4b')]=qs[_0xa489('0x42')](_[_0xa489('0x64')](_0x35ac45[_0xa489('0x40')],_0x36f2ae[_0xa489('0x42')]));_0x5ab7c5[_0xa489('0x4b')]['SmsAccountId']=_0x38e93e['id'];if(_0x35ac45[_0xa489('0x40')][_0xa489('0x4a')]){_0x5ab7c5[_0xa489('0x4b')]=_[_0xa489('0x4c')](_0x5ab7c5[_0xa489('0x4b')],{'$or':_[_0xa489('0x3b')](_0x5ab7c5[_0xa489('0x44')],function(_0x52c6f6){var _0x518799={};_0x518799[_0x52c6f6]={'$like':'%'+_0x35ac45[_0xa489('0x40')][_0xa489('0x4a')]+'%'};return _0x518799;})});}_0x5ab7c5=_[_0xa489('0x4c')]({},_0x5ab7c5,_0x35ac45[_0xa489('0x4e')]);return db[_0xa489('0x62')][_0xa489('0x4f')]({'where':_0x5ab7c5[_0xa489('0x4b')]})['then'](function(_0x3e1606){_0xe63295[_0xa489('0x4f')]=_0x3e1606;if(_0x35ac45[_0xa489('0x40')]['includeAll']){_0x5ab7c5[_0xa489('0x65')]=[{'all':!![]}];}return db[_0xa489('0x62')][_0xa489('0x66')](_0x5ab7c5);})[_0xa489('0x35')](function(_0x5e63ac){_0xe63295[_0xa489('0x51')]=_0x5e63ac;return _0xe63295;});}})[_0xa489('0x35')](respondWithFilteredResult(_0x475494,_0x5ab7c5))[_0xa489('0x29')](handleError(_0x475494,null));};exports['removeDispositions']=function(_0xb41605,_0xbf8f6e,_0x43312e){return db[_0xa489('0x3c')][_0xa489('0x5d')]({'where':{'id':_0xb41605['params']['id']}})[_0xa489('0x35')](handleEntityNotFound(_0xbf8f6e,null))[_0xa489('0x35')](function(_0x3bf014){if(_0x3bf014){return _0x3bf014[_0xa489('0x67')](_0xb41605['query'][_0xa489('0x68')]);}})[_0xa489('0x35')](respondWithStatusCode(_0xbf8f6e,null))[_0xa489('0x29')](handleError(_0xbf8f6e,null));};exports[_0xa489('0x69')]=function(_0x39015b,_0x1da414,_0x8ffdab){if(_0x39015b[_0xa489('0x5c')]['id']){delete _0x39015b['body']['id'];}return db['SmsAccount'][_0xa489('0x5d')]({'where':{'id':_0x39015b[_0xa489('0x52')]['id']}})[_0xa489('0x35')](handleEntityNotFound(_0x1da414,null))[_0xa489('0x35')](function(_0x51b94a){if(_0x51b94a){_0x39015b[_0xa489('0x5c')][_0xa489('0x60')]=_0x51b94a['id'];return db[_0xa489('0x6a')][_0xa489('0x54')](_0x39015b['body']);}})[_0xa489('0x35')](respondWithResult(_0x1da414,null))[_0xa489('0x29')](handleError(_0x1da414,null));};exports[_0xa489('0x6b')]=function(_0x49669a,_0x18bb6e,_0x150ca1){var _0x92fa86={'raw':![],'where':{}};var _0x3010c4={};var _0x432e38={'count':0x0,'rows':[]};return db[_0xa489('0x3c')][_0xa489('0x61')]({'where':{'id':_0x49669a['params']['id']}})[_0xa489('0x35')](handleEntityNotFound(_0x18bb6e,null))[_0xa489('0x35')](function(_0x2f69e0){if(_0x2f69e0){_0x3010c4[_0xa489('0x3f')]=_[_0xa489('0x41')](db[_0xa489('0x6a')]['rawAttributes']);_0x3010c4[_0xa489('0x40')]=_['keys'](_0x49669a[_0xa489('0x40')]);_0x3010c4[_0xa489('0x42')]=_[_0xa489('0x43')](_0x3010c4[_0xa489('0x3f')],_0x3010c4[_0xa489('0x40')]);_0x92fa86['attributes']=_[_0xa489('0x43')](_0x3010c4[_0xa489('0x3f')],qs[_0xa489('0x45')](_0x49669a['query'][_0xa489('0x45')]));_0x92fa86['attributes']=_0x92fa86['attributes'][_0xa489('0x46')]?_0x92fa86[_0xa489('0x44')]:_0x3010c4[_0xa489('0x3f')];if(!_0x49669a[_0xa489('0x40')][_0xa489('0x47')]('nolimit')){_0x92fa86['limit']=qs[_0xa489('0x2e')](_0x49669a[_0xa489('0x40')]['limit']);_0x92fa86[_0xa489('0x2d')]=qs[_0xa489('0x2d')](_0x49669a[_0xa489('0x40')][_0xa489('0x2d')]);}_0x92fa86[_0xa489('0x48')]=qs[_0xa489('0x49')](_0x49669a[_0xa489('0x40')]['sort']);_0x92fa86[_0xa489('0x4b')]=qs[_0xa489('0x42')](_[_0xa489('0x64')](_0x49669a[_0xa489('0x40')],_0x3010c4['filters']));_0x92fa86[_0xa489('0x4b')][_0xa489('0x60')]=_0x2f69e0['id'];if(_0x49669a['query']['filter']){_0x92fa86[_0xa489('0x4b')]=_[_0xa489('0x4c')](_0x92fa86[_0xa489('0x4b')],{'$or':_[_0xa489('0x3b')](_0x92fa86['attributes'],function(_0xfb9353){var _0x39c32a={};_0x39c32a[_0xfb9353]={'$like':'%'+_0x49669a[_0xa489('0x40')][_0xa489('0x4a')]+'%'};return _0x39c32a;})});}_0x92fa86=_[_0xa489('0x4c')]({},_0x92fa86,_0x49669a[_0xa489('0x4e')]);return db[_0xa489('0x6a')]['count']({'where':_0x92fa86[_0xa489('0x4b')]})['then'](function(_0x54a342){_0x432e38[_0xa489('0x4f')]=_0x54a342;if(_0x49669a[_0xa489('0x40')]['includeAll']){_0x92fa86[_0xa489('0x65')]=[{'all':!![]}];}return db[_0xa489('0x6a')][_0xa489('0x66')](_0x92fa86);})[_0xa489('0x35')](function(_0x178f8f){_0x432e38['rows']=_0x178f8f;return _0x432e38;});}})[_0xa489('0x35')](respondWithFilteredResult(_0x18bb6e,_0x92fa86))[_0xa489('0x29')](handleError(_0x18bb6e,null));};exports[_0xa489('0x6c')]=function(_0x1d1b6b,_0x2b9709,_0x16c82b){return db['SmsAccount'][_0xa489('0x5d')]({'where':{'id':_0x1d1b6b[_0xa489('0x52')]['id']}})[_0xa489('0x35')](handleEntityNotFound(_0x2b9709,null))[_0xa489('0x35')](function(_0x14b295){if(_0x14b295){return _0x14b295[_0xa489('0x6c')](_0x1d1b6b[_0xa489('0x40')]['ids']);}})['then'](respondWithStatusCode(_0x2b9709,null))[_0xa489('0x29')](handleError(_0x2b9709,null));};exports['notify']=function(_0x5572bc,_0x57f102,_0x3eb59b){var _0x191ca1={'channel':_0xa489('0x6d')};var _0x115bb6=[];var _0x58bd20=[];var _0x3056c1={};return db['SmsAccount'][_0xa489('0x5d')]({'where':{'id':_0x5572bc[_0xa489('0x52')]['id']},'include':[{'model':db[_0xa489('0x6e')],'as':_0xa489('0x6f')}]})[_0xa489('0x35')](handleEntityNotFound(_0x57f102,null))[_0xa489('0x35')](function(_0x3668ce){_0x191ca1[_0xa489('0x70')]=_0x3668ce;_0x191ca1['applications']=_[_0xa489('0x71')](_0x3668ce[_0xa489('0x6f')],[_0xa489('0x72')],[_0xa489('0x73')]);if(_0x191ca1['account'][_0xa489('0x6f')]){delete _0x191ca1[_0xa489('0x70')][_0xa489('0x6f')];}return db[_0xa489('0x74')][_0xa489('0x5e')]();})[_0xa489('0x35')](function(_0x2da374){if(!_0x2da374){throw new db[(_0xa489('0x75'))][(_0xa489('0x76'))](_0xa489('0x77'));}_0x115bb6=_[_0xa489('0x78')](_[_0xa489('0x41')](_0x2da374),[_0xa489('0x79'),_0xa489('0x7a')]);_0x58bd20=_[_0xa489('0x78')](_['keys'](_0x2da374),['createdAt',_0xa489('0x7a'),'CompanyId',_0xa489('0x7b')]);_0x191ca1['body']={'mapKey':_0xa489('0x7c')};if(_0x191ca1[_0xa489('0x70')]['type']){switch(_0x191ca1[_0xa489('0x70')][_0xa489('0x4d')]){case _0xa489('0x7d'):_0x191ca1['body'][_0xa489('0x7e')]=_0x5572bc[_0xa489('0x5c')]['From'];_0x191ca1[_0xa489('0x5c')][_0xa489('0x5c')]=_0x5572bc[_0xa489('0x5c')][_0xa489('0x7f')];_0x191ca1[_0xa489('0x5c')]['messageId']=_0x5572bc[_0xa489('0x5c')][_0xa489('0x80')];break;case _0xa489('0x81'):_0x191ca1[_0xa489('0x5c')][_0xa489('0x7e')]='+'+_0x5572bc[_0xa489('0x5c')][_0xa489('0x82')];_0x191ca1[_0xa489('0x5c')][_0xa489('0x5c')]=_0x5572bc[_0xa489('0x5c')][_0xa489('0x83')];break;case'connectel':_0x191ca1[_0xa489('0x5c')][_0xa489('0x7e')]=_0x5572bc[_0xa489('0x5c')][_0xa489('0x7e')];_0x191ca1[_0xa489('0x5c')][_0xa489('0x5c')]=_0x5572bc[_0xa489('0x5c')][_0xa489('0x25')];break;case _0xa489('0x84'):_0x191ca1[_0xa489('0x5c')][_0xa489('0x7e')]=_0x5572bc['body']['from'];_0x191ca1[_0xa489('0x5c')][_0xa489('0x5c')]=_0x5572bc[_0xa489('0x5c')]['body'];_0x191ca1[_0xa489('0x5c')][_0xa489('0x85')]=_0x5572bc[_0xa489('0x5c')]['message_id'];break;case _0xa489('0x86'):_0x191ca1[_0xa489('0x5c')][_0xa489('0x7e')]=_0x5572bc[_0xa489('0x5c')]['From'];_0x191ca1[_0xa489('0x5c')][_0xa489('0x5c')]=_0x5572bc[_0xa489('0x5c')][_0xa489('0x87')];_0x191ca1['body']['messageId']=_0x5572bc['body'][_0xa489('0x88')];break;case _0xa489('0x89'):_0x191ca1[_0xa489('0x5c')][_0xa489('0x7e')]='+'+_0x5572bc[_0xa489('0x5c')]['results'][0x0][_0xa489('0x7e')];_0x191ca1[_0xa489('0x5c')][_0xa489('0x5c')]=_0x5572bc[_0xa489('0x5c')][_0xa489('0x8a')][0x0][_0xa489('0x83')];_0x191ca1['body'][_0xa489('0x85')]=_0x5572bc[_0xa489('0x5c')]['results'][0x0]['messageId'];break;case _0xa489('0x8b'):_0x191ca1[_0xa489('0x5c')][_0xa489('0x7e')]=_0x5572bc[_0xa489('0x5c')]['originatingAddress'];_0x191ca1[_0xa489('0x5c')][_0xa489('0x5c')]=_0x5572bc[_0xa489('0x5c')][_0xa489('0x8c')][_0xa489('0x25')];break;case _0xa489('0x8d'):_0x191ca1[_0xa489('0x5c')][_0xa489('0x7e')]=_0x5572bc[_0xa489('0x5c')][_0xa489('0x8e')];_0x191ca1[_0xa489('0x5c')][_0xa489('0x5c')]=_0x5572bc[_0xa489('0x5c')][_0xa489('0x83')];_0x191ca1[_0xa489('0x5c')][_0xa489('0x85')]=_0x5572bc[_0xa489('0x5c')][_0xa489('0x8f')];break;case _0xa489('0x90'):_0x191ca1[_0xa489('0x5c')][_0xa489('0x7e')]=_0x5572bc['body'][_0xa489('0x7e')];_0x191ca1[_0xa489('0x5c')][_0xa489('0x5c')]=_0x5572bc[_0xa489('0x5c')][_0xa489('0x25')];_0x191ca1['body'][_0xa489('0x85')]=_0x5572bc[_0xa489('0x5c')][_0xa489('0x91')];break;}}if(_0x191ca1[_0xa489('0x5c')]['id']){delete _0x191ca1[_0xa489('0x5c')]['id'];}if(_[_0xa489('0x92')](_0x191ca1[_0xa489('0x5c')][_0xa489('0x7e')])){throw new db[(_0xa489('0x75'))][(_0xa489('0x76'))](_0xa489('0x93'));}if(_[_0xa489('0x92')](_0x191ca1[_0xa489('0x5c')][_0xa489('0x5c')])||_0x191ca1['body'][_0xa489('0x5c')]===''){throw new db['Sequelize']['ValidationError'](_0xa489('0x94'));}if(_[_0xa489('0x92')](_0x191ca1[_0xa489('0x5c')][_0xa489('0x95')])){throw new db[(_0xa489('0x75'))][(_0xa489('0x76'))](_0xa489('0x96')+_0x58bd20);}if(!_[_0xa489('0x97')](_0x58bd20,_0x191ca1[_0xa489('0x5c')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xa489('0x98')+_0x58bd20);}_0x3056c1[_0x191ca1[_0xa489('0x5c')]['mapKey']]=_0x191ca1[_0xa489('0x5c')][_0xa489('0x7e')];return db[_0xa489('0x99')][_0xa489('0x5d')]({'where':{'id':_0x191ca1['account'][_0xa489('0x7b')]},'include':[{'model':db['CmContact'],'as':_0xa489('0x9a'),'where':_0x3056c1,'limit':0x1,'order':[[_0xa489('0x7a'),_0xa489('0x9b')]]}]});})[_0xa489('0x35')](handleEntityNotFound(_0x57f102,null))[_0xa489('0x35')](function(_0x4bdd8f){if(_0x4bdd8f){_0x191ca1[_0xa489('0x9c')]=_[_0xa489('0x9d')](_0x4bdd8f,[_0xa489('0x9a')]);if(_0x4bdd8f[_0xa489('0x9a')][_0xa489('0x46')]){return _0x4bdd8f[_0xa489('0x9a')][0x0];}var _0x4c3187=_['defaults'](_0x191ca1[_0xa489('0x5c')],{'firstName':_0x191ca1['body'][_0xa489('0x7e')],'ListId':_0x4bdd8f['id']});_0x4c3187[_0x191ca1[_0xa489('0x5c')][_0xa489('0x95')]]=_0x191ca1[_0xa489('0x5c')][_0xa489('0x7e')];return db[_0xa489('0x74')]['create'](_0x4c3187,{'fields':_0x115bb6,'raw':!![]});}})[_0xa489('0x35')](handleEntityNotFound(_0x57f102,null))[_0xa489('0x35')](function(_0x162e40){if(_0x162e40){_0x191ca1['contact']=_0x162e40;var _0x3a2c16={'ContactId':_0x162e40['id'],'phone':_0x191ca1['body'][_0xa489('0x7e')],'SmsAccountId':_0x5572bc[_0xa489('0x52')]['id']};var _0x5e4a4d={'ContactId':_0x162e40['id'],'SmsAccountId':_0x5572bc[_0xa489('0x52')]['id'],'closed':![]};return db['SmsInteraction'][_0xa489('0x5d')]({'where':_0x5e4a4d})[_0xa489('0x35')](function(_0x44af60){if(_0x44af60){return[_0x44af60,![]];}return db[_0xa489('0x9e')][_0xa489('0x54')](_0x3a2c16)[_0xa489('0x35')](function(_0x524739){return[_0x524739,!![]];});});}})[_0xa489('0x9f')](function(_0x3275f3,_0x84efa9){_0x191ca1[_0xa489('0xa0')]=_0x3275f3['get']({'plain':!![]});_0x191ca1['interaction'][_0xa489('0xa1')]=![];if(_0x84efa9){if(_0x191ca1['account'][_0xa489('0xa2')]){_0x191ca1[_0xa489('0xa3')][_0xa489('0xa4')]({'id':0x0,'priority':_0x191ca1['applications'][_0xa489('0x46')]+0x1,'app':_0xa489('0xa5'),'appdata':_0xa489('0xa6'),'interval':_0xa489('0xa7')});}_0x191ca1[_0xa489('0xa0')]['created']=!![];}return db[_0xa489('0xa8')][_0xa489('0x54')]({'phone':_0x191ca1[_0xa489('0x5c')]['from'],'messageId':_0x191ca1['body'][_0xa489('0x85')],'body':_0x191ca1['body'][_0xa489('0x5c')],'SmsAccountId':_0x5572bc[_0xa489('0x52')]['id'],'SmsInteractionId':_0x3275f3['id'],'direction':'in','ContactId':_0x3275f3[_0xa489('0xa9')],'AttachmentId':_0x191ca1['body'][_0xa489('0xaa')]});})['then'](function(_0x3f660b){_0x191ca1['message']=_0x3f660b;if(_0x191ca1[_0xa489('0xa0')][_0xa489('0xab')]){return db[_0xa489('0xac')][_0xa489('0x5d')]({'attributes':['id',_0xa489('0x38')],'where':{'id':_0x191ca1[_0xa489('0xa0')]['UserId']}})['then'](function(_0x57bcd5){if(_0x57bcd5){_0x191ca1[_0xa489('0xa3')][_0xa489('0xad')]({'id':0x0,'priority':0x0,'app':_0xa489('0xae'),'appdata':_0x57bcd5['name']+','+(_0x191ca1[_0xa489('0x70')]['waitForTheAssignedAgent']||0xa),'interval':_0xa489('0xa7')});}return respondWithRpcPromise(_0xa489('0xaf'),_0xa489('0xb0'),_0x191ca1);});}return respondWithRpcPromise(_0xa489('0xaf'),'startRouting',_0x191ca1);})[_0xa489('0x35')](function(_0x2cabd6){if(_0x2cabd6){var _0x5750e1=0xc8;var _0x21e2d6=_0xa489('0xb1');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x21e2d6,_0x5750e1,_0xa489('0xb2'));logger['debug'](_0xa489('0xb3'),_0x21e2d6,_0x5750e1,_0xa489('0xb2'),JSON[_0xa489('0x23')](_0x2cabd6));if(_0x191ca1[_0xa489('0x70')][_0xa489('0x4d')]===_0xa489('0x7d')){return _0x57f102[_0xa489('0x2b')](_0x5750e1)[_0xa489('0x2f')](_0xa489('0xb4'),_0xa489('0xb5'))[_0xa489('0xb6')]('\x0a');}else{return _0x57f102[_0xa489('0x2b')](_0x5750e1)[_0xa489('0x31')](_0x2cabd6);}}})[_0xa489('0x29')](handleError(_0x57f102,null));};exports['addApplications']=function(_0x379a63,_0x185b27,_0x4d4b0a){return db[_0xa489('0x3c')][_0xa489('0x61')]({'where':{'id':_0x379a63['params']['id']}})[_0xa489('0x35')](handleEntityNotFound(_0x185b27,null))[_0xa489('0x35')](function(_0x39299a){if(_0x39299a){return db[_0xa489('0xb7')][_0xa489('0xb8')](function(_0x4d1c72){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x379a63['params']['id']},'transaction':_0x4d1c72})[_0xa489('0x35')](function(_0x21a1d1){var _0xe65bf1=_[_0xa489('0x3b')](_0x379a63[_0xa489('0x5c')],function(_0x5b76cf){_0x5b76cf[_0xa489('0x60')]=_0x379a63['params']['id'];return _0x5b76cf;});return db['SmsApplication'][_0xa489('0xb9')](_0xe65bf1,{'transaction':_0x4d1c72});});})[_0xa489('0x35')](function(){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x379a63[_0xa489('0x52')]['id']},'order':'priority'});});}})[_0xa489('0x35')](respondWithResult(_0x185b27,null))['catch'](handleError(_0x185b27,null));};exports[_0xa489('0xba')]=function(_0x158520,_0x5ba363,_0x887515){var _0x5db61c={};var _0x44791a={};var _0x725304;var _0x35a114;return db[_0xa489('0x3c')][_0xa489('0x61')]({'where':{'id':_0x158520[_0xa489('0x52')]['id']}})['then'](handleEntityNotFound(_0x5ba363,null))[_0xa489('0x35')](function(_0x2e814f){if(_0x2e814f){_0x725304=_0x2e814f;_0x44791a[_0xa489('0x3f')]=_[_0xa489('0x41')](db[_0xa489('0x6e')][_0xa489('0x3d')]);_0x44791a[_0xa489('0x40')]=_[_0xa489('0x41')](_0x158520[_0xa489('0x40')]);_0x44791a['filters']=_[_0xa489('0x43')](_0x44791a['model'],_0x44791a[_0xa489('0x40')]);_0x5db61c[_0xa489('0x44')]=_[_0xa489('0x43')](_0x44791a['model'],qs[_0xa489('0x45')](_0x158520[_0xa489('0x40')][_0xa489('0x45')]));_0x5db61c[_0xa489('0x44')]=_0x5db61c[_0xa489('0x44')][_0xa489('0x46')]?_0x5db61c[_0xa489('0x44')]:_0x44791a[_0xa489('0x3f')];_0x5db61c['order']=qs['sort'](_0x158520[_0xa489('0x40')][_0xa489('0x49')]);_0x5db61c[_0xa489('0x4b')]=qs[_0xa489('0x42')](_[_0xa489('0x64')](_0x158520['query'],_0x44791a[_0xa489('0x42')]));if(_0x158520['query'][_0xa489('0x4a')]){_0x5db61c[_0xa489('0x4b')]=_[_0xa489('0x4c')](_0x5db61c[_0xa489('0x4b')],{'$or':_['map'](_0x5db61c[_0xa489('0x44')],function(_0x4bf20a){var _0x15c4c6={};_0x15c4c6[_0x4bf20a]={'$like':'%'+_0x158520['query'][_0xa489('0x4a')]+'%'};return _0x15c4c6;})});}_0x5db61c=_[_0xa489('0x4c')]({},_0x5db61c,_0x158520[_0xa489('0x4e')]);return _0x725304['getApplications'](_0x5db61c);}})['then'](function(_0x4d075b){if(_0x4d075b){_0x35a114=_0x4d075b[_0xa489('0x46')];if(!_0x158520[_0xa489('0x40')]['hasOwnProperty'](_0xa489('0x63'))){_0x5db61c[_0xa489('0x2e')]=qs[_0xa489('0x2e')](_0x158520[_0xa489('0x40')][_0xa489('0x2e')]);_0x5db61c[_0xa489('0x2d')]=qs[_0xa489('0x2d')](_0x158520[_0xa489('0x40')][_0xa489('0x2d')]);}return _0x725304[_0xa489('0xba')](_0x5db61c);}})[_0xa489('0x35')](function(_0x12a73b){if(_0x12a73b){return _0x12a73b?{'count':_0x35a114,'rows':_0x12a73b}:null;}})[_0xa489('0x35')](respondWithResult(_0x5ba363,null))[_0xa489('0x29')](handleError(_0x5ba363,null));};exports[_0xa489('0xbb')]=function(_0x542504,_0xabe9be,_0x3d4fe5){var _0x40461d={'raw':![],'where':{}};var _0xa970db={};var _0x1613ef={'count':0x0,'rows':[]};return db[_0xa489('0x3c')][_0xa489('0x61')]({'where':{'id':_0x542504[_0xa489('0x52')]['id']}})[_0xa489('0x35')](handleEntityNotFound(_0xabe9be,null))[_0xa489('0x35')](function(_0x1d6136){if(_0x1d6136){_0xa970db[_0xa489('0x3f')]=_['keys'](db[_0xa489('0x9e')][_0xa489('0x3d')]);_0xa970db['query']=_['keys'](_0x542504['query']);_0xa970db['filters']=_[_0xa489('0x43')](_0xa970db[_0xa489('0x3f')],_0xa970db[_0xa489('0x40')]);_0x40461d[_0xa489('0x44')]=_[_0xa489('0x43')](_0xa970db[_0xa489('0x3f')],qs[_0xa489('0x45')](_0x542504[_0xa489('0x40')]['fields']));_0x40461d[_0xa489('0x44')]=_0x40461d[_0xa489('0x44')]['length']?_0x40461d['attributes']:_0xa970db[_0xa489('0x3f')];if(!_0x542504[_0xa489('0x40')][_0xa489('0x47')](_0xa489('0x63'))){_0x40461d['limit']=qs['limit'](_0x542504[_0xa489('0x40')][_0xa489('0x2e')]);_0x40461d[_0xa489('0x2d')]=qs[_0xa489('0x2d')](_0x542504['query']['offset']);}_0x40461d[_0xa489('0x48')]=qs['sort'](_0x542504['query'][_0xa489('0x49')]);_0x40461d[_0xa489('0x4b')]=qs[_0xa489('0x42')](_[_0xa489('0x64')](_0x542504['query'],_0xa970db['filters']));_0x40461d['where']['SmsAccountId']=_0x1d6136['id'];if(_0x542504[_0xa489('0x40')][_0xa489('0x4a')]){_0x40461d['where']=_[_0xa489('0x4c')](_0x40461d['where'],{'$or':_['map'](_0x40461d['attributes'],function(_0x51c7db){var _0x9a28ec={};_0x9a28ec[_0x51c7db]={'$like':'%'+_0x542504[_0xa489('0x40')][_0xa489('0x4a')]+'%'};return _0x9a28ec;})});}_0x40461d=_[_0xa489('0x4c')]({},_0x40461d,_0x542504[_0xa489('0x4e')]);return db[_0xa489('0x9e')][_0xa489('0x4f')]({'where':_0x40461d[_0xa489('0x4b')]})[_0xa489('0x35')](function(_0x39997a){_0x1613ef[_0xa489('0x4f')]=_0x39997a;if(_0x542504[_0xa489('0x40')][_0xa489('0x50')]){_0x40461d[_0xa489('0x65')]=[{'model':db[_0xa489('0x74')],'as':_0xa489('0xbc'),'required':![]},{'model':db[_0xa489('0xac')],'as':_0xa489('0xbd'),'attributes':[_0xa489('0x38'),_0xa489('0xbe'),_0xa489('0xbf')],'required':![]},{'model':db['Tag'],'as':_0xa489('0xc0'),'attributes':['id','name',_0xa489('0xc1')],'where':_0x542504['query'][_0xa489('0xc2')]?{'id':_0x542504[_0xa489('0x40')][_0xa489('0xc2')]}:undefined,'required':_0x542504[_0xa489('0x40')]['tag']?!![]:![]}];}return db[_0xa489('0x9e')][_0xa489('0x66')](_0x40461d);})['then'](function(_0x3f1d30){_0x1613ef[_0xa489('0x51')]=_0x3f1d30;return _0x1613ef;});}})[_0xa489('0x35')](respondWithFilteredResult(_0xabe9be,_0x40461d))[_0xa489('0x29')](handleError(_0xabe9be,null));};exports['send']=function(_0x96b75e,_0x525a3c,_0x23ff17){var _0x2adce4,_0x9b08b1,_0x3f7eb5;if(_['isNil'](_0x96b75e[_0xa489('0x5c')][_0xa489('0x5c')])||_0x96b75e[_0xa489('0x5c')]['body']===''){throw new db['Sequelize'][(_0xa489('0x76'))](_0xa489('0x94'));}if(_[_0xa489('0x92')](_0x96b75e[_0xa489('0x5c')]['to'])){throw new db['Sequelize'][(_0xa489('0x76'))]('to\x20is\x20mandatory');}_0x2adce4=_0x96b75e[_0xa489('0x5c')]['to'];return db[_0xa489('0x3c')][_0xa489('0x5d')]({'where':{'id':_0x96b75e['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xa489('0x74')],'as':_0xa489('0x9a'),'where':{'mobile':_0x2adce4},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0x525a3c,null))[_0xa489('0x35')](function(_0x488eaf){if(_0x488eaf&&_0x488eaf[_0xa489('0xc3')]){_0x9b08b1=_0x488eaf['get']({'plain':!![]});if(_0x9b08b1['List']&&_0x9b08b1[_0xa489('0xc3')][_0xa489('0x9a')][_0xa489('0x46')]){return _0x9b08b1[_0xa489('0xc3')][_0xa489('0x9a')][0x0];}return db[_0xa489('0x74')][_0xa489('0x54')](_[_0xa489('0x1c')](_0x96b75e[_0xa489('0x5c')],{'firstName':_0x2adce4,'mobile':_0x2adce4,'phone':_0x2adce4,'ListId':_0x9b08b1[_0xa489('0x7b')]}));}})[_0xa489('0x35')](handleEntityNotFound(_0x525a3c,null))['then'](function(_0x9ee31d){if(_0x9ee31d){_0x3f7eb5=_0x9ee31d;return db['SmsInteraction'][_0xa489('0x5d')]({'where':{'ContactId':_0x3f7eb5['id'],'closed':![],'SmsAccountId':_0x9b08b1['id']}})['then'](function(_0x1abb21){if(_0x1abb21){return[_0x1abb21,![]];}return db[_0xa489('0x9e')]['create']({'UserId':_0x96b75e['user']['id'],'ContactId':_0x3f7eb5['id'],'SmsAccountId':_0x9b08b1['id'],'phone':_0x2adce4,'firstMsgDirection':_0xa489('0xc4'),'Messages':[_[_0xa489('0x4c')](_0x96b75e['body'],{'read':![],'body':_0x96b75e[_0xa489('0x5c')][_0xa489('0x5c')],'phone':_0x2adce4,'SmsAccountId':_0x9b08b1['id'],'UserId':_0x96b75e['user']['id'],'ContactId':_0x3f7eb5['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xa489('0xc5')}]})[_0xa489('0x35')](function(_0x18c3c7){return[_0x18c3c7,!![]];});});}})['spread'](function(_0x5660af,_0x3ef21d){if(_0x3ef21d){return _0x5660af;}return db[_0xa489('0xa8')][_0xa489('0x54')](_[_0xa489('0x4c')](_0x96b75e[_0xa489('0x5c')],{'read':![],'body':_0x96b75e['body'][_0xa489('0x5c')],'phone':_0x2adce4,'SmsAccountId':_0x9b08b1['id'],'SmsInteractionId':_0x5660af['id'],'UserId':_0x96b75e[_0xa489('0x57')]['id'],'ContactId':_0x3f7eb5['id']}))[_0xa489('0x35')](function(_0x2e2887){_0x5660af[_0xa489('0xc6')][_0xa489('0xc5')]=[];_0x5660af[_0xa489('0xc6')][_0xa489('0xc5')][_0xa489('0xa4')](_0x2e2887[_0xa489('0xc6')]);return _0x5660af;});})[_0xa489('0x35')](respondWithResult(_0x525a3c,null))[_0xa489('0x29')](handleError(_0x525a3c,null));};exports[_0xa489('0x2b')]=function(_0x2ed5d6,_0x48b173,_0x4c80cb){if(_0x2ed5d6['body']['id']){delete _0x2ed5d6[_0xa489('0x5c')]['id'];}console['log'](_0xa489('0xc7'),_0x2ed5d6['body']);var _0x5917d8,_0x458c70,_0x13bfec;return db['SmsAccount']['find']({'where':{'id':_0x2ed5d6[_0xa489('0x52')]['id']}})[_0xa489('0x35')](handleEntityNotFound(_0x48b173,null))[_0xa489('0x35')](function(_0x1d5d29){if(_0x1d5d29){_0x13bfec=_0x1d5d29;logger[_0xa489('0xc8')](_0xa489('0xc9'),_0xa489('0x2b'),_0xa489('0xca'),_0x1d5d29[_0xa489('0x4d')],util[_0xa489('0xcb')](_0x2ed5d6[_0xa489('0x5c')],{'showHidden':![],'depth':null}));switch(_0x1d5d29[_0xa489('0x4d')]){case _0xa489('0x81'):if(_0x2ed5d6['body'][_0xa489('0xcc')]&&_0x2ed5d6['body'][_0xa489('0x2b')]){_0x458c70=_0x2ed5d6[_0xa489('0x5c')]['status'];return db['SmsMessage'][_0xa489('0x5d')]({'where':{'messageId':_0x2ed5d6[_0xa489('0x5c')][_0xa489('0xcc')]}});}break;case _0xa489('0xcd'):if(_0x2ed5d6[_0xa489('0x5c')][_0xa489('0xce')]&&_0x2ed5d6['body'][_0xa489('0xcf')]){_0x458c70=_0x2ed5d6[_0xa489('0x5c')][_0xa489('0xcf')];return db[_0xa489('0xa8')][_0xa489('0x5d')]({'where':{'messageId':_0x2ed5d6[_0xa489('0x5c')]['requestid']}});}break;case _0xa489('0x84'):if(_0x2ed5d6[_0xa489('0x5c')][_0xa489('0xd0')]&&_0x2ed5d6[_0xa489('0x5c')][_0xa489('0xd1')]){_0x458c70=_0x2ed5d6[_0xa489('0x5c')][_0xa489('0xd1')];return db[_0xa489('0xa8')][_0xa489('0x5d')]({'where':{'messageId':_0x2ed5d6['body']['message_id']}});}break;case _0xa489('0x89'):var _0x48fc40=_0x2ed5d6[_0xa489('0x5c')][_0xa489('0x8a')][0x0];if(_0x48fc40['messageId']&&_0x48fc40[_0xa489('0x2b')][_0xa489('0xd2')]===_0xa489('0xd3')){_0x458c70=_0x48fc40[_0xa489('0x2b')][_0xa489('0xd2')];return db[_0xa489('0xa8')][_0xa489('0x5d')]({'where':{'messageId':_0x48fc40['messageId']}});}break;case _0xa489('0x8d'):if(_0x2ed5d6[_0xa489('0x5c')][_0xa489('0x85')]&&_0x2ed5d6['body']['status']){_0x458c70=_0x2ed5d6[_0xa489('0x5c')][_0xa489('0x2b')];return db[_0xa489('0xa8')][_0xa489('0x5d')]({'where':{'messageId':_0x2ed5d6[_0xa489('0x5c')]['messageId']}});}break;case _0xa489('0x90'):if(_0x2ed5d6[_0xa489('0x5c')][_0xa489('0xd4')]&&_0x2ed5d6[_0xa489('0x5c')]['status']){_0x458c70=_0x2ed5d6['body']['status'];return db[_0xa489('0xa8')][_0xa489('0x5d')]({'where':{'messageId':_0x2ed5d6[_0xa489('0x5c')][_0xa489('0xd4')]}});}break;}}})['then'](handleEntityNotFound(_0x48b173,null))[_0xa489('0x35')](function(_0xdf7e4a){if(_0xdf7e4a){_0x5917d8=_0xdf7e4a;switch(_0x13bfec['type']){case'skebby':if(_0x458c70==='DELIVERED'){return _0x5917d8[_0xa489('0x34')]({'read':!![]});}else{logger[_0xa489('0x24')](_0xa489('0xc9'),'status',_0xa489('0x81'),util[_0xa489('0xcb')](_0x2ed5d6[_0xa489('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xa489('0xcd'):if(_0x458c70==='1'){return _0x5917d8[_0xa489('0x34')]({'read':!![]});}else{logger[_0xa489('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xa489('0x81'),util['inspect'](_0x2ed5d6[_0xa489('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xa489('0x84'):if(!_0x2ed5d6[_0xa489('0x5c')][_0xa489('0xd5')]&&_0x458c70>=0xc8&&_0x458c70<=0xce){return _0x5917d8['update']({'read':!![]});}else{logger[_0xa489('0x24')](_0xa489('0xc9'),'status',_0xa489('0x84'),util['inspect'](_0x2ed5d6[_0xa489('0x5c')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x5e82f3=_0x2ed5d6[_0xa489('0x5c')][_0xa489('0x8a')][0x0];if(_0x5e82f3[_0xa489('0x2b')][_0xa489('0xd2')]==='DELIVERED'){return _0x5917d8[_0xa489('0x34')]({'read':!![]});}else{logger[_0xa489('0x24')](_0xa489('0xc9'),_0xa489('0x2b'),_0xa489('0x89'),util[_0xa489('0xcb')](_0x2ed5d6[_0xa489('0x5c')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x458c70==_0xa489('0xd6')||_0x458c70==_0xa489('0xd7')){return _0x5917d8['update']({'read':!![]});}else{logger[_0xa489('0x24')](_0xa489('0xc9'),'status',_0xa489('0x8d'),util[_0xa489('0xcb')](_0x2ed5d6[_0xa489('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xa489('0x90'):if(_0x458c70===_0xa489('0xd8')||_0x458c70==='ACCEPTD'){return _0x5917d8[_0xa489('0x34')]({'read':!![]});}else{logger[_0xa489('0x24')](_0xa489('0xc9'),_0xa489('0x2b'),'intelepeer',util[_0xa489('0xcb')](_0x2ed5d6[_0xa489('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x5917d8;}})[_0xa489('0x35')](respondWithResult(_0x48b173,null))[_0xa489('0x29')](handleError(_0x48b173,null));};exports[_0xa489('0xd9')]=function(_0x402585,_0x2a0cc5,_0x24c567){var _0x41ca4a,_0x854458,_0x3e43d9;return db[_0xa489('0x3c')][_0xa489('0x5d')]({'where':{'id':_0x402585[_0xa489('0x52')]['id']}})[_0xa489('0x35')](handleEntityNotFound(_0x2a0cc5,null))[_0xa489('0x35')](function(_0x189a2c){if(_0x189a2c){_0x3e43d9=_0x189a2c;logger[_0xa489('0xc8')](_0xa489('0xc9'),'status',_0xa489('0xca'),_0x189a2c[_0xa489('0x4d')],util[_0xa489('0xcb')](_0x402585[_0xa489('0x40')],{'showHidden':![],'depth':null}));switch(_0x189a2c['type']){case _0xa489('0x8b'):if(_0x402585['query']['message-id']&&_0x402585[_0xa489('0x40')][_0xa489('0xda')]){_0x854458=_0x402585[_0xa489('0x40')][_0xa489('0xda')];return db[_0xa489('0xa8')][_0xa489('0x5d')]({'where':{'messageId':_0x402585['query']['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x2a0cc5,null))[_0xa489('0x35')](function(_0x57a2ea){if(_0x57a2ea){_0x41ca4a=_0x57a2ea;switch(_0x3e43d9[_0xa489('0x4d')]){case _0xa489('0x8b'):if(_0x854458==='2'||_0x854458==='6'){return _0x41ca4a['update']({'read':!![]});}else{logger[_0xa489('0x24')](_0xa489('0xc9'),'status','csc',util['inspect'](_0x402585['query'],{'showHidden':![],'depth':null}));};break;}return _0x41ca4a;}})['then'](respondWithResult(_0x2a0cc5,null))[_0xa489('0x29')](handleError(_0x2a0cc5,null));};exports[_0xa489('0xdb')]=function(_0x501c4e,_0x282434,_0x488fa1){return db['SmsAccount'][_0xa489('0x5d')]({'where':{'id':_0x501c4e['params']['id']}})[_0xa489('0x35')](handleEntityNotFound(_0x282434,null))['then'](function(_0x4c20cf){if(_0x4c20cf){return _0x4c20cf[_0xa489('0xdb')](_0x501c4e['body'][_0xa489('0x68')],_[_0xa489('0x9d')](_0x501c4e[_0xa489('0x5c')],['ids','id'])||{})['spread'](function(_0x853ccb){for(var _0x51519b=0x0;_0x51519b<_0x501c4e[_0xa489('0x5c')][_0xa489('0x68')]['length'];_0x51519b+=0x1){socket[_0xa489('0xdc')](_0xa489('0xdd'),{'UserId':_0x501c4e[_0xa489('0x5c')]['ids'][_0x51519b],'SmsAccountId':_0x501c4e[_0xa489('0x52')]['id']});}return _0x853ccb;});}})[_0xa489('0x35')](respondWithResult(_0x282434,null))[_0xa489('0x29')](handleError(_0x282434,null));};exports['removeAgents']=function(_0x45a103,_0x31ac76,_0x9c547){return db[_0xa489('0x3c')][_0xa489('0x5d')]({'where':{'id':_0x45a103[_0xa489('0x52')]['id']}})[_0xa489('0x35')](handleEntityNotFound(_0x31ac76,null))[_0xa489('0x35')](function(_0x2dad4d){if(_0x2dad4d){return _0x2dad4d[_0xa489('0xde')](_0x45a103['query']['ids'])['then'](function(){if(_['isArray'](_0x45a103['query'][_0xa489('0x68')])){for(var _0x255a03=0x0;_0x255a03<_0x45a103[_0xa489('0x40')][_0xa489('0x68')][_0xa489('0x46')];_0x255a03+=0x1){socket[_0xa489('0xdc')](_0xa489('0xdf'),{'UserId':Number(_0x45a103['query'][_0xa489('0x68')][_0x255a03]),'SmsAccountId':Number(_0x45a103['params']['id'])});}}else{socket[_0xa489('0xdc')](_0xa489('0xdf'),{'UserId':Number(_0x45a103[_0xa489('0x40')][_0xa489('0x68')]),'SmsAccountId':Number(_0x45a103[_0xa489('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0x31ac76,null))[_0xa489('0x29')](handleError(_0x31ac76,null));};exports[_0xa489('0xe0')]=function(_0xfc1b0a,_0x3f6f53,_0x435fc0){var _0x144de1={};var _0x5d3ef5={};var _0x28d8e9;var _0x48c244;return db['SmsAccount']['findOne']({'where':{'id':_0xfc1b0a[_0xa489('0x52')]['id']}})['then'](handleEntityNotFound(_0x3f6f53,null))[_0xa489('0x35')](function(_0x5e1f4c){if(_0x5e1f4c){_0x28d8e9=_0x5e1f4c;_0x5d3ef5[_0xa489('0x3f')]=_[_0xa489('0x41')](db[_0xa489('0xac')][_0xa489('0x3d')]);_0x5d3ef5['query']=_['keys'](_0xfc1b0a[_0xa489('0x40')]);_0x5d3ef5[_0xa489('0x42')]=_[_0xa489('0x43')](_0x5d3ef5[_0xa489('0x3f')],_0x5d3ef5['query']);_0x144de1[_0xa489('0x44')]=_['intersection'](_0x5d3ef5['model'],qs[_0xa489('0x45')](_0xfc1b0a[_0xa489('0x40')][_0xa489('0x45')]));_0x144de1[_0xa489('0x44')]=_0x144de1['attributes']['length']?_0x144de1['attributes']:_0x5d3ef5[_0xa489('0x3f')];_0x144de1[_0xa489('0x48')]=qs[_0xa489('0x49')](_0xfc1b0a[_0xa489('0x40')][_0xa489('0x49')]);_0x144de1[_0xa489('0x4b')]=qs[_0xa489('0x42')](_[_0xa489('0x64')](_0xfc1b0a[_0xa489('0x40')],_0x5d3ef5[_0xa489('0x42')]));if(_0xfc1b0a[_0xa489('0x40')][_0xa489('0x4a')]){_0x144de1[_0xa489('0x4b')]=_[_0xa489('0x4c')](_0x144de1['where'],{'$or':_[_0xa489('0x3b')](_0x144de1[_0xa489('0x44')],function(_0xf46f86){var _0x2eae9d={};_0x2eae9d[_0xf46f86]={'$like':'%'+_0xfc1b0a[_0xa489('0x40')][_0xa489('0x4a')]+'%'};return _0x2eae9d;})});}_0x144de1=_['merge']({},_0x144de1,_0xfc1b0a['options']);return _0x28d8e9[_0xa489('0xe0')](_0x144de1);}})[_0xa489('0x35')](function(_0x325c4c){if(_0x325c4c){_0x48c244=_0x325c4c[_0xa489('0x46')];if(!_0xfc1b0a[_0xa489('0x40')][_0xa489('0x47')](_0xa489('0x63'))){_0x144de1[_0xa489('0x2e')]=qs['limit'](_0xfc1b0a[_0xa489('0x40')][_0xa489('0x2e')]);_0x144de1[_0xa489('0x2d')]=qs[_0xa489('0x2d')](_0xfc1b0a[_0xa489('0x40')][_0xa489('0x2d')]);}return _0x28d8e9[_0xa489('0xe0')](_0x144de1);}})[_0xa489('0x35')](function(_0x39c639){if(_0x39c639){return _0x39c639?{'count':_0x48c244,'rows':_0x39c639}:null;}})[_0xa489('0x35')](respondWithResult(_0x3f6f53,null))[_0xa489('0x29')](handleError(_0x3f6f53,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 70c5e96..f2160cb 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 _0x4c83=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','SmsAccount'];(function(_0x2eaac6,_0x1fafb1){var _0x452c2c=function(_0x10b61b){while(--_0x10b61b){_0x2eaac6['push'](_0x2eaac6['shift']());}};_0x452c2c(++_0x1fafb1);}(_0x4c83,0x183));var _0x34c8=function(_0x1482ee,_0x2cd376){_0x1482ee=_0x1482ee-0x0;var _0x27807b=_0x4c83[_0x1482ee];return _0x27807b;};'use strict';var EventEmitter=require(_0x34c8('0x0'));var SmsAccount=require(_0x34c8('0x1'))['db'][_0x34c8('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x34c8('0x3')](0x0);var events={'afterCreate':_0x34c8('0x4'),'afterUpdate':_0x34c8('0x5'),'afterDestroy':_0x34c8('0x6')};function emitEvent(_0x206993){return function(_0x2772f4,_0x21919a,_0x10fab1){SmsAccountEvents[_0x34c8('0x7')](_0x206993+':'+_0x2772f4['id'],_0x2772f4);SmsAccountEvents[_0x34c8('0x7')](_0x206993,_0x2772f4);_0x10fab1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x34c8('0x8')](e,emitEvent(event));}}module[_0x34c8('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x3fbd=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x1ab2d3,_0x248fb8){var _0x42a063=function(_0x133ae0){while(--_0x133ae0){_0x1ab2d3['push'](_0x1ab2d3['shift']());}};_0x42a063(++_0x248fb8);}(_0x3fbd,0x75));var _0xd3fb=function(_0x2ff65b,_0x2a05b1){_0x2ff65b=_0x2ff65b-0x0;var _0x193f4d=_0x3fbd[_0x2ff65b];return _0x193f4d;};'use strict';var EventEmitter=require(_0xd3fb('0x0'));var SmsAccount=require(_0xd3fb('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xd3fb('0x2')](0x0);var events={'afterCreate':_0xd3fb('0x3'),'afterUpdate':_0xd3fb('0x4'),'afterDestroy':'remove'};function emitEvent(_0xa55fc4){return function(_0x24f170,_0x3c5e4a,_0x3c6f69){SmsAccountEvents['emit'](_0xa55fc4+':'+_0x24f170['id'],_0x24f170);SmsAccountEvents[_0xd3fb('0x5')](_0xa55fc4,_0x24f170);_0x3c6f69(null);};}for(var e in events){if(events[_0xd3fb('0x6')](e)){var event=events[e];SmsAccount[_0xd3fb('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index eb8d6a1..892a3d8 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 _0x234a=['../../config/logger','moment','request-promise','path','rimraf','exports','define','SmsAccount','sms_accounts','lodash','util'];(function(_0x958146,_0x4aea4c){var _0x6c93f7=function(_0x4096eb){while(--_0x4096eb){_0x958146['push'](_0x958146['shift']());}};_0x6c93f7(++_0x4aea4c);}(_0x234a,0x1ed));var _0xa234=function(_0x1aec28,_0x556b6f){_0x1aec28=_0x1aec28-0x0;var _0x2398c7=_0x234a[_0x1aec28];return _0x2398c7;};'use strict';var _=require(_0xa234('0x0'));var util=require(_0xa234('0x1'));var logger=require(_0xa234('0x2'))('api');var moment=require(_0xa234('0x3'));var BPromise=require('bluebird');var rp=require(_0xa234('0x4'));var fs=require('fs');var path=require(_0xa234('0x5'));var rimraf=require(_0xa234('0x6'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0xa234('0x7')]=function(_0xceb1ca,_0x2e8b41){return _0xceb1ca[_0xa234('0x8')](_0xa234('0x9'),attributes,{'tableName':_0xa234('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda4a=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','sms_accounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda4a,0x8f));var _0xada4=function(_0x66cb94,_0x486d4e){_0x66cb94=_0x66cb94-0x0;var _0x5f0a0f=_0xda4a[_0x66cb94];return _0x5f0a0f;};'use strict';var _=require('lodash');var util=require(_0xada4('0x0'));var logger=require(_0xada4('0x1'))(_0xada4('0x2'));var moment=require(_0xada4('0x3'));var BPromise=require(_0xada4('0x4'));var rp=require(_0xada4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xada4('0x6'));var config=require(_0xada4('0x7'));var attributes=require('./smsAccount.attributes');module[_0xada4('0x8')]=function(_0x2c328e,_0x2f42da){return _0x2c328e[_0xada4('0x9')]('SmsAccount',attributes,{'tableName':_0xada4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index c985a36..1ab9572 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 _0x8d20=['raw','where','attributes','include','map','model','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','./smsAccount.socket','request','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','info','catch','ShowSmsAccount','SmsAccount','find','options'];(function(_0x2c9687,_0x17ba23){var _0x4fce59=function(_0x2e26c1){while(--_0x2e26c1){_0x2c9687['push'](_0x2c9687['shift']());}};_0x4fce59(++_0x17ba23);}(_0x8d20,0x92));var _0x08d2=function(_0x1f4553,_0x4c15e2){_0x1f4553=_0x1f4553-0x0;var _0x293ec3=_0x8d20[_0x1f4553];return _0x293ec3;};'use strict';var _=require('lodash');var util=require(_0x08d2('0x0'));var moment=require(_0x08d2('0x1'));var BPromise=require('bluebird');var rs=require(_0x08d2('0x2'));var fs=require('fs');var Redis=require(_0x08d2('0x3'));var db=require(_0x08d2('0x4'))['db'];var utils=require(_0x08d2('0x5'));var logger=require(_0x08d2('0x6'))('rpc');var config=require(_0x08d2('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x08d2('0x8')]({'port':0x232a});config[_0x08d2('0x9')]=_['defaults'](config[_0x08d2('0x9')],{'host':_0x08d2('0xa'),'port':0x18eb});var socket=require(_0x08d2('0xb'))(new Redis(config[_0x08d2('0x9')]));require(_0x08d2('0xc'))['register'](socket);function respondWithRpcPromise(_0x14f139,_0x3413fd,_0x44a679){return new BPromise(function(_0x3736eb,_0x375bbc){return client[_0x08d2('0xd')](_0x14f139,_0x44a679)[_0x08d2('0xe')](function(_0x3b00a2){logger['info']('SmsAccount,\x20%s,\x20%s',_0x3413fd,_0x08d2('0xf'));logger[_0x08d2('0x10')](_0x08d2('0x11'),_0x3413fd,_0x08d2('0xf'),JSON[_0x08d2('0x12')](_0x3b00a2));if(_0x3b00a2[_0x08d2('0x13')]){if(_0x3b00a2[_0x08d2('0x13')][_0x08d2('0x14')]===0x1f4){logger[_0x08d2('0x13')](_0x08d2('0x15'),_0x3413fd,_0x3b00a2[_0x08d2('0x13')][_0x08d2('0x16')]);return _0x375bbc(_0x3b00a2[_0x08d2('0x13')][_0x08d2('0x16')]);}logger['error'](_0x08d2('0x15'),_0x3413fd,_0x3b00a2[_0x08d2('0x13')][_0x08d2('0x16')]);return _0x3736eb(_0x3b00a2['error'][_0x08d2('0x16')]);}else{logger[_0x08d2('0x17')]('SmsAccount,\x20%s,\x20%s',_0x3413fd,_0x08d2('0xf'));_0x3736eb(_0x3b00a2['result'][_0x08d2('0x16')]);}})[_0x08d2('0x18')](function(_0x5dbcbf){logger[_0x08d2('0x13')](_0x08d2('0x15'),_0x3413fd,_0x5dbcbf);_0x375bbc(_0x5dbcbf);});});}exports[_0x08d2('0x19')]=function(_0x433468){var _0x304b59=this;return new Promise(function(_0x3e925d,_0x59dccf){return db[_0x08d2('0x1a')][_0x08d2('0x1b')]({'raw':_0x433468[_0x08d2('0x1c')]?_0x433468['options'][_0x08d2('0x1d')]===undefined?!![]:![]:!![],'where':_0x433468[_0x08d2('0x1c')]?_0x433468[_0x08d2('0x1c')][_0x08d2('0x1e')]||null:null,'attributes':_0x433468[_0x08d2('0x1c')]?_0x433468[_0x08d2('0x1c')][_0x08d2('0x1f')]||null:null,'include':_0x433468['options']?_0x433468[_0x08d2('0x1c')][_0x08d2('0x20')]?_[_0x08d2('0x21')](_0x433468[_0x08d2('0x1c')]['include'],function(_0x26bc69){return{'model':db[_0x26bc69[_0x08d2('0x22')]],'as':_0x26bc69['as'],'attributes':_0x26bc69[_0x08d2('0x1f')],'include':_0x26bc69[_0x08d2('0x20')]?_[_0x08d2('0x21')](_0x26bc69[_0x08d2('0x20')],function(_0x12b7ed){return{'model':db[_0x12b7ed[_0x08d2('0x22')]],'as':_0x12b7ed['as'],'attributes':_0x12b7ed[_0x08d2('0x1f')],'include':_0x12b7ed[_0x08d2('0x20')]?_[_0x08d2('0x21')](_0x12b7ed['include'],function(_0x3597b9){return{'model':db[_0x3597b9['model']],'as':_0x3597b9['as'],'attributes':_0x3597b9[_0x08d2('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ee324){logger[_0x08d2('0x17')](_0x08d2('0x19'),_0x433468);logger[_0x08d2('0x10')](_0x08d2('0x19'),_0x433468,JSON['stringify'](_0x1ee324));_0x3e925d(_0x1ee324);})[_0x08d2('0x18')](function(_0x30fde1){logger[_0x08d2('0x13')]('ShowSmsAccount',_0x30fde1[_0x08d2('0x16')],_0x433468);_0x59dccf(_0x304b59[_0x08d2('0x13')](0x1f4,_0x30fde1[_0x08d2('0x16')]));});});}; \ No newline at end of file +var _0x07a7=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ShowSmsAccount','SmsAccount','find','raw','options','where','attributes','include','map','model','debug','lodash','moment','bluebird'];(function(_0x395c16,_0x221a5c){var _0x43b9ae=function(_0x3158ca){while(--_0x3158ca){_0x395c16['push'](_0x395c16['shift']());}};_0x43b9ae(++_0x221a5c);}(_0x07a7,0x1aa));var _0x707a=function(_0x4bb8a1,_0x35623a){_0x4bb8a1=_0x4bb8a1-0x0;var _0x868fb0=_0x07a7[_0x4bb8a1];return _0x868fb0;};'use strict';var _=require(_0x707a('0x0'));var util=require('util');var moment=require(_0x707a('0x1'));var BPromise=require(_0x707a('0x2'));var rs=require(_0x707a('0x3'));var fs=require('fs');var Redis=require(_0x707a('0x4'));var db=require(_0x707a('0x5'))['db'];var utils=require(_0x707a('0x6'));var logger=require(_0x707a('0x7'))(_0x707a('0x8'));var config=require(_0x707a('0x9'));var jayson=require(_0x707a('0xa'));var client=jayson[_0x707a('0xb')]['http']({'port':0x232a});config['redis']=_[_0x707a('0xc')](config[_0x707a('0xd')],{'host':_0x707a('0xe'),'port':0x18eb});var socket=require(_0x707a('0xf'))(new Redis(config[_0x707a('0xd')]));require(_0x707a('0x10'))[_0x707a('0x11')](socket);function respondWithRpcPromise(_0x2156a8,_0x640aae,_0x483262){return new BPromise(function(_0xabea5f,_0x31d75c){return client[_0x707a('0x12')](_0x2156a8,_0x483262)[_0x707a('0x13')](function(_0x5310f8){logger[_0x707a('0x14')](_0x707a('0x15'),_0x640aae,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x640aae,_0x707a('0x16'),JSON[_0x707a('0x17')](_0x5310f8));if(_0x5310f8[_0x707a('0x18')]){if(_0x5310f8[_0x707a('0x18')][_0x707a('0x19')]===0x1f4){logger[_0x707a('0x18')](_0x707a('0x15'),_0x640aae,_0x5310f8[_0x707a('0x18')][_0x707a('0x1a')]);return _0x31d75c(_0x5310f8[_0x707a('0x18')]['message']);}logger[_0x707a('0x18')](_0x707a('0x15'),_0x640aae,_0x5310f8[_0x707a('0x18')][_0x707a('0x1a')]);return _0xabea5f(_0x5310f8[_0x707a('0x18')][_0x707a('0x1a')]);}else{logger[_0x707a('0x14')](_0x707a('0x15'),_0x640aae,_0x707a('0x16'));_0xabea5f(_0x5310f8['result']['message']);}})[_0x707a('0x1b')](function(_0x130996){logger['error']('SmsAccount,\x20%s,\x20%s',_0x640aae,_0x130996);_0x31d75c(_0x130996);});});}exports[_0x707a('0x1c')]=function(_0x896a90){var _0x13f90a=this;return new Promise(function(_0x453c20,_0x5424f3){return db[_0x707a('0x1d')][_0x707a('0x1e')]({'raw':_0x896a90['options']?_0x896a90['options'][_0x707a('0x1f')]===undefined?!![]:![]:!![],'where':_0x896a90['options']?_0x896a90[_0x707a('0x20')][_0x707a('0x21')]||null:null,'attributes':_0x896a90[_0x707a('0x20')]?_0x896a90[_0x707a('0x20')][_0x707a('0x22')]||null:null,'include':_0x896a90[_0x707a('0x20')]?_0x896a90[_0x707a('0x20')][_0x707a('0x23')]?_[_0x707a('0x24')](_0x896a90[_0x707a('0x20')]['include'],function(_0x5e9159){return{'model':db[_0x5e9159['model']],'as':_0x5e9159['as'],'attributes':_0x5e9159[_0x707a('0x22')],'include':_0x5e9159[_0x707a('0x23')]?_[_0x707a('0x24')](_0x5e9159['include'],function(_0x363431){return{'model':db[_0x363431[_0x707a('0x25')]],'as':_0x363431['as'],'attributes':_0x363431['attributes'],'include':_0x363431[_0x707a('0x23')]?_[_0x707a('0x24')](_0x363431[_0x707a('0x23')],function(_0x36f929){return{'model':db[_0x36f929[_0x707a('0x25')]],'as':_0x36f929['as'],'attributes':_0x36f929[_0x707a('0x22')]};}):[]};}):[]};}):[]:[]})[_0x707a('0x13')](function(_0x569763){logger[_0x707a('0x14')]('ShowSmsAccount',_0x896a90);logger[_0x707a('0x26')](_0x707a('0x1c'),_0x896a90,JSON[_0x707a('0x17')](_0x569763));_0x453c20(_0x569763);})[_0x707a('0x1b')](function(_0x42b6ec){logger['error'](_0x707a('0x1c'),_0x42b6ec[_0x707a('0x1a')],_0x896a90);_0x5424f3(_0x13f90a[_0x707a('0x18')](0x1f4,_0x42b6ec[_0x707a('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 942ec8b..397be49 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 _0xd11e=['update','emit','removeListener','register','length','smsAccount:','save','remove'];(function(_0x43a8eb,_0x15f708){var _0x4c9357=function(_0x4c5bed){while(--_0x4c5bed){_0x43a8eb['push'](_0x43a8eb['shift']());}};_0x4c9357(++_0x15f708);}(_0xd11e,0xe6));var _0xed11=function(_0x2d0c48,_0x5146ef){_0x2d0c48=_0x2d0c48-0x0;var _0x44b4db=_0xd11e[_0x2d0c48];return _0x44b4db;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0xed11('0x0'),_0xed11('0x1'),_0xed11('0x2')];function createListener(_0x62d9b2,_0x2cc134){return function(_0x268785){_0x2cc134[_0xed11('0x3')](_0x62d9b2,_0x268785);};}function removeListener(_0x592408,_0x29db1f){return function(){SmsAccountEvents[_0xed11('0x4')](_0x592408,_0x29db1f);};}exports[_0xed11('0x5')]=function(_0x1f83c7){for(var _0x4d9735=0x0,_0x1e2b9e=events[_0xed11('0x6')];_0x4d9735<_0x1e2b9e;_0x4d9735++){var _0x1160f1=events[_0x4d9735];var _0x7d1bd7=createListener(_0xed11('0x7')+_0x1160f1,_0x1f83c7);SmsAccountEvents['on'](_0x1160f1,_0x7d1bd7);}}; \ No newline at end of file +var _0x0381=['removeListener','length','smsAccount:','./smsAccount.events','remove','update','emit'];(function(_0x45da7b,_0x19ae53){var _0x1fee84=function(_0x5efb83){while(--_0x5efb83){_0x45da7b['push'](_0x45da7b['shift']());}};_0x1fee84(++_0x19ae53);}(_0x0381,0x13e));var _0x1038=function(_0x2c881a,_0x20425c){_0x2c881a=_0x2c881a-0x0;var _0x247014=_0x0381[_0x2c881a];return _0x247014;};'use strict';var SmsAccountEvents=require(_0x1038('0x0'));var events=['save',_0x1038('0x1'),_0x1038('0x2')];function createListener(_0x446505,_0xd452b){return function(_0x24dd40){_0xd452b[_0x1038('0x3')](_0x446505,_0x24dd40);};}function removeListener(_0x4de1e6,_0x211443){return function(){SmsAccountEvents[_0x1038('0x4')](_0x4de1e6,_0x211443);};}exports['register']=function(_0x683150){for(var _0x3239f2=0x0,_0x3b1803=events[_0x1038('0x5')];_0x3239f2<_0x3b1803;_0x3239f2++){var _0x41334e=events[_0x3239f2];var _0x6e7e40=createListener(_0x1038('0x6')+_0x41334e,_0x683150);SmsAccountEvents['on'](_0x41334e,_0x6e7e40);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index b65b3e3..5137ec8 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 _0x1136=['isAuthenticated','/:id','show','post','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get'];(function(_0x5eb44c,_0x286e01){var _0x10e986=function(_0x5cc6cf){while(--_0x5cc6cf){_0x5eb44c['push'](_0x5eb44c['shift']());}};_0x10e986(++_0x286e01);}(_0x1136,0x1c2));var _0x6113=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1136[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6113('0x0'));var timeout=require(_0x6113('0x1'));var express=require(_0x6113('0x2'));var router=express[_0x6113('0x3')]();var auth=require(_0x6113('0x4'));var interaction=require(_0x6113('0x5'));var config=require(_0x6113('0x6'));var controller=require(_0x6113('0x7'));router[_0x6113('0x8')]('/',auth[_0x6113('0x9')](),controller['index']);router[_0x6113('0x8')](_0x6113('0xa'),auth[_0x6113('0x9')](),controller[_0x6113('0xb')]);router[_0x6113('0xc')]('/',auth[_0x6113('0x9')](),controller['create']);router[_0x6113('0xd')](_0x6113('0xa'),auth[_0x6113('0x9')](),controller['update']);router[_0x6113('0xe')](_0x6113('0xa'),auth[_0x6113('0x9')](),controller[_0x6113('0xf')]);module[_0x6113('0x10')]=router; \ No newline at end of file +var _0x084c=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsApplication.controller','isAuthenticated','index','get','/:id','post','create'];(function(_0xc1763a,_0x320c57){var _0x5e7fd=function(_0x1e926f){while(--_0x1e926f){_0xc1763a['push'](_0xc1763a['shift']());}};_0x5e7fd(++_0x320c57);}(_0x084c,0x16d));var _0xc084=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x084c[_0x51c819];return _0x15c5d2;};'use strict';var multer=require(_0xc084('0x0'));var util=require(_0xc084('0x1'));var path=require(_0xc084('0x2'));var timeout=require(_0xc084('0x3'));var express=require(_0xc084('0x4'));var router=express[_0xc084('0x5')]();var auth=require(_0xc084('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc084('0x7'));var controller=require(_0xc084('0x8'));router['get']('/',auth[_0xc084('0x9')](),controller[_0xc084('0xa')]);router[_0xc084('0xb')](_0xc084('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc084('0xd')]('/',auth[_0xc084('0x9')](),controller[_0xc084('0xe')]);router[_0xc084('0xf')](_0xc084('0xc'),auth['isAuthenticated'](),controller[_0xc084('0x10')]);router[_0xc084('0x11')](_0xc084('0xc'),auth['isAuthenticated'](),controller[_0xc084('0x12')]);module[_0xc084('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 d3e7b49..e5e95e1 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 _0xb171=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x281ae5,_0x47f861){var _0x12089c=function(_0x3e78fb){while(--_0x3e78fb){_0x281ae5['push'](_0x281ae5['shift']());}};_0x12089c(++_0x47f861);}(_0xb171,0x69));var _0x1b17=function(_0x505955,_0x2e4a83){_0x505955=_0x505955-0x0;var _0x3e8c78=_0xb171[_0x505955];return _0x3e8c78;};'use strict';var Sequelize=require(_0x1b17('0x0'));module[_0x1b17('0x1')]={'priority':{'type':Sequelize[_0x1b17('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1b17('0x3')],'allowNull':![],'defaultValue':_0x1b17('0x4')},'appdata':{'type':Sequelize[_0x1b17('0x5')]()},'description':{'type':Sequelize[_0x1b17('0x3')]},'interval':{'type':Sequelize[_0x1b17('0x3')],'defaultValue':_0x1b17('0x6')}}; \ No newline at end of file +var _0x54c4=['STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0x54c4,0x115));var _0x454c=function(_0x4b9eaf,_0x52a7f1){_0x4b9eaf=_0x4b9eaf-0x0;var _0x2b6f92=_0x54c4[_0x4b9eaf];return _0x2b6f92;};'use strict';var Sequelize=require(_0x454c('0x0'));module[_0x454c('0x1')]={'priority':{'type':Sequelize[_0x454c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x454c('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x454c('0x3')]},'interval':{'type':Sequelize[_0x454c('0x3')],'defaultValue':_0x454c('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 60c3896..c00beba 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 _0x657e=['length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','filtears','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','SmsApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes'];(function(_0x33b3a8,_0x294f0b){var _0x29988d=function(_0x4d7d5d){while(--_0x4d7d5d){_0x33b3a8['push'](_0x33b3a8['shift']());}};_0x29988d(++_0x294f0b);}(_0x657e,0x1c2));var _0xe657=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x657e[_0x54d4a8];return _0x3b321b;};'use strict';var pdf=require(_0xe657('0x0'));var emlformat=require(_0xe657('0x1'));var rimraf=require(_0xe657('0x2'));var zipdir=require(_0xe657('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe657('0x4'));var moment=require(_0xe657('0x5'));var BPromise=require(_0xe657('0x6'));var Mustache=require(_0xe657('0x7'));var util=require('util');var path=require('path');var sox=require(_0xe657('0x8'));var csv=require(_0xe657('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe657('0xa'));var squel=require(_0xe657('0xb'));var crypto=require(_0xe657('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe657('0xd'));var toCsv=require(_0xe657('0x9'));var querystring=require(_0xe657('0xe'));var Papa=require(_0xe657('0xf'));var Redis=require(_0xe657('0x10'));var authService=require(_0xe657('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe657('0x12'));var hardwareService=require(_0xe657('0x13'));var logger=require('../../config/logger')(_0xe657('0x14'));var utils=require(_0xe657('0x15'));var config=require(_0xe657('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe657('0x17'))['db'];function respondWithStatusCode(_0x79a6a4,_0x5f3ff8){_0x5f3ff8=_0x5f3ff8||0xcc;return function(_0x5f36e0){if(_0x5f36e0){return _0x79a6a4[_0xe657('0x18')](_0x5f3ff8);}return _0x79a6a4[_0xe657('0x19')](_0x5f3ff8)[_0xe657('0x1a')]();};}function respondWithResult(_0x261ff2,_0x345c93){_0x345c93=_0x345c93||0xc8;return function(_0x225c85){if(_0x225c85){return _0x261ff2['status'](_0x345c93)['json'](_0x225c85);}};}function respondWithFilteredResult(_0x438e53,_0x2b1d1c){return function(_0x47e9cb){if(_0x47e9cb){var _0x358f28=_0x47e9cb[_0xe657('0x1b')],_0x421d58=_0x2b1d1c[_0xe657('0x1c')],_0x54f12b=_0x2b1d1c[_0xe657('0x1c')]+_0x2b1d1c[_0xe657('0x1d')],_0x3eb933;if(_0x54f12b>=_0x358f28){_0x54f12b=_0x358f28;_0x3eb933=0xc8;}else{_0x3eb933=0xce;}_0x438e53['status'](_0x3eb933);return _0x438e53[_0xe657('0x1e')](_0xe657('0x1f'),_0x421d58+'-'+_0x54f12b+'/'+_0x358f28)['json'](_0x47e9cb);}return null;};}function patchUpdates(_0x3e08b1){return function(_0x5a202c){try{jsonpatch[_0xe657('0x20')](_0x5a202c,_0x3e08b1,!![]);}catch(_0x5c3a7d){return BPromise[_0xe657('0x21')](_0x5c3a7d);}return _0x5a202c[_0xe657('0x22')]();};}function saveUpdates(_0x1c563b,_0x3767f2){return function(_0x5a027b){if(_0x5a027b){return _0x5a027b['update'](_0x1c563b)['then'](function(_0x3c6e54){return _0x3c6e54;});}return null;};}function removeEntity(_0x4b3d0e,_0x61be8f){return function(_0x2f080c){if(_0x2f080c){return _0x2f080c[_0xe657('0x23')]()[_0xe657('0x24')](function(){_0x4b3d0e[_0xe657('0x19')](0xcc)[_0xe657('0x1a')]();});}};}function handleEntityNotFound(_0x4a2ddd,_0x683121){return function(_0x2a1a26){if(!_0x2a1a26){_0x4a2ddd[_0xe657('0x18')](0x194);}return _0x2a1a26;};}function handleError(_0xda25c4,_0x1cb767){_0x1cb767=_0x1cb767||0x1f4;return function(_0x24a4f6){logger[_0xe657('0x25')](_0x24a4f6[_0xe657('0x26')]);if(_0x24a4f6[_0xe657('0x27')]){delete _0x24a4f6['name'];}_0xda25c4['status'](_0x1cb767)[_0xe657('0x28')](_0x24a4f6);};}exports['index']=function(_0x5ed298,_0x12f409){var _0x5e1071={},_0x15a985={},_0x179b75={'count':0x0,'rows':[]};var _0x3cd00a=_['map'](db[_0xe657('0x29')][_0xe657('0x2a')],function(_0x441fe0){return{'name':_0x441fe0[_0xe657('0x2b')],'type':_0x441fe0[_0xe657('0x2c')][_0xe657('0x2d')]};});_0x15a985[_0xe657('0x2e')]=_[_0xe657('0x2f')](_0x3cd00a,'name');_0x15a985[_0xe657('0x30')]=_[_0xe657('0x31')](_0x5ed298['query']);_0x15a985[_0xe657('0x32')]=_['intersection'](_0x15a985[_0xe657('0x2e')],_0x15a985['query']);_0x5e1071['attributes']=_[_0xe657('0x33')](_0x15a985[_0xe657('0x2e')],qs[_0xe657('0x34')](_0x5ed298['query']['fields']));_0x5e1071[_0xe657('0x35')]=_0x5e1071['attributes'][_0xe657('0x36')]?_0x5e1071[_0xe657('0x35')]:_0x15a985[_0xe657('0x2e')];if(!_0x5ed298[_0xe657('0x30')]['hasOwnProperty']('nolimit')){_0x5e1071[_0xe657('0x1d')]=qs[_0xe657('0x1d')](_0x5ed298[_0xe657('0x30')]['limit']);_0x5e1071[_0xe657('0x1c')]=qs['offset'](_0x5ed298['query'][_0xe657('0x1c')]);}_0x5e1071[_0xe657('0x37')]=qs['sort'](_0x5ed298[_0xe657('0x30')][_0xe657('0x38')]);_0x5e1071[_0xe657('0x39')]=qs[_0xe657('0x32')](_[_0xe657('0x3a')](_0x5ed298[_0xe657('0x30')],_0x15a985[_0xe657('0x32')]),_0x3cd00a);if(_0x5ed298[_0xe657('0x30')][_0xe657('0x3b')]){_0x5e1071[_0xe657('0x39')]=_['merge'](_0x5e1071[_0xe657('0x39')],{'$or':_[_0xe657('0x2f')](_0x3cd00a,function(_0x1a6ff6){if(_0x1a6ff6[_0xe657('0x2c')]!==_0xe657('0x3c')){var _0x2f49d7={};_0x2f49d7[_0x1a6ff6[_0xe657('0x27')]]={'$like':'%'+_0x5ed298[_0xe657('0x30')][_0xe657('0x3b')]+'%'};return _0x2f49d7;}})});}_0x5e1071=_[_0xe657('0x3d')]({},_0x5e1071,_0x5ed298[_0xe657('0x3e')]);var _0x3c6c3f={'where':_0x5e1071[_0xe657('0x39')]};return db[_0xe657('0x29')][_0xe657('0x1b')](_0x3c6c3f)['then'](function(_0xcf7dbd){_0x179b75[_0xe657('0x1b')]=_0xcf7dbd;if(_0x5ed298[_0xe657('0x30')][_0xe657('0x3f')]){_0x5e1071[_0xe657('0x40')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x5e1071);})[_0xe657('0x24')](function(_0x1c489b){_0x179b75['rows']=_0x1c489b;return _0x179b75;})[_0xe657('0x24')](respondWithFilteredResult(_0x12f409,_0x5e1071))[_0xe657('0x41')](handleError(_0x12f409,null));};exports[_0xe657('0x42')]=function(_0x3a94b0,_0xd71a8c){var _0x48e36f={'raw':!![],'where':{'id':_0x3a94b0['params']['id']}},_0x435c3b={};_0x435c3b[_0xe657('0x2e')]=_[_0xe657('0x31')](db['SmsApplication'][_0xe657('0x2a')]);_0x435c3b[_0xe657('0x30')]=_[_0xe657('0x31')](_0x3a94b0['query']);_0x435c3b[_0xe657('0x43')]=_[_0xe657('0x33')](_0x435c3b['model'],_0x435c3b[_0xe657('0x30')]);_0x48e36f[_0xe657('0x35')]=_[_0xe657('0x33')](_0x435c3b[_0xe657('0x2e')],qs['fields'](_0x3a94b0[_0xe657('0x30')][_0xe657('0x34')]));_0x48e36f[_0xe657('0x35')]=_0x48e36f[_0xe657('0x35')]['length']?_0x48e36f[_0xe657('0x35')]:_0x435c3b['model'];if(_0x3a94b0['query'][_0xe657('0x3f')]){_0x48e36f[_0xe657('0x40')]=[{'all':!![]}];}_0x48e36f=_[_0xe657('0x3d')]({},_0x48e36f,_0x3a94b0[_0xe657('0x3e')]);return db[_0xe657('0x29')][_0xe657('0x44')](_0x48e36f)[_0xe657('0x24')](handleEntityNotFound(_0xd71a8c,null))[_0xe657('0x24')](respondWithResult(_0xd71a8c,null))[_0xe657('0x41')](handleError(_0xd71a8c,null));};exports['create']=function(_0x54929c,_0x1dcab3){return db[_0xe657('0x29')][_0xe657('0x45')](_0x54929c[_0xe657('0x46')],{})[_0xe657('0x24')](respondWithResult(_0x1dcab3,0xc9))['catch'](handleError(_0x1dcab3,null));};exports['update']=function(_0x3804d4,_0x405877){if(_0x3804d4['body']['id']){delete _0x3804d4['body']['id'];}return db['SmsApplication'][_0xe657('0x44')]({'where':{'id':_0x3804d4[_0xe657('0x47')]['id']}})['then'](handleEntityNotFound(_0x405877,null))['then'](saveUpdates(_0x3804d4[_0xe657('0x46')],null))['then'](respondWithResult(_0x405877,null))[_0xe657('0x41')](handleError(_0x405877,null));};exports[_0xe657('0x23')]=function(_0x2a005f,_0x2820b7){return db['SmsApplication'][_0xe657('0x44')]({'where':{'id':_0x2a005f[_0xe657('0x47')]['id']}})[_0xe657('0x24')](handleEntityNotFound(_0x2820b7,null))[_0xe657('0x24')](removeEntity(_0x2820b7,null))['catch'](handleError(_0x2820b7,null));}; \ No newline at end of file +var _0xeba2=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','params','filtears','include','options','create','update','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName'];(function(_0x30f059,_0x506e04){var _0x1e9f6b=function(_0x51da97){while(--_0x51da97){_0x30f059['push'](_0x30f059['shift']());}};_0x1e9f6b(++_0x506e04);}(_0xeba2,0x70));var _0x2eba=function(_0x1c3370,_0xf617e8){_0x1c3370=_0x1c3370-0x0;var _0xa9b358=_0xeba2[_0x1c3370];return _0xa9b358;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2eba('0x0'));var zipdir=require(_0x2eba('0x1'));var jsonpatch=require(_0x2eba('0x2'));var rp=require(_0x2eba('0x3'));var moment=require(_0x2eba('0x4'));var BPromise=require(_0x2eba('0x5'));var Mustache=require(_0x2eba('0x6'));var util=require(_0x2eba('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2eba('0x8'));var fs=require('fs');var _=require(_0x2eba('0x9'));var squel=require(_0x2eba('0xa'));var crypto=require('crypto');var jsforce=require(_0x2eba('0xb'));var deskjs=require(_0x2eba('0xc'));var toCsv=require(_0x2eba('0xd'));var querystring=require(_0x2eba('0xe'));var Papa=require(_0x2eba('0xf'));var Redis=require(_0x2eba('0x10'));var authService=require(_0x2eba('0x11'));var qs=require(_0x2eba('0x12'));var as=require(_0x2eba('0x13'));var hardwareService=require(_0x2eba('0x14'));var logger=require('../../config/logger')(_0x2eba('0x15'));var utils=require(_0x2eba('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2eba('0x17'));var db=require(_0x2eba('0x18'))['db'];function respondWithStatusCode(_0x1d5979,_0x424217){_0x424217=_0x424217||0xcc;return function(_0x23a642){if(_0x23a642){return _0x1d5979[_0x2eba('0x19')](_0x424217);}return _0x1d5979[_0x2eba('0x1a')](_0x424217)['end']();};}function respondWithResult(_0x4987c1,_0x383ad5){_0x383ad5=_0x383ad5||0xc8;return function(_0x12f03c){if(_0x12f03c){return _0x4987c1[_0x2eba('0x1a')](_0x383ad5)[_0x2eba('0x1b')](_0x12f03c);}};}function respondWithFilteredResult(_0x3e6a85,_0x4f4862){return function(_0x3e6d7d){if(_0x3e6d7d){var _0x475f6f=_0x3e6d7d['count'],_0x43f417=_0x4f4862[_0x2eba('0x1c')],_0x3e5664=_0x4f4862['offset']+_0x4f4862['limit'],_0x2de66e;if(_0x3e5664>=_0x475f6f){_0x3e5664=_0x475f6f;_0x2de66e=0xc8;}else{_0x2de66e=0xce;}_0x3e6a85[_0x2eba('0x1a')](_0x2de66e);return _0x3e6a85[_0x2eba('0x1d')](_0x2eba('0x1e'),_0x43f417+'-'+_0x3e5664+'/'+_0x475f6f)[_0x2eba('0x1b')](_0x3e6d7d);}return null;};}function patchUpdates(_0x3beadb){return function(_0x2683ed){try{jsonpatch[_0x2eba('0x1f')](_0x2683ed,_0x3beadb,!![]);}catch(_0x56574e){return BPromise[_0x2eba('0x20')](_0x56574e);}return _0x2683ed[_0x2eba('0x21')]();};}function saveUpdates(_0x1838de,_0x2368a6){return function(_0x3e1941){if(_0x3e1941){return _0x3e1941['update'](_0x1838de)[_0x2eba('0x22')](function(_0x5dba0d){return _0x5dba0d;});}return null;};}function removeEntity(_0x57d4fe,_0x4aef10){return function(_0x10d89){if(_0x10d89){return _0x10d89[_0x2eba('0x23')]()[_0x2eba('0x22')](function(){_0x57d4fe[_0x2eba('0x1a')](0xcc)[_0x2eba('0x24')]();});}};}function handleEntityNotFound(_0x4a5b71,_0x163cd9){return function(_0x2405cd){if(!_0x2405cd){_0x4a5b71['sendStatus'](0x194);}return _0x2405cd;};}function handleError(_0x9750ea,_0x56f706){_0x56f706=_0x56f706||0x1f4;return function(_0x2e5bc6){logger[_0x2eba('0x25')](_0x2e5bc6[_0x2eba('0x26')]);if(_0x2e5bc6[_0x2eba('0x27')]){delete _0x2e5bc6['name'];}_0x9750ea[_0x2eba('0x1a')](_0x56f706)[_0x2eba('0x28')](_0x2e5bc6);};}exports[_0x2eba('0x29')]=function(_0x1cf897,_0x3d8d31){var _0xe6cf1e={},_0xed2955={},_0x4f3bca={'count':0x0,'rows':[]};var _0x24dd4a=_[_0x2eba('0x2a')](db[_0x2eba('0x2b')][_0x2eba('0x2c')],function(_0x24f128){return{'name':_0x24f128[_0x2eba('0x2d')],'type':_0x24f128[_0x2eba('0x2e')][_0x2eba('0x2f')]};});_0xed2955[_0x2eba('0x30')]=_[_0x2eba('0x2a')](_0x24dd4a,'name');_0xed2955[_0x2eba('0x31')]=_[_0x2eba('0x32')](_0x1cf897[_0x2eba('0x31')]);_0xed2955[_0x2eba('0x33')]=_[_0x2eba('0x34')](_0xed2955['model'],_0xed2955[_0x2eba('0x31')]);_0xe6cf1e[_0x2eba('0x35')]=_[_0x2eba('0x34')](_0xed2955['model'],qs[_0x2eba('0x36')](_0x1cf897[_0x2eba('0x31')]['fields']));_0xe6cf1e['attributes']=_0xe6cf1e[_0x2eba('0x35')][_0x2eba('0x37')]?_0xe6cf1e[_0x2eba('0x35')]:_0xed2955[_0x2eba('0x30')];if(!_0x1cf897[_0x2eba('0x31')][_0x2eba('0x38')](_0x2eba('0x39'))){_0xe6cf1e[_0x2eba('0x3a')]=qs['limit'](_0x1cf897[_0x2eba('0x31')][_0x2eba('0x3a')]);_0xe6cf1e[_0x2eba('0x1c')]=qs[_0x2eba('0x1c')](_0x1cf897['query'][_0x2eba('0x1c')]);}_0xe6cf1e[_0x2eba('0x3b')]=qs[_0x2eba('0x3c')](_0x1cf897[_0x2eba('0x31')][_0x2eba('0x3c')]);_0xe6cf1e[_0x2eba('0x3d')]=qs['filters'](_[_0x2eba('0x3e')](_0x1cf897[_0x2eba('0x31')],_0xed2955['filters']),_0x24dd4a);if(_0x1cf897[_0x2eba('0x31')][_0x2eba('0x3f')]){_0xe6cf1e[_0x2eba('0x3d')]=_[_0x2eba('0x40')](_0xe6cf1e[_0x2eba('0x3d')],{'$or':_[_0x2eba('0x2a')](_0x24dd4a,function(_0x125d5d){if(_0x125d5d[_0x2eba('0x2e')]!==_0x2eba('0x41')){var _0x5ac417={};_0x5ac417[_0x125d5d[_0x2eba('0x27')]]={'$like':'%'+_0x1cf897[_0x2eba('0x31')]['filter']+'%'};return _0x5ac417;}})});}_0xe6cf1e=_[_0x2eba('0x40')]({},_0xe6cf1e,_0x1cf897['options']);var _0x1b914d={'where':_0xe6cf1e['where']};return db[_0x2eba('0x2b')][_0x2eba('0x42')](_0x1b914d)[_0x2eba('0x22')](function(_0x31295d){_0x4f3bca[_0x2eba('0x42')]=_0x31295d;if(_0x1cf897[_0x2eba('0x31')][_0x2eba('0x43')]){_0xe6cf1e['include']=[{'all':!![]}];}return db['SmsApplication'][_0x2eba('0x44')](_0xe6cf1e);})[_0x2eba('0x22')](function(_0x44f1eb){_0x4f3bca[_0x2eba('0x45')]=_0x44f1eb;return _0x4f3bca;})[_0x2eba('0x22')](respondWithFilteredResult(_0x3d8d31,_0xe6cf1e))[_0x2eba('0x46')](handleError(_0x3d8d31,null));};exports['show']=function(_0x2be5cf,_0x1c59b0){var _0x1035a4={'raw':!![],'where':{'id':_0x2be5cf[_0x2eba('0x47')]['id']}},_0x16c916={};_0x16c916[_0x2eba('0x30')]=_[_0x2eba('0x32')](db['SmsApplication'][_0x2eba('0x2c')]);_0x16c916['query']=_[_0x2eba('0x32')](_0x2be5cf['query']);_0x16c916[_0x2eba('0x48')]=_[_0x2eba('0x34')](_0x16c916[_0x2eba('0x30')],_0x16c916[_0x2eba('0x31')]);_0x1035a4[_0x2eba('0x35')]=_['intersection'](_0x16c916[_0x2eba('0x30')],qs['fields'](_0x2be5cf[_0x2eba('0x31')]['fields']));_0x1035a4[_0x2eba('0x35')]=_0x1035a4[_0x2eba('0x35')][_0x2eba('0x37')]?_0x1035a4[_0x2eba('0x35')]:_0x16c916[_0x2eba('0x30')];if(_0x2be5cf['query'][_0x2eba('0x43')]){_0x1035a4[_0x2eba('0x49')]=[{'all':!![]}];}_0x1035a4=_[_0x2eba('0x40')]({},_0x1035a4,_0x2be5cf[_0x2eba('0x4a')]);return db[_0x2eba('0x2b')]['find'](_0x1035a4)[_0x2eba('0x22')](handleEntityNotFound(_0x1c59b0,null))[_0x2eba('0x22')](respondWithResult(_0x1c59b0,null))[_0x2eba('0x46')](handleError(_0x1c59b0,null));};exports['create']=function(_0x28cbe8,_0x56d3bf){return db[_0x2eba('0x2b')][_0x2eba('0x4b')](_0x28cbe8['body'],{})[_0x2eba('0x22')](respondWithResult(_0x56d3bf,0xc9))['catch'](handleError(_0x56d3bf,null));};exports[_0x2eba('0x4c')]=function(_0x3ce62b,_0x264841){if(_0x3ce62b[_0x2eba('0x4d')]['id']){delete _0x3ce62b['body']['id'];}return db[_0x2eba('0x2b')][_0x2eba('0x4e')]({'where':{'id':_0x3ce62b[_0x2eba('0x47')]['id']}})[_0x2eba('0x22')](handleEntityNotFound(_0x264841,null))[_0x2eba('0x22')](saveUpdates(_0x3ce62b[_0x2eba('0x4d')],null))[_0x2eba('0x22')](respondWithResult(_0x264841,null))['catch'](handleError(_0x264841,null));};exports['destroy']=function(_0x780295,_0x39b67e){return db[_0x2eba('0x2b')][_0x2eba('0x4e')]({'where':{'id':_0x780295[_0x2eba('0x47')]['id']}})[_0x2eba('0x22')](handleEntityNotFound(_0x39b67e,null))[_0x2eba('0x22')](removeEntity(_0x39b67e,null))['catch'](handleError(_0x39b67e,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 5f2bc9b..e03d3d3 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 _0xe67c=['path','rimraf','../../config/environment','exports','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise'];(function(_0x565f9b,_0x3697c0){var _0x1a27f9=function(_0x1ba5de){while(--_0x1ba5de){_0x565f9b['push'](_0x565f9b['shift']());}};_0x1a27f9(++_0x3697c0);}(_0xe67c,0x19f));var _0xce67=function(_0x4443c1,_0x11fe43){_0x4443c1=_0x4443c1-0x0;var _0x558ec1=_0xe67c[_0x4443c1];return _0x558ec1;};'use strict';var _=require(_0xce67('0x0'));var util=require(_0xce67('0x1'));var logger=require('../../config/logger')(_0xce67('0x2'));var moment=require(_0xce67('0x3'));var BPromise=require('bluebird');var rp=require(_0xce67('0x4'));var fs=require('fs');var path=require(_0xce67('0x5'));var rimraf=require(_0xce67('0x6'));var config=require(_0xce67('0x7'));var attributes=require('./smsApplication.attributes');module[_0xce67('0x8')]=function(_0xbf4b24,_0x5a996c){return _0xbf4b24['define']('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xce67('0x9')});}; \ No newline at end of file +var _0x2a1e=['bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x5d4927,_0x52abb4){var _0x2a9353=function(_0x19777a){while(--_0x19777a){_0x5d4927['push'](_0x5d4927['shift']());}};_0x2a9353(++_0x52abb4);}(_0x2a1e,0xc1));var _0xe2a1=function(_0x2690ff,_0x4895e6){_0x2690ff=_0x2690ff-0x0;var _0x4c4faa=_0x2a1e[_0x2690ff];return _0x4c4faa;};'use strict';var _=require(_0xe2a1('0x0'));var util=require('util');var logger=require(_0xe2a1('0x1'))(_0xe2a1('0x2'));var moment=require('moment');var BPromise=require(_0xe2a1('0x3'));var rp=require(_0xe2a1('0x4'));var fs=require('fs');var path=require(_0xe2a1('0x5'));var rimraf=require(_0xe2a1('0x6'));var config=require(_0xe2a1('0x7'));var attributes=require(_0xe2a1('0x8'));module[_0xe2a1('0x9')]=function(_0xbc335,_0x2758b6){return _0xbc335[_0xe2a1('0xa')](_0xe2a1('0xb'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe2a1('0xc'),'collate':_0xe2a1('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index a8f918f..fb7ed06 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 _0x6fc4=['randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error','code','SmsApplication,\x20%s,\x20%s','message','info','catch','lodash','util'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0x6fc4,0x1a0));var _0x46fc=function(_0x188cb8,_0x3b12b3){_0x188cb8=_0x188cb8-0x0;var _0x25eb9b=_0x6fc4[_0x188cb8];return _0x25eb9b;};'use strict';var _=require(_0x46fc('0x0'));var util=require(_0x46fc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x46fc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x46fc('0x3'))(_0x46fc('0x4'));var config=require(_0x46fc('0x5'));var jayson=require(_0x46fc('0x6'));var client=jayson[_0x46fc('0x7')][_0x46fc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c4f75,_0x3951e9,_0x5ca981){return new BPromise(function(_0x4a7762,_0x149bf8){return client[_0x46fc('0x9')](_0x3c4f75,_0x5ca981)[_0x46fc('0xa')](function(_0x4594c1){logger['info']('SmsApplication,\x20%s,\x20%s',_0x3951e9,_0x46fc('0xb'));logger[_0x46fc('0xc')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x3951e9,_0x46fc('0xb'),JSON['stringify'](_0x4594c1));if(_0x4594c1[_0x46fc('0xd')]){if(_0x4594c1[_0x46fc('0xd')][_0x46fc('0xe')]===0x1f4){logger[_0x46fc('0xd')](_0x46fc('0xf'),_0x3951e9,_0x4594c1[_0x46fc('0xd')][_0x46fc('0x10')]);return _0x149bf8(_0x4594c1[_0x46fc('0xd')][_0x46fc('0x10')]);}logger[_0x46fc('0xd')](_0x46fc('0xf'),_0x3951e9,_0x4594c1[_0x46fc('0xd')][_0x46fc('0x10')]);return _0x4a7762(_0x4594c1[_0x46fc('0xd')][_0x46fc('0x10')]);}else{logger[_0x46fc('0x11')](_0x46fc('0xf'),_0x3951e9,_0x46fc('0xb'));_0x4a7762(_0x4594c1['result'][_0x46fc('0x10')]);}})[_0x46fc('0x12')](function(_0x1df938){logger[_0x46fc('0xd')](_0x46fc('0xf'),_0x3951e9,_0x1df938);_0x149bf8(_0x1df938);});});} \ No newline at end of file +var _0x9c48=['debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0x9c48,0xa1));var _0x89c4=function(_0xde4b85,_0x10c94e){_0xde4b85=_0xde4b85-0x0;var _0xf25b34=_0x9c48[_0xde4b85];return _0xf25b34;};'use strict';var _=require(_0x89c4('0x0'));var util=require(_0x89c4('0x1'));var moment=require(_0x89c4('0x2'));var BPromise=require('bluebird');var rs=require(_0x89c4('0x3'));var fs=require('fs');var Redis=require(_0x89c4('0x4'));var db=require(_0x89c4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x89c4('0x6'));var config=require(_0x89c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x89c4('0x8')][_0x89c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d0303,_0x213a86,_0x30cdf1){return new BPromise(function(_0x7faf5,_0x26ab92){return client[_0x89c4('0xa')](_0x1d0303,_0x30cdf1)[_0x89c4('0xb')](function(_0xad4f2c){logger[_0x89c4('0xc')](_0x89c4('0xd'),_0x213a86,_0x89c4('0xe'));logger[_0x89c4('0xf')](_0x89c4('0x10'),_0x213a86,_0x89c4('0xe'),JSON[_0x89c4('0x11')](_0xad4f2c));if(_0xad4f2c[_0x89c4('0x12')]){if(_0xad4f2c[_0x89c4('0x12')][_0x89c4('0x13')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x213a86,_0xad4f2c['error'][_0x89c4('0x14')]);return _0x26ab92(_0xad4f2c[_0x89c4('0x12')][_0x89c4('0x14')]);}logger[_0x89c4('0x12')](_0x89c4('0xd'),_0x213a86,_0xad4f2c[_0x89c4('0x12')][_0x89c4('0x14')]);return _0x7faf5(_0xad4f2c['error'][_0x89c4('0x14')]);}else{logger[_0x89c4('0xc')](_0x89c4('0xd'),_0x213a86,_0x89c4('0xe'));_0x7faf5(_0xad4f2c['result'][_0x89c4('0x14')]);}})[_0x89c4('0x15')](function(_0xae1ed7){logger['error'](_0x89c4('0xd'),_0x213a86,_0xae1ed7);_0x26ab92(_0xae1ed7);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index f096bc1..ac5ab90 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 _0x6bdc=['post','create','/:id/messages','addMessage','/:id/tags','tracked','sms','addTags','smsinteraction:update','update','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','download'];(function(_0x4faab0,_0x544bf3){var _0x5b1f25=function(_0xf5d089){while(--_0xf5d089){_0x4faab0['push'](_0x4faab0['shift']());}};_0x5b1f25(++_0x544bf3);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x261ece,_0x2e5f13){_0x261ece=_0x261ece-0x0;var _0x9d5d47=_0x6bdc[_0x261ece];return _0x9d5d47;};'use strict';var multer=require(_0xc6bd('0x0'));var util=require(_0xc6bd('0x1'));var path=require(_0xc6bd('0x2'));var timeout=require(_0xc6bd('0x3'));var express=require(_0xc6bd('0x4'));var router=express[_0xc6bd('0x5')]();var auth=require(_0xc6bd('0x6'));var interaction=require(_0xc6bd('0x7'));var config=require(_0xc6bd('0x8'));var controller=require(_0xc6bd('0x9'));router['get']('/',auth[_0xc6bd('0xa')](),controller[_0xc6bd('0xb')]);router[_0xc6bd('0xc')](_0xc6bd('0xd'),auth[_0xc6bd('0xa')](),controller[_0xc6bd('0xe')]);router['get'](_0xc6bd('0xf'),auth[_0xc6bd('0xa')](),controller[_0xc6bd('0x10')]);router['get']('/:id/messages',auth[_0xc6bd('0xa')](),controller['getMessages']);router[_0xc6bd('0xc')]('/:id/download',auth[_0xc6bd('0xa')](),controller[_0xc6bd('0x11')]);router[_0xc6bd('0x12')]('/',auth[_0xc6bd('0xa')](),controller[_0xc6bd('0x13')]);router[_0xc6bd('0x12')](_0xc6bd('0x14'),auth[_0xc6bd('0xa')](),controller[_0xc6bd('0x15')]);router[_0xc6bd('0x12')](_0xc6bd('0x16'),auth[_0xc6bd('0xa')](),interaction[_0xc6bd('0x17')](_0xc6bd('0x18'),'smsinteraction:addtags'),controller[_0xc6bd('0x19')]);router['put']('/:id',auth[_0xc6bd('0xa')](),interaction[_0xc6bd('0x17')](_0xc6bd('0x18'),_0xc6bd('0x1a')),controller[_0xc6bd('0x1b')]);router['delete']('/:id',auth[_0xc6bd('0xa')](),interaction['tracked'](_0xc6bd('0x18'),_0xc6bd('0x1c')),controller[_0xc6bd('0x1d')]);router['delete'](_0xc6bd('0x16'),auth[_0xc6bd('0xa')](),controller[_0xc6bd('0x1e')]);module[_0xc6bd('0x1f')]=router; \ No newline at end of file +var _0xa898=['show','/:id/messages','download','create','addMessage','post','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','destroy','/:id/tags','removeTags','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','/:id'];(function(_0x267375,_0x1d0f31){var _0x105db1=function(_0x4c1b88){while(--_0x4c1b88){_0x267375['push'](_0x267375['shift']());}};_0x105db1(++_0x1d0f31);}(_0xa898,0x17c));var _0x8a89=function(_0x5de424,_0x50958f){_0x5de424=_0x5de424-0x0;var _0x46fd64=_0xa898[_0x5de424];return _0x46fd64;};'use strict';var multer=require(_0x8a89('0x0'));var util=require('util');var path=require(_0x8a89('0x1'));var timeout=require(_0x8a89('0x2'));var express=require(_0x8a89('0x3'));var router=express['Router']();var auth=require(_0x8a89('0x4'));var interaction=require(_0x8a89('0x5'));var config=require('../../config/environment');var controller=require('./smsInteraction.controller');router[_0x8a89('0x6')]('/',auth['isAuthenticated'](),controller[_0x8a89('0x7')]);router[_0x8a89('0x6')]('/describe',auth[_0x8a89('0x8')](),controller['describe']);router[_0x8a89('0x6')](_0x8a89('0x9'),auth[_0x8a89('0x8')](),controller[_0x8a89('0xa')]);router[_0x8a89('0x6')](_0x8a89('0xb'),auth[_0x8a89('0x8')](),controller['getMessages']);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x8a89('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8a89('0xd')]);router['post'](_0x8a89('0xb'),auth['isAuthenticated'](),controller[_0x8a89('0xe')]);router[_0x8a89('0xf')]('/:id/tags',auth[_0x8a89('0x8')](),interaction[_0x8a89('0x10')](_0x8a89('0x11'),_0x8a89('0x12')),controller[_0x8a89('0x13')]);router[_0x8a89('0x14')](_0x8a89('0x9'),auth[_0x8a89('0x8')](),interaction[_0x8a89('0x10')](_0x8a89('0x11'),_0x8a89('0x15')),controller['update']);router[_0x8a89('0x16')](_0x8a89('0x9'),auth[_0x8a89('0x8')](),interaction[_0x8a89('0x10')](_0x8a89('0x11'),'smsinteraction:destroy'),controller[_0x8a89('0x17')]);router[_0x8a89('0x16')](_0x8a89('0x18'),auth[_0x8a89('0x8')](),controller[_0x8a89('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index e0224f1..232cc84 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 _0xac5c=['DATE','STRING','ENUM','out','sequelize','moment','BOOLEAN'];(function(_0x1c743c,_0x15196b){var _0x4c0a72=function(_0x3c170a){while(--_0x3c170a){_0x1c743c['push'](_0x1c743c['shift']());}};_0x4c0a72(++_0x15196b);}(_0xac5c,0xcf));var _0xcac5=function(_0x3925e0,_0x5247e4){_0x3925e0=_0x3925e0-0x0;var _0x2b34fa=_0xac5c[_0x3925e0];return _0x2b34fa;};'use strict';var Sequelize=require(_0xcac5('0x0'));var moment=require(_0xcac5('0x1'));module['exports']={'closed':{'type':Sequelize[_0xcac5('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcac5('0x3')]},'disposition':{'type':Sequelize[_0xcac5('0x4')]},'secondDisposition':{'type':Sequelize[_0xcac5('0x4')]},'thirdDisposition':{'type':Sequelize[_0xcac5('0x4')]},'note':{'type':Sequelize[_0xcac5('0x4')]},'phone':{'type':Sequelize[_0xcac5('0x4')]},'read1stAt':{'type':Sequelize[_0xcac5('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xcac5('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xcac5('0x5')]('in',_0xcac5('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xa7aa=['BOOLEAN','STRING','DATE','out','ENUM','sequelize'];(function(_0x483934,_0x561521){var _0x3383b7=function(_0x19ddae){while(--_0x19ddae){_0x483934['push'](_0x483934['shift']());}};_0x3383b7(++_0x561521);}(_0xa7aa,0x131));var _0xaa7a=function(_0x48010d,_0xdcf731){_0x48010d=_0x48010d-0x0;var _0x56bfa9=_0xa7aa[_0x48010d];return _0x56bfa9;};'use strict';var Sequelize=require(_0xaa7a('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0xaa7a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xaa7a('0x2')]},'thirdDisposition':{'type':Sequelize[_0xaa7a('0x2')]},'note':{'type':Sequelize[_0xaa7a('0x2')]},'phone':{'type':Sequelize[_0xaa7a('0x2')]},'read1stAt':{'type':Sequelize[_0xaa7a('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xaa7a('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xaa7a('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xaa7a('0x5')]('in',_0xaa7a('0x4')),'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 8bcf0c6..0b84b1e 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 _0xf4df=['omit','ids','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','options','SmsMessage','findAll','addTags','spread','removeTags','join','files','root','server','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','secret','SmsAccount','Owner','get','mkdirSync','10px','40px','30px','Sms','YYYY-MM-DD','Account','N.A.','closed','closedAt','disposition','out','System','renderFile','views','downloadInteraction.html','toFile','transcript-','download','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','status','end','count','offset','Content-Range','json','then','destroy','sendStatus','error','stack','name','send','Users','fullname','Tags','TagIds','split','forEach','push','catch','index','map','SmsInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.SmsInteractionId','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','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','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','rows','show','params','rawAttributes','filtears','includeAll','include','find','create','describe','addMessage'];(function(_0x4a9520,_0x4e67b2){var _0x27d098=function(_0x3e367c){while(--_0x3e367c){_0x4a9520['push'](_0x4a9520['shift']());}};_0x27d098(++_0x4e67b2);}(_0xf4df,0x111));var _0xff4d=function(_0x34a713,_0x5738af){_0x34a713=_0x34a713-0x0;var _0x35eb36=_0xf4df[_0x34a713];return _0x35eb36;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xff4d('0x0'));var zipdir=require(_0xff4d('0x1'));var jsonpatch=require(_0xff4d('0x2'));var rp=require(_0xff4d('0x3'));var moment=require(_0xff4d('0x4'));var BPromise=require(_0xff4d('0x5'));var Mustache=require('mustache');var util=require(_0xff4d('0x6'));var path=require('path');var sox=require(_0xff4d('0x7'));var csv=require(_0xff4d('0x8'));var ejs=require(_0xff4d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xff4d('0xa'));var crypto=require('crypto');var jsforce=require(_0xff4d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xff4d('0x8'));var querystring=require(_0xff4d('0xc'));var Papa=require('papaparse');var Redis=require(_0xff4d('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xff4d('0xe'));var as=require(_0xff4d('0xf'));var hardwareService=require(_0xff4d('0x10'));var logger=require(_0xff4d('0x11'))(_0xff4d('0x12'));var utils=require(_0xff4d('0x13'));var config=require(_0xff4d('0x14'));var licenseUtil=require(_0xff4d('0x15'));var db=require(_0xff4d('0x16'))['db'];config[_0xff4d('0x17')]=_['defaults'](config[_0xff4d('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xff4d('0x18'))(new Redis(config[_0xff4d('0x17')]));require('./smsInteraction.socket')[_0xff4d('0x19')](socket);function respondWithStatusCode(_0x38db9d,_0x5e0a60){_0x5e0a60=_0x5e0a60||0xcc;return function(_0x11e54a){if(_0x11e54a){return _0x38db9d['sendStatus'](_0x5e0a60);}return _0x38db9d[_0xff4d('0x1a')](_0x5e0a60)[_0xff4d('0x1b')]();};}function respondWithResult(_0x46207b,_0x3b0a04){_0x3b0a04=_0x3b0a04||0xc8;return function(_0x29ed5a){if(_0x29ed5a){return _0x46207b[_0xff4d('0x1a')](_0x3b0a04)['json'](_0x29ed5a);}};}function respondWithFilteredResult(_0x1d1415,_0x5e8813){return function(_0x20b7ee){if(_0x20b7ee){var _0x366f22=_0x20b7ee[_0xff4d('0x1c')],_0x2b1587=_0x5e8813[_0xff4d('0x1d')],_0x447ebe=_0x5e8813[_0xff4d('0x1d')]+_0x5e8813['limit'],_0x416217;if(_0x447ebe>=_0x366f22){_0x447ebe=_0x366f22;_0x416217=0xc8;}else{_0x416217=0xce;}_0x1d1415['status'](_0x416217);return _0x1d1415['set'](_0xff4d('0x1e'),_0x2b1587+'-'+_0x447ebe+'/'+_0x366f22)[_0xff4d('0x1f')](_0x20b7ee);}return null;};}function patchUpdates(_0x190f9){return function(_0x13bfd7){try{jsonpatch['apply'](_0x13bfd7,_0x190f9,!![]);}catch(_0x217c59){return BPromise['reject'](_0x217c59);}return _0x13bfd7['save']();};}function saveUpdates(_0x427e9c,_0x196703){return function(_0x42e43b){if(_0x42e43b){return _0x42e43b['update'](_0x427e9c)[_0xff4d('0x20')](function(_0x15505d){return _0x15505d;});}return null;};}function removeEntity(_0x4d420a,_0x3d570c){return function(_0x3349f2){if(_0x3349f2){return _0x3349f2[_0xff4d('0x21')]()[_0xff4d('0x20')](function(){_0x4d420a[_0xff4d('0x1a')](0xcc)[_0xff4d('0x1b')]();});}};}function handleEntityNotFound(_0x327b48,_0x1814a3){return function(_0x5ed105){if(!_0x5ed105){_0x327b48[_0xff4d('0x22')](0x194);}return _0x5ed105;};}function handleError(_0xabdf4b,_0x55132c){_0x55132c=_0x55132c||0x1f4;return function(_0x37970f){logger[_0xff4d('0x23')](_0x37970f[_0xff4d('0x24')]);if(_0x37970f[_0xff4d('0x25')]){delete _0x37970f['name'];}_0xabdf4b['status'](_0x55132c)[_0xff4d('0x26')](_0x37970f);};}function getInteractionUsers(_0x4d0824,_0x310080){return new BPromise(function(_0x3932a3,_0x178354){try{if(_0x310080[_0x4d0824['id']]){_0x4d0824[_0xff4d('0x27')]=_['map'](_0x310080[_0x4d0824['id']],function(_0x3855d5){return{'id':_0x3855d5['id'],'fullname':_0x3855d5[_0xff4d('0x28')]};});}}catch(_0x882aa){_0x178354(_0x882aa);}_0x3932a3(_0x4d0824);});}function getInteractionTags(_0x53f72f,_0x7fa5db){return new BPromise(function(_0x25ff1d,_0x4c61cf){try{if(_0x53f72f['TagIds']){_0x53f72f[_0xff4d('0x29')]=[];_0x53f72f[_0xff4d('0x2a')][_0xff4d('0x2b')](',')[_0xff4d('0x2c')](function(_0x146e3a){_0x53f72f['Tags'][_0xff4d('0x2d')](_0x7fa5db[_0x146e3a]);});}delete _0x53f72f[_0xff4d('0x2a')];}catch(_0x1f57e0){_0x4c61cf(_0x1f57e0);}_0x25ff1d(_0x53f72f);});}function updateSmsInteraction(_0xf4706d,_0x318379,_0x448c86){return new BPromise(function(_0x186a0f,_0x1b49c2){return getInteractionUsers(_0xf4706d,_0x448c86)[_0xff4d('0x20')](function(_0x4dd091){return getInteractionTags(_0x4dd091,_0x318379);})[_0xff4d('0x20')](function(_0x1b5443){_0x186a0f(_0x1b5443);})[_0xff4d('0x2e')](function(_0x1bf985){_0x1b49c2(_0x1bf985);});});}exports[_0xff4d('0x2f')]=function(_0x35f99a,_0x44d28e){var _0xebf232={},_0x3aaaaa={},_0x18a044={'count':0x0,'rows':[]};var _0x557281=_[_0xff4d('0x30')](db[_0xff4d('0x31')]['rawAttributes'],function(_0xe302c5){return{'name':_0xe302c5[_0xff4d('0x32')],'type':_0xe302c5[_0xff4d('0x33')][_0xff4d('0x34')]};});_0x3aaaaa[_0xff4d('0x35')]=_[_0xff4d('0x30')](_0x557281,_0xff4d('0x25'));_0x3aaaaa[_0xff4d('0x36')]=_[_0xff4d('0x37')](_0x35f99a[_0xff4d('0x36')]);_0x3aaaaa[_0xff4d('0x38')]=_[_0xff4d('0x39')](_0x3aaaaa[_0xff4d('0x35')],_0x3aaaaa[_0xff4d('0x36')]);_0xebf232[_0xff4d('0x3a')]=_[_0xff4d('0x39')](_0x3aaaaa[_0xff4d('0x35')],qs[_0xff4d('0x3b')](_0x35f99a[_0xff4d('0x36')][_0xff4d('0x3b')]));_0xebf232[_0xff4d('0x3a')]=_0xebf232[_0xff4d('0x3a')][_0xff4d('0x3c')]?_0xebf232[_0xff4d('0x3a')]:_0x3aaaaa[_0xff4d('0x35')];if(!_0x35f99a[_0xff4d('0x36')][_0xff4d('0x3d')](_0xff4d('0x3e'))){_0xebf232[_0xff4d('0x3f')]=qs['limit'](_0x35f99a[_0xff4d('0x36')]['limit']);_0xebf232[_0xff4d('0x1d')]=qs['offset'](_0x35f99a['query'][_0xff4d('0x1d')]);}_0xebf232['order']=qs[_0xff4d('0x40')](_0x35f99a[_0xff4d('0x36')][_0xff4d('0x40')]);_0xebf232['where']=qs[_0xff4d('0x38')](_[_0xff4d('0x41')](_0x35f99a[_0xff4d('0x36')],_0x3aaaaa[_0xff4d('0x38')]),_0x557281);var _0x301633=[];var _0x4ceb19=squel['select']()[_0xff4d('0x42')]('id')[_0xff4d('0x42')]('name')['field'](_0xff4d('0x43'))[_0xff4d('0x44')](_0xff4d('0x45'));var _0x4f057c=squel[_0xff4d('0x46')]()[_0xff4d('0x42')](_0xff4d('0x47'))['field'](_0xff4d('0x48'))['field'](_0xff4d('0x49'))[_0xff4d('0x44')]('user_has_sms_interactions','ui')[_0xff4d('0x4a')](_0xff4d('0x4b'),'u',_0xff4d('0x4c'));var _0x1970e6=squel[_0xff4d('0x46')]()[_0xff4d('0x44')](_0xff4d('0x4d'),'i')[_0xff4d('0x4a')](_0xff4d('0x4e'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xff4d('0x4a')]('users','o',_0xff4d('0x4f'))[_0xff4d('0x4a')](_0xff4d('0x50'),'a',_0xff4d('0x51'))['left_join'](_0xff4d('0x52'),'me',_0xff4d('0x53'))[_0xff4d('0x4a')](_0xff4d('0x54'),'it',_0xff4d('0x55'))[_0xff4d('0x4a')](_0xff4d('0x45'),'t',_0xff4d('0x56'));var _0xdccf12=squel[_0xff4d('0x57')]();var _0x506bcd=[];var _0x320f7a=squel[_0xff4d('0x57')]();var _0x1b9b35;if(_0x35f99a[_0xff4d('0x36')]['search']){_0x1b9b35=as[_0xff4d('0x58')](_0x35f99a[_0xff4d('0x36')][_0xff4d('0x59')]);var _0x15420e=_0x1b9b35[_0xff4d('0x5a')];for(var _0x3a25ff=0x0;_0x3a25ff<_0x1b9b35['conditions']['length'];_0x3a25ff++){var _0x2d3986=_0x1b9b35['conditions'][_0x3a25ff];var _0x23129c='i';var _0x2aa682=_['find'](_0x557281,[_0xff4d('0x25'),_0x2d3986['field']]);if(!_0x2aa682){switch(_0x2d3986[_0xff4d('0x42')]){case _0xff4d('0x5b'):if(_0x2d3986[_0xff4d('0x5c')]==0x1){_0x1970e6[_0xff4d('0x5d')]('`'+_0x2d3986[_0xff4d('0x42')]+_0xff4d('0x5e'));}else{_0x1970e6[_0xff4d('0x5d')]('`'+_0x2d3986[_0xff4d('0x42')]+_0xff4d('0x5f'));}break;case _0xff4d('0x60'):if(_0x2d3986[_0xff4d('0x61')]===_0xff4d('0x62')){if(_0x2d3986[_0xff4d('0x5c')][_0xff4d('0x2b')]('\x20')['length']>0x1){_0xdccf12[_0x15420e](_0xff4d('0x63'),qs[_0xff4d('0x64')](_0x2d3986[_0xff4d('0x5c')]),null);}else{var _0x2c7818='%'+_0x2d3986[_0xff4d('0x5c')]+'%';_0xdccf12[_0x15420e](_0xff4d('0x65'),_0x2c7818,_0x2c7818,_0x2c7818);}}else{_0x2aa682=_['find'](_0x557281,[_0xff4d('0x25'),_0xff4d('0x66')]);_0x2d3986['field']=_0xff4d('0x66');_0x314bb5=as[_0xff4d('0x67')](_0x23129c,_0x2aa682[_0xff4d('0x33')],_0x2d3986);_0xdccf12[_0x15420e](_0x314bb5[_0xff4d('0x68')],_0x314bb5['value']['start'],_0x314bb5[_0xff4d('0x5c')]['end']);}break;case _0xff4d('0x69'):var _0x49b4ce=_0x2d3986[_0xff4d('0x5c')][_0xff4d('0x2b')](',')[_0xff4d('0x30')](function(_0x2392e3){return Number(_0x2392e3);});_0x49b4ce[_0xff4d('0x2c')](function(_0x48cd83){_0x320f7a['or'](_0xff4d('0x6a'),'%,'+_0x48cd83+',%');});_0x506bcd=_[_0xff4d('0x6b')](_0x506bcd,_0x49b4ce);break;case _0xff4d('0x6c'):if(_0x2d3986[_0xff4d('0x61')]===_0xff4d('0x62')){_0xdccf12[_0x15420e](_0xff4d('0x6d'),'%'+_0x2d3986[_0xff4d('0x5c')]+'%',null);}else{_0x2aa682=_['find'](_0x557281,[_0xff4d('0x25'),_0xff4d('0x6e')]);_0x2d3986[_0xff4d('0x42')]=_0xff4d('0x6e');_0x314bb5=as[_0xff4d('0x67')](_0x23129c,_0x2aa682[_0xff4d('0x33')],_0x2d3986);_0xdccf12[_0x15420e](_0x314bb5[_0xff4d('0x68')],_0x314bb5[_0xff4d('0x5c')][_0xff4d('0x6f')],_0x314bb5['value'][_0xff4d('0x1b')]);}break;case _0xff4d('0x70'):_0x314bb5=as[_0xff4d('0x67')]('me',null,_0x2d3986);_0xdccf12[_0x15420e](_0x314bb5[_0xff4d('0x68')],_0x314bb5['value']['start'],_0x314bb5[_0xff4d('0x5c')][_0xff4d('0x1b')]);break;}}else{var _0x314bb5=as[_0xff4d('0x67')](_0x23129c,_0x2aa682[_0xff4d('0x33')],_0x2d3986);_0xdccf12[_0x15420e](_0x314bb5['text'],_0x314bb5[_0xff4d('0x5c')][_0xff4d('0x6f')],_0x314bb5[_0xff4d('0x5c')][_0xff4d('0x1b')]);}}}else{var _0x3fd2f3=_(_0x35f99a[_0xff4d('0x36')])[_0xff4d('0x37')]()[_0xff4d('0x30')](function(_0xfac9e7){return _['some'](_0x557281,['name',_0xfac9e7])?_0xfac9e7:undefined;})['compact']()['value']();if(!_['isEmpty'](_0x3fd2f3)){_0x3fd2f3[_0xff4d('0x2c')](function(_0x32cc93){if(_0x32cc93===_0xff4d('0x71')){_0x1970e6[_0xff4d('0x72')](_0xff4d('0x73'),[][_0xff4d('0x74')](_0x35f99a[_0xff4d('0x36')][_0x32cc93]));}else if(_0x32cc93===_0xff4d('0x75')){var _0x497e4c=JSON[_0xff4d('0x76')](_0x35f99a[_0xff4d('0x36')][_0x32cc93])[_0xff4d('0x77')];var _0x59267d=JSON[_0xff4d('0x76')](_0x35f99a['query'][_0x32cc93])[_0xff4d('0x78')];_0x1970e6[_0xff4d('0x72')](_0xff4d('0x79'),_0x497e4c,_0x59267d);}else{if(_0x35f99a[_0xff4d('0x36')][_0x32cc93]===_0xff4d('0x7a')){_0x1970e6[_0xff4d('0x72')]('i.'+_0x32cc93+'\x20IS\x20NULL');}else{_0x1970e6[_0xff4d('0x72')]('i.'+_0x32cc93+_0xff4d('0x7b'),_0x35f99a['query'][_0x32cc93]);}}});}if(_0x35f99a[_0xff4d('0x36')][_0xff4d('0x7c')]){if(_0x35f99a[_0xff4d('0x36')][_0xff4d('0x7c')]==0x1){_0x1970e6[_0xff4d('0x5d')](_0xff4d('0x7d'));}else{_0x1970e6['having'](_0xff4d('0x7e'));}}if(_0x35f99a[_0xff4d('0x36')][_0xff4d('0x7f')]){_0x506bcd=_[_0xff4d('0x80')](_0x35f99a['query'][_0xff4d('0x7f')])?_0x35f99a[_0xff4d('0x36')]['tag']:new Array(_0x35f99a[_0xff4d('0x36')][_0xff4d('0x7f')]);_0x506bcd[_0xff4d('0x2c')](function(_0x7f592f){_0x320f7a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x7f592f+',%');});}if(_0x35f99a[_0xff4d('0x36')][_0xff4d('0x81')]){var _0x30d5ab=_0x35f99a['query'][_0xff4d('0x81')][_0xff4d('0x82')]('\x5c','\x5c\x5c')[_0xff4d('0x82')]('\x27\x27','\x27\x27\x27\x27');if(qs['isNumeric'](_0x30d5ab)){_0xdccf12['or']('i.id\x20LIKE\x20?',_0x30d5ab+'%')['or']('i.phone\x20LIKE\x20?',_0x30d5ab+'%');}else{_0xdccf12['or'](_0xff4d('0x83'),qs[_0xff4d('0x64')](_0x30d5ab))['or'](_0xff4d('0x84'),_0x30d5ab+'%');}}}_0x1970e6['where'](_0xdccf12);_0x1970e6[_0xff4d('0x85')](_0xff4d('0x86'));var _0xe9385c={'type':db['Sequelize'][_0xff4d('0x87')][_0xff4d('0x88')],'raw':!![]};var _0xea66e3=_0x1970e6[_0xff4d('0x89')]();_0xea66e3[_0xff4d('0x42')](_0xff4d('0x86'));_0xea66e3[_0xff4d('0x42')](_0xff4d('0x8a'),_0xff4d('0x5b'));if(_0xebf232[_0xff4d('0x8b')]){_0xebf232[_0xff4d('0x8b')]['forEach'](function(_0x58be07){_0x1970e6[_0xff4d('0x8b')]('i.'+_0x58be07[0x0],_0x58be07[0x1]===_0xff4d('0x8c')?![]:!![]);});}if(!_[_0xff4d('0x8d')](_0x506bcd)){_0x1970e6[_0xff4d('0x5d')](_0x320f7a);_0xea66e3['where'](_0xff4d('0x8e'),_0x506bcd);}BPromise[_0xff4d('0x8f')]()[_0xff4d('0x20')](function(){if(!_0x1b9b35){if(_0x35f99a[_0xff4d('0x36')][_0xff4d('0x71')]||_0x35f99a[_0xff4d('0x36')]['journey'])return;_0xea66e3['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x1970e6[_0xff4d('0x72')](_0xff4d('0x90'));return;}return _0x35f99a[_0xff4d('0x91')][_0xff4d('0x92')]({'attributes':['id'],'raw':!![]})[_0xff4d('0x20')](function(_0x520e94){if(_[_0xff4d('0x8d')](_0x520e94)){_0xea66e3[_0xff4d('0x72')]('i.SmsAccountId\x20IS\x20NULL');_0x1970e6[_0xff4d('0x72')](_0xff4d('0x93'));}else{_0xea66e3['where'](_0xff4d('0x73'),_[_0xff4d('0x30')](_0x520e94,'id'));_0x1970e6[_0xff4d('0x72')](_0xff4d('0x73'),_[_0xff4d('0x30')](_0x520e94,'id'));}});})['then'](function(){db[_0xff4d('0x94')]['query'](_0xea66e3['toString'](),_0xe9385c)[_0xff4d('0x20')](function(_0x520880){_0x18a044[_0xff4d('0x1c')]=_0x520880[_0xff4d('0x3c')];if(_0x18a044[_0xff4d('0x1c')]===0x0)return[];return db['sequelize']['query'](_0x4ceb19[_0xff4d('0x95')](),_0xe9385c)[_0xff4d('0x20')](function(_0x551183){_0x301633=_[_0xff4d('0x96')](_0x551183,'id');_0xe9385c=_[_0xff4d('0x97')](_0xe9385c,{'model':db[_0xff4d('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x35f99a[_0xff4d('0x36')][_0xff4d('0x3b')]){_0xebf232['attributes'][_0xff4d('0x2c')](function(_0x35a871){_0x1970e6['field']('i.'+_0x35a871);});}else{_0x1970e6[_0xff4d('0x42')](_0xff4d('0x8a'),_0xff4d('0x5b'));_0x1970e6[_0xff4d('0x42')]('a.key',_0xff4d('0x98'));_0x1970e6['field']('a.mandatoryDisposition',_0xff4d('0x99'));_0x1970e6[_0xff4d('0x42')](_0xff4d('0x9a'));_0x1970e6[_0xff4d('0x42')]('c.firstName',_0xff4d('0x9b'));_0x1970e6[_0xff4d('0x42')]('c.lastName',_0xff4d('0x9c'));_0x1970e6[_0xff4d('0x42')](_0xff4d('0x9d'),_0xff4d('0x9e'));_0x1970e6[_0xff4d('0x42')]('c.phone','Contact.phone');_0x1970e6['field']('c.mobile',_0xff4d('0x9f'));_0x1970e6[_0xff4d('0x42')](_0xff4d('0xa0'),_0xff4d('0xa1'));_0x1970e6[_0xff4d('0x42')](_0xff4d('0xa2'),_0xff4d('0xa3'));_0x1970e6[_0xff4d('0x42')](_0xff4d('0xa4'),_0xff4d('0xa5'));_0x1970e6[_0xff4d('0x42')](_0xff4d('0xa6'),_0xff4d('0x2a'));}if(_0xebf232['limit'])_0x1970e6[_0xff4d('0x3f')](_0xebf232[_0xff4d('0x3f')]);if(_0xebf232[_0xff4d('0x1d')])_0x1970e6[_0xff4d('0x1d')](_0xebf232[_0xff4d('0x1d')]);return db[_0xff4d('0x94')][_0xff4d('0x36')](_0x1970e6[_0xff4d('0x95')](),_0xe9385c);})[_0xff4d('0x20')](function(_0x39870d){_0x4f057c['where'](_0xff4d('0xa7'),_[_0xff4d('0x30')](_0x39870d,'id'));return db['sequelize'][_0xff4d('0x36')](_0x4f057c[_0xff4d('0x95')](),_0xe9385c)[_0xff4d('0x20')](function(_0x424995){var _0x24bad9=_[_0xff4d('0xa8')](_0x424995,_0xff4d('0xa9'));var _0x51c1cd=[];_0x39870d[_0xff4d('0x2c')](function(_0x2d1693){_0x51c1cd[_0xff4d('0x2d')](updateSmsInteraction(_0x2d1693,_0x301633,_0x24bad9));});return BPromise['all'](_0x51c1cd);});});})[_0xff4d('0x20')](function(_0x46bd79){_0x18a044[_0xff4d('0xaa')]=_0x46bd79;return _0x18a044;})[_0xff4d('0x20')](respondWithFilteredResult(_0x44d28e,_0xebf232));})[_0xff4d('0x2e')](handleError(_0x44d28e,null));};exports[_0xff4d('0xab')]=function(_0x40eb0c,_0x4defdc){var _0x4532a9={'raw':![],'where':{'id':_0x40eb0c[_0xff4d('0xac')]['id']}},_0x461d3e={};_0x461d3e[_0xff4d('0x35')]=_[_0xff4d('0x37')](db[_0xff4d('0x31')][_0xff4d('0xad')]);_0x461d3e[_0xff4d('0x36')]=_[_0xff4d('0x37')](_0x40eb0c[_0xff4d('0x36')]);_0x461d3e[_0xff4d('0xae')]=_[_0xff4d('0x39')](_0x461d3e[_0xff4d('0x35')],_0x461d3e[_0xff4d('0x36')]);_0x4532a9['attributes']=_[_0xff4d('0x39')](_0x461d3e['model'],qs[_0xff4d('0x3b')](_0x40eb0c[_0xff4d('0x36')][_0xff4d('0x3b')]));_0x4532a9[_0xff4d('0x3a')]=_0x4532a9['attributes']['length']?_0x4532a9['attributes']:_0x461d3e['model'];if(_0x40eb0c[_0xff4d('0x36')][_0xff4d('0xaf')]){_0x4532a9[_0xff4d('0xb0')]=[{'all':!![]}];}_0x4532a9=_[_0xff4d('0x97')]({},_0x4532a9,_0x40eb0c['options']);return db[_0xff4d('0x31')][_0xff4d('0xb1')](_0x4532a9)[_0xff4d('0x20')](handleEntityNotFound(_0x4defdc,null))[_0xff4d('0x20')](respondWithResult(_0x4defdc,null))[_0xff4d('0x2e')](handleError(_0x4defdc,null));};exports['create']=function(_0x2b3786,_0x129b49){return db[_0xff4d('0x31')][_0xff4d('0xb2')](_0x2b3786[_0xff4d('0x70')],{})[_0xff4d('0x20')](respondWithResult(_0x129b49,0xc9))[_0xff4d('0x2e')](handleError(_0x129b49,null));};exports['update']=function(_0x538ba3,_0x2bcf8b){if(_0x538ba3[_0xff4d('0x70')]['id']){delete _0x538ba3[_0xff4d('0x70')]['id'];}return db['SmsInteraction'][_0xff4d('0xb1')]({'where':{'id':_0x538ba3[_0xff4d('0xac')]['id']}})[_0xff4d('0x20')](handleEntityNotFound(_0x2bcf8b,null))[_0xff4d('0x20')](saveUpdates(_0x538ba3['body'],null))[_0xff4d('0x20')](respondWithResult(_0x2bcf8b,null))['catch'](handleError(_0x2bcf8b,null));};exports[_0xff4d('0x21')]=function(_0x2a199d,_0x550b3e){return db[_0xff4d('0x31')][_0xff4d('0xb1')]({'where':{'id':_0x2a199d[_0xff4d('0xac')]['id']}})[_0xff4d('0x20')](handleEntityNotFound(_0x550b3e,null))[_0xff4d('0x20')](removeEntity(_0x550b3e,null))[_0xff4d('0x2e')](handleError(_0x550b3e,null));};exports[_0xff4d('0xb3')]=function(_0x5b2207,_0x464877){return db[_0xff4d('0x31')]['describe']()[_0xff4d('0x20')](respondWithResult(_0x464877,null))[_0xff4d('0x2e')](handleError(_0x464877,null));};exports[_0xff4d('0xb4')]=function(_0x4f5f79,_0x1f8b7f,_0x3aa873){return db['SmsMessage'][_0xff4d('0xb1')]({'where':{'id':_0x4f5f79[_0xff4d('0xac')]['id']}})['then'](handleEntityNotFound(_0x1f8b7f,null))[_0xff4d('0x20')](function(_0x23ff7d){if(_0x23ff7d){return _0x23ff7d['addMessage'](_0x4f5f79[_0xff4d('0x70')]['ids'],_[_0xff4d('0xb5')](_0x4f5f79['body'],[_0xff4d('0xb6'),'id'])||{});}})[_0xff4d('0x20')](respondWithResult(_0x1f8b7f,null))[_0xff4d('0x2e')](handleError(_0x1f8b7f,null));};exports[_0xff4d('0xb7')]=function(_0x361c8b,_0x283d63,_0x5c3b8d){var _0x1d169a={'raw':![],'where':{}};var _0x4ef721={};var _0x1a5a67={'count':0x0,'rows':[]};return db[_0xff4d('0x31')]['findOne']({'where':{'id':_0x361c8b[_0xff4d('0xac')]['id']}})[_0xff4d('0x20')](handleEntityNotFound(_0x283d63,null))[_0xff4d('0x20')](function(_0x3f11f2){if(_0x3f11f2){_0x4ef721['model']=_[_0xff4d('0x37')](db['SmsMessage'][_0xff4d('0xad')]);_0x4ef721[_0xff4d('0x36')]=_['keys'](_0x361c8b[_0xff4d('0x36')]);_0x4ef721[_0xff4d('0x38')]=_['intersection'](_0x4ef721[_0xff4d('0x35')],_0x4ef721[_0xff4d('0x36')]);_0x1d169a[_0xff4d('0x3a')]=_[_0xff4d('0x39')](_0x4ef721[_0xff4d('0x35')],qs[_0xff4d('0x3b')](_0x361c8b['query'][_0xff4d('0x3b')]));_0x1d169a[_0xff4d('0x3a')]=_0x1d169a[_0xff4d('0x3a')]['length']?_0x1d169a[_0xff4d('0x3a')]:_0x4ef721[_0xff4d('0x35')];if(!_0x361c8b[_0xff4d('0x36')][_0xff4d('0x3d')]('nolimit')){_0x1d169a[_0xff4d('0x3f')]=qs[_0xff4d('0x3f')](_0x361c8b[_0xff4d('0x36')][_0xff4d('0x3f')]);_0x1d169a[_0xff4d('0x1d')]=qs[_0xff4d('0x1d')](_0x361c8b[_0xff4d('0x36')][_0xff4d('0x1d')]);}_0x1d169a[_0xff4d('0x8b')]=qs['sort'](_0x361c8b[_0xff4d('0x36')][_0xff4d('0x40')]);_0x1d169a[_0xff4d('0x72')]=qs[_0xff4d('0x38')](_['pick'](_0x361c8b[_0xff4d('0x36')],_0x4ef721[_0xff4d('0x38')]));_0x1d169a[_0xff4d('0x72')][_0xff4d('0xa9')]=_0x3f11f2['id'];if(_0x361c8b[_0xff4d('0x36')][_0xff4d('0x81')]){_0x1d169a[_0xff4d('0x72')]=_['merge'](_0x1d169a['where'],{'$or':_['map'](_0x1d169a[_0xff4d('0x3a')],function(_0x3a98fe){var _0x40518d={};_0x40518d[_0x3a98fe]={'$like':'%'+_0x361c8b[_0xff4d('0x36')][_0xff4d('0x81')]+'%'};return _0x40518d;})});}if(_0x361c8b[_0xff4d('0x36')]['$gte']){var _0x2ebc62=_0x361c8b[_0xff4d('0x36')]['$gte']['split'](',');var _0x421a39={};_0x421a39[_0x2ebc62[0x0]]={'$gte':moment(_0x2ebc62[0x1])[_0xff4d('0xb8')](_0xff4d('0xb9'))};_0x1d169a[_0xff4d('0x72')]=_[_0xff4d('0x97')](_0x1d169a[_0xff4d('0x72')],_0x421a39);}_0x1d169a=_[_0xff4d('0x97')]({},_0x1d169a,_0x361c8b[_0xff4d('0xba')]);return db[_0xff4d('0xbb')][_0xff4d('0x1c')]({'where':_0x1d169a[_0xff4d('0x72')]})[_0xff4d('0x20')](function(_0x36053f){_0x1a5a67['count']=_0x36053f;if(_0x361c8b[_0xff4d('0x36')][_0xff4d('0xaf')]){_0x1d169a[_0xff4d('0xb0')]=[{'all':!![]}];}return db[_0xff4d('0xbb')][_0xff4d('0xbc')](_0x1d169a);})['then'](function(_0x3871f4){_0x1a5a67[_0xff4d('0xaa')]=_0x3871f4;return _0x1a5a67;});}})[_0xff4d('0x20')](respondWithFilteredResult(_0x283d63,_0x1d169a))[_0xff4d('0x2e')](handleError(_0x283d63,null));};exports[_0xff4d('0xbd')]=function(_0x4a2420,_0x5524a8,_0x2a9a2a){return db[_0xff4d('0x31')][_0xff4d('0xb1')]({'where':{'id':_0x4a2420[_0xff4d('0xac')]['id']}})[_0xff4d('0x20')](handleEntityNotFound(_0x5524a8,null))['then'](function(_0x49e5ef){if(_0x49e5ef){return _0x49e5ef['setTags'](_0x4a2420['body'][_0xff4d('0xb6')],_[_0xff4d('0xb5')](_0x4a2420['body'],[_0xff4d('0xb6'),'id'])||{})[_0xff4d('0xbe')](function(){return db[_0xff4d('0x69')][_0xff4d('0xbc')]({'attributes':['id','name',_0xff4d('0x43')],'where':{'id':_0x4a2420['body'][_0xff4d('0xb6')]}});})['then'](function(_0x290f02){socket['emit']('smsInteractionTags:save',{'id':Number(_0x4a2420[_0xff4d('0xac')]['id']),'tags':_0x290f02||[]});return{'id':Number(_0x4a2420[_0xff4d('0xac')]['id']),'tags':_0x290f02||[]};});}})['then'](respondWithResult(_0x5524a8,null))['catch'](handleError(_0x5524a8,null));};exports['removeTags']=function(_0x297388,_0x4b17f5,_0x1edc07){return db[_0xff4d('0x31')][_0xff4d('0xb1')]({'where':{'id':_0x297388[_0xff4d('0xac')]['id']}})[_0xff4d('0x20')](handleEntityNotFound(_0x4b17f5,null))[_0xff4d('0x20')](function(_0x1f822c){if(_0x1f822c){return _0x1f822c[_0xff4d('0xbf')](_0x297388[_0xff4d('0x36')][_0xff4d('0xb6')]);}})[_0xff4d('0x20')](respondWithStatusCode(_0x4b17f5,null))[_0xff4d('0x2e')](handleError(_0x4b17f5,null));};exports['download']=function(_0x4eca8c,_0x2b5dee){var _0x5f5a3d=moment()['unix']()['toString']();var _0x1a2d33=path[_0xff4d('0xc0')](config['root'],'server',_0xff4d('0xc1'),'tmp');var _0x115924=path['join'](config[_0xff4d('0xc2')],_0xff4d('0xc3'),'files','attachments');var _0x184599=path[_0xff4d('0xc0')](_0x1a2d33,_0x5f5a3d);var _0x27fc7d=util[_0xff4d('0xb8')](_0xff4d('0xc4'),_0x4eca8c['params']['id'],_0x5f5a3d);var _0x19b6cc=path[_0xff4d('0xc0')](_0x1a2d33,_0x27fc7d);var _0x3c3994=[];_0x3c3994['push']({'model':db[_0xff4d('0x6c')],'as':_0xff4d('0x6c'),'attributes':['id',_0xff4d('0x28')],'raw':!![]});_0x3c3994[_0xff4d('0x2d')]({'model':db[_0xff4d('0xc5')],'as':_0xff4d('0x60'),'attributes':['id',_0xff4d('0xc6'),_0xff4d('0xc7')],'raw':!![]});var _0x16a8ea=[{'model':db[_0xff4d('0xbb')],'as':_0xff4d('0xc8'),'attributes':['id',_0xff4d('0x70'),'createdAt',_0xff4d('0xc9'),_0xff4d('0xca'),_0xff4d('0x7c')],'include':_0x3c3994}];_0x16a8ea[_0xff4d('0x2d')]({'model':db[_0xff4d('0xcb')],'as':'Account','attributes':['id',_0xff4d('0x25')]});_0x16a8ea[_0xff4d('0x2d')]({'model':db[_0xff4d('0x6c')],'as':_0xff4d('0xcc'),'attributes':['id','fullname']});return db[_0xff4d('0x31')][_0xff4d('0xb1')]({'where':{'id':_0x4eca8c[_0xff4d('0xac')]['id']},'include':_0x16a8ea})['then'](handleEntityNotFound(_0x2b5dee,null))[_0xff4d('0x20')](function(_0x4b1e4a){if(_0x4b1e4a){var _0x1668a1=_0x4b1e4a[_0xff4d('0xcd')]({'plain':!![]});fs[_0xff4d('0xce')](_0x184599);var _0x3c4193={'format':'A4','border':_0xff4d('0xcf'),'header':{'height':_0xff4d('0xd0'),'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':_0xff4d('0xd1'),'contents':{'default':util[_0xff4d('0xb8')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xff4d('0xb8')]('%s\x20#%d',_0xff4d('0xd2'),_0x1668a1['id']),moment()[_0xff4d('0xb8')](_0xff4d('0xd3'))[_0xff4d('0x95')]())}}};var _0x206f54={'channel':_0xff4d('0xd2'),'account':_0x1668a1[_0xff4d('0xd4')][_0xff4d('0x25')],'agent':_0x1668a1[_0xff4d('0xcc')]?_0x1668a1[_0xff4d('0xcc')]['fullname']:_0xff4d('0xd5'),'createdAt':moment(_0x1668a1['createdAt'])[_0xff4d('0xb8')](_0xff4d('0xb9'))[_0xff4d('0x95')](),'closedAt':_0x1668a1[_0xff4d('0xd6')]?moment(_0x1668a1[_0xff4d('0xd7')])[_0xff4d('0xb8')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x1668a1[_0xff4d('0xd8')],'messages':_(_0x1668a1[_0xff4d('0xc8')])[_0xff4d('0x81')]({'secret':![]})[_0xff4d('0x30')](function(_0x2c7641){return{'date':moment(_0x2c7641[_0xff4d('0x75')])[_0xff4d('0xb8')](_0xff4d('0xb9'))[_0xff4d('0x95')](),'sender':_0x2c7641[_0xff4d('0xc9')]===_0xff4d('0xd9')?_0x2c7641[_0xff4d('0x6c')]?_0x2c7641[_0xff4d('0x6c')][_0xff4d('0x28')]:_0xff4d('0xda'):_0x2c7641[_0xff4d('0x60')][_0xff4d('0xc6')]+(_0x2c7641[_0xff4d('0x60')][_0xff4d('0xc7')]?'\x20'+_0x2c7641['Contact']['lastName']:''),'body':_0x2c7641[_0xff4d('0x70')],'direction':_0x2c7641['direction']===_0xff4d('0xd9')?'A':'C','secret':_0x2c7641[_0xff4d('0xca')],'read':_0x2c7641[_0xff4d('0x7c')]};})[_0xff4d('0x5c')]()};return ejs[_0xff4d('0xdb')](path[_0xff4d('0xc0')](config['root'],_0xff4d('0xc3'),_0xff4d('0xdc'),_0xff4d('0xdd')),{'interaction':_0x206f54})[_0xff4d('0x20')](function(_0x22f1c4){return new BPromise(function(_0x4b95f5,_0x24e242){pdf[_0xff4d('0xb2')](_0x22f1c4,_0x3c4193)[_0xff4d('0xde')](path['join'](_0x184599,_0xff4d('0xdf')+_0x1668a1['id']+'-'+_0x5f5a3d+'.pdf'),function(_0x255250,_0x4e56b5){if(_0x255250)return _0x24e242(_0x255250);_0x4b95f5(_0x4e56b5);});});})[_0xff4d('0x20')](function(){return new BPromise(function(_0x326bd,_0x2cf80b){zipdir(_0x184599,{'saveTo':_0x19b6cc},function(_0x72e2ad,_0x20ef5d){if(_0x72e2ad)return _0x2cf80b(_0x72e2ad);return _0x326bd(_0x20ef5d);});})[_0xff4d('0x20')](function(){return new BPromise(function(_0x24a8ba,_0x53903b){rimraf(_0x184599,function(_0x3239e6){if(_0x3239e6)_0x53903b(_0x3239e6);return _0x24a8ba();});});})[_0xff4d('0x20')](function(){return _0x2b5dee[_0xff4d('0xe0')](_0x19b6cc,_0x27fc7d,function(_0x436a1f){if(_0x436a1f){console['log'](_0xff4d('0xe1'),_0x436a1f);}else{fs[_0xff4d('0xe2')](_0x19b6cc);}});});});}else{return _0x2b5dee[_0xff4d('0x22')](0xc8);}})[_0xff4d('0x2e')](handleError(_0x2b5dee,null));}; \ No newline at end of file +var _0xa88b=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','map','fullname','TagIds','Tags','split','forEach','push','index','SmsInteraction','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','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','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','expr','search','sqlOperator','conditions','find','value','having','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','i.SmsAccountId\x20IS\x20NULL','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','sequelize','SmsInteractionId','all','rows','catch','show','params','keys','rawAttributes','include','options','create','body','describe','addMessage','ids','omit','findOne','SmsMessage','filter','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','join','root','tmp','server','files','transcript-%d-%s.zip','User','CmContact','lastName','Messages','direction','secret','get','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Sms','YYYY-MM-DD','Account','Owner','N.A.','closed','closedAt','disposition','out','System','firstName','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','err','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa88b,0x1b8));var _0xba88=function(_0x163742,_0x467e36){_0x163742=_0x163742-0x0;var _0x1152ac=_0xa88b[_0x163742];return _0x1152ac;};'use strict';var pdf=require(_0xba88('0x0'));var emlformat=require(_0xba88('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xba88('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba88('0x3'));var moment=require(_0xba88('0x4'));var BPromise=require(_0xba88('0x5'));var Mustache=require('mustache');var util=require(_0xba88('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xba88('0x7'));var ejs=require(_0xba88('0x8'));var fs=require('fs');var _=require(_0xba88('0x9'));var squel=require(_0xba88('0xa'));var crypto=require(_0xba88('0xb'));var jsforce=require(_0xba88('0xc'));var deskjs=require(_0xba88('0xd'));var toCsv=require(_0xba88('0x7'));var querystring=require(_0xba88('0xe'));var Papa=require(_0xba88('0xf'));var Redis=require(_0xba88('0x10'));var authService=require(_0xba88('0x11'));var qs=require(_0xba88('0x12'));var as=require(_0xba88('0x13'));var hardwareService=require(_0xba88('0x14'));var logger=require('../../config/logger')(_0xba88('0x15'));var utils=require(_0xba88('0x16'));var config=require(_0xba88('0x17'));var licenseUtil=require(_0xba88('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xba88('0x19')](config[_0xba88('0x1a')],{'host':_0xba88('0x1b'),'port':0x18eb});var socket=require(_0xba88('0x1c'))(new Redis(config[_0xba88('0x1a')]));require(_0xba88('0x1d'))[_0xba88('0x1e')](socket);function respondWithStatusCode(_0x2ecafb,_0x30f3f7){_0x30f3f7=_0x30f3f7||0xcc;return function(_0x5677af){if(_0x5677af){return _0x2ecafb[_0xba88('0x1f')](_0x30f3f7);}return _0x2ecafb[_0xba88('0x20')](_0x30f3f7)['end']();};}function respondWithResult(_0x20c98e,_0x422c0d){_0x422c0d=_0x422c0d||0xc8;return function(_0x5b3fce){if(_0x5b3fce){return _0x20c98e[_0xba88('0x20')](_0x422c0d)['json'](_0x5b3fce);}};}function respondWithFilteredResult(_0x4b412d,_0x2dcc20){return function(_0x2cf59e){if(_0x2cf59e){var _0x27de9a=_0x2cf59e[_0xba88('0x21')],_0x4f1f45=_0x2dcc20[_0xba88('0x22')],_0x386e81=_0x2dcc20[_0xba88('0x22')]+_0x2dcc20[_0xba88('0x23')],_0x241501;if(_0x386e81>=_0x27de9a){_0x386e81=_0x27de9a;_0x241501=0xc8;}else{_0x241501=0xce;}_0x4b412d[_0xba88('0x20')](_0x241501);return _0x4b412d['set'](_0xba88('0x24'),_0x4f1f45+'-'+_0x386e81+'/'+_0x27de9a)[_0xba88('0x25')](_0x2cf59e);}return null;};}function patchUpdates(_0x1eec56){return function(_0x4c10b1){try{jsonpatch[_0xba88('0x26')](_0x4c10b1,_0x1eec56,!![]);}catch(_0x5d9a22){return BPromise[_0xba88('0x27')](_0x5d9a22);}return _0x4c10b1[_0xba88('0x28')]();};}function saveUpdates(_0x3be954,_0x415ce7){return function(_0x193e6f){if(_0x193e6f){return _0x193e6f[_0xba88('0x29')](_0x3be954)[_0xba88('0x2a')](function(_0x5a9674){return _0x5a9674;});}return null;};}function removeEntity(_0x55a3e5,_0x2eb3a2){return function(_0x5d0404){if(_0x5d0404){return _0x5d0404[_0xba88('0x2b')]()[_0xba88('0x2a')](function(){_0x55a3e5['status'](0xcc)[_0xba88('0x2c')]();});}};}function handleEntityNotFound(_0x2fbd46,_0x19776e){return function(_0x1170ef){if(!_0x1170ef){_0x2fbd46[_0xba88('0x1f')](0x194);}return _0x1170ef;};}function handleError(_0x10c10b,_0xc353d3){_0xc353d3=_0xc353d3||0x1f4;return function(_0x51a6a2){logger[_0xba88('0x2d')](_0x51a6a2[_0xba88('0x2e')]);if(_0x51a6a2['name']){delete _0x51a6a2[_0xba88('0x2f')];}_0x10c10b[_0xba88('0x20')](_0xc353d3)['send'](_0x51a6a2);};}function getInteractionUsers(_0x4c75df,_0x4f5e0c){return new BPromise(function(_0x271039,_0x241f67){try{if(_0x4f5e0c[_0x4c75df['id']]){_0x4c75df['Users']=_[_0xba88('0x30')](_0x4f5e0c[_0x4c75df['id']],function(_0x4dbd91){return{'id':_0x4dbd91['id'],'fullname':_0x4dbd91[_0xba88('0x31')]};});}}catch(_0x561787){_0x241f67(_0x561787);}_0x271039(_0x4c75df);});}function getInteractionTags(_0x62692a,_0x2ad2a5){return new BPromise(function(_0x4fae2a,_0x33b524){try{if(_0x62692a[_0xba88('0x32')]){_0x62692a[_0xba88('0x33')]=[];_0x62692a[_0xba88('0x32')][_0xba88('0x34')](',')[_0xba88('0x35')](function(_0x45974f){_0x62692a[_0xba88('0x33')][_0xba88('0x36')](_0x2ad2a5[_0x45974f]);});}delete _0x62692a[_0xba88('0x32')];}catch(_0x3e6a83){_0x33b524(_0x3e6a83);}_0x4fae2a(_0x62692a);});}function updateSmsInteraction(_0x48d295,_0x15773f,_0x558d82){return new BPromise(function(_0x4212c1,_0x221078){return getInteractionUsers(_0x48d295,_0x558d82)[_0xba88('0x2a')](function(_0x2809b0){return getInteractionTags(_0x2809b0,_0x15773f);})[_0xba88('0x2a')](function(_0x450033){_0x4212c1(_0x450033);})['catch'](function(_0x19426c){_0x221078(_0x19426c);});});}exports[_0xba88('0x37')]=function(_0x569cfc,_0x286242){var _0x2ef50c={},_0x59b3d2={},_0x4c4cfa={'count':0x0,'rows':[]};var _0x368476=_['map'](db[_0xba88('0x38')]['rawAttributes'],function(_0x53a520){return{'name':_0x53a520[_0xba88('0x39')],'type':_0x53a520[_0xba88('0x3a')][_0xba88('0x3b')]};});_0x59b3d2[_0xba88('0x3c')]=_['map'](_0x368476,'name');_0x59b3d2[_0xba88('0x3d')]=_['keys'](_0x569cfc[_0xba88('0x3d')]);_0x59b3d2['filters']=_[_0xba88('0x3e')](_0x59b3d2[_0xba88('0x3c')],_0x59b3d2['query']);_0x2ef50c[_0xba88('0x3f')]=_[_0xba88('0x3e')](_0x59b3d2['model'],qs[_0xba88('0x40')](_0x569cfc[_0xba88('0x3d')][_0xba88('0x40')]));_0x2ef50c['attributes']=_0x2ef50c[_0xba88('0x3f')][_0xba88('0x41')]?_0x2ef50c[_0xba88('0x3f')]:_0x59b3d2[_0xba88('0x3c')];if(!_0x569cfc[_0xba88('0x3d')][_0xba88('0x42')](_0xba88('0x43'))){_0x2ef50c['limit']=qs[_0xba88('0x23')](_0x569cfc[_0xba88('0x3d')][_0xba88('0x23')]);_0x2ef50c['offset']=qs[_0xba88('0x22')](_0x569cfc[_0xba88('0x3d')]['offset']);}_0x2ef50c[_0xba88('0x44')]=qs[_0xba88('0x45')](_0x569cfc[_0xba88('0x3d')]['sort']);_0x2ef50c[_0xba88('0x46')]=qs[_0xba88('0x47')](_[_0xba88('0x48')](_0x569cfc[_0xba88('0x3d')],_0x59b3d2['filters']),_0x368476);var _0x335a53=[];var _0x735f2d=squel[_0xba88('0x49')]()[_0xba88('0x4a')]('id')[_0xba88('0x4a')](_0xba88('0x2f'))[_0xba88('0x4a')](_0xba88('0x4b'))[_0xba88('0x4c')](_0xba88('0x4d'));var _0x5bbfa6=squel['select']()[_0xba88('0x4a')](_0xba88('0x4e'))['field'](_0xba88('0x4f'))[_0xba88('0x4a')](_0xba88('0x50'))[_0xba88('0x4c')](_0xba88('0x51'),'ui')[_0xba88('0x52')](_0xba88('0x53'),'u',_0xba88('0x54'));var _0x4740ec=squel[_0xba88('0x49')]()[_0xba88('0x4c')](_0xba88('0x55'),'i')['left_join'](_0xba88('0x56'),'c',_0xba88('0x57'))['left_join'](_0xba88('0x53'),'o',_0xba88('0x58'))[_0xba88('0x52')](_0xba88('0x59'),'a',_0xba88('0x5a'))[_0xba88('0x52')](_0xba88('0x5b'),'me',_0xba88('0x5c'))[_0xba88('0x52')](_0xba88('0x5d'),'it','it.SmsInteractionId\x20=\x20i.id')['left_join'](_0xba88('0x4d'),'t','t.id\x20=\x20it.TagId');var _0x4f5fec=squel[_0xba88('0x5e')]();var _0x2810bc=[];var _0xc6aea=squel[_0xba88('0x5e')]();var _0x11bc8a;if(_0x569cfc[_0xba88('0x3d')][_0xba88('0x5f')]){_0x11bc8a=as['parseSearch'](_0x569cfc[_0xba88('0x3d')][_0xba88('0x5f')]);var _0xab661e=_0x11bc8a[_0xba88('0x60')];for(var _0x370279=0x0;_0x370279<_0x11bc8a['conditions'][_0xba88('0x41')];_0x370279++){var _0x216a4e=_0x11bc8a[_0xba88('0x61')][_0x370279];var _0x1d6fa2='i';var _0x392425=_[_0xba88('0x62')](_0x368476,[_0xba88('0x2f'),_0x216a4e['field']]);if(!_0x392425){switch(_0x216a4e[_0xba88('0x4a')]){case'unreadMessages':if(_0x216a4e[_0xba88('0x63')]==0x1){_0x4740ec[_0xba88('0x64')]('`'+_0x216a4e['field']+'`\x20=\x200');}else{_0x4740ec['having']('`'+_0x216a4e['field']+'`\x20>\x200');}break;case _0xba88('0x65'):if(_0x216a4e[_0xba88('0x66')]===_0xba88('0x67')){if(_0x216a4e[_0xba88('0x63')][_0xba88('0x34')]('\x20')[_0xba88('0x41')]>0x1){_0x4f5fec[_0xab661e](_0xba88('0x68'),qs[_0xba88('0x69')](_0x216a4e[_0xba88('0x63')]),null);}else{var _0x5e03cb='%'+_0x216a4e[_0xba88('0x63')]+'%';_0x4f5fec[_0xab661e](_0xba88('0x6a'),_0x5e03cb,_0x5e03cb,_0x5e03cb);}}else{_0x392425=_[_0xba88('0x62')](_0x368476,[_0xba88('0x2f'),'ContactId']);_0x216a4e[_0xba88('0x4a')]=_0xba88('0x6b');_0x258243=as[_0xba88('0x6c')](_0x1d6fa2,_0x392425[_0xba88('0x3a')],_0x216a4e);_0x4f5fec[_0xab661e](_0x258243[_0xba88('0x6d')],_0x258243[_0xba88('0x63')][_0xba88('0x6e')],_0x258243[_0xba88('0x63')]['end']);}break;case'Tag':var _0x95eb35=_0x216a4e['value'][_0xba88('0x34')](',')[_0xba88('0x30')](function(_0x558e31){return Number(_0x558e31);});_0x95eb35[_0xba88('0x35')](function(_0x423fc9){_0xc6aea['or'](_0xba88('0x6f'),'%,'+_0x423fc9+',%');});_0x2810bc=_[_0xba88('0x70')](_0x2810bc,_0x95eb35);break;case'User':if(_0x216a4e[_0xba88('0x66')]===_0xba88('0x67')){_0x4f5fec[_0xab661e](_0xba88('0x71'),'%'+_0x216a4e[_0xba88('0x63')]+'%',null);}else{_0x392425=_[_0xba88('0x62')](_0x368476,[_0xba88('0x2f'),_0xba88('0x72')]);_0x216a4e[_0xba88('0x4a')]='UserId';_0x258243=as['buildExpression'](_0x1d6fa2,_0x392425[_0xba88('0x3a')],_0x216a4e);_0x4f5fec[_0xab661e](_0x258243['text'],_0x258243[_0xba88('0x63')][_0xba88('0x6e')],_0x258243[_0xba88('0x63')][_0xba88('0x2c')]);}break;case'body':_0x258243=as[_0xba88('0x6c')]('me',null,_0x216a4e);_0x4f5fec[_0xab661e](_0x258243[_0xba88('0x6d')],_0x258243[_0xba88('0x63')]['start'],_0x258243[_0xba88('0x63')]['end']);break;}}else{var _0x258243=as[_0xba88('0x6c')](_0x1d6fa2,_0x392425[_0xba88('0x3a')],_0x216a4e);_0x4f5fec[_0xab661e](_0x258243[_0xba88('0x6d')],_0x258243['value'][_0xba88('0x6e')],_0x258243['value'][_0xba88('0x2c')]);}}}else{var _0x38b3a3=_(_0x569cfc[_0xba88('0x3d')])['keys']()[_0xba88('0x30')](function(_0x1720cf){return _[_0xba88('0x73')](_0x368476,[_0xba88('0x2f'),_0x1720cf])?_0x1720cf:undefined;})['compact']()[_0xba88('0x63')]();if(!_[_0xba88('0x74')](_0x38b3a3)){_0x38b3a3[_0xba88('0x35')](function(_0x277c6d){if(_0x277c6d===_0xba88('0x75')){_0x4740ec[_0xba88('0x46')](_0xba88('0x76'),[][_0xba88('0x77')](_0x569cfc[_0xba88('0x3d')][_0x277c6d]));}else if(_0x277c6d===_0xba88('0x78')){var _0x249034=JSON[_0xba88('0x79')](_0x569cfc[_0xba88('0x3d')][_0x277c6d])[_0xba88('0x7a')];var _0x25cccd=JSON[_0xba88('0x79')](_0x569cfc[_0xba88('0x3d')][_0x277c6d])['$lte'];_0x4740ec[_0xba88('0x46')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x249034,_0x25cccd);}else{if(_0x569cfc[_0xba88('0x3d')][_0x277c6d]===_0xba88('0x7b')){_0x4740ec[_0xba88('0x46')]('i.'+_0x277c6d+_0xba88('0x7c'));}else{_0x4740ec[_0xba88('0x46')]('i.'+_0x277c6d+'\x20=\x20?',_0x569cfc[_0xba88('0x3d')][_0x277c6d]);}}});}if(_0x569cfc['query'][_0xba88('0x7d')]){if(_0x569cfc[_0xba88('0x3d')]['read']==0x1){_0x4740ec['having'](_0xba88('0x7e'));}else{_0x4740ec[_0xba88('0x64')]('`unreadMessages`\x20>\x200');}}if(_0x569cfc[_0xba88('0x3d')][_0xba88('0x7f')]){_0x2810bc=_[_0xba88('0x80')](_0x569cfc[_0xba88('0x3d')][_0xba88('0x7f')])?_0x569cfc[_0xba88('0x3d')][_0xba88('0x7f')]:new Array(_0x569cfc['query'][_0xba88('0x7f')]);_0x2810bc[_0xba88('0x35')](function(_0x51b63a){_0xc6aea['or'](_0xba88('0x6f'),'%,'+_0x51b63a+',%');});}if(_0x569cfc[_0xba88('0x3d')]['filter']){var _0x2d0ada=_0x569cfc[_0xba88('0x3d')]['filter'][_0xba88('0x81')]('\x5c','\x5c\x5c')[_0xba88('0x81')]('\x27\x27',_0xba88('0x82'));if(qs[_0xba88('0x83')](_0x2d0ada)){_0x4f5fec['or'](_0xba88('0x84'),_0x2d0ada+'%')['or'](_0xba88('0x85'),_0x2d0ada+'%');}else{_0x4f5fec['or'](_0xba88('0x86'),qs[_0xba88('0x69')](_0x2d0ada))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2d0ada+'%');}}}_0x4740ec['where'](_0x4f5fec);_0x4740ec['group'](_0xba88('0x87'));var _0x210f35={'type':db['Sequelize'][_0xba88('0x88')]['SELECT'],'raw':!![]};var _0x462fe1=_0x4740ec[_0xba88('0x89')]();_0x462fe1[_0xba88('0x4a')]('i.id');_0x462fe1[_0xba88('0x4a')](_0xba88('0x8a'),_0xba88('0x8b'));if(_0x2ef50c[_0xba88('0x44')]){_0x2ef50c[_0xba88('0x44')]['forEach'](function(_0x2c48f8){_0x4740ec[_0xba88('0x44')]('i.'+_0x2c48f8[0x0],_0x2c48f8[0x1]===_0xba88('0x8c')?![]:!![]);});}if(!_[_0xba88('0x74')](_0x2810bc)){_0x4740ec[_0xba88('0x64')](_0xc6aea);_0x462fe1[_0xba88('0x46')]('t.id\x20IN\x20?',_0x2810bc);}BPromise[_0xba88('0x8d')]()[_0xba88('0x2a')](function(){if(!_0x11bc8a){if(_0x569cfc[_0xba88('0x3d')][_0xba88('0x75')]||_0x569cfc[_0xba88('0x3d')]['journey'])return;_0x462fe1[_0xba88('0x46')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x4740ec[_0xba88('0x46')](_0xba88('0x8e'));return;}return _0x569cfc[_0xba88('0x8f')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0xba88('0x2a')](function(_0x1abea4){if(_[_0xba88('0x74')](_0x1abea4)){_0x462fe1[_0xba88('0x46')](_0xba88('0x90'));_0x4740ec[_0xba88('0x46')](_0xba88('0x90'));}else{_0x462fe1[_0xba88('0x46')](_0xba88('0x76'),_[_0xba88('0x30')](_0x1abea4,'id'));_0x4740ec[_0xba88('0x46')](_0xba88('0x76'),_['map'](_0x1abea4,'id'));}});})[_0xba88('0x2a')](function(){db['sequelize'][_0xba88('0x3d')](_0x462fe1[_0xba88('0x91')](),_0x210f35)[_0xba88('0x2a')](function(_0x3a4162){_0x4c4cfa['count']=_0x3a4162[_0xba88('0x41')];if(_0x4c4cfa[_0xba88('0x21')]===0x0)return[];return db['sequelize'][_0xba88('0x3d')](_0x735f2d[_0xba88('0x91')](),_0x210f35)['then'](function(_0x282dec){_0x335a53=_[_0xba88('0x92')](_0x282dec,'id');_0x210f35=_[_0xba88('0x93')](_0x210f35,{'model':db[_0xba88('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x569cfc[_0xba88('0x3d')][_0xba88('0x40')]){_0x2ef50c[_0xba88('0x3f')]['forEach'](function(_0x225a11){_0x4740ec[_0xba88('0x4a')]('i.'+_0x225a11);});}else{_0x4740ec['field'](_0xba88('0x8a'),_0xba88('0x8b'));_0x4740ec['field'](_0xba88('0x94'),_0xba88('0x95'));_0x4740ec[_0xba88('0x4a')]('a.mandatoryDisposition',_0xba88('0x96'));_0x4740ec[_0xba88('0x4a')](_0xba88('0x97'));_0x4740ec[_0xba88('0x4a')](_0xba88('0x98'),_0xba88('0x99'));_0x4740ec[_0xba88('0x4a')](_0xba88('0x9a'),'Contact.lastName');_0x4740ec[_0xba88('0x4a')](_0xba88('0x9b'),_0xba88('0x9c'));_0x4740ec[_0xba88('0x4a')](_0xba88('0x9d'),_0xba88('0x9e'));_0x4740ec['field']('c.mobile',_0xba88('0x9f'));_0x4740ec[_0xba88('0x4a')]('c.fax','Contact.fax');_0x4740ec['field'](_0xba88('0xa0'),'Owner.fullname');_0x4740ec[_0xba88('0x4a')]('o.internal',_0xba88('0xa1'));_0x4740ec[_0xba88('0x4a')](_0xba88('0xa2'),'TagIds');}if(_0x2ef50c[_0xba88('0x23')])_0x4740ec[_0xba88('0x23')](_0x2ef50c[_0xba88('0x23')]);if(_0x2ef50c[_0xba88('0x22')])_0x4740ec['offset'](_0x2ef50c[_0xba88('0x22')]);return db['sequelize'][_0xba88('0x3d')](_0x4740ec[_0xba88('0x91')](),_0x210f35);})['then'](function(_0xf00c81){_0x5bbfa6[_0xba88('0x46')](_0xba88('0xa3'),_[_0xba88('0x30')](_0xf00c81,'id'));return db[_0xba88('0xa4')]['query'](_0x5bbfa6[_0xba88('0x91')](),_0x210f35)[_0xba88('0x2a')](function(_0x338249){var _0x53d3b2=_['groupBy'](_0x338249,_0xba88('0xa5'));var _0x46a925=[];_0xf00c81['forEach'](function(_0x43d57c){_0x46a925[_0xba88('0x36')](updateSmsInteraction(_0x43d57c,_0x335a53,_0x53d3b2));});return BPromise[_0xba88('0xa6')](_0x46a925);});});})[_0xba88('0x2a')](function(_0x5d10b4){_0x4c4cfa[_0xba88('0xa7')]=_0x5d10b4;return _0x4c4cfa;})[_0xba88('0x2a')](respondWithFilteredResult(_0x286242,_0x2ef50c));})[_0xba88('0xa8')](handleError(_0x286242,null));};exports[_0xba88('0xa9')]=function(_0x4a41c9,_0x27ebe8){var _0x28f643={'raw':![],'where':{'id':_0x4a41c9[_0xba88('0xaa')]['id']}},_0x5ab5aa={};_0x5ab5aa[_0xba88('0x3c')]=_[_0xba88('0xab')](db[_0xba88('0x38')][_0xba88('0xac')]);_0x5ab5aa['query']=_[_0xba88('0xab')](_0x4a41c9['query']);_0x5ab5aa['filtears']=_[_0xba88('0x3e')](_0x5ab5aa[_0xba88('0x3c')],_0x5ab5aa[_0xba88('0x3d')]);_0x28f643[_0xba88('0x3f')]=_[_0xba88('0x3e')](_0x5ab5aa[_0xba88('0x3c')],qs['fields'](_0x4a41c9[_0xba88('0x3d')]['fields']));_0x28f643[_0xba88('0x3f')]=_0x28f643[_0xba88('0x3f')][_0xba88('0x41')]?_0x28f643['attributes']:_0x5ab5aa[_0xba88('0x3c')];if(_0x4a41c9[_0xba88('0x3d')]['includeAll']){_0x28f643[_0xba88('0xad')]=[{'all':!![]}];}_0x28f643=_[_0xba88('0x93')]({},_0x28f643,_0x4a41c9[_0xba88('0xae')]);return db['SmsInteraction'][_0xba88('0x62')](_0x28f643)['then'](handleEntityNotFound(_0x27ebe8,null))[_0xba88('0x2a')](respondWithResult(_0x27ebe8,null))[_0xba88('0xa8')](handleError(_0x27ebe8,null));};exports[_0xba88('0xaf')]=function(_0x40304f,_0x40b70c){return db[_0xba88('0x38')][_0xba88('0xaf')](_0x40304f[_0xba88('0xb0')],{})[_0xba88('0x2a')](respondWithResult(_0x40b70c,0xc9))[_0xba88('0xa8')](handleError(_0x40b70c,null));};exports[_0xba88('0x29')]=function(_0x2d0ae0,_0x5a3542){if(_0x2d0ae0['body']['id']){delete _0x2d0ae0[_0xba88('0xb0')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x2d0ae0[_0xba88('0xaa')]['id']}})[_0xba88('0x2a')](handleEntityNotFound(_0x5a3542,null))[_0xba88('0x2a')](saveUpdates(_0x2d0ae0[_0xba88('0xb0')],null))[_0xba88('0x2a')](respondWithResult(_0x5a3542,null))[_0xba88('0xa8')](handleError(_0x5a3542,null));};exports[_0xba88('0x2b')]=function(_0x4d14df,_0x37b535){return db[_0xba88('0x38')]['find']({'where':{'id':_0x4d14df[_0xba88('0xaa')]['id']}})['then'](handleEntityNotFound(_0x37b535,null))[_0xba88('0x2a')](removeEntity(_0x37b535,null))[_0xba88('0xa8')](handleError(_0x37b535,null));};exports[_0xba88('0xb1')]=function(_0x13328c,_0xd2c15){return db[_0xba88('0x38')][_0xba88('0xb1')]()[_0xba88('0x2a')](respondWithResult(_0xd2c15,null))[_0xba88('0xa8')](handleError(_0xd2c15,null));};exports['addMessage']=function(_0x1beb10,_0x446de1,_0x22dfee){return db['SmsMessage'][_0xba88('0x62')]({'where':{'id':_0x1beb10[_0xba88('0xaa')]['id']}})[_0xba88('0x2a')](handleEntityNotFound(_0x446de1,null))[_0xba88('0x2a')](function(_0x1d9611){if(_0x1d9611){return _0x1d9611[_0xba88('0xb2')](_0x1beb10[_0xba88('0xb0')][_0xba88('0xb3')],_[_0xba88('0xb4')](_0x1beb10['body'],[_0xba88('0xb3'),'id'])||{});}})[_0xba88('0x2a')](respondWithResult(_0x446de1,null))[_0xba88('0xa8')](handleError(_0x446de1,null));};exports['getMessages']=function(_0x343c48,_0x12a6c7,_0x1e78d0){var _0x1d4c33={'raw':![],'where':{}};var _0xc4c1b4={};var _0x2dac4b={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xba88('0xb5')]({'where':{'id':_0x343c48[_0xba88('0xaa')]['id']}})['then'](handleEntityNotFound(_0x12a6c7,null))['then'](function(_0x2b31e0){if(_0x2b31e0){_0xc4c1b4[_0xba88('0x3c')]=_[_0xba88('0xab')](db[_0xba88('0xb6')]['rawAttributes']);_0xc4c1b4[_0xba88('0x3d')]=_[_0xba88('0xab')](_0x343c48['query']);_0xc4c1b4[_0xba88('0x47')]=_[_0xba88('0x3e')](_0xc4c1b4[_0xba88('0x3c')],_0xc4c1b4[_0xba88('0x3d')]);_0x1d4c33[_0xba88('0x3f')]=_[_0xba88('0x3e')](_0xc4c1b4[_0xba88('0x3c')],qs[_0xba88('0x40')](_0x343c48[_0xba88('0x3d')][_0xba88('0x40')]));_0x1d4c33[_0xba88('0x3f')]=_0x1d4c33[_0xba88('0x3f')]['length']?_0x1d4c33[_0xba88('0x3f')]:_0xc4c1b4[_0xba88('0x3c')];if(!_0x343c48['query']['hasOwnProperty']('nolimit')){_0x1d4c33['limit']=qs['limit'](_0x343c48[_0xba88('0x3d')][_0xba88('0x23')]);_0x1d4c33['offset']=qs['offset'](_0x343c48[_0xba88('0x3d')][_0xba88('0x22')]);}_0x1d4c33['order']=qs[_0xba88('0x45')](_0x343c48[_0xba88('0x3d')][_0xba88('0x45')]);_0x1d4c33[_0xba88('0x46')]=qs[_0xba88('0x47')](_[_0xba88('0x48')](_0x343c48[_0xba88('0x3d')],_0xc4c1b4[_0xba88('0x47')]));_0x1d4c33[_0xba88('0x46')][_0xba88('0xa5')]=_0x2b31e0['id'];if(_0x343c48['query'][_0xba88('0xb7')]){_0x1d4c33['where']=_['merge'](_0x1d4c33[_0xba88('0x46')],{'$or':_['map'](_0x1d4c33[_0xba88('0x3f')],function(_0x218057){var _0x2e3742={};_0x2e3742[_0x218057]={'$like':'%'+_0x343c48['query'][_0xba88('0xb7')]+'%'};return _0x2e3742;})});}if(_0x343c48[_0xba88('0x3d')][_0xba88('0x7a')]){var _0x49da09=_0x343c48[_0xba88('0x3d')][_0xba88('0x7a')][_0xba88('0x34')](',');var _0xdb6f8f={};_0xdb6f8f[_0x49da09[0x0]]={'$gte':moment(_0x49da09[0x1])[_0xba88('0xb8')](_0xba88('0xb9'))};_0x1d4c33['where']=_['merge'](_0x1d4c33[_0xba88('0x46')],_0xdb6f8f);}_0x1d4c33=_[_0xba88('0x93')]({},_0x1d4c33,_0x343c48[_0xba88('0xae')]);return db[_0xba88('0xb6')][_0xba88('0x21')]({'where':_0x1d4c33[_0xba88('0x46')]})[_0xba88('0x2a')](function(_0x4c69fc){_0x2dac4b[_0xba88('0x21')]=_0x4c69fc;if(_0x343c48[_0xba88('0x3d')]['includeAll']){_0x1d4c33[_0xba88('0xad')]=[{'all':!![]}];}return db[_0xba88('0xb6')][_0xba88('0xba')](_0x1d4c33);})[_0xba88('0x2a')](function(_0x551678){_0x2dac4b[_0xba88('0xa7')]=_0x551678;return _0x2dac4b;});}})['then'](respondWithFilteredResult(_0x12a6c7,_0x1d4c33))[_0xba88('0xa8')](handleError(_0x12a6c7,null));};exports['addTags']=function(_0x5473cc,_0x26c87f,_0x4782a9){return db['SmsInteraction'][_0xba88('0x62')]({'where':{'id':_0x5473cc[_0xba88('0xaa')]['id']}})[_0xba88('0x2a')](handleEntityNotFound(_0x26c87f,null))[_0xba88('0x2a')](function(_0xbf5039){if(_0xbf5039){return _0xbf5039[_0xba88('0xbb')](_0x5473cc['body']['ids'],_[_0xba88('0xb4')](_0x5473cc[_0xba88('0xb0')],['ids','id'])||{})[_0xba88('0xbc')](function(){return db[_0xba88('0xbd')][_0xba88('0xba')]({'attributes':['id',_0xba88('0x2f'),'color'],'where':{'id':_0x5473cc[_0xba88('0xb0')][_0xba88('0xb3')]}});})['then'](function(_0x29db02){socket[_0xba88('0xbe')](_0xba88('0xbf'),{'id':Number(_0x5473cc[_0xba88('0xaa')]['id']),'tags':_0x29db02||[]});return{'id':Number(_0x5473cc[_0xba88('0xaa')]['id']),'tags':_0x29db02||[]};});}})[_0xba88('0x2a')](respondWithResult(_0x26c87f,null))[_0xba88('0xa8')](handleError(_0x26c87f,null));};exports[_0xba88('0xc0')]=function(_0x11cae9,_0x47ce0f,_0x4928bb){return db['SmsInteraction'][_0xba88('0x62')]({'where':{'id':_0x11cae9[_0xba88('0xaa')]['id']}})[_0xba88('0x2a')](handleEntityNotFound(_0x47ce0f,null))['then'](function(_0x57050b){if(_0x57050b){return _0x57050b[_0xba88('0xc0')](_0x11cae9['query'][_0xba88('0xb3')]);}})[_0xba88('0x2a')](respondWithStatusCode(_0x47ce0f,null))[_0xba88('0xa8')](handleError(_0x47ce0f,null));};exports[_0xba88('0xc1')]=function(_0x144fdb,_0x48d7d3){var _0x15f646=moment()['unix']()['toString']();var _0x1c12b1=path[_0xba88('0xc2')](config[_0xba88('0xc3')],'server','files',_0xba88('0xc4'));var _0x604034=path['join'](config[_0xba88('0xc3')],_0xba88('0xc5'),_0xba88('0xc6'),'attachments');var _0x51e5e0=path['join'](_0x1c12b1,_0x15f646);var _0x4475b1=util[_0xba88('0xb8')](_0xba88('0xc7'),_0x144fdb[_0xba88('0xaa')]['id'],_0x15f646);var _0x86d8eb=path['join'](_0x1c12b1,_0x4475b1);var _0x2bbda3=[];_0x2bbda3['push']({'model':db[_0xba88('0xc8')],'as':_0xba88('0xc8'),'attributes':['id','fullname'],'raw':!![]});_0x2bbda3[_0xba88('0x36')]({'model':db[_0xba88('0xc9')],'as':'Contact','attributes':['id','firstName',_0xba88('0xca')],'raw':!![]});var _0x177085=[{'model':db[_0xba88('0xb6')],'as':_0xba88('0xcb'),'attributes':['id',_0xba88('0xb0'),_0xba88('0x78'),_0xba88('0xcc'),_0xba88('0xcd'),_0xba88('0x7d')],'include':_0x2bbda3}];_0x177085[_0xba88('0x36')]({'model':db['SmsAccount'],'as':'Account','attributes':['id',_0xba88('0x2f')]});_0x177085['push']({'model':db[_0xba88('0xc8')],'as':'Owner','attributes':['id','fullname']});return db['SmsInteraction'][_0xba88('0x62')]({'where':{'id':_0x144fdb[_0xba88('0xaa')]['id']},'include':_0x177085})[_0xba88('0x2a')](handleEntityNotFound(_0x48d7d3,null))[_0xba88('0x2a')](function(_0x5c0603){if(_0x5c0603){var _0x21b564=_0x5c0603[_0xba88('0xce')]({'plain':!![]});fs[_0xba88('0xcf')](_0x51e5e0);var _0x5a57a4={'format':'A4','border':_0xba88('0xd0'),'header':{'height':'40px','contents':{'first':_0xba88('0xd1')}},'footer':{'height':_0xba88('0xd2'),'contents':{'default':util[_0xba88('0xb8')](_0xba88('0xd3'),util[_0xba88('0xb8')]('%s\x20#%d',_0xba88('0xd4'),_0x21b564['id']),moment()[_0xba88('0xb8')](_0xba88('0xd5'))[_0xba88('0x91')]())}}};var _0x45ed3a={'channel':_0xba88('0xd4'),'account':_0x21b564[_0xba88('0xd6')][_0xba88('0x2f')],'agent':_0x21b564[_0xba88('0xd7')]?_0x21b564[_0xba88('0xd7')][_0xba88('0x31')]:_0xba88('0xd8'),'createdAt':moment(_0x21b564[_0xba88('0x78')])[_0xba88('0xb8')](_0xba88('0xb9'))[_0xba88('0x91')](),'closedAt':_0x21b564[_0xba88('0xd9')]?moment(_0x21b564[_0xba88('0xda')])['format'](_0xba88('0xb9'))[_0xba88('0x91')]():'','disposition':_0x21b564[_0xba88('0xdb')],'messages':_(_0x21b564[_0xba88('0xcb')])[_0xba88('0xb7')]({'secret':![]})['map'](function(_0x1a516c){return{'date':moment(_0x1a516c[_0xba88('0x78')])[_0xba88('0xb8')]('YYYY-MM-DD\x20HH:mm:ss')[_0xba88('0x91')](),'sender':_0x1a516c[_0xba88('0xcc')]===_0xba88('0xdc')?_0x1a516c['User']?_0x1a516c[_0xba88('0xc8')][_0xba88('0x31')]:_0xba88('0xdd'):_0x1a516c[_0xba88('0x65')][_0xba88('0xde')]+(_0x1a516c[_0xba88('0x65')][_0xba88('0xca')]?'\x20'+_0x1a516c[_0xba88('0x65')][_0xba88('0xca')]:''),'body':_0x1a516c[_0xba88('0xb0')],'direction':_0x1a516c[_0xba88('0xcc')]===_0xba88('0xdc')?'A':'C','secret':_0x1a516c[_0xba88('0xcd')],'read':_0x1a516c[_0xba88('0x7d')]};})['value']()};return ejs[_0xba88('0xdf')](path[_0xba88('0xc2')](config[_0xba88('0xc3')],_0xba88('0xc5'),'views',_0xba88('0xe0')),{'interaction':_0x45ed3a})['then'](function(_0x766254){return new BPromise(function(_0x4bba6b,_0x495552){pdf[_0xba88('0xaf')](_0x766254,_0x5a57a4)[_0xba88('0xe1')](path['join'](_0x51e5e0,_0xba88('0xe2')+_0x21b564['id']+'-'+_0x15f646+_0xba88('0xe3')),function(_0x562170,_0x4300bf){if(_0x562170)return _0x495552(_0x562170);_0x4bba6b(_0x4300bf);});});})[_0xba88('0x2a')](function(){return new BPromise(function(_0x2effcd,_0xcd3850){zipdir(_0x51e5e0,{'saveTo':_0x86d8eb},function(_0x2e5613,_0x5d6667){if(_0x2e5613)return _0xcd3850(_0x2e5613);return _0x2effcd(_0x5d6667);});})[_0xba88('0x2a')](function(){return new BPromise(function(_0x4e4d74,_0x170763){rimraf(_0x51e5e0,function(_0xdf1bed){if(_0xdf1bed)_0x170763(_0xdf1bed);return _0x4e4d74();});});})[_0xba88('0x2a')](function(){return _0x48d7d3[_0xba88('0xc1')](_0x86d8eb,_0x4475b1,function(_0x3295a0){if(_0x3295a0){console['log'](_0xba88('0xe4'),_0x3295a0);}else{fs['unlinkSync'](_0x86d8eb);}});});});}else{return _0x48d7d3[_0xba88('0x1f')](0xc8);}})[_0xba88('0xa8')](handleError(_0x48d7d3,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index f11d687..39ca198 100644 --- a/server/api/smsInteraction/smsInteraction.events.js +++ b/server/api/smsInteraction/smsInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x46ed=['catch','hasOwnProperty','hook','events','../../mysqldb','SmsMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit'];(function(_0x1236ff,_0x2c4c62){var _0x509cb7=function(_0x1f52bd){while(--_0x1f52bd){_0x1236ff['push'](_0x1236ff['shift']());}};_0x509cb7(++_0x2c4c62);}(_0x46ed,0x168));var _0xd46e=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x46ed[_0x11005e];return _0x29338f;};'use strict';var EventEmitter=require(_0xd46e('0x0'));var SmsInteraction=require(_0xd46e('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xd46e('0x1'))['db'][_0xd46e('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xd46e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd46e('0x4'),'afterDestroy':_0xd46e('0x5')};function emitEvent(_0x54ef98){return function(_0x15c96e,_0x1926d9,_0x160bcf){_0x15c96e[_0xd46e('0x6')]({'attributes':['id'],'raw':!![]})[_0xd46e('0x7')](function(_0x855f24){_0x15c96e[_0xd46e('0x8')](_0xd46e('0x9'),_0x855f24[_0xd46e('0xa')](function(_0x19e4f4){return{'id':_0x19e4f4['id']};}));return SmsMessage[_0xd46e('0xb')]({'where':{'SmsInteractionId':_0x15c96e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x7b2d69){_0x15c96e[_0xd46e('0x8')]('unreadMessages',_0x7b2d69[_0xd46e('0xc')]);SmsInteractionEvents[_0xd46e('0xd')](_0x54ef98+':'+_0x15c96e['id'],_0x15c96e);SmsInteractionEvents[_0xd46e('0xd')](_0x54ef98,_0x15c96e);_0x160bcf(null);})[_0xd46e('0xe')](_0x160bcf(null));};}for(var e in events){if(events[_0xd46e('0xf')](e)){var event=events[e];SmsInteraction[_0xd46e('0x10')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0xdc97=['update','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb','SmsInteraction','SmsMessage','save'];(function(_0x3b46f6,_0x5ab59e){var _0x1b6c8c=function(_0xd43908){while(--_0xd43908){_0x3b46f6['push'](_0x3b46f6['shift']());}};_0x1b6c8c(++_0x5ab59e);}(_0xdc97,0x13b));var _0x7dc9=function(_0x38dfa7,_0x3196b2){_0x38dfa7=_0x38dfa7-0x0;var _0x23c1dd=_0xdc97[_0x38dfa7];return _0x23c1dd;};'use strict';var EventEmitter=require(_0x7dc9('0x0'));var SmsInteraction=require(_0x7dc9('0x1'))['db'][_0x7dc9('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0x7dc9('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7dc9('0x4'),'afterUpdate':_0x7dc9('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2a77c1){return function(_0x1e513b,_0xb15a0b,_0x3ba3ca){_0x1e513b['getUsers']({'attributes':['id'],'raw':!![]})[_0x7dc9('0x6')](function(_0x4f91c7){_0x1e513b['setDataValue'](_0x7dc9('0x7'),_0x4f91c7[_0x7dc9('0x8')](function(_0x3318ea){return{'id':_0x3318ea['id']};}));return SmsMessage[_0x7dc9('0x9')]({'where':{'SmsInteractionId':_0x1e513b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7dc9('0x6')](function(_0x5ca05b){_0x1e513b[_0x7dc9('0xa')](_0x7dc9('0xb'),_0x5ca05b[_0x7dc9('0xc')]);SmsInteractionEvents[_0x7dc9('0xd')](_0x2a77c1+':'+_0x1e513b['id'],_0x1e513b);SmsInteractionEvents[_0x7dc9('0xd')](_0x2a77c1,_0x1e513b);_0x3ba3ca(null);})[_0x7dc9('0xe')](_0x3ba3ca(null));};}for(var e in events){if(events[_0x7dc9('0xf')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 54fd5c3..144af79 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 _0x42be=['SmsInteraction','sms_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x4fdaa9,_0x39537e){var _0x124249=function(_0x5e7dba){while(--_0x5e7dba){_0x4fdaa9['push'](_0x4fdaa9['shift']());}};_0x124249(++_0x39537e);}(_0x42be,0xc6));var _0xe42b=function(_0x26b8be,_0x33f64d){_0x26b8be=_0x26b8be-0x0;var _0x34fc98=_0x42be[_0x26b8be];return _0x34fc98;};'use strict';var _=require(_0xe42b('0x0'));var util=require(_0xe42b('0x1'));var logger=require(_0xe42b('0x2'))(_0xe42b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe42b('0x4'));var fs=require('fs');var path=require(_0xe42b('0x5'));var rimraf=require(_0xe42b('0x6'));var config=require(_0xe42b('0x7'));var attributes=require('./smsInteraction.attributes');module[_0xe42b('0x8')]=function(_0x1f9ba0,_0x1350c1){return _0x1f9ba0[_0xe42b('0x9')](_0xe42b('0xa'),attributes,{'tableName':_0xe42b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x22a944,_0x432b8d,_0x3af182){if(_0x22a944['changed'](_0xe42b('0xc'))){_0x22a944[_0xe42b('0xd')]=moment()[_0xe42b('0xe')](_0xe42b('0xf'));}_0x3af182(null,_0x22a944);}}});}; \ No newline at end of file +var _0xd395=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2fc2e3,_0x3d703b){var _0x301d40=function(_0x1587f6){while(--_0x1587f6){_0x2fc2e3['push'](_0x2fc2e3['shift']());}};_0x301d40(++_0x3d703b);}(_0xd395,0xa0));var _0x5d39=function(_0x3f30b1,_0x3a2de1){_0x3f30b1=_0x3f30b1-0x0;var _0x2ed920=_0xd395[_0x3f30b1];return _0x2ed920;};'use strict';var _=require('lodash');var util=require(_0x5d39('0x0'));var logger=require(_0x5d39('0x1'))(_0x5d39('0x2'));var moment=require(_0x5d39('0x3'));var BPromise=require('bluebird');var rp=require(_0x5d39('0x4'));var fs=require('fs');var path=require(_0x5d39('0x5'));var rimraf=require(_0x5d39('0x6'));var config=require(_0x5d39('0x7'));var attributes=require(_0x5d39('0x8'));module[_0x5d39('0x9')]=function(_0x340101,_0x534fea){return _0x340101['define']('SmsInteraction',attributes,{'tableName':_0x5d39('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xbd763f,_0x2f7806,_0x44270b){if(_0xbd763f[_0x5d39('0xb')](_0x5d39('0xc'))){_0xbd763f[_0x5d39('0xd')]=moment()[_0x5d39('0xe')](_0x5d39('0xf'));}_0x44270b(null,_0xbd763f);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index a10d8f7..a9ca4d2 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 _0xafcb=['catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','limit','find','addTags','ids','stringify','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x2bdb0d,_0x3cab16){var _0x128124=function(_0x566417){while(--_0x566417){_0x2bdb0d['push'](_0x2bdb0d['shift']());}};_0x128124(++_0x3cab16);}(_0xafcb,0xb6));var _0xbafc=function(_0x712077,_0xe8ec85){_0x712077=_0x712077-0x0;var _0x2879d4=_0xafcb[_0x712077];return _0x2879d4;};'use strict';var _=require(_0xbafc('0x0'));var util=require(_0xbafc('0x1'));var moment=require(_0xbafc('0x2'));var BPromise=require(_0xbafc('0x3'));var rs=require(_0xbafc('0x4'));var fs=require('fs');var Redis=require(_0xbafc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbafc('0x6'));var logger=require(_0xbafc('0x7'))(_0xbafc('0x8'));var config=require(_0xbafc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbafc('0xa')][_0xbafc('0xb')]({'port':0x232a});config[_0xbafc('0xc')]=_[_0xbafc('0xd')](config['redis'],{'host':_0xbafc('0xe'),'port':0x18eb});var socket=require(_0xbafc('0xf'))(new Redis(config[_0xbafc('0xc')]));require('./smsInteraction.socket')[_0xbafc('0x10')](socket);function respondWithRpcPromise(_0x53634a,_0x2e88be,_0x153594){return new BPromise(function(_0xbd68ed,_0x16e14f){return client[_0xbafc('0x11')](_0x53634a,_0x153594)[_0xbafc('0x12')](function(_0x44d7e5){logger['info'](_0xbafc('0x13'),_0x2e88be,_0xbafc('0x14'));logger[_0xbafc('0x15')](_0xbafc('0x16'),_0x2e88be,_0xbafc('0x14'),JSON['stringify'](_0x44d7e5));if(_0x44d7e5[_0xbafc('0x17')]){if(_0x44d7e5['error'][_0xbafc('0x18')]===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x2e88be,_0x44d7e5['error'][_0xbafc('0x19')]);return _0x16e14f(_0x44d7e5[_0xbafc('0x17')]['message']);}logger[_0xbafc('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x2e88be,_0x44d7e5[_0xbafc('0x17')]['message']);return _0xbd68ed(_0x44d7e5[_0xbafc('0x17')]['message']);}else{logger[_0xbafc('0x1a')](_0xbafc('0x13'),_0x2e88be,'request\x20sent');_0xbd68ed(_0x44d7e5[_0xbafc('0x1b')]['message']);}})[_0xbafc('0x1c')](function(_0x7df247){logger[_0xbafc('0x17')](_0xbafc('0x13'),_0x2e88be,_0x7df247);_0x16e14f(_0x7df247);});});}exports[_0xbafc('0x1d')]=function(_0x39a715){var _0x230914=this;return new Promise(function(_0x41c674,_0x3443d5){return db[_0xbafc('0x1e')][_0xbafc('0x1f')](_0x39a715[_0xbafc('0x20')],{'raw':_0x39a715[_0xbafc('0x21')]?_0x39a715[_0xbafc('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39a715[_0xbafc('0x21')]?_0x39a715['options'][_0xbafc('0x22')]||null:null,'attributes':_0x39a715['options']?_0x39a715[_0xbafc('0x21')][_0xbafc('0x23')]||null:null,'limit':_0x39a715['options']?_0x39a715['options'][_0xbafc('0x24')]||null:null})[_0xbafc('0x12')](function(_0x5bf96f){logger[_0xbafc('0x1a')](_0xbafc('0x1d'),_0x39a715);logger['debug'](_0xbafc('0x1d'),_0x39a715,JSON['stringify'](_0x5bf96f));_0x41c674(_0x5bf96f);})[_0xbafc('0x1c')](function(_0x49b242){logger[_0xbafc('0x17')](_0xbafc('0x1d'),_0x49b242[_0xbafc('0x19')],_0x39a715);_0x3443d5(_0x230914['error'](0x1f4,_0x49b242[_0xbafc('0x19')]));});});};exports['AddTagsToSmsInteraction']=function(_0x50b9ef){return new Promise(function(_0x153c32,_0x1d2988){return db[_0xbafc('0x1e')][_0xbafc('0x25')]({'where':_0x50b9ef[_0xbafc('0x21')]?_0x50b9ef['options'][_0xbafc('0x22')]||null:null})[_0xbafc('0x12')](function(_0x871e69){if(_0x871e69){return _0x871e69[_0xbafc('0x26')](_0x50b9ef[_0xbafc('0x20')][_0xbafc('0x27')],_['omit'](_0x50b9ef[_0xbafc('0x20')],['ids','id'])||{});}})['spread'](function(_0x13e772){logger['info']('AddTags',_0x50b9ef);logger[_0xbafc('0x15')]('AddTags',_0x50b9ef,JSON[_0xbafc('0x28')](_0x13e772));_0x153c32(_0x13e772);})['catch'](function(_0x236dde){logger[_0xbafc('0x17')](_0xbafc('0x29'),_0x236dde[_0xbafc('0x19')],_0x50b9ef);_0x1d2988(_this[_0xbafc('0x17')](0x1f4,_0x236dde['message']));});});}; \ No newline at end of file +var _0xee26=['SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','UpdateSmsInteraction','update','options','raw','where','then','stringify','catch','AddTagsToSmsInteraction','SmsInteraction','find','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./smsInteraction.socket','register','request','info'];(function(_0x485ea6,_0x39e0f1){var _0x3f757b=function(_0x20f8b0){while(--_0x20f8b0){_0x485ea6['push'](_0x485ea6['shift']());}};_0x3f757b(++_0x39e0f1);}(_0xee26,0x15e));var _0x6ee2=function(_0x30ba85,_0x503490){_0x30ba85=_0x30ba85-0x0;var _0x58b533=_0xee26[_0x30ba85];return _0x58b533;};'use strict';var _=require(_0x6ee2('0x0'));var util=require(_0x6ee2('0x1'));var moment=require(_0x6ee2('0x2'));var BPromise=require(_0x6ee2('0x3'));var rs=require(_0x6ee2('0x4'));var fs=require('fs');var Redis=require(_0x6ee2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ee2('0x6'));var logger=require(_0x6ee2('0x7'))(_0x6ee2('0x8'));var config=require(_0x6ee2('0x9'));var jayson=require(_0x6ee2('0xa'));var client=jayson['client'][_0x6ee2('0xb')]({'port':0x232a});config[_0x6ee2('0xc')]=_[_0x6ee2('0xd')](config['redis'],{'host':_0x6ee2('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6ee2('0xf'))[_0x6ee2('0x10')](socket);function respondWithRpcPromise(_0x2bf6f9,_0x50ad2c,_0x1d7b25){return new BPromise(function(_0x1f1dfe,_0x11dc5d){return client[_0x6ee2('0x11')](_0x2bf6f9,_0x1d7b25)['then'](function(_0x2c28fd){logger[_0x6ee2('0x12')](_0x6ee2('0x13'),_0x50ad2c,'request\x20sent');logger[_0x6ee2('0x14')](_0x6ee2('0x15'),_0x50ad2c,_0x6ee2('0x16'),JSON['stringify'](_0x2c28fd));if(_0x2c28fd[_0x6ee2('0x17')]){if(_0x2c28fd['error']['code']===0x1f4){logger[_0x6ee2('0x17')](_0x6ee2('0x13'),_0x50ad2c,_0x2c28fd['error'][_0x6ee2('0x18')]);return _0x11dc5d(_0x2c28fd[_0x6ee2('0x17')]['message']);}logger[_0x6ee2('0x17')](_0x6ee2('0x13'),_0x50ad2c,_0x2c28fd[_0x6ee2('0x17')]['message']);return _0x1f1dfe(_0x2c28fd['error'][_0x6ee2('0x18')]);}else{logger[_0x6ee2('0x12')](_0x6ee2('0x13'),_0x50ad2c,'request\x20sent');_0x1f1dfe(_0x2c28fd['result'][_0x6ee2('0x18')]);}})['catch'](function(_0x5a2dc5){logger[_0x6ee2('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x50ad2c,_0x5a2dc5);_0x11dc5d(_0x5a2dc5);});});}exports[_0x6ee2('0x19')]=function(_0x3a1412){var _0x4048c9=this;return new Promise(function(_0x31e9bb,_0x3cf8bd){return db['SmsInteraction'][_0x6ee2('0x1a')](_0x3a1412['body'],{'raw':_0x3a1412[_0x6ee2('0x1b')]?_0x3a1412['options'][_0x6ee2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a1412['options']?_0x3a1412[_0x6ee2('0x1b')][_0x6ee2('0x1d')]||null:null,'attributes':_0x3a1412[_0x6ee2('0x1b')]?_0x3a1412[_0x6ee2('0x1b')]['attributes']||null:null,'limit':_0x3a1412['options']?_0x3a1412[_0x6ee2('0x1b')]['limit']||null:null})[_0x6ee2('0x1e')](function(_0x313925){logger[_0x6ee2('0x12')]('UpdateSmsInteraction',_0x3a1412);logger[_0x6ee2('0x14')](_0x6ee2('0x19'),_0x3a1412,JSON[_0x6ee2('0x1f')](_0x313925));_0x31e9bb(_0x313925);})[_0x6ee2('0x20')](function(_0x806e24){logger['error'](_0x6ee2('0x19'),_0x806e24[_0x6ee2('0x18')],_0x3a1412);_0x3cf8bd(_0x4048c9[_0x6ee2('0x17')](0x1f4,_0x806e24['message']));});});};exports[_0x6ee2('0x21')]=function(_0x184f96){return new Promise(function(_0x10956a,_0x4f9b7e){return db[_0x6ee2('0x22')][_0x6ee2('0x23')]({'where':_0x184f96['options']?_0x184f96[_0x6ee2('0x1b')][_0x6ee2('0x1d')]||null:null})['then'](function(_0x282f7c){if(_0x282f7c){return _0x282f7c['addTags'](_0x184f96[_0x6ee2('0x24')][_0x6ee2('0x25')],_[_0x6ee2('0x26')](_0x184f96[_0x6ee2('0x24')],[_0x6ee2('0x25'),'id'])||{});}})[_0x6ee2('0x27')](function(_0x150f4e){logger[_0x6ee2('0x12')](_0x6ee2('0x28'),_0x184f96);logger[_0x6ee2('0x14')](_0x6ee2('0x28'),_0x184f96,JSON[_0x6ee2('0x1f')](_0x150f4e));_0x10956a(_0x150f4e);})[_0x6ee2('0x20')](function(_0x38d75b){logger[_0x6ee2('0x17')](_0x6ee2('0x28'),_0x38d75b[_0x6ee2('0x18')],_0x184f96);_0x4f9b7e(_this['error'](0x1f4,_0x38d75b[_0x6ee2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index cd68338..0a58360 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(_0x26cd05,_0x1f7d74){var _0x3e13b9=function(_0x1af957){while(--_0x1af957){_0x26cd05['push'](_0x26cd05['shift']());}};_0x3e13b9(++_0x1f7d74);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e9e76,_0x3cb685){_0x5e9e76=_0x5e9e76-0x0;var _0x2bc580=_0xb10b[_0x5e9e76];return _0x2bc580;};'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(_0x3009aa,_0x501d90){var _0x306f0c=function(_0x17bd10){while(--_0x17bd10){_0x3009aa['push'](_0x3009aa['shift']());}};_0x306f0c(++_0x501d90);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'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 04f50d6..beccd01 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 _0xe24d=['post','tracked','sms','smsmessage:create','create','/:id/status','put','update','/:id/accept','delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/:id'];(function(_0x481b29,_0x19ea0d){var _0x35152c=function(_0x5b20fb){while(--_0x5b20fb){_0x481b29['push'](_0x481b29['shift']());}};_0x35152c(++_0x19ea0d);}(_0xe24d,0x1ef));var _0xde24=function(_0x520ecf,_0x50eda0){_0x520ecf=_0x520ecf-0x0;var _0x14f0f7=_0xe24d[_0x520ecf];return _0x14f0f7;};'use strict';var multer=require(_0xde24('0x0'));var util=require(_0xde24('0x1'));var path=require(_0xde24('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xde24('0x3'));var interaction=require(_0xde24('0x4'));var config=require(_0xde24('0x5'));var controller=require(_0xde24('0x6'));router[_0xde24('0x7')]('/',auth[_0xde24('0x8')](),controller[_0xde24('0x9')]);router[_0xde24('0x7')]('/describe',auth[_0xde24('0x8')](),controller['describe']);router[_0xde24('0x7')](_0xde24('0xa'),auth[_0xde24('0x8')](),controller['show']);router[_0xde24('0xb')]('/',auth[_0xde24('0x8')](),interaction[_0xde24('0xc')](_0xde24('0xd'),_0xde24('0xe')),controller[_0xde24('0xf')]);router['post'](_0xde24('0x10'),controller['status']);router[_0xde24('0x11')](_0xde24('0xa'),auth['isAuthenticated'](),controller[_0xde24('0x12')]);router['put'](_0xde24('0x13'),auth[_0xde24('0x8')](),controller['accept']);router[_0xde24('0x11')]('/:id/reject',auth[_0xde24('0x8')](),controller['reject']);router[_0xde24('0x14')](_0xde24('0xa'),auth[_0xde24('0x8')](),controller[_0xde24('0x15')]);module[_0xde24('0x16')]=router; \ No newline at end of file +var _0xa79c=['./smsMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked','sms','create','/:id/status','status','/:id','update','accept','put','/:id/reject','reject','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xa79c,0x19e));var _0xca79=function(_0x30fbef,_0x21cf14){_0x30fbef=_0x30fbef-0x0;var _0x52b7e4=_0xa79c[_0x30fbef];return _0x52b7e4;};'use strict';var multer=require(_0xca79('0x0'));var util=require(_0xca79('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xca79('0x2'));var router=express[_0xca79('0x3')]();var auth=require(_0xca79('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xca79('0x5'));var controller=require(_0xca79('0x6'));router[_0xca79('0x7')]('/',auth[_0xca79('0x8')](),controller[_0xca79('0x9')]);router[_0xca79('0x7')](_0xca79('0xa'),auth[_0xca79('0x8')](),controller[_0xca79('0xb')]);router[_0xca79('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xca79('0xc')]);router[_0xca79('0xd')]('/',auth[_0xca79('0x8')](),interaction[_0xca79('0xe')](_0xca79('0xf'),'smsmessage:create'),controller[_0xca79('0x10')]);router[_0xca79('0xd')](_0xca79('0x11'),controller[_0xca79('0x12')]);router['put'](_0xca79('0x13'),auth[_0xca79('0x8')](),controller[_0xca79('0x14')]);router['put']('/:id/accept',auth[_0xca79('0x8')](),controller[_0xca79('0x15')]);router[_0xca79('0x16')](_0xca79('0x17'),auth[_0xca79('0x8')](),controller[_0xca79('0x18')]);router[_0xca79('0x19')](_0xca79('0x13'),auth['isAuthenticated'](),controller[_0xca79('0x1a')]);module[_0xca79('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index b96cb49..eb66011 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 _0x67ee=['ENUM','out','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x590941,_0x1981e0){var _0x43c7bc=function(_0x1cd545){while(--_0x1cd545){_0x590941['push'](_0x590941['shift']());}};_0x43c7bc(++_0x1981e0);}(_0x67ee,0x9b));var _0xe67e=function(_0x287075,_0x3f58d2){_0x287075=_0x287075-0x0;var _0xe05092=_0x67ee[_0x287075];return _0xe05092;};'use strict';var Sequelize=require(_0xe67e('0x0'));module[_0xe67e('0x1')]={'body':{'type':Sequelize[_0xe67e('0x2')](_0xe67e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe67e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe67e('0x5')]('in',_0xe67e('0x6')),'defaultValue':_0xe67e('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xe67e('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xe67e('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x5063=['STRING','exports','TEXT','medium','BOOLEAN','out'];(function(_0x2c3a8f,_0x374e56){var _0x189412=function(_0x560055){while(--_0x560055){_0x2c3a8f['push'](_0x2c3a8f['shift']());}};_0x189412(++_0x374e56);}(_0x5063,0x151));var _0x3506=function(_0x511d7f,_0x429214){_0x511d7f=_0x511d7f-0x0;var _0x3df9ac=_0x5063[_0x511d7f];return _0x3df9ac;};'use strict';var Sequelize=require('sequelize');module[_0x3506('0x0')]={'body':{'type':Sequelize[_0x3506('0x1')](_0x3506('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3506('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x3506('0x4')),'defaultValue':_0x3506('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3506('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x3506('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 d6db113..efd6c1b 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 _0x98c3=['end','stack','name','send','SmsMessage','rawAttributes','fieldName','key','model','map','query','intersection','fields','attributes','length','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','keys','filtears','find','create','body','params','describe','sms-interactions','accept','sms','readAt','format','UserId','user','CmContact','Contact','SmsInteraction','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','get','role','null','AcceptMessage','interface','channel','event','EventManager','acceptmessage','agent','SmsInteractionId','RejectMessage','SIP/%s','rejectmessage','SmsAccount','debug','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy'];(function(_0x33df33,_0x1477b6){var _0x521172=function(_0x419491){while(--_0x419491){_0x33df33['push'](_0x33df33['shift']());}};_0x521172(++_0x1477b6);}(_0x98c3,0xd8));var _0x398c=function(_0xbc35a8,_0xb6f658){_0xbc35a8=_0xbc35a8-0x0;var _0x29edef=_0x98c3[_0xbc35a8];return _0x29edef;};'use strict';var pdf=require(_0x398c('0x0'));var emlformat=require(_0x398c('0x1'));var rimraf=require(_0x398c('0x2'));var zipdir=require(_0x398c('0x3'));var jsonpatch=require(_0x398c('0x4'));var rp=require(_0x398c('0x5'));var moment=require(_0x398c('0x6'));var BPromise=require(_0x398c('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x398c('0x8'));var sox=require(_0x398c('0x9'));var csv=require(_0x398c('0xa'));var ejs=require(_0x398c('0xb'));var fs=require('fs');var _=require(_0x398c('0xc'));var squel=require(_0x398c('0xd'));var crypto=require('crypto');var jsforce=require(_0x398c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x398c('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x398c('0xf'));var authService=require(_0x398c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x398c('0x11'))(_0x398c('0x12'));var utils=require(_0x398c('0x13'));var config=require(_0x398c('0x14'));var licenseUtil=require(_0x398c('0x15'));var db=require(_0x398c('0x16'))['db'];config[_0x398c('0x17')]=_[_0x398c('0x18')](config['redis'],{'host':_0x398c('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x398c('0x1a'))[_0x398c('0x1b')](socket);var jayson=require(_0x398c('0x1c'));var client=jayson[_0x398c('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x398c('0x1d')][_0x398c('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1c9e6b,_0x920cc1,_0xe7ad03,_0x3dcf88){return new BPromise(function(_0x4acdf4,_0x4c6b65){var _0x4e59ca=_0x3dcf88||client;return _0x4e59ca[_0x398c('0x1f')](_0x1c9e6b,_0xe7ad03)[_0x398c('0x20')](function(_0x18e78f){logger[_0x398c('0x21')](_0x398c('0x22'),_0x920cc1,_0x398c('0x23'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x920cc1,_0x398c('0x23'),JSON[_0x398c('0x24')](_0x18e78f));if(_0x18e78f[_0x398c('0x25')]){if(_0x18e78f['error'][_0x398c('0x26')]===0x1f4){logger[_0x398c('0x25')](_0x398c('0x22'),_0x920cc1,_0x18e78f[_0x398c('0x25')][_0x398c('0x27')]);return _0x4c6b65(_0x18e78f[_0x398c('0x25')][_0x398c('0x27')]);}logger['error'](_0x398c('0x22'),_0x920cc1,_0x18e78f[_0x398c('0x25')][_0x398c('0x27')]);return _0x4acdf4(_0x18e78f[_0x398c('0x25')][_0x398c('0x27')]);}else{logger[_0x398c('0x21')](_0x398c('0x22'),_0x920cc1,_0x398c('0x23'));_0x4acdf4(_0x18e78f[_0x398c('0x28')][_0x398c('0x27')]);}})[_0x398c('0x29')](function(_0xecac86){logger[_0x398c('0x25')](_0x398c('0x22'),_0x920cc1,_0xecac86);_0x4c6b65(_0xecac86);});});}function respondWithStatusCode(_0x4e3c1a,_0x1c0846){_0x1c0846=_0x1c0846||0xcc;return function(_0x34f897){if(_0x34f897){return _0x4e3c1a['sendStatus'](_0x1c0846);}return _0x4e3c1a['status'](_0x1c0846)['end']();};}function respondWithResult(_0x420e71,_0x4d045d){_0x4d045d=_0x4d045d||0xc8;return function(_0x3c45f1){if(_0x3c45f1){return _0x420e71[_0x398c('0x2a')](_0x4d045d)['json'](_0x3c45f1);}};}function respondWithFilteredResult(_0x22b4e7,_0x32f9e9){return function(_0x4382d2){if(_0x4382d2){var _0x40a4c0=_0x4382d2[_0x398c('0x2b')],_0x1407c5=_0x32f9e9[_0x398c('0x2c')],_0x441be9=_0x32f9e9[_0x398c('0x2c')]+_0x32f9e9[_0x398c('0x2d')],_0x52216a;if(_0x441be9>=_0x40a4c0){_0x441be9=_0x40a4c0;_0x52216a=0xc8;}else{_0x52216a=0xce;}_0x22b4e7['status'](_0x52216a);return _0x22b4e7[_0x398c('0x2e')](_0x398c('0x2f'),_0x1407c5+'-'+_0x441be9+'/'+_0x40a4c0)[_0x398c('0x30')](_0x4382d2);}return null;};}function patchUpdates(_0x5a7f8f){return function(_0x46f3df){try{jsonpatch[_0x398c('0x31')](_0x46f3df,_0x5a7f8f,!![]);}catch(_0x51e35d){return BPromise[_0x398c('0x32')](_0x51e35d);}return _0x46f3df[_0x398c('0x33')]();};}function saveUpdates(_0x29c15a,_0x1f36c9){return function(_0x295f3d){if(_0x295f3d){return _0x295f3d[_0x398c('0x34')](_0x29c15a)['then'](function(_0xa80106){return _0xa80106;});}return null;};}function removeEntity(_0x55ab09,_0x194442){return function(_0x1f4c24){if(_0x1f4c24){return _0x1f4c24[_0x398c('0x35')]()[_0x398c('0x20')](function(){_0x55ab09[_0x398c('0x2a')](0xcc)[_0x398c('0x36')]();});}};}function handleEntityNotFound(_0x332324,_0x418644){return function(_0x3bf9a4){if(!_0x3bf9a4){_0x332324['sendStatus'](0x194);}return _0x3bf9a4;};}function handleError(_0x42c8c8,_0x42130f){_0x42130f=_0x42130f||0x1f4;return function(_0x23ef77){logger[_0x398c('0x25')](_0x23ef77[_0x398c('0x37')]);if(_0x23ef77[_0x398c('0x38')]){delete _0x23ef77[_0x398c('0x38')];}_0x42c8c8[_0x398c('0x2a')](_0x42130f)[_0x398c('0x39')](_0x23ef77);};}exports['index']=function(_0x12da2e,_0x5f0fb4){var _0x4b4374={},_0x4ba968={},_0x391f9f={'count':0x0,'rows':[]};var _0x2e06ca=_['map'](db[_0x398c('0x3a')][_0x398c('0x3b')],function(_0x1ba396){return{'name':_0x1ba396[_0x398c('0x3c')],'type':_0x1ba396['type'][_0x398c('0x3d')]};});_0x4ba968[_0x398c('0x3e')]=_[_0x398c('0x3f')](_0x2e06ca,_0x398c('0x38'));_0x4ba968[_0x398c('0x40')]=_['keys'](_0x12da2e['query']);_0x4ba968['filters']=_['intersection'](_0x4ba968[_0x398c('0x3e')],_0x4ba968['query']);_0x4b4374['attributes']=_[_0x398c('0x41')](_0x4ba968[_0x398c('0x3e')],qs[_0x398c('0x42')](_0x12da2e[_0x398c('0x40')]['fields']));_0x4b4374[_0x398c('0x43')]=_0x4b4374['attributes'][_0x398c('0x44')]?_0x4b4374[_0x398c('0x43')]:_0x4ba968[_0x398c('0x3e')];if(!_0x12da2e[_0x398c('0x40')]['hasOwnProperty']('nolimit')){_0x4b4374[_0x398c('0x2d')]=qs['limit'](_0x12da2e[_0x398c('0x40')][_0x398c('0x2d')]);_0x4b4374['offset']=qs[_0x398c('0x2c')](_0x12da2e['query'][_0x398c('0x2c')]);}_0x4b4374[_0x398c('0x45')]=qs[_0x398c('0x46')](_0x12da2e[_0x398c('0x40')][_0x398c('0x46')]);_0x4b4374[_0x398c('0x47')]=qs['filters'](_[_0x398c('0x48')](_0x12da2e[_0x398c('0x40')],_0x4ba968[_0x398c('0x49')]),_0x2e06ca);if(_0x12da2e[_0x398c('0x40')][_0x398c('0x4a')]){_0x4b4374[_0x398c('0x47')]=_[_0x398c('0x4b')](_0x4b4374[_0x398c('0x47')],{'$or':_[_0x398c('0x3f')](_0x2e06ca,function(_0x739db8){if(_0x739db8['type']!==_0x398c('0x4c')){var _0x3f59ef={};_0x3f59ef[_0x739db8[_0x398c('0x38')]]={'$like':'%'+_0x12da2e[_0x398c('0x40')][_0x398c('0x4a')]+'%'};return _0x3f59ef;}})});}_0x4b4374=_[_0x398c('0x4b')]({},_0x4b4374,_0x12da2e[_0x398c('0x4d')]);var _0x16fbef={'where':_0x4b4374[_0x398c('0x47')]};return db[_0x398c('0x3a')][_0x398c('0x2b')](_0x16fbef)[_0x398c('0x20')](function(_0x517f17){_0x391f9f[_0x398c('0x2b')]=_0x517f17;if(_0x12da2e['query'][_0x398c('0x4e')]){_0x4b4374[_0x398c('0x4f')]=[{'all':!![]}];}return db[_0x398c('0x3a')][_0x398c('0x50')](_0x4b4374);})['then'](function(_0x1c0264){_0x391f9f['rows']=_0x1c0264;return _0x391f9f;})[_0x398c('0x20')](respondWithFilteredResult(_0x5f0fb4,_0x4b4374))[_0x398c('0x29')](handleError(_0x5f0fb4,null));};exports[_0x398c('0x51')]=function(_0xbd6a14,_0xfe8f0){var _0x34a3c7={'raw':!![],'where':{'id':_0xbd6a14['params']['id']}},_0xaf4506={};_0xaf4506['model']=_[_0x398c('0x52')](db[_0x398c('0x3a')][_0x398c('0x3b')]);_0xaf4506[_0x398c('0x40')]=_['keys'](_0xbd6a14[_0x398c('0x40')]);_0xaf4506[_0x398c('0x53')]=_[_0x398c('0x41')](_0xaf4506['model'],_0xaf4506[_0x398c('0x40')]);_0x34a3c7[_0x398c('0x43')]=_[_0x398c('0x41')](_0xaf4506[_0x398c('0x3e')],qs['fields'](_0xbd6a14[_0x398c('0x40')][_0x398c('0x42')]));_0x34a3c7[_0x398c('0x43')]=_0x34a3c7[_0x398c('0x43')][_0x398c('0x44')]?_0x34a3c7[_0x398c('0x43')]:_0xaf4506['model'];if(_0xbd6a14[_0x398c('0x40')]['includeAll']){_0x34a3c7['include']=[{'all':!![]}];}_0x34a3c7=_[_0x398c('0x4b')]({},_0x34a3c7,_0xbd6a14[_0x398c('0x4d')]);return db[_0x398c('0x3a')][_0x398c('0x54')](_0x34a3c7)[_0x398c('0x20')](handleEntityNotFound(_0xfe8f0,null))['then'](respondWithResult(_0xfe8f0,null))[_0x398c('0x29')](handleError(_0xfe8f0,null));};exports[_0x398c('0x55')]=function(_0x3e4ef6,_0x58f007){return db['SmsMessage'][_0x398c('0x55')](_0x3e4ef6['body'],{})['then'](respondWithResult(_0x58f007,0xc9))[_0x398c('0x29')](handleError(_0x58f007,null));};exports[_0x398c('0x34')]=function(_0x27fd28,_0x4169dc){if(_0x27fd28['body']['id']){delete _0x27fd28[_0x398c('0x56')]['id'];}return db[_0x398c('0x3a')][_0x398c('0x54')]({'where':{'id':_0x27fd28['params']['id']}})[_0x398c('0x20')](handleEntityNotFound(_0x4169dc,null))['then'](saveUpdates(_0x27fd28[_0x398c('0x56')],null))[_0x398c('0x20')](respondWithResult(_0x4169dc,null))[_0x398c('0x29')](handleError(_0x4169dc,null));};exports[_0x398c('0x35')]=function(_0x2ee4f8,_0xa9e71b){return db[_0x398c('0x3a')]['find']({'where':{'id':_0x2ee4f8[_0x398c('0x57')]['id']}})['then'](handleEntityNotFound(_0xa9e71b,null))[_0x398c('0x20')](removeEntity(_0xa9e71b,null))[_0x398c('0x29')](handleError(_0xa9e71b,null));};exports[_0x398c('0x58')]=function(_0x2e69c5,_0x45112d){return db[_0x398c('0x3a')][_0x398c('0x58')]()['then'](respondWithResult(_0x45112d,null))[_0x398c('0x29')](handleError(_0x45112d,null));};var interaction_log=require(_0x398c('0x11'))(_0x398c('0x59'));exports[_0x398c('0x5a')]=function(_0x334b92,_0x49e0c2,_0x446a2d){var _0x50d3b5={'channel':_0x398c('0x5b')};if(_0x334b92[_0x398c('0x56')]['id']){delete _0x334b92['body']['id'];}_0x334b92['body']['read']=!![];_0x334b92['body'][_0x398c('0x5c')]=moment()[_0x398c('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x334b92['body'][_0x398c('0x5e')]=_0x334b92[_0x398c('0x56')][_0x398c('0x5e')]||_0x334b92[_0x398c('0x5f')]['id'];return db[_0x398c('0x3a')][_0x398c('0x54')]({'where':{'id':_0x334b92[_0x398c('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x398c('0x60')],'as':_0x398c('0x61')}]})[_0x398c('0x20')](handleEntityNotFound(_0x49e0c2,null))[_0x398c('0x20')](saveUpdates(_0x334b92['body'],null))[_0x398c('0x20')](function(_0x38c857){if(_0x38c857){_0x50d3b5[_0x398c('0x27')]=_0x38c857['get']({'plain':!![]});return db[_0x398c('0x62')]['find']({'where':{'id':_0x38c857['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x49e0c2,null))['then'](function(_0x5e91c5){if(_0x5e91c5){return _0x5e91c5[_0x398c('0x34')]({'UserId':_0x334b92[_0x398c('0x56')]['UserId'],'read1stAt':_[_0x398c('0x63')](_0x5e91c5['read1stAt'])?moment()['format'](_0x398c('0x64')):undefined});}return null;})['then'](function(_0x4b456a){if(_0x4b456a){_0x50d3b5[_0x398c('0x65')]=_0x4b456a[_0x398c('0x66')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x334b92[_0x398c('0x5f')]['id'],_0x334b92[_0x398c('0x5f')][_0x398c('0x38')],_0x334b92['user'][_0x398c('0x67')],_0x50d3b5['interaction']['id'],_0x334b92[_0x398c('0x56')]?JSON['stringify'](_0x334b92[_0x398c('0x56')]):_0x398c('0x68'));return respondWithRpcPromise(_0x398c('0x69'),'acceptMessage',_0x50d3b5);}return null;})[_0x398c('0x20')](function(_0x5e31ab){if(_0x5e31ab){if(_0x334b92[_0x398c('0x56')]['manual']){_0x50d3b5[_0x398c('0x27')][_0x398c('0x6a')]=util[_0x398c('0x5d')]('SIP/%s',_0x334b92[_0x398c('0x5f')][_0x398c('0x38')]);_0x50d3b5[_0x398c('0x27')]['channel']=_0x50d3b5[_0x398c('0x6b')];_0x50d3b5['message'][_0x398c('0x6c')]=_0x398c('0x5a');return respondWithRpcPromise(_0x398c('0x6d'),_0x398c('0x6d'),{'event':_0x398c('0x6e'),'message':_0x50d3b5['message']},client9002)['then'](function(){return _0x50d3b5;});}return _0x50d3b5;}return null;})[_0x398c('0x20')](respondWithResult(_0x49e0c2,null))[_0x398c('0x29')](handleError(_0x49e0c2,null));};var interaction_log=require(_0x398c('0x11'))(_0x398c('0x59'));exports[_0x398c('0x32')]=function(_0x2c0d07,_0x9fc5ee,_0x581979){var _0x37580b={'agent':{},'channel':_0x398c('0x5b')};if(_0x2c0d07[_0x398c('0x56')]['id']){delete _0x2c0d07[_0x398c('0x56')]['id'];}_0x2c0d07[_0x398c('0x56')][_0x398c('0x5e')]=_0x2c0d07[_0x398c('0x56')][_0x398c('0x5e')]||_0x2c0d07[_0x398c('0x5f')]['id'];_0x37580b[_0x398c('0x6f')]['id']=_0x2c0d07[_0x398c('0x56')][_0x398c('0x5e')];return db['SmsMessage'][_0x398c('0x54')]({'where':{'id':_0x2c0d07[_0x398c('0x57')]['id'],'UserId':null}})[_0x398c('0x20')](handleEntityNotFound(_0x9fc5ee,null))[_0x398c('0x20')](function(_0x3bb070){if(_0x3bb070){_0x37580b['message']=_0x3bb070[_0x398c('0x66')]({'plain':!![]});return db['SmsInteraction'][_0x398c('0x54')]({'where':{'id':_0x3bb070[_0x398c('0x70')]}});}return null;})[_0x398c('0x20')](handleEntityNotFound(_0x9fc5ee,null))[_0x398c('0x20')](function(_0x5347c2){if(_0x5347c2){_0x37580b['interaction']=_0x5347c2['get']({'plain':!![]});interaction_log[_0x398c('0x21')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2c0d07[_0x398c('0x5f')]['id'],_0x2c0d07[_0x398c('0x5f')][_0x398c('0x38')],_0x2c0d07[_0x398c('0x5f')]['role'],_0x37580b[_0x398c('0x65')]['id'],_0x2c0d07[_0x398c('0x56')]?JSON[_0x398c('0x24')](_0x2c0d07[_0x398c('0x56')]):_0x398c('0x68'));return respondWithRpcPromise(_0x398c('0x71'),'rejectMessage',_0x37580b);}return null;})[_0x398c('0x20')](function(_0x569145){if(_0x569145){_0x569145['message'][_0x398c('0x6a')]=util['format'](_0x398c('0x72'),_0x2c0d07[_0x398c('0x5f')][_0x398c('0x38')]);_0x569145[_0x398c('0x27')][_0x398c('0x6b')]=_0x37580b['channel'];_0x569145[_0x398c('0x27')][_0x398c('0x6c')]='reject';respondWithRpcPromise(_0x398c('0x6d'),'EventManager',{'event':_0x398c('0x73'),'message':_0x569145[_0x398c('0x27')]},client9002);return _0x37580b;}return null;})[_0x398c('0x20')](respondWithResult(_0x9fc5ee,null))['catch'](handleError(_0x9fc5ee,null));};exports[_0x398c('0x2a')]=function(_0x450b7b,_0x4af940,_0x3be518){if(_0x450b7b['body']['id']){delete _0x450b7b[_0x398c('0x56')]['id'];}var _0x339092;return db[_0x398c('0x3a')][_0x398c('0x54')]({'where':{'id':_0x450b7b[_0x398c('0x57')]['id']}})[_0x398c('0x20')](handleEntityNotFound(_0x4af940,null))[_0x398c('0x20')](function(_0x5c40c1){if(_0x5c40c1){_0x339092=_0x5c40c1;return db[_0x398c('0x74')]['find']({'where':{'id':_0x5c40c1['SmsAccountId']}});}})[_0x398c('0x20')](handleEntityNotFound(_0x4af940,null))[_0x398c('0x20')](function(_0x3e6596){if(_0x3e6596){logger[_0x398c('0x75')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x398c('0x2a'),_0x398c('0x76'),_0x3e6596[_0x398c('0x77')],util[_0x398c('0x78')](_0x450b7b[_0x398c('0x56')],{'showHidden':![],'depth':null}));switch(_0x3e6596[_0x398c('0x77')]){case _0x398c('0x79'):if(_0x450b7b[_0x398c('0x56')][_0x398c('0x7a')]&&_0x450b7b[_0x398c('0x56')][_0x398c('0x7a')]===_0x339092[_0x398c('0x7b')]){return _0x339092[_0x398c('0x34')]({'read':!![]});}else{logger[_0x398c('0x25')](_0x398c('0x7c'),_0x398c('0x2a'),_0x398c('0x79'),util[_0x398c('0x78')](_0x450b7b[_0x398c('0x56')],{'showHidden':![],'depth':null}));}break;case _0x398c('0x7d'):if(_0x450b7b[_0x398c('0x56')][_0x398c('0x7e')]&&_0x450b7b['body'][_0x398c('0x7e')]===_0x339092[_0x398c('0x7b')]&&_['indexOf']([_0x398c('0x7f'),_0x398c('0x80')],_0x450b7b[_0x398c('0x56')][_0x398c('0x81')])>=0x0){return _0x339092[_0x398c('0x34')]({'read':!![]});}else{logger['error'](_0x398c('0x7c'),_0x398c('0x2a'),_0x398c('0x82'),util[_0x398c('0x78')](_0x450b7b[_0x398c('0x56')],{'showHidden':![],'depth':null}));}break;case _0x398c('0x83'):var _0x6f5507=_0x450b7b[_0x398c('0x56')][_0x398c('0x84')][0x0];if(_0x6f5507[_0x398c('0x2a')][_0x398c('0x85')]===_0x398c('0x86')){return _0x339092['update']({'read':!![]});}else{logger[_0x398c('0x25')](_0x398c('0x7c'),_0x398c('0x2a'),'infobip',util[_0x398c('0x78')](_0x450b7b[_0x398c('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x339092;}})[_0x398c('0x20')](respondWithResult(_0x4af940,null))['catch'](handleError(_0x4af940,null));}; \ No newline at end of file +var _0x3633=['mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','count','offset','set','json','apply','reject','save','update','then','destroy','sendStatus','name','index','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','SmsMessage','findAll','rows','show','params','filtears','length','find','create','body','describe','sms-interactions','accept','read','readAt','format','UserId','CmContact','Contact','SmsInteraction','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','sms','RejectMessage','rejectMessage','rejectmessage','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','delivered','Status','plivio','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x554b21,_0x5d657a){var _0x2abee1=function(_0x4d2881){while(--_0x4d2881){_0x554b21['push'](_0x554b21['shift']());}};_0x2abee1(++_0x5d657a);}(_0x3633,0x81));var _0x3363=function(_0x2bb889,_0x3b54a2){_0x2bb889=_0x2bb889-0x0;var _0x2c9f71=_0x3633[_0x2bb889];return _0x2c9f71;};'use strict';var pdf=require(_0x3363('0x0'));var emlformat=require(_0x3363('0x1'));var rimraf=require(_0x3363('0x2'));var zipdir=require(_0x3363('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3363('0x4'));var moment=require(_0x3363('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3363('0x6'));var util=require(_0x3363('0x7'));var path=require(_0x3363('0x8'));var sox=require(_0x3363('0x9'));var csv=require(_0x3363('0xa'));var ejs=require(_0x3363('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3363('0xc'));var crypto=require('crypto');var jsforce=require(_0x3363('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3363('0xa'));var querystring=require(_0x3363('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3363('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3363('0x10'));var hardwareService=require(_0x3363('0x11'));var logger=require(_0x3363('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x3363('0x13'));var licenseUtil=require(_0x3363('0x14'));var db=require(_0x3363('0x15'))['db'];config[_0x3363('0x16')]=_['defaults'](config['redis'],{'host':_0x3363('0x17'),'port':0x18eb});var socket=require(_0x3363('0x18'))(new Redis(config['redis']));require(_0x3363('0x19'))[_0x3363('0x1a')](socket);var jayson=require(_0x3363('0x1b'));var client=jayson[_0x3363('0x1c')][_0x3363('0x1d')]({'port':0x232c});var client9002=jayson[_0x3363('0x1c')][_0x3363('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x31cfcf,_0x4ae4e5,_0x1e7423,_0x254b89){return new BPromise(function(_0x3e44c4,_0x5b817e){var _0x3c5070=_0x254b89||client;return _0x3c5070[_0x3363('0x1e')](_0x31cfcf,_0x1e7423)['then'](function(_0x127389){logger['info'](_0x3363('0x1f'),_0x4ae4e5,_0x3363('0x20'));logger[_0x3363('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4ae4e5,_0x3363('0x20'),JSON[_0x3363('0x22')](_0x127389));if(_0x127389[_0x3363('0x23')]){if(_0x127389[_0x3363('0x23')][_0x3363('0x24')]===0x1f4){logger[_0x3363('0x23')](_0x3363('0x1f'),_0x4ae4e5,_0x127389[_0x3363('0x23')][_0x3363('0x25')]);return _0x5b817e(_0x127389[_0x3363('0x23')][_0x3363('0x25')]);}logger[_0x3363('0x23')](_0x3363('0x1f'),_0x4ae4e5,_0x127389['error'][_0x3363('0x25')]);return _0x3e44c4(_0x127389[_0x3363('0x23')][_0x3363('0x25')]);}else{logger[_0x3363('0x26')](_0x3363('0x1f'),_0x4ae4e5,'request\x20sent');_0x3e44c4(_0x127389[_0x3363('0x27')][_0x3363('0x25')]);}})[_0x3363('0x28')](function(_0xc02e0){logger[_0x3363('0x23')]('SmsMessage,\x20%s,\x20%s',_0x4ae4e5,_0xc02e0);_0x5b817e(_0xc02e0);});});}function respondWithStatusCode(_0x203d1e,_0x4d59de){_0x4d59de=_0x4d59de||0xcc;return function(_0x631597){if(_0x631597){return _0x203d1e['sendStatus'](_0x4d59de);}return _0x203d1e[_0x3363('0x29')](_0x4d59de)['end']();};}function respondWithResult(_0xacb5d3,_0x5aadf1){_0x5aadf1=_0x5aadf1||0xc8;return function(_0x947bd6){if(_0x947bd6){return _0xacb5d3[_0x3363('0x29')](_0x5aadf1)['json'](_0x947bd6);}};}function respondWithFilteredResult(_0x2ff0a6,_0x2b4f1b){return function(_0x938c29){if(_0x938c29){var _0x36081c=_0x938c29[_0x3363('0x2a')],_0xb28a6e=_0x2b4f1b[_0x3363('0x2b')],_0xb7f80b=_0x2b4f1b[_0x3363('0x2b')]+_0x2b4f1b['limit'],_0x29f6c0;if(_0xb7f80b>=_0x36081c){_0xb7f80b=_0x36081c;_0x29f6c0=0xc8;}else{_0x29f6c0=0xce;}_0x2ff0a6[_0x3363('0x29')](_0x29f6c0);return _0x2ff0a6[_0x3363('0x2c')]('Content-Range',_0xb28a6e+'-'+_0xb7f80b+'/'+_0x36081c)[_0x3363('0x2d')](_0x938c29);}return null;};}function patchUpdates(_0x374822){return function(_0x6b872c){try{jsonpatch[_0x3363('0x2e')](_0x6b872c,_0x374822,!![]);}catch(_0xfa23ef){return BPromise[_0x3363('0x2f')](_0xfa23ef);}return _0x6b872c[_0x3363('0x30')]();};}function saveUpdates(_0x1d7645,_0x5a5391){return function(_0x415772){if(_0x415772){return _0x415772[_0x3363('0x31')](_0x1d7645)[_0x3363('0x32')](function(_0x45ad15){return _0x45ad15;});}return null;};}function removeEntity(_0x1e6cfd,_0x50b3a6){return function(_0x9e3e08){if(_0x9e3e08){return _0x9e3e08[_0x3363('0x33')]()[_0x3363('0x32')](function(){_0x1e6cfd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e8973,_0x5a5533){return function(_0x4a1ffb){if(!_0x4a1ffb){_0x4e8973[_0x3363('0x34')](0x194);}return _0x4a1ffb;};}function handleError(_0x5ae625,_0x5a3821){_0x5a3821=_0x5a3821||0x1f4;return function(_0x43cb57){logger[_0x3363('0x23')](_0x43cb57['stack']);if(_0x43cb57[_0x3363('0x35')]){delete _0x43cb57[_0x3363('0x35')];}_0x5ae625['status'](_0x5a3821)['send'](_0x43cb57);};}exports[_0x3363('0x36')]=function(_0x11a299,_0x59e127){var _0x1533f9={},_0x32ce61={},_0x476003={'count':0x0,'rows':[]};var _0x557c78=_['map'](db['SmsMessage'][_0x3363('0x37')],function(_0x49aa30){return{'name':_0x49aa30[_0x3363('0x38')],'type':_0x49aa30[_0x3363('0x39')][_0x3363('0x3a')]};});_0x32ce61['model']=_[_0x3363('0x3b')](_0x557c78,_0x3363('0x35'));_0x32ce61[_0x3363('0x3c')]=_[_0x3363('0x3d')](_0x11a299[_0x3363('0x3c')]);_0x32ce61[_0x3363('0x3e')]=_['intersection'](_0x32ce61[_0x3363('0x3f')],_0x32ce61[_0x3363('0x3c')]);_0x1533f9[_0x3363('0x40')]=_[_0x3363('0x41')](_0x32ce61[_0x3363('0x3f')],qs[_0x3363('0x42')](_0x11a299['query']['fields']));_0x1533f9['attributes']=_0x1533f9[_0x3363('0x40')]['length']?_0x1533f9[_0x3363('0x40')]:_0x32ce61[_0x3363('0x3f')];if(!_0x11a299['query']['hasOwnProperty']('nolimit')){_0x1533f9[_0x3363('0x43')]=qs[_0x3363('0x43')](_0x11a299['query']['limit']);_0x1533f9['offset']=qs[_0x3363('0x2b')](_0x11a299[_0x3363('0x3c')]['offset']);}_0x1533f9[_0x3363('0x44')]=qs[_0x3363('0x45')](_0x11a299[_0x3363('0x3c')][_0x3363('0x45')]);_0x1533f9['where']=qs[_0x3363('0x3e')](_[_0x3363('0x46')](_0x11a299['query'],_0x32ce61[_0x3363('0x3e')]),_0x557c78);if(_0x11a299[_0x3363('0x3c')][_0x3363('0x47')]){_0x1533f9['where']=_[_0x3363('0x48')](_0x1533f9[_0x3363('0x49')],{'$or':_[_0x3363('0x3b')](_0x557c78,function(_0x49e9ff){if(_0x49e9ff[_0x3363('0x39')]!==_0x3363('0x4a')){var _0x50e963={};_0x50e963[_0x49e9ff[_0x3363('0x35')]]={'$like':'%'+_0x11a299[_0x3363('0x3c')][_0x3363('0x47')]+'%'};return _0x50e963;}})});}_0x1533f9=_[_0x3363('0x48')]({},_0x1533f9,_0x11a299[_0x3363('0x4b')]);var _0x50bb47={'where':_0x1533f9[_0x3363('0x49')]};return db['SmsMessage']['count'](_0x50bb47)[_0x3363('0x32')](function(_0x3b1e9b){_0x476003[_0x3363('0x2a')]=_0x3b1e9b;if(_0x11a299[_0x3363('0x3c')][_0x3363('0x4c')]){_0x1533f9[_0x3363('0x4d')]=[{'all':!![]}];}return db[_0x3363('0x4e')][_0x3363('0x4f')](_0x1533f9);})['then'](function(_0x493ad9){_0x476003[_0x3363('0x50')]=_0x493ad9;return _0x476003;})['then'](respondWithFilteredResult(_0x59e127,_0x1533f9))[_0x3363('0x28')](handleError(_0x59e127,null));};exports[_0x3363('0x51')]=function(_0x2086fb,_0x247226){var _0x465658={'raw':!![],'where':{'id':_0x2086fb[_0x3363('0x52')]['id']}},_0x3a94af={};_0x3a94af[_0x3363('0x3f')]=_[_0x3363('0x3d')](db[_0x3363('0x4e')][_0x3363('0x37')]);_0x3a94af[_0x3363('0x3c')]=_[_0x3363('0x3d')](_0x2086fb['query']);_0x3a94af[_0x3363('0x53')]=_['intersection'](_0x3a94af[_0x3363('0x3f')],_0x3a94af[_0x3363('0x3c')]);_0x465658[_0x3363('0x40')]=_[_0x3363('0x41')](_0x3a94af[_0x3363('0x3f')],qs[_0x3363('0x42')](_0x2086fb[_0x3363('0x3c')]['fields']));_0x465658[_0x3363('0x40')]=_0x465658[_0x3363('0x40')][_0x3363('0x54')]?_0x465658[_0x3363('0x40')]:_0x3a94af[_0x3363('0x3f')];if(_0x2086fb['query']['includeAll']){_0x465658[_0x3363('0x4d')]=[{'all':!![]}];}_0x465658=_[_0x3363('0x48')]({},_0x465658,_0x2086fb[_0x3363('0x4b')]);return db[_0x3363('0x4e')][_0x3363('0x55')](_0x465658)['then'](handleEntityNotFound(_0x247226,null))[_0x3363('0x32')](respondWithResult(_0x247226,null))[_0x3363('0x28')](handleError(_0x247226,null));};exports[_0x3363('0x56')]=function(_0x4d117b,_0x22ba87){return db[_0x3363('0x4e')]['create'](_0x4d117b[_0x3363('0x57')],{})[_0x3363('0x32')](respondWithResult(_0x22ba87,0xc9))[_0x3363('0x28')](handleError(_0x22ba87,null));};exports[_0x3363('0x31')]=function(_0x402610,_0x5c924e){if(_0x402610[_0x3363('0x57')]['id']){delete _0x402610[_0x3363('0x57')]['id'];}return db[_0x3363('0x4e')]['find']({'where':{'id':_0x402610[_0x3363('0x52')]['id']}})[_0x3363('0x32')](handleEntityNotFound(_0x5c924e,null))['then'](saveUpdates(_0x402610[_0x3363('0x57')],null))[_0x3363('0x32')](respondWithResult(_0x5c924e,null))[_0x3363('0x28')](handleError(_0x5c924e,null));};exports[_0x3363('0x33')]=function(_0x106c59,_0x331796){return db[_0x3363('0x4e')][_0x3363('0x55')]({'where':{'id':_0x106c59['params']['id']}})[_0x3363('0x32')](handleEntityNotFound(_0x331796,null))[_0x3363('0x32')](removeEntity(_0x331796,null))['catch'](handleError(_0x331796,null));};exports['describe']=function(_0x4745c9,_0xe767f0){return db[_0x3363('0x4e')][_0x3363('0x58')]()['then'](respondWithResult(_0xe767f0,null))[_0x3363('0x28')](handleError(_0xe767f0,null));};var interaction_log=require(_0x3363('0x12'))(_0x3363('0x59'));exports[_0x3363('0x5a')]=function(_0x3be36a,_0x2e57a3,_0x5c4456){var _0x67d4dd={'channel':'sms'};if(_0x3be36a[_0x3363('0x57')]['id']){delete _0x3be36a[_0x3363('0x57')]['id'];}_0x3be36a[_0x3363('0x57')][_0x3363('0x5b')]=!![];_0x3be36a[_0x3363('0x57')][_0x3363('0x5c')]=moment()[_0x3363('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x3be36a[_0x3363('0x57')][_0x3363('0x5e')]=_0x3be36a[_0x3363('0x57')][_0x3363('0x5e')]||_0x3be36a['user']['id'];return db['SmsMessage'][_0x3363('0x55')]({'where':{'id':_0x3be36a['params']['id'],'UserId':null},'include':[{'model':db[_0x3363('0x5f')],'as':_0x3363('0x60')}]})[_0x3363('0x32')](handleEntityNotFound(_0x2e57a3,null))['then'](saveUpdates(_0x3be36a[_0x3363('0x57')],null))[_0x3363('0x32')](function(_0x43624c){if(_0x43624c){_0x67d4dd[_0x3363('0x25')]=_0x43624c['get']({'plain':!![]});return db[_0x3363('0x61')][_0x3363('0x55')]({'where':{'id':_0x43624c[_0x3363('0x62')]}});}return null;})[_0x3363('0x32')](handleEntityNotFound(_0x2e57a3,null))['then'](function(_0x325724){if(_0x325724){return _0x325724[_0x3363('0x31')]({'UserId':_0x3be36a[_0x3363('0x57')][_0x3363('0x5e')],'read1stAt':_[_0x3363('0x63')](_0x325724[_0x3363('0x64')])?moment()[_0x3363('0x5d')](_0x3363('0x65')):undefined});}return null;})[_0x3363('0x32')](function(_0x5a0ddb){if(_0x5a0ddb){_0x67d4dd[_0x3363('0x66')]=_0x5a0ddb[_0x3363('0x67')]({'plain':!![]});interaction_log[_0x3363('0x26')](_0x3363('0x68'),_0x3be36a[_0x3363('0x69')]['id'],_0x3be36a['user'][_0x3363('0x35')],_0x3be36a[_0x3363('0x69')]['role'],_0x67d4dd[_0x3363('0x66')]['id'],_0x3be36a[_0x3363('0x57')]?JSON['stringify'](_0x3be36a[_0x3363('0x57')]):_0x3363('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x3363('0x6b'),_0x67d4dd);}return null;})[_0x3363('0x32')](function(_0x5ac516){if(_0x5ac516){if(_0x3be36a[_0x3363('0x57')][_0x3363('0x6c')]){_0x67d4dd['message'][_0x3363('0x6d')]=util[_0x3363('0x5d')](_0x3363('0x6e'),_0x3be36a['user']['name']);_0x67d4dd[_0x3363('0x25')][_0x3363('0x6f')]=_0x67d4dd[_0x3363('0x6f')];_0x67d4dd['message'][_0x3363('0x70')]=_0x3363('0x5a');return respondWithRpcPromise(_0x3363('0x71'),_0x3363('0x71'),{'event':_0x3363('0x72'),'message':_0x67d4dd[_0x3363('0x25')]},client9002)[_0x3363('0x32')](function(){return _0x67d4dd;});}return _0x67d4dd;}return null;})['then'](respondWithResult(_0x2e57a3,null))[_0x3363('0x28')](handleError(_0x2e57a3,null));};var interaction_log=require(_0x3363('0x12'))(_0x3363('0x59'));exports[_0x3363('0x2f')]=function(_0xce28c6,_0x22b65a,_0x364a72){var _0x1f9c33={'agent':{},'channel':_0x3363('0x73')};if(_0xce28c6[_0x3363('0x57')]['id']){delete _0xce28c6[_0x3363('0x57')]['id'];}_0xce28c6['body'][_0x3363('0x5e')]=_0xce28c6[_0x3363('0x57')][_0x3363('0x5e')]||_0xce28c6[_0x3363('0x69')]['id'];_0x1f9c33['agent']['id']=_0xce28c6[_0x3363('0x57')][_0x3363('0x5e')];return db[_0x3363('0x4e')]['find']({'where':{'id':_0xce28c6[_0x3363('0x52')]['id'],'UserId':null}})[_0x3363('0x32')](handleEntityNotFound(_0x22b65a,null))[_0x3363('0x32')](function(_0x7aa4e4){if(_0x7aa4e4){_0x1f9c33[_0x3363('0x25')]=_0x7aa4e4['get']({'plain':!![]});return db['SmsInteraction'][_0x3363('0x55')]({'where':{'id':_0x7aa4e4['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x22b65a,null))[_0x3363('0x32')](function(_0x503895){if(_0x503895){_0x1f9c33['interaction']=_0x503895['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xce28c6['user']['id'],_0xce28c6[_0x3363('0x69')][_0x3363('0x35')],_0xce28c6[_0x3363('0x69')]['role'],_0x1f9c33[_0x3363('0x66')]['id'],_0xce28c6[_0x3363('0x57')]?JSON[_0x3363('0x22')](_0xce28c6[_0x3363('0x57')]):_0x3363('0x6a'));return respondWithRpcPromise(_0x3363('0x74'),_0x3363('0x75'),_0x1f9c33);}return null;})['then'](function(_0x3f05de){if(_0x3f05de){_0x3f05de[_0x3363('0x25')][_0x3363('0x6d')]=util[_0x3363('0x5d')](_0x3363('0x6e'),_0xce28c6[_0x3363('0x69')]['name']);_0x3f05de[_0x3363('0x25')]['channel']=_0x1f9c33[_0x3363('0x6f')];_0x3f05de[_0x3363('0x25')]['event']=_0x3363('0x2f');respondWithRpcPromise('EventManager','EventManager',{'event':_0x3363('0x76'),'message':_0x3f05de[_0x3363('0x25')]},client9002);return _0x1f9c33;}return null;})['then'](respondWithResult(_0x22b65a,null))[_0x3363('0x28')](handleError(_0x22b65a,null));};exports['status']=function(_0x983944,_0x25434f,_0x27002e){if(_0x983944[_0x3363('0x57')]['id']){delete _0x983944[_0x3363('0x57')]['id'];}var _0x41dc08;return db[_0x3363('0x4e')][_0x3363('0x55')]({'where':{'id':_0x983944[_0x3363('0x52')]['id']}})[_0x3363('0x32')](handleEntityNotFound(_0x25434f,null))[_0x3363('0x32')](function(_0x51d1b0){if(_0x51d1b0){_0x41dc08=_0x51d1b0;return db['SmsAccount']['find']({'where':{'id':_0x51d1b0[_0x3363('0x77')]}});}})['then'](handleEntityNotFound(_0x25434f,null))['then'](function(_0x596eef){if(_0x596eef){logger['debug'](_0x3363('0x78'),_0x3363('0x29'),_0x3363('0x79'),_0x596eef[_0x3363('0x39')],util[_0x3363('0x7a')](_0x983944[_0x3363('0x57')],{'showHidden':![],'depth':null}));switch(_0x596eef[_0x3363('0x39')]){case'twilio':if(_0x983944[_0x3363('0x57')][_0x3363('0x7b')]&&_0x983944['body'][_0x3363('0x7b')]===_0x41dc08[_0x3363('0x7c')]){return _0x41dc08[_0x3363('0x31')]({'read':!![]});}else{logger[_0x3363('0x23')](_0x3363('0x7d'),_0x3363('0x29'),_0x3363('0x7e'),util['inspect'](_0x983944[_0x3363('0x57')],{'showHidden':![],'depth':null}));}break;case _0x3363('0x7f'):if(_0x983944[_0x3363('0x57')]['MessageUUID']&&_0x983944[_0x3363('0x57')][_0x3363('0x80')]===_0x41dc08[_0x3363('0x7c')]&&_[_0x3363('0x81')](['sent',_0x3363('0x82')],_0x983944[_0x3363('0x57')][_0x3363('0x83')])>=0x0){return _0x41dc08['update']({'read':!![]});}else{logger[_0x3363('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3363('0x29'),_0x3363('0x84'),util[_0x3363('0x7a')](_0x983944['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x188bce=_0x983944[_0x3363('0x57')]['results'][0x0];if(_0x188bce[_0x3363('0x29')][_0x3363('0x85')]===_0x3363('0x86')){return _0x41dc08[_0x3363('0x31')]({'read':!![]});}else{logger[_0x3363('0x23')](_0x3363('0x7d'),_0x3363('0x29'),'infobip',util[_0x3363('0x7a')](_0x983944['body'],{'showHidden':![],'depth':null}));}break;}return _0x41dc08;}})['then'](respondWithResult(_0x25434f,null))[_0x3363('0x28')](handleError(_0x25434f,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index a8b3d20..a92f445 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 _0xf532=['hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x51b210,_0x351ba0){var _0xe441e8=function(_0x27f7bc){while(--_0x27f7bc){_0x51b210['push'](_0x51b210['shift']());}};_0xe441e8(++_0x351ba0);}(_0xf532,0xa7));var _0x2f53=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0xf532[_0x3a9661];return _0x5bb119;};'use strict';var EventEmitter=require(_0x2f53('0x0'));var SmsMessage=require(_0x2f53('0x1'))['db'][_0x2f53('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x2f53('0x3')](0x0);var events={'afterCreate':_0x2f53('0x4'),'afterUpdate':_0x2f53('0x5'),'afterDestroy':_0x2f53('0x6')};function emitEvent(_0x112a0a){return function(_0x759fc6,_0x1d7064,_0x175c8c){SmsMessageEvents['emit'](_0x112a0a+':'+_0x759fc6['id'],_0x759fc6);SmsMessageEvents[_0x2f53('0x7')](_0x112a0a,_0x759fc6);_0x175c8c(null);};}for(var e in events){if(events[_0x2f53('0x8')](e)){var event=events[e];SmsMessage[_0x2f53('0x9')](e,emitEvent(event));}}module[_0x2f53('0xa')]=SmsMessageEvents; \ No newline at end of file +var _0xe29c=['events','../../mysqldb','SmsMessage','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x115ac5,_0x1dbaca){var _0x4e1327=function(_0xe61b38){while(--_0xe61b38){_0x115ac5['push'](_0x115ac5['shift']());}};_0x4e1327(++_0x1dbaca);}(_0xe29c,0xe8));var _0xce29=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe29c[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require(_0xce29('0x0'));var SmsMessage=require(_0xce29('0x1'))['db'][_0xce29('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xce29('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xce29('0x4')};function emitEvent(_0x17b06f){return function(_0x183a39,_0x44b054,_0x30d043){SmsMessageEvents[_0xce29('0x5')](_0x17b06f+':'+_0x183a39['id'],_0x183a39);SmsMessageEvents['emit'](_0x17b06f,_0x183a39);_0x30d043(null);};}for(var e in events){if(events[_0xce29('0x6')](e)){var event=events[e];SmsMessage[_0xce29('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index af8465d..2e9dfe9 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 _0x7b32=['createdAt','catch','error','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','body','phone','/api/sms/messages/','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','password','smsMethod','sender','&password=','GET','split','POST','total_sent','internal_order_id','deliveryReport','read','skebby','connectel','senderString','requestid','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','data','queued_count','clickSend','Missing\x20parameters:\x20username,\x20password','authId','remote','https://api.plivo.com/v1/Account/%s/Message/','base64','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','sort','length','apiKey','createHash','digest','hex','/external/get/send.php?','keys','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','Missing\x20parameters:\x20apiKey','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','utf8mb4_unicode_ci','util','../../config/logger','api','request-promise','path','rimraf','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','FULLTEXT','direction','toLowerCase','out','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then'];(function(_0x209dc2,_0x316e1d){var _0x3ace33=function(_0x16ea3b){while(--_0x16ea3b){_0x209dc2['push'](_0x209dc2['shift']());}};_0x3ace33(++_0x316e1d);}(_0x7b32,0x12f));var _0x27b3=function(_0x57ebb0,_0x13243e){_0x57ebb0=_0x57ebb0-0x0;var _0x369709=_0x7b32[_0x57ebb0];return _0x369709;};'use strict';var _=require('lodash');var util=require(_0x27b3('0x0'));var logger=require(_0x27b3('0x1'))(_0x27b3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x27b3('0x3'));var fs=require('fs');var path=require(_0x27b3('0x4'));var rimraf=require(_0x27b3('0x5'));var config=require('../../config/environment');var attributes=require(_0x27b3('0x6'));module['exports']=function(_0xdda597,_0x414ad3){return _0xdda597[_0x27b3('0x7')](_0x27b3('0x8'),attributes,{'tableName':_0x27b3('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x27b3('0xa')]},{'name':'fti_sms_messages','fields':['body'],'type':_0x27b3('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a64c8,_0x3fd6a8,_0x182d41){var _0x453465=_0xdda597['models'];var _0x52fe50=_0x3a64c8['get']({'plain':!![]});if(_0x52fe50[_0x27b3('0xc')][_0x27b3('0xd')]()==='in'||_0x52fe50[_0x27b3('0xc')][_0x27b3('0xd')]()===_0x27b3('0xe')&&!_0x52fe50['secret']&&!_[_0x27b3('0xf')](_0x52fe50[_0x27b3('0x10')])){_0x453465[_0x27b3('0x11')][_0x27b3('0x12')]({'where':{'id':_0x52fe50[_0x27b3('0x13')]}})[_0x27b3('0x14')](function(_0x2d99b1){if(_0x2d99b1){_0x2d99b1['update']({'lastMsgAt':_0x52fe50[_0x27b3('0x15')],'lastMsgDirection':_0x52fe50['direction'][_0x27b3('0xd')]()});}})[_0x27b3('0x16')](function(_0x288ad2){console[_0x27b3('0x17')](_0x288ad2);});}if(_0x52fe50[_0x27b3('0xc')]===_0x27b3('0xe')&&!_0x52fe50[_0x27b3('0x18')]){var _0x4d245a;_0x453465[_0x27b3('0x19')][_0x27b3('0x1a')]({'where':{'id':_0x52fe50[_0x27b3('0x1b')]},'raw':!![]})[_0x27b3('0x14')](function(_0x5f51f9){_0x4d245a=_0x5f51f9;if(_0x4d245a&&_0x4d245a[_0x27b3('0x1c')]){switch(_0x4d245a[_0x27b3('0x1c')]){case _0x27b3('0x1d'):var _0x154310=require(_0x27b3('0x1d'));if(_0x4d245a[_0x27b3('0x1e')]&&_0x4d245a['authToken']&&_0x4d245a['phone']){var _0x4cd75f=new _0x154310(_0x4d245a[_0x27b3('0x1e')],_0x4d245a[_0x27b3('0x1f')]);_0x4cd75f[_0x27b3('0x20')]['create']({'body':_0x52fe50[_0x27b3('0x21')],'to':_0x52fe50['phone'],'from':_0x4d245a[_0x27b3('0x22')],'statusCallback':_0x4d245a['remote']+_0x27b3('0x23')+_0x52fe50['id']+_0x27b3('0x24')+_0x4d245a[_0x27b3('0x25')]})['then'](function(_0x3bc80c){if(_0x3bc80c[_0x27b3('0x26')]){return _0x3a64c8[_0x27b3('0x27')]({'messageId':_0x3bc80c[_0x27b3('0x26')]});}})[_0x27b3('0x16')](function(_0x1c269d){logger['error'](_0x27b3('0x28'),_0x27b3('0x29'),_0x27b3('0x1d'),util[_0x27b3('0x2a')](_0x1c269d,{'showHidden':![],'depth':null}));});}else{logger[_0x27b3('0x17')](_0x27b3('0x28'),_0x27b3('0x29'),_0x27b3('0x1d'),_0x27b3('0x2b'));}break;case'skebby':var _0x41d3be='https://api.skebby.it/API/v1.0/REST/';if(_0x4d245a[_0x27b3('0x2c')]&&_0x4d245a[_0x27b3('0x2d')]){var _0x59079b={'recipient':[_0x52fe50[_0x27b3('0x22')]],'message':_0x52fe50[_0x27b3('0x21')],'message_type':_0x4d245a['smsMethod']};if(_0x4d245a[_0x27b3('0x2e')]&&_0x4d245a[_0x27b3('0x2e')]!=='SI'){_0x59079b[_0x27b3('0x2f')]=_0x4d245a[_0x27b3('0x22')];}var _0xf43876={'url':_0x41d3be+'login?username='+_0x4d245a[_0x27b3('0x2c')]+_0x27b3('0x30')+_0x4d245a['password'],'method':_0x27b3('0x31')};rp(_0xf43876)[_0x27b3('0x14')](function(_0x22a6e4){var _0xca43ac=_0x22a6e4[_0x27b3('0x32')](';');var _0xcccabc={'user_key':_0xca43ac[0x0],'session_key':_0xca43ac[0x1]};_0xf43876={'url':_0x41d3be+'sms','method':_0x27b3('0x33'),'headers':{'user_key':_0xcccabc['user_key'],'Session_key':_0xcccabc['session_key']},'json':!![],'body':_0x59079b};return rp(_0xf43876);})['then'](function(_0x1e6ad9){if(_0x1e6ad9[_0x27b3('0x34')]>=0x1){var _0x2f8106={'messageId':_0x1e6ad9[_0x27b3('0x35')]};if(_0x4d245a['smsMethod']!=='GP'||!_0x4d245a[_0x27b3('0x36')]){_0x2f8106[_0x27b3('0x37')]=!![];}return _0x3a64c8[_0x27b3('0x27')](_0x2f8106);}else{return logger[_0x27b3('0x17')](_0x27b3('0x28'),'afterCreate','skebby',util[_0x27b3('0x2a')](_0x1e6ad9,{'showHidden':![],'depth':null}));}})[_0x27b3('0x16')](function(_0x134a28){return logger[_0x27b3('0x17')](_0x27b3('0x28'),_0x27b3('0x29'),_0x27b3('0x38'),util['inspect'](_0x134a28,{'showHidden':![],'depth':null}));});}else{logger[_0x27b3('0x17')](_0x27b3('0x28'),'afterCreate',_0x27b3('0x38'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x27b3('0x39'):if(_0x4d245a[_0x27b3('0x1f')]){var _0x5c7b9e={'recipient':_0x52fe50['phone'],'message':_0x52fe50[_0x27b3('0x21')],'sender':_0x4d245a[_0x27b3('0x3a')]||_0x4d245a[_0x27b3('0x22')],'authorization':_0x4d245a[_0x27b3('0x1f')]};var _0x3fd6a8={'method':_0x27b3('0x33'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x5c7b9e,'json':!![]};rp(_0x3fd6a8)[_0x27b3('0x14')](function(_0x1c835c){var _0xafedb4={'messageId':_0x1c835c[_0x27b3('0x3b')]};if(!_0x4d245a['deliveryReport']){_0xafedb4[_0x27b3('0x37')]=!![];}return _0x3a64c8['update'](_0xafedb4);})[_0x27b3('0x16')](function(_0x2d0ca4){logger[_0x27b3('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x27b3('0x29'),_0x27b3('0x39'),util['inspect'](_0x2d0ca4,{'showHidden':![],'depth':null}));});}else{logger[_0x27b3('0x17')](_0x27b3('0x28'),'afterCreate','connectel','Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x4d245a[_0x27b3('0x2c')]&&_0x4d245a[_0x27b3('0x2d')]){var _0x5c7b9e={'messages':[{'source':_0x27b3('0x3c'),'to':_0x52fe50['phone'],'body':_0x52fe50[_0x27b3('0x21')],'from':_0x4d245a['senderString']||_0x4d245a[_0x27b3('0x22')]}]};var _0xee1a66=util[_0x27b3('0x3d')](_0x27b3('0x3e'),_0x4d245a['username'],_0x4d245a[_0x27b3('0x2d')]);var _0x3fd6a8={'method':'POST','uri':_0x27b3('0x3f'),'body':_0x5c7b9e,'headers':{'Authorization':util[_0x27b3('0x3d')](_0x27b3('0x40'),new Buffer(_0xee1a66)[_0x27b3('0x41')]('base64'))},'json':!![]};rp(_0x3fd6a8)[_0x27b3('0x14')](function(_0x252fbb){if(_0x252fbb['http_code']>=0xc8&&_0x252fbb['http_code']<=0xce){if(_0x252fbb[_0x27b3('0x42')]&&_0x252fbb['data'][_0x27b3('0x43')]>0x0){var _0x508c42=_['head'](_0x252fbb[_0x27b3('0x42')][_0x27b3('0x20')]);var _0x4bc27c={'messageId':_0x508c42['message_id']};if(!_0x4d245a[_0x27b3('0x36')]){_0x4bc27c[_0x27b3('0x37')]=!![];}return _0x3a64c8[_0x27b3('0x27')](_0x4bc27c);}else{logger[_0x27b3('0x17')](_0x27b3('0x28'),_0x27b3('0x29'),_0x27b3('0x44'),util[_0x27b3('0x2a')](_0x252fbb,{'showHidden':![],'depth':null}));}}else{logger[_0x27b3('0x17')](_0x27b3('0x28'),_0x27b3('0x29'),_0x27b3('0x44'),util[_0x27b3('0x2a')](_0x252fbb,{'showHidden':![],'depth':null}));}})[_0x27b3('0x16')](function(_0x21fb40){logger['error'](_0x27b3('0x28'),_0x27b3('0x29'),_0x27b3('0x44'),util[_0x27b3('0x2a')](_0x21fb40,{'showHidden':![],'depth':null}));});}else{logger[_0x27b3('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x27b3('0x29'),_0x27b3('0x44'),_0x27b3('0x45'));}break;case'plivo':if(_0x4d245a[_0x27b3('0x46')]&&_0x4d245a[_0x27b3('0x1f')]){var _0x5c7b9e={'dst':_0x52fe50[_0x27b3('0x22')],'text':_0x52fe50['body'],'src':_0x4d245a[_0x27b3('0x3a')]||_0x4d245a[_0x27b3('0x22')],'url':_0x4d245a[_0x27b3('0x47')]+_0x27b3('0x23')+_0x52fe50['id']+_0x27b3('0x24')+_0x4d245a['token']};var _0xee1a66=util['format'](_0x27b3('0x3e'),_0x4d245a[_0x27b3('0x46')],_0x4d245a['authToken']);var _0x3fd6a8={'method':_0x27b3('0x33'),'uri':util[_0x27b3('0x3d')](_0x27b3('0x48'),_0x4d245a[_0x27b3('0x46')]),'body':_0x5c7b9e,'headers':{'Authorization':util[_0x27b3('0x3d')](_0x27b3('0x40'),new Buffer(_0xee1a66)['toString'](_0x27b3('0x49')))},'json':!![]};rp(_0x3fd6a8)[_0x27b3('0x14')](function(_0x498701){var _0x2c1ec7={'messageId':_0x498701['message_uuid'][0x0]};return _0x3a64c8[_0x27b3('0x27')](_0x2c1ec7);})[_0x27b3('0x16')](function(_0x5575da){logger[_0x27b3('0x17')](_0x27b3('0x28'),'afterCreate','plivo',util[_0x27b3('0x2a')](_0x5575da,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x27b3('0x28'),'afterCreate','plivo',_0x27b3('0x4a'));}break;case'infobip':if(_0x4d245a[_0x27b3('0x2c')]&&_0x4d245a['password']){if(_0x4d245a[_0x27b3('0x4b')]){var _0x2d8cdc={'method':_0x27b3('0x33'),'uri':_0x4d245a[_0x27b3('0x4b')]+'/auth/1/session','body':{'username':_0x4d245a[_0x27b3('0x2c')],'password':_0x4d245a['password']},'json':!![]};return rp(_0x2d8cdc)[_0x27b3('0x14')](function(_0x567d69){var _0x57caae={'method':_0x27b3('0x33'),'uri':_0x4d245a[_0x27b3('0x4b')]+_0x27b3('0x4c'),'body':{'messages':[{'from':_0x4d245a[_0x27b3('0x22')],'destinations':[{'to':_0x52fe50[_0x27b3('0x22')]}],'text':_0x52fe50[_0x27b3('0x21')],'notifyUrl':_0x4d245a[_0x27b3('0x47')]+_0x27b3('0x23')+_0x52fe50['id']+_0x27b3('0x24')+_0x4d245a['token'],'notifyContentType':_0x27b3('0x4d'),'callbackData':_0x4d245a[_0x27b3('0x22')]+';'+_0x52fe50['body']}]},'headers':{'Authorization':_0x27b3('0x4e')+_0x567d69[_0x27b3('0x25')]},'json':!![]};return rp(_0x57caae)[_0x27b3('0x14')](function(_0x2228a6){if(_0x2228a6[_0x27b3('0x20')]){var _0x5c0f26={'messageId':_0x2228a6[_0x27b3('0x20')][0x0][_0x27b3('0xa')]};if(!_0x4d245a[_0x27b3('0x36')]){_0x5c0f26[_0x27b3('0x37')]=!![];}return _0x3a64c8[_0x27b3('0x27')](_0x5c0f26);}else{return logger[_0x27b3('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x27b3('0x29'),_0x27b3('0x4f'),util[_0x27b3('0x2a')](_0x2228a6,{'showHidden':![],'depth':null}));}});})[_0x27b3('0x16')](function(_0x367058){return logger[_0x27b3('0x17')](_0x27b3('0x28'),_0x27b3('0x29'),_0x27b3('0x4f'),util[_0x27b3('0x2a')](_0x367058,{'showHidden':![],'depth':null}));});}else{logger[_0x27b3('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x27b3('0x4f'),_0x27b3('0x50'));}}else{logger[_0x27b3('0x17')](_0x27b3('0x28'),_0x27b3('0x29'),'infobip',_0x27b3('0x45'));}break;case _0x27b3('0x51'):var _0x41006a=require(_0x27b3('0x52'));if(_0x4d245a['apiKey']){var _0x3c205d={};_0x3c205d[_0x27b3('0x53')]=_0x4d245a[_0x27b3('0x2c')];_0x3c205d[_0x27b3('0x22')]=_0x52fe50[_0x27b3('0x22')];_0x3c205d['sender']=_0x4d245a[_0x27b3('0x22')];_0x3c205d[_0x27b3('0x54')]=_0x52fe50['body'];_0x3c205d[_0x27b3('0x55')]=+new Date();var _0x360dba='';var _0x211fb2='';var _0x3ede9b=Object['keys'](_0x3c205d);_0x3ede9b[_0x27b3('0x56')]();for(var _0xd6b331=0x0;_0xd6b331<_0x3ede9b[_0x27b3('0x57')];_0xd6b331++){if(_0x360dba!=''){_0x360dba+='&';}_0x360dba+=_0x3ede9b[_0xd6b331]+'='+encodeURIComponent(_0x3c205d[_0x3ede9b[_0xd6b331]]);_0x211fb2+=_0x3c205d[_0x3ede9b[_0xd6b331]];}_0x211fb2+=_0x4d245a[_0x27b3('0x58')];_0x211fb2=_0x41006a[_0x27b3('0x59')]('md5')['update'](_0x211fb2)[_0x27b3('0x5a')](_0x27b3('0x5b'));if(_0x360dba!==''){_0x360dba+='&';}_0x360dba+='signature='+_0x211fb2;var _0xf43876={'method':_0x27b3('0x31'),'uri':_0x4d245a[_0x27b3('0x4b')]+_0x27b3('0x5c')+_0x360dba,'json':!![]};return rp(_0xf43876)[_0x27b3('0x14')](function(_0x505bfd){var _0x2e43d6=Object[_0x27b3('0x5d')](_0x505bfd);if(_0x505bfd[_0x2e43d6[0x0]][_0x27b3('0x17')]&&parseInt(_0x505bfd[_0x2e43d6[0x0]][_0x27b3('0x17')])===0x0){var _0x2d6dea={'messageId':_0x505bfd[_0x2e43d6[0x0]][_0x27b3('0x5e')]};if(!_0x4d245a[_0x27b3('0x36')]){_0x2d6dea[_0x27b3('0x37')]=!![];}return _0x3a64c8[_0x27b3('0x27')](_0x2d6dea);}else{return logger[_0x27b3('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','csc',util[_0x27b3('0x2a')](_0x505bfd[_0x27b3('0x17')],{'showHidden':![],'depth':null}));}})[_0x27b3('0x16')](function(_0x58da6c){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x27b3('0x29'),_0x27b3('0x51'),util[_0x27b3('0x2a')](_0x58da6c,{'showHidden':![],'depth':null}));});}else{logger[_0x27b3('0x17')](_0x27b3('0x28'),'afterCreate','csc','Missing\x20parameters:\x20apiKey');}break;case _0x27b3('0x5f'):if(_0x4d245a['apiKey']){var _0x25a584={'method':_0x27b3('0x33'),'uri':_0x27b3('0x60'),'headers':{'Authorization':_0x4d245a[_0x27b3('0x58')]},'body':{'content':_0x52fe50['body'],'to':[_0x52fe50[_0x27b3('0x22')]],'from':_0x4d245a[_0x27b3('0x22')],'binary':![],'clientMessageId':_0x27b3('0x61'),'charset':'UTF-8'},'json':!![]};rp(_0x25a584)[_0x27b3('0x14')](function(_0x48a6ec){if(!_0x48a6ec[_0x27b3('0x17')]){var _0x5b4bb8={'messageId':_0x48a6ec[_0x27b3('0x20')][0x0]['apiMessageId']};if(!_0x4d245a[_0x27b3('0x36')]){_0x5b4bb8[_0x27b3('0x37')]=!![];}return _0x3a64c8[_0x27b3('0x27')](_0x5b4bb8);}else{return logger[_0x27b3('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x27b3('0x29'),_0x27b3('0x5f'),util[_0x27b3('0x2a')](_0x48a6ec[_0x27b3('0x17')],{'showHidden':![],'depth':null}));}})[_0x27b3('0x16')](function(_0x3912a0){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x27b3('0x29'),_0x27b3('0x5f'),util[_0x27b3('0x2a')](_0x3912a0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x27b3('0x28'),'afterCreate',_0x27b3('0x5f'),_0x27b3('0x62'));}break;case _0x27b3('0x63'):if(_0x4d245a[_0x27b3('0x58')]){var _0x393abd={};var _0xf43876={'method':_0x27b3('0x33'),'uri':_0x27b3('0x64'),'headers':{'Authorization':_0x27b3('0x65')+_0x4d245a[_0x27b3('0x58')],'Content-Type':'application/json'},'body':{'from':_0x4d245a[_0x27b3('0x22')],'to':_0x52fe50[_0x27b3('0x22')],'text':_0x52fe50['body']},'json':!![]};return rp(_0xf43876)[_0x27b3('0x14')](function(_0x252597){if(_0x252597['code']==0xca){_0x393abd[_0x27b3('0x66')]=_0x252597;var _0x348271={'method':_0x27b3('0x33'),'uri':_0x27b3('0x67'),'headers':{'Authorization':_0x27b3('0x65')+_0x4d245a[_0x27b3('0x58')],'Content-Type':_0x27b3('0x4d')},'body':{'refid':_0x393abd[_0x27b3('0x66')][_0x27b3('0x68')]},'json':!![]};return rp(_0x348271)[_0x27b3('0x14')](function(_0x454d79){_0x393abd[_0x27b3('0x69')]=_0x454d79;var _0x1b39d0={'messageId':_0x393abd[_0x27b3('0x66')][_0x27b3('0x68')],'read':!![]};return _0x3a64c8[_0x27b3('0x27')](_0x1b39d0);});}else{return logger['error'](_0x27b3('0x28'),_0x27b3('0x29'),'intelepeer',util[_0x27b3('0x2a')](_0x252597,{'showHidden':![],'depth':null}));}})[_0x27b3('0x16')](function(_0x482daf){return logger[_0x27b3('0x17')](_0x27b3('0x28'),_0x27b3('0x29'),_0x27b3('0x63'),util[_0x27b3('0x2a')](_0x482daf,{'showHidden':![],'depth':null}));});}else{return logger[_0x27b3('0x17')](_0x27b3('0x28'),_0x27b3('0x29'),_0x27b3('0x63'),_0x27b3('0x6a'));}break;}}})['finally'](function(){_0x182d41();});}else{_0x182d41();}}},'charset':'utf8mb4','collate':_0x27b3('0x6b')});}; \ No newline at end of file +var _0x850f=['sender','&password=','GET','split','sms','POST','user_key','session_key','total_sent','deliveryReport','read','skebby','inspect','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','senderString','/status?token=','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/sms/2/text/advanced','/api/sms/messages/','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','sort','length','createHash','digest','hex','signature=','/external/get/send.php?','keys','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','Missing\x20parameters:\x20apiKey','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','SmsInteraction','findOne','SmsInteractionId','then','createdAt','catch','SmsAccount','find','type','accountSid','authToken','phone','create','remote','update','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod'];(function(_0x40db01,_0x5d505d){var _0x32c5fd=function(_0x564ee5){while(--_0x564ee5){_0x40db01['push'](_0x40db01['shift']());}};_0x32c5fd(++_0x5d505d);}(_0x850f,0xc4));var _0xf850=function(_0x2312d1,_0x367145){_0x2312d1=_0x2312d1-0x0;var _0x4889ab=_0x850f[_0x2312d1];return _0x4889ab;};'use strict';var _=require(_0xf850('0x0'));var util=require('util');var logger=require(_0xf850('0x1'))('api');var moment=require(_0xf850('0x2'));var BPromise=require('bluebird');var rp=require(_0xf850('0x3'));var fs=require('fs');var path=require(_0xf850('0x4'));var rimraf=require(_0xf850('0x5'));var config=require(_0xf850('0x6'));var attributes=require(_0xf850('0x7'));module[_0xf850('0x8')]=function(_0xb42f89,_0x245373){return _0xb42f89[_0xf850('0x9')](_0xf850('0xa'),attributes,{'tableName':_0xf850('0xb'),'paranoid':![],'indexes':[{'name':_0xf850('0xc'),'fields':[_0xf850('0xc')]},{'name':_0xf850('0xd'),'fields':[_0xf850('0xe')],'type':_0xf850('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x33e071,_0x4484c8,_0x4c1497){var _0x2ae84c=_0xb42f89[_0xf850('0x10')];var _0x2500ee=_0x33e071[_0xf850('0x11')]({'plain':!![]});if(_0x2500ee['direction']['toLowerCase']()==='in'||_0x2500ee[_0xf850('0x12')][_0xf850('0x13')]()===_0xf850('0x14')&&!_0x2500ee[_0xf850('0x15')]&&!_[_0xf850('0x16')](_0x2500ee['UserId'])){_0x2ae84c[_0xf850('0x17')][_0xf850('0x18')]({'where':{'id':_0x2500ee[_0xf850('0x19')]}})[_0xf850('0x1a')](function(_0x4d9e0f){if(_0x4d9e0f){_0x4d9e0f['update']({'lastMsgAt':_0x2500ee[_0xf850('0x1b')],'lastMsgDirection':_0x2500ee[_0xf850('0x12')][_0xf850('0x13')]()});}})[_0xf850('0x1c')](function(_0x3df912){console['error'](_0x3df912);});}if(_0x2500ee[_0xf850('0x12')]===_0xf850('0x14')&&!_0x2500ee[_0xf850('0x15')]){var _0x594e90;_0x2ae84c[_0xf850('0x1d')][_0xf850('0x1e')]({'where':{'id':_0x2500ee['SmsAccountId']},'raw':!![]})[_0xf850('0x1a')](function(_0x35df94){_0x594e90=_0x35df94;if(_0x594e90&&_0x594e90[_0xf850('0x1f')]){switch(_0x594e90[_0xf850('0x1f')]){case'twilio':var _0x458ae4=require('twilio');if(_0x594e90[_0xf850('0x20')]&&_0x594e90[_0xf850('0x21')]&&_0x594e90[_0xf850('0x22')]){var _0xa0b7fb=new _0x458ae4(_0x594e90[_0xf850('0x20')],_0x594e90['authToken']);_0xa0b7fb['messages'][_0xf850('0x23')]({'body':_0x2500ee['body'],'to':_0x2500ee[_0xf850('0x22')],'from':_0x594e90[_0xf850('0x22')],'statusCallback':_0x594e90[_0xf850('0x24')]+'/api/sms/messages/'+_0x2500ee['id']+'/status?token='+_0x594e90['token']})['then'](function(_0x4ab6b7){if(_0x4ab6b7['sid']){return _0x33e071[_0xf850('0x25')]({'messageId':_0x4ab6b7[_0xf850('0x26')]});}})[_0xf850('0x1c')](function(_0x2d8bc9){logger[_0xf850('0x27')](_0xf850('0x28'),_0xf850('0x29'),_0xf850('0x2a'),util['inspect'](_0x2d8bc9,{'showHidden':![],'depth':null}));});}else{logger[_0xf850('0x27')](_0xf850('0x28'),_0xf850('0x29'),_0xf850('0x2a'),_0xf850('0x2b'));}break;case'skebby':var _0x23b09f=_0xf850('0x2c');if(_0x594e90[_0xf850('0x2d')]&&_0x594e90[_0xf850('0x2e')]){var _0x3d9c3e={'recipient':[_0x2500ee[_0xf850('0x22')]],'message':_0x2500ee['body'],'message_type':_0x594e90[_0xf850('0x2f')]};if(_0x594e90[_0xf850('0x2f')]&&_0x594e90['smsMethod']!=='SI'){_0x3d9c3e[_0xf850('0x30')]=_0x594e90[_0xf850('0x22')];}var _0x4d0274={'url':_0x23b09f+'login?username='+_0x594e90[_0xf850('0x2d')]+_0xf850('0x31')+_0x594e90['password'],'method':_0xf850('0x32')};rp(_0x4d0274)['then'](function(_0x51c101){var _0x2047c5=_0x51c101[_0xf850('0x33')](';');var _0x235f23={'user_key':_0x2047c5[0x0],'session_key':_0x2047c5[0x1]};_0x4d0274={'url':_0x23b09f+_0xf850('0x34'),'method':_0xf850('0x35'),'headers':{'user_key':_0x235f23[_0xf850('0x36')],'Session_key':_0x235f23[_0xf850('0x37')]},'json':!![],'body':_0x3d9c3e};return rp(_0x4d0274);})[_0xf850('0x1a')](function(_0x3241d2){if(_0x3241d2[_0xf850('0x38')]>=0x1){var _0x25c54a={'messageId':_0x3241d2['internal_order_id']};if(_0x594e90[_0xf850('0x2f')]!=='GP'||!_0x594e90[_0xf850('0x39')]){_0x25c54a[_0xf850('0x3a')]=!![];}return _0x33e071['update'](_0x25c54a);}else{return logger[_0xf850('0x27')](_0xf850('0x28'),_0xf850('0x29'),_0xf850('0x3b'),util[_0xf850('0x3c')](_0x3241d2,{'showHidden':![],'depth':null}));}})[_0xf850('0x1c')](function(_0x26fe53){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf850('0x29'),_0xf850('0x3b'),util[_0xf850('0x3c')](_0x26fe53,{'showHidden':![],'depth':null}));});}else{logger[_0xf850('0x27')](_0xf850('0x28'),_0xf850('0x29'),_0xf850('0x3b'),_0xf850('0x3d'));}break;case _0xf850('0x3e'):if(_0x594e90[_0xf850('0x21')]){var _0x3d9fdc={'recipient':_0x2500ee['phone'],'message':_0x2500ee[_0xf850('0xe')],'sender':_0x594e90['senderString']||_0x594e90[_0xf850('0x22')],'authorization':_0x594e90[_0xf850('0x21')]};var _0x4484c8={'method':'POST','uri':_0xf850('0x3f'),'body':_0x3d9fdc,'json':!![]};rp(_0x4484c8)['then'](function(_0x1b83fc){var _0x48b23={'messageId':_0x1b83fc[_0xf850('0x40')]};if(!_0x594e90[_0xf850('0x39')]){_0x48b23[_0xf850('0x3a')]=!![];}return _0x33e071[_0xf850('0x25')](_0x48b23);})[_0xf850('0x1c')](function(_0x46a34a){logger[_0xf850('0x27')](_0xf850('0x28'),'afterCreate',_0xf850('0x3e'),util[_0xf850('0x3c')](_0x46a34a,{'showHidden':![],'depth':null}));});}else{logger[_0xf850('0x27')](_0xf850('0x28'),_0xf850('0x29'),_0xf850('0x3e'),_0xf850('0x41'));}break;case _0xf850('0x42'):if(_0x594e90[_0xf850('0x2d')]&&_0x594e90[_0xf850('0x2e')]){var _0x3d9fdc={'messages':[{'source':_0xf850('0x43'),'to':_0x2500ee[_0xf850('0x22')],'body':_0x2500ee['body'],'from':_0x594e90['senderString']||_0x594e90['phone']}]};var _0x3b9107=util[_0xf850('0x44')](_0xf850('0x45'),_0x594e90['username'],_0x594e90[_0xf850('0x2e')]);var _0x4484c8={'method':_0xf850('0x35'),'uri':_0xf850('0x46'),'body':_0x3d9fdc,'headers':{'Authorization':util[_0xf850('0x44')]('Basic\x20%s',new Buffer(_0x3b9107)[_0xf850('0x47')](_0xf850('0x48')))},'json':!![]};rp(_0x4484c8)[_0xf850('0x1a')](function(_0x18dd18){if(_0x18dd18[_0xf850('0x49')]>=0xc8&&_0x18dd18['http_code']<=0xce){if(_0x18dd18[_0xf850('0x4a')]&&_0x18dd18[_0xf850('0x4a')][_0xf850('0x4b')]>0x0){var _0x29f5f0=_[_0xf850('0x4c')](_0x18dd18['data'][_0xf850('0x4d')]);var _0x2d65a3={'messageId':_0x29f5f0[_0xf850('0x4e')]};if(!_0x594e90[_0xf850('0x39')]){_0x2d65a3[_0xf850('0x3a')]=!![];}return _0x33e071[_0xf850('0x25')](_0x2d65a3);}else{logger['error'](_0xf850('0x28'),_0xf850('0x29'),_0xf850('0x4f'),util[_0xf850('0x3c')](_0x18dd18,{'showHidden':![],'depth':null}));}}else{logger[_0xf850('0x27')](_0xf850('0x28'),_0xf850('0x29'),_0xf850('0x4f'),util['inspect'](_0x18dd18,{'showHidden':![],'depth':null}));}})['catch'](function(_0x87a7db){logger[_0xf850('0x27')](_0xf850('0x28'),'afterCreate',_0xf850('0x4f'),util[_0xf850('0x3c')](_0x87a7db,{'showHidden':![],'depth':null}));});}else{logger[_0xf850('0x27')](_0xf850('0x28'),_0xf850('0x29'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case _0xf850('0x50'):if(_0x594e90['authId']&&_0x594e90[_0xf850('0x21')]){var _0x3d9fdc={'dst':_0x2500ee['phone'],'text':_0x2500ee[_0xf850('0xe')],'src':_0x594e90[_0xf850('0x51')]||_0x594e90[_0xf850('0x22')],'url':_0x594e90[_0xf850('0x24')]+'/api/sms/messages/'+_0x2500ee['id']+_0xf850('0x52')+_0x594e90['token']};var _0x3b9107=util['format'](_0xf850('0x45'),_0x594e90[_0xf850('0x53')],_0x594e90['authToken']);var _0x4484c8={'method':'POST','uri':util['format'](_0xf850('0x54'),_0x594e90['authId']),'body':_0x3d9fdc,'headers':{'Authorization':util[_0xf850('0x44')](_0xf850('0x55'),new Buffer(_0x3b9107)['toString']('base64'))},'json':!![]};rp(_0x4484c8)[_0xf850('0x1a')](function(_0x202570){var _0x16a76e={'messageId':_0x202570['message_uuid'][0x0]};return _0x33e071[_0xf850('0x25')](_0x16a76e);})['catch'](function(_0x55c1e0){logger[_0xf850('0x27')](_0xf850('0x28'),_0xf850('0x29'),_0xf850('0x50'),util['inspect'](_0x55c1e0,{'showHidden':![],'depth':null}));});}else{logger[_0xf850('0x27')](_0xf850('0x28'),'afterCreate',_0xf850('0x50'),_0xf850('0x56'));}break;case'infobip':if(_0x594e90[_0xf850('0x2d')]&&_0x594e90['password']){if(_0x594e90[_0xf850('0x57')]){var _0x6f4c12={'method':_0xf850('0x35'),'uri':_0x594e90['baseUrl']+'/auth/1/session','body':{'username':_0x594e90[_0xf850('0x2d')],'password':_0x594e90[_0xf850('0x2e')]},'json':!![]};return rp(_0x6f4c12)[_0xf850('0x1a')](function(_0x4ce4cc){var _0x524a47={'method':_0xf850('0x35'),'uri':_0x594e90[_0xf850('0x57')]+_0xf850('0x58'),'body':{'messages':[{'from':_0x594e90['phone'],'destinations':[{'to':_0x2500ee[_0xf850('0x22')]}],'text':_0x2500ee[_0xf850('0xe')],'notifyUrl':_0x594e90[_0xf850('0x24')]+_0xf850('0x59')+_0x2500ee['id']+_0xf850('0x52')+_0x594e90['token'],'notifyContentType':_0xf850('0x5a'),'callbackData':_0x594e90[_0xf850('0x22')]+';'+_0x2500ee['body']}]},'headers':{'Authorization':_0xf850('0x5b')+_0x4ce4cc['token']},'json':!![]};return rp(_0x524a47)[_0xf850('0x1a')](function(_0x32551a){if(_0x32551a[_0xf850('0x4d')]){var _0x38a3bf={'messageId':_0x32551a['messages'][0x0]['messageId']};if(!_0x594e90[_0xf850('0x39')]){_0x38a3bf[_0xf850('0x3a')]=!![];}return _0x33e071[_0xf850('0x25')](_0x38a3bf);}else{return logger[_0xf850('0x27')](_0xf850('0x28'),_0xf850('0x29'),_0xf850('0x5c'),util[_0xf850('0x3c')](_0x32551a,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x30b9ba){return logger[_0xf850('0x27')](_0xf850('0x28'),_0xf850('0x29'),_0xf850('0x5c'),util[_0xf850('0x3c')](_0x30b9ba,{'showHidden':![],'depth':null}));});}else{logger[_0xf850('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf850('0x29'),_0xf850('0x5c'),_0xf850('0x5d'));}}else{logger[_0xf850('0x27')](_0xf850('0x28'),'afterCreate','infobip',_0xf850('0x3d'));}break;case _0xf850('0x5e'):var _0x3da1f0=require('crypto');if(_0x594e90[_0xf850('0x5f')]){var _0x4b2f43={};_0x4b2f43[_0xf850('0x60')]=_0x594e90['username'];_0x4b2f43[_0xf850('0x22')]=_0x2500ee[_0xf850('0x22')];_0x4b2f43['sender']=_0x594e90[_0xf850('0x22')];_0x4b2f43[_0xf850('0x61')]=_0x2500ee['body'];_0x4b2f43[_0xf850('0x62')]=+new Date();var _0x74ddaa='';var _0x1c217d='';var _0x512018=Object['keys'](_0x4b2f43);_0x512018[_0xf850('0x63')]();for(var _0x37742f=0x0;_0x37742f<_0x512018[_0xf850('0x64')];_0x37742f++){if(_0x74ddaa!=''){_0x74ddaa+='&';}_0x74ddaa+=_0x512018[_0x37742f]+'='+encodeURIComponent(_0x4b2f43[_0x512018[_0x37742f]]);_0x1c217d+=_0x4b2f43[_0x512018[_0x37742f]];}_0x1c217d+=_0x594e90['apiKey'];_0x1c217d=_0x3da1f0[_0xf850('0x65')]('md5')['update'](_0x1c217d)[_0xf850('0x66')](_0xf850('0x67'));if(_0x74ddaa!==''){_0x74ddaa+='&';}_0x74ddaa+=_0xf850('0x68')+_0x1c217d;var _0x4d0274={'method':_0xf850('0x32'),'uri':_0x594e90[_0xf850('0x57')]+_0xf850('0x69')+_0x74ddaa,'json':!![]};return rp(_0x4d0274)['then'](function(_0x36c05f){var _0xd67dc6=Object[_0xf850('0x6a')](_0x36c05f);if(_0x36c05f[_0xd67dc6[0x0]]['error']&&parseInt(_0x36c05f[_0xd67dc6[0x0]][_0xf850('0x27')])===0x0){var _0x237bfe={'messageId':_0x36c05f[_0xd67dc6[0x0]][_0xf850('0x6b')]};if(!_0x594e90['deliveryReport']){_0x237bfe[_0xf850('0x3a')]=!![];}return _0x33e071[_0xf850('0x25')](_0x237bfe);}else{return logger[_0xf850('0x27')](_0xf850('0x28'),_0xf850('0x29'),'csc',util[_0xf850('0x3c')](_0x36c05f[_0xf850('0x27')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x10f658){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf850('0x29'),_0xf850('0x5e'),util[_0xf850('0x3c')](_0x10f658,{'showHidden':![],'depth':null}));});}else{logger[_0xf850('0x27')](_0xf850('0x28'),_0xf850('0x29'),_0xf850('0x5e'),'Missing\x20parameters:\x20apiKey');}break;case _0xf850('0x6c'):if(_0x594e90[_0xf850('0x5f')]){var _0x592bea={'method':_0xf850('0x35'),'uri':_0xf850('0x6d'),'headers':{'Authorization':_0x594e90[_0xf850('0x5f')]},'body':{'content':_0x2500ee[_0xf850('0xe')],'to':[_0x2500ee[_0xf850('0x22')]],'from':_0x594e90[_0xf850('0x22')],'binary':![],'clientMessageId':_0xf850('0x6e'),'charset':_0xf850('0x6f')},'json':!![]};rp(_0x592bea)['then'](function(_0x1f2325){if(!_0x1f2325[_0xf850('0x27')]){var _0x58d79a={'messageId':_0x1f2325[_0xf850('0x4d')][0x0]['apiMessageId']};if(!_0x594e90[_0xf850('0x39')]){_0x58d79a['read']=!![];}return _0x33e071['update'](_0x58d79a);}else{return logger[_0xf850('0x27')](_0xf850('0x28'),_0xf850('0x29'),_0xf850('0x6c'),util[_0xf850('0x3c')](_0x1f2325[_0xf850('0x27')],{'showHidden':![],'depth':null}));}})[_0xf850('0x1c')](function(_0x69094a){return logger['error'](_0xf850('0x28'),_0xf850('0x29'),'clickatell',util['inspect'](_0x69094a,{'showHidden':![],'depth':null}));});}else{logger[_0xf850('0x27')](_0xf850('0x28'),_0xf850('0x29'),_0xf850('0x6c'),_0xf850('0x70'));}break;case _0xf850('0x71'):if(_0x594e90['apiKey']){var _0x128a35={};var _0x4d0274={'method':_0xf850('0x35'),'uri':_0xf850('0x72'),'headers':{'Authorization':'Bearer\x20'+_0x594e90[_0xf850('0x5f')],'Content-Type':_0xf850('0x5a')},'body':{'from':_0x594e90['phone'],'to':_0x2500ee[_0xf850('0x22')],'text':_0x2500ee[_0xf850('0xe')]},'json':!![]};return rp(_0x4d0274)['then'](function(_0x7065fa){if(_0x7065fa[_0xf850('0x73')]==0xca){_0x128a35[_0xf850('0x74')]=_0x7065fa;var _0xac9e6b={'method':_0xf850('0x35'),'uri':_0xf850('0x75'),'headers':{'Authorization':'Bearer\x20'+_0x594e90['apiKey'],'Content-Type':_0xf850('0x5a')},'body':{'refid':_0x128a35[_0xf850('0x74')][_0xf850('0x76')]},'json':!![]};return rp(_0xac9e6b)[_0xf850('0x1a')](function(_0x309f5c){_0x128a35[_0xf850('0x77')]=_0x309f5c;var _0x4f39ba={'messageId':_0x128a35[_0xf850('0x74')][_0xf850('0x76')],'read':!![]};return _0x33e071['update'](_0x4f39ba);});}else{return logger[_0xf850('0x27')](_0xf850('0x28'),_0xf850('0x29'),_0xf850('0x71'),util[_0xf850('0x3c')](_0x7065fa,{'showHidden':![],'depth':null}));}})['catch'](function(_0x38a76c){return logger[_0xf850('0x27')](_0xf850('0x28'),_0xf850('0x29'),_0xf850('0x71'),util[_0xf850('0x3c')](_0x38a76c,{'showHidden':![],'depth':null}));});}else{return logger[_0xf850('0x27')](_0xf850('0x28'),_0xf850('0x29'),_0xf850('0x71'),_0xf850('0x78'));}break;}}})['finally'](function(){_0x4c1497();});}else{_0x4c1497();}}},'charset':'utf8mb4','collate':_0xf850('0x79')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index acdd61a..876b336 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 _0x5e2e=['CreateSmsMessage','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','create','body','options','raw'];(function(_0x2694e8,_0x261145){var _0x94e70b=function(_0x144a43){while(--_0x144a43){_0x2694e8['push'](_0x2694e8['shift']());}};_0x94e70b(++_0x261145);}(_0x5e2e,0xda));var _0xe5e2=function(_0x1d6355,_0x4418ee){_0x1d6355=_0x1d6355-0x0;var _0x17ebc6=_0x5e2e[_0x1d6355];return _0x17ebc6;};'use strict';var _=require(_0xe5e2('0x0'));var util=require(_0xe5e2('0x1'));var moment=require(_0xe5e2('0x2'));var BPromise=require('bluebird');var rs=require(_0xe5e2('0x3'));var fs=require('fs');var Redis=require(_0xe5e2('0x4'));var db=require(_0xe5e2('0x5'))['db'];var utils=require(_0xe5e2('0x6'));var logger=require(_0xe5e2('0x7'))(_0xe5e2('0x8'));var config=require('../../config/environment');var jayson=require(_0xe5e2('0x9'));var client=jayson['client'][_0xe5e2('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe5e2('0xb')],{'host':_0xe5e2('0xc'),'port':0x18eb});var socket=require(_0xe5e2('0xd'))(new Redis(config[_0xe5e2('0xb')]));require('./smsMessage.socket')[_0xe5e2('0xe')](socket);function respondWithRpcPromise(_0x4ce858,_0x2c7a15,_0x2fc2e0){return new BPromise(function(_0x4fe403,_0xbfd492){return client[_0xe5e2('0xf')](_0x4ce858,_0x2fc2e0)['then'](function(_0x5104fb){logger['info'](_0xe5e2('0x10'),_0x2c7a15,_0xe5e2('0x11'));logger[_0xe5e2('0x12')](_0xe5e2('0x13'),_0x2c7a15,_0xe5e2('0x11'),JSON[_0xe5e2('0x14')](_0x5104fb));if(_0x5104fb[_0xe5e2('0x15')]){if(_0x5104fb[_0xe5e2('0x15')][_0xe5e2('0x16')]===0x1f4){logger[_0xe5e2('0x15')]('SmsMessage,\x20%s,\x20%s',_0x2c7a15,_0x5104fb[_0xe5e2('0x15')][_0xe5e2('0x17')]);return _0xbfd492(_0x5104fb[_0xe5e2('0x15')][_0xe5e2('0x17')]);}logger[_0xe5e2('0x15')]('SmsMessage,\x20%s,\x20%s',_0x2c7a15,_0x5104fb[_0xe5e2('0x15')][_0xe5e2('0x17')]);return _0x4fe403(_0x5104fb[_0xe5e2('0x15')][_0xe5e2('0x17')]);}else{logger[_0xe5e2('0x18')](_0xe5e2('0x10'),_0x2c7a15,_0xe5e2('0x11'));_0x4fe403(_0x5104fb['result'][_0xe5e2('0x17')]);}})[_0xe5e2('0x19')](function(_0x4a95e8){logger['error']('SmsMessage,\x20%s,\x20%s',_0x2c7a15,_0x4a95e8);_0xbfd492(_0x4a95e8);});});}exports['CreateSmsMessage']=function(_0x33e488){var _0x489cc8=this;return new Promise(function(_0x40f218,_0xa37439){return db['SmsMessage'][_0xe5e2('0x1a')](_0x33e488[_0xe5e2('0x1b')],{'raw':_0x33e488[_0xe5e2('0x1c')]?_0x33e488[_0xe5e2('0x1c')][_0xe5e2('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x32d224){logger['info'](_0xe5e2('0x1e'),_0x33e488);logger[_0xe5e2('0x12')](_0xe5e2('0x1e'),_0x33e488,JSON[_0xe5e2('0x14')](_0x32d224));_0x40f218(_0x32d224);})[_0xe5e2('0x19')](function(_0xd524ce){logger[_0xe5e2('0x15')](_0xe5e2('0x1e'),_0xd524ce[_0xe5e2('0x17')],_0x33e488);_0xa37439(_0x489cc8['error'](0x1f4,_0xd524ce[_0xe5e2('0x17')]));});});}; \ No newline at end of file +var _0x4a07=['request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','CreateSmsMessage','SmsMessage','body','options','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x3e3ee1,_0x145541){var _0x519de8=function(_0x59c066){while(--_0x59c066){_0x3e3ee1['push'](_0x3e3ee1['shift']());}};_0x519de8(++_0x145541);}(_0x4a07,0x159));var _0x74a0=function(_0x366e77,_0x96bf7e){_0x366e77=_0x366e77-0x0;var _0x534b2a=_0x4a07[_0x366e77];return _0x534b2a;};'use strict';var _=require('lodash');var util=require(_0x74a0('0x0'));var moment=require(_0x74a0('0x1'));var BPromise=require(_0x74a0('0x2'));var rs=require(_0x74a0('0x3'));var fs=require('fs');var Redis=require(_0x74a0('0x4'));var db=require(_0x74a0('0x5'))['db'];var utils=require(_0x74a0('0x6'));var logger=require(_0x74a0('0x7'))(_0x74a0('0x8'));var config=require(_0x74a0('0x9'));var jayson=require(_0x74a0('0xa'));var client=jayson[_0x74a0('0xb')][_0x74a0('0xc')]({'port':0x232a});config[_0x74a0('0xd')]=_[_0x74a0('0xe')](config[_0x74a0('0xd')],{'host':_0x74a0('0xf'),'port':0x18eb});var socket=require(_0x74a0('0x10'))(new Redis(config[_0x74a0('0xd')]));require('./smsMessage.socket')[_0x74a0('0x11')](socket);function respondWithRpcPromise(_0x1b82b4,_0x2cd3d3,_0x11471d){return new BPromise(function(_0x389905,_0x26514f){return client[_0x74a0('0x12')](_0x1b82b4,_0x11471d)[_0x74a0('0x13')](function(_0x2da631){logger['info'](_0x74a0('0x14'),_0x2cd3d3,_0x74a0('0x15'));logger[_0x74a0('0x16')](_0x74a0('0x17'),_0x2cd3d3,_0x74a0('0x15'),JSON['stringify'](_0x2da631));if(_0x2da631[_0x74a0('0x18')]){if(_0x2da631['error'][_0x74a0('0x19')]===0x1f4){logger['error'](_0x74a0('0x14'),_0x2cd3d3,_0x2da631[_0x74a0('0x18')][_0x74a0('0x1a')]);return _0x26514f(_0x2da631['error'][_0x74a0('0x1a')]);}logger[_0x74a0('0x18')](_0x74a0('0x14'),_0x2cd3d3,_0x2da631[_0x74a0('0x18')][_0x74a0('0x1a')]);return _0x389905(_0x2da631[_0x74a0('0x18')][_0x74a0('0x1a')]);}else{logger[_0x74a0('0x1b')](_0x74a0('0x14'),_0x2cd3d3,_0x74a0('0x15'));_0x389905(_0x2da631['result'][_0x74a0('0x1a')]);}})[_0x74a0('0x1c')](function(_0x4a2321){logger[_0x74a0('0x18')](_0x74a0('0x14'),_0x2cd3d3,_0x4a2321);_0x26514f(_0x4a2321);});});}exports[_0x74a0('0x1d')]=function(_0x202bfc){var _0x1e6959=this;return new Promise(function(_0x2a7596,_0x3a7789){return db[_0x74a0('0x1e')]['create'](_0x202bfc[_0x74a0('0x1f')],{'raw':_0x202bfc['options']?_0x202bfc[_0x74a0('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x74a0('0x13')](function(_0x38c7e7){logger[_0x74a0('0x1b')](_0x74a0('0x1d'),_0x202bfc);logger['debug']('CreateSmsMessage',_0x202bfc,JSON['stringify'](_0x38c7e7));_0x2a7596(_0x38c7e7);})['catch'](function(_0x1e7bb0){logger[_0x74a0('0x18')](_0x74a0('0x1d'),_0x1e7bb0['message'],_0x202bfc);_0x3a7789(_0x1e6959[_0x74a0('0x18')](0x1f4,_0x1e7bb0['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 5fafc69..a5981fa 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 _0xda96=['./smsMessage.events','save','remove','update','removeListener','register','smsMessage:'];(function(_0x4de1b1,_0x18c64c){var _0x639f27=function(_0x635e03){while(--_0x635e03){_0x4de1b1['push'](_0x4de1b1['shift']());}};_0x639f27(++_0x18c64c);}(_0xda96,0xd2));var _0x6da9=function(_0x45f567,_0x38db68){_0x45f567=_0x45f567-0x0;var _0x6a7dbb=_0xda96[_0x45f567];return _0x6a7dbb;};'use strict';var SmsMessageEvents=require(_0x6da9('0x0'));var events=[_0x6da9('0x1'),_0x6da9('0x2'),_0x6da9('0x3')];function createListener(_0x5d9279,_0xd61526){return function(_0x574441){_0xd61526['emit'](_0x5d9279,_0x574441);};}function removeListener(_0x10fe14,_0x187c6b){return function(){SmsMessageEvents[_0x6da9('0x4')](_0x10fe14,_0x187c6b);};}exports[_0x6da9('0x5')]=function(_0x33381e){for(var _0x4fe5b1=0x0,_0x5d85cc=events['length'];_0x4fe5b1<_0x5d85cc;_0x4fe5b1++){var _0x564624=events[_0x4fe5b1];var _0x3e4444=createListener(_0x6da9('0x6')+_0x564624,_0x33381e);SmsMessageEvents['on'](_0x564624,_0x3e4444);}}; \ No newline at end of file +var _0x8ea3=['register','length','./smsMessage.events','save','remove','update','emit'];(function(_0x1b6c7c,_0x44c2e0){var _0x2446ad=function(_0x3f6559){while(--_0x3f6559){_0x1b6c7c['push'](_0x1b6c7c['shift']());}};_0x2446ad(++_0x44c2e0);}(_0x8ea3,0x17c));var _0x38ea=function(_0x545dd3,_0x2a4af4){_0x545dd3=_0x545dd3-0x0;var _0x2ba373=_0x8ea3[_0x545dd3];return _0x2ba373;};'use strict';var SmsMessageEvents=require(_0x38ea('0x0'));var events=[_0x38ea('0x1'),_0x38ea('0x2'),_0x38ea('0x3')];function createListener(_0x5bab3d,_0x5eeda6){return function(_0x309712){_0x5eeda6[_0x38ea('0x4')](_0x5bab3d,_0x309712);};}function removeListener(_0xba2db6,_0xcfe15c){return function(){SmsMessageEvents['removeListener'](_0xba2db6,_0xcfe15c);};}exports[_0x38ea('0x5')]=function(_0x870b6a){for(var _0x268d3e=0x0,_0x337aa0=events[_0x38ea('0x6')];_0x268d3e<_0x337aa0;_0x268d3e++){var _0x3b88d5=events[_0x268d3e];var _0x15fd0d=createListener('smsMessage:'+_0x3b88d5,_0x870b6a);SmsMessageEvents['on'](_0x3b88d5,_0x15fd0d);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 09b7f79..1ea969b 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 _0xcf98=['index','/describe','describe','/:id','show','/:id/teams','getTeams','/:id/users','post','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../config/environment','./smsQueue.controller','get','isAuthenticated'];(function(_0x196f12,_0x54546f){var _0x4d6a58=function(_0x2d6706){while(--_0x2d6706){_0x196f12['push'](_0x196f12['shift']());}};_0x4d6a58(++_0x54546f);}(_0xcf98,0x8d));var _0x8cf9=function(_0x47441d,_0x297b0d){_0x47441d=_0x47441d-0x0;var _0x13cdc7=_0xcf98[_0x47441d];return _0x13cdc7;};'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/members',auth[_0x8cf9('0x8')](),controller['getMembers']);router[_0x8cf9('0x7')](_0x8cf9('0xe'),auth[_0x8cf9('0x8')](),controller[_0x8cf9('0xf')]);router[_0x8cf9('0x7')](_0x8cf9('0x10'),auth[_0x8cf9('0x8')](),controller['getAgents']);router[_0x8cf9('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x8cf9('0xe'),auth['isAuthenticated'](),controller['addTeams']);router[_0x8cf9('0x11')](_0x8cf9('0x10'),auth[_0x8cf9('0x8')](),controller['addAgents']);router[_0x8cf9('0x12')](_0x8cf9('0xc'),auth['isAuthenticated'](),controller[_0x8cf9('0x13')]);router[_0x8cf9('0x14')](_0x8cf9('0xc'),auth[_0x8cf9('0x8')](),controller[_0x8cf9('0x15')]);router[_0x8cf9('0x14')](_0x8cf9('0xe'),auth[_0x8cf9('0x8')](),controller[_0x8cf9('0x16')]);router[_0x8cf9('0x14')](_0x8cf9('0x10'),auth[_0x8cf9('0x8')](),controller[_0x8cf9('0x17')]);module[_0x8cf9('0x18')]=router; \ No newline at end of file +var _0xa93e=['get','isAuthenticated','index','/describe','/:id/members','getMembers','getTeams','/:id/users','getAgents','/:id/teams','addTeams','post','put','update','delete','/:id','destroy','removeTeams','exports','path','connect-timeout','Router','../../components/interaction/service'];(function(_0xaa8fca,_0x1044ef){var _0x20d459=function(_0x23cda2){while(--_0x23cda2){_0xaa8fca['push'](_0xaa8fca['shift']());}};_0x20d459(++_0x1044ef);}(_0xa93e,0x1df));var _0xea93=function(_0x20a868,_0x2e272e){_0x20a868=_0x20a868-0x0;var _0x2d5967=_0xa93e[_0x20a868];return _0x2d5967;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xea93('0x0'));var timeout=require(_0xea93('0x1'));var express=require('express');var router=express[_0xea93('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xea93('0x3'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0xea93('0x4')]('/',auth[_0xea93('0x5')](),controller[_0xea93('0x6')]);router[_0xea93('0x4')](_0xea93('0x7'),auth[_0xea93('0x5')](),controller['describe']);router[_0xea93('0x4')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xea93('0x4')](_0xea93('0x8'),auth['isAuthenticated'](),controller[_0xea93('0x9')]);router[_0xea93('0x4')]('/:id/teams',auth[_0xea93('0x5')](),controller[_0xea93('0xa')]);router[_0xea93('0x4')](_0xea93('0xb'),auth[_0xea93('0x5')](),controller[_0xea93('0xc')]);router['post']('/',auth[_0xea93('0x5')](),controller['create']);router['post'](_0xea93('0xd'),auth[_0xea93('0x5')](),controller[_0xea93('0xe')]);router[_0xea93('0xf')](_0xea93('0xb'),auth[_0xea93('0x5')](),controller['addAgents']);router[_0xea93('0x10')]('/:id',auth[_0xea93('0x5')](),controller[_0xea93('0x11')]);router[_0xea93('0x12')](_0xea93('0x13'),auth[_0xea93('0x5')](),controller[_0xea93('0x14')]);router[_0xea93('0x12')](_0xea93('0xd'),auth[_0xea93('0x5')](),controller[_0xea93('0x15')]);router[_0xea93('0x12')](_0xea93('0xb'),auth[_0xea93('0x5')](),controller['removeAgents']);module[_0xea93('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 03cad8c..3464933 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 _0x003a=['exports','STRING','ENUM','rrmemory','beepall','roundrobin'];(function(_0x11be52,_0x2ef4f4){var _0x5b0bf8=function(_0x3659b6){while(--_0x3659b6){_0x11be52['push'](_0x11be52['shift']());}};_0x5b0bf8(++_0x2ef4f4);}(_0x003a,0x18c));var _0xa003=function(_0x8cb6e4,_0x161d75){_0x8cb6e4=_0x8cb6e4-0x0;var _0x463f99=_0x003a[_0x8cb6e4];return _0x463f99;};'use strict';var Sequelize=require('sequelize');module[_0xa003('0x0')]={'name':{'type':Sequelize[_0xa003('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa003('0x2')](_0xa003('0x3'),_0xa003('0x4'),_0xa003('0x5'))}}; \ No newline at end of file +var _0xf501=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','name'];(function(_0x4c41c4,_0x75bc8a){var _0x2bdc48=function(_0x2ea5e8){while(--_0x2ea5e8){_0x4c41c4['push'](_0x4c41c4['shift']());}};_0x2bdc48(++_0x75bc8a);}(_0xf501,0x131));var _0x1f50=function(_0x47dbc3,_0x1587e0){_0x47dbc3=_0x47dbc3-0x0;var _0x1c9b1a=_0xf501[_0x47dbc3];return _0x1c9b1a;};'use strict';var Sequelize=require(_0x1f50('0x0'));module[_0x1f50('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1f50('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1f50('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1f50('0x4')](_0x1f50('0x5'),'beepall',_0x1f50('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 99922c5..7765613 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 _0xdf64=['from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','union','compact','value','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','getAgents','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','limit','set','Content-Range','apply','save','then','get','SmsQueues','UserProfileResource','destroy','error','name','send','map','fieldName','type','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','pick','filters','filter','where','VIRTUAL','options','SmsQueue','count','includeAll','include','findAll','rows','show','keys','rawAttributes','filtears','merge','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','params','find','describe','getMembers','UserSmsQueue','SmsQueueId','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','findOne','length','getTeams','addTeams','ids','Team','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','field','tq.TeamId'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xdf64,0x1da));var _0x4df6=function(_0x2f6515,_0x3f9118){_0x2f6515=_0x2f6515-0x0;var _0x392f77=_0xdf64[_0x2f6515];return _0x392f77;};'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 licenseUtil=require(_0x4df6('0x1a'));var db=require(_0x4df6('0x1b'))['db'];config[_0x4df6('0x1c')]=_[_0x4df6('0x1d')](config[_0x4df6('0x1c')],{'host':_0x4df6('0x1e'),'port':0x18eb});var socket=require(_0x4df6('0x1f'))(new Redis(config[_0x4df6('0x1c')]));require('./smsQueue.socket')[_0x4df6('0x20')](socket);function respondWithStatusCode(_0x404779,_0x97b1ad){_0x97b1ad=_0x97b1ad||0xcc;return function(_0x4e49c6){if(_0x4e49c6){return _0x404779[_0x4df6('0x21')](_0x97b1ad);}return _0x404779[_0x4df6('0x22')](_0x97b1ad)[_0x4df6('0x23')]();};}function respondWithResult(_0x9b02d3,_0x20de3e){_0x20de3e=_0x20de3e||0xc8;return function(_0x3443f1){if(_0x3443f1){return _0x9b02d3[_0x4df6('0x22')](_0x20de3e)[_0x4df6('0x24')](_0x3443f1);}};}function respondWithFilteredResult(_0x4a76a9,_0x544d9d){return function(_0x3d5b77){if(_0x3d5b77){var _0x59f3b2=_0x3d5b77['count'],_0xc99c25=_0x544d9d['offset'],_0x52304f=_0x544d9d['offset']+_0x544d9d[_0x4df6('0x25')],_0x5cf0f7;if(_0x52304f>=_0x59f3b2){_0x52304f=_0x59f3b2;_0x5cf0f7=0xc8;}else{_0x5cf0f7=0xce;}_0x4a76a9[_0x4df6('0x22')](_0x5cf0f7);return _0x4a76a9[_0x4df6('0x26')](_0x4df6('0x27'),_0xc99c25+'-'+_0x52304f+'/'+_0x59f3b2)['json'](_0x3d5b77);}return null;};}function patchUpdates(_0x4e70dd){return function(_0x4690ca){try{jsonpatch[_0x4df6('0x28')](_0x4690ca,_0x4e70dd,!![]);}catch(_0xd5317a){return BPromise['reject'](_0xd5317a);}return _0x4690ca[_0x4df6('0x29')]();};}function saveUpdates(_0x14d35d,_0x25899c){return function(_0x15999b){if(_0x15999b){return _0x15999b['update'](_0x14d35d)['then'](function(_0x2dd570){return _0x2dd570;});}return null;};}function removeEntity(_0x3998e3,_0x323275){return function(_0x1b673f){if(_0x1b673f){return _0x1b673f['destroy']()[_0x4df6('0x2a')](function(){var _0x1b37bb=_0x1b673f[_0x4df6('0x2b')]({'plain':!![]});var _0x48854e=_0x4df6('0x2c');return db[_0x4df6('0x2d')][_0x4df6('0x2e')]({'where':{'type':_0x48854e,'resourceId':_0x1b37bb['id']}})[_0x4df6('0x2a')](function(){return _0x1b673f;});})[_0x4df6('0x2a')](function(){_0x3998e3[_0x4df6('0x22')](0xcc)[_0x4df6('0x23')]();});}};}function handleEntityNotFound(_0x2d76d5,_0x2f7c55){return function(_0x113b1b){if(!_0x113b1b){_0x2d76d5[_0x4df6('0x21')](0x194);}return _0x113b1b;};}function handleError(_0x21bff1,_0x397f33){_0x397f33=_0x397f33||0x1f4;return function(_0x529d2d){logger[_0x4df6('0x2f')](_0x529d2d['stack']);if(_0x529d2d[_0x4df6('0x30')]){delete _0x529d2d[_0x4df6('0x30')];}_0x21bff1['status'](_0x397f33)[_0x4df6('0x31')](_0x529d2d);};}exports['index']=function(_0x4296bc,_0x2f5203){var _0x3e820f={},_0x93358={},_0x201929={'count':0x0,'rows':[]};var _0x820678=_[_0x4df6('0x32')](db['SmsQueue']['rawAttributes'],function(_0x217848){return{'name':_0x217848[_0x4df6('0x33')],'type':_0x217848[_0x4df6('0x34')]['key']};});_0x93358['model']=_[_0x4df6('0x32')](_0x820678,'name');_0x93358['query']=_['keys'](_0x4296bc[_0x4df6('0x35')]);_0x93358['filters']=_[_0x4df6('0x36')](_0x93358[_0x4df6('0x37')],_0x93358[_0x4df6('0x35')]);_0x3e820f[_0x4df6('0x38')]=_[_0x4df6('0x36')](_0x93358[_0x4df6('0x37')],qs[_0x4df6('0x39')](_0x4296bc[_0x4df6('0x35')][_0x4df6('0x39')]));_0x3e820f[_0x4df6('0x38')]=_0x3e820f[_0x4df6('0x38')]['length']?_0x3e820f['attributes']:_0x93358[_0x4df6('0x37')];if(!_0x4296bc[_0x4df6('0x35')][_0x4df6('0x3a')](_0x4df6('0x3b'))){_0x3e820f[_0x4df6('0x25')]=qs[_0x4df6('0x25')](_0x4296bc['query'][_0x4df6('0x25')]);_0x3e820f[_0x4df6('0x3c')]=qs[_0x4df6('0x3c')](_0x4296bc[_0x4df6('0x35')][_0x4df6('0x3c')]);}_0x3e820f[_0x4df6('0x3d')]=qs[_0x4df6('0x3e')](_0x4296bc[_0x4df6('0x35')][_0x4df6('0x3e')]);_0x3e820f['where']=qs['filters'](_[_0x4df6('0x3f')](_0x4296bc[_0x4df6('0x35')],_0x93358[_0x4df6('0x40')]),_0x820678);if(_0x4296bc[_0x4df6('0x35')][_0x4df6('0x41')]){_0x3e820f['where']=_['merge'](_0x3e820f[_0x4df6('0x42')],{'$or':_[_0x4df6('0x32')](_0x820678,function(_0x4bbeea){if(_0x4bbeea['type']!==_0x4df6('0x43')){var _0x2f4634={};_0x2f4634[_0x4bbeea[_0x4df6('0x30')]]={'$like':'%'+_0x4296bc[_0x4df6('0x35')][_0x4df6('0x41')]+'%'};return _0x2f4634;}})});}_0x3e820f=_['merge']({},_0x3e820f,_0x4296bc[_0x4df6('0x44')]);var _0x1808c7={'where':_0x3e820f[_0x4df6('0x42')]};return db[_0x4df6('0x45')]['count'](_0x1808c7)[_0x4df6('0x2a')](function(_0x40c12d){_0x201929[_0x4df6('0x46')]=_0x40c12d;if(_0x4296bc[_0x4df6('0x35')][_0x4df6('0x47')]){_0x3e820f[_0x4df6('0x48')]=[{'all':!![]}];}return db[_0x4df6('0x45')][_0x4df6('0x49')](_0x3e820f);})['then'](function(_0x146a30){_0x201929[_0x4df6('0x4a')]=_0x146a30;return _0x201929;})[_0x4df6('0x2a')](respondWithFilteredResult(_0x2f5203,_0x3e820f))['catch'](handleError(_0x2f5203,null));};exports[_0x4df6('0x4b')]=function(_0x3ee775,_0x36918d){var _0x40aebb={'raw':!![],'where':{'id':_0x3ee775['params']['id']}},_0x268b5f={};_0x268b5f[_0x4df6('0x37')]=_[_0x4df6('0x4c')](db['SmsQueue'][_0x4df6('0x4d')]);_0x268b5f[_0x4df6('0x35')]=_['keys'](_0x3ee775[_0x4df6('0x35')]);_0x268b5f[_0x4df6('0x4e')]=_[_0x4df6('0x36')](_0x268b5f[_0x4df6('0x37')],_0x268b5f['query']);_0x40aebb[_0x4df6('0x38')]=_['intersection'](_0x268b5f[_0x4df6('0x37')],qs['fields'](_0x3ee775[_0x4df6('0x35')][_0x4df6('0x39')]));_0x40aebb[_0x4df6('0x38')]=_0x40aebb['attributes']['length']?_0x40aebb[_0x4df6('0x38')]:_0x268b5f[_0x4df6('0x37')];if(_0x3ee775[_0x4df6('0x35')]['includeAll']){_0x40aebb[_0x4df6('0x48')]=[{'all':!![]}];}_0x40aebb=_[_0x4df6('0x4f')]({},_0x40aebb,_0x3ee775[_0x4df6('0x44')]);return db[_0x4df6('0x45')]['find'](_0x40aebb)['then'](handleEntityNotFound(_0x36918d,null))['then'](respondWithResult(_0x36918d,null))['catch'](handleError(_0x36918d,null));};exports[_0x4df6('0x50')]=function(_0xc715e8,_0x257ea3){return db[_0x4df6('0x45')][_0x4df6('0x50')](_0xc715e8[_0x4df6('0x51')],{})['then'](function(_0x5215b4){var _0x3ef5ae=_0xc715e8['user'][_0x4df6('0x2b')]({'plain':!![]});if(!_0x3ef5ae)throw new Error(_0x4df6('0x52'));if(_0x3ef5ae[_0x4df6('0x53')]===_0x4df6('0x54')){var _0x58154c=_0x5215b4[_0x4df6('0x2b')]({'plain':!![]});var _0x5db7bb=_0x4df6('0x2c');return db[_0x4df6('0x55')]['find']({'where':{'name':_0x5db7bb,'userProfileId':_0x3ef5ae[_0x4df6('0x56')]},'raw':!![]})[_0x4df6('0x2a')](function(_0xd6639){if(_0xd6639&&_0xd6639[_0x4df6('0x57')]===0x0){return db[_0x4df6('0x2d')][_0x4df6('0x50')]({'name':_0x58154c[_0x4df6('0x30')],'resourceId':_0x58154c['id'],'type':_0xd6639[_0x4df6('0x30')],'sectionId':_0xd6639['id']},{})[_0x4df6('0x2a')](function(){return _0x5215b4;});}else{return _0x5215b4;}})['catch'](function(_0x3fa272){logger['error'](_0x4df6('0x58'),_0x3fa272);throw _0x3fa272;});}return _0x5215b4;})[_0x4df6('0x2a')](respondWithResult(_0x257ea3,0xc9))[_0x4df6('0x59')](handleError(_0x257ea3,null));};exports[_0x4df6('0x5a')]=function(_0xb3870e,_0x328f88){if(_0xb3870e['body']['id']){delete _0xb3870e[_0x4df6('0x51')]['id'];}return db[_0x4df6('0x45')]['find']({'where':{'id':_0xb3870e[_0x4df6('0x5b')]['id']}})['then'](handleEntityNotFound(_0x328f88,null))[_0x4df6('0x2a')](saveUpdates(_0xb3870e[_0x4df6('0x51')],null))[_0x4df6('0x2a')](respondWithResult(_0x328f88,null))[_0x4df6('0x59')](handleError(_0x328f88,null));};exports[_0x4df6('0x2e')]=function(_0x2545c0,_0x1e054b){return db[_0x4df6('0x45')][_0x4df6('0x5c')]({'where':{'id':_0x2545c0['params']['id']}})[_0x4df6('0x2a')](handleEntityNotFound(_0x1e054b,null))['then'](removeEntity(_0x1e054b,null))[_0x4df6('0x59')](handleError(_0x1e054b,null));};exports[_0x4df6('0x5d')]=function(_0xca7e9e,_0x3cb26a){return db[_0x4df6('0x45')][_0x4df6('0x5d')]()[_0x4df6('0x2a')](respondWithResult(_0x3cb26a,null))['catch'](handleError(_0x3cb26a,null));};exports[_0x4df6('0x5e')]=function(_0x2640fe,_0x2634c5,_0xf9e9ed){var _0x287a8f={'raw':!![],'where':{}},_0x120a01={},_0x41fdec;return db[_0x4df6('0x45')]['findOne']({'where':{'id':_0x2640fe[_0x4df6('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2634c5,null))[_0x4df6('0x2a')](function(_0x450b14){if(_0x450b14){_0x41fdec=_0x450b14[_0x4df6('0x2b')]({'plain':!![]});_0x120a01[_0x4df6('0x37')]=_[_0x4df6('0x4c')](db[_0x4df6('0x5f')]['rawAttributes']);_0x120a01[_0x4df6('0x35')]=_[_0x4df6('0x4c')](_0x2640fe[_0x4df6('0x35')]);_0x120a01[_0x4df6('0x40')]=_['intersection'](_0x120a01['model'],_0x120a01['query']);_0x287a8f['attributes']=_[_0x4df6('0x36')](_0x120a01['model'],qs['fields'](_0x2640fe[_0x4df6('0x35')][_0x4df6('0x39')]));_0x287a8f['attributes']=_0x287a8f[_0x4df6('0x38')]['length']?_0x287a8f[_0x4df6('0x38')]:_0x120a01['model'];if(!_0x2640fe[_0x4df6('0x35')][_0x4df6('0x3a')]('nolimit')){_0x287a8f[_0x4df6('0x25')]=qs[_0x4df6('0x25')](_0x2640fe['query'][_0x4df6('0x25')]);_0x287a8f['offset']=qs[_0x4df6('0x3c')](_0x2640fe['query']['offset']);}_0x287a8f[_0x4df6('0x3d')]=qs[_0x4df6('0x3e')](_0x2640fe[_0x4df6('0x35')][_0x4df6('0x3e')]);_0x287a8f['where']=qs[_0x4df6('0x40')](_[_0x4df6('0x3f')](_0x2640fe[_0x4df6('0x35')],_0x120a01['filters']));_0x287a8f[_0x4df6('0x42')][_0x4df6('0x60')]=_0x450b14['id'];if(_0x2640fe['query']['filter']){_0x287a8f[_0x4df6('0x42')]=_['merge'](_0x287a8f[_0x4df6('0x42')],{'$or':_[_0x4df6('0x32')](_0x287a8f[_0x4df6('0x38')],function(_0x361adc){var _0x29465b={};_0x29465b[_0x361adc]={'$like':'%'+_0x2640fe[_0x4df6('0x35')][_0x4df6('0x41')]+'%'};return _0x29465b;})});}_0x287a8f=_[_0x4df6('0x4f')]({},_0x287a8f,_0x2640fe[_0x4df6('0x44')]);return db[_0x4df6('0x5f')][_0x4df6('0x49')](_0x287a8f);}})[_0x4df6('0x2a')](function(_0x3e818d){if(_0x3e818d){return db['User']['findAndCountAll']({'where':{'id':_[_0x4df6('0x32')](_0x3e818d,_0x4df6('0x61')),'role':_0x4df6('0x62')},'attributes':['id','name',_0x4df6('0x63'),_0x4df6('0x64'),_0x4df6('0x65')]});}})[_0x4df6('0x2a')](function(_0x57c330){if(_0x57c330){return{'count':_0x57c330[_0x4df6('0x46')],'rows':_[_0x4df6('0x32')](_0x57c330[_0x4df6('0x4a')],function(_0x2a47d8){return{'membername':_0x2a47d8[_0x4df6('0x30')],'UserId':_0x2a47d8['id'],'queue_name':_0x41fdec[_0x4df6('0x30')],'SmsQueueId':_0x41fdec['id'],'interface':util[_0x4df6('0x66')](_0x4df6('0x67'),_0x4df6('0x68'),_0x2a47d8[_0x4df6('0x30')]),'penalty':0x0,'paused':_0x2a47d8['smsPause'],'createdAt':_0x2a47d8[_0x4df6('0x65')],'updatedAt':_0x2a47d8[_0x4df6('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2634c5,_0x287a8f))['catch'](handleError(_0x2634c5,null));};exports['getTeams']=function(_0x2e428b,_0x2a266d,_0x6762d4){var _0x24d1df={};var _0x5e75fe={};var _0x417fcd;var _0x45231a;return db[_0x4df6('0x45')][_0x4df6('0x69')]({'where':{'id':_0x2e428b[_0x4df6('0x5b')]['id']}})[_0x4df6('0x2a')](handleEntityNotFound(_0x2a266d,null))[_0x4df6('0x2a')](function(_0x5d6675){if(_0x5d6675){_0x417fcd=_0x5d6675;_0x5e75fe[_0x4df6('0x37')]=_['keys'](db['Team'][_0x4df6('0x4d')]);_0x5e75fe[_0x4df6('0x35')]=_[_0x4df6('0x4c')](_0x2e428b['query']);_0x5e75fe[_0x4df6('0x40')]=_[_0x4df6('0x36')](_0x5e75fe[_0x4df6('0x37')],_0x5e75fe[_0x4df6('0x35')]);_0x24d1df[_0x4df6('0x38')]=_[_0x4df6('0x36')](_0x5e75fe[_0x4df6('0x37')],qs[_0x4df6('0x39')](_0x2e428b['query'][_0x4df6('0x39')]));_0x24d1df['attributes']=_0x24d1df['attributes'][_0x4df6('0x6a')]?_0x24d1df[_0x4df6('0x38')]:_0x5e75fe[_0x4df6('0x37')];_0x24d1df['order']=qs[_0x4df6('0x3e')](_0x2e428b['query'][_0x4df6('0x3e')]);_0x24d1df['where']=qs[_0x4df6('0x40')](_[_0x4df6('0x3f')](_0x2e428b[_0x4df6('0x35')],_0x5e75fe['filters']));if(_0x2e428b['query']['filter']){_0x24d1df[_0x4df6('0x42')]=_['merge'](_0x24d1df[_0x4df6('0x42')],{'$or':_[_0x4df6('0x32')](_0x24d1df[_0x4df6('0x38')],function(_0x265097){var _0x4a1564={};_0x4a1564[_0x265097]={'$like':'%'+_0x2e428b[_0x4df6('0x35')][_0x4df6('0x41')]+'%'};return _0x4a1564;})});}_0x24d1df=_[_0x4df6('0x4f')]({},_0x24d1df,_0x2e428b[_0x4df6('0x44')]);return _0x417fcd[_0x4df6('0x6b')](_0x24d1df);}})[_0x4df6('0x2a')](function(_0x11bc59){if(_0x11bc59){_0x45231a=_0x11bc59[_0x4df6('0x6a')];if(!_0x2e428b[_0x4df6('0x35')]['hasOwnProperty'](_0x4df6('0x3b'))){_0x24d1df['limit']=qs[_0x4df6('0x25')](_0x2e428b[_0x4df6('0x35')][_0x4df6('0x25')]);_0x24d1df[_0x4df6('0x3c')]=qs['offset'](_0x2e428b['query'][_0x4df6('0x3c')]);}return _0x417fcd['getTeams'](_0x24d1df);}})[_0x4df6('0x2a')](function(_0x129999){if(_0x129999){return _0x129999?{'count':_0x45231a,'rows':_0x129999}:null;}})[_0x4df6('0x2a')](respondWithResult(_0x2a266d,null))['catch'](handleError(_0x2a266d,null));};exports[_0x4df6('0x6c')]=function(_0x3118ec,_0x460b28,_0x2ace38){var _0x58c29d=_0x3118ec[_0x4df6('0x51')][_0x4df6('0x6d')];return db[_0x4df6('0x6e')]['findAll']({'where':{'id':_0x58c29d},'attributes':['id'],'include':[{'model':db[_0x4df6('0x6f')],'as':_0x4df6('0x70'),'attributes':['id',_0x4df6('0x30'),_0x4df6('0x71'),_0x4df6('0x72'),_0x4df6('0x73')],'raw':!![]}]})[_0x4df6('0x2a')](function(_0x4be852){if(_0x4be852){var _0x151aca=_[_0x4df6('0x74')](_0x4be852,function(_0x2430bf){var _0x548824=_0x2430bf[_0x4df6('0x2b')]({'plain':!![]});return _0x548824['Agents'];});return db[_0x4df6('0x45')]['find']({'where':{'id':_0x3118ec[_0x4df6('0x5b')]['id']}})[_0x4df6('0x2a')](function(_0x3a4c53){return db[_0x4df6('0x75')][_0x4df6('0x76')](function(_0x4e79d7){return _0x3a4c53['addTeams'](_0x58c29d,{'transaction':_0x4e79d7})[_0x4df6('0x2a')](function(){return BPromise[_0x4df6('0x77')](_0x151aca,function(_0x2b49de){return db['UserSmsQueue'][_0x4df6('0x78')]({'where':{'UserId':_0x2b49de['id'],'SmsQueueId':_0x3118ec[_0x4df6('0x5b')]['id']},'transaction':_0x4e79d7});});})[_0x4df6('0x2a')](function(){_0x151aca[_0x4df6('0x79')](function(_0x54a990){socket[_0x4df6('0x7a')](_0x4df6('0x7b'),{'UserId':_0x54a990['id'],'SmsQueueId':_0x3a4c53['id']});});});});});}})[_0x4df6('0x2a')](respondWithStatusCode(_0x460b28,null))[_0x4df6('0x59')](handleError(_0x460b28,null));};exports['removeTeams']=function(_0x5e635a,_0x127262,_0x1b797c){return db[_0x4df6('0x6e')]['findAll']({'where':{'id':_0x5e635a['query'][_0x4df6('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x4df6('0x6f')],'as':_0x4df6('0x70'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x127262,null))[_0x4df6('0x2a')](function(_0x31fe80){var _0x344891=_[_0x4df6('0x32')](_0x31fe80,'id');var _0x32cde0=[];var _0x22cde3=[];var _0x524203=squel['select']();_0x524203[_0x4df6('0x7c')](_0x4df6('0x7d'))[_0x4df6('0x7e')](_0x4df6('0x7f'),'tq')['join'](_0x4df6('0x80'),'ut',_0x4df6('0x81'))[_0x4df6('0x42')](_0x4df6('0x82'),_0x5e635a[_0x4df6('0x5b')]['id']);for(var _0x353fb3=0x0;_0x353fb3<_0x31fe80[_0x4df6('0x6a')];_0x353fb3+=0x1){let _0x2f34eb=_0x31fe80[_0x353fb3];for(var _0x5edf03=0x0;_0x5edf03<_0x2f34eb[_0x4df6('0x70')]['length'];_0x5edf03+=0x1){let _0x4e406f=_0x2f34eb['Agents'][_0x5edf03];var _0x4a54e8=_0x524203[_0x4df6('0x83')]();_0x4a54e8[_0x4df6('0x42')](_0x4df6('0x84'),_0x4e406f['id']);_0x22cde3[_0x4df6('0x85')](db[_0x4df6('0x75')]['query'](_0x4a54e8[_0x4df6('0x86')](),{'type':db[_0x4df6('0x75')]['QueryTypes'][_0x4df6('0x87')]})[_0x4df6('0x2a')](function(_0x379bdd){if(_0x379bdd[_0x4df6('0x6a')]===0x1){return _0x4e406f['id'];}else{var _0x26f7fb=_[_0x4df6('0x88')](_[_0x4df6('0x32')](_0x379bdd,_0x4df6('0x89')),function(_0x50a239){return _[_0x4df6('0x8a')](_0x344891,_0x50a239);});if(_0x26f7fb){return _0x4e406f['id'];}}}));}}return BPromise['all'](_0x22cde3)[_0x4df6('0x2a')](function(_0x5998d3){_0x32cde0=_(_0x32cde0)[_0x4df6('0x8b')](_0x5998d3)[_0x4df6('0x8c')]()[_0x4df6('0x8d')]();return db['SmsQueue'][_0x4df6('0x5c')]({'where':{'id':_0x5e635a[_0x4df6('0x5b')]['id']}})[_0x4df6('0x2a')](function(_0x2b0638){return db[_0x4df6('0x75')][_0x4df6('0x76')](function(_0x879dc3){return _0x2b0638[_0x4df6('0x8e')](_0x5e635a[_0x4df6('0x35')]['ids'],{'transaction':_0x879dc3})[_0x4df6('0x2a')](function(){if(!_[_0x4df6('0x8f')](_0x32cde0)){return _0x2b0638[_0x4df6('0x90')](_0x32cde0,{'transaction':_0x879dc3});}})[_0x4df6('0x2a')](function(){_0x32cde0[_0x4df6('0x79')](function(_0xb495c5){socket[_0x4df6('0x7a')](_0x4df6('0x91'),{'UserId':_0xb495c5,'SmsQueueId':_0x2b0638['id']});});});});});});})[_0x4df6('0x2a')](respondWithStatusCode(_0x127262,null))['catch'](handleError(_0x127262,null));};exports['addAgents']=function(_0x428e93,_0x5554e8,_0x5c2abc){return db['SmsQueue']['find']({'where':{'id':_0x428e93['params']['id']}})[_0x4df6('0x2a')](handleEntityNotFound(_0x5554e8,null))[_0x4df6('0x2a')](function(_0x184320){if(_0x184320){return _0x184320[_0x4df6('0x92')](_0x428e93[_0x4df6('0x51')][_0x4df6('0x6d')],_['omit'](_0x428e93[_0x4df6('0x51')],[_0x4df6('0x6d'),'id'])||{})[_0x4df6('0x93')](function(_0x6a4e43){for(var _0x5b6d82=0x0;_0x5b6d82<_0x428e93[_0x4df6('0x51')][_0x4df6('0x6d')][_0x4df6('0x6a')];_0x5b6d82+=0x1){socket[_0x4df6('0x7a')]('userSmsQueue:save',{'UserId':_0x428e93[_0x4df6('0x51')][_0x4df6('0x6d')][_0x5b6d82],'SmsQueueId':_0x428e93[_0x4df6('0x5b')]['id']});}return _0x6a4e43;});}})[_0x4df6('0x2a')](respondWithResult(_0x5554e8,null))[_0x4df6('0x59')](handleError(_0x5554e8,null));};exports['removeAgents']=function(_0x2bf844,_0x287dd8,_0x49765f){return db['SmsQueue'][_0x4df6('0x5c')]({'where':{'id':_0x2bf844[_0x4df6('0x5b')]['id']}})[_0x4df6('0x2a')](handleEntityNotFound(_0x287dd8,null))[_0x4df6('0x2a')](function(_0x576c0e){if(_0x576c0e){return _0x576c0e[_0x4df6('0x90')](_0x2bf844[_0x4df6('0x35')][_0x4df6('0x6d')])[_0x4df6('0x2a')](function(){if(_[_0x4df6('0x94')](_0x2bf844[_0x4df6('0x35')][_0x4df6('0x6d')])){for(var _0x5595fc=0x0;_0x5595fc<_0x2bf844[_0x4df6('0x35')][_0x4df6('0x6d')][_0x4df6('0x6a')];_0x5595fc+=0x1){socket[_0x4df6('0x7a')](_0x4df6('0x91'),{'UserId':Number(_0x2bf844[_0x4df6('0x35')]['ids'][_0x5595fc]),'SmsQueueId':Number(_0x2bf844[_0x4df6('0x5b')]['id'])});}}else{socket['emit'](_0x4df6('0x91'),{'UserId':Number(_0x2bf844[_0x4df6('0x35')][_0x4df6('0x6d')]),'SmsQueueId':Number(_0x2bf844[_0x4df6('0x5b')]['id'])});}});}})[_0x4df6('0x2a')](respondWithStatusCode(_0x287dd8,null))[_0x4df6('0x59')](handleError(_0x287dd8,null));};exports[_0x4df6('0x95')]=function(_0x8835b5,_0x49cc37,_0x3052dc){var _0x5ded83={};var _0x5a28f2={};var _0x3c83c7;var _0x1e2f58;return db[_0x4df6('0x45')][_0x4df6('0x69')]({'where':{'id':_0x8835b5['params']['id']}})[_0x4df6('0x2a')](handleEntityNotFound(_0x49cc37,null))[_0x4df6('0x2a')](function(_0x5e2bb9){if(_0x5e2bb9){_0x3c83c7=_0x5e2bb9;_0x5a28f2[_0x4df6('0x37')]=_[_0x4df6('0x4c')](db[_0x4df6('0x6f')][_0x4df6('0x4d')]);_0x5a28f2[_0x4df6('0x35')]=_[_0x4df6('0x4c')](_0x8835b5[_0x4df6('0x35')]);_0x5a28f2[_0x4df6('0x40')]=_[_0x4df6('0x36')](_0x5a28f2[_0x4df6('0x37')],_0x5a28f2['query']);_0x5ded83[_0x4df6('0x38')]=_[_0x4df6('0x36')](_0x5a28f2[_0x4df6('0x37')],qs['fields'](_0x8835b5[_0x4df6('0x35')][_0x4df6('0x39')]));_0x5ded83[_0x4df6('0x38')]=_0x5ded83[_0x4df6('0x38')][_0x4df6('0x6a')]?_0x5ded83[_0x4df6('0x38')]:_0x5a28f2[_0x4df6('0x37')];_0x5ded83['order']=qs['sort'](_0x8835b5[_0x4df6('0x35')][_0x4df6('0x3e')]);_0x5ded83['where']=qs['filters'](_[_0x4df6('0x3f')](_0x8835b5['query'],_0x5a28f2[_0x4df6('0x40')]));if(_0x8835b5[_0x4df6('0x35')][_0x4df6('0x41')]){_0x5ded83[_0x4df6('0x42')]=_[_0x4df6('0x4f')](_0x5ded83['where'],{'$or':_['map'](_0x5ded83['attributes'],function(_0x3e1506){var _0x3bf5ed={};_0x3bf5ed[_0x3e1506]={'$like':'%'+_0x8835b5[_0x4df6('0x35')]['filter']+'%'};return _0x3bf5ed;})});}_0x5ded83=_[_0x4df6('0x4f')]({},_0x5ded83,_0x8835b5[_0x4df6('0x44')]);return _0x3c83c7[_0x4df6('0x95')](_0x5ded83);}})[_0x4df6('0x2a')](function(_0x19456f){if(_0x19456f){_0x1e2f58=_0x19456f[_0x4df6('0x6a')];if(!_0x8835b5[_0x4df6('0x35')][_0x4df6('0x3a')]('nolimit')){_0x5ded83[_0x4df6('0x25')]=qs[_0x4df6('0x25')](_0x8835b5['query']['limit']);_0x5ded83['offset']=qs[_0x4df6('0x3c')](_0x8835b5[_0x4df6('0x35')][_0x4df6('0x3c')]);}return _0x3c83c7['getAgents'](_0x5ded83);}})[_0x4df6('0x2a')](function(_0x487a17){if(_0x487a17){return _0x487a17?{'count':_0x1e2f58,'rows':_0x487a17}:null;}})['then'](respondWithResult(_0x49cc37,null))[_0x4df6('0x59')](handleError(_0x49cc37,null));}; \ No newline at end of file +var _0xf491=['socket.io-emitter','./smsQueue.socket','register','end','count','offset','limit','set','json','apply','reject','save','update','destroy','get','SmsQueues','UserProfileResource','then','sendStatus','stack','name','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','catch','params','filtears','include','find','create','body','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','hasOwnProperty','SmsQueueId','findAll','User','findAndCountAll','agent','smsPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','voicePause','interface','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','ids','select','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','SELECT','every','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','spread','isArray','getAgents','html-pdf','eml-format','rimraf','request-promise','bluebird','util','path','sox','lodash','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost'];(function(_0x37cc52,_0x459a9b){var _0x2b4a90=function(_0xabcfc7){while(--_0xabcfc7){_0x37cc52['push'](_0x37cc52['shift']());}};_0x2b4a90(++_0x459a9b);}(_0xf491,0x178));var _0x1f49=function(_0x355ad3,_0x36d054){_0x355ad3=_0x355ad3-0x0;var _0x9b9c8=_0xf491[_0x355ad3];return _0x9b9c8;};'use strict';var pdf=require(_0x1f49('0x0'));var emlformat=require(_0x1f49('0x1'));var rimraf=require(_0x1f49('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1f49('0x3'));var moment=require('moment');var BPromise=require(_0x1f49('0x4'));var Mustache=require('mustache');var util=require(_0x1f49('0x5'));var path=require(_0x1f49('0x6'));var sox=require(_0x1f49('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1f49('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1f49('0x9'));var toCsv=require(_0x1f49('0xa'));var querystring=require(_0x1f49('0xb'));var Papa=require('papaparse');var Redis=require(_0x1f49('0xc'));var authService=require(_0x1f49('0xd'));var qs=require(_0x1f49('0xe'));var as=require(_0x1f49('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f49('0x10'))(_0x1f49('0x11'));var utils=require(_0x1f49('0x12'));var config=require(_0x1f49('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1f49('0x14')]=_[_0x1f49('0x15')](config[_0x1f49('0x14')],{'host':_0x1f49('0x16'),'port':0x18eb});var socket=require(_0x1f49('0x17'))(new Redis(config[_0x1f49('0x14')]));require(_0x1f49('0x18'))[_0x1f49('0x19')](socket);function respondWithStatusCode(_0x1121a2,_0x403bfd){_0x403bfd=_0x403bfd||0xcc;return function(_0x4b1764){if(_0x4b1764){return _0x1121a2['sendStatus'](_0x403bfd);}return _0x1121a2['status'](_0x403bfd)[_0x1f49('0x1a')]();};}function respondWithResult(_0x37948a,_0x118397){_0x118397=_0x118397||0xc8;return function(_0x1bc49b){if(_0x1bc49b){return _0x37948a['status'](_0x118397)['json'](_0x1bc49b);}};}function respondWithFilteredResult(_0x8c2793,_0x210bd1){return function(_0x5acdd1){if(_0x5acdd1){var _0x5cac84=_0x5acdd1[_0x1f49('0x1b')],_0x3e21a7=_0x210bd1[_0x1f49('0x1c')],_0x3f909a=_0x210bd1['offset']+_0x210bd1[_0x1f49('0x1d')],_0x2bf3ca;if(_0x3f909a>=_0x5cac84){_0x3f909a=_0x5cac84;_0x2bf3ca=0xc8;}else{_0x2bf3ca=0xce;}_0x8c2793['status'](_0x2bf3ca);return _0x8c2793[_0x1f49('0x1e')]('Content-Range',_0x3e21a7+'-'+_0x3f909a+'/'+_0x5cac84)[_0x1f49('0x1f')](_0x5acdd1);}return null;};}function patchUpdates(_0x1c3c7e){return function(_0x51f8f7){try{jsonpatch[_0x1f49('0x20')](_0x51f8f7,_0x1c3c7e,!![]);}catch(_0x245844){return BPromise[_0x1f49('0x21')](_0x245844);}return _0x51f8f7[_0x1f49('0x22')]();};}function saveUpdates(_0x286785,_0x38ece0){return function(_0x506383){if(_0x506383){return _0x506383[_0x1f49('0x23')](_0x286785)['then'](function(_0x3a05b3){return _0x3a05b3;});}return null;};}function removeEntity(_0xbb97c,_0x372421){return function(_0x47e9e4){if(_0x47e9e4){return _0x47e9e4[_0x1f49('0x24')]()['then'](function(){var _0x3fbd63=_0x47e9e4[_0x1f49('0x25')]({'plain':!![]});var _0x1077ac=_0x1f49('0x26');return db[_0x1f49('0x27')]['destroy']({'where':{'type':_0x1077ac,'resourceId':_0x3fbd63['id']}})[_0x1f49('0x28')](function(){return _0x47e9e4;});})[_0x1f49('0x28')](function(){_0xbb97c['status'](0xcc)[_0x1f49('0x1a')]();});}};}function handleEntityNotFound(_0x3ba1d8,_0x5b4ab6){return function(_0x1df935){if(!_0x1df935){_0x3ba1d8[_0x1f49('0x29')](0x194);}return _0x1df935;};}function handleError(_0x362f7f,_0x480331){_0x480331=_0x480331||0x1f4;return function(_0x1034d2){logger['error'](_0x1034d2[_0x1f49('0x2a')]);if(_0x1034d2[_0x1f49('0x2b')]){delete _0x1034d2[_0x1f49('0x2b')];}_0x362f7f['status'](_0x480331)['send'](_0x1034d2);};}exports[_0x1f49('0x2c')]=function(_0x25084c,_0x2a8b08){var _0x27c348={},_0x4ff31d={},_0x14dee8={'count':0x0,'rows':[]};var _0x2a2233=_[_0x1f49('0x2d')](db[_0x1f49('0x2e')][_0x1f49('0x2f')],function(_0x37ebb7){return{'name':_0x37ebb7[_0x1f49('0x30')],'type':_0x37ebb7[_0x1f49('0x31')][_0x1f49('0x32')]};});_0x4ff31d[_0x1f49('0x33')]=_['map'](_0x2a2233,'name');_0x4ff31d[_0x1f49('0x34')]=_[_0x1f49('0x35')](_0x25084c[_0x1f49('0x34')]);_0x4ff31d[_0x1f49('0x36')]=_[_0x1f49('0x37')](_0x4ff31d[_0x1f49('0x33')],_0x4ff31d['query']);_0x27c348[_0x1f49('0x38')]=_[_0x1f49('0x37')](_0x4ff31d[_0x1f49('0x33')],qs[_0x1f49('0x39')](_0x25084c[_0x1f49('0x34')][_0x1f49('0x39')]));_0x27c348['attributes']=_0x27c348['attributes'][_0x1f49('0x3a')]?_0x27c348[_0x1f49('0x38')]:_0x4ff31d['model'];if(!_0x25084c[_0x1f49('0x34')]['hasOwnProperty'](_0x1f49('0x3b'))){_0x27c348[_0x1f49('0x1d')]=qs['limit'](_0x25084c['query'][_0x1f49('0x1d')]);_0x27c348['offset']=qs[_0x1f49('0x1c')](_0x25084c[_0x1f49('0x34')]['offset']);}_0x27c348[_0x1f49('0x3c')]=qs[_0x1f49('0x3d')](_0x25084c[_0x1f49('0x34')][_0x1f49('0x3d')]);_0x27c348['where']=qs[_0x1f49('0x36')](_[_0x1f49('0x3e')](_0x25084c[_0x1f49('0x34')],_0x4ff31d['filters']),_0x2a2233);if(_0x25084c['query'][_0x1f49('0x3f')]){_0x27c348[_0x1f49('0x40')]=_['merge'](_0x27c348[_0x1f49('0x40')],{'$or':_[_0x1f49('0x2d')](_0x2a2233,function(_0x39ea9c){if(_0x39ea9c[_0x1f49('0x31')]!==_0x1f49('0x41')){var _0x18abb4={};_0x18abb4[_0x39ea9c[_0x1f49('0x2b')]]={'$like':'%'+_0x25084c[_0x1f49('0x34')][_0x1f49('0x3f')]+'%'};return _0x18abb4;}})});}_0x27c348=_[_0x1f49('0x42')]({},_0x27c348,_0x25084c[_0x1f49('0x43')]);var _0x329ad5={'where':_0x27c348[_0x1f49('0x40')]};return db[_0x1f49('0x2e')][_0x1f49('0x1b')](_0x329ad5)[_0x1f49('0x28')](function(_0x1680c9){_0x14dee8[_0x1f49('0x1b')]=_0x1680c9;if(_0x25084c['query'][_0x1f49('0x44')]){_0x27c348['include']=[{'all':!![]}];}return db[_0x1f49('0x2e')]['findAll'](_0x27c348);})['then'](function(_0x228fd9){_0x14dee8['rows']=_0x228fd9;return _0x14dee8;})[_0x1f49('0x28')](respondWithFilteredResult(_0x2a8b08,_0x27c348))[_0x1f49('0x45')](handleError(_0x2a8b08,null));};exports['show']=function(_0x4f6272,_0x42fdce){var _0x1ada46={'raw':!![],'where':{'id':_0x4f6272[_0x1f49('0x46')]['id']}},_0x385172={};_0x385172[_0x1f49('0x33')]=_[_0x1f49('0x35')](db['SmsQueue']['rawAttributes']);_0x385172['query']=_[_0x1f49('0x35')](_0x4f6272[_0x1f49('0x34')]);_0x385172[_0x1f49('0x47')]=_['intersection'](_0x385172[_0x1f49('0x33')],_0x385172[_0x1f49('0x34')]);_0x1ada46[_0x1f49('0x38')]=_[_0x1f49('0x37')](_0x385172['model'],qs[_0x1f49('0x39')](_0x4f6272[_0x1f49('0x34')][_0x1f49('0x39')]));_0x1ada46[_0x1f49('0x38')]=_0x1ada46[_0x1f49('0x38')][_0x1f49('0x3a')]?_0x1ada46[_0x1f49('0x38')]:_0x385172['model'];if(_0x4f6272[_0x1f49('0x34')][_0x1f49('0x44')]){_0x1ada46[_0x1f49('0x48')]=[{'all':!![]}];}_0x1ada46=_[_0x1f49('0x42')]({},_0x1ada46,_0x4f6272[_0x1f49('0x43')]);return db[_0x1f49('0x2e')][_0x1f49('0x49')](_0x1ada46)[_0x1f49('0x28')](handleEntityNotFound(_0x42fdce,null))[_0x1f49('0x28')](respondWithResult(_0x42fdce,null))[_0x1f49('0x45')](handleError(_0x42fdce,null));};exports[_0x1f49('0x4a')]=function(_0x2b960b,_0x157381){return db[_0x1f49('0x2e')]['create'](_0x2b960b[_0x1f49('0x4b')],{})[_0x1f49('0x28')](function(_0x2648ec){var _0x39da01=_0x2b960b['user'][_0x1f49('0x25')]({'plain':!![]});if(!_0x39da01)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39da01[_0x1f49('0x4c')]==='user'){var _0x521442=_0x2648ec[_0x1f49('0x25')]({'plain':!![]});var _0x172b23=_0x1f49('0x26');return db[_0x1f49('0x4d')][_0x1f49('0x49')]({'where':{'name':_0x172b23,'userProfileId':_0x39da01['userProfileId']},'raw':!![]})[_0x1f49('0x28')](function(_0x37035d){if(_0x37035d&&_0x37035d[_0x1f49('0x4e')]===0x0){return db[_0x1f49('0x27')]['create']({'name':_0x521442[_0x1f49('0x2b')],'resourceId':_0x521442['id'],'type':_0x37035d[_0x1f49('0x2b')],'sectionId':_0x37035d['id']},{})[_0x1f49('0x28')](function(){return _0x2648ec;});}else{return _0x2648ec;}})[_0x1f49('0x45')](function(_0x32b4bf){logger[_0x1f49('0x4f')](_0x1f49('0x50'),_0x32b4bf);throw _0x32b4bf;});}return _0x2648ec;})[_0x1f49('0x28')](respondWithResult(_0x157381,0xc9))['catch'](handleError(_0x157381,null));};exports[_0x1f49('0x23')]=function(_0xf1472c,_0x1bd35c){if(_0xf1472c[_0x1f49('0x4b')]['id']){delete _0xf1472c[_0x1f49('0x4b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0xf1472c['params']['id']}})[_0x1f49('0x28')](handleEntityNotFound(_0x1bd35c,null))[_0x1f49('0x28')](saveUpdates(_0xf1472c[_0x1f49('0x4b')],null))[_0x1f49('0x28')](respondWithResult(_0x1bd35c,null))[_0x1f49('0x45')](handleError(_0x1bd35c,null));};exports[_0x1f49('0x24')]=function(_0x53769c,_0x458848){return db[_0x1f49('0x2e')][_0x1f49('0x49')]({'where':{'id':_0x53769c[_0x1f49('0x46')]['id']}})[_0x1f49('0x28')](handleEntityNotFound(_0x458848,null))[_0x1f49('0x28')](removeEntity(_0x458848,null))[_0x1f49('0x45')](handleError(_0x458848,null));};exports[_0x1f49('0x51')]=function(_0x464cf9,_0x3c6258){return db[_0x1f49('0x2e')][_0x1f49('0x51')]()[_0x1f49('0x28')](respondWithResult(_0x3c6258,null))[_0x1f49('0x45')](handleError(_0x3c6258,null));};exports[_0x1f49('0x52')]=function(_0x37468d,_0x6e93fe,_0x2c2467){var _0x17ac6b={'raw':!![],'where':{}},_0x531bc5={},_0x29dfa9;return db[_0x1f49('0x2e')][_0x1f49('0x53')]({'where':{'id':_0x37468d[_0x1f49('0x46')]['id']}})[_0x1f49('0x28')](handleEntityNotFound(_0x6e93fe,null))[_0x1f49('0x28')](function(_0x5d2583){if(_0x5d2583){_0x29dfa9=_0x5d2583[_0x1f49('0x25')]({'plain':!![]});_0x531bc5[_0x1f49('0x33')]=_[_0x1f49('0x35')](db[_0x1f49('0x54')][_0x1f49('0x2f')]);_0x531bc5[_0x1f49('0x34')]=_[_0x1f49('0x35')](_0x37468d[_0x1f49('0x34')]);_0x531bc5[_0x1f49('0x36')]=_[_0x1f49('0x37')](_0x531bc5[_0x1f49('0x33')],_0x531bc5['query']);_0x17ac6b['attributes']=_[_0x1f49('0x37')](_0x531bc5[_0x1f49('0x33')],qs[_0x1f49('0x39')](_0x37468d[_0x1f49('0x34')]['fields']));_0x17ac6b[_0x1f49('0x38')]=_0x17ac6b[_0x1f49('0x38')]['length']?_0x17ac6b['attributes']:_0x531bc5[_0x1f49('0x33')];if(!_0x37468d[_0x1f49('0x34')][_0x1f49('0x55')]('nolimit')){_0x17ac6b[_0x1f49('0x1d')]=qs[_0x1f49('0x1d')](_0x37468d[_0x1f49('0x34')][_0x1f49('0x1d')]);_0x17ac6b[_0x1f49('0x1c')]=qs[_0x1f49('0x1c')](_0x37468d[_0x1f49('0x34')]['offset']);}_0x17ac6b[_0x1f49('0x3c')]=qs[_0x1f49('0x3d')](_0x37468d[_0x1f49('0x34')]['sort']);_0x17ac6b[_0x1f49('0x40')]=qs[_0x1f49('0x36')](_[_0x1f49('0x3e')](_0x37468d['query'],_0x531bc5[_0x1f49('0x36')]));_0x17ac6b[_0x1f49('0x40')][_0x1f49('0x56')]=_0x5d2583['id'];if(_0x37468d[_0x1f49('0x34')][_0x1f49('0x3f')]){_0x17ac6b[_0x1f49('0x40')]=_[_0x1f49('0x42')](_0x17ac6b[_0x1f49('0x40')],{'$or':_[_0x1f49('0x2d')](_0x17ac6b[_0x1f49('0x38')],function(_0x29445b){var _0x419f3d={};_0x419f3d[_0x29445b]={'$like':'%'+_0x37468d[_0x1f49('0x34')][_0x1f49('0x3f')]+'%'};return _0x419f3d;})});}_0x17ac6b=_[_0x1f49('0x42')]({},_0x17ac6b,_0x37468d[_0x1f49('0x43')]);return db['UserSmsQueue'][_0x1f49('0x57')](_0x17ac6b);}})[_0x1f49('0x28')](function(_0x4c46a4){if(_0x4c46a4){return db[_0x1f49('0x58')][_0x1f49('0x59')]({'where':{'id':_[_0x1f49('0x2d')](_0x4c46a4,'UserId'),'role':_0x1f49('0x5a')},'attributes':['id',_0x1f49('0x2b'),_0x1f49('0x5b'),_0x1f49('0x5c'),_0x1f49('0x5d')]});}})['then'](function(_0x18ba30){if(_0x18ba30){return{'count':_0x18ba30[_0x1f49('0x1b')],'rows':_['map'](_0x18ba30[_0x1f49('0x5e')],function(_0x516f50){return{'membername':_0x516f50[_0x1f49('0x2b')],'UserId':_0x516f50['id'],'queue_name':_0x29dfa9['name'],'SmsQueueId':_0x29dfa9['id'],'interface':util[_0x1f49('0x5f')](_0x1f49('0x60'),_0x1f49('0x61'),_0x516f50[_0x1f49('0x2b')]),'penalty':0x0,'paused':_0x516f50[_0x1f49('0x5b')],'createdAt':_0x516f50[_0x1f49('0x5d')],'updatedAt':_0x516f50[_0x1f49('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x6e93fe,_0x17ac6b))[_0x1f49('0x45')](handleError(_0x6e93fe,null));};exports[_0x1f49('0x62')]=function(_0x495737,_0x30c828,_0x33e991){var _0x3e773b={};var _0x8be58={};var _0x1cba6f;var _0x21fd0f;return db[_0x1f49('0x2e')][_0x1f49('0x53')]({'where':{'id':_0x495737[_0x1f49('0x46')]['id']}})['then'](handleEntityNotFound(_0x30c828,null))['then'](function(_0x4ab42c){if(_0x4ab42c){_0x1cba6f=_0x4ab42c;_0x8be58['model']=_[_0x1f49('0x35')](db[_0x1f49('0x63')]['rawAttributes']);_0x8be58[_0x1f49('0x34')]=_['keys'](_0x495737[_0x1f49('0x34')]);_0x8be58[_0x1f49('0x36')]=_['intersection'](_0x8be58[_0x1f49('0x33')],_0x8be58[_0x1f49('0x34')]);_0x3e773b['attributes']=_[_0x1f49('0x37')](_0x8be58[_0x1f49('0x33')],qs[_0x1f49('0x39')](_0x495737[_0x1f49('0x34')][_0x1f49('0x39')]));_0x3e773b[_0x1f49('0x38')]=_0x3e773b[_0x1f49('0x38')]['length']?_0x3e773b['attributes']:_0x8be58[_0x1f49('0x33')];_0x3e773b[_0x1f49('0x3c')]=qs[_0x1f49('0x3d')](_0x495737[_0x1f49('0x34')][_0x1f49('0x3d')]);_0x3e773b['where']=qs[_0x1f49('0x36')](_[_0x1f49('0x3e')](_0x495737['query'],_0x8be58[_0x1f49('0x36')]));if(_0x495737[_0x1f49('0x34')]['filter']){_0x3e773b[_0x1f49('0x40')]=_['merge'](_0x3e773b[_0x1f49('0x40')],{'$or':_[_0x1f49('0x2d')](_0x3e773b[_0x1f49('0x38')],function(_0x3a6e9e){var _0x300550={};_0x300550[_0x3a6e9e]={'$like':'%'+_0x495737[_0x1f49('0x34')]['filter']+'%'};return _0x300550;})});}_0x3e773b=_[_0x1f49('0x42')]({},_0x3e773b,_0x495737[_0x1f49('0x43')]);return _0x1cba6f[_0x1f49('0x62')](_0x3e773b);}})['then'](function(_0x19f5f9){if(_0x19f5f9){_0x21fd0f=_0x19f5f9[_0x1f49('0x3a')];if(!_0x495737['query']['hasOwnProperty'](_0x1f49('0x3b'))){_0x3e773b['limit']=qs[_0x1f49('0x1d')](_0x495737[_0x1f49('0x34')]['limit']);_0x3e773b[_0x1f49('0x1c')]=qs['offset'](_0x495737[_0x1f49('0x34')][_0x1f49('0x1c')]);}return _0x1cba6f[_0x1f49('0x62')](_0x3e773b);}})[_0x1f49('0x28')](function(_0x5605e7){if(_0x5605e7){return _0x5605e7?{'count':_0x21fd0f,'rows':_0x5605e7}:null;}})[_0x1f49('0x28')](respondWithResult(_0x30c828,null))['catch'](handleError(_0x30c828,null));};exports[_0x1f49('0x64')]=function(_0x345eac,_0x46e2cc,_0x5ce241){var _0x4d9065=_0x345eac[_0x1f49('0x4b')]['ids'];return db['Team'][_0x1f49('0x57')]({'where':{'id':_0x4d9065},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1f49('0x65'),'attributes':['id',_0x1f49('0x2b'),'online',_0x1f49('0x66'),_0x1f49('0x67')],'raw':!![]}]})['then'](function(_0x34cf7d){if(_0x34cf7d){var _0x3b71c6=_['flatMap'](_0x34cf7d,function(_0x3abaac){var _0x5909fd=_0x3abaac[_0x1f49('0x25')]({'plain':!![]});return _0x5909fd['Agents'];});return db[_0x1f49('0x2e')][_0x1f49('0x49')]({'where':{'id':_0x345eac[_0x1f49('0x46')]['id']}})[_0x1f49('0x28')](function(_0x4f6fa6){return db['sequelize'][_0x1f49('0x68')](function(_0x472c68){return _0x4f6fa6[_0x1f49('0x64')](_0x4d9065,{'transaction':_0x472c68})['then'](function(){return BPromise[_0x1f49('0x69')](_0x3b71c6,function(_0x4acc7a){return db[_0x1f49('0x54')][_0x1f49('0x6a')]({'where':{'UserId':_0x4acc7a['id'],'SmsQueueId':_0x345eac['params']['id']},'transaction':_0x472c68});});})[_0x1f49('0x28')](function(){_0x3b71c6[_0x1f49('0x6b')](function(_0x56a99e){socket[_0x1f49('0x6c')](_0x1f49('0x6d'),{'UserId':_0x56a99e['id'],'SmsQueueId':_0x4f6fa6['id']});});});});});}})[_0x1f49('0x28')](respondWithStatusCode(_0x46e2cc,null))[_0x1f49('0x45')](handleError(_0x46e2cc,null));};exports[_0x1f49('0x6e')]=function(_0x174874,_0x2b3c78,_0x2b9497){return db[_0x1f49('0x63')][_0x1f49('0x57')]({'where':{'id':_0x174874[_0x1f49('0x34')][_0x1f49('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x1f49('0x58')],'as':_0x1f49('0x65'),'attributes':['id'],'raw':!![]}]})[_0x1f49('0x28')](handleEntityNotFound(_0x2b3c78,null))['then'](function(_0x47542e){var _0x11ec03=_['map'](_0x47542e,'id');var _0x375831=[];var _0x30b19d=[];var _0x2c3264=squel[_0x1f49('0x70')]();_0x2c3264['field']('tq.TeamId')[_0x1f49('0x71')]('team_has_sms_queues','tq')[_0x1f49('0x72')](_0x1f49('0x73'),'ut',_0x1f49('0x74'))['where'](_0x1f49('0x75'),_0x174874[_0x1f49('0x46')]['id']);for(var _0x2a8f18=0x0;_0x2a8f18<_0x47542e[_0x1f49('0x3a')];_0x2a8f18+=0x1){let _0x4c650d=_0x47542e[_0x2a8f18];for(var _0x14f3e4=0x0;_0x14f3e4<_0x4c650d['Agents'][_0x1f49('0x3a')];_0x14f3e4+=0x1){let _0x132f95=_0x4c650d[_0x1f49('0x65')][_0x14f3e4];var _0x2c8e87=_0x2c3264[_0x1f49('0x76')]();_0x2c8e87[_0x1f49('0x40')](_0x1f49('0x77'),_0x132f95['id']);_0x30b19d[_0x1f49('0x78')](db[_0x1f49('0x79')][_0x1f49('0x34')](_0x2c8e87['toString'](),{'type':db['sequelize']['QueryTypes'][_0x1f49('0x7a')]})[_0x1f49('0x28')](function(_0x4e9e07){if(_0x4e9e07[_0x1f49('0x3a')]===0x1){return _0x132f95['id'];}else{var _0x2c1986=_[_0x1f49('0x7b')](_['map'](_0x4e9e07,'TeamId'),function(_0x5e6d72){return _['includes'](_0x11ec03,_0x5e6d72);});if(_0x2c1986){return _0x132f95['id'];}}}));}}return BPromise[_0x1f49('0x7c')](_0x30b19d)['then'](function(_0x2b43b7){_0x375831=_(_0x375831)['union'](_0x2b43b7)[_0x1f49('0x7d')]()[_0x1f49('0x7e')]();return db[_0x1f49('0x2e')][_0x1f49('0x49')]({'where':{'id':_0x174874[_0x1f49('0x46')]['id']}})[_0x1f49('0x28')](function(_0xbcfb3f){return db['sequelize'][_0x1f49('0x68')](function(_0x12cfd0){return _0xbcfb3f['removeTeams'](_0x174874[_0x1f49('0x34')][_0x1f49('0x6f')],{'transaction':_0x12cfd0})['then'](function(){if(!_[_0x1f49('0x7f')](_0x375831)){return _0xbcfb3f[_0x1f49('0x80')](_0x375831,{'transaction':_0x12cfd0});}})[_0x1f49('0x28')](function(){_0x375831[_0x1f49('0x6b')](function(_0x96b970){socket[_0x1f49('0x6c')](_0x1f49('0x81'),{'UserId':_0x96b970,'SmsQueueId':_0xbcfb3f['id']});});});});});});})[_0x1f49('0x28')](respondWithStatusCode(_0x2b3c78,null))[_0x1f49('0x45')](handleError(_0x2b3c78,null));};exports['addAgents']=function(_0x149ad2,_0x5a3d87,_0x10e2f6){return db[_0x1f49('0x2e')][_0x1f49('0x49')]({'where':{'id':_0x149ad2[_0x1f49('0x46')]['id']}})[_0x1f49('0x28')](handleEntityNotFound(_0x5a3d87,null))[_0x1f49('0x28')](function(_0x1a5eaa){if(_0x1a5eaa){return _0x1a5eaa['addAgents'](_0x149ad2[_0x1f49('0x4b')]['ids'],_['omit'](_0x149ad2[_0x1f49('0x4b')],[_0x1f49('0x6f'),'id'])||{})[_0x1f49('0x82')](function(_0x58fecb){for(var _0xefc551=0x0;_0xefc551<_0x149ad2['body'][_0x1f49('0x6f')][_0x1f49('0x3a')];_0xefc551+=0x1){socket[_0x1f49('0x6c')](_0x1f49('0x6d'),{'UserId':_0x149ad2[_0x1f49('0x4b')][_0x1f49('0x6f')][_0xefc551],'SmsQueueId':_0x149ad2[_0x1f49('0x46')]['id']});}return _0x58fecb;});}})[_0x1f49('0x28')](respondWithResult(_0x5a3d87,null))[_0x1f49('0x45')](handleError(_0x5a3d87,null));};exports[_0x1f49('0x80')]=function(_0x47e0bb,_0x10ea1e,_0x3f9310){return db[_0x1f49('0x2e')]['find']({'where':{'id':_0x47e0bb[_0x1f49('0x46')]['id']}})[_0x1f49('0x28')](handleEntityNotFound(_0x10ea1e,null))[_0x1f49('0x28')](function(_0x1da767){if(_0x1da767){return _0x1da767[_0x1f49('0x80')](_0x47e0bb[_0x1f49('0x34')][_0x1f49('0x6f')])[_0x1f49('0x28')](function(){if(_[_0x1f49('0x83')](_0x47e0bb[_0x1f49('0x34')][_0x1f49('0x6f')])){for(var _0x55c73d=0x0;_0x55c73d<_0x47e0bb['query'][_0x1f49('0x6f')]['length'];_0x55c73d+=0x1){socket[_0x1f49('0x6c')](_0x1f49('0x81'),{'UserId':Number(_0x47e0bb[_0x1f49('0x34')][_0x1f49('0x6f')][_0x55c73d]),'SmsQueueId':Number(_0x47e0bb[_0x1f49('0x46')]['id'])});}}else{socket['emit'](_0x1f49('0x81'),{'UserId':Number(_0x47e0bb[_0x1f49('0x34')][_0x1f49('0x6f')]),'SmsQueueId':Number(_0x47e0bb['params']['id'])});}});}})[_0x1f49('0x28')](respondWithStatusCode(_0x10ea1e,null))['catch'](handleError(_0x10ea1e,null));};exports['getAgents']=function(_0x162450,_0x2acfa8,_0x289c4a){var _0x31e01d={};var _0x528f72={};var _0x542340;var _0x244504;return db[_0x1f49('0x2e')][_0x1f49('0x53')]({'where':{'id':_0x162450[_0x1f49('0x46')]['id']}})[_0x1f49('0x28')](handleEntityNotFound(_0x2acfa8,null))[_0x1f49('0x28')](function(_0x4f5206){if(_0x4f5206){_0x542340=_0x4f5206;_0x528f72[_0x1f49('0x33')]=_[_0x1f49('0x35')](db['User'][_0x1f49('0x2f')]);_0x528f72[_0x1f49('0x34')]=_[_0x1f49('0x35')](_0x162450[_0x1f49('0x34')]);_0x528f72[_0x1f49('0x36')]=_[_0x1f49('0x37')](_0x528f72[_0x1f49('0x33')],_0x528f72['query']);_0x31e01d['attributes']=_[_0x1f49('0x37')](_0x528f72[_0x1f49('0x33')],qs[_0x1f49('0x39')](_0x162450[_0x1f49('0x34')][_0x1f49('0x39')]));_0x31e01d[_0x1f49('0x38')]=_0x31e01d['attributes'][_0x1f49('0x3a')]?_0x31e01d['attributes']:_0x528f72['model'];_0x31e01d[_0x1f49('0x3c')]=qs[_0x1f49('0x3d')](_0x162450[_0x1f49('0x34')]['sort']);_0x31e01d['where']=qs[_0x1f49('0x36')](_['pick'](_0x162450[_0x1f49('0x34')],_0x528f72[_0x1f49('0x36')]));if(_0x162450['query']['filter']){_0x31e01d[_0x1f49('0x40')]=_[_0x1f49('0x42')](_0x31e01d['where'],{'$or':_[_0x1f49('0x2d')](_0x31e01d[_0x1f49('0x38')],function(_0x369e13){var _0x33c859={};_0x33c859[_0x369e13]={'$like':'%'+_0x162450[_0x1f49('0x34')]['filter']+'%'};return _0x33c859;})});}_0x31e01d=_[_0x1f49('0x42')]({},_0x31e01d,_0x162450[_0x1f49('0x43')]);return _0x542340['getAgents'](_0x31e01d);}})[_0x1f49('0x28')](function(_0xa39a45){if(_0xa39a45){_0x244504=_0xa39a45[_0x1f49('0x3a')];if(!_0x162450[_0x1f49('0x34')][_0x1f49('0x55')]('nolimit')){_0x31e01d[_0x1f49('0x1d')]=qs[_0x1f49('0x1d')](_0x162450[_0x1f49('0x34')][_0x1f49('0x1d')]);_0x31e01d[_0x1f49('0x1c')]=qs[_0x1f49('0x1c')](_0x162450['query'][_0x1f49('0x1c')]);}return _0x542340[_0x1f49('0x84')](_0x31e01d);}})[_0x1f49('0x28')](function(_0x441253){if(_0x441253){return _0x441253?{'count':_0x244504,'rows':_0x441253}:null;}})['then'](respondWithResult(_0x2acfa8,null))[_0x1f49('0x45')](handleError(_0x2acfa8,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index a7321ef..8505513 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 _0x9232=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x31a8a7,_0x3e412b){var _0x570eec=function(_0x1423a3){while(--_0x1423a3){_0x31a8a7['push'](_0x31a8a7['shift']());}};_0x570eec(++_0x3e412b);}(_0x9232,0x75));var _0x2923=function(_0x53bac3,_0x52b117){_0x53bac3=_0x53bac3-0x0;var _0x33b1c7=_0x9232[_0x53bac3];return _0x33b1c7;};'use strict';var EventEmitter=require(_0x2923('0x0'));var SmsQueue=require(_0x2923('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x2923('0x2')](0x0);var events={'afterCreate':_0x2923('0x3'),'afterUpdate':'update','afterDestroy':_0x2923('0x4')};function emitEvent(_0x5ba814){return function(_0x28b4e1,_0x4364ff,_0x5b6751){SmsQueueEvents[_0x2923('0x5')](_0x5ba814+':'+_0x28b4e1['id'],_0x28b4e1);SmsQueueEvents[_0x2923('0x5')](_0x5ba814,_0x28b4e1);_0x5b6751(null);};}for(var e in events){if(events[_0x2923('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x2923('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x56c8=['../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x56c8,0x170));var _0x856c=function(_0x2118e0,_0x545eb4){_0x2118e0=_0x2118e0-0x0;var _0x41c61d=_0x56c8[_0x2118e0];return _0x41c61d;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x856c('0x0'))['db'][_0x856c('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x856c('0x2')](0x0);var events={'afterCreate':_0x856c('0x3'),'afterUpdate':_0x856c('0x4'),'afterDestroy':_0x856c('0x5')};function emitEvent(_0x58d729){return function(_0x5b2881,_0x1b96d3,_0x45f583){SmsQueueEvents[_0x856c('0x6')](_0x58d729+':'+_0x5b2881['id'],_0x5b2881);SmsQueueEvents['emit'](_0x58d729,_0x5b2881);_0x45f583(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x856c('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index c243819..ee5fb40 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 _0x83cd=['sms_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define'];(function(_0x34f6bd,_0x21fb3c){var _0x2b4340=function(_0x5970d8){while(--_0x5970d8){_0x34f6bd['push'](_0x34f6bd['shift']());}};_0x2b4340(++_0x21fb3c);}(_0x83cd,0x1d5));var _0xd83c=function(_0x31c795,_0x46aac6){_0x31c795=_0x31c795-0x0;var _0x156547=_0x83cd[_0x31c795];return _0x156547;};'use strict';var _=require(_0xd83c('0x0'));var util=require(_0xd83c('0x1'));var logger=require(_0xd83c('0x2'))(_0xd83c('0x3'));var moment=require(_0xd83c('0x4'));var BPromise=require(_0xd83c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd83c('0x6'));var rimraf=require(_0xd83c('0x7'));var config=require(_0xd83c('0x8'));var attributes=require(_0xd83c('0x9'));module[_0xd83c('0xa')]=function(_0x3a0bdd,_0x266349){return _0x3a0bdd[_0xd83c('0xb')]('SmsQueue',attributes,{'tableName':_0xd83c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc928=['define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x51ed46,_0x4b7ad2){var _0xc2b1e7=function(_0x43ec08){while(--_0x43ec08){_0x51ed46['push'](_0x51ed46['shift']());}};_0xc2b1e7(++_0x4b7ad2);}(_0xc928,0xe0));var _0x8c92=function(_0x2f5db9,_0x39c03f){_0x2f5db9=_0x2f5db9-0x0;var _0x41a6d6=_0xc928[_0x2f5db9];return _0x41a6d6;};'use strict';var _=require(_0x8c92('0x0'));var util=require(_0x8c92('0x1'));var logger=require(_0x8c92('0x2'))(_0x8c92('0x3'));var moment=require(_0x8c92('0x4'));var BPromise=require(_0x8c92('0x5'));var rp=require(_0x8c92('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c92('0x7'));var config=require(_0x8c92('0x8'));var attributes=require('./smsQueue.attributes');module[_0x8c92('0x9')]=function(_0x142f69,_0x45d083){return _0x142f69[_0x8c92('0xa')](_0x8c92('0xb'),attributes,{'tableName':_0x8c92('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index bfb924c..86ed724 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 _0x7a3d=['SmsQueue','options','attributes','limit','map','include','model','catch','ShowSmsQueue','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetSmsQueue'];(function(_0x2b281a,_0x4f642d){var _0x58b740=function(_0x3ae91f){while(--_0x3ae91f){_0x2b281a['push'](_0x2b281a['shift']());}};_0x58b740(++_0x4f642d);}(_0x7a3d,0xee));var _0xd7a3=function(_0x45258c,_0x3aa165){_0x45258c=_0x45258c-0x0;var _0x4caede=_0x7a3d[_0x45258c];return _0x4caede;};'use strict';var _=require('lodash');var util=require(_0xd7a3('0x0'));var moment=require('moment');var BPromise=require(_0xd7a3('0x1'));var rs=require(_0xd7a3('0x2'));var fs=require('fs');var Redis=require(_0xd7a3('0x3'));var db=require(_0xd7a3('0x4'))['db'];var utils=require(_0xd7a3('0x5'));var logger=require(_0xd7a3('0x6'))('rpc');var config=require(_0xd7a3('0x7'));var jayson=require(_0xd7a3('0x8'));var client=jayson['client'][_0xd7a3('0x9')]({'port':0x232a});config['redis']=_[_0xd7a3('0xa')](config[_0xd7a3('0xb')],{'host':_0xd7a3('0xc'),'port':0x18eb});var socket=require(_0xd7a3('0xd'))(new Redis(config['redis']));require(_0xd7a3('0xe'))[_0xd7a3('0xf')](socket);function respondWithRpcPromise(_0x302bce,_0x315c42,_0x2b628a){return new BPromise(function(_0x299eae,_0x30e774){return client[_0xd7a3('0x10')](_0x302bce,_0x2b628a)[_0xd7a3('0x11')](function(_0xe2f56e){logger[_0xd7a3('0x12')](_0xd7a3('0x13'),_0x315c42,_0xd7a3('0x14'));logger[_0xd7a3('0x15')](_0xd7a3('0x16'),_0x315c42,'request\x20sent',JSON[_0xd7a3('0x17')](_0xe2f56e));if(_0xe2f56e[_0xd7a3('0x18')]){if(_0xe2f56e[_0xd7a3('0x18')][_0xd7a3('0x19')]===0x1f4){logger['error'](_0xd7a3('0x13'),_0x315c42,_0xe2f56e[_0xd7a3('0x18')][_0xd7a3('0x1a')]);return _0x30e774(_0xe2f56e[_0xd7a3('0x18')]['message']);}logger[_0xd7a3('0x18')](_0xd7a3('0x13'),_0x315c42,_0xe2f56e['error'][_0xd7a3('0x1a')]);return _0x299eae(_0xe2f56e[_0xd7a3('0x18')][_0xd7a3('0x1a')]);}else{logger['info'](_0xd7a3('0x13'),_0x315c42,'request\x20sent');_0x299eae(_0xe2f56e['result']['message']);}})['catch'](function(_0x1d480d){logger['error'](_0xd7a3('0x13'),_0x315c42,_0x1d480d);_0x30e774(_0x1d480d);});});}exports[_0xd7a3('0x1b')]=function(_0x1ded26){var _0x3893fa=this;return new Promise(function(_0x109e52,_0x4fe22f){return db[_0xd7a3('0x1c')]['findAll']({'raw':_0x1ded26[_0xd7a3('0x1d')]?_0x1ded26[_0xd7a3('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1ded26['options']?_0x1ded26[_0xd7a3('0x1d')]['where']||null:null,'attributes':_0x1ded26[_0xd7a3('0x1d')]?_0x1ded26[_0xd7a3('0x1d')][_0xd7a3('0x1e')]||null:null,'limit':_0x1ded26[_0xd7a3('0x1d')]?_0x1ded26[_0xd7a3('0x1d')][_0xd7a3('0x1f')]||null:null,'include':_0x1ded26[_0xd7a3('0x1d')]?_0x1ded26[_0xd7a3('0x1d')]['include']?_[_0xd7a3('0x20')](_0x1ded26[_0xd7a3('0x1d')][_0xd7a3('0x21')],function(_0x328490){return{'model':db[_0x328490[_0xd7a3('0x22')]],'as':_0x328490['as'],'attributes':_0x328490[_0xd7a3('0x1e')],'include':_0x328490['include']?_[_0xd7a3('0x20')](_0x328490[_0xd7a3('0x21')],function(_0x4d782d){return{'model':db[_0x4d782d[_0xd7a3('0x22')]],'as':_0x4d782d['as'],'attributes':_0x4d782d[_0xd7a3('0x1e')],'include':_0x4d782d['include']?_[_0xd7a3('0x20')](_0x4d782d['include'],function(_0xd58573){return{'model':db[_0xd58573[_0xd7a3('0x22')]],'as':_0xd58573['as'],'attributes':_0xd58573[_0xd7a3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd7a3('0x11')](function(_0x4b3b23){logger[_0xd7a3('0x12')](_0xd7a3('0x1b'),_0x1ded26);logger[_0xd7a3('0x15')](_0xd7a3('0x1b'),_0x1ded26,JSON[_0xd7a3('0x17')](_0x4b3b23));_0x109e52(_0x4b3b23);})[_0xd7a3('0x23')](function(_0x257aad){logger[_0xd7a3('0x18')](_0xd7a3('0x1b'),_0x257aad[_0xd7a3('0x1a')],_0x1ded26);_0x4fe22f(_0x3893fa[_0xd7a3('0x18')](0x1f4,_0x257aad[_0xd7a3('0x1a')]));});});};exports[_0xd7a3('0x24')]=function(_0x4191be){var _0x554502=this;return new Promise(function(_0x2e62e9,_0x115489){return db[_0xd7a3('0x1c')]['find']({'raw':_0x4191be[_0xd7a3('0x1d')]?_0x4191be['options'][_0xd7a3('0x25')]===undefined?!![]:![]:!![],'where':_0x4191be['options']?_0x4191be[_0xd7a3('0x1d')]['where']||null:null,'attributes':_0x4191be[_0xd7a3('0x1d')]?_0x4191be['options']['attributes']||null:null,'include':_0x4191be[_0xd7a3('0x1d')]?_0x4191be['options']['include']?_[_0xd7a3('0x20')](_0x4191be[_0xd7a3('0x1d')]['include'],function(_0x54e955){return{'model':db[_0x54e955[_0xd7a3('0x22')]],'as':_0x54e955['as'],'attributes':_0x54e955[_0xd7a3('0x1e')],'include':_0x54e955[_0xd7a3('0x21')]?_[_0xd7a3('0x20')](_0x54e955['include'],function(_0x584970){return{'model':db[_0x584970[_0xd7a3('0x22')]],'as':_0x584970['as'],'attributes':_0x584970[_0xd7a3('0x1e')],'include':_0x584970['include']?_[_0xd7a3('0x20')](_0x584970[_0xd7a3('0x21')],function(_0x381a86){return{'model':db[_0x381a86[_0xd7a3('0x22')]],'as':_0x381a86['as'],'attributes':_0x381a86['attributes']};}):[]};}):[]};}):[]:[]})[_0xd7a3('0x11')](function(_0x1f88d1){logger['info'](_0xd7a3('0x24'),_0x4191be);logger[_0xd7a3('0x15')](_0xd7a3('0x24'),_0x4191be,JSON[_0xd7a3('0x17')](_0x1f88d1));_0x2e62e9(_0x1f88d1);})[_0xd7a3('0x23')](function(_0x256be0){logger[_0xd7a3('0x18')](_0xd7a3('0x24'),_0x256be0['message'],_0x4191be);_0x115489(_0x554502[_0xd7a3('0x18')](0x1f4,_0x256be0[_0xd7a3('0x1a')]));});});}; \ No newline at end of file +var _0xbf1b=['../../config/environment','jayson/promise','client','http','redis','defaults','./smsQueue.socket','register','request','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetSmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','ShowSmsQueue','SmsQueue','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2d24f6,_0x1223e1){var _0x317569=function(_0x5b0cd1){while(--_0x5b0cd1){_0x2d24f6['push'](_0x2d24f6['shift']());}};_0x317569(++_0x1223e1);}(_0xbf1b,0x76));var _0xbbf1=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xbf1b[_0x4b7895];return _0x264180;};'use strict';var _=require('lodash');var util=require(_0xbbf1('0x0'));var moment=require(_0xbbf1('0x1'));var BPromise=require(_0xbbf1('0x2'));var rs=require(_0xbbf1('0x3'));var fs=require('fs');var Redis=require(_0xbbf1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbbf1('0x5'));var logger=require(_0xbbf1('0x6'))(_0xbbf1('0x7'));var config=require(_0xbbf1('0x8'));var jayson=require(_0xbbf1('0x9'));var client=jayson[_0xbbf1('0xa')][_0xbbf1('0xb')]({'port':0x232a});config[_0xbbf1('0xc')]=_[_0xbbf1('0xd')](config[_0xbbf1('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbbf1('0xc')]));require(_0xbbf1('0xe'))[_0xbbf1('0xf')](socket);function respondWithRpcPromise(_0x5c0257,_0x1419d4,_0x314c68){return new BPromise(function(_0x44f7a6,_0x409cca){return client[_0xbbf1('0x10')](_0x5c0257,_0x314c68)['then'](function(_0x3222d8){logger['info'](_0xbbf1('0x11'),_0x1419d4,_0xbbf1('0x12'));logger[_0xbbf1('0x13')](_0xbbf1('0x14'),_0x1419d4,'request\x20sent',JSON[_0xbbf1('0x15')](_0x3222d8));if(_0x3222d8[_0xbbf1('0x16')]){if(_0x3222d8[_0xbbf1('0x16')][_0xbbf1('0x17')]===0x1f4){logger[_0xbbf1('0x16')]('SmsQueue,\x20%s,\x20%s',_0x1419d4,_0x3222d8['error'][_0xbbf1('0x18')]);return _0x409cca(_0x3222d8[_0xbbf1('0x16')][_0xbbf1('0x18')]);}logger[_0xbbf1('0x16')]('SmsQueue,\x20%s,\x20%s',_0x1419d4,_0x3222d8['error'][_0xbbf1('0x18')]);return _0x44f7a6(_0x3222d8[_0xbbf1('0x16')][_0xbbf1('0x18')]);}else{logger[_0xbbf1('0x19')](_0xbbf1('0x11'),_0x1419d4,_0xbbf1('0x12'));_0x44f7a6(_0x3222d8[_0xbbf1('0x1a')][_0xbbf1('0x18')]);}})['catch'](function(_0x251317){logger[_0xbbf1('0x16')]('SmsQueue,\x20%s,\x20%s',_0x1419d4,_0x251317);_0x409cca(_0x251317);});});}exports[_0xbbf1('0x1b')]=function(_0x3ae961){var _0x1ea2c3=this;return new Promise(function(_0x4a8ca7,_0x1ea368){return db['SmsQueue'][_0xbbf1('0x1c')]({'raw':_0x3ae961[_0xbbf1('0x1d')]?_0x3ae961[_0xbbf1('0x1d')][_0xbbf1('0x1e')]===undefined?!![]:![]:!![],'where':_0x3ae961['options']?_0x3ae961[_0xbbf1('0x1d')][_0xbbf1('0x1f')]||null:null,'attributes':_0x3ae961[_0xbbf1('0x1d')]?_0x3ae961['options'][_0xbbf1('0x20')]||null:null,'limit':_0x3ae961[_0xbbf1('0x1d')]?_0x3ae961[_0xbbf1('0x1d')][_0xbbf1('0x21')]||null:null,'include':_0x3ae961['options']?_0x3ae961[_0xbbf1('0x1d')][_0xbbf1('0x22')]?_[_0xbbf1('0x23')](_0x3ae961[_0xbbf1('0x1d')][_0xbbf1('0x22')],function(_0x4738a7){return{'model':db[_0x4738a7[_0xbbf1('0x24')]],'as':_0x4738a7['as'],'attributes':_0x4738a7[_0xbbf1('0x20')],'include':_0x4738a7[_0xbbf1('0x22')]?_[_0xbbf1('0x23')](_0x4738a7[_0xbbf1('0x22')],function(_0x5a59b8){return{'model':db[_0x5a59b8[_0xbbf1('0x24')]],'as':_0x5a59b8['as'],'attributes':_0x5a59b8['attributes'],'include':_0x5a59b8[_0xbbf1('0x22')]?_[_0xbbf1('0x23')](_0x5a59b8[_0xbbf1('0x22')],function(_0x2f892c){return{'model':db[_0x2f892c[_0xbbf1('0x24')]],'as':_0x2f892c['as'],'attributes':_0x2f892c['attributes']};}):[]};}):[]};}):[]:[]})[_0xbbf1('0x25')](function(_0x1c020b){logger['info']('GetSmsQueue',_0x3ae961);logger['debug']('GetSmsQueue',_0x3ae961,JSON[_0xbbf1('0x15')](_0x1c020b));_0x4a8ca7(_0x1c020b);})[_0xbbf1('0x26')](function(_0x507a59){logger['error'](_0xbbf1('0x1b'),_0x507a59[_0xbbf1('0x18')],_0x3ae961);_0x1ea368(_0x1ea2c3[_0xbbf1('0x16')](0x1f4,_0x507a59[_0xbbf1('0x18')]));});});};exports[_0xbbf1('0x27')]=function(_0x183b66){var _0x1bcf47=this;return new Promise(function(_0x582aba,_0x52566d){return db[_0xbbf1('0x28')][_0xbbf1('0x29')]({'raw':_0x183b66[_0xbbf1('0x1d')]?_0x183b66['options'][_0xbbf1('0x1e')]===undefined?!![]:![]:!![],'where':_0x183b66[_0xbbf1('0x1d')]?_0x183b66['options'][_0xbbf1('0x1f')]||null:null,'attributes':_0x183b66[_0xbbf1('0x1d')]?_0x183b66['options'][_0xbbf1('0x20')]||null:null,'include':_0x183b66[_0xbbf1('0x1d')]?_0x183b66['options'][_0xbbf1('0x22')]?_[_0xbbf1('0x23')](_0x183b66['options'][_0xbbf1('0x22')],function(_0x59ae91){return{'model':db[_0x59ae91[_0xbbf1('0x24')]],'as':_0x59ae91['as'],'attributes':_0x59ae91[_0xbbf1('0x20')],'include':_0x59ae91['include']?_[_0xbbf1('0x23')](_0x59ae91[_0xbbf1('0x22')],function(_0xd709e7){return{'model':db[_0xd709e7[_0xbbf1('0x24')]],'as':_0xd709e7['as'],'attributes':_0xd709e7['attributes'],'include':_0xd709e7[_0xbbf1('0x22')]?_[_0xbbf1('0x23')](_0xd709e7[_0xbbf1('0x22')],function(_0x352d08){return{'model':db[_0x352d08[_0xbbf1('0x24')]],'as':_0x352d08['as'],'attributes':_0x352d08[_0xbbf1('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a7cd6){logger[_0xbbf1('0x19')](_0xbbf1('0x27'),_0x183b66);logger[_0xbbf1('0x13')](_0xbbf1('0x27'),_0x183b66,JSON[_0xbbf1('0x15')](_0x3a7cd6));_0x582aba(_0x3a7cd6);})[_0xbbf1('0x26')](function(_0x3263f0){logger['error']('ShowSmsQueue',_0x3263f0['message'],_0x183b66);_0x52566d(_0x1bcf47['error'](0x1f4,_0x3263f0[_0xbbf1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 0979e22..b16d49f 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 _0x1281=['save','remove','update','emit','removeListener','register','smsQueue:'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0x1281,0xb6));var _0x1128=function(_0x48875f,_0x53597a){_0x48875f=_0x48875f-0x0;var _0xfe2308=_0x1281[_0x48875f];return _0xfe2308;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x1128('0x0'),_0x1128('0x1'),_0x1128('0x2')];function createListener(_0x4f88b8,_0x25fd8a){return function(_0x34b5ae){_0x25fd8a[_0x1128('0x3')](_0x4f88b8,_0x34b5ae);};}function removeListener(_0x2e194c,_0x2b92b8){return function(){SmsQueueEvents[_0x1128('0x4')](_0x2e194c,_0x2b92b8);};}exports[_0x1128('0x5')]=function(_0x1725d9){for(var _0x5d3ddb=0x0,_0x5b2688=events['length'];_0x5d3ddb<_0x5b2688;_0x5d3ddb++){var _0x3f3b58=events[_0x5d3ddb];var _0x249d35=createListener(_0x1128('0x6')+_0x3f3b58,_0x1725d9);SmsQueueEvents['on'](_0x3f3b58,_0x249d35);}}; \ No newline at end of file +var _0xfc66=['remove','update','removeListener','smsQueue:','./smsQueue.events','save'];(function(_0x247be6,_0x5a1359){var _0x28a4cf=function(_0x43ffa1){while(--_0x43ffa1){_0x247be6['push'](_0x247be6['shift']());}};_0x28a4cf(++_0x5a1359);}(_0xfc66,0xac));var _0x6fc6=function(_0x394e23,_0x2347dd){_0x394e23=_0x394e23-0x0;var _0x3e9d59=_0xfc66[_0x394e23];return _0x3e9d59;};'use strict';var SmsQueueEvents=require(_0x6fc6('0x0'));var events=[_0x6fc6('0x1'),_0x6fc6('0x2'),_0x6fc6('0x3')];function createListener(_0x13efdf,_0x521b54){return function(_0x365006){_0x521b54['emit'](_0x13efdf,_0x365006);};}function removeListener(_0x13135d,_0x52a168){return function(){SmsQueueEvents[_0x6fc6('0x4')](_0x13135d,_0x52a168);};}exports['register']=function(_0x61701d){for(var _0x45a741=0x0,_0x2b2c70=events['length'];_0x45a741<_0x2b2c70;_0x45a741++){var _0xe19b6f=events[_0x45a741];var _0xa4e2b3=createListener(_0x6fc6('0x5')+_0xe19b6f,_0x61701d);SmsQueueEvents['on'](_0xe19b6f,_0xa4e2b3);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 53cef6c..99f414b 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 _0x8173=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x8173,0x1d6));var _0x3817=function(_0x2eba27,_0x2c4cbd){_0x2eba27=_0x2eba27-0x0;var _0x2774a5=_0x8173[_0x2eba27];return _0x2774a5;};'use strict';var multer=require(_0x3817('0x0'));var util=require(_0x3817('0x1'));var path=require('path');var timeout=require(_0x3817('0x2'));var express=require(_0x3817('0x3'));var router=express[_0x3817('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3817('0x5'));var config=require(_0x3817('0x6'));var controller=require('./smsQueueReport.controller');router[_0x3817('0x7')]('/',auth[_0x3817('0x8')](),controller[_0x3817('0x9')]);router[_0x3817('0x7')](_0x3817('0xa'),auth[_0x3817('0x8')](),controller[_0x3817('0xb')]);router[_0x3817('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x3817('0xc')]);router[_0x3817('0xd')]('/',auth[_0x3817('0x8')](),controller['create']);router[_0x3817('0xe')](_0x3817('0xf'),auth[_0x3817('0x8')](),controller[_0x3817('0x10')]);router['delete'](_0x3817('0xf'),auth['isAuthenticated'](),controller[_0x3817('0x11')]);module[_0x3817('0x12')]=router; \ No newline at end of file +var _0xc23b=['multer','path','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe','describe','/:id','show','create','put','delete','destroy','exports'];(function(_0x719d5b,_0x4e7cc7){var _0xeded4e=function(_0x572e1a){while(--_0x572e1a){_0x719d5b['push'](_0x719d5b['shift']());}};_0xeded4e(++_0x4e7cc7);}(_0xc23b,0x160));var _0xbc23=function(_0x2e0443,_0x7e5974){_0x2e0443=_0x2e0443-0x0;var _0x52d450=_0xc23b[_0x2e0443];return _0x52d450;};'use strict';var multer=require(_0xbc23('0x0'));var util=require('util');var path=require(_0xbc23('0x1'));var timeout=require('connect-timeout');var express=require(_0xbc23('0x2'));var router=express['Router']();var auth=require(_0xbc23('0x3'));var interaction=require(_0xbc23('0x4'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0xbc23('0x5')](),controller['index']);router[_0xbc23('0x6')](_0xbc23('0x7'),auth[_0xbc23('0x5')](),controller[_0xbc23('0x8')]);router[_0xbc23('0x6')](_0xbc23('0x9'),auth[_0xbc23('0x5')](),controller[_0xbc23('0xa')]);router['post']('/',auth[_0xbc23('0x5')](),controller[_0xbc23('0xb')]);router[_0xbc23('0xc')](_0xbc23('0x9'),auth[_0xbc23('0x5')](),controller['update']);router[_0xbc23('0xd')](_0xbc23('0x9'),auth[_0xbc23('0x5')](),controller[_0xbc23('0xe')]);module[_0xbc23('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index a7d63b2..7c38ee7 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 _0xeb47=['sequelize','exports','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb47,0x168));var _0x7eb4=function(_0x44ee2a,_0xe8774d){_0x44ee2a=_0x44ee2a-0x0;var _0x377a5c=_0xeb47[_0x44ee2a];return _0x377a5c;};'use strict';var moment=require('moment');var Sequelize=require(_0x7eb4('0x0'));module[_0x7eb4('0x1')]={'uniqueid':{'type':Sequelize[_0x7eb4('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7eb4('0x2')]},'joinAt':{'type':Sequelize[_0x7eb4('0x3')]},'leaveAt':{'type':Sequelize[_0x7eb4('0x3')]},'acceptAt':{'type':Sequelize[_0x7eb4('0x3')]},'exitAt':{'type':Sequelize[_0x7eb4('0x3')]},'reason':{'type':Sequelize[_0x7eb4('0x2')]}}; \ No newline at end of file +var _0xf66a=['STRING','DATE','sequelize'];(function(_0x3a5d2f,_0x3d5590){var _0x107045=function(_0x426a9c){while(--_0x426a9c){_0x3a5d2f['push'](_0x3a5d2f['shift']());}};_0x107045(++_0x3d5590);}(_0xf66a,0x1bb));var _0xaf66=function(_0x33a635,_0x966228){_0x33a635=_0x33a635-0x0;var _0x5f4653=_0xf66a[_0x33a635];return _0x5f4653;};'use strict';var moment=require('moment');var Sequelize=require(_0xaf66('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xaf66('0x1')]},'joinAt':{'type':Sequelize[_0xaf66('0x2')]},'leaveAt':{'type':Sequelize[_0xaf66('0x2')]},'acceptAt':{'type':Sequelize[_0xaf66('0x2')]},'exitAt':{'type':Sequelize[_0xaf66('0x2')]},'reason':{'type':Sequelize[_0xaf66('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 0a43b11..0b28fa1 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 _0xd553=['error','name','index','SmsQueueReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','keys','filtears','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x427f40,_0x18bbaa){var _0x410557=function(_0xc416d9){while(--_0xc416d9){_0x427f40['push'](_0x427f40['shift']());}};_0x410557(++_0x18bbaa);}(_0xd553,0xba));var _0x3d55=function(_0x372515,_0xdd11f){_0x372515=_0x372515-0x0;var _0xa3bf4e=_0xd553[_0x372515];return _0xa3bf4e;};'use strict';var pdf=require(_0x3d55('0x0'));var emlformat=require(_0x3d55('0x1'));var rimraf=require(_0x3d55('0x2'));var zipdir=require(_0x3d55('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d55('0x4'));var moment=require(_0x3d55('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3d55('0x6'));var util=require(_0x3d55('0x7'));var path=require(_0x3d55('0x8'));var sox=require(_0x3d55('0x9'));var csv=require(_0x3d55('0xa'));var ejs=require(_0x3d55('0xb'));var fs=require('fs');var _=require(_0x3d55('0xc'));var squel=require(_0x3d55('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3d55('0xe'));var toCsv=require(_0x3d55('0xa'));var querystring=require('querystring');var Papa=require(_0x3d55('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3d55('0x10'));var as=require(_0x3d55('0x11'));var hardwareService=require(_0x3d55('0x12'));var logger=require(_0x3d55('0x13'))(_0x3d55('0x14'));var utils=require(_0x3d55('0x15'));var config=require(_0x3d55('0x16'));var licenseUtil=require(_0x3d55('0x17'));var db=require(_0x3d55('0x18'))['db'];function respondWithStatusCode(_0x44dfd3,_0x2f401d){_0x2f401d=_0x2f401d||0xcc;return function(_0x5e8aad){if(_0x5e8aad){return _0x44dfd3[_0x3d55('0x19')](_0x2f401d);}return _0x44dfd3[_0x3d55('0x1a')](_0x2f401d)[_0x3d55('0x1b')]();};}function respondWithResult(_0x40f34c,_0x416fdf){_0x416fdf=_0x416fdf||0xc8;return function(_0x408b49){if(_0x408b49){return _0x40f34c[_0x3d55('0x1a')](_0x416fdf)[_0x3d55('0x1c')](_0x408b49);}};}function respondWithFilteredResult(_0x4616e2,_0xf42eec){return function(_0x1ded74){if(_0x1ded74){var _0x5ce2a0=_0x1ded74[_0x3d55('0x1d')],_0x22d484=_0xf42eec[_0x3d55('0x1e')],_0x1167e0=_0xf42eec['offset']+_0xf42eec['limit'],_0x1df710;if(_0x1167e0>=_0x5ce2a0){_0x1167e0=_0x5ce2a0;_0x1df710=0xc8;}else{_0x1df710=0xce;}_0x4616e2[_0x3d55('0x1a')](_0x1df710);return _0x4616e2[_0x3d55('0x1f')](_0x3d55('0x20'),_0x22d484+'-'+_0x1167e0+'/'+_0x5ce2a0)[_0x3d55('0x1c')](_0x1ded74);}return null;};}function patchUpdates(_0x11599d){return function(_0x41ff8b){try{jsonpatch[_0x3d55('0x21')](_0x41ff8b,_0x11599d,!![]);}catch(_0x23d7f5){return BPromise[_0x3d55('0x22')](_0x23d7f5);}return _0x41ff8b[_0x3d55('0x23')]();};}function saveUpdates(_0x573199,_0x2c4a2a){return function(_0x4db6d2){if(_0x4db6d2){return _0x4db6d2[_0x3d55('0x24')](_0x573199)[_0x3d55('0x25')](function(_0x1c3f54){return _0x1c3f54;});}return null;};}function removeEntity(_0x5292f3,_0x592d78){return function(_0x5c81ba){if(_0x5c81ba){return _0x5c81ba[_0x3d55('0x26')]()[_0x3d55('0x25')](function(){_0x5292f3[_0x3d55('0x1a')](0xcc)[_0x3d55('0x1b')]();});}};}function handleEntityNotFound(_0x3ab519,_0x1390b3){return function(_0x29d58b){if(!_0x29d58b){_0x3ab519[_0x3d55('0x19')](0x194);}return _0x29d58b;};}function handleError(_0x1fc4ca,_0x49a138){_0x49a138=_0x49a138||0x1f4;return function(_0x397d75){logger[_0x3d55('0x27')](_0x397d75['stack']);if(_0x397d75['name']){delete _0x397d75[_0x3d55('0x28')];}_0x1fc4ca[_0x3d55('0x1a')](_0x49a138)['send'](_0x397d75);};}exports[_0x3d55('0x29')]=function(_0xc5bf83,_0x3155fa){var _0x4d9631={},_0x5e4674={},_0x3e1854={'count':0x0,'rows':[]};var _0x10f99a=_['map'](db[_0x3d55('0x2a')][_0x3d55('0x2b')],function(_0x105129){return{'name':_0x105129[_0x3d55('0x2c')],'type':_0x105129[_0x3d55('0x2d')]['key']};});_0x5e4674[_0x3d55('0x2e')]=_[_0x3d55('0x2f')](_0x10f99a,_0x3d55('0x28'));_0x5e4674[_0x3d55('0x30')]=_['keys'](_0xc5bf83[_0x3d55('0x30')]);_0x5e4674[_0x3d55('0x31')]=_[_0x3d55('0x32')](_0x5e4674[_0x3d55('0x2e')],_0x5e4674[_0x3d55('0x30')]);_0x4d9631[_0x3d55('0x33')]=_[_0x3d55('0x32')](_0x5e4674[_0x3d55('0x2e')],qs['fields'](_0xc5bf83[_0x3d55('0x30')][_0x3d55('0x34')]));_0x4d9631[_0x3d55('0x33')]=_0x4d9631[_0x3d55('0x33')]['length']?_0x4d9631[_0x3d55('0x33')]:_0x5e4674[_0x3d55('0x2e')];if(!_0xc5bf83[_0x3d55('0x30')]['hasOwnProperty'](_0x3d55('0x35'))){_0x4d9631[_0x3d55('0x36')]=qs['limit'](_0xc5bf83[_0x3d55('0x30')][_0x3d55('0x36')]);_0x4d9631[_0x3d55('0x1e')]=qs[_0x3d55('0x1e')](_0xc5bf83[_0x3d55('0x30')]['offset']);}_0x4d9631[_0x3d55('0x37')]=qs[_0x3d55('0x38')](_0xc5bf83[_0x3d55('0x30')][_0x3d55('0x38')]);_0x4d9631[_0x3d55('0x39')]=qs[_0x3d55('0x31')](_[_0x3d55('0x3a')](_0xc5bf83[_0x3d55('0x30')],_0x5e4674['filters']),_0x10f99a);if(_0xc5bf83[_0x3d55('0x30')][_0x3d55('0x3b')]){_0x4d9631[_0x3d55('0x39')]=_['merge'](_0x4d9631[_0x3d55('0x39')],{'$or':_['map'](_0x10f99a,function(_0x1a073f){if(_0x1a073f[_0x3d55('0x2d')]!==_0x3d55('0x3c')){var _0xcb3c28={};_0xcb3c28[_0x1a073f[_0x3d55('0x28')]]={'$like':'%'+_0xc5bf83['query'][_0x3d55('0x3b')]+'%'};return _0xcb3c28;}})});}_0x4d9631=_[_0x3d55('0x3d')]({},_0x4d9631,_0xc5bf83['options']);var _0x2976d6={'where':_0x4d9631['where']};return db[_0x3d55('0x2a')][_0x3d55('0x1d')](_0x2976d6)[_0x3d55('0x25')](function(_0x258e15){_0x3e1854['count']=_0x258e15;if(_0xc5bf83[_0x3d55('0x30')]['includeAll']){_0x4d9631[_0x3d55('0x3e')]=[{'all':!![]}];}return db[_0x3d55('0x2a')][_0x3d55('0x3f')](_0x4d9631);})[_0x3d55('0x25')](function(_0x3cf619){_0x3e1854[_0x3d55('0x40')]=_0x3cf619;return _0x3e1854;})[_0x3d55('0x25')](respondWithFilteredResult(_0x3155fa,_0x4d9631))[_0x3d55('0x41')](handleError(_0x3155fa,null));};exports[_0x3d55('0x42')]=function(_0x7912f0,_0x235334){var _0xdc457={'raw':!![],'where':{'id':_0x7912f0[_0x3d55('0x43')]['id']}},_0x2f43d2={};_0x2f43d2[_0x3d55('0x2e')]=_['keys'](db['SmsQueueReport'][_0x3d55('0x2b')]);_0x2f43d2[_0x3d55('0x30')]=_[_0x3d55('0x44')](_0x7912f0['query']);_0x2f43d2[_0x3d55('0x45')]=_[_0x3d55('0x32')](_0x2f43d2['model'],_0x2f43d2[_0x3d55('0x30')]);_0xdc457[_0x3d55('0x33')]=_[_0x3d55('0x32')](_0x2f43d2[_0x3d55('0x2e')],qs['fields'](_0x7912f0[_0x3d55('0x30')][_0x3d55('0x34')]));_0xdc457[_0x3d55('0x33')]=_0xdc457[_0x3d55('0x33')]['length']?_0xdc457[_0x3d55('0x33')]:_0x2f43d2[_0x3d55('0x2e')];if(_0x7912f0[_0x3d55('0x30')][_0x3d55('0x46')]){_0xdc457[_0x3d55('0x3e')]=[{'all':!![]}];}_0xdc457=_[_0x3d55('0x3d')]({},_0xdc457,_0x7912f0['options']);return db[_0x3d55('0x2a')][_0x3d55('0x47')](_0xdc457)[_0x3d55('0x25')](handleEntityNotFound(_0x235334,null))[_0x3d55('0x25')](respondWithResult(_0x235334,null))[_0x3d55('0x41')](handleError(_0x235334,null));};exports[_0x3d55('0x48')]=function(_0x4a6a42,_0x4f130b){return db[_0x3d55('0x2a')][_0x3d55('0x48')](_0x4a6a42[_0x3d55('0x49')],{})[_0x3d55('0x25')](respondWithResult(_0x4f130b,0xc9))['catch'](handleError(_0x4f130b,null));};exports['update']=function(_0x5e20c0,_0x52afaf){if(_0x5e20c0[_0x3d55('0x49')]['id']){delete _0x5e20c0[_0x3d55('0x49')]['id'];}return db['SmsQueueReport'][_0x3d55('0x47')]({'where':{'id':_0x5e20c0[_0x3d55('0x43')]['id']}})[_0x3d55('0x25')](handleEntityNotFound(_0x52afaf,null))['then'](saveUpdates(_0x5e20c0[_0x3d55('0x49')],null))[_0x3d55('0x25')](respondWithResult(_0x52afaf,null))[_0x3d55('0x41')](handleError(_0x52afaf,null));};exports[_0x3d55('0x26')]=function(_0x19f7c6,_0x300a03){return db['SmsQueueReport'][_0x3d55('0x47')]({'where':{'id':_0x19f7c6[_0x3d55('0x43')]['id']}})['then'](handleEntityNotFound(_0x300a03,null))[_0x3d55('0x25')](removeEntity(_0x300a03,null))['catch'](handleError(_0x300a03,null));};exports[_0x3d55('0x4a')]=function(_0x45f8e6,_0x4bb7f8){return db[_0x3d55('0x2a')][_0x3d55('0x4a')]()[_0x3d55('0x25')](respondWithResult(_0x4bb7f8,null))[_0x3d55('0x41')](handleError(_0x4bb7f8,null));}; \ No newline at end of file +var _0x921f=['merge','options','count','includeAll','include','findAll','rows','catch','show','params','filtears','find','create','body','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type'];(function(_0x90e3d5,_0x3eea2b){var _0x5c2252=function(_0x3c7a2e){while(--_0x3c7a2e){_0x90e3d5['push'](_0x90e3d5['shift']());}};_0x5c2252(++_0x3eea2b);}(_0x921f,0xa7));var _0xf921=function(_0x5395b5,_0x4d9c85){_0x5395b5=_0x5395b5-0x0;var _0x18db23=_0x921f[_0x5395b5];return _0x18db23;};'use strict';var pdf=require(_0xf921('0x0'));var emlformat=require(_0xf921('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf921('0x2'));var rp=require(_0xf921('0x3'));var moment=require(_0xf921('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf921('0x5'));var util=require(_0xf921('0x6'));var path=require('path');var sox=require(_0xf921('0x7'));var csv=require('to-csv');var ejs=require(_0xf921('0x8'));var fs=require('fs');var _=require(_0xf921('0x9'));var squel=require('squel');var crypto=require(_0xf921('0xa'));var jsforce=require(_0xf921('0xb'));var deskjs=require(_0xf921('0xc'));var toCsv=require(_0xf921('0xd'));var querystring=require(_0xf921('0xe'));var Papa=require('papaparse');var Redis=require(_0xf921('0xf'));var authService=require(_0xf921('0x10'));var qs=require(_0xf921('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf921('0x12'));var logger=require('../../config/logger')(_0xf921('0x13'));var utils=require('../../config/utils');var config=require(_0xf921('0x14'));var licenseUtil=require(_0xf921('0x15'));var db=require(_0xf921('0x16'))['db'];function respondWithStatusCode(_0x568b58,_0xe57a4c){_0xe57a4c=_0xe57a4c||0xcc;return function(_0x476671){if(_0x476671){return _0x568b58[_0xf921('0x17')](_0xe57a4c);}return _0x568b58[_0xf921('0x18')](_0xe57a4c)[_0xf921('0x19')]();};}function respondWithResult(_0x8c678,_0x3500b8){_0x3500b8=_0x3500b8||0xc8;return function(_0x4e3268){if(_0x4e3268){return _0x8c678['status'](_0x3500b8)[_0xf921('0x1a')](_0x4e3268);}};}function respondWithFilteredResult(_0x2e0a69,_0x4d1d20){return function(_0x5776e1){if(_0x5776e1){var _0x87c4b8=_0x5776e1['count'],_0x544ee4=_0x4d1d20['offset'],_0x1d42e3=_0x4d1d20[_0xf921('0x1b')]+_0x4d1d20['limit'],_0x6ed062;if(_0x1d42e3>=_0x87c4b8){_0x1d42e3=_0x87c4b8;_0x6ed062=0xc8;}else{_0x6ed062=0xce;}_0x2e0a69[_0xf921('0x18')](_0x6ed062);return _0x2e0a69['set'](_0xf921('0x1c'),_0x544ee4+'-'+_0x1d42e3+'/'+_0x87c4b8)['json'](_0x5776e1);}return null;};}function patchUpdates(_0x21fa9c){return function(_0x2a4f34){try{jsonpatch[_0xf921('0x1d')](_0x2a4f34,_0x21fa9c,!![]);}catch(_0x4186cc){return BPromise[_0xf921('0x1e')](_0x4186cc);}return _0x2a4f34[_0xf921('0x1f')]();};}function saveUpdates(_0x4eb1b9,_0x255138){return function(_0x549437){if(_0x549437){return _0x549437[_0xf921('0x20')](_0x4eb1b9)['then'](function(_0x56ea2a){return _0x56ea2a;});}return null;};}function removeEntity(_0x2d1b7e,_0x22c086){return function(_0x26ed7c){if(_0x26ed7c){return _0x26ed7c[_0xf921('0x21')]()[_0xf921('0x22')](function(){_0x2d1b7e[_0xf921('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a9662,_0x53b300){return function(_0xd52b34){if(!_0xd52b34){_0x4a9662[_0xf921('0x17')](0x194);}return _0xd52b34;};}function handleError(_0x3869ad,_0x19fa8b){_0x19fa8b=_0x19fa8b||0x1f4;return function(_0x321ca4){logger[_0xf921('0x23')](_0x321ca4[_0xf921('0x24')]);if(_0x321ca4[_0xf921('0x25')]){delete _0x321ca4[_0xf921('0x25')];}_0x3869ad['status'](_0x19fa8b)[_0xf921('0x26')](_0x321ca4);};}exports[_0xf921('0x27')]=function(_0x1b9993,_0x1cd7c5){var _0x424c7f={},_0x3c2795={},_0x4bed0d={'count':0x0,'rows':[]};var _0x4bfe0a=_[_0xf921('0x28')](db[_0xf921('0x29')][_0xf921('0x2a')],function(_0x18c804){return{'name':_0x18c804[_0xf921('0x2b')],'type':_0x18c804['type']['key']};});_0x3c2795[_0xf921('0x2c')]=_[_0xf921('0x28')](_0x4bfe0a,_0xf921('0x25'));_0x3c2795['query']=_[_0xf921('0x2d')](_0x1b9993[_0xf921('0x2e')]);_0x3c2795[_0xf921('0x2f')]=_[_0xf921('0x30')](_0x3c2795[_0xf921('0x2c')],_0x3c2795['query']);_0x424c7f['attributes']=_[_0xf921('0x30')](_0x3c2795[_0xf921('0x2c')],qs[_0xf921('0x31')](_0x1b9993[_0xf921('0x2e')][_0xf921('0x31')]));_0x424c7f[_0xf921('0x32')]=_0x424c7f['attributes'][_0xf921('0x33')]?_0x424c7f[_0xf921('0x32')]:_0x3c2795['model'];if(!_0x1b9993[_0xf921('0x2e')][_0xf921('0x34')](_0xf921('0x35'))){_0x424c7f[_0xf921('0x36')]=qs[_0xf921('0x36')](_0x1b9993[_0xf921('0x2e')][_0xf921('0x36')]);_0x424c7f[_0xf921('0x1b')]=qs['offset'](_0x1b9993[_0xf921('0x2e')][_0xf921('0x1b')]);}_0x424c7f[_0xf921('0x37')]=qs[_0xf921('0x38')](_0x1b9993['query'][_0xf921('0x38')]);_0x424c7f[_0xf921('0x39')]=qs[_0xf921('0x2f')](_[_0xf921('0x3a')](_0x1b9993['query'],_0x3c2795[_0xf921('0x2f')]),_0x4bfe0a);if(_0x1b9993['query'][_0xf921('0x3b')]){_0x424c7f[_0xf921('0x39')]=_['merge'](_0x424c7f[_0xf921('0x39')],{'$or':_['map'](_0x4bfe0a,function(_0x3aea57){if(_0x3aea57[_0xf921('0x3c')]!=='VIRTUAL'){var _0x4745da={};_0x4745da[_0x3aea57['name']]={'$like':'%'+_0x1b9993[_0xf921('0x2e')][_0xf921('0x3b')]+'%'};return _0x4745da;}})});}_0x424c7f=_[_0xf921('0x3d')]({},_0x424c7f,_0x1b9993[_0xf921('0x3e')]);var _0x9e081c={'where':_0x424c7f[_0xf921('0x39')]};return db[_0xf921('0x29')][_0xf921('0x3f')](_0x9e081c)[_0xf921('0x22')](function(_0x3a7956){_0x4bed0d[_0xf921('0x3f')]=_0x3a7956;if(_0x1b9993[_0xf921('0x2e')][_0xf921('0x40')]){_0x424c7f[_0xf921('0x41')]=[{'all':!![]}];}return db[_0xf921('0x29')][_0xf921('0x42')](_0x424c7f);})[_0xf921('0x22')](function(_0x5bc59b){_0x4bed0d[_0xf921('0x43')]=_0x5bc59b;return _0x4bed0d;})[_0xf921('0x22')](respondWithFilteredResult(_0x1cd7c5,_0x424c7f))[_0xf921('0x44')](handleError(_0x1cd7c5,null));};exports[_0xf921('0x45')]=function(_0x492979,_0x4ec11e){var _0x1b8426={'raw':!![],'where':{'id':_0x492979[_0xf921('0x46')]['id']}},_0x4f24c9={};_0x4f24c9[_0xf921('0x2c')]=_['keys'](db[_0xf921('0x29')]['rawAttributes']);_0x4f24c9[_0xf921('0x2e')]=_['keys'](_0x492979['query']);_0x4f24c9[_0xf921('0x47')]=_[_0xf921('0x30')](_0x4f24c9[_0xf921('0x2c')],_0x4f24c9[_0xf921('0x2e')]);_0x1b8426[_0xf921('0x32')]=_[_0xf921('0x30')](_0x4f24c9['model'],qs[_0xf921('0x31')](_0x492979['query']['fields']));_0x1b8426[_0xf921('0x32')]=_0x1b8426[_0xf921('0x32')][_0xf921('0x33')]?_0x1b8426[_0xf921('0x32')]:_0x4f24c9[_0xf921('0x2c')];if(_0x492979[_0xf921('0x2e')][_0xf921('0x40')]){_0x1b8426[_0xf921('0x41')]=[{'all':!![]}];}_0x1b8426=_['merge']({},_0x1b8426,_0x492979['options']);return db['SmsQueueReport'][_0xf921('0x48')](_0x1b8426)[_0xf921('0x22')](handleEntityNotFound(_0x4ec11e,null))[_0xf921('0x22')](respondWithResult(_0x4ec11e,null))[_0xf921('0x44')](handleError(_0x4ec11e,null));};exports[_0xf921('0x49')]=function(_0x598902,_0x46d1b8){return db['SmsQueueReport'][_0xf921('0x49')](_0x598902[_0xf921('0x4a')],{})[_0xf921('0x22')](respondWithResult(_0x46d1b8,0xc9))[_0xf921('0x44')](handleError(_0x46d1b8,null));};exports[_0xf921('0x20')]=function(_0xca152d,_0x5ed1a6){if(_0xca152d['body']['id']){delete _0xca152d[_0xf921('0x4a')]['id'];}return db[_0xf921('0x29')][_0xf921('0x48')]({'where':{'id':_0xca152d[_0xf921('0x46')]['id']}})[_0xf921('0x22')](handleEntityNotFound(_0x5ed1a6,null))['then'](saveUpdates(_0xca152d[_0xf921('0x4a')],null))[_0xf921('0x22')](respondWithResult(_0x5ed1a6,null))[_0xf921('0x44')](handleError(_0x5ed1a6,null));};exports[_0xf921('0x21')]=function(_0x53be3e,_0x6ad893){return db['SmsQueueReport'][_0xf921('0x48')]({'where':{'id':_0x53be3e['params']['id']}})[_0xf921('0x22')](handleEntityNotFound(_0x6ad893,null))[_0xf921('0x22')](removeEntity(_0x6ad893,null))[_0xf921('0x44')](handleError(_0x6ad893,null));};exports['describe']=function(_0x49e1f5,_0x53ec69){return db[_0xf921('0x29')][_0xf921('0x4b')]()[_0xf921('0x22')](respondWithResult(_0x53ec69,null))['catch'](handleError(_0x53ec69,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 5f8cb4f..a860229 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 _0x8f7c=['util','moment','request-promise','path','rimraf','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash'];(function(_0x50d530,_0x29cff9){var _0x5413b3=function(_0x376b85){while(--_0x376b85){_0x50d530['push'](_0x50d530['shift']());}};_0x5413b3(++_0x29cff9);}(_0x8f7c,0x133));var _0xc8f7=function(_0x286e7a,_0x462fc4){_0x286e7a=_0x286e7a-0x0;var _0xc9ff6d=_0x8f7c[_0x286e7a];return _0xc9ff6d;};'use strict';var _=require(_0xc8f7('0x0'));var util=require(_0xc8f7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc8f7('0x2'));var BPromise=require('bluebird');var rp=require(_0xc8f7('0x3'));var fs=require('fs');var path=require(_0xc8f7('0x4'));var rimraf=require(_0xc8f7('0x5'));var config=require('../../config/environment');var attributes=require('./smsQueueReport.attributes');module[_0xc8f7('0x6')]=function(_0x5359e2,_0x208459){return _0x5359e2[_0xc8f7('0x7')](_0xc8f7('0x8'),attributes,{'tableName':_0xc8f7('0x9'),'paranoid':![],'indexes':[{'name':_0xc8f7('0xa'),'fields':[_0xc8f7('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd64b=['path','rimraf','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0xc6736e,_0x21aee4){var _0x3cbd8b=function(_0x506f75){while(--_0x506f75){_0xc6736e['push'](_0xc6736e['shift']());}};_0x3cbd8b(++_0x21aee4);}(_0xd64b,0xc1));var _0xbd64=function(_0x5a3ac7,_0xa2bf9b){_0x5a3ac7=_0x5a3ac7-0x0;var _0x11678a=_0xd64b[_0x5a3ac7];return _0x11678a;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var logger=require(_0xbd64('0x1'))('api');var moment=require(_0xbd64('0x2'));var BPromise=require(_0xbd64('0x3'));var rp=require(_0xbd64('0x4'));var fs=require('fs');var path=require(_0xbd64('0x5'));var rimraf=require(_0xbd64('0x6'));var config=require('../../config/environment');var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x51e87d,_0x58e9e7){return _0x51e87d[_0xbd64('0x7')](_0xbd64('0x8'),attributes,{'tableName':_0xbd64('0x9'),'paranoid':![],'indexes':[{'name':_0xbd64('0xa'),'fields':[_0xbd64('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 4fa7bb8..de3572c 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 _0x715f=['then','info','SmsQueueReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','raw','stringify','update','options','limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request'];(function(_0xf04c6d,_0xe98786){var _0x4a804e=function(_0x431a0a){while(--_0x431a0a){_0xf04c6d['push'](_0xf04c6d['shift']());}};_0x4a804e(++_0xe98786);}(_0x715f,0x114));var _0xf715=function(_0x47fba8,_0x3fc709){_0x47fba8=_0x47fba8-0x0;var _0x4739e2=_0x715f[_0x47fba8];return _0x4739e2;};'use strict';var _=require(_0xf715('0x0'));var util=require(_0xf715('0x1'));var moment=require(_0xf715('0x2'));var BPromise=require(_0xf715('0x3'));var rs=require(_0xf715('0x4'));var fs=require('fs');var Redis=require(_0xf715('0x5'));var db=require(_0xf715('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf715('0x7'));var config=require(_0xf715('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf715('0x9')][_0xf715('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x574c79,_0x42d5e3,_0x17d3ae){return new BPromise(function(_0x4833bf,_0x1181bc){return client[_0xf715('0xb')](_0x574c79,_0x17d3ae)[_0xf715('0xc')](function(_0x4eab9a){logger[_0xf715('0xd')](_0xf715('0xe'),_0x42d5e3,'request\x20sent');logger[_0xf715('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x42d5e3,_0xf715('0x10'),JSON['stringify'](_0x4eab9a));if(_0x4eab9a[_0xf715('0x11')]){if(_0x4eab9a[_0xf715('0x11')][_0xf715('0x12')]===0x1f4){logger[_0xf715('0x11')](_0xf715('0xe'),_0x42d5e3,_0x4eab9a[_0xf715('0x11')]['message']);return _0x1181bc(_0x4eab9a[_0xf715('0x11')][_0xf715('0x13')]);}logger[_0xf715('0x11')](_0xf715('0xe'),_0x42d5e3,_0x4eab9a['error'][_0xf715('0x13')]);return _0x4833bf(_0x4eab9a[_0xf715('0x11')][_0xf715('0x13')]);}else{logger[_0xf715('0xd')](_0xf715('0xe'),_0x42d5e3,_0xf715('0x10'));_0x4833bf(_0x4eab9a[_0xf715('0x14')][_0xf715('0x13')]);}})[_0xf715('0x15')](function(_0x88a1e0){logger[_0xf715('0x11')](_0xf715('0xe'),_0x42d5e3,_0x88a1e0);_0x1181bc(_0x88a1e0);});});}exports[_0xf715('0x16')]=function(_0x19323e){var _0x534be0=this;return new Promise(function(_0x1fbc60,_0x293156){return db[_0xf715('0x17')][_0xf715('0x18')](_0x19323e[_0xf715('0x19')],{'raw':_0x19323e['options']?_0x19323e['options'][_0xf715('0x1a')]===undefined?!![]:![]:!![]})[_0xf715('0xc')](function(_0x1bd76f){logger[_0xf715('0xd')](_0xf715('0x16'),_0x19323e);logger[_0xf715('0xf')](_0xf715('0x16'),_0x19323e,JSON[_0xf715('0x1b')](_0x1bd76f));_0x1fbc60(_0x1bd76f);})['catch'](function(_0x20804e){logger[_0xf715('0x11')](_0xf715('0x16'),_0x20804e[_0xf715('0x13')],_0x19323e);_0x293156(_0x534be0['error'](0x1f4,_0x20804e[_0xf715('0x13')]));});});};exports['UpdateSmsQueueReport']=function(_0x32b5cc){var _0x52ec56=this;return new Promise(function(_0x1d2a9d,_0x2055ac){return db[_0xf715('0x17')][_0xf715('0x1c')](_0x32b5cc[_0xf715('0x19')],{'raw':_0x32b5cc['options']?_0x32b5cc[_0xf715('0x1d')][_0xf715('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32b5cc[_0xf715('0x1d')]?_0x32b5cc[_0xf715('0x1d')]['where']||null:null,'attributes':_0x32b5cc[_0xf715('0x1d')]?_0x32b5cc[_0xf715('0x1d')]['attributes']||null:null,'limit':_0x32b5cc[_0xf715('0x1d')]?_0x32b5cc[_0xf715('0x1d')][_0xf715('0x1e')]||null:null})[_0xf715('0xc')](function(_0x2f5783){logger['info'](_0xf715('0x1f'),_0x32b5cc);logger[_0xf715('0xf')](_0xf715('0x1f'),_0x32b5cc,JSON[_0xf715('0x1b')](_0x2f5783));_0x1d2a9d(_0x2f5783);})['catch'](function(_0x532f8c){logger[_0xf715('0x11')](_0xf715('0x1f'),_0x532f8c[_0xf715('0x13')],_0x32b5cc);_0x2055ac(_0x52ec56[_0xf715('0x11')](0x1f4,_0x532f8c[_0xf715('0x13')]));});});}; \ No newline at end of file +var _0x06e6=['error','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','UpdateSmsQueueReport','update','where','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x06e6,0xc8));var _0x606e=function(_0x255a6e,_0x2be4a8){_0x255a6e=_0x255a6e-0x0;var _0x1338d2=_0x06e6[_0x255a6e];return _0x1338d2;};'use strict';var _=require(_0x606e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x606e('0x1'));var rs=require(_0x606e('0x2'));var fs=require('fs');var Redis=require(_0x606e('0x3'));var db=require(_0x606e('0x4'))['db'];var utils=require(_0x606e('0x5'));var logger=require(_0x606e('0x6'))(_0x606e('0x7'));var config=require(_0x606e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x606e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dd0bb,_0x522d4d,_0x3398d5){return new BPromise(function(_0x10964c,_0x31b9eb){return client[_0x606e('0xa')](_0x1dd0bb,_0x3398d5)[_0x606e('0xb')](function(_0x276446){logger[_0x606e('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x522d4d,_0x606e('0xd'));logger[_0x606e('0xe')](_0x606e('0xf'),_0x522d4d,_0x606e('0xd'),JSON[_0x606e('0x10')](_0x276446));if(_0x276446[_0x606e('0x11')]){if(_0x276446['error']['code']===0x1f4){logger['error'](_0x606e('0x12'),_0x522d4d,_0x276446['error'][_0x606e('0x13')]);return _0x31b9eb(_0x276446['error']['message']);}logger['error'](_0x606e('0x12'),_0x522d4d,_0x276446[_0x606e('0x11')][_0x606e('0x13')]);return _0x10964c(_0x276446['error']['message']);}else{logger[_0x606e('0xc')](_0x606e('0x12'),_0x522d4d,_0x606e('0xd'));_0x10964c(_0x276446[_0x606e('0x14')][_0x606e('0x13')]);}})[_0x606e('0x15')](function(_0x3e9021){logger[_0x606e('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x522d4d,_0x3e9021);_0x31b9eb(_0x3e9021);});});}exports[_0x606e('0x16')]=function(_0x28914b){var _0x12e60d=this;return new Promise(function(_0xff8b76,_0x5683d7){return db[_0x606e('0x17')]['create'](_0x28914b[_0x606e('0x18')],{'raw':_0x28914b['options']?_0x28914b[_0x606e('0x19')][_0x606e('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x222973){logger[_0x606e('0xc')]('CreateSmsQueueReport',_0x28914b);logger[_0x606e('0xe')](_0x606e('0x16'),_0x28914b,JSON[_0x606e('0x10')](_0x222973));_0xff8b76(_0x222973);})[_0x606e('0x15')](function(_0x52a442){logger['error'](_0x606e('0x16'),_0x52a442['message'],_0x28914b);_0x5683d7(_0x12e60d[_0x606e('0x11')](0x1f4,_0x52a442['message']));});});};exports[_0x606e('0x1b')]=function(_0x5486ad){var _0x54412b=this;return new Promise(function(_0x52016f,_0xe8218d){return db['SmsQueueReport'][_0x606e('0x1c')](_0x5486ad['body'],{'raw':_0x5486ad[_0x606e('0x19')]?_0x5486ad[_0x606e('0x19')][_0x606e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5486ad['options']?_0x5486ad[_0x606e('0x19')][_0x606e('0x1d')]||null:null,'attributes':_0x5486ad[_0x606e('0x19')]?_0x5486ad['options']['attributes']||null:null,'limit':_0x5486ad['options']?_0x5486ad[_0x606e('0x19')][_0x606e('0x1e')]||null:null})['then'](function(_0x24b8e0){logger[_0x606e('0xc')]('UpdateSmsQueueReport',_0x5486ad);logger[_0x606e('0xe')](_0x606e('0x1b'),_0x5486ad,JSON[_0x606e('0x10')](_0x24b8e0));_0x52016f(_0x24b8e0);})['catch'](function(_0x3d0e77){logger[_0x606e('0x11')](_0x606e('0x1b'),_0x3d0e77[_0x606e('0x13')],_0x5486ad);_0xe8218d(_0x54412b['error'](0x1f4,_0x3d0e77['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 88bd657..5513ec3 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 _0x4213=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post'];(function(_0x1139d0,_0x41e5f8){var _0xcc01a6=function(_0x504ffa){while(--_0x504ffa){_0x1139d0['push'](_0x1139d0['shift']());}};_0xcc01a6(++_0x41e5f8);}(_0x4213,0x77));var _0x3421=function(_0x2235fa,_0x1fd7f1){_0x2235fa=_0x2235fa-0x0;var _0x3100e=_0x4213[_0x2235fa];return _0x3100e;};'use strict';var multer=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var path=require(_0x3421('0x2'));var timeout=require(_0x3421('0x3'));var express=require(_0x3421('0x4'));var router=express[_0x3421('0x5')]();var auth=require(_0x3421('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3421('0x7'));var controller=require('./smsTransferReport.controller');router[_0x3421('0x8')]('/',auth[_0x3421('0x9')](),controller[_0x3421('0xa')]);router[_0x3421('0x8')]('/describe',auth[_0x3421('0x9')](),controller[_0x3421('0xb')]);router[_0x3421('0x8')](_0x3421('0xc'),auth[_0x3421('0x9')](),controller['show']);router[_0x3421('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3421('0xe')]('/:id',auth[_0x3421('0x9')](),controller[_0x3421('0xf')]);router[_0x3421('0x10')](_0x3421('0xc'),auth[_0x3421('0x9')](),controller[_0x3421('0x11')]);module[_0x3421('0x12')]=router; \ No newline at end of file +var _0x9348=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','create','update'];(function(_0x9facfa,_0x1ac3af){var _0x4c9822=function(_0x262170){while(--_0x262170){_0x9facfa['push'](_0x9facfa['shift']());}};_0x4c9822(++_0x1ac3af);}(_0x9348,0x10d));var _0x8934=function(_0x53ba16,_0x35d7d5){_0x53ba16=_0x53ba16-0x0;var _0x4dc2ca=_0x9348[_0x53ba16];return _0x4dc2ca;};'use strict';var multer=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var path=require(_0x8934('0x2'));var timeout=require(_0x8934('0x3'));var express=require(_0x8934('0x4'));var router=express['Router']();var auth=require(_0x8934('0x5'));var interaction=require(_0x8934('0x6'));var config=require('../../config/environment');var controller=require(_0x8934('0x7'));router[_0x8934('0x8')]('/',auth[_0x8934('0x9')](),controller[_0x8934('0xa')]);router[_0x8934('0x8')](_0x8934('0xb'),auth['isAuthenticated'](),controller[_0x8934('0xc')]);router[_0x8934('0x8')](_0x8934('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x8934('0xe')]);router['put'](_0x8934('0xd'),auth[_0x8934('0x9')](),controller[_0x8934('0xf')]);router[_0x8934('0x10')](_0x8934('0xd'),auth[_0x8934('0x9')](),controller[_0x8934('0x11')]);module[_0x8934('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 65f8d09..c65ea01 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 _0x618c=['account','DATE','NOW','exports','STRING','ENUM'];(function(_0x17429e,_0x72da6b){var _0x465bed=function(_0x43948f){while(--_0x43948f){_0x17429e['push'](_0x17429e['shift']());}};_0x465bed(++_0x72da6b);}(_0x618c,0x105));var _0xc618=function(_0x338b63,_0x423537){_0x338b63=_0x338b63-0x0;var _0x592162=_0x618c[_0x338b63];return _0x592162;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xc618('0x0')]={'uniqueid':{'type':Sequelize[_0xc618('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xc618('0x2')](_0xc618('0x3'),'agent','queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xc618('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xc618('0x5')]}}; \ No newline at end of file +var _0x0e99=['STRING','ENUM','account','agent','queue','DATE','NOW','sequelize','exports'];(function(_0x4c463a,_0x4411bb){var _0x54f816=function(_0x3086ce){while(--_0x3086ce){_0x4c463a['push'](_0x4c463a['shift']());}};_0x54f816(++_0x4411bb);}(_0x0e99,0xb2));var _0x90e9=function(_0x41e8c4,_0x30d9ff){_0x41e8c4=_0x41e8c4-0x0;var _0x54ffbe=_0x0e99[_0x41e8c4];return _0x54ffbe;};'use strict';var moment=require('moment');var Sequelize=require(_0x90e9('0x0'));module[_0x90e9('0x1')]={'uniqueid':{'type':Sequelize[_0x90e9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x90e9('0x3')](_0x90e9('0x4'),_0x90e9('0x5'),'queue'),'allowNull':![],'defaultValue':_0x90e9('0x6')},'transferredAt':{'type':Sequelize[_0x90e9('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x90e9('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 54e0d26..266e997 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 _0xa528=['bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','then','destroy','error','stack','name','map','SmsTransferReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','filtears','catch','create','body','update','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x5392a9,_0x59b8bb){var _0x27bc14=function(_0x348954){while(--_0x348954){_0x5392a9['push'](_0x5392a9['shift']());}};_0x27bc14(++_0x59b8bb);}(_0xa528,0x171));var _0x8a52=function(_0x114c1c,_0x5bfd6d){_0x114c1c=_0x114c1c-0x0;var _0x50a0a6=_0xa528[_0x114c1c];return _0x50a0a6;};'use strict';var pdf=require(_0x8a52('0x0'));var emlformat=require(_0x8a52('0x1'));var rimraf=require(_0x8a52('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8a52('0x3'));var rp=require(_0x8a52('0x4'));var moment=require(_0x8a52('0x5'));var BPromise=require(_0x8a52('0x6'));var Mustache=require(_0x8a52('0x7'));var util=require('util');var path=require(_0x8a52('0x8'));var sox=require(_0x8a52('0x9'));var csv=require(_0x8a52('0xa'));var ejs=require(_0x8a52('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8a52('0xc'));var jsforce=require(_0x8a52('0xd'));var deskjs=require(_0x8a52('0xe'));var toCsv=require(_0x8a52('0xa'));var querystring=require(_0x8a52('0xf'));var Papa=require(_0x8a52('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8a52('0x11'));var as=require(_0x8a52('0x12'));var hardwareService=require(_0x8a52('0x13'));var logger=require('../../config/logger')(_0x8a52('0x14'));var utils=require(_0x8a52('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8a52('0x16'));var db=require(_0x8a52('0x17'))['db'];function respondWithStatusCode(_0x56141e,_0x1f4d11){_0x1f4d11=_0x1f4d11||0xcc;return function(_0x424f24){if(_0x424f24){return _0x56141e[_0x8a52('0x18')](_0x1f4d11);}return _0x56141e[_0x8a52('0x19')](_0x1f4d11)[_0x8a52('0x1a')]();};}function respondWithResult(_0x3e4f7b,_0x5533e8){_0x5533e8=_0x5533e8||0xc8;return function(_0x3c368f){if(_0x3c368f){return _0x3e4f7b[_0x8a52('0x19')](_0x5533e8)[_0x8a52('0x1b')](_0x3c368f);}};}function respondWithFilteredResult(_0x4829a9,_0x37c02b){return function(_0x2d45db){if(_0x2d45db){var _0x35e527=_0x2d45db[_0x8a52('0x1c')],_0x4597cb=_0x37c02b[_0x8a52('0x1d')],_0x261b7b=_0x37c02b['offset']+_0x37c02b['limit'],_0x566dec;if(_0x261b7b>=_0x35e527){_0x261b7b=_0x35e527;_0x566dec=0xc8;}else{_0x566dec=0xce;}_0x4829a9[_0x8a52('0x19')](_0x566dec);return _0x4829a9[_0x8a52('0x1e')]('Content-Range',_0x4597cb+'-'+_0x261b7b+'/'+_0x35e527)[_0x8a52('0x1b')](_0x2d45db);}return null;};}function patchUpdates(_0x2c9df3){return function(_0x57ffa9){try{jsonpatch[_0x8a52('0x1f')](_0x57ffa9,_0x2c9df3,!![]);}catch(_0x3c8c3e){return BPromise[_0x8a52('0x20')](_0x3c8c3e);}return _0x57ffa9[_0x8a52('0x21')]();};}function saveUpdates(_0x268e75,_0x4e6ca4){return function(_0x312b41){if(_0x312b41){return _0x312b41['update'](_0x268e75)[_0x8a52('0x22')](function(_0x182216){return _0x182216;});}return null;};}function removeEntity(_0x4dc448,_0x2d4426){return function(_0xcf0dd4){if(_0xcf0dd4){return _0xcf0dd4[_0x8a52('0x23')]()[_0x8a52('0x22')](function(){_0x4dc448['status'](0xcc)[_0x8a52('0x1a')]();});}};}function handleEntityNotFound(_0x54875b,_0x2d4e9a){return function(_0x30d110){if(!_0x30d110){_0x54875b[_0x8a52('0x18')](0x194);}return _0x30d110;};}function handleError(_0x3b4b14,_0x3f64b8){_0x3f64b8=_0x3f64b8||0x1f4;return function(_0x15785a){logger[_0x8a52('0x24')](_0x15785a[_0x8a52('0x25')]);if(_0x15785a[_0x8a52('0x26')]){delete _0x15785a[_0x8a52('0x26')];}_0x3b4b14[_0x8a52('0x19')](_0x3f64b8)['send'](_0x15785a);};}exports['index']=function(_0x35920c,_0x1ee0b1){var _0x162120={},_0x27e01e={},_0x497848={'count':0x0,'rows':[]};var _0x3cc510=_[_0x8a52('0x27')](db[_0x8a52('0x28')][_0x8a52('0x29')],function(_0x5b46d3){return{'name':_0x5b46d3['fieldName'],'type':_0x5b46d3[_0x8a52('0x2a')][_0x8a52('0x2b')]};});_0x27e01e[_0x8a52('0x2c')]=_[_0x8a52('0x27')](_0x3cc510,'name');_0x27e01e[_0x8a52('0x2d')]=_[_0x8a52('0x2e')](_0x35920c[_0x8a52('0x2d')]);_0x27e01e[_0x8a52('0x2f')]=_['intersection'](_0x27e01e['model'],_0x27e01e[_0x8a52('0x2d')]);_0x162120[_0x8a52('0x30')]=_[_0x8a52('0x31')](_0x27e01e['model'],qs[_0x8a52('0x32')](_0x35920c[_0x8a52('0x2d')][_0x8a52('0x32')]));_0x162120[_0x8a52('0x30')]=_0x162120[_0x8a52('0x30')][_0x8a52('0x33')]?_0x162120['attributes']:_0x27e01e['model'];if(!_0x35920c[_0x8a52('0x2d')][_0x8a52('0x34')](_0x8a52('0x35'))){_0x162120[_0x8a52('0x36')]=qs['limit'](_0x35920c['query'][_0x8a52('0x36')]);_0x162120['offset']=qs[_0x8a52('0x1d')](_0x35920c[_0x8a52('0x2d')][_0x8a52('0x1d')]);}_0x162120[_0x8a52('0x37')]=qs[_0x8a52('0x38')](_0x35920c[_0x8a52('0x2d')]['sort']);_0x162120[_0x8a52('0x39')]=qs[_0x8a52('0x2f')](_[_0x8a52('0x3a')](_0x35920c[_0x8a52('0x2d')],_0x27e01e[_0x8a52('0x2f')]),_0x3cc510);if(_0x35920c[_0x8a52('0x2d')][_0x8a52('0x3b')]){_0x162120[_0x8a52('0x39')]=_[_0x8a52('0x3c')](_0x162120[_0x8a52('0x39')],{'$or':_[_0x8a52('0x27')](_0x3cc510,function(_0x3ef914){if(_0x3ef914['type']!==_0x8a52('0x3d')){var _0x1da568={};_0x1da568[_0x3ef914[_0x8a52('0x26')]]={'$like':'%'+_0x35920c[_0x8a52('0x2d')][_0x8a52('0x3b')]+'%'};return _0x1da568;}})});}_0x162120=_[_0x8a52('0x3c')]({},_0x162120,_0x35920c[_0x8a52('0x3e')]);var _0xdc0fc={'where':_0x162120[_0x8a52('0x39')]};return db[_0x8a52('0x28')][_0x8a52('0x1c')](_0xdc0fc)['then'](function(_0xf451e7){_0x497848[_0x8a52('0x1c')]=_0xf451e7;if(_0x35920c['query'][_0x8a52('0x3f')]){_0x162120[_0x8a52('0x40')]=[{'all':!![]}];}return db[_0x8a52('0x28')][_0x8a52('0x41')](_0x162120);})[_0x8a52('0x22')](function(_0x11be3a){_0x497848[_0x8a52('0x42')]=_0x11be3a;return _0x497848;})[_0x8a52('0x22')](respondWithFilteredResult(_0x1ee0b1,_0x162120))['catch'](handleError(_0x1ee0b1,null));};exports[_0x8a52('0x43')]=function(_0x1d6420,_0x2cfe75){var _0x24191d={'raw':!![],'where':{'id':_0x1d6420[_0x8a52('0x44')]['id']}},_0x375cc0={};_0x375cc0[_0x8a52('0x2c')]=_[_0x8a52('0x2e')](db[_0x8a52('0x28')][_0x8a52('0x29')]);_0x375cc0['query']=_[_0x8a52('0x2e')](_0x1d6420[_0x8a52('0x2d')]);_0x375cc0[_0x8a52('0x45')]=_[_0x8a52('0x31')](_0x375cc0[_0x8a52('0x2c')],_0x375cc0[_0x8a52('0x2d')]);_0x24191d[_0x8a52('0x30')]=_[_0x8a52('0x31')](_0x375cc0[_0x8a52('0x2c')],qs[_0x8a52('0x32')](_0x1d6420[_0x8a52('0x2d')][_0x8a52('0x32')]));_0x24191d[_0x8a52('0x30')]=_0x24191d[_0x8a52('0x30')][_0x8a52('0x33')]?_0x24191d[_0x8a52('0x30')]:_0x375cc0[_0x8a52('0x2c')];if(_0x1d6420[_0x8a52('0x2d')][_0x8a52('0x3f')]){_0x24191d[_0x8a52('0x40')]=[{'all':!![]}];}_0x24191d=_[_0x8a52('0x3c')]({},_0x24191d,_0x1d6420[_0x8a52('0x3e')]);return db[_0x8a52('0x28')]['find'](_0x24191d)[_0x8a52('0x22')](handleEntityNotFound(_0x2cfe75,null))[_0x8a52('0x22')](respondWithResult(_0x2cfe75,null))[_0x8a52('0x46')](handleError(_0x2cfe75,null));};exports[_0x8a52('0x47')]=function(_0x1a3a51,_0x3884bf){return db[_0x8a52('0x28')][_0x8a52('0x47')](_0x1a3a51[_0x8a52('0x48')],{})[_0x8a52('0x22')](respondWithResult(_0x3884bf,0xc9))['catch'](handleError(_0x3884bf,null));};exports[_0x8a52('0x49')]=function(_0xe8d992,_0x524bc6){if(_0xe8d992['body']['id']){delete _0xe8d992[_0x8a52('0x48')]['id'];}return db[_0x8a52('0x28')][_0x8a52('0x4a')]({'where':{'id':_0xe8d992[_0x8a52('0x44')]['id']}})['then'](handleEntityNotFound(_0x524bc6,null))[_0x8a52('0x22')](saveUpdates(_0xe8d992[_0x8a52('0x48')],null))[_0x8a52('0x22')](respondWithResult(_0x524bc6,null))[_0x8a52('0x46')](handleError(_0x524bc6,null));};exports[_0x8a52('0x23')]=function(_0x48d1d5,_0x25672b){return db[_0x8a52('0x28')][_0x8a52('0x4a')]({'where':{'id':_0x48d1d5[_0x8a52('0x44')]['id']}})[_0x8a52('0x22')](handleEntityNotFound(_0x25672b,null))[_0x8a52('0x22')](removeEntity(_0x25672b,null))['catch'](handleError(_0x25672b,null));};exports['describe']=function(_0x34f7ac,_0x5ce492){return db[_0x8a52('0x28')]['describe']()[_0x8a52('0x22')](respondWithResult(_0x5ce492,null))[_0x8a52('0x46')](handleError(_0x5ce492,null));}; \ No newline at end of file +var _0xe833=['params','keys','rawAttributes','filtears','find','create','update','body','destroy','describe','html-pdf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','Content-Range','apply','reject','then','sendStatus','stack','name','send','map','SmsTransferReport','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x2deb15,_0x102a17){var _0x1abb33=function(_0x1a1a10){while(--_0x1a1a10){_0x2deb15['push'](_0x2deb15['shift']());}};_0x1abb33(++_0x102a17);}(_0xe833,0x1c6));var _0x3e83=function(_0x129902,_0x13a47a){_0x129902=_0x129902-0x0;var _0x51c7df=_0xe833[_0x129902];return _0x51c7df;};'use strict';var pdf=require(_0x3e83('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3e83('0x1'));var jsonpatch=require(_0x3e83('0x2'));var rp=require('request-promise');var moment=require(_0x3e83('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3e83('0x4'));var util=require(_0x3e83('0x5'));var path=require(_0x3e83('0x6'));var sox=require(_0x3e83('0x7'));var csv=require('to-csv');var ejs=require(_0x3e83('0x8'));var fs=require('fs');var _=require(_0x3e83('0x9'));var squel=require(_0x3e83('0xa'));var crypto=require(_0x3e83('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3e83('0xc'));var toCsv=require(_0x3e83('0xd'));var querystring=require(_0x3e83('0xe'));var Papa=require(_0x3e83('0xf'));var Redis=require('ioredis');var authService=require(_0x3e83('0x10'));var qs=require(_0x3e83('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e83('0x12'));var logger=require(_0x3e83('0x13'))(_0x3e83('0x14'));var utils=require(_0x3e83('0x15'));var config=require(_0x3e83('0x16'));var licenseUtil=require(_0x3e83('0x17'));var db=require(_0x3e83('0x18'))['db'];function respondWithStatusCode(_0x39dae7,_0x14b09a){_0x14b09a=_0x14b09a||0xcc;return function(_0x58d7b8){if(_0x58d7b8){return _0x39dae7['sendStatus'](_0x14b09a);}return _0x39dae7[_0x3e83('0x19')](_0x14b09a)[_0x3e83('0x1a')]();};}function respondWithResult(_0x1c5040,_0x1b4ffd){_0x1b4ffd=_0x1b4ffd||0xc8;return function(_0x488c23){if(_0x488c23){return _0x1c5040[_0x3e83('0x19')](_0x1b4ffd)[_0x3e83('0x1b')](_0x488c23);}};}function respondWithFilteredResult(_0x3c3a68,_0x32354b){return function(_0x349fb8){if(_0x349fb8){var _0x189a6c=_0x349fb8[_0x3e83('0x1c')],_0x16a2d4=_0x32354b[_0x3e83('0x1d')],_0x3e09f2=_0x32354b['offset']+_0x32354b['limit'],_0x1a9135;if(_0x3e09f2>=_0x189a6c){_0x3e09f2=_0x189a6c;_0x1a9135=0xc8;}else{_0x1a9135=0xce;}_0x3c3a68[_0x3e83('0x19')](_0x1a9135);return _0x3c3a68['set'](_0x3e83('0x1e'),_0x16a2d4+'-'+_0x3e09f2+'/'+_0x189a6c)[_0x3e83('0x1b')](_0x349fb8);}return null;};}function patchUpdates(_0x285662){return function(_0x3b0cd8){try{jsonpatch[_0x3e83('0x1f')](_0x3b0cd8,_0x285662,!![]);}catch(_0x48dd3d){return BPromise[_0x3e83('0x20')](_0x48dd3d);}return _0x3b0cd8['save']();};}function saveUpdates(_0x4d4102,_0x471233){return function(_0x5f56fa){if(_0x5f56fa){return _0x5f56fa['update'](_0x4d4102)['then'](function(_0x404d7b){return _0x404d7b;});}return null;};}function removeEntity(_0x41772b,_0x4fd0ff){return function(_0x19a9ac){if(_0x19a9ac){return _0x19a9ac['destroy']()[_0x3e83('0x21')](function(){_0x41772b['status'](0xcc)[_0x3e83('0x1a')]();});}};}function handleEntityNotFound(_0x5cd263,_0x246738){return function(_0x2e86a6){if(!_0x2e86a6){_0x5cd263[_0x3e83('0x22')](0x194);}return _0x2e86a6;};}function handleError(_0x30e498,_0x1a97f1){_0x1a97f1=_0x1a97f1||0x1f4;return function(_0x207f8e){logger['error'](_0x207f8e[_0x3e83('0x23')]);if(_0x207f8e[_0x3e83('0x24')]){delete _0x207f8e['name'];}_0x30e498[_0x3e83('0x19')](_0x1a97f1)[_0x3e83('0x25')](_0x207f8e);};}exports['index']=function(_0x214e80,_0x372d9c){var _0x367cf6={},_0x172dc4={},_0x4a0056={'count':0x0,'rows':[]};var _0x315a90=_[_0x3e83('0x26')](db[_0x3e83('0x27')]['rawAttributes'],function(_0x490e58){return{'name':_0x490e58['fieldName'],'type':_0x490e58['type']['key']};});_0x172dc4['model']=_[_0x3e83('0x26')](_0x315a90,_0x3e83('0x24'));_0x172dc4[_0x3e83('0x28')]=_['keys'](_0x214e80[_0x3e83('0x28')]);_0x172dc4[_0x3e83('0x29')]=_['intersection'](_0x172dc4[_0x3e83('0x2a')],_0x172dc4['query']);_0x367cf6[_0x3e83('0x2b')]=_[_0x3e83('0x2c')](_0x172dc4['model'],qs[_0x3e83('0x2d')](_0x214e80[_0x3e83('0x28')]['fields']));_0x367cf6[_0x3e83('0x2b')]=_0x367cf6[_0x3e83('0x2b')][_0x3e83('0x2e')]?_0x367cf6['attributes']:_0x172dc4[_0x3e83('0x2a')];if(!_0x214e80[_0x3e83('0x28')][_0x3e83('0x2f')]('nolimit')){_0x367cf6['limit']=qs[_0x3e83('0x30')](_0x214e80['query']['limit']);_0x367cf6[_0x3e83('0x1d')]=qs['offset'](_0x214e80[_0x3e83('0x28')][_0x3e83('0x1d')]);}_0x367cf6[_0x3e83('0x31')]=qs[_0x3e83('0x32')](_0x214e80['query']['sort']);_0x367cf6[_0x3e83('0x33')]=qs[_0x3e83('0x29')](_[_0x3e83('0x34')](_0x214e80[_0x3e83('0x28')],_0x172dc4['filters']),_0x315a90);if(_0x214e80[_0x3e83('0x28')][_0x3e83('0x35')]){_0x367cf6[_0x3e83('0x33')]=_[_0x3e83('0x36')](_0x367cf6[_0x3e83('0x33')],{'$or':_[_0x3e83('0x26')](_0x315a90,function(_0x3be017){if(_0x3be017[_0x3e83('0x37')]!==_0x3e83('0x38')){var _0x399899={};_0x399899[_0x3be017[_0x3e83('0x24')]]={'$like':'%'+_0x214e80[_0x3e83('0x28')][_0x3e83('0x35')]+'%'};return _0x399899;}})});}_0x367cf6=_[_0x3e83('0x36')]({},_0x367cf6,_0x214e80[_0x3e83('0x39')]);var _0x58fa0b={'where':_0x367cf6['where']};return db[_0x3e83('0x27')][_0x3e83('0x1c')](_0x58fa0b)[_0x3e83('0x21')](function(_0x2a626d){_0x4a0056['count']=_0x2a626d;if(_0x214e80['query'][_0x3e83('0x3a')]){_0x367cf6[_0x3e83('0x3b')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x3e83('0x3c')](_0x367cf6);})['then'](function(_0x54ce70){_0x4a0056[_0x3e83('0x3d')]=_0x54ce70;return _0x4a0056;})['then'](respondWithFilteredResult(_0x372d9c,_0x367cf6))[_0x3e83('0x3e')](handleError(_0x372d9c,null));};exports[_0x3e83('0x3f')]=function(_0x54ad6f,_0x19ada9){var _0x4db5b7={'raw':!![],'where':{'id':_0x54ad6f[_0x3e83('0x40')]['id']}},_0x2e5cac={};_0x2e5cac[_0x3e83('0x2a')]=_[_0x3e83('0x41')](db[_0x3e83('0x27')][_0x3e83('0x42')]);_0x2e5cac[_0x3e83('0x28')]=_[_0x3e83('0x41')](_0x54ad6f[_0x3e83('0x28')]);_0x2e5cac[_0x3e83('0x43')]=_[_0x3e83('0x2c')](_0x2e5cac[_0x3e83('0x2a')],_0x2e5cac[_0x3e83('0x28')]);_0x4db5b7[_0x3e83('0x2b')]=_['intersection'](_0x2e5cac[_0x3e83('0x2a')],qs[_0x3e83('0x2d')](_0x54ad6f[_0x3e83('0x28')][_0x3e83('0x2d')]));_0x4db5b7[_0x3e83('0x2b')]=_0x4db5b7['attributes']['length']?_0x4db5b7[_0x3e83('0x2b')]:_0x2e5cac[_0x3e83('0x2a')];if(_0x54ad6f['query'][_0x3e83('0x3a')]){_0x4db5b7[_0x3e83('0x3b')]=[{'all':!![]}];}_0x4db5b7=_[_0x3e83('0x36')]({},_0x4db5b7,_0x54ad6f[_0x3e83('0x39')]);return db[_0x3e83('0x27')][_0x3e83('0x44')](_0x4db5b7)[_0x3e83('0x21')](handleEntityNotFound(_0x19ada9,null))['then'](respondWithResult(_0x19ada9,null))[_0x3e83('0x3e')](handleError(_0x19ada9,null));};exports[_0x3e83('0x45')]=function(_0x204138,_0x1d2b31){return db[_0x3e83('0x27')]['create'](_0x204138['body'],{})[_0x3e83('0x21')](respondWithResult(_0x1d2b31,0xc9))['catch'](handleError(_0x1d2b31,null));};exports[_0x3e83('0x46')]=function(_0x339e17,_0x4cd216){if(_0x339e17[_0x3e83('0x47')]['id']){delete _0x339e17['body']['id'];}return db[_0x3e83('0x27')][_0x3e83('0x44')]({'where':{'id':_0x339e17[_0x3e83('0x40')]['id']}})[_0x3e83('0x21')](handleEntityNotFound(_0x4cd216,null))[_0x3e83('0x21')](saveUpdates(_0x339e17[_0x3e83('0x47')],null))[_0x3e83('0x21')](respondWithResult(_0x4cd216,null))['catch'](handleError(_0x4cd216,null));};exports[_0x3e83('0x48')]=function(_0x46280e,_0x3c4a0d){return db[_0x3e83('0x27')]['find']({'where':{'id':_0x46280e['params']['id']}})[_0x3e83('0x21')](handleEntityNotFound(_0x3c4a0d,null))['then'](removeEntity(_0x3c4a0d,null))[_0x3e83('0x3e')](handleError(_0x3c4a0d,null));};exports[_0x3e83('0x49')]=function(_0x1be026,_0x4a1021){return db[_0x3e83('0x27')][_0x3e83('0x49')]()[_0x3e83('0x21')](respondWithResult(_0x4a1021,null))[_0x3e83('0x3e')](handleError(_0x4a1021,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index d8bddeb..d226386 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 _0x0309=['bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','define','report_sms_transfer','uniqueid','lodash','../../config/logger','moment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0309,0x165));var _0x9030=function(_0x474d4c,_0x244969){_0x474d4c=_0x474d4c-0x0;var _0x3fa1aa=_0x0309[_0x474d4c];return _0x3fa1aa;};'use strict';var _=require(_0x9030('0x0'));var util=require('util');var logger=require(_0x9030('0x1'))('api');var moment=require(_0x9030('0x2'));var BPromise=require(_0x9030('0x3'));var rp=require(_0x9030('0x4'));var fs=require('fs');var path=require(_0x9030('0x5'));var rimraf=require(_0x9030('0x6'));var config=require(_0x9030('0x7'));var attributes=require(_0x9030('0x8'));module['exports']=function(_0x5a3334,_0x1c9c7b){return _0x5a3334[_0x9030('0x9')]('SmsTransferReport',attributes,{'tableName':_0x9030('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9030('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbd51=['./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1dd12d,_0x30ba57){var _0x203d0a=function(_0x2cc94a){while(--_0x2cc94a){_0x1dd12d['push'](_0x1dd12d['shift']());}};_0x203d0a(++_0x30ba57);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x37eae2,_0x347043){_0x37eae2=_0x37eae2-0x0;var _0x287dab=_0xbd51[_0x37eae2];return _0x287dab;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var logger=require(_0x1bd5('0x1'))(_0x1bd5('0x2'));var moment=require(_0x1bd5('0x3'));var BPromise=require(_0x1bd5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1bd5('0x5'));module[_0x1bd5('0x6')]=function(_0x43e6b6,_0x59ddfb){return _0x43e6b6[_0x1bd5('0x7')](_0x1bd5('0x8'),attributes,{'tableName':_0x1bd5('0x9'),'paranoid':![],'indexes':[{'name':_0x1bd5('0xa'),'fields':[_0x1bd5('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 09b9576..98873b0 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 _0x36a2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x3ab61a,_0x452053){var _0xb7841c=function(_0x22623c){while(--_0x22623c){_0x3ab61a['push'](_0x3ab61a['shift']());}};_0xb7841c(++_0x452053);}(_0x36a2,0x111));var _0x236a=function(_0x4aa662,_0x1cc90c){_0x4aa662=_0x4aa662-0x0;var _0x336478=_0x36a2[_0x4aa662];return _0x336478;};'use strict';var _=require(_0x236a('0x0'));var util=require(_0x236a('0x1'));var moment=require(_0x236a('0x2'));var BPromise=require(_0x236a('0x3'));var rs=require(_0x236a('0x4'));var fs=require('fs');var Redis=require(_0x236a('0x5'));var db=require(_0x236a('0x6'))['db'];var utils=require(_0x236a('0x7'));var logger=require(_0x236a('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x236a('0x9'));var client=jayson['client'][_0x236a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x436ed8,_0x560744,_0x16b0e0){return new BPromise(function(_0x5be0f3,_0x5b8dda){return client[_0x236a('0xb')](_0x436ed8,_0x16b0e0)[_0x236a('0xc')](function(_0x3444e2){logger[_0x236a('0xd')](_0x236a('0xe'),_0x560744,_0x236a('0xf'));logger[_0x236a('0x10')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x560744,_0x236a('0xf'),JSON[_0x236a('0x11')](_0x3444e2));if(_0x3444e2['error']){if(_0x3444e2[_0x236a('0x12')][_0x236a('0x13')]===0x1f4){logger[_0x236a('0x12')](_0x236a('0xe'),_0x560744,_0x3444e2[_0x236a('0x12')][_0x236a('0x14')]);return _0x5b8dda(_0x3444e2[_0x236a('0x12')][_0x236a('0x14')]);}logger[_0x236a('0x12')](_0x236a('0xe'),_0x560744,_0x3444e2['error']['message']);return _0x5be0f3(_0x3444e2['error'][_0x236a('0x14')]);}else{logger['info'](_0x236a('0xe'),_0x560744,_0x236a('0xf'));_0x5be0f3(_0x3444e2[_0x236a('0x15')][_0x236a('0x14')]);}})[_0x236a('0x16')](function(_0x25d503){logger[_0x236a('0x12')](_0x236a('0xe'),_0x560744,_0x25d503);_0x5b8dda(_0x25d503);});});} \ No newline at end of file +var _0xe359=['info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x4a721b,_0x2d1e2b){var _0x166cf3=function(_0x56f5d2){while(--_0x56f5d2){_0x4a721b['push'](_0x4a721b['shift']());}};_0x166cf3(++_0x2d1e2b);}(_0xe359,0xda));var _0x9e35=function(_0x9968ec,_0x408862){_0x9968ec=_0x9968ec-0x0;var _0x19d445=_0xe359[_0x9968ec];return _0x19d445;};'use strict';var _=require(_0x9e35('0x0'));var util=require(_0x9e35('0x1'));var moment=require('moment');var BPromise=require(_0x9e35('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e35('0x3'));var db=require(_0x9e35('0x4'))['db'];var utils=require(_0x9e35('0x5'));var logger=require(_0x9e35('0x6'))(_0x9e35('0x7'));var config=require(_0x9e35('0x8'));var jayson=require(_0x9e35('0x9'));var client=jayson['client'][_0x9e35('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1506bb,_0x875c6,_0x1ed0d1){return new BPromise(function(_0x2eaee1,_0x263cca){return client[_0x9e35('0xb')](_0x1506bb,_0x1ed0d1)['then'](function(_0x4a9b91){logger[_0x9e35('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x875c6,_0x9e35('0xd'));logger[_0x9e35('0xe')](_0x9e35('0xf'),_0x875c6,_0x9e35('0xd'),JSON[_0x9e35('0x10')](_0x4a9b91));if(_0x4a9b91[_0x9e35('0x11')]){if(_0x4a9b91[_0x9e35('0x11')][_0x9e35('0x12')]===0x1f4){logger[_0x9e35('0x11')](_0x9e35('0x13'),_0x875c6,_0x4a9b91[_0x9e35('0x11')]['message']);return _0x263cca(_0x4a9b91[_0x9e35('0x11')][_0x9e35('0x14')]);}logger[_0x9e35('0x11')](_0x9e35('0x13'),_0x875c6,_0x4a9b91[_0x9e35('0x11')]['message']);return _0x2eaee1(_0x4a9b91[_0x9e35('0x11')][_0x9e35('0x14')]);}else{logger[_0x9e35('0xc')](_0x9e35('0x13'),_0x875c6,_0x9e35('0xd'));_0x2eaee1(_0x4a9b91[_0x9e35('0x15')][_0x9e35('0x14')]);}})[_0x9e35('0x16')](function(_0xcdcf6f){logger[_0x9e35('0x11')](_0x9e35('0x13'),_0x875c6,_0xcdcf6f);_0x263cca(_0xcdcf6f);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index aeada96..41b28a8 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 _0xb35e=['now','post','single','file','create','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname','replace','format','%s-%s%s'];(function(_0x1325c4,_0x14f37a){var _0x4683b7=function(_0x1a886e){while(--_0x1a886e){_0x1325c4['push'](_0x1325c4['shift']());}};_0x4683b7(++_0x14f37a);}(_0xb35e,0x13f));var _0xeb35=function(_0x39ee47,_0x961844){_0x39ee47=_0x39ee47-0x0;var _0x5bb4f8=_0xb35e[_0x39ee47];return _0x5bb4f8;};'use strict';var multer=require(_0xeb35('0x0'));var util=require(_0xeb35('0x1'));var path=require(_0xeb35('0x2'));var timeout=require(_0xeb35('0x3'));var express=require(_0xeb35('0x4'));var router=express[_0xeb35('0x5')]();var auth=require(_0xeb35('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xeb35('0x7'));var controller=require(_0xeb35('0x8'));router[_0xeb35('0x9')]('/',auth[_0xeb35('0xa')](),controller[_0xeb35('0xb')]);router[_0xeb35('0x9')]('/:id',auth[_0xeb35('0xa')](),controller[_0xeb35('0xc')]);router['get'](_0xeb35('0xd'),auth[_0xeb35('0xa')](),controller[_0xeb35('0xe')]);var upload=multer({'storage':multer[_0xeb35('0xf')]({'destination':function(_0x2bca70,_0x4cc105,_0x5a1e89){_0x5a1e89(null,path[_0xeb35('0x10')](config['root'],_0xeb35('0x11')));},'filename':function(_0x33b04b,_0x2d7d33,_0x5a6e1f){_0x2d7d33[_0xeb35('0x12')]=_0x2d7d33[_0xeb35('0x12')][_0xeb35('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5a6e1f(null,util[_0xeb35('0x14')](_0xeb35('0x15'),path['basename'](_0x2d7d33[_0xeb35('0x12')],path['extname'](_0x2d7d33['originalname'])),Date[_0xeb35('0x16')](),path['extname'](_0x2d7d33[_0xeb35('0x12')])));}})});router[_0xeb35('0x17')]('/',upload[_0xeb35('0x18')](_0xeb35('0x19')),controller[_0xeb35('0x1a')]);router['put'](_0xeb35('0x1b'),auth[_0xeb35('0xa')](),controller[_0xeb35('0x1c')]);router[_0xeb35('0x1d')]('/:id',auth[_0xeb35('0xa')](),controller['delete']);module[_0xeb35('0x1e')]=router; \ No newline at end of file +var _0xb25b=['connect-timeout','express','Router','../../components/auth/service','./sound.controller','isAuthenticated','get','/:id','show','diskStorage','join','root','originalname','replace','format','%s-%s%s','extname','now','single','file','delete','exports','multer'];(function(_0x2df1f2,_0x58d388){var _0x38652b=function(_0x18e322){while(--_0x18e322){_0x2df1f2['push'](_0x2df1f2['shift']());}};_0x38652b(++_0x58d388);}(_0xb25b,0xa0));var _0xbb25=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb25b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbb25('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbb25('0x1'));var express=require(_0xbb25('0x2'));var router=express[_0xbb25('0x3')]();var auth=require(_0xbb25('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbb25('0x5'));router['get']('/',auth[_0xbb25('0x6')](),controller['index']);router[_0xbb25('0x7')](_0xbb25('0x8'),auth[_0xbb25('0x6')](),controller[_0xbb25('0x9')]);router[_0xbb25('0x7')]('/:id/download',auth[_0xbb25('0x6')](),controller['download']);var upload=multer({'storage':multer[_0xbb25('0xa')]({'destination':function(_0x5b5378,_0x9a6ed6,_0x55ec18){_0x55ec18(null,path[_0xbb25('0xb')](config[_0xbb25('0xc')],'server/files/sounds/original/'));},'filename':function(_0x592a2a,_0xcfb024,_0x59f398){_0xcfb024[_0xbb25('0xd')]=_0xcfb024[_0xbb25('0xd')][_0xbb25('0xe')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59f398(null,util[_0xbb25('0xf')](_0xbb25('0x10'),path['basename'](_0xcfb024[_0xbb25('0xd')],path[_0xbb25('0x11')](_0xcfb024[_0xbb25('0xd')])),Date[_0xbb25('0x12')](),path[_0xbb25('0x11')](_0xcfb024['originalname'])));}})});router['post']('/',upload[_0xbb25('0x13')](_0xbb25('0x14')),controller['create']);router['put'](_0xbb25('0x8'),auth[_0xbb25('0x6')](),controller['update']);router[_0xbb25('0x15')](_0xbb25('0x8'),auth[_0xbb25('0x6')](),controller[_0xbb25('0x15')]);module[_0xbb25('0x16')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 59daf65..5d98678 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 _0x092b=['sequelize','STRING','name','BIGINT','INTEGER','FLOAT'];(function(_0x247405,_0x390f4e){var _0x52404f=function(_0x272c5c){while(--_0x272c5c){_0x247405['push'](_0x247405['shift']());}};_0x52404f(++_0x390f4e);}(_0x092b,0x168));var _0xb092=function(_0xb78086,_0x3ec82b){_0xb78086=_0xb78086-0x0;var _0x2b2526=_0x092b[_0xb78086];return _0x2b2526;};'use strict';var Sequelize=require(_0xb092('0x0'));module['exports']={'name':{'type':Sequelize[_0xb092('0x1')],'unique':_0xb092('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xb092('0x1')]},'display_name':{'type':Sequelize[_0xb092('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xb092('0x1')]},'original_format':{'type':Sequelize[_0xb092('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xb092('0x3')]},'original_channelCount':{'type':Sequelize[_0xb092('0x4')]},'original_bitRate':{'type':Sequelize[_0xb092('0x3')]},'original_sampleRate':{'type':Sequelize[_0xb092('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xb092('0x5')]},'converted_sampleCount':{'type':Sequelize[_0xb092('0x3')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xb092('0x3')]},'converted_sampleRate':{'type':Sequelize[_0xb092('0x4')]}}; \ No newline at end of file +var _0x348e=['name','FLOAT','INTEGER','BIGINT','sequelize','exports','STRING'];(function(_0x3b87f4,_0x112243){var _0x63d16e=function(_0x3e7323){while(--_0x3e7323){_0x3b87f4['push'](_0x3b87f4['shift']());}};_0x63d16e(++_0x112243);}(_0x348e,0x1ee));var _0xe348=function(_0x27daf4,_0x5663c4){_0x27daf4=_0x27daf4-0x0;var _0xf59dd6=_0x348e[_0x27daf4];return _0xf59dd6;};'use strict';var Sequelize=require(_0xe348('0x0'));module[_0xe348('0x1')]={'name':{'type':Sequelize[_0xe348('0x2')],'unique':_0xe348('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xe348('0x2')]},'display_name':{'type':Sequelize[_0xe348('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xe348('0x2')]},'original_format':{'type':Sequelize[_0xe348('0x2')]},'original_duration':{'type':Sequelize[_0xe348('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xe348('0x5')]},'converted_format':{'type':Sequelize[_0xe348('0x2')]},'converted_duration':{'type':Sequelize[_0xe348('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xe348('0x5')]},'converted_bitRate':{'type':Sequelize[_0xe348('0x6')]},'converted_sampleRate':{'type':Sequelize[_0xe348('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 1441b8c..95c1d59 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 _0x7f73=['file','originalname','filename','extname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','0777','send','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','end','chmodSync','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','error','start','update','description','delete','original_format','unlinkSync','html-pdf','eml-format','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/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','Sounds','UserProfileResource','stack','name','index','map','Sound','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','length','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','find','download','save_name','converted_format','existsSync','join','root','Sequelize','ValidationError','server/files/sounds/converted','format','%s.%s','create','basename'];(function(_0xefae85,_0x1b1c2f){var _0x3935fe=function(_0x5191df){while(--_0x5191df){_0xefae85['push'](_0xefae85['shift']());}};_0x3935fe(++_0x1b1c2f);}(_0x7f73,0x128));var _0x37f7=function(_0x19dd02,_0x3a98c7){_0x19dd02=_0x19dd02-0x0;var _0x347853=_0x7f73[_0x19dd02];return _0x347853;};'use strict';var pdf=require(_0x37f7('0x0'));var emlformat=require(_0x37f7('0x1'));var rimraf=require(_0x37f7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x37f7('0x3'));var rp=require(_0x37f7('0x4'));var moment=require(_0x37f7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x37f7('0x6'));var util=require(_0x37f7('0x7'));var path=require(_0x37f7('0x8'));var sox=require('sox');var csv=require(_0x37f7('0x9'));var ejs=require(_0x37f7('0xa'));var fs=require('fs');var _=require(_0x37f7('0xb'));var squel=require(_0x37f7('0xc'));var crypto=require(_0x37f7('0xd'));var jsforce=require(_0x37f7('0xe'));var deskjs=require(_0x37f7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x37f7('0x10'));var Papa=require(_0x37f7('0x11'));var Redis=require(_0x37f7('0x12'));var authService=require(_0x37f7('0x13'));var qs=require(_0x37f7('0x14'));var as=require(_0x37f7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x37f7('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a36f4,_0x3475e0){_0x3475e0=_0x3475e0||0xcc;return function(_0x4ec302){if(_0x4ec302){return _0x1a36f4[_0x37f7('0x17')](_0x3475e0);}return _0x1a36f4[_0x37f7('0x18')](_0x3475e0)['end']();};}function respondWithResult(_0x3e4556,_0x50e449){_0x50e449=_0x50e449||0xc8;return function(_0xaee4d8){if(_0xaee4d8){return _0x3e4556[_0x37f7('0x18')](_0x50e449)[_0x37f7('0x19')](_0xaee4d8);}};}function respondWithFilteredResult(_0x84a9b2,_0x26e43b){return function(_0x24a15e){if(_0x24a15e){var _0x13c72b=_0x24a15e[_0x37f7('0x1a')],_0x2e50e3=_0x26e43b[_0x37f7('0x1b')],_0x4268bd=_0x26e43b[_0x37f7('0x1b')]+_0x26e43b[_0x37f7('0x1c')],_0x4d5ae3;if(_0x4268bd>=_0x13c72b){_0x4268bd=_0x13c72b;_0x4d5ae3=0xc8;}else{_0x4d5ae3=0xce;}_0x84a9b2[_0x37f7('0x18')](_0x4d5ae3);return _0x84a9b2[_0x37f7('0x1d')](_0x37f7('0x1e'),_0x2e50e3+'-'+_0x4268bd+'/'+_0x13c72b)[_0x37f7('0x19')](_0x24a15e);}return null;};}function patchUpdates(_0x3a3b7f){return function(_0x21e5bf){try{jsonpatch[_0x37f7('0x1f')](_0x21e5bf,_0x3a3b7f,!![]);}catch(_0x4a10cf){return BPromise[_0x37f7('0x20')](_0x4a10cf);}return _0x21e5bf[_0x37f7('0x21')]();};}function saveUpdates(_0x1fa02e,_0x45ff11){return function(_0x24e4d9){if(_0x24e4d9){return _0x24e4d9['update'](_0x1fa02e)[_0x37f7('0x22')](function(_0x135b6c){return _0x135b6c;});}return null;};}function removeEntity(_0x2d96fb,_0x31f8c3){return function(_0x442fbf){if(_0x442fbf){return _0x442fbf[_0x37f7('0x23')]()[_0x37f7('0x22')](function(){var _0x5aaa1e=_0x442fbf['get']({'plain':!![]});var _0x597a80=_0x37f7('0x24');return db[_0x37f7('0x25')][_0x37f7('0x23')]({'where':{'type':_0x597a80,'resourceId':_0x5aaa1e['id']}})['then'](function(){return _0x442fbf;});})[_0x37f7('0x22')](function(){_0x2d96fb[_0x37f7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21a813,_0x2563f2){return function(_0x1b824d){if(!_0x1b824d){_0x21a813[_0x37f7('0x17')](0x194);}return _0x1b824d;};}function handleError(_0x3bfb9f,_0x51c673){_0x51c673=_0x51c673||0x1f4;return function(_0x491e96){logger['error'](_0x491e96[_0x37f7('0x26')]);if(_0x491e96[_0x37f7('0x27')]){delete _0x491e96[_0x37f7('0x27')];}_0x3bfb9f['status'](_0x51c673)['send'](_0x491e96);};}exports[_0x37f7('0x28')]=function(_0x1baf5f,_0x5cfe62){var _0x399864={},_0x433ac3={},_0x311be8={'count':0x0,'rows':[]};var _0x3a5192=_[_0x37f7('0x29')](db[_0x37f7('0x2a')][_0x37f7('0x2b')],function(_0x571894){return{'name':_0x571894['fieldName'],'type':_0x571894['type'][_0x37f7('0x2c')]};});_0x433ac3[_0x37f7('0x2d')]=_[_0x37f7('0x29')](_0x3a5192,_0x37f7('0x27'));_0x433ac3['query']=_[_0x37f7('0x2e')](_0x1baf5f['query']);_0x433ac3[_0x37f7('0x2f')]=_[_0x37f7('0x30')](_0x433ac3[_0x37f7('0x2d')],_0x433ac3['query']);_0x399864[_0x37f7('0x31')]=_[_0x37f7('0x30')](_0x433ac3['model'],qs[_0x37f7('0x32')](_0x1baf5f[_0x37f7('0x33')][_0x37f7('0x32')]));_0x399864[_0x37f7('0x31')]=_0x399864[_0x37f7('0x31')][_0x37f7('0x34')]?_0x399864[_0x37f7('0x31')]:_0x433ac3[_0x37f7('0x2d')];if(!_0x1baf5f[_0x37f7('0x33')]['hasOwnProperty'](_0x37f7('0x35'))){_0x399864[_0x37f7('0x1c')]=qs[_0x37f7('0x1c')](_0x1baf5f['query'][_0x37f7('0x1c')]);_0x399864[_0x37f7('0x1b')]=qs[_0x37f7('0x1b')](_0x1baf5f[_0x37f7('0x33')][_0x37f7('0x1b')]);}_0x399864[_0x37f7('0x36')]=qs[_0x37f7('0x37')](_0x1baf5f[_0x37f7('0x33')]['sort']);_0x399864[_0x37f7('0x38')]=qs[_0x37f7('0x2f')](_[_0x37f7('0x39')](_0x1baf5f[_0x37f7('0x33')],_0x433ac3['filters']),_0x3a5192);if(_0x1baf5f[_0x37f7('0x33')][_0x37f7('0x3a')]){_0x399864[_0x37f7('0x38')]=_[_0x37f7('0x3b')](_0x399864[_0x37f7('0x38')],{'$or':_[_0x37f7('0x29')](_0x3a5192,function(_0x2438b0){if(_0x2438b0[_0x37f7('0x3c')]!=='VIRTUAL'){var _0x53052c={};_0x53052c[_0x2438b0[_0x37f7('0x27')]]={'$like':'%'+_0x1baf5f[_0x37f7('0x33')][_0x37f7('0x3a')]+'%'};return _0x53052c;}})});}_0x399864=_[_0x37f7('0x3b')]({},_0x399864,_0x1baf5f['options']);var _0x240d59={'where':_0x399864[_0x37f7('0x38')]};return db[_0x37f7('0x2a')]['count'](_0x240d59)[_0x37f7('0x22')](function(_0x6c4367){_0x311be8['count']=_0x6c4367;if(_0x1baf5f[_0x37f7('0x33')][_0x37f7('0x3d')]){_0x399864[_0x37f7('0x3e')]=[{'all':!![]}];}return db[_0x37f7('0x2a')][_0x37f7('0x3f')](_0x399864);})[_0x37f7('0x22')](function(_0x21b179){_0x311be8[_0x37f7('0x40')]=_0x21b179;return _0x311be8;})[_0x37f7('0x22')](respondWithFilteredResult(_0x5cfe62,_0x399864))[_0x37f7('0x41')](handleError(_0x5cfe62,null));};exports[_0x37f7('0x42')]=function(_0x551340,_0x1d5823){var _0x37eb8c={'raw':!![],'where':{'id':_0x551340[_0x37f7('0x43')]['id']}},_0x312f60={};_0x312f60[_0x37f7('0x2d')]=_[_0x37f7('0x2e')](db['Sound'][_0x37f7('0x2b')]);_0x312f60['query']=_[_0x37f7('0x2e')](_0x551340[_0x37f7('0x33')]);_0x312f60['filtears']=_[_0x37f7('0x30')](_0x312f60[_0x37f7('0x2d')],_0x312f60[_0x37f7('0x33')]);_0x37eb8c['attributes']=_[_0x37f7('0x30')](_0x312f60['model'],qs[_0x37f7('0x32')](_0x551340[_0x37f7('0x33')]['fields']));_0x37eb8c[_0x37f7('0x31')]=_0x37eb8c[_0x37f7('0x31')][_0x37f7('0x34')]?_0x37eb8c[_0x37f7('0x31')]:_0x312f60[_0x37f7('0x2d')];if(_0x551340[_0x37f7('0x33')][_0x37f7('0x3d')]){_0x37eb8c[_0x37f7('0x3e')]=[{'all':!![]}];}_0x37eb8c=_[_0x37f7('0x3b')]({},_0x37eb8c,_0x551340['options']);return db[_0x37f7('0x2a')][_0x37f7('0x44')](_0x37eb8c)[_0x37f7('0x22')](handleEntityNotFound(_0x1d5823,null))['then'](respondWithResult(_0x1d5823,null))[_0x37f7('0x41')](handleError(_0x1d5823,null));};exports[_0x37f7('0x45')]=function(_0x117349,_0x5c4461,_0x26c371){return db[_0x37f7('0x2a')]['find']({'where':{'id':_0x117349[_0x37f7('0x43')]['id']},'attributes':['name',_0x37f7('0x46'),_0x37f7('0x47')],'raw':!![]})[_0x37f7('0x22')](handleEntityNotFound(_0x5c4461,null))[_0x37f7('0x22')](function(_0x1aae79){if(_0x1aae79){if(!fs[_0x37f7('0x48')](path[_0x37f7('0x49')](config[_0x37f7('0x4a')],'server/files/sounds/converted',_0x1aae79['save_name']+'.'+_0x1aae79['converted_format']))){throw new db[(_0x37f7('0x4b'))][(_0x37f7('0x4c'))]('Sound\x20not\x20found');}return _0x5c4461[_0x37f7('0x45')](path[_0x37f7('0x49')](config[_0x37f7('0x4a')],_0x37f7('0x4d'),util[_0x37f7('0x4e')](_0x37f7('0x4f'),_0x1aae79['save_name'],_0x1aae79[_0x37f7('0x47')])),util[_0x37f7('0x4e')](_0x37f7('0x4f'),_0x1aae79['name'],_0x1aae79[_0x37f7('0x47')]));}return null;})[_0x37f7('0x41')](handleError(_0x5c4461,null));};exports[_0x37f7('0x50')]=function(_0xb6b8db,_0x4b5aa5,_0x4165ec){var _0x3426eb={'name':path[_0x37f7('0x51')](_0xb6b8db[_0x37f7('0x52')][_0x37f7('0x53')],path['extname'](_0xb6b8db[_0x37f7('0x52')]['originalname'])),'save_name':path[_0x37f7('0x51')](_0xb6b8db[_0x37f7('0x52')][_0x37f7('0x54')],path[_0x37f7('0x55')](_0xb6b8db[_0x37f7('0x52')]['filename'])),'original_format':path['extname'](_0xb6b8db[_0x37f7('0x52')][_0x37f7('0x53')])[_0x37f7('0x56')](0x1),'converted_format':_0x37f7('0x57')};var _0x4ad56b=path[_0x37f7('0x49')](config[_0x37f7('0x4a')],_0x37f7('0x58'),_0xb6b8db['file'][_0x37f7('0x54')]);var _0x5f0d4b=path[_0x37f7('0x49')](config['root'],_0x37f7('0x4d'),util['format'](_0x37f7('0x4f'),path['basename'](_0xb6b8db['file']['filename'],path[_0x37f7('0x55')](_0xb6b8db[_0x37f7('0x52')][_0x37f7('0x54')])),_0x3426eb['converted_format']));logger[_0x37f7('0x59')](_0x37f7('0x5a'),_0x4ad56b);logger[_0x37f7('0x59')]('Sound\x20upload\x20destination:\x20%s',_0x5f0d4b);try{fs['chmodSync'](_0x4ad56b,parseInt(_0x37f7('0x5b'),0x8));var _0x34202d=sox['transcode'](_0x4ad56b,_0x5f0d4b,{'sampleRate':0x1f40,'format':_0x37f7('0x57'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x34202d['on']('error',function(_0xfce07c){fs['unlinkSync'](_0x4ad56b);_0x4b5aa5[_0x37f7('0x18')](0x1f4)[_0x37f7('0x5c')](_0xfce07c);});_0x34202d['on'](_0x37f7('0x5d'),function(_0x427fec){_0x3426eb[_0x37f7('0x5e')]=isNaN(_0x427fec[_0x37f7('0x5f')])?null:_0x427fec[_0x37f7('0x5f')]*0x3e8;_0x3426eb[_0x37f7('0x60')]=isNaN(_0x427fec[_0x37f7('0x61')])?null:_0x427fec['sampleCount'];_0x3426eb[_0x37f7('0x62')]=isNaN(_0x427fec[_0x37f7('0x63')])?null:_0x427fec['channelCount'];_0x3426eb[_0x37f7('0x64')]=isNaN(_0x427fec[_0x37f7('0x65')])?null:_0x427fec[_0x37f7('0x65')];_0x3426eb[_0x37f7('0x66')]=isNaN(_0x427fec[_0x37f7('0x67')])?null:_0x427fec[_0x37f7('0x67')];});_0x34202d['on'](_0x37f7('0x68'),function(_0x5ee458){_0x3426eb[_0x37f7('0x69')]=isNaN(_0x5ee458[_0x37f7('0x5f')])?null:_0x5ee458[_0x37f7('0x5f')]*0x3e8;_0x3426eb[_0x37f7('0x6a')]=isNaN(_0x5ee458[_0x37f7('0x61')])?null:_0x5ee458[_0x37f7('0x61')];_0x3426eb[_0x37f7('0x6b')]=isNaN(_0x5ee458[_0x37f7('0x63')])?null:_0x5ee458['channelCount'];_0x3426eb['converted_bitRate']=isNaN(_0x5ee458['bitRate'])?null:_0x5ee458[_0x37f7('0x65')];_0x3426eb[_0x37f7('0x6c')]=isNaN(_0x5ee458['sampleRate'])?null:_0x5ee458[_0x37f7('0x67')];});_0x34202d['on'](_0x37f7('0x6d'),function(){fs[_0x37f7('0x6e')](_0x5f0d4b,parseInt('0777',0x8));return db[_0x37f7('0x2a')][_0x37f7('0x50')](_0x3426eb)['then'](function(_0x1f92e8){var _0x594620={'role':_0xb6b8db[_0x37f7('0x6f')][_0x37f7('0x70')],'userProfileId':_0xb6b8db[_0x37f7('0x6f')][_0x37f7('0x71')]};if(!_0x594620)throw new Error(_0x37f7('0x72'));if(_0x594620['role']===_0x37f7('0x73')){var _0x254c91=_0x1f92e8[_0x37f7('0x74')]({'plain':!![]});return db[_0x37f7('0x75')][_0x37f7('0x44')]({'where':{'name':_0x37f7('0x24'),'userProfileId':_0x594620[_0x37f7('0x71')]},'raw':!![]})[_0x37f7('0x22')](function(_0x1cc57f){if(_0x1cc57f&&_0x1cc57f[_0x37f7('0x76')]===0x0){return db[_0x37f7('0x25')][_0x37f7('0x50')]({'name':_0x254c91[_0x37f7('0x27')],'resourceId':_0x254c91['id'],'type':_0x1cc57f['name'],'sectionId':_0x1cc57f['id']},{})['then'](function(){return _0x1f92e8;});}else{return _0x1f92e8;}})[_0x37f7('0x41')](function(_0x503288){logger[_0x37f7('0x77')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x503288);throw _0x503288;});}return _0x1f92e8;})[_0x37f7('0x22')](respondWithResult(_0x4b5aa5,null))['catch'](handleError(_0x4b5aa5,null));});_0x34202d[_0x37f7('0x78')]();}catch(_0x4a1c55){_0x4b5aa5[_0x37f7('0x18')](0x1f4)[_0x37f7('0x5c')](_0x4a1c55);}};exports[_0x37f7('0x79')]=function(_0x3f292b,_0x5777c5,_0x35b515){return db[_0x37f7('0x2a')][_0x37f7('0x44')]({'where':{'id':_0x3f292b['params']['id']}})[_0x37f7('0x22')](handleEntityNotFound(_0x5777c5,null))['then'](saveUpdates(_[_0x37f7('0x39')](_0x3f292b[_0x37f7('0x6f')],[_0x37f7('0x27'),_0x37f7('0x7a')]),null))[_0x37f7('0x22')](respondWithResult(_0x5777c5,null))['catch'](handleError(_0x5777c5,null));};exports[_0x37f7('0x7b')]=function(_0x3457ba,_0x331725,_0x3cbc6e){return db['Sound'][_0x37f7('0x44')]({'where':{'id':_0x3457ba[_0x37f7('0x43')]['id']}})[_0x37f7('0x22')](function(_0x26a605){if(_0x26a605){return _0x26a605['destroy']();}})[_0x37f7('0x22')](function(_0x44d67f){var _0x372368=path[_0x37f7('0x49')](config['root'],_0x37f7('0x58'),util[_0x37f7('0x4e')]('%s.%s',_0x44d67f[_0x37f7('0x46')],_0x44d67f[_0x37f7('0x7c')]));var _0x54fb76=path[_0x37f7('0x49')](config['root'],_0x37f7('0x4d'),util[_0x37f7('0x4e')](_0x37f7('0x4f'),_0x44d67f[_0x37f7('0x46')],_0x44d67f[_0x37f7('0x47')]));fs[_0x37f7('0x7d')](_0x372368);fs['unlinkSync'](_0x54fb76);return _0x44d67f;})['then'](function(_0x2af264){if(_0x2af264){return _0x331725[_0x37f7('0x18')](0xcc)[_0x37f7('0x6d')]();}})[_0x37f7('0x22')](handleEntityNotFound(_0x331725,null))[_0x37f7('0x41')](handleError(_0x331725,null));}; \ No newline at end of file +var _0x813f=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','reject','save','update','destroy','then','get','Sounds','UserProfileResource','stack','send','index','map','rawAttributes','fieldName','type','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','Sound','includeAll','include','findAll','catch','length','find','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','download','format','create','basename','originalname','extname','file','filename','substring','wav','%s.%s','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','error','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x813f,0xf5));var _0xf813=function(_0x43c0f5,_0x5706e8){_0x43c0f5=_0x43c0f5-0x0;var _0x52d074=_0x813f[_0x43c0f5];return _0x52d074;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf813('0x0'));var rimraf=require(_0xf813('0x1'));var zipdir=require(_0xf813('0x2'));var jsonpatch=require(_0xf813('0x3'));var rp=require(_0xf813('0x4'));var moment=require(_0xf813('0x5'));var BPromise=require(_0xf813('0x6'));var Mustache=require(_0xf813('0x7'));var util=require(_0xf813('0x8'));var path=require(_0xf813('0x9'));var sox=require(_0xf813('0xa'));var csv=require(_0xf813('0xb'));var ejs=require(_0xf813('0xc'));var fs=require('fs');var _=require(_0xf813('0xd'));var squel=require(_0xf813('0xe'));var crypto=require(_0xf813('0xf'));var jsforce=require(_0xf813('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf813('0x11'));var Papa=require('papaparse');var Redis=require(_0xf813('0x12'));var authService=require(_0xf813('0x13'));var qs=require(_0xf813('0x14'));var as=require(_0xf813('0x15'));var hardwareService=require(_0xf813('0x16'));var logger=require(_0xf813('0x17'))(_0xf813('0x18'));var utils=require(_0xf813('0x19'));var config=require(_0xf813('0x1a'));var licenseUtil=require(_0xf813('0x1b'));var db=require(_0xf813('0x1c'))['db'];function respondWithStatusCode(_0x2a5a26,_0x599d39){_0x599d39=_0x599d39||0xcc;return function(_0x160b7e){if(_0x160b7e){return _0x2a5a26[_0xf813('0x1d')](_0x599d39);}return _0x2a5a26[_0xf813('0x1e')](_0x599d39)[_0xf813('0x1f')]();};}function respondWithResult(_0x21e669,_0x3e663c){_0x3e663c=_0x3e663c||0xc8;return function(_0x14eaba){if(_0x14eaba){return _0x21e669['status'](_0x3e663c)[_0xf813('0x20')](_0x14eaba);}};}function respondWithFilteredResult(_0x4c3ebf,_0x4db5bd){return function(_0x5c3a65){if(_0x5c3a65){var _0x8e19dd=_0x5c3a65[_0xf813('0x21')],_0x17ed42=_0x4db5bd[_0xf813('0x22')],_0x4df681=_0x4db5bd['offset']+_0x4db5bd['limit'],_0x2aea8e;if(_0x4df681>=_0x8e19dd){_0x4df681=_0x8e19dd;_0x2aea8e=0xc8;}else{_0x2aea8e=0xce;}_0x4c3ebf[_0xf813('0x1e')](_0x2aea8e);return _0x4c3ebf['set']('Content-Range',_0x17ed42+'-'+_0x4df681+'/'+_0x8e19dd)[_0xf813('0x20')](_0x5c3a65);}return null;};}function patchUpdates(_0x59f78d){return function(_0x244292){try{jsonpatch['apply'](_0x244292,_0x59f78d,!![]);}catch(_0x25a72f){return BPromise[_0xf813('0x23')](_0x25a72f);}return _0x244292[_0xf813('0x24')]();};}function saveUpdates(_0x35864e,_0x4ca5d2){return function(_0x316ae9){if(_0x316ae9){return _0x316ae9[_0xf813('0x25')](_0x35864e)['then'](function(_0x4f9b27){return _0x4f9b27;});}return null;};}function removeEntity(_0x432510,_0x406559){return function(_0x26efdc){if(_0x26efdc){return _0x26efdc[_0xf813('0x26')]()[_0xf813('0x27')](function(){var _0xc0ec06=_0x26efdc[_0xf813('0x28')]({'plain':!![]});var _0x5a5030=_0xf813('0x29');return db[_0xf813('0x2a')][_0xf813('0x26')]({'where':{'type':_0x5a5030,'resourceId':_0xc0ec06['id']}})[_0xf813('0x27')](function(){return _0x26efdc;});})[_0xf813('0x27')](function(){_0x432510['status'](0xcc)[_0xf813('0x1f')]();});}};}function handleEntityNotFound(_0x50e59d,_0x317119){return function(_0x3c21b8){if(!_0x3c21b8){_0x50e59d[_0xf813('0x1d')](0x194);}return _0x3c21b8;};}function handleError(_0x2e2ac6,_0x3c2854){_0x3c2854=_0x3c2854||0x1f4;return function(_0x12e486){logger['error'](_0x12e486[_0xf813('0x2b')]);if(_0x12e486['name']){delete _0x12e486['name'];}_0x2e2ac6['status'](_0x3c2854)[_0xf813('0x2c')](_0x12e486);};}exports[_0xf813('0x2d')]=function(_0x30af57,_0x4cd608){var _0x4fa555={},_0x1d25df={},_0x3b53bd={'count':0x0,'rows':[]};var _0x35241a=_[_0xf813('0x2e')](db['Sound'][_0xf813('0x2f')],function(_0x3a4244){return{'name':_0x3a4244[_0xf813('0x30')],'type':_0x3a4244[_0xf813('0x31')]['key']};});_0x1d25df[_0xf813('0x32')]=_[_0xf813('0x2e')](_0x35241a,_0xf813('0x33'));_0x1d25df[_0xf813('0x34')]=_[_0xf813('0x35')](_0x30af57['query']);_0x1d25df['filters']=_[_0xf813('0x36')](_0x1d25df[_0xf813('0x32')],_0x1d25df[_0xf813('0x34')]);_0x4fa555[_0xf813('0x37')]=_[_0xf813('0x36')](_0x1d25df['model'],qs['fields'](_0x30af57[_0xf813('0x34')][_0xf813('0x38')]));_0x4fa555[_0xf813('0x37')]=_0x4fa555['attributes']['length']?_0x4fa555[_0xf813('0x37')]:_0x1d25df['model'];if(!_0x30af57[_0xf813('0x34')][_0xf813('0x39')](_0xf813('0x3a'))){_0x4fa555[_0xf813('0x3b')]=qs[_0xf813('0x3b')](_0x30af57['query'][_0xf813('0x3b')]);_0x4fa555['offset']=qs['offset'](_0x30af57[_0xf813('0x34')][_0xf813('0x22')]);}_0x4fa555[_0xf813('0x3c')]=qs[_0xf813('0x3d')](_0x30af57[_0xf813('0x34')][_0xf813('0x3d')]);_0x4fa555['where']=qs[_0xf813('0x3e')](_[_0xf813('0x3f')](_0x30af57[_0xf813('0x34')],_0x1d25df[_0xf813('0x3e')]),_0x35241a);if(_0x30af57[_0xf813('0x34')][_0xf813('0x40')]){_0x4fa555[_0xf813('0x41')]=_[_0xf813('0x42')](_0x4fa555[_0xf813('0x41')],{'$or':_['map'](_0x35241a,function(_0x1616b6){if(_0x1616b6['type']!==_0xf813('0x43')){var _0x3c0e6b={};_0x3c0e6b[_0x1616b6['name']]={'$like':'%'+_0x30af57[_0xf813('0x34')][_0xf813('0x40')]+'%'};return _0x3c0e6b;}})});}_0x4fa555=_['merge']({},_0x4fa555,_0x30af57[_0xf813('0x44')]);var _0x4c5603={'where':_0x4fa555[_0xf813('0x41')]};return db[_0xf813('0x45')]['count'](_0x4c5603)[_0xf813('0x27')](function(_0x597d85){_0x3b53bd[_0xf813('0x21')]=_0x597d85;if(_0x30af57['query'][_0xf813('0x46')]){_0x4fa555[_0xf813('0x47')]=[{'all':!![]}];}return db['Sound'][_0xf813('0x48')](_0x4fa555);})[_0xf813('0x27')](function(_0xa84b7f){_0x3b53bd['rows']=_0xa84b7f;return _0x3b53bd;})[_0xf813('0x27')](respondWithFilteredResult(_0x4cd608,_0x4fa555))[_0xf813('0x49')](handleError(_0x4cd608,null));};exports['show']=function(_0x36f411,_0x2e466c){var _0x2a55ef={'raw':!![],'where':{'id':_0x36f411['params']['id']}},_0x27640a={};_0x27640a[_0xf813('0x32')]=_[_0xf813('0x35')](db['Sound'][_0xf813('0x2f')]);_0x27640a[_0xf813('0x34')]=_['keys'](_0x36f411[_0xf813('0x34')]);_0x27640a['filtears']=_[_0xf813('0x36')](_0x27640a[_0xf813('0x32')],_0x27640a[_0xf813('0x34')]);_0x2a55ef[_0xf813('0x37')]=_[_0xf813('0x36')](_0x27640a['model'],qs[_0xf813('0x38')](_0x36f411['query']['fields']));_0x2a55ef[_0xf813('0x37')]=_0x2a55ef['attributes'][_0xf813('0x4a')]?_0x2a55ef[_0xf813('0x37')]:_0x27640a[_0xf813('0x32')];if(_0x36f411[_0xf813('0x34')]['includeAll']){_0x2a55ef['include']=[{'all':!![]}];}_0x2a55ef=_['merge']({},_0x2a55ef,_0x36f411[_0xf813('0x44')]);return db['Sound'][_0xf813('0x4b')](_0x2a55ef)['then'](handleEntityNotFound(_0x2e466c,null))[_0xf813('0x27')](respondWithResult(_0x2e466c,null))[_0xf813('0x49')](handleError(_0x2e466c,null));};exports['download']=function(_0xe47483,_0x429812,_0x565776){return db[_0xf813('0x45')][_0xf813('0x4b')]({'where':{'id':_0xe47483['params']['id']},'attributes':[_0xf813('0x33'),_0xf813('0x4c'),_0xf813('0x4d')],'raw':!![]})[_0xf813('0x27')](handleEntityNotFound(_0x429812,null))[_0xf813('0x27')](function(_0x216510){if(_0x216510){if(!fs['existsSync'](path[_0xf813('0x4e')](config[_0xf813('0x4f')],_0xf813('0x50'),_0x216510[_0xf813('0x4c')]+'.'+_0x216510[_0xf813('0x4d')]))){throw new db[(_0xf813('0x51'))][(_0xf813('0x52'))](_0xf813('0x53'));}return _0x429812[_0xf813('0x54')](path[_0xf813('0x4e')](config[_0xf813('0x4f')],_0xf813('0x50'),util[_0xf813('0x55')]('%s.%s',_0x216510[_0xf813('0x4c')],_0x216510['converted_format'])),util[_0xf813('0x55')]('%s.%s',_0x216510['name'],_0x216510[_0xf813('0x4d')]));}return null;})['catch'](handleError(_0x429812,null));};exports[_0xf813('0x56')]=function(_0x403b3f,_0x453d36,_0x1a4e7f){var _0x1226ed={'name':path[_0xf813('0x57')](_0x403b3f['file'][_0xf813('0x58')],path[_0xf813('0x59')](_0x403b3f[_0xf813('0x5a')][_0xf813('0x58')])),'save_name':path[_0xf813('0x57')](_0x403b3f[_0xf813('0x5a')][_0xf813('0x5b')],path[_0xf813('0x59')](_0x403b3f[_0xf813('0x5a')][_0xf813('0x5b')])),'original_format':path[_0xf813('0x59')](_0x403b3f[_0xf813('0x5a')][_0xf813('0x58')])[_0xf813('0x5c')](0x1),'converted_format':_0xf813('0x5d')};var _0x254a79=path['join'](config[_0xf813('0x4f')],'server/files/sounds/original',_0x403b3f[_0xf813('0x5a')][_0xf813('0x5b')]);var _0xd7e5f0=path[_0xf813('0x4e')](config['root'],_0xf813('0x50'),util[_0xf813('0x55')](_0xf813('0x5e'),path['basename'](_0x403b3f[_0xf813('0x5a')]['filename'],path['extname'](_0x403b3f[_0xf813('0x5a')]['filename'])),_0x1226ed[_0xf813('0x4d')]));logger[_0xf813('0x5f')](_0xf813('0x60'),_0x254a79);logger['info']('Sound\x20upload\x20destination:\x20%s',_0xd7e5f0);try{fs[_0xf813('0x61')](_0x254a79,parseInt(_0xf813('0x62'),0x8));var _0x2279e0=sox[_0xf813('0x63')](_0x254a79,_0xd7e5f0,{'sampleRate':0x1f40,'format':_0xf813('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2279e0['on'](_0xf813('0x64'),function(_0x10395e){fs[_0xf813('0x65')](_0x254a79);_0x453d36[_0xf813('0x1e')](0x1f4)['send'](_0x10395e);});_0x2279e0['on']('src',function(_0x29c41d){_0x1226ed[_0xf813('0x66')]=isNaN(_0x29c41d[_0xf813('0x67')])?null:_0x29c41d[_0xf813('0x67')]*0x3e8;_0x1226ed[_0xf813('0x68')]=isNaN(_0x29c41d['sampleCount'])?null:_0x29c41d[_0xf813('0x69')];_0x1226ed['original_channelCount']=isNaN(_0x29c41d[_0xf813('0x6a')])?null:_0x29c41d['channelCount'];_0x1226ed['original_bitRate']=isNaN(_0x29c41d[_0xf813('0x6b')])?null:_0x29c41d[_0xf813('0x6b')];_0x1226ed[_0xf813('0x6c')]=isNaN(_0x29c41d[_0xf813('0x6d')])?null:_0x29c41d[_0xf813('0x6d')];});_0x2279e0['on'](_0xf813('0x6e'),function(_0x2a4dc1){_0x1226ed[_0xf813('0x6f')]=isNaN(_0x2a4dc1[_0xf813('0x67')])?null:_0x2a4dc1[_0xf813('0x67')]*0x3e8;_0x1226ed[_0xf813('0x70')]=isNaN(_0x2a4dc1[_0xf813('0x69')])?null:_0x2a4dc1['sampleCount'];_0x1226ed[_0xf813('0x71')]=isNaN(_0x2a4dc1['channelCount'])?null:_0x2a4dc1[_0xf813('0x6a')];_0x1226ed[_0xf813('0x72')]=isNaN(_0x2a4dc1[_0xf813('0x6b')])?null:_0x2a4dc1[_0xf813('0x6b')];_0x1226ed[_0xf813('0x73')]=isNaN(_0x2a4dc1[_0xf813('0x6d')])?null:_0x2a4dc1[_0xf813('0x6d')];});_0x2279e0['on'](_0xf813('0x1f'),function(){fs[_0xf813('0x61')](_0xd7e5f0,parseInt('0777',0x8));return db[_0xf813('0x45')]['create'](_0x1226ed)[_0xf813('0x27')](function(_0x4de30b){var _0x44e514={'role':_0x403b3f[_0xf813('0x74')][_0xf813('0x75')],'userProfileId':_0x403b3f[_0xf813('0x74')][_0xf813('0x76')]};if(!_0x44e514)throw new Error(_0xf813('0x77'));if(_0x44e514[_0xf813('0x75')]===_0xf813('0x78')){var _0x33ed42=_0x4de30b[_0xf813('0x28')]({'plain':!![]});return db[_0xf813('0x79')][_0xf813('0x4b')]({'where':{'name':_0xf813('0x29'),'userProfileId':_0x44e514['userProfileId']},'raw':!![]})['then'](function(_0x18d18c){if(_0x18d18c&&_0x18d18c[_0xf813('0x7a')]===0x0){return db[_0xf813('0x2a')]['create']({'name':_0x33ed42[_0xf813('0x33')],'resourceId':_0x33ed42['id'],'type':_0x18d18c[_0xf813('0x33')],'sectionId':_0x18d18c['id']},{})['then'](function(){return _0x4de30b;});}else{return _0x4de30b;}})[_0xf813('0x49')](function(_0x9b3e74){logger[_0xf813('0x64')](_0xf813('0x7b'),_0x9b3e74);throw _0x9b3e74;});}return _0x4de30b;})[_0xf813('0x27')](respondWithResult(_0x453d36,null))['catch'](handleError(_0x453d36,null));});_0x2279e0['start']();}catch(_0x303759){_0x453d36[_0xf813('0x1e')](0x1f4)[_0xf813('0x2c')](_0x303759);}};exports['update']=function(_0x50bc6b,_0x3ed592,_0x1483ac){return db[_0xf813('0x45')]['find']({'where':{'id':_0x50bc6b[_0xf813('0x7c')]['id']}})['then'](handleEntityNotFound(_0x3ed592,null))[_0xf813('0x27')](saveUpdates(_[_0xf813('0x3f')](_0x50bc6b[_0xf813('0x74')],[_0xf813('0x33'),'description']),null))[_0xf813('0x27')](respondWithResult(_0x3ed592,null))[_0xf813('0x49')](handleError(_0x3ed592,null));};exports['delete']=function(_0x306db7,_0x52f478,_0x258e41){return db[_0xf813('0x45')][_0xf813('0x4b')]({'where':{'id':_0x306db7[_0xf813('0x7c')]['id']}})['then'](function(_0x3cf873){if(_0x3cf873){return _0x3cf873[_0xf813('0x26')]();}})[_0xf813('0x27')](function(_0x45baf3){var _0x4d531e=path[_0xf813('0x4e')](config[_0xf813('0x4f')],'server/files/sounds/original',util[_0xf813('0x55')]('%s.%s',_0x45baf3[_0xf813('0x4c')],_0x45baf3['original_format']));var _0x4b67ed=path[_0xf813('0x4e')](config[_0xf813('0x4f')],_0xf813('0x50'),util[_0xf813('0x55')](_0xf813('0x5e'),_0x45baf3[_0xf813('0x4c')],_0x45baf3[_0xf813('0x4d')]));fs['unlinkSync'](_0x4d531e);fs[_0xf813('0x65')](_0x4b67ed);return _0x45baf3;})[_0xf813('0x27')](function(_0x3b3af8){if(_0x3b3af8){return _0x52f478['status'](0xcc)['end']();}})[_0xf813('0x27')](handleEntityNotFound(_0x52f478,null))[_0xf813('0x49')](handleError(_0x52f478,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 2badfc3..5ab3101 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 _0x273f=['define','tools_sounds','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xc1288f,_0x381f59){var _0x2d89d1=function(_0x1fcf55){while(--_0x1fcf55){_0xc1288f['push'](_0xc1288f['shift']());}};_0x2d89d1(++_0x381f59);}(_0x273f,0x138));var _0xf273=function(_0x2b02a6,_0x104468){_0x2b02a6=_0x2b02a6-0x0;var _0x4cc72a=_0x273f[_0x2b02a6];return _0x4cc72a;};'use strict';var _=require('lodash');var util=require(_0xf273('0x0'));var logger=require(_0xf273('0x1'))('api');var moment=require(_0xf273('0x2'));var BPromise=require(_0xf273('0x3'));var rp=require(_0xf273('0x4'));var fs=require('fs');var path=require(_0xf273('0x5'));var rimraf=require(_0xf273('0x6'));var config=require(_0xf273('0x7'));var attributes=require('./sound.attributes');module['exports']=function(_0x5bdf5f,_0x2fe66b){return _0x5bdf5f[_0xf273('0x8')]('Sound',attributes,{'tableName':_0xf273('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79a1=['tools_sounds','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./sound.attributes','exports','define'];(function(_0x1f1e31,_0x27b5c3){var _0x229b56=function(_0x16db77){while(--_0x16db77){_0x1f1e31['push'](_0x1f1e31['shift']());}};_0x229b56(++_0x27b5c3);}(_0x79a1,0x156));var _0x179a=function(_0x3141ff,_0x136823){_0x3141ff=_0x3141ff-0x0;var _0x4bb11f=_0x79a1[_0x3141ff];return _0x4bb11f;};'use strict';var _=require(_0x179a('0x0'));var util=require(_0x179a('0x1'));var logger=require(_0x179a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x179a('0x3'));var rp=require(_0x179a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x179a('0x5'));var config=require(_0x179a('0x6'));var attributes=require(_0x179a('0x7'));module[_0x179a('0x8')]=function(_0x8e74b2,_0x376543){return _0x8e74b2[_0x179a('0x9')]('Sound',attributes,{'tableName':_0x179a('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 8196a61..04ce759 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 _0x9537=['util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','find','options','raw','attributes','include','map','model','then','lodash'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x9537,0xff));var _0x7953=function(_0x4bbd41,_0x269933){_0x4bbd41=_0x4bbd41-0x0;var _0xa90941=_0x9537[_0x4bbd41];return _0xa90941;};'use strict';var _=require(_0x7953('0x0'));var util=require(_0x7953('0x1'));var moment=require(_0x7953('0x2'));var BPromise=require(_0x7953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7953('0x4'))(_0x7953('0x5'));var config=require(_0x7953('0x6'));var jayson=require(_0x7953('0x7'));var client=jayson[_0x7953('0x8')][_0x7953('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x423a93,_0xb32773,_0x4a926e){return new BPromise(function(_0x422d47,_0x22eb9e){return client[_0x7953('0xa')](_0x423a93,_0x4a926e)['then'](function(_0x54d766){logger[_0x7953('0xb')](_0x7953('0xc'),_0xb32773,_0x7953('0xd'));logger[_0x7953('0xe')](_0x7953('0xf'),_0xb32773,'request\x20sent',JSON[_0x7953('0x10')](_0x54d766));if(_0x54d766[_0x7953('0x11')]){if(_0x54d766[_0x7953('0x11')][_0x7953('0x12')]===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0xb32773,_0x54d766[_0x7953('0x11')][_0x7953('0x13')]);return _0x22eb9e(_0x54d766['error'][_0x7953('0x13')]);}logger[_0x7953('0x11')](_0x7953('0xc'),_0xb32773,_0x54d766[_0x7953('0x11')][_0x7953('0x13')]);return _0x422d47(_0x54d766[_0x7953('0x11')][_0x7953('0x13')]);}else{logger[_0x7953('0xb')](_0x7953('0xc'),_0xb32773,_0x7953('0xd'));_0x422d47(_0x54d766[_0x7953('0x14')]['message']);}})[_0x7953('0x15')](function(_0x1f32af){logger[_0x7953('0x11')](_0x7953('0xc'),_0xb32773,_0x1f32af);_0x22eb9e(_0x1f32af);});});}exports[_0x7953('0x16')]=function(_0x1b249c){var _0x6a806a=this;return new Promise(function(_0x5a6601,_0x276561){return db[_0x7953('0x17')][_0x7953('0x18')]({'raw':_0x1b249c[_0x7953('0x19')]?_0x1b249c[_0x7953('0x19')][_0x7953('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b249c['options']?_0x1b249c[_0x7953('0x19')]['where']||null:null,'attributes':_0x1b249c['options']?_0x1b249c[_0x7953('0x19')][_0x7953('0x1b')]||null:null,'include':_0x1b249c[_0x7953('0x19')]?_0x1b249c[_0x7953('0x19')][_0x7953('0x1c')]?_[_0x7953('0x1d')](_0x1b249c['options'][_0x7953('0x1c')],function(_0x237a10){return{'model':db[_0x237a10[_0x7953('0x1e')]],'as':_0x237a10['as'],'attributes':_0x237a10[_0x7953('0x1b')],'include':_0x237a10[_0x7953('0x1c')]?_[_0x7953('0x1d')](_0x237a10['include'],function(_0x17b59a){return{'model':db[_0x17b59a[_0x7953('0x1e')]],'as':_0x17b59a['as'],'attributes':_0x17b59a[_0x7953('0x1b')],'include':_0x17b59a[_0x7953('0x1c')]?_[_0x7953('0x1d')](_0x17b59a[_0x7953('0x1c')],function(_0x32a2fe){return{'model':db[_0x32a2fe[_0x7953('0x1e')]],'as':_0x32a2fe['as'],'attributes':_0x32a2fe[_0x7953('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7953('0x1f')](function(_0x5ed37d){logger[_0x7953('0xb')](_0x7953('0x16'),_0x1b249c);logger[_0x7953('0xe')](_0x7953('0x16'),_0x1b249c,JSON[_0x7953('0x10')](_0x5ed37d));_0x5a6601(_0x5ed37d);})[_0x7953('0x15')](function(_0x2dde3e){logger[_0x7953('0x11')](_0x7953('0x16'),_0x2dde3e[_0x7953('0x13')],_0x1b249c);_0x276561(_0x6a806a['error'](0x1f4,_0x2dde3e[_0x7953('0x13')]));});});}; \ No newline at end of file +var _0xe57e=['then','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSound','find','options','raw','where','include','map','model','attributes'];(function(_0x59a0b4,_0x53fe9c){var _0x547745=function(_0x3f20e2){while(--_0x3f20e2){_0x59a0b4['push'](_0x59a0b4['shift']());}};_0x547745(++_0x53fe9c);}(_0xe57e,0xf0));var _0xee57=function(_0x64f1e,_0x3286d2){_0x64f1e=_0x64f1e-0x0;var _0x48eda2=_0xe57e[_0x64f1e];return _0x48eda2;};'use strict';var _=require(_0xee57('0x0'));var util=require(_0xee57('0x1'));var moment=require('moment');var BPromise=require(_0xee57('0x2'));var rs=require(_0xee57('0x3'));var fs=require('fs');var Redis=require(_0xee57('0x4'));var db=require(_0xee57('0x5'))['db'];var utils=require(_0xee57('0x6'));var logger=require(_0xee57('0x7'))(_0xee57('0x8'));var config=require(_0xee57('0x9'));var jayson=require(_0xee57('0xa'));var client=jayson[_0xee57('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x369493,_0x1ad1f3,_0x3cd2da){return new BPromise(function(_0x55b725,_0x4f092b){return client[_0xee57('0xc')](_0x369493,_0x3cd2da)['then'](function(_0x2af347){logger[_0xee57('0xd')](_0xee57('0xe'),_0x1ad1f3,_0xee57('0xf'));logger[_0xee57('0x10')](_0xee57('0x11'),_0x1ad1f3,_0xee57('0xf'),JSON[_0xee57('0x12')](_0x2af347));if(_0x2af347[_0xee57('0x13')]){if(_0x2af347['error'][_0xee57('0x14')]===0x1f4){logger[_0xee57('0x13')](_0xee57('0xe'),_0x1ad1f3,_0x2af347['error'][_0xee57('0x15')]);return _0x4f092b(_0x2af347[_0xee57('0x13')]['message']);}logger[_0xee57('0x13')](_0xee57('0xe'),_0x1ad1f3,_0x2af347[_0xee57('0x13')]['message']);return _0x55b725(_0x2af347['error'][_0xee57('0x15')]);}else{logger[_0xee57('0xd')](_0xee57('0xe'),_0x1ad1f3,'request\x20sent');_0x55b725(_0x2af347[_0xee57('0x16')][_0xee57('0x15')]);}})['catch'](function(_0x3bfc4d){logger['error'](_0xee57('0xe'),_0x1ad1f3,_0x3bfc4d);_0x4f092b(_0x3bfc4d);});});}exports[_0xee57('0x17')]=function(_0x3e3519){var _0x45f671=this;return new Promise(function(_0x26410d,_0x41fc3c){return db['Sound'][_0xee57('0x18')]({'raw':_0x3e3519[_0xee57('0x19')]?_0x3e3519[_0xee57('0x19')][_0xee57('0x1a')]===undefined?!![]:![]:!![],'where':_0x3e3519[_0xee57('0x19')]?_0x3e3519[_0xee57('0x19')][_0xee57('0x1b')]||null:null,'attributes':_0x3e3519[_0xee57('0x19')]?_0x3e3519[_0xee57('0x19')]['attributes']||null:null,'include':_0x3e3519[_0xee57('0x19')]?_0x3e3519[_0xee57('0x19')][_0xee57('0x1c')]?_[_0xee57('0x1d')](_0x3e3519['options'][_0xee57('0x1c')],function(_0x3a2290){return{'model':db[_0x3a2290[_0xee57('0x1e')]],'as':_0x3a2290['as'],'attributes':_0x3a2290[_0xee57('0x1f')],'include':_0x3a2290[_0xee57('0x1c')]?_[_0xee57('0x1d')](_0x3a2290[_0xee57('0x1c')],function(_0x366675){return{'model':db[_0x366675[_0xee57('0x1e')]],'as':_0x366675['as'],'attributes':_0x366675[_0xee57('0x1f')],'include':_0x366675['include']?_[_0xee57('0x1d')](_0x366675[_0xee57('0x1c')],function(_0x39ac84){return{'model':db[_0x39ac84['model']],'as':_0x39ac84['as'],'attributes':_0x39ac84[_0xee57('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xee57('0x20')](function(_0x13232a){logger[_0xee57('0xd')](_0xee57('0x17'),_0x3e3519);logger['debug'](_0xee57('0x17'),_0x3e3519,JSON[_0xee57('0x12')](_0x13232a));_0x26410d(_0x13232a);})[_0xee57('0x21')](function(_0x469fa2){logger[_0xee57('0x13')](_0xee57('0x17'),_0x469fa2[_0xee57('0x15')],_0x3e3519);_0x41fc3c(_0x45f671['error'](0x1f4,_0x469fa2[_0xee57('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 465c1d7..1d7aa7c 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 _0xf4d2=['Router','../../components/auth/service','../../config/environment','./squareMessage.controller','index','get','/:id','isAuthenticated','post','create','put','delete','destroy','multer','util','connect-timeout','express'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf4d2,0x1e9));var _0x2f4d=function(_0x55d691,_0x4ac367){_0x55d691=_0x55d691-0x0;var _0xafd4dc=_0xf4d2[_0x55d691];return _0xafd4dc;};'use strict';var multer=require(_0x2f4d('0x0'));var util=require(_0x2f4d('0x1'));var path=require('path');var timeout=require(_0x2f4d('0x2'));var express=require(_0x2f4d('0x3'));var router=express[_0x2f4d('0x4')]();var auth=require(_0x2f4d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2f4d('0x6'));var controller=require(_0x2f4d('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2f4d('0x8')]);router[_0x2f4d('0x9')](_0x2f4d('0xa'),auth[_0x2f4d('0xb')](),controller['show']);router[_0x2f4d('0xc')]('/',auth['isAuthenticated'](),controller[_0x2f4d('0xd')]);router[_0x2f4d('0xe')](_0x2f4d('0xa'),auth[_0x2f4d('0xb')](),controller['update']);router[_0x2f4d('0xf')](_0x2f4d('0xa'),auth[_0x2f4d('0xb')](),controller[_0x2f4d('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9417=['Router','../../components/auth/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','util','path','connect-timeout'];(function(_0x3a814c,_0x2f74df){var _0x219de3=function(_0x41cfc3){while(--_0x41cfc3){_0x3a814c['push'](_0x3a814c['shift']());}};_0x219de3(++_0x2f74df);}(_0x9417,0x74));var _0x7941=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9417[_0x4565bf];return _0x5610ba;};'use strict';var multer=require('multer');var util=require(_0x7941('0x0'));var path=require(_0x7941('0x1'));var timeout=require(_0x7941('0x2'));var express=require('express');var router=express[_0x7941('0x3')]();var auth=require(_0x7941('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7941('0x5'));var controller=require(_0x7941('0x6'));router[_0x7941('0x7')]('/',auth[_0x7941('0x8')](),controller[_0x7941('0x9')]);router[_0x7941('0x7')](_0x7941('0xa'),auth['isAuthenticated'](),controller[_0x7941('0xb')]);router[_0x7941('0xc')]('/',auth[_0x7941('0x8')](),controller[_0x7941('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7941('0xe')](_0x7941('0xa'),auth[_0x7941('0x8')](),controller[_0x7941('0xf')]);module[_0x7941('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 7220834..adbb9b4 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 _0x2820=['medium','ENUM','out','sequelize','exports','STRING','TEXT'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x2820,0x10d));var _0x0282=function(_0x3a43a0,_0x3e09a9){_0x3a43a0=_0x3a43a0-0x0;var _0x46fa96=_0x2820[_0x3a43a0];return _0x46fa96;};'use strict';var Sequelize=require(_0x0282('0x0'));module[_0x0282('0x1')]={'uniqueid':{'type':Sequelize[_0x0282('0x2')]},'body':{'type':Sequelize[_0x0282('0x3')](_0x0282('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x0282('0x5')]('in',_0x0282('0x6')),'defaultValue':_0x0282('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0x34d8=['ENUM','out','STRING','TEXT'];(function(_0x21acc5,_0x5d4fc1){var _0x495c4c=function(_0x129288){while(--_0x129288){_0x21acc5['push'](_0x21acc5['shift']());}};_0x495c4c(++_0x5d4fc1);}(_0x34d8,0xba));var _0x834d=function(_0x4a74e5,_0x108772){_0x4a74e5=_0x4a74e5-0x0;var _0x1339c6=_0x34d8[_0x4a74e5];return _0x1339c6;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x834d('0x0')]},'body':{'type':Sequelize[_0x834d('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x834d('0x2')]('in','out'),'defaultValue':_0x834d('0x3'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index ab9079f..d596971 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 _0xd439=['bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','set','Content-Range','apply','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','count','includeAll','include','rows','show','params','filtears','options','find','catch','create','body','html-pdf','rimraf','request-promise','moment'];(function(_0x12ba45,_0x52609b){var _0x3b6858=function(_0x471895){while(--_0x471895){_0x12ba45['push'](_0x12ba45['shift']());}};_0x3b6858(++_0x52609b);}(_0xd439,0x94));var _0x9d43=function(_0x40add1,_0x288eaf){_0x40add1=_0x40add1-0x0;var _0x5da3be=_0xd439[_0x40add1];return _0x5da3be;};'use strict';var pdf=require(_0x9d43('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9d43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9d43('0x2'));var moment=require(_0x9d43('0x3'));var BPromise=require(_0x9d43('0x4'));var Mustache=require(_0x9d43('0x5'));var util=require(_0x9d43('0x6'));var path=require(_0x9d43('0x7'));var sox=require('sox');var csv=require(_0x9d43('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9d43('0x9'));var squel=require(_0x9d43('0xa'));var crypto=require(_0x9d43('0xb'));var jsforce=require(_0x9d43('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9d43('0x8'));var querystring=require(_0x9d43('0xd'));var Papa=require(_0x9d43('0xe'));var Redis=require(_0x9d43('0xf'));var authService=require(_0x9d43('0x10'));var qs=require(_0x9d43('0x11'));var as=require(_0x9d43('0x12'));var hardwareService=require(_0x9d43('0x13'));var logger=require('../../config/logger')(_0x9d43('0x14'));var utils=require(_0x9d43('0x15'));var config=require(_0x9d43('0x16'));var licenseUtil=require(_0x9d43('0x17'));var db=require(_0x9d43('0x18'))['db'];function respondWithStatusCode(_0x43db6e,_0x55a1bf){_0x55a1bf=_0x55a1bf||0xcc;return function(_0x197e05){if(_0x197e05){return _0x43db6e['sendStatus'](_0x55a1bf);}return _0x43db6e[_0x9d43('0x19')](_0x55a1bf)['end']();};}function respondWithResult(_0x2a9e2d,_0x13d0e2){_0x13d0e2=_0x13d0e2||0xc8;return function(_0x3cd7d9){if(_0x3cd7d9){return _0x2a9e2d[_0x9d43('0x19')](_0x13d0e2)['json'](_0x3cd7d9);}};}function respondWithFilteredResult(_0x4d28c0,_0x1166ce){return function(_0x4e16ce){if(_0x4e16ce){var _0xd80244=_0x4e16ce['count'],_0x551874=_0x1166ce[_0x9d43('0x1a')],_0x31d1be=_0x1166ce['offset']+_0x1166ce['limit'],_0x4b0b1e;if(_0x31d1be>=_0xd80244){_0x31d1be=_0xd80244;_0x4b0b1e=0xc8;}else{_0x4b0b1e=0xce;}_0x4d28c0[_0x9d43('0x19')](_0x4b0b1e);return _0x4d28c0[_0x9d43('0x1b')](_0x9d43('0x1c'),_0x551874+'-'+_0x31d1be+'/'+_0xd80244)['json'](_0x4e16ce);}return null;};}function patchUpdates(_0x2a61f9){return function(_0x37f6cc){try{jsonpatch[_0x9d43('0x1d')](_0x37f6cc,_0x2a61f9,!![]);}catch(_0x4056ff){return BPromise['reject'](_0x4056ff);}return _0x37f6cc[_0x9d43('0x1e')]();};}function saveUpdates(_0x371a40,_0x439d6f){return function(_0x400fd0){if(_0x400fd0){return _0x400fd0[_0x9d43('0x1f')](_0x371a40)['then'](function(_0x3d8108){return _0x3d8108;});}return null;};}function removeEntity(_0x479df7,_0x45823b){return function(_0x44376e){if(_0x44376e){return _0x44376e[_0x9d43('0x20')]()[_0x9d43('0x21')](function(){_0x479df7['status'](0xcc)[_0x9d43('0x22')]();});}};}function handleEntityNotFound(_0x553b0a,_0x38c989){return function(_0x5db363){if(!_0x5db363){_0x553b0a[_0x9d43('0x23')](0x194);}return _0x5db363;};}function handleError(_0x1c4f7,_0x149964){_0x149964=_0x149964||0x1f4;return function(_0x529490){logger[_0x9d43('0x24')](_0x529490[_0x9d43('0x25')]);if(_0x529490[_0x9d43('0x26')]){delete _0x529490[_0x9d43('0x26')];}_0x1c4f7[_0x9d43('0x19')](_0x149964)[_0x9d43('0x27')](_0x529490);};}exports[_0x9d43('0x28')]=function(_0x3eb690,_0x40cbde){var _0x242e31={},_0x19575d={},_0x7c539d={'count':0x0,'rows':[]};var _0x141587=_[_0x9d43('0x29')](db[_0x9d43('0x2a')][_0x9d43('0x2b')],function(_0x43011b){return{'name':_0x43011b[_0x9d43('0x2c')],'type':_0x43011b[_0x9d43('0x2d')][_0x9d43('0x2e')]};});_0x19575d['model']=_[_0x9d43('0x29')](_0x141587,'name');_0x19575d[_0x9d43('0x2f')]=_[_0x9d43('0x30')](_0x3eb690[_0x9d43('0x2f')]);_0x19575d[_0x9d43('0x31')]=_['intersection'](_0x19575d[_0x9d43('0x32')],_0x19575d[_0x9d43('0x2f')]);_0x242e31[_0x9d43('0x33')]=_[_0x9d43('0x34')](_0x19575d[_0x9d43('0x32')],qs[_0x9d43('0x35')](_0x3eb690[_0x9d43('0x2f')][_0x9d43('0x35')]));_0x242e31[_0x9d43('0x33')]=_0x242e31[_0x9d43('0x33')][_0x9d43('0x36')]?_0x242e31[_0x9d43('0x33')]:_0x19575d['model'];if(!_0x3eb690[_0x9d43('0x2f')]['hasOwnProperty'](_0x9d43('0x37'))){_0x242e31[_0x9d43('0x38')]=qs[_0x9d43('0x38')](_0x3eb690['query'][_0x9d43('0x38')]);_0x242e31[_0x9d43('0x1a')]=qs[_0x9d43('0x1a')](_0x3eb690['query'][_0x9d43('0x1a')]);}_0x242e31[_0x9d43('0x39')]=qs['sort'](_0x3eb690[_0x9d43('0x2f')][_0x9d43('0x3a')]);_0x242e31['where']=qs[_0x9d43('0x31')](_[_0x9d43('0x3b')](_0x3eb690[_0x9d43('0x2f')],_0x19575d[_0x9d43('0x31')]),_0x141587);if(_0x3eb690[_0x9d43('0x2f')][_0x9d43('0x3c')]){_0x242e31['where']=_[_0x9d43('0x3d')](_0x242e31[_0x9d43('0x3e')],{'$or':_[_0x9d43('0x29')](_0x141587,function(_0x318015){if(_0x318015[_0x9d43('0x2d')]!==_0x9d43('0x3f')){var _0x5e739f={};_0x5e739f[_0x318015[_0x9d43('0x26')]]={'$like':'%'+_0x3eb690[_0x9d43('0x2f')]['filter']+'%'};return _0x5e739f;}})});}_0x242e31=_['merge']({},_0x242e31,_0x3eb690['options']);var _0x10f185={'where':_0x242e31['where']};return db[_0x9d43('0x2a')][_0x9d43('0x40')](_0x10f185)[_0x9d43('0x21')](function(_0x19afc0){_0x7c539d[_0x9d43('0x40')]=_0x19afc0;if(_0x3eb690[_0x9d43('0x2f')][_0x9d43('0x41')]){_0x242e31[_0x9d43('0x42')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x242e31);})[_0x9d43('0x21')](function(_0x459e57){_0x7c539d[_0x9d43('0x43')]=_0x459e57;return _0x7c539d;})[_0x9d43('0x21')](respondWithFilteredResult(_0x40cbde,_0x242e31))['catch'](handleError(_0x40cbde,null));};exports[_0x9d43('0x44')]=function(_0x43a038,_0x4f2b98){var _0x361596={'raw':!![],'where':{'id':_0x43a038[_0x9d43('0x45')]['id']}},_0x1f8002={};_0x1f8002[_0x9d43('0x32')]=_['keys'](db['SquareMessage'][_0x9d43('0x2b')]);_0x1f8002[_0x9d43('0x2f')]=_[_0x9d43('0x30')](_0x43a038[_0x9d43('0x2f')]);_0x1f8002[_0x9d43('0x46')]=_[_0x9d43('0x34')](_0x1f8002[_0x9d43('0x32')],_0x1f8002[_0x9d43('0x2f')]);_0x361596[_0x9d43('0x33')]=_['intersection'](_0x1f8002['model'],qs[_0x9d43('0x35')](_0x43a038['query']['fields']));_0x361596[_0x9d43('0x33')]=_0x361596[_0x9d43('0x33')][_0x9d43('0x36')]?_0x361596[_0x9d43('0x33')]:_0x1f8002[_0x9d43('0x32')];if(_0x43a038[_0x9d43('0x2f')][_0x9d43('0x41')]){_0x361596[_0x9d43('0x42')]=[{'all':!![]}];}_0x361596=_[_0x9d43('0x3d')]({},_0x361596,_0x43a038[_0x9d43('0x47')]);return db[_0x9d43('0x2a')][_0x9d43('0x48')](_0x361596)[_0x9d43('0x21')](handleEntityNotFound(_0x4f2b98,null))['then'](respondWithResult(_0x4f2b98,null))[_0x9d43('0x49')](handleError(_0x4f2b98,null));};exports[_0x9d43('0x4a')]=function(_0x559448,_0x3dda40){return db[_0x9d43('0x2a')][_0x9d43('0x4a')](_0x559448[_0x9d43('0x4b')],{})[_0x9d43('0x21')](respondWithResult(_0x3dda40,0xc9))[_0x9d43('0x49')](handleError(_0x3dda40,null));};exports[_0x9d43('0x1f')]=function(_0x840f1a,_0x3f9081){if(_0x840f1a['body']['id']){delete _0x840f1a[_0x9d43('0x4b')]['id'];}return db['SquareMessage'][_0x9d43('0x48')]({'where':{'id':_0x840f1a['params']['id']}})['then'](handleEntityNotFound(_0x3f9081,null))['then'](saveUpdates(_0x840f1a[_0x9d43('0x4b')],null))[_0x9d43('0x21')](respondWithResult(_0x3f9081,null))[_0x9d43('0x49')](handleError(_0x3f9081,null));};exports[_0x9d43('0x20')]=function(_0x2283b7,_0x248e21){return db[_0x9d43('0x2a')][_0x9d43('0x48')]({'where':{'id':_0x2283b7[_0x9d43('0x45')]['id']}})[_0x9d43('0x21')](handleEntityNotFound(_0x248e21,null))[_0x9d43('0x21')](removeEntity(_0x248e21,null))['catch'](handleError(_0x248e21,null));}; \ No newline at end of file +var _0xb97a=['options','includeAll','include','catch','show','params','filtears','create','body','find','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter'];(function(_0x3ba9e0,_0x3219cf){var _0x4ab6db=function(_0x459cad){while(--_0x459cad){_0x3ba9e0['push'](_0x3ba9e0['shift']());}};_0x4ab6db(++_0x3219cf);}(_0xb97a,0xf4));var _0xab97=function(_0xb354ae,_0x195eba){_0xb354ae=_0xb354ae-0x0;var _0x47964a=_0xb97a[_0xb354ae];return _0x47964a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xab97('0x0'));var rimraf=require(_0xab97('0x1'));var zipdir=require(_0xab97('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab97('0x3'));var moment=require(_0xab97('0x4'));var BPromise=require(_0xab97('0x5'));var Mustache=require('mustache');var util=require(_0xab97('0x6'));var path=require(_0xab97('0x7'));var sox=require(_0xab97('0x8'));var csv=require(_0xab97('0x9'));var ejs=require(_0xab97('0xa'));var fs=require('fs');var _=require(_0xab97('0xb'));var squel=require(_0xab97('0xc'));var crypto=require(_0xab97('0xd'));var jsforce=require(_0xab97('0xe'));var deskjs=require(_0xab97('0xf'));var toCsv=require(_0xab97('0x9'));var querystring=require(_0xab97('0x10'));var Papa=require(_0xab97('0x11'));var Redis=require(_0xab97('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xab97('0x13'));var as=require(_0xab97('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xab97('0x15'))(_0xab97('0x16'));var utils=require(_0xab97('0x17'));var config=require(_0xab97('0x18'));var licenseUtil=require(_0xab97('0x19'));var db=require(_0xab97('0x1a'))['db'];function respondWithStatusCode(_0x1c121d,_0x3e86de){_0x3e86de=_0x3e86de||0xcc;return function(_0x3709a1){if(_0x3709a1){return _0x1c121d[_0xab97('0x1b')](_0x3e86de);}return _0x1c121d[_0xab97('0x1c')](_0x3e86de)[_0xab97('0x1d')]();};}function respondWithResult(_0x11d87e,_0x26e16a){_0x26e16a=_0x26e16a||0xc8;return function(_0x158dba){if(_0x158dba){return _0x11d87e['status'](_0x26e16a)[_0xab97('0x1e')](_0x158dba);}};}function respondWithFilteredResult(_0x496d84,_0x1c9d30){return function(_0x334015){if(_0x334015){var _0x4df500=_0x334015[_0xab97('0x1f')],_0x5ef805=_0x1c9d30[_0xab97('0x20')],_0x407cf0=_0x1c9d30[_0xab97('0x20')]+_0x1c9d30[_0xab97('0x21')],_0x11181f;if(_0x407cf0>=_0x4df500){_0x407cf0=_0x4df500;_0x11181f=0xc8;}else{_0x11181f=0xce;}_0x496d84[_0xab97('0x1c')](_0x11181f);return _0x496d84[_0xab97('0x22')](_0xab97('0x23'),_0x5ef805+'-'+_0x407cf0+'/'+_0x4df500)['json'](_0x334015);}return null;};}function patchUpdates(_0x1da06e){return function(_0x469218){try{jsonpatch[_0xab97('0x24')](_0x469218,_0x1da06e,!![]);}catch(_0x50f32d){return BPromise[_0xab97('0x25')](_0x50f32d);}return _0x469218['save']();};}function saveUpdates(_0x45ba4a,_0xab5345){return function(_0xa7d6c6){if(_0xa7d6c6){return _0xa7d6c6[_0xab97('0x26')](_0x45ba4a)[_0xab97('0x27')](function(_0x33c474){return _0x33c474;});}return null;};}function removeEntity(_0x271eff,_0x313aad){return function(_0x27a933){if(_0x27a933){return _0x27a933[_0xab97('0x28')]()['then'](function(){_0x271eff[_0xab97('0x1c')](0xcc)[_0xab97('0x1d')]();});}};}function handleEntityNotFound(_0x1504fa,_0x2caffb){return function(_0x24b7b9){if(!_0x24b7b9){_0x1504fa[_0xab97('0x1b')](0x194);}return _0x24b7b9;};}function handleError(_0x81b506,_0x183b07){_0x183b07=_0x183b07||0x1f4;return function(_0x1f340a){logger['error'](_0x1f340a[_0xab97('0x29')]);if(_0x1f340a[_0xab97('0x2a')]){delete _0x1f340a[_0xab97('0x2a')];}_0x81b506[_0xab97('0x1c')](_0x183b07)[_0xab97('0x2b')](_0x1f340a);};}exports[_0xab97('0x2c')]=function(_0x24fd76,_0x5c1366){var _0x1c3145={},_0xc94794={},_0x1a08c2={'count':0x0,'rows':[]};var _0x5549d5=_[_0xab97('0x2d')](db[_0xab97('0x2e')][_0xab97('0x2f')],function(_0xacb2fe){return{'name':_0xacb2fe[_0xab97('0x30')],'type':_0xacb2fe[_0xab97('0x31')][_0xab97('0x32')]};});_0xc94794[_0xab97('0x33')]=_[_0xab97('0x2d')](_0x5549d5,_0xab97('0x2a'));_0xc94794['query']=_[_0xab97('0x34')](_0x24fd76['query']);_0xc94794[_0xab97('0x35')]=_[_0xab97('0x36')](_0xc94794['model'],_0xc94794[_0xab97('0x37')]);_0x1c3145['attributes']=_[_0xab97('0x36')](_0xc94794[_0xab97('0x33')],qs[_0xab97('0x38')](_0x24fd76['query'][_0xab97('0x38')]));_0x1c3145[_0xab97('0x39')]=_0x1c3145[_0xab97('0x39')][_0xab97('0x3a')]?_0x1c3145[_0xab97('0x39')]:_0xc94794[_0xab97('0x33')];if(!_0x24fd76[_0xab97('0x37')][_0xab97('0x3b')](_0xab97('0x3c'))){_0x1c3145['limit']=qs['limit'](_0x24fd76[_0xab97('0x37')]['limit']);_0x1c3145[_0xab97('0x20')]=qs[_0xab97('0x20')](_0x24fd76[_0xab97('0x37')]['offset']);}_0x1c3145[_0xab97('0x3d')]=qs[_0xab97('0x3e')](_0x24fd76['query']['sort']);_0x1c3145[_0xab97('0x3f')]=qs['filters'](_[_0xab97('0x40')](_0x24fd76[_0xab97('0x37')],_0xc94794[_0xab97('0x35')]),_0x5549d5);if(_0x24fd76[_0xab97('0x37')]['filter']){_0x1c3145[_0xab97('0x3f')]=_[_0xab97('0x41')](_0x1c3145[_0xab97('0x3f')],{'$or':_[_0xab97('0x2d')](_0x5549d5,function(_0x2db533){if(_0x2db533[_0xab97('0x31')]!==_0xab97('0x42')){var _0x165218={};_0x165218[_0x2db533['name']]={'$like':'%'+_0x24fd76['query'][_0xab97('0x43')]+'%'};return _0x165218;}})});}_0x1c3145=_[_0xab97('0x41')]({},_0x1c3145,_0x24fd76[_0xab97('0x44')]);var _0x195771={'where':_0x1c3145['where']};return db['SquareMessage'][_0xab97('0x1f')](_0x195771)[_0xab97('0x27')](function(_0x4a783b){_0x1a08c2[_0xab97('0x1f')]=_0x4a783b;if(_0x24fd76[_0xab97('0x37')][_0xab97('0x45')]){_0x1c3145[_0xab97('0x46')]=[{'all':!![]}];}return db[_0xab97('0x2e')]['findAll'](_0x1c3145);})[_0xab97('0x27')](function(_0x2ad679){_0x1a08c2['rows']=_0x2ad679;return _0x1a08c2;})[_0xab97('0x27')](respondWithFilteredResult(_0x5c1366,_0x1c3145))[_0xab97('0x47')](handleError(_0x5c1366,null));};exports[_0xab97('0x48')]=function(_0x5468ed,_0x548fd2){var _0x44a081={'raw':!![],'where':{'id':_0x5468ed[_0xab97('0x49')]['id']}},_0x1fff6e={};_0x1fff6e['model']=_[_0xab97('0x34')](db[_0xab97('0x2e')][_0xab97('0x2f')]);_0x1fff6e[_0xab97('0x37')]=_[_0xab97('0x34')](_0x5468ed['query']);_0x1fff6e[_0xab97('0x4a')]=_['intersection'](_0x1fff6e[_0xab97('0x33')],_0x1fff6e[_0xab97('0x37')]);_0x44a081['attributes']=_[_0xab97('0x36')](_0x1fff6e[_0xab97('0x33')],qs[_0xab97('0x38')](_0x5468ed[_0xab97('0x37')][_0xab97('0x38')]));_0x44a081[_0xab97('0x39')]=_0x44a081[_0xab97('0x39')][_0xab97('0x3a')]?_0x44a081['attributes']:_0x1fff6e[_0xab97('0x33')];if(_0x5468ed[_0xab97('0x37')][_0xab97('0x45')]){_0x44a081[_0xab97('0x46')]=[{'all':!![]}];}_0x44a081=_[_0xab97('0x41')]({},_0x44a081,_0x5468ed[_0xab97('0x44')]);return db[_0xab97('0x2e')]['find'](_0x44a081)['then'](handleEntityNotFound(_0x548fd2,null))[_0xab97('0x27')](respondWithResult(_0x548fd2,null))['catch'](handleError(_0x548fd2,null));};exports['create']=function(_0x38b5c5,_0xcfff21){return db[_0xab97('0x2e')][_0xab97('0x4b')](_0x38b5c5[_0xab97('0x4c')],{})[_0xab97('0x27')](respondWithResult(_0xcfff21,0xc9))[_0xab97('0x47')](handleError(_0xcfff21,null));};exports[_0xab97('0x26')]=function(_0x57f9bd,_0x3e9b93){if(_0x57f9bd['body']['id']){delete _0x57f9bd[_0xab97('0x4c')]['id'];}return db[_0xab97('0x2e')][_0xab97('0x4d')]({'where':{'id':_0x57f9bd[_0xab97('0x49')]['id']}})[_0xab97('0x27')](handleEntityNotFound(_0x3e9b93,null))[_0xab97('0x27')](saveUpdates(_0x57f9bd[_0xab97('0x4c')],null))[_0xab97('0x27')](respondWithResult(_0x3e9b93,null))[_0xab97('0x47')](handleError(_0x3e9b93,null));};exports[_0xab97('0x28')]=function(_0x30df6,_0x2c32c2){return db[_0xab97('0x2e')][_0xab97('0x4d')]({'where':{'id':_0x30df6[_0xab97('0x49')]['id']}})[_0xab97('0x27')](handleEntityNotFound(_0x2c32c2,null))[_0xab97('0x27')](removeEntity(_0x2c32c2,null))[_0xab97('0x47')](handleError(_0x2c32c2,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 0645531..30ddae8 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 _0x70d4=['SquareMessage','square_messages','lodash','util','api','moment','bluebird','path','rimraf','exports','define'];(function(_0x18af79,_0x391cb5){var _0x13890c=function(_0x5530b4){while(--_0x5530b4){_0x18af79['push'](_0x18af79['shift']());}};_0x13890c(++_0x391cb5);}(_0x70d4,0xf4));var _0x470d=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x70d4[_0x4cbf20];return _0x582ae4;};'use strict';var _=require(_0x470d('0x0'));var util=require(_0x470d('0x1'));var logger=require('../../config/logger')(_0x470d('0x2'));var moment=require(_0x470d('0x3'));var BPromise=require(_0x470d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x470d('0x5'));var rimraf=require(_0x470d('0x6'));var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0x470d('0x7')]=function(_0x58ca77,_0xcc7379){return _0x58ca77[_0x470d('0x8')](_0x470d('0x9'),attributes,{'tableName':_0x470d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2494=['lodash','util','../../config/logger','bluebird','path','../../config/environment','./squareMessage.attributes','define','SquareMessage'];(function(_0x37d4a3,_0x36acbe){var _0x22fac8=function(_0x212fec){while(--_0x212fec){_0x37d4a3['push'](_0x37d4a3['shift']());}};_0x22fac8(++_0x36acbe);}(_0x2494,0xbd));var _0x4249=function(_0x595b8d,_0x10cfa1){_0x595b8d=_0x595b8d-0x0;var _0xea7f08=_0x2494[_0x595b8d];return _0xea7f08;};'use strict';var _=require(_0x4249('0x0'));var util=require(_0x4249('0x1'));var logger=require(_0x4249('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4249('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4249('0x4'));var rimraf=require('rimraf');var config=require(_0x4249('0x5'));var attributes=require(_0x4249('0x6'));module['exports']=function(_0x186e41,_0x27d3ea){return _0x186e41[_0x4249('0x7')](_0x4249('0x8'),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 c2abb93..0cc2568 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 _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x3dad45,_0x294ee7){var _0x34d24a=function(_0x129688){while(--_0x129688){_0x3dad45['push'](_0x3dad45['shift']());}};_0x34d24a(++_0x294ee7);}(_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 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['CreateSquareMessage']=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?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file +var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x2cffe2,_0x563a65){var _0x55ba86=function(_0x34f9b5){while(--_0x34f9b5){_0x2cffe2['push'](_0x2cffe2['shift']());}};_0x55ba86(++_0x563a65);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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['CreateSquareMessage']=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?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 57a5c22..ff1aaa9 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 _0xb03a=['create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/test','15s','test','post'];(function(_0x184a56,_0x503f50){var _0x89ba34=function(_0x2cce45){while(--_0x2cce45){_0x184a56['push'](_0x184a56['shift']());}};_0x89ba34(++_0x503f50);}(_0xb03a,0x1d0));var _0xab03=function(_0x3b56e3,_0x2657cd){_0x3b56e3=_0x3b56e3-0x0;var _0x32a812=_0xb03a[_0x3b56e3];return _0x32a812;};'use strict';var multer=require(_0xab03('0x0'));var util=require(_0xab03('0x1'));var path=require(_0xab03('0x2'));var timeout=require(_0xab03('0x3'));var express=require(_0xab03('0x4'));var router=express[_0xab03('0x5')]();var auth=require(_0xab03('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xab03('0x7'));var controller=require('./squareOdbc.controller');router[_0xab03('0x8')]('/',auth[_0xab03('0x9')](),controller[_0xab03('0xa')]);router[_0xab03('0x8')](_0xab03('0xb'),auth[_0xab03('0x9')](),controller['show']);router[_0xab03('0x8')](_0xab03('0xc'),auth[_0xab03('0x9')](),timeout(_0xab03('0xd')),controller[_0xab03('0xe')]);router[_0xab03('0xf')]('/',auth[_0xab03('0x9')](),controller[_0xab03('0x10')]);router[_0xab03('0x11')](_0xab03('0xb'),auth[_0xab03('0x9')](),controller['update']);router[_0xab03('0x12')]('/:id',auth[_0xab03('0x9')](),controller['destroy']);module[_0xab03('0x13')]=router; \ No newline at end of file +var _0x994b=['/:id','/:id/test','15s','post','put','update','delete','exports','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','get'];(function(_0x2171b7,_0x3c824c){var _0x132330=function(_0x27636b){while(--_0x27636b){_0x2171b7['push'](_0x2171b7['shift']());}};_0x132330(++_0x3c824c);}(_0x994b,0x198));var _0xb994=function(_0x56d49a,_0x419ef9){_0x56d49a=_0x56d49a-0x0;var _0x2fe15f=_0x994b[_0x56d49a];return _0x2fe15f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb994('0x0'));var express=require(_0xb994('0x1'));var router=express['Router']();var auth=require(_0xb994('0x2'));var interaction=require(_0xb994('0x3'));var config=require(_0xb994('0x4'));var controller=require(_0xb994('0x5'));router['get']('/',auth[_0xb994('0x6')](),controller['index']);router[_0xb994('0x7')](_0xb994('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xb994('0x7')](_0xb994('0x9'),auth[_0xb994('0x6')](),timeout(_0xb994('0xa')),controller['test']);router[_0xb994('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb994('0xc')](_0xb994('0x8'),auth[_0xb994('0x6')](),controller[_0xb994('0xd')]);router[_0xb994('0xe')](_0xb994('0x8'),auth[_0xb994('0x6')](),controller['destroy']);module[_0xb994('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index d27469d..2c94e5a 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 _0xb6e3=['STRING','name','exports'];(function(_0x54e770,_0x4c695f){var _0x138bbc=function(_0xf2e4b){while(--_0xf2e4b){_0x54e770['push'](_0x54e770['shift']());}};_0x138bbc(++_0x4c695f);}(_0xb6e3,0x197));var _0x3b6e=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xb6e3[_0x2e4aa2];return _0x5e6092;};'use strict';var Sequelize=require('sequelize');module[_0x3b6e('0x0')]={'name':{'type':Sequelize[_0x3b6e('0x1')],'unique':_0x3b6e('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x3b6e('0x1')]},'description':{'type':Sequelize[_0x3b6e('0x1')]}}; \ No newline at end of file +var _0xf745=['exports','name','STRING','sequelize'];(function(_0x1acce5,_0x1932cc){var _0x2d81b7=function(_0x30018e){while(--_0x30018e){_0x1acce5['push'](_0x1acce5['shift']());}};_0x2d81b7(++_0x1932cc);}(_0xf745,0x77));var _0x5f74=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf745[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x5f74('0x0'));module[_0x5f74('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5f74('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x5f74('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index f8db3c2..e72ee22 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 _0x984f=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save','update','then','ODBC','destroy','error','name','send','index','map','SquareOdbc','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','filtears','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','closeSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x984f,0x97));var _0xf984=function(_0x527372,_0x173b25){_0x527372=_0x527372-0x0;var _0x4f88b2=_0x984f[_0x527372];return _0x4f88b2;};'use strict';var pdf=require(_0xf984('0x0'));var emlformat=require(_0xf984('0x1'));var rimraf=require(_0xf984('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf984('0x3'));var rp=require(_0xf984('0x4'));var moment=require('moment');var BPromise=require(_0xf984('0x5'));var Mustache=require(_0xf984('0x6'));var util=require(_0xf984('0x7'));var path=require(_0xf984('0x8'));var sox=require(_0xf984('0x9'));var csv=require(_0xf984('0xa'));var ejs=require(_0xf984('0xb'));var fs=require('fs');var _=require(_0xf984('0xc'));var squel=require('squel');var crypto=require(_0xf984('0xd'));var jsforce=require(_0xf984('0xe'));var deskjs=require(_0xf984('0xf'));var toCsv=require(_0xf984('0xa'));var querystring=require(_0xf984('0x10'));var Papa=require(_0xf984('0x11'));var Redis=require(_0xf984('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf984('0x13'));var as=require(_0xf984('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf984('0x15'))(_0xf984('0x16'));var utils=require(_0xf984('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf984('0x18'));var db=require(_0xf984('0x19'))['db'];function respondWithStatusCode(_0x292848,_0x4d1813){_0x4d1813=_0x4d1813||0xcc;return function(_0xccd9f4){if(_0xccd9f4){return _0x292848[_0xf984('0x1a')](_0x4d1813);}return _0x292848[_0xf984('0x1b')](_0x4d1813)[_0xf984('0x1c')]();};}function respondWithResult(_0x465661,_0x102f1d){_0x102f1d=_0x102f1d||0xc8;return function(_0x457468){if(_0x457468){return _0x465661['status'](_0x102f1d)['json'](_0x457468);}};}function respondWithFilteredResult(_0x17bf64,_0x4f332a){return function(_0x1d3163){if(_0x1d3163){var _0x32f84d=_0x1d3163['count'],_0x32de03=_0x4f332a[_0xf984('0x1d')],_0x567846=_0x4f332a['offset']+_0x4f332a[_0xf984('0x1e')],_0x45ade4;if(_0x567846>=_0x32f84d){_0x567846=_0x32f84d;_0x45ade4=0xc8;}else{_0x45ade4=0xce;}_0x17bf64[_0xf984('0x1b')](_0x45ade4);return _0x17bf64[_0xf984('0x1f')](_0xf984('0x20'),_0x32de03+'-'+_0x567846+'/'+_0x32f84d)[_0xf984('0x21')](_0x1d3163);}return null;};}function patchUpdates(_0x486a6e){return function(_0x182cac){try{jsonpatch['apply'](_0x182cac,_0x486a6e,!![]);}catch(_0x20a0c5){return BPromise[_0xf984('0x22')](_0x20a0c5);}return _0x182cac[_0xf984('0x23')]();};}function saveUpdates(_0x157ee1,_0xd1600c){return function(_0xd892f1){if(_0xd892f1){return _0xd892f1[_0xf984('0x24')](_0x157ee1)[_0xf984('0x25')](function(_0x33560b){return _0x33560b;});}return null;};}function removeEntity(_0x2ae9a3,_0x45d0e9){return function(_0xc44337){if(_0xc44337){return _0xc44337['destroy']()[_0xf984('0x25')](function(){var _0x3935a0=_0xc44337['get']({'plain':!![]});var _0x383eb6=_0xf984('0x26');return db['UserProfileResource'][_0xf984('0x27')]({'where':{'type':_0x383eb6,'resourceId':_0x3935a0['id']}})[_0xf984('0x25')](function(){return _0xc44337;});})[_0xf984('0x25')](function(){_0x2ae9a3[_0xf984('0x1b')](0xcc)[_0xf984('0x1c')]();});}};}function handleEntityNotFound(_0x169193,_0x43e2bd){return function(_0x5bcc4b){if(!_0x5bcc4b){_0x169193[_0xf984('0x1a')](0x194);}return _0x5bcc4b;};}function handleError(_0x146c93,_0x1b774d){_0x1b774d=_0x1b774d||0x1f4;return function(_0x281e0b){logger[_0xf984('0x28')](_0x281e0b['stack']);if(_0x281e0b['name']){delete _0x281e0b[_0xf984('0x29')];}_0x146c93[_0xf984('0x1b')](_0x1b774d)[_0xf984('0x2a')](_0x281e0b);};}exports[_0xf984('0x2b')]=function(_0x3c4b55,_0x109df1){var _0x3fd068={},_0x3fcf2f={},_0x3bc45b={'count':0x0,'rows':[]};var _0x1c87b9=_[_0xf984('0x2c')](db[_0xf984('0x2d')][_0xf984('0x2e')],function(_0x28a02f){return{'name':_0x28a02f['fieldName'],'type':_0x28a02f[_0xf984('0x2f')][_0xf984('0x30')]};});_0x3fcf2f[_0xf984('0x31')]=_[_0xf984('0x2c')](_0x1c87b9,_0xf984('0x29'));_0x3fcf2f[_0xf984('0x32')]=_[_0xf984('0x33')](_0x3c4b55[_0xf984('0x32')]);_0x3fcf2f[_0xf984('0x34')]=_[_0xf984('0x35')](_0x3fcf2f[_0xf984('0x31')],_0x3fcf2f['query']);_0x3fd068[_0xf984('0x36')]=_[_0xf984('0x35')](_0x3fcf2f[_0xf984('0x31')],qs['fields'](_0x3c4b55[_0xf984('0x32')][_0xf984('0x37')]));_0x3fd068[_0xf984('0x36')]=_0x3fd068[_0xf984('0x36')][_0xf984('0x38')]?_0x3fd068[_0xf984('0x36')]:_0x3fcf2f[_0xf984('0x31')];if(!_0x3c4b55[_0xf984('0x32')]['hasOwnProperty'](_0xf984('0x39'))){_0x3fd068['limit']=qs[_0xf984('0x1e')](_0x3c4b55[_0xf984('0x32')]['limit']);_0x3fd068[_0xf984('0x1d')]=qs[_0xf984('0x1d')](_0x3c4b55[_0xf984('0x32')][_0xf984('0x1d')]);}_0x3fd068['order']=qs[_0xf984('0x3a')](_0x3c4b55[_0xf984('0x32')][_0xf984('0x3a')]);_0x3fd068[_0xf984('0x3b')]=qs[_0xf984('0x34')](_[_0xf984('0x3c')](_0x3c4b55[_0xf984('0x32')],_0x3fcf2f['filters']),_0x1c87b9);if(_0x3c4b55[_0xf984('0x32')][_0xf984('0x3d')]){_0x3fd068[_0xf984('0x3b')]=_[_0xf984('0x3e')](_0x3fd068[_0xf984('0x3b')],{'$or':_[_0xf984('0x2c')](_0x1c87b9,function(_0x2fe17d){if(_0x2fe17d[_0xf984('0x2f')]!==_0xf984('0x3f')){var _0x580ffe={};_0x580ffe[_0x2fe17d[_0xf984('0x29')]]={'$like':'%'+_0x3c4b55[_0xf984('0x32')]['filter']+'%'};return _0x580ffe;}})});}_0x3fd068=_[_0xf984('0x3e')]({},_0x3fd068,_0x3c4b55[_0xf984('0x40')]);var _0x51de47={'where':_0x3fd068[_0xf984('0x3b')]};return db[_0xf984('0x2d')][_0xf984('0x41')](_0x51de47)[_0xf984('0x25')](function(_0x1d0ce7){_0x3bc45b[_0xf984('0x41')]=_0x1d0ce7;if(_0x3c4b55['query'][_0xf984('0x42')]){_0x3fd068[_0xf984('0x43')]=[{'all':!![]}];}return db[_0xf984('0x2d')][_0xf984('0x44')](_0x3fd068);})[_0xf984('0x25')](function(_0x22099d){_0x3bc45b['rows']=_0x22099d;return _0x3bc45b;})[_0xf984('0x25')](respondWithFilteredResult(_0x109df1,_0x3fd068))[_0xf984('0x45')](handleError(_0x109df1,null));};exports[_0xf984('0x46')]=function(_0x52bf08,_0x3d147b){var _0x14f94f={'raw':!![],'where':{'id':_0x52bf08[_0xf984('0x47')]['id']}},_0x4a31dc={};_0x4a31dc[_0xf984('0x31')]=_[_0xf984('0x33')](db[_0xf984('0x2d')][_0xf984('0x2e')]);_0x4a31dc[_0xf984('0x32')]=_[_0xf984('0x33')](_0x52bf08[_0xf984('0x32')]);_0x4a31dc[_0xf984('0x48')]=_[_0xf984('0x35')](_0x4a31dc[_0xf984('0x31')],_0x4a31dc[_0xf984('0x32')]);_0x14f94f[_0xf984('0x36')]=_['intersection'](_0x4a31dc[_0xf984('0x31')],qs[_0xf984('0x37')](_0x52bf08[_0xf984('0x32')][_0xf984('0x37')]));_0x14f94f[_0xf984('0x36')]=_0x14f94f[_0xf984('0x36')][_0xf984('0x38')]?_0x14f94f[_0xf984('0x36')]:_0x4a31dc[_0xf984('0x31')];if(_0x52bf08[_0xf984('0x32')][_0xf984('0x42')]){_0x14f94f[_0xf984('0x43')]=[{'all':!![]}];}_0x14f94f=_[_0xf984('0x3e')]({},_0x14f94f,_0x52bf08[_0xf984('0x40')]);return db[_0xf984('0x2d')][_0xf984('0x49')](_0x14f94f)[_0xf984('0x25')](handleEntityNotFound(_0x3d147b,null))[_0xf984('0x25')](respondWithResult(_0x3d147b,null))[_0xf984('0x45')](handleError(_0x3d147b,null));};exports['create']=function(_0x4ebb53,_0x1db6d5){return db[_0xf984('0x2d')][_0xf984('0x4a')](_0x4ebb53[_0xf984('0x4b')],{})[_0xf984('0x25')](function(_0xf3a4e7){var _0x1af1b0=_0x4ebb53[_0xf984('0x4c')]['get']({'plain':!![]});if(!_0x1af1b0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1af1b0[_0xf984('0x4d')]===_0xf984('0x4c')){var _0x3aa9af=_0xf3a4e7['get']({'plain':!![]});var _0x4c194a='ODBC';return db[_0xf984('0x4e')][_0xf984('0x49')]({'where':{'name':_0x4c194a,'userProfileId':_0x1af1b0[_0xf984('0x4f')]},'raw':!![]})[_0xf984('0x25')](function(_0x48af9f){if(_0x48af9f&&_0x48af9f[_0xf984('0x50')]===0x0){return db[_0xf984('0x51')][_0xf984('0x4a')]({'name':_0x3aa9af['name'],'resourceId':_0x3aa9af['id'],'type':_0x48af9f['name'],'sectionId':_0x48af9f['id']},{})['then'](function(){return _0xf3a4e7;});}else{return _0xf3a4e7;}})['catch'](function(_0x572886){logger[_0xf984('0x28')](_0xf984('0x52'),_0x572886);throw _0x572886;});}return _0xf3a4e7;})['then'](respondWithResult(_0x1db6d5,0xc9))[_0xf984('0x45')](handleError(_0x1db6d5,null));};exports['update']=function(_0x195a78,_0x26f58f){if(_0x195a78['body']['id']){delete _0x195a78['body']['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x195a78['params']['id']}})['then'](handleEntityNotFound(_0x26f58f,null))['then'](saveUpdates(_0x195a78[_0xf984('0x4b')],null))[_0xf984('0x25')](respondWithResult(_0x26f58f,null))[_0xf984('0x45')](handleError(_0x26f58f,null));};exports[_0xf984('0x27')]=function(_0xb400d6,_0xb1ad8a){return db[_0xf984('0x2d')][_0xf984('0x49')]({'where':{'id':_0xb400d6[_0xf984('0x47')]['id']}})[_0xf984('0x25')](handleEntityNotFound(_0xb1ad8a,null))[_0xf984('0x25')](removeEntity(_0xb1ad8a,null))['catch'](handleError(_0xb1ad8a,null));};exports[_0xf984('0x53')]=function(_0x124542,_0x59b1ce,_0x344ca){var _0x56c472;return db['SquareOdbc'][_0xf984('0x49')]({'where':{'id':_0x124542[_0xf984('0x47')]['id']},'attributes':['id',_0xf984('0x54')]})[_0xf984('0x25')](handleEntityNotFound(_0x59b1ce,null))[_0xf984('0x25')](function(_0x3558a6){if(_0x3558a6){var _0x30239f=require(_0xf984('0x55'))();_0x30239f['openSync'](_0x3558a6[_0xf984('0x54')]);_0x30239f[_0xf984('0x56')]();return _0x3558a6;}})[_0xf984('0x25')](respondWithResult(_0x59b1ce,null))[_0xf984('0x45')](handleError(_0x59b1ce,null));}; \ No newline at end of file +var _0x6797=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','SquareOdbc','include','catch','params','filtears','options','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','test','dsn','closeSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','ODBC','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection'];(function(_0x594670,_0x4b9fdd){var _0x36a5b7=function(_0x45471e){while(--_0x45471e){_0x594670['push'](_0x594670['shift']());}};_0x36a5b7(++_0x4b9fdd);}(_0x6797,0x115));var _0x7679=function(_0x58d67e,_0x235b06){_0x58d67e=_0x58d67e-0x0;var _0x246a9e=_0x6797[_0x58d67e];return _0x246a9e;};'use strict';var pdf=require(_0x7679('0x0'));var emlformat=require(_0x7679('0x1'));var rimraf=require(_0x7679('0x2'));var zipdir=require(_0x7679('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7679('0x4'));var moment=require(_0x7679('0x5'));var BPromise=require(_0x7679('0x6'));var Mustache=require(_0x7679('0x7'));var util=require(_0x7679('0x8'));var path=require(_0x7679('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7679('0xa'));var fs=require('fs');var _=require(_0x7679('0xb'));var squel=require(_0x7679('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7679('0xd'));var toCsv=require(_0x7679('0xe'));var querystring=require(_0x7679('0xf'));var Papa=require(_0x7679('0x10'));var Redis=require('ioredis');var authService=require(_0x7679('0x11'));var qs=require(_0x7679('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7679('0x13'));var utils=require(_0x7679('0x14'));var config=require(_0x7679('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7679('0x16'))['db'];function respondWithStatusCode(_0x1aa150,_0x126753){_0x126753=_0x126753||0xcc;return function(_0x229368){if(_0x229368){return _0x1aa150[_0x7679('0x17')](_0x126753);}return _0x1aa150[_0x7679('0x18')](_0x126753)[_0x7679('0x19')]();};}function respondWithResult(_0x2f66f7,_0x22fb3f){_0x22fb3f=_0x22fb3f||0xc8;return function(_0x52b1b5){if(_0x52b1b5){return _0x2f66f7[_0x7679('0x18')](_0x22fb3f)[_0x7679('0x1a')](_0x52b1b5);}};}function respondWithFilteredResult(_0x2c01b3,_0x5ad34d){return function(_0x17cf9c){if(_0x17cf9c){var _0x58b013=_0x17cf9c[_0x7679('0x1b')],_0x58ec83=_0x5ad34d[_0x7679('0x1c')],_0x31a3ce=_0x5ad34d[_0x7679('0x1c')]+_0x5ad34d[_0x7679('0x1d')],_0x44df6f;if(_0x31a3ce>=_0x58b013){_0x31a3ce=_0x58b013;_0x44df6f=0xc8;}else{_0x44df6f=0xce;}_0x2c01b3[_0x7679('0x18')](_0x44df6f);return _0x2c01b3[_0x7679('0x1e')](_0x7679('0x1f'),_0x58ec83+'-'+_0x31a3ce+'/'+_0x58b013)['json'](_0x17cf9c);}return null;};}function patchUpdates(_0x2732eb){return function(_0x1fe203){try{jsonpatch['apply'](_0x1fe203,_0x2732eb,!![]);}catch(_0x28c327){return BPromise['reject'](_0x28c327);}return _0x1fe203[_0x7679('0x20')]();};}function saveUpdates(_0x225983,_0x1145da){return function(_0x3200bc){if(_0x3200bc){return _0x3200bc[_0x7679('0x21')](_0x225983)[_0x7679('0x22')](function(_0x56754e){return _0x56754e;});}return null;};}function removeEntity(_0x4df916,_0x55b13d){return function(_0x353ed4){if(_0x353ed4){return _0x353ed4[_0x7679('0x23')]()['then'](function(){var _0x59e1ce=_0x353ed4['get']({'plain':!![]});var _0x5f01c1=_0x7679('0x24');return db[_0x7679('0x25')]['destroy']({'where':{'type':_0x5f01c1,'resourceId':_0x59e1ce['id']}})[_0x7679('0x22')](function(){return _0x353ed4;});})[_0x7679('0x22')](function(){_0x4df916[_0x7679('0x18')](0xcc)[_0x7679('0x19')]();});}};}function handleEntityNotFound(_0x13c367,_0x2b7a18){return function(_0x2296c4){if(!_0x2296c4){_0x13c367[_0x7679('0x17')](0x194);}return _0x2296c4;};}function handleError(_0x2fd8bf,_0x357f50){_0x357f50=_0x357f50||0x1f4;return function(_0x13c8ee){logger['error'](_0x13c8ee[_0x7679('0x26')]);if(_0x13c8ee['name']){delete _0x13c8ee[_0x7679('0x27')];}_0x2fd8bf['status'](_0x357f50)[_0x7679('0x28')](_0x13c8ee);};}exports[_0x7679('0x29')]=function(_0x1c8281,_0x553acc){var _0x2f7114={},_0x320752={},_0x5675d2={'count':0x0,'rows':[]};var _0x4c87ae=_['map'](db['SquareOdbc'][_0x7679('0x2a')],function(_0xb27482){return{'name':_0xb27482[_0x7679('0x2b')],'type':_0xb27482['type'][_0x7679('0x2c')]};});_0x320752[_0x7679('0x2d')]=_[_0x7679('0x2e')](_0x4c87ae,'name');_0x320752[_0x7679('0x2f')]=_[_0x7679('0x30')](_0x1c8281[_0x7679('0x2f')]);_0x320752[_0x7679('0x31')]=_[_0x7679('0x32')](_0x320752['model'],_0x320752['query']);_0x2f7114['attributes']=_[_0x7679('0x32')](_0x320752[_0x7679('0x2d')],qs[_0x7679('0x33')](_0x1c8281[_0x7679('0x2f')][_0x7679('0x33')]));_0x2f7114[_0x7679('0x34')]=_0x2f7114[_0x7679('0x34')][_0x7679('0x35')]?_0x2f7114[_0x7679('0x34')]:_0x320752['model'];if(!_0x1c8281['query'][_0x7679('0x36')](_0x7679('0x37'))){_0x2f7114['limit']=qs[_0x7679('0x1d')](_0x1c8281[_0x7679('0x2f')][_0x7679('0x1d')]);_0x2f7114['offset']=qs[_0x7679('0x1c')](_0x1c8281[_0x7679('0x2f')][_0x7679('0x1c')]);}_0x2f7114[_0x7679('0x38')]=qs[_0x7679('0x39')](_0x1c8281[_0x7679('0x2f')][_0x7679('0x39')]);_0x2f7114['where']=qs['filters'](_[_0x7679('0x3a')](_0x1c8281['query'],_0x320752[_0x7679('0x31')]),_0x4c87ae);if(_0x1c8281['query'][_0x7679('0x3b')]){_0x2f7114[_0x7679('0x3c')]=_[_0x7679('0x3d')](_0x2f7114[_0x7679('0x3c')],{'$or':_['map'](_0x4c87ae,function(_0x432a4d){if(_0x432a4d['type']!==_0x7679('0x3e')){var _0x2269ca={};_0x2269ca[_0x432a4d[_0x7679('0x27')]]={'$like':'%'+_0x1c8281[_0x7679('0x2f')][_0x7679('0x3b')]+'%'};return _0x2269ca;}})});}_0x2f7114=_['merge']({},_0x2f7114,_0x1c8281['options']);var _0x16d3e2={'where':_0x2f7114[_0x7679('0x3c')]};return db[_0x7679('0x3f')][_0x7679('0x1b')](_0x16d3e2)[_0x7679('0x22')](function(_0x13fade){_0x5675d2[_0x7679('0x1b')]=_0x13fade;if(_0x1c8281['query']['includeAll']){_0x2f7114[_0x7679('0x40')]=[{'all':!![]}];}return db[_0x7679('0x3f')]['findAll'](_0x2f7114);})['then'](function(_0x2398e7){_0x5675d2['rows']=_0x2398e7;return _0x5675d2;})[_0x7679('0x22')](respondWithFilteredResult(_0x553acc,_0x2f7114))[_0x7679('0x41')](handleError(_0x553acc,null));};exports['show']=function(_0x43dccd,_0x207bca){var _0xd3ab7d={'raw':!![],'where':{'id':_0x43dccd[_0x7679('0x42')]['id']}},_0x565eb9={};_0x565eb9[_0x7679('0x2d')]=_[_0x7679('0x30')](db[_0x7679('0x3f')]['rawAttributes']);_0x565eb9[_0x7679('0x2f')]=_[_0x7679('0x30')](_0x43dccd['query']);_0x565eb9[_0x7679('0x43')]=_[_0x7679('0x32')](_0x565eb9[_0x7679('0x2d')],_0x565eb9['query']);_0xd3ab7d['attributes']=_[_0x7679('0x32')](_0x565eb9['model'],qs[_0x7679('0x33')](_0x43dccd[_0x7679('0x2f')][_0x7679('0x33')]));_0xd3ab7d[_0x7679('0x34')]=_0xd3ab7d[_0x7679('0x34')][_0x7679('0x35')]?_0xd3ab7d[_0x7679('0x34')]:_0x565eb9[_0x7679('0x2d')];if(_0x43dccd[_0x7679('0x2f')]['includeAll']){_0xd3ab7d[_0x7679('0x40')]=[{'all':!![]}];}_0xd3ab7d=_[_0x7679('0x3d')]({},_0xd3ab7d,_0x43dccd[_0x7679('0x44')]);return db[_0x7679('0x3f')]['find'](_0xd3ab7d)[_0x7679('0x22')](handleEntityNotFound(_0x207bca,null))[_0x7679('0x22')](respondWithResult(_0x207bca,null))[_0x7679('0x41')](handleError(_0x207bca,null));};exports['create']=function(_0x5763c1,_0x448be7){return db[_0x7679('0x3f')][_0x7679('0x45')](_0x5763c1['body'],{})[_0x7679('0x22')](function(_0x53bb1c){var _0x34d1b8=_0x5763c1[_0x7679('0x46')][_0x7679('0x47')]({'plain':!![]});if(!_0x34d1b8)throw new Error(_0x7679('0x48'));if(_0x34d1b8['role']==='user'){var _0x567f19=_0x53bb1c[_0x7679('0x47')]({'plain':!![]});var _0x279f1e=_0x7679('0x24');return db[_0x7679('0x49')]['find']({'where':{'name':_0x279f1e,'userProfileId':_0x34d1b8[_0x7679('0x4a')]},'raw':!![]})[_0x7679('0x22')](function(_0x3ffce7){if(_0x3ffce7&&_0x3ffce7['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x567f19[_0x7679('0x27')],'resourceId':_0x567f19['id'],'type':_0x3ffce7[_0x7679('0x27')],'sectionId':_0x3ffce7['id']},{})['then'](function(){return _0x53bb1c;});}else{return _0x53bb1c;}})['catch'](function(_0x592f2e){logger[_0x7679('0x4b')](_0x7679('0x4c'),_0x592f2e);throw _0x592f2e;});}return _0x53bb1c;})[_0x7679('0x22')](respondWithResult(_0x448be7,0xc9))[_0x7679('0x41')](handleError(_0x448be7,null));};exports[_0x7679('0x21')]=function(_0x1c43dc,_0x8c697c){if(_0x1c43dc[_0x7679('0x4d')]['id']){delete _0x1c43dc[_0x7679('0x4d')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x1c43dc[_0x7679('0x42')]['id']}})['then'](handleEntityNotFound(_0x8c697c,null))[_0x7679('0x22')](saveUpdates(_0x1c43dc['body'],null))[_0x7679('0x22')](respondWithResult(_0x8c697c,null))[_0x7679('0x41')](handleError(_0x8c697c,null));};exports[_0x7679('0x23')]=function(_0x4b5891,_0x4a1881){return db[_0x7679('0x3f')][_0x7679('0x4e')]({'where':{'id':_0x4b5891[_0x7679('0x42')]['id']}})[_0x7679('0x22')](handleEntityNotFound(_0x4a1881,null))[_0x7679('0x22')](removeEntity(_0x4a1881,null))[_0x7679('0x41')](handleError(_0x4a1881,null));};exports[_0x7679('0x4f')]=function(_0x53871a,_0x138d00,_0x1b3b6e){var _0x444457;return db[_0x7679('0x3f')]['find']({'where':{'id':_0x53871a['params']['id']},'attributes':['id','dsn']})[_0x7679('0x22')](handleEntityNotFound(_0x138d00,null))[_0x7679('0x22')](function(_0x32d26a){if(_0x32d26a){var _0x4895f8=require('odbc')();_0x4895f8['openSync'](_0x32d26a[_0x7679('0x50')]);_0x4895f8[_0x7679('0x51')]();return _0x32d26a;}})[_0x7679('0x22')](respondWithResult(_0x138d00,null))['catch'](handleError(_0x138d00,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 428cff5..bfa4c36 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 _0xa643=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','square_odbc','lodash','util'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xa643,0x11c));var _0x3a64=function(_0x29055e,_0x3aa359){_0x29055e=_0x29055e-0x0;var _0x2ededa=_0xa643[_0x29055e];return _0x2ededa;};'use strict';var _=require(_0x3a64('0x0'));var util=require(_0x3a64('0x1'));var logger=require('../../config/logger')(_0x3a64('0x2'));var moment=require(_0x3a64('0x3'));var BPromise=require('bluebird');var rp=require(_0x3a64('0x4'));var fs=require('fs');var path=require(_0x3a64('0x5'));var rimraf=require(_0x3a64('0x6'));var config=require(_0x3a64('0x7'));var attributes=require('./squareOdbc.attributes');module[_0x3a64('0x8')]=function(_0x14e51b,_0x207bec){return _0x14e51b[_0x3a64('0x9')]('SquareOdbc',attributes,{'tableName':_0x3a64('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c96=['bluebird','request-promise','path','../../config/environment','./squareOdbc.attributes','define','SquareOdbc','lodash','util','../../config/logger','api','moment'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x4c96,0xbb));var _0x64c9=function(_0x222338,_0x7e39af){_0x222338=_0x222338-0x0;var _0x209673=_0x4c96[_0x222338];return _0x209673;};'use strict';var _=require(_0x64c9('0x0'));var util=require(_0x64c9('0x1'));var logger=require(_0x64c9('0x2'))(_0x64c9('0x3'));var moment=require(_0x64c9('0x4'));var BPromise=require(_0x64c9('0x5'));var rp=require(_0x64c9('0x6'));var fs=require('fs');var path=require(_0x64c9('0x7'));var rimraf=require('rimraf');var config=require(_0x64c9('0x8'));var attributes=require(_0x64c9('0x9'));module['exports']=function(_0x1b6261,_0xc7a075){return _0x1b6261[_0x64c9('0xa')](_0x64c9('0xb'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 9ae61b3..173ab2d 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find'];(function(_0xc5775d,_0x3701ab){var _0x3b4edd=function(_0x37c3cb){while(--_0x37c3cb){_0xc5775d['push'](_0xc5775d['shift']());}};_0x3b4edd(++_0x3701ab);}(_0x55ca,0x126));var _0xa55c=function(_0x2f23c6,_0x8eacbc){_0x2f23c6=_0x2f23c6-0x0;var _0x12e26a=_0x55ca[_0x2f23c6];return _0x12e26a;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +var _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(_0x499aab,_0x79ef10){var _0x1174b1=function(_0x2625eb){while(--_0x2625eb){_0x499aab['push'](_0x499aab['shift']());}};_0x1174b1(++_0x79ef10);}(_0xe14b,0x93));var _0xbe14=function(_0x24a0ed,_0x2ff0fc){_0x24a0ed=_0x24a0ed-0x0;var _0x46126c=_0xe14b[_0x24a0ed];return _0x46126c;};'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 a6580e6..856df4a 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 _0x9354=['express','Router','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/users','delete','destroy','removeUsers','exports','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9354,0x96));var _0x4935=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x9354[_0x4aba15];return _0x1c8122;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var auth=require(_0x4935('0x4'));var interaction=require(_0x4935('0x5'));var config=require('../../config/environment');var controller=require(_0x4935('0x6'));router[_0x4935('0x7')]('/',auth[_0x4935('0x8')](),controller[_0x4935('0x9')]);router[_0x4935('0x7')](_0x4935('0xa'),auth[_0x4935('0x8')](),controller[_0x4935('0xb')]);router[_0x4935('0x7')]('/:id/users',auth[_0x4935('0x8')](),controller['getUsers']);router[_0x4935('0xc')]('/',auth[_0x4935('0x8')](),controller[_0x4935('0xd')]);router[_0x4935('0xc')](_0x4935('0xe'),auth[_0x4935('0x8')](),controller['addUsers']);router['put'](_0x4935('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x4935('0xf')](_0x4935('0xa'),auth[_0x4935('0x8')](),controller[_0x4935('0x10')]);router[_0x4935('0xf')](_0x4935('0xe'),auth[_0x4935('0x8')](),controller[_0x4935('0x11')]);module[_0x4935('0x12')]=router; \ No newline at end of file +var _0x5c00=['getUsers','post','create','put','update','delete','removeUsers','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','show','/:id/users'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5c00,0x17e));var _0x05c0=function(_0x3ad7ad,_0x291a8d){_0x3ad7ad=_0x3ad7ad-0x0;var _0x225a60=_0x5c00[_0x3ad7ad];return _0x225a60;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var auth=require(_0x05c0('0x4'));var interaction=require(_0x05c0('0x5'));var config=require(_0x05c0('0x6'));var controller=require(_0x05c0('0x7'));router['get']('/',auth[_0x05c0('0x8')](),controller[_0x05c0('0x9')]);router[_0x05c0('0xa')](_0x05c0('0xb'),auth['isAuthenticated'](),controller[_0x05c0('0xc')]);router[_0x05c0('0xa')](_0x05c0('0xd'),auth['isAuthenticated'](),controller[_0x05c0('0xe')]);router[_0x05c0('0xf')]('/',auth[_0x05c0('0x8')](),controller[_0x05c0('0x10')]);router[_0x05c0('0xf')](_0x05c0('0xd'),auth['isAuthenticated'](),controller['addUsers']);router[_0x05c0('0x11')]('/:id',auth[_0x05c0('0x8')](),controller[_0x05c0('0x12')]);router[_0x05c0('0x13')]('/:id',auth[_0x05c0('0x8')](),controller['destroy']);router[_0x05c0('0x13')](_0x05c0('0xd'),auth[_0x05c0('0x8')](),controller[_0x05c0('0x14')]);module[_0x05c0('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index c08397d..11d38de 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 _0x70d5=['STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','sequelize','exports'];(function(_0x1867f5,_0x419bcb){var _0x1cb0a4=function(_0x15ff8b){while(--_0x15ff8b){_0x1867f5['push'](_0x1867f5['shift']());}};_0x1cb0a4(++_0x419bcb);}(_0x70d5,0x1cc));var _0x570d=function(_0x2dc4c5,_0x115bf6){_0x2dc4c5=_0x2dc4c5-0x0;var _0x439cbe=_0x70d5[_0x2dc4c5];return _0x439cbe;};'use strict';var Sequelize=require(_0x570d('0x0'));module[_0x570d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x570d('0x2')]},'notes':{'type':Sequelize[_0x570d('0x3')]},'preproduction':{'type':Sequelize[_0x570d('0x4')](_0x570d('0x5')),'get':function(){if(this[_0x570d('0x6')](_0x570d('0x7'))){return this[_0x570d('0x6')](_0x570d('0x7'))[_0x570d('0x8')](_0x570d('0x9'));}}},'production':{'type':Sequelize[_0x570d('0x4')]('long'),'get':function(){if(this[_0x570d('0x6')]('production')){return this[_0x570d('0x6')](_0x570d('0xa'))[_0x570d('0x8')](_0x570d('0x9'));}}}}; \ No newline at end of file +var _0x940b=['name','TEXT','long','getDataValue','preproduction','utf8','production','STRING'];(function(_0x819400,_0x20fcc8){var _0x1ba168=function(_0x27c3a6){while(--_0x27c3a6){_0x819400['push'](_0x819400['shift']());}};_0x1ba168(++_0x20fcc8);}(_0x940b,0x127));var _0xb940=function(_0x40fcfb,_0x492624){_0x40fcfb=_0x40fcfb-0x0;var _0x2a3218=_0x940b[_0x40fcfb];return _0x2a3218;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb940('0x0')],'unique':_0xb940('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xb940('0x2')]},'preproduction':{'type':Sequelize['BLOB'](_0xb940('0x3')),'get':function(){if(this['getDataValue']('preproduction')){return this[_0xb940('0x4')](_0xb940('0x5'))['toString'](_0xb940('0x6'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this['getDataValue'](_0xb940('0x7'))){return this[_0xb940('0x4')](_0xb940('0x7'))['toString'](_0xb940('0x6'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index d106456..8698a21 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 _0x5975=['filters','merge','map','VIRTUAL','filter','options','count','includeAll','include','rows','catch','params','filtears','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','pick','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','then','SquareProjects','UserProfileResource','error','stack','name','send','index','SquareProject','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x256c3f,_0x3012e4){var _0x25c89f=function(_0x8026f3){while(--_0x8026f3){_0x256c3f['push'](_0x256c3f['shift']());}};_0x25c89f(++_0x3012e4);}(_0x5975,0xe4));var _0x5597=function(_0x1288b6,_0x404e05){_0x1288b6=_0x1288b6-0x0;var _0x4b52c6=_0x5975[_0x1288b6];return _0x4b52c6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5597('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5597('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5597('0x2'));var moment=require(_0x5597('0x3'));var BPromise=require(_0x5597('0x4'));var Mustache=require('mustache');var util=require(_0x5597('0x5'));var path=require(_0x5597('0x6'));var sox=require(_0x5597('0x7'));var csv=require(_0x5597('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5597('0x9'));var squel=require(_0x5597('0xa'));var crypto=require(_0x5597('0xb'));var jsforce=require(_0x5597('0xc'));var deskjs=require(_0x5597('0xd'));var toCsv=require(_0x5597('0x8'));var querystring=require(_0x5597('0xe'));var Papa=require('papaparse');var Redis=require(_0x5597('0xf'));var authService=require(_0x5597('0x10'));var qs=require(_0x5597('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5597('0x12'))('api');var utils=require(_0x5597('0x13'));var config=require(_0x5597('0x14'));var licenseUtil=require(_0x5597('0x15'));var db=require(_0x5597('0x16'))['db'];config[_0x5597('0x17')]=_['defaults'](config[_0x5597('0x17')],{'host':_0x5597('0x18'),'port':0x18eb});var socket=require(_0x5597('0x19'))(new Redis(config['redis']));require(_0x5597('0x1a'))[_0x5597('0x1b')](socket);function respondWithStatusCode(_0x13f194,_0x1288be){_0x1288be=_0x1288be||0xcc;return function(_0x4438e6){if(_0x4438e6){return _0x13f194[_0x5597('0x1c')](_0x1288be);}return _0x13f194['status'](_0x1288be)[_0x5597('0x1d')]();};}function respondWithResult(_0x473034,_0x1cafc3){_0x1cafc3=_0x1cafc3||0xc8;return function(_0x15e95e){if(_0x15e95e){return _0x473034[_0x5597('0x1e')](_0x1cafc3)[_0x5597('0x1f')](_0x15e95e);}};}function respondWithFilteredResult(_0x449ad7,_0x2aff94){return function(_0x5b9ff2){if(_0x5b9ff2){var _0x2fd5f8=_0x5b9ff2['count'],_0x49e2ff=_0x2aff94[_0x5597('0x20')],_0x3a68f6=_0x2aff94[_0x5597('0x20')]+_0x2aff94[_0x5597('0x21')],_0x56489a;if(_0x3a68f6>=_0x2fd5f8){_0x3a68f6=_0x2fd5f8;_0x56489a=0xc8;}else{_0x56489a=0xce;}_0x449ad7['status'](_0x56489a);return _0x449ad7[_0x5597('0x22')](_0x5597('0x23'),_0x49e2ff+'-'+_0x3a68f6+'/'+_0x2fd5f8)['json'](_0x5b9ff2);}return null;};}function patchUpdates(_0x4da428){return function(_0x1ab6aa){try{jsonpatch[_0x5597('0x24')](_0x1ab6aa,_0x4da428,!![]);}catch(_0xcf9ca9){return BPromise[_0x5597('0x25')](_0xcf9ca9);}return _0x1ab6aa[_0x5597('0x26')]();};}function saveUpdates(_0xb69136,_0x552446){return function(_0xb9b228){if(_0xb9b228){return _0xb9b228['update'](_0xb69136)[_0x5597('0x27')](function(_0x83cedc){return _0x83cedc;});}return null;};}function removeEntity(_0x3cdd30,_0x3e3200){return function(_0x397ba5){if(_0x397ba5){return _0x397ba5['destroy']()[_0x5597('0x27')](function(){var _0x1223f6=_0x397ba5['get']({'plain':!![]});var _0x3ab5e3=_0x5597('0x28');return db[_0x5597('0x29')]['destroy']({'where':{'type':_0x3ab5e3,'resourceId':_0x1223f6['id']}})[_0x5597('0x27')](function(){return _0x397ba5;});})[_0x5597('0x27')](function(){_0x3cdd30[_0x5597('0x1e')](0xcc)[_0x5597('0x1d')]();});}};}function handleEntityNotFound(_0x4c7f43,_0x295756){return function(_0x18d9f4){if(!_0x18d9f4){_0x4c7f43[_0x5597('0x1c')](0x194);}return _0x18d9f4;};}function handleError(_0x1edd78,_0x971f73){_0x971f73=_0x971f73||0x1f4;return function(_0x1f8738){logger[_0x5597('0x2a')](_0x1f8738[_0x5597('0x2b')]);if(_0x1f8738[_0x5597('0x2c')]){delete _0x1f8738[_0x5597('0x2c')];}_0x1edd78[_0x5597('0x1e')](_0x971f73)[_0x5597('0x2d')](_0x1f8738);};}exports[_0x5597('0x2e')]=function(_0x29d5a5,_0x572364){var _0x3ae34c={},_0x83d885={},_0x55481e={'count':0x0,'rows':[]};var _0x1d2fca=_['map'](db[_0x5597('0x2f')][_0x5597('0x30')],function(_0xafff6a){return{'name':_0xafff6a['fieldName'],'type':_0xafff6a[_0x5597('0x31')][_0x5597('0x32')]};});_0x83d885[_0x5597('0x33')]=_['map'](_0x1d2fca,_0x5597('0x2c'));_0x83d885[_0x5597('0x34')]=_[_0x5597('0x35')](_0x29d5a5[_0x5597('0x34')]);_0x83d885['filters']=_[_0x5597('0x36')](_0x83d885[_0x5597('0x33')],_0x83d885[_0x5597('0x34')]);_0x3ae34c[_0x5597('0x37')]=_[_0x5597('0x36')](_0x83d885['model'],qs[_0x5597('0x38')](_0x29d5a5[_0x5597('0x34')]['fields']));_0x3ae34c[_0x5597('0x37')]=_0x3ae34c[_0x5597('0x37')][_0x5597('0x39')]?_0x3ae34c[_0x5597('0x37')]:_0x83d885[_0x5597('0x33')];if(!_0x29d5a5[_0x5597('0x34')][_0x5597('0x3a')](_0x5597('0x3b'))){_0x3ae34c[_0x5597('0x21')]=qs[_0x5597('0x21')](_0x29d5a5[_0x5597('0x34')]['limit']);_0x3ae34c['offset']=qs[_0x5597('0x20')](_0x29d5a5[_0x5597('0x34')][_0x5597('0x20')]);}_0x3ae34c[_0x5597('0x3c')]=qs['sort'](_0x29d5a5[_0x5597('0x34')][_0x5597('0x3d')]);_0x3ae34c[_0x5597('0x3e')]=qs[_0x5597('0x3f')](_['pick'](_0x29d5a5[_0x5597('0x34')],_0x83d885[_0x5597('0x3f')]),_0x1d2fca);if(_0x29d5a5[_0x5597('0x34')]['filter']){_0x3ae34c[_0x5597('0x3e')]=_[_0x5597('0x40')](_0x3ae34c[_0x5597('0x3e')],{'$or':_[_0x5597('0x41')](_0x1d2fca,function(_0x2957a7){if(_0x2957a7['type']!==_0x5597('0x42')){var _0x18221a={};_0x18221a[_0x2957a7['name']]={'$like':'%'+_0x29d5a5['query'][_0x5597('0x43')]+'%'};return _0x18221a;}})});}_0x3ae34c=_['merge']({},_0x3ae34c,_0x29d5a5[_0x5597('0x44')]);var _0x57743b={'where':_0x3ae34c[_0x5597('0x3e')]};return db['SquareProject'][_0x5597('0x45')](_0x57743b)[_0x5597('0x27')](function(_0x1db398){_0x55481e[_0x5597('0x45')]=_0x1db398;if(_0x29d5a5[_0x5597('0x34')][_0x5597('0x46')]){_0x3ae34c[_0x5597('0x47')]=[{'all':!![]}];}return db[_0x5597('0x2f')]['findAll'](_0x3ae34c);})[_0x5597('0x27')](function(_0x430c1e){_0x55481e[_0x5597('0x48')]=_0x430c1e;return _0x55481e;})[_0x5597('0x27')](respondWithFilteredResult(_0x572364,_0x3ae34c))[_0x5597('0x49')](handleError(_0x572364,null));};exports['show']=function(_0x93b1d4,_0x275ec2){var _0x287faf={'raw':![],'where':{'id':_0x93b1d4[_0x5597('0x4a')]['id']}},_0x2c832c={};_0x2c832c[_0x5597('0x33')]=_['keys'](db['SquareProject']['rawAttributes']);_0x2c832c[_0x5597('0x34')]=_[_0x5597('0x35')](_0x93b1d4[_0x5597('0x34')]);_0x2c832c[_0x5597('0x4b')]=_['intersection'](_0x2c832c[_0x5597('0x33')],_0x2c832c[_0x5597('0x34')]);_0x287faf[_0x5597('0x37')]=_[_0x5597('0x36')](_0x2c832c[_0x5597('0x33')],qs[_0x5597('0x38')](_0x93b1d4[_0x5597('0x34')][_0x5597('0x38')]));_0x287faf['attributes']=_0x287faf[_0x5597('0x37')]['length']?_0x287faf[_0x5597('0x37')]:_0x2c832c[_0x5597('0x33')];if(_0x93b1d4[_0x5597('0x34')][_0x5597('0x46')]){_0x287faf[_0x5597('0x47')]=[{'all':!![]}];}_0x287faf=_[_0x5597('0x40')]({},_0x287faf,_0x93b1d4[_0x5597('0x44')]);return db[_0x5597('0x2f')][_0x5597('0x4c')](_0x287faf)[_0x5597('0x27')](handleEntityNotFound(_0x275ec2,null))['then'](respondWithResult(_0x275ec2,null))['catch'](handleError(_0x275ec2,null));};exports[_0x5597('0x4d')]=function(_0x130696,_0x27ba75){return db[_0x5597('0x2f')][_0x5597('0x4d')](_0x130696[_0x5597('0x4e')],{})[_0x5597('0x27')](function(_0xc44e79){var _0x10196c=_0x130696['user'][_0x5597('0x4f')]({'plain':!![]});if(!_0x10196c)throw new Error(_0x5597('0x50'));if(_0x10196c[_0x5597('0x51')]===_0x5597('0x52')){var _0x1b8c67=_0xc44e79['get']({'plain':!![]});var _0x4fd2f1=_0x5597('0x28');return db['UserProfileSection'][_0x5597('0x4c')]({'where':{'name':_0x4fd2f1,'userProfileId':_0x10196c[_0x5597('0x53')]},'raw':!![]})[_0x5597('0x27')](function(_0x2e0d5b){if(_0x2e0d5b&&_0x2e0d5b[_0x5597('0x54')]===0x0){return db[_0x5597('0x29')][_0x5597('0x4d')]({'name':_0x1b8c67[_0x5597('0x2c')],'resourceId':_0x1b8c67['id'],'type':_0x2e0d5b[_0x5597('0x2c')],'sectionId':_0x2e0d5b['id']},{})[_0x5597('0x27')](function(){return _0xc44e79;});}else{return _0xc44e79;}})[_0x5597('0x49')](function(_0xe54b52){logger[_0x5597('0x2a')](_0x5597('0x55'),_0xe54b52);throw _0xe54b52;});}return _0xc44e79;})[_0x5597('0x27')](respondWithResult(_0x27ba75,0xc9))[_0x5597('0x49')](handleError(_0x27ba75,null));};exports[_0x5597('0x56')]=function(_0x34e8f4,_0x720a56){if(_0x34e8f4['body']['id']){delete _0x34e8f4[_0x5597('0x4e')]['id'];}return db[_0x5597('0x2f')]['find']({'where':{'id':_0x34e8f4[_0x5597('0x4a')]['id']}})['then'](handleEntityNotFound(_0x720a56,null))[_0x5597('0x27')](saveUpdates(_0x34e8f4[_0x5597('0x4e')],null))['then'](respondWithResult(_0x720a56,null))[_0x5597('0x49')](handleError(_0x720a56,null));};exports['destroy']=function(_0x3c1740,_0x5a0c99){return db['SquareProject'][_0x5597('0x4c')]({'where':{'id':_0x3c1740[_0x5597('0x4a')]['id']}})[_0x5597('0x27')](handleEntityNotFound(_0x5a0c99,null))[_0x5597('0x27')](removeEntity(_0x5a0c99,null))['catch'](handleError(_0x5a0c99,null));};exports[_0x5597('0x57')]=function(_0x545bff,_0x4954eb,_0xe4e5a8){return db[_0x5597('0x2f')][_0x5597('0x4c')]({'where':{'id':_0x545bff[_0x5597('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4954eb,null))[_0x5597('0x27')](function(_0x4375ae){if(_0x4375ae){return _0x4375ae[_0x5597('0x57')](_0x545bff['body'][_0x5597('0x58')],_[_0x5597('0x59')](_0x545bff[_0x5597('0x4e')],[_0x5597('0x58'),'id'])||{});}})[_0x5597('0x27')](respondWithResult(_0x4954eb,null))['catch'](handleError(_0x4954eb,null));};exports[_0x5597('0x5a')]=function(_0x4d660e,_0x1a2678,_0x2bce8d){return db[_0x5597('0x2f')]['find']({'where':{'id':_0x4d660e[_0x5597('0x4a')]['id']}})[_0x5597('0x27')](handleEntityNotFound(_0x1a2678,null))[_0x5597('0x27')](function(_0x1d5814){if(_0x1d5814){return _0x1d5814[_0x5597('0x5a')](_0x4d660e[_0x5597('0x34')]['ids'])[_0x5597('0x27')](function(){if(_[_0x5597('0x5b')](_0x4d660e[_0x5597('0x34')]['ids'])){for(var _0x44545a=0x0;_0x44545a<_0x4d660e[_0x5597('0x34')][_0x5597('0x58')]['length'];_0x44545a+=0x1){socket['emit'](_0x5597('0x5c'),{'UserId':Number(_0x4d660e[_0x5597('0x34')][_0x5597('0x58')][_0x44545a]),'SquareProjectId':Number(_0x4d660e['params']['id'])});}}else{socket[_0x5597('0x5d')](_0x5597('0x5c'),{'UserId':Number(_0x4d660e['query'][_0x5597('0x58')]),'SquareProjectId':Number(_0x4d660e[_0x5597('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x1a2678,null))[_0x5597('0x49')](handleError(_0x1a2678,null));};exports[_0x5597('0x5e')]=function(_0x3c1f45,_0x1ba416,_0x4a6a15){var _0xe049b8={};var _0x2a8295={};var _0x2c2783;var _0x43df33;return db[_0x5597('0x2f')][_0x5597('0x5f')]({'where':{'id':_0x3c1f45[_0x5597('0x4a')]['id']}})[_0x5597('0x27')](handleEntityNotFound(_0x1ba416,null))[_0x5597('0x27')](function(_0x1cd8bd){if(_0x1cd8bd){_0x2c2783=_0x1cd8bd;_0x2a8295['model']=_['keys'](db['User'][_0x5597('0x30')]);_0x2a8295[_0x5597('0x34')]=_[_0x5597('0x35')](_0x3c1f45['query']);_0x2a8295[_0x5597('0x3f')]=_[_0x5597('0x36')](_0x2a8295[_0x5597('0x33')],_0x2a8295[_0x5597('0x34')]);_0xe049b8[_0x5597('0x37')]=_[_0x5597('0x36')](_0x2a8295['model'],qs[_0x5597('0x38')](_0x3c1f45[_0x5597('0x34')][_0x5597('0x38')]));_0xe049b8[_0x5597('0x37')]=_0xe049b8[_0x5597('0x37')][_0x5597('0x39')]?_0xe049b8[_0x5597('0x37')]:_0x2a8295[_0x5597('0x33')];_0xe049b8[_0x5597('0x3c')]=qs[_0x5597('0x3d')](_0x3c1f45[_0x5597('0x34')][_0x5597('0x3d')]);_0xe049b8[_0x5597('0x3e')]=qs[_0x5597('0x3f')](_[_0x5597('0x60')](_0x3c1f45['query'],_0x2a8295['filters']));if(_0x3c1f45['query'][_0x5597('0x43')]){_0xe049b8['where']=_['merge'](_0xe049b8[_0x5597('0x3e')],{'$or':_['map'](_0xe049b8['attributes'],function(_0x3a2c38){var _0xbb9cd8={};_0xbb9cd8[_0x3a2c38]={'$like':'%'+_0x3c1f45['query'][_0x5597('0x43')]+'%'};return _0xbb9cd8;})});}_0xe049b8=_[_0x5597('0x40')]({},_0xe049b8,_0x3c1f45[_0x5597('0x44')]);return _0x2c2783[_0x5597('0x5e')](_0xe049b8);}})[_0x5597('0x27')](function(_0x41f49c){if(_0x41f49c){_0x43df33=_0x41f49c[_0x5597('0x39')];if(!_0x3c1f45[_0x5597('0x34')][_0x5597('0x3a')](_0x5597('0x3b'))){_0xe049b8[_0x5597('0x21')]=qs['limit'](_0x3c1f45[_0x5597('0x34')][_0x5597('0x21')]);_0xe049b8[_0x5597('0x20')]=qs[_0x5597('0x20')](_0x3c1f45[_0x5597('0x34')][_0x5597('0x20')]);}return _0x2c2783[_0x5597('0x5e')](_0xe049b8);}})[_0x5597('0x27')](function(_0xfa23ff){if(_0xfa23ff){return _0xfa23ff?{'count':_0x43df33,'rows':_0xfa23ff}:null;}})[_0x5597('0x27')](respondWithResult(_0x1ba416,null))[_0x5597('0x49')](handleError(_0x1ba416,null));}; \ No newline at end of file +var _0x3b52=['util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./squareProject.socket','register','sendStatus','status','end','json','offset','limit','Content-Range','apply','update','then','get','SquareProjects','UserProfileResource','destroy','stack','name','send','SquareProject','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','filtears','include','create','body','user','role','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','pick','hasOwnProperty','html-pdf','eml-format','request-promise','moment','bluebird','mustache'];(function(_0xe13abc,_0x50e0d2){var _0x2a1f6c=function(_0x329f09){while(--_0x329f09){_0xe13abc['push'](_0xe13abc['shift']());}};_0x2a1f6c(++_0x50e0d2);}(_0x3b52,0x182));var _0x23b5=function(_0x3e63e2,_0x3b6f2c){_0x3e63e2=_0x3e63e2-0x0;var _0x56263c=_0x3b52[_0x3e63e2];return _0x56263c;};'use strict';var pdf=require(_0x23b5('0x0'));var emlformat=require(_0x23b5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x23b5('0x2'));var moment=require(_0x23b5('0x3'));var BPromise=require(_0x23b5('0x4'));var Mustache=require(_0x23b5('0x5'));var util=require(_0x23b5('0x6'));var path=require(_0x23b5('0x7'));var sox=require(_0x23b5('0x8'));var csv=require('to-csv');var ejs=require(_0x23b5('0x9'));var fs=require('fs');var _=require(_0x23b5('0xa'));var squel=require(_0x23b5('0xb'));var crypto=require(_0x23b5('0xc'));var jsforce=require(_0x23b5('0xd'));var deskjs=require(_0x23b5('0xe'));var toCsv=require(_0x23b5('0xf'));var querystring=require(_0x23b5('0x10'));var Papa=require(_0x23b5('0x11'));var Redis=require(_0x23b5('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x23b5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x23b5('0x14'))(_0x23b5('0x15'));var utils=require('../../config/utils');var config=require(_0x23b5('0x16'));var licenseUtil=require(_0x23b5('0x17'));var db=require(_0x23b5('0x18'))['db'];config['redis']=_[_0x23b5('0x19')](config['redis'],{'host':_0x23b5('0x1a'),'port':0x18eb});var socket=require(_0x23b5('0x1b'))(new Redis(config[_0x23b5('0x1c')]));require(_0x23b5('0x1d'))[_0x23b5('0x1e')](socket);function respondWithStatusCode(_0x1b017b,_0x5c7ecb){_0x5c7ecb=_0x5c7ecb||0xcc;return function(_0x16fd29){if(_0x16fd29){return _0x1b017b[_0x23b5('0x1f')](_0x5c7ecb);}return _0x1b017b[_0x23b5('0x20')](_0x5c7ecb)[_0x23b5('0x21')]();};}function respondWithResult(_0xe629d3,_0x5014cf){_0x5014cf=_0x5014cf||0xc8;return function(_0x3db60c){if(_0x3db60c){return _0xe629d3['status'](_0x5014cf)[_0x23b5('0x22')](_0x3db60c);}};}function respondWithFilteredResult(_0xa19214,_0x3644fa){return function(_0x587564){if(_0x587564){var _0x3324b3=_0x587564['count'],_0x4d4162=_0x3644fa['offset'],_0x117eca=_0x3644fa[_0x23b5('0x23')]+_0x3644fa[_0x23b5('0x24')],_0x22be6c;if(_0x117eca>=_0x3324b3){_0x117eca=_0x3324b3;_0x22be6c=0xc8;}else{_0x22be6c=0xce;}_0xa19214['status'](_0x22be6c);return _0xa19214['set'](_0x23b5('0x25'),_0x4d4162+'-'+_0x117eca+'/'+_0x3324b3)[_0x23b5('0x22')](_0x587564);}return null;};}function patchUpdates(_0x482dca){return function(_0x249ff9){try{jsonpatch[_0x23b5('0x26')](_0x249ff9,_0x482dca,!![]);}catch(_0x4a0f01){return BPromise['reject'](_0x4a0f01);}return _0x249ff9['save']();};}function saveUpdates(_0x1b1957,_0x1da19f){return function(_0x9455f){if(_0x9455f){return _0x9455f[_0x23b5('0x27')](_0x1b1957)[_0x23b5('0x28')](function(_0x38be99){return _0x38be99;});}return null;};}function removeEntity(_0x174ea2,_0x44d687){return function(_0x35f5cc){if(_0x35f5cc){return _0x35f5cc['destroy']()[_0x23b5('0x28')](function(){var _0x34eb75=_0x35f5cc[_0x23b5('0x29')]({'plain':!![]});var _0x48e28d=_0x23b5('0x2a');return db[_0x23b5('0x2b')][_0x23b5('0x2c')]({'where':{'type':_0x48e28d,'resourceId':_0x34eb75['id']}})[_0x23b5('0x28')](function(){return _0x35f5cc;});})[_0x23b5('0x28')](function(){_0x174ea2['status'](0xcc)[_0x23b5('0x21')]();});}};}function handleEntityNotFound(_0x4b721e,_0x23d564){return function(_0x3ca434){if(!_0x3ca434){_0x4b721e[_0x23b5('0x1f')](0x194);}return _0x3ca434;};}function handleError(_0x139399,_0x3d93d4){_0x3d93d4=_0x3d93d4||0x1f4;return function(_0x434f9d){logger['error'](_0x434f9d[_0x23b5('0x2d')]);if(_0x434f9d[_0x23b5('0x2e')]){delete _0x434f9d[_0x23b5('0x2e')];}_0x139399[_0x23b5('0x20')](_0x3d93d4)[_0x23b5('0x2f')](_0x434f9d);};}exports['index']=function(_0x131d88,_0x1c7e2b){var _0x2ead91={},_0xcbc7e5={},_0x5102a2={'count':0x0,'rows':[]};var _0x5638e4=_['map'](db[_0x23b5('0x30')][_0x23b5('0x31')],function(_0x191bcc){return{'name':_0x191bcc[_0x23b5('0x32')],'type':_0x191bcc[_0x23b5('0x33')][_0x23b5('0x34')]};});_0xcbc7e5[_0x23b5('0x35')]=_[_0x23b5('0x36')](_0x5638e4,_0x23b5('0x2e'));_0xcbc7e5['query']=_[_0x23b5('0x37')](_0x131d88[_0x23b5('0x38')]);_0xcbc7e5[_0x23b5('0x39')]=_[_0x23b5('0x3a')](_0xcbc7e5[_0x23b5('0x35')],_0xcbc7e5['query']);_0x2ead91[_0x23b5('0x3b')]=_['intersection'](_0xcbc7e5[_0x23b5('0x35')],qs[_0x23b5('0x3c')](_0x131d88[_0x23b5('0x38')]['fields']));_0x2ead91[_0x23b5('0x3b')]=_0x2ead91[_0x23b5('0x3b')][_0x23b5('0x3d')]?_0x2ead91[_0x23b5('0x3b')]:_0xcbc7e5[_0x23b5('0x35')];if(!_0x131d88[_0x23b5('0x38')]['hasOwnProperty'](_0x23b5('0x3e'))){_0x2ead91[_0x23b5('0x24')]=qs['limit'](_0x131d88['query']['limit']);_0x2ead91[_0x23b5('0x23')]=qs[_0x23b5('0x23')](_0x131d88['query'][_0x23b5('0x23')]);}_0x2ead91[_0x23b5('0x3f')]=qs[_0x23b5('0x40')](_0x131d88['query']['sort']);_0x2ead91[_0x23b5('0x41')]=qs['filters'](_['pick'](_0x131d88[_0x23b5('0x38')],_0xcbc7e5[_0x23b5('0x39')]),_0x5638e4);if(_0x131d88['query'][_0x23b5('0x42')]){_0x2ead91[_0x23b5('0x41')]=_[_0x23b5('0x43')](_0x2ead91[_0x23b5('0x41')],{'$or':_[_0x23b5('0x36')](_0x5638e4,function(_0xa08fc0){if(_0xa08fc0[_0x23b5('0x33')]!==_0x23b5('0x44')){var _0x3cd4d8={};_0x3cd4d8[_0xa08fc0['name']]={'$like':'%'+_0x131d88['query'][_0x23b5('0x42')]+'%'};return _0x3cd4d8;}})});}_0x2ead91=_['merge']({},_0x2ead91,_0x131d88[_0x23b5('0x45')]);var _0x1b57d5={'where':_0x2ead91['where']};return db[_0x23b5('0x30')][_0x23b5('0x46')](_0x1b57d5)['then'](function(_0x396d39){_0x5102a2[_0x23b5('0x46')]=_0x396d39;if(_0x131d88[_0x23b5('0x38')][_0x23b5('0x47')]){_0x2ead91['include']=[{'all':!![]}];}return db[_0x23b5('0x30')][_0x23b5('0x48')](_0x2ead91);})[_0x23b5('0x28')](function(_0x24b023){_0x5102a2[_0x23b5('0x49')]=_0x24b023;return _0x5102a2;})[_0x23b5('0x28')](respondWithFilteredResult(_0x1c7e2b,_0x2ead91))[_0x23b5('0x4a')](handleError(_0x1c7e2b,null));};exports['show']=function(_0x57247a,_0x2dd6a2){var _0x477d33={'raw':![],'where':{'id':_0x57247a['params']['id']}},_0x261332={};_0x261332[_0x23b5('0x35')]=_['keys'](db[_0x23b5('0x30')][_0x23b5('0x31')]);_0x261332['query']=_[_0x23b5('0x37')](_0x57247a[_0x23b5('0x38')]);_0x261332[_0x23b5('0x4b')]=_[_0x23b5('0x3a')](_0x261332[_0x23b5('0x35')],_0x261332[_0x23b5('0x38')]);_0x477d33['attributes']=_['intersection'](_0x261332['model'],qs['fields'](_0x57247a[_0x23b5('0x38')][_0x23b5('0x3c')]));_0x477d33['attributes']=_0x477d33[_0x23b5('0x3b')][_0x23b5('0x3d')]?_0x477d33[_0x23b5('0x3b')]:_0x261332[_0x23b5('0x35')];if(_0x57247a[_0x23b5('0x38')]['includeAll']){_0x477d33[_0x23b5('0x4c')]=[{'all':!![]}];}_0x477d33=_[_0x23b5('0x43')]({},_0x477d33,_0x57247a[_0x23b5('0x45')]);return db[_0x23b5('0x30')]['find'](_0x477d33)['then'](handleEntityNotFound(_0x2dd6a2,null))[_0x23b5('0x28')](respondWithResult(_0x2dd6a2,null))[_0x23b5('0x4a')](handleError(_0x2dd6a2,null));};exports[_0x23b5('0x4d')]=function(_0x36ed34,_0x95298e){return db[_0x23b5('0x30')][_0x23b5('0x4d')](_0x36ed34[_0x23b5('0x4e')],{})[_0x23b5('0x28')](function(_0x3aa9df){var _0x1d77b7=_0x36ed34[_0x23b5('0x4f')][_0x23b5('0x29')]({'plain':!![]});if(!_0x1d77b7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d77b7[_0x23b5('0x50')]===_0x23b5('0x4f')){var _0x4616c9=_0x3aa9df[_0x23b5('0x29')]({'plain':!![]});var _0x1ea165=_0x23b5('0x2a');return db[_0x23b5('0x51')][_0x23b5('0x52')]({'where':{'name':_0x1ea165,'userProfileId':_0x1d77b7[_0x23b5('0x53')]},'raw':!![]})[_0x23b5('0x28')](function(_0x10347d){if(_0x10347d&&_0x10347d['autoAssociation']===0x0){return db[_0x23b5('0x2b')][_0x23b5('0x4d')]({'name':_0x4616c9[_0x23b5('0x2e')],'resourceId':_0x4616c9['id'],'type':_0x10347d[_0x23b5('0x2e')],'sectionId':_0x10347d['id']},{})[_0x23b5('0x28')](function(){return _0x3aa9df;});}else{return _0x3aa9df;}})['catch'](function(_0x16ac32){logger[_0x23b5('0x54')](_0x23b5('0x55'),_0x16ac32);throw _0x16ac32;});}return _0x3aa9df;})[_0x23b5('0x28')](respondWithResult(_0x95298e,0xc9))[_0x23b5('0x4a')](handleError(_0x95298e,null));};exports[_0x23b5('0x27')]=function(_0x9f0334,_0xcef93a){if(_0x9f0334[_0x23b5('0x4e')]['id']){delete _0x9f0334[_0x23b5('0x4e')]['id'];}return db[_0x23b5('0x30')][_0x23b5('0x52')]({'where':{'id':_0x9f0334[_0x23b5('0x56')]['id']}})[_0x23b5('0x28')](handleEntityNotFound(_0xcef93a,null))['then'](saveUpdates(_0x9f0334['body'],null))[_0x23b5('0x28')](respondWithResult(_0xcef93a,null))[_0x23b5('0x4a')](handleError(_0xcef93a,null));};exports[_0x23b5('0x2c')]=function(_0x4135f3,_0x34076a){return db[_0x23b5('0x30')][_0x23b5('0x52')]({'where':{'id':_0x4135f3[_0x23b5('0x56')]['id']}})['then'](handleEntityNotFound(_0x34076a,null))['then'](removeEntity(_0x34076a,null))['catch'](handleError(_0x34076a,null));};exports[_0x23b5('0x57')]=function(_0x3b5214,_0x391b6b,_0x2ee13f){return db[_0x23b5('0x30')][_0x23b5('0x52')]({'where':{'id':_0x3b5214[_0x23b5('0x56')]['id']}})['then'](handleEntityNotFound(_0x391b6b,null))['then'](function(_0x3c961b){if(_0x3c961b){return _0x3c961b[_0x23b5('0x57')](_0x3b5214[_0x23b5('0x4e')][_0x23b5('0x58')],_[_0x23b5('0x59')](_0x3b5214[_0x23b5('0x4e')],[_0x23b5('0x58'),'id'])||{});}})[_0x23b5('0x28')](respondWithResult(_0x391b6b,null))['catch'](handleError(_0x391b6b,null));};exports[_0x23b5('0x5a')]=function(_0x38a0d3,_0x3414d4,_0x59a4dd){return db[_0x23b5('0x30')][_0x23b5('0x52')]({'where':{'id':_0x38a0d3[_0x23b5('0x56')]['id']}})['then'](handleEntityNotFound(_0x3414d4,null))[_0x23b5('0x28')](function(_0x3c18db){if(_0x3c18db){return _0x3c18db[_0x23b5('0x5a')](_0x38a0d3[_0x23b5('0x38')][_0x23b5('0x58')])['then'](function(){if(_[_0x23b5('0x5b')](_0x38a0d3['query'][_0x23b5('0x58')])){for(var _0x586f94=0x0;_0x586f94<_0x38a0d3[_0x23b5('0x38')][_0x23b5('0x58')][_0x23b5('0x3d')];_0x586f94+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x38a0d3[_0x23b5('0x38')][_0x23b5('0x58')][_0x586f94]),'SquareProjectId':Number(_0x38a0d3[_0x23b5('0x56')]['id'])});}}else{socket[_0x23b5('0x5c')](_0x23b5('0x5d'),{'UserId':Number(_0x38a0d3[_0x23b5('0x38')][_0x23b5('0x58')]),'SquareProjectId':Number(_0x38a0d3[_0x23b5('0x56')]['id'])});}});}})[_0x23b5('0x28')](respondWithStatusCode(_0x3414d4,null))['catch'](handleError(_0x3414d4,null));};exports['getUsers']=function(_0x27dbe4,_0x5bb75a,_0x4345cf){var _0x558a28={};var _0x533e10={};var _0x5acb70;var _0x16c8ed;return db['SquareProject'][_0x23b5('0x5e')]({'where':{'id':_0x27dbe4[_0x23b5('0x56')]['id']}})[_0x23b5('0x28')](handleEntityNotFound(_0x5bb75a,null))['then'](function(_0x303f7e){if(_0x303f7e){_0x5acb70=_0x303f7e;_0x533e10[_0x23b5('0x35')]=_[_0x23b5('0x37')](db[_0x23b5('0x5f')][_0x23b5('0x31')]);_0x533e10[_0x23b5('0x38')]=_[_0x23b5('0x37')](_0x27dbe4[_0x23b5('0x38')]);_0x533e10[_0x23b5('0x39')]=_[_0x23b5('0x3a')](_0x533e10[_0x23b5('0x35')],_0x533e10[_0x23b5('0x38')]);_0x558a28[_0x23b5('0x3b')]=_[_0x23b5('0x3a')](_0x533e10[_0x23b5('0x35')],qs[_0x23b5('0x3c')](_0x27dbe4['query']['fields']));_0x558a28['attributes']=_0x558a28[_0x23b5('0x3b')][_0x23b5('0x3d')]?_0x558a28['attributes']:_0x533e10[_0x23b5('0x35')];_0x558a28[_0x23b5('0x3f')]=qs[_0x23b5('0x40')](_0x27dbe4[_0x23b5('0x38')]['sort']);_0x558a28[_0x23b5('0x41')]=qs[_0x23b5('0x39')](_[_0x23b5('0x60')](_0x27dbe4[_0x23b5('0x38')],_0x533e10[_0x23b5('0x39')]));if(_0x27dbe4[_0x23b5('0x38')][_0x23b5('0x42')]){_0x558a28['where']=_['merge'](_0x558a28['where'],{'$or':_['map'](_0x558a28[_0x23b5('0x3b')],function(_0x1a90ff){var _0x26ac4c={};_0x26ac4c[_0x1a90ff]={'$like':'%'+_0x27dbe4[_0x23b5('0x38')][_0x23b5('0x42')]+'%'};return _0x26ac4c;})});}_0x558a28=_[_0x23b5('0x43')]({},_0x558a28,_0x27dbe4[_0x23b5('0x45')]);return _0x5acb70['getUsers'](_0x558a28);}})['then'](function(_0x394080){if(_0x394080){_0x16c8ed=_0x394080[_0x23b5('0x3d')];if(!_0x27dbe4[_0x23b5('0x38')][_0x23b5('0x61')](_0x23b5('0x3e'))){_0x558a28['limit']=qs[_0x23b5('0x24')](_0x27dbe4[_0x23b5('0x38')][_0x23b5('0x24')]);_0x558a28[_0x23b5('0x23')]=qs['offset'](_0x27dbe4[_0x23b5('0x38')][_0x23b5('0x23')]);}return _0x5acb70['getUsers'](_0x558a28);}})[_0x23b5('0x28')](function(_0x260783){if(_0x260783){return _0x260783?{'count':_0x16c8ed,'rows':_0x260783}:null;}})[_0x23b5('0x28')](respondWithResult(_0x5bb75a,null))[_0x23b5('0x4a')](handleError(_0x5bb75a,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 0477f28..de3d563 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 _0xea0e=['hasOwnProperty','exports','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x9d9f51,_0x4831d7){var _0x1585e7=function(_0x19f59c){while(--_0x19f59c){_0x9d9f51['push'](_0x9d9f51['shift']());}};_0x1585e7(++_0x4831d7);}(_0xea0e,0xa2));var _0xeea0=function(_0x2fe9f6,_0x4ad382){_0x2fe9f6=_0x2fe9f6-0x0;var _0x58a5e3=_0xea0e[_0x2fe9f6];return _0x58a5e3;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0xeea0('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xeea0('0x1')](0x0);var events={'afterCreate':_0xeea0('0x2'),'afterUpdate':_0xeea0('0x3'),'afterDestroy':_0xeea0('0x4')};function emitEvent(_0x5d2620){return function(_0x1da76a,_0x489db0,_0xcbb66a){SquareProjectEvents['emit'](_0x5d2620+':'+_0x1da76a['id'],_0x1da76a);SquareProjectEvents[_0xeea0('0x5')](_0x5d2620,_0x1da76a);_0xcbb66a(null);};}for(var e in events){if(events[_0xeea0('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xeea0('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x6c42=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x487ab4,_0x1e24e8){var _0x3bef77=function(_0x5ce664){while(--_0x5ce664){_0x487ab4['push'](_0x487ab4['shift']());}};_0x3bef77(++_0x1e24e8);}(_0x6c42,0xd0));var _0x26c4=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x6c42[_0x37c22c];return _0x119d79;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x26c4('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x26c4('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x26c4('0x2'),'afterDestroy':'remove'};function emitEvent(_0x202378){return function(_0x5e6766,_0x1689bd,_0x4c2991){SquareProjectEvents[_0x26c4('0x3')](_0x202378+':'+_0x5e6766['id'],_0x5e6766);SquareProjectEvents[_0x26c4('0x3')](_0x202378,_0x5e6766);_0x4c2991(null);};}for(var e in events){if(events[_0x26c4('0x4')](e)){var event=events[e];SquareProject[_0x26c4('0x5')](e,emitEvent(event));}}module[_0x26c4('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 5c9e115..d0778fb 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 _0x09c5=['path','rimraf','../../config/environment','exports','define','SquareProject','square_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x229f5e,_0x433f0f){var _0x2d62ff=function(_0xe4d381){while(--_0xe4d381){_0x229f5e['push'](_0x229f5e['shift']());}};_0x2d62ff(++_0x433f0f);}(_0x09c5,0x13b));var _0x509c=function(_0x88f8ca,_0x1e419a){_0x88f8ca=_0x88f8ca-0x0;var _0x46f4b1=_0x09c5[_0x88f8ca];return _0x46f4b1;};'use strict';var _=require(_0x509c('0x0'));var util=require(_0x509c('0x1'));var logger=require(_0x509c('0x2'))(_0x509c('0x3'));var moment=require(_0x509c('0x4'));var BPromise=require(_0x509c('0x5'));var rp=require(_0x509c('0x6'));var fs=require('fs');var path=require(_0x509c('0x7'));var rimraf=require(_0x509c('0x8'));var config=require(_0x509c('0x9'));var attributes=require('./squareProject.attributes');module[_0x509c('0xa')]=function(_0x4a33cd,_0x4ebc2f){return _0x4a33cd[_0x509c('0xb')](_0x509c('0xc'),attributes,{'tableName':_0x509c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3754=['./squareProject.attributes','exports','define','SquareProject','square_projects','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0x3754,0x139));var _0x4375=function(_0x48e7ba,_0x120483){_0x48e7ba=_0x48e7ba-0x0;var _0x50a06c=_0x3754[_0x48e7ba];return _0x50a06c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4375('0x0'))('api');var moment=require(_0x4375('0x1'));var BPromise=require(_0x4375('0x2'));var rp=require(_0x4375('0x3'));var fs=require('fs');var path=require(_0x4375('0x4'));var rimraf=require('rimraf');var config=require(_0x4375('0x5'));var attributes=require(_0x4375('0x6'));module[_0x4375('0x7')]=function(_0x381731,_0x44ca92){return _0x381731[_0x4375('0x8')](_0x4375('0x9'),attributes,{'tableName':_0x4375('0xa'),'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 a63d53c..db160da 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 _0x2f79=['localhost','socket.io-emitter','./squareProject.socket','request','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','SquareProject,\x20%s,\x20%s','message','info','result','catch','ShowSquareProject','find','options','where','include','map','model','attributes','then','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x40d3c1,_0x1fc6b0){var _0x4a1831=function(_0x54d37e){while(--_0x54d37e){_0x40d3c1['push'](_0x40d3c1['shift']());}};_0x4a1831(++_0x1fc6b0);}(_0x2f79,0x15b));var _0x92f7=function(_0x4d1683,_0x34796e){_0x4d1683=_0x4d1683-0x0;var _0x35327d=_0x2f79[_0x4d1683];return _0x35327d;};'use strict';var _=require(_0x92f7('0x0'));var util=require('util');var moment=require(_0x92f7('0x1'));var BPromise=require('bluebird');var rs=require(_0x92f7('0x2'));var fs=require('fs');var Redis=require(_0x92f7('0x3'));var db=require(_0x92f7('0x4'))['db'];var utils=require(_0x92f7('0x5'));var logger=require(_0x92f7('0x6'))(_0x92f7('0x7'));var config=require(_0x92f7('0x8'));var jayson=require(_0x92f7('0x9'));var client=jayson[_0x92f7('0xa')]['http']({'port':0x232a});config[_0x92f7('0xb')]=_[_0x92f7('0xc')](config[_0x92f7('0xb')],{'host':_0x92f7('0xd'),'port':0x18eb});var socket=require(_0x92f7('0xe'))(new Redis(config[_0x92f7('0xb')]));require(_0x92f7('0xf'))['register'](socket);function respondWithRpcPromise(_0x29dc06,_0x175c79,_0x4529a6){return new BPromise(function(_0x5f4a00,_0x159973){return client[_0x92f7('0x10')](_0x29dc06,_0x4529a6)['then'](function(_0x286063){logger['info']('SquareProject,\x20%s,\x20%s',_0x175c79,_0x92f7('0x11'));logger[_0x92f7('0x12')](_0x92f7('0x13'),_0x175c79,_0x92f7('0x11'),JSON[_0x92f7('0x14')](_0x286063));if(_0x286063[_0x92f7('0x15')]){if(_0x286063[_0x92f7('0x15')]['code']===0x1f4){logger['error'](_0x92f7('0x16'),_0x175c79,_0x286063[_0x92f7('0x15')]['message']);return _0x159973(_0x286063['error'][_0x92f7('0x17')]);}logger[_0x92f7('0x15')](_0x92f7('0x16'),_0x175c79,_0x286063['error'][_0x92f7('0x17')]);return _0x5f4a00(_0x286063[_0x92f7('0x15')]['message']);}else{logger[_0x92f7('0x18')](_0x92f7('0x16'),_0x175c79,'request\x20sent');_0x5f4a00(_0x286063[_0x92f7('0x19')][_0x92f7('0x17')]);}})[_0x92f7('0x1a')](function(_0x334e14){logger[_0x92f7('0x15')](_0x92f7('0x16'),_0x175c79,_0x334e14);_0x159973(_0x334e14);});});}exports[_0x92f7('0x1b')]=function(_0x331ed8){var _0x42ef45=this;return new Promise(function(_0x3b1885,_0x2f35dd){return db['SquareProject'][_0x92f7('0x1c')]({'raw':_0x331ed8[_0x92f7('0x1d')]?_0x331ed8['options']['raw']===undefined?!![]:![]:!![],'where':_0x331ed8['options']?_0x331ed8[_0x92f7('0x1d')][_0x92f7('0x1e')]||null:null,'attributes':_0x331ed8['options']?_0x331ed8['options']['attributes']||null:null,'include':_0x331ed8[_0x92f7('0x1d')]?_0x331ed8['options'][_0x92f7('0x1f')]?_[_0x92f7('0x20')](_0x331ed8[_0x92f7('0x1d')][_0x92f7('0x1f')],function(_0x27a070){return{'model':db[_0x27a070[_0x92f7('0x21')]],'as':_0x27a070['as'],'attributes':_0x27a070[_0x92f7('0x22')],'include':_0x27a070['include']?_[_0x92f7('0x20')](_0x27a070[_0x92f7('0x1f')],function(_0x159cf3){return{'model':db[_0x159cf3[_0x92f7('0x21')]],'as':_0x159cf3['as'],'attributes':_0x159cf3['attributes'],'include':_0x159cf3[_0x92f7('0x1f')]?_[_0x92f7('0x20')](_0x159cf3[_0x92f7('0x1f')],function(_0x14bff1){return{'model':db[_0x14bff1['model']],'as':_0x14bff1['as'],'attributes':_0x14bff1[_0x92f7('0x22')]};}):[]};}):[]};}):[]:[]})[_0x92f7('0x23')](function(_0x7b96e7){logger[_0x92f7('0x18')](_0x92f7('0x1b'),_0x331ed8);logger['debug'](_0x92f7('0x1b'),_0x331ed8,JSON[_0x92f7('0x14')](_0x7b96e7));_0x3b1885(_0x7b96e7);})[_0x92f7('0x1a')](function(_0x8dfe96){logger[_0x92f7('0x15')]('ShowSquareProject',_0x8dfe96['message'],_0x331ed8);_0x2f35dd(_0x42ef45[_0x92f7('0x15')](0x1f4,_0x8dfe96['message']));});});}; \ No newline at end of file +var _0xf064=['raw','options','where','attributes','include','model','map','stringify','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./squareProject.socket','register','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','ShowSquareProject','SquareProject'];(function(_0x5ce900,_0x1f35db){var _0x51f4f1=function(_0x3bca21){while(--_0x3bca21){_0x5ce900['push'](_0x5ce900['shift']());}};_0x51f4f1(++_0x1f35db);}(_0xf064,0x118));var _0x4f06=function(_0x5d6c3e,_0x409a3e){_0x5d6c3e=_0x5d6c3e-0x0;var _0x44ecb7=_0xf064[_0x5d6c3e];return _0x44ecb7;};'use strict';var _=require(_0x4f06('0x0'));var util=require('util');var moment=require(_0x4f06('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f06('0x2'));var db=require(_0x4f06('0x3'))['db'];var utils=require(_0x4f06('0x4'));var logger=require(_0x4f06('0x5'))(_0x4f06('0x6'));var config=require('../../config/environment');var jayson=require(_0x4f06('0x7'));var client=jayson[_0x4f06('0x8')][_0x4f06('0x9')]({'port':0x232a});config[_0x4f06('0xa')]=_[_0x4f06('0xb')](config[_0x4f06('0xa')],{'host':_0x4f06('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f06('0xa')]));require(_0x4f06('0xd'))[_0x4f06('0xe')](socket);function respondWithRpcPromise(_0x45b04b,_0x46fd2a,_0x24814b){return new BPromise(function(_0x1818f2,_0x5b9da7){return client['request'](_0x45b04b,_0x24814b)['then'](function(_0x3eeb64){logger['info'](_0x4f06('0xf'),_0x46fd2a,_0x4f06('0x10'));logger[_0x4f06('0x11')](_0x4f06('0x12'),_0x46fd2a,_0x4f06('0x10'),JSON['stringify'](_0x3eeb64));if(_0x3eeb64['error']){if(_0x3eeb64['error']['code']===0x1f4){logger['error'](_0x4f06('0xf'),_0x46fd2a,_0x3eeb64[_0x4f06('0x13')][_0x4f06('0x14')]);return _0x5b9da7(_0x3eeb64[_0x4f06('0x13')][_0x4f06('0x14')]);}logger[_0x4f06('0x13')](_0x4f06('0xf'),_0x46fd2a,_0x3eeb64[_0x4f06('0x13')][_0x4f06('0x14')]);return _0x1818f2(_0x3eeb64['error']['message']);}else{logger[_0x4f06('0x15')]('SquareProject,\x20%s,\x20%s',_0x46fd2a,'request\x20sent');_0x1818f2(_0x3eeb64[_0x4f06('0x16')]['message']);}})[_0x4f06('0x17')](function(_0xb9cc95){logger['error'](_0x4f06('0xf'),_0x46fd2a,_0xb9cc95);_0x5b9da7(_0xb9cc95);});});}exports[_0x4f06('0x18')]=function(_0x480468){var _0xdcfa62=this;return new Promise(function(_0x4811b9,_0x45fbeb){return db[_0x4f06('0x19')]['find']({'raw':_0x480468['options']?_0x480468['options'][_0x4f06('0x1a')]===undefined?!![]:![]:!![],'where':_0x480468[_0x4f06('0x1b')]?_0x480468[_0x4f06('0x1b')][_0x4f06('0x1c')]||null:null,'attributes':_0x480468[_0x4f06('0x1b')]?_0x480468['options'][_0x4f06('0x1d')]||null:null,'include':_0x480468[_0x4f06('0x1b')]?_0x480468['options']['include']?_['map'](_0x480468[_0x4f06('0x1b')][_0x4f06('0x1e')],function(_0x4fbbfc){return{'model':db[_0x4fbbfc[_0x4f06('0x1f')]],'as':_0x4fbbfc['as'],'attributes':_0x4fbbfc[_0x4f06('0x1d')],'include':_0x4fbbfc['include']?_[_0x4f06('0x20')](_0x4fbbfc[_0x4f06('0x1e')],function(_0x225ca6){return{'model':db[_0x225ca6[_0x4f06('0x1f')]],'as':_0x225ca6['as'],'attributes':_0x225ca6[_0x4f06('0x1d')],'include':_0x225ca6[_0x4f06('0x1e')]?_['map'](_0x225ca6[_0x4f06('0x1e')],function(_0x41a33a){return{'model':db[_0x41a33a[_0x4f06('0x1f')]],'as':_0x41a33a['as'],'attributes':_0x41a33a[_0x4f06('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x361db0){logger[_0x4f06('0x15')](_0x4f06('0x18'),_0x480468);logger[_0x4f06('0x11')](_0x4f06('0x18'),_0x480468,JSON[_0x4f06('0x21')](_0x361db0));_0x4811b9(_0x361db0);})[_0x4f06('0x17')](function(_0x42ba95){logger[_0x4f06('0x13')]('ShowSquareProject',_0x42ba95['message'],_0x480468);_0x45fbeb(_0xdcfa62[_0x4f06('0x13')](0x1f4,_0x42ba95[_0x4f06('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 1276792..cf631dd 100644 --- a/server/api/squareProject/squareProject.socket.js +++ b/server/api/squareProject/squareProject.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1623=['removeListener','length','squareProject:','./squareProject.events','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1623,0xab));var _0x3162=function(_0xdd2e2f,_0x18b79a){_0xdd2e2f=_0xdd2e2f-0x0;var _0xc1ab16=_0x1623[_0xdd2e2f];return _0xc1ab16;};'use strict';var SquareProjectEvents=require(_0x3162('0x0'));var events=['save','remove',_0x3162('0x1')];function createListener(_0x27ee21,_0x36ccc3){return function(_0x2cc4d7){_0x36ccc3[_0x3162('0x2')](_0x27ee21,_0x2cc4d7);};}function removeListener(_0x4ce2bd,_0x5d49d0){return function(){SquareProjectEvents[_0x3162('0x3')](_0x4ce2bd,_0x5d49d0);};}exports['register']=function(_0x1b55f2){for(var _0x428de6=0x0,_0x53260d=events[_0x3162('0x4')];_0x428de6<_0x53260d;_0x428de6++){var _0x2dc07e=events[_0x428de6];var _0x26ee32=createListener(_0x3162('0x5')+_0x2dc07e,_0x1b55f2);SquareProjectEvents['on'](_0x2dc07e,_0x26ee32);}}; \ No newline at end of file +var _0xc1c6=['length','squareProject:','./squareProject.events','save','remove','emit','register'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x286536,_0x383dd4){_0x286536=_0x286536-0x0;var _0x11df27=_0xc1c6[_0x286536];return _0x11df27;};'use strict';var SquareProjectEvents=require(_0x6c1c('0x0'));var events=[_0x6c1c('0x1'),_0x6c1c('0x2'),'update'];function createListener(_0x114c93,_0x4c33ca){return function(_0x426398){_0x4c33ca[_0x6c1c('0x3')](_0x114c93,_0x426398);};}function removeListener(_0x265d2c,_0x59f799){return function(){SquareProjectEvents['removeListener'](_0x265d2c,_0x59f799);};}exports[_0x6c1c('0x4')]=function(_0x524a6b){for(var _0x50c1bb=0x0,_0x582bec=events[_0x6c1c('0x5')];_0x50c1bb<_0x582bec;_0x50c1bb++){var _0x2eb1ba=events[_0x50c1bb];var _0x38369d=createListener(_0x6c1c('0x6')+_0x2eb1ba,_0x524a6b);SquareProjectEvents['on'](_0x2eb1ba,_0x38369d);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index f0591df..c6e4296 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 _0xf47f=['destroy','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','put','update','delete','/:id/delete'];(function(_0x19babd,_0x1d4ef7){var _0x314eaf=function(_0x24ea35){while(--_0x24ea35){_0x19babd['push'](_0x19babd['shift']());}};_0x314eaf(++_0x1d4ef7);}(_0xf47f,0x191));var _0xff47=function(_0x1ca7a9,_0x230243){_0x1ca7a9=_0x1ca7a9-0x0;var _0x4804a4=_0xf47f[_0x1ca7a9];return _0x4804a4;};'use strict';var multer=require(_0xff47('0x0'));var util=require(_0xff47('0x1'));var path=require('path');var timeout=require(_0xff47('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xff47('0x3'));var interaction=require(_0xff47('0x4'));var config=require(_0xff47('0x5'));var controller=require(_0xff47('0x6'));router[_0xff47('0x7')]('/',auth[_0xff47('0x8')](),controller[_0xff47('0x9')]);router['get'](_0xff47('0xa'),auth['isAuthenticated'](),controller[_0xff47('0xb')]);router['get'](_0xff47('0xc'),auth['isAuthenticated'](),controller[_0xff47('0xd')]);router[_0xff47('0xe')]('/',auth[_0xff47('0x8')](),controller['create']);router[_0xff47('0xf')]('/:id',auth[_0xff47('0x8')](),controller[_0xff47('0x10')]);router[_0xff47('0x11')](_0xff47('0x12'),auth[_0xff47('0x8')](),controller[_0xff47('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0925=['delete','/:id/delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','put','update'];(function(_0x1d3956,_0x4100a7){var _0x390806=function(_0x43c218){while(--_0x43c218){_0x1d3956['push'](_0x1d3956['shift']());}};_0x390806(++_0x4100a7);}(_0x0925,0x8a));var _0x5092=function(_0x216586,_0x2e9346){_0x216586=_0x216586-0x0;var _0x2c0807=_0x0925[_0x216586];return _0x2c0807;};'use strict';var multer=require(_0x5092('0x0'));var util=require(_0x5092('0x1'));var path=require(_0x5092('0x2'));var timeout=require('connect-timeout');var express=require(_0x5092('0x3'));var router=express[_0x5092('0x4')]();var auth=require(_0x5092('0x5'));var interaction=require(_0x5092('0x6'));var config=require(_0x5092('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0x5092('0x8')](),controller['index']);router[_0x5092('0x9')](_0x5092('0xa'),auth['isAuthenticated'](),controller[_0x5092('0xb')]);router[_0x5092('0x9')]('/:id/download',auth[_0x5092('0x8')](),controller['download']);router[_0x5092('0xc')]('/',auth[_0x5092('0x8')](),controller['create']);router[_0x5092('0xd')](_0x5092('0xa'),auth['isAuthenticated'](),controller[_0x5092('0xe')]);router[_0x5092('0xf')](_0x5092('0x10'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 061a209..55b7865 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 _0x3de9=['savePath','substring','lastIndexOf','sequelize','STRING','getDataValue'];(function(_0x1e1639,_0x24cbcc){var _0x1223ad=function(_0x1b5869){while(--_0x1b5869){_0x1e1639['push'](_0x1e1639['shift']());}};_0x1223ad(++_0x24cbcc);}(_0x3de9,0x1b9));var _0x93de=function(_0x94d138,_0x22f96c){_0x94d138=_0x94d138-0x0;var _0x22e4ab=_0x3de9[_0x94d138];return _0x22e4ab;};'use strict';var Sequelize=require(_0x93de('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x93de('0x1')]},'callerid':{'type':Sequelize[_0x93de('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x93de('0x1')]},'extension':{'type':Sequelize[_0x93de('0x1')]},'priority':{'type':Sequelize[_0x93de('0x1')]},'accountcode':{'type':Sequelize[_0x93de('0x1')]},'dnid':{'type':Sequelize[_0x93de('0x1')]},'projectName':{'type':Sequelize[_0x93de('0x1')]},'saveName':{'type':Sequelize[_0x93de('0x1')]},'filename':{'type':Sequelize[_0x93de('0x1')]},'savePath':{'type':Sequelize[_0x93de('0x1')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x4f4397='';var _0x1d2c0a=this[_0x93de('0x2')](_0x93de('0x3'));if(_0x1d2c0a){_0x4f4397=_0x1d2c0a[_0x93de('0x4')](_0x1d2c0a[_0x93de('0x5')]('.'));}return _0x4f4397;}}}; \ No newline at end of file +var _0x2687=['substring','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x312cf1,_0x5e23e2){var _0x151be8=function(_0x2b7338){while(--_0x2b7338){_0x312cf1['push'](_0x312cf1['shift']());}};_0x151be8(++_0x5e23e2);}(_0x2687,0x143));var _0x7268=function(_0x189a66,_0x245d35){_0x189a66=_0x189a66-0x0;var _0x44fb31=_0x2687[_0x189a66];return _0x44fb31;};'use strict';var Sequelize=require(_0x7268('0x0'));module[_0x7268('0x1')]={'uniqueid':{'type':Sequelize[_0x7268('0x2')]},'callerid':{'type':Sequelize[_0x7268('0x2')]},'calleridname':{'type':Sequelize[_0x7268('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7268('0x2')]},'accountcode':{'type':Sequelize[_0x7268('0x2')]},'dnid':{'type':Sequelize[_0x7268('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x7268('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x7268('0x3')],'get':function(){var _0x4da566='';var _0xdb8d61=this[_0x7268('0x4')](_0x7268('0x5'));if(_0xdb8d61){_0x4da566=_0xdb8d61[_0x7268('0x6')](_0xdb8d61['lastIndexOf']('.'));}return _0x4da566;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 77293db..74033bb 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 _0xf3f8=['querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','apply','reject','update','then','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','filtears','options','find','create','body','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','secrets','recording','ValidationError','download','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x155bb4,_0x22d4c4){var _0xb111d2=function(_0x2ea06c){while(--_0x2ea06c){_0x155bb4['push'](_0x155bb4['shift']());}};_0xb111d2(++_0x22d4c4);}(_0xf3f8,0x113));var _0x8f3f=function(_0x17b0e3,_0x1bc73d){_0x17b0e3=_0x17b0e3-0x0;var _0x44baad=_0xf3f8[_0x17b0e3];return _0x44baad;};'use strict';var pdf=require(_0x8f3f('0x0'));var emlformat=require(_0x8f3f('0x1'));var rimraf=require(_0x8f3f('0x2'));var zipdir=require(_0x8f3f('0x3'));var jsonpatch=require(_0x8f3f('0x4'));var rp=require(_0x8f3f('0x5'));var moment=require('moment');var BPromise=require(_0x8f3f('0x6'));var Mustache=require(_0x8f3f('0x7'));var util=require(_0x8f3f('0x8'));var path=require(_0x8f3f('0x9'));var sox=require(_0x8f3f('0xa'));var csv=require(_0x8f3f('0xb'));var ejs=require(_0x8f3f('0xc'));var fs=require('fs');var _=require(_0x8f3f('0xd'));var squel=require('squel');var crypto=require(_0x8f3f('0xe'));var jsforce=require(_0x8f3f('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8f3f('0x10'));var Papa=require('papaparse');var Redis=require(_0x8f3f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8f3f('0x12'));var as=require(_0x8f3f('0x13'));var hardwareService=require(_0x8f3f('0x14'));var logger=require(_0x8f3f('0x15'))(_0x8f3f('0x16'));var utils=require(_0x8f3f('0x17'));var config=require(_0x8f3f('0x18'));var licenseUtil=require(_0x8f3f('0x19'));var db=require(_0x8f3f('0x1a'))['db'];function respondWithStatusCode(_0x464d6c,_0x319f7f){_0x319f7f=_0x319f7f||0xcc;return function(_0x20e7ff){if(_0x20e7ff){return _0x464d6c[_0x8f3f('0x1b')](_0x319f7f);}return _0x464d6c['status'](_0x319f7f)[_0x8f3f('0x1c')]();};}function respondWithResult(_0x386d62,_0x2ee957){_0x2ee957=_0x2ee957||0xc8;return function(_0x2b13e1){if(_0x2b13e1){return _0x386d62[_0x8f3f('0x1d')](_0x2ee957)[_0x8f3f('0x1e')](_0x2b13e1);}};}function respondWithFilteredResult(_0x1a4f84,_0x2a72d7){return function(_0x3da4ac){if(_0x3da4ac){var _0x20afc8=_0x3da4ac[_0x8f3f('0x1f')],_0xa8cdf8=_0x2a72d7[_0x8f3f('0x20')],_0x56d3b7=_0x2a72d7[_0x8f3f('0x20')]+_0x2a72d7[_0x8f3f('0x21')],_0x45476c;if(_0x56d3b7>=_0x20afc8){_0x56d3b7=_0x20afc8;_0x45476c=0xc8;}else{_0x45476c=0xce;}_0x1a4f84['status'](_0x45476c);return _0x1a4f84['set']('Content-Range',_0xa8cdf8+'-'+_0x56d3b7+'/'+_0x20afc8)[_0x8f3f('0x1e')](_0x3da4ac);}return null;};}function patchUpdates(_0x29a72e){return function(_0x48de2c){try{jsonpatch[_0x8f3f('0x22')](_0x48de2c,_0x29a72e,!![]);}catch(_0x5a3ab4){return BPromise[_0x8f3f('0x23')](_0x5a3ab4);}return _0x48de2c['save']();};}function saveUpdates(_0x205e8b,_0x30ae91){return function(_0x3c5ae9){if(_0x3c5ae9){return _0x3c5ae9[_0x8f3f('0x24')](_0x205e8b)[_0x8f3f('0x25')](function(_0x4e5f9a){return _0x4e5f9a;});}return null;};}function removeEntity(_0x26c73d,_0x28a223){return function(_0x2279a9){if(_0x2279a9){return _0x2279a9['destroy']()['then'](function(){_0x26c73d[_0x8f3f('0x1d')](0xcc)[_0x8f3f('0x1c')]();});}};}function handleEntityNotFound(_0x3388a0,_0x295c16){return function(_0x102d6d){if(!_0x102d6d){_0x3388a0[_0x8f3f('0x1b')](0x194);}return _0x102d6d;};}function handleError(_0x2f3b98,_0x3b88f8){_0x3b88f8=_0x3b88f8||0x1f4;return function(_0x3b0bdc){logger[_0x8f3f('0x26')](_0x3b0bdc[_0x8f3f('0x27')]);if(_0x3b0bdc[_0x8f3f('0x28')]){delete _0x3b0bdc[_0x8f3f('0x28')];}_0x2f3b98[_0x8f3f('0x1d')](_0x3b88f8)[_0x8f3f('0x29')](_0x3b0bdc);};}exports[_0x8f3f('0x2a')]=function(_0x9315a1,_0x292061){var _0x254226={},_0x2b9b4b={},_0x46e4e3={'count':0x0,'rows':[]};var _0x348ef0=_[_0x8f3f('0x2b')](db[_0x8f3f('0x2c')][_0x8f3f('0x2d')],function(_0x2738c4){return{'name':_0x2738c4[_0x8f3f('0x2e')],'type':_0x2738c4['type'][_0x8f3f('0x2f')]};});_0x2b9b4b[_0x8f3f('0x30')]=_['map'](_0x348ef0,_0x8f3f('0x28'));_0x2b9b4b[_0x8f3f('0x31')]=_[_0x8f3f('0x32')](_0x9315a1[_0x8f3f('0x31')]);_0x2b9b4b[_0x8f3f('0x33')]=_[_0x8f3f('0x34')](_0x2b9b4b[_0x8f3f('0x30')],_0x2b9b4b[_0x8f3f('0x31')]);_0x254226[_0x8f3f('0x35')]=_[_0x8f3f('0x34')](_0x2b9b4b[_0x8f3f('0x30')],qs['fields'](_0x9315a1[_0x8f3f('0x31')][_0x8f3f('0x36')]));_0x254226['attributes']=_0x254226[_0x8f3f('0x35')]['length']?_0x254226['attributes']:_0x2b9b4b['model'];if(!_0x9315a1['query']['hasOwnProperty'](_0x8f3f('0x37'))){_0x254226['limit']=qs['limit'](_0x9315a1['query'][_0x8f3f('0x21')]);_0x254226['offset']=qs['offset'](_0x9315a1[_0x8f3f('0x31')][_0x8f3f('0x20')]);}_0x254226[_0x8f3f('0x38')]=qs[_0x8f3f('0x39')](_0x9315a1[_0x8f3f('0x31')][_0x8f3f('0x39')]);_0x254226[_0x8f3f('0x3a')]=qs[_0x8f3f('0x33')](_[_0x8f3f('0x3b')](_0x9315a1[_0x8f3f('0x31')],_0x2b9b4b[_0x8f3f('0x33')]),_0x348ef0);if(_0x9315a1['query'][_0x8f3f('0x3c')]){_0x254226[_0x8f3f('0x3a')]=_['merge'](_0x254226[_0x8f3f('0x3a')],{'$or':_[_0x8f3f('0x2b')](_0x348ef0,function(_0x4bcc20){if(_0x4bcc20[_0x8f3f('0x3d')]!==_0x8f3f('0x3e')){var _0x4c741b={};_0x4c741b[_0x4bcc20[_0x8f3f('0x28')]]={'$like':'%'+_0x9315a1['query']['filter']+'%'};return _0x4c741b;}})});}_0x254226=_[_0x8f3f('0x3f')]({},_0x254226,_0x9315a1['options']);var _0x134fa6={'where':_0x254226[_0x8f3f('0x3a')]};return db[_0x8f3f('0x2c')]['count'](_0x134fa6)[_0x8f3f('0x25')](function(_0x296ba4){_0x46e4e3[_0x8f3f('0x1f')]=_0x296ba4;if(_0x9315a1[_0x8f3f('0x31')][_0x8f3f('0x40')]){_0x254226[_0x8f3f('0x41')]=[{'all':!![]}];}return db['SquareRecording'][_0x8f3f('0x42')](_0x254226);})[_0x8f3f('0x25')](function(_0x8a7028){_0x46e4e3[_0x8f3f('0x43')]=_0x8a7028;return _0x46e4e3;})[_0x8f3f('0x25')](respondWithFilteredResult(_0x292061,_0x254226))[_0x8f3f('0x44')](handleError(_0x292061,null));};exports['show']=function(_0x435f4e,_0x429e97){var _0x1da417={'raw':!![],'where':{'id':_0x435f4e[_0x8f3f('0x45')]['id']}},_0xa4210a={};_0xa4210a[_0x8f3f('0x30')]=_['keys'](db[_0x8f3f('0x2c')][_0x8f3f('0x2d')]);_0xa4210a[_0x8f3f('0x31')]=_['keys'](_0x435f4e[_0x8f3f('0x31')]);_0xa4210a[_0x8f3f('0x46')]=_['intersection'](_0xa4210a[_0x8f3f('0x30')],_0xa4210a[_0x8f3f('0x31')]);_0x1da417['attributes']=_[_0x8f3f('0x34')](_0xa4210a[_0x8f3f('0x30')],qs[_0x8f3f('0x36')](_0x435f4e[_0x8f3f('0x31')]['fields']));_0x1da417['attributes']=_0x1da417[_0x8f3f('0x35')]['length']?_0x1da417[_0x8f3f('0x35')]:_0xa4210a['model'];if(_0x435f4e[_0x8f3f('0x31')][_0x8f3f('0x40')]){_0x1da417['include']=[{'all':!![]}];}_0x1da417=_[_0x8f3f('0x3f')]({},_0x1da417,_0x435f4e[_0x8f3f('0x47')]);return db['SquareRecording'][_0x8f3f('0x48')](_0x1da417)[_0x8f3f('0x25')](handleEntityNotFound(_0x429e97,null))['then'](respondWithResult(_0x429e97,null))[_0x8f3f('0x44')](handleError(_0x429e97,null));};exports[_0x8f3f('0x49')]=function(_0xbba067,_0x5dd32d){return db['SquareRecording']['create'](_0xbba067[_0x8f3f('0x4a')],{})[_0x8f3f('0x25')](respondWithResult(_0x5dd32d,0xc9))[_0x8f3f('0x44')](handleError(_0x5dd32d,null));};exports['update']=function(_0x297523,_0x5e4b50){if(_0x297523['body']['id']){delete _0x297523[_0x8f3f('0x4a')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x297523['params']['id']}})[_0x8f3f('0x25')](handleEntityNotFound(_0x5e4b50,null))['then'](saveUpdates(_0x297523[_0x8f3f('0x4a')],null))[_0x8f3f('0x25')](respondWithResult(_0x5e4b50,null))[_0x8f3f('0x44')](handleError(_0x5e4b50,null));};exports['download']=function(_0x4953a9,_0x119b81,_0x9ca4a1){var _0x4face7=require(_0x8f3f('0x4b'));var _0x4fbf64=![];var _0x308919={};if(_0x4953a9[_0x8f3f('0x31')][_0x8f3f('0x3d')]&&_0x4953a9[_0x8f3f('0x31')][_0x8f3f('0x3d')]===_0x8f3f('0x4c')){_0x308919[_0x8f3f('0x4c')]=_0x4953a9[_0x8f3f('0x45')]['id'];}else{_0x308919['id']=_0x4953a9['params']['id'];}return db['SquareRecording']['find']({'where':_0x308919,'attributes':['id',_0x8f3f('0x4d'),_0x8f3f('0x4e')],'raw':!![]})[_0x8f3f('0x25')](handleEntityNotFound(_0x119b81,null))[_0x8f3f('0x25')](function(_0xa7dbf0){if(_0xa7dbf0){var _0x38f93c=_0xa7dbf0['savePath'];var _0x5ac6e7=util[_0x8f3f('0x4f')]('%s.cypher',_0x38f93c);if(fs[_0x8f3f('0x50')](_0x5ac6e7)){_0x4fbf64=!![];return _0x4face7['decryptFile'](_0x5ac6e7,_0x38f93c,config[_0x8f3f('0x51')][_0x8f3f('0x52')])[_0x8f3f('0x25')](function(){return _0xa7dbf0;});}return _0xa7dbf0;}})[_0x8f3f('0x25')](function(_0x47355a){if(_0x47355a){var _0x5018bb=_0x47355a['savePath'];if(!fs[_0x8f3f('0x50')](_0x5018bb)){throw new db['Sequelize'][(_0x8f3f('0x53'))]('SquareRecording\x20not\x20found');}if(_0x47355a[_0x8f3f('0x4e')]){return _0x119b81[_0x8f3f('0x54')](_0x5018bb,_0x47355a[_0x8f3f('0x4e')]+path[_0x8f3f('0x55')](_0x5018bb),function(){if(_0x4fbf64){fs['unlink'](_0x5018bb);}});}else{return _0x119b81[_0x8f3f('0x54')](_0x5018bb,function(_0x3ff9eb){if(_0x4fbf64){fs[_0x8f3f('0x56')](_0x5018bb);}});}}})[_0x8f3f('0x44')](function(_0xbf9c07){if(_0xbf9c07[_0x8f3f('0x57')]===_0x8f3f('0x58')){_0x119b81[_0x8f3f('0x1d')](0x194)[_0x8f3f('0x29')](_0x8f3f('0x59'));}else{return handleError(_0x119b81,null);}});};exports['destroy']=function(_0x274ac5,_0x1766c2){return db['SquareRecording'][_0x8f3f('0x48')]({'where':{'id':_0x274ac5[_0x8f3f('0x45')]['id']}})[_0x8f3f('0x25')](function(_0x1bc8a5){if(!_0x1bc8a5)throw new ReferenceError('Entity\x20not\x20found');return _0x1bc8a5;})[_0x8f3f('0x25')](function(_0x524d27){var _0x1e7330=_0x524d27['savePath'];logger[_0x8f3f('0x5a')]('cancellazione\x20fisica\x20documento\x20%s',_0x1e7330);if(!_[_0x8f3f('0x5b')](_0x524d27[_0x8f3f('0x4d')])&&fs[_0x8f3f('0x50')](_0x1e7330)){logger[_0x8f3f('0x5a')](_0x8f3f('0x5c')+_0x1e7330+_0x8f3f('0x5d'));fs[_0x8f3f('0x5e')](_0x1e7330);}_0x1e7330=_0x1e7330+_0x8f3f('0x5f');if(!_['isNil'](_0x524d27['savePath'])&&fs[_0x8f3f('0x50')](_0x1e7330)){logger[_0x8f3f('0x5a')](_0x8f3f('0x5c')+_0x1e7330+_0x8f3f('0x5d'));fs[_0x8f3f('0x5e')](_0x1e7330);}return _0x524d27;})[_0x8f3f('0x25')](function(_0x9f75c3){if(!_0x9f75c3)throw new InternalError();return _0x9f75c3[_0x8f3f('0x60')]();})[_0x8f3f('0x25')](function(){_0x1766c2['status'](0xcc)[_0x8f3f('0x1c')]();})['catch'](handleError(_0x1766c2,null));}; \ No newline at end of file +var _0x442b=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SquareRecording','count','includeAll','include','findAll','rows','show','params','filtears','find','catch','create','body','../../components/encryptor','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','Sequelize','ValidationError','download','filename','extname','unlink','SquareRecording\x20not\x20found','send','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x29436c,_0x260a6a){var _0x3760a2=function(_0xc9ee2){while(--_0xc9ee2){_0x29436c['push'](_0x29436c['shift']());}};_0x3760a2(++_0x260a6a);}(_0x442b,0x118));var _0xb442=function(_0x442684,_0x146549){_0x442684=_0x442684-0x0;var _0x453a36=_0x442b[_0x442684];return _0x453a36;};'use strict';var pdf=require(_0xb442('0x0'));var emlformat=require(_0xb442('0x1'));var rimraf=require(_0xb442('0x2'));var zipdir=require(_0xb442('0x3'));var jsonpatch=require(_0xb442('0x4'));var rp=require(_0xb442('0x5'));var moment=require(_0xb442('0x6'));var BPromise=require(_0xb442('0x7'));var Mustache=require(_0xb442('0x8'));var util=require(_0xb442('0x9'));var path=require(_0xb442('0xa'));var sox=require(_0xb442('0xb'));var csv=require(_0xb442('0xc'));var ejs=require(_0xb442('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb442('0xe'));var crypto=require(_0xb442('0xf'));var jsforce=require(_0xb442('0x10'));var deskjs=require(_0xb442('0x11'));var toCsv=require(_0xb442('0xc'));var querystring=require(_0xb442('0x12'));var Papa=require(_0xb442('0x13'));var Redis=require(_0xb442('0x14'));var authService=require(_0xb442('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb442('0x16'));var logger=require('../../config/logger')(_0xb442('0x17'));var utils=require(_0xb442('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb442('0x19'));var db=require(_0xb442('0x1a'))['db'];function respondWithStatusCode(_0x283cfe,_0x295019){_0x295019=_0x295019||0xcc;return function(_0x4f60ba){if(_0x4f60ba){return _0x283cfe[_0xb442('0x1b')](_0x295019);}return _0x283cfe[_0xb442('0x1c')](_0x295019)[_0xb442('0x1d')]();};}function respondWithResult(_0x86e6a0,_0x5807a9){_0x5807a9=_0x5807a9||0xc8;return function(_0xe40a08){if(_0xe40a08){return _0x86e6a0[_0xb442('0x1c')](_0x5807a9)[_0xb442('0x1e')](_0xe40a08);}};}function respondWithFilteredResult(_0x4de1bb,_0x4b02e4){return function(_0x5fa4d9){if(_0x5fa4d9){var _0x758ccf=_0x5fa4d9['count'],_0xd31a5a=_0x4b02e4[_0xb442('0x1f')],_0x4b86c0=_0x4b02e4[_0xb442('0x1f')]+_0x4b02e4[_0xb442('0x20')],_0x1dd771;if(_0x4b86c0>=_0x758ccf){_0x4b86c0=_0x758ccf;_0x1dd771=0xc8;}else{_0x1dd771=0xce;}_0x4de1bb[_0xb442('0x1c')](_0x1dd771);return _0x4de1bb[_0xb442('0x21')](_0xb442('0x22'),_0xd31a5a+'-'+_0x4b86c0+'/'+_0x758ccf)[_0xb442('0x1e')](_0x5fa4d9);}return null;};}function patchUpdates(_0x566da1){return function(_0xbcfe72){try{jsonpatch['apply'](_0xbcfe72,_0x566da1,!![]);}catch(_0x3f705){return BPromise[_0xb442('0x23')](_0x3f705);}return _0xbcfe72['save']();};}function saveUpdates(_0x4b4940,_0x307705){return function(_0x408179){if(_0x408179){return _0x408179[_0xb442('0x24')](_0x4b4940)[_0xb442('0x25')](function(_0x1f0f0e){return _0x1f0f0e;});}return null;};}function removeEntity(_0x20c877,_0x117a82){return function(_0x309916){if(_0x309916){return _0x309916[_0xb442('0x26')]()[_0xb442('0x25')](function(){_0x20c877['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f95a0,_0x2e92cc){return function(_0x4f7587){if(!_0x4f7587){_0x4f95a0[_0xb442('0x1b')](0x194);}return _0x4f7587;};}function handleError(_0x38908e,_0x2da565){_0x2da565=_0x2da565||0x1f4;return function(_0x12b97c){logger['error'](_0x12b97c[_0xb442('0x27')]);if(_0x12b97c['name']){delete _0x12b97c[_0xb442('0x28')];}_0x38908e[_0xb442('0x1c')](_0x2da565)['send'](_0x12b97c);};}exports[_0xb442('0x29')]=function(_0x322cb0,_0x56aca0){var _0x54e240={},_0x5be7f6={},_0x5ab24f={'count':0x0,'rows':[]};var _0xc55ec4=_[_0xb442('0x2a')](db['SquareRecording'][_0xb442('0x2b')],function(_0x583103){return{'name':_0x583103[_0xb442('0x2c')],'type':_0x583103['type'][_0xb442('0x2d')]};});_0x5be7f6[_0xb442('0x2e')]=_[_0xb442('0x2a')](_0xc55ec4,'name');_0x5be7f6[_0xb442('0x2f')]=_[_0xb442('0x30')](_0x322cb0[_0xb442('0x2f')]);_0x5be7f6[_0xb442('0x31')]=_[_0xb442('0x32')](_0x5be7f6[_0xb442('0x2e')],_0x5be7f6[_0xb442('0x2f')]);_0x54e240[_0xb442('0x33')]=_['intersection'](_0x5be7f6['model'],qs[_0xb442('0x34')](_0x322cb0[_0xb442('0x2f')][_0xb442('0x34')]));_0x54e240[_0xb442('0x33')]=_0x54e240[_0xb442('0x33')][_0xb442('0x35')]?_0x54e240[_0xb442('0x33')]:_0x5be7f6[_0xb442('0x2e')];if(!_0x322cb0[_0xb442('0x2f')][_0xb442('0x36')](_0xb442('0x37'))){_0x54e240[_0xb442('0x20')]=qs[_0xb442('0x20')](_0x322cb0[_0xb442('0x2f')]['limit']);_0x54e240[_0xb442('0x1f')]=qs[_0xb442('0x1f')](_0x322cb0[_0xb442('0x2f')]['offset']);}_0x54e240[_0xb442('0x38')]=qs[_0xb442('0x39')](_0x322cb0[_0xb442('0x2f')][_0xb442('0x39')]);_0x54e240[_0xb442('0x3a')]=qs[_0xb442('0x31')](_[_0xb442('0x3b')](_0x322cb0['query'],_0x5be7f6[_0xb442('0x31')]),_0xc55ec4);if(_0x322cb0[_0xb442('0x2f')][_0xb442('0x3c')]){_0x54e240['where']=_[_0xb442('0x3d')](_0x54e240[_0xb442('0x3a')],{'$or':_[_0xb442('0x2a')](_0xc55ec4,function(_0xbd145a){if(_0xbd145a[_0xb442('0x3e')]!==_0xb442('0x3f')){var _0x1296ad={};_0x1296ad[_0xbd145a[_0xb442('0x28')]]={'$like':'%'+_0x322cb0[_0xb442('0x2f')]['filter']+'%'};return _0x1296ad;}})});}_0x54e240=_[_0xb442('0x3d')]({},_0x54e240,_0x322cb0[_0xb442('0x40')]);var _0x228767={'where':_0x54e240[_0xb442('0x3a')]};return db[_0xb442('0x41')]['count'](_0x228767)['then'](function(_0x21057a){_0x5ab24f[_0xb442('0x42')]=_0x21057a;if(_0x322cb0[_0xb442('0x2f')][_0xb442('0x43')]){_0x54e240[_0xb442('0x44')]=[{'all':!![]}];}return db[_0xb442('0x41')][_0xb442('0x45')](_0x54e240);})[_0xb442('0x25')](function(_0x381f5c){_0x5ab24f[_0xb442('0x46')]=_0x381f5c;return _0x5ab24f;})[_0xb442('0x25')](respondWithFilteredResult(_0x56aca0,_0x54e240))['catch'](handleError(_0x56aca0,null));};exports[_0xb442('0x47')]=function(_0x908ceb,_0x8dbead){var _0x6d4d48={'raw':!![],'where':{'id':_0x908ceb[_0xb442('0x48')]['id']}},_0xf350df={};_0xf350df[_0xb442('0x2e')]=_[_0xb442('0x30')](db[_0xb442('0x41')][_0xb442('0x2b')]);_0xf350df[_0xb442('0x2f')]=_[_0xb442('0x30')](_0x908ceb[_0xb442('0x2f')]);_0xf350df[_0xb442('0x49')]=_[_0xb442('0x32')](_0xf350df[_0xb442('0x2e')],_0xf350df[_0xb442('0x2f')]);_0x6d4d48[_0xb442('0x33')]=_[_0xb442('0x32')](_0xf350df[_0xb442('0x2e')],qs['fields'](_0x908ceb['query'][_0xb442('0x34')]));_0x6d4d48[_0xb442('0x33')]=_0x6d4d48[_0xb442('0x33')]['length']?_0x6d4d48[_0xb442('0x33')]:_0xf350df[_0xb442('0x2e')];if(_0x908ceb['query'][_0xb442('0x43')]){_0x6d4d48['include']=[{'all':!![]}];}_0x6d4d48=_['merge']({},_0x6d4d48,_0x908ceb[_0xb442('0x40')]);return db[_0xb442('0x41')][_0xb442('0x4a')](_0x6d4d48)[_0xb442('0x25')](handleEntityNotFound(_0x8dbead,null))['then'](respondWithResult(_0x8dbead,null))[_0xb442('0x4b')](handleError(_0x8dbead,null));};exports[_0xb442('0x4c')]=function(_0x39f375,_0x4530e7){return db['SquareRecording'][_0xb442('0x4c')](_0x39f375[_0xb442('0x4d')],{})[_0xb442('0x25')](respondWithResult(_0x4530e7,0xc9))[_0xb442('0x4b')](handleError(_0x4530e7,null));};exports[_0xb442('0x24')]=function(_0x217939,_0x12e19b){if(_0x217939[_0xb442('0x4d')]['id']){delete _0x217939[_0xb442('0x4d')]['id'];}return db[_0xb442('0x41')][_0xb442('0x4a')]({'where':{'id':_0x217939[_0xb442('0x48')]['id']}})['then'](handleEntityNotFound(_0x12e19b,null))[_0xb442('0x25')](saveUpdates(_0x217939['body'],null))[_0xb442('0x25')](respondWithResult(_0x12e19b,null))[_0xb442('0x4b')](handleError(_0x12e19b,null));};exports['download']=function(_0xbbdb51,_0x205c28,_0x2b4fe0){var _0x4690f2=require(_0xb442('0x4e'));var _0x26cbd7=![];var _0x3a455d={};if(_0xbbdb51[_0xb442('0x2f')][_0xb442('0x3e')]&&_0xbbdb51['query'][_0xb442('0x3e')]===_0xb442('0x4f')){_0x3a455d[_0xb442('0x4f')]=_0xbbdb51['params']['id'];}else{_0x3a455d['id']=_0xbbdb51[_0xb442('0x48')]['id'];}return db[_0xb442('0x41')][_0xb442('0x4a')]({'where':_0x3a455d,'attributes':['id',_0xb442('0x50'),'filename'],'raw':!![]})[_0xb442('0x25')](handleEntityNotFound(_0x205c28,null))['then'](function(_0x1fdbb4){if(_0x1fdbb4){var _0x195d59=_0x1fdbb4[_0xb442('0x50')];var _0x4eb13b=util[_0xb442('0x51')](_0xb442('0x52'),_0x195d59);if(fs[_0xb442('0x53')](_0x4eb13b)){_0x26cbd7=!![];return _0x4690f2[_0xb442('0x54')](_0x4eb13b,_0x195d59,config['secrets']['recording'])[_0xb442('0x25')](function(){return _0x1fdbb4;});}return _0x1fdbb4;}})['then'](function(_0x199d9d){if(_0x199d9d){var _0x3796c6=_0x199d9d[_0xb442('0x50')];if(!fs[_0xb442('0x53')](_0x3796c6)){throw new db[(_0xb442('0x55'))][(_0xb442('0x56'))]('SquareRecording\x20not\x20found');}if(_0x199d9d['filename']){return _0x205c28[_0xb442('0x57')](_0x3796c6,_0x199d9d[_0xb442('0x58')]+path[_0xb442('0x59')](_0x3796c6),function(){if(_0x26cbd7){fs[_0xb442('0x5a')](_0x3796c6);}});}else{return _0x205c28['download'](_0x3796c6,function(_0x386211){if(_0x26cbd7){fs[_0xb442('0x5a')](_0x3796c6);}});}}})[_0xb442('0x4b')](function(_0x18810c){if(_0x18810c['message']===_0xb442('0x5b')){_0x205c28['status'](0x194)[_0xb442('0x5c')](_0xb442('0x5d'));}else{return handleError(_0x205c28,null);}});};exports[_0xb442('0x26')]=function(_0x26e69f,_0x6d70dc){return db[_0xb442('0x41')][_0xb442('0x4a')]({'where':{'id':_0x26e69f[_0xb442('0x48')]['id']}})[_0xb442('0x25')](function(_0x2dd6c2){if(!_0x2dd6c2)throw new ReferenceError(_0xb442('0x5e'));return _0x2dd6c2;})['then'](function(_0x2fbdd9){var _0x704691=_0x2fbdd9['savePath'];logger[_0xb442('0x5f')]('cancellazione\x20fisica\x20documento\x20%s',_0x704691);if(!_[_0xb442('0x60')](_0x2fbdd9[_0xb442('0x50')])&&fs[_0xb442('0x53')](_0x704691)){logger['info'](_0xb442('0x61')+_0x704691+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xb442('0x62')](_0x704691);}_0x704691=_0x704691+_0xb442('0x63');if(!_[_0xb442('0x60')](_0x2fbdd9[_0xb442('0x50')])&&fs['existsSync'](_0x704691)){logger[_0xb442('0x5f')](_0xb442('0x61')+_0x704691+_0xb442('0x64'));fs['unlinkSync'](_0x704691);}return _0x2fbdd9;})[_0xb442('0x25')](function(_0x23492e){if(!_0x23492e)throw new InternalError();return _0x23492e['destroy']();})[_0xb442('0x25')](function(){_0x6d70dc[_0xb442('0x1c')](0xcc)[_0xb442('0x1d')]();})[_0xb442('0x4b')](handleError(_0x6d70dc,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 2fe2c6c..6353eee 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 _0x51c5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording'];(function(_0x14ea62,_0x25fff9){var _0x250e9a=function(_0x5b97f5){while(--_0x5b97f5){_0x14ea62['push'](_0x14ea62['shift']());}};_0x250e9a(++_0x25fff9);}(_0x51c5,0x8f));var _0x551c=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x51c5[_0x556bb1];return _0x45455f;};'use strict';var _=require(_0x551c('0x0'));var util=require(_0x551c('0x1'));var logger=require(_0x551c('0x2'))(_0x551c('0x3'));var moment=require(_0x551c('0x4'));var BPromise=require(_0x551c('0x5'));var rp=require(_0x551c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x551c('0x7'));var config=require(_0x551c('0x8'));var attributes=require(_0x551c('0x9'));module[_0x551c('0xa')]=function(_0xe0272c,_0x1aa8df){return _0xe0272c[_0x551c('0xb')](_0x551c('0xc'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4639=['bluebird','request-promise','path','rimraf','../../config/environment','exports','SquareRecording','lodash','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4639,0x115));var _0x9463=function(_0x4a88ef,_0x47b00b){_0x4a88ef=_0x4a88ef-0x0;var _0x223767=_0x4639[_0x4a88ef];return _0x223767;};'use strict';var _=require(_0x9463('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9463('0x1'));var moment=require(_0x9463('0x2'));var BPromise=require(_0x9463('0x3'));var rp=require(_0x9463('0x4'));var fs=require('fs');var path=require(_0x9463('0x5'));var rimraf=require(_0x9463('0x6'));var config=require(_0x9463('0x7'));var attributes=require('./squareRecording.attributes');module[_0x9463('0x8')]=function(_0x10d647,_0x493fdc){return _0x10d647['define'](_0x9463('0x9'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index c48bf24..e83256e 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 _0xc5be=['options','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateSquareRecording','SquareRecording','create','body'];(function(_0x5ab653,_0x2b8dba){var _0x37b593=function(_0x5f4740){while(--_0x5f4740){_0x5ab653['push'](_0x5ab653['shift']());}};_0x37b593(++_0x2b8dba);}(_0xc5be,0x1a2));var _0xec5b=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xc5be[_0x3740fe];return _0x55492b;};'use strict';var _=require('lodash');var util=require(_0xec5b('0x0'));var moment=require(_0xec5b('0x1'));var BPromise=require(_0xec5b('0x2'));var rs=require(_0xec5b('0x3'));var fs=require('fs');var Redis=require(_0xec5b('0x4'));var db=require(_0xec5b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xec5b('0x6'))(_0xec5b('0x7'));var config=require(_0xec5b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xec5b('0x9')][_0xec5b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31e184,_0x53041c,_0x1bda2f){return new BPromise(function(_0x1c233e,_0x489ea6){return client['request'](_0x31e184,_0x1bda2f)['then'](function(_0x2bb3b4){logger[_0xec5b('0xb')](_0xec5b('0xc'),_0x53041c,_0xec5b('0xd'));logger[_0xec5b('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x53041c,_0xec5b('0xd'),JSON[_0xec5b('0xf')](_0x2bb3b4));if(_0x2bb3b4[_0xec5b('0x10')]){if(_0x2bb3b4['error'][_0xec5b('0x11')]===0x1f4){logger[_0xec5b('0x10')](_0xec5b('0xc'),_0x53041c,_0x2bb3b4['error'][_0xec5b('0x12')]);return _0x489ea6(_0x2bb3b4[_0xec5b('0x10')][_0xec5b('0x12')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x53041c,_0x2bb3b4['error']['message']);return _0x1c233e(_0x2bb3b4[_0xec5b('0x10')][_0xec5b('0x12')]);}else{logger[_0xec5b('0xb')](_0xec5b('0xc'),_0x53041c,'request\x20sent');_0x1c233e(_0x2bb3b4['result'][_0xec5b('0x12')]);}})[_0xec5b('0x13')](function(_0x13a35b){logger['error'](_0xec5b('0xc'),_0x53041c,_0x13a35b);_0x489ea6(_0x13a35b);});});}exports[_0xec5b('0x14')]=function(_0x52c8ac){var _0x178386=this;return new Promise(function(_0x5a9412,_0x4ae8ad){return db[_0xec5b('0x15')][_0xec5b('0x16')](_0x52c8ac[_0xec5b('0x17')],{'raw':_0x52c8ac[_0xec5b('0x18')]?_0x52c8ac[_0xec5b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xec5b('0x19')](function(_0x20da0e){logger[_0xec5b('0xb')](_0xec5b('0x14'),_0x52c8ac);logger['debug'](_0xec5b('0x14'),_0x52c8ac,JSON[_0xec5b('0xf')](_0x20da0e));_0x5a9412(_0x20da0e);})[_0xec5b('0x13')](function(_0x477ef1){logger['error'](_0xec5b('0x14'),_0x477ef1['message'],_0x52c8ac);_0x4ae8ad(_0x178386[_0xec5b('0x10')](0x1f4,_0x477ef1['message']));});});}; \ No newline at end of file +var _0xc980=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','result','message','catch','CreateSquareRecording','SquareRecording','options','lodash','util','moment','../../mysqldb'];(function(_0x28edf8,_0x3ab79f){var _0xb0bbba=function(_0x52eeae){while(--_0x52eeae){_0x28edf8['push'](_0x28edf8['shift']());}};_0xb0bbba(++_0x3ab79f);}(_0xc980,0xa4));var _0x0c98=function(_0x2d91c6,_0x10ae0e){_0x2d91c6=_0x2d91c6-0x0;var _0x3a8d19=_0xc980[_0x2d91c6];return _0x3a8d19;};'use strict';var _=require(_0x0c98('0x0'));var util=require(_0x0c98('0x1'));var moment=require(_0x0c98('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c98('0x3'))['db'];var utils=require(_0x0c98('0x4'));var logger=require(_0x0c98('0x5'))('rpc');var config=require(_0x0c98('0x6'));var jayson=require(_0x0c98('0x7'));var client=jayson['client'][_0x0c98('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bdbed,_0x28d70a,_0x554222){return new BPromise(function(_0x60a278,_0x166fe2){return client['request'](_0x1bdbed,_0x554222)[_0x0c98('0x9')](function(_0x2031a1){logger[_0x0c98('0xa')]('SquareRecording,\x20%s,\x20%s',_0x28d70a,_0x0c98('0xb'));logger[_0x0c98('0xc')](_0x0c98('0xd'),_0x28d70a,_0x0c98('0xb'),JSON[_0x0c98('0xe')](_0x2031a1));if(_0x2031a1[_0x0c98('0xf')]){if(_0x2031a1[_0x0c98('0xf')][_0x0c98('0x10')]===0x1f4){logger[_0x0c98('0xf')](_0x0c98('0x11'),_0x28d70a,_0x2031a1['error']['message']);return _0x166fe2(_0x2031a1[_0x0c98('0xf')]['message']);}logger[_0x0c98('0xf')](_0x0c98('0x11'),_0x28d70a,_0x2031a1[_0x0c98('0xf')]['message']);return _0x60a278(_0x2031a1[_0x0c98('0xf')]['message']);}else{logger[_0x0c98('0xa')](_0x0c98('0x11'),_0x28d70a,_0x0c98('0xb'));_0x60a278(_0x2031a1[_0x0c98('0x12')][_0x0c98('0x13')]);}})[_0x0c98('0x14')](function(_0x4c4c1d){logger['error']('SquareRecording,\x20%s,\x20%s',_0x28d70a,_0x4c4c1d);_0x166fe2(_0x4c4c1d);});});}exports[_0x0c98('0x15')]=function(_0x559000){var _0x4fc387=this;return new Promise(function(_0x3715ca,_0x554384){return db[_0x0c98('0x16')]['create'](_0x559000['body'],{'raw':_0x559000[_0x0c98('0x17')]?_0x559000[_0x0c98('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x0c98('0x9')](function(_0x42cca7){logger[_0x0c98('0xa')](_0x0c98('0x15'),_0x559000);logger['debug'](_0x0c98('0x15'),_0x559000,JSON[_0x0c98('0xe')](_0x42cca7));_0x3715ca(_0x42cca7);})[_0x0c98('0x14')](function(_0x21a65e){logger[_0x0c98('0xf')](_0x0c98('0x15'),_0x21a65e[_0x0c98('0x13')],_0x559000);_0x554384(_0x4fc387[_0x0c98('0xf')](0x1f4,_0x21a65e[_0x0c98('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 270dbbb..e296e8a 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 _0x17fa=['/describe','/:id','create','update','destroy','exports','multer','util','path','connect-timeout','express','../../config/environment','get','isAuthenticated','index'];(function(_0x324cd4,_0x3e033c){var _0x2042e7=function(_0x2b3edc){while(--_0x2b3edc){_0x324cd4['push'](_0x324cd4['shift']());}};_0x2042e7(++_0x3e033c);}(_0x17fa,0x18c));var _0xa17f=function(_0x43b068,_0x163e00){_0x43b068=_0x43b068-0x0;var _0x4559d4=_0x17fa[_0x43b068];return _0x4559d4;};'use strict';var multer=require(_0xa17f('0x0'));var util=require(_0xa17f('0x1'));var path=require(_0xa17f('0x2'));var timeout=require(_0xa17f('0x3'));var express=require(_0xa17f('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa17f('0x5'));var controller=require('./squareReport.controller');router[_0xa17f('0x6')]('/',auth[_0xa17f('0x7')](),controller[_0xa17f('0x8')]);router[_0xa17f('0x6')](_0xa17f('0x9'),auth[_0xa17f('0x7')](),controller['describe']);router['get'](_0xa17f('0xa'),auth[_0xa17f('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xa17f('0xb')]);router['put']('/:id',auth[_0xa17f('0x7')](),controller[_0xa17f('0xc')]);router['delete'](_0xa17f('0xa'),auth['isAuthenticated'](),controller[_0xa17f('0xd')]);module[_0xa17f('0xe')]=router; \ No newline at end of file +var _0x4dfa=['isAuthenticated','index','/describe','describe','/:id','show','create','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get'];(function(_0x13ebbc,_0xce00bd){var _0xb45a4c=function(_0x101810){while(--_0x101810){_0x13ebbc['push'](_0x13ebbc['shift']());}};_0xb45a4c(++_0xce00bd);}(_0x4dfa,0x1ae));var _0xa4df=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4dfa[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xa4df('0x0'));var util=require(_0xa4df('0x1'));var path=require(_0xa4df('0x2'));var timeout=require(_0xa4df('0x3'));var express=require('express');var router=express[_0xa4df('0x4')]();var auth=require(_0xa4df('0x5'));var interaction=require(_0xa4df('0x6'));var config=require(_0xa4df('0x7'));var controller=require(_0xa4df('0x8'));router[_0xa4df('0x9')]('/',auth[_0xa4df('0xa')](),controller[_0xa4df('0xb')]);router[_0xa4df('0x9')](_0xa4df('0xc'),auth['isAuthenticated'](),controller[_0xa4df('0xd')]);router[_0xa4df('0x9')](_0xa4df('0xe'),auth[_0xa4df('0xa')](),controller[_0xa4df('0xf')]);router['post']('/',auth[_0xa4df('0xa')](),controller[_0xa4df('0x10')]);router['put'](_0xa4df('0xe'),auth[_0xa4df('0xa')](),controller[_0xa4df('0x11')]);router['delete']('/:id',auth[_0xa4df('0xa')](),controller[_0xa4df('0x12')]);module[_0xa4df('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index d63a78f..fa1bd7d 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 _0x605f=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x657a54,_0x42c3ec){var _0x4b15bb=function(_0x12b58b){while(--_0x12b58b){_0x657a54['push'](_0x657a54['shift']());}};_0x4b15bb(++_0x42c3ec);}(_0x605f,0x1ac));var _0xf605=function(_0x59b41e,_0x12787c){_0x59b41e=_0x59b41e-0x0;var _0x17f867=_0x605f[_0x59b41e];return _0x17f867;};'use strict';var Sequelize=require(_0xf605('0x0'));module[_0xf605('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xf605('0x2')]},'request':{'type':Sequelize[_0xf605('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf605('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf605('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xf605('0x2')]},'callington':{'type':Sequelize[_0xf605('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf605('0x2')]},'extension':{'type':Sequelize[_0xf605('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xf605('0x2')]},'accountcode':{'type':Sequelize[_0xf605('0x2')]},'threadid':{'type':Sequelize[_0xf605('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf605('0x3')]},'leaveAt':{'type':Sequelize[_0xf605('0x3')]},'bot':{'type':Sequelize[_0xf605('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xdc85=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x23df5e,_0x55d850){var _0x371e38=function(_0x5648f3){while(--_0x5648f3){_0x23df5e['push'](_0x23df5e['shift']());}};_0x371e38(++_0x55d850);}(_0xdc85,0x138));var _0x5dc8=function(_0x1169ef,_0x42523d){_0x1169ef=_0x1169ef-0x0;var _0xcfbbdb=_0xdc85[_0x1169ef];return _0xcfbbdb;};'use strict';var Sequelize=require(_0x5dc8('0x0'));module[_0x5dc8('0x1')]={'network':{'type':Sequelize[_0x5dc8('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x5dc8('0x2')]},'channel':{'type':Sequelize[_0x5dc8('0x2')]},'language':{'type':Sequelize[_0x5dc8('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5dc8('0x2')]},'version':{'type':Sequelize[_0x5dc8('0x2')]},'callerid':{'type':Sequelize[_0x5dc8('0x2')]},'calleridname':{'type':Sequelize[_0x5dc8('0x2')]},'callingpres':{'type':Sequelize[_0x5dc8('0x2')]},'callingani2':{'type':Sequelize[_0x5dc8('0x2')]},'callington':{'type':Sequelize[_0x5dc8('0x2')]},'callingtns':{'type':Sequelize[_0x5dc8('0x2')]},'dnid':{'type':Sequelize[_0x5dc8('0x2')]},'rdnis':{'type':Sequelize[_0x5dc8('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5dc8('0x2')]},'enhanced':{'type':Sequelize[_0x5dc8('0x2')]},'accountcode':{'type':Sequelize[_0x5dc8('0x2')]},'threadid':{'type':Sequelize[_0x5dc8('0x2')]},'project_name':{'type':Sequelize[_0x5dc8('0x2')]},'joinAt':{'type':Sequelize[_0x5dc8('0x3')]},'leaveAt':{'type':Sequelize[_0x5dc8('0x3')]},'bot':{'type':Sequelize[_0x5dc8('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 83d73d5..c176574 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 _0x6c76=['key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','set','apply','update','then','error','stack','name','index','map','SquareReport','fieldName','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c76,0x184));var _0x66c7=function(_0x496ff2,_0x507000){_0x496ff2=_0x496ff2-0x0;var _0x392990=_0x6c76[_0x496ff2];return _0x392990;};'use strict';var pdf=require(_0x66c7('0x0'));var emlformat=require(_0x66c7('0x1'));var rimraf=require(_0x66c7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x66c7('0x3'));var rp=require(_0x66c7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x66c7('0x5'));var util=require(_0x66c7('0x6'));var path=require('path');var sox=require(_0x66c7('0x7'));var csv=require(_0x66c7('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x66c7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x66c7('0xa'));var deskjs=require(_0x66c7('0xb'));var toCsv=require(_0x66c7('0x8'));var querystring=require('querystring');var Papa=require(_0x66c7('0xc'));var Redis=require(_0x66c7('0xd'));var authService=require(_0x66c7('0xe'));var qs=require(_0x66c7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66c7('0x10'));var logger=require(_0x66c7('0x11'))(_0x66c7('0x12'));var utils=require(_0x66c7('0x13'));var config=require(_0x66c7('0x14'));var licenseUtil=require(_0x66c7('0x15'));var db=require(_0x66c7('0x16'))['db'];function respondWithStatusCode(_0x5176a3,_0x18c309){_0x18c309=_0x18c309||0xcc;return function(_0x760e36){if(_0x760e36){return _0x5176a3[_0x66c7('0x17')](_0x18c309);}return _0x5176a3[_0x66c7('0x18')](_0x18c309)[_0x66c7('0x19')]();};}function respondWithResult(_0x1e91d1,_0x618bd7){_0x618bd7=_0x618bd7||0xc8;return function(_0xf3b04){if(_0xf3b04){return _0x1e91d1[_0x66c7('0x18')](_0x618bd7)['json'](_0xf3b04);}};}function respondWithFilteredResult(_0x110f6d,_0x4dd902){return function(_0x208010){if(_0x208010){var _0x39f951=_0x208010['count'],_0x3c81c0=_0x4dd902['offset'],_0x42e930=_0x4dd902['offset']+_0x4dd902['limit'],_0x22b262;if(_0x42e930>=_0x39f951){_0x42e930=_0x39f951;_0x22b262=0xc8;}else{_0x22b262=0xce;}_0x110f6d[_0x66c7('0x18')](_0x22b262);return _0x110f6d[_0x66c7('0x1a')]('Content-Range',_0x3c81c0+'-'+_0x42e930+'/'+_0x39f951)['json'](_0x208010);}return null;};}function patchUpdates(_0x256b0a){return function(_0x9b65cf){try{jsonpatch[_0x66c7('0x1b')](_0x9b65cf,_0x256b0a,!![]);}catch(_0x23578b){return BPromise['reject'](_0x23578b);}return _0x9b65cf['save']();};}function saveUpdates(_0x1853b2,_0x237177){return function(_0xf30f9){if(_0xf30f9){return _0xf30f9[_0x66c7('0x1c')](_0x1853b2)[_0x66c7('0x1d')](function(_0x75f118){return _0x75f118;});}return null;};}function removeEntity(_0x4804cf,_0x4ddbd2){return function(_0x366e9b){if(_0x366e9b){return _0x366e9b['destroy']()[_0x66c7('0x1d')](function(){_0x4804cf[_0x66c7('0x18')](0xcc)[_0x66c7('0x19')]();});}};}function handleEntityNotFound(_0x1fc9d3,_0x5bfaf6){return function(_0x2736df){if(!_0x2736df){_0x1fc9d3[_0x66c7('0x17')](0x194);}return _0x2736df;};}function handleError(_0x5b28e6,_0x2ae31f){_0x2ae31f=_0x2ae31f||0x1f4;return function(_0x11a6b9){logger[_0x66c7('0x1e')](_0x11a6b9[_0x66c7('0x1f')]);if(_0x11a6b9[_0x66c7('0x20')]){delete _0x11a6b9['name'];}_0x5b28e6['status'](_0x2ae31f)['send'](_0x11a6b9);};}exports[_0x66c7('0x21')]=function(_0x542ff1,_0x5c5e42){var _0x9afd50={},_0x3e979d={},_0x205b7e={'count':0x0,'rows':[]};var _0xb4b65b=_[_0x66c7('0x22')](db[_0x66c7('0x23')]['rawAttributes'],function(_0xccefb2){return{'name':_0xccefb2[_0x66c7('0x24')],'type':_0xccefb2[_0x66c7('0x25')][_0x66c7('0x26')]};});_0x3e979d[_0x66c7('0x27')]=_['map'](_0xb4b65b,_0x66c7('0x20'));_0x3e979d['query']=_[_0x66c7('0x28')](_0x542ff1['query']);_0x3e979d[_0x66c7('0x29')]=_[_0x66c7('0x2a')](_0x3e979d[_0x66c7('0x27')],_0x3e979d[_0x66c7('0x2b')]);_0x9afd50[_0x66c7('0x2c')]=_[_0x66c7('0x2a')](_0x3e979d['model'],qs['fields'](_0x542ff1[_0x66c7('0x2b')][_0x66c7('0x2d')]));_0x9afd50[_0x66c7('0x2c')]=_0x9afd50[_0x66c7('0x2c')][_0x66c7('0x2e')]?_0x9afd50[_0x66c7('0x2c')]:_0x3e979d[_0x66c7('0x27')];if(!_0x542ff1[_0x66c7('0x2b')][_0x66c7('0x2f')](_0x66c7('0x30'))){_0x9afd50[_0x66c7('0x31')]=qs[_0x66c7('0x31')](_0x542ff1['query']['limit']);_0x9afd50[_0x66c7('0x32')]=qs[_0x66c7('0x32')](_0x542ff1[_0x66c7('0x2b')][_0x66c7('0x32')]);}_0x9afd50[_0x66c7('0x33')]=qs[_0x66c7('0x34')](_0x542ff1[_0x66c7('0x2b')]['sort']);_0x9afd50[_0x66c7('0x35')]=qs[_0x66c7('0x29')](_[_0x66c7('0x36')](_0x542ff1[_0x66c7('0x2b')],_0x3e979d[_0x66c7('0x29')]),_0xb4b65b);if(_0x542ff1[_0x66c7('0x2b')][_0x66c7('0x37')]){_0x9afd50[_0x66c7('0x35')]=_[_0x66c7('0x38')](_0x9afd50[_0x66c7('0x35')],{'$or':_[_0x66c7('0x22')](_0xb4b65b,function(_0x4cd663){if(_0x4cd663['type']!==_0x66c7('0x39')){var _0x1b704c={};_0x1b704c[_0x4cd663[_0x66c7('0x20')]]={'$like':'%'+_0x542ff1['query']['filter']+'%'};return _0x1b704c;}})});}_0x9afd50=_[_0x66c7('0x38')]({},_0x9afd50,_0x542ff1[_0x66c7('0x3a')]);var _0x501771={'where':_0x9afd50[_0x66c7('0x35')]};return db[_0x66c7('0x23')][_0x66c7('0x3b')](_0x501771)['then'](function(_0x20374a){_0x205b7e[_0x66c7('0x3b')]=_0x20374a;if(_0x542ff1[_0x66c7('0x2b')][_0x66c7('0x3c')]){_0x9afd50[_0x66c7('0x3d')]=[{'all':!![]}];}return db[_0x66c7('0x23')][_0x66c7('0x3e')](_0x9afd50);})[_0x66c7('0x1d')](function(_0x28ffe9){_0x205b7e['rows']=_0x28ffe9;return _0x205b7e;})[_0x66c7('0x1d')](respondWithFilteredResult(_0x5c5e42,_0x9afd50))[_0x66c7('0x3f')](handleError(_0x5c5e42,null));};exports[_0x66c7('0x40')]=function(_0x17a1e8,_0x3f169e){var _0x28983c={'raw':!![],'where':{'id':_0x17a1e8[_0x66c7('0x41')]['id']}},_0x85274={};_0x85274[_0x66c7('0x27')]=_[_0x66c7('0x28')](db['SquareReport']['rawAttributes']);_0x85274['query']=_[_0x66c7('0x28')](_0x17a1e8[_0x66c7('0x2b')]);_0x85274['filtears']=_['intersection'](_0x85274[_0x66c7('0x27')],_0x85274[_0x66c7('0x2b')]);_0x28983c[_0x66c7('0x2c')]=_[_0x66c7('0x2a')](_0x85274[_0x66c7('0x27')],qs['fields'](_0x17a1e8[_0x66c7('0x2b')]['fields']));_0x28983c['attributes']=_0x28983c[_0x66c7('0x2c')][_0x66c7('0x2e')]?_0x28983c[_0x66c7('0x2c')]:_0x85274[_0x66c7('0x27')];if(_0x17a1e8['query']['includeAll']){_0x28983c[_0x66c7('0x3d')]=[{'all':!![]}];}_0x28983c=_['merge']({},_0x28983c,_0x17a1e8['options']);return db[_0x66c7('0x23')][_0x66c7('0x42')](_0x28983c)[_0x66c7('0x1d')](handleEntityNotFound(_0x3f169e,null))[_0x66c7('0x1d')](respondWithResult(_0x3f169e,null))['catch'](handleError(_0x3f169e,null));};exports[_0x66c7('0x43')]=function(_0x108a92,_0x2c8ffe){return db['SquareReport'][_0x66c7('0x43')](_0x108a92[_0x66c7('0x44')],{})[_0x66c7('0x1d')](respondWithResult(_0x2c8ffe,0xc9))[_0x66c7('0x3f')](handleError(_0x2c8ffe,null));};exports[_0x66c7('0x1c')]=function(_0x3b4f34,_0x2e3f06){if(_0x3b4f34[_0x66c7('0x44')]['id']){delete _0x3b4f34['body']['id'];}return db[_0x66c7('0x23')][_0x66c7('0x42')]({'where':{'id':_0x3b4f34[_0x66c7('0x41')]['id']}})[_0x66c7('0x1d')](handleEntityNotFound(_0x2e3f06,null))[_0x66c7('0x1d')](saveUpdates(_0x3b4f34[_0x66c7('0x44')],null))[_0x66c7('0x1d')](respondWithResult(_0x2e3f06,null))[_0x66c7('0x3f')](handleError(_0x2e3f06,null));};exports[_0x66c7('0x45')]=function(_0x2d8eeb,_0x9e2346){return db[_0x66c7('0x23')][_0x66c7('0x42')]({'where':{'id':_0x2d8eeb[_0x66c7('0x41')]['id']}})['then'](handleEntityNotFound(_0x9e2346,null))[_0x66c7('0x1d')](removeEntity(_0x9e2346,null))[_0x66c7('0x3f')](handleError(_0x9e2346,null));};exports[_0x66c7('0x46')]=function(_0x104c8b,_0x533ff5){return db[_0x66c7('0x23')][_0x66c7('0x46')]()['then'](respondWithResult(_0x533ff5,null))[_0x66c7('0x3f')](handleError(_0x533ff5,null));}; \ No newline at end of file +var _0x06ef=['SquareReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','filtears','find','catch','create','body','destroy','describe','rimraf','bluebird','mustache','util','sox','to-csv','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','index','map'];(function(_0x294a50,_0x56fcd7){var _0x22da5e=function(_0x4a1d8c){while(--_0x4a1d8c){_0x294a50['push'](_0x294a50['shift']());}};_0x22da5e(++_0x56fcd7);}(_0x06ef,0x185));var _0xf06e=function(_0x2d9f8b,_0x1eca48){_0x2d9f8b=_0x2d9f8b-0x0;var _0x251209=_0x06ef[_0x2d9f8b];return _0x251209;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xf06e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf06e('0x1'));var Mustache=require(_0xf06e('0x2'));var util=require(_0xf06e('0x3'));var path=require('path');var sox=require(_0xf06e('0x4'));var csv=require(_0xf06e('0x5'));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(_0xf06e('0x6'));var toCsv=require(_0xf06e('0x5'));var querystring=require(_0xf06e('0x7'));var Papa=require(_0xf06e('0x8'));var Redis=require(_0xf06e('0x9'));var authService=require('../../components/auth/service');var qs=require(_0xf06e('0xa'));var as=require(_0xf06e('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf06e('0xc'))(_0xf06e('0xd'));var utils=require(_0xf06e('0xe'));var config=require(_0xf06e('0xf'));var licenseUtil=require(_0xf06e('0x10'));var db=require(_0xf06e('0x11'))['db'];function respondWithStatusCode(_0x49fe5d,_0x3daa50){_0x3daa50=_0x3daa50||0xcc;return function(_0x2578e4){if(_0x2578e4){return _0x49fe5d['sendStatus'](_0x3daa50);}return _0x49fe5d[_0xf06e('0x12')](_0x3daa50)[_0xf06e('0x13')]();};}function respondWithResult(_0x59f60b,_0x4e6dd8){_0x4e6dd8=_0x4e6dd8||0xc8;return function(_0x5c862b){if(_0x5c862b){return _0x59f60b[_0xf06e('0x12')](_0x4e6dd8)[_0xf06e('0x14')](_0x5c862b);}};}function respondWithFilteredResult(_0x36f38f,_0x55dce1){return function(_0x3fdacc){if(_0x3fdacc){var _0x375f90=_0x3fdacc[_0xf06e('0x15')],_0x3629f3=_0x55dce1[_0xf06e('0x16')],_0xab4288=_0x55dce1['offset']+_0x55dce1[_0xf06e('0x17')],_0x44157a;if(_0xab4288>=_0x375f90){_0xab4288=_0x375f90;_0x44157a=0xc8;}else{_0x44157a=0xce;}_0x36f38f[_0xf06e('0x12')](_0x44157a);return _0x36f38f[_0xf06e('0x18')](_0xf06e('0x19'),_0x3629f3+'-'+_0xab4288+'/'+_0x375f90)['json'](_0x3fdacc);}return null;};}function patchUpdates(_0x54c08d){return function(_0x171763){try{jsonpatch[_0xf06e('0x1a')](_0x171763,_0x54c08d,!![]);}catch(_0x5d66f9){return BPromise['reject'](_0x5d66f9);}return _0x171763[_0xf06e('0x1b')]();};}function saveUpdates(_0x211590,_0x167ad3){return function(_0x5db0be){if(_0x5db0be){return _0x5db0be[_0xf06e('0x1c')](_0x211590)[_0xf06e('0x1d')](function(_0x5ecd73){return _0x5ecd73;});}return null;};}function removeEntity(_0x3c3796,_0x1ba130){return function(_0x445e2b){if(_0x445e2b){return _0x445e2b['destroy']()[_0xf06e('0x1d')](function(){_0x3c3796[_0xf06e('0x12')](0xcc)[_0xf06e('0x13')]();});}};}function handleEntityNotFound(_0x13e484,_0x3b410e){return function(_0x4c2d01){if(!_0x4c2d01){_0x13e484[_0xf06e('0x1e')](0x194);}return _0x4c2d01;};}function handleError(_0x4923d3,_0x22e5da){_0x22e5da=_0x22e5da||0x1f4;return function(_0x36b816){logger[_0xf06e('0x1f')](_0x36b816[_0xf06e('0x20')]);if(_0x36b816[_0xf06e('0x21')]){delete _0x36b816[_0xf06e('0x21')];}_0x4923d3['status'](_0x22e5da)[_0xf06e('0x22')](_0x36b816);};}exports[_0xf06e('0x23')]=function(_0x873aa5,_0x1b1d2a){var _0x164fa9={},_0x57063f={},_0x19e8d3={'count':0x0,'rows':[]};var _0x2ccbd0=_[_0xf06e('0x24')](db[_0xf06e('0x25')][_0xf06e('0x26')],function(_0x25bacb){return{'name':_0x25bacb['fieldName'],'type':_0x25bacb[_0xf06e('0x27')][_0xf06e('0x28')]};});_0x57063f[_0xf06e('0x29')]=_['map'](_0x2ccbd0,_0xf06e('0x21'));_0x57063f[_0xf06e('0x2a')]=_[_0xf06e('0x2b')](_0x873aa5[_0xf06e('0x2a')]);_0x57063f[_0xf06e('0x2c')]=_[_0xf06e('0x2d')](_0x57063f[_0xf06e('0x29')],_0x57063f[_0xf06e('0x2a')]);_0x164fa9[_0xf06e('0x2e')]=_['intersection'](_0x57063f['model'],qs[_0xf06e('0x2f')](_0x873aa5[_0xf06e('0x2a')]['fields']));_0x164fa9[_0xf06e('0x2e')]=_0x164fa9[_0xf06e('0x2e')][_0xf06e('0x30')]?_0x164fa9[_0xf06e('0x2e')]:_0x57063f[_0xf06e('0x29')];if(!_0x873aa5[_0xf06e('0x2a')]['hasOwnProperty'](_0xf06e('0x31'))){_0x164fa9[_0xf06e('0x17')]=qs[_0xf06e('0x17')](_0x873aa5['query'][_0xf06e('0x17')]);_0x164fa9[_0xf06e('0x16')]=qs[_0xf06e('0x16')](_0x873aa5[_0xf06e('0x2a')][_0xf06e('0x16')]);}_0x164fa9[_0xf06e('0x32')]=qs[_0xf06e('0x33')](_0x873aa5['query']['sort']);_0x164fa9[_0xf06e('0x34')]=qs['filters'](_[_0xf06e('0x35')](_0x873aa5['query'],_0x57063f[_0xf06e('0x2c')]),_0x2ccbd0);if(_0x873aa5['query'][_0xf06e('0x36')]){_0x164fa9[_0xf06e('0x34')]=_[_0xf06e('0x37')](_0x164fa9[_0xf06e('0x34')],{'$or':_[_0xf06e('0x24')](_0x2ccbd0,function(_0x260f74){if(_0x260f74['type']!==_0xf06e('0x38')){var _0xb20e60={};_0xb20e60[_0x260f74[_0xf06e('0x21')]]={'$like':'%'+_0x873aa5[_0xf06e('0x2a')][_0xf06e('0x36')]+'%'};return _0xb20e60;}})});}_0x164fa9=_[_0xf06e('0x37')]({},_0x164fa9,_0x873aa5[_0xf06e('0x39')]);var _0x152da2={'where':_0x164fa9[_0xf06e('0x34')]};return db[_0xf06e('0x25')][_0xf06e('0x15')](_0x152da2)['then'](function(_0x4085d6){_0x19e8d3[_0xf06e('0x15')]=_0x4085d6;if(_0x873aa5[_0xf06e('0x2a')][_0xf06e('0x3a')]){_0x164fa9[_0xf06e('0x3b')]=[{'all':!![]}];}return db[_0xf06e('0x25')][_0xf06e('0x3c')](_0x164fa9);})['then'](function(_0x27c5f8){_0x19e8d3[_0xf06e('0x3d')]=_0x27c5f8;return _0x19e8d3;})['then'](respondWithFilteredResult(_0x1b1d2a,_0x164fa9))['catch'](handleError(_0x1b1d2a,null));};exports[_0xf06e('0x3e')]=function(_0x2df541,_0x3ae06c){var _0x7fc745={'raw':!![],'where':{'id':_0x2df541[_0xf06e('0x3f')]['id']}},_0x3b3f7d={};_0x3b3f7d['model']=_['keys'](db[_0xf06e('0x25')]['rawAttributes']);_0x3b3f7d['query']=_['keys'](_0x2df541[_0xf06e('0x2a')]);_0x3b3f7d[_0xf06e('0x40')]=_['intersection'](_0x3b3f7d['model'],_0x3b3f7d[_0xf06e('0x2a')]);_0x7fc745[_0xf06e('0x2e')]=_['intersection'](_0x3b3f7d[_0xf06e('0x29')],qs['fields'](_0x2df541[_0xf06e('0x2a')][_0xf06e('0x2f')]));_0x7fc745[_0xf06e('0x2e')]=_0x7fc745[_0xf06e('0x2e')]['length']?_0x7fc745[_0xf06e('0x2e')]:_0x3b3f7d[_0xf06e('0x29')];if(_0x2df541['query'][_0xf06e('0x3a')]){_0x7fc745[_0xf06e('0x3b')]=[{'all':!![]}];}_0x7fc745=_[_0xf06e('0x37')]({},_0x7fc745,_0x2df541[_0xf06e('0x39')]);return db[_0xf06e('0x25')][_0xf06e('0x41')](_0x7fc745)[_0xf06e('0x1d')](handleEntityNotFound(_0x3ae06c,null))[_0xf06e('0x1d')](respondWithResult(_0x3ae06c,null))[_0xf06e('0x42')](handleError(_0x3ae06c,null));};exports[_0xf06e('0x43')]=function(_0x1e8a06,_0x50d3a5){return db['SquareReport'][_0xf06e('0x43')](_0x1e8a06['body'],{})['then'](respondWithResult(_0x50d3a5,0xc9))[_0xf06e('0x42')](handleError(_0x50d3a5,null));};exports[_0xf06e('0x1c')]=function(_0x324aaf,_0x3e3137){if(_0x324aaf[_0xf06e('0x44')]['id']){delete _0x324aaf[_0xf06e('0x44')]['id'];}return db[_0xf06e('0x25')][_0xf06e('0x41')]({'where':{'id':_0x324aaf['params']['id']}})[_0xf06e('0x1d')](handleEntityNotFound(_0x3e3137,null))[_0xf06e('0x1d')](saveUpdates(_0x324aaf['body'],null))[_0xf06e('0x1d')](respondWithResult(_0x3e3137,null))[_0xf06e('0x42')](handleError(_0x3e3137,null));};exports[_0xf06e('0x45')]=function(_0x4c8824,_0x544319){return db[_0xf06e('0x25')][_0xf06e('0x41')]({'where':{'id':_0x4c8824[_0xf06e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x544319,null))[_0xf06e('0x1d')](removeEntity(_0x544319,null))[_0xf06e('0x42')](handleError(_0x544319,null));};exports[_0xf06e('0x46')]=function(_0x476d25,_0x5ae817){return db['SquareReport'][_0xf06e('0x46')]()['then'](respondWithResult(_0x5ae817,null))['catch'](handleError(_0x5ae817,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 6f6a336..7970e24 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 _0xbe1e=['api','moment','bluebird','request-promise','./squareReport.attributes','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xbe1e,0x13f));var _0xebe1=function(_0x28d6a2,_0x28fc9a){_0x28d6a2=_0x28d6a2-0x0;var _0x210e73=_0xbe1e[_0x28d6a2];return _0x210e73;};'use strict';var _=require(_0xebe1('0x0'));var util=require(_0xebe1('0x1'));var logger=require(_0xebe1('0x2'))(_0xebe1('0x3'));var moment=require(_0xebe1('0x4'));var BPromise=require(_0xebe1('0x5'));var rp=require(_0xebe1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xebe1('0x7'));module['exports']=function(_0x53e749,_0x41d634){return _0x53e749['define'](_0xebe1('0x8'),attributes,{'tableName':_0xebe1('0x9'),'paranoid':![],'indexes':[{'name':_0xebe1('0xa'),'fields':[_0xebe1('0xb'),_0xebe1('0xc')]},{'name':_0xebe1('0xd'),'fields':[_0xebe1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c9d=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api'];(function(_0x4696f1,_0x5b6379){var _0x4fdfa0=function(_0x50a0d8){while(--_0x50a0d8){_0x4696f1['push'](_0x4696f1['shift']());}};_0x4fdfa0(++_0x5b6379);}(_0x9c9d,0x1cd));var _0xd9c9=function(_0x47c0d5,_0x1ab3d9){_0x47c0d5=_0x47c0d5-0x0;var _0x3d4d57=_0x9c9d[_0x47c0d5];return _0x3d4d57;};'use strict';var _=require(_0xd9c9('0x0'));var util=require(_0xd9c9('0x1'));var logger=require(_0xd9c9('0x2'))(_0xd9c9('0x3'));var moment=require(_0xd9c9('0x4'));var BPromise=require(_0xd9c9('0x5'));var rp=require(_0xd9c9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd9c9('0x7'));var config=require(_0xd9c9('0x8'));var attributes=require('./squareReport.attributes');module[_0xd9c9('0x9')]=function(_0x43bcdb,_0x483dc8){return _0x43bcdb['define'](_0xd9c9('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xd9c9('0xb'),'fields':[_0xd9c9('0xc'),_0xd9c9('0xd')]},{'name':_0xd9c9('0xe'),'fields':[_0xd9c9('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 6eb3cf9..65ec584 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 _0xabce=['CreateSquareReport','SquareReport','create','options','raw','UpdateSquareReport','body','where','attributes','limit','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xabce,0x103));var _0xeabc=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xabce[_0x5783f4];return _0x28e380;};'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});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('SquareReport,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')](_0x58a3c0['body'],{'raw':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0['options'][_0xeabc('0x18')]===undefined?!![]:![]:!![]})[_0xeabc('0x9')](function(_0x502947){logger[_0xeabc('0xa')](_0xeabc('0x14'),_0x58a3c0);logger[_0xeabc('0xd')](_0xeabc('0x14'),_0x58a3c0,JSON[_0xeabc('0xf')](_0x502947));_0x31dd53(_0x502947);})['catch'](function(_0xecdbf){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0xecdbf['message'],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0xecdbf[_0xeabc('0x12')]));});});};exports[_0xeabc('0x19')]=function(_0x319119){var _0x5b8838=this;return new Promise(function(_0x109e1d,_0x480440){return db[_0xeabc('0x15')]['update'](_0x319119[_0xeabc('0x1a')],{'raw':_0x319119[_0xeabc('0x17')]?_0x319119[_0xeabc('0x17')][_0xeabc('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x319119[_0xeabc('0x17')]?_0x319119[_0xeabc('0x17')][_0xeabc('0x1b')]||null:null,'attributes':_0x319119['options']?_0x319119['options'][_0xeabc('0x1c')]||null:null,'limit':_0x319119['options']?_0x319119[_0xeabc('0x17')][_0xeabc('0x1d')]||null:null})['then'](function(_0x2163e6){logger[_0xeabc('0xa')](_0xeabc('0x19'),_0x319119);logger[_0xeabc('0xd')](_0xeabc('0x19'),_0x319119,JSON[_0xeabc('0xf')](_0x2163e6));_0x109e1d(_0x2163e6);})[_0xeabc('0x1e')](function(_0x38dc0a){logger[_0xeabc('0x10')]('UpdateSquareReport',_0x38dc0a[_0xeabc('0x12')],_0x319119);_0x480440(_0x5b8838['error'](0x1f4,_0x38dc0a[_0xeabc('0x12')]));});});}; \ No newline at end of file +var _0xf2ca=['then','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','SquareReport','create','body','options','raw','CreateSquareReport','UpdateSquareReport','update','where','attributes','limit'];(function(_0x315222,_0x3c5bd0){var _0x218c49=function(_0x44ecaa){while(--_0x44ecaa){_0x315222['push'](_0x315222['shift']());}};_0x218c49(++_0x3c5bd0);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x2652ef,_0x234230){_0x2652ef=_0x2652ef-0x0;var _0x2db578=_0xf2ca[_0x2652ef];return _0x2db578;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var moment=require(_0xaf2c('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf2c('0x3'));var fs=require('fs');var Redis=require(_0xaf2c('0x4'));var db=require(_0xaf2c('0x5'))['db'];var utils=require(_0xaf2c('0x6'));var logger=require(_0xaf2c('0x7'))(_0xaf2c('0x8'));var config=require('../../config/environment');var jayson=require(_0xaf2c('0x9'));var client=jayson[_0xaf2c('0xa')][_0xaf2c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f9531,_0x58351f,_0x37fedd){return new BPromise(function(_0x3c0421,_0x4a7397){return client[_0xaf2c('0xc')](_0x1f9531,_0x37fedd)['then'](function(_0x439ca3){logger['info'](_0xaf2c('0xd'),_0x58351f,_0xaf2c('0xe'));logger[_0xaf2c('0xf')](_0xaf2c('0x10'),_0x58351f,'request\x20sent',JSON['stringify'](_0x439ca3));if(_0x439ca3[_0xaf2c('0x11')]){if(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x12')]===0x1f4){logger[_0xaf2c('0x11')](_0xaf2c('0xd'),_0x58351f,_0x439ca3['error']['message']);return _0x4a7397(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);}logger[_0xaf2c('0x11')](_0xaf2c('0xd'),_0x58351f,_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);return _0x3c0421(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);}else{logger[_0xaf2c('0x14')](_0xaf2c('0xd'),_0x58351f,_0xaf2c('0xe'));_0x3c0421(_0x439ca3[_0xaf2c('0x15')][_0xaf2c('0x13')]);}})[_0xaf2c('0x16')](function(_0x705d09){logger['error'](_0xaf2c('0xd'),_0x58351f,_0x705d09);_0x4a7397(_0x705d09);});});}exports['CreateSquareReport']=function(_0x278a28){var _0x474c80=this;return new Promise(function(_0x1d544a,_0x578492){return db[_0xaf2c('0x17')][_0xaf2c('0x18')](_0x278a28[_0xaf2c('0x19')],{'raw':_0x278a28[_0xaf2c('0x1a')]?_0x278a28[_0xaf2c('0x1a')][_0xaf2c('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x35e712){logger[_0xaf2c('0x14')](_0xaf2c('0x1c'),_0x278a28);logger[_0xaf2c('0xf')](_0xaf2c('0x1c'),_0x278a28,JSON['stringify'](_0x35e712));_0x1d544a(_0x35e712);})[_0xaf2c('0x16')](function(_0xbf6f62){logger[_0xaf2c('0x11')]('CreateSquareReport',_0xbf6f62['message'],_0x278a28);_0x578492(_0x474c80[_0xaf2c('0x11')](0x1f4,_0xbf6f62[_0xaf2c('0x13')]));});});};exports[_0xaf2c('0x1d')]=function(_0x99f78d){var _0x591aff=this;return new Promise(function(_0x2b8f1a,_0xf1a7cf){return db[_0xaf2c('0x17')][_0xaf2c('0x1e')](_0x99f78d[_0xaf2c('0x19')],{'raw':_0x99f78d[_0xaf2c('0x1a')]?_0x99f78d[_0xaf2c('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x99f78d[_0xaf2c('0x1a')]?_0x99f78d[_0xaf2c('0x1a')][_0xaf2c('0x1f')]||null:null,'attributes':_0x99f78d[_0xaf2c('0x1a')]?_0x99f78d['options'][_0xaf2c('0x20')]||null:null,'limit':_0x99f78d['options']?_0x99f78d[_0xaf2c('0x1a')][_0xaf2c('0x21')]||null:null})[_0xaf2c('0x22')](function(_0x5d685a){logger[_0xaf2c('0x14')](_0xaf2c('0x1d'),_0x99f78d);logger[_0xaf2c('0xf')]('UpdateSquareReport',_0x99f78d,JSON[_0xaf2c('0x23')](_0x5d685a));_0x2b8f1a(_0x5d685a);})[_0xaf2c('0x16')](function(_0x42e2a5){logger[_0xaf2c('0x11')]('UpdateSquareReport',_0x42e2a5[_0xaf2c('0x13')],_0x99f78d);_0xf1a7cf(_0x591aff[_0xaf2c('0x11')](0x1f4,_0x42e2a5[_0xaf2c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 85c1182..aa88c06 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 _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x186ee2,_0x398ac0){var _0x5e287c=function(_0x5a00e3){while(--_0x5a00e3){_0x186ee2['push'](_0x186ee2['shift']());}};_0x5e287c(++_0x398ac0);}(_0x7a54,0x106));var _0x47a5=function(_0x5623d8,_0x12a9d4){_0x5623d8=_0x5623d8-0x0;var _0x44c9e9=_0x7a54[_0x5623d8];return _0x44c9e9;};'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 +var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x334504,_0x53c802){var _0x36a7ca=function(_0x47f18a){while(--_0x47f18a){_0x334504['push'](_0x334504['shift']());}};_0x36a7ca(++_0x53c802);}(_0x7a54,0x106));var _0x47a5=function(_0x457a2d,_0x4a7d77){_0x457a2d=_0x457a2d-0x0;var _0xab4f00=_0x7a54[_0x457a2d];return _0xab4f00;};'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 c2ca965..230ca31 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 _0x9493=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9493,0x15f));var _0x3949=function(_0x468c7a,_0xec6861){_0x468c7a=_0x468c7a-0x0;var _0x39c3a4=_0x9493[_0x468c7a];return _0x39c3a4;};'use strict';var Sequelize=require(_0x3949('0x0'));module[_0x3949('0x1')]={'uniqueid':{'type':Sequelize[_0x3949('0x2')]},'node':{'type':Sequelize[_0x3949('0x2')]},'application':{'type':Sequelize[_0x3949('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x3949('0x2')]},'callerid':{'type':Sequelize[_0x3949('0x2')]}}; \ No newline at end of file +var _0xceb4=['STRING','TEXT','exports'];(function(_0x2c8be2,_0x16dc35){var _0x4543fa=function(_0x2b7d24){while(--_0x2b7d24){_0x2c8be2['push'](_0x2c8be2['shift']());}};_0x4543fa(++_0x16dc35);}(_0xceb4,0x65));var _0x4ceb=function(_0xb4788,_0x1efb8d){_0xb4788=_0xb4788-0x0;var _0xd49d21=_0xceb4[_0xb4788];return _0xd49d21;};'use strict';var Sequelize=require('sequelize');module[_0x4ceb('0x0')]={'uniqueid':{'type':Sequelize[_0x4ceb('0x1')]},'node':{'type':Sequelize[_0x4ceb('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x4ceb('0x2')]},'project_name':{'type':Sequelize[_0x4ceb('0x1')]},'callerid':{'type':Sequelize[_0x4ceb('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 62d1271..ed1e4b4 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 _0x7a59=['filtears','find','create','body','params','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','Content-Range','reject','save','update','then','error','stack','name','send','index','map','SquareDetailsReport','fieldName','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','filters','pick','merge','filter','options','include','findAll','catch','show'];(function(_0x54393d,_0x438f0a){var _0x3cc026=function(_0x13ddbc){while(--_0x13ddbc){_0x54393d['push'](_0x54393d['shift']());}};_0x3cc026(++_0x438f0a);}(_0x7a59,0x16e));var _0x97a5=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x7a59[_0x4ab3fb];return _0x34fe1e;};'use strict';var pdf=require(_0x97a5('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x97a5('0x1'));var jsonpatch=require(_0x97a5('0x2'));var rp=require(_0x97a5('0x3'));var moment=require(_0x97a5('0x4'));var BPromise=require(_0x97a5('0x5'));var Mustache=require('mustache');var util=require(_0x97a5('0x6'));var path=require(_0x97a5('0x7'));var sox=require(_0x97a5('0x8'));var csv=require('to-csv');var ejs=require(_0x97a5('0x9'));var fs=require('fs');var _=require(_0x97a5('0xa'));var squel=require(_0x97a5('0xb'));var crypto=require(_0x97a5('0xc'));var jsforce=require(_0x97a5('0xd'));var deskjs=require(_0x97a5('0xe'));var toCsv=require(_0x97a5('0xf'));var querystring=require('querystring');var Papa=require(_0x97a5('0x10'));var Redis=require(_0x97a5('0x11'));var authService=require(_0x97a5('0x12'));var qs=require(_0x97a5('0x13'));var as=require(_0x97a5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x97a5('0x15'));var utils=require(_0x97a5('0x16'));var config=require(_0x97a5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x97a5('0x18'))['db'];function respondWithStatusCode(_0x350720,_0x55305a){_0x55305a=_0x55305a||0xcc;return function(_0x4f85a0){if(_0x4f85a0){return _0x350720[_0x97a5('0x19')](_0x55305a);}return _0x350720[_0x97a5('0x1a')](_0x55305a)['end']();};}function respondWithResult(_0x595437,_0x51d5e2){_0x51d5e2=_0x51d5e2||0xc8;return function(_0x5a4471){if(_0x5a4471){return _0x595437[_0x97a5('0x1a')](_0x51d5e2)[_0x97a5('0x1b')](_0x5a4471);}};}function respondWithFilteredResult(_0x3603e4,_0x4d8ba7){return function(_0x1a7a62){if(_0x1a7a62){var _0x3fa986=_0x1a7a62[_0x97a5('0x1c')],_0x531ed8=_0x4d8ba7['offset'],_0x1178d5=_0x4d8ba7['offset']+_0x4d8ba7['limit'],_0x5ee8ca;if(_0x1178d5>=_0x3fa986){_0x1178d5=_0x3fa986;_0x5ee8ca=0xc8;}else{_0x5ee8ca=0xce;}_0x3603e4[_0x97a5('0x1a')](_0x5ee8ca);return _0x3603e4['set'](_0x97a5('0x1d'),_0x531ed8+'-'+_0x1178d5+'/'+_0x3fa986)[_0x97a5('0x1b')](_0x1a7a62);}return null;};}function patchUpdates(_0x3e87b2){return function(_0x1efe8c){try{jsonpatch['apply'](_0x1efe8c,_0x3e87b2,!![]);}catch(_0x57dc28){return BPromise[_0x97a5('0x1e')](_0x57dc28);}return _0x1efe8c[_0x97a5('0x1f')]();};}function saveUpdates(_0x4e3386,_0x51858b){return function(_0x3d54a3){if(_0x3d54a3){return _0x3d54a3[_0x97a5('0x20')](_0x4e3386)[_0x97a5('0x21')](function(_0x587f2c){return _0x587f2c;});}return null;};}function removeEntity(_0x34fb55,_0x3a5849){return function(_0x23f4f8){if(_0x23f4f8){return _0x23f4f8['destroy']()[_0x97a5('0x21')](function(){_0x34fb55[_0x97a5('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e731e,_0x469592){return function(_0x233b29){if(!_0x233b29){_0x5e731e[_0x97a5('0x19')](0x194);}return _0x233b29;};}function handleError(_0x282192,_0x5239f2){_0x5239f2=_0x5239f2||0x1f4;return function(_0x302d78){logger[_0x97a5('0x22')](_0x302d78[_0x97a5('0x23')]);if(_0x302d78['name']){delete _0x302d78[_0x97a5('0x24')];}_0x282192[_0x97a5('0x1a')](_0x5239f2)[_0x97a5('0x25')](_0x302d78);};}exports[_0x97a5('0x26')]=function(_0x2076e9,_0x46846f){var _0x5c0517={},_0x1dcf5f={},_0x3eff21={'count':0x0,'rows':[]};var _0x5bdf34=_[_0x97a5('0x27')](db[_0x97a5('0x28')]['rawAttributes'],function(_0x1bdb74){return{'name':_0x1bdb74[_0x97a5('0x29')],'type':_0x1bdb74['type'][_0x97a5('0x2a')]};});_0x1dcf5f['model']=_[_0x97a5('0x27')](_0x5bdf34,_0x97a5('0x24'));_0x1dcf5f[_0x97a5('0x2b')]=_[_0x97a5('0x2c')](_0x2076e9['query']);_0x1dcf5f['filters']=_[_0x97a5('0x2d')](_0x1dcf5f[_0x97a5('0x2e')],_0x1dcf5f[_0x97a5('0x2b')]);_0x5c0517['attributes']=_[_0x97a5('0x2d')](_0x1dcf5f[_0x97a5('0x2e')],qs['fields'](_0x2076e9[_0x97a5('0x2b')][_0x97a5('0x2f')]));_0x5c0517['attributes']=_0x5c0517[_0x97a5('0x30')][_0x97a5('0x31')]?_0x5c0517[_0x97a5('0x30')]:_0x1dcf5f['model'];if(!_0x2076e9[_0x97a5('0x2b')][_0x97a5('0x32')](_0x97a5('0x33'))){_0x5c0517[_0x97a5('0x34')]=qs[_0x97a5('0x34')](_0x2076e9[_0x97a5('0x2b')][_0x97a5('0x34')]);_0x5c0517['offset']=qs[_0x97a5('0x35')](_0x2076e9[_0x97a5('0x2b')][_0x97a5('0x35')]);}_0x5c0517[_0x97a5('0x36')]=qs[_0x97a5('0x37')](_0x2076e9[_0x97a5('0x2b')][_0x97a5('0x37')]);_0x5c0517[_0x97a5('0x38')]=qs[_0x97a5('0x39')](_[_0x97a5('0x3a')](_0x2076e9[_0x97a5('0x2b')],_0x1dcf5f[_0x97a5('0x39')]),_0x5bdf34);if(_0x2076e9[_0x97a5('0x2b')]['filter']){_0x5c0517[_0x97a5('0x38')]=_[_0x97a5('0x3b')](_0x5c0517[_0x97a5('0x38')],{'$or':_[_0x97a5('0x27')](_0x5bdf34,function(_0x2aec4e){if(_0x2aec4e['type']!=='VIRTUAL'){var _0x15be39={};_0x15be39[_0x2aec4e[_0x97a5('0x24')]]={'$like':'%'+_0x2076e9[_0x97a5('0x2b')][_0x97a5('0x3c')]+'%'};return _0x15be39;}})});}_0x5c0517=_[_0x97a5('0x3b')]({},_0x5c0517,_0x2076e9[_0x97a5('0x3d')]);var _0x57333b={'where':_0x5c0517[_0x97a5('0x38')]};return db['SquareDetailsReport'][_0x97a5('0x1c')](_0x57333b)[_0x97a5('0x21')](function(_0x30fc3b){_0x3eff21[_0x97a5('0x1c')]=_0x30fc3b;if(_0x2076e9[_0x97a5('0x2b')]['includeAll']){_0x5c0517[_0x97a5('0x3e')]=[{'all':!![]}];}return db[_0x97a5('0x28')][_0x97a5('0x3f')](_0x5c0517);})[_0x97a5('0x21')](function(_0xc0a896){_0x3eff21['rows']=_0xc0a896;return _0x3eff21;})['then'](respondWithFilteredResult(_0x46846f,_0x5c0517))[_0x97a5('0x40')](handleError(_0x46846f,null));};exports[_0x97a5('0x41')]=function(_0xd89561,_0x20dbc6){var _0x52b775={'raw':!![],'where':{'id':_0xd89561['params']['id']}},_0x4742f5={};_0x4742f5[_0x97a5('0x2e')]=_[_0x97a5('0x2c')](db[_0x97a5('0x28')]['rawAttributes']);_0x4742f5[_0x97a5('0x2b')]=_[_0x97a5('0x2c')](_0xd89561['query']);_0x4742f5[_0x97a5('0x42')]=_[_0x97a5('0x2d')](_0x4742f5[_0x97a5('0x2e')],_0x4742f5[_0x97a5('0x2b')]);_0x52b775[_0x97a5('0x30')]=_[_0x97a5('0x2d')](_0x4742f5[_0x97a5('0x2e')],qs[_0x97a5('0x2f')](_0xd89561[_0x97a5('0x2b')][_0x97a5('0x2f')]));_0x52b775[_0x97a5('0x30')]=_0x52b775[_0x97a5('0x30')]['length']?_0x52b775[_0x97a5('0x30')]:_0x4742f5[_0x97a5('0x2e')];if(_0xd89561[_0x97a5('0x2b')]['includeAll']){_0x52b775[_0x97a5('0x3e')]=[{'all':!![]}];}_0x52b775=_[_0x97a5('0x3b')]({},_0x52b775,_0xd89561[_0x97a5('0x3d')]);return db[_0x97a5('0x28')][_0x97a5('0x43')](_0x52b775)['then'](handleEntityNotFound(_0x20dbc6,null))[_0x97a5('0x21')](respondWithResult(_0x20dbc6,null))[_0x97a5('0x40')](handleError(_0x20dbc6,null));};exports[_0x97a5('0x44')]=function(_0xec4726,_0x11feb9){return db['SquareDetailsReport'][_0x97a5('0x44')](_0xec4726['body'],{})[_0x97a5('0x21')](respondWithResult(_0x11feb9,0xc9))[_0x97a5('0x40')](handleError(_0x11feb9,null));};exports[_0x97a5('0x20')]=function(_0x4b3c38,_0xcd4f58){if(_0x4b3c38[_0x97a5('0x45')]['id']){delete _0x4b3c38[_0x97a5('0x45')]['id'];}return db[_0x97a5('0x28')][_0x97a5('0x43')]({'where':{'id':_0x4b3c38[_0x97a5('0x46')]['id']}})['then'](handleEntityNotFound(_0xcd4f58,null))[_0x97a5('0x21')](saveUpdates(_0x4b3c38[_0x97a5('0x45')],null))[_0x97a5('0x21')](respondWithResult(_0xcd4f58,null))[_0x97a5('0x40')](handleError(_0xcd4f58,null));};exports['destroy']=function(_0x4582e9,_0xd9509c){return db['SquareDetailsReport'][_0x97a5('0x43')]({'where':{'id':_0x4582e9[_0x97a5('0x46')]['id']}})[_0x97a5('0x21')](handleEntityNotFound(_0xd9509c,null))['then'](removeEntity(_0xd9509c,null))[_0x97a5('0x40')](handleError(_0xd9509c,null));};exports[_0x97a5('0x47')]=function(_0x495f70,_0x9674a7){return db[_0x97a5('0x28')][_0x97a5('0x47')]()['then'](respondWithResult(_0x9674a7,null))[_0x97a5('0x40')](handleError(_0x9674a7,null));}; \ No newline at end of file +var _0xaba6=['nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','keys','filtears','find','catch','create','body','describe','html-pdf','eml-format','moment','bluebird','util','path','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','SquareDetailsReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x463e24,_0x4029b7){var _0x1d3304=function(_0x1f68f1){while(--_0x1f68f1){_0x463e24['push'](_0x463e24['shift']());}};_0x1d3304(++_0x4029b7);}(_0xaba6,0xe2));var _0x6aba=function(_0x43b34a,_0x39f685){_0x43b34a=_0x43b34a-0x0;var _0x4d4b3b=_0xaba6[_0x43b34a];return _0x4d4b3b;};'use strict';var pdf=require(_0x6aba('0x0'));var emlformat=require(_0x6aba('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6aba('0x2'));var BPromise=require(_0x6aba('0x3'));var Mustache=require('mustache');var util=require(_0x6aba('0x4'));var path=require(_0x6aba('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6aba('0x6'));var squel=require('squel');var crypto=require(_0x6aba('0x7'));var jsforce=require(_0x6aba('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x6aba('0x9'));var querystring=require(_0x6aba('0xa'));var Papa=require('papaparse');var Redis=require(_0x6aba('0xb'));var authService=require(_0x6aba('0xc'));var qs=require(_0x6aba('0xd'));var as=require(_0x6aba('0xe'));var hardwareService=require(_0x6aba('0xf'));var logger=require(_0x6aba('0x10'))(_0x6aba('0x11'));var utils=require('../../config/utils');var config=require(_0x6aba('0x12'));var licenseUtil=require(_0x6aba('0x13'));var db=require(_0x6aba('0x14'))['db'];function respondWithStatusCode(_0x254007,_0x53e604){_0x53e604=_0x53e604||0xcc;return function(_0x313529){if(_0x313529){return _0x254007[_0x6aba('0x15')](_0x53e604);}return _0x254007['status'](_0x53e604)[_0x6aba('0x16')]();};}function respondWithResult(_0x2934c3,_0x252574){_0x252574=_0x252574||0xc8;return function(_0x515272){if(_0x515272){return _0x2934c3[_0x6aba('0x17')](_0x252574)[_0x6aba('0x18')](_0x515272);}};}function respondWithFilteredResult(_0x15d236,_0x4ae616){return function(_0x117235){if(_0x117235){var _0xe0c63f=_0x117235[_0x6aba('0x19')],_0xa3cb32=_0x4ae616[_0x6aba('0x1a')],_0x21921d=_0x4ae616['offset']+_0x4ae616[_0x6aba('0x1b')],_0x379b17;if(_0x21921d>=_0xe0c63f){_0x21921d=_0xe0c63f;_0x379b17=0xc8;}else{_0x379b17=0xce;}_0x15d236[_0x6aba('0x17')](_0x379b17);return _0x15d236[_0x6aba('0x1c')]('Content-Range',_0xa3cb32+'-'+_0x21921d+'/'+_0xe0c63f)[_0x6aba('0x18')](_0x117235);}return null;};}function patchUpdates(_0x4b0ed4){return function(_0x4dd600){try{jsonpatch[_0x6aba('0x1d')](_0x4dd600,_0x4b0ed4,!![]);}catch(_0x593bd7){return BPromise[_0x6aba('0x1e')](_0x593bd7);}return _0x4dd600[_0x6aba('0x1f')]();};}function saveUpdates(_0x37b275,_0xb2f624){return function(_0x110be5){if(_0x110be5){return _0x110be5[_0x6aba('0x20')](_0x37b275)[_0x6aba('0x21')](function(_0x5953f2){return _0x5953f2;});}return null;};}function removeEntity(_0x2e5f65,_0x41464f){return function(_0x41744c){if(_0x41744c){return _0x41744c[_0x6aba('0x22')]()[_0x6aba('0x21')](function(){_0x2e5f65[_0x6aba('0x17')](0xcc)[_0x6aba('0x16')]();});}};}function handleEntityNotFound(_0x67ba6e,_0x2b02c5){return function(_0x222ad8){if(!_0x222ad8){_0x67ba6e[_0x6aba('0x15')](0x194);}return _0x222ad8;};}function handleError(_0x3e18e3,_0x24d1ad){_0x24d1ad=_0x24d1ad||0x1f4;return function(_0x3aafa3){logger[_0x6aba('0x23')](_0x3aafa3[_0x6aba('0x24')]);if(_0x3aafa3[_0x6aba('0x25')]){delete _0x3aafa3[_0x6aba('0x25')];}_0x3e18e3[_0x6aba('0x17')](_0x24d1ad)['send'](_0x3aafa3);};}exports['index']=function(_0x335e82,_0x5b0845){var _0x30ecf9={},_0x108ff1={},_0x3ca593={'count':0x0,'rows':[]};var _0x1725d2=_['map'](db[_0x6aba('0x26')][_0x6aba('0x27')],function(_0x338702){return{'name':_0x338702[_0x6aba('0x28')],'type':_0x338702[_0x6aba('0x29')]['key']};});_0x108ff1[_0x6aba('0x2a')]=_['map'](_0x1725d2,_0x6aba('0x25'));_0x108ff1[_0x6aba('0x2b')]=_['keys'](_0x335e82['query']);_0x108ff1[_0x6aba('0x2c')]=_[_0x6aba('0x2d')](_0x108ff1[_0x6aba('0x2a')],_0x108ff1[_0x6aba('0x2b')]);_0x30ecf9[_0x6aba('0x2e')]=_[_0x6aba('0x2d')](_0x108ff1[_0x6aba('0x2a')],qs['fields'](_0x335e82[_0x6aba('0x2b')][_0x6aba('0x2f')]));_0x30ecf9[_0x6aba('0x2e')]=_0x30ecf9['attributes'][_0x6aba('0x30')]?_0x30ecf9[_0x6aba('0x2e')]:_0x108ff1[_0x6aba('0x2a')];if(!_0x335e82['query'][_0x6aba('0x31')](_0x6aba('0x32'))){_0x30ecf9['limit']=qs[_0x6aba('0x1b')](_0x335e82['query'][_0x6aba('0x1b')]);_0x30ecf9['offset']=qs[_0x6aba('0x1a')](_0x335e82[_0x6aba('0x2b')]['offset']);}_0x30ecf9['order']=qs[_0x6aba('0x33')](_0x335e82['query'][_0x6aba('0x33')]);_0x30ecf9[_0x6aba('0x34')]=qs['filters'](_[_0x6aba('0x35')](_0x335e82[_0x6aba('0x2b')],_0x108ff1[_0x6aba('0x2c')]),_0x1725d2);if(_0x335e82[_0x6aba('0x2b')][_0x6aba('0x36')]){_0x30ecf9[_0x6aba('0x34')]=_[_0x6aba('0x37')](_0x30ecf9['where'],{'$or':_['map'](_0x1725d2,function(_0x3250a5){if(_0x3250a5['type']!==_0x6aba('0x38')){var _0x4a34e4={};_0x4a34e4[_0x3250a5[_0x6aba('0x25')]]={'$like':'%'+_0x335e82['query'][_0x6aba('0x36')]+'%'};return _0x4a34e4;}})});}_0x30ecf9=_[_0x6aba('0x37')]({},_0x30ecf9,_0x335e82[_0x6aba('0x39')]);var _0x406874={'where':_0x30ecf9[_0x6aba('0x34')]};return db[_0x6aba('0x26')][_0x6aba('0x19')](_0x406874)[_0x6aba('0x21')](function(_0x463713){_0x3ca593['count']=_0x463713;if(_0x335e82[_0x6aba('0x2b')][_0x6aba('0x3a')]){_0x30ecf9[_0x6aba('0x3b')]=[{'all':!![]}];}return db[_0x6aba('0x26')]['findAll'](_0x30ecf9);})[_0x6aba('0x21')](function(_0x4abf0e){_0x3ca593[_0x6aba('0x3c')]=_0x4abf0e;return _0x3ca593;})['then'](respondWithFilteredResult(_0x5b0845,_0x30ecf9))['catch'](handleError(_0x5b0845,null));};exports['show']=function(_0x339385,_0x5a8b22){var _0x197f0f={'raw':!![],'where':{'id':_0x339385[_0x6aba('0x3d')]['id']}},_0x3263a9={};_0x3263a9[_0x6aba('0x2a')]=_[_0x6aba('0x3e')](db[_0x6aba('0x26')][_0x6aba('0x27')]);_0x3263a9['query']=_[_0x6aba('0x3e')](_0x339385[_0x6aba('0x2b')]);_0x3263a9[_0x6aba('0x3f')]=_['intersection'](_0x3263a9['model'],_0x3263a9[_0x6aba('0x2b')]);_0x197f0f[_0x6aba('0x2e')]=_[_0x6aba('0x2d')](_0x3263a9[_0x6aba('0x2a')],qs[_0x6aba('0x2f')](_0x339385['query'][_0x6aba('0x2f')]));_0x197f0f[_0x6aba('0x2e')]=_0x197f0f[_0x6aba('0x2e')][_0x6aba('0x30')]?_0x197f0f[_0x6aba('0x2e')]:_0x3263a9[_0x6aba('0x2a')];if(_0x339385[_0x6aba('0x2b')]['includeAll']){_0x197f0f[_0x6aba('0x3b')]=[{'all':!![]}];}_0x197f0f=_[_0x6aba('0x37')]({},_0x197f0f,_0x339385[_0x6aba('0x39')]);return db[_0x6aba('0x26')][_0x6aba('0x40')](_0x197f0f)[_0x6aba('0x21')](handleEntityNotFound(_0x5a8b22,null))['then'](respondWithResult(_0x5a8b22,null))[_0x6aba('0x41')](handleError(_0x5a8b22,null));};exports['create']=function(_0x5629f4,_0x2609d4){return db[_0x6aba('0x26')][_0x6aba('0x42')](_0x5629f4[_0x6aba('0x43')],{})[_0x6aba('0x21')](respondWithResult(_0x2609d4,0xc9))[_0x6aba('0x41')](handleError(_0x2609d4,null));};exports[_0x6aba('0x20')]=function(_0x155156,_0x109b5d){if(_0x155156[_0x6aba('0x43')]['id']){delete _0x155156['body']['id'];}return db[_0x6aba('0x26')][_0x6aba('0x40')]({'where':{'id':_0x155156[_0x6aba('0x3d')]['id']}})[_0x6aba('0x21')](handleEntityNotFound(_0x109b5d,null))[_0x6aba('0x21')](saveUpdates(_0x155156[_0x6aba('0x43')],null))[_0x6aba('0x21')](respondWithResult(_0x109b5d,null))[_0x6aba('0x41')](handleError(_0x109b5d,null));};exports[_0x6aba('0x22')]=function(_0x2b0963,_0x24f87c){return db[_0x6aba('0x26')][_0x6aba('0x40')]({'where':{'id':_0x2b0963['params']['id']}})[_0x6aba('0x21')](handleEntityNotFound(_0x24f87c,null))[_0x6aba('0x21')](removeEntity(_0x24f87c,null))[_0x6aba('0x41')](handleError(_0x24f87c,null));};exports['describe']=function(_0x12383d,_0x5476ec){return db['SquareDetailsReport'][_0x6aba('0x44')]()[_0x6aba('0x21')](respondWithResult(_0x5476ec,null))[_0x6aba('0x41')](handleError(_0x5476ec,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 87a8f7d..0b1e7cd 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 _0x7f6f=['exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./squareReportDetail.attributes'];(function(_0x253c3e,_0x3cc628){var _0x586afb=function(_0x9d39da){while(--_0x9d39da){_0x253c3e['push'](_0x253c3e['shift']());}};_0x586afb(++_0x3cc628);}(_0x7f6f,0x6c));var _0xf7f6=function(_0x187dbd,_0x2ecf58){_0x187dbd=_0x187dbd-0x0;var _0x45d1e9=_0x7f6f[_0x187dbd];return _0x45d1e9;};'use strict';var _=require(_0xf7f6('0x0'));var util=require(_0xf7f6('0x1'));var logger=require(_0xf7f6('0x2'))(_0xf7f6('0x3'));var moment=require(_0xf7f6('0x4'));var BPromise=require(_0xf7f6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf7f6('0x6'));var config=require(_0xf7f6('0x7'));var attributes=require(_0xf7f6('0x8'));module[_0xf7f6('0x9')]=function(_0x46075f,_0x37f221){return _0x46075f[_0xf7f6('0xa')](_0xf7f6('0xb'),attributes,{'tableName':_0xf7f6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59f9=['lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./squareReportDetail.attributes','SquareDetailsReport','report_square_details'];(function(_0x3dbf26,_0x201e70){var _0x5689c5=function(_0x49cb4f){while(--_0x49cb4f){_0x3dbf26['push'](_0x3dbf26['shift']());}};_0x5689c5(++_0x201e70);}(_0x59f9,0x1ea));var _0x959f=function(_0x571c1d,_0x3b0586){_0x571c1d=_0x571c1d-0x0;var _0x33c609=_0x59f9[_0x571c1d];return _0x33c609;};'use strict';var _=require(_0x959f('0x0'));var util=require(_0x959f('0x1'));var logger=require(_0x959f('0x2'))(_0x959f('0x3'));var moment=require(_0x959f('0x4'));var BPromise=require('bluebird');var rp=require(_0x959f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x959f('0x6'));var attributes=require(_0x959f('0x7'));module['exports']=function(_0x329265,_0x5acdb5){return _0x329265['define'](_0x959f('0x8'),attributes,{'tableName':_0x959f('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 fdd5bbd..0d05c82 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 _0x6bb9=['result','CreateSquareDetailsReport','create','options','raw','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xb21072,_0x5bbda9){var _0x1e2335=function(_0x3be51c){while(--_0x3be51c){_0xb21072['push'](_0xb21072['shift']());}};_0x1e2335(++_0x5bbda9);}(_0x6bb9,0x10a));var _0x96bb=function(_0x4b5ea5,_0x567ed2){_0x4b5ea5=_0x4b5ea5-0x0;var _0x54ccb0=_0x6bb9[_0x4b5ea5];return _0x54ccb0;};'use strict';var _=require('lodash');var util=require(_0x96bb('0x0'));var moment=require(_0x96bb('0x1'));var BPromise=require(_0x96bb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96bb('0x3'));var db=require(_0x96bb('0x4'))['db'];var utils=require(_0x96bb('0x5'));var logger=require(_0x96bb('0x6'))(_0x96bb('0x7'));var config=require(_0x96bb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x96bb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54d825,_0xeae9be,_0x32de55){return new BPromise(function(_0x2f1520,_0x18ef7e){return client[_0x96bb('0xa')](_0x54d825,_0x32de55)[_0x96bb('0xb')](function(_0x477b39){logger[_0x96bb('0xc')](_0x96bb('0xd'),_0xeae9be,'request\x20sent');logger[_0x96bb('0xe')](_0x96bb('0xf'),_0xeae9be,'request\x20sent',JSON[_0x96bb('0x10')](_0x477b39));if(_0x477b39[_0x96bb('0x11')]){if(_0x477b39['error'][_0x96bb('0x12')]===0x1f4){logger[_0x96bb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0xeae9be,_0x477b39[_0x96bb('0x11')]['message']);return _0x18ef7e(_0x477b39['error'][_0x96bb('0x13')]);}logger[_0x96bb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0xeae9be,_0x477b39[_0x96bb('0x11')][_0x96bb('0x13')]);return _0x2f1520(_0x477b39[_0x96bb('0x11')][_0x96bb('0x13')]);}else{logger[_0x96bb('0xc')](_0x96bb('0xd'),_0xeae9be,'request\x20sent');_0x2f1520(_0x477b39[_0x96bb('0x14')]['message']);}})['catch'](function(_0x1f1d80){logger[_0x96bb('0x11')](_0x96bb('0xd'),_0xeae9be,_0x1f1d80);_0x18ef7e(_0x1f1d80);});});}exports[_0x96bb('0x15')]=function(_0x523769){var _0x326745=this;return new Promise(function(_0x4b4319,_0x574d29){return db['SquareDetailsReport'][_0x96bb('0x16')](_0x523769['body'],{'raw':_0x523769['options']?_0x523769[_0x96bb('0x17')][_0x96bb('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x3694af){logger[_0x96bb('0xc')](_0x96bb('0x15'),_0x523769);logger[_0x96bb('0xe')](_0x96bb('0x15'),_0x523769,JSON[_0x96bb('0x10')](_0x3694af));_0x4b4319(_0x3694af);})[_0x96bb('0x19')](function(_0x11a87c){logger[_0x96bb('0x11')](_0x96bb('0x15'),_0x11a87c[_0x96bb('0x13')],_0x523769);_0x574d29(_0x326745[_0x96bb('0x11')](0x1f4,_0x11a87c['message']));});});}; \ No newline at end of file +var _0x91f9=['SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x456ce8,_0x336e87){var _0x4086ff=function(_0x3acc84){while(--_0x3acc84){_0x456ce8['push'](_0x456ce8['shift']());}};_0x4086ff(++_0x336e87);}(_0x91f9,0x11b));var _0x991f=function(_0x3ab6cb,_0x591249){_0x3ab6cb=_0x3ab6cb-0x0;var _0x108ae5=_0x91f9[_0x3ab6cb];return _0x108ae5;};'use strict';var _=require(_0x991f('0x0'));var util=require(_0x991f('0x1'));var moment=require(_0x991f('0x2'));var BPromise=require(_0x991f('0x3'));var rs=require(_0x991f('0x4'));var fs=require('fs');var Redis=require(_0x991f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x991f('0x6'));var logger=require('../../config/logger')(_0x991f('0x7'));var config=require(_0x991f('0x8'));var jayson=require(_0x991f('0x9'));var client=jayson[_0x991f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e288c,_0x56115b,_0x48e26e){return new BPromise(function(_0x2c3aa8,_0x1088c6){return client[_0x991f('0xb')](_0x5e288c,_0x48e26e)[_0x991f('0xc')](function(_0x20f582){logger[_0x991f('0xd')](_0x991f('0xe'),_0x56115b,_0x991f('0xf'));logger[_0x991f('0x10')](_0x991f('0x11'),_0x56115b,'request\x20sent',JSON['stringify'](_0x20f582));if(_0x20f582[_0x991f('0x12')]){if(_0x20f582['error'][_0x991f('0x13')]===0x1f4){logger[_0x991f('0x12')](_0x991f('0xe'),_0x56115b,_0x20f582['error'][_0x991f('0x14')]);return _0x1088c6(_0x20f582[_0x991f('0x12')]['message']);}logger[_0x991f('0x12')](_0x991f('0xe'),_0x56115b,_0x20f582[_0x991f('0x12')][_0x991f('0x14')]);return _0x2c3aa8(_0x20f582[_0x991f('0x12')][_0x991f('0x14')]);}else{logger['info'](_0x991f('0xe'),_0x56115b,_0x991f('0xf'));_0x2c3aa8(_0x20f582['result'][_0x991f('0x14')]);}})[_0x991f('0x15')](function(_0x161f5f){logger[_0x991f('0x12')](_0x991f('0xe'),_0x56115b,_0x161f5f);_0x1088c6(_0x161f5f);});});}exports[_0x991f('0x16')]=function(_0x61d6f8){var _0x587283=this;return new Promise(function(_0x609bed,_0x1fd5cf){return db[_0x991f('0x17')]['create'](_0x61d6f8[_0x991f('0x18')],{'raw':_0x61d6f8[_0x991f('0x19')]?_0x61d6f8[_0x991f('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x41d79d){logger[_0x991f('0xd')](_0x991f('0x16'),_0x61d6f8);logger[_0x991f('0x10')]('CreateSquareDetailsReport',_0x61d6f8,JSON[_0x991f('0x1a')](_0x41d79d));_0x609bed(_0x41d79d);})[_0x991f('0x15')](function(_0xc4602a){logger[_0x991f('0x12')]('CreateSquareDetailsReport',_0xc4602a['message'],_0x61d6f8);_0x1fd5cf(_0x587283[_0x991f('0x12')](0x1f4,_0xc4602a[_0x991f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 5009760..f6cf68e 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 _0x8168=['index','/process/:pid/kill','exports','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated'];(function(_0x52ea08,_0x15d935){var _0x28d546=function(_0x4a3aa7){while(--_0x4a3aa7){_0x52ea08['push'](_0x52ea08['shift']());}};_0x28d546(++_0x15d935);}(_0x8168,0x111));var _0x8816=function(_0x14f89e,_0x139fce){_0x14f89e=_0x14f89e-0x0;var _0x26092d=_0x8168[_0x14f89e];return _0x26092d;};'use strict';var express=require(_0x8816('0x0'));var router=express[_0x8816('0x1')]();var auth=require(_0x8816('0x2'));var controller=require(_0x8816('0x3'));router[_0x8816('0x4')]('/',auth[_0x8816('0x5')](),controller[_0x8816('0x6')]);router[_0x8816('0x4')](_0x8816('0x7'),auth['isAuthenticated'](),controller['killProcess']);module[_0x8816('0x8')]=router; \ No newline at end of file +var _0x8590=['express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','exports'];(function(_0x2f2360,_0x151089){var _0x1cc8d3=function(_0x5e356f){while(--_0x5e356f){_0x2f2360['push'](_0x2f2360['shift']());}};_0x1cc8d3(++_0x151089);}(_0x8590,0x105));var _0x0859=function(_0x5cf2d6,_0x2245c5){_0x5cf2d6=_0x5cf2d6-0x0;var _0x4ad889=_0x8590[_0x5cf2d6];return _0x4ad889;};'use strict';var express=require(_0x0859('0x0'));var router=express[_0x0859('0x1')]();var auth=require(_0x0859('0x2'));var controller=require(_0x0859('0x3'));router[_0x0859('0x4')]('/',auth[_0x0859('0x5')](),controller[_0x0859('0x6')]);router[_0x0859('0x4')](_0x0859('0x7'),auth[_0x0859('0x5')](),controller['killProcess']);module[_0x0859('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 3c822aa..94e2288 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 _0xd906=['catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','exec','../../config/logger','api','util','bluebird','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData','then','json'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xd906,0x6b));var _0x6d90=function(_0x2c772e,_0xe45e6c){_0x2c772e=_0x2c772e-0x0;var _0x14ee6a=_0xd906[_0x2c772e];return _0x14ee6a;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0x6d90('0x0')];var logger=require(_0x6d90('0x1'))(_0x6d90('0x2'));var util=require(_0x6d90('0x3'));var BPromise=require(_0x6d90('0x4'));var _=require('lodash');function handleError(_0x2ae140,_0x431c1e,_0x132c67){_0x431c1e=_0x431c1e||0x1f4;return function(_0xe3335c){logger['error'](_0x6d90('0x5'),_0x132c67,_0x431c1e,util[_0x6d90('0x6')](_0xe3335c,{'showHidden':![],'depth':null}));delete _0xe3335c[_0x6d90('0x7')];_0x2ae140[_0x6d90('0x8')](_0x431c1e)[_0x6d90('0x9')](_0xe3335c);};}exports['index']=function(_0x5f272f,_0x551bfb){return info[_0x6d90('0xa')]()[_0x6d90('0xb')](function(_0x46586e){return _0x551bfb[_0x6d90('0x8')](0xc8)[_0x6d90('0xc')](_0x46586e);})[_0x6d90('0xd')](function(_0x243b3a){return _0x551bfb['status'](0x1f4)[_0x6d90('0xc')](_0x243b3a);});};exports['killProcess']=function(_0x3c132a,_0x4b1ce0){var _0x2e791b=[_0x6d90('0xe')];return new BPromise(function(_0x1e4b32,_0x284ea8){return exec(util[_0x6d90('0xf')](_0x6d90('0x10'),_0x3c132a[_0x6d90('0x11')][_0x6d90('0x12')]),function(_0x50b642,_0x35994a,_0x513417){if(_0x50b642){return _0x284ea8(_0x50b642);}return _0x1e4b32(_0x35994a);});})[_0x6d90('0xb')](function(_0x2c0b05){var _0x1f128f=![];var _0x4dc4e3=_0x2c0b05[_0x6d90('0x13')](/\n/);for(var _0x49b4ad=0x0,_0x379439=_0x2e791b['length'];_0x49b4ad<_0x379439,_0x1f128f===![];_0x49b4ad+=0x1){if(_0x2c0b05[_0x6d90('0x14')](_0x2e791b[_0x49b4ad])>=0x0){_0x1f128f=!![];}}if(!_0x1f128f){throw new Error(util[_0x6d90('0xf')](_0x6d90('0x15'),_0x3c132a[_0x6d90('0x11')]['pid']));}process['kill'](_0x3c132a[_0x6d90('0x11')]['pid'],_0x6d90('0x16'));return _0x4b1ce0[_0x6d90('0x8')](0xc8)['json']({'message':util['format'](_0x6d90('0x17'),_0x3c132a[_0x6d90('0x11')][_0x6d90('0x12')])});})['catch'](handleError(_0x4b1ce0,null,'killProcess'));}; \ No newline at end of file +var _0x74af=['then','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','Process\x20with\x20pid\x20%s\x20not\x20found!','params','SIGINT','killProcess','systeminformation','child_process','exec','../../config/logger','api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','getAllData'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x74af,0x178));var _0xf74a=function(_0x470353,_0x273ec4){_0x470353=_0x470353-0x0;var _0x14b3be=_0x74af[_0x470353];return _0x14b3be;};'use strict';var info=require(_0xf74a('0x0'));var exec=require(_0xf74a('0x1'))[_0xf74a('0x2')];var logger=require(_0xf74a('0x3'))(_0xf74a('0x4'));var util=require(_0xf74a('0x5'));var BPromise=require('bluebird');var _=require(_0xf74a('0x6'));function handleError(_0x321dc5,_0x349c77,_0x282618){_0x349c77=_0x349c77||0x1f4;return function(_0x132947){logger[_0xf74a('0x7')](_0xf74a('0x8'),_0x282618,_0x349c77,util['inspect'](_0x132947,{'showHidden':![],'depth':null}));delete _0x132947[_0xf74a('0x9')];_0x321dc5[_0xf74a('0xa')](_0x349c77)[_0xf74a('0xb')](_0x132947);};}exports[_0xf74a('0xc')]=function(_0x1088a4,_0x358ca8){return info[_0xf74a('0xd')]()[_0xf74a('0xe')](function(_0x206db9){return _0x358ca8[_0xf74a('0xa')](0xc8)[_0xf74a('0xf')](_0x206db9);})[_0xf74a('0x10')](function(_0x6e453d){return _0x358ca8[_0xf74a('0xa')](0x1f4)[_0xf74a('0xf')](_0x6e453d);});};exports['killProcess']=function(_0x1289b1,_0x5efa82){var _0x16533b=[_0xf74a('0x11')];return new BPromise(function(_0x1cc6ff,_0x1e58b4){return exec(util[_0xf74a('0x12')](_0xf74a('0x13'),_0x1289b1['params'][_0xf74a('0x14')]),function(_0x544a44,_0x2f1493,_0x399657){if(_0x544a44){return _0x1e58b4(_0x544a44);}return _0x1cc6ff(_0x2f1493);});})['then'](function(_0xf3cb24){var _0x18ec31=![];var _0x37eb21=_0xf3cb24[_0xf74a('0x15')](/\n/);for(var _0x5820b2=0x0,_0x398d39=_0x16533b['length'];_0x5820b2<_0x398d39,_0x18ec31===![];_0x5820b2+=0x1){if(_0xf3cb24['indexOf'](_0x16533b[_0x5820b2])>=0x0){_0x18ec31=!![];}}if(!_0x18ec31){throw new Error(util[_0xf74a('0x12')](_0xf74a('0x16'),_0x1289b1[_0xf74a('0x17')]['pid']));}process['kill'](_0x1289b1['params'][_0xf74a('0x14')],_0xf74a('0x18'));return _0x5efa82[_0xf74a('0xa')](0xc8)[_0xf74a('0xf')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x1289b1[_0xf74a('0x17')]['pid'])});})[_0xf74a('0x10')](handleError(_0x5efa82,null,_0xf74a('0x19')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 4c3bc0b..6782b62 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 _0xe706=['update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x561f25,_0x2d95c1){var _0x150e4c=function(_0x266e99){while(--_0x266e99){_0x561f25['push'](_0x561f25['shift']());}};_0x150e4c(++_0x2d95c1);}(_0xe706,0xa3));var _0x6e70=function(_0x2efe4f,_0x35b3d9){_0x2efe4f=_0x2efe4f-0x0;var _0x251e7e=_0xe706[_0x2efe4f];return _0x251e7e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0xe')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x10')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x12')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);module['exports']=router; \ No newline at end of file +var _0x54ef=['isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','/:id'];(function(_0x3a0837,_0x368a5e){var _0x24b436=function(_0x457135){while(--_0x457135){_0x3a0837['push'](_0x3a0837['shift']());}};_0x24b436(++_0x368a5e);}(_0x54ef,0x112));var _0xf54e=function(_0x22147c,_0x537130){_0x22147c=_0x22147c-0x0;var _0x1be839=_0x54ef[_0x22147c];return _0x1be839;};'use strict';var multer=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var path=require(_0xf54e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf54e('0x3'));var router=express[_0xf54e('0x4')]();var auth=require(_0xf54e('0x5'));var interaction=require(_0xf54e('0x6'));var config=require(_0xf54e('0x7'));var controller=require(_0xf54e('0x8'));router[_0xf54e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf54e('0x9')](_0xf54e('0xa'),auth[_0xf54e('0xb')](),controller['show']);router[_0xf54e('0xc')]('/',auth['isAuthenticated'](),controller[_0xf54e('0xd')]);router[_0xf54e('0xe')]('/:id',auth[_0xf54e('0xb')](),controller[_0xf54e('0xf')]);router[_0xf54e('0x10')](_0xf54e('0xa'),auth['isAuthenticated'](),controller[_0xf54e('0x11')]);module[_0xf54e('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 05b8498..6e8ce39 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 _0x757a=['exports','STRING'];(function(_0x3999ed,_0x57651d){var _0x172d71=function(_0x3265f3){while(--_0x3265f3){_0x3999ed['push'](_0x3999ed['shift']());}};_0x172d71(++_0x57651d);}(_0x757a,0xde));var _0xa757=function(_0x212aea,_0x3159e9){_0x212aea=_0x212aea-0x0;var _0x710738=_0x757a[_0x212aea];return _0x710738;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xa757('0x1')]}}; \ No newline at end of file +var _0xea28=['exports','STRING','name','#0091EA','sequelize'];(function(_0x510f28,_0x442a90){var _0x10f91c=function(_0x51ffdf){while(--_0x51ffdf){_0x510f28['push'](_0x510f28['shift']());}};_0x10f91c(++_0x442a90);}(_0xea28,0x13a));var _0x8ea2=function(_0xe628ab,_0x92da6b){_0xe628ab=_0xe628ab-0x0;var _0x159eac=_0xea28[_0xe628ab];return _0x159eac;};'use strict';var Sequelize=require(_0x8ea2('0x0'));module[_0x8ea2('0x1')]={'name':{'type':Sequelize[_0x8ea2('0x2')],'unique':_0x8ea2('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8ea2('0x2')],'defaultValue':_0x8ea2('0x4')},'description':{'type':Sequelize[_0x8ea2('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index e9f39cf..ae39149 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 _0x7faa=['send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','Tag','includeAll','include','rows','show','params','filtears','length','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Tags','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name'];(function(_0x5b6128,_0x19201c){var _0x17f288=function(_0x291b1f){while(--_0x291b1f){_0x5b6128['push'](_0x5b6128['shift']());}};_0x17f288(++_0x19201c);}(_0x7faa,0x11e));var _0xa7fa=function(_0x588743,_0x4a4ac9){_0x588743=_0x588743-0x0;var _0x47a9ba=_0x7faa[_0x588743];return _0x47a9ba;};'use strict';var pdf=require(_0xa7fa('0x0'));var emlformat=require(_0xa7fa('0x1'));var rimraf=require(_0xa7fa('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa7fa('0x3'));var rp=require(_0xa7fa('0x4'));var moment=require(_0xa7fa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa7fa('0x6'));var util=require(_0xa7fa('0x7'));var path=require('path');var sox=require(_0xa7fa('0x8'));var csv=require('to-csv');var ejs=require(_0xa7fa('0x9'));var fs=require('fs');var _=require(_0xa7fa('0xa'));var squel=require('squel');var crypto=require(_0xa7fa('0xb'));var jsforce=require(_0xa7fa('0xc'));var deskjs=require(_0xa7fa('0xd'));var toCsv=require(_0xa7fa('0xe'));var querystring=require(_0xa7fa('0xf'));var Papa=require(_0xa7fa('0x10'));var Redis=require('ioredis');var authService=require(_0xa7fa('0x11'));var qs=require(_0xa7fa('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa7fa('0x13'))(_0xa7fa('0x14'));var utils=require(_0xa7fa('0x15'));var config=require(_0xa7fa('0x16'));var licenseUtil=require(_0xa7fa('0x17'));var db=require(_0xa7fa('0x18'))['db'];function respondWithStatusCode(_0x1f6d74,_0x193c64){_0x193c64=_0x193c64||0xcc;return function(_0x2e4783){if(_0x2e4783){return _0x1f6d74[_0xa7fa('0x19')](_0x193c64);}return _0x1f6d74[_0xa7fa('0x1a')](_0x193c64)[_0xa7fa('0x1b')]();};}function respondWithResult(_0x4fb2cf,_0x3400f9){_0x3400f9=_0x3400f9||0xc8;return function(_0x3c9ee5){if(_0x3c9ee5){return _0x4fb2cf[_0xa7fa('0x1a')](_0x3400f9)[_0xa7fa('0x1c')](_0x3c9ee5);}};}function respondWithFilteredResult(_0xc37c4c,_0x3076d9){return function(_0x194b8e){if(_0x194b8e){var _0x1ff2c0=_0x194b8e[_0xa7fa('0x1d')],_0xe83c1=_0x3076d9[_0xa7fa('0x1e')],_0x30c916=_0x3076d9['offset']+_0x3076d9['limit'],_0x27df2e;if(_0x30c916>=_0x1ff2c0){_0x30c916=_0x1ff2c0;_0x27df2e=0xc8;}else{_0x27df2e=0xce;}_0xc37c4c['status'](_0x27df2e);return _0xc37c4c['set'](_0xa7fa('0x1f'),_0xe83c1+'-'+_0x30c916+'/'+_0x1ff2c0)[_0xa7fa('0x1c')](_0x194b8e);}return null;};}function patchUpdates(_0x3201fc){return function(_0x18a9f3){try{jsonpatch[_0xa7fa('0x20')](_0x18a9f3,_0x3201fc,!![]);}catch(_0x3e3fe4){return BPromise[_0xa7fa('0x21')](_0x3e3fe4);}return _0x18a9f3[_0xa7fa('0x22')]();};}function saveUpdates(_0x1516a1,_0x3509ec){return function(_0x914264){if(_0x914264){return _0x914264['update'](_0x1516a1)[_0xa7fa('0x23')](function(_0x314f42){return _0x314f42;});}return null;};}function removeEntity(_0x3c08c5,_0x5bc7bb){return function(_0x590941){if(_0x590941){return _0x590941[_0xa7fa('0x24')]()[_0xa7fa('0x23')](function(){var _0x4bb00f=_0x590941[_0xa7fa('0x25')]({'plain':!![]});var _0x25ad4f='Tags';return db[_0xa7fa('0x26')][_0xa7fa('0x24')]({'where':{'type':_0x25ad4f,'resourceId':_0x4bb00f['id']}})[_0xa7fa('0x23')](function(){return _0x590941;});})[_0xa7fa('0x23')](function(){_0x3c08c5[_0xa7fa('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ba3cc,_0x235ded){return function(_0x216cce){if(!_0x216cce){_0x2ba3cc[_0xa7fa('0x19')](0x194);}return _0x216cce;};}function handleError(_0x214179,_0xf1f30e){_0xf1f30e=_0xf1f30e||0x1f4;return function(_0x48887c){logger[_0xa7fa('0x27')](_0x48887c[_0xa7fa('0x28')]);if(_0x48887c[_0xa7fa('0x29')]){delete _0x48887c['name'];}_0x214179['status'](_0xf1f30e)[_0xa7fa('0x2a')](_0x48887c);};}exports['index']=function(_0x48f1ad,_0x11f871){var _0x15fecd={},_0x1c21e1={},_0x2cd5d3={'count':0x0,'rows':[]};var _0x4a9f3b=_[_0xa7fa('0x2b')](db['Tag'][_0xa7fa('0x2c')],function(_0x304942){return{'name':_0x304942[_0xa7fa('0x2d')],'type':_0x304942['type'][_0xa7fa('0x2e')]};});_0x1c21e1[_0xa7fa('0x2f')]=_[_0xa7fa('0x2b')](_0x4a9f3b,'name');_0x1c21e1[_0xa7fa('0x30')]=_[_0xa7fa('0x31')](_0x48f1ad[_0xa7fa('0x30')]);_0x1c21e1[_0xa7fa('0x32')]=_[_0xa7fa('0x33')](_0x1c21e1[_0xa7fa('0x2f')],_0x1c21e1[_0xa7fa('0x30')]);_0x15fecd[_0xa7fa('0x34')]=_[_0xa7fa('0x33')](_0x1c21e1[_0xa7fa('0x2f')],qs[_0xa7fa('0x35')](_0x48f1ad['query'][_0xa7fa('0x35')]));_0x15fecd['attributes']=_0x15fecd[_0xa7fa('0x34')]['length']?_0x15fecd[_0xa7fa('0x34')]:_0x1c21e1[_0xa7fa('0x2f')];if(!_0x48f1ad[_0xa7fa('0x30')][_0xa7fa('0x36')]('nolimit')){_0x15fecd[_0xa7fa('0x37')]=qs['limit'](_0x48f1ad[_0xa7fa('0x30')][_0xa7fa('0x37')]);_0x15fecd[_0xa7fa('0x1e')]=qs['offset'](_0x48f1ad[_0xa7fa('0x30')][_0xa7fa('0x1e')]);}_0x15fecd[_0xa7fa('0x38')]=qs[_0xa7fa('0x39')](_0x48f1ad['query'][_0xa7fa('0x39')]);_0x15fecd[_0xa7fa('0x3a')]=qs[_0xa7fa('0x32')](_[_0xa7fa('0x3b')](_0x48f1ad[_0xa7fa('0x30')],_0x1c21e1[_0xa7fa('0x32')]),_0x4a9f3b);if(_0x48f1ad['query']['filter']){_0x15fecd[_0xa7fa('0x3a')]=_[_0xa7fa('0x3c')](_0x15fecd[_0xa7fa('0x3a')],{'$or':_['map'](_0x4a9f3b,function(_0x57a9e9){if(_0x57a9e9[_0xa7fa('0x3d')]!==_0xa7fa('0x3e')){var _0x4566b0={};_0x4566b0[_0x57a9e9[_0xa7fa('0x29')]]={'$like':'%'+_0x48f1ad[_0xa7fa('0x30')][_0xa7fa('0x3f')]+'%'};return _0x4566b0;}})});}_0x15fecd=_[_0xa7fa('0x3c')]({},_0x15fecd,_0x48f1ad['options']);var _0x39da76={'where':_0x15fecd[_0xa7fa('0x3a')]};return db[_0xa7fa('0x40')]['count'](_0x39da76)[_0xa7fa('0x23')](function(_0xbc8526){_0x2cd5d3[_0xa7fa('0x1d')]=_0xbc8526;if(_0x48f1ad[_0xa7fa('0x30')][_0xa7fa('0x41')]){_0x15fecd[_0xa7fa('0x42')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x15fecd);})[_0xa7fa('0x23')](function(_0x1ae323){_0x2cd5d3[_0xa7fa('0x43')]=_0x1ae323;return _0x2cd5d3;})[_0xa7fa('0x23')](respondWithFilteredResult(_0x11f871,_0x15fecd))['catch'](handleError(_0x11f871,null));};exports[_0xa7fa('0x44')]=function(_0x3c4d77,_0x1e83d6){var _0x4f9b62={'raw':!![],'where':{'id':_0x3c4d77[_0xa7fa('0x45')]['id']}},_0x39a28c={};_0x39a28c['model']=_['keys'](db[_0xa7fa('0x40')]['rawAttributes']);_0x39a28c['query']=_['keys'](_0x3c4d77[_0xa7fa('0x30')]);_0x39a28c[_0xa7fa('0x46')]=_['intersection'](_0x39a28c[_0xa7fa('0x2f')],_0x39a28c[_0xa7fa('0x30')]);_0x4f9b62[_0xa7fa('0x34')]=_[_0xa7fa('0x33')](_0x39a28c[_0xa7fa('0x2f')],qs[_0xa7fa('0x35')](_0x3c4d77[_0xa7fa('0x30')][_0xa7fa('0x35')]));_0x4f9b62[_0xa7fa('0x34')]=_0x4f9b62['attributes'][_0xa7fa('0x47')]?_0x4f9b62[_0xa7fa('0x34')]:_0x39a28c[_0xa7fa('0x2f')];if(_0x3c4d77[_0xa7fa('0x30')][_0xa7fa('0x41')]){_0x4f9b62[_0xa7fa('0x42')]=[{'all':!![]}];}_0x4f9b62=_[_0xa7fa('0x3c')]({},_0x4f9b62,_0x3c4d77['options']);return db[_0xa7fa('0x40')][_0xa7fa('0x48')](_0x4f9b62)[_0xa7fa('0x23')](handleEntityNotFound(_0x1e83d6,null))[_0xa7fa('0x23')](respondWithResult(_0x1e83d6,null))[_0xa7fa('0x49')](handleError(_0x1e83d6,null));};exports[_0xa7fa('0x4a')]=function(_0x247969,_0x39fd9c){return db[_0xa7fa('0x40')][_0xa7fa('0x4a')](_0x247969[_0xa7fa('0x4b')],{})['then'](function(_0x4d3550){var _0x214382=_0x247969['user'][_0xa7fa('0x25')]({'plain':!![]});if(!_0x214382)throw new Error(_0xa7fa('0x4c'));if(_0x214382['role']==='user'){var _0x292ddd=_0x4d3550[_0xa7fa('0x25')]({'plain':!![]});var _0x598d68=_0xa7fa('0x4d');return db[_0xa7fa('0x4e')][_0xa7fa('0x48')]({'where':{'name':_0x598d68,'userProfileId':_0x214382['userProfileId']},'raw':!![]})[_0xa7fa('0x23')](function(_0x5cbf62){if(_0x5cbf62&&_0x5cbf62[_0xa7fa('0x4f')]===0x0){return db[_0xa7fa('0x26')]['create']({'name':_0x292ddd[_0xa7fa('0x29')],'resourceId':_0x292ddd['id'],'type':_0x5cbf62[_0xa7fa('0x29')],'sectionId':_0x5cbf62['id']},{})['then'](function(){return _0x4d3550;});}else{return _0x4d3550;}})[_0xa7fa('0x49')](function(_0x4a6002){logger[_0xa7fa('0x27')](_0xa7fa('0x50'),_0x4a6002);throw _0x4a6002;});}return _0x4d3550;})[_0xa7fa('0x23')](respondWithResult(_0x39fd9c,0xc9))[_0xa7fa('0x49')](handleError(_0x39fd9c,null));};exports[_0xa7fa('0x51')]=function(_0x4ec83e,_0x7d1dbc){if(_0x4ec83e[_0xa7fa('0x4b')]['id']){delete _0x4ec83e[_0xa7fa('0x4b')]['id'];}return db[_0xa7fa('0x40')][_0xa7fa('0x48')]({'where':{'id':_0x4ec83e[_0xa7fa('0x45')]['id']}})['then'](handleEntityNotFound(_0x7d1dbc,null))[_0xa7fa('0x23')](saveUpdates(_0x4ec83e['body'],null))['then'](respondWithResult(_0x7d1dbc,null))['catch'](handleError(_0x7d1dbc,null));};exports['destroy']=function(_0x57dfa2,_0x17d8b3){return db[_0xa7fa('0x40')][_0xa7fa('0x48')]({'where':{'id':_0x57dfa2['params']['id']}})[_0xa7fa('0x23')](handleEntityNotFound(_0x17d8b3,null))[_0xa7fa('0x23')](removeEntity(_0x17d8b3,null))[_0xa7fa('0x49')](handleError(_0x17d8b3,null));}; \ No newline at end of file +var _0x6f97=['path','sox','to-csv','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','status','json','count','offset','set','Content-Range','save','then','destroy','get','Tags','UserProfileResource','end','sendStatus','stack','send','map','Tag','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','rimraf','fast-json-patch','moment','mustache','util'];(function(_0x1b218d,_0x36c9ce){var _0x388c92=function(_0x2bb271){while(--_0x2bb271){_0x1b218d['push'](_0x1b218d['shift']());}};_0x388c92(++_0x36c9ce);}(_0x6f97,0x1b7));var _0x76f9=function(_0x1ad0d0,_0x3e4614){_0x1ad0d0=_0x1ad0d0-0x0;var _0xa5e9ae=_0x6f97[_0x1ad0d0];return _0xa5e9ae;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x76f9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x76f9('0x1'));var rp=require('request-promise');var moment=require(_0x76f9('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x76f9('0x3'));var util=require(_0x76f9('0x4'));var path=require(_0x76f9('0x5'));var sox=require(_0x76f9('0x6'));var csv=require(_0x76f9('0x7'));var ejs=require(_0x76f9('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x76f9('0x9'));var crypto=require(_0x76f9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x76f9('0xb'));var toCsv=require(_0x76f9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x76f9('0xc'));var authService=require(_0x76f9('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x76f9('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x76f9('0xf'))('api');var utils=require(_0x76f9('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x76f9('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37f5e6,_0x3d4833){_0x3d4833=_0x3d4833||0xcc;return function(_0x50a798){if(_0x50a798){return _0x37f5e6['sendStatus'](_0x3d4833);}return _0x37f5e6[_0x76f9('0x12')](_0x3d4833)['end']();};}function respondWithResult(_0x4c3496,_0x24674b){_0x24674b=_0x24674b||0xc8;return function(_0x2c187d){if(_0x2c187d){return _0x4c3496['status'](_0x24674b)[_0x76f9('0x13')](_0x2c187d);}};}function respondWithFilteredResult(_0x4c6c0d,_0x4ddb9f){return function(_0xcbde9f){if(_0xcbde9f){var _0x123544=_0xcbde9f[_0x76f9('0x14')],_0x33caa1=_0x4ddb9f[_0x76f9('0x15')],_0x51749f=_0x4ddb9f[_0x76f9('0x15')]+_0x4ddb9f['limit'],_0x15f278;if(_0x51749f>=_0x123544){_0x51749f=_0x123544;_0x15f278=0xc8;}else{_0x15f278=0xce;}_0x4c6c0d[_0x76f9('0x12')](_0x15f278);return _0x4c6c0d[_0x76f9('0x16')](_0x76f9('0x17'),_0x33caa1+'-'+_0x51749f+'/'+_0x123544)[_0x76f9('0x13')](_0xcbde9f);}return null;};}function patchUpdates(_0x29635c){return function(_0x3e05cb){try{jsonpatch['apply'](_0x3e05cb,_0x29635c,!![]);}catch(_0x5a041b){return BPromise['reject'](_0x5a041b);}return _0x3e05cb[_0x76f9('0x18')]();};}function saveUpdates(_0x89fabe,_0x224771){return function(_0x2246a6){if(_0x2246a6){return _0x2246a6['update'](_0x89fabe)[_0x76f9('0x19')](function(_0x3118a8){return _0x3118a8;});}return null;};}function removeEntity(_0x14f7bf,_0x24f7da){return function(_0x4733a9){if(_0x4733a9){return _0x4733a9[_0x76f9('0x1a')]()['then'](function(){var _0x7d51b8=_0x4733a9[_0x76f9('0x1b')]({'plain':!![]});var _0x1b39fc=_0x76f9('0x1c');return db[_0x76f9('0x1d')]['destroy']({'where':{'type':_0x1b39fc,'resourceId':_0x7d51b8['id']}})[_0x76f9('0x19')](function(){return _0x4733a9;});})[_0x76f9('0x19')](function(){_0x14f7bf[_0x76f9('0x12')](0xcc)[_0x76f9('0x1e')]();});}};}function handleEntityNotFound(_0x632809,_0x10157b){return function(_0x3d409f){if(!_0x3d409f){_0x632809[_0x76f9('0x1f')](0x194);}return _0x3d409f;};}function handleError(_0x39bbcb,_0x46c8e4){_0x46c8e4=_0x46c8e4||0x1f4;return function(_0x34531b){logger['error'](_0x34531b[_0x76f9('0x20')]);if(_0x34531b['name']){delete _0x34531b['name'];}_0x39bbcb['status'](_0x46c8e4)[_0x76f9('0x21')](_0x34531b);};}exports['index']=function(_0x52c722,_0x583e89){var _0x3739ba={},_0x8015e6={},_0x92c91b={'count':0x0,'rows':[]};var _0x103e82=_[_0x76f9('0x22')](db[_0x76f9('0x23')][_0x76f9('0x24')],function(_0x57f425){return{'name':_0x57f425[_0x76f9('0x25')],'type':_0x57f425[_0x76f9('0x26')][_0x76f9('0x27')]};});_0x8015e6[_0x76f9('0x28')]=_[_0x76f9('0x22')](_0x103e82,'name');_0x8015e6['query']=_[_0x76f9('0x29')](_0x52c722[_0x76f9('0x2a')]);_0x8015e6['filters']=_[_0x76f9('0x2b')](_0x8015e6['model'],_0x8015e6[_0x76f9('0x2a')]);_0x3739ba[_0x76f9('0x2c')]=_[_0x76f9('0x2b')](_0x8015e6['model'],qs['fields'](_0x52c722[_0x76f9('0x2a')][_0x76f9('0x2d')]));_0x3739ba[_0x76f9('0x2c')]=_0x3739ba[_0x76f9('0x2c')]['length']?_0x3739ba[_0x76f9('0x2c')]:_0x8015e6[_0x76f9('0x28')];if(!_0x52c722['query']['hasOwnProperty'](_0x76f9('0x2e'))){_0x3739ba[_0x76f9('0x2f')]=qs[_0x76f9('0x2f')](_0x52c722[_0x76f9('0x2a')][_0x76f9('0x2f')]);_0x3739ba[_0x76f9('0x15')]=qs['offset'](_0x52c722['query'][_0x76f9('0x15')]);}_0x3739ba[_0x76f9('0x30')]=qs[_0x76f9('0x31')](_0x52c722['query'][_0x76f9('0x31')]);_0x3739ba[_0x76f9('0x32')]=qs[_0x76f9('0x33')](_[_0x76f9('0x34')](_0x52c722[_0x76f9('0x2a')],_0x8015e6[_0x76f9('0x33')]),_0x103e82);if(_0x52c722[_0x76f9('0x2a')][_0x76f9('0x35')]){_0x3739ba['where']=_[_0x76f9('0x36')](_0x3739ba[_0x76f9('0x32')],{'$or':_[_0x76f9('0x22')](_0x103e82,function(_0x50e782){if(_0x50e782[_0x76f9('0x26')]!==_0x76f9('0x37')){var _0x31f10c={};_0x31f10c[_0x50e782[_0x76f9('0x38')]]={'$like':'%'+_0x52c722[_0x76f9('0x2a')]['filter']+'%'};return _0x31f10c;}})});}_0x3739ba=_[_0x76f9('0x36')]({},_0x3739ba,_0x52c722[_0x76f9('0x39')]);var _0x289538={'where':_0x3739ba['where']};return db[_0x76f9('0x23')][_0x76f9('0x14')](_0x289538)['then'](function(_0xd144ed){_0x92c91b['count']=_0xd144ed;if(_0x52c722[_0x76f9('0x2a')][_0x76f9('0x3a')]){_0x3739ba[_0x76f9('0x3b')]=[{'all':!![]}];}return db[_0x76f9('0x23')][_0x76f9('0x3c')](_0x3739ba);})[_0x76f9('0x19')](function(_0x329687){_0x92c91b[_0x76f9('0x3d')]=_0x329687;return _0x92c91b;})['then'](respondWithFilteredResult(_0x583e89,_0x3739ba))[_0x76f9('0x3e')](handleError(_0x583e89,null));};exports['show']=function(_0x49b0ad,_0xe3b0a0){var _0x1c88ed={'raw':!![],'where':{'id':_0x49b0ad[_0x76f9('0x3f')]['id']}},_0x4372e8={};_0x4372e8[_0x76f9('0x28')]=_[_0x76f9('0x29')](db['Tag'][_0x76f9('0x24')]);_0x4372e8[_0x76f9('0x2a')]=_[_0x76f9('0x29')](_0x49b0ad['query']);_0x4372e8['filtears']=_[_0x76f9('0x2b')](_0x4372e8[_0x76f9('0x28')],_0x4372e8[_0x76f9('0x2a')]);_0x1c88ed['attributes']=_['intersection'](_0x4372e8[_0x76f9('0x28')],qs[_0x76f9('0x2d')](_0x49b0ad[_0x76f9('0x2a')][_0x76f9('0x2d')]));_0x1c88ed['attributes']=_0x1c88ed[_0x76f9('0x2c')][_0x76f9('0x40')]?_0x1c88ed[_0x76f9('0x2c')]:_0x4372e8[_0x76f9('0x28')];if(_0x49b0ad[_0x76f9('0x2a')][_0x76f9('0x3a')]){_0x1c88ed[_0x76f9('0x3b')]=[{'all':!![]}];}_0x1c88ed=_[_0x76f9('0x36')]({},_0x1c88ed,_0x49b0ad[_0x76f9('0x39')]);return db[_0x76f9('0x23')][_0x76f9('0x41')](_0x1c88ed)[_0x76f9('0x19')](handleEntityNotFound(_0xe3b0a0,null))['then'](respondWithResult(_0xe3b0a0,null))[_0x76f9('0x3e')](handleError(_0xe3b0a0,null));};exports['create']=function(_0x293b9b,_0x255e25){return db['Tag'][_0x76f9('0x42')](_0x293b9b[_0x76f9('0x43')],{})[_0x76f9('0x19')](function(_0x4968ee){var _0x3f4e75=_0x293b9b['user'][_0x76f9('0x1b')]({'plain':!![]});if(!_0x3f4e75)throw new Error(_0x76f9('0x44'));if(_0x3f4e75[_0x76f9('0x45')]==='user'){var _0xce4507=_0x4968ee[_0x76f9('0x1b')]({'plain':!![]});var _0x54cdcd=_0x76f9('0x1c');return db[_0x76f9('0x46')][_0x76f9('0x41')]({'where':{'name':_0x54cdcd,'userProfileId':_0x3f4e75[_0x76f9('0x47')]},'raw':!![]})[_0x76f9('0x19')](function(_0x17b47c){if(_0x17b47c&&_0x17b47c[_0x76f9('0x48')]===0x0){return db['UserProfileResource'][_0x76f9('0x42')]({'name':_0xce4507[_0x76f9('0x38')],'resourceId':_0xce4507['id'],'type':_0x17b47c[_0x76f9('0x38')],'sectionId':_0x17b47c['id']},{})['then'](function(){return _0x4968ee;});}else{return _0x4968ee;}})[_0x76f9('0x3e')](function(_0x4cb1f3){logger[_0x76f9('0x49')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4cb1f3);throw _0x4cb1f3;});}return _0x4968ee;})[_0x76f9('0x19')](respondWithResult(_0x255e25,0xc9))['catch'](handleError(_0x255e25,null));};exports['update']=function(_0x42c8a4,_0x100da2){if(_0x42c8a4[_0x76f9('0x43')]['id']){delete _0x42c8a4['body']['id'];}return db['Tag']['find']({'where':{'id':_0x42c8a4[_0x76f9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x100da2,null))[_0x76f9('0x19')](saveUpdates(_0x42c8a4[_0x76f9('0x43')],null))[_0x76f9('0x19')](respondWithResult(_0x100da2,null))[_0x76f9('0x3e')](handleError(_0x100da2,null));};exports[_0x76f9('0x1a')]=function(_0x3498c5,_0x3e750b){return db[_0x76f9('0x23')]['find']({'where':{'id':_0x3498c5[_0x76f9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3e750b,null))['then'](removeEntity(_0x3e750b,null))[_0x76f9('0x3e')](handleError(_0x3e750b,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 88767eb..55706ba 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 _0x5529=['./tag.attributes','Tag','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x5529,0xc8));var _0x9552=function(_0x8d9d42,_0x4cd2ad){_0x8d9d42=_0x8d9d42-0x0;var _0x2bef14=_0x5529[_0x8d9d42];return _0x2bef14;};'use strict';var _=require(_0x9552('0x0'));var util=require(_0x9552('0x1'));var logger=require(_0x9552('0x2'))(_0x9552('0x3'));var moment=require('moment');var BPromise=require(_0x9552('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9552('0x5'));var config=require(_0x9552('0x6'));var attributes=require(_0x9552('0x7'));module['exports']=function(_0x4c0fac,_0x4e5b4f){return _0x4c0fac['define'](_0x9552('0x8'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7605=['request-promise','path','../../config/environment','./tag.attributes','exports','Tag','tools_tags','util','../../config/logger','api','bluebird'];(function(_0x13b07a,_0x49cfc3){var _0xdcbe0=function(_0x45dee2){while(--_0x45dee2){_0x13b07a['push'](_0x13b07a['shift']());}};_0xdcbe0(++_0x49cfc3);}(_0x7605,0xc2));var _0x5760=function(_0x430aa3,_0x5717ab){_0x430aa3=_0x430aa3-0x0;var _0x13fca3=_0x7605[_0x430aa3];return _0x13fca3;};'use strict';var _=require('lodash');var util=require(_0x5760('0x0'));var logger=require(_0x5760('0x1'))(_0x5760('0x2'));var moment=require('moment');var BPromise=require(_0x5760('0x3'));var rp=require(_0x5760('0x4'));var fs=require('fs');var path=require(_0x5760('0x5'));var rimraf=require('rimraf');var config=require(_0x5760('0x6'));var attributes=require(_0x5760('0x7'));module[_0x5760('0x8')]=function(_0x2db439,_0x5052ad){return _0x2db439['define'](_0x5760('0x9'),attributes,{'tableName':_0x5760('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 7eec494..39f13ca 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 _0x153f=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x52ebae,_0x4a20d8){var _0x641c7d=function(_0xb90812){while(--_0xb90812){_0x52ebae['push'](_0x52ebae['shift']());}};_0x641c7d(++_0x4a20d8);}(_0x153f,0x15b));var _0xf153=function(_0xa1fecc,_0x1e1813){_0xa1fecc=_0xa1fecc-0x0;var _0x27617c=_0x153f[_0xa1fecc];return _0x27617c;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f432,_0x4c8ae5,_0x17ba96){return new BPromise(function(_0x143497,_0x224f88){return client[_0xf153('0xc')](_0x21f432,_0x17ba96)[_0xf153('0xd')](function(_0x3e7a82){logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));logger[_0xf153('0x11')]('Tag,\x20%s,\x20%s,\x20%s',_0x4c8ae5,_0xf153('0x10'),JSON[_0xf153('0x12')](_0x3e7a82));if(_0x3e7a82[_0xf153('0x13')]){if(_0x3e7a82['error'][_0xf153('0x14')]===0x1f4){logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);return _0x224f88(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82['error'][_0xf153('0x15')]);return _0x143497(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}else{logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));_0x143497(_0x3e7a82[_0xf153('0x16')][_0xf153('0x15')]);}})['catch'](function(_0x35f4e8){logger['error'](_0xf153('0xf'),_0x4c8ae5,_0x35f4e8);_0x224f88(_0x35f4e8);});});} \ No newline at end of file +var _0x44a3=['http','request','then','info','request\x20sent','debug','error','code','message','Tag,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0xe20e73,_0x4ec4ef){var _0x232634=function(_0x2d0b70){while(--_0x2d0b70){_0xe20e73['push'](_0xe20e73['shift']());}};_0x232634(++_0x4ec4ef);}(_0x44a3,0x1a9));var _0x344a=function(_0x417baa,_0x3923d0){_0x417baa=_0x417baa-0x0;var _0x42724f=_0x44a3[_0x417baa];return _0x42724f;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var moment=require(_0x344a('0x2'));var BPromise=require(_0x344a('0x3'));var rs=require(_0x344a('0x4'));var fs=require('fs');var Redis=require(_0x344a('0x5'));var db=require(_0x344a('0x6'))['db'];var utils=require(_0x344a('0x7'));var logger=require('../../config/logger')(_0x344a('0x8'));var config=require(_0x344a('0x9'));var jayson=require(_0x344a('0xa'));var client=jayson[_0x344a('0xb')][_0x344a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x504bd1,_0x553d97,_0x55ddca){return new BPromise(function(_0x484661,_0x475dab){return client[_0x344a('0xd')](_0x504bd1,_0x55ddca)[_0x344a('0xe')](function(_0x233ca1){logger[_0x344a('0xf')]('Tag,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'));logger[_0x344a('0x11')]('Tag,\x20%s,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'),JSON['stringify'](_0x233ca1));if(_0x233ca1[_0x344a('0x12')]){if(_0x233ca1['error'][_0x344a('0x13')]===0x1f4){logger[_0x344a('0x12')]('Tag,\x20%s,\x20%s',_0x553d97,_0x233ca1['error'][_0x344a('0x14')]);return _0x475dab(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}logger[_0x344a('0x12')](_0x344a('0x15'),_0x553d97,_0x233ca1[_0x344a('0x12')]['message']);return _0x484661(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}else{logger[_0x344a('0xf')](_0x344a('0x15'),_0x553d97,'request\x20sent');_0x484661(_0x233ca1['result'][_0x344a('0x14')]);}})[_0x344a('0x16')](function(_0x36227e){logger[_0x344a('0x12')]('Tag,\x20%s,\x20%s',_0x553d97,_0x36227e);_0x475dab(_0x36227e);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 010fdc0..b40d8eb 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 _0x93b2=['addAgents','put','update','delete','destroy','removeQueues','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','/:id','/:id/queues','getQueues','/:id/users','getAgents','post'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x93b2,0x18e));var _0x293b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x93b2[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x293b('0x0'));var util=require(_0x293b('0x1'));var path=require('path');var timeout=require(_0x293b('0x2'));var express=require(_0x293b('0x3'));var router=express[_0x293b('0x4')]();var auth=require(_0x293b('0x5'));var interaction=require(_0x293b('0x6'));var config=require(_0x293b('0x7'));var controller=require(_0x293b('0x8'));router[_0x293b('0x9')]('/',auth[_0x293b('0xa')](),controller[_0x293b('0xb')]);router[_0x293b('0x9')](_0x293b('0xc'),auth[_0x293b('0xa')](),controller['show']);router[_0x293b('0x9')](_0x293b('0xd'),auth[_0x293b('0xa')](),controller[_0x293b('0xe')]);router[_0x293b('0x9')](_0x293b('0xf'),auth[_0x293b('0xa')](),controller[_0x293b('0x10')]);router[_0x293b('0x11')]('/',auth[_0x293b('0xa')](),controller['create']);router[_0x293b('0x11')](_0x293b('0xd'),auth[_0x293b('0xa')](),controller['addQueues']);router['post'](_0x293b('0xf'),auth[_0x293b('0xa')](),controller[_0x293b('0x12')]);router[_0x293b('0x13')]('/:id',auth[_0x293b('0xa')](),controller[_0x293b('0x14')]);router[_0x293b('0x15')]('/:id',auth[_0x293b('0xa')](),controller[_0x293b('0x16')]);router[_0x293b('0x15')](_0x293b('0xd'),auth[_0x293b('0xa')](),controller[_0x293b('0x17')]);router[_0x293b('0x15')](_0x293b('0xf'),auth[_0x293b('0xa')](),controller[_0x293b('0x18')]);module[_0x293b('0x19')]=router; \ No newline at end of file +var _0xca4b=['/:id/users','getAgents','post','create','addQueues','put','/:id','delete','/:id/queues','removeQueues','removeAgents','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xca4b,0x123));var _0xbca4=function(_0xc32171,_0x5dfdf0){_0xc32171=_0xc32171-0x0;var _0x3d77aa=_0xca4b[_0xc32171];return _0x3d77aa;};'use strict';var multer=require(_0xbca4('0x0'));var util=require(_0xbca4('0x1'));var path=require(_0xbca4('0x2'));var timeout=require(_0xbca4('0x3'));var express=require(_0xbca4('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xbca4('0x5'));var config=require(_0xbca4('0x6'));var controller=require('./team.controller');router[_0xbca4('0x7')]('/',auth[_0xbca4('0x8')](),controller['index']);router[_0xbca4('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xbca4('0x7')]('/:id/queues',auth[_0xbca4('0x8')](),controller['getQueues']);router[_0xbca4('0x7')](_0xbca4('0x9'),auth[_0xbca4('0x8')](),controller[_0xbca4('0xa')]);router[_0xbca4('0xb')]('/',auth[_0xbca4('0x8')](),controller[_0xbca4('0xc')]);router[_0xbca4('0xb')]('/:id/queues',auth[_0xbca4('0x8')](),controller[_0xbca4('0xd')]);router[_0xbca4('0xb')](_0xbca4('0x9'),auth[_0xbca4('0x8')](),controller['addAgents']);router[_0xbca4('0xe')](_0xbca4('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xbca4('0xf'),auth[_0xbca4('0x8')](),controller['destroy']);router[_0xbca4('0x10')](_0xbca4('0x11'),auth[_0xbca4('0x8')](),controller[_0xbca4('0x12')]);router[_0xbca4('0x10')](_0xbca4('0x9'),auth[_0xbca4('0x8')](),controller[_0xbca4('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 8d1ec20..62aaa06 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 _0x8161=['exports','STRING','name'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8161,0x1ef));var _0x1816=function(_0x1224a2,_0x328dc7){_0x1224a2=_0x1224a2-0x0;var _0x407626=_0x8161[_0x1224a2];return _0x407626;};'use strict';var Sequelize=require('sequelize');module[_0x1816('0x0')]={'name':{'type':Sequelize[_0x1816('0x1')],'allowNull':![],'unique':_0x1816('0x2')},'description':{'type':Sequelize[_0x1816('0x1')]}}; \ No newline at end of file +var _0xf540=['sequelize','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xf540,0x70));var _0x0f54=function(_0x55a6db,_0x565c5c){_0x55a6db=_0x55a6db-0x0;var _0x3a0d82=_0xf540[_0x55a6db];return _0x3a0d82;};'use strict';var Sequelize=require(_0x0f54('0x0'));module[_0x0f54('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 48a0735..a69bf39 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 _0x3381=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','getQueues','findOne','channel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','addQueues','isValidChannel','add','Queues','ids','removeQueues','remove','Voice','Chat','Mail','Sms','Fax','Whatsapp','each','addAgents','User','online','voicePause','interface','upsert','format','SIP/%s','omit','spread','emit','userTeam:save','removeAgents','voice','chat','mail','sms','whatsapp','UserVoiceQueueRt','isArray','userTeam:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./team.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','filtears','length','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x512dfe,_0x26d598){var _0x4a69c8=function(_0x581af8){while(--_0x581af8){_0x512dfe['push'](_0x512dfe['shift']());}};_0x4a69c8(++_0x26d598);}(_0x3381,0x140));var _0x1338=function(_0x724c4c,_0x2cc07d){_0x724c4c=_0x724c4c-0x0;var _0x5f3db9=_0x3381[_0x724c4c];return _0x5f3db9;};'use strict';var pdf=require(_0x1338('0x0'));var emlformat=require(_0x1338('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1338('0x2'));var jsonpatch=require(_0x1338('0x3'));var rp=require(_0x1338('0x4'));var moment=require(_0x1338('0x5'));var BPromise=require(_0x1338('0x6'));var Mustache=require(_0x1338('0x7'));var util=require(_0x1338('0x8'));var path=require(_0x1338('0x9'));var sox=require('sox');var csv=require(_0x1338('0xa'));var ejs=require(_0x1338('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1338('0xc'));var crypto=require(_0x1338('0xd'));var jsforce=require(_0x1338('0xe'));var deskjs=require(_0x1338('0xf'));var toCsv=require(_0x1338('0xa'));var querystring=require('querystring');var Papa=require(_0x1338('0x10'));var Redis=require(_0x1338('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1338('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1338('0x13'));var logger=require(_0x1338('0x14'))(_0x1338('0x15'));var utils=require(_0x1338('0x16'));var config=require(_0x1338('0x17'));var licenseUtil=require(_0x1338('0x18'));var db=require(_0x1338('0x19'))['db'];config[_0x1338('0x1a')]=_[_0x1338('0x1b')](config[_0x1338('0x1a')],{'host':_0x1338('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1338('0x1a')]));require(_0x1338('0x1d'))[_0x1338('0x1e')](socket);function respondWithStatusCode(_0x411a80,_0x3ed62d){_0x3ed62d=_0x3ed62d||0xcc;return function(_0x5f2fbf){if(_0x5f2fbf){return _0x411a80[_0x1338('0x1f')](_0x3ed62d);}return _0x411a80[_0x1338('0x20')](_0x3ed62d)[_0x1338('0x21')]();};}function respondWithResult(_0xd23886,_0x18529f){_0x18529f=_0x18529f||0xc8;return function(_0x18a437){if(_0x18a437){return _0xd23886[_0x1338('0x20')](_0x18529f)['json'](_0x18a437);}};}function respondWithFilteredResult(_0x3fe85e,_0x35eb7b){return function(_0x528306){if(_0x528306){var _0xe9d91c=_0x528306[_0x1338('0x22')],_0x98a65c=_0x35eb7b[_0x1338('0x23')],_0x2ee983=_0x35eb7b[_0x1338('0x23')]+_0x35eb7b[_0x1338('0x24')],_0x3da0d2;if(_0x2ee983>=_0xe9d91c){_0x2ee983=_0xe9d91c;_0x3da0d2=0xc8;}else{_0x3da0d2=0xce;}_0x3fe85e[_0x1338('0x20')](_0x3da0d2);return _0x3fe85e[_0x1338('0x25')](_0x1338('0x26'),_0x98a65c+'-'+_0x2ee983+'/'+_0xe9d91c)[_0x1338('0x27')](_0x528306);}return null;};}function patchUpdates(_0x154a85){return function(_0xc60462){try{jsonpatch['apply'](_0xc60462,_0x154a85,!![]);}catch(_0x2c2107){return BPromise[_0x1338('0x28')](_0x2c2107);}return _0xc60462['save']();};}function saveUpdates(_0x50ddb5,_0x7c0e67){return function(_0x398fec){if(_0x398fec){return _0x398fec['update'](_0x50ddb5)['then'](function(_0x1dac76){return _0x1dac76;});}return null;};}function removeEntity(_0x3ba0d7,_0x113d72){return function(_0x3a570e){if(_0x3a570e){return _0x3a570e[_0x1338('0x29')]()[_0x1338('0x2a')](function(){var _0x3d850d=_0x3a570e[_0x1338('0x2b')]({'plain':!![]});var _0x1fdb35='Teams';return db[_0x1338('0x2c')]['destroy']({'where':{'type':_0x1fdb35,'resourceId':_0x3d850d['id']}})[_0x1338('0x2a')](function(){return _0x3a570e;});})[_0x1338('0x2a')](function(){_0x3ba0d7[_0x1338('0x20')](0xcc)[_0x1338('0x21')]();});}};}function handleEntityNotFound(_0xc83a89,_0x3c0de9){return function(_0x3be153){if(!_0x3be153){_0xc83a89['sendStatus'](0x194);}return _0x3be153;};}function handleError(_0x185fdd,_0x16ce3c){_0x16ce3c=_0x16ce3c||0x1f4;return function(_0x96fb18){logger[_0x1338('0x2d')](_0x96fb18[_0x1338('0x2e')]);if(_0x96fb18[_0x1338('0x2f')]){delete _0x96fb18['name'];}_0x185fdd[_0x1338('0x20')](_0x16ce3c)[_0x1338('0x30')](_0x96fb18);};}exports[_0x1338('0x31')]=function(_0x54e655,_0x19896c){var _0x3e39d6={},_0x5d147b={},_0x4517a2={'count':0x0,'rows':[]};var _0x342de0=_[_0x1338('0x32')](db[_0x1338('0x33')][_0x1338('0x34')],function(_0x2687db){return{'name':_0x2687db[_0x1338('0x35')],'type':_0x2687db[_0x1338('0x36')][_0x1338('0x37')]};});_0x5d147b[_0x1338('0x38')]=_[_0x1338('0x32')](_0x342de0,_0x1338('0x2f'));_0x5d147b[_0x1338('0x39')]=_[_0x1338('0x3a')](_0x54e655['query']);_0x5d147b[_0x1338('0x3b')]=_[_0x1338('0x3c')](_0x5d147b[_0x1338('0x38')],_0x5d147b['query']);_0x3e39d6['attributes']=_['intersection'](_0x5d147b[_0x1338('0x38')],qs[_0x1338('0x3d')](_0x54e655[_0x1338('0x39')][_0x1338('0x3d')]));_0x3e39d6[_0x1338('0x3e')]=_0x3e39d6[_0x1338('0x3e')]['length']?_0x3e39d6[_0x1338('0x3e')]:_0x5d147b[_0x1338('0x38')];if(!_0x54e655[_0x1338('0x39')][_0x1338('0x3f')](_0x1338('0x40'))){_0x3e39d6[_0x1338('0x24')]=qs['limit'](_0x54e655[_0x1338('0x39')][_0x1338('0x24')]);_0x3e39d6[_0x1338('0x23')]=qs[_0x1338('0x23')](_0x54e655[_0x1338('0x39')][_0x1338('0x23')]);}_0x3e39d6[_0x1338('0x41')]=qs[_0x1338('0x42')](_0x54e655[_0x1338('0x39')]['sort']);_0x3e39d6[_0x1338('0x43')]=qs[_0x1338('0x3b')](_[_0x1338('0x44')](_0x54e655[_0x1338('0x39')],_0x5d147b[_0x1338('0x3b')]),_0x342de0);if(_0x54e655[_0x1338('0x39')][_0x1338('0x45')]){_0x3e39d6[_0x1338('0x43')]=_[_0x1338('0x46')](_0x3e39d6[_0x1338('0x43')],{'$or':_[_0x1338('0x32')](_0x342de0,function(_0x85b437){if(_0x85b437[_0x1338('0x36')]!==_0x1338('0x47')){var _0x367ad2={};_0x367ad2[_0x85b437['name']]={'$like':'%'+_0x54e655[_0x1338('0x39')][_0x1338('0x45')]+'%'};return _0x367ad2;}})});}_0x3e39d6=_['merge']({},_0x3e39d6,_0x54e655[_0x1338('0x48')]);var _0x4a8ba1={'where':_0x3e39d6[_0x1338('0x43')]};return db[_0x1338('0x33')]['count'](_0x4a8ba1)[_0x1338('0x2a')](function(_0x390ba6){_0x4517a2['count']=_0x390ba6;if(_0x54e655[_0x1338('0x39')][_0x1338('0x49')]){_0x3e39d6[_0x1338('0x4a')]=[{'all':!![]}];}return db['Team'][_0x1338('0x4b')](_0x3e39d6);})[_0x1338('0x2a')](function(_0x57a482){_0x4517a2['rows']=_0x57a482;return _0x4517a2;})[_0x1338('0x2a')](respondWithFilteredResult(_0x19896c,_0x3e39d6))['catch'](handleError(_0x19896c,null));};exports['show']=function(_0x16eb0b,_0x546a39){var _0x3beafa={'raw':![],'where':{'id':_0x16eb0b[_0x1338('0x4c')]['id']}},_0x83b4={};_0x83b4[_0x1338('0x38')]=_[_0x1338('0x3a')](db[_0x1338('0x33')][_0x1338('0x34')]);_0x83b4[_0x1338('0x39')]=_['keys'](_0x16eb0b['query']);_0x83b4[_0x1338('0x4d')]=_[_0x1338('0x3c')](_0x83b4['model'],_0x83b4[_0x1338('0x39')]);_0x3beafa['attributes']=_['intersection'](_0x83b4[_0x1338('0x38')],qs[_0x1338('0x3d')](_0x16eb0b[_0x1338('0x39')][_0x1338('0x3d')]));_0x3beafa[_0x1338('0x3e')]=_0x3beafa[_0x1338('0x3e')][_0x1338('0x4e')]?_0x3beafa['attributes']:_0x83b4['model'];if(_0x16eb0b[_0x1338('0x39')][_0x1338('0x49')]){_0x3beafa[_0x1338('0x4a')]=[{'all':!![]}];}_0x3beafa=_['merge']({},_0x3beafa,_0x16eb0b[_0x1338('0x48')]);return db['Team'][_0x1338('0x4f')](_0x3beafa)[_0x1338('0x2a')](handleEntityNotFound(_0x546a39,null))[_0x1338('0x2a')](respondWithResult(_0x546a39,null))[_0x1338('0x50')](handleError(_0x546a39,null));};exports[_0x1338('0x51')]=function(_0x2fde37,_0x5a4613){return db['Team']['create'](_0x2fde37['body'],{})[_0x1338('0x2a')](function(_0x26674a){var _0x223a0a=_0x2fde37[_0x1338('0x52')][_0x1338('0x2b')]({'plain':!![]});if(!_0x223a0a)throw new Error(_0x1338('0x53'));if(_0x223a0a[_0x1338('0x54')]===_0x1338('0x52')){var _0x24f292=_0x26674a[_0x1338('0x2b')]({'plain':!![]});var _0x5af511='Teams';return db[_0x1338('0x55')]['find']({'where':{'name':_0x5af511,'userProfileId':_0x223a0a[_0x1338('0x56')]},'raw':!![]})[_0x1338('0x2a')](function(_0x55fc1a){if(_0x55fc1a&&_0x55fc1a[_0x1338('0x57')]===0x0){return db[_0x1338('0x2c')]['create']({'name':_0x24f292[_0x1338('0x2f')],'resourceId':_0x24f292['id'],'type':_0x55fc1a[_0x1338('0x2f')],'sectionId':_0x55fc1a['id']},{})[_0x1338('0x2a')](function(){return _0x26674a;});}else{return _0x26674a;}})['catch'](function(_0x1193bb){logger['error'](_0x1338('0x58'),_0x1193bb);throw _0x1193bb;});}return _0x26674a;})[_0x1338('0x2a')](respondWithResult(_0x5a4613,0xc9))[_0x1338('0x50')](handleError(_0x5a4613,null));};exports[_0x1338('0x59')]=function(_0x1864d2,_0x1bcd66){if(_0x1864d2[_0x1338('0x5a')]['id']){delete _0x1864d2[_0x1338('0x5a')]['id'];}return db[_0x1338('0x33')]['find']({'where':{'id':_0x1864d2['params']['id']}})[_0x1338('0x2a')](handleEntityNotFound(_0x1bcd66,null))[_0x1338('0x2a')](saveUpdates(_0x1864d2[_0x1338('0x5a')],null))['then'](respondWithResult(_0x1bcd66,null))[_0x1338('0x50')](handleError(_0x1bcd66,null));};exports[_0x1338('0x29')]=function(_0x96885e,_0x232b86){return db[_0x1338('0x33')][_0x1338('0x4f')]({'where':{'id':_0x96885e['params']['id']}})[_0x1338('0x2a')](handleEntityNotFound(_0x232b86,null))[_0x1338('0x2a')](removeEntity(_0x232b86,null))[_0x1338('0x50')](handleError(_0x232b86,null));};exports[_0x1338('0x5b')]=function(_0x159283,_0x443d74,_0xa4e6c6){return db[_0x1338('0x33')][_0x1338('0x5c')]({'where':{'id':_0x159283[_0x1338('0x4c')]['id']}})['then'](handleEntityNotFound(_0x443d74,null))[_0x1338('0x2a')](function(_0x274680){if(!_0x159283['query'][_0x1338('0x5d')]||!utils['isValidChannel'](_0x159283[_0x1338('0x39')][_0x1338('0x5d')])){throw new db[(_0x1338('0x5e'))][(_0x1338('0x5f'))](_0x1338('0x60'));}var _0x1e08e2={};var _0x16566e={};_0x16566e[_0x1338('0x38')]=_[_0x1338('0x3a')](db[_[_0x1338('0x61')](_0x159283['query'][_0x1338('0x5d')][_0x1338('0x62')]())+'Queue'][_0x1338('0x34')]);_0x16566e[_0x1338('0x39')]=_[_0x1338('0x3a')](_0x159283[_0x1338('0x39')]);_0x16566e[_0x1338('0x3b')]=_['intersection'](_0x16566e[_0x1338('0x38')],_0x16566e[_0x1338('0x39')]);_0x1e08e2['attributes']=_['intersection'](_0x16566e[_0x1338('0x38')],qs[_0x1338('0x3d')](_0x159283['query'][_0x1338('0x3d')]));_0x1e08e2[_0x1338('0x3e')]=_0x1e08e2[_0x1338('0x3e')][_0x1338('0x4e')]?_0x1e08e2['attributes']:_0x16566e['model'];_0x1e08e2[_0x1338('0x24')]=qs[_0x1338('0x24')](_0x159283['query']['limit']);_0x1e08e2['offset']=qs[_0x1338('0x23')](_0x159283[_0x1338('0x39')][_0x1338('0x23')]);_0x1e08e2[_0x1338('0x41')]=qs['sort'](_0x159283[_0x1338('0x39')][_0x1338('0x42')]);_0x1e08e2['where']=qs[_0x1338('0x3b')](_['pick'](_0x159283['query'],_0x16566e[_0x1338('0x3b')]));_0x1e08e2=_[_0x1338('0x46')]({},_0x1e08e2,_0x159283[_0x1338('0x48')]);return _0x274680[_0x1338('0x2b')+_[_0x1338('0x61')](_0x159283[_0x1338('0x39')][_0x1338('0x5d')][_0x1338('0x62')]())+'Queues'](_0x1e08e2);})[_0x1338('0x2a')](respondWithResult(_0x443d74,null))[_0x1338('0x50')](handleError(_0x443d74,null));};exports[_0x1338('0x63')]=function(_0x434f52,_0x7255f,_0x13ee9a){return db['Team'][_0x1338('0x5c')]({'where':{'id':_0x434f52['params']['id']}})['then'](function(_0x1e2bd1){if(_0x1e2bd1){if(!_0x434f52[_0x1338('0x5a')]['channel']||!utils[_0x1338('0x64')](_0x434f52[_0x1338('0x5a')][_0x1338('0x5d')])){throw new db[(_0x1338('0x5e'))][(_0x1338('0x5f'))](_0x1338('0x60'));}return _0x1e2bd1[_0x1338('0x65')+_[_0x1338('0x61')](_0x434f52[_0x1338('0x5a')]['channel'][_0x1338('0x62')]())+_0x1338('0x66')](_0x434f52[_0x1338('0x5a')][_0x1338('0x67')]);}return null;})['then'](handleEntityNotFound(_0x7255f,null))['then'](respondWithStatusCode(_0x7255f,null))[_0x1338('0x50')](handleError(_0x7255f,null));};exports[_0x1338('0x68')]=function(_0x4de8fc,_0x21c87c,_0x6c7da7){return db[_0x1338('0x33')][_0x1338('0x5c')]({'where':{'id':_0x4de8fc[_0x1338('0x4c')]['id']}})[_0x1338('0x2a')](function(_0xe3fb8e){if(_0xe3fb8e){if(!_0x4de8fc[_0x1338('0x39')][_0x1338('0x5d')]||!utils[_0x1338('0x64')](_0x4de8fc['query'][_0x1338('0x5d')])){throw new db['Sequelize'][(_0x1338('0x5f'))]('Unknown\x20channel');}return _0xe3fb8e[_0x1338('0x69')+_[_0x1338('0x61')](_0x4de8fc[_0x1338('0x39')]['channel'][_0x1338('0x62')]())+'Queues'](_0x4de8fc[_0x1338('0x39')][_0x1338('0x67')]);}return null;})[_0x1338('0x2a')](handleEntityNotFound(_0x21c87c,null))['then'](respondWithStatusCode(_0x21c87c,null))[_0x1338('0x50')](handleError(_0x21c87c,null));};exports['addAgents']=function(_0x1b9924,_0x3b177e,_0x12d935){return db[_0x1338('0x33')][_0x1338('0x4f')]({'where':{'id':_0x1b9924[_0x1338('0x4c')]['id']}})[_0x1338('0x2a')](handleEntityNotFound(_0x3b177e,null))['then'](function(_0x2a8918){if(_0x2a8918){var _0x2a5964=[_0x1338('0x6a'),_0x1338('0x6b'),_0x1338('0x6c'),_0x1338('0x6d'),_0x1338('0x6e'),'Openchannel',_0x1338('0x6f')];return BPromise[_0x1338('0x70')](_0x2a5964,function(_0x4f8727){return _0x2a8918[_0x1338('0x2b')+_0x4f8727+_0x1338('0x66')]({'attributes':['id',_0x1338('0x2f')]})[_0x1338('0x2a')](function(_0x4d3115){return BPromise['each'](_0x4d3115,function(_0x3d07b4){return _0x3d07b4[_0x1338('0x71')](_0x1b9924[_0x1338('0x5a')][_0x1338('0x67')])['then'](function(){if(_0x4f8727===_0x1338('0x6a')){return db[_0x1338('0x72')][_0x1338('0x4b')]({'where':{'id':_0x1b9924[_0x1338('0x5a')][_0x1338('0x67')]},'attributes':['id','name',_0x1338('0x73'),_0x1338('0x74'),_0x1338('0x75')],'raw':!![]})[_0x1338('0x2a')](function(_0x57dcb4){return BPromise[_0x1338('0x70')](_[_0x1338('0x45')](_0x57dcb4,{'online':0x1}),function(_0x10d624){return db['UserVoiceQueueRt'][_0x1338('0x76')]({'membername':_0x10d624[_0x1338('0x2f')],'UserId':_0x10d624['id'],'queue_name':_0x3d07b4[_0x1338('0x2f')],'VoiceQueueId':_0x3d07b4['id'],'interface':_['isNil'](_0x10d624[_0x1338('0x75')])?util[_0x1338('0x77')](_0x1338('0x78'),_0x10d624['name']):_0x10d624['interface'],'paused':_0x10d624['voicePause']||![],'penalty':0x0});});});}});});})[_0x1338('0x2a')](function(){return _0x2a8918;});})['then'](function(){return _0x2a8918;});}})[_0x1338('0x2a')](function(_0x43f48e){if(_0x43f48e){return _0x43f48e[_0x1338('0x71')](_0x1b9924[_0x1338('0x5a')]['ids'],_[_0x1338('0x79')](_0x1b9924['body'],[_0x1338('0x67'),'id'])||{})[_0x1338('0x7a')](function(_0x2c269c){for(var _0x47acb3=0x0;_0x47acb3<_0x1b9924[_0x1338('0x5a')][_0x1338('0x67')]['length'];_0x47acb3+=0x1){socket[_0x1338('0x7b')](_0x1338('0x7c'),{'UserId':_0x1b9924[_0x1338('0x5a')][_0x1338('0x67')][_0x47acb3],'TeamId':_0x1b9924[_0x1338('0x4c')]['id']});}return _0x2c269c;});}})[_0x1338('0x2a')](respondWithResult(_0x3b177e,null))[_0x1338('0x50')](handleError(_0x3b177e,null));};exports[_0x1338('0x7d')]=function(_0xd78ec6,_0x445429,_0x106ac3){return db['Team'][_0x1338('0x4f')]({'where':{'id':_0xd78ec6[_0x1338('0x4c')]['id']}})[_0x1338('0x2a')](handleEntityNotFound(_0x445429,null))[_0x1338('0x2a')](function(_0x3ee1af){if(_0x3ee1af){return BPromise[_0x1338('0x70')]([_0x1338('0x7e'),_0x1338('0x7f'),_0x1338('0x80'),_0x1338('0x81'),'fax','openchannel',_0x1338('0x82')],function(_0x33748e){return _0x3ee1af['get'+_['capitalize'](_0x33748e)+_0x1338('0x66')]({'attributes':['id','name']})[_0x1338('0x2a')](function(_0x154ef2){return BPromise[_0x1338('0x70')](_0x154ef2,function(_0x8d243c){return _0x8d243c[_0x1338('0x7d')](_0xd78ec6[_0x1338('0x39')][_0x1338('0x67')])['then'](function(){if(_0x33748e===_0x1338('0x7e')){return db[_0x1338('0x83')][_0x1338('0x29')]({'where':{'VoiceQueueId':_0x8d243c['id'],'UserId':_0xd78ec6['query'][_0x1338('0x67')]}});}});});})['then'](function(){return _0x3ee1af;});})[_0x1338('0x2a')](function(){return _0x3ee1af;});}})[_0x1338('0x2a')](function(_0xf064c0){if(_0xf064c0){return _0xf064c0[_0x1338('0x7d')](_0xd78ec6[_0x1338('0x39')][_0x1338('0x67')])[_0x1338('0x2a')](function(){if(_[_0x1338('0x84')](_0xd78ec6['query'][_0x1338('0x67')])){for(var _0x1a8e51=0x0;_0x1a8e51<_0xd78ec6[_0x1338('0x39')]['ids'][_0x1338('0x4e')];_0x1a8e51+=0x1){socket[_0x1338('0x7b')](_0x1338('0x85'),{'UserId':Number(_0xd78ec6['query'][_0x1338('0x67')][_0x1a8e51]),'TeamId':Number(_0xd78ec6[_0x1338('0x4c')]['id'])});}}else{socket[_0x1338('0x7b')](_0x1338('0x85'),{'UserId':Number(_0xd78ec6[_0x1338('0x39')][_0x1338('0x67')]),'TeamId':Number(_0xd78ec6[_0x1338('0x4c')]['id'])});}});}})[_0x1338('0x2a')](respondWithStatusCode(_0x445429,null))[_0x1338('0x50')](handleError(_0x445429,null));};exports[_0x1338('0x86')]=function(_0x12d7a3,_0x283164,_0x508070){var _0x3f4f09={};var _0x3c0fb8={};var _0x131642;var _0x24a3a9;return db['Team']['findOne']({'where':{'id':_0x12d7a3[_0x1338('0x4c')]['id']}})[_0x1338('0x2a')](handleEntityNotFound(_0x283164,null))['then'](function(_0x3e723d){if(_0x3e723d){_0x131642=_0x3e723d;_0x3c0fb8[_0x1338('0x38')]=_[_0x1338('0x3a')](db[_0x1338('0x72')][_0x1338('0x34')]);_0x3c0fb8[_0x1338('0x39')]=_[_0x1338('0x3a')](_0x12d7a3[_0x1338('0x39')]);_0x3c0fb8['filters']=_['intersection'](_0x3c0fb8[_0x1338('0x38')],_0x3c0fb8[_0x1338('0x39')]);_0x3f4f09[_0x1338('0x3e')]=_[_0x1338('0x3c')](_0x3c0fb8[_0x1338('0x38')],qs[_0x1338('0x3d')](_0x12d7a3[_0x1338('0x39')][_0x1338('0x3d')]));_0x3f4f09['attributes']=_0x3f4f09['attributes'][_0x1338('0x4e')]?_0x3f4f09['attributes']:_0x3c0fb8[_0x1338('0x38')];_0x3f4f09[_0x1338('0x41')]=qs[_0x1338('0x42')](_0x12d7a3[_0x1338('0x39')][_0x1338('0x42')]);_0x3f4f09[_0x1338('0x43')]=qs['filters'](_[_0x1338('0x44')](_0x12d7a3[_0x1338('0x39')],_0x3c0fb8[_0x1338('0x3b')]));if(_0x12d7a3[_0x1338('0x39')][_0x1338('0x45')]){_0x3f4f09['where']=_['merge'](_0x3f4f09[_0x1338('0x43')],{'$or':_['map'](_0x3f4f09[_0x1338('0x3e')],function(_0x3b659e){var _0x57bba2={};_0x57bba2[_0x3b659e]={'$like':'%'+_0x12d7a3['query'][_0x1338('0x45')]+'%'};return _0x57bba2;})});}_0x3f4f09=_[_0x1338('0x46')]({},_0x3f4f09,_0x12d7a3[_0x1338('0x48')]);return _0x131642[_0x1338('0x86')](_0x3f4f09);}})[_0x1338('0x2a')](function(_0x566344){if(_0x566344){_0x24a3a9=_0x566344[_0x1338('0x4e')];if(!_0x12d7a3[_0x1338('0x39')][_0x1338('0x3f')]('nolimit')){_0x3f4f09[_0x1338('0x24')]=qs[_0x1338('0x24')](_0x12d7a3[_0x1338('0x39')]['limit']);_0x3f4f09[_0x1338('0x23')]=qs[_0x1338('0x23')](_0x12d7a3[_0x1338('0x39')][_0x1338('0x23')]);}return _0x131642[_0x1338('0x86')](_0x3f4f09);}})[_0x1338('0x2a')](function(_0x38549b){if(_0x38549b){return _0x38549b?{'count':_0x24a3a9,'rows':_0x38549b}:null;}})['then'](respondWithResult(_0x283164,null))[_0x1338('0x50')](handleError(_0x283164,null));}; \ No newline at end of file +var _0xd850=['redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','get','Teams','UserProfileResource','name','send','index','map','Team','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','filtears','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','Queue','toLowerCase','Queues','add','ids','remove','capitalize','addAgents','Chat','Mail','Fax','Whatsapp','each','Voice','online','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','omit','spread','emit','voice','openchannel','removeAgents','isArray','userTeam:remove','getAgents','User','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb'];(function(_0x579d54,_0x36a9f8){var _0x1a5b2b=function(_0x5ee626){while(--_0x5ee626){_0x579d54['push'](_0x579d54['shift']());}};_0x1a5b2b(++_0x36a9f8);}(_0xd850,0xe4));var _0x0d85=function(_0x438d03,_0x1b403d){_0x438d03=_0x438d03-0x0;var _0x9ef98e=_0xd850[_0x438d03];return _0x9ef98e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0d85('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0d85('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0d85('0x2'));var Mustache=require(_0x0d85('0x3'));var util=require(_0x0d85('0x4'));var path=require(_0x0d85('0x5'));var sox=require(_0x0d85('0x6'));var csv=require(_0x0d85('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0d85('0x8'));var squel=require(_0x0d85('0x9'));var crypto=require(_0x0d85('0xa'));var jsforce=require(_0x0d85('0xb'));var deskjs=require(_0x0d85('0xc'));var toCsv=require(_0x0d85('0x7'));var querystring=require(_0x0d85('0xd'));var Papa=require(_0x0d85('0xe'));var Redis=require(_0x0d85('0xf'));var authService=require(_0x0d85('0x10'));var qs=require(_0x0d85('0x11'));var as=require(_0x0d85('0x12'));var hardwareService=require(_0x0d85('0x13'));var logger=require(_0x0d85('0x14'))(_0x0d85('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0d85('0x16'));var db=require(_0x0d85('0x17'))['db'];config[_0x0d85('0x18')]=_[_0x0d85('0x19')](config[_0x0d85('0x18')],{'host':_0x0d85('0x1a'),'port':0x18eb});var socket=require(_0x0d85('0x1b'))(new Redis(config[_0x0d85('0x18')]));require(_0x0d85('0x1c'))[_0x0d85('0x1d')](socket);function respondWithStatusCode(_0x42ec5e,_0x2fddc6){_0x2fddc6=_0x2fddc6||0xcc;return function(_0x26bc9d){if(_0x26bc9d){return _0x42ec5e[_0x0d85('0x1e')](_0x2fddc6);}return _0x42ec5e[_0x0d85('0x1f')](_0x2fddc6)[_0x0d85('0x20')]();};}function respondWithResult(_0x180f89,_0xcce20){_0xcce20=_0xcce20||0xc8;return function(_0x456afa){if(_0x456afa){return _0x180f89[_0x0d85('0x1f')](_0xcce20)['json'](_0x456afa);}};}function respondWithFilteredResult(_0x31b527,_0x53a308){return function(_0x17ef9a){if(_0x17ef9a){var _0x1fd8a9=_0x17ef9a[_0x0d85('0x21')],_0x237365=_0x53a308['offset'],_0x1cbf79=_0x53a308[_0x0d85('0x22')]+_0x53a308[_0x0d85('0x23')],_0x46eb9b;if(_0x1cbf79>=_0x1fd8a9){_0x1cbf79=_0x1fd8a9;_0x46eb9b=0xc8;}else{_0x46eb9b=0xce;}_0x31b527[_0x0d85('0x1f')](_0x46eb9b);return _0x31b527['set'](_0x0d85('0x24'),_0x237365+'-'+_0x1cbf79+'/'+_0x1fd8a9)[_0x0d85('0x25')](_0x17ef9a);}return null;};}function patchUpdates(_0x3c4f48){return function(_0x3ccc8e){try{jsonpatch[_0x0d85('0x26')](_0x3ccc8e,_0x3c4f48,!![]);}catch(_0x515087){return BPromise[_0x0d85('0x27')](_0x515087);}return _0x3ccc8e[_0x0d85('0x28')]();};}function saveUpdates(_0x53c9df,_0x45002){return function(_0x34dedd){if(_0x34dedd){return _0x34dedd['update'](_0x53c9df)[_0x0d85('0x29')](function(_0x58276d){return _0x58276d;});}return null;};}function removeEntity(_0x1e65fb,_0x31b13a){return function(_0x3354d0){if(_0x3354d0){return _0x3354d0[_0x0d85('0x2a')]()[_0x0d85('0x29')](function(){var _0x34e568=_0x3354d0[_0x0d85('0x2b')]({'plain':!![]});var _0x3f3f10=_0x0d85('0x2c');return db[_0x0d85('0x2d')]['destroy']({'where':{'type':_0x3f3f10,'resourceId':_0x34e568['id']}})[_0x0d85('0x29')](function(){return _0x3354d0;});})[_0x0d85('0x29')](function(){_0x1e65fb[_0x0d85('0x1f')](0xcc)[_0x0d85('0x20')]();});}};}function handleEntityNotFound(_0x4556ea,_0xf723e9){return function(_0x3bf007){if(!_0x3bf007){_0x4556ea['sendStatus'](0x194);}return _0x3bf007;};}function handleError(_0x902187,_0x32b545){_0x32b545=_0x32b545||0x1f4;return function(_0x51d9b1){logger['error'](_0x51d9b1['stack']);if(_0x51d9b1[_0x0d85('0x2e')]){delete _0x51d9b1[_0x0d85('0x2e')];}_0x902187['status'](_0x32b545)[_0x0d85('0x2f')](_0x51d9b1);};}exports[_0x0d85('0x30')]=function(_0x1351c2,_0x586634){var _0x30e33e={},_0x1ef4bd={},_0x412114={'count':0x0,'rows':[]};var _0x41cd86=_[_0x0d85('0x31')](db[_0x0d85('0x32')]['rawAttributes'],function(_0x4f6f6a){return{'name':_0x4f6f6a[_0x0d85('0x33')],'type':_0x4f6f6a[_0x0d85('0x34')][_0x0d85('0x35')]};});_0x1ef4bd[_0x0d85('0x36')]=_['map'](_0x41cd86,_0x0d85('0x2e'));_0x1ef4bd[_0x0d85('0x37')]=_[_0x0d85('0x38')](_0x1351c2[_0x0d85('0x37')]);_0x1ef4bd['filters']=_[_0x0d85('0x39')](_0x1ef4bd[_0x0d85('0x36')],_0x1ef4bd[_0x0d85('0x37')]);_0x30e33e[_0x0d85('0x3a')]=_['intersection'](_0x1ef4bd[_0x0d85('0x36')],qs[_0x0d85('0x3b')](_0x1351c2[_0x0d85('0x37')][_0x0d85('0x3b')]));_0x30e33e['attributes']=_0x30e33e[_0x0d85('0x3a')][_0x0d85('0x3c')]?_0x30e33e[_0x0d85('0x3a')]:_0x1ef4bd[_0x0d85('0x36')];if(!_0x1351c2[_0x0d85('0x37')][_0x0d85('0x3d')](_0x0d85('0x3e'))){_0x30e33e[_0x0d85('0x23')]=qs[_0x0d85('0x23')](_0x1351c2[_0x0d85('0x37')][_0x0d85('0x23')]);_0x30e33e[_0x0d85('0x22')]=qs['offset'](_0x1351c2[_0x0d85('0x37')][_0x0d85('0x22')]);}_0x30e33e[_0x0d85('0x3f')]=qs[_0x0d85('0x40')](_0x1351c2['query'][_0x0d85('0x40')]);_0x30e33e[_0x0d85('0x41')]=qs[_0x0d85('0x42')](_[_0x0d85('0x43')](_0x1351c2['query'],_0x1ef4bd[_0x0d85('0x42')]),_0x41cd86);if(_0x1351c2[_0x0d85('0x37')]['filter']){_0x30e33e[_0x0d85('0x41')]=_[_0x0d85('0x44')](_0x30e33e[_0x0d85('0x41')],{'$or':_[_0x0d85('0x31')](_0x41cd86,function(_0x28dc22){if(_0x28dc22['type']!==_0x0d85('0x45')){var _0x5898c8={};_0x5898c8[_0x28dc22[_0x0d85('0x2e')]]={'$like':'%'+_0x1351c2[_0x0d85('0x37')][_0x0d85('0x46')]+'%'};return _0x5898c8;}})});}_0x30e33e=_['merge']({},_0x30e33e,_0x1351c2['options']);var _0x2f45ca={'where':_0x30e33e[_0x0d85('0x41')]};return db[_0x0d85('0x32')]['count'](_0x2f45ca)['then'](function(_0x25e0ec){_0x412114['count']=_0x25e0ec;if(_0x1351c2[_0x0d85('0x37')][_0x0d85('0x47')]){_0x30e33e[_0x0d85('0x48')]=[{'all':!![]}];}return db[_0x0d85('0x32')][_0x0d85('0x49')](_0x30e33e);})[_0x0d85('0x29')](function(_0x910b3f){_0x412114[_0x0d85('0x4a')]=_0x910b3f;return _0x412114;})[_0x0d85('0x29')](respondWithFilteredResult(_0x586634,_0x30e33e))[_0x0d85('0x4b')](handleError(_0x586634,null));};exports[_0x0d85('0x4c')]=function(_0x1f8f1f,_0x1c3f5f){var _0x541e97={'raw':![],'where':{'id':_0x1f8f1f[_0x0d85('0x4d')]['id']}},_0x2d0262={};_0x2d0262[_0x0d85('0x36')]=_[_0x0d85('0x38')](db['Team'][_0x0d85('0x4e')]);_0x2d0262[_0x0d85('0x37')]=_[_0x0d85('0x38')](_0x1f8f1f[_0x0d85('0x37')]);_0x2d0262[_0x0d85('0x4f')]=_[_0x0d85('0x39')](_0x2d0262[_0x0d85('0x36')],_0x2d0262[_0x0d85('0x37')]);_0x541e97[_0x0d85('0x3a')]=_['intersection'](_0x2d0262['model'],qs[_0x0d85('0x3b')](_0x1f8f1f[_0x0d85('0x37')][_0x0d85('0x3b')]));_0x541e97[_0x0d85('0x3a')]=_0x541e97[_0x0d85('0x3a')][_0x0d85('0x3c')]?_0x541e97[_0x0d85('0x3a')]:_0x2d0262['model'];if(_0x1f8f1f[_0x0d85('0x37')]['includeAll']){_0x541e97[_0x0d85('0x48')]=[{'all':!![]}];}_0x541e97=_[_0x0d85('0x44')]({},_0x541e97,_0x1f8f1f[_0x0d85('0x50')]);return db[_0x0d85('0x32')][_0x0d85('0x51')](_0x541e97)[_0x0d85('0x29')](handleEntityNotFound(_0x1c3f5f,null))[_0x0d85('0x29')](respondWithResult(_0x1c3f5f,null))[_0x0d85('0x4b')](handleError(_0x1c3f5f,null));};exports['create']=function(_0xbedc53,_0x17ff01){return db[_0x0d85('0x32')]['create'](_0xbedc53[_0x0d85('0x52')],{})[_0x0d85('0x29')](function(_0x44752f){var _0x135ca9=_0xbedc53[_0x0d85('0x53')][_0x0d85('0x2b')]({'plain':!![]});if(!_0x135ca9)throw new Error(_0x0d85('0x54'));if(_0x135ca9[_0x0d85('0x55')]===_0x0d85('0x53')){var _0x5b7a75=_0x44752f[_0x0d85('0x2b')]({'plain':!![]});var _0xf83d2c=_0x0d85('0x2c');return db['UserProfileSection'][_0x0d85('0x51')]({'where':{'name':_0xf83d2c,'userProfileId':_0x135ca9['userProfileId']},'raw':!![]})[_0x0d85('0x29')](function(_0xaf582b){if(_0xaf582b&&_0xaf582b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5b7a75['name'],'resourceId':_0x5b7a75['id'],'type':_0xaf582b[_0x0d85('0x2e')],'sectionId':_0xaf582b['id']},{})[_0x0d85('0x29')](function(){return _0x44752f;});}else{return _0x44752f;}})[_0x0d85('0x4b')](function(_0x4659e2){logger[_0x0d85('0x56')](_0x0d85('0x57'),_0x4659e2);throw _0x4659e2;});}return _0x44752f;})['then'](respondWithResult(_0x17ff01,0xc9))[_0x0d85('0x4b')](handleError(_0x17ff01,null));};exports[_0x0d85('0x58')]=function(_0xf907b9,_0x1836e1){if(_0xf907b9[_0x0d85('0x52')]['id']){delete _0xf907b9[_0x0d85('0x52')]['id'];}return db[_0x0d85('0x32')][_0x0d85('0x51')]({'where':{'id':_0xf907b9[_0x0d85('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1836e1,null))[_0x0d85('0x29')](saveUpdates(_0xf907b9[_0x0d85('0x52')],null))[_0x0d85('0x29')](respondWithResult(_0x1836e1,null))[_0x0d85('0x4b')](handleError(_0x1836e1,null));};exports[_0x0d85('0x2a')]=function(_0x154ff2,_0x5503d6){return db[_0x0d85('0x32')][_0x0d85('0x51')]({'where':{'id':_0x154ff2[_0x0d85('0x4d')]['id']}})[_0x0d85('0x29')](handleEntityNotFound(_0x5503d6,null))['then'](removeEntity(_0x5503d6,null))[_0x0d85('0x4b')](handleError(_0x5503d6,null));};exports['getQueues']=function(_0x52b6e1,_0x32fa28,_0x44b210){return db[_0x0d85('0x32')][_0x0d85('0x59')]({'where':{'id':_0x52b6e1[_0x0d85('0x4d')]['id']}})['then'](handleEntityNotFound(_0x32fa28,null))['then'](function(_0x39a8bc){if(!_0x52b6e1[_0x0d85('0x37')][_0x0d85('0x5a')]||!utils[_0x0d85('0x5b')](_0x52b6e1[_0x0d85('0x37')][_0x0d85('0x5a')])){throw new db[(_0x0d85('0x5c'))][(_0x0d85('0x5d'))](_0x0d85('0x5e'));}var _0x1d3dfe={};var _0x1b941a={};_0x1b941a[_0x0d85('0x36')]=_['keys'](db[_['capitalize'](_0x52b6e1['query'][_0x0d85('0x5a')]['toLowerCase']())+_0x0d85('0x5f')][_0x0d85('0x4e')]);_0x1b941a[_0x0d85('0x37')]=_['keys'](_0x52b6e1[_0x0d85('0x37')]);_0x1b941a[_0x0d85('0x42')]=_[_0x0d85('0x39')](_0x1b941a[_0x0d85('0x36')],_0x1b941a[_0x0d85('0x37')]);_0x1d3dfe[_0x0d85('0x3a')]=_[_0x0d85('0x39')](_0x1b941a[_0x0d85('0x36')],qs[_0x0d85('0x3b')](_0x52b6e1[_0x0d85('0x37')][_0x0d85('0x3b')]));_0x1d3dfe[_0x0d85('0x3a')]=_0x1d3dfe[_0x0d85('0x3a')][_0x0d85('0x3c')]?_0x1d3dfe[_0x0d85('0x3a')]:_0x1b941a[_0x0d85('0x36')];_0x1d3dfe[_0x0d85('0x23')]=qs['limit'](_0x52b6e1[_0x0d85('0x37')][_0x0d85('0x23')]);_0x1d3dfe[_0x0d85('0x22')]=qs['offset'](_0x52b6e1[_0x0d85('0x37')][_0x0d85('0x22')]);_0x1d3dfe['order']=qs[_0x0d85('0x40')](_0x52b6e1['query'][_0x0d85('0x40')]);_0x1d3dfe[_0x0d85('0x41')]=qs[_0x0d85('0x42')](_[_0x0d85('0x43')](_0x52b6e1[_0x0d85('0x37')],_0x1b941a[_0x0d85('0x42')]));_0x1d3dfe=_[_0x0d85('0x44')]({},_0x1d3dfe,_0x52b6e1[_0x0d85('0x50')]);return _0x39a8bc['get'+_['capitalize'](_0x52b6e1[_0x0d85('0x37')][_0x0d85('0x5a')][_0x0d85('0x60')]())+_0x0d85('0x61')](_0x1d3dfe);})['then'](respondWithResult(_0x32fa28,null))[_0x0d85('0x4b')](handleError(_0x32fa28,null));};exports['addQueues']=function(_0x1a9605,_0x19bf36,_0x20cddc){return db[_0x0d85('0x32')][_0x0d85('0x59')]({'where':{'id':_0x1a9605['params']['id']}})[_0x0d85('0x29')](function(_0x324900){if(_0x324900){if(!_0x1a9605['body'][_0x0d85('0x5a')]||!utils[_0x0d85('0x5b')](_0x1a9605['body'][_0x0d85('0x5a')])){throw new db[(_0x0d85('0x5c'))]['ValidationError'](_0x0d85('0x5e'));}return _0x324900[_0x0d85('0x62')+_['capitalize'](_0x1a9605[_0x0d85('0x52')][_0x0d85('0x5a')]['toLowerCase']())+_0x0d85('0x61')](_0x1a9605['body'][_0x0d85('0x63')]);}return null;})[_0x0d85('0x29')](handleEntityNotFound(_0x19bf36,null))[_0x0d85('0x29')](respondWithStatusCode(_0x19bf36,null))[_0x0d85('0x4b')](handleError(_0x19bf36,null));};exports['removeQueues']=function(_0xde1ae2,_0x159093,_0x379440){return db['Team']['findOne']({'where':{'id':_0xde1ae2[_0x0d85('0x4d')]['id']}})['then'](function(_0x1e3952){if(_0x1e3952){if(!_0xde1ae2[_0x0d85('0x37')][_0x0d85('0x5a')]||!utils[_0x0d85('0x5b')](_0xde1ae2['query'][_0x0d85('0x5a')])){throw new db['Sequelize']['ValidationError'](_0x0d85('0x5e'));}return _0x1e3952[_0x0d85('0x64')+_[_0x0d85('0x65')](_0xde1ae2[_0x0d85('0x37')]['channel']['toLowerCase']())+_0x0d85('0x61')](_0xde1ae2[_0x0d85('0x37')][_0x0d85('0x63')]);}return null;})[_0x0d85('0x29')](handleEntityNotFound(_0x159093,null))[_0x0d85('0x29')](respondWithStatusCode(_0x159093,null))[_0x0d85('0x4b')](handleError(_0x159093,null));};exports[_0x0d85('0x66')]=function(_0x22e860,_0x4a8c80,_0x1774ad){return db[_0x0d85('0x32')][_0x0d85('0x51')]({'where':{'id':_0x22e860['params']['id']}})[_0x0d85('0x29')](handleEntityNotFound(_0x4a8c80,null))['then'](function(_0x2b6396){if(_0x2b6396){var _0x53f7c1=['Voice',_0x0d85('0x67'),_0x0d85('0x68'),'Sms',_0x0d85('0x69'),'Openchannel',_0x0d85('0x6a')];return BPromise[_0x0d85('0x6b')](_0x53f7c1,function(_0x45fb18){return _0x2b6396[_0x0d85('0x2b')+_0x45fb18+_0x0d85('0x61')]({'attributes':['id',_0x0d85('0x2e')]})[_0x0d85('0x29')](function(_0x24d87){return BPromise[_0x0d85('0x6b')](_0x24d87,function(_0x4d3114){return _0x4d3114[_0x0d85('0x66')](_0x22e860[_0x0d85('0x52')][_0x0d85('0x63')])[_0x0d85('0x29')](function(){if(_0x45fb18===_0x0d85('0x6c')){return db['User']['findAll']({'where':{'id':_0x22e860[_0x0d85('0x52')][_0x0d85('0x63')]},'attributes':['id',_0x0d85('0x2e'),_0x0d85('0x6d'),_0x0d85('0x6e'),'interface'],'raw':!![]})['then'](function(_0x2cef14){return BPromise['each'](_[_0x0d85('0x46')](_0x2cef14,{'online':0x1}),function(_0x31ce52){return db[_0x0d85('0x6f')][_0x0d85('0x70')]({'membername':_0x31ce52[_0x0d85('0x2e')],'UserId':_0x31ce52['id'],'queue_name':_0x4d3114[_0x0d85('0x2e')],'VoiceQueueId':_0x4d3114['id'],'interface':_[_0x0d85('0x71')](_0x31ce52[_0x0d85('0x72')])?util[_0x0d85('0x73')]('SIP/%s',_0x31ce52[_0x0d85('0x2e')]):_0x31ce52[_0x0d85('0x72')],'paused':_0x31ce52[_0x0d85('0x6e')]||![],'penalty':0x0});});});}});});})[_0x0d85('0x29')](function(){return _0x2b6396;});})['then'](function(){return _0x2b6396;});}})[_0x0d85('0x29')](function(_0x18cf2c){if(_0x18cf2c){return _0x18cf2c[_0x0d85('0x66')](_0x22e860[_0x0d85('0x52')][_0x0d85('0x63')],_[_0x0d85('0x74')](_0x22e860[_0x0d85('0x52')],[_0x0d85('0x63'),'id'])||{})[_0x0d85('0x75')](function(_0x3feee9){for(var _0x5670ab=0x0;_0x5670ab<_0x22e860['body'][_0x0d85('0x63')][_0x0d85('0x3c')];_0x5670ab+=0x1){socket[_0x0d85('0x76')]('userTeam:save',{'UserId':_0x22e860['body']['ids'][_0x5670ab],'TeamId':_0x22e860[_0x0d85('0x4d')]['id']});}return _0x3feee9;});}})[_0x0d85('0x29')](respondWithResult(_0x4a8c80,null))['catch'](handleError(_0x4a8c80,null));};exports['removeAgents']=function(_0x13ab73,_0x3b44d3,_0x2e5b2b){return db['Team'][_0x0d85('0x51')]({'where':{'id':_0x13ab73[_0x0d85('0x4d')]['id']}})[_0x0d85('0x29')](handleEntityNotFound(_0x3b44d3,null))[_0x0d85('0x29')](function(_0x3dfe0f){if(_0x3dfe0f){return BPromise[_0x0d85('0x6b')]([_0x0d85('0x77'),'chat','mail','sms','fax',_0x0d85('0x78'),'whatsapp'],function(_0x5ed8e6){return _0x3dfe0f['get'+_['capitalize'](_0x5ed8e6)+_0x0d85('0x61')]({'attributes':['id',_0x0d85('0x2e')]})[_0x0d85('0x29')](function(_0x335e47){return BPromise['each'](_0x335e47,function(_0xfa1d80){return _0xfa1d80['removeAgents'](_0x13ab73[_0x0d85('0x37')][_0x0d85('0x63')])[_0x0d85('0x29')](function(){if(_0x5ed8e6===_0x0d85('0x77')){return db['UserVoiceQueueRt'][_0x0d85('0x2a')]({'where':{'VoiceQueueId':_0xfa1d80['id'],'UserId':_0x13ab73['query']['ids']}});}});});})[_0x0d85('0x29')](function(){return _0x3dfe0f;});})['then'](function(){return _0x3dfe0f;});}})['then'](function(_0xb4a8eb){if(_0xb4a8eb){return _0xb4a8eb[_0x0d85('0x79')](_0x13ab73[_0x0d85('0x37')]['ids'])[_0x0d85('0x29')](function(){if(_[_0x0d85('0x7a')](_0x13ab73[_0x0d85('0x37')][_0x0d85('0x63')])){for(var _0x4d0a06=0x0;_0x4d0a06<_0x13ab73[_0x0d85('0x37')]['ids'][_0x0d85('0x3c')];_0x4d0a06+=0x1){socket[_0x0d85('0x76')]('userTeam:remove',{'UserId':Number(_0x13ab73[_0x0d85('0x37')][_0x0d85('0x63')][_0x4d0a06]),'TeamId':Number(_0x13ab73[_0x0d85('0x4d')]['id'])});}}else{socket[_0x0d85('0x76')](_0x0d85('0x7b'),{'UserId':Number(_0x13ab73[_0x0d85('0x37')][_0x0d85('0x63')]),'TeamId':Number(_0x13ab73['params']['id'])});}});}})[_0x0d85('0x29')](respondWithStatusCode(_0x3b44d3,null))[_0x0d85('0x4b')](handleError(_0x3b44d3,null));};exports[_0x0d85('0x7c')]=function(_0x185db8,_0x5c30b,_0x3298b8){var _0x38396f={};var _0x5d6787={};var _0x4e6cdd;var _0x4c28c3;return db['Team']['findOne']({'where':{'id':_0x185db8[_0x0d85('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5c30b,null))[_0x0d85('0x29')](function(_0xbf3ccc){if(_0xbf3ccc){_0x4e6cdd=_0xbf3ccc;_0x5d6787[_0x0d85('0x36')]=_[_0x0d85('0x38')](db[_0x0d85('0x7d')][_0x0d85('0x4e')]);_0x5d6787[_0x0d85('0x37')]=_[_0x0d85('0x38')](_0x185db8[_0x0d85('0x37')]);_0x5d6787[_0x0d85('0x42')]=_[_0x0d85('0x39')](_0x5d6787[_0x0d85('0x36')],_0x5d6787[_0x0d85('0x37')]);_0x38396f[_0x0d85('0x3a')]=_[_0x0d85('0x39')](_0x5d6787[_0x0d85('0x36')],qs[_0x0d85('0x3b')](_0x185db8[_0x0d85('0x37')][_0x0d85('0x3b')]));_0x38396f[_0x0d85('0x3a')]=_0x38396f[_0x0d85('0x3a')][_0x0d85('0x3c')]?_0x38396f[_0x0d85('0x3a')]:_0x5d6787[_0x0d85('0x36')];_0x38396f[_0x0d85('0x3f')]=qs[_0x0d85('0x40')](_0x185db8[_0x0d85('0x37')][_0x0d85('0x40')]);_0x38396f[_0x0d85('0x41')]=qs[_0x0d85('0x42')](_[_0x0d85('0x43')](_0x185db8['query'],_0x5d6787[_0x0d85('0x42')]));if(_0x185db8['query']['filter']){_0x38396f[_0x0d85('0x41')]=_[_0x0d85('0x44')](_0x38396f[_0x0d85('0x41')],{'$or':_['map'](_0x38396f['attributes'],function(_0x3b0015){var _0x398415={};_0x398415[_0x3b0015]={'$like':'%'+_0x185db8[_0x0d85('0x37')][_0x0d85('0x46')]+'%'};return _0x398415;})});}_0x38396f=_[_0x0d85('0x44')]({},_0x38396f,_0x185db8[_0x0d85('0x50')]);return _0x4e6cdd[_0x0d85('0x7c')](_0x38396f);}})['then'](function(_0x2dc883){if(_0x2dc883){_0x4c28c3=_0x2dc883[_0x0d85('0x3c')];if(!_0x185db8[_0x0d85('0x37')][_0x0d85('0x3d')]('nolimit')){_0x38396f[_0x0d85('0x23')]=qs[_0x0d85('0x23')](_0x185db8[_0x0d85('0x37')][_0x0d85('0x23')]);_0x38396f[_0x0d85('0x22')]=qs[_0x0d85('0x22')](_0x185db8[_0x0d85('0x37')]['offset']);}return _0x4e6cdd[_0x0d85('0x7c')](_0x38396f);}})[_0x0d85('0x29')](function(_0x2e5d0e){if(_0x2e5d0e){return _0x2e5d0e?{'count':_0x4c28c3,'rows':_0x2e5d0e}:null;}})[_0x0d85('0x29')](respondWithResult(_0x5c30b,null))[_0x0d85('0x4b')](handleError(_0x5c30b,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 0fbc5f1..f6a8cb3 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 _0x82d9=['events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x4ba3b9,_0xf364e5){var _0x414858=function(_0x3fe002){while(--_0x3fe002){_0x4ba3b9['push'](_0x4ba3b9['shift']());}};_0x414858(++_0xf364e5);}(_0x82d9,0xf3));var _0x982d=function(_0x4b02f1,_0x52c473){_0x4b02f1=_0x4b02f1-0x0;var _0x1c6d12=_0x82d9[_0x4b02f1];return _0x1c6d12;};'use strict';var EventEmitter=require(_0x982d('0x0'));var Team=require(_0x982d('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x982d('0x2')](0x0);var events={'afterCreate':_0x982d('0x3'),'afterUpdate':_0x982d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x25e7bf){return function(_0x5bf09e,_0x1a3eec,_0x5c9f05){TeamEvents[_0x982d('0x5')](_0x25e7bf+':'+_0x5bf09e['id'],_0x5bf09e);TeamEvents['emit'](_0x25e7bf,_0x5bf09e);_0x5c9f05(null);};}for(var e in events){if(events[_0x982d('0x6')](e)){var event=events[e];Team[_0x982d('0x7')](e,emitEvent(event));}}module[_0x982d('0x8')]=TeamEvents; \ No newline at end of file +var _0xb865=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update','remove'];(function(_0x3c3fc6,_0x4db4b1){var _0x5d4479=function(_0x1ca807){while(--_0x1ca807){_0x3c3fc6['push'](_0x3c3fc6['shift']());}};_0x5d4479(++_0x4db4b1);}(_0xb865,0xa9));var _0x5b86=function(_0x1d0c4d,_0x384ce6){_0x1d0c4d=_0x1d0c4d-0x0;var _0xc8b94c=_0xb865[_0x1d0c4d];return _0xc8b94c;};'use strict';var EventEmitter=require(_0x5b86('0x0'));var Team=require(_0x5b86('0x1'))['db'][_0x5b86('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x5b86('0x3')](0x0);var events={'afterCreate':_0x5b86('0x4'),'afterUpdate':_0x5b86('0x5'),'afterDestroy':_0x5b86('0x6')};function emitEvent(_0x37c2bf){return function(_0x229fec,_0x14e0d4,_0x5bce05){TeamEvents[_0x5b86('0x7')](_0x37c2bf+':'+_0x229fec['id'],_0x229fec);TeamEvents[_0x5b86('0x7')](_0x37c2bf,_0x229fec);_0x5bce05(null);};}for(var e in events){if(events[_0x5b86('0x8')](e)){var event=events[e];Team[_0x5b86('0x9')](e,emitEvent(event));}}module[_0x5b86('0xa')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index a632208..2a3432f 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 _0x20f4=['../../config/environment','./team.attributes','exports','define','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x12c50d,_0x1721d5){var _0x50b19d=function(_0x52c4fe){while(--_0x52c4fe){_0x12c50d['push'](_0x12c50d['shift']());}};_0x50b19d(++_0x1721d5);}(_0x20f4,0xdc));var _0x420f=function(_0x4b3562,_0x38e9ad){_0x4b3562=_0x4b3562-0x0;var _0x1db0a7=_0x20f4[_0x4b3562];return _0x1db0a7;};'use strict';var _=require(_0x420f('0x0'));var util=require(_0x420f('0x1'));var logger=require(_0x420f('0x2'))(_0x420f('0x3'));var moment=require('moment');var BPromise=require(_0x420f('0x4'));var rp=require(_0x420f('0x5'));var fs=require('fs');var path=require(_0x420f('0x6'));var rimraf=require(_0x420f('0x7'));var config=require(_0x420f('0x8'));var attributes=require(_0x420f('0x9'));module[_0x420f('0xa')]=function(_0x48e0c6,_0x356a21){return _0x48e0c6[_0x420f('0xb')]('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd004=['./team.attributes','define','Team','teams','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x28eeda,_0x2462af){var _0x35d44a=function(_0x1dbf75){while(--_0x1dbf75){_0x28eeda['push'](_0x28eeda['shift']());}};_0x35d44a(++_0x2462af);}(_0xd004,0x154));var _0x4d00=function(_0x1ea170,_0x28d157){_0x1ea170=_0x1ea170-0x0;var _0x32487e=_0xd004[_0x1ea170];return _0x32487e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4d00('0x0'))(_0x4d00('0x1'));var moment=require(_0x4d00('0x2'));var BPromise=require(_0x4d00('0x3'));var rp=require(_0x4d00('0x4'));var fs=require('fs');var path=require(_0x4d00('0x5'));var rimraf=require(_0x4d00('0x6'));var config=require(_0x4d00('0x7'));var attributes=require(_0x4d00('0x8'));module['exports']=function(_0x3a2b0c,_0x33485a){return _0x3a2b0c[_0x4d00('0x9')](_0x4d00('0xa'),attributes,{'tableName':_0x4d00('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 936f7bb..cdab39a 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 _0xa67a=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','error','message','Team,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x1a5f38,_0x6f9a2a){var _0x4d0758=function(_0x904725){while(--_0x904725){_0x1a5f38['push'](_0x1a5f38['shift']());}};_0x4d0758(++_0x6f9a2a);}(_0xa67a,0x9a));var _0xaa67=function(_0x3a8796,_0x3cc169){_0x3a8796=_0x3a8796-0x0;var _0x5117e9=_0xa67a[_0x3a8796];return _0x5117e9;};'use strict';var _=require(_0xaa67('0x0'));var util=require(_0xaa67('0x1'));var moment=require(_0xaa67('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa67('0x3'));var fs=require('fs');var Redis=require(_0xaa67('0x4'));var db=require(_0xaa67('0x5'))['db'];var utils=require(_0xaa67('0x6'));var logger=require(_0xaa67('0x7'))('rpc');var config=require(_0xaa67('0x8'));var jayson=require(_0xaa67('0x9'));var client=jayson['client'][_0xaa67('0xa')]({'port':0x232a});config[_0xaa67('0xb')]=_[_0xaa67('0xc')](config[_0xaa67('0xb')],{'host':_0xaa67('0xd'),'port':0x18eb});var socket=require(_0xaa67('0xe'))(new Redis(config['redis']));require('./team.socket')[_0xaa67('0xf')](socket);function respondWithRpcPromise(_0x45bcdd,_0x1806ea,_0x3c86b8){return new BPromise(function(_0x1c3d50,_0x4c24a5){return client[_0xaa67('0x10')](_0x45bcdd,_0x3c86b8)[_0xaa67('0x11')](function(_0x268b1a){logger[_0xaa67('0x12')]('Team,\x20%s,\x20%s',_0x1806ea,_0xaa67('0x13'));logger[_0xaa67('0x14')]('Team,\x20%s,\x20%s,\x20%s',_0x1806ea,_0xaa67('0x13'),JSON['stringify'](_0x268b1a));if(_0x268b1a['error']){if(_0x268b1a[_0xaa67('0x15')]['code']===0x1f4){logger[_0xaa67('0x15')]('Team,\x20%s,\x20%s',_0x1806ea,_0x268b1a[_0xaa67('0x15')]['message']);return _0x4c24a5(_0x268b1a['error'][_0xaa67('0x16')]);}logger[_0xaa67('0x15')]('Team,\x20%s,\x20%s',_0x1806ea,_0x268b1a['error']['message']);return _0x1c3d50(_0x268b1a[_0xaa67('0x15')][_0xaa67('0x16')]);}else{logger['info'](_0xaa67('0x17'),_0x1806ea,_0xaa67('0x13'));_0x1c3d50(_0x268b1a[_0xaa67('0x18')]['message']);}})[_0xaa67('0x19')](function(_0xb12837){logger[_0xaa67('0x15')](_0xaa67('0x17'),_0x1806ea,_0xb12837);_0x4c24a5(_0xb12837);});});} \ No newline at end of file +var _0x8369=['jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x475d19,_0x46b7f2){var _0xb33339=function(_0x35ed9c){while(--_0x35ed9c){_0x475d19['push'](_0x475d19['shift']());}};_0xb33339(++_0x46b7f2);}(_0x8369,0x1c7));var _0x9836=function(_0x3cd19c,_0x4f7dd1){_0x3cd19c=_0x3cd19c-0x0;var _0x2de43e=_0x8369[_0x3cd19c];return _0x2de43e;};'use strict';var _=require(_0x9836('0x0'));var util=require(_0x9836('0x1'));var moment=require(_0x9836('0x2'));var BPromise=require(_0x9836('0x3'));var rs=require(_0x9836('0x4'));var fs=require('fs');var Redis=require(_0x9836('0x5'));var db=require(_0x9836('0x6'))['db'];var utils=require(_0x9836('0x7'));var logger=require(_0x9836('0x8'))('rpc');var config=require(_0x9836('0x9'));var jayson=require(_0x9836('0xa'));var client=jayson[_0x9836('0xb')][_0x9836('0xc')]({'port':0x232a});config['redis']=_[_0x9836('0xd')](config[_0x9836('0xe')],{'host':_0x9836('0xf'),'port':0x18eb});var socket=require(_0x9836('0x10'))(new Redis(config['redis']));require(_0x9836('0x11'))[_0x9836('0x12')](socket);function respondWithRpcPromise(_0x3d0482,_0xf2de38,_0x5c9021){return new BPromise(function(_0x12764f,_0x145a49){return client['request'](_0x3d0482,_0x5c9021)[_0x9836('0x13')](function(_0x1ab247){logger[_0x9836('0x14')](_0x9836('0x15'),_0xf2de38,_0x9836('0x16'));logger[_0x9836('0x17')](_0x9836('0x18'),_0xf2de38,_0x9836('0x16'),JSON[_0x9836('0x19')](_0x1ab247));if(_0x1ab247[_0x9836('0x1a')]){if(_0x1ab247['error'][_0x9836('0x1b')]===0x1f4){logger[_0x9836('0x1a')](_0x9836('0x15'),_0xf2de38,_0x1ab247['error'][_0x9836('0x1c')]);return _0x145a49(_0x1ab247[_0x9836('0x1a')][_0x9836('0x1c')]);}logger[_0x9836('0x1a')]('Team,\x20%s,\x20%s',_0xf2de38,_0x1ab247[_0x9836('0x1a')][_0x9836('0x1c')]);return _0x12764f(_0x1ab247[_0x9836('0x1a')][_0x9836('0x1c')]);}else{logger[_0x9836('0x14')](_0x9836('0x15'),_0xf2de38,'request\x20sent');_0x12764f(_0x1ab247[_0x9836('0x1d')][_0x9836('0x1c')]);}})[_0x9836('0x1e')](function(_0x5d0f58){logger[_0x9836('0x1a')](_0x9836('0x15'),_0xf2de38,_0x5d0f58);_0x145a49(_0x5d0f58);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index f9ca724..6cf23e6 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 _0x6337=['length','team:','save','remove','update','emit','register'];(function(_0x3fe03d,_0x846d0e){var _0x3d36d6=function(_0x2cec2e){while(--_0x2cec2e){_0x3fe03d['push'](_0x3fe03d['shift']());}};_0x3d36d6(++_0x846d0e);}(_0x6337,0x18a));var _0x7633=function(_0xb756a8,_0x276f89){_0xb756a8=_0xb756a8-0x0;var _0x5e5f3a=_0x6337[_0xb756a8];return _0x5e5f3a;};'use strict';var TeamEvents=require('./team.events');var events=[_0x7633('0x0'),_0x7633('0x1'),_0x7633('0x2')];function createListener(_0xcf14c,_0xcd75f9){return function(_0x4194d6){_0xcd75f9[_0x7633('0x3')](_0xcf14c,_0x4194d6);};}function removeListener(_0x3f476d,_0x2ccc60){return function(){TeamEvents['removeListener'](_0x3f476d,_0x2ccc60);};}exports[_0x7633('0x4')]=function(_0x27e596){for(var _0x470054=0x0,_0x539d69=events[_0x7633('0x5')];_0x470054<_0x539d69;_0x470054++){var _0x4b9491=events[_0x470054];var _0x27baac=createListener(_0x7633('0x6')+_0x4b9491,_0x27e596);TeamEvents['on'](_0x4b9491,_0x27baac);}}; \ No newline at end of file +var _0xfa45=['register','length','team:','./team.events','save','remove','update','removeListener'];(function(_0x1f23b1,_0x57c83f){var _0x3c9197=function(_0x2f6e4a){while(--_0x2f6e4a){_0x1f23b1['push'](_0x1f23b1['shift']());}};_0x3c9197(++_0x57c83f);}(_0xfa45,0x11b));var _0x5fa4=function(_0xd15819,_0x114f7b){_0xd15819=_0xd15819-0x0;var _0x14520f=_0xfa45[_0xd15819];return _0x14520f;};'use strict';var TeamEvents=require(_0x5fa4('0x0'));var events=[_0x5fa4('0x1'),_0x5fa4('0x2'),_0x5fa4('0x3')];function createListener(_0x46c739,_0x2d966c){return function(_0x1e88c8){_0x2d966c['emit'](_0x46c739,_0x1e88c8);};}function removeListener(_0x2b3824,_0x4b7365){return function(){TeamEvents[_0x5fa4('0x4')](_0x2b3824,_0x4b7365);};}exports[_0x5fa4('0x5')]=function(_0x1121f8){for(var _0x260b0d=0x0,_0x28a266=events[_0x5fa4('0x6')];_0x260b0d<_0x28a266;_0x260b0d++){var _0x298dce=events[_0x260b0d];var _0x108de1=createListener(_0x5fa4('0x7')+_0x298dce,_0x1121f8);TeamEvents['on'](_0x298dce,_0x108de1);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 428ddb8..c8f5b93 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 _0x2b68=['create','put','update','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','post'];(function(_0x450f09,_0x59561d){var _0x4e22ec=function(_0x516748){while(--_0x516748){_0x450f09['push'](_0x450f09['shift']());}};_0x4e22ec(++_0x59561d);}(_0x2b68,0x9f));var _0x82b6=function(_0x3eb671,_0x4468a7){_0x3eb671=_0x3eb671-0x0;var _0x4f1869=_0x2b68[_0x3eb671];return _0x4f1869;};'use strict';var multer=require(_0x82b6('0x0'));var util=require('util');var path=require(_0x82b6('0x1'));var timeout=require('connect-timeout');var express=require(_0x82b6('0x2'));var router=express['Router']();var auth=require(_0x82b6('0x3'));var interaction=require(_0x82b6('0x4'));var config=require(_0x82b6('0x5'));var controller=require(_0x82b6('0x6'));router[_0x82b6('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x82b6('0x7')]('/:id',auth[_0x82b6('0x8')](),controller['show']);router[_0x82b6('0x9')]('/',auth[_0x82b6('0x8')](),controller[_0x82b6('0xa')]);router[_0x82b6('0xb')]('/:id',auth[_0x82b6('0x8')](),controller[_0x82b6('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7f1d=['destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0x2258fd,_0x11774e){var _0xa596e7=function(_0x426add){while(--_0x426add){_0x2258fd['push'](_0x2258fd['shift']());}};_0xa596e7(++_0x11774e);}(_0x7f1d,0x1b7));var _0xd7f1=function(_0x41af7c,_0x1ffcfa){_0x41af7c=_0x41af7c-0x0;var _0x3ee1a2=_0x7f1d[_0x41af7c];return _0x3ee1a2;};'use strict';var multer=require(_0xd7f1('0x0'));var util=require(_0xd7f1('0x1'));var path=require('path');var timeout=require(_0xd7f1('0x2'));var express=require(_0xd7f1('0x3'));var router=express['Router']();var auth=require(_0xd7f1('0x4'));var interaction=require(_0xd7f1('0x5'));var config=require(_0xd7f1('0x6'));var controller=require(_0xd7f1('0x7'));router[_0xd7f1('0x8')]('/',auth[_0xd7f1('0x9')](),controller['index']);router[_0xd7f1('0x8')](_0xd7f1('0xa'),auth['isAuthenticated'](),controller[_0xd7f1('0xb')]);router[_0xd7f1('0xc')]('/',auth[_0xd7f1('0x9')](),controller[_0xd7f1('0xd')]);router[_0xd7f1('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xd7f1('0xf')]);router[_0xd7f1('0x10')](_0xd7f1('0xa'),auth[_0xd7f1('0x9')](),controller[_0xd7f1('0x11')]);module[_0xd7f1('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 29b3a4c..4d30a64 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 _0x72e1=['STRING','TEXT','sequelize'];(function(_0x2c02e8,_0x252c56){var _0x46dcbe=function(_0x2d6ad0){while(--_0x2d6ad0){_0x2c02e8['push'](_0x2c02e8['shift']());}};_0x46dcbe(++_0x252c56);}(_0x72e1,0x86));var _0x172e=function(_0x891bf3,_0x24af6d){_0x891bf3=_0x891bf3-0x0;var _0x48c795=_0x72e1[_0x891bf3];return _0x48c795;};'use strict';var Sequelize=require(_0x172e('0x0'));module['exports']={'name':{'type':Sequelize[_0x172e('0x1')]},'description':{'type':Sequelize[_0x172e('0x1')]},'html':{'type':Sequelize[_0x172e('0x2')]}}; \ No newline at end of file +var _0xb72f=['TEXT','sequelize','exports','STRING'];(function(_0x9adf1b,_0x3ac695){var _0x960269=function(_0x368ca6){while(--_0x368ca6){_0x9adf1b['push'](_0x9adf1b['shift']());}};_0x960269(++_0x3ac695);}(_0xb72f,0x161));var _0xfb72=function(_0x334599,_0x4b1cfa){_0x334599=_0x334599-0x0;var _0x4cdff2=_0xb72f[_0x334599];return _0x4cdff2;};'use strict';var Sequelize=require(_0xfb72('0x0'));module[_0xfb72('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfb72('0x2')]},'html':{'type':Sequelize[_0xfb72('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index e2ea18b..9be5b58 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 _0x576b=['../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','json','update','destroy','then','get','Templates','UserProfileResource','error','stack','name','index','Template','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','count','includeAll','include','findAll','catch','show','params','keys','filtears','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x5791c4,_0x4c699f){var _0x49cd8f=function(_0x295cde){while(--_0x295cde){_0x5791c4['push'](_0x5791c4['shift']());}};_0x49cd8f(++_0x4c699f);}(_0x576b,0x1d9));var _0xb576=function(_0x243c94,_0x401300){_0x243c94=_0x243c94-0x0;var _0xb68416=_0x576b[_0x243c94];return _0xb68416;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb576('0x0'));var jsonpatch=require(_0xb576('0x1'));var rp=require('request-promise');var moment=require(_0xb576('0x2'));var BPromise=require(_0xb576('0x3'));var Mustache=require('mustache');var util=require(_0xb576('0x4'));var path=require(_0xb576('0x5'));var sox=require(_0xb576('0x6'));var csv=require(_0xb576('0x7'));var ejs=require(_0xb576('0x8'));var fs=require('fs');var _=require(_0xb576('0x9'));var squel=require(_0xb576('0xa'));var crypto=require(_0xb576('0xb'));var jsforce=require(_0xb576('0xc'));var deskjs=require(_0xb576('0xd'));var toCsv=require(_0xb576('0x7'));var querystring=require(_0xb576('0xe'));var Papa=require(_0xb576('0xf'));var Redis=require(_0xb576('0x10'));var authService=require(_0xb576('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb576('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb576('0x13'))(_0xb576('0x14'));var utils=require(_0xb576('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb576('0x16'))['db'];function respondWithStatusCode(_0x420041,_0x8d09e0){_0x8d09e0=_0x8d09e0||0xcc;return function(_0x1c5cf2){if(_0x1c5cf2){return _0x420041[_0xb576('0x17')](_0x8d09e0);}return _0x420041[_0xb576('0x18')](_0x8d09e0)[_0xb576('0x19')]();};}function respondWithResult(_0x1f3a23,_0xb80ee8){_0xb80ee8=_0xb80ee8||0xc8;return function(_0x1791f0){if(_0x1791f0){return _0x1f3a23['status'](_0xb80ee8)['json'](_0x1791f0);}};}function respondWithFilteredResult(_0x5cf596,_0x4173de){return function(_0x44f1b3){if(_0x44f1b3){var _0x18cd64=_0x44f1b3['count'],_0x1be7b0=_0x4173de[_0xb576('0x1a')],_0x463fb2=_0x4173de[_0xb576('0x1a')]+_0x4173de['limit'],_0x29940b;if(_0x463fb2>=_0x18cd64){_0x463fb2=_0x18cd64;_0x29940b=0xc8;}else{_0x29940b=0xce;}_0x5cf596['status'](_0x29940b);return _0x5cf596[_0xb576('0x1b')](_0xb576('0x1c'),_0x1be7b0+'-'+_0x463fb2+'/'+_0x18cd64)[_0xb576('0x1d')](_0x44f1b3);}return null;};}function patchUpdates(_0x4f87bb){return function(_0x4e8677){try{jsonpatch['apply'](_0x4e8677,_0x4f87bb,!![]);}catch(_0x432e41){return BPromise['reject'](_0x432e41);}return _0x4e8677['save']();};}function saveUpdates(_0x2243b1,_0x2bedf0){return function(_0x1da0be){if(_0x1da0be){return _0x1da0be[_0xb576('0x1e')](_0x2243b1)['then'](function(_0x230e91){return _0x230e91;});}return null;};}function removeEntity(_0x38cf07,_0xde0fb1){return function(_0x2295ed){if(_0x2295ed){return _0x2295ed[_0xb576('0x1f')]()[_0xb576('0x20')](function(){var _0x2b6074=_0x2295ed[_0xb576('0x21')]({'plain':!![]});var _0x23d3e7=_0xb576('0x22');return db[_0xb576('0x23')][_0xb576('0x1f')]({'where':{'type':_0x23d3e7,'resourceId':_0x2b6074['id']}})[_0xb576('0x20')](function(){return _0x2295ed;});})[_0xb576('0x20')](function(){_0x38cf07['status'](0xcc)[_0xb576('0x19')]();});}};}function handleEntityNotFound(_0xa0be5e,_0x1e858d){return function(_0x3b8a50){if(!_0x3b8a50){_0xa0be5e[_0xb576('0x17')](0x194);}return _0x3b8a50;};}function handleError(_0x46863c,_0x2ecfc5){_0x2ecfc5=_0x2ecfc5||0x1f4;return function(_0x535bb9){logger[_0xb576('0x24')](_0x535bb9[_0xb576('0x25')]);if(_0x535bb9[_0xb576('0x26')]){delete _0x535bb9[_0xb576('0x26')];}_0x46863c[_0xb576('0x18')](_0x2ecfc5)['send'](_0x535bb9);};}exports[_0xb576('0x27')]=function(_0x5a7b3d,_0xc6cbc){var _0x19f443={},_0x239638={},_0x4561b4={'count':0x0,'rows':[]};var _0x2d9fc4=_['map'](db[_0xb576('0x28')][_0xb576('0x29')],function(_0x2f4e6c){return{'name':_0x2f4e6c[_0xb576('0x2a')],'type':_0x2f4e6c['type'][_0xb576('0x2b')]};});_0x239638[_0xb576('0x2c')]=_[_0xb576('0x2d')](_0x2d9fc4,'name');_0x239638['query']=_['keys'](_0x5a7b3d[_0xb576('0x2e')]);_0x239638[_0xb576('0x2f')]=_[_0xb576('0x30')](_0x239638[_0xb576('0x2c')],_0x239638[_0xb576('0x2e')]);_0x19f443[_0xb576('0x31')]=_[_0xb576('0x30')](_0x239638[_0xb576('0x2c')],qs[_0xb576('0x32')](_0x5a7b3d['query'][_0xb576('0x32')]));_0x19f443['attributes']=_0x19f443['attributes'][_0xb576('0x33')]?_0x19f443[_0xb576('0x31')]:_0x239638[_0xb576('0x2c')];if(!_0x5a7b3d['query'][_0xb576('0x34')](_0xb576('0x35'))){_0x19f443['limit']=qs[_0xb576('0x36')](_0x5a7b3d[_0xb576('0x2e')][_0xb576('0x36')]);_0x19f443[_0xb576('0x1a')]=qs[_0xb576('0x1a')](_0x5a7b3d[_0xb576('0x2e')][_0xb576('0x1a')]);}_0x19f443[_0xb576('0x37')]=qs[_0xb576('0x38')](_0x5a7b3d[_0xb576('0x2e')][_0xb576('0x38')]);_0x19f443['where']=qs['filters'](_[_0xb576('0x39')](_0x5a7b3d['query'],_0x239638[_0xb576('0x2f')]),_0x2d9fc4);if(_0x5a7b3d[_0xb576('0x2e')][_0xb576('0x3a')]){_0x19f443[_0xb576('0x3b')]=_['merge'](_0x19f443[_0xb576('0x3b')],{'$or':_['map'](_0x2d9fc4,function(_0x66dd5d){if(_0x66dd5d[_0xb576('0x3c')]!==_0xb576('0x3d')){var _0x4f851d={};_0x4f851d[_0x66dd5d[_0xb576('0x26')]]={'$like':'%'+_0x5a7b3d['query']['filter']+'%'};return _0x4f851d;}})});}_0x19f443=_[_0xb576('0x3e')]({},_0x19f443,_0x5a7b3d[_0xb576('0x3f')]);var _0x15b439={'where':_0x19f443[_0xb576('0x3b')]};return db[_0xb576('0x28')][_0xb576('0x40')](_0x15b439)['then'](function(_0x372a4c){_0x4561b4[_0xb576('0x40')]=_0x372a4c;if(_0x5a7b3d[_0xb576('0x2e')][_0xb576('0x41')]){_0x19f443[_0xb576('0x42')]=[{'all':!![]}];}return db[_0xb576('0x28')][_0xb576('0x43')](_0x19f443);})[_0xb576('0x20')](function(_0x2d5071){_0x4561b4['rows']=_0x2d5071;return _0x4561b4;})[_0xb576('0x20')](respondWithFilteredResult(_0xc6cbc,_0x19f443))[_0xb576('0x44')](handleError(_0xc6cbc,null));};exports[_0xb576('0x45')]=function(_0x1c6a4c,_0x28a0cb){var _0x1a03b4={'raw':!![],'where':{'id':_0x1c6a4c[_0xb576('0x46')]['id']}},_0x427dc5={};_0x427dc5[_0xb576('0x2c')]=_[_0xb576('0x47')](db[_0xb576('0x28')]['rawAttributes']);_0x427dc5['query']=_[_0xb576('0x47')](_0x1c6a4c[_0xb576('0x2e')]);_0x427dc5[_0xb576('0x48')]=_[_0xb576('0x30')](_0x427dc5[_0xb576('0x2c')],_0x427dc5[_0xb576('0x2e')]);_0x1a03b4[_0xb576('0x31')]=_[_0xb576('0x30')](_0x427dc5[_0xb576('0x2c')],qs['fields'](_0x1c6a4c['query'][_0xb576('0x32')]));_0x1a03b4['attributes']=_0x1a03b4['attributes'][_0xb576('0x33')]?_0x1a03b4[_0xb576('0x31')]:_0x427dc5[_0xb576('0x2c')];if(_0x1c6a4c['query'][_0xb576('0x41')]){_0x1a03b4[_0xb576('0x42')]=[{'all':!![]}];}_0x1a03b4=_[_0xb576('0x3e')]({},_0x1a03b4,_0x1c6a4c['options']);return db['Template'][_0xb576('0x49')](_0x1a03b4)['then'](handleEntityNotFound(_0x28a0cb,null))[_0xb576('0x20')](respondWithResult(_0x28a0cb,null))[_0xb576('0x44')](handleError(_0x28a0cb,null));};exports['create']=function(_0x576a53,_0x1e97e5){return db[_0xb576('0x28')][_0xb576('0x4a')](_0x576a53['body'],{})[_0xb576('0x20')](function(_0x27e80d){var _0x35a707=_0x576a53[_0xb576('0x4b')][_0xb576('0x21')]({'plain':!![]});if(!_0x35a707)throw new Error(_0xb576('0x4c'));if(_0x35a707[_0xb576('0x4d')]===_0xb576('0x4b')){var _0x232729=_0x27e80d[_0xb576('0x21')]({'plain':!![]});var _0xea2fbd=_0xb576('0x22');return db[_0xb576('0x4e')][_0xb576('0x49')]({'where':{'name':_0xea2fbd,'userProfileId':_0x35a707[_0xb576('0x4f')]},'raw':!![]})[_0xb576('0x20')](function(_0x3cccad){if(_0x3cccad&&_0x3cccad[_0xb576('0x50')]===0x0){return db['UserProfileResource'][_0xb576('0x4a')]({'name':_0x232729[_0xb576('0x26')],'resourceId':_0x232729['id'],'type':_0x3cccad[_0xb576('0x26')],'sectionId':_0x3cccad['id']},{})[_0xb576('0x20')](function(){return _0x27e80d;});}else{return _0x27e80d;}})[_0xb576('0x44')](function(_0x3fd02e){logger[_0xb576('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fd02e);throw _0x3fd02e;});}return _0x27e80d;})['then'](respondWithResult(_0x1e97e5,0xc9))['catch'](handleError(_0x1e97e5,null));};exports['update']=function(_0x362452,_0x4e0edc){if(_0x362452[_0xb576('0x51')]['id']){delete _0x362452['body']['id'];}return db[_0xb576('0x28')]['find']({'where':{'id':_0x362452[_0xb576('0x46')]['id']}})[_0xb576('0x20')](handleEntityNotFound(_0x4e0edc,null))[_0xb576('0x20')](saveUpdates(_0x362452[_0xb576('0x51')],null))['then'](respondWithResult(_0x4e0edc,null))['catch'](handleError(_0x4e0edc,null));};exports[_0xb576('0x1f')]=function(_0x5aaf2d,_0x2428d8){return db[_0xb576('0x28')][_0xb576('0x49')]({'where':{'id':_0x5aaf2d['params']['id']}})['then'](handleEntityNotFound(_0x2428d8,null))[_0xb576('0x20')](removeEntity(_0x2428d8,null))[_0xb576('0x44')](handleError(_0x2428d8,null));}; \ No newline at end of file +var _0x8cad=['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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','get','Templates','UserProfileResource','destroy','error','name','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter','options','Template','include','findAll','rows','catch','show','params','filtears','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x341937,_0x40df62){var _0x930bd=function(_0xbe8b91){while(--_0xbe8b91){_0x341937['push'](_0x341937['shift']());}};_0x930bd(++_0x40df62);}(_0x8cad,0xfe));var _0xd8ca=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x8cad[_0x31a371];return _0x2a5bd6;};'use strict';var pdf=require(_0xd8ca('0x0'));var emlformat=require(_0xd8ca('0x1'));var rimraf=require(_0xd8ca('0x2'));var zipdir=require(_0xd8ca('0x3'));var jsonpatch=require(_0xd8ca('0x4'));var rp=require(_0xd8ca('0x5'));var moment=require(_0xd8ca('0x6'));var BPromise=require(_0xd8ca('0x7'));var Mustache=require(_0xd8ca('0x8'));var util=require(_0xd8ca('0x9'));var path=require(_0xd8ca('0xa'));var sox=require(_0xd8ca('0xb'));var csv=require(_0xd8ca('0xc'));var ejs=require(_0xd8ca('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd8ca('0xe'));var crypto=require(_0xd8ca('0xf'));var jsforce=require(_0xd8ca('0x10'));var deskjs=require(_0xd8ca('0x11'));var toCsv=require(_0xd8ca('0xc'));var querystring=require('querystring');var Papa=require(_0xd8ca('0x12'));var Redis=require('ioredis');var authService=require(_0xd8ca('0x13'));var qs=require(_0xd8ca('0x14'));var as=require(_0xd8ca('0x15'));var hardwareService=require(_0xd8ca('0x16'));var logger=require(_0xd8ca('0x17'))(_0xd8ca('0x18'));var utils=require('../../config/utils');var config=require(_0xd8ca('0x19'));var licenseUtil=require(_0xd8ca('0x1a'));var db=require(_0xd8ca('0x1b'))['db'];function respondWithStatusCode(_0x102b16,_0x326272){_0x326272=_0x326272||0xcc;return function(_0x2bb191){if(_0x2bb191){return _0x102b16[_0xd8ca('0x1c')](_0x326272);}return _0x102b16[_0xd8ca('0x1d')](_0x326272)[_0xd8ca('0x1e')]();};}function respondWithResult(_0x52726a,_0x58969b){_0x58969b=_0x58969b||0xc8;return function(_0x12d3f8){if(_0x12d3f8){return _0x52726a[_0xd8ca('0x1d')](_0x58969b)[_0xd8ca('0x1f')](_0x12d3f8);}};}function respondWithFilteredResult(_0x647962,_0x177367){return function(_0x17330a){if(_0x17330a){var _0x3013f2=_0x17330a[_0xd8ca('0x20')],_0x229d85=_0x177367[_0xd8ca('0x21')],_0x738557=_0x177367[_0xd8ca('0x21')]+_0x177367[_0xd8ca('0x22')],_0x5c5c41;if(_0x738557>=_0x3013f2){_0x738557=_0x3013f2;_0x5c5c41=0xc8;}else{_0x5c5c41=0xce;}_0x647962['status'](_0x5c5c41);return _0x647962['set'](_0xd8ca('0x23'),_0x229d85+'-'+_0x738557+'/'+_0x3013f2)['json'](_0x17330a);}return null;};}function patchUpdates(_0x2d43dd){return function(_0x35a3a1){try{jsonpatch[_0xd8ca('0x24')](_0x35a3a1,_0x2d43dd,!![]);}catch(_0x35bb60){return BPromise[_0xd8ca('0x25')](_0x35bb60);}return _0x35a3a1[_0xd8ca('0x26')]();};}function saveUpdates(_0x56ea7e,_0xa18ac1){return function(_0x3a8537){if(_0x3a8537){return _0x3a8537[_0xd8ca('0x27')](_0x56ea7e)[_0xd8ca('0x28')](function(_0x5d9ba3){return _0x5d9ba3;});}return null;};}function removeEntity(_0x23854a,_0x3053f0){return function(_0x1d1367){if(_0x1d1367){return _0x1d1367['destroy']()[_0xd8ca('0x28')](function(){var _0x341807=_0x1d1367[_0xd8ca('0x29')]({'plain':!![]});var _0xbf3254=_0xd8ca('0x2a');return db[_0xd8ca('0x2b')][_0xd8ca('0x2c')]({'where':{'type':_0xbf3254,'resourceId':_0x341807['id']}})['then'](function(){return _0x1d1367;});})[_0xd8ca('0x28')](function(){_0x23854a[_0xd8ca('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bd963,_0x4151cd){return function(_0x32ba25){if(!_0x32ba25){_0x3bd963[_0xd8ca('0x1c')](0x194);}return _0x32ba25;};}function handleError(_0x15a71d,_0x133579){_0x133579=_0x133579||0x1f4;return function(_0x5e8750){logger[_0xd8ca('0x2d')](_0x5e8750['stack']);if(_0x5e8750[_0xd8ca('0x2e')]){delete _0x5e8750[_0xd8ca('0x2e')];}_0x15a71d['status'](_0x133579)['send'](_0x5e8750);};}exports[_0xd8ca('0x2f')]=function(_0x4641af,_0x3b1098){var _0x3bd4c4={},_0xab5ffe={},_0x3d6e33={'count':0x0,'rows':[]};var _0x1eca24=_[_0xd8ca('0x30')](db['Template'][_0xd8ca('0x31')],function(_0x33bfe0){return{'name':_0x33bfe0[_0xd8ca('0x32')],'type':_0x33bfe0['type']['key']};});_0xab5ffe[_0xd8ca('0x33')]=_[_0xd8ca('0x30')](_0x1eca24,_0xd8ca('0x2e'));_0xab5ffe[_0xd8ca('0x34')]=_[_0xd8ca('0x35')](_0x4641af[_0xd8ca('0x34')]);_0xab5ffe[_0xd8ca('0x36')]=_[_0xd8ca('0x37')](_0xab5ffe['model'],_0xab5ffe[_0xd8ca('0x34')]);_0x3bd4c4[_0xd8ca('0x38')]=_[_0xd8ca('0x37')](_0xab5ffe[_0xd8ca('0x33')],qs[_0xd8ca('0x39')](_0x4641af[_0xd8ca('0x34')][_0xd8ca('0x39')]));_0x3bd4c4[_0xd8ca('0x38')]=_0x3bd4c4['attributes'][_0xd8ca('0x3a')]?_0x3bd4c4[_0xd8ca('0x38')]:_0xab5ffe[_0xd8ca('0x33')];if(!_0x4641af['query'][_0xd8ca('0x3b')](_0xd8ca('0x3c'))){_0x3bd4c4[_0xd8ca('0x22')]=qs['limit'](_0x4641af[_0xd8ca('0x34')]['limit']);_0x3bd4c4[_0xd8ca('0x21')]=qs['offset'](_0x4641af[_0xd8ca('0x34')][_0xd8ca('0x21')]);}_0x3bd4c4[_0xd8ca('0x3d')]=qs['sort'](_0x4641af[_0xd8ca('0x34')][_0xd8ca('0x3e')]);_0x3bd4c4['where']=qs[_0xd8ca('0x36')](_[_0xd8ca('0x3f')](_0x4641af['query'],_0xab5ffe[_0xd8ca('0x36')]),_0x1eca24);if(_0x4641af[_0xd8ca('0x34')]['filter']){_0x3bd4c4[_0xd8ca('0x40')]=_[_0xd8ca('0x41')](_0x3bd4c4[_0xd8ca('0x40')],{'$or':_['map'](_0x1eca24,function(_0x4b440f){if(_0x4b440f[_0xd8ca('0x42')]!=='VIRTUAL'){var _0x2151c5={};_0x2151c5[_0x4b440f['name']]={'$like':'%'+_0x4641af[_0xd8ca('0x34')][_0xd8ca('0x43')]+'%'};return _0x2151c5;}})});}_0x3bd4c4=_[_0xd8ca('0x41')]({},_0x3bd4c4,_0x4641af[_0xd8ca('0x44')]);var _0x52b648={'where':_0x3bd4c4[_0xd8ca('0x40')]};return db[_0xd8ca('0x45')][_0xd8ca('0x20')](_0x52b648)['then'](function(_0x5bf439){_0x3d6e33[_0xd8ca('0x20')]=_0x5bf439;if(_0x4641af[_0xd8ca('0x34')]['includeAll']){_0x3bd4c4[_0xd8ca('0x46')]=[{'all':!![]}];}return db[_0xd8ca('0x45')][_0xd8ca('0x47')](_0x3bd4c4);})[_0xd8ca('0x28')](function(_0x3fbb97){_0x3d6e33[_0xd8ca('0x48')]=_0x3fbb97;return _0x3d6e33;})['then'](respondWithFilteredResult(_0x3b1098,_0x3bd4c4))[_0xd8ca('0x49')](handleError(_0x3b1098,null));};exports[_0xd8ca('0x4a')]=function(_0x15d671,_0x2dffca){var _0x2e5e55={'raw':!![],'where':{'id':_0x15d671[_0xd8ca('0x4b')]['id']}},_0x5cea78={};_0x5cea78[_0xd8ca('0x33')]=_['keys'](db[_0xd8ca('0x45')][_0xd8ca('0x31')]);_0x5cea78['query']=_['keys'](_0x15d671[_0xd8ca('0x34')]);_0x5cea78[_0xd8ca('0x4c')]=_[_0xd8ca('0x37')](_0x5cea78[_0xd8ca('0x33')],_0x5cea78[_0xd8ca('0x34')]);_0x2e5e55[_0xd8ca('0x38')]=_[_0xd8ca('0x37')](_0x5cea78[_0xd8ca('0x33')],qs['fields'](_0x15d671[_0xd8ca('0x34')][_0xd8ca('0x39')]));_0x2e5e55[_0xd8ca('0x38')]=_0x2e5e55[_0xd8ca('0x38')][_0xd8ca('0x3a')]?_0x2e5e55[_0xd8ca('0x38')]:_0x5cea78[_0xd8ca('0x33')];if(_0x15d671[_0xd8ca('0x34')]['includeAll']){_0x2e5e55[_0xd8ca('0x46')]=[{'all':!![]}];}_0x2e5e55=_[_0xd8ca('0x41')]({},_0x2e5e55,_0x15d671['options']);return db[_0xd8ca('0x45')][_0xd8ca('0x4d')](_0x2e5e55)[_0xd8ca('0x28')](handleEntityNotFound(_0x2dffca,null))[_0xd8ca('0x28')](respondWithResult(_0x2dffca,null))[_0xd8ca('0x49')](handleError(_0x2dffca,null));};exports[_0xd8ca('0x4e')]=function(_0x441d1f,_0x541189){return db['Template'][_0xd8ca('0x4e')](_0x441d1f[_0xd8ca('0x4f')],{})[_0xd8ca('0x28')](function(_0x513b2e){var _0x346497=_0x441d1f[_0xd8ca('0x50')][_0xd8ca('0x29')]({'plain':!![]});if(!_0x346497)throw new Error(_0xd8ca('0x51'));if(_0x346497[_0xd8ca('0x52')]===_0xd8ca('0x50')){var _0x38949c=_0x513b2e[_0xd8ca('0x29')]({'plain':!![]});var _0x2bf4e8=_0xd8ca('0x2a');return db[_0xd8ca('0x53')]['find']({'where':{'name':_0x2bf4e8,'userProfileId':_0x346497[_0xd8ca('0x54')]},'raw':!![]})[_0xd8ca('0x28')](function(_0x541307){if(_0x541307&&_0x541307[_0xd8ca('0x55')]===0x0){return db[_0xd8ca('0x2b')][_0xd8ca('0x4e')]({'name':_0x38949c[_0xd8ca('0x2e')],'resourceId':_0x38949c['id'],'type':_0x541307[_0xd8ca('0x2e')],'sectionId':_0x541307['id']},{})[_0xd8ca('0x28')](function(){return _0x513b2e;});}else{return _0x513b2e;}})[_0xd8ca('0x49')](function(_0x43d3ef){logger[_0xd8ca('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43d3ef);throw _0x43d3ef;});}return _0x513b2e;})['then'](respondWithResult(_0x541189,0xc9))[_0xd8ca('0x49')](handleError(_0x541189,null));};exports[_0xd8ca('0x27')]=function(_0x52d821,_0x351e7e){if(_0x52d821[_0xd8ca('0x4f')]['id']){delete _0x52d821[_0xd8ca('0x4f')]['id'];}return db[_0xd8ca('0x45')]['find']({'where':{'id':_0x52d821['params']['id']}})['then'](handleEntityNotFound(_0x351e7e,null))[_0xd8ca('0x28')](saveUpdates(_0x52d821[_0xd8ca('0x4f')],null))['then'](respondWithResult(_0x351e7e,null))[_0xd8ca('0x49')](handleError(_0x351e7e,null));};exports[_0xd8ca('0x2c')]=function(_0x421c08,_0x3b4a29){return db[_0xd8ca('0x45')][_0xd8ca('0x4d')]({'where':{'id':_0x421c08[_0xd8ca('0x4b')]['id']}})[_0xd8ca('0x28')](handleEntityNotFound(_0x3b4a29,null))[_0xd8ca('0x28')](removeEntity(_0x3b4a29,null))[_0xd8ca('0x49')](handleError(_0x3b4a29,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 4769951..acc1f0c 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 _0xb658=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','tools_templates','lodash','util','../../config/logger','api'];(function(_0x3ade5a,_0x1994bb){var _0x393999=function(_0x156a60){while(--_0x156a60){_0x3ade5a['push'](_0x3ade5a['shift']());}};_0x393999(++_0x1994bb);}(_0xb658,0x64));var _0x8b65=function(_0x5db7d6,_0x33407c){_0x5db7d6=_0x5db7d6-0x0;var _0x1041ec=_0xb658[_0x5db7d6];return _0x1041ec;};'use strict';var _=require(_0x8b65('0x0'));var util=require(_0x8b65('0x1'));var logger=require(_0x8b65('0x2'))(_0x8b65('0x3'));var moment=require(_0x8b65('0x4'));var BPromise=require(_0x8b65('0x5'));var rp=require(_0x8b65('0x6'));var fs=require('fs');var path=require(_0x8b65('0x7'));var rimraf=require(_0x8b65('0x8'));var config=require(_0x8b65('0x9'));var attributes=require('./template.attributes');module[_0x8b65('0xa')]=function(_0x369dcf,_0x4d1c84){return _0x369dcf[_0x8b65('0xb')]('Template',attributes,{'tableName':_0x8b65('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3172=['../../config/environment','./template.attributes','exports','define','Template','lodash','util','api','moment','bluebird','request-promise'];(function(_0x19d02a,_0xcea776){var _0x1264bc=function(_0x4e6503){while(--_0x4e6503){_0x19d02a['push'](_0x19d02a['shift']());}};_0x1264bc(++_0xcea776);}(_0x3172,0x186));var _0x2317=function(_0x18d5d7,_0x19074b){_0x18d5d7=_0x18d5d7-0x0;var _0x30a9ea=_0x3172[_0x18d5d7];return _0x30a9ea;};'use strict';var _=require(_0x2317('0x0'));var util=require(_0x2317('0x1'));var logger=require('../../config/logger')(_0x2317('0x2'));var moment=require(_0x2317('0x3'));var BPromise=require(_0x2317('0x4'));var rp=require(_0x2317('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2317('0x6'));var attributes=require(_0x2317('0x7'));module[_0x2317('0x8')]=function(_0x24a762,_0x1c2014){return _0x24a762[_0x2317('0x9')](_0x2317('0xa'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 33ef969..41ebf06 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 _0x0000=['http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0xa3bb1e,_0x34dcdb){var _0x54b4e8=function(_0xdf2940){while(--_0xdf2940){_0xa3bb1e['push'](_0xa3bb1e['shift']());}};_0x54b4e8(++_0x34dcdb);}(_0x0000,0xea));var _0x0000=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0000[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0000('0x0'));var util=require(_0x0000('0x1'));var moment=require(_0x0000('0x2'));var BPromise=require(_0x0000('0x3'));var rs=require(_0x0000('0x4'));var fs=require('fs');var Redis=require(_0x0000('0x5'));var db=require(_0x0000('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0000('0x7'))(_0x0000('0x8'));var config=require(_0x0000('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0000('0xa')][_0x0000('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21ed33,_0x400369,_0xa28382){return new BPromise(function(_0x55fda8,_0x1a74b7){return client[_0x0000('0xc')](_0x21ed33,_0xa28382)[_0x0000('0xd')](function(_0xef054e){logger[_0x0000('0xe')](_0x0000('0xf'),_0x400369,_0x0000('0x10'));logger[_0x0000('0x11')](_0x0000('0x12'),_0x400369,_0x0000('0x10'),JSON['stringify'](_0xef054e));if(_0xef054e[_0x0000('0x13')]){if(_0xef054e[_0x0000('0x13')][_0x0000('0x14')]===0x1f4){logger[_0x0000('0x13')](_0x0000('0xf'),_0x400369,_0xef054e[_0x0000('0x13')]['message']);return _0x1a74b7(_0xef054e['error']['message']);}logger[_0x0000('0x13')]('Template,\x20%s,\x20%s',_0x400369,_0xef054e[_0x0000('0x13')][_0x0000('0x15')]);return _0x55fda8(_0xef054e[_0x0000('0x13')][_0x0000('0x15')]);}else{logger[_0x0000('0xe')](_0x0000('0xf'),_0x400369,_0x0000('0x10'));_0x55fda8(_0xef054e['result']['message']);}})[_0x0000('0x16')](function(_0x375447){logger[_0x0000('0x13')](_0x0000('0xf'),_0x400369,_0x375447);_0x1a74b7(_0x375447);});});}exports[_0x0000('0x17')]=function(_0x445088){var _0x3a9c8d=this;return new Promise(function(_0x131d90,_0x3cff47){return db[_0x0000('0x18')][_0x0000('0x19')]({'raw':_0x445088[_0x0000('0x1a')]?_0x445088[_0x0000('0x1a')][_0x0000('0x1b')]===undefined?!![]:![]:!![],'where':_0x445088[_0x0000('0x1a')]?_0x445088[_0x0000('0x1a')][_0x0000('0x1c')]||null:null,'attributes':_0x445088['options']?_0x445088[_0x0000('0x1a')][_0x0000('0x1d')]||null:null,'limit':_0x445088['options']?_0x445088[_0x0000('0x1a')][_0x0000('0x1e')]||null:null,'include':_0x445088['options']?_0x445088['options'][_0x0000('0x1f')]?_[_0x0000('0x20')](_0x445088[_0x0000('0x1a')]['include'],function(_0xbd2e1f){return{'model':db[_0xbd2e1f[_0x0000('0x21')]],'as':_0xbd2e1f['as'],'attributes':_0xbd2e1f[_0x0000('0x1d')],'include':_0xbd2e1f['include']?_[_0x0000('0x20')](_0xbd2e1f[_0x0000('0x1f')],function(_0x44dd3c){return{'model':db[_0x44dd3c['model']],'as':_0x44dd3c['as'],'attributes':_0x44dd3c[_0x0000('0x1d')],'include':_0x44dd3c[_0x0000('0x1f')]?_[_0x0000('0x20')](_0x44dd3c[_0x0000('0x1f')],function(_0x17bf0e){return{'model':db[_0x17bf0e['model']],'as':_0x17bf0e['as'],'attributes':_0x17bf0e[_0x0000('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0000('0xd')](function(_0x2b5182){logger['info'](_0x0000('0x17'),_0x445088);logger['debug'](_0x0000('0x17'),_0x445088,JSON[_0x0000('0x22')](_0x2b5182));_0x131d90(_0x2b5182);})[_0x0000('0x16')](function(_0x48ef60){logger[_0x0000('0x13')](_0x0000('0x17'),_0x48ef60[_0x0000('0x15')],_0x445088);_0x3cff47(_0x3a9c8d[_0x0000('0x13')](0x1f4,_0x48ef60['message']));});});}; \ No newline at end of file +var _0xef84=['client','http','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Template,\x20%s,\x20%s','result','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','model','map','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x410935,_0x2c8960){var _0x2ac9aa=function(_0x2fc327){while(--_0x2fc327){_0x410935['push'](_0x410935['shift']());}};_0x2ac9aa(++_0x2c8960);}(_0xef84,0x116));var _0x4ef8=function(_0x1540d7,_0x5094e0){_0x1540d7=_0x1540d7-0x0;var _0x3f4840=_0xef84[_0x1540d7];return _0x3f4840;};'use strict';var _=require(_0x4ef8('0x0'));var util=require(_0x4ef8('0x1'));var moment=require(_0x4ef8('0x2'));var BPromise=require(_0x4ef8('0x3'));var rs=require(_0x4ef8('0x4'));var fs=require('fs');var Redis=require(_0x4ef8('0x5'));var db=require(_0x4ef8('0x6'))['db'];var utils=require(_0x4ef8('0x7'));var logger=require(_0x4ef8('0x8'))('rpc');var config=require(_0x4ef8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4ef8('0xa')][_0x4ef8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e6171,_0x4d4a46,_0x4632d5){return new BPromise(function(_0x21b984,_0x224081){return client[_0x4ef8('0xc')](_0x2e6171,_0x4632d5)[_0x4ef8('0xd')](function(_0x3f7834){logger[_0x4ef8('0xe')]('Template,\x20%s,\x20%s',_0x4d4a46,_0x4ef8('0xf'));logger[_0x4ef8('0x10')](_0x4ef8('0x11'),_0x4d4a46,_0x4ef8('0xf'),JSON[_0x4ef8('0x12')](_0x3f7834));if(_0x3f7834[_0x4ef8('0x13')]){if(_0x3f7834[_0x4ef8('0x13')][_0x4ef8('0x14')]===0x1f4){logger[_0x4ef8('0x13')]('Template,\x20%s,\x20%s',_0x4d4a46,_0x3f7834[_0x4ef8('0x13')][_0x4ef8('0x15')]);return _0x224081(_0x3f7834[_0x4ef8('0x13')][_0x4ef8('0x15')]);}logger[_0x4ef8('0x13')](_0x4ef8('0x16'),_0x4d4a46,_0x3f7834[_0x4ef8('0x13')][_0x4ef8('0x15')]);return _0x21b984(_0x3f7834[_0x4ef8('0x13')][_0x4ef8('0x15')]);}else{logger[_0x4ef8('0xe')](_0x4ef8('0x16'),_0x4d4a46,'request\x20sent');_0x21b984(_0x3f7834[_0x4ef8('0x17')][_0x4ef8('0x15')]);}})['catch'](function(_0x8a6462){logger[_0x4ef8('0x13')](_0x4ef8('0x16'),_0x4d4a46,_0x8a6462);_0x224081(_0x8a6462);});});}exports[_0x4ef8('0x18')]=function(_0x378c72){var _0x48a7ce=this;return new Promise(function(_0xc7db99,_0x4c23be){return db[_0x4ef8('0x19')][_0x4ef8('0x1a')]({'raw':_0x378c72[_0x4ef8('0x1b')]?_0x378c72[_0x4ef8('0x1b')][_0x4ef8('0x1c')]===undefined?!![]:![]:!![],'where':_0x378c72['options']?_0x378c72[_0x4ef8('0x1b')][_0x4ef8('0x1d')]||null:null,'attributes':_0x378c72[_0x4ef8('0x1b')]?_0x378c72['options'][_0x4ef8('0x1e')]||null:null,'limit':_0x378c72[_0x4ef8('0x1b')]?_0x378c72['options'][_0x4ef8('0x1f')]||null:null,'include':_0x378c72['options']?_0x378c72['options'][_0x4ef8('0x20')]?_['map'](_0x378c72[_0x4ef8('0x1b')][_0x4ef8('0x20')],function(_0xdccd5f){return{'model':db[_0xdccd5f[_0x4ef8('0x21')]],'as':_0xdccd5f['as'],'attributes':_0xdccd5f['attributes'],'include':_0xdccd5f['include']?_[_0x4ef8('0x22')](_0xdccd5f[_0x4ef8('0x20')],function(_0x5d6d9a){return{'model':db[_0x5d6d9a[_0x4ef8('0x21')]],'as':_0x5d6d9a['as'],'attributes':_0x5d6d9a[_0x4ef8('0x1e')],'include':_0x5d6d9a[_0x4ef8('0x20')]?_[_0x4ef8('0x22')](_0x5d6d9a[_0x4ef8('0x20')],function(_0x1f818e){return{'model':db[_0x1f818e['model']],'as':_0x1f818e['as'],'attributes':_0x1f818e[_0x4ef8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4ef8('0xd')](function(_0x5edcfa){logger[_0x4ef8('0xe')](_0x4ef8('0x18'),_0x378c72);logger['debug']('GetTemplate',_0x378c72,JSON[_0x4ef8('0x12')](_0x5edcfa));_0xc7db99(_0x5edcfa);})[_0x4ef8('0x23')](function(_0x2b6421){logger[_0x4ef8('0x13')]('GetTemplate',_0x2b6421[_0x4ef8('0x15')],_0x378c72);_0x4c23be(_0x48a7ce[_0x4ef8('0x13')](0x1f4,_0x2b6421[_0x4ef8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 2b347b0..3186608 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 _0x1d8b=['../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','isAuthenticated','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','put','update','destroy','exports','multer','util','path','express'];(function(_0x4007b1,_0x206901){var _0x108d6c=function(_0x84fcb6){while(--_0x84fcb6){_0x4007b1['push'](_0x4007b1['shift']());}};_0x108d6c(++_0x206901);}(_0x1d8b,0x1ac));var _0xb1d8=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x1d8b[_0x513aa5];return _0x1a1a7c;};'use strict';var multer=require(_0xb1d8('0x0'));var util=require(_0xb1d8('0x1'));var path=require(_0xb1d8('0x2'));var timeout=require('connect-timeout');var express=require(_0xb1d8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xb1d8('0x4'));var config=require(_0xb1d8('0x5'));var controller=require(_0xb1d8('0x6'));router[_0xb1d8('0x7')]('/',auth['isAuthenticated'](),controller[_0xb1d8('0x8')]);router[_0xb1d8('0x7')](_0xb1d8('0x9'),auth[_0xb1d8('0xa')](),controller['show']);router[_0xb1d8('0x7')](_0xb1d8('0xb'),auth[_0xb1d8('0xa')](),controller['getAllConditions']);router[_0xb1d8('0x7')](_0xb1d8('0xc'),auth[_0xb1d8('0xa')](),controller[_0xb1d8('0xd')]);router[_0xb1d8('0x7')](_0xb1d8('0xe'),auth[_0xb1d8('0xa')](),controller[_0xb1d8('0xf')]);router[_0xb1d8('0x10')]('/',auth[_0xb1d8('0xa')](),controller[_0xb1d8('0x11')]);router['post'](_0xb1d8('0xb'),auth[_0xb1d8('0xa')](),controller[_0xb1d8('0x12')]);router[_0xb1d8('0x10')](_0xb1d8('0xc'),auth[_0xb1d8('0xa')](),controller[_0xb1d8('0x13')]);router['post'](_0xb1d8('0xe'),auth[_0xb1d8('0xa')](),controller['addAction']);router[_0xb1d8('0x14')](_0xb1d8('0x9'),auth[_0xb1d8('0xa')](),controller[_0xb1d8('0x15')]);router['delete'](_0xb1d8('0x9'),auth[_0xb1d8('0xa')](),controller[_0xb1d8('0x16')]);module[_0xb1d8('0x17')]=router; \ No newline at end of file +var _0xa12b=['addAnyCondition','addAction','update','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','post'];(function(_0x4bf27a,_0x435cc2){var _0x22a0ba=function(_0x4b442e){while(--_0x4b442e){_0x4bf27a['push'](_0x4bf27a['shift']());}};_0x22a0ba(++_0x435cc2);}(_0xa12b,0x175));var _0xba12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa12b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xba12('0x0'));var util=require(_0xba12('0x1'));var path=require('path');var timeout=require(_0xba12('0x2'));var express=require('express');var router=express[_0xba12('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xba12('0x4'));var config=require('../../config/environment');var controller=require(_0xba12('0x5'));router[_0xba12('0x6')]('/',auth[_0xba12('0x7')](),controller[_0xba12('0x8')]);router[_0xba12('0x6')](_0xba12('0x9'),auth[_0xba12('0x7')](),controller[_0xba12('0xa')]);router['get']('/:id/all_conditions',auth[_0xba12('0x7')](),controller[_0xba12('0xb')]);router[_0xba12('0x6')](_0xba12('0xc'),auth['isAuthenticated'](),controller[_0xba12('0xd')]);router['get'](_0xba12('0xe'),auth[_0xba12('0x7')](),controller[_0xba12('0xf')]);router['post']('/',auth[_0xba12('0x7')](),controller[_0xba12('0x10')]);router[_0xba12('0x11')]('/:id/all_conditions',auth[_0xba12('0x7')](),controller['addAllCondition']);router[_0xba12('0x11')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0xba12('0x12')]);router[_0xba12('0x11')](_0xba12('0xe'),auth['isAuthenticated'](),controller[_0xba12('0x13')]);router['put']('/:id',auth[_0xba12('0x7')](),controller[_0xba12('0x14')]);router['delete'](_0xba12('0x9'),auth['isAuthenticated'](),controller[_0xba12('0x15')]);module[_0xba12('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 09bd502..df9a5de 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 _0xe878=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2e905d,_0x322a3a){var _0x40ab50=function(_0x7cc99){while(--_0x7cc99){_0x2e905d['push'](_0x2e905d['shift']());}};_0x40ab50(++_0x322a3a);}(_0xe878,0x17c));var _0x8e87=function(_0x45a91c,_0x56541f){_0x45a91c=_0x45a91c-0x0;var _0x587932=_0xe878[_0x45a91c];return _0x587932;};'use strict';var Sequelize=require(_0x8e87('0x0'));module[_0x8e87('0x1')]={'name':{'type':Sequelize[_0x8e87('0x2')]},'channel':{'type':Sequelize[_0x8e87('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x8e87('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe325=['BOOLEAN','exports','STRING'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xe325,0x193));var _0x5e32=function(_0x3fd4b3,_0x17d3ef){_0x3fd4b3=_0x3fd4b3-0x0;var _0x2979a3=_0xe325[_0x3fd4b3];return _0x2979a3;};'use strict';var Sequelize=require('sequelize');module[_0x5e32('0x0')]={'name':{'type':Sequelize[_0x5e32('0x1')]},'channel':{'type':Sequelize[_0x5e32('0x1')]},'description':{'type':Sequelize[_0x5e32('0x1')]},'status':{'type':Sequelize[_0x5e32('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 a747967..10030e3 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 _0x3423=['findAll','rows','catch','show','filtears','include','merge','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','nolimit','getAnyConditions','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','api','../../config/utils','../../config/license/util','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','Triggers','UserProfileResource','stack','name','send','index','map','Trigger','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options'];(function(_0x5a878e,_0x2b209c){var _0x2bb45f=function(_0x3e9d30){while(--_0x3e9d30){_0x5a878e['push'](_0x5a878e['shift']());}};_0x2bb45f(++_0x2b209c);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3342('0x0'));var zipdir=require(_0x3342('0x1'));var jsonpatch=require(_0x3342('0x2'));var rp=require(_0x3342('0x3'));var moment=require(_0x3342('0x4'));var BPromise=require(_0x3342('0x5'));var Mustache=require(_0x3342('0x6'));var util=require(_0x3342('0x7'));var path=require(_0x3342('0x8'));var sox=require(_0x3342('0x9'));var csv=require(_0x3342('0xa'));var ejs=require(_0x3342('0xb'));var fs=require('fs');var _=require(_0x3342('0xc'));var squel=require(_0x3342('0xd'));var crypto=require(_0x3342('0xe'));var jsforce=require(_0x3342('0xf'));var deskjs=require(_0x3342('0x10'));var toCsv=require(_0x3342('0xa'));var querystring=require(_0x3342('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3342('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3342('0x13'));var utils=require(_0x3342('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3342('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x716d80,_0x36e1f4){_0x36e1f4=_0x36e1f4||0xcc;return function(_0x592ba8){if(_0x592ba8){return _0x716d80[_0x3342('0x16')](_0x36e1f4);}return _0x716d80[_0x3342('0x17')](_0x36e1f4)[_0x3342('0x18')]();};}function respondWithResult(_0xe4689e,_0x61fcc0){_0x61fcc0=_0x61fcc0||0xc8;return function(_0x104077){if(_0x104077){return _0xe4689e[_0x3342('0x17')](_0x61fcc0)['json'](_0x104077);}};}function respondWithFilteredResult(_0x3e44f3,_0x19bd71){return function(_0x49afe3){if(_0x49afe3){var _0x40d609=_0x49afe3[_0x3342('0x19')],_0x2c9df0=_0x19bd71[_0x3342('0x1a')],_0x51ef91=_0x19bd71[_0x3342('0x1a')]+_0x19bd71[_0x3342('0x1b')],_0x554f9c;if(_0x51ef91>=_0x40d609){_0x51ef91=_0x40d609;_0x554f9c=0xc8;}else{_0x554f9c=0xce;}_0x3e44f3[_0x3342('0x17')](_0x554f9c);return _0x3e44f3[_0x3342('0x1c')](_0x3342('0x1d'),_0x2c9df0+'-'+_0x51ef91+'/'+_0x40d609)[_0x3342('0x1e')](_0x49afe3);}return null;};}function patchUpdates(_0x2c90c8){return function(_0x4f4c2a){try{jsonpatch[_0x3342('0x1f')](_0x4f4c2a,_0x2c90c8,!![]);}catch(_0xda235a){return BPromise[_0x3342('0x20')](_0xda235a);}return _0x4f4c2a['save']();};}function saveUpdates(_0x3cb86f,_0x463324){return function(_0x52f7b7){if(_0x52f7b7){return _0x52f7b7[_0x3342('0x21')](_0x3cb86f)[_0x3342('0x22')](function(_0x4b765d){return _0x4b765d;});}return null;};}function removeEntity(_0x4e1b19,_0x5a0658){return function(_0x3f271c){if(_0x3f271c){return _0x3f271c[_0x3342('0x23')]()[_0x3342('0x22')](function(){var _0x2dbad1=_0x3f271c[_0x3342('0x24')]({'plain':!![]});var _0x2925a2=_0x3342('0x25');return db[_0x3342('0x26')]['destroy']({'where':{'type':_0x2925a2,'resourceId':_0x2dbad1['id']}})[_0x3342('0x22')](function(){return _0x3f271c;});})['then'](function(){_0x4e1b19['status'](0xcc)[_0x3342('0x18')]();});}};}function handleEntityNotFound(_0x52ba65,_0x5d2f0b){return function(_0x247ee4){if(!_0x247ee4){_0x52ba65['sendStatus'](0x194);}return _0x247ee4;};}function handleError(_0x37df78,_0x543ec3){_0x543ec3=_0x543ec3||0x1f4;return function(_0x524286){logger['error'](_0x524286[_0x3342('0x27')]);if(_0x524286[_0x3342('0x28')]){delete _0x524286[_0x3342('0x28')];}_0x37df78['status'](_0x543ec3)[_0x3342('0x29')](_0x524286);};}exports[_0x3342('0x2a')]=function(_0x1cc542,_0x272a52){var _0x4fbfb7={},_0x27e25b={},_0x3d6810={'count':0x0,'rows':[]};var _0x387ba2=_[_0x3342('0x2b')](db[_0x3342('0x2c')][_0x3342('0x2d')],function(_0x135760){return{'name':_0x135760['fieldName'],'type':_0x135760[_0x3342('0x2e')]['key']};});_0x27e25b[_0x3342('0x2f')]=_[_0x3342('0x2b')](_0x387ba2,'name');_0x27e25b[_0x3342('0x30')]=_[_0x3342('0x31')](_0x1cc542[_0x3342('0x30')]);_0x27e25b[_0x3342('0x32')]=_['intersection'](_0x27e25b[_0x3342('0x2f')],_0x27e25b[_0x3342('0x30')]);_0x4fbfb7[_0x3342('0x33')]=_[_0x3342('0x34')](_0x27e25b[_0x3342('0x2f')],qs[_0x3342('0x35')](_0x1cc542[_0x3342('0x30')][_0x3342('0x35')]));_0x4fbfb7[_0x3342('0x33')]=_0x4fbfb7[_0x3342('0x33')][_0x3342('0x36')]?_0x4fbfb7[_0x3342('0x33')]:_0x27e25b['model'];if(!_0x1cc542['query'][_0x3342('0x37')]('nolimit')){_0x4fbfb7[_0x3342('0x1b')]=qs[_0x3342('0x1b')](_0x1cc542[_0x3342('0x30')][_0x3342('0x1b')]);_0x4fbfb7[_0x3342('0x1a')]=qs[_0x3342('0x1a')](_0x1cc542[_0x3342('0x30')]['offset']);}_0x4fbfb7[_0x3342('0x38')]=qs[_0x3342('0x39')](_0x1cc542[_0x3342('0x30')][_0x3342('0x39')]);_0x4fbfb7[_0x3342('0x3a')]=qs['filters'](_[_0x3342('0x3b')](_0x1cc542['query'],_0x27e25b[_0x3342('0x32')]),_0x387ba2);if(_0x1cc542[_0x3342('0x30')][_0x3342('0x3c')]){_0x4fbfb7[_0x3342('0x3a')]=_['merge'](_0x4fbfb7[_0x3342('0x3a')],{'$or':_['map'](_0x387ba2,function(_0x9fcf8d){if(_0x9fcf8d[_0x3342('0x2e')]!==_0x3342('0x3d')){var _0x1b58c5={};_0x1b58c5[_0x9fcf8d[_0x3342('0x28')]]={'$like':'%'+_0x1cc542[_0x3342('0x30')][_0x3342('0x3c')]+'%'};return _0x1b58c5;}})});}_0x4fbfb7=_['merge']({},_0x4fbfb7,_0x1cc542[_0x3342('0x3e')]);var _0x355e83={'where':_0x4fbfb7['where']};return db[_0x3342('0x2c')][_0x3342('0x19')](_0x355e83)['then'](function(_0x45b956){_0x3d6810[_0x3342('0x19')]=_0x45b956;if(_0x1cc542['query']['includeAll']){_0x4fbfb7['include']=[{'all':!![]}];}return db[_0x3342('0x2c')][_0x3342('0x3f')](_0x4fbfb7);})['then'](function(_0x40af89){_0x3d6810[_0x3342('0x40')]=_0x40af89;return _0x3d6810;})[_0x3342('0x22')](respondWithFilteredResult(_0x272a52,_0x4fbfb7))[_0x3342('0x41')](handleError(_0x272a52,null));};exports[_0x3342('0x42')]=function(_0x308363,_0x34de7b){var _0x4282ea={'raw':![],'where':{'id':_0x308363['params']['id']}},_0x5f0ed3={};_0x5f0ed3[_0x3342('0x2f')]=_[_0x3342('0x31')](db[_0x3342('0x2c')][_0x3342('0x2d')]);_0x5f0ed3[_0x3342('0x30')]=_[_0x3342('0x31')](_0x308363['query']);_0x5f0ed3[_0x3342('0x43')]=_[_0x3342('0x34')](_0x5f0ed3[_0x3342('0x2f')],_0x5f0ed3[_0x3342('0x30')]);_0x4282ea[_0x3342('0x33')]=_[_0x3342('0x34')](_0x5f0ed3['model'],qs[_0x3342('0x35')](_0x308363['query'][_0x3342('0x35')]));_0x4282ea[_0x3342('0x33')]=_0x4282ea[_0x3342('0x33')][_0x3342('0x36')]?_0x4282ea['attributes']:_0x5f0ed3[_0x3342('0x2f')];if(_0x308363[_0x3342('0x30')]['includeAll']){_0x4282ea[_0x3342('0x44')]=[{'all':!![]}];}_0x4282ea=_[_0x3342('0x45')]({},_0x4282ea,_0x308363[_0x3342('0x3e')]);return db[_0x3342('0x2c')]['find'](_0x4282ea)[_0x3342('0x22')](handleEntityNotFound(_0x34de7b,null))[_0x3342('0x22')](respondWithResult(_0x34de7b,null))['catch'](handleError(_0x34de7b,null));};exports[_0x3342('0x46')]=function(_0x483ba7,_0x5683e0){return db[_0x3342('0x2c')][_0x3342('0x46')](_0x483ba7[_0x3342('0x47')],{})[_0x3342('0x22')](function(_0x23925e){var _0x171387=_0x483ba7[_0x3342('0x48')]['get']({'plain':!![]});if(!_0x171387)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x171387[_0x3342('0x49')]==='user'){var _0x26251c=_0x23925e['get']({'plain':!![]});var _0x4c9214='Triggers';return db[_0x3342('0x4a')][_0x3342('0x4b')]({'where':{'name':_0x4c9214,'userProfileId':_0x171387[_0x3342('0x4c')]},'raw':!![]})[_0x3342('0x22')](function(_0x5176d7){if(_0x5176d7&&_0x5176d7[_0x3342('0x4d')]===0x0){return db[_0x3342('0x26')]['create']({'name':_0x26251c[_0x3342('0x28')],'resourceId':_0x26251c['id'],'type':_0x5176d7[_0x3342('0x28')],'sectionId':_0x5176d7['id']},{})[_0x3342('0x22')](function(){return _0x23925e;});}else{return _0x23925e;}})['catch'](function(_0x189b68){logger[_0x3342('0x4e')](_0x3342('0x4f'),_0x189b68);throw _0x189b68;});}return _0x23925e;})[_0x3342('0x22')](respondWithResult(_0x5683e0,0xc9))[_0x3342('0x41')](handleError(_0x5683e0,null));};exports['update']=function(_0x2699d2,_0x1d5001){if(_0x2699d2[_0x3342('0x47')]['id']){delete _0x2699d2[_0x3342('0x47')]['id'];}return db[_0x3342('0x2c')][_0x3342('0x4b')]({'where':{'id':_0x2699d2[_0x3342('0x50')]['id']}})[_0x3342('0x22')](handleEntityNotFound(_0x1d5001,null))[_0x3342('0x22')](saveUpdates(_0x2699d2['body'],null))[_0x3342('0x22')](respondWithResult(_0x1d5001,null))['catch'](handleError(_0x1d5001,null));};exports[_0x3342('0x23')]=function(_0x524fb6,_0x49e3c6){return db['Trigger']['find']({'where':{'id':_0x524fb6[_0x3342('0x50')]['id']}})[_0x3342('0x22')](handleEntityNotFound(_0x49e3c6,null))[_0x3342('0x22')](removeEntity(_0x49e3c6,null))[_0x3342('0x41')](handleError(_0x49e3c6,null));};exports[_0x3342('0x51')]=function(_0x163d76,_0x3f653c,_0x421ed4){if(_0x163d76[_0x3342('0x47')]['id']){delete _0x163d76[_0x3342('0x47')]['id'];}return db[_0x3342('0x2c')]['find']({'where':{'id':_0x163d76['params']['id']}})[_0x3342('0x22')](handleEntityNotFound(_0x3f653c,null))['then'](function(_0x1e01b0){if(_0x1e01b0){_0x163d76['body']['TriggerAllId']=_0x1e01b0['id'];return db[_0x3342('0x52')][_0x3342('0x46')](_0x163d76[_0x3342('0x47')]);}})['then'](respondWithResult(_0x3f653c,null))['catch'](handleError(_0x3f653c,null));};exports[_0x3342('0x53')]=function(_0x3cc92a,_0x5e9161,_0x2da4b7){if(_0x3cc92a[_0x3342('0x47')]['id']){delete _0x3cc92a[_0x3342('0x47')]['id'];}return db['Trigger'][_0x3342('0x4b')]({'where':{'id':_0x3cc92a[_0x3342('0x50')]['id']}})[_0x3342('0x22')](handleEntityNotFound(_0x5e9161,null))[_0x3342('0x22')](function(_0x18ed0c){if(_0x18ed0c){_0x3cc92a[_0x3342('0x47')][_0x3342('0x54')]=_0x18ed0c['id'];return db['Condition']['create'](_0x3cc92a[_0x3342('0x47')]);}})['then'](respondWithResult(_0x5e9161,null))[_0x3342('0x41')](handleError(_0x5e9161,null));};exports[_0x3342('0x55')]=function(_0xd6fff5,_0x28b252,_0xe9b979){var _0x5d8a9d={};var _0x154f1d={};var _0x3f2fcb;var _0x4c1c6a;return db[_0x3342('0x2c')][_0x3342('0x56')]({'where':{'id':_0xd6fff5[_0x3342('0x50')]['id']}})[_0x3342('0x22')](handleEntityNotFound(_0x28b252,null))[_0x3342('0x22')](function(_0x3a82c8){if(_0x3a82c8){_0x3f2fcb=_0x3a82c8;_0x154f1d[_0x3342('0x2f')]=_[_0x3342('0x31')](db[_0x3342('0x52')][_0x3342('0x2d')]);_0x154f1d[_0x3342('0x30')]=_[_0x3342('0x31')](_0xd6fff5[_0x3342('0x30')]);_0x154f1d['filters']=_['intersection'](_0x154f1d[_0x3342('0x2f')],_0x154f1d[_0x3342('0x30')]);_0x5d8a9d[_0x3342('0x33')]=_[_0x3342('0x34')](_0x154f1d['model'],qs['fields'](_0xd6fff5[_0x3342('0x30')][_0x3342('0x35')]));_0x5d8a9d[_0x3342('0x33')]=_0x5d8a9d[_0x3342('0x33')][_0x3342('0x36')]?_0x5d8a9d[_0x3342('0x33')]:_0x154f1d[_0x3342('0x2f')];_0x5d8a9d[_0x3342('0x38')]=qs[_0x3342('0x39')](_0xd6fff5[_0x3342('0x30')]['sort']);_0x5d8a9d[_0x3342('0x3a')]=qs['filters'](_[_0x3342('0x3b')](_0xd6fff5[_0x3342('0x30')],_0x154f1d['filters']));if(_0xd6fff5[_0x3342('0x30')][_0x3342('0x3c')]){_0x5d8a9d['where']=_[_0x3342('0x45')](_0x5d8a9d[_0x3342('0x3a')],{'$or':_[_0x3342('0x2b')](_0x5d8a9d[_0x3342('0x33')],function(_0x6b9502){var _0x42bc3b={};_0x42bc3b[_0x6b9502]={'$like':'%'+_0xd6fff5[_0x3342('0x30')]['filter']+'%'};return _0x42bc3b;})});}_0x5d8a9d=_[_0x3342('0x45')]({},_0x5d8a9d,_0xd6fff5['options']);return _0x3f2fcb['getAllConditions'](_0x5d8a9d);}})[_0x3342('0x22')](function(_0x28624b){if(_0x28624b){_0x4c1c6a=_0x28624b[_0x3342('0x36')];if(!_0xd6fff5[_0x3342('0x30')][_0x3342('0x37')](_0x3342('0x57'))){_0x5d8a9d[_0x3342('0x1b')]=qs[_0x3342('0x1b')](_0xd6fff5['query'][_0x3342('0x1b')]);_0x5d8a9d[_0x3342('0x1a')]=qs[_0x3342('0x1a')](_0xd6fff5[_0x3342('0x30')][_0x3342('0x1a')]);}return _0x3f2fcb[_0x3342('0x55')](_0x5d8a9d);}})[_0x3342('0x22')](function(_0x58926c){if(_0x58926c){return _0x58926c?{'count':_0x4c1c6a,'rows':_0x58926c}:null;}})[_0x3342('0x22')](respondWithResult(_0x28b252,null))[_0x3342('0x41')](handleError(_0x28b252,null));};exports[_0x3342('0x58')]=function(_0x20203b,_0x38a83f,_0x30e493){var _0x5a9027={};var _0x59ac64={};var _0x585b5e;var _0x26ed77;return db[_0x3342('0x2c')][_0x3342('0x56')]({'where':{'id':_0x20203b[_0x3342('0x50')]['id']}})[_0x3342('0x22')](handleEntityNotFound(_0x38a83f,null))[_0x3342('0x22')](function(_0xdd0f62){if(_0xdd0f62){_0x585b5e=_0xdd0f62;_0x59ac64[_0x3342('0x2f')]=_['keys'](db[_0x3342('0x52')][_0x3342('0x2d')]);_0x59ac64[_0x3342('0x30')]=_[_0x3342('0x31')](_0x20203b['query']);_0x59ac64[_0x3342('0x32')]=_[_0x3342('0x34')](_0x59ac64[_0x3342('0x2f')],_0x59ac64[_0x3342('0x30')]);_0x5a9027[_0x3342('0x33')]=_[_0x3342('0x34')](_0x59ac64[_0x3342('0x2f')],qs[_0x3342('0x35')](_0x20203b[_0x3342('0x30')]['fields']));_0x5a9027[_0x3342('0x33')]=_0x5a9027[_0x3342('0x33')]['length']?_0x5a9027[_0x3342('0x33')]:_0x59ac64['model'];_0x5a9027[_0x3342('0x38')]=qs['sort'](_0x20203b[_0x3342('0x30')]['sort']);_0x5a9027[_0x3342('0x3a')]=qs[_0x3342('0x32')](_['pick'](_0x20203b[_0x3342('0x30')],_0x59ac64[_0x3342('0x32')]));if(_0x20203b['query'][_0x3342('0x3c')]){_0x5a9027[_0x3342('0x3a')]=_[_0x3342('0x45')](_0x5a9027[_0x3342('0x3a')],{'$or':_[_0x3342('0x2b')](_0x5a9027[_0x3342('0x33')],function(_0x5cb6c5){var _0x29a7a1={};_0x29a7a1[_0x5cb6c5]={'$like':'%'+_0x20203b[_0x3342('0x30')][_0x3342('0x3c')]+'%'};return _0x29a7a1;})});}_0x5a9027=_[_0x3342('0x45')]({},_0x5a9027,_0x20203b[_0x3342('0x3e')]);return _0x585b5e[_0x3342('0x58')](_0x5a9027);}})[_0x3342('0x22')](function(_0x2c4bec){if(_0x2c4bec){_0x26ed77=_0x2c4bec[_0x3342('0x36')];if(!_0x20203b[_0x3342('0x30')]['hasOwnProperty'](_0x3342('0x57'))){_0x5a9027[_0x3342('0x1b')]=qs[_0x3342('0x1b')](_0x20203b['query']['limit']);_0x5a9027[_0x3342('0x1a')]=qs['offset'](_0x20203b['query'][_0x3342('0x1a')]);}return _0x585b5e[_0x3342('0x58')](_0x5a9027);}})['then'](function(_0x46297e){if(_0x46297e){return _0x46297e?{'count':_0x26ed77,'rows':_0x46297e}:null;}})['then'](respondWithResult(_0x38a83f,null))[_0x3342('0x41')](handleError(_0x38a83f,null));};exports['addAction']=function(_0x5e5642,_0x2cb12a,_0x2d3f3e){if(_0x5e5642[_0x3342('0x47')]['id']){delete _0x5e5642['body']['id'];}return db['Trigger'][_0x3342('0x4b')]({'where':{'id':_0x5e5642['params']['id']}})[_0x3342('0x22')](handleEntityNotFound(_0x2cb12a,null))[_0x3342('0x22')](function(_0x328335){if(_0x328335){_0x5e5642[_0x3342('0x47')]['TriggerId']=_0x328335['id'];return db['Action'][_0x3342('0x46')](_0x5e5642[_0x3342('0x47')]);}})['then'](respondWithResult(_0x2cb12a,null))[_0x3342('0x41')](handleError(_0x2cb12a,null));};exports['getActions']=function(_0xe0d6b7,_0x21a2bc,_0x45899e){var _0x2c3cfe={};var _0x22b415={};var _0x5e368f;var _0x502050;return db['Trigger'][_0x3342('0x56')]({'where':{'id':_0xe0d6b7[_0x3342('0x50')]['id']}})[_0x3342('0x22')](handleEntityNotFound(_0x21a2bc,null))['then'](function(_0x3393d9){if(_0x3393d9){_0x5e368f=_0x3393d9;_0x22b415[_0x3342('0x2f')]=_[_0x3342('0x31')](db[_0x3342('0x59')][_0x3342('0x2d')]);_0x22b415[_0x3342('0x30')]=_['keys'](_0xe0d6b7[_0x3342('0x30')]);_0x22b415['filters']=_['intersection'](_0x22b415['model'],_0x22b415[_0x3342('0x30')]);_0x2c3cfe[_0x3342('0x33')]=_['intersection'](_0x22b415[_0x3342('0x2f')],qs[_0x3342('0x35')](_0xe0d6b7['query'][_0x3342('0x35')]));_0x2c3cfe[_0x3342('0x33')]=_0x2c3cfe[_0x3342('0x33')][_0x3342('0x36')]?_0x2c3cfe[_0x3342('0x33')]:_0x22b415[_0x3342('0x2f')];_0x2c3cfe[_0x3342('0x38')]=qs[_0x3342('0x39')](_0xe0d6b7['query'][_0x3342('0x39')]);_0x2c3cfe[_0x3342('0x3a')]=qs[_0x3342('0x32')](_[_0x3342('0x3b')](_0xe0d6b7[_0x3342('0x30')],_0x22b415[_0x3342('0x32')]));if(_0xe0d6b7[_0x3342('0x30')]['filter']){_0x2c3cfe['where']=_[_0x3342('0x45')](_0x2c3cfe[_0x3342('0x3a')],{'$or':_[_0x3342('0x2b')](_0x2c3cfe[_0x3342('0x33')],function(_0x15c44b){var _0x1e6bfa={};_0x1e6bfa[_0x15c44b]={'$like':'%'+_0xe0d6b7[_0x3342('0x30')]['filter']+'%'};return _0x1e6bfa;})});}_0x2c3cfe=_[_0x3342('0x45')]({},_0x2c3cfe,_0xe0d6b7[_0x3342('0x3e')]);return _0x5e368f[_0x3342('0x5a')](_0x2c3cfe);}})[_0x3342('0x22')](function(_0x439a6b){if(_0x439a6b){_0x502050=_0x439a6b['length'];if(!_0xe0d6b7[_0x3342('0x30')][_0x3342('0x37')](_0x3342('0x57'))){_0x2c3cfe[_0x3342('0x1b')]=qs['limit'](_0xe0d6b7[_0x3342('0x30')][_0x3342('0x1b')]);_0x2c3cfe[_0x3342('0x1a')]=qs[_0x3342('0x1a')](_0xe0d6b7[_0x3342('0x30')][_0x3342('0x1a')]);}return _0x5e368f[_0x3342('0x5a')](_0x2c3cfe);}})['then'](function(_0x53a9e1){if(_0x53a9e1){return _0x53a9e1?{'count':_0x502050,'rows':_0x53a9e1}:null;}})[_0x3342('0x22')](respondWithResult(_0x21a2bc,null))['catch'](handleError(_0x21a2bc,null));}; \ No newline at end of file +var _0x4fc2=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','Triggers','UserProfileResource','then','error','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','map','VIRTUAL','Trigger','include','findAll','rows','catch','show','keys','filtears','includeAll','options','create','user','role','get','UserProfileSection','find','userProfileId','autoAssociation','body','params','TriggerAllId','TriggerAnyId','Condition','getAllConditions','findOne','order','getAnyConditions','nolimit','addAction','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x12a8bc,_0xabe938){var _0x3515ac=function(_0x10c702){while(--_0x10c702){_0x12a8bc['push'](_0x12a8bc['shift']());}};_0x3515ac(++_0xabe938);}(_0x4fc2,0x111));var _0x24fc=function(_0x168777,_0x3fb028){_0x168777=_0x168777-0x0;var _0x48b8cd=_0x4fc2[_0x168777];return _0x48b8cd;};'use strict';var pdf=require(_0x24fc('0x0'));var emlformat=require(_0x24fc('0x1'));var rimraf=require(_0x24fc('0x2'));var zipdir=require(_0x24fc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24fc('0x4'));var moment=require(_0x24fc('0x5'));var BPromise=require(_0x24fc('0x6'));var Mustache=require('mustache');var util=require(_0x24fc('0x7'));var path=require(_0x24fc('0x8'));var sox=require('sox');var csv=require(_0x24fc('0x9'));var ejs=require(_0x24fc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x24fc('0xb'));var crypto=require(_0x24fc('0xc'));var jsforce=require(_0x24fc('0xd'));var deskjs=require(_0x24fc('0xe'));var toCsv=require(_0x24fc('0x9'));var querystring=require(_0x24fc('0xf'));var Papa=require('papaparse');var Redis=require(_0x24fc('0x10'));var authService=require(_0x24fc('0x11'));var qs=require(_0x24fc('0x12'));var as=require(_0x24fc('0x13'));var hardwareService=require(_0x24fc('0x14'));var logger=require(_0x24fc('0x15'))(_0x24fc('0x16'));var utils=require(_0x24fc('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x24fc('0x18'));var db=require(_0x24fc('0x19'))['db'];function respondWithStatusCode(_0x5cc65e,_0x306873){_0x306873=_0x306873||0xcc;return function(_0x76cb25){if(_0x76cb25){return _0x5cc65e[_0x24fc('0x1a')](_0x306873);}return _0x5cc65e[_0x24fc('0x1b')](_0x306873)[_0x24fc('0x1c')]();};}function respondWithResult(_0x326276,_0x537b5c){_0x537b5c=_0x537b5c||0xc8;return function(_0x2a0971){if(_0x2a0971){return _0x326276[_0x24fc('0x1b')](_0x537b5c)[_0x24fc('0x1d')](_0x2a0971);}};}function respondWithFilteredResult(_0x42cbe8,_0x4acd36){return function(_0x2ac989){if(_0x2ac989){var _0x588543=_0x2ac989[_0x24fc('0x1e')],_0x4af098=_0x4acd36[_0x24fc('0x1f')],_0x3385c7=_0x4acd36['offset']+_0x4acd36[_0x24fc('0x20')],_0x218fb6;if(_0x3385c7>=_0x588543){_0x3385c7=_0x588543;_0x218fb6=0xc8;}else{_0x218fb6=0xce;}_0x42cbe8[_0x24fc('0x1b')](_0x218fb6);return _0x42cbe8[_0x24fc('0x21')](_0x24fc('0x22'),_0x4af098+'-'+_0x3385c7+'/'+_0x588543)['json'](_0x2ac989);}return null;};}function patchUpdates(_0x5eabee){return function(_0x4073e0){try{jsonpatch[_0x24fc('0x23')](_0x4073e0,_0x5eabee,!![]);}catch(_0x5b0516){return BPromise[_0x24fc('0x24')](_0x5b0516);}return _0x4073e0[_0x24fc('0x25')]();};}function saveUpdates(_0xbf1d6b,_0x2d0e3d){return function(_0x49a0ba){if(_0x49a0ba){return _0x49a0ba[_0x24fc('0x26')](_0xbf1d6b)['then'](function(_0x339b50){return _0x339b50;});}return null;};}function removeEntity(_0x591c8f,_0x3ed464){return function(_0x44c121){if(_0x44c121){return _0x44c121[_0x24fc('0x27')]()['then'](function(){var _0x313a25=_0x44c121['get']({'plain':!![]});var _0x35a9c7=_0x24fc('0x28');return db[_0x24fc('0x29')][_0x24fc('0x27')]({'where':{'type':_0x35a9c7,'resourceId':_0x313a25['id']}})[_0x24fc('0x2a')](function(){return _0x44c121;});})[_0x24fc('0x2a')](function(){_0x591c8f[_0x24fc('0x1b')](0xcc)[_0x24fc('0x1c')]();});}};}function handleEntityNotFound(_0x168d98,_0x2a5c4b){return function(_0x568441){if(!_0x568441){_0x168d98[_0x24fc('0x1a')](0x194);}return _0x568441;};}function handleError(_0x16f27f,_0x3ee302){_0x3ee302=_0x3ee302||0x1f4;return function(_0x5bb4c8){logger[_0x24fc('0x2b')](_0x5bb4c8[_0x24fc('0x2c')]);if(_0x5bb4c8[_0x24fc('0x2d')]){delete _0x5bb4c8[_0x24fc('0x2d')];}_0x16f27f[_0x24fc('0x1b')](_0x3ee302)[_0x24fc('0x2e')](_0x5bb4c8);};}exports['index']=function(_0x240ae7,_0x29a461){var _0x3c99ed={},_0x1c5146={},_0x9f7bbc={'count':0x0,'rows':[]};var _0x490aa5=_['map'](db['Trigger'][_0x24fc('0x2f')],function(_0x574ba3){return{'name':_0x574ba3[_0x24fc('0x30')],'type':_0x574ba3[_0x24fc('0x31')][_0x24fc('0x32')]};});_0x1c5146[_0x24fc('0x33')]=_['map'](_0x490aa5,_0x24fc('0x2d'));_0x1c5146[_0x24fc('0x34')]=_['keys'](_0x240ae7[_0x24fc('0x34')]);_0x1c5146[_0x24fc('0x35')]=_['intersection'](_0x1c5146['model'],_0x1c5146[_0x24fc('0x34')]);_0x3c99ed['attributes']=_[_0x24fc('0x36')](_0x1c5146[_0x24fc('0x33')],qs['fields'](_0x240ae7[_0x24fc('0x34')][_0x24fc('0x37')]));_0x3c99ed[_0x24fc('0x38')]=_0x3c99ed[_0x24fc('0x38')][_0x24fc('0x39')]?_0x3c99ed[_0x24fc('0x38')]:_0x1c5146[_0x24fc('0x33')];if(!_0x240ae7[_0x24fc('0x34')][_0x24fc('0x3a')]('nolimit')){_0x3c99ed[_0x24fc('0x20')]=qs[_0x24fc('0x20')](_0x240ae7[_0x24fc('0x34')][_0x24fc('0x20')]);_0x3c99ed[_0x24fc('0x1f')]=qs['offset'](_0x240ae7['query'][_0x24fc('0x1f')]);}_0x3c99ed['order']=qs[_0x24fc('0x3b')](_0x240ae7[_0x24fc('0x34')][_0x24fc('0x3b')]);_0x3c99ed[_0x24fc('0x3c')]=qs['filters'](_[_0x24fc('0x3d')](_0x240ae7['query'],_0x1c5146[_0x24fc('0x35')]),_0x490aa5);if(_0x240ae7[_0x24fc('0x34')][_0x24fc('0x3e')]){_0x3c99ed[_0x24fc('0x3c')]=_[_0x24fc('0x3f')](_0x3c99ed['where'],{'$or':_[_0x24fc('0x40')](_0x490aa5,function(_0x3f40cd){if(_0x3f40cd[_0x24fc('0x31')]!==_0x24fc('0x41')){var _0x5ceae2={};_0x5ceae2[_0x3f40cd[_0x24fc('0x2d')]]={'$like':'%'+_0x240ae7[_0x24fc('0x34')]['filter']+'%'};return _0x5ceae2;}})});}_0x3c99ed=_[_0x24fc('0x3f')]({},_0x3c99ed,_0x240ae7['options']);var _0x320f7b={'where':_0x3c99ed[_0x24fc('0x3c')]};return db[_0x24fc('0x42')][_0x24fc('0x1e')](_0x320f7b)[_0x24fc('0x2a')](function(_0x278b18){_0x9f7bbc[_0x24fc('0x1e')]=_0x278b18;if(_0x240ae7[_0x24fc('0x34')]['includeAll']){_0x3c99ed[_0x24fc('0x43')]=[{'all':!![]}];}return db[_0x24fc('0x42')][_0x24fc('0x44')](_0x3c99ed);})['then'](function(_0x14a8b4){_0x9f7bbc[_0x24fc('0x45')]=_0x14a8b4;return _0x9f7bbc;})['then'](respondWithFilteredResult(_0x29a461,_0x3c99ed))[_0x24fc('0x46')](handleError(_0x29a461,null));};exports[_0x24fc('0x47')]=function(_0x2c598c,_0x5e4e9b){var _0x31ddd0={'raw':![],'where':{'id':_0x2c598c['params']['id']}},_0x3af80a={};_0x3af80a[_0x24fc('0x33')]=_[_0x24fc('0x48')](db[_0x24fc('0x42')][_0x24fc('0x2f')]);_0x3af80a['query']=_[_0x24fc('0x48')](_0x2c598c[_0x24fc('0x34')]);_0x3af80a[_0x24fc('0x49')]=_[_0x24fc('0x36')](_0x3af80a[_0x24fc('0x33')],_0x3af80a['query']);_0x31ddd0[_0x24fc('0x38')]=_[_0x24fc('0x36')](_0x3af80a[_0x24fc('0x33')],qs[_0x24fc('0x37')](_0x2c598c['query'][_0x24fc('0x37')]));_0x31ddd0[_0x24fc('0x38')]=_0x31ddd0['attributes']['length']?_0x31ddd0[_0x24fc('0x38')]:_0x3af80a['model'];if(_0x2c598c['query'][_0x24fc('0x4a')]){_0x31ddd0['include']=[{'all':!![]}];}_0x31ddd0=_[_0x24fc('0x3f')]({},_0x31ddd0,_0x2c598c[_0x24fc('0x4b')]);return db[_0x24fc('0x42')]['find'](_0x31ddd0)[_0x24fc('0x2a')](handleEntityNotFound(_0x5e4e9b,null))[_0x24fc('0x2a')](respondWithResult(_0x5e4e9b,null))[_0x24fc('0x46')](handleError(_0x5e4e9b,null));};exports[_0x24fc('0x4c')]=function(_0x39873d,_0x6c6754){return db[_0x24fc('0x42')][_0x24fc('0x4c')](_0x39873d['body'],{})['then'](function(_0x266378){var _0x2f1a99=_0x39873d[_0x24fc('0x4d')]['get']({'plain':!![]});if(!_0x2f1a99)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f1a99[_0x24fc('0x4e')]===_0x24fc('0x4d')){var _0x179a60=_0x266378[_0x24fc('0x4f')]({'plain':!![]});var _0x21f8b8=_0x24fc('0x28');return db[_0x24fc('0x50')][_0x24fc('0x51')]({'where':{'name':_0x21f8b8,'userProfileId':_0x2f1a99[_0x24fc('0x52')]},'raw':!![]})[_0x24fc('0x2a')](function(_0x434700){if(_0x434700&&_0x434700[_0x24fc('0x53')]===0x0){return db['UserProfileResource'][_0x24fc('0x4c')]({'name':_0x179a60[_0x24fc('0x2d')],'resourceId':_0x179a60['id'],'type':_0x434700[_0x24fc('0x2d')],'sectionId':_0x434700['id']},{})[_0x24fc('0x2a')](function(){return _0x266378;});}else{return _0x266378;}})[_0x24fc('0x46')](function(_0x5bdc4d){logger[_0x24fc('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bdc4d);throw _0x5bdc4d;});}return _0x266378;})[_0x24fc('0x2a')](respondWithResult(_0x6c6754,0xc9))[_0x24fc('0x46')](handleError(_0x6c6754,null));};exports[_0x24fc('0x26')]=function(_0x41ddfb,_0x40f42b){if(_0x41ddfb[_0x24fc('0x54')]['id']){delete _0x41ddfb['body']['id'];}return db[_0x24fc('0x42')][_0x24fc('0x51')]({'where':{'id':_0x41ddfb[_0x24fc('0x55')]['id']}})[_0x24fc('0x2a')](handleEntityNotFound(_0x40f42b,null))[_0x24fc('0x2a')](saveUpdates(_0x41ddfb[_0x24fc('0x54')],null))['then'](respondWithResult(_0x40f42b,null))[_0x24fc('0x46')](handleError(_0x40f42b,null));};exports[_0x24fc('0x27')]=function(_0x1628b4,_0x1b69ad){return db[_0x24fc('0x42')][_0x24fc('0x51')]({'where':{'id':_0x1628b4[_0x24fc('0x55')]['id']}})['then'](handleEntityNotFound(_0x1b69ad,null))[_0x24fc('0x2a')](removeEntity(_0x1b69ad,null))[_0x24fc('0x46')](handleError(_0x1b69ad,null));};exports['addAllCondition']=function(_0x1368f6,_0x192aa8,_0x276f11){if(_0x1368f6[_0x24fc('0x54')]['id']){delete _0x1368f6[_0x24fc('0x54')]['id'];}return db[_0x24fc('0x42')]['find']({'where':{'id':_0x1368f6[_0x24fc('0x55')]['id']}})['then'](handleEntityNotFound(_0x192aa8,null))[_0x24fc('0x2a')](function(_0x8c9649){if(_0x8c9649){_0x1368f6['body'][_0x24fc('0x56')]=_0x8c9649['id'];return db['Condition'][_0x24fc('0x4c')](_0x1368f6['body']);}})[_0x24fc('0x2a')](respondWithResult(_0x192aa8,null))[_0x24fc('0x46')](handleError(_0x192aa8,null));};exports['addAnyCondition']=function(_0x2edef7,_0x5d6539,_0x191bc6){if(_0x2edef7[_0x24fc('0x54')]['id']){delete _0x2edef7['body']['id'];}return db[_0x24fc('0x42')][_0x24fc('0x51')]({'where':{'id':_0x2edef7[_0x24fc('0x55')]['id']}})[_0x24fc('0x2a')](handleEntityNotFound(_0x5d6539,null))[_0x24fc('0x2a')](function(_0x4df659){if(_0x4df659){_0x2edef7[_0x24fc('0x54')][_0x24fc('0x57')]=_0x4df659['id'];return db[_0x24fc('0x58')][_0x24fc('0x4c')](_0x2edef7[_0x24fc('0x54')]);}})['then'](respondWithResult(_0x5d6539,null))['catch'](handleError(_0x5d6539,null));};exports[_0x24fc('0x59')]=function(_0xe634a,_0x4af02a,_0x4cd3ae){var _0x1e671d={};var _0x33fb07={};var _0x28ef6a;var _0x1c47cd;return db['Trigger'][_0x24fc('0x5a')]({'where':{'id':_0xe634a[_0x24fc('0x55')]['id']}})[_0x24fc('0x2a')](handleEntityNotFound(_0x4af02a,null))[_0x24fc('0x2a')](function(_0x1df0c4){if(_0x1df0c4){_0x28ef6a=_0x1df0c4;_0x33fb07[_0x24fc('0x33')]=_[_0x24fc('0x48')](db[_0x24fc('0x58')][_0x24fc('0x2f')]);_0x33fb07[_0x24fc('0x34')]=_[_0x24fc('0x48')](_0xe634a[_0x24fc('0x34')]);_0x33fb07[_0x24fc('0x35')]=_[_0x24fc('0x36')](_0x33fb07[_0x24fc('0x33')],_0x33fb07['query']);_0x1e671d[_0x24fc('0x38')]=_[_0x24fc('0x36')](_0x33fb07[_0x24fc('0x33')],qs[_0x24fc('0x37')](_0xe634a[_0x24fc('0x34')][_0x24fc('0x37')]));_0x1e671d[_0x24fc('0x38')]=_0x1e671d[_0x24fc('0x38')]['length']?_0x1e671d[_0x24fc('0x38')]:_0x33fb07[_0x24fc('0x33')];_0x1e671d[_0x24fc('0x5b')]=qs[_0x24fc('0x3b')](_0xe634a['query'][_0x24fc('0x3b')]);_0x1e671d[_0x24fc('0x3c')]=qs['filters'](_['pick'](_0xe634a['query'],_0x33fb07[_0x24fc('0x35')]));if(_0xe634a[_0x24fc('0x34')][_0x24fc('0x3e')]){_0x1e671d[_0x24fc('0x3c')]=_[_0x24fc('0x3f')](_0x1e671d[_0x24fc('0x3c')],{'$or':_['map'](_0x1e671d[_0x24fc('0x38')],function(_0x15e8a3){var _0x5a2c09={};_0x5a2c09[_0x15e8a3]={'$like':'%'+_0xe634a['query'][_0x24fc('0x3e')]+'%'};return _0x5a2c09;})});}_0x1e671d=_[_0x24fc('0x3f')]({},_0x1e671d,_0xe634a[_0x24fc('0x4b')]);return _0x28ef6a['getAllConditions'](_0x1e671d);}})[_0x24fc('0x2a')](function(_0x7640fa){if(_0x7640fa){_0x1c47cd=_0x7640fa[_0x24fc('0x39')];if(!_0xe634a['query']['hasOwnProperty']('nolimit')){_0x1e671d['limit']=qs['limit'](_0xe634a[_0x24fc('0x34')][_0x24fc('0x20')]);_0x1e671d[_0x24fc('0x1f')]=qs[_0x24fc('0x1f')](_0xe634a['query'][_0x24fc('0x1f')]);}return _0x28ef6a['getAllConditions'](_0x1e671d);}})[_0x24fc('0x2a')](function(_0x4e6eec){if(_0x4e6eec){return _0x4e6eec?{'count':_0x1c47cd,'rows':_0x4e6eec}:null;}})[_0x24fc('0x2a')](respondWithResult(_0x4af02a,null))[_0x24fc('0x46')](handleError(_0x4af02a,null));};exports[_0x24fc('0x5c')]=function(_0x4291bd,_0x3c4e2c,_0x291d60){var _0x35c5f7={};var _0x591ec6={};var _0x45513e;var _0x302992;return db[_0x24fc('0x42')]['findOne']({'where':{'id':_0x4291bd['params']['id']}})[_0x24fc('0x2a')](handleEntityNotFound(_0x3c4e2c,null))[_0x24fc('0x2a')](function(_0x4d4291){if(_0x4d4291){_0x45513e=_0x4d4291;_0x591ec6[_0x24fc('0x33')]=_[_0x24fc('0x48')](db['Condition'][_0x24fc('0x2f')]);_0x591ec6[_0x24fc('0x34')]=_['keys'](_0x4291bd[_0x24fc('0x34')]);_0x591ec6[_0x24fc('0x35')]=_[_0x24fc('0x36')](_0x591ec6[_0x24fc('0x33')],_0x591ec6[_0x24fc('0x34')]);_0x35c5f7[_0x24fc('0x38')]=_['intersection'](_0x591ec6['model'],qs[_0x24fc('0x37')](_0x4291bd['query'][_0x24fc('0x37')]));_0x35c5f7['attributes']=_0x35c5f7['attributes'][_0x24fc('0x39')]?_0x35c5f7[_0x24fc('0x38')]:_0x591ec6[_0x24fc('0x33')];_0x35c5f7[_0x24fc('0x5b')]=qs[_0x24fc('0x3b')](_0x4291bd[_0x24fc('0x34')][_0x24fc('0x3b')]);_0x35c5f7[_0x24fc('0x3c')]=qs['filters'](_[_0x24fc('0x3d')](_0x4291bd[_0x24fc('0x34')],_0x591ec6['filters']));if(_0x4291bd['query'][_0x24fc('0x3e')]){_0x35c5f7[_0x24fc('0x3c')]=_[_0x24fc('0x3f')](_0x35c5f7[_0x24fc('0x3c')],{'$or':_[_0x24fc('0x40')](_0x35c5f7['attributes'],function(_0x216781){var _0xcb7986={};_0xcb7986[_0x216781]={'$like':'%'+_0x4291bd['query'][_0x24fc('0x3e')]+'%'};return _0xcb7986;})});}_0x35c5f7=_[_0x24fc('0x3f')]({},_0x35c5f7,_0x4291bd[_0x24fc('0x4b')]);return _0x45513e['getAnyConditions'](_0x35c5f7);}})[_0x24fc('0x2a')](function(_0x4752ba){if(_0x4752ba){_0x302992=_0x4752ba[_0x24fc('0x39')];if(!_0x4291bd[_0x24fc('0x34')][_0x24fc('0x3a')](_0x24fc('0x5d'))){_0x35c5f7[_0x24fc('0x20')]=qs[_0x24fc('0x20')](_0x4291bd[_0x24fc('0x34')]['limit']);_0x35c5f7[_0x24fc('0x1f')]=qs[_0x24fc('0x1f')](_0x4291bd[_0x24fc('0x34')]['offset']);}return _0x45513e['getAnyConditions'](_0x35c5f7);}})['then'](function(_0x1c6e01){if(_0x1c6e01){return _0x1c6e01?{'count':_0x302992,'rows':_0x1c6e01}:null;}})['then'](respondWithResult(_0x3c4e2c,null))[_0x24fc('0x46')](handleError(_0x3c4e2c,null));};exports[_0x24fc('0x5e')]=function(_0x5c051f,_0x23ec74,_0x559692){if(_0x5c051f[_0x24fc('0x54')]['id']){delete _0x5c051f['body']['id'];}return db[_0x24fc('0x42')][_0x24fc('0x51')]({'where':{'id':_0x5c051f[_0x24fc('0x55')]['id']}})[_0x24fc('0x2a')](handleEntityNotFound(_0x23ec74,null))[_0x24fc('0x2a')](function(_0x1f9265){if(_0x1f9265){_0x5c051f['body'][_0x24fc('0x5f')]=_0x1f9265['id'];return db[_0x24fc('0x60')][_0x24fc('0x4c')](_0x5c051f[_0x24fc('0x54')]);}})[_0x24fc('0x2a')](respondWithResult(_0x23ec74,null))[_0x24fc('0x46')](handleError(_0x23ec74,null));};exports[_0x24fc('0x61')]=function(_0x3f21c0,_0x1b3db1,_0x5f4ec2){var _0x2c9119={};var _0x211295={};var _0x31b110;var _0x30ed50;return db['Trigger'][_0x24fc('0x5a')]({'where':{'id':_0x3f21c0[_0x24fc('0x55')]['id']}})[_0x24fc('0x2a')](handleEntityNotFound(_0x1b3db1,null))['then'](function(_0x29cbc5){if(_0x29cbc5){_0x31b110=_0x29cbc5;_0x211295['model']=_['keys'](db['Action'][_0x24fc('0x2f')]);_0x211295['query']=_[_0x24fc('0x48')](_0x3f21c0[_0x24fc('0x34')]);_0x211295[_0x24fc('0x35')]=_[_0x24fc('0x36')](_0x211295['model'],_0x211295[_0x24fc('0x34')]);_0x2c9119[_0x24fc('0x38')]=_[_0x24fc('0x36')](_0x211295[_0x24fc('0x33')],qs[_0x24fc('0x37')](_0x3f21c0['query'][_0x24fc('0x37')]));_0x2c9119[_0x24fc('0x38')]=_0x2c9119[_0x24fc('0x38')][_0x24fc('0x39')]?_0x2c9119['attributes']:_0x211295['model'];_0x2c9119[_0x24fc('0x5b')]=qs[_0x24fc('0x3b')](_0x3f21c0[_0x24fc('0x34')][_0x24fc('0x3b')]);_0x2c9119[_0x24fc('0x3c')]=qs['filters'](_[_0x24fc('0x3d')](_0x3f21c0[_0x24fc('0x34')],_0x211295[_0x24fc('0x35')]));if(_0x3f21c0['query'][_0x24fc('0x3e')]){_0x2c9119[_0x24fc('0x3c')]=_[_0x24fc('0x3f')](_0x2c9119[_0x24fc('0x3c')],{'$or':_[_0x24fc('0x40')](_0x2c9119['attributes'],function(_0x52cc49){var _0x587e47={};_0x587e47[_0x52cc49]={'$like':'%'+_0x3f21c0[_0x24fc('0x34')][_0x24fc('0x3e')]+'%'};return _0x587e47;})});}_0x2c9119=_[_0x24fc('0x3f')]({},_0x2c9119,_0x3f21c0[_0x24fc('0x4b')]);return _0x31b110[_0x24fc('0x61')](_0x2c9119);}})[_0x24fc('0x2a')](function(_0x1a2838){if(_0x1a2838){_0x30ed50=_0x1a2838[_0x24fc('0x39')];if(!_0x3f21c0[_0x24fc('0x34')][_0x24fc('0x3a')](_0x24fc('0x5d'))){_0x2c9119[_0x24fc('0x20')]=qs['limit'](_0x3f21c0['query'][_0x24fc('0x20')]);_0x2c9119['offset']=qs[_0x24fc('0x1f')](_0x3f21c0[_0x24fc('0x34')][_0x24fc('0x1f')]);}return _0x31b110[_0x24fc('0x61')](_0x2c9119);}})[_0x24fc('0x2a')](function(_0x574a98){if(_0x574a98){return _0x574a98?{'count':_0x30ed50,'rows':_0x574a98}:null;}})[_0x24fc('0x2a')](respondWithResult(_0x1b3db1,null))[_0x24fc('0x46')](handleError(_0x1b3db1,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 3a0006e..762ad46 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 _0x869e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util'];(function(_0x170d17,_0x1b1827){var _0x526a44=function(_0x74ae43){while(--_0x74ae43){_0x170d17['push'](_0x170d17['shift']());}};_0x526a44(++_0x1b1827);}(_0x869e,0x8d));var _0xe869=function(_0xebc35,_0x34aeb7){_0xebc35=_0xebc35-0x0;var _0x1e71db=_0x869e[_0xebc35];return _0x1e71db;};'use strict';var _=require(_0xe869('0x0'));var util=require(_0xe869('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe869('0x2'));var BPromise=require(_0xe869('0x3'));var rp=require(_0xe869('0x4'));var fs=require('fs');var path=require(_0xe869('0x5'));var rimraf=require(_0xe869('0x6'));var config=require(_0xe869('0x7'));var attributes=require(_0xe869('0x8'));module[_0xe869('0x9')]=function(_0x4028f6,_0x932dde){return _0x4028f6[_0xe869('0xa')](_0xe869('0xb'),attributes,{'tableName':_0xe869('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa107=['Trigger','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./trigger.attributes','exports','define'];(function(_0x5858df,_0x52167c){var _0x37cf27=function(_0x105e20){while(--_0x105e20){_0x5858df['push'](_0x5858df['shift']());}};_0x37cf27(++_0x52167c);}(_0xa107,0x9d));var _0x7a10=function(_0x58be6e,_0x5b665f){_0x58be6e=_0x58be6e-0x0;var _0xae5018=_0xa107[_0x58be6e];return _0xae5018;};'use strict';var _=require(_0x7a10('0x0'));var util=require(_0x7a10('0x1'));var logger=require(_0x7a10('0x2'))(_0x7a10('0x3'));var moment=require(_0x7a10('0x4'));var BPromise=require(_0x7a10('0x5'));var rp=require(_0x7a10('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a10('0x7'));var config=require(_0x7a10('0x8'));var attributes=require(_0x7a10('0x9'));module[_0x7a10('0xa')]=function(_0x2d2b9c,_0x461288){return _0x2d2b9c[_0x7a10('0xb')](_0x7a10('0xc'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index fcf05a8..e8ad884 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 _0x3423=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s','stringify','error','code','message','info','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowTrigger','find','debug','moment','bluebird','randomstring','ioredis'];(function(_0x3f30ce,_0x461247){var _0x17d560=function(_0x230e8b){while(--_0x230e8b){_0x3f30ce['push'](_0x3f30ce['shift']());}};_0x17d560(++_0x461247);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3342('0x0'));var BPromise=require(_0x3342('0x1'));var rs=require(_0x3342('0x2'));var fs=require('fs');var Redis=require(_0x3342('0x3'));var db=require(_0x3342('0x4'))['db'];var utils=require(_0x3342('0x5'));var logger=require(_0x3342('0x6'))(_0x3342('0x7'));var config=require(_0x3342('0x8'));var jayson=require(_0x3342('0x9'));var client=jayson[_0x3342('0xa')][_0x3342('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29c40c,_0x420d4b,_0x76422d){return new BPromise(function(_0xce08ab,_0x305d13){return client[_0x3342('0xc')](_0x29c40c,_0x76422d)[_0x3342('0xd')](function(_0x4ae4f3){logger['info'](_0x3342('0xe'),_0x420d4b,'request\x20sent');logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x420d4b,'request\x20sent',JSON[_0x3342('0xf')](_0x4ae4f3));if(_0x4ae4f3[_0x3342('0x10')]){if(_0x4ae4f3['error'][_0x3342('0x11')]===0x1f4){logger['error'](_0x3342('0xe'),_0x420d4b,_0x4ae4f3[_0x3342('0x10')]['message']);return _0x305d13(_0x4ae4f3[_0x3342('0x10')][_0x3342('0x12')]);}logger[_0x3342('0x10')](_0x3342('0xe'),_0x420d4b,_0x4ae4f3[_0x3342('0x10')][_0x3342('0x12')]);return _0xce08ab(_0x4ae4f3[_0x3342('0x10')]['message']);}else{logger[_0x3342('0x13')](_0x3342('0xe'),_0x420d4b,'request\x20sent');_0xce08ab(_0x4ae4f3[_0x3342('0x14')][_0x3342('0x12')]);}})['catch'](function(_0x554f9c){logger[_0x3342('0x10')](_0x3342('0xe'),_0x420d4b,_0x554f9c);_0x305d13(_0x554f9c);});});}exports[_0x3342('0x15')]=function(_0x2075cb){var _0x12947a=this;return new Promise(function(_0x156c24,_0x45a3ca){return db[_0x3342('0x16')][_0x3342('0x17')]({'raw':_0x2075cb['options']?_0x2075cb[_0x3342('0x18')][_0x3342('0x19')]===undefined?!![]:![]:!![],'where':_0x2075cb[_0x3342('0x18')]?_0x2075cb['options'][_0x3342('0x1a')]||null:null,'attributes':_0x2075cb[_0x3342('0x18')]?_0x2075cb['options'][_0x3342('0x1b')]||null:null,'limit':_0x2075cb[_0x3342('0x18')]?_0x2075cb['options'][_0x3342('0x1c')]||null:null,'include':_0x2075cb['options']?_0x2075cb[_0x3342('0x18')][_0x3342('0x1d')]?_[_0x3342('0x1e')](_0x2075cb[_0x3342('0x18')][_0x3342('0x1d')],function(_0x2925a2){return{'model':db[_0x2925a2[_0x3342('0x1f')]],'as':_0x2925a2['as'],'attributes':_0x2925a2[_0x3342('0x1b')],'include':_0x2925a2['include']?_[_0x3342('0x1e')](_0x2925a2['include'],function(_0x51cf45){return{'model':db[_0x51cf45[_0x3342('0x1f')]],'as':_0x51cf45['as'],'attributes':_0x51cf45['attributes'],'include':_0x51cf45['include']?_[_0x3342('0x1e')](_0x51cf45['include'],function(_0x37df78){return{'model':db[_0x37df78['model']],'as':_0x37df78['as'],'attributes':_0x37df78['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1497d9){logger[_0x3342('0x13')](_0x3342('0x15'),_0x2075cb);logger['debug'](_0x3342('0x15'),_0x2075cb,JSON[_0x3342('0xf')](_0x1497d9));_0x156c24(_0x1497d9);})[_0x3342('0x20')](function(_0x272a52){logger['error'](_0x3342('0x15'),_0x272a52[_0x3342('0x12')],_0x2075cb);_0x45a3ca(_0x12947a[_0x3342('0x10')](0x1f4,_0x272a52[_0x3342('0x12')]));});});};exports[_0x3342('0x21')]=function(_0x2cc691){var _0x135760=this;return new Promise(function(_0x47b2a0,_0x2e0bde){return db['Trigger'][_0x3342('0x22')]({'raw':_0x2cc691[_0x3342('0x18')]?_0x2cc691['options'][_0x3342('0x19')]===undefined?!![]:![]:!![],'where':_0x2cc691[_0x3342('0x18')]?_0x2cc691[_0x3342('0x18')][_0x3342('0x1a')]||null:null,'attributes':_0x2cc691['options']?_0x2cc691[_0x3342('0x18')][_0x3342('0x1b')]||null:null,'include':_0x2cc691[_0x3342('0x18')]?_0x2cc691[_0x3342('0x18')][_0x3342('0x1d')]?_[_0x3342('0x1e')](_0x2cc691[_0x3342('0x18')][_0x3342('0x1d')],function(_0x2531fb){return{'model':db[_0x2531fb[_0x3342('0x1f')]],'as':_0x2531fb['as'],'attributes':_0x2531fb[_0x3342('0x1b')],'include':_0x2531fb[_0x3342('0x1d')]?_['map'](_0x2531fb['include'],function(_0x1dc9b3){return{'model':db[_0x1dc9b3['model']],'as':_0x1dc9b3['as'],'attributes':_0x1dc9b3[_0x3342('0x1b')],'include':_0x1dc9b3[_0x3342('0x1d')]?_[_0x3342('0x1e')](_0x1dc9b3[_0x3342('0x1d')],function(_0x2dbc02){return{'model':db[_0x2dbc02[_0x3342('0x1f')]],'as':_0x2dbc02['as'],'attributes':_0x2dbc02[_0x3342('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4754d9){logger[_0x3342('0x13')](_0x3342('0x21'),_0x2cc691);logger[_0x3342('0x23')](_0x3342('0x21'),_0x2cc691,JSON['stringify'](_0x4754d9));_0x47b2a0(_0x4754d9);})[_0x3342('0x20')](function(_0x4d1a59){logger[_0x3342('0x10')](_0x3342('0x21'),_0x4d1a59[_0x3342('0x12')],_0x2cc691);_0x2e0bde(_0x135760[_0x3342('0x10')](0x1f4,_0x4d1a59['message']));});});}; \ No newline at end of file +var _0xbfcc=['findAll','options','raw','where','attributes','limit','map','model','include','then','GetTrigger','catch','ShowTrigger','Trigger','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x434783,_0xff395d){var _0x13efcf=function(_0x235dac){while(--_0x235dac){_0x434783['push'](_0x434783['shift']());}};_0x13efcf(++_0xff395d);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xbfcc[_0x543084];return _0x306a57;};'use strict';var _=require(_0xcbfc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcbfc('0x1'));var rs=require(_0xcbfc('0x2'));var fs=require('fs');var Redis=require(_0xcbfc('0x3'));var db=require(_0xcbfc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcbfc('0x5'));var client=jayson[_0xcbfc('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b3917,_0x5a2be0,_0x2ea130){return new BPromise(function(_0x1f8b71,_0x1b1377){return client[_0xcbfc('0x7')](_0x1b3917,_0x2ea130)['then'](function(_0x2e7097){logger[_0xcbfc('0x8')](_0xcbfc('0x9'),_0x5a2be0,_0xcbfc('0xa'));logger[_0xcbfc('0xb')](_0xcbfc('0xc'),_0x5a2be0,'request\x20sent',JSON[_0xcbfc('0xd')](_0x2e7097));if(_0x2e7097[_0xcbfc('0xe')]){if(_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0xf')]===0x1f4){logger[_0xcbfc('0xe')]('Trigger,\x20%s,\x20%s',_0x5a2be0,_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0x10')]);return _0x1b1377(_0x2e7097[_0xcbfc('0xe')]['message']);}logger[_0xcbfc('0xe')](_0xcbfc('0x9'),_0x5a2be0,_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0x10')]);return _0x1f8b71(_0x2e7097[_0xcbfc('0xe')]['message']);}else{logger[_0xcbfc('0x8')](_0xcbfc('0x9'),_0x5a2be0,_0xcbfc('0xa'));_0x1f8b71(_0x2e7097[_0xcbfc('0x11')]['message']);}})['catch'](function(_0x418f18){logger[_0xcbfc('0xe')](_0xcbfc('0x9'),_0x5a2be0,_0x418f18);_0x1b1377(_0x418f18);});});}exports['GetTrigger']=function(_0x5b078f){var _0x33f731=this;return new Promise(function(_0x99b59d,_0x344510){return db['Trigger'][_0xcbfc('0x12')]({'raw':_0x5b078f['options']?_0x5b078f[_0xcbfc('0x13')][_0xcbfc('0x14')]===undefined?!![]:![]:!![],'where':_0x5b078f[_0xcbfc('0x13')]?_0x5b078f[_0xcbfc('0x13')][_0xcbfc('0x15')]||null:null,'attributes':_0x5b078f[_0xcbfc('0x13')]?_0x5b078f['options'][_0xcbfc('0x16')]||null:null,'limit':_0x5b078f[_0xcbfc('0x13')]?_0x5b078f['options'][_0xcbfc('0x17')]||null:null,'include':_0x5b078f['options']?_0x5b078f['options']['include']?_[_0xcbfc('0x18')](_0x5b078f['options']['include'],function(_0x1b3e42){return{'model':db[_0x1b3e42[_0xcbfc('0x19')]],'as':_0x1b3e42['as'],'attributes':_0x1b3e42[_0xcbfc('0x16')],'include':_0x1b3e42[_0xcbfc('0x1a')]?_['map'](_0x1b3e42[_0xcbfc('0x1a')],function(_0x51284a){return{'model':db[_0x51284a[_0xcbfc('0x19')]],'as':_0x51284a['as'],'attributes':_0x51284a[_0xcbfc('0x16')],'include':_0x51284a['include']?_[_0xcbfc('0x18')](_0x51284a[_0xcbfc('0x1a')],function(_0x4ab48e){return{'model':db[_0x4ab48e[_0xcbfc('0x19')]],'as':_0x4ab48e['as'],'attributes':_0x4ab48e[_0xcbfc('0x16')]};}):[]};}):[]};}):[]:[]})[_0xcbfc('0x1b')](function(_0x41f3b8){logger['info'](_0xcbfc('0x1c'),_0x5b078f);logger[_0xcbfc('0xb')]('GetTrigger',_0x5b078f,JSON[_0xcbfc('0xd')](_0x41f3b8));_0x99b59d(_0x41f3b8);})[_0xcbfc('0x1d')](function(_0x7cbdfa){logger[_0xcbfc('0xe')](_0xcbfc('0x1c'),_0x7cbdfa[_0xcbfc('0x10')],_0x5b078f);_0x344510(_0x33f731[_0xcbfc('0xe')](0x1f4,_0x7cbdfa['message']));});});};exports[_0xcbfc('0x1e')]=function(_0x433300){var _0x3f9d20=this;return new Promise(function(_0x20a378,_0x500a0b){return db[_0xcbfc('0x1f')][_0xcbfc('0x20')]({'raw':_0x433300[_0xcbfc('0x13')]?_0x433300[_0xcbfc('0x13')][_0xcbfc('0x14')]===undefined?!![]:![]:!![],'where':_0x433300[_0xcbfc('0x13')]?_0x433300[_0xcbfc('0x13')]['where']||null:null,'attributes':_0x433300[_0xcbfc('0x13')]?_0x433300[_0xcbfc('0x13')]['attributes']||null:null,'include':_0x433300[_0xcbfc('0x13')]?_0x433300[_0xcbfc('0x13')][_0xcbfc('0x1a')]?_['map'](_0x433300['options']['include'],function(_0x3c6d04){return{'model':db[_0x3c6d04[_0xcbfc('0x19')]],'as':_0x3c6d04['as'],'attributes':_0x3c6d04[_0xcbfc('0x16')],'include':_0x3c6d04[_0xcbfc('0x1a')]?_[_0xcbfc('0x18')](_0x3c6d04[_0xcbfc('0x1a')],function(_0x856e83){return{'model':db[_0x856e83[_0xcbfc('0x19')]],'as':_0x856e83['as'],'attributes':_0x856e83['attributes'],'include':_0x856e83[_0xcbfc('0x1a')]?_[_0xcbfc('0x18')](_0x856e83['include'],function(_0x3093b5){return{'model':db[_0x3093b5['model']],'as':_0x3093b5['as'],'attributes':_0x3093b5[_0xcbfc('0x16')]};}):[]};}):[]};}):[]:[]})[_0xcbfc('0x1b')](function(_0x43121e){logger['info'](_0xcbfc('0x1e'),_0x433300);logger['debug']('ShowTrigger',_0x433300,JSON[_0xcbfc('0xd')](_0x43121e));_0x20a378(_0x43121e);})[_0xcbfc('0x1d')](function(_0x382d8b){logger[_0xcbfc('0xe')](_0xcbfc('0x1e'),_0x382d8b[_0xcbfc('0x10')],_0x433300);_0x500a0b(_0x3f9d20[_0xcbfc('0xe')](0x1f4,_0x382d8b[_0xcbfc('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index b0e68ee..d3ba226 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 _0xf3cd=['../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index','get','/:id','show','/:id/clone','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x3d7911,_0x5d7eb0){var _0x6606ec=function(_0x53dede){while(--_0x53dede){_0x3d7911['push'](_0x3d7911['shift']());}};_0x6606ec(++_0x5d7eb0);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x525b28,_0x5cf5a0){_0x525b28=_0x525b28-0x0;var _0x180178=_0xf3cd[_0x525b28];return _0x180178;};'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'](_0xdf3c('0xe'),auth['isAuthenticated'](),controller['clone']);router[_0xdf3c('0xf')]('/',auth[_0xdf3c('0x9')](),controller['create']);router[_0xdf3c('0x10')](_0xdf3c('0xc'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x11')]);router[_0xdf3c('0x12')](_0xdf3c('0xc'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x13')]);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(_0x14794b,_0x17c31d){var _0x28889e=function(_0x579711){while(--_0x579711){_0x14794b['push'](_0x14794b['shift']());}};_0x28889e(++_0x17c31d);}(_0x00bb,0x1d8));var _0xb00b=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x00bb[_0x47a7d0];return _0xb9bd08;};'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 8ca8b3a..29e43c3 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 _0xabcb=['outgoing','force_rport,comedia','setDataValue','nat','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<>','always','accept','refuse','originate','uas','fingerprint','certificate','passive','actpass','dynamic','BOOLEAN','sequelize','exports','STRING','name','friend','user','peer','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','rfc2833','inband','ENUM','yes','nonat','update'];(function(_0x4cb661,_0x1e02da){var _0x1f62f0=function(_0x5a3f5c){while(--_0x5a3f5c){_0x4cb661['push'](_0x4cb661['shift']());}};_0x1f62f0(++_0x1e02da);}(_0xabcb,0x11a));var _0xbabc=function(_0x3a77a6,_0x2b513b){_0x3a77a6=_0x3a77a6-0x0;var _0x4053db=_0xabcb[_0x3a77a6];return _0x4053db;};'use strict';var Sequelize=require(_0xbabc('0x0'));module[_0xbabc('0x1')]={'name':{'type':Sequelize[_0xbabc('0x2')],'allowNull':![],'unique':_0xbabc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xbabc('0x4'),_0xbabc('0x5'),_0xbabc('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0xbabc('0x7'),_0xbabc('0x8'),_0xbabc('0x9'),_0xbabc('0xa'),_0xbabc('0xb'),_0xbabc('0xc'),_0xbabc('0xd'))},'deny':{'type':Sequelize[_0xbabc('0x2')]},'permit':{'type':Sequelize[_0xbabc('0x2')]},'secret':{'type':Sequelize[_0xbabc('0x2')]},'md5secret':{'type':Sequelize[_0xbabc('0x2')]},'remotesecret':{'type':Sequelize[_0xbabc('0x2')]},'transport':{'type':Sequelize[_0xbabc('0x2')],'defaultValue':_0xbabc('0xe'),'set':function(_0x3fa754){this['setDataValue'](_0xbabc('0xf'),_0x3fa754?_0x3fa754[_0xbabc('0x10')](','):null);},'get':function(){return this[_0xbabc('0x11')](_0xbabc('0xf'))?this[_0xbabc('0x11')](_0xbabc('0xf'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0xbabc('0x12'),'info','shortinfo',_0xbabc('0x13'),'auto'),'defaultValue':_0xbabc('0x12')},'directmedia':{'type':Sequelize[_0xbabc('0x14')](_0xbabc('0x15'),'no',_0xbabc('0x16'),_0xbabc('0x17'),_0xbabc('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xbabc('0x14')](_0xbabc('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xbabc('0x2')]},'directmediadeny':{'type':Sequelize[_0xbabc('0x2')]},'nat':{'type':Sequelize[_0xbabc('0x2')],'defaultValue':_0xbabc('0x19'),'set':function(_0x3feaae){this[_0xbabc('0x1a')](_0xbabc('0x1b'),_0x3feaae?_0x3feaae[_0xbabc('0x10')](','):null);},'get':function(){return this[_0xbabc('0x11')](_0xbabc('0x1b'))?this[_0xbabc('0x11')](_0xbabc('0x1b'))[_0xbabc('0x1c')](','):null;},'comment':_0xbabc('0x1d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xbabc('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xbabc('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xbabc('0x1e')},'allow':{'type':Sequelize[_0xbabc('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x29eabc){this[_0xbabc('0x1a')](_0xbabc('0x1f'),_0x29eabc?_0x29eabc[_0xbabc('0x10')](';'):_0xbabc('0x20'));},'get':function(){return this[_0xbabc('0x11')](_0xbabc('0x1f'))?this['getDataValue'](_0xbabc('0x1f'))['split'](';'):null;},'comment':_0xbabc('0x21')},'autoframing':{'type':Sequelize[_0xbabc('0x14')]('yes','no')},'insecure':{'type':Sequelize[_0xbabc('0x2')],'defaultValue':_0xbabc('0x22'),'set':function(_0x1b0a41){this[_0xbabc('0x1a')](_0xbabc('0x23'),_0x1b0a41?_0x1b0a41[_0xbabc('0x10')](','):null);},'get':function(){return this[_0xbabc('0x11')](_0xbabc('0x23'))?this['getDataValue']('insecure')[_0xbabc('0x1c')](','):null;},'comment':_0xbabc('0x24')},'trustrpid':{'type':Sequelize['ENUM'](_0xbabc('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xbabc('0x14')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xbabc('0x14')](_0xbabc('0x15'),'no',_0xbabc('0x25'))},'promiscredir':{'type':Sequelize[_0xbabc('0x14')](_0xbabc('0x15'),'no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize[_0xbabc('0x26')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xbabc('0x2')],'defaultValue':_0xbabc('0x27')},'amaflags':{'type':Sequelize[_0xbabc('0x2')]},'callcounter':{'type':Sequelize[_0xbabc('0x14')](_0xbabc('0x15'),'no'),'defaultValue':_0xbabc('0x15')},'busylevel':{'type':Sequelize[_0xbabc('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0xbabc('0x14')](_0xbabc('0x15'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0xbabc('0x14')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xbabc('0x14')](_0xbabc('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0xbabc('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xbabc('0x14')](_0xbabc('0x15'),'no',_0xbabc('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xbabc('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xbabc('0x14')]('yes','no')},'mailbox':{'type':Sequelize[_0xbabc('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0xbabc('0x29'),_0xbabc('0x2a'),_0xbabc('0x2b'))},'session_expires':{'type':Sequelize[_0xbabc('0x26')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xbabc('0x14')]('uac','uas'),'defaultValue':_0xbabc('0x2c')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xbabc('0x2')]},'fromdomain':{'type':Sequelize[_0xbabc('0x2')]},'fromuser':{'type':Sequelize[_0xbabc('0x2')]},'port':{'type':Sequelize[_0xbabc('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xbabc('0x15'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xbabc('0x26')](0xb)},'defaultip':{'type':Sequelize[_0xbabc('0x2')]},'defaultuser':{'type':Sequelize[_0xbabc('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xbabc('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xbabc('0x26')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xbabc('0x15'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xbabc('0x2')]},'timert1':{'type':Sequelize[_0xbabc('0x26')](0xb)},'timerb':{'type':Sequelize[_0xbabc('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0xbabc('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0xbabc('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xbabc('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xbabc('0x2')]},'maxforwards':{'type':Sequelize[_0xbabc('0x26')](0xb)},'encryption':{'type':Sequelize[_0xbabc('0x14')](_0xbabc('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xbabc('0x15'),'no')},'force_avp':{'type':Sequelize[_0xbabc('0x14')](_0xbabc('0x15'),'no')},'icesupport':{'type':Sequelize[_0xbabc('0x14')](_0xbabc('0x15'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0xbabc('0x14')]('yes','no',_0xbabc('0x2d'),_0xbabc('0x2e'))},'dtlsrekey':{'type':Sequelize[_0xbabc('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0xbabc('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xbabc('0x2')]},'dtlscipher':{'type':Sequelize[_0xbabc('0x2')]},'dtlscafile':{'type':Sequelize[_0xbabc('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xbabc('0x14')]('active',_0xbabc('0x2f'),_0xbabc('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xbabc('0x14')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xbabc('0x2')]},'recordofffeature':{'type':Sequelize[_0xbabc('0x2')]},'call_limit':{'type':Sequelize[_0xbabc('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xbabc('0x14')](_0xbabc('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0xbabc('0x14')](_0xbabc('0x15'),'no')},'vmexten':{'type':Sequelize[_0xbabc('0x2')]},'mohinterpret':{'type':Sequelize[_0xbabc('0x2')]},'mohsuggest':{'type':Sequelize[_0xbabc('0x2')]},'parkinglot':{'type':Sequelize[_0xbabc('0x2')]},'description':{'type':Sequelize[_0xbabc('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xbabc('0x31')},'canreinvite':{'type':Sequelize[_0xbabc('0x14')](_0xbabc('0x15'),'no','nonat','update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xbabc('0x2')]},'active':{'type':Sequelize[_0xbabc('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x4616=['nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','INTEGER','always','refuse','originate','uac','uas','certificate','active','passive','actpass','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','user','peer','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','yes','nonat','update','outgoing','setDataValue'];(function(_0x149882,_0x39b6be){var _0x43c6ee=function(_0x42d925){while(--_0x42d925){_0x149882['push'](_0x149882['shift']());}};_0x43c6ee(++_0x39b6be);}(_0x4616,0x19d));var _0x6461=function(_0x164e8f,_0xdba27a){_0x164e8f=_0x164e8f-0x0;var _0x2b2840=_0x4616[_0x164e8f];return _0x2b2840;};'use strict';var Sequelize=require(_0x6461('0x0'));module[_0x6461('0x1')]={'name':{'type':Sequelize[_0x6461('0x2')],'allowNull':![],'unique':_0x6461('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6461('0x4')]('friend',_0x6461('0x5'),_0x6461('0x6')),'allowNull':![],'defaultValue':_0x6461('0x7')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6461('0x8')},'callingpres':{'type':Sequelize[_0x6461('0x4')](_0x6461('0x9'),_0x6461('0xa'),_0x6461('0xb'),_0x6461('0xc'),_0x6461('0xd'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0x6461('0xe'))},'deny':{'type':Sequelize[_0x6461('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x6461('0x2')]},'md5secret':{'type':Sequelize[_0x6461('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0xa17a6a){this['setDataValue'](_0x6461('0xf'),_0xa17a6a?_0xa17a6a[_0x6461('0x10')](','):null);},'get':function(){return this['getDataValue'](_0x6461('0xf'))?this[_0x6461('0x11')](_0x6461('0xf'))[_0x6461('0x12')](','):null;},'comment':_0x6461('0x13')},'dtmfmode':{'type':Sequelize['ENUM'](_0x6461('0x14'),'info',_0x6461('0x15'),'inband',_0x6461('0x16')),'defaultValue':_0x6461('0x14')},'directmedia':{'type':Sequelize['ENUM'](_0x6461('0x17'),'no',_0x6461('0x18'),_0x6461('0x19'),_0x6461('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6461('0x4')](_0x6461('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6461('0x2')]},'directmediadeny':{'type':Sequelize[_0x6461('0x2')]},'nat':{'type':Sequelize[_0x6461('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x5d9efa){this[_0x6461('0x1b')]('nat',_0x5d9efa?_0x5d9efa[_0x6461('0x10')](','):null);},'get':function(){return this[_0x6461('0x11')](_0x6461('0x1c'))?this[_0x6461('0x11')](_0x6461('0x1c'))[_0x6461('0x12')](','):null;},'comment':_0x6461('0x1d')},'callgroup':{'type':Sequelize[_0x6461('0x2')]},'namedcallgroup':{'type':Sequelize[_0x6461('0x2')]},'pickupgroup':{'type':Sequelize[_0x6461('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x6461('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6461('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0x6461('0x2')],'allowNull':![],'defaultValue':_0x6461('0x1e'),'set':function(_0x3fa165){this[_0x6461('0x1b')](_0x6461('0x1f'),_0x3fa165?_0x3fa165[_0x6461('0x10')](';'):_0x6461('0x1e'));},'get':function(){return this[_0x6461('0x11')](_0x6461('0x1f'))?this[_0x6461('0x11')]('allow')[_0x6461('0x12')](';'):null;},'comment':_0x6461('0x20')},'autoframing':{'type':Sequelize[_0x6461('0x4')](_0x6461('0x17'),'no')},'insecure':{'type':Sequelize[_0x6461('0x2')],'defaultValue':_0x6461('0x21'),'set':function(_0x40bc5d){this[_0x6461('0x1b')](_0x6461('0x22'),_0x40bc5d?_0x40bc5d['join'](','):null);},'get':function(){return this[_0x6461('0x11')]('insecure')?this['getDataValue']('insecure')['split'](','):null;},'comment':_0x6461('0x23')},'trustrpid':{'type':Sequelize[_0x6461('0x4')](_0x6461('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6461('0x4')](_0x6461('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6461('0x4')](_0x6461('0x17'),'no','never')},'promiscredir':{'type':Sequelize[_0x6461('0x4')]('yes','no')},'useclientcode':{'type':Sequelize[_0x6461('0x4')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x6461('0x2')]},'callerid':{'type':Sequelize[_0x6461('0x2')],'defaultValue':_0x6461('0x24')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x6461('0x4')](_0x6461('0x17'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x6461('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x6461('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x6461('0x4')](_0x6461('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x6461('0x4')](_0x6461('0x17'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x6461('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x6461('0x2')]},'template':{'type':Sequelize[_0x6461('0x2')]},'videosupport':{'type':Sequelize[_0x6461('0x4')]('yes','no',_0x6461('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6461('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x6461('0x4')](_0x6461('0x17'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x6461('0x4')]('accept',_0x6461('0x27'),_0x6461('0x28'))},'session_expires':{'type':Sequelize[_0x6461('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x6461('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x6461('0x4')](_0x6461('0x29'),_0x6461('0x2a')),'defaultValue':_0x6461('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x6461('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x6461('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x6461('0x25')](0x5)},'qualify':{'type':Sequelize[_0x6461('0x4')](_0x6461('0x17'),'no'),'defaultValue':_0x6461('0x17')},'keepalive':{'type':Sequelize[_0x6461('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x6461('0x2')]},'defaultuser':{'type':Sequelize[_0x6461('0x2')]},'rtptimeout':{'type':Sequelize[_0x6461('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x6461('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x6461('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x6461('0x4')](_0x6461('0x17'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6461('0x2')]},'callbackextension':{'type':Sequelize[_0x6461('0x2')]},'timert1':{'type':Sequelize[_0x6461('0x25')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x6461('0x2')]},'contactdeny':{'type':Sequelize[_0x6461('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x6461('0x2')]},'use_q850_reason':{'type':Sequelize[_0x6461('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x6461('0x4')](_0x6461('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6461('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0x6461('0x4')](_0x6461('0x17'),'no')},'icesupport':{'type':Sequelize[_0x6461('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x6461('0x4')](_0x6461('0x17'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x6461('0x17'),'no','fingerprint',_0x6461('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x6461('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x6461('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x6461('0x2')]},'dtlscapath':{'type':Sequelize[_0x6461('0x2')]},'dtlssetup':{'type':Sequelize[_0x6461('0x4')](_0x6461('0x2c'),_0x6461('0x2d'),_0x6461('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x6461('0x4')](_0x6461('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x6461('0x2')]},'call_limit':{'type':Sequelize[_0x6461('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x6461('0x4')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x6461('0x4')]('yes','no')},'vmexten':{'type':Sequelize[_0x6461('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x6461('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6461('0x2')]},'host':{'type':Sequelize[_0x6461('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x6461('0x4')](_0x6461('0x17'),'no',_0x6461('0x18'),_0x6461('0x19'),_0x6461('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x6461('0x2')]},'active':{'type':Sequelize[_0x6461('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 14978d0..523dd1d 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 _0xf6a5=['result','catch','sendStatus','end','count','offset','limit','status','set','json','apply','reject','save','update','then','destroy','Trunks','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','Trunk','include','findAll','rows','params','rawAttributes','length','includeAll','find','clone','omit','createdAt','updatedAt','body','create','user','get','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x4eaa42,_0x3c4233){var _0x34749e=function(_0x4dfdd5){while(--_0x4dfdd5){_0x4eaa42['push'](_0x4eaa42['shift']());}};_0x34749e(++_0x3c4233);}(_0xf6a5,0x125));var _0x5f6a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf6a5[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5f6a('0x0'));var rimraf=require(_0x5f6a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5f6a('0x2'));var rp=require('request-promise');var moment=require(_0x5f6a('0x3'));var BPromise=require(_0x5f6a('0x4'));var Mustache=require(_0x5f6a('0x5'));var util=require('util');var path=require(_0x5f6a('0x6'));var sox=require('sox');var csv=require(_0x5f6a('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5f6a('0x8'));var squel=require(_0x5f6a('0x9'));var crypto=require(_0x5f6a('0xa'));var jsforce=require(_0x5f6a('0xb'));var deskjs=require(_0x5f6a('0xc'));var toCsv=require(_0x5f6a('0x7'));var querystring=require('querystring');var Papa=require(_0x5f6a('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5f6a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f6a('0xf'));var logger=require('../../config/logger')(_0x5f6a('0x10'));var utils=require(_0x5f6a('0x11'));var config=require(_0x5f6a('0x12'));var licenseUtil=require(_0x5f6a('0x13'));var db=require(_0x5f6a('0x14'))['db'];var jayson=require(_0x5f6a('0x15'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x40adb3,_0x4b1ce0,_0x436f8c,_0x4c9666){return new BPromise(function(_0x4be408,_0x5bc9f7){var _0x56161e=_0x4c9666||client;return _0x56161e[_0x5f6a('0x16')](_0x40adb3,_0x436f8c)['then'](function(_0x403b92){logger[_0x5f6a('0x17')](_0x5f6a('0x18'),_0x4b1ce0,_0x5f6a('0x19'));logger[_0x5f6a('0x1a')]('Trunk,\x20%s,\x20%s,\x20%s',_0x4b1ce0,_0x5f6a('0x19'),JSON[_0x5f6a('0x1b')](_0x403b92));if(_0x403b92[_0x5f6a('0x1c')]){if(_0x403b92[_0x5f6a('0x1c')][_0x5f6a('0x1d')]===0x1f4){logger[_0x5f6a('0x1c')](_0x5f6a('0x18'),_0x4b1ce0,_0x403b92[_0x5f6a('0x1c')]['message']);return _0x5bc9f7(_0x403b92['error']['message']);}logger[_0x5f6a('0x1c')]('Trunk,\x20%s,\x20%s',_0x4b1ce0,_0x403b92[_0x5f6a('0x1c')][_0x5f6a('0x1e')]);return _0x4be408(_0x403b92[_0x5f6a('0x1c')][_0x5f6a('0x1e')]);}else{logger[_0x5f6a('0x17')](_0x5f6a('0x18'),_0x4b1ce0,'request\x20sent');_0x4be408(_0x403b92[_0x5f6a('0x1f')][_0x5f6a('0x1e')]);}})[_0x5f6a('0x20')](function(_0x45bee4){logger[_0x5f6a('0x1c')](_0x5f6a('0x18'),_0x4b1ce0,_0x45bee4);_0x5bc9f7(_0x45bee4);});});}function respondWithStatusCode(_0x521cb1,_0x22b456){_0x22b456=_0x22b456||0xcc;return function(_0x54b264){if(_0x54b264){return _0x521cb1[_0x5f6a('0x21')](_0x22b456);}return _0x521cb1['status'](_0x22b456)[_0x5f6a('0x22')]();};}function respondWithResult(_0x530bc9,_0x283b51){_0x283b51=_0x283b51||0xc8;return function(_0x251050){if(_0x251050){return _0x530bc9['status'](_0x283b51)['json'](_0x251050);}};}function respondWithFilteredResult(_0x35c532,_0x4b170e){return function(_0x3a6b64){if(_0x3a6b64){var _0x51a5ab=_0x3a6b64[_0x5f6a('0x23')],_0x1d6e0f=_0x4b170e[_0x5f6a('0x24')],_0x4ea871=_0x4b170e['offset']+_0x4b170e[_0x5f6a('0x25')],_0x634092;if(_0x4ea871>=_0x51a5ab){_0x4ea871=_0x51a5ab;_0x634092=0xc8;}else{_0x634092=0xce;}_0x35c532[_0x5f6a('0x26')](_0x634092);return _0x35c532[_0x5f6a('0x27')]('Content-Range',_0x1d6e0f+'-'+_0x4ea871+'/'+_0x51a5ab)[_0x5f6a('0x28')](_0x3a6b64);}return null;};}function patchUpdates(_0x411a50){return function(_0x4119af){try{jsonpatch[_0x5f6a('0x29')](_0x4119af,_0x411a50,!![]);}catch(_0x53322a){return BPromise[_0x5f6a('0x2a')](_0x53322a);}return _0x4119af[_0x5f6a('0x2b')]();};}function saveUpdates(_0x2cc06e,_0x53ac80){return function(_0x254454){if(_0x254454){return _0x254454[_0x5f6a('0x2c')](_0x2cc06e)[_0x5f6a('0x2d')](function(_0x5d3e4e){return _0x5d3e4e;});}return null;};}function removeEntity(_0x3ff1c3,_0x24d9f6){return function(_0x4f6b73){if(_0x4f6b73){return _0x4f6b73[_0x5f6a('0x2e')]()['then'](function(){var _0x1493a4=_0x4f6b73['get']({'plain':!![]});var _0x1ec25a=_0x5f6a('0x2f');return db['UserProfileResource'][_0x5f6a('0x2e')]({'where':{'type':_0x1ec25a,'resourceId':_0x1493a4['id']}})['then'](function(){return _0x4f6b73;});})['then'](function(){_0x3ff1c3[_0x5f6a('0x26')](0xcc)[_0x5f6a('0x22')]();});}};}function handleEntityNotFound(_0x85d71b,_0x54b844){return function(_0x4c8bbc){if(!_0x4c8bbc){_0x85d71b[_0x5f6a('0x21')](0x194);}return _0x4c8bbc;};}function handleError(_0x115ab4,_0x42d990){_0x42d990=_0x42d990||0x1f4;return function(_0x292035){logger['error'](_0x292035[_0x5f6a('0x30')]);if(_0x292035[_0x5f6a('0x31')]){delete _0x292035[_0x5f6a('0x31')];}_0x115ab4[_0x5f6a('0x26')](_0x42d990)[_0x5f6a('0x32')](_0x292035);};}exports[_0x5f6a('0x33')]=function(_0x48d231,_0x4742d4){var _0x594f44={},_0x521c40={},_0x3defb2={'count':0x0,'rows':[]};var _0x477ca2=_[_0x5f6a('0x34')](db['Trunk']['rawAttributes'],function(_0x1e4bc7){return{'name':_0x1e4bc7[_0x5f6a('0x35')],'type':_0x1e4bc7[_0x5f6a('0x36')][_0x5f6a('0x37')]};});_0x521c40[_0x5f6a('0x38')]=_[_0x5f6a('0x34')](_0x477ca2,_0x5f6a('0x31'));_0x521c40[_0x5f6a('0x39')]=_[_0x5f6a('0x3a')](_0x48d231['query']);_0x521c40[_0x5f6a('0x3b')]=_[_0x5f6a('0x3c')](_0x521c40[_0x5f6a('0x38')],_0x521c40[_0x5f6a('0x39')]);_0x594f44[_0x5f6a('0x3d')]=_[_0x5f6a('0x3c')](_0x521c40[_0x5f6a('0x38')],qs[_0x5f6a('0x3e')](_0x48d231[_0x5f6a('0x39')]['fields']));_0x594f44['attributes']=_0x594f44[_0x5f6a('0x3d')]['length']?_0x594f44[_0x5f6a('0x3d')]:_0x521c40[_0x5f6a('0x38')];if(!_0x48d231[_0x5f6a('0x39')][_0x5f6a('0x3f')](_0x5f6a('0x40'))){_0x594f44[_0x5f6a('0x25')]=qs['limit'](_0x48d231['query'][_0x5f6a('0x25')]);_0x594f44[_0x5f6a('0x24')]=qs[_0x5f6a('0x24')](_0x48d231[_0x5f6a('0x39')][_0x5f6a('0x24')]);}_0x594f44[_0x5f6a('0x41')]=qs['sort'](_0x48d231[_0x5f6a('0x39')][_0x5f6a('0x42')]);_0x594f44[_0x5f6a('0x43')]=qs[_0x5f6a('0x3b')](_['pick'](_0x48d231['query'],_0x521c40['filters']),_0x477ca2);if(_0x48d231[_0x5f6a('0x39')][_0x5f6a('0x44')]){_0x594f44[_0x5f6a('0x43')]=_[_0x5f6a('0x45')](_0x594f44[_0x5f6a('0x43')],{'$or':_[_0x5f6a('0x34')](_0x477ca2,function(_0x4bc9a4){if(_0x4bc9a4[_0x5f6a('0x36')]!=='VIRTUAL'){var _0x2e8fce={};_0x2e8fce[_0x4bc9a4[_0x5f6a('0x31')]]={'$like':'%'+_0x48d231[_0x5f6a('0x39')]['filter']+'%'};return _0x2e8fce;}})});}_0x594f44=_[_0x5f6a('0x45')]({},_0x594f44,_0x48d231[_0x5f6a('0x46')]);var _0x1fed74={'where':_0x594f44['where']};return db[_0x5f6a('0x47')]['count'](_0x1fed74)[_0x5f6a('0x2d')](function(_0x1f2079){_0x3defb2[_0x5f6a('0x23')]=_0x1f2079;if(_0x48d231[_0x5f6a('0x39')]['includeAll']){_0x594f44[_0x5f6a('0x48')]=[{'all':!![]}];}return db[_0x5f6a('0x47')][_0x5f6a('0x49')](_0x594f44);})[_0x5f6a('0x2d')](function(_0x2d7d02){_0x3defb2[_0x5f6a('0x4a')]=_0x2d7d02;return _0x3defb2;})[_0x5f6a('0x2d')](respondWithFilteredResult(_0x4742d4,_0x594f44))[_0x5f6a('0x20')](handleError(_0x4742d4,null));};exports['show']=function(_0x171654,_0x5d4fef){var _0x188d5f={'raw':![],'where':{'id':_0x171654[_0x5f6a('0x4b')]['id']}},_0x4bbc1c={};_0x4bbc1c[_0x5f6a('0x38')]=_['keys'](db[_0x5f6a('0x47')][_0x5f6a('0x4c')]);_0x4bbc1c['query']=_[_0x5f6a('0x3a')](_0x171654['query']);_0x4bbc1c['filtears']=_[_0x5f6a('0x3c')](_0x4bbc1c[_0x5f6a('0x38')],_0x4bbc1c[_0x5f6a('0x39')]);_0x188d5f['attributes']=_[_0x5f6a('0x3c')](_0x4bbc1c[_0x5f6a('0x38')],qs['fields'](_0x171654[_0x5f6a('0x39')][_0x5f6a('0x3e')]));_0x188d5f[_0x5f6a('0x3d')]=_0x188d5f[_0x5f6a('0x3d')][_0x5f6a('0x4d')]?_0x188d5f[_0x5f6a('0x3d')]:_0x4bbc1c[_0x5f6a('0x38')];if(_0x171654[_0x5f6a('0x39')][_0x5f6a('0x4e')]){_0x188d5f[_0x5f6a('0x48')]=[{'all':!![]}];}_0x188d5f=_[_0x5f6a('0x45')]({},_0x188d5f,_0x171654[_0x5f6a('0x46')]);return db['Trunk'][_0x5f6a('0x4f')](_0x188d5f)['then'](handleEntityNotFound(_0x5d4fef,null))['then'](respondWithResult(_0x5d4fef,null))[_0x5f6a('0x20')](handleError(_0x5d4fef,null));};exports[_0x5f6a('0x50')]=function(_0xe301f,_0x3f51ea){var _0x51e5df={'where':{'id':_0xe301f['params']['id']}},_0x3f3229={};_0x3f3229[_0x5f6a('0x38')]=_[_0x5f6a('0x3a')](db[_0x5f6a('0x47')][_0x5f6a('0x4c')]);_0x51e5df['attributes']=_[_0x5f6a('0x3c')](_0x3f3229['model'],qs[_0x5f6a('0x3e')](_0xe301f[_0x5f6a('0x39')][_0x5f6a('0x3e')]));_0x51e5df[_0x5f6a('0x3d')]=_0x51e5df[_0x5f6a('0x3d')]['length']?_0x51e5df[_0x5f6a('0x3d')]:_0x3f3229['model'];if(_0xe301f[_0x5f6a('0x39')]['includeAll']){_0x51e5df['include']=[{'all':!![]}];}_0x51e5df=_[_0x5f6a('0x45')]({},_0x51e5df,_0xe301f['options']);return db['Trunk'][_0x5f6a('0x4f')](_0x51e5df)[_0x5f6a('0x2d')](handleEntityNotFound(_0x3f51ea,null))[_0x5f6a('0x2d')](function(_0x55881c){if(_0x55881c){var _0x383828=_0x55881c['get']({'plain':!![]});_0x383828=qs[_0x5f6a('0x51')](_0x383828,['id',_0x5f6a('0x52'),_0x5f6a('0x53')]);_0xe301f[_0x5f6a('0x54')]=_[_0x5f6a('0x51')](_0xe301f[_0x5f6a('0x54')],['id',_0x5f6a('0x52'),_0x5f6a('0x53')]);return db[_0x5f6a('0x47')][_0x5f6a('0x55')](_[_0x5f6a('0x45')](_0x383828,_0xe301f[_0x5f6a('0x54')]),{'include':_0xe301f[_0x5f6a('0x39')][_0x5f6a('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x5678fa){var _0x9ab44a=_0xe301f[_0x5f6a('0x56')]['get']({'plain':!![]});if(!_0x9ab44a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9ab44a['role']===_0x5f6a('0x56')){var _0x45a418=_0x5678fa[_0x5f6a('0x57')]({'plain':!![]});var _0x43836c=_0x5f6a('0x2f');return db[_0x5f6a('0x58')][_0x5f6a('0x4f')]({'where':{'name':_0x43836c,'userProfileId':_0x9ab44a['userProfileId']},'raw':!![]})[_0x5f6a('0x2d')](function(_0x14c064){if(_0x14c064&&_0x14c064[_0x5f6a('0x59')]===0x0){return db[_0x5f6a('0x5a')]['create']({'name':_0x45a418[_0x5f6a('0x31')],'resourceId':_0x45a418['id'],'type':_0x14c064['name'],'sectionId':_0x14c064['id']},{})['then'](function(){return _0x5678fa;});}else{return _0x5678fa;}})['catch'](function(_0x4d7ce6){logger[_0x5f6a('0x1c')](_0x5f6a('0x5b'),_0x4d7ce6);throw _0x4d7ce6;});}return _0x5678fa;});}})[_0x5f6a('0x2d')](respondWithResult(_0x3f51ea,0xc9))[_0x5f6a('0x20')](handleError(_0x3f51ea,null));};exports['create']=function(_0x29bedd,_0x2e0b94,_0x1d517c){var _0x3d44d1;return db[_0x5f6a('0x47')][_0x5f6a('0x55')](_0x29bedd[_0x5f6a('0x54')],{'raw':!![]})[_0x5f6a('0x2d')](function(_0x4a1e64){_0x3d44d1=_0x4a1e64;return db[_0x5f6a('0x47')]['findAll']({'raw':!![]});})[_0x5f6a('0x2d')](function(_0xadf360){var _0x28bed9=fs['readFileSync'](path[_0x5f6a('0x5c')](config[_0x5f6a('0x5d')],_0x5f6a('0x5e')),_0x5f6a('0x5f'));var _0x127ddc=fs[_0x5f6a('0x60')](path[_0x5f6a('0x5c')](config[_0x5f6a('0x5d')],_0x5f6a('0x61')),_0x5f6a('0x5f'));var _0x2754fe=ejs[_0x5f6a('0x62')](_0x28bed9,{'trunks':_0xadf360||[]});fs[_0x5f6a('0x63')](_0x5f6a('0x64'),_0x2754fe);if(_0x3d44d1[_0x5f6a('0x65')]){var _0x401511=ejs['render'](_0x127ddc,{'trunks':_0xadf360||[]});fs[_0x5f6a('0x63')](_0x5f6a('0x66'),_0x401511);}})[_0x5f6a('0x2d')](function(){return respondWithRpcPromise(_0x5f6a('0x67'),'create',{'module':_0x5f6a('0x68')});})[_0x5f6a('0x2d')](function(){var _0x30480a=_0x29bedd[_0x5f6a('0x56')][_0x5f6a('0x57')]({'plain':!![]});if(!_0x30480a)throw new Error(_0x5f6a('0x69'));if(_0x30480a[_0x5f6a('0x6a')]==='user'){var _0x39ccaf=_0x3d44d1['get']({'plain':!![]});return db['UserProfileSection'][_0x5f6a('0x4f')]({'where':{'name':_0x5f6a('0x2f'),'userProfileId':_0x30480a[_0x5f6a('0x6b')]},'raw':!![]})[_0x5f6a('0x2d')](function(_0x7e7ad2){if(_0x7e7ad2&&_0x7e7ad2[_0x5f6a('0x59')]===0x0){return db[_0x5f6a('0x5a')][_0x5f6a('0x55')]({'name':_0x39ccaf[_0x5f6a('0x31')],'resourceId':_0x39ccaf['id'],'type':_0x7e7ad2[_0x5f6a('0x31')],'sectionId':_0x7e7ad2['id']},{})[_0x5f6a('0x2d')](function(){return _0x3d44d1;});}else{return _0x3d44d1;}})['catch'](function(_0x4cbf60){logger[_0x5f6a('0x1c')](_0x5f6a('0x5b'),_0x4cbf60);throw _0x4cbf60;});}return _0x3d44d1;})[_0x5f6a('0x2d')](respondWithResult(_0x2e0b94,0xc9))['catch'](handleError(_0x2e0b94,null));};exports['update']=function(_0x1f4281,_0x3cf504,_0x2a5a40){var _0x4d30d6;return db[_0x5f6a('0x47')][_0x5f6a('0x4f')]({'where':{'id':_0x1f4281[_0x5f6a('0x4b')]['id']}})[_0x5f6a('0x2d')](handleEntityNotFound(_0x3cf504,null))['then'](saveUpdates(_0x1f4281[_0x5f6a('0x54')],null))[_0x5f6a('0x2d')](function(_0x13b840){if(_0x13b840){_0x4d30d6=_0x13b840;return db[_0x5f6a('0x47')]['findAll']({'raw':!![]});}})[_0x5f6a('0x2d')](function(_0x1d89e3){if(_0x1d89e3){var _0x5771e4=fs['readFileSync'](path[_0x5f6a('0x5c')](config[_0x5f6a('0x5d')],_0x5f6a('0x5e')),_0x5f6a('0x5f'));var _0x932945=fs[_0x5f6a('0x60')](path[_0x5f6a('0x5c')](config['root'],_0x5f6a('0x61')),_0x5f6a('0x5f'));var _0x397c84=ejs[_0x5f6a('0x62')](_0x5771e4,{'trunks':_0x1d89e3||[]});fs[_0x5f6a('0x63')](_0x5f6a('0x64'),_0x397c84);var _0x274345=ejs[_0x5f6a('0x62')](_0x932945,{'trunks':_0x1d89e3||[]});fs['writeFileSync'](_0x5f6a('0x66'),_0x274345);return respondWithRpcPromise(_0x5f6a('0x67'),'update',{'module':_0x5f6a('0x68')});}return null;})[_0x5f6a('0x2d')](function(_0x36b498){if(_0x36b498){return _0x4d30d6;}})[_0x5f6a('0x2d')](respondWithResult(_0x3cf504,null))[_0x5f6a('0x20')](handleError(_0x3cf504,null));};exports['destroy']=function(_0x4ae164,_0x515355,_0x255128){var _0x37bf13;return db[_0x5f6a('0x47')]['find']({'where':{'id':_0x4ae164[_0x5f6a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x515355,null))[_0x5f6a('0x2d')](removeEntity(_0x515355,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x5f6a('0x2d')](function(_0x3fc371){var _0x2fbe4a=fs[_0x5f6a('0x60')](path[_0x5f6a('0x5c')](config[_0x5f6a('0x5d')],'server/files/templates/trunk.ejs'),_0x5f6a('0x5f'));var _0x1eb2d3=fs['readFileSync'](path['join'](config[_0x5f6a('0x5d')],_0x5f6a('0x61')),_0x5f6a('0x5f'));var _0x204ac8=ejs[_0x5f6a('0x62')](_0x2fbe4a,{'trunks':_0x3fc371});var _0x3f52ed=ejs[_0x5f6a('0x62')](_0x1eb2d3,{'trunks':_0x3fc371});fs['writeFileSync'](_0x5f6a('0x64'),_0x204ac8);fs[_0x5f6a('0x63')]('/etc/asterisk/sip_xcally_registers.conf',_0x3f52ed);return respondWithRpcPromise(_0x5f6a('0x67'),_0x5f6a('0x2e'),{'module':_0x5f6a('0x68')});})[_0x5f6a('0x20')](handleError(_0x515355,null));}; \ No newline at end of file +var _0xedde=['sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','params','Trunk','length','find','clone','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','readFileSync','server/files/templates/trunk.ejs','join','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','UserProfileSection','root','chan_sip.so','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','jayson/promise','client','http','request','Trunk,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','UserProfileResource','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x3c172f,_0x2927ab){var _0x4748b9=function(_0x34f03c){while(--_0x34f03c){_0x3c172f['push'](_0x3c172f['shift']());}};_0x4748b9(++_0x2927ab);}(_0xedde,0x102));var _0xeedd=function(_0x149c55,_0x38fc84){_0x149c55=_0x149c55-0x0;var _0x26f7af=_0xedde[_0x149c55];return _0x26f7af;};'use strict';var pdf=require(_0xeedd('0x0'));var emlformat=require(_0xeedd('0x1'));var rimraf=require(_0xeedd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeedd('0x3'));var moment=require('moment');var BPromise=require(_0xeedd('0x4'));var Mustache=require(_0xeedd('0x5'));var util=require('util');var path=require(_0xeedd('0x6'));var sox=require(_0xeedd('0x7'));var csv=require(_0xeedd('0x8'));var ejs=require(_0xeedd('0x9'));var fs=require('fs');var _=require(_0xeedd('0xa'));var squel=require('squel');var crypto=require(_0xeedd('0xb'));var jsforce=require(_0xeedd('0xc'));var deskjs=require(_0xeedd('0xd'));var toCsv=require('to-csv');var querystring=require(_0xeedd('0xe'));var Papa=require(_0xeedd('0xf'));var Redis=require(_0xeedd('0x10'));var authService=require(_0xeedd('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xeedd('0x12'));var hardwareService=require(_0xeedd('0x13'));var logger=require(_0xeedd('0x14'))('api');var utils=require(_0xeedd('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xeedd('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xeedd('0x17'));var client=jayson[_0xeedd('0x18')][_0xeedd('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x277acb,_0x1abf52,_0x52834f,_0x573e9e){return new BPromise(function(_0x1bb8ad,_0x4120dc){var _0x1b9006=_0x573e9e||client;return _0x1b9006[_0xeedd('0x1a')](_0x277acb,_0x52834f)['then'](function(_0x42af88){logger['info'](_0xeedd('0x1b'),_0x1abf52,_0xeedd('0x1c'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x1abf52,'request\x20sent',JSON[_0xeedd('0x1d')](_0x42af88));if(_0x42af88['error']){if(_0x42af88[_0xeedd('0x1e')][_0xeedd('0x1f')]===0x1f4){logger['error'](_0xeedd('0x1b'),_0x1abf52,_0x42af88['error'][_0xeedd('0x20')]);return _0x4120dc(_0x42af88[_0xeedd('0x1e')][_0xeedd('0x20')]);}logger[_0xeedd('0x1e')]('Trunk,\x20%s,\x20%s',_0x1abf52,_0x42af88['error'][_0xeedd('0x20')]);return _0x1bb8ad(_0x42af88['error']['message']);}else{logger[_0xeedd('0x21')](_0xeedd('0x1b'),_0x1abf52,_0xeedd('0x1c'));_0x1bb8ad(_0x42af88[_0xeedd('0x22')][_0xeedd('0x20')]);}})[_0xeedd('0x23')](function(_0x2e76e9){logger[_0xeedd('0x1e')](_0xeedd('0x1b'),_0x1abf52,_0x2e76e9);_0x4120dc(_0x2e76e9);});});}function respondWithStatusCode(_0x2eb638,_0x12c0ca){_0x12c0ca=_0x12c0ca||0xcc;return function(_0x42982c){if(_0x42982c){return _0x2eb638[_0xeedd('0x24')](_0x12c0ca);}return _0x2eb638['status'](_0x12c0ca)['end']();};}function respondWithResult(_0x5c73e2,_0x4e8d7d){_0x4e8d7d=_0x4e8d7d||0xc8;return function(_0xb081bf){if(_0xb081bf){return _0x5c73e2[_0xeedd('0x25')](_0x4e8d7d)[_0xeedd('0x26')](_0xb081bf);}};}function respondWithFilteredResult(_0x1da111,_0x46c79f){return function(_0x447f06){if(_0x447f06){var _0x5dc20f=_0x447f06['count'],_0x74aa23=_0x46c79f[_0xeedd('0x27')],_0x1d7aae=_0x46c79f[_0xeedd('0x27')]+_0x46c79f[_0xeedd('0x28')],_0x553141;if(_0x1d7aae>=_0x5dc20f){_0x1d7aae=_0x5dc20f;_0x553141=0xc8;}else{_0x553141=0xce;}_0x1da111[_0xeedd('0x25')](_0x553141);return _0x1da111[_0xeedd('0x29')](_0xeedd('0x2a'),_0x74aa23+'-'+_0x1d7aae+'/'+_0x5dc20f)[_0xeedd('0x26')](_0x447f06);}return null;};}function patchUpdates(_0x247484){return function(_0x5adaec){try{jsonpatch[_0xeedd('0x2b')](_0x5adaec,_0x247484,!![]);}catch(_0x5583d9){return BPromise[_0xeedd('0x2c')](_0x5583d9);}return _0x5adaec[_0xeedd('0x2d')]();};}function saveUpdates(_0x1dce58,_0x57ef5f){return function(_0x5da6d8){if(_0x5da6d8){return _0x5da6d8[_0xeedd('0x2e')](_0x1dce58)[_0xeedd('0x2f')](function(_0x9849c7){return _0x9849c7;});}return null;};}function removeEntity(_0x2c745f,_0x11c5d4){return function(_0x51108f){if(_0x51108f){return _0x51108f[_0xeedd('0x30')]()['then'](function(){var _0x82c801=_0x51108f['get']({'plain':!![]});var _0x185e19=_0xeedd('0x31');return db[_0xeedd('0x32')]['destroy']({'where':{'type':_0x185e19,'resourceId':_0x82c801['id']}})[_0xeedd('0x2f')](function(){return _0x51108f;});})[_0xeedd('0x2f')](function(){_0x2c745f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x336055,_0x4a072c){return function(_0x5e32a9){if(!_0x5e32a9){_0x336055['sendStatus'](0x194);}return _0x5e32a9;};}function handleError(_0x4fda38,_0x2c834b){_0x2c834b=_0x2c834b||0x1f4;return function(_0x3b0b4e){logger[_0xeedd('0x1e')](_0x3b0b4e['stack']);if(_0x3b0b4e[_0xeedd('0x33')]){delete _0x3b0b4e[_0xeedd('0x33')];}_0x4fda38[_0xeedd('0x25')](_0x2c834b)[_0xeedd('0x34')](_0x3b0b4e);};}exports['index']=function(_0x97a676,_0x1c4154){var _0x4a7b20={},_0x294963={},_0x29af1a={'count':0x0,'rows':[]};var _0x3bac7c=_['map'](db['Trunk'][_0xeedd('0x35')],function(_0x3e39ca){return{'name':_0x3e39ca[_0xeedd('0x36')],'type':_0x3e39ca[_0xeedd('0x37')][_0xeedd('0x38')]};});_0x294963[_0xeedd('0x39')]=_[_0xeedd('0x3a')](_0x3bac7c,_0xeedd('0x33'));_0x294963[_0xeedd('0x3b')]=_[_0xeedd('0x3c')](_0x97a676[_0xeedd('0x3b')]);_0x294963['filters']=_['intersection'](_0x294963[_0xeedd('0x39')],_0x294963[_0xeedd('0x3b')]);_0x4a7b20['attributes']=_[_0xeedd('0x3d')](_0x294963[_0xeedd('0x39')],qs[_0xeedd('0x3e')](_0x97a676['query'][_0xeedd('0x3e')]));_0x4a7b20[_0xeedd('0x3f')]=_0x4a7b20[_0xeedd('0x3f')]['length']?_0x4a7b20[_0xeedd('0x3f')]:_0x294963['model'];if(!_0x97a676[_0xeedd('0x3b')][_0xeedd('0x40')](_0xeedd('0x41'))){_0x4a7b20[_0xeedd('0x28')]=qs[_0xeedd('0x28')](_0x97a676[_0xeedd('0x3b')][_0xeedd('0x28')]);_0x4a7b20['offset']=qs['offset'](_0x97a676[_0xeedd('0x3b')]['offset']);}_0x4a7b20['order']=qs[_0xeedd('0x42')](_0x97a676[_0xeedd('0x3b')][_0xeedd('0x42')]);_0x4a7b20[_0xeedd('0x43')]=qs[_0xeedd('0x44')](_[_0xeedd('0x45')](_0x97a676[_0xeedd('0x3b')],_0x294963[_0xeedd('0x44')]),_0x3bac7c);if(_0x97a676[_0xeedd('0x3b')]['filter']){_0x4a7b20[_0xeedd('0x43')]=_[_0xeedd('0x46')](_0x4a7b20[_0xeedd('0x43')],{'$or':_['map'](_0x3bac7c,function(_0x5dd8f9){if(_0x5dd8f9[_0xeedd('0x37')]!==_0xeedd('0x47')){var _0x42b6e0={};_0x42b6e0[_0x5dd8f9[_0xeedd('0x33')]]={'$like':'%'+_0x97a676[_0xeedd('0x3b')][_0xeedd('0x48')]+'%'};return _0x42b6e0;}})});}_0x4a7b20=_['merge']({},_0x4a7b20,_0x97a676[_0xeedd('0x49')]);var _0x139770={'where':_0x4a7b20['where']};return db['Trunk'][_0xeedd('0x4a')](_0x139770)[_0xeedd('0x2f')](function(_0x591337){_0x29af1a[_0xeedd('0x4a')]=_0x591337;if(_0x97a676[_0xeedd('0x3b')][_0xeedd('0x4b')]){_0x4a7b20[_0xeedd('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0xeedd('0x4d')](_0x4a7b20);})[_0xeedd('0x2f')](function(_0x2b242b){_0x29af1a['rows']=_0x2b242b;return _0x29af1a;})[_0xeedd('0x2f')](respondWithFilteredResult(_0x1c4154,_0x4a7b20))[_0xeedd('0x23')](handleError(_0x1c4154,null));};exports['show']=function(_0x3d3828,_0x5ca89d){var _0x43ca12={'raw':![],'where':{'id':_0x3d3828[_0xeedd('0x4e')]['id']}},_0x34fbdc={};_0x34fbdc[_0xeedd('0x39')]=_[_0xeedd('0x3c')](db[_0xeedd('0x4f')][_0xeedd('0x35')]);_0x34fbdc[_0xeedd('0x3b')]=_['keys'](_0x3d3828[_0xeedd('0x3b')]);_0x34fbdc['filtears']=_[_0xeedd('0x3d')](_0x34fbdc[_0xeedd('0x39')],_0x34fbdc[_0xeedd('0x3b')]);_0x43ca12[_0xeedd('0x3f')]=_[_0xeedd('0x3d')](_0x34fbdc['model'],qs['fields'](_0x3d3828[_0xeedd('0x3b')]['fields']));_0x43ca12[_0xeedd('0x3f')]=_0x43ca12[_0xeedd('0x3f')][_0xeedd('0x50')]?_0x43ca12[_0xeedd('0x3f')]:_0x34fbdc[_0xeedd('0x39')];if(_0x3d3828['query'][_0xeedd('0x4b')]){_0x43ca12['include']=[{'all':!![]}];}_0x43ca12=_[_0xeedd('0x46')]({},_0x43ca12,_0x3d3828[_0xeedd('0x49')]);return db[_0xeedd('0x4f')][_0xeedd('0x51')](_0x43ca12)[_0xeedd('0x2f')](handleEntityNotFound(_0x5ca89d,null))[_0xeedd('0x2f')](respondWithResult(_0x5ca89d,null))[_0xeedd('0x23')](handleError(_0x5ca89d,null));};exports[_0xeedd('0x52')]=function(_0x485de9,_0x550782){var _0x2e3a0c={'where':{'id':_0x485de9[_0xeedd('0x4e')]['id']}},_0x5055e1={};_0x5055e1[_0xeedd('0x39')]=_['keys'](db[_0xeedd('0x4f')][_0xeedd('0x35')]);_0x2e3a0c['attributes']=_['intersection'](_0x5055e1[_0xeedd('0x39')],qs[_0xeedd('0x3e')](_0x485de9[_0xeedd('0x3b')][_0xeedd('0x3e')]));_0x2e3a0c['attributes']=_0x2e3a0c[_0xeedd('0x3f')][_0xeedd('0x50')]?_0x2e3a0c['attributes']:_0x5055e1[_0xeedd('0x39')];if(_0x485de9[_0xeedd('0x3b')][_0xeedd('0x4b')]){_0x2e3a0c[_0xeedd('0x4c')]=[{'all':!![]}];}_0x2e3a0c=_[_0xeedd('0x46')]({},_0x2e3a0c,_0x485de9['options']);return db['Trunk'][_0xeedd('0x51')](_0x2e3a0c)[_0xeedd('0x2f')](handleEntityNotFound(_0x550782,null))[_0xeedd('0x2f')](function(_0x5a954c){if(_0x5a954c){var _0x53d143=_0x5a954c[_0xeedd('0x53')]({'plain':!![]});_0x53d143=qs[_0xeedd('0x54')](_0x53d143,['id',_0xeedd('0x55'),_0xeedd('0x56')]);_0x485de9[_0xeedd('0x57')]=_[_0xeedd('0x54')](_0x485de9[_0xeedd('0x57')],['id',_0xeedd('0x55'),_0xeedd('0x56')]);return db[_0xeedd('0x4f')][_0xeedd('0x58')](_[_0xeedd('0x46')](_0x53d143,_0x485de9[_0xeedd('0x57')]),{'include':_0x485de9[_0xeedd('0x3b')]['includeAll']?[{'all':!![]}]:undefined})[_0xeedd('0x2f')](function(_0x397997){var _0xcdac27=_0x485de9[_0xeedd('0x59')][_0xeedd('0x53')]({'plain':!![]});if(!_0xcdac27)throw new Error(_0xeedd('0x5a'));if(_0xcdac27[_0xeedd('0x5b')]===_0xeedd('0x59')){var _0x541ab0=_0x397997[_0xeedd('0x53')]({'plain':!![]});var _0x23e4e6=_0xeedd('0x31');return db['UserProfileSection'][_0xeedd('0x51')]({'where':{'name':_0x23e4e6,'userProfileId':_0xcdac27[_0xeedd('0x5c')]},'raw':!![]})[_0xeedd('0x2f')](function(_0x2b9a7a){if(_0x2b9a7a&&_0x2b9a7a[_0xeedd('0x5d')]===0x0){return db[_0xeedd('0x32')][_0xeedd('0x58')]({'name':_0x541ab0[_0xeedd('0x33')],'resourceId':_0x541ab0['id'],'type':_0x2b9a7a[_0xeedd('0x33')],'sectionId':_0x2b9a7a['id']},{})[_0xeedd('0x2f')](function(){return _0x397997;});}else{return _0x397997;}})[_0xeedd('0x23')](function(_0x437698){logger[_0xeedd('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x437698);throw _0x437698;});}return _0x397997;});}})['then'](respondWithResult(_0x550782,0xc9))['catch'](handleError(_0x550782,null));};exports[_0xeedd('0x58')]=function(_0x31548e,_0x463932,_0x284840){var _0x5289fb;return db[_0xeedd('0x4f')][_0xeedd('0x58')](_0x31548e[_0xeedd('0x57')],{'raw':!![]})[_0xeedd('0x2f')](function(_0x507a1f){_0x5289fb=_0x507a1f;return db[_0xeedd('0x4f')][_0xeedd('0x4d')]({'raw':!![]});})[_0xeedd('0x2f')](function(_0x1bc426){var _0x2ffef9=fs[_0xeedd('0x5e')](path['join'](config['root'],_0xeedd('0x5f')),'utf8');var _0x92533b=fs[_0xeedd('0x5e')](path[_0xeedd('0x60')](config['root'],_0xeedd('0x61')),_0xeedd('0x62'));var _0x5d623d=ejs['render'](_0x2ffef9,{'trunks':_0x1bc426||[]});fs[_0xeedd('0x63')](_0xeedd('0x64'),_0x5d623d);if(_0x5289fb[_0xeedd('0x65')]){var _0x1b2157=ejs[_0xeedd('0x66')](_0x92533b,{'trunks':_0x1bc426||[]});fs[_0xeedd('0x63')](_0xeedd('0x67'),_0x1b2157);}})[_0xeedd('0x2f')](function(){return respondWithRpcPromise(_0xeedd('0x68'),'create',{'module':'chan_sip.so'});})['then'](function(){var _0x2d75e8=_0x31548e[_0xeedd('0x59')][_0xeedd('0x53')]({'plain':!![]});if(!_0x2d75e8)throw new Error(_0xeedd('0x5a'));if(_0x2d75e8['role']===_0xeedd('0x59')){var _0x5a8490=_0x5289fb[_0xeedd('0x53')]({'plain':!![]});return db[_0xeedd('0x69')][_0xeedd('0x51')]({'where':{'name':_0xeedd('0x31'),'userProfileId':_0x2d75e8[_0xeedd('0x5c')]},'raw':!![]})[_0xeedd('0x2f')](function(_0x4982a8){if(_0x4982a8&&_0x4982a8[_0xeedd('0x5d')]===0x0){return db['UserProfileResource'][_0xeedd('0x58')]({'name':_0x5a8490[_0xeedd('0x33')],'resourceId':_0x5a8490['id'],'type':_0x4982a8['name'],'sectionId':_0x4982a8['id']},{})[_0xeedd('0x2f')](function(){return _0x5289fb;});}else{return _0x5289fb;}})['catch'](function(_0x489e5e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x489e5e);throw _0x489e5e;});}return _0x5289fb;})[_0xeedd('0x2f')](respondWithResult(_0x463932,0xc9))[_0xeedd('0x23')](handleError(_0x463932,null));};exports[_0xeedd('0x2e')]=function(_0xe47451,_0x1c36ad,_0x1bc9b6){var _0xa09e25;return db[_0xeedd('0x4f')][_0xeedd('0x51')]({'where':{'id':_0xe47451['params']['id']}})[_0xeedd('0x2f')](handleEntityNotFound(_0x1c36ad,null))[_0xeedd('0x2f')](saveUpdates(_0xe47451[_0xeedd('0x57')],null))['then'](function(_0x3e89bb){if(_0x3e89bb){_0xa09e25=_0x3e89bb;return db['Trunk']['findAll']({'raw':!![]});}})[_0xeedd('0x2f')](function(_0x41ec74){if(_0x41ec74){var _0x232d79=fs['readFileSync'](path[_0xeedd('0x60')](config[_0xeedd('0x6a')],_0xeedd('0x5f')),_0xeedd('0x62'));var _0x3bce72=fs['readFileSync'](path[_0xeedd('0x60')](config['root'],_0xeedd('0x61')),'utf8');var _0x234369=ejs['render'](_0x232d79,{'trunks':_0x41ec74||[]});fs[_0xeedd('0x63')]('/etc/asterisk/sip_xcally_trunks.conf',_0x234369);var _0x4eb90e=ejs[_0xeedd('0x66')](_0x3bce72,{'trunks':_0x41ec74||[]});fs[_0xeedd('0x63')]('/etc/asterisk/sip_xcally_registers.conf',_0x4eb90e);return respondWithRpcPromise(_0xeedd('0x68'),'update',{'module':_0xeedd('0x6b')});}return null;})[_0xeedd('0x2f')](function(_0x5782ae){if(_0x5782ae){return _0xa09e25;}})[_0xeedd('0x2f')](respondWithResult(_0x1c36ad,null))[_0xeedd('0x23')](handleError(_0x1c36ad,null));};exports['destroy']=function(_0x15c95c,_0x438db7,_0x412b70){var _0x339380;return db['Trunk']['find']({'where':{'id':_0x15c95c['params']['id']}})[_0xeedd('0x2f')](handleEntityNotFound(_0x438db7,null))[_0xeedd('0x2f')](removeEntity(_0x438db7,null))[_0xeedd('0x2f')](function(){return db[_0xeedd('0x4f')][_0xeedd('0x4d')]({'raw':!![]});})[_0xeedd('0x2f')](function(_0x3445ad){var _0x193d27=fs['readFileSync'](path[_0xeedd('0x60')](config[_0xeedd('0x6a')],_0xeedd('0x5f')),_0xeedd('0x62'));var _0x39c9fe=fs[_0xeedd('0x5e')](path['join'](config[_0xeedd('0x6a')],_0xeedd('0x61')),_0xeedd('0x62'));var _0x4c000a=ejs['render'](_0x193d27,{'trunks':_0x3445ad});var _0x47d478=ejs[_0xeedd('0x66')](_0x39c9fe,{'trunks':_0x3445ad});fs['writeFileSync'](_0xeedd('0x64'),_0x4c000a);fs[_0xeedd('0x63')](_0xeedd('0x67'),_0x47d478);return respondWithRpcPromise(_0xeedd('0x68'),_0xeedd('0x30'),{'module':_0xeedd('0x6b')});})[_0xeedd('0x23')](handleError(_0x438db7,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index c2b015d..fe3f2ce 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 _0x69cf=['moment','bluebird','request-promise','path','rimraf','./trunk.attributes','define','Trunk','tools_trunks','util','../../config/logger','api'];(function(_0x3867c6,_0x14e1a2){var _0x39979c=function(_0x4edbb8){while(--_0x4edbb8){_0x3867c6['push'](_0x3867c6['shift']());}};_0x39979c(++_0x14e1a2);}(_0x69cf,0x99));var _0xf69c=function(_0x16938f,_0x35e57f){_0x16938f=_0x16938f-0x0;var _0x5c66e9=_0x69cf[_0x16938f];return _0x5c66e9;};'use strict';var _=require('lodash');var util=require(_0xf69c('0x0'));var logger=require(_0xf69c('0x1'))(_0xf69c('0x2'));var moment=require(_0xf69c('0x3'));var BPromise=require(_0xf69c('0x4'));var rp=require(_0xf69c('0x5'));var fs=require('fs');var path=require(_0xf69c('0x6'));var rimraf=require(_0xf69c('0x7'));var config=require('../../config/environment');var attributes=require(_0xf69c('0x8'));module['exports']=function(_0x4493cb,_0x3ba1b4){return _0x4493cb[_0xf69c('0x9')](_0xf69c('0xa'),attributes,{'tableName':_0xf69c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96e0=['exports','define','Trunk','tools_trunks','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./trunk.attributes'];(function(_0x4fcf8f,_0x440b92){var _0x22ee95=function(_0x1fb81f){while(--_0x1fb81f){_0x4fcf8f['push'](_0x4fcf8f['shift']());}};_0x22ee95(++_0x440b92);}(_0x96e0,0xad));var _0x096e=function(_0x5168fc,_0xc775d7){_0x5168fc=_0x5168fc-0x0;var _0x50ea7d=_0x96e0[_0x5168fc];return _0x50ea7d;};'use strict';var _=require('lodash');var util=require(_0x096e('0x0'));var logger=require(_0x096e('0x1'))(_0x096e('0x2'));var moment=require(_0x096e('0x3'));var BPromise=require(_0x096e('0x4'));var rp=require(_0x096e('0x5'));var fs=require('fs');var path=require(_0x096e('0x6'));var rimraf=require(_0x096e('0x7'));var config=require('../../config/environment');var attributes=require(_0x096e('0x8'));module[_0x096e('0x9')]=function(_0x3fdc9c,_0x44dd44){return _0x3fdc9c[_0x096e('0xa')](_0x096e('0xb'),attributes,{'tableName':_0x096e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index bea8bae..a3a6c49 100644 --- a/server/api/trunk/trunk.rpc.js +++ b/server/api/trunk/trunk.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14a0=['limit','include','model','map','find','ShowTrunk','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','info','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes'];(function(_0x58c3e4,_0x2d5a82){var _0x5ea6fb=function(_0x7f76a5){while(--_0x7f76a5){_0x58c3e4['push'](_0x58c3e4['shift']());}};_0x5ea6fb(++_0x2d5a82);}(_0x14a0,0x8e));var _0x014a=function(_0x4a63d3,_0x4b184f){_0x4a63d3=_0x4a63d3-0x0;var _0x5c40ce=_0x14a0[_0x4a63d3];return _0x5c40ce;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('Trunk,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('Trunk,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('Trunk,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});}exports[_0x014a('0x15')]=function(_0x12d339){var _0x61ec9f=this;return new Promise(function(_0x263b07,_0x16490a){return db[_0x014a('0x16')][_0x014a('0x17')]({'raw':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x12d339['options']?_0x12d339[_0x014a('0x18')][_0x014a('0x1a')]||null:null,'attributes':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'limit':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1c')]||null:null,'include':_0x12d339[_0x014a('0x18')]?_0x12d339['options'][_0x014a('0x1d')]?_['map'](_0x12d339[_0x014a('0x18')][_0x014a('0x1d')],function(_0x44d921){return{'model':db[_0x44d921[_0x014a('0x1e')]],'as':_0x44d921['as'],'attributes':_0x44d921[_0x014a('0x1b')],'include':_0x44d921[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x44d921[_0x014a('0x1d')],function(_0x165a42){return{'model':db[_0x165a42['model']],'as':_0x165a42['as'],'attributes':_0x165a42[_0x014a('0x1b')],'include':_0x165a42['include']?_[_0x014a('0x1f')](_0x165a42[_0x014a('0x1d')],function(_0x4f1c44){return{'model':db[_0x4f1c44['model']],'as':_0x4f1c44['as'],'attributes':_0x4f1c44[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x014a('0xa')](function(_0x143346){logger['info'](_0x014a('0x15'),_0x12d339);logger[_0x014a('0xb')]('GetTrunk',_0x12d339,JSON[_0x014a('0xd')](_0x143346));_0x263b07(_0x143346);})[_0x014a('0x14')](function(_0x496040){logger['error'](_0x014a('0x15'),_0x496040[_0x014a('0x11')],_0x12d339);_0x16490a(_0x61ec9f[_0x014a('0xe')](0x1f4,_0x496040[_0x014a('0x11')]));});});};exports['ShowTrunk']=function(_0x434038){var _0x147e7e=this;return new Promise(function(_0x15af07,_0x402d3b){return db[_0x014a('0x16')][_0x014a('0x20')]({'raw':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')]['where']||null:null,'attributes':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'include':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x434038['options'][_0x014a('0x1d')],function(_0x325b3c){return{'model':db[_0x325b3c['model']],'as':_0x325b3c['as'],'attributes':_0x325b3c[_0x014a('0x1b')],'include':_0x325b3c[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x325b3c[_0x014a('0x1d')],function(_0x329136){return{'model':db[_0x329136[_0x014a('0x1e')]],'as':_0x329136['as'],'attributes':_0x329136[_0x014a('0x1b')],'include':_0x329136[_0x014a('0x1d')]?_['map'](_0x329136[_0x014a('0x1d')],function(_0x1dfe6e){return{'model':db[_0x1dfe6e[_0x014a('0x1e')]],'as':_0x1dfe6e['as'],'attributes':_0x1dfe6e[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x427c7a){logger[_0x014a('0x12')](_0x014a('0x21'),_0x434038);logger[_0x014a('0xb')](_0x014a('0x21'),_0x434038,JSON[_0x014a('0xd')](_0x427c7a));_0x15af07(_0x427c7a);})[_0x014a('0x14')](function(_0x36187b){logger[_0x014a('0xe')]('ShowTrunk',_0x36187b[_0x014a('0x11')],_0x434038);_0x402d3b(_0x147e7e['error'](0x1f4,_0x36187b[_0x014a('0x11')]));});});}; \ No newline at end of file +var _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(_0x49b708,_0x512de6){var _0x3d098e=function(_0x175263){while(--_0x175263){_0x49b708['push'](_0x49b708['shift']());}};_0x3d098e(++_0x512de6);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'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 diff --git a/server/api/user/index.js b/server/api/user/index.js index 5f8d129..e03aa6e 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 _0x265b=['show','/:id/avatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','getVoicePrefixes','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','addContacts','post','create','/create_many','bulkCreate','addQueues','join','root','server/files/images/','format','now','originalname','single','addAvatar','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','/:id/whatsapp_accounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./user.controller','isAuthenticated','get','describe','/whoami','whoami','/:id'];(function(_0x394e2c,_0x2469a0){var _0x552353=function(_0x93c8eb){while(--_0x93c8eb){_0x394e2c['push'](_0x394e2c['shift']());}};_0x552353(++_0x2469a0);}(_0x265b,0x133));var _0xb265=function(_0x50a666,_0x5d49b1){_0x50a666=_0x50a666-0x0;var _0x2877ef=_0x265b[_0x50a666];return _0x2877ef;};'use strict';var multer=require(_0xb265('0x0'));var util=require(_0xb265('0x1'));var path=require(_0xb265('0x2'));var timeout=require(_0xb265('0x3'));var express=require(_0xb265('0x4'));var router=express['Router']();var auth=require(_0xb265('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb265('0x6'));var controller=require(_0xb265('0x7'));router['get']('/',auth[_0xb265('0x8')](),controller['index']);router[_0xb265('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xb265('0xa')]);router['get'](_0xb265('0xb'),auth[_0xb265('0x8')](),controller[_0xb265('0xc')]);router['get'](_0xb265('0xd'),auth[_0xb265('0x8')](),controller[_0xb265('0xe')]);router['get'](_0xb265('0xf'),controller['getAvatar']);router[_0xb265('0x9')](_0xb265('0x10'),auth[_0xb265('0x8')](),controller[_0xb265('0x11')]);router[_0xb265('0x9')](_0xb265('0x12'),auth[_0xb265('0x8')](),controller[_0xb265('0x13')]);router[_0xb265('0x9')](_0xb265('0x14'),auth[_0xb265('0x8')](),controller[_0xb265('0x15')]);router[_0xb265('0x9')](_0xb265('0x16'),auth['isAuthenticated'](),controller['getGroups']);router[_0xb265('0x9')](_0xb265('0x17'),auth[_0xb265('0x8')](),controller[_0xb265('0x18')]);router[_0xb265('0x9')]('/:id/screen_recordings',auth[_0xb265('0x8')](),controller['getScreenRecordings']);router[_0xb265('0x9')](_0xb265('0x19'),auth[_0xb265('0x8')](),controller[_0xb265('0x1a')]);router['get']('/:id/openchannel/interactions',auth[_0xb265('0x8')](),controller[_0xb265('0x1b')]);router[_0xb265('0x9')]('/:id/mail/interactions',auth['isAuthenticated'](),controller['getMailInteractions']);router[_0xb265('0x9')](_0xb265('0x1c'),auth['isAuthenticated'](),controller[_0xb265('0x1d')]);router[_0xb265('0x9')](_0xb265('0x1e'),auth[_0xb265('0x8')](),controller[_0xb265('0x1f')]);router[_0xb265('0x9')](_0xb265('0x20'),auth['isAuthenticated'](),controller[_0xb265('0x21')]);router[_0xb265('0x9')](_0xb265('0x22'),auth[_0xb265('0x8')](),controller[_0xb265('0x23')]);router[_0xb265('0x9')](_0xb265('0x24'),auth['isAuthenticated'](),controller[_0xb265('0x25')]);router[_0xb265('0x9')]('/:id/agents',auth['isAuthenticated'](),controller[_0xb265('0x26')]);router['get']('/:id/prefixes',auth[_0xb265('0x8')](),controller[_0xb265('0x27')]);router['get']('/:id/fax_accounts',auth['isAuthenticated'](),controller['getFaxAccounts']);router[_0xb265('0x9')](_0xb265('0x28'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0xb265('0x9')](_0xb265('0x29'),auth['isAuthenticated'](),controller[_0xb265('0x2a')]);router[_0xb265('0x9')]('/:id/sms_accounts',auth[_0xb265('0x8')](),controller[_0xb265('0x2b')]);router[_0xb265('0x9')](_0xb265('0x2c'),auth[_0xb265('0x8')](),controller['getChatWebsites']);router['get']('/:id/whatsapp_accounts',auth[_0xb265('0x8')](),controller[_0xb265('0x2d')]);router[_0xb265('0x9')](_0xb265('0x2e'),auth[_0xb265('0x8')](),controller[_0xb265('0x2f')]);router[_0xb265('0x9')](_0xb265('0x30'),auth['isAuthenticated'](),controller[_0xb265('0x31')]);router[_0xb265('0x9')](_0xb265('0x32'),auth[_0xb265('0x8')](),controller['getApiKey']);router['post'](_0xb265('0x10'),auth[_0xb265('0x8')](),controller[_0xb265('0x33')]);router[_0xb265('0x34')]('/',auth[_0xb265('0x8')](),controller[_0xb265('0x35')]);router[_0xb265('0x34')](_0xb265('0x36'),auth['isAuthenticated'](),controller[_0xb265('0x37')]);router['post']('/:id/queues',auth[_0xb265('0x8')](),controller[_0xb265('0x38')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3ccdc8,_0xd33b6d,_0x20277d){_0x20277d(null,path[_0xb265('0x39')](config[_0xb265('0x3a')],_0xb265('0x3b')));},'filename':function(_0x4d3d8a,_0x3e3459,_0x5ee1a1){_0x5ee1a1(null,util[_0xb265('0x3c')]('%s-%s',Date[_0xb265('0x3d')](),_0x3e3459[_0xb265('0x3e')]));}})});router[_0xb265('0x34')](_0xb265('0xf'),upload[_0xb265('0x3f')]('file'),controller[_0xb265('0x40')]);router[_0xb265('0x34')]('/:id/login',auth['isAuthenticated'](),controller['login']);router[_0xb265('0x34')](_0xb265('0x41'),auth[_0xb265('0x8')](),controller[_0xb265('0x42')]);router[_0xb265('0x34')](_0xb265('0x43'),auth[_0xb265('0x8')](),controller[_0xb265('0x44')]);router[_0xb265('0x34')](_0xb265('0x45'),auth[_0xb265('0x8')](),controller['unpause']);router[_0xb265('0x34')](_0xb265('0x22'),auth[_0xb265('0x8')](),controller[_0xb265('0x46')]);router[_0xb265('0x34')](_0xb265('0x47'),auth[_0xb265('0x8')](),controller[_0xb265('0x48')]);router[_0xb265('0x34')]('/:id/mail_interactions',auth[_0xb265('0x8')](),controller[_0xb265('0x49')]);router[_0xb265('0x34')](_0xb265('0x4a'),auth[_0xb265('0x8')](),controller['addFaxInteractions']);router[_0xb265('0x34')]('/:id/sms_interactions',auth[_0xb265('0x8')](),controller['addSmsInteractions']);router[_0xb265('0x34')](_0xb265('0x4b'),auth[_0xb265('0x8')](),controller[_0xb265('0x4c')]);router[_0xb265('0x34')](_0xb265('0x4d'),auth[_0xb265('0x8')](),controller[_0xb265('0x4e')]);router[_0xb265('0x34')]('/:id/fax_accounts',auth[_0xb265('0x8')](),controller[_0xb265('0x4f')]);router['post'](_0xb265('0x28'),auth[_0xb265('0x8')](),controller[_0xb265('0x50')]);router['post'](_0xb265('0x29'),auth[_0xb265('0x8')](),controller[_0xb265('0x51')]);router[_0xb265('0x34')]('/:id/sms_accounts',auth[_0xb265('0x8')](),controller[_0xb265('0x52')]);router['post'](_0xb265('0x2c'),auth['isAuthenticated'](),controller['addChatWebsites']);router['post']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xb265('0x53')]);router[_0xb265('0x34')](_0xb265('0x2e'),auth[_0xb265('0x8')](),controller[_0xb265('0x54')]);router[_0xb265('0x34')](_0xb265('0x32'),auth[_0xb265('0x8')](),controller[_0xb265('0x55')]);router[_0xb265('0x56')](_0xb265('0xd'),auth[_0xb265('0x8')](),controller[_0xb265('0x57')]);router['put'](_0xb265('0x58'),auth[_0xb265('0x8')](),controller[_0xb265('0x59')]);router[_0xb265('0x5a')](_0xb265('0x12'),auth[_0xb265('0x8')](),controller[_0xb265('0x5b')]);router[_0xb265('0x5a')](_0xb265('0x22'),auth[_0xb265('0x8')](),controller[_0xb265('0x5c')]);router['delete'](_0xb265('0xd'),auth[_0xb265('0x8')](),controller['destroy']);router[_0xb265('0x5a')](_0xb265('0x47'),auth[_0xb265('0x8')](),controller[_0xb265('0x5d')]);router[_0xb265('0x5a')]('/:id/mail_interactions',auth[_0xb265('0x8')](),controller[_0xb265('0x5e')]);router[_0xb265('0x5a')](_0xb265('0x4a'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0xb265('0x5a')](_0xb265('0x5f'),auth[_0xb265('0x8')](),controller[_0xb265('0x60')]);router[_0xb265('0x5a')](_0xb265('0x4b'),auth['isAuthenticated'](),controller[_0xb265('0x61')]);router['delete'](_0xb265('0x4d'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0xb265('0x5a')]('/:id/fax_accounts',auth[_0xb265('0x8')](),controller[_0xb265('0x62')]);router[_0xb265('0x5a')](_0xb265('0x28'),auth['isAuthenticated'](),controller[_0xb265('0x63')]);router[_0xb265('0x5a')](_0xb265('0x29'),auth[_0xb265('0x8')](),controller['removeOpenchannelAccounts']);router['delete']('/:id/sms_accounts',auth[_0xb265('0x8')](),controller[_0xb265('0x64')]);router[_0xb265('0x5a')](_0xb265('0x2c'),auth['isAuthenticated'](),controller[_0xb265('0x65')]);router['delete'](_0xb265('0x66'),auth[_0xb265('0x8')](),controller[_0xb265('0x67')]);router[_0xb265('0x5a')](_0xb265('0x2e'),auth['isAuthenticated'](),controller[_0xb265('0x68')]);router[_0xb265('0x5a')](_0xb265('0x32'),auth[_0xb265('0x8')](),controller[_0xb265('0x69')]);module[_0xb265('0x6a')]=router; \ No newline at end of file +var _0x1091=['/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','put','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','/whoami','whoami','/:id','show','getAvatar','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','create','bulkCreate','/:id/queues','addQueues','diskStorage','root','server/files/images/','format','%s-%s','now','/:id/avatar','addAvatar','/:id/login','logout','pause','/:id/unpause','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions'];(function(_0x41d432,_0x20e878){var _0x1650f9=function(_0x27f177){while(--_0x27f177){_0x41d432['push'](_0x41d432['shift']());}};_0x1650f9(++_0x20e878);}(_0x1091,0x1d6));var _0x1109=function(_0x3be499,_0xec870a){_0x3be499=_0x3be499-0x0;var _0x585479=_0x1091[_0x3be499];return _0x585479;};'use strict';var multer=require('multer');var util=require(_0x1109('0x0'));var path=require(_0x1109('0x1'));var timeout=require(_0x1109('0x2'));var express=require(_0x1109('0x3'));var router=express['Router']();var auth=require(_0x1109('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1109('0x5'));var controller=require(_0x1109('0x6'));router['get']('/',auth[_0x1109('0x7')](),controller[_0x1109('0x8')]);router[_0x1109('0x9')](_0x1109('0xa'),auth[_0x1109('0x7')](),controller['describe']);router['get'](_0x1109('0xb'),auth[_0x1109('0x7')](),controller[_0x1109('0xc')]);router[_0x1109('0x9')](_0x1109('0xd'),auth['isAuthenticated'](),controller[_0x1109('0xe')]);router[_0x1109('0x9')]('/:id/avatar',controller[_0x1109('0xf')]);router[_0x1109('0x9')](_0x1109('0x10'),auth['isAuthenticated'](),controller[_0x1109('0x11')]);router[_0x1109('0x9')]('/:id/queues',auth['isAuthenticated'](),controller[_0x1109('0x12')]);router[_0x1109('0x9')](_0x1109('0x13'),auth[_0x1109('0x7')](),controller[_0x1109('0x14')]);router[_0x1109('0x9')]('/:id/groups',auth['isAuthenticated'](),controller[_0x1109('0x15')]);router[_0x1109('0x9')](_0x1109('0x16'),auth[_0x1109('0x7')](),controller[_0x1109('0x17')]);router[_0x1109('0x9')](_0x1109('0x18'),auth[_0x1109('0x7')](),controller['getScreenRecordings']);router[_0x1109('0x9')](_0x1109('0x19'),auth['isAuthenticated'](),controller['getChatInteractions']);router['get'](_0x1109('0x1a'),auth[_0x1109('0x7')](),controller[_0x1109('0x1b')]);router[_0x1109('0x9')](_0x1109('0x1c'),auth[_0x1109('0x7')](),controller[_0x1109('0x1d')]);router[_0x1109('0x9')](_0x1109('0x1e'),auth['isAuthenticated'](),controller[_0x1109('0x1f')]);router[_0x1109('0x9')](_0x1109('0x20'),auth[_0x1109('0x7')](),controller[_0x1109('0x21')]);router[_0x1109('0x9')](_0x1109('0x22'),auth['isAuthenticated'](),controller[_0x1109('0x23')]);router[_0x1109('0x9')](_0x1109('0x24'),auth['isAuthenticated'](),controller['getTeams']);router[_0x1109('0x9')](_0x1109('0x25'),auth['isAuthenticated'](),controller[_0x1109('0x26')]);router['get']('/:id/agents',auth[_0x1109('0x7')](),controller[_0x1109('0x27')]);router['get'](_0x1109('0x28'),auth[_0x1109('0x7')](),controller[_0x1109('0x29')]);router[_0x1109('0x9')](_0x1109('0x2a'),auth['isAuthenticated'](),controller['getFaxAccounts']);router['get']('/:id/mail_accounts',auth[_0x1109('0x7')](),controller[_0x1109('0x2b')]);router[_0x1109('0x9')](_0x1109('0x2c'),auth[_0x1109('0x7')](),controller[_0x1109('0x2d')]);router[_0x1109('0x9')]('/:id/sms_accounts',auth[_0x1109('0x7')](),controller[_0x1109('0x2e')]);router[_0x1109('0x9')](_0x1109('0x2f'),auth['isAuthenticated'](),controller[_0x1109('0x30')]);router['get']('/:id/whatsapp_accounts',auth[_0x1109('0x7')](),controller[_0x1109('0x31')]);router['get'](_0x1109('0x32'),auth[_0x1109('0x7')](),controller[_0x1109('0x33')]);router['get'](_0x1109('0x34'),auth[_0x1109('0x7')](),controller[_0x1109('0x35')]);router[_0x1109('0x9')](_0x1109('0x36'),auth[_0x1109('0x7')](),controller['getApiKey']);router[_0x1109('0x37')](_0x1109('0x10'),auth[_0x1109('0x7')](),controller['addContacts']);router[_0x1109('0x37')]('/',auth['isAuthenticated'](),controller[_0x1109('0x38')]);router[_0x1109('0x37')]('/create_many',auth['isAuthenticated'](),controller[_0x1109('0x39')]);router[_0x1109('0x37')](_0x1109('0x3a'),auth[_0x1109('0x7')](),controller[_0x1109('0x3b')]);var upload=multer({'storage':multer[_0x1109('0x3c')]({'destination':function(_0x196cd3,_0x448e44,_0x5f19eb){_0x5f19eb(null,path['join'](config[_0x1109('0x3d')],_0x1109('0x3e')));},'filename':function(_0x5b759d,_0x487b7c,_0x5454f5){_0x5454f5(null,util[_0x1109('0x3f')](_0x1109('0x40'),Date[_0x1109('0x41')](),_0x487b7c['originalname']));}})});router[_0x1109('0x37')](_0x1109('0x42'),upload['single']('file'),controller[_0x1109('0x43')]);router['post'](_0x1109('0x44'),auth[_0x1109('0x7')](),controller['login']);router[_0x1109('0x37')]('/:id/logout',auth[_0x1109('0x7')](),controller[_0x1109('0x45')]);router[_0x1109('0x37')]('/:id/pause',auth[_0x1109('0x7')](),controller[_0x1109('0x46')]);router[_0x1109('0x37')](_0x1109('0x47'),auth['isAuthenticated'](),controller['unpause']);router[_0x1109('0x37')](_0x1109('0x24'),auth['isAuthenticated'](),controller['addTeams']);router[_0x1109('0x37')](_0x1109('0x48'),auth[_0x1109('0x7')](),controller['addChatInteractions']);router['post'](_0x1109('0x49'),auth[_0x1109('0x7')](),controller[_0x1109('0x4a')]);router[_0x1109('0x37')](_0x1109('0x4b'),auth[_0x1109('0x7')](),controller[_0x1109('0x4c')]);router['post'](_0x1109('0x4d'),auth[_0x1109('0x7')](),controller[_0x1109('0x4e')]);router[_0x1109('0x37')](_0x1109('0x4f'),auth['isAuthenticated'](),controller[_0x1109('0x50')]);router[_0x1109('0x37')](_0x1109('0x51'),auth[_0x1109('0x7')](),controller[_0x1109('0x52')]);router[_0x1109('0x37')]('/:id/fax_accounts',auth[_0x1109('0x7')](),controller[_0x1109('0x53')]);router[_0x1109('0x37')](_0x1109('0x54'),auth[_0x1109('0x7')](),controller[_0x1109('0x55')]);router[_0x1109('0x37')](_0x1109('0x2c'),auth[_0x1109('0x7')](),controller['addOpenchannelAccounts']);router[_0x1109('0x37')](_0x1109('0x56'),auth[_0x1109('0x7')](),controller[_0x1109('0x57')]);router['post']('/:id/chat_websites',auth[_0x1109('0x7')](),controller[_0x1109('0x58')]);router[_0x1109('0x37')](_0x1109('0x59'),auth[_0x1109('0x7')](),controller[_0x1109('0x5a')]);router[_0x1109('0x37')](_0x1109('0x32'),auth['isAuthenticated'](),controller['addSquareProjects']);router[_0x1109('0x37')](_0x1109('0x36'),auth['isAuthenticated'](),controller['createApiKey']);router[_0x1109('0x5b')](_0x1109('0xd'),auth[_0x1109('0x7')](),controller['update']);router['put'](_0x1109('0x5c'),auth[_0x1109('0x7')](),controller[_0x1109('0x5d')]);router['delete'](_0x1109('0x3a'),auth[_0x1109('0x7')](),controller[_0x1109('0x5e')]);router[_0x1109('0x5f')](_0x1109('0x24'),auth[_0x1109('0x7')](),controller[_0x1109('0x60')]);router[_0x1109('0x5f')](_0x1109('0xd'),auth[_0x1109('0x7')](),controller[_0x1109('0x61')]);router['delete'](_0x1109('0x48'),auth[_0x1109('0x7')](),controller[_0x1109('0x62')]);router[_0x1109('0x5f')](_0x1109('0x49'),auth[_0x1109('0x7')](),controller[_0x1109('0x63')]);router[_0x1109('0x5f')](_0x1109('0x4b'),auth['isAuthenticated'](),controller[_0x1109('0x64')]);router['delete']('/:id/sms_interactions',auth[_0x1109('0x7')](),controller['removeSmsInteractions']);router['delete'](_0x1109('0x4f'),auth[_0x1109('0x7')](),controller[_0x1109('0x65')]);router[_0x1109('0x5f')](_0x1109('0x51'),auth['isAuthenticated'](),controller[_0x1109('0x66')]);router[_0x1109('0x5f')](_0x1109('0x2a'),auth[_0x1109('0x7')](),controller['removeFaxAccounts']);router['delete']('/:id/mail_accounts',auth[_0x1109('0x7')](),controller[_0x1109('0x67')]);router[_0x1109('0x5f')]('/:id/openchannel_accounts',auth[_0x1109('0x7')](),controller[_0x1109('0x68')]);router[_0x1109('0x5f')]('/:id/sms_accounts',auth[_0x1109('0x7')](),controller['removeSmsAccounts']);router[_0x1109('0x5f')](_0x1109('0x2f'),auth[_0x1109('0x7')](),controller[_0x1109('0x69')]);router[_0x1109('0x5f')](_0x1109('0x59'),auth['isAuthenticated'](),controller[_0x1109('0x6a')]);router[_0x1109('0x5f')](_0x1109('0x32'),auth[_0x1109('0x7')](),controller[_0x1109('0x6b')]);router[_0x1109('0x5f')](_0x1109('0x36'),auth[_0x1109('0x7')](),controller['removeApiKey']);module[_0x1109('0x6c')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index a0fa96e..9f62d44 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 _0x3882=['transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','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','originate','uac','uas','fingerprint','certificate','active','actpass','update,nonat','get','isArray','wss','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','sequelize','moment','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','callerid','format','getDataValue','internal','email','ENUM','admin','agent','local','INTEGER','accountcode','fullname','BOOLEAN','DATE','dynamic','user','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join'];(function(_0x531be7,_0x20e028){var _0x2a513f=function(_0x5ebf22){while(--_0x5ebf22){_0x531be7['push'](_0x531be7['shift']());}};_0x2a513f(++_0x20e028);}(_0x3882,0x12a));var _0x2388=function(_0x104553,_0x32a3c0){_0x104553=_0x104553-0x0;var _0x3faae0=_0x3882[_0x104553];return _0x3faae0;};'use strict';var Sequelize=require(_0x2388('0x0'));var moment=require(_0x2388('0x1'));var util=require('util');var _=require(_0x2388('0x2'));module[_0x2388('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2388('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4f17a4){this[_0x2388('0x5')](_0x2388('0x4'),_0x4f17a4);this['setDataValue'](_0x2388('0x6'),_0x4f17a4);},'comment':_0x2388('0x7')},'fullname':{'type':Sequelize[_0x2388('0x8')],'allowNull':![],'set':function(_0x2d8bbf){this[_0x2388('0x5')]('fullname',_0x2d8bbf);this['setDataValue'](_0x2388('0x9'),util[_0x2388('0xa')]('\x22%s\x22\x20<%s>',_0x2d8bbf,this[_0x2388('0xb')](_0x2388('0xc'))));}},'alias':{'type':Sequelize[_0x2388('0x8')]},'email':{'type':Sequelize[_0x2388('0x8')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0xeaece){if(_0xeaece){this[_0x2388('0x5')](_0x2388('0xd'),_0xeaece['toLowerCase']());}}},'role':{'type':Sequelize[_0x2388('0xe')](_0x2388('0xf'),'user',_0x2388('0x10'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x2388('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x2388('0x11')},'internal':{'type':Sequelize[_0x2388('0x12')](0xb),'allowNull':![],'unique':_0x2388('0xc'),'set':function(_0x24448b){this['setDataValue']('internal',_0x24448b);this[_0x2388('0x5')](_0x2388('0x13'),_0x24448b);this['setDataValue'](_0x2388('0x9'),util[_0x2388('0xa')]('\x22%s\x22\x20<%s>',this[_0x2388('0xb')](_0x2388('0x14')),_0x24448b));}},'salt':{'type':Sequelize[_0x2388('0x8')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x2388('0x8')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x2388('0x8')]},'userpic':{'type':Sequelize[_0x2388('0x8')]},'city':{'type':Sequelize[_0x2388('0x8')]},'country':{'type':Sequelize[_0x2388('0x8')]},'online':{'type':Sequelize[_0x2388('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x2388('0x16')]},'voicePause':{'type':Sequelize[_0x2388('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x2388('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x2388('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x2388('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x2388('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x2388('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x2388('0x8')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x2388('0x16')]},'chatCapacity':{'type':Sequelize[_0x2388('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x2388('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x2388('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x2388('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x2388('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x2388('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x2388('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x2388('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x2388('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x2388('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'host':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![],'defaultValue':_0x2388('0x17')},'ipaddr':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x2388('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x2388('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x2388('0xe')]('friend',_0x2388('0x18'),'peer'),'allowNull':!![],'defaultValue':_0x2388('0x19')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize['ENUM'](_0x2388('0x1a'),_0x2388('0x1b'),'ALLOWED_FAILED_SCREEN',_0x2388('0x1c'),_0x2388('0x1d'),_0x2388('0x1e'),_0x2388('0x1f'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'secret':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'transport':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![],'defaultValue':_0x2388('0x20'),'set':function(_0x34056a){this[_0x2388('0x5')]('transport',_0x34056a?_0x34056a[_0x2388('0x21')](','):null);},'get':function(){return this[_0x2388('0xb')](_0x2388('0x22'))?this['getDataValue'](_0x2388('0x22'))[_0x2388('0x23')](','):null;},'comment':_0x2388('0x24')},'dtmfmode':{'type':Sequelize[_0x2388('0xe')](_0x2388('0x25'),'info',_0x2388('0x26'),_0x2388('0x27'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x2388('0xe')](_0x2388('0x28'),'no',_0x2388('0x29'),_0x2388('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2388('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2388('0x2b'),'set':function(_0x3ef6e2){this[_0x2388('0x5')]('nat',_0x3ef6e2?_0x3ef6e2['join'](','):null);},'get':function(){return this[_0x2388('0xb')](_0x2388('0x2c'))?this['getDataValue'](_0x2388('0x2c'))[_0x2388('0x23')](','):null;},'comment':_0x2388('0x2d')},'callgroup':{'type':Sequelize[_0x2388('0x8')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x2388('0x8')]},'language':{'type':Sequelize[_0x2388('0x8')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2388('0x8')]},'disallow':{'type':Sequelize[_0x2388('0x8')],'allowNull':![],'defaultValue':_0x2388('0x2e')},'allow':{'type':Sequelize[_0x2388('0x8')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4cb5d7){this[_0x2388('0x5')](_0x2388('0x2f'),_0x4cb5d7?_0x4cb5d7[_0x2388('0x21')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x2388('0x2f'))?this[_0x2388('0xb')](_0x2388('0x2f'))[_0x2388('0x23')](';'):null;},'comment':_0x2388('0x30')},'autoframing':{'type':Sequelize[_0x2388('0xe')](_0x2388('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![],'set':function(_0x1c6010){this[_0x2388('0x5')](_0x2388('0x31'),_0x1c6010?_0x1c6010[_0x2388('0x21')](','):null);},'get':function(){return this[_0x2388('0xb')]('insecure')?this['getDataValue'](_0x2388('0x31'))[_0x2388('0x23')](','):null;},'comment':_0x2388('0x32')},'trustrpid':{'type':Sequelize[_0x2388('0xe')](_0x2388('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2388('0xe')](_0x2388('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2388('0xe')](_0x2388('0x28'),'no',_0x2388('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x2388('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x2388('0xe')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x2388('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x2388('0xe')](_0x2388('0x28'),'no'),'allowNull':!![],'defaultValue':_0x2388('0x28')},'busylevel':{'type':Sequelize[_0x2388('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x2388('0xe')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x2388('0xe')](_0x2388('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x2388('0xe')](_0x2388('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x2388('0xe')](_0x2388('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'template':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x2388('0xe')](_0x2388('0x28'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x2388('0xe')](_0x2388('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x2388('0xe')](_0x2388('0x34'),'refuse',_0x2388('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x2388('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x2388('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x2388('0xe')](_0x2388('0x36'),_0x2388('0x37')),'allowNull':!![],'defaultValue':_0x2388('0x37')},'t38pt_usertpsource':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x2388('0xe')]('yes','no'),'allowNull':!![],'defaultValue':_0x2388('0x28')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x2388('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x2388('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x2388('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x2388('0xe')](_0x2388('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x2388('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x2388('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x2388('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x2388('0xe')](_0x2388('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x2388('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x2388('0xe')](_0x2388('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x2388('0xe')](_0x2388('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x2388('0x38'),_0x2388('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x2388('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x2388('0x3a'),'passive',_0x2388('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x2388('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x2388('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x2388('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x2388('0xe')](_0x2388('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x2388('0xe')]('yes','no',_0x2388('0x29'),_0x2388('0x2a'),_0x2388('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x2388('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x2388('0x8')]},'resetPasswordExpires':{'type':Sequelize[_0x2388('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize['STRING']},'showWebBar':{'type':Sequelize[_0x2388('0x12')],'defaultValue':0x0,'set':function(_0x5470c9){this[_0x2388('0x5')]('showWebBar',_0x5470c9);var _0x359ebe=this[_0x2388('0x3d')]({'plain':!![]});switch(_0x5470c9){case 0x0:case 0x1:var _0x461d5c=_0x359ebe[_0x2388('0x22')]?_[_0x2388('0x3e')](_0x359ebe[_0x2388('0x22')])?_0x359ebe['transport']['join']():_0x359ebe[_0x2388('0x22')]:_0x2388('0x20');if(_0x461d5c===_0x2388('0x3f')){_0x461d5c=_0x2388('0x20');}this['setDataValue']('transport',_0x461d5c);this[_0x2388('0x5')]('encryption','no');this['setDataValue'](_0x2388('0x40'),null);this[_0x2388('0x5')]('force_avp',null);this['setDataValue'](_0x2388('0x41'),null);this['setDataValue'](_0x2388('0x42'),null);this[_0x2388('0x5')](_0x2388('0x43'),null);this[_0x2388('0x5')](_0x2388('0x44'),null);this[_0x2388('0x5')](_0x2388('0x45'),null);this[_0x2388('0x5')](_0x2388('0x46'),null);this['setDataValue'](_0x2388('0x47'),'no');break;case 0x2:this[_0x2388('0x5')]('transport',_0x2388('0x3f'));this['setDataValue']('encryption','yes');this['setDataValue'](_0x2388('0x40'),_0x2388('0x28'));this[_0x2388('0x5')](_0x2388('0x48'),_0x2388('0x28'));this[_0x2388('0x5')]('icesupport',_0x2388('0x28'));this[_0x2388('0x5')](_0x2388('0x42'),'yes');this[_0x2388('0x5')]('dtlsverify','no');this[_0x2388('0x5')]('dtlssetup','actpass');this['setDataValue'](_0x2388('0x45'),_0x359ebe[_0x2388('0x45')]||_0x2388('0x49'));this[_0x2388('0x5')](_0x2388('0x46'),_0x359ebe[_0x2388('0x46')]||_0x2388('0x4a'));this[_0x2388('0x5')]('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0x2388('0x4b')],'set':function(_0x1159c3){this[_0x2388('0x5')](_0x2388('0x4c'),_0x1159c3?_0x1159c3[_0x2388('0x21')](','):[]);},'get':function(){return this[_0x2388('0xb')]('permissions')?_['map'](this[_0x2388('0xb')](_0x2388('0x4c'))[_0x2388('0x23')](','),function(_0x84d562){return parseInt(_0x84d562,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x2388('0x8')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x2388('0x8')]},'phoneBarUnconditional':{'type':Sequelize[_0x2388('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x2388('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x2388('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x2388('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x2388('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x2388('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x2388('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x2388('0x8')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x2388('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x2388('0xe')](_0x2388('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x2388('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x2388('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x2388('0xb')](_0x2388('0x4d'))?this['getDataValue'](_0x2388('0x4d')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x2388('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x2388('0x8')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x2388('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x2388('0x8')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x2388('0x15')],'defaultValue':![],'set':function(_0x168ede){if(typeof _0x168ede==='string'){var _0x38c9ff=_0x168ede==='1'?!![]:_0x168ede==='0'?![]:_0x168ede===_0x2388('0x4e')?!![]:_0x168ede===_0x2388('0x4f')?![]:![];this[_0x2388('0x5')](_0x2388('0x50'),_0x38c9ff);}else{this[_0x2388('0x5')](_0x2388('0x50'),_0x168ede);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x47211f){this['setDataValue'](_0x2388('0x51'),_0x47211f);if(_0x47211f===!![]){this['setDataValue'](_0x2388('0x52'),moment());this[_0x2388('0x5')]('loginAttempts',0x0);}else{this[_0x2388('0x5')](_0x2388('0x52'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x2388('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x2388('0x15')],'defaultValue':!![]}}; \ No newline at end of file +var _0xbebb=['force_avp','icesupport','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','avpf','dtlsenable','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','sequelize','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','\x22%s\x22\x20<%s>','email','toLowerCase','ENUM','admin','user','agent','local','INTEGER','internal','accountcode','format','getDataValue','fullname','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','join','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','refuse','originate','uac','uas','fingerprint','certificate','passive','actpass','update,nonat','showWebBar','get','wss','encryption'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xbebb,0x18e));var _0xbbeb=function(_0x58f32f,_0x44dd85){_0x58f32f=_0x58f32f-0x0;var _0x20185b=_0xbebb[_0x58f32f];return _0x20185b;};'use strict';var Sequelize=require(_0xbbeb('0x0'));var moment=require('moment');var util=require(_0xbbeb('0x1'));var _=require(_0xbbeb('0x2'));module[_0xbbeb('0x3')]={'name':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':![],'unique':_0xbbeb('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5c4e7a){this[_0xbbeb('0x6')](_0xbbeb('0x5'),_0x5c4e7a);this[_0xbbeb('0x6')](_0xbbeb('0x7'),_0x5c4e7a);},'comment':_0xbbeb('0x8')},'fullname':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':![],'set':function(_0x358e16){this[_0xbbeb('0x6')]('fullname',_0x358e16);this[_0xbbeb('0x6')](_0xbbeb('0x9'),util['format'](_0xbbeb('0xa'),_0x358e16,this['getDataValue']('internal')));}},'alias':{'type':Sequelize[_0xbbeb('0x4')]},'email':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':![],'unique':_0xbbeb('0xb'),'validate':{'isEmail':!![]},'set':function(_0x3228f2){if(_0x3228f2){this[_0xbbeb('0x6')](_0xbbeb('0xb'),_0x3228f2[_0xbbeb('0xc')]());}}},'role':{'type':Sequelize[_0xbbeb('0xd')](_0xbbeb('0xe'),_0xbbeb('0xf'),_0xbbeb('0x10'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xbbeb('0x4')],'defaultValue':_0xbbeb('0x11')},'internal':{'type':Sequelize[_0xbbeb('0x12')](0xb),'allowNull':![],'unique':_0xbbeb('0x13'),'set':function(_0x3b66af){this['setDataValue'](_0xbbeb('0x13'),_0x3b66af);this[_0xbbeb('0x6')](_0xbbeb('0x14'),_0x3b66af);this[_0xbbeb('0x6')](_0xbbeb('0x9'),util[_0xbbeb('0x15')]('\x22%s\x22\x20<%s>',this[_0xbbeb('0x16')](_0xbbeb('0x17')),_0x3b66af));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xbbeb('0x4')]},'mobile':{'type':Sequelize[_0xbbeb('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xbbeb('0x4')]},'userpic':{'type':Sequelize[_0xbbeb('0x4')]},'city':{'type':Sequelize[_0xbbeb('0x4')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xbbeb('0x18')]},'voicePause':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xbbeb('0x4')],'defaultValue':_0xbbeb('0x1a')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xbbeb('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xbbeb('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xbbeb('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xbbeb('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xbbeb('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xbbeb('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xbbeb('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xbbeb('0x1b')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xbbeb('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xbbeb('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xbbeb('0xd')](_0xbbeb('0x1c'),'user','peer'),'allowNull':!![],'defaultValue':_0xbbeb('0x1c')},'context':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![],'defaultValue':_0xbbeb('0x1d')},'callingpres':{'type':Sequelize[_0xbbeb('0xd')](_0xbbeb('0x1e'),_0xbbeb('0x1f'),_0xbbeb('0x20'),_0xbbeb('0x21'),'PROHIB_NOT_SCREENED',_0xbbeb('0x22'),_0xbbeb('0x23'),_0xbbeb('0x24')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![],'defaultValue':_0xbbeb('0x25'),'set':function(_0x24199b){this[_0xbbeb('0x6')]('transport',_0x24199b?_0x24199b['join'](','):null);},'get':function(){return this['getDataValue'](_0xbbeb('0x26'))?this[_0xbbeb('0x16')](_0xbbeb('0x26'))[_0xbbeb('0x27')](','):null;},'comment':_0xbbeb('0x28')},'dtmfmode':{'type':Sequelize['ENUM'](_0xbbeb('0x29'),_0xbbeb('0x2a'),_0xbbeb('0x2b'),_0xbbeb('0x2c'),_0xbbeb('0x2d')),'allowNull':!![],'defaultValue':_0xbbeb('0x29')},'directmedia':{'type':Sequelize['ENUM'](_0xbbeb('0x2e'),'no',_0xbbeb('0x2f'),_0xbbeb('0x30'),_0xbbeb('0x31')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xbbeb('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![],'defaultValue':_0xbbeb('0x32'),'set':function(_0x3e0272){this[_0xbbeb('0x6')](_0xbbeb('0x33'),_0x3e0272?_0x3e0272[_0xbbeb('0x34')](','):null);},'get':function(){return this[_0xbbeb('0x16')](_0xbbeb('0x33'))?this['getDataValue']('nat')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xbbeb('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xbbeb('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xbbeb('0x4')]},'language':{'type':Sequelize[_0xbbeb('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xbbeb('0x4')]},'disallow':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':![],'defaultValue':_0xbbeb('0x35')},'allow':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':![],'defaultValue':_0xbbeb('0x36'),'set':function(_0x4f1e53){this[_0xbbeb('0x6')]('allow',_0x4f1e53?_0x4f1e53['join'](';'):_0xbbeb('0x36'));},'get':function(){return this[_0xbbeb('0x16')](_0xbbeb('0x37'))?this[_0xbbeb('0x16')](_0xbbeb('0x37'))[_0xbbeb('0x27')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xbbeb('0xd')](_0xbbeb('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x274d85){this['setDataValue'](_0xbbeb('0x38'),_0x274d85?_0x274d85[_0xbbeb('0x34')](','):null);},'get':function(){return this['getDataValue'](_0xbbeb('0x38'))?this[_0xbbeb('0x16')]('insecure')['split'](','):null;},'comment':_0xbbeb('0x39')},'trustrpid':{'type':Sequelize[_0xbbeb('0xd')](_0xbbeb('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xbbeb('0xd')](_0xbbeb('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xbbeb('0xd')](_0xbbeb('0x2e'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xbbeb('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xbbeb('0xd')](_0xbbeb('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xbbeb('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![],'defaultValue':_0xbbeb('0x3a')},'amaflags':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xbbeb('0xd')]('yes','no'),'allowNull':!![],'defaultValue':_0xbbeb('0x2e')},'busylevel':{'type':Sequelize[_0xbbeb('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xbbeb('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xbbeb('0xd')](_0xbbeb('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xbbeb('0xd')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xbbeb('0x2e'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xbbeb('0xd')](_0xbbeb('0x2e'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xbbeb('0xd')]('accept',_0xbbeb('0x3b'),_0xbbeb('0x3c')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xbbeb('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xbbeb('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xbbeb('0xd')](_0xbbeb('0x3d'),_0xbbeb('0x3e')),'allowNull':!![],'defaultValue':_0xbbeb('0x3e')},'t38pt_usertpsource':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xbbeb('0xd')](_0xbbeb('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xbbeb('0x2e')},'keepalive':{'type':Sequelize[_0xbbeb('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xbbeb('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xbbeb('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xbbeb('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xbbeb('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xbbeb('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xbbeb('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xbbeb('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xbbeb('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xbbeb('0xd')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xbbeb('0xd')](_0xbbeb('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xbbeb('0xd')](_0xbbeb('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xbbeb('0x2e'),'no',_0xbbeb('0x3f'),_0xbbeb('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xbbeb('0x41'),_0xbbeb('0x42')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xbbeb('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xbbeb('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xbbeb('0xd')](_0xbbeb('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xbbeb('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xbbeb('0xd')]('yes','no',_0xbbeb('0x2f'),_0xbbeb('0x30'),_0xbbeb('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xbbeb('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xbbeb('0x18')]},'passwordResetAt':{'type':Sequelize[_0xbbeb('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xbbeb('0x4')]},'showWebBar':{'type':Sequelize[_0xbbeb('0x12')],'defaultValue':0x0,'set':function(_0x4a31cd){this[_0xbbeb('0x6')](_0xbbeb('0x44'),_0x4a31cd);var _0x39d546=this[_0xbbeb('0x45')]({'plain':!![]});switch(_0x4a31cd){case 0x0:case 0x1:var _0xada85=_0x39d546[_0xbbeb('0x26')]?_['isArray'](_0x39d546['transport'])?_0x39d546[_0xbbeb('0x26')][_0xbbeb('0x34')]():_0x39d546[_0xbbeb('0x26')]:_0xbbeb('0x25');if(_0xada85===_0xbbeb('0x46')){_0xada85=_0xbbeb('0x25');}this[_0xbbeb('0x6')](_0xbbeb('0x26'),_0xada85);this['setDataValue'](_0xbbeb('0x47'),'no');this['setDataValue']('avpf',null);this[_0xbbeb('0x6')](_0xbbeb('0x48'),null);this[_0xbbeb('0x6')](_0xbbeb('0x49'),null);this[_0xbbeb('0x6')]('dtlsenable',null);this['setDataValue'](_0xbbeb('0x4a'),null);this[_0xbbeb('0x6')]('dtlssetup',null);this[_0xbbeb('0x6')](_0xbbeb('0x4b'),null);this[_0xbbeb('0x6')](_0xbbeb('0x4c'),null);this[_0xbbeb('0x6')](_0xbbeb('0x4d'),'no');break;case 0x2:this[_0xbbeb('0x6')]('transport','wss');this[_0xbbeb('0x6')](_0xbbeb('0x47'),_0xbbeb('0x2e'));this['setDataValue'](_0xbbeb('0x4e'),_0xbbeb('0x2e'));this[_0xbbeb('0x6')](_0xbbeb('0x48'),_0xbbeb('0x2e'));this[_0xbbeb('0x6')]('icesupport','yes');this[_0xbbeb('0x6')](_0xbbeb('0x4f'),_0xbbeb('0x2e'));this[_0xbbeb('0x6')](_0xbbeb('0x4a'),'no');this[_0xbbeb('0x6')](_0xbbeb('0x50'),_0xbbeb('0x42'));this['setDataValue'](_0xbbeb('0x4b'),_0x39d546['dtlscertfile']||_0xbbeb('0x51'));this[_0xbbeb('0x6')](_0xbbeb('0x4c'),_0x39d546[_0xbbeb('0x4c')]||_0xbbeb('0x52'));this['setDataValue'](_0xbbeb('0x4d'),_0xbbeb('0x2e'));break;default:}}},'permissions':{'type':Sequelize[_0xbbeb('0x53')],'set':function(_0x1b46d0){this[_0xbbeb('0x6')](_0xbbeb('0x54'),_0x1b46d0?_0x1b46d0[_0xbbeb('0x34')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_[_0xbbeb('0x55')](this[_0xbbeb('0x16')](_0xbbeb('0x54'))['split'](','),function(_0x2e3376){return parseInt(_0x2e3376,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xbbeb('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xbbeb('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0xbbeb('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xbbeb('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xbbeb('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xbbeb('0xd')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xbbeb('0x56')],'get':function(){return this['getDataValue'](_0xbbeb('0x57'))?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![]},'interface':{'type':Sequelize[_0xbbeb('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xbbeb('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![],'set':function(_0x3822b1){if(typeof _0x3822b1===_0xbbeb('0x58')){var _0x43ecbe=_0x3822b1==='1'?!![]:_0x3822b1==='0'?![]:_0x3822b1===_0xbbeb('0x59')?!![]:_0x3822b1===_0xbbeb('0x5a')?![]:![];this['setDataValue'](_0xbbeb('0x5b'),_0x43ecbe);}else{this[_0xbbeb('0x6')]('screenrecording',_0x3822b1);}}},'blocked':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':![],'set':function(_0x4c6bfa){this[_0xbbeb('0x6')](_0xbbeb('0x5c'),_0x4c6bfa);if(_0x4c6bfa===!![]){this[_0xbbeb('0x6')]('blockedAt',moment());this[_0xbbeb('0x6')]('loginAttempts',0x0);}else{this['setDataValue'](_0xbbeb('0x5d'),null);}}},'blockedAt':{'type':Sequelize[_0xbbeb('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xbbeb('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xbbeb('0x19')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index c83ada4..33fcc47 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 _0xbbe5=['QueryTypes','length','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','103','110','104','105','107','108','109','114','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','autoAssociation','bulkCreate','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','all','push','each','some','telephone','UserProfileSection','Telephones','isEmpty','compact','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','channel','loginInPause','voicePause','interface','Unknown\x20channel','add','Queues','penalty','spread','capitalize','toLowerCase','emit','Queue:save','voice','VoiceQueue','online','SIP/%s','removeQueues','isValidChannel','remove','QueueId','Queue:remove','UserVoiceQueueRt','userpic','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','server/files/images/','pick','getContacts','List','Tags','color','tag','hasOwnProperty','nolimit','findOne','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','FaxInteraction','getFaxInteractions','WhatsappInteraction','getWhatsappInteractions','login','mobile','format','LOCAL/%s@from-sip/n','intrf','headers','x-forwarded-for','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','LOGININPAUSE','concat','isMiddleware','resolve','logout','pause','PAUSE','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','QueuePause','manual','mail','fax','sms','openchannel','set','getTeams','Team','addTeams','setDataValue','Voice','getChatQueues','Chat','getMailQueues','getSmsQueues','Sms','getWhatsappQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','removeTeams','Mail','Whatsapp','removeAgent','getLists','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','omit','user_has_chat_interactions:save','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','$and','$or','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$contains','$contained','$any','CmHopper','firstName','lastName','phone','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','html-pdf','eml-format','rimraf','request-promise','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','register','jayson/promise','client','http','request','then','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','User,\x20%s,\x20%s','message','info','result','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','get','role','admin','Users','user','Agents','agent','filter','ignore','map','value','includes','find','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','type','key','model','differenceBy','password','salt','keys','query','attributes','fields','order','sort','filters','where','merge','sequelize','lower','col','options','User','findAll','rows','catch','params','filtears','intersection','includeAll','include','body','describe','addContacts','ids','internal','Setting','securePassword','validatePasswordPattern','max','isNil','min_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)'];(function(_0x46651c,_0x3f5512){var _0x1cdafb=function(_0x1e532a){while(--_0x1e532a){_0x46651c['push'](_0x46651c['shift']());}};_0x1cdafb(++_0x3f5512);}(_0xbbe5,0x10e));var _0x5bbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbe5[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x5bbe('0x0'));var emlformat=require(_0x5bbe('0x1'));var rimraf=require(_0x5bbe('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5bbe('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5bbe('0x4'));var path=require(_0x5bbe('0x5'));var sox=require('sox');var csv=require(_0x5bbe('0x6'));var ejs=require(_0x5bbe('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5bbe('0x8'));var crypto=require(_0x5bbe('0x9'));var jsforce=require(_0x5bbe('0xa'));var deskjs=require(_0x5bbe('0xb'));var toCsv=require(_0x5bbe('0x6'));var querystring=require(_0x5bbe('0xc'));var Papa=require(_0x5bbe('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5bbe('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bbe('0xf'));var logger=require(_0x5bbe('0x10'))(_0x5bbe('0x11'));var utils=require('../../config/utils');var config=require(_0x5bbe('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5bbe('0x13')]=_[_0x5bbe('0x14')](config[_0x5bbe('0x13')],{'host':_0x5bbe('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5bbe('0x13')]));require('./user.socket')[_0x5bbe('0x16')](socket);var jayson=require(_0x5bbe('0x17'));var client=jayson[_0x5bbe('0x18')][_0x5bbe('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x39c4a5,_0x3bff89,_0x15d6b1,_0x33885d){return new BPromise(function(_0x1869d8,_0x5db988){var _0x4d1687=_0x33885d||client;return _0x4d1687[_0x5bbe('0x1a')](_0x39c4a5,_0x15d6b1)[_0x5bbe('0x1b')](function(_0x31e512){logger['info']('User,\x20%s,\x20%s',_0x3bff89,_0x5bbe('0x1c'));logger[_0x5bbe('0x1d')](_0x5bbe('0x1e'),_0x3bff89,_0x5bbe('0x1c'),JSON[_0x5bbe('0x1f')](_0x31e512));if(_0x31e512[_0x5bbe('0x20')]){if(_0x31e512[_0x5bbe('0x20')][_0x5bbe('0x21')]===0x1f4){logger[_0x5bbe('0x20')](_0x5bbe('0x22'),_0x3bff89,_0x31e512['error'][_0x5bbe('0x23')]);return _0x5db988(_0x31e512[_0x5bbe('0x20')][_0x5bbe('0x23')]);}logger[_0x5bbe('0x20')](_0x5bbe('0x22'),_0x3bff89,_0x31e512['error']['message']);return _0x1869d8(_0x31e512[_0x5bbe('0x20')][_0x5bbe('0x23')]);}else{logger[_0x5bbe('0x24')]('User,\x20%s,\x20%s',_0x3bff89,_0x5bbe('0x1c'));_0x1869d8(_0x31e512[_0x5bbe('0x25')]['message']);}})['catch'](function(_0x427f8c){logger[_0x5bbe('0x20')](_0x5bbe('0x22'),_0x3bff89,_0x427f8c);_0x5db988(_0x427f8c);});});}function respondWithStatusCode(_0x94b3a7,_0x16bbad){_0x16bbad=_0x16bbad||0xcc;return function(_0x167f5e){if(_0x167f5e){return _0x94b3a7[_0x5bbe('0x26')](_0x16bbad);}return _0x94b3a7[_0x5bbe('0x27')](_0x16bbad)[_0x5bbe('0x28')]();};}function respondWithResult(_0x491e66,_0x15bc78){_0x15bc78=_0x15bc78||0xc8;return function(_0x1649fe){if(_0x1649fe){return _0x491e66[_0x5bbe('0x27')](_0x15bc78)[_0x5bbe('0x29')](_0x1649fe);}};}function respondWithFilteredResult(_0xfb2b4d,_0x2f454d){return function(_0x3ec138){if(_0x3ec138){var _0x2daa4f=_0x3ec138[_0x5bbe('0x2a')],_0x306363=_0x2f454d[_0x5bbe('0x2b')],_0x54c58c=_0x2f454d[_0x5bbe('0x2b')]+_0x2f454d[_0x5bbe('0x2c')],_0x4ff36e;if(_0x54c58c>=_0x2daa4f){_0x54c58c=_0x2daa4f;_0x4ff36e=0xc8;}else{_0x4ff36e=0xce;}_0xfb2b4d[_0x5bbe('0x27')](_0x4ff36e);return _0xfb2b4d['set'](_0x5bbe('0x2d'),_0x306363+'-'+_0x54c58c+'/'+_0x2daa4f)['json'](_0x3ec138);}return null;};}function patchUpdates(_0x523cdc){return function(_0x4fd633){try{jsonpatch[_0x5bbe('0x2e')](_0x4fd633,_0x523cdc,!![]);}catch(_0x238480){return BPromise[_0x5bbe('0x2f')](_0x238480);}return _0x4fd633['save']();};}function saveUpdates(_0xc9e80c,_0x46797f){return function(_0x24168c){if(_0x24168c){return _0x24168c[_0x5bbe('0x30')](_0xc9e80c)[_0x5bbe('0x1b')](function(_0x6a7d61){return _0x6a7d61;});}return null;};}function removeEntity(_0x555ee5,_0x197425){return function(_0x511f0b){if(_0x511f0b){return _0x511f0b[_0x5bbe('0x31')]()[_0x5bbe('0x1b')](function(){var _0x20fd89=_0x511f0b[_0x5bbe('0x32')]({'plain':!![]});if(_0x20fd89[_0x5bbe('0x33')]===_0x5bbe('0x34'))return;var _0x199b93=[{'name':_0x5bbe('0x35'),'value':_0x5bbe('0x36'),'ignore':!![]},{'name':_0x5bbe('0x37'),'value':_0x5bbe('0x38'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x2e899b=_(_0x199b93)[_0x5bbe('0x39')](_0x5bbe('0x3a'))[_0x5bbe('0x3b')](_0x5bbe('0x3c'))[_0x5bbe('0x3c')]();if(_[_0x5bbe('0x3d')](_0x2e899b,_0x20fd89['role'])){return;}var _0x5e34a7=_[_0x5bbe('0x3e')](_0x199b93,['value',_0x20fd89['role']])['name'];return db[_0x5bbe('0x3f')][_0x5bbe('0x31')]({'where':{'type':_0x5e34a7,'resourceId':_0x20fd89['id']}})['then'](function(){return _0x511f0b;});})[_0x5bbe('0x1b')](function(){_0x555ee5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x587e5c,_0x29934f){return function(_0x1932ea){if(!_0x1932ea){_0x587e5c[_0x5bbe('0x26')](0x194);}return _0x1932ea;};}function handleError(_0x4df6f4,_0xcbe96f){_0xcbe96f=_0xcbe96f||0x1f4;return function(_0x590df6){logger[_0x5bbe('0x20')](_0x590df6[_0x5bbe('0x40')]);if(_0x590df6[_0x5bbe('0x41')]){delete _0x590df6[_0x5bbe('0x41')];}_0x4df6f4[_0x5bbe('0x27')](_0xcbe96f)[_0x5bbe('0x42')](_0x590df6);};}exports[_0x5bbe('0x43')]=function(_0x1ed033,_0x228e4c){var _0x4b7569={},_0x5200c2={},_0x290ec8={'count':0x0,'rows':[]};var _0x49fd6c=_[_0x5bbe('0x3b')](db['User'][_0x5bbe('0x44')],function(_0x436bb5){return{'name':_0x436bb5[_0x5bbe('0x45')],'type':_0x436bb5[_0x5bbe('0x46')][_0x5bbe('0x47')]};});_0x5200c2[_0x5bbe('0x48')]=_[_0x5bbe('0x49')](_[_0x5bbe('0x3b')](_0x49fd6c,_0x5bbe('0x41')),[_0x5bbe('0x4a'),_0x5bbe('0x4b')]);_0x5200c2['query']=_[_0x5bbe('0x4c')](_0x1ed033['query']);_0x5200c2['filters']=_['intersection'](_0x5200c2[_0x5bbe('0x48')],_0x5200c2[_0x5bbe('0x4d')]);_0x4b7569[_0x5bbe('0x4e')]=_['intersection'](_0x5200c2[_0x5bbe('0x48')],qs[_0x5bbe('0x4f')](_0x1ed033['query'][_0x5bbe('0x4f')]));_0x4b7569['attributes']=_0x4b7569['attributes']['length']?_0x4b7569[_0x5bbe('0x4e')]:_0x5200c2[_0x5bbe('0x48')];if(!_0x1ed033[_0x5bbe('0x4d')]['hasOwnProperty']('nolimit')){_0x4b7569[_0x5bbe('0x2c')]=qs[_0x5bbe('0x2c')](_0x1ed033[_0x5bbe('0x4d')][_0x5bbe('0x2c')]);_0x4b7569[_0x5bbe('0x2b')]=qs[_0x5bbe('0x2b')](_0x1ed033[_0x5bbe('0x4d')][_0x5bbe('0x2b')]);}_0x4b7569[_0x5bbe('0x50')]=qs[_0x5bbe('0x51')](_0x1ed033[_0x5bbe('0x4d')][_0x5bbe('0x51')]);_0x4b7569['where']=qs[_0x5bbe('0x52')](_['pick'](_0x1ed033[_0x5bbe('0x4d')],_0x5200c2['filters']),_0x49fd6c);if(_0x1ed033[_0x5bbe('0x4d')][_0x5bbe('0x39')]){_0x4b7569[_0x5bbe('0x53')]=_[_0x5bbe('0x54')](_0x4b7569[_0x5bbe('0x53')],{'$or':_['map'](_0x49fd6c,function(_0x416561){if(_0x416561[_0x5bbe('0x46')]!=='VIRTUAL'){return db[_0x5bbe('0x55')][_0x5bbe('0x53')](db[_0x5bbe('0x55')]['fn'](_0x5bbe('0x56'),db[_0x5bbe('0x55')][_0x5bbe('0x57')](_0x416561[_0x5bbe('0x41')])),{'$like':db[_0x5bbe('0x55')]['fn']('lower','%'+_0x1ed033[_0x5bbe('0x4d')][_0x5bbe('0x39')]+'%')});}})});}_0x4b7569=_[_0x5bbe('0x54')]({},_0x4b7569,_0x1ed033[_0x5bbe('0x58')]);var _0x54f92a={'where':_0x4b7569['where']};return db[_0x5bbe('0x59')][_0x5bbe('0x2a')](_0x54f92a)['then'](function(_0x34200d){_0x290ec8['count']=_0x34200d;if(_0x1ed033[_0x5bbe('0x4d')]['includeAll']){_0x4b7569['include']=[{'all':!![]}];}return db['User'][_0x5bbe('0x5a')](_0x4b7569);})[_0x5bbe('0x1b')](function(_0x729104){_0x290ec8[_0x5bbe('0x5b')]=_0x729104;return _0x290ec8;})[_0x5bbe('0x1b')](respondWithFilteredResult(_0x228e4c,_0x4b7569))[_0x5bbe('0x5c')](handleError(_0x228e4c,null));};exports['show']=function(_0x4af8d7,_0x348a29){var _0x2e0327={'raw':![],'where':{'id':_0x4af8d7[_0x5bbe('0x5d')]['id']}},_0x490fe0={};_0x490fe0[_0x5bbe('0x48')]=_[_0x5bbe('0x49')](_['keys'](db[_0x5bbe('0x59')][_0x5bbe('0x44')]),['password',_0x5bbe('0x4b')]);_0x490fe0['query']=_[_0x5bbe('0x4c')](_0x4af8d7[_0x5bbe('0x4d')]);_0x490fe0[_0x5bbe('0x5e')]=_[_0x5bbe('0x5f')](_0x490fe0['model'],_0x490fe0['query']);_0x2e0327[_0x5bbe('0x4e')]=_['intersection'](_0x490fe0[_0x5bbe('0x48')],qs['fields'](_0x4af8d7[_0x5bbe('0x4d')]['fields']));_0x2e0327[_0x5bbe('0x4e')]=_0x2e0327[_0x5bbe('0x4e')]['length']?_0x2e0327['attributes']:_0x490fe0[_0x5bbe('0x48')];if(_0x4af8d7[_0x5bbe('0x4d')][_0x5bbe('0x60')]){_0x2e0327[_0x5bbe('0x61')]=[{'all':!![]}];}_0x2e0327=_[_0x5bbe('0x54')]({},_0x2e0327,_0x4af8d7[_0x5bbe('0x58')]);return db['User'][_0x5bbe('0x3e')](_0x2e0327)[_0x5bbe('0x1b')](handleEntityNotFound(_0x348a29,null))[_0x5bbe('0x1b')](respondWithResult(_0x348a29,null))[_0x5bbe('0x5c')](handleError(_0x348a29,null));};exports['update']=function(_0xfc2a7b,_0x3dabd5){if(_0xfc2a7b[_0x5bbe('0x62')]['id']){delete _0xfc2a7b[_0x5bbe('0x62')]['id'];}delete _0xfc2a7b[_0x5bbe('0x62')]['role'];return db['User'][_0x5bbe('0x3e')]({'where':{'id':_0xfc2a7b[_0x5bbe('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3dabd5,null))['then'](saveUpdates(_0xfc2a7b['body'],null))[_0x5bbe('0x1b')](respondWithResult(_0x3dabd5,null))[_0x5bbe('0x5c')](handleError(_0x3dabd5,null));};exports[_0x5bbe('0x63')]=function(_0xc3f3f9,_0x2f8119){return db['User'][_0x5bbe('0x63')]()[_0x5bbe('0x1b')](respondWithResult(_0x2f8119,null))[_0x5bbe('0x5c')](handleError(_0x2f8119,null));};exports[_0x5bbe('0x64')]=function(_0x1a06e4,_0x26043e,_0x3a558e){return db[_0x5bbe('0x59')][_0x5bbe('0x3e')]({'where':{'id':_0x1a06e4['params']['id']}})[_0x5bbe('0x1b')](handleEntityNotFound(_0x26043e,null))[_0x5bbe('0x1b')](function(_0x55f25f){if(_0x55f25f){return _0x55f25f['addContacts'](_0x1a06e4[_0x5bbe('0x62')][_0x5bbe('0x65')],_['omit'](_0x1a06e4[_0x5bbe('0x62')],[_0x5bbe('0x65'),'id'])||{});}})[_0x5bbe('0x1b')](respondWithResult(_0x26043e,null))[_0x5bbe('0x5c')](handleError(_0x26043e,null));};function validateUser(_0x35b80e){return new BPromise(function(_0x4d45af,_0x39d8af){if(_0x35b80e[_0x5bbe('0x66')])return _0x4d45af();return db[_0x5bbe('0x67')]['findById'](0x1)[_0x5bbe('0x1b')](function(_0x960280){if(_0x960280[_0x5bbe('0x68')])authService[_0x5bbe('0x69')](_0x35b80e[_0x5bbe('0x4a')]);db[_0x5bbe('0x59')][_0x5bbe('0x6a')]('internal')['then'](function(_0x778278){if(_[_0x5bbe('0x6b')](_0x778278)){_0x35b80e[_0x5bbe('0x66')]=_0x960280[_0x5bbe('0x6c')]||0x1;return;}if(_['isNil'](_0x960280[_0x5bbe('0x6c')])||_0x960280['min_internal']===_0x778278){_0x35b80e[_0x5bbe('0x66')]=_0x778278+0x1;return;}if(_0x960280['min_internal']>_0x778278){_0x35b80e[_0x5bbe('0x66')]=_0x960280[_0x5bbe('0x6c')];return;}return db['sequelize'][_0x5bbe('0x4d')](_0x5bbe('0x6d'),{'type':db[_0x5bbe('0x55')][_0x5bbe('0x6e')]['SELECT']})[_0x5bbe('0x1b')](function(_0x545cb1){if(_0x545cb1&&_0x545cb1[_0x5bbe('0x6f')]){for(var _0x4bcfe3=0x0,_0x357d77=_0x545cb1['length'];_0x4bcfe3<_0x357d77&&_[_0x5bbe('0x6b')](_0x35b80e[_0x5bbe('0x66')]);_0x4bcfe3++){if(_0x960280[_0x5bbe('0x6c')]<=_0x545cb1[_0x4bcfe3]['from']){_0x35b80e[_0x5bbe('0x66')]=_0x545cb1[_0x4bcfe3][_0x5bbe('0x70')];}else if(_0x960280[_0x5bbe('0x6c')]>_0x545cb1[_0x4bcfe3]['from']&&_0x960280[_0x5bbe('0x6c')]<=_0x545cb1[_0x4bcfe3]['to']){_0x35b80e['internal']=_0x960280[_0x5bbe('0x6c')];}}}if(_[_0x5bbe('0x6b')](_0x35b80e[_0x5bbe('0x66')])){_0x35b80e[_0x5bbe('0x66')]=_0x778278+0x1;}return _0x4d45af(_0x35b80e);});});})[_0x5bbe('0x5c')](function(_0x5aedf3){_0x39d8af(_0x5aedf3);});});}function updateUser(_0x520d0a){return new BPromise(function(_0x32ba90,_0x51ee5d){try{if(_0x520d0a[_0x5bbe('0x71')]){_0x520d0a[_0x5bbe('0x72')]=_0x520d0a[_0x5bbe('0x66')];_0x520d0a[_0x5bbe('0x73')]={'mailbox':_0x520d0a[_0x5bbe('0x66')],'password':_0x520d0a[_0x5bbe('0x4a')],'fullname':_0x520d0a[_0x5bbe('0x74')],'email':_0x520d0a[_0x5bbe('0x75')]};}if(_0x520d0a['role']===_0x5bbe('0x38')){if(!_0x520d0a[_0x5bbe('0x76')])_0x520d0a[_0x5bbe('0x76')]=[_0x5bbe('0x77'),_0x5bbe('0x78'),_0x5bbe('0x79'),'113',_0x5bbe('0x7a'),_0x5bbe('0x7b'),_0x5bbe('0x7c'),'106',_0x5bbe('0x7d'),_0x5bbe('0x7e'),_0x5bbe('0x7f'),'100','111',_0x5bbe('0x80')];}_0x32ba90(_0x520d0a);}catch(_0x1b0418){_0x51ee5d(_0x1b0418);}});}exports[_0x5bbe('0x81')]=function(_0x48efcb,_0x593d95){if(_0x48efcb[_0x5bbe('0x36')][_0x5bbe('0x33')]===_0x5bbe('0x38'))throw new Error('Unauthorized');if(_0x48efcb[_0x5bbe('0x62')][_0x5bbe('0x33')]===_0x5bbe('0x36')&&_0x48efcb[_0x5bbe('0x36')][_0x5bbe('0x33')]!=='admin'){throw new Error(_0x5bbe('0x82'));}if(_0x48efcb[_0x5bbe('0x62')][_0x5bbe('0x33')]==='admin'&&_0x48efcb[_0x5bbe('0x36')][_0x5bbe('0x33')]!==_0x5bbe('0x34')){throw new Error(_0x5bbe('0x83'));}return licenseUtil['checkUserLimits']([_0x48efcb['body']])['then'](function(){return validateUser(_0x48efcb[_0x5bbe('0x62')]);})[_0x5bbe('0x1b')](function(_0x35fc45){return updateUser(_0x35fc45)[_0x5bbe('0x1b')](function(_0x107b2d){if(_0x107b2d[_0x5bbe('0x33')]===_0x5bbe('0x34')){_0x107b2d[_0x5bbe('0x84')]=_0x48efcb[_0x5bbe('0x36')][_0x5bbe('0x84')];delete _0x107b2d[_0x5bbe('0x85')];}return _0x107b2d;});})[_0x5bbe('0x1b')](function(_0x4a2fe5){return db['User'][_0x5bbe('0x81')](_0x4a2fe5,{'include':[{'model':db['VoiceMail'],'as':_0x5bbe('0x73')}]});})['then'](function(_0x57624b){if(_0x48efcb[_0x5bbe('0x62')]['role']===_0x5bbe('0x36'))return _0x57624b;if(_0x48efcb[_0x5bbe('0x36')][_0x5bbe('0x33')]!==_0x5bbe('0x36'))return _0x57624b;return db['UserProfileSection'][_0x5bbe('0x3e')]({'where':{'name':_0x57624b[_0x5bbe('0x33')]===_0x5bbe('0x38')?'Agents':'Telephones','userProfileId':_0x48efcb[_0x5bbe('0x36')][_0x5bbe('0x85')]},'raw':!![]})[_0x5bbe('0x1b')](function(_0x300c2b){if(!_0x300c2b||_0x300c2b[_0x5bbe('0x86')]!=0x0)return _0x57624b;return db[_0x5bbe('0x3f')]['create']({'name':_0x57624b['name'],'resourceId':_0x57624b['id'],'type':_0x300c2b[_0x5bbe('0x41')],'sectionId':_0x300c2b['id']},{})[_0x5bbe('0x1b')](function(){return _0x57624b;});})[_0x5bbe('0x5c')](function(_0x32b79f){logger[_0x5bbe('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32b79f);throw _0x32b79f;});})[_0x5bbe('0x1b')](respondWithResult(_0x593d95,0xc9))[_0x5bbe('0x5c')](handleError(_0x593d95,null));};exports[_0x5bbe('0x87')]=function(_0x4ed0e6,_0x3199c3){var _0xbf7e60=_0x4ed0e6[_0x5bbe('0x62')];var _0x137e26=[];if(_0x4ed0e6[_0x5bbe('0x36')][_0x5bbe('0x33')]==='agent')throw new Error(_0x5bbe('0x88'));if(_['some'](_0xbf7e60,['role',_0x5bbe('0x36')])&&_0x4ed0e6[_0x5bbe('0x36')][_0x5bbe('0x33')]!==_0x5bbe('0x34')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0xbf7e60,[_0x5bbe('0x33'),'admin'])&&_0x4ed0e6[_0x5bbe('0x36')][_0x5bbe('0x33')]!==_0x5bbe('0x34')){throw new Error(_0x5bbe('0x89'));}return licenseUtil[_0x5bbe('0x8a')](_0xbf7e60)[_0x5bbe('0x1b')](function(){return validateUser(_0xbf7e60[0x0]);})[_0x5bbe('0x1b')](function(){for(var _0x53a471=0x1;_0x53a471<_0xbf7e60[_0x5bbe('0x6f')];_0x53a471++){var _0x208a3f=_0xbf7e60[_0x53a471-0x1][_0x5bbe('0x66')];if(!_0xbf7e60[_0x53a471][_0x5bbe('0x66')])_0xbf7e60[_0x53a471][_0x5bbe('0x66')]=_0x208a3f+0x1;_0x137e26['push'](validateUser(_0xbf7e60[_0x53a471]));}return BPromise[_0x5bbe('0x8b')](_0x137e26);})[_0x5bbe('0x1b')](function(){_0x137e26=[];for(var _0x1f1474=0x0;_0x1f1474<_0xbf7e60[_0x5bbe('0x6f')];_0x1f1474++){_0x137e26[_0x5bbe('0x8c')](updateUser(_0xbf7e60[_0x1f1474]));}return BPromise[_0x5bbe('0x8b')](_0x137e26);})['then'](function(){return BPromise[_0x5bbe('0x8d')](_0xbf7e60,function(_0x13e281){return db['User'][_0x5bbe('0x81')](_0x13e281,{'include':[{'model':db[_0x5bbe('0x73')],'as':_0x5bbe('0x73')}]})[_0x5bbe('0x1b')](function(_0x570002){_0x13e281['id']=_0x570002['id'];return _0x13e281;});});})[_0x5bbe('0x1b')](function(_0x56989e){if(_0x4ed0e6[_0x5bbe('0x62')][_0x5bbe('0x33')]==='user')return _0x56989e;if(_0x4ed0e6[_0x5bbe('0x36')][_0x5bbe('0x33')]!==_0x5bbe('0x36'))return _0x56989e;var _0x19a87a=_[_0x5bbe('0x8e')](_0x56989e,function(_0x431ac9){return _0x431ac9['role']===_0x5bbe('0x38')||_0x431ac9[_0x5bbe('0x33')]===_0x5bbe('0x8f');});if(!_0x19a87a)return _0x56989e;return db[_0x5bbe('0x90')][_0x5bbe('0x5a')]({'where':{'name':{'$or':[_0x5bbe('0x37'),_0x5bbe('0x91')]},'userProfileId':_0x4ed0e6[_0x5bbe('0x36')][_0x5bbe('0x85')]},'raw':!![]})[_0x5bbe('0x1b')](function(_0x457dab){if(_[_0x5bbe('0x92')](_0x457dab)||!_[_0x5bbe('0x8e')](_0x457dab,[_0x5bbe('0x86'),0x0]))return _0x56989e;_0x137e26=[];var _0x4650bb=_(_0x457dab)[_0x5bbe('0x3b')](function(_0x2cfb51){if(_0x2cfb51[_0x5bbe('0x86')]===0x1)return;return _0x2cfb51[_0x5bbe('0x41')]===_0x5bbe('0x37')?'agent':_0x5bbe('0x8f');})[_0x5bbe('0x93')]()['value']();for(var _0x27e27b=0x0;_0x27e27b<_0x56989e[_0x5bbe('0x6f')];_0x27e27b++){if(!_[_0x5bbe('0x3d')](_0x4650bb,_0x56989e[_0x27e27b][_0x5bbe('0x33')]))return;var _0x2aaa74=_0x56989e[_0x27e27b][_0x5bbe('0x33')]===_0x5bbe('0x38')?_0x5bbe('0x37'):_0x5bbe('0x91');_0x137e26[_0x5bbe('0x8c')](db[_0x5bbe('0x3f')][_0x5bbe('0x81')]({'name':_0x56989e[_0x27e27b][_0x5bbe('0x41')],'resourceId':_0x56989e[_0x27e27b]['id'],'type':_0x2aaa74,'sectionId':_[_0x5bbe('0x3e')](_0x457dab,[_0x5bbe('0x41'),_0x2aaa74])['id']},{}));}return BPromise[_0x5bbe('0x8b')](_0x137e26);})[_0x5bbe('0x1b')](respondWithResult(_0x3199c3,0xc9))[_0x5bbe('0x5c')](handleError(_0x3199c3,null));});};exports['changePassword']=function(_0x32a8b0,_0x1e8948,_0x3e5024){if(_0x32a8b0['body']['id']){delete _0x32a8b0[_0x5bbe('0x62')]['id'];}return db[_0x5bbe('0x59')]['find']({'where':{'id':_0x32a8b0['params']['id']}})['then'](function(_0x42bd4d){if(!_0x42bd4d)return null;if(_0x42bd4d['id']===_0x32a8b0[_0x5bbe('0x36')]['id']){if(!_0x32a8b0[_0x5bbe('0x62')][_0x5bbe('0x94')]||!_0x32a8b0[_0x5bbe('0x62')][_0x5bbe('0x95')]){throw new db['Sequelize'][(_0x5bbe('0x96'))](_0x5bbe('0x97'));}if(!_0x42bd4d[_0x5bbe('0x98')](_0x32a8b0[_0x5bbe('0x62')][_0x5bbe('0x94')])){throw new db['Sequelize'][(_0x5bbe('0x96'))]('Wrong\x20credentials');}if(_0x32a8b0['body']['oldPassword']===_0x32a8b0[_0x5bbe('0x62')]['newPassword']){throw new db[(_0x5bbe('0x99'))]['ValidationError'](_0x5bbe('0x9a'));}}else if(_0x32a8b0['user']['role']===_0x5bbe('0x34')){if(!_0x32a8b0[_0x5bbe('0x62')][_0x5bbe('0x95')]){throw new db[(_0x5bbe('0x99'))]['ValidationError'](_0x5bbe('0x9b'));}}else if(_0x32a8b0[_0x5bbe('0x36')]['role']===_0x5bbe('0x36')){if(!_0x32a8b0[_0x5bbe('0x62')]['newPassword']){throw new db[(_0x5bbe('0x99'))][(_0x5bbe('0x96'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x42bd4d[_0x5bbe('0x33')]!=='agent'){throw new db[(_0x5bbe('0x99'))][(_0x5bbe('0x96'))]('Unauthorized');}}else{throw new db['Sequelize'][(_0x5bbe('0x96'))](_0x5bbe('0x88'));}return _0x42bd4d;})[_0x5bbe('0x1b')](handleEntityNotFound(_0x1e8948,null))[_0x5bbe('0x1b')](function(_0x284a0d){return db['Setting']['findOne']({'attributes':['id',_0x5bbe('0x68'),_0x5bbe('0x9c'),'passwordHistoryLimit']})[_0x5bbe('0x1b')](function(_0x495481){if(_0x495481[_0x5bbe('0x68')])authService['validatePasswordPattern'](_0x32a8b0[_0x5bbe('0x62')][_0x5bbe('0x95')]);if(!_0x495481[_0x5bbe('0x9c')]||!_0x284a0d[_0x5bbe('0x9d')])return _0x284a0d;authService[_0x5bbe('0x9e')](_0x32a8b0['body'][_0x5bbe('0x95')],_0x284a0d[_0x5bbe('0x9d')],_0x495481[_0x5bbe('0x9f')]);return _0x284a0d;})[_0x5bbe('0x1b')](saveUpdates({'password':_0x32a8b0[_0x5bbe('0x62')][_0x5bbe('0x95')],'passwordResetAt':_0x32a8b0[_0x5bbe('0x36')]['id']==_0x32a8b0[_0x5bbe('0x5d')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x32a8b0[_0x5bbe('0x62')][_0x5bbe('0x95')],_0x284a0d['previousPasswords'])},null));})[_0x5bbe('0x1b')](respondWithResult(_0x1e8948,null))[_0x5bbe('0x5c')](handleError(_0x1e8948,null));};exports['addQueues']=function(_0x31c783,_0x1dbe2f,_0x59d30d){var _0x100292=_0x31c783['body'][_0x5bbe('0xa0')];return db['User']['find']({'where':{'id':_0x31c783['params']['id']},'attributes':['id',_0x5bbe('0x41'),'role','online',_0x5bbe('0xa1'),_0x5bbe('0xa2'),_0x5bbe('0xa3')]})[_0x5bbe('0x1b')](handleEntityNotFound(_0x1dbe2f,null))['then'](function(_0x1f60f8){if(_0x1f60f8){if(!utils['isValidChannel'](_0x100292)){throw new db[(_0x5bbe('0x99'))][(_0x5bbe('0x96'))](_0x5bbe('0xa4'));}return _0x1f60f8[_0x5bbe('0xa5')+_['capitalize'](_0x100292['toLowerCase']())+_0x5bbe('0xa6')](_0x31c783[_0x5bbe('0x62')]['ids'],{'penalty':_0x31c783['body'][_0x5bbe('0xa7')]||0x0})[_0x5bbe('0xa8')](function(_0x46dc7f){for(var _0x35ef0c=0x0;_0x35ef0c<_0x31c783[_0x5bbe('0x62')]['ids'][_0x5bbe('0x6f')];_0x35ef0c+=0x1){var _0x279532={'UserId':_0x31c783[_0x5bbe('0x5d')]['id']};_0x279532[_[_0x5bbe('0xa9')](_0x100292[_0x5bbe('0xaa')]())+'QueueId']=_0x31c783[_0x5bbe('0x62')][_0x5bbe('0x65')][_0x35ef0c];socket[_0x5bbe('0xab')](_0x5bbe('0x36')+_[_0x5bbe('0xa9')](_0x100292['toLowerCase']())+_0x5bbe('0xac'),_0x279532);}return _0x46dc7f;})[_0x5bbe('0x1b')](function(){if(_0x100292===_0x5bbe('0xad')){return db[_0x5bbe('0xae')][_0x5bbe('0x5a')]({'where':{'id':_0x31c783[_0x5bbe('0x62')][_0x5bbe('0x65')]||[]},'raw':!![],'attributes':['id',_0x5bbe('0x41')]});}})[_0x5bbe('0x1b')](function(_0x4a61c9){var _0x2c4277=_0x1f60f8[_0x5bbe('0x32')]({'plain':!![]});var _0x29bca3=[];if(_0x100292===_0x5bbe('0xad')&&_0x2c4277['role']===_0x5bbe('0x38')&&_0x2c4277[_0x5bbe('0xaf')]){for(var _0x172480=0x0;_0x172480<_0x4a61c9[_0x5bbe('0x6f')];_0x172480+=0x1){_0x29bca3[_0x5bbe('0x8c')]({'membername':_0x2c4277[_0x5bbe('0x41')],'UserId':_0x2c4277['id'],'queue_name':_0x4a61c9[_0x172480]['name'],'VoiceQueueId':_0x4a61c9[_0x172480]['id'],'interface':_[_0x5bbe('0x6b')](_0x2c4277[_0x5bbe('0xa3')])?util['format'](_0x5bbe('0xb0'),_0x2c4277['name']):_0x2c4277[_0x5bbe('0xa3')],'paused':_0x2c4277[_0x5bbe('0xa2')]||![],'penalty':_0x31c783['body'][_0x5bbe('0xa7')]||0x0});}return BPromise[_0x5bbe('0x8d')](_0x29bca3,function(_0x1943d2){return db['UserVoiceQueueRt']['upsert'](_0x1943d2);});}return _0x1f60f8;});}})[_0x5bbe('0x1b')](respondWithStatusCode(_0x1dbe2f,null))[_0x5bbe('0x5c')](handleError(_0x1dbe2f,null));};exports[_0x5bbe('0xb1')]=function(_0x2e68ca,_0x5786e3,_0x29f9f1){var _0x200423;return db[_0x5bbe('0x59')][_0x5bbe('0x3e')]({'where':{'id':_0x2e68ca[_0x5bbe('0x5d')]['id']},'attributes':['id',_0x5bbe('0x41'),_0x5bbe('0x33')]})[_0x5bbe('0x1b')](handleEntityNotFound(_0x5786e3,null))[_0x5bbe('0x1b')](function(_0x1222f5){if(_0x1222f5){_0x200423=_0x1222f5;if(!_0x2e68ca[_0x5bbe('0x4d')][_0x5bbe('0xa0')]||!utils[_0x5bbe('0xb2')](_0x2e68ca[_0x5bbe('0x4d')][_0x5bbe('0xa0')])){throw new db['Sequelize'][(_0x5bbe('0x96'))]('Unknown\x20channel');}return _0x1222f5[_0x5bbe('0xb3')+_['capitalize'](_0x2e68ca[_0x5bbe('0x4d')][_0x5bbe('0xa0')]['toLowerCase']())+_0x5bbe('0xa6')](_0x2e68ca[_0x5bbe('0x4d')][_0x5bbe('0x65')]);}})[_0x5bbe('0x1b')](function(_0x6d113f){for(var _0x2bb726=0x0;_0x2bb726<_0x2e68ca['query'][_0x5bbe('0x65')][_0x5bbe('0x6f')];_0x2bb726+=0x1){var _0x4f9eb1={'UserId':_0x2e68ca[_0x5bbe('0x5d')]['id']};_0x4f9eb1[_[_0x5bbe('0xa9')](_0x2e68ca['query'][_0x5bbe('0xa0')][_0x5bbe('0xaa')]())+_0x5bbe('0xb4')]=_0x2e68ca[_0x5bbe('0x4d')][_0x5bbe('0x65')][_0x2bb726];socket[_0x5bbe('0xab')](_0x5bbe('0x36')+_[_0x5bbe('0xa9')](_0x2e68ca[_0x5bbe('0x4d')][_0x5bbe('0xa0')][_0x5bbe('0xaa')]())+_0x5bbe('0xb5'),_0x4f9eb1);}return _0x6d113f;})['then'](function(){if(_0x2e68ca[_0x5bbe('0x4d')]['channel']===_0x5bbe('0xad')){return db[_0x5bbe('0xb6')]['destroy']({'where':{'UserId':_0x2e68ca[_0x5bbe('0x5d')]['id'],'VoiceQueueId':_0x2e68ca[_0x5bbe('0x4d')][_0x5bbe('0x65')]},'individualHooks':!![]})['then'](function(){return _0x200423;});}return _0x200423;})['then'](respondWithStatusCode(_0x5786e3,null))[_0x5bbe('0x5c')](handleError(_0x5786e3,null));};exports['addAvatar']=function(_0xfb9a6b,_0x21ebeb,_0x24959a){_0xfb9a6b[_0x5bbe('0x62')][_0x5bbe('0xb7')]=_0xfb9a6b['file'][_0x5bbe('0xb8')];return db[_0x5bbe('0x59')][_0x5bbe('0x3e')]({'where':{'id':_0xfb9a6b[_0x5bbe('0x5d')]['id']}})['then'](handleEntityNotFound(_0x21ebeb,null))[_0x5bbe('0x1b')](saveUpdates(_0xfb9a6b[_0x5bbe('0x62')],null))[_0x5bbe('0x1b')](respondWithResult(_0x21ebeb,null))[_0x5bbe('0x5c')](handleError(_0x21ebeb,null));};exports[_0x5bbe('0xb9')]=function(_0x3d6615,_0x13eb15,_0x5c1cd5){var _0x430afe=path[_0x5bbe('0xba')](config[_0x5bbe('0xbb')],_0x5bbe('0xbc'));return db[_0x5bbe('0x59')][_0x5bbe('0x3e')]({'where':{'id':_0x3d6615[_0x5bbe('0x5d')]['id']},'attributes':['id',_0x5bbe('0xb7')],'raw':!![]})[_0x5bbe('0x1b')](handleEntityNotFound(_0x13eb15,null))[_0x5bbe('0x1b')](function(_0x5aaecd){if(_0x5aaecd){if(_[_0x5bbe('0x6b')](_0x5aaecd[_0x5bbe('0xb7')])){return _0x13eb15[_0x5bbe('0xbd')](_0x430afe);}else{if(!fs['existsSync'](path['join'](config[_0x5bbe('0xbb')],_0x5bbe('0xbe'),_0x5aaecd[_0x5bbe('0xb7')]))){return _0x13eb15[_0x5bbe('0xbd')](_0x430afe);}return _0x13eb15[_0x5bbe('0xbd')](path[_0x5bbe('0xba')](config[_0x5bbe('0xbb')],_0x5bbe('0xbe'),_0x5aaecd[_0x5bbe('0xb7')]));}}})[_0x5bbe('0x5c')](handleError(_0x13eb15,null));};exports['getContacts']=function(_0x4d931e,_0x15c37e,_0x6b15a1){var _0x308e6c={};var _0x4aba6f={};var _0x393786;var _0x33ddc0;return db[_0x5bbe('0x59')]['findOne']({'where':{'id':_0x4d931e[_0x5bbe('0x5d')]['id']}})[_0x5bbe('0x1b')](handleEntityNotFound(_0x15c37e,null))['then'](function(_0x79167e){if(_0x79167e){_0x393786=_0x79167e;_0x4aba6f[_0x5bbe('0x48')]=_[_0x5bbe('0x4c')](db['CmContact'][_0x5bbe('0x44')]);_0x4aba6f[_0x5bbe('0x4d')]=_[_0x5bbe('0x4c')](_0x4d931e['query']);_0x4aba6f[_0x5bbe('0x52')]=_[_0x5bbe('0x5f')](_0x4aba6f['model'],_0x4aba6f[_0x5bbe('0x4d')]);_0x308e6c['attributes']=_['intersection'](_0x4aba6f['model'],qs['fields'](_0x4d931e[_0x5bbe('0x4d')][_0x5bbe('0x4f')]));_0x308e6c['attributes']=_0x308e6c[_0x5bbe('0x4e')][_0x5bbe('0x6f')]?_0x308e6c[_0x5bbe('0x4e')]:_0x4aba6f[_0x5bbe('0x48')];_0x308e6c[_0x5bbe('0x50')]=qs[_0x5bbe('0x51')](_0x4d931e[_0x5bbe('0x4d')]['sort']);_0x308e6c[_0x5bbe('0x53')]=qs['filters'](_[_0x5bbe('0xbf')](_0x4d931e[_0x5bbe('0x4d')],_0x4aba6f[_0x5bbe('0x52')]));if(_0x4d931e[_0x5bbe('0x4d')][_0x5bbe('0x39')]){_0x308e6c[_0x5bbe('0x53')]=_['merge'](_0x308e6c[_0x5bbe('0x53')],{'$or':_[_0x5bbe('0x3b')](_0x308e6c[_0x5bbe('0x4e')],function(_0x389822){var _0x5f0a8f={};_0x5f0a8f[_0x389822]={'$like':'%'+_0x4d931e[_0x5bbe('0x4d')]['filter']+'%'};return _0x5f0a8f;})});}_0x308e6c=_[_0x5bbe('0x54')]({},_0x308e6c,_0x4d931e[_0x5bbe('0x58')]);return _0x393786[_0x5bbe('0xc0')](_0x308e6c);}})['then'](function(_0x317a31){if(_0x317a31){_0x33ddc0=_0x317a31[_0x5bbe('0x6f')];if(_0x4d931e['query']['hasOwnProperty']('includeAll')){_0x308e6c[_0x5bbe('0x61')]=[{'model':db['CmList'],'as':_0x5bbe('0xc1'),'required':![]},{'model':db['Tag'],'as':_0x5bbe('0xc2'),'attributes':['id',_0x5bbe('0x41'),_0x5bbe('0xc3')],'where':_0x4d931e[_0x5bbe('0x4d')]['tag']?{'id':_0x4d931e['query'][_0x5bbe('0xc4')]}:undefined,'required':_0x4d931e[_0x5bbe('0x4d')][_0x5bbe('0xc4')]?!![]:![]}];}if(!_0x4d931e[_0x5bbe('0x4d')][_0x5bbe('0xc5')](_0x5bbe('0xc6'))){_0x308e6c[_0x5bbe('0x2c')]=qs['limit'](_0x4d931e[_0x5bbe('0x4d')]['limit']);_0x308e6c[_0x5bbe('0x2b')]=qs[_0x5bbe('0x2b')](_0x4d931e[_0x5bbe('0x4d')][_0x5bbe('0x2b')]);}return _0x393786[_0x5bbe('0xc0')](_0x308e6c);}})[_0x5bbe('0x1b')](function(_0x3c1ad4){if(_0x3c1ad4){return _0x3c1ad4?{'count':_0x33ddc0,'rows':_0x3c1ad4}:null;}})[_0x5bbe('0x1b')](respondWithResult(_0x15c37e,null))[_0x5bbe('0x5c')](handleError(_0x15c37e,null));};exports['getQueues']=function(_0xdf50a7,_0x2de0c5,_0x81c96d){var _0x162972;var _0x2e4fae;var _0x206521={};var _0x2c727d;return db[_0x5bbe('0x59')][_0x5bbe('0xc7')]({'where':{'id':_0xdf50a7['params']['id']},'attributes':['id',_0x5bbe('0x41'),_0x5bbe('0x33')]})[_0x5bbe('0x1b')](handleEntityNotFound(_0x2de0c5,null))[_0x5bbe('0x1b')](function(_0x1e49d6){if(!utils[_0x5bbe('0xb2')](_0xdf50a7[_0x5bbe('0x4d')][_0x5bbe('0xa0')])){throw new db[(_0x5bbe('0x99'))][(_0x5bbe('0x96'))](_0x5bbe('0xa4'));}_0x162972=_0x1e49d6;var _0x2c56fb={};_0x2c56fb[_0x5bbe('0x48')]=_['keys'](db[_[_0x5bbe('0xa9')](_0xdf50a7[_0x5bbe('0x4d')][_0x5bbe('0xa0')])+_0x5bbe('0xc8')][_0x5bbe('0x44')]);_0x2c56fb[_0x5bbe('0x4d')]=_[_0x5bbe('0x4c')](_0xdf50a7[_0x5bbe('0x4d')]);_0x2c56fb[_0x5bbe('0x52')]=_[_0x5bbe('0x5f')](_0x2c56fb['model'],_0x2c56fb[_0x5bbe('0x4d')]);_0x206521['attributes']=_[_0x5bbe('0x5f')](_0x2c56fb['model'],qs[_0x5bbe('0x4f')](_0xdf50a7[_0x5bbe('0x4d')]['fields']));_0x206521[_0x5bbe('0x4e')]=_0x206521[_0x5bbe('0x4e')][_0x5bbe('0x6f')]?_0x206521[_0x5bbe('0x4e')]:_0x2c56fb[_0x5bbe('0x48')];_0x206521[_0x5bbe('0x50')]=qs[_0x5bbe('0x51')](_0xdf50a7['query'][_0x5bbe('0x51')]);_0x206521[_0x5bbe('0x53')]=qs[_0x5bbe('0x52')](_[_0x5bbe('0xbf')](_0xdf50a7['query'],_0x2c56fb[_0x5bbe('0x52')]));if(_0xdf50a7[_0x5bbe('0x4d')][_0x5bbe('0x39')]){_0x206521[_0x5bbe('0x53')]=_['merge'](_0x206521[_0x5bbe('0x53')],{'$or':_[_0x5bbe('0x3b')](_0x206521[_0x5bbe('0x4e')],function(_0x32a5c6){var _0x4f5809={};_0x4f5809[_0x32a5c6]={'$like':'%'+_0xdf50a7[_0x5bbe('0x4d')][_0x5bbe('0x39')]+'%'};return _0x4f5809;})});}_0x206521=_[_0x5bbe('0x54')]({},_0x206521,_0xdf50a7['options']);switch(_0x162972['role']){case'admin':return db[_[_0x5bbe('0xa9')](_0xdf50a7[_0x5bbe('0x4d')]['channel'])+_0x5bbe('0xc8')][_0x5bbe('0x5a')](_0x206521);case _0x5bbe('0x36'):case _0x5bbe('0x38'):return _0x162972[_0x5bbe('0x32')+_[_0x5bbe('0xa9')](_0xdf50a7[_0x5bbe('0x4d')][_0x5bbe('0xa0')])+_0x5bbe('0xa6')](_0x206521);default:throw new db[(_0x5bbe('0x99'))][(_0x5bbe('0x96'))](_0x5bbe('0xc9'));}})['then'](function(_0x3317e){_0x2c727d=_0x3317e[_0x5bbe('0x6f')];if(!_0xdf50a7[_0x5bbe('0x4d')][_0x5bbe('0xc5')]('nolimit')){_0x206521['limit']=qs[_0x5bbe('0x2c')](_0xdf50a7[_0x5bbe('0x4d')][_0x5bbe('0x2c')]);_0x206521['offset']=qs[_0x5bbe('0x2b')](_0xdf50a7[_0x5bbe('0x4d')][_0x5bbe('0x2b')]);}switch(_0x162972['role']){case _0x5bbe('0x34'):return db[_[_0x5bbe('0xa9')](_0xdf50a7[_0x5bbe('0x4d')][_0x5bbe('0xa0')])+'Queue'][_0x5bbe('0x5a')](_0x206521);case _0x5bbe('0x36'):case _0x5bbe('0x38'):return _0x162972[_0x5bbe('0x32')+_[_0x5bbe('0xa9')](_0xdf50a7[_0x5bbe('0x4d')][_0x5bbe('0xa0')])+_0x5bbe('0xa6')](_0x206521);}})['then'](function(_0x5a2f42){return{'count':_0x2c727d,'rows':_0x5a2f42};})[_0x5bbe('0x1b')](respondWithResult(_0x2de0c5,null))['catch'](handleError(_0x2de0c5,null));};exports[_0x5bbe('0xca')]=function(_0x4b5998,_0x161c48,_0x482fb1){var _0x564872={};var _0x4ae46a={};var _0x571f4d;var _0x202c70;return db[_0x5bbe('0x59')][_0x5bbe('0xc7')]({'where':{'id':_0x4b5998[_0x5bbe('0x5d')]['id']}})[_0x5bbe('0x1b')](handleEntityNotFound(_0x161c48,null))['then'](function(_0xbe044e){if(_0xbe044e){_0x571f4d=_0xbe044e;_0x4ae46a['model']=_[_0x5bbe('0x4c')](db[_0x5bbe('0xb6')]['rawAttributes']);_0x4ae46a['query']=_[_0x5bbe('0x4c')](_0x4b5998[_0x5bbe('0x4d')]);_0x4ae46a[_0x5bbe('0x52')]=_[_0x5bbe('0x5f')](_0x4ae46a[_0x5bbe('0x48')],_0x4ae46a[_0x5bbe('0x4d')]);_0x564872[_0x5bbe('0x4e')]=_[_0x5bbe('0x5f')](_0x4ae46a[_0x5bbe('0x48')],qs[_0x5bbe('0x4f')](_0x4b5998[_0x5bbe('0x4d')][_0x5bbe('0x4f')]));_0x564872[_0x5bbe('0x4e')]=_0x564872[_0x5bbe('0x4e')]['length']?_0x564872[_0x5bbe('0x4e')]:_0x4ae46a[_0x5bbe('0x48')];_0x564872[_0x5bbe('0x50')]=qs[_0x5bbe('0x51')](_0x4b5998[_0x5bbe('0x4d')]['sort']);_0x564872[_0x5bbe('0x53')]=qs['filters'](_[_0x5bbe('0xbf')](_0x4b5998[_0x5bbe('0x4d')],_0x4ae46a['filters']));if(_0x4b5998['query'][_0x5bbe('0x39')]){_0x564872[_0x5bbe('0x53')]=_['merge'](_0x564872[_0x5bbe('0x53')],{'$or':_[_0x5bbe('0x3b')](_0x564872[_0x5bbe('0x4e')],function(_0x1e491a){var _0x2aa88a={};_0x2aa88a[_0x1e491a]={'$like':'%'+_0x4b5998[_0x5bbe('0x4d')]['filter']+'%'};return _0x2aa88a;})});}_0x564872=_[_0x5bbe('0x54')]({},_0x564872,_0x4b5998['options']);return _0x571f4d['getVoiceQueuesRt'](_0x564872);}})[_0x5bbe('0x1b')](function(_0x1a7be3){if(_0x1a7be3){_0x202c70=_0x1a7be3[_0x5bbe('0x6f')];if(!_0x4b5998[_0x5bbe('0x4d')]['hasOwnProperty'](_0x5bbe('0xc6'))){_0x564872[_0x5bbe('0x2c')]=qs[_0x5bbe('0x2c')](_0x4b5998['query'][_0x5bbe('0x2c')]);_0x564872[_0x5bbe('0x2b')]=qs[_0x5bbe('0x2b')](_0x4b5998[_0x5bbe('0x4d')]['offset']);}return _0x571f4d['getVoiceQueuesRt'](_0x564872);}})[_0x5bbe('0x1b')](function(_0x184ea6){if(_0x184ea6){return _0x184ea6?{'count':_0x202c70,'rows':_0x184ea6}:null;}})[_0x5bbe('0x1b')](respondWithResult(_0x161c48,null))[_0x5bbe('0x5c')](handleError(_0x161c48,null));};exports[_0x5bbe('0xcb')]=function(_0x5eb89f,_0x2657a6,_0x5a62c6){var _0x464d2d={};var _0x24b570={};var _0x46799f;var _0xabc816;return db[_0x5bbe('0x59')][_0x5bbe('0xc7')]({'where':{'id':_0x5eb89f['params']['id']}})['then'](handleEntityNotFound(_0x2657a6,null))[_0x5bbe('0x1b')](function(_0x37babb){if(_0x37babb){_0x46799f=_0x37babb;_0x24b570[_0x5bbe('0x48')]=_[_0x5bbe('0x4c')](db[_0x5bbe('0xcc')][_0x5bbe('0x44')]);_0x24b570[_0x5bbe('0x4d')]=_[_0x5bbe('0x4c')](_0x5eb89f[_0x5bbe('0x4d')]);_0x24b570[_0x5bbe('0x52')]=_[_0x5bbe('0x5f')](_0x24b570[_0x5bbe('0x48')],_0x24b570[_0x5bbe('0x4d')]);_0x464d2d[_0x5bbe('0x4e')]=_[_0x5bbe('0x5f')](_0x24b570[_0x5bbe('0x48')],qs[_0x5bbe('0x4f')](_0x5eb89f[_0x5bbe('0x4d')][_0x5bbe('0x4f')]));_0x464d2d[_0x5bbe('0x4e')]=_0x464d2d[_0x5bbe('0x4e')][_0x5bbe('0x6f')]?_0x464d2d[_0x5bbe('0x4e')]:_0x24b570['model'];_0x464d2d[_0x5bbe('0x50')]=qs[_0x5bbe('0x51')](_0x5eb89f[_0x5bbe('0x4d')]['sort']);_0x464d2d['where']=qs[_0x5bbe('0x52')](_['pick'](_0x5eb89f[_0x5bbe('0x4d')],_0x24b570[_0x5bbe('0x52')]));if(_0x5eb89f[_0x5bbe('0x4d')][_0x5bbe('0x39')]){_0x464d2d[_0x5bbe('0x53')]=_[_0x5bbe('0x54')](_0x464d2d[_0x5bbe('0x53')],{'$or':_[_0x5bbe('0x3b')](_0x464d2d[_0x5bbe('0x4e')],function(_0x1c9f34){var _0x5bc816={};_0x5bc816[_0x1c9f34]={'$like':'%'+_0x5eb89f[_0x5bbe('0x4d')][_0x5bbe('0x39')]+'%'};return _0x5bc816;})});}_0x464d2d=_[_0x5bbe('0x54')]({},_0x464d2d,_0x5eb89f['options']);return _0x46799f[_0x5bbe('0xcb')](_0x464d2d);}})['then'](function(_0x2416ac){if(_0x2416ac){_0xabc816=_0x2416ac[_0x5bbe('0x6f')];if(!_0x5eb89f[_0x5bbe('0x4d')][_0x5bbe('0xc5')](_0x5bbe('0xc6'))){_0x464d2d[_0x5bbe('0x2c')]=qs['limit'](_0x5eb89f['query'][_0x5bbe('0x2c')]);_0x464d2d[_0x5bbe('0x2b')]=qs[_0x5bbe('0x2b')](_0x5eb89f[_0x5bbe('0x4d')][_0x5bbe('0x2b')]);}return _0x46799f[_0x5bbe('0xcb')](_0x464d2d);}})[_0x5bbe('0x1b')](function(_0x2623a3){if(_0x2623a3){return _0x2623a3?{'count':_0xabc816,'rows':_0x2623a3}:null;}})[_0x5bbe('0x1b')](respondWithResult(_0x2657a6,null))[_0x5bbe('0x5c')](handleError(_0x2657a6,null));};exports[_0x5bbe('0xcd')]=function(_0x596557,_0x40a177,_0x2ea182){var _0x52c672={'raw':!![],'where':{}};var _0x28698e={};var _0x55a184={'count':0x0,'rows':[]};return db[_0x5bbe('0x59')][_0x5bbe('0xc7')]({'where':{'id':_0x596557[_0x5bbe('0x5d')]['id']}})[_0x5bbe('0x1b')](handleEntityNotFound(_0x40a177,null))[_0x5bbe('0x1b')](function(_0x918c31){if(_0x918c31){_0x28698e[_0x5bbe('0x48')]=_[_0x5bbe('0x4c')](db[_0x5bbe('0xce')][_0x5bbe('0x44')]);_0x28698e[_0x5bbe('0x4d')]=_[_0x5bbe('0x4c')](_0x596557['query']);_0x28698e[_0x5bbe('0x52')]=_[_0x5bbe('0x5f')](_0x28698e[_0x5bbe('0x48')],_0x28698e[_0x5bbe('0x4d')]);_0x52c672[_0x5bbe('0x4e')]=_[_0x5bbe('0x5f')](_0x28698e['model'],qs[_0x5bbe('0x4f')](_0x596557[_0x5bbe('0x4d')][_0x5bbe('0x4f')]));_0x52c672[_0x5bbe('0x4e')]=_0x52c672[_0x5bbe('0x4e')]['length']?_0x52c672[_0x5bbe('0x4e')]:_0x28698e[_0x5bbe('0x48')];if(!_0x596557[_0x5bbe('0x4d')]['hasOwnProperty'](_0x5bbe('0xc6'))){_0x52c672[_0x5bbe('0x2c')]=qs[_0x5bbe('0x2c')](_0x596557['query']['limit']);_0x52c672['offset']=qs['offset'](_0x596557[_0x5bbe('0x4d')]['offset']);}_0x52c672[_0x5bbe('0x50')]=qs[_0x5bbe('0x51')](_0x596557[_0x5bbe('0x4d')]['sort']);_0x52c672[_0x5bbe('0x53')]=qs['filters'](_[_0x5bbe('0xbf')](_0x596557[_0x5bbe('0x4d')],_0x28698e[_0x5bbe('0x52')]));_0x52c672[_0x5bbe('0x53')]['UserId']=_0x918c31['id'];if(_0x596557[_0x5bbe('0x4d')]['filter']){_0x52c672['where']=_['merge'](_0x52c672['where'],{'$or':_['map'](_0x52c672[_0x5bbe('0x4e')],function(_0xe99999){var _0x42ed42={};_0x42ed42[_0xe99999]={'$like':'%'+_0x596557[_0x5bbe('0x4d')][_0x5bbe('0x39')]+'%'};return _0x42ed42;})});}_0x52c672=_[_0x5bbe('0x54')]({},_0x52c672,_0x596557[_0x5bbe('0x58')]);return db['VoiceRecording'][_0x5bbe('0x2a')]({'where':_0x52c672[_0x5bbe('0x53')]})['then'](function(_0x538847){_0x55a184[_0x5bbe('0x2a')]=_0x538847;if(_0x596557['query'][_0x5bbe('0x60')]){_0x52c672['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x5bbe('0x5a')](_0x52c672);})[_0x5bbe('0x1b')](function(_0x2596b1){_0x55a184[_0x5bbe('0x5b')]=_0x2596b1;return _0x55a184;});}})[_0x5bbe('0x1b')](respondWithFilteredResult(_0x40a177,_0x52c672))[_0x5bbe('0x5c')](handleError(_0x40a177,null));};exports['getScreenRecordings']=function(_0x39693e,_0x5c80e1,_0x51fdb2){var _0x2ccaf5={'raw':!![],'where':{}};var _0x36108a={};var _0x4e703d={'count':0x0,'rows':[]};return db[_0x5bbe('0x59')][_0x5bbe('0xc7')]({'where':{'id':_0x39693e[_0x5bbe('0x5d')]['id']}})[_0x5bbe('0x1b')](handleEntityNotFound(_0x5c80e1,null))['then'](function(_0xc48481){if(_0xc48481){_0x36108a[_0x5bbe('0x48')]=_['keys'](db[_0x5bbe('0xcf')][_0x5bbe('0x44')]);_0x36108a[_0x5bbe('0x4d')]=_[_0x5bbe('0x4c')](_0x39693e[_0x5bbe('0x4d')]);_0x36108a[_0x5bbe('0x52')]=_[_0x5bbe('0x5f')](_0x36108a['model'],_0x36108a[_0x5bbe('0x4d')]);_0x2ccaf5[_0x5bbe('0x4e')]=_[_0x5bbe('0x5f')](_0x36108a[_0x5bbe('0x48')],qs[_0x5bbe('0x4f')](_0x39693e[_0x5bbe('0x4d')]['fields']));_0x2ccaf5[_0x5bbe('0x4e')]=_0x2ccaf5[_0x5bbe('0x4e')][_0x5bbe('0x6f')]?_0x2ccaf5[_0x5bbe('0x4e')]:_0x36108a[_0x5bbe('0x48')];if(!_0x39693e['query'][_0x5bbe('0xc5')](_0x5bbe('0xc6'))){_0x2ccaf5[_0x5bbe('0x2c')]=qs[_0x5bbe('0x2c')](_0x39693e['query'][_0x5bbe('0x2c')]);_0x2ccaf5[_0x5bbe('0x2b')]=qs['offset'](_0x39693e['query']['offset']);}_0x2ccaf5[_0x5bbe('0x50')]=qs[_0x5bbe('0x51')](_0x39693e['query'][_0x5bbe('0x51')]);_0x2ccaf5['where']=qs[_0x5bbe('0x52')](_[_0x5bbe('0xbf')](_0x39693e[_0x5bbe('0x4d')],_0x36108a[_0x5bbe('0x52')]));_0x2ccaf5[_0x5bbe('0x53')]['UserId']=_0xc48481['id'];if(_0x39693e[_0x5bbe('0x4d')]['filter']){_0x2ccaf5[_0x5bbe('0x53')]=_['merge'](_0x2ccaf5[_0x5bbe('0x53')],{'$or':_[_0x5bbe('0x3b')](_0x2ccaf5[_0x5bbe('0x4e')],function(_0x119e8e){var _0xe68bc7={};_0xe68bc7[_0x119e8e]={'$like':'%'+_0x39693e[_0x5bbe('0x4d')][_0x5bbe('0x39')]+'%'};return _0xe68bc7;})});}_0x2ccaf5=_['merge']({},_0x2ccaf5,_0x39693e[_0x5bbe('0x58')]);return db['ScreenRecording']['count']({'where':_0x2ccaf5[_0x5bbe('0x53')]})['then'](function(_0x53fa7c){_0x4e703d['count']=_0x53fa7c;if(_0x39693e[_0x5bbe('0x4d')]['includeAll']){_0x2ccaf5['include']=[{'all':!![]}];}return db[_0x5bbe('0xcf')][_0x5bbe('0x5a')](_0x2ccaf5);})['then'](function(_0x318b95){_0x4e703d[_0x5bbe('0x5b')]=_0x318b95;return _0x4e703d;});}})[_0x5bbe('0x1b')](respondWithFilteredResult(_0x5c80e1,_0x2ccaf5))['catch'](handleError(_0x5c80e1,null));};exports[_0x5bbe('0xd0')]=function(_0x56c1e0,_0xf3194d,_0x172174){var _0x178839={};var _0x1ae806={};var _0x46b6a7;var _0x16dfc7;return db[_0x5bbe('0x59')][_0x5bbe('0xc7')]({'where':{'id':_0x56c1e0['params']['id']}})[_0x5bbe('0x1b')](handleEntityNotFound(_0xf3194d,null))['then'](function(_0x4691e8){if(_0x4691e8){_0x46b6a7=_0x4691e8;_0x1ae806[_0x5bbe('0x48')]=_[_0x5bbe('0x4c')](db['ChatInteraction'][_0x5bbe('0x44')]);_0x1ae806[_0x5bbe('0x4d')]=_[_0x5bbe('0x4c')](_0x56c1e0[_0x5bbe('0x4d')]);_0x1ae806[_0x5bbe('0x52')]=_[_0x5bbe('0x5f')](_0x1ae806[_0x5bbe('0x48')],_0x1ae806[_0x5bbe('0x4d')]);_0x178839[_0x5bbe('0x4e')]=_['intersection'](_0x1ae806[_0x5bbe('0x48')],qs[_0x5bbe('0x4f')](_0x56c1e0[_0x5bbe('0x4d')][_0x5bbe('0x4f')]));_0x178839[_0x5bbe('0x4e')]=_0x178839[_0x5bbe('0x4e')][_0x5bbe('0x6f')]?_0x178839[_0x5bbe('0x4e')]:_0x1ae806[_0x5bbe('0x48')];_0x178839[_0x5bbe('0x50')]=qs[_0x5bbe('0x51')](_0x56c1e0[_0x5bbe('0x4d')][_0x5bbe('0x51')]);_0x178839[_0x5bbe('0x53')]=qs['filters'](_[_0x5bbe('0xbf')](_0x56c1e0[_0x5bbe('0x4d')],_0x1ae806[_0x5bbe('0x52')]));if(_0x56c1e0['query'][_0x5bbe('0x39')]){_0x178839['where']=_[_0x5bbe('0x54')](_0x178839[_0x5bbe('0x53')],{'$or':_['map'](_0x178839[_0x5bbe('0x4e')],function(_0x2f67d2){var _0x421074={};_0x421074[_0x2f67d2]={'$like':'%'+_0x56c1e0[_0x5bbe('0x4d')][_0x5bbe('0x39')]+'%'};return _0x421074;})});}_0x178839=_[_0x5bbe('0x54')]({},_0x178839,_0x56c1e0[_0x5bbe('0x58')]);return _0x46b6a7[_0x5bbe('0xd0')](_0x178839);}})[_0x5bbe('0x1b')](function(_0x1eda6b){if(_0x1eda6b){_0x16dfc7=_0x1eda6b['length'];if(!_0x56c1e0['query']['hasOwnProperty'](_0x5bbe('0xc6'))){_0x178839[_0x5bbe('0x2c')]=qs[_0x5bbe('0x2c')](_0x56c1e0[_0x5bbe('0x4d')]['limit']);_0x178839[_0x5bbe('0x2b')]=qs[_0x5bbe('0x2b')](_0x56c1e0[_0x5bbe('0x4d')][_0x5bbe('0x2b')]);}return _0x46b6a7[_0x5bbe('0xd0')](_0x178839);}})['then'](function(_0x13e00a){if(_0x13e00a){return _0x13e00a?{'count':_0x16dfc7,'rows':_0x13e00a}:null;}})[_0x5bbe('0x1b')](respondWithResult(_0xf3194d,null))[_0x5bbe('0x5c')](handleError(_0xf3194d,null));};exports[_0x5bbe('0xd1')]=function(_0x36a4a7,_0x650292,_0x5d703c){var _0x3b561d={};var _0x5e03b9={};var _0x15dcca;var _0x5a7755;return db['User'][_0x5bbe('0xc7')]({'where':{'id':_0x36a4a7[_0x5bbe('0x5d')]['id']}})['then'](handleEntityNotFound(_0x650292,null))[_0x5bbe('0x1b')](function(_0x40eb1b){if(_0x40eb1b){_0x15dcca=_0x40eb1b;_0x5e03b9[_0x5bbe('0x48')]=_[_0x5bbe('0x4c')](db[_0x5bbe('0xd2')][_0x5bbe('0x44')]);_0x5e03b9[_0x5bbe('0x4d')]=_['keys'](_0x36a4a7[_0x5bbe('0x4d')]);_0x5e03b9[_0x5bbe('0x52')]=_[_0x5bbe('0x5f')](_0x5e03b9[_0x5bbe('0x48')],_0x5e03b9[_0x5bbe('0x4d')]);_0x3b561d[_0x5bbe('0x4e')]=_[_0x5bbe('0x5f')](_0x5e03b9[_0x5bbe('0x48')],qs[_0x5bbe('0x4f')](_0x36a4a7['query'][_0x5bbe('0x4f')]));_0x3b561d['attributes']=_0x3b561d['attributes'][_0x5bbe('0x6f')]?_0x3b561d[_0x5bbe('0x4e')]:_0x5e03b9[_0x5bbe('0x48')];_0x3b561d[_0x5bbe('0x50')]=qs[_0x5bbe('0x51')](_0x36a4a7['query'][_0x5bbe('0x51')]);_0x3b561d[_0x5bbe('0x53')]=qs['filters'](_[_0x5bbe('0xbf')](_0x36a4a7[_0x5bbe('0x4d')],_0x5e03b9[_0x5bbe('0x52')]));if(_0x36a4a7['query']['filter']){_0x3b561d[_0x5bbe('0x53')]=_['merge'](_0x3b561d[_0x5bbe('0x53')],{'$or':_[_0x5bbe('0x3b')](_0x3b561d['attributes'],function(_0x19077d){var _0x1dcbf4={};_0x1dcbf4[_0x19077d]={'$like':'%'+_0x36a4a7[_0x5bbe('0x4d')][_0x5bbe('0x39')]+'%'};return _0x1dcbf4;})});}_0x3b561d=_[_0x5bbe('0x54')]({},_0x3b561d,_0x36a4a7['options']);return _0x15dcca[_0x5bbe('0xd1')](_0x3b561d);}})[_0x5bbe('0x1b')](function(_0x50059b){if(_0x50059b){_0x5a7755=_0x50059b['length'];if(!_0x36a4a7[_0x5bbe('0x4d')][_0x5bbe('0xc5')]('nolimit')){_0x3b561d[_0x5bbe('0x2c')]=qs[_0x5bbe('0x2c')](_0x36a4a7[_0x5bbe('0x4d')]['limit']);_0x3b561d[_0x5bbe('0x2b')]=qs[_0x5bbe('0x2b')](_0x36a4a7['query'][_0x5bbe('0x2b')]);}return _0x15dcca[_0x5bbe('0xd1')](_0x3b561d);}})[_0x5bbe('0x1b')](function(_0x40888d){if(_0x40888d){return _0x40888d?{'count':_0x5a7755,'rows':_0x40888d}:null;}})['then'](respondWithResult(_0x650292,null))[_0x5bbe('0x5c')](handleError(_0x650292,null));};exports[_0x5bbe('0xd3')]=function(_0x130f32,_0x1776ab,_0x4d5def){var _0x2a1a33={'raw':!![],'where':{}};var _0x308c6e={};var _0x5e32d9={'count':0x0,'rows':[]};return db[_0x5bbe('0x59')][_0x5bbe('0xc7')]({'where':{'id':_0x130f32[_0x5bbe('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1776ab,null))[_0x5bbe('0x1b')](function(_0x5bc593){if(_0x5bc593){_0x308c6e[_0x5bbe('0x48')]=_['keys'](db[_0x5bbe('0xd4')][_0x5bbe('0x44')]);_0x308c6e[_0x5bbe('0x4d')]=_[_0x5bbe('0x4c')](_0x130f32[_0x5bbe('0x4d')]);_0x308c6e[_0x5bbe('0x52')]=_['intersection'](_0x308c6e[_0x5bbe('0x48')],_0x308c6e[_0x5bbe('0x4d')]);_0x2a1a33[_0x5bbe('0x4e')]=_[_0x5bbe('0x5f')](_0x308c6e[_0x5bbe('0x48')],qs[_0x5bbe('0x4f')](_0x130f32[_0x5bbe('0x4d')][_0x5bbe('0x4f')]));_0x2a1a33['attributes']=_0x2a1a33[_0x5bbe('0x4e')][_0x5bbe('0x6f')]?_0x2a1a33[_0x5bbe('0x4e')]:_0x308c6e[_0x5bbe('0x48')];if(!_0x130f32[_0x5bbe('0x4d')][_0x5bbe('0xc5')](_0x5bbe('0xc6'))){_0x2a1a33[_0x5bbe('0x2c')]=qs['limit'](_0x130f32[_0x5bbe('0x4d')][_0x5bbe('0x2c')]);_0x2a1a33['offset']=qs[_0x5bbe('0x2b')](_0x130f32[_0x5bbe('0x4d')][_0x5bbe('0x2b')]);}_0x2a1a33[_0x5bbe('0x50')]=qs[_0x5bbe('0x51')](_0x130f32[_0x5bbe('0x4d')][_0x5bbe('0x51')]);_0x2a1a33[_0x5bbe('0x53')]=qs[_0x5bbe('0x52')](_[_0x5bbe('0xbf')](_0x130f32['query'],_0x308c6e[_0x5bbe('0x52')]));_0x2a1a33[_0x5bbe('0x53')]['UserId']=_0x5bc593['id'];if(_0x130f32[_0x5bbe('0x4d')][_0x5bbe('0x39')]){_0x2a1a33[_0x5bbe('0x53')]=_[_0x5bbe('0x54')](_0x2a1a33['where'],{'$or':_['map'](_0x2a1a33['attributes'],function(_0x5b72e9){var _0x263d4f={};_0x263d4f[_0x5b72e9]={'$like':'%'+_0x130f32[_0x5bbe('0x4d')][_0x5bbe('0x39')]+'%'};return _0x263d4f;})});}_0x2a1a33=_['merge']({},_0x2a1a33,_0x130f32[_0x5bbe('0x58')]);return db[_0x5bbe('0xd4')][_0x5bbe('0x2a')]({'where':_0x2a1a33['where']})[_0x5bbe('0x1b')](function(_0xafac53){_0x5e32d9['count']=_0xafac53;if(_0x130f32['query'][_0x5bbe('0x60')]){_0x2a1a33[_0x5bbe('0x61')]=[{'all':!![]}];}return db[_0x5bbe('0xd4')][_0x5bbe('0x5a')](_0x2a1a33);})[_0x5bbe('0x1b')](function(_0x22fb13){_0x5e32d9[_0x5bbe('0x5b')]=_0x22fb13;return _0x5e32d9;});}})['then'](respondWithFilteredResult(_0x1776ab,_0x2a1a33))[_0x5bbe('0x5c')](handleError(_0x1776ab,null));};exports['getSmsInteractions']=function(_0x45f242,_0x17094c,_0x1a5bba){var _0x100464={};var _0xee9fd5={};var _0x32f196;var _0x562245;return db[_0x5bbe('0x59')]['findOne']({'where':{'id':_0x45f242[_0x5bbe('0x5d')]['id']}})[_0x5bbe('0x1b')](handleEntityNotFound(_0x17094c,null))[_0x5bbe('0x1b')](function(_0x43e7a3){if(_0x43e7a3){_0x32f196=_0x43e7a3;_0xee9fd5[_0x5bbe('0x48')]=_[_0x5bbe('0x4c')](db[_0x5bbe('0xd5')][_0x5bbe('0x44')]);_0xee9fd5['query']=_[_0x5bbe('0x4c')](_0x45f242[_0x5bbe('0x4d')]);_0xee9fd5[_0x5bbe('0x52')]=_[_0x5bbe('0x5f')](_0xee9fd5[_0x5bbe('0x48')],_0xee9fd5[_0x5bbe('0x4d')]);_0x100464[_0x5bbe('0x4e')]=_[_0x5bbe('0x5f')](_0xee9fd5['model'],qs[_0x5bbe('0x4f')](_0x45f242[_0x5bbe('0x4d')]['fields']));_0x100464[_0x5bbe('0x4e')]=_0x100464[_0x5bbe('0x4e')][_0x5bbe('0x6f')]?_0x100464['attributes']:_0xee9fd5[_0x5bbe('0x48')];_0x100464[_0x5bbe('0x50')]=qs['sort'](_0x45f242[_0x5bbe('0x4d')][_0x5bbe('0x51')]);_0x100464[_0x5bbe('0x53')]=qs[_0x5bbe('0x52')](_[_0x5bbe('0xbf')](_0x45f242[_0x5bbe('0x4d')],_0xee9fd5['filters']));if(_0x45f242['query'][_0x5bbe('0x39')]){_0x100464['where']=_[_0x5bbe('0x54')](_0x100464[_0x5bbe('0x53')],{'$or':_[_0x5bbe('0x3b')](_0x100464[_0x5bbe('0x4e')],function(_0x38a263){var _0x1ccd85={};_0x1ccd85[_0x38a263]={'$like':'%'+_0x45f242[_0x5bbe('0x4d')][_0x5bbe('0x39')]+'%'};return _0x1ccd85;})});}_0x100464=_['merge']({},_0x100464,_0x45f242[_0x5bbe('0x58')]);return _0x32f196['getSmsInteractions'](_0x100464);}})[_0x5bbe('0x1b')](function(_0x177792){if(_0x177792){_0x562245=_0x177792[_0x5bbe('0x6f')];if(!_0x45f242[_0x5bbe('0x4d')]['hasOwnProperty'](_0x5bbe('0xc6'))){_0x100464[_0x5bbe('0x2c')]=qs[_0x5bbe('0x2c')](_0x45f242[_0x5bbe('0x4d')][_0x5bbe('0x2c')]);_0x100464['offset']=qs[_0x5bbe('0x2b')](_0x45f242[_0x5bbe('0x4d')][_0x5bbe('0x2b')]);}return _0x32f196[_0x5bbe('0xd6')](_0x100464);}})['then'](function(_0x1907c2){if(_0x1907c2){return _0x1907c2?{'count':_0x562245,'rows':_0x1907c2}:null;}})['then'](respondWithResult(_0x17094c,null))[_0x5bbe('0x5c')](handleError(_0x17094c,null));};exports['getFaxInteractions']=function(_0x109e8b,_0x53b76d,_0x1a610e){var _0x18cb44={};var _0x387d78={};var _0x34fdf8;var _0x22512f;return db[_0x5bbe('0x59')][_0x5bbe('0xc7')]({'where':{'id':_0x109e8b[_0x5bbe('0x5d')]['id']}})[_0x5bbe('0x1b')](handleEntityNotFound(_0x53b76d,null))[_0x5bbe('0x1b')](function(_0x1019cd){if(_0x1019cd){_0x34fdf8=_0x1019cd;_0x387d78[_0x5bbe('0x48')]=_['keys'](db[_0x5bbe('0xd7')][_0x5bbe('0x44')]);_0x387d78[_0x5bbe('0x4d')]=_['keys'](_0x109e8b['query']);_0x387d78[_0x5bbe('0x52')]=_[_0x5bbe('0x5f')](_0x387d78[_0x5bbe('0x48')],_0x387d78['query']);_0x18cb44[_0x5bbe('0x4e')]=_[_0x5bbe('0x5f')](_0x387d78[_0x5bbe('0x48')],qs[_0x5bbe('0x4f')](_0x109e8b[_0x5bbe('0x4d')][_0x5bbe('0x4f')]));_0x18cb44[_0x5bbe('0x4e')]=_0x18cb44[_0x5bbe('0x4e')]['length']?_0x18cb44[_0x5bbe('0x4e')]:_0x387d78[_0x5bbe('0x48')];_0x18cb44[_0x5bbe('0x50')]=qs['sort'](_0x109e8b[_0x5bbe('0x4d')][_0x5bbe('0x51')]);_0x18cb44[_0x5bbe('0x53')]=qs[_0x5bbe('0x52')](_['pick'](_0x109e8b[_0x5bbe('0x4d')],_0x387d78[_0x5bbe('0x52')]));if(_0x109e8b[_0x5bbe('0x4d')]['filter']){_0x18cb44[_0x5bbe('0x53')]=_[_0x5bbe('0x54')](_0x18cb44[_0x5bbe('0x53')],{'$or':_[_0x5bbe('0x3b')](_0x18cb44['attributes'],function(_0x1835b0){var _0x364865={};_0x364865[_0x1835b0]={'$like':'%'+_0x109e8b[_0x5bbe('0x4d')][_0x5bbe('0x39')]+'%'};return _0x364865;})});}_0x18cb44=_[_0x5bbe('0x54')]({},_0x18cb44,_0x109e8b[_0x5bbe('0x58')]);return _0x34fdf8[_0x5bbe('0xd8')](_0x18cb44);}})[_0x5bbe('0x1b')](function(_0x20c2e1){if(_0x20c2e1){_0x22512f=_0x20c2e1['length'];if(!_0x109e8b[_0x5bbe('0x4d')]['hasOwnProperty'](_0x5bbe('0xc6'))){_0x18cb44[_0x5bbe('0x2c')]=qs['limit'](_0x109e8b[_0x5bbe('0x4d')][_0x5bbe('0x2c')]);_0x18cb44[_0x5bbe('0x2b')]=qs[_0x5bbe('0x2b')](_0x109e8b[_0x5bbe('0x4d')][_0x5bbe('0x2b')]);}return _0x34fdf8[_0x5bbe('0xd8')](_0x18cb44);}})[_0x5bbe('0x1b')](function(_0x569941){if(_0x569941){return _0x569941?{'count':_0x22512f,'rows':_0x569941}:null;}})[_0x5bbe('0x1b')](respondWithResult(_0x53b76d,null))[_0x5bbe('0x5c')](handleError(_0x53b76d,null));};exports['getWhatsappInteractions']=function(_0x4e9cd2,_0x4d4b57,_0x49470a){var _0x4a055c={};var _0x1a5b74={};var _0x49cf31;var _0x14dc39;return db['User'][_0x5bbe('0xc7')]({'where':{'id':_0x4e9cd2['params']['id']}})[_0x5bbe('0x1b')](handleEntityNotFound(_0x4d4b57,null))[_0x5bbe('0x1b')](function(_0x1d1a9c){if(_0x1d1a9c){_0x49cf31=_0x1d1a9c;_0x1a5b74[_0x5bbe('0x48')]=_[_0x5bbe('0x4c')](db[_0x5bbe('0xd9')][_0x5bbe('0x44')]);_0x1a5b74['query']=_[_0x5bbe('0x4c')](_0x4e9cd2[_0x5bbe('0x4d')]);_0x1a5b74['filters']=_[_0x5bbe('0x5f')](_0x1a5b74[_0x5bbe('0x48')],_0x1a5b74[_0x5bbe('0x4d')]);_0x4a055c[_0x5bbe('0x4e')]=_[_0x5bbe('0x5f')](_0x1a5b74[_0x5bbe('0x48')],qs[_0x5bbe('0x4f')](_0x4e9cd2[_0x5bbe('0x4d')][_0x5bbe('0x4f')]));_0x4a055c[_0x5bbe('0x4e')]=_0x4a055c[_0x5bbe('0x4e')][_0x5bbe('0x6f')]?_0x4a055c[_0x5bbe('0x4e')]:_0x1a5b74['model'];_0x4a055c[_0x5bbe('0x50')]=qs['sort'](_0x4e9cd2[_0x5bbe('0x4d')][_0x5bbe('0x51')]);_0x4a055c[_0x5bbe('0x53')]=qs[_0x5bbe('0x52')](_['pick'](_0x4e9cd2[_0x5bbe('0x4d')],_0x1a5b74[_0x5bbe('0x52')]));if(_0x4e9cd2[_0x5bbe('0x4d')]['filter']){_0x4a055c[_0x5bbe('0x53')]=_[_0x5bbe('0x54')](_0x4a055c['where'],{'$or':_[_0x5bbe('0x3b')](_0x4a055c['attributes'],function(_0x233bb2){var _0x586994={};_0x586994[_0x233bb2]={'$like':'%'+_0x4e9cd2[_0x5bbe('0x4d')][_0x5bbe('0x39')]+'%'};return _0x586994;})});}_0x4a055c=_[_0x5bbe('0x54')]({},_0x4a055c,_0x4e9cd2['options']);return _0x49cf31[_0x5bbe('0xda')](_0x4a055c);}})['then'](function(_0xb71aca){if(_0xb71aca){_0x14dc39=_0xb71aca[_0x5bbe('0x6f')];if(!_0x4e9cd2[_0x5bbe('0x4d')][_0x5bbe('0xc5')](_0x5bbe('0xc6'))){_0x4a055c[_0x5bbe('0x2c')]=qs[_0x5bbe('0x2c')](_0x4e9cd2['query'][_0x5bbe('0x2c')]);_0x4a055c[_0x5bbe('0x2b')]=qs[_0x5bbe('0x2b')](_0x4e9cd2[_0x5bbe('0x4d')][_0x5bbe('0x2b')]);}return _0x49cf31[_0x5bbe('0xda')](_0x4a055c);}})[_0x5bbe('0x1b')](function(_0x490b0c){if(_0x490b0c){return _0x490b0c?{'count':_0x14dc39,'rows':_0x490b0c}:null;}})[_0x5bbe('0x1b')](respondWithResult(_0x4d4b57,null))[_0x5bbe('0x5c')](handleError(_0x4d4b57,null));};exports[_0x5bbe('0xdb')]=function(_0x24bdc2,_0x155a59,_0x4c7e55){var _0x306a92;var _0xa771cc;var _0xc938a4;var _0x4e97d8=!_[_0x5bbe('0x6b')](_0x24bdc2[_0x5bbe('0x5d')]['id'])?_0x24bdc2[_0x5bbe('0x5d')]['id']:!_[_0x5bbe('0x6b')](_0x24bdc2[_0x5bbe('0x36')]['id'])?_0x24bdc2[_0x5bbe('0x36')]['id']:null;return db[_0x5bbe('0x59')][_0x5bbe('0x3e')]({'where':{'id':_0x4e97d8,'role':{'$or':[_0x5bbe('0x34'),_0x5bbe('0x36'),_0x5bbe('0x38')]}},'attributes':['id',_0x5bbe('0x41'),'phone',_0x5bbe('0xdc'),_0x5bbe('0x33'),_0x5bbe('0x66'),_0x5bbe('0xa1')]})['then'](function(_0x5448d){if(_0x5448d){if(_0x5448d['role']==='agent'){_0x306a92=_0x5448d;if(_0x24bdc2['body']['interface']){_0xc938a4=util[_0x5bbe('0xdd')](_0x5bbe('0xde'),_0x306a92[_0x24bdc2[_0x5bbe('0x62')][_0x5bbe('0xa3')]]);}else if(_0x24bdc2[_0x5bbe('0x62')][_0x5bbe('0xdf')]){_0xc938a4=util[_0x5bbe('0xdd')](_0x5bbe('0xb0'),_0x24bdc2[_0x5bbe('0x62')]['intrf']);}else{_0xc938a4=util[_0x5bbe('0xdd')](_0x5bbe('0xb0'),_0x306a92['name']);}socket['to'](util['format']('user:%s',_0x306a92['name']))['emit']('user:forcelogout',{'ip':_0x24bdc2[_0x5bbe('0xe0')][_0x5bbe('0xe1')]||_0x24bdc2[_0x5bbe('0xe2')]['remoteAddress']||_0x24bdc2[_0x5bbe('0xe3')][_0x5bbe('0xe4')]||_0x24bdc2[_0x5bbe('0xe2')]['socket'][_0x5bbe('0xe4')]});return db[_0x5bbe('0xb6')][_0x5bbe('0x31')]({'where':{'membername':_0x306a92[_0x5bbe('0x41')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x5bbe('0x96'))](_0x5bbe('0xe5'));}})[_0x5bbe('0x1b')](function(){if(_0x306a92){return _0x306a92[_0x5bbe('0xe6')]({'raw':!![]});}})[_0x5bbe('0x1b')](function(_0x4cdb7c){if(_0x306a92){var _0x447c02=[];if(_0x4cdb7c){_0xa771cc=_0x4cdb7c;if(_0xa771cc['length']){for(var _0x59f6d3=0x0;_0x59f6d3<_0xa771cc[_0x5bbe('0x6f')];_0x59f6d3++){_0x447c02[_0x5bbe('0x8c')]({'membername':_0x306a92[_0x5bbe('0x41')],'UserId':_0x306a92['id'],'queue_name':_0xa771cc[_0x59f6d3][_0x5bbe('0x41')],'VoiceQueueId':_0xa771cc[_0x59f6d3]['id'],'interface':_0xc938a4,'paused':_0x306a92[_0x5bbe('0xa1')]||![],'penalty':_0xa771cc[_0x59f6d3][_0x5bbe('0xe7')]||0x0});}return BPromise[_0x5bbe('0x8d')](_0x447c02,function(_0x2d5ff3){return db['UserVoiceQueueRt'][_0x5bbe('0xe8')](_0x2d5ff3);});}}}})[_0x5bbe('0x1b')](function(){if(_0x306a92){return db[_0x5bbe('0xe9')][_0x5bbe('0x5a')]({'where':{'membername':_0x306a92[_0x5bbe('0x41')],'exitAt':null}});}})['then'](function(_0x1d7c2a){if(_0x306a92){var _0x14e42d=[];_0x1d7c2a[_0x5bbe('0xea')](function(_0x49ee5c){_0x14e42d[_0x5bbe('0x8c')](_0x49ee5c['update']({'exitAt':moment()[_0x5bbe('0xdd')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x5bbe('0x8b')](_0x14e42d);}})[_0x5bbe('0x1b')](function(){if(_0x306a92){var _0x4a40bb=[];var _0x320c59=[];var _0x519671=utils[_0x5bbe('0xeb')]();var _0x456853={'membername':_0x306a92[_0x5bbe('0x41')],'interface':_0xc938a4,'enterAt':moment()['format'](_0x5bbe('0xec')),'role':_0x306a92['role'],'internal':_0x306a92[_0x5bbe('0x66')]};_0x519671[_0x5bbe('0xea')](function(_0x41433a){_0x4a40bb[_0x5bbe('0x8c')](_[_0x5bbe('0x54')]({'channel':_0x41433a,'type':_0x5bbe('0xed'),'data1':_0x24bdc2[_0x5bbe('0x62')][_0x5bbe('0xee')],'data2':_0xc938a4},_0x456853));if(_0x306a92[_0x5bbe('0xa1')]){_0x320c59['push'](_[_0x5bbe('0x54')]({'channel':_0x41433a,'type':'PAUSE','data1':_0x5bbe('0xef')},_0x456853));}});return db['MemberReport'][_0x5bbe('0x87')](_0x4a40bb[_0x5bbe('0xf0')](_0x320c59),{'individualHooks':!![]});}})[_0x5bbe('0x1b')](function(){if(_0x306a92){return _0x306a92[_0x5bbe('0x30')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x306a92[_0x5bbe('0xa1')]||![],'mailPause':_0x306a92['loginInPause']||![],'chatPause':_0x306a92[_0x5bbe('0xa1')]||![],'faxPause':_0x306a92[_0x5bbe('0xa1')]||![],'smsPause':_0x306a92[_0x5bbe('0xa1')]||![],'openchannelPause':_0x306a92[_0x5bbe('0xa1')]||![],'whatsappPause':_0x306a92[_0x5bbe('0xa1')]||![],'pauseType':_0x306a92[_0x5bbe('0xa1')]?_0x5bbe('0xef'):null,'interface':_0xc938a4,'lastPauseAt':moment()['format'](_0x5bbe('0xec'))});}})[_0x5bbe('0x1b')](function(_0x1520d0){if(_0x24bdc2[_0x5bbe('0xf1')]){return _0x4c7e55();}else{return BPromise[_0x5bbe('0xf2')](_0x1520d0)['then'](respondWithResult(_0x155a59,null));}})[_0x5bbe('0x5c')](handleError(_0x155a59,null));};exports[_0x5bbe('0xf3')]=function(_0x494a37,_0x1d0c85,_0x406e48){var _0x118d8d;return db[_0x5bbe('0x59')][_0x5bbe('0x3e')]({'where':{'id':_0x494a37[_0x5bbe('0x5d')]['id'],'role':_0x5bbe('0x38')},'attributes':['id','name','role']})[_0x5bbe('0x1b')](handleEntityNotFound(_0x1d0c85,null))[_0x5bbe('0x1b')](function(_0x4847b2){if(_0x4847b2){_0x118d8d=_0x4847b2;return db['UserVoiceQueueRt'][_0x5bbe('0x31')]({'where':{'membername':_0x118d8d[_0x5bbe('0x41')]},'individualHooks':!![]});}})[_0x5bbe('0x1b')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x118d8d[_0x5bbe('0x41')],'exitAt':null}});})[_0x5bbe('0x1b')](function(_0x5e84e3){var _0xe1888b=[];_0x5e84e3['forEach'](function(_0x253b7a){_0xe1888b['push'](_0x253b7a[_0x5bbe('0x30')]({'exitAt':moment()[_0x5bbe('0xdd')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x5bbe('0x8b')](_0xe1888b);})[_0x5bbe('0x1b')](function(){return _0x118d8d[_0x5bbe('0x30')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x1d0c85,null))['catch'](handleError(_0x1d0c85,null));};exports[_0x5bbe('0xf4')]=function(_0x5be466,_0x5744c6,_0x1f1cf8){var _0x16f278;return db[_0x5bbe('0xb6')]['update']({'paused':0x1},{'where':{'UserId':_0x5be466['params']['id']},'individualHooks':!![]})[_0x5bbe('0x1b')](function(){return db[_0x5bbe('0x59')][_0x5bbe('0x3e')]({'where':{'id':_0x5be466[_0x5bbe('0x5d')]['id'],'role':_0x5bbe('0x38')},'attributes':['id',_0x5bbe('0x41'),'role',_0x5bbe('0x66'),_0x5bbe('0xa3')]});})[_0x5bbe('0x1b')](handleEntityNotFound(_0x5744c6,null))['then'](function(_0x46e9ec){if(_0x46e9ec){_0x16f278=_0x46e9ec;return respondWithRpcPromise('QueuePause',_0x5bbe('0xf4'),{'id':_0x16f278['id'],'name':_0x16f278[_0x5bbe('0x41')],'pause':!![]});}})[_0x5bbe('0x1b')](function(){if(_0x16f278){return db[_0x5bbe('0xe9')]['findAll']({'where':{'membername':_0x16f278['name'],'type':_0x5bbe('0xf5'),'exitAt':null}});}})['then'](function(_0xd68cb1){if(_0xd68cb1['length']){var _0x3a3181=moment()[_0x5bbe('0xdd')](_0x5bbe('0xec'));for(var _0x36133c=0x0,_0x3de583=_0xd68cb1[_0x5bbe('0x6f')];_0x36133c<_0x3de583;_0x36133c++){_0xd68cb1[_0x36133c][_0x5bbe('0xf6')]({'exitAt':_0x3a3181});}}})[_0x5bbe('0x1b')](function(){var _0x4b08de=[];var _0x39616d=utils[_0x5bbe('0xeb')]();_0x39616d[_0x5bbe('0xea')](function(_0x101e37){_0x4b08de[_0x5bbe('0x8c')]({'channel':_0x101e37,'membername':_0x16f278['name'],'interface':_[_0x5bbe('0x6b')](_0x16f278['interface'])?util[_0x5bbe('0xdd')](_0x5bbe('0xb0'),_0x16f278[_0x5bbe('0x41')]):_0x16f278['interface'],'type':_0x5bbe('0xf5'),'enterAt':moment()[_0x5bbe('0xdd')](_0x5bbe('0xec')),'data1':_0x5be466[_0x5bbe('0x62')][_0x5bbe('0x46')]||'DEFAULT\x20PAUSE','role':_0x16f278[_0x5bbe('0x33')],'internal':_0x16f278[_0x5bbe('0x66')]});});return db[_0x5bbe('0xe9')][_0x5bbe('0x87')](_0x4b08de,{'individualHooks':!![]});})[_0x5bbe('0x1b')](function(){return _0x16f278[_0x5bbe('0x30')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5be466[_0x5bbe('0x62')][_0x5bbe('0x46')]||_0x5bbe('0xf7'),'lastPauseAt':moment()['format'](_0x5bbe('0xec'))});})[_0x5bbe('0x1b')](respondWithResult(_0x5744c6,null))[_0x5bbe('0x5c')](handleError(_0x5744c6,null));};exports[_0x5bbe('0xf8')]=function(_0x22e460,_0xf0b8e9,_0x27c7ed){var _0x59b75f;return db[_0x5bbe('0x59')]['find']({'where':{'id':_0x22e460[_0x5bbe('0x5d')]['id']},'attributes':['id','name',_0x5bbe('0x33'),_0x5bbe('0xa2'),_0x5bbe('0xf9'),_0x5bbe('0xfa'),_0x5bbe('0xfb'),_0x5bbe('0xfc'),_0x5bbe('0xfd'),_0x5bbe('0xfe'),_0x5bbe('0xff'),_0x5bbe('0x100')]})[_0x5bbe('0x1b')](handleEntityNotFound(_0xf0b8e9,null))['then'](function(_0x394f1c){if(_0x394f1c){_0x59b75f=_0x394f1c;if(_0x22e460[_0x5bbe('0x62')][_0x5bbe('0xa0')]&&!utils[_0x5bbe('0xb2')](_0x22e460['body'][_0x5bbe('0xa0')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}switch(_0x22e460[_0x5bbe('0x62')][_0x5bbe('0xa0')]){case _0x5bbe('0xad'):return respondWithRpcPromise(_0x5bbe('0x101'),'unpause',{'id':_0x59b75f['id'],'name':_0x59b75f[_0x5bbe('0x41')],'pause':![]})[_0x5bbe('0x1b')](function(){return db[_0x5bbe('0xb6')][_0x5bbe('0x30')]({'paused':0x0},{'where':{'UserId':_0x59b75f['id']},'individualHooks':!![]});})[_0x5bbe('0x1b')](function(){return db[_0x5bbe('0xe9')][_0x5bbe('0x3e')]({'where':{'channel':_0x22e460[_0x5bbe('0x62')]['channel'],'membername':_0x59b75f[_0x5bbe('0x41')],'type':_0x5bbe('0xf5'),'exitAt':null}});})[_0x5bbe('0x1b')](function(_0x5d3902){if(_0x5d3902){return _0x5d3902['update']({'exitAt':moment()['format'](_0x5bbe('0xec')),'data2':_0x5bbe('0x102')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x59b75f[_0x5bbe('0x30')]({'voicePause':![]});});case _0x5bbe('0x103'):case'chat':case _0x5bbe('0x104'):case _0x5bbe('0x105'):case'whatsapp':case _0x5bbe('0x106'):return db[_0x5bbe('0xe9')]['find']({'where':{'channel':_0x22e460['body'][_0x5bbe('0xa0')],'membername':_0x59b75f['name'],'type':_0x5bbe('0xf5'),'exitAt':null}})[_0x5bbe('0x1b')](function(_0x220a8f){if(_0x220a8f){return _0x220a8f[_0x5bbe('0x30')]({'exitAt':moment()[_0x5bbe('0xdd')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x5bbe('0x1b')](function(){var _0x8dcd07={};_[_0x5bbe('0x107')](_0x8dcd07,util[_0x5bbe('0xdd')]('%s%s',_0x22e460[_0x5bbe('0x62')][_0x5bbe('0xa0')],'Pause'),![]);return _0x59b75f['update'](_0x8dcd07);});default:return respondWithRpcPromise('QueuePause',_0x5bbe('0xf8'),{'id':_0x59b75f['id'],'name':_0x59b75f[_0x5bbe('0x41')],'pause':![]})[_0x5bbe('0x1b')](function(){return db[_0x5bbe('0xb6')][_0x5bbe('0x30')]({'paused':0x0},{'where':{'UserId':_0x59b75f['id']}});})[_0x5bbe('0x1b')](function(){return db[_0x5bbe('0xe9')]['findAll']({'where':{'membername':_0x59b75f[_0x5bbe('0x41')],'type':_0x5bbe('0xf5'),'exitAt':null}});})['then'](function(_0x2967f6){var _0x1c1b2b=[];_0x2967f6[_0x5bbe('0xea')](function(_0x17fe71){_0x1c1b2b[_0x5bbe('0x8c')](_0x17fe71[_0x5bbe('0x30')]({'exitAt':moment()[_0x5bbe('0xdd')](_0x5bbe('0xec')),'data2':_0x5bbe('0x102')}));});return BPromise[_0x5bbe('0x8b')](_0x1c1b2b);})['then'](function(){return _0x59b75f['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x5bbe('0x1b')](respondWithResult(_0xf0b8e9,null))[_0x5bbe('0x5c')](handleError(_0xf0b8e9,null));};exports[_0x5bbe('0x108')]=function(_0x281367,_0x581258,_0x19e75f){var _0x4f7b3e={};var _0x3cb247={};var _0x525e52;var _0xd9f2a1;return db[_0x5bbe('0x59')][_0x5bbe('0xc7')]({'where':{'id':_0x281367[_0x5bbe('0x5d')]['id']}})[_0x5bbe('0x1b')](handleEntityNotFound(_0x581258,null))[_0x5bbe('0x1b')](function(_0x2669dc){if(_0x2669dc){_0x525e52=_0x2669dc;_0x3cb247[_0x5bbe('0x48')]=_[_0x5bbe('0x4c')](db[_0x5bbe('0x109')][_0x5bbe('0x44')]);_0x3cb247[_0x5bbe('0x4d')]=_['keys'](_0x281367[_0x5bbe('0x4d')]);_0x3cb247[_0x5bbe('0x52')]=_[_0x5bbe('0x5f')](_0x3cb247[_0x5bbe('0x48')],_0x3cb247[_0x5bbe('0x4d')]);_0x4f7b3e['attributes']=_[_0x5bbe('0x5f')](_0x3cb247[_0x5bbe('0x48')],qs['fields'](_0x281367['query']['fields']));_0x4f7b3e[_0x5bbe('0x4e')]=_0x4f7b3e[_0x5bbe('0x4e')]['length']?_0x4f7b3e[_0x5bbe('0x4e')]:_0x3cb247[_0x5bbe('0x48')];_0x4f7b3e['order']=qs[_0x5bbe('0x51')](_0x281367['query'][_0x5bbe('0x51')]);_0x4f7b3e[_0x5bbe('0x53')]=qs['filters'](_[_0x5bbe('0xbf')](_0x281367[_0x5bbe('0x4d')],_0x3cb247[_0x5bbe('0x52')]));if(_0x281367[_0x5bbe('0x4d')][_0x5bbe('0x39')]){_0x4f7b3e[_0x5bbe('0x53')]=_[_0x5bbe('0x54')](_0x4f7b3e['where'],{'$or':_[_0x5bbe('0x3b')](_0x4f7b3e['attributes'],function(_0x13220b){var _0x41eb7b={};_0x41eb7b[_0x13220b]={'$like':'%'+_0x281367[_0x5bbe('0x4d')][_0x5bbe('0x39')]+'%'};return _0x41eb7b;})});}_0x4f7b3e=_[_0x5bbe('0x54')]({},_0x4f7b3e,_0x281367[_0x5bbe('0x58')]);return _0x525e52[_0x5bbe('0x108')](_0x4f7b3e);}})['then'](function(_0x8b40bb){if(_0x8b40bb){_0xd9f2a1=_0x8b40bb['length'];if(!_0x281367[_0x5bbe('0x4d')][_0x5bbe('0xc5')](_0x5bbe('0xc6'))){_0x4f7b3e[_0x5bbe('0x2c')]=qs[_0x5bbe('0x2c')](_0x281367[_0x5bbe('0x4d')][_0x5bbe('0x2c')]);_0x4f7b3e[_0x5bbe('0x2b')]=qs['offset'](_0x281367['query'][_0x5bbe('0x2b')]);}return _0x525e52['getTeams'](_0x4f7b3e);}})[_0x5bbe('0x1b')](function(_0x593771){if(_0x593771){return _0x593771?{'count':_0xd9f2a1,'rows':_0x593771}:null;}})[_0x5bbe('0x1b')](respondWithResult(_0x581258,null))[_0x5bbe('0x5c')](handleError(_0x581258,null));};exports[_0x5bbe('0x10a')]=function(_0x29955c,_0x1f1432){return db[_0x5bbe('0x59')][_0x5bbe('0x3e')]({'where':{'id':_0x29955c['params']['id']}})[_0x5bbe('0x1b')](handleEntityNotFound(_0x1f1432,null))['then'](function(_0x37d862){if(_0x37d862){var _0x2357b3=_0x37d862[_0x5bbe('0x32')]({'plain':!![]});return _0x37d862[_0x5bbe('0x10a')](_0x29955c['body']['ids'],_['omit'](_0x29955c[_0x5bbe('0x62')],[_0x5bbe('0x65'),'id'])||{})['then'](function(){for(var _0x429aa=0x0;_0x429aa<_0x29955c['body'][_0x5bbe('0x65')][_0x5bbe('0x6f')];_0x429aa++){var _0x5cb93a=[];db[_0x5bbe('0x109')][_0x5bbe('0xc7')]({'where':{'id':_0x29955c[_0x5bbe('0x62')][_0x5bbe('0x65')][_0x429aa]}})[_0x5bbe('0x1b')](function(_0x3147e9){_0x5cb93a[_0x5bbe('0x8c')](_0x3147e9[_0x5bbe('0xe6')]()['then'](function(_0x5e719d){for(var _0x2931b7=0x0;_0x2931b7<_0x5e719d[_0x5bbe('0x6f')];_0x2931b7++){_0x5e719d[_0x2931b7][_0x5bbe('0x10b')](_0x5bbe('0xa0'),_0x5bbe('0x10c'));}return _0x5e719d;}));_0x5cb93a[_0x5bbe('0x8c')](_0x3147e9[_0x5bbe('0x10d')]()[_0x5bbe('0x1b')](function(_0x377397){for(var _0x5c81b1=0x0;_0x5c81b1<_0x377397[_0x5bbe('0x6f')];_0x5c81b1++){_0x377397[_0x5c81b1][_0x5bbe('0x10b')]('channel',_0x5bbe('0x10e'));}return _0x377397;}));_0x5cb93a[_0x5bbe('0x8c')](_0x3147e9[_0x5bbe('0x10f')]()['then'](function(_0x68019b){for(var _0x50ea4b=0x0;_0x50ea4b<_0x68019b[_0x5bbe('0x6f')];_0x50ea4b++){_0x68019b[_0x50ea4b][_0x5bbe('0x10b')](_0x5bbe('0xa0'),'Mail');}return _0x68019b;}));_0x5cb93a[_0x5bbe('0x8c')](_0x3147e9[_0x5bbe('0x110')]()[_0x5bbe('0x1b')](function(_0x55a730){for(var _0xa96c0c=0x0;_0xa96c0c<_0x55a730[_0x5bbe('0x6f')];_0xa96c0c++){_0x55a730[_0xa96c0c][_0x5bbe('0x10b')]('channel',_0x5bbe('0x111'));}return _0x55a730;}));_0x5cb93a[_0x5bbe('0x8c')](_0x3147e9[_0x5bbe('0x112')]()[_0x5bbe('0x1b')](function(_0x566c8c){for(var _0x461792=0x0;_0x461792<_0x566c8c['length'];_0x461792++){_0x566c8c[_0x461792][_0x5bbe('0x10b')](_0x5bbe('0xa0'),'Whatsapp');}return _0x566c8c;}));_0x5cb93a[_0x5bbe('0x8c')](_0x3147e9['getFaxQueues']()[_0x5bbe('0x1b')](function(_0x31937e){for(var _0x5db09f=0x0;_0x5db09f<_0x31937e[_0x5bbe('0x6f')];_0x5db09f++){_0x31937e[_0x5db09f]['setDataValue'](_0x5bbe('0xa0'),_0x5bbe('0x113'));}return _0x31937e;}));_0x5cb93a[_0x5bbe('0x8c')](_0x3147e9[_0x5bbe('0x114')]()[_0x5bbe('0x1b')](function(_0x153713){for(var _0x3a6bd1=0x0;_0x3a6bd1<_0x153713[_0x5bbe('0x6f')];_0x3a6bd1++){_0x153713[_0x3a6bd1][_0x5bbe('0x10b')](_0x5bbe('0xa0'),_0x5bbe('0x115'));}return _0x153713;}));return BPromise[_0x5bbe('0x8b')](_0x5cb93a);})[_0x5bbe('0x1b')](function(_0x3aec53){var _0x5cd7f9=_[_0x5bbe('0x116')](_0x3aec53);_0x5cb93a=[];return db[_0x5bbe('0x55')][_0x5bbe('0x117')](function(_0x17b167){for(var _0x4173a7=0x0;_0x4173a7<_0x5cd7f9[_0x5bbe('0x6f')];_0x4173a7++){_0x5cb93a[_0x5bbe('0x8c')](_0x5cd7f9[_0x4173a7][_0x5bbe('0x118')](_0x2357b3['id']),{'transaction':_0x17b167});}return BPromise[_0x5bbe('0x8b')](_0x5cb93a)[_0x5bbe('0x1b')](function(){if(_0x2357b3[_0x5bbe('0xaf')]){return BPromise[_0x5bbe('0x8d')](_[_0x5bbe('0x39')](_0x5cd7f9,function(_0x40ccb6){return _0x40ccb6['getDataValue'](_0x5bbe('0xa0'))==='Voice';}),function(_0x4fb00c){return db[_0x5bbe('0xb6')][_0x5bbe('0xe8')]({'membername':_0x2357b3[_0x5bbe('0x41')],'UserId':_0x2357b3['id'],'queue_name':_0x4fb00c[_0x5bbe('0x41')],'VoiceQueueId':_0x4fb00c['id'],'interface':_[_0x5bbe('0x6b')](_0x2357b3[_0x5bbe('0xa3')])?util['format'](_0x5bbe('0xb0'),_0x2357b3[_0x5bbe('0x41')]):_0x2357b3[_0x5bbe('0xa3')],'paused':_0x2357b3[_0x5bbe('0xa2')]||![],'penalty':_0x2357b3[_0x5bbe('0xa7')]},{'transaction':_0x17b167});});}else{return;}})[_0x5bbe('0x1b')](function(){for(var _0x1b9535=0x0;_0x1b9535<_0x5cd7f9['length'];_0x1b9535++){var _0x30d0f9=_0x5cd7f9[_0x1b9535][_0x5bbe('0x119')](_0x5bbe('0xa0'));var _0x403279=_0x30d0f9+_0x5bbe('0xb4');socket[_0x5bbe('0xab')](_0x5bbe('0x36')+_0x30d0f9+'Queue:save',{'UserId':_0x2357b3['id'],['queueField']:_0x5cd7f9[_0x1b9535]['id']});}});});});}});}})[_0x5bbe('0x1b')](respondWithStatusCode(_0x1f1432,null))[_0x5bbe('0x5c')](handleError(_0x1f1432,null));};exports['removeTeams']=function(_0x285318,_0x3ae7e6){return db[_0x5bbe('0x59')]['findOne']({'where':{'id':_0x285318[_0x5bbe('0x5d')]['id']}})[_0x5bbe('0x1b')](handleEntityNotFound(_0x3ae7e6,null))[_0x5bbe('0x1b')](function(_0x3f3828){if(_0x3f3828){var _0x56f41f=_0x3f3828[_0x5bbe('0x32')]({'plain':!![]});var _0x3cf715=_0x285318[_0x5bbe('0x4d')]['ids'];return _0x3f3828[_0x5bbe('0x11a')](_0x3cf715)['then'](function(){for(var _0x21ecd4=0x0;_0x21ecd4<_0x3cf715[_0x5bbe('0x6f')];_0x21ecd4++){var _0x3799d0=[];db[_0x5bbe('0x109')][_0x5bbe('0xc7')]({'where':{'id':_0x3cf715[_0x21ecd4]}})[_0x5bbe('0x1b')](function(_0x4fd865){_0x3799d0[_0x5bbe('0x8c')](_0x4fd865[_0x5bbe('0xe6')]()['then'](function(_0x3fb6c1){for(var _0x120362=0x0;_0x120362<_0x3fb6c1[_0x5bbe('0x6f')];_0x120362++){_0x3fb6c1[_0x120362][_0x5bbe('0x10b')](_0x5bbe('0xa0'),_0x5bbe('0x10c'));}return _0x3fb6c1;}));_0x3799d0[_0x5bbe('0x8c')](_0x4fd865[_0x5bbe('0x10d')]()['then'](function(_0x52323f){for(var _0x554b63=0x0;_0x554b63<_0x52323f[_0x5bbe('0x6f')];_0x554b63++){_0x52323f[_0x554b63][_0x5bbe('0x10b')](_0x5bbe('0xa0'),_0x5bbe('0x10e'));}return _0x52323f;}));_0x3799d0[_0x5bbe('0x8c')](_0x4fd865[_0x5bbe('0x10f')]()['then'](function(_0x4b3cc9){for(var _0x48dfb2=0x0;_0x48dfb2<_0x4b3cc9['length'];_0x48dfb2++){_0x4b3cc9[_0x48dfb2][_0x5bbe('0x10b')](_0x5bbe('0xa0'),_0x5bbe('0x11b'));}return _0x4b3cc9;}));_0x3799d0['push'](_0x4fd865[_0x5bbe('0x110')]()[_0x5bbe('0x1b')](function(_0x3d77b4){for(var _0xe300be=0x0;_0xe300be<_0x3d77b4['length'];_0xe300be++){_0x3d77b4[_0xe300be][_0x5bbe('0x10b')]('channel',_0x5bbe('0x111'));}return _0x3d77b4;}));_0x3799d0[_0x5bbe('0x8c')](_0x4fd865[_0x5bbe('0x112')]()[_0x5bbe('0x1b')](function(_0x35b18e){for(var _0x24b581=0x0;_0x24b581<_0x35b18e[_0x5bbe('0x6f')];_0x24b581++){_0x35b18e[_0x24b581][_0x5bbe('0x10b')](_0x5bbe('0xa0'),_0x5bbe('0x11c'));}return _0x35b18e;}));_0x3799d0['push'](_0x4fd865['getFaxQueues']()[_0x5bbe('0x1b')](function(_0x33caa9){for(var _0xf2005f=0x0;_0xf2005f<_0x33caa9[_0x5bbe('0x6f')];_0xf2005f++){_0x33caa9[_0xf2005f][_0x5bbe('0x10b')](_0x5bbe('0xa0'),'Fax');}return _0x33caa9;}));_0x3799d0['push'](_0x4fd865[_0x5bbe('0x114')]()['then'](function(_0xf3eddf){for(var _0x3a80f6=0x0;_0x3a80f6<_0xf3eddf[_0x5bbe('0x6f')];_0x3a80f6++){_0xf3eddf[_0x3a80f6][_0x5bbe('0x10b')](_0x5bbe('0xa0'),_0x5bbe('0x115'));}return _0xf3eddf;}));return BPromise[_0x5bbe('0x8b')](_0x3799d0);})['then'](function(_0x394f0e){var _0x16c065=_[_0x5bbe('0x116')](_0x394f0e);_0x3799d0=[];return db[_0x5bbe('0x55')][_0x5bbe('0x117')](function(_0x1c371b){for(var _0x5ddca8=0x0;_0x5ddca8<_0x16c065[_0x5bbe('0x6f')];_0x5ddca8++){_0x3799d0[_0x5bbe('0x8c')](_0x16c065[_0x5ddca8][_0x5bbe('0x11d')](_0x56f41f['id']),{'transaction':_0x1c371b});}return BPromise[_0x5bbe('0x8b')](_0x3799d0)[_0x5bbe('0x1b')](function(){if(_0x56f41f[_0x5bbe('0xaf')]){return BPromise[_0x5bbe('0x8d')](_[_0x5bbe('0x39')](_0x16c065,function(_0x3fd505){return _0x3fd505[_0x5bbe('0x119')](_0x5bbe('0xa0'))===_0x5bbe('0x10c');}),function(_0xbe868c){return db[_0x5bbe('0xb6')][_0x5bbe('0x31')]({'where':{'VoiceQueueId':_0xbe868c['id'],'UserId':_0x56f41f['id']},'transaction':_0x1c371b});});}else{return;}})[_0x5bbe('0x1b')](function(){for(var _0x1f2bc3=0x0;_0x1f2bc3<_0x16c065[_0x5bbe('0x6f')];_0x1f2bc3++){var _0x3234d4=_0x16c065[_0x1f2bc3][_0x5bbe('0x119')](_0x5bbe('0xa0'));var _0x19c1e8=_0x3234d4+'QueueId';socket['emit'](_0x5bbe('0x36')+_0x3234d4+_0x5bbe('0xb5'),{'UserId':_0x56f41f['id'],['queueField']:_0x16c065[_0x1f2bc3]['id']});}});});});}});}})[_0x5bbe('0x1b')](respondWithStatusCode(_0x3ae7e6,null))[_0x5bbe('0x5c')](handleError(_0x3ae7e6,null));};exports[_0x5bbe('0x11e')]=function(_0x1bd0fb,_0x2a088f,_0x5f1f78){var _0x5f4e35={};var _0x1b1a58={};var _0xc50724;var _0x5687b5;return db['User'][_0x5bbe('0xc7')]({'where':{'id':_0x1bd0fb['params']['id']}})['then'](handleEntityNotFound(_0x2a088f,null))[_0x5bbe('0x1b')](function(_0x3c2ef6){if(_0x3c2ef6){_0xc50724=_0x3c2ef6;_0x1b1a58[_0x5bbe('0x48')]=_[_0x5bbe('0x4c')](db['CmList'][_0x5bbe('0x44')]);_0x1b1a58['query']=_[_0x5bbe('0x4c')](_0x1bd0fb['query']);_0x1b1a58['filters']=_['intersection'](_0x1b1a58[_0x5bbe('0x48')],_0x1b1a58['query']);_0x5f4e35[_0x5bbe('0x4e')]=_[_0x5bbe('0x5f')](_0x1b1a58['model'],qs[_0x5bbe('0x4f')](_0x1bd0fb[_0x5bbe('0x4d')][_0x5bbe('0x4f')]));_0x5f4e35[_0x5bbe('0x4e')]=_0x5f4e35['attributes']['length']?_0x5f4e35[_0x5bbe('0x4e')]:_0x1b1a58['model'];_0x5f4e35[_0x5bbe('0x50')]=qs[_0x5bbe('0x51')](_0x1bd0fb['query'][_0x5bbe('0x51')]);_0x5f4e35[_0x5bbe('0x53')]=qs[_0x5bbe('0x52')](_[_0x5bbe('0xbf')](_0x1bd0fb[_0x5bbe('0x4d')],_0x1b1a58[_0x5bbe('0x52')]));if(_0x1bd0fb[_0x5bbe('0x4d')][_0x5bbe('0x39')]){_0x5f4e35[_0x5bbe('0x53')]=_[_0x5bbe('0x54')](_0x5f4e35[_0x5bbe('0x53')],{'$or':_[_0x5bbe('0x3b')](_0x5f4e35['attributes'],function(_0x62e602){var _0x256366={};_0x256366[_0x62e602]={'$like':'%'+_0x1bd0fb[_0x5bbe('0x4d')][_0x5bbe('0x39')]+'%'};return _0x256366;})});}_0x5f4e35=_[_0x5bbe('0x54')]({},_0x5f4e35,_0x1bd0fb[_0x5bbe('0x58')]);return _0xc50724[_0x5bbe('0x11e')](_0x5f4e35);}})['then'](function(_0x3bcc0e){if(_0x3bcc0e){_0x5687b5=_0x3bcc0e[_0x5bbe('0x6f')];if(!_0x1bd0fb[_0x5bbe('0x4d')][_0x5bbe('0xc5')](_0x5bbe('0xc6'))){_0x5f4e35[_0x5bbe('0x2c')]=qs[_0x5bbe('0x2c')](_0x1bd0fb[_0x5bbe('0x4d')][_0x5bbe('0x2c')]);_0x5f4e35['offset']=qs['offset'](_0x1bd0fb['query'][_0x5bbe('0x2b')]);}return _0xc50724['getLists'](_0x5f4e35);}})[_0x5bbe('0x1b')](function(_0x3a2b0f){if(_0x3a2b0f){return _0x3a2b0f?{'count':_0x5687b5,'rows':_0x3a2b0f}:null;}})[_0x5bbe('0x1b')](respondWithResult(_0x2a088f,null))[_0x5bbe('0x5c')](handleError(_0x2a088f,null));};exports['getAgents']=function(_0x41f365,_0x37ce28,_0x288537){var _0x7ff420={};var _0x4d2831={};var _0x2e0e22;var _0xf51105;return db[_0x5bbe('0x59')][_0x5bbe('0xc7')]({'where':{'id':_0x41f365[_0x5bbe('0x5d')]['id']}})[_0x5bbe('0x1b')](handleEntityNotFound(_0x37ce28,null))['then'](function(_0x5bf348){if(_0x5bf348){_0x2e0e22=_0x5bf348;_0x4d2831['model']=_[_0x5bbe('0x4c')](db[_0x5bbe('0x59')][_0x5bbe('0x44')]);_0x4d2831[_0x5bbe('0x4d')]=_['keys'](_0x41f365[_0x5bbe('0x4d')]);_0x4d2831[_0x5bbe('0x52')]=_['intersection'](_0x4d2831['model'],_0x4d2831[_0x5bbe('0x4d')]);_0x7ff420['attributes']=_['intersection'](_0x4d2831[_0x5bbe('0x48')],qs[_0x5bbe('0x4f')](_0x41f365['query'][_0x5bbe('0x4f')]));_0x7ff420['attributes']=_0x7ff420[_0x5bbe('0x4e')][_0x5bbe('0x6f')]?_0x7ff420['attributes']:_0x4d2831['model'];_0x7ff420[_0x5bbe('0x50')]=qs[_0x5bbe('0x51')](_0x41f365[_0x5bbe('0x4d')]['sort']);_0x7ff420[_0x5bbe('0x53')]=qs[_0x5bbe('0x52')](_[_0x5bbe('0xbf')](_0x41f365[_0x5bbe('0x4d')],_0x4d2831['filters']));if(_0x41f365['query'][_0x5bbe('0x39')]){_0x7ff420[_0x5bbe('0x53')]=_[_0x5bbe('0x54')](_0x7ff420['where'],{'$or':_[_0x5bbe('0x3b')](_0x7ff420['attributes'],function(_0x12c83d){var _0x1eca5f={};_0x1eca5f[_0x12c83d]={'$like':'%'+_0x41f365['query'][_0x5bbe('0x39')]+'%'};return _0x1eca5f;})});}_0x7ff420[_0x5bbe('0x48')]=db[_0x5bbe('0x59')];_0x7ff420['as']=_0x5bbe('0x37');_0x7ff420=_[_0x5bbe('0x54')]({},_0x7ff420,_0x41f365[_0x5bbe('0x58')]);return _0x2e0e22[_0x5bbe('0xe6')]({'include':[_0x7ff420]});}})[_0x5bbe('0x1b')](function(_0x3d496a){if(_0x3d496a){var _0x85bd18={},_0x4e02bc=[],_0x2191ba=0x0;for(var _0x10163d=0x0;_0x10163d<_0x3d496a[_0x5bbe('0x6f')];_0x10163d+=0x1){for(var _0x4ba439=0x0,_0x8788b9;_0x4ba439<_0x3d496a[_0x10163d][_0x5bbe('0x37')]['length'];_0x4ba439+=0x1){_0x8788b9=_0x3d496a[_0x10163d][_0x5bbe('0x37')][_0x4ba439][_0x5bbe('0x32')]({'plain':!![]});_0x85bd18[_0x8788b9['id']]=_0x8788b9;}}_0x85bd18=_[_0x5bbe('0x11f')](_0x85bd18);for(var _0x3b31b9=qs['offset'](_0x41f365[_0x5bbe('0x4d')][_0x5bbe('0x2b')]);_0x3b31b9<_0x85bd18[_0x5bbe('0x6f')]&&_0x4e02bc['length']=_0x2c1fcd){_0x5aa074=_0x2c1fcd;_0xf33db5=0xc8;}else{_0xf33db5=0xce;}_0x2656fe[_0xec54('0x2b')](_0xf33db5);return _0x2656fe[_0xec54('0x2f')](_0xec54('0x30'),_0x3a1c48+'-'+_0x5aa074+'/'+_0x2c1fcd)[_0xec54('0x2c')](_0x515b0c);}return null;};}function patchUpdates(_0x4f94fc){return function(_0x3b0ce9){try{jsonpatch[_0xec54('0x31')](_0x3b0ce9,_0x4f94fc,!![]);}catch(_0x2f10d5){return BPromise[_0xec54('0x32')](_0x2f10d5);}return _0x3b0ce9['save']();};}function saveUpdates(_0x1cfde4,_0x3223df){return function(_0x263664){if(_0x263664){return _0x263664['update'](_0x1cfde4)[_0xec54('0x21')](function(_0x59dadd){return _0x59dadd;});}return null;};}function removeEntity(_0x4476e7,_0x3740bf){return function(_0x7184ee){if(_0x7184ee){return _0x7184ee['destroy']()[_0xec54('0x21')](function(){var _0x3a3cc4=_0x7184ee[_0xec54('0x33')]({'plain':!![]});if(_0x3a3cc4[_0xec54('0x34')]===_0xec54('0x35'))return;var _0x4c364d=[{'name':_0xec54('0x36'),'value':_0xec54('0x37'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':'Telephones','value':_0xec54('0x38'),'ignore':![]}];var _0xcda14a=_(_0x4c364d)[_0xec54('0x39')]('ignore')['map'](_0xec54('0x3a'))[_0xec54('0x3a')]();if(_['includes'](_0xcda14a,_0x3a3cc4['role'])){return;}var _0x3a7062=_[_0xec54('0x3b')](_0x4c364d,[_0xec54('0x3a'),_0x3a3cc4['role']])[_0xec54('0x3c')];return db[_0xec54('0x3d')][_0xec54('0x3e')]({'where':{'type':_0x3a7062,'resourceId':_0x3a3cc4['id']}})[_0xec54('0x21')](function(){return _0x7184ee;});})[_0xec54('0x21')](function(){_0x4476e7[_0xec54('0x2b')](0xcc)[_0xec54('0x3f')]();});}};}function handleEntityNotFound(_0x30e8e6,_0xc93c1a){return function(_0x3b0b95){if(!_0x3b0b95){_0x30e8e6[_0xec54('0x2a')](0x194);}return _0x3b0b95;};}function handleError(_0x2ff896,_0x5733dd){_0x5733dd=_0x5733dd||0x1f4;return function(_0x49d65d){logger[_0xec54('0x26')](_0x49d65d[_0xec54('0x40')]);if(_0x49d65d[_0xec54('0x3c')]){delete _0x49d65d[_0xec54('0x3c')];}_0x2ff896[_0xec54('0x2b')](_0x5733dd)['send'](_0x49d65d);};}exports['index']=function(_0x224a06,_0x5d936e){var _0x587be0={},_0x54bb99={},_0x5d8642={'count':0x0,'rows':[]};var _0x5ecd1f=_[_0xec54('0x41')](db['User'][_0xec54('0x42')],function(_0x253f89){return{'name':_0x253f89['fieldName'],'type':_0x253f89['type'][_0xec54('0x43')]};});_0x54bb99[_0xec54('0x44')]=_[_0xec54('0x45')](_[_0xec54('0x41')](_0x5ecd1f,_0xec54('0x3c')),['password',_0xec54('0x46')]);_0x54bb99['query']=_[_0xec54('0x47')](_0x224a06[_0xec54('0x48')]);_0x54bb99[_0xec54('0x49')]=_[_0xec54('0x4a')](_0x54bb99[_0xec54('0x44')],_0x54bb99[_0xec54('0x48')]);_0x587be0[_0xec54('0x4b')]=_[_0xec54('0x4a')](_0x54bb99[_0xec54('0x44')],qs[_0xec54('0x4c')](_0x224a06['query'][_0xec54('0x4c')]));_0x587be0[_0xec54('0x4b')]=_0x587be0[_0xec54('0x4b')][_0xec54('0x4d')]?_0x587be0['attributes']:_0x54bb99[_0xec54('0x44')];if(!_0x224a06[_0xec54('0x48')]['hasOwnProperty'](_0xec54('0x4e'))){_0x587be0[_0xec54('0x2e')]=qs[_0xec54('0x2e')](_0x224a06[_0xec54('0x48')]['limit']);_0x587be0[_0xec54('0x2d')]=qs['offset'](_0x224a06[_0xec54('0x48')][_0xec54('0x2d')]);}_0x587be0[_0xec54('0x4f')]=qs[_0xec54('0x50')](_0x224a06[_0xec54('0x48')][_0xec54('0x50')]);_0x587be0['where']=qs[_0xec54('0x49')](_[_0xec54('0x51')](_0x224a06[_0xec54('0x48')],_0x54bb99[_0xec54('0x49')]),_0x5ecd1f);if(_0x224a06[_0xec54('0x48')][_0xec54('0x39')]){_0x587be0[_0xec54('0x52')]=_[_0xec54('0x53')](_0x587be0[_0xec54('0x52')],{'$or':_['map'](_0x5ecd1f,function(_0x1796a7){if(_0x1796a7[_0xec54('0x54')]!=='VIRTUAL'){return db['sequelize'][_0xec54('0x52')](db[_0xec54('0x55')]['fn'](_0xec54('0x56'),db['sequelize'][_0xec54('0x57')](_0x1796a7[_0xec54('0x3c')])),{'$like':db['sequelize']['fn']('lower','%'+_0x224a06['query'][_0xec54('0x39')]+'%')});}})});}_0x587be0=_[_0xec54('0x53')]({},_0x587be0,_0x224a06['options']);var _0x5c8018={'where':_0x587be0[_0xec54('0x52')]};return db[_0xec54('0x58')][_0xec54('0x59')](_0x5c8018)[_0xec54('0x21')](function(_0x1deb3c){_0x5d8642['count']=_0x1deb3c;if(_0x224a06[_0xec54('0x48')]['includeAll']){_0x587be0['include']=[{'all':!![]}];}return db[_0xec54('0x58')][_0xec54('0x5a')](_0x587be0);})[_0xec54('0x21')](function(_0x909b98){_0x5d8642[_0xec54('0x5b')]=_0x909b98;return _0x5d8642;})[_0xec54('0x21')](respondWithFilteredResult(_0x5d936e,_0x587be0))[_0xec54('0x29')](handleError(_0x5d936e,null));};exports[_0xec54('0x5c')]=function(_0x3d7f10,_0x49d95b){var _0x1dd8a5={'raw':![],'where':{'id':_0x3d7f10[_0xec54('0x5d')]['id']}},_0x42c7ac={};_0x42c7ac[_0xec54('0x44')]=_[_0xec54('0x45')](_[_0xec54('0x47')](db['User'][_0xec54('0x42')]),[_0xec54('0x5e'),_0xec54('0x46')]);_0x42c7ac['query']=_[_0xec54('0x47')](_0x3d7f10[_0xec54('0x48')]);_0x42c7ac[_0xec54('0x5f')]=_[_0xec54('0x4a')](_0x42c7ac[_0xec54('0x44')],_0x42c7ac[_0xec54('0x48')]);_0x1dd8a5['attributes']=_[_0xec54('0x4a')](_0x42c7ac[_0xec54('0x44')],qs[_0xec54('0x4c')](_0x3d7f10['query'][_0xec54('0x4c')]));_0x1dd8a5[_0xec54('0x4b')]=_0x1dd8a5['attributes'][_0xec54('0x4d')]?_0x1dd8a5[_0xec54('0x4b')]:_0x42c7ac[_0xec54('0x44')];if(_0x3d7f10[_0xec54('0x48')][_0xec54('0x60')]){_0x1dd8a5[_0xec54('0x61')]=[{'all':!![]}];}_0x1dd8a5=_[_0xec54('0x53')]({},_0x1dd8a5,_0x3d7f10[_0xec54('0x62')]);return db['User']['find'](_0x1dd8a5)[_0xec54('0x21')](handleEntityNotFound(_0x49d95b,null))[_0xec54('0x21')](respondWithResult(_0x49d95b,null))[_0xec54('0x29')](handleError(_0x49d95b,null));};exports[_0xec54('0x63')]=function(_0x414c46,_0x349c4b){if(_0x414c46[_0xec54('0x64')]['id']){delete _0x414c46[_0xec54('0x64')]['id'];}delete _0x414c46[_0xec54('0x64')][_0xec54('0x34')];return db[_0xec54('0x58')][_0xec54('0x3b')]({'where':{'id':_0x414c46[_0xec54('0x5d')]['id']}})['then'](handleEntityNotFound(_0x349c4b,null))[_0xec54('0x21')](saveUpdates(_0x414c46[_0xec54('0x64')],null))[_0xec54('0x21')](respondWithResult(_0x349c4b,null))[_0xec54('0x29')](handleError(_0x349c4b,null));};exports[_0xec54('0x65')]=function(_0x549ee6,_0x193024){return db['User'][_0xec54('0x65')]()['then'](respondWithResult(_0x193024,null))['catch'](handleError(_0x193024,null));};exports[_0xec54('0x66')]=function(_0xb1928,_0x5858aa,_0x870c41){return db['User'][_0xec54('0x3b')]({'where':{'id':_0xb1928[_0xec54('0x5d')]['id']}})[_0xec54('0x21')](handleEntityNotFound(_0x5858aa,null))['then'](function(_0x3177de){if(_0x3177de){return _0x3177de['addContacts'](_0xb1928['body'][_0xec54('0x67')],_[_0xec54('0x68')](_0xb1928['body'],[_0xec54('0x67'),'id'])||{});}})[_0xec54('0x21')](respondWithResult(_0x5858aa,null))[_0xec54('0x29')](handleError(_0x5858aa,null));};function validateUser(_0x60c1c3){return new BPromise(function(_0x4c06be,_0x197525){if(_0x60c1c3[_0xec54('0x69')])return _0x4c06be();return db['Setting']['findById'](0x1)[_0xec54('0x21')](function(_0x37fe89){if(_0x37fe89[_0xec54('0x6a')])authService['validatePasswordPattern'](_0x60c1c3[_0xec54('0x5e')]);db['User'][_0xec54('0x6b')]('internal')[_0xec54('0x21')](function(_0x29191c){if(_['isNil'](_0x29191c)){_0x60c1c3[_0xec54('0x69')]=_0x37fe89[_0xec54('0x6c')]||0x1;return;}if(_[_0xec54('0x6d')](_0x37fe89[_0xec54('0x6c')])||_0x37fe89[_0xec54('0x6c')]===_0x29191c){_0x60c1c3[_0xec54('0x69')]=_0x29191c+0x1;return;}if(_0x37fe89[_0xec54('0x6c')]>_0x29191c){_0x60c1c3[_0xec54('0x69')]=_0x37fe89[_0xec54('0x6c')];return;}return db[_0xec54('0x55')][_0xec54('0x48')](_0xec54('0x6e'),{'type':db[_0xec54('0x55')][_0xec54('0x6f')][_0xec54('0x70')]})[_0xec54('0x21')](function(_0x340489){if(_0x340489&&_0x340489[_0xec54('0x4d')]){for(var _0x379aa7=0x0,_0x589c61=_0x340489[_0xec54('0x4d')];_0x379aa7<_0x589c61&&_[_0xec54('0x6d')](_0x60c1c3[_0xec54('0x69')]);_0x379aa7++){if(_0x37fe89[_0xec54('0x6c')]<=_0x340489[_0x379aa7]['from']){_0x60c1c3[_0xec54('0x69')]=_0x340489[_0x379aa7][_0xec54('0x71')];}else if(_0x37fe89['min_internal']>_0x340489[_0x379aa7][_0xec54('0x71')]&&_0x37fe89[_0xec54('0x6c')]<=_0x340489[_0x379aa7]['to']){_0x60c1c3[_0xec54('0x69')]=_0x37fe89[_0xec54('0x6c')];}}}if(_['isNil'](_0x60c1c3[_0xec54('0x69')])){_0x60c1c3[_0xec54('0x69')]=_0x29191c+0x1;}return _0x4c06be(_0x60c1c3);});});})[_0xec54('0x29')](function(_0x24850e){_0x197525(_0x24850e);});});}function updateUser(_0x4b297a){return new BPromise(function(_0x3162c6,_0x108b80){try{if(_0x4b297a[_0xec54('0x72')]){_0x4b297a['mailbox']=_0x4b297a[_0xec54('0x69')];_0x4b297a[_0xec54('0x73')]={'mailbox':_0x4b297a[_0xec54('0x69')],'password':_0x4b297a[_0xec54('0x5e')],'fullname':_0x4b297a['fullname'],'email':_0x4b297a[_0xec54('0x74')]};}if(_0x4b297a[_0xec54('0x34')]==='agent'){if(!_0x4b297a['permissions'])_0x4b297a[_0xec54('0x75')]=[_0xec54('0x76'),_0xec54('0x77'),_0xec54('0x78'),'113','110',_0xec54('0x79'),_0xec54('0x7a'),'106',_0xec54('0x7b'),'108',_0xec54('0x7c'),'100',_0xec54('0x7d'),_0xec54('0x7e')];}_0x3162c6(_0x4b297a);}catch(_0x3abda6){_0x108b80(_0x3abda6);}});}exports[_0xec54('0x7f')]=function(_0x32a317,_0x2707af){if(_0x32a317[_0xec54('0x37')][_0xec54('0x34')]===_0xec54('0x80'))throw new Error(_0xec54('0x81'));if(_0x32a317[_0xec54('0x64')][_0xec54('0x34')]==='user'&&_0x32a317[_0xec54('0x37')][_0xec54('0x34')]!=='admin'){throw new Error(_0xec54('0x82'));}if(_0x32a317[_0xec54('0x64')][_0xec54('0x34')]==='admin'&&_0x32a317[_0xec54('0x37')]['role']!==_0xec54('0x35')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xec54('0x83')]([_0x32a317[_0xec54('0x64')]])[_0xec54('0x21')](function(){return validateUser(_0x32a317[_0xec54('0x64')]);})[_0xec54('0x21')](function(_0x50cf11){return updateUser(_0x50cf11)['then'](function(_0xdd2dac){if(_0xdd2dac[_0xec54('0x34')]===_0xec54('0x35')){_0xdd2dac[_0xec54('0x84')]=_0x32a317[_0xec54('0x37')][_0xec54('0x84')];delete _0xdd2dac['userProfileId'];}return _0xdd2dac;});})['then'](function(_0x275130){return db[_0xec54('0x58')][_0xec54('0x7f')](_0x275130,{'include':[{'model':db[_0xec54('0x73')],'as':_0xec54('0x73')}]});})[_0xec54('0x21')](function(_0x43cf07){if(_0x32a317[_0xec54('0x64')][_0xec54('0x34')]===_0xec54('0x37'))return _0x43cf07;if(_0x32a317[_0xec54('0x37')]['role']!=='user')return _0x43cf07;return db[_0xec54('0x85')][_0xec54('0x3b')]({'where':{'name':_0x43cf07['role']===_0xec54('0x80')?_0xec54('0x86'):_0xec54('0x87'),'userProfileId':_0x32a317[_0xec54('0x37')][_0xec54('0x88')]},'raw':!![]})[_0xec54('0x21')](function(_0x465433){if(!_0x465433||_0x465433['autoAssociation']!=0x0)return _0x43cf07;return db[_0xec54('0x3d')][_0xec54('0x7f')]({'name':_0x43cf07[_0xec54('0x3c')],'resourceId':_0x43cf07['id'],'type':_0x465433[_0xec54('0x3c')],'sectionId':_0x465433['id']},{})[_0xec54('0x21')](function(){return _0x43cf07;});})[_0xec54('0x29')](function(_0xadd750){logger[_0xec54('0x26')](_0xec54('0x89'),_0xadd750);throw _0xadd750;});})[_0xec54('0x21')](respondWithResult(_0x2707af,0xc9))['catch'](handleError(_0x2707af,null));};exports[_0xec54('0x8a')]=function(_0x14f5a0,_0x52c99d){var _0x396097=_0x14f5a0[_0xec54('0x64')];var _0x6774a9=[];if(_0x14f5a0[_0xec54('0x37')][_0xec54('0x34')]===_0xec54('0x80'))throw new Error(_0xec54('0x81'));if(_['some'](_0x396097,['role',_0xec54('0x37')])&&_0x14f5a0[_0xec54('0x37')][_0xec54('0x34')]!==_0xec54('0x35')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xec54('0x8b')](_0x396097,[_0xec54('0x34'),_0xec54('0x35')])&&_0x14f5a0['user']['role']!==_0xec54('0x35')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xec54('0x83')](_0x396097)[_0xec54('0x21')](function(){return validateUser(_0x396097[0x0]);})[_0xec54('0x21')](function(){for(var _0x48ba9d=0x1;_0x48ba9d<_0x396097[_0xec54('0x4d')];_0x48ba9d++){var _0xad95c9=_0x396097[_0x48ba9d-0x1]['internal'];if(!_0x396097[_0x48ba9d][_0xec54('0x69')])_0x396097[_0x48ba9d]['internal']=_0xad95c9+0x1;_0x6774a9['push'](validateUser(_0x396097[_0x48ba9d]));}return BPromise[_0xec54('0x8c')](_0x6774a9);})[_0xec54('0x21')](function(){_0x6774a9=[];for(var _0x47c7ba=0x0;_0x47c7ba<_0x396097['length'];_0x47c7ba++){_0x6774a9[_0xec54('0x8d')](updateUser(_0x396097[_0x47c7ba]));}return BPromise['all'](_0x6774a9);})[_0xec54('0x21')](function(){return BPromise[_0xec54('0x8e')](_0x396097,function(_0x4fa0cc){return db[_0xec54('0x58')][_0xec54('0x7f')](_0x4fa0cc,{'include':[{'model':db[_0xec54('0x73')],'as':_0xec54('0x73')}]})['then'](function(_0x446b0a){_0x4fa0cc['id']=_0x446b0a['id'];return _0x4fa0cc;});});})['then'](function(_0x41e104){if(_0x14f5a0[_0xec54('0x64')][_0xec54('0x34')]===_0xec54('0x37'))return _0x41e104;if(_0x14f5a0['user'][_0xec54('0x34')]!==_0xec54('0x37'))return _0x41e104;var _0x3a248f=_[_0xec54('0x8b')](_0x41e104,function(_0x1ddb53){return _0x1ddb53[_0xec54('0x34')]==='agent'||_0x1ddb53['role']===_0xec54('0x38');});if(!_0x3a248f)return _0x41e104;return db['UserProfileSection']['findAll']({'where':{'name':{'$or':[_0xec54('0x86'),_0xec54('0x87')]},'userProfileId':_0x14f5a0['user']['userProfileId']},'raw':!![]})[_0xec54('0x21')](function(_0x5cc25e){if(_['isEmpty'](_0x5cc25e)||!_[_0xec54('0x8b')](_0x5cc25e,[_0xec54('0x8f'),0x0]))return _0x41e104;_0x6774a9=[];var _0x703c64=_(_0x5cc25e)['map'](function(_0x49dc56){if(_0x49dc56['autoAssociation']===0x1)return;return _0x49dc56[_0xec54('0x3c')]==='Agents'?_0xec54('0x80'):_0xec54('0x38');})[_0xec54('0x90')]()[_0xec54('0x3a')]();for(var _0x9fd3d4=0x0;_0x9fd3d4<_0x41e104[_0xec54('0x4d')];_0x9fd3d4++){if(!_[_0xec54('0x91')](_0x703c64,_0x41e104[_0x9fd3d4][_0xec54('0x34')]))return;var _0x25ed79=_0x41e104[_0x9fd3d4][_0xec54('0x34')]===_0xec54('0x80')?_0xec54('0x86'):_0xec54('0x87');_0x6774a9['push'](db[_0xec54('0x3d')][_0xec54('0x7f')]({'name':_0x41e104[_0x9fd3d4][_0xec54('0x3c')],'resourceId':_0x41e104[_0x9fd3d4]['id'],'type':_0x25ed79,'sectionId':_[_0xec54('0x3b')](_0x5cc25e,[_0xec54('0x3c'),_0x25ed79])['id']},{}));}return BPromise['all'](_0x6774a9);})[_0xec54('0x21')](respondWithResult(_0x52c99d,0xc9))['catch'](handleError(_0x52c99d,null));});};exports[_0xec54('0x92')]=function(_0x48c747,_0x381955,_0x24406f){if(_0x48c747[_0xec54('0x64')]['id']){delete _0x48c747[_0xec54('0x64')]['id'];}return db[_0xec54('0x58')][_0xec54('0x3b')]({'where':{'id':_0x48c747[_0xec54('0x5d')]['id']}})['then'](function(_0x589ab7){if(!_0x589ab7)return null;if(_0x589ab7['id']===_0x48c747[_0xec54('0x37')]['id']){if(!_0x48c747[_0xec54('0x64')]['oldPassword']||!_0x48c747[_0xec54('0x64')][_0xec54('0x93')]){throw new db[(_0xec54('0x94'))][(_0xec54('0x95'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x589ab7[_0xec54('0x96')](_0x48c747[_0xec54('0x64')][_0xec54('0x97')])){throw new db[(_0xec54('0x94'))][(_0xec54('0x95'))](_0xec54('0x98'));}if(_0x48c747[_0xec54('0x64')][_0xec54('0x97')]===_0x48c747[_0xec54('0x64')][_0xec54('0x93')]){throw new db[(_0xec54('0x94'))][(_0xec54('0x95'))](_0xec54('0x99'));}}else if(_0x48c747[_0xec54('0x37')][_0xec54('0x34')]===_0xec54('0x35')){if(!_0x48c747[_0xec54('0x64')][_0xec54('0x93')]){throw new db['Sequelize']['ValidationError'](_0xec54('0x9a'));}}else if(_0x48c747[_0xec54('0x37')][_0xec54('0x34')]===_0xec54('0x37')){if(!_0x48c747[_0xec54('0x64')][_0xec54('0x93')]){throw new db[(_0xec54('0x94'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x589ab7[_0xec54('0x34')]!==_0xec54('0x80')){throw new db[(_0xec54('0x94'))][(_0xec54('0x95'))]('Unauthorized');}}else{throw new db['Sequelize'][(_0xec54('0x95'))]('Unauthorized');}return _0x589ab7;})[_0xec54('0x21')](handleEntityNotFound(_0x381955,null))[_0xec54('0x21')](function(_0x389429){return db[_0xec54('0x9b')][_0xec54('0x9c')]({'attributes':['id',_0xec54('0x6a'),'enforcePasswordHistory','passwordHistoryLimit']})[_0xec54('0x21')](function(_0x464028){if(_0x464028[_0xec54('0x6a')])authService[_0xec54('0x9d')](_0x48c747[_0xec54('0x64')][_0xec54('0x93')]);if(!_0x464028[_0xec54('0x9e')]||!_0x389429[_0xec54('0x9f')])return _0x389429;authService[_0xec54('0xa0')](_0x48c747[_0xec54('0x64')][_0xec54('0x93')],_0x389429['previousPasswords'],_0x464028[_0xec54('0xa1')]);return _0x389429;})[_0xec54('0x21')](saveUpdates({'password':_0x48c747[_0xec54('0x64')][_0xec54('0x93')],'passwordResetAt':_0x48c747[_0xec54('0x37')]['id']==_0x48c747['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x48c747[_0xec54('0x64')][_0xec54('0x93')],_0x389429[_0xec54('0x9f')])},null));})[_0xec54('0x21')](respondWithResult(_0x381955,null))[_0xec54('0x29')](handleError(_0x381955,null));};exports[_0xec54('0xa2')]=function(_0x54e5d7,_0x1c684f,_0x404a8b){var _0x39dca0=_0x54e5d7[_0xec54('0x64')]['channel'];return db[_0xec54('0x58')]['find']({'where':{'id':_0x54e5d7[_0xec54('0x5d')]['id']},'attributes':['id',_0xec54('0x3c'),_0xec54('0x34'),_0xec54('0xa3'),_0xec54('0xa4'),'voicePause',_0xec54('0xa5')]})[_0xec54('0x21')](handleEntityNotFound(_0x1c684f,null))[_0xec54('0x21')](function(_0x3153e3){if(_0x3153e3){if(!utils[_0xec54('0xa6')](_0x39dca0)){throw new db['Sequelize'][(_0xec54('0x95'))](_0xec54('0xa7'));}return _0x3153e3[_0xec54('0xa8')+_[_0xec54('0xa9')](_0x39dca0[_0xec54('0xaa')]())+_0xec54('0xab')](_0x54e5d7[_0xec54('0x64')]['ids'],{'penalty':_0x54e5d7[_0xec54('0x64')][_0xec54('0xac')]||0x0})[_0xec54('0xad')](function(_0x4941cf){for(var _0x423c13=0x0;_0x423c13<_0x54e5d7[_0xec54('0x64')][_0xec54('0x67')][_0xec54('0x4d')];_0x423c13+=0x1){var _0x5708ef={'UserId':_0x54e5d7[_0xec54('0x5d')]['id']};_0x5708ef[_[_0xec54('0xa9')](_0x39dca0['toLowerCase']())+'QueueId']=_0x54e5d7[_0xec54('0x64')][_0xec54('0x67')][_0x423c13];socket['emit'](_0xec54('0x37')+_[_0xec54('0xa9')](_0x39dca0[_0xec54('0xaa')]())+'Queue:save',_0x5708ef);}return _0x4941cf;})[_0xec54('0x21')](function(){if(_0x39dca0==='voice'){return db['VoiceQueue'][_0xec54('0x5a')]({'where':{'id':_0x54e5d7[_0xec54('0x64')][_0xec54('0x67')]||[]},'raw':!![],'attributes':['id',_0xec54('0x3c')]});}})[_0xec54('0x21')](function(_0x293cd9){var _0x6be12c=_0x3153e3[_0xec54('0x33')]({'plain':!![]});var _0x2ecaee=[];if(_0x39dca0===_0xec54('0xae')&&_0x6be12c[_0xec54('0x34')]==='agent'&&_0x6be12c['online']){for(var _0x2e9359=0x0;_0x2e9359<_0x293cd9[_0xec54('0x4d')];_0x2e9359+=0x1){_0x2ecaee['push']({'membername':_0x6be12c[_0xec54('0x3c')],'UserId':_0x6be12c['id'],'queue_name':_0x293cd9[_0x2e9359]['name'],'VoiceQueueId':_0x293cd9[_0x2e9359]['id'],'interface':_['isNil'](_0x6be12c[_0xec54('0xa5')])?util[_0xec54('0xaf')](_0xec54('0xb0'),_0x6be12c[_0xec54('0x3c')]):_0x6be12c[_0xec54('0xa5')],'paused':_0x6be12c[_0xec54('0xb1')]||![],'penalty':_0x54e5d7['body']['penalty']||0x0});}return BPromise[_0xec54('0x8e')](_0x2ecaee,function(_0x262e06){return db[_0xec54('0xb2')][_0xec54('0xb3')](_0x262e06);});}return _0x3153e3;});}})[_0xec54('0x21')](respondWithStatusCode(_0x1c684f,null))['catch'](handleError(_0x1c684f,null));};exports[_0xec54('0xb4')]=function(_0x4540a0,_0x29fcfa,_0x2e0666){var _0xa915fc;return db['User'][_0xec54('0x3b')]({'where':{'id':_0x4540a0[_0xec54('0x5d')]['id']},'attributes':['id',_0xec54('0x3c'),_0xec54('0x34')]})[_0xec54('0x21')](handleEntityNotFound(_0x29fcfa,null))['then'](function(_0x34a966){if(_0x34a966){_0xa915fc=_0x34a966;if(!_0x4540a0[_0xec54('0x48')][_0xec54('0xb5')]||!utils[_0xec54('0xa6')](_0x4540a0['query'][_0xec54('0xb5')])){throw new db[(_0xec54('0x94'))][(_0xec54('0x95'))](_0xec54('0xa7'));}return _0x34a966[_0xec54('0xb6')+_[_0xec54('0xa9')](_0x4540a0['query'][_0xec54('0xb5')][_0xec54('0xaa')]())+_0xec54('0xab')](_0x4540a0[_0xec54('0x48')][_0xec54('0x67')]);}})[_0xec54('0x21')](function(_0x5bc418){for(var _0x14ad28=0x0;_0x14ad28<_0x4540a0[_0xec54('0x48')][_0xec54('0x67')]['length'];_0x14ad28+=0x1){var _0x17f79a={'UserId':_0x4540a0['params']['id']};_0x17f79a[_[_0xec54('0xa9')](_0x4540a0[_0xec54('0x48')][_0xec54('0xb5')][_0xec54('0xaa')]())+_0xec54('0xb7')]=_0x4540a0[_0xec54('0x48')][_0xec54('0x67')][_0x14ad28];socket['emit']('user'+_[_0xec54('0xa9')](_0x4540a0['query'][_0xec54('0xb5')]['toLowerCase']())+_0xec54('0xb8'),_0x17f79a);}return _0x5bc418;})['then'](function(){if(_0x4540a0[_0xec54('0x48')][_0xec54('0xb5')]==='voice'){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x4540a0[_0xec54('0x5d')]['id'],'VoiceQueueId':_0x4540a0['query'][_0xec54('0x67')]},'individualHooks':!![]})[_0xec54('0x21')](function(){return _0xa915fc;});}return _0xa915fc;})[_0xec54('0x21')](respondWithStatusCode(_0x29fcfa,null))[_0xec54('0x29')](handleError(_0x29fcfa,null));};exports[_0xec54('0xb9')]=function(_0x1b6c40,_0x94d782,_0x5508b0){_0x1b6c40[_0xec54('0x64')]['userpic']=_0x1b6c40[_0xec54('0xba')][_0xec54('0xbb')];return db[_0xec54('0x58')][_0xec54('0x3b')]({'where':{'id':_0x1b6c40['params']['id']}})[_0xec54('0x21')](handleEntityNotFound(_0x94d782,null))['then'](saveUpdates(_0x1b6c40[_0xec54('0x64')],null))['then'](respondWithResult(_0x94d782,null))[_0xec54('0x29')](handleError(_0x94d782,null));};exports[_0xec54('0xbc')]=function(_0x5dd4a3,_0x38ace4,_0x2bc460){var _0x2d18e1=path[_0xec54('0xbd')](config[_0xec54('0xbe')],'server/files/images/logos/default_profile.png');return db[_0xec54('0x58')][_0xec54('0x3b')]({'where':{'id':_0x5dd4a3[_0xec54('0x5d')]['id']},'attributes':['id',_0xec54('0xbf')],'raw':!![]})[_0xec54('0x21')](handleEntityNotFound(_0x38ace4,null))['then'](function(_0x3668f6){if(_0x3668f6){if(_[_0xec54('0x6d')](_0x3668f6[_0xec54('0xbf')])){return _0x38ace4[_0xec54('0xc0')](_0x2d18e1);}else{if(!fs[_0xec54('0xc1')](path[_0xec54('0xbd')](config[_0xec54('0xbe')],_0xec54('0xc2'),_0x3668f6['userpic']))){return _0x38ace4['download'](_0x2d18e1);}return _0x38ace4[_0xec54('0xc0')](path[_0xec54('0xbd')](config[_0xec54('0xbe')],_0xec54('0xc2'),_0x3668f6[_0xec54('0xbf')]));}}})[_0xec54('0x29')](handleError(_0x38ace4,null));};exports['getContacts']=function(_0x2fce4c,_0x3da58f,_0x13daa9){var _0x90d151={};var _0x3eb03d={};var _0x586965;var _0x4f31b4;return db[_0xec54('0x58')][_0xec54('0x9c')]({'where':{'id':_0x2fce4c[_0xec54('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3da58f,null))['then'](function(_0x1dbec8){if(_0x1dbec8){_0x586965=_0x1dbec8;_0x3eb03d[_0xec54('0x44')]=_[_0xec54('0x47')](db[_0xec54('0xc3')][_0xec54('0x42')]);_0x3eb03d[_0xec54('0x48')]=_['keys'](_0x2fce4c[_0xec54('0x48')]);_0x3eb03d[_0xec54('0x49')]=_[_0xec54('0x4a')](_0x3eb03d[_0xec54('0x44')],_0x3eb03d[_0xec54('0x48')]);_0x90d151['attributes']=_[_0xec54('0x4a')](_0x3eb03d[_0xec54('0x44')],qs[_0xec54('0x4c')](_0x2fce4c[_0xec54('0x48')][_0xec54('0x4c')]));_0x90d151[_0xec54('0x4b')]=_0x90d151[_0xec54('0x4b')][_0xec54('0x4d')]?_0x90d151[_0xec54('0x4b')]:_0x3eb03d[_0xec54('0x44')];_0x90d151[_0xec54('0x4f')]=qs['sort'](_0x2fce4c[_0xec54('0x48')]['sort']);_0x90d151[_0xec54('0x52')]=qs[_0xec54('0x49')](_['pick'](_0x2fce4c[_0xec54('0x48')],_0x3eb03d['filters']));if(_0x2fce4c[_0xec54('0x48')][_0xec54('0x39')]){_0x90d151[_0xec54('0x52')]=_[_0xec54('0x53')](_0x90d151[_0xec54('0x52')],{'$or':_[_0xec54('0x41')](_0x90d151['attributes'],function(_0x1279ab){var _0x39c4e6={};_0x39c4e6[_0x1279ab]={'$like':'%'+_0x2fce4c['query'][_0xec54('0x39')]+'%'};return _0x39c4e6;})});}_0x90d151=_[_0xec54('0x53')]({},_0x90d151,_0x2fce4c[_0xec54('0x62')]);return _0x586965[_0xec54('0xc4')](_0x90d151);}})[_0xec54('0x21')](function(_0x54a82e){if(_0x54a82e){_0x4f31b4=_0x54a82e[_0xec54('0x4d')];if(_0x2fce4c[_0xec54('0x48')][_0xec54('0xc5')](_0xec54('0x60'))){_0x90d151[_0xec54('0x61')]=[{'model':db[_0xec54('0xc6')],'as':_0xec54('0xc7'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xec54('0x3c'),_0xec54('0xc8')],'where':_0x2fce4c[_0xec54('0x48')]['tag']?{'id':_0x2fce4c['query']['tag']}:undefined,'required':_0x2fce4c[_0xec54('0x48')][_0xec54('0xc9')]?!![]:![]}];}if(!_0x2fce4c[_0xec54('0x48')]['hasOwnProperty'](_0xec54('0x4e'))){_0x90d151[_0xec54('0x2e')]=qs[_0xec54('0x2e')](_0x2fce4c[_0xec54('0x48')]['limit']);_0x90d151['offset']=qs[_0xec54('0x2d')](_0x2fce4c[_0xec54('0x48')][_0xec54('0x2d')]);}return _0x586965['getContacts'](_0x90d151);}})[_0xec54('0x21')](function(_0x2255cb){if(_0x2255cb){return _0x2255cb?{'count':_0x4f31b4,'rows':_0x2255cb}:null;}})[_0xec54('0x21')](respondWithResult(_0x3da58f,null))[_0xec54('0x29')](handleError(_0x3da58f,null));};exports[_0xec54('0xca')]=function(_0x37422,_0x501075,_0x108973){var _0x4e51e4;var _0x3c8f22;var _0x270a0c={};var _0x321ec1;return db[_0xec54('0x58')]['findOne']({'where':{'id':_0x37422[_0xec54('0x5d')]['id']},'attributes':['id','name','role']})[_0xec54('0x21')](handleEntityNotFound(_0x501075,null))[_0xec54('0x21')](function(_0x537658){if(!utils[_0xec54('0xa6')](_0x37422[_0xec54('0x48')][_0xec54('0xb5')])){throw new db[(_0xec54('0x94'))][(_0xec54('0x95'))]('Unknown\x20channel');}_0x4e51e4=_0x537658;var _0xfc9720={};_0xfc9720[_0xec54('0x44')]=_[_0xec54('0x47')](db[_['capitalize'](_0x37422[_0xec54('0x48')][_0xec54('0xb5')])+_0xec54('0xcb')][_0xec54('0x42')]);_0xfc9720[_0xec54('0x48')]=_[_0xec54('0x47')](_0x37422[_0xec54('0x48')]);_0xfc9720[_0xec54('0x49')]=_['intersection'](_0xfc9720['model'],_0xfc9720[_0xec54('0x48')]);_0x270a0c[_0xec54('0x4b')]=_[_0xec54('0x4a')](_0xfc9720[_0xec54('0x44')],qs[_0xec54('0x4c')](_0x37422['query']['fields']));_0x270a0c['attributes']=_0x270a0c[_0xec54('0x4b')][_0xec54('0x4d')]?_0x270a0c[_0xec54('0x4b')]:_0xfc9720['model'];_0x270a0c['order']=qs[_0xec54('0x50')](_0x37422[_0xec54('0x48')][_0xec54('0x50')]);_0x270a0c[_0xec54('0x52')]=qs[_0xec54('0x49')](_[_0xec54('0x51')](_0x37422['query'],_0xfc9720[_0xec54('0x49')]));if(_0x37422[_0xec54('0x48')]['filter']){_0x270a0c[_0xec54('0x52')]=_[_0xec54('0x53')](_0x270a0c['where'],{'$or':_[_0xec54('0x41')](_0x270a0c[_0xec54('0x4b')],function(_0x289691){var _0x5aa4ff={};_0x5aa4ff[_0x289691]={'$like':'%'+_0x37422['query']['filter']+'%'};return _0x5aa4ff;})});}_0x270a0c=_['merge']({},_0x270a0c,_0x37422[_0xec54('0x62')]);switch(_0x4e51e4['role']){case _0xec54('0x35'):return db[_['capitalize'](_0x37422[_0xec54('0x48')][_0xec54('0xb5')])+'Queue'][_0xec54('0x5a')](_0x270a0c);case _0xec54('0x37'):case _0xec54('0x80'):return _0x4e51e4[_0xec54('0x33')+_[_0xec54('0xa9')](_0x37422[_0xec54('0x48')][_0xec54('0xb5')])+'Queues'](_0x270a0c);default:throw new db['Sequelize'][(_0xec54('0x95'))](_0xec54('0xcc'));}})[_0xec54('0x21')](function(_0x173859){_0x321ec1=_0x173859['length'];if(!_0x37422[_0xec54('0x48')][_0xec54('0xc5')](_0xec54('0x4e'))){_0x270a0c[_0xec54('0x2e')]=qs['limit'](_0x37422[_0xec54('0x48')][_0xec54('0x2e')]);_0x270a0c[_0xec54('0x2d')]=qs[_0xec54('0x2d')](_0x37422[_0xec54('0x48')]['offset']);}switch(_0x4e51e4[_0xec54('0x34')]){case _0xec54('0x35'):return db[_[_0xec54('0xa9')](_0x37422[_0xec54('0x48')][_0xec54('0xb5')])+'Queue'][_0xec54('0x5a')](_0x270a0c);case _0xec54('0x37'):case _0xec54('0x80'):return _0x4e51e4[_0xec54('0x33')+_[_0xec54('0xa9')](_0x37422[_0xec54('0x48')][_0xec54('0xb5')])+_0xec54('0xab')](_0x270a0c);}})[_0xec54('0x21')](function(_0xdde46d){return{'count':_0x321ec1,'rows':_0xdde46d};})[_0xec54('0x21')](respondWithResult(_0x501075,null))[_0xec54('0x29')](handleError(_0x501075,null));};exports[_0xec54('0xcd')]=function(_0x1a492e,_0x5cc7d2,_0x478300){var _0x554f3a={};var _0x3b3f98={};var _0x4d274f;var _0x2c6a1e;return db[_0xec54('0x58')][_0xec54('0x9c')]({'where':{'id':_0x1a492e[_0xec54('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5cc7d2,null))['then'](function(_0x47e98d){if(_0x47e98d){_0x4d274f=_0x47e98d;_0x3b3f98[_0xec54('0x44')]=_[_0xec54('0x47')](db['UserVoiceQueueRt'][_0xec54('0x42')]);_0x3b3f98['query']=_[_0xec54('0x47')](_0x1a492e['query']);_0x3b3f98['filters']=_[_0xec54('0x4a')](_0x3b3f98[_0xec54('0x44')],_0x3b3f98[_0xec54('0x48')]);_0x554f3a['attributes']=_[_0xec54('0x4a')](_0x3b3f98[_0xec54('0x44')],qs[_0xec54('0x4c')](_0x1a492e[_0xec54('0x48')]['fields']));_0x554f3a['attributes']=_0x554f3a[_0xec54('0x4b')]['length']?_0x554f3a[_0xec54('0x4b')]:_0x3b3f98[_0xec54('0x44')];_0x554f3a[_0xec54('0x4f')]=qs[_0xec54('0x50')](_0x1a492e[_0xec54('0x48')][_0xec54('0x50')]);_0x554f3a['where']=qs['filters'](_[_0xec54('0x51')](_0x1a492e[_0xec54('0x48')],_0x3b3f98['filters']));if(_0x1a492e[_0xec54('0x48')][_0xec54('0x39')]){_0x554f3a[_0xec54('0x52')]=_[_0xec54('0x53')](_0x554f3a['where'],{'$or':_[_0xec54('0x41')](_0x554f3a[_0xec54('0x4b')],function(_0x306d72){var _0x202bed={};_0x202bed[_0x306d72]={'$like':'%'+_0x1a492e[_0xec54('0x48')]['filter']+'%'};return _0x202bed;})});}_0x554f3a=_[_0xec54('0x53')]({},_0x554f3a,_0x1a492e[_0xec54('0x62')]);return _0x4d274f['getVoiceQueuesRt'](_0x554f3a);}})[_0xec54('0x21')](function(_0x10b9b5){if(_0x10b9b5){_0x2c6a1e=_0x10b9b5[_0xec54('0x4d')];if(!_0x1a492e[_0xec54('0x48')][_0xec54('0xc5')]('nolimit')){_0x554f3a[_0xec54('0x2e')]=qs[_0xec54('0x2e')](_0x1a492e['query'][_0xec54('0x2e')]);_0x554f3a[_0xec54('0x2d')]=qs['offset'](_0x1a492e[_0xec54('0x48')][_0xec54('0x2d')]);}return _0x4d274f['getVoiceQueuesRt'](_0x554f3a);}})[_0xec54('0x21')](function(_0x2c2fea){if(_0x2c2fea){return _0x2c2fea?{'count':_0x2c6a1e,'rows':_0x2c2fea}:null;}})['then'](respondWithResult(_0x5cc7d2,null))[_0xec54('0x29')](handleError(_0x5cc7d2,null));};exports[_0xec54('0xce')]=function(_0x5c6257,_0x4e4632,_0x497ed6){var _0x2153e6={};var _0x15c589={};var _0x4d8931;var _0xe5ca0d;return db[_0xec54('0x58')][_0xec54('0x9c')]({'where':{'id':_0x5c6257[_0xec54('0x5d')]['id']}})[_0xec54('0x21')](handleEntityNotFound(_0x4e4632,null))[_0xec54('0x21')](function(_0x28d3c5){if(_0x28d3c5){_0x4d8931=_0x28d3c5;_0x15c589['model']=_['keys'](db[_0xec54('0xcf')][_0xec54('0x42')]);_0x15c589['query']=_[_0xec54('0x47')](_0x5c6257[_0xec54('0x48')]);_0x15c589[_0xec54('0x49')]=_[_0xec54('0x4a')](_0x15c589['model'],_0x15c589[_0xec54('0x48')]);_0x2153e6[_0xec54('0x4b')]=_[_0xec54('0x4a')](_0x15c589[_0xec54('0x44')],qs[_0xec54('0x4c')](_0x5c6257[_0xec54('0x48')][_0xec54('0x4c')]));_0x2153e6['attributes']=_0x2153e6['attributes'][_0xec54('0x4d')]?_0x2153e6['attributes']:_0x15c589[_0xec54('0x44')];_0x2153e6[_0xec54('0x4f')]=qs[_0xec54('0x50')](_0x5c6257[_0xec54('0x48')][_0xec54('0x50')]);_0x2153e6[_0xec54('0x52')]=qs[_0xec54('0x49')](_[_0xec54('0x51')](_0x5c6257[_0xec54('0x48')],_0x15c589[_0xec54('0x49')]));if(_0x5c6257['query'][_0xec54('0x39')]){_0x2153e6['where']=_[_0xec54('0x53')](_0x2153e6[_0xec54('0x52')],{'$or':_['map'](_0x2153e6[_0xec54('0x4b')],function(_0x4b86bf){var _0x4ef6fd={};_0x4ef6fd[_0x4b86bf]={'$like':'%'+_0x5c6257[_0xec54('0x48')][_0xec54('0x39')]+'%'};return _0x4ef6fd;})});}_0x2153e6=_[_0xec54('0x53')]({},_0x2153e6,_0x5c6257[_0xec54('0x62')]);return _0x4d8931['getGroups'](_0x2153e6);}})['then'](function(_0x894104){if(_0x894104){_0xe5ca0d=_0x894104[_0xec54('0x4d')];if(!_0x5c6257[_0xec54('0x48')][_0xec54('0xc5')](_0xec54('0x4e'))){_0x2153e6['limit']=qs[_0xec54('0x2e')](_0x5c6257[_0xec54('0x48')][_0xec54('0x2e')]);_0x2153e6[_0xec54('0x2d')]=qs[_0xec54('0x2d')](_0x5c6257[_0xec54('0x48')][_0xec54('0x2d')]);}return _0x4d8931[_0xec54('0xce')](_0x2153e6);}})[_0xec54('0x21')](function(_0x25877e){if(_0x25877e){return _0x25877e?{'count':_0xe5ca0d,'rows':_0x25877e}:null;}})[_0xec54('0x21')](respondWithResult(_0x4e4632,null))['catch'](handleError(_0x4e4632,null));};exports['getRecordings']=function(_0x5266b9,_0x2e59c4,_0x42501b){var _0x19159e={'raw':!![],'where':{}};var _0xbba057={};var _0x409ec4={'count':0x0,'rows':[]};return db[_0xec54('0x58')][_0xec54('0x9c')]({'where':{'id':_0x5266b9[_0xec54('0x5d')]['id']}})[_0xec54('0x21')](handleEntityNotFound(_0x2e59c4,null))['then'](function(_0x1fc4e6){if(_0x1fc4e6){_0xbba057[_0xec54('0x44')]=_[_0xec54('0x47')](db[_0xec54('0xd0')][_0xec54('0x42')]);_0xbba057[_0xec54('0x48')]=_[_0xec54('0x47')](_0x5266b9[_0xec54('0x48')]);_0xbba057[_0xec54('0x49')]=_[_0xec54('0x4a')](_0xbba057[_0xec54('0x44')],_0xbba057[_0xec54('0x48')]);_0x19159e['attributes']=_['intersection'](_0xbba057[_0xec54('0x44')],qs[_0xec54('0x4c')](_0x5266b9['query'][_0xec54('0x4c')]));_0x19159e[_0xec54('0x4b')]=_0x19159e[_0xec54('0x4b')][_0xec54('0x4d')]?_0x19159e[_0xec54('0x4b')]:_0xbba057[_0xec54('0x44')];if(!_0x5266b9[_0xec54('0x48')][_0xec54('0xc5')](_0xec54('0x4e'))){_0x19159e[_0xec54('0x2e')]=qs[_0xec54('0x2e')](_0x5266b9[_0xec54('0x48')]['limit']);_0x19159e['offset']=qs['offset'](_0x5266b9[_0xec54('0x48')]['offset']);}_0x19159e[_0xec54('0x4f')]=qs[_0xec54('0x50')](_0x5266b9[_0xec54('0x48')]['sort']);_0x19159e[_0xec54('0x52')]=qs[_0xec54('0x49')](_[_0xec54('0x51')](_0x5266b9['query'],_0xbba057[_0xec54('0x49')]));_0x19159e[_0xec54('0x52')][_0xec54('0xd1')]=_0x1fc4e6['id'];if(_0x5266b9['query'][_0xec54('0x39')]){_0x19159e[_0xec54('0x52')]=_[_0xec54('0x53')](_0x19159e[_0xec54('0x52')],{'$or':_[_0xec54('0x41')](_0x19159e[_0xec54('0x4b')],function(_0x43a395){var _0xbf8609={};_0xbf8609[_0x43a395]={'$like':'%'+_0x5266b9[_0xec54('0x48')]['filter']+'%'};return _0xbf8609;})});}_0x19159e=_[_0xec54('0x53')]({},_0x19159e,_0x5266b9[_0xec54('0x62')]);return db[_0xec54('0xd0')]['count']({'where':_0x19159e['where']})[_0xec54('0x21')](function(_0x52f5d4){_0x409ec4['count']=_0x52f5d4;if(_0x5266b9['query'][_0xec54('0x60')]){_0x19159e[_0xec54('0x61')]=[{'all':!![]}];}return db[_0xec54('0xd0')][_0xec54('0x5a')](_0x19159e);})[_0xec54('0x21')](function(_0x292445){_0x409ec4[_0xec54('0x5b')]=_0x292445;return _0x409ec4;});}})[_0xec54('0x21')](respondWithFilteredResult(_0x2e59c4,_0x19159e))['catch'](handleError(_0x2e59c4,null));};exports[_0xec54('0xd2')]=function(_0x3385c9,_0x1f4d48,_0x2ceef1){var _0x473ee8={'raw':!![],'where':{}};var _0x3824d2={};var _0x5e0e8b={'count':0x0,'rows':[]};return db['User'][_0xec54('0x9c')]({'where':{'id':_0x3385c9[_0xec54('0x5d')]['id']}})[_0xec54('0x21')](handleEntityNotFound(_0x1f4d48,null))[_0xec54('0x21')](function(_0x520df4){if(_0x520df4){_0x3824d2[_0xec54('0x44')]=_['keys'](db[_0xec54('0xd3')][_0xec54('0x42')]);_0x3824d2['query']=_[_0xec54('0x47')](_0x3385c9['query']);_0x3824d2['filters']=_[_0xec54('0x4a')](_0x3824d2[_0xec54('0x44')],_0x3824d2[_0xec54('0x48')]);_0x473ee8[_0xec54('0x4b')]=_[_0xec54('0x4a')](_0x3824d2['model'],qs[_0xec54('0x4c')](_0x3385c9[_0xec54('0x48')][_0xec54('0x4c')]));_0x473ee8['attributes']=_0x473ee8[_0xec54('0x4b')]['length']?_0x473ee8[_0xec54('0x4b')]:_0x3824d2[_0xec54('0x44')];if(!_0x3385c9[_0xec54('0x48')][_0xec54('0xc5')](_0xec54('0x4e'))){_0x473ee8[_0xec54('0x2e')]=qs[_0xec54('0x2e')](_0x3385c9['query'][_0xec54('0x2e')]);_0x473ee8[_0xec54('0x2d')]=qs[_0xec54('0x2d')](_0x3385c9['query']['offset']);}_0x473ee8[_0xec54('0x4f')]=qs[_0xec54('0x50')](_0x3385c9[_0xec54('0x48')]['sort']);_0x473ee8[_0xec54('0x52')]=qs[_0xec54('0x49')](_[_0xec54('0x51')](_0x3385c9[_0xec54('0x48')],_0x3824d2[_0xec54('0x49')]));_0x473ee8[_0xec54('0x52')][_0xec54('0xd1')]=_0x520df4['id'];if(_0x3385c9[_0xec54('0x48')][_0xec54('0x39')]){_0x473ee8[_0xec54('0x52')]=_[_0xec54('0x53')](_0x473ee8[_0xec54('0x52')],{'$or':_[_0xec54('0x41')](_0x473ee8[_0xec54('0x4b')],function(_0x9b70c5){var _0x379ba8={};_0x379ba8[_0x9b70c5]={'$like':'%'+_0x3385c9[_0xec54('0x48')][_0xec54('0x39')]+'%'};return _0x379ba8;})});}_0x473ee8=_[_0xec54('0x53')]({},_0x473ee8,_0x3385c9['options']);return db['ScreenRecording'][_0xec54('0x59')]({'where':_0x473ee8[_0xec54('0x52')]})[_0xec54('0x21')](function(_0x5092ac){_0x5e0e8b['count']=_0x5092ac;if(_0x3385c9[_0xec54('0x48')]['includeAll']){_0x473ee8[_0xec54('0x61')]=[{'all':!![]}];}return db[_0xec54('0xd3')][_0xec54('0x5a')](_0x473ee8);})[_0xec54('0x21')](function(_0x2926f7){_0x5e0e8b['rows']=_0x2926f7;return _0x5e0e8b;});}})[_0xec54('0x21')](respondWithFilteredResult(_0x1f4d48,_0x473ee8))[_0xec54('0x29')](handleError(_0x1f4d48,null));};exports[_0xec54('0xd4')]=function(_0x874a8b,_0x1b8ea3,_0x190a57){var _0x1ebf41={};var _0x83008={};var _0x6cecbd;var _0x1a7299;return db[_0xec54('0x58')][_0xec54('0x9c')]({'where':{'id':_0x874a8b['params']['id']}})[_0xec54('0x21')](handleEntityNotFound(_0x1b8ea3,null))[_0xec54('0x21')](function(_0xbc4708){if(_0xbc4708){_0x6cecbd=_0xbc4708;_0x83008[_0xec54('0x44')]=_[_0xec54('0x47')](db[_0xec54('0xd5')][_0xec54('0x42')]);_0x83008[_0xec54('0x48')]=_[_0xec54('0x47')](_0x874a8b['query']);_0x83008[_0xec54('0x49')]=_['intersection'](_0x83008['model'],_0x83008['query']);_0x1ebf41['attributes']=_['intersection'](_0x83008[_0xec54('0x44')],qs['fields'](_0x874a8b[_0xec54('0x48')][_0xec54('0x4c')]));_0x1ebf41['attributes']=_0x1ebf41['attributes']['length']?_0x1ebf41[_0xec54('0x4b')]:_0x83008[_0xec54('0x44')];_0x1ebf41['order']=qs[_0xec54('0x50')](_0x874a8b['query']['sort']);_0x1ebf41['where']=qs['filters'](_[_0xec54('0x51')](_0x874a8b[_0xec54('0x48')],_0x83008['filters']));if(_0x874a8b[_0xec54('0x48')][_0xec54('0x39')]){_0x1ebf41['where']=_['merge'](_0x1ebf41[_0xec54('0x52')],{'$or':_[_0xec54('0x41')](_0x1ebf41[_0xec54('0x4b')],function(_0x5992d){var _0x3f0d0b={};_0x3f0d0b[_0x5992d]={'$like':'%'+_0x874a8b[_0xec54('0x48')][_0xec54('0x39')]+'%'};return _0x3f0d0b;})});}_0x1ebf41=_[_0xec54('0x53')]({},_0x1ebf41,_0x874a8b[_0xec54('0x62')]);return _0x6cecbd[_0xec54('0xd4')](_0x1ebf41);}})[_0xec54('0x21')](function(_0x31490d){if(_0x31490d){_0x1a7299=_0x31490d[_0xec54('0x4d')];if(!_0x874a8b[_0xec54('0x48')][_0xec54('0xc5')]('nolimit')){_0x1ebf41[_0xec54('0x2e')]=qs[_0xec54('0x2e')](_0x874a8b[_0xec54('0x48')][_0xec54('0x2e')]);_0x1ebf41[_0xec54('0x2d')]=qs[_0xec54('0x2d')](_0x874a8b[_0xec54('0x48')][_0xec54('0x2d')]);}return _0x6cecbd[_0xec54('0xd4')](_0x1ebf41);}})[_0xec54('0x21')](function(_0x201e08){if(_0x201e08){return _0x201e08?{'count':_0x1a7299,'rows':_0x201e08}:null;}})[_0xec54('0x21')](respondWithResult(_0x1b8ea3,null))[_0xec54('0x29')](handleError(_0x1b8ea3,null));};exports[_0xec54('0xd6')]=function(_0x3a5596,_0x407e32,_0xa26012){var _0x3534f7={};var _0xea611={};var _0x3236cb;var _0x31c2d3;return db[_0xec54('0x58')][_0xec54('0x9c')]({'where':{'id':_0x3a5596['params']['id']}})[_0xec54('0x21')](handleEntityNotFound(_0x407e32,null))['then'](function(_0x29816c){if(_0x29816c){_0x3236cb=_0x29816c;_0xea611[_0xec54('0x44')]=_['keys'](db[_0xec54('0xd7')][_0xec54('0x42')]);_0xea611[_0xec54('0x48')]=_[_0xec54('0x47')](_0x3a5596[_0xec54('0x48')]);_0xea611[_0xec54('0x49')]=_[_0xec54('0x4a')](_0xea611[_0xec54('0x44')],_0xea611[_0xec54('0x48')]);_0x3534f7[_0xec54('0x4b')]=_[_0xec54('0x4a')](_0xea611['model'],qs['fields'](_0x3a5596[_0xec54('0x48')][_0xec54('0x4c')]));_0x3534f7['attributes']=_0x3534f7[_0xec54('0x4b')][_0xec54('0x4d')]?_0x3534f7[_0xec54('0x4b')]:_0xea611[_0xec54('0x44')];_0x3534f7['order']=qs[_0xec54('0x50')](_0x3a5596[_0xec54('0x48')][_0xec54('0x50')]);_0x3534f7[_0xec54('0x52')]=qs['filters'](_[_0xec54('0x51')](_0x3a5596[_0xec54('0x48')],_0xea611[_0xec54('0x49')]));if(_0x3a5596[_0xec54('0x48')][_0xec54('0x39')]){_0x3534f7[_0xec54('0x52')]=_['merge'](_0x3534f7['where'],{'$or':_[_0xec54('0x41')](_0x3534f7[_0xec54('0x4b')],function(_0x4e63a6){var _0x44bbee={};_0x44bbee[_0x4e63a6]={'$like':'%'+_0x3a5596[_0xec54('0x48')][_0xec54('0x39')]+'%'};return _0x44bbee;})});}_0x3534f7=_[_0xec54('0x53')]({},_0x3534f7,_0x3a5596[_0xec54('0x62')]);return _0x3236cb[_0xec54('0xd6')](_0x3534f7);}})[_0xec54('0x21')](function(_0x1b5fb9){if(_0x1b5fb9){_0x31c2d3=_0x1b5fb9[_0xec54('0x4d')];if(!_0x3a5596[_0xec54('0x48')][_0xec54('0xc5')]('nolimit')){_0x3534f7[_0xec54('0x2e')]=qs[_0xec54('0x2e')](_0x3a5596[_0xec54('0x48')][_0xec54('0x2e')]);_0x3534f7[_0xec54('0x2d')]=qs[_0xec54('0x2d')](_0x3a5596[_0xec54('0x48')]['offset']);}return _0x3236cb['getOpenchannelInteractions'](_0x3534f7);}})[_0xec54('0x21')](function(_0x98784b){if(_0x98784b){return _0x98784b?{'count':_0x31c2d3,'rows':_0x98784b}:null;}})[_0xec54('0x21')](respondWithResult(_0x407e32,null))[_0xec54('0x29')](handleError(_0x407e32,null));};exports['getMailInteractions']=function(_0x43c1e3,_0x595151,_0x119392){var _0x45d219={'raw':!![],'where':{}};var _0x2d6dc7={};var _0x5e77cb={'count':0x0,'rows':[]};return db['User'][_0xec54('0x9c')]({'where':{'id':_0x43c1e3[_0xec54('0x5d')]['id']}})[_0xec54('0x21')](handleEntityNotFound(_0x595151,null))[_0xec54('0x21')](function(_0x2dc14e){if(_0x2dc14e){_0x2d6dc7[_0xec54('0x44')]=_[_0xec54('0x47')](db[_0xec54('0xd8')][_0xec54('0x42')]);_0x2d6dc7[_0xec54('0x48')]=_[_0xec54('0x47')](_0x43c1e3[_0xec54('0x48')]);_0x2d6dc7['filters']=_[_0xec54('0x4a')](_0x2d6dc7[_0xec54('0x44')],_0x2d6dc7[_0xec54('0x48')]);_0x45d219[_0xec54('0x4b')]=_[_0xec54('0x4a')](_0x2d6dc7[_0xec54('0x44')],qs[_0xec54('0x4c')](_0x43c1e3['query'][_0xec54('0x4c')]));_0x45d219[_0xec54('0x4b')]=_0x45d219['attributes'][_0xec54('0x4d')]?_0x45d219[_0xec54('0x4b')]:_0x2d6dc7['model'];if(!_0x43c1e3[_0xec54('0x48')][_0xec54('0xc5')](_0xec54('0x4e'))){_0x45d219[_0xec54('0x2e')]=qs[_0xec54('0x2e')](_0x43c1e3[_0xec54('0x48')][_0xec54('0x2e')]);_0x45d219['offset']=qs[_0xec54('0x2d')](_0x43c1e3['query'][_0xec54('0x2d')]);}_0x45d219[_0xec54('0x4f')]=qs[_0xec54('0x50')](_0x43c1e3[_0xec54('0x48')]['sort']);_0x45d219[_0xec54('0x52')]=qs[_0xec54('0x49')](_[_0xec54('0x51')](_0x43c1e3[_0xec54('0x48')],_0x2d6dc7[_0xec54('0x49')]));_0x45d219['where'][_0xec54('0xd1')]=_0x2dc14e['id'];if(_0x43c1e3[_0xec54('0x48')][_0xec54('0x39')]){_0x45d219['where']=_['merge'](_0x45d219[_0xec54('0x52')],{'$or':_[_0xec54('0x41')](_0x45d219[_0xec54('0x4b')],function(_0x54401d){var _0x278111={};_0x278111[_0x54401d]={'$like':'%'+_0x43c1e3['query']['filter']+'%'};return _0x278111;})});}_0x45d219=_[_0xec54('0x53')]({},_0x45d219,_0x43c1e3[_0xec54('0x62')]);return db[_0xec54('0xd8')]['count']({'where':_0x45d219[_0xec54('0x52')]})[_0xec54('0x21')](function(_0x7688d7){_0x5e77cb['count']=_0x7688d7;if(_0x43c1e3[_0xec54('0x48')][_0xec54('0x60')]){_0x45d219[_0xec54('0x61')]=[{'all':!![]}];}return db['MailInteraction'][_0xec54('0x5a')](_0x45d219);})[_0xec54('0x21')](function(_0x1c3a97){_0x5e77cb[_0xec54('0x5b')]=_0x1c3a97;return _0x5e77cb;});}})[_0xec54('0x21')](respondWithFilteredResult(_0x595151,_0x45d219))[_0xec54('0x29')](handleError(_0x595151,null));};exports[_0xec54('0xd9')]=function(_0xf79976,_0x3e4e25,_0xe337a3){var _0x108465={};var _0x11fb95={};var _0x309283;var _0xf99ba3;return db[_0xec54('0x58')][_0xec54('0x9c')]({'where':{'id':_0xf79976[_0xec54('0x5d')]['id']}})[_0xec54('0x21')](handleEntityNotFound(_0x3e4e25,null))['then'](function(_0x5dae22){if(_0x5dae22){_0x309283=_0x5dae22;_0x11fb95[_0xec54('0x44')]=_[_0xec54('0x47')](db['SmsInteraction']['rawAttributes']);_0x11fb95[_0xec54('0x48')]=_['keys'](_0xf79976[_0xec54('0x48')]);_0x11fb95[_0xec54('0x49')]=_[_0xec54('0x4a')](_0x11fb95[_0xec54('0x44')],_0x11fb95[_0xec54('0x48')]);_0x108465[_0xec54('0x4b')]=_[_0xec54('0x4a')](_0x11fb95['model'],qs[_0xec54('0x4c')](_0xf79976[_0xec54('0x48')][_0xec54('0x4c')]));_0x108465[_0xec54('0x4b')]=_0x108465[_0xec54('0x4b')][_0xec54('0x4d')]?_0x108465['attributes']:_0x11fb95[_0xec54('0x44')];_0x108465[_0xec54('0x4f')]=qs[_0xec54('0x50')](_0xf79976['query'][_0xec54('0x50')]);_0x108465['where']=qs[_0xec54('0x49')](_[_0xec54('0x51')](_0xf79976['query'],_0x11fb95[_0xec54('0x49')]));if(_0xf79976[_0xec54('0x48')]['filter']){_0x108465[_0xec54('0x52')]=_[_0xec54('0x53')](_0x108465['where'],{'$or':_[_0xec54('0x41')](_0x108465[_0xec54('0x4b')],function(_0x413f03){var _0x167886={};_0x167886[_0x413f03]={'$like':'%'+_0xf79976[_0xec54('0x48')][_0xec54('0x39')]+'%'};return _0x167886;})});}_0x108465=_[_0xec54('0x53')]({},_0x108465,_0xf79976[_0xec54('0x62')]);return _0x309283['getSmsInteractions'](_0x108465);}})[_0xec54('0x21')](function(_0x387b99){if(_0x387b99){_0xf99ba3=_0x387b99[_0xec54('0x4d')];if(!_0xf79976['query'][_0xec54('0xc5')]('nolimit')){_0x108465[_0xec54('0x2e')]=qs[_0xec54('0x2e')](_0xf79976['query'][_0xec54('0x2e')]);_0x108465[_0xec54('0x2d')]=qs['offset'](_0xf79976[_0xec54('0x48')][_0xec54('0x2d')]);}return _0x309283['getSmsInteractions'](_0x108465);}})[_0xec54('0x21')](function(_0x4b3ba4){if(_0x4b3ba4){return _0x4b3ba4?{'count':_0xf99ba3,'rows':_0x4b3ba4}:null;}})['then'](respondWithResult(_0x3e4e25,null))[_0xec54('0x29')](handleError(_0x3e4e25,null));};exports['getFaxInteractions']=function(_0x104602,_0x5e3027,_0x403520){var _0x77698a={};var _0x5868bd={};var _0x64d0f4;var _0xa84347;return db[_0xec54('0x58')]['findOne']({'where':{'id':_0x104602[_0xec54('0x5d')]['id']}})[_0xec54('0x21')](handleEntityNotFound(_0x5e3027,null))[_0xec54('0x21')](function(_0x17eb66){if(_0x17eb66){_0x64d0f4=_0x17eb66;_0x5868bd[_0xec54('0x44')]=_[_0xec54('0x47')](db['FaxInteraction'][_0xec54('0x42')]);_0x5868bd[_0xec54('0x48')]=_[_0xec54('0x47')](_0x104602[_0xec54('0x48')]);_0x5868bd[_0xec54('0x49')]=_[_0xec54('0x4a')](_0x5868bd[_0xec54('0x44')],_0x5868bd['query']);_0x77698a[_0xec54('0x4b')]=_[_0xec54('0x4a')](_0x5868bd[_0xec54('0x44')],qs[_0xec54('0x4c')](_0x104602[_0xec54('0x48')][_0xec54('0x4c')]));_0x77698a[_0xec54('0x4b')]=_0x77698a[_0xec54('0x4b')][_0xec54('0x4d')]?_0x77698a[_0xec54('0x4b')]:_0x5868bd['model'];_0x77698a[_0xec54('0x4f')]=qs[_0xec54('0x50')](_0x104602[_0xec54('0x48')][_0xec54('0x50')]);_0x77698a[_0xec54('0x52')]=qs[_0xec54('0x49')](_[_0xec54('0x51')](_0x104602[_0xec54('0x48')],_0x5868bd[_0xec54('0x49')]));if(_0x104602['query'][_0xec54('0x39')]){_0x77698a['where']=_[_0xec54('0x53')](_0x77698a[_0xec54('0x52')],{'$or':_[_0xec54('0x41')](_0x77698a[_0xec54('0x4b')],function(_0x48665c){var _0x44f00d={};_0x44f00d[_0x48665c]={'$like':'%'+_0x104602[_0xec54('0x48')][_0xec54('0x39')]+'%'};return _0x44f00d;})});}_0x77698a=_[_0xec54('0x53')]({},_0x77698a,_0x104602[_0xec54('0x62')]);return _0x64d0f4[_0xec54('0xda')](_0x77698a);}})['then'](function(_0x556da2){if(_0x556da2){_0xa84347=_0x556da2[_0xec54('0x4d')];if(!_0x104602[_0xec54('0x48')]['hasOwnProperty'](_0xec54('0x4e'))){_0x77698a[_0xec54('0x2e')]=qs[_0xec54('0x2e')](_0x104602['query']['limit']);_0x77698a[_0xec54('0x2d')]=qs[_0xec54('0x2d')](_0x104602[_0xec54('0x48')]['offset']);}return _0x64d0f4['getFaxInteractions'](_0x77698a);}})[_0xec54('0x21')](function(_0x30b40d){if(_0x30b40d){return _0x30b40d?{'count':_0xa84347,'rows':_0x30b40d}:null;}})['then'](respondWithResult(_0x5e3027,null))[_0xec54('0x29')](handleError(_0x5e3027,null));};exports[_0xec54('0xdb')]=function(_0x1e3b13,_0x26458a,_0x553e22){var _0x320317={};var _0x3babd4={};var _0x45be1a;var _0x366796;return db['User']['findOne']({'where':{'id':_0x1e3b13['params']['id']}})['then'](handleEntityNotFound(_0x26458a,null))['then'](function(_0x1b88fd){if(_0x1b88fd){_0x45be1a=_0x1b88fd;_0x3babd4[_0xec54('0x44')]=_[_0xec54('0x47')](db[_0xec54('0xdc')][_0xec54('0x42')]);_0x3babd4[_0xec54('0x48')]=_['keys'](_0x1e3b13[_0xec54('0x48')]);_0x3babd4[_0xec54('0x49')]=_[_0xec54('0x4a')](_0x3babd4[_0xec54('0x44')],_0x3babd4[_0xec54('0x48')]);_0x320317['attributes']=_['intersection'](_0x3babd4[_0xec54('0x44')],qs[_0xec54('0x4c')](_0x1e3b13[_0xec54('0x48')][_0xec54('0x4c')]));_0x320317['attributes']=_0x320317[_0xec54('0x4b')][_0xec54('0x4d')]?_0x320317['attributes']:_0x3babd4[_0xec54('0x44')];_0x320317[_0xec54('0x4f')]=qs[_0xec54('0x50')](_0x1e3b13[_0xec54('0x48')][_0xec54('0x50')]);_0x320317[_0xec54('0x52')]=qs[_0xec54('0x49')](_[_0xec54('0x51')](_0x1e3b13[_0xec54('0x48')],_0x3babd4[_0xec54('0x49')]));if(_0x1e3b13[_0xec54('0x48')]['filter']){_0x320317[_0xec54('0x52')]=_[_0xec54('0x53')](_0x320317[_0xec54('0x52')],{'$or':_[_0xec54('0x41')](_0x320317[_0xec54('0x4b')],function(_0x35da70){var _0xde809f={};_0xde809f[_0x35da70]={'$like':'%'+_0x1e3b13[_0xec54('0x48')][_0xec54('0x39')]+'%'};return _0xde809f;})});}_0x320317=_['merge']({},_0x320317,_0x1e3b13[_0xec54('0x62')]);return _0x45be1a[_0xec54('0xdb')](_0x320317);}})[_0xec54('0x21')](function(_0x1f75f8){if(_0x1f75f8){_0x366796=_0x1f75f8[_0xec54('0x4d')];if(!_0x1e3b13[_0xec54('0x48')][_0xec54('0xc5')](_0xec54('0x4e'))){_0x320317[_0xec54('0x2e')]=qs[_0xec54('0x2e')](_0x1e3b13['query'][_0xec54('0x2e')]);_0x320317[_0xec54('0x2d')]=qs[_0xec54('0x2d')](_0x1e3b13[_0xec54('0x48')][_0xec54('0x2d')]);}return _0x45be1a[_0xec54('0xdb')](_0x320317);}})[_0xec54('0x21')](function(_0x54ab14){if(_0x54ab14){return _0x54ab14?{'count':_0x366796,'rows':_0x54ab14}:null;}})['then'](respondWithResult(_0x26458a,null))[_0xec54('0x29')](handleError(_0x26458a,null));};exports['login']=function(_0x4010c0,_0x1e30e1,_0xff1e0e){var _0x4993e3;var _0x2a80c5;var _0x410974;var _0x4fd472=!_[_0xec54('0x6d')](_0x4010c0[_0xec54('0x5d')]['id'])?_0x4010c0[_0xec54('0x5d')]['id']:!_[_0xec54('0x6d')](_0x4010c0['user']['id'])?_0x4010c0[_0xec54('0x37')]['id']:null;return db[_0xec54('0x58')][_0xec54('0x3b')]({'where':{'id':_0x4fd472,'role':{'$or':[_0xec54('0x35'),_0xec54('0x37'),_0xec54('0x80')]}},'attributes':['id',_0xec54('0x3c'),_0xec54('0xdd'),'mobile',_0xec54('0x34'),_0xec54('0x69'),_0xec54('0xa4')]})['then'](function(_0x2a8158){if(_0x2a8158){if(_0x2a8158[_0xec54('0x34')]===_0xec54('0x80')){_0x4993e3=_0x2a8158;if(_0x4010c0[_0xec54('0x64')][_0xec54('0xa5')]){_0x410974=util[_0xec54('0xaf')](_0xec54('0xde'),_0x4993e3[_0x4010c0[_0xec54('0x64')]['interface']]);}else if(_0x4010c0[_0xec54('0x64')]['intrf']){_0x410974=util['format'](_0xec54('0xb0'),_0x4010c0[_0xec54('0x64')][_0xec54('0xdf')]);}else{_0x410974=util[_0xec54('0xaf')]('SIP/%s',_0x4993e3['name']);}socket['to'](util['format'](_0xec54('0xe0'),_0x4993e3[_0xec54('0x3c')]))[_0xec54('0xe1')]('user:forcelogout',{'ip':_0x4010c0[_0xec54('0xe2')][_0xec54('0xe3')]||_0x4010c0[_0xec54('0xe4')]['remoteAddress']||_0x4010c0[_0xec54('0xe5')][_0xec54('0xe6')]||_0x4010c0[_0xec54('0xe4')][_0xec54('0xe5')][_0xec54('0xe6')]});return db['UserVoiceQueueRt'][_0xec54('0x3e')]({'where':{'membername':_0x4993e3[_0xec54('0x3c')]},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError']('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0xec54('0x21')](function(){if(_0x4993e3){return _0x4993e3['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x396c42){if(_0x4993e3){var _0x39795c=[];if(_0x396c42){_0x2a80c5=_0x396c42;if(_0x2a80c5[_0xec54('0x4d')]){for(var _0x57b954=0x0;_0x57b954<_0x2a80c5[_0xec54('0x4d')];_0x57b954++){_0x39795c[_0xec54('0x8d')]({'membername':_0x4993e3[_0xec54('0x3c')],'UserId':_0x4993e3['id'],'queue_name':_0x2a80c5[_0x57b954][_0xec54('0x3c')],'VoiceQueueId':_0x2a80c5[_0x57b954]['id'],'interface':_0x410974,'paused':_0x4993e3[_0xec54('0xa4')]||![],'penalty':_0x2a80c5[_0x57b954][_0xec54('0xe7')]||0x0});}return BPromise[_0xec54('0x8e')](_0x39795c,function(_0x2e963d){return db[_0xec54('0xb2')][_0xec54('0xb3')](_0x2e963d);});}}}})['then'](function(){if(_0x4993e3){return db['MemberReport'][_0xec54('0x5a')]({'where':{'membername':_0x4993e3['name'],'exitAt':null}});}})[_0xec54('0x21')](function(_0x2b88e1){if(_0x4993e3){var _0x1a7085=[];_0x2b88e1[_0xec54('0xe8')](function(_0x18cc0e){_0x1a7085['push'](_0x18cc0e[_0xec54('0x63')]({'exitAt':moment()[_0xec54('0xaf')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xec54('0x8c')](_0x1a7085);}})[_0xec54('0x21')](function(){if(_0x4993e3){var _0x564910=[];var _0x33432e=[];var _0x1c6893=utils[_0xec54('0xe9')]();var _0xf5847e={'membername':_0x4993e3[_0xec54('0x3c')],'interface':_0x410974,'enterAt':moment()['format'](_0xec54('0xea')),'role':_0x4993e3[_0xec54('0x34')],'internal':_0x4993e3['internal']};_0x1c6893[_0xec54('0xe8')](function(_0x5c4d4b){_0x564910[_0xec54('0x8d')](_[_0xec54('0x53')]({'channel':_0x5c4d4b,'type':_0xec54('0xeb'),'data1':_0x4010c0[_0xec54('0x64')]['device'],'data2':_0x410974},_0xf5847e));if(_0x4993e3['loginInPause']){_0x33432e[_0xec54('0x8d')](_[_0xec54('0x53')]({'channel':_0x5c4d4b,'type':'PAUSE','data1':_0xec54('0xec')},_0xf5847e));}});return db[_0xec54('0xed')][_0xec54('0x8a')](_0x564910[_0xec54('0xee')](_0x33432e),{'individualHooks':!![]});}})['then'](function(){if(_0x4993e3){return _0x4993e3[_0xec54('0x63')]({'online':!![],'lastLoginAt':moment()[_0xec54('0xaf')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x4993e3[_0xec54('0xa4')]||![],'mailPause':_0x4993e3['loginInPause']||![],'chatPause':_0x4993e3[_0xec54('0xa4')]||![],'faxPause':_0x4993e3[_0xec54('0xa4')]||![],'smsPause':_0x4993e3['loginInPause']||![],'openchannelPause':_0x4993e3[_0xec54('0xa4')]||![],'whatsappPause':_0x4993e3['loginInPause']||![],'pauseType':_0x4993e3[_0xec54('0xa4')]?'LOGININPAUSE':null,'interface':_0x410974,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0xc52be4){if(_0x4010c0[_0xec54('0xef')]){return _0xff1e0e();}else{return BPromise[_0xec54('0xf0')](_0xc52be4)['then'](respondWithResult(_0x1e30e1,null));}})[_0xec54('0x29')](handleError(_0x1e30e1,null));};exports['logout']=function(_0x2036b8,_0x31fb38,_0x3264ce){var _0x24efa3;return db[_0xec54('0x58')][_0xec54('0x3b')]({'where':{'id':_0x2036b8[_0xec54('0x5d')]['id'],'role':_0xec54('0x80')},'attributes':['id',_0xec54('0x3c'),'role']})['then'](handleEntityNotFound(_0x31fb38,null))[_0xec54('0x21')](function(_0x584935){if(_0x584935){_0x24efa3=_0x584935;return db[_0xec54('0xb2')][_0xec54('0x3e')]({'where':{'membername':_0x24efa3[_0xec54('0x3c')]},'individualHooks':!![]});}})[_0xec54('0x21')](function(){return db['MemberReport'][_0xec54('0x5a')]({'where':{'membername':_0x24efa3[_0xec54('0x3c')],'exitAt':null}});})[_0xec54('0x21')](function(_0x5d1072){var _0x3b4f0f=[];_0x5d1072['forEach'](function(_0x130bf2){_0x3b4f0f[_0xec54('0x8d')](_0x130bf2[_0xec54('0x63')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x3b4f0f);})[_0xec54('0x21')](function(){return _0x24efa3[_0xec54('0x63')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xec54('0x21')](respondWithResult(_0x31fb38,null))[_0xec54('0x29')](handleError(_0x31fb38,null));};exports[_0xec54('0xf1')]=function(_0x10c57f,_0x703ee9,_0x429d56){var _0x10eea1;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x10c57f[_0xec54('0x5d')]['id']},'individualHooks':!![]})[_0xec54('0x21')](function(){return db[_0xec54('0x58')]['find']({'where':{'id':_0x10c57f['params']['id'],'role':_0xec54('0x80')},'attributes':['id',_0xec54('0x3c'),_0xec54('0x34'),_0xec54('0x69'),_0xec54('0xa5')]});})[_0xec54('0x21')](handleEntityNotFound(_0x703ee9,null))[_0xec54('0x21')](function(_0x8a81f6){if(_0x8a81f6){_0x10eea1=_0x8a81f6;return respondWithRpcPromise('QueuePause',_0xec54('0xf1'),{'id':_0x10eea1['id'],'name':_0x10eea1['name'],'pause':!![]});}})[_0xec54('0x21')](function(){if(_0x10eea1){return db[_0xec54('0xed')]['findAll']({'where':{'membername':_0x10eea1[_0xec54('0x3c')],'type':'PAUSE','exitAt':null}});}})[_0xec54('0x21')](function(_0x4416f5){if(_0x4416f5['length']){var _0x1290b0=moment()['format'](_0xec54('0xea'));for(var _0x3c42ff=0x0,_0x2645f2=_0x4416f5[_0xec54('0x4d')];_0x3c42ff<_0x2645f2;_0x3c42ff++){_0x4416f5[_0x3c42ff]['updateAttributes']({'exitAt':_0x1290b0});}}})[_0xec54('0x21')](function(){var _0x106422=[];var _0x4f04a0=utils[_0xec54('0xe9')]();_0x4f04a0[_0xec54('0xe8')](function(_0x750311){_0x106422['push']({'channel':_0x750311,'membername':_0x10eea1[_0xec54('0x3c')],'interface':_[_0xec54('0x6d')](_0x10eea1[_0xec54('0xa5')])?util[_0xec54('0xaf')](_0xec54('0xb0'),_0x10eea1[_0xec54('0x3c')]):_0x10eea1[_0xec54('0xa5')],'type':_0xec54('0xf2'),'enterAt':moment()[_0xec54('0xaf')](_0xec54('0xea')),'data1':_0x10c57f[_0xec54('0x64')][_0xec54('0x54')]||'DEFAULT\x20PAUSE','role':_0x10eea1[_0xec54('0x34')],'internal':_0x10eea1[_0xec54('0x69')]});});return db[_0xec54('0xed')][_0xec54('0x8a')](_0x106422,{'individualHooks':!![]});})['then'](function(){return _0x10eea1[_0xec54('0x63')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x10c57f[_0xec54('0x64')]['type']||_0xec54('0xf3'),'lastPauseAt':moment()[_0xec54('0xaf')](_0xec54('0xea'))});})[_0xec54('0x21')](respondWithResult(_0x703ee9,null))[_0xec54('0x29')](handleError(_0x703ee9,null));};exports['unpause']=function(_0x59e168,_0x4a575a,_0x54ec59){var _0xe361e5;return db['User'][_0xec54('0x3b')]({'where':{'id':_0x59e168['params']['id']},'attributes':['id',_0xec54('0x3c'),_0xec54('0x34'),'voicePause',_0xec54('0xf4'),_0xec54('0xf5'),_0xec54('0xf6'),_0xec54('0xf7'),_0xec54('0xf8'),'whatsapppause','pauseType',_0xec54('0xf9')]})[_0xec54('0x21')](handleEntityNotFound(_0x4a575a,null))[_0xec54('0x21')](function(_0x1e8498){if(_0x1e8498){_0xe361e5=_0x1e8498;if(_0x59e168[_0xec54('0x64')]['channel']&&!utils[_0xec54('0xa6')](_0x59e168[_0xec54('0x64')][_0xec54('0xb5')])){throw new db['Sequelize']['ValidationError'](_0xec54('0xa7'));}switch(_0x59e168[_0xec54('0x64')][_0xec54('0xb5')]){case _0xec54('0xae'):return respondWithRpcPromise(_0xec54('0xfa'),_0xec54('0xfb'),{'id':_0xe361e5['id'],'name':_0xe361e5[_0xec54('0x3c')],'pause':![]})[_0xec54('0x21')](function(){return db[_0xec54('0xb2')]['update']({'paused':0x0},{'where':{'UserId':_0xe361e5['id']},'individualHooks':!![]});})[_0xec54('0x21')](function(){return db[_0xec54('0xed')][_0xec54('0x3b')]({'where':{'channel':_0x59e168['body'][_0xec54('0xb5')],'membername':_0xe361e5[_0xec54('0x3c')],'type':_0xec54('0xf2'),'exitAt':null}});})[_0xec54('0x21')](function(_0x1ec478){if(_0x1ec478){return _0x1ec478['update']({'exitAt':moment()[_0xec54('0xaf')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xec54('0xfc')},{'individualHooks':!![]});}return null;})[_0xec54('0x21')](function(){return _0xe361e5[_0xec54('0x63')]({'voicePause':![]});});case _0xec54('0xfd'):case _0xec54('0xfe'):case _0xec54('0xff'):case _0xec54('0x100'):case _0xec54('0x101'):case _0xec54('0x102'):return db[_0xec54('0xed')]['find']({'where':{'channel':_0x59e168['body'][_0xec54('0xb5')],'membername':_0xe361e5[_0xec54('0x3c')],'type':'PAUSE','exitAt':null}})[_0xec54('0x21')](function(_0x5ddbca){if(_0x5ddbca){return _0x5ddbca['update']({'exitAt':moment()[_0xec54('0xaf')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xec54('0x21')](function(){var _0x549867={};_[_0xec54('0x2f')](_0x549867,util[_0xec54('0xaf')](_0xec54('0x103'),_0x59e168[_0xec54('0x64')][_0xec54('0xb5')],_0xec54('0x104')),![]);return _0xe361e5[_0xec54('0x63')](_0x549867);});default:return respondWithRpcPromise(_0xec54('0xfa'),_0xec54('0xfb'),{'id':_0xe361e5['id'],'name':_0xe361e5[_0xec54('0x3c')],'pause':![]})[_0xec54('0x21')](function(){return db[_0xec54('0xb2')][_0xec54('0x63')]({'paused':0x0},{'where':{'UserId':_0xe361e5['id']}});})['then'](function(){return db[_0xec54('0xed')][_0xec54('0x5a')]({'where':{'membername':_0xe361e5['name'],'type':'PAUSE','exitAt':null}});})['then'](function(_0x2d14e4){var _0x103504=[];_0x2d14e4[_0xec54('0xe8')](function(_0x65f1b9){_0x103504['push'](_0x65f1b9[_0xec54('0x63')]({'exitAt':moment()[_0xec54('0xaf')](_0xec54('0xea')),'data2':'manual'}));});return BPromise[_0xec54('0x8c')](_0x103504);})['then'](function(){return _0xe361e5[_0xec54('0x63')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xec54('0x21')](respondWithResult(_0x4a575a,null))[_0xec54('0x29')](handleError(_0x4a575a,null));};exports[_0xec54('0x105')]=function(_0x25ef30,_0x400c3a,_0x23c4eb){var _0x583cab={};var _0x33ca73={};var _0x484770;var _0x2413f3;return db[_0xec54('0x58')]['findOne']({'where':{'id':_0x25ef30[_0xec54('0x5d')]['id']}})[_0xec54('0x21')](handleEntityNotFound(_0x400c3a,null))['then'](function(_0x538da8){if(_0x538da8){_0x484770=_0x538da8;_0x33ca73[_0xec54('0x44')]=_['keys'](db['Team'][_0xec54('0x42')]);_0x33ca73['query']=_[_0xec54('0x47')](_0x25ef30[_0xec54('0x48')]);_0x33ca73['filters']=_[_0xec54('0x4a')](_0x33ca73[_0xec54('0x44')],_0x33ca73[_0xec54('0x48')]);_0x583cab[_0xec54('0x4b')]=_[_0xec54('0x4a')](_0x33ca73[_0xec54('0x44')],qs['fields'](_0x25ef30[_0xec54('0x48')][_0xec54('0x4c')]));_0x583cab[_0xec54('0x4b')]=_0x583cab[_0xec54('0x4b')][_0xec54('0x4d')]?_0x583cab[_0xec54('0x4b')]:_0x33ca73[_0xec54('0x44')];_0x583cab[_0xec54('0x4f')]=qs[_0xec54('0x50')](_0x25ef30[_0xec54('0x48')][_0xec54('0x50')]);_0x583cab[_0xec54('0x52')]=qs[_0xec54('0x49')](_[_0xec54('0x51')](_0x25ef30['query'],_0x33ca73[_0xec54('0x49')]));if(_0x25ef30[_0xec54('0x48')][_0xec54('0x39')]){_0x583cab[_0xec54('0x52')]=_[_0xec54('0x53')](_0x583cab['where'],{'$or':_[_0xec54('0x41')](_0x583cab['attributes'],function(_0x22e111){var _0x793035={};_0x793035[_0x22e111]={'$like':'%'+_0x25ef30[_0xec54('0x48')][_0xec54('0x39')]+'%'};return _0x793035;})});}_0x583cab=_[_0xec54('0x53')]({},_0x583cab,_0x25ef30[_0xec54('0x62')]);return _0x484770[_0xec54('0x105')](_0x583cab);}})[_0xec54('0x21')](function(_0x4988d1){if(_0x4988d1){_0x2413f3=_0x4988d1[_0xec54('0x4d')];if(!_0x25ef30[_0xec54('0x48')][_0xec54('0xc5')](_0xec54('0x4e'))){_0x583cab[_0xec54('0x2e')]=qs[_0xec54('0x2e')](_0x25ef30[_0xec54('0x48')][_0xec54('0x2e')]);_0x583cab['offset']=qs[_0xec54('0x2d')](_0x25ef30[_0xec54('0x48')]['offset']);}return _0x484770['getTeams'](_0x583cab);}})[_0xec54('0x21')](function(_0x3677d5){if(_0x3677d5){return _0x3677d5?{'count':_0x2413f3,'rows':_0x3677d5}:null;}})[_0xec54('0x21')](respondWithResult(_0x400c3a,null))[_0xec54('0x29')](handleError(_0x400c3a,null));};exports[_0xec54('0x106')]=function(_0x37388a,_0x8eb115){return db[_0xec54('0x58')][_0xec54('0x3b')]({'where':{'id':_0x37388a[_0xec54('0x5d')]['id']}})['then'](handleEntityNotFound(_0x8eb115,null))[_0xec54('0x21')](function(_0x3323bf){if(_0x3323bf){var _0x404126=_0x3323bf['get']({'plain':!![]});return _0x3323bf[_0xec54('0x106')](_0x37388a[_0xec54('0x64')][_0xec54('0x67')],_[_0xec54('0x68')](_0x37388a[_0xec54('0x64')],[_0xec54('0x67'),'id'])||{})[_0xec54('0x21')](function(){for(var _0x8287e=0x0;_0x8287e<_0x37388a['body'][_0xec54('0x67')][_0xec54('0x4d')];_0x8287e++){var _0x4cbdad=[];db[_0xec54('0x107')][_0xec54('0x9c')]({'where':{'id':_0x37388a[_0xec54('0x64')][_0xec54('0x67')][_0x8287e]}})[_0xec54('0x21')](function(_0x214c2b){_0x4cbdad[_0xec54('0x8d')](_0x214c2b[_0xec54('0x108')]()[_0xec54('0x21')](function(_0x2510c8){for(var _0x302d02=0x0;_0x302d02<_0x2510c8[_0xec54('0x4d')];_0x302d02++){_0x2510c8[_0x302d02][_0xec54('0x109')](_0xec54('0xb5'),_0xec54('0x10a'));}return _0x2510c8;}));_0x4cbdad[_0xec54('0x8d')](_0x214c2b['getChatQueues']()['then'](function(_0x234f12){for(var _0x31fa15=0x0;_0x31fa15<_0x234f12[_0xec54('0x4d')];_0x31fa15++){_0x234f12[_0x31fa15][_0xec54('0x109')](_0xec54('0xb5'),_0xec54('0x10b'));}return _0x234f12;}));_0x4cbdad['push'](_0x214c2b['getMailQueues']()[_0xec54('0x21')](function(_0x11dfc1){for(var _0x5f0559=0x0;_0x5f0559<_0x11dfc1[_0xec54('0x4d')];_0x5f0559++){_0x11dfc1[_0x5f0559][_0xec54('0x109')](_0xec54('0xb5'),_0xec54('0x10c'));}return _0x11dfc1;}));_0x4cbdad[_0xec54('0x8d')](_0x214c2b['getSmsQueues']()[_0xec54('0x21')](function(_0x1c8ee6){for(var _0x200b4c=0x0;_0x200b4c<_0x1c8ee6[_0xec54('0x4d')];_0x200b4c++){_0x1c8ee6[_0x200b4c][_0xec54('0x109')](_0xec54('0xb5'),_0xec54('0x10d'));}return _0x1c8ee6;}));_0x4cbdad[_0xec54('0x8d')](_0x214c2b[_0xec54('0x10e')]()[_0xec54('0x21')](function(_0x5cce1f){for(var _0x38714f=0x0;_0x38714f<_0x5cce1f[_0xec54('0x4d')];_0x38714f++){_0x5cce1f[_0x38714f][_0xec54('0x109')](_0xec54('0xb5'),'Whatsapp');}return _0x5cce1f;}));_0x4cbdad[_0xec54('0x8d')](_0x214c2b[_0xec54('0x10f')]()[_0xec54('0x21')](function(_0x5bf8ea){for(var _0x397b8a=0x0;_0x397b8a<_0x5bf8ea[_0xec54('0x4d')];_0x397b8a++){_0x5bf8ea[_0x397b8a][_0xec54('0x109')](_0xec54('0xb5'),_0xec54('0x110'));}return _0x5bf8ea;}));_0x4cbdad[_0xec54('0x8d')](_0x214c2b[_0xec54('0x111')]()[_0xec54('0x21')](function(_0x21de10){for(var _0x524a1c=0x0;_0x524a1c<_0x21de10['length'];_0x524a1c++){_0x21de10[_0x524a1c][_0xec54('0x109')](_0xec54('0xb5'),'Openchannel');}return _0x21de10;}));return BPromise[_0xec54('0x8c')](_0x4cbdad);})[_0xec54('0x21')](function(_0xcd85cc){var _0x1e5411=_[_0xec54('0x112')](_0xcd85cc);_0x4cbdad=[];return db[_0xec54('0x55')]['transaction'](function(_0x45b3c5){for(var _0x3b6efc=0x0;_0x3b6efc<_0x1e5411['length'];_0x3b6efc++){_0x4cbdad[_0xec54('0x8d')](_0x1e5411[_0x3b6efc][_0xec54('0x113')](_0x404126['id']),{'transaction':_0x45b3c5});}return BPromise[_0xec54('0x8c')](_0x4cbdad)[_0xec54('0x21')](function(){if(_0x404126[_0xec54('0xa3')]){return BPromise[_0xec54('0x8e')](_[_0xec54('0x39')](_0x1e5411,function(_0x2bb785){return _0x2bb785[_0xec54('0x114')](_0xec54('0xb5'))==='Voice';}),function(_0x12ee5e){return db[_0xec54('0xb2')][_0xec54('0xb3')]({'membername':_0x404126[_0xec54('0x3c')],'UserId':_0x404126['id'],'queue_name':_0x12ee5e[_0xec54('0x3c')],'VoiceQueueId':_0x12ee5e['id'],'interface':_[_0xec54('0x6d')](_0x404126[_0xec54('0xa5')])?util['format'](_0xec54('0xb0'),_0x404126[_0xec54('0x3c')]):_0x404126[_0xec54('0xa5')],'paused':_0x404126[_0xec54('0xb1')]||![],'penalty':_0x404126[_0xec54('0xac')]},{'transaction':_0x45b3c5});});}else{return;}})[_0xec54('0x21')](function(){for(var _0x2db6b7=0x0;_0x2db6b7<_0x1e5411['length'];_0x2db6b7++){var _0x53e031=_0x1e5411[_0x2db6b7][_0xec54('0x114')](_0xec54('0xb5'));var _0x1a2280=_0x53e031+_0xec54('0xb7');socket[_0xec54('0xe1')](_0xec54('0x37')+_0x53e031+_0xec54('0x115'),{'UserId':_0x404126['id'],['queueField']:_0x1e5411[_0x2db6b7]['id']});}});});});}});}})[_0xec54('0x21')](respondWithStatusCode(_0x8eb115,null))[_0xec54('0x29')](handleError(_0x8eb115,null));};exports['removeTeams']=function(_0x61af5d,_0x2be915){return db['User'][_0xec54('0x9c')]({'where':{'id':_0x61af5d['params']['id']}})[_0xec54('0x21')](handleEntityNotFound(_0x2be915,null))[_0xec54('0x21')](function(_0xe7b3f){if(_0xe7b3f){var _0x5f4189=_0xe7b3f[_0xec54('0x33')]({'plain':!![]});var _0x2c0602=_0x61af5d[_0xec54('0x48')]['ids'];return _0xe7b3f[_0xec54('0x116')](_0x2c0602)['then'](function(){for(var _0x383760=0x0;_0x383760<_0x2c0602[_0xec54('0x4d')];_0x383760++){var _0x3940b5=[];db['Team'][_0xec54('0x9c')]({'where':{'id':_0x2c0602[_0x383760]}})[_0xec54('0x21')](function(_0xae1e52){_0x3940b5[_0xec54('0x8d')](_0xae1e52[_0xec54('0x108')]()[_0xec54('0x21')](function(_0x2546b2){for(var _0x34f23e=0x0;_0x34f23e<_0x2546b2[_0xec54('0x4d')];_0x34f23e++){_0x2546b2[_0x34f23e][_0xec54('0x109')]('channel',_0xec54('0x10a'));}return _0x2546b2;}));_0x3940b5['push'](_0xae1e52[_0xec54('0x117')]()[_0xec54('0x21')](function(_0x55c386){for(var _0x659297=0x0;_0x659297<_0x55c386[_0xec54('0x4d')];_0x659297++){_0x55c386[_0x659297]['setDataValue'](_0xec54('0xb5'),_0xec54('0x10b'));}return _0x55c386;}));_0x3940b5[_0xec54('0x8d')](_0xae1e52[_0xec54('0x118')]()[_0xec54('0x21')](function(_0x13ddd7){for(var _0x29b406=0x0;_0x29b406<_0x13ddd7[_0xec54('0x4d')];_0x29b406++){_0x13ddd7[_0x29b406][_0xec54('0x109')]('channel',_0xec54('0x10c'));}return _0x13ddd7;}));_0x3940b5[_0xec54('0x8d')](_0xae1e52[_0xec54('0x119')]()[_0xec54('0x21')](function(_0x3897a1){for(var _0x4c07ab=0x0;_0x4c07ab<_0x3897a1['length'];_0x4c07ab++){_0x3897a1[_0x4c07ab][_0xec54('0x109')]('channel',_0xec54('0x10d'));}return _0x3897a1;}));_0x3940b5[_0xec54('0x8d')](_0xae1e52['getWhatsappQueues']()['then'](function(_0x20c011){for(var _0x50906f=0x0;_0x50906f<_0x20c011[_0xec54('0x4d')];_0x50906f++){_0x20c011[_0x50906f]['setDataValue'](_0xec54('0xb5'),_0xec54('0x11a'));}return _0x20c011;}));_0x3940b5[_0xec54('0x8d')](_0xae1e52[_0xec54('0x10f')]()['then'](function(_0x87be42){for(var _0x19fc0e=0x0;_0x19fc0e<_0x87be42['length'];_0x19fc0e++){_0x87be42[_0x19fc0e][_0xec54('0x109')](_0xec54('0xb5'),_0xec54('0x110'));}return _0x87be42;}));_0x3940b5[_0xec54('0x8d')](_0xae1e52[_0xec54('0x111')]()[_0xec54('0x21')](function(_0x56ef84){for(var _0x4ac457=0x0;_0x4ac457<_0x56ef84[_0xec54('0x4d')];_0x4ac457++){_0x56ef84[_0x4ac457][_0xec54('0x109')](_0xec54('0xb5'),_0xec54('0x11b'));}return _0x56ef84;}));return BPromise[_0xec54('0x8c')](_0x3940b5);})[_0xec54('0x21')](function(_0x50e18f){var _0x4e0d99=_[_0xec54('0x112')](_0x50e18f);_0x3940b5=[];return db['sequelize'][_0xec54('0x11c')](function(_0x4dec29){for(var _0x2dc8cb=0x0;_0x2dc8cb<_0x4e0d99[_0xec54('0x4d')];_0x2dc8cb++){_0x3940b5['push'](_0x4e0d99[_0x2dc8cb][_0xec54('0x11d')](_0x5f4189['id']),{'transaction':_0x4dec29});}return BPromise[_0xec54('0x8c')](_0x3940b5)['then'](function(){if(_0x5f4189['online']){return BPromise[_0xec54('0x8e')](_[_0xec54('0x39')](_0x4e0d99,function(_0x6ec728){return _0x6ec728[_0xec54('0x114')](_0xec54('0xb5'))===_0xec54('0x10a');}),function(_0x5d1d86){return db[_0xec54('0xb2')][_0xec54('0x3e')]({'where':{'VoiceQueueId':_0x5d1d86['id'],'UserId':_0x5f4189['id']},'transaction':_0x4dec29});});}else{return;}})['then'](function(){for(var _0x384182=0x0;_0x384182<_0x4e0d99[_0xec54('0x4d')];_0x384182++){var _0x27bfe9=_0x4e0d99[_0x384182][_0xec54('0x114')]('channel');var _0x29304f=_0x27bfe9+'QueueId';socket[_0xec54('0xe1')](_0xec54('0x37')+_0x27bfe9+_0xec54('0xb8'),{'UserId':_0x5f4189['id'],['queueField']:_0x4e0d99[_0x384182]['id']});}});});});}});}})[_0xec54('0x21')](respondWithStatusCode(_0x2be915,null))[_0xec54('0x29')](handleError(_0x2be915,null));};exports['getLists']=function(_0x3c35ee,_0x2fc200,_0x25487d){var _0x1da813={};var _0x1fda16={};var _0x4c3265;var _0x5c2213;return db['User'][_0xec54('0x9c')]({'where':{'id':_0x3c35ee[_0xec54('0x5d')]['id']}})[_0xec54('0x21')](handleEntityNotFound(_0x2fc200,null))[_0xec54('0x21')](function(_0x3fda5){if(_0x3fda5){_0x4c3265=_0x3fda5;_0x1fda16[_0xec54('0x44')]=_[_0xec54('0x47')](db[_0xec54('0xc6')]['rawAttributes']);_0x1fda16[_0xec54('0x48')]=_[_0xec54('0x47')](_0x3c35ee[_0xec54('0x48')]);_0x1fda16[_0xec54('0x49')]=_[_0xec54('0x4a')](_0x1fda16[_0xec54('0x44')],_0x1fda16[_0xec54('0x48')]);_0x1da813[_0xec54('0x4b')]=_['intersection'](_0x1fda16[_0xec54('0x44')],qs['fields'](_0x3c35ee[_0xec54('0x48')][_0xec54('0x4c')]));_0x1da813[_0xec54('0x4b')]=_0x1da813[_0xec54('0x4b')][_0xec54('0x4d')]?_0x1da813[_0xec54('0x4b')]:_0x1fda16[_0xec54('0x44')];_0x1da813['order']=qs[_0xec54('0x50')](_0x3c35ee['query'][_0xec54('0x50')]);_0x1da813['where']=qs['filters'](_['pick'](_0x3c35ee['query'],_0x1fda16[_0xec54('0x49')]));if(_0x3c35ee[_0xec54('0x48')][_0xec54('0x39')]){_0x1da813['where']=_[_0xec54('0x53')](_0x1da813['where'],{'$or':_[_0xec54('0x41')](_0x1da813[_0xec54('0x4b')],function(_0x2977c1){var _0x201e86={};_0x201e86[_0x2977c1]={'$like':'%'+_0x3c35ee[_0xec54('0x48')]['filter']+'%'};return _0x201e86;})});}_0x1da813=_[_0xec54('0x53')]({},_0x1da813,_0x3c35ee[_0xec54('0x62')]);return _0x4c3265['getLists'](_0x1da813);}})[_0xec54('0x21')](function(_0x39099d){if(_0x39099d){_0x5c2213=_0x39099d[_0xec54('0x4d')];if(!_0x3c35ee[_0xec54('0x48')][_0xec54('0xc5')](_0xec54('0x4e'))){_0x1da813[_0xec54('0x2e')]=qs[_0xec54('0x2e')](_0x3c35ee[_0xec54('0x48')][_0xec54('0x2e')]);_0x1da813[_0xec54('0x2d')]=qs[_0xec54('0x2d')](_0x3c35ee[_0xec54('0x48')]['offset']);}return _0x4c3265[_0xec54('0x11e')](_0x1da813);}})[_0xec54('0x21')](function(_0x15e9b0){if(_0x15e9b0){return _0x15e9b0?{'count':_0x5c2213,'rows':_0x15e9b0}:null;}})[_0xec54('0x21')](respondWithResult(_0x2fc200,null))[_0xec54('0x29')](handleError(_0x2fc200,null));};exports[_0xec54('0x11f')]=function(_0x5a1864,_0x395995,_0x508787){var _0x2aea73={};var _0x26a5e5={};var _0x56b916;var _0x282376;return db[_0xec54('0x58')][_0xec54('0x9c')]({'where':{'id':_0x5a1864['params']['id']}})[_0xec54('0x21')](handleEntityNotFound(_0x395995,null))[_0xec54('0x21')](function(_0x1b1a77){if(_0x1b1a77){_0x56b916=_0x1b1a77;_0x26a5e5[_0xec54('0x44')]=_[_0xec54('0x47')](db[_0xec54('0x58')][_0xec54('0x42')]);_0x26a5e5[_0xec54('0x48')]=_[_0xec54('0x47')](_0x5a1864[_0xec54('0x48')]);_0x26a5e5['filters']=_[_0xec54('0x4a')](_0x26a5e5[_0xec54('0x44')],_0x26a5e5[_0xec54('0x48')]);_0x2aea73[_0xec54('0x4b')]=_[_0xec54('0x4a')](_0x26a5e5[_0xec54('0x44')],qs[_0xec54('0x4c')](_0x5a1864[_0xec54('0x48')]['fields']));_0x2aea73[_0xec54('0x4b')]=_0x2aea73['attributes'][_0xec54('0x4d')]?_0x2aea73[_0xec54('0x4b')]:_0x26a5e5['model'];_0x2aea73[_0xec54('0x4f')]=qs[_0xec54('0x50')](_0x5a1864['query'][_0xec54('0x50')]);_0x2aea73[_0xec54('0x52')]=qs[_0xec54('0x49')](_[_0xec54('0x51')](_0x5a1864[_0xec54('0x48')],_0x26a5e5[_0xec54('0x49')]));if(_0x5a1864[_0xec54('0x48')]['filter']){_0x2aea73[_0xec54('0x52')]=_[_0xec54('0x53')](_0x2aea73[_0xec54('0x52')],{'$or':_[_0xec54('0x41')](_0x2aea73[_0xec54('0x4b')],function(_0x1706b4){var _0x4d9d70={};_0x4d9d70[_0x1706b4]={'$like':'%'+_0x5a1864['query'][_0xec54('0x39')]+'%'};return _0x4d9d70;})});}_0x2aea73['model']=db['User'];_0x2aea73['as']=_0xec54('0x86');_0x2aea73=_[_0xec54('0x53')]({},_0x2aea73,_0x5a1864[_0xec54('0x62')]);return _0x56b916[_0xec54('0x108')]({'include':[_0x2aea73]});}})['then'](function(_0x186358){if(_0x186358){var _0x506ed2={},_0x368417=[],_0x1cbc7f=0x0;for(var _0x3e3470=0x0;_0x3e3470<_0x186358[_0xec54('0x4d')];_0x3e3470+=0x1){for(var _0x45180e=0x0,_0x2f3e14;_0x45180e<_0x186358[_0x3e3470][_0xec54('0x86')][_0xec54('0x4d')];_0x45180e+=0x1){_0x2f3e14=_0x186358[_0x3e3470][_0xec54('0x86')][_0x45180e]['get']({'plain':!![]});_0x506ed2[_0x2f3e14['id']]=_0x2f3e14;}}_0x506ed2=_['values'](_0x506ed2);for(var _0x9de155=qs[_0xec54('0x2d')](_0x5a1864[_0xec54('0x48')][_0xec54('0x2d')]);_0x9de155<_0x506ed2[_0xec54('0x4d')]&&_0x368417['length']=_0x278812['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x36d981){return db[_0x3f37('0x4c')][_0x3f37('0x4d')]({'where':{'membername':_0x36d981[_0x3f37('0x28')]},'individualHooks':!![]});}})[_0x3f37('0x2b')](function(){if(_0x36d981){return _0x36d981['getVoiceQueues']({'raw':!![]});}})[_0x3f37('0x2b')](function(_0xaef540){if(_0x36d981){if(_0xaef540){var _0x3f9bb7=[];_0x357152=_0xaef540;if(_0x357152[_0x3f37('0x30')]){for(var _0x18704f=0x0;_0x18704f<_0x357152[_0x3f37('0x30')];_0x18704f++){_0x3f9bb7[_0x3f37('0x35')](db[_0x3f37('0x4c')][_0x3f37('0x54')]({'membername':_0x36d981['name'],'UserId':_0x36d981['id'],'queue_name':_0x357152[_0x18704f][_0x3f37('0x28')],'VoiceQueueId':_0x357152[_0x18704f]['id'],'interface':_0x3dbaac,'paused':_0x36d981[_0x3f37('0x55')]||![],'penalty':_0x357152[_0x18704f][_0x3f37('0x56')]||0x0}));}return BPromise[_0x3f37('0x4a')](_0x3f9bb7);}}}})[_0x3f37('0x2b')](function(){if(_0x36d981){return db[_0x3f37('0x2d')][_0x3f37('0x2e')]({'where':{'membername':_0x36d981[_0x3f37('0x28')],'exitAt':null}});}})[_0x3f37('0x2b')](function(_0x19245c){if(_0x36d981){if(_0x19245c&&_0x19245c['length']){var _0x5c5bbf=[];_0x19245c['forEach'](function(_0x1b42e9){_0x5c5bbf[_0x3f37('0x35')](_0x1b42e9[_0x3f37('0x2c')]({'exitAt':moment()['format'](_0x3f37('0x31'))}));});return BPromise[_0x3f37('0x4a')](_0x5c5bbf);}}})['then'](function(_0x179fe3){if(_0x36d981){var _0x527528=[];var _0x251e3e=[];var _0x52338d=utils[_0x3f37('0x33')]();var _0x246481={'membername':_0x36d981[_0x3f37('0x28')],'interface':_0x3dbaac,'enterAt':moment()[_0x3f37('0x37')](_0x3f37('0x31')),'role':_0x36d981[_0x3f37('0x3a')],'internal':_0x36d981['internal']};_0x52338d[_0x3f37('0x34')](function(_0xa4dc3f){_0x527528[_0x3f37('0x35')](_[_0x3f37('0x57')]({'channel':_0xa4dc3f,'type':_0x3f37('0x58'),'data1':_0x3f37('0x59'),'data2':_0x3dbaac},_0x246481));if(_0x36d981[_0x3f37('0x55')]){_0x251e3e[_0x3f37('0x35')](_[_0x3f37('0x57')]({'channel':_0xa4dc3f,'type':'PAUSE','data1':_0x3f37('0x5a')},_0x246481));}});return db[_0x3f37('0x2d')][_0x3f37('0x5b')](_0x527528[_0x3f37('0x5c')](_0x251e3e),{'individualHooks':!![]});}})[_0x3f37('0x2b')](function(){if(_0x36d981){return _0x36d981[_0x3f37('0x2c')]({'online':!![],'lastLoginAt':moment()['format'](_0x3f37('0x31')),'voicePause':_0x36d981[_0x3f37('0x55')]||![],'mailPause':_0x36d981['loginInPause']||![],'chatPause':_0x36d981[_0x3f37('0x55')]||![],'faxPause':_0x36d981[_0x3f37('0x55')]||![],'smsPause':_0x36d981[_0x3f37('0x55')]||![],'openchannelPause':_0x36d981[_0x3f37('0x55')]||![],'pauseType':_0x36d981['loginInPause']?_0x3f37('0x5a'):null,'lastPauseAt':moment()[_0x3f37('0x37')](_0x3f37('0x31')),'interface':_0x3dbaac});}})[_0x3f37('0x2b')](function(_0x19b5e1){_0x303fe7(_0x19b5e1);})[_0x3f37('0x1b')](function(_0x484e74){_0x7ad191(_0x3bed9e['error'](0x1f4,_0x484e74[_0x3f37('0x1a')]));});});}; \ No newline at end of file +var _0x8ef4=['count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','./user.socket','request','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetUser','User','findAll','raw','options','attributes','limit','include','map','model','then','ShowUser','find','where','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','findOne','isValidChannel','channel','Unknown\x20channel','PAUSE','system','chat','sms','all','LogoutUser','destroy','mobile','phone','loginInPause'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0x8ef4,0xc1));var _0x48ef=function(_0xb39122,_0x1c4f04){_0xb39122=_0xb39122-0x0;var _0x4126c7=_0x8ef4[_0xb39122];return _0x4126c7;};'use strict';var _=require(_0x48ef('0x0'));var util=require(_0x48ef('0x1'));var moment=require(_0x48ef('0x2'));var BPromise=require(_0x48ef('0x3'));var rs=require(_0x48ef('0x4'));var fs=require('fs');var Redis=require(_0x48ef('0x5'));var db=require(_0x48ef('0x6'))['db'];var utils=require(_0x48ef('0x7'));var logger=require(_0x48ef('0x8'))(_0x48ef('0x9'));var config=require(_0x48ef('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x48ef('0xb')]({'port':0x232a});config['redis']=_[_0x48ef('0xc')](config[_0x48ef('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x48ef('0xd')]));require(_0x48ef('0xe'))['register'](socket);function respondWithRpcPromise(_0x1c36c9,_0x58d184,_0x285e1f){return new BPromise(function(_0x44a054,_0x5ad990){return client[_0x48ef('0xf')](_0x1c36c9,_0x285e1f)['then'](function(_0x34e7cb){logger['info'](_0x48ef('0x10'),_0x58d184,_0x48ef('0x11'));logger[_0x48ef('0x12')](_0x48ef('0x13'),_0x58d184,_0x48ef('0x11'),JSON[_0x48ef('0x14')](_0x34e7cb));if(_0x34e7cb['error']){if(_0x34e7cb[_0x48ef('0x15')][_0x48ef('0x16')]===0x1f4){logger[_0x48ef('0x15')](_0x48ef('0x10'),_0x58d184,_0x34e7cb[_0x48ef('0x15')][_0x48ef('0x17')]);return _0x5ad990(_0x34e7cb['error']['message']);}logger[_0x48ef('0x15')](_0x48ef('0x10'),_0x58d184,_0x34e7cb[_0x48ef('0x15')][_0x48ef('0x17')]);return _0x44a054(_0x34e7cb[_0x48ef('0x15')][_0x48ef('0x17')]);}else{logger[_0x48ef('0x18')](_0x48ef('0x10'),_0x58d184,_0x48ef('0x11'));_0x44a054(_0x34e7cb[_0x48ef('0x19')][_0x48ef('0x17')]);}})[_0x48ef('0x1a')](function(_0x5f0bb1){logger[_0x48ef('0x15')]('User,\x20%s,\x20%s',_0x58d184,_0x5f0bb1);_0x5ad990(_0x5f0bb1);});});}exports[_0x48ef('0x1b')]=function(_0x3b74ee){var _0x1137eb=this;return new Promise(function(_0x48cbc8,_0x436969){return db[_0x48ef('0x1c')][_0x48ef('0x1d')]({'raw':_0x3b74ee['options']?_0x3b74ee['options'][_0x48ef('0x1e')]===undefined?!![]:![]:!![],'where':_0x3b74ee[_0x48ef('0x1f')]?_0x3b74ee[_0x48ef('0x1f')]['where']||null:null,'attributes':_0x3b74ee[_0x48ef('0x1f')]?_0x3b74ee[_0x48ef('0x1f')][_0x48ef('0x20')]||null:null,'limit':_0x3b74ee['options']?_0x3b74ee[_0x48ef('0x1f')][_0x48ef('0x21')]||null:null,'include':_0x3b74ee[_0x48ef('0x1f')]?_0x3b74ee[_0x48ef('0x1f')][_0x48ef('0x22')]?_['map'](_0x3b74ee[_0x48ef('0x1f')]['include'],function(_0x1341b2){return{'model':db[_0x1341b2['model']],'as':_0x1341b2['as'],'attributes':_0x1341b2[_0x48ef('0x20')],'include':_0x1341b2[_0x48ef('0x22')]?_[_0x48ef('0x23')](_0x1341b2['include'],function(_0x1993bf){return{'model':db[_0x1993bf[_0x48ef('0x24')]],'as':_0x1993bf['as'],'attributes':_0x1993bf[_0x48ef('0x20')],'include':_0x1993bf[_0x48ef('0x22')]?_['map'](_0x1993bf['include'],function(_0x385a0c){return{'model':db[_0x385a0c[_0x48ef('0x24')]],'as':_0x385a0c['as'],'attributes':_0x385a0c[_0x48ef('0x20')]};}):[]};}):[]};}):[]:[]})[_0x48ef('0x25')](function(_0x52c3de){logger[_0x48ef('0x18')](_0x48ef('0x1b'),_0x3b74ee);logger[_0x48ef('0x12')]('GetUser',_0x3b74ee,JSON['stringify'](_0x52c3de));_0x48cbc8(_0x52c3de);})[_0x48ef('0x1a')](function(_0x27a96a){logger[_0x48ef('0x15')](_0x48ef('0x1b'),_0x27a96a['message'],_0x3b74ee);_0x436969(_0x1137eb['error'](0x1f4,_0x27a96a[_0x48ef('0x17')]));});});};exports[_0x48ef('0x26')]=function(_0xba7448){var _0x351cd5=this;return new Promise(function(_0x3f81b7,_0x2e3b7e){return db[_0x48ef('0x1c')][_0x48ef('0x27')]({'raw':_0xba7448[_0x48ef('0x1f')]?_0xba7448[_0x48ef('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0xba7448[_0x48ef('0x1f')]?_0xba7448[_0x48ef('0x1f')][_0x48ef('0x28')]||null:null,'attributes':_0xba7448[_0x48ef('0x1f')]?_0xba7448['options'][_0x48ef('0x20')]||null:null,'include':_0xba7448['options']?_0xba7448[_0x48ef('0x1f')]['include']?_['map'](_0xba7448[_0x48ef('0x1f')][_0x48ef('0x22')],function(_0x73642a){return{'model':db[_0x73642a['model']],'as':_0x73642a['as'],'attributes':_0x73642a[_0x48ef('0x20')],'include':_0x73642a[_0x48ef('0x22')]?_['map'](_0x73642a['include'],function(_0x2114ad){return{'model':db[_0x2114ad[_0x48ef('0x24')]],'as':_0x2114ad['as'],'attributes':_0x2114ad[_0x48ef('0x20')],'include':_0x2114ad[_0x48ef('0x22')]?_[_0x48ef('0x23')](_0x2114ad[_0x48ef('0x22')],function(_0x59c831){return{'model':db[_0x59c831[_0x48ef('0x24')]],'as':_0x59c831['as'],'attributes':_0x59c831['attributes']};}):[]};}):[]};}):[]:[]})[_0x48ef('0x25')](function(_0x475a98){logger[_0x48ef('0x18')]('ShowUser',_0xba7448);logger['debug'](_0x48ef('0x26'),_0xba7448,JSON[_0x48ef('0x14')](_0x475a98));_0x3f81b7(_0x475a98);})[_0x48ef('0x1a')](function(_0x565311){logger[_0x48ef('0x15')](_0x48ef('0x26'),_0x565311[_0x48ef('0x17')],_0xba7448);_0x2e3b7e(_0x351cd5[_0x48ef('0x15')](0x1f4,_0x565311['message']));});});};exports[_0x48ef('0x29')]=function(_0x3c26a1){var _0x1989da=this;return new Promise(function(_0x5f3be3,_0x15e1ff){var _0x5a6f93;return db[_0x48ef('0x1c')]['find']({'where':_0x3c26a1[_0x48ef('0x1f')][_0x48ef('0x28')]||{},'attributes':['id',_0x48ef('0x2a'),_0x48ef('0x2b'),_0x48ef('0x2c'),_0x48ef('0x2d')]})[_0x48ef('0x25')](function(_0x21520f){if(_0x21520f){_0x5a6f93=_0x21520f;return db[_0x48ef('0x2e')][_0x48ef('0x2f')]({'paused':0x1},{'where':{'UserId':_0x5a6f93['id']},'individualHooks':!![]});}})['then'](function(){if(_0x5a6f93){return db[_0x48ef('0x30')][_0x48ef('0x1d')]({'where':{'membername':_0x5a6f93[_0x48ef('0x2a')],'type':'PAUSE','exitAt':null}});}})[_0x48ef('0x25')](function(_0x5da59c){if(_0x5a6f93){if(_0x5da59c&&_0x5da59c[_0x48ef('0x31')]){var _0xd35ea7=moment()[_0x48ef('0x32')](_0x48ef('0x33'));for(var _0x2a3aff=0x0,_0x225b2c=_0x5da59c['length'];_0x2a3aff<_0x225b2c;_0x2a3aff++){_0x5da59c[_0x2a3aff][_0x48ef('0x34')]({'exitAt':_0xd35ea7});}}}})[_0x48ef('0x25')](function(){if(_0x5a6f93){var _0x13deb9=[];var _0xaa4b56=utils[_0x48ef('0x35')]();_0xaa4b56[_0x48ef('0x36')](function(_0x45ca1c){_0x13deb9[_0x48ef('0x37')]({'channel':_0x45ca1c,'membername':_0x5a6f93[_0x48ef('0x2a')],'interface':_[_0x48ef('0x38')](_0x5a6f93['interface'])?util[_0x48ef('0x32')](_0x48ef('0x39'),_0x5a6f93['name']):_0x5a6f93['interface'],'type':'PAUSE','enterAt':moment()[_0x48ef('0x32')](_0x48ef('0x33')),'data1':_0x3c26a1[_0x48ef('0x3a')][_0x48ef('0x3b')]||_0x48ef('0x3c'),'role':_0x5a6f93[_0x48ef('0x2b')],'internal':_0x5a6f93[_0x48ef('0x2c')],'uniqueid':_0x3c26a1[_0x48ef('0x3a')][_0x48ef('0x3d')]||null});});return db[_0x48ef('0x30')][_0x48ef('0x3e')](_0x13deb9,{'individualHooks':!![]});}})[_0x48ef('0x25')](function(){if(_0x5a6f93){return _0x5a6f93[_0x48ef('0x2f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x3c26a1['body']['type']||_0x48ef('0x3c'),'lastPauseAt':moment()[_0x48ef('0x32')](_0x48ef('0x33'))});}})[_0x48ef('0x25')](function(_0x1b69a9){_0x5f3be3(_0x1b69a9);})[_0x48ef('0x1a')](function(_0x3f6d6d){_0x15e1ff(_0x1989da[_0x48ef('0x15')](0x1f4,_0x3f6d6d['message']));});});};exports['UnpauseUser']=function(_0x33bc6c){var _0x56d378=this;return new Promise(function(_0x3dffbd,_0x49f0a3){var _0x55e65d;return db[_0x48ef('0x1c')][_0x48ef('0x3f')]({'where':_0x33bc6c[_0x48ef('0x1f')]['where']||{},'attributes':['id','name']})['then'](function(_0x51b990){if(_0x51b990){_0x55e65d=_0x51b990;if(_0x33bc6c[_0x48ef('0x3a')]['channel']&&!utils[_0x48ef('0x40')](_0x33bc6c[_0x48ef('0x3a')][_0x48ef('0x41')])){throw new Error(_0x48ef('0x42'));}switch(_0x33bc6c[_0x48ef('0x3a')][_0x48ef('0x41')]){case'voice':return db[_0x48ef('0x2e')][_0x48ef('0x2f')]({'paused':0x0},{'where':{'UserId':_0x55e65d['id']}})[_0x48ef('0x25')](function(){return db[_0x48ef('0x30')][_0x48ef('0x27')]({'where':{'channel':_0x33bc6c[_0x48ef('0x3a')]['channel'],'membername':_0x55e65d[_0x48ef('0x2a')],'type':_0x48ef('0x43'),'exitAt':null}});})[_0x48ef('0x25')](function(_0x27d4ab){if(_0x27d4ab){return _0x27d4ab[_0x48ef('0x2f')]({'exitAt':moment()[_0x48ef('0x32')](_0x48ef('0x33')),'data2':_0x48ef('0x44')},{'individualHooks':!![]});}return null;})[_0x48ef('0x25')](function(){return _0x55e65d[_0x48ef('0x2f')]({'voicePause':![]});});case'mail':case _0x48ef('0x45'):case'fax':case _0x48ef('0x46'):case'openchannel':return db['MemberReport']['find']({'where':{'channel':_0x33bc6c[_0x48ef('0x3a')][_0x48ef('0x41')],'membername':_0x55e65d[_0x48ef('0x2a')],'type':'PAUSE','exitAt':null}})[_0x48ef('0x25')](function(_0xca3d36){return _0xca3d36[_0x48ef('0x2f')]({'exitAt':moment()[_0x48ef('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x48ef('0x44')},{'individualHooks':!![]});})[_0x48ef('0x25')](function(){var _0x34f473={};_['set'](_0x34f473,util[_0x48ef('0x32')]('%s%s',_0x33bc6c[_0x48ef('0x3a')][_0x48ef('0x41')],'Pause'),![]);return _0x55e65d[_0x48ef('0x2f')](_0x34f473);});default:return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x55e65d['id']}})[_0x48ef('0x25')](function(){return db[_0x48ef('0x30')][_0x48ef('0x1d')]({'where':{'membername':_0x55e65d['name'],'type':'PAUSE','exitAt':null}});})[_0x48ef('0x25')](function(_0x2adb69){var _0x2949d3=[];_0x2adb69[_0x48ef('0x36')](function(_0x407f44){_0x2949d3[_0x48ef('0x37')](_0x407f44[_0x48ef('0x2f')]({'exitAt':moment()[_0x48ef('0x32')](_0x48ef('0x33')),'data2':_0x48ef('0x44')}));});return BPromise[_0x48ef('0x47')](_0x2949d3);})[_0x48ef('0x25')](function(){return _0x55e65d['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x48ef('0x25')](function(_0x3a1ea7){_0x3dffbd(_0x3a1ea7);})[_0x48ef('0x1a')](function(_0x2a92c7){_0x49f0a3(_0x56d378[_0x48ef('0x15')](0x1f4,_0x2a92c7[_0x48ef('0x17')]));});});};exports[_0x48ef('0x48')]=function(_0x5912d3){var _0x32ea0a=this;return new Promise(function(_0xf48a4b,_0x5a799c){var _0x13ab86;return db[_0x48ef('0x1c')]['findOne']({'where':_0x5912d3[_0x48ef('0x1f')][_0x48ef('0x28')]||{},'attributes':['id','name']})[_0x48ef('0x25')](function(_0x4c6347){if(_0x4c6347){_0x13ab86=_0x4c6347;return db[_0x48ef('0x2e')][_0x48ef('0x49')]({'where':{'membername':_0x13ab86[_0x48ef('0x2a')]},'individualHooks':!![]});}})[_0x48ef('0x25')](function(){if(_0x13ab86){return db['MemberReport']['findAll']({'where':{'membername':_0x13ab86['name'],'exitAt':null}});}})[_0x48ef('0x25')](function(_0x29f965){if(_0x13ab86){if(_0x29f965&&_0x29f965[_0x48ef('0x31')]){var _0x480a0c=[];_0x29f965[_0x48ef('0x36')](function(_0x54f810){_0x480a0c[_0x48ef('0x37')](_0x54f810[_0x48ef('0x2f')]({'exitAt':moment()[_0x48ef('0x32')](_0x48ef('0x33'))}));});return BPromise[_0x48ef('0x47')](_0x480a0c);}}})['then'](function(){if(_0x13ab86){return _0x13ab86[_0x48ef('0x2f')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x48ef('0x25')](function(_0x2f58d2){_0xf48a4b(_0x2f58d2);})[_0x48ef('0x1a')](function(_0x2ab756){_0x5a799c(_0x32ea0a['error'](0x1f4,_0x2ab756[_0x48ef('0x17')]));});});};exports['LoginUser']=function(_0x3b7fa1){var _0x5eea0f=this;return new Promise(function(_0x177e38,_0x56a7c0){var _0x2bf8ad;var _0x58f1fa;var _0x5c5651;var _0x36ded4;return db[_0x48ef('0x1c')]['findOne']({'where':_0x3b7fa1[_0x48ef('0x1f')][_0x48ef('0x28')]||{},'attributes':['id',_0x48ef('0x2a'),'role',_0x48ef('0x4a'),_0x48ef('0x4b'),'internal',_0x48ef('0x4c'),'interface']})[_0x48ef('0x25')](function(_0x306111){if(_0x306111){_0x2bf8ad=_0x306111;_0x36ded4=_0x3b7fa1[_0x48ef('0x3a')]['interface']?_0x3b7fa1[_0x48ef('0x3a')][_0x48ef('0x2d')]:util['format'](_0x48ef('0x39'),_0x2bf8ad[_0x48ef('0x2a')]);return db[_0x48ef('0x1c')][_0x48ef('0x4d')]({'where':{'role':_0x48ef('0x4e'),'online':!![],'id':{'$ne':_0x2bf8ad['id']}}});}})[_0x48ef('0x25')](function(_0xa71580){if(_0xa71580){_0x5c5651=_0xa71580;return require(_0x48ef('0x4f'))[_0x48ef('0x50')]();}})[_0x48ef('0x25')](function(_0x3f7f39){if(_0x3f7f39&&_0x3f7f39[_0x48ef('0x51')]&&_0x5c5651>=_0x3f7f39[_0x48ef('0x51')]){throw new Error(_0x48ef('0x52'));}})['then'](function(){if(_0x2bf8ad){return db[_0x48ef('0x2e')][_0x48ef('0x49')]({'where':{'membername':_0x2bf8ad['name']},'individualHooks':!![]});}})[_0x48ef('0x25')](function(){if(_0x2bf8ad){return _0x2bf8ad[_0x48ef('0x53')]({'raw':!![]});}})[_0x48ef('0x25')](function(_0x2d3662){if(_0x2bf8ad){if(_0x2d3662){var _0x51645a=[];_0x58f1fa=_0x2d3662;if(_0x58f1fa[_0x48ef('0x31')]){for(var _0x5334d1=0x0;_0x5334d1<_0x58f1fa[_0x48ef('0x31')];_0x5334d1++){_0x51645a[_0x48ef('0x37')](db[_0x48ef('0x2e')][_0x48ef('0x54')]({'membername':_0x2bf8ad['name'],'UserId':_0x2bf8ad['id'],'queue_name':_0x58f1fa[_0x5334d1][_0x48ef('0x2a')],'VoiceQueueId':_0x58f1fa[_0x5334d1]['id'],'interface':_0x36ded4,'paused':_0x2bf8ad[_0x48ef('0x4c')]||![],'penalty':_0x58f1fa[_0x5334d1][_0x48ef('0x55')]||0x0}));}return BPromise[_0x48ef('0x47')](_0x51645a);}}}})[_0x48ef('0x25')](function(){if(_0x2bf8ad){return db[_0x48ef('0x30')][_0x48ef('0x1d')]({'where':{'membername':_0x2bf8ad[_0x48ef('0x2a')],'exitAt':null}});}})[_0x48ef('0x25')](function(_0x4b600d){if(_0x2bf8ad){if(_0x4b600d&&_0x4b600d[_0x48ef('0x31')]){var _0x3a546a=[];_0x4b600d['forEach'](function(_0x59e361){_0x3a546a[_0x48ef('0x37')](_0x59e361['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x48ef('0x47')](_0x3a546a);}}})[_0x48ef('0x25')](function(_0x575707){if(_0x2bf8ad){var _0x4cd08b=[];var _0x10dd91=[];var _0x366b22=utils[_0x48ef('0x35')]();var _0x14c747={'membername':_0x2bf8ad[_0x48ef('0x2a')],'interface':_0x36ded4,'enterAt':moment()[_0x48ef('0x32')](_0x48ef('0x33')),'role':_0x2bf8ad[_0x48ef('0x2b')],'internal':_0x2bf8ad[_0x48ef('0x2c')]};_0x366b22['forEach'](function(_0x209679){_0x4cd08b[_0x48ef('0x37')](_[_0x48ef('0x56')]({'channel':_0x209679,'type':_0x48ef('0x57'),'data1':_0x48ef('0x58'),'data2':_0x36ded4},_0x14c747));if(_0x2bf8ad[_0x48ef('0x4c')]){_0x10dd91[_0x48ef('0x37')](_[_0x48ef('0x56')]({'channel':_0x209679,'type':_0x48ef('0x43'),'data1':_0x48ef('0x59')},_0x14c747));}});return db[_0x48ef('0x30')][_0x48ef('0x3e')](_0x4cd08b['concat'](_0x10dd91),{'individualHooks':!![]});}})[_0x48ef('0x25')](function(){if(_0x2bf8ad){return _0x2bf8ad[_0x48ef('0x2f')]({'online':!![],'lastLoginAt':moment()[_0x48ef('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2bf8ad[_0x48ef('0x4c')]||![],'mailPause':_0x2bf8ad[_0x48ef('0x4c')]||![],'chatPause':_0x2bf8ad[_0x48ef('0x4c')]||![],'faxPause':_0x2bf8ad['loginInPause']||![],'smsPause':_0x2bf8ad[_0x48ef('0x4c')]||![],'openchannelPause':_0x2bf8ad[_0x48ef('0x4c')]||![],'pauseType':_0x2bf8ad[_0x48ef('0x4c')]?_0x48ef('0x59'):null,'lastPauseAt':moment()[_0x48ef('0x32')](_0x48ef('0x33')),'interface':_0x36ded4});}})[_0x48ef('0x25')](function(_0x166c26){_0x177e38(_0x166c26);})[_0x48ef('0x1a')](function(_0xeb914c){_0x56a7c0(_0x5eea0f[_0x48ef('0x15')](0x1f4,_0xeb914c[_0x48ef('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index bef6a2c..e2acab8 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 _0x40db=['length','user:','./user.events','save','update','emit','removeListener','register'];(function(_0x4b25a3,_0x878c39){var _0x5bd36a=function(_0x5b89a9){while(--_0x5b89a9){_0x4b25a3['push'](_0x4b25a3['shift']());}};_0x5bd36a(++_0x878c39);}(_0x40db,0xa2));var _0xb40d=function(_0x53488e,_0x37addb){_0x53488e=_0x53488e-0x0;var _0xd5173b=_0x40db[_0x53488e];return _0xd5173b;};'use strict';var UserEvents=require(_0xb40d('0x0'));var events=[_0xb40d('0x1'),'remove',_0xb40d('0x2')];function createListener(_0x1d5c86,_0x30ff42){return function(_0x498aeb){_0x30ff42[_0xb40d('0x3')](_0x1d5c86,_0x498aeb);};}function removeListener(_0x34ad55,_0x3cd84d){return function(){UserEvents[_0xb40d('0x4')](_0x34ad55,_0x3cd84d);};}exports[_0xb40d('0x5')]=function(_0x16abd7){for(var _0x52781e=0x0,_0x179f86=events[_0xb40d('0x6')];_0x52781e<_0x179f86;_0x52781e++){var _0x5ca17d=events[_0x52781e];var _0x204be8=createListener(_0xb40d('0x7')+_0x5ca17d,_0x16abd7);UserEvents['on'](_0x5ca17d,_0x204be8);}}; \ No newline at end of file +var _0x7b31=['./user.events','save','remove','emit','removeListener','register','length','user:'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7b31,0x70));var _0x17b3=function(_0x5592bd,_0x562e42){_0x5592bd=_0x5592bd-0x0;var _0x42a9f7=_0x7b31[_0x5592bd];return _0x42a9f7;};'use strict';var UserEvents=require(_0x17b3('0x0'));var events=[_0x17b3('0x1'),_0x17b3('0x2'),'update'];function createListener(_0x47c70e,_0x4358ab){return function(_0x300f21){_0x4358ab[_0x17b3('0x3')](_0x47c70e,_0x300f21);};}function removeListener(_0x145460,_0x3f9f50){return function(){UserEvents[_0x17b3('0x4')](_0x145460,_0x3f9f50);};}exports[_0x17b3('0x5')]=function(_0x430d52){for(var _0x3b81af=0x0,_0x36163f=events[_0x17b3('0x6')];_0x3b81af<_0x36163f;_0x3b81af++){var _0x3fe600=events[_0x3b81af];var _0x4dc221=createListener(_0x17b3('0x7')+_0x3fe600,_0x430d52);UserEvents['on'](_0x3fe600,_0x4dc221);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 00b3fc2..7fe8867 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 _0x2b55=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports','multer','path'];(function(_0xecd2a5,_0x57c798){var _0x3e3e5c=function(_0x185f42){while(--_0x185f42){_0xecd2a5['push'](_0xecd2a5['shift']());}};_0x3e3e5c(++_0x57c798);}(_0x2b55,0x1a6));var _0x52b5=function(_0x2e42ba,_0x23b069){_0x2e42ba=_0x2e42ba-0x0;var _0x208546=_0x2b55[_0x2e42ba];return _0x208546;};'use strict';var multer=require(_0x52b5('0x0'));var util=require('util');var path=require(_0x52b5('0x1'));var timeout=require(_0x52b5('0x2'));var express=require(_0x52b5('0x3'));var router=express[_0x52b5('0x4')]();var auth=require(_0x52b5('0x5'));var interaction=require(_0x52b5('0x6'));var config=require('../../config/environment');module[_0x52b5('0x7')]=router; \ No newline at end of file +var _0x2dcc=['../../components/interaction/service','../../config/environment','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x70980f,_0x514088){var _0x5ccec5=function(_0x24f971){while(--_0x24f971){_0x70980f['push'](_0x70980f['shift']());}};_0x5ccec5(++_0x514088);}(_0x2dcc,0x17a));var _0xc2dc=function(_0xf65191,_0x437b0e){_0xf65191=_0xf65191-0x0;var _0x535b69=_0x2dcc[_0xf65191];return _0x535b69;};'use strict';var multer=require(_0xc2dc('0x0'));var util=require('util');var path=require(_0xc2dc('0x1'));var timeout=require(_0xc2dc('0x2'));var express=require(_0xc2dc('0x3'));var router=express[_0xc2dc('0x4')]();var auth=require(_0xc2dc('0x5'));var interaction=require(_0xc2dc('0x6'));var config=require(_0xc2dc('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 6f8e898..d55c015 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 _0xb10b=['sequelize','INTEGER'];(function(_0xcded2e,_0x12be16){var _0x453367=function(_0x26927a){while(--_0x26927a){_0xcded2e['push'](_0xcded2e['shift']());}};_0x453367(++_0x12be16);}(_0xb10b,0x12a));var _0xbb10=function(_0x148aa9,_0x421ae3){_0x148aa9=_0x148aa9-0x0;var _0x530a22=_0xb10b[_0x148aa9];return _0x530a22;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x1e271f,_0xf14504){var _0x2b2ac5=function(_0x21c3b6){while(--_0x21c3b6){_0x1e271f['push'](_0x1e271f['shift']());}};_0x2b2ac5(++_0xf14504);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index be9b9aa..567603b 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 _0x8cda=['request-promise','rimraf','../../config/environment','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','util','../../config/logger','api','moment','bluebird'];(function(_0x1fee9b,_0x292595){var _0x2ead7=function(_0x18e3dc){while(--_0x18e3dc){_0x1fee9b['push'](_0x1fee9b['shift']());}};_0x2ead7(++_0x292595);}(_0x8cda,0x1db));var _0xa8cd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8cda[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xa8cd('0x0'));var logger=require(_0xa8cd('0x1'))(_0xa8cd('0x2'));var moment=require(_0xa8cd('0x3'));var BPromise=require(_0xa8cd('0x4'));var rp=require(_0xa8cd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa8cd('0x6'));var config=require(_0xa8cd('0x7'));var attributes=require(_0xa8cd('0x8'));module['exports']=function(_0x80c199,_0x418e36){return _0x80c199[_0xa8cd('0x9')](_0xa8cd('0xa'),attributes,{'tableName':_0xa8cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x472f=['request-promise','rimraf','./userChatQueue.attributes','exports','define','lodash','util','api','moment','bluebird'];(function(_0x1383d9,_0x54f5fc){var _0x136ee6=function(_0x72622b){while(--_0x72622b){_0x1383d9['push'](_0x1383d9['shift']());}};_0x136ee6(++_0x54f5fc);}(_0x472f,0x1e5));var _0xf472=function(_0x5458f2,_0x4dbe68){_0x5458f2=_0x5458f2-0x0;var _0x5c77c7=_0x472f[_0x5458f2];return _0x5c77c7;};'use strict';var _=require(_0xf472('0x0'));var util=require(_0xf472('0x1'));var logger=require('../../config/logger')(_0xf472('0x2'));var moment=require(_0xf472('0x3'));var BPromise=require(_0xf472('0x4'));var rp=require(_0xf472('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf472('0x6'));var config=require('../../config/environment');var attributes=require(_0xf472('0x7'));module[_0xf472('0x8')]=function(_0x2327e6,_0x1d42bc){return _0x2327e6[_0xf472('0x9')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','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 b0ae3d4..387ac3a 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 _0x8e2d=['jayson/promise','client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x8e2d,0x155));var _0xd8e2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8e2d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd8e2('0x0'));var util=require(_0xd8e2('0x1'));var moment=require(_0xd8e2('0x2'));var BPromise=require(_0xd8e2('0x3'));var rs=require(_0xd8e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8e2('0x5'))['db'];var utils=require(_0xd8e2('0x6'));var logger=require(_0xd8e2('0x7'))('rpc');var config=require(_0xd8e2('0x8'));var jayson=require(_0xd8e2('0x9'));var client=jayson[_0xd8e2('0xa')][_0xd8e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e09aa,_0x53d656,_0x17a7df){return new BPromise(function(_0xc2f00d,_0x414155){return client[_0xd8e2('0xc')](_0x3e09aa,_0x17a7df)[_0xd8e2('0xd')](function(_0x2523ad){logger['info'](_0xd8e2('0xe'),_0x53d656,_0xd8e2('0xf'));logger[_0xd8e2('0x10')](_0xd8e2('0x11'),_0x53d656,_0xd8e2('0xf'),JSON[_0xd8e2('0x12')](_0x2523ad));if(_0x2523ad[_0xd8e2('0x13')]){if(_0x2523ad[_0xd8e2('0x13')][_0xd8e2('0x14')]===0x1f4){logger[_0xd8e2('0x13')](_0xd8e2('0xe'),_0x53d656,_0x2523ad[_0xd8e2('0x13')][_0xd8e2('0x15')]);return _0x414155(_0x2523ad['error']['message']);}logger[_0xd8e2('0x13')](_0xd8e2('0xe'),_0x53d656,_0x2523ad[_0xd8e2('0x13')][_0xd8e2('0x15')]);return _0xc2f00d(_0x2523ad[_0xd8e2('0x13')][_0xd8e2('0x15')]);}else{logger[_0xd8e2('0x16')](_0xd8e2('0xe'),_0x53d656,_0xd8e2('0xf'));_0xc2f00d(_0x2523ad[_0xd8e2('0x17')][_0xd8e2('0x15')]);}})[_0xd8e2('0x18')](function(_0x52c88f){logger['error'](_0xd8e2('0xe'),_0x53d656,_0x52c88f);_0x414155(_0x52c88f);});});} \ No newline at end of file +var _0x2af7=['UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','UserChatQueue,\x20%s,\x20%s','debug'];(function(_0x3ab753,_0x4a8d82){var _0x19b35=function(_0xc76b5a){while(--_0xc76b5a){_0x3ab753['push'](_0x3ab753['shift']());}};_0x19b35(++_0x4a8d82);}(_0x2af7,0x191));var _0x72af=function(_0x64e78a,_0x59d720){_0x64e78a=_0x64e78a-0x0;var _0x386763=_0x2af7[_0x64e78a];return _0x386763;};'use strict';var _=require(_0x72af('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x72af('0x1'));var fs=require('fs');var Redis=require(_0x72af('0x2'));var db=require(_0x72af('0x3'))['db'];var utils=require(_0x72af('0x4'));var logger=require(_0x72af('0x5'))(_0x72af('0x6'));var config=require('../../config/environment');var jayson=require(_0x72af('0x7'));var client=jayson[_0x72af('0x8')][_0x72af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1952b4,_0x202e45,_0x1e8b47){return new BPromise(function(_0x1283f9,_0xc1b9a2){return client['request'](_0x1952b4,_0x1e8b47)['then'](function(_0x4e13bb){logger[_0x72af('0xa')](_0x72af('0xb'),_0x202e45,'request\x20sent');logger[_0x72af('0xc')](_0x72af('0xd'),_0x202e45,_0x72af('0xe'),JSON[_0x72af('0xf')](_0x4e13bb));if(_0x4e13bb[_0x72af('0x10')]){if(_0x4e13bb['error']['code']===0x1f4){logger[_0x72af('0x10')](_0x72af('0xb'),_0x202e45,_0x4e13bb[_0x72af('0x10')]['message']);return _0xc1b9a2(_0x4e13bb[_0x72af('0x10')][_0x72af('0x11')]);}logger['error'](_0x72af('0xb'),_0x202e45,_0x4e13bb[_0x72af('0x10')][_0x72af('0x11')]);return _0x1283f9(_0x4e13bb['error'][_0x72af('0x11')]);}else{logger['info'](_0x72af('0xb'),_0x202e45,_0x72af('0xe'));_0x1283f9(_0x4e13bb['result'][_0x72af('0x11')]);}})['catch'](function(_0x5c85cb){logger[_0x72af('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x202e45,_0x5c85cb);_0xc1b9a2(_0x5c85cb);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index ac8456c..b2dbf1c 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 _0x6780=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x307101,_0x45fd0a){var _0x5d4775=function(_0x5864ff){while(--_0x5864ff){_0x307101['push'](_0x307101['shift']());}};_0x5d4775(++_0x45fd0a);}(_0x6780,0x1e6));var _0x0678=function(_0x433d3,_0x4256a7){_0x433d3=_0x433d3-0x0;var _0x139aa5=_0x6780[_0x433d3];return _0x139aa5;};'use strict';var multer=require(_0x0678('0x0'));var util=require(_0x0678('0x1'));var path=require(_0x0678('0x2'));var timeout=require(_0x0678('0x3'));var express=require(_0x0678('0x4'));var router=express[_0x0678('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0678('0x6'));var config=require(_0x0678('0x7'));module['exports']=router; \ No newline at end of file +var _0xe963=['multer','express','Router','../../components/auth/service','exports'];(function(_0x482070,_0x383ffd){var _0x728070=function(_0x5364ab){while(--_0x5364ab){_0x482070['push'](_0x482070['shift']());}};_0x728070(++_0x383ffd);}(_0xe963,0x19f));var _0x3e96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe963[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3e96('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3e96('0x1'));var router=express[_0x3e96('0x2')]();var auth=require(_0x3e96('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x3e96('0x4')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 808b6f2..2b41140 100644 --- a/server/api/userFaxQueue/userFaxQueue.attributes.js +++ b/server/api/userFaxQueue/userFaxQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa571=['exports','INTEGER','sequelize'];(function(_0x3c806c,_0x4bcebc){var _0x2f101f=function(_0x2a2fc9){while(--_0x2a2fc9){_0x3c806c['push'](_0x3c806c['shift']());}};_0x2f101f(++_0x4bcebc);}(_0xa571,0x107));var _0x1a57=function(_0x5d302c,_0x56f99d){_0x5d302c=_0x5d302c-0x0;var _0x5c9a03=_0xa571[_0x5d302c];return _0x5c9a03;};'use strict';var Sequelize=require(_0x1a57('0x0'));module[_0x1a57('0x1')]={'penalty':{'type':Sequelize[_0x1a57('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1a57('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x4514e3,_0xbe9be0){var _0x43ce27=function(_0x50f54b){while(--_0x50f54b){_0x4514e3['push'](_0x4514e3['shift']());}};_0x43ce27(++_0xbe9be0);}(_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},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 4e97004..9e45f63 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 _0xc638=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','define','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0x30bd66,_0x36a93d){var _0x74c9dd=function(_0x2cd660){while(--_0x2cd660){_0x30bd66['push'](_0x30bd66['shift']());}};_0x74c9dd(++_0x36a93d);}(_0xc638,0x112));var _0x8c63=function(_0x788de2,_0x5da66a){_0x788de2=_0x788de2-0x0;var _0x5bba81=_0xc638[_0x788de2];return _0x5bba81;};'use strict';var _=require(_0x8c63('0x0'));var util=require(_0x8c63('0x1'));var logger=require('../../config/logger')(_0x8c63('0x2'));var moment=require('moment');var BPromise=require(_0x8c63('0x3'));var rp=require(_0x8c63('0x4'));var fs=require('fs');var path=require(_0x8c63('0x5'));var rimraf=require(_0x8c63('0x6'));var config=require(_0x8c63('0x7'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x4f6303,_0x5deb49){return _0x4f6303[_0x8c63('0x8')](_0x8c63('0x9'),attributes,{'tableName':_0x8c63('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x570d=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','user_has_fax_queues'];(function(_0x15c32d,_0x1bb90f){var _0x175994=function(_0x160e2d){while(--_0x160e2d){_0x15c32d['push'](_0x15c32d['shift']());}};_0x175994(++_0x1bb90f);}(_0x570d,0x113));var _0xd570=function(_0x3c4999,_0x3bce96){_0x3c4999=_0x3c4999-0x0;var _0x8f1b0e=_0x570d[_0x3c4999];return _0x8f1b0e;};'use strict';var _=require(_0xd570('0x0'));var util=require('util');var logger=require(_0xd570('0x1'))(_0xd570('0x2'));var moment=require('moment');var BPromise=require(_0xd570('0x3'));var rp=require(_0xd570('0x4'));var fs=require('fs');var path=require(_0xd570('0x5'));var rimraf=require(_0xd570('0x6'));var config=require(_0xd570('0x7'));var attributes=require('./userFaxQueue.attributes');module[_0xd570('0x8')]=function(_0x4f57d5,_0x464c82){return _0x4f57d5[_0xd570('0x9')]('UserFaxQueue',attributes,{'tableName':_0xd570('0xa'),'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 bffd28e..3f077d5 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 _0x4f9a=['then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xf1326b,_0x29aba1){var _0x4b71df=function(_0x51b67b){while(--_0x51b67b){_0xf1326b['push'](_0xf1326b['shift']());}};_0x4b71df(++_0x29aba1);}(_0x4f9a,0xd1));var _0xa4f9=function(_0xa40bcf,_0x398e50){_0xa40bcf=_0xa40bcf-0x0;var _0x349c94=_0x4f9a[_0xa40bcf];return _0x349c94;};'use strict';var _=require('lodash');var util=require(_0xa4f9('0x0'));var moment=require(_0xa4f9('0x1'));var BPromise=require(_0xa4f9('0x2'));var rs=require(_0xa4f9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4f9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa4f9('0x5'))(_0xa4f9('0x6'));var config=require(_0xa4f9('0x7'));var jayson=require(_0xa4f9('0x8'));var client=jayson[_0xa4f9('0x9')][_0xa4f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27894c,_0x4d27cb,_0x21682f){return new BPromise(function(_0x2f5b76,_0x316d3a){return client['request'](_0x27894c,_0x21682f)[_0xa4f9('0xb')](function(_0x2ae5d9){logger[_0xa4f9('0xc')](_0xa4f9('0xd'),_0x4d27cb,_0xa4f9('0xe'));logger[_0xa4f9('0xf')](_0xa4f9('0x10'),_0x4d27cb,_0xa4f9('0xe'),JSON[_0xa4f9('0x11')](_0x2ae5d9));if(_0x2ae5d9[_0xa4f9('0x12')]){if(_0x2ae5d9[_0xa4f9('0x12')]['code']===0x1f4){logger[_0xa4f9('0x12')](_0xa4f9('0xd'),_0x4d27cb,_0x2ae5d9[_0xa4f9('0x12')]['message']);return _0x316d3a(_0x2ae5d9[_0xa4f9('0x12')][_0xa4f9('0x13')]);}logger[_0xa4f9('0x12')](_0xa4f9('0xd'),_0x4d27cb,_0x2ae5d9['error'][_0xa4f9('0x13')]);return _0x2f5b76(_0x2ae5d9[_0xa4f9('0x12')][_0xa4f9('0x13')]);}else{logger[_0xa4f9('0xc')](_0xa4f9('0xd'),_0x4d27cb,'request\x20sent');_0x2f5b76(_0x2ae5d9['result'][_0xa4f9('0x13')]);}})['catch'](function(_0xd59f56){logger[_0xa4f9('0x12')](_0xa4f9('0xd'),_0x4d27cb,_0xd59f56);_0x316d3a(_0xd59f56);});});} \ No newline at end of file +var _0xa445=['code','UserFaxQueue,\x20%s,\x20%s','message','catch','moment','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x47994d,_0x2646e8){var _0x2767bb=function(_0x33f710){while(--_0x33f710){_0x47994d['push'](_0x47994d['shift']());}};_0x2767bb(++_0x2646e8);}(_0xa445,0x10e));var _0x5a44=function(_0x22d34e,_0x2c1408){_0x22d34e=_0x22d34e-0x0;var _0x334761=_0xa445[_0x22d34e];return _0x334761;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5a44('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5a44('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x5a44('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0x5a44('0x3'));var jayson=require(_0x5a44('0x4'));var client=jayson[_0x5a44('0x5')][_0x5a44('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x30bdbe,_0x2eced2,_0x58427b){return new BPromise(function(_0x4e8d2e,_0x333acc){return client[_0x5a44('0x7')](_0x30bdbe,_0x58427b)[_0x5a44('0x8')](function(_0x41f384){logger[_0x5a44('0x9')]('UserFaxQueue,\x20%s,\x20%s',_0x2eced2,_0x5a44('0xa'));logger[_0x5a44('0xb')](_0x5a44('0xc'),_0x2eced2,'request\x20sent',JSON[_0x5a44('0xd')](_0x41f384));if(_0x41f384[_0x5a44('0xe')]){if(_0x41f384[_0x5a44('0xe')][_0x5a44('0xf')]===0x1f4){logger['error'](_0x5a44('0x10'),_0x2eced2,_0x41f384[_0x5a44('0xe')][_0x5a44('0x11')]);return _0x333acc(_0x41f384['error'][_0x5a44('0x11')]);}logger[_0x5a44('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x2eced2,_0x41f384['error']['message']);return _0x4e8d2e(_0x41f384[_0x5a44('0xe')][_0x5a44('0x11')]);}else{logger[_0x5a44('0x9')](_0x5a44('0x10'),_0x2eced2,'request\x20sent');_0x4e8d2e(_0x41f384['result'][_0x5a44('0x11')]);}})[_0x5a44('0x12')](function(_0x1e454f){logger[_0x5a44('0xe')](_0x5a44('0x10'),_0x2eced2,_0x1e454f);_0x333acc(_0x1e454f);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 876e04c..9ccb86e 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 _0x1be9=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','express'];(function(_0xe8a3d2,_0x1ac4d8){var _0x2a1ba2=function(_0x2892cd){while(--_0x2892cd){_0xe8a3d2['push'](_0xe8a3d2['shift']());}};_0x2a1ba2(++_0x1ac4d8);}(_0x1be9,0x84));var _0x91be=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x1be9[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0x91be('0x0'));var util=require(_0x91be('0x1'));var path=require(_0x91be('0x2'));var timeout=require('connect-timeout');var express=require(_0x91be('0x3'));var router=express['Router']();var auth=require(_0x91be('0x4'));var interaction=require(_0x91be('0x5'));var config=require(_0x91be('0x6'));module[_0x91be('0x7')]=router; \ No newline at end of file +var _0x8082=['multer','util','path','connect-timeout','express','../../config/environment','exports'];(function(_0x1f2234,_0x257a6b){var _0x5c1383=function(_0x1bf5a7){while(--_0x1bf5a7){_0x1f2234['push'](_0x1f2234['shift']());}};_0x5c1383(++_0x257a6b);}(_0x8082,0xe0));var _0x2808=function(_0x34af8d,_0xb52e77){_0x34af8d=_0x34af8d-0x0;var _0x10afec=_0x8082[_0x34af8d];return _0x10afec;};'use strict';var multer=require(_0x2808('0x0'));var util=require(_0x2808('0x1'));var path=require(_0x2808('0x2'));var timeout=require(_0x2808('0x3'));var express=require(_0x2808('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2808('0x5'));module[_0x2808('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 263af38..6841c32 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x3101eb,_0x342865){var _0x4e3696=function(_0x20bc49){while(--_0x20bc49){_0x3101eb['push'](_0x3101eb['shift']());}};_0x4e3696(++_0x342865);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x1d3f0c,_0x490a34){var _0x927276=function(_0x3bccef){while(--_0x3bccef){_0x1d3f0c['push'](_0x1d3f0c['shift']());}};_0x927276(++_0x490a34);}(_0xe706,0xa3));var _0x6e70=function(_0x1f75a4,_0x220814){_0x1f75a4=_0x1f75a4-0x0;var _0x3e3309=_0xe706[_0x1f75a4];return _0x3e3309;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 19ce7ef..ff41ace 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util'];(function(_0x4b7c13,_0x2c5239){var _0x37e4ec=function(_0x3e451b){while(--_0x3e451b){_0x4b7c13['push'](_0x4b7c13['shift']());}};_0x37e4ec(++_0x2c5239);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','user_has_mail_queues','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1e044c,_0x2d7e30){var _0x31886c=function(_0xa9dd01){while(--_0xa9dd01){_0x1e044c['push'](_0x1e044c['shift']());}};_0x31886c(++_0x2d7e30);}(_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('./userMailQueue.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('UserMailQueue',attributes,{'tableName':_0x0d8b('0x8'),'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 5b3aecf..330ff42 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 _0xcf30=['info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','then'];(function(_0x2124c5,_0x3f5233){var _0x304e39=function(_0x1cb6fe){while(--_0x1cb6fe){_0x2124c5['push'](_0x2124c5['shift']());}};_0x304e39(++_0x3f5233);}(_0xcf30,0x128));var _0x0cf3=function(_0x55f58e,_0x3a3d3b){_0x55f58e=_0x55f58e-0x0;var _0x25d1d7=_0xcf30[_0x55f58e];return _0x25d1d7;};'use strict';var _=require(_0x0cf3('0x0'));var util=require(_0x0cf3('0x1'));var moment=require(_0x0cf3('0x2'));var BPromise=require(_0x0cf3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0cf3('0x4'));var db=require(_0x0cf3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0cf3('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x126c36,_0x3e41ed,_0x3cab77){return new BPromise(function(_0x3b86b4,_0xa10648){return client['request'](_0x126c36,_0x3cab77)[_0x0cf3('0x7')](function(_0x4dc9a7){logger[_0x0cf3('0x8')](_0x0cf3('0x9'),_0x3e41ed,_0x0cf3('0xa'));logger[_0x0cf3('0xb')](_0x0cf3('0xc'),_0x3e41ed,_0x0cf3('0xa'),JSON[_0x0cf3('0xd')](_0x4dc9a7));if(_0x4dc9a7[_0x0cf3('0xe')]){if(_0x4dc9a7['error'][_0x0cf3('0xf')]===0x1f4){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x3e41ed,_0x4dc9a7['error'][_0x0cf3('0x10')]);return _0xa10648(_0x4dc9a7[_0x0cf3('0xe')]['message']);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x3e41ed,_0x4dc9a7[_0x0cf3('0xe')][_0x0cf3('0x10')]);return _0x3b86b4(_0x4dc9a7[_0x0cf3('0xe')][_0x0cf3('0x10')]);}else{logger[_0x0cf3('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x3e41ed,_0x0cf3('0xa'));_0x3b86b4(_0x4dc9a7[_0x0cf3('0x11')]['message']);}})[_0x0cf3('0x12')](function(_0x154602){logger[_0x0cf3('0xe')](_0x0cf3('0x9'),_0x3e41ed,_0x154602);_0xa10648(_0x154602);});});} \ No newline at end of file +var _0x8f53=['../../mysqldb','../../config/environment','jayson/promise','client','http','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis'];(function(_0x47cdf2,_0x4e2857){var _0x24d61f=function(_0x5d9c50){while(--_0x5d9c50){_0x47cdf2['push'](_0x47cdf2['shift']());}};_0x24d61f(++_0x4e2857);}(_0x8f53,0x128));var _0x38f5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8f53[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x38f5('0x0'));var util=require(_0x38f5('0x1'));var moment=require(_0x38f5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x38f5('0x3'));var db=require(_0x38f5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x38f5('0x5'));var jayson=require(_0x38f5('0x6'));var client=jayson[_0x38f5('0x7')][_0x38f5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16b957,_0x35dd8c,_0x834cf2){return new BPromise(function(_0x1d5096,_0x1e32af){return client['request'](_0x16b957,_0x834cf2)[_0x38f5('0x9')](function(_0x5d76b1){logger['info'](_0x38f5('0xa'),_0x35dd8c,_0x38f5('0xb'));logger[_0x38f5('0xc')](_0x38f5('0xd'),_0x35dd8c,_0x38f5('0xb'),JSON[_0x38f5('0xe')](_0x5d76b1));if(_0x5d76b1['error']){if(_0x5d76b1[_0x38f5('0xf')][_0x38f5('0x10')]===0x1f4){logger[_0x38f5('0xf')]('UserMailQueue,\x20%s,\x20%s',_0x35dd8c,_0x5d76b1[_0x38f5('0xf')][_0x38f5('0x11')]);return _0x1e32af(_0x5d76b1[_0x38f5('0xf')][_0x38f5('0x11')]);}logger['error'](_0x38f5('0xa'),_0x35dd8c,_0x5d76b1[_0x38f5('0xf')]['message']);return _0x1d5096(_0x5d76b1[_0x38f5('0xf')]['message']);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x35dd8c,'request\x20sent');_0x1d5096(_0x5d76b1[_0x38f5('0x12')][_0x38f5('0x11')]);}})[_0x38f5('0x13')](function(_0x318535){logger[_0x38f5('0xf')](_0x38f5('0xa'),_0x35dd8c,_0x318535);_0x1e32af(_0x318535);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index d362353..3008fb8 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 _0x6061=['../../config/environment','exports','multer','util','connect-timeout','Router','../../components/interaction/service'];(function(_0x1ed73e,_0x108238){var _0x497c61=function(_0x4a4896){while(--_0x4a4896){_0x1ed73e['push'](_0x1ed73e['shift']());}};_0x497c61(++_0x108238);}(_0x6061,0x159));var _0x1606=function(_0x539e5b,_0x3913c4){_0x539e5b=_0x539e5b-0x0;var _0x4c3ed6=_0x6061[_0x539e5b];return _0x4c3ed6;};'use strict';var multer=require(_0x1606('0x0'));var util=require(_0x1606('0x1'));var path=require('path');var timeout=require(_0x1606('0x2'));var express=require('express');var router=express[_0x1606('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1606('0x4'));var config=require(_0x1606('0x5'));module[_0x1606('0x6')]=router; \ No newline at end of file +var _0x12c5=['Router','../../components/auth/service','../../components/interaction/service','exports','multer','path','connect-timeout','express'];(function(_0x2bac31,_0x1c4fbe){var _0x2de22a=function(_0x228a3e){while(--_0x228a3e){_0x2bac31['push'](_0x2bac31['shift']());}};_0x2de22a(++_0x1c4fbe);}(_0x12c5,0x94));var _0x512c=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x12c5[_0x209941];return _0x1e8729;};'use strict';var multer=require(_0x512c('0x0'));var util=require('util');var path=require(_0x512c('0x1'));var timeout=require(_0x512c('0x2'));var express=require(_0x512c('0x3'));var router=express[_0x512c('0x4')]();var auth=require(_0x512c('0x5'));var interaction=require(_0x512c('0x6'));var config=require('../../config/environment');module[_0x512c('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index ee0fcd3..0b449d3 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 _0xd8b0=['exports','sequelize'];(function(_0x560250,_0x2a24f5){var _0x55e2e1=function(_0x2dba93){while(--_0x2dba93){_0x560250['push'](_0x560250['shift']());}};_0x55e2e1(++_0x2a24f5);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x56e0b6,_0x3fdb97){var _0x42e9c5=function(_0x587869){while(--_0x587869){_0x56e0b6['push'](_0x56e0b6['shift']());}};_0x42e9c5(++_0x3fdb97);}(_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 4e47052..d9d9018 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 _0x3b20=['bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','moment'];(function(_0x4b3f08,_0x32fa2e){var _0x576690=function(_0x2a03d6){while(--_0x2a03d6){_0x4b3f08['push'](_0x4b3f08['shift']());}};_0x576690(++_0x32fa2e);}(_0x3b20,0x1aa));var _0x03b2=function(_0x4265de,_0x3b72a8){_0x4265de=_0x4265de-0x0;var _0x32b15b=_0x3b20[_0x4265de];return _0x32b15b;};'use strict';var _=require(_0x03b2('0x0'));var util=require(_0x03b2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x03b2('0x2'));var BPromise=require(_0x03b2('0x3'));var rp=require(_0x03b2('0x4'));var fs=require('fs');var path=require(_0x03b2('0x5'));var rimraf=require(_0x03b2('0x6'));var config=require(_0x03b2('0x7'));var attributes=require(_0x03b2('0x8'));module[_0x03b2('0x9')]=function(_0xb4555e,_0x50c7a8){return _0xb4555e[_0x03b2('0xa')](_0x03b2('0xb'),attributes,{'tableName':_0x03b2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bf6=['bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','util','api','moment'];(function(_0x5da705,_0x3eb273){var _0x458b99=function(_0x41525a){while(--_0x41525a){_0x5da705['push'](_0x5da705['shift']());}};_0x458b99(++_0x3eb273);}(_0x8bf6,0xb1));var _0x68bf=function(_0x1ce94e,_0x47badc){_0x1ce94e=_0x1ce94e-0x0;var _0x1a9255=_0x8bf6[_0x1ce94e];return _0x1a9255;};'use strict';var _=require('lodash');var util=require(_0x68bf('0x0'));var logger=require('../../config/logger')(_0x68bf('0x1'));var moment=require(_0x68bf('0x2'));var BPromise=require(_0x68bf('0x3'));var rp=require(_0x68bf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68bf('0x5'));var config=require(_0x68bf('0x6'));var attributes=require(_0x68bf('0x7'));module[_0x68bf('0x8')]=function(_0x4ae1f4,_0xd279c9){return _0x4ae1f4[_0x68bf('0x9')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index d22a88c..c0fc7c1 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 _0xc779=['result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0xc779,0x94));var _0x9c77=function(_0x3257d5,_0x325595){_0x3257d5=_0x3257d5-0x0;var _0x39beeb=_0xc779[_0x3257d5];return _0x39beeb;};'use strict';var _=require(_0x9c77('0x0'));var util=require(_0x9c77('0x1'));var moment=require('moment');var BPromise=require(_0x9c77('0x2'));var rs=require(_0x9c77('0x3'));var fs=require('fs');var Redis=require(_0x9c77('0x4'));var db=require(_0x9c77('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c77('0x6'))(_0x9c77('0x7'));var config=require(_0x9c77('0x8'));var jayson=require(_0x9c77('0x9'));var client=jayson[_0x9c77('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fadee,_0x2087fd,_0x444d62){return new BPromise(function(_0x54a3ed,_0x5b1b1c){return client['request'](_0x1fadee,_0x444d62)[_0x9c77('0xb')](function(_0x5dca63){logger[_0x9c77('0xc')](_0x9c77('0xd'),_0x2087fd,_0x9c77('0xe'));logger[_0x9c77('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2087fd,_0x9c77('0xe'),JSON[_0x9c77('0x10')](_0x5dca63));if(_0x5dca63[_0x9c77('0x11')]){if(_0x5dca63['error'][_0x9c77('0x12')]===0x1f4){logger['error'](_0x9c77('0xd'),_0x2087fd,_0x5dca63['error']['message']);return _0x5b1b1c(_0x5dca63[_0x9c77('0x11')][_0x9c77('0x13')]);}logger[_0x9c77('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2087fd,_0x5dca63['error'][_0x9c77('0x13')]);return _0x54a3ed(_0x5dca63[_0x9c77('0x11')][_0x9c77('0x13')]);}else{logger[_0x9c77('0xc')](_0x9c77('0xd'),_0x2087fd,_0x9c77('0xe'));_0x54a3ed(_0x5dca63[_0x9c77('0x14')][_0x9c77('0x13')]);}})['catch'](function(_0x14b55e){logger[_0x9c77('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2087fd,_0x14b55e);_0x5b1b1c(_0x14b55e);});});} \ No newline at end of file +var _0x17d0=['catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x543178,_0xa94a76){var _0x8cc169=function(_0x485f45){while(--_0x485f45){_0x543178['push'](_0x543178['shift']());}};_0x8cc169(++_0xa94a76);}(_0x17d0,0x8d));var _0x017d=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0x17d0[_0x13f980];return _0x27153c;};'use strict';var _=require(_0x017d('0x0'));var util=require(_0x017d('0x1'));var moment=require('moment');var BPromise=require(_0x017d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x017d('0x3'));var db=require(_0x017d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x017d('0x5'))(_0x017d('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x017d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e622a,_0x3fc648,_0x2921bb){return new BPromise(function(_0x3cbe63,_0x363f53){return client['request'](_0x5e622a,_0x2921bb)[_0x017d('0x8')](function(_0x1b857b){logger[_0x017d('0x9')](_0x017d('0xa'),_0x3fc648,_0x017d('0xb'));logger[_0x017d('0xc')](_0x017d('0xd'),_0x3fc648,_0x017d('0xb'),JSON[_0x017d('0xe')](_0x1b857b));if(_0x1b857b[_0x017d('0xf')]){if(_0x1b857b['error'][_0x017d('0x10')]===0x1f4){logger[_0x017d('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3fc648,_0x1b857b[_0x017d('0xf')][_0x017d('0x11')]);return _0x363f53(_0x1b857b['error'][_0x017d('0x11')]);}logger['error'](_0x017d('0xa'),_0x3fc648,_0x1b857b[_0x017d('0xf')][_0x017d('0x11')]);return _0x3cbe63(_0x1b857b[_0x017d('0xf')][_0x017d('0x11')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x3fc648,_0x017d('0xb'));_0x3cbe63(_0x1b857b[_0x017d('0x12')]['message']);}})[_0x017d('0x13')](function(_0x23ecc2){logger[_0x017d('0xf')](_0x017d('0xa'),_0x3fc648,_0x23ecc2);_0x363f53(_0x23ecc2);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index a415da3..c6983bd 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 _0x7ed4=['removeResources','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','addResources','update','delete','destroy'];(function(_0x566661,_0x3ef886){var _0x2d07d9=function(_0x3badd1){while(--_0x3badd1){_0x566661['push'](_0x566661['shift']());}};_0x2d07d9(++_0x3ef886);}(_0x7ed4,0x1b2));var _0x47ed=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7ed4[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0x47ed('0x0'));var util=require('util');var path=require(_0x47ed('0x1'));var timeout=require(_0x47ed('0x2'));var express=require(_0x47ed('0x3'));var router=express[_0x47ed('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47ed('0x5'));var config=require(_0x47ed('0x6'));var controller=require('./userProfile.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x47ed('0x7')]);router[_0x47ed('0x8')]('/describe',auth[_0x47ed('0x9')](),controller['describe']);router[_0x47ed('0x8')](_0x47ed('0xa'),auth[_0x47ed('0x9')](),controller[_0x47ed('0xb')]);router[_0x47ed('0x8')](_0x47ed('0xc'),auth[_0x47ed('0x9')](),controller[_0x47ed('0xd')]);router[_0x47ed('0x8')](_0x47ed('0xe'),auth[_0x47ed('0x9')](),controller[_0x47ed('0xf')]);router[_0x47ed('0x10')]('/',auth[_0x47ed('0x9')](),controller[_0x47ed('0x11')]);router['post']('/:id/clone',auth[_0x47ed('0x9')](),controller['clone']);router[_0x47ed('0x10')]('/:id/sections',auth['isAuthenticated'](),controller['addSections']);router[_0x47ed('0x10')](_0x47ed('0xe'),auth[_0x47ed('0x9')](),controller[_0x47ed('0x12')]);router['put'](_0x47ed('0xa'),auth[_0x47ed('0x9')](),controller[_0x47ed('0x13')]);router[_0x47ed('0x14')]('/:id',auth[_0x47ed('0x9')](),controller[_0x47ed('0x15')]);router['delete'](_0x47ed('0xc'),auth[_0x47ed('0x9')](),controller['removeSections']);router[_0x47ed('0x14')](_0x47ed('0xe'),auth[_0x47ed('0x9')](),controller[_0x47ed('0x16')]);module[_0x47ed('0x17')]=router; \ No newline at end of file +var _0x689f=['put','destroy','removeSections','delete','removeResources','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addResources'];(function(_0x31c072,_0x379862){var _0x13e2cd=function(_0x501b3f){while(--_0x501b3f){_0x31c072['push'](_0x31c072['shift']());}};_0x13e2cd(++_0x379862);}(_0x689f,0xca));var _0xf689=function(_0x3bdace,_0x346358){_0x3bdace=_0x3bdace-0x0;var _0x65b0bb=_0x689f[_0x3bdace];return _0x65b0bb;};'use strict';var multer=require('multer');var util=require(_0xf689('0x0'));var path=require(_0xf689('0x1'));var timeout=require(_0xf689('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xf689('0x3'));var interaction=require(_0xf689('0x4'));var config=require(_0xf689('0x5'));var controller=require(_0xf689('0x6'));router[_0xf689('0x7')]('/',auth[_0xf689('0x8')](),controller[_0xf689('0x9')]);router[_0xf689('0x7')]('/describe',auth[_0xf689('0x8')](),controller[_0xf689('0xa')]);router[_0xf689('0x7')](_0xf689('0xb'),auth[_0xf689('0x8')](),controller[_0xf689('0xc')]);router[_0xf689('0x7')](_0xf689('0xd'),auth['isAuthenticated'](),controller[_0xf689('0xe')]);router[_0xf689('0x7')](_0xf689('0xf'),auth[_0xf689('0x8')](),controller[_0xf689('0x10')]);router[_0xf689('0x11')]('/',auth['isAuthenticated'](),controller[_0xf689('0x12')]);router[_0xf689('0x11')](_0xf689('0x13'),auth[_0xf689('0x8')](),controller[_0xf689('0x14')]);router[_0xf689('0x11')](_0xf689('0xd'),auth[_0xf689('0x8')](),controller['addSections']);router[_0xf689('0x11')](_0xf689('0xf'),auth[_0xf689('0x8')](),controller[_0xf689('0x15')]);router[_0xf689('0x16')]('/:id',auth[_0xf689('0x8')](),controller['update']);router['delete']('/:id',auth[_0xf689('0x8')](),controller[_0xf689('0x17')]);router['delete'](_0xf689('0xd'),auth[_0xf689('0x8')](),controller[_0xf689('0x18')]);router[_0xf689('0x19')](_0xf689('0xf'),auth[_0xf689('0x8')](),controller[_0xf689('0x1a')]);module[_0xf689('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 01a4357..a5c5497 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 _0x0a16=['sequelize','exports','STRING','name','setDataValue','crudPermissions','join','split'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0a16,0x160));var _0x60a1=function(_0x2e78b4,_0x4e9b05){_0x2e78b4=_0x2e78b4-0x0;var _0x129f4d=_0x0a16[_0x2e78b4];return _0x129f4d;};'use strict';var Sequelize=require(_0x60a1('0x0'));module[_0x60a1('0x1')]={'name':{'type':Sequelize[_0x60a1('0x2')],'allowNull':![],'unique':_0x60a1('0x3')},'crudPermissions':{'type':Sequelize[_0x60a1('0x2')],'set':function(_0x565a11){this[_0x60a1('0x4')](_0x60a1('0x5'),_0x565a11?_0x565a11[_0x60a1('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x60a1('0x5'))?this['getDataValue']('crudPermissions')[_0x60a1('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x5f68=['split','sequelize','exports','name','crudPermissions','join','getDataValue'];(function(_0x3f6441,_0x164f4a){var _0x284fb1=function(_0x3ef2f2){while(--_0x3ef2f2){_0x3f6441['push'](_0x3f6441['shift']());}};_0x284fb1(++_0x164f4a);}(_0x5f68,0x189));var _0x85f6=function(_0x102b48,_0x1ffa36){_0x102b48=_0x102b48-0x0;var _0x1819c4=_0x5f68[_0x102b48];return _0x1819c4;};'use strict';var Sequelize=require(_0x85f6('0x0'));module[_0x85f6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x85f6('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x3549fc){this['setDataValue'](_0x85f6('0x3'),_0x3549fc?_0x3549fc[_0x85f6('0x4')](''):[]);},'get':function(){return this[_0x85f6('0x5')]('crudPermissions')?this[_0x85f6('0x5')](_0x85f6('0x3'))[_0x85f6('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 2642a2d..7507aad 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 _0xd6d3=['findAll','rows','catch','show','includeAll','options','find','create','body','params','include','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','sectionId','Resources','describe','addSections','userProfileId','each','push','removeSections','ids','enabled','isEmpty','includes','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','getResources','undefined','Sequelize','ValidationError','Unknown\x20section','Invalid\x20section\x20\x27','all','ignore','childModel','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','value','squareprojects','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','Lists','companies','CmCompany','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','agent','Telephones','membername','User','telephone','VoiceQueues','queue','inbound','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','QueueCampaigns','users','telephones','Users','role','admin','user','Agents','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','intervals','Interval','pauses','scheduler','Schedule','sounds','tags','templates','Template','Trigger','trunks','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','whatsappaccounts','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','register','sendStatus','end','status','json','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','UserProfile','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','count'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd6d3,0x186));var _0x3d6d=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xd6d3[_0x413feb];return _0x40ee88;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3d6d('0x0'));var rimraf=require(_0x3d6d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d6d('0x2'));var rp=require(_0x3d6d('0x3'));var moment=require(_0x3d6d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3d6d('0x5'));var path=require(_0x3d6d('0x6'));var sox=require(_0x3d6d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3d6d('0x8'));var squel=require('squel');var crypto=require(_0x3d6d('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3d6d('0xa'));var querystring=require(_0x3d6d('0xb'));var Papa=require(_0x3d6d('0xc'));var Redis=require(_0x3d6d('0xd'));var authService=require(_0x3d6d('0xe'));var qs=require(_0x3d6d('0xf'));var as=require(_0x3d6d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d6d('0x11'))(_0x3d6d('0x12'));var utils=require(_0x3d6d('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3d6d('0x14'))['db'];config['redis']=_[_0x3d6d('0x15')](config[_0x3d6d('0x16')],{'host':_0x3d6d('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userProfile.socket')[_0x3d6d('0x18')](socket);function respondWithStatusCode(_0x43cec7,_0x319203){_0x319203=_0x319203||0xcc;return function(_0x59c609){if(_0x59c609){return _0x43cec7[_0x3d6d('0x19')](_0x319203);}return _0x43cec7['status'](_0x319203)[_0x3d6d('0x1a')]();};}function respondWithResult(_0x275928,_0x4295e1){_0x4295e1=_0x4295e1||0xc8;return function(_0x2648a1){if(_0x2648a1){return _0x275928[_0x3d6d('0x1b')](_0x4295e1)[_0x3d6d('0x1c')](_0x2648a1);}};}function respondWithFilteredResult(_0x54ffd6,_0x4dabf1){return function(_0x4d5433){if(_0x4d5433){var _0x59aa60=_0x4d5433['count'],_0x6122e0=_0x4dabf1['offset'],_0x13bf9c=_0x4dabf1['offset']+_0x4dabf1[_0x3d6d('0x1d')],_0xc0deed;if(_0x13bf9c>=_0x59aa60){_0x13bf9c=_0x59aa60;_0xc0deed=0xc8;}else{_0xc0deed=0xce;}_0x54ffd6[_0x3d6d('0x1b')](_0xc0deed);return _0x54ffd6[_0x3d6d('0x1e')](_0x3d6d('0x1f'),_0x6122e0+'-'+_0x13bf9c+'/'+_0x59aa60)[_0x3d6d('0x1c')](_0x4d5433);}return null;};}function patchUpdates(_0x18b1cb){return function(_0x462fb1){try{jsonpatch[_0x3d6d('0x20')](_0x462fb1,_0x18b1cb,!![]);}catch(_0x481c40){return BPromise[_0x3d6d('0x21')](_0x481c40);}return _0x462fb1[_0x3d6d('0x22')]();};}function saveUpdates(_0x4cf9a2,_0x30d40d){return function(_0x5ceda0){if(_0x5ceda0){return _0x5ceda0[_0x3d6d('0x23')](_0x4cf9a2)[_0x3d6d('0x24')](function(_0x386384){return _0x386384;});}return null;};}function removeEntity(_0x4b622c,_0x3f2e60){return function(_0x4f8319){if(_0x4f8319){return _0x4f8319[_0x3d6d('0x25')]()[_0x3d6d('0x24')](function(){_0x4b622c[_0x3d6d('0x1b')](0xcc)[_0x3d6d('0x1a')]();});}};}function handleEntityNotFound(_0x513a13,_0x453f77){return function(_0x1116f6){if(!_0x1116f6){_0x513a13[_0x3d6d('0x19')](0x194);}return _0x1116f6;};}function handleError(_0x4c9c4a,_0x5b8826){_0x5b8826=_0x5b8826||0x1f4;return function(_0x39be46){logger[_0x3d6d('0x26')](_0x39be46[_0x3d6d('0x27')]);if(_0x39be46[_0x3d6d('0x28')]){delete _0x39be46[_0x3d6d('0x28')];}_0x4c9c4a[_0x3d6d('0x1b')](_0x5b8826)[_0x3d6d('0x29')](_0x39be46);};}exports['index']=function(_0x58eb9d,_0x326b70){var _0x25fce4={},_0x329282={},_0x16ac4b={'count':0x0,'rows':[]};var _0x3671de=_[_0x3d6d('0x2a')](db[_0x3d6d('0x2b')][_0x3d6d('0x2c')],function(_0x15cc81){return{'name':_0x15cc81[_0x3d6d('0x2d')],'type':_0x15cc81[_0x3d6d('0x2e')][_0x3d6d('0x2f')]};});_0x329282[_0x3d6d('0x30')]=_[_0x3d6d('0x2a')](_0x3671de,_0x3d6d('0x28'));_0x329282['query']=_[_0x3d6d('0x31')](_0x58eb9d['query']);_0x329282['filters']=_[_0x3d6d('0x32')](_0x329282[_0x3d6d('0x30')],_0x329282[_0x3d6d('0x33')]);_0x25fce4[_0x3d6d('0x34')]=_[_0x3d6d('0x32')](_0x329282['model'],qs[_0x3d6d('0x35')](_0x58eb9d['query'][_0x3d6d('0x35')]));_0x25fce4[_0x3d6d('0x34')]=_0x25fce4[_0x3d6d('0x34')][_0x3d6d('0x36')]?_0x25fce4[_0x3d6d('0x34')]:_0x329282['model'];if(!_0x58eb9d['query']['hasOwnProperty'](_0x3d6d('0x37'))){_0x25fce4[_0x3d6d('0x1d')]=qs[_0x3d6d('0x1d')](_0x58eb9d['query'][_0x3d6d('0x1d')]);_0x25fce4[_0x3d6d('0x38')]=qs[_0x3d6d('0x38')](_0x58eb9d[_0x3d6d('0x33')][_0x3d6d('0x38')]);}_0x25fce4[_0x3d6d('0x39')]=qs[_0x3d6d('0x3a')](_0x58eb9d[_0x3d6d('0x33')][_0x3d6d('0x3a')]);_0x25fce4[_0x3d6d('0x3b')]=qs[_0x3d6d('0x3c')](_[_0x3d6d('0x3d')](_0x58eb9d[_0x3d6d('0x33')],_0x329282[_0x3d6d('0x3c')]),_0x3671de);if(_0x58eb9d[_0x3d6d('0x33')][_0x3d6d('0x3e')]){_0x25fce4[_0x3d6d('0x3b')]=_[_0x3d6d('0x3f')](_0x25fce4[_0x3d6d('0x3b')],{'$or':_[_0x3d6d('0x2a')](_0x3671de,function(_0x560e17){if(_0x560e17[_0x3d6d('0x2e')]!==_0x3d6d('0x40')){var _0xf346bc={};_0xf346bc[_0x560e17[_0x3d6d('0x28')]]={'$like':'%'+_0x58eb9d[_0x3d6d('0x33')][_0x3d6d('0x3e')]+'%'};return _0xf346bc;}})});}_0x25fce4=_[_0x3d6d('0x3f')]({},_0x25fce4,_0x58eb9d['options']);var _0x287581={'where':_0x25fce4[_0x3d6d('0x3b')]};return db[_0x3d6d('0x2b')][_0x3d6d('0x41')](_0x287581)[_0x3d6d('0x24')](function(_0x12743e){_0x16ac4b[_0x3d6d('0x41')]=_0x12743e;if(_0x58eb9d[_0x3d6d('0x33')]['includeAll']){_0x25fce4['include']=[{'all':!![]}];}return db[_0x3d6d('0x2b')][_0x3d6d('0x42')](_0x25fce4);})[_0x3d6d('0x24')](function(_0x19374a){_0x16ac4b[_0x3d6d('0x43')]=_0x19374a;return _0x16ac4b;})['then'](respondWithFilteredResult(_0x326b70,_0x25fce4))[_0x3d6d('0x44')](handleError(_0x326b70,null));};exports[_0x3d6d('0x45')]=function(_0x49cbf0,_0xd787d1){var _0x278b0d={'raw':![],'where':{'id':_0x49cbf0['params']['id']}},_0x278274={};_0x278274[_0x3d6d('0x30')]=_[_0x3d6d('0x31')](db['UserProfile'][_0x3d6d('0x2c')]);_0x278274['query']=_[_0x3d6d('0x31')](_0x49cbf0[_0x3d6d('0x33')]);_0x278274['filtears']=_['intersection'](_0x278274[_0x3d6d('0x30')],_0x278274[_0x3d6d('0x33')]);_0x278b0d[_0x3d6d('0x34')]=_[_0x3d6d('0x32')](_0x278274[_0x3d6d('0x30')],qs[_0x3d6d('0x35')](_0x49cbf0[_0x3d6d('0x33')][_0x3d6d('0x35')]));_0x278b0d['attributes']=_0x278b0d[_0x3d6d('0x34')][_0x3d6d('0x36')]?_0x278b0d[_0x3d6d('0x34')]:_0x278274[_0x3d6d('0x30')];if(_0x49cbf0[_0x3d6d('0x33')][_0x3d6d('0x46')]){_0x278b0d['include']=[{'all':!![]}];}_0x278b0d=_['merge']({},_0x278b0d,_0x49cbf0[_0x3d6d('0x47')]);return db[_0x3d6d('0x2b')][_0x3d6d('0x48')](_0x278b0d)[_0x3d6d('0x24')](handleEntityNotFound(_0xd787d1,null))['then'](respondWithResult(_0xd787d1,null))[_0x3d6d('0x44')](handleError(_0xd787d1,null));};exports['create']=function(_0x5df5ad,_0x4b6113){return db[_0x3d6d('0x2b')][_0x3d6d('0x49')](_0x5df5ad[_0x3d6d('0x4a')],{})['then'](respondWithResult(_0x4b6113,0xc9))['catch'](handleError(_0x4b6113,null));};exports['clone']=function(_0x3b949b,_0x1783d6){var _0x3e45d6={'where':{'id':_0x3b949b[_0x3d6d('0x4b')]['id']}},_0xa6704c={};_0xa6704c['model']=_['keys'](db[_0x3d6d('0x2b')][_0x3d6d('0x2c')]);_0x3e45d6[_0x3d6d('0x34')]=_[_0x3d6d('0x32')](_0xa6704c[_0x3d6d('0x30')],qs['fields'](_0x3b949b[_0x3d6d('0x33')][_0x3d6d('0x35')]));_0x3e45d6[_0x3d6d('0x34')]=_0x3e45d6['attributes']['length']?_0x3e45d6[_0x3d6d('0x34')]:_0xa6704c[_0x3d6d('0x30')];if(_0x3b949b[_0x3d6d('0x33')][_0x3d6d('0x46')]){_0x3e45d6[_0x3d6d('0x4c')]=[{'all':!![]}];}_0x3e45d6=_[_0x3d6d('0x3f')]({},_0x3e45d6,_0x3b949b['options']);return db['UserProfile'][_0x3d6d('0x48')](_0x3e45d6)['then'](handleEntityNotFound(_0x1783d6,null))[_0x3d6d('0x24')](function(_0x51dca0){if(_0x51dca0){var _0x40a96b=_0x51dca0[_0x3d6d('0x4d')]({'plain':!![]});_0x40a96b=qs[_0x3d6d('0x4e')](_0x40a96b,['id',_0x3d6d('0x4f'),_0x3d6d('0x50'),_0x3d6d('0x51')]);_0x3b949b[_0x3d6d('0x4a')]=_[_0x3d6d('0x4e')](_0x3b949b[_0x3d6d('0x4a')],['id','createdAt',_0x3d6d('0x50')]);return db[_0x3d6d('0x52')][_0x3d6d('0x53')](function(_0x4f59a0){return db['UserProfile']['create'](_[_0x3d6d('0x3f')](_0x40a96b,_0x3b949b[_0x3d6d('0x4a')]),{'include':_0x3b949b['query'][_0x3d6d('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x4f59a0})[_0x3d6d('0x24')](function(_0x48cf53){var _0x5b307f=_0x48cf53[_0x3d6d('0x4d')]({'plain':!![]});return db[_0x3d6d('0x54')][_0x3d6d('0x42')]({'where':{'userProfileId':_0x3b949b[_0x3d6d('0x4b')]['id']},'raw':!![]})[_0x3d6d('0x24')](function(_0x58a5ad){if(_0x58a5ad){return BPromise['each'](_0x58a5ad,function(_0x2d3b30){return new BPromise(function(_0x2ae805,_0x133a34){if(_0x2d3b30[_0x3d6d('0x55')]===null||_0x2d3b30['autoAssociation']===0x1)_0x2ae805(null);return db[_0x3d6d('0x56')][_0x3d6d('0x42')]({'where':{'sectionId':_0x2d3b30['id']},'raw':!![]})['then'](function(_0x3e41f3){var _0x48da3e=_['map'](_0x3e41f3,function(_0x3df550){return qs[_0x3d6d('0x4e')](_0x3df550,['id',_0x3d6d('0x4f'),_0x3d6d('0x50'),_0x3d6d('0x57')]);});_0x2ae805(_0x48da3e);})[_0x3d6d('0x44')](function(_0x29d083){_0x133a34(_0x29d083);});})[_0x3d6d('0x24')](function(_0x3d44c1){var _0x1ae767=qs['omit'](_0x2d3b30,['id',_0x3d6d('0x4f'),_0x3d6d('0x50')]);_0x1ae767['userProfileId']=_0x5b307f['id'];if(_0x3d44c1)_0x1ae767[_0x3d6d('0x58')]=_0x3d44c1;return _0x1ae767;})[_0x3d6d('0x24')](function(_0x2eb3d8){return db['UserProfileSection']['create'](_0x2eb3d8,{'include':[{'model':db[_0x3d6d('0x56')],'as':_0x3d6d('0x58')}],'raw':!![],'transaction':_0x4f59a0});});})[_0x3d6d('0x24')](function(){return _0x5b307f;});}});});});}})[_0x3d6d('0x24')](respondWithResult(_0x1783d6,0xc9))[_0x3d6d('0x44')](handleError(_0x1783d6,null));};exports[_0x3d6d('0x23')]=function(_0x5373d6,_0x4b7741){if(_0x5373d6[_0x3d6d('0x4a')]['id']){delete _0x5373d6[_0x3d6d('0x4a')]['id'];}return db[_0x3d6d('0x2b')]['find']({'where':{'id':_0x5373d6[_0x3d6d('0x4b')]['id']}})[_0x3d6d('0x24')](handleEntityNotFound(_0x4b7741,null))[_0x3d6d('0x24')](saveUpdates(_0x5373d6[_0x3d6d('0x4a')],null))[_0x3d6d('0x24')](respondWithResult(_0x4b7741,null))['catch'](handleError(_0x4b7741,null));};exports[_0x3d6d('0x25')]=function(_0x20c3a2,_0x5cb0d6){return db[_0x3d6d('0x2b')][_0x3d6d('0x48')]({'where':{'id':_0x20c3a2[_0x3d6d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5cb0d6,null))['then'](removeEntity(_0x5cb0d6,null))[_0x3d6d('0x44')](handleError(_0x5cb0d6,null));};exports[_0x3d6d('0x59')]=function(_0x3cbf7d,_0x341279){return db[_0x3d6d('0x2b')][_0x3d6d('0x59')]()[_0x3d6d('0x24')](respondWithResult(_0x341279,null))[_0x3d6d('0x44')](handleError(_0x341279,null));};exports[_0x3d6d('0x5a')]=function(_0x477041,_0x618202){var _0x2489b0=_0x477041[_0x3d6d('0x4a')];return db[_0x3d6d('0x2b')][_0x3d6d('0x48')]({'where':{'id':_0x477041[_0x3d6d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x618202,null))[_0x3d6d('0x24')](function(_0x23ba39){if(_0x23ba39){return db[_0x3d6d('0x52')]['transaction'](function(_0x3883da){return db[_0x3d6d('0x54')][_0x3d6d('0x25')]({'where':{'userProfileId':_0x477041['params']['id'],'sectionId':_['map'](_0x2489b0,function(_0xde5308){return _0xde5308[_0x3d6d('0x57')];})},'transaction':_0x3883da})[_0x3d6d('0x24')](function(){var _0x3999f8=_[_0x3d6d('0x2a')](_0x2489b0,function(_0x561d17){_0x561d17[_0x3d6d('0x5b')]=_0x477041[_0x3d6d('0x4b')]['id'];return _0x561d17;});var _0x2679df=[];return BPromise[_0x3d6d('0x5c')](_0x3999f8,function(_0x2d0913){return db['UserProfileSection']['create'](_0x2d0913,{'include':[{'model':db[_0x3d6d('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x3883da})[_0x3d6d('0x24')](function(_0x40743f){_0x2679df[_0x3d6d('0x5d')](_0x40743f[_0x3d6d('0x4d')]({'plain':!![]}));});})['then'](function(){return _0x2679df;});});});}})[_0x3d6d('0x24')](function(_0x23a285){return _0x23a285;})['then'](respondWithResult(_0x618202,null))[_0x3d6d('0x44')](handleError(_0x618202,null));};exports[_0x3d6d('0x5e')]=function(_0x46e06c,_0x4341bf){var _0x1b9b85;return db[_0x3d6d('0x2b')]['find']({'where':{'id':_0x46e06c[_0x3d6d('0x4b')]['id']},'attributes':['id',_0x3d6d('0x28')]})['then'](handleEntityNotFound(_0x4341bf,null))[_0x3d6d('0x24')](function(_0xdbb113){if(_0xdbb113){_0x1b9b85=_0xdbb113;return db[_0x3d6d('0x54')]['destroy']({'where':{'userProfileId':_0x46e06c['params']['id'],'sectionId':_0x46e06c[_0x3d6d('0x33')][_0x3d6d('0x5f')]}});}})[_0x3d6d('0x24')](function(){return _0x1b9b85;})[_0x3d6d('0x24')](respondWithStatusCode(_0x4341bf,null))[_0x3d6d('0x44')](handleError(_0x4341bf,null));};exports['getSections']=function(_0xb3752,_0x26ce83){var _0x439a01=[];var _0x4de10d=[];return db[_0x3d6d('0x54')][_0x3d6d('0x42')]({'where':{'userProfileId':_0xb3752[_0x3d6d('0x4b')]['id']},'raw':!![]})[_0x3d6d('0x24')](function(_0x26a6c4){_0x439a01=_[_0x3d6d('0x3e')](_0x26a6c4,function(_0x3e9d3d){return _0x3e9d3d[_0x3d6d('0x60')]===0x1||_['includes']([0x3eb,0x709],_0x3e9d3d[_0x3d6d('0x57')]);});if(!_[_0x3d6d('0x61')](_0x439a01)){return _[_0x3d6d('0x2a')](_0x439a01,function(_0x7fbc68){return _0x7fbc68[_0x3d6d('0x57')];});}else{return;}})[_0x3d6d('0x24')](function(_0x16e39a){if(_0x16e39a)_0x4de10d=_0x16e39a;if(_[_0x3d6d('0x62')](_0x4de10d,0x64)){var _0x5079f7=_['find'](_0x439a01,{'sectionId':0x64});return hasDefaultDashboard(_0x5079f7)[_0x3d6d('0x24')](function(_0x3e993a){return _['map'](_0x439a01,function(_0x201f03){if(_0x201f03[_0x3d6d('0x57')]===0x64){_0x201f03[_0x3d6d('0x63')]=_0x3e993a;}return _0x201f03;});});}else{return;}})[_0x3d6d('0x24')](function(_0x380e20){if(_0x380e20)_0x439a01=_0x380e20;if(_[_0x3d6d('0x62')](_0x4de10d,0x3eb)){var _0x29b0c4=_['find'](_0x439a01,{'sectionId':0x3eb});return getCustomDashboards(_0x29b0c4)[_0x3d6d('0x24')](function(_0x26cc18){return _[_0x3d6d('0x2a')](_0x439a01,function(_0x571029){if(_0x29b0c4['enabled']){if(_0x571029[_0x3d6d('0x57')]===0x3eb){_0x571029[_0x3d6d('0x63')]=_0x26cc18;}}else{if(_0x571029[_0x3d6d('0x57')]===0x64){_0x571029['subsections']=_0x26cc18;}}return _0x571029;});});}else{return;}})[_0x3d6d('0x24')](function(_0x505761){if(_0x505761)_0x439a01=_0x505761;if(_['includes'](_0x4de10d,0x709)){var _0x15b136=_[_0x3d6d('0x48')](_0x439a01,{'sectionId':0x709});return getPlugins(_0x15b136)[_0x3d6d('0x24')](function(_0x405ccd){if(_0x15b136[_0x3d6d('0x60')]){return _[_0x3d6d('0x2a')](_0x439a01,function(_0x3fdd13){if(_0x3fdd13['sectionId']===0x709){_0x3fdd13[_0x3d6d('0x63')]=_0x405ccd;}return _0x3fdd13;});}else{var _0x3f6b26={'sectionId':0x76c,'enabled':0x1,'subsections':_0x405ccd};var _0x57af34=_[_0x3d6d('0x2a')](_0x439a01);_0x57af34[_0x3d6d('0x5d')](_0x3f6b26);return _0x57af34;}});}else{return;}})[_0x3d6d('0x24')](function(_0x58e37b){if(_0x58e37b)_0x439a01=_0x58e37b;return _['filter'](_0x439a01,[_0x3d6d('0x60'),0x1]);})[_0x3d6d('0x24')](respondWithResult(_0x26ce83,null))['catch'](handleError(_0x26ce83,null));};function hasDefaultDashboard(_0xa36234){var _0x166c97=[0x65];return new BPromise(function(_0x5c0eb8,_0x5d32d4){try{if(_0xa36234[_0x3d6d('0x55')]){_0x5c0eb8(_0x166c97);}else{return db[_0x3d6d('0x56')][_0x3d6d('0x64')]({'where':{'sectionId':_0xa36234['id']},'raw':!![]})[_0x3d6d('0x24')](function(_0x2d8e41){_0x2d8e41?_0x5c0eb8(_0x166c97):_0x5c0eb8();});}}catch(_0x38c46e){_0x5d32d4(_0x38c46e);}});}function getCustomDashboards(_0x4ec49f){var _0x261db2=[];return new BPromise(function(_0x25a96c,_0x4cd5cf){try{if(_0x4ec49f['autoAssociation']){return db[_0x3d6d('0x65')][_0x3d6d('0x42')]({'raw':!![]})[_0x3d6d('0x24')](function(_0x21ecc4){_0x21ecc4['forEach'](function(_0x22efb1){_0x261db2[_0x3d6d('0x5d')](_0x22efb1['id']+0x1869f);});_0x25a96c(_0x261db2);});}else{return db['UserProfileResource'][_0x3d6d('0x42')]({'where':{'sectionId':_0x4ec49f['id']},'raw':!![]})[_0x3d6d('0x24')](function(_0x5107fe){_0x5107fe[_0x3d6d('0x66')](function(_0x2ee84d){_0x261db2['push'](_0x2ee84d[_0x3d6d('0x67')]+0x1869f);});_0x25a96c(_0x261db2);});}}catch(_0x1c2593){_0x4cd5cf(_0x1c2593);}});}function getPlugins(_0x56d354){var _0x4338cb=[];return new BPromise(function(_0x1881f1,_0x419431){try{if(_0x56d354['autoAssociation']){return db[_0x3d6d('0x68')][_0x3d6d('0x42')]({'raw':!![]})[_0x3d6d('0x24')](function(_0x313e9c){_0x313e9c[_0x3d6d('0x66')](function(_0x2b5263){_0x4338cb[_0x3d6d('0x5d')](_0x2b5263['id']+0x15b38);});_0x1881f1(_0x4338cb);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x56d354['id']},'raw':!![]})[_0x3d6d('0x24')](function(_0x4e3254){_0x4e3254[_0x3d6d('0x66')](function(_0x3ca4ff){_0x4338cb[_0x3d6d('0x5d')](_0x3ca4ff[_0x3d6d('0x67')]+0x15b38);});_0x1881f1(_0x4338cb);});}}catch(_0x4d245a){_0x419431(_0x4d245a);}});}exports[_0x3d6d('0x69')]=function(_0x89d08a,_0x36db06){return db[_0x3d6d('0x2b')][_0x3d6d('0x48')]({'where':{'id':_0x89d08a[_0x3d6d('0x4b')]['id']}})[_0x3d6d('0x24')](handleEntityNotFound(_0x36db06,null))[_0x3d6d('0x24')](function(_0xfc3e86){if(_0xfc3e86){return db[_0x3d6d('0x52')][_0x3d6d('0x53')](function(_0x3b9d85){return db[_0x3d6d('0x54')][_0x3d6d('0x42')]({'where':{'userProfileId':_0x89d08a['params']['id']},'attributes':['id'],'raw':!![]})[_0x3d6d('0x24')](function(_0x299af7){if(_0x299af7){return db[_0x3d6d('0x54')][_0x3d6d('0x25')]({'where':{'userProfileId':_0x89d08a['params']['id'],'id':_[_0x3d6d('0x2a')](_0x299af7,function(_0xfc3d61){return _0xfc3d61['id'];})},'transaction':_0x3b9d85});}})[_0x3d6d('0x24')](function(_0x39afe2){var _0x788854=_[_0x3d6d('0x2a')](_0x89d08a['body'],function(_0x4b5b72){_0x4b5b72[_0x3d6d('0x5b')]=_0x89d08a[_0x3d6d('0x4b')]['id'];return _0x4b5b72;});return db[_0x3d6d('0x54')]['bulkCreate'](_0x788854,{'raw':!![],'transaction':_0x3b9d85});})['then'](function(_0x51e013){var _0x4e3e8e=_[_0x3d6d('0x3e')](_['map'](_0x51e013,function(_0x9dfb27){return _0x9dfb27[_0x3d6d('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x4e3e8e){return db[_0x3d6d('0x54')][_0x3d6d('0x42')]({'where':{'userProfileId':_0x89d08a[_0x3d6d('0x4b')]['id'],'sectionId':_['map'](_0x4e3e8e,function(_0x1d632a){return _0x1d632a[_0x3d6d('0x57')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x3d6d('0x24')](function(_0xd2daa8){var _0x1851a0=_[_0x3d6d('0x2a')](_0x89d08a[_0x3d6d('0x4a')],function(_0x3d4299){_0x3d4299[_0x3d6d('0x5b')]=_0x89d08a[_0x3d6d('0x4b')]['id'];return _0x3d4299;});return db[_0x3d6d('0x56')][_0x3d6d('0x6a')](_0x1851a0,{'raw':!![],'transaction':_0x3b9d85});});}})[_0x3d6d('0x44')](handleError(_0x36db06,null));});}})[_0x3d6d('0x24')](function(_0x566af4){var _0x30133f=_[_0x3d6d('0x2a')](_0x566af4,function(_0x310e7f){return _0x310e7f[_0x3d6d('0x4d')]({'plain':!![]});});})[_0x3d6d('0x24')](respondWithResult(_0x36db06,null))[_0x3d6d('0x44')](handleError(_0x36db06,null));};exports['removeResources']=function(_0x46d33a,_0x265c2e,_0x4ee7d7){return db['UserProfile'][_0x3d6d('0x48')]({'where':{'id':_0x46d33a[_0x3d6d('0x4b')]['id']}})[_0x3d6d('0x24')](handleEntityNotFound(_0x265c2e,null))[_0x3d6d('0x24')](function(_0x3368e6){if(_0x3368e6){return _0x3368e6['removeResources'](_0x46d33a['query'][_0x3d6d('0x5f')]);}})['then'](respondWithStatusCode(_0x265c2e,null))[_0x3d6d('0x44')](handleError(_0x265c2e,null));};exports[_0x3d6d('0x6b')]=function(_0x50d746,_0x3f668d){var _0x479333={'raw':![],'where':{}};var _0xdbb008={};var _0x35fb8e={'count':0x0,'rows':[]};var _0x1b92fb=_0x50d746['query']['section'];if(typeof _0x1b92fb===_0x3d6d('0x6c')){throw new db[(_0x3d6d('0x6d'))][(_0x3d6d('0x6e'))](_0x3d6d('0x6f'));}var _0xd336b4=_0x50d746[_0x3d6d('0x33')]['mergeResources']||![];var _0x50cdce=getQueryModels(_0x1b92fb,_0xd336b4);if(typeof _0x50cdce['childModel']===_0x3d6d('0x6c')){throw new db[(_0x3d6d('0x6d'))]['ValidationError'](_0x3d6d('0x70')+_0x1b92fb+'\x27');}var _0x1184a0=[];if(!_['isEmpty'](_0x50cdce['parentSections'])){_0x1184a0=_0x50cdce['parentSections'];}else{_0x1184a0=[{'name':_0x1b92fb}];}return db[_0x3d6d('0x2b')]['findOne']({'where':{'id':_0x50d746[_0x3d6d('0x4b')]['id']}})[_0x3d6d('0x24')](handleEntityNotFound(_0x3f668d,null))['then'](function(_0x295865){if(_0x295865){var _0x1f417d=[];for(var _0x205f65=0x0;_0x205f65<_0x1184a0['length'];_0x205f65++){_0x1f417d[_0x3d6d('0x5d')](db[_0x3d6d('0x54')]['findOne']({'where':{'userProfileId':_0x295865['id'],'name':_0x1184a0[_0x205f65]['name']},'raw':!![]}));}return BPromise[_0x3d6d('0x71')](_0x1f417d);}})[_0x3d6d('0x24')](function(_0x2e5727){var _0x148a2e=_[_0x3d6d('0x3e')](_0x2e5727,function(_0x5dc310){return _0x5dc310?_0x5dc310:undefined;});var _0x379d4c=_[_0x3d6d('0x3e')](_0x1184a0,[_0x3d6d('0x72'),!![]]);var _0x4d96c3=_[_0x3d6d('0x61')](_0x148a2e)&&_['isEmpty'](_0x379d4c)?null:_['union'](_0x379d4c,_0x148a2e);if(_0x4d96c3){var _0x411f01=[];for(var _0x324e5d=0x0;_0x324e5d<_0x4d96c3[_0x3d6d('0x36')];_0x324e5d++){var _0x1e718f=_[_0x3d6d('0x48')](_0x1184a0,function(_0x5e88a4){return _0x4d96c3[_0x324e5d]?_0x5e88a4[_0x3d6d('0x28')]===_0x4d96c3[_0x324e5d][_0x3d6d('0x28')]:null;});if(_0x1e718f){if(_0x4d96c3[_0x324e5d][_0x3d6d('0x72')]){_0x411f01[_0x3d6d('0x5d')](getAllResources(_0x50cdce[_0x3d6d('0x73')],_0x4d96c3[_0x324e5d]));}else{if(!_0x4d96c3[_0x324e5d][_0x3d6d('0x55')]){_0x411f01[_0x3d6d('0x5d')](getAllowedResources(_0x1e718f,_0x4d96c3[_0x324e5d],_0x50cdce['childModel']));}else{if(_0x1e718f[_0x3d6d('0x30')]){_0x411f01[_0x3d6d('0x5d')](getAllFilteredResources(_0x1e718f,_0x4d96c3[_0x324e5d]));}}}}}return BPromise[_0x3d6d('0x71')](_0x411f01);}else{return null;}})['then'](function(_0x1a43de){var _0x25938e=_0x1a43de;var _0x34a4e0=null;if(_0x25938e){_0x34a4e0=_0x25938e['length']===0x1?_0x25938e[0x0]:null;}if(_0x34a4e0||_0x25938e){var _0x46ac08=db[_0x50cdce[_0x3d6d('0x73')]]['rawAttributes'];_0xdbb008[_0x3d6d('0x30')]=_[_0x3d6d('0x31')](_0x46ac08);_0xdbb008[_0x3d6d('0x33')]=_[_0x3d6d('0x31')](_0x50d746['query']);_0xdbb008[_0x3d6d('0x3c')]=_[_0x3d6d('0x32')](_0xdbb008[_0x3d6d('0x30')],_0xdbb008[_0x3d6d('0x33')]);_0x479333[_0x3d6d('0x34')]=_[_0x3d6d('0x32')](_0xdbb008[_0x3d6d('0x30')],qs['fields'](_0x50d746['query'][_0x3d6d('0x35')]));_0x479333[_0x3d6d('0x34')]=_0x479333[_0x3d6d('0x34')][_0x3d6d('0x36')]?_0x479333[_0x3d6d('0x34')]:_0xdbb008[_0x3d6d('0x30')];if(!_0x50d746[_0x3d6d('0x33')]['hasOwnProperty']('nolimit')){_0x479333[_0x3d6d('0x1d')]=qs[_0x3d6d('0x1d')](_0x50d746[_0x3d6d('0x33')]['limit']);_0x479333[_0x3d6d('0x38')]=qs[_0x3d6d('0x38')](_0x50d746[_0x3d6d('0x33')][_0x3d6d('0x38')]);}_0x479333[_0x3d6d('0x39')]=qs['sort'](_0x50d746[_0x3d6d('0x33')]['sort']);_0x479333[_0x3d6d('0x3b')]=qs[_0x3d6d('0x3c')](_[_0x3d6d('0x3d')](_0x50d746[_0x3d6d('0x33')],_0xdbb008[_0x3d6d('0x3c')]));if(_0x50d746[_0x3d6d('0x33')][_0x3d6d('0x3e')]){_0x479333[_0x3d6d('0x3b')]=_[_0x3d6d('0x3f')](_0x479333[_0x3d6d('0x3b')],{'$or':_[_0x3d6d('0x2a')](_0x46ac08,function(_0x15b4c2){if(_0x15b4c2[_0x3d6d('0x2e')][_0x3d6d('0x2f')]!==_0x3d6d('0x40')){var _0x81098f={};_0x81098f[_0x15b4c2[_0x3d6d('0x74')]]={'$like':'%'+_0x50d746['query']['filter']+'%'};return _0x81098f;}})});}var _0x33bfdd=[];if(_0x34a4e0){var _0x415e1f=_[_0x3d6d('0x48')](_0x1184a0,[_0x3d6d('0x28'),_0x34a4e0[_0x3d6d('0x28')]]);if(_0x415e1f['field']){var _0x43a37a={};if(_0x50cdce[_0x3d6d('0x73')]===_0x3d6d('0x75')){_0x43a37a[_0x415e1f[_0x3d6d('0x76')]]=_[_0x3d6d('0x2a')](_0x34a4e0[_0x3d6d('0x77')],'id');}else{_0x43a37a[_0x415e1f[_0x3d6d('0x76')]]=_0x34a4e0[_0x3d6d('0x77')];}_0x33bfdd[_0x3d6d('0x5d')](_0x43a37a);}else{_0x479333[_0x3d6d('0x3b')]['id']=_0x34a4e0[_0x3d6d('0x77')];}}else{for(var _0x5760b1=0x0;_0x5760b1<_0x25938e[_0x3d6d('0x36')];_0x5760b1++){var _0x415e1f=_[_0x3d6d('0x48')](_0x1184a0,['name',_0x25938e[_0x5760b1][_0x3d6d('0x28')]]);if(_0x415e1f[_0x3d6d('0x74')]){var _0x43a37a={};_0x43a37a[_0x415e1f[_0x3d6d('0x76')]]=_0x25938e[_0x5760b1][_0x3d6d('0x77')];_0x33bfdd[_0x3d6d('0x5d')](_0x43a37a);}else{if(!_0x479333[_0x3d6d('0x3b')]['id'])_0x479333[_0x3d6d('0x3b')]['id']=[];_0x25938e[_0x5760b1][_0x3d6d('0x77')][_0x3d6d('0x66')](function(_0x1befad){_0x479333[_0x3d6d('0x3b')]['id'][_0x3d6d('0x5d')](_0x1befad);});}}}if(!_[_0x3d6d('0x61')](_0x33bfdd)){_0x479333[_0x3d6d('0x3b')]=_[_0x3d6d('0x3f')](_0x479333[_0x3d6d('0x3b')],{'$and':{'$or':_0x33bfdd}});}_0x479333=_[_0x3d6d('0x3f')]({},_0x479333,_0x50d746['options']);if(_0x34a4e0&&!_0x34a4e0[_0x3d6d('0x55')]&&_0x50cdce[_0x3d6d('0x73')]===_0x3d6d('0x75')){if(_0x50d746[_0x3d6d('0x33')]['includeAll']){_0x479333[_0x3d6d('0x4c')]=[{'all':!![]}];}return db[_0x50cdce[_0x3d6d('0x73')]][_0x3d6d('0x42')](_0x479333)['then'](function(_0x382677){var _0x22218a=[];_0x382677[_0x3d6d('0x66')](function(_0x5701be){var _0x41353f;switch(_0x5701be[_0x3d6d('0x78')]){case _0x3d6d('0x79'):_0x41353f=_[_0x3d6d('0x48')](_0x34a4e0['associatedResources'],function(_0x1efffc){return _0x1efffc['id']===_0x5701be[_0x3d6d('0x7a')]&&_0x1efffc[_0x3d6d('0x2e')]==='DefaultReports';});break;case'custom':_0x41353f=_[_0x3d6d('0x48')](_0x34a4e0[_0x3d6d('0x77')],function(_0x270c59){return _0x270c59['id']===_0x5701be['reportId']&&_0x270c59[_0x3d6d('0x2e')]===_0x3d6d('0x7b');});break;}if(_0x41353f)_0x22218a[_0x3d6d('0x5d')](_0x5701be);});_0x35fb8e[_0x3d6d('0x41')]=_0x22218a[_0x3d6d('0x36')];_0x35fb8e[_0x3d6d('0x43')]=_0x22218a;return _0x35fb8e;});}else{return db[_0x50cdce[_0x3d6d('0x73')]][_0x3d6d('0x41')]({'where':_0x479333['where']})[_0x3d6d('0x24')](function(_0x472a84){_0x35fb8e[_0x3d6d('0x41')]=_0x472a84;if(_0x50d746[_0x3d6d('0x33')][_0x3d6d('0x46')]){if(_0x50cdce[_0x3d6d('0x73')]===_0x3d6d('0x7c')){_0x479333[_0x3d6d('0x4c')]=[{'model':db[_0x3d6d('0x7d')],'as':_0x3d6d('0x7e'),'attributes':['id',_0x3d6d('0x28'),_0x3d6d('0x7f')],'required':_0x50d746[_0x3d6d('0x33')][_0x3d6d('0x80')]?!![]:![]},{'model':db[_0x3d6d('0x7d')],'as':_0x3d6d('0x81'),'attributes':['id',_0x3d6d('0x28'),_0x3d6d('0x7f')],'through':_0x50d746[_0x3d6d('0x33')][_0x3d6d('0x80')]?{'attributes':[],'where':{'TagId':_0x50d746[_0x3d6d('0x33')][_0x3d6d('0x80')]||undefined}}:{},'required':_0x50d746[_0x3d6d('0x33')][_0x3d6d('0x80')]?!![]:![]}];}else{_0x479333[_0x3d6d('0x4c')]=[{'all':!![]}];}}return db[_0x50cdce[_0x3d6d('0x73')]][_0x3d6d('0x42')](_0x479333);})[_0x3d6d('0x24')](function(_0x535d5d){_0x35fb8e[_0x3d6d('0x43')]=_0x535d5d;return _0x35fb8e;});}}else{return _0x35fb8e;}})[_0x3d6d('0x24')](respondWithFilteredResult(_0x3f668d,_0x479333))[_0x3d6d('0x44')](handleError(_0x3f668d,null));};function getAllResources(_0xae3acd,_0x59d9ff){return new BPromise(function(_0x1bd256,_0x38b245){if(_0x59d9ff){var _0x3c4242=_0x59d9ff['filter']?{[_0x59d9ff[_0x3d6d('0x3e')][_0x3d6d('0x74')]]:_0x59d9ff['filter']['value']}:undefined;return db[_0xae3acd][_0x3d6d('0x42')]({'where':_0x3c4242,'raw':!![]})[_0x3d6d('0x24')](function(_0x4c73b3){_0x59d9ff[_0x3d6d('0x77')]=_[_0x3d6d('0x2a')](_0x4c73b3,'id');_0x1bd256(_0x59d9ff);})['catch'](function(_0x2d9c23){_0x38b245(_0x2d9c23);});}else{_0x1bd256(null);}});}function getAllFilteredResources(_0x82e7d1,_0x43f1f7){return new BPromise(function(_0x154e55,_0x4e0876){var _0x4f4ac0=_0x82e7d1['filter']?{[_0x82e7d1[_0x3d6d('0x3e')]['field']]:_0x82e7d1[_0x3d6d('0x3e')][_0x3d6d('0x82')]}:undefined;return db[_0x82e7d1[_0x3d6d('0x30')]]['findAll']({'where':_0x4f4ac0,'raw':!![]})[_0x3d6d('0x24')](function(_0x62f183){_0x43f1f7[_0x3d6d('0x77')]=_['map'](_0x62f183,function(_0x5686ca){return _0x5686ca[_0x3d6d('0x28')];});_0x154e55(_0x43f1f7);})[_0x3d6d('0x44')](function(_0x49bce9){_0x4e0876(_0x49bce9);});});}function getAllowedResources(_0x2883c6,_0x9cbfd4,_0x2cd904){return new BPromise(function(_0xe30e9a,_0x593dfc){if(_0x9cbfd4){return db['UserProfileResource'][_0x3d6d('0x42')]({'where':{'sectionId':_0x9cbfd4['id']},'raw':!![]})['then'](function(_0x1edcc4){if(_0x2883c6[_0x3d6d('0x74')]&&_0x2883c6['field']!=='id'){_0x9cbfd4[_0x3d6d('0x77')]=_[_0x3d6d('0x2a')](_0x1edcc4,function(_0x4a241b){return _0x4a241b[_0x2883c6[_0x3d6d('0x74')]];});}else{if(_0x2cd904==='AnalyticExtractedReport'){_0x9cbfd4[_0x3d6d('0x77')]=_['map'](_0x1edcc4,function(_0x571687){return{'id':_0x571687[_0x3d6d('0x67')],'type':_0x571687['type']};});}else{_0x9cbfd4['associatedResources']=_['map'](_0x1edcc4,function(_0x537536){return _0x537536[_0x3d6d('0x67')];});}}_0xe30e9a(_0x9cbfd4);})[_0x3d6d('0x44')](function(_0x9f7540){_0x593dfc(_0x9f7540);});}else{_0xe30e9a(null);}});}function getQueryModels(_0x27493f,_0x20c274){var _0x326d31=_0x27493f['toLowerCase']();var _0x137e13={'childModel':undefined,'parentSections':[]};switch(_0x326d31){case _0x3d6d('0x83'):_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0x84');break;case _0x3d6d('0x85'):_0x137e13[_0x3d6d('0x73')]='SquareOdbc';break;case _0x3d6d('0x86'):_0x137e13['childModel']=_0x3d6d('0x87');_0x137e13[_0x3d6d('0x88')]=[{'name':_0x3d6d('0x89'),'field':'name','foreignKey':_0x3d6d('0x8a')}];break;case _0x3d6d('0x8b'):_0x137e13['childModel']='JscriptyProject';break;case'contacts':_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0x7c');_0x137e13['parentSections']=[{'name':_0x3d6d('0x8c'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x137e13[_0x3d6d('0x73')]='CmList';break;case _0x3d6d('0x8d'):_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0x8e');break;case'globalcustomfields':_0x137e13['childModel']=_0x3d6d('0x8f');break;case'chatqueues':_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0x90');break;case _0x3d6d('0x91'):_0x137e13['childModel']=_0x3d6d('0x92');break;case _0x3d6d('0x93'):_0x137e13['childModel']='FaxQueue';break;case'faxaccounts':_0x137e13[_0x3d6d('0x73')]='FaxAccount';break;case _0x3d6d('0x94'):case _0x3d6d('0x95'):case _0x3d6d('0x96'):_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0x97');break;case _0x3d6d('0x98'):_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0x99');break;case _0x3d6d('0x9a'):_0x137e13[_0x3d6d('0x73')]='VoiceMail';break;case'voicerecordings':_0x137e13['childModel']='VoiceRecording';_0x137e13[_0x3d6d('0x88')]=[{'name':'Agents','field':_0x3d6d('0x28'),'foreignKey':'membername','model':'User','filter':{'field':'role','value':[_0x3d6d('0x9b')]}},{'name':_0x3d6d('0x9c'),'field':_0x3d6d('0x28'),'foreignKey':_0x3d6d('0x9d'),'model':_0x3d6d('0x9e'),'filter':{'field':'role','value':[_0x3d6d('0x9f')]}},{'name':_0x3d6d('0xa0'),'field':_0x3d6d('0x28'),'foreignKey':_0x3d6d('0xa1'),'model':'VoiceQueue','filter':{'field':_0x3d6d('0x2e'),'value':[_0x3d6d('0xa2')]}},{'name':'QueueCampaigns','field':_0x3d6d('0x28'),'foreignKey':_0x3d6d('0xa1'),'model':_0x3d6d('0xa3'),'filter':{'field':'type','value':[_0x3d6d('0xa4')]}}];break;case _0x3d6d('0xa5'):_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0xa6');break;case _0x3d6d('0xa7'):_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0xa8');break;case _0x3d6d('0xa9'):_0x137e13[_0x3d6d('0x73')]='VoicePrefix';break;case'ivrcampaigns':_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0xaa');break;case _0x3d6d('0xab'):_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0xac');break;case _0x3d6d('0xad'):_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0xae');break;case'mailsubstatuses':_0x137e13[_0x3d6d('0x73')]='MailSubstatus';break;case _0x3d6d('0xaf'):_0x137e13[_0x3d6d('0x73')]='OpenchannelQueue';break;case _0x3d6d('0xb0'):_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0xb1');break;case _0x3d6d('0xb2'):_0x137e13['childModel']=_0x3d6d('0xb3');break;case'smsaccounts':_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0xb4');break;case _0x3d6d('0xb5'):_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0xb6');break;case'whatsappaccounts':_0x137e13['childModel']=_0x3d6d('0xb7');break;case _0x3d6d('0xb8'):_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0xb9');break;case _0x3d6d('0xba'):case _0x3d6d('0xbb'):_0x137e13[_0x3d6d('0x73')]='VoiceQueue';if(_0x20c274){_0x137e13[_0x3d6d('0x88')]=[{'name':_0x3d6d('0xa0')},{'name':_0x3d6d('0xbc')}];}break;case _0x3d6d('0xbd'):case'agents':case _0x3d6d('0xbe'):_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0x9e');if(_0x20c274){_0x137e13[_0x3d6d('0x88')]=[{'name':_0x3d6d('0xbf'),'filter':{'field':_0x3d6d('0xc0'),'value':[_0x3d6d('0xc1'),_0x3d6d('0xc2')]},'ignore':!![]},{'name':_0x3d6d('0xc3')},{'name':_0x3d6d('0x9c')}];}break;case'zendeskaccounts':_0x137e13[_0x3d6d('0x73')]='ZendeskAccount';break;case _0x3d6d('0xc4'):_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0xc5');break;case _0x3d6d('0xc6'):_0x137e13[_0x3d6d('0x73')]='FreshdeskAccount';break;case _0x3d6d('0xc7'):_0x137e13[_0x3d6d('0x73')]='SugarcrmAccount';break;case _0x3d6d('0xc8'):_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0xc9');break;case _0x3d6d('0xca'):_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0xcb');break;case _0x3d6d('0xcc'):_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0x9e');break;case _0x3d6d('0xcd'):_0x137e13['childModel']=_0x3d6d('0xce');break;case _0x3d6d('0xcf'):_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0xd0');break;case'customdashboards':_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0x65');break;case _0x3d6d('0xd1'):_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0xd2');break;case _0x3d6d('0xd3'):_0x137e13[_0x3d6d('0x73')]='Pause';break;case _0x3d6d('0xd4'):_0x137e13['childModel']=_0x3d6d('0xd5');break;case _0x3d6d('0xd6'):_0x137e13['childModel']='Sound';break;case _0x3d6d('0xd7'):_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0x7d');break;case _0x3d6d('0xd8'):_0x137e13['childModel']=_0x3d6d('0xd9');break;case'triggers':_0x137e13['childModel']=_0x3d6d('0xda');break;case _0x3d6d('0xdb'):_0x137e13[_0x3d6d('0x73')]='Trunk';break;case _0x3d6d('0xdc'):_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0xdd');break;case _0x3d6d('0xde'):_0x137e13[_0x3d6d('0x73')]=_0x3d6d('0x68');break;case _0x3d6d('0xdf'):_0x137e13[_0x3d6d('0x73')]='AnalyticExtractedReport';_0x137e13[_0x3d6d('0x88')]=[{'name':_0x3d6d('0xe0'),'field':'id','foreignKey':'reportId'}];break;case _0x3d6d('0xe1'):_0x137e13['childModel']=_0x3d6d('0xe2');break;case _0x3d6d('0xe3'):_0x137e13['childModel']='WhatsappAccount';break;default:return _0x137e13;}return _0x137e13;} \ No newline at end of file +var _0x2cc5=['deskaccounts','DeskAccount','zohoaccounts','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','sounds','Sound','tags','templates','Template','triggers','Trunk','variables','Variable','extractedreports','Reports','AnalyticMetric','WhatsappAccount','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userProfile.socket','register','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','then','error','stack','name','send','UserProfile','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','filtears','options','find','catch','create','body','clone','get','omit','createdAt','crudPermissions','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','sectionId','updatedAt','userProfileId','Resources','update','destroy','describe','addSections','each','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','push','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','undefined','Sequelize','Unknown\x20section','mergeResources','Invalid\x20section\x20\x27','parentSections','findOne','all','ignore','union','childModel','order','pick','key','field','associatedResources','foreignKey','reportType','default','DefaultReports','custom','CmContact','Tag','color','tag','value','AnalyticExtractedReport','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','JscriptyProject','contacts','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','Agents','membername','User','role','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','VoiceChanSpy','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','users','telephones','Users','admin','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts'];(function(_0x1106a0,_0x38752b){var _0x382199=function(_0x3533f3){while(--_0x3533f3){_0x1106a0['push'](_0x1106a0['shift']());}};_0x382199(++_0x38752b);}(_0x2cc5,0x106));var _0x52cc=function(_0x5e0c81,_0x8c811b){_0x5e0c81=_0x5e0c81-0x0;var _0x12efad=_0x2cc5[_0x5e0c81];return _0x12efad;};'use strict';var pdf=require(_0x52cc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x52cc('0x1'));var zipdir=require(_0x52cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x52cc('0x3'));var moment=require(_0x52cc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x52cc('0x5'));var util=require(_0x52cc('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x52cc('0x7'));var ejs=require(_0x52cc('0x8'));var fs=require('fs');var _=require(_0x52cc('0x9'));var squel=require(_0x52cc('0xa'));var crypto=require(_0x52cc('0xb'));var jsforce=require(_0x52cc('0xc'));var deskjs=require(_0x52cc('0xd'));var toCsv=require(_0x52cc('0x7'));var querystring=require('querystring');var Papa=require(_0x52cc('0xe'));var Redis=require('ioredis');var authService=require(_0x52cc('0xf'));var qs=require(_0x52cc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x52cc('0x11'));var utils=require(_0x52cc('0x12'));var config=require(_0x52cc('0x13'));var licenseUtil=require(_0x52cc('0x14'));var db=require(_0x52cc('0x15'))['db'];config[_0x52cc('0x16')]=_[_0x52cc('0x17')](config[_0x52cc('0x16')],{'host':_0x52cc('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x52cc('0x19'))[_0x52cc('0x1a')](socket);function respondWithStatusCode(_0x35b51c,_0x44b483){_0x44b483=_0x44b483||0xcc;return function(_0x120709){if(_0x120709){return _0x35b51c[_0x52cc('0x1b')](_0x44b483);}return _0x35b51c[_0x52cc('0x1c')](_0x44b483)[_0x52cc('0x1d')]();};}function respondWithResult(_0x3a49e7,_0x35260a){_0x35260a=_0x35260a||0xc8;return function(_0x29f39c){if(_0x29f39c){return _0x3a49e7['status'](_0x35260a)[_0x52cc('0x1e')](_0x29f39c);}};}function respondWithFilteredResult(_0x486d08,_0x27fce5){return function(_0x603001){if(_0x603001){var _0x2ce3d6=_0x603001['count'],_0x417246=_0x27fce5[_0x52cc('0x1f')],_0x17d404=_0x27fce5[_0x52cc('0x1f')]+_0x27fce5[_0x52cc('0x20')],_0x4d0d40;if(_0x17d404>=_0x2ce3d6){_0x17d404=_0x2ce3d6;_0x4d0d40=0xc8;}else{_0x4d0d40=0xce;}_0x486d08[_0x52cc('0x1c')](_0x4d0d40);return _0x486d08['set'](_0x52cc('0x21'),_0x417246+'-'+_0x17d404+'/'+_0x2ce3d6)[_0x52cc('0x1e')](_0x603001);}return null;};}function patchUpdates(_0x34b3a2){return function(_0x41b8d0){try{jsonpatch[_0x52cc('0x22')](_0x41b8d0,_0x34b3a2,!![]);}catch(_0x52c717){return BPromise[_0x52cc('0x23')](_0x52c717);}return _0x41b8d0['save']();};}function saveUpdates(_0x4b3a0d,_0x310204){return function(_0x33b360){if(_0x33b360){return _0x33b360['update'](_0x4b3a0d)[_0x52cc('0x24')](function(_0x1c6663){return _0x1c6663;});}return null;};}function removeEntity(_0x3fa1d6,_0x4c7055){return function(_0x2e2c66){if(_0x2e2c66){return _0x2e2c66['destroy']()['then'](function(){_0x3fa1d6['status'](0xcc)[_0x52cc('0x1d')]();});}};}function handleEntityNotFound(_0x3aed93,_0x2f2de8){return function(_0x17031c){if(!_0x17031c){_0x3aed93[_0x52cc('0x1b')](0x194);}return _0x17031c;};}function handleError(_0x976e95,_0xd8c3f5){_0xd8c3f5=_0xd8c3f5||0x1f4;return function(_0x521785){logger[_0x52cc('0x25')](_0x521785[_0x52cc('0x26')]);if(_0x521785[_0x52cc('0x27')]){delete _0x521785['name'];}_0x976e95[_0x52cc('0x1c')](_0xd8c3f5)[_0x52cc('0x28')](_0x521785);};}exports['index']=function(_0x576d4c,_0x11c2c5){var _0x393c85={},_0x2b9e94={},_0x36cf85={'count':0x0,'rows':[]};var _0x8afc42=_['map'](db[_0x52cc('0x29')][_0x52cc('0x2a')],function(_0x3d6aad){return{'name':_0x3d6aad[_0x52cc('0x2b')],'type':_0x3d6aad[_0x52cc('0x2c')]['key']};});_0x2b9e94[_0x52cc('0x2d')]=_[_0x52cc('0x2e')](_0x8afc42,_0x52cc('0x27'));_0x2b9e94[_0x52cc('0x2f')]=_[_0x52cc('0x30')](_0x576d4c[_0x52cc('0x2f')]);_0x2b9e94[_0x52cc('0x31')]=_['intersection'](_0x2b9e94[_0x52cc('0x2d')],_0x2b9e94['query']);_0x393c85['attributes']=_[_0x52cc('0x32')](_0x2b9e94[_0x52cc('0x2d')],qs[_0x52cc('0x33')](_0x576d4c[_0x52cc('0x2f')][_0x52cc('0x33')]));_0x393c85[_0x52cc('0x34')]=_0x393c85[_0x52cc('0x34')][_0x52cc('0x35')]?_0x393c85[_0x52cc('0x34')]:_0x2b9e94['model'];if(!_0x576d4c[_0x52cc('0x2f')][_0x52cc('0x36')](_0x52cc('0x37'))){_0x393c85[_0x52cc('0x20')]=qs[_0x52cc('0x20')](_0x576d4c[_0x52cc('0x2f')]['limit']);_0x393c85[_0x52cc('0x1f')]=qs[_0x52cc('0x1f')](_0x576d4c[_0x52cc('0x2f')][_0x52cc('0x1f')]);}_0x393c85['order']=qs[_0x52cc('0x38')](_0x576d4c[_0x52cc('0x2f')]['sort']);_0x393c85[_0x52cc('0x39')]=qs[_0x52cc('0x31')](_['pick'](_0x576d4c['query'],_0x2b9e94['filters']),_0x8afc42);if(_0x576d4c[_0x52cc('0x2f')][_0x52cc('0x3a')]){_0x393c85['where']=_['merge'](_0x393c85[_0x52cc('0x39')],{'$or':_[_0x52cc('0x2e')](_0x8afc42,function(_0x3b1485){if(_0x3b1485['type']!==_0x52cc('0x3b')){var _0x51e6b7={};_0x51e6b7[_0x3b1485[_0x52cc('0x27')]]={'$like':'%'+_0x576d4c[_0x52cc('0x2f')]['filter']+'%'};return _0x51e6b7;}})});}_0x393c85=_[_0x52cc('0x3c')]({},_0x393c85,_0x576d4c['options']);var _0x45b3ae={'where':_0x393c85['where']};return db['UserProfile'][_0x52cc('0x3d')](_0x45b3ae)[_0x52cc('0x24')](function(_0xd1fbe){_0x36cf85['count']=_0xd1fbe;if(_0x576d4c[_0x52cc('0x2f')][_0x52cc('0x3e')]){_0x393c85[_0x52cc('0x3f')]=[{'all':!![]}];}return db[_0x52cc('0x29')][_0x52cc('0x40')](_0x393c85);})[_0x52cc('0x24')](function(_0x46b2d7){_0x36cf85[_0x52cc('0x41')]=_0x46b2d7;return _0x36cf85;})['then'](respondWithFilteredResult(_0x11c2c5,_0x393c85))['catch'](handleError(_0x11c2c5,null));};exports[_0x52cc('0x42')]=function(_0x27129d,_0x16913d){var _0x25f433={'raw':![],'where':{'id':_0x27129d[_0x52cc('0x43')]['id']}},_0x2dc47d={};_0x2dc47d[_0x52cc('0x2d')]=_['keys'](db[_0x52cc('0x29')][_0x52cc('0x2a')]);_0x2dc47d['query']=_[_0x52cc('0x30')](_0x27129d[_0x52cc('0x2f')]);_0x2dc47d[_0x52cc('0x44')]=_[_0x52cc('0x32')](_0x2dc47d[_0x52cc('0x2d')],_0x2dc47d[_0x52cc('0x2f')]);_0x25f433[_0x52cc('0x34')]=_[_0x52cc('0x32')](_0x2dc47d[_0x52cc('0x2d')],qs['fields'](_0x27129d[_0x52cc('0x2f')][_0x52cc('0x33')]));_0x25f433[_0x52cc('0x34')]=_0x25f433[_0x52cc('0x34')][_0x52cc('0x35')]?_0x25f433['attributes']:_0x2dc47d['model'];if(_0x27129d[_0x52cc('0x2f')][_0x52cc('0x3e')]){_0x25f433[_0x52cc('0x3f')]=[{'all':!![]}];}_0x25f433=_['merge']({},_0x25f433,_0x27129d[_0x52cc('0x45')]);return db['UserProfile'][_0x52cc('0x46')](_0x25f433)[_0x52cc('0x24')](handleEntityNotFound(_0x16913d,null))[_0x52cc('0x24')](respondWithResult(_0x16913d,null))[_0x52cc('0x47')](handleError(_0x16913d,null));};exports['create']=function(_0xff8a66,_0x4637e8){return db[_0x52cc('0x29')][_0x52cc('0x48')](_0xff8a66[_0x52cc('0x49')],{})[_0x52cc('0x24')](respondWithResult(_0x4637e8,0xc9))[_0x52cc('0x47')](handleError(_0x4637e8,null));};exports[_0x52cc('0x4a')]=function(_0x234e40,_0x20915f){var _0x533917={'where':{'id':_0x234e40[_0x52cc('0x43')]['id']}},_0x16ada0={};_0x16ada0['model']=_[_0x52cc('0x30')](db['UserProfile'][_0x52cc('0x2a')]);_0x533917[_0x52cc('0x34')]=_[_0x52cc('0x32')](_0x16ada0[_0x52cc('0x2d')],qs[_0x52cc('0x33')](_0x234e40[_0x52cc('0x2f')][_0x52cc('0x33')]));_0x533917['attributes']=_0x533917[_0x52cc('0x34')][_0x52cc('0x35')]?_0x533917['attributes']:_0x16ada0[_0x52cc('0x2d')];if(_0x234e40[_0x52cc('0x2f')]['includeAll']){_0x533917[_0x52cc('0x3f')]=[{'all':!![]}];}_0x533917=_[_0x52cc('0x3c')]({},_0x533917,_0x234e40[_0x52cc('0x45')]);return db[_0x52cc('0x29')]['find'](_0x533917)[_0x52cc('0x24')](handleEntityNotFound(_0x20915f,null))[_0x52cc('0x24')](function(_0x14258d){if(_0x14258d){var _0x4e529a=_0x14258d[_0x52cc('0x4b')]({'plain':!![]});_0x4e529a=qs[_0x52cc('0x4c')](_0x4e529a,['id',_0x52cc('0x4d'),'updatedAt',_0x52cc('0x4e')]);_0x234e40[_0x52cc('0x49')]=_[_0x52cc('0x4c')](_0x234e40['body'],['id',_0x52cc('0x4d'),'updatedAt']);return db[_0x52cc('0x4f')][_0x52cc('0x50')](function(_0x2915e9){return db['UserProfile'][_0x52cc('0x48')](_[_0x52cc('0x3c')](_0x4e529a,_0x234e40['body']),{'include':_0x234e40[_0x52cc('0x2f')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x2915e9})['then'](function(_0x2fc79f){var _0x1bad8f=_0x2fc79f['get']({'plain':!![]});return db[_0x52cc('0x51')][_0x52cc('0x40')]({'where':{'userProfileId':_0x234e40['params']['id']},'raw':!![]})[_0x52cc('0x24')](function(_0x269bba){if(_0x269bba){return BPromise['each'](_0x269bba,function(_0x2677d0){return new BPromise(function(_0xde4174,_0xcd5d2b){if(_0x2677d0[_0x52cc('0x52')]===null||_0x2677d0[_0x52cc('0x52')]===0x1)_0xde4174(null);return db[_0x52cc('0x53')][_0x52cc('0x40')]({'where':{'sectionId':_0x2677d0['id']},'raw':!![]})[_0x52cc('0x24')](function(_0x104bb2){var _0x57f86b=_[_0x52cc('0x2e')](_0x104bb2,function(_0x63d4b2){return qs[_0x52cc('0x4c')](_0x63d4b2,['id',_0x52cc('0x4d'),'updatedAt',_0x52cc('0x54')]);});_0xde4174(_0x57f86b);})['catch'](function(_0x2fd62b){_0xcd5d2b(_0x2fd62b);});})['then'](function(_0x57ba00){var _0x3b2961=qs['omit'](_0x2677d0,['id',_0x52cc('0x4d'),_0x52cc('0x55')]);_0x3b2961[_0x52cc('0x56')]=_0x1bad8f['id'];if(_0x57ba00)_0x3b2961[_0x52cc('0x57')]=_0x57ba00;return _0x3b2961;})[_0x52cc('0x24')](function(_0x1cc35a){return db[_0x52cc('0x51')]['create'](_0x1cc35a,{'include':[{'model':db[_0x52cc('0x53')],'as':_0x52cc('0x57')}],'raw':!![],'transaction':_0x2915e9});});})['then'](function(){return _0x1bad8f;});}});});});}})[_0x52cc('0x24')](respondWithResult(_0x20915f,0xc9))[_0x52cc('0x47')](handleError(_0x20915f,null));};exports[_0x52cc('0x58')]=function(_0x161515,_0x51bdf4){if(_0x161515[_0x52cc('0x49')]['id']){delete _0x161515[_0x52cc('0x49')]['id'];}return db[_0x52cc('0x29')][_0x52cc('0x46')]({'where':{'id':_0x161515[_0x52cc('0x43')]['id']}})[_0x52cc('0x24')](handleEntityNotFound(_0x51bdf4,null))[_0x52cc('0x24')](saveUpdates(_0x161515['body'],null))[_0x52cc('0x24')](respondWithResult(_0x51bdf4,null))[_0x52cc('0x47')](handleError(_0x51bdf4,null));};exports[_0x52cc('0x59')]=function(_0x27ba14,_0x2eb40a){return db['UserProfile'][_0x52cc('0x46')]({'where':{'id':_0x27ba14[_0x52cc('0x43')]['id']}})[_0x52cc('0x24')](handleEntityNotFound(_0x2eb40a,null))[_0x52cc('0x24')](removeEntity(_0x2eb40a,null))[_0x52cc('0x47')](handleError(_0x2eb40a,null));};exports['describe']=function(_0x450753,_0x4f89c8){return db[_0x52cc('0x29')][_0x52cc('0x5a')]()['then'](respondWithResult(_0x4f89c8,null))['catch'](handleError(_0x4f89c8,null));};exports[_0x52cc('0x5b')]=function(_0xf62423,_0x473a33){var _0x3e1a53=_0xf62423[_0x52cc('0x49')];return db[_0x52cc('0x29')]['find']({'where':{'id':_0xf62423[_0x52cc('0x43')]['id']}})[_0x52cc('0x24')](handleEntityNotFound(_0x473a33,null))[_0x52cc('0x24')](function(_0x2e4168){if(_0x2e4168){return db[_0x52cc('0x4f')][_0x52cc('0x50')](function(_0x3537af){return db[_0x52cc('0x51')][_0x52cc('0x59')]({'where':{'userProfileId':_0xf62423[_0x52cc('0x43')]['id'],'sectionId':_[_0x52cc('0x2e')](_0x3e1a53,function(_0xc400e5){return _0xc400e5[_0x52cc('0x54')];})},'transaction':_0x3537af})['then'](function(){var _0x1f0138=_[_0x52cc('0x2e')](_0x3e1a53,function(_0xec913e){_0xec913e[_0x52cc('0x56')]=_0xf62423[_0x52cc('0x43')]['id'];return _0xec913e;});var _0x3085ef=[];return BPromise[_0x52cc('0x5c')](_0x1f0138,function(_0x19d44b){return db[_0x52cc('0x51')]['create'](_0x19d44b,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x3537af})['then'](function(_0x47b72f){_0x3085ef['push'](_0x47b72f[_0x52cc('0x4b')]({'plain':!![]}));});})[_0x52cc('0x24')](function(){return _0x3085ef;});});});}})[_0x52cc('0x24')](function(_0xc21186){return _0xc21186;})[_0x52cc('0x24')](respondWithResult(_0x473a33,null))[_0x52cc('0x47')](handleError(_0x473a33,null));};exports[_0x52cc('0x5d')]=function(_0x2d5887,_0x1f6280){var _0x4ae164;return db['UserProfile'][_0x52cc('0x46')]({'where':{'id':_0x2d5887[_0x52cc('0x43')]['id']},'attributes':['id',_0x52cc('0x27')]})[_0x52cc('0x24')](handleEntityNotFound(_0x1f6280,null))[_0x52cc('0x24')](function(_0x4feb31){if(_0x4feb31){_0x4ae164=_0x4feb31;return db[_0x52cc('0x51')]['destroy']({'where':{'userProfileId':_0x2d5887[_0x52cc('0x43')]['id'],'sectionId':_0x2d5887[_0x52cc('0x2f')][_0x52cc('0x5e')]}});}})['then'](function(){return _0x4ae164;})[_0x52cc('0x24')](respondWithStatusCode(_0x1f6280,null))['catch'](handleError(_0x1f6280,null));};exports[_0x52cc('0x5f')]=function(_0x17eeba,_0x477cb6){var _0xdab858=[];var _0x8308c=[];return db[_0x52cc('0x51')][_0x52cc('0x40')]({'where':{'userProfileId':_0x17eeba[_0x52cc('0x43')]['id']},'raw':!![]})[_0x52cc('0x24')](function(_0x136181){_0xdab858=_[_0x52cc('0x3a')](_0x136181,function(_0x50d29e){return _0x50d29e[_0x52cc('0x60')]===0x1||_[_0x52cc('0x61')]([0x3eb,0x709],_0x50d29e['sectionId']);});if(!_[_0x52cc('0x62')](_0xdab858)){return _[_0x52cc('0x2e')](_0xdab858,function(_0x5646c4){return _0x5646c4[_0x52cc('0x54')];});}else{return;}})[_0x52cc('0x24')](function(_0x26de66){if(_0x26de66)_0x8308c=_0x26de66;if(_[_0x52cc('0x61')](_0x8308c,0x64)){var _0x51762a=_[_0x52cc('0x46')](_0xdab858,{'sectionId':0x64});return hasDefaultDashboard(_0x51762a)[_0x52cc('0x24')](function(_0x35602f){return _[_0x52cc('0x2e')](_0xdab858,function(_0x51545d){if(_0x51545d['sectionId']===0x64){_0x51545d['subsections']=_0x35602f;}return _0x51545d;});});}else{return;}})['then'](function(_0x22e791){if(_0x22e791)_0xdab858=_0x22e791;if(_[_0x52cc('0x61')](_0x8308c,0x3eb)){var _0x13233e=_[_0x52cc('0x46')](_0xdab858,{'sectionId':0x3eb});return getCustomDashboards(_0x13233e)[_0x52cc('0x24')](function(_0x27adeb){return _[_0x52cc('0x2e')](_0xdab858,function(_0x165e55){if(_0x13233e['enabled']){if(_0x165e55[_0x52cc('0x54')]===0x3eb){_0x165e55[_0x52cc('0x63')]=_0x27adeb;}}else{if(_0x165e55[_0x52cc('0x54')]===0x64){_0x165e55[_0x52cc('0x63')]=_0x27adeb;}}return _0x165e55;});});}else{return;}})[_0x52cc('0x24')](function(_0x4e22dd){if(_0x4e22dd)_0xdab858=_0x4e22dd;if(_[_0x52cc('0x61')](_0x8308c,0x709)){var _0xa0d694=_[_0x52cc('0x46')](_0xdab858,{'sectionId':0x709});return getPlugins(_0xa0d694)[_0x52cc('0x24')](function(_0x104f13){if(_0xa0d694[_0x52cc('0x60')]){return _[_0x52cc('0x2e')](_0xdab858,function(_0x2f697c){if(_0x2f697c['sectionId']===0x709){_0x2f697c[_0x52cc('0x63')]=_0x104f13;}return _0x2f697c;});}else{var _0x21306f={'sectionId':0x76c,'enabled':0x1,'subsections':_0x104f13};var _0x1f6fce=_[_0x52cc('0x2e')](_0xdab858);_0x1f6fce[_0x52cc('0x64')](_0x21306f);return _0x1f6fce;}});}else{return;}})['then'](function(_0x5f5202){if(_0x5f5202)_0xdab858=_0x5f5202;return _[_0x52cc('0x3a')](_0xdab858,[_0x52cc('0x60'),0x1]);})[_0x52cc('0x24')](respondWithResult(_0x477cb6,null))['catch'](handleError(_0x477cb6,null));};function hasDefaultDashboard(_0xa5a215){var _0x98c6fa=[0x65];return new BPromise(function(_0x52a987,_0x54e6d8){try{if(_0xa5a215[_0x52cc('0x52')]){_0x52a987(_0x98c6fa);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0xa5a215['id']},'raw':!![]})['then'](function(_0x292e1f){_0x292e1f?_0x52a987(_0x98c6fa):_0x52a987();});}}catch(_0xb30855){_0x54e6d8(_0xb30855);}});}function getCustomDashboards(_0x4680c3){var _0x26056c=[];return new BPromise(function(_0x46404f,_0x52db05){try{if(_0x4680c3[_0x52cc('0x52')]){return db[_0x52cc('0x65')][_0x52cc('0x40')]({'raw':!![]})[_0x52cc('0x24')](function(_0x4c485c){_0x4c485c['forEach'](function(_0x435d6e){_0x26056c[_0x52cc('0x64')](_0x435d6e['id']+0x1869f);});_0x46404f(_0x26056c);});}else{return db[_0x52cc('0x53')][_0x52cc('0x40')]({'where':{'sectionId':_0x4680c3['id']},'raw':!![]})['then'](function(_0x562e9f){_0x562e9f[_0x52cc('0x66')](function(_0x43cb66){_0x26056c[_0x52cc('0x64')](_0x43cb66[_0x52cc('0x67')]+0x1869f);});_0x46404f(_0x26056c);});}}catch(_0xf8fc64){_0x52db05(_0xf8fc64);}});}function getPlugins(_0x5d322c){var _0xe3feb2=[];return new BPromise(function(_0x44cec2,_0x883621){try{if(_0x5d322c[_0x52cc('0x52')]){return db[_0x52cc('0x68')][_0x52cc('0x40')]({'raw':!![]})[_0x52cc('0x24')](function(_0x20f75e){_0x20f75e['forEach'](function(_0xe00262){_0xe3feb2[_0x52cc('0x64')](_0xe00262['id']+0x15b38);});_0x44cec2(_0xe3feb2);});}else{return db[_0x52cc('0x53')][_0x52cc('0x40')]({'where':{'sectionId':_0x5d322c['id']},'raw':!![]})['then'](function(_0x1c34d0){_0x1c34d0['forEach'](function(_0x3472db){_0xe3feb2[_0x52cc('0x64')](_0x3472db[_0x52cc('0x67')]+0x15b38);});_0x44cec2(_0xe3feb2);});}}catch(_0x234f23){_0x883621(_0x234f23);}});}exports[_0x52cc('0x69')]=function(_0x13fe71,_0x54f500){return db['UserProfile']['find']({'where':{'id':_0x13fe71[_0x52cc('0x43')]['id']}})[_0x52cc('0x24')](handleEntityNotFound(_0x54f500,null))[_0x52cc('0x24')](function(_0xcdce19){if(_0xcdce19){return db[_0x52cc('0x4f')][_0x52cc('0x50')](function(_0xe55df7){return db[_0x52cc('0x51')][_0x52cc('0x40')]({'where':{'userProfileId':_0x13fe71[_0x52cc('0x43')]['id']},'attributes':['id'],'raw':!![]})[_0x52cc('0x24')](function(_0x29bee1){if(_0x29bee1){return db[_0x52cc('0x51')][_0x52cc('0x59')]({'where':{'userProfileId':_0x13fe71[_0x52cc('0x43')]['id'],'id':_[_0x52cc('0x2e')](_0x29bee1,function(_0x159af3){return _0x159af3['id'];})},'transaction':_0xe55df7});}})[_0x52cc('0x24')](function(_0xb2912c){var _0x5dbb10=_[_0x52cc('0x2e')](_0x13fe71[_0x52cc('0x49')],function(_0xb6f754){_0xb6f754['userProfileId']=_0x13fe71['params']['id'];return _0xb6f754;});return db[_0x52cc('0x51')]['bulkCreate'](_0x5dbb10,{'raw':!![],'transaction':_0xe55df7});})['then'](function(_0x4d5622){var _0x4ba982=_['filter'](_[_0x52cc('0x2e')](_0x4d5622,function(_0x28f13f){return _0x28f13f[_0x52cc('0x4b')]({'plain':!![]});}),{'includeAll':![]});if(_0x4ba982){return db[_0x52cc('0x51')][_0x52cc('0x40')]({'where':{'userProfileId':_0x13fe71[_0x52cc('0x43')]['id'],'sectionId':_[_0x52cc('0x2e')](_0x4ba982,function(_0x25fe67){return _0x25fe67[_0x52cc('0x54')];})},'attributes':['id',_0x52cc('0x54')],'raw':!![]})['then'](function(_0x56932c){var _0x2a1d34=_[_0x52cc('0x2e')](_0x13fe71[_0x52cc('0x49')],function(_0x4699c6){_0x4699c6[_0x52cc('0x56')]=_0x13fe71[_0x52cc('0x43')]['id'];return _0x4699c6;});return db['UserProfileResource'][_0x52cc('0x6a')](_0x2a1d34,{'raw':!![],'transaction':_0xe55df7});});}})[_0x52cc('0x47')](handleError(_0x54f500,null));});}})[_0x52cc('0x24')](function(_0xe06df1){var _0x16806c=_['map'](_0xe06df1,function(_0x31936a){return _0x31936a[_0x52cc('0x4b')]({'plain':!![]});});})[_0x52cc('0x24')](respondWithResult(_0x54f500,null))[_0x52cc('0x47')](handleError(_0x54f500,null));};exports['removeResources']=function(_0x54926d,_0x5f30f8,_0x901c69){return db[_0x52cc('0x29')][_0x52cc('0x46')]({'where':{'id':_0x54926d['params']['id']}})[_0x52cc('0x24')](handleEntityNotFound(_0x5f30f8,null))[_0x52cc('0x24')](function(_0x48144c){if(_0x48144c){return _0x48144c[_0x52cc('0x6b')](_0x54926d[_0x52cc('0x2f')][_0x52cc('0x5e')]);}})['then'](respondWithStatusCode(_0x5f30f8,null))[_0x52cc('0x47')](handleError(_0x5f30f8,null));};exports[_0x52cc('0x6c')]=function(_0x571e8c,_0x555dde){var _0x137676={'raw':![],'where':{}};var _0x9fc475={};var _0x433a47={'count':0x0,'rows':[]};var _0x264ce5=_0x571e8c['query'][_0x52cc('0x6d')];if(typeof _0x264ce5===_0x52cc('0x6e')){throw new db[(_0x52cc('0x6f'))]['ValidationError'](_0x52cc('0x70'));}var _0x48c0c8=_0x571e8c[_0x52cc('0x2f')][_0x52cc('0x71')]||![];var _0x255642=getQueryModels(_0x264ce5,_0x48c0c8);if(typeof _0x255642['childModel']===_0x52cc('0x6e')){throw new db[(_0x52cc('0x6f'))]['ValidationError'](_0x52cc('0x72')+_0x264ce5+'\x27');}var _0x5cd5b3=[];if(!_[_0x52cc('0x62')](_0x255642[_0x52cc('0x73')])){_0x5cd5b3=_0x255642[_0x52cc('0x73')];}else{_0x5cd5b3=[{'name':_0x264ce5}];}return db['UserProfile'][_0x52cc('0x74')]({'where':{'id':_0x571e8c[_0x52cc('0x43')]['id']}})[_0x52cc('0x24')](handleEntityNotFound(_0x555dde,null))[_0x52cc('0x24')](function(_0x1074eb){if(_0x1074eb){var _0x153fdd=[];for(var _0x53c81b=0x0;_0x53c81b<_0x5cd5b3[_0x52cc('0x35')];_0x53c81b++){_0x153fdd[_0x52cc('0x64')](db[_0x52cc('0x51')][_0x52cc('0x74')]({'where':{'userProfileId':_0x1074eb['id'],'name':_0x5cd5b3[_0x53c81b][_0x52cc('0x27')]},'raw':!![]}));}return BPromise[_0x52cc('0x75')](_0x153fdd);}})[_0x52cc('0x24')](function(_0x213c60){var _0x51a4d9=_[_0x52cc('0x3a')](_0x213c60,function(_0x423776){return _0x423776?_0x423776:undefined;});var _0xb64fb=_[_0x52cc('0x3a')](_0x5cd5b3,[_0x52cc('0x76'),!![]]);var _0x26cd74=_['isEmpty'](_0x51a4d9)&&_['isEmpty'](_0xb64fb)?null:_[_0x52cc('0x77')](_0xb64fb,_0x51a4d9);if(_0x26cd74){var _0x5a4303=[];for(var _0x52fb9b=0x0;_0x52fb9b<_0x26cd74[_0x52cc('0x35')];_0x52fb9b++){var _0x342849=_[_0x52cc('0x46')](_0x5cd5b3,function(_0x5ca381){return _0x26cd74[_0x52fb9b]?_0x5ca381[_0x52cc('0x27')]===_0x26cd74[_0x52fb9b]['name']:null;});if(_0x342849){if(_0x26cd74[_0x52fb9b][_0x52cc('0x76')]){_0x5a4303[_0x52cc('0x64')](getAllResources(_0x255642[_0x52cc('0x78')],_0x26cd74[_0x52fb9b]));}else{if(!_0x26cd74[_0x52fb9b][_0x52cc('0x52')]){_0x5a4303[_0x52cc('0x64')](getAllowedResources(_0x342849,_0x26cd74[_0x52fb9b],_0x255642[_0x52cc('0x78')]));}else{if(_0x342849[_0x52cc('0x2d')]){_0x5a4303['push'](getAllFilteredResources(_0x342849,_0x26cd74[_0x52fb9b]));}}}}}return BPromise[_0x52cc('0x75')](_0x5a4303);}else{return null;}})[_0x52cc('0x24')](function(_0x4c06c1){var _0x4a8f28=_0x4c06c1;var _0x42c4a9=null;if(_0x4a8f28){_0x42c4a9=_0x4a8f28['length']===0x1?_0x4a8f28[0x0]:null;}if(_0x42c4a9||_0x4a8f28){var _0x4071a6=db[_0x255642['childModel']]['rawAttributes'];_0x9fc475[_0x52cc('0x2d')]=_[_0x52cc('0x30')](_0x4071a6);_0x9fc475[_0x52cc('0x2f')]=_[_0x52cc('0x30')](_0x571e8c[_0x52cc('0x2f')]);_0x9fc475['filters']=_[_0x52cc('0x32')](_0x9fc475[_0x52cc('0x2d')],_0x9fc475[_0x52cc('0x2f')]);_0x137676[_0x52cc('0x34')]=_['intersection'](_0x9fc475[_0x52cc('0x2d')],qs['fields'](_0x571e8c['query'][_0x52cc('0x33')]));_0x137676[_0x52cc('0x34')]=_0x137676[_0x52cc('0x34')][_0x52cc('0x35')]?_0x137676[_0x52cc('0x34')]:_0x9fc475[_0x52cc('0x2d')];if(!_0x571e8c[_0x52cc('0x2f')][_0x52cc('0x36')]('nolimit')){_0x137676[_0x52cc('0x20')]=qs[_0x52cc('0x20')](_0x571e8c['query'][_0x52cc('0x20')]);_0x137676[_0x52cc('0x1f')]=qs['offset'](_0x571e8c[_0x52cc('0x2f')][_0x52cc('0x1f')]);}_0x137676[_0x52cc('0x79')]=qs[_0x52cc('0x38')](_0x571e8c[_0x52cc('0x2f')]['sort']);_0x137676['where']=qs[_0x52cc('0x31')](_[_0x52cc('0x7a')](_0x571e8c[_0x52cc('0x2f')],_0x9fc475[_0x52cc('0x31')]));if(_0x571e8c[_0x52cc('0x2f')][_0x52cc('0x3a')]){_0x137676['where']=_['merge'](_0x137676[_0x52cc('0x39')],{'$or':_[_0x52cc('0x2e')](_0x4071a6,function(_0x2f113c){if(_0x2f113c[_0x52cc('0x2c')][_0x52cc('0x7b')]!==_0x52cc('0x3b')){var _0x2bd63f={};_0x2bd63f[_0x2f113c[_0x52cc('0x7c')]]={'$like':'%'+_0x571e8c[_0x52cc('0x2f')][_0x52cc('0x3a')]+'%'};return _0x2bd63f;}})});}var _0x3ac9e1=[];if(_0x42c4a9){var _0x586554=_[_0x52cc('0x46')](_0x5cd5b3,[_0x52cc('0x27'),_0x42c4a9['name']]);if(_0x586554['field']){var _0x4abbe1={};if(_0x255642[_0x52cc('0x78')]==='AnalyticExtractedReport'){_0x4abbe1[_0x586554['foreignKey']]=_[_0x52cc('0x2e')](_0x42c4a9[_0x52cc('0x7d')],'id');}else{_0x4abbe1[_0x586554[_0x52cc('0x7e')]]=_0x42c4a9[_0x52cc('0x7d')];}_0x3ac9e1[_0x52cc('0x64')](_0x4abbe1);}else{_0x137676[_0x52cc('0x39')]['id']=_0x42c4a9['associatedResources'];}}else{for(var _0x3a0db4=0x0;_0x3a0db4<_0x4a8f28['length'];_0x3a0db4++){var _0x586554=_['find'](_0x5cd5b3,[_0x52cc('0x27'),_0x4a8f28[_0x3a0db4][_0x52cc('0x27')]]);if(_0x586554[_0x52cc('0x7c')]){var _0x4abbe1={};_0x4abbe1[_0x586554[_0x52cc('0x7e')]]=_0x4a8f28[_0x3a0db4]['associatedResources'];_0x3ac9e1[_0x52cc('0x64')](_0x4abbe1);}else{if(!_0x137676[_0x52cc('0x39')]['id'])_0x137676['where']['id']=[];_0x4a8f28[_0x3a0db4]['associatedResources'][_0x52cc('0x66')](function(_0x49df5d){_0x137676[_0x52cc('0x39')]['id'][_0x52cc('0x64')](_0x49df5d);});}}}if(!_[_0x52cc('0x62')](_0x3ac9e1)){_0x137676['where']=_[_0x52cc('0x3c')](_0x137676[_0x52cc('0x39')],{'$and':{'$or':_0x3ac9e1}});}_0x137676=_[_0x52cc('0x3c')]({},_0x137676,_0x571e8c[_0x52cc('0x45')]);if(_0x42c4a9&&!_0x42c4a9['autoAssociation']&&_0x255642['childModel']==='AnalyticExtractedReport'){if(_0x571e8c[_0x52cc('0x2f')][_0x52cc('0x3e')]){_0x137676[_0x52cc('0x3f')]=[{'all':!![]}];}return db[_0x255642['childModel']][_0x52cc('0x40')](_0x137676)['then'](function(_0x17b073){var _0x56b1df=[];_0x17b073[_0x52cc('0x66')](function(_0x468d85){var _0x29c308;switch(_0x468d85[_0x52cc('0x7f')]){case _0x52cc('0x80'):_0x29c308=_[_0x52cc('0x46')](_0x42c4a9[_0x52cc('0x7d')],function(_0x2a7892){return _0x2a7892['id']===_0x468d85['reportId']&&_0x2a7892[_0x52cc('0x2c')]===_0x52cc('0x81');});break;case _0x52cc('0x82'):_0x29c308=_[_0x52cc('0x46')](_0x42c4a9['associatedResources'],function(_0x1670b2){return _0x1670b2['id']===_0x468d85['reportId']&&_0x1670b2[_0x52cc('0x2c')]==='CustomReports';});break;}if(_0x29c308)_0x56b1df['push'](_0x468d85);});_0x433a47[_0x52cc('0x3d')]=_0x56b1df['length'];_0x433a47[_0x52cc('0x41')]=_0x56b1df;return _0x433a47;});}else{return db[_0x255642[_0x52cc('0x78')]][_0x52cc('0x3d')]({'where':_0x137676['where']})[_0x52cc('0x24')](function(_0x314ffc){_0x433a47[_0x52cc('0x3d')]=_0x314ffc;if(_0x571e8c['query'][_0x52cc('0x3e')]){if(_0x255642[_0x52cc('0x78')]===_0x52cc('0x83')){_0x137676[_0x52cc('0x3f')]=[{'model':db[_0x52cc('0x84')],'as':'Tags','attributes':['id',_0x52cc('0x27'),_0x52cc('0x85')],'required':_0x571e8c[_0x52cc('0x2f')][_0x52cc('0x86')]?!![]:![]},{'model':db['Tag'],'as':'ThroughTags','attributes':['id',_0x52cc('0x27'),_0x52cc('0x85')],'through':_0x571e8c[_0x52cc('0x2f')][_0x52cc('0x86')]?{'attributes':[],'where':{'TagId':_0x571e8c[_0x52cc('0x2f')]['tag']||undefined}}:{},'required':_0x571e8c['query'][_0x52cc('0x86')]?!![]:![]}];}else{_0x137676[_0x52cc('0x3f')]=[{'all':!![]}];}}return db[_0x255642[_0x52cc('0x78')]][_0x52cc('0x40')](_0x137676);})[_0x52cc('0x24')](function(_0x519077){_0x433a47[_0x52cc('0x41')]=_0x519077;return _0x433a47;});}}else{return _0x433a47;}})[_0x52cc('0x24')](respondWithFilteredResult(_0x555dde,_0x137676))[_0x52cc('0x47')](handleError(_0x555dde,null));};function getAllResources(_0x4c87f6,_0x462193){return new BPromise(function(_0x256b4d,_0x44592d){if(_0x462193){var _0x108528=_0x462193[_0x52cc('0x3a')]?{[_0x462193[_0x52cc('0x3a')][_0x52cc('0x7c')]]:_0x462193['filter'][_0x52cc('0x87')]}:undefined;return db[_0x4c87f6][_0x52cc('0x40')]({'where':_0x108528,'raw':!![]})[_0x52cc('0x24')](function(_0x367062){_0x462193[_0x52cc('0x7d')]=_[_0x52cc('0x2e')](_0x367062,'id');_0x256b4d(_0x462193);})['catch'](function(_0x1aab81){_0x44592d(_0x1aab81);});}else{_0x256b4d(null);}});}function getAllFilteredResources(_0x32f52f,_0x81e01c){return new BPromise(function(_0x52df61,_0x451aea){var _0x45f925=_0x32f52f[_0x52cc('0x3a')]?{[_0x32f52f[_0x52cc('0x3a')][_0x52cc('0x7c')]]:_0x32f52f[_0x52cc('0x3a')]['value']}:undefined;return db[_0x32f52f['model']][_0x52cc('0x40')]({'where':_0x45f925,'raw':!![]})[_0x52cc('0x24')](function(_0x938b71){_0x81e01c['associatedResources']=_[_0x52cc('0x2e')](_0x938b71,function(_0x52909f){return _0x52909f[_0x52cc('0x27')];});_0x52df61(_0x81e01c);})[_0x52cc('0x47')](function(_0x4893c6){_0x451aea(_0x4893c6);});});}function getAllowedResources(_0x11de7c,_0x1022d7,_0x717178){return new BPromise(function(_0x5f12d9,_0x67615f){if(_0x1022d7){return db['UserProfileResource'][_0x52cc('0x40')]({'where':{'sectionId':_0x1022d7['id']},'raw':!![]})[_0x52cc('0x24')](function(_0x5232cb){if(_0x11de7c[_0x52cc('0x7c')]&&_0x11de7c[_0x52cc('0x7c')]!=='id'){_0x1022d7['associatedResources']=_[_0x52cc('0x2e')](_0x5232cb,function(_0x4238c7){return _0x4238c7[_0x11de7c['field']];});}else{if(_0x717178===_0x52cc('0x88')){_0x1022d7[_0x52cc('0x7d')]=_['map'](_0x5232cb,function(_0x4b0ea8){return{'id':_0x4b0ea8[_0x52cc('0x67')],'type':_0x4b0ea8['type']};});}else{_0x1022d7[_0x52cc('0x7d')]=_['map'](_0x5232cb,function(_0x4d977a){return _0x4d977a[_0x52cc('0x67')];});}}_0x5f12d9(_0x1022d7);})[_0x52cc('0x47')](function(_0x5d443c){_0x67615f(_0x5d443c);});}else{_0x5f12d9(null);}});}function getQueryModels(_0x3f62f5,_0x218476){var _0x4391ca=_0x3f62f5['toLowerCase']();var _0x7215d6={'childModel':undefined,'parentSections':[]};switch(_0x4391ca){case _0x52cc('0x89'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0x8a');break;case _0x52cc('0x8b'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0x8c');break;case _0x52cc('0x8d'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0x8e');_0x7215d6[_0x52cc('0x73')]=[{'name':_0x52cc('0x8f'),'field':'name','foreignKey':'projectName'}];break;case'projects':_0x7215d6[_0x52cc('0x78')]=_0x52cc('0x90');break;case _0x52cc('0x91'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0x83');_0x7215d6['parentSections']=[{'name':_0x52cc('0x92'),'field':'id','foreignKey':_0x52cc('0x93')}];break;case'lists':_0x7215d6[_0x52cc('0x78')]=_0x52cc('0x94');break;case _0x52cc('0x95'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0x96');break;case _0x52cc('0x97'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0x98');break;case _0x52cc('0x99'):_0x7215d6['childModel']=_0x52cc('0x9a');break;case _0x52cc('0x9b'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0x9c');break;case _0x52cc('0x9d'):_0x7215d6['childModel']=_0x52cc('0x9e');break;case _0x52cc('0x9f'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xa0');break;case _0x52cc('0xa1'):case _0x52cc('0xa2'):case _0x52cc('0xa3'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xa4');break;case _0x52cc('0xa5'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xa6');break;case _0x52cc('0xa7'):_0x7215d6[_0x52cc('0x78')]='VoiceMail';break;case _0x52cc('0xa8'):_0x7215d6[_0x52cc('0x78')]='VoiceRecording';_0x7215d6[_0x52cc('0x73')]=[{'name':_0x52cc('0xa9'),'field':_0x52cc('0x27'),'foreignKey':_0x52cc('0xaa'),'model':_0x52cc('0xab'),'filter':{'field':_0x52cc('0xac'),'value':['agent']}},{'name':_0x52cc('0xad'),'field':_0x52cc('0x27'),'foreignKey':_0x52cc('0xaa'),'model':_0x52cc('0xab'),'filter':{'field':_0x52cc('0xac'),'value':[_0x52cc('0xae')]}},{'name':_0x52cc('0xaf'),'field':_0x52cc('0x27'),'foreignKey':_0x52cc('0xb0'),'model':_0x52cc('0xb1'),'filter':{'field':_0x52cc('0x2c'),'value':[_0x52cc('0xb2')]}},{'name':_0x52cc('0xb3'),'field':_0x52cc('0x27'),'foreignKey':_0x52cc('0xb0'),'model':_0x52cc('0xb1'),'filter':{'field':_0x52cc('0x2c'),'value':[_0x52cc('0xb4')]}}];break;case'musiconholds':_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xb5');break;case'chanspies':_0x7215d6['childModel']=_0x52cc('0xb6');break;case'voiceprefixes':_0x7215d6[_0x52cc('0x78')]='VoicePrefix';break;case _0x52cc('0xb7'):_0x7215d6['childModel']=_0x52cc('0xb8');break;case'mailqueues':_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xb9');break;case _0x52cc('0xba'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xbb');break;case _0x52cc('0xbc'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xbd');break;case _0x52cc('0xbe'):_0x7215d6[_0x52cc('0x78')]='OpenchannelQueue';break;case _0x52cc('0xbf'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xc0');break;case _0x52cc('0xc1'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xc2');break;case _0x52cc('0xc3'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xc4');break;case _0x52cc('0xc5'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xc6');break;case _0x52cc('0xc7'):_0x7215d6[_0x52cc('0x78')]='WhatsappAccount';break;case _0x52cc('0xc8'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xc9');break;case _0x52cc('0xca'):case'queuecampaigns':_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xb1');if(_0x218476){_0x7215d6[_0x52cc('0x73')]=[{'name':_0x52cc('0xaf')},{'name':_0x52cc('0xb3')}];}break;case _0x52cc('0xcb'):case'agents':case _0x52cc('0xcc'):_0x7215d6['childModel']=_0x52cc('0xab');if(_0x218476){_0x7215d6[_0x52cc('0x73')]=[{'name':_0x52cc('0xcd'),'filter':{'field':_0x52cc('0xac'),'value':[_0x52cc('0xce'),'user']},'ignore':!![]},{'name':_0x52cc('0xa9')},{'name':'Telephones'}];}break;case _0x52cc('0xcf'):_0x7215d6[_0x52cc('0x78')]='ZendeskAccount';break;case _0x52cc('0xd0'):_0x7215d6['childModel']=_0x52cc('0xd1');break;case _0x52cc('0xd2'):_0x7215d6[_0x52cc('0x78')]='FreshdeskAccount';break;case _0x52cc('0xd3'):_0x7215d6[_0x52cc('0x78')]='SugarcrmAccount';break;case _0x52cc('0xd4'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xd5');break;case _0x52cc('0xd6'):_0x7215d6['childModel']='ZohoAccount';break;case'vtigeraccounts':_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xab');break;case'cannedanswers':_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xd7');break;case _0x52cc('0xd8'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xd9');break;case _0x52cc('0xda'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0x65');break;case _0x52cc('0xdb'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xdc');break;case _0x52cc('0xdd'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xde');break;case _0x52cc('0xdf'):_0x7215d6['childModel']='Schedule';break;case _0x52cc('0xe0'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xe1');break;case _0x52cc('0xe2'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0x84');break;case _0x52cc('0xe3'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xe4');break;case _0x52cc('0xe5'):_0x7215d6[_0x52cc('0x78')]='Trigger';break;case'trunks':_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xe6');break;case _0x52cc('0xe7'):_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xe8');break;case'plugins':_0x7215d6['childModel']=_0x52cc('0x68');break;case _0x52cc('0xe9'):_0x7215d6['childModel']='AnalyticExtractedReport';_0x7215d6[_0x52cc('0x73')]=[{'name':_0x52cc('0xea'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xeb');break;case'whatsappaccounts':_0x7215d6[_0x52cc('0x78')]=_0x52cc('0xec');break;default:return _0x7215d6;}return _0x7215d6;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 49851b9..f85e12c 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 _0xd938=['save','update','remove','emit','hook','exports','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x5ef905,_0x564b87){var _0x367808=function(_0x14f487){while(--_0x14f487){_0x5ef905['push'](_0x5ef905['shift']());}};_0x367808(++_0x564b87);}(_0xd938,0x84));var _0x8d93=function(_0x467c7a,_0x17482e){_0x467c7a=_0x467c7a-0x0;var _0x326854=_0xd938[_0x467c7a];return _0x326854;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x8d93('0x0'))['db'][_0x8d93('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x8d93('0x2')](0x0);var events={'afterCreate':_0x8d93('0x3'),'afterUpdate':_0x8d93('0x4'),'afterDestroy':_0x8d93('0x5')};function emitEvent(_0x4d1aac){return function(_0x105da8,_0x2e8617,_0x1459c6){UserProfileEvents[_0x8d93('0x6')](_0x4d1aac+':'+_0x105da8['id'],_0x105da8);UserProfileEvents[_0x8d93('0x6')](_0x4d1aac,_0x105da8);_0x1459c6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x8d93('0x7')](e,emitEvent(event));}}module[_0x8d93('0x8')]=UserProfileEvents; \ No newline at end of file +var _0xd6c8=['UserProfile','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2eaa57,_0x59e2bb){var _0x25ed95=function(_0x2db2c3){while(--_0x2db2c3){_0x2eaa57['push'](_0x2eaa57['shift']());}};_0x25ed95(++_0x59e2bb);}(_0xd6c8,0xb3));var _0x8d6c=function(_0x3e5bc8,_0x457d89){_0x3e5bc8=_0x3e5bc8-0x0;var _0xfd84bc=_0xd6c8[_0x3e5bc8];return _0xfd84bc;};'use strict';var EventEmitter=require(_0x8d6c('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x8d6c('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x8d6c('0x2')](0x0);var events={'afterCreate':_0x8d6c('0x3'),'afterUpdate':'update','afterDestroy':_0x8d6c('0x4')};function emitEvent(_0x26b02d){return function(_0x84dd2f,_0x4e845c,_0x10e0af){UserProfileEvents[_0x8d6c('0x5')](_0x26b02d+':'+_0x84dd2f['id'],_0x84dd2f);UserProfileEvents[_0x8d6c('0x5')](_0x26b02d,_0x84dd2f);_0x10e0af(null);};}for(var e in events){if(events[_0x8d6c('0x6')](e)){var event=events[e];UserProfile[_0x8d6c('0x7')](e,emitEvent(event));}}module[_0x8d6c('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index bb046f0..cb55834 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 _0xa3fb=['moment','bluebird','request-promise','path','../../config/environment','./userProfile.attributes','exports','define','UserProfile','user_profiles','util','../../config/logger','api'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xa3fb,0xe7));var _0xba3f=function(_0xce2412,_0x1436a7){_0xce2412=_0xce2412-0x0;var _0x38d1e5=_0xa3fb[_0xce2412];return _0x38d1e5;};'use strict';var _=require('lodash');var util=require(_0xba3f('0x0'));var logger=require(_0xba3f('0x1'))(_0xba3f('0x2'));var moment=require(_0xba3f('0x3'));var BPromise=require(_0xba3f('0x4'));var rp=require(_0xba3f('0x5'));var fs=require('fs');var path=require(_0xba3f('0x6'));var rimraf=require('rimraf');var config=require(_0xba3f('0x7'));var attributes=require(_0xba3f('0x8'));module[_0xba3f('0x9')]=function(_0x1a174c,_0x2db5e6){return _0x1a174c[_0xba3f('0xa')](_0xba3f('0xb'),attributes,{'tableName':_0xba3f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x083e=['moment','request-promise','path','rimraf','../../config/environment','./userProfile.attributes','exports','define','UserProfile','user_profiles','lodash','../../config/logger','api'];(function(_0xee7548,_0x1451f9){var _0x1a7899=function(_0x3391bb){while(--_0x3391bb){_0xee7548['push'](_0xee7548['shift']());}};_0x1a7899(++_0x1451f9);}(_0x083e,0x10e));var _0xe083=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0x083e[_0x5b740b];return _0x6f8f4e;};'use strict';var _=require(_0xe083('0x0'));var util=require('util');var logger=require(_0xe083('0x1'))(_0xe083('0x2'));var moment=require(_0xe083('0x3'));var BPromise=require('bluebird');var rp=require(_0xe083('0x4'));var fs=require('fs');var path=require(_0xe083('0x5'));var rimraf=require(_0xe083('0x6'));var config=require(_0xe083('0x7'));var attributes=require(_0xe083('0x8'));module[_0xe083('0x9')]=function(_0x5f5bec,_0xd873d7){return _0x5f5bec[_0xe083('0xa')](_0xe083('0xb'),attributes,{'tableName':_0xe083('0xc'),'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 800d131..7f6182e 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 _0x2bd8=['../../config/environment','jayson/promise','client','redis','defaults','localhost','info','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3f6848,_0x153e29){var _0x5654e3=function(_0x2b9e58){while(--_0x2b9e58){_0x3f6848['push'](_0x3f6848['shift']());}};_0x5654e3(++_0x153e29);}(_0x2bd8,0x130));var _0x82bd=function(_0x11be45,_0x5bec8c){_0x11be45=_0x11be45-0x0;var _0x24ec58=_0x2bd8[_0x11be45];return _0x24ec58;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var moment=require(_0x82bd('0x1'));var BPromise=require(_0x82bd('0x2'));var rs=require(_0x82bd('0x3'));var fs=require('fs');var Redis=require(_0x82bd('0x4'));var db=require(_0x82bd('0x5'))['db'];var utils=require(_0x82bd('0x6'));var logger=require(_0x82bd('0x7'))('rpc');var config=require(_0x82bd('0x8'));var jayson=require(_0x82bd('0x9'));var client=jayson[_0x82bd('0xa')]['http']({'port':0x232a});config[_0x82bd('0xb')]=_[_0x82bd('0xc')](config[_0x82bd('0xb')],{'host':_0x82bd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x82bd('0xb')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x51c6ea,_0x5bb22c,_0x5f0434){return new BPromise(function(_0x4c9430,_0x36abe3){return client['request'](_0x51c6ea,_0x5f0434)['then'](function(_0x32821a){logger[_0x82bd('0xe')]('UserProfile,\x20%s,\x20%s',_0x5bb22c,_0x82bd('0xf'));logger['debug'](_0x82bd('0x10'),_0x5bb22c,'request\x20sent',JSON[_0x82bd('0x11')](_0x32821a));if(_0x32821a[_0x82bd('0x12')]){if(_0x32821a[_0x82bd('0x12')][_0x82bd('0x13')]===0x1f4){logger['error'](_0x82bd('0x14'),_0x5bb22c,_0x32821a[_0x82bd('0x12')]['message']);return _0x36abe3(_0x32821a[_0x82bd('0x12')]['message']);}logger[_0x82bd('0x12')](_0x82bd('0x14'),_0x5bb22c,_0x32821a[_0x82bd('0x12')][_0x82bd('0x15')]);return _0x4c9430(_0x32821a[_0x82bd('0x12')][_0x82bd('0x15')]);}else{logger[_0x82bd('0xe')](_0x82bd('0x14'),_0x5bb22c,_0x82bd('0xf'));_0x4c9430(_0x32821a[_0x82bd('0x16')][_0x82bd('0x15')]);}})[_0x82bd('0x17')](function(_0x1c3779){logger[_0x82bd('0x12')]('UserProfile,\x20%s,\x20%s',_0x5bb22c,_0x1c3779);_0x36abe3(_0x1c3779);});});} \ No newline at end of file +var _0x425d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','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','stringify','error','code','message','result'];(function(_0x35ca4d,_0x2ae299){var _0x9abc2c=function(_0x246fb3){while(--_0x246fb3){_0x35ca4d['push'](_0x35ca4d['shift']());}};_0x9abc2c(++_0x2ae299);}(_0x425d,0x1e0));var _0xd425=function(_0x377ddf,_0x102e9a){_0x377ddf=_0x377ddf-0x0;var _0x5b8465=_0x425d[_0x377ddf];return _0x5b8465;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var moment=require(_0xd425('0x1'));var BPromise=require(_0xd425('0x2'));var rs=require(_0xd425('0x3'));var fs=require('fs');var Redis=require(_0xd425('0x4'));var db=require(_0xd425('0x5'))['db'];var utils=require(_0xd425('0x6'));var logger=require(_0xd425('0x7'))('rpc');var config=require(_0xd425('0x8'));var jayson=require(_0xd425('0x9'));var client=jayson[_0xd425('0xa')][_0xd425('0xb')]({'port':0x232a});config[_0xd425('0xc')]=_[_0xd425('0xd')](config['redis'],{'host':_0xd425('0xe'),'port':0x18eb});var socket=require(_0xd425('0xf'))(new Redis(config[_0xd425('0xc')]));require(_0xd425('0x10'))[_0xd425('0x11')](socket);function respondWithRpcPromise(_0x2beb20,_0x30111e,_0x1969ba){return new BPromise(function(_0x3a7a01,_0x35a7f4){return client[_0xd425('0x12')](_0x2beb20,_0x1969ba)[_0xd425('0x13')](function(_0x26f6d2){logger[_0xd425('0x14')](_0xd425('0x15'),_0x30111e,_0xd425('0x16'));logger[_0xd425('0x17')](_0xd425('0x18'),_0x30111e,_0xd425('0x16'),JSON[_0xd425('0x19')](_0x26f6d2));if(_0x26f6d2['error']){if(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1b')]===0x1f4){logger[_0xd425('0x1a')]('UserProfile,\x20%s,\x20%s',_0x30111e,_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);return _0x35a7f4(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);}logger[_0xd425('0x1a')]('UserProfile,\x20%s,\x20%s',_0x30111e,_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);return _0x3a7a01(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);}else{logger['info'](_0xd425('0x15'),_0x30111e,_0xd425('0x16'));_0x3a7a01(_0x26f6d2[_0xd425('0x1d')][_0xd425('0x1c')]);}})['catch'](function(_0x58a0c1){logger['error']('UserProfile,\x20%s,\x20%s',_0x30111e,_0x58a0c1);_0x35a7f4(_0x58a0c1);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 98127c9..564fff2 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 _0xda78=['remove','emit','removeListener','register','length','userProfile:','save'];(function(_0x10f3fc,_0x46c9e9){var _0x3ca4cb=function(_0x3dab68){while(--_0x3dab68){_0x10f3fc['push'](_0x10f3fc['shift']());}};_0x3ca4cb(++_0x46c9e9);}(_0xda78,0x180));var _0x8da7=function(_0x574548,_0x7a5fe3){_0x574548=_0x574548-0x0;var _0x66cd38=_0xda78[_0x574548];return _0x66cd38;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x8da7('0x0'),_0x8da7('0x1'),'update'];function createListener(_0x1a3184,_0x44f316){return function(_0x3c4de2){_0x44f316[_0x8da7('0x2')](_0x1a3184,_0x3c4de2);};}function removeListener(_0x4a9431,_0x109921){return function(){UserProfileEvents[_0x8da7('0x3')](_0x4a9431,_0x109921);};}exports[_0x8da7('0x4')]=function(_0xd35a86){for(var _0x4e4fab=0x0,_0x570339=events[_0x8da7('0x5')];_0x4e4fab<_0x570339;_0x4e4fab++){var _0x4bf84f=events[_0x4e4fab];var _0x463ea8=createListener(_0x8da7('0x6')+_0x4bf84f,_0xd35a86);UserProfileEvents['on'](_0x4bf84f,_0x463ea8);}}; \ No newline at end of file +var _0x3699=['./userProfile.events','save','remove','emit','removeListener','register','length','userProfile:'];(function(_0x201957,_0x5d51ce){var _0xeb3d26=function(_0x30b3a2){while(--_0x30b3a2){_0x201957['push'](_0x201957['shift']());}};_0xeb3d26(++_0x5d51ce);}(_0x3699,0x110));var _0x9369=function(_0x36ade3,_0x6177ee){_0x36ade3=_0x36ade3-0x0;var _0x584f3e=_0x3699[_0x36ade3];return _0x584f3e;};'use strict';var UserProfileEvents=require(_0x9369('0x0'));var events=[_0x9369('0x1'),_0x9369('0x2'),'update'];function createListener(_0x331263,_0x3e3694){return function(_0x48587c){_0x3e3694[_0x9369('0x3')](_0x331263,_0x48587c);};}function removeListener(_0x11a7e1,_0x4633ba){return function(){UserProfileEvents[_0x9369('0x4')](_0x11a7e1,_0x4633ba);};}exports[_0x9369('0x5')]=function(_0x85414f){for(var _0x3f275d=0x0,_0x453aa4=events[_0x9369('0x6')];_0x3f275d<_0x453aa4;_0x3f275d++){var _0x102b3c=events[_0x3f275d];var _0x5783fd=createListener(_0x9369('0x7')+_0x102b3c,_0x85414f);UserProfileEvents['on'](_0x102b3c,_0x5783fd);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index b52656f..a661a3a 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 _0x775e=['/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x257e68,_0x293133){var _0x33e49f=function(_0x33f7e1){while(--_0x33f7e1){_0x257e68['push'](_0x257e68['shift']());}};_0x33e49f(++_0x293133);}(_0x775e,0xda));var _0xe775=function(_0x246d30,_0x24538b){_0x246d30=_0x246d30-0x0;var _0x384cd4=_0x775e[_0x246d30];return _0x384cd4;};'use strict';var multer=require(_0xe775('0x0'));var util=require('util');var path=require(_0xe775('0x1'));var timeout=require(_0xe775('0x2'));var express=require(_0xe775('0x3'));var router=express[_0xe775('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe775('0x5'));var config=require(_0xe775('0x6'));var controller=require(_0xe775('0x7'));router['get']('/',auth[_0xe775('0x8')](),controller[_0xe775('0x9')]);router[_0xe775('0xa')](_0xe775('0xb'),auth['isAuthenticated'](),controller[_0xe775('0xc')]);router['get'](_0xe775('0xd'),auth[_0xe775('0x8')](),controller[_0xe775('0xe')]);router[_0xe775('0xf')]('/',auth[_0xe775('0x8')](),controller[_0xe775('0x10')]);router['put']('/:id',auth[_0xe775('0x8')](),controller[_0xe775('0x11')]);router[_0xe775('0x12')](_0xe775('0xd'),auth[_0xe775('0x8')](),controller[_0xe775('0x13')]);module[_0xe775('0x14')]=router; \ No newline at end of file +var _0x5843=['delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x5843,0x74));var _0x3584=function(_0x334524,_0x1fca82){_0x334524=_0x334524-0x0;var _0x870ae9=_0x5843[_0x334524];return _0x870ae9;};'use strict';var multer=require(_0x3584('0x0'));var util=require('util');var path=require(_0x3584('0x1'));var timeout=require(_0x3584('0x2'));var express=require(_0x3584('0x3'));var router=express[_0x3584('0x4')]();var auth=require(_0x3584('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3584('0x6'));var controller=require('./userProfileResource.controller');router[_0x3584('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3584('0x7')](_0x3584('0x8'),auth[_0x3584('0x9')](),controller[_0x3584('0xa')]);router[_0x3584('0x7')](_0x3584('0xb'),auth['isAuthenticated'](),controller[_0x3584('0xc')]);router[_0x3584('0xd')]('/',auth['isAuthenticated'](),controller[_0x3584('0xe')]);router[_0x3584('0xf')](_0x3584('0xb'),auth['isAuthenticated'](),controller[_0x3584('0x10')]);router[_0x3584('0x11')]('/:id',auth[_0x3584('0x9')](),controller[_0x3584('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index e07a862..617de19 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 _0x53fa=['sequelize','exports','INTEGER'];(function(_0x11ef2d,_0x4da792){var _0xc17ba0=function(_0x380d9c){while(--_0x380d9c){_0x11ef2d['push'](_0x11ef2d['shift']());}};_0xc17ba0(++_0x4da792);}(_0x53fa,0x84));var _0xa53f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53fa[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa53f('0x0'));module[_0xa53f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xa53f('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x30f1=['sequelize','exports'];(function(_0x457862,_0x57595a){var _0x566e06=function(_0x3a81ae){while(--_0x3a81ae){_0x457862['push'](_0x457862['shift']());}};_0x566e06(++_0x57595a);}(_0x30f1,0xde));var _0x130f=function(_0x4b9925,_0x147278){_0x4b9925=_0x4b9925-0x0;var _0x346e2c=_0x30f1[_0x4b9925];return _0x346e2c;};'use strict';var Sequelize=require(_0x130f('0x0'));module[_0x130f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index a355e80..208f410 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 _0xd056=['create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','UserProfileResource','includeAll','include','findAll','rows','show','params','filtears','catch'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xd056,0x124));var _0x6d05=function(_0x1db92a,_0x560664){_0x1db92a=_0x1db92a-0x0;var _0x125a40=_0xd056[_0x1db92a];return _0x125a40;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6d05('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6d05('0x1'));var jsonpatch=require(_0x6d05('0x2'));var rp=require(_0x6d05('0x3'));var moment=require('moment');var BPromise=require(_0x6d05('0x4'));var Mustache=require(_0x6d05('0x5'));var util=require('util');var path=require(_0x6d05('0x6'));var sox=require(_0x6d05('0x7'));var csv=require(_0x6d05('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6d05('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6d05('0xa'));var deskjs=require(_0x6d05('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6d05('0xc'));var Papa=require(_0x6d05('0xd'));var Redis=require(_0x6d05('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6d05('0xf'));var as=require(_0x6d05('0x10'));var hardwareService=require(_0x6d05('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x6d05('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x6d05('0x13'));var db=require(_0x6d05('0x14'))['db'];function respondWithStatusCode(_0x27ab96,_0x37eae0){_0x37eae0=_0x37eae0||0xcc;return function(_0x54e0c8){if(_0x54e0c8){return _0x27ab96['sendStatus'](_0x37eae0);}return _0x27ab96[_0x6d05('0x15')](_0x37eae0)[_0x6d05('0x16')]();};}function respondWithResult(_0x1d6b36,_0x2bb9cb){_0x2bb9cb=_0x2bb9cb||0xc8;return function(_0x5a4012){if(_0x5a4012){return _0x1d6b36[_0x6d05('0x15')](_0x2bb9cb)[_0x6d05('0x17')](_0x5a4012);}};}function respondWithFilteredResult(_0x47c745,_0x1185cd){return function(_0x46e6a8){if(_0x46e6a8){var _0x1b1ccc=_0x46e6a8[_0x6d05('0x18')],_0x465615=_0x1185cd[_0x6d05('0x19')],_0x5dbe2f=_0x1185cd[_0x6d05('0x19')]+_0x1185cd[_0x6d05('0x1a')],_0xcf9190;if(_0x5dbe2f>=_0x1b1ccc){_0x5dbe2f=_0x1b1ccc;_0xcf9190=0xc8;}else{_0xcf9190=0xce;}_0x47c745[_0x6d05('0x15')](_0xcf9190);return _0x47c745['set'](_0x6d05('0x1b'),_0x465615+'-'+_0x5dbe2f+'/'+_0x1b1ccc)[_0x6d05('0x17')](_0x46e6a8);}return null;};}function patchUpdates(_0x3d6228){return function(_0x476649){try{jsonpatch[_0x6d05('0x1c')](_0x476649,_0x3d6228,!![]);}catch(_0x17494b){return BPromise[_0x6d05('0x1d')](_0x17494b);}return _0x476649[_0x6d05('0x1e')]();};}function saveUpdates(_0x3fc03d,_0x213743){return function(_0x1439d8){if(_0x1439d8){return _0x1439d8[_0x6d05('0x1f')](_0x3fc03d)[_0x6d05('0x20')](function(_0x8a90fd){return _0x8a90fd;});}return null;};}function removeEntity(_0x4fc9f0,_0x20c3ee){return function(_0x50d244){if(_0x50d244){return _0x50d244[_0x6d05('0x21')]()[_0x6d05('0x20')](function(){_0x4fc9f0[_0x6d05('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e9ac8,_0x265bc5){return function(_0x416caf){if(!_0x416caf){_0x2e9ac8[_0x6d05('0x22')](0x194);}return _0x416caf;};}function handleError(_0x2d9685,_0x561855){_0x561855=_0x561855||0x1f4;return function(_0x36c296){logger[_0x6d05('0x23')](_0x36c296['stack']);if(_0x36c296[_0x6d05('0x24')]){delete _0x36c296[_0x6d05('0x24')];}_0x2d9685[_0x6d05('0x15')](_0x561855)['send'](_0x36c296);};}exports[_0x6d05('0x25')]=function(_0x3007f7,_0x1b4db4){var _0x23be83={},_0x285fbf={},_0xb38d99={'count':0x0,'rows':[]};var _0x3eb83a=_[_0x6d05('0x26')](db['UserProfileResource'][_0x6d05('0x27')],function(_0x286a86){return{'name':_0x286a86[_0x6d05('0x28')],'type':_0x286a86[_0x6d05('0x29')][_0x6d05('0x2a')]};});_0x285fbf[_0x6d05('0x2b')]=_[_0x6d05('0x26')](_0x3eb83a,_0x6d05('0x24'));_0x285fbf[_0x6d05('0x2c')]=_[_0x6d05('0x2d')](_0x3007f7['query']);_0x285fbf['filters']=_[_0x6d05('0x2e')](_0x285fbf['model'],_0x285fbf[_0x6d05('0x2c')]);_0x23be83[_0x6d05('0x2f')]=_['intersection'](_0x285fbf[_0x6d05('0x2b')],qs['fields'](_0x3007f7[_0x6d05('0x2c')][_0x6d05('0x30')]));_0x23be83[_0x6d05('0x2f')]=_0x23be83['attributes'][_0x6d05('0x31')]?_0x23be83['attributes']:_0x285fbf[_0x6d05('0x2b')];if(!_0x3007f7[_0x6d05('0x2c')]['hasOwnProperty'](_0x6d05('0x32'))){_0x23be83[_0x6d05('0x1a')]=qs[_0x6d05('0x1a')](_0x3007f7[_0x6d05('0x2c')][_0x6d05('0x1a')]);_0x23be83[_0x6d05('0x19')]=qs[_0x6d05('0x19')](_0x3007f7[_0x6d05('0x2c')][_0x6d05('0x19')]);}_0x23be83[_0x6d05('0x33')]=qs[_0x6d05('0x34')](_0x3007f7[_0x6d05('0x2c')][_0x6d05('0x34')]);_0x23be83['where']=qs[_0x6d05('0x35')](_['pick'](_0x3007f7[_0x6d05('0x2c')],_0x285fbf[_0x6d05('0x35')]),_0x3eb83a);if(_0x3007f7['query'][_0x6d05('0x36')]){_0x23be83[_0x6d05('0x37')]=_[_0x6d05('0x38')](_0x23be83['where'],{'$or':_[_0x6d05('0x26')](_0x3eb83a,function(_0x26a1b9){if(_0x26a1b9[_0x6d05('0x29')]!==_0x6d05('0x39')){var _0x2c60f6={};_0x2c60f6[_0x26a1b9[_0x6d05('0x24')]]={'$like':'%'+_0x3007f7[_0x6d05('0x2c')][_0x6d05('0x36')]+'%'};return _0x2c60f6;}})});}_0x23be83=_['merge']({},_0x23be83,_0x3007f7[_0x6d05('0x3a')]);var _0x12943f={'where':_0x23be83['where']};return db[_0x6d05('0x3b')][_0x6d05('0x18')](_0x12943f)[_0x6d05('0x20')](function(_0x1a53c9){_0xb38d99[_0x6d05('0x18')]=_0x1a53c9;if(_0x3007f7[_0x6d05('0x2c')][_0x6d05('0x3c')]){_0x23be83[_0x6d05('0x3d')]=[{'all':!![]}];}return db['UserProfileResource'][_0x6d05('0x3e')](_0x23be83);})['then'](function(_0x5d7228){_0xb38d99[_0x6d05('0x3f')]=_0x5d7228;return _0xb38d99;})['then'](respondWithFilteredResult(_0x1b4db4,_0x23be83))['catch'](handleError(_0x1b4db4,null));};exports[_0x6d05('0x40')]=function(_0x50ad57,_0x34530c){var _0x317bb8={'raw':![],'where':{'id':_0x50ad57[_0x6d05('0x41')]['id']}},_0x2de08d={};_0x2de08d[_0x6d05('0x2b')]=_[_0x6d05('0x2d')](db['UserProfileResource'][_0x6d05('0x27')]);_0x2de08d['query']=_['keys'](_0x50ad57[_0x6d05('0x2c')]);_0x2de08d[_0x6d05('0x42')]=_[_0x6d05('0x2e')](_0x2de08d[_0x6d05('0x2b')],_0x2de08d[_0x6d05('0x2c')]);_0x317bb8[_0x6d05('0x2f')]=_[_0x6d05('0x2e')](_0x2de08d[_0x6d05('0x2b')],qs['fields'](_0x50ad57[_0x6d05('0x2c')][_0x6d05('0x30')]));_0x317bb8[_0x6d05('0x2f')]=_0x317bb8['attributes'][_0x6d05('0x31')]?_0x317bb8['attributes']:_0x2de08d['model'];if(_0x50ad57['query']['includeAll']){_0x317bb8[_0x6d05('0x3d')]=[{'all':!![]}];}_0x317bb8=_['merge']({},_0x317bb8,_0x50ad57[_0x6d05('0x3a')]);return db[_0x6d05('0x3b')]['find'](_0x317bb8)[_0x6d05('0x20')](handleEntityNotFound(_0x34530c,null))[_0x6d05('0x20')](respondWithResult(_0x34530c,null))[_0x6d05('0x43')](handleError(_0x34530c,null));};exports['create']=function(_0x36f74c,_0x2c93e7){return db['UserProfileResource'][_0x6d05('0x44')](_0x36f74c[_0x6d05('0x45')],{})[_0x6d05('0x20')](respondWithResult(_0x2c93e7,0xc9))[_0x6d05('0x43')](handleError(_0x2c93e7,null));};exports[_0x6d05('0x1f')]=function(_0x33df21,_0x24dac0){if(_0x33df21[_0x6d05('0x45')]['id']){delete _0x33df21[_0x6d05('0x45')]['id'];}return db[_0x6d05('0x3b')][_0x6d05('0x46')]({'where':{'id':_0x33df21[_0x6d05('0x41')]['id']}})[_0x6d05('0x20')](handleEntityNotFound(_0x24dac0,null))[_0x6d05('0x20')](saveUpdates(_0x33df21[_0x6d05('0x45')],null))[_0x6d05('0x20')](respondWithResult(_0x24dac0,null))[_0x6d05('0x43')](handleError(_0x24dac0,null));};exports[_0x6d05('0x21')]=function(_0x354fc4,_0x2458a1){return db[_0x6d05('0x3b')]['find']({'where':{'id':_0x354fc4[_0x6d05('0x41')]['id']}})['then'](handleEntityNotFound(_0x2458a1,null))[_0x6d05('0x20')](removeEntity(_0x2458a1,null))['catch'](handleError(_0x2458a1,null));};exports[_0x6d05('0x47')]=function(_0x4814f7,_0x531d23){return db[_0x6d05('0x3b')][_0x6d05('0x47')]()['then'](respondWithResult(_0x531d23,null))[_0x6d05('0x43')](handleError(_0x531d23,null));}; \ No newline at end of file +var _0x5c37=['set','Content-Range','json','reject','save','update','then','sendStatus','stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','type','VIRTUAL','options','UserProfileResource','includeAll','include','findAll','rows','catch','params','filtears','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','count','offset','limit'];(function(_0x12fb0e,_0x430744){var _0x13f8d3=function(_0x229c3b){while(--_0x229c3b){_0x12fb0e['push'](_0x12fb0e['shift']());}};_0x13f8d3(++_0x430744);}(_0x5c37,0x14e));var _0x75c3=function(_0x16e57d,_0x2cb7ba){_0x16e57d=_0x16e57d-0x0;var _0x40239c=_0x5c37[_0x16e57d];return _0x40239c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x75c3('0x0'));var rimraf=require(_0x75c3('0x1'));var zipdir=require(_0x75c3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x75c3('0x3'));var Mustache=require(_0x75c3('0x4'));var util=require('util');var path=require(_0x75c3('0x5'));var sox=require('sox');var csv=require(_0x75c3('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x75c3('0x7'));var squel=require(_0x75c3('0x8'));var crypto=require(_0x75c3('0x9'));var jsforce=require(_0x75c3('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x75c3('0x6'));var querystring=require(_0x75c3('0xb'));var Papa=require(_0x75c3('0xc'));var Redis=require(_0x75c3('0xd'));var authService=require(_0x75c3('0xe'));var qs=require(_0x75c3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x75c3('0x10'));var logger=require(_0x75c3('0x11'))(_0x75c3('0x12'));var utils=require('../../config/utils');var config=require(_0x75c3('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x75c3('0x14'))['db'];function respondWithStatusCode(_0x2ff709,_0x822447){_0x822447=_0x822447||0xcc;return function(_0x233318){if(_0x233318){return _0x2ff709['sendStatus'](_0x822447);}return _0x2ff709[_0x75c3('0x15')](_0x822447)[_0x75c3('0x16')]();};}function respondWithResult(_0x447b6b,_0x550351){_0x550351=_0x550351||0xc8;return function(_0x2b2bb9){if(_0x2b2bb9){return _0x447b6b['status'](_0x550351)['json'](_0x2b2bb9);}};}function respondWithFilteredResult(_0x19bb2e,_0x7ff199){return function(_0x15aa9d){if(_0x15aa9d){var _0x9108a5=_0x15aa9d[_0x75c3('0x17')],_0x23916a=_0x7ff199[_0x75c3('0x18')],_0x321a52=_0x7ff199[_0x75c3('0x18')]+_0x7ff199[_0x75c3('0x19')],_0x3f6b03;if(_0x321a52>=_0x9108a5){_0x321a52=_0x9108a5;_0x3f6b03=0xc8;}else{_0x3f6b03=0xce;}_0x19bb2e[_0x75c3('0x15')](_0x3f6b03);return _0x19bb2e[_0x75c3('0x1a')](_0x75c3('0x1b'),_0x23916a+'-'+_0x321a52+'/'+_0x9108a5)[_0x75c3('0x1c')](_0x15aa9d);}return null;};}function patchUpdates(_0x480324){return function(_0x1a71f1){try{jsonpatch['apply'](_0x1a71f1,_0x480324,!![]);}catch(_0x43c1a9){return BPromise[_0x75c3('0x1d')](_0x43c1a9);}return _0x1a71f1[_0x75c3('0x1e')]();};}function saveUpdates(_0x2426ac,_0x4cf18d){return function(_0x20c061){if(_0x20c061){return _0x20c061[_0x75c3('0x1f')](_0x2426ac)[_0x75c3('0x20')](function(_0x326ed9){return _0x326ed9;});}return null;};}function removeEntity(_0x3b8080,_0x4e88f1){return function(_0x28282f){if(_0x28282f){return _0x28282f['destroy']()['then'](function(){_0x3b8080[_0x75c3('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3616f6,_0x27ea6d){return function(_0x5e8be0){if(!_0x5e8be0){_0x3616f6[_0x75c3('0x21')](0x194);}return _0x5e8be0;};}function handleError(_0x307078,_0x468308){_0x468308=_0x468308||0x1f4;return function(_0x394258){logger['error'](_0x394258[_0x75c3('0x22')]);if(_0x394258[_0x75c3('0x23')]){delete _0x394258[_0x75c3('0x23')];}_0x307078[_0x75c3('0x15')](_0x468308)[_0x75c3('0x24')](_0x394258);};}exports[_0x75c3('0x25')]=function(_0x552815,_0x3a2872){var _0x1137c5={},_0x125b1b={},_0x3808f2={'count':0x0,'rows':[]};var _0x36d39d=_['map'](db['UserProfileResource'][_0x75c3('0x26')],function(_0x532f75){return{'name':_0x532f75[_0x75c3('0x27')],'type':_0x532f75['type'][_0x75c3('0x28')]};});_0x125b1b[_0x75c3('0x29')]=_['map'](_0x36d39d,_0x75c3('0x23'));_0x125b1b[_0x75c3('0x2a')]=_[_0x75c3('0x2b')](_0x552815['query']);_0x125b1b['filters']=_[_0x75c3('0x2c')](_0x125b1b['model'],_0x125b1b[_0x75c3('0x2a')]);_0x1137c5[_0x75c3('0x2d')]=_['intersection'](_0x125b1b[_0x75c3('0x29')],qs[_0x75c3('0x2e')](_0x552815[_0x75c3('0x2a')][_0x75c3('0x2e')]));_0x1137c5[_0x75c3('0x2d')]=_0x1137c5['attributes'][_0x75c3('0x2f')]?_0x1137c5[_0x75c3('0x2d')]:_0x125b1b[_0x75c3('0x29')];if(!_0x552815[_0x75c3('0x2a')][_0x75c3('0x30')](_0x75c3('0x31'))){_0x1137c5[_0x75c3('0x19')]=qs[_0x75c3('0x19')](_0x552815[_0x75c3('0x2a')][_0x75c3('0x19')]);_0x1137c5['offset']=qs['offset'](_0x552815[_0x75c3('0x2a')]['offset']);}_0x1137c5[_0x75c3('0x32')]=qs[_0x75c3('0x33')](_0x552815[_0x75c3('0x2a')][_0x75c3('0x33')]);_0x1137c5['where']=qs['filters'](_['pick'](_0x552815['query'],_0x125b1b['filters']),_0x36d39d);if(_0x552815['query'][_0x75c3('0x34')]){_0x1137c5[_0x75c3('0x35')]=_[_0x75c3('0x36')](_0x1137c5['where'],{'$or':_[_0x75c3('0x37')](_0x36d39d,function(_0x346edb){if(_0x346edb[_0x75c3('0x38')]!==_0x75c3('0x39')){var _0x9a7ed0={};_0x9a7ed0[_0x346edb[_0x75c3('0x23')]]={'$like':'%'+_0x552815[_0x75c3('0x2a')][_0x75c3('0x34')]+'%'};return _0x9a7ed0;}})});}_0x1137c5=_[_0x75c3('0x36')]({},_0x1137c5,_0x552815[_0x75c3('0x3a')]);var _0x100698={'where':_0x1137c5[_0x75c3('0x35')]};return db[_0x75c3('0x3b')][_0x75c3('0x17')](_0x100698)[_0x75c3('0x20')](function(_0x22729f){_0x3808f2[_0x75c3('0x17')]=_0x22729f;if(_0x552815[_0x75c3('0x2a')][_0x75c3('0x3c')]){_0x1137c5[_0x75c3('0x3d')]=[{'all':!![]}];}return db[_0x75c3('0x3b')][_0x75c3('0x3e')](_0x1137c5);})[_0x75c3('0x20')](function(_0x128622){_0x3808f2[_0x75c3('0x3f')]=_0x128622;return _0x3808f2;})[_0x75c3('0x20')](respondWithFilteredResult(_0x3a2872,_0x1137c5))[_0x75c3('0x40')](handleError(_0x3a2872,null));};exports['show']=function(_0x4905c9,_0x4eb91e){var _0x2c1c18={'raw':![],'where':{'id':_0x4905c9[_0x75c3('0x41')]['id']}},_0x56a6bb={};_0x56a6bb[_0x75c3('0x29')]=_['keys'](db['UserProfileResource']['rawAttributes']);_0x56a6bb['query']=_['keys'](_0x4905c9[_0x75c3('0x2a')]);_0x56a6bb[_0x75c3('0x42')]=_[_0x75c3('0x2c')](_0x56a6bb[_0x75c3('0x29')],_0x56a6bb[_0x75c3('0x2a')]);_0x2c1c18[_0x75c3('0x2d')]=_[_0x75c3('0x2c')](_0x56a6bb[_0x75c3('0x29')],qs[_0x75c3('0x2e')](_0x4905c9[_0x75c3('0x2a')][_0x75c3('0x2e')]));_0x2c1c18['attributes']=_0x2c1c18[_0x75c3('0x2d')][_0x75c3('0x2f')]?_0x2c1c18[_0x75c3('0x2d')]:_0x56a6bb[_0x75c3('0x29')];if(_0x4905c9['query']['includeAll']){_0x2c1c18[_0x75c3('0x3d')]=[{'all':!![]}];}_0x2c1c18=_['merge']({},_0x2c1c18,_0x4905c9[_0x75c3('0x3a')]);return db[_0x75c3('0x3b')][_0x75c3('0x43')](_0x2c1c18)[_0x75c3('0x20')](handleEntityNotFound(_0x4eb91e,null))[_0x75c3('0x20')](respondWithResult(_0x4eb91e,null))[_0x75c3('0x40')](handleError(_0x4eb91e,null));};exports['create']=function(_0x26f3da,_0x537ae2){return db['UserProfileResource'][_0x75c3('0x44')](_0x26f3da[_0x75c3('0x45')],{})[_0x75c3('0x20')](respondWithResult(_0x537ae2,0xc9))[_0x75c3('0x40')](handleError(_0x537ae2,null));};exports[_0x75c3('0x1f')]=function(_0x3a53d2,_0x253e39){if(_0x3a53d2[_0x75c3('0x45')]['id']){delete _0x3a53d2['body']['id'];}return db[_0x75c3('0x3b')][_0x75c3('0x43')]({'where':{'id':_0x3a53d2[_0x75c3('0x41')]['id']}})[_0x75c3('0x20')](handleEntityNotFound(_0x253e39,null))[_0x75c3('0x20')](saveUpdates(_0x3a53d2[_0x75c3('0x45')],null))[_0x75c3('0x20')](respondWithResult(_0x253e39,null))[_0x75c3('0x40')](handleError(_0x253e39,null));};exports[_0x75c3('0x46')]=function(_0x4e5c99,_0x43d7a5){return db[_0x75c3('0x3b')][_0x75c3('0x43')]({'where':{'id':_0x4e5c99[_0x75c3('0x41')]['id']}})['then'](handleEntityNotFound(_0x43d7a5,null))[_0x75c3('0x20')](removeEntity(_0x43d7a5,null))[_0x75c3('0x40')](handleError(_0x43d7a5,null));};exports[_0x75c3('0x47')]=function(_0x5126e5,_0x5d7169){return db[_0x75c3('0x3b')]['describe']()[_0x75c3('0x20')](respondWithResult(_0x5d7169,null))[_0x75c3('0x40')](handleError(_0x5d7169,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 69d45a8..1c2b30d 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 _0x02df=['resourceId','sectionId','util','api','moment','bluebird','path','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex'];(function(_0x5b3cbf,_0x5b3cf2){var _0x4e1aba=function(_0x5600e1){while(--_0x5600e1){_0x5b3cbf['push'](_0x5b3cbf['shift']());}};_0x4e1aba(++_0x5b3cf2);}(_0x02df,0xaa));var _0xf02d=function(_0x28e2cf,_0xc2d7ee){_0x28e2cf=_0x28e2cf-0x0;var _0x1b9b44=_0x02df[_0x28e2cf];return _0x1b9b44;};'use strict';var _=require('lodash');var util=require(_0xf02d('0x0'));var logger=require('../../config/logger')(_0xf02d('0x1'));var moment=require(_0xf02d('0x2'));var BPromise=require(_0xf02d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf02d('0x4'));var rimraf=require('rimraf');var config=require(_0xf02d('0x5'));var attributes=require(_0xf02d('0x6'));module[_0xf02d('0x7')]=function(_0x35b72e,_0x6d98e8){return _0x35b72e[_0xf02d('0x8')](_0xf02d('0x9'),attributes,{'tableName':_0xf02d('0xa'),'paranoid':![],'indexes':[{'name':_0xf02d('0xb'),'fields':[_0xf02d('0xc'),_0xf02d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f90=['rimraf','exports','define','UserProfileResource','compositeIndex','lodash','util','api','bluebird','request-promise','path'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x9f90,0x144));var _0x09f9=function(_0x1ed986,_0x3a077b){_0x1ed986=_0x1ed986-0x0;var _0x2705b3=_0x9f90[_0x1ed986];return _0x2705b3;};'use strict';var _=require(_0x09f9('0x0'));var util=require(_0x09f9('0x1'));var logger=require('../../config/logger')(_0x09f9('0x2'));var moment=require('moment');var BPromise=require(_0x09f9('0x3'));var rp=require(_0x09f9('0x4'));var fs=require('fs');var path=require(_0x09f9('0x5'));var rimraf=require(_0x09f9('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0x09f9('0x7')]=function(_0x4394cd,_0x20917d){return _0x4394cd[_0x09f9('0x8')](_0x09f9('0x9'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x09f9('0xa'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 7ec4e72..a957bae 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 _0x8cb9=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x450e9c,_0x5bebe5){var _0x5dfe79=function(_0x32eb53){while(--_0x32eb53){_0x450e9c['push'](_0x450e9c['shift']());}};_0x5dfe79(++_0x5bebe5);}(_0x8cb9,0x175));var _0x98cb=function(_0x193b2a,_0x4ff6c0){_0x193b2a=_0x193b2a-0x0;var _0x3bfb09=_0x8cb9[_0x193b2a];return _0x3bfb09;};'use strict';var _=require(_0x98cb('0x0'));var util=require(_0x98cb('0x1'));var moment=require(_0x98cb('0x2'));var BPromise=require(_0x98cb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98cb('0x4'));var db=require(_0x98cb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x98cb('0x6'))(_0x98cb('0x7'));var config=require(_0x98cb('0x8'));var jayson=require(_0x98cb('0x9'));var client=jayson['client'][_0x98cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32e013,_0x4460ba,_0x51d520){return new BPromise(function(_0x3aa7c2,_0x18fd04){return client[_0x98cb('0xb')](_0x32e013,_0x51d520)['then'](function(_0x282605){logger[_0x98cb('0xc')](_0x98cb('0xd'),_0x4460ba,_0x98cb('0xe'));logger[_0x98cb('0xf')](_0x98cb('0x10'),_0x4460ba,'request\x20sent',JSON[_0x98cb('0x11')](_0x282605));if(_0x282605[_0x98cb('0x12')]){if(_0x282605[_0x98cb('0x12')]['code']===0x1f4){logger[_0x98cb('0x12')](_0x98cb('0xd'),_0x4460ba,_0x282605[_0x98cb('0x12')]['message']);return _0x18fd04(_0x282605['error']['message']);}logger[_0x98cb('0x12')](_0x98cb('0xd'),_0x4460ba,_0x282605[_0x98cb('0x12')][_0x98cb('0x13')]);return _0x3aa7c2(_0x282605['error']['message']);}else{logger[_0x98cb('0xc')](_0x98cb('0xd'),_0x4460ba,'request\x20sent');_0x3aa7c2(_0x282605[_0x98cb('0x14')][_0x98cb('0x13')]);}})[_0x98cb('0x15')](function(_0x3e0ed3){logger[_0x98cb('0x12')](_0x98cb('0xd'),_0x4460ba,_0x3e0ed3);_0x18fd04(_0x3e0ed3);});});} \ No newline at end of file +var _0xe394=['code','message','catch','lodash','util','moment','randomstring','../../config/logger','../../config/environment','jayson/promise','client','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2ec2bf,_0x64e983){var _0x2c279c=function(_0x41fe42){while(--_0x41fe42){_0x2ec2bf['push'](_0x2ec2bf['shift']());}};_0x2c279c(++_0x64e983);}(_0xe394,0x192));var _0x4e39=function(_0x2f181e,_0x3e55ed){_0x2f181e=_0x2f181e-0x0;var _0x2a2b88=_0xe394[_0x2f181e];return _0x2a2b88;};'use strict';var _=require(_0x4e39('0x0'));var util=require(_0x4e39('0x1'));var moment=require(_0x4e39('0x2'));var BPromise=require('bluebird');var rs=require(_0x4e39('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4e39('0x4'))('rpc');var config=require(_0x4e39('0x5'));var jayson=require(_0x4e39('0x6'));var client=jayson[_0x4e39('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbc5438,_0x2b95d9,_0x9713d4){return new BPromise(function(_0x3d2e7d,_0x4cc54f){return client[_0x4e39('0x8')](_0xbc5438,_0x9713d4)['then'](function(_0x2f57de){logger[_0x4e39('0x9')](_0x4e39('0xa'),_0x2b95d9,_0x4e39('0xb'));logger[_0x4e39('0xc')](_0x4e39('0xd'),_0x2b95d9,_0x4e39('0xb'),JSON[_0x4e39('0xe')](_0x2f57de));if(_0x2f57de[_0x4e39('0xf')]){if(_0x2f57de['error'][_0x4e39('0x10')]===0x1f4){logger['error'](_0x4e39('0xa'),_0x2b95d9,_0x2f57de[_0x4e39('0xf')][_0x4e39('0x11')]);return _0x4cc54f(_0x2f57de[_0x4e39('0xf')][_0x4e39('0x11')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x2b95d9,_0x2f57de[_0x4e39('0xf')][_0x4e39('0x11')]);return _0x3d2e7d(_0x2f57de['error'][_0x4e39('0x11')]);}else{logger[_0x4e39('0x9')]('UserProfileResource,\x20%s,\x20%s',_0x2b95d9,_0x4e39('0xb'));_0x3d2e7d(_0x2f57de['result'][_0x4e39('0x11')]);}})[_0x4e39('0x12')](function(_0x2a9435){logger['error'](_0x4e39('0xa'),_0x2b95d9,_0x2a9435);_0x4cc54f(_0x2a9435);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 3a2e152..18df981 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 _0xf3bb=['./userProfileSection.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x59b2a1,_0x1f631f){var _0x4908d1=function(_0x14c9b8){while(--_0x14c9b8){_0x59b2a1['push'](_0x59b2a1['shift']());}};_0x4908d1(++_0x1f631f);}(_0xf3bb,0x1e0));var _0xbf3b=function(_0xb17419,_0x435b7d){_0xb17419=_0xb17419-0x0;var _0x39dbc8=_0xf3bb[_0xb17419];return _0x39dbc8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbf3b('0x0'));var timeout=require(_0xbf3b('0x1'));var express=require(_0xbf3b('0x2'));var router=express[_0xbf3b('0x3')]();var auth=require(_0xbf3b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbf3b('0x5'));var controller=require(_0xbf3b('0x6'));router[_0xbf3b('0x7')]('/',auth[_0xbf3b('0x8')](),controller[_0xbf3b('0x9')]);router[_0xbf3b('0x7')](_0xbf3b('0xa'),auth[_0xbf3b('0x8')](),controller['describe']);router[_0xbf3b('0x7')]('/:id',auth[_0xbf3b('0x8')](),controller[_0xbf3b('0xb')]);router[_0xbf3b('0xc')]('/',auth[_0xbf3b('0x8')](),controller[_0xbf3b('0xd')]);router[_0xbf3b('0xe')](_0xbf3b('0xf'),auth[_0xbf3b('0x8')](),controller['update']);router[_0xbf3b('0x10')](_0xbf3b('0xf'),auth['isAuthenticated'](),controller[_0xbf3b('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5f96=['isAuthenticated','/describe','describe','/:id','show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get'];(function(_0x2bba73,_0x82bb5d){var _0x19870b=function(_0x404d5f){while(--_0x404d5f){_0x2bba73['push'](_0x2bba73['shift']());}};_0x19870b(++_0x82bb5d);}(_0x5f96,0x75));var _0x65f9=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x5f96[_0x819464];return _0x49dcc0;};'use strict';var multer=require(_0x65f9('0x0'));var util=require(_0x65f9('0x1'));var path=require(_0x65f9('0x2'));var timeout=require(_0x65f9('0x3'));var express=require(_0x65f9('0x4'));var router=express[_0x65f9('0x5')]();var auth=require(_0x65f9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x65f9('0x7'));var controller=require('./userProfileSection.controller');router[_0x65f9('0x8')]('/',auth[_0x65f9('0x9')](),controller['index']);router[_0x65f9('0x8')](_0x65f9('0xa'),auth['isAuthenticated'](),controller[_0x65f9('0xb')]);router[_0x65f9('0x8')](_0x65f9('0xc'),auth[_0x65f9('0x9')](),controller[_0x65f9('0xd')]);router[_0x65f9('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x65f9('0xf')](_0x65f9('0xc'),auth[_0x65f9('0x9')](),controller[_0x65f9('0x10')]);router['delete'](_0x65f9('0xc'),auth['isAuthenticated'](),controller[_0x65f9('0x11')]);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 681044d..2dbe415 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 _0xbc82=['STRING','crudPermissions','split','sequelize','INTEGER'];(function(_0x5234a8,_0x849aff){var _0x126b38=function(_0x19684c){while(--_0x19684c){_0x5234a8['push'](_0x5234a8['shift']());}};_0x126b38(++_0x849aff);}(_0xbc82,0x13e));var _0x2bc8=function(_0xbbb526,_0x12c481){_0xbbb526=_0xbbb526-0x0;var _0xfc7a45=_0xbc82[_0xbbb526];return _0xfc7a45;};'use strict';var Sequelize=require(_0x2bc8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x2bc8('0x1')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x2bc8('0x2')],'set':function(_0x5c8329){this['setDataValue'](_0x2bc8('0x3'),_0x5c8329?_0x5c8329['join'](''):[]);},'get':function(){return this['getDataValue'](_0x2bc8('0x3'))?this['getDataValue']('crudPermissions')[_0x2bc8('0x4')](''):[];}}}; \ No newline at end of file +var _0x383d=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','STRING','INTEGER'];(function(_0x5a3e91,_0x132342){var _0x3fda34=function(_0x318ee7){while(--_0x318ee7){_0x5a3e91['push'](_0x5a3e91['shift']());}};_0x3fda34(++_0x132342);}(_0x383d,0x86));var _0xd383=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x383d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd383('0x0')],'allowNull':![]},'category':{'type':Sequelize[_0xd383('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd383('0x1')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd383('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd383('0x0')],'set':function(_0x319f67){this[_0xd383('0x3')](_0xd383('0x4'),_0x319f67?_0x319f67[_0xd383('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xd383('0x4'))?this[_0xd383('0x6')](_0xd383('0x4'))[_0xd383('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index b3b3446..644abac 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 _0x4c9a=['fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','filtears','options','find','create','update','body','describe','html-pdf','rimraf','zip-dir','request-promise','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','json','count','offset','limit','status','set','Content-Range','apply','save','then','destroy','end','sendStatus','error','stack','name','index','map','UserProfileSection','fieldName','type','key','model','query','filters','intersection','attributes'];(function(_0x38f4c0,_0x3ba083){var _0x19d4be=function(_0x1e7ee3){while(--_0x1e7ee3){_0x38f4c0['push'](_0x38f4c0['shift']());}};_0x19d4be(++_0x3ba083);}(_0x4c9a,0x181));var _0xa4c9=function(_0x3c7914,_0x2fba5c){_0x3c7914=_0x3c7914-0x0;var _0x2451ed=_0x4c9a[_0x3c7914];return _0x2451ed;};'use strict';var pdf=require(_0xa4c9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa4c9('0x1'));var zipdir=require(_0xa4c9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa4c9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa4c9('0x4'));var csv=require(_0xa4c9('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa4c9('0x6'));var squel=require(_0xa4c9('0x7'));var crypto=require('crypto');var jsforce=require(_0xa4c9('0x8'));var deskjs=require(_0xa4c9('0x9'));var toCsv=require(_0xa4c9('0x5'));var querystring=require(_0xa4c9('0xa'));var Papa=require('papaparse');var Redis=require(_0xa4c9('0xb'));var authService=require(_0xa4c9('0xc'));var qs=require(_0xa4c9('0xd'));var as=require(_0xa4c9('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa4c9('0xf'))(_0xa4c9('0x10'));var utils=require(_0xa4c9('0x11'));var config=require(_0xa4c9('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xa4c9('0x13'))['db'];function respondWithStatusCode(_0x296c4d,_0x53d6c6){_0x53d6c6=_0x53d6c6||0xcc;return function(_0x87eb53){if(_0x87eb53){return _0x296c4d['sendStatus'](_0x53d6c6);}return _0x296c4d['status'](_0x53d6c6)['end']();};}function respondWithResult(_0x4ea6dd,_0x164765){_0x164765=_0x164765||0xc8;return function(_0x35b0c0){if(_0x35b0c0){return _0x4ea6dd['status'](_0x164765)[_0xa4c9('0x14')](_0x35b0c0);}};}function respondWithFilteredResult(_0x3d8f75,_0x1f046b){return function(_0x479beb){if(_0x479beb){var _0x1ebf6d=_0x479beb[_0xa4c9('0x15')],_0x43073f=_0x1f046b[_0xa4c9('0x16')],_0x32df09=_0x1f046b[_0xa4c9('0x16')]+_0x1f046b[_0xa4c9('0x17')],_0x16ed93;if(_0x32df09>=_0x1ebf6d){_0x32df09=_0x1ebf6d;_0x16ed93=0xc8;}else{_0x16ed93=0xce;}_0x3d8f75[_0xa4c9('0x18')](_0x16ed93);return _0x3d8f75[_0xa4c9('0x19')](_0xa4c9('0x1a'),_0x43073f+'-'+_0x32df09+'/'+_0x1ebf6d)[_0xa4c9('0x14')](_0x479beb);}return null;};}function patchUpdates(_0x4e8719){return function(_0x57b30a){try{jsonpatch[_0xa4c9('0x1b')](_0x57b30a,_0x4e8719,!![]);}catch(_0x5a09c9){return BPromise['reject'](_0x5a09c9);}return _0x57b30a[_0xa4c9('0x1c')]();};}function saveUpdates(_0x5b04f2,_0xb330c8){return function(_0x4ff4dd){if(_0x4ff4dd){return _0x4ff4dd['update'](_0x5b04f2)[_0xa4c9('0x1d')](function(_0x93af4f){return _0x93af4f;});}return null;};}function removeEntity(_0x37f37c,_0x14351d){return function(_0x2af573){if(_0x2af573){return _0x2af573[_0xa4c9('0x1e')]()[_0xa4c9('0x1d')](function(){_0x37f37c[_0xa4c9('0x18')](0xcc)[_0xa4c9('0x1f')]();});}};}function handleEntityNotFound(_0x5748ed,_0x5ed757){return function(_0x490473){if(!_0x490473){_0x5748ed[_0xa4c9('0x20')](0x194);}return _0x490473;};}function handleError(_0x385f1f,_0x40db49){_0x40db49=_0x40db49||0x1f4;return function(_0x3dc466){logger[_0xa4c9('0x21')](_0x3dc466[_0xa4c9('0x22')]);if(_0x3dc466[_0xa4c9('0x23')]){delete _0x3dc466[_0xa4c9('0x23')];}_0x385f1f[_0xa4c9('0x18')](_0x40db49)['send'](_0x3dc466);};}exports[_0xa4c9('0x24')]=function(_0xc7adb5,_0xefbad7){var _0x1a001a={},_0x1a135d={},_0x2db1a6={'count':0x0,'rows':[]};var _0x10469b=_[_0xa4c9('0x25')](db[_0xa4c9('0x26')]['rawAttributes'],function(_0x47da1f){return{'name':_0x47da1f[_0xa4c9('0x27')],'type':_0x47da1f[_0xa4c9('0x28')][_0xa4c9('0x29')]};});_0x1a135d[_0xa4c9('0x2a')]=_[_0xa4c9('0x25')](_0x10469b,'name');_0x1a135d[_0xa4c9('0x2b')]=_['keys'](_0xc7adb5[_0xa4c9('0x2b')]);_0x1a135d[_0xa4c9('0x2c')]=_[_0xa4c9('0x2d')](_0x1a135d[_0xa4c9('0x2a')],_0x1a135d[_0xa4c9('0x2b')]);_0x1a001a[_0xa4c9('0x2e')]=_['intersection'](_0x1a135d[_0xa4c9('0x2a')],qs['fields'](_0xc7adb5[_0xa4c9('0x2b')][_0xa4c9('0x2f')]));_0x1a001a[_0xa4c9('0x2e')]=_0x1a001a[_0xa4c9('0x2e')][_0xa4c9('0x30')]?_0x1a001a['attributes']:_0x1a135d['model'];if(!_0xc7adb5[_0xa4c9('0x2b')]['hasOwnProperty'](_0xa4c9('0x31'))){_0x1a001a[_0xa4c9('0x17')]=qs[_0xa4c9('0x17')](_0xc7adb5['query'][_0xa4c9('0x17')]);_0x1a001a[_0xa4c9('0x16')]=qs['offset'](_0xc7adb5[_0xa4c9('0x2b')][_0xa4c9('0x16')]);}_0x1a001a['order']=qs[_0xa4c9('0x32')](_0xc7adb5[_0xa4c9('0x2b')][_0xa4c9('0x32')]);_0x1a001a[_0xa4c9('0x33')]=qs[_0xa4c9('0x2c')](_[_0xa4c9('0x34')](_0xc7adb5[_0xa4c9('0x2b')],_0x1a135d[_0xa4c9('0x2c')]),_0x10469b);if(_0xc7adb5[_0xa4c9('0x2b')][_0xa4c9('0x35')]){_0x1a001a[_0xa4c9('0x33')]=_[_0xa4c9('0x36')](_0x1a001a[_0xa4c9('0x33')],{'$or':_[_0xa4c9('0x25')](_0x10469b,function(_0x49b6bc){if(_0x49b6bc[_0xa4c9('0x28')]!==_0xa4c9('0x37')){var _0x5f483a={};_0x5f483a[_0x49b6bc[_0xa4c9('0x23')]]={'$like':'%'+_0xc7adb5[_0xa4c9('0x2b')][_0xa4c9('0x35')]+'%'};return _0x5f483a;}})});}_0x1a001a=_['merge']({},_0x1a001a,_0xc7adb5['options']);var _0x56b99e={'where':_0x1a001a[_0xa4c9('0x33')]};return db['UserProfileSection'][_0xa4c9('0x15')](_0x56b99e)['then'](function(_0x1b4f1e){_0x2db1a6[_0xa4c9('0x15')]=_0x1b4f1e;if(_0xc7adb5[_0xa4c9('0x2b')][_0xa4c9('0x38')]){_0x1a001a[_0xa4c9('0x39')]=[{'all':!![]}];}return db[_0xa4c9('0x26')][_0xa4c9('0x3a')](_0x1a001a);})[_0xa4c9('0x1d')](function(_0x4abd33){_0x2db1a6[_0xa4c9('0x3b')]=_0x4abd33;return _0x2db1a6;})['then'](respondWithFilteredResult(_0xefbad7,_0x1a001a))[_0xa4c9('0x3c')](handleError(_0xefbad7,null));};exports[_0xa4c9('0x3d')]=function(_0x7bdf3,_0x54204a){var _0x57a21d={'raw':![],'where':{'id':_0x7bdf3[_0xa4c9('0x3e')]['id']}},_0x5444ca={};_0x5444ca[_0xa4c9('0x2a')]=_[_0xa4c9('0x3f')](db[_0xa4c9('0x26')][_0xa4c9('0x40')]);_0x5444ca['query']=_[_0xa4c9('0x3f')](_0x7bdf3[_0xa4c9('0x2b')]);_0x5444ca[_0xa4c9('0x41')]=_[_0xa4c9('0x2d')](_0x5444ca[_0xa4c9('0x2a')],_0x5444ca[_0xa4c9('0x2b')]);_0x57a21d[_0xa4c9('0x2e')]=_['intersection'](_0x5444ca[_0xa4c9('0x2a')],qs[_0xa4c9('0x2f')](_0x7bdf3[_0xa4c9('0x2b')]['fields']));_0x57a21d[_0xa4c9('0x2e')]=_0x57a21d[_0xa4c9('0x2e')]['length']?_0x57a21d[_0xa4c9('0x2e')]:_0x5444ca[_0xa4c9('0x2a')];if(_0x7bdf3[_0xa4c9('0x2b')][_0xa4c9('0x38')]){_0x57a21d[_0xa4c9('0x39')]=[{'all':!![]}];}_0x57a21d=_[_0xa4c9('0x36')]({},_0x57a21d,_0x7bdf3[_0xa4c9('0x42')]);return db['UserProfileSection'][_0xa4c9('0x43')](_0x57a21d)[_0xa4c9('0x1d')](handleEntityNotFound(_0x54204a,null))[_0xa4c9('0x1d')](respondWithResult(_0x54204a,null))['catch'](handleError(_0x54204a,null));};exports[_0xa4c9('0x44')]=function(_0x2dc3c9,_0xcb7a09){return db[_0xa4c9('0x26')][_0xa4c9('0x44')](_0x2dc3c9['body'],{})[_0xa4c9('0x1d')](respondWithResult(_0xcb7a09,0xc9))[_0xa4c9('0x3c')](handleError(_0xcb7a09,null));};exports[_0xa4c9('0x45')]=function(_0x59d82b,_0x4a04bb){if(_0x59d82b['body']['id']){delete _0x59d82b[_0xa4c9('0x46')]['id'];}return db[_0xa4c9('0x26')][_0xa4c9('0x43')]({'where':{'id':_0x59d82b[_0xa4c9('0x3e')]['id']}})[_0xa4c9('0x1d')](handleEntityNotFound(_0x4a04bb,null))[_0xa4c9('0x1d')](saveUpdates(_0x59d82b[_0xa4c9('0x46')],null))[_0xa4c9('0x1d')](respondWithResult(_0x4a04bb,null))[_0xa4c9('0x3c')](handleError(_0x4a04bb,null));};exports[_0xa4c9('0x1e')]=function(_0x3e9e90,_0x1e6db7){return db[_0xa4c9('0x26')][_0xa4c9('0x43')]({'where':{'id':_0x3e9e90[_0xa4c9('0x3e')]['id']}})[_0xa4c9('0x1d')](handleEntityNotFound(_0x1e6db7,null))['then'](removeEntity(_0x1e6db7,null))['catch'](handleError(_0x1e6db7,null));};exports[_0xa4c9('0x47')]=function(_0x422ee0,_0x341e7a){return db[_0xa4c9('0x26')][_0xa4c9('0x47')]()[_0xa4c9('0x1d')](respondWithResult(_0x341e7a,null))[_0xa4c9('0x3c')](handleError(_0x341e7a,null));}; \ No newline at end of file +var _0xc320=['count','includeAll','findAll','rows','catch','show','params','keys','filtears','options','find','create','body','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','UserProfileSection'];(function(_0x5e1254,_0x586fd0){var _0x409e7e=function(_0x18c9b4){while(--_0x18c9b4){_0x5e1254['push'](_0x5e1254['shift']());}};_0x409e7e(++_0x586fd0);}(_0xc320,0xa1));var _0x0c32=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xc320[_0x231e16];return _0x570a7c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x0c32('0x0'));var zipdir=require(_0x0c32('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0c32('0x2'));var BPromise=require(_0x0c32('0x3'));var Mustache=require(_0x0c32('0x4'));var util=require('util');var path=require(_0x0c32('0x5'));var sox=require(_0x0c32('0x6'));var csv=require(_0x0c32('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0c32('0x8'));var squel=require(_0x0c32('0x9'));var crypto=require(_0x0c32('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0c32('0x7'));var querystring=require(_0x0c32('0xb'));var Papa=require(_0x0c32('0xc'));var Redis=require(_0x0c32('0xd'));var authService=require(_0x0c32('0xe'));var qs=require(_0x0c32('0xf'));var as=require(_0x0c32('0x10'));var hardwareService=require(_0x0c32('0x11'));var logger=require('../../config/logger')(_0x0c32('0x12'));var utils=require(_0x0c32('0x13'));var config=require(_0x0c32('0x14'));var licenseUtil=require(_0x0c32('0x15'));var db=require(_0x0c32('0x16'))['db'];function respondWithStatusCode(_0x5dfe46,_0x5f4afc){_0x5f4afc=_0x5f4afc||0xcc;return function(_0x263629){if(_0x263629){return _0x5dfe46['sendStatus'](_0x5f4afc);}return _0x5dfe46['status'](_0x5f4afc)[_0x0c32('0x17')]();};}function respondWithResult(_0x4d6650,_0x21b403){_0x21b403=_0x21b403||0xc8;return function(_0x2f460c){if(_0x2f460c){return _0x4d6650[_0x0c32('0x18')](_0x21b403)[_0x0c32('0x19')](_0x2f460c);}};}function respondWithFilteredResult(_0x2ac97d,_0x1dbb65){return function(_0x2e0742){if(_0x2e0742){var _0x44df68=_0x2e0742['count'],_0x4efc33=_0x1dbb65[_0x0c32('0x1a')],_0x579897=_0x1dbb65[_0x0c32('0x1a')]+_0x1dbb65['limit'],_0x26efc9;if(_0x579897>=_0x44df68){_0x579897=_0x44df68;_0x26efc9=0xc8;}else{_0x26efc9=0xce;}_0x2ac97d[_0x0c32('0x18')](_0x26efc9);return _0x2ac97d[_0x0c32('0x1b')](_0x0c32('0x1c'),_0x4efc33+'-'+_0x579897+'/'+_0x44df68)[_0x0c32('0x19')](_0x2e0742);}return null;};}function patchUpdates(_0x3fd315){return function(_0x2dae32){try{jsonpatch[_0x0c32('0x1d')](_0x2dae32,_0x3fd315,!![]);}catch(_0x42aa21){return BPromise[_0x0c32('0x1e')](_0x42aa21);}return _0x2dae32[_0x0c32('0x1f')]();};}function saveUpdates(_0x32640,_0xf79a45){return function(_0x304198){if(_0x304198){return _0x304198[_0x0c32('0x20')](_0x32640)[_0x0c32('0x21')](function(_0x51b436){return _0x51b436;});}return null;};}function removeEntity(_0x110a68,_0x5a3162){return function(_0x5c4988){if(_0x5c4988){return _0x5c4988[_0x0c32('0x22')]()[_0x0c32('0x21')](function(){_0x110a68[_0x0c32('0x18')](0xcc)[_0x0c32('0x17')]();});}};}function handleEntityNotFound(_0x46824e,_0x11d319){return function(_0x432049){if(!_0x432049){_0x46824e[_0x0c32('0x23')](0x194);}return _0x432049;};}function handleError(_0x440ec6,_0x2d09ee){_0x2d09ee=_0x2d09ee||0x1f4;return function(_0xb861d3){logger[_0x0c32('0x24')](_0xb861d3[_0x0c32('0x25')]);if(_0xb861d3['name']){delete _0xb861d3[_0x0c32('0x26')];}_0x440ec6[_0x0c32('0x18')](_0x2d09ee)[_0x0c32('0x27')](_0xb861d3);};}exports['index']=function(_0x36da69,_0x969250){var _0x36056a={},_0x5c013a={},_0x3cb14e={'count':0x0,'rows':[]};var _0x10eaed=_[_0x0c32('0x28')](db['UserProfileSection'][_0x0c32('0x29')],function(_0x57040d){return{'name':_0x57040d['fieldName'],'type':_0x57040d['type']['key']};});_0x5c013a['model']=_[_0x0c32('0x28')](_0x10eaed,_0x0c32('0x26'));_0x5c013a[_0x0c32('0x2a')]=_['keys'](_0x36da69[_0x0c32('0x2a')]);_0x5c013a['filters']=_[_0x0c32('0x2b')](_0x5c013a[_0x0c32('0x2c')],_0x5c013a[_0x0c32('0x2a')]);_0x36056a[_0x0c32('0x2d')]=_[_0x0c32('0x2b')](_0x5c013a[_0x0c32('0x2c')],qs[_0x0c32('0x2e')](_0x36da69[_0x0c32('0x2a')]['fields']));_0x36056a[_0x0c32('0x2d')]=_0x36056a[_0x0c32('0x2d')][_0x0c32('0x2f')]?_0x36056a['attributes']:_0x5c013a[_0x0c32('0x2c')];if(!_0x36da69['query'][_0x0c32('0x30')](_0x0c32('0x31'))){_0x36056a[_0x0c32('0x32')]=qs[_0x0c32('0x32')](_0x36da69[_0x0c32('0x2a')][_0x0c32('0x32')]);_0x36056a[_0x0c32('0x1a')]=qs[_0x0c32('0x1a')](_0x36da69[_0x0c32('0x2a')][_0x0c32('0x1a')]);}_0x36056a[_0x0c32('0x33')]=qs[_0x0c32('0x34')](_0x36da69[_0x0c32('0x2a')]['sort']);_0x36056a[_0x0c32('0x35')]=qs[_0x0c32('0x36')](_[_0x0c32('0x37')](_0x36da69[_0x0c32('0x2a')],_0x5c013a[_0x0c32('0x36')]),_0x10eaed);if(_0x36da69['query'][_0x0c32('0x38')]){_0x36056a[_0x0c32('0x35')]=_[_0x0c32('0x39')](_0x36056a['where'],{'$or':_['map'](_0x10eaed,function(_0x8af0d5){if(_0x8af0d5[_0x0c32('0x3a')]!==_0x0c32('0x3b')){var _0x2613ae={};_0x2613ae[_0x8af0d5[_0x0c32('0x26')]]={'$like':'%'+_0x36da69['query'][_0x0c32('0x38')]+'%'};return _0x2613ae;}})});}_0x36056a=_['merge']({},_0x36056a,_0x36da69['options']);var _0x31b4e4={'where':_0x36056a['where']};return db[_0x0c32('0x3c')][_0x0c32('0x3d')](_0x31b4e4)[_0x0c32('0x21')](function(_0x16fdeb){_0x3cb14e['count']=_0x16fdeb;if(_0x36da69['query'][_0x0c32('0x3e')]){_0x36056a['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x0c32('0x3f')](_0x36056a);})['then'](function(_0x53bae3){_0x3cb14e[_0x0c32('0x40')]=_0x53bae3;return _0x3cb14e;})['then'](respondWithFilteredResult(_0x969250,_0x36056a))[_0x0c32('0x41')](handleError(_0x969250,null));};exports[_0x0c32('0x42')]=function(_0x26af27,_0x5187f2){var _0x275e78={'raw':![],'where':{'id':_0x26af27[_0x0c32('0x43')]['id']}},_0x4ce377={};_0x4ce377[_0x0c32('0x2c')]=_['keys'](db[_0x0c32('0x3c')][_0x0c32('0x29')]);_0x4ce377[_0x0c32('0x2a')]=_[_0x0c32('0x44')](_0x26af27[_0x0c32('0x2a')]);_0x4ce377[_0x0c32('0x45')]=_['intersection'](_0x4ce377[_0x0c32('0x2c')],_0x4ce377[_0x0c32('0x2a')]);_0x275e78[_0x0c32('0x2d')]=_[_0x0c32('0x2b')](_0x4ce377[_0x0c32('0x2c')],qs['fields'](_0x26af27['query']['fields']));_0x275e78['attributes']=_0x275e78[_0x0c32('0x2d')][_0x0c32('0x2f')]?_0x275e78['attributes']:_0x4ce377['model'];if(_0x26af27[_0x0c32('0x2a')]['includeAll']){_0x275e78['include']=[{'all':!![]}];}_0x275e78=_[_0x0c32('0x39')]({},_0x275e78,_0x26af27[_0x0c32('0x46')]);return db[_0x0c32('0x3c')][_0x0c32('0x47')](_0x275e78)[_0x0c32('0x21')](handleEntityNotFound(_0x5187f2,null))[_0x0c32('0x21')](respondWithResult(_0x5187f2,null))[_0x0c32('0x41')](handleError(_0x5187f2,null));};exports[_0x0c32('0x48')]=function(_0x1f18a3,_0x4988c5){return db[_0x0c32('0x3c')][_0x0c32('0x48')](_0x1f18a3[_0x0c32('0x49')],{})[_0x0c32('0x21')](respondWithResult(_0x4988c5,0xc9))['catch'](handleError(_0x4988c5,null));};exports[_0x0c32('0x20')]=function(_0x5cb0ed,_0x31f551){if(_0x5cb0ed[_0x0c32('0x49')]['id']){delete _0x5cb0ed[_0x0c32('0x49')]['id'];}return db['UserProfileSection'][_0x0c32('0x47')]({'where':{'id':_0x5cb0ed[_0x0c32('0x43')]['id']}})[_0x0c32('0x21')](handleEntityNotFound(_0x31f551,null))[_0x0c32('0x21')](saveUpdates(_0x5cb0ed[_0x0c32('0x49')],null))['then'](respondWithResult(_0x31f551,null))['catch'](handleError(_0x31f551,null));};exports[_0x0c32('0x22')]=function(_0x203ea6,_0x14c0fb){return db['UserProfileSection'][_0x0c32('0x47')]({'where':{'id':_0x203ea6[_0x0c32('0x43')]['id']}})[_0x0c32('0x21')](handleEntityNotFound(_0x14c0fb,null))[_0x0c32('0x21')](removeEntity(_0x14c0fb,null))[_0x0c32('0x41')](handleError(_0x14c0fb,null));};exports['describe']=function(_0x1fe190,_0x356061){return db[_0x0c32('0x3c')]['describe']()[_0x0c32('0x21')](respondWithResult(_0x356061,null))['catch'](handleError(_0x356061,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index ccd5df9..231a681 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 _0xdc32=['exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x3bc88a,_0x13d7ad){var _0x19aac7=function(_0x4f8a21){while(--_0x4f8a21){_0x3bc88a['push'](_0x3bc88a['shift']());}};_0x19aac7(++_0x13d7ad);}(_0xdc32,0x149));var _0x2dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc32[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2dc3('0x0'));var util=require(_0x2dc3('0x1'));var logger=require('../../config/logger')(_0x2dc3('0x2'));var moment=require(_0x2dc3('0x3'));var BPromise=require(_0x2dc3('0x4'));var rp=require(_0x2dc3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2dc3('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0x2dc3('0x7')]=function(_0x319357,_0x42ed74){return _0x319357[_0x2dc3('0x8')](_0x2dc3('0x9'),attributes,{'tableName':_0x2dc3('0xa'),'paranoid':![],'indexes':[{'name':_0x2dc3('0xb'),'fields':[_0x2dc3('0xc'),_0x2dc3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4e6e=['moment','bluebird','request-promise','./userProfileSection.attributes','userProfileId','lodash','../../config/logger','api'];(function(_0x203271,_0x542139){var _0x37b0dd=function(_0x21d4d6){while(--_0x21d4d6){_0x203271['push'](_0x203271['shift']());}};_0x37b0dd(++_0x542139);}(_0x4e6e,0x1c5));var _0xe4e6=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x4e6e[_0x368fb9];return _0x4892fb;};'use strict';var _=require(_0xe4e6('0x0'));var util=require('util');var logger=require(_0xe4e6('0x1'))(_0xe4e6('0x2'));var moment=require(_0xe4e6('0x3'));var BPromise=require(_0xe4e6('0x4'));var rp=require(_0xe4e6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe4e6('0x6'));module['exports']=function(_0x4a3e3a,_0x582dec){return _0x4a3e3a['define']('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0xe4e6('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index c2e4478..45aa354 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 _0x452d=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','lodash','util','moment'];(function(_0x517114,_0x1456d5){var _0x9876ef=function(_0x70035b){while(--_0x70035b){_0x517114['push'](_0x517114['shift']());}};_0x9876ef(++_0x1456d5);}(_0x452d,0x14d));var _0xd452=function(_0x337367,_0x46fe17){_0x337367=_0x337367-0x0;var _0x363433=_0x452d[_0x337367];return _0x363433;};'use strict';var _=require(_0xd452('0x0'));var util=require(_0xd452('0x1'));var moment=require(_0xd452('0x2'));var BPromise=require(_0xd452('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd452('0x4'));var db=require(_0xd452('0x5'))['db'];var utils=require(_0xd452('0x6'));var logger=require(_0xd452('0x7'))(_0xd452('0x8'));var config=require(_0xd452('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd452('0xa')][_0xd452('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25c6e0,_0x48e14d,_0x4e2cce){return new BPromise(function(_0x42b42e,_0x3dbdb8){return client[_0xd452('0xc')](_0x25c6e0,_0x4e2cce)[_0xd452('0xd')](function(_0x45081d){logger['info'](_0xd452('0xe'),_0x48e14d,_0xd452('0xf'));logger[_0xd452('0x10')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x48e14d,_0xd452('0xf'),JSON['stringify'](_0x45081d));if(_0x45081d[_0xd452('0x11')]){if(_0x45081d['error'][_0xd452('0x12')]===0x1f4){logger[_0xd452('0x11')](_0xd452('0xe'),_0x48e14d,_0x45081d[_0xd452('0x11')][_0xd452('0x13')]);return _0x3dbdb8(_0x45081d['error'][_0xd452('0x13')]);}logger[_0xd452('0x11')](_0xd452('0xe'),_0x48e14d,_0x45081d[_0xd452('0x11')]['message']);return _0x42b42e(_0x45081d[_0xd452('0x11')][_0xd452('0x13')]);}else{logger[_0xd452('0x14')](_0xd452('0xe'),_0x48e14d,_0xd452('0xf'));_0x42b42e(_0x45081d['result']['message']);}})['catch'](function(_0x396a80){logger[_0xd452('0x11')](_0xd452('0xe'),_0x48e14d,_0x396a80);_0x3dbdb8(_0x396a80);});});} \ No newline at end of file +var _0xf3ea=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x49ae93,_0x194c10){var _0x5eeb34=function(_0x26dc88){while(--_0x26dc88){_0x49ae93['push'](_0x49ae93['shift']());}};_0x5eeb34(++_0x194c10);}(_0xf3ea,0xc1));var _0xaf3e=function(_0x6204ed,_0x207e26){_0x6204ed=_0x6204ed-0x0;var _0x5ac1b1=_0xf3ea[_0x6204ed];return _0x5ac1b1;};'use strict';var _=require(_0xaf3e('0x0'));var util=require('util');var moment=require(_0xaf3e('0x1'));var BPromise=require(_0xaf3e('0x2'));var rs=require(_0xaf3e('0x3'));var fs=require('fs');var Redis=require(_0xaf3e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaf3e('0x5'));var logger=require(_0xaf3e('0x6'))('rpc');var config=require(_0xaf3e('0x7'));var jayson=require(_0xaf3e('0x8'));var client=jayson[_0xaf3e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x594fd2,_0x9c8193,_0x2a2796){return new BPromise(function(_0x4e23b0,_0x5b8610){return client[_0xaf3e('0xa')](_0x594fd2,_0x2a2796)[_0xaf3e('0xb')](function(_0x5318dd){logger['info'](_0xaf3e('0xc'),_0x9c8193,_0xaf3e('0xd'));logger[_0xaf3e('0xe')](_0xaf3e('0xf'),_0x9c8193,'request\x20sent',JSON['stringify'](_0x5318dd));if(_0x5318dd[_0xaf3e('0x10')]){if(_0x5318dd['error'][_0xaf3e('0x11')]===0x1f4){logger[_0xaf3e('0x10')](_0xaf3e('0xc'),_0x9c8193,_0x5318dd['error']['message']);return _0x5b8610(_0x5318dd[_0xaf3e('0x10')]['message']);}logger[_0xaf3e('0x10')](_0xaf3e('0xc'),_0x9c8193,_0x5318dd[_0xaf3e('0x10')][_0xaf3e('0x12')]);return _0x4e23b0(_0x5318dd[_0xaf3e('0x10')][_0xaf3e('0x12')]);}else{logger[_0xaf3e('0x13')](_0xaf3e('0xc'),_0x9c8193,_0xaf3e('0xd'));_0x4e23b0(_0x5318dd[_0xaf3e('0x14')][_0xaf3e('0x12')]);}})[_0xaf3e('0x15')](function(_0x48c893){logger['error'](_0xaf3e('0xc'),_0x9c8193,_0x48c893);_0x5b8610(_0x48c893);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index aa3afd7..329e187 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 _0x508d=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x52ea08,_0x15d935){var _0x28d546=function(_0x4a3aa7){while(--_0x4a3aa7){_0x52ea08['push'](_0x52ea08['shift']());}};_0x28d546(++_0x15d935);}(_0x508d,0x118));var _0xd508=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x508d[_0x279d37];return _0x530173;};'use strict';var multer=require(_0xd508('0x0'));var util=require(_0xd508('0x1'));var path=require(_0xd508('0x2'));var timeout=require(_0xd508('0x3'));var express=require('express');var router=express[_0xd508('0x4')]();var auth=require(_0xd508('0x5'));var interaction=require(_0xd508('0x6'));var config=require(_0xd508('0x7'));module['exports']=router; \ No newline at end of file +var _0xd32a=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout'];(function(_0x258dca,_0xce61f8){var _0x558682=function(_0x15e2c3){while(--_0x15e2c3){_0x258dca['push'](_0x258dca['shift']());}};_0x558682(++_0xce61f8);}(_0xd32a,0x19b));var _0xad32=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xd32a[_0x4b7895];return _0x264180;};'use strict';var multer=require(_0xad32('0x0'));var util=require('util');var path=require(_0xad32('0x1'));var timeout=require(_0xad32('0x2'));var express=require(_0xad32('0x3'));var router=express[_0xad32('0x4')]();var auth=require(_0xad32('0x5'));var interaction=require(_0xad32('0x6'));var config=require(_0xad32('0x7'));module[_0xad32('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 362522e..31d0933 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(_0x12615d,_0x128ffd){var _0x372b49=function(_0x420c67){while(--_0x420c67){_0x12615d['push'](_0x12615d['shift']());}};_0x372b49(++_0x128ffd);}(_0xe706,0xa3));var _0x6e70=function(_0x3c2efd,_0x405f28){_0x3c2efd=_0x3c2efd-0x0;var _0x433b01=_0xe706[_0x3c2efd];return _0x433b01;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x5ba74f,_0x200bf4){var _0x534d79=function(_0x50521a){while(--_0x50521a){_0x5ba74f['push'](_0x5ba74f['shift']());}};_0x534d79(++_0x200bf4);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 910a24f..7585ec6 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 _0xd900=['UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xd900,0xaa));var _0x0d90=function(_0x465a22,_0x6bfa46){_0x465a22=_0x465a22-0x0;var _0x5ad9da=_0xd900[_0x465a22];return _0x5ad9da;};'use strict';var _=require('lodash');var util=require(_0x0d90('0x0'));var logger=require(_0x0d90('0x1'))(_0x0d90('0x2'));var moment=require(_0x0d90('0x3'));var BPromise=require(_0x0d90('0x4'));var rp=require(_0x0d90('0x5'));var fs=require('fs');var path=require(_0x0d90('0x6'));var rimraf=require('rimraf');var config=require(_0x0d90('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0x0d90('0x8')]=function(_0x19fd22,_0x51d4c9){return _0x19fd22[_0x0d90('0x9')](_0x0d90('0xa'),attributes,{'tableName':_0x0d90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93f4=['exports','UserSmsQueue','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./userSmsQueue.attributes'];(function(_0x1fe0cb,_0x452e1a){var _0xcb8a22=function(_0x18df4d){while(--_0x18df4d){_0x1fe0cb['push'](_0x1fe0cb['shift']());}};_0xcb8a22(++_0x452e1a);}(_0x93f4,0xa2));var _0x493f=function(_0x29db77,_0x1765ab){_0x29db77=_0x29db77-0x0;var _0x3c5761=_0x93f4[_0x29db77];return _0x3c5761;};'use strict';var _=require('lodash');var util=require(_0x493f('0x0'));var logger=require(_0x493f('0x1'))(_0x493f('0x2'));var moment=require(_0x493f('0x3'));var BPromise=require(_0x493f('0x4'));var rp=require(_0x493f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x493f('0x6'));var config=require('../../config/environment');var attributes=require(_0x493f('0x7'));module[_0x493f('0x8')]=function(_0x3ef929,_0x345e50){return _0x3ef929['define'](_0x493f('0x9'),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 cd9c567..e0bbf56 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 _0x8d87=['../../config/utils','rpc','../../config/environment','http','then','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1fcc7c,_0x3ff6b9){var _0xf5d503=function(_0x5d6612){while(--_0x5d6612){_0x1fcc7c['push'](_0x1fcc7c['shift']());}};_0xf5d503(++_0x3ff6b9);}(_0x8d87,0x18a));var _0x78d8=function(_0x5613de,_0x479c93){_0x5613de=_0x5613de-0x0;var _0x5b40cb=_0x8d87[_0x5613de];return _0x5b40cb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x78d8('0x0'));var BPromise=require(_0x78d8('0x1'));var rs=require(_0x78d8('0x2'));var fs=require('fs');var Redis=require(_0x78d8('0x3'));var db=require(_0x78d8('0x4'))['db'];var utils=require(_0x78d8('0x5'));var logger=require('../../config/logger')(_0x78d8('0x6'));var config=require(_0x78d8('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x78d8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f9a9f,_0x5f2a58,_0x4912aa){return new BPromise(function(_0x735ed8,_0x316a9d){return client['request'](_0x3f9a9f,_0x4912aa)[_0x78d8('0x9')](function(_0x459ecb){logger[_0x78d8('0xa')](_0x78d8('0xb'),_0x5f2a58,'request\x20sent');logger[_0x78d8('0xc')](_0x78d8('0xd'),_0x5f2a58,_0x78d8('0xe'),JSON['stringify'](_0x459ecb));if(_0x459ecb[_0x78d8('0xf')]){if(_0x459ecb[_0x78d8('0xf')][_0x78d8('0x10')]===0x1f4){logger['error'](_0x78d8('0xb'),_0x5f2a58,_0x459ecb['error']['message']);return _0x316a9d(_0x459ecb[_0x78d8('0xf')][_0x78d8('0x11')]);}logger[_0x78d8('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x5f2a58,_0x459ecb['error']['message']);return _0x735ed8(_0x459ecb[_0x78d8('0xf')][_0x78d8('0x11')]);}else{logger[_0x78d8('0xa')](_0x78d8('0xb'),_0x5f2a58,_0x78d8('0xe'));_0x735ed8(_0x459ecb['result']['message']);}})[_0x78d8('0x12')](function(_0x3f2018){logger[_0x78d8('0xf')](_0x78d8('0xb'),_0x5f2a58,_0x3f2018);_0x316a9d(_0x3f2018);});});} \ No newline at end of file +var _0xd620=['error','code','message','info','catch','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xd620,0xdd));var _0x0d62=function(_0x30f296,_0x3a539b){_0x30f296=_0x30f296-0x0;var _0x39653d=_0xd620[_0x30f296];return _0x39653d;};'use strict';var _=require(_0x0d62('0x0'));var util=require(_0x0d62('0x1'));var moment=require(_0x0d62('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d62('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d62('0x4'))(_0x0d62('0x5'));var config=require(_0x0d62('0x6'));var jayson=require(_0x0d62('0x7'));var client=jayson[_0x0d62('0x8')][_0x0d62('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b663a,_0x55b1a7,_0x31cbdf){return new BPromise(function(_0x14d1dc,_0x3a9da4){return client['request'](_0x2b663a,_0x31cbdf)[_0x0d62('0xa')](function(_0x571e0d){logger['info'](_0x0d62('0xb'),_0x55b1a7,_0x0d62('0xc'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x55b1a7,_0x0d62('0xc'),JSON['stringify'](_0x571e0d));if(_0x571e0d[_0x0d62('0xd')]){if(_0x571e0d[_0x0d62('0xd')][_0x0d62('0xe')]===0x1f4){logger[_0x0d62('0xd')](_0x0d62('0xb'),_0x55b1a7,_0x571e0d[_0x0d62('0xd')][_0x0d62('0xf')]);return _0x3a9da4(_0x571e0d[_0x0d62('0xd')][_0x0d62('0xf')]);}logger[_0x0d62('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x55b1a7,_0x571e0d[_0x0d62('0xd')][_0x0d62('0xf')]);return _0x14d1dc(_0x571e0d['error'][_0x0d62('0xf')]);}else{logger[_0x0d62('0x10')](_0x0d62('0xb'),_0x55b1a7,_0x0d62('0xc'));_0x14d1dc(_0x571e0d['result']['message']);}})[_0x0d62('0x11')](function(_0x34a8a6){logger[_0x0d62('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x55b1a7,_0x34a8a6);_0x3a9da4(_0x34a8a6);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index f08859d..c04fb84 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 _0x074a=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout','express'];(function(_0x335d63,_0x5d8378){var _0x49bcda=function(_0x4b3ea4){while(--_0x4b3ea4){_0x335d63['push'](_0x335d63['shift']());}};_0x49bcda(++_0x5d8378);}(_0x074a,0x175));var _0xa074=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x074a[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xa074('0x0'));var util=require(_0xa074('0x1'));var path=require(_0xa074('0x2'));var timeout=require(_0xa074('0x3'));var express=require(_0xa074('0x4'));var router=express[_0xa074('0x5')]();var auth=require(_0xa074('0x6'));var interaction=require(_0xa074('0x7'));var config=require(_0xa074('0x8'));module['exports']=router; \ No newline at end of file +var _0x7860=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x7860,0x1ef));var _0x0786=function(_0x3a1518,_0x563141){_0x3a1518=_0x3a1518-0x0;var _0x3b7f5d=_0x7860[_0x3a1518];return _0x3b7f5d;};'use strict';var multer=require(_0x0786('0x0'));var util=require(_0x0786('0x1'));var path=require(_0x0786('0x2'));var timeout=require(_0x0786('0x3'));var express=require(_0x0786('0x4'));var router=express[_0x0786('0x5')]();var auth=require(_0x0786('0x6'));var interaction=require(_0x0786('0x7'));var config=require(_0x0786('0x8'));module[_0x0786('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index bfcaf46..9ff5950 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x5c62fb,_0x4f913b){var _0x4a8f34=function(_0x231e7d){while(--_0x231e7d){_0x5c62fb['push'](_0x5c62fb['shift']());}};_0x4a8f34(++_0x4f913b);}(_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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x105a59,_0x45aaf8){var _0x346f87=function(_0x1f485c){while(--_0x1f485c){_0x105a59['push'](_0x105a59['shift']());}};_0x346f87(++_0x45aaf8);}(_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')]={'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 ba7ddb3..217df21 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 _0x50a6=['./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','lodash','util','moment','request-promise','path','rimraf'];(function(_0x291d3f,_0x3ef99f){var _0x242080=function(_0x257705){while(--_0x257705){_0x291d3f['push'](_0x291d3f['shift']());}};_0x242080(++_0x3ef99f);}(_0x50a6,0xa4));var _0x650a=function(_0x25be63,_0x4b335e){_0x25be63=_0x25be63-0x0;var _0x4daaa8=_0x50a6[_0x25be63];return _0x4daaa8;};'use strict';var _=require(_0x650a('0x0'));var util=require(_0x650a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x650a('0x2'));var BPromise=require('bluebird');var rp=require(_0x650a('0x3'));var fs=require('fs');var path=require(_0x650a('0x4'));var rimraf=require(_0x650a('0x5'));var config=require('../../config/environment');var attributes=require(_0x650a('0x6'));module['exports']=function(_0x4eabde,_0x2d486d){return _0x4eabde[_0x650a('0x7')](_0x650a('0x8'),attributes,{'tableName':_0x650a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b84=['moment','path','rimraf','../../config/environment','UserVoiceQueue','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x26b8b5,_0xf5c2c1){_0x26b8b5=_0x26b8b5-0x0;var _0x2150a9=_0x4b84[_0x26b8b5];return _0x2150a9;};'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('./userVoiceQueue.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 8332c5a..bffc80f 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 _0x2e84=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4db9ed,_0x1e1a7e){var _0x218dab=function(_0x1a36ab){while(--_0x1a36ab){_0x4db9ed['push'](_0x4db9ed['shift']());}};_0x218dab(++_0x1e1a7e);}(_0x2e84,0x175));var _0x42e8=function(_0xe3f6e7,_0x45773c){_0xe3f6e7=_0xe3f6e7-0x0;var _0x14894f=_0x2e84[_0xe3f6e7];return _0x14894f;};'use strict';var _=require(_0x42e8('0x0'));var util=require(_0x42e8('0x1'));var moment=require(_0x42e8('0x2'));var BPromise=require(_0x42e8('0x3'));var rs=require(_0x42e8('0x4'));var fs=require('fs');var Redis=require(_0x42e8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x42e8('0x6'));var logger=require(_0x42e8('0x7'))(_0x42e8('0x8'));var config=require(_0x42e8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x42e8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x395a38,_0x189638,_0x1eb9c9){return new BPromise(function(_0x165f76,_0x403f47){return client['request'](_0x395a38,_0x1eb9c9)[_0x42e8('0xb')](function(_0x32a8ff){logger[_0x42e8('0xc')](_0x42e8('0xd'),_0x189638,'request\x20sent');logger[_0x42e8('0xe')](_0x42e8('0xf'),_0x189638,_0x42e8('0x10'),JSON[_0x42e8('0x11')](_0x32a8ff));if(_0x32a8ff[_0x42e8('0x12')]){if(_0x32a8ff['error'][_0x42e8('0x13')]===0x1f4){logger['error'](_0x42e8('0xd'),_0x189638,_0x32a8ff['error'][_0x42e8('0x14')]);return _0x403f47(_0x32a8ff['error'][_0x42e8('0x14')]);}logger[_0x42e8('0x12')](_0x42e8('0xd'),_0x189638,_0x32a8ff[_0x42e8('0x12')][_0x42e8('0x14')]);return _0x165f76(_0x32a8ff[_0x42e8('0x12')][_0x42e8('0x14')]);}else{logger[_0x42e8('0xc')](_0x42e8('0xd'),_0x189638,_0x42e8('0x10'));_0x165f76(_0x32a8ff[_0x42e8('0x15')][_0x42e8('0x14')]);}})[_0x42e8('0x16')](function(_0x563f10){logger[_0x42e8('0x12')](_0x42e8('0xd'),_0x189638,_0x563f10);_0x403f47(_0x563f10);});});} \ No newline at end of file +var _0xf6f7=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','lodash','util','moment'];(function(_0x1d83a2,_0x2921d5){var _0x353203=function(_0x378ca3){while(--_0x378ca3){_0x1d83a2['push'](_0x1d83a2['shift']());}};_0x353203(++_0x2921d5);}(_0xf6f7,0xe3));var _0x7f6f=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0xf6f7[_0x450689];return _0x46ffb0;};'use strict';var _=require(_0x7f6f('0x0'));var util=require(_0x7f6f('0x1'));var moment=require(_0x7f6f('0x2'));var BPromise=require(_0x7f6f('0x3'));var rs=require(_0x7f6f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f6f('0x5'))['db'];var utils=require(_0x7f6f('0x6'));var logger=require(_0x7f6f('0x7'))('rpc');var config=require(_0x7f6f('0x8'));var jayson=require(_0x7f6f('0x9'));var client=jayson[_0x7f6f('0xa')][_0x7f6f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x158dc2,_0x4bb522,_0x1448b2){return new BPromise(function(_0x301a63,_0x14edf5){return client[_0x7f6f('0xc')](_0x158dc2,_0x1448b2)[_0x7f6f('0xd')](function(_0x5043ae){logger[_0x7f6f('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x4bb522,_0x7f6f('0xf'));logger[_0x7f6f('0x10')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4bb522,_0x7f6f('0xf'),JSON[_0x7f6f('0x11')](_0x5043ae));if(_0x5043ae[_0x7f6f('0x12')]){if(_0x5043ae[_0x7f6f('0x12')][_0x7f6f('0x13')]===0x1f4){logger['error'](_0x7f6f('0x14'),_0x4bb522,_0x5043ae['error']['message']);return _0x14edf5(_0x5043ae[_0x7f6f('0x12')]['message']);}logger[_0x7f6f('0x12')](_0x7f6f('0x14'),_0x4bb522,_0x5043ae[_0x7f6f('0x12')][_0x7f6f('0x15')]);return _0x301a63(_0x5043ae['error'][_0x7f6f('0x15')]);}else{logger[_0x7f6f('0xe')](_0x7f6f('0x14'),_0x4bb522,_0x7f6f('0xf'));_0x301a63(_0x5043ae[_0x7f6f('0x16')][_0x7f6f('0x15')]);}})['catch'](function(_0x2a5828){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x4bb522,_0x2a5828);_0x14edf5(_0x2a5828);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 43622b4..7679497 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 _0xf091=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x28e74e,_0x53fdf1){var _0xb45ac1=function(_0x311a7a){while(--_0x311a7a){_0x28e74e['push'](_0x28e74e['shift']());}};_0xb45ac1(++_0x53fdf1);}(_0xf091,0x105));var _0x1f09=function(_0x41afbf,_0x31a015){_0x41afbf=_0x41afbf-0x0;var _0x3d5476=_0xf091[_0x41afbf];return _0x3d5476;};'use strict';var multer=require(_0x1f09('0x0'));var util=require(_0x1f09('0x1'));var path=require(_0x1f09('0x2'));var timeout=require('connect-timeout');var express=require(_0x1f09('0x3'));var router=express['Router']();var auth=require(_0x1f09('0x4'));var interaction=require(_0x1f09('0x5'));var config=require(_0x1f09('0x6'));module[_0x1f09('0x7')]=router; \ No newline at end of file +var _0x0da9=['../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout','express','Router'];(function(_0x55f15b,_0x4cf93b){var _0x2b723c=function(_0xe14b42){while(--_0xe14b42){_0x55f15b['push'](_0x55f15b['shift']());}};_0x2b723c(++_0x4cf93b);}(_0x0da9,0x15a));var _0x90da=function(_0x5bb215,_0x268c07){_0x5bb215=_0x5bb215-0x0;var _0x5c615f=_0x0da9[_0x5bb215];return _0x5c615f;};'use strict';var multer=require(_0x90da('0x0'));var util=require(_0x90da('0x1'));var path=require(_0x90da('0x2'));var timeout=require(_0x90da('0x3'));var express=require(_0x90da('0x4'));var router=express[_0x90da('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x90da('0x6'));var config=require(_0x90da('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index dbdce09..d746a37 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 _0x57a6=['queue_interface','sequelize','INTEGER','STRING','Required\x20by\x20Asterisk'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x57a6,0x7e));var _0x657a=function(_0x4e17e3,_0x1fc8a8){_0x4e17e3=_0x4e17e3-0x0;var _0x4e8eb0=_0x57a6[_0x4e17e3];return _0x4e8eb0;};'use strict';var Sequelize=require(_0x657a('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x657a('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x657a('0x2')],'allowNull':![],'comment':_0x657a('0x3')},'UserId':{'type':Sequelize[_0x657a('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x657a('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x657a('0x2')],'allowNull':![],'unique':_0x657a('0x4'),'comment':_0x657a('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x657a('0x3')},'paused':{'type':Sequelize[_0x657a('0x1')](0xb),'defaultValue':0x0,'comment':_0x657a('0x3')}}; \ No newline at end of file +var _0xdfb3=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x9d14e3,_0x5a6072){var _0x19bf32=function(_0x19da07){while(--_0x19da07){_0x9d14e3['push'](_0x9d14e3['shift']());}};_0x19bf32(++_0x5a6072);}(_0xdfb3,0xbf));var _0x3dfb=function(_0x4d1324,_0x3f7b0d){_0x4d1324=_0x4d1324-0x0;var _0x5e6bf0=_0xdfb3[_0x4d1324];return _0x5e6bf0;};'use strict';var Sequelize=require(_0x3dfb('0x0'));module[_0x3dfb('0x1')]={'uniqueid':{'type':Sequelize[_0x3dfb('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3dfb('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x3dfb('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3dfb('0x4')],'allowNull':![],'unique':_0x3dfb('0x5'),'comment':_0x3dfb('0x3')},'VoiceQueueId':{'type':Sequelize[_0x3dfb('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x3dfb('0x4')],'allowNull':![],'unique':_0x3dfb('0x5'),'comment':_0x3dfb('0x3')},'penalty':{'type':Sequelize[_0x3dfb('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x3dfb('0x2')](0xb),'defaultValue':0x0,'comment':_0x3dfb('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 63f8989..2cccfde 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 _0xba7e=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt'];(function(_0x3b9954,_0x2c0711){var _0x30f058=function(_0x3b86b0){while(--_0x3b86b0){_0x3b9954['push'](_0x3b9954['shift']());}};_0x30f058(++_0x2c0711);}(_0xba7e,0x103));var _0xeba7=function(_0x4adff1,_0x4a8cbe){_0x4adff1=_0x4adff1-0x0;var _0x318759=_0xba7e[_0x4adff1];return _0x318759;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xeba7('0x0'))['db'][_0xeba7('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xeba7('0x2')](0x0);var events={'afterCreate':_0xeba7('0x3'),'afterUpdate':_0xeba7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x35a2e4){return function(_0x37b17d,_0x4159f0,_0x13fddf){UserVoiceQueueRtEvents[_0xeba7('0x5')](_0x35a2e4+':'+_0x37b17d['id'],_0x37b17d);UserVoiceQueueRtEvents[_0xeba7('0x5')](_0x35a2e4,_0x37b17d);_0x13fddf(null);};}for(var e in events){if(events[_0xeba7('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xeba7('0x7')](e,emitEvent(event));}}module[_0xeba7('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x2916=['hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove'];(function(_0x3b1e1d,_0x1504a2){var _0x55ab85=function(_0x5a50e8){while(--_0x5a50e8){_0x3b1e1d['push'](_0x3b1e1d['shift']());}};_0x55ab85(++_0x1504a2);}(_0x2916,0x12b));var _0x6291=function(_0x2250da,_0xdb9fe6){_0x2250da=_0x2250da-0x0;var _0x573dc5=_0x2916[_0x2250da];return _0x573dc5;};'use strict';var EventEmitter=require(_0x6291('0x0'));var UserVoiceQueueRt=require(_0x6291('0x1'))['db'][_0x6291('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x6291('0x3')](0x0);var events={'afterCreate':_0x6291('0x4'),'afterUpdate':_0x6291('0x5'),'afterDestroy':_0x6291('0x6')};function emitEvent(_0x57eec3){return function(_0x37d995,_0x6b0bdd,_0x1e6dd7){UserVoiceQueueRtEvents['emit'](_0x57eec3+':'+_0x37d995['id'],_0x37d995);UserVoiceQueueRtEvents['emit'](_0x57eec3,_0x37d995);_0x1e6dd7(null);};}for(var e in events){if(events[_0x6291('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x6291('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 7e3f651..0968128 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 _0x05f2=['rimraf','../../config/environment','exports','define','UserVoiceQueueRt','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3d9400,_0x2b9228){var _0x1b6fe8=function(_0x42076f){while(--_0x42076f){_0x3d9400['push'](_0x3d9400['shift']());}};_0x1b6fe8(++_0x2b9228);}(_0x05f2,0xf5));var _0x205f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x05f2[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x205f('0x0'));var util=require(_0x205f('0x1'));var logger=require(_0x205f('0x2'))(_0x205f('0x3'));var moment=require(_0x205f('0x4'));var BPromise=require(_0x205f('0x5'));var rp=require(_0x205f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x205f('0x7'));var config=require(_0x205f('0x8'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x205f('0x9')]=function(_0x38663e,_0x292a94){return _0x38663e[_0x205f('0xa')](_0x205f('0xb'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3fd=['util','api','moment','bluebird','request-promise','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash'];(function(_0x63488a,_0x5ca591){var _0x2ab9a0=function(_0x19bed6){while(--_0x19bed6){_0x63488a['push'](_0x63488a['shift']());}};_0x2ab9a0(++_0x5ca591);}(_0xc3fd,0x11d));var _0xdc3f=function(_0x53d8c1,_0x334506){_0x53d8c1=_0x53d8c1-0x0;var _0x31be67=_0xc3fd[_0x53d8c1];return _0x31be67;};'use strict';var _=require(_0xdc3f('0x0'));var util=require(_0xdc3f('0x1'));var logger=require('../../config/logger')(_0xdc3f('0x2'));var moment=require(_0xdc3f('0x3'));var BPromise=require(_0xdc3f('0x4'));var rp=require(_0xdc3f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdc3f('0x6'));var attributes=require(_0xdc3f('0x7'));module['exports']=function(_0x4c3890,_0xc29b3a){return _0x4c3890[_0xdc3f('0x8')](_0xdc3f('0x9'),attributes,{'tableName':_0xdc3f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 940379a..970092a 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 _0x19b5=['../../config/utils','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','code','error','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5a2291,_0x3ddda7){var _0x10e3f5=function(_0xc510cc){while(--_0xc510cc){_0x5a2291['push'](_0x5a2291['shift']());}};_0x10e3f5(++_0x3ddda7);}(_0x19b5,0xe9));var _0x519b=function(_0xc3c495,_0x74456e){_0xc3c495=_0xc3c495-0x0;var _0x25cff9=_0x19b5[_0xc3c495];return _0x25cff9;};'use strict';var _=require('lodash');var util=require(_0x519b('0x0'));var moment=require('moment');var BPromise=require(_0x519b('0x1'));var rs=require(_0x519b('0x2'));var fs=require('fs');var Redis=require(_0x519b('0x3'));var db=require(_0x519b('0x4'))['db'];var utils=require(_0x519b('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x519b('0x6')]({'port':0x232a});config[_0x519b('0x7')]=_[_0x519b('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x519b('0x9'))(new Redis(config[_0x519b('0x7')]));require(_0x519b('0xa'))[_0x519b('0xb')](socket);function respondWithRpcPromise(_0xea2145,_0x21d922,_0xc8a1ad){return new BPromise(function(_0x58897f,_0x425965){return client[_0x519b('0xc')](_0xea2145,_0xc8a1ad)[_0x519b('0xd')](function(_0xa79a5b){logger[_0x519b('0xe')](_0x519b('0xf'),_0x21d922,_0x519b('0x10'));logger['debug'](_0x519b('0x11'),_0x21d922,'request\x20sent',JSON['stringify'](_0xa79a5b));if(_0xa79a5b['error']){if(_0xa79a5b['error'][_0x519b('0x12')]===0x1f4){logger['error'](_0x519b('0xf'),_0x21d922,_0xa79a5b[_0x519b('0x13')]['message']);return _0x425965(_0xa79a5b[_0x519b('0x13')][_0x519b('0x14')]);}logger[_0x519b('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x21d922,_0xa79a5b[_0x519b('0x13')][_0x519b('0x14')]);return _0x58897f(_0xa79a5b[_0x519b('0x13')][_0x519b('0x14')]);}else{logger[_0x519b('0xe')](_0x519b('0xf'),_0x21d922,_0x519b('0x10'));_0x58897f(_0xa79a5b[_0x519b('0x15')][_0x519b('0x14')]);}})['catch'](function(_0x48a9ae){logger['error'](_0x519b('0xf'),_0x21d922,_0x48a9ae);_0x425965(_0x48a9ae);});});}exports[_0x519b('0x16')]=function(_0x3386ca){var _0x22039e=this;return new Promise(function(_0x1ab9d2,_0x467c03){return db[_0x519b('0x17')][_0x519b('0x18')]({'raw':_0x3386ca[_0x519b('0x19')]?_0x3386ca[_0x519b('0x19')][_0x519b('0x1a')]===undefined?!![]:![]:!![],'where':_0x3386ca[_0x519b('0x19')]?_0x3386ca[_0x519b('0x19')][_0x519b('0x1b')]||null:null,'attributes':[[db[_0x519b('0x1c')]['fn'](_0x519b('0x1d'),db[_0x519b('0x1c')]['fn']('IF',db['sequelize']['literal'](_0x519b('0x1e')))),_0x519b('0x1f')]]})[_0x519b('0xd')](function(_0x460d51){logger[_0x519b('0xe')](_0x519b('0x16'),_0x3386ca);logger[_0x519b('0x20')](_0x519b('0x16'),_0x3386ca,JSON['stringify'](_0x460d51));_0x1ab9d2(_0x460d51);})[_0x519b('0x21')](function(_0x50b7b3){logger[_0x519b('0x13')](_0x519b('0x16'),_0x50b7b3[_0x519b('0x14')],_0x3386ca);_0x467c03(_0x22039e[_0x519b('0x13')](0x1f4,_0x50b7b3[_0x519b('0x14')]));});});}; \ No newline at end of file +var _0x86ce=['redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','catch','lodash','util','moment','rpc','jayson/promise','client'];(function(_0x191713,_0x54044e){var _0x33798d=function(_0xdfe2f8){while(--_0xdfe2f8){_0x191713['push'](_0x191713['shift']());}};_0x33798d(++_0x54044e);}(_0x86ce,0x7e));var _0xe86c=function(_0xa3fadc,_0xd1e16){_0xa3fadc=_0xa3fadc-0x0;var _0x23ecb8=_0x86ce[_0xa3fadc];return _0x23ecb8;};'use strict';var _=require(_0xe86c('0x0'));var util=require(_0xe86c('0x1'));var moment=require(_0xe86c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe86c('0x3'));var config=require('../../config/environment');var jayson=require(_0xe86c('0x4'));var client=jayson[_0xe86c('0x5')]['http']({'port':0x232a});config[_0xe86c('0x6')]=_[_0xe86c('0x7')](config[_0xe86c('0x6')],{'host':_0xe86c('0x8'),'port':0x18eb});var socket=require(_0xe86c('0x9'))(new Redis(config[_0xe86c('0x6')]));require(_0xe86c('0xa'))[_0xe86c('0xb')](socket);function respondWithRpcPromise(_0x4912f2,_0x264efd,_0x1fe785){return new BPromise(function(_0x17859f,_0x190dee){return client[_0xe86c('0xc')](_0x4912f2,_0x1fe785)[_0xe86c('0xd')](function(_0x2e662b){logger[_0xe86c('0xe')](_0xe86c('0xf'),_0x264efd,_0xe86c('0x10'));logger[_0xe86c('0x11')](_0xe86c('0x12'),_0x264efd,_0xe86c('0x10'),JSON[_0xe86c('0x13')](_0x2e662b));if(_0x2e662b[_0xe86c('0x14')]){if(_0x2e662b['error'][_0xe86c('0x15')]===0x1f4){logger[_0xe86c('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x264efd,_0x2e662b['error']['message']);return _0x190dee(_0x2e662b[_0xe86c('0x14')][_0xe86c('0x16')]);}logger[_0xe86c('0x14')](_0xe86c('0xf'),_0x264efd,_0x2e662b[_0xe86c('0x14')][_0xe86c('0x16')]);return _0x17859f(_0x2e662b[_0xe86c('0x14')][_0xe86c('0x16')]);}else{logger[_0xe86c('0xe')](_0xe86c('0xf'),_0x264efd,_0xe86c('0x10'));_0x17859f(_0x2e662b['result']['message']);}})['catch'](function(_0x56e74b){logger['error'](_0xe86c('0xf'),_0x264efd,_0x56e74b);_0x190dee(_0x56e74b);});});}exports[_0xe86c('0x17')]=function(_0x34d2a8){var _0x1a13fc=this;return new Promise(function(_0x377971,_0x22fc78){return db[_0xe86c('0x18')]['findAll']({'raw':_0x34d2a8[_0xe86c('0x19')]?_0x34d2a8[_0xe86c('0x19')][_0xe86c('0x1a')]===undefined?!![]:![]:!![],'where':_0x34d2a8[_0xe86c('0x19')]?_0x34d2a8[_0xe86c('0x19')][_0xe86c('0x1b')]||null:null,'attributes':[[db[_0xe86c('0x1c')]['fn'](_0xe86c('0x1d'),db['sequelize']['fn']('IF',db[_0xe86c('0x1c')]['literal'](_0xe86c('0x1e')))),_0xe86c('0x1f')]]})['then'](function(_0x29716a){logger['info']('GetVoiceQueueRtPauses',_0x34d2a8);logger[_0xe86c('0x11')]('GetVoiceQueueRtPauses',_0x34d2a8,JSON[_0xe86c('0x13')](_0x29716a));_0x377971(_0x29716a);})[_0xe86c('0x20')](function(_0x2ae944){logger[_0xe86c('0x14')](_0xe86c('0x17'),_0x2ae944['message'],_0x34d2a8);_0x22fc78(_0x1a13fc[_0xe86c('0x14')](0x1f4,_0x2ae944[_0xe86c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index a716a23..cc3e0b0 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 _0xa300=['update','removeListener','register','length','./userVoiceQueueRt.events'];(function(_0x3dfb56,_0xfe844d){var _0x5e6e1b=function(_0x4e002f){while(--_0x4e002f){_0x3dfb56['push'](_0x3dfb56['shift']());}};_0x5e6e1b(++_0xfe844d);}(_0xa300,0xf4));var _0x0a30=function(_0x596d50,_0x50925b){_0x596d50=_0x596d50-0x0;var _0x366978=_0xa300[_0x596d50];return _0x366978;};'use strict';var UserVoiceQueueRtEvents=require(_0x0a30('0x0'));var events=['save','remove',_0x0a30('0x1')];function createListener(_0xc0c619,_0x5e1442){return function(_0x54252d){_0x5e1442['emit'](_0xc0c619,_0x54252d);};}function removeListener(_0x3750db,_0x39c347){return function(){UserVoiceQueueRtEvents[_0x0a30('0x2')](_0x3750db,_0x39c347);};}exports[_0x0a30('0x3')]=function(_0x2c24a6){for(var _0x1d87d2=0x0,_0x6452f2=events[_0x0a30('0x4')];_0x1d87d2<_0x6452f2;_0x1d87d2++){var _0x256dc9=events[_0x1d87d2];var _0x423a0d=createListener('userVoiceQueueRt:'+_0x256dc9,_0x2c24a6);UserVoiceQueueRtEvents['on'](_0x256dc9,_0x423a0d);}}; \ No newline at end of file +var _0x75b4=['register','./userVoiceQueueRt.events','save'];(function(_0x40e998,_0x43a134){var _0x5cb03f=function(_0x1ef5c3){while(--_0x1ef5c3){_0x40e998['push'](_0x40e998['shift']());}};_0x5cb03f(++_0x43a134);}(_0x75b4,0xfd));var _0x475b=function(_0x3fba4e,_0x28c4d6){_0x3fba4e=_0x3fba4e-0x0;var _0x380b1d=_0x75b4[_0x3fba4e];return _0x380b1d;};'use strict';var UserVoiceQueueRtEvents=require(_0x475b('0x0'));var events=[_0x475b('0x1'),'remove','update'];function createListener(_0x1d3e22,_0x9f3b20){return function(_0xed2eff){_0x9f3b20['emit'](_0x1d3e22,_0xed2eff);};}function removeListener(_0x31cc3c,_0x4ae23f){return function(){UserVoiceQueueRtEvents['removeListener'](_0x31cc3c,_0x4ae23f);};}exports[_0x475b('0x2')]=function(_0x71eec2){for(var _0x4516f4=0x0,_0x34b4d6=events['length'];_0x4516f4<_0x34b4d6;_0x4516f4++){var _0xecf51d=events[_0x4516f4];var _0x24012c=createListener('userVoiceQueueRt:'+_0xecf51d,_0x71eec2);UserVoiceQueueRtEvents['on'](_0xecf51d,_0x24012c);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index f4a9dbf..4feafcd 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 _0x6909=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express'];(function(_0x14e6d4,_0xb76b02){var _0x3f903f=function(_0x499682){while(--_0x499682){_0x14e6d4['push'](_0x14e6d4['shift']());}};_0x3f903f(++_0xb76b02);}(_0x6909,0x1b4));var _0x9690=function(_0x1ccaa8,_0x4f81d0){_0x1ccaa8=_0x1ccaa8-0x0;var _0x146fb3=_0x6909[_0x1ccaa8];return _0x146fb3;};'use strict';var multer=require(_0x9690('0x0'));var util=require(_0x9690('0x1'));var path=require(_0x9690('0x2'));var timeout=require(_0x9690('0x3'));var express=require(_0x9690('0x4'));var router=express['Router']();var auth=require(_0x9690('0x5'));var interaction=require(_0x9690('0x6'));var config=require(_0x9690('0x7'));module[_0x9690('0x8')]=router; \ No newline at end of file +var _0x2b34=['multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2b34,0x165));var _0x42b3=function(_0x3fbf17,_0x4d59b2){_0x3fbf17=_0x3fbf17-0x0;var _0x5a1358=_0x2b34[_0x3fbf17];return _0x5a1358;};'use strict';var multer=require(_0x42b3('0x0'));var util=require(_0x42b3('0x1'));var path=require('path');var timeout=require(_0x42b3('0x2'));var express=require('express');var router=express[_0x42b3('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x42b3('0x4'));var config=require(_0x42b3('0x5'));module[_0x42b3('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index bb88702..6749019 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x36a491,_0xfa13a9){var _0xcde177=function(_0x85fdc6){while(--_0x85fdc6){_0x36a491['push'](_0x36a491['shift']());}};_0xcde177(++_0xfa13a9);}(_0xe706,0xa3));var _0x6e70=function(_0x215f9e,_0x438b14){_0x215f9e=_0x215f9e-0x0;var _0x217ce4=_0xe706[_0x215f9e];return _0x217ce4;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x43b597,_0x1f9df2){var _0x72509c=function(_0x4f0130){while(--_0x4f0130){_0x43b597['push'](_0x43b597['shift']());}};_0x72509c(++_0x1f9df2);}(_0xe706,0xa3));var _0x6e70=function(_0x34f499,_0xd8ff6e){_0x34f499=_0x34f499-0x0;var _0x2be65b=_0xe706[_0x34f499];return _0x2be65b;};'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 6906c22..976b9c1 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 _0x4e81=['lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x136a0d,_0x476fe2){var _0x212ea5=function(_0xa288e){while(--_0xa288e){_0x136a0d['push'](_0x136a0d['shift']());}};_0x212ea5(++_0x476fe2);}(_0x4e81,0x1bc));var _0x14e8=function(_0x50d84b,_0x1d7ea7){_0x50d84b=_0x50d84b-0x0;var _0x6d4270=_0x4e81[_0x50d84b];return _0x6d4270;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var logger=require(_0x14e8('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x14e8('0x3'));var fs=require('fs');var path=require(_0x14e8('0x4'));var rimraf=require(_0x14e8('0x5'));var config=require(_0x14e8('0x6'));var attributes=require(_0x14e8('0x7'));module[_0x14e8('0x8')]=function(_0x56a266,_0x57c79b){return _0x56a266[_0x14e8('0x9')](_0x14e8('0xa'),attributes,{'tableName':_0x14e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3de3=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x115621,_0x341cde){var _0x5ef5ce=function(_0x2ca3f2){while(--_0x2ca3f2){_0x115621['push'](_0x115621['shift']());}};_0x5ef5ce(++_0x341cde);}(_0x3de3,0x1ce));var _0x33de=function(_0x2aa88e,_0x40aa77){_0x2aa88e=_0x2aa88e-0x0;var _0x453638=_0x3de3[_0x2aa88e];return _0x453638;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var logger=require(_0x33de('0x1'))(_0x33de('0x2'));var moment=require('moment');var BPromise=require(_0x33de('0x3'));var rp=require(_0x33de('0x4'));var fs=require('fs');var path=require(_0x33de('0x5'));var rimraf=require(_0x33de('0x6'));var config=require('../../config/environment');var attributes=require(_0x33de('0x7'));module[_0x33de('0x8')]=function(_0x558f98,_0x142716){return _0x558f98['define'](_0x33de('0x9'),attributes,{'tableName':_0x33de('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 6812c20..c0ef794 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(_0x1a2ca0,_0x12dc19){var _0x179ef2=function(_0x3fe0c6){while(--_0x3fe0c6){_0x1a2ca0['push'](_0x1a2ca0['shift']());}};_0x179ef2(++_0x12dc19);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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(_0x6ca0e7,_0x5adfee){var _0x1b60d2=function(_0x57ab36){while(--_0x57ab36){_0x6ca0e7['push'](_0x6ca0e7['shift']());}};_0x1b60d2(++_0x5adfee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 d937143..1805545 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 _0xc477=['./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xafd517,_0x41f215){var _0x1c9d07=function(_0x4b3a88){while(--_0x4b3a88){_0xafd517['push'](_0xafd517['shift']());}};_0x1c9d07(++_0x41f215);}(_0xc477,0x1da));var _0x7c47=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xc477[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x7c47('0x0'));var util=require(_0x7c47('0x1'));var path=require(_0x7c47('0x2'));var timeout=require(_0x7c47('0x3'));var express=require(_0x7c47('0x4'));var router=express[_0x7c47('0x5')]();var auth=require(_0x7c47('0x6'));var interaction=require(_0x7c47('0x7'));var config=require(_0x7c47('0x8'));var controller=require(_0x7c47('0x9'));router[_0x7c47('0xa')]('/',auth[_0x7c47('0xb')](),controller[_0x7c47('0xc')]);router[_0x7c47('0xa')](_0x7c47('0xd'),auth['isAuthenticated'](),controller[_0x7c47('0xe')]);router[_0x7c47('0xf')]('/',auth['isAuthenticated'](),controller[_0x7c47('0x10')]);router[_0x7c47('0x11')](_0x7c47('0xd'),auth['isAuthenticated'](),controller[_0x7c47('0x12')]);router[_0x7c47('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7c47('0x14')]=router; \ No newline at end of file +var _0xd469=['destroy','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd469,0x1ab));var _0x9d46=function(_0x344db2,_0x184342){_0x344db2=_0x344db2-0x0;var _0x32ca22=_0xd469[_0x344db2];return _0x32ca22;};'use strict';var multer=require('multer');var util=require(_0x9d46('0x0'));var path=require('path');var timeout=require(_0x9d46('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x9d46('0x2'));var interaction=require(_0x9d46('0x3'));var config=require('../../config/environment');var controller=require(_0x9d46('0x4'));router[_0x9d46('0x5')]('/',auth[_0x9d46('0x6')](),controller[_0x9d46('0x7')]);router[_0x9d46('0x5')](_0x9d46('0x8'),auth[_0x9d46('0x6')](),controller[_0x9d46('0x9')]);router[_0x9d46('0xa')]('/',auth['isAuthenticated'](),controller[_0x9d46('0xb')]);router[_0x9d46('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x9d46('0xd')]);router[_0x9d46('0xe')](_0x9d46('0x8'),auth[_0x9d46('0x6')](),controller[_0x9d46('0xf')]);module[_0x9d46('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index bb3dbac..2facaa5 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 _0x55d4=['STRING','name','sequelize','exports'];(function(_0x14ec58,_0x187b4e){var _0x27c55f=function(_0x56ffe9){while(--_0x56ffe9){_0x14ec58['push'](_0x14ec58['shift']());}};_0x27c55f(++_0x187b4e);}(_0x55d4,0x10a));var _0x455d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x55d4[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x455d('0x0'));module[_0x455d('0x1')]={'name':{'type':Sequelize[_0x455d('0x2')],'unique':_0x455d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x455d('0x2')]}}; \ No newline at end of file +var _0xf836=['sequelize','exports','STRING','name'];(function(_0x1d06a5,_0x4fc577){var _0xbaab59=function(_0x458664){while(--_0x458664){_0x1d06a5['push'](_0x1d06a5['shift']());}};_0xbaab59(++_0x4fc577);}(_0xf836,0xac));var _0x6f83=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf836[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6f83('0x0'));module[_0x6f83('0x1')]={'name':{'type':Sequelize[_0x6f83('0x2')],'unique':_0x6f83('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6f83('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 04a4487..4640622 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 _0x11f8=['where','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','filtears','intersection','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','Variable','rawAttributes','key','model','query','keys','filters','attributes','fields','length','sort'];(function(_0x65ee06,_0xf724b6){var _0x4d51c7=function(_0x560e92){while(--_0x560e92){_0x65ee06['push'](_0x65ee06['shift']());}};_0x4d51c7(++_0xf724b6);}(_0x11f8,0x108));var _0x811f=function(_0x3d3b76,_0x131ed4){_0x3d3b76=_0x3d3b76-0x0;var _0x98434e=_0x11f8[_0x3d3b76];return _0x98434e;};'use strict';var pdf=require(_0x811f('0x0'));var emlformat=require(_0x811f('0x1'));var rimraf=require(_0x811f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x811f('0x3'));var moment=require(_0x811f('0x4'));var BPromise=require(_0x811f('0x5'));var Mustache=require('mustache');var util=require(_0x811f('0x6'));var path=require(_0x811f('0x7'));var sox=require(_0x811f('0x8'));var csv=require('to-csv');var ejs=require(_0x811f('0x9'));var fs=require('fs');var _=require(_0x811f('0xa'));var squel=require(_0x811f('0xb'));var crypto=require('crypto');var jsforce=require(_0x811f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x811f('0xd'));var querystring=require(_0x811f('0xe'));var Papa=require(_0x811f('0xf'));var Redis=require(_0x811f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x811f('0x11'));var as=require(_0x811f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x811f('0x13'))(_0x811f('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x811f('0x15'));var db=require(_0x811f('0x16'))['db'];function respondWithStatusCode(_0x281d02,_0x12eca4){_0x12eca4=_0x12eca4||0xcc;return function(_0x2b0ab7){if(_0x2b0ab7){return _0x281d02[_0x811f('0x17')](_0x12eca4);}return _0x281d02['status'](_0x12eca4)[_0x811f('0x18')]();};}function respondWithResult(_0x44b09b,_0x27c2a6){_0x27c2a6=_0x27c2a6||0xc8;return function(_0x4f44b1){if(_0x4f44b1){return _0x44b09b['status'](_0x27c2a6)[_0x811f('0x19')](_0x4f44b1);}};}function respondWithFilteredResult(_0x742aa2,_0x561216){return function(_0x32aab1){if(_0x32aab1){var _0x6f1e70=_0x32aab1['count'],_0x8c31eb=_0x561216[_0x811f('0x1a')],_0x554bd1=_0x561216[_0x811f('0x1a')]+_0x561216[_0x811f('0x1b')],_0x475305;if(_0x554bd1>=_0x6f1e70){_0x554bd1=_0x6f1e70;_0x475305=0xc8;}else{_0x475305=0xce;}_0x742aa2[_0x811f('0x1c')](_0x475305);return _0x742aa2[_0x811f('0x1d')](_0x811f('0x1e'),_0x8c31eb+'-'+_0x554bd1+'/'+_0x6f1e70)['json'](_0x32aab1);}return null;};}function patchUpdates(_0x41d098){return function(_0x2d80d0){try{jsonpatch['apply'](_0x2d80d0,_0x41d098,!![]);}catch(_0x552816){return BPromise[_0x811f('0x1f')](_0x552816);}return _0x2d80d0[_0x811f('0x20')]();};}function saveUpdates(_0x385a93,_0x3164e9){return function(_0xa9514d){if(_0xa9514d){return _0xa9514d[_0x811f('0x21')](_0x385a93)[_0x811f('0x22')](function(_0x1e026f){return _0x1e026f;});}return null;};}function removeEntity(_0x431922,_0x394719){return function(_0x26c233){if(_0x26c233){return _0x26c233[_0x811f('0x23')]()['then'](function(){var _0x33487a=_0x26c233['get']({'plain':!![]});var _0x4c9e6c='Variables';return db['UserProfileResource'][_0x811f('0x23')]({'where':{'type':_0x4c9e6c,'resourceId':_0x33487a['id']}})[_0x811f('0x22')](function(){return _0x26c233;});})[_0x811f('0x22')](function(){_0x431922[_0x811f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7860f5,_0x1f4922){return function(_0x44ace8){if(!_0x44ace8){_0x7860f5[_0x811f('0x17')](0x194);}return _0x44ace8;};}function handleError(_0x4f1f00,_0x3914dc){_0x3914dc=_0x3914dc||0x1f4;return function(_0x553706){logger[_0x811f('0x24')](_0x553706[_0x811f('0x25')]);if(_0x553706[_0x811f('0x26')]){delete _0x553706[_0x811f('0x26')];}_0x4f1f00[_0x811f('0x1c')](_0x3914dc)[_0x811f('0x27')](_0x553706);};}exports['index']=function(_0x4774d0,_0x9e5c2c){var _0x4da363={},_0x5e00e3={},_0x54854b={'count':0x0,'rows':[]};var _0x46290d=_[_0x811f('0x28')](db[_0x811f('0x29')][_0x811f('0x2a')],function(_0x26723d){return{'name':_0x26723d['fieldName'],'type':_0x26723d['type'][_0x811f('0x2b')]};});_0x5e00e3[_0x811f('0x2c')]=_[_0x811f('0x28')](_0x46290d,_0x811f('0x26'));_0x5e00e3[_0x811f('0x2d')]=_[_0x811f('0x2e')](_0x4774d0[_0x811f('0x2d')]);_0x5e00e3[_0x811f('0x2f')]=_['intersection'](_0x5e00e3[_0x811f('0x2c')],_0x5e00e3[_0x811f('0x2d')]);_0x4da363[_0x811f('0x30')]=_['intersection'](_0x5e00e3[_0x811f('0x2c')],qs[_0x811f('0x31')](_0x4774d0['query']['fields']));_0x4da363[_0x811f('0x30')]=_0x4da363[_0x811f('0x30')][_0x811f('0x32')]?_0x4da363['attributes']:_0x5e00e3[_0x811f('0x2c')];if(!_0x4774d0['query']['hasOwnProperty']('nolimit')){_0x4da363[_0x811f('0x1b')]=qs[_0x811f('0x1b')](_0x4774d0[_0x811f('0x2d')][_0x811f('0x1b')]);_0x4da363[_0x811f('0x1a')]=qs[_0x811f('0x1a')](_0x4774d0['query'][_0x811f('0x1a')]);}_0x4da363['order']=qs[_0x811f('0x33')](_0x4774d0[_0x811f('0x2d')]['sort']);_0x4da363['where']=qs[_0x811f('0x2f')](_['pick'](_0x4774d0['query'],_0x5e00e3[_0x811f('0x2f')]),_0x46290d);if(_0x4774d0[_0x811f('0x2d')]['filter']){_0x4da363[_0x811f('0x34')]=_[_0x811f('0x35')](_0x4da363['where'],{'$or':_['map'](_0x46290d,function(_0x3a7995){if(_0x3a7995[_0x811f('0x36')]!==_0x811f('0x37')){var _0x5cab5c={};_0x5cab5c[_0x3a7995[_0x811f('0x26')]]={'$like':'%'+_0x4774d0['query'][_0x811f('0x38')]+'%'};return _0x5cab5c;}})});}_0x4da363=_[_0x811f('0x35')]({},_0x4da363,_0x4774d0[_0x811f('0x39')]);var _0x81b827={'where':_0x4da363['where']};return db[_0x811f('0x29')]['count'](_0x81b827)['then'](function(_0x5c9256){_0x54854b['count']=_0x5c9256;if(_0x4774d0[_0x811f('0x2d')]['includeAll']){_0x4da363[_0x811f('0x3a')]=[{'all':!![]}];}return db[_0x811f('0x29')][_0x811f('0x3b')](_0x4da363);})[_0x811f('0x22')](function(_0x3deb4d){_0x54854b[_0x811f('0x3c')]=_0x3deb4d;return _0x54854b;})[_0x811f('0x22')](respondWithFilteredResult(_0x9e5c2c,_0x4da363))[_0x811f('0x3d')](handleError(_0x9e5c2c,null));};exports[_0x811f('0x3e')]=function(_0x32e03d,_0x94b2bc){var _0x645a29={'raw':!![],'where':{'id':_0x32e03d['params']['id']}},_0x24fb41={};_0x24fb41[_0x811f('0x2c')]=_[_0x811f('0x2e')](db['Variable'][_0x811f('0x2a')]);_0x24fb41[_0x811f('0x2d')]=_[_0x811f('0x2e')](_0x32e03d[_0x811f('0x2d')]);_0x24fb41[_0x811f('0x3f')]=_[_0x811f('0x40')](_0x24fb41[_0x811f('0x2c')],_0x24fb41[_0x811f('0x2d')]);_0x645a29[_0x811f('0x30')]=_[_0x811f('0x40')](_0x24fb41['model'],qs[_0x811f('0x31')](_0x32e03d[_0x811f('0x2d')][_0x811f('0x31')]));_0x645a29[_0x811f('0x30')]=_0x645a29[_0x811f('0x30')][_0x811f('0x32')]?_0x645a29[_0x811f('0x30')]:_0x24fb41[_0x811f('0x2c')];if(_0x32e03d['query']['includeAll']){_0x645a29[_0x811f('0x3a')]=[{'all':!![]}];}_0x645a29=_['merge']({},_0x645a29,_0x32e03d['options']);return db[_0x811f('0x29')][_0x811f('0x41')](_0x645a29)[_0x811f('0x22')](handleEntityNotFound(_0x94b2bc,null))[_0x811f('0x22')](respondWithResult(_0x94b2bc,null))[_0x811f('0x3d')](handleError(_0x94b2bc,null));};exports[_0x811f('0x42')]=function(_0x2a2d30,_0x220ee2){return db[_0x811f('0x29')][_0x811f('0x42')](_0x2a2d30[_0x811f('0x43')],{})[_0x811f('0x22')](function(_0x26b56b){var _0x1070ea=_0x2a2d30[_0x811f('0x44')][_0x811f('0x45')]({'plain':!![]});if(!_0x1070ea)throw new Error(_0x811f('0x46'));if(_0x1070ea[_0x811f('0x47')]===_0x811f('0x44')){var _0x188969=_0x26b56b['get']({'plain':!![]});var _0xb0bced=_0x811f('0x48');return db[_0x811f('0x49')][_0x811f('0x41')]({'where':{'name':_0xb0bced,'userProfileId':_0x1070ea[_0x811f('0x4a')]},'raw':!![]})[_0x811f('0x22')](function(_0x2560e2){if(_0x2560e2&&_0x2560e2[_0x811f('0x4b')]===0x0){return db[_0x811f('0x4c')][_0x811f('0x42')]({'name':_0x188969[_0x811f('0x26')],'resourceId':_0x188969['id'],'type':_0x2560e2[_0x811f('0x26')],'sectionId':_0x2560e2['id']},{})[_0x811f('0x22')](function(){return _0x26b56b;});}else{return _0x26b56b;}})[_0x811f('0x3d')](function(_0x259f66){logger[_0x811f('0x24')](_0x811f('0x4d'),_0x259f66);throw _0x259f66;});}return _0x26b56b;})[_0x811f('0x22')](respondWithResult(_0x220ee2,0xc9))[_0x811f('0x3d')](handleError(_0x220ee2,null));};exports[_0x811f('0x21')]=function(_0x4f7dcd,_0x5ba5c4){if(_0x4f7dcd[_0x811f('0x43')]['id']){delete _0x4f7dcd[_0x811f('0x43')]['id'];}return db['Variable'][_0x811f('0x41')]({'where':{'id':_0x4f7dcd[_0x811f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5ba5c4,null))[_0x811f('0x22')](saveUpdates(_0x4f7dcd[_0x811f('0x43')],null))['then'](respondWithResult(_0x5ba5c4,null))[_0x811f('0x3d')](handleError(_0x5ba5c4,null));};exports[_0x811f('0x23')]=function(_0x457e9b,_0x4f9452){return db[_0x811f('0x29')]['find']({'where':{'id':_0x457e9b['params']['id']}})['then'](handleEntityNotFound(_0x4f9452,null))['then'](removeEntity(_0x4f9452,null))[_0x811f('0x3d')](handleError(_0x4f9452,null));}; \ No newline at end of file +var _0xe45b=['html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','Variables','UserProfileResource','error','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','nolimit','where','pick','filter','merge','VIRTUAL','options','Variable','includeAll','findAll','rows','catch','show','filtears','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params'];(function(_0x3c909a,_0x35296f){var _0x300d84=function(_0x459216){while(--_0x459216){_0x3c909a['push'](_0x3c909a['shift']());}};_0x300d84(++_0x35296f);}(_0xe45b,0x13c));var _0xbe45=function(_0xaad24a,_0x1c7172){_0xaad24a=_0xaad24a-0x0;var _0x32df5b=_0xe45b[_0xaad24a];return _0x32df5b;};'use strict';var pdf=require(_0xbe45('0x0'));var emlformat=require(_0xbe45('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbe45('0x2'));var jsonpatch=require(_0xbe45('0x3'));var rp=require(_0xbe45('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbe45('0x5'));var util=require(_0xbe45('0x6'));var path=require(_0xbe45('0x7'));var sox=require(_0xbe45('0x8'));var csv=require('to-csv');var ejs=require(_0xbe45('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbe45('0xa'));var crypto=require(_0xbe45('0xb'));var jsforce=require(_0xbe45('0xc'));var deskjs=require(_0xbe45('0xd'));var toCsv=require(_0xbe45('0xe'));var querystring=require(_0xbe45('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbe45('0x10'));var hardwareService=require(_0xbe45('0x11'));var logger=require('../../config/logger')(_0xbe45('0x12'));var utils=require(_0xbe45('0x13'));var config=require(_0xbe45('0x14'));var licenseUtil=require(_0xbe45('0x15'));var db=require(_0xbe45('0x16'))['db'];function respondWithStatusCode(_0x1a50ac,_0x21d6c5){_0x21d6c5=_0x21d6c5||0xcc;return function(_0x4cd00e){if(_0x4cd00e){return _0x1a50ac[_0xbe45('0x17')](_0x21d6c5);}return _0x1a50ac['status'](_0x21d6c5)[_0xbe45('0x18')]();};}function respondWithResult(_0x2419e2,_0x206576){_0x206576=_0x206576||0xc8;return function(_0x2e068b){if(_0x2e068b){return _0x2419e2[_0xbe45('0x19')](_0x206576)[_0xbe45('0x1a')](_0x2e068b);}};}function respondWithFilteredResult(_0x16a98e,_0x1ce2ad){return function(_0x361712){if(_0x361712){var _0x262da8=_0x361712[_0xbe45('0x1b')],_0xac1439=_0x1ce2ad[_0xbe45('0x1c')],_0x20138f=_0x1ce2ad[_0xbe45('0x1c')]+_0x1ce2ad[_0xbe45('0x1d')],_0x57dd38;if(_0x20138f>=_0x262da8){_0x20138f=_0x262da8;_0x57dd38=0xc8;}else{_0x57dd38=0xce;}_0x16a98e[_0xbe45('0x19')](_0x57dd38);return _0x16a98e[_0xbe45('0x1e')](_0xbe45('0x1f'),_0xac1439+'-'+_0x20138f+'/'+_0x262da8)['json'](_0x361712);}return null;};}function patchUpdates(_0x9385d3){return function(_0x1883df){try{jsonpatch[_0xbe45('0x20')](_0x1883df,_0x9385d3,!![]);}catch(_0x19dd8e){return BPromise[_0xbe45('0x21')](_0x19dd8e);}return _0x1883df['save']();};}function saveUpdates(_0x565763,_0x243c0d){return function(_0x1d20af){if(_0x1d20af){return _0x1d20af[_0xbe45('0x22')](_0x565763)[_0xbe45('0x23')](function(_0x36277b){return _0x36277b;});}return null;};}function removeEntity(_0x53f799,_0x5e5546){return function(_0x54a062){if(_0x54a062){return _0x54a062[_0xbe45('0x24')]()['then'](function(){var _0x1f009b=_0x54a062['get']({'plain':!![]});var _0x142d0e=_0xbe45('0x25');return db[_0xbe45('0x26')]['destroy']({'where':{'type':_0x142d0e,'resourceId':_0x1f009b['id']}})[_0xbe45('0x23')](function(){return _0x54a062;});})[_0xbe45('0x23')](function(){_0x53f799[_0xbe45('0x19')](0xcc)[_0xbe45('0x18')]();});}};}function handleEntityNotFound(_0x1878a8,_0x5f393f){return function(_0x11a1b8){if(!_0x11a1b8){_0x1878a8[_0xbe45('0x17')](0x194);}return _0x11a1b8;};}function handleError(_0x8f8bd2,_0xe25fd0){_0xe25fd0=_0xe25fd0||0x1f4;return function(_0x3488c0){logger[_0xbe45('0x27')](_0x3488c0['stack']);if(_0x3488c0[_0xbe45('0x28')]){delete _0x3488c0[_0xbe45('0x28')];}_0x8f8bd2['status'](_0xe25fd0)[_0xbe45('0x29')](_0x3488c0);};}exports[_0xbe45('0x2a')]=function(_0x27d482,_0xa341d7){var _0xdb46a={},_0x2564b7={},_0x2ead8b={'count':0x0,'rows':[]};var _0x431be5=_[_0xbe45('0x2b')](db['Variable'][_0xbe45('0x2c')],function(_0x3a11c){return{'name':_0x3a11c['fieldName'],'type':_0x3a11c[_0xbe45('0x2d')][_0xbe45('0x2e')]};});_0x2564b7['model']=_['map'](_0x431be5,_0xbe45('0x28'));_0x2564b7[_0xbe45('0x2f')]=_[_0xbe45('0x30')](_0x27d482['query']);_0x2564b7[_0xbe45('0x31')]=_[_0xbe45('0x32')](_0x2564b7['model'],_0x2564b7['query']);_0xdb46a[_0xbe45('0x33')]=_['intersection'](_0x2564b7[_0xbe45('0x34')],qs['fields'](_0x27d482['query'][_0xbe45('0x35')]));_0xdb46a['attributes']=_0xdb46a[_0xbe45('0x33')]['length']?_0xdb46a['attributes']:_0x2564b7['model'];if(!_0x27d482['query']['hasOwnProperty'](_0xbe45('0x36'))){_0xdb46a[_0xbe45('0x1d')]=qs[_0xbe45('0x1d')](_0x27d482['query']['limit']);_0xdb46a['offset']=qs[_0xbe45('0x1c')](_0x27d482[_0xbe45('0x2f')][_0xbe45('0x1c')]);}_0xdb46a['order']=qs['sort'](_0x27d482[_0xbe45('0x2f')]['sort']);_0xdb46a[_0xbe45('0x37')]=qs['filters'](_[_0xbe45('0x38')](_0x27d482[_0xbe45('0x2f')],_0x2564b7[_0xbe45('0x31')]),_0x431be5);if(_0x27d482[_0xbe45('0x2f')][_0xbe45('0x39')]){_0xdb46a[_0xbe45('0x37')]=_[_0xbe45('0x3a')](_0xdb46a['where'],{'$or':_[_0xbe45('0x2b')](_0x431be5,function(_0x14ba6c){if(_0x14ba6c[_0xbe45('0x2d')]!==_0xbe45('0x3b')){var _0x2a1dfd={};_0x2a1dfd[_0x14ba6c['name']]={'$like':'%'+_0x27d482['query'][_0xbe45('0x39')]+'%'};return _0x2a1dfd;}})});}_0xdb46a=_[_0xbe45('0x3a')]({},_0xdb46a,_0x27d482[_0xbe45('0x3c')]);var _0x3be697={'where':_0xdb46a['where']};return db[_0xbe45('0x3d')][_0xbe45('0x1b')](_0x3be697)[_0xbe45('0x23')](function(_0x7fb375){_0x2ead8b[_0xbe45('0x1b')]=_0x7fb375;if(_0x27d482[_0xbe45('0x2f')][_0xbe45('0x3e')]){_0xdb46a['include']=[{'all':!![]}];}return db[_0xbe45('0x3d')][_0xbe45('0x3f')](_0xdb46a);})[_0xbe45('0x23')](function(_0x1e6639){_0x2ead8b[_0xbe45('0x40')]=_0x1e6639;return _0x2ead8b;})[_0xbe45('0x23')](respondWithFilteredResult(_0xa341d7,_0xdb46a))[_0xbe45('0x41')](handleError(_0xa341d7,null));};exports[_0xbe45('0x42')]=function(_0x5ed2ce,_0x333267){var _0x1d021e={'raw':!![],'where':{'id':_0x5ed2ce['params']['id']}},_0x425704={};_0x425704[_0xbe45('0x34')]=_[_0xbe45('0x30')](db['Variable'][_0xbe45('0x2c')]);_0x425704[_0xbe45('0x2f')]=_[_0xbe45('0x30')](_0x5ed2ce[_0xbe45('0x2f')]);_0x425704[_0xbe45('0x43')]=_[_0xbe45('0x32')](_0x425704[_0xbe45('0x34')],_0x425704[_0xbe45('0x2f')]);_0x1d021e[_0xbe45('0x33')]=_['intersection'](_0x425704[_0xbe45('0x34')],qs[_0xbe45('0x35')](_0x5ed2ce[_0xbe45('0x2f')]['fields']));_0x1d021e['attributes']=_0x1d021e[_0xbe45('0x33')][_0xbe45('0x44')]?_0x1d021e[_0xbe45('0x33')]:_0x425704[_0xbe45('0x34')];if(_0x5ed2ce[_0xbe45('0x2f')][_0xbe45('0x3e')]){_0x1d021e['include']=[{'all':!![]}];}_0x1d021e=_[_0xbe45('0x3a')]({},_0x1d021e,_0x5ed2ce['options']);return db[_0xbe45('0x3d')][_0xbe45('0x45')](_0x1d021e)[_0xbe45('0x23')](handleEntityNotFound(_0x333267,null))[_0xbe45('0x23')](respondWithResult(_0x333267,null))[_0xbe45('0x41')](handleError(_0x333267,null));};exports[_0xbe45('0x46')]=function(_0x13abe7,_0x153c90){return db[_0xbe45('0x3d')][_0xbe45('0x46')](_0x13abe7[_0xbe45('0x47')],{})['then'](function(_0x5e1a28){var _0x2397f0=_0x13abe7[_0xbe45('0x48')][_0xbe45('0x49')]({'plain':!![]});if(!_0x2397f0)throw new Error(_0xbe45('0x4a'));if(_0x2397f0[_0xbe45('0x4b')]===_0xbe45('0x48')){var _0x4bc760=_0x5e1a28[_0xbe45('0x49')]({'plain':!![]});var _0x2b1207='Variables';return db[_0xbe45('0x4c')][_0xbe45('0x45')]({'where':{'name':_0x2b1207,'userProfileId':_0x2397f0[_0xbe45('0x4d')]},'raw':!![]})[_0xbe45('0x23')](function(_0x16e367){if(_0x16e367&&_0x16e367['autoAssociation']===0x0){return db[_0xbe45('0x26')]['create']({'name':_0x4bc760[_0xbe45('0x28')],'resourceId':_0x4bc760['id'],'type':_0x16e367[_0xbe45('0x28')],'sectionId':_0x16e367['id']},{})['then'](function(){return _0x5e1a28;});}else{return _0x5e1a28;}})['catch'](function(_0x1e02cb){logger[_0xbe45('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e02cb);throw _0x1e02cb;});}return _0x5e1a28;})[_0xbe45('0x23')](respondWithResult(_0x153c90,0xc9))[_0xbe45('0x41')](handleError(_0x153c90,null));};exports[_0xbe45('0x22')]=function(_0x14bbae,_0x5aeb60){if(_0x14bbae[_0xbe45('0x47')]['id']){delete _0x14bbae[_0xbe45('0x47')]['id'];}return db[_0xbe45('0x3d')]['find']({'where':{'id':_0x14bbae['params']['id']}})[_0xbe45('0x23')](handleEntityNotFound(_0x5aeb60,null))[_0xbe45('0x23')](saveUpdates(_0x14bbae[_0xbe45('0x47')],null))['then'](respondWithResult(_0x5aeb60,null))['catch'](handleError(_0x5aeb60,null));};exports[_0xbe45('0x24')]=function(_0x18da22,_0x10d604){return db[_0xbe45('0x3d')]['find']({'where':{'id':_0x18da22[_0xbe45('0x4e')]['id']}})['then'](handleEntityNotFound(_0x10d604,null))[_0xbe45('0x23')](removeEntity(_0x10d604,null))[_0xbe45('0x41')](handleError(_0x10d604,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index ef44b33..e739359 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 _0x03bc=['bluebird','path','rimraf','../../config/environment','./variable.attributes','exports','Variable','tools_variables','lodash','../../config/logger','api'];(function(_0x23f456,_0x20150a){var _0x24554f=function(_0x59a4d5){while(--_0x59a4d5){_0x23f456['push'](_0x23f456['shift']());}};_0x24554f(++_0x20150a);}(_0x03bc,0xb8));var _0xc03b=function(_0x897ec9,_0xa15d6c){_0x897ec9=_0x897ec9-0x0;var _0x261ee7=_0x03bc[_0x897ec9];return _0x261ee7;};'use strict';var _=require(_0xc03b('0x0'));var util=require('util');var logger=require(_0xc03b('0x1'))(_0xc03b('0x2'));var moment=require('moment');var BPromise=require(_0xc03b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc03b('0x4'));var rimraf=require(_0xc03b('0x5'));var config=require(_0xc03b('0x6'));var attributes=require(_0xc03b('0x7'));module[_0xc03b('0x8')]=function(_0x48e3de,_0x31eda8){return _0x48e3de['define'](_0xc03b('0x9'),attributes,{'tableName':_0xc03b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc40b=['../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','Variable','lodash'];(function(_0x28a327,_0x2e1313){var _0x127420=function(_0xe10d4){while(--_0xe10d4){_0x28a327['push'](_0x28a327['shift']());}};_0x127420(++_0x2e1313);}(_0xc40b,0x95));var _0xbc40=function(_0x29222b,_0x190e44){_0x29222b=_0x29222b-0x0;var _0x24b5e2=_0xc40b[_0x29222b];return _0x24b5e2;};'use strict';var _=require(_0xbc40('0x0'));var util=require('util');var logger=require(_0xbc40('0x1'))(_0xbc40('0x2'));var moment=require('moment');var BPromise=require(_0xbc40('0x3'));var rp=require(_0xbc40('0x4'));var fs=require('fs');var path=require(_0xbc40('0x5'));var rimraf=require(_0xbc40('0x6'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0xbc40('0x7')]=function(_0x300dbb,_0x1a8dab){return _0x300dbb[_0xbc40('0x8')](_0xbc40('0x9'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index bf31211..4c84977 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 _0x95d4=['Variable','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable'];(function(_0x5373df,_0x299edb){var _0x10534c=function(_0x31e34f){while(--_0x31e34f){_0x5373df['push'](_0x5373df['shift']());}};_0x10534c(++_0x299edb);}(_0x95d4,0x13b));var _0x495d=function(_0x2c90c1,_0x446eda){_0x2c90c1=_0x2c90c1-0x0;var _0xcb55d4=_0x95d4[_0x2c90c1];return _0xcb55d4;};'use strict';var _=require(_0x495d('0x0'));var util=require(_0x495d('0x1'));var moment=require(_0x495d('0x2'));var BPromise=require(_0x495d('0x3'));var rs=require(_0x495d('0x4'));var fs=require('fs');var Redis=require(_0x495d('0x5'));var db=require(_0x495d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x495d('0x7'))(_0x495d('0x8'));var config=require(_0x495d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x495d('0xa')][_0x495d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ff195,_0x16eadb,_0x2f1720){return new BPromise(function(_0x4a31dd,_0x4b5508){return client[_0x495d('0xc')](_0x5ff195,_0x2f1720)[_0x495d('0xd')](function(_0x28a586){logger[_0x495d('0xe')](_0x495d('0xf'),_0x16eadb,_0x495d('0x10'));logger[_0x495d('0x11')](_0x495d('0x12'),_0x16eadb,_0x495d('0x10'),JSON[_0x495d('0x13')](_0x28a586));if(_0x28a586['error']){if(_0x28a586[_0x495d('0x14')]['code']===0x1f4){logger['error'](_0x495d('0xf'),_0x16eadb,_0x28a586[_0x495d('0x14')][_0x495d('0x15')]);return _0x4b5508(_0x28a586[_0x495d('0x14')]['message']);}logger[_0x495d('0x14')](_0x495d('0xf'),_0x16eadb,_0x28a586[_0x495d('0x14')][_0x495d('0x15')]);return _0x4a31dd(_0x28a586[_0x495d('0x14')][_0x495d('0x15')]);}else{logger['info'](_0x495d('0xf'),_0x16eadb,_0x495d('0x10'));_0x4a31dd(_0x28a586[_0x495d('0x16')][_0x495d('0x15')]);}})[_0x495d('0x17')](function(_0x369483){logger[_0x495d('0x14')]('Variable,\x20%s,\x20%s',_0x16eadb,_0x369483);_0x4b5508(_0x369483);});});}exports[_0x495d('0x18')]=function(_0x2ba71a){var _0x5267bb=this;return new Promise(function(_0x26547c,_0x2ebbd1){return db[_0x495d('0x19')][_0x495d('0x1a')]({'raw':_0x2ba71a[_0x495d('0x1b')]?_0x2ba71a['options'][_0x495d('0x1c')]===undefined?!![]:![]:!![],'where':_0x2ba71a[_0x495d('0x1b')]?_0x2ba71a[_0x495d('0x1b')][_0x495d('0x1d')]||null:null,'attributes':_0x2ba71a[_0x495d('0x1b')]?_0x2ba71a[_0x495d('0x1b')][_0x495d('0x1e')]||null:null,'include':_0x2ba71a[_0x495d('0x1b')]?_0x2ba71a['options'][_0x495d('0x1f')]?_[_0x495d('0x20')](_0x2ba71a[_0x495d('0x1b')][_0x495d('0x1f')],function(_0x30183b){return{'model':db[_0x30183b[_0x495d('0x21')]],'as':_0x30183b['as'],'attributes':_0x30183b['attributes'],'include':_0x30183b['include']?_[_0x495d('0x20')](_0x30183b[_0x495d('0x1f')],function(_0x47e0c8){return{'model':db[_0x47e0c8['model']],'as':_0x47e0c8['as'],'attributes':_0x47e0c8[_0x495d('0x1e')],'include':_0x47e0c8[_0x495d('0x1f')]?_[_0x495d('0x20')](_0x47e0c8[_0x495d('0x1f')],function(_0x30600f){return{'model':db[_0x30600f[_0x495d('0x21')]],'as':_0x30600f['as'],'attributes':_0x30600f[_0x495d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ead73){logger[_0x495d('0xe')](_0x495d('0x18'),_0x2ba71a);logger['debug']('ShowVariable',_0x2ba71a,JSON[_0x495d('0x13')](_0x4ead73));_0x26547c(_0x4ead73);})['catch'](function(_0x356752){logger['error']('ShowVariable',_0x356752['message'],_0x2ba71a);_0x2ebbd1(_0x5267bb[_0x495d('0x14')](0x1f4,_0x356752['message']));});});}; \ No newline at end of file +var _0x6a81=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','Variable,\x20%s,\x20%s','message','result','catch','ShowVariable','Variable','options','raw','where','attributes','include','map','model','lodash'];(function(_0x4a51e6,_0x521fec){var _0x5989c1=function(_0x26e837){while(--_0x26e837){_0x4a51e6['push'](_0x4a51e6['shift']());}};_0x5989c1(++_0x521fec);}(_0x6a81,0x65));var _0x16a8=function(_0x4831ae,_0x38e48){_0x4831ae=_0x4831ae-0x0;var _0x1fc77e=_0x6a81[_0x4831ae];return _0x1fc77e;};'use strict';var _=require(_0x16a8('0x0'));var util=require(_0x16a8('0x1'));var moment=require(_0x16a8('0x2'));var BPromise=require(_0x16a8('0x3'));var rs=require(_0x16a8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16a8('0x5'))['db'];var utils=require(_0x16a8('0x6'));var logger=require(_0x16a8('0x7'))(_0x16a8('0x8'));var config=require(_0x16a8('0x9'));var jayson=require(_0x16a8('0xa'));var client=jayson[_0x16a8('0xb')][_0x16a8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f44d6,_0x33f038,_0x2974a0){return new BPromise(function(_0x37c704,_0x57c6f4){return client[_0x16a8('0xd')](_0x4f44d6,_0x2974a0)['then'](function(_0xc7887d){logger[_0x16a8('0xe')]('Variable,\x20%s,\x20%s',_0x33f038,_0x16a8('0xf'));logger[_0x16a8('0x10')](_0x16a8('0x11'),_0x33f038,'request\x20sent',JSON[_0x16a8('0x12')](_0xc7887d));if(_0xc7887d[_0x16a8('0x13')]){if(_0xc7887d['error'][_0x16a8('0x14')]===0x1f4){logger[_0x16a8('0x13')](_0x16a8('0x15'),_0x33f038,_0xc7887d[_0x16a8('0x13')][_0x16a8('0x16')]);return _0x57c6f4(_0xc7887d[_0x16a8('0x13')]['message']);}logger[_0x16a8('0x13')]('Variable,\x20%s,\x20%s',_0x33f038,_0xc7887d[_0x16a8('0x13')]['message']);return _0x37c704(_0xc7887d['error'][_0x16a8('0x16')]);}else{logger[_0x16a8('0xe')](_0x16a8('0x15'),_0x33f038,'request\x20sent');_0x37c704(_0xc7887d[_0x16a8('0x17')][_0x16a8('0x16')]);}})[_0x16a8('0x18')](function(_0xa9d711){logger['error']('Variable,\x20%s,\x20%s',_0x33f038,_0xa9d711);_0x57c6f4(_0xa9d711);});});}exports[_0x16a8('0x19')]=function(_0x112424){var _0x3e758e=this;return new Promise(function(_0xcef229,_0x51e6cb){return db[_0x16a8('0x1a')]['find']({'raw':_0x112424['options']?_0x112424[_0x16a8('0x1b')][_0x16a8('0x1c')]===undefined?!![]:![]:!![],'where':_0x112424['options']?_0x112424[_0x16a8('0x1b')][_0x16a8('0x1d')]||null:null,'attributes':_0x112424[_0x16a8('0x1b')]?_0x112424['options'][_0x16a8('0x1e')]||null:null,'include':_0x112424[_0x16a8('0x1b')]?_0x112424[_0x16a8('0x1b')][_0x16a8('0x1f')]?_[_0x16a8('0x20')](_0x112424[_0x16a8('0x1b')]['include'],function(_0x2109e9){return{'model':db[_0x2109e9[_0x16a8('0x21')]],'as':_0x2109e9['as'],'attributes':_0x2109e9[_0x16a8('0x1e')],'include':_0x2109e9[_0x16a8('0x1f')]?_['map'](_0x2109e9[_0x16a8('0x1f')],function(_0x3820c3){return{'model':db[_0x3820c3['model']],'as':_0x3820c3['as'],'attributes':_0x3820c3[_0x16a8('0x1e')],'include':_0x3820c3[_0x16a8('0x1f')]?_[_0x16a8('0x20')](_0x3820c3[_0x16a8('0x1f')],function(_0x18a625){return{'model':db[_0x18a625[_0x16a8('0x21')]],'as':_0x18a625['as'],'attributes':_0x18a625['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f1ccb){logger[_0x16a8('0xe')]('ShowVariable',_0x112424);logger[_0x16a8('0x10')](_0x16a8('0x19'),_0x112424,JSON[_0x16a8('0x12')](_0x3f1ccb));_0xcef229(_0x3f1ccb);})[_0x16a8('0x18')](function(_0x53d722){logger[_0x16a8('0x13')](_0x16a8('0x19'),_0x53d722[_0x16a8('0x16')],_0x112424);_0x51e6cb(_0x3e758e[_0x16a8('0x13')](0x1f4,_0x53d722[_0x16a8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 65eb582..896de3a 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 _0xa7f1=['./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','/migrations','exports','Router'];(function(_0x2b4d3e,_0x28f4eb){var _0x5a9ad9=function(_0x136464){while(--_0x136464){_0x2b4d3e['push'](_0x2b4d3e['shift']());}};_0x5a9ad9(++_0x28f4eb);}(_0xa7f1,0x11c));var _0x1a7f=function(_0x2072f4,_0x1f2f7e){_0x2072f4=_0x2072f4-0x0;var _0x330448=_0xa7f1[_0x2072f4];return _0x330448;};'use strict';var express=require('express');var router=express[_0x1a7f('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x1a7f('0x1'));router[_0x1a7f('0x2')]('/',controller[_0x1a7f('0x3')]);router[_0x1a7f('0x2')](_0x1a7f('0x4'),auth[_0x1a7f('0x5')](),auth[_0x1a7f('0x6')](),controller[_0x1a7f('0x7')]);router[_0x1a7f('0x2')](_0x1a7f('0x8'),auth[_0x1a7f('0x5')](),auth['canUpdate'](),controller[_0x1a7f('0x9')]);router[_0x1a7f('0x2')](_0x1a7f('0xa'),auth['isAuthenticated'](),auth[_0x1a7f('0x6')](),controller[_0x1a7f('0xb')]);router[_0x1a7f('0x2')](_0x1a7f('0xc'),auth[_0x1a7f('0x5')](),controller['restart']);router[_0x1a7f('0x2')](_0x1a7f('0xd'),controller['migrations']);module[_0x1a7f('0xe')]=router; \ No newline at end of file +var _0x5289=['restart','/migrations','exports','express','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','pull','/restart'];(function(_0x3c10b7,_0x10fb4a){var _0xbd891b=function(_0x256dc3){while(--_0x256dc3){_0x3c10b7['push'](_0x3c10b7['shift']());}};_0xbd891b(++_0x10fb4a);}(_0x5289,0x163));var _0x9528=function(_0x2f0e7d,_0x41bf2c){_0x2f0e7d=_0x2f0e7d-0x0;var _0x314812=_0x5289[_0x2f0e7d];return _0x314812;};'use strict';var express=require(_0x9528('0x0'));var router=express['Router']();var auth=require(_0x9528('0x1'));var controller=require(_0x9528('0x2'));router[_0x9528('0x3')]('/',controller[_0x9528('0x4')]);router[_0x9528('0x3')](_0x9528('0x5'),auth[_0x9528('0x6')](),auth[_0x9528('0x7')](),controller[_0x9528('0x8')]);router[_0x9528('0x3')](_0x9528('0x9'),auth[_0x9528('0x6')](),auth[_0x9528('0x7')](),controller[_0x9528('0xa')]);router['get']('/pull',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x9528('0xb')]);router['get'](_0x9528('0xc'),auth['isAuthenticated'](),controller[_0x9528('0xd')]);router[_0x9528('0x3')](_0x9528('0xe'),controller['migrations']);module[_0x9528('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index cd48171..27226f1 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 _0x8fcd=['map','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','index','exports','latest','status','json','fetch','origin','master','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','info','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','length','.js','push','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8fcd,0xa1));var _0xd8fc=function(_0x5e982e,_0x4e2189){_0x5e982e=_0x5e982e-0x0;var _0x4664af=_0x8fcd[_0x5e982e];return _0x4664af;};'use strict';var Umzug=require(_0xd8fc('0x0'));var path=require(_0xd8fc('0x1'));var fs=require('fs');var _=require(_0xd8fc('0x2'));var pkginfo=require(_0xd8fc('0x3'))(module,_0xd8fc('0x4'));var compareVersions=require('compare-versions');var exec=require('child_process')[_0xd8fc('0x5')];var db=require(_0xd8fc('0x6'))['db'];var config=require(_0xd8fc('0x7'));var pm2=require(_0xd8fc('0x8'));var logger=require(_0xd8fc('0x9'))(_0xd8fc('0xa'));var git=require('simple-git')(config['root']);exports[_0xd8fc('0xb')]=function(_0x507323,_0x331add){var _0x1519e5={'current':module[_0xd8fc('0xc')][_0xd8fc('0x4')],'phonebar':0x2};if(_0x507323['query']&&_0x507323['query'][_0xd8fc('0xd')]){return git['fetch']()['tags'](function(_0x1a1927,_0x121b64){_0x1519e5['latest']=(_0x1a1927?module['exports'][_0xd8fc('0x4')]:_0x121b64[_0xd8fc('0xd')])||'2.0.0';return _0x331add[_0xd8fc('0xe')](0xc8)[_0xd8fc('0xf')](_0x1519e5);});}else{return _0x331add[_0xd8fc('0xe')](0xc8)[_0xd8fc('0xf')](_0x1519e5);}};exports[_0xd8fc('0x10')]=function(_0x5c20f1,_0x32b375){return git['fetch']([_0xd8fc('0x11'),_0xd8fc('0x12')],function(_0x3216bf){if(_0x3216bf){logger['error'](_0x3216bf);return _0x32b375[_0xd8fc('0xe')](0x1f4)[_0xd8fc('0xf')](_0x3216bf);}logger['info']('git\x20fetch');return _0x32b375[_0xd8fc('0xe')](0xc8)[_0xd8fc('0xf')]({'output':_0xd8fc('0x13')});});};exports['reset']=function(_0x1dad5b,_0x1c744d){return git[_0xd8fc('0x14')]([_0xd8fc('0x15'),_0xd8fc('0x16')],function(_0x373654){if(_0x373654){logger[_0xd8fc('0x17')](_0x373654);return _0x1c744d[_0xd8fc('0xe')](0x1f4)[_0xd8fc('0xf')](_0x373654);}logger['info'](_0xd8fc('0x18'));return _0x1c744d[_0xd8fc('0xe')](0xc8)[_0xd8fc('0xf')]({'output':_0xd8fc('0x19')});});};exports[_0xd8fc('0x1a')]=function(_0xd24b3f,_0x4fec5c){exec(_0xd8fc('0x1b'),function(_0x3f0196,_0x5cd1f9,_0x37a93b){logger['info'](_0x5cd1f9);logger[_0xd8fc('0x1c')](_0x37a93b);if(_0x3f0196){logger[_0xd8fc('0x17')](_0x3f0196);return _0x4fec5c['status'](0x1f4)['json'](_0x3f0196);}return _0x4fec5c['status'](0xc8)[_0xd8fc('0xf')]({'output':_0x5cd1f9});});};exports[_0xd8fc('0x1d')]=function(_0x18fd3a,_0x25d8ae){return pm2['restart'](_0xd8fc('0x1e'))[_0xd8fc('0x1f')](function(_0x54f1a5){logger[_0xd8fc('0x1c')]('pm2\x20restart\x20motion\x20%s',_0x54f1a5);return _0x25d8ae[_0xd8fc('0xe')](0xc8)[_0xd8fc('0xf')]({'output':_0xd8fc('0x20')});})[_0xd8fc('0x21')](function(_0x58718b){logger[_0xd8fc('0x17')](_0x58718b);return _0x25d8ae['status'](0x1f4)[_0xd8fc('0xf')](_0x58718b);});};exports[_0xd8fc('0x22')]=function(_0x4e823d,_0x4a5383){var _0x56a980=fs[_0xd8fc('0x23')](path[_0xd8fc('0x24')](config[_0xd8fc('0x25')],_0xd8fc('0x26'),_0xd8fc('0x22')));var _0x281559=[];for(var _0x55bfcc=0x0;_0x55bfcc<_0x56a980[_0xd8fc('0x27')];_0x55bfcc++){var _0x446609=_0x56a980[_0x55bfcc]['replace'](_0xd8fc('0x28'),'');if(compareVersions(module[_0xd8fc('0xc')]['version'],_0x446609)===-0x1){_0x281559[_0xd8fc('0x29')](_0x446609);}}if(_0x281559[_0xd8fc('0x27')]){var _0x152087=_0x281559['sort'](compareVersions);var _0xf77e6b=new Umzug({'storage':_0xd8fc('0x2a'),'storageOptions':{'model':db[_0xd8fc('0x2b')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db['sequelize'][_0xd8fc('0x2c')](),db[_0xd8fc('0x2a')][_0xd8fc('0x2d')],function(){throw new Error(_0xd8fc('0x2e'));}],'path':path[_0xd8fc('0x24')](config[_0xd8fc('0x25')],_0xd8fc('0x26'),_0xd8fc('0x22')),'pattern':/\.js$/}});_0xf77e6b['up']({'migrations':_[_0xd8fc('0x2f')](_0x152087,function(_0x4165d7){return _0x4165d7+'.js';})})[_0xd8fc('0x1f')](function(){return _0x4a5383['status'](0xc8)[_0xd8fc('0xf')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0xd8fc('0x4')]+_0xd8fc('0x30')+_[_0xd8fc('0x31')](_0x152087),'migrations':_[_0xd8fc('0x24')](_0x152087)});})[_0xd8fc('0x21')](function(_0x3aa3c7){if(_0x3aa3c7 instanceof db['sequelize'][_0xd8fc('0x32')]){return _0x4a5383[_0xd8fc('0xe')](0xc8)[_0xd8fc('0xf')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x4a5383[_0xd8fc('0xe')](0x1f4)[_0xd8fc('0xf')](_0x3aa3c7);}});}else{return _0x4a5383['status'](0xc8)['json']({'output':_0xd8fc('0x33')});}}; \ No newline at end of file +var _0xc2c7=['sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/logger','update','simple-git','exports','query','latest','fetch','tags','2.0.0','status','json','origin','master','git\x20fetch','reset','--hard','FETCH_HEAD','error','info','git\x20reset\x20--hard\x20FETCH_HEAD','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','join','root','server','length','replace','.js','sort'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3df3a0,_0x2b5251){_0x3df3a0=_0x3df3a0-0x0;var _0x46e7b6=_0xc2c7[_0x3df3a0];return _0x46e7b6;};'use strict';var Umzug=require('umzug');var path=require(_0x7c2c('0x0'));var fs=require('fs');var _=require(_0x7c2c('0x1'));var pkginfo=require(_0x7c2c('0x2'))(module,_0x7c2c('0x3'));var compareVersions=require(_0x7c2c('0x4'));var exec=require(_0x7c2c('0x5'))[_0x7c2c('0x6')];var db=require(_0x7c2c('0x7'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require(_0x7c2c('0x8'))(_0x7c2c('0x9'));var git=require(_0x7c2c('0xa'))(config['root']);exports['index']=function(_0x5a1027,_0x2274cd){var _0x29638d={'current':module[_0x7c2c('0xb')][_0x7c2c('0x3')],'phonebar':0x2};if(_0x5a1027[_0x7c2c('0xc')]&&_0x5a1027['query'][_0x7c2c('0xd')]){return git[_0x7c2c('0xe')]()[_0x7c2c('0xf')](function(_0x1bfeaf,_0x2587ec){_0x29638d[_0x7c2c('0xd')]=(_0x1bfeaf?module[_0x7c2c('0xb')][_0x7c2c('0x3')]:_0x2587ec[_0x7c2c('0xd')])||_0x7c2c('0x10');return _0x2274cd[_0x7c2c('0x11')](0xc8)[_0x7c2c('0x12')](_0x29638d);});}else{return _0x2274cd[_0x7c2c('0x11')](0xc8)[_0x7c2c('0x12')](_0x29638d);}};exports[_0x7c2c('0xe')]=function(_0x29fe58,_0x4c4aaf){return git['fetch']([_0x7c2c('0x13'),_0x7c2c('0x14')],function(_0x4678a8){if(_0x4678a8){logger['error'](_0x4678a8);return _0x4c4aaf[_0x7c2c('0x11')](0x1f4)[_0x7c2c('0x12')](_0x4678a8);}logger['info'](_0x7c2c('0x15'));return _0x4c4aaf['status'](0xc8)[_0x7c2c('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x7c2c('0x16')]=function(_0x3c948a,_0x14453f){return git[_0x7c2c('0x16')]([_0x7c2c('0x17'),_0x7c2c('0x18')],function(_0x2c1378){if(_0x2c1378){logger[_0x7c2c('0x19')](_0x2c1378);return _0x14453f[_0x7c2c('0x11')](0x1f4)[_0x7c2c('0x12')](_0x2c1378);}logger[_0x7c2c('0x1a')](_0x7c2c('0x1b'));return _0x14453f['status'](0xc8)[_0x7c2c('0x12')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x15ae33,_0x3a71d7){exec(_0x7c2c('0x1c'),function(_0x38ae30,_0x41552f,_0x1883b5){logger[_0x7c2c('0x1a')](_0x41552f);logger['info'](_0x1883b5);if(_0x38ae30){logger[_0x7c2c('0x19')](_0x38ae30);return _0x3a71d7['status'](0x1f4)[_0x7c2c('0x12')](_0x38ae30);}return _0x3a71d7['status'](0xc8)[_0x7c2c('0x12')]({'output':_0x41552f});});};exports[_0x7c2c('0x1d')]=function(_0x3126d,_0x481867){return pm2['restart'](_0x7c2c('0x1e'))[_0x7c2c('0x1f')](function(_0x3d2b8d){logger[_0x7c2c('0x1a')](_0x7c2c('0x20'),_0x3d2b8d);return _0x481867[_0x7c2c('0x11')](0xc8)[_0x7c2c('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x7c2c('0x21')](function(_0xf39941){logger[_0x7c2c('0x19')](_0xf39941);return _0x481867[_0x7c2c('0x11')](0x1f4)[_0x7c2c('0x12')](_0xf39941);});};exports[_0x7c2c('0x22')]=function(_0xf2bfd1,_0x26f472){var _0xa040ff=fs['readdirSync'](path[_0x7c2c('0x23')](config[_0x7c2c('0x24')],_0x7c2c('0x25'),_0x7c2c('0x22')));var _0x53ad23=[];for(var _0xcb98ba=0x0;_0xcb98ba<_0xa040ff[_0x7c2c('0x26')];_0xcb98ba++){var _0x4192c8=_0xa040ff[_0xcb98ba][_0x7c2c('0x27')](_0x7c2c('0x28'),'');if(compareVersions(module[_0x7c2c('0xb')][_0x7c2c('0x3')],_0x4192c8)===-0x1){_0x53ad23['push'](_0x4192c8);}}if(_0x53ad23[_0x7c2c('0x26')]){var _0x1acf75=_0x53ad23[_0x7c2c('0x29')](compareVersions);var _0x1a8fce=new Umzug({'storage':_0x7c2c('0x2a'),'storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0x7c2c('0x3')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db[_0x7c2c('0x2a')][_0x7c2c('0x2b')],function(){throw new Error(_0x7c2c('0x2c'));}],'path':path[_0x7c2c('0x23')](config['root'],_0x7c2c('0x25'),_0x7c2c('0x22')),'pattern':/\.js$/}});_0x1a8fce['up']({'migrations':_[_0x7c2c('0x2d')](_0x1acf75,function(_0x19783d){return _0x19783d+_0x7c2c('0x28');})})[_0x7c2c('0x1f')](function(){return _0x26f472[_0x7c2c('0x11')](0xc8)[_0x7c2c('0x12')]({'output':_0x7c2c('0x2e')+module[_0x7c2c('0xb')][_0x7c2c('0x3')]+_0x7c2c('0x2f')+_[_0x7c2c('0x30')](_0x1acf75),'migrations':_['join'](_0x1acf75)});})['catch'](function(_0x3cd30d){if(_0x3cd30d instanceof db['sequelize']['UniqueConstraintError']){return _0x26f472['status'](0xc8)[_0x7c2c('0x12')]({'output':_0x7c2c('0x31')});}else{return _0x26f472[_0x7c2c('0x11')](0x1f4)[_0x7c2c('0x12')](_0x3cd30d);}});}else{return _0x26f472[_0x7c2c('0x11')](0xc8)[_0x7c2c('0x12')]({'output':_0x7c2c('0x31')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 71982f3..79091f6 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 _0xb045=['post','create','put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show'];(function(_0x5be228,_0x356a54){var _0x48ce9b=function(_0x3a9801){while(--_0x3a9801){_0x5be228['push'](_0x5be228['shift']());}};_0x48ce9b(++_0x356a54);}(_0xb045,0x84));var _0x5b04=function(_0x1b745b,_0x3e2d40){_0x1b745b=_0x1b745b-0x0;var _0x120a9d=_0xb045[_0x1b745b];return _0x120a9d;};'use strict';var multer=require(_0x5b04('0x0'));var util=require(_0x5b04('0x1'));var path=require(_0x5b04('0x2'));var timeout=require(_0x5b04('0x3'));var express=require(_0x5b04('0x4'));var router=express[_0x5b04('0x5')]();var auth=require(_0x5b04('0x6'));var interaction=require(_0x5b04('0x7'));var config=require(_0x5b04('0x8'));var controller=require('./voiceAgentReport.controller');router[_0x5b04('0x9')]('/',auth[_0x5b04('0xa')](),controller[_0x5b04('0xb')]);router[_0x5b04('0x9')](_0x5b04('0xc'),auth['isAuthenticated'](),controller[_0x5b04('0xd')]);router[_0x5b04('0x9')]('/:id',auth[_0x5b04('0xa')](),controller[_0x5b04('0xe')]);router[_0x5b04('0xf')]('/',auth[_0x5b04('0xa')](),controller[_0x5b04('0x10')]);router[_0x5b04('0x11')](_0x5b04('0x12'),auth[_0x5b04('0xa')](),controller['update']);router[_0x5b04('0x13')]('/:id',auth[_0x5b04('0xa')](),controller['destroy']);module[_0x5b04('0x14')]=router; \ No newline at end of file +var _0xd540=['post','put','update','delete','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','get','/describe','/:id'];(function(_0x2c085f,_0x4c8c74){var _0x2fe397=function(_0x49018f){while(--_0x49018f){_0x2c085f['push'](_0x2c085f['shift']());}};_0x2fe397(++_0x4c8c74);}(_0xd540,0x148));var _0x0d54=function(_0x32280a,_0xe52c98){_0x32280a=_0x32280a-0x0;var _0x4d0e19=_0xd540[_0x32280a];return _0x4d0e19;};'use strict';var multer=require(_0x0d54('0x0'));var util=require(_0x0d54('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d54('0x2')]();var auth=require(_0x0d54('0x3'));var interaction=require(_0x0d54('0x4'));var config=require(_0x0d54('0x5'));var controller=require(_0x0d54('0x6'));router['get']('/',auth[_0x0d54('0x7')](),controller[_0x0d54('0x8')]);router[_0x0d54('0x9')](_0x0d54('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0d54('0x9')](_0x0d54('0xb'),auth[_0x0d54('0x7')](),controller['show']);router[_0x0d54('0xc')]('/',auth[_0x0d54('0x7')](),controller['create']);router[_0x0d54('0xd')](_0x0d54('0xb'),auth[_0x0d54('0x7')](),controller[_0x0d54('0xe')]);router[_0x0d54('0xf')](_0x0d54('0xb'),auth[_0x0d54('0x7')](),controller['destroy']);module[_0x0d54('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 9d54f5f..0e7cfc8 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 _0x3eea=['INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','BOOLEAN'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x25921e,_0x244cfc){_0x25921e=_0x25921e-0x0;var _0x2bbc27=_0x3eea[_0x25921e];return _0x2bbc27;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'type':{'type':Sequelize[_0xa3ee('0x1')]},'uniqueid':{'type':Sequelize[_0xa3ee('0x1')]},'calleridnum':{'type':Sequelize[_0xa3ee('0x1')]},'calleridname':{'type':Sequelize[_0xa3ee('0x1')]},'queue':{'type':Sequelize[_0xa3ee('0x1')]},'interface':{'type':Sequelize[_0xa3ee('0x1')]},'membername':{'type':Sequelize[_0xa3ee('0x1')]},'agentcalledAt':{'type':Sequelize[_0xa3ee('0x2')]},'agentconnectAt':{'type':Sequelize[_0xa3ee('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xa3ee('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xa3ee('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xa3ee('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xa3ee('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xa3ee('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xa3ee('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa3ee('0x1')]},'channelstate':{'type':Sequelize[_0xa3ee('0x4')]},'channelstatedesc':{'type':Sequelize[_0xa3ee('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xa3ee('0x1')]},'language':{'type':Sequelize[_0xa3ee('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xa3ee('0x1')]},'priority':{'type':Sequelize[_0xa3ee('0x1')]},'destchannel':{'type':Sequelize[_0xa3ee('0x1')]},'destchannelstate':{'type':Sequelize[_0xa3ee('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xa3ee('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa3ee('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa3ee('0x1')]},'destlanguage':{'type':Sequelize[_0xa3ee('0x1')]},'destaccountcode':{'type':Sequelize[_0xa3ee('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xa3ee('0x1')]},'destpriority':{'type':Sequelize[_0xa3ee('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xa3ee('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa3ee('0x1')],'comment':_0xa3ee('0x5')},'transferexten':{'type':Sequelize[_0xa3ee('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xa3ee('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdbf5=['BOOLEAN','exports','STRING','DATE','INTEGER'];(function(_0x26742c,_0xe241ee){var _0x4d9df4=function(_0x5bf307){while(--_0x5bf307){_0x26742c['push'](_0x26742c['shift']());}};_0x4d9df4(++_0xe241ee);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x1edaa8,_0x4db38a){_0x1edaa8=_0x1edaa8-0x0;var _0x2d7f46=_0xdbf5[_0x1edaa8];return _0x2d7f46;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5dbf('0x1')]},'calleridname':{'type':Sequelize[_0x5dbf('0x1')]},'queue':{'type':Sequelize[_0x5dbf('0x1')]},'interface':{'type':Sequelize[_0x5dbf('0x1')]},'membername':{'type':Sequelize[_0x5dbf('0x1')]},'agentcalledAt':{'type':Sequelize[_0x5dbf('0x2')]},'agentconnectAt':{'type':Sequelize[_0x5dbf('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x5dbf('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x5dbf('0x2')]},'agentdumpAt':{'type':Sequelize[_0x5dbf('0x2')]},'holdtime':{'type':Sequelize[_0x5dbf('0x3')]},'agentcomplete':{'type':Sequelize[_0x5dbf('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x5dbf('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x5dbf('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5dbf('0x3')]},'reason':{'type':Sequelize[_0x5dbf('0x1')]},'lastevent':{'type':Sequelize[_0x5dbf('0x1')]},'channel':{'type':Sequelize[_0x5dbf('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x5dbf('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x5dbf('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5dbf('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x5dbf('0x1')]},'destchannelstate':{'type':Sequelize[_0x5dbf('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5dbf('0x1')]},'destcalleridnum':{'type':Sequelize[_0x5dbf('0x1')]},'destcalleridname':{'type':Sequelize[_0x5dbf('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x5dbf('0x1')]},'destaccountcode':{'type':Sequelize[_0x5dbf('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x5dbf('0x1')]},'destpriority':{'type':Sequelize[_0x5dbf('0x1')]},'destuniqueid':{'type':Sequelize[_0x5dbf('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x5dbf('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x5dbf('0x1')]},'transfer':{'type':Sequelize[_0x5dbf('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5dbf('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x5dbf('0x1')]},'agententerreason':{'type':Sequelize[_0x5dbf('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index b16c070..43abefa 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 _0xa887=['util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','apply','reject','save','update','then','name','VoiceAgentReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','filtears','find','create','body','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xa887,0x89));var _0x7a88=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa887[_0x491a7f];return _0x3d8f44;};'use strict';var pdf=require(_0x7a88('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7a88('0x1'));var zipdir=require(_0x7a88('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7a88('0x3'));var moment=require(_0x7a88('0x4'));var BPromise=require(_0x7a88('0x5'));var Mustache=require(_0x7a88('0x6'));var util=require(_0x7a88('0x7'));var path=require(_0x7a88('0x8'));var sox=require(_0x7a88('0x9'));var csv=require(_0x7a88('0xa'));var ejs=require(_0x7a88('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7a88('0xc'));var crypto=require(_0x7a88('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7a88('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7a88('0xf'));var Papa=require(_0x7a88('0x10'));var Redis=require(_0x7a88('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7a88('0x12'));var hardwareService=require(_0x7a88('0x13'));var logger=require(_0x7a88('0x14'))(_0x7a88('0x15'));var utils=require(_0x7a88('0x16'));var config=require(_0x7a88('0x17'));var licenseUtil=require(_0x7a88('0x18'));var db=require(_0x7a88('0x19'))['db'];function respondWithStatusCode(_0x495404,_0xd21d2f){_0xd21d2f=_0xd21d2f||0xcc;return function(_0x53f6f2){if(_0x53f6f2){return _0x495404[_0x7a88('0x1a')](_0xd21d2f);}return _0x495404[_0x7a88('0x1b')](_0xd21d2f)[_0x7a88('0x1c')]();};}function respondWithResult(_0xc4a939,_0x496ad9){_0x496ad9=_0x496ad9||0xc8;return function(_0x4023f9){if(_0x4023f9){return _0xc4a939['status'](_0x496ad9)[_0x7a88('0x1d')](_0x4023f9);}};}function respondWithFilteredResult(_0x48a79c,_0x5784d5){return function(_0x59b30a){if(_0x59b30a){var _0x129357=_0x59b30a[_0x7a88('0x1e')],_0x4c3436=_0x5784d5[_0x7a88('0x1f')],_0x267e3b=_0x5784d5[_0x7a88('0x1f')]+_0x5784d5['limit'],_0x71c7b9;if(_0x267e3b>=_0x129357){_0x267e3b=_0x129357;_0x71c7b9=0xc8;}else{_0x71c7b9=0xce;}_0x48a79c[_0x7a88('0x1b')](_0x71c7b9);return _0x48a79c['set']('Content-Range',_0x4c3436+'-'+_0x267e3b+'/'+_0x129357)[_0x7a88('0x1d')](_0x59b30a);}return null;};}function patchUpdates(_0x18744a){return function(_0x232a0e){try{jsonpatch[_0x7a88('0x20')](_0x232a0e,_0x18744a,!![]);}catch(_0x1ec86f){return BPromise[_0x7a88('0x21')](_0x1ec86f);}return _0x232a0e[_0x7a88('0x22')]();};}function saveUpdates(_0x9d9d08,_0xdd197f){return function(_0x420172){if(_0x420172){return _0x420172[_0x7a88('0x23')](_0x9d9d08)[_0x7a88('0x24')](function(_0x47e4fc){return _0x47e4fc;});}return null;};}function removeEntity(_0x505264,_0x41708d){return function(_0x384a2b){if(_0x384a2b){return _0x384a2b['destroy']()['then'](function(){_0x505264[_0x7a88('0x1b')](0xcc)[_0x7a88('0x1c')]();});}};}function handleEntityNotFound(_0x618fc,_0x26e424){return function(_0x5eb08f){if(!_0x5eb08f){_0x618fc[_0x7a88('0x1a')](0x194);}return _0x5eb08f;};}function handleError(_0x3aff3b,_0x3d1801){_0x3d1801=_0x3d1801||0x1f4;return function(_0x2a6f69){logger['error'](_0x2a6f69['stack']);if(_0x2a6f69[_0x7a88('0x25')]){delete _0x2a6f69['name'];}_0x3aff3b[_0x7a88('0x1b')](_0x3d1801)['send'](_0x2a6f69);};}exports['index']=function(_0x22029a,_0x1e01dd){var _0x157176={},_0xf6e9a4={},_0x10fcce={'count':0x0,'rows':[]};var _0x53e4ab=_['map'](db[_0x7a88('0x26')][_0x7a88('0x27')],function(_0x44f401){return{'name':_0x44f401[_0x7a88('0x28')],'type':_0x44f401[_0x7a88('0x29')][_0x7a88('0x2a')]};});_0xf6e9a4[_0x7a88('0x2b')]=_[_0x7a88('0x2c')](_0x53e4ab,_0x7a88('0x25'));_0xf6e9a4[_0x7a88('0x2d')]=_[_0x7a88('0x2e')](_0x22029a[_0x7a88('0x2d')]);_0xf6e9a4[_0x7a88('0x2f')]=_[_0x7a88('0x30')](_0xf6e9a4[_0x7a88('0x2b')],_0xf6e9a4[_0x7a88('0x2d')]);_0x157176['attributes']=_[_0x7a88('0x30')](_0xf6e9a4[_0x7a88('0x2b')],qs[_0x7a88('0x31')](_0x22029a[_0x7a88('0x2d')][_0x7a88('0x31')]));_0x157176[_0x7a88('0x32')]=_0x157176[_0x7a88('0x32')][_0x7a88('0x33')]?_0x157176['attributes']:_0xf6e9a4['model'];if(!_0x22029a[_0x7a88('0x2d')]['hasOwnProperty'](_0x7a88('0x34'))){_0x157176[_0x7a88('0x35')]=qs[_0x7a88('0x35')](_0x22029a[_0x7a88('0x2d')]['limit']);_0x157176[_0x7a88('0x1f')]=qs['offset'](_0x22029a[_0x7a88('0x2d')][_0x7a88('0x1f')]);}_0x157176[_0x7a88('0x36')]=qs['sort'](_0x22029a[_0x7a88('0x2d')][_0x7a88('0x37')]);_0x157176[_0x7a88('0x38')]=qs['filters'](_[_0x7a88('0x39')](_0x22029a[_0x7a88('0x2d')],_0xf6e9a4[_0x7a88('0x2f')]),_0x53e4ab);if(_0x22029a[_0x7a88('0x2d')]['filter']){_0x157176[_0x7a88('0x38')]=_[_0x7a88('0x3a')](_0x157176[_0x7a88('0x38')],{'$or':_[_0x7a88('0x2c')](_0x53e4ab,function(_0x3d640b){if(_0x3d640b['type']!=='VIRTUAL'){var _0x572324={};_0x572324[_0x3d640b[_0x7a88('0x25')]]={'$like':'%'+_0x22029a['query'][_0x7a88('0x3b')]+'%'};return _0x572324;}})});}_0x157176=_[_0x7a88('0x3a')]({},_0x157176,_0x22029a[_0x7a88('0x3c')]);var _0x3cf0fb={'where':_0x157176[_0x7a88('0x38')]};return db[_0x7a88('0x26')][_0x7a88('0x1e')](_0x3cf0fb)[_0x7a88('0x24')](function(_0x4d0be2){_0x10fcce[_0x7a88('0x1e')]=_0x4d0be2;if(_0x22029a[_0x7a88('0x2d')][_0x7a88('0x3d')]){_0x157176[_0x7a88('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x7a88('0x3f')](_0x157176);})['then'](function(_0x5aff6c){_0x10fcce['rows']=_0x5aff6c;return _0x10fcce;})[_0x7a88('0x24')](respondWithFilteredResult(_0x1e01dd,_0x157176))[_0x7a88('0x40')](handleError(_0x1e01dd,null));};exports[_0x7a88('0x41')]=function(_0x593ecb,_0x46e54f){var _0x102a45={'raw':![],'where':{'id':_0x593ecb[_0x7a88('0x42')]['id']}},_0x3e56ab={};_0x3e56ab[_0x7a88('0x2b')]=_[_0x7a88('0x2e')](db[_0x7a88('0x26')][_0x7a88('0x27')]);_0x3e56ab[_0x7a88('0x2d')]=_[_0x7a88('0x2e')](_0x593ecb[_0x7a88('0x2d')]);_0x3e56ab[_0x7a88('0x43')]=_['intersection'](_0x3e56ab[_0x7a88('0x2b')],_0x3e56ab[_0x7a88('0x2d')]);_0x102a45[_0x7a88('0x32')]=_[_0x7a88('0x30')](_0x3e56ab['model'],qs['fields'](_0x593ecb['query'][_0x7a88('0x31')]));_0x102a45[_0x7a88('0x32')]=_0x102a45[_0x7a88('0x32')][_0x7a88('0x33')]?_0x102a45['attributes']:_0x3e56ab['model'];if(_0x593ecb['query'][_0x7a88('0x3d')]){_0x102a45[_0x7a88('0x3e')]=[{'all':!![]}];}_0x102a45=_[_0x7a88('0x3a')]({},_0x102a45,_0x593ecb[_0x7a88('0x3c')]);return db[_0x7a88('0x26')][_0x7a88('0x44')](_0x102a45)[_0x7a88('0x24')](handleEntityNotFound(_0x46e54f,null))['then'](respondWithResult(_0x46e54f,null))['catch'](handleError(_0x46e54f,null));};exports[_0x7a88('0x45')]=function(_0xd920fc,_0x58c7b1){return db[_0x7a88('0x26')][_0x7a88('0x45')](_0xd920fc[_0x7a88('0x46')],{})[_0x7a88('0x24')](respondWithResult(_0x58c7b1,0xc9))[_0x7a88('0x40')](handleError(_0x58c7b1,null));};exports[_0x7a88('0x23')]=function(_0x55e5cc,_0x28f555){if(_0x55e5cc[_0x7a88('0x46')]['id']){delete _0x55e5cc[_0x7a88('0x46')]['id'];}return db[_0x7a88('0x26')]['find']({'where':{'id':_0x55e5cc[_0x7a88('0x42')]['id']}})['then'](handleEntityNotFound(_0x28f555,null))[_0x7a88('0x24')](saveUpdates(_0x55e5cc[_0x7a88('0x46')],null))[_0x7a88('0x24')](respondWithResult(_0x28f555,null))['catch'](handleError(_0x28f555,null));};exports['destroy']=function(_0x33e32f,_0x24ca0a){return db['VoiceAgentReport'][_0x7a88('0x44')]({'where':{'id':_0x33e32f[_0x7a88('0x42')]['id']}})['then'](handleEntityNotFound(_0x24ca0a,null))[_0x7a88('0x24')](removeEntity(_0x24ca0a,null))[_0x7a88('0x40')](handleError(_0x24ca0a,null));};exports[_0x7a88('0x47')]=function(_0xd2cc74,_0x2a685b){return db['VoiceAgentReport'][_0x7a88('0x47')]()[_0x7a88('0x24')](respondWithResult(_0x2a685b,null))[_0x7a88('0x40')](handleError(_0x2a685b,null));}; \ No newline at end of file +var _0x9b94=['merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','filtears','includeAll','create','update','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','apply','reject','then','destroy','error','stack','name','send','index','map','VoiceAgentReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','order','sort','pick','filters','filter','where'];(function(_0xab3410,_0x547a87){var _0x155e3d=function(_0x3aafe3){while(--_0x3aafe3){_0xab3410['push'](_0xab3410['shift']());}};_0x155e3d(++_0x547a87);}(_0x9b94,0x135));var _0x49b9=function(_0xdc3ff1,_0x1aa92d){_0xdc3ff1=_0xdc3ff1-0x0;var _0x9b98e6=_0x9b94[_0xdc3ff1];return _0x9b98e6;};'use strict';var pdf=require(_0x49b9('0x0'));var emlformat=require(_0x49b9('0x1'));var rimraf=require(_0x49b9('0x2'));var zipdir=require(_0x49b9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x49b9('0x4'));var moment=require('moment');var BPromise=require(_0x49b9('0x5'));var Mustache=require(_0x49b9('0x6'));var util=require(_0x49b9('0x7'));var path=require(_0x49b9('0x8'));var sox=require(_0x49b9('0x9'));var csv=require(_0x49b9('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x49b9('0xb'));var squel=require(_0x49b9('0xc'));var crypto=require(_0x49b9('0xd'));var jsforce=require(_0x49b9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x49b9('0xa'));var querystring=require(_0x49b9('0xf'));var Papa=require(_0x49b9('0x10'));var Redis=require(_0x49b9('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x49b9('0x12'));var hardwareService=require(_0x49b9('0x13'));var logger=require('../../config/logger')(_0x49b9('0x14'));var utils=require('../../config/utils');var config=require(_0x49b9('0x15'));var licenseUtil=require(_0x49b9('0x16'));var db=require(_0x49b9('0x17'))['db'];function respondWithStatusCode(_0x5041f6,_0xf81bef){_0xf81bef=_0xf81bef||0xcc;return function(_0x4fcd5b){if(_0x4fcd5b){return _0x5041f6[_0x49b9('0x18')](_0xf81bef);}return _0x5041f6[_0x49b9('0x19')](_0xf81bef)[_0x49b9('0x1a')]();};}function respondWithResult(_0x75381b,_0x1e8959){_0x1e8959=_0x1e8959||0xc8;return function(_0x50d2ad){if(_0x50d2ad){return _0x75381b[_0x49b9('0x19')](_0x1e8959)['json'](_0x50d2ad);}};}function respondWithFilteredResult(_0x28228e,_0x4ccd0f){return function(_0xa98e64){if(_0xa98e64){var _0x4d0db9=_0xa98e64['count'],_0x4d110b=_0x4ccd0f[_0x49b9('0x1b')],_0x4c8539=_0x4ccd0f[_0x49b9('0x1b')]+_0x4ccd0f[_0x49b9('0x1c')],_0x45d3e2;if(_0x4c8539>=_0x4d0db9){_0x4c8539=_0x4d0db9;_0x45d3e2=0xc8;}else{_0x45d3e2=0xce;}_0x28228e[_0x49b9('0x19')](_0x45d3e2);return _0x28228e['set']('Content-Range',_0x4d110b+'-'+_0x4c8539+'/'+_0x4d0db9)['json'](_0xa98e64);}return null;};}function patchUpdates(_0x4b4692){return function(_0xb8b442){try{jsonpatch[_0x49b9('0x1d')](_0xb8b442,_0x4b4692,!![]);}catch(_0x1f1238){return BPromise[_0x49b9('0x1e')](_0x1f1238);}return _0xb8b442['save']();};}function saveUpdates(_0x5781d5,_0x3377b7){return function(_0x200cd8){if(_0x200cd8){return _0x200cd8['update'](_0x5781d5)[_0x49b9('0x1f')](function(_0x12d205){return _0x12d205;});}return null;};}function removeEntity(_0x5a0850,_0xeab2ce){return function(_0x1b21be){if(_0x1b21be){return _0x1b21be[_0x49b9('0x20')]()[_0x49b9('0x1f')](function(){_0x5a0850['status'](0xcc)[_0x49b9('0x1a')]();});}};}function handleEntityNotFound(_0x556b3b,_0x4e03d1){return function(_0x5be6bd){if(!_0x5be6bd){_0x556b3b[_0x49b9('0x18')](0x194);}return _0x5be6bd;};}function handleError(_0x11cd0a,_0x5e17a0){_0x5e17a0=_0x5e17a0||0x1f4;return function(_0x1bf018){logger[_0x49b9('0x21')](_0x1bf018[_0x49b9('0x22')]);if(_0x1bf018['name']){delete _0x1bf018[_0x49b9('0x23')];}_0x11cd0a['status'](_0x5e17a0)[_0x49b9('0x24')](_0x1bf018);};}exports[_0x49b9('0x25')]=function(_0xca0caa,_0x2c162f){var _0x31ed76={},_0x2a5b4b={},_0x451143={'count':0x0,'rows':[]};var _0xb0e0f2=_[_0x49b9('0x26')](db[_0x49b9('0x27')][_0x49b9('0x28')],function(_0x18b9db){return{'name':_0x18b9db[_0x49b9('0x29')],'type':_0x18b9db[_0x49b9('0x2a')]['key']};});_0x2a5b4b[_0x49b9('0x2b')]=_['map'](_0xb0e0f2,_0x49b9('0x23'));_0x2a5b4b[_0x49b9('0x2c')]=_[_0x49b9('0x2d')](_0xca0caa['query']);_0x2a5b4b['filters']=_[_0x49b9('0x2e')](_0x2a5b4b[_0x49b9('0x2b')],_0x2a5b4b[_0x49b9('0x2c')]);_0x31ed76[_0x49b9('0x2f')]=_['intersection'](_0x2a5b4b[_0x49b9('0x2b')],qs[_0x49b9('0x30')](_0xca0caa[_0x49b9('0x2c')][_0x49b9('0x30')]));_0x31ed76[_0x49b9('0x2f')]=_0x31ed76[_0x49b9('0x2f')][_0x49b9('0x31')]?_0x31ed76[_0x49b9('0x2f')]:_0x2a5b4b[_0x49b9('0x2b')];if(!_0xca0caa[_0x49b9('0x2c')]['hasOwnProperty']('nolimit')){_0x31ed76[_0x49b9('0x1c')]=qs[_0x49b9('0x1c')](_0xca0caa[_0x49b9('0x2c')][_0x49b9('0x1c')]);_0x31ed76['offset']=qs['offset'](_0xca0caa['query']['offset']);}_0x31ed76[_0x49b9('0x32')]=qs[_0x49b9('0x33')](_0xca0caa[_0x49b9('0x2c')][_0x49b9('0x33')]);_0x31ed76['where']=qs['filters'](_[_0x49b9('0x34')](_0xca0caa['query'],_0x2a5b4b[_0x49b9('0x35')]),_0xb0e0f2);if(_0xca0caa[_0x49b9('0x2c')][_0x49b9('0x36')]){_0x31ed76[_0x49b9('0x37')]=_[_0x49b9('0x38')](_0x31ed76[_0x49b9('0x37')],{'$or':_[_0x49b9('0x26')](_0xb0e0f2,function(_0x572e5c){if(_0x572e5c[_0x49b9('0x2a')]!==_0x49b9('0x39')){var _0x4f05ab={};_0x4f05ab[_0x572e5c[_0x49b9('0x23')]]={'$like':'%'+_0xca0caa[_0x49b9('0x2c')]['filter']+'%'};return _0x4f05ab;}})});}_0x31ed76=_['merge']({},_0x31ed76,_0xca0caa[_0x49b9('0x3a')]);var _0x4be3b8={'where':_0x31ed76[_0x49b9('0x37')]};return db[_0x49b9('0x27')][_0x49b9('0x3b')](_0x4be3b8)[_0x49b9('0x1f')](function(_0x13e8ec){_0x451143[_0x49b9('0x3b')]=_0x13e8ec;if(_0xca0caa[_0x49b9('0x2c')]['includeAll']){_0x31ed76[_0x49b9('0x3c')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x49b9('0x3d')](_0x31ed76);})[_0x49b9('0x1f')](function(_0x6acd3e){_0x451143[_0x49b9('0x3e')]=_0x6acd3e;return _0x451143;})['then'](respondWithFilteredResult(_0x2c162f,_0x31ed76))[_0x49b9('0x3f')](handleError(_0x2c162f,null));};exports[_0x49b9('0x40')]=function(_0x56bb9e,_0x188e6a){var _0x391435={'raw':![],'where':{'id':_0x56bb9e[_0x49b9('0x41')]['id']}},_0x3d283f={};_0x3d283f[_0x49b9('0x2b')]=_[_0x49b9('0x2d')](db['VoiceAgentReport'][_0x49b9('0x28')]);_0x3d283f[_0x49b9('0x2c')]=_[_0x49b9('0x2d')](_0x56bb9e[_0x49b9('0x2c')]);_0x3d283f[_0x49b9('0x42')]=_[_0x49b9('0x2e')](_0x3d283f['model'],_0x3d283f[_0x49b9('0x2c')]);_0x391435[_0x49b9('0x2f')]=_['intersection'](_0x3d283f[_0x49b9('0x2b')],qs[_0x49b9('0x30')](_0x56bb9e['query'][_0x49b9('0x30')]));_0x391435[_0x49b9('0x2f')]=_0x391435[_0x49b9('0x2f')][_0x49b9('0x31')]?_0x391435[_0x49b9('0x2f')]:_0x3d283f[_0x49b9('0x2b')];if(_0x56bb9e['query'][_0x49b9('0x43')]){_0x391435[_0x49b9('0x3c')]=[{'all':!![]}];}_0x391435=_['merge']({},_0x391435,_0x56bb9e[_0x49b9('0x3a')]);return db[_0x49b9('0x27')]['find'](_0x391435)[_0x49b9('0x1f')](handleEntityNotFound(_0x188e6a,null))[_0x49b9('0x1f')](respondWithResult(_0x188e6a,null))[_0x49b9('0x3f')](handleError(_0x188e6a,null));};exports[_0x49b9('0x44')]=function(_0x5467aa,_0x4ad6b9){return db['VoiceAgentReport'][_0x49b9('0x44')](_0x5467aa['body'],{})[_0x49b9('0x1f')](respondWithResult(_0x4ad6b9,0xc9))[_0x49b9('0x3f')](handleError(_0x4ad6b9,null));};exports[_0x49b9('0x45')]=function(_0x201120,_0x2ef72f){if(_0x201120[_0x49b9('0x46')]['id']){delete _0x201120[_0x49b9('0x46')]['id'];}return db[_0x49b9('0x27')][_0x49b9('0x47')]({'where':{'id':_0x201120['params']['id']}})[_0x49b9('0x1f')](handleEntityNotFound(_0x2ef72f,null))[_0x49b9('0x1f')](saveUpdates(_0x201120['body'],null))[_0x49b9('0x1f')](respondWithResult(_0x2ef72f,null))[_0x49b9('0x3f')](handleError(_0x2ef72f,null));};exports[_0x49b9('0x20')]=function(_0x1639c6,_0x1920b8){return db['VoiceAgentReport'][_0x49b9('0x47')]({'where':{'id':_0x1639c6[_0x49b9('0x41')]['id']}})[_0x49b9('0x1f')](handleEntityNotFound(_0x1920b8,null))[_0x49b9('0x1f')](removeEntity(_0x1920b8,null))['catch'](handleError(_0x1920b8,null));};exports[_0x49b9('0x48')]=function(_0x212bf4,_0x36ec76){return db[_0x49b9('0x27')][_0x49b9('0x48')]()[_0x49b9('0x1f')](respondWithResult(_0x36ec76,null))[_0x49b9('0x3f')](handleError(_0x36ec76,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 7a36e7a..53c701b 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 _0x315e=['moment','bluebird','path','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','destuniqueid','lodash','../../config/logger','api'];(function(_0x45acf9,_0x2f14de){var _0xc12e04=function(_0x20d580){while(--_0x20d580){_0x45acf9['push'](_0x45acf9['shift']());}};_0xc12e04(++_0x2f14de);}(_0x315e,0x15c));var _0xe315=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x315e[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xe315('0x0'));var util=require('util');var logger=require(_0xe315('0x1'))(_0xe315('0x2'));var moment=require(_0xe315('0x3'));var BPromise=require(_0xe315('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe315('0x5'));var rimraf=require('rimraf');var config=require(_0xe315('0x6'));var attributes=require(_0xe315('0x7'));module[_0xe315('0x8')]=function(_0xf67f02,_0x385b46){return _0xf67f02[_0xe315('0x9')](_0xe315('0xa'),attributes,{'tableName':_0xe315('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xe315('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x7995('0xc'),_0x7995('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index f8b04a0..9d7d02a 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 _0x91c1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','CreateVoiceAgentReport','create','body','options','then','UpdateVoiceAgentReport','VoiceAgentReport','update','where','limit','moment','bluebird'];(function(_0x282664,_0x495e8b){var _0x371b03=function(_0x33e852){while(--_0x33e852){_0x282664['push'](_0x282664['shift']());}};_0x371b03(++_0x495e8b);}(_0x91c1,0xde));var _0x191c=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0x91c1[_0x2f87cd];return _0x5d7eda;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x191c('0x0'));var BPromise=require(_0x191c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x191c('0x2'));var db=require(_0x191c('0x3'))['db'];var utils=require(_0x191c('0x4'));var logger=require(_0x191c('0x5'))(_0x191c('0x6'));var config=require(_0x191c('0x7'));var jayson=require(_0x191c('0x8'));var client=jayson[_0x191c('0x9')][_0x191c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b993d,_0x5367ce,_0xfe90fb){return new BPromise(function(_0x122136,_0x5eca21){return client[_0x191c('0xb')](_0x2b993d,_0xfe90fb)['then'](function(_0x4bfa2e){logger[_0x191c('0xc')](_0x191c('0xd'),_0x5367ce,'request\x20sent');logger[_0x191c('0xe')](_0x191c('0xf'),_0x5367ce,'request\x20sent',JSON['stringify'](_0x4bfa2e));if(_0x4bfa2e[_0x191c('0x10')]){if(_0x4bfa2e[_0x191c('0x10')][_0x191c('0x11')]===0x1f4){logger['error'](_0x191c('0xd'),_0x5367ce,_0x4bfa2e['error'][_0x191c('0x12')]);return _0x5eca21(_0x4bfa2e[_0x191c('0x10')]['message']);}logger[_0x191c('0x10')](_0x191c('0xd'),_0x5367ce,_0x4bfa2e['error'][_0x191c('0x12')]);return _0x122136(_0x4bfa2e[_0x191c('0x10')]['message']);}else{logger['info'](_0x191c('0xd'),_0x5367ce,_0x191c('0x13'));_0x122136(_0x4bfa2e[_0x191c('0x14')][_0x191c('0x12')]);}})[_0x191c('0x15')](function(_0x2c2033){logger[_0x191c('0x10')](_0x191c('0xd'),_0x5367ce,_0x2c2033);_0x5eca21(_0x2c2033);});});}exports[_0x191c('0x16')]=function(_0x91c3ca){var _0x344823=this;return new Promise(function(_0x529155,_0x54dd0b){return db['VoiceAgentReport'][_0x191c('0x17')](_0x91c3ca[_0x191c('0x18')],{'raw':_0x91c3ca[_0x191c('0x19')]?_0x91c3ca[_0x191c('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x191c('0x1a')](function(_0x199d31){logger[_0x191c('0xc')](_0x191c('0x16'),_0x91c3ca);logger[_0x191c('0xe')](_0x191c('0x16'),_0x91c3ca,JSON['stringify'](_0x199d31));_0x529155(_0x199d31);})[_0x191c('0x15')](function(_0x460a77){logger[_0x191c('0x10')](_0x191c('0x16'),_0x460a77[_0x191c('0x12')],_0x91c3ca);_0x54dd0b(_0x344823[_0x191c('0x10')](0x1f4,_0x460a77[_0x191c('0x12')]));});});};exports[_0x191c('0x1b')]=function(_0x19ef53){var _0x38a476=this;return new Promise(function(_0x5c735f,_0x2b12bc){return db[_0x191c('0x1c')][_0x191c('0x1d')](_0x19ef53[_0x191c('0x18')],{'raw':_0x19ef53[_0x191c('0x19')]?_0x19ef53[_0x191c('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19ef53[_0x191c('0x19')]?_0x19ef53[_0x191c('0x19')][_0x191c('0x1e')]||null:null,'attributes':_0x19ef53[_0x191c('0x19')]?_0x19ef53[_0x191c('0x19')]['attributes']||null:null,'limit':_0x19ef53[_0x191c('0x19')]?_0x19ef53[_0x191c('0x19')][_0x191c('0x1f')]||null:null})['then'](function(_0x5eaae9){logger[_0x191c('0xc')]('UpdateVoiceAgentReport',_0x19ef53);logger['debug'](_0x191c('0x1b'),_0x19ef53,JSON['stringify'](_0x5eaae9));_0x5c735f(_0x5eaae9);})[_0x191c('0x15')](function(_0x568a1c){logger[_0x191c('0x10')](_0x191c('0x1b'),_0x568a1c[_0x191c('0x12')],_0x19ef53);_0x2b12bc(_0x38a476[_0x191c('0x10')](0x1f4,_0x568a1c[_0x191c('0x12')]));});});}; \ No newline at end of file +var _0x9646=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','debug','catch','UpdateVoiceAgentReport','update','raw','attributes','util'];(function(_0x4ea99f,_0x1e2117){var _0x392fe8=function(_0x5e09af){while(--_0x5e09af){_0x4ea99f['push'](_0x4ea99f['shift']());}};_0x392fe8(++_0x1e2117);}(_0x9646,0xdf));var _0x6964=function(_0x16167b,_0x2e64c4){_0x16167b=_0x16167b-0x0;var _0x357fab=_0x9646[_0x16167b];return _0x357fab;};'use strict';var _=require('lodash');var util=require(_0x6964('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6964('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x6964('0x2'));var logger=require(_0x6964('0x3'))(_0x6964('0x4'));var config=require(_0x6964('0x5'));var jayson=require(_0x6964('0x6'));var client=jayson['client'][_0x6964('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43ab6e,_0x493d81,_0x355f9d){return new BPromise(function(_0x3793e6,_0x43cb37){return client['request'](_0x43ab6e,_0x355f9d)[_0x6964('0x8')](function(_0x5ad593){logger[_0x6964('0x9')](_0x6964('0xa'),_0x493d81,_0x6964('0xb'));logger['debug'](_0x6964('0xc'),_0x493d81,'request\x20sent',JSON[_0x6964('0xd')](_0x5ad593));if(_0x5ad593[_0x6964('0xe')]){if(_0x5ad593[_0x6964('0xe')][_0x6964('0xf')]===0x1f4){logger[_0x6964('0xe')](_0x6964('0xa'),_0x493d81,_0x5ad593[_0x6964('0xe')][_0x6964('0x10')]);return _0x43cb37(_0x5ad593['error'][_0x6964('0x10')]);}logger[_0x6964('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x493d81,_0x5ad593['error']['message']);return _0x3793e6(_0x5ad593['error']['message']);}else{logger['info'](_0x6964('0xa'),_0x493d81,'request\x20sent');_0x3793e6(_0x5ad593['result'][_0x6964('0x10')]);}})['catch'](function(_0x2dee98){logger['error'](_0x6964('0xa'),_0x493d81,_0x2dee98);_0x43cb37(_0x2dee98);});});}exports[_0x6964('0x11')]=function(_0x42dea0){var _0x5c5b74=this;return new Promise(function(_0x1ae2f0,_0x586cd7){return db[_0x6964('0x12')][_0x6964('0x13')](_0x42dea0[_0x6964('0x14')],{'raw':_0x42dea0[_0x6964('0x15')]?_0x42dea0[_0x6964('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x6964('0x8')](function(_0x330a04){logger['info'](_0x6964('0x11'),_0x42dea0);logger[_0x6964('0x16')]('CreateVoiceAgentReport',_0x42dea0,JSON[_0x6964('0xd')](_0x330a04));_0x1ae2f0(_0x330a04);})[_0x6964('0x17')](function(_0x363822){logger[_0x6964('0xe')](_0x6964('0x11'),_0x363822[_0x6964('0x10')],_0x42dea0);_0x586cd7(_0x5c5b74[_0x6964('0xe')](0x1f4,_0x363822[_0x6964('0x10')]));});});};exports[_0x6964('0x18')]=function(_0x2f69dd){var _0x1f1134=this;return new Promise(function(_0x36df6d,_0x238159){return db[_0x6964('0x12')][_0x6964('0x19')](_0x2f69dd[_0x6964('0x14')],{'raw':_0x2f69dd[_0x6964('0x15')]?_0x2f69dd['options'][_0x6964('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f69dd['options']?_0x2f69dd[_0x6964('0x15')]['where']||null:null,'attributes':_0x2f69dd[_0x6964('0x15')]?_0x2f69dd[_0x6964('0x15')][_0x6964('0x1b')]||null:null,'limit':_0x2f69dd['options']?_0x2f69dd[_0x6964('0x15')]['limit']||null:null})[_0x6964('0x8')](function(_0x1f3b7b){logger['info']('UpdateVoiceAgentReport',_0x2f69dd);logger[_0x6964('0x16')](_0x6964('0x18'),_0x2f69dd,JSON[_0x6964('0xd')](_0x1f3b7b));_0x36df6d(_0x1f3b7b);})[_0x6964('0x17')](function(_0x18a5c0){logger[_0x6964('0xe')](_0x6964('0x18'),_0x18a5c0[_0x6964('0x10')],_0x2f69dd);_0x238159(_0x1f1134[_0x6964('0xe')](0x1f4,_0x18a5c0[_0x6964('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 7d32df8..6420802 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 _0xcfa7=['create','/:id','update','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','describe','show','post'];(function(_0x5c7158,_0x40146f){var _0x526bc4=function(_0x58260f){while(--_0x58260f){_0x5c7158['push'](_0x5c7158['shift']());}};_0x526bc4(++_0x40146f);}(_0xcfa7,0x7c));var _0x7cfa=function(_0x258f57,_0x1a8b99){_0x258f57=_0x258f57-0x0;var _0x1308ea=_0xcfa7[_0x258f57];return _0x1308ea;};'use strict';var multer=require('multer');var util=require(_0x7cfa('0x0'));var path=require('path');var timeout=require(_0x7cfa('0x1'));var express=require('express');var router=express[_0x7cfa('0x2')]();var auth=require(_0x7cfa('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7cfa('0x4'));var controller=require(_0x7cfa('0x5'));router[_0x7cfa('0x6')]('/',auth[_0x7cfa('0x7')](),controller[_0x7cfa('0x8')]);router[_0x7cfa('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x7cfa('0x9')]);router['get']('/:id',auth[_0x7cfa('0x7')](),controller[_0x7cfa('0xa')]);router[_0x7cfa('0xb')]('/',auth[_0x7cfa('0x7')](),controller[_0x7cfa('0xc')]);router['put'](_0x7cfa('0xd'),auth['isAuthenticated'](),controller[_0x7cfa('0xe')]);router['delete'](_0x7cfa('0xd'),auth[_0x7cfa('0x7')](),controller[_0x7cfa('0xf')]);module[_0x7cfa('0x10')]=router; \ No newline at end of file +var _0x2e76=['../../config/environment','./voiceCallReport.controller','index','isAuthenticated','describe','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2e8418,_0x58c529){var _0x548fe6=function(_0x2b2877){while(--_0x2b2877){_0x2e8418['push'](_0x2e8418['shift']());}};_0x548fe6(++_0x58c529);}(_0x2e76,0x199));var _0x62e7=function(_0x59f19c,_0x2f435d){_0x59f19c=_0x59f19c-0x0;var _0x2245f0=_0x2e76[_0x59f19c];return _0x2245f0;};'use strict';var multer=require(_0x62e7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x62e7('0x1'));var express=require('express');var router=express[_0x62e7('0x2')]();var auth=require(_0x62e7('0x3'));var interaction=require(_0x62e7('0x4'));var config=require(_0x62e7('0x5'));var controller=require(_0x62e7('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x62e7('0x7')]);router['get']('/describe',auth[_0x62e7('0x8')](),controller[_0x62e7('0x9')]);router['get']('/:id',auth[_0x62e7('0x8')](),controller['show']);router[_0x62e7('0xa')]('/',auth['isAuthenticated'](),controller[_0x62e7('0xb')]);router[_0x62e7('0xc')](_0x62e7('0xd'),auth[_0x62e7('0x8')](),controller[_0x62e7('0xe')]);router[_0x62e7('0xf')](_0x62e7('0xd'),auth[_0x62e7('0x8')](),controller[_0x62e7('0x10')]);module[_0x62e7('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index d3b0a0e..f3f1bf9 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 _0x4819=['INTEGER','exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE'];(function(_0x2d344f,_0x25fa84){var _0x2e796b=function(_0x10466a){while(--_0x10466a){_0x2d344f['push'](_0x2d344f['shift']());}};_0x2e796b(++_0x25fa84);}(_0x4819,0xcd));var _0x9481=function(_0x303986,_0x5c751c){_0x303986=_0x303986-0x0;var _0x4c4431=_0x4819[_0x303986];return _0x4c4431;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'uniqueid':{'type':Sequelize[_0x9481('0x1')]},'type':{'type':Sequelize[_0x9481('0x2')](_0x9481('0x3'),_0x9481('0x4'),_0x9481('0x5'),_0x9481('0x6'),_0x9481('0x7'),_0x9481('0x8'))},'tag':{'type':Sequelize[_0x9481('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x9481('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9481('0x1')]},'channel':{'type':Sequelize[_0x9481('0x1')]},'destinationchannel':{'type':Sequelize[_0x9481('0x1')]},'lastapplication':{'type':Sequelize[_0x9481('0x1')]},'lastdata':{'type':Sequelize[_0x9481('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x9481('0xa')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x9481('0xa')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x9481('0xb')]},'mohtime':{'type':Sequelize[_0x9481('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9481('0x1')]},'amaflags':{'type':Sequelize[_0x9481('0x1')]},'userfield':{'type':Sequelize[_0x9481('0x1')]},'userDisposition':{'type':Sequelize[_0x9481('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x9481('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x9481('0x1')]},'note':{'type':Sequelize[_0x9481('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x9481('0x1')]}}; \ No newline at end of file +var _0xdc97=['inbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','inbound','outbound'];(function(_0x5f08a2,_0xa1f37){var _0x208914=function(_0x553a1d){while(--_0x553a1d){_0x5f08a2['push'](_0x5f08a2['shift']());}};_0x208914(++_0xa1f37);}(_0xdc97,0x13b));var _0x7dc9=function(_0x4ad4c6,_0x548bd4){_0x4ad4c6=_0x4ad4c6-0x0;var _0x12fe24=_0xdc97[_0x4ad4c6];return _0x12fe24;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'uniqueid':{'type':Sequelize[_0x7dc9('0x2')]},'type':{'type':Sequelize['ENUM'](_0x7dc9('0x3'),'internal',_0x7dc9('0x4'),_0x7dc9('0x5'),'outbound-fax',_0x7dc9('0x6'))},'tag':{'type':Sequelize[_0x7dc9('0x2')]},'accountcode':{'type':Sequelize[_0x7dc9('0x2')]},'source':{'type':Sequelize[_0x7dc9('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x7dc9('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7dc9('0x2')]},'lastapplication':{'type':Sequelize[_0x7dc9('0x2')]},'lastdata':{'type':Sequelize[_0x7dc9('0x7')]},'starttime':{'type':Sequelize[_0x7dc9('0x8')]},'systemanswertime':{'type':Sequelize[_0x7dc9('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x7dc9('0x8')]},'duration':{'type':Sequelize[_0x7dc9('0x9')]},'billableseconds':{'type':Sequelize[_0x7dc9('0x9')]},'mohtime':{'type':Sequelize[_0x7dc9('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7dc9('0x2')]},'amaflags':{'type':Sequelize[_0x7dc9('0x2')]},'userfield':{'type':Sequelize[_0x7dc9('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x7dc9('0x2')]},'routeid':{'type':Sequelize[_0x7dc9('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index fbedddc..e160deb 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 _0x292c=['order','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceCallReport','includeAll','include','fullname','alias','User','findAll','rows','show','find','catch','create','body','destroy','params','describe','uniqueid','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','update','then','name','map','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0x292c,0x66));var _0xc292=function(_0x3f3f06,_0x581e5b){_0x3f3f06=_0x3f3f06-0x0;var _0x140feb=_0x292c[_0x3f3f06];return _0x140feb;};'use strict';var pdf=require(_0xc292('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc292('0x1'));var zipdir=require(_0xc292('0x2'));var jsonpatch=require(_0xc292('0x3'));var rp=require(_0xc292('0x4'));var moment=require(_0xc292('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc292('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc292('0x7'));var csv=require(_0xc292('0x8'));var ejs=require(_0xc292('0x9'));var fs=require('fs');var _=require(_0xc292('0xa'));var squel=require(_0xc292('0xb'));var crypto=require(_0xc292('0xc'));var jsforce=require(_0xc292('0xd'));var deskjs=require(_0xc292('0xe'));var toCsv=require(_0xc292('0x8'));var querystring=require(_0xc292('0xf'));var Papa=require('papaparse');var Redis=require(_0xc292('0x10'));var authService=require(_0xc292('0x11'));var qs=require(_0xc292('0x12'));var as=require(_0xc292('0x13'));var hardwareService=require(_0xc292('0x14'));var logger=require('../../config/logger')(_0xc292('0x15'));var utils=require(_0xc292('0x16'));var config=require(_0xc292('0x17'));var licenseUtil=require(_0xc292('0x18'));var db=require(_0xc292('0x19'))['db'];function respondWithStatusCode(_0x3ead77,_0x4f4e98){_0x4f4e98=_0x4f4e98||0xcc;return function(_0x891862){if(_0x891862){return _0x3ead77[_0xc292('0x1a')](_0x4f4e98);}return _0x3ead77[_0xc292('0x1b')](_0x4f4e98)[_0xc292('0x1c')]();};}function respondWithResult(_0x38c865,_0x51ab23){_0x51ab23=_0x51ab23||0xc8;return function(_0x56417e){if(_0x56417e){return _0x38c865[_0xc292('0x1b')](_0x51ab23)[_0xc292('0x1d')](_0x56417e);}};}function respondWithFilteredResult(_0x5d0067,_0x290138){return function(_0x53a23e){if(_0x53a23e){var _0x5e765a=_0x53a23e[_0xc292('0x1e')],_0x3f762b=_0x290138[_0xc292('0x1f')],_0x5bde28=_0x290138['offset']+_0x290138[_0xc292('0x20')],_0x156747;if(_0x5bde28>=_0x5e765a){_0x5bde28=_0x5e765a;_0x156747=0xc8;}else{_0x156747=0xce;}_0x5d0067['status'](_0x156747);return _0x5d0067['set'](_0xc292('0x21'),_0x3f762b+'-'+_0x5bde28+'/'+_0x5e765a)[_0xc292('0x1d')](_0x53a23e);}return null;};}function patchUpdates(_0x5808f1){return function(_0x2a74af){try{jsonpatch[_0xc292('0x22')](_0x2a74af,_0x5808f1,!![]);}catch(_0x314f3b){return BPromise['reject'](_0x314f3b);}return _0x2a74af['save']();};}function saveUpdates(_0x29b51a,_0x169c3d){return function(_0x32a138){if(_0x32a138){return _0x32a138[_0xc292('0x23')](_0x29b51a)[_0xc292('0x24')](function(_0x14d94c){return _0x14d94c;});}return null;};}function removeEntity(_0x17bafc,_0x2a4618){return function(_0x3e638b){if(_0x3e638b){return _0x3e638b['destroy']()['then'](function(){_0x17bafc[_0xc292('0x1b')](0xcc)[_0xc292('0x1c')]();});}};}function handleEntityNotFound(_0x4ba9e3,_0x190aae){return function(_0x7c33dd){if(!_0x7c33dd){_0x4ba9e3[_0xc292('0x1a')](0x194);}return _0x7c33dd;};}function handleError(_0x595f4b,_0x315057){_0x315057=_0x315057||0x1f4;return function(_0x342d73){logger['error'](_0x342d73['stack']);if(_0x342d73[_0xc292('0x25')]){delete _0x342d73[_0xc292('0x25')];}_0x595f4b['status'](_0x315057)['send'](_0x342d73);};}exports['index']=function(_0x3933c6,_0x10b77e){var _0x49b9fd={},_0x8683a2={},_0x51a56e={'count':0x0,'rows':[]};var _0x212eb7=_[_0xc292('0x26')](db['VoiceCallReport']['rawAttributes'],function(_0x23cb2c){return{'name':_0x23cb2c[_0xc292('0x27')],'type':_0x23cb2c['type']['key']};});_0x8683a2[_0xc292('0x28')]=_['map'](_0x212eb7,_0xc292('0x25'));_0x8683a2[_0xc292('0x29')]=_[_0xc292('0x2a')](_0x3933c6['query']);_0x8683a2[_0xc292('0x2b')]=_[_0xc292('0x2c')](_0x8683a2[_0xc292('0x28')],_0x8683a2[_0xc292('0x29')]);_0x49b9fd[_0xc292('0x2d')]=_['intersection'](_0x8683a2[_0xc292('0x28')],qs[_0xc292('0x2e')](_0x3933c6[_0xc292('0x29')][_0xc292('0x2e')]));_0x49b9fd['attributes']=_0x49b9fd['attributes'][_0xc292('0x2f')]?_0x49b9fd[_0xc292('0x2d')]:_0x8683a2[_0xc292('0x28')];if(!_0x3933c6[_0xc292('0x29')][_0xc292('0x30')](_0xc292('0x31'))){_0x49b9fd['limit']=qs['limit'](_0x3933c6[_0xc292('0x29')][_0xc292('0x20')]);_0x49b9fd['offset']=qs[_0xc292('0x1f')](_0x3933c6[_0xc292('0x29')][_0xc292('0x1f')]);}_0x49b9fd[_0xc292('0x32')]=qs[_0xc292('0x33')](_0x3933c6['query'][_0xc292('0x33')]);_0x49b9fd[_0xc292('0x34')]=qs[_0xc292('0x2b')](_[_0xc292('0x35')](_0x3933c6[_0xc292('0x29')],_0x8683a2[_0xc292('0x2b')]),_0x212eb7);if(_0x3933c6['query'][_0xc292('0x36')]){_0x49b9fd[_0xc292('0x34')]=_[_0xc292('0x37')](_0x49b9fd[_0xc292('0x34')],{'$or':_[_0xc292('0x26')](_0x212eb7,function(_0x5e97c1){if(_0x5e97c1[_0xc292('0x38')]!==_0xc292('0x39')){var _0x1b0fc8={};_0x1b0fc8[_0x5e97c1[_0xc292('0x25')]]={'$like':'%'+_0x3933c6[_0xc292('0x29')]['filter']+'%'};return _0x1b0fc8;}})});}_0x49b9fd=_['merge']({},_0x49b9fd,_0x3933c6[_0xc292('0x3a')]);var _0x284a06={'where':_0x49b9fd['where']};return db[_0xc292('0x3b')][_0xc292('0x1e')](_0x284a06)['then'](function(_0x2f6df7){_0x51a56e[_0xc292('0x1e')]=_0x2f6df7;if(_0x3933c6['query'][_0xc292('0x3c')]){_0x49b9fd[_0xc292('0x3d')]=[{'attributes':['id',_0xc292('0x25'),_0xc292('0x3e'),_0xc292('0x3f')],'model':db[_0xc292('0x40')],'as':'User'}];}return db[_0xc292('0x3b')][_0xc292('0x41')](_0x49b9fd);})[_0xc292('0x24')](function(_0x4efcb4){_0x51a56e[_0xc292('0x42')]=_0x4efcb4;return _0x51a56e;})['then'](respondWithFilteredResult(_0x10b77e,_0x49b9fd))['catch'](handleError(_0x10b77e,null));};exports[_0xc292('0x43')]=function(_0x2f78d5,_0x331193){var _0x49a10c={'raw':!![],'where':{'id':_0x2f78d5['params']['id']}},_0x267817={};_0x267817[_0xc292('0x28')]=_[_0xc292('0x2a')](db[_0xc292('0x3b')]['rawAttributes']);_0x267817['query']=_[_0xc292('0x2a')](_0x2f78d5[_0xc292('0x29')]);_0x267817['filtears']=_['intersection'](_0x267817[_0xc292('0x28')],_0x267817[_0xc292('0x29')]);_0x49a10c[_0xc292('0x2d')]=_['intersection'](_0x267817[_0xc292('0x28')],qs['fields'](_0x2f78d5['query'][_0xc292('0x2e')]));_0x49a10c['attributes']=_0x49a10c[_0xc292('0x2d')]['length']?_0x49a10c[_0xc292('0x2d')]:_0x267817[_0xc292('0x28')];if(_0x2f78d5[_0xc292('0x29')][_0xc292('0x3c')]){_0x49a10c[_0xc292('0x3d')]=[{'all':!![]}];}_0x49a10c=_[_0xc292('0x37')]({},_0x49a10c,_0x2f78d5['options']);return db[_0xc292('0x3b')][_0xc292('0x44')](_0x49a10c)['then'](handleEntityNotFound(_0x331193,null))[_0xc292('0x24')](respondWithResult(_0x331193,null))[_0xc292('0x45')](handleError(_0x331193,null));};exports[_0xc292('0x46')]=function(_0x721f32,_0x21968e){return db[_0xc292('0x3b')]['create'](_0x721f32[_0xc292('0x47')],{})[_0xc292('0x24')](respondWithResult(_0x21968e,0xc9))[_0xc292('0x45')](handleError(_0x21968e,null));};exports[_0xc292('0x48')]=function(_0x309148,_0x3609fe){return db[_0xc292('0x3b')][_0xc292('0x44')]({'where':{'id':_0x309148[_0xc292('0x49')]['id']}})[_0xc292('0x24')](handleEntityNotFound(_0x3609fe,null))[_0xc292('0x24')](removeEntity(_0x3609fe,null))[_0xc292('0x45')](handleError(_0x3609fe,null));};exports[_0xc292('0x4a')]=function(_0x749f98,_0x294d8b){return db[_0xc292('0x3b')]['describe']()[_0xc292('0x24')](respondWithResult(_0x294d8b,null))[_0xc292('0x45')](handleError(_0x294d8b,null));};exports[_0xc292('0x23')]=function(_0x245e23,_0x4ca8aa){if(_0x245e23[_0xc292('0x47')][_0xc292('0x4b')]){delete _0x245e23[_0xc292('0x47')][_0xc292('0x4b')];}return db[_0xc292('0x3b')]['find']({'where':{'uniqueid':_0x245e23[_0xc292('0x49')]['id'],'UserId':{'$or':[null,_0x245e23['user']['id']]}}})[_0xc292('0x24')](handleEntityNotFound(_0x4ca8aa,null))[_0xc292('0x24')](saveUpdates(_0x245e23[_0xc292('0x47')],null))[_0xc292('0x24')](respondWithResult(_0x4ca8aa,null))[_0xc292('0x45')](handleError(_0x4ca8aa,null));}; \ No newline at end of file +var _0xaa5c=['pick','filter','merge','type','VIRTUAL','options','include','fullname','alias','User','findAll','rows','catch','show','params','filtears','fields','includeAll','find','create','describe','body','uniqueid','user','html-pdf','eml-format','rimraf','zip-dir','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','VoiceCallReport','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x3113ec,_0xa95efd){var _0x35d465=function(_0x2574cc){while(--_0x2574cc){_0x3113ec['push'](_0x3113ec['shift']());}};_0x35d465(++_0xa95efd);}(_0xaa5c,0x1f2));var _0xcaa5=function(_0x217e1a,_0x38da2c){_0x217e1a=_0x217e1a-0x0;var _0x4b2755=_0xaa5c[_0x217e1a];return _0x4b2755;};'use strict';var pdf=require(_0xcaa5('0x0'));var emlformat=require(_0xcaa5('0x1'));var rimraf=require(_0xcaa5('0x2'));var zipdir=require(_0xcaa5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcaa5('0x4'));var util=require('util');var path=require('path');var sox=require(_0xcaa5('0x5'));var csv=require(_0xcaa5('0x6'));var ejs=require(_0xcaa5('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcaa5('0x8'));var crypto=require(_0xcaa5('0x9'));var jsforce=require(_0xcaa5('0xa'));var deskjs=require(_0xcaa5('0xb'));var toCsv=require('to-csv');var querystring=require(_0xcaa5('0xc'));var Papa=require(_0xcaa5('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcaa5('0xe'));var as=require(_0xcaa5('0xf'));var hardwareService=require(_0xcaa5('0x10'));var logger=require('../../config/logger')(_0xcaa5('0x11'));var utils=require('../../config/utils');var config=require(_0xcaa5('0x12'));var licenseUtil=require(_0xcaa5('0x13'));var db=require(_0xcaa5('0x14'))['db'];function respondWithStatusCode(_0x3b8783,_0x16bb6d){_0x16bb6d=_0x16bb6d||0xcc;return function(_0xbf4c57){if(_0xbf4c57){return _0x3b8783[_0xcaa5('0x15')](_0x16bb6d);}return _0x3b8783['status'](_0x16bb6d)[_0xcaa5('0x16')]();};}function respondWithResult(_0x240651,_0x474770){_0x474770=_0x474770||0xc8;return function(_0x295c9f){if(_0x295c9f){return _0x240651[_0xcaa5('0x17')](_0x474770)[_0xcaa5('0x18')](_0x295c9f);}};}function respondWithFilteredResult(_0x3e1c8e,_0xa2c6b6){return function(_0x8b7ad5){if(_0x8b7ad5){var _0x53e67f=_0x8b7ad5[_0xcaa5('0x19')],_0xa74489=_0xa2c6b6['offset'],_0x47eb0f=_0xa2c6b6[_0xcaa5('0x1a')]+_0xa2c6b6[_0xcaa5('0x1b')],_0x17e3d2;if(_0x47eb0f>=_0x53e67f){_0x47eb0f=_0x53e67f;_0x17e3d2=0xc8;}else{_0x17e3d2=0xce;}_0x3e1c8e[_0xcaa5('0x17')](_0x17e3d2);return _0x3e1c8e[_0xcaa5('0x1c')](_0xcaa5('0x1d'),_0xa74489+'-'+_0x47eb0f+'/'+_0x53e67f)['json'](_0x8b7ad5);}return null;};}function patchUpdates(_0x20b4e3){return function(_0x4470c1){try{jsonpatch[_0xcaa5('0x1e')](_0x4470c1,_0x20b4e3,!![]);}catch(_0x5087e1){return BPromise['reject'](_0x5087e1);}return _0x4470c1[_0xcaa5('0x1f')]();};}function saveUpdates(_0x581ff8,_0x93f6d4){return function(_0x228f0b){if(_0x228f0b){return _0x228f0b[_0xcaa5('0x20')](_0x581ff8)[_0xcaa5('0x21')](function(_0x2e1c82){return _0x2e1c82;});}return null;};}function removeEntity(_0x52ca18,_0x48b8ee){return function(_0x51be62){if(_0x51be62){return _0x51be62[_0xcaa5('0x22')]()['then'](function(){_0x52ca18[_0xcaa5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39fb88,_0x554027){return function(_0xc9a5ac){if(!_0xc9a5ac){_0x39fb88[_0xcaa5('0x15')](0x194);}return _0xc9a5ac;};}function handleError(_0x1ecd5e,_0x2af11b){_0x2af11b=_0x2af11b||0x1f4;return function(_0x5c7693){logger[_0xcaa5('0x23')](_0x5c7693['stack']);if(_0x5c7693[_0xcaa5('0x24')]){delete _0x5c7693['name'];}_0x1ecd5e[_0xcaa5('0x17')](_0x2af11b)[_0xcaa5('0x25')](_0x5c7693);};}exports[_0xcaa5('0x26')]=function(_0x15c213,_0x16462d){var _0x89b3d3={},_0x16414b={},_0xf27232={'count':0x0,'rows':[]};var _0x5da781=_['map'](db[_0xcaa5('0x27')][_0xcaa5('0x28')],function(_0x2d58f9){return{'name':_0x2d58f9['fieldName'],'type':_0x2d58f9['type'][_0xcaa5('0x29')]};});_0x16414b[_0xcaa5('0x2a')]=_[_0xcaa5('0x2b')](_0x5da781,_0xcaa5('0x24'));_0x16414b[_0xcaa5('0x2c')]=_[_0xcaa5('0x2d')](_0x15c213[_0xcaa5('0x2c')]);_0x16414b[_0xcaa5('0x2e')]=_[_0xcaa5('0x2f')](_0x16414b['model'],_0x16414b[_0xcaa5('0x2c')]);_0x89b3d3[_0xcaa5('0x30')]=_[_0xcaa5('0x2f')](_0x16414b[_0xcaa5('0x2a')],qs['fields'](_0x15c213[_0xcaa5('0x2c')]['fields']));_0x89b3d3[_0xcaa5('0x30')]=_0x89b3d3[_0xcaa5('0x30')][_0xcaa5('0x31')]?_0x89b3d3['attributes']:_0x16414b[_0xcaa5('0x2a')];if(!_0x15c213[_0xcaa5('0x2c')][_0xcaa5('0x32')](_0xcaa5('0x33'))){_0x89b3d3['limit']=qs[_0xcaa5('0x1b')](_0x15c213[_0xcaa5('0x2c')][_0xcaa5('0x1b')]);_0x89b3d3[_0xcaa5('0x1a')]=qs[_0xcaa5('0x1a')](_0x15c213['query']['offset']);}_0x89b3d3[_0xcaa5('0x34')]=qs[_0xcaa5('0x35')](_0x15c213[_0xcaa5('0x2c')]['sort']);_0x89b3d3[_0xcaa5('0x36')]=qs['filters'](_[_0xcaa5('0x37')](_0x15c213[_0xcaa5('0x2c')],_0x16414b['filters']),_0x5da781);if(_0x15c213[_0xcaa5('0x2c')][_0xcaa5('0x38')]){_0x89b3d3[_0xcaa5('0x36')]=_[_0xcaa5('0x39')](_0x89b3d3['where'],{'$or':_[_0xcaa5('0x2b')](_0x5da781,function(_0x2d61b2){if(_0x2d61b2[_0xcaa5('0x3a')]!==_0xcaa5('0x3b')){var _0x434926={};_0x434926[_0x2d61b2[_0xcaa5('0x24')]]={'$like':'%'+_0x15c213[_0xcaa5('0x2c')][_0xcaa5('0x38')]+'%'};return _0x434926;}})});}_0x89b3d3=_['merge']({},_0x89b3d3,_0x15c213[_0xcaa5('0x3c')]);var _0x3c024b={'where':_0x89b3d3[_0xcaa5('0x36')]};return db[_0xcaa5('0x27')]['count'](_0x3c024b)[_0xcaa5('0x21')](function(_0x51286b){_0xf27232[_0xcaa5('0x19')]=_0x51286b;if(_0x15c213[_0xcaa5('0x2c')]['includeAll']){_0x89b3d3[_0xcaa5('0x3d')]=[{'attributes':['id',_0xcaa5('0x24'),_0xcaa5('0x3e'),_0xcaa5('0x3f')],'model':db[_0xcaa5('0x40')],'as':_0xcaa5('0x40')}];}return db['VoiceCallReport'][_0xcaa5('0x41')](_0x89b3d3);})[_0xcaa5('0x21')](function(_0x336176){_0xf27232[_0xcaa5('0x42')]=_0x336176;return _0xf27232;})[_0xcaa5('0x21')](respondWithFilteredResult(_0x16462d,_0x89b3d3))[_0xcaa5('0x43')](handleError(_0x16462d,null));};exports[_0xcaa5('0x44')]=function(_0x464c00,_0x12ea07){var _0x22313c={'raw':!![],'where':{'id':_0x464c00[_0xcaa5('0x45')]['id']}},_0x29f93a={};_0x29f93a[_0xcaa5('0x2a')]=_[_0xcaa5('0x2d')](db['VoiceCallReport'][_0xcaa5('0x28')]);_0x29f93a['query']=_[_0xcaa5('0x2d')](_0x464c00[_0xcaa5('0x2c')]);_0x29f93a[_0xcaa5('0x46')]=_[_0xcaa5('0x2f')](_0x29f93a['model'],_0x29f93a[_0xcaa5('0x2c')]);_0x22313c[_0xcaa5('0x30')]=_[_0xcaa5('0x2f')](_0x29f93a[_0xcaa5('0x2a')],qs[_0xcaa5('0x47')](_0x464c00[_0xcaa5('0x2c')][_0xcaa5('0x47')]));_0x22313c[_0xcaa5('0x30')]=_0x22313c['attributes'][_0xcaa5('0x31')]?_0x22313c['attributes']:_0x29f93a[_0xcaa5('0x2a')];if(_0x464c00[_0xcaa5('0x2c')][_0xcaa5('0x48')]){_0x22313c[_0xcaa5('0x3d')]=[{'all':!![]}];}_0x22313c=_[_0xcaa5('0x39')]({},_0x22313c,_0x464c00[_0xcaa5('0x3c')]);return db[_0xcaa5('0x27')][_0xcaa5('0x49')](_0x22313c)['then'](handleEntityNotFound(_0x12ea07,null))[_0xcaa5('0x21')](respondWithResult(_0x12ea07,null))[_0xcaa5('0x43')](handleError(_0x12ea07,null));};exports[_0xcaa5('0x4a')]=function(_0x4ac9da,_0x2ab2a1){return db[_0xcaa5('0x27')][_0xcaa5('0x4a')](_0x4ac9da['body'],{})[_0xcaa5('0x21')](respondWithResult(_0x2ab2a1,0xc9))[_0xcaa5('0x43')](handleError(_0x2ab2a1,null));};exports[_0xcaa5('0x22')]=function(_0x282c51,_0x2fcb89){return db[_0xcaa5('0x27')][_0xcaa5('0x49')]({'where':{'id':_0x282c51['params']['id']}})[_0xcaa5('0x21')](handleEntityNotFound(_0x2fcb89,null))['then'](removeEntity(_0x2fcb89,null))[_0xcaa5('0x43')](handleError(_0x2fcb89,null));};exports['describe']=function(_0x136334,_0x3cc0ea){return db[_0xcaa5('0x27')][_0xcaa5('0x4b')]()[_0xcaa5('0x21')](respondWithResult(_0x3cc0ea,null))[_0xcaa5('0x43')](handleError(_0x3cc0ea,null));};exports[_0xcaa5('0x20')]=function(_0x426c2d,_0x53ba5b){if(_0x426c2d[_0xcaa5('0x4c')][_0xcaa5('0x4d')]){delete _0x426c2d[_0xcaa5('0x4c')][_0xcaa5('0x4d')];}return db[_0xcaa5('0x27')][_0xcaa5('0x49')]({'where':{'uniqueid':_0x426c2d[_0xcaa5('0x45')]['id'],'UserId':{'$or':[null,_0x426c2d[_0xcaa5('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x53ba5b,null))[_0xcaa5('0x21')](saveUpdates(_0x426c2d[_0xcaa5('0x4c')],null))[_0xcaa5('0x21')](respondWithResult(_0x53ba5b,null))['catch'](handleError(_0x53ba5b,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 54a28de..70e68f1 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 _0xee86=['rimraf','../../config/environment','exports','define','report_call','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x3d3635,_0x352100){var _0x482c67=function(_0x4cd142){while(--_0x4cd142){_0x3d3635['push'](_0x3d3635['shift']());}};_0x482c67(++_0x352100);}(_0xee86,0xea));var _0x6ee8=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xee86[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x6ee8('0x0'));var util=require(_0x6ee8('0x1'));var logger=require(_0x6ee8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ee8('0x3'));var rp=require(_0x6ee8('0x4'));var fs=require('fs');var path=require(_0x6ee8('0x5'));var rimraf=require(_0x6ee8('0x6'));var config=require(_0x6ee8('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0x6ee8('0x8')]=function(_0xb806ec,_0x547a7d){return _0xb806ec[_0x6ee8('0x9')]('VoiceCallReport',attributes,{'tableName':_0x6ee8('0xa'),'paranoid':![],'indexes':[{'fields':[_0x6ee8('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x36c2=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash','util'];(function(_0x1a2862,_0xee81a2){var _0x295295=function(_0x447a4c){while(--_0x447a4c){_0x1a2862['push'](_0x1a2862['shift']());}};_0x295295(++_0xee81a2);}(_0x36c2,0x1da));var _0x236c=function(_0x3feffc,_0x2e5616){_0x3feffc=_0x3feffc-0x0;var _0x1fbcd8=_0x36c2[_0x3feffc];return _0x1fbcd8;};'use strict';var _=require(_0x236c('0x0'));var util=require(_0x236c('0x1'));var logger=require(_0x236c('0x2'))(_0x236c('0x3'));var moment=require(_0x236c('0x4'));var BPromise=require('bluebird');var rp=require(_0x236c('0x5'));var fs=require('fs');var path=require(_0x236c('0x6'));var rimraf=require(_0x236c('0x7'));var config=require(_0x236c('0x8'));var attributes=require(_0x236c('0x9'));module[_0x236c('0xa')]=function(_0x18dbbd,_0x293444){return _0x18dbbd[_0x236c('0xb')](_0x236c('0xc'),attributes,{'tableName':_0x236c('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index d2b534a..e2f3a12 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 _0x64b6=['VoiceCallReport','findAll','options','raw','where','include','model','map','attributes','info','CreateVoiceCallReport','create','body','update','limit','UpdateVoiceCallReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceCallReport,\x20%s,\x20%s','result','catch','GetVoiceCallReport'];(function(_0x51e42a,_0x2e2098){var _0x483535=function(_0x2f453a){while(--_0x2f453a){_0x51e42a['push'](_0x51e42a['shift']());}};_0x483535(++_0x2e2098);}(_0x64b6,0xd3));var _0x664b=function(_0x146ef3,_0x1c7bb0){_0x146ef3=_0x146ef3-0x0;var _0x5d9bae=_0x64b6[_0x146ef3];return _0x5d9bae;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x664b('0x0'));var BPromise=require(_0x664b('0x1'));var rs=require(_0x664b('0x2'));var fs=require('fs');var Redis=require(_0x664b('0x3'));var db=require(_0x664b('0x4'))['db'];var utils=require(_0x664b('0x5'));var logger=require(_0x664b('0x6'))('rpc');var config=require(_0x664b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x664b('0x8')][_0x664b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e4188,_0x1dedc7,_0x50180d){return new BPromise(function(_0x321b17,_0x1e098e){return client[_0x664b('0xa')](_0x3e4188,_0x50180d)[_0x664b('0xb')](function(_0x157971){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x1dedc7,_0x664b('0xc'));logger[_0x664b('0xd')](_0x664b('0xe'),_0x1dedc7,'request\x20sent',JSON[_0x664b('0xf')](_0x157971));if(_0x157971['error']){if(_0x157971[_0x664b('0x10')][_0x664b('0x11')]===0x1f4){logger[_0x664b('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x1dedc7,_0x157971[_0x664b('0x10')][_0x664b('0x12')]);return _0x1e098e(_0x157971[_0x664b('0x10')][_0x664b('0x12')]);}logger[_0x664b('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x1dedc7,_0x157971[_0x664b('0x10')]['message']);return _0x321b17(_0x157971[_0x664b('0x10')]['message']);}else{logger['info'](_0x664b('0x13'),_0x1dedc7,_0x664b('0xc'));_0x321b17(_0x157971[_0x664b('0x14')]['message']);}})[_0x664b('0x15')](function(_0x3d62b2){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x1dedc7,_0x3d62b2);_0x1e098e(_0x3d62b2);});});}exports[_0x664b('0x16')]=function(_0x257f41){var _0x393506=this;return new Promise(function(_0x3fe293,_0x4627c9){return db[_0x664b('0x17')][_0x664b('0x18')]({'raw':_0x257f41[_0x664b('0x19')]?_0x257f41[_0x664b('0x19')][_0x664b('0x1a')]===undefined?!![]:![]:!![],'where':_0x257f41[_0x664b('0x19')]?_0x257f41[_0x664b('0x19')][_0x664b('0x1b')]||null:null,'attributes':_0x257f41[_0x664b('0x19')]?_0x257f41[_0x664b('0x19')]['attributes']||null:null,'limit':_0x257f41[_0x664b('0x19')]?_0x257f41[_0x664b('0x19')]['limit']||null:null,'include':_0x257f41[_0x664b('0x19')]?_0x257f41['options'][_0x664b('0x1c')]?_['map'](_0x257f41[_0x664b('0x19')][_0x664b('0x1c')],function(_0x262630){return{'model':db[_0x262630[_0x664b('0x1d')]],'as':_0x262630['as'],'attributes':_0x262630['attributes'],'include':_0x262630[_0x664b('0x1c')]?_[_0x664b('0x1e')](_0x262630[_0x664b('0x1c')],function(_0x141072){return{'model':db[_0x141072[_0x664b('0x1d')]],'as':_0x141072['as'],'attributes':_0x141072[_0x664b('0x1f')],'include':_0x141072[_0x664b('0x1c')]?_[_0x664b('0x1e')](_0x141072[_0x664b('0x1c')],function(_0x1f787e){return{'model':db[_0x1f787e[_0x664b('0x1d')]],'as':_0x1f787e['as'],'attributes':_0x1f787e['attributes']};}):[]};}):[]};}):[]:[]})[_0x664b('0xb')](function(_0x84f19b){logger[_0x664b('0x20')](_0x664b('0x16'),_0x257f41);logger[_0x664b('0xd')]('GetVoiceCallReport',_0x257f41,JSON[_0x664b('0xf')](_0x84f19b));_0x3fe293(_0x84f19b);})[_0x664b('0x15')](function(_0x1ac386){logger[_0x664b('0x10')](_0x664b('0x16'),_0x1ac386['message'],_0x257f41);_0x4627c9(_0x393506[_0x664b('0x10')](0x1f4,_0x1ac386['message']));});});};exports[_0x664b('0x21')]=function(_0x391e6c){var _0x1f8a99=this;return new Promise(function(_0x5d96fc,_0x2f7f8d){return db[_0x664b('0x17')][_0x664b('0x22')](_0x391e6c[_0x664b('0x23')],{'raw':_0x391e6c['options']?_0x391e6c[_0x664b('0x19')][_0x664b('0x1a')]===undefined?!![]:![]:!![]})[_0x664b('0xb')](function(_0x18370d){logger['info'](_0x664b('0x21'),_0x391e6c);logger['debug'](_0x664b('0x21'),_0x391e6c,JSON[_0x664b('0xf')](_0x18370d));_0x5d96fc(_0x18370d);})['catch'](function(_0x3f24d7){logger[_0x664b('0x10')]('CreateVoiceCallReport',_0x3f24d7[_0x664b('0x12')],_0x391e6c);_0x2f7f8d(_0x1f8a99['error'](0x1f4,_0x3f24d7[_0x664b('0x12')]));});});};exports['UpdateVoiceCallReport']=function(_0x5d1cc8){var _0x7d1bbb=this;return new Promise(function(_0x17770a,_0x52e75a){return db['VoiceCallReport'][_0x664b('0x24')](_0x5d1cc8[_0x664b('0x23')],{'raw':_0x5d1cc8[_0x664b('0x19')]?_0x5d1cc8['options'][_0x664b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d1cc8[_0x664b('0x19')]?_0x5d1cc8['options'][_0x664b('0x1b')]||null:null,'attributes':_0x5d1cc8[_0x664b('0x19')]?_0x5d1cc8[_0x664b('0x19')][_0x664b('0x1f')]||null:null,'limit':_0x5d1cc8[_0x664b('0x19')]?_0x5d1cc8['options'][_0x664b('0x25')]||null:null})[_0x664b('0xb')](function(_0x51a7aa){logger[_0x664b('0x20')](_0x664b('0x26'),_0x5d1cc8);logger['debug'](_0x664b('0x26'),_0x5d1cc8,JSON['stringify'](_0x51a7aa));_0x17770a(_0x51a7aa);})[_0x664b('0x15')](function(_0x4f38e3){logger[_0x664b('0x10')](_0x664b('0x26'),_0x4f38e3[_0x664b('0x12')],_0x5d1cc8);_0x52e75a(_0x7d1bbb[_0x664b('0x10')](0x1f4,_0x4f38e3[_0x664b('0x12')]));});});}; \ No newline at end of file +var _0x4611=['CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','map','include','model','debug'];(function(_0x9e0863,_0x33e1bc){var _0x3817b4=function(_0x1acfd3){while(--_0x1acfd3){_0x9e0863['push'](_0x9e0863['shift']());}};_0x3817b4(++_0x33e1bc);}(_0x4611,0x1cd));var _0x1461=function(_0x390163,_0x3263d8){_0x390163=_0x390163-0x0;var _0x1b8c45=_0x4611[_0x390163];return _0x1b8c45;};'use strict';var _=require(_0x1461('0x0'));var util=require(_0x1461('0x1'));var moment=require(_0x1461('0x2'));var BPromise=require(_0x1461('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1461('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1461('0x5'));var logger=require(_0x1461('0x6'))(_0x1461('0x7'));var config=require(_0x1461('0x8'));var jayson=require(_0x1461('0x9'));var client=jayson['client'][_0x1461('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30292a,_0x1dcf93,_0x3a837d){return new BPromise(function(_0x27d870,_0xdac648){return client[_0x1461('0xb')](_0x30292a,_0x3a837d)[_0x1461('0xc')](function(_0x487526){logger[_0x1461('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x1dcf93,_0x1461('0xe'));logger['debug'](_0x1461('0xf'),_0x1dcf93,_0x1461('0xe'),JSON[_0x1461('0x10')](_0x487526));if(_0x487526[_0x1461('0x11')]){if(_0x487526[_0x1461('0x11')][_0x1461('0x12')]===0x1f4){logger[_0x1461('0x11')](_0x1461('0x13'),_0x1dcf93,_0x487526[_0x1461('0x11')][_0x1461('0x14')]);return _0xdac648(_0x487526[_0x1461('0x11')][_0x1461('0x14')]);}logger[_0x1461('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x1dcf93,_0x487526['error'][_0x1461('0x14')]);return _0x27d870(_0x487526[_0x1461('0x11')][_0x1461('0x14')]);}else{logger[_0x1461('0xd')](_0x1461('0x13'),_0x1dcf93,_0x1461('0xe'));_0x27d870(_0x487526['result'][_0x1461('0x14')]);}})[_0x1461('0x15')](function(_0x4b6159){logger[_0x1461('0x11')](_0x1461('0x13'),_0x1dcf93,_0x4b6159);_0xdac648(_0x4b6159);});});}exports[_0x1461('0x16')]=function(_0x529aef){var _0x58664f=this;return new Promise(function(_0x41a627,_0x4b2d39){return db[_0x1461('0x17')]['findAll']({'raw':_0x529aef[_0x1461('0x18')]?_0x529aef[_0x1461('0x18')][_0x1461('0x19')]===undefined?!![]:![]:!![],'where':_0x529aef[_0x1461('0x18')]?_0x529aef[_0x1461('0x18')][_0x1461('0x1a')]||null:null,'attributes':_0x529aef[_0x1461('0x18')]?_0x529aef['options'][_0x1461('0x1b')]||null:null,'limit':_0x529aef[_0x1461('0x18')]?_0x529aef[_0x1461('0x18')][_0x1461('0x1c')]||null:null,'include':_0x529aef[_0x1461('0x18')]?_0x529aef[_0x1461('0x18')]['include']?_[_0x1461('0x1d')](_0x529aef[_0x1461('0x18')][_0x1461('0x1e')],function(_0x441ea1){return{'model':db[_0x441ea1[_0x1461('0x1f')]],'as':_0x441ea1['as'],'attributes':_0x441ea1['attributes'],'include':_0x441ea1[_0x1461('0x1e')]?_[_0x1461('0x1d')](_0x441ea1['include'],function(_0x5f40eb){return{'model':db[_0x5f40eb[_0x1461('0x1f')]],'as':_0x5f40eb['as'],'attributes':_0x5f40eb['attributes'],'include':_0x5f40eb['include']?_[_0x1461('0x1d')](_0x5f40eb[_0x1461('0x1e')],function(_0x4e8a02){return{'model':db[_0x4e8a02[_0x1461('0x1f')]],'as':_0x4e8a02['as'],'attributes':_0x4e8a02[_0x1461('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1461('0xc')](function(_0x1a083c){logger[_0x1461('0xd')](_0x1461('0x16'),_0x529aef);logger[_0x1461('0x20')](_0x1461('0x16'),_0x529aef,JSON[_0x1461('0x10')](_0x1a083c));_0x41a627(_0x1a083c);})[_0x1461('0x15')](function(_0x1e6a0d){logger[_0x1461('0x11')](_0x1461('0x16'),_0x1e6a0d[_0x1461('0x14')],_0x529aef);_0x4b2d39(_0x58664f['error'](0x1f4,_0x1e6a0d['message']));});});};exports[_0x1461('0x21')]=function(_0x1473d1){var _0x5b5f13=this;return new Promise(function(_0x9cf65f,_0x262a00){return db['VoiceCallReport'][_0x1461('0x22')](_0x1473d1[_0x1461('0x23')],{'raw':_0x1473d1['options']?_0x1473d1[_0x1461('0x18')][_0x1461('0x19')]===undefined?!![]:![]:!![]})[_0x1461('0xc')](function(_0x41665e){logger['info'](_0x1461('0x21'),_0x1473d1);logger['debug'](_0x1461('0x21'),_0x1473d1,JSON['stringify'](_0x41665e));_0x9cf65f(_0x41665e);})[_0x1461('0x15')](function(_0x20ff4a){logger['error'](_0x1461('0x21'),_0x20ff4a[_0x1461('0x14')],_0x1473d1);_0x262a00(_0x5b5f13[_0x1461('0x11')](0x1f4,_0x20ff4a[_0x1461('0x14')]));});});};exports[_0x1461('0x24')]=function(_0x536aed){var _0xfd7896=this;return new Promise(function(_0x4c00e3,_0x53c0ad){return db[_0x1461('0x17')][_0x1461('0x25')](_0x536aed[_0x1461('0x23')],{'raw':_0x536aed['options']?_0x536aed[_0x1461('0x18')][_0x1461('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x536aed['options']?_0x536aed[_0x1461('0x18')][_0x1461('0x1a')]||null:null,'attributes':_0x536aed[_0x1461('0x18')]?_0x536aed[_0x1461('0x18')][_0x1461('0x1b')]||null:null,'limit':_0x536aed[_0x1461('0x18')]?_0x536aed[_0x1461('0x18')]['limit']||null:null})[_0x1461('0xc')](function(_0x4fc1af){logger[_0x1461('0xd')](_0x1461('0x24'),_0x536aed);logger[_0x1461('0x20')](_0x1461('0x24'),_0x536aed,JSON[_0x1461('0x10')](_0x4fc1af));_0x4c00e3(_0x4fc1af);})[_0x1461('0x15')](function(_0x23b08f){logger['error'](_0x1461('0x24'),_0x23b08f[_0x1461('0x14')],_0x536aed);_0x53c0ad(_0xfd7896['error'](0x1f4,_0x23b08f['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 357f780..e93cbd9 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 _0x325f=['get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller'];(function(_0x49949b,_0x2e758f){var _0x55ef4a=function(_0x5b1e81){while(--_0x5b1e81){_0x49949b['push'](_0x49949b['shift']());}};_0x55ef4a(++_0x2e758f);}(_0x325f,0x174));var _0xf325=function(_0x4fb4e6,_0x5cb8db){_0x4fb4e6=_0x4fb4e6-0x0;var _0x2313f3=_0x325f[_0x4fb4e6];return _0x2313f3;};'use strict';var multer=require(_0xf325('0x0'));var util=require('util');var path=require(_0xf325('0x1'));var timeout=require(_0xf325('0x2'));var express=require('express');var router=express[_0xf325('0x3')]();var auth=require(_0xf325('0x4'));var interaction=require(_0xf325('0x5'));var config=require(_0xf325('0x6'));var controller=require(_0xf325('0x7'));router[_0xf325('0x8')]('/',auth[_0xf325('0x9')](),controller[_0xf325('0xa')]);router[_0xf325('0x8')](_0xf325('0xb'),auth[_0xf325('0x9')](),controller[_0xf325('0xc')]);router[_0xf325('0xd')]('/',auth[_0xf325('0x9')](),controller[_0xf325('0xe')]);router[_0xf325('0xf')](_0xf325('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xf325('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xf325('0x11')]);module[_0xf325('0x12')]=router; \ No newline at end of file +var _0xcc20=['update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x2c4570,_0x21871d){var _0x26f4b0=function(_0x56b0dc){while(--_0x56b0dc){_0x2c4570['push'](_0x2c4570['shift']());}};_0x26f4b0(++_0x21871d);}(_0xcc20,0x114));var _0x0cc2=function(_0x5b3b6c,_0x4cde8c){_0x5b3b6c=_0x5b3b6c-0x0;var _0x1cba59=_0xcc20[_0x5b3b6c];return _0x1cba59;};'use strict';var multer=require(_0x0cc2('0x0'));var util=require(_0x0cc2('0x1'));var path=require('path');var timeout=require(_0x0cc2('0x2'));var express=require(_0x0cc2('0x3'));var router=express['Router']();var auth=require(_0x0cc2('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0cc2('0x5'));router[_0x0cc2('0x6')]('/',auth[_0x0cc2('0x7')](),controller['index']);router[_0x0cc2('0x6')](_0x0cc2('0x8'),auth['isAuthenticated'](),controller[_0x0cc2('0x9')]);router[_0x0cc2('0xa')]('/',auth[_0x0cc2('0x7')](),controller[_0x0cc2('0xb')]);router[_0x0cc2('0xc')](_0x0cc2('0x8'),auth['isAuthenticated'](),controller[_0x0cc2('0xd')]);router[_0x0cc2('0xe')]('/:id',auth[_0x0cc2('0x7')](),controller[_0x0cc2('0xf')]);module[_0x0cc2('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 d4f6a40..f5ff54c 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 _0xc525=['BOOLEAN','sequelize','exports','STRING','name','join','getDataValue','options','split'];(function(_0xafe7c4,_0x4d76a0){var _0x3138a0=function(_0x4dc3a8){while(--_0x4dc3a8){_0xafe7c4['push'](_0xafe7c4['shift']());}};_0x3138a0(++_0x4d76a0);}(_0xc525,0xe2));var _0x5c52=function(_0x4b8829,_0x236afa){_0x4b8829=_0x4b8829-0x0;var _0x4a0fa9=_0xc525[_0x4b8829];return _0x4a0fa9;};'use strict';var Sequelize=require(_0x5c52('0x0'));module[_0x5c52('0x1')]={'name':{'type':Sequelize[_0x5c52('0x2')]},'prefix':{'type':Sequelize[_0x5c52('0x2')],'unique':_0x5c52('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x5c52('0x2')],'set':function(_0xec507b){this['setDataValue']('options',_0xec507b?_0xec507b[_0x5c52('0x4')](''):[]);},'get':function(){return this[_0x5c52('0x5')](_0x5c52('0x6'))?this[_0x5c52('0x5')](_0x5c52('0x6'))[_0x5c52('0x7')](''):[];}},'auth':{'type':Sequelize[_0x5c52('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x5c52('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5c52('0x2')]}}; \ No newline at end of file +var _0xca44=['STRING','name','setDataValue','options','getDataValue','split','BOOLEAN','exports'];(function(_0x108db1,_0x89896d){var _0x16848d=function(_0x2726f6){while(--_0x2726f6){_0x108db1['push'](_0x108db1['shift']());}};_0x16848d(++_0x89896d);}(_0xca44,0xff));var _0x4ca4=function(_0x1d24f9,_0x54c085){_0x1d24f9=_0x1d24f9-0x0;var _0x10e1c1=_0xca44[_0x1d24f9];return _0x10e1c1;};'use strict';var Sequelize=require('sequelize');module[_0x4ca4('0x0')]={'name':{'type':Sequelize[_0x4ca4('0x1')]},'prefix':{'type':Sequelize[_0x4ca4('0x1')],'unique':_0x4ca4('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x4ca4('0x1')],'set':function(_0x52d8fc){this[_0x4ca4('0x3')](_0x4ca4('0x4'),_0x52d8fc?_0x52d8fc['join'](''):[]);},'get':function(){return this[_0x4ca4('0x5')](_0x4ca4('0x4'))?this[_0x4ca4('0x5')](_0x4ca4('0x4'))[_0x4ca4('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x4ca4('0x1')]},'record':{'type':Sequelize[_0x4ca4('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x4ca4('0x1')]},'description':{'type':Sequelize[_0x4ca4('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 7a4a734..84e73f7 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 _0x5e6b=['json','count','offset','limit','set','Content-Range','reject','save','update','destroy','get','ChanSpies','then','error','stack','name','send','VoiceChanSpy','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0x5e6b,0x16c));var _0xb5e6=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0x5e6b[_0x40b3f2];return _0x4ce90c;};'use strict';var pdf=require(_0xb5e6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb5e6('0x1'));var rp=require(_0xb5e6('0x2'));var moment=require(_0xb5e6('0x3'));var BPromise=require(_0xb5e6('0x4'));var Mustache=require(_0xb5e6('0x5'));var util=require(_0xb5e6('0x6'));var path=require(_0xb5e6('0x7'));var sox=require('sox');var csv=require(_0xb5e6('0x8'));var ejs=require(_0xb5e6('0x9'));var fs=require('fs');var _=require(_0xb5e6('0xa'));var squel=require(_0xb5e6('0xb'));var crypto=require('crypto');var jsforce=require(_0xb5e6('0xc'));var deskjs=require(_0xb5e6('0xd'));var toCsv=require(_0xb5e6('0x8'));var querystring=require(_0xb5e6('0xe'));var Papa=require(_0xb5e6('0xf'));var Redis=require(_0xb5e6('0x10'));var authService=require(_0xb5e6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb5e6('0x12'));var hardwareService=require(_0xb5e6('0x13'));var logger=require(_0xb5e6('0x14'))(_0xb5e6('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb5e6('0x16'))['db'];function respondWithStatusCode(_0x2b3430,_0x377047){_0x377047=_0x377047||0xcc;return function(_0x1add0f){if(_0x1add0f){return _0x2b3430[_0xb5e6('0x17')](_0x377047);}return _0x2b3430[_0xb5e6('0x18')](_0x377047)[_0xb5e6('0x19')]();};}function respondWithResult(_0x2b7f9b,_0x12d24a){_0x12d24a=_0x12d24a||0xc8;return function(_0x16e78c){if(_0x16e78c){return _0x2b7f9b[_0xb5e6('0x18')](_0x12d24a)[_0xb5e6('0x1a')](_0x16e78c);}};}function respondWithFilteredResult(_0x26f4c6,_0x375e53){return function(_0x16c813){if(_0x16c813){var _0x85e945=_0x16c813[_0xb5e6('0x1b')],_0x4a12a1=_0x375e53[_0xb5e6('0x1c')],_0xcc4fe8=_0x375e53[_0xb5e6('0x1c')]+_0x375e53[_0xb5e6('0x1d')],_0x382280;if(_0xcc4fe8>=_0x85e945){_0xcc4fe8=_0x85e945;_0x382280=0xc8;}else{_0x382280=0xce;}_0x26f4c6['status'](_0x382280);return _0x26f4c6[_0xb5e6('0x1e')](_0xb5e6('0x1f'),_0x4a12a1+'-'+_0xcc4fe8+'/'+_0x85e945)[_0xb5e6('0x1a')](_0x16c813);}return null;};}function patchUpdates(_0x4ac11a){return function(_0x59cff1){try{jsonpatch['apply'](_0x59cff1,_0x4ac11a,!![]);}catch(_0x252e69){return BPromise[_0xb5e6('0x20')](_0x252e69);}return _0x59cff1[_0xb5e6('0x21')]();};}function saveUpdates(_0x7cda8e,_0x5462d8){return function(_0x52afc0){if(_0x52afc0){return _0x52afc0[_0xb5e6('0x22')](_0x7cda8e)['then'](function(_0xe97b7c){return _0xe97b7c;});}return null;};}function removeEntity(_0xb8e0ec,_0x3a2d47){return function(_0x3664dc){if(_0x3664dc){return _0x3664dc[_0xb5e6('0x23')]()['then'](function(){var _0x1b68e0=_0x3664dc[_0xb5e6('0x24')]({'plain':!![]});var _0x306cd6=_0xb5e6('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x306cd6,'resourceId':_0x1b68e0['id']}})[_0xb5e6('0x26')](function(){return _0x3664dc;});})[_0xb5e6('0x26')](function(){_0xb8e0ec[_0xb5e6('0x18')](0xcc)[_0xb5e6('0x19')]();});}};}function handleEntityNotFound(_0x39e341,_0x5c1eb7){return function(_0x170fb3){if(!_0x170fb3){_0x39e341[_0xb5e6('0x17')](0x194);}return _0x170fb3;};}function handleError(_0x5e9e3b,_0x130267){_0x130267=_0x130267||0x1f4;return function(_0x8051f5){logger[_0xb5e6('0x27')](_0x8051f5[_0xb5e6('0x28')]);if(_0x8051f5[_0xb5e6('0x29')]){delete _0x8051f5[_0xb5e6('0x29')];}_0x5e9e3b['status'](_0x130267)[_0xb5e6('0x2a')](_0x8051f5);};}exports['index']=function(_0x1745f3,_0x37f72b){var _0x44918e={},_0x31fd30={},_0x1bfea5={'count':0x0,'rows':[]};var _0x164065=_['map'](db[_0xb5e6('0x2b')]['rawAttributes'],function(_0x3386f4){return{'name':_0x3386f4[_0xb5e6('0x2c')],'type':_0x3386f4[_0xb5e6('0x2d')][_0xb5e6('0x2e')]};});_0x31fd30[_0xb5e6('0x2f')]=_[_0xb5e6('0x30')](_0x164065,_0xb5e6('0x29'));_0x31fd30[_0xb5e6('0x31')]=_[_0xb5e6('0x32')](_0x1745f3[_0xb5e6('0x31')]);_0x31fd30[_0xb5e6('0x33')]=_[_0xb5e6('0x34')](_0x31fd30[_0xb5e6('0x2f')],_0x31fd30['query']);_0x44918e[_0xb5e6('0x35')]=_[_0xb5e6('0x34')](_0x31fd30[_0xb5e6('0x2f')],qs[_0xb5e6('0x36')](_0x1745f3[_0xb5e6('0x31')][_0xb5e6('0x36')]));_0x44918e[_0xb5e6('0x35')]=_0x44918e['attributes']['length']?_0x44918e[_0xb5e6('0x35')]:_0x31fd30[_0xb5e6('0x2f')];if(!_0x1745f3[_0xb5e6('0x31')][_0xb5e6('0x37')](_0xb5e6('0x38'))){_0x44918e[_0xb5e6('0x1d')]=qs[_0xb5e6('0x1d')](_0x1745f3[_0xb5e6('0x31')]['limit']);_0x44918e[_0xb5e6('0x1c')]=qs[_0xb5e6('0x1c')](_0x1745f3[_0xb5e6('0x31')]['offset']);}_0x44918e['order']=qs['sort'](_0x1745f3[_0xb5e6('0x31')]['sort']);_0x44918e[_0xb5e6('0x39')]=qs[_0xb5e6('0x33')](_['pick'](_0x1745f3['query'],_0x31fd30['filters']),_0x164065);if(_0x1745f3[_0xb5e6('0x31')][_0xb5e6('0x3a')]){_0x44918e[_0xb5e6('0x39')]=_[_0xb5e6('0x3b')](_0x44918e['where'],{'$or':_[_0xb5e6('0x30')](_0x164065,function(_0x4ebe96){if(_0x4ebe96['type']!==_0xb5e6('0x3c')){var _0x128c51={};_0x128c51[_0x4ebe96['name']]={'$like':'%'+_0x1745f3[_0xb5e6('0x31')][_0xb5e6('0x3a')]+'%'};return _0x128c51;}})});}_0x44918e=_['merge']({},_0x44918e,_0x1745f3[_0xb5e6('0x3d')]);var _0x1fd50a={'where':_0x44918e[_0xb5e6('0x39')]};return db['VoiceChanSpy'][_0xb5e6('0x1b')](_0x1fd50a)[_0xb5e6('0x26')](function(_0x306b3b){_0x1bfea5[_0xb5e6('0x1b')]=_0x306b3b;if(_0x1745f3[_0xb5e6('0x31')][_0xb5e6('0x3e')]){_0x44918e[_0xb5e6('0x3f')]=[{'all':!![]}];}return db[_0xb5e6('0x2b')][_0xb5e6('0x40')](_0x44918e);})[_0xb5e6('0x26')](function(_0x4a2748){_0x1bfea5[_0xb5e6('0x41')]=_0x4a2748;return _0x1bfea5;})[_0xb5e6('0x26')](respondWithFilteredResult(_0x37f72b,_0x44918e))[_0xb5e6('0x42')](handleError(_0x37f72b,null));};exports[_0xb5e6('0x43')]=function(_0x487c39,_0x9f0842){var _0x41efb0={'raw':![],'where':{'id':_0x487c39[_0xb5e6('0x44')]['id']}},_0x27eb86={};_0x27eb86[_0xb5e6('0x2f')]=_[_0xb5e6('0x32')](db[_0xb5e6('0x2b')][_0xb5e6('0x45')]);_0x27eb86['query']=_['keys'](_0x487c39['query']);_0x27eb86['filtears']=_['intersection'](_0x27eb86['model'],_0x27eb86[_0xb5e6('0x31')]);_0x41efb0['attributes']=_[_0xb5e6('0x34')](_0x27eb86[_0xb5e6('0x2f')],qs['fields'](_0x487c39[_0xb5e6('0x31')][_0xb5e6('0x36')]));_0x41efb0[_0xb5e6('0x35')]=_0x41efb0['attributes']['length']?_0x41efb0[_0xb5e6('0x35')]:_0x27eb86[_0xb5e6('0x2f')];if(_0x487c39[_0xb5e6('0x31')][_0xb5e6('0x3e')]){_0x41efb0['include']=[{'all':!![]}];}_0x41efb0=_[_0xb5e6('0x3b')]({},_0x41efb0,_0x487c39[_0xb5e6('0x3d')]);return db['VoiceChanSpy']['find'](_0x41efb0)[_0xb5e6('0x26')](handleEntityNotFound(_0x9f0842,null))[_0xb5e6('0x26')](respondWithResult(_0x9f0842,null))['catch'](handleError(_0x9f0842,null));};exports[_0xb5e6('0x46')]=function(_0x1d8f17,_0x245cce){return db[_0xb5e6('0x2b')][_0xb5e6('0x46')](_0x1d8f17['body'],{})[_0xb5e6('0x26')](function(_0x27c860){var _0x4ca8b3=_0x1d8f17['user'][_0xb5e6('0x24')]({'plain':!![]});if(!_0x4ca8b3)throw new Error(_0xb5e6('0x47'));if(_0x4ca8b3['role']===_0xb5e6('0x48')){var _0x53d42a=_0x27c860[_0xb5e6('0x24')]({'plain':!![]});var _0x28944f=_0xb5e6('0x25');return db['UserProfileSection'][_0xb5e6('0x49')]({'where':{'name':_0x28944f,'userProfileId':_0x4ca8b3[_0xb5e6('0x4a')]},'raw':!![]})[_0xb5e6('0x26')](function(_0x29d43a){if(_0x29d43a&&_0x29d43a[_0xb5e6('0x4b')]===0x0){return db['UserProfileResource'][_0xb5e6('0x46')]({'name':_0x53d42a[_0xb5e6('0x29')],'resourceId':_0x53d42a['id'],'type':_0x29d43a[_0xb5e6('0x29')],'sectionId':_0x29d43a['id']},{})[_0xb5e6('0x26')](function(){return _0x27c860;});}else{return _0x27c860;}})[_0xb5e6('0x42')](function(_0x2ff405){logger['error'](_0xb5e6('0x4c'),_0x2ff405);throw _0x2ff405;});}return _0x27c860;})[_0xb5e6('0x26')](respondWithResult(_0x245cce,0xc9))[_0xb5e6('0x42')](handleError(_0x245cce,null));};exports['update']=function(_0xac48d3,_0x2d03a1){if(_0xac48d3[_0xb5e6('0x4d')]['id']){delete _0xac48d3[_0xb5e6('0x4d')]['id'];}return db[_0xb5e6('0x2b')][_0xb5e6('0x49')]({'where':{'id':_0xac48d3['params']['id']}})[_0xb5e6('0x26')](handleEntityNotFound(_0x2d03a1,null))[_0xb5e6('0x26')](saveUpdates(_0xac48d3[_0xb5e6('0x4d')],null))['then'](respondWithResult(_0x2d03a1,null))[_0xb5e6('0x42')](handleError(_0x2d03a1,null));};exports[_0xb5e6('0x23')]=function(_0x3b80cf,_0x509c26){return db[_0xb5e6('0x2b')]['find']({'where':{'id':_0x3b80cf[_0xb5e6('0x44')]['id']}})[_0xb5e6('0x26')](handleEntityNotFound(_0x509c26,null))['then'](removeEntity(_0x509c26,null))[_0xb5e6('0x42')](handleError(_0x509c26,null));}; \ No newline at end of file +var _0x0383=['limit','set','Content-Range','apply','reject','update','destroy','then','get','ChanSpies','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','attributes','nolimit','order','sort','where','filters','pick','type','VIRTUAL','merge','count','includeAll','include','VoiceChanSpy','rows','show','params','intersection','fields','length','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x56120c,_0x274c6d){var _0x33f028=function(_0x2d8fb4){while(--_0x2d8fb4){_0x56120c['push'](_0x56120c['shift']());}};_0x33f028(++_0x274c6d);}(_0x0383,0x8a));var _0x3038=function(_0x353e11,_0x37b28f){_0x353e11=_0x353e11-0x0;var _0x23a0c7=_0x0383[_0x353e11];return _0x23a0c7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3038('0x0'));var zipdir=require(_0x3038('0x1'));var jsonpatch=require(_0x3038('0x2'));var rp=require(_0x3038('0x3'));var moment=require(_0x3038('0x4'));var BPromise=require(_0x3038('0x5'));var Mustache=require(_0x3038('0x6'));var util=require(_0x3038('0x7'));var path=require('path');var sox=require(_0x3038('0x8'));var csv=require(_0x3038('0x9'));var ejs=require(_0x3038('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3038('0xb'));var crypto=require(_0x3038('0xc'));var jsforce=require(_0x3038('0xd'));var deskjs=require(_0x3038('0xe'));var toCsv=require(_0x3038('0x9'));var querystring=require(_0x3038('0xf'));var Papa=require(_0x3038('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3038('0x11'));var hardwareService=require(_0x3038('0x12'));var logger=require(_0x3038('0x13'))(_0x3038('0x14'));var utils=require(_0x3038('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3038('0x16'))['db'];function respondWithStatusCode(_0x2da5ea,_0x25a14f){_0x25a14f=_0x25a14f||0xcc;return function(_0x558114){if(_0x558114){return _0x2da5ea[_0x3038('0x17')](_0x25a14f);}return _0x2da5ea[_0x3038('0x18')](_0x25a14f)[_0x3038('0x19')]();};}function respondWithResult(_0x4728f4,_0x572873){_0x572873=_0x572873||0xc8;return function(_0x5595df){if(_0x5595df){return _0x4728f4['status'](_0x572873)[_0x3038('0x1a')](_0x5595df);}};}function respondWithFilteredResult(_0x1712ab,_0x2cdf82){return function(_0x131d1c){if(_0x131d1c){var _0x43188c=_0x131d1c['count'],_0x11d35a=_0x2cdf82[_0x3038('0x1b')],_0x5a0020=_0x2cdf82[_0x3038('0x1b')]+_0x2cdf82[_0x3038('0x1c')],_0x28eac2;if(_0x5a0020>=_0x43188c){_0x5a0020=_0x43188c;_0x28eac2=0xc8;}else{_0x28eac2=0xce;}_0x1712ab['status'](_0x28eac2);return _0x1712ab[_0x3038('0x1d')](_0x3038('0x1e'),_0x11d35a+'-'+_0x5a0020+'/'+_0x43188c)[_0x3038('0x1a')](_0x131d1c);}return null;};}function patchUpdates(_0x3b76ff){return function(_0x39b0c3){try{jsonpatch[_0x3038('0x1f')](_0x39b0c3,_0x3b76ff,!![]);}catch(_0x1b7bee){return BPromise[_0x3038('0x20')](_0x1b7bee);}return _0x39b0c3['save']();};}function saveUpdates(_0x386eaa,_0xd6e53d){return function(_0x54fe7f){if(_0x54fe7f){return _0x54fe7f[_0x3038('0x21')](_0x386eaa)['then'](function(_0x5bb59a){return _0x5bb59a;});}return null;};}function removeEntity(_0x10a238,_0x252c32){return function(_0x52590e){if(_0x52590e){return _0x52590e[_0x3038('0x22')]()[_0x3038('0x23')](function(){var _0x55423a=_0x52590e[_0x3038('0x24')]({'plain':!![]});var _0x2c70f8=_0x3038('0x25');return db[_0x3038('0x26')][_0x3038('0x22')]({'where':{'type':_0x2c70f8,'resourceId':_0x55423a['id']}})[_0x3038('0x23')](function(){return _0x52590e;});})[_0x3038('0x23')](function(){_0x10a238[_0x3038('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x97bc8a,_0x63d7af){return function(_0x3d0844){if(!_0x3d0844){_0x97bc8a['sendStatus'](0x194);}return _0x3d0844;};}function handleError(_0x4ce3b1,_0x2b607c){_0x2b607c=_0x2b607c||0x1f4;return function(_0x159a87){logger[_0x3038('0x27')](_0x159a87[_0x3038('0x28')]);if(_0x159a87[_0x3038('0x29')]){delete _0x159a87['name'];}_0x4ce3b1[_0x3038('0x18')](_0x2b607c)[_0x3038('0x2a')](_0x159a87);};}exports[_0x3038('0x2b')]=function(_0x384875,_0x37d50a){var _0x477767={},_0x200562={},_0x43b2f0={'count':0x0,'rows':[]};var _0xfc975f=_[_0x3038('0x2c')](db['VoiceChanSpy'][_0x3038('0x2d')],function(_0x42f96d){return{'name':_0x42f96d[_0x3038('0x2e')],'type':_0x42f96d['type'][_0x3038('0x2f')]};});_0x200562[_0x3038('0x30')]=_[_0x3038('0x2c')](_0xfc975f,_0x3038('0x29'));_0x200562[_0x3038('0x31')]=_[_0x3038('0x32')](_0x384875[_0x3038('0x31')]);_0x200562['filters']=_['intersection'](_0x200562[_0x3038('0x30')],_0x200562[_0x3038('0x31')]);_0x477767[_0x3038('0x33')]=_['intersection'](_0x200562[_0x3038('0x30')],qs['fields'](_0x384875[_0x3038('0x31')]['fields']));_0x477767['attributes']=_0x477767[_0x3038('0x33')]['length']?_0x477767[_0x3038('0x33')]:_0x200562[_0x3038('0x30')];if(!_0x384875[_0x3038('0x31')]['hasOwnProperty'](_0x3038('0x34'))){_0x477767[_0x3038('0x1c')]=qs[_0x3038('0x1c')](_0x384875[_0x3038('0x31')][_0x3038('0x1c')]);_0x477767[_0x3038('0x1b')]=qs['offset'](_0x384875[_0x3038('0x31')][_0x3038('0x1b')]);}_0x477767[_0x3038('0x35')]=qs['sort'](_0x384875[_0x3038('0x31')][_0x3038('0x36')]);_0x477767[_0x3038('0x37')]=qs[_0x3038('0x38')](_[_0x3038('0x39')](_0x384875[_0x3038('0x31')],_0x200562[_0x3038('0x38')]),_0xfc975f);if(_0x384875[_0x3038('0x31')]['filter']){_0x477767[_0x3038('0x37')]=_['merge'](_0x477767[_0x3038('0x37')],{'$or':_['map'](_0xfc975f,function(_0xcc57f6){if(_0xcc57f6[_0x3038('0x3a')]!==_0x3038('0x3b')){var _0x100a6a={};_0x100a6a[_0xcc57f6[_0x3038('0x29')]]={'$like':'%'+_0x384875[_0x3038('0x31')]['filter']+'%'};return _0x100a6a;}})});}_0x477767=_[_0x3038('0x3c')]({},_0x477767,_0x384875['options']);var _0x435fe1={'where':_0x477767[_0x3038('0x37')]};return db['VoiceChanSpy'][_0x3038('0x3d')](_0x435fe1)[_0x3038('0x23')](function(_0x24143a){_0x43b2f0[_0x3038('0x3d')]=_0x24143a;if(_0x384875[_0x3038('0x31')][_0x3038('0x3e')]){_0x477767[_0x3038('0x3f')]=[{'all':!![]}];}return db[_0x3038('0x40')]['findAll'](_0x477767);})[_0x3038('0x23')](function(_0x104d12){_0x43b2f0[_0x3038('0x41')]=_0x104d12;return _0x43b2f0;})['then'](respondWithFilteredResult(_0x37d50a,_0x477767))['catch'](handleError(_0x37d50a,null));};exports[_0x3038('0x42')]=function(_0x2541a2,_0x32256b){var _0xb5bfe4={'raw':![],'where':{'id':_0x2541a2[_0x3038('0x43')]['id']}},_0x50bc8b={};_0x50bc8b[_0x3038('0x30')]=_[_0x3038('0x32')](db[_0x3038('0x40')][_0x3038('0x2d')]);_0x50bc8b[_0x3038('0x31')]=_[_0x3038('0x32')](_0x2541a2['query']);_0x50bc8b['filtears']=_[_0x3038('0x44')](_0x50bc8b['model'],_0x50bc8b[_0x3038('0x31')]);_0xb5bfe4[_0x3038('0x33')]=_[_0x3038('0x44')](_0x50bc8b[_0x3038('0x30')],qs[_0x3038('0x45')](_0x2541a2[_0x3038('0x31')][_0x3038('0x45')]));_0xb5bfe4[_0x3038('0x33')]=_0xb5bfe4[_0x3038('0x33')][_0x3038('0x46')]?_0xb5bfe4[_0x3038('0x33')]:_0x50bc8b[_0x3038('0x30')];if(_0x2541a2[_0x3038('0x31')]['includeAll']){_0xb5bfe4['include']=[{'all':!![]}];}_0xb5bfe4=_[_0x3038('0x3c')]({},_0xb5bfe4,_0x2541a2[_0x3038('0x47')]);return db['VoiceChanSpy'][_0x3038('0x48')](_0xb5bfe4)['then'](handleEntityNotFound(_0x32256b,null))[_0x3038('0x23')](respondWithResult(_0x32256b,null))[_0x3038('0x49')](handleError(_0x32256b,null));};exports[_0x3038('0x4a')]=function(_0x16ea67,_0x43e211){return db[_0x3038('0x40')][_0x3038('0x4a')](_0x16ea67[_0x3038('0x4b')],{})['then'](function(_0x3b2da5){var _0x31d731=_0x16ea67[_0x3038('0x4c')]['get']({'plain':!![]});if(!_0x31d731)throw new Error(_0x3038('0x4d'));if(_0x31d731[_0x3038('0x4e')]===_0x3038('0x4c')){var _0x2f70d0=_0x3b2da5['get']({'plain':!![]});var _0x145396=_0x3038('0x25');return db[_0x3038('0x4f')][_0x3038('0x48')]({'where':{'name':_0x145396,'userProfileId':_0x31d731[_0x3038('0x50')]},'raw':!![]})[_0x3038('0x23')](function(_0x12ec7d){if(_0x12ec7d&&_0x12ec7d[_0x3038('0x51')]===0x0){return db[_0x3038('0x26')][_0x3038('0x4a')]({'name':_0x2f70d0[_0x3038('0x29')],'resourceId':_0x2f70d0['id'],'type':_0x12ec7d[_0x3038('0x29')],'sectionId':_0x12ec7d['id']},{})[_0x3038('0x23')](function(){return _0x3b2da5;});}else{return _0x3b2da5;}})[_0x3038('0x49')](function(_0x48703c){logger[_0x3038('0x27')](_0x3038('0x52'),_0x48703c);throw _0x48703c;});}return _0x3b2da5;})[_0x3038('0x23')](respondWithResult(_0x43e211,0xc9))['catch'](handleError(_0x43e211,null));};exports['update']=function(_0xa1078c,_0x56c2c3){if(_0xa1078c[_0x3038('0x4b')]['id']){delete _0xa1078c['body']['id'];}return db[_0x3038('0x40')][_0x3038('0x48')]({'where':{'id':_0xa1078c[_0x3038('0x43')]['id']}})['then'](handleEntityNotFound(_0x56c2c3,null))['then'](saveUpdates(_0xa1078c[_0x3038('0x4b')],null))[_0x3038('0x23')](respondWithResult(_0x56c2c3,null))[_0x3038('0x49')](handleError(_0x56c2c3,null));};exports[_0x3038('0x22')]=function(_0xd6b690,_0xad8eed){return db[_0x3038('0x40')][_0x3038('0x48')]({'where':{'id':_0xd6b690[_0x3038('0x43')]['id']}})[_0x3038('0x23')](handleEntityNotFound(_0xad8eed,null))[_0x3038('0x23')](removeEntity(_0xad8eed,null))[_0x3038('0x49')](handleError(_0xad8eed,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 67d645c..0bd185d 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 _0xee53=['chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','password','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','catch','define','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s'];(function(_0x3942aa,_0x7d789c){var _0x1345c9=function(_0x2bf0b6){while(--_0x2bf0b6){_0x3942aa['push'](_0x3942aa['shift']());}};_0x1345c9(++_0x7d789c);}(_0xee53,0xa8));var _0x3ee5=function(_0x53f897,_0x539857){_0x53f897=_0x53f897-0x0;var _0x6879f8=_0xee53[_0x53f897];return _0x6879f8;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x3ee5('0x0'));var attributes=require(_0x3ee5('0x1'));var getUserApplications=function(_0x2a66a5,_0x5d31e0,_0x3217ab){var _0x25de7e=0x1;var _0x17d29c=[];var _0xdd9942={'context':_0x5d31e0[_0x3ee5('0x2')]||_0x3ee5('0x3'),'exten':util[_0x3ee5('0x4')](_0x3ee5('0x5'),_0x2a66a5[_0x3ee5('0x6')],_0x3217ab),'type':_0x3ee5('0x7'),'isApp':![],'ChanSpyId':_0x2a66a5['id'],'UserId':_0x5d31e0['id']};_0x17d29c[_0x3ee5('0x8')](_[_0x3ee5('0x9')]({'app':_0x3ee5('0xa'),'appdata':util['format'](_0x3ee5('0xb'),_0x3ee5('0xc')),'priority':_0x25de7e++},_0xdd9942));if(_0x2a66a5[_0x3ee5('0xd')]){_0x17d29c[_0x3ee5('0x8')](_['merge']({'app':_0x3ee5('0xe'),'appdata':util[_0x3ee5('0x4')](_0x3ee5('0xf'),_0x2a66a5[_0x3ee5('0x10')]),'priority':_0x25de7e++},_0xdd9942));}if(_0x2a66a5['auth']){_0x17d29c[_0x3ee5('0x8')](_[_0x3ee5('0x9')]({'app':'Authenticate','appdata':_0x2a66a5[_0x3ee5('0x11')],'priority':_0x25de7e++},_0xdd9942));}_0x17d29c['push'](_[_0x3ee5('0x9')]({'app':'ChanSpy','appdata':util['format'](_0x3ee5('0x12'),_0x5d31e0[_0x3ee5('0x13')],_0x2a66a5[_0x3ee5('0x14')]?_0x2a66a5[_0x3ee5('0x14')][_0x3ee5('0x15')](''):''),'priority':_0x25de7e++},_0xdd9942));if(_0x2a66a5[_0x3ee5('0xd')]){_0x17d29c[_0x3ee5('0x8')](_[_0x3ee5('0x9')]({'app':_0x3ee5('0x16'),'priority':_0x25de7e++},_0xdd9942));}return _0x17d29c;};var getChanSpyApplications=function(_0x5568f3,_0x221afa){var _0x57fb10=[];for(var _0xab5013=0x0,_0x3428e6=0x1;_0xab5013<_0x221afa[_0x3ee5('0x17')];_0xab5013++,_0x3428e6=0x1){_0x57fb10=_0x57fb10[_0x3ee5('0x18')](getUserApplications(_0x5568f3,_0x221afa[_0xab5013],_0x221afa[_0xab5013][_0x3ee5('0x19')]));if(_0x221afa[_0xab5013][_0x3ee5('0x19')]!=_0x221afa[_0xab5013][_0x3ee5('0x13')]){_0x57fb10=_0x57fb10['concat'](getUserApplications(_0x5568f3,_0x221afa[_0xab5013],_0x221afa[_0xab5013][_0x3ee5('0x13')]));}}return _0x57fb10;};var getChanSpyPromise=function(_0x338168,_0x150187){return new BPromise(function(_0xac2cd0,_0x487f98){return _0x338168[_0x3ee5('0x1a')][_0x3ee5('0x1b')]({'attributes':['id',_0x3ee5('0x13'),_0x3ee5('0x19')],'where':{'role':_0x3ee5('0x1c'),'chanspy':!![]},'raw':!![]})['then'](function(_0x174300){if(_0x174300){return _0xac2cd0(getChanSpyApplications(_0x150187,_0x174300));}return _0xac2cd0([]);})[_0x3ee5('0x1d')](function(_0x591bde){_0x487f98(_0x591bde);});});};module['exports']=function(_0x1b5139,_0x46fdcf){var _0x15018a=_0x1b5139['models'];return _0x1b5139[_0x3ee5('0x1e')]('VoiceChanSpy',attributes,{'tableName':_0x3ee5('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x11415e,_0x559a59,_0x3e9b6c){return getChanSpyPromise(_0x15018a,_0x11415e)[_0x3ee5('0x20')](function(_0x31d980){if(_0x31d980&&_0x31d980[_0x3ee5('0x17')]){return _0x15018a[_0x3ee5('0x21')][_0x3ee5('0x22')](_0x31d980);}})[_0x3ee5('0x20')](function(){_0x3e9b6c();})[_0x3ee5('0x1d')](function(_0x415f50){_0x3e9b6c(_0x415f50);});},'afterUpdate':function(_0x2c9045,_0x27819d,_0x4795e2){return _0x15018a[_0x3ee5('0x21')]['destroy']({'where':{'ChanSpyId':_0x2c9045['id']}})[_0x3ee5('0x20')](function(){return getChanSpyPromise(_0x15018a,_0x2c9045);})[_0x3ee5('0x20')](function(_0x2ec4ac){if(_0x2ec4ac&&_0x2ec4ac['length']){return _0x15018a[_0x3ee5('0x21')][_0x3ee5('0x22')](_0x2ec4ac);}})[_0x3ee5('0x20')](function(){_0x4795e2();})[_0x3ee5('0x1d')](function(_0x497e8e){_0x4795e2(_0x497e8e);});},'afterDestroy':function(_0x454b8d,_0x3f46a7,_0x3f4cd2){return _0x15018a[_0x3ee5('0x21')][_0x3ee5('0x23')]({'where':{'ChanSpyId':_0x454b8d['id']}})['then'](function(){_0x3f4cd2();})[_0x3ee5('0x1d')](function(_0x49c767){_0x3f4cd2(_0x49c767);});}}});}; \ No newline at end of file +var _0x9f94=['push','merge','Set','chanspy','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','ChanSpy','SIP/%s,%s','join','StopMixMonitor','length','concat','internal','name','User','then','exports','define','VoiceChanSpy','VoiceExtension','catch','bulkCreate','destroy','lodash','util','bluebird','from-sip','format','%s%s','prefix','system'];(function(_0x2c4307,_0x2e9445){var _0x4fa017=function(_0x39cdb2){while(--_0x39cdb2){_0x2c4307['push'](_0x2c4307['shift']());}};_0x4fa017(++_0x2e9445);}(_0x9f94,0x1e7));var _0x49f9=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x9f94[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x49f9('0x0'));var util=require(_0x49f9('0x1'));var BPromise=require(_0x49f9('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x56e388,_0x342097,_0x435860){var _0xb643ef=0x1;var _0x375856=[];var _0x18492d={'context':_0x342097['context']||_0x49f9('0x3'),'exten':util[_0x49f9('0x4')](_0x49f9('0x5'),_0x56e388[_0x49f9('0x6')],_0x435860),'type':_0x49f9('0x7'),'isApp':![],'ChanSpyId':_0x56e388['id'],'UserId':_0x342097['id']};_0x375856[_0x49f9('0x8')](_[_0x49f9('0x9')]({'app':_0x49f9('0xa'),'appdata':util['format']('CDR(type)=%s',_0x49f9('0xb')),'priority':_0xb643ef++},_0x18492d));if(_0x56e388['record']){_0x375856[_0x49f9('0x8')](_[_0x49f9('0x9')]({'app':_0x49f9('0xc'),'appdata':util['format'](_0x49f9('0xd'),_0x56e388['recordingFormat']),'priority':_0xb643ef++},_0x18492d));}if(_0x56e388[_0x49f9('0xe')]){_0x375856[_0x49f9('0x8')](_[_0x49f9('0x9')]({'app':_0x49f9('0xf'),'appdata':_0x56e388['password'],'priority':_0xb643ef++},_0x18492d));}_0x375856['push'](_[_0x49f9('0x9')]({'app':_0x49f9('0x10'),'appdata':util[_0x49f9('0x4')](_0x49f9('0x11'),_0x342097['name'],_0x56e388['options']?_0x56e388['options'][_0x49f9('0x12')](''):''),'priority':_0xb643ef++},_0x18492d));if(_0x56e388['record']){_0x375856[_0x49f9('0x8')](_['merge']({'app':_0x49f9('0x13'),'priority':_0xb643ef++},_0x18492d));}return _0x375856;};var getChanSpyApplications=function(_0x760ac,_0x482aa5){var _0x45a376=[];for(var _0x1a2026=0x0,_0x24250f=0x1;_0x1a2026<_0x482aa5[_0x49f9('0x14')];_0x1a2026++,_0x24250f=0x1){_0x45a376=_0x45a376[_0x49f9('0x15')](getUserApplications(_0x760ac,_0x482aa5[_0x1a2026],_0x482aa5[_0x1a2026][_0x49f9('0x16')]));if(_0x482aa5[_0x1a2026][_0x49f9('0x16')]!=_0x482aa5[_0x1a2026][_0x49f9('0x17')]){_0x45a376=_0x45a376[_0x49f9('0x15')](getUserApplications(_0x760ac,_0x482aa5[_0x1a2026],_0x482aa5[_0x1a2026][_0x49f9('0x17')]));}}return _0x45a376;};var getChanSpyPromise=function(_0x9dd864,_0x1971e3){return new BPromise(function(_0xa9b24c,_0x3b6c8f){return _0x9dd864[_0x49f9('0x18')]['findAll']({'attributes':['id','name',_0x49f9('0x16')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x49f9('0x19')](function(_0x5b49d5){if(_0x5b49d5){return _0xa9b24c(getChanSpyApplications(_0x1971e3,_0x5b49d5));}return _0xa9b24c([]);})['catch'](function(_0x42c0aa){_0x3b6c8f(_0x42c0aa);});});};module[_0x49f9('0x1a')]=function(_0x4e92e5,_0x372347){var _0x482b0d=_0x4e92e5['models'];return _0x4e92e5[_0x49f9('0x1b')](_0x49f9('0x1c'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x113179,_0x459809,_0x4a6161){return getChanSpyPromise(_0x482b0d,_0x113179)[_0x49f9('0x19')](function(_0x184b85){if(_0x184b85&&_0x184b85[_0x49f9('0x14')]){return _0x482b0d[_0x49f9('0x1d')]['bulkCreate'](_0x184b85);}})[_0x49f9('0x19')](function(){_0x4a6161();})[_0x49f9('0x1e')](function(_0x126aa2){_0x4a6161(_0x126aa2);});},'afterUpdate':function(_0x10da65,_0x28e56f,_0x45e077){return _0x482b0d[_0x49f9('0x1d')]['destroy']({'where':{'ChanSpyId':_0x10da65['id']}})['then'](function(){return getChanSpyPromise(_0x482b0d,_0x10da65);})[_0x49f9('0x19')](function(_0xc64e23){if(_0xc64e23&&_0xc64e23[_0x49f9('0x14')]){return _0x482b0d[_0x49f9('0x1d')][_0x49f9('0x1f')](_0xc64e23);}})[_0x49f9('0x19')](function(){_0x45e077();})[_0x49f9('0x1e')](function(_0x1deb22){_0x45e077(_0x1deb22);});},'afterDestroy':function(_0x5c8fc5,_0xc0a9aa,_0x51aff6){return _0x482b0d[_0x49f9('0x1d')][_0x49f9('0x20')]({'where':{'ChanSpyId':_0x5c8fc5['id']}})[_0x49f9('0x19')](function(){_0x51aff6();})['catch'](function(_0x1cd16b){_0x51aff6(_0x1cd16b);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 91fa5ba..c17b6a5 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 _0xdc28=['message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x253ecd,_0x24da47){var _0xdedb1d=function(_0x201aba){while(--_0x201aba){_0x253ecd['push'](_0x253ecd['shift']());}};_0xdedb1d(++_0x24da47);}(_0xdc28,0x121));var _0x8dc2=function(_0xbc568c,_0x425cae){_0xbc568c=_0xbc568c-0x0;var _0x472040=_0xdc28[_0xbc568c];return _0x472040;};'use strict';var _=require(_0x8dc2('0x0'));var util=require(_0x8dc2('0x1'));var moment=require(_0x8dc2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8dc2('0x3'));var db=require(_0x8dc2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8dc2('0x5'));var config=require(_0x8dc2('0x6'));var jayson=require(_0x8dc2('0x7'));var client=jayson[_0x8dc2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23acce,_0x4312e8,_0x4d8dc4){return new BPromise(function(_0x1040f8,_0x19ea33){return client['request'](_0x23acce,_0x4d8dc4)['then'](function(_0x237682){logger['info'](_0x8dc2('0x9'),_0x4312e8,_0x8dc2('0xa'));logger[_0x8dc2('0xb')](_0x8dc2('0xc'),_0x4312e8,_0x8dc2('0xa'),JSON[_0x8dc2('0xd')](_0x237682));if(_0x237682[_0x8dc2('0xe')]){if(_0x237682[_0x8dc2('0xe')]['code']===0x1f4){logger[_0x8dc2('0xe')](_0x8dc2('0x9'),_0x4312e8,_0x237682['error'][_0x8dc2('0xf')]);return _0x19ea33(_0x237682[_0x8dc2('0xe')][_0x8dc2('0xf')]);}logger[_0x8dc2('0xe')](_0x8dc2('0x9'),_0x4312e8,_0x237682[_0x8dc2('0xe')][_0x8dc2('0xf')]);return _0x1040f8(_0x237682['error']['message']);}else{logger[_0x8dc2('0x10')](_0x8dc2('0x9'),_0x4312e8,_0x8dc2('0xa'));_0x1040f8(_0x237682[_0x8dc2('0x11')][_0x8dc2('0xf')]);}})[_0x8dc2('0x12')](function(_0x1f6a87){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x4312e8,_0x1f6a87);_0x19ea33(_0x1f6a87);});});} \ No newline at end of file +var _0x971a=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x971a,0xa2));var _0xa971=function(_0x3d41e8,_0x5db0c0){_0x3d41e8=_0x3d41e8-0x0;var _0x14ff65=_0x971a[_0x3d41e8];return _0x14ff65;};'use strict';var _=require(_0xa971('0x0'));var util=require(_0xa971('0x1'));var moment=require(_0xa971('0x2'));var BPromise=require(_0xa971('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa971('0x4'))['db'];var utils=require(_0xa971('0x5'));var logger=require('../../config/logger')(_0xa971('0x6'));var config=require(_0xa971('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5bde79,_0x1d6485,_0x497b2e){return new BPromise(function(_0x1280ee,_0x407fc5){return client['request'](_0x5bde79,_0x497b2e)[_0xa971('0x8')](function(_0x10e88e){logger[_0xa971('0x9')](_0xa971('0xa'),_0x1d6485,_0xa971('0xb'));logger['debug'](_0xa971('0xc'),_0x1d6485,_0xa971('0xb'),JSON[_0xa971('0xd')](_0x10e88e));if(_0x10e88e[_0xa971('0xe')]){if(_0x10e88e[_0xa971('0xe')][_0xa971('0xf')]===0x1f4){logger[_0xa971('0xe')](_0xa971('0xa'),_0x1d6485,_0x10e88e[_0xa971('0xe')][_0xa971('0x10')]);return _0x407fc5(_0x10e88e[_0xa971('0xe')][_0xa971('0x10')]);}logger[_0xa971('0xe')](_0xa971('0xa'),_0x1d6485,_0x10e88e[_0xa971('0xe')][_0xa971('0x10')]);return _0x1280ee(_0x10e88e[_0xa971('0xe')][_0xa971('0x10')]);}else{logger[_0xa971('0x9')]('VoiceChanSpy,\x20%s,\x20%s',_0x1d6485,'request\x20sent');_0x1280ee(_0x10e88e['result'][_0xa971('0x10')]);}})[_0xa971('0x11')](function(_0x30c2a7){logger[_0xa971('0xe')](_0xa971('0xa'),_0x1d6485,_0x30c2a7);_0x407fc5(_0x30c2a7);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 46b457b..270efe1 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 _0x3bee=['path','connect-timeout','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0x5110d8,_0xa5e576){var _0x51c7d9=function(_0x419550){while(--_0x419550){_0x5110d8['push'](_0x5110d8['shift']());}};_0x51c7d9(++_0xa5e576);}(_0x3bee,0x12f));var _0xe3be=function(_0x53be79,_0x46ac23){_0x53be79=_0x53be79-0x0;var _0x42201b=_0x3bee[_0x53be79];return _0x42201b;};'use strict';var multer=require('multer');var util=require(_0xe3be('0x0'));var path=require(_0xe3be('0x1'));var timeout=require(_0xe3be('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xe3be('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe3be('0x4'));var controller=require('./voiceContext.controller');router[_0xe3be('0x5')]('/',auth[_0xe3be('0x6')](),controller['index']);router['get'](_0xe3be('0x7'),auth[_0xe3be('0x6')](),controller[_0xe3be('0x8')]);router[_0xe3be('0x9')]('/',auth[_0xe3be('0x6')](),controller[_0xe3be('0xa')]);router[_0xe3be('0xb')](_0xe3be('0x7'),auth[_0xe3be('0x6')](),controller[_0xe3be('0xc')]);router[_0xe3be('0xd')](_0xe3be('0x7'),auth[_0xe3be('0x6')](),controller[_0xe3be('0xe')]);module[_0xe3be('0xf')]=router; \ No newline at end of file +var _0x9a23=['/:id','isAuthenticated','show','post','delete','destroy','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index'];(function(_0x59bd3d,_0x106cd2){var _0x4ea54d=function(_0x3ea218){while(--_0x3ea218){_0x59bd3d['push'](_0x59bd3d['shift']());}};_0x4ea54d(++_0x106cd2);}(_0x9a23,0x8d));var _0x39a2=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x9a23[_0x49d41c];return _0xb64c5f;};'use strict';var multer=require('multer');var util=require(_0x39a2('0x0'));var path=require(_0x39a2('0x1'));var timeout=require(_0x39a2('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x39a2('0x3'));var interaction=require(_0x39a2('0x4'));var config=require(_0x39a2('0x5'));var controller=require(_0x39a2('0x6'));router[_0x39a2('0x7')]('/',auth['isAuthenticated'](),controller[_0x39a2('0x8')]);router['get'](_0x39a2('0x9'),auth[_0x39a2('0xa')](),controller[_0x39a2('0xb')]);router[_0x39a2('0xc')]('/',auth[_0x39a2('0xa')](),controller['create']);router['put']('/:id',auth[_0x39a2('0xa')](),controller['update']);router[_0x39a2('0xd')](_0x39a2('0x9'),auth[_0x39a2('0xa')](),controller[_0x39a2('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index a37409e..0bf2d42 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 _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x438442,_0x50c450){var _0x3ed3b5=function(_0x4e583e){while(--_0x4e583e){_0x438442['push'](_0x438442['shift']());}};_0x3ed3b5(++_0x50c450);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'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 +var _0x3e74=['name','sequelize','STRING'];(function(_0x34fedc,_0x30255f){var _0xbd34b=function(_0x25b598){while(--_0x25b598){_0x34fedc['push'](_0x34fedc['shift']());}};_0xbd34b(++_0x30255f);}(_0x3e74,0x175));var _0x43e7=function(_0x3698bd,_0x17f7a0){_0x3698bd=_0x3698bd-0x0;var _0x5c117f=_0x3e74[_0x3698bd];return _0x5c117f;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 4937455..a10b22e 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 _0x4600=['error','code','message','result','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Contexts','UserProfileResource','sendStatus','stack','name','send','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','includeAll','include','rows','catch','show','params','options','create','body','readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','Reload','chan_sip.so','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','findAll','root','/etc/asterisk/extensions_xcally_contexts.conf','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x4600,0x191));var _0x0460=function(_0x245b93,_0x4ecc95){_0x245b93=_0x245b93-0x0;var _0x29a168=_0x4600[_0x245b93];return _0x29a168;};'use strict';var pdf=require(_0x0460('0x0'));var emlformat=require(_0x0460('0x1'));var rimraf=require(_0x0460('0x2'));var zipdir=require(_0x0460('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0460('0x4'));var moment=require(_0x0460('0x5'));var BPromise=require(_0x0460('0x6'));var Mustache=require(_0x0460('0x7'));var util=require(_0x0460('0x8'));var path=require(_0x0460('0x9'));var sox=require('sox');var csv=require(_0x0460('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0460('0xb'));var crypto=require(_0x0460('0xc'));var jsforce=require(_0x0460('0xd'));var deskjs=require(_0x0460('0xe'));var toCsv=require(_0x0460('0xa'));var querystring=require(_0x0460('0xf'));var Papa=require(_0x0460('0x10'));var Redis=require(_0x0460('0x11'));var authService=require(_0x0460('0x12'));var qs=require(_0x0460('0x13'));var as=require(_0x0460('0x14'));var hardwareService=require(_0x0460('0x15'));var logger=require('../../config/logger')(_0x0460('0x16'));var utils=require(_0x0460('0x17'));var config=require(_0x0460('0x18'));var licenseUtil=require(_0x0460('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x0460('0x1a'));var client=jayson[_0x0460('0x1b')][_0x0460('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xf26018,_0x16f72f,_0x36e929,_0x33d0f8){return new BPromise(function(_0x3b64d9,_0x2beb2a){var _0x5e983e=_0x33d0f8||client;return _0x5e983e[_0x0460('0x1d')](_0xf26018,_0x36e929)['then'](function(_0x3e3455){logger[_0x0460('0x1e')](_0x0460('0x1f'),_0x16f72f,_0x0460('0x20'));logger[_0x0460('0x21')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x16f72f,_0x0460('0x20'),JSON[_0x0460('0x22')](_0x3e3455));if(_0x3e3455[_0x0460('0x23')]){if(_0x3e3455[_0x0460('0x23')][_0x0460('0x24')]===0x1f4){logger[_0x0460('0x23')](_0x0460('0x1f'),_0x16f72f,_0x3e3455['error']['message']);return _0x2beb2a(_0x3e3455['error'][_0x0460('0x25')]);}logger[_0x0460('0x23')](_0x0460('0x1f'),_0x16f72f,_0x3e3455[_0x0460('0x23')][_0x0460('0x25')]);return _0x3b64d9(_0x3e3455[_0x0460('0x23')][_0x0460('0x25')]);}else{logger['info'](_0x0460('0x1f'),_0x16f72f,_0x0460('0x20'));_0x3b64d9(_0x3e3455[_0x0460('0x26')]['message']);}})['catch'](function(_0x39769d){logger[_0x0460('0x23')](_0x0460('0x1f'),_0x16f72f,_0x39769d);_0x2beb2a(_0x39769d);});});}function respondWithStatusCode(_0xb60489,_0x75b4a2){_0x75b4a2=_0x75b4a2||0xcc;return function(_0x4e0efd){if(_0x4e0efd){return _0xb60489['sendStatus'](_0x75b4a2);}return _0xb60489[_0x0460('0x27')](_0x75b4a2)[_0x0460('0x28')]();};}function respondWithResult(_0x34d5e9,_0x23813e){_0x23813e=_0x23813e||0xc8;return function(_0x22f5c7){if(_0x22f5c7){return _0x34d5e9[_0x0460('0x27')](_0x23813e)[_0x0460('0x29')](_0x22f5c7);}};}function respondWithFilteredResult(_0x1dd980,_0x1f9771){return function(_0x330e08){if(_0x330e08){var _0x138b8d=_0x330e08[_0x0460('0x2a')],_0xd06e72=_0x1f9771[_0x0460('0x2b')],_0x59c8e6=_0x1f9771['offset']+_0x1f9771[_0x0460('0x2c')],_0x4e6b59;if(_0x59c8e6>=_0x138b8d){_0x59c8e6=_0x138b8d;_0x4e6b59=0xc8;}else{_0x4e6b59=0xce;}_0x1dd980[_0x0460('0x27')](_0x4e6b59);return _0x1dd980[_0x0460('0x2d')](_0x0460('0x2e'),_0xd06e72+'-'+_0x59c8e6+'/'+_0x138b8d)[_0x0460('0x29')](_0x330e08);}return null;};}function patchUpdates(_0x45bc15){return function(_0x2af56d){try{jsonpatch[_0x0460('0x2f')](_0x2af56d,_0x45bc15,!![]);}catch(_0x443559){return BPromise[_0x0460('0x30')](_0x443559);}return _0x2af56d[_0x0460('0x31')]();};}function saveUpdates(_0x12c184,_0x47a4b5){return function(_0x26d07f){if(_0x26d07f){return _0x26d07f[_0x0460('0x32')](_0x12c184)[_0x0460('0x33')](function(_0x497dd9){return _0x497dd9;});}return null;};}function removeEntity(_0x18860a,_0x5449fb){return function(_0x359e96){if(_0x359e96){return _0x359e96[_0x0460('0x34')]()[_0x0460('0x33')](function(){var _0x4060fa=_0x359e96[_0x0460('0x35')]({'plain':!![]});var _0x2d90a3=_0x0460('0x36');return db[_0x0460('0x37')][_0x0460('0x34')]({'where':{'type':_0x2d90a3,'resourceId':_0x4060fa['id']}})[_0x0460('0x33')](function(){return _0x359e96;});})[_0x0460('0x33')](function(){_0x18860a[_0x0460('0x27')](0xcc)[_0x0460('0x28')]();});}};}function handleEntityNotFound(_0x311778,_0x295076){return function(_0x3399dd){if(!_0x3399dd){_0x311778[_0x0460('0x38')](0x194);}return _0x3399dd;};}function handleError(_0x258c02,_0x5b46ec){_0x5b46ec=_0x5b46ec||0x1f4;return function(_0x89ac4f){logger['error'](_0x89ac4f[_0x0460('0x39')]);if(_0x89ac4f[_0x0460('0x3a')]){delete _0x89ac4f[_0x0460('0x3a')];}_0x258c02[_0x0460('0x27')](_0x5b46ec)[_0x0460('0x3b')](_0x89ac4f);};}exports['index']=function(_0x4e64cb,_0x373236){var _0x7a8b3b={},_0x336714={},_0x2192fd={'count':0x0,'rows':[]};var _0x5a6d55=_[_0x0460('0x3c')](db[_0x0460('0x3d')][_0x0460('0x3e')],function(_0x400b0b){return{'name':_0x400b0b[_0x0460('0x3f')],'type':_0x400b0b[_0x0460('0x40')][_0x0460('0x41')]};});_0x336714[_0x0460('0x42')]=_['map'](_0x5a6d55,_0x0460('0x3a'));_0x336714[_0x0460('0x43')]=_[_0x0460('0x44')](_0x4e64cb[_0x0460('0x43')]);_0x336714['filters']=_[_0x0460('0x45')](_0x336714['model'],_0x336714[_0x0460('0x43')]);_0x7a8b3b[_0x0460('0x46')]=_[_0x0460('0x45')](_0x336714[_0x0460('0x42')],qs[_0x0460('0x47')](_0x4e64cb[_0x0460('0x43')][_0x0460('0x47')]));_0x7a8b3b[_0x0460('0x46')]=_0x7a8b3b['attributes'][_0x0460('0x48')]?_0x7a8b3b[_0x0460('0x46')]:_0x336714[_0x0460('0x42')];if(!_0x4e64cb['query'][_0x0460('0x49')](_0x0460('0x4a'))){_0x7a8b3b[_0x0460('0x2c')]=qs['limit'](_0x4e64cb[_0x0460('0x43')]['limit']);_0x7a8b3b['offset']=qs[_0x0460('0x2b')](_0x4e64cb[_0x0460('0x43')][_0x0460('0x2b')]);}_0x7a8b3b[_0x0460('0x4b')]=qs[_0x0460('0x4c')](_0x4e64cb['query'][_0x0460('0x4c')]);_0x7a8b3b[_0x0460('0x4d')]=qs[_0x0460('0x4e')](_[_0x0460('0x4f')](_0x4e64cb[_0x0460('0x43')],_0x336714['filters']),_0x5a6d55);if(_0x4e64cb[_0x0460('0x43')]['filter']){_0x7a8b3b[_0x0460('0x4d')]=_[_0x0460('0x50')](_0x7a8b3b[_0x0460('0x4d')],{'$or':_[_0x0460('0x3c')](_0x5a6d55,function(_0x4c0ffb){if(_0x4c0ffb[_0x0460('0x40')]!=='VIRTUAL'){var _0x53e208={};_0x53e208[_0x4c0ffb[_0x0460('0x3a')]]={'$like':'%'+_0x4e64cb[_0x0460('0x43')][_0x0460('0x51')]+'%'};return _0x53e208;}})});}_0x7a8b3b=_[_0x0460('0x50')]({},_0x7a8b3b,_0x4e64cb['options']);var _0xc22f92={'where':_0x7a8b3b[_0x0460('0x4d')]};return db[_0x0460('0x3d')]['count'](_0xc22f92)[_0x0460('0x33')](function(_0x1cafda){_0x2192fd[_0x0460('0x2a')]=_0x1cafda;if(_0x4e64cb['query'][_0x0460('0x52')]){_0x7a8b3b[_0x0460('0x53')]=[{'all':!![]}];}return db[_0x0460('0x3d')]['findAll'](_0x7a8b3b);})[_0x0460('0x33')](function(_0x36cc5a){_0x2192fd[_0x0460('0x54')]=_0x36cc5a;return _0x2192fd;})[_0x0460('0x33')](respondWithFilteredResult(_0x373236,_0x7a8b3b))[_0x0460('0x55')](handleError(_0x373236,null));};exports[_0x0460('0x56')]=function(_0x28d14e,_0x302d39){var _0x494c9c={'raw':![],'where':{'id':_0x28d14e[_0x0460('0x57')]['id']}},_0x2965f4={};_0x2965f4[_0x0460('0x42')]=_['keys'](db[_0x0460('0x3d')][_0x0460('0x3e')]);_0x2965f4[_0x0460('0x43')]=_[_0x0460('0x44')](_0x28d14e[_0x0460('0x43')]);_0x2965f4['filtears']=_[_0x0460('0x45')](_0x2965f4['model'],_0x2965f4[_0x0460('0x43')]);_0x494c9c[_0x0460('0x46')]=_['intersection'](_0x2965f4['model'],qs[_0x0460('0x47')](_0x28d14e[_0x0460('0x43')]['fields']));_0x494c9c[_0x0460('0x46')]=_0x494c9c[_0x0460('0x46')][_0x0460('0x48')]?_0x494c9c[_0x0460('0x46')]:_0x2965f4['model'];if(_0x28d14e[_0x0460('0x43')][_0x0460('0x52')]){_0x494c9c[_0x0460('0x53')]=[{'all':!![]}];}_0x494c9c=_[_0x0460('0x50')]({},_0x494c9c,_0x28d14e[_0x0460('0x58')]);return db[_0x0460('0x3d')]['find'](_0x494c9c)[_0x0460('0x33')](handleEntityNotFound(_0x302d39,null))[_0x0460('0x33')](respondWithResult(_0x302d39,null))[_0x0460('0x55')](handleError(_0x302d39,null));};exports['create']=function(_0x2124f6,_0x6c125c,_0x2e059a){var _0x38a36e;return db['VoiceContext'][_0x0460('0x59')](_0x2124f6[_0x0460('0x5a')],{'raw':!![]})[_0x0460('0x33')](function(_0x342111){_0x38a36e=_0x342111;return db[_0x0460('0x3d')]['findAll']({'raw':!![]});})[_0x0460('0x33')](function(_0x2a27a2){var _0x64cce4=fs[_0x0460('0x5b')](path[_0x0460('0x5c')](config['root'],_0x0460('0x5d')),_0x0460('0x5e'));var _0x25e462=ejs[_0x0460('0x5f')](_0x64cce4,{'contexts':_0x2a27a2||[]});fs[_0x0460('0x60')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x25e462);})['then'](function(){return respondWithRpcPromise(_0x0460('0x61'),_0x0460('0x59'),{'module':_0x0460('0x62')});})['then'](function(){var _0x25825a=_0x2124f6[_0x0460('0x63')]['get']({'plain':!![]});if(!_0x25825a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25825a[_0x0460('0x64')]===_0x0460('0x63')){var _0x47c520=_0x38a36e[_0x0460('0x35')]({'plain':!![]});return db[_0x0460('0x65')]['find']({'where':{'name':'Contexts','userProfileId':_0x25825a[_0x0460('0x66')]},'raw':!![]})['then'](function(_0x4ca247){if(_0x4ca247&&_0x4ca247[_0x0460('0x67')]===0x0){return db['UserProfileResource']['create']({'name':_0x47c520[_0x0460('0x3a')],'resourceId':_0x47c520['id'],'type':_0x4ca247[_0x0460('0x3a')],'sectionId':_0x4ca247['id']},{})[_0x0460('0x33')](function(){return _0x38a36e;});}else{return _0x38a36e;}})['catch'](function(_0x10d41a){logger['error'](_0x0460('0x68'),_0x10d41a);throw _0x10d41a;});}return _0x38a36e;})['then'](respondWithResult(_0x6c125c,0xc9))[_0x0460('0x55')](handleError(_0x6c125c,null));};exports[_0x0460('0x32')]=function(_0x16dab3,_0x4fc549,_0x2125bb){var _0x47aa29;return db[_0x0460('0x3d')][_0x0460('0x69')]({'where':{'id':_0x16dab3[_0x0460('0x57')]['id']}})['then'](handleEntityNotFound(_0x4fc549,null))['then'](saveUpdates(_0x16dab3[_0x0460('0x5a')],null))['then'](function(_0x46122c){if(_0x46122c){_0x47aa29=_0x46122c;return db[_0x0460('0x3d')][_0x0460('0x6a')]({'raw':!![]});}})[_0x0460('0x33')](function(_0x1dbda4){var _0x408fe4=fs[_0x0460('0x5b')](path[_0x0460('0x5c')](config[_0x0460('0x6b')],_0x0460('0x5d')),_0x0460('0x5e'));var _0x414394=ejs['render'](_0x408fe4,{'contexts':_0x1dbda4||[]});fs[_0x0460('0x60')](_0x0460('0x6c'),_0x414394);})['then'](function(){return respondWithRpcPromise('Reload',_0x0460('0x32'),{'module':_0x0460('0x62')});})[_0x0460('0x33')](function(){return _0x47aa29;})['then'](respondWithResult(_0x4fc549,null))[_0x0460('0x55')](handleError(_0x4fc549,null));};exports[_0x0460('0x34')]=function(_0x2027f0,_0x387752,_0x5c9c88){var _0xe43633;return db[_0x0460('0x3d')][_0x0460('0x69')]({'where':{'id':_0x2027f0['params']['id']}})['then'](handleEntityNotFound(_0x387752,null))[_0x0460('0x33')](removeEntity(_0x387752,null))['then'](function(){return db[_0x0460('0x3d')]['findAll']({'raw':!![]});})['then'](function(_0x42929f){var _0x59a25b=fs[_0x0460('0x5b')](path['join'](config[_0x0460('0x6b')],_0x0460('0x5d')),_0x0460('0x5e'));var _0x1e2c34=ejs['render'](_0x59a25b,{'contexts':_0x42929f});fs[_0x0460('0x60')](_0x0460('0x6c'),_0x1e2c34);return respondWithRpcPromise(_0x0460('0x61'),_0x0460('0x34'),{'module':_0x0460('0x62')});})['catch'](handleError(_0x387752,null));}; \ No newline at end of file +var _0xe206=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','request\x20sent','debug','error','VoiceContext,\x20%s,\x20%s','message','result','catch','status','json','count','offset','limit','Content-Range','apply','reject','get','Contexts','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','VoiceContext','findAll','show','params','filtears','length','includeAll','create','body','readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','update','chan_sip.so','root','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto'];(function(_0x10dfdf,_0xd11233){var _0x2ff0c7=function(_0x3b3d32){while(--_0x3b3d32){_0x10dfdf['push'](_0x10dfdf['shift']());}};_0x2ff0c7(++_0xd11233);}(_0xe206,0x1e4));var _0x6e20=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xe206[_0x4b2436];return _0x4f5ab2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6e20('0x0'));var rimraf=require(_0x6e20('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6e20('0x2'));var moment=require(_0x6e20('0x3'));var BPromise=require(_0x6e20('0x4'));var Mustache=require('mustache');var util=require(_0x6e20('0x5'));var path=require(_0x6e20('0x6'));var sox=require(_0x6e20('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6e20('0x8'));var squel=require(_0x6e20('0x9'));var crypto=require(_0x6e20('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6e20('0xb'));var Papa=require(_0x6e20('0xc'));var Redis=require(_0x6e20('0xd'));var authService=require(_0x6e20('0xe'));var qs=require(_0x6e20('0xf'));var as=require(_0x6e20('0x10'));var hardwareService=require(_0x6e20('0x11'));var logger=require(_0x6e20('0x12'))(_0x6e20('0x13'));var utils=require(_0x6e20('0x14'));var config=require(_0x6e20('0x15'));var licenseUtil=require(_0x6e20('0x16'));var db=require(_0x6e20('0x17'))['db'];var jayson=require(_0x6e20('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xe52276,_0xf31065,_0x1948e8,_0x24373e){return new BPromise(function(_0x39910b,_0x22600a){var _0x67db97=_0x24373e||client;return _0x67db97[_0x6e20('0x19')](_0xe52276,_0x1948e8)[_0x6e20('0x1a')](function(_0x55ee88){logger[_0x6e20('0x1b')]('VoiceContext,\x20%s,\x20%s',_0xf31065,_0x6e20('0x1c'));logger[_0x6e20('0x1d')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0xf31065,_0x6e20('0x1c'),JSON['stringify'](_0x55ee88));if(_0x55ee88[_0x6e20('0x1e')]){if(_0x55ee88[_0x6e20('0x1e')]['code']===0x1f4){logger[_0x6e20('0x1e')](_0x6e20('0x1f'),_0xf31065,_0x55ee88[_0x6e20('0x1e')][_0x6e20('0x20')]);return _0x22600a(_0x55ee88[_0x6e20('0x1e')][_0x6e20('0x20')]);}logger[_0x6e20('0x1e')](_0x6e20('0x1f'),_0xf31065,_0x55ee88[_0x6e20('0x1e')][_0x6e20('0x20')]);return _0x39910b(_0x55ee88[_0x6e20('0x1e')]['message']);}else{logger[_0x6e20('0x1b')]('VoiceContext,\x20%s,\x20%s',_0xf31065,_0x6e20('0x1c'));_0x39910b(_0x55ee88[_0x6e20('0x21')][_0x6e20('0x20')]);}})[_0x6e20('0x22')](function(_0x1c7fc0){logger[_0x6e20('0x1e')](_0x6e20('0x1f'),_0xf31065,_0x1c7fc0);_0x22600a(_0x1c7fc0);});});}function respondWithStatusCode(_0xc4a5aa,_0x451b03){_0x451b03=_0x451b03||0xcc;return function(_0x478208){if(_0x478208){return _0xc4a5aa['sendStatus'](_0x451b03);}return _0xc4a5aa['status'](_0x451b03)['end']();};}function respondWithResult(_0x1809f3,_0x2ea1b7){_0x2ea1b7=_0x2ea1b7||0xc8;return function(_0x45baa9){if(_0x45baa9){return _0x1809f3[_0x6e20('0x23')](_0x2ea1b7)[_0x6e20('0x24')](_0x45baa9);}};}function respondWithFilteredResult(_0x5b397c,_0x2d2926){return function(_0x26d326){if(_0x26d326){var _0xddc8d2=_0x26d326[_0x6e20('0x25')],_0x27eb88=_0x2d2926[_0x6e20('0x26')],_0x53492f=_0x2d2926[_0x6e20('0x26')]+_0x2d2926[_0x6e20('0x27')],_0x3451a2;if(_0x53492f>=_0xddc8d2){_0x53492f=_0xddc8d2;_0x3451a2=0xc8;}else{_0x3451a2=0xce;}_0x5b397c[_0x6e20('0x23')](_0x3451a2);return _0x5b397c['set'](_0x6e20('0x28'),_0x27eb88+'-'+_0x53492f+'/'+_0xddc8d2)[_0x6e20('0x24')](_0x26d326);}return null;};}function patchUpdates(_0xe9e67c){return function(_0xbb3197){try{jsonpatch[_0x6e20('0x29')](_0xbb3197,_0xe9e67c,!![]);}catch(_0x24b95a){return BPromise[_0x6e20('0x2a')](_0x24b95a);}return _0xbb3197['save']();};}function saveUpdates(_0x134a61,_0x3bcc8b){return function(_0x402083){if(_0x402083){return _0x402083['update'](_0x134a61)[_0x6e20('0x1a')](function(_0x263615){return _0x263615;});}return null;};}function removeEntity(_0x4cd4b7,_0x43c979){return function(_0x13bddd){if(_0x13bddd){return _0x13bddd['destroy']()[_0x6e20('0x1a')](function(){var _0x27797a=_0x13bddd[_0x6e20('0x2b')]({'plain':!![]});var _0x27a6ae=_0x6e20('0x2c');return db[_0x6e20('0x2d')][_0x6e20('0x2e')]({'where':{'type':_0x27a6ae,'resourceId':_0x27797a['id']}})[_0x6e20('0x1a')](function(){return _0x13bddd;});})['then'](function(){_0x4cd4b7[_0x6e20('0x23')](0xcc)[_0x6e20('0x2f')]();});}};}function handleEntityNotFound(_0x26388f,_0x1cc916){return function(_0x2639e3){if(!_0x2639e3){_0x26388f[_0x6e20('0x30')](0x194);}return _0x2639e3;};}function handleError(_0x29bbb7,_0x54a578){_0x54a578=_0x54a578||0x1f4;return function(_0x56a3d4){logger[_0x6e20('0x1e')](_0x56a3d4[_0x6e20('0x31')]);if(_0x56a3d4[_0x6e20('0x32')]){delete _0x56a3d4[_0x6e20('0x32')];}_0x29bbb7['status'](_0x54a578)[_0x6e20('0x33')](_0x56a3d4);};}exports[_0x6e20('0x34')]=function(_0x37bf4b,_0x28e4f5){var _0x29e2a2={},_0x4f8e52={},_0x443e74={'count':0x0,'rows':[]};var _0x26e72f=_[_0x6e20('0x35')](db['VoiceContext']['rawAttributes'],function(_0x13df5b){return{'name':_0x13df5b[_0x6e20('0x36')],'type':_0x13df5b[_0x6e20('0x37')][_0x6e20('0x38')]};});_0x4f8e52[_0x6e20('0x39')]=_[_0x6e20('0x35')](_0x26e72f,_0x6e20('0x32'));_0x4f8e52[_0x6e20('0x3a')]=_[_0x6e20('0x3b')](_0x37bf4b[_0x6e20('0x3a')]);_0x4f8e52[_0x6e20('0x3c')]=_[_0x6e20('0x3d')](_0x4f8e52['model'],_0x4f8e52['query']);_0x29e2a2[_0x6e20('0x3e')]=_[_0x6e20('0x3d')](_0x4f8e52[_0x6e20('0x39')],qs[_0x6e20('0x3f')](_0x37bf4b[_0x6e20('0x3a')][_0x6e20('0x3f')]));_0x29e2a2['attributes']=_0x29e2a2[_0x6e20('0x3e')]['length']?_0x29e2a2['attributes']:_0x4f8e52[_0x6e20('0x39')];if(!_0x37bf4b[_0x6e20('0x3a')]['hasOwnProperty'](_0x6e20('0x40'))){_0x29e2a2[_0x6e20('0x27')]=qs[_0x6e20('0x27')](_0x37bf4b['query']['limit']);_0x29e2a2[_0x6e20('0x26')]=qs[_0x6e20('0x26')](_0x37bf4b[_0x6e20('0x3a')]['offset']);}_0x29e2a2[_0x6e20('0x41')]=qs[_0x6e20('0x42')](_0x37bf4b['query']['sort']);_0x29e2a2[_0x6e20('0x43')]=qs[_0x6e20('0x3c')](_['pick'](_0x37bf4b['query'],_0x4f8e52[_0x6e20('0x3c')]),_0x26e72f);if(_0x37bf4b[_0x6e20('0x3a')][_0x6e20('0x44')]){_0x29e2a2[_0x6e20('0x43')]=_[_0x6e20('0x45')](_0x29e2a2[_0x6e20('0x43')],{'$or':_[_0x6e20('0x35')](_0x26e72f,function(_0xdf0a76){if(_0xdf0a76[_0x6e20('0x37')]!==_0x6e20('0x46')){var _0x5365e1={};_0x5365e1[_0xdf0a76[_0x6e20('0x32')]]={'$like':'%'+_0x37bf4b[_0x6e20('0x3a')][_0x6e20('0x44')]+'%'};return _0x5365e1;}})});}_0x29e2a2=_[_0x6e20('0x45')]({},_0x29e2a2,_0x37bf4b[_0x6e20('0x47')]);var _0x3a0260={'where':_0x29e2a2[_0x6e20('0x43')]};return db['VoiceContext']['count'](_0x3a0260)['then'](function(_0x262bfd){_0x443e74['count']=_0x262bfd;if(_0x37bf4b[_0x6e20('0x3a')]['includeAll']){_0x29e2a2[_0x6e20('0x48')]=[{'all':!![]}];}return db[_0x6e20('0x49')][_0x6e20('0x4a')](_0x29e2a2);})[_0x6e20('0x1a')](function(_0x4d46bf){_0x443e74['rows']=_0x4d46bf;return _0x443e74;})['then'](respondWithFilteredResult(_0x28e4f5,_0x29e2a2))[_0x6e20('0x22')](handleError(_0x28e4f5,null));};exports[_0x6e20('0x4b')]=function(_0x687b8a,_0x4e16be){var _0x3f6534={'raw':![],'where':{'id':_0x687b8a[_0x6e20('0x4c')]['id']}},_0x33db3c={};_0x33db3c[_0x6e20('0x39')]=_['keys'](db[_0x6e20('0x49')]['rawAttributes']);_0x33db3c[_0x6e20('0x3a')]=_[_0x6e20('0x3b')](_0x687b8a[_0x6e20('0x3a')]);_0x33db3c[_0x6e20('0x4d')]=_[_0x6e20('0x3d')](_0x33db3c[_0x6e20('0x39')],_0x33db3c[_0x6e20('0x3a')]);_0x3f6534[_0x6e20('0x3e')]=_[_0x6e20('0x3d')](_0x33db3c[_0x6e20('0x39')],qs[_0x6e20('0x3f')](_0x687b8a[_0x6e20('0x3a')][_0x6e20('0x3f')]));_0x3f6534[_0x6e20('0x3e')]=_0x3f6534[_0x6e20('0x3e')][_0x6e20('0x4e')]?_0x3f6534[_0x6e20('0x3e')]:_0x33db3c[_0x6e20('0x39')];if(_0x687b8a[_0x6e20('0x3a')][_0x6e20('0x4f')]){_0x3f6534['include']=[{'all':!![]}];}_0x3f6534=_['merge']({},_0x3f6534,_0x687b8a['options']);return db['VoiceContext']['find'](_0x3f6534)[_0x6e20('0x1a')](handleEntityNotFound(_0x4e16be,null))['then'](respondWithResult(_0x4e16be,null))[_0x6e20('0x22')](handleError(_0x4e16be,null));};exports[_0x6e20('0x50')]=function(_0x23fbce,_0x28a230,_0x7e3ed5){var _0x50e892;return db['VoiceContext'][_0x6e20('0x50')](_0x23fbce[_0x6e20('0x51')],{'raw':!![]})[_0x6e20('0x1a')](function(_0x53bdf8){_0x50e892=_0x53bdf8;return db['VoiceContext'][_0x6e20('0x4a')]({'raw':!![]});})['then'](function(_0x279f79){var _0x476c0f=fs[_0x6e20('0x52')](path[_0x6e20('0x53')](config['root'],_0x6e20('0x54')),_0x6e20('0x55'));var _0x2e76d4=ejs[_0x6e20('0x56')](_0x476c0f,{'contexts':_0x279f79||[]});fs[_0x6e20('0x57')](_0x6e20('0x58'),_0x2e76d4);})[_0x6e20('0x1a')](function(){return respondWithRpcPromise(_0x6e20('0x59'),_0x6e20('0x50'),{'module':'chan_sip.so'});})['then'](function(){var _0x5b1989=_0x23fbce['user'][_0x6e20('0x2b')]({'plain':!![]});if(!_0x5b1989)throw new Error(_0x6e20('0x5a'));if(_0x5b1989[_0x6e20('0x5b')]===_0x6e20('0x5c')){var _0x21a53d=_0x50e892[_0x6e20('0x2b')]({'plain':!![]});return db[_0x6e20('0x5d')][_0x6e20('0x5e')]({'where':{'name':_0x6e20('0x2c'),'userProfileId':_0x5b1989['userProfileId']},'raw':!![]})[_0x6e20('0x1a')](function(_0x3f9074){if(_0x3f9074&&_0x3f9074[_0x6e20('0x5f')]===0x0){return db[_0x6e20('0x2d')][_0x6e20('0x50')]({'name':_0x21a53d[_0x6e20('0x32')],'resourceId':_0x21a53d['id'],'type':_0x3f9074[_0x6e20('0x32')],'sectionId':_0x3f9074['id']},{})[_0x6e20('0x1a')](function(){return _0x50e892;});}else{return _0x50e892;}})[_0x6e20('0x22')](function(_0x3c7639){logger[_0x6e20('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c7639);throw _0x3c7639;});}return _0x50e892;})[_0x6e20('0x1a')](respondWithResult(_0x28a230,0xc9))[_0x6e20('0x22')](handleError(_0x28a230,null));};exports[_0x6e20('0x60')]=function(_0x4a18fb,_0xdabbb4,_0x5c454c){var _0x1048a6;return db[_0x6e20('0x49')]['find']({'where':{'id':_0x4a18fb[_0x6e20('0x4c')]['id']}})[_0x6e20('0x1a')](handleEntityNotFound(_0xdabbb4,null))[_0x6e20('0x1a')](saveUpdates(_0x4a18fb[_0x6e20('0x51')],null))[_0x6e20('0x1a')](function(_0x4236ef){if(_0x4236ef){_0x1048a6=_0x4236ef;return db[_0x6e20('0x49')][_0x6e20('0x4a')]({'raw':!![]});}})[_0x6e20('0x1a')](function(_0x2dc15e){var _0x1eaac2=fs[_0x6e20('0x52')](path[_0x6e20('0x53')](config['root'],_0x6e20('0x54')),'utf8');var _0xa23796=ejs['render'](_0x1eaac2,{'contexts':_0x2dc15e||[]});fs[_0x6e20('0x57')](_0x6e20('0x58'),_0xa23796);})[_0x6e20('0x1a')](function(){return respondWithRpcPromise('Reload',_0x6e20('0x60'),{'module':_0x6e20('0x61')});})['then'](function(){return _0x1048a6;})['then'](respondWithResult(_0xdabbb4,null))[_0x6e20('0x22')](handleError(_0xdabbb4,null));};exports[_0x6e20('0x2e')]=function(_0xa5451d,_0x238141,_0x2ecca9){var _0x2258ce;return db['VoiceContext'][_0x6e20('0x5e')]({'where':{'id':_0xa5451d[_0x6e20('0x4c')]['id']}})[_0x6e20('0x1a')](handleEntityNotFound(_0x238141,null))[_0x6e20('0x1a')](removeEntity(_0x238141,null))[_0x6e20('0x1a')](function(){return db[_0x6e20('0x49')]['findAll']({'raw':!![]});})[_0x6e20('0x1a')](function(_0x3aed7b){var _0x25d50e=fs[_0x6e20('0x52')](path[_0x6e20('0x53')](config[_0x6e20('0x62')],_0x6e20('0x54')),'utf8');var _0x32adf9=ejs[_0x6e20('0x56')](_0x25d50e,{'contexts':_0x3aed7b});fs[_0x6e20('0x57')](_0x6e20('0x58'),_0x32adf9);return respondWithRpcPromise('Reload',_0x6e20('0x2e'),{'module':'chan_sip.so'});})[_0x6e20('0x22')](handleError(_0x238141,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index d60fc6d..839a814 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 _0x79cb=['VoiceContext','voice_contexts','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','define'];(function(_0x48b9a0,_0x59a945){var _0x5de14e=function(_0x563536){while(--_0x563536){_0x48b9a0['push'](_0x48b9a0['shift']());}};_0x5de14e(++_0x59a945);}(_0x79cb,0x199));var _0xb79c=function(_0x795e6f,_0x2d5d5e){_0x795e6f=_0x795e6f-0x0;var _0x51d5e=_0x79cb[_0x795e6f];return _0x51d5e;};'use strict';var _=require(_0xb79c('0x0'));var util=require('util');var logger=require(_0xb79c('0x1'))('api');var moment=require(_0xb79c('0x2'));var BPromise=require('bluebird');var rp=require(_0xb79c('0x3'));var fs=require('fs');var path=require(_0xb79c('0x4'));var rimraf=require(_0xb79c('0x5'));var config=require(_0xb79c('0x6'));var attributes=require(_0xb79c('0x7'));module['exports']=function(_0x1d70cc,_0x6fbb8f){return _0x1d70cc[_0xb79c('0x8')](_0xb79c('0x9'),attributes,{'tableName':_0xb79c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa68f=['api','bluebird','../../config/environment','./voiceContext.attributes','exports','VoiceContext','voice_contexts','lodash','../../config/logger'];(function(_0x47990b,_0xf722d6){var _0x57bb0a=function(_0x26b8d0){while(--_0x26b8d0){_0x47990b['push'](_0x47990b['shift']());}};_0x57bb0a(++_0xf722d6);}(_0xa68f,0x1c0));var _0xfa68=function(_0x2452be,_0x55417c){_0x2452be=_0x2452be-0x0;var _0x37d939=_0xa68f[_0x2452be];return _0x37d939;};'use strict';var _=require(_0xfa68('0x0'));var util=require('util');var logger=require(_0xfa68('0x1'))(_0xfa68('0x2'));var moment=require('moment');var BPromise=require(_0xfa68('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfa68('0x4'));var attributes=require(_0xfa68('0x5'));module[_0xfa68('0x6')]=function(_0x47a197,_0x2754c9){return _0x47a197['define'](_0xfa68('0x7'),attributes,{'tableName':_0xfa68('0x8'),'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 177fb93..739e0c4 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 _0x3c2c=['request\x20sent','error','code','message','VoiceContext,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0xfeb675,_0x150818){var _0x4c8fe8=function(_0xb0b469){while(--_0xb0b469){_0xfeb675['push'](_0xfeb675['shift']());}};_0x4c8fe8(++_0x150818);}(_0x3c2c,0x160));var _0xc3c2=function(_0x2e7cf0,_0x3f283e){_0x2e7cf0=_0x2e7cf0-0x0;var _0x37d471=_0x3c2c[_0x2e7cf0];return _0x37d471;};'use strict';var _=require(_0xc3c2('0x0'));var util=require(_0xc3c2('0x1'));var moment=require(_0xc3c2('0x2'));var BPromise=require(_0xc3c2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3c2('0x4'))['db'];var utils=require(_0xc3c2('0x5'));var logger=require(_0xc3c2('0x6'))(_0xc3c2('0x7'));var config=require('../../config/environment');var jayson=require(_0xc3c2('0x8'));var client=jayson[_0xc3c2('0x9')][_0xc3c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21fa50,_0xc36639,_0x48cab1){return new BPromise(function(_0x5daa76,_0x55840b){return client[_0xc3c2('0xb')](_0x21fa50,_0x48cab1)[_0xc3c2('0xc')](function(_0x5bf3d4){logger[_0xc3c2('0xd')]('VoiceContext,\x20%s,\x20%s',_0xc36639,'request\x20sent');logger[_0xc3c2('0xe')](_0xc3c2('0xf'),_0xc36639,_0xc3c2('0x10'),JSON['stringify'](_0x5bf3d4));if(_0x5bf3d4[_0xc3c2('0x11')]){if(_0x5bf3d4[_0xc3c2('0x11')][_0xc3c2('0x12')]===0x1f4){logger[_0xc3c2('0x11')]('VoiceContext,\x20%s,\x20%s',_0xc36639,_0x5bf3d4[_0xc3c2('0x11')][_0xc3c2('0x13')]);return _0x55840b(_0x5bf3d4['error'][_0xc3c2('0x13')]);}logger['error'](_0xc3c2('0x14'),_0xc36639,_0x5bf3d4['error'][_0xc3c2('0x13')]);return _0x5daa76(_0x5bf3d4['error'][_0xc3c2('0x13')]);}else{logger[_0xc3c2('0xd')]('VoiceContext,\x20%s,\x20%s',_0xc36639,_0xc3c2('0x10'));_0x5daa76(_0x5bf3d4[_0xc3c2('0x15')][_0xc3c2('0x13')]);}})[_0xc3c2('0x16')](function(_0x342d4a){logger[_0xc3c2('0x11')]('VoiceContext,\x20%s,\x20%s',_0xc36639,_0x342d4a);_0x55840b(_0x342d4a);});});} \ No newline at end of file +var _0xc7ee=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x182190,_0x246b68){var _0x31883b=function(_0xd443c9){while(--_0xd443c9){_0x182190['push'](_0x182190['shift']());}};_0x31883b(++_0x246b68);}(_0xc7ee,0x1aa));var _0xec7e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc7ee[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xec7e('0x0'));var util=require(_0xec7e('0x1'));var moment=require(_0xec7e('0x2'));var BPromise=require(_0xec7e('0x3'));var rs=require(_0xec7e('0x4'));var fs=require('fs');var Redis=require(_0xec7e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xec7e('0x6'));var logger=require(_0xec7e('0x7'))(_0xec7e('0x8'));var config=require(_0xec7e('0x9'));var jayson=require(_0xec7e('0xa'));var client=jayson[_0xec7e('0xb')][_0xec7e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd49f94,_0x6c6886,_0x42b468){return new BPromise(function(_0x2d1f7f,_0x37d03a){return client[_0xec7e('0xd')](_0xd49f94,_0x42b468)[_0xec7e('0xe')](function(_0x496693){logger[_0xec7e('0xf')](_0xec7e('0x10'),_0x6c6886,_0xec7e('0x11'));logger['debug'](_0xec7e('0x12'),_0x6c6886,_0xec7e('0x11'),JSON[_0xec7e('0x13')](_0x496693));if(_0x496693[_0xec7e('0x14')]){if(_0x496693[_0xec7e('0x14')][_0xec7e('0x15')]===0x1f4){logger[_0xec7e('0x14')](_0xec7e('0x10'),_0x6c6886,_0x496693['error'][_0xec7e('0x16')]);return _0x37d03a(_0x496693[_0xec7e('0x14')][_0xec7e('0x16')]);}logger[_0xec7e('0x14')]('VoiceContext,\x20%s,\x20%s',_0x6c6886,_0x496693[_0xec7e('0x14')]['message']);return _0x2d1f7f(_0x496693[_0xec7e('0x14')][_0xec7e('0x16')]);}else{logger[_0xec7e('0xf')]('VoiceContext,\x20%s,\x20%s',_0x6c6886,_0xec7e('0x11'));_0x2d1f7f(_0x496693['result']['message']);}})[_0xec7e('0x17')](function(_0x2ac81b){logger[_0xec7e('0x14')](_0xec7e('0x10'),_0x6c6886,_0x2ac81b);_0x37d03a(_0x2ac81b);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index da1b5ad..3336081 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 _0x4633=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceDialReport.controller','get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4633,0x17c));var _0x3463=function(_0x14c56e,_0xf8ef02){_0x14c56e=_0x14c56e-0x0;var _0x422094=_0x4633[_0x14c56e];return _0x422094;};'use strict';var multer=require(_0x3463('0x0'));var util=require(_0x3463('0x1'));var path=require(_0x3463('0x2'));var timeout=require(_0x3463('0x3'));var express=require(_0x3463('0x4'));var router=express[_0x3463('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x3463('0x6'));var config=require('../../config/environment');var controller=require(_0x3463('0x7'));router[_0x3463('0x8')]('/',auth['isAuthenticated'](),controller[_0x3463('0x9')]);router[_0x3463('0x8')]('/describe',auth[_0x3463('0xa')](),controller[_0x3463('0xb')]);router[_0x3463('0x8')](_0x3463('0xc'),auth[_0x3463('0xa')](),controller['show']);router[_0x3463('0xd')]('/',auth['isAuthenticated'](),controller[_0x3463('0xe')]);router[_0x3463('0xf')](_0x3463('0xc'),auth[_0x3463('0xa')](),controller[_0x3463('0x10')]);router[_0x3463('0x11')](_0x3463('0xc'),auth[_0x3463('0xa')](),controller['destroy']);module[_0x3463('0x12')]=router; \ No newline at end of file +var _0xed93=['../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','describe','post','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','Router'];(function(_0x206338,_0x2d800b){var _0x2b87f2=function(_0x436c1c){while(--_0x436c1c){_0x206338['push'](_0x206338['shift']());}};_0x2b87f2(++_0x2d800b);}(_0xed93,0xea));var _0x3ed9=function(_0x3d6cdb,_0xd254d4){_0x3d6cdb=_0x3d6cdb-0x0;var _0x4d128b=_0xed93[_0x3d6cdb];return _0x4d128b;};'use strict';var multer=require('multer');var util=require(_0x3ed9('0x0'));var path=require(_0x3ed9('0x1'));var timeout=require(_0x3ed9('0x2'));var express=require('express');var router=express[_0x3ed9('0x3')]();var auth=require(_0x3ed9('0x4'));var interaction=require(_0x3ed9('0x5'));var config=require('../../config/environment');var controller=require(_0x3ed9('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3ed9('0x7')]('/describe',auth[_0x3ed9('0x8')](),controller[_0x3ed9('0x9')]);router['get']('/:id',auth[_0x3ed9('0x8')](),controller['show']);router[_0x3ed9('0xa')]('/',auth['isAuthenticated'](),controller[_0x3ed9('0xb')]);router[_0x3ed9('0xc')](_0x3ed9('0xd'),auth[_0x3ed9('0x8')](),controller['update']);router[_0x3ed9('0xe')](_0x3ed9('0xd'),auth['isAuthenticated'](),controller[_0x3ed9('0xf')]);module[_0x3ed9('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 11f1394..8860069 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 _0x8c05=['exports','STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x45fb13,_0x293e34){var _0x36c8f7=function(_0x4796f8){while(--_0x4796f8){_0x45fb13['push'](_0x45fb13['shift']());}};_0x36c8f7(++_0x293e34);}(_0x8c05,0xf5));var _0x58c0=function(_0x10f060,_0x312a7b){_0x10f060=_0x10f060-0x0;var _0x512722=_0x8c05[_0x10f060];return _0x512722;};'use strict';var Sequelize=require(_0x58c0('0x0'));module[_0x58c0('0x1')]={'privilege':{'type':Sequelize[_0x58c0('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x58c0('0x3')]},'channelstatedesc':{'type':Sequelize[_0x58c0('0x2')]},'calleridnum':{'type':Sequelize[_0x58c0('0x2')]},'calleridname':{'type':Sequelize[_0x58c0('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x58c0('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x58c0('0x2')]},'context':{'type':Sequelize[_0x58c0('0x2')]},'exten':{'type':Sequelize[_0x58c0('0x2')]},'priority':{'type':Sequelize[_0x58c0('0x3')]},'uniqueid':{'type':Sequelize[_0x58c0('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x58c0('0x2')]},'destcalleridnum':{'type':Sequelize[_0x58c0('0x2')]},'destcalleridname':{'type':Sequelize[_0x58c0('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x58c0('0x2')]},'destlanguage':{'type':Sequelize[_0x58c0('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x58c0('0x2')]},'destpriority':{'type':Sequelize[_0x58c0('0x3')]},'destuniqueid':{'type':Sequelize[_0x58c0('0x2')]},'destlinkedid':{'type':Sequelize[_0x58c0('0x2')]},'dialstring':{'type':Sequelize[_0x58c0('0x2')]},'dialstatus':{'type':Sequelize[_0x58c0('0x2')]},'starttime':{'type':Sequelize[_0x58c0('0x4')]},'answertime':{'type':Sequelize[_0x58c0('0x4')]},'endtime':{'type':Sequelize[_0x58c0('0x4')]},'lastevent':{'type':Sequelize[_0x58c0('0x2')],'comment':_0x58c0('0x5')},'routeId':{'type':Sequelize[_0x58c0('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x58c0('0x3')]},'billableseconds':{'type':Sequelize[_0x58c0('0x3')]}}; \ No newline at end of file +var _0x0705=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x2468b5,_0x506b9e){var _0x1056e4=function(_0x26da1c){while(--_0x26da1c){_0x2468b5['push'](_0x2468b5['shift']());}};_0x1056e4(++_0x506b9e);}(_0x0705,0x17c));var _0x5070=function(_0x24b897,_0x38df26){_0x24b897=_0x24b897-0x0;var _0x522698=_0x0705[_0x24b897];return _0x522698;};'use strict';var Sequelize=require('sequelize');module[_0x5070('0x0')]={'privilege':{'type':Sequelize[_0x5070('0x1')]},'channel':{'type':Sequelize[_0x5070('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5070('0x1')]},'connectedlinenum':{'type':Sequelize[_0x5070('0x1')]},'connectedlinename':{'type':Sequelize[_0x5070('0x1')]},'language':{'type':Sequelize[_0x5070('0x1')]},'accountcode':{'type':Sequelize[_0x5070('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x5070('0x1')]},'linkedid':{'type':Sequelize[_0x5070('0x1')]},'destchannel':{'type':Sequelize[_0x5070('0x1')]},'destchannelstate':{'type':Sequelize[_0x5070('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x5070('0x1')]},'destcalleridname':{'type':Sequelize[_0x5070('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x5070('0x1')]},'destlanguage':{'type':Sequelize[_0x5070('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x5070('0x1')]},'destexten':{'type':Sequelize[_0x5070('0x1')]},'destpriority':{'type':Sequelize[_0x5070('0x2')]},'destuniqueid':{'type':Sequelize[_0x5070('0x1')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x5070('0x1')]},'dialstatus':{'type':Sequelize[_0x5070('0x1')]},'starttime':{'type':Sequelize[_0x5070('0x3')]},'answertime':{'type':Sequelize[_0x5070('0x3')]},'endtime':{'type':Sequelize[_0x5070('0x3')]},'lastevent':{'type':Sequelize[_0x5070('0x1')],'comment':_0x5070('0x4')},'routeId':{'type':Sequelize[_0x5070('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x5070('0x2')]},'billableseconds':{'type':Sequelize[_0x5070('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index ccf0a4d..93620c3 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 _0x846b=['options','VoiceDialReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x52ac80,_0x903b6a){var _0x4f86bb=function(_0x45d908){while(--_0x45d908){_0x52ac80['push'](_0x52ac80['shift']());}};_0x4f86bb(++_0x903b6a);}(_0x846b,0x199));var _0xb846=function(_0x265092,_0x44b2f1){_0x265092=_0x265092-0x0;var _0xb38eb6=_0x846b[_0x265092];return _0xb38eb6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb846('0x0'));var rimraf=require(_0xb846('0x1'));var zipdir=require(_0xb846('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb846('0x3'));var moment=require(_0xb846('0x4'));var BPromise=require(_0xb846('0x5'));var Mustache=require(_0xb846('0x6'));var util=require(_0xb846('0x7'));var path=require(_0xb846('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb846('0x9'));var fs=require('fs');var _=require(_0xb846('0xa'));var squel=require(_0xb846('0xb'));var crypto=require(_0xb846('0xc'));var jsforce=require(_0xb846('0xd'));var deskjs=require(_0xb846('0xe'));var toCsv=require(_0xb846('0xf'));var querystring=require(_0xb846('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb846('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb846('0x12'));var hardwareService=require(_0xb846('0x13'));var logger=require(_0xb846('0x14'))(_0xb846('0x15'));var utils=require(_0xb846('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb846('0x17'))['db'];function respondWithStatusCode(_0x33bf41,_0x453538){_0x453538=_0x453538||0xcc;return function(_0xdba2cf){if(_0xdba2cf){return _0x33bf41['sendStatus'](_0x453538);}return _0x33bf41[_0xb846('0x18')](_0x453538)[_0xb846('0x19')]();};}function respondWithResult(_0x31a167,_0x1074c6){_0x1074c6=_0x1074c6||0xc8;return function(_0x2110eb){if(_0x2110eb){return _0x31a167['status'](_0x1074c6)[_0xb846('0x1a')](_0x2110eb);}};}function respondWithFilteredResult(_0x50d7bc,_0x443903){return function(_0x3a86ae){if(_0x3a86ae){var _0x59ad8f=_0x3a86ae[_0xb846('0x1b')],_0x2cd4c3=_0x443903[_0xb846('0x1c')],_0xada4d8=_0x443903[_0xb846('0x1c')]+_0x443903['limit'],_0x2ec3a9;if(_0xada4d8>=_0x59ad8f){_0xada4d8=_0x59ad8f;_0x2ec3a9=0xc8;}else{_0x2ec3a9=0xce;}_0x50d7bc[_0xb846('0x18')](_0x2ec3a9);return _0x50d7bc[_0xb846('0x1d')](_0xb846('0x1e'),_0x2cd4c3+'-'+_0xada4d8+'/'+_0x59ad8f)['json'](_0x3a86ae);}return null;};}function patchUpdates(_0xe014d4){return function(_0x5bb026){try{jsonpatch[_0xb846('0x1f')](_0x5bb026,_0xe014d4,!![]);}catch(_0x4174ff){return BPromise[_0xb846('0x20')](_0x4174ff);}return _0x5bb026[_0xb846('0x21')]();};}function saveUpdates(_0xe9960b,_0x271cae){return function(_0x434b6c){if(_0x434b6c){return _0x434b6c[_0xb846('0x22')](_0xe9960b)[_0xb846('0x23')](function(_0x132224){return _0x132224;});}return null;};}function removeEntity(_0x30c51c,_0x594d19){return function(_0x59142f){if(_0x59142f){return _0x59142f[_0xb846('0x24')]()['then'](function(){_0x30c51c[_0xb846('0x18')](0xcc)[_0xb846('0x19')]();});}};}function handleEntityNotFound(_0x52ef14,_0x5e79c9){return function(_0x4760a8){if(!_0x4760a8){_0x52ef14[_0xb846('0x25')](0x194);}return _0x4760a8;};}function handleError(_0x297c1a,_0x3fca3e){_0x3fca3e=_0x3fca3e||0x1f4;return function(_0x568451){logger[_0xb846('0x26')](_0x568451[_0xb846('0x27')]);if(_0x568451['name']){delete _0x568451[_0xb846('0x28')];}_0x297c1a[_0xb846('0x18')](_0x3fca3e)[_0xb846('0x29')](_0x568451);};}exports[_0xb846('0x2a')]=function(_0x46a41c,_0x5693b3){var _0xe7d079={},_0x5d9a1a={},_0x4a5323={'count':0x0,'rows':[]};var _0x57bcf5=_['map'](db['VoiceDialReport']['rawAttributes'],function(_0x5eed7f){return{'name':_0x5eed7f[_0xb846('0x2b')],'type':_0x5eed7f[_0xb846('0x2c')][_0xb846('0x2d')]};});_0x5d9a1a[_0xb846('0x2e')]=_[_0xb846('0x2f')](_0x57bcf5,_0xb846('0x28'));_0x5d9a1a[_0xb846('0x30')]=_[_0xb846('0x31')](_0x46a41c[_0xb846('0x30')]);_0x5d9a1a[_0xb846('0x32')]=_['intersection'](_0x5d9a1a[_0xb846('0x2e')],_0x5d9a1a[_0xb846('0x30')]);_0xe7d079[_0xb846('0x33')]=_[_0xb846('0x34')](_0x5d9a1a[_0xb846('0x2e')],qs[_0xb846('0x35')](_0x46a41c['query'][_0xb846('0x35')]));_0xe7d079['attributes']=_0xe7d079[_0xb846('0x33')][_0xb846('0x36')]?_0xe7d079[_0xb846('0x33')]:_0x5d9a1a['model'];if(!_0x46a41c[_0xb846('0x30')][_0xb846('0x37')](_0xb846('0x38'))){_0xe7d079[_0xb846('0x39')]=qs['limit'](_0x46a41c['query'][_0xb846('0x39')]);_0xe7d079[_0xb846('0x1c')]=qs[_0xb846('0x1c')](_0x46a41c[_0xb846('0x30')][_0xb846('0x1c')]);}_0xe7d079[_0xb846('0x3a')]=qs[_0xb846('0x3b')](_0x46a41c[_0xb846('0x30')][_0xb846('0x3b')]);_0xe7d079[_0xb846('0x3c')]=qs['filters'](_[_0xb846('0x3d')](_0x46a41c[_0xb846('0x30')],_0x5d9a1a['filters']),_0x57bcf5);if(_0x46a41c[_0xb846('0x30')][_0xb846('0x3e')]){_0xe7d079[_0xb846('0x3c')]=_[_0xb846('0x3f')](_0xe7d079['where'],{'$or':_['map'](_0x57bcf5,function(_0x3aaa7b){if(_0x3aaa7b[_0xb846('0x2c')]!==_0xb846('0x40')){var _0xc21b0c={};_0xc21b0c[_0x3aaa7b['name']]={'$like':'%'+_0x46a41c[_0xb846('0x30')][_0xb846('0x3e')]+'%'};return _0xc21b0c;}})});}_0xe7d079=_[_0xb846('0x3f')]({},_0xe7d079,_0x46a41c[_0xb846('0x41')]);var _0x5a81c4={'where':_0xe7d079['where']};return db[_0xb846('0x42')]['count'](_0x5a81c4)['then'](function(_0x476d8d){_0x4a5323['count']=_0x476d8d;if(_0x46a41c['query'][_0xb846('0x43')]){_0xe7d079[_0xb846('0x44')]=[{'all':!![]}];}return db[_0xb846('0x42')][_0xb846('0x45')](_0xe7d079);})[_0xb846('0x23')](function(_0x4f99c7){_0x4a5323[_0xb846('0x46')]=_0x4f99c7;return _0x4a5323;})[_0xb846('0x23')](respondWithFilteredResult(_0x5693b3,_0xe7d079))[_0xb846('0x47')](handleError(_0x5693b3,null));};exports[_0xb846('0x48')]=function(_0x2ef181,_0x521b41){var _0x3e95ee={'raw':!![],'where':{'id':_0x2ef181[_0xb846('0x49')]['id']}},_0x5385b7={};_0x5385b7['model']=_[_0xb846('0x31')](db[_0xb846('0x42')][_0xb846('0x4a')]);_0x5385b7[_0xb846('0x30')]=_['keys'](_0x2ef181['query']);_0x5385b7['filtears']=_[_0xb846('0x34')](_0x5385b7['model'],_0x5385b7['query']);_0x3e95ee['attributes']=_['intersection'](_0x5385b7[_0xb846('0x2e')],qs['fields'](_0x2ef181['query'][_0xb846('0x35')]));_0x3e95ee[_0xb846('0x33')]=_0x3e95ee[_0xb846('0x33')][_0xb846('0x36')]?_0x3e95ee[_0xb846('0x33')]:_0x5385b7[_0xb846('0x2e')];if(_0x2ef181[_0xb846('0x30')]['includeAll']){_0x3e95ee[_0xb846('0x44')]=[{'all':!![]}];}_0x3e95ee=_[_0xb846('0x3f')]({},_0x3e95ee,_0x2ef181[_0xb846('0x41')]);return db[_0xb846('0x42')]['find'](_0x3e95ee)[_0xb846('0x23')](handleEntityNotFound(_0x521b41,null))['then'](respondWithResult(_0x521b41,null))[_0xb846('0x47')](handleError(_0x521b41,null));};exports[_0xb846('0x4b')]=function(_0x223ac6,_0x4bcacb){return db[_0xb846('0x42')][_0xb846('0x4b')](_0x223ac6[_0xb846('0x4c')],{})[_0xb846('0x23')](respondWithResult(_0x4bcacb,0xc9))[_0xb846('0x47')](handleError(_0x4bcacb,null));};exports[_0xb846('0x22')]=function(_0x5ba265,_0x1be843){if(_0x5ba265[_0xb846('0x4c')]['id']){delete _0x5ba265[_0xb846('0x4c')]['id'];}return db[_0xb846('0x42')]['find']({'where':{'id':_0x5ba265['params']['id']}})[_0xb846('0x23')](handleEntityNotFound(_0x1be843,null))['then'](saveUpdates(_0x5ba265[_0xb846('0x4c')],null))[_0xb846('0x23')](respondWithResult(_0x1be843,null))[_0xb846('0x47')](handleError(_0x1be843,null));};exports[_0xb846('0x24')]=function(_0x5bfe41,_0x25f8ef){return db['VoiceDialReport'][_0xb846('0x4d')]({'where':{'id':_0x5bfe41[_0xb846('0x49')]['id']}})[_0xb846('0x23')](handleEntityNotFound(_0x25f8ef,null))[_0xb846('0x23')](removeEntity(_0x25f8ef,null))[_0xb846('0x47')](handleError(_0x25f8ef,null));};exports[_0xb846('0x4e')]=function(_0x219675,_0x2e5d6c){return db['VoiceDialReport'][_0xb846('0x4e')]()[_0xb846('0x23')](respondWithResult(_0x2e5d6c,null))[_0xb846('0x47')](handleError(_0x2e5d6c,null));}; \ No newline at end of file +var _0x1d72=['../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','VoiceDialReport','includeAll','include','rows','catch','show','params','filtears','find','create','update','body','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x238830,_0x545f75){var _0x5917f0=function(_0x12f821){while(--_0x12f821){_0x238830['push'](_0x238830['shift']());}};_0x5917f0(++_0x545f75);}(_0x1d72,0x1a4));var _0x21d7=function(_0x18f920,_0x15547){_0x18f920=_0x18f920-0x0;var _0x345a9a=_0x1d72[_0x18f920];return _0x345a9a;};'use strict';var pdf=require(_0x21d7('0x0'));var emlformat=require(_0x21d7('0x1'));var rimraf=require(_0x21d7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x21d7('0x3'));var moment=require(_0x21d7('0x4'));var BPromise=require(_0x21d7('0x5'));var Mustache=require(_0x21d7('0x6'));var util=require(_0x21d7('0x7'));var path=require(_0x21d7('0x8'));var sox=require('sox');var csv=require(_0x21d7('0x9'));var ejs=require(_0x21d7('0xa'));var fs=require('fs');var _=require(_0x21d7('0xb'));var squel=require(_0x21d7('0xc'));var crypto=require('crypto');var jsforce=require(_0x21d7('0xd'));var deskjs=require(_0x21d7('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x21d7('0xf'));var Redis=require(_0x21d7('0x10'));var authService=require(_0x21d7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x21d7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x21d7('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x21d7('0x14'));var licenseUtil=require(_0x21d7('0x15'));var db=require(_0x21d7('0x16'))['db'];function respondWithStatusCode(_0x4a6d5a,_0x2a9679){_0x2a9679=_0x2a9679||0xcc;return function(_0x371584){if(_0x371584){return _0x4a6d5a['sendStatus'](_0x2a9679);}return _0x4a6d5a[_0x21d7('0x17')](_0x2a9679)[_0x21d7('0x18')]();};}function respondWithResult(_0x2708fd,_0x5278f0){_0x5278f0=_0x5278f0||0xc8;return function(_0x51344a){if(_0x51344a){return _0x2708fd['status'](_0x5278f0)[_0x21d7('0x19')](_0x51344a);}};}function respondWithFilteredResult(_0x1fefbe,_0x363b5d){return function(_0x3a2e12){if(_0x3a2e12){var _0x5cc875=_0x3a2e12[_0x21d7('0x1a')],_0x48b2dd=_0x363b5d['offset'],_0x32f488=_0x363b5d[_0x21d7('0x1b')]+_0x363b5d[_0x21d7('0x1c')],_0x2f6f28;if(_0x32f488>=_0x5cc875){_0x32f488=_0x5cc875;_0x2f6f28=0xc8;}else{_0x2f6f28=0xce;}_0x1fefbe['status'](_0x2f6f28);return _0x1fefbe[_0x21d7('0x1d')]('Content-Range',_0x48b2dd+'-'+_0x32f488+'/'+_0x5cc875)[_0x21d7('0x19')](_0x3a2e12);}return null;};}function patchUpdates(_0x83dfaa){return function(_0x28f1cf){try{jsonpatch[_0x21d7('0x1e')](_0x28f1cf,_0x83dfaa,!![]);}catch(_0x425269){return BPromise['reject'](_0x425269);}return _0x28f1cf[_0x21d7('0x1f')]();};}function saveUpdates(_0x32fe43,_0x333e42){return function(_0x167d2b){if(_0x167d2b){return _0x167d2b['update'](_0x32fe43)[_0x21d7('0x20')](function(_0x3b76e4){return _0x3b76e4;});}return null;};}function removeEntity(_0x576373,_0x5e02f6){return function(_0x520275){if(_0x520275){return _0x520275[_0x21d7('0x21')]()[_0x21d7('0x20')](function(){_0x576373[_0x21d7('0x17')](0xcc)[_0x21d7('0x18')]();});}};}function handleEntityNotFound(_0x568ec4,_0x55345f){return function(_0x17c73b){if(!_0x17c73b){_0x568ec4[_0x21d7('0x22')](0x194);}return _0x17c73b;};}function handleError(_0x524096,_0x13f541){_0x13f541=_0x13f541||0x1f4;return function(_0x1cc8b6){logger[_0x21d7('0x23')](_0x1cc8b6[_0x21d7('0x24')]);if(_0x1cc8b6[_0x21d7('0x25')]){delete _0x1cc8b6[_0x21d7('0x25')];}_0x524096[_0x21d7('0x17')](_0x13f541)[_0x21d7('0x26')](_0x1cc8b6);};}exports[_0x21d7('0x27')]=function(_0x132b05,_0xfa4158){var _0x3e2c38={},_0x1e9ec0={},_0x1563e0={'count':0x0,'rows':[]};var _0x2b18e4=_[_0x21d7('0x28')](db['VoiceDialReport'][_0x21d7('0x29')],function(_0x1610d1){return{'name':_0x1610d1['fieldName'],'type':_0x1610d1[_0x21d7('0x2a')][_0x21d7('0x2b')]};});_0x1e9ec0['model']=_[_0x21d7('0x28')](_0x2b18e4,'name');_0x1e9ec0[_0x21d7('0x2c')]=_[_0x21d7('0x2d')](_0x132b05['query']);_0x1e9ec0[_0x21d7('0x2e')]=_[_0x21d7('0x2f')](_0x1e9ec0[_0x21d7('0x30')],_0x1e9ec0[_0x21d7('0x2c')]);_0x3e2c38['attributes']=_['intersection'](_0x1e9ec0[_0x21d7('0x30')],qs[_0x21d7('0x31')](_0x132b05[_0x21d7('0x2c')][_0x21d7('0x31')]));_0x3e2c38[_0x21d7('0x32')]=_0x3e2c38[_0x21d7('0x32')][_0x21d7('0x33')]?_0x3e2c38[_0x21d7('0x32')]:_0x1e9ec0['model'];if(!_0x132b05[_0x21d7('0x2c')][_0x21d7('0x34')](_0x21d7('0x35'))){_0x3e2c38[_0x21d7('0x1c')]=qs[_0x21d7('0x1c')](_0x132b05[_0x21d7('0x2c')][_0x21d7('0x1c')]);_0x3e2c38[_0x21d7('0x1b')]=qs[_0x21d7('0x1b')](_0x132b05['query']['offset']);}_0x3e2c38[_0x21d7('0x36')]=qs[_0x21d7('0x37')](_0x132b05[_0x21d7('0x2c')]['sort']);_0x3e2c38['where']=qs[_0x21d7('0x2e')](_['pick'](_0x132b05[_0x21d7('0x2c')],_0x1e9ec0[_0x21d7('0x2e')]),_0x2b18e4);if(_0x132b05[_0x21d7('0x2c')]['filter']){_0x3e2c38[_0x21d7('0x38')]=_[_0x21d7('0x39')](_0x3e2c38[_0x21d7('0x38')],{'$or':_[_0x21d7('0x28')](_0x2b18e4,function(_0x3a2599){if(_0x3a2599[_0x21d7('0x2a')]!=='VIRTUAL'){var _0x399b6a={};_0x399b6a[_0x3a2599['name']]={'$like':'%'+_0x132b05[_0x21d7('0x2c')][_0x21d7('0x3a')]+'%'};return _0x399b6a;}})});}_0x3e2c38=_[_0x21d7('0x39')]({},_0x3e2c38,_0x132b05[_0x21d7('0x3b')]);var _0x1b2066={'where':_0x3e2c38[_0x21d7('0x38')]};return db[_0x21d7('0x3c')]['count'](_0x1b2066)[_0x21d7('0x20')](function(_0x2022ab){_0x1563e0['count']=_0x2022ab;if(_0x132b05[_0x21d7('0x2c')][_0x21d7('0x3d')]){_0x3e2c38[_0x21d7('0x3e')]=[{'all':!![]}];}return db[_0x21d7('0x3c')]['findAll'](_0x3e2c38);})[_0x21d7('0x20')](function(_0xdafb2e){_0x1563e0[_0x21d7('0x3f')]=_0xdafb2e;return _0x1563e0;})['then'](respondWithFilteredResult(_0xfa4158,_0x3e2c38))[_0x21d7('0x40')](handleError(_0xfa4158,null));};exports[_0x21d7('0x41')]=function(_0xf9232e,_0x6d65c0){var _0x2efc66={'raw':!![],'where':{'id':_0xf9232e[_0x21d7('0x42')]['id']}},_0x28910b={};_0x28910b[_0x21d7('0x30')]=_[_0x21d7('0x2d')](db['VoiceDialReport'][_0x21d7('0x29')]);_0x28910b[_0x21d7('0x2c')]=_[_0x21d7('0x2d')](_0xf9232e[_0x21d7('0x2c')]);_0x28910b[_0x21d7('0x43')]=_[_0x21d7('0x2f')](_0x28910b[_0x21d7('0x30')],_0x28910b[_0x21d7('0x2c')]);_0x2efc66[_0x21d7('0x32')]=_[_0x21d7('0x2f')](_0x28910b[_0x21d7('0x30')],qs['fields'](_0xf9232e[_0x21d7('0x2c')]['fields']));_0x2efc66[_0x21d7('0x32')]=_0x2efc66[_0x21d7('0x32')]['length']?_0x2efc66[_0x21d7('0x32')]:_0x28910b[_0x21d7('0x30')];if(_0xf9232e['query'][_0x21d7('0x3d')]){_0x2efc66[_0x21d7('0x3e')]=[{'all':!![]}];}_0x2efc66=_[_0x21d7('0x39')]({},_0x2efc66,_0xf9232e[_0x21d7('0x3b')]);return db[_0x21d7('0x3c')][_0x21d7('0x44')](_0x2efc66)[_0x21d7('0x20')](handleEntityNotFound(_0x6d65c0,null))[_0x21d7('0x20')](respondWithResult(_0x6d65c0,null))[_0x21d7('0x40')](handleError(_0x6d65c0,null));};exports[_0x21d7('0x45')]=function(_0x2e3512,_0x11ca9c){return db[_0x21d7('0x3c')][_0x21d7('0x45')](_0x2e3512['body'],{})[_0x21d7('0x20')](respondWithResult(_0x11ca9c,0xc9))[_0x21d7('0x40')](handleError(_0x11ca9c,null));};exports[_0x21d7('0x46')]=function(_0x2d5bbe,_0x153dfe){if(_0x2d5bbe[_0x21d7('0x47')]['id']){delete _0x2d5bbe['body']['id'];}return db[_0x21d7('0x3c')]['find']({'where':{'id':_0x2d5bbe[_0x21d7('0x42')]['id']}})[_0x21d7('0x20')](handleEntityNotFound(_0x153dfe,null))[_0x21d7('0x20')](saveUpdates(_0x2d5bbe['body'],null))['then'](respondWithResult(_0x153dfe,null))[_0x21d7('0x40')](handleError(_0x153dfe,null));};exports[_0x21d7('0x21')]=function(_0x5f49df,_0x50ca23){return db[_0x21d7('0x3c')][_0x21d7('0x44')]({'where':{'id':_0x5f49df[_0x21d7('0x42')]['id']}})[_0x21d7('0x20')](handleEntityNotFound(_0x50ca23,null))['then'](removeEntity(_0x50ca23,null))['catch'](handleError(_0x50ca23,null));};exports[_0x21d7('0x48')]=function(_0xc98f84,_0x56e6f5){return db[_0x21d7('0x3c')][_0x21d7('0x48')]()[_0x21d7('0x20')](respondWithResult(_0x56e6f5,null))['catch'](handleError(_0x56e6f5,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 43d29f4..33805f9 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 _0x869c=['define','VoiceDialReport','report_dial','uniqueid','lodash','util','api','moment','request-promise','path','rimraf','exports'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0x869c,0x64));var _0xc869=function(_0x1541c3,_0x2c6f07){_0x1541c3=_0x1541c3-0x0;var _0x3f9028=_0x869c[_0x1541c3];return _0x3f9028;};'use strict';var _=require(_0xc869('0x0'));var util=require(_0xc869('0x1'));var logger=require('../../config/logger')(_0xc869('0x2'));var moment=require(_0xc869('0x3'));var BPromise=require('bluebird');var rp=require(_0xc869('0x4'));var fs=require('fs');var path=require(_0xc869('0x5'));var rimraf=require(_0xc869('0x6'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0xc869('0x7')]=function(_0x57718d,_0x1383cb){return _0x57718d[_0xc869('0x8')](_0xc869('0x9'),attributes,{'tableName':_0xc869('0xa'),'paranoid':![],'indexes':[{'fields':[_0xc869('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf1d1=['rimraf','../../config/environment','exports','define','report_dial','uniqueid','util','moment','bluebird','request-promise','path'];(function(_0x3bc76b,_0x16026c){var _0x3a7b=function(_0x383105){while(--_0x383105){_0x3bc76b['push'](_0x3bc76b['shift']());}};_0x3a7b(++_0x16026c);}(_0xf1d1,0xc1));var _0x1f1d=function(_0x1c77c4,_0xaef643){_0x1c77c4=_0x1c77c4-0x0;var _0x546176=_0xf1d1[_0x1c77c4];return _0x546176;};'use strict';var _=require('lodash');var util=require(_0x1f1d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1f1d('0x1'));var BPromise=require(_0x1f1d('0x2'));var rp=require(_0x1f1d('0x3'));var fs=require('fs');var path=require(_0x1f1d('0x4'));var rimraf=require(_0x1f1d('0x5'));var config=require(_0x1f1d('0x6'));var attributes=require('./voiceDialReport.attributes');module[_0x1f1d('0x7')]=function(_0x38bf2e,_0x331c11){return _0x38bf2e[_0x1f1d('0x8')]('VoiceDialReport',attributes,{'tableName':_0x1f1d('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1f1d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 04e3fde..8080db4 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 _0xb7ea=['update','body','where','attributes','limit','stringify','lodash','util','moment','bluebird','../../config/logger','../../config/environment','jayson/promise','client','request','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','message','VoiceDialReport,\x20%s,\x20%s','result','catch','VoiceDialReport','options','raw','then','info','CreateVoiceDialReport','UpdateVoiceDialReport'];(function(_0x4f6b86,_0x3c3ffb){var _0x2087c3=function(_0x3bc2a3){while(--_0x3bc2a3){_0x4f6b86['push'](_0x4f6b86['shift']());}};_0x2087c3(++_0x3c3ffb);}(_0xb7ea,0xd8));var _0xab7e=function(_0x220474,_0x2aba1d){_0x220474=_0x220474-0x0;var _0x2af91a=_0xb7ea[_0x220474];return _0x2af91a;};'use strict';var _=require(_0xab7e('0x0'));var util=require(_0xab7e('0x1'));var moment=require(_0xab7e('0x2'));var BPromise=require(_0xab7e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xab7e('0x4'))('rpc');var config=require(_0xab7e('0x5'));var jayson=require(_0xab7e('0x6'));var client=jayson[_0xab7e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2bb62e,_0x5e1dec,_0x57198a){return new BPromise(function(_0x1cdd89,_0x3b1f31){return client[_0xab7e('0x8')](_0x2bb62e,_0x57198a)['then'](function(_0x592fc1){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x5e1dec,_0xab7e('0x9'));logger[_0xab7e('0xa')](_0xab7e('0xb'),_0x5e1dec,'request\x20sent',JSON['stringify'](_0x592fc1));if(_0x592fc1[_0xab7e('0xc')]){if(_0x592fc1[_0xab7e('0xc')]['code']===0x1f4){logger[_0xab7e('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x5e1dec,_0x592fc1[_0xab7e('0xc')][_0xab7e('0xd')]);return _0x3b1f31(_0x592fc1[_0xab7e('0xc')][_0xab7e('0xd')]);}logger[_0xab7e('0xc')](_0xab7e('0xe'),_0x5e1dec,_0x592fc1[_0xab7e('0xc')]['message']);return _0x1cdd89(_0x592fc1[_0xab7e('0xc')]['message']);}else{logger['info'](_0xab7e('0xe'),_0x5e1dec,'request\x20sent');_0x1cdd89(_0x592fc1[_0xab7e('0xf')][_0xab7e('0xd')]);}})[_0xab7e('0x10')](function(_0x36e9b2){logger[_0xab7e('0xc')](_0xab7e('0xe'),_0x5e1dec,_0x36e9b2);_0x3b1f31(_0x36e9b2);});});}exports['CreateVoiceDialReport']=function(_0x516abf){var _0x5c3685=this;return new Promise(function(_0x34265f,_0x39af6f){return db[_0xab7e('0x11')]['create'](_0x516abf['body'],{'raw':_0x516abf[_0xab7e('0x12')]?_0x516abf[_0xab7e('0x12')][_0xab7e('0x13')]===undefined?!![]:![]:!![]})[_0xab7e('0x14')](function(_0xeb7f77){logger[_0xab7e('0x15')](_0xab7e('0x16'),_0x516abf);logger[_0xab7e('0xa')](_0xab7e('0x16'),_0x516abf,JSON['stringify'](_0xeb7f77));_0x34265f(_0xeb7f77);})[_0xab7e('0x10')](function(_0x102484){logger['error'](_0xab7e('0x16'),_0x102484[_0xab7e('0xd')],_0x516abf);_0x39af6f(_0x5c3685[_0xab7e('0xc')](0x1f4,_0x102484[_0xab7e('0xd')]));});});};exports[_0xab7e('0x17')]=function(_0x477905){var _0x3045dd=this;return new Promise(function(_0x37b34d,_0x11afe1){return db[_0xab7e('0x11')][_0xab7e('0x18')](_0x477905[_0xab7e('0x19')],{'raw':_0x477905[_0xab7e('0x12')]?_0x477905[_0xab7e('0x12')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x477905[_0xab7e('0x12')]?_0x477905[_0xab7e('0x12')][_0xab7e('0x1a')]||null:null,'attributes':_0x477905[_0xab7e('0x12')]?_0x477905[_0xab7e('0x12')][_0xab7e('0x1b')]||null:null,'limit':_0x477905['options']?_0x477905[_0xab7e('0x12')][_0xab7e('0x1c')]||null:null})[_0xab7e('0x14')](function(_0x32a9cf){logger[_0xab7e('0x15')](_0xab7e('0x17'),_0x477905);logger[_0xab7e('0xa')]('UpdateVoiceDialReport',_0x477905,JSON[_0xab7e('0x1d')](_0x32a9cf));_0x37b34d(_0x32a9cf);})['catch'](function(_0x59a70d){logger[_0xab7e('0xc')]('UpdateVoiceDialReport',_0x59a70d[_0xab7e('0xd')],_0x477905);_0x11afe1(_0x3045dd[_0xab7e('0xc')](0x1f4,_0x59a70d['message']));});});}; \ No newline at end of file +var _0xff54=['VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','info','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','stringify','UpdateVoiceDialReport','where','attributes','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x5b2980,_0x31ad07){var _0x4c308e=function(_0x4f162d){while(--_0x4f162d){_0x5b2980['push'](_0x5b2980['shift']());}};_0x4c308e(++_0x31ad07);}(_0xff54,0x193));var _0x4ff5=function(_0x44f92f,_0x5ad5f8){_0x44f92f=_0x44f92f-0x0;var _0x1bdcff=_0xff54[_0x44f92f];return _0x1bdcff;};'use strict';var _=require(_0x4ff5('0x0'));var util=require(_0x4ff5('0x1'));var moment=require(_0x4ff5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ff5('0x3'));var db=require(_0x4ff5('0x4'))['db'];var utils=require(_0x4ff5('0x5'));var logger=require(_0x4ff5('0x6'))(_0x4ff5('0x7'));var config=require('../../config/environment');var jayson=require(_0x4ff5('0x8'));var client=jayson[_0x4ff5('0x9')][_0x4ff5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e8210,_0x307ca8,_0x1ba663){return new BPromise(function(_0x1034d2,_0x4a18c0){return client[_0x4ff5('0xb')](_0x3e8210,_0x1ba663)[_0x4ff5('0xc')](function(_0x318c3c){logger['info'](_0x4ff5('0xd'),_0x307ca8,_0x4ff5('0xe'));logger[_0x4ff5('0xf')](_0x4ff5('0x10'),_0x307ca8,_0x4ff5('0xe'),JSON['stringify'](_0x318c3c));if(_0x318c3c[_0x4ff5('0x11')]){if(_0x318c3c[_0x4ff5('0x11')][_0x4ff5('0x12')]===0x1f4){logger[_0x4ff5('0x11')](_0x4ff5('0xd'),_0x307ca8,_0x318c3c[_0x4ff5('0x11')]['message']);return _0x4a18c0(_0x318c3c[_0x4ff5('0x11')]['message']);}logger[_0x4ff5('0x11')](_0x4ff5('0xd'),_0x307ca8,_0x318c3c['error']['message']);return _0x1034d2(_0x318c3c[_0x4ff5('0x11')]['message']);}else{logger[_0x4ff5('0x13')](_0x4ff5('0xd'),_0x307ca8,_0x4ff5('0xe'));_0x1034d2(_0x318c3c['result'][_0x4ff5('0x14')]);}})[_0x4ff5('0x15')](function(_0x3ecc29){logger[_0x4ff5('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x307ca8,_0x3ecc29);_0x4a18c0(_0x3ecc29);});});}exports[_0x4ff5('0x16')]=function(_0x411954){var _0x5c6f36=this;return new Promise(function(_0x36222e,_0x4a86fe){return db[_0x4ff5('0x17')][_0x4ff5('0x18')](_0x411954[_0x4ff5('0x19')],{'raw':_0x411954[_0x4ff5('0x1a')]?_0x411954[_0x4ff5('0x1a')][_0x4ff5('0x1b')]===undefined?!![]:![]:!![]})[_0x4ff5('0xc')](function(_0x2d060e){logger[_0x4ff5('0x13')](_0x4ff5('0x16'),_0x411954);logger['debug'](_0x4ff5('0x16'),_0x411954,JSON[_0x4ff5('0x1c')](_0x2d060e));_0x36222e(_0x2d060e);})[_0x4ff5('0x15')](function(_0x1b3278){logger[_0x4ff5('0x11')]('CreateVoiceDialReport',_0x1b3278[_0x4ff5('0x14')],_0x411954);_0x4a86fe(_0x5c6f36[_0x4ff5('0x11')](0x1f4,_0x1b3278[_0x4ff5('0x14')]));});});};exports[_0x4ff5('0x1d')]=function(_0xfea52f){var _0x3c02a2=this;return new Promise(function(_0x56a7f9,_0x481686){return db[_0x4ff5('0x17')]['update'](_0xfea52f[_0x4ff5('0x19')],{'raw':_0xfea52f['options']?_0xfea52f[_0x4ff5('0x1a')][_0x4ff5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfea52f[_0x4ff5('0x1a')]?_0xfea52f[_0x4ff5('0x1a')][_0x4ff5('0x1e')]||null:null,'attributes':_0xfea52f[_0x4ff5('0x1a')]?_0xfea52f[_0x4ff5('0x1a')][_0x4ff5('0x1f')]||null:null,'limit':_0xfea52f[_0x4ff5('0x1a')]?_0xfea52f[_0x4ff5('0x1a')]['limit']||null:null})[_0x4ff5('0xc')](function(_0x4dc4dc){logger[_0x4ff5('0x13')](_0x4ff5('0x1d'),_0xfea52f);logger[_0x4ff5('0xf')](_0x4ff5('0x1d'),_0xfea52f,JSON[_0x4ff5('0x1c')](_0x4dc4dc));_0x56a7f9(_0x4dc4dc);})[_0x4ff5('0x15')](function(_0x44cd07){logger['error'](_0x4ff5('0x1d'),_0x44cd07[_0x4ff5('0x14')],_0xfea52f);_0x481686(_0x3c02a2[_0x4ff5('0x11')](0x1f4,_0x44cd07[_0x4ff5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index f0b4bda..26fb9d6 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 _0xa6b0=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','isAuthenticated','get','show','post','create','/:id/applications','/:id','update','delete','destroy'];(function(_0x53821f,_0x255d9f){var _0x57dd9b=function(_0x23fdb4){while(--_0x23fdb4){_0x53821f['push'](_0x53821f['shift']());}};_0x57dd9b(++_0x255d9f);}(_0xa6b0,0x1dc));var _0x0a6b=function(_0x8ef006,_0x4e7e62){_0x8ef006=_0x8ef006-0x0;var _0x1884f4=_0xa6b0[_0x8ef006];return _0x1884f4;};'use strict';var multer=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var path=require(_0x0a6b('0x2'));var timeout=require('connect-timeout');var express=require(_0x0a6b('0x3'));var router=express[_0x0a6b('0x4')]();var auth=require(_0x0a6b('0x5'));var interaction=require(_0x0a6b('0x6'));var config=require('../../config/environment');var controller=require(_0x0a6b('0x7'));router['get']('/',auth[_0x0a6b('0x8')](),controller['index']);router[_0x0a6b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x0a6b('0xa')]);router[_0x0a6b('0xb')]('/',auth[_0x0a6b('0x8')](),controller[_0x0a6b('0xc')]);router['post'](_0x0a6b('0xd'),auth[_0x0a6b('0x8')](),controller['addApplications']);router['put'](_0x0a6b('0xe'),auth['isAuthenticated'](),controller[_0x0a6b('0xf')]);router[_0x0a6b('0x10')](_0x0a6b('0xe'),auth[_0x0a6b('0x8')](),controller[_0x0a6b('0x11')]);module[_0x0a6b('0x12')]=router; \ No newline at end of file +var _0xef0e=['/:id/applications','addApplications','put','update','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','post','create'];(function(_0x28bea5,_0x4c0c43){var _0x33194c=function(_0x453df2){while(--_0x453df2){_0x28bea5['push'](_0x28bea5['shift']());}};_0x33194c(++_0x4c0c43);}(_0xef0e,0x96));var _0xeef0=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xef0e[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0xeef0('0x0'));var util=require(_0xeef0('0x1'));var path=require('path');var timeout=require(_0xeef0('0x2'));var express=require('express');var router=express[_0xeef0('0x3')]();var auth=require(_0xeef0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xeef0('0x5'));var controller=require('./voiceExtension.controller');router[_0xeef0('0x6')]('/',auth[_0xeef0('0x7')](),controller[_0xeef0('0x8')]);router[_0xeef0('0x6')](_0xeef0('0x9'),auth[_0xeef0('0x7')](),controller['show']);router[_0xeef0('0xa')]('/',auth[_0xeef0('0x7')](),controller[_0xeef0('0xb')]);router[_0xeef0('0xa')](_0xeef0('0xc'),auth[_0xeef0('0x7')](),controller[_0xeef0('0xd')]);router[_0xeef0('0xe')]('/:id',auth[_0xeef0('0x7')](),controller[_0xeef0('0xf')]);router['delete'](_0xeef0('0x9'),auth[_0xeef0('0x7')](),controller[_0xeef0('0x10')]);module[_0xeef0('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index a3edeca..7e16212 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(_0x5596d2,_0x1defc9){var _0x170e3c=function(_0x466a34){while(--_0x466a34){_0x5596d2['push'](_0x5596d2['shift']());}};_0x170e3c(++_0x1defc9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x3d9dbc,_0x414267){var _0x25fb2b=function(_0x2f1e03){while(--_0x2f1e03){_0x3d9dbc['push'](_0x3d9dbc['shift']());}};_0x25fb2b(++_0x414267);}(_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')]={'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 4a05e0b..9b37b46 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 _0x24cf=['VoiceExtension','includeAll','findAll','rows','show','params','keys','filtears','include','catch','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','InternalRoutes','internal','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','then','destroy','get','InboundRoutes','outbound','ignore','map','type','find','value','UserProfileResource','error','name','send','index','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x24cf,0x1d5));var _0xf24c=function(_0x1042ae,_0x1cc64c){_0x1042ae=_0x1042ae-0x0;var _0x2874d8=_0x24cf[_0x1042ae];return _0x2874d8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xf24c('0x0'));var zipdir=require(_0xf24c('0x1'));var jsonpatch=require(_0xf24c('0x2'));var rp=require(_0xf24c('0x3'));var moment=require(_0xf24c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf24c('0x5'));var util=require(_0xf24c('0x6'));var path=require(_0xf24c('0x7'));var sox=require(_0xf24c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf24c('0x9'));var crypto=require('crypto');var jsforce=require(_0xf24c('0xa'));var deskjs=require(_0xf24c('0xb'));var toCsv=require(_0xf24c('0xc'));var querystring=require(_0xf24c('0xd'));var Papa=require('papaparse');var Redis=require(_0xf24c('0xe'));var authService=require(_0xf24c('0xf'));var qs=require(_0xf24c('0x10'));var as=require(_0xf24c('0x11'));var hardwareService=require(_0xf24c('0x12'));var logger=require(_0xf24c('0x13'))('api');var utils=require(_0xf24c('0x14'));var config=require(_0xf24c('0x15'));var licenseUtil=require(_0xf24c('0x16'));var db=require('../../mysqldb')['db'];config[_0xf24c('0x17')]=_[_0xf24c('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf24c('0x19'))(new Redis(config['redis']));require(_0xf24c('0x1a'))[_0xf24c('0x1b')](socket);function respondWithStatusCode(_0x58dc00,_0x35efca){_0x35efca=_0x35efca||0xcc;return function(_0x302daf){if(_0x302daf){return _0x58dc00[_0xf24c('0x1c')](_0x35efca);}return _0x58dc00[_0xf24c('0x1d')](_0x35efca)[_0xf24c('0x1e')]();};}function respondWithResult(_0x4f20cd,_0x5c46a5){_0x5c46a5=_0x5c46a5||0xc8;return function(_0x32787d){if(_0x32787d){return _0x4f20cd[_0xf24c('0x1d')](_0x5c46a5)['json'](_0x32787d);}};}function respondWithFilteredResult(_0x2640cd,_0x35eb58){return function(_0x2d9015){if(_0x2d9015){var _0x3eb8e1=_0x2d9015[_0xf24c('0x1f')],_0x1a17c6=_0x35eb58[_0xf24c('0x20')],_0x3a0b61=_0x35eb58[_0xf24c('0x20')]+_0x35eb58[_0xf24c('0x21')],_0x36ceba;if(_0x3a0b61>=_0x3eb8e1){_0x3a0b61=_0x3eb8e1;_0x36ceba=0xc8;}else{_0x36ceba=0xce;}_0x2640cd[_0xf24c('0x1d')](_0x36ceba);return _0x2640cd['set'](_0xf24c('0x22'),_0x1a17c6+'-'+_0x3a0b61+'/'+_0x3eb8e1)[_0xf24c('0x23')](_0x2d9015);}return null;};}function patchUpdates(_0x56ffff){return function(_0x13d9ea){try{jsonpatch[_0xf24c('0x24')](_0x13d9ea,_0x56ffff,!![]);}catch(_0x3ab497){return BPromise['reject'](_0x3ab497);}return _0x13d9ea[_0xf24c('0x25')]();};}function saveUpdates(_0x5090e6,_0x40ba03){return function(_0x318abe){if(_0x318abe){return _0x318abe['update'](_0x5090e6)[_0xf24c('0x26')](function(_0x1ebdd3){return _0x1ebdd3;});}return null;};}function removeEntity(_0x106771,_0x35ba83){return function(_0x273a80){if(_0x273a80){return _0x273a80[_0xf24c('0x27')]()[_0xf24c('0x26')](function(){var _0x13cda8=_0x273a80[_0xf24c('0x28')]({'plain':!![]});var _0xc9fd87=[{'name':_0xf24c('0x29'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0xf24c('0x2a'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x46d94b=_(_0xc9fd87)['filter'](_0xf24c('0x2b'))[_0xf24c('0x2c')]('value')['value']();if(_['includes'](_0x46d94b,_0x13cda8[_0xf24c('0x2d')])){return;}var _0x52427b=_[_0xf24c('0x2e')](_0xc9fd87,[_0xf24c('0x2f'),_0x13cda8[_0xf24c('0x2d')]])['name'];return db[_0xf24c('0x30')]['destroy']({'where':{'type':_0x52427b,'resourceId':_0x13cda8['id']}})['then'](function(){return _0x273a80;});})[_0xf24c('0x26')](function(){_0x106771[_0xf24c('0x1d')](0xcc)[_0xf24c('0x1e')]();});}};}function handleEntityNotFound(_0x318ba4,_0x4c71e0){return function(_0x27026f){if(!_0x27026f){_0x318ba4[_0xf24c('0x1c')](0x194);}return _0x27026f;};}function handleError(_0x40cb38,_0x311801){_0x311801=_0x311801||0x1f4;return function(_0x3cfe5d){logger[_0xf24c('0x31')](_0x3cfe5d['stack']);if(_0x3cfe5d[_0xf24c('0x32')]){delete _0x3cfe5d[_0xf24c('0x32')];}_0x40cb38[_0xf24c('0x1d')](_0x311801)[_0xf24c('0x33')](_0x3cfe5d);};}exports[_0xf24c('0x34')]=function(_0x373882,_0x12fc96){var _0x5c8f4a={},_0xeea960={},_0x493701={'count':0x0,'rows':[]};var _0x428d8b=_[_0xf24c('0x2c')](db['VoiceExtension'][_0xf24c('0x35')],function(_0x4fe3e1){return{'name':_0x4fe3e1[_0xf24c('0x36')],'type':_0x4fe3e1[_0xf24c('0x2d')][_0xf24c('0x37')]};});_0xeea960['model']=_[_0xf24c('0x2c')](_0x428d8b,'name');_0xeea960[_0xf24c('0x38')]=_['keys'](_0x373882['query']);_0xeea960['filters']=_[_0xf24c('0x39')](_0xeea960[_0xf24c('0x3a')],_0xeea960[_0xf24c('0x38')]);_0x5c8f4a[_0xf24c('0x3b')]=_[_0xf24c('0x39')](_0xeea960[_0xf24c('0x3a')],qs[_0xf24c('0x3c')](_0x373882['query'][_0xf24c('0x3c')]));_0x5c8f4a[_0xf24c('0x3b')]=_0x5c8f4a[_0xf24c('0x3b')][_0xf24c('0x3d')]?_0x5c8f4a[_0xf24c('0x3b')]:_0xeea960['model'];if(!_0x373882[_0xf24c('0x38')]['hasOwnProperty'](_0xf24c('0x3e'))){_0x5c8f4a[_0xf24c('0x21')]=qs[_0xf24c('0x21')](_0x373882[_0xf24c('0x38')][_0xf24c('0x21')]);_0x5c8f4a[_0xf24c('0x20')]=qs[_0xf24c('0x20')](_0x373882[_0xf24c('0x38')][_0xf24c('0x20')]);}_0x5c8f4a[_0xf24c('0x3f')]=qs[_0xf24c('0x40')](_0x373882['query']['sort']);_0x5c8f4a[_0xf24c('0x41')]=qs[_0xf24c('0x42')](_[_0xf24c('0x43')](_0x373882[_0xf24c('0x38')],_0xeea960[_0xf24c('0x42')]),_0x428d8b);if(_0x373882[_0xf24c('0x38')][_0xf24c('0x44')]){_0x5c8f4a[_0xf24c('0x41')]=_[_0xf24c('0x45')](_0x5c8f4a[_0xf24c('0x41')],{'$or':_[_0xf24c('0x2c')](_0x428d8b,function(_0x5002a1){if(_0x5002a1[_0xf24c('0x2d')]!=='VIRTUAL'){var _0x30a394={};_0x30a394[_0x5002a1[_0xf24c('0x32')]]={'$like':'%'+_0x373882[_0xf24c('0x38')][_0xf24c('0x44')]+'%'};return _0x30a394;}})});}_0x5c8f4a=_[_0xf24c('0x45')]({},_0x5c8f4a,_0x373882[_0xf24c('0x46')]);var _0x2f5566={'where':_0x5c8f4a[_0xf24c('0x41')]};return db[_0xf24c('0x47')][_0xf24c('0x1f')](_0x2f5566)[_0xf24c('0x26')](function(_0xcadea1){_0x493701[_0xf24c('0x1f')]=_0xcadea1;if(_0x373882[_0xf24c('0x38')][_0xf24c('0x48')]){_0x5c8f4a['include']=[{'all':!![]}];}return db['VoiceExtension'][_0xf24c('0x49')](_0x5c8f4a);})[_0xf24c('0x26')](function(_0x5f378d){_0x493701[_0xf24c('0x4a')]=_0x5f378d;return _0x493701;})[_0xf24c('0x26')](respondWithFilteredResult(_0x12fc96,_0x5c8f4a))['catch'](handleError(_0x12fc96,null));};exports[_0xf24c('0x4b')]=function(_0x3f8610,_0x10c3c8){var _0xb40bd={'raw':![],'where':{'id':_0x3f8610[_0xf24c('0x4c')]['id']}},_0x4f3a43={};_0x4f3a43[_0xf24c('0x3a')]=_[_0xf24c('0x4d')](db[_0xf24c('0x47')][_0xf24c('0x35')]);_0x4f3a43[_0xf24c('0x38')]=_[_0xf24c('0x4d')](_0x3f8610[_0xf24c('0x38')]);_0x4f3a43[_0xf24c('0x4e')]=_[_0xf24c('0x39')](_0x4f3a43[_0xf24c('0x3a')],_0x4f3a43[_0xf24c('0x38')]);_0xb40bd[_0xf24c('0x3b')]=_[_0xf24c('0x39')](_0x4f3a43[_0xf24c('0x3a')],qs[_0xf24c('0x3c')](_0x3f8610[_0xf24c('0x38')]['fields']));_0xb40bd[_0xf24c('0x3b')]=_0xb40bd[_0xf24c('0x3b')][_0xf24c('0x3d')]?_0xb40bd[_0xf24c('0x3b')]:_0x4f3a43[_0xf24c('0x3a')];if(_0x3f8610[_0xf24c('0x38')][_0xf24c('0x48')]){_0xb40bd[_0xf24c('0x4f')]=[{'all':!![]}];}_0xb40bd=_[_0xf24c('0x45')]({},_0xb40bd,_0x3f8610[_0xf24c('0x46')]);return db['VoiceExtension'][_0xf24c('0x2e')](_0xb40bd)[_0xf24c('0x26')](handleEntityNotFound(_0x10c3c8,null))['then'](respondWithResult(_0x10c3c8,null))['catch'](handleError(_0x10c3c8,null));};exports[_0xf24c('0x27')]=function(_0x21b4ef,_0x3b24d7){return db[_0xf24c('0x47')][_0xf24c('0x2e')]({'where':{'id':_0x21b4ef[_0xf24c('0x4c')]['id']}})[_0xf24c('0x26')](handleEntityNotFound(_0x3b24d7,null))[_0xf24c('0x26')](removeEntity(_0x3b24d7,null))[_0xf24c('0x50')](handleError(_0x3b24d7,null));};exports['create']=function(_0x28099c,_0x5837d4){if(_0x28099c['body'][_0xf24c('0x2d')]===_0xf24c('0x2a')&&!_[_0xf24c('0x51')](_0x28099c[_0xf24c('0x52')][_0xf24c('0x53')],'_')){_0x28099c[_0xf24c('0x52')][_0xf24c('0x53')]='_'[_0xf24c('0x54')](_0x28099c[_0xf24c('0x52')][_0xf24c('0x53')]);}return db['VoiceExtension']['create'](_0x28099c[_0xf24c('0x52')],{'raw':![]})['then'](function(_0x2b9b2d){var _0x35a63a=_0x28099c[_0xf24c('0x55')][_0xf24c('0x28')]({'plain':!![]});if(!_0x35a63a)throw new Error(_0xf24c('0x56'));if(_0x35a63a[_0xf24c('0x57')]===_0xf24c('0x55')){var _0x2cb927=_0x2b9b2d[_0xf24c('0x28')]({'plain':!![]});var _0x35b71b=[{'name':_0xf24c('0x29'),'value':_0xf24c('0x58')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0xf24c('0x59'),'value':_0xf24c('0x5a')}];var _0x5ae31a=_[_0xf24c('0x2e')](_0x35b71b,[_0xf24c('0x2f'),_0x2cb927[_0xf24c('0x2d')]])[_0xf24c('0x32')];return db[_0xf24c('0x5b')]['find']({'where':{'name':_0x5ae31a,'userProfileId':_0x35a63a[_0xf24c('0x5c')]},'raw':!![]})[_0xf24c('0x26')](function(_0x52081e){if(_0x52081e&&_0x52081e['autoAssociation']===0x0){return db['UserProfileResource'][_0xf24c('0x5d')]({'name':_0x2cb927['name'],'resourceId':_0x2cb927['id'],'type':_0x52081e[_0xf24c('0x32')],'sectionId':_0x52081e['id']},{})[_0xf24c('0x26')](function(){return _0x2b9b2d;});}else{return _0x2b9b2d;}})['catch'](function(_0x4a83bd){logger['error'](_0xf24c('0x5e'),_0x4a83bd);throw _0x4a83bd;});}return _0x2b9b2d;})[_0xf24c('0x26')](respondWithResult(_0x5837d4,0xc9))['catch'](handleError(_0x5837d4,null));};exports[_0xf24c('0x5f')]=function(_0x41edb9,_0x5f40fd){if(_0x41edb9[_0xf24c('0x52')]['id']){delete _0x41edb9[_0xf24c('0x52')]['id'];}return db[_0xf24c('0x47')][_0xf24c('0x2e')]({'where':{'id':_0x41edb9[_0xf24c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5f40fd,null))['then'](function(_0x2be2fe){if(_0x2be2fe){return db[_0xf24c('0x47')]['update'](_[_0xf24c('0x43')](_0x41edb9[_0xf24c('0x52')],[_0xf24c('0x53'),_0xf24c('0x60'),_0xf24c('0x61'),_0xf24c('0x62'),_0xf24c('0x63'),_0xf24c('0x64')]),{'where':{'context':_0x2be2fe[_0xf24c('0x60')],'exten':_0x2be2fe[_0xf24c('0x53')]},'individualHooks':!![]})[_0xf24c('0x26')](function(_0x42d91e){return _0x42d91e;});}return null;})[_0xf24c('0x26')](respondWithStatusCode(_0x5f40fd,null))['catch'](handleError(_0x5f40fd,null));};exports[_0xf24c('0x65')]=function(_0x46bdcf,_0x1cf23e,_0x5f362c){return db[_0xf24c('0x47')][_0xf24c('0x66')]({'where':{'id':_0x46bdcf[_0xf24c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1cf23e,null))[_0xf24c('0x26')](function(_0x504c4b){if(_0x504c4b){return db[_0xf24c('0x67')][_0xf24c('0x68')](function(_0x3f19b9){return db['VoiceExtension'][_0xf24c('0x27')]({'where':{'VoiceExtensionId':_0x46bdcf[_0xf24c('0x4c')]['id']},'transaction':_0x3f19b9})[_0xf24c('0x26')](function(_0x4327ef){var _0x21ffd2=_[_0xf24c('0x2c')](_0x46bdcf[_0xf24c('0x52')],function(_0x486d10){_0x486d10['VoiceExtensionId']=_0x46bdcf[_0xf24c('0x4c')]['id'];return _0x486d10;});return db[_0xf24c('0x47')][_0xf24c('0x69')](_0x21ffd2,{'transaction':_0x3f19b9});});})[_0xf24c('0x26')](function(){return db['VoiceExtension'][_0xf24c('0x6a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x46bdcf[_0xf24c('0x4c')]['id']},'order':_0xf24c('0x6b')});});}})[_0xf24c('0x26')](respondWithResult(_0x1cf23e,null))[_0xf24c('0x50')](handleError(_0x1cf23e,null));}; \ No newline at end of file +var _0xfd3a=['status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','value','includes','type','find','name','UserProfileResource','sendStatus','error','send','VoiceExtension','rawAttributes','key','model','map','query','intersection','attributes','fields','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','filtears','length','includeAll','body','exten','concat','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','outbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','VoiceExtensionId','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','defaults','redis','localhost','./voiceExtension.socket','register'];(function(_0xede44e,_0x2540de){var _0x36367b=function(_0x10bad9){while(--_0x10bad9){_0xede44e['push'](_0xede44e['shift']());}};_0x36367b(++_0x2540de);}(_0xfd3a,0x179));var _0xafd3=function(_0x49a548,_0x59bce0){_0x49a548=_0x49a548-0x0;var _0x385bfb=_0xfd3a[_0x49a548];return _0x385bfb;};'use strict';var pdf=require(_0xafd3('0x0'));var emlformat=require(_0xafd3('0x1'));var rimraf=require(_0xafd3('0x2'));var zipdir=require(_0xafd3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xafd3('0x4'));var BPromise=require(_0xafd3('0x5'));var Mustache=require(_0xafd3('0x6'));var util=require(_0xafd3('0x7'));var path=require(_0xafd3('0x8'));var sox=require('sox');var csv=require(_0xafd3('0x9'));var ejs=require(_0xafd3('0xa'));var fs=require('fs');var _=require(_0xafd3('0xb'));var squel=require(_0xafd3('0xc'));var crypto=require(_0xafd3('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xafd3('0x9'));var querystring=require(_0xafd3('0xe'));var Papa=require('papaparse');var Redis=require(_0xafd3('0xf'));var authService=require(_0xafd3('0x10'));var qs=require(_0xafd3('0x11'));var as=require(_0xafd3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xafd3('0x13'));var utils=require(_0xafd3('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xafd3('0x15'))['db'];config['redis']=_[_0xafd3('0x16')](config[_0xafd3('0x17')],{'host':_0xafd3('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xafd3('0x17')]));require(_0xafd3('0x19'))[_0xafd3('0x1a')](socket);function respondWithStatusCode(_0x14d23d,_0x3bf5fd){_0x3bf5fd=_0x3bf5fd||0xcc;return function(_0x3f48fb){if(_0x3f48fb){return _0x14d23d['sendStatus'](_0x3bf5fd);}return _0x14d23d['status'](_0x3bf5fd)['end']();};}function respondWithResult(_0x6c7be7,_0x13c036){_0x13c036=_0x13c036||0xc8;return function(_0x46c652){if(_0x46c652){return _0x6c7be7[_0xafd3('0x1b')](_0x13c036)[_0xafd3('0x1c')](_0x46c652);}};}function respondWithFilteredResult(_0x3eb646,_0x1c4fc9){return function(_0x4e65e2){if(_0x4e65e2){var _0xb84b4f=_0x4e65e2[_0xafd3('0x1d')],_0x264a5b=_0x1c4fc9['offset'],_0x5d1301=_0x1c4fc9[_0xafd3('0x1e')]+_0x1c4fc9['limit'],_0x34e2d3;if(_0x5d1301>=_0xb84b4f){_0x5d1301=_0xb84b4f;_0x34e2d3=0xc8;}else{_0x34e2d3=0xce;}_0x3eb646[_0xafd3('0x1b')](_0x34e2d3);return _0x3eb646[_0xafd3('0x1f')](_0xafd3('0x20'),_0x264a5b+'-'+_0x5d1301+'/'+_0xb84b4f)[_0xafd3('0x1c')](_0x4e65e2);}return null;};}function patchUpdates(_0xc97b1b){return function(_0x2d62b5){try{jsonpatch[_0xafd3('0x21')](_0x2d62b5,_0xc97b1b,!![]);}catch(_0x221595){return BPromise[_0xafd3('0x22')](_0x221595);}return _0x2d62b5[_0xafd3('0x23')]();};}function saveUpdates(_0x43e8c5,_0x363d77){return function(_0x90c729){if(_0x90c729){return _0x90c729[_0xafd3('0x24')](_0x43e8c5)[_0xafd3('0x25')](function(_0x1384ba){return _0x1384ba;});}return null;};}function removeEntity(_0x248601,_0x62906c){return function(_0x196b67){if(_0x196b67){return _0x196b67[_0xafd3('0x26')]()['then'](function(){var _0x2a38b5=_0x196b67[_0xafd3('0x27')]({'plain':!![]});var _0x3ef0c3=[{'name':_0xafd3('0x28'),'value':_0xafd3('0x29'),'ignore':![]},{'name':_0xafd3('0x2a'),'value':'outbound','ignore':![]},{'name':_0xafd3('0x2b'),'value':_0xafd3('0x2c'),'ignore':![]}];var _0xfa1278=_(_0x3ef0c3)[_0xafd3('0x2d')]('ignore')['map']('value')[_0xafd3('0x2e')]();if(_[_0xafd3('0x2f')](_0xfa1278,_0x2a38b5[_0xafd3('0x30')])){return;}var _0x48aebb=_[_0xafd3('0x31')](_0x3ef0c3,['value',_0x2a38b5['type']])[_0xafd3('0x32')];return db[_0xafd3('0x33')][_0xafd3('0x26')]({'where':{'type':_0x48aebb,'resourceId':_0x2a38b5['id']}})[_0xafd3('0x25')](function(){return _0x196b67;});})[_0xafd3('0x25')](function(){_0x248601['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49408d,_0x200a6a){return function(_0x1a2516){if(!_0x1a2516){_0x49408d[_0xafd3('0x34')](0x194);}return _0x1a2516;};}function handleError(_0x3e5f71,_0x397768){_0x397768=_0x397768||0x1f4;return function(_0x6eae5){logger[_0xafd3('0x35')](_0x6eae5['stack']);if(_0x6eae5[_0xafd3('0x32')]){delete _0x6eae5[_0xafd3('0x32')];}_0x3e5f71[_0xafd3('0x1b')](_0x397768)[_0xafd3('0x36')](_0x6eae5);};}exports['index']=function(_0x58f4e6,_0x12582c){var _0xc54e6f={},_0x12af24={},_0x1d9cbc={'count':0x0,'rows':[]};var _0x482fc6=_['map'](db[_0xafd3('0x37')][_0xafd3('0x38')],function(_0x45c1f2){return{'name':_0x45c1f2['fieldName'],'type':_0x45c1f2['type'][_0xafd3('0x39')]};});_0x12af24[_0xafd3('0x3a')]=_[_0xafd3('0x3b')](_0x482fc6,_0xafd3('0x32'));_0x12af24[_0xafd3('0x3c')]=_['keys'](_0x58f4e6[_0xafd3('0x3c')]);_0x12af24['filters']=_[_0xafd3('0x3d')](_0x12af24[_0xafd3('0x3a')],_0x12af24[_0xafd3('0x3c')]);_0xc54e6f[_0xafd3('0x3e')]=_[_0xafd3('0x3d')](_0x12af24[_0xafd3('0x3a')],qs[_0xafd3('0x3f')](_0x58f4e6[_0xafd3('0x3c')][_0xafd3('0x3f')]));_0xc54e6f[_0xafd3('0x3e')]=_0xc54e6f[_0xafd3('0x3e')]['length']?_0xc54e6f[_0xafd3('0x3e')]:_0x12af24['model'];if(!_0x58f4e6[_0xafd3('0x3c')][_0xafd3('0x40')]('nolimit')){_0xc54e6f['limit']=qs['limit'](_0x58f4e6[_0xafd3('0x3c')]['limit']);_0xc54e6f[_0xafd3('0x1e')]=qs[_0xafd3('0x1e')](_0x58f4e6[_0xafd3('0x3c')][_0xafd3('0x1e')]);}_0xc54e6f['order']=qs[_0xafd3('0x41')](_0x58f4e6['query'][_0xafd3('0x41')]);_0xc54e6f[_0xafd3('0x42')]=qs['filters'](_[_0xafd3('0x43')](_0x58f4e6['query'],_0x12af24['filters']),_0x482fc6);if(_0x58f4e6[_0xafd3('0x3c')][_0xafd3('0x2d')]){_0xc54e6f[_0xafd3('0x42')]=_[_0xafd3('0x44')](_0xc54e6f[_0xafd3('0x42')],{'$or':_['map'](_0x482fc6,function(_0x5317b0){if(_0x5317b0[_0xafd3('0x30')]!==_0xafd3('0x45')){var _0x590756={};_0x590756[_0x5317b0[_0xafd3('0x32')]]={'$like':'%'+_0x58f4e6['query']['filter']+'%'};return _0x590756;}})});}_0xc54e6f=_[_0xafd3('0x44')]({},_0xc54e6f,_0x58f4e6[_0xafd3('0x46')]);var _0x236e55={'where':_0xc54e6f[_0xafd3('0x42')]};return db[_0xafd3('0x37')]['count'](_0x236e55)[_0xafd3('0x25')](function(_0x308c1e){_0x1d9cbc['count']=_0x308c1e;if(_0x58f4e6[_0xafd3('0x3c')]['includeAll']){_0xc54e6f[_0xafd3('0x47')]=[{'all':!![]}];}return db[_0xafd3('0x37')][_0xafd3('0x48')](_0xc54e6f);})[_0xafd3('0x25')](function(_0x2f0719){_0x1d9cbc['rows']=_0x2f0719;return _0x1d9cbc;})[_0xafd3('0x25')](respondWithFilteredResult(_0x12582c,_0xc54e6f))[_0xafd3('0x49')](handleError(_0x12582c,null));};exports[_0xafd3('0x4a')]=function(_0x4698c1,_0x60b342){var _0x23dde7={'raw':![],'where':{'id':_0x4698c1[_0xafd3('0x4b')]['id']}},_0x34c5a7={};_0x34c5a7[_0xafd3('0x3a')]=_[_0xafd3('0x4c')](db[_0xafd3('0x37')][_0xafd3('0x38')]);_0x34c5a7[_0xafd3('0x3c')]=_[_0xafd3('0x4c')](_0x4698c1[_0xafd3('0x3c')]);_0x34c5a7[_0xafd3('0x4d')]=_[_0xafd3('0x3d')](_0x34c5a7[_0xafd3('0x3a')],_0x34c5a7['query']);_0x23dde7[_0xafd3('0x3e')]=_[_0xafd3('0x3d')](_0x34c5a7['model'],qs[_0xafd3('0x3f')](_0x4698c1[_0xafd3('0x3c')][_0xafd3('0x3f')]));_0x23dde7[_0xafd3('0x3e')]=_0x23dde7[_0xafd3('0x3e')][_0xafd3('0x4e')]?_0x23dde7[_0xafd3('0x3e')]:_0x34c5a7['model'];if(_0x4698c1['query'][_0xafd3('0x4f')]){_0x23dde7[_0xafd3('0x47')]=[{'all':!![]}];}_0x23dde7=_['merge']({},_0x23dde7,_0x4698c1[_0xafd3('0x46')]);return db['VoiceExtension']['find'](_0x23dde7)[_0xafd3('0x25')](handleEntityNotFound(_0x60b342,null))[_0xafd3('0x25')](respondWithResult(_0x60b342,null))[_0xafd3('0x49')](handleError(_0x60b342,null));};exports[_0xafd3('0x26')]=function(_0x19ec19,_0x3242c9){return db[_0xafd3('0x37')][_0xafd3('0x31')]({'where':{'id':_0x19ec19[_0xafd3('0x4b')]['id']}})[_0xafd3('0x25')](handleEntityNotFound(_0x3242c9,null))['then'](removeEntity(_0x3242c9,null))['catch'](handleError(_0x3242c9,null));};exports['create']=function(_0x3e30c1,_0x5ef6e5){if(_0x3e30c1[_0xafd3('0x50')][_0xafd3('0x30')]==='outbound'&&!_['startsWith'](_0x3e30c1[_0xafd3('0x50')][_0xafd3('0x51')],'_')){_0x3e30c1[_0xafd3('0x50')][_0xafd3('0x51')]='_'[_0xafd3('0x52')](_0x3e30c1[_0xafd3('0x50')][_0xafd3('0x51')]);}return db[_0xafd3('0x37')][_0xafd3('0x53')](_0x3e30c1[_0xafd3('0x50')],{'raw':![]})[_0xafd3('0x25')](function(_0x504406){var _0x28c195=_0x3e30c1['user'][_0xafd3('0x27')]({'plain':!![]});if(!_0x28c195)throw new Error(_0xafd3('0x54'));if(_0x28c195[_0xafd3('0x55')]==='user'){var _0x39fb94=_0x504406['get']({'plain':!![]});var _0x42a18a=[{'name':_0xafd3('0x28'),'value':_0xafd3('0x29')},{'name':_0xafd3('0x2a'),'value':_0xafd3('0x56')},{'name':_0xafd3('0x2b'),'value':_0xafd3('0x2c')}];var _0x34fbe9=_[_0xafd3('0x31')](_0x42a18a,['value',_0x39fb94[_0xafd3('0x30')]])['name'];return db[_0xafd3('0x57')]['find']({'where':{'name':_0x34fbe9,'userProfileId':_0x28c195[_0xafd3('0x58')]},'raw':!![]})[_0xafd3('0x25')](function(_0x4113c5){if(_0x4113c5&&_0x4113c5[_0xafd3('0x59')]===0x0){return db[_0xafd3('0x33')][_0xafd3('0x53')]({'name':_0x39fb94['name'],'resourceId':_0x39fb94['id'],'type':_0x4113c5[_0xafd3('0x32')],'sectionId':_0x4113c5['id']},{})['then'](function(){return _0x504406;});}else{return _0x504406;}})[_0xafd3('0x49')](function(_0x58419a){logger[_0xafd3('0x35')](_0xafd3('0x5a'),_0x58419a);throw _0x58419a;});}return _0x504406;})[_0xafd3('0x25')](respondWithResult(_0x5ef6e5,0xc9))[_0xafd3('0x49')](handleError(_0x5ef6e5,null));};exports['update']=function(_0xbb35ae,_0x14bdc2){if(_0xbb35ae[_0xafd3('0x50')]['id']){delete _0xbb35ae[_0xafd3('0x50')]['id'];}return db[_0xafd3('0x37')]['find']({'where':{'id':_0xbb35ae['params']['id']}})[_0xafd3('0x25')](handleEntityNotFound(_0x14bdc2,null))[_0xafd3('0x25')](function(_0x4fd190){if(_0x4fd190){return db[_0xafd3('0x37')][_0xafd3('0x24')](_[_0xafd3('0x43')](_0xbb35ae['body'],[_0xafd3('0x51'),_0xafd3('0x5b'),_0xafd3('0x5c'),_0xafd3('0x5d'),_0xafd3('0x5e'),_0xafd3('0x5f')]),{'where':{'context':_0x4fd190['context'],'exten':_0x4fd190[_0xafd3('0x51')]},'individualHooks':!![]})['then'](function(_0x3add08){return _0x3add08;});}return null;})['then'](respondWithStatusCode(_0x14bdc2,null))[_0xafd3('0x49')](handleError(_0x14bdc2,null));};exports[_0xafd3('0x60')]=function(_0x2efca0,_0x2c55f7,_0x3fe836){return db[_0xafd3('0x37')][_0xafd3('0x61')]({'where':{'id':_0x2efca0['params']['id']}})[_0xafd3('0x25')](handleEntityNotFound(_0x2c55f7,null))['then'](function(_0x3fe737){if(_0x3fe737){return db[_0xafd3('0x62')]['transaction'](function(_0xc949ec){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x2efca0[_0xafd3('0x4b')]['id']},'transaction':_0xc949ec})[_0xafd3('0x25')](function(_0x365e76){var _0xdf11fd=_[_0xafd3('0x3b')](_0x2efca0[_0xafd3('0x50')],function(_0x4a8c43){_0x4a8c43[_0xafd3('0x63')]=_0x2efca0[_0xafd3('0x4b')]['id'];return _0x4a8c43;});return db[_0xafd3('0x37')][_0xafd3('0x64')](_0xdf11fd,{'transaction':_0xc949ec});});})[_0xafd3('0x25')](function(){return db[_0xafd3('0x37')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x2efca0[_0xafd3('0x4b')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0xafd3('0x25')](respondWithResult(_0x2c55f7,null))[_0xafd3('0x49')](handleError(_0x2c55f7,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 3dbb5ef..e9ca12f 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 _0x62c9=['emit','hasOwnProperty','exports','../../mysqldb','VoiceExtension','setMaxListeners','save','remove'];(function(_0x2544eb,_0x2804f3){var _0x4484d0=function(_0x114d81){while(--_0x114d81){_0x2544eb['push'](_0x2544eb['shift']());}};_0x4484d0(++_0x2804f3);}(_0x62c9,0x133));var _0x962c=function(_0x4ceade,_0x59ad5b){_0x4ceade=_0x4ceade-0x0;var _0x50bda6=_0x62c9[_0x4ceade];return _0x50bda6;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x962c('0x0'))['db'][_0x962c('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x962c('0x2')](0x0);var events={'afterCreate':_0x962c('0x3'),'afterUpdate':'update','afterDestroy':_0x962c('0x4')};function emitEvent(_0xa74d69){return function(_0x229148,_0x31a83e,_0x111521){VoiceExtensionEvents['emit'](_0xa74d69+':'+_0x229148['id'],_0x229148);VoiceExtensionEvents[_0x962c('0x5')](_0xa74d69,_0x229148);_0x111521(null);};}for(var e in events){if(events[_0x962c('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x962c('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x7276=['../../mysqldb','VoiceExtension','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x3c6c1b,_0x82a1e4){var _0x15170e=function(_0x388a43){while(--_0x388a43){_0x3c6c1b['push'](_0x3c6c1b['shift']());}};_0x15170e(++_0x82a1e4);}(_0x7276,0xfb));var _0x6727=function(_0x2c503c,_0xd88a2a){_0x2c503c=_0x2c503c-0x0;var _0x39dce7=_0x7276[_0x2c503c];return _0x39dce7;};'use strict';var EventEmitter=require(_0x6727('0x0'));var VoiceExtension=require(_0x6727('0x1'))['db'][_0x6727('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x6727('0x3')](0x0);var events={'afterCreate':_0x6727('0x4'),'afterUpdate':_0x6727('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2603b2){return function(_0x31b091,_0x2b6af0,_0x1b26ad){VoiceExtensionEvents[_0x6727('0x6')](_0x2603b2+':'+_0x31b091['id'],_0x31b091);VoiceExtensionEvents['emit'](_0x2603b2,_0x31b091);_0x1b26ad(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x6727('0x7')](e,emitEvent(event));}}module[_0x6727('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index fb4c805..8a17302 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 _0x532d=['../../config/environment','exports','define','VoiceExtension','voice_extensions','lodash','util','api','moment','path','rimraf'];(function(_0x56a351,_0x48912f){var _0x1f3faa=function(_0x4d9399){while(--_0x4d9399){_0x56a351['push'](_0x56a351['shift']());}};_0x1f3faa(++_0x48912f);}(_0x532d,0x14f));var _0xd532=function(_0x168127,_0x59cea1){_0x168127=_0x168127-0x0;var _0x4c99ad=_0x532d[_0x168127];return _0x4c99ad;};'use strict';var _=require(_0xd532('0x0'));var util=require(_0xd532('0x1'));var logger=require('../../config/logger')(_0xd532('0x2'));var moment=require(_0xd532('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd532('0x4'));var rimraf=require(_0xd532('0x5'));var config=require(_0xd532('0x6'));var attributes=require('./voiceExtension.attributes');module[_0xd532('0x7')]=function(_0x435097,_0x48c41a){return _0x435097[_0xd532('0x8')](_0xd532('0x9'),attributes,{'tableName':_0xd532('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4680=['moment','bluebird','request-promise','path','rimraf','./voiceExtension.attributes','exports','define','VoiceExtension','voice_extensions','../../config/logger','api'];(function(_0x24b9b3,_0x266ebb){var _0xaad9b8=function(_0x4cb492){while(--_0x4cb492){_0x24b9b3['push'](_0x24b9b3['shift']());}};_0xaad9b8(++_0x266ebb);}(_0x4680,0xd6));var _0x0468=function(_0x4ac134,_0x33bfc4){_0x4ac134=_0x4ac134-0x0;var _0x469ac6=_0x4680[_0x4ac134];return _0x469ac6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0468('0x0'))(_0x0468('0x1'));var moment=require(_0x0468('0x2'));var BPromise=require(_0x0468('0x3'));var rp=require(_0x0468('0x4'));var fs=require('fs');var path=require(_0x0468('0x5'));var rimraf=require(_0x0468('0x6'));var config=require('../../config/environment');var attributes=require(_0x0468('0x7'));module[_0x0468('0x8')]=function(_0x55f2a2,_0x17774a){return _0x55f2a2[_0x0468('0x9')](_0x0468('0xa'),attributes,{'tableName':_0x0468('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 15a8b3d..666620b 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 _0x1192=['localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','VoiceExtension','findAll','options','limit','include','map','model','attributes','GetVoiceExtension','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults'];(function(_0x32aa4c,_0x2a0627){var _0x41d40c=function(_0x7a4f3d){while(--_0x7a4f3d){_0x32aa4c['push'](_0x32aa4c['shift']());}};_0x41d40c(++_0x2a0627);}(_0x1192,0x1c6));var _0x2119=function(_0x1faa61,_0x1bd7e2){_0x1faa61=_0x1faa61-0x0;var _0x3f0e58=_0x1192[_0x1faa61];return _0x3f0e58;};'use strict';var _=require(_0x2119('0x0'));var util=require(_0x2119('0x1'));var moment=require(_0x2119('0x2'));var BPromise=require(_0x2119('0x3'));var rs=require(_0x2119('0x4'));var fs=require('fs');var Redis=require(_0x2119('0x5'));var db=require(_0x2119('0x6'))['db'];var utils=require(_0x2119('0x7'));var logger=require(_0x2119('0x8'))('rpc');var config=require(_0x2119('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2119('0xa')][_0x2119('0xb')]({'port':0x232a});config[_0x2119('0xc')]=_[_0x2119('0xd')](config[_0x2119('0xc')],{'host':_0x2119('0xe'),'port':0x18eb});var socket=require(_0x2119('0xf'))(new Redis(config[_0x2119('0xc')]));require(_0x2119('0x10'))[_0x2119('0x11')](socket);function respondWithRpcPromise(_0x5d10b2,_0x5c5650,_0x296631){return new BPromise(function(_0x423569,_0x5a5c17){return client[_0x2119('0x12')](_0x5d10b2,_0x296631)[_0x2119('0x13')](function(_0x48ed90){logger[_0x2119('0x14')](_0x2119('0x15'),_0x5c5650,_0x2119('0x16'));logger[_0x2119('0x17')](_0x2119('0x18'),_0x5c5650,_0x2119('0x16'),JSON['stringify'](_0x48ed90));if(_0x48ed90[_0x2119('0x19')]){if(_0x48ed90[_0x2119('0x19')][_0x2119('0x1a')]===0x1f4){logger['error'](_0x2119('0x15'),_0x5c5650,_0x48ed90[_0x2119('0x19')][_0x2119('0x1b')]);return _0x5a5c17(_0x48ed90[_0x2119('0x19')]['message']);}logger[_0x2119('0x19')](_0x2119('0x15'),_0x5c5650,_0x48ed90[_0x2119('0x19')][_0x2119('0x1b')]);return _0x423569(_0x48ed90['error'][_0x2119('0x1b')]);}else{logger[_0x2119('0x14')](_0x2119('0x15'),_0x5c5650,_0x2119('0x16'));_0x423569(_0x48ed90['result'][_0x2119('0x1b')]);}})['catch'](function(_0x2b518a){logger[_0x2119('0x19')]('VoiceExtension,\x20%s,\x20%s',_0x5c5650,_0x2b518a);_0x5a5c17(_0x2b518a);});});}exports['GetVoiceExtension']=function(_0x9133c8){var _0x639b49=this;return new Promise(function(_0x1e1a71,_0x12dcf0){return db[_0x2119('0x1c')][_0x2119('0x1d')]({'raw':_0x9133c8[_0x2119('0x1e')]?_0x9133c8[_0x2119('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x9133c8[_0x2119('0x1e')]?_0x9133c8[_0x2119('0x1e')]['where']||null:null,'attributes':_0x9133c8['options']?_0x9133c8['options']['attributes']||null:null,'limit':_0x9133c8[_0x2119('0x1e')]?_0x9133c8[_0x2119('0x1e')][_0x2119('0x1f')]||null:null,'include':_0x9133c8[_0x2119('0x1e')]?_0x9133c8['options'][_0x2119('0x20')]?_[_0x2119('0x21')](_0x9133c8[_0x2119('0x1e')][_0x2119('0x20')],function(_0x5032ee){return{'model':db[_0x5032ee[_0x2119('0x22')]],'as':_0x5032ee['as'],'attributes':_0x5032ee[_0x2119('0x23')],'include':_0x5032ee['include']?_['map'](_0x5032ee['include'],function(_0x401d02){return{'model':db[_0x401d02[_0x2119('0x22')]],'as':_0x401d02['as'],'attributes':_0x401d02[_0x2119('0x23')],'include':_0x401d02[_0x2119('0x20')]?_[_0x2119('0x21')](_0x401d02[_0x2119('0x20')],function(_0x451631){return{'model':db[_0x451631[_0x2119('0x22')]],'as':_0x451631['as'],'attributes':_0x451631[_0x2119('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2119('0x13')](function(_0x122f72){logger['info']('GetVoiceExtension',_0x9133c8);logger[_0x2119('0x17')](_0x2119('0x24'),_0x9133c8,JSON[_0x2119('0x25')](_0x122f72));_0x1e1a71(_0x122f72);})[_0x2119('0x26')](function(_0x4559dd){logger[_0x2119('0x19')](_0x2119('0x24'),_0x4559dd[_0x2119('0x1b')],_0x9133c8);_0x12dcf0(_0x639b49['error'](0x1f4,_0x4559dd[_0x2119('0x1b')]));});});}; \ No newline at end of file +var _0xc757=['request\x20sent','debug','stringify','error','message','catch','options','raw','where','attributes','limit','include','map','model','GetVoiceExtension','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s'];(function(_0xa7b38f,_0x4ffe2f){var _0x44f2cd=function(_0xe00e63){while(--_0xe00e63){_0xa7b38f['push'](_0xa7b38f['shift']());}};_0x44f2cd(++_0x4ffe2f);}(_0xc757,0xc3));var _0x7c75=function(_0x1a209a,_0x40b886){_0x1a209a=_0x1a209a-0x0;var _0x1327e1=_0xc757[_0x1a209a];return _0x1327e1;};'use strict';var _=require('lodash');var util=require(_0x7c75('0x0'));var moment=require(_0x7c75('0x1'));var BPromise=require(_0x7c75('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c75('0x3'));var db=require(_0x7c75('0x4'))['db'];var utils=require(_0x7c75('0x5'));var logger=require(_0x7c75('0x6'))(_0x7c75('0x7'));var config=require(_0x7c75('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7c75('0x9')][_0x7c75('0xa')]({'port':0x232a});config[_0x7c75('0xb')]=_[_0x7c75('0xc')](config[_0x7c75('0xb')],{'host':_0x7c75('0xd'),'port':0x18eb});var socket=require(_0x7c75('0xe'))(new Redis(config['redis']));require(_0x7c75('0xf'))[_0x7c75('0x10')](socket);function respondWithRpcPromise(_0x5836ee,_0x52ccbe,_0x4fb4fb){return new BPromise(function(_0xce6230,_0x3cdfc0){return client[_0x7c75('0x11')](_0x5836ee,_0x4fb4fb)[_0x7c75('0x12')](function(_0x2ca33b){logger[_0x7c75('0x13')](_0x7c75('0x14'),_0x52ccbe,_0x7c75('0x15'));logger[_0x7c75('0x16')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x52ccbe,'request\x20sent',JSON[_0x7c75('0x17')](_0x2ca33b));if(_0x2ca33b[_0x7c75('0x18')]){if(_0x2ca33b[_0x7c75('0x18')]['code']===0x1f4){logger[_0x7c75('0x18')](_0x7c75('0x14'),_0x52ccbe,_0x2ca33b[_0x7c75('0x18')][_0x7c75('0x19')]);return _0x3cdfc0(_0x2ca33b[_0x7c75('0x18')][_0x7c75('0x19')]);}logger[_0x7c75('0x18')](_0x7c75('0x14'),_0x52ccbe,_0x2ca33b['error'][_0x7c75('0x19')]);return _0xce6230(_0x2ca33b[_0x7c75('0x18')][_0x7c75('0x19')]);}else{logger['info'](_0x7c75('0x14'),_0x52ccbe,_0x7c75('0x15'));_0xce6230(_0x2ca33b['result']['message']);}})[_0x7c75('0x1a')](function(_0x2e4134){logger[_0x7c75('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x52ccbe,_0x2e4134);_0x3cdfc0(_0x2e4134);});});}exports['GetVoiceExtension']=function(_0x1fb94f){var _0x1c34b0=this;return new Promise(function(_0x10cdc4,_0x4abf45){return db['VoiceExtension']['findAll']({'raw':_0x1fb94f[_0x7c75('0x1b')]?_0x1fb94f[_0x7c75('0x1b')][_0x7c75('0x1c')]===undefined?!![]:![]:!![],'where':_0x1fb94f[_0x7c75('0x1b')]?_0x1fb94f[_0x7c75('0x1b')][_0x7c75('0x1d')]||null:null,'attributes':_0x1fb94f[_0x7c75('0x1b')]?_0x1fb94f[_0x7c75('0x1b')][_0x7c75('0x1e')]||null:null,'limit':_0x1fb94f[_0x7c75('0x1b')]?_0x1fb94f['options'][_0x7c75('0x1f')]||null:null,'include':_0x1fb94f[_0x7c75('0x1b')]?_0x1fb94f[_0x7c75('0x1b')][_0x7c75('0x20')]?_[_0x7c75('0x21')](_0x1fb94f[_0x7c75('0x1b')][_0x7c75('0x20')],function(_0x4ded20){return{'model':db[_0x4ded20[_0x7c75('0x22')]],'as':_0x4ded20['as'],'attributes':_0x4ded20[_0x7c75('0x1e')],'include':_0x4ded20[_0x7c75('0x20')]?_[_0x7c75('0x21')](_0x4ded20[_0x7c75('0x20')],function(_0xb64464){return{'model':db[_0xb64464[_0x7c75('0x22')]],'as':_0xb64464['as'],'attributes':_0xb64464[_0x7c75('0x1e')],'include':_0xb64464[_0x7c75('0x20')]?_['map'](_0xb64464['include'],function(_0x29fe5b){return{'model':db[_0x29fe5b[_0x7c75('0x22')]],'as':_0x29fe5b['as'],'attributes':_0x29fe5b[_0x7c75('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7c75('0x12')](function(_0x55fa7c){logger[_0x7c75('0x13')](_0x7c75('0x23'),_0x1fb94f);logger[_0x7c75('0x16')](_0x7c75('0x23'),_0x1fb94f,JSON[_0x7c75('0x17')](_0x55fa7c));_0x10cdc4(_0x55fa7c);})[_0x7c75('0x1a')](function(_0x1c3002){logger[_0x7c75('0x18')]('GetVoiceExtension',_0x1c3002[_0x7c75('0x19')],_0x1fb94f);_0x4abf45(_0x1c34b0[_0x7c75('0x18')](0x1f4,_0x1c3002[_0x7c75('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index ac3bbcd..59dbc5a 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 _0x4faa=['update','removeListener','register','length','./voiceExtension.events','remove'];(function(_0x136a8e,_0x2c4696){var _0x35a885=function(_0x37406c){while(--_0x37406c){_0x136a8e['push'](_0x136a8e['shift']());}};_0x35a885(++_0x2c4696);}(_0x4faa,0x76));var _0xa4fa=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x4faa[_0x3635ce];return _0x97ecd0;};'use strict';var VoiceExtensionEvents=require(_0xa4fa('0x0'));var events=['save',_0xa4fa('0x1'),_0xa4fa('0x2')];function createListener(_0x55d1a3,_0x270a94){return function(_0x592dcf){_0x270a94['emit'](_0x55d1a3,_0x592dcf);};}function removeListener(_0x1b30e8,_0x2983cb){return function(){VoiceExtensionEvents[_0xa4fa('0x3')](_0x1b30e8,_0x2983cb);};}exports[_0xa4fa('0x4')]=function(_0x5aa7ac){for(var _0x42caeb=0x0,_0x2c40a8=events[_0xa4fa('0x5')];_0x42caeb<_0x2c40a8;_0x42caeb++){var _0x461148=events[_0x42caeb];var _0x103a07=createListener('voiceExtension:'+_0x461148,_0x5aa7ac);VoiceExtensionEvents['on'](_0x461148,_0x103a07);}}; \ No newline at end of file +var _0x2c1f=['voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener','register','length'];(function(_0x40f355,_0x27fac0){var _0x1ebb62=function(_0x5e94f4){while(--_0x5e94f4){_0x40f355['push'](_0x40f355['shift']());}};_0x1ebb62(++_0x27fac0);}(_0x2c1f,0x184));var _0xf2c1=function(_0x30977a,_0x8a06c2){_0x30977a=_0x30977a-0x0;var _0x8c5525=_0x2c1f[_0x30977a];return _0x8c5525;};'use strict';var VoiceExtensionEvents=require(_0xf2c1('0x0'));var events=[_0xf2c1('0x1'),_0xf2c1('0x2'),_0xf2c1('0x3')];function createListener(_0x4a683a,_0xc87f82){return function(_0x419509){_0xc87f82[_0xf2c1('0x4')](_0x4a683a,_0x419509);};}function removeListener(_0x2229e1,_0xdcca41){return function(){VoiceExtensionEvents[_0xf2c1('0x5')](_0x2229e1,_0xdcca41);};}exports[_0xf2c1('0x6')]=function(_0x4036b9){for(var _0x22fab1=0x0,_0x143065=events[_0xf2c1('0x7')];_0x22fab1<_0x143065;_0x22fab1++){var _0x2c6e1a=events[_0x22fab1];var _0x40182f=createListener(_0xf2c1('0x8')+_0x2c6e1a,_0x4036b9);VoiceExtensionEvents['on'](_0x2c6e1a,_0x40182f);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 262ddf3..b3b95e0 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 _0xd590=['post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','./voiceMail.controller','get','isAuthenticated','index','show','/:id/messages','getMessages'];(function(_0x55f5ce,_0x2d3342){var _0x51f4c8=function(_0x53abe3){while(--_0x53abe3){_0x55f5ce['push'](_0x55f5ce['shift']());}};_0x51f4c8(++_0x2d3342);}(_0xd590,0x8c));var _0x0d59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd590[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0d59('0x0'));var util=require('util');var path=require(_0x0d59('0x1'));var timeout=require(_0x0d59('0x2'));var express=require(_0x0d59('0x3'));var router=express[_0x0d59('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0d59('0x5'));router[_0x0d59('0x6')]('/',auth[_0x0d59('0x7')](),controller[_0x0d59('0x8')]);router[_0x0d59('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x0d59('0x9')]);router[_0x0d59('0x6')](_0x0d59('0xa'),auth[_0x0d59('0x7')](),controller[_0x0d59('0xb')]);router[_0x0d59('0xc')]('/',auth[_0x0d59('0x7')](),controller['create']);router[_0x0d59('0xd')](_0x0d59('0xe'),auth[_0x0d59('0x7')](),controller[_0x0d59('0xf')]);router[_0x0d59('0x10')](_0x0d59('0xe'),auth[_0x0d59('0x7')](),controller[_0x0d59('0x11')]);module[_0x0d59('0x12')]=router; \ No newline at end of file +var _0x1442=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','show','/:id/messages','getMessages','post','create','/:id','update','destroy','exports','multer','util'];(function(_0x28a9ac,_0x27cfae){var _0x238ca0=function(_0x243b1e){while(--_0x243b1e){_0x28a9ac['push'](_0x28a9ac['shift']());}};_0x238ca0(++_0x27cfae);}(_0x1442,0x116));var _0x2144=function(_0x87ae7e,_0x3af8e6){_0x87ae7e=_0x87ae7e-0x0;var _0x590c0c=_0x1442[_0x87ae7e];return _0x590c0c;};'use strict';var multer=require(_0x2144('0x0'));var util=require(_0x2144('0x1'));var path=require(_0x2144('0x2'));var timeout=require(_0x2144('0x3'));var express=require(_0x2144('0x4'));var router=express[_0x2144('0x5')]();var auth=require(_0x2144('0x6'));var interaction=require(_0x2144('0x7'));var config=require('../../config/environment');var controller=require(_0x2144('0x8'));router[_0x2144('0x9')]('/',auth[_0x2144('0xa')](),controller['index']);router['get']('/:id',auth[_0x2144('0xa')](),controller[_0x2144('0xb')]);router[_0x2144('0x9')](_0x2144('0xc'),auth['isAuthenticated'](),controller[_0x2144('0xd')]);router[_0x2144('0xe')]('/',auth['isAuthenticated'](),controller[_0x2144('0xf')]);router['put'](_0x2144('0x10'),auth[_0x2144('0xa')](),controller[_0x2144('0x11')]);router['delete']('/:id',auth[_0x2144('0xa')](),controller[_0x2144('0x12')]);module[_0x2144('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index f89a7a6..4e813e7 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 _0xb58b=['mailbox','exports','STRING','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue'];(function(_0x1a16f4,_0x433a8f){var _0x3ebad0=function(_0x1db8b4){while(--_0x1db8b4){_0x1a16f4['push'](_0x1a16f4['shift']());}};_0x3ebad0(++_0x433a8f);}(_0xb58b,0x1f1));var _0xbb58=function(_0x52d494,_0x59fd91){_0x52d494=_0x52d494-0x0;var _0x4d189c=_0xb58b[_0x52d494];return _0x4d189c;};'use strict';var Sequelize=require('sequelize');module[_0xbb58('0x0')]={'customer_id':{'type':Sequelize[_0xbb58('0x1')]},'context':{'type':Sequelize[_0xbb58('0x1')],'defaultValue':'from-voicemail','unique':_0xbb58('0x2')},'mailbox':{'type':Sequelize[_0xbb58('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xbb58('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xbb58('0x1')],'validate':{'isEmail':!![]},'set':function(_0x367b4f){this[_0xbb58('0x3')]('email',typeof _0x367b4f===_0xbb58('0x4')&&_0x367b4f[_0xbb58('0x5')]()?_0x367b4f[_0xbb58('0x5')]():null);}},'pager':{'type':Sequelize[_0xbb58('0x1')]},'tz':{'type':Sequelize[_0xbb58('0x1')],'defaultValue':_0xbb58('0x6')},'attach':{'type':Sequelize[_0xbb58('0x7')](_0xbb58('0x8'),'no'),'defaultValue':_0xbb58('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0xbb58('0x7')](_0xbb58('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xbb58('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xbb58('0x7')](_0xbb58('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xbb58('0x7')](_0xbb58('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xbb58('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xbb58('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xbb58('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xbb58('0x7')](_0xbb58('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xbb58('0x7')](_0xbb58('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xbb58('0x8'),'no'),'defaultValue':_0xbb58('0x8'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xbb58('0x7')](_0xbb58('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xbb58('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xbb58('0x1')]},'maxsecs':{'type':Sequelize[_0xbb58('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xbb58('0xb')],'get':function(){return this['getDataValue'](_0xbb58('0xc'))+_0xbb58('0xd')+this[_0xbb58('0xe')](_0xbb58('0xf'));}}}; \ No newline at end of file +var _0xdd4f=['string','trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','from-voicemail','contest_mailbox','STRING','setDataValue','email'];(function(_0x23550e,_0xac7a39){var _0x52eefc=function(_0x26c81e){while(--_0x26c81e){_0x23550e['push'](_0x23550e['shift']());}};_0x52eefc(++_0xac7a39);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x2dfdf7,_0x193643){_0x2dfdf7=_0x2dfdf7-0x0;var _0xe8320a=_0xdd4f[_0x2dfdf7];return _0xe8320a;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0xfdd4('0x1'),'unique':_0xfdd4('0x2')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xfdd4('0x2')},'password':{'type':Sequelize[_0xfdd4('0x3')]},'fullname':{'type':Sequelize[_0xfdd4('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x398015){this[_0xfdd4('0x4')](_0xfdd4('0x5'),typeof _0x398015===_0xfdd4('0x6')&&_0x398015[_0xfdd4('0x7')]()?_0x398015['trim']():null);}},'pager':{'type':Sequelize[_0xfdd4('0x3')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xfdd4('0x8')},'attach':{'type':Sequelize[_0xfdd4('0x9')](_0xfdd4('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xfdd4('0x9')]('yes','no'),'defaultValue':_0xfdd4('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xfdd4('0x3')]},'callback':{'type':Sequelize[_0xfdd4('0x3')]},'review':{'type':Sequelize[_0xfdd4('0x9')](_0xfdd4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xfdd4('0x9')](_0xfdd4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xfdd4('0x9')](_0xfdd4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xfdd4('0x9')](_0xfdd4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xfdd4('0x9')](_0xfdd4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xfdd4('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xfdd4('0x9')]('yes','no'),'defaultValue':_0xfdd4('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xfdd4('0x9')](_0xfdd4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xfdd4('0x9')](_0xfdd4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xfdd4('0xb')},'emailsubject':{'type':Sequelize[_0xfdd4('0x3')]},'emailbody':{'type':Sequelize[_0xfdd4('0x3')]},'maxsecs':{'type':Sequelize[_0xfdd4('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xfdd4('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xfdd4('0xd')],'get':function(){return this[_0xfdd4('0xe')](_0xfdd4('0xf'))+_0xfdd4('0x10')+this['getDataValue'](_0xfdd4('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 4a3cf7a..c263975 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 _0x7958=['key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','then','rows','params','filtears','find','catch','create','user','UserProfileSection','body','VoiceMailMessage','mailbox','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','Voicemails','UserProfileResource','error','name','send','index','VoiceMail','rawAttributes','fieldName'];(function(_0x340838,_0x58c9ac){var _0x1006da=function(_0x4483ad){while(--_0x4483ad){_0x340838['push'](_0x340838['shift']());}};_0x1006da(++_0x58c9ac);}(_0x7958,0x126));var _0x8795=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7958[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x8795('0x0'));var emlformat=require(_0x8795('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8795('0x2'));var jsonpatch=require(_0x8795('0x3'));var rp=require(_0x8795('0x4'));var moment=require(_0x8795('0x5'));var BPromise=require(_0x8795('0x6'));var Mustache=require(_0x8795('0x7'));var util=require(_0x8795('0x8'));var path=require(_0x8795('0x9'));var sox=require('sox');var csv=require(_0x8795('0xa'));var ejs=require(_0x8795('0xb'));var fs=require('fs');var _=require(_0x8795('0xc'));var squel=require('squel');var crypto=require(_0x8795('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8795('0xe'));var toCsv=require(_0x8795('0xa'));var querystring=require(_0x8795('0xf'));var Papa=require(_0x8795('0x10'));var Redis=require(_0x8795('0x11'));var authService=require(_0x8795('0x12'));var qs=require(_0x8795('0x13'));var as=require(_0x8795('0x14'));var hardwareService=require(_0x8795('0x15'));var logger=require(_0x8795('0x16'))(_0x8795('0x17'));var utils=require(_0x8795('0x18'));var config=require(_0x8795('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8795('0x1a'))['db'];function respondWithStatusCode(_0x36b9bd,_0x30d51c){_0x30d51c=_0x30d51c||0xcc;return function(_0x4d7f72){if(_0x4d7f72){return _0x36b9bd[_0x8795('0x1b')](_0x30d51c);}return _0x36b9bd[_0x8795('0x1c')](_0x30d51c)[_0x8795('0x1d')]();};}function respondWithResult(_0x57dbb1,_0x532ffd){_0x532ffd=_0x532ffd||0xc8;return function(_0x595064){if(_0x595064){return _0x57dbb1[_0x8795('0x1c')](_0x532ffd)[_0x8795('0x1e')](_0x595064);}};}function respondWithFilteredResult(_0x396670,_0x2299f0){return function(_0x44d96e){if(_0x44d96e){var _0x2027c1=_0x44d96e['count'],_0x3f835f=_0x2299f0[_0x8795('0x1f')],_0x5017fc=_0x2299f0[_0x8795('0x1f')]+_0x2299f0[_0x8795('0x20')],_0x15f1db;if(_0x5017fc>=_0x2027c1){_0x5017fc=_0x2027c1;_0x15f1db=0xc8;}else{_0x15f1db=0xce;}_0x396670[_0x8795('0x1c')](_0x15f1db);return _0x396670[_0x8795('0x21')](_0x8795('0x22'),_0x3f835f+'-'+_0x5017fc+'/'+_0x2027c1)[_0x8795('0x1e')](_0x44d96e);}return null;};}function patchUpdates(_0x5ef45e){return function(_0x1aae20){try{jsonpatch[_0x8795('0x23')](_0x1aae20,_0x5ef45e,!![]);}catch(_0x4a65f0){return BPromise[_0x8795('0x24')](_0x4a65f0);}return _0x1aae20[_0x8795('0x25')]();};}function saveUpdates(_0x458787,_0x1e8f08){return function(_0x4f5ae8){if(_0x4f5ae8){return _0x4f5ae8[_0x8795('0x26')](_0x458787)['then'](function(_0x4e10a3){return _0x4e10a3;});}return null;};}function removeEntity(_0x145b05,_0x5cecec){return function(_0x396f97){if(_0x396f97){return _0x396f97[_0x8795('0x27')]()['then'](function(){var _0x2d5097=_0x396f97[_0x8795('0x28')]({'plain':!![]});var _0xb1becd=_0x8795('0x29');return db[_0x8795('0x2a')][_0x8795('0x27')]({'where':{'type':_0xb1becd,'resourceId':_0x2d5097['id']}})['then'](function(){return _0x396f97;});})['then'](function(){_0x145b05[_0x8795('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ed14c,_0x389c38){return function(_0x14f40e){if(!_0x14f40e){_0x3ed14c[_0x8795('0x1b')](0x194);}return _0x14f40e;};}function handleError(_0x26365b,_0x5f4441){_0x5f4441=_0x5f4441||0x1f4;return function(_0x8dc441){logger[_0x8795('0x2b')](_0x8dc441['stack']);if(_0x8dc441[_0x8795('0x2c')]){delete _0x8dc441[_0x8795('0x2c')];}_0x26365b[_0x8795('0x1c')](_0x5f4441)[_0x8795('0x2d')](_0x8dc441);};}exports[_0x8795('0x2e')]=function(_0x2bbf58,_0x41428b){var _0x2c7d1f={},_0x1fb080={},_0x29891b={'count':0x0,'rows':[]};var _0x1095a7=_['map'](db[_0x8795('0x2f')][_0x8795('0x30')],function(_0x3aab08){return{'name':_0x3aab08[_0x8795('0x31')],'type':_0x3aab08['type'][_0x8795('0x32')]};});_0x1fb080[_0x8795('0x33')]=_[_0x8795('0x34')](_0x1095a7,_0x8795('0x2c'));_0x1fb080[_0x8795('0x35')]=_[_0x8795('0x36')](_0x2bbf58[_0x8795('0x35')]);_0x1fb080[_0x8795('0x37')]=_['intersection'](_0x1fb080['model'],_0x1fb080[_0x8795('0x35')]);_0x2c7d1f[_0x8795('0x38')]=_[_0x8795('0x39')](_0x1fb080[_0x8795('0x33')],qs['fields'](_0x2bbf58[_0x8795('0x35')][_0x8795('0x3a')]));_0x2c7d1f[_0x8795('0x38')]=_0x2c7d1f[_0x8795('0x38')][_0x8795('0x3b')]?_0x2c7d1f[_0x8795('0x38')]:_0x1fb080[_0x8795('0x33')];if(!_0x2bbf58[_0x8795('0x35')][_0x8795('0x3c')](_0x8795('0x3d'))){_0x2c7d1f[_0x8795('0x20')]=qs[_0x8795('0x20')](_0x2bbf58[_0x8795('0x35')][_0x8795('0x20')]);_0x2c7d1f[_0x8795('0x1f')]=qs[_0x8795('0x1f')](_0x2bbf58[_0x8795('0x35')][_0x8795('0x1f')]);}_0x2c7d1f[_0x8795('0x3e')]=qs[_0x8795('0x3f')](_0x2bbf58[_0x8795('0x35')][_0x8795('0x3f')]);_0x2c7d1f[_0x8795('0x40')]=qs[_0x8795('0x37')](_[_0x8795('0x41')](_0x2bbf58[_0x8795('0x35')],_0x1fb080['filters']),_0x1095a7);if(_0x2bbf58['query'][_0x8795('0x42')]){_0x2c7d1f[_0x8795('0x40')]=_[_0x8795('0x43')](_0x2c7d1f[_0x8795('0x40')],{'$or':_['map'](_0x1095a7,function(_0x182878){if(_0x182878['type']!==_0x8795('0x44')){var _0x33359e={};_0x33359e[_0x182878['name']]={'$like':'%'+_0x2bbf58[_0x8795('0x35')]['filter']+'%'};return _0x33359e;}})});}_0x2c7d1f=_[_0x8795('0x43')]({},_0x2c7d1f,_0x2bbf58[_0x8795('0x45')]);var _0x51ec64={'where':_0x2c7d1f['where']};return db['VoiceMail'][_0x8795('0x46')](_0x51ec64)['then'](function(_0x4e4377){_0x29891b[_0x8795('0x46')]=_0x4e4377;if(_0x2bbf58[_0x8795('0x35')][_0x8795('0x47')]){_0x2c7d1f[_0x8795('0x48')]=[{'all':!![]}];}return db[_0x8795('0x2f')][_0x8795('0x49')](_0x2c7d1f);})[_0x8795('0x4a')](function(_0x4847aa){_0x29891b[_0x8795('0x4b')]=_0x4847aa;return _0x29891b;})['then'](respondWithFilteredResult(_0x41428b,_0x2c7d1f))['catch'](handleError(_0x41428b,null));};exports['show']=function(_0x7c4a5,_0x39475b){var _0x316902={'raw':!![],'where':{'id':_0x7c4a5[_0x8795('0x4c')]['id']}},_0x1d03c2={};_0x1d03c2[_0x8795('0x33')]=_[_0x8795('0x36')](db[_0x8795('0x2f')]['rawAttributes']);_0x1d03c2[_0x8795('0x35')]=_['keys'](_0x7c4a5[_0x8795('0x35')]);_0x1d03c2[_0x8795('0x4d')]=_['intersection'](_0x1d03c2[_0x8795('0x33')],_0x1d03c2[_0x8795('0x35')]);_0x316902['attributes']=_[_0x8795('0x39')](_0x1d03c2[_0x8795('0x33')],qs[_0x8795('0x3a')](_0x7c4a5[_0x8795('0x35')]['fields']));_0x316902[_0x8795('0x38')]=_0x316902[_0x8795('0x38')]['length']?_0x316902['attributes']:_0x1d03c2[_0x8795('0x33')];if(_0x7c4a5[_0x8795('0x35')][_0x8795('0x47')]){_0x316902[_0x8795('0x48')]=[{'all':!![]}];}_0x316902=_['merge']({},_0x316902,_0x7c4a5[_0x8795('0x45')]);return db[_0x8795('0x2f')][_0x8795('0x4e')](_0x316902)[_0x8795('0x4a')](handleEntityNotFound(_0x39475b,null))[_0x8795('0x4a')](respondWithResult(_0x39475b,null))[_0x8795('0x4f')](handleError(_0x39475b,null));};exports[_0x8795('0x50')]=function(_0x3d2fda,_0x5ca1fe){return db['VoiceMail'][_0x8795('0x50')](_0x3d2fda['body'],{})[_0x8795('0x4a')](function(_0xa80f56){var _0x23b042=_0x3d2fda[_0x8795('0x51')][_0x8795('0x28')]({'plain':!![]});if(!_0x23b042)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23b042['role']===_0x8795('0x51')){var _0x5c882b=_0xa80f56[_0x8795('0x28')]({'plain':!![]});var _0x2de561='Voicemails';return db[_0x8795('0x52')][_0x8795('0x4e')]({'where':{'name':_0x2de561,'userProfileId':_0x23b042['userProfileId']},'raw':!![]})[_0x8795('0x4a')](function(_0x596c48){if(_0x596c48&&_0x596c48['autoAssociation']===0x0){return db[_0x8795('0x2a')][_0x8795('0x50')]({'name':_0x5c882b[_0x8795('0x2c')],'resourceId':_0x5c882b['id'],'type':_0x596c48['name'],'sectionId':_0x596c48['id']},{})['then'](function(){return _0xa80f56;});}else{return _0xa80f56;}})[_0x8795('0x4f')](function(_0xa4fde0){logger[_0x8795('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa4fde0);throw _0xa4fde0;});}return _0xa80f56;})[_0x8795('0x4a')](respondWithResult(_0x5ca1fe,0xc9))[_0x8795('0x4f')](handleError(_0x5ca1fe,null));};exports[_0x8795('0x26')]=function(_0xe0e3cb,_0x59aecd){if(_0xe0e3cb[_0x8795('0x53')]['id']){delete _0xe0e3cb[_0x8795('0x53')]['id'];}return db[_0x8795('0x2f')][_0x8795('0x4e')]({'where':{'id':_0xe0e3cb[_0x8795('0x4c')]['id']}})['then'](handleEntityNotFound(_0x59aecd,null))[_0x8795('0x4a')](saveUpdates(_0xe0e3cb[_0x8795('0x53')],null))['then'](respondWithResult(_0x59aecd,null))['catch'](handleError(_0x59aecd,null));};exports[_0x8795('0x27')]=function(_0x2687b7,_0x16ea79){return db['VoiceMail'][_0x8795('0x4e')]({'where':{'id':_0x2687b7[_0x8795('0x4c')]['id']}})[_0x8795('0x4a')](handleEntityNotFound(_0x16ea79,null))[_0x8795('0x4a')](removeEntity(_0x16ea79,null))[_0x8795('0x4f')](handleError(_0x16ea79,null));};exports['getMessages']=function(_0x497c58,_0x5a7da5,_0x1c25e3){return db[_0x8795('0x2f')]['findOne']({'where':{'id':_0x497c58[_0x8795('0x4c')]['id']}})[_0x8795('0x4a')](handleEntityNotFound(_0x5a7da5,null))[_0x8795('0x4a')](function(_0x3faae4){var _0x463b73;var _0x5f08e4={},_0x4f4adb={};_0x4f4adb['model']=_['keys'](db[_0x8795('0x54')][_0x8795('0x30')]);_0x4f4adb[_0x8795('0x35')]=_[_0x8795('0x36')](_0x497c58['query']);_0x4f4adb[_0x8795('0x37')]=_[_0x8795('0x39')](_0x4f4adb[_0x8795('0x33')],_0x4f4adb[_0x8795('0x35')]);_0x5f08e4[_0x8795('0x38')]=_[_0x8795('0x39')](_0x4f4adb[_0x8795('0x33')],qs['fields'](_0x497c58[_0x8795('0x35')][_0x8795('0x3a')]));_0x5f08e4['attributes']=_0x5f08e4[_0x8795('0x38')][_0x8795('0x3b')]?_0x5f08e4[_0x8795('0x38')]:_0x4f4adb[_0x8795('0x33')];if(!_0x497c58[_0x8795('0x35')][_0x8795('0x3c')](_0x8795('0x3d'))){_0x5f08e4[_0x8795('0x20')]=qs[_0x8795('0x20')](_0x497c58[_0x8795('0x35')][_0x8795('0x20')]);_0x5f08e4[_0x8795('0x1f')]=qs[_0x8795('0x1f')](_0x497c58['query'][_0x8795('0x1f')]);}_0x5f08e4[_0x8795('0x3e')]=qs['sort'](_0x497c58['query'][_0x8795('0x3f')]);_0x5f08e4[_0x8795('0x40')]=qs['filters'](_[_0x8795('0x41')](_0x497c58[_0x8795('0x35')],_0x4f4adb[_0x8795('0x37')]));if(_0x497c58[_0x8795('0x35')]['filter']){_0x5f08e4['where']=_[_0x8795('0x43')](_0x5f08e4[_0x8795('0x40')],{'$or':_[_0x8795('0x34')](_0x5f08e4['attributes'],function(_0x3afcd8){var _0x283585={};_0x283585[_0x3afcd8]={'$like':'%'+_0x497c58[_0x8795('0x35')][_0x8795('0x42')]+'%'};return _0x283585;})});}_0x5f08e4[_0x8795('0x40')]=_['merge'](_0x5f08e4[_0x8795('0x40')],{'mailboxuser':_0x3faae4[_0x8795('0x55')]});_0x5f08e4=_[_0x8795('0x43')]({},_0x5f08e4,_0x497c58[_0x8795('0x45')]);return db[_0x8795('0x54')]['findAndCountAll'](_0x5f08e4)[_0x8795('0x4a')](respondWithFilteredResult(_0x5a7da5,_0x5f08e4));})['catch'](handleError(_0x5a7da5,null));}; \ No newline at end of file +var _0x85d0=['VoiceMailMessage','filter','mailbox','findAndCountAll','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','merge','options','VoiceMail','includeAll','include','rows','catch','show','filtears','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages'];(function(_0x44769c,_0x4b2cc6){var _0x216eb5=function(_0x3289e7){while(--_0x3289e7){_0x44769c['push'](_0x44769c['shift']());}};_0x216eb5(++_0x4b2cc6);}(_0x85d0,0x164));var _0x085d=function(_0x36c790,_0x3f26d4){_0x36c790=_0x36c790-0x0;var _0x149d1b=_0x85d0[_0x36c790];return _0x149d1b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x085d('0x0'));var rp=require(_0x085d('0x1'));var moment=require(_0x085d('0x2'));var BPromise=require(_0x085d('0x3'));var Mustache=require(_0x085d('0x4'));var util=require(_0x085d('0x5'));var path=require('path');var sox=require(_0x085d('0x6'));var csv=require('to-csv');var ejs=require(_0x085d('0x7'));var fs=require('fs');var _=require(_0x085d('0x8'));var squel=require(_0x085d('0x9'));var crypto=require('crypto');var jsforce=require(_0x085d('0xa'));var deskjs=require(_0x085d('0xb'));var toCsv=require(_0x085d('0xc'));var querystring=require(_0x085d('0xd'));var Papa=require(_0x085d('0xe'));var Redis=require(_0x085d('0xf'));var authService=require(_0x085d('0x10'));var qs=require(_0x085d('0x11'));var as=require(_0x085d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x085d('0x13'))(_0x085d('0x14'));var utils=require(_0x085d('0x15'));var config=require(_0x085d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x085d('0x17'))['db'];function respondWithStatusCode(_0x2bd6ae,_0x5c6c27){_0x5c6c27=_0x5c6c27||0xcc;return function(_0x2e0714){if(_0x2e0714){return _0x2bd6ae[_0x085d('0x18')](_0x5c6c27);}return _0x2bd6ae[_0x085d('0x19')](_0x5c6c27)[_0x085d('0x1a')]();};}function respondWithResult(_0x5a5252,_0x4b87b9){_0x4b87b9=_0x4b87b9||0xc8;return function(_0x19ce18){if(_0x19ce18){return _0x5a5252['status'](_0x4b87b9)['json'](_0x19ce18);}};}function respondWithFilteredResult(_0x267374,_0x334263){return function(_0x1d041b){if(_0x1d041b){var _0x5f8e18=_0x1d041b[_0x085d('0x1b')],_0x309c15=_0x334263[_0x085d('0x1c')],_0x5ed56a=_0x334263[_0x085d('0x1c')]+_0x334263[_0x085d('0x1d')],_0x2b29be;if(_0x5ed56a>=_0x5f8e18){_0x5ed56a=_0x5f8e18;_0x2b29be=0xc8;}else{_0x2b29be=0xce;}_0x267374[_0x085d('0x19')](_0x2b29be);return _0x267374[_0x085d('0x1e')](_0x085d('0x1f'),_0x309c15+'-'+_0x5ed56a+'/'+_0x5f8e18)[_0x085d('0x20')](_0x1d041b);}return null;};}function patchUpdates(_0x5c8232){return function(_0xba531c){try{jsonpatch[_0x085d('0x21')](_0xba531c,_0x5c8232,!![]);}catch(_0x159291){return BPromise[_0x085d('0x22')](_0x159291);}return _0xba531c[_0x085d('0x23')]();};}function saveUpdates(_0x54eff1,_0xb9d0ad){return function(_0x5fd5f){if(_0x5fd5f){return _0x5fd5f[_0x085d('0x24')](_0x54eff1)[_0x085d('0x25')](function(_0x4cf0e1){return _0x4cf0e1;});}return null;};}function removeEntity(_0x5b3f9c,_0x4cdb11){return function(_0x2b7cdc){if(_0x2b7cdc){return _0x2b7cdc[_0x085d('0x26')]()[_0x085d('0x25')](function(){var _0x10aa9d=_0x2b7cdc[_0x085d('0x27')]({'plain':!![]});var _0x17dafb='Voicemails';return db[_0x085d('0x28')][_0x085d('0x26')]({'where':{'type':_0x17dafb,'resourceId':_0x10aa9d['id']}})[_0x085d('0x25')](function(){return _0x2b7cdc;});})['then'](function(){_0x5b3f9c[_0x085d('0x19')](0xcc)[_0x085d('0x1a')]();});}};}function handleEntityNotFound(_0xbacfbc,_0x31d807){return function(_0x300295){if(!_0x300295){_0xbacfbc['sendStatus'](0x194);}return _0x300295;};}function handleError(_0x5e5228,_0x5d2fa9){_0x5d2fa9=_0x5d2fa9||0x1f4;return function(_0x16614){logger[_0x085d('0x29')](_0x16614[_0x085d('0x2a')]);if(_0x16614['name']){delete _0x16614[_0x085d('0x2b')];}_0x5e5228[_0x085d('0x19')](_0x5d2fa9)[_0x085d('0x2c')](_0x16614);};}exports['index']=function(_0x2f670c,_0x2eae2c){var _0x3f905d={},_0x26aa90={},_0x4e37ad={'count':0x0,'rows':[]};var _0x318cab=_[_0x085d('0x2d')](db['VoiceMail'][_0x085d('0x2e')],function(_0x326a12){return{'name':_0x326a12['fieldName'],'type':_0x326a12[_0x085d('0x2f')][_0x085d('0x30')]};});_0x26aa90[_0x085d('0x31')]=_['map'](_0x318cab,_0x085d('0x2b'));_0x26aa90[_0x085d('0x32')]=_[_0x085d('0x33')](_0x2f670c['query']);_0x26aa90[_0x085d('0x34')]=_['intersection'](_0x26aa90[_0x085d('0x31')],_0x26aa90[_0x085d('0x32')]);_0x3f905d[_0x085d('0x35')]=_[_0x085d('0x36')](_0x26aa90['model'],qs[_0x085d('0x37')](_0x2f670c[_0x085d('0x32')][_0x085d('0x37')]));_0x3f905d[_0x085d('0x35')]=_0x3f905d['attributes']['length']?_0x3f905d[_0x085d('0x35')]:_0x26aa90[_0x085d('0x31')];if(!_0x2f670c[_0x085d('0x32')][_0x085d('0x38')](_0x085d('0x39'))){_0x3f905d[_0x085d('0x1d')]=qs[_0x085d('0x1d')](_0x2f670c[_0x085d('0x32')][_0x085d('0x1d')]);_0x3f905d['offset']=qs[_0x085d('0x1c')](_0x2f670c[_0x085d('0x32')]['offset']);}_0x3f905d[_0x085d('0x3a')]=qs['sort'](_0x2f670c[_0x085d('0x32')][_0x085d('0x3b')]);_0x3f905d['where']=qs[_0x085d('0x34')](_[_0x085d('0x3c')](_0x2f670c[_0x085d('0x32')],_0x26aa90[_0x085d('0x34')]),_0x318cab);if(_0x2f670c[_0x085d('0x32')]['filter']){_0x3f905d[_0x085d('0x3d')]=_['merge'](_0x3f905d['where'],{'$or':_[_0x085d('0x2d')](_0x318cab,function(_0x32bf4f){if(_0x32bf4f[_0x085d('0x2f')]!==_0x085d('0x3e')){var _0xd9d33e={};_0xd9d33e[_0x32bf4f['name']]={'$like':'%'+_0x2f670c[_0x085d('0x32')]['filter']+'%'};return _0xd9d33e;}})});}_0x3f905d=_[_0x085d('0x3f')]({},_0x3f905d,_0x2f670c[_0x085d('0x40')]);var _0xd853e2={'where':_0x3f905d['where']};return db[_0x085d('0x41')]['count'](_0xd853e2)[_0x085d('0x25')](function(_0x284172){_0x4e37ad['count']=_0x284172;if(_0x2f670c[_0x085d('0x32')][_0x085d('0x42')]){_0x3f905d[_0x085d('0x43')]=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x3f905d);})[_0x085d('0x25')](function(_0x1f1e1f){_0x4e37ad[_0x085d('0x44')]=_0x1f1e1f;return _0x4e37ad;})[_0x085d('0x25')](respondWithFilteredResult(_0x2eae2c,_0x3f905d))[_0x085d('0x45')](handleError(_0x2eae2c,null));};exports[_0x085d('0x46')]=function(_0x27e1c7,_0x120980){var _0x2978a1={'raw':!![],'where':{'id':_0x27e1c7['params']['id']}},_0x2de678={};_0x2de678['model']=_[_0x085d('0x33')](db[_0x085d('0x41')][_0x085d('0x2e')]);_0x2de678[_0x085d('0x32')]=_[_0x085d('0x33')](_0x27e1c7[_0x085d('0x32')]);_0x2de678[_0x085d('0x47')]=_[_0x085d('0x36')](_0x2de678[_0x085d('0x31')],_0x2de678[_0x085d('0x32')]);_0x2978a1[_0x085d('0x35')]=_['intersection'](_0x2de678[_0x085d('0x31')],qs[_0x085d('0x37')](_0x27e1c7[_0x085d('0x32')][_0x085d('0x37')]));_0x2978a1[_0x085d('0x35')]=_0x2978a1['attributes'][_0x085d('0x48')]?_0x2978a1['attributes']:_0x2de678[_0x085d('0x31')];if(_0x27e1c7['query']['includeAll']){_0x2978a1[_0x085d('0x43')]=[{'all':!![]}];}_0x2978a1=_[_0x085d('0x3f')]({},_0x2978a1,_0x27e1c7[_0x085d('0x40')]);return db[_0x085d('0x41')][_0x085d('0x49')](_0x2978a1)['then'](handleEntityNotFound(_0x120980,null))['then'](respondWithResult(_0x120980,null))['catch'](handleError(_0x120980,null));};exports['create']=function(_0x5aeb4a,_0x1f447d){return db[_0x085d('0x41')]['create'](_0x5aeb4a[_0x085d('0x4a')],{})['then'](function(_0x5df4cf){var _0x415a4b=_0x5aeb4a[_0x085d('0x4b')][_0x085d('0x27')]({'plain':!![]});if(!_0x415a4b)throw new Error(_0x085d('0x4c'));if(_0x415a4b['role']===_0x085d('0x4b')){var _0x5ec8dc=_0x5df4cf[_0x085d('0x27')]({'plain':!![]});var _0x458c54='Voicemails';return db[_0x085d('0x4d')][_0x085d('0x49')]({'where':{'name':_0x458c54,'userProfileId':_0x415a4b[_0x085d('0x4e')]},'raw':!![]})[_0x085d('0x25')](function(_0x58955e){if(_0x58955e&&_0x58955e[_0x085d('0x4f')]===0x0){return db['UserProfileResource'][_0x085d('0x50')]({'name':_0x5ec8dc['name'],'resourceId':_0x5ec8dc['id'],'type':_0x58955e['name'],'sectionId':_0x58955e['id']},{})[_0x085d('0x25')](function(){return _0x5df4cf;});}else{return _0x5df4cf;}})[_0x085d('0x45')](function(_0x236368){logger[_0x085d('0x29')](_0x085d('0x51'),_0x236368);throw _0x236368;});}return _0x5df4cf;})[_0x085d('0x25')](respondWithResult(_0x1f447d,0xc9))[_0x085d('0x45')](handleError(_0x1f447d,null));};exports[_0x085d('0x24')]=function(_0x488d5a,_0x540e77){if(_0x488d5a['body']['id']){delete _0x488d5a[_0x085d('0x4a')]['id'];}return db['VoiceMail'][_0x085d('0x49')]({'where':{'id':_0x488d5a['params']['id']}})[_0x085d('0x25')](handleEntityNotFound(_0x540e77,null))[_0x085d('0x25')](saveUpdates(_0x488d5a[_0x085d('0x4a')],null))[_0x085d('0x25')](respondWithResult(_0x540e77,null))['catch'](handleError(_0x540e77,null));};exports['destroy']=function(_0x1cd63d,_0x34b117){return db['VoiceMail'][_0x085d('0x49')]({'where':{'id':_0x1cd63d[_0x085d('0x52')]['id']}})[_0x085d('0x25')](handleEntityNotFound(_0x34b117,null))[_0x085d('0x25')](removeEntity(_0x34b117,null))[_0x085d('0x45')](handleError(_0x34b117,null));};exports[_0x085d('0x53')]=function(_0x2a2eb4,_0x3b3ccc,_0x483f75){return db[_0x085d('0x41')]['findOne']({'where':{'id':_0x2a2eb4[_0x085d('0x52')]['id']}})['then'](handleEntityNotFound(_0x3b3ccc,null))[_0x085d('0x25')](function(_0x505634){var _0x402157;var _0x183932={},_0x4cc92a={};_0x4cc92a['model']=_[_0x085d('0x33')](db[_0x085d('0x54')][_0x085d('0x2e')]);_0x4cc92a[_0x085d('0x32')]=_[_0x085d('0x33')](_0x2a2eb4[_0x085d('0x32')]);_0x4cc92a[_0x085d('0x34')]=_[_0x085d('0x36')](_0x4cc92a[_0x085d('0x31')],_0x4cc92a[_0x085d('0x32')]);_0x183932[_0x085d('0x35')]=_[_0x085d('0x36')](_0x4cc92a[_0x085d('0x31')],qs[_0x085d('0x37')](_0x2a2eb4['query']['fields']));_0x183932[_0x085d('0x35')]=_0x183932[_0x085d('0x35')]['length']?_0x183932['attributes']:_0x4cc92a['model'];if(!_0x2a2eb4[_0x085d('0x32')][_0x085d('0x38')]('nolimit')){_0x183932[_0x085d('0x1d')]=qs[_0x085d('0x1d')](_0x2a2eb4[_0x085d('0x32')]['limit']);_0x183932[_0x085d('0x1c')]=qs[_0x085d('0x1c')](_0x2a2eb4[_0x085d('0x32')][_0x085d('0x1c')]);}_0x183932['order']=qs[_0x085d('0x3b')](_0x2a2eb4[_0x085d('0x32')]['sort']);_0x183932[_0x085d('0x3d')]=qs[_0x085d('0x34')](_[_0x085d('0x3c')](_0x2a2eb4['query'],_0x4cc92a['filters']));if(_0x2a2eb4['query'][_0x085d('0x55')]){_0x183932[_0x085d('0x3d')]=_['merge'](_0x183932[_0x085d('0x3d')],{'$or':_['map'](_0x183932[_0x085d('0x35')],function(_0x1d0388){var _0x50fe13={};_0x50fe13[_0x1d0388]={'$like':'%'+_0x2a2eb4[_0x085d('0x32')][_0x085d('0x55')]+'%'};return _0x50fe13;})});}_0x183932['where']=_[_0x085d('0x3f')](_0x183932[_0x085d('0x3d')],{'mailboxuser':_0x505634[_0x085d('0x56')]});_0x183932=_[_0x085d('0x3f')]({},_0x183932,_0x2a2eb4['options']);return db['VoiceMailMessage'][_0x085d('0x57')](_0x183932)[_0x085d('0x25')](respondWithFilteredResult(_0x3b3ccc,_0x183932));})[_0x085d('0x45')](handleError(_0x3b3ccc,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 4b88f77..e5745af 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 _0xf55c=['moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','../../config/logger','api'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xf55c,0x1e7));var _0xcf55=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xf55c[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0xcf55('0x0'));var util=require('util');var logger=require(_0xcf55('0x1'))(_0xcf55('0x2'));var moment=require(_0xcf55('0x3'));var BPromise=require(_0xcf55('0x4'));var rp=require(_0xcf55('0x5'));var fs=require('fs');var path=require(_0xcf55('0x6'));var rimraf=require(_0xcf55('0x7'));var config=require('../../config/environment');var attributes=require(_0xcf55('0x8'));module[_0xcf55('0x9')]=function(_0x14574c,_0x3a6de7){return _0x14574c['define'](_0xcf55('0xa'),attributes,{'tableName':_0xcf55('0xb'),'paranoid':![],'indexes':[{'name':_0xcf55('0xc'),'fields':[_0xcf55('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9aea=['rimraf','../../config/environment','./voiceMail.attributes','VoiceMail','voice_voicemail','mailbox','lodash','util','../../config/logger','bluebird'];(function(_0x2887e7,_0x56ce68){var _0x431f63=function(_0x19c005){while(--_0x19c005){_0x2887e7['push'](_0x2887e7['shift']());}};_0x431f63(++_0x56ce68);}(_0x9aea,0x196));var _0xa9ae=function(_0x562251,_0x394e86){_0x562251=_0x562251-0x0;var _0x217711=_0x9aea[_0x562251];return _0x217711;};'use strict';var _=require(_0xa9ae('0x0'));var util=require(_0xa9ae('0x1'));var logger=require(_0xa9ae('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa9ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa9ae('0x4'));var config=require(_0xa9ae('0x5'));var attributes=require(_0xa9ae('0x6'));module['exports']=function(_0x161bdc,_0x1716ea){return _0x161bdc['define'](_0xa9ae('0x7'),attributes,{'tableName':_0xa9ae('0x8'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xa9ae('0x9'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index e35bdc8..0e643b7 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 _0xca22=['stringify','error','VoiceMail,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug'];(function(_0x448295,_0x47219b){var _0x43354e=function(_0x290c11){while(--_0x290c11){_0x448295['push'](_0x448295['shift']());}};_0x43354e(++_0x47219b);}(_0xca22,0xee));var _0x2ca2=function(_0x255840,_0x411b6e){_0x255840=_0x255840-0x0;var _0x40dad5=_0xca22[_0x255840];return _0x40dad5;};'use strict';var _=require('lodash');var util=require(_0x2ca2('0x0'));var moment=require(_0x2ca2('0x1'));var BPromise=require(_0x2ca2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ca2('0x3'))['db'];var utils=require(_0x2ca2('0x4'));var logger=require(_0x2ca2('0x5'))(_0x2ca2('0x6'));var config=require(_0x2ca2('0x7'));var jayson=require(_0x2ca2('0x8'));var client=jayson[_0x2ca2('0x9')][_0x2ca2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d0bf8,_0x3f2016,_0x2e1e57){return new BPromise(function(_0xa2cfcb,_0x54aea9){return client[_0x2ca2('0xb')](_0x2d0bf8,_0x2e1e57)['then'](function(_0x2d9da6){logger['info']('VoiceMail,\x20%s,\x20%s',_0x3f2016,_0x2ca2('0xc'));logger[_0x2ca2('0xd')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x3f2016,_0x2ca2('0xc'),JSON[_0x2ca2('0xe')](_0x2d9da6));if(_0x2d9da6[_0x2ca2('0xf')]){if(_0x2d9da6[_0x2ca2('0xf')]['code']===0x1f4){logger['error'](_0x2ca2('0x10'),_0x3f2016,_0x2d9da6[_0x2ca2('0xf')]['message']);return _0x54aea9(_0x2d9da6[_0x2ca2('0xf')]['message']);}logger[_0x2ca2('0xf')](_0x2ca2('0x10'),_0x3f2016,_0x2d9da6[_0x2ca2('0xf')][_0x2ca2('0x11')]);return _0xa2cfcb(_0x2d9da6[_0x2ca2('0xf')][_0x2ca2('0x11')]);}else{logger[_0x2ca2('0x12')](_0x2ca2('0x10'),_0x3f2016,_0x2ca2('0xc'));_0xa2cfcb(_0x2d9da6[_0x2ca2('0x13')][_0x2ca2('0x11')]);}})[_0x2ca2('0x14')](function(_0x227b94){logger[_0x2ca2('0xf')](_0x2ca2('0x10'),_0x3f2016,_0x227b94);_0x54aea9(_0x227b94);});});} \ No newline at end of file +var _0xdb95=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x7b544a,_0x33c45a){var _0x33dcb4=function(_0x5ebc7f){while(--_0x5ebc7f){_0x7b544a['push'](_0x7b544a['shift']());}};_0x33dcb4(++_0x33c45a);}(_0xdb95,0x1b5));var _0x5db9=function(_0x437f64,_0x5559e3){_0x437f64=_0x437f64-0x0;var _0x15c59d=_0xdb95[_0x437f64];return _0x15c59d;};'use strict';var _=require(_0x5db9('0x0'));var util=require(_0x5db9('0x1'));var moment=require(_0x5db9('0x2'));var BPromise=require('bluebird');var rs=require(_0x5db9('0x3'));var fs=require('fs');var Redis=require(_0x5db9('0x4'));var db=require(_0x5db9('0x5'))['db'];var utils=require(_0x5db9('0x6'));var logger=require('../../config/logger')(_0x5db9('0x7'));var config=require(_0x5db9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5db9('0x9')][_0x5db9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e779f,_0x701a44,_0x4d3cb1){return new BPromise(function(_0xe303c9,_0x149694){return client[_0x5db9('0xb')](_0x1e779f,_0x4d3cb1)[_0x5db9('0xc')](function(_0x49003b){logger['info'](_0x5db9('0xd'),_0x701a44,_0x5db9('0xe'));logger[_0x5db9('0xf')](_0x5db9('0x10'),_0x701a44,_0x5db9('0xe'),JSON['stringify'](_0x49003b));if(_0x49003b[_0x5db9('0x11')]){if(_0x49003b['error'][_0x5db9('0x12')]===0x1f4){logger[_0x5db9('0x11')]('VoiceMail,\x20%s,\x20%s',_0x701a44,_0x49003b[_0x5db9('0x11')][_0x5db9('0x13')]);return _0x149694(_0x49003b[_0x5db9('0x11')][_0x5db9('0x13')]);}logger[_0x5db9('0x11')](_0x5db9('0xd'),_0x701a44,_0x49003b[_0x5db9('0x11')][_0x5db9('0x13')]);return _0xe303c9(_0x49003b[_0x5db9('0x11')]['message']);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x701a44,_0x5db9('0xe'));_0xe303c9(_0x49003b[_0x5db9('0x14')][_0x5db9('0x13')]);}})[_0x5db9('0x15')](function(_0x4019bf){logger[_0x5db9('0x11')](_0x5db9('0xd'),_0x701a44,_0x4019bf);_0x149694(_0x4019bf);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 2f37ab3..472b41f 100644 --- a/server/api/voiceMailMessage/index.js +++ b/server/api/voiceMailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['get','isAuthenticated','index','/:id','/:id/download','download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller'];(function(_0x2925d0,_0x57812c){var _0x2a8891=function(_0x52da79){while(--_0x52da79){_0x2925d0['push'](_0x2925d0['shift']());}};_0x2a8891(++_0x57812c);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x26d741,_0x18409b){_0x26d741=_0x26d741-0x0;var _0x564540=_0x7fbe[_0x26d741];return _0x564540;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var auth=require(_0xe7fb('0x4'));var interaction=require(_0xe7fb('0x5'));var config=require(_0xe7fb('0x6'));var controller=require(_0xe7fb('0x7'));router[_0xe7fb('0x8')]('/',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xa')]);router[_0xe7fb('0x8')](_0xe7fb('0xb'),auth[_0xe7fb('0x9')](),controller['show']);router[_0xe7fb('0x8')](_0xe7fb('0xc'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe7fb('0xe')]);router[_0xe7fb('0xf')](_0xe7fb('0xb'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x10')]);router[_0xe7fb('0x11')](_0xe7fb('0xb'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x12')]);module[_0xe7fb('0x13')]=router; \ No newline at end of file +var _0x4819=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','isAuthenticated','show','/:id/download','post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x836bb4,_0x565f4b){var _0x4f5a56=function(_0x183a19){while(--_0x183a19){_0x836bb4['push'](_0x836bb4['shift']());}};_0x4f5a56(++_0x565f4b);}(_0x4819,0xcd));var _0x9481=function(_0x35d59c,_0x4aa57e){_0x35d59c=_0x35d59c-0x0;var _0x55d5cc=_0x4819[_0x35d59c];return _0x55d5cc;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var auth=require(_0x9481('0x5'));var interaction=require(_0x9481('0x6'));var config=require(_0x9481('0x7'));var controller=require(_0x9481('0x8'));router[_0x9481('0x9')]('/',auth['isAuthenticated'](),controller[_0x9481('0xa')]);router['get']('/:id',auth[_0x9481('0xb')](),controller[_0x9481('0xc')]);router[_0x9481('0x9')](_0x9481('0xd'),auth[_0x9481('0xb')](),controller['download']);router[_0x9481('0xe')]('/',auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['put'](_0x9481('0x10'),auth[_0x9481('0xb')](),controller[_0x9481('0x11')]);router[_0x9481('0x12')](_0x9481('0x10'),auth[_0x9481('0xb')](),controller[_0x9481('0x13')]);module[_0x9481('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 845ad5a..74c7a5c 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 _0xcd53=['VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','sequelize','exports'];(function(_0x1e39e1,_0x32c3cd){var _0x5b2576=function(_0x300cd8){while(--_0x300cd8){_0x1e39e1['push'](_0x1e39e1['shift']());}};_0x5b2576(++_0x32c3cd);}(_0xcd53,0xc4));var _0x3cd5=function(_0x5f746f,_0x5b05ab){_0x5f746f=_0x5f746f-0x0;var _0x198d15=_0xcd53[_0x5f746f];return _0x198d15;};'use strict';var Sequelize=require(_0x3cd5('0x0'));module[_0x3cd5('0x1')]={'name':{'type':Sequelize[_0x3cd5('0x2')],'get':function(_0x2c3742){return this[_0x3cd5('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x3cd5('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x3cd5('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x3cd5('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x3cd5('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x3cd5('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x3cd5('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x3cd5('0x6')](_0x3cd5('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x3cd5('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x3cd5('0x5')],'defaultValue':''},'stamp':{'type':_0x3cd5('0x8'),'allowNull':![]}}; \ No newline at end of file +var _0xc11e=['long','TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0x176c28,_0x131dd6){var _0x38083e=function(_0x48beb3){while(--_0x48beb3){_0x176c28['push'](_0x176c28['shift']());}};_0x38083e(++_0x131dd6);}(_0xc11e,0x92));var _0xec11=function(_0x56f598,_0x19a7e9){_0x56f598=_0x56f598-0x0;var _0x12663d=_0xc11e[_0x56f598];return _0x12663d;};'use strict';var Sequelize=require(_0xec11('0x0'));module[_0xec11('0x1')]={'name':{'type':Sequelize[_0xec11('0x2')],'get':function(_0x38e034){return this[_0xec11('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xec11('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xec11('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xec11('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xec11('0x5')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xec11('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xec11('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xec11('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xec11('0x5')],'defaultValue':''},'stamp':{'type':_0xec11('0x7'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index c72b96d..467cbbf 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 _0x9fca=['count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','include','rows','catch','show','params','filtears','length','find','body','download','recording','msg_id','VoiceMailMessage\x20not\x20found','attachment','attachment;\x20filename=\x22','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','status','end','json'];(function(_0x2418d6,_0x4c4fa9){var _0x28ac71=function(_0x302666){while(--_0x302666){_0x2418d6['push'](_0x2418d6['shift']());}};_0x28ac71(++_0x4c4fa9);}(_0x9fca,0x7f));var _0xa9fc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9fca[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xa9fc('0x0'));var emlformat=require(_0xa9fc('0x1'));var rimraf=require(_0xa9fc('0x2'));var zipdir=require(_0xa9fc('0x3'));var jsonpatch=require(_0xa9fc('0x4'));var rp=require(_0xa9fc('0x5'));var moment=require(_0xa9fc('0x6'));var BPromise=require(_0xa9fc('0x7'));var Mustache=require(_0xa9fc('0x8'));var util=require(_0xa9fc('0x9'));var path=require(_0xa9fc('0xa'));var sox=require('sox');var csv=require(_0xa9fc('0xb'));var ejs=require(_0xa9fc('0xc'));var fs=require('fs');var _=require(_0xa9fc('0xd'));var squel=require('squel');var crypto=require(_0xa9fc('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa9fc('0xf'));var toCsv=require(_0xa9fc('0xb'));var querystring=require(_0xa9fc('0x10'));var Papa=require('papaparse');var Redis=require(_0xa9fc('0x11'));var authService=require(_0xa9fc('0x12'));var qs=require(_0xa9fc('0x13'));var as=require(_0xa9fc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa9fc('0x15'));var utils=require('../../config/utils');var config=require(_0xa9fc('0x16'));var licenseUtil=require(_0xa9fc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x225893,_0x22a928){_0x22a928=_0x22a928||0xcc;return function(_0x20e1a9){if(_0x20e1a9){return _0x225893['sendStatus'](_0x22a928);}return _0x225893[_0xa9fc('0x18')](_0x22a928)[_0xa9fc('0x19')]();};}function respondWithResult(_0x56cab9,_0xbdc8df){_0xbdc8df=_0xbdc8df||0xc8;return function(_0x53e57f){if(_0x53e57f){return _0x56cab9[_0xa9fc('0x18')](_0xbdc8df)[_0xa9fc('0x1a')](_0x53e57f);}};}function respondWithFilteredResult(_0x209d7a,_0x4c8a47){return function(_0x3b8115){if(_0x3b8115){var _0x3daafa=_0x3b8115[_0xa9fc('0x1b')],_0x126472=_0x4c8a47[_0xa9fc('0x1c')],_0x273a38=_0x4c8a47[_0xa9fc('0x1c')]+_0x4c8a47[_0xa9fc('0x1d')],_0x1cc8c0;if(_0x273a38>=_0x3daafa){_0x273a38=_0x3daafa;_0x1cc8c0=0xc8;}else{_0x1cc8c0=0xce;}_0x209d7a['status'](_0x1cc8c0);return _0x209d7a[_0xa9fc('0x1e')](_0xa9fc('0x1f'),_0x126472+'-'+_0x273a38+'/'+_0x3daafa)[_0xa9fc('0x1a')](_0x3b8115);}return null;};}function patchUpdates(_0x3326da){return function(_0x5d7cb0){try{jsonpatch[_0xa9fc('0x20')](_0x5d7cb0,_0x3326da,!![]);}catch(_0x344890){return BPromise['reject'](_0x344890);}return _0x5d7cb0[_0xa9fc('0x21')]();};}function saveUpdates(_0x2fca38,_0x402a06){return function(_0x17ec80){if(_0x17ec80){return _0x17ec80[_0xa9fc('0x22')](_0x2fca38)[_0xa9fc('0x23')](function(_0x1269ab){return _0x1269ab;});}return null;};}function removeEntity(_0x348868,_0x21768c){return function(_0x2d9e76){if(_0x2d9e76){return _0x2d9e76[_0xa9fc('0x24')]()['then'](function(){_0x348868['status'](0xcc)[_0xa9fc('0x19')]();});}};}function handleEntityNotFound(_0x34764e,_0x129f78){return function(_0x1f53e0){if(!_0x1f53e0){_0x34764e['sendStatus'](0x194);}return _0x1f53e0;};}function handleError(_0x1972b4,_0x21c6ac){_0x21c6ac=_0x21c6ac||0x1f4;return function(_0x1a9e30){logger[_0xa9fc('0x25')](_0x1a9e30[_0xa9fc('0x26')]);if(_0x1a9e30['name']){delete _0x1a9e30[_0xa9fc('0x27')];}_0x1972b4['status'](_0x21c6ac)[_0xa9fc('0x28')](_0x1a9e30);};}exports['index']=function(_0x4b26e2,_0x2bf5e9){var _0x58dc45={},_0xf3b78f={},_0x39f58b={'count':0x0,'rows':[]};var _0xa951cd=_[_0xa9fc('0x29')](db[_0xa9fc('0x2a')][_0xa9fc('0x2b')],function(_0x10df9b){return{'name':_0x10df9b[_0xa9fc('0x2c')],'type':_0x10df9b[_0xa9fc('0x2d')][_0xa9fc('0x2e')]};});_0xf3b78f[_0xa9fc('0x2f')]=_['differenceBy'](_[_0xa9fc('0x29')](_0xa951cd,'name'),['name']);_0xf3b78f['query']=_[_0xa9fc('0x30')](_0x4b26e2[_0xa9fc('0x31')]);_0xf3b78f[_0xa9fc('0x32')]=_[_0xa9fc('0x33')](_0xf3b78f[_0xa9fc('0x2f')],_0xf3b78f['query']);_0x58dc45[_0xa9fc('0x34')]=_['intersection'](_0xf3b78f[_0xa9fc('0x2f')],qs['fields'](_0x4b26e2['query'][_0xa9fc('0x35')]));_0x58dc45['attributes']=_0x58dc45['attributes']['length']?_0x58dc45[_0xa9fc('0x34')]:_0xf3b78f[_0xa9fc('0x2f')];if(!_0x4b26e2['query'][_0xa9fc('0x36')](_0xa9fc('0x37'))){_0x58dc45[_0xa9fc('0x1d')]=qs[_0xa9fc('0x1d')](_0x4b26e2[_0xa9fc('0x31')]['limit']);_0x58dc45[_0xa9fc('0x1c')]=qs['offset'](_0x4b26e2[_0xa9fc('0x31')][_0xa9fc('0x1c')]);}_0x58dc45[_0xa9fc('0x38')]=qs[_0xa9fc('0x39')](_0x4b26e2[_0xa9fc('0x31')][_0xa9fc('0x39')]);_0x58dc45[_0xa9fc('0x3a')]=qs['filters'](_['pick'](_0x4b26e2[_0xa9fc('0x31')],_0xf3b78f['filters']),_0xa951cd);if(_0x4b26e2[_0xa9fc('0x31')][_0xa9fc('0x3b')]){_0x58dc45[_0xa9fc('0x3a')]=_['merge'](_0x58dc45[_0xa9fc('0x3a')],{'$or':_[_0xa9fc('0x29')](_0xa951cd,function(_0x10bcc4){if(_0x10bcc4[_0xa9fc('0x2d')]!=='VIRTUAL'){var _0x2aa931={};_0x2aa931[_0x10bcc4[_0xa9fc('0x27')]]={'$like':'%'+_0x4b26e2[_0xa9fc('0x31')]['filter']+'%'};return _0x2aa931;}})});}_0x58dc45=_['merge']({},_0x58dc45,_0x4b26e2[_0xa9fc('0x3c')]);var _0x14efd9={'where':_0x58dc45[_0xa9fc('0x3a')]};return db['VoiceMailMessage'][_0xa9fc('0x1b')](_0x14efd9)[_0xa9fc('0x23')](function(_0x7dbbbe){_0x39f58b[_0xa9fc('0x1b')]=_0x7dbbbe;if(_0x4b26e2['query'][_0xa9fc('0x3d')]){_0x58dc45[_0xa9fc('0x3e')]=[{'all':!![]}];}return db[_0xa9fc('0x2a')]['findAll'](_0x58dc45);})['then'](function(_0xf4c90a){_0x39f58b[_0xa9fc('0x3f')]=_0xf4c90a;return _0x39f58b;})['then'](respondWithFilteredResult(_0x2bf5e9,_0x58dc45))[_0xa9fc('0x40')](handleError(_0x2bf5e9,null));};exports[_0xa9fc('0x41')]=function(_0x50a2fe,_0x20cec6){var _0xd0cca4={'raw':!![],'where':{'id':_0x50a2fe[_0xa9fc('0x42')]['id']}},_0x17e87b={};_0x17e87b[_0xa9fc('0x2f')]=_[_0xa9fc('0x30')](db['VoiceMailMessage'][_0xa9fc('0x2b')]);_0x17e87b[_0xa9fc('0x31')]=_[_0xa9fc('0x30')](_0x50a2fe['query']);_0x17e87b[_0xa9fc('0x43')]=_[_0xa9fc('0x33')](_0x17e87b['model'],_0x17e87b['query']);_0xd0cca4[_0xa9fc('0x34')]=_['intersection'](_0x17e87b[_0xa9fc('0x2f')],qs[_0xa9fc('0x35')](_0x50a2fe[_0xa9fc('0x31')][_0xa9fc('0x35')]));_0xd0cca4[_0xa9fc('0x34')]=_0xd0cca4['attributes'][_0xa9fc('0x44')]?_0xd0cca4[_0xa9fc('0x34')]:_0x17e87b[_0xa9fc('0x2f')];if(_0x50a2fe[_0xa9fc('0x31')][_0xa9fc('0x3d')]){_0xd0cca4['include']=[{'all':!![]}];}_0xd0cca4=_['merge']({},_0xd0cca4,_0x50a2fe[_0xa9fc('0x3c')]);return db[_0xa9fc('0x2a')][_0xa9fc('0x45')](_0xd0cca4)['then'](handleEntityNotFound(_0x20cec6,null))[_0xa9fc('0x23')](respondWithResult(_0x20cec6,null))[_0xa9fc('0x40')](handleError(_0x20cec6,null));};exports['create']=function(_0x4199ac,_0x2cbae0){return db[_0xa9fc('0x2a')]['create'](_0x4199ac[_0xa9fc('0x46')],{})[_0xa9fc('0x23')](respondWithResult(_0x2cbae0,0xc9))[_0xa9fc('0x40')](handleError(_0x2cbae0,null));};exports[_0xa9fc('0x22')]=function(_0x42eb87,_0x5adf37){if(_0x42eb87[_0xa9fc('0x46')]['id']){delete _0x42eb87['body']['id'];}return db[_0xa9fc('0x2a')]['find']({'where':{'id':_0x42eb87[_0xa9fc('0x42')]['id']}})[_0xa9fc('0x23')](handleEntityNotFound(_0x5adf37,null))['then'](saveUpdates(_0x42eb87['body'],null))[_0xa9fc('0x23')](respondWithResult(_0x5adf37,null))[_0xa9fc('0x40')](handleError(_0x5adf37,null));};exports['destroy']=function(_0x34eacc,_0x22b4b3){return db[_0xa9fc('0x2a')][_0xa9fc('0x45')]({'where':{'id':_0x34eacc[_0xa9fc('0x42')]['id']}})[_0xa9fc('0x23')](handleEntityNotFound(_0x22b4b3,null))[_0xa9fc('0x23')](removeEntity(_0x22b4b3,null))['catch'](handleError(_0x22b4b3,null));};exports[_0xa9fc('0x47')]=function(_0xcbac30,_0x964d00,_0x396ad4){return db[_0xa9fc('0x2a')]['find']({'where':{'id':_0xcbac30['params']['id']},'attributes':['id',_0xa9fc('0x48'),_0xa9fc('0x49')]})[_0xa9fc('0x23')](handleEntityNotFound(_0x964d00,null))['then'](function(_0x28c9b7){if(_0x28c9b7){if(!_0x28c9b7[_0xa9fc('0x48')]){throw new db['Sequelize']['ValidationError'](_0xa9fc('0x4a'));}var _0x59db14={'Content-Type':'audio/wav','Content-Disposition':_0xa9fc('0x4b')};if(_0x28c9b7[_0xa9fc('0x49')]){_0x59db14['Content-Disposition']=_0xa9fc('0x4c')+_0x28c9b7[_0xa9fc('0x49')]+'.wav\x22';}_0x964d00[_0xa9fc('0x1e')](_0x59db14);return _0x964d00[_0xa9fc('0x28')](new Buffer(_0x28c9b7[_0xa9fc('0x48')]));}})[_0xa9fc('0x40')](handleError(_0x964d00,null));}; \ No newline at end of file +var _0xbfb0=['hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','msg_id','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','attributes','intersection','fields'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xbfb0,0x166));var _0x0bfb=function(_0x4b1665,_0xb0c095){_0x4b1665=_0x4b1665-0x0;var _0x5850c0=_0xbfb0[_0x4b1665];return _0x5850c0;};'use strict';var pdf=require(_0x0bfb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0bfb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0bfb('0x2'));var rp=require(_0x0bfb('0x3'));var moment=require(_0x0bfb('0x4'));var BPromise=require(_0x0bfb('0x5'));var Mustache=require(_0x0bfb('0x6'));var util=require(_0x0bfb('0x7'));var path=require(_0x0bfb('0x8'));var sox=require('sox');var csv=require(_0x0bfb('0x9'));var ejs=require(_0x0bfb('0xa'));var fs=require('fs');var _=require(_0x0bfb('0xb'));var squel=require('squel');var crypto=require(_0x0bfb('0xc'));var jsforce=require(_0x0bfb('0xd'));var deskjs=require(_0x0bfb('0xe'));var toCsv=require(_0x0bfb('0x9'));var querystring=require(_0x0bfb('0xf'));var Papa=require(_0x0bfb('0x10'));var Redis=require(_0x0bfb('0x11'));var authService=require(_0x0bfb('0x12'));var qs=require(_0x0bfb('0x13'));var as=require(_0x0bfb('0x14'));var hardwareService=require(_0x0bfb('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x0bfb('0x16'));var config=require(_0x0bfb('0x17'));var licenseUtil=require(_0x0bfb('0x18'));var db=require(_0x0bfb('0x19'))['db'];function respondWithStatusCode(_0x4df110,_0x28688d){_0x28688d=_0x28688d||0xcc;return function(_0x3ed4d3){if(_0x3ed4d3){return _0x4df110[_0x0bfb('0x1a')](_0x28688d);}return _0x4df110['status'](_0x28688d)['end']();};}function respondWithResult(_0x100f45,_0x429e0f){_0x429e0f=_0x429e0f||0xc8;return function(_0x1d6223){if(_0x1d6223){return _0x100f45[_0x0bfb('0x1b')](_0x429e0f)[_0x0bfb('0x1c')](_0x1d6223);}};}function respondWithFilteredResult(_0x356a84,_0x517b6c){return function(_0x2c8010){if(_0x2c8010){var _0x441032=_0x2c8010[_0x0bfb('0x1d')],_0x161620=_0x517b6c[_0x0bfb('0x1e')],_0x5f3124=_0x517b6c[_0x0bfb('0x1e')]+_0x517b6c[_0x0bfb('0x1f')],_0xe4842;if(_0x5f3124>=_0x441032){_0x5f3124=_0x441032;_0xe4842=0xc8;}else{_0xe4842=0xce;}_0x356a84['status'](_0xe4842);return _0x356a84[_0x0bfb('0x20')]('Content-Range',_0x161620+'-'+_0x5f3124+'/'+_0x441032)['json'](_0x2c8010);}return null;};}function patchUpdates(_0x5b1e33){return function(_0x55fe9b){try{jsonpatch[_0x0bfb('0x21')](_0x55fe9b,_0x5b1e33,!![]);}catch(_0x27afa7){return BPromise[_0x0bfb('0x22')](_0x27afa7);}return _0x55fe9b['save']();};}function saveUpdates(_0x32b509,_0x4839a1){return function(_0x5f0a0f){if(_0x5f0a0f){return _0x5f0a0f[_0x0bfb('0x23')](_0x32b509)[_0x0bfb('0x24')](function(_0x598db2){return _0x598db2;});}return null;};}function removeEntity(_0x5563f2,_0x3fd72a){return function(_0x3267ae){if(_0x3267ae){return _0x3267ae[_0x0bfb('0x25')]()['then'](function(){_0x5563f2[_0x0bfb('0x1b')](0xcc)[_0x0bfb('0x26')]();});}};}function handleEntityNotFound(_0x31a46f,_0x4f9a9c){return function(_0x414e7f){if(!_0x414e7f){_0x31a46f[_0x0bfb('0x1a')](0x194);}return _0x414e7f;};}function handleError(_0xbee41,_0xde3d9c){_0xde3d9c=_0xde3d9c||0x1f4;return function(_0x1250db){logger[_0x0bfb('0x27')](_0x1250db[_0x0bfb('0x28')]);if(_0x1250db[_0x0bfb('0x29')]){delete _0x1250db[_0x0bfb('0x29')];}_0xbee41['status'](_0xde3d9c)[_0x0bfb('0x2a')](_0x1250db);};}exports[_0x0bfb('0x2b')]=function(_0x2e8d91,_0x232e37){var _0x4ef82f={},_0x4da759={},_0x4786c3={'count':0x0,'rows':[]};var _0x495f40=_[_0x0bfb('0x2c')](db[_0x0bfb('0x2d')][_0x0bfb('0x2e')],function(_0x19c3ee){return{'name':_0x19c3ee[_0x0bfb('0x2f')],'type':_0x19c3ee[_0x0bfb('0x30')]['key']};});_0x4da759[_0x0bfb('0x31')]=_[_0x0bfb('0x32')](_[_0x0bfb('0x2c')](_0x495f40,_0x0bfb('0x29')),[_0x0bfb('0x29')]);_0x4da759[_0x0bfb('0x33')]=_[_0x0bfb('0x34')](_0x2e8d91[_0x0bfb('0x33')]);_0x4da759[_0x0bfb('0x35')]=_['intersection'](_0x4da759[_0x0bfb('0x31')],_0x4da759[_0x0bfb('0x33')]);_0x4ef82f[_0x0bfb('0x36')]=_[_0x0bfb('0x37')](_0x4da759[_0x0bfb('0x31')],qs['fields'](_0x2e8d91[_0x0bfb('0x33')][_0x0bfb('0x38')]));_0x4ef82f[_0x0bfb('0x36')]=_0x4ef82f[_0x0bfb('0x36')]['length']?_0x4ef82f[_0x0bfb('0x36')]:_0x4da759['model'];if(!_0x2e8d91['query'][_0x0bfb('0x39')]('nolimit')){_0x4ef82f[_0x0bfb('0x1f')]=qs[_0x0bfb('0x1f')](_0x2e8d91[_0x0bfb('0x33')][_0x0bfb('0x1f')]);_0x4ef82f[_0x0bfb('0x1e')]=qs['offset'](_0x2e8d91[_0x0bfb('0x33')][_0x0bfb('0x1e')]);}_0x4ef82f['order']=qs[_0x0bfb('0x3a')](_0x2e8d91[_0x0bfb('0x33')][_0x0bfb('0x3a')]);_0x4ef82f[_0x0bfb('0x3b')]=qs[_0x0bfb('0x35')](_['pick'](_0x2e8d91['query'],_0x4da759[_0x0bfb('0x35')]),_0x495f40);if(_0x2e8d91[_0x0bfb('0x33')][_0x0bfb('0x3c')]){_0x4ef82f[_0x0bfb('0x3b')]=_[_0x0bfb('0x3d')](_0x4ef82f[_0x0bfb('0x3b')],{'$or':_[_0x0bfb('0x2c')](_0x495f40,function(_0x4fe422){if(_0x4fe422[_0x0bfb('0x30')]!==_0x0bfb('0x3e')){var _0x164ff0={};_0x164ff0[_0x4fe422['name']]={'$like':'%'+_0x2e8d91[_0x0bfb('0x33')][_0x0bfb('0x3c')]+'%'};return _0x164ff0;}})});}_0x4ef82f=_['merge']({},_0x4ef82f,_0x2e8d91[_0x0bfb('0x3f')]);var _0x559208={'where':_0x4ef82f['where']};return db[_0x0bfb('0x2d')]['count'](_0x559208)['then'](function(_0x4a0eff){_0x4786c3[_0x0bfb('0x1d')]=_0x4a0eff;if(_0x2e8d91['query'][_0x0bfb('0x40')]){_0x4ef82f[_0x0bfb('0x41')]=[{'all':!![]}];}return db[_0x0bfb('0x2d')][_0x0bfb('0x42')](_0x4ef82f);})[_0x0bfb('0x24')](function(_0x37fd1b){_0x4786c3[_0x0bfb('0x43')]=_0x37fd1b;return _0x4786c3;})['then'](respondWithFilteredResult(_0x232e37,_0x4ef82f))[_0x0bfb('0x44')](handleError(_0x232e37,null));};exports[_0x0bfb('0x45')]=function(_0x2f9ed1,_0x3eca63){var _0x3f7d19={'raw':!![],'where':{'id':_0x2f9ed1[_0x0bfb('0x46')]['id']}},_0x1ae22b={};_0x1ae22b['model']=_['keys'](db[_0x0bfb('0x2d')][_0x0bfb('0x2e')]);_0x1ae22b[_0x0bfb('0x33')]=_[_0x0bfb('0x34')](_0x2f9ed1[_0x0bfb('0x33')]);_0x1ae22b['filtears']=_[_0x0bfb('0x37')](_0x1ae22b[_0x0bfb('0x31')],_0x1ae22b[_0x0bfb('0x33')]);_0x3f7d19['attributes']=_[_0x0bfb('0x37')](_0x1ae22b['model'],qs[_0x0bfb('0x38')](_0x2f9ed1[_0x0bfb('0x33')][_0x0bfb('0x38')]));_0x3f7d19[_0x0bfb('0x36')]=_0x3f7d19['attributes'][_0x0bfb('0x47')]?_0x3f7d19['attributes']:_0x1ae22b['model'];if(_0x2f9ed1['query'][_0x0bfb('0x40')]){_0x3f7d19[_0x0bfb('0x41')]=[{'all':!![]}];}_0x3f7d19=_['merge']({},_0x3f7d19,_0x2f9ed1[_0x0bfb('0x3f')]);return db[_0x0bfb('0x2d')][_0x0bfb('0x48')](_0x3f7d19)[_0x0bfb('0x24')](handleEntityNotFound(_0x3eca63,null))[_0x0bfb('0x24')](respondWithResult(_0x3eca63,null))[_0x0bfb('0x44')](handleError(_0x3eca63,null));};exports['create']=function(_0x1d4b90,_0x43d7f2){return db[_0x0bfb('0x2d')][_0x0bfb('0x49')](_0x1d4b90[_0x0bfb('0x4a')],{})[_0x0bfb('0x24')](respondWithResult(_0x43d7f2,0xc9))['catch'](handleError(_0x43d7f2,null));};exports['update']=function(_0x1cd0df,_0x14ef1b){if(_0x1cd0df[_0x0bfb('0x4a')]['id']){delete _0x1cd0df[_0x0bfb('0x4a')]['id'];}return db[_0x0bfb('0x2d')][_0x0bfb('0x48')]({'where':{'id':_0x1cd0df['params']['id']}})[_0x0bfb('0x24')](handleEntityNotFound(_0x14ef1b,null))[_0x0bfb('0x24')](saveUpdates(_0x1cd0df[_0x0bfb('0x4a')],null))[_0x0bfb('0x24')](respondWithResult(_0x14ef1b,null))[_0x0bfb('0x44')](handleError(_0x14ef1b,null));};exports[_0x0bfb('0x25')]=function(_0x585785,_0x4f85c8){return db['VoiceMailMessage'][_0x0bfb('0x48')]({'where':{'id':_0x585785['params']['id']}})[_0x0bfb('0x24')](handleEntityNotFound(_0x4f85c8,null))['then'](removeEntity(_0x4f85c8,null))[_0x0bfb('0x44')](handleError(_0x4f85c8,null));};exports['download']=function(_0x33da43,_0x272b67,_0x50dc0c){return db[_0x0bfb('0x2d')][_0x0bfb('0x48')]({'where':{'id':_0x33da43['params']['id']},'attributes':['id',_0x0bfb('0x4b'),'msg_id']})[_0x0bfb('0x24')](handleEntityNotFound(_0x272b67,null))[_0x0bfb('0x24')](function(_0x2a1e22){if(_0x2a1e22){if(!_0x2a1e22[_0x0bfb('0x4b')]){throw new db[(_0x0bfb('0x4c'))][(_0x0bfb('0x4d'))](_0x0bfb('0x4e'));}var _0xe2c70a={'Content-Type':_0x0bfb('0x4f'),'Content-Disposition':_0x0bfb('0x50')};if(_0x2a1e22['msg_id']){_0xe2c70a[_0x0bfb('0x51')]='attachment;\x20filename=\x22'+_0x2a1e22[_0x0bfb('0x52')]+'.wav\x22';}_0x272b67[_0x0bfb('0x20')](_0xe2c70a);return _0x272b67[_0x0bfb('0x2a')](new Buffer(_0x2a1e22[_0x0bfb('0x4b')]));}})[_0x0bfb('0x44')](handleError(_0x272b67,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 6123ccf..2da4722 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 _0x94b2=['rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','dir','util','api','moment','bluebird','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x94b2,0x103));var _0x294b=function(_0x1759e0,_0x2e40bd){_0x1759e0=_0x1759e0-0x0;var _0x58bb76=_0x94b2[_0x1759e0];return _0x58bb76;};'use strict';var _=require('lodash');var util=require(_0x294b('0x0'));var logger=require('../../config/logger')(_0x294b('0x1'));var moment=require(_0x294b('0x2'));var BPromise=require(_0x294b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x294b('0x4'));var rimraf=require(_0x294b('0x5'));var config=require(_0x294b('0x6'));var attributes=require(_0x294b('0x7'));module['exports']=function(_0x4ca379,_0x46b2d5){return _0x4ca379[_0x294b('0x8')](_0x294b('0x9'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x294b('0xa'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0xc299=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','dir','lodash','util'];(function(_0x2a9748,_0x1cda69){var _0x25e4a0=function(_0x40b4ce){while(--_0x40b4ce){_0x2a9748['push'](_0x2a9748['shift']());}};_0x25e4a0(++_0x1cda69);}(_0xc299,0x6c));var _0x9c29=function(_0x430095,_0x122722){_0x430095=_0x430095-0x0;var _0x115f8a=_0xc299[_0x430095];return _0x115f8a;};'use strict';var _=require(_0x9c29('0x0'));var util=require(_0x9c29('0x1'));var logger=require(_0x9c29('0x2'))('api');var moment=require(_0x9c29('0x3'));var BPromise=require(_0x9c29('0x4'));var rp=require(_0x9c29('0x5'));var fs=require('fs');var path=require(_0x9c29('0x6'));var rimraf=require(_0x9c29('0x7'));var config=require(_0x9c29('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0x9c29('0x9')]=function(_0x4161b3,_0x4b890c){return _0x4161b3['define']('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x9c29('0xa'),'fields':[_0x9c29('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index ef06239..d690a6e 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2757fc,_0xfbd23){var _0x58efc4=function(_0x3a9f1e){while(--_0x3a9f1e){_0x2757fc['push'](_0x2757fc['shift']());}};_0x58efc4(++_0xfbd23);}(_0xadb5,0xad));var _0x5adb=function(_0x1d2af1,_0x4def85){_0x1d2af1=_0x1d2af1-0x0;var _0x3b530c=_0xadb5[_0x1d2af1];return _0x3b530c;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x3d1c06,_0x30f2e0){var _0x10c6e6=function(_0x42ee29){while(--_0x42ee29){_0x3d1c06['push'](_0x3d1c06['shift']());}};_0x10c6e6(++_0x30f2e0);}(_0x14a0,0x8e));var _0x014a=function(_0x43c158,_0x12eb07){_0x43c158=_0x43c158-0x0;var _0x11089e=_0x14a0[_0x43c158];return _0x11089e;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 33dc671..2575967 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 _0x3dae=['/:id/sounds','getSounds','post','create','addSound','put','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x3dae,0x19a));var _0xe3da=function(_0x24f9ef,_0x523275){_0x24f9ef=_0x24f9ef-0x0;var _0x6f74e3=_0x3dae[_0x24f9ef];return _0x6f74e3;};'use strict';var multer=require(_0xe3da('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe3da('0x1'));var express=require('express');var router=express[_0xe3da('0x2')]();var auth=require(_0xe3da('0x3'));var interaction=require(_0xe3da('0x4'));var config=require(_0xe3da('0x5'));var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe3da('0x6')]);router[_0xe3da('0x7')](_0xe3da('0x8'),auth[_0xe3da('0x9')](),controller['show']);router[_0xe3da('0x7')](_0xe3da('0xa'),auth[_0xe3da('0x9')](),controller[_0xe3da('0xb')]);router[_0xe3da('0xc')]('/',auth[_0xe3da('0x9')](),controller[_0xe3da('0xd')]);router['post'](_0xe3da('0xa'),auth[_0xe3da('0x9')](),controller[_0xe3da('0xe')]);router[_0xe3da('0xf')](_0xe3da('0x8'),auth[_0xe3da('0x9')](),controller['update']);router[_0xe3da('0x10')]('/:id',auth[_0xe3da('0x9')](),controller[_0xe3da('0x11')]);router['delete'](_0xe3da('0x12'),auth['isAuthenticated'](),controller[_0xe3da('0x13')]);module[_0xe3da('0x14')]=router; \ No newline at end of file +var _0xf8af=['/:id/sounds','getSounds','post','create','addSound','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show'];(function(_0x50e52c,_0x4e5097){var _0xe5ba06=function(_0x14b99a){while(--_0x14b99a){_0x50e52c['push'](_0x50e52c['shift']());}};_0xe5ba06(++_0x4e5097);}(_0xf8af,0x1ac));var _0xff8a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf8af[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xff8a('0x0'));var util=require(_0xff8a('0x1'));var path=require(_0xff8a('0x2'));var timeout=require(_0xff8a('0x3'));var express=require(_0xff8a('0x4'));var router=express['Router']();var auth=require(_0xff8a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xff8a('0x6'));router[_0xff8a('0x7')]('/',auth[_0xff8a('0x8')](),controller[_0xff8a('0x9')]);router['get'](_0xff8a('0xa'),auth[_0xff8a('0x8')](),controller[_0xff8a('0xb')]);router[_0xff8a('0x7')](_0xff8a('0xc'),auth[_0xff8a('0x8')](),controller[_0xff8a('0xd')]);router[_0xff8a('0xe')]('/',auth['isAuthenticated'](),controller[_0xff8a('0xf')]);router[_0xff8a('0xe')](_0xff8a('0xc'),auth[_0xff8a('0x8')](),controller[_0xff8a('0x10')]);router['put']('/:id',auth[_0xff8a('0x8')](),controller['update']);router[_0xff8a('0x11')](_0xff8a('0xa'),auth[_0xff8a('0x8')](),controller[_0xff8a('0x12')]);router['delete'](_0xff8a('0x13'),auth[_0xff8a('0x8')](),controller[_0xff8a('0x14')]);module[_0xff8a('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index dcd3e77..15bd3e8 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 _0x20a6=['BOOLEAN','exports','custom','mp3nb','quietmp3','mp3','files','STRING','alpha','TIMESTAMP'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x20a6,0x105));var _0x620a=function(_0x3ff0e7,_0x2f0353){_0x3ff0e7=_0x3ff0e7-0x0;var _0x5d5622=_0x20a6[_0x3ff0e7];return _0x5d5622;};'use strict';var Sequelize=require('sequelize');module[_0x620a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0x620a('0x1'),'files',_0x620a('0x2'),'quietmp3nb',_0x620a('0x3'),_0x620a('0x4')),'allowNull':!![],'defaultValue':_0x620a('0x5')},'directory':{'type':Sequelize[_0x620a('0x6')],'allowNull':!![]},'application':{'type':Sequelize[_0x620a('0x6')],'allowNull':!![]},'digit':{'type':Sequelize[_0x620a('0x6')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x620a('0x7')},'format':{'type':Sequelize[_0x620a('0x6')],'allowNull':!![]},'stamp':{'type':_0x620a('0x8')},'defaultEntry':{'type':Sequelize[_0x620a('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb1a8=['sequelize','STRING','name','ENUM','custom','mp3nb','quietmp3nb','mp3','files','alpha','TIMESTAMP'];(function(_0x42601c,_0x2a542){var _0x27668f=function(_0x14fc4f){while(--_0x14fc4f){_0x42601c['push'](_0x42601c['shift']());}};_0x27668f(++_0x2a542);}(_0xb1a8,0x1a2));var _0x8b1a=function(_0x3ca4c1,_0x404c12){_0x3ca4c1=_0x3ca4c1-0x0;var _0x566ab5=_0xb1a8[_0x3ca4c1];return _0x566ab5;};'use strict';var Sequelize=require(_0x8b1a('0x0'));module['exports']={'name':{'type':Sequelize[_0x8b1a('0x1')],'allowNull':![],'unique':_0x8b1a('0x2')},'mode':{'type':Sequelize[_0x8b1a('0x3')](_0x8b1a('0x4'),'files',_0x8b1a('0x5'),_0x8b1a('0x6'),'quietmp3',_0x8b1a('0x7')),'allowNull':!![],'defaultValue':_0x8b1a('0x8')},'directory':{'type':Sequelize[_0x8b1a('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x8b1a('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x8b1a('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x8b1a('0x1')],'allowNull':!![],'defaultValue':_0x8b1a('0x9')},'format':{'type':Sequelize[_0x8b1a('0x1')],'allowNull':!![]},'stamp':{'type':_0x8b1a('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 1e0991d..34ca251 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 _0xedf3=['rawAttributes','find','body','sequelize','transaction','mode','files','directory','join','mkdirSync','0777','user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','root','server/files/moh','symlinkSync','ValidationError','removeSound','id2','Sound','getSounds','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','apply','reject','update','then','get','UserProfileResource','destroy','error','name','map','type','model','keys','filters','intersection','query','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','findAll','rows','catch','show','params'];(function(_0x3196a6,_0x4d5a64){var _0x35baaa=function(_0x577830){while(--_0x577830){_0x3196a6['push'](_0x3196a6['shift']());}};_0x35baaa(++_0x4d5a64);}(_0xedf3,0x17a));var _0x3edf=function(_0x3e5f6d,_0x121db6){_0x3e5f6d=_0x3e5f6d-0x0;var _0x1bea6e=_0xedf3[_0x3e5f6d];return _0x1bea6e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3edf('0x0'));var rimraf=require(_0x3edf('0x1'));var zipdir=require(_0x3edf('0x2'));var jsonpatch=require(_0x3edf('0x3'));var rp=require(_0x3edf('0x4'));var moment=require(_0x3edf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3edf('0x6'));var util=require(_0x3edf('0x7'));var path=require(_0x3edf('0x8'));var sox=require(_0x3edf('0x9'));var csv=require('to-csv');var ejs=require(_0x3edf('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3edf('0xb'));var jsforce=require(_0x3edf('0xc'));var deskjs=require(_0x3edf('0xd'));var toCsv=require(_0x3edf('0xe'));var querystring=require(_0x3edf('0xf'));var Papa=require(_0x3edf('0x10'));var Redis=require(_0x3edf('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3edf('0x12'));var as=require(_0x3edf('0x13'));var hardwareService=require(_0x3edf('0x14'));var logger=require(_0x3edf('0x15'))(_0x3edf('0x16'));var utils=require(_0x3edf('0x17'));var config=require(_0x3edf('0x18'));var licenseUtil=require(_0x3edf('0x19'));var db=require(_0x3edf('0x1a'))['db'];function respondWithStatusCode(_0x5e0fea,_0x58662d){_0x58662d=_0x58662d||0xcc;return function(_0x1b7829){if(_0x1b7829){return _0x5e0fea['sendStatus'](_0x58662d);}return _0x5e0fea[_0x3edf('0x1b')](_0x58662d)[_0x3edf('0x1c')]();};}function respondWithResult(_0x5c9c75,_0x2467fb){_0x2467fb=_0x2467fb||0xc8;return function(_0x221edb){if(_0x221edb){return _0x5c9c75['status'](_0x2467fb)[_0x3edf('0x1d')](_0x221edb);}};}function respondWithFilteredResult(_0x3836f0,_0x414d26){return function(_0x45cc40){if(_0x45cc40){var _0x31874e=_0x45cc40[_0x3edf('0x1e')],_0x39df5e=_0x414d26[_0x3edf('0x1f')],_0x4d93b1=_0x414d26[_0x3edf('0x1f')]+_0x414d26['limit'],_0x3fd722;if(_0x4d93b1>=_0x31874e){_0x4d93b1=_0x31874e;_0x3fd722=0xc8;}else{_0x3fd722=0xce;}_0x3836f0[_0x3edf('0x1b')](_0x3fd722);return _0x3836f0[_0x3edf('0x20')]('Content-Range',_0x39df5e+'-'+_0x4d93b1+'/'+_0x31874e)[_0x3edf('0x1d')](_0x45cc40);}return null;};}function patchUpdates(_0x893426){return function(_0x2d18b2){try{jsonpatch[_0x3edf('0x21')](_0x2d18b2,_0x893426,!![]);}catch(_0x25eab2){return BPromise[_0x3edf('0x22')](_0x25eab2);}return _0x2d18b2['save']();};}function saveUpdates(_0x894ea7,_0x4adba8){return function(_0xd1f11c){if(_0xd1f11c){return _0xd1f11c[_0x3edf('0x23')](_0x894ea7)['then'](function(_0x250b48){return _0x250b48;});}return null;};}function removeEntity(_0x2cbae7,_0x5c64e0){return function(_0xfd0087){if(_0xfd0087){return _0xfd0087['destroy']()[_0x3edf('0x24')](function(){var _0x3ca576=_0xfd0087[_0x3edf('0x25')]({'plain':!![]});var _0x1b9dc7='MusicOnHolds';return db[_0x3edf('0x26')][_0x3edf('0x27')]({'where':{'type':_0x1b9dc7,'resourceId':_0x3ca576['id']}})['then'](function(){return _0xfd0087;});})[_0x3edf('0x24')](function(){_0x2cbae7[_0x3edf('0x1b')](0xcc)[_0x3edf('0x1c')]();});}};}function handleEntityNotFound(_0x2ba895,_0x1c8ed8){return function(_0x51ff46){if(!_0x51ff46){_0x2ba895['sendStatus'](0x194);}return _0x51ff46;};}function handleError(_0xda8de2,_0x51f357){_0x51f357=_0x51f357||0x1f4;return function(_0x5f021f){logger[_0x3edf('0x28')](_0x5f021f['stack']);if(_0x5f021f[_0x3edf('0x29')]){delete _0x5f021f[_0x3edf('0x29')];}_0xda8de2[_0x3edf('0x1b')](_0x51f357)['send'](_0x5f021f);};}exports['index']=function(_0x429e4e,_0x561951){var _0x593f8b={},_0x2b9949={},_0xbceced={'count':0x0,'rows':[]};var _0x4dd898=_[_0x3edf('0x2a')](db['VoiceMusicOnHold']['rawAttributes'],function(_0x3c381c){return{'name':_0x3c381c['fieldName'],'type':_0x3c381c[_0x3edf('0x2b')]['key']};});_0x2b9949[_0x3edf('0x2c')]=_[_0x3edf('0x2a')](_0x4dd898,_0x3edf('0x29'));_0x2b9949['query']=_[_0x3edf('0x2d')](_0x429e4e['query']);_0x2b9949[_0x3edf('0x2e')]=_[_0x3edf('0x2f')](_0x2b9949['model'],_0x2b9949[_0x3edf('0x30')]);_0x593f8b[_0x3edf('0x31')]=_['intersection'](_0x2b9949[_0x3edf('0x2c')],qs[_0x3edf('0x32')](_0x429e4e[_0x3edf('0x30')][_0x3edf('0x32')]));_0x593f8b[_0x3edf('0x31')]=_0x593f8b[_0x3edf('0x31')][_0x3edf('0x33')]?_0x593f8b[_0x3edf('0x31')]:_0x2b9949[_0x3edf('0x2c')];if(!_0x429e4e[_0x3edf('0x30')]['hasOwnProperty'](_0x3edf('0x34'))){_0x593f8b['limit']=qs[_0x3edf('0x35')](_0x429e4e[_0x3edf('0x30')][_0x3edf('0x35')]);_0x593f8b['offset']=qs[_0x3edf('0x1f')](_0x429e4e[_0x3edf('0x30')][_0x3edf('0x1f')]);}_0x593f8b[_0x3edf('0x36')]=qs[_0x3edf('0x37')](_0x429e4e[_0x3edf('0x30')][_0x3edf('0x37')]);_0x593f8b[_0x3edf('0x38')]=qs[_0x3edf('0x2e')](_[_0x3edf('0x39')](_0x429e4e[_0x3edf('0x30')],_0x2b9949[_0x3edf('0x2e')]),_0x4dd898);if(_0x429e4e[_0x3edf('0x30')][_0x3edf('0x3a')]){_0x593f8b[_0x3edf('0x38')]=_[_0x3edf('0x3b')](_0x593f8b['where'],{'$or':_[_0x3edf('0x2a')](_0x4dd898,function(_0x32dc4c){if(_0x32dc4c['type']!==_0x3edf('0x3c')){var _0x4a0f40={};_0x4a0f40[_0x32dc4c[_0x3edf('0x29')]]={'$like':'%'+_0x429e4e[_0x3edf('0x30')][_0x3edf('0x3a')]+'%'};return _0x4a0f40;}})});}_0x593f8b=_[_0x3edf('0x3b')]({},_0x593f8b,_0x429e4e[_0x3edf('0x3d')]);var _0x319708={'where':_0x593f8b[_0x3edf('0x38')]};return db[_0x3edf('0x3e')][_0x3edf('0x1e')](_0x319708)['then'](function(_0x3140bb){_0xbceced[_0x3edf('0x1e')]=_0x3140bb;if(_0x429e4e[_0x3edf('0x30')][_0x3edf('0x3f')]){_0x593f8b[_0x3edf('0x40')]=[{'all':!![]}];}return db[_0x3edf('0x3e')][_0x3edf('0x41')](_0x593f8b);})['then'](function(_0x1dc13a){_0xbceced[_0x3edf('0x42')]=_0x1dc13a;return _0xbceced;})[_0x3edf('0x24')](respondWithFilteredResult(_0x561951,_0x593f8b))[_0x3edf('0x43')](handleError(_0x561951,null));};exports[_0x3edf('0x44')]=function(_0xcb4038,_0x1a779b){var _0x49987b={'raw':![],'where':{'id':_0xcb4038[_0x3edf('0x45')]['id']}},_0x594e2b={};_0x594e2b[_0x3edf('0x2c')]=_[_0x3edf('0x2d')](db[_0x3edf('0x3e')][_0x3edf('0x46')]);_0x594e2b['query']=_['keys'](_0xcb4038[_0x3edf('0x30')]);_0x594e2b['filtears']=_[_0x3edf('0x2f')](_0x594e2b[_0x3edf('0x2c')],_0x594e2b['query']);_0x49987b[_0x3edf('0x31')]=_[_0x3edf('0x2f')](_0x594e2b[_0x3edf('0x2c')],qs[_0x3edf('0x32')](_0xcb4038[_0x3edf('0x30')]['fields']));_0x49987b[_0x3edf('0x31')]=_0x49987b[_0x3edf('0x31')][_0x3edf('0x33')]?_0x49987b['attributes']:_0x594e2b[_0x3edf('0x2c')];if(_0xcb4038[_0x3edf('0x30')]['includeAll']){_0x49987b[_0x3edf('0x40')]=[{'all':!![]}];}_0x49987b=_[_0x3edf('0x3b')]({},_0x49987b,_0xcb4038['options']);return db[_0x3edf('0x3e')][_0x3edf('0x47')](_0x49987b)[_0x3edf('0x24')](handleEntityNotFound(_0x1a779b,null))[_0x3edf('0x24')](respondWithResult(_0x1a779b,null))[_0x3edf('0x43')](handleError(_0x1a779b,null));};exports['update']=function(_0x2abea9,_0x469eb3){if(_0x2abea9['body']['id']){delete _0x2abea9[_0x3edf('0x48')]['id'];}return db[_0x3edf('0x3e')]['find']({'where':{'id':_0x2abea9[_0x3edf('0x45')]['id']}})[_0x3edf('0x24')](handleEntityNotFound(_0x469eb3,null))[_0x3edf('0x24')](saveUpdates(_0x2abea9[_0x3edf('0x48')],null))[_0x3edf('0x24')](respondWithResult(_0x469eb3,null))[_0x3edf('0x43')](handleError(_0x469eb3,null));};exports['create']=function(_0x41d5e2,_0x131e02,_0x1372a6){return db[_0x3edf('0x49')][_0x3edf('0x4a')](function(_0x55a096){if(_0x41d5e2['body'][_0x3edf('0x4b')]===_0x3edf('0x4c')){_0x41d5e2[_0x3edf('0x48')][_0x3edf('0x4d')]=path[_0x3edf('0x4e')](config['root'],'server/files/moh',_0x41d5e2[_0x3edf('0x48')][_0x3edf('0x29')]);}return db['VoiceMusicOnHold']['create'](_0x41d5e2['body'],{'transaction':_0x55a096})[_0x3edf('0x24')](function(_0x3f316d){if(_0x41d5e2[_0x3edf('0x48')][_0x3edf('0x4b')]===_0x3edf('0x4c')){fs[_0x3edf('0x4f')](_0x3f316d[_0x3edf('0x4d')],parseInt(_0x3edf('0x50'),0x8));}var _0x2dd744=_0x41d5e2[_0x3edf('0x51')]['get']({'plain':!![]});if(!_0x2dd744)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2dd744[_0x3edf('0x52')]===_0x3edf('0x51')){var _0x69c1b3=_0x3f316d[_0x3edf('0x25')]({'plain':!![]});return db[_0x3edf('0x53')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x2dd744[_0x3edf('0x54')]},'raw':!![]})[_0x3edf('0x24')](function(_0x29a5fd){if(_0x29a5fd&&_0x29a5fd['autoAssociation']===0x0){return db[_0x3edf('0x26')][_0x3edf('0x55')]({'name':_0x69c1b3[_0x3edf('0x29')],'resourceId':_0x69c1b3['id'],'type':_0x29a5fd[_0x3edf('0x29')],'sectionId':_0x29a5fd['id']},{})[_0x3edf('0x24')](function(){return _0x3f316d;});}else{return _0x3f316d;}})[_0x3edf('0x43')](function(_0x153a70){logger[_0x3edf('0x28')](_0x3edf('0x56'),_0x153a70);});}return _0x3f316d;});})[_0x3edf('0x24')](respondWithResult(_0x131e02,0xc9))[_0x3edf('0x43')](handleError(_0x131e02,null));};exports[_0x3edf('0x27')]=function(_0x18026f,_0x2d44fa,_0x492c71){var _0x18336a;return db[_0x3edf('0x3e')][_0x3edf('0x47')]({'where':{'id':_0x18026f['params']['id']}})['then'](function(_0x24b937){if(_0x24b937){return db['sequelize'][_0x3edf('0x4a')](function(_0x3b5c9a){return _0x24b937[_0x3edf('0x27')]({'transaction':_0x3b5c9a,'raw':!![]})['then'](function(_0x4ef0b5){if(_0x4ef0b5[_0x3edf('0x4d')]){fs[_0x3edf('0x57')](_0x4ef0b5[_0x3edf('0x4d')])[_0x3edf('0x58')](function(_0x2f1e83){fs[_0x3edf('0x59')](path[_0x3edf('0x4e')](_0x4ef0b5[_0x3edf('0x4d')],_0x2f1e83));});fs[_0x3edf('0x5a')](_0x4ef0b5[_0x3edf('0x4d')]);}return _0x4ef0b5;});})[_0x3edf('0x43')](function(_0x54a73a){throw new db[(_0x3edf('0x5b'))]['ValidationError'](_0x54a73a[_0x3edf('0x5c')]);});}})[_0x3edf('0x24')](handleEntityNotFound(_0x2d44fa,null))[_0x3edf('0x24')](removeEntity(_0x2d44fa,null))[_0x3edf('0x43')](handleError(_0x2d44fa,null));};exports[_0x3edf('0x5d')]=function(_0x5b5f0c,_0x36a3aa,_0x247ffa){return db[_0x3edf('0x49')][_0x3edf('0x4a')](function(_0x2124c2){var _0x439be1;return db[_0x3edf('0x3e')]['find']({'where':{'id':_0x5b5f0c[_0x3edf('0x45')]['id']}})[_0x3edf('0x24')](function(_0xa57c9b){if(_0xa57c9b){_0x439be1=_0xa57c9b;return _0xa57c9b[_0x3edf('0x5d')](_0x5b5f0c['body']['id'],{'transaction':_0x2124c2});}})[_0x3edf('0x24')](function(_0x3866aa){if(_0x3866aa){return db['Sound'][_0x3edf('0x5e')]({'where':{'id':_0x5b5f0c['body']['id']},'attributes':['id',_0x3edf('0x29'),'save_name',_0x3edf('0x5f'),_0x3edf('0x60')],'raw':!![]});}})[_0x3edf('0x24')](function(_0x434b6c){if(_0x434b6c){var _0x1b87c0=path[_0x3edf('0x4e')](config['root'],_0x3edf('0x61'),util[_0x3edf('0x62')](_0x3edf('0x63'),path[_0x3edf('0x64')](_0x434b6c[_0x3edf('0x65')],path[_0x3edf('0x66')](_0x434b6c[_0x3edf('0x65')])),_0x434b6c[_0x3edf('0x5f')]));var _0x1f1273=path[_0x3edf('0x4e')](config[_0x3edf('0x67')],_0x3edf('0x68'),_0x439be1['name'],util[_0x3edf('0x62')](_0x3edf('0x63'),_0x434b6c[_0x3edf('0x29')],_0x434b6c[_0x3edf('0x5f')]));fs[_0x3edf('0x69')](_0x1b87c0,_0x1f1273);return _0x434b6c;}})[_0x3edf('0x43')](function(_0x2082c1){throw new db[(_0x3edf('0x5b'))][(_0x3edf('0x6a'))](_0x2082c1['message']);});})[_0x3edf('0x24')](handleEntityNotFound(_0x36a3aa,null))[_0x3edf('0x24')](respondWithResult(_0x36a3aa,0xc9))[_0x3edf('0x43')](handleError(_0x36a3aa,null));};exports[_0x3edf('0x6b')]=function(_0x6a8867,_0xf9c85e,_0x1f1702){return db[_0x3edf('0x49')][_0x3edf('0x4a')](function(_0x45c543){var _0x387219;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x6a8867[_0x3edf('0x45')]['id']}})['then'](handleEntityNotFound(_0xf9c85e,null))[_0x3edf('0x24')](function(_0xa30157){if(_0xa30157){_0x387219=_0xa30157;return _0xa30157[_0x3edf('0x6b')](_0x6a8867[_0x3edf('0x45')][_0x3edf('0x6c')]);}})[_0x3edf('0x24')](function(_0x30502c){if(_0x30502c){return db[_0x3edf('0x6d')][_0x3edf('0x5e')]({'where':{'id':_0x6a8867['params'][_0x3edf('0x6c')]},'attributes':['id',_0x3edf('0x29'),_0x3edf('0x65'),_0x3edf('0x5f'),_0x3edf('0x60')],'raw':!![]});}})[_0x3edf('0x24')](function(_0x257d80){if(_0x257d80){fs[_0x3edf('0x59')](path[_0x3edf('0x4e')](_0x387219[_0x3edf('0x4d')],util[_0x3edf('0x62')]('%s.%s',_0x257d80['name'],_0x257d80[_0x3edf('0x5f')])));return _0x257d80;}})[_0x3edf('0x43')](function(_0x40d4d8){throw new db[(_0x3edf('0x5b'))]['ValidationError'](_0x40d4d8['message']);});})['then'](handleEntityNotFound(_0xf9c85e,null))[_0x3edf('0x24')](respondWithStatusCode(_0xf9c85e,0xcc))[_0x3edf('0x43')](handleError(_0xf9c85e,null));};exports[_0x3edf('0x6e')]=function(_0x1c044d,_0x364009,_0x300e18){var _0x5c9778={};var _0x3223d5={};var _0x47512d;var _0x2ba921;return db[_0x3edf('0x3e')][_0x3edf('0x5e')]({'where':{'id':_0x1c044d[_0x3edf('0x45')]['id']}})[_0x3edf('0x24')](handleEntityNotFound(_0x364009,null))['then'](function(_0x31c8f8){if(_0x31c8f8){_0x47512d=_0x31c8f8;_0x3223d5['model']=_['keys'](db[_0x3edf('0x6d')]['rawAttributes']);_0x3223d5[_0x3edf('0x30')]=_[_0x3edf('0x2d')](_0x1c044d[_0x3edf('0x30')]);_0x3223d5[_0x3edf('0x2e')]=_[_0x3edf('0x2f')](_0x3223d5[_0x3edf('0x2c')],_0x3223d5[_0x3edf('0x30')]);_0x5c9778['attributes']=_[_0x3edf('0x2f')](_0x3223d5[_0x3edf('0x2c')],qs[_0x3edf('0x32')](_0x1c044d[_0x3edf('0x30')]['fields']));_0x5c9778['attributes']=_0x5c9778['attributes'][_0x3edf('0x33')]?_0x5c9778[_0x3edf('0x31')]:_0x3223d5[_0x3edf('0x2c')];_0x5c9778[_0x3edf('0x36')]=qs[_0x3edf('0x37')](_0x1c044d[_0x3edf('0x30')][_0x3edf('0x37')]);_0x5c9778[_0x3edf('0x38')]=qs[_0x3edf('0x2e')](_[_0x3edf('0x39')](_0x1c044d['query'],_0x3223d5[_0x3edf('0x2e')]));if(_0x1c044d[_0x3edf('0x30')][_0x3edf('0x3a')]){_0x5c9778[_0x3edf('0x38')]=_[_0x3edf('0x3b')](_0x5c9778[_0x3edf('0x38')],{'$or':_[_0x3edf('0x2a')](_0x5c9778[_0x3edf('0x31')],function(_0x27ea9a){var _0x2c7f57={};_0x2c7f57[_0x27ea9a]={'$like':'%'+_0x1c044d[_0x3edf('0x30')][_0x3edf('0x3a')]+'%'};return _0x2c7f57;})});}_0x5c9778=_[_0x3edf('0x3b')]({},_0x5c9778,_0x1c044d['options']);return _0x47512d['getSounds'](_0x5c9778);}})[_0x3edf('0x24')](function(_0x5e902b){if(_0x5e902b){_0x2ba921=_0x5e902b[_0x3edf('0x33')];if(!_0x1c044d[_0x3edf('0x30')][_0x3edf('0x6f')]('nolimit')){_0x5c9778[_0x3edf('0x35')]=qs[_0x3edf('0x35')](_0x1c044d[_0x3edf('0x30')]['limit']);_0x5c9778[_0x3edf('0x1f')]=qs[_0x3edf('0x1f')](_0x1c044d[_0x3edf('0x30')][_0x3edf('0x1f')]);}return _0x47512d[_0x3edf('0x6e')](_0x5c9778);}})[_0x3edf('0x24')](function(_0x1965af){if(_0x1965af){return _0x1965af?{'count':_0x2ba921,'rows':_0x1965af}:null;}})[_0x3edf('0x24')](respondWithResult(_0x364009,null))[_0x3edf('0x43')](handleError(_0x364009,null));}; \ No newline at end of file +var _0x291f=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','forEach','unlinkSync','directory','rmdirSync','Sequelize','Sound','findOne','save_name','%s.%s','basename','extname','converted_format','root','format','symlinkSync','message','removeSound','id2','ValidationError','getSounds','html-pdf','eml-format','zip-dir','mustache','util','path','to-csv','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','MusicOnHolds','UserProfileResource','destroy','error','name','index','map','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','VoiceMusicOnHold','findAll','rows','catch','show','params','filtears','length','body','find','create','files','join','server/files/moh','mkdirSync','0777','user','get','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0xfdd66f,_0x573a80){var _0x34a6e4=function(_0x53fa0a){while(--_0x53fa0a){_0xfdd66f['push'](_0xfdd66f['shift']());}};_0x34a6e4(++_0x573a80);}(_0x291f,0x84));var _0xf291=function(_0x202211,_0x1575ec){_0x202211=_0x202211-0x0;var _0x150705=_0x291f[_0x202211];return _0x150705;};'use strict';var pdf=require(_0xf291('0x0'));var emlformat=require(_0xf291('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf291('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf291('0x3'));var util=require(_0xf291('0x4'));var path=require(_0xf291('0x5'));var sox=require('sox');var csv=require(_0xf291('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf291('0x7'));var squel=require('squel');var crypto=require(_0xf291('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf291('0x6'));var querystring=require('querystring');var Papa=require(_0xf291('0x9'));var Redis=require(_0xf291('0xa'));var authService=require(_0xf291('0xb'));var qs=require(_0xf291('0xc'));var as=require(_0xf291('0xd'));var hardwareService=require(_0xf291('0xe'));var logger=require(_0xf291('0xf'))(_0xf291('0x10'));var utils=require(_0xf291('0x11'));var config=require(_0xf291('0x12'));var licenseUtil=require(_0xf291('0x13'));var db=require(_0xf291('0x14'))['db'];function respondWithStatusCode(_0x59a8b7,_0x85b065){_0x85b065=_0x85b065||0xcc;return function(_0xffa0cd){if(_0xffa0cd){return _0x59a8b7[_0xf291('0x15')](_0x85b065);}return _0x59a8b7[_0xf291('0x16')](_0x85b065)[_0xf291('0x17')]();};}function respondWithResult(_0x308951,_0xc41de7){_0xc41de7=_0xc41de7||0xc8;return function(_0x3616cf){if(_0x3616cf){return _0x308951['status'](_0xc41de7)[_0xf291('0x18')](_0x3616cf);}};}function respondWithFilteredResult(_0x458037,_0x1fab92){return function(_0x2e2bbf){if(_0x2e2bbf){var _0x294edf=_0x2e2bbf[_0xf291('0x19')],_0x1ebc49=_0x1fab92[_0xf291('0x1a')],_0xfebd0=_0x1fab92['offset']+_0x1fab92['limit'],_0x120aff;if(_0xfebd0>=_0x294edf){_0xfebd0=_0x294edf;_0x120aff=0xc8;}else{_0x120aff=0xce;}_0x458037[_0xf291('0x16')](_0x120aff);return _0x458037['set'](_0xf291('0x1b'),_0x1ebc49+'-'+_0xfebd0+'/'+_0x294edf)['json'](_0x2e2bbf);}return null;};}function patchUpdates(_0x45142a){return function(_0x2fc893){try{jsonpatch[_0xf291('0x1c')](_0x2fc893,_0x45142a,!![]);}catch(_0x2e5501){return BPromise[_0xf291('0x1d')](_0x2e5501);}return _0x2fc893[_0xf291('0x1e')]();};}function saveUpdates(_0x392998,_0x345e85){return function(_0x353ba5){if(_0x353ba5){return _0x353ba5[_0xf291('0x1f')](_0x392998)['then'](function(_0x33eb9b){return _0x33eb9b;});}return null;};}function removeEntity(_0x177150,_0x27b97f){return function(_0x1df249){if(_0x1df249){return _0x1df249['destroy']()[_0xf291('0x20')](function(){var _0x15e3e8=_0x1df249['get']({'plain':!![]});var _0x41675f=_0xf291('0x21');return db[_0xf291('0x22')][_0xf291('0x23')]({'where':{'type':_0x41675f,'resourceId':_0x15e3e8['id']}})['then'](function(){return _0x1df249;});})[_0xf291('0x20')](function(){_0x177150['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x180577,_0x1512e5){return function(_0x475d47){if(!_0x475d47){_0x180577['sendStatus'](0x194);}return _0x475d47;};}function handleError(_0x3bd74b,_0x5cb45c){_0x5cb45c=_0x5cb45c||0x1f4;return function(_0x42c757){logger[_0xf291('0x24')](_0x42c757['stack']);if(_0x42c757[_0xf291('0x25')]){delete _0x42c757[_0xf291('0x25')];}_0x3bd74b['status'](_0x5cb45c)['send'](_0x42c757);};}exports[_0xf291('0x26')]=function(_0x21cb01,_0x550d3c){var _0x10a749={},_0x37f88e={},_0x5a066a={'count':0x0,'rows':[]};var _0x2c8c4c=_[_0xf291('0x27')](db['VoiceMusicOnHold'][_0xf291('0x28')],function(_0x322994){return{'name':_0x322994[_0xf291('0x29')],'type':_0x322994['type'][_0xf291('0x2a')]};});_0x37f88e['model']=_[_0xf291('0x27')](_0x2c8c4c,'name');_0x37f88e[_0xf291('0x2b')]=_[_0xf291('0x2c')](_0x21cb01[_0xf291('0x2b')]);_0x37f88e['filters']=_[_0xf291('0x2d')](_0x37f88e[_0xf291('0x2e')],_0x37f88e[_0xf291('0x2b')]);_0x10a749[_0xf291('0x2f')]=_[_0xf291('0x2d')](_0x37f88e['model'],qs[_0xf291('0x30')](_0x21cb01[_0xf291('0x2b')]['fields']));_0x10a749[_0xf291('0x2f')]=_0x10a749[_0xf291('0x2f')]['length']?_0x10a749[_0xf291('0x2f')]:_0x37f88e[_0xf291('0x2e')];if(!_0x21cb01[_0xf291('0x2b')][_0xf291('0x31')](_0xf291('0x32'))){_0x10a749['limit']=qs[_0xf291('0x33')](_0x21cb01[_0xf291('0x2b')][_0xf291('0x33')]);_0x10a749[_0xf291('0x1a')]=qs['offset'](_0x21cb01[_0xf291('0x2b')]['offset']);}_0x10a749[_0xf291('0x34')]=qs[_0xf291('0x35')](_0x21cb01[_0xf291('0x2b')]['sort']);_0x10a749[_0xf291('0x36')]=qs[_0xf291('0x37')](_[_0xf291('0x38')](_0x21cb01[_0xf291('0x2b')],_0x37f88e[_0xf291('0x37')]),_0x2c8c4c);if(_0x21cb01[_0xf291('0x2b')][_0xf291('0x39')]){_0x10a749[_0xf291('0x36')]=_[_0xf291('0x3a')](_0x10a749['where'],{'$or':_[_0xf291('0x27')](_0x2c8c4c,function(_0x4feeb9){if(_0x4feeb9[_0xf291('0x3b')]!==_0xf291('0x3c')){var _0x44123b={};_0x44123b[_0x4feeb9[_0xf291('0x25')]]={'$like':'%'+_0x21cb01[_0xf291('0x2b')][_0xf291('0x39')]+'%'};return _0x44123b;}})});}_0x10a749=_[_0xf291('0x3a')]({},_0x10a749,_0x21cb01[_0xf291('0x3d')]);var _0x13a3e7={'where':_0x10a749[_0xf291('0x36')]};return db['VoiceMusicOnHold'][_0xf291('0x19')](_0x13a3e7)[_0xf291('0x20')](function(_0x20a4db){_0x5a066a['count']=_0x20a4db;if(_0x21cb01['query'][_0xf291('0x3e')]){_0x10a749[_0xf291('0x3f')]=[{'all':!![]}];}return db[_0xf291('0x40')][_0xf291('0x41')](_0x10a749);})['then'](function(_0x4d2d7f){_0x5a066a[_0xf291('0x42')]=_0x4d2d7f;return _0x5a066a;})['then'](respondWithFilteredResult(_0x550d3c,_0x10a749))[_0xf291('0x43')](handleError(_0x550d3c,null));};exports[_0xf291('0x44')]=function(_0x5e8f5e,_0x3105a3){var _0x50f865={'raw':![],'where':{'id':_0x5e8f5e[_0xf291('0x45')]['id']}},_0x354c83={};_0x354c83[_0xf291('0x2e')]=_[_0xf291('0x2c')](db[_0xf291('0x40')]['rawAttributes']);_0x354c83['query']=_[_0xf291('0x2c')](_0x5e8f5e[_0xf291('0x2b')]);_0x354c83[_0xf291('0x46')]=_[_0xf291('0x2d')](_0x354c83[_0xf291('0x2e')],_0x354c83[_0xf291('0x2b')]);_0x50f865[_0xf291('0x2f')]=_['intersection'](_0x354c83[_0xf291('0x2e')],qs[_0xf291('0x30')](_0x5e8f5e[_0xf291('0x2b')][_0xf291('0x30')]));_0x50f865[_0xf291('0x2f')]=_0x50f865[_0xf291('0x2f')][_0xf291('0x47')]?_0x50f865[_0xf291('0x2f')]:_0x354c83[_0xf291('0x2e')];if(_0x5e8f5e[_0xf291('0x2b')]['includeAll']){_0x50f865[_0xf291('0x3f')]=[{'all':!![]}];}_0x50f865=_[_0xf291('0x3a')]({},_0x50f865,_0x5e8f5e[_0xf291('0x3d')]);return db[_0xf291('0x40')]['find'](_0x50f865)['then'](handleEntityNotFound(_0x3105a3,null))[_0xf291('0x20')](respondWithResult(_0x3105a3,null))[_0xf291('0x43')](handleError(_0x3105a3,null));};exports[_0xf291('0x1f')]=function(_0x3e13ea,_0x3ae1ea){if(_0x3e13ea[_0xf291('0x48')]['id']){delete _0x3e13ea['body']['id'];}return db[_0xf291('0x40')][_0xf291('0x49')]({'where':{'id':_0x3e13ea[_0xf291('0x45')]['id']}})[_0xf291('0x20')](handleEntityNotFound(_0x3ae1ea,null))[_0xf291('0x20')](saveUpdates(_0x3e13ea['body'],null))[_0xf291('0x20')](respondWithResult(_0x3ae1ea,null))[_0xf291('0x43')](handleError(_0x3ae1ea,null));};exports[_0xf291('0x4a')]=function(_0x2051fc,_0x3b9b7b,_0x36dfc7){return db['sequelize']['transaction'](function(_0xc8006c){if(_0x2051fc['body']['mode']===_0xf291('0x4b')){_0x2051fc['body']['directory']=path[_0xf291('0x4c')](config['root'],_0xf291('0x4d'),_0x2051fc[_0xf291('0x48')]['name']);}return db[_0xf291('0x40')][_0xf291('0x4a')](_0x2051fc[_0xf291('0x48')],{'transaction':_0xc8006c})['then'](function(_0x487778){if(_0x2051fc[_0xf291('0x48')]['mode']===_0xf291('0x4b')){fs[_0xf291('0x4e')](_0x487778['directory'],parseInt(_0xf291('0x4f'),0x8));}var _0x5b2a51=_0x2051fc[_0xf291('0x50')][_0xf291('0x51')]({'plain':!![]});if(!_0x5b2a51)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b2a51[_0xf291('0x52')]===_0xf291('0x50')){var _0x321123=_0x487778['get']({'plain':!![]});return db[_0xf291('0x53')][_0xf291('0x49')]({'where':{'name':_0xf291('0x21'),'userProfileId':_0x5b2a51[_0xf291('0x54')]},'raw':!![]})['then'](function(_0x40256d){if(_0x40256d&&_0x40256d[_0xf291('0x55')]===0x0){return db[_0xf291('0x22')][_0xf291('0x4a')]({'name':_0x321123['name'],'resourceId':_0x321123['id'],'type':_0x40256d['name'],'sectionId':_0x40256d['id']},{})[_0xf291('0x20')](function(){return _0x487778;});}else{return _0x487778;}})['catch'](function(_0x52a5c1){logger[_0xf291('0x24')](_0xf291('0x56'),_0x52a5c1);});}return _0x487778;});})[_0xf291('0x20')](respondWithResult(_0x3b9b7b,0xc9))['catch'](handleError(_0x3b9b7b,null));};exports['destroy']=function(_0x56d8ad,_0x1c07be,_0x159d84){var _0x24cf3a;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x56d8ad[_0xf291('0x45')]['id']}})[_0xf291('0x20')](function(_0xb9c537){if(_0xb9c537){return db[_0xf291('0x57')][_0xf291('0x58')](function(_0x1295d8){return _0xb9c537[_0xf291('0x23')]({'transaction':_0x1295d8,'raw':!![]})['then'](function(_0x15bc71){if(_0x15bc71['directory']){fs['readdirSync'](_0x15bc71['directory'])[_0xf291('0x59')](function(_0x1c89a3){fs[_0xf291('0x5a')](path[_0xf291('0x4c')](_0x15bc71[_0xf291('0x5b')],_0x1c89a3));});fs[_0xf291('0x5c')](_0x15bc71[_0xf291('0x5b')]);}return _0x15bc71;});})[_0xf291('0x43')](function(_0x26c78c){throw new db[(_0xf291('0x5d'))]['ValidationError'](_0x26c78c['message']);});}})['then'](handleEntityNotFound(_0x1c07be,null))[_0xf291('0x20')](removeEntity(_0x1c07be,null))['catch'](handleError(_0x1c07be,null));};exports['addSound']=function(_0x16d374,_0x6072d2,_0x4fff63){return db['sequelize'][_0xf291('0x58')](function(_0x51eb1b){var _0x1e2188;return db[_0xf291('0x40')][_0xf291('0x49')]({'where':{'id':_0x16d374[_0xf291('0x45')]['id']}})[_0xf291('0x20')](function(_0x21e35c){if(_0x21e35c){_0x1e2188=_0x21e35c;return _0x21e35c['addSound'](_0x16d374[_0xf291('0x48')]['id'],{'transaction':_0x51eb1b});}})[_0xf291('0x20')](function(_0x5d65ac){if(_0x5d65ac){return db[_0xf291('0x5e')][_0xf291('0x5f')]({'where':{'id':_0x16d374[_0xf291('0x48')]['id']},'attributes':['id',_0xf291('0x25'),_0xf291('0x60'),'converted_format','createdAt'],'raw':!![]});}})[_0xf291('0x20')](function(_0x550e39){if(_0x550e39){var _0x29131e=path[_0xf291('0x4c')](config['root'],'server/files/sounds/converted',util['format'](_0xf291('0x61'),path[_0xf291('0x62')](_0x550e39[_0xf291('0x60')],path[_0xf291('0x63')](_0x550e39[_0xf291('0x60')])),_0x550e39[_0xf291('0x64')]));var _0x1b66b2=path[_0xf291('0x4c')](config[_0xf291('0x65')],'server/files/moh',_0x1e2188[_0xf291('0x25')],util[_0xf291('0x66')](_0xf291('0x61'),_0x550e39[_0xf291('0x25')],_0x550e39[_0xf291('0x64')]));fs[_0xf291('0x67')](_0x29131e,_0x1b66b2);return _0x550e39;}})['catch'](function(_0x37547b){throw new db[(_0xf291('0x5d'))]['ValidationError'](_0x37547b[_0xf291('0x68')]);});})[_0xf291('0x20')](handleEntityNotFound(_0x6072d2,null))[_0xf291('0x20')](respondWithResult(_0x6072d2,0xc9))[_0xf291('0x43')](handleError(_0x6072d2,null));};exports[_0xf291('0x69')]=function(_0x2a74dc,_0x223913,_0x52bdfd){return db[_0xf291('0x57')]['transaction'](function(_0xbb21e9){var _0xe6fa3e;return db[_0xf291('0x40')][_0xf291('0x5f')]({'where':{'id':_0x2a74dc[_0xf291('0x45')]['id']}})[_0xf291('0x20')](handleEntityNotFound(_0x223913,null))[_0xf291('0x20')](function(_0x585ba2){if(_0x585ba2){_0xe6fa3e=_0x585ba2;return _0x585ba2[_0xf291('0x69')](_0x2a74dc[_0xf291('0x45')][_0xf291('0x6a')]);}})[_0xf291('0x20')](function(_0x94f324){if(_0x94f324){return db[_0xf291('0x5e')]['findOne']({'where':{'id':_0x2a74dc[_0xf291('0x45')]['id2']},'attributes':['id',_0xf291('0x25'),_0xf291('0x60'),'converted_format','createdAt'],'raw':!![]});}})[_0xf291('0x20')](function(_0xccdfe4){if(_0xccdfe4){fs['unlinkSync'](path[_0xf291('0x4c')](_0xe6fa3e[_0xf291('0x5b')],util[_0xf291('0x66')](_0xf291('0x61'),_0xccdfe4[_0xf291('0x25')],_0xccdfe4[_0xf291('0x64')])));return _0xccdfe4;}})['catch'](function(_0x278b26){throw new db[(_0xf291('0x5d'))][(_0xf291('0x6b'))](_0x278b26[_0xf291('0x68')]);});})['then'](handleEntityNotFound(_0x223913,null))['then'](respondWithStatusCode(_0x223913,0xcc))[_0xf291('0x43')](handleError(_0x223913,null));};exports[_0xf291('0x6c')]=function(_0x1dac5e,_0x5b2bc6,_0x35de96){var _0x1cfe16={};var _0x478635={};var _0xed5d14;var _0x37893c;return db['VoiceMusicOnHold'][_0xf291('0x5f')]({'where':{'id':_0x1dac5e['params']['id']}})[_0xf291('0x20')](handleEntityNotFound(_0x5b2bc6,null))[_0xf291('0x20')](function(_0x5a3539){if(_0x5a3539){_0xed5d14=_0x5a3539;_0x478635[_0xf291('0x2e')]=_[_0xf291('0x2c')](db[_0xf291('0x5e')]['rawAttributes']);_0x478635[_0xf291('0x2b')]=_[_0xf291('0x2c')](_0x1dac5e[_0xf291('0x2b')]);_0x478635['filters']=_[_0xf291('0x2d')](_0x478635['model'],_0x478635[_0xf291('0x2b')]);_0x1cfe16[_0xf291('0x2f')]=_[_0xf291('0x2d')](_0x478635[_0xf291('0x2e')],qs['fields'](_0x1dac5e[_0xf291('0x2b')][_0xf291('0x30')]));_0x1cfe16['attributes']=_0x1cfe16['attributes'][_0xf291('0x47')]?_0x1cfe16['attributes']:_0x478635[_0xf291('0x2e')];_0x1cfe16[_0xf291('0x34')]=qs[_0xf291('0x35')](_0x1dac5e[_0xf291('0x2b')][_0xf291('0x35')]);_0x1cfe16[_0xf291('0x36')]=qs[_0xf291('0x37')](_[_0xf291('0x38')](_0x1dac5e[_0xf291('0x2b')],_0x478635[_0xf291('0x37')]));if(_0x1dac5e['query'][_0xf291('0x39')]){_0x1cfe16['where']=_[_0xf291('0x3a')](_0x1cfe16[_0xf291('0x36')],{'$or':_[_0xf291('0x27')](_0x1cfe16['attributes'],function(_0x1bd1d9){var _0x14dbbe={};_0x14dbbe[_0x1bd1d9]={'$like':'%'+_0x1dac5e[_0xf291('0x2b')]['filter']+'%'};return _0x14dbbe;})});}_0x1cfe16=_[_0xf291('0x3a')]({},_0x1cfe16,_0x1dac5e[_0xf291('0x3d')]);return _0xed5d14[_0xf291('0x6c')](_0x1cfe16);}})[_0xf291('0x20')](function(_0x5ccf54){if(_0x5ccf54){_0x37893c=_0x5ccf54[_0xf291('0x47')];if(!_0x1dac5e[_0xf291('0x2b')][_0xf291('0x31')](_0xf291('0x32'))){_0x1cfe16[_0xf291('0x33')]=qs[_0xf291('0x33')](_0x1dac5e[_0xf291('0x2b')]['limit']);_0x1cfe16[_0xf291('0x1a')]=qs[_0xf291('0x1a')](_0x1dac5e[_0xf291('0x2b')][_0xf291('0x1a')]);}return _0xed5d14[_0xf291('0x6c')](_0x1cfe16);}})[_0xf291('0x20')](function(_0xd5ca51){if(_0xd5ca51){return _0xd5ca51?{'count':_0x37893c,'rows':_0xd5ca51}:null;}})[_0xf291('0x20')](respondWithResult(_0x5b2bc6,null))[_0xf291('0x43')](handleError(_0x5b2bc6,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 93fa54c..7aa5f2c 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 _0x387c=['../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','voice_musiconhold','lodash','util','api','moment','request-promise','path'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x387c,0x17b));var _0xc387=function(_0x45ae0d,_0x1ea3b9){_0x45ae0d=_0x45ae0d-0x0;var _0x371826=_0x387c[_0x45ae0d];return _0x371826;};'use strict';var _=require(_0xc387('0x0'));var util=require(_0xc387('0x1'));var logger=require('../../config/logger')(_0xc387('0x2'));var moment=require(_0xc387('0x3'));var BPromise=require('bluebird');var rp=require(_0xc387('0x4'));var fs=require('fs');var path=require(_0xc387('0x5'));var rimraf=require('rimraf');var config=require(_0xc387('0x6'));var attributes=require(_0xc387('0x7'));module[_0xc387('0x8')]=function(_0x337f7c,_0x37db67){return _0x337f7c['define'](_0xc387('0x9'),attributes,{'tableName':_0xc387('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa590=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','voice_musiconhold','lodash','util','moment'];(function(_0x43e50e,_0x3c7e25){var _0x19ef3f=function(_0x2c1330){while(--_0x2c1330){_0x43e50e['push'](_0x43e50e['shift']());}};_0x19ef3f(++_0x3c7e25);}(_0xa590,0x81));var _0x0a59=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa590[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x0a59('0x0'));var util=require(_0x0a59('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a59('0x2'));var BPromise=require(_0x0a59('0x3'));var rp=require(_0x0a59('0x4'));var fs=require('fs');var path=require(_0x0a59('0x5'));var rimraf=require(_0x0a59('0x6'));var config=require(_0x0a59('0x7'));var attributes=require(_0x0a59('0x8'));module[_0x0a59('0x9')]=function(_0x151dad,_0x13f729){return _0x151dad['define'](_0x0a59('0xa'),attributes,{'tableName':_0x0a59('0xb'),'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 f975a5e..616b8cc 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 _0xa4c3=['catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMusicOnHold,\x20%s,\x20%s','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xa4c3,0x1dc));var _0x3a4c=function(_0x1780b0,_0x1a03ab){_0x1780b0=_0x1780b0-0x0;var _0x3d2560=_0xa4c3[_0x1780b0];return _0x3d2560;};'use strict';var _=require(_0x3a4c('0x0'));var util=require(_0x3a4c('0x1'));var moment=require(_0x3a4c('0x2'));var BPromise=require(_0x3a4c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a4c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3a4c('0x5'));var logger=require(_0x3a4c('0x6'))(_0x3a4c('0x7'));var config=require(_0x3a4c('0x8'));var jayson=require(_0x3a4c('0x9'));var client=jayson[_0x3a4c('0xa')][_0x3a4c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa7fbf4,_0x245e30,_0x44a0dd){return new BPromise(function(_0x4819c0,_0x3d0592){return client[_0x3a4c('0xc')](_0xa7fbf4,_0x44a0dd)[_0x3a4c('0xd')](function(_0x4fa43b){logger['info'](_0x3a4c('0xe'),_0x245e30,'request\x20sent');logger[_0x3a4c('0xf')](_0x3a4c('0x10'),_0x245e30,'request\x20sent',JSON[_0x3a4c('0x11')](_0x4fa43b));if(_0x4fa43b[_0x3a4c('0x12')]){if(_0x4fa43b['error'][_0x3a4c('0x13')]===0x1f4){logger[_0x3a4c('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x245e30,_0x4fa43b[_0x3a4c('0x12')][_0x3a4c('0x14')]);return _0x3d0592(_0x4fa43b[_0x3a4c('0x12')][_0x3a4c('0x14')]);}logger[_0x3a4c('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x245e30,_0x4fa43b['error'][_0x3a4c('0x14')]);return _0x4819c0(_0x4fa43b[_0x3a4c('0x12')][_0x3a4c('0x14')]);}else{logger[_0x3a4c('0x15')](_0x3a4c('0xe'),_0x245e30,_0x3a4c('0x16'));_0x4819c0(_0x4fa43b[_0x3a4c('0x17')][_0x3a4c('0x14')]);}})[_0x3a4c('0x18')](function(_0x41e28b){logger[_0x3a4c('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x245e30,_0x41e28b);_0x3d0592(_0x41e28b);});});} \ No newline at end of file +var _0xe1f2=['rpc','../../config/environment','jayson/promise','http','then','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x496155,_0x1efd3b){var _0x2d7f91=function(_0x20243c){while(--_0x20243c){_0x496155['push'](_0x496155['shift']());}};_0x2d7f91(++_0x1efd3b);}(_0xe1f2,0x7d));var _0x2e1f=function(_0x4ebf6a,_0xfd0a40){_0x4ebf6a=_0x4ebf6a-0x0;var _0x1e7a72=_0xe1f2[_0x4ebf6a];return _0x1e7a72;};'use strict';var _=require('lodash');var util=require(_0x2e1f('0x0'));var moment=require(_0x2e1f('0x1'));var BPromise=require(_0x2e1f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e1f('0x3'));var db=require(_0x2e1f('0x4'))['db'];var utils=require(_0x2e1f('0x5'));var logger=require(_0x2e1f('0x6'))(_0x2e1f('0x7'));var config=require(_0x2e1f('0x8'));var jayson=require(_0x2e1f('0x9'));var client=jayson['client'][_0x2e1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc30b7c,_0x36cd3a,_0x47d613){return new BPromise(function(_0x59c204,_0x3419f3){return client['request'](_0xc30b7c,_0x47d613)[_0x2e1f('0xb')](function(_0x3a3a97){logger['info'](_0x2e1f('0xc'),_0x36cd3a,_0x2e1f('0xd'));logger[_0x2e1f('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x36cd3a,_0x2e1f('0xd'),JSON[_0x2e1f('0xf')](_0x3a3a97));if(_0x3a3a97['error']){if(_0x3a3a97[_0x2e1f('0x10')][_0x2e1f('0x11')]===0x1f4){logger[_0x2e1f('0x10')](_0x2e1f('0xc'),_0x36cd3a,_0x3a3a97[_0x2e1f('0x10')][_0x2e1f('0x12')]);return _0x3419f3(_0x3a3a97[_0x2e1f('0x10')]['message']);}logger[_0x2e1f('0x10')](_0x2e1f('0xc'),_0x36cd3a,_0x3a3a97[_0x2e1f('0x10')][_0x2e1f('0x12')]);return _0x59c204(_0x3a3a97[_0x2e1f('0x10')][_0x2e1f('0x12')]);}else{logger[_0x2e1f('0x13')](_0x2e1f('0xc'),_0x36cd3a,_0x2e1f('0xd'));_0x59c204(_0x3a3a97[_0x2e1f('0x14')][_0x2e1f('0x12')]);}})[_0x2e1f('0x15')](function(_0xe49c79){logger[_0x2e1f('0x10')](_0x2e1f('0xc'),_0x36cd3a,_0xe49c79);_0x3419f3(_0xe49c79);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index a50e145..e21cdf9 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 _0x4981=['/describe','show','create','post','/:id/users','put','/:id','update','destroy','delete','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x4981,0x1a8));var _0x1498=function(_0x4d3156,_0x2162d6){_0x4d3156=_0x4d3156-0x0;var _0x47355d=_0x4981[_0x4d3156];return _0x47355d;};'use strict';var multer=require('multer');var util=require(_0x1498('0x0'));var path=require('path');var timeout=require(_0x1498('0x1'));var express=require(_0x1498('0x2'));var router=express['Router']();var auth=require(_0x1498('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1498('0x4'));var controller=require('./voicePrefix.controller');router[_0x1498('0x5')]('/',auth[_0x1498('0x6')](),controller[_0x1498('0x7')]);router[_0x1498('0x5')](_0x1498('0x8'),auth[_0x1498('0x6')](),controller['describe']);router['get']('/:id',auth[_0x1498('0x6')](),controller[_0x1498('0x9')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x1498('0x6')](),controller[_0x1498('0xa')]);router[_0x1498('0xb')](_0x1498('0xc'),auth['isAuthenticated'](),controller['addAgents']);router[_0x1498('0xd')](_0x1498('0xe'),auth[_0x1498('0x6')](),controller[_0x1498('0xf')]);router['delete'](_0x1498('0xe'),auth[_0x1498('0x6')](),controller[_0x1498('0x10')]);router[_0x1498('0x11')](_0x1498('0xc'),auth[_0x1498('0x6')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x8062=['isAuthenticated','describe','/:id','show','post','create','/:id/users','addAgents','put','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','/describe'];(function(_0x2cfad6,_0x2d09e5){var _0x39902c=function(_0x3e1895){while(--_0x3e1895){_0x2cfad6['push'](_0x2cfad6['shift']());}};_0x39902c(++_0x2d09e5);}(_0x8062,0x9e));var _0x2806=function(_0x4839a2,_0x1f67eb){_0x4839a2=_0x4839a2-0x0;var _0x465147=_0x8062[_0x4839a2];return _0x465147;};'use strict';var multer=require('multer');var util=require(_0x2806('0x0'));var path=require(_0x2806('0x1'));var timeout=require(_0x2806('0x2'));var express=require(_0x2806('0x3'));var router=express[_0x2806('0x4')]();var auth=require(_0x2806('0x5'));var interaction=require(_0x2806('0x6'));var config=require('../../config/environment');var controller=require(_0x2806('0x7'));router[_0x2806('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2806('0x8')](_0x2806('0x9'),auth[_0x2806('0xa')](),controller[_0x2806('0xb')]);router[_0x2806('0x8')](_0x2806('0xc'),auth['isAuthenticated'](),controller[_0x2806('0xd')]);router[_0x2806('0x8')]('/:id/users',auth[_0x2806('0xa')](),controller['getAgents']);router[_0x2806('0xe')]('/',auth[_0x2806('0xa')](),controller[_0x2806('0xf')]);router[_0x2806('0xe')](_0x2806('0x10'),auth['isAuthenticated'](),controller[_0x2806('0x11')]);router[_0x2806('0x12')](_0x2806('0xc'),auth['isAuthenticated'](),controller[_0x2806('0x13')]);router[_0x2806('0x14')](_0x2806('0xc'),auth[_0x2806('0xa')](),controller[_0x2806('0x15')]);router[_0x2806('0x14')](_0x2806('0x10'),auth[_0x2806('0xa')](),controller[_0x2806('0x16')]);module[_0x2806('0x17')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index d677a00..d80babb 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 _0x1546=['exports','STRING','system-','getDataValue','name'];(function(_0x20f9ba,_0x442513){var _0x7792a5=function(_0x4884fd){while(--_0x4884fd){_0x20f9ba['push'](_0x20f9ba['shift']());}};_0x7792a5(++_0x442513);}(_0x1546,0x18b));var _0x6154=function(_0x1e7b1d,_0x3deb27){_0x1e7b1d=_0x1e7b1d-0x0;var _0x1a2712=_0x1546[_0x1e7b1d];return _0x1a2712;};'use strict';var Sequelize=require('sequelize');module[_0x6154('0x0')]={'name':{'type':Sequelize[_0x6154('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x518035){return _0x6154('0x2')+this[_0x6154('0x3')](_0x6154('0x4'))+'-';}},'description':{'type':Sequelize[_0x6154('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1298=['INTEGER','name','VIRTUAL','getDataValue','STRING'];(function(_0x3239f5,_0x50e77c){var _0x3559c8=function(_0x4f9f83){while(--_0x4f9f83){_0x3239f5['push'](_0x3239f5['shift']());}};_0x3559c8(++_0x50e77c);}(_0x1298,0x1a0));var _0x8129=function(_0x4a6d91,_0x1ca64b){_0x4a6d91=_0x4a6d91-0x0;var _0x551b93=_0x1298[_0x4a6d91];return _0x551b93;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8129('0x0')},'prefix':{'type':Sequelize[_0x8129('0x1')],'get':function(_0x502d37){return'system-'+this[_0x8129('0x2')]('name')+'-';}},'description':{'type':Sequelize[_0x8129('0x3')]},'callerIdAll':{'type':Sequelize[_0x8129('0x3')]},'VoiceExtensionId':{'type':Sequelize[_0x8129('0x4')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index e9ca172..3ac5804 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 _0xdedc=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','status','offset','limit','set','Content-Range','apply','update','then','get','VoicePrefixes','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','sort','pick','where','merge','filter','options','count','includeAll','include','findAll','catch','show','params','rawAttributes','filtears','length','find','describe','create','sequelize','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','getAgents','order','nolimit','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1a1d13,_0x32bb1e){var _0x52d7d1=function(_0x5466d5){while(--_0x5466d5){_0x1a1d13['push'](_0x1a1d13['shift']());}};_0x52d7d1(++_0x32bb1e);}(_0xdedc,0xdd));var _0xcded=function(_0x59d517,_0x166ca2){_0x59d517=_0x59d517-0x0;var _0x522a2e=_0xdedc[_0x59d517];return _0x522a2e;};'use strict';var pdf=require(_0xcded('0x0'));var emlformat=require(_0xcded('0x1'));var rimraf=require(_0xcded('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcded('0x3'));var moment=require(_0xcded('0x4'));var BPromise=require(_0xcded('0x5'));var Mustache=require(_0xcded('0x6'));var util=require('util');var path=require(_0xcded('0x7'));var sox=require(_0xcded('0x8'));var csv=require(_0xcded('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcded('0xa'));var squel=require(_0xcded('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcded('0xc'));var toCsv=require(_0xcded('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcded('0xd'));var authService=require(_0xcded('0xe'));var qs=require(_0xcded('0xf'));var as=require(_0xcded('0x10'));var hardwareService=require(_0xcded('0x11'));var logger=require(_0xcded('0x12'))(_0xcded('0x13'));var utils=require(_0xcded('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xcded('0x15'));var db=require(_0xcded('0x16'))['db'];config[_0xcded('0x17')]=_['defaults'](config[_0xcded('0x17')],{'host':_0xcded('0x18'),'port':0x18eb});var socket=require(_0xcded('0x19'))(new Redis(config[_0xcded('0x17')]));require(_0xcded('0x1a'))[_0xcded('0x1b')](socket);function respondWithStatusCode(_0x3175b0,_0x4e5049){_0x4e5049=_0x4e5049||0xcc;return function(_0x3f0b55){if(_0x3f0b55){return _0x3175b0['sendStatus'](_0x4e5049);}return _0x3175b0[_0xcded('0x1c')](_0x4e5049)['end']();};}function respondWithResult(_0x30ad30,_0x93872c){_0x93872c=_0x93872c||0xc8;return function(_0x5c581b){if(_0x5c581b){return _0x30ad30[_0xcded('0x1c')](_0x93872c)['json'](_0x5c581b);}};}function respondWithFilteredResult(_0x7cfc4f,_0x450fe3){return function(_0xc02be0){if(_0xc02be0){var _0x4efcdb=_0xc02be0['count'],_0xf133a9=_0x450fe3[_0xcded('0x1d')],_0xd9c2ee=_0x450fe3[_0xcded('0x1d')]+_0x450fe3[_0xcded('0x1e')],_0x11a0c9;if(_0xd9c2ee>=_0x4efcdb){_0xd9c2ee=_0x4efcdb;_0x11a0c9=0xc8;}else{_0x11a0c9=0xce;}_0x7cfc4f['status'](_0x11a0c9);return _0x7cfc4f[_0xcded('0x1f')](_0xcded('0x20'),_0xf133a9+'-'+_0xd9c2ee+'/'+_0x4efcdb)['json'](_0xc02be0);}return null;};}function patchUpdates(_0x24f8f1){return function(_0x361b18){try{jsonpatch[_0xcded('0x21')](_0x361b18,_0x24f8f1,!![]);}catch(_0x1b8ecb){return BPromise['reject'](_0x1b8ecb);}return _0x361b18['save']();};}function saveUpdates(_0x3d6294,_0x5d9ac9){return function(_0x173ea4){if(_0x173ea4){return _0x173ea4[_0xcded('0x22')](_0x3d6294)['then'](function(_0xc42e91){return _0xc42e91;});}return null;};}function removeEntity(_0x24c7e3,_0x15267f){return function(_0x88e92b){if(_0x88e92b){return _0x88e92b['destroy']()[_0xcded('0x23')](function(){var _0x36b384=_0x88e92b[_0xcded('0x24')]({'plain':!![]});var _0xd82ef1=_0xcded('0x25');return db[_0xcded('0x26')]['destroy']({'where':{'type':_0xd82ef1,'resourceId':_0x36b384['id']}})[_0xcded('0x23')](function(){return _0x88e92b;});})[_0xcded('0x23')](function(){_0x24c7e3[_0xcded('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27a933,_0x24447f){return function(_0x12dd6c){if(!_0x12dd6c){_0x27a933['sendStatus'](0x194);}return _0x12dd6c;};}function handleError(_0x32a1b4,_0x1055d0){_0x1055d0=_0x1055d0||0x1f4;return function(_0x1080b8){logger[_0xcded('0x27')](_0x1080b8[_0xcded('0x28')]);if(_0x1080b8[_0xcded('0x29')]){delete _0x1080b8[_0xcded('0x29')];}_0x32a1b4['status'](_0x1055d0)[_0xcded('0x2a')](_0x1080b8);};}exports[_0xcded('0x2b')]=function(_0x2d5098,_0x2dc58d){var _0x531b77={},_0x46a7fe={},_0x4a71a8={'count':0x0,'rows':[]};var _0x182f9a=_[_0xcded('0x2c')](db[_0xcded('0x2d')]['rawAttributes'],function(_0x5053e2){return{'name':_0x5053e2['fieldName'],'type':_0x5053e2[_0xcded('0x2e')][_0xcded('0x2f')]};});_0x46a7fe['model']=_[_0xcded('0x2c')](_0x182f9a,_0xcded('0x29'));_0x46a7fe[_0xcded('0x30')]=_[_0xcded('0x31')](_0x2d5098[_0xcded('0x30')]);_0x46a7fe[_0xcded('0x32')]=_[_0xcded('0x33')](_0x46a7fe[_0xcded('0x34')],_0x46a7fe[_0xcded('0x30')]);_0x531b77['attributes']=_[_0xcded('0x33')](_0x46a7fe['model'],qs[_0xcded('0x35')](_0x2d5098[_0xcded('0x30')]['fields']));_0x531b77['attributes']=_0x531b77['attributes']['length']?_0x531b77[_0xcded('0x36')]:_0x46a7fe[_0xcded('0x34')];if(!_0x2d5098[_0xcded('0x30')][_0xcded('0x37')]('nolimit')){_0x531b77[_0xcded('0x1e')]=qs[_0xcded('0x1e')](_0x2d5098[_0xcded('0x30')][_0xcded('0x1e')]);_0x531b77[_0xcded('0x1d')]=qs['offset'](_0x2d5098[_0xcded('0x30')][_0xcded('0x1d')]);}_0x531b77['order']=qs[_0xcded('0x38')](_0x2d5098['query'][_0xcded('0x38')]);_0x531b77['where']=qs[_0xcded('0x32')](_[_0xcded('0x39')](_0x2d5098[_0xcded('0x30')],_0x46a7fe[_0xcded('0x32')]),_0x182f9a);if(_0x2d5098[_0xcded('0x30')]['filter']){_0x531b77[_0xcded('0x3a')]=_[_0xcded('0x3b')](_0x531b77['where'],{'$or':_[_0xcded('0x2c')](_0x182f9a,function(_0x505226){if(_0x505226[_0xcded('0x2e')]!=='VIRTUAL'){var _0x2d2b17={};_0x2d2b17[_0x505226[_0xcded('0x29')]]={'$like':'%'+_0x2d5098[_0xcded('0x30')][_0xcded('0x3c')]+'%'};return _0x2d2b17;}})});}_0x531b77=_[_0xcded('0x3b')]({},_0x531b77,_0x2d5098[_0xcded('0x3d')]);var _0x273917={'where':_0x531b77[_0xcded('0x3a')]};return db[_0xcded('0x2d')][_0xcded('0x3e')](_0x273917)[_0xcded('0x23')](function(_0xc0dcda){_0x4a71a8[_0xcded('0x3e')]=_0xc0dcda;if(_0x2d5098[_0xcded('0x30')][_0xcded('0x3f')]){_0x531b77[_0xcded('0x40')]=[{'all':!![]}];}return db[_0xcded('0x2d')][_0xcded('0x41')](_0x531b77);})[_0xcded('0x23')](function(_0x2f9602){_0x4a71a8['rows']=_0x2f9602;return _0x4a71a8;})[_0xcded('0x23')](respondWithFilteredResult(_0x2dc58d,_0x531b77))[_0xcded('0x42')](handleError(_0x2dc58d,null));};exports[_0xcded('0x43')]=function(_0x47f28e,_0x57ac09){var _0x1f645c={'raw':![],'where':{'id':_0x47f28e[_0xcded('0x44')]['id']}},_0x2fc4a3={};_0x2fc4a3['model']=_[_0xcded('0x31')](db[_0xcded('0x2d')][_0xcded('0x45')]);_0x2fc4a3[_0xcded('0x30')]=_[_0xcded('0x31')](_0x47f28e[_0xcded('0x30')]);_0x2fc4a3[_0xcded('0x46')]=_['intersection'](_0x2fc4a3[_0xcded('0x34')],_0x2fc4a3[_0xcded('0x30')]);_0x1f645c[_0xcded('0x36')]=_['intersection'](_0x2fc4a3[_0xcded('0x34')],qs[_0xcded('0x35')](_0x47f28e['query']['fields']));_0x1f645c[_0xcded('0x36')]=_0x1f645c[_0xcded('0x36')][_0xcded('0x47')]?_0x1f645c['attributes']:_0x2fc4a3[_0xcded('0x34')];if(_0x47f28e[_0xcded('0x30')][_0xcded('0x3f')]){_0x1f645c[_0xcded('0x40')]=[{'all':!![]}];}_0x1f645c=_['merge']({},_0x1f645c,_0x47f28e['options']);return db['VoicePrefix'][_0xcded('0x48')](_0x1f645c)[_0xcded('0x23')](handleEntityNotFound(_0x57ac09,null))[_0xcded('0x23')](respondWithResult(_0x57ac09,null))[_0xcded('0x42')](handleError(_0x57ac09,null));};exports['destroy']=function(_0x3b2837,_0x18591d){return db[_0xcded('0x2d')][_0xcded('0x48')]({'where':{'id':_0x3b2837[_0xcded('0x44')]['id']}})[_0xcded('0x23')](handleEntityNotFound(_0x18591d,null))['then'](removeEntity(_0x18591d,null))['catch'](handleError(_0x18591d,null));};exports[_0xcded('0x49')]=function(_0xbcd4eb,_0x463f33){return db[_0xcded('0x2d')][_0xcded('0x49')]()[_0xcded('0x23')](respondWithResult(_0x463f33,null))[_0xcded('0x42')](handleError(_0x463f33,null));};exports[_0xcded('0x4a')]=function(_0x2a1aa8,_0x49608f){var _0x457c3c;return db[_0xcded('0x4b')]['transaction'](function(_0x324a3e){return db['VoicePrefix'][_0xcded('0x4a')](_0x2a1aa8[_0xcded('0x4c')],{'transaction':_0x324a3e})[_0xcded('0x23')](function(_0xcbe68e){_0x457c3c=_0xcbe68e[_0xcded('0x24')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x457c3c[_0xcded('0x4d')]},'raw':!![]})[_0xcded('0x23')](function(_0xc92503){return createVoicePrefixExtensions(_0x457c3c,_0xc92503,_0x324a3e);});});})[_0xcded('0x23')](function(){var _0x33aa5f=_0x2a1aa8[_0xcded('0x4e')][_0xcded('0x24')]({'plain':!![]});if(!_0x33aa5f)throw new Error(_0xcded('0x4f'));if(_0x33aa5f['role']===_0xcded('0x4e')){var _0x3e0d64=_0x457c3c;return db[_0xcded('0x50')][_0xcded('0x48')]({'where':{'name':_0xcded('0x25'),'userProfileId':_0x33aa5f['userProfileId']},'raw':!![]})[_0xcded('0x23')](function(_0x1b3fa8){if(_0x1b3fa8&&_0x1b3fa8[_0xcded('0x51')]===0x0){return db[_0xcded('0x26')]['create']({'name':_0x3e0d64[_0xcded('0x29')],'resourceId':_0x3e0d64['id'],'type':_0x1b3fa8['name'],'sectionId':_0x1b3fa8['id']},{})[_0xcded('0x23')](function(){return _0x457c3c;});}else{return _0x457c3c;}})[_0xcded('0x42')](function(_0x10f1a1){logger[_0xcded('0x27')](_0xcded('0x52'),_0x10f1a1);throw _0x10f1a1;});}return _0x457c3c;})['then'](respondWithResult(_0x49608f,null))[_0xcded('0x42')](handleError(_0x49608f,null));};function Extension(_0x3b0fda,_0x1d7b13,_0x17cb62,_0x46322a){this[_0xcded('0x53')]=_0xcded('0x54');this[_0xcded('0x55')]=_0x3b0fda;this[_0xcded('0x56')]=_0x17cb62;this[_0xcded('0x2e')]=_0xcded('0x57');this['description']=_0xcded('0x58');this[_0xcded('0x59')]=_0x1d7b13;this['appdata']=_0x46322a;}function createVoicePrefixExtensions(_0x480bac,_0x5303a5,_0x1b3e7b){return new BPromise(function(_0x27bb37,_0x280587){var _0x2df278=new Extension(formatPrefixName(_0x480bac[_0xcded('0x5a')]),0x1,_0xcded('0x5b'),'Voice\x20Prefix');_0x2df278[_0xcded('0x5c')]=_0x480bac['id'];return db['VoiceExtension'][_0xcded('0x4a')](_0x2df278,{'transaction':_0x1b3e7b})[_0xcded('0x23')](function(_0x248a4a){var _0x126713=_0x248a4a[_0xcded('0x24')]({'plain':!![]});var _0x577167=_[_0xcded('0x2c')](addVoicePrefixExtensions(_0x480bac,_0x5303a5),function(_0x219dbc){_0x219dbc[_0xcded('0x4d')]=_0x126713['id'];_0x219dbc[_0xcded('0x5c')]=_0x480bac['id'];return _0x219dbc;});return db[_0xcded('0x5d')][_0xcded('0x5e')](_0x577167,{'transaction':_0x1b3e7b})[_0xcded('0x23')](function(_0x114576){if(!_0x114576){return _0x280587(_0xcded('0x5f'));}else{return _0x27bb37(_0x114576);}})[_0xcded('0x42')](function(_0x2c4470){return _0x280587(_0x2c4470);});});;});};function addVoicePrefixExtensions(_0x437b66,_0x2ae6df){var _0x5be937=[];var _0x3f7203=formatPrefixName(_0x437b66[_0xcded('0x5a')]);_0x5be937[_0xcded('0x60')](new Extension(_0x3f7203,0x2,_0xcded('0x61'),_0xcded('0x62')+_0x437b66[_0xcded('0x29')]));if(_0x437b66['callerIdAll']){_0x5be937[_0xcded('0x60')](new Extension(_0x3f7203,0x3,_0xcded('0x61'),_0xcded('0x63')+_0x437b66[_0xcded('0x64')]));}else{_0x5be937[_0xcded('0x60')](new Extension(_0x3f7203,0x3,'NoOp',_0xcded('0x65')));}_0x5be937[_0xcded('0x60')](new Extension(_0x3f7203,0x4,_0xcded('0x66'),_0x2ae6df[_0xcded('0x53')]+','+_0xcded('0x67')+(0x8+_0x437b66[_0xcded('0x29')][_0xcded('0x47')])+'}'+','+0x1));return _0x5be937;}function formatPrefixName(_0x1186cf){var _0x138b8c='_';for(var _0x4887b9=0x0;_0x4887b9<_0x1186cf['length'];_0x4887b9++){if(_0x1186cf[_0xcded('0x68')](_0x4887b9)=='-'){_0x138b8c+=_0x1186cf[_0xcded('0x68')](_0x4887b9);}else{_0x138b8c+='['+_0x1186cf['charAt'](_0x4887b9)+']';}}_0x138b8c+='.';return _0x138b8c;}exports[_0xcded('0x22')]=function(_0x29141a,_0x122516,_0x4d631f){var _0x537d96=_0x29141a['body'];_0x537d96[_0xcded('0x5a')]=_0xcded('0x69')+_0x537d96[_0xcded('0x29')]+'-';return db[_0xcded('0x4b')][_0xcded('0x6a')](function(_0x302055){return db[_0xcded('0x2d')][_0xcded('0x22')](_0x537d96,{'where':{'id':_0x537d96['id']},'transaction':_0x302055})[_0xcded('0x23')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x537d96['id']},'transaction':_0x302055})[_0xcded('0x23')](function(){return db[_0xcded('0x5d')]['find']({'where':{'id':_0x537d96[_0xcded('0x4d')]},'raw':!![]})[_0xcded('0x23')](function(_0x50baa6){return createVoicePrefixExtensions(_0x537d96,_0x50baa6,_0x302055);});});});})[_0xcded('0x23')](function(){return db[_0xcded('0x2d')][_0xcded('0x6b')](_0x537d96['id']);})[_0xcded('0x23')](respondWithResult(_0x122516,null))[_0xcded('0x42')](handleError(_0x122516,null));};exports[_0xcded('0x6c')]=function(_0x539c9d,_0x4e9921,_0x38f406){return db['VoicePrefix'][_0xcded('0x48')]({'where':{'id':_0x539c9d[_0xcded('0x44')]['id']}})[_0xcded('0x23')](handleEntityNotFound(_0x4e9921,null))[_0xcded('0x23')](function(_0x4a08ff){if(_0x4a08ff){return _0x4a08ff[_0xcded('0x6c')](_0x539c9d[_0xcded('0x4c')][_0xcded('0x6d')],_[_0xcded('0x6e')](_0x539c9d['body'],['ids','id'])||{})[_0xcded('0x6f')](function(_0x20c7da){for(var _0x450dd7=0x0;_0x450dd7<_0x539c9d[_0xcded('0x4c')][_0xcded('0x6d')]['length'];_0x450dd7+=0x1){socket[_0xcded('0x70')](_0xcded('0x71'),{'UserId':_0x539c9d[_0xcded('0x4c')][_0xcded('0x6d')][_0x450dd7],'VoicePrefixId':_0x539c9d[_0xcded('0x44')]['id']});}return _0x20c7da;});}})[_0xcded('0x23')](respondWithResult(_0x4e9921,null))[_0xcded('0x42')](handleError(_0x4e9921,null));};exports[_0xcded('0x72')]=function(_0x5e5898,_0x517b93,_0x5f0e15){return db[_0xcded('0x2d')]['find']({'where':{'id':_0x5e5898[_0xcded('0x44')]['id']}})[_0xcded('0x23')](handleEntityNotFound(_0x517b93,null))[_0xcded('0x23')](function(_0x30e9dc){if(_0x30e9dc){return _0x30e9dc[_0xcded('0x72')](_0x5e5898[_0xcded('0x30')][_0xcded('0x6d')])[_0xcded('0x23')](function(){if(_[_0xcded('0x73')](_0x5e5898[_0xcded('0x30')][_0xcded('0x6d')])){for(var _0x2b99ed=0x0;_0x2b99ed<_0x5e5898[_0xcded('0x30')][_0xcded('0x6d')][_0xcded('0x47')];_0x2b99ed+=0x1){socket[_0xcded('0x70')]('userVoicePrefix:remove',{'UserId':Number(_0x5e5898[_0xcded('0x30')][_0xcded('0x6d')][_0x2b99ed]),'VoicePrefixId':Number(_0x5e5898[_0xcded('0x44')]['id'])});}}else{socket[_0xcded('0x70')]('userVoicePrefix:remove',{'UserId':Number(_0x5e5898['query']['ids']),'VoicePrefixId':Number(_0x5e5898[_0xcded('0x44')]['id'])});}});}})['then'](respondWithStatusCode(_0x517b93,null))[_0xcded('0x42')](handleError(_0x517b93,null));};exports[_0xcded('0x74')]=function(_0x1881f9,_0x454068,_0x3a0820){var _0x4f96df={};var _0x8a1de5={};var _0x87bcba;var _0x357649;return db[_0xcded('0x2d')]['findOne']({'where':{'id':_0x1881f9['params']['id']}})[_0xcded('0x23')](handleEntityNotFound(_0x454068,null))[_0xcded('0x23')](function(_0x5a6705){if(_0x5a6705){_0x87bcba=_0x5a6705;_0x8a1de5['model']=_[_0xcded('0x31')](db['User']['rawAttributes']);_0x8a1de5[_0xcded('0x30')]=_[_0xcded('0x31')](_0x1881f9[_0xcded('0x30')]);_0x8a1de5['filters']=_[_0xcded('0x33')](_0x8a1de5[_0xcded('0x34')],_0x8a1de5[_0xcded('0x30')]);_0x4f96df[_0xcded('0x36')]=_['intersection'](_0x8a1de5['model'],qs[_0xcded('0x35')](_0x1881f9[_0xcded('0x30')][_0xcded('0x35')]));_0x4f96df[_0xcded('0x36')]=_0x4f96df['attributes'][_0xcded('0x47')]?_0x4f96df['attributes']:_0x8a1de5['model'];_0x4f96df[_0xcded('0x75')]=qs['sort'](_0x1881f9[_0xcded('0x30')][_0xcded('0x38')]);_0x4f96df['where']=qs[_0xcded('0x32')](_['pick'](_0x1881f9[_0xcded('0x30')],_0x8a1de5[_0xcded('0x32')]));if(_0x1881f9['query'][_0xcded('0x3c')]){_0x4f96df['where']=_[_0xcded('0x3b')](_0x4f96df[_0xcded('0x3a')],{'$or':_[_0xcded('0x2c')](_0x4f96df[_0xcded('0x36')],function(_0x130dc5){var _0x3072dd={};_0x3072dd[_0x130dc5]={'$like':'%'+_0x1881f9['query'][_0xcded('0x3c')]+'%'};return _0x3072dd;})});}_0x4f96df=_[_0xcded('0x3b')]({},_0x4f96df,_0x1881f9[_0xcded('0x3d')]);return _0x87bcba[_0xcded('0x74')](_0x4f96df);}})['then'](function(_0x111e3a){if(_0x111e3a){_0x357649=_0x111e3a['length'];if(!_0x1881f9[_0xcded('0x30')][_0xcded('0x37')](_0xcded('0x76'))){_0x4f96df[_0xcded('0x1e')]=qs[_0xcded('0x1e')](_0x1881f9[_0xcded('0x30')][_0xcded('0x1e')]);_0x4f96df[_0xcded('0x1d')]=qs['offset'](_0x1881f9[_0xcded('0x30')][_0xcded('0x1d')]);}return _0x87bcba[_0xcded('0x74')](_0x4f96df);}})['then'](function(_0x179619){if(_0x179619){return _0x179619?{'count':_0x357649,'rows':_0x179619}:null;}})[_0xcded('0x23')](respondWithResult(_0x454068,null))['catch'](handleError(_0x454068,null));}; \ No newline at end of file +var _0x474d=['fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','params','filtears','fields','find','describe','create','sequelize','body','get','VoiceExtensionId','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','appdata','NoOp','Voice\x20Prefix','VoiceExtension','VoicePrefixId','bulkCreate','prefix','push','Set','CDR(prefix)=','callerIdAll','charAt','update','system-','transaction','findById','addAgents','ids','omit','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','order','html-pdf','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','end','status','json','offset','set','Content-Range','apply','save','then','destroy','VoicePrefixes','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x474d,0x13a));var _0xd474=function(_0x4dc3a2,_0x1092c4){_0x4dc3a2=_0x4dc3a2-0x0;var _0x240f93=_0x474d[_0x4dc3a2];return _0x240f93;};'use strict';var pdf=require(_0xd474('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd474('0x1'));var jsonpatch=require(_0xd474('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd474('0x3'));var util=require(_0xd474('0x4'));var path=require(_0xd474('0x5'));var sox=require(_0xd474('0x6'));var csv=require('to-csv');var ejs=require(_0xd474('0x7'));var fs=require('fs');var _=require(_0xd474('0x8'));var squel=require('squel');var crypto=require(_0xd474('0x9'));var jsforce=require(_0xd474('0xa'));var deskjs=require(_0xd474('0xb'));var toCsv=require(_0xd474('0xc'));var querystring=require(_0xd474('0xd'));var Papa=require(_0xd474('0xe'));var Redis=require(_0xd474('0xf'));var authService=require(_0xd474('0x10'));var qs=require(_0xd474('0x11'));var as=require(_0xd474('0x12'));var hardwareService=require(_0xd474('0x13'));var logger=require(_0xd474('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xd474('0x15'));var licenseUtil=require(_0xd474('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xd474('0x17')],{'host':_0xd474('0x18'),'port':0x18eb});var socket=require(_0xd474('0x19'))(new Redis(config[_0xd474('0x17')]));require(_0xd474('0x1a'))[_0xd474('0x1b')](socket);function respondWithStatusCode(_0x3c76ce,_0x22d1e6){_0x22d1e6=_0x22d1e6||0xcc;return function(_0x2a6eb4){if(_0x2a6eb4){return _0x3c76ce[_0xd474('0x1c')](_0x22d1e6);}return _0x3c76ce['status'](_0x22d1e6)[_0xd474('0x1d')]();};}function respondWithResult(_0x4ecc09,_0x45c61c){_0x45c61c=_0x45c61c||0xc8;return function(_0x2f0bc9){if(_0x2f0bc9){return _0x4ecc09[_0xd474('0x1e')](_0x45c61c)[_0xd474('0x1f')](_0x2f0bc9);}};}function respondWithFilteredResult(_0x27d4ee,_0xc6a986){return function(_0x35f02b){if(_0x35f02b){var _0x57e36d=_0x35f02b['count'],_0x1ef53f=_0xc6a986[_0xd474('0x20')],_0x51f634=_0xc6a986[_0xd474('0x20')]+_0xc6a986['limit'],_0x418ae6;if(_0x51f634>=_0x57e36d){_0x51f634=_0x57e36d;_0x418ae6=0xc8;}else{_0x418ae6=0xce;}_0x27d4ee['status'](_0x418ae6);return _0x27d4ee[_0xd474('0x21')](_0xd474('0x22'),_0x1ef53f+'-'+_0x51f634+'/'+_0x57e36d)['json'](_0x35f02b);}return null;};}function patchUpdates(_0x34c1ab){return function(_0x31ce9f){try{jsonpatch[_0xd474('0x23')](_0x31ce9f,_0x34c1ab,!![]);}catch(_0x21810f){return BPromise['reject'](_0x21810f);}return _0x31ce9f[_0xd474('0x24')]();};}function saveUpdates(_0x19c4ab,_0x23ab82){return function(_0x3fc30a){if(_0x3fc30a){return _0x3fc30a['update'](_0x19c4ab)[_0xd474('0x25')](function(_0x526e74){return _0x526e74;});}return null;};}function removeEntity(_0x55793e,_0xe21bd){return function(_0x2b3d69){if(_0x2b3d69){return _0x2b3d69[_0xd474('0x26')]()[_0xd474('0x25')](function(){var _0x5d890e=_0x2b3d69['get']({'plain':!![]});var _0x47f0a6=_0xd474('0x27');return db[_0xd474('0x28')][_0xd474('0x26')]({'where':{'type':_0x47f0a6,'resourceId':_0x5d890e['id']}})['then'](function(){return _0x2b3d69;});})[_0xd474('0x25')](function(){_0x55793e[_0xd474('0x1e')](0xcc)[_0xd474('0x1d')]();});}};}function handleEntityNotFound(_0x3cbe08,_0x2223de){return function(_0x252bbf){if(!_0x252bbf){_0x3cbe08[_0xd474('0x1c')](0x194);}return _0x252bbf;};}function handleError(_0x5568f6,_0x46ce45){_0x46ce45=_0x46ce45||0x1f4;return function(_0x2eee10){logger[_0xd474('0x29')](_0x2eee10[_0xd474('0x2a')]);if(_0x2eee10[_0xd474('0x2b')]){delete _0x2eee10[_0xd474('0x2b')];}_0x5568f6[_0xd474('0x1e')](_0x46ce45)[_0xd474('0x2c')](_0x2eee10);};}exports[_0xd474('0x2d')]=function(_0x470b5e,_0x274a57){var _0x23259c={},_0x499889={},_0x413d79={'count':0x0,'rows':[]};var _0x3cea13=_[_0xd474('0x2e')](db[_0xd474('0x2f')][_0xd474('0x30')],function(_0x16c929){return{'name':_0x16c929[_0xd474('0x31')],'type':_0x16c929[_0xd474('0x32')][_0xd474('0x33')]};});_0x499889[_0xd474('0x34')]=_[_0xd474('0x2e')](_0x3cea13,_0xd474('0x2b'));_0x499889['query']=_[_0xd474('0x35')](_0x470b5e[_0xd474('0x36')]);_0x499889[_0xd474('0x37')]=_[_0xd474('0x38')](_0x499889['model'],_0x499889[_0xd474('0x36')]);_0x23259c[_0xd474('0x39')]=_[_0xd474('0x38')](_0x499889[_0xd474('0x34')],qs['fields'](_0x470b5e[_0xd474('0x36')]['fields']));_0x23259c['attributes']=_0x23259c[_0xd474('0x39')][_0xd474('0x3a')]?_0x23259c['attributes']:_0x499889[_0xd474('0x34')];if(!_0x470b5e['query'][_0xd474('0x3b')](_0xd474('0x3c'))){_0x23259c[_0xd474('0x3d')]=qs['limit'](_0x470b5e[_0xd474('0x36')][_0xd474('0x3d')]);_0x23259c[_0xd474('0x20')]=qs[_0xd474('0x20')](_0x470b5e[_0xd474('0x36')]['offset']);}_0x23259c['order']=qs[_0xd474('0x3e')](_0x470b5e[_0xd474('0x36')][_0xd474('0x3e')]);_0x23259c[_0xd474('0x3f')]=qs[_0xd474('0x37')](_[_0xd474('0x40')](_0x470b5e['query'],_0x499889[_0xd474('0x37')]),_0x3cea13);if(_0x470b5e[_0xd474('0x36')][_0xd474('0x41')]){_0x23259c[_0xd474('0x3f')]=_['merge'](_0x23259c[_0xd474('0x3f')],{'$or':_[_0xd474('0x2e')](_0x3cea13,function(_0x5ba9a0){if(_0x5ba9a0[_0xd474('0x32')]!=='VIRTUAL'){var _0x16b631={};_0x16b631[_0x5ba9a0[_0xd474('0x2b')]]={'$like':'%'+_0x470b5e['query'][_0xd474('0x41')]+'%'};return _0x16b631;}})});}_0x23259c=_[_0xd474('0x42')]({},_0x23259c,_0x470b5e[_0xd474('0x43')]);var _0x1493cc={'where':_0x23259c[_0xd474('0x3f')]};return db[_0xd474('0x2f')][_0xd474('0x44')](_0x1493cc)[_0xd474('0x25')](function(_0x498faa){_0x413d79[_0xd474('0x44')]=_0x498faa;if(_0x470b5e[_0xd474('0x36')][_0xd474('0x45')]){_0x23259c[_0xd474('0x46')]=[{'all':!![]}];}return db['VoicePrefix'][_0xd474('0x47')](_0x23259c);})[_0xd474('0x25')](function(_0x325f0c){_0x413d79[_0xd474('0x48')]=_0x325f0c;return _0x413d79;})[_0xd474('0x25')](respondWithFilteredResult(_0x274a57,_0x23259c))[_0xd474('0x49')](handleError(_0x274a57,null));};exports['show']=function(_0x548a12,_0x3ca43c){var _0x4d37b={'raw':![],'where':{'id':_0x548a12[_0xd474('0x4a')]['id']}},_0x5bb3a5={};_0x5bb3a5[_0xd474('0x34')]=_[_0xd474('0x35')](db[_0xd474('0x2f')][_0xd474('0x30')]);_0x5bb3a5[_0xd474('0x36')]=_[_0xd474('0x35')](_0x548a12['query']);_0x5bb3a5[_0xd474('0x4b')]=_[_0xd474('0x38')](_0x5bb3a5[_0xd474('0x34')],_0x5bb3a5[_0xd474('0x36')]);_0x4d37b[_0xd474('0x39')]=_[_0xd474('0x38')](_0x5bb3a5[_0xd474('0x34')],qs[_0xd474('0x4c')](_0x548a12[_0xd474('0x36')][_0xd474('0x4c')]));_0x4d37b[_0xd474('0x39')]=_0x4d37b[_0xd474('0x39')]['length']?_0x4d37b['attributes']:_0x5bb3a5[_0xd474('0x34')];if(_0x548a12[_0xd474('0x36')][_0xd474('0x45')]){_0x4d37b['include']=[{'all':!![]}];}_0x4d37b=_[_0xd474('0x42')]({},_0x4d37b,_0x548a12[_0xd474('0x43')]);return db['VoicePrefix'][_0xd474('0x4d')](_0x4d37b)[_0xd474('0x25')](handleEntityNotFound(_0x3ca43c,null))[_0xd474('0x25')](respondWithResult(_0x3ca43c,null))[_0xd474('0x49')](handleError(_0x3ca43c,null));};exports['destroy']=function(_0x7038e1,_0x21ce4c){return db[_0xd474('0x2f')][_0xd474('0x4d')]({'where':{'id':_0x7038e1['params']['id']}})[_0xd474('0x25')](handleEntityNotFound(_0x21ce4c,null))[_0xd474('0x25')](removeEntity(_0x21ce4c,null))[_0xd474('0x49')](handleError(_0x21ce4c,null));};exports['describe']=function(_0x146a39,_0x5ed146){return db['VoicePrefix'][_0xd474('0x4e')]()[_0xd474('0x25')](respondWithResult(_0x5ed146,null))[_0xd474('0x49')](handleError(_0x5ed146,null));};exports[_0xd474('0x4f')]=function(_0x5e784f,_0xc411be){var _0xda9ba0;return db[_0xd474('0x50')]['transaction'](function(_0x29aec7){return db['VoicePrefix']['create'](_0x5e784f[_0xd474('0x51')],{'transaction':_0x29aec7})[_0xd474('0x25')](function(_0x1e6e40){_0xda9ba0=_0x1e6e40[_0xd474('0x52')]({'plain':!![]});return db['VoiceExtension'][_0xd474('0x4d')]({'where':{'id':_0xda9ba0[_0xd474('0x53')]},'raw':!![]})[_0xd474('0x25')](function(_0x224082){return createVoicePrefixExtensions(_0xda9ba0,_0x224082,_0x29aec7);});});})['then'](function(){var _0x57ec20=_0x5e784f[_0xd474('0x54')]['get']({'plain':!![]});if(!_0x57ec20)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57ec20[_0xd474('0x55')]===_0xd474('0x54')){var _0x4fd30d=_0xda9ba0;return db[_0xd474('0x56')][_0xd474('0x4d')]({'where':{'name':_0xd474('0x27'),'userProfileId':_0x57ec20[_0xd474('0x57')]},'raw':!![]})[_0xd474('0x25')](function(_0x1142f0){if(_0x1142f0&&_0x1142f0['autoAssociation']===0x0){return db[_0xd474('0x28')]['create']({'name':_0x4fd30d[_0xd474('0x2b')],'resourceId':_0x4fd30d['id'],'type':_0x1142f0[_0xd474('0x2b')],'sectionId':_0x1142f0['id']},{})[_0xd474('0x25')](function(){return _0xda9ba0;});}else{return _0xda9ba0;}})[_0xd474('0x49')](function(_0x512299){logger[_0xd474('0x29')](_0xd474('0x58'),_0x512299);throw _0x512299;});}return _0xda9ba0;})[_0xd474('0x25')](respondWithResult(_0xc411be,null))[_0xd474('0x49')](handleError(_0xc411be,null));};function Extension(_0x6f1782,_0x508ec3,_0x46a643,_0x44cc9b){this[_0xd474('0x59')]=_0xd474('0x5a');this[_0xd474('0x5b')]=_0x6f1782;this['app']=_0x46a643;this['type']=_0xd474('0x5c');this['description']='Voice\x20Prefix\x20Extension';this['priority']=_0x508ec3;this[_0xd474('0x5d')]=_0x44cc9b;}function createVoicePrefixExtensions(_0x3bad74,_0x26ca8b,_0x535cc1){return new BPromise(function(_0x5af1f3,_0x5f0422){var _0x4f2aef=new Extension(formatPrefixName(_0x3bad74['prefix']),0x1,_0xd474('0x5e'),_0xd474('0x5f'));_0x4f2aef['VoicePrefixId']=_0x3bad74['id'];return db[_0xd474('0x60')][_0xd474('0x4f')](_0x4f2aef,{'transaction':_0x535cc1})['then'](function(_0x8a74c1){var _0x44ca0e=_0x8a74c1[_0xd474('0x52')]({'plain':!![]});var _0xd6bd04=_['map'](addVoicePrefixExtensions(_0x3bad74,_0x26ca8b),function(_0x48d020){_0x48d020['VoiceExtensionId']=_0x44ca0e['id'];_0x48d020[_0xd474('0x61')]=_0x3bad74['id'];return _0x48d020;});return db['VoiceExtension'][_0xd474('0x62')](_0xd6bd04,{'transaction':_0x535cc1})[_0xd474('0x25')](function(_0x213690){if(!_0x213690){return _0x5f0422('Extensions\x20creation\x20failed');}else{return _0x5af1f3(_0x213690);}})['catch'](function(_0xe2d7a7){return _0x5f0422(_0xe2d7a7);});});;});};function addVoicePrefixExtensions(_0x5c2607,_0xd65977){var _0x444e1b=[];var _0x5b78df=formatPrefixName(_0x5c2607[_0xd474('0x63')]);_0x444e1b[_0xd474('0x64')](new Extension(_0x5b78df,0x2,_0xd474('0x65'),_0xd474('0x66')+_0x5c2607[_0xd474('0x2b')]));if(_0x5c2607[_0xd474('0x67')]){_0x444e1b[_0xd474('0x64')](new Extension(_0x5b78df,0x3,_0xd474('0x65'),'PREFIX-CALLERIDALL='+_0x5c2607['callerIdAll']));}else{_0x444e1b[_0xd474('0x64')](new Extension(_0x5b78df,0x3,_0xd474('0x5e'),'No\x20callerid\x20available'));}_0x444e1b[_0xd474('0x64')](new Extension(_0x5b78df,0x4,'goto',_0xd65977[_0xd474('0x59')]+','+'${EXTEN:'+(0x8+_0x5c2607[_0xd474('0x2b')][_0xd474('0x3a')])+'}'+','+0x1));return _0x444e1b;}function formatPrefixName(_0x198b60){var _0x4d9cfc='_';for(var _0x44d952=0x0;_0x44d952<_0x198b60['length'];_0x44d952++){if(_0x198b60[_0xd474('0x68')](_0x44d952)=='-'){_0x4d9cfc+=_0x198b60['charAt'](_0x44d952);}else{_0x4d9cfc+='['+_0x198b60[_0xd474('0x68')](_0x44d952)+']';}}_0x4d9cfc+='.';return _0x4d9cfc;}exports[_0xd474('0x69')]=function(_0x32de9c,_0x1a2532,_0x14ab1a){var _0x4446bc=_0x32de9c[_0xd474('0x51')];_0x4446bc[_0xd474('0x63')]=_0xd474('0x6a')+_0x4446bc[_0xd474('0x2b')]+'-';return db[_0xd474('0x50')][_0xd474('0x6b')](function(_0x3edeeb){return db[_0xd474('0x2f')][_0xd474('0x69')](_0x4446bc,{'where':{'id':_0x4446bc['id']},'transaction':_0x3edeeb})[_0xd474('0x25')](function(){return db[_0xd474('0x60')]['destroy']({'where':{'VoicePrefixId':_0x4446bc['id']},'transaction':_0x3edeeb})[_0xd474('0x25')](function(){return db[_0xd474('0x60')][_0xd474('0x4d')]({'where':{'id':_0x4446bc[_0xd474('0x53')]},'raw':!![]})[_0xd474('0x25')](function(_0x8d4fe1){return createVoicePrefixExtensions(_0x4446bc,_0x8d4fe1,_0x3edeeb);});});});})[_0xd474('0x25')](function(){return db['VoicePrefix'][_0xd474('0x6c')](_0x4446bc['id']);})[_0xd474('0x25')](respondWithResult(_0x1a2532,null))[_0xd474('0x49')](handleError(_0x1a2532,null));};exports[_0xd474('0x6d')]=function(_0x44797f,_0x1e80a5,_0x1cfacc){return db[_0xd474('0x2f')][_0xd474('0x4d')]({'where':{'id':_0x44797f[_0xd474('0x4a')]['id']}})[_0xd474('0x25')](handleEntityNotFound(_0x1e80a5,null))[_0xd474('0x25')](function(_0x4e3075){if(_0x4e3075){return _0x4e3075[_0xd474('0x6d')](_0x44797f['body'][_0xd474('0x6e')],_[_0xd474('0x6f')](_0x44797f[_0xd474('0x51')],['ids','id'])||{})[_0xd474('0x70')](function(_0x2b0015){for(var _0x3c524a=0x0;_0x3c524a<_0x44797f['body'][_0xd474('0x6e')][_0xd474('0x3a')];_0x3c524a+=0x1){socket[_0xd474('0x71')]('userVoicePrefix:save',{'UserId':_0x44797f[_0xd474('0x51')][_0xd474('0x6e')][_0x3c524a],'VoicePrefixId':_0x44797f[_0xd474('0x4a')]['id']});}return _0x2b0015;});}})[_0xd474('0x25')](respondWithResult(_0x1e80a5,null))[_0xd474('0x49')](handleError(_0x1e80a5,null));};exports[_0xd474('0x72')]=function(_0x5b35f5,_0x28cdb8,_0x130a74){return db[_0xd474('0x2f')][_0xd474('0x4d')]({'where':{'id':_0x5b35f5[_0xd474('0x4a')]['id']}})[_0xd474('0x25')](handleEntityNotFound(_0x28cdb8,null))['then'](function(_0x51ee80){if(_0x51ee80){return _0x51ee80[_0xd474('0x72')](_0x5b35f5[_0xd474('0x36')][_0xd474('0x6e')])[_0xd474('0x25')](function(){if(_[_0xd474('0x73')](_0x5b35f5['query'][_0xd474('0x6e')])){for(var _0x53368d=0x0;_0x53368d<_0x5b35f5[_0xd474('0x36')][_0xd474('0x6e')][_0xd474('0x3a')];_0x53368d+=0x1){socket[_0xd474('0x71')](_0xd474('0x74'),{'UserId':Number(_0x5b35f5['query'][_0xd474('0x6e')][_0x53368d]),'VoicePrefixId':Number(_0x5b35f5[_0xd474('0x4a')]['id'])});}}else{socket[_0xd474('0x71')]('userVoicePrefix:remove',{'UserId':Number(_0x5b35f5[_0xd474('0x36')][_0xd474('0x6e')]),'VoicePrefixId':Number(_0x5b35f5[_0xd474('0x4a')]['id'])});}});}})[_0xd474('0x25')](respondWithStatusCode(_0x28cdb8,null))[_0xd474('0x49')](handleError(_0x28cdb8,null));};exports[_0xd474('0x75')]=function(_0x48decb,_0xb0e242,_0x52fe97){var _0x5747b5={};var _0x3a320f={};var _0x1c5497;var _0x5759b9;return db['VoicePrefix'][_0xd474('0x76')]({'where':{'id':_0x48decb[_0xd474('0x4a')]['id']}})[_0xd474('0x25')](handleEntityNotFound(_0xb0e242,null))[_0xd474('0x25')](function(_0x4b169a){if(_0x4b169a){_0x1c5497=_0x4b169a;_0x3a320f['model']=_[_0xd474('0x35')](db[_0xd474('0x77')][_0xd474('0x30')]);_0x3a320f[_0xd474('0x36')]=_[_0xd474('0x35')](_0x48decb['query']);_0x3a320f[_0xd474('0x37')]=_[_0xd474('0x38')](_0x3a320f[_0xd474('0x34')],_0x3a320f[_0xd474('0x36')]);_0x5747b5[_0xd474('0x39')]=_['intersection'](_0x3a320f[_0xd474('0x34')],qs['fields'](_0x48decb['query']['fields']));_0x5747b5[_0xd474('0x39')]=_0x5747b5[_0xd474('0x39')][_0xd474('0x3a')]?_0x5747b5['attributes']:_0x3a320f[_0xd474('0x34')];_0x5747b5[_0xd474('0x78')]=qs['sort'](_0x48decb[_0xd474('0x36')][_0xd474('0x3e')]);_0x5747b5[_0xd474('0x3f')]=qs[_0xd474('0x37')](_[_0xd474('0x40')](_0x48decb[_0xd474('0x36')],_0x3a320f[_0xd474('0x37')]));if(_0x48decb[_0xd474('0x36')][_0xd474('0x41')]){_0x5747b5[_0xd474('0x3f')]=_['merge'](_0x5747b5[_0xd474('0x3f')],{'$or':_[_0xd474('0x2e')](_0x5747b5[_0xd474('0x39')],function(_0xc9ff1f){var _0x4b5246={};_0x4b5246[_0xc9ff1f]={'$like':'%'+_0x48decb[_0xd474('0x36')][_0xd474('0x41')]+'%'};return _0x4b5246;})});}_0x5747b5=_[_0xd474('0x42')]({},_0x5747b5,_0x48decb[_0xd474('0x43')]);return _0x1c5497[_0xd474('0x75')](_0x5747b5);}})[_0xd474('0x25')](function(_0x36cc3b){if(_0x36cc3b){_0x5759b9=_0x36cc3b[_0xd474('0x3a')];if(!_0x48decb[_0xd474('0x36')]['hasOwnProperty'](_0xd474('0x3c'))){_0x5747b5[_0xd474('0x3d')]=qs[_0xd474('0x3d')](_0x48decb['query']['limit']);_0x5747b5['offset']=qs[_0xd474('0x20')](_0x48decb[_0xd474('0x36')][_0xd474('0x20')]);}return _0x1c5497[_0xd474('0x75')](_0x5747b5);}})[_0xd474('0x25')](function(_0x137444){if(_0x137444){return _0x137444?{'count':_0x5759b9,'rows':_0x137444}:null;}})[_0xd474('0x25')](respondWithResult(_0xb0e242,null))['catch'](handleError(_0xb0e242,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 0180c78..a38d40a 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xedd9,0xfc));var _0x9edd=function(_0x4ed8f5,_0x17fe22){_0x4ed8f5=_0x4ed8f5-0x0;var _0x1c1743=_0xedd9[_0x4ed8f5];return _0x1c1743;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x9edd('0x0'))['db'][_0x9edd('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9edd('0x2')](0x0);var events={'afterCreate':_0x9edd('0x3'),'afterUpdate':_0x9edd('0x4'),'afterDestroy':_0x9edd('0x5')};function emitEvent(_0x3e6d3a){return function(_0x36b53f,_0x5943b3,_0x33679f){VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a+':'+_0x36b53f['id'],_0x36b53f);VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a,_0x36b53f);_0x33679f(null);};}for(var e in events){if(events[_0x9edd('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x9edd('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xcb91=['save','update','emit','hasOwnProperty','hook','VoicePrefix','setMaxListeners'];(function(_0x2f1f85,_0xfe33ae){var _0xdf43b3=function(_0x2392de){while(--_0x2392de){_0x2f1f85['push'](_0x2f1f85['shift']());}};_0xdf43b3(++_0xfe33ae);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0xcb91[_0x466bc5];return _0x138952;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x1cb9('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x1cb9('0x1')](0x0);var events={'afterCreate':_0x1cb9('0x2'),'afterUpdate':_0x1cb9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8c392f){return function(_0x2c17b8,_0x545a34,_0x13d5fd){VoicePrefixEvents[_0x1cb9('0x4')](_0x8c392f+':'+_0x2c17b8['id'],_0x2c17b8);VoicePrefixEvents['emit'](_0x8c392f,_0x2c17b8);_0x13d5fd(null);};}for(var e in events){if(events[_0x1cb9('0x5')](e)){var event=events[e];VoicePrefix[_0x1cb9('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 28daf3b..07f3dcc 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 _0xcc30=['./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','moment','bluebird','../../config/environment'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xcc30,0x16c));var _0x0cc3=function(_0xbc1a4b,_0x4dfbe4){_0xbc1a4b=_0xbc1a4b-0x0;var _0x108b87=_0xcc30[_0xbc1a4b];return _0x108b87;};'use strict';var _=require(_0x0cc3('0x0'));var util=require(_0x0cc3('0x1'));var logger=require(_0x0cc3('0x2'))('api');var moment=require(_0x0cc3('0x3'));var BPromise=require(_0x0cc3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0cc3('0x5'));var attributes=require(_0x0cc3('0x6'));module['exports']=function(_0x376e5f,_0x123d88){return _0x376e5f[_0x0cc3('0x7')](_0x0cc3('0x8'),attributes,{'tableName':_0x0cc3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcfe=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','define','VoicePrefix'];(function(_0x20b679,_0x5d5f07){var _0x288129=function(_0x19ad1a){while(--_0x19ad1a){_0x20b679['push'](_0x20b679['shift']());}};_0x288129(++_0x5d5f07);}(_0xbcfe,0x15f));var _0xebcf=function(_0x559546,_0x4dc81c){_0x559546=_0x559546-0x0;var _0x3ae590=_0xbcfe[_0x559546];return _0x3ae590;};'use strict';var _=require(_0xebcf('0x0'));var util=require(_0xebcf('0x1'));var logger=require(_0xebcf('0x2'))(_0xebcf('0x3'));var moment=require(_0xebcf('0x4'));var BPromise=require(_0xebcf('0x5'));var rp=require(_0xebcf('0x6'));var fs=require('fs');var path=require(_0xebcf('0x7'));var rimraf=require(_0xebcf('0x8'));var config=require(_0xebcf('0x9'));var attributes=require(_0xebcf('0xa'));module['exports']=function(_0x2e23a8,_0x1a56fe){return _0x2e23a8[_0xebcf('0xb')](_0xebcf('0xc'),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 147cea9..0300133 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 _0xfa9c=['defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis'];(function(_0x9aa19d,_0xe0e616){var _0x31071b=function(_0x340890){while(--_0x340890){_0x9aa19d['push'](_0x9aa19d['shift']());}};_0x31071b(++_0xe0e616);}(_0xfa9c,0x11e));var _0xcfa9=function(_0x1424c8,_0x3d5663){_0x1424c8=_0x1424c8-0x0;var _0x441911=_0xfa9c[_0x1424c8];return _0x441911;};'use strict';var _=require(_0xcfa9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcfa9('0x1'));var rs=require(_0xcfa9('0x2'));var fs=require('fs');var Redis=require(_0xcfa9('0x3'));var db=require(_0xcfa9('0x4'))['db'];var utils=require(_0xcfa9('0x5'));var logger=require(_0xcfa9('0x6'))(_0xcfa9('0x7'));var config=require('../../config/environment');var jayson=require(_0xcfa9('0x8'));var client=jayson['client'][_0xcfa9('0x9')]({'port':0x232a});config[_0xcfa9('0xa')]=_[_0xcfa9('0xb')](config[_0xcfa9('0xa')],{'host':_0xcfa9('0xc'),'port':0x18eb});var socket=require(_0xcfa9('0xd'))(new Redis(config[_0xcfa9('0xa')]));require(_0xcfa9('0xe'))[_0xcfa9('0xf')](socket);function respondWithRpcPromise(_0x4b40b7,_0x243c60,_0xfc39c1){return new BPromise(function(_0x4c6c09,_0x4c5fa9){return client[_0xcfa9('0x10')](_0x4b40b7,_0xfc39c1)[_0xcfa9('0x11')](function(_0x92136a){logger[_0xcfa9('0x12')](_0xcfa9('0x13'),_0x243c60,_0xcfa9('0x14'));logger[_0xcfa9('0x15')](_0xcfa9('0x16'),_0x243c60,_0xcfa9('0x14'),JSON['stringify'](_0x92136a));if(_0x92136a[_0xcfa9('0x17')]){if(_0x92136a[_0xcfa9('0x17')][_0xcfa9('0x18')]===0x1f4){logger[_0xcfa9('0x17')](_0xcfa9('0x13'),_0x243c60,_0x92136a[_0xcfa9('0x17')][_0xcfa9('0x19')]);return _0x4c5fa9(_0x92136a[_0xcfa9('0x17')]['message']);}logger[_0xcfa9('0x17')](_0xcfa9('0x13'),_0x243c60,_0x92136a['error'][_0xcfa9('0x19')]);return _0x4c6c09(_0x92136a[_0xcfa9('0x17')][_0xcfa9('0x19')]);}else{logger[_0xcfa9('0x12')](_0xcfa9('0x13'),_0x243c60,'request\x20sent');_0x4c6c09(_0x92136a['result'][_0xcfa9('0x19')]);}})[_0xcfa9('0x1a')](function(_0x5f1c96){logger[_0xcfa9('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x243c60,_0x5f1c96);_0x4c5fa9(_0x5f1c96);});});} \ No newline at end of file +var _0x1022=['request','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','http','redis','defaults','localhost','./voicePrefix.socket','register'];(function(_0x5e438a,_0x4a322f){var _0x93845c=function(_0x546119){while(--_0x546119){_0x5e438a['push'](_0x5e438a['shift']());}};_0x93845c(++_0x4a322f);}(_0x1022,0x1c6));var _0x2102=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x1022[_0x5416db];return _0x243e35;};'use strict';var _=require(_0x2102('0x0'));var util=require(_0x2102('0x1'));var moment=require(_0x2102('0x2'));var BPromise=require(_0x2102('0x3'));var rs=require(_0x2102('0x4'));var fs=require('fs');var Redis=require(_0x2102('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2102('0x6'));var config=require('../../config/environment');var jayson=require(_0x2102('0x7'));var client=jayson['client'][_0x2102('0x8')]({'port':0x232a});config[_0x2102('0x9')]=_[_0x2102('0xa')](config[_0x2102('0x9')],{'host':_0x2102('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2102('0x9')]));require(_0x2102('0xc'))[_0x2102('0xd')](socket);function respondWithRpcPromise(_0xfa600,_0x4d9dd7,_0x416663){return new BPromise(function(_0x3cae8b,_0x4279b3){return client[_0x2102('0xe')](_0xfa600,_0x416663)['then'](function(_0x1ecbcd){logger['info'](_0x2102('0xf'),_0x4d9dd7,_0x2102('0x10'));logger[_0x2102('0x11')](_0x2102('0x12'),_0x4d9dd7,_0x2102('0x10'),JSON[_0x2102('0x13')](_0x1ecbcd));if(_0x1ecbcd[_0x2102('0x14')]){if(_0x1ecbcd[_0x2102('0x14')][_0x2102('0x15')]===0x1f4){logger['error'](_0x2102('0xf'),_0x4d9dd7,_0x1ecbcd['error'][_0x2102('0x16')]);return _0x4279b3(_0x1ecbcd[_0x2102('0x14')]['message']);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x4d9dd7,_0x1ecbcd[_0x2102('0x14')][_0x2102('0x16')]);return _0x3cae8b(_0x1ecbcd[_0x2102('0x14')][_0x2102('0x16')]);}else{logger[_0x2102('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x4d9dd7,'request\x20sent');_0x3cae8b(_0x1ecbcd[_0x2102('0x18')][_0x2102('0x16')]);}})[_0x2102('0x19')](function(_0x4a03a3){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x4d9dd7,_0x4a03a3);_0x4279b3(_0x4a03a3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index b208e1b..d8eae4a 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 _0x8702=['length','save','remove','update','removeListener'];(function(_0x3d3afe,_0x42483e){var _0x30b53d=function(_0x315478){while(--_0x315478){_0x3d3afe['push'](_0x3d3afe['shift']());}};_0x30b53d(++_0x42483e);}(_0x8702,0x1d2));var _0x2870=function(_0x428bce,_0x2fabf4){_0x428bce=_0x428bce-0x0;var _0x12ff6d=_0x8702[_0x428bce];return _0x12ff6d;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x2870('0x0'),_0x2870('0x1'),_0x2870('0x2')];function createListener(_0xfc53a5,_0x466388){return function(_0x524b42){_0x466388['emit'](_0xfc53a5,_0x524b42);};}function removeListener(_0x35f12d,_0x38be6e){return function(){VoicePrefixEvents[_0x2870('0x3')](_0x35f12d,_0x38be6e);};}exports['register']=function(_0x3c2510){for(var _0x489e56=0x0,_0x24721c=events[_0x2870('0x4')];_0x489e56<_0x24721c;_0x489e56++){var _0x12b87d=events[_0x489e56];var _0x2103e9=createListener('voicePrefix:'+_0x12b87d,_0x3c2510);VoicePrefixEvents['on'](_0x12b87d,_0x2103e9);}}; \ No newline at end of file +var _0xa73e=['length','voicePrefix:','./voicePrefix.events','save','remove','update','removeListener','register'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xa73e,0x172));var _0xea73=function(_0x52613c,_0x8457ef){_0x52613c=_0x52613c-0x0;var _0x4d9827=_0xa73e[_0x52613c];return _0x4d9827;};'use strict';var VoicePrefixEvents=require(_0xea73('0x0'));var events=[_0xea73('0x1'),_0xea73('0x2'),_0xea73('0x3')];function createListener(_0x48db70,_0x47fd36){return function(_0xc51dfa){_0x47fd36['emit'](_0x48db70,_0xc51dfa);};}function removeListener(_0x178798,_0x20af2f){return function(){VoicePrefixEvents[_0xea73('0x4')](_0x178798,_0x20af2f);};}exports[_0xea73('0x5')]=function(_0x46e10b){for(var _0x42578b=0x0,_0x2bc1e3=events[_0xea73('0x6')];_0x42578b<_0x2bc1e3;_0x42578b++){var _0x957f9d=events[_0x42578b];var _0x1e8b79=createListener(_0xea73('0x7')+_0x957f9d,_0x46e10b);VoicePrefixEvents['on'](_0x957f9d,_0x1e8b79);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index f4fcb6c..741872c 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 _0x8e6c=['isAuthenticated','index','get','/:id','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addTeams','/:id/users','addAgents','addLists','addBlackLists','update','delete','destroy','removeAgents','removeLists','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller'];(function(_0x44db83,_0x256156){var _0x14166e=function(_0x14af7d){while(--_0x14af7d){_0x44db83['push'](_0x44db83['shift']());}};_0x14166e(++_0x256156);}(_0x8e6c,0x7b));var _0xc8e6=function(_0x355d12,_0x1b163a){_0x355d12=_0x355d12-0x0;var _0x4888e2=_0x8e6c[_0x355d12];return _0x4888e2;};'use strict';var multer=require(_0xc8e6('0x0'));var util=require('util');var path=require(_0xc8e6('0x1'));var timeout=require(_0xc8e6('0x2'));var express=require(_0xc8e6('0x3'));var router=express[_0xc8e6('0x4')]();var auth=require(_0xc8e6('0x5'));var interaction=require(_0xc8e6('0x6'));var config=require(_0xc8e6('0x7'));var controller=require(_0xc8e6('0x8'));router['get']('/',auth[_0xc8e6('0x9')](),controller[_0xc8e6('0xa')]);router[_0xc8e6('0xb')](_0xc8e6('0xc'),auth[_0xc8e6('0x9')](),controller['show']);router[_0xc8e6('0xb')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0xc8e6('0xd')]);router[_0xc8e6('0xb')](_0xc8e6('0xe'),auth[_0xc8e6('0x9')](),controller[_0xc8e6('0xf')]);router[_0xc8e6('0xb')](_0xc8e6('0x10'),auth[_0xc8e6('0x9')](),controller[_0xc8e6('0x11')]);router[_0xc8e6('0xb')](_0xc8e6('0x12'),auth[_0xc8e6('0x9')](),controller[_0xc8e6('0x13')]);router[_0xc8e6('0xb')](_0xc8e6('0x14'),auth['isAuthenticated'](),controller[_0xc8e6('0x15')]);router[_0xc8e6('0xb')]('/:id/users',auth['isAuthenticated'](),controller[_0xc8e6('0x16')]);router[_0xc8e6('0xb')](_0xc8e6('0x17'),auth[_0xc8e6('0x9')](),controller[_0xc8e6('0x18')]);router['get'](_0xc8e6('0x19'),auth[_0xc8e6('0x9')](),controller[_0xc8e6('0x1a')]);router[_0xc8e6('0xb')](_0xc8e6('0x1b'),auth[_0xc8e6('0x9')](),controller[_0xc8e6('0x1c')]);router[_0xc8e6('0x1d')]('/',auth[_0xc8e6('0x9')](),controller[_0xc8e6('0x1e')]);router[_0xc8e6('0x1d')](_0xc8e6('0x1f'),auth[_0xc8e6('0x9')](),controller[_0xc8e6('0x20')]);router[_0xc8e6('0x1d')](_0xc8e6('0x14'),auth[_0xc8e6('0x9')](),controller[_0xc8e6('0x21')]);router['post'](_0xc8e6('0x22'),auth[_0xc8e6('0x9')](),controller[_0xc8e6('0x23')]);router['post'](_0xc8e6('0x19'),auth[_0xc8e6('0x9')](),controller[_0xc8e6('0x24')]);router['post'](_0xc8e6('0x1b'),auth[_0xc8e6('0x9')](),controller[_0xc8e6('0x25')]);router['put'](_0xc8e6('0xc'),auth[_0xc8e6('0x9')](),controller[_0xc8e6('0x26')]);router[_0xc8e6('0x27')](_0xc8e6('0xc'),auth[_0xc8e6('0x9')](),controller[_0xc8e6('0x28')]);router[_0xc8e6('0x27')](_0xc8e6('0x14'),auth[_0xc8e6('0x9')](),controller['removeTeams']);router[_0xc8e6('0x27')]('/:id/users',auth[_0xc8e6('0x9')](),controller[_0xc8e6('0x29')]);router[_0xc8e6('0x27')](_0xc8e6('0x19'),auth[_0xc8e6('0x9')](),controller[_0xc8e6('0x2a')]);router[_0xc8e6('0x27')]('/:id/blacklists',auth[_0xc8e6('0x9')](),controller['removeBlackLists']);module[_0xc8e6('0x2b')]=router; \ No newline at end of file +var _0xab1e=['/:id/teams','getTeams','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','post','clone','/:id/users','addAgents','addLists','put','destroy','removeAgents','delete','removeLists','removeBlackLists','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks'];(function(_0x3f4875,_0x1eee06){var _0x1727cf=function(_0x92fc15){while(--_0x92fc15){_0x3f4875['push'](_0x3f4875['shift']());}};_0x1727cf(++_0x1eee06);}(_0xab1e,0x169));var _0xeab1=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xab1e[_0x49b207];return _0x2dc8fa;};'use strict';var multer=require(_0xeab1('0x0'));var util=require(_0xeab1('0x1'));var path=require(_0xeab1('0x2'));var timeout=require('connect-timeout');var express=require(_0xeab1('0x3'));var router=express['Router']();var auth=require(_0xeab1('0x4'));var interaction=require(_0xeab1('0x5'));var config=require(_0xeab1('0x6'));var controller=require('./voiceQueue.controller');router['get']('/',auth[_0xeab1('0x7')](),controller[_0xeab1('0x8')]);router[_0xeab1('0x9')](_0xeab1('0xa'),auth[_0xeab1('0x7')](),controller[_0xeab1('0xb')]);router[_0xeab1('0x9')](_0xeab1('0xc'),auth['isAuthenticated'](),controller[_0xeab1('0xd')]);router['get'](_0xeab1('0xe'),auth[_0xeab1('0x7')](),controller[_0xeab1('0xf')]);router[_0xeab1('0x9')](_0xeab1('0x10'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0xeab1('0x9')](_0xeab1('0x11'),auth[_0xeab1('0x7')](),controller[_0xeab1('0x12')]);router[_0xeab1('0x9')](_0xeab1('0x13'),auth[_0xeab1('0x7')](),controller[_0xeab1('0x14')]);router[_0xeab1('0x9')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xeab1('0x9')](_0xeab1('0x15'),auth[_0xeab1('0x7')](),controller[_0xeab1('0x16')]);router['get'](_0xeab1('0x17'),auth[_0xeab1('0x7')](),controller[_0xeab1('0x18')]);router[_0xeab1('0x9')](_0xeab1('0x19'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0xeab1('0x1a')]('/',auth[_0xeab1('0x7')](),controller['create']);router[_0xeab1('0x1a')]('/:id/clone',auth[_0xeab1('0x7')](),controller[_0xeab1('0x1b')]);router[_0xeab1('0x1a')](_0xeab1('0x13'),auth['isAuthenticated'](),controller['addTeams']);router[_0xeab1('0x1a')](_0xeab1('0x1c'),auth[_0xeab1('0x7')](),controller[_0xeab1('0x1d')]);router[_0xeab1('0x1a')](_0xeab1('0x17'),auth['isAuthenticated'](),controller[_0xeab1('0x1e')]);router[_0xeab1('0x1a')]('/:id/blacklists',auth[_0xeab1('0x7')](),controller['addBlackLists']);router[_0xeab1('0x1f')](_0xeab1('0xa'),auth[_0xeab1('0x7')](),controller['update']);router['delete'](_0xeab1('0xa'),auth['isAuthenticated'](),controller[_0xeab1('0x20')]);router['delete']('/:id/teams',auth[_0xeab1('0x7')](),controller['removeTeams']);router['delete'](_0xeab1('0x1c'),auth[_0xeab1('0x7')](),controller[_0xeab1('0x21')]);router[_0xeab1('0x22')](_0xeab1('0x17'),auth['isAuthenticated'](),controller[_0xeab1('0x23')]);router[_0xeab1('0x22')]('/:id/blacklists',auth[_0xeab1('0x7')](),controller[_0xeab1('0x24')]);module[_0xeab1('0x25')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index be60431..f1f62e7 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(_0x4947e3,_0x21f2ee){var _0x1911e5=function(_0x193c1b){while(--_0x193c1b){_0x4947e3['push'](_0x4947e3['shift']());}};_0x1911e5(++_0x21f2ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x11cbbd,_0x5d4106){var _0x153af2=function(_0xd8cb94){while(--_0xd8cb94){_0x11cbbd['push'](_0x11cbbd['shift']());}};_0x153af2(++_0x5d4106);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 1661e5a..bccc4a0 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 _0x8d0e=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','include','omit','createdAt','updatedAt','body','outbound','UserProfileSection','getHoppers','findOne','CmHopper','hasOwnProperty','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','voicePause','flatMap','Agents','sequelize','transaction','each','UserVoiceQueue','findOrCreate','penalty','upsert','isNil','interface','format','SIP/%s','forEach','emit','userVoiceQueue:save','select','field','tq.TeamId','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','toString','QueryTypes','every','TeamId','includes','union','ids','isEmpty','addAgents','spread','push','UserVoiceQueueRt','all','removeAgents','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','cm_hopper','fromQuery','phone','scheduledAt','ContactId','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','into','ListId','ListId\x20=\x20?','insert','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','ignore','value','type','find','UserProfileResource','end','error','stack','name','send','index','VoiceQueue','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','filtears','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x1e8339,_0x241b08){_0x1e8339=_0x1e8339-0x0;var _0x31fe67=_0x8d0e[_0x1e8339];return _0x31fe67;};'use strict';var pdf=require(_0xe8d0('0x0'));var emlformat=require(_0xe8d0('0x1'));var rimraf=require(_0xe8d0('0x2'));var zipdir=require(_0xe8d0('0x3'));var jsonpatch=require(_0xe8d0('0x4'));var rp=require(_0xe8d0('0x5'));var moment=require(_0xe8d0('0x6'));var BPromise=require(_0xe8d0('0x7'));var Mustache=require(_0xe8d0('0x8'));var util=require('util');var path=require(_0xe8d0('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe8d0('0xa'));var fs=require('fs');var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];config['redis']=_[_0xe8d0('0x1b')](config[_0xe8d0('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xe8d0('0x1d'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0xe8d0('0x1e')](socket);function respondWithStatusCode(_0x2aa906,_0x1aa725){_0x1aa725=_0x1aa725||0xcc;return function(_0x291b49){if(_0x291b49){return _0x2aa906[_0xe8d0('0x1f')](_0x1aa725);}return _0x2aa906[_0xe8d0('0x20')](_0x1aa725)['end']();};}function respondWithResult(_0x6ccffa,_0x49554d){_0x49554d=_0x49554d||0xc8;return function(_0x6d932b){if(_0x6d932b){return _0x6ccffa[_0xe8d0('0x20')](_0x49554d)[_0xe8d0('0x21')](_0x6d932b);}};}function respondWithFilteredResult(_0x4d1db4,_0x4d0ddb){return function(_0x47c67a){if(_0x47c67a){var _0x1bdd94=_0x47c67a[_0xe8d0('0x22')],_0x384854=_0x4d0ddb['offset'],_0x27b910=_0x4d0ddb[_0xe8d0('0x23')]+_0x4d0ddb[_0xe8d0('0x24')],_0x44bbe4;if(_0x27b910>=_0x1bdd94){_0x27b910=_0x1bdd94;_0x44bbe4=0xc8;}else{_0x44bbe4=0xce;}_0x4d1db4['status'](_0x44bbe4);return _0x4d1db4['set']('Content-Range',_0x384854+'-'+_0x27b910+'/'+_0x1bdd94)[_0xe8d0('0x21')](_0x47c67a);}return null;};}function patchUpdates(_0x35d131){return function(_0x25363b){try{jsonpatch[_0xe8d0('0x25')](_0x25363b,_0x35d131,!![]);}catch(_0x25f764){return BPromise[_0xe8d0('0x26')](_0x25f764);}return _0x25363b[_0xe8d0('0x27')]();};}function saveUpdates(_0x28a6b5,_0x32e39a){return function(_0x5ab4e7){if(_0x5ab4e7){return _0x5ab4e7[_0xe8d0('0x28')](_0x28a6b5)[_0xe8d0('0x29')](function(_0x572c25){return _0x572c25;});}return null;};}function removeEntity(_0x106614,_0x2e69d1){return function(_0x274cac){if(_0x274cac){return _0x274cac[_0xe8d0('0x2a')]()[_0xe8d0('0x29')](function(){var _0x149dfd=_0x274cac[_0xe8d0('0x2b')]({'plain':!![]});var _0x32f0c1=[{'name':_0xe8d0('0x2c'),'value':_0xe8d0('0x2d'),'ignore':![]},{'name':_0xe8d0('0x2e'),'value':'outbound','ignore':![]}];var _0x24982c=_(_0x32f0c1)[_0xe8d0('0x2f')](_0xe8d0('0x30'))['map'](_0xe8d0('0x31'))[_0xe8d0('0x31')]();if(_['includes'](_0x24982c,_0x149dfd[_0xe8d0('0x32')])){return;}var _0x3ffcb7=_[_0xe8d0('0x33')](_0x32f0c1,[_0xe8d0('0x31'),_0x149dfd[_0xe8d0('0x32')]])['name'];return db[_0xe8d0('0x34')]['destroy']({'where':{'type':_0x3ffcb7,'resourceId':_0x149dfd['id']}})['then'](function(){return _0x274cac;});})['then'](function(){_0x106614[_0xe8d0('0x20')](0xcc)[_0xe8d0('0x35')]();});}};}function handleEntityNotFound(_0x36ccec,_0x5151fa){return function(_0x57e375){if(!_0x57e375){_0x36ccec[_0xe8d0('0x1f')](0x194);}return _0x57e375;};}function handleError(_0x551999,_0x3b5d31){_0x3b5d31=_0x3b5d31||0x1f4;return function(_0x383084){logger[_0xe8d0('0x36')](_0x383084[_0xe8d0('0x37')]);if(_0x383084[_0xe8d0('0x38')]){delete _0x383084['name'];}_0x551999[_0xe8d0('0x20')](_0x3b5d31)[_0xe8d0('0x39')](_0x383084);};}exports[_0xe8d0('0x3a')]=function(_0x145ddb,_0x587819){var _0x4547b6={},_0x28ece9={},_0x4c1347={'count':0x0,'rows':[]};var _0x42c31f=_['map'](db[_0xe8d0('0x3b')]['rawAttributes'],function(_0x197e01){return{'name':_0x197e01['fieldName'],'type':_0x197e01[_0xe8d0('0x32')][_0xe8d0('0x3c')]};});_0x28ece9[_0xe8d0('0x3d')]=_[_0xe8d0('0x3e')](_0x42c31f,'name');_0x28ece9[_0xe8d0('0x3f')]=_[_0xe8d0('0x40')](_0x145ddb[_0xe8d0('0x3f')]);_0x28ece9['filters']=_[_0xe8d0('0x41')](_0x28ece9[_0xe8d0('0x3d')],_0x28ece9[_0xe8d0('0x3f')]);_0x4547b6[_0xe8d0('0x42')]=_[_0xe8d0('0x41')](_0x28ece9['model'],qs[_0xe8d0('0x43')](_0x145ddb[_0xe8d0('0x3f')][_0xe8d0('0x43')]));_0x4547b6[_0xe8d0('0x42')]=_0x4547b6[_0xe8d0('0x42')][_0xe8d0('0x44')]?_0x4547b6[_0xe8d0('0x42')]:_0x28ece9[_0xe8d0('0x3d')];if(!_0x145ddb['query']['hasOwnProperty'](_0xe8d0('0x45'))){_0x4547b6[_0xe8d0('0x24')]=qs[_0xe8d0('0x24')](_0x145ddb[_0xe8d0('0x3f')][_0xe8d0('0x24')]);_0x4547b6['offset']=qs[_0xe8d0('0x23')](_0x145ddb['query'][_0xe8d0('0x23')]);}_0x4547b6[_0xe8d0('0x46')]=qs[_0xe8d0('0x47')](_0x145ddb['query'][_0xe8d0('0x47')]);_0x4547b6[_0xe8d0('0x48')]=qs[_0xe8d0('0x49')](_[_0xe8d0('0x4a')](_0x145ddb[_0xe8d0('0x3f')],_0x28ece9['filters']),_0x42c31f);if(_0x145ddb['query']['filter']){_0x4547b6['where']=_[_0xe8d0('0x4b')](_0x4547b6['where'],{'$or':_[_0xe8d0('0x3e')](_0x42c31f,function(_0x1b0ef3){if(_0x1b0ef3[_0xe8d0('0x32')]!==_0xe8d0('0x4c')){var _0x2fd21e={};_0x2fd21e[_0x1b0ef3[_0xe8d0('0x38')]]={'$like':'%'+_0x145ddb[_0xe8d0('0x3f')][_0xe8d0('0x2f')]+'%'};return _0x2fd21e;}})});}_0x4547b6=_['merge']({},_0x4547b6,_0x145ddb[_0xe8d0('0x4d')]);var _0x1da8b2={'where':_0x4547b6['where']};return db['VoiceQueue'][_0xe8d0('0x22')](_0x1da8b2)[_0xe8d0('0x29')](function(_0x267b32){_0x4c1347['count']=_0x267b32;if(_0x145ddb[_0xe8d0('0x3f')][_0xe8d0('0x4e')]){_0x4547b6['include']=[{'all':!![]}];}return db[_0xe8d0('0x3b')][_0xe8d0('0x4f')](_0x4547b6);})['then'](function(_0x473e9a){_0x4c1347[_0xe8d0('0x50')]=_0x473e9a;return _0x4c1347;})[_0xe8d0('0x29')](respondWithFilteredResult(_0x587819,_0x4547b6))[_0xe8d0('0x51')](handleError(_0x587819,null));};exports[_0xe8d0('0x52')]=function(_0x2a6760,_0x11339d){var _0x1ce97d={'raw':![],'where':{'id':_0x2a6760[_0xe8d0('0x53')]['id']}},_0x510f62={};_0x510f62[_0xe8d0('0x3d')]=_[_0xe8d0('0x40')](db[_0xe8d0('0x3b')][_0xe8d0('0x54')]);_0x510f62[_0xe8d0('0x3f')]=_[_0xe8d0('0x40')](_0x2a6760[_0xe8d0('0x3f')]);_0x510f62[_0xe8d0('0x55')]=_[_0xe8d0('0x41')](_0x510f62[_0xe8d0('0x3d')],_0x510f62[_0xe8d0('0x3f')]);_0x1ce97d['attributes']=_[_0xe8d0('0x41')](_0x510f62[_0xe8d0('0x3d')],qs[_0xe8d0('0x43')](_0x2a6760[_0xe8d0('0x3f')][_0xe8d0('0x43')]));_0x1ce97d[_0xe8d0('0x42')]=_0x1ce97d[_0xe8d0('0x42')]['length']?_0x1ce97d[_0xe8d0('0x42')]:_0x510f62[_0xe8d0('0x3d')];if(_0x2a6760[_0xe8d0('0x3f')][_0xe8d0('0x4e')]){_0x1ce97d['include']=[{'all':!![]}];}_0x1ce97d=_[_0xe8d0('0x4b')]({},_0x1ce97d,_0x2a6760['options']);return db[_0xe8d0('0x3b')][_0xe8d0('0x33')](_0x1ce97d)[_0xe8d0('0x29')](handleEntityNotFound(_0x11339d,null))[_0xe8d0('0x29')](respondWithResult(_0x11339d,null))[_0xe8d0('0x51')](handleError(_0x11339d,null));};exports[_0xe8d0('0x56')]=function(_0x1646fb,_0x52b8b2){return db[_0xe8d0('0x3b')]['create'](_0x1646fb['body'],{})[_0xe8d0('0x29')](function(_0x5516ad){var _0x303a17=_0x1646fb['user'][_0xe8d0('0x2b')]({'plain':!![]});if(!_0x303a17)throw new Error(_0xe8d0('0x57'));if(_0x303a17[_0xe8d0('0x58')]===_0xe8d0('0x59')){var _0x555a56=_0x5516ad[_0xe8d0('0x2b')]({'plain':!![]});var _0xbd55db=[{'name':_0xe8d0('0x2c'),'value':_0xe8d0('0x2d')},{'name':_0xe8d0('0x2e'),'value':'outbound'}];var _0x3a7a99=_[_0xe8d0('0x33')](_0xbd55db,[_0xe8d0('0x31'),_0x555a56['type']])[_0xe8d0('0x38')];return db['UserProfileSection']['find']({'where':{'name':_0x3a7a99,'userProfileId':_0x303a17[_0xe8d0('0x5a')]},'raw':!![]})[_0xe8d0('0x29')](function(_0x4e7b49){if(_0x4e7b49&&_0x4e7b49[_0xe8d0('0x5b')]===0x0){return db[_0xe8d0('0x34')]['create']({'name':_0x555a56[_0xe8d0('0x38')],'resourceId':_0x555a56['id'],'type':_0x4e7b49[_0xe8d0('0x38')],'sectionId':_0x4e7b49['id']},{})[_0xe8d0('0x29')](function(){return _0x5516ad;});}else{return _0x5516ad;}})[_0xe8d0('0x51')](function(_0x54fbf5){logger[_0xe8d0('0x36')](_0xe8d0('0x5c'),_0x54fbf5);throw _0x54fbf5;});}return _0x5516ad;})[_0xe8d0('0x29')](respondWithResult(_0x52b8b2,0xc9))[_0xe8d0('0x51')](handleError(_0x52b8b2,null));};exports['clone']=function(_0x4125aa,_0x677679){var _0x17c044={'where':{'id':_0x4125aa[_0xe8d0('0x53')]['id']}},_0x35e0d5={};_0x35e0d5[_0xe8d0('0x3d')]=_['keys'](db['VoiceQueue'][_0xe8d0('0x54')]);_0x17c044['attributes']=_[_0xe8d0('0x41')](_0x35e0d5[_0xe8d0('0x3d')],qs['fields'](_0x4125aa['query'][_0xe8d0('0x43')]));_0x17c044['attributes']=_0x17c044[_0xe8d0('0x42')]['length']?_0x17c044[_0xe8d0('0x42')]:_0x35e0d5[_0xe8d0('0x3d')];if(_0x4125aa[_0xe8d0('0x3f')]['includeAll']){_0x17c044[_0xe8d0('0x5d')]=[{'all':!![]}];}_0x17c044=_[_0xe8d0('0x4b')]({},_0x17c044,_0x4125aa['options']);return db[_0xe8d0('0x3b')]['find'](_0x17c044)[_0xe8d0('0x29')](handleEntityNotFound(_0x677679,null))['then'](function(_0x1a6de5){if(_0x1a6de5){var _0x17afc2=_0x1a6de5[_0xe8d0('0x2b')]({'plain':!![]});_0x17afc2=qs[_0xe8d0('0x5e')](_0x17afc2,['id',_0xe8d0('0x5f'),'updatedAt']);_0x4125aa['body']=_[_0xe8d0('0x5e')](_0x4125aa['body'],['id',_0xe8d0('0x5f'),_0xe8d0('0x60')]);return db[_0xe8d0('0x3b')][_0xe8d0('0x56')](_[_0xe8d0('0x4b')](_0x17afc2,_0x4125aa[_0xe8d0('0x61')]),{'include':_0x4125aa[_0xe8d0('0x3f')][_0xe8d0('0x4e')]?[{'all':!![]}]:undefined})[_0xe8d0('0x29')](function(_0x2fc8bd){var _0x6160e1=_0x4125aa[_0xe8d0('0x59')][_0xe8d0('0x2b')]({'plain':!![]});if(!_0x6160e1)throw new Error(_0xe8d0('0x57'));if(_0x6160e1[_0xe8d0('0x58')]==='user'){var _0x2d4b21=_0x2fc8bd[_0xe8d0('0x2b')]({'plain':!![]});var _0x298403=[{'name':_0xe8d0('0x2c'),'value':_0xe8d0('0x2d')},{'name':'QueueCampaigns','value':_0xe8d0('0x62')}];var _0x1d30c0=_[_0xe8d0('0x33')](_0x298403,[_0xe8d0('0x31'),_0x2d4b21[_0xe8d0('0x32')]])[_0xe8d0('0x38')];return db[_0xe8d0('0x63')][_0xe8d0('0x33')]({'where':{'name':_0x1d30c0,'userProfileId':_0x6160e1[_0xe8d0('0x5a')]},'raw':!![]})[_0xe8d0('0x29')](function(_0x23955c){if(_0x23955c&&_0x23955c[_0xe8d0('0x5b')]===0x0){return db['UserProfileResource']['create']({'name':_0x2d4b21[_0xe8d0('0x38')],'resourceId':_0x2d4b21['id'],'type':_0x23955c['name'],'sectionId':_0x23955c['id']},{})[_0xe8d0('0x29')](function(){return _0x2fc8bd;});}else{return _0x2fc8bd;}})[_0xe8d0('0x51')](function(_0x56761c){logger[_0xe8d0('0x36')](_0xe8d0('0x5c'),_0x56761c);throw _0x56761c;});}return _0x2fc8bd;});}})[_0xe8d0('0x29')](respondWithResult(_0x677679,0xc9))[_0xe8d0('0x51')](handleError(_0x677679,null));};exports[_0xe8d0('0x28')]=function(_0x1b5df8,_0x473e0b){if(_0x1b5df8[_0xe8d0('0x61')]['id']){delete _0x1b5df8[_0xe8d0('0x61')]['id'];}return db[_0xe8d0('0x3b')][_0xe8d0('0x33')]({'where':{'id':_0x1b5df8[_0xe8d0('0x53')]['id']}})[_0xe8d0('0x29')](handleEntityNotFound(_0x473e0b,null))[_0xe8d0('0x29')](saveUpdates(_0x1b5df8[_0xe8d0('0x61')],null))[_0xe8d0('0x29')](respondWithResult(_0x473e0b,null))[_0xe8d0('0x51')](handleError(_0x473e0b,null));};exports[_0xe8d0('0x2a')]=function(_0x44ffa5,_0x500fb0){return db[_0xe8d0('0x3b')][_0xe8d0('0x33')]({'where':{'id':_0x44ffa5[_0xe8d0('0x53')]['id']}})['then'](handleEntityNotFound(_0x500fb0,null))[_0xe8d0('0x29')](removeEntity(_0x500fb0,null))['catch'](handleError(_0x500fb0,null));};exports[_0xe8d0('0x64')]=function(_0x1c1794,_0x22791b,_0x561eb3){var _0x1bc8cf={'raw':![],'where':{}};var _0x6fe4d5={};var _0xc94cd3={'count':0x0,'rows':[]};return db[_0xe8d0('0x3b')][_0xe8d0('0x65')]({'where':{'id':_0x1c1794['params']['id']}})[_0xe8d0('0x29')](handleEntityNotFound(_0x22791b,null))[_0xe8d0('0x29')](function(_0x23ba49){if(_0x23ba49){_0x6fe4d5[_0xe8d0('0x3d')]=_[_0xe8d0('0x40')](db[_0xe8d0('0x66')][_0xe8d0('0x54')]);_0x6fe4d5[_0xe8d0('0x3f')]=_['keys'](_0x1c1794[_0xe8d0('0x3f')]);_0x6fe4d5[_0xe8d0('0x49')]=_[_0xe8d0('0x41')](_0x6fe4d5[_0xe8d0('0x3d')],_0x6fe4d5['query']);_0x1bc8cf[_0xe8d0('0x42')]=_[_0xe8d0('0x41')](_0x6fe4d5[_0xe8d0('0x3d')],qs['fields'](_0x1c1794[_0xe8d0('0x3f')]['fields']));_0x1bc8cf[_0xe8d0('0x42')]=_0x1bc8cf['attributes'][_0xe8d0('0x44')]?_0x1bc8cf[_0xe8d0('0x42')]:_0x6fe4d5[_0xe8d0('0x3d')];if(!_0x1c1794[_0xe8d0('0x3f')][_0xe8d0('0x67')](_0xe8d0('0x45'))){_0x1bc8cf[_0xe8d0('0x24')]=qs[_0xe8d0('0x24')](_0x1c1794[_0xe8d0('0x3f')][_0xe8d0('0x24')]);_0x1bc8cf[_0xe8d0('0x23')]=qs[_0xe8d0('0x23')](_0x1c1794['query'][_0xe8d0('0x23')]);}_0x1bc8cf[_0xe8d0('0x46')]=qs[_0xe8d0('0x47')](_0x1c1794[_0xe8d0('0x3f')][_0xe8d0('0x47')]);_0x1bc8cf[_0xe8d0('0x48')]=qs[_0xe8d0('0x49')](_[_0xe8d0('0x4a')](_0x1c1794[_0xe8d0('0x3f')],_0x6fe4d5[_0xe8d0('0x49')]));_0x1bc8cf['where'][_0xe8d0('0x68')]=_0x23ba49['id'];if(_0x1c1794[_0xe8d0('0x3f')][_0xe8d0('0x2f')]){_0x1bc8cf[_0xe8d0('0x48')]=_[_0xe8d0('0x4b')](_0x1bc8cf['where'],{'$or':_['map'](_0x1bc8cf[_0xe8d0('0x42')],function(_0x5c8c7d){var _0x3fb7c8={};_0x3fb7c8[_0x5c8c7d]={'$like':'%'+_0x1c1794[_0xe8d0('0x3f')][_0xe8d0('0x2f')]+'%'};return _0x3fb7c8;})});}_0x1bc8cf=_['merge']({},_0x1bc8cf,_0x1c1794[_0xe8d0('0x4d')]);return db['CmHopper'][_0xe8d0('0x22')]({'where':_0x1bc8cf[_0xe8d0('0x48')]})[_0xe8d0('0x29')](function(_0x1a04a6){_0xc94cd3[_0xe8d0('0x22')]=_0x1a04a6;if(_0x1c1794['query']['includeAll']){_0x1bc8cf[_0xe8d0('0x5d')]=[{'all':!![]}];}return db[_0xe8d0('0x66')][_0xe8d0('0x4f')](_0x1bc8cf);})[_0xe8d0('0x29')](function(_0x2bb013){_0xc94cd3[_0xe8d0('0x50')]=_0x2bb013;return _0xc94cd3;});}})[_0xe8d0('0x29')](respondWithFilteredResult(_0x22791b,_0x1bc8cf))[_0xe8d0('0x51')](handleError(_0x22791b,null));};exports[_0xe8d0('0x69')]=function(_0x590397,_0x35e14f,_0x289e7e){var _0x142db4={'raw':!![],'where':{}};var _0x2f199b={};var _0x4a568f={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe8d0('0x65')]({'where':{'id':_0x590397[_0xe8d0('0x53')]['id']}})[_0xe8d0('0x29')](handleEntityNotFound(_0x35e14f,null))[_0xe8d0('0x29')](function(_0x38a2dc){if(_0x38a2dc){_0x2f199b[_0xe8d0('0x3d')]=_[_0xe8d0('0x40')](db[_0xe8d0('0x6a')][_0xe8d0('0x54')]);_0x2f199b[_0xe8d0('0x3f')]=_['keys'](_0x590397[_0xe8d0('0x3f')]);_0x2f199b[_0xe8d0('0x49')]=_[_0xe8d0('0x41')](_0x2f199b[_0xe8d0('0x3d')],_0x2f199b[_0xe8d0('0x3f')]);_0x142db4[_0xe8d0('0x42')]=_[_0xe8d0('0x41')](_0x2f199b[_0xe8d0('0x3d')],qs[_0xe8d0('0x43')](_0x590397['query']['fields']));_0x142db4[_0xe8d0('0x42')]=_0x142db4[_0xe8d0('0x42')]['length']?_0x142db4[_0xe8d0('0x42')]:_0x2f199b[_0xe8d0('0x3d')];if(!_0x590397[_0xe8d0('0x3f')]['hasOwnProperty'](_0xe8d0('0x45'))){_0x142db4[_0xe8d0('0x24')]=qs[_0xe8d0('0x24')](_0x590397[_0xe8d0('0x3f')]['limit']);_0x142db4['offset']=qs[_0xe8d0('0x23')](_0x590397[_0xe8d0('0x3f')]['offset']);}_0x142db4['order']=qs[_0xe8d0('0x47')](_0x590397[_0xe8d0('0x3f')][_0xe8d0('0x47')]);_0x142db4['where']=qs[_0xe8d0('0x49')](_['pick'](_0x590397['query'],_0x2f199b[_0xe8d0('0x49')]));_0x142db4[_0xe8d0('0x48')][_0xe8d0('0x68')]=_0x38a2dc['id'];if(_0x590397[_0xe8d0('0x3f')][_0xe8d0('0x2f')]){_0x142db4['where']=_[_0xe8d0('0x4b')](_0x142db4[_0xe8d0('0x48')],{'$or':_['map'](_0x142db4[_0xe8d0('0x42')],function(_0x388bac){var _0x198a12={};_0x198a12[_0x388bac]={'$like':'%'+_0x590397[_0xe8d0('0x3f')]['filter']+'%'};return _0x198a12;})});}_0x142db4=_[_0xe8d0('0x4b')]({},_0x142db4,_0x590397[_0xe8d0('0x4d')]);return db[_0xe8d0('0x6a')][_0xe8d0('0x22')]({'where':_0x142db4[_0xe8d0('0x48')]})[_0xe8d0('0x29')](function(_0x247155){_0x4a568f[_0xe8d0('0x22')]=_0x247155;if(_0x590397['query'][_0xe8d0('0x4e')]){_0x142db4[_0xe8d0('0x5d')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x142db4);})['then'](function(_0x5cf3b5){_0x4a568f[_0xe8d0('0x50')]=_0x5cf3b5;return _0x4a568f;});}})['then'](respondWithFilteredResult(_0x35e14f,_0x142db4))['catch'](handleError(_0x35e14f,null));};exports[_0xe8d0('0x6b')]=function(_0x5e433c,_0xfac5ae,_0x4dae64){var _0x2d394a={'raw':!![],'where':{}};var _0x6e431={};var _0xa807b9={'count':0x0,'rows':[]};return db[_0xe8d0('0x3b')][_0xe8d0('0x65')]({'where':{'id':_0x5e433c[_0xe8d0('0x53')]['id']}})[_0xe8d0('0x29')](handleEntityNotFound(_0xfac5ae,null))[_0xe8d0('0x29')](function(_0x21e53d){if(_0x21e53d){_0x6e431[_0xe8d0('0x3d')]=_[_0xe8d0('0x40')](db[_0xe8d0('0x6c')][_0xe8d0('0x54')]);_0x6e431['query']=_[_0xe8d0('0x40')](_0x5e433c['query']);_0x6e431[_0xe8d0('0x49')]=_[_0xe8d0('0x41')](_0x6e431[_0xe8d0('0x3d')],_0x6e431[_0xe8d0('0x3f')]);_0x2d394a[_0xe8d0('0x42')]=_[_0xe8d0('0x41')](_0x6e431[_0xe8d0('0x3d')],qs[_0xe8d0('0x43')](_0x5e433c['query'][_0xe8d0('0x43')]));_0x2d394a[_0xe8d0('0x42')]=_0x2d394a[_0xe8d0('0x42')][_0xe8d0('0x44')]?_0x2d394a[_0xe8d0('0x42')]:_0x6e431['model'];if(!_0x5e433c['query'][_0xe8d0('0x67')](_0xe8d0('0x45'))){_0x2d394a[_0xe8d0('0x24')]=qs[_0xe8d0('0x24')](_0x5e433c[_0xe8d0('0x3f')][_0xe8d0('0x24')]);_0x2d394a[_0xe8d0('0x23')]=qs[_0xe8d0('0x23')](_0x5e433c[_0xe8d0('0x3f')][_0xe8d0('0x23')]);}_0x2d394a[_0xe8d0('0x46')]=qs[_0xe8d0('0x47')](_0x5e433c[_0xe8d0('0x3f')]['sort']);_0x2d394a['where']=qs[_0xe8d0('0x49')](_[_0xe8d0('0x4a')](_0x5e433c[_0xe8d0('0x3f')],_0x6e431[_0xe8d0('0x49')]));_0x2d394a[_0xe8d0('0x48')]['VoiceQueueId']=_0x21e53d['id'];if(_0x5e433c['query'][_0xe8d0('0x2f')]){_0x2d394a['where']=_[_0xe8d0('0x4b')](_0x2d394a[_0xe8d0('0x48')],{'$or':_[_0xe8d0('0x3e')](_0x2d394a[_0xe8d0('0x42')],function(_0x3fccce){var _0x3dde53={};_0x3dde53[_0x3fccce]={'$like':'%'+_0x5e433c[_0xe8d0('0x3f')]['filter']+'%'};return _0x3dde53;})});}_0x2d394a=_[_0xe8d0('0x4b')]({},_0x2d394a,_0x5e433c[_0xe8d0('0x4d')]);return db[_0xe8d0('0x6c')][_0xe8d0('0x22')]({'where':_0x2d394a[_0xe8d0('0x48')]})['then'](function(_0x530a4a){_0xa807b9[_0xe8d0('0x22')]=_0x530a4a;if(_0x5e433c['query'][_0xe8d0('0x4e')]){_0x2d394a['include']=[{'all':!![]}];}return db[_0xe8d0('0x6c')][_0xe8d0('0x4f')](_0x2d394a);})[_0xe8d0('0x29')](function(_0x489f76){_0xa807b9[_0xe8d0('0x50')]=_0x489f76;return _0xa807b9;});}})[_0xe8d0('0x29')](respondWithFilteredResult(_0xfac5ae,_0x2d394a))['catch'](handleError(_0xfac5ae,null));};exports[_0xe8d0('0x6d')]=function(_0x1cdf37,_0x2f303,_0x4d7211){var _0x5829b9={'raw':!![],'where':{}};var _0x439b39={};var _0xc07427={'count':0x0,'rows':[]};return db[_0xe8d0('0x3b')]['findOne']({'where':{'id':_0x1cdf37[_0xe8d0('0x53')]['id']}})['then'](handleEntityNotFound(_0x2f303,null))[_0xe8d0('0x29')](function(_0x59dff1){if(_0x59dff1){_0x439b39['model']=_['keys'](db[_0xe8d0('0x6e')]['rawAttributes']);_0x439b39[_0xe8d0('0x3f')]=_['keys'](_0x1cdf37[_0xe8d0('0x3f')]);_0x439b39['filters']=_['intersection'](_0x439b39[_0xe8d0('0x3d')],_0x439b39['query']);_0x5829b9[_0xe8d0('0x42')]=_[_0xe8d0('0x41')](_0x439b39[_0xe8d0('0x3d')],qs[_0xe8d0('0x43')](_0x1cdf37[_0xe8d0('0x3f')][_0xe8d0('0x43')]));_0x5829b9[_0xe8d0('0x42')]=_0x5829b9[_0xe8d0('0x42')]['length']?_0x5829b9[_0xe8d0('0x42')]:_0x439b39[_0xe8d0('0x3d')];if(!_0x1cdf37[_0xe8d0('0x3f')][_0xe8d0('0x67')]('nolimit')){_0x5829b9[_0xe8d0('0x24')]=qs[_0xe8d0('0x24')](_0x1cdf37[_0xe8d0('0x3f')][_0xe8d0('0x24')]);_0x5829b9[_0xe8d0('0x23')]=qs[_0xe8d0('0x23')](_0x1cdf37[_0xe8d0('0x3f')]['offset']);}_0x5829b9[_0xe8d0('0x46')]=qs[_0xe8d0('0x47')](_0x1cdf37[_0xe8d0('0x3f')][_0xe8d0('0x47')]);_0x5829b9[_0xe8d0('0x48')]=qs[_0xe8d0('0x49')](_[_0xe8d0('0x4a')](_0x1cdf37[_0xe8d0('0x3f')],_0x439b39['filters']));_0x5829b9[_0xe8d0('0x48')][_0xe8d0('0x68')]=_0x59dff1['id'];if(_0x1cdf37['query']['filter']){_0x5829b9['where']=_[_0xe8d0('0x4b')](_0x5829b9[_0xe8d0('0x48')],{'$or':_[_0xe8d0('0x3e')](_0x5829b9[_0xe8d0('0x42')],function(_0x51595b){var _0x29cf57={};_0x29cf57[_0x51595b]={'$like':'%'+_0x1cdf37['query']['filter']+'%'};return _0x29cf57;})});}_0x5829b9=_[_0xe8d0('0x4b')]({},_0x5829b9,_0x1cdf37['options']);return db['CmHopperBlack'][_0xe8d0('0x22')]({'where':_0x5829b9['where']})[_0xe8d0('0x29')](function(_0x2b65fa){_0xc07427['count']=_0x2b65fa;if(_0x1cdf37[_0xe8d0('0x3f')][_0xe8d0('0x4e')]){_0x5829b9['include']=[{'all':!![]}];}return db[_0xe8d0('0x6e')][_0xe8d0('0x4f')](_0x5829b9);})[_0xe8d0('0x29')](function(_0x30fee6){_0xc07427[_0xe8d0('0x50')]=_0x30fee6;return _0xc07427;});}})[_0xe8d0('0x29')](respondWithFilteredResult(_0x2f303,_0x5829b9))[_0xe8d0('0x51')](handleError(_0x2f303,null));};exports[_0xe8d0('0x6f')]=function(_0x9e333a,_0xa3add4,_0x34a781){var _0x38ed60={};var _0x225935={};var _0x4dea64;var _0x2dd9b5;return db[_0xe8d0('0x3b')][_0xe8d0('0x65')]({'where':{'id':_0x9e333a[_0xe8d0('0x53')]['id']}})[_0xe8d0('0x29')](handleEntityNotFound(_0xa3add4,null))[_0xe8d0('0x29')](function(_0x40c2e6){if(_0x40c2e6){_0x4dea64=_0x40c2e6;_0x225935[_0xe8d0('0x3d')]=_[_0xe8d0('0x40')](db[_0xe8d0('0x70')][_0xe8d0('0x54')]);_0x225935[_0xe8d0('0x3f')]=_[_0xe8d0('0x40')](_0x9e333a[_0xe8d0('0x3f')]);_0x225935[_0xe8d0('0x49')]=_[_0xe8d0('0x41')](_0x225935[_0xe8d0('0x3d')],_0x225935[_0xe8d0('0x3f')]);_0x38ed60[_0xe8d0('0x42')]=_['intersection'](_0x225935[_0xe8d0('0x3d')],qs[_0xe8d0('0x43')](_0x9e333a['query']['fields']));_0x38ed60[_0xe8d0('0x42')]=_0x38ed60['attributes']['length']?_0x38ed60[_0xe8d0('0x42')]:_0x225935[_0xe8d0('0x3d')];_0x38ed60['order']=qs['sort'](_0x9e333a[_0xe8d0('0x3f')][_0xe8d0('0x47')]);_0x38ed60['where']=qs[_0xe8d0('0x49')](_[_0xe8d0('0x4a')](_0x9e333a['query'],_0x225935['filters']));if(_0x9e333a[_0xe8d0('0x3f')][_0xe8d0('0x2f')]){_0x38ed60[_0xe8d0('0x48')]=_[_0xe8d0('0x4b')](_0x38ed60[_0xe8d0('0x48')],{'$or':_['map'](_0x38ed60[_0xe8d0('0x42')],function(_0x2dd448){var _0x50e44a={};_0x50e44a[_0x2dd448]={'$like':'%'+_0x9e333a['query'][_0xe8d0('0x2f')]+'%'};return _0x50e44a;})});}_0x38ed60=_[_0xe8d0('0x4b')]({},_0x38ed60,_0x9e333a['options']);return _0x4dea64[_0xe8d0('0x6f')](_0x38ed60);}})[_0xe8d0('0x29')](function(_0x54878e){if(_0x54878e){_0x2dd9b5=_0x54878e['length'];if(!_0x9e333a[_0xe8d0('0x3f')]['hasOwnProperty'](_0xe8d0('0x45'))){_0x38ed60[_0xe8d0('0x24')]=qs[_0xe8d0('0x24')](_0x9e333a[_0xe8d0('0x3f')]['limit']);_0x38ed60[_0xe8d0('0x23')]=qs[_0xe8d0('0x23')](_0x9e333a[_0xe8d0('0x3f')]['offset']);}return _0x4dea64['getTeams'](_0x38ed60);}})[_0xe8d0('0x29')](function(_0x361667){if(_0x361667){return _0x361667?{'count':_0x2dd9b5,'rows':_0x361667}:null;}})[_0xe8d0('0x29')](respondWithResult(_0xa3add4,null))[_0xe8d0('0x51')](handleError(_0xa3add4,null));};exports[_0xe8d0('0x71')]=function(_0x48d623,_0x5b814d,_0x2c56bc){var _0x1f1d3d=_0x48d623[_0xe8d0('0x61')][_0xe8d0('0x72')];var _0x50825e=_[_0xe8d0('0x3e')](_0x1f1d3d,'id');return db[_0xe8d0('0x70')]['findAll']({'where':{'id':_0x50825e},'attributes':['id'],'include':[{'model':db[_0xe8d0('0x73')],'as':'Agents','attributes':['id',_0xe8d0('0x38'),_0xe8d0('0x74'),_0xe8d0('0x75'),'interface'],'raw':!![]}]})[_0xe8d0('0x29')](function(_0x16b684){if(_0x16b684){var _0x24b26f=_[_0xe8d0('0x76')](_0x16b684,function(_0x54e5fc){var _0x1a3ec8=_0x54e5fc[_0xe8d0('0x2b')]({'plain':!![]});_0x1a3ec8[_0xe8d0('0x77')]['forEach'](function(_0x3ddcc8){_0x3ddcc8['penalty']=_[_0xe8d0('0x33')](_0x1f1d3d,{'id':_0x1a3ec8['id']})['penalty'];});return _0x1a3ec8[_0xe8d0('0x77')];});return db['VoiceQueue']['find']({'where':{'id':_0x48d623['params']['id']}})[_0xe8d0('0x29')](function(_0x1ebe42){return db[_0xe8d0('0x78')][_0xe8d0('0x79')](function(_0x6ee9e3){return _0x1ebe42['addTeams'](_0x50825e,{'transaction':_0x6ee9e3})[_0xe8d0('0x29')](function(){return BPromise[_0xe8d0('0x7a')](_0x24b26f,function(_0x357611){return db[_0xe8d0('0x7b')][_0xe8d0('0x7c')]({'where':{'UserId':_0x357611['id'],'VoiceQueueId':_0x48d623[_0xe8d0('0x53')]['id']},'defaults':{'penalty':_0x357611[_0xe8d0('0x7d')]},'transaction':_0x6ee9e3});});})[_0xe8d0('0x29')](function(){return BPromise[_0xe8d0('0x7a')](_['filter'](_0x24b26f,{'online':!![]}),function(_0x2590b3){return db['UserVoiceQueueRt'][_0xe8d0('0x7e')]({'membername':_0x2590b3['name'],'UserId':_0x2590b3['id'],'queue_name':_0x1ebe42[_0xe8d0('0x38')],'VoiceQueueId':_0x1ebe42['id'],'interface':_[_0xe8d0('0x7f')](_0x2590b3[_0xe8d0('0x80')])?util[_0xe8d0('0x81')](_0xe8d0('0x82'),_0x2590b3['name']):_0x2590b3[_0xe8d0('0x80')],'paused':_0x2590b3[_0xe8d0('0x75')]||![],'penalty':_0x2590b3[_0xe8d0('0x7d')]},{'transaction':_0x6ee9e3});});})['then'](function(){_0x24b26f[_0xe8d0('0x83')](function(_0x152043){socket[_0xe8d0('0x84')](_0xe8d0('0x85'),{'UserId':_0x152043['id'],'VoiceQueueId':_0x1ebe42['id']});});});});});}})[_0xe8d0('0x29')](respondWithStatusCode(_0x5b814d,null))['catch'](handleError(_0x5b814d,null));};exports['removeTeams']=function(_0x1b3a0d,_0x47d94c,_0x72bd94){return db[_0xe8d0('0x70')][_0xe8d0('0x4f')]({'where':{'id':_0x1b3a0d[_0xe8d0('0x3f')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe8d0('0x73')],'as':_0xe8d0('0x77'),'attributes':['id'],'raw':!![]}]})[_0xe8d0('0x29')](handleEntityNotFound(_0x47d94c,null))['then'](function(_0x2e35ef){var _0x5420f5=_[_0xe8d0('0x3e')](_0x2e35ef,'id');var _0x37cf43=[];var _0x346716=[];var _0x45fa0d=squel[_0xe8d0('0x86')]();_0x45fa0d[_0xe8d0('0x87')](_0xe8d0('0x88'))[_0xe8d0('0x89')](_0xe8d0('0x8a'),'tq')[_0xe8d0('0x8b')]('user_has_teams','ut',_0xe8d0('0x8c'))[_0xe8d0('0x48')](_0xe8d0('0x8d'),_0x1b3a0d['params']['id']);for(var _0x5eea6c=0x0;_0x5eea6c<_0x2e35ef[_0xe8d0('0x44')];_0x5eea6c+=0x1){let _0xa2021c=_0x2e35ef[_0x5eea6c];for(var _0x5f4b56=0x0;_0x5f4b56<_0xa2021c[_0xe8d0('0x77')]['length'];_0x5f4b56+=0x1){let _0x3f8cf5=_0xa2021c[_0xe8d0('0x77')][_0x5f4b56];var _0x8bfcda=_0x45fa0d[_0xe8d0('0x8e')]();_0x8bfcda[_0xe8d0('0x48')]('ut.UserId\x20=\x20?',_0x3f8cf5['id']);_0x346716['push'](db[_0xe8d0('0x78')][_0xe8d0('0x3f')](_0x8bfcda[_0xe8d0('0x8f')](),{'type':db[_0xe8d0('0x78')][_0xe8d0('0x90')]['SELECT']})[_0xe8d0('0x29')](function(_0x951308){if(_0x951308[_0xe8d0('0x44')]===0x1){return _0x3f8cf5['id'];}else{var _0x5bda3a=_[_0xe8d0('0x91')](_['map'](_0x951308,_0xe8d0('0x92')),function(_0x5a40c2){return _[_0xe8d0('0x93')](_0x5420f5,_0x5a40c2);});if(_0x5bda3a){return _0x3f8cf5['id'];}}}));}}return BPromise['all'](_0x346716)[_0xe8d0('0x29')](function(_0x371569){_0x37cf43=_(_0x37cf43)[_0xe8d0('0x94')](_0x371569)['compact']()['value']();return db[_0xe8d0('0x3b')][_0xe8d0('0x33')]({'where':{'id':_0x1b3a0d[_0xe8d0('0x53')]['id']}})[_0xe8d0('0x29')](function(_0x42ad80){return db[_0xe8d0('0x78')][_0xe8d0('0x79')](function(_0x5df6c8){return _0x42ad80['removeTeams'](_0x1b3a0d[_0xe8d0('0x3f')][_0xe8d0('0x95')],{'transaction':_0x5df6c8})['then'](function(){if(!_[_0xe8d0('0x96')](_0x37cf43)){return _0x42ad80['removeAgents'](_0x37cf43,{'transaction':_0x5df6c8})[_0xe8d0('0x29')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x1b3a0d[_0xe8d0('0x53')]['id'],'UserId':_0x37cf43},'transaction':_0x5df6c8});});}})[_0xe8d0('0x29')](function(){_0x37cf43['forEach'](function(_0x5bc695){socket[_0xe8d0('0x84')]('userVoiceQueue:remove',{'UserId':_0x5bc695,'VoiceQueueId':_0x42ad80['id']});});});});});});})[_0xe8d0('0x29')](respondWithStatusCode(_0x47d94c,null))['catch'](handleError(_0x47d94c,null));};exports[_0xe8d0('0x97')]=function(_0x172121,_0x3dff21,_0x5a87ee){var _0x1acb00,_0x2b9e65;return db['VoiceQueue'][_0xe8d0('0x33')]({'where':{'id':_0x172121[_0xe8d0('0x53')]['id']}})[_0xe8d0('0x29')](handleEntityNotFound(_0x3dff21,null))[_0xe8d0('0x29')](function(_0x5a1e76){if(_0x5a1e76){_0x2b9e65=_0x5a1e76;return _0x5a1e76[_0xe8d0('0x97')](_0x172121[_0xe8d0('0x61')][_0xe8d0('0x95')],_[_0xe8d0('0x5e')](_0x172121['body'],[_0xe8d0('0x95'),'id'])||{})[_0xe8d0('0x98')](function(_0x19385d){for(var _0x512dd4=0x0;_0x512dd4<_0x172121[_0xe8d0('0x61')][_0xe8d0('0x95')]['length'];_0x512dd4+=0x1){socket[_0xe8d0('0x84')](_0xe8d0('0x85'),{'UserId':_0x172121[_0xe8d0('0x61')]['ids'][_0x512dd4],'VoiceQueueId':_0x172121['params']['id']});}return _0x19385d;});}})['then'](function(_0x5bbe7b){_0x1acb00=_0x5bbe7b||[];if(_0x2b9e65){return db[_0xe8d0('0x73')]['findAll']({'where':{'id':_0x172121[_0xe8d0('0x61')]['ids']},'attributes':['id',_0xe8d0('0x38'),'online',_0xe8d0('0x75'),'interface'],'raw':!![]});}})[_0xe8d0('0x29')](function(_0x168bd8){if(!_[_0xe8d0('0x96')](_0x168bd8)){var _0x284c03=[];for(var _0x23e7d4=0x0;_0x23e7d4<_0x168bd8['length'];_0x23e7d4++){if(_0x168bd8[_0x23e7d4]['online']){_0x284c03[_0xe8d0('0x99')](db[_0xe8d0('0x9a')]['upsert']({'membername':_0x168bd8[_0x23e7d4]['name'],'UserId':_0x168bd8[_0x23e7d4]['id'],'queue_name':_0x2b9e65['name'],'VoiceQueueId':_0x2b9e65['id'],'interface':_[_0xe8d0('0x7f')](_0x168bd8[_0x23e7d4][_0xe8d0('0x80')])?util['format'](_0xe8d0('0x82'),_0x168bd8[_0x23e7d4][_0xe8d0('0x38')]):_0x168bd8[_0x23e7d4][_0xe8d0('0x80')],'paused':_0x168bd8[_0x23e7d4][_0xe8d0('0x75')]||![],'penalty':_0x172121[_0xe8d0('0x61')][_0xe8d0('0x7d')]||0x0}));}}return BPromise[_0xe8d0('0x9b')](_0x284c03);}})[_0xe8d0('0x29')](function(){return _0x1acb00;})[_0xe8d0('0x29')](respondWithResult(_0x3dff21,null))['catch'](handleError(_0x3dff21,null));};exports[_0xe8d0('0x9c')]=function(_0x536ab1,_0x253849,_0x137064){return db['VoiceQueue']['find']({'where':{'id':_0x536ab1['params']['id']}})[_0xe8d0('0x29')](handleEntityNotFound(_0x253849,null))['then'](function(_0x2ed64c){if(_0x2ed64c){return _0x2ed64c[_0xe8d0('0x9c')](_0x536ab1['query']['ids'])[_0xe8d0('0x29')](function(){if(_['isArray'](_0x536ab1[_0xe8d0('0x3f')][_0xe8d0('0x95')])){for(var _0x5d3987=0x0;_0x5d3987<_0x536ab1[_0xe8d0('0x3f')]['ids'][_0xe8d0('0x44')];_0x5d3987+=0x1){socket[_0xe8d0('0x84')](_0xe8d0('0x9d'),{'UserId':Number(_0x536ab1['query'][_0xe8d0('0x95')][_0x5d3987]),'VoiceQueueId':Number(_0x536ab1[_0xe8d0('0x53')]['id'])});}}else{socket[_0xe8d0('0x84')]('userVoiceQueue:remove',{'UserId':Number(_0x536ab1['query'][_0xe8d0('0x95')]),'VoiceQueueId':Number(_0x536ab1['params']['id'])});}});}})[_0xe8d0('0x29')](function(_0x454f6f){return db[_0xe8d0('0x9a')][_0xe8d0('0x2a')]({'where':{'VoiceQueueId':_0x536ab1['params']['id'],'UserId':_0x536ab1[_0xe8d0('0x3f')]['ids']}})['then'](function(){return _0x454f6f;});})['then'](respondWithStatusCode(_0x253849,null))[_0xe8d0('0x51')](handleError(_0x253849,null));};exports[_0xe8d0('0x9e')]=function(_0x2b7530,_0x258265,_0x19f710){var _0x5a90f3={};var _0xf18e32={};var _0x5b821d;var _0x4af90e;return db[_0xe8d0('0x3b')][_0xe8d0('0x65')]({'where':{'id':_0x2b7530[_0xe8d0('0x53')]['id']}})['then'](handleEntityNotFound(_0x258265,null))[_0xe8d0('0x29')](function(_0x2f5242){if(_0x2f5242){_0x5b821d=_0x2f5242;_0xf18e32[_0xe8d0('0x3d')]=_[_0xe8d0('0x40')](db[_0xe8d0('0x73')]['rawAttributes']);_0xf18e32[_0xe8d0('0x3f')]=_[_0xe8d0('0x40')](_0x2b7530[_0xe8d0('0x3f')]);_0xf18e32[_0xe8d0('0x49')]=_[_0xe8d0('0x41')](_0xf18e32[_0xe8d0('0x3d')],_0xf18e32[_0xe8d0('0x3f')]);_0x5a90f3[_0xe8d0('0x42')]=_[_0xe8d0('0x41')](_0xf18e32[_0xe8d0('0x3d')],qs[_0xe8d0('0x43')](_0x2b7530['query'][_0xe8d0('0x43')]));_0x5a90f3['attributes']=_0x5a90f3['attributes'][_0xe8d0('0x44')]?_0x5a90f3[_0xe8d0('0x42')]:_0xf18e32[_0xe8d0('0x3d')];_0x5a90f3['order']=qs[_0xe8d0('0x47')](_0x2b7530[_0xe8d0('0x3f')][_0xe8d0('0x47')]);_0x5a90f3[_0xe8d0('0x48')]=qs[_0xe8d0('0x49')](_[_0xe8d0('0x4a')](_0x2b7530['query'],_0xf18e32[_0xe8d0('0x49')]));if(_0x2b7530[_0xe8d0('0x3f')][_0xe8d0('0x2f')]){_0x5a90f3[_0xe8d0('0x48')]=_[_0xe8d0('0x4b')](_0x5a90f3[_0xe8d0('0x48')],{'$or':_['map'](_0x5a90f3['attributes'],function(_0x7d71ac){var _0x46d178={};_0x46d178[_0x7d71ac]={'$like':'%'+_0x2b7530[_0xe8d0('0x3f')][_0xe8d0('0x2f')]+'%'};return _0x46d178;})});}_0x5a90f3=_[_0xe8d0('0x4b')]({},_0x5a90f3,_0x2b7530[_0xe8d0('0x4d')]);return _0x5b821d['getAgents'](_0x5a90f3);}})[_0xe8d0('0x29')](function(_0x32c851){if(_0x32c851){_0x4af90e=_0x32c851[_0xe8d0('0x44')];if(!_0x2b7530[_0xe8d0('0x3f')][_0xe8d0('0x67')]('nolimit')){_0x5a90f3[_0xe8d0('0x24')]=qs[_0xe8d0('0x24')](_0x2b7530[_0xe8d0('0x3f')]['limit']);_0x5a90f3[_0xe8d0('0x23')]=qs[_0xe8d0('0x23')](_0x2b7530[_0xe8d0('0x3f')][_0xe8d0('0x23')]);}return _0x5b821d['getAgents'](_0x5a90f3);}})[_0xe8d0('0x29')](function(_0xca9b3b){if(_0xca9b3b){return _0xca9b3b?{'count':_0x4af90e,'rows':_0xca9b3b}:null;}})[_0xe8d0('0x29')](respondWithResult(_0x258265,null))[_0xe8d0('0x51')](handleError(_0x258265,null));};exports[_0xe8d0('0x9f')]=function(_0x47a8b6,_0x24a7cb,_0x47099a){var _0x276a0c={};var _0xf94727={};var _0x1b6363;var _0x2595e3;return db[_0xe8d0('0x3b')]['findOne']({'where':{'id':_0x47a8b6[_0xe8d0('0x53')]['id']}})['then'](handleEntityNotFound(_0x24a7cb,null))[_0xe8d0('0x29')](function(_0x557a73){if(_0x557a73){_0x1b6363=_0x557a73;_0xf94727[_0xe8d0('0x3d')]=_['keys'](db[_0xe8d0('0x9a')][_0xe8d0('0x54')]);_0xf94727['query']=_[_0xe8d0('0x40')](_0x47a8b6[_0xe8d0('0x3f')]);_0xf94727[_0xe8d0('0x49')]=_[_0xe8d0('0x41')](_0xf94727[_0xe8d0('0x3d')],_0xf94727['query']);_0x276a0c[_0xe8d0('0x42')]=_[_0xe8d0('0x41')](_0xf94727['model'],qs[_0xe8d0('0x43')](_0x47a8b6['query']['fields']));_0x276a0c[_0xe8d0('0x42')]=_0x276a0c[_0xe8d0('0x42')][_0xe8d0('0x44')]?_0x276a0c['attributes']:_0xf94727[_0xe8d0('0x3d')];_0x276a0c[_0xe8d0('0x46')]=qs['sort'](_0x47a8b6[_0xe8d0('0x3f')]['sort']);_0x276a0c[_0xe8d0('0x48')]=qs[_0xe8d0('0x49')](_[_0xe8d0('0x4a')](_0x47a8b6['query'],_0xf94727[_0xe8d0('0x49')]));if(_0x47a8b6[_0xe8d0('0x3f')][_0xe8d0('0x2f')]){_0x276a0c[_0xe8d0('0x48')]=_[_0xe8d0('0x4b')](_0x276a0c[_0xe8d0('0x48')],{'$or':_[_0xe8d0('0x3e')](_0x276a0c[_0xe8d0('0x42')],function(_0x4e33e0){var _0x19f74f={};_0x19f74f[_0x4e33e0]={'$like':'%'+_0x47a8b6[_0xe8d0('0x3f')][_0xe8d0('0x2f')]+'%'};return _0x19f74f;})});}_0x276a0c=_[_0xe8d0('0x4b')]({},_0x276a0c,_0x47a8b6[_0xe8d0('0x4d')]);return _0x1b6363[_0xe8d0('0x9f')](_0x276a0c);}})['then'](function(_0x354455){if(_0x354455){_0x2595e3=_0x354455[_0xe8d0('0x44')];if(!_0x47a8b6[_0xe8d0('0x3f')][_0xe8d0('0x67')](_0xe8d0('0x45'))){_0x276a0c[_0xe8d0('0x24')]=qs[_0xe8d0('0x24')](_0x47a8b6[_0xe8d0('0x3f')][_0xe8d0('0x24')]);_0x276a0c[_0xe8d0('0x23')]=qs[_0xe8d0('0x23')](_0x47a8b6['query'][_0xe8d0('0x23')]);}return _0x1b6363[_0xe8d0('0x9f')](_0x276a0c);}})[_0xe8d0('0x29')](function(_0x177734){return _0x177734?{'count':_0x2595e3,'rows':_0x177734}:null;})[_0xe8d0('0x29')](respondWithResult(_0x24a7cb,null))['catch'](handleError(_0x24a7cb,null));};exports['getLists']=function(_0x11505a,_0x26c71f,_0x231f49){var _0x4db989={};var _0x4811b9={};var _0xff41cc;var _0x318899;return db[_0xe8d0('0x3b')][_0xe8d0('0x65')]({'where':{'id':_0x11505a[_0xe8d0('0x53')]['id']}})[_0xe8d0('0x29')](handleEntityNotFound(_0x26c71f,null))['then'](function(_0x513d1f){if(_0x513d1f){_0xff41cc=_0x513d1f;_0x4811b9['model']=_[_0xe8d0('0x40')](db['CmList']['rawAttributes']);_0x4811b9['query']=_[_0xe8d0('0x40')](_0x11505a[_0xe8d0('0x3f')]);_0x4811b9[_0xe8d0('0x49')]=_[_0xe8d0('0x41')](_0x4811b9[_0xe8d0('0x3d')],_0x4811b9['query']);_0x4db989[_0xe8d0('0x42')]=_[_0xe8d0('0x41')](_0x4811b9[_0xe8d0('0x3d')],qs[_0xe8d0('0x43')](_0x11505a[_0xe8d0('0x3f')]['fields']));_0x4db989[_0xe8d0('0x42')]=_0x4db989[_0xe8d0('0x42')]['length']?_0x4db989[_0xe8d0('0x42')]:_0x4811b9[_0xe8d0('0x3d')];_0x4db989['order']=qs[_0xe8d0('0x47')](_0x11505a['query'][_0xe8d0('0x47')]);_0x4db989['where']=qs['filters'](_[_0xe8d0('0x4a')](_0x11505a[_0xe8d0('0x3f')],_0x4811b9[_0xe8d0('0x49')]));if(_0x11505a[_0xe8d0('0x3f')][_0xe8d0('0x2f')]){_0x4db989[_0xe8d0('0x48')]=_['merge'](_0x4db989[_0xe8d0('0x48')],{'$or':_[_0xe8d0('0x3e')](_0x4db989['attributes'],function(_0x24a68a){var _0x698d8b={};_0x698d8b[_0x24a68a]={'$like':'%'+_0x11505a[_0xe8d0('0x3f')]['filter']+'%'};return _0x698d8b;})});}_0x4db989=_['merge']({},_0x4db989,_0x11505a['options']);return _0xff41cc[_0xe8d0('0xa0')](_0x4db989);}})['then'](function(_0x59fae7){if(_0x59fae7){_0x318899=_0x59fae7['length'];if(!_0x11505a[_0xe8d0('0x3f')]['hasOwnProperty'](_0xe8d0('0x45'))){_0x4db989[_0xe8d0('0x24')]=qs[_0xe8d0('0x24')](_0x11505a[_0xe8d0('0x3f')][_0xe8d0('0x24')]);_0x4db989['offset']=qs['offset'](_0x11505a['query']['offset']);}return _0xff41cc['getLists'](_0x4db989);}})[_0xe8d0('0x29')](function(_0x3e4111){if(_0x3e4111){return _0x3e4111?{'count':_0x318899,'rows':_0x3e4111}:null;}})['then'](respondWithResult(_0x26c71f,null))[_0xe8d0('0x51')](handleError(_0x26c71f,null));};exports[_0xe8d0('0xa1')]=function(_0x2b7f16,_0x34a17d,_0x4eda30){var _0x45b6b7,_0x4ef9d2;return db[_0xe8d0('0x3b')]['find']({'where':{'id':_0x2b7f16[_0xe8d0('0x53')]['id']}})[_0xe8d0('0x29')](handleEntityNotFound(_0x34a17d,null))[_0xe8d0('0x29')](function(_0x264913){if(_0x264913){_0x4ef9d2=_0x264913;return _0x264913[_0xe8d0('0xa1')](_0x2b7f16[_0xe8d0('0x61')]['ids'],_[_0xe8d0('0x5e')](_0x2b7f16[_0xe8d0('0x61')],[_0xe8d0('0x95'),'id'])||{});}return null;})[_0xe8d0('0x98')](function(_0x142d62){var _0x49d3c8;_0x45b6b7=_0x142d62||[];var _0x5a8c45=[];if(_0x142d62){for(var _0x2961bc=0x0;_0x2961bc<_0x142d62[_0xe8d0('0x44')];_0x2961bc+=0x1){var _0x2bd2bd=_0x142d62[_0x2961bc][_0xe8d0('0x2b')]({'plain':!![]});_0x4ef9d2['dialCheckDuplicateType']=_0x2b7f16[_0xe8d0('0x61')][_0xe8d0('0xa2')]?_0x2b7f16[_0xe8d0('0x61')][_0xe8d0('0xa2')]:_0x4ef9d2[_0xe8d0('0xa2')];switch(_0x4ef9d2[_0xe8d0('0xa2')]){case _0xe8d0('0xa3'):_0x49d3c8=squel['insert']()['into'](_0xe8d0('0xa4'))[_0xe8d0('0xa5')]([_0xe8d0('0xa6'),_0xe8d0('0xa7'),_0xe8d0('0xa8'),'ListId','VoiceQueueId',_0xe8d0('0x5f'),_0xe8d0('0x60')],squel[_0xe8d0('0x86')]()[_0xe8d0('0x87')]('phone',_0xe8d0('0xa6'))[_0xe8d0('0x87')](_0xe8d0('0xa9'),'scheduledAt')[_0xe8d0('0x87')]('id',_0xe8d0('0xa8'))[_0xe8d0('0x87')](_0x2bd2bd[_0xe8d0('0xaa')][_0xe8d0('0x8f')](),'ListId')[_0xe8d0('0x87')](_0x2b7f16[_0xe8d0('0x53')]['id'][_0xe8d0('0x8f')](),_0xe8d0('0x68'))[_0xe8d0('0x87')](_0xe8d0('0xa9'),_0xe8d0('0x5f'))[_0xe8d0('0x87')](_0xe8d0('0xa9'),_0xe8d0('0x60'))[_0xe8d0('0x89')](_0xe8d0('0xab'))[_0xe8d0('0x48')](_0xe8d0('0xac'))[_0xe8d0('0x48')]('ListId\x20=\x20?',_0x2bd2bd[_0xe8d0('0xaa')][_0xe8d0('0x8f')]())[_0xe8d0('0x48')](_0xe8d0('0xad'))['where'](_0xe8d0('0xae'),squel[_0xe8d0('0x86')]()[_0xe8d0('0x87')]('COALESCE(calleridnum,\x27\x27)')['from'](_0xe8d0('0xaf'))['where'](_0xe8d0('0x8d'),_0x2b7f16[_0xe8d0('0x53')]['id'][_0xe8d0('0x8f')]()))[_0xe8d0('0x48')](_0xe8d0('0xae'),squel['select']()['field'](_0xe8d0('0xb0'))['from'](_0xe8d0('0xa4'))[_0xe8d0('0x48')](_0xe8d0('0x8d'),_0x2b7f16[_0xe8d0('0x53')]['id'][_0xe8d0('0x8f')]())))['toString']();break;case'onlyIfOpen':_0x49d3c8=squel['insert']()[_0xe8d0('0xb1')]('cm_hopper')[_0xe8d0('0xa5')](['phone',_0xe8d0('0xa7'),_0xe8d0('0xa8'),_0xe8d0('0xb2'),_0xe8d0('0x68'),_0xe8d0('0x5f'),'updatedAt'],squel[_0xe8d0('0x86')]()[_0xe8d0('0x87')](_0xe8d0('0xa6'),_0xe8d0('0xa6'))['field'](_0xe8d0('0xa9'),'scheduledAt')[_0xe8d0('0x87')]('id','ContactId')[_0xe8d0('0x87')](_0x2bd2bd[_0xe8d0('0xaa')]['toString'](),'ListId')[_0xe8d0('0x87')](_0x2b7f16[_0xe8d0('0x53')]['id'][_0xe8d0('0x8f')](),'VoiceQueueId')[_0xe8d0('0x87')](_0xe8d0('0xa9'),_0xe8d0('0x5f'))[_0xe8d0('0x87')](_0xe8d0('0xa9'),_0xe8d0('0x60'))[_0xe8d0('0x89')](_0xe8d0('0xab'))[_0xe8d0('0x48')](_0xe8d0('0xac'))['where'](_0xe8d0('0xb3'),_0x2bd2bd[_0xe8d0('0xaa')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0xe8d0('0xae'),squel[_0xe8d0('0x86')]()[_0xe8d0('0x87')](_0xe8d0('0xb0'))[_0xe8d0('0x89')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x2b7f16['params']['id'][_0xe8d0('0x8f')]())))[_0xe8d0('0x8f')]();break;default:_0x49d3c8=squel[_0xe8d0('0xb4')]()[_0xe8d0('0xb1')]('cm_hopper')[_0xe8d0('0xa5')](['phone',_0xe8d0('0xa7'),_0xe8d0('0xa8'),_0xe8d0('0xb2'),_0xe8d0('0x68'),'createdAt',_0xe8d0('0x60')],squel['select']()[_0xe8d0('0x87')](_0xe8d0('0xa6'),_0xe8d0('0xa6'))[_0xe8d0('0x87')](_0xe8d0('0xa9'),_0xe8d0('0xa7'))[_0xe8d0('0x87')]('id',_0xe8d0('0xa8'))[_0xe8d0('0x87')](_0x2bd2bd[_0xe8d0('0xaa')][_0xe8d0('0x8f')](),'ListId')[_0xe8d0('0x87')](_0x2b7f16[_0xe8d0('0x53')]['id'][_0xe8d0('0x8f')](),_0xe8d0('0x68'))[_0xe8d0('0x87')](_0xe8d0('0xa9'),'createdAt')[_0xe8d0('0x87')](_0xe8d0('0xa9'),_0xe8d0('0x60'))[_0xe8d0('0x89')](_0xe8d0('0xab'))['where'](_0xe8d0('0xac'))[_0xe8d0('0x48')]('ListId\x20=\x20?',_0x2bd2bd[_0xe8d0('0xaa')][_0xe8d0('0x8f')]())[_0xe8d0('0x48')](_0xe8d0('0xad')))['toString']();}_0x5a8c45[_0xe8d0('0x99')](db['sequelize'][_0xe8d0('0x3f')](_0x49d3c8));}return BPromise[_0xe8d0('0x9b')](_0x5a8c45);}})['then'](function(){return _0x45b6b7;})[_0xe8d0('0x29')](respondWithResult(_0x34a17d,null))['catch'](handleError(_0x34a17d,null));};exports[_0xe8d0('0xb5')]=function(_0x197657,_0x3de30d,_0x58b9c3){return db[_0xe8d0('0x3b')][_0xe8d0('0x33')]({'where':{'id':_0x197657[_0xe8d0('0x53')]['id']}})['then'](handleEntityNotFound(_0x3de30d,null))[_0xe8d0('0x29')](function(_0x193394){if(_0x193394){return _0x193394['removeLists'](_0x197657['query'][_0xe8d0('0x95')]);}})[_0xe8d0('0x29')](function(_0x502906){if(_0x502906){return db[_0xe8d0('0x66')][_0xe8d0('0x2a')]({'where':{'ListId':_0x197657[_0xe8d0('0x3f')][_0xe8d0('0x95')],'VoiceQueueId':_0x197657['params']['id']}})[_0xe8d0('0x29')](function(){return _0x502906;});}})[_0xe8d0('0x29')](respondWithStatusCode(_0x3de30d,null))[_0xe8d0('0x51')](handleError(_0x3de30d,null));};exports[_0xe8d0('0xb6')]=function(_0x3a6494,_0xbd8132,_0x39a371){var _0x329801={};var _0x510d8b={};var _0x158f39;var _0x7ce6a1;return db[_0xe8d0('0x3b')][_0xe8d0('0x65')]({'where':{'id':_0x3a6494[_0xe8d0('0x53')]['id']}})[_0xe8d0('0x29')](handleEntityNotFound(_0xbd8132,null))[_0xe8d0('0x29')](function(_0x1d90cd){if(_0x1d90cd){_0x158f39=_0x1d90cd;_0x510d8b['model']=_['keys'](db[_0xe8d0('0xb7')][_0xe8d0('0x54')]);_0x510d8b['query']=_[_0xe8d0('0x40')](_0x3a6494[_0xe8d0('0x3f')]);_0x510d8b[_0xe8d0('0x49')]=_['intersection'](_0x510d8b[_0xe8d0('0x3d')],_0x510d8b['query']);_0x329801[_0xe8d0('0x42')]=_['intersection'](_0x510d8b['model'],qs[_0xe8d0('0x43')](_0x3a6494[_0xe8d0('0x3f')][_0xe8d0('0x43')]));_0x329801['attributes']=_0x329801['attributes']['length']?_0x329801[_0xe8d0('0x42')]:_0x510d8b['model'];_0x329801['order']=qs[_0xe8d0('0x47')](_0x3a6494[_0xe8d0('0x3f')][_0xe8d0('0x47')]);_0x329801['where']=qs[_0xe8d0('0x49')](_[_0xe8d0('0x4a')](_0x3a6494[_0xe8d0('0x3f')],_0x510d8b['filters']));if(_0x3a6494[_0xe8d0('0x3f')][_0xe8d0('0x2f')]){_0x329801[_0xe8d0('0x48')]=_[_0xe8d0('0x4b')](_0x329801[_0xe8d0('0x48')],{'$or':_['map'](_0x329801[_0xe8d0('0x42')],function(_0x5addb7){var _0x508af0={};_0x508af0[_0x5addb7]={'$like':'%'+_0x3a6494['query']['filter']+'%'};return _0x508af0;})});}_0x329801=_[_0xe8d0('0x4b')]({},_0x329801,_0x3a6494[_0xe8d0('0x4d')]);return _0x158f39[_0xe8d0('0xb6')](_0x329801);}})[_0xe8d0('0x29')](function(_0x32859d){if(_0x32859d){_0x7ce6a1=_0x32859d[_0xe8d0('0x44')];if(!_0x3a6494[_0xe8d0('0x3f')][_0xe8d0('0x67')](_0xe8d0('0x45'))){_0x329801[_0xe8d0('0x24')]=qs[_0xe8d0('0x24')](_0x3a6494[_0xe8d0('0x3f')][_0xe8d0('0x24')]);_0x329801[_0xe8d0('0x23')]=qs[_0xe8d0('0x23')](_0x3a6494[_0xe8d0('0x3f')]['offset']);}return _0x158f39['getBlackLists'](_0x329801);}})[_0xe8d0('0x29')](function(_0xabd9f8){if(_0xabd9f8){return _0xabd9f8?{'count':_0x7ce6a1,'rows':_0xabd9f8}:null;}})[_0xe8d0('0x29')](respondWithResult(_0xbd8132,null))['catch'](handleError(_0xbd8132,null));};exports[_0xe8d0('0xb8')]=function(_0x464b1a,_0x57a9e5,_0x581d15){var _0xa74e36,_0x8f728e;return db[_0xe8d0('0x3b')][_0xe8d0('0x33')]({'where':{'id':_0x464b1a[_0xe8d0('0x53')]['id']}})[_0xe8d0('0x29')](handleEntityNotFound(_0x57a9e5,null))[_0xe8d0('0x29')](function(_0x2e6f35){if(_0x2e6f35){_0x8f728e=_0x2e6f35;return _0x2e6f35[_0xe8d0('0xb8')](_0x464b1a[_0xe8d0('0x61')][_0xe8d0('0x95')],_[_0xe8d0('0x5e')](_0x464b1a[_0xe8d0('0x61')],[_0xe8d0('0x95'),'id'])||{});}return null;})[_0xe8d0('0x98')](function(_0x194628){var _0x2d8c37;_0xa74e36=_0x194628||[];var _0x3efc33=[];if(_0x194628){for(var _0x2c753a=0x0;_0x2c753a<_0x194628[_0xe8d0('0x44')];_0x2c753a+=0x1){var _0x5aeec2=_0x194628[_0x2c753a][_0xe8d0('0x2b')]({'plain':!![]});_0x2d8c37=squel[_0xe8d0('0xb4')]()[_0xe8d0('0xb1')](_0xe8d0('0xb9'))[_0xe8d0('0xa5')]([_0xe8d0('0xa6'),_0xe8d0('0xa8'),_0xe8d0('0xb2'),_0xe8d0('0x68'),_0xe8d0('0x5f'),_0xe8d0('0x60')],squel['select']()[_0xe8d0('0x87')](_0xe8d0('0xa6'),_0xe8d0('0xa6'))[_0xe8d0('0x87')]('id',_0xe8d0('0xa8'))[_0xe8d0('0x87')](_0x5aeec2[_0xe8d0('0xaa')][_0xe8d0('0x8f')](),_0xe8d0('0xb2'))[_0xe8d0('0x87')](_0x464b1a[_0xe8d0('0x53')]['id']['toString'](),_0xe8d0('0x68'))[_0xe8d0('0x87')](_0xe8d0('0xa9'),_0xe8d0('0x5f'))[_0xe8d0('0x87')](_0xe8d0('0xa9'),_0xe8d0('0x60'))[_0xe8d0('0x89')]('cm_contacts')[_0xe8d0('0x48')](_0xe8d0('0xac'))['where']('ListId\x20=\x20?',_0x5aeec2['CmListId'][_0xe8d0('0x8f')]())[_0xe8d0('0x48')]('phone\x20IS\x20NOT\x20NULL'))[_0xe8d0('0x8f')]();_0x3efc33[_0xe8d0('0x99')](db['sequelize'][_0xe8d0('0x3f')](_0x2d8c37));}return BPromise['all'](_0x3efc33);}})['then'](function(){return _0xa74e36;})['then'](respondWithResult(_0x57a9e5,null))[_0xe8d0('0x51')](handleError(_0x57a9e5,null));};exports[_0xe8d0('0xba')]=function(_0x1c91e7,_0x48dea5,_0x2ee7a5){return db[_0xe8d0('0x3b')][_0xe8d0('0x33')]({'where':{'id':_0x1c91e7[_0xe8d0('0x53')]['id']}})[_0xe8d0('0x29')](handleEntityNotFound(_0x48dea5,null))[_0xe8d0('0x29')](function(_0x1ab8a0){if(_0x1ab8a0){return _0x1ab8a0['removeBlackLists'](_0x1c91e7[_0xe8d0('0x3f')][_0xe8d0('0x95')]);}})[_0xe8d0('0x29')](function(_0x4c2cdf){if(_0x4c2cdf){return db[_0xe8d0('0x6e')][_0xe8d0('0x2a')]({'where':{'ListId':_0x1c91e7[_0xe8d0('0x3f')][_0xe8d0('0x95')],'VoiceQueueId':_0x1c91e7[_0xe8d0('0x53')]['id']}})[_0xe8d0('0x29')](function(){return _0x4c2cdf;});}})[_0xe8d0('0x29')](respondWithStatusCode(_0x48dea5,null))[_0xe8d0('0x51')](handleError(_0x48dea5,null));}; \ No newline at end of file +var _0x008c=['getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','phone','scheduledAt','ContactId','ListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','into','fromQuery','CmListId','ListId\x20=\x20?','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','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','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','status','json','count','set','reject','save','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','value','includes','type','find','name','error','stack','index','map','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','filtears','length','include','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','catch','clone','omit','createdAt','updatedAt','role','UserProfileResource','update','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','User','online','voicePause','interface','Agents','penalty','sequelize','UserVoiceQueue','findOrCreate','each','UserVoiceQueueRt','upsert','isNil','format','emit','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','union','compact','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','SIP/%s','all','isArray','getAgents','getMembers'];(function(_0x213721,_0xc41653){var _0x6435ee=function(_0x6b1fe){while(--_0x6b1fe){_0x213721['push'](_0x213721['shift']());}};_0x6435ee(++_0xc41653);}(_0x008c,0x188));var _0xc008=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0x008c[_0x55821d];return _0x58ea8a;};'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 licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];config[_0xc008('0x18')]=_[_0xc008('0x19')](config[_0xc008('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc008('0x18')]));require('./voiceQueue.socket')[_0xc008('0x1a')](socket);function respondWithStatusCode(_0x4584e1,_0x2073ef){_0x2073ef=_0x2073ef||0xcc;return function(_0x339ffc){if(_0x339ffc){return _0x4584e1[_0xc008('0x1b')](_0x2073ef);}return _0x4584e1['status'](_0x2073ef)['end']();};}function respondWithResult(_0x4bd0f4,_0x11ef38){_0x11ef38=_0x11ef38||0xc8;return function(_0x15a6ad){if(_0x15a6ad){return _0x4bd0f4[_0xc008('0x1c')](_0x11ef38)[_0xc008('0x1d')](_0x15a6ad);}};}function respondWithFilteredResult(_0x4fe771,_0x53b06e){return function(_0x540e45){if(_0x540e45){var _0x5c2668=_0x540e45[_0xc008('0x1e')],_0x46042b=_0x53b06e['offset'],_0x462af5=_0x53b06e['offset']+_0x53b06e['limit'],_0x501137;if(_0x462af5>=_0x5c2668){_0x462af5=_0x5c2668;_0x501137=0xc8;}else{_0x501137=0xce;}_0x4fe771['status'](_0x501137);return _0x4fe771[_0xc008('0x1f')]('Content-Range',_0x46042b+'-'+_0x462af5+'/'+_0x5c2668)['json'](_0x540e45);}return null;};}function patchUpdates(_0x590a71){return function(_0x4a582d){try{jsonpatch['apply'](_0x4a582d,_0x590a71,!![]);}catch(_0x13a263){return BPromise[_0xc008('0x20')](_0x13a263);}return _0x4a582d[_0xc008('0x21')]();};}function saveUpdates(_0x415af3,_0x11cc75){return function(_0x110128){if(_0x110128){return _0x110128['update'](_0x415af3)[_0xc008('0x22')](function(_0x5c85f2){return _0x5c85f2;});}return null;};}function removeEntity(_0x58a6ea,_0x218599){return function(_0x36f358){if(_0x36f358){return _0x36f358[_0xc008('0x23')]()[_0xc008('0x22')](function(){var _0x5410f5=_0x36f358['get']({'plain':!![]});var _0x5de1e9=[{'name':_0xc008('0x24'),'value':_0xc008('0x25'),'ignore':![]},{'name':_0xc008('0x26'),'value':_0xc008('0x27'),'ignore':![]}];var _0x5bebd9=_(_0x5de1e9)['filter']('ignore')['map']('value')[_0xc008('0x28')]();if(_[_0xc008('0x29')](_0x5bebd9,_0x5410f5[_0xc008('0x2a')])){return;}var _0x529961=_[_0xc008('0x2b')](_0x5de1e9,[_0xc008('0x28'),_0x5410f5[_0xc008('0x2a')]])[_0xc008('0x2c')];return db['UserProfileResource'][_0xc008('0x23')]({'where':{'type':_0x529961,'resourceId':_0x5410f5['id']}})[_0xc008('0x22')](function(){return _0x36f358;});})['then'](function(){_0x58a6ea['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1032b2,_0x267abd){return function(_0xf831f2){if(!_0xf831f2){_0x1032b2[_0xc008('0x1b')](0x194);}return _0xf831f2;};}function handleError(_0x1de04b,_0xceebc3){_0xceebc3=_0xceebc3||0x1f4;return function(_0x294f97){logger[_0xc008('0x2d')](_0x294f97[_0xc008('0x2e')]);if(_0x294f97[_0xc008('0x2c')]){delete _0x294f97[_0xc008('0x2c')];}_0x1de04b[_0xc008('0x1c')](_0xceebc3)['send'](_0x294f97);};}exports[_0xc008('0x2f')]=function(_0x4b7fd4,_0x499754){var _0xaf4b84={},_0x165a7b={},_0x383be7={'count':0x0,'rows':[]};var _0xca0520=_[_0xc008('0x30')](db[_0xc008('0x31')][_0xc008('0x32')],function(_0x470e79){return{'name':_0x470e79[_0xc008('0x33')],'type':_0x470e79['type'][_0xc008('0x34')]};});_0x165a7b[_0xc008('0x35')]=_[_0xc008('0x30')](_0xca0520,_0xc008('0x2c'));_0x165a7b[_0xc008('0x36')]=_[_0xc008('0x37')](_0x4b7fd4[_0xc008('0x36')]);_0x165a7b['filters']=_[_0xc008('0x38')](_0x165a7b[_0xc008('0x35')],_0x165a7b['query']);_0xaf4b84[_0xc008('0x39')]=_[_0xc008('0x38')](_0x165a7b['model'],qs[_0xc008('0x3a')](_0x4b7fd4[_0xc008('0x36')][_0xc008('0x3a')]));_0xaf4b84['attributes']=_0xaf4b84['attributes']['length']?_0xaf4b84[_0xc008('0x39')]:_0x165a7b['model'];if(!_0x4b7fd4[_0xc008('0x36')][_0xc008('0x3b')](_0xc008('0x3c'))){_0xaf4b84[_0xc008('0x3d')]=qs[_0xc008('0x3d')](_0x4b7fd4[_0xc008('0x36')][_0xc008('0x3d')]);_0xaf4b84[_0xc008('0x3e')]=qs[_0xc008('0x3e')](_0x4b7fd4[_0xc008('0x36')][_0xc008('0x3e')]);}_0xaf4b84[_0xc008('0x3f')]=qs[_0xc008('0x40')](_0x4b7fd4[_0xc008('0x36')]['sort']);_0xaf4b84[_0xc008('0x41')]=qs[_0xc008('0x42')](_[_0xc008('0x43')](_0x4b7fd4[_0xc008('0x36')],_0x165a7b['filters']),_0xca0520);if(_0x4b7fd4[_0xc008('0x36')][_0xc008('0x44')]){_0xaf4b84[_0xc008('0x41')]=_[_0xc008('0x45')](_0xaf4b84[_0xc008('0x41')],{'$or':_['map'](_0xca0520,function(_0x398cdd){if(_0x398cdd[_0xc008('0x2a')]!==_0xc008('0x46')){var _0x3e9a99={};_0x3e9a99[_0x398cdd[_0xc008('0x2c')]]={'$like':'%'+_0x4b7fd4['query'][_0xc008('0x44')]+'%'};return _0x3e9a99;}})});}_0xaf4b84=_[_0xc008('0x45')]({},_0xaf4b84,_0x4b7fd4[_0xc008('0x47')]);var _0x408192={'where':_0xaf4b84['where']};return db[_0xc008('0x31')][_0xc008('0x1e')](_0x408192)[_0xc008('0x22')](function(_0x5e1602){_0x383be7[_0xc008('0x1e')]=_0x5e1602;if(_0x4b7fd4['query'][_0xc008('0x48')]){_0xaf4b84['include']=[{'all':!![]}];}return db[_0xc008('0x31')][_0xc008('0x49')](_0xaf4b84);})['then'](function(_0x31007c){_0x383be7[_0xc008('0x4a')]=_0x31007c;return _0x383be7;})[_0xc008('0x22')](respondWithFilteredResult(_0x499754,_0xaf4b84))['catch'](handleError(_0x499754,null));};exports[_0xc008('0x4b')]=function(_0x2a9b5c,_0x200469){var _0x44fc5d={'raw':![],'where':{'id':_0x2a9b5c[_0xc008('0x4c')]['id']}},_0x347629={};_0x347629['model']=_['keys'](db['VoiceQueue'][_0xc008('0x32')]);_0x347629[_0xc008('0x36')]=_[_0xc008('0x37')](_0x2a9b5c[_0xc008('0x36')]);_0x347629[_0xc008('0x4d')]=_[_0xc008('0x38')](_0x347629[_0xc008('0x35')],_0x347629[_0xc008('0x36')]);_0x44fc5d['attributes']=_['intersection'](_0x347629['model'],qs[_0xc008('0x3a')](_0x2a9b5c[_0xc008('0x36')][_0xc008('0x3a')]));_0x44fc5d['attributes']=_0x44fc5d[_0xc008('0x39')][_0xc008('0x4e')]?_0x44fc5d[_0xc008('0x39')]:_0x347629[_0xc008('0x35')];if(_0x2a9b5c[_0xc008('0x36')][_0xc008('0x48')]){_0x44fc5d[_0xc008('0x4f')]=[{'all':!![]}];}_0x44fc5d=_[_0xc008('0x45')]({},_0x44fc5d,_0x2a9b5c[_0xc008('0x47')]);return db[_0xc008('0x31')]['find'](_0x44fc5d)['then'](handleEntityNotFound(_0x200469,null))[_0xc008('0x22')](respondWithResult(_0x200469,null))['catch'](handleError(_0x200469,null));};exports[_0xc008('0x50')]=function(_0x36e6f8,_0x201e52){return db['VoiceQueue'][_0xc008('0x50')](_0x36e6f8[_0xc008('0x51')],{})[_0xc008('0x22')](function(_0x8b9775){var _0x750cc9=_0x36e6f8['user'][_0xc008('0x52')]({'plain':!![]});if(!_0x750cc9)throw new Error(_0xc008('0x53'));if(_0x750cc9['role']===_0xc008('0x54')){var _0xfd6d1d=_0x8b9775['get']({'plain':!![]});var _0x51d3dc=[{'name':_0xc008('0x24'),'value':_0xc008('0x25')},{'name':_0xc008('0x26'),'value':_0xc008('0x27')}];var _0x14b6a0=_['find'](_0x51d3dc,['value',_0xfd6d1d[_0xc008('0x2a')]])['name'];return db[_0xc008('0x55')][_0xc008('0x2b')]({'where':{'name':_0x14b6a0,'userProfileId':_0x750cc9[_0xc008('0x56')]},'raw':!![]})[_0xc008('0x22')](function(_0x44f42d){if(_0x44f42d&&_0x44f42d[_0xc008('0x57')]===0x0){return db['UserProfileResource'][_0xc008('0x50')]({'name':_0xfd6d1d[_0xc008('0x2c')],'resourceId':_0xfd6d1d['id'],'type':_0x44f42d[_0xc008('0x2c')],'sectionId':_0x44f42d['id']},{})[_0xc008('0x22')](function(){return _0x8b9775;});}else{return _0x8b9775;}})[_0xc008('0x58')](function(_0x5aa385){logger[_0xc008('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5aa385);throw _0x5aa385;});}return _0x8b9775;})['then'](respondWithResult(_0x201e52,0xc9))['catch'](handleError(_0x201e52,null));};exports[_0xc008('0x59')]=function(_0x1bcbb1,_0x5dfb69){var _0x5f58d7={'where':{'id':_0x1bcbb1[_0xc008('0x4c')]['id']}},_0x3aeeab={};_0x3aeeab[_0xc008('0x35')]=_['keys'](db[_0xc008('0x31')][_0xc008('0x32')]);_0x5f58d7[_0xc008('0x39')]=_[_0xc008('0x38')](_0x3aeeab['model'],qs[_0xc008('0x3a')](_0x1bcbb1['query'][_0xc008('0x3a')]));_0x5f58d7[_0xc008('0x39')]=_0x5f58d7[_0xc008('0x39')][_0xc008('0x4e')]?_0x5f58d7[_0xc008('0x39')]:_0x3aeeab[_0xc008('0x35')];if(_0x1bcbb1['query'][_0xc008('0x48')]){_0x5f58d7['include']=[{'all':!![]}];}_0x5f58d7=_['merge']({},_0x5f58d7,_0x1bcbb1[_0xc008('0x47')]);return db[_0xc008('0x31')]['find'](_0x5f58d7)[_0xc008('0x22')](handleEntityNotFound(_0x5dfb69,null))[_0xc008('0x22')](function(_0x3e373e){if(_0x3e373e){var _0x4517c0=_0x3e373e[_0xc008('0x52')]({'plain':!![]});_0x4517c0=qs[_0xc008('0x5a')](_0x4517c0,['id',_0xc008('0x5b'),'updatedAt']);_0x1bcbb1[_0xc008('0x51')]=_[_0xc008('0x5a')](_0x1bcbb1[_0xc008('0x51')],['id',_0xc008('0x5b'),_0xc008('0x5c')]);return db[_0xc008('0x31')][_0xc008('0x50')](_[_0xc008('0x45')](_0x4517c0,_0x1bcbb1[_0xc008('0x51')]),{'include':_0x1bcbb1[_0xc008('0x36')][_0xc008('0x48')]?[{'all':!![]}]:undefined})[_0xc008('0x22')](function(_0x131b81){var _0x41dd45=_0x1bcbb1['user'][_0xc008('0x52')]({'plain':!![]});if(!_0x41dd45)throw new Error(_0xc008('0x53'));if(_0x41dd45[_0xc008('0x5d')]==='user'){var _0xd7d020=_0x131b81[_0xc008('0x52')]({'plain':!![]});var _0x5e76d8=[{'name':'VoiceQueues','value':_0xc008('0x25')},{'name':_0xc008('0x26'),'value':_0xc008('0x27')}];var _0x39083c=_[_0xc008('0x2b')](_0x5e76d8,[_0xc008('0x28'),_0xd7d020[_0xc008('0x2a')]])[_0xc008('0x2c')];return db[_0xc008('0x55')][_0xc008('0x2b')]({'where':{'name':_0x39083c,'userProfileId':_0x41dd45[_0xc008('0x56')]},'raw':!![]})['then'](function(_0x336516){if(_0x336516&&_0x336516[_0xc008('0x57')]===0x0){return db[_0xc008('0x5e')][_0xc008('0x50')]({'name':_0xd7d020['name'],'resourceId':_0xd7d020['id'],'type':_0x336516[_0xc008('0x2c')],'sectionId':_0x336516['id']},{})['then'](function(){return _0x131b81;});}else{return _0x131b81;}})[_0xc008('0x58')](function(_0x46fa7b){logger[_0xc008('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46fa7b);throw _0x46fa7b;});}return _0x131b81;});}})[_0xc008('0x22')](respondWithResult(_0x5dfb69,0xc9))[_0xc008('0x58')](handleError(_0x5dfb69,null));};exports[_0xc008('0x5f')]=function(_0x553f5c,_0x35b28a){if(_0x553f5c['body']['id']){delete _0x553f5c[_0xc008('0x51')]['id'];}return db[_0xc008('0x31')][_0xc008('0x2b')]({'where':{'id':_0x553f5c[_0xc008('0x4c')]['id']}})[_0xc008('0x22')](handleEntityNotFound(_0x35b28a,null))['then'](saveUpdates(_0x553f5c[_0xc008('0x51')],null))[_0xc008('0x22')](respondWithResult(_0x35b28a,null))['catch'](handleError(_0x35b28a,null));};exports[_0xc008('0x23')]=function(_0x5233bb,_0x278cbe){return db['VoiceQueue'][_0xc008('0x2b')]({'where':{'id':_0x5233bb['params']['id']}})[_0xc008('0x22')](handleEntityNotFound(_0x278cbe,null))[_0xc008('0x22')](removeEntity(_0x278cbe,null))[_0xc008('0x58')](handleError(_0x278cbe,null));};exports[_0xc008('0x60')]=function(_0x5a94ff,_0x57752c,_0x415c66){var _0xb24eec={'raw':![],'where':{}};var _0x1d49db={};var _0x321500={'count':0x0,'rows':[]};return db[_0xc008('0x31')][_0xc008('0x61')]({'where':{'id':_0x5a94ff[_0xc008('0x4c')]['id']}})['then'](handleEntityNotFound(_0x57752c,null))[_0xc008('0x22')](function(_0x530c2f){if(_0x530c2f){_0x1d49db['model']=_['keys'](db[_0xc008('0x62')][_0xc008('0x32')]);_0x1d49db[_0xc008('0x36')]=_[_0xc008('0x37')](_0x5a94ff[_0xc008('0x36')]);_0x1d49db[_0xc008('0x42')]=_[_0xc008('0x38')](_0x1d49db[_0xc008('0x35')],_0x1d49db[_0xc008('0x36')]);_0xb24eec['attributes']=_[_0xc008('0x38')](_0x1d49db[_0xc008('0x35')],qs[_0xc008('0x3a')](_0x5a94ff[_0xc008('0x36')][_0xc008('0x3a')]));_0xb24eec[_0xc008('0x39')]=_0xb24eec[_0xc008('0x39')][_0xc008('0x4e')]?_0xb24eec[_0xc008('0x39')]:_0x1d49db[_0xc008('0x35')];if(!_0x5a94ff[_0xc008('0x36')][_0xc008('0x3b')]('nolimit')){_0xb24eec['limit']=qs[_0xc008('0x3d')](_0x5a94ff[_0xc008('0x36')][_0xc008('0x3d')]);_0xb24eec['offset']=qs[_0xc008('0x3e')](_0x5a94ff[_0xc008('0x36')]['offset']);}_0xb24eec['order']=qs['sort'](_0x5a94ff[_0xc008('0x36')][_0xc008('0x40')]);_0xb24eec[_0xc008('0x41')]=qs[_0xc008('0x42')](_[_0xc008('0x43')](_0x5a94ff[_0xc008('0x36')],_0x1d49db[_0xc008('0x42')]));_0xb24eec[_0xc008('0x41')][_0xc008('0x63')]=_0x530c2f['id'];if(_0x5a94ff[_0xc008('0x36')]['filter']){_0xb24eec['where']=_[_0xc008('0x45')](_0xb24eec[_0xc008('0x41')],{'$or':_[_0xc008('0x30')](_0xb24eec[_0xc008('0x39')],function(_0x2b94b2){var _0x37fc2c={};_0x37fc2c[_0x2b94b2]={'$like':'%'+_0x5a94ff['query']['filter']+'%'};return _0x37fc2c;})});}_0xb24eec=_[_0xc008('0x45')]({},_0xb24eec,_0x5a94ff[_0xc008('0x47')]);return db[_0xc008('0x62')]['count']({'where':_0xb24eec['where']})['then'](function(_0x505061){_0x321500['count']=_0x505061;if(_0x5a94ff['query'][_0xc008('0x48')]){_0xb24eec['include']=[{'all':!![]}];}return db[_0xc008('0x62')]['findAll'](_0xb24eec);})[_0xc008('0x22')](function(_0x41151e){_0x321500[_0xc008('0x4a')]=_0x41151e;return _0x321500;});}})['then'](respondWithFilteredResult(_0x57752c,_0xb24eec))['catch'](handleError(_0x57752c,null));};exports[_0xc008('0x64')]=function(_0x51a194,_0x29d8e0,_0x3c37bd){var _0x544519={'raw':!![],'where':{}};var _0x7b7246={};var _0x4db90b={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xc008('0x61')]({'where':{'id':_0x51a194[_0xc008('0x4c')]['id']}})['then'](handleEntityNotFound(_0x29d8e0,null))[_0xc008('0x22')](function(_0x3afc15){if(_0x3afc15){_0x7b7246[_0xc008('0x35')]=_['keys'](db[_0xc008('0x65')][_0xc008('0x32')]);_0x7b7246[_0xc008('0x36')]=_[_0xc008('0x37')](_0x51a194[_0xc008('0x36')]);_0x7b7246[_0xc008('0x42')]=_['intersection'](_0x7b7246[_0xc008('0x35')],_0x7b7246[_0xc008('0x36')]);_0x544519[_0xc008('0x39')]=_['intersection'](_0x7b7246[_0xc008('0x35')],qs[_0xc008('0x3a')](_0x51a194[_0xc008('0x36')]['fields']));_0x544519['attributes']=_0x544519['attributes'][_0xc008('0x4e')]?_0x544519[_0xc008('0x39')]:_0x7b7246[_0xc008('0x35')];if(!_0x51a194[_0xc008('0x36')][_0xc008('0x3b')](_0xc008('0x3c'))){_0x544519[_0xc008('0x3d')]=qs[_0xc008('0x3d')](_0x51a194['query'][_0xc008('0x3d')]);_0x544519[_0xc008('0x3e')]=qs['offset'](_0x51a194['query'][_0xc008('0x3e')]);}_0x544519[_0xc008('0x3f')]=qs[_0xc008('0x40')](_0x51a194[_0xc008('0x36')][_0xc008('0x40')]);_0x544519['where']=qs[_0xc008('0x42')](_[_0xc008('0x43')](_0x51a194['query'],_0x7b7246[_0xc008('0x42')]));_0x544519[_0xc008('0x41')][_0xc008('0x63')]=_0x3afc15['id'];if(_0x51a194[_0xc008('0x36')]['filter']){_0x544519[_0xc008('0x41')]=_[_0xc008('0x45')](_0x544519[_0xc008('0x41')],{'$or':_[_0xc008('0x30')](_0x544519['attributes'],function(_0x3122ec){var _0x1d4cdc={};_0x1d4cdc[_0x3122ec]={'$like':'%'+_0x51a194['query']['filter']+'%'};return _0x1d4cdc;})});}_0x544519=_[_0xc008('0x45')]({},_0x544519,_0x51a194['options']);return db[_0xc008('0x65')][_0xc008('0x1e')]({'where':_0x544519['where']})[_0xc008('0x22')](function(_0x201ffa){_0x4db90b[_0xc008('0x1e')]=_0x201ffa;if(_0x51a194[_0xc008('0x36')][_0xc008('0x48')]){_0x544519[_0xc008('0x4f')]=[{'all':!![]}];}return db[_0xc008('0x65')][_0xc008('0x49')](_0x544519);})[_0xc008('0x22')](function(_0x2fcad1){_0x4db90b['rows']=_0x2fcad1;return _0x4db90b;});}})['then'](respondWithFilteredResult(_0x29d8e0,_0x544519))[_0xc008('0x58')](handleError(_0x29d8e0,null));};exports[_0xc008('0x66')]=function(_0x4d07d2,_0x16c1f2,_0x1bdaa9){var _0x698d5c={'raw':!![],'where':{}};var _0x5f1e48={};var _0x303cdd={'count':0x0,'rows':[]};return db[_0xc008('0x31')][_0xc008('0x61')]({'where':{'id':_0x4d07d2[_0xc008('0x4c')]['id']}})[_0xc008('0x22')](handleEntityNotFound(_0x16c1f2,null))[_0xc008('0x22')](function(_0x3c9518){if(_0x3c9518){_0x5f1e48['model']=_[_0xc008('0x37')](db['CmHopperFinal'][_0xc008('0x32')]);_0x5f1e48[_0xc008('0x36')]=_[_0xc008('0x37')](_0x4d07d2['query']);_0x5f1e48[_0xc008('0x42')]=_[_0xc008('0x38')](_0x5f1e48[_0xc008('0x35')],_0x5f1e48[_0xc008('0x36')]);_0x698d5c[_0xc008('0x39')]=_[_0xc008('0x38')](_0x5f1e48[_0xc008('0x35')],qs[_0xc008('0x3a')](_0x4d07d2[_0xc008('0x36')][_0xc008('0x3a')]));_0x698d5c['attributes']=_0x698d5c[_0xc008('0x39')][_0xc008('0x4e')]?_0x698d5c[_0xc008('0x39')]:_0x5f1e48[_0xc008('0x35')];if(!_0x4d07d2[_0xc008('0x36')]['hasOwnProperty'](_0xc008('0x3c'))){_0x698d5c[_0xc008('0x3d')]=qs[_0xc008('0x3d')](_0x4d07d2[_0xc008('0x36')][_0xc008('0x3d')]);_0x698d5c[_0xc008('0x3e')]=qs[_0xc008('0x3e')](_0x4d07d2[_0xc008('0x36')][_0xc008('0x3e')]);}_0x698d5c[_0xc008('0x3f')]=qs[_0xc008('0x40')](_0x4d07d2[_0xc008('0x36')][_0xc008('0x40')]);_0x698d5c[_0xc008('0x41')]=qs[_0xc008('0x42')](_['pick'](_0x4d07d2['query'],_0x5f1e48[_0xc008('0x42')]));_0x698d5c[_0xc008('0x41')][_0xc008('0x63')]=_0x3c9518['id'];if(_0x4d07d2[_0xc008('0x36')][_0xc008('0x44')]){_0x698d5c[_0xc008('0x41')]=_[_0xc008('0x45')](_0x698d5c[_0xc008('0x41')],{'$or':_[_0xc008('0x30')](_0x698d5c['attributes'],function(_0x9e53af){var _0x2bbadf={};_0x2bbadf[_0x9e53af]={'$like':'%'+_0x4d07d2['query'][_0xc008('0x44')]+'%'};return _0x2bbadf;})});}_0x698d5c=_[_0xc008('0x45')]({},_0x698d5c,_0x4d07d2[_0xc008('0x47')]);return db[_0xc008('0x67')][_0xc008('0x1e')]({'where':_0x698d5c[_0xc008('0x41')]})['then'](function(_0x26617c){_0x303cdd[_0xc008('0x1e')]=_0x26617c;if(_0x4d07d2[_0xc008('0x36')][_0xc008('0x48')]){_0x698d5c['include']=[{'all':!![]}];}return db[_0xc008('0x67')]['findAll'](_0x698d5c);})[_0xc008('0x22')](function(_0x4c5725){_0x303cdd['rows']=_0x4c5725;return _0x303cdd;});}})[_0xc008('0x22')](respondWithFilteredResult(_0x16c1f2,_0x698d5c))['catch'](handleError(_0x16c1f2,null));};exports[_0xc008('0x68')]=function(_0x4cb7d7,_0x5b387d,_0x5351f7){var _0x79dfea={'raw':!![],'where':{}};var _0x402b67={};var _0x48f40f={'count':0x0,'rows':[]};return db[_0xc008('0x31')][_0xc008('0x61')]({'where':{'id':_0x4cb7d7['params']['id']}})[_0xc008('0x22')](handleEntityNotFound(_0x5b387d,null))[_0xc008('0x22')](function(_0x1564a9){if(_0x1564a9){_0x402b67['model']=_[_0xc008('0x37')](db[_0xc008('0x69')][_0xc008('0x32')]);_0x402b67[_0xc008('0x36')]=_[_0xc008('0x37')](_0x4cb7d7[_0xc008('0x36')]);_0x402b67[_0xc008('0x42')]=_[_0xc008('0x38')](_0x402b67[_0xc008('0x35')],_0x402b67[_0xc008('0x36')]);_0x79dfea[_0xc008('0x39')]=_['intersection'](_0x402b67[_0xc008('0x35')],qs[_0xc008('0x3a')](_0x4cb7d7[_0xc008('0x36')]['fields']));_0x79dfea[_0xc008('0x39')]=_0x79dfea[_0xc008('0x39')][_0xc008('0x4e')]?_0x79dfea['attributes']:_0x402b67[_0xc008('0x35')];if(!_0x4cb7d7['query'][_0xc008('0x3b')](_0xc008('0x3c'))){_0x79dfea[_0xc008('0x3d')]=qs['limit'](_0x4cb7d7[_0xc008('0x36')][_0xc008('0x3d')]);_0x79dfea[_0xc008('0x3e')]=qs[_0xc008('0x3e')](_0x4cb7d7[_0xc008('0x36')][_0xc008('0x3e')]);}_0x79dfea[_0xc008('0x3f')]=qs['sort'](_0x4cb7d7[_0xc008('0x36')][_0xc008('0x40')]);_0x79dfea[_0xc008('0x41')]=qs[_0xc008('0x42')](_['pick'](_0x4cb7d7[_0xc008('0x36')],_0x402b67['filters']));_0x79dfea[_0xc008('0x41')][_0xc008('0x63')]=_0x1564a9['id'];if(_0x4cb7d7[_0xc008('0x36')][_0xc008('0x44')]){_0x79dfea[_0xc008('0x41')]=_[_0xc008('0x45')](_0x79dfea[_0xc008('0x41')],{'$or':_['map'](_0x79dfea[_0xc008('0x39')],function(_0x34c532){var _0x372822={};_0x372822[_0x34c532]={'$like':'%'+_0x4cb7d7[_0xc008('0x36')]['filter']+'%'};return _0x372822;})});}_0x79dfea=_[_0xc008('0x45')]({},_0x79dfea,_0x4cb7d7['options']);return db[_0xc008('0x69')][_0xc008('0x1e')]({'where':_0x79dfea[_0xc008('0x41')]})['then'](function(_0x58231d){_0x48f40f[_0xc008('0x1e')]=_0x58231d;if(_0x4cb7d7['query'][_0xc008('0x48')]){_0x79dfea[_0xc008('0x4f')]=[{'all':!![]}];}return db[_0xc008('0x69')][_0xc008('0x49')](_0x79dfea);})['then'](function(_0x2ebd24){_0x48f40f[_0xc008('0x4a')]=_0x2ebd24;return _0x48f40f;});}})['then'](respondWithFilteredResult(_0x5b387d,_0x79dfea))['catch'](handleError(_0x5b387d,null));};exports[_0xc008('0x6a')]=function(_0x1edf41,_0x59aa91,_0xf1094e){var _0x4265d1={};var _0x1d0348={};var _0x3d571;var _0x47a463;return db[_0xc008('0x31')][_0xc008('0x61')]({'where':{'id':_0x1edf41[_0xc008('0x4c')]['id']}})[_0xc008('0x22')](handleEntityNotFound(_0x59aa91,null))[_0xc008('0x22')](function(_0x177733){if(_0x177733){_0x3d571=_0x177733;_0x1d0348[_0xc008('0x35')]=_[_0xc008('0x37')](db[_0xc008('0x6b')][_0xc008('0x32')]);_0x1d0348[_0xc008('0x36')]=_[_0xc008('0x37')](_0x1edf41[_0xc008('0x36')]);_0x1d0348['filters']=_['intersection'](_0x1d0348[_0xc008('0x35')],_0x1d0348[_0xc008('0x36')]);_0x4265d1[_0xc008('0x39')]=_[_0xc008('0x38')](_0x1d0348[_0xc008('0x35')],qs[_0xc008('0x3a')](_0x1edf41[_0xc008('0x36')]['fields']));_0x4265d1['attributes']=_0x4265d1[_0xc008('0x39')][_0xc008('0x4e')]?_0x4265d1[_0xc008('0x39')]:_0x1d0348['model'];_0x4265d1[_0xc008('0x3f')]=qs[_0xc008('0x40')](_0x1edf41[_0xc008('0x36')][_0xc008('0x40')]);_0x4265d1[_0xc008('0x41')]=qs[_0xc008('0x42')](_[_0xc008('0x43')](_0x1edf41[_0xc008('0x36')],_0x1d0348[_0xc008('0x42')]));if(_0x1edf41[_0xc008('0x36')][_0xc008('0x44')]){_0x4265d1[_0xc008('0x41')]=_['merge'](_0x4265d1['where'],{'$or':_[_0xc008('0x30')](_0x4265d1[_0xc008('0x39')],function(_0x53baa4){var _0x16a90e={};_0x16a90e[_0x53baa4]={'$like':'%'+_0x1edf41[_0xc008('0x36')][_0xc008('0x44')]+'%'};return _0x16a90e;})});}_0x4265d1=_[_0xc008('0x45')]({},_0x4265d1,_0x1edf41[_0xc008('0x47')]);return _0x3d571[_0xc008('0x6a')](_0x4265d1);}})[_0xc008('0x22')](function(_0x2e7505){if(_0x2e7505){_0x47a463=_0x2e7505[_0xc008('0x4e')];if(!_0x1edf41['query']['hasOwnProperty']('nolimit')){_0x4265d1[_0xc008('0x3d')]=qs['limit'](_0x1edf41[_0xc008('0x36')][_0xc008('0x3d')]);_0x4265d1[_0xc008('0x3e')]=qs[_0xc008('0x3e')](_0x1edf41[_0xc008('0x36')][_0xc008('0x3e')]);}return _0x3d571[_0xc008('0x6a')](_0x4265d1);}})[_0xc008('0x22')](function(_0x39d52f){if(_0x39d52f){return _0x39d52f?{'count':_0x47a463,'rows':_0x39d52f}:null;}})[_0xc008('0x22')](respondWithResult(_0x59aa91,null))[_0xc008('0x58')](handleError(_0x59aa91,null));};exports[_0xc008('0x6c')]=function(_0x1fea74,_0x304083,_0x39c9b1){var _0x473f44=_0x1fea74[_0xc008('0x51')]['teams'];var _0x755321=_['map'](_0x473f44,'id');return db[_0xc008('0x6b')][_0xc008('0x49')]({'where':{'id':_0x755321},'attributes':['id'],'include':[{'model':db[_0xc008('0x6d')],'as':'Agents','attributes':['id',_0xc008('0x2c'),_0xc008('0x6e'),_0xc008('0x6f'),_0xc008('0x70')],'raw':!![]}]})[_0xc008('0x22')](function(_0x377754){if(_0x377754){var _0x516590=_['flatMap'](_0x377754,function(_0x1cad4b){var _0x3835ce=_0x1cad4b[_0xc008('0x52')]({'plain':!![]});_0x3835ce[_0xc008('0x71')]['forEach'](function(_0x555e8c){_0x555e8c['penalty']=_['find'](_0x473f44,{'id':_0x3835ce['id']})[_0xc008('0x72')];});return _0x3835ce[_0xc008('0x71')];});return db[_0xc008('0x31')][_0xc008('0x2b')]({'where':{'id':_0x1fea74['params']['id']}})[_0xc008('0x22')](function(_0x13fcee){return db[_0xc008('0x73')]['transaction'](function(_0x438195){return _0x13fcee['addTeams'](_0x755321,{'transaction':_0x438195})[_0xc008('0x22')](function(){return BPromise['each'](_0x516590,function(_0x190ffc){return db[_0xc008('0x74')][_0xc008('0x75')]({'where':{'UserId':_0x190ffc['id'],'VoiceQueueId':_0x1fea74[_0xc008('0x4c')]['id']},'defaults':{'penalty':_0x190ffc['penalty']},'transaction':_0x438195});});})[_0xc008('0x22')](function(){return BPromise[_0xc008('0x76')](_[_0xc008('0x44')](_0x516590,{'online':!![]}),function(_0xa67842){return db[_0xc008('0x77')][_0xc008('0x78')]({'membername':_0xa67842[_0xc008('0x2c')],'UserId':_0xa67842['id'],'queue_name':_0x13fcee['name'],'VoiceQueueId':_0x13fcee['id'],'interface':_[_0xc008('0x79')](_0xa67842[_0xc008('0x70')])?util[_0xc008('0x7a')]('SIP/%s',_0xa67842['name']):_0xa67842[_0xc008('0x70')],'paused':_0xa67842[_0xc008('0x6f')]||![],'penalty':_0xa67842[_0xc008('0x72')]},{'transaction':_0x438195});});})[_0xc008('0x22')](function(){_0x516590['forEach'](function(_0xc45c61){socket[_0xc008('0x7b')]('userVoiceQueue:save',{'UserId':_0xc45c61['id'],'VoiceQueueId':_0x13fcee['id']});});});});});}})['then'](respondWithStatusCode(_0x304083,null))['catch'](handleError(_0x304083,null));};exports[_0xc008('0x7c')]=function(_0x573b21,_0x3744e1,_0x4a5ff4){return db[_0xc008('0x6b')][_0xc008('0x49')]({'where':{'id':_0x573b21[_0xc008('0x36')][_0xc008('0x7d')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc008('0x22')](handleEntityNotFound(_0x3744e1,null))[_0xc008('0x22')](function(_0x347c78){var _0x532ddd=_[_0xc008('0x30')](_0x347c78,'id');var _0x236d62=[];var _0x3de2af=[];var _0x272d98=squel[_0xc008('0x7e')]();_0x272d98[_0xc008('0x7f')](_0xc008('0x80'))[_0xc008('0x81')](_0xc008('0x82'),'tq')[_0xc008('0x83')](_0xc008('0x84'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xc008('0x85'),_0x573b21['params']['id']);for(var _0x451dcd=0x0;_0x451dcd<_0x347c78[_0xc008('0x4e')];_0x451dcd+=0x1){let _0x4a7268=_0x347c78[_0x451dcd];for(var _0x487c0d=0x0;_0x487c0d<_0x4a7268[_0xc008('0x71')][_0xc008('0x4e')];_0x487c0d+=0x1){let _0x36af70=_0x4a7268[_0xc008('0x71')][_0x487c0d];var _0x3e0b78=_0x272d98[_0xc008('0x59')]();_0x3e0b78['where'](_0xc008('0x86'),_0x36af70['id']);_0x3de2af[_0xc008('0x87')](db[_0xc008('0x73')]['query'](_0x3e0b78[_0xc008('0x88')](),{'type':db[_0xc008('0x73')][_0xc008('0x89')][_0xc008('0x8a')]})['then'](function(_0x4ae026){if(_0x4ae026[_0xc008('0x4e')]===0x1){return _0x36af70['id'];}else{var _0x4ad0b4=_[_0xc008('0x8b')](_[_0xc008('0x30')](_0x4ae026,_0xc008('0x8c')),function(_0x22b77a){return _[_0xc008('0x29')](_0x532ddd,_0x22b77a);});if(_0x4ad0b4){return _0x36af70['id'];}}}));}}return BPromise['all'](_0x3de2af)['then'](function(_0x8e97a3){_0x236d62=_(_0x236d62)[_0xc008('0x8d')](_0x8e97a3)[_0xc008('0x8e')]()[_0xc008('0x28')]();return db[_0xc008('0x31')][_0xc008('0x2b')]({'where':{'id':_0x573b21[_0xc008('0x4c')]['id']}})['then'](function(_0x298edc){return db[_0xc008('0x73')][_0xc008('0x8f')](function(_0x4d5c49){return _0x298edc[_0xc008('0x7c')](_0x573b21[_0xc008('0x36')][_0xc008('0x7d')],{'transaction':_0x4d5c49})[_0xc008('0x22')](function(){if(!_[_0xc008('0x90')](_0x236d62)){return _0x298edc[_0xc008('0x91')](_0x236d62,{'transaction':_0x4d5c49})[_0xc008('0x22')](function(){return db[_0xc008('0x77')]['destroy']({'where':{'VoiceQueueId':_0x573b21[_0xc008('0x4c')]['id'],'UserId':_0x236d62},'transaction':_0x4d5c49});});}})[_0xc008('0x22')](function(){_0x236d62['forEach'](function(_0x40cb66){socket[_0xc008('0x7b')](_0xc008('0x92'),{'UserId':_0x40cb66,'VoiceQueueId':_0x298edc['id']});});});});});});})[_0xc008('0x22')](respondWithStatusCode(_0x3744e1,null))[_0xc008('0x58')](handleError(_0x3744e1,null));};exports[_0xc008('0x93')]=function(_0x3e33be,_0x20fbb3,_0x1859c1){var _0x20f728,_0x2fd627;return db['VoiceQueue'][_0xc008('0x2b')]({'where':{'id':_0x3e33be[_0xc008('0x4c')]['id']}})[_0xc008('0x22')](handleEntityNotFound(_0x20fbb3,null))[_0xc008('0x22')](function(_0x33c990){if(_0x33c990){_0x2fd627=_0x33c990;return _0x33c990[_0xc008('0x93')](_0x3e33be[_0xc008('0x51')][_0xc008('0x7d')],_[_0xc008('0x5a')](_0x3e33be[_0xc008('0x51')],[_0xc008('0x7d'),'id'])||{})[_0xc008('0x94')](function(_0x1b3a7f){for(var _0x148333=0x0;_0x148333<_0x3e33be[_0xc008('0x51')][_0xc008('0x7d')]['length'];_0x148333+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':_0x3e33be[_0xc008('0x51')][_0xc008('0x7d')][_0x148333],'VoiceQueueId':_0x3e33be[_0xc008('0x4c')]['id']});}return _0x1b3a7f;});}})[_0xc008('0x22')](function(_0x1a0565){_0x20f728=_0x1a0565||[];if(_0x2fd627){return db[_0xc008('0x6d')][_0xc008('0x49')]({'where':{'id':_0x3e33be['body'][_0xc008('0x7d')]},'attributes':['id','name','online',_0xc008('0x6f'),_0xc008('0x70')],'raw':!![]});}})['then'](function(_0x43521e){if(!_[_0xc008('0x90')](_0x43521e)){var _0x3dc75c=[];for(var _0x5a47ff=0x0;_0x5a47ff<_0x43521e[_0xc008('0x4e')];_0x5a47ff++){if(_0x43521e[_0x5a47ff][_0xc008('0x6e')]){_0x3dc75c[_0xc008('0x87')](db['UserVoiceQueueRt'][_0xc008('0x78')]({'membername':_0x43521e[_0x5a47ff][_0xc008('0x2c')],'UserId':_0x43521e[_0x5a47ff]['id'],'queue_name':_0x2fd627[_0xc008('0x2c')],'VoiceQueueId':_0x2fd627['id'],'interface':_[_0xc008('0x79')](_0x43521e[_0x5a47ff][_0xc008('0x70')])?util[_0xc008('0x7a')](_0xc008('0x95'),_0x43521e[_0x5a47ff][_0xc008('0x2c')]):_0x43521e[_0x5a47ff]['interface'],'paused':_0x43521e[_0x5a47ff][_0xc008('0x6f')]||![],'penalty':_0x3e33be[_0xc008('0x51')][_0xc008('0x72')]||0x0}));}}return BPromise[_0xc008('0x96')](_0x3dc75c);}})[_0xc008('0x22')](function(){return _0x20f728;})['then'](respondWithResult(_0x20fbb3,null))[_0xc008('0x58')](handleError(_0x20fbb3,null));};exports[_0xc008('0x91')]=function(_0x1be2f3,_0x3275e9,_0x54ac55){return db[_0xc008('0x31')][_0xc008('0x2b')]({'where':{'id':_0x1be2f3[_0xc008('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3275e9,null))[_0xc008('0x22')](function(_0x231318){if(_0x231318){return _0x231318[_0xc008('0x91')](_0x1be2f3[_0xc008('0x36')]['ids'])['then'](function(){if(_[_0xc008('0x97')](_0x1be2f3[_0xc008('0x36')]['ids'])){for(var _0x30e433=0x0;_0x30e433<_0x1be2f3[_0xc008('0x36')][_0xc008('0x7d')][_0xc008('0x4e')];_0x30e433+=0x1){socket[_0xc008('0x7b')](_0xc008('0x92'),{'UserId':Number(_0x1be2f3[_0xc008('0x36')]['ids'][_0x30e433]),'VoiceQueueId':Number(_0x1be2f3['params']['id'])});}}else{socket[_0xc008('0x7b')]('userVoiceQueue:remove',{'UserId':Number(_0x1be2f3[_0xc008('0x36')][_0xc008('0x7d')]),'VoiceQueueId':Number(_0x1be2f3[_0xc008('0x4c')]['id'])});}});}})[_0xc008('0x22')](function(_0x2ea1db){return db[_0xc008('0x77')][_0xc008('0x23')]({'where':{'VoiceQueueId':_0x1be2f3[_0xc008('0x4c')]['id'],'UserId':_0x1be2f3[_0xc008('0x36')][_0xc008('0x7d')]}})[_0xc008('0x22')](function(){return _0x2ea1db;});})['then'](respondWithStatusCode(_0x3275e9,null))[_0xc008('0x58')](handleError(_0x3275e9,null));};exports[_0xc008('0x98')]=function(_0x344250,_0x139d2b,_0x3a0430){var _0x3f089d={};var _0x310979={};var _0x506dc0;var _0x43065b;return db[_0xc008('0x31')][_0xc008('0x61')]({'where':{'id':_0x344250['params']['id']}})[_0xc008('0x22')](handleEntityNotFound(_0x139d2b,null))[_0xc008('0x22')](function(_0x41b8c4){if(_0x41b8c4){_0x506dc0=_0x41b8c4;_0x310979[_0xc008('0x35')]=_[_0xc008('0x37')](db[_0xc008('0x6d')]['rawAttributes']);_0x310979['query']=_[_0xc008('0x37')](_0x344250[_0xc008('0x36')]);_0x310979[_0xc008('0x42')]=_[_0xc008('0x38')](_0x310979[_0xc008('0x35')],_0x310979['query']);_0x3f089d[_0xc008('0x39')]=_['intersection'](_0x310979[_0xc008('0x35')],qs[_0xc008('0x3a')](_0x344250['query'][_0xc008('0x3a')]));_0x3f089d[_0xc008('0x39')]=_0x3f089d[_0xc008('0x39')][_0xc008('0x4e')]?_0x3f089d['attributes']:_0x310979[_0xc008('0x35')];_0x3f089d[_0xc008('0x3f')]=qs[_0xc008('0x40')](_0x344250[_0xc008('0x36')][_0xc008('0x40')]);_0x3f089d['where']=qs[_0xc008('0x42')](_[_0xc008('0x43')](_0x344250[_0xc008('0x36')],_0x310979['filters']));if(_0x344250[_0xc008('0x36')][_0xc008('0x44')]){_0x3f089d[_0xc008('0x41')]=_[_0xc008('0x45')](_0x3f089d['where'],{'$or':_[_0xc008('0x30')](_0x3f089d[_0xc008('0x39')],function(_0x74ccbe){var _0x9afcd6={};_0x9afcd6[_0x74ccbe]={'$like':'%'+_0x344250[_0xc008('0x36')]['filter']+'%'};return _0x9afcd6;})});}_0x3f089d=_[_0xc008('0x45')]({},_0x3f089d,_0x344250['options']);return _0x506dc0['getAgents'](_0x3f089d);}})[_0xc008('0x22')](function(_0x5f266f){if(_0x5f266f){_0x43065b=_0x5f266f[_0xc008('0x4e')];if(!_0x344250[_0xc008('0x36')][_0xc008('0x3b')](_0xc008('0x3c'))){_0x3f089d[_0xc008('0x3d')]=qs[_0xc008('0x3d')](_0x344250[_0xc008('0x36')]['limit']);_0x3f089d[_0xc008('0x3e')]=qs[_0xc008('0x3e')](_0x344250[_0xc008('0x36')][_0xc008('0x3e')]);}return _0x506dc0[_0xc008('0x98')](_0x3f089d);}})[_0xc008('0x22')](function(_0x59b5b9){if(_0x59b5b9){return _0x59b5b9?{'count':_0x43065b,'rows':_0x59b5b9}:null;}})[_0xc008('0x22')](respondWithResult(_0x139d2b,null))[_0xc008('0x58')](handleError(_0x139d2b,null));};exports[_0xc008('0x99')]=function(_0x1842bb,_0x8c33de,_0x37802a){var _0x105f3e={};var _0x3aa9b4={};var _0x5789a0;var _0x57ae51;return db[_0xc008('0x31')][_0xc008('0x61')]({'where':{'id':_0x1842bb['params']['id']}})[_0xc008('0x22')](handleEntityNotFound(_0x8c33de,null))['then'](function(_0x1b1766){if(_0x1b1766){_0x5789a0=_0x1b1766;_0x3aa9b4[_0xc008('0x35')]=_[_0xc008('0x37')](db[_0xc008('0x77')][_0xc008('0x32')]);_0x3aa9b4[_0xc008('0x36')]=_[_0xc008('0x37')](_0x1842bb['query']);_0x3aa9b4[_0xc008('0x42')]=_['intersection'](_0x3aa9b4[_0xc008('0x35')],_0x3aa9b4[_0xc008('0x36')]);_0x105f3e[_0xc008('0x39')]=_[_0xc008('0x38')](_0x3aa9b4[_0xc008('0x35')],qs[_0xc008('0x3a')](_0x1842bb[_0xc008('0x36')]['fields']));_0x105f3e[_0xc008('0x39')]=_0x105f3e[_0xc008('0x39')]['length']?_0x105f3e[_0xc008('0x39')]:_0x3aa9b4[_0xc008('0x35')];_0x105f3e[_0xc008('0x3f')]=qs[_0xc008('0x40')](_0x1842bb[_0xc008('0x36')][_0xc008('0x40')]);_0x105f3e['where']=qs[_0xc008('0x42')](_[_0xc008('0x43')](_0x1842bb[_0xc008('0x36')],_0x3aa9b4[_0xc008('0x42')]));if(_0x1842bb['query']['filter']){_0x105f3e['where']=_[_0xc008('0x45')](_0x105f3e[_0xc008('0x41')],{'$or':_['map'](_0x105f3e['attributes'],function(_0x5035ca){var _0x518d2d={};_0x518d2d[_0x5035ca]={'$like':'%'+_0x1842bb[_0xc008('0x36')][_0xc008('0x44')]+'%'};return _0x518d2d;})});}_0x105f3e=_['merge']({},_0x105f3e,_0x1842bb[_0xc008('0x47')]);return _0x5789a0[_0xc008('0x99')](_0x105f3e);}})[_0xc008('0x22')](function(_0x2f1e34){if(_0x2f1e34){_0x57ae51=_0x2f1e34[_0xc008('0x4e')];if(!_0x1842bb['query']['hasOwnProperty'](_0xc008('0x3c'))){_0x105f3e[_0xc008('0x3d')]=qs[_0xc008('0x3d')](_0x1842bb[_0xc008('0x36')][_0xc008('0x3d')]);_0x105f3e[_0xc008('0x3e')]=qs[_0xc008('0x3e')](_0x1842bb['query'][_0xc008('0x3e')]);}return _0x5789a0[_0xc008('0x99')](_0x105f3e);}})[_0xc008('0x22')](function(_0x33dc6b){return _0x33dc6b?{'count':_0x57ae51,'rows':_0x33dc6b}:null;})[_0xc008('0x22')](respondWithResult(_0x8c33de,null))[_0xc008('0x58')](handleError(_0x8c33de,null));};exports[_0xc008('0x9a')]=function(_0x4ecfa9,_0x583226,_0x2b7dfe){var _0x1fa94d={};var _0x11bcba={};var _0x14824a;var _0x28b578;return db[_0xc008('0x31')][_0xc008('0x61')]({'where':{'id':_0x4ecfa9[_0xc008('0x4c')]['id']}})[_0xc008('0x22')](handleEntityNotFound(_0x583226,null))[_0xc008('0x22')](function(_0xefba5){if(_0xefba5){_0x14824a=_0xefba5;_0x11bcba[_0xc008('0x35')]=_[_0xc008('0x37')](db['CmList']['rawAttributes']);_0x11bcba[_0xc008('0x36')]=_[_0xc008('0x37')](_0x4ecfa9[_0xc008('0x36')]);_0x11bcba[_0xc008('0x42')]=_[_0xc008('0x38')](_0x11bcba[_0xc008('0x35')],_0x11bcba[_0xc008('0x36')]);_0x1fa94d['attributes']=_['intersection'](_0x11bcba['model'],qs[_0xc008('0x3a')](_0x4ecfa9['query']['fields']));_0x1fa94d['attributes']=_0x1fa94d[_0xc008('0x39')][_0xc008('0x4e')]?_0x1fa94d[_0xc008('0x39')]:_0x11bcba[_0xc008('0x35')];_0x1fa94d[_0xc008('0x3f')]=qs[_0xc008('0x40')](_0x4ecfa9[_0xc008('0x36')][_0xc008('0x40')]);_0x1fa94d[_0xc008('0x41')]=qs[_0xc008('0x42')](_[_0xc008('0x43')](_0x4ecfa9[_0xc008('0x36')],_0x11bcba['filters']));if(_0x4ecfa9['query'][_0xc008('0x44')]){_0x1fa94d[_0xc008('0x41')]=_[_0xc008('0x45')](_0x1fa94d[_0xc008('0x41')],{'$or':_[_0xc008('0x30')](_0x1fa94d[_0xc008('0x39')],function(_0xcdba52){var _0x39877e={};_0x39877e[_0xcdba52]={'$like':'%'+_0x4ecfa9['query'][_0xc008('0x44')]+'%'};return _0x39877e;})});}_0x1fa94d=_['merge']({},_0x1fa94d,_0x4ecfa9['options']);return _0x14824a['getLists'](_0x1fa94d);}})['then'](function(_0x476beb){if(_0x476beb){_0x28b578=_0x476beb['length'];if(!_0x4ecfa9[_0xc008('0x36')][_0xc008('0x3b')](_0xc008('0x3c'))){_0x1fa94d['limit']=qs['limit'](_0x4ecfa9[_0xc008('0x36')][_0xc008('0x3d')]);_0x1fa94d['offset']=qs[_0xc008('0x3e')](_0x4ecfa9[_0xc008('0x36')][_0xc008('0x3e')]);}return _0x14824a[_0xc008('0x9a')](_0x1fa94d);}})[_0xc008('0x22')](function(_0x275a21){if(_0x275a21){return _0x275a21?{'count':_0x28b578,'rows':_0x275a21}:null;}})[_0xc008('0x22')](respondWithResult(_0x583226,null))[_0xc008('0x58')](handleError(_0x583226,null));};exports[_0xc008('0x9b')]=function(_0x4117cc,_0x5456ce,_0x2392ac){var _0x17d146,_0x4838cb;return db['VoiceQueue'][_0xc008('0x2b')]({'where':{'id':_0x4117cc[_0xc008('0x4c')]['id']}})[_0xc008('0x22')](handleEntityNotFound(_0x5456ce,null))['then'](function(_0x52e4a5){if(_0x52e4a5){_0x4838cb=_0x52e4a5;return _0x52e4a5['addLists'](_0x4117cc['body'][_0xc008('0x7d')],_[_0xc008('0x5a')](_0x4117cc[_0xc008('0x51')],[_0xc008('0x7d'),'id'])||{});}return null;})[_0xc008('0x94')](function(_0xb24d64){var _0x323af4;_0x17d146=_0xb24d64||[];var _0x4e46f0=[];if(_0xb24d64){for(var _0x2be9d1=0x0;_0x2be9d1<_0xb24d64[_0xc008('0x4e')];_0x2be9d1+=0x1){var _0x1407de=_0xb24d64[_0x2be9d1][_0xc008('0x52')]({'plain':!![]});_0x4838cb[_0xc008('0x9c')]=_0x4117cc['body'][_0xc008('0x9c')]?_0x4117cc[_0xc008('0x51')]['dialCheckDuplicateType']:_0x4838cb[_0xc008('0x9c')];switch(_0x4838cb[_0xc008('0x9c')]){case _0xc008('0x9d'):_0x323af4=squel[_0xc008('0x9e')]()['into'](_0xc008('0x9f'))['fromQuery']([_0xc008('0xa0'),_0xc008('0xa1'),_0xc008('0xa2'),_0xc008('0xa3'),_0xc008('0x63'),'createdAt',_0xc008('0x5c')],squel[_0xc008('0x7e')]()[_0xc008('0x7f')](_0xc008('0xa0'),'phone')[_0xc008('0x7f')]('NOW()','scheduledAt')[_0xc008('0x7f')]('id',_0xc008('0xa2'))[_0xc008('0x7f')](_0x1407de['CmListId'][_0xc008('0x88')](),_0xc008('0xa3'))['field'](_0x4117cc[_0xc008('0x4c')]['id'][_0xc008('0x88')](),'VoiceQueueId')['field'](_0xc008('0xa4'),'createdAt')['field'](_0xc008('0xa4'),'updatedAt')[_0xc008('0x81')](_0xc008('0xa5'))[_0xc008('0x41')](_0xc008('0xa6'))[_0xc008('0x41')]('ListId\x20=\x20?',_0x1407de['CmListId'][_0xc008('0x88')]())['where'](_0xc008('0xa7'))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xc008('0x7f')]('COALESCE(calleridnum,\x27\x27)')[_0xc008('0x81')](_0xc008('0xa8'))['where']('VoiceQueueId\x20=\x20?',_0x4117cc[_0xc008('0x4c')]['id'][_0xc008('0x88')]()))[_0xc008('0x41')](_0xc008('0xa9'),squel['select']()['field'](_0xc008('0xaa'))['from']('cm_hopper')[_0xc008('0x41')](_0xc008('0x85'),_0x4117cc['params']['id']['toString']())))['toString']();break;case _0xc008('0xab'):_0x323af4=squel['insert']()[_0xc008('0xac')](_0xc008('0x9f'))[_0xc008('0xad')]([_0xc008('0xa0'),_0xc008('0xa1'),'ContactId','ListId',_0xc008('0x63'),_0xc008('0x5b'),_0xc008('0x5c')],squel[_0xc008('0x7e')]()[_0xc008('0x7f')](_0xc008('0xa0'),_0xc008('0xa0'))[_0xc008('0x7f')](_0xc008('0xa4'),_0xc008('0xa1'))[_0xc008('0x7f')]('id',_0xc008('0xa2'))['field'](_0x1407de[_0xc008('0xae')][_0xc008('0x88')](),_0xc008('0xa3'))[_0xc008('0x7f')](_0x4117cc['params']['id'][_0xc008('0x88')](),_0xc008('0x63'))[_0xc008('0x7f')](_0xc008('0xa4'),_0xc008('0x5b'))[_0xc008('0x7f')](_0xc008('0xa4'),_0xc008('0x5c'))['from'](_0xc008('0xa5'))[_0xc008('0x41')](_0xc008('0xa6'))[_0xc008('0x41')](_0xc008('0xaf'),_0x1407de[_0xc008('0xae')][_0xc008('0x88')]())['where'](_0xc008('0xa7'))['where'](_0xc008('0xa9'),squel[_0xc008('0x7e')]()[_0xc008('0x7f')](_0xc008('0xaa'))[_0xc008('0x81')](_0xc008('0x9f'))[_0xc008('0x41')](_0xc008('0x85'),_0x4117cc[_0xc008('0x4c')]['id'][_0xc008('0x88')]())))['toString']();break;default:_0x323af4=squel[_0xc008('0x9e')]()[_0xc008('0xac')](_0xc008('0x9f'))[_0xc008('0xad')]([_0xc008('0xa0'),_0xc008('0xa1'),_0xc008('0xa2'),_0xc008('0xa3'),_0xc008('0x63'),_0xc008('0x5b'),_0xc008('0x5c')],squel[_0xc008('0x7e')]()[_0xc008('0x7f')]('phone',_0xc008('0xa0'))['field'](_0xc008('0xa4'),_0xc008('0xa1'))[_0xc008('0x7f')]('id',_0xc008('0xa2'))[_0xc008('0x7f')](_0x1407de[_0xc008('0xae')]['toString'](),_0xc008('0xa3'))[_0xc008('0x7f')](_0x4117cc[_0xc008('0x4c')]['id']['toString'](),'VoiceQueueId')['field'](_0xc008('0xa4'),_0xc008('0x5b'))[_0xc008('0x7f')](_0xc008('0xa4'),_0xc008('0x5c'))[_0xc008('0x81')](_0xc008('0xa5'))['where'](_0xc008('0xa6'))[_0xc008('0x41')](_0xc008('0xaf'),_0x1407de[_0xc008('0xae')][_0xc008('0x88')]())['where'](_0xc008('0xa7')))[_0xc008('0x88')]();}_0x4e46f0[_0xc008('0x87')](db[_0xc008('0x73')][_0xc008('0x36')](_0x323af4));}return BPromise[_0xc008('0x96')](_0x4e46f0);}})[_0xc008('0x22')](function(){return _0x17d146;})[_0xc008('0x22')](respondWithResult(_0x5456ce,null))[_0xc008('0x58')](handleError(_0x5456ce,null));};exports[_0xc008('0xb0')]=function(_0x5fa4bf,_0x59170f,_0x466c8e){return db['VoiceQueue'][_0xc008('0x2b')]({'where':{'id':_0x5fa4bf[_0xc008('0x4c')]['id']}})[_0xc008('0x22')](handleEntityNotFound(_0x59170f,null))['then'](function(_0xcffc22){if(_0xcffc22){return _0xcffc22['removeLists'](_0x5fa4bf[_0xc008('0x36')][_0xc008('0x7d')]);}})[_0xc008('0x22')](function(_0x42275c){if(_0x42275c){return db[_0xc008('0x62')][_0xc008('0x23')]({'where':{'ListId':_0x5fa4bf[_0xc008('0x36')][_0xc008('0x7d')],'VoiceQueueId':_0x5fa4bf[_0xc008('0x4c')]['id']}})[_0xc008('0x22')](function(){return _0x42275c;});}})['then'](respondWithStatusCode(_0x59170f,null))[_0xc008('0x58')](handleError(_0x59170f,null));};exports['getBlackLists']=function(_0x490993,_0x35edb8,_0x55ad1f){var _0x32cce7={};var _0x8a14={};var _0x46717a;var _0x1345ad;return db['VoiceQueue'][_0xc008('0x61')]({'where':{'id':_0x490993[_0xc008('0x4c')]['id']}})[_0xc008('0x22')](handleEntityNotFound(_0x35edb8,null))[_0xc008('0x22')](function(_0xc5b3de){if(_0xc5b3de){_0x46717a=_0xc5b3de;_0x8a14['model']=_[_0xc008('0x37')](db[_0xc008('0xb1')]['rawAttributes']);_0x8a14[_0xc008('0x36')]=_[_0xc008('0x37')](_0x490993[_0xc008('0x36')]);_0x8a14[_0xc008('0x42')]=_[_0xc008('0x38')](_0x8a14[_0xc008('0x35')],_0x8a14['query']);_0x32cce7[_0xc008('0x39')]=_[_0xc008('0x38')](_0x8a14[_0xc008('0x35')],qs[_0xc008('0x3a')](_0x490993[_0xc008('0x36')][_0xc008('0x3a')]));_0x32cce7[_0xc008('0x39')]=_0x32cce7[_0xc008('0x39')][_0xc008('0x4e')]?_0x32cce7[_0xc008('0x39')]:_0x8a14['model'];_0x32cce7[_0xc008('0x3f')]=qs[_0xc008('0x40')](_0x490993[_0xc008('0x36')][_0xc008('0x40')]);_0x32cce7['where']=qs[_0xc008('0x42')](_[_0xc008('0x43')](_0x490993[_0xc008('0x36')],_0x8a14[_0xc008('0x42')]));if(_0x490993[_0xc008('0x36')][_0xc008('0x44')]){_0x32cce7[_0xc008('0x41')]=_[_0xc008('0x45')](_0x32cce7[_0xc008('0x41')],{'$or':_[_0xc008('0x30')](_0x32cce7[_0xc008('0x39')],function(_0x15a061){var _0x322330={};_0x322330[_0x15a061]={'$like':'%'+_0x490993[_0xc008('0x36')]['filter']+'%'};return _0x322330;})});}_0x32cce7=_[_0xc008('0x45')]({},_0x32cce7,_0x490993[_0xc008('0x47')]);return _0x46717a[_0xc008('0xb2')](_0x32cce7);}})[_0xc008('0x22')](function(_0x202896){if(_0x202896){_0x1345ad=_0x202896['length'];if(!_0x490993[_0xc008('0x36')][_0xc008('0x3b')]('nolimit')){_0x32cce7[_0xc008('0x3d')]=qs[_0xc008('0x3d')](_0x490993['query']['limit']);_0x32cce7['offset']=qs['offset'](_0x490993[_0xc008('0x36')]['offset']);}return _0x46717a['getBlackLists'](_0x32cce7);}})[_0xc008('0x22')](function(_0x4781bf){if(_0x4781bf){return _0x4781bf?{'count':_0x1345ad,'rows':_0x4781bf}:null;}})[_0xc008('0x22')](respondWithResult(_0x35edb8,null))['catch'](handleError(_0x35edb8,null));};exports['addBlackLists']=function(_0x4c6c36,_0x291b87,_0x43631c){var _0x2a7239,_0x5e8ddf;return db[_0xc008('0x31')][_0xc008('0x2b')]({'where':{'id':_0x4c6c36['params']['id']}})[_0xc008('0x22')](handleEntityNotFound(_0x291b87,null))['then'](function(_0x5aedcb){if(_0x5aedcb){_0x5e8ddf=_0x5aedcb;return _0x5aedcb[_0xc008('0xb3')](_0x4c6c36[_0xc008('0x51')]['ids'],_['omit'](_0x4c6c36[_0xc008('0x51')],[_0xc008('0x7d'),'id'])||{});}return null;})['spread'](function(_0x27a63c){var _0x5cfa5f;_0x2a7239=_0x27a63c||[];var _0x337f51=[];if(_0x27a63c){for(var _0x120e9d=0x0;_0x120e9d<_0x27a63c[_0xc008('0x4e')];_0x120e9d+=0x1){var _0x2e3d3e=_0x27a63c[_0x120e9d][_0xc008('0x52')]({'plain':!![]});_0x5cfa5f=squel[_0xc008('0x9e')]()[_0xc008('0xac')](_0xc008('0xb4'))['fromQuery']([_0xc008('0xa0'),'ContactId',_0xc008('0xa3'),'VoiceQueueId','createdAt',_0xc008('0x5c')],squel[_0xc008('0x7e')]()[_0xc008('0x7f')](_0xc008('0xa0'),_0xc008('0xa0'))['field']('id','ContactId')[_0xc008('0x7f')](_0x2e3d3e[_0xc008('0xae')]['toString'](),'ListId')[_0xc008('0x7f')](_0x4c6c36[_0xc008('0x4c')]['id'][_0xc008('0x88')](),_0xc008('0x63'))[_0xc008('0x7f')](_0xc008('0xa4'),_0xc008('0x5b'))[_0xc008('0x7f')]('NOW()',_0xc008('0x5c'))[_0xc008('0x81')]('cm_contacts')[_0xc008('0x41')](_0xc008('0xa6'))['where'](_0xc008('0xaf'),_0x2e3d3e['CmListId'][_0xc008('0x88')]())['where'](_0xc008('0xa7')))[_0xc008('0x88')]();_0x337f51['push'](db[_0xc008('0x73')]['query'](_0x5cfa5f));}return BPromise[_0xc008('0x96')](_0x337f51);}})[_0xc008('0x22')](function(){return _0x2a7239;})[_0xc008('0x22')](respondWithResult(_0x291b87,null))[_0xc008('0x58')](handleError(_0x291b87,null));};exports[_0xc008('0xb5')]=function(_0x2bf125,_0x384e8a,_0x1b4a2f){return db[_0xc008('0x31')]['find']({'where':{'id':_0x2bf125[_0xc008('0x4c')]['id']}})[_0xc008('0x22')](handleEntityNotFound(_0x384e8a,null))[_0xc008('0x22')](function(_0x22de7a){if(_0x22de7a){return _0x22de7a[_0xc008('0xb5')](_0x2bf125['query'][_0xc008('0x7d')]);}})[_0xc008('0x22')](function(_0x1cac43){if(_0x1cac43){return db[_0xc008('0x69')][_0xc008('0x23')]({'where':{'ListId':_0x2bf125[_0xc008('0x36')][_0xc008('0x7d')],'VoiceQueueId':_0x2bf125[_0xc008('0x4c')]['id']}})[_0xc008('0x22')](function(){return _0x1cac43;});}})[_0xc008('0x22')](respondWithStatusCode(_0x384e8a,null))[_0xc008('0x58')](handleError(_0x384e8a,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 2e9bb72..717229a 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 _0x8c30=['emit','hasOwnProperty','hook','events','VoiceQueue','setMaxListeners','save','update','remove'];(function(_0x1e48d3,_0x5d8c43){var _0x2852b1=function(_0x11d7b3){while(--_0x11d7b3){_0x1e48d3['push'](_0x1e48d3['shift']());}};_0x2852b1(++_0x5d8c43);}(_0x8c30,0x18f));var _0x08c3=function(_0x465d47,_0x2e5f56){_0x465d47=_0x465d47-0x0;var _0x3a564d=_0x8c30[_0x465d47];return _0x3a564d;};'use strict';var EventEmitter=require(_0x08c3('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x08c3('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x08c3('0x2')](0x0);var events={'afterCreate':_0x08c3('0x3'),'afterUpdate':_0x08c3('0x4'),'afterDestroy':_0x08c3('0x5')};function emitEvent(_0x39b539){return function(_0x399d76,_0x356f75,_0x299384){VoiceQueueEvents['emit'](_0x39b539+':'+_0x399d76['id'],_0x399d76);VoiceQueueEvents[_0x08c3('0x6')](_0x39b539,_0x399d76);_0x299384(null);};}for(var e in events){if(events[_0x08c3('0x7')](e)){var event=events[e];VoiceQueue[_0x08c3('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x88d6=['VoiceQueue','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x237cb6,_0x583128){var _0x1c83af=function(_0x3b6f95){while(--_0x3b6f95){_0x237cb6['push'](_0x237cb6['shift']());}};_0x1c83af(++_0x583128);}(_0x88d6,0x110));var _0x688d=function(_0x1e404e,_0x5118e0){_0x1e404e=_0x1e404e-0x0;var _0xd01dc4=_0x88d6[_0x1e404e];return _0xd01dc4;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x688d('0x0'))['db'][_0x688d('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x688d('0x2')};function emitEvent(_0x2e4a08){return function(_0x380b39,_0x5e08b3,_0x4ecaac){VoiceQueueEvents[_0x688d('0x3')](_0x2e4a08+':'+_0x380b39['id'],_0x380b39);VoiceQueueEvents[_0x688d('0x3')](_0x2e4a08,_0x380b39);_0x4ecaac(null);};}for(var e in events){if(events[_0x688d('0x4')](e)){var event=events[e];VoiceQueue[_0x688d('0x5')](e,emitEvent(event));}}module[_0x688d('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 4b3af99..7023313 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 _0x57a2=['VoiceQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','./voiceQueue.attributes','exports','define'];(function(_0xbc6edb,_0x9306e1){var _0x5de02f=function(_0x57b369){while(--_0x57b369){_0xbc6edb['push'](_0xbc6edb['shift']());}};_0x5de02f(++_0x9306e1);}(_0x57a2,0x12d));var _0x257a=function(_0x5aeb3a,_0x3511f3){_0x5aeb3a=_0x5aeb3a-0x0;var _0x336677=_0x57a2[_0x5aeb3a];return _0x336677;};'use strict';var _=require(_0x257a('0x0'));var util=require('util');var logger=require(_0x257a('0x1'))(_0x257a('0x2'));var moment=require(_0x257a('0x3'));var BPromise=require(_0x257a('0x4'));var rp=require(_0x257a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x257a('0x6'));module[_0x257a('0x7')]=function(_0x541d27,_0x345a08){return _0x541d27[_0x257a('0x8')](_0x257a('0x9'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8e8=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueue','voice_queues','lodash','util'];(function(_0x881f07,_0x1ffd07){var _0x38c79c=function(_0xebe32){while(--_0xebe32){_0x881f07['push'](_0x881f07['shift']());}};_0x38c79c(++_0x1ffd07);}(_0xe8e8,0xa6));var _0x8e8e=function(_0x122393,_0x179065){_0x122393=_0x122393-0x0;var _0x139a71=_0xe8e8[_0x122393];return _0x139a71;};'use strict';var _=require(_0x8e8e('0x0'));var util=require(_0x8e8e('0x1'));var logger=require(_0x8e8e('0x2'))(_0x8e8e('0x3'));var moment=require(_0x8e8e('0x4'));var BPromise=require(_0x8e8e('0x5'));var rp=require(_0x8e8e('0x6'));var fs=require('fs');var path=require(_0x8e8e('0x7'));var rimraf=require(_0x8e8e('0x8'));var config=require(_0x8e8e('0x9'));var attributes=require('./voiceQueue.attributes');module[_0x8e8e('0xa')]=function(_0x18076a,_0x1a01c2){return _0x18076a[_0x8e8e('0xb')](_0x8e8e('0xc'),attributes,{'tableName':_0x8e8e('0xd'),'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 ebf79da..25669d1 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 _0x9207=['catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','info','find','ShowVoiceQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','request','then','VoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x30b95a,_0x103ff4){var _0x356c58=function(_0x55a40f){while(--_0x55a40f){_0x30b95a['push'](_0x30b95a['shift']());}};_0x356c58(++_0x103ff4);}(_0x9207,0x127));var _0x7920=function(_0x1d53cb,_0x4cf3f1){_0x1d53cb=_0x1d53cb-0x0;var _0x1de5fe=_0x9207[_0x1d53cb];return _0x1de5fe;};'use strict';var _=require(_0x7920('0x0'));var util=require(_0x7920('0x1'));var moment=require(_0x7920('0x2'));var BPromise=require('bluebird');var rs=require(_0x7920('0x3'));var fs=require('fs');var Redis=require(_0x7920('0x4'));var db=require(_0x7920('0x5'))['db'];var utils=require(_0x7920('0x6'));var logger=require(_0x7920('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7920('0x8'));var client=jayson[_0x7920('0x9')][_0x7920('0xa')]({'port':0x232a});config[_0x7920('0xb')]=_[_0x7920('0xc')](config[_0x7920('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7920('0xd'))(new Redis(config[_0x7920('0xb')]));require(_0x7920('0xe'))['register'](socket);function respondWithRpcPromise(_0x7cf201,_0x2b59a5,_0x5eec6f){return new BPromise(function(_0x2afa2c,_0x457720){return client[_0x7920('0xf')](_0x7cf201,_0x5eec6f)[_0x7920('0x10')](function(_0xc68e16){logger['info'](_0x7920('0x11'),_0x2b59a5,'request\x20sent');logger[_0x7920('0x12')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x2b59a5,_0x7920('0x13'),JSON[_0x7920('0x14')](_0xc68e16));if(_0xc68e16['error']){if(_0xc68e16[_0x7920('0x15')][_0x7920('0x16')]===0x1f4){logger['error'](_0x7920('0x11'),_0x2b59a5,_0xc68e16[_0x7920('0x15')][_0x7920('0x17')]);return _0x457720(_0xc68e16['error'][_0x7920('0x17')]);}logger[_0x7920('0x15')](_0x7920('0x11'),_0x2b59a5,_0xc68e16['error'][_0x7920('0x17')]);return _0x2afa2c(_0xc68e16[_0x7920('0x15')][_0x7920('0x17')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x2b59a5,'request\x20sent');_0x2afa2c(_0xc68e16[_0x7920('0x18')][_0x7920('0x17')]);}})[_0x7920('0x19')](function(_0x984ac3){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x2b59a5,_0x984ac3);_0x457720(_0x984ac3);});});}exports[_0x7920('0x1a')]=function(_0x247bdd){var _0x3cbbae=this;return new Promise(function(_0x3d0b3a,_0xc0878){return db[_0x7920('0x1b')][_0x7920('0x1c')]({'raw':_0x247bdd[_0x7920('0x1d')]?_0x247bdd[_0x7920('0x1d')][_0x7920('0x1e')]===undefined?!![]:![]:!![],'where':_0x247bdd[_0x7920('0x1d')]?_0x247bdd[_0x7920('0x1d')][_0x7920('0x1f')]||null:null,'attributes':_0x247bdd[_0x7920('0x1d')]?_0x247bdd[_0x7920('0x1d')][_0x7920('0x20')]||null:null,'limit':_0x247bdd[_0x7920('0x1d')]?_0x247bdd[_0x7920('0x1d')][_0x7920('0x21')]||null:null,'include':_0x247bdd[_0x7920('0x1d')]?_0x247bdd[_0x7920('0x1d')][_0x7920('0x22')]?_[_0x7920('0x23')](_0x247bdd['options'][_0x7920('0x22')],function(_0x57f4e8){return{'model':db[_0x57f4e8[_0x7920('0x24')]],'as':_0x57f4e8['as'],'attributes':_0x57f4e8[_0x7920('0x20')],'include':_0x57f4e8[_0x7920('0x22')]?_[_0x7920('0x23')](_0x57f4e8[_0x7920('0x22')],function(_0x521bb0){return{'model':db[_0x521bb0['model']],'as':_0x521bb0['as'],'attributes':_0x521bb0[_0x7920('0x20')],'include':_0x521bb0['include']?_[_0x7920('0x23')](_0x521bb0['include'],function(_0x127274){return{'model':db[_0x127274[_0x7920('0x24')]],'as':_0x127274['as'],'attributes':_0x127274[_0x7920('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x567cf9){logger[_0x7920('0x25')](_0x7920('0x1a'),_0x247bdd);logger[_0x7920('0x12')](_0x7920('0x1a'),_0x247bdd,JSON[_0x7920('0x14')](_0x567cf9));_0x3d0b3a(_0x567cf9);})[_0x7920('0x19')](function(_0x1d75b8){logger[_0x7920('0x15')](_0x7920('0x1a'),_0x1d75b8[_0x7920('0x17')],_0x247bdd);_0xc0878(_0x3cbbae['error'](0x1f4,_0x1d75b8['message']));});});};exports['ShowVoiceQueue']=function(_0x4e513d){var _0x2fb17c=this;return new Promise(function(_0x3ec13b,_0x24561b){return db[_0x7920('0x1b')][_0x7920('0x26')]({'raw':_0x4e513d[_0x7920('0x1d')]?_0x4e513d[_0x7920('0x1d')][_0x7920('0x1e')]===undefined?!![]:![]:!![],'where':_0x4e513d['options']?_0x4e513d[_0x7920('0x1d')]['where']||null:null,'attributes':_0x4e513d[_0x7920('0x1d')]?_0x4e513d[_0x7920('0x1d')][_0x7920('0x20')]||null:null,'include':_0x4e513d['options']?_0x4e513d[_0x7920('0x1d')][_0x7920('0x22')]?_[_0x7920('0x23')](_0x4e513d[_0x7920('0x1d')][_0x7920('0x22')],function(_0x1c4128){return{'model':db[_0x1c4128['model']],'as':_0x1c4128['as'],'attributes':_0x1c4128[_0x7920('0x20')],'include':_0x1c4128['include']?_[_0x7920('0x23')](_0x1c4128[_0x7920('0x22')],function(_0x25116e){return{'model':db[_0x25116e[_0x7920('0x24')]],'as':_0x25116e['as'],'attributes':_0x25116e['attributes'],'include':_0x25116e[_0x7920('0x22')]?_['map'](_0x25116e['include'],function(_0x5d6889){return{'model':db[_0x5d6889[_0x7920('0x24')]],'as':_0x5d6889['as'],'attributes':_0x5d6889['attributes']};}):[]};}):[]};}):[]:[]})[_0x7920('0x10')](function(_0x2c5cfe){logger['info']('ShowVoiceQueue',_0x4e513d);logger[_0x7920('0x12')](_0x7920('0x27'),_0x4e513d,JSON[_0x7920('0x14')](_0x2c5cfe));_0x3ec13b(_0x2c5cfe);})[_0x7920('0x19')](function(_0x5dc9d9){logger[_0x7920('0x15')](_0x7920('0x27'),_0x5dc9d9['message'],_0x4e513d);_0x24561b(_0x2fb17c[_0x7920('0x15')](0x1f4,_0x5dc9d9[_0x7920('0x17')]));});});}; \ No newline at end of file +var _0x7ba4=['options','raw','where','attributes','limit','include','map','model','ShowVoiceQueue','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll'];(function(_0x4b8e8a,_0xcbb7a){var _0x547ceb=function(_0x1416ec){while(--_0x1416ec){_0x4b8e8a['push'](_0x4b8e8a['shift']());}};_0x547ceb(++_0xcbb7a);}(_0x7ba4,0x1c1));var _0x47ba=function(_0x4a1e15,_0x8633b6){_0x4a1e15=_0x4a1e15-0x0;var _0x2aa501=_0x7ba4[_0x4a1e15];return _0x2aa501;};'use strict';var _=require(_0x47ba('0x0'));var util=require(_0x47ba('0x1'));var moment=require('moment');var BPromise=require(_0x47ba('0x2'));var rs=require(_0x47ba('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x47ba('0x4'))['db'];var utils=require(_0x47ba('0x5'));var logger=require('../../config/logger')(_0x47ba('0x6'));var config=require(_0x47ba('0x7'));var jayson=require(_0x47ba('0x8'));var client=jayson[_0x47ba('0x9')][_0x47ba('0xa')]({'port':0x232a});config['redis']=_[_0x47ba('0xb')](config[_0x47ba('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47ba('0xd'))(new Redis(config[_0x47ba('0xc')]));require(_0x47ba('0xe'))[_0x47ba('0xf')](socket);function respondWithRpcPromise(_0x1f12bc,_0x4101c3,_0x3a31f7){return new BPromise(function(_0x4b315a,_0x35c883){return client[_0x47ba('0x10')](_0x1f12bc,_0x3a31f7)[_0x47ba('0x11')](function(_0x51a95f){logger[_0x47ba('0x12')](_0x47ba('0x13'),_0x4101c3,_0x47ba('0x14'));logger[_0x47ba('0x15')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x4101c3,'request\x20sent',JSON[_0x47ba('0x16')](_0x51a95f));if(_0x51a95f[_0x47ba('0x17')]){if(_0x51a95f[_0x47ba('0x17')][_0x47ba('0x18')]===0x1f4){logger[_0x47ba('0x17')](_0x47ba('0x13'),_0x4101c3,_0x51a95f[_0x47ba('0x17')]['message']);return _0x35c883(_0x51a95f['error'][_0x47ba('0x19')]);}logger[_0x47ba('0x17')](_0x47ba('0x13'),_0x4101c3,_0x51a95f[_0x47ba('0x17')][_0x47ba('0x19')]);return _0x4b315a(_0x51a95f[_0x47ba('0x17')][_0x47ba('0x19')]);}else{logger[_0x47ba('0x12')](_0x47ba('0x13'),_0x4101c3,_0x47ba('0x14'));_0x4b315a(_0x51a95f[_0x47ba('0x1a')][_0x47ba('0x19')]);}})[_0x47ba('0x1b')](function(_0x26b182){logger[_0x47ba('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x4101c3,_0x26b182);_0x35c883(_0x26b182);});});}exports[_0x47ba('0x1c')]=function(_0x55b7f8){var _0x5870c8=this;return new Promise(function(_0x5b5b6f,_0x570563){return db[_0x47ba('0x1d')][_0x47ba('0x1e')]({'raw':_0x55b7f8['options']?_0x55b7f8[_0x47ba('0x1f')][_0x47ba('0x20')]===undefined?!![]:![]:!![],'where':_0x55b7f8[_0x47ba('0x1f')]?_0x55b7f8['options'][_0x47ba('0x21')]||null:null,'attributes':_0x55b7f8[_0x47ba('0x1f')]?_0x55b7f8[_0x47ba('0x1f')][_0x47ba('0x22')]||null:null,'limit':_0x55b7f8['options']?_0x55b7f8[_0x47ba('0x1f')][_0x47ba('0x23')]||null:null,'include':_0x55b7f8[_0x47ba('0x1f')]?_0x55b7f8[_0x47ba('0x1f')][_0x47ba('0x24')]?_[_0x47ba('0x25')](_0x55b7f8['options'][_0x47ba('0x24')],function(_0x2d9fe3){return{'model':db[_0x2d9fe3[_0x47ba('0x26')]],'as':_0x2d9fe3['as'],'attributes':_0x2d9fe3[_0x47ba('0x22')],'include':_0x2d9fe3[_0x47ba('0x24')]?_['map'](_0x2d9fe3[_0x47ba('0x24')],function(_0x4a573a){return{'model':db[_0x4a573a[_0x47ba('0x26')]],'as':_0x4a573a['as'],'attributes':_0x4a573a[_0x47ba('0x22')],'include':_0x4a573a[_0x47ba('0x24')]?_[_0x47ba('0x25')](_0x4a573a['include'],function(_0x12e1cb){return{'model':db[_0x12e1cb[_0x47ba('0x26')]],'as':_0x12e1cb['as'],'attributes':_0x12e1cb['attributes']};}):[]};}):[]};}):[]:[]})[_0x47ba('0x11')](function(_0x5ea406){logger[_0x47ba('0x12')](_0x47ba('0x1c'),_0x55b7f8);logger[_0x47ba('0x15')](_0x47ba('0x1c'),_0x55b7f8,JSON[_0x47ba('0x16')](_0x5ea406));_0x5b5b6f(_0x5ea406);})['catch'](function(_0x11e4ce){logger[_0x47ba('0x17')](_0x47ba('0x1c'),_0x11e4ce['message'],_0x55b7f8);_0x570563(_0x5870c8[_0x47ba('0x17')](0x1f4,_0x11e4ce[_0x47ba('0x19')]));});});};exports[_0x47ba('0x27')]=function(_0xb86f30){var _0x1bb0c4=this;return new Promise(function(_0x345ab7,_0x5a01a6){return db[_0x47ba('0x1d')]['find']({'raw':_0xb86f30[_0x47ba('0x1f')]?_0xb86f30[_0x47ba('0x1f')][_0x47ba('0x20')]===undefined?!![]:![]:!![],'where':_0xb86f30[_0x47ba('0x1f')]?_0xb86f30[_0x47ba('0x1f')][_0x47ba('0x21')]||null:null,'attributes':_0xb86f30[_0x47ba('0x1f')]?_0xb86f30[_0x47ba('0x1f')]['attributes']||null:null,'include':_0xb86f30['options']?_0xb86f30['options'][_0x47ba('0x24')]?_[_0x47ba('0x25')](_0xb86f30[_0x47ba('0x1f')][_0x47ba('0x24')],function(_0x591cb0){return{'model':db[_0x591cb0[_0x47ba('0x26')]],'as':_0x591cb0['as'],'attributes':_0x591cb0[_0x47ba('0x22')],'include':_0x591cb0[_0x47ba('0x24')]?_['map'](_0x591cb0['include'],function(_0x1be04e){return{'model':db[_0x1be04e[_0x47ba('0x26')]],'as':_0x1be04e['as'],'attributes':_0x1be04e[_0x47ba('0x22')],'include':_0x1be04e[_0x47ba('0x24')]?_[_0x47ba('0x25')](_0x1be04e[_0x47ba('0x24')],function(_0x59eaa8){return{'model':db[_0x59eaa8[_0x47ba('0x26')]],'as':_0x59eaa8['as'],'attributes':_0x59eaa8[_0x47ba('0x22')]};}):[]};}):[]};}):[]:[]})[_0x47ba('0x11')](function(_0x1e30e3){logger['info']('ShowVoiceQueue',_0xb86f30);logger[_0x47ba('0x15')](_0x47ba('0x27'),_0xb86f30,JSON[_0x47ba('0x16')](_0x1e30e3));_0x345ab7(_0x1e30e3);})['catch'](function(_0x1d5caa){logger['error']('ShowVoiceQueue',_0x1d5caa[_0x47ba('0x19')],_0xb86f30);_0x5a01a6(_0x1bb0c4[_0x47ba('0x17')](0x1f4,_0x1d5caa[_0x47ba('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 6c7875d..dd1b174 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 _0x8e1f=['save','update','emit','removeListener','voiceQueue:','./voiceQueue.events'];(function(_0x9c802a,_0x1eb813){var _0x1bac75=function(_0x3c79c0){while(--_0x3c79c0){_0x9c802a['push'](_0x9c802a['shift']());}};_0x1bac75(++_0x1eb813);}(_0x8e1f,0x95));var _0xf8e1=function(_0x5804c8,_0x57af4d){_0x5804c8=_0x5804c8-0x0;var _0x33d432=_0x8e1f[_0x5804c8];return _0x33d432;};'use strict';var VoiceQueueEvents=require(_0xf8e1('0x0'));var events=[_0xf8e1('0x1'),'remove',_0xf8e1('0x2')];function createListener(_0x49a653,_0x17e8cd){return function(_0x484bf6){_0x17e8cd[_0xf8e1('0x3')](_0x49a653,_0x484bf6);};}function removeListener(_0x4091dd,_0x3c772a){return function(){VoiceQueueEvents[_0xf8e1('0x4')](_0x4091dd,_0x3c772a);};}exports['register']=function(_0x4bdf39){for(var _0x5df2f4=0x0,_0x326787=events['length'];_0x5df2f4<_0x326787;_0x5df2f4++){var _0x2678d8=events[_0x5df2f4];var _0x59d6ec=createListener(_0xf8e1('0x5')+_0x2678d8,_0x4bdf39);VoiceQueueEvents['on'](_0x2678d8,_0x59d6ec);}}; \ No newline at end of file +var _0x8f71=['voiceQueue:','save','remove','register','length'];(function(_0x8eedb5,_0x33ed83){var _0xbdbbeb=function(_0x312470){while(--_0x312470){_0x8eedb5['push'](_0x8eedb5['shift']());}};_0xbdbbeb(++_0x33ed83);}(_0x8f71,0x1e6));var _0x18f7=function(_0x2fea15,_0x30e9d5){_0x2fea15=_0x2fea15-0x0;var _0x5d84f9=_0x8f71[_0x2fea15];return _0x5d84f9;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x18f7('0x0'),_0x18f7('0x1'),'update'];function createListener(_0x10edde,_0x4f01e6){return function(_0x3e6312){_0x4f01e6['emit'](_0x10edde,_0x3e6312);};}function removeListener(_0x5d961b,_0x2eda16){return function(){VoiceQueueEvents['removeListener'](_0x5d961b,_0x2eda16);};}exports[_0x18f7('0x2')]=function(_0xec71c9){for(var _0x2587d3=0x0,_0xf2cd36=events[_0x18f7('0x3')];_0x2587d3<_0xf2cd36;_0x2587d3++){var _0xbb8cf7=events[_0x2587d3];var _0x52ad55=createListener(_0x18f7('0x4')+_0xbb8cf7,_0xec71c9);VoiceQueueEvents['on'](_0xbb8cf7,_0x52ad55);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 58bc0dc..8f5a007 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 _0x0a6b=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','create','update','delete','destroy','exports','multer','express'];(function(_0x2286c3,_0x11775f){var _0x2f6721=function(_0x53e385){while(--_0x53e385){_0x2286c3['push'](_0x2286c3['shift']());}};_0x2f6721(++_0x11775f);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x1e3313,_0x36fc14){_0x1e3313=_0x1e3313-0x0;var _0x413004=_0x0a6b[_0x1e3313];return _0x413004;};'use strict';var multer=require(_0xb0a6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb0a6('0x1'));var router=express['Router']();var auth=require(_0xb0a6('0x2'));var interaction=require(_0xb0a6('0x3'));var config=require(_0xb0a6('0x4'));var controller=require('./voiceQueueReport.controller');router[_0xb0a6('0x5')]('/',auth['isAuthenticated'](),controller[_0xb0a6('0x6')]);router[_0xb0a6('0x5')]('/describe',auth[_0xb0a6('0x7')](),controller[_0xb0a6('0x8')]);router[_0xb0a6('0x5')]('/index',auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0xb0a6('0x5')](_0xb0a6('0x9'),auth[_0xb0a6('0x7')](),controller[_0xb0a6('0xa')]);router['post']('/',auth[_0xb0a6('0x7')](),controller[_0xb0a6('0xb')]);router['put'](_0xb0a6('0x9'),auth[_0xb0a6('0x7')](),controller[_0xb0a6('0xc')]);router[_0xb0a6('0xd')](_0xb0a6('0x9'),auth[_0xb0a6('0x7')](),controller[_0xb0a6('0xe')]);module[_0xb0a6('0xf')]=router; \ No newline at end of file +var _0x199c=['/index','getVoiceQueuesReport','/:id','show','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','describe','get'];(function(_0x47f54e,_0x560861){var _0xfafaa4=function(_0x3c023c){while(--_0x3c023c){_0x47f54e['push'](_0x47f54e['shift']());}};_0xfafaa4(++_0x560861);}(_0x199c,0x1d8));var _0xc199=function(_0x3a678e,_0x4d297c){_0x3a678e=_0x3a678e-0x0;var _0x2e62e7=_0x199c[_0x3a678e];return _0x2e62e7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc199('0x0'));var timeout=require(_0xc199('0x1'));var express=require(_0xc199('0x2'));var router=express[_0xc199('0x3')]();var auth=require(_0xc199('0x4'));var interaction=require(_0xc199('0x5'));var config=require(_0xc199('0x6'));var controller=require(_0xc199('0x7'));router['get']('/',auth[_0xc199('0x8')](),controller[_0xc199('0x9')]);router['get']('/describe',auth[_0xc199('0x8')](),controller[_0xc199('0xa')]);router[_0xc199('0xb')](_0xc199('0xc'),auth[_0xc199('0x8')](),controller[_0xc199('0xd')]);router[_0xc199('0xb')](_0xc199('0xe'),auth['isAuthenticated'](),controller[_0xc199('0xf')]);router[_0xc199('0x10')]('/',auth[_0xc199('0x8')](),controller[_0xc199('0x11')]);router[_0xc199('0x12')](_0xc199('0xe'),auth['isAuthenticated'](),controller[_0xc199('0x13')]);router[_0xc199('0x14')](_0xc199('0xe'),auth[_0xc199('0x8')](),controller[_0xc199('0x15')]);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 15493f4..b8e698e 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 _0x9c44=['getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','DATE','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x49c4('0x0')]={'type':{'type':Sequelize[_0x49c4('0x1')]},'uniqueid':{'type':Sequelize[_0x49c4('0x1')]},'calleridnum':{'type':Sequelize[_0x49c4('0x1')]},'calleridname':{'type':Sequelize[_0x49c4('0x1')]},'queue':{'type':Sequelize[_0x49c4('0x1')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x41a183){var _0x57effd=moment(_0x41a183);var _0xc1278f=moment(this[_0x49c4('0x2')](_0x49c4('0x3')))[_0x49c4('0x4')](_0x49c4('0x5'));var _0x511d53=_0x57effd[_0x49c4('0x6')](_0xc1278f,_0x49c4('0x7'));this[_0x49c4('0x8')](_0x49c4('0x9'),_0x41a183);this['setDataValue']('holdtime',_0x511d53||null);}},'position':{'type':Sequelize[_0x49c4('0xa')]},'count':{'type':Sequelize[_0x49c4('0xa')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x49c4('0xb')]},'queuecallercomplete':{'type':Sequelize[_0x49c4('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x49c4('0xb')]},'queuecallerexitreason':{'type':Sequelize[_0x49c4('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x49c4('0xa')]},'channel':{'type':Sequelize[_0x49c4('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x49c4('0x1')]},'accountcode':{'type':Sequelize[_0x49c4('0x1')]},'context':{'type':Sequelize[_0x49c4('0x1')]},'exten':{'type':Sequelize[_0x49c4('0x1')]},'priority':{'type':Sequelize[_0x49c4('0x1')]},'holdtime':{'type':Sequelize[_0x49c4('0xa')]},'mohtime':{'type':Sequelize[_0x49c4('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x49c4('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x49c4('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x49c4('0x1')],'comment':_0x49c4('0xd')},'transferexten':{'type':Sequelize[_0x49c4('0x1')]},'transferuniqueid':{'type':Sequelize[_0x49c4('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x49c4('0x1')]},'thirdDisposition':{'type':Sequelize[_0x49c4('0x1')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x70e0=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x5a26f9,_0x3f951a){var _0x59a22a=function(_0x50c3d7){while(--_0x50c3d7){_0x5a26f9['push'](_0x5a26f9['shift']());}};_0x59a22a(++_0x3f951a);}(_0x70e0,0x17b));var _0x070e=function(_0x2bc069,_0x55c67a){_0x2bc069=_0x2bc069-0x0;var _0xf12fea=_0x70e0[_0x2bc069];return _0xf12fea;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));module[_0x070e('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x070e('0x3')]},'calleridname':{'type':Sequelize[_0x070e('0x3')]},'queue':{'type':Sequelize[_0x070e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x7bce9b){var _0x579a6b=moment(_0x7bce9b);var _0x46fe68=moment(this['getDataValue']('queuecallerjoinAt'))['format'](_0x070e('0x5'));var _0x1e11f0=_0x579a6b[_0x070e('0x6')](_0x46fe68,_0x070e('0x7'));this[_0x070e('0x8')](_0x070e('0x9'),_0x7bce9b);this[_0x070e('0x8')]('holdtime',_0x1e11f0||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x070e('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerexit':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x070e('0x3')],'comment':_0x070e('0xc')},'originalposition':{'type':Sequelize[_0x070e('0xa')]},'channel':{'type':Sequelize[_0x070e('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x070e('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x070e('0xa')]},'mohtime':{'type':Sequelize[_0x070e('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x070e('0x3')],'comment':_0x070e('0xd')},'transferexten':{'type':Sequelize[_0x070e('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x070e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x070e('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x070e('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index f19b664..dcef078 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 _0xc5c8=['update','destroy','then','sendStatus','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','describe','getVoiceQueuesReport','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','save'];(function(_0x2d34ad,_0xcc2b95){var _0x25d8f4=function(_0x597234){while(--_0x597234){_0x2d34ad['push'](_0x2d34ad['shift']());}};_0x25d8f4(++_0xcc2b95);}(_0xc5c8,0x118));var _0x8c5c=function(_0x2a8d7e,_0x43ef65){_0x2a8d7e=_0x2a8d7e-0x0;var _0x822835=_0xc5c8[_0x2a8d7e];return _0x822835;};'use strict';var pdf=require(_0x8c5c('0x0'));var emlformat=require(_0x8c5c('0x1'));var rimraf=require(_0x8c5c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8c5c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8c5c('0x4'));var Mustache=require(_0x8c5c('0x5'));var util=require('util');var path=require(_0x8c5c('0x6'));var sox=require(_0x8c5c('0x7'));var csv=require(_0x8c5c('0x8'));var ejs=require(_0x8c5c('0x9'));var fs=require('fs');var _=require(_0x8c5c('0xa'));var squel=require(_0x8c5c('0xb'));var crypto=require(_0x8c5c('0xc'));var jsforce=require(_0x8c5c('0xd'));var deskjs=require(_0x8c5c('0xe'));var toCsv=require(_0x8c5c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8c5c('0xf'));var qs=require(_0x8c5c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c5c('0x11'))(_0x8c5c('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8c5c('0x13'));var db=require(_0x8c5c('0x14'))['db'];config['redis']=_['defaults'](config[_0x8c5c('0x15')],{'host':_0x8c5c('0x16'),'port':0x18eb});var socket=require(_0x8c5c('0x17'))(new Redis(config['redis']));require(_0x8c5c('0x18'))[_0x8c5c('0x19')](socket);function respondWithStatusCode(_0x4fe2a6,_0x47eddd){_0x47eddd=_0x47eddd||0xcc;return function(_0x39d63e){if(_0x39d63e){return _0x4fe2a6['sendStatus'](_0x47eddd);}return _0x4fe2a6[_0x8c5c('0x1a')](_0x47eddd)[_0x8c5c('0x1b')]();};}function respondWithResult(_0x2e820a,_0x3a3104){_0x3a3104=_0x3a3104||0xc8;return function(_0x535bb0){if(_0x535bb0){return _0x2e820a[_0x8c5c('0x1a')](_0x3a3104)[_0x8c5c('0x1c')](_0x535bb0);}};}function respondWithFilteredResult(_0x107835,_0x189ddb){return function(_0x10614e){if(_0x10614e){var _0x5a40f6=_0x10614e[_0x8c5c('0x1d')],_0x5d8dd3=_0x189ddb['offset'],_0x51ff6b=_0x189ddb[_0x8c5c('0x1e')]+_0x189ddb[_0x8c5c('0x1f')],_0x56a434;if(_0x51ff6b>=_0x5a40f6){_0x51ff6b=_0x5a40f6;_0x56a434=0xc8;}else{_0x56a434=0xce;}_0x107835[_0x8c5c('0x1a')](_0x56a434);return _0x107835[_0x8c5c('0x20')](_0x8c5c('0x21'),_0x5d8dd3+'-'+_0x51ff6b+'/'+_0x5a40f6)[_0x8c5c('0x1c')](_0x10614e);}return null;};}function patchUpdates(_0xc174a4){return function(_0xac22f9){try{jsonpatch[_0x8c5c('0x22')](_0xac22f9,_0xc174a4,!![]);}catch(_0x3d1712){return BPromise['reject'](_0x3d1712);}return _0xac22f9[_0x8c5c('0x23')]();};}function saveUpdates(_0x34f24e,_0x1e5caa){return function(_0x4c85e8){if(_0x4c85e8){return _0x4c85e8[_0x8c5c('0x24')](_0x34f24e)['then'](function(_0x570486){return _0x570486;});}return null;};}function removeEntity(_0x572e87,_0x32a426){return function(_0x3c583e){if(_0x3c583e){return _0x3c583e[_0x8c5c('0x25')]()[_0x8c5c('0x26')](function(){_0x572e87[_0x8c5c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bf1ec,_0x4bd6e8){return function(_0x19820f){if(!_0x19820f){_0x4bf1ec[_0x8c5c('0x27')](0x194);}return _0x19820f;};}function handleError(_0x2fc2f7,_0x6bf7b6){_0x6bf7b6=_0x6bf7b6||0x1f4;return function(_0xe61871){logger[_0x8c5c('0x28')](_0xe61871[_0x8c5c('0x29')]);if(_0xe61871[_0x8c5c('0x2a')]){delete _0xe61871[_0x8c5c('0x2a')];}_0x2fc2f7[_0x8c5c('0x1a')](_0x6bf7b6)[_0x8c5c('0x2b')](_0xe61871);};}exports[_0x8c5c('0x2c')]=function(_0x23f003,_0x5e26eb){var _0x450b66={},_0x479ff0={},_0x2a185c={'count':0x0,'rows':[]};var _0x338c03=_[_0x8c5c('0x2d')](db[_0x8c5c('0x2e')][_0x8c5c('0x2f')],function(_0x49d200){return{'name':_0x49d200['fieldName'],'type':_0x49d200[_0x8c5c('0x30')][_0x8c5c('0x31')]};});_0x479ff0[_0x8c5c('0x32')]=_[_0x8c5c('0x2d')](_0x338c03,'name');_0x479ff0[_0x8c5c('0x33')]=_[_0x8c5c('0x34')](_0x23f003[_0x8c5c('0x33')]);_0x479ff0['filters']=_['intersection'](_0x479ff0[_0x8c5c('0x32')],_0x479ff0[_0x8c5c('0x33')]);_0x450b66[_0x8c5c('0x35')]=_[_0x8c5c('0x36')](_0x479ff0['model'],qs[_0x8c5c('0x37')](_0x23f003[_0x8c5c('0x33')][_0x8c5c('0x37')]));_0x450b66[_0x8c5c('0x35')]=_0x450b66[_0x8c5c('0x35')][_0x8c5c('0x38')]?_0x450b66['attributes']:_0x479ff0[_0x8c5c('0x32')];if(!_0x23f003[_0x8c5c('0x33')][_0x8c5c('0x39')](_0x8c5c('0x3a'))){_0x450b66[_0x8c5c('0x1f')]=qs[_0x8c5c('0x1f')](_0x23f003['query'][_0x8c5c('0x1f')]);_0x450b66[_0x8c5c('0x1e')]=qs[_0x8c5c('0x1e')](_0x23f003['query'][_0x8c5c('0x1e')]);}_0x450b66[_0x8c5c('0x3b')]=qs[_0x8c5c('0x3c')](_0x23f003[_0x8c5c('0x33')][_0x8c5c('0x3c')]);_0x450b66[_0x8c5c('0x3d')]=qs[_0x8c5c('0x3e')](_[_0x8c5c('0x3f')](_0x23f003[_0x8c5c('0x33')],_0x479ff0[_0x8c5c('0x3e')]),_0x338c03);if(_0x23f003['query'][_0x8c5c('0x40')]){_0x450b66[_0x8c5c('0x3d')]=_[_0x8c5c('0x41')](_0x450b66[_0x8c5c('0x3d')],{'$or':_[_0x8c5c('0x2d')](_0x338c03,function(_0x2d0fc8){if(_0x2d0fc8['type']!==_0x8c5c('0x42')){var _0x303beb={};_0x303beb[_0x2d0fc8['name']]={'$like':'%'+_0x23f003[_0x8c5c('0x33')]['filter']+'%'};return _0x303beb;}})});}_0x450b66=_['merge']({},_0x450b66,_0x23f003[_0x8c5c('0x43')]);var _0x3f31={'where':_0x450b66['where']};return db[_0x8c5c('0x2e')][_0x8c5c('0x1d')](_0x3f31)['then'](function(_0xbcc60c){_0x2a185c[_0x8c5c('0x1d')]=_0xbcc60c;if(_0x23f003[_0x8c5c('0x33')][_0x8c5c('0x44')]){_0x450b66[_0x8c5c('0x45')]=[{'all':!![]}];}return db[_0x8c5c('0x2e')][_0x8c5c('0x46')](_0x450b66);})['then'](function(_0x2df4b3){_0x2a185c[_0x8c5c('0x47')]=_0x2df4b3;return _0x2a185c;})[_0x8c5c('0x26')](respondWithFilteredResult(_0x5e26eb,_0x450b66))['catch'](handleError(_0x5e26eb,null));};exports['show']=function(_0x3ed226,_0xfe1aad){var _0x43c6c2={'raw':![],'where':{'id':_0x3ed226[_0x8c5c('0x48')]['id']}},_0x47b63f={};_0x47b63f[_0x8c5c('0x32')]=_[_0x8c5c('0x34')](db['VoiceQueueReport'][_0x8c5c('0x2f')]);_0x47b63f['query']=_['keys'](_0x3ed226[_0x8c5c('0x33')]);_0x47b63f['filtears']=_[_0x8c5c('0x36')](_0x47b63f['model'],_0x47b63f[_0x8c5c('0x33')]);_0x43c6c2[_0x8c5c('0x35')]=_[_0x8c5c('0x36')](_0x47b63f[_0x8c5c('0x32')],qs['fields'](_0x3ed226[_0x8c5c('0x33')]['fields']));_0x43c6c2['attributes']=_0x43c6c2['attributes'][_0x8c5c('0x38')]?_0x43c6c2[_0x8c5c('0x35')]:_0x47b63f[_0x8c5c('0x32')];if(_0x3ed226[_0x8c5c('0x33')][_0x8c5c('0x44')]){_0x43c6c2[_0x8c5c('0x45')]=[{'all':!![]}];}_0x43c6c2=_['merge']({},_0x43c6c2,_0x3ed226[_0x8c5c('0x43')]);return db['VoiceQueueReport'][_0x8c5c('0x49')](_0x43c6c2)[_0x8c5c('0x26')](handleEntityNotFound(_0xfe1aad,null))[_0x8c5c('0x26')](respondWithResult(_0xfe1aad,null))[_0x8c5c('0x4a')](handleError(_0xfe1aad,null));};exports[_0x8c5c('0x4b')]=function(_0x5da6a0,_0x42e8d9){return db[_0x8c5c('0x2e')][_0x8c5c('0x4b')](_0x5da6a0[_0x8c5c('0x4c')],{})[_0x8c5c('0x26')](respondWithResult(_0x42e8d9,0xc9))[_0x8c5c('0x4a')](handleError(_0x42e8d9,null));};exports[_0x8c5c('0x24')]=function(_0x173b8c,_0x4f984b){if(_0x173b8c['body']['id']){delete _0x173b8c['body']['id'];}return db[_0x8c5c('0x2e')][_0x8c5c('0x49')]({'where':{'id':_0x173b8c[_0x8c5c('0x48')]['id']}})['then'](handleEntityNotFound(_0x4f984b,null))[_0x8c5c('0x26')](saveUpdates(_0x173b8c[_0x8c5c('0x4c')],null))['then'](respondWithResult(_0x4f984b,null))[_0x8c5c('0x4a')](handleError(_0x4f984b,null));};exports[_0x8c5c('0x25')]=function(_0xf8e008,_0xae8f89){return db[_0x8c5c('0x2e')]['find']({'where':{'id':_0xf8e008[_0x8c5c('0x48')]['id']}})[_0x8c5c('0x26')](handleEntityNotFound(_0xae8f89,null))[_0x8c5c('0x26')](removeEntity(_0xae8f89,null))[_0x8c5c('0x4a')](handleError(_0xae8f89,null));};exports[_0x8c5c('0x4d')]=function(_0x497838,_0x35e355){return db[_0x8c5c('0x2e')][_0x8c5c('0x4d')]()[_0x8c5c('0x26')](respondWithResult(_0x35e355,null))[_0x8c5c('0x4a')](handleError(_0x35e355,null));};exports[_0x8c5c('0x4e')]=function(_0x354685,_0x8a22df){var _0x33511d={},_0x54a967={},_0x321acf={'count':0x0,'rows':[]};_0x54a967['model']=_[_0x8c5c('0x34')](db[_0x8c5c('0x2e')]['rawAttributes']);_0x54a967[_0x8c5c('0x33')]=_[_0x8c5c('0x34')](_0x354685[_0x8c5c('0x33')]);_0x54a967[_0x8c5c('0x3e')]=_[_0x8c5c('0x36')](_0x54a967[_0x8c5c('0x32')],_0x54a967[_0x8c5c('0x33')]);_0x33511d[_0x8c5c('0x35')]=_['intersection'](_0x54a967[_0x8c5c('0x32')],qs['fields'](_0x354685[_0x8c5c('0x33')][_0x8c5c('0x37')]));_0x33511d[_0x8c5c('0x35')]=_0x33511d[_0x8c5c('0x35')]['length']?_0x33511d[_0x8c5c('0x35')]:_0x54a967[_0x8c5c('0x32')];if(!_0x354685[_0x8c5c('0x33')][_0x8c5c('0x39')](_0x8c5c('0x3a'))){_0x33511d[_0x8c5c('0x1f')]=qs['limit'](_0x354685[_0x8c5c('0x33')]['limit']);_0x33511d['offset']=qs[_0x8c5c('0x1e')](_0x354685[_0x8c5c('0x33')][_0x8c5c('0x1e')]);}_0x33511d[_0x8c5c('0x3b')]=qs[_0x8c5c('0x3c')](_0x354685[_0x8c5c('0x33')]['sort']);_0x33511d[_0x8c5c('0x3d')]=qs['filters'](_[_0x8c5c('0x3f')](_0x354685[_0x8c5c('0x33')],_0x54a967[_0x8c5c('0x3e')]));if(_0x354685[_0x8c5c('0x33')][_0x8c5c('0x40')]){_0x33511d['where']=_['merge'](_0x33511d[_0x8c5c('0x3d')],{'$or':_[_0x8c5c('0x2d')](_0x33511d[_0x8c5c('0x35')],function(_0x4fbe3d){var _0x5a7fe4={};_0x5a7fe4[_0x4fbe3d]={'$like':'%'+_0x354685[_0x8c5c('0x33')][_0x8c5c('0x40')]+'%'};return _0x5a7fe4;})});}_0x33511d=_['merge']({},_0x33511d,_0x354685['options']);var _0x54b872={'where':_0x33511d[_0x8c5c('0x3d')]};return db[_0x8c5c('0x2e')][_0x8c5c('0x1d')](_0x54b872)[_0x8c5c('0x26')](function(_0x5dcd19){_0x321acf['count']=_0x5dcd19;if(_0x354685[_0x8c5c('0x33')][_0x8c5c('0x44')]){_0x33511d['include']=[{'all':!![]}];}return db[_0x8c5c('0x2e')][_0x8c5c('0x46')](_0x33511d);})[_0x8c5c('0x26')](function(_0x1cf6f0){_0x321acf[_0x8c5c('0x47')]=_0x1cf6f0;return _0x321acf;})[_0x8c5c('0x26')](respondWithFilteredResult(_0x8a22df,_0x33511d,_0x8c5c('0x4e')))[_0x8c5c('0x4a')](handleError(_0x8a22df,null,_0x8c5c('0x4e')));}; \ No newline at end of file +var _0x3c8e=['localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','show','params','length','options','create','body','catch','update','find','describe','getVoiceQueuesReport','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3c8e,0x89));var _0xe3c8=function(_0x484d09,_0x4df9b9){_0x484d09=_0x484d09-0x0;var _0x1d35b7=_0x3c8e[_0x484d09];return _0x1d35b7;};'use strict';var pdf=require(_0xe3c8('0x0'));var emlformat=require(_0xe3c8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe3c8('0x2'));var rp=require(_0xe3c8('0x3'));var moment=require(_0xe3c8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe3c8('0x5'));var util=require(_0xe3c8('0x6'));var path=require(_0xe3c8('0x7'));var sox=require(_0xe3c8('0x8'));var csv=require('to-csv');var ejs=require(_0xe3c8('0x9'));var fs=require('fs');var _=require(_0xe3c8('0xa'));var squel=require(_0xe3c8('0xb'));var crypto=require(_0xe3c8('0xc'));var jsforce=require(_0xe3c8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe3c8('0xe'));var querystring=require('querystring');var Papa=require(_0xe3c8('0xf'));var Redis=require(_0xe3c8('0x10'));var authService=require(_0xe3c8('0x11'));var qs=require(_0xe3c8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3c8('0x13'));var logger=require(_0xe3c8('0x14'))(_0xe3c8('0x15'));var utils=require('../../config/utils');var config=require(_0xe3c8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe3c8('0x17'))['db'];config['redis']=_['defaults'](config[_0xe3c8('0x18')],{'host':_0xe3c8('0x19'),'port':0x18eb});var socket=require(_0xe3c8('0x1a'))(new Redis(config['redis']));require(_0xe3c8('0x1b'))[_0xe3c8('0x1c')](socket);function respondWithStatusCode(_0x45c7c3,_0x1b3615){_0x1b3615=_0x1b3615||0xcc;return function(_0x369b2a){if(_0x369b2a){return _0x45c7c3[_0xe3c8('0x1d')](_0x1b3615);}return _0x45c7c3['status'](_0x1b3615)[_0xe3c8('0x1e')]();};}function respondWithResult(_0x138dc8,_0x599149){_0x599149=_0x599149||0xc8;return function(_0x7b146b){if(_0x7b146b){return _0x138dc8[_0xe3c8('0x1f')](_0x599149)[_0xe3c8('0x20')](_0x7b146b);}};}function respondWithFilteredResult(_0x4d94de,_0x2196f2){return function(_0x1dc06e){if(_0x1dc06e){var _0x36d454=_0x1dc06e[_0xe3c8('0x21')],_0x1677ef=_0x2196f2['offset'],_0x1142a3=_0x2196f2[_0xe3c8('0x22')]+_0x2196f2[_0xe3c8('0x23')],_0x1136d1;if(_0x1142a3>=_0x36d454){_0x1142a3=_0x36d454;_0x1136d1=0xc8;}else{_0x1136d1=0xce;}_0x4d94de[_0xe3c8('0x1f')](_0x1136d1);return _0x4d94de[_0xe3c8('0x24')](_0xe3c8('0x25'),_0x1677ef+'-'+_0x1142a3+'/'+_0x36d454)[_0xe3c8('0x20')](_0x1dc06e);}return null;};}function patchUpdates(_0x4907ed){return function(_0x1010a3){try{jsonpatch[_0xe3c8('0x26')](_0x1010a3,_0x4907ed,!![]);}catch(_0x499665){return BPromise[_0xe3c8('0x27')](_0x499665);}return _0x1010a3[_0xe3c8('0x28')]();};}function saveUpdates(_0x5396ea,_0x2168e9){return function(_0x22ea83){if(_0x22ea83){return _0x22ea83['update'](_0x5396ea)[_0xe3c8('0x29')](function(_0x3f9460){return _0x3f9460;});}return null;};}function removeEntity(_0x2558b8,_0x33ee35){return function(_0x1f5bf8){if(_0x1f5bf8){return _0x1f5bf8['destroy']()[_0xe3c8('0x29')](function(){_0x2558b8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b9fa5,_0xf2f111){return function(_0x4f2d7f){if(!_0x4f2d7f){_0x4b9fa5[_0xe3c8('0x1d')](0x194);}return _0x4f2d7f;};}function handleError(_0x27887a,_0x590979){_0x590979=_0x590979||0x1f4;return function(_0x2e02bf){logger['error'](_0x2e02bf[_0xe3c8('0x2a')]);if(_0x2e02bf[_0xe3c8('0x2b')]){delete _0x2e02bf[_0xe3c8('0x2b')];}_0x27887a[_0xe3c8('0x1f')](_0x590979)[_0xe3c8('0x2c')](_0x2e02bf);};}exports[_0xe3c8('0x2d')]=function(_0x9d9e45,_0x497448){var _0x56b742={},_0x3cf2f8={},_0x2005b1={'count':0x0,'rows':[]};var _0x40d365=_['map'](db[_0xe3c8('0x2e')][_0xe3c8('0x2f')],function(_0x2c928a){return{'name':_0x2c928a[_0xe3c8('0x30')],'type':_0x2c928a['type'][_0xe3c8('0x31')]};});_0x3cf2f8['model']=_[_0xe3c8('0x32')](_0x40d365,_0xe3c8('0x2b'));_0x3cf2f8[_0xe3c8('0x33')]=_[_0xe3c8('0x34')](_0x9d9e45['query']);_0x3cf2f8[_0xe3c8('0x35')]=_[_0xe3c8('0x36')](_0x3cf2f8[_0xe3c8('0x37')],_0x3cf2f8['query']);_0x56b742[_0xe3c8('0x38')]=_[_0xe3c8('0x36')](_0x3cf2f8[_0xe3c8('0x37')],qs[_0xe3c8('0x39')](_0x9d9e45[_0xe3c8('0x33')][_0xe3c8('0x39')]));_0x56b742['attributes']=_0x56b742[_0xe3c8('0x38')]['length']?_0x56b742[_0xe3c8('0x38')]:_0x3cf2f8[_0xe3c8('0x37')];if(!_0x9d9e45[_0xe3c8('0x33')][_0xe3c8('0x3a')](_0xe3c8('0x3b'))){_0x56b742[_0xe3c8('0x23')]=qs[_0xe3c8('0x23')](_0x9d9e45[_0xe3c8('0x33')]['limit']);_0x56b742[_0xe3c8('0x22')]=qs['offset'](_0x9d9e45['query'][_0xe3c8('0x22')]);}_0x56b742[_0xe3c8('0x3c')]=qs[_0xe3c8('0x3d')](_0x9d9e45[_0xe3c8('0x33')]['sort']);_0x56b742[_0xe3c8('0x3e')]=qs['filters'](_[_0xe3c8('0x3f')](_0x9d9e45[_0xe3c8('0x33')],_0x3cf2f8[_0xe3c8('0x35')]),_0x40d365);if(_0x9d9e45[_0xe3c8('0x33')][_0xe3c8('0x40')]){_0x56b742[_0xe3c8('0x3e')]=_[_0xe3c8('0x41')](_0x56b742[_0xe3c8('0x3e')],{'$or':_[_0xe3c8('0x32')](_0x40d365,function(_0x201217){if(_0x201217[_0xe3c8('0x42')]!=='VIRTUAL'){var _0x5322ed={};_0x5322ed[_0x201217[_0xe3c8('0x2b')]]={'$like':'%'+_0x9d9e45[_0xe3c8('0x33')][_0xe3c8('0x40')]+'%'};return _0x5322ed;}})});}_0x56b742=_[_0xe3c8('0x41')]({},_0x56b742,_0x9d9e45['options']);var _0x34d130={'where':_0x56b742['where']};return db[_0xe3c8('0x2e')][_0xe3c8('0x21')](_0x34d130)[_0xe3c8('0x29')](function(_0x4cd844){_0x2005b1[_0xe3c8('0x21')]=_0x4cd844;if(_0x9d9e45[_0xe3c8('0x33')][_0xe3c8('0x43')]){_0x56b742[_0xe3c8('0x44')]=[{'all':!![]}];}return db[_0xe3c8('0x2e')][_0xe3c8('0x45')](_0x56b742);})[_0xe3c8('0x29')](function(_0x4f61de){_0x2005b1['rows']=_0x4f61de;return _0x2005b1;})[_0xe3c8('0x29')](respondWithFilteredResult(_0x497448,_0x56b742))['catch'](handleError(_0x497448,null));};exports[_0xe3c8('0x46')]=function(_0x2bd33f,_0x440858){var _0x152210={'raw':![],'where':{'id':_0x2bd33f[_0xe3c8('0x47')]['id']}},_0xd0f80f={};_0xd0f80f['model']=_[_0xe3c8('0x34')](db[_0xe3c8('0x2e')][_0xe3c8('0x2f')]);_0xd0f80f[_0xe3c8('0x33')]=_['keys'](_0x2bd33f['query']);_0xd0f80f['filtears']=_['intersection'](_0xd0f80f[_0xe3c8('0x37')],_0xd0f80f[_0xe3c8('0x33')]);_0x152210[_0xe3c8('0x38')]=_['intersection'](_0xd0f80f['model'],qs[_0xe3c8('0x39')](_0x2bd33f[_0xe3c8('0x33')][_0xe3c8('0x39')]));_0x152210[_0xe3c8('0x38')]=_0x152210[_0xe3c8('0x38')][_0xe3c8('0x48')]?_0x152210[_0xe3c8('0x38')]:_0xd0f80f['model'];if(_0x2bd33f[_0xe3c8('0x33')][_0xe3c8('0x43')]){_0x152210[_0xe3c8('0x44')]=[{'all':!![]}];}_0x152210=_[_0xe3c8('0x41')]({},_0x152210,_0x2bd33f[_0xe3c8('0x49')]);return db[_0xe3c8('0x2e')]['find'](_0x152210)[_0xe3c8('0x29')](handleEntityNotFound(_0x440858,null))[_0xe3c8('0x29')](respondWithResult(_0x440858,null))['catch'](handleError(_0x440858,null));};exports['create']=function(_0x1a3b42,_0x335c81){return db['VoiceQueueReport'][_0xe3c8('0x4a')](_0x1a3b42[_0xe3c8('0x4b')],{})['then'](respondWithResult(_0x335c81,0xc9))[_0xe3c8('0x4c')](handleError(_0x335c81,null));};exports[_0xe3c8('0x4d')]=function(_0x449cca,_0x16ed1f){if(_0x449cca[_0xe3c8('0x4b')]['id']){delete _0x449cca[_0xe3c8('0x4b')]['id'];}return db[_0xe3c8('0x2e')]['find']({'where':{'id':_0x449cca['params']['id']}})[_0xe3c8('0x29')](handleEntityNotFound(_0x16ed1f,null))[_0xe3c8('0x29')](saveUpdates(_0x449cca[_0xe3c8('0x4b')],null))[_0xe3c8('0x29')](respondWithResult(_0x16ed1f,null))[_0xe3c8('0x4c')](handleError(_0x16ed1f,null));};exports['destroy']=function(_0xf9a5c4,_0x18239b){return db[_0xe3c8('0x2e')][_0xe3c8('0x4e')]({'where':{'id':_0xf9a5c4[_0xe3c8('0x47')]['id']}})[_0xe3c8('0x29')](handleEntityNotFound(_0x18239b,null))['then'](removeEntity(_0x18239b,null))[_0xe3c8('0x4c')](handleError(_0x18239b,null));};exports[_0xe3c8('0x4f')]=function(_0x3b7fbc,_0x31abd4){return db[_0xe3c8('0x2e')]['describe']()['then'](respondWithResult(_0x31abd4,null))[_0xe3c8('0x4c')](handleError(_0x31abd4,null));};exports[_0xe3c8('0x50')]=function(_0x408e07,_0x331833){var _0x4183fe={},_0x27f545={},_0x2dac2e={'count':0x0,'rows':[]};_0x27f545[_0xe3c8('0x37')]=_[_0xe3c8('0x34')](db['VoiceQueueReport'][_0xe3c8('0x2f')]);_0x27f545[_0xe3c8('0x33')]=_[_0xe3c8('0x34')](_0x408e07['query']);_0x27f545['filters']=_['intersection'](_0x27f545[_0xe3c8('0x37')],_0x27f545[_0xe3c8('0x33')]);_0x4183fe['attributes']=_[_0xe3c8('0x36')](_0x27f545[_0xe3c8('0x37')],qs['fields'](_0x408e07['query']['fields']));_0x4183fe['attributes']=_0x4183fe['attributes'][_0xe3c8('0x48')]?_0x4183fe['attributes']:_0x27f545[_0xe3c8('0x37')];if(!_0x408e07[_0xe3c8('0x33')][_0xe3c8('0x3a')](_0xe3c8('0x3b'))){_0x4183fe[_0xe3c8('0x23')]=qs[_0xe3c8('0x23')](_0x408e07[_0xe3c8('0x33')]['limit']);_0x4183fe[_0xe3c8('0x22')]=qs[_0xe3c8('0x22')](_0x408e07[_0xe3c8('0x33')][_0xe3c8('0x22')]);}_0x4183fe['order']=qs[_0xe3c8('0x3d')](_0x408e07[_0xe3c8('0x33')][_0xe3c8('0x3d')]);_0x4183fe[_0xe3c8('0x3e')]=qs[_0xe3c8('0x35')](_['pick'](_0x408e07['query'],_0x27f545[_0xe3c8('0x35')]));if(_0x408e07[_0xe3c8('0x33')][_0xe3c8('0x40')]){_0x4183fe['where']=_[_0xe3c8('0x41')](_0x4183fe[_0xe3c8('0x3e')],{'$or':_[_0xe3c8('0x32')](_0x4183fe['attributes'],function(_0x2a9685){var _0x5f58cb={};_0x5f58cb[_0x2a9685]={'$like':'%'+_0x408e07[_0xe3c8('0x33')][_0xe3c8('0x40')]+'%'};return _0x5f58cb;})});}_0x4183fe=_[_0xe3c8('0x41')]({},_0x4183fe,_0x408e07[_0xe3c8('0x49')]);var _0x573c16={'where':_0x4183fe[_0xe3c8('0x3e')]};return db[_0xe3c8('0x2e')][_0xe3c8('0x21')](_0x573c16)[_0xe3c8('0x29')](function(_0x1b491e){_0x2dac2e[_0xe3c8('0x21')]=_0x1b491e;if(_0x408e07[_0xe3c8('0x33')]['includeAll']){_0x4183fe[_0xe3c8('0x44')]=[{'all':!![]}];}return db[_0xe3c8('0x2e')][_0xe3c8('0x45')](_0x4183fe);})[_0xe3c8('0x29')](function(_0x2679d1){_0x2dac2e['rows']=_0x2679d1;return _0x2dac2e;})[_0xe3c8('0x29')](respondWithFilteredResult(_0x331833,_0x4183fe,_0xe3c8('0x50')))[_0xe3c8('0x4c')](handleError(_0x331833,null,_0xe3c8('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 0170c88..2d7f499 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 _0x5119=['hook','exports','events','VoiceQueueReport','remove','emit'];(function(_0x2db56a,_0x3b4d6a){var _0x1826f8=function(_0x928dc8){while(--_0x928dc8){_0x2db56a['push'](_0x2db56a['shift']());}};_0x1826f8(++_0x3b4d6a);}(_0x5119,0x17c));var _0x9511=function(_0x17aa7a,_0x2be8e4){_0x17aa7a=_0x17aa7a-0x0;var _0x2321f8=_0x5119[_0x17aa7a];return _0x2321f8;};'use strict';var EventEmitter=require(_0x9511('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x9511('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9511('0x2')};function emitEvent(_0x3e36c1){return function(_0x47decf,_0x36cf18,_0x6b2b6b){VoiceQueueReportEvents['emit'](_0x3e36c1+':'+_0x47decf['id'],_0x47decf);VoiceQueueReportEvents[_0x9511('0x3')](_0x3e36c1,_0x47decf);_0x6b2b6b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x9511('0x4')](e,emitEvent(event));}}module[_0x9511('0x5')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x96d5=['hasOwnProperty','hook','VoiceQueueReport','save','update','remove','emit'];(function(_0x652222,_0x3cfce9){var _0x2fd044=function(_0x49ad36){while(--_0x49ad36){_0x652222['push'](_0x652222['shift']());}};_0x2fd044(++_0x3cfce9);}(_0x96d5,0x183));var _0x596d=function(_0x2a1a31,_0x1b8b1a){_0x2a1a31=_0x2a1a31-0x0;var _0xe175e8=_0x96d5[_0x2a1a31];return _0xe175e8;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0x596d('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x596d('0x1'),'afterUpdate':_0x596d('0x2'),'afterDestroy':_0x596d('0x3')};function emitEvent(_0x5404fe){return function(_0xee205f,_0xeccb2b,_0x101c86){VoiceQueueReportEvents[_0x596d('0x4')](_0x5404fe+':'+_0xee205f['id'],_0xee205f);VoiceQueueReportEvents[_0x596d('0x4')](_0x5404fe,_0xee205f);_0x101c86(null);};}for(var e in events){if(events[_0x596d('0x5')](e)){var event=events[e];VoiceQueueReport[_0x596d('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 4719c2c..f3f031c 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.model.js +++ b/server/api/voiceQueueReport/voiceQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x7b8d14,_0x11ff9f){var _0x12b867=function(_0x1cea9d){while(--_0x1cea9d){_0x7b8d14['push'](_0x7b8d14['shift']());}};_0x12b867(++_0x11ff9f);}(_0x757a,0xde));var _0xa757=function(_0x144dcb,_0x33f007){_0x144dcb=_0x144dcb-0x0;var _0x4aafb4=_0x757a[_0x144dcb];return _0x4aafb4;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('VoiceQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'fields':[_0xa757('0xa')]},{'fields':[_0xa757('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f66=['request-promise','path','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','moment','bluebird'];(function(_0x54cc68,_0x38558b){var _0xf3a052=function(_0x548178){while(--_0x548178){_0x54cc68['push'](_0x54cc68['shift']());}};_0xf3a052(++_0x38558b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[{'fields':[_0x65f6('0xa')]},{'fields':[_0x65f6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 2616480..ea7f1a9 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 _0x58a1=['../../config/environment','jayson/promise','client','redis','defaults','localhost','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','create','CreateVoiceQueueReport','UpdateVoiceQueueReport','body','where','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xb818a9,_0x56a971){var _0x311b68=function(_0x57aadb){while(--_0x57aadb){_0xb818a9['push'](_0xb818a9['shift']());}};_0x311b68(++_0x56a971);}(_0x58a1,0x72));var _0x158a=function(_0x33fab6,_0x532a04){_0x33fab6=_0x33fab6-0x0;var _0x314e60=_0x58a1[_0x33fab6];return _0x314e60;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x158a('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x158a('0x1'));var db=require(_0x158a('0x2'))['db'];var utils=require(_0x158a('0x3'));var logger=require(_0x158a('0x4'))(_0x158a('0x5'));var config=require(_0x158a('0x6'));var jayson=require(_0x158a('0x7'));var client=jayson[_0x158a('0x8')]['http']({'port':0x232a});config[_0x158a('0x9')]=_[_0x158a('0xa')](config[_0x158a('0x9')],{'host':_0x158a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x158a('0x9')]));require(_0x158a('0xc'))[_0x158a('0xd')](socket);function respondWithRpcPromise(_0x18d11d,_0x440707,_0x13a43c){return new BPromise(function(_0x125bff,_0x3e8700){return client['request'](_0x18d11d,_0x13a43c)[_0x158a('0xe')](function(_0x413edb){logger[_0x158a('0xf')](_0x158a('0x10'),_0x440707,_0x158a('0x11'));logger[_0x158a('0x12')](_0x158a('0x13'),_0x440707,_0x158a('0x11'),JSON[_0x158a('0x14')](_0x413edb));if(_0x413edb[_0x158a('0x15')]){if(_0x413edb[_0x158a('0x15')][_0x158a('0x16')]===0x1f4){logger[_0x158a('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x440707,_0x413edb[_0x158a('0x15')][_0x158a('0x17')]);return _0x3e8700(_0x413edb[_0x158a('0x15')][_0x158a('0x17')]);}logger[_0x158a('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x440707,_0x413edb['error'][_0x158a('0x17')]);return _0x125bff(_0x413edb['error']['message']);}else{logger[_0x158a('0xf')](_0x158a('0x10'),_0x440707,_0x158a('0x11'));_0x125bff(_0x413edb['result'][_0x158a('0x17')]);}})[_0x158a('0x18')](function(_0x4dfbfc){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x440707,_0x4dfbfc);_0x3e8700(_0x4dfbfc);});});}exports[_0x158a('0x19')]=function(_0x73475d){var _0x18c3cf=this;return new Promise(function(_0x3c4c47,_0x136d89){return db[_0x158a('0x1a')][_0x158a('0x1b')]({'raw':_0x73475d[_0x158a('0x1c')]?_0x73475d[_0x158a('0x1c')][_0x158a('0x1d')]===undefined?!![]:![]:!![],'where':_0x73475d[_0x158a('0x1c')]?_0x73475d[_0x158a('0x1c')]['where']||null:null,'attributes':_0x73475d[_0x158a('0x1c')]?_0x73475d[_0x158a('0x1c')][_0x158a('0x1e')]||null:null,'limit':_0x73475d[_0x158a('0x1c')]?_0x73475d[_0x158a('0x1c')][_0x158a('0x1f')]||null:null,'include':_0x73475d[_0x158a('0x1c')]?_0x73475d['options'][_0x158a('0x20')]?_[_0x158a('0x21')](_0x73475d[_0x158a('0x1c')][_0x158a('0x20')],function(_0x5cbdc7){return{'model':db[_0x5cbdc7[_0x158a('0x22')]],'as':_0x5cbdc7['as'],'attributes':_0x5cbdc7[_0x158a('0x1e')],'include':_0x5cbdc7[_0x158a('0x20')]?_[_0x158a('0x21')](_0x5cbdc7[_0x158a('0x20')],function(_0x3f5808){return{'model':db[_0x3f5808[_0x158a('0x22')]],'as':_0x3f5808['as'],'attributes':_0x3f5808['attributes'],'include':_0x3f5808[_0x158a('0x20')]?_[_0x158a('0x21')](_0x3f5808[_0x158a('0x20')],function(_0x4cfae2){return{'model':db[_0x4cfae2['model']],'as':_0x4cfae2['as'],'attributes':_0x4cfae2[_0x158a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x158a('0xe')](function(_0x1262eb){logger[_0x158a('0xf')](_0x158a('0x19'),_0x73475d);logger[_0x158a('0x12')](_0x158a('0x19'),_0x73475d,JSON[_0x158a('0x14')](_0x1262eb));_0x3c4c47(_0x1262eb);})[_0x158a('0x18')](function(_0x13f44f){logger['error'](_0x158a('0x19'),_0x13f44f['message'],_0x73475d);_0x136d89(_0x18c3cf[_0x158a('0x15')](0x1f4,_0x13f44f[_0x158a('0x17')]));});});};exports['CreateVoiceQueueReport']=function(_0x188bcd){var _0x1c17b6=this;return new Promise(function(_0x283650,_0x91a3c1){return db[_0x158a('0x1a')][_0x158a('0x23')](_0x188bcd['body'],{'raw':_0x188bcd['options']?_0x188bcd[_0x158a('0x1c')][_0x158a('0x1d')]===undefined?!![]:![]:!![]})[_0x158a('0xe')](function(_0x3397c8){logger[_0x158a('0xf')](_0x158a('0x24'),_0x188bcd);logger[_0x158a('0x12')](_0x158a('0x24'),_0x188bcd,JSON[_0x158a('0x14')](_0x3397c8));_0x283650(_0x3397c8);})[_0x158a('0x18')](function(_0xb4338){logger[_0x158a('0x15')]('CreateVoiceQueueReport',_0xb4338['message'],_0x188bcd);_0x91a3c1(_0x1c17b6[_0x158a('0x15')](0x1f4,_0xb4338[_0x158a('0x17')]));});});};exports[_0x158a('0x25')]=function(_0x203880){var _0x27d216=this;return new Promise(function(_0x1778e5,_0x4423f1){return db[_0x158a('0x1a')]['update'](_0x203880[_0x158a('0x26')],{'raw':_0x203880[_0x158a('0x1c')]?_0x203880[_0x158a('0x1c')][_0x158a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x203880[_0x158a('0x1c')]?_0x203880[_0x158a('0x1c')][_0x158a('0x27')]||null:null,'attributes':_0x203880[_0x158a('0x1c')]?_0x203880['options'][_0x158a('0x1e')]||null:null,'limit':_0x203880[_0x158a('0x1c')]?_0x203880[_0x158a('0x1c')]['limit']||null:null})[_0x158a('0xe')](function(_0x534ed3){logger[_0x158a('0xf')](_0x158a('0x25'),_0x203880);logger['debug'](_0x158a('0x25'),_0x203880,JSON[_0x158a('0x14')](_0x534ed3));_0x1778e5(_0x534ed3);})[_0x158a('0x18')](function(_0x51077b){logger[_0x158a('0x15')]('UpdateVoiceQueueReport',_0x51077b[_0x158a('0x17')],_0x203880);_0x4423f1(_0x27d216[_0x158a('0x15')](0x1f4,_0x51077b[_0x158a('0x17')]));});});}; \ No newline at end of file +var _0xd779=['then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','update','body','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xd779,0xd3));var _0x9d77=function(_0x3d4c6e,_0x2c412c){_0x3d4c6e=_0x3d4c6e-0x0;var _0x5bcc38=_0xd779[_0x3d4c6e];return _0x5bcc38;};'use strict';var _=require(_0x9d77('0x0'));var util=require(_0x9d77('0x1'));var moment=require(_0x9d77('0x2'));var BPromise=require(_0x9d77('0x3'));var rs=require(_0x9d77('0x4'));var fs=require('fs');var Redis=require(_0x9d77('0x5'));var db=require(_0x9d77('0x6'))['db'];var utils=require(_0x9d77('0x7'));var logger=require(_0x9d77('0x8'))('rpc');var config=require(_0x9d77('0x9'));var jayson=require(_0x9d77('0xa'));var client=jayson['client'][_0x9d77('0xb')]({'port':0x232a});config[_0x9d77('0xc')]=_[_0x9d77('0xd')](config[_0x9d77('0xc')],{'host':_0x9d77('0xe'),'port':0x18eb});var socket=require(_0x9d77('0xf'))(new Redis(config[_0x9d77('0xc')]));require(_0x9d77('0x10'))[_0x9d77('0x11')](socket);function respondWithRpcPromise(_0x7552cd,_0x151f8b,_0x242072){return new BPromise(function(_0x1056c0,_0x43eed8){return client[_0x9d77('0x12')](_0x7552cd,_0x242072)[_0x9d77('0x13')](function(_0x12c189){logger[_0x9d77('0x14')](_0x9d77('0x15'),_0x151f8b,_0x9d77('0x16'));logger[_0x9d77('0x17')](_0x9d77('0x18'),_0x151f8b,_0x9d77('0x16'),JSON[_0x9d77('0x19')](_0x12c189));if(_0x12c189[_0x9d77('0x1a')]){if(_0x12c189[_0x9d77('0x1a')][_0x9d77('0x1b')]===0x1f4){logger['error'](_0x9d77('0x15'),_0x151f8b,_0x12c189[_0x9d77('0x1a')][_0x9d77('0x1c')]);return _0x43eed8(_0x12c189['error']['message']);}logger[_0x9d77('0x1a')](_0x9d77('0x15'),_0x151f8b,_0x12c189[_0x9d77('0x1a')][_0x9d77('0x1c')]);return _0x1056c0(_0x12c189[_0x9d77('0x1a')]['message']);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x151f8b,_0x9d77('0x16'));_0x1056c0(_0x12c189['result'][_0x9d77('0x1c')]);}})[_0x9d77('0x1d')](function(_0x2183be){logger[_0x9d77('0x1a')]('VoiceQueueReport,\x20%s,\x20%s',_0x151f8b,_0x2183be);_0x43eed8(_0x2183be);});});}exports['GetVoiceQueueReport']=function(_0x3302b6){var _0x2a8ad0=this;return new Promise(function(_0x291a75,_0x4e55e8){return db[_0x9d77('0x1e')][_0x9d77('0x1f')]({'raw':_0x3302b6['options']?_0x3302b6[_0x9d77('0x20')][_0x9d77('0x21')]===undefined?!![]:![]:!![],'where':_0x3302b6[_0x9d77('0x20')]?_0x3302b6[_0x9d77('0x20')][_0x9d77('0x22')]||null:null,'attributes':_0x3302b6[_0x9d77('0x20')]?_0x3302b6[_0x9d77('0x20')][_0x9d77('0x23')]||null:null,'limit':_0x3302b6[_0x9d77('0x20')]?_0x3302b6[_0x9d77('0x20')][_0x9d77('0x24')]||null:null,'include':_0x3302b6[_0x9d77('0x20')]?_0x3302b6[_0x9d77('0x20')][_0x9d77('0x25')]?_[_0x9d77('0x26')](_0x3302b6[_0x9d77('0x20')][_0x9d77('0x25')],function(_0x295348){return{'model':db[_0x295348[_0x9d77('0x27')]],'as':_0x295348['as'],'attributes':_0x295348[_0x9d77('0x23')],'include':_0x295348[_0x9d77('0x25')]?_[_0x9d77('0x26')](_0x295348[_0x9d77('0x25')],function(_0x2b9cdb){return{'model':db[_0x2b9cdb['model']],'as':_0x2b9cdb['as'],'attributes':_0x2b9cdb[_0x9d77('0x23')],'include':_0x2b9cdb['include']?_[_0x9d77('0x26')](_0x2b9cdb['include'],function(_0x44fa60){return{'model':db[_0x44fa60[_0x9d77('0x27')]],'as':_0x44fa60['as'],'attributes':_0x44fa60['attributes']};}):[]};}):[]};}):[]:[]})[_0x9d77('0x13')](function(_0x2cdf4c){logger['info'](_0x9d77('0x28'),_0x3302b6);logger['debug'](_0x9d77('0x28'),_0x3302b6,JSON[_0x9d77('0x19')](_0x2cdf4c));_0x291a75(_0x2cdf4c);})[_0x9d77('0x1d')](function(_0x33c3cf){logger[_0x9d77('0x1a')]('GetVoiceQueueReport',_0x33c3cf[_0x9d77('0x1c')],_0x3302b6);_0x4e55e8(_0x2a8ad0['error'](0x1f4,_0x33c3cf[_0x9d77('0x1c')]));});});};exports[_0x9d77('0x29')]=function(_0x1e3841){var _0x492b7d=this;return new Promise(function(_0x3914cf,_0x19f8d9){return db['VoiceQueueReport'][_0x9d77('0x2a')](_0x1e3841['body'],{'raw':_0x1e3841[_0x9d77('0x20')]?_0x1e3841['options'][_0x9d77('0x21')]===undefined?!![]:![]:!![]})[_0x9d77('0x13')](function(_0x4749d1){logger[_0x9d77('0x14')](_0x9d77('0x29'),_0x1e3841);logger['debug'](_0x9d77('0x29'),_0x1e3841,JSON['stringify'](_0x4749d1));_0x3914cf(_0x4749d1);})[_0x9d77('0x1d')](function(_0x90ea32){logger[_0x9d77('0x1a')]('CreateVoiceQueueReport',_0x90ea32[_0x9d77('0x1c')],_0x1e3841);_0x19f8d9(_0x492b7d['error'](0x1f4,_0x90ea32[_0x9d77('0x1c')]));});});};exports[_0x9d77('0x2b')]=function(_0x3a335c){var _0x10d515=this;return new Promise(function(_0x5437af,_0x1b31bd){return db[_0x9d77('0x1e')][_0x9d77('0x2c')](_0x3a335c[_0x9d77('0x2d')],{'raw':_0x3a335c[_0x9d77('0x20')]?_0x3a335c[_0x9d77('0x20')][_0x9d77('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a335c[_0x9d77('0x20')]?_0x3a335c[_0x9d77('0x20')][_0x9d77('0x22')]||null:null,'attributes':_0x3a335c[_0x9d77('0x20')]?_0x3a335c[_0x9d77('0x20')][_0x9d77('0x23')]||null:null,'limit':_0x3a335c[_0x9d77('0x20')]?_0x3a335c['options'][_0x9d77('0x24')]||null:null})[_0x9d77('0x13')](function(_0x5b750e){logger[_0x9d77('0x14')](_0x9d77('0x2b'),_0x3a335c);logger['debug'](_0x9d77('0x2b'),_0x3a335c,JSON[_0x9d77('0x19')](_0x5b750e));_0x5437af(_0x5b750e);})[_0x9d77('0x1d')](function(_0x54e4dc){logger[_0x9d77('0x1a')](_0x9d77('0x2b'),_0x54e4dc[_0x9d77('0x1c')],_0x3a335c);_0x1b31bd(_0x10d515[_0x9d77('0x1a')](0x1f4,_0x54e4dc[_0x9d77('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 80e21c8..df64b3e 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 _0xb479=['removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x23d68e,_0x16d36d){var _0x2bbae1=function(_0x25db66){while(--_0x25db66){_0x23d68e['push'](_0x23d68e['shift']());}};_0x2bbae1(++_0x16d36d);}(_0xb479,0x176));var _0x9b47=function(_0x3e9a88,_0x4a57b4){_0x3e9a88=_0x3e9a88-0x0;var _0x38a7db=_0xb479[_0x3e9a88];return _0x38a7db;};'use strict';var VoiceQueueReportEvents=require(_0x9b47('0x0'));var events=[_0x9b47('0x1'),_0x9b47('0x2'),_0x9b47('0x3')];function createListener(_0x5b2637,_0x310f2d){return function(_0x4d4966){_0x310f2d['emit'](_0x5b2637,_0x4d4966);};}function removeListener(_0xb974df,_0x404cf9){return function(){VoiceQueueReportEvents[_0x9b47('0x4')](_0xb974df,_0x404cf9);};}exports['register']=function(_0x212c0e){for(var _0x58b268=0x0,_0x252e95=events[_0x9b47('0x5')];_0x58b268<_0x252e95;_0x58b268++){var _0x2444ca=events[_0x58b268];var _0x5732d2=createListener(_0x9b47('0x6')+_0x2444ca,_0x212c0e);VoiceQueueReportEvents['on'](_0x2444ca,_0x5732d2);}}; \ No newline at end of file +var _0x4dbd=['update','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x441025,_0x211099){var _0x3c7906=function(_0x3be6cb){while(--_0x3be6cb){_0x441025['push'](_0x441025['shift']());}};_0x3c7906(++_0x211099);}(_0x4dbd,0xf5));var _0xd4db=function(_0x2a2a68,_0x22688a){_0x2a2a68=_0x2a2a68-0x0;var _0x572ef8=_0x4dbd[_0x2a2a68];return _0x572ef8;};'use strict';var VoiceQueueReportEvents=require(_0xd4db('0x0'));var events=[_0xd4db('0x1'),_0xd4db('0x2'),_0xd4db('0x3')];function createListener(_0x45f285,_0x3d2b44){return function(_0x29cc76){_0x3d2b44['emit'](_0x45f285,_0x29cc76);};}function removeListener(_0x4bdc48,_0x65253f){return function(){VoiceQueueReportEvents[_0xd4db('0x4')](_0x4bdc48,_0x65253f);};}exports[_0xd4db('0x5')]=function(_0x33ce8a){for(var _0x2adf53=0x0,_0x55f9d2=events[_0xd4db('0x6')];_0x2adf53<_0x55f9d2;_0x2adf53++){var _0x52d005=events[_0x2adf53];var _0x49d2a1=createListener(_0xd4db('0x7')+_0x52d005,_0x33ce8a);VoiceQueueReportEvents['on'](_0x52d005,_0x49d2a1);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index dbe42f5..edad414 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 _0x2d7a=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x51e731,_0x22d23b){var _0x241323=function(_0x519965){while(--_0x519965){_0x51e731['push'](_0x51e731['shift']());}};_0x241323(++_0x22d23b);}(_0x2d7a,0x103));var _0xa2d7=function(_0x211c4d,_0xf66ff){_0x211c4d=_0x211c4d-0x0;var _0x314443=_0x2d7a[_0x211c4d];return _0x314443;};'use strict';var multer=require(_0xa2d7('0x0'));var util=require(_0xa2d7('0x1'));var path=require(_0xa2d7('0x2'));var timeout=require(_0xa2d7('0x3'));var express=require(_0xa2d7('0x4'));var router=express[_0xa2d7('0x5')]();var auth=require(_0xa2d7('0x6'));var interaction=require(_0xa2d7('0x7'));var config=require(_0xa2d7('0x8'));var controller=require(_0xa2d7('0x9'));router[_0xa2d7('0xa')]('/',auth[_0xa2d7('0xb')](),controller['index']);router[_0xa2d7('0xa')](_0xa2d7('0xc'),auth[_0xa2d7('0xb')](),controller[_0xa2d7('0xd')]);router[_0xa2d7('0xe')]('/',auth['isAuthenticated'](),controller[_0xa2d7('0xf')]);router[_0xa2d7('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa2d7('0x11')]);router[_0xa2d7('0x12')](_0xa2d7('0xc'),auth[_0xa2d7('0xb')](),controller[_0xa2d7('0x13')]);module['exports']=router; \ No newline at end of file +var _0x9cd6=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x1cc961,_0x2c42ee){var _0x471d86=function(_0x44e422){while(--_0x44e422){_0x1cc961['push'](_0x1cc961['shift']());}};_0x471d86(++_0x2c42ee);}(_0x9cd6,0x156));var _0x69cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9cd6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x69cd('0x0'));var util=require(_0x69cd('0x1'));var path=require(_0x69cd('0x2'));var timeout=require(_0x69cd('0x3'));var express=require('express');var router=express[_0x69cd('0x4')]();var auth=require(_0x69cd('0x5'));var interaction=require(_0x69cd('0x6'));var config=require(_0x69cd('0x7'));var controller=require(_0x69cd('0x8'));router[_0x69cd('0x9')]('/',auth[_0x69cd('0xa')](),controller['index']);router[_0x69cd('0x9')](_0x69cd('0xb'),auth[_0x69cd('0xa')](),controller[_0x69cd('0xc')]);router[_0x69cd('0xd')]('/',auth[_0x69cd('0xa')](),controller[_0x69cd('0xe')]);router['put'](_0x69cd('0xb'),auth[_0x69cd('0xa')](),controller[_0x69cd('0xf')]);router[_0x69cd('0x10')](_0x69cd('0xb'),auth['isAuthenticated'](),controller[_0x69cd('0x11')]);module[_0x69cd('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 35e0621..9759e7a 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 _0x6fd2=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6fd2,0xe3));var _0x26fd=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x6fd2[_0x32d457];return _0x338386;};'use strict';var Sequelize=require(_0x26fd('0x0'));var moment=require(_0x26fd('0x1'));module['exports']={'time':{'type':Sequelize[_0x26fd('0x2')]},'callid':{'type':Sequelize[_0x26fd('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x26fd('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x26fd('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x26fd('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x26fd('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x26fd('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x26fd('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x26fd('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x26fd('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x26fd('0x3')](_0x26fd('0x4'))}}; \ No newline at end of file +var _0x9e7a=['sequelize','moment','STRING','DATE','format'];(function(_0x312b06,_0x5ad05e){var _0x54dd60=function(_0x837599){while(--_0x837599){_0x312b06['push'](_0x312b06['shift']());}};_0x54dd60(++_0x5ad05e);}(_0x9e7a,0x1db));var _0xa9e7=function(_0x39a182,_0x2324fb){_0x39a182=_0x39a182-0x0;var _0x4a0275=_0x9e7a[_0x39a182];return _0x4a0275;};'use strict';var Sequelize=require(_0xa9e7('0x0'));var moment=require(_0xa9e7('0x1'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xa9e7('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa9e7('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa9e7('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa9e7('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa9e7('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa9e7('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa9e7('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa9e7('0x3')],'allowNull':![],'defaultValue':moment()[_0xa9e7('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 204d524..17fceda 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 _0x4cf8=['query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','filtears','include','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model'];(function(_0x20ebe9,_0x1c3ffb){var _0x32aa96=function(_0x451f32){while(--_0x451f32){_0x20ebe9['push'](_0x20ebe9['shift']());}};_0x32aa96(++_0x1c3ffb);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x77773a,_0x5a7026){_0x77773a=_0x77773a-0x0;var _0x1091a2=_0x4cf8[_0x77773a];return _0x1091a2;};'use strict';var pdf=require(_0x84cf('0x0'));var emlformat=require(_0x84cf('0x1'));var rimraf=require(_0x84cf('0x2'));var zipdir=require(_0x84cf('0x3'));var jsonpatch=require(_0x84cf('0x4'));var rp=require(_0x84cf('0x5'));var moment=require(_0x84cf('0x6'));var BPromise=require(_0x84cf('0x7'));var Mustache=require(_0x84cf('0x8'));var util=require(_0x84cf('0x9'));var path=require(_0x84cf('0xa'));var sox=require(_0x84cf('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x84cf('0xc'));var squel=require('squel');var crypto=require(_0x84cf('0xd'));var jsforce=require(_0x84cf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x84cf('0xf'));var querystring=require(_0x84cf('0x10'));var Papa=require('papaparse');var Redis=require(_0x84cf('0x11'));var authService=require(_0x84cf('0x12'));var qs=require(_0x84cf('0x13'));var as=require(_0x84cf('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84cf('0x15'))(_0x84cf('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x84cf('0x17'));var db=require(_0x84cf('0x18'))['db'];function respondWithStatusCode(_0x35f852,_0x33f83e){_0x33f83e=_0x33f83e||0xcc;return function(_0x172d04){if(_0x172d04){return _0x35f852[_0x84cf('0x19')](_0x33f83e);}return _0x35f852[_0x84cf('0x1a')](_0x33f83e)[_0x84cf('0x1b')]();};}function respondWithResult(_0xced48,_0x250a19){_0x250a19=_0x250a19||0xc8;return function(_0x2fc41f){if(_0x2fc41f){return _0xced48[_0x84cf('0x1a')](_0x250a19)[_0x84cf('0x1c')](_0x2fc41f);}};}function respondWithFilteredResult(_0x20e79c,_0x27261b){return function(_0x167c3e){if(_0x167c3e){var _0x464e70=_0x167c3e[_0x84cf('0x1d')],_0x240edf=_0x27261b[_0x84cf('0x1e')],_0xe12c7b=_0x27261b[_0x84cf('0x1e')]+_0x27261b[_0x84cf('0x1f')],_0x5b8ac8;if(_0xe12c7b>=_0x464e70){_0xe12c7b=_0x464e70;_0x5b8ac8=0xc8;}else{_0x5b8ac8=0xce;}_0x20e79c[_0x84cf('0x1a')](_0x5b8ac8);return _0x20e79c[_0x84cf('0x20')](_0x84cf('0x21'),_0x240edf+'-'+_0xe12c7b+'/'+_0x464e70)['json'](_0x167c3e);}return null;};}function patchUpdates(_0x4c5362){return function(_0x42d6d4){try{jsonpatch[_0x84cf('0x22')](_0x42d6d4,_0x4c5362,!![]);}catch(_0x346b43){return BPromise[_0x84cf('0x23')](_0x346b43);}return _0x42d6d4[_0x84cf('0x24')]();};}function saveUpdates(_0x5dda3f,_0x39a37b){return function(_0x448b5d){if(_0x448b5d){return _0x448b5d[_0x84cf('0x25')](_0x5dda3f)[_0x84cf('0x26')](function(_0x1b082a){return _0x1b082a;});}return null;};}function removeEntity(_0x54405a,_0x42fa45){return function(_0x160f86){if(_0x160f86){return _0x160f86[_0x84cf('0x27')]()[_0x84cf('0x26')](function(){_0x54405a[_0x84cf('0x1a')](0xcc)[_0x84cf('0x1b')]();});}};}function handleEntityNotFound(_0x7feb4,_0x4c9d1c){return function(_0x2b2c90){if(!_0x2b2c90){_0x7feb4[_0x84cf('0x19')](0x194);}return _0x2b2c90;};}function handleError(_0x1c7747,_0x39326d){_0x39326d=_0x39326d||0x1f4;return function(_0x1d220a){logger[_0x84cf('0x28')](_0x1d220a[_0x84cf('0x29')]);if(_0x1d220a[_0x84cf('0x2a')]){delete _0x1d220a[_0x84cf('0x2a')];}_0x1c7747[_0x84cf('0x1a')](_0x39326d)['send'](_0x1d220a);};}exports[_0x84cf('0x2b')]=function(_0x17bc92,_0x2a4973){var _0x41a5db={},_0x58f07e={},_0x1595dd={'count':0x0,'rows':[]};var _0x5a428c=_[_0x84cf('0x2c')](db[_0x84cf('0x2d')][_0x84cf('0x2e')],function(_0xc15298){return{'name':_0xc15298[_0x84cf('0x2f')],'type':_0xc15298[_0x84cf('0x30')][_0x84cf('0x31')]};});_0x58f07e[_0x84cf('0x32')]=_[_0x84cf('0x2c')](_0x5a428c,_0x84cf('0x2a'));_0x58f07e[_0x84cf('0x33')]=_[_0x84cf('0x34')](_0x17bc92[_0x84cf('0x33')]);_0x58f07e[_0x84cf('0x35')]=_['intersection'](_0x58f07e['model'],_0x58f07e[_0x84cf('0x33')]);_0x41a5db[_0x84cf('0x36')]=_[_0x84cf('0x37')](_0x58f07e[_0x84cf('0x32')],qs[_0x84cf('0x38')](_0x17bc92[_0x84cf('0x33')][_0x84cf('0x38')]));_0x41a5db[_0x84cf('0x36')]=_0x41a5db['attributes'][_0x84cf('0x39')]?_0x41a5db[_0x84cf('0x36')]:_0x58f07e['model'];if(!_0x17bc92[_0x84cf('0x33')]['hasOwnProperty'](_0x84cf('0x3a'))){_0x41a5db[_0x84cf('0x1f')]=qs[_0x84cf('0x1f')](_0x17bc92[_0x84cf('0x33')][_0x84cf('0x1f')]);_0x41a5db['offset']=qs[_0x84cf('0x1e')](_0x17bc92['query']['offset']);}_0x41a5db[_0x84cf('0x3b')]=qs[_0x84cf('0x3c')](_0x17bc92['query'][_0x84cf('0x3c')]);_0x41a5db[_0x84cf('0x3d')]=qs[_0x84cf('0x35')](_[_0x84cf('0x3e')](_0x17bc92[_0x84cf('0x33')],_0x58f07e[_0x84cf('0x35')]),_0x5a428c);if(_0x17bc92['query'][_0x84cf('0x3f')]){_0x41a5db[_0x84cf('0x3d')]=_[_0x84cf('0x40')](_0x41a5db[_0x84cf('0x3d')],{'$or':_[_0x84cf('0x2c')](_0x5a428c,function(_0x2a8992){if(_0x2a8992['type']!==_0x84cf('0x41')){var _0x4a9be3={};_0x4a9be3[_0x2a8992[_0x84cf('0x2a')]]={'$like':'%'+_0x17bc92[_0x84cf('0x33')][_0x84cf('0x3f')]+'%'};return _0x4a9be3;}})});}_0x41a5db=_[_0x84cf('0x40')]({},_0x41a5db,_0x17bc92[_0x84cf('0x42')]);var _0x3897b0={'where':_0x41a5db[_0x84cf('0x3d')]};return db[_0x84cf('0x2d')][_0x84cf('0x1d')](_0x3897b0)['then'](function(_0x44e6f0){_0x1595dd['count']=_0x44e6f0;if(_0x17bc92[_0x84cf('0x33')][_0x84cf('0x43')]){_0x41a5db['include']=[{'all':!![]}];}return db[_0x84cf('0x2d')]['findAll'](_0x41a5db);})[_0x84cf('0x26')](function(_0x504d32){_0x1595dd[_0x84cf('0x44')]=_0x504d32;return _0x1595dd;})['then'](respondWithFilteredResult(_0x2a4973,_0x41a5db))[_0x84cf('0x45')](handleError(_0x2a4973,null));};exports[_0x84cf('0x46')]=function(_0x48f1b9,_0x847ce9){var _0x426ddb={'raw':!![],'where':{'id':_0x48f1b9['params']['id']}},_0x33b242={};_0x33b242[_0x84cf('0x32')]=_['keys'](db[_0x84cf('0x2d')]['rawAttributes']);_0x33b242['query']=_['keys'](_0x48f1b9[_0x84cf('0x33')]);_0x33b242[_0x84cf('0x47')]=_['intersection'](_0x33b242[_0x84cf('0x32')],_0x33b242['query']);_0x426ddb[_0x84cf('0x36')]=_[_0x84cf('0x37')](_0x33b242['model'],qs[_0x84cf('0x38')](_0x48f1b9['query'][_0x84cf('0x38')]));_0x426ddb['attributes']=_0x426ddb['attributes']['length']?_0x426ddb['attributes']:_0x33b242['model'];if(_0x48f1b9['query']['includeAll']){_0x426ddb[_0x84cf('0x48')]=[{'all':!![]}];}_0x426ddb=_[_0x84cf('0x40')]({},_0x426ddb,_0x48f1b9[_0x84cf('0x42')]);return db[_0x84cf('0x2d')]['find'](_0x426ddb)[_0x84cf('0x26')](handleEntityNotFound(_0x847ce9,null))['then'](respondWithResult(_0x847ce9,null))[_0x84cf('0x45')](handleError(_0x847ce9,null));};exports[_0x84cf('0x49')]=function(_0x1533a7,_0x253464){return db[_0x84cf('0x2d')][_0x84cf('0x49')](_0x1533a7['body'],{})[_0x84cf('0x26')](respondWithResult(_0x253464,0xc9))[_0x84cf('0x45')](handleError(_0x253464,null));};exports['update']=function(_0xb2b8ae,_0x3fe7ef){if(_0xb2b8ae[_0x84cf('0x4a')]['id']){delete _0xb2b8ae['body']['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0xb2b8ae[_0x84cf('0x4b')]['id']}})[_0x84cf('0x26')](handleEntityNotFound(_0x3fe7ef,null))[_0x84cf('0x26')](saveUpdates(_0xb2b8ae[_0x84cf('0x4a')],null))[_0x84cf('0x26')](respondWithResult(_0x3fe7ef,null))[_0x84cf('0x45')](handleError(_0x3fe7ef,null));};exports['destroy']=function(_0x350985,_0x55316e){return db[_0x84cf('0x2d')]['find']({'where':{'id':_0x350985['params']['id']}})[_0x84cf('0x26')](handleEntityNotFound(_0x55316e,null))[_0x84cf('0x26')](removeEntity(_0x55316e,null))[_0x84cf('0x45')](handleError(_0x55316e,null));}; \ No newline at end of file +var _0x34b7=['stack','name','send','index','map','VoiceQueuesLog','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','catch','include','create','body','find','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','end','error'];(function(_0x5232b2,_0x28d544){var _0x403926=function(_0x207fe8){while(--_0x207fe8){_0x5232b2['push'](_0x5232b2['shift']());}};_0x403926(++_0x28d544);}(_0x34b7,0x196));var _0x734b=function(_0x59dc02,_0x120477){_0x59dc02=_0x59dc02-0x0;var _0x556178=_0x34b7[_0x59dc02];return _0x556178;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x734b('0x0'));var zipdir=require(_0x734b('0x1'));var jsonpatch=require(_0x734b('0x2'));var rp=require(_0x734b('0x3'));var moment=require(_0x734b('0x4'));var BPromise=require(_0x734b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x734b('0x6'));var sox=require(_0x734b('0x7'));var csv=require(_0x734b('0x8'));var ejs=require(_0x734b('0x9'));var fs=require('fs');var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];function respondWithStatusCode(_0x1e0fca,_0x189a82){_0x189a82=_0x189a82||0xcc;return function(_0xff9ddf){if(_0xff9ddf){return _0x1e0fca[_0x734b('0x18')](_0x189a82);}return _0x1e0fca[_0x734b('0x19')](_0x189a82)['end']();};}function respondWithResult(_0x18fc18,_0x252510){_0x252510=_0x252510||0xc8;return function(_0x47791c){if(_0x47791c){return _0x18fc18[_0x734b('0x19')](_0x252510)[_0x734b('0x1a')](_0x47791c);}};}function respondWithFilteredResult(_0x2e00ad,_0x2372bd){return function(_0x2c03bd){if(_0x2c03bd){var _0xa6d111=_0x2c03bd[_0x734b('0x1b')],_0x4b8c63=_0x2372bd[_0x734b('0x1c')],_0x42407a=_0x2372bd[_0x734b('0x1c')]+_0x2372bd[_0x734b('0x1d')],_0x4d2d23;if(_0x42407a>=_0xa6d111){_0x42407a=_0xa6d111;_0x4d2d23=0xc8;}else{_0x4d2d23=0xce;}_0x2e00ad['status'](_0x4d2d23);return _0x2e00ad['set'](_0x734b('0x1e'),_0x4b8c63+'-'+_0x42407a+'/'+_0xa6d111)[_0x734b('0x1a')](_0x2c03bd);}return null;};}function patchUpdates(_0x1e6ed9){return function(_0x41ba87){try{jsonpatch[_0x734b('0x1f')](_0x41ba87,_0x1e6ed9,!![]);}catch(_0xfe567d){return BPromise[_0x734b('0x20')](_0xfe567d);}return _0x41ba87[_0x734b('0x21')]();};}function saveUpdates(_0x67eed,_0x1d2b27){return function(_0x7060f8){if(_0x7060f8){return _0x7060f8[_0x734b('0x22')](_0x67eed)[_0x734b('0x23')](function(_0x19fc51){return _0x19fc51;});}return null;};}function removeEntity(_0x56f807,_0x1e4dcc){return function(_0x7856d7){if(_0x7856d7){return _0x7856d7['destroy']()[_0x734b('0x23')](function(){_0x56f807[_0x734b('0x19')](0xcc)[_0x734b('0x24')]();});}};}function handleEntityNotFound(_0x11fb8e,_0x46d432){return function(_0x26d118){if(!_0x26d118){_0x11fb8e[_0x734b('0x18')](0x194);}return _0x26d118;};}function handleError(_0x104fff,_0x144328){_0x144328=_0x144328||0x1f4;return function(_0x3abbe6){logger[_0x734b('0x25')](_0x3abbe6[_0x734b('0x26')]);if(_0x3abbe6[_0x734b('0x27')]){delete _0x3abbe6['name'];}_0x104fff['status'](_0x144328)[_0x734b('0x28')](_0x3abbe6);};}exports[_0x734b('0x29')]=function(_0x47a0a9,_0x32ea00){var _0x2dd51a={},_0x1d8e51={},_0x41b501={'count':0x0,'rows':[]};var _0x43edea=_[_0x734b('0x2a')](db[_0x734b('0x2b')]['rawAttributes'],function(_0x1f3652){return{'name':_0x1f3652[_0x734b('0x2c')],'type':_0x1f3652[_0x734b('0x2d')][_0x734b('0x2e')]};});_0x1d8e51[_0x734b('0x2f')]=_[_0x734b('0x2a')](_0x43edea,_0x734b('0x27'));_0x1d8e51[_0x734b('0x30')]=_[_0x734b('0x31')](_0x47a0a9[_0x734b('0x30')]);_0x1d8e51['filters']=_[_0x734b('0x32')](_0x1d8e51[_0x734b('0x2f')],_0x1d8e51['query']);_0x2dd51a[_0x734b('0x33')]=_[_0x734b('0x32')](_0x1d8e51[_0x734b('0x2f')],qs[_0x734b('0x34')](_0x47a0a9[_0x734b('0x30')][_0x734b('0x34')]));_0x2dd51a[_0x734b('0x33')]=_0x2dd51a[_0x734b('0x33')][_0x734b('0x35')]?_0x2dd51a[_0x734b('0x33')]:_0x1d8e51[_0x734b('0x2f')];if(!_0x47a0a9[_0x734b('0x30')][_0x734b('0x36')](_0x734b('0x37'))){_0x2dd51a[_0x734b('0x1d')]=qs['limit'](_0x47a0a9[_0x734b('0x30')]['limit']);_0x2dd51a[_0x734b('0x1c')]=qs[_0x734b('0x1c')](_0x47a0a9[_0x734b('0x30')][_0x734b('0x1c')]);}_0x2dd51a[_0x734b('0x38')]=qs[_0x734b('0x39')](_0x47a0a9['query']['sort']);_0x2dd51a[_0x734b('0x3a')]=qs['filters'](_[_0x734b('0x3b')](_0x47a0a9['query'],_0x1d8e51[_0x734b('0x3c')]),_0x43edea);if(_0x47a0a9['query'][_0x734b('0x3d')]){_0x2dd51a['where']=_[_0x734b('0x3e')](_0x2dd51a[_0x734b('0x3a')],{'$or':_[_0x734b('0x2a')](_0x43edea,function(_0x34a504){if(_0x34a504[_0x734b('0x2d')]!==_0x734b('0x3f')){var _0x1e3632={};_0x1e3632[_0x34a504['name']]={'$like':'%'+_0x47a0a9[_0x734b('0x30')][_0x734b('0x3d')]+'%'};return _0x1e3632;}})});}_0x2dd51a=_['merge']({},_0x2dd51a,_0x47a0a9[_0x734b('0x40')]);var _0x309b31={'where':_0x2dd51a[_0x734b('0x3a')]};return db[_0x734b('0x2b')]['count'](_0x309b31)[_0x734b('0x23')](function(_0x352d28){_0x41b501['count']=_0x352d28;if(_0x47a0a9[_0x734b('0x30')][_0x734b('0x41')]){_0x2dd51a['include']=[{'all':!![]}];}return db[_0x734b('0x2b')][_0x734b('0x42')](_0x2dd51a);})[_0x734b('0x23')](function(_0x300aaa){_0x41b501['rows']=_0x300aaa;return _0x41b501;})['then'](respondWithFilteredResult(_0x32ea00,_0x2dd51a))[_0x734b('0x43')](handleError(_0x32ea00,null));};exports['show']=function(_0x564ad9,_0x121a00){var _0x50bde2={'raw':!![],'where':{'id':_0x564ad9['params']['id']}},_0x3f44e8={};_0x3f44e8[_0x734b('0x2f')]=_[_0x734b('0x31')](db[_0x734b('0x2b')]['rawAttributes']);_0x3f44e8['query']=_[_0x734b('0x31')](_0x564ad9['query']);_0x3f44e8['filtears']=_[_0x734b('0x32')](_0x3f44e8[_0x734b('0x2f')],_0x3f44e8['query']);_0x50bde2[_0x734b('0x33')]=_['intersection'](_0x3f44e8[_0x734b('0x2f')],qs[_0x734b('0x34')](_0x564ad9[_0x734b('0x30')]['fields']));_0x50bde2[_0x734b('0x33')]=_0x50bde2[_0x734b('0x33')][_0x734b('0x35')]?_0x50bde2[_0x734b('0x33')]:_0x3f44e8['model'];if(_0x564ad9['query']['includeAll']){_0x50bde2[_0x734b('0x44')]=[{'all':!![]}];}_0x50bde2=_['merge']({},_0x50bde2,_0x564ad9['options']);return db[_0x734b('0x2b')]['find'](_0x50bde2)[_0x734b('0x23')](handleEntityNotFound(_0x121a00,null))[_0x734b('0x23')](respondWithResult(_0x121a00,null))[_0x734b('0x43')](handleError(_0x121a00,null));};exports[_0x734b('0x45')]=function(_0x5befde,_0x2c253b){return db['VoiceQueuesLog'][_0x734b('0x45')](_0x5befde[_0x734b('0x46')],{})[_0x734b('0x23')](respondWithResult(_0x2c253b,0xc9))['catch'](handleError(_0x2c253b,null));};exports[_0x734b('0x22')]=function(_0x4c3efb,_0x357ae4){if(_0x4c3efb[_0x734b('0x46')]['id']){delete _0x4c3efb['body']['id'];}return db[_0x734b('0x2b')][_0x734b('0x47')]({'where':{'id':_0x4c3efb[_0x734b('0x48')]['id']}})[_0x734b('0x23')](handleEntityNotFound(_0x357ae4,null))[_0x734b('0x23')](saveUpdates(_0x4c3efb['body'],null))[_0x734b('0x23')](respondWithResult(_0x357ae4,null))['catch'](handleError(_0x357ae4,null));};exports[_0x734b('0x49')]=function(_0x5de7b7,_0xd3c688){return db[_0x734b('0x2b')][_0x734b('0x47')]({'where':{'id':_0x5de7b7[_0x734b('0x48')]['id']}})[_0x734b('0x23')](handleEntityNotFound(_0xd3c688,null))['then'](removeEntity(_0xd3c688,null))['catch'](handleError(_0xd3c688,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index f029198..7204509 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 _0xbaa5=['api','moment','bluebird','rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','../../config/logger'];(function(_0x188c60,_0x1d0d8f){var _0x580a07=function(_0x5679d0){while(--_0x5679d0){_0x188c60['push'](_0x188c60['shift']());}};_0x580a07(++_0x1d0d8f);}(_0xbaa5,0x1e8));var _0x5baa=function(_0x3a8b95,_0x171d39){_0x3a8b95=_0x3a8b95-0x0;var _0x23a616=_0xbaa5[_0x3a8b95];return _0x23a616;};'use strict';var _=require(_0x5baa('0x0'));var util=require('util');var logger=require(_0x5baa('0x1'))(_0x5baa('0x2'));var moment=require(_0x5baa('0x3'));var BPromise=require(_0x5baa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5baa('0x5'));var config=require(_0x5baa('0x6'));var attributes=require('./voiceQueuesLog.attributes');module[_0x5baa('0x7')]=function(_0xff6598,_0xf6cec0){return _0xff6598[_0x5baa('0x8')](_0x5baa('0x9'),attributes,{'tableName':_0x5baa('0xa'),'paranoid':![],'indexes':[{'name':_0x5baa('0xb'),'fields':[_0x5baa('0xc'),_0x5baa('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4b91=['lodash','util','api','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','event'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b91,0xf7));var _0x14b9=function(_0x34efe5,_0x26be46){_0x34efe5=_0x34efe5-0x0;var _0x3d5783=_0x4b91[_0x34efe5];return _0x3d5783;};'use strict';var _=require(_0x14b9('0x0'));var util=require(_0x14b9('0x1'));var logger=require('../../config/logger')(_0x14b9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x14b9('0x3'));var fs=require('fs');var path=require(_0x14b9('0x4'));var rimraf=require(_0x14b9('0x5'));var config=require(_0x14b9('0x6'));var attributes=require(_0x14b9('0x7'));module[_0x14b9('0x8')]=function(_0xa5ec33,_0x267c69){return _0xa5ec33[_0x14b9('0x9')](_0x14b9('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x14b9('0xb'),'fields':[_0x14b9('0xc'),'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 d910b33..e5ae6c9 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 _0xe493=['../../config/utils','rpc','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x4e38c7,_0x467ab3){var _0x445dd6=function(_0x36f06a){while(--_0x36f06a){_0x4e38c7['push'](_0x4e38c7['shift']());}};_0x445dd6(++_0x467ab3);}(_0xe493,0x7e));var _0x3e49=function(_0x2478b8,_0x306a92){_0x2478b8=_0x2478b8-0x0;var _0xbb83bc=_0xe493[_0x2478b8];return _0xbb83bc;};'use strict';var _=require(_0x3e49('0x0'));var util=require(_0x3e49('0x1'));var moment=require(_0x3e49('0x2'));var BPromise=require(_0x3e49('0x3'));var rs=require(_0x3e49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e49('0x5'))['db'];var utils=require(_0x3e49('0x6'));var logger=require('../../config/logger')(_0x3e49('0x7'));var config=require('../../config/environment');var jayson=require(_0x3e49('0x8'));var client=jayson[_0x3e49('0x9')][_0x3e49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f7821,_0x12dd84,_0x3626b6){return new BPromise(function(_0x4e96ac,_0x56b767){return client['request'](_0x3f7821,_0x3626b6)[_0x3e49('0xb')](function(_0x8b8c0e){logger[_0x3e49('0xc')](_0x3e49('0xd'),_0x12dd84,_0x3e49('0xe'));logger[_0x3e49('0xf')](_0x3e49('0x10'),_0x12dd84,_0x3e49('0xe'),JSON[_0x3e49('0x11')](_0x8b8c0e));if(_0x8b8c0e[_0x3e49('0x12')]){if(_0x8b8c0e[_0x3e49('0x12')]['code']===0x1f4){logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x8b8c0e['error'][_0x3e49('0x13')]);return _0x56b767(_0x8b8c0e[_0x3e49('0x12')]['message']);}logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x8b8c0e['error'][_0x3e49('0x13')]);return _0x4e96ac(_0x8b8c0e[_0x3e49('0x12')][_0x3e49('0x13')]);}else{logger[_0x3e49('0xc')](_0x3e49('0xd'),_0x12dd84,_0x3e49('0xe'));_0x4e96ac(_0x8b8c0e[_0x3e49('0x14')][_0x3e49('0x13')]);}})[_0x3e49('0x15')](function(_0x1d9cce){logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x1d9cce);_0x56b767(_0x1d9cce);});});} \ No newline at end of file +var _0x574d=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5bf850,_0x5c6078){var _0x3b96a7=function(_0xe345eb){while(--_0xe345eb){_0x5bf850['push'](_0x5bf850['shift']());}};_0x3b96a7(++_0x5c6078);}(_0x574d,0xc0));var _0xd574=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x574d[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0xd574('0x0'));var util=require(_0xd574('0x1'));var moment=require(_0xd574('0x2'));var BPromise=require(_0xd574('0x3'));var rs=require(_0xd574('0x4'));var fs=require('fs');var Redis=require(_0xd574('0x5'));var db=require(_0xd574('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd574('0x7'))(_0xd574('0x8'));var config=require(_0xd574('0x9'));var jayson=require(_0xd574('0xa'));var client=jayson['client'][_0xd574('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13a566,_0x3ce54f,_0x1558b3){return new BPromise(function(_0x3a1e54,_0x20751c){return client['request'](_0x13a566,_0x1558b3)['then'](function(_0x4306f7){logger[_0xd574('0xc')](_0xd574('0xd'),_0x3ce54f,_0xd574('0xe'));logger[_0xd574('0xf')](_0xd574('0x10'),_0x3ce54f,_0xd574('0xe'),JSON['stringify'](_0x4306f7));if(_0x4306f7[_0xd574('0x11')]){if(_0x4306f7[_0xd574('0x11')][_0xd574('0x12')]===0x1f4){logger[_0xd574('0x11')](_0xd574('0xd'),_0x3ce54f,_0x4306f7[_0xd574('0x11')][_0xd574('0x13')]);return _0x20751c(_0x4306f7[_0xd574('0x11')][_0xd574('0x13')]);}logger[_0xd574('0x11')](_0xd574('0xd'),_0x3ce54f,_0x4306f7[_0xd574('0x11')]['message']);return _0x3a1e54(_0x4306f7[_0xd574('0x11')][_0xd574('0x13')]);}else{logger[_0xd574('0xc')](_0xd574('0xd'),_0x3ce54f,_0xd574('0xe'));_0x3a1e54(_0x4306f7[_0xd574('0x14')][_0xd574('0x13')]);}})[_0xd574('0x15')](function(_0x5c1db1){logger['error'](_0xd574('0xd'),_0x3ce54f,_0x5c1db1);_0x20751c(_0x5c1db1);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 0da4839..8d44d77 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 _0xe20d=['delete','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','/describe','describe','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put'];(function(_0xce9195,_0x1963e1){var _0x530fe6=function(_0x1b8055){while(--_0x1b8055){_0xce9195['push'](_0xce9195['shift']());}};_0x530fe6(++_0x1963e1);}(_0xe20d,0xda));var _0xde20=function(_0x2e5a33,_0x2e768c){_0x2e5a33=_0x2e5a33-0x0;var _0x1f5221=_0xe20d[_0x2e5a33];return _0x1f5221;};'use strict';var multer=require(_0xde20('0x0'));var util=require(_0xde20('0x1'));var path=require(_0xde20('0x2'));var timeout=require('connect-timeout');var express=require(_0xde20('0x3'));var router=express[_0xde20('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xde20('0x5'));var config=require(_0xde20('0x6'));var controller=require(_0xde20('0x7'));router['get']('/',auth[_0xde20('0x8')](),controller[_0xde20('0x9')]);router[_0xde20('0xa')](_0xde20('0xb'),auth[_0xde20('0x8')](),controller[_0xde20('0xc')]);router[_0xde20('0xa')]('/:id',auth[_0xde20('0x8')](),controller['show']);router[_0xde20('0xa')](_0xde20('0xd'),auth[_0xde20('0x8')](),controller[_0xde20('0xe')]);router[_0xde20('0xa')](_0xde20('0xf'),controller[_0xde20('0x10')]);router[_0xde20('0xa')](_0xde20('0x11'),auth[_0xde20('0x8')](),controller[_0xde20('0x12')]);router[_0xde20('0x13')]('/',auth[_0xde20('0x8')](),controller['create']);router[_0xde20('0x13')](_0xde20('0x11'),auth[_0xde20('0x8')](),controller[_0xde20('0x14')]);router[_0xde20('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xde20('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xde20('0x17')]=router; \ No newline at end of file +var _0x39a5=['runTranscribe','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create'];(function(_0x3d5e85,_0x4fcc11){var _0x9716f6=function(_0x424d32){while(--_0x424d32){_0x3d5e85['push'](_0x3d5e85['shift']());}};_0x9716f6(++_0x4fcc11);}(_0x39a5,0xdf));var _0x539a=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x39a5[_0x119d5a];return _0x15bff4;};'use strict';var multer=require(_0x539a('0x0'));var util=require(_0x539a('0x1'));var path=require('path');var timeout=require(_0x539a('0x2'));var express=require('express');var router=express[_0x539a('0x3')]();var auth=require(_0x539a('0x4'));var interaction=require(_0x539a('0x5'));var config=require(_0x539a('0x6'));var controller=require(_0x539a('0x7'));router[_0x539a('0x8')]('/',auth[_0x539a('0x9')](),controller[_0x539a('0xa')]);router['get'](_0x539a('0xb'),auth[_0x539a('0x9')](),controller[_0x539a('0xc')]);router['get']('/:id',auth[_0x539a('0x9')](),controller[_0x539a('0xd')]);router[_0x539a('0x8')](_0x539a('0xe'),auth[_0x539a('0x9')](),controller['download']);router[_0x539a('0x8')](_0x539a('0xf'),controller[_0x539a('0x10')]);router['get'](_0x539a('0x11'),auth[_0x539a('0x9')](),controller[_0x539a('0x12')]);router['post']('/',auth[_0x539a('0x9')](),controller[_0x539a('0x13')]);router['post']('/:id/transcribe',auth[_0x539a('0x9')](),controller[_0x539a('0x14')]);router[_0x539a('0x15')](_0x539a('0x16'),auth['isAuthenticated'](),controller[_0x539a('0x17')]);router[_0x539a('0x18')](_0x539a('0x16'),auth[_0x539a('0x9')](),controller[_0x539a('0x19')]);module[_0x539a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 9787d13..d893a9f 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 _0x4a9a=['BOOLEAN','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','STRING','setDataValue','channel','membername','INTEGER','TEXT','NEW','FLOAT'];(function(_0x46774f,_0x5cfab6){var _0x29ee44=function(_0x4c309d){while(--_0x4c309d){_0x46774f['push'](_0x46774f['shift']());}};_0x29ee44(++_0x5cfab6);}(_0x4a9a,0x151));var _0xa4a9=function(_0x33f373,_0x52d996){_0x33f373=_0x33f373-0x0;var _0x47459e=_0x4a9a[_0x33f373];return _0x47459e;};'use strict';var Sequelize=require(_0xa4a9('0x0'));var moment=require(_0xa4a9('0x1'));var path=require(_0xa4a9('0x2'));module[_0xa4a9('0x3')]={'format':{'type':Sequelize[_0xa4a9('0x4')],'get':function(){return this[_0xa4a9('0x5')](_0xa4a9('0x6'))?path['extname'](this[_0xa4a9('0x5')](_0xa4a9('0x6'))):undefined;}},'uniqueid':{'type':Sequelize[_0xa4a9('0x7')]},'channel':{'type':Sequelize[_0xa4a9('0x7')],'set':function(_0x2c1c3b){if(_0x2c1c3b){this[_0xa4a9('0x8')](_0xa4a9('0x9'),_0x2c1c3b);this[_0xa4a9('0x8')](_0xa4a9('0xa'),_0x2c1c3b['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xa4a9('0x7')]},'calleridnum':{'type':Sequelize[_0xa4a9('0x7')]},'calleridname':{'type':Sequelize[_0xa4a9('0x7')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xa4a9('0x7')]},'accountcode':{'type':Sequelize[_0xa4a9('0x7')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xa4a9('0x7')]},'value':{'type':Sequelize[_0xa4a9('0x7')]},'type':{'type':Sequelize[_0xa4a9('0x7')]},'rating':{'type':Sequelize[_0xa4a9('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xa4a9('0x7')]},'userDisposition':{'type':Sequelize[_0xa4a9('0x7')]},'userSecondDisposition':{'type':Sequelize[_0xa4a9('0x7')]},'userThirdDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0xa4a9('0xc')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0xa4a9('0xd')},'fileUri':{'type':Sequelize[_0xa4a9('0xc')]},'fileText':{'type':Sequelize[_0xa4a9('0xc')]},'failureReason':{'type':Sequelize[_0xa4a9('0xc')]},'sentiment':{'type':Sequelize[_0xa4a9('0x7')]},'sPositive':{'type':Sequelize[_0xa4a9('0xe')]},'sNegative':{'type':Sequelize[_0xa4a9('0xe')]},'sNeutral':{'type':Sequelize[_0xa4a9('0xe')]},'sMixed':{'type':Sequelize[_0xa4a9('0xe')]},'tempSentiment':{'type':Sequelize[_0xa4a9('0xf')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xa4a9('0x10')],'get':function(){return moment(this['getDataValue'](_0xa4a9('0x11')))[_0xa4a9('0x12')](_0xa4a9('0x13'))[_0xa4a9('0x14')]();}},'updatedAt':{'type':Sequelize[_0xa4a9('0x10')],'get':function(){return moment(this[_0xa4a9('0x5')](_0xa4a9('0x15')))[_0xa4a9('0x12')](_0xa4a9('0x13'))['toString']();}}}; \ No newline at end of file +var _0xf341=['path','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','channel','membername','split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize'];(function(_0x55387b,_0x85625b){var _0x2a376d=function(_0x22e575){while(--_0x22e575){_0x55387b['push'](_0x55387b['shift']());}};_0x2a376d(++_0x85625b);}(_0xf341,0xf1));var _0x1f34=function(_0x176519,_0xda437c){_0x176519=_0x176519-0x0;var _0x57b3e7=_0xf341[_0x176519];return _0x57b3e7;};'use strict';var Sequelize=require(_0x1f34('0x0'));var moment=require('moment');var path=require(_0x1f34('0x1'));module['exports']={'format':{'type':Sequelize[_0x1f34('0x2')],'get':function(){return this[_0x1f34('0x3')](_0x1f34('0x4'))?path[_0x1f34('0x5')](this[_0x1f34('0x3')](_0x1f34('0x4'))):undefined;}},'uniqueid':{'type':Sequelize[_0x1f34('0x6')]},'channel':{'type':Sequelize[_0x1f34('0x6')],'set':function(_0x333e1a){if(_0x333e1a){this[_0x1f34('0x7')](_0x1f34('0x8'),_0x333e1a);this[_0x1f34('0x7')](_0x1f34('0x9'),_0x333e1a[_0x1f34('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1f34('0x6')]},'calleridname':{'type':Sequelize[_0x1f34('0x6')]},'connectedlinenum':{'type':Sequelize[_0x1f34('0x6')]},'connectedlinename':{'type':Sequelize[_0x1f34('0x6')]},'accountcode':{'type':Sequelize[_0x1f34('0x6')]},'context':{'type':Sequelize[_0x1f34('0x6')]},'exten':{'type':Sequelize[_0x1f34('0x6')]},'value':{'type':Sequelize[_0x1f34('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x1f34('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x1f34('0x6')]},'userSecondDisposition':{'type':Sequelize[_0x1f34('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x1f34('0x6')]},'location':{'type':Sequelize[_0x1f34('0xc')]},'transcribeName':{'type':Sequelize[_0x1f34('0x6')]},'transcribeStatus':{'type':Sequelize[_0x1f34('0x6')],'defaultValue':_0x1f34('0xd')},'fileUri':{'type':Sequelize[_0x1f34('0xc')]},'fileText':{'type':Sequelize[_0x1f34('0xc')]},'failureReason':{'type':Sequelize[_0x1f34('0xc')]},'sentiment':{'type':Sequelize[_0x1f34('0x6')]},'sPositive':{'type':Sequelize[_0x1f34('0xe')]},'sNegative':{'type':Sequelize[_0x1f34('0xe')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x1f34('0xe')]},'tempSentiment':{'type':Sequelize[_0x1f34('0xf')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x1f34('0x10')],'get':function(){return moment(this[_0x1f34('0x3')](_0x1f34('0x11')))[_0x1f34('0x12')](_0x1f34('0x13'))[_0x1f34('0x14')]();}},'updatedAt':{'type':Sequelize[_0x1f34('0x10')],'get':function(){return moment(this[_0x1f34('0x3')](_0x1f34('0x15')))['format'](_0x1f34('0x13'))[_0x1f34('0x14')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index dcd6ee8..43a003d 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 _0xa849=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','stack','name','map','rawAttributes','fieldName','type','key','model','format','query','filters','intersection','attributes','sort','where','pick','merge','VIRTUAL','filter','VoiceRecording','includeAll','include','findAll','rows','catch','show','params','keys','filtears','fields','length','options','find','create','body','update','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','secrets','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','Sentiment\x20Analysis\x20not\x20configured','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf'];(function(_0x4a9ed3,_0x3d6a92){var _0x241a76=function(_0x279fe0){while(--_0x279fe0){_0x4a9ed3['push'](_0x4a9ed3['shift']());}};_0x241a76(++_0x3d6a92);}(_0xa849,0x96));var _0x9a84=function(_0x4dded0,_0x3a4585){_0x4dded0=_0x4dded0-0x0;var _0x20002b=_0xa849[_0x4dded0];return _0x20002b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9a84('0x0'));var rimraf=require(_0x9a84('0x1'));var zipdir=require(_0x9a84('0x2'));var jsonpatch=require(_0x9a84('0x3'));var rp=require(_0x9a84('0x4'));var moment=require('moment');var BPromise=require(_0x9a84('0x5'));var Mustache=require(_0x9a84('0x6'));var util=require(_0x9a84('0x7'));var path=require(_0x9a84('0x8'));var sox=require(_0x9a84('0x9'));var csv=require(_0x9a84('0xa'));var ejs=require(_0x9a84('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9a84('0xc'));var crypto=require('crypto');var jsforce=require(_0x9a84('0xd'));var deskjs=require(_0x9a84('0xe'));var toCsv=require(_0x9a84('0xa'));var querystring=require(_0x9a84('0xf'));var Papa=require(_0x9a84('0x10'));var AWS=require(_0x9a84('0x11'));var uuidv4=require(_0x9a84('0x12'));var Redis=require('ioredis');var authService=require(_0x9a84('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9a84('0x14'));var hardwareService=require(_0x9a84('0x15'));var logger=require(_0x9a84('0x16'))(_0x9a84('0x17'));var utils=require('../../config/utils');var config=require(_0x9a84('0x18'));var licenseUtil=require(_0x9a84('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38c189,_0xaf543c){_0xaf543c=_0xaf543c||0xcc;return function(_0x590bc3){if(_0x590bc3){return _0x38c189[_0x9a84('0x1a')](_0xaf543c);}return _0x38c189[_0x9a84('0x1b')](_0xaf543c)[_0x9a84('0x1c')]();};}function respondWithResult(_0x4c9383,_0x398827){_0x398827=_0x398827||0xc8;return function(_0x56b6cd){if(_0x56b6cd){return _0x4c9383[_0x9a84('0x1b')](_0x398827)[_0x9a84('0x1d')](_0x56b6cd);}};}function respondWithFilteredResult(_0x5d7ceb,_0x544bda){return function(_0x5e4860){if(_0x5e4860){var _0x2aa693=_0x5e4860[_0x9a84('0x1e')],_0x47ee19=_0x544bda[_0x9a84('0x1f')],_0x331641=_0x544bda['offset']+_0x544bda[_0x9a84('0x20')],_0x476723;if(_0x331641>=_0x2aa693){_0x331641=_0x2aa693;_0x476723=0xc8;}else{_0x476723=0xce;}_0x5d7ceb[_0x9a84('0x1b')](_0x476723);return _0x5d7ceb[_0x9a84('0x21')](_0x9a84('0x22'),_0x47ee19+'-'+_0x331641+'/'+_0x2aa693)[_0x9a84('0x1d')](_0x5e4860);}return null;};}function patchUpdates(_0x4ab30c){return function(_0x561832){try{jsonpatch[_0x9a84('0x23')](_0x561832,_0x4ab30c,!![]);}catch(_0x52a72c){return BPromise[_0x9a84('0x24')](_0x52a72c);}return _0x561832[_0x9a84('0x25')]();};}function saveUpdates(_0x4ac87a,_0x12eca0){return function(_0x5bb857){if(_0x5bb857){return _0x5bb857['update'](_0x4ac87a)['then'](function(_0x362dc2){return _0x362dc2;});}return null;};}function removeEntity(_0x439aee,_0x161378){return function(_0x3ad1e6){if(_0x3ad1e6){return _0x3ad1e6[_0x9a84('0x26')]()[_0x9a84('0x27')](function(){_0x439aee[_0x9a84('0x1b')](0xcc)[_0x9a84('0x1c')]();});}};}function handleEntityNotFound(_0x4a620b,_0xd17d52){return function(_0x403194){if(!_0x403194){_0x4a620b[_0x9a84('0x1a')](0x194);}return _0x403194;};}function handleError(_0x177314,_0x239bbe){_0x239bbe=_0x239bbe||0x1f4;return function(_0x1c6325){logger['error'](_0x1c6325[_0x9a84('0x28')]);if(_0x1c6325[_0x9a84('0x29')]){delete _0x1c6325['name'];}_0x177314[_0x9a84('0x1b')](_0x239bbe)['send'](_0x1c6325);};}exports['index']=function(_0x1a87bd,_0x4a5655){var _0x31836c={},_0x35669b={},_0x44224d={'count':0x0,'rows':[]};var _0x453eb7=_[_0x9a84('0x2a')](db['VoiceRecording'][_0x9a84('0x2b')],function(_0x302466){return{'name':_0x302466[_0x9a84('0x2c')],'type':_0x302466[_0x9a84('0x2d')][_0x9a84('0x2e')]};});_0x35669b[_0x9a84('0x2f')]=_['differenceBy'](_[_0x9a84('0x2a')](_0x453eb7,_0x9a84('0x29')),[_0x9a84('0x30')]);_0x35669b[_0x9a84('0x31')]=_['keys'](_0x1a87bd[_0x9a84('0x31')]);_0x35669b[_0x9a84('0x32')]=_[_0x9a84('0x33')](_0x35669b[_0x9a84('0x2f')],_0x35669b[_0x9a84('0x31')]);_0x31836c['attributes']=_['intersection'](_0x35669b[_0x9a84('0x2f')],qs['fields'](_0x1a87bd[_0x9a84('0x31')]['fields']));_0x31836c[_0x9a84('0x34')]=_0x31836c[_0x9a84('0x34')]['length']?_0x31836c[_0x9a84('0x34')]:_0x35669b[_0x9a84('0x2f')];if(!_0x1a87bd[_0x9a84('0x31')]['hasOwnProperty']('nolimit')){_0x31836c[_0x9a84('0x20')]=qs[_0x9a84('0x20')](_0x1a87bd[_0x9a84('0x31')][_0x9a84('0x20')]);_0x31836c[_0x9a84('0x1f')]=qs['offset'](_0x1a87bd[_0x9a84('0x31')][_0x9a84('0x1f')]);}_0x31836c['order']=qs['sort'](_0x1a87bd[_0x9a84('0x31')][_0x9a84('0x35')]);_0x31836c[_0x9a84('0x36')]=qs[_0x9a84('0x32')](_[_0x9a84('0x37')](_0x1a87bd[_0x9a84('0x31')],_0x35669b[_0x9a84('0x32')]),_0x453eb7);if(_0x1a87bd[_0x9a84('0x31')]['filter']){_0x31836c[_0x9a84('0x36')]=_[_0x9a84('0x38')](_0x31836c[_0x9a84('0x36')],{'$or':_[_0x9a84('0x2a')](_0x453eb7,function(_0x45a9ba){if(_0x45a9ba[_0x9a84('0x2d')]!==_0x9a84('0x39')){var _0x248fd2={};_0x248fd2[_0x45a9ba['name']]={'$like':'%'+_0x1a87bd[_0x9a84('0x31')][_0x9a84('0x3a')]+'%'};return _0x248fd2;}})});}_0x31836c=_[_0x9a84('0x38')]({},_0x31836c,_0x1a87bd['options']);var _0x39c73e={'where':_0x31836c[_0x9a84('0x36')]};return db[_0x9a84('0x3b')][_0x9a84('0x1e')](_0x39c73e)['then'](function(_0x1c659b){_0x44224d['count']=_0x1c659b;if(_0x1a87bd[_0x9a84('0x31')][_0x9a84('0x3c')]){_0x31836c[_0x9a84('0x3d')]=[{'all':!![]}];}return db[_0x9a84('0x3b')][_0x9a84('0x3e')](_0x31836c);})[_0x9a84('0x27')](function(_0x1d7f2d){_0x44224d[_0x9a84('0x3f')]=_0x1d7f2d;return _0x44224d;})[_0x9a84('0x27')](respondWithFilteredResult(_0x4a5655,_0x31836c))[_0x9a84('0x40')](handleError(_0x4a5655,null));};exports[_0x9a84('0x41')]=function(_0x4b1888,_0x5d56b6){var _0x54681c={'raw':![],'where':{'id':_0x4b1888[_0x9a84('0x42')]['id']}},_0x4daef5={};_0x4daef5[_0x9a84('0x2f')]=_[_0x9a84('0x43')](db['VoiceRecording']['rawAttributes']);_0x4daef5['query']=_[_0x9a84('0x43')](_0x4b1888[_0x9a84('0x31')]);_0x4daef5[_0x9a84('0x44')]=_[_0x9a84('0x33')](_0x4daef5[_0x9a84('0x2f')],_0x4daef5[_0x9a84('0x31')]);_0x54681c[_0x9a84('0x34')]=_[_0x9a84('0x33')](_0x4daef5[_0x9a84('0x2f')],qs[_0x9a84('0x45')](_0x4b1888[_0x9a84('0x31')][_0x9a84('0x45')]));_0x54681c['attributes']=_0x54681c[_0x9a84('0x34')][_0x9a84('0x46')]?_0x54681c[_0x9a84('0x34')]:_0x4daef5[_0x9a84('0x2f')];if(_0x4b1888[_0x9a84('0x31')]['includeAll']){_0x54681c[_0x9a84('0x3d')]=[{'all':!![]}];}_0x54681c=_[_0x9a84('0x38')]({},_0x54681c,_0x4b1888[_0x9a84('0x47')]);return db[_0x9a84('0x3b')][_0x9a84('0x48')](_0x54681c)[_0x9a84('0x27')](handleEntityNotFound(_0x5d56b6,null))[_0x9a84('0x27')](respondWithResult(_0x5d56b6,null))[_0x9a84('0x40')](handleError(_0x5d56b6,null));};exports[_0x9a84('0x49')]=function(_0x517f9e,_0x55f549){return db['VoiceRecording'][_0x9a84('0x49')](_0x517f9e[_0x9a84('0x4a')],{})[_0x9a84('0x27')](respondWithResult(_0x55f549,0xc9))[_0x9a84('0x40')](handleError(_0x55f549,null));};exports[_0x9a84('0x4b')]=function(_0x411f30,_0x2c4fab){if(_0x411f30[_0x9a84('0x4a')]['id']){delete _0x411f30[_0x9a84('0x4a')]['id'];}return db[_0x9a84('0x3b')][_0x9a84('0x48')]({'where':{'id':_0x411f30[_0x9a84('0x42')]['id']}})[_0x9a84('0x27')](handleEntityNotFound(_0x2c4fab,null))['then'](saveUpdates(_0x411f30[_0x9a84('0x4a')],null))['then'](respondWithResult(_0x2c4fab,null))['catch'](handleError(_0x2c4fab,null));};exports[_0x9a84('0x4c')]=function(_0x3a57dd,_0x2dddcd){return db['VoiceRecording'][_0x9a84('0x4c')]()['then'](respondWithResult(_0x2dddcd,null))['catch'](handleError(_0x2dddcd,null));};exports[_0x9a84('0x4d')]=function(_0x93c5f0,_0x384903,_0x4f8579){var _0xb40f15=require(_0x9a84('0x4e'));var _0x359a5d=![];var _0x5f01cc={};if(_0x93c5f0[_0x9a84('0x31')][_0x9a84('0x2d')]&&_0x93c5f0[_0x9a84('0x31')][_0x9a84('0x2d')]===_0x9a84('0x4f')){_0x5f01cc['uniqueid']=_0x93c5f0['params']['id'];}else{_0x5f01cc['id']=_0x93c5f0[_0x9a84('0x42')]['id'];}return db[_0x9a84('0x3b')]['find']({'where':_0x5f01cc,'attributes':['id',_0x9a84('0x50')],'raw':!![]})[_0x9a84('0x27')](handleEntityNotFound(_0x384903,null))[_0x9a84('0x27')](function(_0x431e8d){if(_0x431e8d){var _0x5b3ae7=_0x431e8d['value'];var _0x1b64fb=util[_0x9a84('0x30')](_0x9a84('0x51'),_0x5b3ae7);if(fs[_0x9a84('0x52')](_0x1b64fb)){_0x359a5d=!![];return _0xb40f15[_0x9a84('0x53')](_0x1b64fb,_0x5b3ae7,config['secrets'][_0x9a84('0x54')])[_0x9a84('0x27')](function(){return _0x431e8d;});}return _0x431e8d;}})['then'](function(_0x2096b5){if(_0x2096b5){var _0x54e02d=_0x2096b5[_0x9a84('0x50')];if(!fs[_0x9a84('0x52')](_0x54e02d)){throw new db[(_0x9a84('0x55'))][(_0x9a84('0x56'))](_0x9a84('0x57'));}if(_0x2096b5[_0x9a84('0x58')]){return _0x384903[_0x9a84('0x4d')](_0x54e02d,_0x2096b5[_0x9a84('0x58')]+path[_0x9a84('0x59')](_0x54e02d),function(){if(_0x359a5d){fs['unlink'](_0x54e02d);}});}else{return _0x384903[_0x9a84('0x4d')](_0x54e02d,function(_0xfa0797){if(_0x359a5d){fs[_0x9a84('0x5a')](_0x54e02d);}});}}})[_0x9a84('0x40')](function(_0x8bd9e9){if(_0x8bd9e9[_0x9a84('0x5b')]==='VoiceRecording\x20not\x20found'){_0x384903[_0x9a84('0x1b')](0x194)[_0x9a84('0x5c')](_0x9a84('0x5d'));}else{return handleError(_0x384903,null);}});};exports[_0x9a84('0x5e')]=function(_0x5709a3,_0x5a522f,_0x347832){var _0x573fac=require(_0x9a84('0x4e'));var _0xf52faf=![];var _0x3ca1d8={'$and':[db[_0x9a84('0x5f')][_0x9a84('0x36')](db['sequelize']['fn'](_0x9a84('0x60'),db[_0x9a84('0x5f')][_0x9a84('0x61')](_0x9a84('0x4f'))),_0x5709a3['query'][_0x9a84('0x62')])]};if(_0x5709a3['query'][_0x9a84('0x2d')]&&_0x5709a3[_0x9a84('0x31')][_0x9a84('0x2d')]===_0x9a84('0x4f')){_0x3ca1d8[_0x9a84('0x63')][_0x9a84('0x64')]({'uniqueid':_0x5709a3[_0x9a84('0x42')]['id']});}else{_0x3ca1d8['$and'][_0x9a84('0x64')]({'id':_0x5709a3['params']['id']});}return db[_0x9a84('0x3b')][_0x9a84('0x48')]({'where':_0x3ca1d8,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x5a522f,null))[_0x9a84('0x27')](function(_0x24adf3){if(_0x24adf3){var _0x43ed35=util[_0x9a84('0x30')](_0x9a84('0x51'),_0x24adf3[_0x9a84('0x50')]);if(fs[_0x9a84('0x52')](_0x43ed35)){_0xf52faf=!![];return _0x573fac[_0x9a84('0x53')](_0x43ed35,_0x24adf3['value'],config[_0x9a84('0x65')][_0x9a84('0x54')])['then'](function(){return _0x24adf3;});}return _0x24adf3;}})[_0x9a84('0x27')](function(_0x4fb0df){if(_0x4fb0df){if(!fs['existsSync'](_0x4fb0df[_0x9a84('0x50')])){throw new db[(_0x9a84('0x55'))][(_0x9a84('0x56'))]('VoiceRecording\x20not\x20found');}if(_0x4fb0df[_0x9a84('0x58')]){return _0x5a522f[_0x9a84('0x4d')](_0x4fb0df[_0x9a84('0x50')],_0x4fb0df[_0x9a84('0x58')]+path[_0x9a84('0x59')](_0x4fb0df[_0x9a84('0x50')]),function(){if(_0xf52faf){fs[_0x9a84('0x5a')](_0x4fb0df['value']);}});}else{return _0x5a522f[_0x9a84('0x4d')](_0x4fb0df[_0x9a84('0x50')],function(_0xc8f1c7){if(_0xf52faf){fs[_0x9a84('0x5a')](_0x4fb0df[_0x9a84('0x50')]);}});}}})[_0x9a84('0x40')](handleError(_0x5a522f,null));};exports[_0x9a84('0x26')]=function(_0x5c3d43,_0x5aedf5){return db['VoiceRecording']['find']({'where':{'id':_0x5c3d43[_0x9a84('0x42')]['id']}})['then'](function(_0x5ab4db){if(!_0x5ab4db)throw new ReferenceError('Entity\x20not\x20found');return _0x5ab4db;})[_0x9a84('0x27')](function(_0x487154){var _0xd2990d=_0x487154[_0x9a84('0x50')];logger[_0x9a84('0x66')](_0x9a84('0x67'),_0xd2990d);if(!_[_0x9a84('0x68')](_0x487154[_0x9a84('0x50')])&&fs[_0x9a84('0x52')](_0xd2990d)){logger[_0x9a84('0x66')](_0x9a84('0x69')+_0xd2990d+_0x9a84('0x6a'));fs[_0x9a84('0x6b')](_0xd2990d);}_0xd2990d=_0xd2990d+_0x9a84('0x6c');if(!_[_0x9a84('0x68')](_0x487154[_0x9a84('0x50')])&&fs[_0x9a84('0x52')](_0xd2990d)){logger[_0x9a84('0x66')]('File:\x20\x22'+_0xd2990d+_0x9a84('0x6a'));fs['unlinkSync'](_0xd2990d);}return _0x487154;})[_0x9a84('0x27')](function(_0x208f5b){if(!_0x208f5b)throw new InternalError();return _0x208f5b[_0x9a84('0x26')]();})[_0x9a84('0x27')](function(){_0x5aedf5[_0x9a84('0x1b')](0xcc)[_0x9a84('0x1c')]();})[_0x9a84('0x40')](handleError(_0x5aedf5,null));};function getBucketslist(_0x4de967,_0xa76188,_0x233934){return new Promise(function(_0x3ca52d,_0x32f436){var _0x4b11b4=new AWS['S3']({'accessKeyId':_0xa76188,'secretAccessKey':_0x4de967,'region':_0x233934});_0x4b11b4[_0x9a84('0x6d')]({},function(_0x36eb3f,_0x2c76c4){if(_0x36eb3f){return _0x32f436(_0x36eb3f);}else{return _0x3ca52d(_0x2c76c4);}});});}function createBucket(_0x10f5a6,_0x22b49f,_0x4cb84a,_0x3005b5){return new Promise(function(_0x422fec,_0x22f544){var _0x4e25b5=new AWS['S3']({'accessKeyId':_0x22b49f,'secretAccessKey':_0x10f5a6,'region':_0x4cb84a});_0x4e25b5[_0x9a84('0x6e')]({'Bucket':_0x3005b5},function(_0x55fa4d,_0x5e162b){if(_0x55fa4d){return _0x22f544(_0x55fa4d);}else{return _0x422fec(_0x5e162b);}});});}function uploadFile(_0x15189c,_0x38212c,_0x4d93c9,_0x1adf99,_0x37b1aa,_0x246d94){return new Promise(function(_0x32fba2,_0x2099e2){var _0x1d7006=new AWS['S3']({'accessKeyId':_0x38212c,'secretAccessKey':_0x15189c,'region':_0x4d93c9});_0x1d7006[_0x9a84('0x6f')]({'Bucket':_0x1adf99,'Key':_0x37b1aa,'Body':_0x246d94},function(_0x4177ca,_0x34ae8e){if(_0x4177ca){return _0x2099e2(_0x4177ca);}else{return _0x32fba2(_0x34ae8e);}});});}function startTranscribe(_0x460b2c,_0x242c46,_0x33d8f6,_0x21b01c,_0x50ce94,_0x1d6699){return new Promise(function(_0x524b00,_0x4c8d6b){var _0x525904=new AWS[(_0x9a84('0x70'))]({'accessKeyId':_0x242c46,'secretAccessKey':_0x460b2c,'region':_0x33d8f6});_0x525904[_0x9a84('0x71')]({'TranscriptionJobName':_0x21b01c,'LanguageCode':_0x50ce94,'Media':{'MediaFileUri':_0x1d6699}},function(_0x3b1db2,_0x2a5326){if(_0x3b1db2){return _0x4c8d6b(_0x3b1db2);}else{return _0x524b00(_0x2a5326);}});});}function transcribe(_0x1a80a5,_0x264d7f,_0xb4165d,_0x13b391,_0x435560,_0x2e479e,_0x205110){return new Promise(function(_0x1c6f57,_0x28f886){var _0x5a5a40={};logger['info'](util[_0x9a84('0x30')](_0x9a84('0x72'),_0x1a80a5,_0x435560));return uploadFile(_0x264d7f,_0xb4165d,_0x13b391,_0x435560,path[_0x9a84('0x73')](_0x2e479e),fs[_0x9a84('0x74')](_0x2e479e))[_0x9a84('0x27')](function(_0x2ff0de){logger['info'](util[_0x9a84('0x30')](_0x9a84('0x75'),_0x1a80a5,_0x435560,_0x2ff0de['Location']));_0x5a5a40['bucket']=_0x2ff0de['Bucket'];_0x5a5a40[_0x9a84('0x76')]=_0x2ff0de[_0x9a84('0x77')];logger[_0x9a84('0x66')](util[_0x9a84('0x30')](_0x9a84('0x78'),_0x1a80a5));return startTranscribe(_0x264d7f,_0xb4165d,_0x13b391,uuidv4(),_0x205110,_0x2ff0de[_0x9a84('0x77')]);})[_0x9a84('0x27')](function(_0x1af40f){logger[_0x9a84('0x66')](util['format'](_0x9a84('0x79'),_0x1a80a5,_0x1af40f[_0x9a84('0x7a')][_0x9a84('0x7b')]));_0x5a5a40[_0x9a84('0x7c')]=_0x1af40f[_0x9a84('0x7a')][_0x9a84('0x7b')];_0x5a5a40[_0x9a84('0x7d')]=_0x1af40f[_0x9a84('0x7a')][_0x9a84('0x7e')];return _0x1c6f57(_0x5a5a40);})['catch'](function(_0x1bdd55){return _0x28f886(_0x1bdd55);});});}exports['runTranscribe']=function(_0x7cd6e6,_0x190d7c,_0x43bd36){var _0xeb87dd;var _0x112da2;var _0x23eb31;var _0x2e72b0=require('../../components/encryptor');return db['VoiceRecording']['findOne']({'where':{'id':_0x7cd6e6[_0x9a84('0x42')]['id']}})['then'](function(_0x33b446){if(_0x33b446){var _0x4e9ea8=util['format'](_0x9a84('0x51'),_0x33b446['value']);if(fs[_0x9a84('0x52')](_0x4e9ea8)){cypher=!![];return _0x2e72b0[_0x9a84('0x53')](_0x4e9ea8,_0x33b446[_0x9a84('0x50')],config[_0x9a84('0x65')][_0x9a84('0x54')])[_0x9a84('0x27')](function(){return _0x33b446;});}return _0x33b446;}})['then'](function(_0x579b57){if(!_0x579b57){throw new db[(_0x9a84('0x55'))][(_0x9a84('0x56'))](_0x9a84('0x7f'));}_0x112da2=_0x579b57;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x9a84('0x27')](handleEntityNotFound(_0x190d7c,null))[_0x9a84('0x27')](function(_0x5b612f){if(_0x5b612f){_0xeb87dd=_0x5b612f;if(!_0xeb87dd[_0x9a84('0x80')]||!_0xeb87dd[_0x9a84('0x81')]||!_0xeb87dd[_0x9a84('0x82')]||!_0xeb87dd[_0x9a84('0x83')]||!_0xeb87dd[_0x9a84('0x84')]){throw new db[(_0x9a84('0x55'))]['ValidationError'](_0x9a84('0x85'));}if(_0x7cd6e6['body'][_0x9a84('0x86')]&&(!_0xeb87dd['sentiment']||!_0xeb87dd['sentimentAccountId']||!_0xeb87dd['sentimentRegion']||!_0xeb87dd[_0x9a84('0x83')]||!_0xeb87dd[_0x9a84('0x84')])){throw new db[(_0x9a84('0x55'))][(_0x9a84('0x56'))](_0x9a84('0x87'));}return db['CloudProvider'][_0x9a84('0x88')]({'where':{'id':_0xeb87dd['transcribeAccountId']}});}})[_0x9a84('0x27')](function(_0x359ef6){if(!_0x359ef6){throw new db['Sequelize'][(_0x9a84('0x56'))](_0x9a84('0x89'));}if(!_0x359ef6[_0x9a84('0x8a')]||!_0x359ef6[_0x9a84('0x8b')]){throw new db['Sequelize'][(_0x9a84('0x56'))]('Cloud\x20Provider\x20not\x20configured');}_0x23eb31=_0x359ef6;return getBucketslist(_0x23eb31[_0x9a84('0x8a')],_0x23eb31['data2'],_0xeb87dd[_0x9a84('0x82')]);})['then'](function(_0x41c16e){if(_0x41c16e&&_0x41c16e[_0x9a84('0x8c')]){var _0x336f5b=_['find'](_0x41c16e[_0x9a84('0x8c')],function(_0x5c65ed){return _0x5c65ed[_0x9a84('0x8d')]===_0xeb87dd[_0x9a84('0x84')];});if(!_0x336f5b){logger['info'](util['format'](_0x9a84('0x8e'),_0x7cd6e6[_0x9a84('0x42')]['id'],_0xeb87dd['bucket']));return createBucket(_0x23eb31['data1'],_0x23eb31[_0x9a84('0x8b')],_0xeb87dd[_0x9a84('0x82')],_0xeb87dd[_0x9a84('0x84')]);}logger[_0x9a84('0x66')](util[_0x9a84('0x30')](_0x9a84('0x8f'),_0x7cd6e6[_0x9a84('0x42')]['id'],_0xeb87dd[_0x9a84('0x84')]));return;}})[_0x9a84('0x27')](function(_0x3320a6){if(_0x112da2[_0x9a84('0x7d')]==='NEW'){return transcribe(_0x7cd6e6[_0x9a84('0x42')]['id'],_0x23eb31[_0x9a84('0x8a')],_0x23eb31['data2'],_0xeb87dd['transcribeRegion'],_0xeb87dd[_0x9a84('0x84')],_0x112da2[_0x9a84('0x50')],_0xeb87dd['language']);}else{logger[_0x9a84('0x66')](util['format'](_0x9a84('0x90'),_0x7cd6e6[_0x9a84('0x42')]['id']));return{'transcribeStatus':_0x9a84('0x91')};}})['then'](function(_0x3fc716){if(_0x3fc716){_0x3fc716['tempSentiment']=_0x7cd6e6[_0x9a84('0x4a')]['runSentiment'];return _0x112da2[_0x9a84('0x92')](_0x3fc716);}})[_0x9a84('0x27')](respondWithResult(_0x190d7c,null))[_0x9a84('0x40')](handleError(_0x190d7c,null));};function writeFile(_0x41dcc,_0x22dbe4){return new Promise(function(_0x143143,_0x4c277e){fs[_0x9a84('0x93')](_0x22dbe4,_0x41dcc,function(_0x5ee094,_0x27ea91){if(_0x5ee094){return _0x4c277e(_0x5ee094);}else{return _0x143143(_0x27ea91);}});});}exports['downloadTranscribe']=function(_0x474870,_0xca3247,_0x508201){return db[_0x9a84('0x3b')]['findOne']({'where':{'id':_0x474870[_0x9a84('0x42')]['id']}})[_0x9a84('0x27')](handleEntityNotFound(_0xca3247))[_0x9a84('0x27')](function(_0x12ef0f){if(_0x12ef0f&&_0x12ef0f[_0x9a84('0x94')]){var _0x4ff7eb=_0x12ef0f[_0x9a84('0x94')];var _0x147931=config[_0x9a84('0x95')]+_0x9a84('0x96')+_0x12ef0f['id']+_0x9a84('0x97');if(fs[_0x9a84('0x52')](_0x147931)){return _0x147931;}return writeFile(_0x4ff7eb,_0x147931)[_0x9a84('0x27')](function(){return _0x147931;});}else{throw new db[(_0x9a84('0x55'))][(_0x9a84('0x56'))]('Transcript\x20not\x20available');}})[_0x9a84('0x27')](function(_0x385bc0){return _0xca3247['download'](_0x385bc0);})[_0x9a84('0x40')](handleError(_0xca3247));}; \ No newline at end of file +var _0x6bd4=['crypto','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','VoiceRecording','fieldName','type','model','format','query','keys','intersection','attributes','fields','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','filtears','length','find','body','params','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','recording','Sequelize','ValidationError','filename','unlink','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','col','$and','push','secrets','extname','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','destroy','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','decryptFile','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6bd4,0x1c2));var _0x46bd=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x6bd4[_0x18ab2a];return _0x16dcee;};'use strict';var pdf=require(_0x46bd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x46bd('0x1'));var zipdir=require(_0x46bd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x46bd('0x3'));var moment=require(_0x46bd('0x4'));var BPromise=require(_0x46bd('0x5'));var Mustache=require(_0x46bd('0x6'));var util=require('util');var path=require('path');var sox=require(_0x46bd('0x7'));var csv=require(_0x46bd('0x8'));var ejs=require(_0x46bd('0x9'));var fs=require('fs');var _=require(_0x46bd('0xa'));var squel=require(_0x46bd('0xb'));var crypto=require(_0x46bd('0xc'));var jsforce=require(_0x46bd('0xd'));var deskjs=require(_0x46bd('0xe'));var toCsv=require(_0x46bd('0x8'));var querystring=require(_0x46bd('0xf'));var Papa=require(_0x46bd('0x10'));var AWS=require('aws-sdk');var uuidv4=require(_0x46bd('0x11'));var Redis=require(_0x46bd('0x12'));var authService=require(_0x46bd('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x46bd('0x14'));var hardwareService=require(_0x46bd('0x15'));var logger=require(_0x46bd('0x16'))(_0x46bd('0x17'));var utils=require(_0x46bd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x46bd('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x196e00,_0xd4912){_0xd4912=_0xd4912||0xcc;return function(_0x2de4ef){if(_0x2de4ef){return _0x196e00[_0x46bd('0x1a')](_0xd4912);}return _0x196e00[_0x46bd('0x1b')](_0xd4912)['end']();};}function respondWithResult(_0x4d6c54,_0x24a495){_0x24a495=_0x24a495||0xc8;return function(_0x561b39){if(_0x561b39){return _0x4d6c54[_0x46bd('0x1b')](_0x24a495)[_0x46bd('0x1c')](_0x561b39);}};}function respondWithFilteredResult(_0x7d732e,_0x280b85){return function(_0x5e32fd){if(_0x5e32fd){var _0x499f69=_0x5e32fd[_0x46bd('0x1d')],_0x541202=_0x280b85[_0x46bd('0x1e')],_0x3d5b49=_0x280b85[_0x46bd('0x1e')]+_0x280b85['limit'],_0xc9627d;if(_0x3d5b49>=_0x499f69){_0x3d5b49=_0x499f69;_0xc9627d=0xc8;}else{_0xc9627d=0xce;}_0x7d732e['status'](_0xc9627d);return _0x7d732e[_0x46bd('0x1f')](_0x46bd('0x20'),_0x541202+'-'+_0x3d5b49+'/'+_0x499f69)[_0x46bd('0x1c')](_0x5e32fd);}return null;};}function patchUpdates(_0x7c6ff0){return function(_0xb3495a){try{jsonpatch[_0x46bd('0x21')](_0xb3495a,_0x7c6ff0,!![]);}catch(_0x45bec9){return BPromise[_0x46bd('0x22')](_0x45bec9);}return _0xb3495a[_0x46bd('0x23')]();};}function saveUpdates(_0x58b12e,_0xbbb2f0){return function(_0x10cdf2){if(_0x10cdf2){return _0x10cdf2[_0x46bd('0x24')](_0x58b12e)[_0x46bd('0x25')](function(_0x566638){return _0x566638;});}return null;};}function removeEntity(_0x2034e2,_0x33f39e){return function(_0x1aeee1){if(_0x1aeee1){return _0x1aeee1['destroy']()[_0x46bd('0x25')](function(){_0x2034e2[_0x46bd('0x1b')](0xcc)[_0x46bd('0x26')]();});}};}function handleEntityNotFound(_0x30cdcc,_0x4a7f6b){return function(_0x54a4b1){if(!_0x54a4b1){_0x30cdcc[_0x46bd('0x1a')](0x194);}return _0x54a4b1;};}function handleError(_0x21a22a,_0x547f2b){_0x547f2b=_0x547f2b||0x1f4;return function(_0x49fe8c){logger[_0x46bd('0x27')](_0x49fe8c[_0x46bd('0x28')]);if(_0x49fe8c['name']){delete _0x49fe8c[_0x46bd('0x29')];}_0x21a22a['status'](_0x547f2b)[_0x46bd('0x2a')](_0x49fe8c);};}exports[_0x46bd('0x2b')]=function(_0x540d48,_0x5ce875){var _0x3e4eb9={},_0x19dbdf={},_0x2ab640={'count':0x0,'rows':[]};var _0x2c336d=_[_0x46bd('0x2c')](db[_0x46bd('0x2d')]['rawAttributes'],function(_0x10b670){return{'name':_0x10b670[_0x46bd('0x2e')],'type':_0x10b670[_0x46bd('0x2f')]['key']};});_0x19dbdf[_0x46bd('0x30')]=_['differenceBy'](_['map'](_0x2c336d,'name'),[_0x46bd('0x31')]);_0x19dbdf[_0x46bd('0x32')]=_[_0x46bd('0x33')](_0x540d48[_0x46bd('0x32')]);_0x19dbdf['filters']=_[_0x46bd('0x34')](_0x19dbdf['model'],_0x19dbdf['query']);_0x3e4eb9[_0x46bd('0x35')]=_[_0x46bd('0x34')](_0x19dbdf[_0x46bd('0x30')],qs['fields'](_0x540d48['query'][_0x46bd('0x36')]));_0x3e4eb9[_0x46bd('0x35')]=_0x3e4eb9[_0x46bd('0x35')]['length']?_0x3e4eb9['attributes']:_0x19dbdf[_0x46bd('0x30')];if(!_0x540d48[_0x46bd('0x32')]['hasOwnProperty'](_0x46bd('0x37'))){_0x3e4eb9[_0x46bd('0x38')]=qs[_0x46bd('0x38')](_0x540d48[_0x46bd('0x32')]['limit']);_0x3e4eb9[_0x46bd('0x1e')]=qs['offset'](_0x540d48[_0x46bd('0x32')]['offset']);}_0x3e4eb9[_0x46bd('0x39')]=qs[_0x46bd('0x3a')](_0x540d48['query'][_0x46bd('0x3a')]);_0x3e4eb9[_0x46bd('0x3b')]=qs[_0x46bd('0x3c')](_[_0x46bd('0x3d')](_0x540d48['query'],_0x19dbdf['filters']),_0x2c336d);if(_0x540d48[_0x46bd('0x32')][_0x46bd('0x3e')]){_0x3e4eb9[_0x46bd('0x3b')]=_[_0x46bd('0x3f')](_0x3e4eb9[_0x46bd('0x3b')],{'$or':_[_0x46bd('0x2c')](_0x2c336d,function(_0xf40730){if(_0xf40730[_0x46bd('0x2f')]!==_0x46bd('0x40')){var _0x382098={};_0x382098[_0xf40730[_0x46bd('0x29')]]={'$like':'%'+_0x540d48[_0x46bd('0x32')][_0x46bd('0x3e')]+'%'};return _0x382098;}})});}_0x3e4eb9=_[_0x46bd('0x3f')]({},_0x3e4eb9,_0x540d48[_0x46bd('0x41')]);var _0x2b513d={'where':_0x3e4eb9[_0x46bd('0x3b')]};return db['VoiceRecording']['count'](_0x2b513d)[_0x46bd('0x25')](function(_0x81aaed){_0x2ab640[_0x46bd('0x1d')]=_0x81aaed;if(_0x540d48[_0x46bd('0x32')][_0x46bd('0x42')]){_0x3e4eb9[_0x46bd('0x43')]=[{'all':!![]}];}return db[_0x46bd('0x2d')][_0x46bd('0x44')](_0x3e4eb9);})[_0x46bd('0x25')](function(_0x50c088){_0x2ab640[_0x46bd('0x45')]=_0x50c088;return _0x2ab640;})[_0x46bd('0x25')](respondWithFilteredResult(_0x5ce875,_0x3e4eb9))[_0x46bd('0x46')](handleError(_0x5ce875,null));};exports[_0x46bd('0x47')]=function(_0x2dc62c,_0x7ff18b){var _0x542993={'raw':![],'where':{'id':_0x2dc62c['params']['id']}},_0x1ffbdc={};_0x1ffbdc[_0x46bd('0x30')]=_[_0x46bd('0x33')](db[_0x46bd('0x2d')][_0x46bd('0x48')]);_0x1ffbdc[_0x46bd('0x32')]=_['keys'](_0x2dc62c['query']);_0x1ffbdc[_0x46bd('0x49')]=_['intersection'](_0x1ffbdc[_0x46bd('0x30')],_0x1ffbdc[_0x46bd('0x32')]);_0x542993[_0x46bd('0x35')]=_[_0x46bd('0x34')](_0x1ffbdc[_0x46bd('0x30')],qs[_0x46bd('0x36')](_0x2dc62c['query'][_0x46bd('0x36')]));_0x542993[_0x46bd('0x35')]=_0x542993[_0x46bd('0x35')][_0x46bd('0x4a')]?_0x542993['attributes']:_0x1ffbdc[_0x46bd('0x30')];if(_0x2dc62c[_0x46bd('0x32')][_0x46bd('0x42')]){_0x542993[_0x46bd('0x43')]=[{'all':!![]}];}_0x542993=_[_0x46bd('0x3f')]({},_0x542993,_0x2dc62c['options']);return db[_0x46bd('0x2d')][_0x46bd('0x4b')](_0x542993)[_0x46bd('0x25')](handleEntityNotFound(_0x7ff18b,null))[_0x46bd('0x25')](respondWithResult(_0x7ff18b,null))[_0x46bd('0x46')](handleError(_0x7ff18b,null));};exports['create']=function(_0x771c9d,_0x23b689){return db[_0x46bd('0x2d')]['create'](_0x771c9d[_0x46bd('0x4c')],{})[_0x46bd('0x25')](respondWithResult(_0x23b689,0xc9))['catch'](handleError(_0x23b689,null));};exports[_0x46bd('0x24')]=function(_0x53418a,_0x1d01d0){if(_0x53418a[_0x46bd('0x4c')]['id']){delete _0x53418a['body']['id'];}return db[_0x46bd('0x2d')]['find']({'where':{'id':_0x53418a[_0x46bd('0x4d')]['id']}})[_0x46bd('0x25')](handleEntityNotFound(_0x1d01d0,null))['then'](saveUpdates(_0x53418a[_0x46bd('0x4c')],null))['then'](respondWithResult(_0x1d01d0,null))[_0x46bd('0x46')](handleError(_0x1d01d0,null));};exports[_0x46bd('0x4e')]=function(_0xbe7274,_0x52256a){return db[_0x46bd('0x2d')][_0x46bd('0x4e')]()[_0x46bd('0x25')](respondWithResult(_0x52256a,null))['catch'](handleError(_0x52256a,null));};exports[_0x46bd('0x4f')]=function(_0x1c7c07,_0x3fb630,_0x284090){var _0x375f96=require(_0x46bd('0x50'));var _0x322de3=![];var _0x2a13eb={};if(_0x1c7c07[_0x46bd('0x32')][_0x46bd('0x2f')]&&_0x1c7c07[_0x46bd('0x32')]['type']==='uniqueid'){_0x2a13eb[_0x46bd('0x51')]=_0x1c7c07[_0x46bd('0x4d')]['id'];}else{_0x2a13eb['id']=_0x1c7c07[_0x46bd('0x4d')]['id'];}return db[_0x46bd('0x2d')][_0x46bd('0x4b')]({'where':_0x2a13eb,'attributes':['id',_0x46bd('0x52')],'raw':!![]})[_0x46bd('0x25')](handleEntityNotFound(_0x3fb630,null))[_0x46bd('0x25')](function(_0x4cb54d){if(_0x4cb54d){var _0xd6828d=_0x4cb54d['value'];var _0xcdba71=util[_0x46bd('0x31')](_0x46bd('0x53'),_0xd6828d);if(fs[_0x46bd('0x54')](_0xcdba71)){_0x322de3=!![];return _0x375f96['decryptFile'](_0xcdba71,_0xd6828d,config['secrets'][_0x46bd('0x55')])['then'](function(){return _0x4cb54d;});}return _0x4cb54d;}})['then'](function(_0x1124ac){if(_0x1124ac){var _0x496bf2=_0x1124ac[_0x46bd('0x52')];if(!fs['existsSync'](_0x496bf2)){throw new db[(_0x46bd('0x56'))][(_0x46bd('0x57'))]('VoiceRecording\x20not\x20found');}if(_0x1124ac[_0x46bd('0x58')]){return _0x3fb630[_0x46bd('0x4f')](_0x496bf2,_0x1124ac[_0x46bd('0x58')]+path['extname'](_0x496bf2),function(){if(_0x322de3){fs[_0x46bd('0x59')](_0x496bf2);}});}else{return _0x3fb630[_0x46bd('0x4f')](_0x496bf2,function(_0x95129e){if(_0x322de3){fs[_0x46bd('0x59')](_0x496bf2);}});}}})[_0x46bd('0x46')](function(_0x4ac2a4){if(_0x4ac2a4['message']===_0x46bd('0x5a')){_0x3fb630[_0x46bd('0x1b')](0x194)[_0x46bd('0x2a')](_0x46bd('0x5b'));}else{return handleError(_0x3fb630,null);}});};exports[_0x46bd('0x5c')]=function(_0x39e23f,_0x14bd88,_0x1934b9){var _0x57a665=require('../../components/encryptor');var _0x2ce89e=![];var _0x4cf78c={'$and':[db[_0x46bd('0x5d')]['where'](db[_0x46bd('0x5d')]['fn'](_0x46bd('0x5e'),db['sequelize'][_0x46bd('0x5f')]('uniqueid')),_0x39e23f[_0x46bd('0x32')]['token'])]};if(_0x39e23f[_0x46bd('0x32')]['type']&&_0x39e23f[_0x46bd('0x32')]['type']===_0x46bd('0x51')){_0x4cf78c[_0x46bd('0x60')]['push']({'uniqueid':_0x39e23f[_0x46bd('0x4d')]['id']});}else{_0x4cf78c[_0x46bd('0x60')][_0x46bd('0x61')]({'id':_0x39e23f[_0x46bd('0x4d')]['id']});}return db[_0x46bd('0x2d')][_0x46bd('0x4b')]({'where':_0x4cf78c,'attributes':['id',_0x46bd('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x14bd88,null))[_0x46bd('0x25')](function(_0x466bc7){if(_0x466bc7){var _0x447cec=util[_0x46bd('0x31')](_0x46bd('0x53'),_0x466bc7['value']);if(fs[_0x46bd('0x54')](_0x447cec)){_0x2ce89e=!![];return _0x57a665['decryptFile'](_0x447cec,_0x466bc7[_0x46bd('0x52')],config[_0x46bd('0x62')][_0x46bd('0x55')])['then'](function(){return _0x466bc7;});}return _0x466bc7;}})[_0x46bd('0x25')](function(_0x19d323){if(_0x19d323){if(!fs[_0x46bd('0x54')](_0x19d323[_0x46bd('0x52')])){throw new db['Sequelize'][(_0x46bd('0x57'))](_0x46bd('0x5a'));}if(_0x19d323[_0x46bd('0x58')]){return _0x14bd88[_0x46bd('0x4f')](_0x19d323[_0x46bd('0x52')],_0x19d323[_0x46bd('0x58')]+path[_0x46bd('0x63')](_0x19d323['value']),function(){if(_0x2ce89e){fs[_0x46bd('0x59')](_0x19d323[_0x46bd('0x52')]);}});}else{return _0x14bd88[_0x46bd('0x4f')](_0x19d323[_0x46bd('0x52')],function(_0x59bb12){if(_0x2ce89e){fs[_0x46bd('0x59')](_0x19d323[_0x46bd('0x52')]);}});}}})[_0x46bd('0x46')](handleError(_0x14bd88,null));};exports['destroy']=function(_0x1339f9,_0xe43fd1){return db['VoiceRecording'][_0x46bd('0x4b')]({'where':{'id':_0x1339f9[_0x46bd('0x4d')]['id']}})[_0x46bd('0x25')](function(_0x18c330){if(!_0x18c330)throw new ReferenceError(_0x46bd('0x64'));return _0x18c330;})[_0x46bd('0x25')](function(_0x575da7){var _0x1fce99=_0x575da7[_0x46bd('0x52')];logger[_0x46bd('0x65')]('cancellazione\x20fisica\x20documento\x20%s',_0x1fce99);if(!_[_0x46bd('0x66')](_0x575da7['value'])&&fs['existsSync'](_0x1fce99)){logger[_0x46bd('0x65')](_0x46bd('0x67')+_0x1fce99+_0x46bd('0x68'));fs[_0x46bd('0x69')](_0x1fce99);}_0x1fce99=_0x1fce99+_0x46bd('0x6a');if(!_[_0x46bd('0x66')](_0x575da7[_0x46bd('0x52')])&&fs['existsSync'](_0x1fce99)){logger[_0x46bd('0x65')](_0x46bd('0x67')+_0x1fce99+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x46bd('0x69')](_0x1fce99);}return _0x575da7;})[_0x46bd('0x25')](function(_0x4c211d){if(!_0x4c211d)throw new InternalError();return _0x4c211d[_0x46bd('0x6b')]();})[_0x46bd('0x25')](function(){_0xe43fd1[_0x46bd('0x1b')](0xcc)[_0x46bd('0x26')]();})[_0x46bd('0x46')](handleError(_0xe43fd1,null));};function getBucketslist(_0x446869,_0x32c6a0,_0x87f97){return new Promise(function(_0x2ee3d6,_0x310ec7){var _0xa2248f=new AWS['S3']({'accessKeyId':_0x32c6a0,'secretAccessKey':_0x446869,'region':_0x87f97});_0xa2248f['listBuckets']({},function(_0x3582bc,_0xba990d){if(_0x3582bc){return _0x310ec7(_0x3582bc);}else{return _0x2ee3d6(_0xba990d);}});});}function createBucket(_0x50c7cf,_0x4d7b57,_0x673e0,_0x22b4c6){return new Promise(function(_0x230024,_0x25a769){var _0x5dd631=new AWS['S3']({'accessKeyId':_0x4d7b57,'secretAccessKey':_0x50c7cf,'region':_0x673e0});_0x5dd631['createBucket']({'Bucket':_0x22b4c6},function(_0x5a3428,_0x48c140){if(_0x5a3428){return _0x25a769(_0x5a3428);}else{return _0x230024(_0x48c140);}});});}function uploadFile(_0x3a6d25,_0x457ae5,_0x5a8209,_0xa173df,_0x2e8d20,_0x47625a){return new Promise(function(_0x487947,_0x51c47b){var _0x1eca02=new AWS['S3']({'accessKeyId':_0x457ae5,'secretAccessKey':_0x3a6d25,'region':_0x5a8209});_0x1eca02[_0x46bd('0x6c')]({'Bucket':_0xa173df,'Key':_0x2e8d20,'Body':_0x47625a},function(_0x40fa3a,_0x1b563a){if(_0x40fa3a){return _0x51c47b(_0x40fa3a);}else{return _0x487947(_0x1b563a);}});});}function startTranscribe(_0x50060d,_0x3381b7,_0x201c7c,_0x2a7966,_0x3ab32f,_0x8ff9a){return new Promise(function(_0x1ddc99,_0x597ed9){var _0x193c35=new AWS[(_0x46bd('0x6d'))]({'accessKeyId':_0x3381b7,'secretAccessKey':_0x50060d,'region':_0x201c7c});_0x193c35['startTranscriptionJob']({'TranscriptionJobName':_0x2a7966,'LanguageCode':_0x3ab32f,'Media':{'MediaFileUri':_0x8ff9a}},function(_0x2a5f7c,_0x4b500b){if(_0x2a5f7c){return _0x597ed9(_0x2a5f7c);}else{return _0x1ddc99(_0x4b500b);}});});}function transcribe(_0x3f7d0e,_0x2da37a,_0x2b45d0,_0x40cd30,_0x2c4273,_0x5c47ee,_0x33b5d2){return new Promise(function(_0x2af4cf,_0x49eb3c){var _0x1da94c={};logger[_0x46bd('0x65')](util[_0x46bd('0x31')](_0x46bd('0x6e'),_0x3f7d0e,_0x2c4273));return uploadFile(_0x2da37a,_0x2b45d0,_0x40cd30,_0x2c4273,path[_0x46bd('0x6f')](_0x5c47ee),fs[_0x46bd('0x70')](_0x5c47ee))['then'](function(_0x2ec44e){logger[_0x46bd('0x65')](util[_0x46bd('0x31')](_0x46bd('0x71'),_0x3f7d0e,_0x2c4273,_0x2ec44e[_0x46bd('0x72')]));_0x1da94c[_0x46bd('0x73')]=_0x2ec44e[_0x46bd('0x74')];_0x1da94c[_0x46bd('0x75')]=_0x2ec44e[_0x46bd('0x72')];logger[_0x46bd('0x65')](util[_0x46bd('0x31')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x3f7d0e));return startTranscribe(_0x2da37a,_0x2b45d0,_0x40cd30,uuidv4(),_0x33b5d2,_0x2ec44e[_0x46bd('0x72')]);})[_0x46bd('0x25')](function(_0x1ceb7a){logger[_0x46bd('0x65')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x3f7d0e,_0x1ceb7a['TranscriptionJob'][_0x46bd('0x76')]));_0x1da94c[_0x46bd('0x77')]=_0x1ceb7a[_0x46bd('0x78')][_0x46bd('0x76')];_0x1da94c[_0x46bd('0x79')]=_0x1ceb7a[_0x46bd('0x78')][_0x46bd('0x7a')];return _0x2af4cf(_0x1da94c);})[_0x46bd('0x46')](function(_0x46a7e5){return _0x49eb3c(_0x46a7e5);});});}exports['runTranscribe']=function(_0x4707ef,_0x39433a,_0x5d42de){var _0x18d2a5;var _0x87501f;var _0x33e2bf;var _0x5bdc74=require(_0x46bd('0x50'));return db['VoiceRecording']['findOne']({'where':{'id':_0x4707ef[_0x46bd('0x4d')]['id']}})[_0x46bd('0x25')](function(_0x1df2b0){if(_0x1df2b0){var _0x238ad3=util[_0x46bd('0x31')](_0x46bd('0x53'),_0x1df2b0[_0x46bd('0x52')]);if(fs[_0x46bd('0x54')](_0x238ad3)){cypher=!![];return _0x5bdc74[_0x46bd('0x7b')](_0x238ad3,_0x1df2b0[_0x46bd('0x52')],config['secrets']['recording'])[_0x46bd('0x25')](function(){return _0x1df2b0;});}return _0x1df2b0;}})[_0x46bd('0x25')](function(_0x48c53f){if(!_0x48c53f){throw new db[(_0x46bd('0x56'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x87501f=_0x48c53f;return db[_0x46bd('0x7c')][_0x46bd('0x7d')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x39433a,null))[_0x46bd('0x25')](function(_0x2c1912){if(_0x2c1912){_0x18d2a5=_0x2c1912;if(!_0x18d2a5[_0x46bd('0x7e')]||!_0x18d2a5[_0x46bd('0x7f')]||!_0x18d2a5[_0x46bd('0x80')]||!_0x18d2a5[_0x46bd('0x81')]||!_0x18d2a5[_0x46bd('0x73')]){throw new db[(_0x46bd('0x56'))][(_0x46bd('0x57'))](_0x46bd('0x82'));}if(_0x4707ef['body'][_0x46bd('0x83')]&&(!_0x18d2a5['sentiment']||!_0x18d2a5[_0x46bd('0x84')]||!_0x18d2a5[_0x46bd('0x85')]||!_0x18d2a5[_0x46bd('0x81')]||!_0x18d2a5[_0x46bd('0x73')])){throw new db[(_0x46bd('0x56'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x46bd('0x86')][_0x46bd('0x7d')]({'where':{'id':_0x18d2a5[_0x46bd('0x7f')]}});}})['then'](function(_0x201467){if(!_0x201467){throw new db[(_0x46bd('0x56'))][(_0x46bd('0x57'))](_0x46bd('0x87'));}if(!_0x201467[_0x46bd('0x88')]||!_0x201467[_0x46bd('0x89')]){throw new db[(_0x46bd('0x56'))][(_0x46bd('0x57'))](_0x46bd('0x8a'));}_0x33e2bf=_0x201467;return getBucketslist(_0x33e2bf['data1'],_0x33e2bf[_0x46bd('0x89')],_0x18d2a5[_0x46bd('0x80')]);})[_0x46bd('0x25')](function(_0x56574e){if(_0x56574e&&_0x56574e[_0x46bd('0x8b')]){var _0xe2982c=_[_0x46bd('0x4b')](_0x56574e['Buckets'],function(_0x21648d){return _0x21648d[_0x46bd('0x8c')]===_0x18d2a5[_0x46bd('0x73')];});if(!_0xe2982c){logger[_0x46bd('0x65')](util[_0x46bd('0x31')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x4707ef[_0x46bd('0x4d')]['id'],_0x18d2a5[_0x46bd('0x73')]));return createBucket(_0x33e2bf[_0x46bd('0x88')],_0x33e2bf['data2'],_0x18d2a5[_0x46bd('0x80')],_0x18d2a5[_0x46bd('0x73')]);}logger[_0x46bd('0x65')](util['format'](_0x46bd('0x8d'),_0x4707ef[_0x46bd('0x4d')]['id'],_0x18d2a5[_0x46bd('0x73')]));return;}})[_0x46bd('0x25')](function(_0x1854ec){if(_0x87501f[_0x46bd('0x79')]===_0x46bd('0x8e')){return transcribe(_0x4707ef['params']['id'],_0x33e2bf[_0x46bd('0x88')],_0x33e2bf[_0x46bd('0x89')],_0x18d2a5['transcribeRegion'],_0x18d2a5['bucket'],_0x87501f[_0x46bd('0x52')],_0x18d2a5[_0x46bd('0x81')]);}else{logger[_0x46bd('0x65')](util[_0x46bd('0x31')](_0x46bd('0x8f'),_0x4707ef['params']['id']));return{'transcribeStatus':_0x46bd('0x90')};}})['then'](function(_0x9c3076){if(_0x9c3076){_0x9c3076[_0x46bd('0x91')]=_0x4707ef['body'][_0x46bd('0x83')];return _0x87501f[_0x46bd('0x92')](_0x9c3076);}})['then'](respondWithResult(_0x39433a,null))['catch'](handleError(_0x39433a,null));};function writeFile(_0x5c6359,_0x866764){return new Promise(function(_0x16714a,_0x58ed94){fs[_0x46bd('0x93')](_0x866764,_0x5c6359,function(_0x27d820,_0x4fc04f){if(_0x27d820){return _0x58ed94(_0x27d820);}else{return _0x16714a(_0x4fc04f);}});});}exports[_0x46bd('0x94')]=function(_0x1b9d50,_0x3f4500,_0x24e1e7){return db[_0x46bd('0x2d')][_0x46bd('0x7d')]({'where':{'id':_0x1b9d50[_0x46bd('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3f4500))[_0x46bd('0x25')](function(_0x2d3d04){if(_0x2d3d04&&_0x2d3d04[_0x46bd('0x95')]){var _0x4bc4dd=_0x2d3d04[_0x46bd('0x95')];var _0xbb0a13=config[_0x46bd('0x96')]+_0x46bd('0x97')+_0x2d3d04['id']+_0x46bd('0x98');if(fs[_0x46bd('0x54')](_0xbb0a13)){return _0xbb0a13;}return writeFile(_0x4bc4dd,_0xbb0a13)[_0x46bd('0x25')](function(){return _0xbb0a13;});}else{throw new db['Sequelize'][(_0x46bd('0x57'))](_0x46bd('0x99'));}})['then'](function(_0x3fddb2){return _0x3f4500['download'](_0x3fddb2);})[_0x46bd('0x46')](handleError(_0x3f4500));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 11b168d..9f31069 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 _0x8ac8=['voice_recordings','uniqueid','lodash','moment','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','VoiceRecording'];(function(_0xeec3c0,_0x1ee2ff){var _0x3d5daf=function(_0x4370f9){while(--_0x4370f9){_0xeec3c0['push'](_0xeec3c0['shift']());}};_0x3d5daf(++_0x1ee2ff);}(_0x8ac8,0x86));var _0x88ac=function(_0x3bce59,_0x63c5df){_0x3bce59=_0x3bce59-0x0;var _0x4edbea=_0x8ac8[_0x3bce59];return _0x4edbea;};'use strict';var _=require(_0x88ac('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x88ac('0x1'));var BPromise=require('bluebird');var rp=require(_0x88ac('0x2'));var fs=require('fs');var path=require(_0x88ac('0x3'));var rimraf=require(_0x88ac('0x4'));var config=require(_0x88ac('0x5'));var attributes=require(_0x88ac('0x6'));module[_0x88ac('0x7')]=function(_0x33ce08,_0xc5a45a){return _0x33ce08['define'](_0x88ac('0x8'),attributes,{'tableName':_0x88ac('0x9'),'paranoid':![],'indexes':[{'name':_0x88ac('0xa'),'fields':[_0x88ac('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd96b=['../../config/environment','./voiceRecording.attributes','define','voice_recordings','uniqueid','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);}(_0xd96b,0x6d));var _0xbd96=function(_0x54f591,_0x1c98c6){_0x54f591=_0x54f591-0x0;var _0x290457=_0xd96b[_0x54f591];return _0x290457;};'use strict';var _=require('lodash');var util=require(_0xbd96('0x0'));var logger=require(_0xbd96('0x1'))(_0xbd96('0x2'));var moment=require(_0xbd96('0x3'));var BPromise=require(_0xbd96('0x4'));var rp=require(_0xbd96('0x5'));var fs=require('fs');var path=require(_0xbd96('0x6'));var rimraf=require(_0xbd96('0x7'));var config=require(_0xbd96('0x8'));var attributes=require(_0xbd96('0x9'));module['exports']=function(_0x2e2adb,_0x46d0c8){return _0x2e2adb[_0xbd96('0xa')]('VoiceRecording',attributes,{'tableName':_0xbd96('0xb'),'paranoid':![],'indexes':[{'name':_0xbd96('0xc'),'fields':[_0xbd96('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 dc66e27..574c4f7 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(_0x48ac40,_0x1e3beb){var _0x55df02=function(_0x5e27d6){while(--_0x5e27d6){_0x48ac40['push'](_0x48ac40['shift']());}};_0x55df02(++_0x1e3beb);}(_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);});});}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(_0x97501e,_0x48c8fd){var _0x5919c8=function(_0x4033bd){while(--_0x4033bd){_0x97501e['push'](_0x97501e['shift']());}};_0x5919c8(++_0x48c8fd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 0f84f4b..f0d71da 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 _0x6d38=['path','connect-timeout','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','exports','util'];(function(_0x382799,_0x5f3320){var _0x34a4e3=function(_0xe9d343){while(--_0xe9d343){_0x382799['push'](_0x382799['shift']());}};_0x34a4e3(++_0x5f3320);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6d38[_0x2b4411];return _0x8e41ef;};'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 _0x4975=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','show','post','create','/:id','update','delete','destroy'];(function(_0x459a83,_0x384ed7){var _0x3fbae4=function(_0x37933d){while(--_0x37933d){_0x459a83['push'](_0x459a83['shift']());}};_0x3fbae4(++_0x384ed7);}(_0x4975,0x86));var _0x5497=function(_0x494355,_0x556552){_0x494355=_0x494355-0x0;var _0x228825=_0x4975[_0x494355];return _0x228825;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var auth=require(_0x5497('0x5'));var interaction=require(_0x5497('0x6'));var config=require(_0x5497('0x7'));var controller=require(_0x5497('0x8'));router[_0x5497('0x9')]('/',auth[_0x5497('0xa')](),controller['index']);router[_0x5497('0x9')]('/:id',auth[_0x5497('0xa')](),controller[_0x5497('0xb')]);router[_0x5497('0xc')]('/',auth['isAuthenticated'](),controller[_0x5497('0xd')]);router['put'](_0x5497('0xe'),auth[_0x5497('0xa')](),controller[_0x5497('0xf')]);router[_0x5497('0x10')](_0x5497('0xe'),auth[_0x5497('0xa')](),controller[_0x5497('0x11')]);module[_0x5497('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index b183ae4..b17e78d 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 _0x0203=['sequelize','moment','ENUM','blind','attended','STRING','Yes'];(function(_0x21bb46,_0x4aa448){var _0x26f8ab=function(_0x26f9d3){while(--_0x26f9d3){_0x21bb46['push'](_0x21bb46['shift']());}};_0x26f8ab(++_0x4aa448);}(_0x0203,0x77));var _0x3020=function(_0x545168,_0x215698){_0x545168=_0x545168-0x0;var _0x3d20c8=_0x0203[_0x545168];return _0x3d20c8;};'use strict';var Sequelize=require(_0x3020('0x0'));var moment=require(_0x3020('0x1'));module['exports']={'type':{'type':Sequelize[_0x3020('0x2')](_0x3020('0x3'),_0x3020('0x4'))},'result':{'type':Sequelize[_0x3020('0x5')]},'transfererchannel':{'type':Sequelize[_0x3020('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x3020('0x5')]},'transferercalleridname':{'type':Sequelize[_0x3020('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x3020('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x3020('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x3020('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x3020('0x5')]},'transfereechannel':{'type':Sequelize[_0x3020('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x3020('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x3020('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x3020('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x3020('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x3020('0x5')]},'transfereeexten':{'type':Sequelize[_0x3020('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x3020('0x2')](_0x3020('0x6'),'No')},'context':{'type':Sequelize[_0x3020('0x5')]},'extension':{'type':Sequelize[_0x3020('0x5')]}}; \ No newline at end of file +var _0x6d20=['blind','attended','STRING','exports','ENUM'];(function(_0x54d52,_0x2473ba){var _0x968345=function(_0x3fcd06){while(--_0x3fcd06){_0x54d52['push'](_0x54d52['shift']());}};_0x968345(++_0x2473ba);}(_0x6d20,0x116));var _0x06d2=function(_0x2f1172,_0x5f5b26){_0x2f1172=_0x2f1172-0x0;var _0x58e374=_0x6d20[_0x2f1172];return _0x58e374;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x06d2('0x0')]={'type':{'type':Sequelize[_0x06d2('0x1')](_0x06d2('0x2'),_0x06d2('0x3'))},'result':{'type':Sequelize[_0x06d2('0x4')]},'transfererchannel':{'type':Sequelize[_0x06d2('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x06d2('0x4')]},'transferercalleridname':{'type':Sequelize[_0x06d2('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x06d2('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x06d2('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x06d2('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x06d2('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x06d2('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x06d2('0x4')]},'transfereecontext':{'type':Sequelize[_0x06d2('0x4')]},'transfereeexten':{'type':Sequelize[_0x06d2('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0x06d2('0x4')]},'extension':{'type':Sequelize[_0x06d2('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 6dcb60b..2f4a2ed 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 _0x3495=['error','name','send','index','map','VoiceTransferReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','rows','show','params','options','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then'];(function(_0x12ea6e,_0x309cb7){var _0x557dd9=function(_0x12741c){while(--_0x12741c){_0x12ea6e['push'](_0x12ea6e['shift']());}};_0x557dd9(++_0x309cb7);}(_0x3495,0x1de));var _0x5349=function(_0x448a72,_0x380ed3){_0x448a72=_0x448a72-0x0;var _0x4e3fc0=_0x3495[_0x448a72];return _0x4e3fc0;};'use strict';var pdf=require(_0x5349('0x0'));var emlformat=require(_0x5349('0x1'));var rimraf=require(_0x5349('0x2'));var zipdir=require(_0x5349('0x3'));var jsonpatch=require(_0x5349('0x4'));var rp=require(_0x5349('0x5'));var moment=require(_0x5349('0x6'));var BPromise=require(_0x5349('0x7'));var Mustache=require(_0x5349('0x8'));var util=require('util');var path=require(_0x5349('0x9'));var sox=require(_0x5349('0xa'));var csv=require('to-csv');var ejs=require(_0x5349('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5349('0xc'));var crypto=require('crypto');var jsforce=require(_0x5349('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5349('0xe'));var querystring=require(_0x5349('0xf'));var Papa=require(_0x5349('0x10'));var Redis=require(_0x5349('0x11'));var authService=require(_0x5349('0x12'));var qs=require(_0x5349('0x13'));var as=require(_0x5349('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5349('0x15'))('api');var utils=require(_0x5349('0x16'));var config=require(_0x5349('0x17'));var licenseUtil=require(_0x5349('0x18'));var db=require(_0x5349('0x19'))['db'];function respondWithStatusCode(_0x2f5172,_0x3c592a){_0x3c592a=_0x3c592a||0xcc;return function(_0x642966){if(_0x642966){return _0x2f5172[_0x5349('0x1a')](_0x3c592a);}return _0x2f5172[_0x5349('0x1b')](_0x3c592a)[_0x5349('0x1c')]();};}function respondWithResult(_0x534e31,_0x2fde66){_0x2fde66=_0x2fde66||0xc8;return function(_0x367c25){if(_0x367c25){return _0x534e31['status'](_0x2fde66)[_0x5349('0x1d')](_0x367c25);}};}function respondWithFilteredResult(_0x269f7f,_0x2fe611){return function(_0x49bbec){if(_0x49bbec){var _0x5bcb3a=_0x49bbec[_0x5349('0x1e')],_0x558fbb=_0x2fe611['offset'],_0x1fcbba=_0x2fe611[_0x5349('0x1f')]+_0x2fe611[_0x5349('0x20')],_0x5c873d;if(_0x1fcbba>=_0x5bcb3a){_0x1fcbba=_0x5bcb3a;_0x5c873d=0xc8;}else{_0x5c873d=0xce;}_0x269f7f[_0x5349('0x1b')](_0x5c873d);return _0x269f7f[_0x5349('0x21')]('Content-Range',_0x558fbb+'-'+_0x1fcbba+'/'+_0x5bcb3a)[_0x5349('0x1d')](_0x49bbec);}return null;};}function patchUpdates(_0x24e74c){return function(_0x8abbe3){try{jsonpatch[_0x5349('0x22')](_0x8abbe3,_0x24e74c,!![]);}catch(_0x4be827){return BPromise[_0x5349('0x23')](_0x4be827);}return _0x8abbe3[_0x5349('0x24')]();};}function saveUpdates(_0x4f2cb6,_0x4c96dc){return function(_0x491c84){if(_0x491c84){return _0x491c84[_0x5349('0x25')](_0x4f2cb6)['then'](function(_0x270593){return _0x270593;});}return null;};}function removeEntity(_0x1ff911,_0x164978){return function(_0x6c80cd){if(_0x6c80cd){return _0x6c80cd[_0x5349('0x26')]()[_0x5349('0x27')](function(){_0x1ff911[_0x5349('0x1b')](0xcc)[_0x5349('0x1c')]();});}};}function handleEntityNotFound(_0x2a3258,_0x34353f){return function(_0x1a84ce){if(!_0x1a84ce){_0x2a3258[_0x5349('0x1a')](0x194);}return _0x1a84ce;};}function handleError(_0x57af6c,_0x12d67c){_0x12d67c=_0x12d67c||0x1f4;return function(_0x187b39){logger[_0x5349('0x28')](_0x187b39['stack']);if(_0x187b39[_0x5349('0x29')]){delete _0x187b39['name'];}_0x57af6c[_0x5349('0x1b')](_0x12d67c)[_0x5349('0x2a')](_0x187b39);};}exports[_0x5349('0x2b')]=function(_0x49153e,_0x1b5e87){var _0xc3e727={},_0x228dce={},_0x339f9a={'count':0x0,'rows':[]};var _0x180bc7=_[_0x5349('0x2c')](db[_0x5349('0x2d')][_0x5349('0x2e')],function(_0x39b3a9){return{'name':_0x39b3a9['fieldName'],'type':_0x39b3a9[_0x5349('0x2f')][_0x5349('0x30')]};});_0x228dce['model']=_[_0x5349('0x2c')](_0x180bc7,'name');_0x228dce[_0x5349('0x31')]=_[_0x5349('0x32')](_0x49153e[_0x5349('0x31')]);_0x228dce[_0x5349('0x33')]=_[_0x5349('0x34')](_0x228dce[_0x5349('0x35')],_0x228dce['query']);_0xc3e727[_0x5349('0x36')]=_[_0x5349('0x34')](_0x228dce[_0x5349('0x35')],qs[_0x5349('0x37')](_0x49153e['query']['fields']));_0xc3e727[_0x5349('0x36')]=_0xc3e727[_0x5349('0x36')][_0x5349('0x38')]?_0xc3e727['attributes']:_0x228dce[_0x5349('0x35')];if(!_0x49153e['query'][_0x5349('0x39')](_0x5349('0x3a'))){_0xc3e727[_0x5349('0x20')]=qs[_0x5349('0x20')](_0x49153e[_0x5349('0x31')][_0x5349('0x20')]);_0xc3e727['offset']=qs['offset'](_0x49153e[_0x5349('0x31')][_0x5349('0x1f')]);}_0xc3e727[_0x5349('0x3b')]=qs[_0x5349('0x3c')](_0x49153e[_0x5349('0x31')][_0x5349('0x3c')]);_0xc3e727[_0x5349('0x3d')]=qs['filters'](_['pick'](_0x49153e[_0x5349('0x31')],_0x228dce['filters']),_0x180bc7);if(_0x49153e['query'][_0x5349('0x3e')]){_0xc3e727['where']=_[_0x5349('0x3f')](_0xc3e727[_0x5349('0x3d')],{'$or':_[_0x5349('0x2c')](_0x180bc7,function(_0x47be36){if(_0x47be36[_0x5349('0x2f')]!=='VIRTUAL'){var _0x3c9a9d={};_0x3c9a9d[_0x47be36[_0x5349('0x29')]]={'$like':'%'+_0x49153e[_0x5349('0x31')]['filter']+'%'};return _0x3c9a9d;}})});}_0xc3e727=_['merge']({},_0xc3e727,_0x49153e['options']);var _0x84592b={'where':_0xc3e727[_0x5349('0x3d')]};return db[_0x5349('0x2d')][_0x5349('0x1e')](_0x84592b)[_0x5349('0x27')](function(_0x44715c){_0x339f9a['count']=_0x44715c;if(_0x49153e['query'][_0x5349('0x40')]){_0xc3e727[_0x5349('0x41')]=[{'all':!![]}];}return db[_0x5349('0x2d')]['findAll'](_0xc3e727);})[_0x5349('0x27')](function(_0x30ea46){_0x339f9a[_0x5349('0x42')]=_0x30ea46;return _0x339f9a;})[_0x5349('0x27')](respondWithFilteredResult(_0x1b5e87,_0xc3e727))['catch'](handleError(_0x1b5e87,null));};exports[_0x5349('0x43')]=function(_0x53beff,_0x39a154){var _0x196d68={'raw':!![],'where':{'id':_0x53beff[_0x5349('0x44')]['id']}},_0x5652b4={};_0x5652b4[_0x5349('0x35')]=_[_0x5349('0x32')](db[_0x5349('0x2d')][_0x5349('0x2e')]);_0x5652b4[_0x5349('0x31')]=_[_0x5349('0x32')](_0x53beff['query']);_0x5652b4['filtears']=_[_0x5349('0x34')](_0x5652b4[_0x5349('0x35')],_0x5652b4[_0x5349('0x31')]);_0x196d68[_0x5349('0x36')]=_['intersection'](_0x5652b4[_0x5349('0x35')],qs['fields'](_0x53beff['query'][_0x5349('0x37')]));_0x196d68[_0x5349('0x36')]=_0x196d68[_0x5349('0x36')][_0x5349('0x38')]?_0x196d68['attributes']:_0x5652b4[_0x5349('0x35')];if(_0x53beff[_0x5349('0x31')][_0x5349('0x40')]){_0x196d68[_0x5349('0x41')]=[{'all':!![]}];}_0x196d68=_[_0x5349('0x3f')]({},_0x196d68,_0x53beff[_0x5349('0x45')]);return db[_0x5349('0x2d')][_0x5349('0x46')](_0x196d68)[_0x5349('0x27')](handleEntityNotFound(_0x39a154,null))[_0x5349('0x27')](respondWithResult(_0x39a154,null))[_0x5349('0x47')](handleError(_0x39a154,null));};exports[_0x5349('0x48')]=function(_0x1e683,_0x191cef){return db['VoiceTransferReport']['create'](_0x1e683[_0x5349('0x49')],{})[_0x5349('0x27')](respondWithResult(_0x191cef,0xc9))[_0x5349('0x47')](handleError(_0x191cef,null));};exports[_0x5349('0x25')]=function(_0x5e8cf3,_0x24e2d1){if(_0x5e8cf3['body']['id']){delete _0x5e8cf3[_0x5349('0x49')]['id'];}return db[_0x5349('0x2d')][_0x5349('0x46')]({'where':{'id':_0x5e8cf3[_0x5349('0x44')]['id']}})[_0x5349('0x27')](handleEntityNotFound(_0x24e2d1,null))[_0x5349('0x27')](saveUpdates(_0x5e8cf3['body'],null))[_0x5349('0x27')](respondWithResult(_0x24e2d1,null))['catch'](handleError(_0x24e2d1,null));};exports[_0x5349('0x26')]=function(_0x39c77b,_0x35ca92){return db[_0x5349('0x2d')][_0x5349('0x46')]({'where':{'id':_0x39c77b['params']['id']}})[_0x5349('0x27')](handleEntityNotFound(_0x35ca92,null))[_0x5349('0x27')](removeEntity(_0x35ca92,null))[_0x5349('0x47')](handleError(_0x35ca92,null));}; \ No newline at end of file +var _0x90db=['include','findAll','rows','catch','show','params','filtears','find','create','body','eml-format','rimraf','zip-dir','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll'];(function(_0x2fb28c,_0x458fc5){var _0x22ee82=function(_0x47aa1c){while(--_0x47aa1c){_0x2fb28c['push'](_0x2fb28c['shift']());}};_0x22ee82(++_0x458fc5);}(_0x90db,0x1c0));var _0xb90d=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x90db[_0x9df060];return _0x338dfe;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb90d('0x0'));var rimraf=require(_0xb90d('0x1'));var zipdir=require(_0xb90d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb90d('0x3'));var path=require(_0xb90d('0x4'));var sox=require(_0xb90d('0x5'));var csv=require(_0xb90d('0x6'));var ejs=require(_0xb90d('0x7'));var fs=require('fs');var _=require(_0xb90d('0x8'));var squel=require(_0xb90d('0x9'));var crypto=require(_0xb90d('0xa'));var jsforce=require(_0xb90d('0xb'));var deskjs=require(_0xb90d('0xc'));var toCsv=require(_0xb90d('0x6'));var querystring=require(_0xb90d('0xd'));var Papa=require('papaparse');var Redis=require(_0xb90d('0xe'));var authService=require(_0xb90d('0xf'));var qs=require(_0xb90d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb90d('0x11'));var logger=require(_0xb90d('0x12'))(_0xb90d('0x13'));var utils=require(_0xb90d('0x14'));var config=require(_0xb90d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb90d('0x16'))['db'];function respondWithStatusCode(_0x5bc2b9,_0xe1b1d6){_0xe1b1d6=_0xe1b1d6||0xcc;return function(_0x1d5eed){if(_0x1d5eed){return _0x5bc2b9[_0xb90d('0x17')](_0xe1b1d6);}return _0x5bc2b9[_0xb90d('0x18')](_0xe1b1d6)[_0xb90d('0x19')]();};}function respondWithResult(_0x1152fb,_0x1f797c){_0x1f797c=_0x1f797c||0xc8;return function(_0x56c67c){if(_0x56c67c){return _0x1152fb[_0xb90d('0x18')](_0x1f797c)['json'](_0x56c67c);}};}function respondWithFilteredResult(_0x13dbd5,_0x469d74){return function(_0x5af3c4){if(_0x5af3c4){var _0x1b2324=_0x5af3c4[_0xb90d('0x1a')],_0x5a4d4d=_0x469d74[_0xb90d('0x1b')],_0x28912e=_0x469d74[_0xb90d('0x1b')]+_0x469d74['limit'],_0x396f3f;if(_0x28912e>=_0x1b2324){_0x28912e=_0x1b2324;_0x396f3f=0xc8;}else{_0x396f3f=0xce;}_0x13dbd5[_0xb90d('0x18')](_0x396f3f);return _0x13dbd5['set'](_0xb90d('0x1c'),_0x5a4d4d+'-'+_0x28912e+'/'+_0x1b2324)['json'](_0x5af3c4);}return null;};}function patchUpdates(_0x5a91e1){return function(_0x73eae9){try{jsonpatch[_0xb90d('0x1d')](_0x73eae9,_0x5a91e1,!![]);}catch(_0x4598c2){return BPromise[_0xb90d('0x1e')](_0x4598c2);}return _0x73eae9[_0xb90d('0x1f')]();};}function saveUpdates(_0x134076,_0x4d3a04){return function(_0x12c62b){if(_0x12c62b){return _0x12c62b[_0xb90d('0x20')](_0x134076)['then'](function(_0x1393ac){return _0x1393ac;});}return null;};}function removeEntity(_0x21d28e,_0x3b3b80){return function(_0x39dcc4){if(_0x39dcc4){return _0x39dcc4[_0xb90d('0x21')]()[_0xb90d('0x22')](function(){_0x21d28e[_0xb90d('0x18')](0xcc)[_0xb90d('0x19')]();});}};}function handleEntityNotFound(_0x37b8ec,_0x1cf8cc){return function(_0x1581d3){if(!_0x1581d3){_0x37b8ec[_0xb90d('0x17')](0x194);}return _0x1581d3;};}function handleError(_0x350218,_0x582a4e){_0x582a4e=_0x582a4e||0x1f4;return function(_0x280ec3){logger['error'](_0x280ec3[_0xb90d('0x23')]);if(_0x280ec3[_0xb90d('0x24')]){delete _0x280ec3[_0xb90d('0x24')];}_0x350218[_0xb90d('0x18')](_0x582a4e)[_0xb90d('0x25')](_0x280ec3);};}exports[_0xb90d('0x26')]=function(_0x1149e5,_0x18a69b){var _0x29d8ea={},_0x3af742={},_0x59097a={'count':0x0,'rows':[]};var _0x2ce8f8=_[_0xb90d('0x27')](db[_0xb90d('0x28')][_0xb90d('0x29')],function(_0x1f9151){return{'name':_0x1f9151[_0xb90d('0x2a')],'type':_0x1f9151['type']['key']};});_0x3af742['model']=_[_0xb90d('0x27')](_0x2ce8f8,'name');_0x3af742[_0xb90d('0x2b')]=_[_0xb90d('0x2c')](_0x1149e5['query']);_0x3af742[_0xb90d('0x2d')]=_[_0xb90d('0x2e')](_0x3af742[_0xb90d('0x2f')],_0x3af742[_0xb90d('0x2b')]);_0x29d8ea[_0xb90d('0x30')]=_[_0xb90d('0x2e')](_0x3af742[_0xb90d('0x2f')],qs[_0xb90d('0x31')](_0x1149e5[_0xb90d('0x2b')][_0xb90d('0x31')]));_0x29d8ea[_0xb90d('0x30')]=_0x29d8ea[_0xb90d('0x30')][_0xb90d('0x32')]?_0x29d8ea[_0xb90d('0x30')]:_0x3af742[_0xb90d('0x2f')];if(!_0x1149e5[_0xb90d('0x2b')][_0xb90d('0x33')](_0xb90d('0x34'))){_0x29d8ea['limit']=qs['limit'](_0x1149e5[_0xb90d('0x2b')][_0xb90d('0x35')]);_0x29d8ea[_0xb90d('0x1b')]=qs[_0xb90d('0x1b')](_0x1149e5[_0xb90d('0x2b')][_0xb90d('0x1b')]);}_0x29d8ea[_0xb90d('0x36')]=qs['sort'](_0x1149e5[_0xb90d('0x2b')]['sort']);_0x29d8ea[_0xb90d('0x37')]=qs[_0xb90d('0x2d')](_[_0xb90d('0x38')](_0x1149e5[_0xb90d('0x2b')],_0x3af742[_0xb90d('0x2d')]),_0x2ce8f8);if(_0x1149e5[_0xb90d('0x2b')][_0xb90d('0x39')]){_0x29d8ea[_0xb90d('0x37')]=_[_0xb90d('0x3a')](_0x29d8ea['where'],{'$or':_[_0xb90d('0x27')](_0x2ce8f8,function(_0x8fa42d){if(_0x8fa42d[_0xb90d('0x3b')]!==_0xb90d('0x3c')){var _0x5c48dd={};_0x5c48dd[_0x8fa42d[_0xb90d('0x24')]]={'$like':'%'+_0x1149e5[_0xb90d('0x2b')][_0xb90d('0x39')]+'%'};return _0x5c48dd;}})});}_0x29d8ea=_[_0xb90d('0x3a')]({},_0x29d8ea,_0x1149e5[_0xb90d('0x3d')]);var _0x4adffe={'where':_0x29d8ea[_0xb90d('0x37')]};return db[_0xb90d('0x28')][_0xb90d('0x1a')](_0x4adffe)[_0xb90d('0x22')](function(_0x56181a){_0x59097a[_0xb90d('0x1a')]=_0x56181a;if(_0x1149e5[_0xb90d('0x2b')][_0xb90d('0x3e')]){_0x29d8ea[_0xb90d('0x3f')]=[{'all':!![]}];}return db[_0xb90d('0x28')][_0xb90d('0x40')](_0x29d8ea);})[_0xb90d('0x22')](function(_0x1e7252){_0x59097a[_0xb90d('0x41')]=_0x1e7252;return _0x59097a;})[_0xb90d('0x22')](respondWithFilteredResult(_0x18a69b,_0x29d8ea))[_0xb90d('0x42')](handleError(_0x18a69b,null));};exports[_0xb90d('0x43')]=function(_0x428cbb,_0x238a36){var _0x44044f={'raw':!![],'where':{'id':_0x428cbb[_0xb90d('0x44')]['id']}},_0x3d5ef3={};_0x3d5ef3['model']=_[_0xb90d('0x2c')](db['VoiceTransferReport'][_0xb90d('0x29')]);_0x3d5ef3['query']=_[_0xb90d('0x2c')](_0x428cbb[_0xb90d('0x2b')]);_0x3d5ef3[_0xb90d('0x45')]=_[_0xb90d('0x2e')](_0x3d5ef3[_0xb90d('0x2f')],_0x3d5ef3['query']);_0x44044f[_0xb90d('0x30')]=_[_0xb90d('0x2e')](_0x3d5ef3['model'],qs['fields'](_0x428cbb['query']['fields']));_0x44044f[_0xb90d('0x30')]=_0x44044f[_0xb90d('0x30')]['length']?_0x44044f[_0xb90d('0x30')]:_0x3d5ef3['model'];if(_0x428cbb[_0xb90d('0x2b')]['includeAll']){_0x44044f['include']=[{'all':!![]}];}_0x44044f=_[_0xb90d('0x3a')]({},_0x44044f,_0x428cbb[_0xb90d('0x3d')]);return db[_0xb90d('0x28')][_0xb90d('0x46')](_0x44044f)[_0xb90d('0x22')](handleEntityNotFound(_0x238a36,null))['then'](respondWithResult(_0x238a36,null))[_0xb90d('0x42')](handleError(_0x238a36,null));};exports[_0xb90d('0x47')]=function(_0x4086bc,_0x505b5){return db[_0xb90d('0x28')][_0xb90d('0x47')](_0x4086bc[_0xb90d('0x48')],{})['then'](respondWithResult(_0x505b5,0xc9))[_0xb90d('0x42')](handleError(_0x505b5,null));};exports[_0xb90d('0x20')]=function(_0x35d363,_0x4fa155){if(_0x35d363[_0xb90d('0x48')]['id']){delete _0x35d363[_0xb90d('0x48')]['id'];}return db[_0xb90d('0x28')]['find']({'where':{'id':_0x35d363['params']['id']}})[_0xb90d('0x22')](handleEntityNotFound(_0x4fa155,null))[_0xb90d('0x22')](saveUpdates(_0x35d363[_0xb90d('0x48')],null))[_0xb90d('0x22')](respondWithResult(_0x4fa155,null))[_0xb90d('0x42')](handleError(_0x4fa155,null));};exports[_0xb90d('0x21')]=function(_0x2afb4c,_0x2c53b1){return db[_0xb90d('0x28')][_0xb90d('0x46')]({'where':{'id':_0x2afb4c[_0xb90d('0x44')]['id']}})[_0xb90d('0x22')](handleEntityNotFound(_0x2c53b1,null))[_0xb90d('0x22')](removeEntity(_0x2c53b1,null))[_0xb90d('0x42')](handleError(_0x2c53b1,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index ac0202d..a81c09e 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 _0x16a2=['define','VoiceTransferReport','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./voiceTransferReport.attributes'];(function(_0x28f205,_0x37858d){var _0x519175=function(_0x337159){while(--_0x337159){_0x28f205['push'](_0x28f205['shift']());}};_0x519175(++_0x37858d);}(_0x16a2,0x1d0));var _0x216a=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0x16a2[_0x3cb6dc];return _0x47ec89;};'use strict';var _=require(_0x216a('0x0'));var util=require(_0x216a('0x1'));var logger=require(_0x216a('0x2'))(_0x216a('0x3'));var moment=require(_0x216a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x216a('0x5'));var rimraf=require(_0x216a('0x6'));var config=require(_0x216a('0x7'));var attributes=require(_0x216a('0x8'));module['exports']=function(_0x4d97cd,_0x4456ad){return _0x4d97cd[_0x216a('0x9')](_0x216a('0xa'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfa5=['path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','lodash','util'];(function(_0x2a4a56,_0xf7e6ed){var _0x4b0b3e=function(_0x52ef43){while(--_0x52ef43){_0x2a4a56['push'](_0x2a4a56['shift']());}};_0x4b0b3e(++_0xf7e6ed);}(_0xcfa5,0xbb));var _0x5cfa=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xcfa5[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x5cfa('0x0'));var util=require(_0x5cfa('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5cfa('0x2'));var rimraf=require(_0x5cfa('0x3'));var config=require(_0x5cfa('0x4'));var attributes=require(_0x5cfa('0x5'));module[_0x5cfa('0x6')]=function(_0x4d79d0,_0x28446c){return _0x4d79d0['define'](_0x5cfa('0x7'),attributes,{'tableName':_0x5cfa('0x8'),'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 92aa25c..8c681dd 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 _0x44d4=['VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x44d4,0x161));var _0x444d=function(_0x3cb530,_0x170e8c){_0x3cb530=_0x3cb530-0x0;var _0x4168ea=_0x44d4[_0x3cb530];return _0x4168ea;};'use strict';var _=require(_0x444d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x444d('0x1'));var fs=require('fs');var Redis=require(_0x444d('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x444d('0x3'));var config=require(_0x444d('0x4'));var jayson=require(_0x444d('0x5'));var client=jayson[_0x444d('0x6')][_0x444d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x33fe8c,_0x300f01,_0x58e34d){return new BPromise(function(_0x38938a,_0x56e84b){return client[_0x444d('0x8')](_0x33fe8c,_0x58e34d)[_0x444d('0x9')](function(_0x87d3e8){logger[_0x444d('0xa')](_0x444d('0xb'),_0x300f01,_0x444d('0xc'));logger[_0x444d('0xd')](_0x444d('0xe'),_0x300f01,_0x444d('0xc'),JSON[_0x444d('0xf')](_0x87d3e8));if(_0x87d3e8[_0x444d('0x10')]){if(_0x87d3e8['error'][_0x444d('0x11')]===0x1f4){logger[_0x444d('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x300f01,_0x87d3e8[_0x444d('0x10')][_0x444d('0x12')]);return _0x56e84b(_0x87d3e8[_0x444d('0x10')]['message']);}logger[_0x444d('0x10')](_0x444d('0xb'),_0x300f01,_0x87d3e8[_0x444d('0x10')]['message']);return _0x38938a(_0x87d3e8[_0x444d('0x10')]['message']);}else{logger[_0x444d('0xa')](_0x444d('0xb'),_0x300f01,_0x444d('0xc'));_0x38938a(_0x87d3e8[_0x444d('0x13')]['message']);}})['catch'](function(_0x4da5e3){logger['error'](_0x444d('0xb'),_0x300f01,_0x4da5e3);_0x56e84b(_0x4da5e3);});});}exports[_0x444d('0x14')]=function(_0x171c35){var _0x5eb11e=this;return new Promise(function(_0x54e12a,_0x2f7809){return db[_0x444d('0x15')][_0x444d('0x16')](_0x171c35[_0x444d('0x17')],{'raw':_0x171c35[_0x444d('0x18')]?_0x171c35['options'][_0x444d('0x19')]===undefined?!![]:![]:!![]})[_0x444d('0x9')](function(_0x2c0e2a){logger[_0x444d('0xa')](_0x444d('0x14'),_0x171c35);logger[_0x444d('0xd')](_0x444d('0x14'),_0x171c35,JSON['stringify'](_0x2c0e2a));_0x54e12a(_0x2c0e2a);})['catch'](function(_0xe2cd4d){logger['error']('CreateVoiceTransferReport',_0xe2cd4d[_0x444d('0x12')],_0x171c35);_0x2f7809(_0x5eb11e[_0x444d('0x10')](0x1f4,_0xe2cd4d[_0x444d('0x12')]));});});}; \ No newline at end of file +var _0x2305=['VoiceTransferReport','create','options','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateVoiceTransferReport'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x2305,0x122));var _0x5230=function(_0x19efbc,_0x10b7d7){_0x19efbc=_0x19efbc-0x0;var _0x205c5e=_0x2305[_0x19efbc];return _0x205c5e;};'use strict';var _=require(_0x5230('0x0'));var util=require(_0x5230('0x1'));var moment=require(_0x5230('0x2'));var BPromise=require(_0x5230('0x3'));var rs=require(_0x5230('0x4'));var fs=require('fs');var Redis=require(_0x5230('0x5'));var db=require(_0x5230('0x6'))['db'];var utils=require(_0x5230('0x7'));var logger=require('../../config/logger')(_0x5230('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5230('0x9')][_0x5230('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x154e19,_0x5e9fdc,_0x21daf1){return new BPromise(function(_0x51c6d6,_0x12e4ce){return client[_0x5230('0xb')](_0x154e19,_0x21daf1)['then'](function(_0x44f029){logger[_0x5230('0xc')](_0x5230('0xd'),_0x5e9fdc,_0x5230('0xe'));logger[_0x5230('0xf')](_0x5230('0x10'),_0x5e9fdc,'request\x20sent',JSON['stringify'](_0x44f029));if(_0x44f029[_0x5230('0x11')]){if(_0x44f029[_0x5230('0x11')][_0x5230('0x12')]===0x1f4){logger[_0x5230('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x5e9fdc,_0x44f029[_0x5230('0x11')]['message']);return _0x12e4ce(_0x44f029[_0x5230('0x11')][_0x5230('0x13')]);}logger[_0x5230('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x5e9fdc,_0x44f029[_0x5230('0x11')][_0x5230('0x13')]);return _0x51c6d6(_0x44f029['error']['message']);}else{logger[_0x5230('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x5e9fdc,_0x5230('0xe'));_0x51c6d6(_0x44f029[_0x5230('0x14')][_0x5230('0x13')]);}})['catch'](function(_0x3b3ada){logger[_0x5230('0x11')](_0x5230('0xd'),_0x5e9fdc,_0x3b3ada);_0x12e4ce(_0x3b3ada);});});}exports[_0x5230('0x15')]=function(_0x5addc9){var _0x2d2b9a=this;return new Promise(function(_0x54f403,_0x2a0036){return db[_0x5230('0x16')][_0x5230('0x17')](_0x5addc9['body'],{'raw':_0x5addc9[_0x5230('0x18')]?_0x5addc9['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1ea59a){logger[_0x5230('0xc')](_0x5230('0x15'),_0x5addc9);logger[_0x5230('0xf')](_0x5230('0x15'),_0x5addc9,JSON[_0x5230('0x19')](_0x1ea59a));_0x54f403(_0x1ea59a);})['catch'](function(_0x41efd8){logger[_0x5230('0x11')](_0x5230('0x15'),_0x41efd8[_0x5230('0x13')],_0x5addc9);_0x2a0036(_0x2d2b9a[_0x5230('0x11')](0x1f4,_0x41efd8[_0x5230('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index e4c3d91..2aa7da2 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 _0x96a2=['./webbar.controller','post','/originate','isAuthenticated','canUpdate','originate','/hangup','hangup','/answer','answer','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','../../components/auth/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x96a2,0x96));var _0x296a=function(_0x43ac6d,_0x395ba9){_0x43ac6d=_0x43ac6d-0x0;var _0x5e8642=_0x96a2[_0x43ac6d];return _0x5e8642;};'use strict';var express=require(_0x296a('0x0'));var router=express['Router']();var auth=require(_0x296a('0x1'));var controller=require(_0x296a('0x2'));router[_0x296a('0x3')](_0x296a('0x4'),auth[_0x296a('0x5')](),auth[_0x296a('0x6')](),controller[_0x296a('0x7')]);router[_0x296a('0x3')](_0x296a('0x8'),auth[_0x296a('0x5')](),auth[_0x296a('0x6')](),controller[_0x296a('0x9')]);router[_0x296a('0x3')](_0x296a('0xa'),auth[_0x296a('0x5')](),auth[_0x296a('0x6')](),controller[_0x296a('0xb')]);router[_0x296a('0x3')]('/hold',auth[_0x296a('0x5')](),auth[_0x296a('0x6')](),controller['hold']);router[_0x296a('0x3')](_0x296a('0xc'),auth[_0x296a('0x5')](),auth[_0x296a('0x6')](),controller[_0x296a('0xd')]);router[_0x296a('0x3')](_0x296a('0xe'),auth['isAuthenticated'](),auth[_0x296a('0x6')](),controller[_0x296a('0xf')]);router[_0x296a('0x3')](_0x296a('0x10'),auth[_0x296a('0x5')](),auth['canUpdate'](),controller[_0x296a('0x11')]);module[_0x296a('0x12')]=router; \ No newline at end of file +var _0xe148=['isAuthenticated','canUpdate','originate','hangup','/answer','answer','/hold','hold','/unhold','unhold','/calls','calls','transfer','exports','express','Router','./webbar.controller','post'];(function(_0x21cca5,_0x5bfd5a){var _0x326810=function(_0x53564b){while(--_0x53564b){_0x21cca5['push'](_0x21cca5['shift']());}};_0x326810(++_0x5bfd5a);}(_0xe148,0x9e));var _0x8e14=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xe148[_0x5c9307];return _0x373e29;};'use strict';var express=require(_0x8e14('0x0'));var router=express[_0x8e14('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x8e14('0x2'));router[_0x8e14('0x3')]('/originate',auth[_0x8e14('0x4')](),auth[_0x8e14('0x5')](),controller[_0x8e14('0x6')]);router[_0x8e14('0x3')]('/hangup',auth['isAuthenticated'](),auth[_0x8e14('0x5')](),controller[_0x8e14('0x7')]);router['post'](_0x8e14('0x8'),auth[_0x8e14('0x4')](),auth[_0x8e14('0x5')](),controller[_0x8e14('0x9')]);router['post'](_0x8e14('0xa'),auth['isAuthenticated'](),auth[_0x8e14('0x5')](),controller[_0x8e14('0xb')]);router['post'](_0x8e14('0xc'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x8e14('0xd')]);router[_0x8e14('0x3')](_0x8e14('0xe'),auth[_0x8e14('0x4')](),auth['canUpdate'](),controller[_0x8e14('0xf')]);router['post']('/transfer',auth[_0x8e14('0x4')](),auth['canUpdate'](),controller[_0x8e14('0x10')]);module[_0x8e14('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 ea9934f..08685ed 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 _0xb016=['../../config/environment','util','bluebird','jayson/promise','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','number','userId\x20is\x20required','string','sessionId\x20is\x20required','info','stringify','emit','log','stack','name','status','send','request','then','error','code','message','catch','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','sessionId\x20','originate','body','validate','length','json','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','userId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb'];(function(_0x523615,_0x522ee8){var _0x9863eb=function(_0x2008e2){while(--_0x2008e2){_0x523615['push'](_0x523615['shift']());}};_0x9863eb(++_0x522ee8);}(_0xb016,0x129));var _0x6b01=function(_0x5a5a81,_0xbbd271){_0x5a5a81=_0x5a5a81-0x0;var _0x4e9340=_0xb016[_0x5a5a81];return _0x4e9340;};'use strict';var path=require(_0x6b01('0x0'));var fs=require('fs');var _=require(_0x6b01('0x1'));var db=require(_0x6b01('0x2'))['db'];var config=require(_0x6b01('0x3'));var util=require(_0x6b01('0x4'));var BPromise=require(_0x6b01('0x5'));var jayson=require(_0x6b01('0x6'));var amiClient=jayson['client'][_0x6b01('0x7')]({'port':0x232a});var logger=require(_0x6b01('0x8'))(_0x6b01('0x9'));var Redis=require(_0x6b01('0xa'));config[_0x6b01('0xb')]=_[_0x6b01('0xc')](config[_0x6b01('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x6b01('0xd'))(new Redis(config[_0x6b01('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x6b01('0xe'),'required':[!![],_0x6b01('0xf')]},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x6b01('0x10')},'callbackUrl':{'type':_0x6b01('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6b01('0xf')]},'sessionId':{'type':_0x6b01('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x6b01('0xe'),'required':[!![],_0x6b01('0xf')]},'sessionId':{'type':_0x6b01('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x6b01('0xe'),'required':[!![],_0x6b01('0xf')]},'sessionId':{'type':_0x6b01('0x10'),'required':[!![],_0x6b01('0x11')]},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x6b01('0xe'),'required':[!![],_0x6b01('0xf')]},'sessionId':{'type':_0x6b01('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x6b01('0xe'),'required':[!![],_0x6b01('0xf')]},'sessionId':{'type':_0x6b01('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x6b01('0xe'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x6b01('0xe'),'required':[!![],_0x6b01('0xf')]}});function emit(_0x5f81db,_0xbe978e,_0x4ca9b0){logger[_0x6b01('0x12')](_0x5f81db,_0xbe978e,JSON[_0x6b01('0x13')](_0x4ca9b0));io['to'](_0x5f81db)[_0x6b01('0x14')](_0xbe978e,_0x4ca9b0);}function handleError(_0x2b8053){return function(_0x38aabf){console[_0x6b01('0x15')]('handleError:',_0x38aabf,_0x38aabf instanceof RangeError);logger['error'](_0x38aabf[_0x6b01('0x16')]);if(_0x38aabf instanceof RangeError){if(_0x38aabf[_0x6b01('0x17')]){delete _0x38aabf[_0x6b01('0x17')];}_0x2b8053[_0x6b01('0x18')](0x194)[_0x6b01('0x19')](_0x38aabf);}else{if(_0x38aabf[_0x6b01('0x17')]){delete _0x38aabf[_0x6b01('0x17')];}_0x2b8053[_0x6b01('0x18')](0x1f4)['send'](_0x38aabf);}};}function checkError(){return function(_0x49108a){if(!_0x49108a){throw new RangeError('NotFound');}return _0x49108a;};}function respondWithRpcPromise(_0x54a830,_0xc26d7e){return new BPromise(function(_0x531a9c,_0x17901b){var _0x402a73=amiClient;return _0x402a73[_0x6b01('0x1a')](_0x54a830,_0xc26d7e)[_0x6b01('0x1b')](function(_0x1ff519){if(_0x1ff519['error']){if(_0x1ff519[_0x6b01('0x1c')][_0x6b01('0x1d')]===0x1f4){return _0x17901b(_0x1ff519[_0x6b01('0x1c')][_0x6b01('0x1e')]);}return _0x531a9c(_0x1ff519['error'][_0x6b01('0x1e')]);}else{_0x531a9c(_0x1ff519['result']);}})[_0x6b01('0x1f')](function(_0x458d9e){_0x17901b(_0x458d9e);});});}function getAgent(_0x4ebe4e){return db['User'][_0x6b01('0x20')]({'where':{'id':_0x4ebe4e,'role':_0x6b01('0x21')}})['then'](checkError());}function getAgentCheckSession(_0x946b1,_0x561d7f){return new BPromise(function(_0x403708,_0x2a0878){var _0x5454cc=respondWithRpcPromise(_0x6b01('0x22'));var _0x5c5c3f=getAgent(_0x946b1);Promise[_0x6b01('0x23')]([_0x5454cc,_0x5c5c3f])[_0x6b01('0x1b')](function(_0x51f5c4){var _0x62366f=_0x51f5c4[0x0];var _0x4cbb02=_0x51f5c4[0x1];var _0x200232=_[_0x6b01('0x24')](_0x62366f[_0x6b01('0x25')],function(_0x598814){return _0x598814[_0x6b01('0x26')]==_0x4cbb02['id']&&_0x598814[_0x6b01('0x27')]==_0x561d7f;});if(_0x200232['length']==0x1){_0x403708(_0x4cbb02);}else{_0x2a0878(new RangeError(_0x6b01('0x28')+_0x561d7f+'\x20not\x20found!'));}});});}exports[_0x6b01('0x29')]=function(_0x12505a,_0x429293){logger[_0x6b01('0x12')]('originate\x20fired:',_0x12505a[_0x6b01('0x2a')]);var _0x1e9c14=originateValidation[_0x6b01('0x2b')](_0x12505a[_0x6b01('0x2a')]);if(_0x1e9c14[_0x6b01('0x2c')]>0x0){return _0x429293[_0x6b01('0x18')](0x190)[_0x6b01('0x2d')](_0x1e9c14);}var _0x3e88c7=_0x12505a[_0x6b01('0x2a')]['userId'];var _0x253d94=_0x12505a[_0x6b01('0x2a')][_0x6b01('0x2e')];var _0x2d3adb=_0x12505a[_0x6b01('0x2a')][_0x6b01('0x2f')];var _0x670522=_0x12505a[_0x6b01('0x2a')][_0x6b01('0x30')];return getAgent(_0x3e88c7)['then'](function(_0xe405ee){logger['info'](_0x6b01('0x31'),_0xe405ee[_0x6b01('0x17')]);emit(util[_0x6b01('0x32')](_0x6b01('0x33'),_0xe405ee[_0x6b01('0x17')]),_0x6b01('0x34'),{'callNumber':_0x253d94,'callerId':_0x2d3adb,'callbackUrl':_0x670522});return _0x429293[_0x6b01('0x18')](0xc8)[_0x6b01('0x2d')]({'error':![],'message':'originate\x20executed!'});})[_0x6b01('0x1f')](handleError(_0x429293));};exports['hangup']=function(_0x3b155c,_0x4d1b5c){logger[_0x6b01('0x12')]('hangup\x20fired:',_0x3b155c['body']);var _0x16058f=hangupValidation[_0x6b01('0x2b')](_0x3b155c[_0x6b01('0x2a')]);if(_0x16058f[_0x6b01('0x2c')]>0x0){return _0x4d1b5c[_0x6b01('0x18')](0x190)[_0x6b01('0x2d')](_0x16058f);}var _0x5b25a1=_0x3b155c[_0x6b01('0x2a')][_0x6b01('0x35')];var _0x3c7138=_0x3b155c[_0x6b01('0x2a')]['sessionId'];return getAgent(_0x5b25a1)[_0x6b01('0x1b')](function(_0x54d85d){logger[_0x6b01('0x12')]('entityFound:',_0x54d85d['name']);emit(util[_0x6b01('0x32')](_0x6b01('0x33'),_0x54d85d[_0x6b01('0x17')]),_0x6b01('0x36'),{'sessionId':_0x3c7138});return _0x4d1b5c['status'](0xc8)['json']({'error':![],'message':_0x6b01('0x37')});})[_0x6b01('0x1f')](handleError(_0x4d1b5c));};exports[_0x6b01('0x38')]=function(_0xbce901,_0x5c6f8f){logger[_0x6b01('0x12')](_0x6b01('0x39'),_0xbce901['body']);var _0x5da492=answerValidation[_0x6b01('0x2b')](_0xbce901['body']);if(_0x5da492[_0x6b01('0x2c')]>0x0){return _0x5c6f8f['status'](0x190)['json'](_0x5da492);}var _0x5437f4=_0xbce901['body'][_0x6b01('0x35')];var _0x43b2b7=_0xbce901[_0x6b01('0x2a')]['sessionId'];return getAgent(_0x5437f4)['then'](function(_0x20d7eb){logger['info'](_0x6b01('0x31'),_0x20d7eb['name']);emit(util[_0x6b01('0x32')](_0x6b01('0x33'),_0x20d7eb[_0x6b01('0x17')]),'webbar:answer',{'sessionId':_0x43b2b7});return _0x5c6f8f[_0x6b01('0x18')](0xc8)['json']({'error':![],'message':_0x6b01('0x3a')});})[_0x6b01('0x1f')](handleError(_0x5c6f8f));};exports[_0x6b01('0x3b')]=function(_0x3ae162,_0x581353){logger['info'](_0x6b01('0x3c'),_0x3ae162[_0x6b01('0x2a')]);var _0x40febd=holdValidation[_0x6b01('0x2b')](_0x3ae162[_0x6b01('0x2a')]);if(_0x40febd[_0x6b01('0x2c')]>0x0){return _0x581353[_0x6b01('0x18')](0x190)['json'](_0x40febd);}var _0x412161=_0x3ae162[_0x6b01('0x2a')][_0x6b01('0x35')];var _0x4aff01=_0x3ae162[_0x6b01('0x2a')][_0x6b01('0x27')];return getAgent(_0x412161)[_0x6b01('0x1b')](function(_0x5033bf){logger[_0x6b01('0x12')]('entityFound:',_0x5033bf[_0x6b01('0x17')]);emit(util['format'](_0x6b01('0x33'),_0x5033bf['name']),_0x6b01('0x3d'),{'sessionId':_0x4aff01});return _0x581353[_0x6b01('0x18')](0xc8)[_0x6b01('0x2d')]({'error':![],'message':_0x6b01('0x3e')});})[_0x6b01('0x1f')](handleError(_0x581353));};exports[_0x6b01('0x3f')]=function(_0x225908,_0x56bc4d){logger[_0x6b01('0x12')]('unhold\x20fired:',_0x225908[_0x6b01('0x2a')]);var _0x291762=unholdValidation['validate'](_0x225908[_0x6b01('0x2a')]);if(_0x291762['length']>0x0){return _0x56bc4d[_0x6b01('0x18')](0x190)[_0x6b01('0x2d')](_0x291762);}var _0x39eec9=_0x225908[_0x6b01('0x2a')][_0x6b01('0x35')];var _0x232192=_0x225908['body'][_0x6b01('0x27')];return getAgent(_0x39eec9)['then'](function(_0x5b928a){logger['info']('entityFound:',_0x5b928a[_0x6b01('0x17')]);emit(util[_0x6b01('0x32')](_0x6b01('0x33'),_0x5b928a[_0x6b01('0x17')]),_0x6b01('0x40'),{'sessionId':_0x232192});return _0x56bc4d[_0x6b01('0x18')](0xc8)[_0x6b01('0x2d')]({'error':![],'message':_0x6b01('0x41')});})[_0x6b01('0x1f')](handleError(_0x56bc4d));};exports[_0x6b01('0x42')]=function(_0x1cc751,_0x22e5c9){logger['info']('calls\x20fired:',_0x22e5c9[_0x6b01('0x2a')]);var _0x2d00a5=callsValidation['validate'](_0x1cc751['body']);if(_0x2d00a5[_0x6b01('0x2c')]>0x0){return _0x22e5c9[_0x6b01('0x18')](0x190)[_0x6b01('0x2d')](_0x2d00a5);}var _0x180e31=_0x1cc751[_0x6b01('0x2a')][_0x6b01('0x35')];var _0x30771e=respondWithRpcPromise('VoiceChannels');var _0x27c003=getAgent(_0x180e31);return Promise[_0x6b01('0x23')]([_0x30771e,_0x27c003])[_0x6b01('0x1b')](function(_0xceced3){var _0x24f031=_0xceced3[0x0];var _0x17d7c6=_0xceced3[0x1];var _0xc5c7ba=_[_0x6b01('0x24')](_0x24f031['rows'],function(_0xeeda78){return _0xeeda78[_0x6b01('0x26')]==_0x17d7c6['id'];});return _0x22e5c9[_0x6b01('0x18')](0xc8)['json']({'count':_0xc5c7ba[_0x6b01('0x2c')],'rows':_0xc5c7ba});})[_0x6b01('0x1f')](handleError(_0x22e5c9));};exports[_0x6b01('0x43')]=function(_0x466767,_0x29686f){logger['info'](_0x6b01('0x44'),_0x466767[_0x6b01('0x2a')]);var _0x9ee5b1=conferenceValidation[_0x6b01('0x2b')](_0x466767[_0x6b01('0x2a')]);if(_0x9ee5b1[_0x6b01('0x2c')]>0x0){return _0x29686f['status'](0x190)[_0x6b01('0x2d')](_0x9ee5b1);}var _0x52243f=_0x466767[_0x6b01('0x2a')][_0x6b01('0x35')];return getAgent(_0x52243f)['then'](function(_0x5eb487){logger['info'](_0x6b01('0x31'),_0x5eb487[_0x6b01('0x17')]);emit(util[_0x6b01('0x32')](_0x6b01('0x33'),_0x5eb487[_0x6b01('0x17')]),_0x6b01('0x45'));return _0x29686f[_0x6b01('0x18')](0xc8)[_0x6b01('0x2d')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x29686f));};exports[_0x6b01('0x46')]=function(_0x3620eb,_0x907d1d){logger[_0x6b01('0x12')](_0x6b01('0x47'),_0x3620eb[_0x6b01('0x2a')]);var _0xb9a456=transferValidation['validate'](_0x3620eb['body']);if(_0xb9a456[_0x6b01('0x2c')]>0x0){return _0x907d1d['status'](0x190)['json'](_0xb9a456);}var _0x3d4453=_0x3620eb[_0x6b01('0x2a')][_0x6b01('0x35')];var _0x3821ed=_0x3620eb['body']['sessionId'];var _0x4d693b=_0x3620eb['body'][_0x6b01('0x48')];return getAgent(_0x3d4453)['then'](function(_0x2693fb){logger[_0x6b01('0x12')]('entityFound:',_0x2693fb[_0x6b01('0x17')]);emit(util[_0x6b01('0x32')](_0x6b01('0x33'),_0x2693fb[_0x6b01('0x17')]),_0x6b01('0x49'),{'sessionId':_0x3821ed,'transferNumber':_0x4d693b});return _0x907d1d[_0x6b01('0x18')](0xc8)[_0x6b01('0x2d')]({'error':![],'message':_0x6b01('0x4a')});})[_0x6b01('0x1f')](handleError(_0x907d1d));}; \ No newline at end of file +var _0x7a59=['transferNumber','path','../../config/environment','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','transferNumber\x20is\x20required','stringify','log','error','stack','name','NotFound','then','code','message','result','catch','User','findOne','agent','all','rows','UserId','sessionId','\x20not\x20found!','originate','info','originate\x20fired:','length','status','json','body','userId','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20executed!','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer'];(function(_0x525d78,_0x14175d){var _0x4c203d=function(_0x45d4f4){while(--_0x45d4f4){_0x525d78['push'](_0x525d78['shift']());}};_0x4c203d(++_0x14175d);}(_0x7a59,0x16e));var _0x97a5=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x7a59[_0x1b6c6d];return _0x290d9d;};'use strict';var path=require(_0x97a5('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0x97a5('0x1'));var util=require(_0x97a5('0x2'));var BPromise=require(_0x97a5('0x3'));var jayson=require(_0x97a5('0x4'));var amiClient=jayson[_0x97a5('0x5')]['http']({'port':0x232a});var logger=require(_0x97a5('0x6'))(_0x97a5('0x7'));var Redis=require(_0x97a5('0x8'));config['redis']=_[_0x97a5('0x9')](config[_0x97a5('0xa')],{'host':_0x97a5('0xb'),'port':0x18eb});var io=require(_0x97a5('0xc'))(new Redis(config[_0x97a5('0xa')]));var Schema=require(_0x97a5('0xd'));var originateValidation=new Schema({'userId':{'type':_0x97a5('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x97a5('0xf'),'required':[!![],_0x97a5('0x10')]},'callerId':{'type':_0x97a5('0xf')},'callbackUrl':{'type':_0x97a5('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x97a5('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x97a5('0xe'),'required':[!![],_0x97a5('0x11')]},'sessionId':{'type':_0x97a5('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x97a5('0x11')]},'sessionId':{'type':_0x97a5('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],_0x97a5('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x97a5('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x97a5('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x97a5('0xe'),'required':[!![],_0x97a5('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x97a5('0x11')]}});function emit(_0x3fa986,_0x531ed8,_0x1178d5){logger['info'](_0x3fa986,_0x531ed8,JSON[_0x97a5('0x13')](_0x1178d5));io['to'](_0x3fa986)['emit'](_0x531ed8,_0x1178d5);}function handleError(_0x4b7a38){return function(_0x52ce92){console[_0x97a5('0x14')]('handleError:',_0x52ce92,_0x52ce92 instanceof RangeError);logger[_0x97a5('0x15')](_0x52ce92[_0x97a5('0x16')]);if(_0x52ce92 instanceof RangeError){if(_0x52ce92[_0x97a5('0x17')]){delete _0x52ce92[_0x97a5('0x17')];}_0x4b7a38['status'](0x194)['send'](_0x52ce92);}else{if(_0x52ce92[_0x97a5('0x17')]){delete _0x52ce92[_0x97a5('0x17')];}_0x4b7a38['status'](0x1f4)['send'](_0x52ce92);}};}function checkError(){return function(_0x3d54a3){if(!_0x3d54a3){throw new RangeError(_0x97a5('0x18'));}return _0x3d54a3;};}function respondWithRpcPromise(_0x38be6b,_0x587f2c){return new BPromise(function(_0x34fb55,_0x3a5849){var _0x23f4f8=amiClient;return _0x23f4f8['request'](_0x38be6b,_0x587f2c)[_0x97a5('0x19')](function(_0x33d6da){if(_0x33d6da['error']){if(_0x33d6da[_0x97a5('0x15')][_0x97a5('0x1a')]===0x1f4){return _0x3a5849(_0x33d6da[_0x97a5('0x15')][_0x97a5('0x1b')]);}return _0x34fb55(_0x33d6da[_0x97a5('0x15')][_0x97a5('0x1b')]);}else{_0x34fb55(_0x33d6da[_0x97a5('0x1c')]);}})[_0x97a5('0x1d')](function(_0x4743e0){_0x3a5849(_0x4743e0);});});}function getAgent(_0x5dc52f){return db[_0x97a5('0x1e')][_0x97a5('0x1f')]({'where':{'id':_0x5dc52f,'role':_0x97a5('0x20')}})[_0x97a5('0x19')](checkError());}function getAgentCheckSession(_0x2076e9,_0x46846f){return new BPromise(function(_0x5c0517,_0x1dcf5f){var _0x3eff21=respondWithRpcPromise('VoiceChannels');var _0x274ccb=getAgent(_0x2076e9);Promise[_0x97a5('0x21')]([_0x3eff21,_0x274ccb])['then'](function(_0x1bdb74){var _0x2eaae4=_0x1bdb74[0x0];var _0x5c1c67=_0x1bdb74[0x1];var _0x2546ee=_['filter'](_0x2eaae4[_0x97a5('0x22')],function(_0x3c5d02){return _0x3c5d02[_0x97a5('0x23')]==_0x5c1c67['id']&&_0x3c5d02[_0x97a5('0x24')]==_0x46846f;});if(_0x2546ee['length']==0x1){_0x5c0517(_0x5c1c67);}else{_0x1dcf5f(new RangeError('sessionId\x20'+_0x46846f+_0x97a5('0x25')));}});});}exports[_0x97a5('0x26')]=function(_0x418498,_0x57c7d7){logger[_0x97a5('0x27')](_0x97a5('0x28'),_0x418498['body']);var _0x1bbccd=originateValidation[_0x97a5('0xd')](_0x418498['body']);if(_0x1bbccd[_0x97a5('0x29')]>0x0){return _0x57c7d7[_0x97a5('0x2a')](0x190)[_0x97a5('0x2b')](_0x1bbccd);}var _0x4a2b5d=_0x418498[_0x97a5('0x2c')][_0x97a5('0x2d')];var _0x347ad5=_0x418498[_0x97a5('0x2c')][_0x97a5('0x2e')];var _0x33e8d4=_0x418498[_0x97a5('0x2c')]['callerId'];var _0xde33a6=_0x418498[_0x97a5('0x2c')][_0x97a5('0x2f')];return getAgent(_0x4a2b5d)[_0x97a5('0x19')](function(_0x369d7b){logger[_0x97a5('0x27')](_0x97a5('0x30'),_0x369d7b[_0x97a5('0x17')]);emit(util[_0x97a5('0x31')](_0x97a5('0x32'),_0x369d7b[_0x97a5('0x17')]),_0x97a5('0x33'),{'callNumber':_0x347ad5,'callerId':_0x33e8d4,'callbackUrl':_0xde33a6});return _0x57c7d7[_0x97a5('0x2a')](0xc8)['json']({'error':![],'message':_0x97a5('0x34')});})[_0x97a5('0x1d')](handleError(_0x57c7d7));};exports[_0x97a5('0x35')]=function(_0x305d92,_0x2aec4e){logger['info']('hangup\x20fired:',_0x305d92[_0x97a5('0x2c')]);var _0x2e25d4=hangupValidation[_0x97a5('0xd')](_0x305d92[_0x97a5('0x2c')]);if(_0x2e25d4[_0x97a5('0x29')]>0x0){return _0x2aec4e[_0x97a5('0x2a')](0x190)['json'](_0x2e25d4);}var _0x3b3f88=_0x305d92['body'][_0x97a5('0x2d')];var _0x1bde97=_0x305d92[_0x97a5('0x2c')][_0x97a5('0x24')];return getAgent(_0x3b3f88)[_0x97a5('0x19')](function(_0x524a69){logger[_0x97a5('0x27')](_0x97a5('0x30'),_0x524a69[_0x97a5('0x17')]);emit(util[_0x97a5('0x31')](_0x97a5('0x32'),_0x524a69['name']),'webbar:hangup',{'sessionId':_0x1bde97});return _0x2aec4e[_0x97a5('0x2a')](0xc8)[_0x97a5('0x2b')]({'error':![],'message':_0x97a5('0x36')});})[_0x97a5('0x1d')](handleError(_0x2aec4e));};exports['answer']=function(_0x4742f5,_0x51a961){logger[_0x97a5('0x27')](_0x97a5('0x37'),_0x4742f5[_0x97a5('0x2c')]);var _0x5baf77=answerValidation[_0x97a5('0xd')](_0x4742f5[_0x97a5('0x2c')]);if(_0x5baf77['length']>0x0){return _0x51a961[_0x97a5('0x2a')](0x190)[_0x97a5('0x2b')](_0x5baf77);}var _0x2f6f5e=_0x4742f5[_0x97a5('0x2c')][_0x97a5('0x2d')];var _0x170f72=_0x4742f5[_0x97a5('0x2c')][_0x97a5('0x24')];return getAgent(_0x2f6f5e)[_0x97a5('0x19')](function(_0x22f234){logger[_0x97a5('0x27')](_0x97a5('0x30'),_0x22f234['name']);emit(util[_0x97a5('0x31')](_0x97a5('0x32'),_0x22f234[_0x97a5('0x17')]),'webbar:answer',{'sessionId':_0x170f72});return _0x51a961[_0x97a5('0x2a')](0xc8)[_0x97a5('0x2b')]({'error':![],'message':_0x97a5('0x38')});})[_0x97a5('0x1d')](handleError(_0x51a961));};exports[_0x97a5('0x39')]=function(_0x59e97a,_0xa7fa0b){logger[_0x97a5('0x27')](_0x97a5('0x3a'),_0x59e97a[_0x97a5('0x2c')]);var _0x11feb9=holdValidation['validate'](_0x59e97a[_0x97a5('0x2c')]);if(_0x11feb9['length']>0x0){return _0xa7fa0b[_0x97a5('0x2a')](0x190)[_0x97a5('0x2b')](_0x11feb9);}var _0x330f6a=_0x59e97a['body'][_0x97a5('0x2d')];var _0x111ec3=_0x59e97a[_0x97a5('0x2c')][_0x97a5('0x24')];return getAgent(_0x330f6a)[_0x97a5('0x19')](function(_0x42ced6){logger['info'](_0x97a5('0x30'),_0x42ced6[_0x97a5('0x17')]);emit(util[_0x97a5('0x31')](_0x97a5('0x32'),_0x42ced6['name']),_0x97a5('0x3b'),{'sessionId':_0x111ec3});return _0xa7fa0b[_0x97a5('0x2a')](0xc8)['json']({'error':![],'message':_0x97a5('0x3c')});})[_0x97a5('0x1d')](handleError(_0xa7fa0b));};exports[_0x97a5('0x3d')]=function(_0x56890f,_0x2a6fa0){logger[_0x97a5('0x27')]('unhold\x20fired:',_0x56890f[_0x97a5('0x2c')]);var _0x1244f0=unholdValidation[_0x97a5('0xd')](_0x56890f['body']);if(_0x1244f0[_0x97a5('0x29')]>0x0){return _0x2a6fa0[_0x97a5('0x2a')](0x190)[_0x97a5('0x2b')](_0x1244f0);}var _0x5d3944=_0x56890f['body'][_0x97a5('0x2d')];var _0x7c4886=_0x56890f[_0x97a5('0x2c')][_0x97a5('0x24')];return getAgent(_0x5d3944)['then'](function(_0x43be43){logger[_0x97a5('0x27')](_0x97a5('0x30'),_0x43be43['name']);emit(util['format']('user:%s',_0x43be43[_0x97a5('0x17')]),_0x97a5('0x3e'),{'sessionId':_0x7c4886});return _0x2a6fa0[_0x97a5('0x2a')](0xc8)['json']({'error':![],'message':_0x97a5('0x3f')});})[_0x97a5('0x1d')](handleError(_0x2a6fa0));};exports[_0x97a5('0x40')]=function(_0x31e618,_0x1cc489){logger[_0x97a5('0x27')](_0x97a5('0x41'),_0x1cc489['body']);var _0x514149=callsValidation['validate'](_0x31e618[_0x97a5('0x2c')]);if(_0x514149['length']>0x0){return _0x1cc489['status'](0x190)[_0x97a5('0x2b')](_0x514149);}var _0x2777ce=_0x31e618['body'][_0x97a5('0x2d')];var _0x25427d=respondWithRpcPromise('VoiceChannels');var _0x116ded=getAgent(_0x2777ce);return Promise['all']([_0x25427d,_0x116ded])[_0x97a5('0x19')](function(_0x4863a6){var _0x296688=_0x4863a6[0x0];var _0x5a40e2=_0x4863a6[0x1];var _0x1761da=_[_0x97a5('0x42')](_0x296688['rows'],function(_0x42cc2b){return _0x42cc2b['UserId']==_0x5a40e2['id'];});return _0x1cc489[_0x97a5('0x2a')](0xc8)['json']({'count':_0x1761da['length'],'rows':_0x1761da});})['catch'](handleError(_0x1cc489));};exports[_0x97a5('0x43')]=function(_0x1a04eb,_0x1e63e0){logger[_0x97a5('0x27')](_0x97a5('0x44'),_0x1a04eb[_0x97a5('0x2c')]);var _0x145c62=conferenceValidation[_0x97a5('0xd')](_0x1a04eb['body']);if(_0x145c62['length']>0x0){return _0x1e63e0['status'](0x190)[_0x97a5('0x2b')](_0x145c62);}var _0x5ca023=_0x1a04eb['body'][_0x97a5('0x2d')];return getAgent(_0x5ca023)[_0x97a5('0x19')](function(_0x5b3d6b){logger[_0x97a5('0x27')](_0x97a5('0x30'),_0x5b3d6b['name']);emit(util['format'](_0x97a5('0x32'),_0x5b3d6b[_0x97a5('0x17')]),_0x97a5('0x45'));return _0x1e63e0[_0x97a5('0x2a')](0xc8)['json']({'error':![],'message':_0x97a5('0x46')});})[_0x97a5('0x1d')](handleError(_0x1e63e0));};exports[_0x97a5('0x47')]=function(_0x31eca3,_0x1a3c2d){logger['info']('transfer\x20fired:',_0x31eca3[_0x97a5('0x2c')]);var _0xc8c17a=transferValidation['validate'](_0x31eca3[_0x97a5('0x2c')]);if(_0xc8c17a[_0x97a5('0x29')]>0x0){return _0x1a3c2d[_0x97a5('0x2a')](0x190)[_0x97a5('0x2b')](_0xc8c17a);}var _0x5e9585=_0x31eca3[_0x97a5('0x2c')]['userId'];var _0x546708=_0x31eca3['body']['sessionId'];var _0x1e9972=_0x31eca3[_0x97a5('0x2c')][_0x97a5('0x48')];return getAgent(_0x5e9585)[_0x97a5('0x19')](function(_0xb499fb){logger[_0x97a5('0x27')](_0x97a5('0x30'),_0xb499fb[_0x97a5('0x17')]);emit(util['format'](_0x97a5('0x32'),_0xb499fb[_0x97a5('0x17')]),'webbar:transfer',{'sessionId':_0x546708,'transferNumber':_0x1e9972});return _0x1a3c2d[_0x97a5('0x2a')](0xc8)[_0x97a5('0x2b')]({'error':![],'message':'transfer\x20executed!'});})[_0x97a5('0x1d')](handleError(_0x1a3c2d));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 60618fd..e75e8c9 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 _0x8e3f=['addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','/:id/applications','getApplications','create','post'];(function(_0x5976f8,_0x1265b7){var _0x179715=function(_0x2b2c4b){while(--_0x2b2c4b){_0x5976f8['push'](_0x5976f8['shift']());}};_0x179715(++_0x1265b7);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8e3f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var path=require(_0xf8e3('0x2'));var timeout=require('connect-timeout');var express=require(_0xf8e3('0x3'));var router=express[_0xf8e3('0x4')]();var auth=require(_0xf8e3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf8e3('0x6'));var controller=require(_0xf8e3('0x7'));router['get']('/',auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x9')]);router[_0xf8e3('0xa')](_0xf8e3('0xb'),auth['isAuthenticated'](),controller[_0xf8e3('0xc')]);router[_0xf8e3('0xa')](_0xf8e3('0xd'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0xe')]);router[_0xf8e3('0xa')](_0xf8e3('0xf'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x10')]);router[_0xf8e3('0xa')](_0xf8e3('0x11'),auth[_0xf8e3('0x8')](),controller['getAnswers']);router[_0xf8e3('0xa')](_0xf8e3('0x12'),auth[_0xf8e3('0x8')](),controller['getAgents']);router[_0xf8e3('0xa')](_0xf8e3('0x13'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x14')]);router['post']('/',auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x15')]);router[_0xf8e3('0x16')]('/:id/dispositions',auth[_0xf8e3('0x8')](),controller['addDisposition']);router[_0xf8e3('0x16')](_0xf8e3('0x11'),auth[_0xf8e3('0x8')](),controller['addAnswer']);router['post'](_0xf8e3('0x12'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x17')]);router[_0xf8e3('0x16')](_0xf8e3('0x13'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x18')]);router[_0xf8e3('0x16')](_0xf8e3('0x19'),controller[_0xf8e3('0x1a')]);router['post'](_0xf8e3('0x1b'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x1c')]);router[_0xf8e3('0x1d')](_0xf8e3('0xd'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x1e')]);router[_0xf8e3('0x1f')]('/:id',auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x20')]);router[_0xf8e3('0x1f')](_0xf8e3('0xf'),auth['isAuthenticated'](),controller[_0xf8e3('0x21')]);router['delete'](_0xf8e3('0x11'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x22')]);router[_0xf8e3('0x1f')](_0xf8e3('0x12'),auth[_0xf8e3('0x8')](),controller['removeAgents']);module[_0xf8e3('0x23')]=router; \ No newline at end of file +var _0x5fdc=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','post','create','/:id/dispositions','addDisposition','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','removeDispositions','/:id/users','removeAgents','exports','multer'];(function(_0x2b45ea,_0x412074){var _0x5427fc=function(_0x553630){while(--_0x553630){_0x2b45ea['push'](_0x2b45ea['shift']());}};_0x5427fc(++_0x412074);}(_0x5fdc,0x127));var _0xc5fd=function(_0x213d99,_0x11e48a){_0x213d99=_0x213d99-0x0;var _0x3d35d5=_0x5fdc[_0x213d99];return _0x3d35d5;};'use strict';var multer=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var path=require(_0xc5fd('0x2'));var timeout=require(_0xc5fd('0x3'));var express=require(_0xc5fd('0x4'));var router=express[_0xc5fd('0x5')]();var auth=require(_0xc5fd('0x6'));var interaction=require(_0xc5fd('0x7'));var config=require(_0xc5fd('0x8'));var controller=require(_0xc5fd('0x9'));router[_0xc5fd('0xa')]('/',auth[_0xc5fd('0xb')](),controller[_0xc5fd('0xc')]);router[_0xc5fd('0xa')](_0xc5fd('0xd'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xc5fd('0xe'),auth[_0xc5fd('0xb')](),controller[_0xc5fd('0xf')]);router[_0xc5fd('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc5fd('0x10')]);router[_0xc5fd('0xa')](_0xc5fd('0x11'),auth[_0xc5fd('0xb')](),controller[_0xc5fd('0x12')]);router[_0xc5fd('0xa')]('/:id/users',auth[_0xc5fd('0xb')](),controller['getAgents']);router['get'](_0xc5fd('0x13'),auth[_0xc5fd('0xb')](),controller[_0xc5fd('0x14')]);router[_0xc5fd('0x15')]('/',auth[_0xc5fd('0xb')](),controller[_0xc5fd('0x16')]);router[_0xc5fd('0x15')](_0xc5fd('0x17'),auth['isAuthenticated'](),controller[_0xc5fd('0x18')]);router[_0xc5fd('0x15')](_0xc5fd('0x11'),auth[_0xc5fd('0xb')](),controller['addAnswer']);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xc5fd('0x15')](_0xc5fd('0x13'),auth[_0xc5fd('0xb')](),controller[_0xc5fd('0x19')]);router[_0xc5fd('0x15')](_0xc5fd('0x1a'),controller[_0xc5fd('0x1b')]);router['post'](_0xc5fd('0x1c'),auth[_0xc5fd('0xb')](),controller[_0xc5fd('0x1d')]);router[_0xc5fd('0x1e')](_0xc5fd('0xe'),auth['isAuthenticated'](),controller[_0xc5fd('0x1f')]);router[_0xc5fd('0x20')](_0xc5fd('0xe'),auth[_0xc5fd('0xb')](),controller['destroy']);router['delete'](_0xc5fd('0x17'),auth[_0xc5fd('0xb')](),controller[_0xc5fd('0x21')]);router[_0xc5fd('0x20')](_0xc5fd('0x11'),auth[_0xc5fd('0xb')](),controller['removeAnswers']);router[_0xc5fd('0x20')](_0xc5fd('0x22'),auth[_0xc5fd('0xb')](),controller[_0xc5fd('0x23')]);module[_0xc5fd('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index f291fdc..1716761 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 _0x0f0c=['STRING','name','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','sequelize','randomstring'];(function(_0x42f071,_0x52533f){var _0x2b7b2c=function(_0xab75eb){while(--_0xab75eb){_0x42f071['push'](_0x42f071['shift']());}};_0x2b7b2c(++_0x52533f);}(_0x0f0c,0x1ca));var _0xc0f0=function(_0x23d7c5,_0x2a7547){_0x23d7c5=_0x23d7c5-0x0;var _0x350950=_0x0f0c[_0x23d7c5];return _0x350950;};'use strict';var Sequelize=require(_0xc0f0('0x0'));var rs=require(_0xc0f0('0x1'));module['exports']={'name':{'type':Sequelize[_0xc0f0('0x2')],'unique':_0xc0f0('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xc0f0('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xc0f0('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xc0f0('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xc0f0('0x2')]},'type':{'type':Sequelize['ENUM']('twilio')},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xc0f0('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xc0f0('0x4');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xc0f0('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc0f0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc0f0('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc0f0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc0f0('0x6')],'comment':_0xc0f0('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xc0f0('0x5')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2b6b79){if(!_0x2b6b79){this[_0xc0f0('0x8')](_0xc0f0('0x9'),null);}this[_0xc0f0('0x8')]('mandatoryDisposition',_0x2b6b79);}},'description':{'type':Sequelize[_0xc0f0('0x2')]}}; \ No newline at end of file +var _0xcd51=['BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','name','generate','ENUM','twilio','TEXT'];(function(_0x365c44,_0x5764d2){var _0x146363=function(_0x1865d2){while(--_0x1865d2){_0x365c44['push'](_0x365c44['shift']());}};_0x146363(++_0x5764d2);}(_0xcd51,0x87));var _0x1cd5=function(_0xf0a854,_0xa08c0d){_0xf0a854=_0xf0a854-0x0;var _0x5a8c3f=_0xcd51[_0xf0a854];return _0x5a8c3f;};'use strict';var Sequelize=require(_0x1cd5('0x0'));var rs=require('randomstring');module[_0x1cd5('0x1')]={'name':{'type':Sequelize[_0x1cd5('0x2')],'unique':_0x1cd5('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x1cd5('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x1cd5('0x2')],'defaultValue':function(){return rs[_0x1cd5('0x4')]();}},'phone':{'type':Sequelize[_0x1cd5('0x2')]},'type':{'type':Sequelize[_0x1cd5('0x5')](_0x1cd5('0x6'))},'accountSid':{'type':Sequelize[_0x1cd5('0x2')]},'authToken':{'type':Sequelize[_0x1cd5('0x2')]},'notificationTemplate':{'type':Sequelize[_0x1cd5('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1cd5('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1cd5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1cd5('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1cd5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1cd5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1cd5('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1cd5('0x8')],'defaultValue':![],'comment':_0x1cd5('0xa'),'set':function(_0xd385f5){if(!_0xd385f5){this[_0x1cd5('0xb')]('mandatoryDispositionPauseId',null);}this[_0x1cd5('0xb')](_0x1cd5('0xc'),_0xd385f5);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 60ab42e..e5da9d5 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 _0xdec1=['entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','twilio','Content-Type','send','\x0a','to\x20is\x20mandatory','List','CmContact','Messages','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','info','debug','error','code','WhatsappAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','json','count','offset','set','apply','save','update','then','destroy','get','UserProfileResource','end','stack','name','index','Pause','mandatoryDispositionPause','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','WhatsappAccount','findAll','rows','show','params','keys','filtears','user','role','WhatsappAccounts','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','removeAgents','emit','userWhatsappAccount:remove','getAgents','addApplications','sequelize','WhatsappApplication','bulkCreate','getApplications','notify','whatsapp','Applications','account','orderBy','priority','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','replace','whatsapp:','Body','messageId','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','Contacts','WhatsappInteraction','interaction','autoclose','applications','push','close','unmanaged','*,*,*,*','created','WhatsappMessage','ContactId','UserId','User','agent','waitForTheAssignedAgent','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdec1,0x17b));var _0x1dec=function(_0x3e3db1,_0x28d455){_0x3e3db1=_0x3e3db1-0x0;var _0x35f45b=_0xdec1[_0x3e3db1];return _0x35f45b;};'use strict';var pdf=require(_0x1dec('0x0'));var emlformat=require(_0x1dec('0x1'));var rimraf=require(_0x1dec('0x2'));var zipdir=require(_0x1dec('0x3'));var jsonpatch=require(_0x1dec('0x4'));var rp=require(_0x1dec('0x5'));var moment=require(_0x1dec('0x6'));var BPromise=require(_0x1dec('0x7'));var Mustache=require(_0x1dec('0x8'));var util=require('util');var path=require(_0x1dec('0x9'));var sox=require('sox');var csv=require(_0x1dec('0xa'));var ejs=require(_0x1dec('0xb'));var fs=require('fs');var _=require(_0x1dec('0xc'));var squel=require('squel');var crypto=require(_0x1dec('0xd'));var jsforce=require(_0x1dec('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1dec('0xa'));var querystring=require(_0x1dec('0xf'));var Papa=require(_0x1dec('0x10'));var Redis=require('ioredis');var authService=require(_0x1dec('0x11'));var qs=require(_0x1dec('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1dec('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1dec('0x14'));var config=require(_0x1dec('0x15'));var licenseUtil=require(_0x1dec('0x16'));var db=require(_0x1dec('0x17'))['db'];config['redis']=_[_0x1dec('0x18')](config[_0x1dec('0x19')],{'host':_0x1dec('0x1a'),'port':0x18eb});var socket=require(_0x1dec('0x1b'))(new Redis(config[_0x1dec('0x19')]));require(_0x1dec('0x1c'))[_0x1dec('0x1d')](socket);var jayson=require(_0x1dec('0x1e'));var client=jayson[_0x1dec('0x1f')][_0x1dec('0x20')]({'port':0x232c});function respondWithRpcPromise(_0xace682,_0x4d7493,_0x5e8522,_0xd583ae){return new BPromise(function(_0x57e5f3,_0x4e6b00){var _0x49519a=_0xd583ae||client;return _0x49519a[_0x1dec('0x21')](_0xace682,_0x5e8522)['then'](function(_0x29633f){logger[_0x1dec('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x4d7493,'request\x20sent');logger[_0x1dec('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4d7493,'request\x20sent',JSON['stringify'](_0x29633f));if(_0x29633f[_0x1dec('0x24')]){if(_0x29633f[_0x1dec('0x24')][_0x1dec('0x25')]===0x1f4){logger[_0x1dec('0x24')](_0x1dec('0x26'),_0x4d7493,_0x29633f[_0x1dec('0x24')]['message']);return _0x4e6b00(_0x29633f['error'][_0x1dec('0x27')]);}logger[_0x1dec('0x24')](_0x1dec('0x26'),_0x4d7493,_0x29633f[_0x1dec('0x24')][_0x1dec('0x27')]);return _0x57e5f3(_0x29633f[_0x1dec('0x24')]['message']);}else{logger[_0x1dec('0x22')](_0x1dec('0x26'),_0x4d7493,_0x1dec('0x28'));_0x57e5f3(_0x29633f[_0x1dec('0x29')][_0x1dec('0x27')]);}})[_0x1dec('0x2a')](function(_0x10a91e){logger[_0x1dec('0x24')](_0x1dec('0x26'),_0x4d7493,_0x10a91e);_0x4e6b00(_0x10a91e);});});}function respondWithStatusCode(_0x571d2a,_0x320d93){_0x320d93=_0x320d93||0xcc;return function(_0x190210){if(_0x190210){return _0x571d2a[_0x1dec('0x2b')](_0x320d93);}return _0x571d2a[_0x1dec('0x2c')](_0x320d93)['end']();};}function respondWithResult(_0xd03aba,_0x2fb181){_0x2fb181=_0x2fb181||0xc8;return function(_0x4d9294){if(_0x4d9294){return _0xd03aba[_0x1dec('0x2c')](_0x2fb181)[_0x1dec('0x2d')](_0x4d9294);}};}function respondWithFilteredResult(_0x32b466,_0x2a9db7){return function(_0x4076f2){if(_0x4076f2){var _0x53c7ed=_0x4076f2[_0x1dec('0x2e')],_0x53d60d=_0x2a9db7[_0x1dec('0x2f')],_0x5864f1=_0x2a9db7[_0x1dec('0x2f')]+_0x2a9db7['limit'],_0x1664ad;if(_0x5864f1>=_0x53c7ed){_0x5864f1=_0x53c7ed;_0x1664ad=0xc8;}else{_0x1664ad=0xce;}_0x32b466[_0x1dec('0x2c')](_0x1664ad);return _0x32b466[_0x1dec('0x30')]('Content-Range',_0x53d60d+'-'+_0x5864f1+'/'+_0x53c7ed)[_0x1dec('0x2d')](_0x4076f2);}return null;};}function patchUpdates(_0x194684){return function(_0x89d966){try{jsonpatch[_0x1dec('0x31')](_0x89d966,_0x194684,!![]);}catch(_0x16feb2){return BPromise['reject'](_0x16feb2);}return _0x89d966[_0x1dec('0x32')]();};}function saveUpdates(_0x9497a8,_0x461410){return function(_0x119764){if(_0x119764){return _0x119764[_0x1dec('0x33')](_0x9497a8)[_0x1dec('0x34')](function(_0x3e27fc){return _0x3e27fc;});}return null;};}function removeEntity(_0x32fa76,_0x2b01f4){return function(_0x240485){if(_0x240485){return _0x240485[_0x1dec('0x35')]()[_0x1dec('0x34')](function(){var _0x11024d=_0x240485[_0x1dec('0x36')]({'plain':!![]});var _0x52eb29='WhatsappAccounts';return db[_0x1dec('0x37')]['destroy']({'where':{'type':_0x52eb29,'resourceId':_0x11024d['id']}})['then'](function(){return _0x240485;});})[_0x1dec('0x34')](function(){_0x32fa76[_0x1dec('0x2c')](0xcc)[_0x1dec('0x38')]();});}};}function handleEntityNotFound(_0x464a27,_0x7820b3){return function(_0x1356fa){if(!_0x1356fa){_0x464a27[_0x1dec('0x2b')](0x194);}return _0x1356fa;};}function handleError(_0x37bdd9,_0x3383d9){_0x3383d9=_0x3383d9||0x1f4;return function(_0x24afc3){logger[_0x1dec('0x24')](_0x24afc3[_0x1dec('0x39')]);if(_0x24afc3[_0x1dec('0x3a')]){delete _0x24afc3[_0x1dec('0x3a')];}_0x37bdd9[_0x1dec('0x2c')](_0x3383d9)['send'](_0x24afc3);};}exports[_0x1dec('0x3b')]=function(_0x48972c,_0x20a153){var _0x1066cc={'include':[{'model':db[_0x1dec('0x3c')],'as':_0x1dec('0x3d')}]},_0x1798c1={},_0x495afa={'count':0x0,'rows':[]};var _0x11cf22=_['map'](db['WhatsappAccount'][_0x1dec('0x3e')],function(_0x4d4274){return{'name':_0x4d4274['fieldName'],'type':_0x4d4274[_0x1dec('0x3f')][_0x1dec('0x40')]};});_0x1798c1[_0x1dec('0x41')]=_['map'](_0x11cf22,'name');_0x1798c1['query']=_['keys'](_0x48972c[_0x1dec('0x42')]);_0x1798c1[_0x1dec('0x43')]=_[_0x1dec('0x44')](_0x1798c1['model'],_0x1798c1[_0x1dec('0x42')]);_0x1066cc[_0x1dec('0x45')]=_[_0x1dec('0x44')](_0x1798c1[_0x1dec('0x41')],qs[_0x1dec('0x46')](_0x48972c[_0x1dec('0x42')][_0x1dec('0x46')]));_0x1066cc[_0x1dec('0x45')]=_0x1066cc[_0x1dec('0x45')][_0x1dec('0x47')]?_0x1066cc[_0x1dec('0x45')]:_0x1798c1[_0x1dec('0x41')];if(!_0x48972c[_0x1dec('0x42')][_0x1dec('0x48')](_0x1dec('0x49'))){_0x1066cc['limit']=qs[_0x1dec('0x4a')](_0x48972c['query'][_0x1dec('0x4a')]);_0x1066cc[_0x1dec('0x2f')]=qs[_0x1dec('0x2f')](_0x48972c[_0x1dec('0x42')]['offset']);}_0x1066cc[_0x1dec('0x4b')]=qs[_0x1dec('0x4c')](_0x48972c[_0x1dec('0x42')]['sort']);_0x1066cc[_0x1dec('0x4d')]=qs[_0x1dec('0x43')](_[_0x1dec('0x4e')](_0x48972c[_0x1dec('0x42')],_0x1798c1[_0x1dec('0x43')]),_0x11cf22);if(_0x48972c['query'][_0x1dec('0x4f')]){_0x1066cc[_0x1dec('0x4d')]=_[_0x1dec('0x50')](_0x1066cc[_0x1dec('0x4d')],{'$or':_[_0x1dec('0x51')](_0x11cf22,function(_0x33b1f2){if(_0x33b1f2[_0x1dec('0x3f')]!==_0x1dec('0x52')){var _0x3da860={};_0x3da860[_0x33b1f2[_0x1dec('0x3a')]]={'$like':'%'+_0x48972c[_0x1dec('0x42')][_0x1dec('0x4f')]+'%'};return _0x3da860;}})});}_0x1066cc=_[_0x1dec('0x50')]({},_0x1066cc,_0x48972c[_0x1dec('0x53')]);var _0x42b2b8={'where':_0x1066cc[_0x1dec('0x4d')]};return db['WhatsappAccount'][_0x1dec('0x2e')](_0x42b2b8)[_0x1dec('0x34')](function(_0x5b7bc9){_0x495afa[_0x1dec('0x2e')]=_0x5b7bc9;if(_0x48972c[_0x1dec('0x42')][_0x1dec('0x54')]){_0x1066cc[_0x1dec('0x55')]=[{'all':!![]}];}return db[_0x1dec('0x56')][_0x1dec('0x57')](_0x1066cc);})['then'](function(_0x4a28f8){_0x495afa[_0x1dec('0x58')]=_0x4a28f8;return _0x495afa;})[_0x1dec('0x34')](respondWithFilteredResult(_0x20a153,_0x1066cc))[_0x1dec('0x2a')](handleError(_0x20a153,null));};exports[_0x1dec('0x59')]=function(_0x15fddf,_0x43c556){var _0x482c41={'raw':![],'where':{'id':_0x15fddf[_0x1dec('0x5a')]['id']},'include':[{'model':db[_0x1dec('0x3c')],'as':_0x1dec('0x3d')}]},_0x3ee93d={};_0x3ee93d[_0x1dec('0x41')]=_[_0x1dec('0x5b')](db[_0x1dec('0x56')][_0x1dec('0x3e')]);_0x3ee93d[_0x1dec('0x42')]=_[_0x1dec('0x5b')](_0x15fddf['query']);_0x3ee93d[_0x1dec('0x5c')]=_[_0x1dec('0x44')](_0x3ee93d[_0x1dec('0x41')],_0x3ee93d['query']);_0x482c41[_0x1dec('0x45')]=_[_0x1dec('0x44')](_0x3ee93d[_0x1dec('0x41')],qs[_0x1dec('0x46')](_0x15fddf[_0x1dec('0x42')][_0x1dec('0x46')]));_0x482c41[_0x1dec('0x45')]=_0x482c41[_0x1dec('0x45')][_0x1dec('0x47')]?_0x482c41['attributes']:_0x3ee93d[_0x1dec('0x41')];if(_0x15fddf[_0x1dec('0x42')][_0x1dec('0x54')]){_0x482c41[_0x1dec('0x55')]=[{'all':!![]}];}_0x482c41=_[_0x1dec('0x50')]({},_0x482c41,_0x15fddf[_0x1dec('0x53')]);return db['WhatsappAccount']['find'](_0x482c41)['then'](handleEntityNotFound(_0x43c556,null))[_0x1dec('0x34')](respondWithResult(_0x43c556,null))['catch'](handleError(_0x43c556,null));};exports['create']=function(_0x546eef,_0x35353e){return db[_0x1dec('0x56')]['create'](_0x546eef['body'],{})[_0x1dec('0x34')](function(_0x150bc6){var _0x47ca2e=_0x546eef[_0x1dec('0x5d')][_0x1dec('0x36')]({'plain':!![]});if(!_0x47ca2e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47ca2e[_0x1dec('0x5e')]==='user'){var _0x14ef78=_0x150bc6['get']({'plain':!![]});var _0x36bb0d=_0x1dec('0x5f');return db[_0x1dec('0x60')][_0x1dec('0x61')]({'where':{'name':_0x36bb0d,'userProfileId':_0x47ca2e[_0x1dec('0x62')]},'raw':!![]})['then'](function(_0x219010){if(_0x219010&&_0x219010[_0x1dec('0x63')]===0x0){return db[_0x1dec('0x37')][_0x1dec('0x64')]({'name':_0x14ef78[_0x1dec('0x3a')],'resourceId':_0x14ef78['id'],'type':_0x219010['name'],'sectionId':_0x219010['id']},{})['then'](function(){return _0x150bc6;});}else{return _0x150bc6;}})[_0x1dec('0x2a')](function(_0x4611c7){logger[_0x1dec('0x24')](_0x1dec('0x65'),_0x4611c7);throw _0x4611c7;});}return _0x150bc6;})[_0x1dec('0x34')](respondWithResult(_0x35353e,0xc9))[_0x1dec('0x2a')](handleError(_0x35353e,null));};exports[_0x1dec('0x33')]=function(_0x5cea34,_0x10d23a){if(_0x5cea34[_0x1dec('0x66')]['id']){delete _0x5cea34[_0x1dec('0x66')]['id'];}return db[_0x1dec('0x56')][_0x1dec('0x61')]({'where':{'id':_0x5cea34['params']['id']},'include':[{'model':db[_0x1dec('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x1dec('0x34')](handleEntityNotFound(_0x10d23a,null))[_0x1dec('0x34')](saveUpdates(_0x5cea34[_0x1dec('0x66')],null))['then'](respondWithResult(_0x10d23a,null))[_0x1dec('0x2a')](handleError(_0x10d23a,null));};exports[_0x1dec('0x35')]=function(_0x293f81,_0x11bb18){return db[_0x1dec('0x56')][_0x1dec('0x61')]({'where':{'id':_0x293f81[_0x1dec('0x5a')]['id']}})[_0x1dec('0x34')](handleEntityNotFound(_0x11bb18,null))[_0x1dec('0x34')](removeEntity(_0x11bb18,null))[_0x1dec('0x2a')](handleError(_0x11bb18,null));};exports[_0x1dec('0x67')]=function(_0x33e22b,_0x31df68){return db[_0x1dec('0x56')][_0x1dec('0x67')]()[_0x1dec('0x34')](respondWithResult(_0x31df68,null))[_0x1dec('0x2a')](handleError(_0x31df68,null));};exports['addDisposition']=function(_0x5ae238,_0x3290d8,_0x8e8dd6){if(_0x5ae238[_0x1dec('0x66')]['id']){delete _0x5ae238[_0x1dec('0x66')]['id'];}return db[_0x1dec('0x56')]['find']({'where':{'id':_0x5ae238['params']['id']}})['then'](handleEntityNotFound(_0x3290d8,null))['then'](function(_0x88db73){if(_0x88db73){_0x5ae238[_0x1dec('0x66')][_0x1dec('0x68')]=_0x88db73['id'];return db[_0x1dec('0x69')]['create'](_0x5ae238['body']);}})['then'](respondWithResult(_0x3290d8,null))[_0x1dec('0x2a')](handleError(_0x3290d8,null));};exports[_0x1dec('0x6a')]=function(_0x30bc9c,_0x4d9f7a,_0x33a44d){var _0x4592b5={'raw':![],'where':{}};var _0x412cfc={};var _0x13c872={'count':0x0,'rows':[]};return db[_0x1dec('0x56')][_0x1dec('0x6b')]({'where':{'id':_0x30bc9c['params']['id']}})[_0x1dec('0x34')](handleEntityNotFound(_0x4d9f7a,null))['then'](function(_0x241fd1){if(_0x241fd1){_0x412cfc[_0x1dec('0x41')]=_[_0x1dec('0x5b')](db[_0x1dec('0x69')][_0x1dec('0x3e')]);_0x412cfc[_0x1dec('0x42')]=_[_0x1dec('0x5b')](_0x30bc9c['query']);_0x412cfc[_0x1dec('0x43')]=_[_0x1dec('0x44')](_0x412cfc['model'],_0x412cfc[_0x1dec('0x42')]);_0x4592b5[_0x1dec('0x45')]=_[_0x1dec('0x44')](_0x412cfc[_0x1dec('0x41')],qs[_0x1dec('0x46')](_0x30bc9c[_0x1dec('0x42')][_0x1dec('0x46')]));_0x4592b5[_0x1dec('0x45')]=_0x4592b5['attributes']['length']?_0x4592b5[_0x1dec('0x45')]:_0x412cfc['model'];if(!_0x30bc9c[_0x1dec('0x42')][_0x1dec('0x48')]('nolimit')){_0x4592b5['limit']=qs[_0x1dec('0x4a')](_0x30bc9c['query'][_0x1dec('0x4a')]);_0x4592b5[_0x1dec('0x2f')]=qs[_0x1dec('0x2f')](_0x30bc9c['query'][_0x1dec('0x2f')]);}_0x4592b5[_0x1dec('0x4b')]=qs[_0x1dec('0x4c')](_0x30bc9c[_0x1dec('0x42')]['sort']);_0x4592b5[_0x1dec('0x4d')]=qs[_0x1dec('0x43')](_['pick'](_0x30bc9c[_0x1dec('0x42')],_0x412cfc[_0x1dec('0x43')]));_0x4592b5[_0x1dec('0x4d')][_0x1dec('0x68')]=_0x241fd1['id'];if(_0x30bc9c[_0x1dec('0x42')]['filter']){_0x4592b5['where']=_[_0x1dec('0x50')](_0x4592b5[_0x1dec('0x4d')],{'$or':_['map'](_0x4592b5[_0x1dec('0x45')],function(_0x1cfc0d){var _0x51c1a2={};_0x51c1a2[_0x1cfc0d]={'$like':'%'+_0x30bc9c['query'][_0x1dec('0x4f')]+'%'};return _0x51c1a2;})});}_0x4592b5=_[_0x1dec('0x50')]({},_0x4592b5,_0x30bc9c[_0x1dec('0x53')]);return db['Disposition'][_0x1dec('0x2e')]({'where':_0x4592b5[_0x1dec('0x4d')]})['then'](function(_0x557ec8){_0x13c872[_0x1dec('0x2e')]=_0x557ec8;if(_0x30bc9c[_0x1dec('0x42')]['includeAll']){_0x4592b5['include']=[{'all':!![]}];}return db[_0x1dec('0x69')][_0x1dec('0x57')](_0x4592b5);})[_0x1dec('0x34')](function(_0x464a82){_0x13c872[_0x1dec('0x58')]=_0x464a82;return _0x13c872;});}})[_0x1dec('0x34')](respondWithFilteredResult(_0x4d9f7a,_0x4592b5))['catch'](handleError(_0x4d9f7a,null));};exports['removeDispositions']=function(_0x261261,_0x4d9657,_0x13fad0){return db[_0x1dec('0x56')][_0x1dec('0x61')]({'where':{'id':_0x261261['params']['id']}})['then'](handleEntityNotFound(_0x4d9657,null))['then'](function(_0x32507a){if(_0x32507a){return _0x32507a[_0x1dec('0x6c')](_0x261261[_0x1dec('0x42')][_0x1dec('0x6d')]);}})[_0x1dec('0x34')](respondWithStatusCode(_0x4d9657,null))[_0x1dec('0x2a')](handleError(_0x4d9657,null));};exports[_0x1dec('0x6e')]=function(_0x15a088,_0x1b0045,_0x18b708){if(_0x15a088['body']['id']){delete _0x15a088[_0x1dec('0x66')]['id'];}return db['WhatsappAccount'][_0x1dec('0x61')]({'where':{'id':_0x15a088['params']['id']}})[_0x1dec('0x34')](handleEntityNotFound(_0x1b0045,null))[_0x1dec('0x34')](function(_0x5bad05){if(_0x5bad05){_0x15a088[_0x1dec('0x66')]['WhatsappAccountId']=_0x5bad05['id'];return db[_0x1dec('0x6f')][_0x1dec('0x64')](_0x15a088[_0x1dec('0x66')]);}})['then'](respondWithResult(_0x1b0045,null))[_0x1dec('0x2a')](handleError(_0x1b0045,null));};exports['getAnswers']=function(_0x24ae07,_0x51136d,_0x23c24b){var _0x5d7ebc={'raw':![],'where':{}};var _0x4c85f6={};var _0x12f2ba={'count':0x0,'rows':[]};return db[_0x1dec('0x56')][_0x1dec('0x6b')]({'where':{'id':_0x24ae07[_0x1dec('0x5a')]['id']}})[_0x1dec('0x34')](handleEntityNotFound(_0x51136d,null))[_0x1dec('0x34')](function(_0x113f68){if(_0x113f68){_0x4c85f6[_0x1dec('0x41')]=_[_0x1dec('0x5b')](db[_0x1dec('0x6f')][_0x1dec('0x3e')]);_0x4c85f6['query']=_[_0x1dec('0x5b')](_0x24ae07['query']);_0x4c85f6[_0x1dec('0x43')]=_[_0x1dec('0x44')](_0x4c85f6[_0x1dec('0x41')],_0x4c85f6[_0x1dec('0x42')]);_0x5d7ebc[_0x1dec('0x45')]=_[_0x1dec('0x44')](_0x4c85f6[_0x1dec('0x41')],qs[_0x1dec('0x46')](_0x24ae07[_0x1dec('0x42')][_0x1dec('0x46')]));_0x5d7ebc['attributes']=_0x5d7ebc[_0x1dec('0x45')][_0x1dec('0x47')]?_0x5d7ebc[_0x1dec('0x45')]:_0x4c85f6[_0x1dec('0x41')];if(!_0x24ae07[_0x1dec('0x42')][_0x1dec('0x48')](_0x1dec('0x49'))){_0x5d7ebc[_0x1dec('0x4a')]=qs[_0x1dec('0x4a')](_0x24ae07[_0x1dec('0x42')][_0x1dec('0x4a')]);_0x5d7ebc[_0x1dec('0x2f')]=qs['offset'](_0x24ae07[_0x1dec('0x42')][_0x1dec('0x2f')]);}_0x5d7ebc[_0x1dec('0x4b')]=qs[_0x1dec('0x4c')](_0x24ae07['query']['sort']);_0x5d7ebc['where']=qs[_0x1dec('0x43')](_[_0x1dec('0x4e')](_0x24ae07[_0x1dec('0x42')],_0x4c85f6[_0x1dec('0x43')]));_0x5d7ebc['where'][_0x1dec('0x68')]=_0x113f68['id'];if(_0x24ae07[_0x1dec('0x42')][_0x1dec('0x4f')]){_0x5d7ebc[_0x1dec('0x4d')]=_['merge'](_0x5d7ebc[_0x1dec('0x4d')],{'$or':_['map'](_0x5d7ebc[_0x1dec('0x45')],function(_0x2e5de6){var _0x46cd12={};_0x46cd12[_0x2e5de6]={'$like':'%'+_0x24ae07[_0x1dec('0x42')]['filter']+'%'};return _0x46cd12;})});}_0x5d7ebc=_[_0x1dec('0x50')]({},_0x5d7ebc,_0x24ae07['options']);return db[_0x1dec('0x6f')]['count']({'where':_0x5d7ebc[_0x1dec('0x4d')]})[_0x1dec('0x34')](function(_0x58ae62){_0x12f2ba[_0x1dec('0x2e')]=_0x58ae62;if(_0x24ae07[_0x1dec('0x42')][_0x1dec('0x54')]){_0x5d7ebc['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x5d7ebc);})[_0x1dec('0x34')](function(_0x7f26b2){_0x12f2ba[_0x1dec('0x58')]=_0x7f26b2;return _0x12f2ba;});}})['then'](respondWithFilteredResult(_0x51136d,_0x5d7ebc))[_0x1dec('0x2a')](handleError(_0x51136d,null));};exports[_0x1dec('0x70')]=function(_0x3eb46e,_0x103ef2,_0xd21b7d){return db[_0x1dec('0x56')]['find']({'where':{'id':_0x3eb46e[_0x1dec('0x5a')]['id']}})[_0x1dec('0x34')](handleEntityNotFound(_0x103ef2,null))[_0x1dec('0x34')](function(_0x4f8335){if(_0x4f8335){return _0x4f8335[_0x1dec('0x70')](_0x3eb46e[_0x1dec('0x42')]['ids']);}})[_0x1dec('0x34')](respondWithStatusCode(_0x103ef2,null))[_0x1dec('0x2a')](handleError(_0x103ef2,null));};exports['addAgents']=function(_0x530876,_0x2db96b,_0x3475f4){return db[_0x1dec('0x56')][_0x1dec('0x61')]({'where':{'id':_0x530876[_0x1dec('0x5a')]['id']}})[_0x1dec('0x34')](handleEntityNotFound(_0x2db96b,null))[_0x1dec('0x34')](function(_0x316487){if(_0x316487){return _0x316487[_0x1dec('0x71')](_0x530876[_0x1dec('0x66')][_0x1dec('0x6d')],_[_0x1dec('0x72')](_0x530876[_0x1dec('0x66')],[_0x1dec('0x6d'),'id'])||{})[_0x1dec('0x73')](function(_0x380f41){for(var _0x40bdf1=0x0;_0x40bdf1<_0x530876[_0x1dec('0x66')][_0x1dec('0x6d')][_0x1dec('0x47')];_0x40bdf1+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':_0x530876[_0x1dec('0x66')][_0x1dec('0x6d')][_0x40bdf1],'WhatsappAccountId':_0x530876[_0x1dec('0x5a')]['id']});}return _0x380f41;});}})['then'](respondWithResult(_0x2db96b,null))[_0x1dec('0x2a')](handleError(_0x2db96b,null));};exports[_0x1dec('0x74')]=function(_0x3a0430,_0x5ed46c,_0x4479b4){return db[_0x1dec('0x56')][_0x1dec('0x61')]({'where':{'id':_0x3a0430[_0x1dec('0x5a')]['id']}})[_0x1dec('0x34')](handleEntityNotFound(_0x5ed46c,null))[_0x1dec('0x34')](function(_0x355080){if(_0x355080){return _0x355080[_0x1dec('0x74')](_0x3a0430[_0x1dec('0x42')]['ids'])[_0x1dec('0x34')](function(){if(_['isArray'](_0x3a0430['query'][_0x1dec('0x6d')])){for(var _0x1fd13c=0x0;_0x1fd13c<_0x3a0430[_0x1dec('0x42')][_0x1dec('0x6d')][_0x1dec('0x47')];_0x1fd13c+=0x1){socket[_0x1dec('0x75')](_0x1dec('0x76'),{'UserId':Number(_0x3a0430['query']['ids'][_0x1fd13c]),'WhatsappAccountId':Number(_0x3a0430['params']['id'])});}}else{socket[_0x1dec('0x75')](_0x1dec('0x76'),{'UserId':Number(_0x3a0430['query'][_0x1dec('0x6d')]),'WhatsappAccountId':Number(_0x3a0430[_0x1dec('0x5a')]['id'])});}});}})[_0x1dec('0x34')](respondWithStatusCode(_0x5ed46c,null))[_0x1dec('0x2a')](handleError(_0x5ed46c,null));};exports[_0x1dec('0x77')]=function(_0x5dca50,_0x2972c7,_0x27b6fc){var _0x2b0daf={};var _0x3842f5={};var _0x4750b8;var _0x394a0d;return db[_0x1dec('0x56')][_0x1dec('0x6b')]({'where':{'id':_0x5dca50['params']['id']}})[_0x1dec('0x34')](handleEntityNotFound(_0x2972c7,null))[_0x1dec('0x34')](function(_0x4caf68){if(_0x4caf68){_0x4750b8=_0x4caf68;_0x3842f5[_0x1dec('0x41')]=_[_0x1dec('0x5b')](db['User']['rawAttributes']);_0x3842f5[_0x1dec('0x42')]=_[_0x1dec('0x5b')](_0x5dca50[_0x1dec('0x42')]);_0x3842f5[_0x1dec('0x43')]=_[_0x1dec('0x44')](_0x3842f5[_0x1dec('0x41')],_0x3842f5[_0x1dec('0x42')]);_0x2b0daf[_0x1dec('0x45')]=_['intersection'](_0x3842f5[_0x1dec('0x41')],qs[_0x1dec('0x46')](_0x5dca50[_0x1dec('0x42')]['fields']));_0x2b0daf[_0x1dec('0x45')]=_0x2b0daf[_0x1dec('0x45')][_0x1dec('0x47')]?_0x2b0daf[_0x1dec('0x45')]:_0x3842f5['model'];_0x2b0daf[_0x1dec('0x4b')]=qs[_0x1dec('0x4c')](_0x5dca50[_0x1dec('0x42')][_0x1dec('0x4c')]);_0x2b0daf[_0x1dec('0x4d')]=qs[_0x1dec('0x43')](_[_0x1dec('0x4e')](_0x5dca50[_0x1dec('0x42')],_0x3842f5[_0x1dec('0x43')]));if(_0x5dca50[_0x1dec('0x42')][_0x1dec('0x4f')]){_0x2b0daf[_0x1dec('0x4d')]=_[_0x1dec('0x50')](_0x2b0daf[_0x1dec('0x4d')],{'$or':_[_0x1dec('0x51')](_0x2b0daf[_0x1dec('0x45')],function(_0x6315f8){var _0x551719={};_0x551719[_0x6315f8]={'$like':'%'+_0x5dca50[_0x1dec('0x42')][_0x1dec('0x4f')]+'%'};return _0x551719;})});}_0x2b0daf=_['merge']({},_0x2b0daf,_0x5dca50['options']);return _0x4750b8[_0x1dec('0x77')](_0x2b0daf);}})[_0x1dec('0x34')](function(_0x246d9d){if(_0x246d9d){_0x394a0d=_0x246d9d[_0x1dec('0x47')];if(!_0x5dca50[_0x1dec('0x42')][_0x1dec('0x48')](_0x1dec('0x49'))){_0x2b0daf[_0x1dec('0x4a')]=qs[_0x1dec('0x4a')](_0x5dca50[_0x1dec('0x42')][_0x1dec('0x4a')]);_0x2b0daf[_0x1dec('0x2f')]=qs[_0x1dec('0x2f')](_0x5dca50['query'][_0x1dec('0x2f')]);}return _0x4750b8[_0x1dec('0x77')](_0x2b0daf);}})[_0x1dec('0x34')](function(_0x2c44){if(_0x2c44){return _0x2c44?{'count':_0x394a0d,'rows':_0x2c44}:null;}})[_0x1dec('0x34')](respondWithResult(_0x2972c7,null))[_0x1dec('0x2a')](handleError(_0x2972c7,null));};exports[_0x1dec('0x78')]=function(_0x1a4068,_0xfc76a9,_0x2da163){return db[_0x1dec('0x56')][_0x1dec('0x6b')]({'where':{'id':_0x1a4068['params']['id']}})[_0x1dec('0x34')](handleEntityNotFound(_0xfc76a9,null))[_0x1dec('0x34')](function(_0x364ce8){if(_0x364ce8){return db[_0x1dec('0x79')]['transaction'](function(_0x242c3c){return db[_0x1dec('0x7a')][_0x1dec('0x35')]({'where':{'WhatsappAccountId':_0x1a4068[_0x1dec('0x5a')]['id']},'transaction':_0x242c3c})['then'](function(_0x23f4f5){var _0x473e27=_[_0x1dec('0x51')](_0x1a4068[_0x1dec('0x66')],function(_0x48d6f1){_0x48d6f1[_0x1dec('0x68')]=_0x1a4068['params']['id'];return _0x48d6f1;});return db[_0x1dec('0x7a')][_0x1dec('0x7b')](_0x473e27,{'transaction':_0x242c3c});});})[_0x1dec('0x34')](function(){return db[_0x1dec('0x7a')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x1a4068[_0x1dec('0x5a')]['id']},'order':'priority'});});}})[_0x1dec('0x34')](respondWithResult(_0xfc76a9,null))['catch'](handleError(_0xfc76a9,null));};exports[_0x1dec('0x7c')]=function(_0x5b24a1,_0x5bb293,_0x18e3aa){var _0x14ec5={};var _0x3d0de4={};var _0x473fde;var _0xa41fc0;return db[_0x1dec('0x56')][_0x1dec('0x6b')]({'where':{'id':_0x5b24a1['params']['id']}})[_0x1dec('0x34')](handleEntityNotFound(_0x5bb293,null))[_0x1dec('0x34')](function(_0x552d3a){if(_0x552d3a){_0x473fde=_0x552d3a;_0x3d0de4[_0x1dec('0x41')]=_['keys'](db['WhatsappApplication'][_0x1dec('0x3e')]);_0x3d0de4[_0x1dec('0x42')]=_['keys'](_0x5b24a1[_0x1dec('0x42')]);_0x3d0de4[_0x1dec('0x43')]=_[_0x1dec('0x44')](_0x3d0de4['model'],_0x3d0de4[_0x1dec('0x42')]);_0x14ec5['attributes']=_[_0x1dec('0x44')](_0x3d0de4[_0x1dec('0x41')],qs['fields'](_0x5b24a1['query'][_0x1dec('0x46')]));_0x14ec5[_0x1dec('0x45')]=_0x14ec5[_0x1dec('0x45')][_0x1dec('0x47')]?_0x14ec5[_0x1dec('0x45')]:_0x3d0de4[_0x1dec('0x41')];_0x14ec5[_0x1dec('0x4b')]=qs[_0x1dec('0x4c')](_0x5b24a1[_0x1dec('0x42')]['sort']);_0x14ec5[_0x1dec('0x4d')]=qs[_0x1dec('0x43')](_[_0x1dec('0x4e')](_0x5b24a1[_0x1dec('0x42')],_0x3d0de4[_0x1dec('0x43')]));if(_0x5b24a1[_0x1dec('0x42')][_0x1dec('0x4f')]){_0x14ec5['where']=_['merge'](_0x14ec5[_0x1dec('0x4d')],{'$or':_[_0x1dec('0x51')](_0x14ec5[_0x1dec('0x45')],function(_0x2e7528){var _0x4577dd={};_0x4577dd[_0x2e7528]={'$like':'%'+_0x5b24a1[_0x1dec('0x42')][_0x1dec('0x4f')]+'%'};return _0x4577dd;})});}_0x14ec5=_[_0x1dec('0x50')]({},_0x14ec5,_0x5b24a1[_0x1dec('0x53')]);return _0x473fde[_0x1dec('0x7c')](_0x14ec5);}})[_0x1dec('0x34')](function(_0x26e22d){if(_0x26e22d){_0xa41fc0=_0x26e22d['length'];if(!_0x5b24a1['query'][_0x1dec('0x48')](_0x1dec('0x49'))){_0x14ec5[_0x1dec('0x4a')]=qs['limit'](_0x5b24a1[_0x1dec('0x42')][_0x1dec('0x4a')]);_0x14ec5[_0x1dec('0x2f')]=qs[_0x1dec('0x2f')](_0x5b24a1[_0x1dec('0x42')]['offset']);}return _0x473fde['getApplications'](_0x14ec5);}})[_0x1dec('0x34')](function(_0x5a24c7){if(_0x5a24c7){return _0x5a24c7?{'count':_0xa41fc0,'rows':_0x5a24c7}:null;}})[_0x1dec('0x34')](respondWithResult(_0x5bb293,null))['catch'](handleError(_0x5bb293,null));};exports[_0x1dec('0x7d')]=function(_0x8c8513,_0x27f114,_0x381c33){var _0x2a3211={'channel':_0x1dec('0x7e')};var _0x21f263=[];var _0x225805=[];var _0x7531fb={};return db[_0x1dec('0x56')][_0x1dec('0x61')]({'where':{'id':_0x8c8513[_0x1dec('0x5a')]['id']},'include':[{'model':db[_0x1dec('0x7a')],'as':_0x1dec('0x7f')}]})[_0x1dec('0x34')](handleEntityNotFound(_0x27f114,null))[_0x1dec('0x34')](function(_0x7980e6){_0x2a3211[_0x1dec('0x80')]=_0x7980e6;_0x2a3211['applications']=_[_0x1dec('0x81')](_0x7980e6[_0x1dec('0x7f')],[_0x1dec('0x82')],['asc']);if(_0x2a3211[_0x1dec('0x80')]['Applications']){delete _0x2a3211[_0x1dec('0x80')][_0x1dec('0x7f')];}return db['CmContact'][_0x1dec('0x67')]();})['then'](function(_0x4404f9){if(!_0x4404f9){throw new db[(_0x1dec('0x83'))][(_0x1dec('0x84'))]('no\x20available\x20attributes');}_0x21f263=_[_0x1dec('0x85')](_[_0x1dec('0x5b')](_0x4404f9),[_0x1dec('0x86'),_0x1dec('0x87')]);_0x225805=_[_0x1dec('0x85')](_[_0x1dec('0x5b')](_0x4404f9),['createdAt',_0x1dec('0x87'),_0x1dec('0x88'),_0x1dec('0x89')]);_0x2a3211[_0x1dec('0x66')]={'mapKey':_0x1dec('0x8a')};if(_0x2a3211[_0x1dec('0x80')]['type']&&_0x2a3211['account'][_0x1dec('0x3f')]==='twilio'){_0x2a3211[_0x1dec('0x66')][_0x1dec('0x8b')]=_0x8c8513[_0x1dec('0x66')][_0x1dec('0x8c')][_0x1dec('0x8d')](_0x1dec('0x8e'),'');_0x2a3211[_0x1dec('0x66')][_0x1dec('0x66')]=_0x8c8513[_0x1dec('0x66')][_0x1dec('0x8f')];_0x2a3211['body'][_0x1dec('0x90')]=_0x8c8513[_0x1dec('0x66')]['MessageSid'];}if(_0x2a3211[_0x1dec('0x66')]['id']){delete _0x2a3211[_0x1dec('0x66')]['id'];}if(_['isNil'](_0x2a3211[_0x1dec('0x66')]['from'])){throw new db[(_0x1dec('0x83'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x2a3211[_0x1dec('0x66')]['body'])||_0x2a3211[_0x1dec('0x66')][_0x1dec('0x66')]===''){throw new db[(_0x1dec('0x83'))]['ValidationError'](_0x1dec('0x91'));}if(_[_0x1dec('0x92')](_0x2a3211[_0x1dec('0x66')][_0x1dec('0x93')])){throw new db['Sequelize'][(_0x1dec('0x84'))](_0x1dec('0x94')+_0x225805);}if(!_[_0x1dec('0x95')](_0x225805,_0x2a3211[_0x1dec('0x66')][_0x1dec('0x93')])){throw new db[(_0x1dec('0x83'))][(_0x1dec('0x84'))](_0x1dec('0x96')+_0x225805);}_0x7531fb[_0x2a3211['body'][_0x1dec('0x93')]]=_0x2a3211[_0x1dec('0x66')][_0x1dec('0x8b')];return db[_0x1dec('0x97')][_0x1dec('0x61')]({'where':{'id':_0x2a3211[_0x1dec('0x80')]['ListId']},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x7531fb,'limit':0x1,'order':[[_0x1dec('0x87'),_0x1dec('0x98')]]}]});})['then'](handleEntityNotFound(_0x27f114,null))['then'](function(_0x58c40f){if(_0x58c40f){_0x2a3211[_0x1dec('0x99')]=_[_0x1dec('0x72')](_0x58c40f,[_0x1dec('0x9a')]);if(_0x58c40f[_0x1dec('0x9a')][_0x1dec('0x47')]){return _0x58c40f['Contacts'][0x0];}var _0x10dc79=_[_0x1dec('0x18')](_0x2a3211[_0x1dec('0x66')],{'firstName':_0x2a3211[_0x1dec('0x66')]['from'],'ListId':_0x58c40f['id']});_0x10dc79[_0x2a3211[_0x1dec('0x66')][_0x1dec('0x93')]]=_0x2a3211[_0x1dec('0x66')][_0x1dec('0x8b')];return db['CmContact'][_0x1dec('0x64')](_0x10dc79,{'fields':_0x21f263,'raw':!![]});}})[_0x1dec('0x34')](handleEntityNotFound(_0x27f114,null))[_0x1dec('0x34')](function(_0x41f474){if(_0x41f474){_0x2a3211['contact']=_0x41f474;var _0x325b42={'ContactId':_0x41f474['id'],'phone':_0x2a3211[_0x1dec('0x66')][_0x1dec('0x8b')],'WhatsappAccountId':_0x8c8513[_0x1dec('0x5a')]['id']};var _0x988676={'ContactId':_0x41f474['id'],'WhatsappAccountId':_0x8c8513['params']['id'],'closed':![]};return db[_0x1dec('0x9b')][_0x1dec('0x61')]({'where':_0x988676})[_0x1dec('0x34')](function(_0x40344a){if(_0x40344a){return[_0x40344a,![]];}return db[_0x1dec('0x9b')][_0x1dec('0x64')](_0x325b42)[_0x1dec('0x34')](function(_0x5b459c){return[_0x5b459c,!![]];});});}})[_0x1dec('0x73')](function(_0x3dc566,_0xdf7c89){_0x2a3211[_0x1dec('0x9c')]=_0x3dc566[_0x1dec('0x36')]({'plain':!![]});_0x2a3211[_0x1dec('0x9c')]['created']=![];if(_0xdf7c89){if(_0x2a3211[_0x1dec('0x80')][_0x1dec('0x9d')]){_0x2a3211[_0x1dec('0x9e')][_0x1dec('0x9f')]({'id':0x0,'priority':_0x2a3211[_0x1dec('0x9e')][_0x1dec('0x47')]+0x1,'app':_0x1dec('0xa0'),'appdata':_0x1dec('0xa1'),'interval':_0x1dec('0xa2')});}_0x2a3211[_0x1dec('0x9c')][_0x1dec('0xa3')]=!![];}return db[_0x1dec('0xa4')]['create']({'phone':_0x2a3211[_0x1dec('0x66')][_0x1dec('0x8b')],'messageId':_0x2a3211[_0x1dec('0x66')][_0x1dec('0x90')],'body':_0x2a3211[_0x1dec('0x66')]['body'],'WhatsappAccountId':_0x8c8513['params']['id'],'WhatsappInteractionId':_0x3dc566['id'],'direction':'in','ContactId':_0x3dc566[_0x1dec('0xa5')],'AttachmentId':_0x2a3211[_0x1dec('0x66')]['AttachmentId']});})[_0x1dec('0x34')](function(_0xde9789){_0x2a3211['message']=_0xde9789;if(_0x2a3211[_0x1dec('0x9c')][_0x1dec('0xa6')]){return db[_0x1dec('0xa7')][_0x1dec('0x61')]({'attributes':['id',_0x1dec('0x3a')],'where':{'id':_0x2a3211[_0x1dec('0x9c')][_0x1dec('0xa6')]}})['then'](function(_0x3c0dc8){if(_0x3c0dc8){_0x2a3211[_0x1dec('0x9e')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1dec('0xa8'),'appdata':_0x3c0dc8[_0x1dec('0x3a')]+','+(_0x2a3211[_0x1dec('0x80')][_0x1dec('0xa9')]||0xa),'interval':_0x1dec('0xa2')});}return respondWithRpcPromise(_0x1dec('0xaa'),'startRouting',_0x2a3211);});}return respondWithRpcPromise(_0x1dec('0xaa'),'startRouting',_0x2a3211);})['then'](function(_0xf01aff){if(_0xf01aff){var _0x31111d=0xc8;var _0x462e04=_0x1dec('0xab');logger[_0x1dec('0x22')](_0x1dec('0xac'),_0x462e04,_0x31111d,_0x1dec('0xad'));logger[_0x1dec('0x23')](_0x1dec('0xae'),_0x462e04,_0x31111d,_0x1dec('0xad'),JSON[_0x1dec('0xaf')](_0xf01aff));if(_0x2a3211[_0x1dec('0x80')][_0x1dec('0x3f')]===_0x1dec('0xb0')){return _0x27f114[_0x1dec('0x2c')](_0x31111d)[_0x1dec('0x30')](_0x1dec('0xb1'),'text/xml')[_0x1dec('0xb2')](_0x1dec('0xb3'));}else{return _0x27f114[_0x1dec('0x2c')](_0x31111d)[_0x1dec('0x2d')](_0xf01aff);}}})[_0x1dec('0x2a')](handleError(_0x27f114,null));};exports['send']=function(_0x415e81,_0x4637b9,_0x28ccd4){var _0x368442,_0x3056fd,_0x3071ae;if(_['isNil'](_0x415e81[_0x1dec('0x66')][_0x1dec('0x66')])||_0x415e81[_0x1dec('0x66')][_0x1dec('0x66')]===''){throw new db['Sequelize']['ValidationError'](_0x1dec('0x91'));}if(_[_0x1dec('0x92')](_0x415e81[_0x1dec('0x66')]['to'])){throw new db[(_0x1dec('0x83'))][(_0x1dec('0x84'))](_0x1dec('0xb4'));}_0x368442=_0x415e81[_0x1dec('0x66')]['to'];return db[_0x1dec('0x56')][_0x1dec('0x61')]({'where':{'id':_0x415e81[_0x1dec('0x5a')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x1dec('0x9a'),'where':{'mobile':_0x368442},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x1dec('0x34')](handleEntityNotFound(_0x4637b9,null))['then'](function(_0x21bf1d){if(_0x21bf1d&&_0x21bf1d['List']){_0x3056fd=_0x21bf1d[_0x1dec('0x36')]({'plain':!![]});if(_0x3056fd[_0x1dec('0xb5')]&&_0x3056fd[_0x1dec('0xb5')][_0x1dec('0x9a')][_0x1dec('0x47')]){return _0x3056fd[_0x1dec('0xb5')][_0x1dec('0x9a')][0x0];}return db[_0x1dec('0xb6')][_0x1dec('0x64')](_[_0x1dec('0x18')](_0x415e81['body'],{'firstName':_0x368442,'mobile':_0x368442,'phone':_0x368442,'ListId':_0x3056fd[_0x1dec('0x89')]}));}})[_0x1dec('0x34')](handleEntityNotFound(_0x4637b9,null))[_0x1dec('0x34')](function(_0x141f70){if(_0x141f70){_0x3071ae=_0x141f70;return db[_0x1dec('0x9b')]['find']({'where':{'ContactId':_0x3071ae['id'],'closed':![],'WhatsappAccountId':_0x3056fd['id']}})[_0x1dec('0x34')](function(_0x2db812){if(_0x2db812){return[_0x2db812,![]];}return db['WhatsappInteraction'][_0x1dec('0x64')]({'UserId':_0x415e81[_0x1dec('0x5d')]['id'],'ContactId':_0x3071ae['id'],'WhatsappAccountId':_0x3056fd['id'],'phone':_0x368442,'firstMsgDirection':'out','Messages':[_[_0x1dec('0x50')](_0x415e81['body'],{'read':![],'body':_0x415e81[_0x1dec('0x66')][_0x1dec('0x66')],'phone':_0x368442,'WhatsappAccountId':_0x3056fd['id'],'UserId':_0x415e81[_0x1dec('0x5d')]['id'],'ContactId':_0x3071ae['id']})]},{'include':[{'model':db[_0x1dec('0xa4')],'as':'Messages'}]})[_0x1dec('0x34')](function(_0x5190b1){return[_0x5190b1,!![]];});});}})[_0x1dec('0x73')](function(_0x11bda8,_0x50d441){if(_0x50d441){return _0x11bda8;}return db['WhatsappMessage'][_0x1dec('0x64')](_[_0x1dec('0x50')](_0x415e81[_0x1dec('0x66')],{'read':![],'body':_0x415e81[_0x1dec('0x66')][_0x1dec('0x66')],'phone':_0x368442,'WhatsappAccountId':_0x3056fd['id'],'WhatsappInteractionId':_0x11bda8['id'],'UserId':_0x415e81[_0x1dec('0x5d')]['id'],'ContactId':_0x3071ae['id']}))['then'](function(_0x3d78d2){_0x11bda8['dataValues'][_0x1dec('0xb7')]=[];_0x11bda8['dataValues']['Messages'][_0x1dec('0x9f')](_0x3d78d2['dataValues']);return _0x11bda8;});})[_0x1dec('0x34')](respondWithResult(_0x4637b9,null))[_0x1dec('0x2a')](handleError(_0x4637b9,null));}; \ No newline at end of file +var _0xfe40=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','findOne','WhatsappAccountId','addAnswer','CannedAnswer','nolimit','removeAnswers','ids','addAgents','omit','spread','emit','removeAgents','isArray','getAgents','User','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','Applications','account','applications','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','mobile','from','whatsapp:','Body','messageId','MessageSid','isNil','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','list','Contacts','defaults','contact','WhatsappInteraction','interaction','created','autoclose','close','unmanaged','ContactId','UserId','unshift','agent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','DESC','WhatsappMessage','dataValues','push','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/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','then','info','debug','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','params','keys','rawAttributes','filtears','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource'];(function(_0x425240,_0x4db882){var _0x543dbb=function(_0x45b57c){while(--_0x45b57c){_0x425240['push'](_0x425240['shift']());}};_0x543dbb(++_0x4db882);}(_0xfe40,0x1cb));var _0x0fe4=function(_0x261335,_0x313128){_0x261335=_0x261335-0x0;var _0x444971=_0xfe40[_0x261335];return _0x444971;};'use strict';var pdf=require(_0x0fe4('0x0'));var emlformat=require(_0x0fe4('0x1'));var rimraf=require(_0x0fe4('0x2'));var zipdir=require(_0x0fe4('0x3'));var jsonpatch=require(_0x0fe4('0x4'));var rp=require(_0x0fe4('0x5'));var moment=require('moment');var BPromise=require(_0x0fe4('0x6'));var Mustache=require(_0x0fe4('0x7'));var util=require(_0x0fe4('0x8'));var path=require(_0x0fe4('0x9'));var sox=require(_0x0fe4('0xa'));var csv=require(_0x0fe4('0xb'));var ejs=require(_0x0fe4('0xc'));var fs=require('fs');var _=require(_0x0fe4('0xd'));var squel=require(_0x0fe4('0xe'));var crypto=require(_0x0fe4('0xf'));var jsforce=require(_0x0fe4('0x10'));var deskjs=require(_0x0fe4('0x11'));var toCsv=require(_0x0fe4('0xb'));var querystring=require('querystring');var Papa=require(_0x0fe4('0x12'));var Redis=require(_0x0fe4('0x13'));var authService=require(_0x0fe4('0x14'));var qs=require(_0x0fe4('0x15'));var as=require(_0x0fe4('0x16'));var hardwareService=require(_0x0fe4('0x17'));var logger=require(_0x0fe4('0x18'))(_0x0fe4('0x19'));var utils=require('../../config/utils');var config=require(_0x0fe4('0x1a'));var licenseUtil=require(_0x0fe4('0x1b'));var db=require(_0x0fe4('0x1c'))['db'];config['redis']=_['defaults'](config[_0x0fe4('0x1d')],{'host':_0x0fe4('0x1e'),'port':0x18eb});var socket=require(_0x0fe4('0x1f'))(new Redis(config[_0x0fe4('0x1d')]));require(_0x0fe4('0x20'))['register'](socket);var jayson=require(_0x0fe4('0x21'));var client=jayson[_0x0fe4('0x22')][_0x0fe4('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x32c550,_0x39490b,_0x718641,_0x9f5b40){return new BPromise(function(_0x260120,_0x39d036){var _0x22dda6=_0x9f5b40||client;return _0x22dda6['request'](_0x32c550,_0x718641)[_0x0fe4('0x24')](function(_0x5bb96b){logger[_0x0fe4('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x39490b,'request\x20sent');logger[_0x0fe4('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x39490b,_0x0fe4('0x27'),JSON[_0x0fe4('0x28')](_0x5bb96b));if(_0x5bb96b[_0x0fe4('0x29')]){if(_0x5bb96b[_0x0fe4('0x29')][_0x0fe4('0x2a')]===0x1f4){logger[_0x0fe4('0x29')](_0x0fe4('0x2b'),_0x39490b,_0x5bb96b[_0x0fe4('0x29')]['message']);return _0x39d036(_0x5bb96b[_0x0fe4('0x29')][_0x0fe4('0x2c')]);}logger[_0x0fe4('0x29')]('WhatsappAccount,\x20%s,\x20%s',_0x39490b,_0x5bb96b[_0x0fe4('0x29')][_0x0fe4('0x2c')]);return _0x260120(_0x5bb96b[_0x0fe4('0x29')][_0x0fe4('0x2c')]);}else{logger[_0x0fe4('0x25')](_0x0fe4('0x2b'),_0x39490b,_0x0fe4('0x27'));_0x260120(_0x5bb96b[_0x0fe4('0x2d')][_0x0fe4('0x2c')]);}})[_0x0fe4('0x2e')](function(_0x297c24){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x39490b,_0x297c24);_0x39d036(_0x297c24);});});}function respondWithStatusCode(_0x27cc60,_0x1b4f20){_0x1b4f20=_0x1b4f20||0xcc;return function(_0x54b143){if(_0x54b143){return _0x27cc60[_0x0fe4('0x2f')](_0x1b4f20);}return _0x27cc60[_0x0fe4('0x30')](_0x1b4f20)[_0x0fe4('0x31')]();};}function respondWithResult(_0x4708c9,_0x4a4383){_0x4a4383=_0x4a4383||0xc8;return function(_0xdccd72){if(_0xdccd72){return _0x4708c9[_0x0fe4('0x30')](_0x4a4383)[_0x0fe4('0x32')](_0xdccd72);}};}function respondWithFilteredResult(_0x4a468f,_0x2d77c3){return function(_0x3582d5){if(_0x3582d5){var _0x3a876e=_0x3582d5['count'],_0x54c026=_0x2d77c3[_0x0fe4('0x33')],_0x79d231=_0x2d77c3['offset']+_0x2d77c3[_0x0fe4('0x34')],_0x41da3d;if(_0x79d231>=_0x3a876e){_0x79d231=_0x3a876e;_0x41da3d=0xc8;}else{_0x41da3d=0xce;}_0x4a468f[_0x0fe4('0x30')](_0x41da3d);return _0x4a468f[_0x0fe4('0x35')](_0x0fe4('0x36'),_0x54c026+'-'+_0x79d231+'/'+_0x3a876e)[_0x0fe4('0x32')](_0x3582d5);}return null;};}function patchUpdates(_0x286135){return function(_0x3fcbc5){try{jsonpatch[_0x0fe4('0x37')](_0x3fcbc5,_0x286135,!![]);}catch(_0x39b0d1){return BPromise[_0x0fe4('0x38')](_0x39b0d1);}return _0x3fcbc5[_0x0fe4('0x39')]();};}function saveUpdates(_0x4ac242,_0x127d14){return function(_0x2a152e){if(_0x2a152e){return _0x2a152e[_0x0fe4('0x3a')](_0x4ac242)[_0x0fe4('0x24')](function(_0x57f7e2){return _0x57f7e2;});}return null;};}function removeEntity(_0x3ffc1a,_0x1511f0){return function(_0x524478){if(_0x524478){return _0x524478[_0x0fe4('0x3b')]()[_0x0fe4('0x24')](function(){var _0xbfa935=_0x524478[_0x0fe4('0x3c')]({'plain':!![]});var _0xa52be6=_0x0fe4('0x3d');return db['UserProfileResource'][_0x0fe4('0x3b')]({'where':{'type':_0xa52be6,'resourceId':_0xbfa935['id']}})[_0x0fe4('0x24')](function(){return _0x524478;});})[_0x0fe4('0x24')](function(){_0x3ffc1a[_0x0fe4('0x30')](0xcc)[_0x0fe4('0x31')]();});}};}function handleEntityNotFound(_0x3cf7ef,_0x1e0546){return function(_0x55bbc4){if(!_0x55bbc4){_0x3cf7ef[_0x0fe4('0x2f')](0x194);}return _0x55bbc4;};}function handleError(_0x2e330d,_0x7ca737){_0x7ca737=_0x7ca737||0x1f4;return function(_0x598841){logger['error'](_0x598841[_0x0fe4('0x3e')]);if(_0x598841[_0x0fe4('0x3f')]){delete _0x598841[_0x0fe4('0x3f')];}_0x2e330d[_0x0fe4('0x30')](_0x7ca737)[_0x0fe4('0x40')](_0x598841);};}exports[_0x0fe4('0x41')]=function(_0x32afee,_0x28f45b){var _0x2bdf33={'include':[{'model':db[_0x0fe4('0x42')],'as':_0x0fe4('0x43')}]},_0x15e8c4={},_0x5c19f0={'count':0x0,'rows':[]};var _0x29903f=_[_0x0fe4('0x44')](db[_0x0fe4('0x45')]['rawAttributes'],function(_0x1318a5){return{'name':_0x1318a5['fieldName'],'type':_0x1318a5[_0x0fe4('0x46')][_0x0fe4('0x47')]};});_0x15e8c4[_0x0fe4('0x48')]=_[_0x0fe4('0x44')](_0x29903f,_0x0fe4('0x3f'));_0x15e8c4[_0x0fe4('0x49')]=_['keys'](_0x32afee['query']);_0x15e8c4[_0x0fe4('0x4a')]=_[_0x0fe4('0x4b')](_0x15e8c4[_0x0fe4('0x48')],_0x15e8c4[_0x0fe4('0x49')]);_0x2bdf33[_0x0fe4('0x4c')]=_[_0x0fe4('0x4b')](_0x15e8c4[_0x0fe4('0x48')],qs[_0x0fe4('0x4d')](_0x32afee[_0x0fe4('0x49')][_0x0fe4('0x4d')]));_0x2bdf33[_0x0fe4('0x4c')]=_0x2bdf33[_0x0fe4('0x4c')][_0x0fe4('0x4e')]?_0x2bdf33[_0x0fe4('0x4c')]:_0x15e8c4[_0x0fe4('0x48')];if(!_0x32afee['query'][_0x0fe4('0x4f')]('nolimit')){_0x2bdf33[_0x0fe4('0x34')]=qs['limit'](_0x32afee[_0x0fe4('0x49')][_0x0fe4('0x34')]);_0x2bdf33[_0x0fe4('0x33')]=qs[_0x0fe4('0x33')](_0x32afee[_0x0fe4('0x49')][_0x0fe4('0x33')]);}_0x2bdf33[_0x0fe4('0x50')]=qs[_0x0fe4('0x51')](_0x32afee[_0x0fe4('0x49')][_0x0fe4('0x51')]);_0x2bdf33[_0x0fe4('0x52')]=qs['filters'](_[_0x0fe4('0x53')](_0x32afee['query'],_0x15e8c4[_0x0fe4('0x4a')]),_0x29903f);if(_0x32afee[_0x0fe4('0x49')][_0x0fe4('0x54')]){_0x2bdf33[_0x0fe4('0x52')]=_[_0x0fe4('0x55')](_0x2bdf33[_0x0fe4('0x52')],{'$or':_[_0x0fe4('0x44')](_0x29903f,function(_0x408cab){if(_0x408cab['type']!=='VIRTUAL'){var _0x4ef837={};_0x4ef837[_0x408cab[_0x0fe4('0x3f')]]={'$like':'%'+_0x32afee[_0x0fe4('0x49')][_0x0fe4('0x54')]+'%'};return _0x4ef837;}})});}_0x2bdf33=_[_0x0fe4('0x55')]({},_0x2bdf33,_0x32afee[_0x0fe4('0x56')]);var _0x4679e2={'where':_0x2bdf33[_0x0fe4('0x52')]};return db[_0x0fe4('0x45')][_0x0fe4('0x57')](_0x4679e2)['then'](function(_0x5bb265){_0x5c19f0[_0x0fe4('0x57')]=_0x5bb265;if(_0x32afee['query'][_0x0fe4('0x58')]){_0x2bdf33[_0x0fe4('0x59')]=[{'all':!![]}];}return db[_0x0fe4('0x45')][_0x0fe4('0x5a')](_0x2bdf33);})[_0x0fe4('0x24')](function(_0x18d8c6){_0x5c19f0[_0x0fe4('0x5b')]=_0x18d8c6;return _0x5c19f0;})[_0x0fe4('0x24')](respondWithFilteredResult(_0x28f45b,_0x2bdf33))['catch'](handleError(_0x28f45b,null));};exports['show']=function(_0x495d59,_0x105d04){var _0x39ccec={'raw':![],'where':{'id':_0x495d59[_0x0fe4('0x5c')]['id']},'include':[{'model':db[_0x0fe4('0x42')],'as':'mandatoryDispositionPause'}]},_0x375259={};_0x375259['model']=_[_0x0fe4('0x5d')](db[_0x0fe4('0x45')][_0x0fe4('0x5e')]);_0x375259[_0x0fe4('0x49')]=_[_0x0fe4('0x5d')](_0x495d59[_0x0fe4('0x49')]);_0x375259[_0x0fe4('0x5f')]=_[_0x0fe4('0x4b')](_0x375259[_0x0fe4('0x48')],_0x375259[_0x0fe4('0x49')]);_0x39ccec['attributes']=_[_0x0fe4('0x4b')](_0x375259[_0x0fe4('0x48')],qs[_0x0fe4('0x4d')](_0x495d59[_0x0fe4('0x49')]['fields']));_0x39ccec[_0x0fe4('0x4c')]=_0x39ccec[_0x0fe4('0x4c')][_0x0fe4('0x4e')]?_0x39ccec[_0x0fe4('0x4c')]:_0x375259[_0x0fe4('0x48')];if(_0x495d59['query'][_0x0fe4('0x58')]){_0x39ccec[_0x0fe4('0x59')]=[{'all':!![]}];}_0x39ccec=_[_0x0fe4('0x55')]({},_0x39ccec,_0x495d59[_0x0fe4('0x56')]);return db[_0x0fe4('0x45')]['find'](_0x39ccec)[_0x0fe4('0x24')](handleEntityNotFound(_0x105d04,null))[_0x0fe4('0x24')](respondWithResult(_0x105d04,null))['catch'](handleError(_0x105d04,null));};exports[_0x0fe4('0x60')]=function(_0x2d6a3a,_0x5f0f9f){return db[_0x0fe4('0x45')][_0x0fe4('0x60')](_0x2d6a3a[_0x0fe4('0x61')],{})['then'](function(_0x1b3f8b){var _0x446f44=_0x2d6a3a[_0x0fe4('0x62')][_0x0fe4('0x3c')]({'plain':!![]});if(!_0x446f44)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x446f44[_0x0fe4('0x63')]===_0x0fe4('0x62')){var _0x3e1eb3=_0x1b3f8b[_0x0fe4('0x3c')]({'plain':!![]});var _0x4a71e6=_0x0fe4('0x3d');return db[_0x0fe4('0x64')][_0x0fe4('0x65')]({'where':{'name':_0x4a71e6,'userProfileId':_0x446f44[_0x0fe4('0x66')]},'raw':!![]})['then'](function(_0x547274){if(_0x547274&&_0x547274[_0x0fe4('0x67')]===0x0){return db[_0x0fe4('0x68')][_0x0fe4('0x60')]({'name':_0x3e1eb3[_0x0fe4('0x3f')],'resourceId':_0x3e1eb3['id'],'type':_0x547274[_0x0fe4('0x3f')],'sectionId':_0x547274['id']},{})[_0x0fe4('0x24')](function(){return _0x1b3f8b;});}else{return _0x1b3f8b;}})['catch'](function(_0x48eeab){logger['error'](_0x0fe4('0x69'),_0x48eeab);throw _0x48eeab;});}return _0x1b3f8b;})[_0x0fe4('0x24')](respondWithResult(_0x5f0f9f,0xc9))['catch'](handleError(_0x5f0f9f,null));};exports[_0x0fe4('0x3a')]=function(_0x2e9895,_0x3148a9){if(_0x2e9895[_0x0fe4('0x61')]['id']){delete _0x2e9895[_0x0fe4('0x61')]['id'];}return db[_0x0fe4('0x45')][_0x0fe4('0x65')]({'where':{'id':_0x2e9895[_0x0fe4('0x5c')]['id']},'include':[{'model':db[_0x0fe4('0x42')],'as':_0x0fe4('0x43')}]})['then'](handleEntityNotFound(_0x3148a9,null))[_0x0fe4('0x24')](saveUpdates(_0x2e9895[_0x0fe4('0x61')],null))[_0x0fe4('0x24')](respondWithResult(_0x3148a9,null))[_0x0fe4('0x2e')](handleError(_0x3148a9,null));};exports['destroy']=function(_0x4645b2,_0x2cbd3e){return db[_0x0fe4('0x45')]['find']({'where':{'id':_0x4645b2['params']['id']}})[_0x0fe4('0x24')](handleEntityNotFound(_0x2cbd3e,null))[_0x0fe4('0x24')](removeEntity(_0x2cbd3e,null))[_0x0fe4('0x2e')](handleError(_0x2cbd3e,null));};exports[_0x0fe4('0x6a')]=function(_0x4d9571,_0x2847c2){return db[_0x0fe4('0x45')][_0x0fe4('0x6a')]()[_0x0fe4('0x24')](respondWithResult(_0x2847c2,null))[_0x0fe4('0x2e')](handleError(_0x2847c2,null));};exports[_0x0fe4('0x6b')]=function(_0x4819ef,_0x300f01,_0x3a2991){if(_0x4819ef['body']['id']){delete _0x4819ef[_0x0fe4('0x61')]['id'];}return db[_0x0fe4('0x45')][_0x0fe4('0x65')]({'where':{'id':_0x4819ef[_0x0fe4('0x5c')]['id']}})[_0x0fe4('0x24')](handleEntityNotFound(_0x300f01,null))[_0x0fe4('0x24')](function(_0x20f22e){if(_0x20f22e){_0x4819ef['body']['WhatsappAccountId']=_0x20f22e['id'];return db[_0x0fe4('0x6c')][_0x0fe4('0x60')](_0x4819ef[_0x0fe4('0x61')]);}})[_0x0fe4('0x24')](respondWithResult(_0x300f01,null))[_0x0fe4('0x2e')](handleError(_0x300f01,null));};exports['getDispositions']=function(_0x147664,_0x17fb15,_0x2006f5){var _0x2dafc5={'raw':![],'where':{}};var _0x58ada0={};var _0x977f38={'count':0x0,'rows':[]};return db[_0x0fe4('0x45')][_0x0fe4('0x6d')]({'where':{'id':_0x147664[_0x0fe4('0x5c')]['id']}})['then'](handleEntityNotFound(_0x17fb15,null))[_0x0fe4('0x24')](function(_0x3ae9f1){if(_0x3ae9f1){_0x58ada0[_0x0fe4('0x48')]=_['keys'](db['Disposition'][_0x0fe4('0x5e')]);_0x58ada0['query']=_['keys'](_0x147664[_0x0fe4('0x49')]);_0x58ada0[_0x0fe4('0x4a')]=_['intersection'](_0x58ada0[_0x0fe4('0x48')],_0x58ada0[_0x0fe4('0x49')]);_0x2dafc5[_0x0fe4('0x4c')]=_[_0x0fe4('0x4b')](_0x58ada0['model'],qs[_0x0fe4('0x4d')](_0x147664['query'][_0x0fe4('0x4d')]));_0x2dafc5['attributes']=_0x2dafc5[_0x0fe4('0x4c')][_0x0fe4('0x4e')]?_0x2dafc5[_0x0fe4('0x4c')]:_0x58ada0[_0x0fe4('0x48')];if(!_0x147664['query'][_0x0fe4('0x4f')]('nolimit')){_0x2dafc5['limit']=qs['limit'](_0x147664['query'][_0x0fe4('0x34')]);_0x2dafc5[_0x0fe4('0x33')]=qs[_0x0fe4('0x33')](_0x147664[_0x0fe4('0x49')]['offset']);}_0x2dafc5[_0x0fe4('0x50')]=qs[_0x0fe4('0x51')](_0x147664['query'][_0x0fe4('0x51')]);_0x2dafc5[_0x0fe4('0x52')]=qs[_0x0fe4('0x4a')](_[_0x0fe4('0x53')](_0x147664['query'],_0x58ada0[_0x0fe4('0x4a')]));_0x2dafc5[_0x0fe4('0x52')][_0x0fe4('0x6e')]=_0x3ae9f1['id'];if(_0x147664[_0x0fe4('0x49')][_0x0fe4('0x54')]){_0x2dafc5[_0x0fe4('0x52')]=_[_0x0fe4('0x55')](_0x2dafc5[_0x0fe4('0x52')],{'$or':_[_0x0fe4('0x44')](_0x2dafc5[_0x0fe4('0x4c')],function(_0x31423b){var _0x57a9bb={};_0x57a9bb[_0x31423b]={'$like':'%'+_0x147664[_0x0fe4('0x49')]['filter']+'%'};return _0x57a9bb;})});}_0x2dafc5=_['merge']({},_0x2dafc5,_0x147664['options']);return db[_0x0fe4('0x6c')][_0x0fe4('0x57')]({'where':_0x2dafc5[_0x0fe4('0x52')]})[_0x0fe4('0x24')](function(_0x3c708f){_0x977f38[_0x0fe4('0x57')]=_0x3c708f;if(_0x147664['query'][_0x0fe4('0x58')]){_0x2dafc5[_0x0fe4('0x59')]=[{'all':!![]}];}return db[_0x0fe4('0x6c')][_0x0fe4('0x5a')](_0x2dafc5);})['then'](function(_0x5cee5a){_0x977f38['rows']=_0x5cee5a;return _0x977f38;});}})['then'](respondWithFilteredResult(_0x17fb15,_0x2dafc5))[_0x0fe4('0x2e')](handleError(_0x17fb15,null));};exports['removeDispositions']=function(_0x50444f,_0x573140,_0x3df772){return db[_0x0fe4('0x45')]['find']({'where':{'id':_0x50444f[_0x0fe4('0x5c')]['id']}})[_0x0fe4('0x24')](handleEntityNotFound(_0x573140,null))[_0x0fe4('0x24')](function(_0x5eaf3b){if(_0x5eaf3b){return _0x5eaf3b['removeDispositions'](_0x50444f[_0x0fe4('0x49')]['ids']);}})[_0x0fe4('0x24')](respondWithStatusCode(_0x573140,null))[_0x0fe4('0x2e')](handleError(_0x573140,null));};exports[_0x0fe4('0x6f')]=function(_0x59664a,_0x3c0932,_0x3ce729){if(_0x59664a[_0x0fe4('0x61')]['id']){delete _0x59664a[_0x0fe4('0x61')]['id'];}return db['WhatsappAccount'][_0x0fe4('0x65')]({'where':{'id':_0x59664a[_0x0fe4('0x5c')]['id']}})[_0x0fe4('0x24')](handleEntityNotFound(_0x3c0932,null))['then'](function(_0x40e18b){if(_0x40e18b){_0x59664a[_0x0fe4('0x61')][_0x0fe4('0x6e')]=_0x40e18b['id'];return db[_0x0fe4('0x70')][_0x0fe4('0x60')](_0x59664a[_0x0fe4('0x61')]);}})['then'](respondWithResult(_0x3c0932,null))[_0x0fe4('0x2e')](handleError(_0x3c0932,null));};exports['getAnswers']=function(_0x5f5146,_0x3855ab,_0x3343d4){var _0x5c8da8={'raw':![],'where':{}};var _0x14951f={};var _0xad114b={'count':0x0,'rows':[]};return db[_0x0fe4('0x45')][_0x0fe4('0x6d')]({'where':{'id':_0x5f5146['params']['id']}})['then'](handleEntityNotFound(_0x3855ab,null))['then'](function(_0x5e8fbe){if(_0x5e8fbe){_0x14951f['model']=_[_0x0fe4('0x5d')](db['CannedAnswer'][_0x0fe4('0x5e')]);_0x14951f[_0x0fe4('0x49')]=_[_0x0fe4('0x5d')](_0x5f5146[_0x0fe4('0x49')]);_0x14951f[_0x0fe4('0x4a')]=_[_0x0fe4('0x4b')](_0x14951f[_0x0fe4('0x48')],_0x14951f[_0x0fe4('0x49')]);_0x5c8da8[_0x0fe4('0x4c')]=_[_0x0fe4('0x4b')](_0x14951f[_0x0fe4('0x48')],qs['fields'](_0x5f5146[_0x0fe4('0x49')][_0x0fe4('0x4d')]));_0x5c8da8[_0x0fe4('0x4c')]=_0x5c8da8[_0x0fe4('0x4c')][_0x0fe4('0x4e')]?_0x5c8da8[_0x0fe4('0x4c')]:_0x14951f[_0x0fe4('0x48')];if(!_0x5f5146['query'][_0x0fe4('0x4f')](_0x0fe4('0x71'))){_0x5c8da8[_0x0fe4('0x34')]=qs['limit'](_0x5f5146[_0x0fe4('0x49')][_0x0fe4('0x34')]);_0x5c8da8['offset']=qs['offset'](_0x5f5146[_0x0fe4('0x49')][_0x0fe4('0x33')]);}_0x5c8da8[_0x0fe4('0x50')]=qs[_0x0fe4('0x51')](_0x5f5146[_0x0fe4('0x49')][_0x0fe4('0x51')]);_0x5c8da8[_0x0fe4('0x52')]=qs[_0x0fe4('0x4a')](_[_0x0fe4('0x53')](_0x5f5146['query'],_0x14951f[_0x0fe4('0x4a')]));_0x5c8da8[_0x0fe4('0x52')][_0x0fe4('0x6e')]=_0x5e8fbe['id'];if(_0x5f5146[_0x0fe4('0x49')][_0x0fe4('0x54')]){_0x5c8da8[_0x0fe4('0x52')]=_[_0x0fe4('0x55')](_0x5c8da8[_0x0fe4('0x52')],{'$or':_[_0x0fe4('0x44')](_0x5c8da8[_0x0fe4('0x4c')],function(_0x4a8ab9){var _0x24c0e7={};_0x24c0e7[_0x4a8ab9]={'$like':'%'+_0x5f5146[_0x0fe4('0x49')][_0x0fe4('0x54')]+'%'};return _0x24c0e7;})});}_0x5c8da8=_[_0x0fe4('0x55')]({},_0x5c8da8,_0x5f5146[_0x0fe4('0x56')]);return db[_0x0fe4('0x70')][_0x0fe4('0x57')]({'where':_0x5c8da8[_0x0fe4('0x52')]})[_0x0fe4('0x24')](function(_0x5bea14){_0xad114b[_0x0fe4('0x57')]=_0x5bea14;if(_0x5f5146[_0x0fe4('0x49')]['includeAll']){_0x5c8da8[_0x0fe4('0x59')]=[{'all':!![]}];}return db[_0x0fe4('0x70')][_0x0fe4('0x5a')](_0x5c8da8);})[_0x0fe4('0x24')](function(_0x5b74ef){_0xad114b['rows']=_0x5b74ef;return _0xad114b;});}})['then'](respondWithFilteredResult(_0x3855ab,_0x5c8da8))['catch'](handleError(_0x3855ab,null));};exports[_0x0fe4('0x72')]=function(_0xd78511,_0x3acd72,_0xf4f2a9){return db['WhatsappAccount'][_0x0fe4('0x65')]({'where':{'id':_0xd78511['params']['id']}})['then'](handleEntityNotFound(_0x3acd72,null))[_0x0fe4('0x24')](function(_0x1a29de){if(_0x1a29de){return _0x1a29de[_0x0fe4('0x72')](_0xd78511[_0x0fe4('0x49')][_0x0fe4('0x73')]);}})[_0x0fe4('0x24')](respondWithStatusCode(_0x3acd72,null))['catch'](handleError(_0x3acd72,null));};exports[_0x0fe4('0x74')]=function(_0x1ef862,_0x5461b2,_0x30d947){return db[_0x0fe4('0x45')][_0x0fe4('0x65')]({'where':{'id':_0x1ef862['params']['id']}})['then'](handleEntityNotFound(_0x5461b2,null))[_0x0fe4('0x24')](function(_0x51179a){if(_0x51179a){return _0x51179a[_0x0fe4('0x74')](_0x1ef862[_0x0fe4('0x61')][_0x0fe4('0x73')],_[_0x0fe4('0x75')](_0x1ef862[_0x0fe4('0x61')],[_0x0fe4('0x73'),'id'])||{})[_0x0fe4('0x76')](function(_0x4c974b){for(var _0x2b617b=0x0;_0x2b617b<_0x1ef862[_0x0fe4('0x61')][_0x0fe4('0x73')][_0x0fe4('0x4e')];_0x2b617b+=0x1){socket[_0x0fe4('0x77')]('userWhatsappAccount:save',{'UserId':_0x1ef862[_0x0fe4('0x61')][_0x0fe4('0x73')][_0x2b617b],'WhatsappAccountId':_0x1ef862[_0x0fe4('0x5c')]['id']});}return _0x4c974b;});}})[_0x0fe4('0x24')](respondWithResult(_0x5461b2,null))[_0x0fe4('0x2e')](handleError(_0x5461b2,null));};exports[_0x0fe4('0x78')]=function(_0xb1a782,_0x3a92fc,_0x30942a){return db[_0x0fe4('0x45')][_0x0fe4('0x65')]({'where':{'id':_0xb1a782[_0x0fe4('0x5c')]['id']}})[_0x0fe4('0x24')](handleEntityNotFound(_0x3a92fc,null))['then'](function(_0x5c3982){if(_0x5c3982){return _0x5c3982['removeAgents'](_0xb1a782[_0x0fe4('0x49')][_0x0fe4('0x73')])[_0x0fe4('0x24')](function(){if(_[_0x0fe4('0x79')](_0xb1a782[_0x0fe4('0x49')][_0x0fe4('0x73')])){for(var _0x41ea82=0x0;_0x41ea82<_0xb1a782['query'][_0x0fe4('0x73')][_0x0fe4('0x4e')];_0x41ea82+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0xb1a782[_0x0fe4('0x49')]['ids'][_0x41ea82]),'WhatsappAccountId':Number(_0xb1a782['params']['id'])});}}else{socket[_0x0fe4('0x77')]('userWhatsappAccount:remove',{'UserId':Number(_0xb1a782[_0x0fe4('0x49')][_0x0fe4('0x73')]),'WhatsappAccountId':Number(_0xb1a782[_0x0fe4('0x5c')]['id'])});}});}})[_0x0fe4('0x24')](respondWithStatusCode(_0x3a92fc,null))[_0x0fe4('0x2e')](handleError(_0x3a92fc,null));};exports[_0x0fe4('0x7a')]=function(_0x4580f0,_0x453e4c,_0x4bed1f){var _0x298ac0={};var _0x4270e7={};var _0x4af87f;var _0x48ac1a;return db[_0x0fe4('0x45')][_0x0fe4('0x6d')]({'where':{'id':_0x4580f0[_0x0fe4('0x5c')]['id']}})['then'](handleEntityNotFound(_0x453e4c,null))[_0x0fe4('0x24')](function(_0x56c2ed){if(_0x56c2ed){_0x4af87f=_0x56c2ed;_0x4270e7['model']=_['keys'](db[_0x0fe4('0x7b')][_0x0fe4('0x5e')]);_0x4270e7[_0x0fe4('0x49')]=_[_0x0fe4('0x5d')](_0x4580f0[_0x0fe4('0x49')]);_0x4270e7[_0x0fe4('0x4a')]=_[_0x0fe4('0x4b')](_0x4270e7[_0x0fe4('0x48')],_0x4270e7[_0x0fe4('0x49')]);_0x298ac0[_0x0fe4('0x4c')]=_[_0x0fe4('0x4b')](_0x4270e7[_0x0fe4('0x48')],qs[_0x0fe4('0x4d')](_0x4580f0['query'][_0x0fe4('0x4d')]));_0x298ac0[_0x0fe4('0x4c')]=_0x298ac0[_0x0fe4('0x4c')][_0x0fe4('0x4e')]?_0x298ac0[_0x0fe4('0x4c')]:_0x4270e7['model'];_0x298ac0[_0x0fe4('0x50')]=qs[_0x0fe4('0x51')](_0x4580f0[_0x0fe4('0x49')][_0x0fe4('0x51')]);_0x298ac0[_0x0fe4('0x52')]=qs[_0x0fe4('0x4a')](_[_0x0fe4('0x53')](_0x4580f0['query'],_0x4270e7[_0x0fe4('0x4a')]));if(_0x4580f0['query'][_0x0fe4('0x54')]){_0x298ac0[_0x0fe4('0x52')]=_[_0x0fe4('0x55')](_0x298ac0[_0x0fe4('0x52')],{'$or':_[_0x0fe4('0x44')](_0x298ac0[_0x0fe4('0x4c')],function(_0x1d08d0){var _0x4ad27a={};_0x4ad27a[_0x1d08d0]={'$like':'%'+_0x4580f0['query'][_0x0fe4('0x54')]+'%'};return _0x4ad27a;})});}_0x298ac0=_[_0x0fe4('0x55')]({},_0x298ac0,_0x4580f0[_0x0fe4('0x56')]);return _0x4af87f[_0x0fe4('0x7a')](_0x298ac0);}})[_0x0fe4('0x24')](function(_0x17115b){if(_0x17115b){_0x48ac1a=_0x17115b[_0x0fe4('0x4e')];if(!_0x4580f0[_0x0fe4('0x49')][_0x0fe4('0x4f')](_0x0fe4('0x71'))){_0x298ac0[_0x0fe4('0x34')]=qs['limit'](_0x4580f0[_0x0fe4('0x49')][_0x0fe4('0x34')]);_0x298ac0['offset']=qs[_0x0fe4('0x33')](_0x4580f0[_0x0fe4('0x49')]['offset']);}return _0x4af87f[_0x0fe4('0x7a')](_0x298ac0);}})[_0x0fe4('0x24')](function(_0x52a8f2){if(_0x52a8f2){return _0x52a8f2?{'count':_0x48ac1a,'rows':_0x52a8f2}:null;}})[_0x0fe4('0x24')](respondWithResult(_0x453e4c,null))['catch'](handleError(_0x453e4c,null));};exports['addApplications']=function(_0x554228,_0x103e05,_0x3eaf5d){return db[_0x0fe4('0x45')][_0x0fe4('0x6d')]({'where':{'id':_0x554228[_0x0fe4('0x5c')]['id']}})['then'](handleEntityNotFound(_0x103e05,null))[_0x0fe4('0x24')](function(_0x1c6788){if(_0x1c6788){return db['sequelize'][_0x0fe4('0x7c')](function(_0x1aa2ed){return db[_0x0fe4('0x7d')]['destroy']({'where':{'WhatsappAccountId':_0x554228[_0x0fe4('0x5c')]['id']},'transaction':_0x1aa2ed})[_0x0fe4('0x24')](function(_0x19ba5c){var _0x305592=_['map'](_0x554228['body'],function(_0x1b1e08){_0x1b1e08['WhatsappAccountId']=_0x554228[_0x0fe4('0x5c')]['id'];return _0x1b1e08;});return db[_0x0fe4('0x7d')][_0x0fe4('0x7e')](_0x305592,{'transaction':_0x1aa2ed});});})[_0x0fe4('0x24')](function(){return db[_0x0fe4('0x7d')][_0x0fe4('0x7f')]({'where':{'WhatsappAccountId':_0x554228[_0x0fe4('0x5c')]['id']},'order':_0x0fe4('0x80')});});}})['then'](respondWithResult(_0x103e05,null))['catch'](handleError(_0x103e05,null));};exports['getApplications']=function(_0x173bfc,_0x506d38,_0x349fcc){var _0x5e674c={};var _0x1665b2={};var _0xc82d7f;var _0x3f017d;return db['WhatsappAccount'][_0x0fe4('0x6d')]({'where':{'id':_0x173bfc[_0x0fe4('0x5c')]['id']}})[_0x0fe4('0x24')](handleEntityNotFound(_0x506d38,null))['then'](function(_0x39d336){if(_0x39d336){_0xc82d7f=_0x39d336;_0x1665b2[_0x0fe4('0x48')]=_[_0x0fe4('0x5d')](db[_0x0fe4('0x7d')]['rawAttributes']);_0x1665b2[_0x0fe4('0x49')]=_[_0x0fe4('0x5d')](_0x173bfc[_0x0fe4('0x49')]);_0x1665b2[_0x0fe4('0x4a')]=_[_0x0fe4('0x4b')](_0x1665b2['model'],_0x1665b2['query']);_0x5e674c[_0x0fe4('0x4c')]=_[_0x0fe4('0x4b')](_0x1665b2['model'],qs[_0x0fe4('0x4d')](_0x173bfc[_0x0fe4('0x49')][_0x0fe4('0x4d')]));_0x5e674c['attributes']=_0x5e674c['attributes'][_0x0fe4('0x4e')]?_0x5e674c[_0x0fe4('0x4c')]:_0x1665b2[_0x0fe4('0x48')];_0x5e674c[_0x0fe4('0x50')]=qs['sort'](_0x173bfc[_0x0fe4('0x49')][_0x0fe4('0x51')]);_0x5e674c[_0x0fe4('0x52')]=qs['filters'](_['pick'](_0x173bfc[_0x0fe4('0x49')],_0x1665b2[_0x0fe4('0x4a')]));if(_0x173bfc['query'][_0x0fe4('0x54')]){_0x5e674c[_0x0fe4('0x52')]=_['merge'](_0x5e674c[_0x0fe4('0x52')],{'$or':_[_0x0fe4('0x44')](_0x5e674c['attributes'],function(_0x3b2efd){var _0x188185={};_0x188185[_0x3b2efd]={'$like':'%'+_0x173bfc[_0x0fe4('0x49')][_0x0fe4('0x54')]+'%'};return _0x188185;})});}_0x5e674c=_[_0x0fe4('0x55')]({},_0x5e674c,_0x173bfc['options']);return _0xc82d7f[_0x0fe4('0x81')](_0x5e674c);}})[_0x0fe4('0x24')](function(_0x421c0e){if(_0x421c0e){_0x3f017d=_0x421c0e[_0x0fe4('0x4e')];if(!_0x173bfc[_0x0fe4('0x49')][_0x0fe4('0x4f')](_0x0fe4('0x71'))){_0x5e674c[_0x0fe4('0x34')]=qs[_0x0fe4('0x34')](_0x173bfc[_0x0fe4('0x49')][_0x0fe4('0x34')]);_0x5e674c[_0x0fe4('0x33')]=qs[_0x0fe4('0x33')](_0x173bfc[_0x0fe4('0x49')][_0x0fe4('0x33')]);}return _0xc82d7f[_0x0fe4('0x81')](_0x5e674c);}})[_0x0fe4('0x24')](function(_0x3988cd){if(_0x3988cd){return _0x3988cd?{'count':_0x3f017d,'rows':_0x3988cd}:null;}})[_0x0fe4('0x24')](respondWithResult(_0x506d38,null))[_0x0fe4('0x2e')](handleError(_0x506d38,null));};exports[_0x0fe4('0x82')]=function(_0x3ad245,_0x2699bc,_0x59a3ce){var _0xd44d1f={'channel':'whatsapp'};var _0x5caabc=[];var _0x5e53c0=[];var _0x4cb87c={};return db[_0x0fe4('0x45')][_0x0fe4('0x65')]({'where':{'id':_0x3ad245[_0x0fe4('0x5c')]['id']},'include':[{'model':db[_0x0fe4('0x7d')],'as':_0x0fe4('0x83')}]})['then'](handleEntityNotFound(_0x2699bc,null))[_0x0fe4('0x24')](function(_0x350ebe){_0xd44d1f[_0x0fe4('0x84')]=_0x350ebe;_0xd44d1f[_0x0fe4('0x85')]=_[_0x0fe4('0x86')](_0x350ebe['Applications'],[_0x0fe4('0x80')],[_0x0fe4('0x87')]);if(_0xd44d1f['account'][_0x0fe4('0x83')]){delete _0xd44d1f[_0x0fe4('0x84')][_0x0fe4('0x83')];}return db[_0x0fe4('0x88')][_0x0fe4('0x6a')]();})[_0x0fe4('0x24')](function(_0x11c068){if(!_0x11c068){throw new db['Sequelize'][(_0x0fe4('0x89'))](_0x0fe4('0x8a'));}_0x5caabc=_['difference'](_['keys'](_0x11c068),[_0x0fe4('0x8b'),'updatedAt']);_0x5e53c0=_[_0x0fe4('0x8c')](_[_0x0fe4('0x5d')](_0x11c068),[_0x0fe4('0x8b'),_0x0fe4('0x8d'),_0x0fe4('0x8e'),_0x0fe4('0x8f')]);_0xd44d1f[_0x0fe4('0x61')]={'mapKey':_0x0fe4('0x90')};if(_0xd44d1f[_0x0fe4('0x84')][_0x0fe4('0x46')]&&_0xd44d1f[_0x0fe4('0x84')][_0x0fe4('0x46')]==='twilio'){_0xd44d1f[_0x0fe4('0x61')][_0x0fe4('0x91')]=_0x3ad245[_0x0fe4('0x61')]['From']['replace'](_0x0fe4('0x92'),'');_0xd44d1f[_0x0fe4('0x61')][_0x0fe4('0x61')]=_0x3ad245[_0x0fe4('0x61')][_0x0fe4('0x93')];_0xd44d1f[_0x0fe4('0x61')][_0x0fe4('0x94')]=_0x3ad245['body'][_0x0fe4('0x95')];}if(_0xd44d1f[_0x0fe4('0x61')]['id']){delete _0xd44d1f['body']['id'];}if(_[_0x0fe4('0x96')](_0xd44d1f[_0x0fe4('0x61')][_0x0fe4('0x91')])){throw new db[(_0x0fe4('0x97'))][(_0x0fe4('0x89'))](_0x0fe4('0x98'));}if(_[_0x0fe4('0x96')](_0xd44d1f['body'][_0x0fe4('0x61')])||_0xd44d1f['body'][_0x0fe4('0x61')]===''){throw new db[(_0x0fe4('0x97'))][(_0x0fe4('0x89'))](_0x0fe4('0x99'));}if(_[_0x0fe4('0x96')](_0xd44d1f[_0x0fe4('0x61')][_0x0fe4('0x9a')])){throw new db[(_0x0fe4('0x97'))][(_0x0fe4('0x89'))](_0x0fe4('0x9b')+_0x5e53c0);}if(!_[_0x0fe4('0x9c')](_0x5e53c0,_0xd44d1f[_0x0fe4('0x61')][_0x0fe4('0x9a')])){throw new db[(_0x0fe4('0x97'))][(_0x0fe4('0x89'))](_0x0fe4('0x9d')+_0x5e53c0);}_0x4cb87c[_0xd44d1f[_0x0fe4('0x61')]['mapKey']]=_0xd44d1f[_0x0fe4('0x61')]['from'];return db['CmList'][_0x0fe4('0x65')]({'where':{'id':_0xd44d1f[_0x0fe4('0x84')][_0x0fe4('0x8f')]},'include':[{'model':db[_0x0fe4('0x88')],'as':'Contacts','where':_0x4cb87c,'limit':0x1,'order':[[_0x0fe4('0x8d'),'DESC']]}]});})[_0x0fe4('0x24')](handleEntityNotFound(_0x2699bc,null))[_0x0fe4('0x24')](function(_0x4d44d4){if(_0x4d44d4){_0xd44d1f[_0x0fe4('0x9e')]=_['omit'](_0x4d44d4,[_0x0fe4('0x9f')]);if(_0x4d44d4[_0x0fe4('0x9f')]['length']){return _0x4d44d4['Contacts'][0x0];}var _0x4a8532=_[_0x0fe4('0xa0')](_0xd44d1f['body'],{'firstName':_0xd44d1f[_0x0fe4('0x61')][_0x0fe4('0x91')],'ListId':_0x4d44d4['id']});_0x4a8532[_0xd44d1f[_0x0fe4('0x61')]['mapKey']]=_0xd44d1f[_0x0fe4('0x61')]['from'];return db[_0x0fe4('0x88')]['create'](_0x4a8532,{'fields':_0x5caabc,'raw':!![]});}})['then'](handleEntityNotFound(_0x2699bc,null))['then'](function(_0x2bfee0){if(_0x2bfee0){_0xd44d1f[_0x0fe4('0xa1')]=_0x2bfee0;var _0x365775={'ContactId':_0x2bfee0['id'],'phone':_0xd44d1f[_0x0fe4('0x61')][_0x0fe4('0x91')],'WhatsappAccountId':_0x3ad245[_0x0fe4('0x5c')]['id']};var _0x2b4d5e={'ContactId':_0x2bfee0['id'],'WhatsappAccountId':_0x3ad245[_0x0fe4('0x5c')]['id'],'closed':![]};return db[_0x0fe4('0xa2')][_0x0fe4('0x65')]({'where':_0x2b4d5e})[_0x0fe4('0x24')](function(_0x497b5a){if(_0x497b5a){return[_0x497b5a,![]];}return db[_0x0fe4('0xa2')][_0x0fe4('0x60')](_0x365775)[_0x0fe4('0x24')](function(_0x341e37){return[_0x341e37,!![]];});});}})['spread'](function(_0x2e47fa,_0x442091){_0xd44d1f[_0x0fe4('0xa3')]=_0x2e47fa[_0x0fe4('0x3c')]({'plain':!![]});_0xd44d1f[_0x0fe4('0xa3')][_0x0fe4('0xa4')]=![];if(_0x442091){if(_0xd44d1f['account'][_0x0fe4('0xa5')]){_0xd44d1f[_0x0fe4('0x85')]['push']({'id':0x0,'priority':_0xd44d1f[_0x0fe4('0x85')][_0x0fe4('0x4e')]+0x1,'app':_0x0fe4('0xa6'),'appdata':_0x0fe4('0xa7'),'interval':'*,*,*,*'});}_0xd44d1f[_0x0fe4('0xa3')]['created']=!![];}return db['WhatsappMessage'][_0x0fe4('0x60')]({'phone':_0xd44d1f[_0x0fe4('0x61')][_0x0fe4('0x91')],'messageId':_0xd44d1f[_0x0fe4('0x61')][_0x0fe4('0x94')],'body':_0xd44d1f['body'][_0x0fe4('0x61')],'WhatsappAccountId':_0x3ad245[_0x0fe4('0x5c')]['id'],'WhatsappInteractionId':_0x2e47fa['id'],'direction':'in','ContactId':_0x2e47fa[_0x0fe4('0xa8')],'AttachmentId':_0xd44d1f[_0x0fe4('0x61')]['AttachmentId']});})[_0x0fe4('0x24')](function(_0x19c0fd){_0xd44d1f[_0x0fe4('0x2c')]=_0x19c0fd;if(_0xd44d1f[_0x0fe4('0xa3')][_0x0fe4('0xa9')]){return db[_0x0fe4('0x7b')][_0x0fe4('0x65')]({'attributes':['id',_0x0fe4('0x3f')],'where':{'id':_0xd44d1f['interaction'][_0x0fe4('0xa9')]}})['then'](function(_0x4f894c){if(_0x4f894c){_0xd44d1f[_0x0fe4('0x85')][_0x0fe4('0xaa')]({'id':0x0,'priority':0x0,'app':_0x0fe4('0xab'),'appdata':_0x4f894c[_0x0fe4('0x3f')]+','+(_0xd44d1f[_0x0fe4('0x84')]['waitForTheAssignedAgent']||0xa),'interval':_0x0fe4('0xac')});}return respondWithRpcPromise(_0x0fe4('0xad'),_0x0fe4('0xae'),_0xd44d1f);});}return respondWithRpcPromise(_0x0fe4('0xad'),'startRouting',_0xd44d1f);})[_0x0fe4('0x24')](function(_0x4b9d69){if(_0x4b9d69){var _0x3bbfe2=0xc8;var _0x217920=_0x0fe4('0xaf');logger[_0x0fe4('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x217920,_0x3bbfe2,_0x0fe4('0xb0'));logger[_0x0fe4('0x26')](_0x0fe4('0xb1'),_0x217920,_0x3bbfe2,_0x0fe4('0xb0'),JSON[_0x0fe4('0x28')](_0x4b9d69));if(_0xd44d1f[_0x0fe4('0x84')]['type']===_0x0fe4('0xb2')){return _0x2699bc[_0x0fe4('0x30')](_0x3bbfe2)[_0x0fe4('0x35')](_0x0fe4('0xb3'),_0x0fe4('0xb4'))[_0x0fe4('0x40')](_0x0fe4('0xb5'));}else{return _0x2699bc[_0x0fe4('0x30')](_0x3bbfe2)['json'](_0x4b9d69);}}})['catch'](handleError(_0x2699bc,null));};exports['send']=function(_0x3e63e3,_0x3f8d13,_0x4823a4){var _0x811725,_0x3086ab,_0xf6b010;if(_[_0x0fe4('0x96')](_0x3e63e3[_0x0fe4('0x61')][_0x0fe4('0x61')])||_0x3e63e3[_0x0fe4('0x61')][_0x0fe4('0x61')]===''){throw new db[(_0x0fe4('0x97'))][(_0x0fe4('0x89'))](_0x0fe4('0x99'));}if(_[_0x0fe4('0x96')](_0x3e63e3[_0x0fe4('0x61')]['to'])){throw new db[(_0x0fe4('0x97'))]['ValidationError'](_0x0fe4('0xb6'));}_0x811725=_0x3e63e3[_0x0fe4('0x61')]['to'];return db[_0x0fe4('0x45')]['find']({'where':{'id':_0x3e63e3['params']['id']},'include':[{'model':db['CmList'],'as':_0x0fe4('0xb7'),'include':[{'model':db[_0x0fe4('0x88')],'as':_0x0fe4('0x9f'),'where':{'mobile':_0x811725},'limit':0x1,'order':[[_0x0fe4('0x8d'),_0x0fe4('0xb8')]]}]}]})[_0x0fe4('0x24')](handleEntityNotFound(_0x3f8d13,null))[_0x0fe4('0x24')](function(_0x71fcf){if(_0x71fcf&&_0x71fcf[_0x0fe4('0xb7')]){_0x3086ab=_0x71fcf[_0x0fe4('0x3c')]({'plain':!![]});if(_0x3086ab['List']&&_0x3086ab[_0x0fe4('0xb7')][_0x0fe4('0x9f')][_0x0fe4('0x4e')]){return _0x3086ab['List'][_0x0fe4('0x9f')][0x0];}return db[_0x0fe4('0x88')]['create'](_['defaults'](_0x3e63e3['body'],{'firstName':_0x811725,'mobile':_0x811725,'phone':_0x811725,'ListId':_0x3086ab[_0x0fe4('0x8f')]}));}})['then'](handleEntityNotFound(_0x3f8d13,null))[_0x0fe4('0x24')](function(_0x585731){if(_0x585731){_0xf6b010=_0x585731;return db[_0x0fe4('0xa2')][_0x0fe4('0x65')]({'where':{'ContactId':_0xf6b010['id'],'closed':![],'WhatsappAccountId':_0x3086ab['id']}})[_0x0fe4('0x24')](function(_0x3dd678){if(_0x3dd678){return[_0x3dd678,![]];}return db[_0x0fe4('0xa2')][_0x0fe4('0x60')]({'UserId':_0x3e63e3['user']['id'],'ContactId':_0xf6b010['id'],'WhatsappAccountId':_0x3086ab['id'],'phone':_0x811725,'firstMsgDirection':'out','Messages':[_['merge'](_0x3e63e3[_0x0fe4('0x61')],{'read':![],'body':_0x3e63e3[_0x0fe4('0x61')]['body'],'phone':_0x811725,'WhatsappAccountId':_0x3086ab['id'],'UserId':_0x3e63e3[_0x0fe4('0x62')]['id'],'ContactId':_0xf6b010['id']})]},{'include':[{'model':db[_0x0fe4('0xb9')],'as':'Messages'}]})[_0x0fe4('0x24')](function(_0x26f739){return[_0x26f739,!![]];});});}})['spread'](function(_0x3b2695,_0x4cd5eb){if(_0x4cd5eb){return _0x3b2695;}return db[_0x0fe4('0xb9')]['create'](_[_0x0fe4('0x55')](_0x3e63e3[_0x0fe4('0x61')],{'read':![],'body':_0x3e63e3['body'][_0x0fe4('0x61')],'phone':_0x811725,'WhatsappAccountId':_0x3086ab['id'],'WhatsappInteractionId':_0x3b2695['id'],'UserId':_0x3e63e3[_0x0fe4('0x62')]['id'],'ContactId':_0xf6b010['id']}))[_0x0fe4('0x24')](function(_0x41f60f){_0x3b2695['dataValues']['Messages']=[];_0x3b2695[_0x0fe4('0xba')]['Messages'][_0x0fe4('0xbb')](_0x41f60f[_0x0fe4('0xba')]);return _0x3b2695;});})[_0x0fe4('0x24')](respondWithResult(_0x3f8d13,null))[_0x0fe4('0x2e')](handleError(_0x3f8d13,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 169ebae..a569df1 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 _0xf0f4=['hasOwnProperty','exports','../../mysqldb','save','update','emit'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xf0f4,0x182));var _0x4f0f=function(_0x27a4ce,_0x32d55c){_0x27a4ce=_0x27a4ce-0x0;var _0x93a063=_0xf0f4[_0x27a4ce];return _0x93a063;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x4f0f('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4f0f('0x1'),'afterUpdate':_0x4f0f('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2cefe){return function(_0x420159,_0x1f6cdb,_0x130ab2){WhatsappAccountEvents[_0x4f0f('0x3')](_0x2cefe+':'+_0x420159['id'],_0x420159);WhatsappAccountEvents[_0x4f0f('0x3')](_0x2cefe,_0x420159);_0x130ab2(null);};}for(var e in events){if(events[_0x4f0f('0x4')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x4f0f('0x5')]=WhatsappAccountEvents; \ No newline at end of file +var _0xd9fb=['emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove'];(function(_0x3b2be5,_0x9c01ae){var _0x14cd8=function(_0x5262be){while(--_0x5262be){_0x3b2be5['push'](_0x3b2be5['shift']());}};_0x14cd8(++_0x9c01ae);}(_0xd9fb,0x189));var _0xbd9f=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xd9fb[_0x2cfb58];return _0xd99951;};'use strict';var EventEmitter=require(_0xbd9f('0x0'));var WhatsappAccount=require(_0xbd9f('0x1'))['db'][_0xbd9f('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xbd9f('0x3')](0x0);var events={'afterCreate':_0xbd9f('0x4'),'afterUpdate':_0xbd9f('0x5'),'afterDestroy':_0xbd9f('0x6')};function emitEvent(_0x56fe1b){return function(_0x2d4213,_0xf146bc,_0x4ce2e2){WhatsappAccountEvents[_0xbd9f('0x7')](_0x56fe1b+':'+_0x2d4213['id'],_0x2d4213);WhatsappAccountEvents['emit'](_0x56fe1b,_0x2d4213);_0x4ce2e2(null);};}for(var e in events){if(events[_0xbd9f('0x8')](e)){var event=events[e];WhatsappAccount[_0xbd9f('0x9')](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 9a1862f..cfdf681 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 _0x4dda=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','util','../../config/logger','api','moment'];(function(_0xe7fb45,_0x3d0181){var _0x11928a=function(_0x1da2b2){while(--_0x1da2b2){_0xe7fb45['push'](_0xe7fb45['shift']());}};_0x11928a(++_0x3d0181);}(_0x4dda,0x7e));var _0xa4dd=function(_0xff5df6,_0x514e73){_0xff5df6=_0xff5df6-0x0;var _0x2634bb=_0x4dda[_0xff5df6];return _0x2634bb;};'use strict';var _=require('lodash');var util=require(_0xa4dd('0x0'));var logger=require(_0xa4dd('0x1'))(_0xa4dd('0x2'));var moment=require(_0xa4dd('0x3'));var BPromise=require(_0xa4dd('0x4'));var rp=require(_0xa4dd('0x5'));var fs=require('fs');var path=require(_0xa4dd('0x6'));var rimraf=require(_0xa4dd('0x7'));var config=require(_0xa4dd('0x8'));var attributes=require(_0xa4dd('0x9'));module['exports']=function(_0x587563,_0x5a5b20){return _0x587563['define']('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08f3=['exports','define','WhatsappAccount','whatsapp_accounts','util','../../config/logger','api','bluebird','path','rimraf','./whatsappAccount.attributes'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0x08f3,0x1d2));var _0x308f=function(_0x5d64d5,_0x1c7228){_0x5d64d5=_0x5d64d5-0x0;var _0x2d3630=_0x08f3[_0x5d64d5];return _0x2d3630;};'use strict';var _=require('lodash');var util=require(_0x308f('0x0'));var logger=require(_0x308f('0x1'))(_0x308f('0x2'));var moment=require('moment');var BPromise=require(_0x308f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x308f('0x4'));var rimraf=require(_0x308f('0x5'));var config=require('../../config/environment');var attributes=require(_0x308f('0x6'));module[_0x308f('0x7')]=function(_0x55630e,_0x5cb4fc){return _0x55630e[_0x308f('0x8')](_0x308f('0x9'),attributes,{'tableName':_0x308f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 539a4f5..69a9403 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 _0x6d2d=['include','model','attributes','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','map'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x6d2d,0xbc));var _0xd6d2=function(_0x27de41,_0x3cecf5){_0x27de41=_0x27de41-0x0;var _0xe2a580=_0x6d2d[_0x27de41];return _0xe2a580;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd6d2('0x0'));var BPromise=require(_0xd6d2('0x1'));var rs=require(_0xd6d2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6d2('0x3'))['db'];var utils=require(_0xd6d2('0x4'));var logger=require(_0xd6d2('0x5'))(_0xd6d2('0x6'));var config=require(_0xd6d2('0x7'));var jayson=require(_0xd6d2('0x8'));var client=jayson[_0xd6d2('0x9')][_0xd6d2('0xa')]({'port':0x232a});config['redis']=_[_0xd6d2('0xb')](config[_0xd6d2('0xc')],{'host':_0xd6d2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd6d2('0xc')]));require(_0xd6d2('0xe'))[_0xd6d2('0xf')](socket);function respondWithRpcPromise(_0x263e8b,_0x2eb446,_0x3ac061){return new BPromise(function(_0x1a35d2,_0x3fa7ad){return client['request'](_0x263e8b,_0x3ac061)[_0xd6d2('0x10')](function(_0x35f0f7){logger[_0xd6d2('0x11')](_0xd6d2('0x12'),_0x2eb446,_0xd6d2('0x13'));logger[_0xd6d2('0x14')](_0xd6d2('0x15'),_0x2eb446,'request\x20sent',JSON[_0xd6d2('0x16')](_0x35f0f7));if(_0x35f0f7[_0xd6d2('0x17')]){if(_0x35f0f7[_0xd6d2('0x17')][_0xd6d2('0x18')]===0x1f4){logger[_0xd6d2('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x2eb446,_0x35f0f7[_0xd6d2('0x17')][_0xd6d2('0x19')]);return _0x3fa7ad(_0x35f0f7['error']['message']);}logger[_0xd6d2('0x17')](_0xd6d2('0x12'),_0x2eb446,_0x35f0f7['error'][_0xd6d2('0x19')]);return _0x1a35d2(_0x35f0f7[_0xd6d2('0x17')]['message']);}else{logger[_0xd6d2('0x11')](_0xd6d2('0x12'),_0x2eb446,_0xd6d2('0x13'));_0x1a35d2(_0x35f0f7[_0xd6d2('0x1a')][_0xd6d2('0x19')]);}})[_0xd6d2('0x1b')](function(_0x13e59b){logger[_0xd6d2('0x17')](_0xd6d2('0x12'),_0x2eb446,_0x13e59b);_0x3fa7ad(_0x13e59b);});});}exports[_0xd6d2('0x1c')]=function(_0x421688){var _0x194553=this;return new Promise(function(_0x22a5a5,_0xfc32c9){return db[_0xd6d2('0x1d')][_0xd6d2('0x1e')]({'raw':_0x421688[_0xd6d2('0x1f')]?_0x421688[_0xd6d2('0x1f')][_0xd6d2('0x20')]===undefined?!![]:![]:!![],'where':_0x421688['options']?_0x421688[_0xd6d2('0x1f')]['where']||null:null,'attributes':_0x421688[_0xd6d2('0x1f')]?_0x421688['options']['attributes']||null:null,'include':_0x421688[_0xd6d2('0x1f')]?_0x421688['options']['include']?_[_0xd6d2('0x21')](_0x421688['options'][_0xd6d2('0x22')],function(_0xbad304){return{'model':db[_0xbad304[_0xd6d2('0x23')]],'as':_0xbad304['as'],'attributes':_0xbad304['attributes'],'include':_0xbad304[_0xd6d2('0x22')]?_[_0xd6d2('0x21')](_0xbad304[_0xd6d2('0x22')],function(_0x3d8c76){return{'model':db[_0x3d8c76['model']],'as':_0x3d8c76['as'],'attributes':_0x3d8c76[_0xd6d2('0x24')],'include':_0x3d8c76['include']?_[_0xd6d2('0x21')](_0x3d8c76[_0xd6d2('0x22')],function(_0x84f724){return{'model':db[_0x84f724['model']],'as':_0x84f724['as'],'attributes':_0x84f724[_0xd6d2('0x24')]};}):[]};}):[]};}):[]:[]})[_0xd6d2('0x10')](function(_0x5ce3ef){logger[_0xd6d2('0x11')](_0xd6d2('0x1c'),_0x421688);logger[_0xd6d2('0x14')](_0xd6d2('0x1c'),_0x421688,JSON[_0xd6d2('0x16')](_0x5ce3ef));_0x22a5a5(_0x5ce3ef);})[_0xd6d2('0x1b')](function(_0x113f42){logger[_0xd6d2('0x17')](_0xd6d2('0x1c'),_0x113f42[_0xd6d2('0x19')],_0x421688);_0xfc32c9(_0x194553[_0xd6d2('0x17')](0x1f4,_0x113f42['message']));});});}; \ No newline at end of file +var _0xea85=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowWhatsappAccount','find','options','raw','where','attributes','map','model','include','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x38d901,_0x1376df){var _0x3e73d2=function(_0x2387b5){while(--_0x2387b5){_0x38d901['push'](_0x38d901['shift']());}};_0x3e73d2(++_0x1376df);}(_0xea85,0x1cd));var _0x5ea8=function(_0xedd180,_0xbea543){_0xedd180=_0xedd180-0x0;var _0x374726=_0xea85[_0xedd180];return _0x374726;};'use strict';var _=require(_0x5ea8('0x0'));var util=require('util');var moment=require(_0x5ea8('0x1'));var BPromise=require(_0x5ea8('0x2'));var rs=require(_0x5ea8('0x3'));var fs=require('fs');var Redis=require(_0x5ea8('0x4'));var db=require(_0x5ea8('0x5'))['db'];var utils=require(_0x5ea8('0x6'));var logger=require(_0x5ea8('0x7'))(_0x5ea8('0x8'));var config=require(_0x5ea8('0x9'));var jayson=require(_0x5ea8('0xa'));var client=jayson[_0x5ea8('0xb')][_0x5ea8('0xc')]({'port':0x232a});config[_0x5ea8('0xd')]=_[_0x5ea8('0xe')](config[_0x5ea8('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x5ea8('0xf'))(new Redis(config[_0x5ea8('0xd')]));require(_0x5ea8('0x10'))[_0x5ea8('0x11')](socket);function respondWithRpcPromise(_0x535cc6,_0x1e46c6,_0x1fa8ba){return new BPromise(function(_0x3ab40c,_0x30de84){return client[_0x5ea8('0x12')](_0x535cc6,_0x1fa8ba)[_0x5ea8('0x13')](function(_0x3a51c8){logger[_0x5ea8('0x14')](_0x5ea8('0x15'),_0x1e46c6,_0x5ea8('0x16'));logger[_0x5ea8('0x17')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1e46c6,_0x5ea8('0x16'),JSON['stringify'](_0x3a51c8));if(_0x3a51c8[_0x5ea8('0x18')]){if(_0x3a51c8[_0x5ea8('0x18')][_0x5ea8('0x19')]===0x1f4){logger[_0x5ea8('0x18')](_0x5ea8('0x15'),_0x1e46c6,_0x3a51c8[_0x5ea8('0x18')][_0x5ea8('0x1a')]);return _0x30de84(_0x3a51c8[_0x5ea8('0x18')][_0x5ea8('0x1a')]);}logger[_0x5ea8('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x1e46c6,_0x3a51c8['error'][_0x5ea8('0x1a')]);return _0x3ab40c(_0x3a51c8[_0x5ea8('0x18')][_0x5ea8('0x1a')]);}else{logger[_0x5ea8('0x14')](_0x5ea8('0x15'),_0x1e46c6,_0x5ea8('0x16'));_0x3ab40c(_0x3a51c8[_0x5ea8('0x1b')]['message']);}})[_0x5ea8('0x1c')](function(_0x4eec25){logger['error'](_0x5ea8('0x15'),_0x1e46c6,_0x4eec25);_0x30de84(_0x4eec25);});});}exports[_0x5ea8('0x1d')]=function(_0x4d5ebc){var _0x112222=this;return new Promise(function(_0x3712f1,_0x27a9fb){return db['WhatsappAccount'][_0x5ea8('0x1e')]({'raw':_0x4d5ebc[_0x5ea8('0x1f')]?_0x4d5ebc[_0x5ea8('0x1f')][_0x5ea8('0x20')]===undefined?!![]:![]:!![],'where':_0x4d5ebc[_0x5ea8('0x1f')]?_0x4d5ebc[_0x5ea8('0x1f')][_0x5ea8('0x21')]||null:null,'attributes':_0x4d5ebc[_0x5ea8('0x1f')]?_0x4d5ebc[_0x5ea8('0x1f')][_0x5ea8('0x22')]||null:null,'include':_0x4d5ebc['options']?_0x4d5ebc[_0x5ea8('0x1f')]['include']?_[_0x5ea8('0x23')](_0x4d5ebc[_0x5ea8('0x1f')]['include'],function(_0x3d1277){return{'model':db[_0x3d1277[_0x5ea8('0x24')]],'as':_0x3d1277['as'],'attributes':_0x3d1277[_0x5ea8('0x22')],'include':_0x3d1277[_0x5ea8('0x25')]?_[_0x5ea8('0x23')](_0x3d1277['include'],function(_0x26dcf2){return{'model':db[_0x26dcf2[_0x5ea8('0x24')]],'as':_0x26dcf2['as'],'attributes':_0x26dcf2[_0x5ea8('0x22')],'include':_0x26dcf2[_0x5ea8('0x25')]?_[_0x5ea8('0x23')](_0x26dcf2[_0x5ea8('0x25')],function(_0x310f00){return{'model':db[_0x310f00[_0x5ea8('0x24')]],'as':_0x310f00['as'],'attributes':_0x310f00['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x16a56f){logger[_0x5ea8('0x14')]('ShowWhatsappAccount',_0x4d5ebc);logger['debug'](_0x5ea8('0x1d'),_0x4d5ebc,JSON[_0x5ea8('0x26')](_0x16a56f));_0x3712f1(_0x16a56f);})[_0x5ea8('0x1c')](function(_0x5ccdc0){logger[_0x5ea8('0x18')](_0x5ea8('0x1d'),_0x5ccdc0[_0x5ea8('0x1a')],_0x4d5ebc);_0x27a9fb(_0x112222[_0x5ea8('0x18')](0x1f4,_0x5ccdc0[_0x5ea8('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 1b38c57..d3828e7 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 _0xb898=['whatsappAccount:','./whatsappAccount.events','save','remove','update','length'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xb898,0x1cf));var _0x8b89=function(_0x14e9f0,_0x287f90){_0x14e9f0=_0x14e9f0-0x0;var _0xa63f7e=_0xb898[_0x14e9f0];return _0xa63f7e;};'use strict';var WhatsappAccountEvents=require(_0x8b89('0x0'));var events=[_0x8b89('0x1'),_0x8b89('0x2'),_0x8b89('0x3')];function createListener(_0x58a576,_0x4a1189){return function(_0x5bd8a){_0x4a1189['emit'](_0x58a576,_0x5bd8a);};}function removeListener(_0x1fe429,_0x391079){return function(){WhatsappAccountEvents['removeListener'](_0x1fe429,_0x391079);};}exports['register']=function(_0x339122){for(var _0x19de65=0x0,_0x35468f=events[_0x8b89('0x4')];_0x19de65<_0x35468f;_0x19de65++){var _0x499fde=events[_0x19de65];var _0x5b730f=createListener(_0x8b89('0x5')+_0x499fde,_0x339122);WhatsappAccountEvents['on'](_0x499fde,_0x5b730f);}}; \ No newline at end of file +var _0xba53=['./whatsappAccount.events','save','remove','removeListener','whatsappAccount:'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xba53,0x12c));var _0x3ba5=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xba53[_0x3e5086];return _0xfeb102;};'use strict';var WhatsappAccountEvents=require(_0x3ba5('0x0'));var events=[_0x3ba5('0x1'),_0x3ba5('0x2'),'update'];function createListener(_0x3b39d0,_0x42cf32){return function(_0x1be90f){_0x42cf32['emit'](_0x3b39d0,_0x1be90f);};}function removeListener(_0xc3cce4,_0x33ebc4){return function(){WhatsappAccountEvents[_0x3ba5('0x3')](_0xc3cce4,_0x33ebc4);};}exports['register']=function(_0x40cb59){for(var _0x2bd5ee=0x0,_0x4b3880=events['length'];_0x2bd5ee<_0x4b3880;_0x2bd5ee++){var _0x408436=events[_0x2bd5ee];var _0x13993e=createListener(_0x3ba5('0x4')+_0x408436,_0x40cb59);WhatsappAccountEvents['on'](_0x408436,_0x13993e);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index f45c445..385c026 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 _0x9d11=['delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','isAuthenticated','show','post','create','update'];(function(_0x4eb6ec,_0x7f2520){var _0x58881b=function(_0x4f375f){while(--_0x4f375f){_0x4eb6ec['push'](_0x4eb6ec['shift']());}};_0x58881b(++_0x7f2520);}(_0x9d11,0xec));var _0x19d1=function(_0x195c21,_0x332612){_0x195c21=_0x195c21-0x0;var _0x3576a8=_0x9d11[_0x195c21];return _0x3576a8;};'use strict';var multer=require('multer');var util=require(_0x19d1('0x0'));var path=require('path');var timeout=require(_0x19d1('0x1'));var express=require(_0x19d1('0x2'));var router=express[_0x19d1('0x3')]();var auth=require(_0x19d1('0x4'));var interaction=require(_0x19d1('0x5'));var config=require(_0x19d1('0x6'));var controller=require(_0x19d1('0x7'));router[_0x19d1('0x8')]('/',auth['isAuthenticated'](),controller[_0x19d1('0x9')]);router[_0x19d1('0x8')](_0x19d1('0xa'),auth[_0x19d1('0xb')](),controller[_0x19d1('0xc')]);router[_0x19d1('0xd')]('/',auth[_0x19d1('0xb')](),controller[_0x19d1('0xe')]);router['put'](_0x19d1('0xa'),auth[_0x19d1('0xb')](),controller[_0x19d1('0xf')]);router[_0x19d1('0x10')](_0x19d1('0xa'),auth[_0x19d1('0xb')](),controller['destroy']);module[_0x19d1('0x11')]=router; \ No newline at end of file +var _0x34ce=['create','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','show','post'];(function(_0x16ecad,_0x205047){var _0x313ff7=function(_0x58b16a){while(--_0x58b16a){_0x16ecad['push'](_0x16ecad['shift']());}};_0x313ff7(++_0x205047);}(_0x34ce,0xf2));var _0xe34c=function(_0x56eb70,_0x2bd75c){_0x56eb70=_0x56eb70-0x0;var _0x47f1fe=_0x34ce[_0x56eb70];return _0x47f1fe;};'use strict';var multer=require(_0xe34c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe34c('0x1'));var express=require(_0xe34c('0x2'));var router=express[_0xe34c('0x3')]();var auth=require(_0xe34c('0x4'));var interaction=require(_0xe34c('0x5'));var config=require(_0xe34c('0x6'));var controller=require(_0xe34c('0x7'));router[_0xe34c('0x8')]('/',auth[_0xe34c('0x9')](),controller[_0xe34c('0xa')]);router['get']('/:id',auth[_0xe34c('0x9')](),controller[_0xe34c('0xb')]);router[_0xe34c('0xc')]('/',auth[_0xe34c('0x9')](),controller[_0xe34c('0xd')]);router['put']('/:id',auth[_0xe34c('0x9')](),controller['update']);router[_0xe34c('0xe')]('/:id',auth[_0xe34c('0x9')](),controller[_0xe34c('0xf')]);module[_0xe34c('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 37571cb..cc4a0a4 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 _0x4d87=['INTEGER','STRING','*,*,*,*','sequelize','exports'];(function(_0x5a26a9,_0x160cee){var _0x49a1a2=function(_0x86506e){while(--_0x86506e){_0x5a26a9['push'](_0x5a26a9['shift']());}};_0x49a1a2(++_0x160cee);}(_0x4d87,0xf3));var _0x74d8=function(_0x29c696,_0x243038){_0x29c696=_0x29c696-0x0;var _0x2a2ad4=_0x4d87[_0x29c696];return _0x2a2ad4;};'use strict';var Sequelize=require(_0x74d8('0x0'));module[_0x74d8('0x1')]={'priority':{'type':Sequelize[_0x74d8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x74d8('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x74d8('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x74d8('0x4')}}; \ No newline at end of file +var _0x8d0b=['TEXT','STRING','*,*,*,*','sequelize','exports','noop'];(function(_0x54b780,_0x1648c2){var _0x29108f=function(_0x3cdcd1){while(--_0x3cdcd1){_0x54b780['push'](_0x54b780['shift']());}};_0x29108f(++_0x1648c2);}(_0x8d0b,0x99));var _0xb8d0=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x8d0b[_0x4a3898];return _0x25ceb0;};'use strict';var Sequelize=require(_0xb8d0('0x0'));module[_0xb8d0('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb8d0('0x2')},'appdata':{'type':Sequelize[_0xb8d0('0x3')]()},'description':{'type':Sequelize[_0xb8d0('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb8d0('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index bc21a84..78ee81c 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 _0xdda5=['rimraf','zip-dir','fast-json-patch','moment','mustache','path','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','end','json','count','limit','status','set','Content-Range','apply','save','update','then','stack','name','map','WhatsappApplication','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','filter','merge','where','VIRTUAL','options','includeAll','findAll','show','rawAttributes','filtears','include','find','create','body','catch','params','destroy','html-pdf','eml-format'];(function(_0x1e74ca,_0x59dc03){var _0x4f1f20=function(_0x11918c){while(--_0x11918c){_0x1e74ca['push'](_0x1e74ca['shift']());}};_0x4f1f20(++_0x59dc03);}(_0xdda5,0x157));var _0x5dda=function(_0x533e9b,_0x80b652){_0x533e9b=_0x533e9b-0x0;var _0x2650d7=_0xdda5[_0x533e9b];return _0x2650d7;};'use strict';var pdf=require(_0x5dda('0x0'));var emlformat=require(_0x5dda('0x1'));var rimraf=require(_0x5dda('0x2'));var zipdir=require(_0x5dda('0x3'));var jsonpatch=require(_0x5dda('0x4'));var rp=require('request-promise');var moment=require(_0x5dda('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5dda('0x6'));var util=require('util');var path=require(_0x5dda('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5dda('0x8'));var fs=require('fs');var _=require(_0x5dda('0x9'));var squel=require('squel');var crypto=require(_0x5dda('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5dda('0xb'));var toCsv=require(_0x5dda('0xc'));var querystring=require(_0x5dda('0xd'));var Papa=require(_0x5dda('0xe'));var Redis=require(_0x5dda('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5dda('0x10'));var as=require(_0x5dda('0x11'));var hardwareService=require(_0x5dda('0x12'));var logger=require('../../config/logger')(_0x5dda('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dda('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ff42c,_0x4a6028){_0x4a6028=_0x4a6028||0xcc;return function(_0x1796cb){if(_0x1796cb){return _0x1ff42c[_0x5dda('0x15')](_0x4a6028);}return _0x1ff42c['status'](_0x4a6028)[_0x5dda('0x16')]();};}function respondWithResult(_0x4ca168,_0xc2472a){_0xc2472a=_0xc2472a||0xc8;return function(_0x6da28a){if(_0x6da28a){return _0x4ca168['status'](_0xc2472a)[_0x5dda('0x17')](_0x6da28a);}};}function respondWithFilteredResult(_0x2edc9b,_0x21b97f){return function(_0x434f7a){if(_0x434f7a){var _0x1b63a6=_0x434f7a[_0x5dda('0x18')],_0x42aeaf=_0x21b97f['offset'],_0x745257=_0x21b97f['offset']+_0x21b97f[_0x5dda('0x19')],_0x5cc3de;if(_0x745257>=_0x1b63a6){_0x745257=_0x1b63a6;_0x5cc3de=0xc8;}else{_0x5cc3de=0xce;}_0x2edc9b[_0x5dda('0x1a')](_0x5cc3de);return _0x2edc9b[_0x5dda('0x1b')](_0x5dda('0x1c'),_0x42aeaf+'-'+_0x745257+'/'+_0x1b63a6)['json'](_0x434f7a);}return null;};}function patchUpdates(_0x5a6118){return function(_0x49644e){try{jsonpatch[_0x5dda('0x1d')](_0x49644e,_0x5a6118,!![]);}catch(_0x1121b2){return BPromise['reject'](_0x1121b2);}return _0x49644e[_0x5dda('0x1e')]();};}function saveUpdates(_0x1d2449,_0x566883){return function(_0x15007b){if(_0x15007b){return _0x15007b[_0x5dda('0x1f')](_0x1d2449)[_0x5dda('0x20')](function(_0x407beb){return _0x407beb;});}return null;};}function removeEntity(_0x253672,_0x11af26){return function(_0x6869cf){if(_0x6869cf){return _0x6869cf['destroy']()[_0x5dda('0x20')](function(){_0x253672['status'](0xcc)[_0x5dda('0x16')]();});}};}function handleEntityNotFound(_0x3fbb15,_0xabda0b){return function(_0x258c8d){if(!_0x258c8d){_0x3fbb15[_0x5dda('0x15')](0x194);}return _0x258c8d;};}function handleError(_0x37905c,_0x4b79e0){_0x4b79e0=_0x4b79e0||0x1f4;return function(_0x4e159c){logger['error'](_0x4e159c[_0x5dda('0x21')]);if(_0x4e159c[_0x5dda('0x22')]){delete _0x4e159c[_0x5dda('0x22')];}_0x37905c[_0x5dda('0x1a')](_0x4b79e0)['send'](_0x4e159c);};}exports['index']=function(_0x4e2fea,_0x3f291a){var _0x255391={},_0x513a10={},_0x246e11={'count':0x0,'rows':[]};var _0x19b8a3=_[_0x5dda('0x23')](db[_0x5dda('0x24')]['rawAttributes'],function(_0x5cdad2){return{'name':_0x5cdad2[_0x5dda('0x25')],'type':_0x5cdad2[_0x5dda('0x26')]['key']};});_0x513a10[_0x5dda('0x27')]=_['map'](_0x19b8a3,_0x5dda('0x22'));_0x513a10[_0x5dda('0x28')]=_[_0x5dda('0x29')](_0x4e2fea[_0x5dda('0x28')]);_0x513a10[_0x5dda('0x2a')]=_[_0x5dda('0x2b')](_0x513a10['model'],_0x513a10[_0x5dda('0x28')]);_0x255391['attributes']=_[_0x5dda('0x2b')](_0x513a10[_0x5dda('0x27')],qs[_0x5dda('0x2c')](_0x4e2fea[_0x5dda('0x28')][_0x5dda('0x2c')]));_0x255391[_0x5dda('0x2d')]=_0x255391[_0x5dda('0x2d')][_0x5dda('0x2e')]?_0x255391['attributes']:_0x513a10['model'];if(!_0x4e2fea[_0x5dda('0x28')][_0x5dda('0x2f')](_0x5dda('0x30'))){_0x255391[_0x5dda('0x19')]=qs[_0x5dda('0x19')](_0x4e2fea[_0x5dda('0x28')][_0x5dda('0x19')]);_0x255391[_0x5dda('0x31')]=qs[_0x5dda('0x31')](_0x4e2fea[_0x5dda('0x28')][_0x5dda('0x31')]);}_0x255391[_0x5dda('0x32')]=qs[_0x5dda('0x33')](_0x4e2fea[_0x5dda('0x28')][_0x5dda('0x33')]);_0x255391['where']=qs['filters'](_['pick'](_0x4e2fea['query'],_0x513a10[_0x5dda('0x2a')]),_0x19b8a3);if(_0x4e2fea[_0x5dda('0x28')][_0x5dda('0x34')]){_0x255391['where']=_[_0x5dda('0x35')](_0x255391[_0x5dda('0x36')],{'$or':_[_0x5dda('0x23')](_0x19b8a3,function(_0x4dc187){if(_0x4dc187[_0x5dda('0x26')]!==_0x5dda('0x37')){var _0x1faf0b={};_0x1faf0b[_0x4dc187[_0x5dda('0x22')]]={'$like':'%'+_0x4e2fea[_0x5dda('0x28')][_0x5dda('0x34')]+'%'};return _0x1faf0b;}})});}_0x255391=_[_0x5dda('0x35')]({},_0x255391,_0x4e2fea[_0x5dda('0x38')]);var _0x4b5ef8={'where':_0x255391[_0x5dda('0x36')]};return db[_0x5dda('0x24')][_0x5dda('0x18')](_0x4b5ef8)[_0x5dda('0x20')](function(_0xdd925){_0x246e11[_0x5dda('0x18')]=_0xdd925;if(_0x4e2fea[_0x5dda('0x28')][_0x5dda('0x39')]){_0x255391['include']=[{'all':!![]}];}return db[_0x5dda('0x24')][_0x5dda('0x3a')](_0x255391);})[_0x5dda('0x20')](function(_0x7f3c8b){_0x246e11['rows']=_0x7f3c8b;return _0x246e11;})[_0x5dda('0x20')](respondWithFilteredResult(_0x3f291a,_0x255391))['catch'](handleError(_0x3f291a,null));};exports[_0x5dda('0x3b')]=function(_0x1d4c24,_0x388983){var _0x5f1cee={'raw':!![],'where':{'id':_0x1d4c24['params']['id']}},_0xdd4d7a={};_0xdd4d7a['model']=_[_0x5dda('0x29')](db[_0x5dda('0x24')][_0x5dda('0x3c')]);_0xdd4d7a[_0x5dda('0x28')]=_[_0x5dda('0x29')](_0x1d4c24[_0x5dda('0x28')]);_0xdd4d7a[_0x5dda('0x3d')]=_[_0x5dda('0x2b')](_0xdd4d7a['model'],_0xdd4d7a['query']);_0x5f1cee[_0x5dda('0x2d')]=_['intersection'](_0xdd4d7a[_0x5dda('0x27')],qs['fields'](_0x1d4c24['query'][_0x5dda('0x2c')]));_0x5f1cee[_0x5dda('0x2d')]=_0x5f1cee['attributes'][_0x5dda('0x2e')]?_0x5f1cee[_0x5dda('0x2d')]:_0xdd4d7a[_0x5dda('0x27')];if(_0x1d4c24['query'][_0x5dda('0x39')]){_0x5f1cee[_0x5dda('0x3e')]=[{'all':!![]}];}_0x5f1cee=_[_0x5dda('0x35')]({},_0x5f1cee,_0x1d4c24[_0x5dda('0x38')]);return db[_0x5dda('0x24')][_0x5dda('0x3f')](_0x5f1cee)[_0x5dda('0x20')](handleEntityNotFound(_0x388983,null))[_0x5dda('0x20')](respondWithResult(_0x388983,null))['catch'](handleError(_0x388983,null));};exports[_0x5dda('0x40')]=function(_0x431b4e,_0x5dc447){return db[_0x5dda('0x24')][_0x5dda('0x40')](_0x431b4e[_0x5dda('0x41')],{})[_0x5dda('0x20')](respondWithResult(_0x5dc447,0xc9))[_0x5dda('0x42')](handleError(_0x5dc447,null));};exports[_0x5dda('0x1f')]=function(_0x1b5518,_0x1fa1ec){if(_0x1b5518['body']['id']){delete _0x1b5518[_0x5dda('0x41')]['id'];}return db['WhatsappApplication'][_0x5dda('0x3f')]({'where':{'id':_0x1b5518[_0x5dda('0x43')]['id']}})[_0x5dda('0x20')](handleEntityNotFound(_0x1fa1ec,null))[_0x5dda('0x20')](saveUpdates(_0x1b5518[_0x5dda('0x41')],null))[_0x5dda('0x20')](respondWithResult(_0x1fa1ec,null))[_0x5dda('0x42')](handleError(_0x1fa1ec,null));};exports[_0x5dda('0x44')]=function(_0x203fe9,_0x53a31c){return db['WhatsappApplication'][_0x5dda('0x3f')]({'where':{'id':_0x203fe9[_0x5dda('0x43')]['id']}})['then'](handleEntityNotFound(_0x53a31c,null))[_0x5dda('0x20')](removeEntity(_0x53a31c,null))[_0x5dda('0x42')](handleError(_0x53a31c,null));}; \ No newline at end of file +var _0x3dbb=['order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappApplication','include','rows','catch','show','params','keys','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3dbb,0x1c8));var _0xb3db=function(_0x20b18f,_0xf29421){_0x20b18f=_0x20b18f-0x0;var _0x510ea8=_0x3dbb[_0x20b18f];return _0x510ea8;};'use strict';var pdf=require(_0xb3db('0x0'));var emlformat=require(_0xb3db('0x1'));var rimraf=require(_0xb3db('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb3db('0x3'));var rp=require(_0xb3db('0x4'));var moment=require(_0xb3db('0x5'));var BPromise=require(_0xb3db('0x6'));var Mustache=require(_0xb3db('0x7'));var util=require('util');var path=require(_0xb3db('0x8'));var sox=require(_0xb3db('0x9'));var csv=require(_0xb3db('0xa'));var ejs=require(_0xb3db('0xb'));var fs=require('fs');var _=require(_0xb3db('0xc'));var squel=require(_0xb3db('0xd'));var crypto=require(_0xb3db('0xe'));var jsforce=require(_0xb3db('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb3db('0xa'));var querystring=require('querystring');var Papa=require(_0xb3db('0x10'));var Redis=require(_0xb3db('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb3db('0x12'));var hardwareService=require(_0xb3db('0x13'));var logger=require(_0xb3db('0x14'))(_0xb3db('0x15'));var utils=require(_0xb3db('0x16'));var config=require(_0xb3db('0x17'));var licenseUtil=require(_0xb3db('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e1250,_0x221abd){_0x221abd=_0x221abd||0xcc;return function(_0x40cf3f){if(_0x40cf3f){return _0x1e1250[_0xb3db('0x19')](_0x221abd);}return _0x1e1250['status'](_0x221abd)['end']();};}function respondWithResult(_0xb031ad,_0x177365){_0x177365=_0x177365||0xc8;return function(_0x550541){if(_0x550541){return _0xb031ad[_0xb3db('0x1a')](_0x177365)['json'](_0x550541);}};}function respondWithFilteredResult(_0x1a5d4d,_0x14c584){return function(_0x45fb05){if(_0x45fb05){var _0x9175ca=_0x45fb05[_0xb3db('0x1b')],_0x19ca02=_0x14c584['offset'],_0x983a59=_0x14c584['offset']+_0x14c584[_0xb3db('0x1c')],_0x2456a5;if(_0x983a59>=_0x9175ca){_0x983a59=_0x9175ca;_0x2456a5=0xc8;}else{_0x2456a5=0xce;}_0x1a5d4d[_0xb3db('0x1a')](_0x2456a5);return _0x1a5d4d[_0xb3db('0x1d')](_0xb3db('0x1e'),_0x19ca02+'-'+_0x983a59+'/'+_0x9175ca)['json'](_0x45fb05);}return null;};}function patchUpdates(_0x57c9d9){return function(_0xfaad2a){try{jsonpatch[_0xb3db('0x1f')](_0xfaad2a,_0x57c9d9,!![]);}catch(_0x273f4e){return BPromise[_0xb3db('0x20')](_0x273f4e);}return _0xfaad2a[_0xb3db('0x21')]();};}function saveUpdates(_0x400920,_0x453305){return function(_0x54bd4a){if(_0x54bd4a){return _0x54bd4a[_0xb3db('0x22')](_0x400920)['then'](function(_0x4df50c){return _0x4df50c;});}return null;};}function removeEntity(_0x1e4f65,_0x167020){return function(_0x37b149){if(_0x37b149){return _0x37b149[_0xb3db('0x23')]()[_0xb3db('0x24')](function(){_0x1e4f65[_0xb3db('0x1a')](0xcc)[_0xb3db('0x25')]();});}};}function handleEntityNotFound(_0x2732d9,_0x37f2d7){return function(_0x978769){if(!_0x978769){_0x2732d9['sendStatus'](0x194);}return _0x978769;};}function handleError(_0x56c536,_0x3b1eb7){_0x3b1eb7=_0x3b1eb7||0x1f4;return function(_0x166f52){logger[_0xb3db('0x26')](_0x166f52[_0xb3db('0x27')]);if(_0x166f52[_0xb3db('0x28')]){delete _0x166f52['name'];}_0x56c536[_0xb3db('0x1a')](_0x3b1eb7)[_0xb3db('0x29')](_0x166f52);};}exports['index']=function(_0x3889ae,_0x9a9564){var _0x37ae88={},_0x168ca4={},_0x46becf={'count':0x0,'rows':[]};var _0x273561=_['map'](db['WhatsappApplication'][_0xb3db('0x2a')],function(_0x4421de){return{'name':_0x4421de['fieldName'],'type':_0x4421de[_0xb3db('0x2b')][_0xb3db('0x2c')]};});_0x168ca4[_0xb3db('0x2d')]=_['map'](_0x273561,_0xb3db('0x28'));_0x168ca4[_0xb3db('0x2e')]=_['keys'](_0x3889ae[_0xb3db('0x2e')]);_0x168ca4[_0xb3db('0x2f')]=_[_0xb3db('0x30')](_0x168ca4[_0xb3db('0x2d')],_0x168ca4['query']);_0x37ae88['attributes']=_[_0xb3db('0x30')](_0x168ca4[_0xb3db('0x2d')],qs[_0xb3db('0x31')](_0x3889ae[_0xb3db('0x2e')][_0xb3db('0x31')]));_0x37ae88[_0xb3db('0x32')]=_0x37ae88['attributes'][_0xb3db('0x33')]?_0x37ae88[_0xb3db('0x32')]:_0x168ca4[_0xb3db('0x2d')];if(!_0x3889ae[_0xb3db('0x2e')][_0xb3db('0x34')](_0xb3db('0x35'))){_0x37ae88[_0xb3db('0x1c')]=qs[_0xb3db('0x1c')](_0x3889ae[_0xb3db('0x2e')][_0xb3db('0x1c')]);_0x37ae88[_0xb3db('0x36')]=qs[_0xb3db('0x36')](_0x3889ae[_0xb3db('0x2e')][_0xb3db('0x36')]);}_0x37ae88[_0xb3db('0x37')]=qs[_0xb3db('0x38')](_0x3889ae[_0xb3db('0x2e')][_0xb3db('0x38')]);_0x37ae88[_0xb3db('0x39')]=qs[_0xb3db('0x2f')](_[_0xb3db('0x3a')](_0x3889ae[_0xb3db('0x2e')],_0x168ca4[_0xb3db('0x2f')]),_0x273561);if(_0x3889ae[_0xb3db('0x2e')][_0xb3db('0x3b')]){_0x37ae88[_0xb3db('0x39')]=_[_0xb3db('0x3c')](_0x37ae88['where'],{'$or':_['map'](_0x273561,function(_0x29360d){if(_0x29360d[_0xb3db('0x2b')]!==_0xb3db('0x3d')){var _0x3cffd7={};_0x3cffd7[_0x29360d['name']]={'$like':'%'+_0x3889ae[_0xb3db('0x2e')][_0xb3db('0x3b')]+'%'};return _0x3cffd7;}})});}_0x37ae88=_[_0xb3db('0x3c')]({},_0x37ae88,_0x3889ae[_0xb3db('0x3e')]);var _0x3cffe1={'where':_0x37ae88[_0xb3db('0x39')]};return db[_0xb3db('0x3f')][_0xb3db('0x1b')](_0x3cffe1)[_0xb3db('0x24')](function(_0x5bb2ca){_0x46becf['count']=_0x5bb2ca;if(_0x3889ae['query']['includeAll']){_0x37ae88[_0xb3db('0x40')]=[{'all':!![]}];}return db[_0xb3db('0x3f')]['findAll'](_0x37ae88);})[_0xb3db('0x24')](function(_0x22496e){_0x46becf[_0xb3db('0x41')]=_0x22496e;return _0x46becf;})[_0xb3db('0x24')](respondWithFilteredResult(_0x9a9564,_0x37ae88))[_0xb3db('0x42')](handleError(_0x9a9564,null));};exports[_0xb3db('0x43')]=function(_0x201bd8,_0x1013c2){var _0x5881cb={'raw':!![],'where':{'id':_0x201bd8[_0xb3db('0x44')]['id']}},_0x99740f={};_0x99740f[_0xb3db('0x2d')]=_[_0xb3db('0x45')](db[_0xb3db('0x3f')][_0xb3db('0x2a')]);_0x99740f['query']=_[_0xb3db('0x45')](_0x201bd8[_0xb3db('0x2e')]);_0x99740f['filtears']=_[_0xb3db('0x30')](_0x99740f[_0xb3db('0x2d')],_0x99740f[_0xb3db('0x2e')]);_0x5881cb[_0xb3db('0x32')]=_[_0xb3db('0x30')](_0x99740f[_0xb3db('0x2d')],qs[_0xb3db('0x31')](_0x201bd8[_0xb3db('0x2e')][_0xb3db('0x31')]));_0x5881cb[_0xb3db('0x32')]=_0x5881cb['attributes']['length']?_0x5881cb[_0xb3db('0x32')]:_0x99740f['model'];if(_0x201bd8[_0xb3db('0x2e')]['includeAll']){_0x5881cb['include']=[{'all':!![]}];}_0x5881cb=_[_0xb3db('0x3c')]({},_0x5881cb,_0x201bd8[_0xb3db('0x3e')]);return db[_0xb3db('0x3f')][_0xb3db('0x46')](_0x5881cb)[_0xb3db('0x24')](handleEntityNotFound(_0x1013c2,null))['then'](respondWithResult(_0x1013c2,null))[_0xb3db('0x42')](handleError(_0x1013c2,null));};exports[_0xb3db('0x47')]=function(_0x1a99fb,_0x180257){return db[_0xb3db('0x3f')][_0xb3db('0x47')](_0x1a99fb[_0xb3db('0x48')],{})['then'](respondWithResult(_0x180257,0xc9))[_0xb3db('0x42')](handleError(_0x180257,null));};exports[_0xb3db('0x22')]=function(_0x40d224,_0x13e370){if(_0x40d224[_0xb3db('0x48')]['id']){delete _0x40d224['body']['id'];}return db[_0xb3db('0x3f')][_0xb3db('0x46')]({'where':{'id':_0x40d224[_0xb3db('0x44')]['id']}})[_0xb3db('0x24')](handleEntityNotFound(_0x13e370,null))[_0xb3db('0x24')](saveUpdates(_0x40d224['body'],null))[_0xb3db('0x24')](respondWithResult(_0x13e370,null))[_0xb3db('0x42')](handleError(_0x13e370,null));};exports['destroy']=function(_0x56c002,_0x2f1415){return db['WhatsappApplication'][_0xb3db('0x46')]({'where':{'id':_0x56c002['params']['id']}})[_0xb3db('0x24')](handleEntityNotFound(_0x2f1415,null))[_0xb3db('0x24')](removeEntity(_0x2f1415,null))[_0xb3db('0x42')](handleError(_0x2f1415,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index b751b3c..205c9ec 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 _0xe135=['./whatsappApplication.attributes','WhatsappApplication','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2d9617,_0x33050e){var _0xa2d1e=function(_0x3b00c3){while(--_0x3b00c3){_0x2d9617['push'](_0x2d9617['shift']());}};_0xa2d1e(++_0x33050e);}(_0xe135,0x1d7));var _0x5e13=function(_0xbf3f20,_0x5bf459){_0xbf3f20=_0xbf3f20-0x0;var _0x4b8870=_0xe135[_0xbf3f20];return _0x4b8870;};'use strict';var _=require(_0x5e13('0x0'));var util=require(_0x5e13('0x1'));var logger=require(_0x5e13('0x2'))(_0x5e13('0x3'));var moment=require('moment');var BPromise=require(_0x5e13('0x4'));var rp=require(_0x5e13('0x5'));var fs=require('fs');var path=require(_0x5e13('0x6'));var rimraf=require(_0x5e13('0x7'));var config=require(_0x5e13('0x8'));var attributes=require(_0x5e13('0x9'));module['exports']=function(_0x4a8f1b,_0x387373){return _0x4a8f1b['define'](_0x5e13('0xa'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5e13('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xadcf=['path','rimraf','./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0xefd816,_0x51799d){var _0x282669=function(_0x429323){while(--_0x429323){_0xefd816['push'](_0xefd816['shift']());}};_0x282669(++_0x51799d);}(_0xadcf,0x132));var _0xfadc=function(_0x223f00,_0x5e5c44){_0x223f00=_0x223f00-0x0;var _0x6778cb=_0xadcf[_0x223f00];return _0x6778cb;};'use strict';var _=require(_0xfadc('0x0'));var util=require(_0xfadc('0x1'));var logger=require(_0xfadc('0x2'))('api');var moment=require(_0xfadc('0x3'));var BPromise=require(_0xfadc('0x4'));var rp=require(_0xfadc('0x5'));var fs=require('fs');var path=require(_0xfadc('0x6'));var rimraf=require(_0xfadc('0x7'));var config=require('../../config/environment');var attributes=require(_0xfadc('0x8'));module[_0xfadc('0x9')]=function(_0xdd17e8,_0x2f9618){return _0xdd17e8['define'](_0xfadc('0xa'),attributes,{'tableName':_0xfadc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfadc('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index a2626ec..63a286c 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 _0xf52f=['request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x576f26,_0x6dac0a){var _0x1bf6f6=function(_0x3c71e6){while(--_0x3c71e6){_0x576f26['push'](_0x576f26['shift']());}};_0x1bf6f6(++_0x6dac0a);}(_0xf52f,0x113));var _0xff52=function(_0x4f067e,_0x406536){_0x4f067e=_0x4f067e-0x0;var _0x3930d1=_0xf52f[_0x4f067e];return _0x3930d1;};'use strict';var _=require(_0xff52('0x0'));var util=require(_0xff52('0x1'));var moment=require(_0xff52('0x2'));var BPromise=require('bluebird');var rs=require(_0xff52('0x3'));var fs=require('fs');var Redis=require(_0xff52('0x4'));var db=require(_0xff52('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xff52('0x6'))(_0xff52('0x7'));var config=require('../../config/environment');var jayson=require(_0xff52('0x8'));var client=jayson[_0xff52('0x9')][_0xff52('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x328920,_0x64f10b,_0x17af4a){return new BPromise(function(_0x2e80a0,_0x10dcbe){return client[_0xff52('0xb')](_0x328920,_0x17af4a)[_0xff52('0xc')](function(_0x34f1f9){logger[_0xff52('0xd')](_0xff52('0xe'),_0x64f10b,_0xff52('0xf'));logger[_0xff52('0x10')](_0xff52('0x11'),_0x64f10b,_0xff52('0xf'),JSON[_0xff52('0x12')](_0x34f1f9));if(_0x34f1f9[_0xff52('0x13')]){if(_0x34f1f9['error']['code']===0x1f4){logger[_0xff52('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x64f10b,_0x34f1f9[_0xff52('0x13')][_0xff52('0x14')]);return _0x10dcbe(_0x34f1f9[_0xff52('0x13')][_0xff52('0x14')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x64f10b,_0x34f1f9['error'][_0xff52('0x14')]);return _0x2e80a0(_0x34f1f9['error']['message']);}else{logger[_0xff52('0xd')](_0xff52('0xe'),_0x64f10b,_0xff52('0xf'));_0x2e80a0(_0x34f1f9[_0xff52('0x15')][_0xff52('0x14')]);}})['catch'](function(_0x853d6b){logger['error'](_0xff52('0xe'),_0x64f10b,_0x853d6b);_0x10dcbe(_0x853d6b);});});} \ No newline at end of file +var _0x13c5=['request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x2f692e,_0x72dc7f){var _0x8d7b78=function(_0x4ef903){while(--_0x4ef903){_0x2f692e['push'](_0x2f692e['shift']());}};_0x8d7b78(++_0x72dc7f);}(_0x13c5,0x7a));var _0x513c=function(_0x765b79,_0x31a864){_0x765b79=_0x765b79-0x0;var _0x3e8bba=_0x13c5[_0x765b79];return _0x3e8bba;};'use strict';var _=require(_0x513c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x513c('0x1'));var logger=require('../../config/logger')('rpc');var config=require(_0x513c('0x2'));var jayson=require(_0x513c('0x3'));var client=jayson[_0x513c('0x4')][_0x513c('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x51309d,_0x59ccbb,_0x40be91){return new BPromise(function(_0x3fc015,_0x42da79){return client[_0x513c('0x6')](_0x51309d,_0x40be91)[_0x513c('0x7')](function(_0x3126f2){logger[_0x513c('0x8')](_0x513c('0x9'),_0x59ccbb,'request\x20sent');logger[_0x513c('0xa')](_0x513c('0xb'),_0x59ccbb,'request\x20sent',JSON['stringify'](_0x3126f2));if(_0x3126f2[_0x513c('0xc')]){if(_0x3126f2[_0x513c('0xc')]['code']===0x1f4){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x59ccbb,_0x3126f2[_0x513c('0xc')]['message']);return _0x42da79(_0x3126f2[_0x513c('0xc')][_0x513c('0xd')]);}logger['error'](_0x513c('0x9'),_0x59ccbb,_0x3126f2[_0x513c('0xc')][_0x513c('0xd')]);return _0x3fc015(_0x3126f2[_0x513c('0xc')][_0x513c('0xd')]);}else{logger['info'](_0x513c('0x9'),_0x59ccbb,'request\x20sent');_0x3fc015(_0x3126f2[_0x513c('0xe')][_0x513c('0xd')]);}})[_0x513c('0xf')](function(_0x2fd03e){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x59ccbb,_0x2fd03e);_0x42da79(_0x2fd03e);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index d2124fe..007bf06 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 _0x03c8=['isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','post','/:id/tags','tracked','whatsapp','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','index','get','/describe'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x03c8,0x1f4));var _0x803c=function(_0x39e638,_0x1c2950){_0x39e638=_0x39e638-0x0;var _0x5283cd=_0x03c8[_0x39e638];return _0x5283cd;};'use strict';var multer=require(_0x803c('0x0'));var util=require('util');var path=require(_0x803c('0x1'));var timeout=require(_0x803c('0x2'));var express=require(_0x803c('0x3'));var router=express[_0x803c('0x4')]();var auth=require(_0x803c('0x5'));var interaction=require(_0x803c('0x6'));var config=require(_0x803c('0x7'));var controller=require(_0x803c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x803c('0x9')]);router[_0x803c('0xa')](_0x803c('0xb'),auth[_0x803c('0xc')](),controller[_0x803c('0xd')]);router[_0x803c('0xa')](_0x803c('0xe'),auth['isAuthenticated'](),controller[_0x803c('0xf')]);router[_0x803c('0xa')](_0x803c('0x10'),auth['isAuthenticated'](),controller['getMessages']);router[_0x803c('0xa')](_0x803c('0x11'),auth[_0x803c('0xc')](),controller[_0x803c('0x12')]);router['post']('/',auth[_0x803c('0xc')](),controller['create']);router[_0x803c('0x13')](_0x803c('0x10'),auth[_0x803c('0xc')](),controller['addMessage']);router[_0x803c('0x13')](_0x803c('0x14'),auth[_0x803c('0xc')](),interaction[_0x803c('0x15')](_0x803c('0x16'),'whatsappinteraction:addtags'),controller[_0x803c('0x17')]);router[_0x803c('0x18')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x803c('0x16'),_0x803c('0x19')),controller[_0x803c('0x1a')]);router[_0x803c('0x1b')](_0x803c('0xe'),auth['isAuthenticated'](),interaction[_0x803c('0x15')](_0x803c('0x16'),_0x803c('0x1c')),controller[_0x803c('0x1d')]);router[_0x803c('0x1b')](_0x803c('0x14'),auth['isAuthenticated'](),controller[_0x803c('0x1e')]);module[_0x803c('0x1f')]=router; \ No newline at end of file +var _0xb1fb=['addMessage','/:id/tags','tracked','whatsapp','put','/:id','whatsappinteraction:update','destroy','delete','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','download','post'];(function(_0x5dde39,_0x284aa4){var _0x20f277=function(_0x1b76bb){while(--_0x1b76bb){_0x5dde39['push'](_0x5dde39['shift']());}};_0x20f277(++_0x284aa4);}(_0xb1fb,0x141));var _0xbb1f=function(_0x38087e,_0x2c0ed6){_0x38087e=_0x38087e-0x0;var _0x5e897e=_0xb1fb[_0x38087e];return _0x5e897e;};'use strict';var multer=require(_0xbb1f('0x0'));var util=require('util');var path=require(_0xbb1f('0x1'));var timeout=require(_0xbb1f('0x2'));var express=require(_0xbb1f('0x3'));var router=express[_0xbb1f('0x4')]();var auth=require(_0xbb1f('0x5'));var interaction=require(_0xbb1f('0x6'));var config=require(_0xbb1f('0x7'));var controller=require(_0xbb1f('0x8'));router[_0xbb1f('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb1f('0xa')]);router[_0xbb1f('0x9')](_0xbb1f('0xb'),auth[_0xbb1f('0xc')](),controller[_0xbb1f('0xd')]);router[_0xbb1f('0x9')]('/:id',auth[_0xbb1f('0xc')](),controller[_0xbb1f('0xe')]);router[_0xbb1f('0x9')](_0xbb1f('0xf'),auth[_0xbb1f('0xc')](),controller[_0xbb1f('0x10')]);router['get'](_0xbb1f('0x11'),auth['isAuthenticated'](),controller[_0xbb1f('0x12')]);router[_0xbb1f('0x13')]('/',auth[_0xbb1f('0xc')](),controller['create']);router[_0xbb1f('0x13')](_0xbb1f('0xf'),auth['isAuthenticated'](),controller[_0xbb1f('0x14')]);router['post'](_0xbb1f('0x15'),auth[_0xbb1f('0xc')](),interaction[_0xbb1f('0x16')](_0xbb1f('0x17'),'whatsappinteraction:addtags'),controller['addTags']);router[_0xbb1f('0x18')](_0xbb1f('0x19'),auth['isAuthenticated'](),interaction[_0xbb1f('0x16')](_0xbb1f('0x17'),_0xbb1f('0x1a')),controller['update']);router['delete'](_0xbb1f('0x19'),auth[_0xbb1f('0xc')](),interaction[_0xbb1f('0x16')](_0xbb1f('0x17'),'whatsappinteraction:destroy'),controller[_0xbb1f('0x1b')]);router[_0xbb1f('0x1c')]('/:id/tags',auth['isAuthenticated'](),controller[_0xbb1f('0x1d')]);module[_0xbb1f('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 13cb2fc..310267b 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 _0x5f4d=['exports','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5f4d,0x91));var _0xd5f4=function(_0x3a3a6a,_0x5eb6a9){_0x3a3a6a=_0x3a3a6a-0x0;var _0xa89294=_0x5f4d[_0x3a3a6a];return _0xa89294;};'use strict';var Sequelize=require(_0xd5f4('0x0'));var moment=require(_0xd5f4('0x1'));module[_0xd5f4('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd5f4('0x3')]},'disposition':{'type':Sequelize[_0xd5f4('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd5f4('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xd5f4('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd5f4('0x5')]('in',_0xd5f4('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd5f4('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd5f4('0x5')]('in',_0xd5f4('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xbfba=['out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x4bd183,_0x3e4d6b){var _0x2e5df4=function(_0x1d8488){while(--_0x1d8488){_0x4bd183['push'](_0x4bd183['shift']());}};_0x2e5df4(++_0x3e4d6b);}(_0xbfba,0x1ac));var _0xabfb=function(_0x46540e,_0x2a75e5){_0x46540e=_0x46540e-0x0;var _0x3d4fc2=_0xbfba[_0x46540e];return _0x3d4fc2;};'use strict';var Sequelize=require(_0xabfb('0x0'));var moment=require(_0xabfb('0x1'));module[_0xabfb('0x2')]={'closed':{'type':Sequelize[_0xabfb('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xabfb('0x4')]},'disposition':{'type':Sequelize[_0xabfb('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xabfb('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xabfb('0x5')]},'read1stAt':{'type':Sequelize[_0xabfb('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xabfb('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index f6fe603..06a0501 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 _0xb2d0=['ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','push','all','rows','show','params','filtears','intersection','includeAll','include','options','create','describe','addMessage','ids','getMessages','findOne','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','WhatsappMessage','addTags','setTags','omit','spread','Tag','findAll','color','removeTags','download','unix','join','server','tmp','root','files','transcript-%d-%s.zip','User','fullname','CmContact','attachments','Attachment','Messages','createdAt','direction','secret','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Whatsapp','N.A.','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','firstName','lastName','renderFile','views','toFile','.pdf','log','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','catch','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','fields','attributes','nolimit','order','sort','where','pick','select','field','from','u.id','ui.WhatsappInteractionId','left_join','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','body','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','toString','count','sequelize','keyBy','merge','a.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)'];(function(_0x1b5a05,_0x2c80de){var _0x347931=function(_0xd39454){while(--_0xd39454){_0x1b5a05['push'](_0x1b5a05['shift']());}};_0x347931(++_0x2c80de);}(_0xb2d0,0x13b));var _0x0b2d=function(_0x413fd1,_0x4e4de7){_0x413fd1=_0x413fd1-0x0;var _0x167410=_0xb2d0[_0x413fd1];return _0x167410;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x0b2d('0x0'));var zipdir=require(_0x0b2d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b2d('0x2'));var moment=require(_0x0b2d('0x3'));var BPromise=require(_0x0b2d('0x4'));var Mustache=require(_0x0b2d('0x5'));var util=require(_0x0b2d('0x6'));var path=require('path');var sox=require(_0x0b2d('0x7'));var csv=require(_0x0b2d('0x8'));var ejs=require(_0x0b2d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0b2d('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0b2d('0xb'));var Papa=require(_0x0b2d('0xc'));var Redis=require('ioredis');var authService=require(_0x0b2d('0xd'));var qs=require(_0x0b2d('0xe'));var as=require(_0x0b2d('0xf'));var hardwareService=require(_0x0b2d('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x0b2d('0x11'));var config=require(_0x0b2d('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x0b2d('0x13'))['db'];config[_0x0b2d('0x14')]=_[_0x0b2d('0x15')](config[_0x0b2d('0x14')],{'host':_0x0b2d('0x16'),'port':0x18eb});var socket=require(_0x0b2d('0x17'))(new Redis(config['redis']));require(_0x0b2d('0x18'))[_0x0b2d('0x19')](socket);function respondWithStatusCode(_0x157442,_0x44ee7f){_0x44ee7f=_0x44ee7f||0xcc;return function(_0xf86b4f){if(_0xf86b4f){return _0x157442[_0x0b2d('0x1a')](_0x44ee7f);}return _0x157442[_0x0b2d('0x1b')](_0x44ee7f)[_0x0b2d('0x1c')]();};}function respondWithResult(_0x3f1395,_0x3918bf){_0x3918bf=_0x3918bf||0xc8;return function(_0x577c62){if(_0x577c62){return _0x3f1395[_0x0b2d('0x1b')](_0x3918bf)[_0x0b2d('0x1d')](_0x577c62);}};}function respondWithFilteredResult(_0x3b3800,_0x14f09e){return function(_0x44aa89){if(_0x44aa89){var _0x272d0c=_0x44aa89['count'],_0x2d8aac=_0x14f09e['offset'],_0x39e7ec=_0x14f09e[_0x0b2d('0x1e')]+_0x14f09e[_0x0b2d('0x1f')],_0x39de75;if(_0x39e7ec>=_0x272d0c){_0x39e7ec=_0x272d0c;_0x39de75=0xc8;}else{_0x39de75=0xce;}_0x3b3800[_0x0b2d('0x1b')](_0x39de75);return _0x3b3800[_0x0b2d('0x20')](_0x0b2d('0x21'),_0x2d8aac+'-'+_0x39e7ec+'/'+_0x272d0c)[_0x0b2d('0x1d')](_0x44aa89);}return null;};}function patchUpdates(_0x4dbc81){return function(_0xa8ffe5){try{jsonpatch[_0x0b2d('0x22')](_0xa8ffe5,_0x4dbc81,!![]);}catch(_0x8e8c37){return BPromise[_0x0b2d('0x23')](_0x8e8c37);}return _0xa8ffe5[_0x0b2d('0x24')]();};}function saveUpdates(_0xc6347c,_0x3aabfa){return function(_0x51c29a){if(_0x51c29a){return _0x51c29a[_0x0b2d('0x25')](_0xc6347c)[_0x0b2d('0x26')](function(_0x3e2825){return _0x3e2825;});}return null;};}function removeEntity(_0x3934ec,_0x319752){return function(_0x34ecda){if(_0x34ecda){return _0x34ecda[_0x0b2d('0x27')]()['then'](function(){_0x3934ec[_0x0b2d('0x1b')](0xcc)[_0x0b2d('0x1c')]();});}};}function handleEntityNotFound(_0xe8d445,_0x5c218c){return function(_0x2e6a5e){if(!_0x2e6a5e){_0xe8d445['sendStatus'](0x194);}return _0x2e6a5e;};}function handleError(_0x16a46d,_0x3d99aa){_0x3d99aa=_0x3d99aa||0x1f4;return function(_0x4191af){logger[_0x0b2d('0x28')](_0x4191af[_0x0b2d('0x29')]);if(_0x4191af['name']){delete _0x4191af[_0x0b2d('0x2a')];}_0x16a46d[_0x0b2d('0x1b')](_0x3d99aa)[_0x0b2d('0x2b')](_0x4191af);};}function getInteractionUsers(_0x206298,_0x196856){return new BPromise(function(_0x5f0172,_0x5685b8){try{if(_0x196856[_0x206298['id']]){_0x206298[_0x0b2d('0x2c')]=_[_0x0b2d('0x2d')](_0x196856[_0x206298['id']],function(_0x50fed4){return{'id':_0x50fed4['id'],'fullname':_0x50fed4['fullname']};});}}catch(_0x4d6633){_0x5685b8(_0x4d6633);}_0x5f0172(_0x206298);});}function getInteractionTags(_0x404541,_0x2d7d03){return new BPromise(function(_0x10f68f,_0x539c8c){try{if(_0x404541[_0x0b2d('0x2e')]){_0x404541[_0x0b2d('0x2f')]=[];_0x404541[_0x0b2d('0x2e')][_0x0b2d('0x30')](',')[_0x0b2d('0x31')](function(_0x3174d8){_0x404541[_0x0b2d('0x2f')]['push'](_0x2d7d03[_0x3174d8]);});}delete _0x404541[_0x0b2d('0x2e')];}catch(_0x201083){_0x539c8c(_0x201083);}_0x10f68f(_0x404541);});}function updateWhatsappInteraction(_0x4839cd,_0x4dece3,_0x4e2917){return new BPromise(function(_0x317324,_0x5dfb2a){return getInteractionUsers(_0x4839cd,_0x4e2917)[_0x0b2d('0x26')](function(_0x308965){return getInteractionTags(_0x308965,_0x4dece3);})[_0x0b2d('0x26')](function(_0x3711e9){_0x317324(_0x3711e9);})[_0x0b2d('0x32')](function(_0x175de6){_0x5dfb2a(_0x175de6);});});}exports[_0x0b2d('0x33')]=function(_0x1e7d22,_0x539d1d){var _0x40c12c={},_0x4e1719={},_0x20b108={'count':0x0,'rows':[]};var _0xe41499=_[_0x0b2d('0x2d')](db[_0x0b2d('0x34')][_0x0b2d('0x35')],function(_0x43fc16){return{'name':_0x43fc16[_0x0b2d('0x36')],'type':_0x43fc16[_0x0b2d('0x37')][_0x0b2d('0x38')]};});_0x4e1719[_0x0b2d('0x39')]=_['map'](_0xe41499,_0x0b2d('0x2a'));_0x4e1719['query']=_[_0x0b2d('0x3a')](_0x1e7d22[_0x0b2d('0x3b')]);_0x4e1719[_0x0b2d('0x3c')]=_['intersection'](_0x4e1719[_0x0b2d('0x39')],_0x4e1719['query']);_0x40c12c['attributes']=_['intersection'](_0x4e1719[_0x0b2d('0x39')],qs[_0x0b2d('0x3d')](_0x1e7d22['query']['fields']));_0x40c12c['attributes']=_0x40c12c[_0x0b2d('0x3e')]['length']?_0x40c12c['attributes']:_0x4e1719['model'];if(!_0x1e7d22['query']['hasOwnProperty'](_0x0b2d('0x3f'))){_0x40c12c['limit']=qs['limit'](_0x1e7d22[_0x0b2d('0x3b')][_0x0b2d('0x1f')]);_0x40c12c['offset']=qs[_0x0b2d('0x1e')](_0x1e7d22[_0x0b2d('0x3b')][_0x0b2d('0x1e')]);}_0x40c12c[_0x0b2d('0x40')]=qs[_0x0b2d('0x41')](_0x1e7d22[_0x0b2d('0x3b')][_0x0b2d('0x41')]);_0x40c12c[_0x0b2d('0x42')]=qs[_0x0b2d('0x3c')](_[_0x0b2d('0x43')](_0x1e7d22[_0x0b2d('0x3b')],_0x4e1719['filters']),_0xe41499);var _0x59add9=[];var _0x512440=squel[_0x0b2d('0x44')]()[_0x0b2d('0x45')]('id')[_0x0b2d('0x45')]('name')[_0x0b2d('0x45')]('color')[_0x0b2d('0x46')]('tools_tags');var _0x361b4f=squel[_0x0b2d('0x44')]()[_0x0b2d('0x45')](_0x0b2d('0x47'))['field']('u.fullname')[_0x0b2d('0x45')](_0x0b2d('0x48'))[_0x0b2d('0x46')]('user_has_whatsapp_interactions','ui')[_0x0b2d('0x49')]('users','u',_0x0b2d('0x4a'));var _0x40a719=squel[_0x0b2d('0x44')]()[_0x0b2d('0x46')](_0x0b2d('0x4b'),'i')[_0x0b2d('0x49')](_0x0b2d('0x4c'),'c',_0x0b2d('0x4d'))['left_join'](_0x0b2d('0x4e'),'o',_0x0b2d('0x4f'))['left_join'](_0x0b2d('0x50'),'a',_0x0b2d('0x51'))[_0x0b2d('0x49')](_0x0b2d('0x52'),'me',_0x0b2d('0x53'))[_0x0b2d('0x49')]('whatsapp_interaction_has_tags','it',_0x0b2d('0x54'))[_0x0b2d('0x49')]('tools_tags','t',_0x0b2d('0x55'));var _0x28a6f1=squel['expr']();var _0x5b7175=[];var _0x15cdaf=squel[_0x0b2d('0x56')]();var _0x1239f2;if(_0x1e7d22[_0x0b2d('0x3b')][_0x0b2d('0x57')]){_0x1239f2=as[_0x0b2d('0x58')](_0x1e7d22[_0x0b2d('0x3b')][_0x0b2d('0x57')]);var _0x2faeeb=_0x1239f2[_0x0b2d('0x59')];for(var _0x4fddcc=0x0;_0x4fddcc<_0x1239f2['conditions'][_0x0b2d('0x5a')];_0x4fddcc++){var _0x503697=_0x1239f2[_0x0b2d('0x5b')][_0x4fddcc];var _0x172864='i';var _0x59c115=_['find'](_0xe41499,['name',_0x503697[_0x0b2d('0x45')]]);if(!_0x59c115){switch(_0x503697[_0x0b2d('0x45')]){case _0x0b2d('0x5c'):if(_0x503697[_0x0b2d('0x5d')]==0x1){_0x40a719['having']('`'+_0x503697[_0x0b2d('0x45')]+'`\x20=\x200');}else{_0x40a719[_0x0b2d('0x5e')]('`'+_0x503697[_0x0b2d('0x45')]+_0x0b2d('0x5f'));}break;case _0x0b2d('0x60'):if(_0x503697[_0x0b2d('0x61')]===_0x0b2d('0x62')){if(_0x503697[_0x0b2d('0x5d')][_0x0b2d('0x30')]('\x20')[_0x0b2d('0x5a')]>0x1){_0x28a6f1[_0x2faeeb](_0x0b2d('0x63'),qs[_0x0b2d('0x64')](_0x503697['value']),null);}else{var _0x338c25='%'+_0x503697[_0x0b2d('0x5d')]+'%';_0x28a6f1[_0x2faeeb](_0x0b2d('0x65'),_0x338c25,_0x338c25,_0x338c25);}}else{_0x59c115=_[_0x0b2d('0x66')](_0xe41499,['name',_0x0b2d('0x67')]);_0x503697[_0x0b2d('0x45')]=_0x0b2d('0x67');_0x4aa950=as[_0x0b2d('0x68')](_0x172864,_0x59c115[_0x0b2d('0x37')],_0x503697);_0x28a6f1[_0x2faeeb](_0x4aa950[_0x0b2d('0x69')],_0x4aa950[_0x0b2d('0x5d')][_0x0b2d('0x6a')],_0x4aa950[_0x0b2d('0x5d')]['end']);}break;case'Tag':var _0x2d5a09=_0x503697[_0x0b2d('0x5d')]['split'](',')['map'](function(_0x1a05d0){return Number(_0x1a05d0);});_0x2d5a09[_0x0b2d('0x31')](function(_0x58edfa){_0x15cdaf['or'](_0x0b2d('0x6b'),'%,'+_0x58edfa+',%');});_0x5b7175=_[_0x0b2d('0x6c')](_0x5b7175,_0x2d5a09);break;case'User':if(_0x503697['operator']==='$substring'){_0x28a6f1[_0x2faeeb]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x503697[_0x0b2d('0x5d')]+'%',null);}else{_0x59c115=_[_0x0b2d('0x66')](_0xe41499,[_0x0b2d('0x2a'),_0x0b2d('0x6d')]);_0x503697[_0x0b2d('0x45')]=_0x0b2d('0x6d');_0x4aa950=as[_0x0b2d('0x68')](_0x172864,_0x59c115['type'],_0x503697);_0x28a6f1[_0x2faeeb](_0x4aa950[_0x0b2d('0x69')],_0x4aa950[_0x0b2d('0x5d')][_0x0b2d('0x6a')],_0x4aa950[_0x0b2d('0x5d')]['end']);}break;case _0x0b2d('0x6e'):_0x4aa950=as[_0x0b2d('0x68')]('me',null,_0x503697);_0x28a6f1[_0x2faeeb](_0x4aa950[_0x0b2d('0x69')],_0x4aa950[_0x0b2d('0x5d')][_0x0b2d('0x6a')],_0x4aa950[_0x0b2d('0x5d')]['end']);break;}}else{var _0x4aa950=as['buildExpression'](_0x172864,_0x59c115[_0x0b2d('0x37')],_0x503697);_0x28a6f1[_0x2faeeb](_0x4aa950[_0x0b2d('0x69')],_0x4aa950['value'][_0x0b2d('0x6a')],_0x4aa950['value'][_0x0b2d('0x1c')]);}}}else{var _0x17200f=_(_0x1e7d22[_0x0b2d('0x3b')])[_0x0b2d('0x3a')]()[_0x0b2d('0x2d')](function(_0x35e73a){return _['some'](_0xe41499,[_0x0b2d('0x2a'),_0x35e73a])?_0x35e73a:undefined;})[_0x0b2d('0x6f')]()[_0x0b2d('0x5d')]();if(!_[_0x0b2d('0x70')](_0x17200f)){_0x17200f[_0x0b2d('0x31')](function(_0x2c7046){if(_0x2c7046===_0x0b2d('0x71')){_0x40a719[_0x0b2d('0x42')](_0x0b2d('0x72'),[][_0x0b2d('0x73')](_0x1e7d22[_0x0b2d('0x3b')][_0x2c7046]));}else if(_0x2c7046==='createdAt'){var _0x443c84=JSON[_0x0b2d('0x74')](_0x1e7d22['query'][_0x2c7046])[_0x0b2d('0x75')];var _0x4821d2=JSON[_0x0b2d('0x74')](_0x1e7d22[_0x0b2d('0x3b')][_0x2c7046])['$lte'];_0x40a719['where'](_0x0b2d('0x76'),_0x443c84,_0x4821d2);}else{if(_0x1e7d22[_0x0b2d('0x3b')][_0x2c7046]==='null'){_0x40a719[_0x0b2d('0x42')]('i.'+_0x2c7046+'\x20IS\x20NULL');}else{_0x40a719[_0x0b2d('0x42')]('i.'+_0x2c7046+_0x0b2d('0x77'),_0x1e7d22[_0x0b2d('0x3b')][_0x2c7046]);}}});}if(_0x1e7d22[_0x0b2d('0x3b')]['read']){if(_0x1e7d22[_0x0b2d('0x3b')][_0x0b2d('0x78')]==0x1){_0x40a719[_0x0b2d('0x5e')](_0x0b2d('0x79'));}else{_0x40a719['having'](_0x0b2d('0x7a'));}}if(_0x1e7d22['query']['tag']){_0x5b7175=_['isArray'](_0x1e7d22[_0x0b2d('0x3b')][_0x0b2d('0x7b')])?_0x1e7d22[_0x0b2d('0x3b')][_0x0b2d('0x7b')]:new Array(_0x1e7d22[_0x0b2d('0x3b')][_0x0b2d('0x7b')]);_0x5b7175[_0x0b2d('0x31')](function(_0x1d588b){_0x15cdaf['or'](_0x0b2d('0x6b'),'%,'+_0x1d588b+',%');});}if(_0x1e7d22[_0x0b2d('0x3b')][_0x0b2d('0x7c')]){var _0x44cb14=_0x1e7d22[_0x0b2d('0x3b')]['filter'][_0x0b2d('0x7d')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0b2d('0x7e'));if(qs['isNumeric'](_0x44cb14)){_0x28a6f1['or'](_0x0b2d('0x7f'),_0x44cb14+'%')['or'](_0x0b2d('0x80'),_0x44cb14+'%');}else{_0x28a6f1['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0b2d('0x64')](_0x44cb14))['or'](_0x0b2d('0x81'),_0x44cb14+'%');}}}_0x40a719[_0x0b2d('0x42')](_0x28a6f1);_0x40a719[_0x0b2d('0x82')](_0x0b2d('0x83'));var _0x130894={'type':db[_0x0b2d('0x84')][_0x0b2d('0x85')][_0x0b2d('0x86')],'raw':!![]};var _0x393294=_0x40a719[_0x0b2d('0x87')]();_0x393294[_0x0b2d('0x45')](_0x0b2d('0x83'));_0x393294[_0x0b2d('0x45')](_0x0b2d('0x88'),'unreadMessages');if(_0x40c12c[_0x0b2d('0x40')]){_0x40c12c[_0x0b2d('0x40')]['forEach'](function(_0x50f4c6){_0x40a719[_0x0b2d('0x40')]('i.'+_0x50f4c6[0x0],_0x50f4c6[0x1]===_0x0b2d('0x89')?![]:!![]);});}if(!_['isEmpty'](_0x5b7175)){_0x40a719[_0x0b2d('0x5e')](_0x15cdaf);_0x393294[_0x0b2d('0x42')](_0x0b2d('0x8a'),_0x5b7175);}BPromise[_0x0b2d('0x8b')]()[_0x0b2d('0x26')](function(){if(!_0x1239f2){if(_0x1e7d22['query'][_0x0b2d('0x71')]||_0x1e7d22['query'][_0x0b2d('0x8c')])return;_0x393294[_0x0b2d('0x42')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x40a719[_0x0b2d('0x42')](_0x0b2d('0x8d'));return;}return _0x1e7d22[_0x0b2d('0x8e')][_0x0b2d('0x8f')]({'attributes':['id'],'raw':!![]})[_0x0b2d('0x26')](function(_0x37d8ad){if(_[_0x0b2d('0x70')](_0x37d8ad)){_0x393294[_0x0b2d('0x42')]('i.WhatsappAccountId\x20IS\x20NULL');_0x40a719[_0x0b2d('0x42')](_0x0b2d('0x90'));}else{_0x393294[_0x0b2d('0x42')](_0x0b2d('0x72'),_['map'](_0x37d8ad,'id'));_0x40a719['where'](_0x0b2d('0x72'),_['map'](_0x37d8ad,'id'));}});})['then'](function(){db['sequelize'][_0x0b2d('0x3b')](_0x393294[_0x0b2d('0x91')](),_0x130894)[_0x0b2d('0x26')](function(_0x1a8673){_0x20b108[_0x0b2d('0x92')]=_0x1a8673[_0x0b2d('0x5a')];if(_0x20b108[_0x0b2d('0x92')]===0x0)return[];return db[_0x0b2d('0x93')][_0x0b2d('0x3b')](_0x512440[_0x0b2d('0x91')](),_0x130894)['then'](function(_0x7d6b6b){_0x59add9=_[_0x0b2d('0x94')](_0x7d6b6b,'id');_0x130894=_[_0x0b2d('0x95')](_0x130894,{'model':db[_0x0b2d('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1e7d22[_0x0b2d('0x3b')][_0x0b2d('0x3d')]){_0x40c12c[_0x0b2d('0x3e')][_0x0b2d('0x31')](function(_0xe8fd54){_0x40a719['field']('i.'+_0xe8fd54);});}else{_0x40a719[_0x0b2d('0x45')](_0x0b2d('0x88'),_0x0b2d('0x5c'));_0x40a719['field'](_0x0b2d('0x96'),'Account.key');_0x40a719[_0x0b2d('0x45')]('a.mandatoryDisposition',_0x0b2d('0x97'));_0x40a719[_0x0b2d('0x45')](_0x0b2d('0x98'));_0x40a719[_0x0b2d('0x45')](_0x0b2d('0x99'),_0x0b2d('0x9a'));_0x40a719[_0x0b2d('0x45')](_0x0b2d('0x9b'),'Contact.lastName');_0x40a719[_0x0b2d('0x45')](_0x0b2d('0x9c'),_0x0b2d('0x9d'));_0x40a719[_0x0b2d('0x45')](_0x0b2d('0x9e'),_0x0b2d('0x9f'));_0x40a719['field'](_0x0b2d('0xa0'),_0x0b2d('0xa1'));_0x40a719[_0x0b2d('0x45')]('c.fax',_0x0b2d('0xa2'));_0x40a719[_0x0b2d('0x45')](_0x0b2d('0xa3'),'Owner.fullname');_0x40a719[_0x0b2d('0x45')](_0x0b2d('0xa4'),_0x0b2d('0xa5'));_0x40a719[_0x0b2d('0x45')](_0x0b2d('0xa6'),_0x0b2d('0x2e'));}if(_0x40c12c[_0x0b2d('0x1f')])_0x40a719['limit'](_0x40c12c[_0x0b2d('0x1f')]);if(_0x40c12c['offset'])_0x40a719[_0x0b2d('0x1e')](_0x40c12c['offset']);return db['sequelize'][_0x0b2d('0x3b')](_0x40a719['toString'](),_0x130894);})['then'](function(_0x1e6a0b){_0x361b4f[_0x0b2d('0x42')](_0x0b2d('0xa7'),_[_0x0b2d('0x2d')](_0x1e6a0b,'id'));return db['sequelize']['query'](_0x361b4f['toString'](),_0x130894)['then'](function(_0x31010f){var _0x6a1bba=_[_0x0b2d('0xa8')](_0x31010f,_0x0b2d('0xa9'));var _0x477681=[];_0x1e6a0b[_0x0b2d('0x31')](function(_0x3b8389){_0x477681[_0x0b2d('0xaa')](updateWhatsappInteraction(_0x3b8389,_0x59add9,_0x6a1bba));});return BPromise[_0x0b2d('0xab')](_0x477681);});});})[_0x0b2d('0x26')](function(_0x49e1ba){_0x20b108[_0x0b2d('0xac')]=_0x49e1ba;return _0x20b108;})[_0x0b2d('0x26')](respondWithFilteredResult(_0x539d1d,_0x40c12c));})['catch'](handleError(_0x539d1d,null));};exports[_0x0b2d('0xad')]=function(_0x43f741,_0x2b25cf){var _0x587906={'raw':![],'where':{'id':_0x43f741[_0x0b2d('0xae')]['id']}},_0x1263da={};_0x1263da[_0x0b2d('0x39')]=_[_0x0b2d('0x3a')](db[_0x0b2d('0x34')][_0x0b2d('0x35')]);_0x1263da[_0x0b2d('0x3b')]=_[_0x0b2d('0x3a')](_0x43f741['query']);_0x1263da[_0x0b2d('0xaf')]=_['intersection'](_0x1263da[_0x0b2d('0x39')],_0x1263da['query']);_0x587906['attributes']=_[_0x0b2d('0xb0')](_0x1263da[_0x0b2d('0x39')],qs[_0x0b2d('0x3d')](_0x43f741[_0x0b2d('0x3b')][_0x0b2d('0x3d')]));_0x587906[_0x0b2d('0x3e')]=_0x587906[_0x0b2d('0x3e')]['length']?_0x587906[_0x0b2d('0x3e')]:_0x1263da['model'];if(_0x43f741['query'][_0x0b2d('0xb1')]){_0x587906[_0x0b2d('0xb2')]=[{'all':!![]}];}_0x587906=_['merge']({},_0x587906,_0x43f741[_0x0b2d('0xb3')]);return db['WhatsappInteraction'][_0x0b2d('0x66')](_0x587906)[_0x0b2d('0x26')](handleEntityNotFound(_0x2b25cf,null))['then'](respondWithResult(_0x2b25cf,null))[_0x0b2d('0x32')](handleError(_0x2b25cf,null));};exports[_0x0b2d('0xb4')]=function(_0x4b71d7,_0x3f44e4){return db[_0x0b2d('0x34')][_0x0b2d('0xb4')](_0x4b71d7[_0x0b2d('0x6e')],{})[_0x0b2d('0x26')](respondWithResult(_0x3f44e4,0xc9))['catch'](handleError(_0x3f44e4,null));};exports[_0x0b2d('0x25')]=function(_0x3b73ea,_0x41f797){if(_0x3b73ea['body']['id']){delete _0x3b73ea['body']['id'];}return db[_0x0b2d('0x34')][_0x0b2d('0x66')]({'where':{'id':_0x3b73ea[_0x0b2d('0xae')]['id']}})[_0x0b2d('0x26')](handleEntityNotFound(_0x41f797,null))[_0x0b2d('0x26')](saveUpdates(_0x3b73ea['body'],null))[_0x0b2d('0x26')](respondWithResult(_0x41f797,null))[_0x0b2d('0x32')](handleError(_0x41f797,null));};exports['destroy']=function(_0x299599,_0x516d95){return db[_0x0b2d('0x34')][_0x0b2d('0x66')]({'where':{'id':_0x299599['params']['id']}})[_0x0b2d('0x26')](handleEntityNotFound(_0x516d95,null))['then'](removeEntity(_0x516d95,null))[_0x0b2d('0x32')](handleError(_0x516d95,null));};exports[_0x0b2d('0xb5')]=function(_0x4a43ac,_0x33250a){return db['WhatsappInteraction'][_0x0b2d('0xb5')]()[_0x0b2d('0x26')](respondWithResult(_0x33250a,null))[_0x0b2d('0x32')](handleError(_0x33250a,null));};exports[_0x0b2d('0xb6')]=function(_0x36c30e,_0x5bd3c0,_0x2ffb79){return db['WhatsappMessage']['find']({'where':{'id':_0x36c30e[_0x0b2d('0xae')]['id']}})[_0x0b2d('0x26')](handleEntityNotFound(_0x5bd3c0,null))[_0x0b2d('0x26')](function(_0xd83212){if(_0xd83212){return _0xd83212[_0x0b2d('0xb6')](_0x36c30e['body']['ids'],_['omit'](_0x36c30e[_0x0b2d('0x6e')],[_0x0b2d('0xb7'),'id'])||{});}})[_0x0b2d('0x26')](respondWithResult(_0x5bd3c0,null))[_0x0b2d('0x32')](handleError(_0x5bd3c0,null));};exports[_0x0b2d('0xb8')]=function(_0x129b48,_0x54dc82,_0x5b8464){var _0x5c5ba4={'raw':![],'where':{}};var _0x40df75={};var _0x46fdb1={'count':0x0,'rows':[]};return db[_0x0b2d('0x34')][_0x0b2d('0xb9')]({'where':{'id':_0x129b48[_0x0b2d('0xae')]['id']}})[_0x0b2d('0x26')](handleEntityNotFound(_0x54dc82,null))[_0x0b2d('0x26')](function(_0x5440f4){if(_0x5440f4){_0x40df75['model']=_[_0x0b2d('0x3a')](db['WhatsappMessage']['rawAttributes']);_0x40df75[_0x0b2d('0x3b')]=_['keys'](_0x129b48[_0x0b2d('0x3b')]);_0x40df75['filters']=_['intersection'](_0x40df75[_0x0b2d('0x39')],_0x40df75[_0x0b2d('0x3b')]);_0x5c5ba4['attributes']=_[_0x0b2d('0xb0')](_0x40df75[_0x0b2d('0x39')],qs['fields'](_0x129b48[_0x0b2d('0x3b')][_0x0b2d('0x3d')]));_0x5c5ba4[_0x0b2d('0x3e')]=_0x5c5ba4[_0x0b2d('0x3e')][_0x0b2d('0x5a')]?_0x5c5ba4[_0x0b2d('0x3e')]:_0x40df75[_0x0b2d('0x39')];if(!_0x129b48[_0x0b2d('0x3b')][_0x0b2d('0xba')](_0x0b2d('0x3f'))){_0x5c5ba4[_0x0b2d('0x1f')]=qs[_0x0b2d('0x1f')](_0x129b48['query'][_0x0b2d('0x1f')]);_0x5c5ba4['offset']=qs['offset'](_0x129b48[_0x0b2d('0x3b')]['offset']);}_0x5c5ba4[_0x0b2d('0x40')]=qs[_0x0b2d('0x41')](_0x129b48[_0x0b2d('0x3b')][_0x0b2d('0x41')]);_0x5c5ba4[_0x0b2d('0x42')]=qs[_0x0b2d('0x3c')](_[_0x0b2d('0x43')](_0x129b48['query'],_0x40df75[_0x0b2d('0x3c')]));_0x5c5ba4[_0x0b2d('0x42')][_0x0b2d('0xa9')]=_0x5440f4['id'];if(_0x129b48[_0x0b2d('0x3b')][_0x0b2d('0x7c')]){_0x5c5ba4[_0x0b2d('0x42')]=_[_0x0b2d('0x95')](_0x5c5ba4['where'],{'$or':_['map'](_0x5c5ba4[_0x0b2d('0x3e')],function(_0x6fedfa){var _0x1ac98c={};_0x1ac98c[_0x6fedfa]={'$like':'%'+_0x129b48[_0x0b2d('0x3b')]['filter']+'%'};return _0x1ac98c;})});}if(_0x129b48[_0x0b2d('0x3b')]['$gte']){var _0x1495b0=_0x129b48['query'][_0x0b2d('0x75')][_0x0b2d('0x30')](',');var _0x337317={};_0x337317[_0x1495b0[0x0]]={'$gte':moment(_0x1495b0[0x1])[_0x0b2d('0xbb')](_0x0b2d('0xbc'))};_0x5c5ba4['where']=_[_0x0b2d('0x95')](_0x5c5ba4[_0x0b2d('0x42')],_0x337317);}_0x5c5ba4=_[_0x0b2d('0x95')]({},_0x5c5ba4,_0x129b48[_0x0b2d('0xb3')]);return db[_0x0b2d('0xbd')][_0x0b2d('0x92')]({'where':_0x5c5ba4[_0x0b2d('0x42')]})['then'](function(_0x500355){_0x46fdb1['count']=_0x500355;if(_0x129b48[_0x0b2d('0x3b')][_0x0b2d('0xb1')]){_0x5c5ba4['include']=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x5c5ba4);})['then'](function(_0x32375b){_0x46fdb1['rows']=_0x32375b;return _0x46fdb1;});}})['then'](respondWithFilteredResult(_0x54dc82,_0x5c5ba4))[_0x0b2d('0x32')](handleError(_0x54dc82,null));};exports[_0x0b2d('0xbe')]=function(_0x4398b0,_0x10c13a,_0x5075d1){return db[_0x0b2d('0x34')][_0x0b2d('0x66')]({'where':{'id':_0x4398b0[_0x0b2d('0xae')]['id']}})[_0x0b2d('0x26')](handleEntityNotFound(_0x10c13a,null))[_0x0b2d('0x26')](function(_0x4a3395){if(_0x4a3395){return _0x4a3395[_0x0b2d('0xbf')](_0x4398b0[_0x0b2d('0x6e')]['ids'],_[_0x0b2d('0xc0')](_0x4398b0['body'],[_0x0b2d('0xb7'),'id'])||{})[_0x0b2d('0xc1')](function(){return db[_0x0b2d('0xc2')][_0x0b2d('0xc3')]({'attributes':['id','name',_0x0b2d('0xc4')],'where':{'id':_0x4398b0['body'][_0x0b2d('0xb7')]}});})[_0x0b2d('0x26')](function(_0x2bc755){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x4398b0[_0x0b2d('0xae')]['id']),'tags':_0x2bc755||[]});return{'id':Number(_0x4398b0[_0x0b2d('0xae')]['id']),'tags':_0x2bc755||[]};});}})[_0x0b2d('0x26')](respondWithResult(_0x10c13a,null))[_0x0b2d('0x32')](handleError(_0x10c13a,null));};exports['removeTags']=function(_0x1c6f74,_0x5705f2,_0x1b057d){return db[_0x0b2d('0x34')][_0x0b2d('0x66')]({'where':{'id':_0x1c6f74[_0x0b2d('0xae')]['id']}})[_0x0b2d('0x26')](handleEntityNotFound(_0x5705f2,null))[_0x0b2d('0x26')](function(_0xfcc629){if(_0xfcc629){return _0xfcc629[_0x0b2d('0xc5')](_0x1c6f74[_0x0b2d('0x3b')][_0x0b2d('0xb7')]);}})[_0x0b2d('0x26')](respondWithStatusCode(_0x5705f2,null))[_0x0b2d('0x32')](handleError(_0x5705f2,null));};exports[_0x0b2d('0xc6')]=function(_0x45c565,_0x4ce7f0){var _0x290030=moment()[_0x0b2d('0xc7')]()[_0x0b2d('0x91')]();var _0xcbaffd=path[_0x0b2d('0xc8')](config['root'],_0x0b2d('0xc9'),'files',_0x0b2d('0xca'));var _0x2284ac=path[_0x0b2d('0xc8')](config[_0x0b2d('0xcb')],_0x0b2d('0xc9'),_0x0b2d('0xcc'),'attachments');var _0x295047=path[_0x0b2d('0xc8')](_0xcbaffd,_0x290030);var _0x2518f5=util[_0x0b2d('0xbb')](_0x0b2d('0xcd'),_0x45c565[_0x0b2d('0xae')]['id'],_0x290030);var _0x10b535=path[_0x0b2d('0xc8')](_0xcbaffd,_0x2518f5);var _0x525794=[];_0x525794['push']({'model':db[_0x0b2d('0xce')],'as':_0x0b2d('0xce'),'attributes':['id',_0x0b2d('0xcf')],'raw':!![]});_0x525794[_0x0b2d('0xaa')]({'model':db[_0x0b2d('0xd0')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x45c565[_0x0b2d('0x3b')][_0x0b2d('0xd1')]){_0x525794[_0x0b2d('0xaa')]({'model':db[_0x0b2d('0xd2')],'as':'Attachment','raw':!![]});}var _0x509ad8=[{'model':db[_0x0b2d('0xbd')],'as':_0x0b2d('0xd3'),'attributes':['id','body',_0x0b2d('0xd4'),_0x0b2d('0xd5'),_0x0b2d('0xd6'),'read'],'include':_0x525794}];_0x509ad8['push']({'model':db['WhatsappAccount'],'as':_0x0b2d('0xd7'),'attributes':['id',_0x0b2d('0x2a')]});_0x509ad8[_0x0b2d('0xaa')]({'model':db[_0x0b2d('0xce')],'as':_0x0b2d('0xd8'),'attributes':['id','fullname']});return db['WhatsappInteraction'][_0x0b2d('0x66')]({'where':{'id':_0x45c565['params']['id']},'include':_0x509ad8})[_0x0b2d('0x26')](handleEntityNotFound(_0x4ce7f0,null))['then'](function(_0x4ec235){if(_0x4ec235){var _0x32c91c=_0x4ec235[_0x0b2d('0xd9')]({'plain':!![]});fs[_0x0b2d('0xda')](_0x295047);var _0x561cb0={'format':'A4','border':_0x0b2d('0xdb'),'header':{'height':_0x0b2d('0xdc'),'contents':{'first':_0x0b2d('0xdd')}},'footer':{'height':_0x0b2d('0xde'),'contents':{'default':util[_0x0b2d('0xbb')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x0b2d('0xbb')](_0x0b2d('0xdf'),'Whatsapp',_0x32c91c['id']),moment()[_0x0b2d('0xbb')]('YYYY-MM-DD')['toString']())}}};var _0x3e5741={'channel':_0x0b2d('0xe0'),'account':_0x32c91c[_0x0b2d('0xd7')][_0x0b2d('0x2a')],'agent':_0x32c91c[_0x0b2d('0xd8')]?_0x32c91c[_0x0b2d('0xd8')]['fullname']:_0x0b2d('0xe1'),'createdAt':moment(_0x32c91c[_0x0b2d('0xd4')])[_0x0b2d('0xbb')](_0x0b2d('0xbc'))[_0x0b2d('0x91')](),'closedAt':_0x32c91c['closed']?moment(_0x32c91c['closedAt'])['format'](_0x0b2d('0xbc'))['toString']():'','disposition':_0x32c91c['disposition'],'messages':_(_0x32c91c[_0x0b2d('0xd3')])['filter']({'secret':![]})[_0x0b2d('0x2d')](function(_0x5569e8){if(_0x5569e8[_0x0b2d('0xd2')]){var _0x55c109=path[_0x0b2d('0xc8')](_0x2284ac,_0x5569e8[_0x0b2d('0xd2')][_0x0b2d('0xe2')]);if(fs[_0x0b2d('0xe3')](_0x55c109)){fs[_0x0b2d('0xe4')](_0x55c109)[_0x0b2d('0xe5')](fs[_0x0b2d('0xe6')](path['join'](_0x295047,_0x5569e8[_0x0b2d('0xd2')][_0x0b2d('0xe2')])));}}return{'date':moment(_0x5569e8[_0x0b2d('0xd4')])[_0x0b2d('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x5569e8['direction']===_0x0b2d('0xe7')?_0x5569e8[_0x0b2d('0xce')]?_0x5569e8[_0x0b2d('0xce')][_0x0b2d('0xcf')]:_0x0b2d('0xe8'):_0x5569e8[_0x0b2d('0x60')][_0x0b2d('0xe9')]+(_0x5569e8['Contact'][_0x0b2d('0xea')]?'\x20'+_0x5569e8['Contact'][_0x0b2d('0xea')]:''),'body':_0x5569e8[_0x0b2d('0xd2')]?_0x5569e8[_0x0b2d('0xd2')][_0x0b2d('0xe2')]:_0x5569e8['body'],'direction':_0x5569e8[_0x0b2d('0xd5')]===_0x0b2d('0xe7')?'A':'C','secret':_0x5569e8[_0x0b2d('0xd6')],'read':_0x5569e8[_0x0b2d('0x78')],'attachment':_0x5569e8['Attachment']};})[_0x0b2d('0x5d')]()};return ejs[_0x0b2d('0xeb')](path[_0x0b2d('0xc8')](config[_0x0b2d('0xcb')],_0x0b2d('0xc9'),_0x0b2d('0xec'),'downloadInteraction.html'),{'interaction':_0x3e5741})[_0x0b2d('0x26')](function(_0x112110){return new BPromise(function(_0x510c99,_0x18b53e){pdf[_0x0b2d('0xb4')](_0x112110,_0x561cb0)[_0x0b2d('0xed')](path[_0x0b2d('0xc8')](_0x295047,'transcript-'+_0x32c91c['id']+'-'+_0x290030+_0x0b2d('0xee')),function(_0x5adffa,_0x1c36df){if(_0x5adffa)return _0x18b53e(_0x5adffa);_0x510c99(_0x1c36df);});});})[_0x0b2d('0x26')](function(){return new BPromise(function(_0x5e483e,_0xc1e157){zipdir(_0x295047,{'saveTo':_0x10b535},function(_0xb4e491,_0x568fde){if(_0xb4e491)return _0xc1e157(_0xb4e491);return _0x5e483e(_0x568fde);});})[_0x0b2d('0x26')](function(){return new BPromise(function(_0x28ab7e,_0x429cd1){rimraf(_0x295047,function(_0xa84b0d){if(_0xa84b0d)_0x429cd1(_0xa84b0d);return _0x28ab7e();});});})[_0x0b2d('0x26')](function(){return _0x4ce7f0['download'](_0x10b535,_0x2518f5,function(_0xad808){if(_0xad808){console[_0x0b2d('0xef')]('err',_0xad808);}else{fs[_0x0b2d('0xf0')](_0x10b535);}});});});}else{return _0x4ce7f0[_0x0b2d('0x1a')](0xc8);}})[_0x0b2d('0x32')](handleError(_0x4ce7f0,null));}; \ No newline at end of file +var _0x4021=['name','send','Users','fullname','TagIds','Tags','forEach','push','catch','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','field','color','from','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','expr','parseSearch','search','sqlOperator','conditions','find','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','buildExpression','some','compact','WhatsappAccountId','where','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','`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?','i.id','Sequelize','QueryTypes','SELECT','unreadMessages','isEmpty','t.id\x20IN\x20?','resolve','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','toString','merge','WhatsappInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','params','includeAll','include','options','create','body','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','pick','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','removeTags','download','join','server','files','tmp','attachments','format','transcript-%d-%s.zip','firstName','lastName','Attachment','Messages','direction','WhatsappAccount','Account','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','N.A.','closed','closedAt','disposition','createReadStream','createWriteStream','basename','out','System','secret','read','renderFile','root','views','downloadInteraction.html','transcript-','log','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','json','count','offset','limit','set','reject','save','then','destroy','end','stack'];(function(_0x134192,_0x36adc5){var _0x3cd080=function(_0x134371){while(--_0x134371){_0x134192['push'](_0x134192['shift']());}};_0x3cd080(++_0x36adc5);}(_0x4021,0x1b2));var _0x1402=function(_0x49748c,_0x3d2005){_0x49748c=_0x49748c-0x0;var _0xedf6b6=_0x4021[_0x49748c];return _0xedf6b6;};'use strict';var pdf=require(_0x1402('0x0'));var emlformat=require(_0x1402('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1402('0x2'));var jsonpatch=require(_0x1402('0x3'));var rp=require(_0x1402('0x4'));var moment=require(_0x1402('0x5'));var BPromise=require(_0x1402('0x6'));var Mustache=require(_0x1402('0x7'));var util=require(_0x1402('0x8'));var path=require(_0x1402('0x9'));var sox=require('sox');var csv=require(_0x1402('0xa'));var ejs=require(_0x1402('0xb'));var fs=require('fs');var _=require(_0x1402('0xc'));var squel=require(_0x1402('0xd'));var crypto=require('crypto');var jsforce=require(_0x1402('0xe'));var deskjs=require(_0x1402('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1402('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1402('0x11'));var qs=require(_0x1402('0x12'));var as=require(_0x1402('0x13'));var hardwareService=require(_0x1402('0x14'));var logger=require(_0x1402('0x15'))(_0x1402('0x16'));var utils=require(_0x1402('0x17'));var config=require(_0x1402('0x18'));var licenseUtil=require(_0x1402('0x19'));var db=require(_0x1402('0x1a'))['db'];config['redis']=_[_0x1402('0x1b')](config[_0x1402('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x1402('0x1d'))(new Redis(config['redis']));require(_0x1402('0x1e'))['register'](socket);function respondWithStatusCode(_0x3cdf9c,_0x4351dc){_0x4351dc=_0x4351dc||0xcc;return function(_0x50897d){if(_0x50897d){return _0x3cdf9c[_0x1402('0x1f')](_0x4351dc);}return _0x3cdf9c[_0x1402('0x20')](_0x4351dc)['end']();};}function respondWithResult(_0x5c2c08,_0x3396f1){_0x3396f1=_0x3396f1||0xc8;return function(_0x2889d1){if(_0x2889d1){return _0x5c2c08[_0x1402('0x20')](_0x3396f1)[_0x1402('0x21')](_0x2889d1);}};}function respondWithFilteredResult(_0x25331c,_0x206838){return function(_0x172cfc){if(_0x172cfc){var _0x3217cb=_0x172cfc[_0x1402('0x22')],_0x510629=_0x206838['offset'],_0x48e149=_0x206838[_0x1402('0x23')]+_0x206838[_0x1402('0x24')],_0xa6d1ab;if(_0x48e149>=_0x3217cb){_0x48e149=_0x3217cb;_0xa6d1ab=0xc8;}else{_0xa6d1ab=0xce;}_0x25331c['status'](_0xa6d1ab);return _0x25331c[_0x1402('0x25')]('Content-Range',_0x510629+'-'+_0x48e149+'/'+_0x3217cb)['json'](_0x172cfc);}return null;};}function patchUpdates(_0x614178){return function(_0x1cdf8b){try{jsonpatch['apply'](_0x1cdf8b,_0x614178,!![]);}catch(_0x21798c){return BPromise[_0x1402('0x26')](_0x21798c);}return _0x1cdf8b[_0x1402('0x27')]();};}function saveUpdates(_0x2cded9,_0x3ff9bf){return function(_0x1024a4){if(_0x1024a4){return _0x1024a4['update'](_0x2cded9)[_0x1402('0x28')](function(_0xe78ab6){return _0xe78ab6;});}return null;};}function removeEntity(_0x71df76,_0x317a94){return function(_0x4f0993){if(_0x4f0993){return _0x4f0993[_0x1402('0x29')]()[_0x1402('0x28')](function(){_0x71df76['status'](0xcc)[_0x1402('0x2a')]();});}};}function handleEntityNotFound(_0x2eebff,_0x7d247d){return function(_0x4deb3c){if(!_0x4deb3c){_0x2eebff[_0x1402('0x1f')](0x194);}return _0x4deb3c;};}function handleError(_0x5665b4,_0x5534bd){_0x5534bd=_0x5534bd||0x1f4;return function(_0x1fffe0){logger['error'](_0x1fffe0[_0x1402('0x2b')]);if(_0x1fffe0[_0x1402('0x2c')]){delete _0x1fffe0['name'];}_0x5665b4['status'](_0x5534bd)[_0x1402('0x2d')](_0x1fffe0);};}function getInteractionUsers(_0x559df2,_0x1d1125){return new BPromise(function(_0x2f0446,_0x11b3d9){try{if(_0x1d1125[_0x559df2['id']]){_0x559df2[_0x1402('0x2e')]=_['map'](_0x1d1125[_0x559df2['id']],function(_0x56ac97){return{'id':_0x56ac97['id'],'fullname':_0x56ac97[_0x1402('0x2f')]};});}}catch(_0x34dad7){_0x11b3d9(_0x34dad7);}_0x2f0446(_0x559df2);});}function getInteractionTags(_0x58bef7,_0xd22d56){return new BPromise(function(_0x41ecef,_0x17cd0c){try{if(_0x58bef7[_0x1402('0x30')]){_0x58bef7[_0x1402('0x31')]=[];_0x58bef7[_0x1402('0x30')]['split'](',')[_0x1402('0x32')](function(_0x1ef2ab){_0x58bef7['Tags'][_0x1402('0x33')](_0xd22d56[_0x1ef2ab]);});}delete _0x58bef7[_0x1402('0x30')];}catch(_0x24aa75){_0x17cd0c(_0x24aa75);}_0x41ecef(_0x58bef7);});}function updateWhatsappInteraction(_0x1cc009,_0x7795a2,_0x472e45){return new BPromise(function(_0x3424ba,_0x56c407){return getInteractionUsers(_0x1cc009,_0x472e45)[_0x1402('0x28')](function(_0x2466e3){return getInteractionTags(_0x2466e3,_0x7795a2);})[_0x1402('0x28')](function(_0x190bb7){_0x3424ba(_0x190bb7);})[_0x1402('0x34')](function(_0x1d5fbd){_0x56c407(_0x1d5fbd);});});}exports[_0x1402('0x35')]=function(_0x3ad6c4,_0x5bdc0a){var _0x17bc26={},_0x10af5a={},_0xc5c2e2={'count':0x0,'rows':[]};var _0xb63667=_[_0x1402('0x36')](db['WhatsappInteraction'][_0x1402('0x37')],function(_0x5c88e8){return{'name':_0x5c88e8[_0x1402('0x38')],'type':_0x5c88e8[_0x1402('0x39')][_0x1402('0x3a')]};});_0x10af5a[_0x1402('0x3b')]=_['map'](_0xb63667,'name');_0x10af5a[_0x1402('0x3c')]=_[_0x1402('0x3d')](_0x3ad6c4[_0x1402('0x3c')]);_0x10af5a[_0x1402('0x3e')]=_['intersection'](_0x10af5a[_0x1402('0x3b')],_0x10af5a[_0x1402('0x3c')]);_0x17bc26[_0x1402('0x3f')]=_[_0x1402('0x40')](_0x10af5a[_0x1402('0x3b')],qs[_0x1402('0x41')](_0x3ad6c4[_0x1402('0x3c')]['fields']));_0x17bc26[_0x1402('0x3f')]=_0x17bc26['attributes'][_0x1402('0x42')]?_0x17bc26[_0x1402('0x3f')]:_0x10af5a[_0x1402('0x3b')];if(!_0x3ad6c4[_0x1402('0x3c')]['hasOwnProperty'](_0x1402('0x43'))){_0x17bc26[_0x1402('0x24')]=qs[_0x1402('0x24')](_0x3ad6c4['query'][_0x1402('0x24')]);_0x17bc26['offset']=qs[_0x1402('0x23')](_0x3ad6c4[_0x1402('0x3c')]['offset']);}_0x17bc26[_0x1402('0x44')]=qs[_0x1402('0x45')](_0x3ad6c4[_0x1402('0x3c')]['sort']);_0x17bc26['where']=qs['filters'](_['pick'](_0x3ad6c4['query'],_0x10af5a[_0x1402('0x3e')]),_0xb63667);var _0x4d2525=[];var _0x39287b=squel['select']()[_0x1402('0x46')]('id')['field'](_0x1402('0x2c'))['field'](_0x1402('0x47'))[_0x1402('0x48')](_0x1402('0x49'));var _0x22e944=squel[_0x1402('0x4a')]()[_0x1402('0x46')](_0x1402('0x4b'))[_0x1402('0x46')](_0x1402('0x4c'))['field'](_0x1402('0x4d'))[_0x1402('0x48')](_0x1402('0x4e'),'ui')[_0x1402('0x4f')](_0x1402('0x50'),'u','u.id\x20=\x20ui.UserId');var _0x4d270d=squel[_0x1402('0x4a')]()['from']('whatsapp_interactions','i')[_0x1402('0x4f')](_0x1402('0x51'),'c',_0x1402('0x52'))[_0x1402('0x4f')](_0x1402('0x50'),'o',_0x1402('0x53'))[_0x1402('0x4f')]('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')[_0x1402('0x4f')](_0x1402('0x54'),'me',_0x1402('0x55'))['left_join'](_0x1402('0x56'),'it',_0x1402('0x57'))[_0x1402('0x4f')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x1cc0ad=squel['expr']();var _0x35dcc8=[];var _0x403a2b=squel[_0x1402('0x58')]();var _0x26dea3;if(_0x3ad6c4[_0x1402('0x3c')]['search']){_0x26dea3=as[_0x1402('0x59')](_0x3ad6c4[_0x1402('0x3c')][_0x1402('0x5a')]);var _0x2eccc5=_0x26dea3[_0x1402('0x5b')];for(var _0x16dac6=0x0;_0x16dac6<_0x26dea3[_0x1402('0x5c')][_0x1402('0x42')];_0x16dac6++){var _0x75b177=_0x26dea3[_0x1402('0x5c')][_0x16dac6];var _0x422609='i';var _0x44cb70=_[_0x1402('0x5d')](_0xb63667,[_0x1402('0x2c'),_0x75b177[_0x1402('0x46')]]);if(!_0x44cb70){switch(_0x75b177[_0x1402('0x46')]){case'unreadMessages':if(_0x75b177[_0x1402('0x5e')]==0x1){_0x4d270d[_0x1402('0x5f')]('`'+_0x75b177['field']+_0x1402('0x60'));}else{_0x4d270d['having']('`'+_0x75b177[_0x1402('0x46')]+'`\x20>\x200');}break;case _0x1402('0x61'):if(_0x75b177[_0x1402('0x62')]===_0x1402('0x63')){if(_0x75b177[_0x1402('0x5e')]['split']('\x20')[_0x1402('0x42')]>0x1){_0x1cc0ad[_0x2eccc5](_0x1402('0x64'),qs['getFullTextValue'](_0x75b177[_0x1402('0x5e')]),null);}else{var _0x2c35aa='%'+_0x75b177[_0x1402('0x5e')]+'%';_0x1cc0ad[_0x2eccc5](_0x1402('0x65'),_0x2c35aa,_0x2c35aa,_0x2c35aa);}}else{_0x44cb70=_[_0x1402('0x5d')](_0xb63667,[_0x1402('0x2c'),_0x1402('0x66')]);_0x75b177[_0x1402('0x46')]=_0x1402('0x66');_0x5b2493=as['buildExpression'](_0x422609,_0x44cb70[_0x1402('0x39')],_0x75b177);_0x1cc0ad[_0x2eccc5](_0x5b2493[_0x1402('0x67')],_0x5b2493[_0x1402('0x5e')][_0x1402('0x68')],_0x5b2493['value'][_0x1402('0x2a')]);}break;case _0x1402('0x69'):var _0x13cbda=_0x75b177[_0x1402('0x5e')][_0x1402('0x6a')](',')['map'](function(_0x3670e7){return Number(_0x3670e7);});_0x13cbda[_0x1402('0x32')](function(_0x2b3c71){_0x403a2b['or'](_0x1402('0x6b'),'%,'+_0x2b3c71+',%');});_0x35dcc8=_[_0x1402('0x6c')](_0x35dcc8,_0x13cbda);break;case _0x1402('0x6d'):if(_0x75b177[_0x1402('0x62')]===_0x1402('0x63')){_0x1cc0ad[_0x2eccc5]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x75b177[_0x1402('0x5e')]+'%',null);}else{_0x44cb70=_['find'](_0xb63667,[_0x1402('0x2c'),_0x1402('0x6e')]);_0x75b177[_0x1402('0x46')]='UserId';_0x5b2493=as[_0x1402('0x6f')](_0x422609,_0x44cb70[_0x1402('0x39')],_0x75b177);_0x1cc0ad[_0x2eccc5](_0x5b2493[_0x1402('0x67')],_0x5b2493[_0x1402('0x5e')][_0x1402('0x68')],_0x5b2493[_0x1402('0x5e')][_0x1402('0x2a')]);}break;case'body':_0x5b2493=as['buildExpression']('me',null,_0x75b177);_0x1cc0ad[_0x2eccc5](_0x5b2493[_0x1402('0x67')],_0x5b2493[_0x1402('0x5e')][_0x1402('0x68')],_0x5b2493[_0x1402('0x5e')][_0x1402('0x2a')]);break;}}else{var _0x5b2493=as['buildExpression'](_0x422609,_0x44cb70['type'],_0x75b177);_0x1cc0ad[_0x2eccc5](_0x5b2493[_0x1402('0x67')],_0x5b2493[_0x1402('0x5e')]['start'],_0x5b2493[_0x1402('0x5e')][_0x1402('0x2a')]);}}}else{var _0x2949e8=_(_0x3ad6c4[_0x1402('0x3c')])[_0x1402('0x3d')]()[_0x1402('0x36')](function(_0x5ad1d1){return _[_0x1402('0x70')](_0xb63667,[_0x1402('0x2c'),_0x5ad1d1])?_0x5ad1d1:undefined;})[_0x1402('0x71')]()[_0x1402('0x5e')]();if(!_['isEmpty'](_0x2949e8)){_0x2949e8[_0x1402('0x32')](function(_0x2e4baa){if(_0x2e4baa===_0x1402('0x72')){_0x4d270d[_0x1402('0x73')]('i.WhatsappAccountId\x20IN\x20?',[][_0x1402('0x74')](_0x3ad6c4[_0x1402('0x3c')][_0x2e4baa]));}else if(_0x2e4baa===_0x1402('0x75')){var _0x4a7fe2=JSON[_0x1402('0x76')](_0x3ad6c4['query'][_0x2e4baa])[_0x1402('0x77')];var _0x995f48=JSON[_0x1402('0x76')](_0x3ad6c4[_0x1402('0x3c')][_0x2e4baa])['$lte'];_0x4d270d['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4a7fe2,_0x995f48);}else{if(_0x3ad6c4[_0x1402('0x3c')][_0x2e4baa]===_0x1402('0x78')){_0x4d270d[_0x1402('0x73')]('i.'+_0x2e4baa+_0x1402('0x79'));}else{_0x4d270d[_0x1402('0x73')]('i.'+_0x2e4baa+_0x1402('0x7a'),_0x3ad6c4[_0x1402('0x3c')][_0x2e4baa]);}}});}if(_0x3ad6c4[_0x1402('0x3c')]['read']){if(_0x3ad6c4[_0x1402('0x3c')]['read']==0x1){_0x4d270d['having']('`unreadMessages`\x20=\x200');}else{_0x4d270d[_0x1402('0x5f')](_0x1402('0x7b'));}}if(_0x3ad6c4[_0x1402('0x3c')][_0x1402('0x7c')]){_0x35dcc8=_[_0x1402('0x7d')](_0x3ad6c4[_0x1402('0x3c')][_0x1402('0x7c')])?_0x3ad6c4[_0x1402('0x3c')][_0x1402('0x7c')]:new Array(_0x3ad6c4['query'][_0x1402('0x7c')]);_0x35dcc8[_0x1402('0x32')](function(_0x138a7a){_0x403a2b['or'](_0x1402('0x6b'),'%,'+_0x138a7a+',%');});}if(_0x3ad6c4[_0x1402('0x3c')][_0x1402('0x7e')]){var _0xd73702=_0x3ad6c4[_0x1402('0x3c')][_0x1402('0x7e')][_0x1402('0x7f')]('\x5c','\x5c\x5c')[_0x1402('0x7f')]('\x27\x27',_0x1402('0x80'));if(qs[_0x1402('0x81')](_0xd73702)){_0x1cc0ad['or'](_0x1402('0x82'),_0xd73702+'%')['or']('i.phone\x20LIKE\x20?',_0xd73702+'%');}else{_0x1cc0ad['or'](_0x1402('0x83'),qs[_0x1402('0x84')](_0xd73702))['or'](_0x1402('0x85'),_0xd73702+'%');}}}_0x4d270d[_0x1402('0x73')](_0x1cc0ad);_0x4d270d['group'](_0x1402('0x86'));var _0xd41443={'type':db[_0x1402('0x87')][_0x1402('0x88')][_0x1402('0x89')],'raw':!![]};var _0x405b54=_0x4d270d['clone']();_0x405b54[_0x1402('0x46')]('i.id');_0x405b54[_0x1402('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1402('0x8a'));if(_0x17bc26[_0x1402('0x44')]){_0x17bc26[_0x1402('0x44')][_0x1402('0x32')](function(_0x4f11c0){_0x4d270d[_0x1402('0x44')]('i.'+_0x4f11c0[0x0],_0x4f11c0[0x1]==='DESC'?![]:!![]);});}if(!_[_0x1402('0x8b')](_0x35dcc8)){_0x4d270d[_0x1402('0x5f')](_0x403a2b);_0x405b54['where'](_0x1402('0x8c'),_0x35dcc8);}BPromise[_0x1402('0x8d')]()[_0x1402('0x28')](function(){if(!_0x26dea3){if(_0x3ad6c4[_0x1402('0x3c')][_0x1402('0x72')]||_0x3ad6c4[_0x1402('0x3c')][_0x1402('0x8e')])return;_0x405b54[_0x1402('0x73')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x4d270d[_0x1402('0x73')](_0x1402('0x8f'));return;}return _0x3ad6c4[_0x1402('0x90')][_0x1402('0x91')]({'attributes':['id'],'raw':!![]})[_0x1402('0x28')](function(_0x53cb74){if(_[_0x1402('0x8b')](_0x53cb74)){_0x405b54[_0x1402('0x73')](_0x1402('0x92'));_0x4d270d[_0x1402('0x73')](_0x1402('0x92'));}else{_0x405b54[_0x1402('0x73')](_0x1402('0x93'),_['map'](_0x53cb74,'id'));_0x4d270d[_0x1402('0x73')](_0x1402('0x93'),_['map'](_0x53cb74,'id'));}});})[_0x1402('0x28')](function(){db['sequelize'][_0x1402('0x3c')](_0x405b54[_0x1402('0x94')](),_0xd41443)[_0x1402('0x28')](function(_0x13f381){_0xc5c2e2[_0x1402('0x22')]=_0x13f381[_0x1402('0x42')];if(_0xc5c2e2['count']===0x0)return[];return db['sequelize'][_0x1402('0x3c')](_0x39287b['toString'](),_0xd41443)['then'](function(_0x2f2a6a){_0x4d2525=_['keyBy'](_0x2f2a6a,'id');_0xd41443=_[_0x1402('0x95')](_0xd41443,{'model':db[_0x1402('0x96')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3ad6c4[_0x1402('0x3c')]['fields']){_0x17bc26[_0x1402('0x3f')][_0x1402('0x32')](function(_0x15e6e1){_0x4d270d['field']('i.'+_0x15e6e1);});}else{_0x4d270d['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1402('0x8a'));_0x4d270d['field'](_0x1402('0x97'),_0x1402('0x98'));_0x4d270d['field'](_0x1402('0x99'),_0x1402('0x9a'));_0x4d270d[_0x1402('0x46')](_0x1402('0x9b'));_0x4d270d['field'](_0x1402('0x9c'),'Contact.firstName');_0x4d270d[_0x1402('0x46')](_0x1402('0x9d'),'Contact.lastName');_0x4d270d[_0x1402('0x46')](_0x1402('0x9e'),_0x1402('0x9f'));_0x4d270d[_0x1402('0x46')](_0x1402('0xa0'),_0x1402('0xa1'));_0x4d270d[_0x1402('0x46')](_0x1402('0xa2'),_0x1402('0xa3'));_0x4d270d[_0x1402('0x46')](_0x1402('0xa4'),_0x1402('0xa5'));_0x4d270d[_0x1402('0x46')]('o.fullname',_0x1402('0xa6'));_0x4d270d[_0x1402('0x46')](_0x1402('0xa7'),'Owner.internal');_0x4d270d[_0x1402('0x46')](_0x1402('0xa8'),'TagIds');}if(_0x17bc26[_0x1402('0x24')])_0x4d270d[_0x1402('0x24')](_0x17bc26['limit']);if(_0x17bc26[_0x1402('0x23')])_0x4d270d[_0x1402('0x23')](_0x17bc26[_0x1402('0x23')]);return db[_0x1402('0xa9')][_0x1402('0x3c')](_0x4d270d[_0x1402('0x94')](),_0xd41443);})[_0x1402('0x28')](function(_0x4b290b){_0x22e944['where'](_0x1402('0xaa'),_[_0x1402('0x36')](_0x4b290b,'id'));return db['sequelize'][_0x1402('0x3c')](_0x22e944['toString'](),_0xd41443)[_0x1402('0x28')](function(_0x72079a){var _0x28cc46=_[_0x1402('0xab')](_0x72079a,_0x1402('0xac'));var _0x34d50f=[];_0x4b290b[_0x1402('0x32')](function(_0x3c7cf7){_0x34d50f[_0x1402('0x33')](updateWhatsappInteraction(_0x3c7cf7,_0x4d2525,_0x28cc46));});return BPromise[_0x1402('0xad')](_0x34d50f);});});})[_0x1402('0x28')](function(_0x1d7aa9){_0xc5c2e2[_0x1402('0xae')]=_0x1d7aa9;return _0xc5c2e2;})['then'](respondWithFilteredResult(_0x5bdc0a,_0x17bc26));})[_0x1402('0x34')](handleError(_0x5bdc0a,null));};exports['show']=function(_0x709699,_0x51fdd1){var _0x2aa36c={'raw':![],'where':{'id':_0x709699[_0x1402('0xaf')]['id']}},_0x4f0d85={};_0x4f0d85[_0x1402('0x3b')]=_[_0x1402('0x3d')](db[_0x1402('0x96')][_0x1402('0x37')]);_0x4f0d85[_0x1402('0x3c')]=_[_0x1402('0x3d')](_0x709699[_0x1402('0x3c')]);_0x4f0d85['filtears']=_[_0x1402('0x40')](_0x4f0d85[_0x1402('0x3b')],_0x4f0d85[_0x1402('0x3c')]);_0x2aa36c[_0x1402('0x3f')]=_[_0x1402('0x40')](_0x4f0d85[_0x1402('0x3b')],qs['fields'](_0x709699[_0x1402('0x3c')][_0x1402('0x41')]));_0x2aa36c[_0x1402('0x3f')]=_0x2aa36c['attributes'][_0x1402('0x42')]?_0x2aa36c[_0x1402('0x3f')]:_0x4f0d85[_0x1402('0x3b')];if(_0x709699[_0x1402('0x3c')][_0x1402('0xb0')]){_0x2aa36c[_0x1402('0xb1')]=[{'all':!![]}];}_0x2aa36c=_[_0x1402('0x95')]({},_0x2aa36c,_0x709699[_0x1402('0xb2')]);return db[_0x1402('0x96')][_0x1402('0x5d')](_0x2aa36c)['then'](handleEntityNotFound(_0x51fdd1,null))[_0x1402('0x28')](respondWithResult(_0x51fdd1,null))[_0x1402('0x34')](handleError(_0x51fdd1,null));};exports[_0x1402('0xb3')]=function(_0x3e3a09,_0x1768f7){return db[_0x1402('0x96')][_0x1402('0xb3')](_0x3e3a09[_0x1402('0xb4')],{})[_0x1402('0x28')](respondWithResult(_0x1768f7,0xc9))[_0x1402('0x34')](handleError(_0x1768f7,null));};exports['update']=function(_0x4fe81c,_0x2a6164){if(_0x4fe81c[_0x1402('0xb4')]['id']){delete _0x4fe81c['body']['id'];}return db[_0x1402('0x96')][_0x1402('0x5d')]({'where':{'id':_0x4fe81c[_0x1402('0xaf')]['id']}})[_0x1402('0x28')](handleEntityNotFound(_0x2a6164,null))[_0x1402('0x28')](saveUpdates(_0x4fe81c[_0x1402('0xb4')],null))[_0x1402('0x28')](respondWithResult(_0x2a6164,null))['catch'](handleError(_0x2a6164,null));};exports['destroy']=function(_0x1b0aca,_0x28611c){return db[_0x1402('0x96')][_0x1402('0x5d')]({'where':{'id':_0x1b0aca[_0x1402('0xaf')]['id']}})['then'](handleEntityNotFound(_0x28611c,null))[_0x1402('0x28')](removeEntity(_0x28611c,null))[_0x1402('0x34')](handleError(_0x28611c,null));};exports['describe']=function(_0x2b50d3,_0x417669){return db[_0x1402('0x96')]['describe']()[_0x1402('0x28')](respondWithResult(_0x417669,null))[_0x1402('0x34')](handleError(_0x417669,null));};exports[_0x1402('0xb5')]=function(_0x2ee517,_0x39b177,_0x279ce9){return db[_0x1402('0xb6')][_0x1402('0x5d')]({'where':{'id':_0x2ee517[_0x1402('0xaf')]['id']}})[_0x1402('0x28')](handleEntityNotFound(_0x39b177,null))['then'](function(_0x5568dd){if(_0x5568dd){return _0x5568dd[_0x1402('0xb5')](_0x2ee517[_0x1402('0xb4')][_0x1402('0xb7')],_[_0x1402('0xb8')](_0x2ee517[_0x1402('0xb4')],['ids','id'])||{});}})[_0x1402('0x28')](respondWithResult(_0x39b177,null))[_0x1402('0x34')](handleError(_0x39b177,null));};exports[_0x1402('0xb9')]=function(_0x263280,_0x5caf64,_0x1d52a4){var _0x28d643={'raw':![],'where':{}};var _0x31bfff={};var _0x34d1f5={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x1402('0xba')]({'where':{'id':_0x263280[_0x1402('0xaf')]['id']}})[_0x1402('0x28')](handleEntityNotFound(_0x5caf64,null))['then'](function(_0x1a9095){if(_0x1a9095){_0x31bfff[_0x1402('0x3b')]=_[_0x1402('0x3d')](db[_0x1402('0xb6')][_0x1402('0x37')]);_0x31bfff[_0x1402('0x3c')]=_[_0x1402('0x3d')](_0x263280['query']);_0x31bfff[_0x1402('0x3e')]=_[_0x1402('0x40')](_0x31bfff[_0x1402('0x3b')],_0x31bfff[_0x1402('0x3c')]);_0x28d643['attributes']=_[_0x1402('0x40')](_0x31bfff['model'],qs[_0x1402('0x41')](_0x263280[_0x1402('0x3c')]['fields']));_0x28d643[_0x1402('0x3f')]=_0x28d643[_0x1402('0x3f')][_0x1402('0x42')]?_0x28d643[_0x1402('0x3f')]:_0x31bfff[_0x1402('0x3b')];if(!_0x263280[_0x1402('0x3c')][_0x1402('0xbb')](_0x1402('0x43'))){_0x28d643[_0x1402('0x24')]=qs[_0x1402('0x24')](_0x263280['query'][_0x1402('0x24')]);_0x28d643[_0x1402('0x23')]=qs['offset'](_0x263280[_0x1402('0x3c')][_0x1402('0x23')]);}_0x28d643[_0x1402('0x44')]=qs[_0x1402('0x45')](_0x263280[_0x1402('0x3c')]['sort']);_0x28d643[_0x1402('0x73')]=qs[_0x1402('0x3e')](_[_0x1402('0xbc')](_0x263280['query'],_0x31bfff[_0x1402('0x3e')]));_0x28d643[_0x1402('0x73')][_0x1402('0xac')]=_0x1a9095['id'];if(_0x263280[_0x1402('0x3c')][_0x1402('0x7e')]){_0x28d643[_0x1402('0x73')]=_[_0x1402('0x95')](_0x28d643[_0x1402('0x73')],{'$or':_[_0x1402('0x36')](_0x28d643['attributes'],function(_0x34c2ea){var _0x8dfd6f={};_0x8dfd6f[_0x34c2ea]={'$like':'%'+_0x263280[_0x1402('0x3c')]['filter']+'%'};return _0x8dfd6f;})});}if(_0x263280[_0x1402('0x3c')][_0x1402('0x77')]){var _0x1e7af7=_0x263280[_0x1402('0x3c')][_0x1402('0x77')][_0x1402('0x6a')](',');var _0x496525={};_0x496525[_0x1e7af7[0x0]]={'$gte':moment(_0x1e7af7[0x1])['format'](_0x1402('0xbd'))};_0x28d643[_0x1402('0x73')]=_[_0x1402('0x95')](_0x28d643[_0x1402('0x73')],_0x496525);}_0x28d643=_[_0x1402('0x95')]({},_0x28d643,_0x263280['options']);return db['WhatsappMessage'][_0x1402('0x22')]({'where':_0x28d643[_0x1402('0x73')]})[_0x1402('0x28')](function(_0x1d5eeb){_0x34d1f5[_0x1402('0x22')]=_0x1d5eeb;if(_0x263280['query'][_0x1402('0xb0')]){_0x28d643[_0x1402('0xb1')]=[{'all':!![]}];}return db[_0x1402('0xb6')][_0x1402('0xbe')](_0x28d643);})[_0x1402('0x28')](function(_0x494530){_0x34d1f5['rows']=_0x494530;return _0x34d1f5;});}})[_0x1402('0x28')](respondWithFilteredResult(_0x5caf64,_0x28d643))[_0x1402('0x34')](handleError(_0x5caf64,null));};exports[_0x1402('0xbf')]=function(_0x7042f3,_0xf1b029,_0x2b5ef4){return db[_0x1402('0x96')][_0x1402('0x5d')]({'where':{'id':_0x7042f3[_0x1402('0xaf')]['id']}})['then'](handleEntityNotFound(_0xf1b029,null))[_0x1402('0x28')](function(_0x33abbb){if(_0x33abbb){return _0x33abbb[_0x1402('0xc0')](_0x7042f3[_0x1402('0xb4')][_0x1402('0xb7')],_[_0x1402('0xb8')](_0x7042f3[_0x1402('0xb4')],[_0x1402('0xb7'),'id'])||{})[_0x1402('0xc1')](function(){return db[_0x1402('0x69')][_0x1402('0xbe')]({'attributes':['id',_0x1402('0x2c'),_0x1402('0x47')],'where':{'id':_0x7042f3['body'][_0x1402('0xb7')]}});})[_0x1402('0x28')](function(_0x4e5a37){socket[_0x1402('0xc2')]('whatsappInteractionTags:save',{'id':Number(_0x7042f3[_0x1402('0xaf')]['id']),'tags':_0x4e5a37||[]});return{'id':Number(_0x7042f3[_0x1402('0xaf')]['id']),'tags':_0x4e5a37||[]};});}})['then'](respondWithResult(_0xf1b029,null))[_0x1402('0x34')](handleError(_0xf1b029,null));};exports[_0x1402('0xc3')]=function(_0x3a568b,_0x53410e,_0x5143c0){return db[_0x1402('0x96')]['find']({'where':{'id':_0x3a568b['params']['id']}})[_0x1402('0x28')](handleEntityNotFound(_0x53410e,null))[_0x1402('0x28')](function(_0x3ba9cc){if(_0x3ba9cc){return _0x3ba9cc[_0x1402('0xc3')](_0x3a568b[_0x1402('0x3c')][_0x1402('0xb7')]);}})['then'](respondWithStatusCode(_0x53410e,null))[_0x1402('0x34')](handleError(_0x53410e,null));};exports[_0x1402('0xc4')]=function(_0x41ff54,_0x3d2de6){var _0xfcd3e1=moment()['unix']()[_0x1402('0x94')]();var _0x3dc7b0=path[_0x1402('0xc5')](config['root'],_0x1402('0xc6'),_0x1402('0xc7'),_0x1402('0xc8'));var _0x511726=path[_0x1402('0xc5')](config['root'],_0x1402('0xc6'),'files',_0x1402('0xc9'));var _0x34b375=path[_0x1402('0xc5')](_0x3dc7b0,_0xfcd3e1);var _0x548c1b=util[_0x1402('0xca')](_0x1402('0xcb'),_0x41ff54[_0x1402('0xaf')]['id'],_0xfcd3e1);var _0x614a5=path[_0x1402('0xc5')](_0x3dc7b0,_0x548c1b);var _0x2473b4=[];_0x2473b4[_0x1402('0x33')]({'model':db[_0x1402('0x6d')],'as':_0x1402('0x6d'),'attributes':['id',_0x1402('0x2f')],'raw':!![]});_0x2473b4[_0x1402('0x33')]({'model':db['CmContact'],'as':_0x1402('0x61'),'attributes':['id',_0x1402('0xcc'),_0x1402('0xcd')],'raw':!![]});if(_0x41ff54['query'][_0x1402('0xc9')]){_0x2473b4[_0x1402('0x33')]({'model':db[_0x1402('0xce')],'as':_0x1402('0xce'),'raw':!![]});}var _0x150b74=[{'model':db[_0x1402('0xb6')],'as':_0x1402('0xcf'),'attributes':['id',_0x1402('0xb4'),'createdAt',_0x1402('0xd0'),'secret','read'],'include':_0x2473b4}];_0x150b74[_0x1402('0x33')]({'model':db[_0x1402('0xd1')],'as':_0x1402('0xd2'),'attributes':['id',_0x1402('0x2c')]});_0x150b74[_0x1402('0x33')]({'model':db['User'],'as':'Owner','attributes':['id',_0x1402('0x2f')]});return db['WhatsappInteraction']['find']({'where':{'id':_0x41ff54['params']['id']},'include':_0x150b74})[_0x1402('0x28')](handleEntityNotFound(_0x3d2de6,null))[_0x1402('0x28')](function(_0x4bd402){if(_0x4bd402){var _0x50849a=_0x4bd402[_0x1402('0xd3')]({'plain':!![]});fs[_0x1402('0xd4')](_0x34b375);var _0x23a3d8={'format':'A4','border':'10px','header':{'height':_0x1402('0xd5'),'contents':{'first':_0x1402('0xd6')}},'footer':{'height':_0x1402('0xd7'),'contents':{'default':util['format'](_0x1402('0xd8'),util[_0x1402('0xca')](_0x1402('0xd9'),_0x1402('0xda'),_0x50849a['id']),moment()['format'](_0x1402('0xdb'))[_0x1402('0x94')]())}}};var _0x1d3660={'channel':'Whatsapp','account':_0x50849a[_0x1402('0xd2')][_0x1402('0x2c')],'agent':_0x50849a['Owner']?_0x50849a['Owner'][_0x1402('0x2f')]:_0x1402('0xdc'),'createdAt':moment(_0x50849a[_0x1402('0x75')])['format'](_0x1402('0xbd'))[_0x1402('0x94')](),'closedAt':_0x50849a[_0x1402('0xdd')]?moment(_0x50849a[_0x1402('0xde')])[_0x1402('0xca')](_0x1402('0xbd'))[_0x1402('0x94')]():'','disposition':_0x50849a[_0x1402('0xdf')],'messages':_(_0x50849a[_0x1402('0xcf')])[_0x1402('0x7e')]({'secret':![]})[_0x1402('0x36')](function(_0x57e64a){if(_0x57e64a[_0x1402('0xce')]){var _0x1c7581=path[_0x1402('0xc5')](_0x511726,_0x57e64a['Attachment']['basename']);if(fs['existsSync'](_0x1c7581)){fs[_0x1402('0xe0')](_0x1c7581)['pipe'](fs[_0x1402('0xe1')](path[_0x1402('0xc5')](_0x34b375,_0x57e64a[_0x1402('0xce')][_0x1402('0xe2')])));}}return{'date':moment(_0x57e64a['createdAt'])[_0x1402('0xca')](_0x1402('0xbd'))[_0x1402('0x94')](),'sender':_0x57e64a['direction']===_0x1402('0xe3')?_0x57e64a[_0x1402('0x6d')]?_0x57e64a[_0x1402('0x6d')][_0x1402('0x2f')]:_0x1402('0xe4'):_0x57e64a['Contact'][_0x1402('0xcc')]+(_0x57e64a[_0x1402('0x61')][_0x1402('0xcd')]?'\x20'+_0x57e64a[_0x1402('0x61')][_0x1402('0xcd')]:''),'body':_0x57e64a['Attachment']?_0x57e64a[_0x1402('0xce')]['basename']:_0x57e64a[_0x1402('0xb4')],'direction':_0x57e64a[_0x1402('0xd0')]===_0x1402('0xe3')?'A':'C','secret':_0x57e64a[_0x1402('0xe5')],'read':_0x57e64a[_0x1402('0xe6')],'attachment':_0x57e64a[_0x1402('0xce')]};})[_0x1402('0x5e')]()};return ejs[_0x1402('0xe7')](path[_0x1402('0xc5')](config[_0x1402('0xe8')],_0x1402('0xc6'),_0x1402('0xe9'),_0x1402('0xea')),{'interaction':_0x1d3660})['then'](function(_0x5b55e3){return new BPromise(function(_0x2ce622,_0x19e721){pdf['create'](_0x5b55e3,_0x23a3d8)['toFile'](path[_0x1402('0xc5')](_0x34b375,_0x1402('0xeb')+_0x50849a['id']+'-'+_0xfcd3e1+'.pdf'),function(_0x9fbcbe,_0x318a3b){if(_0x9fbcbe)return _0x19e721(_0x9fbcbe);_0x2ce622(_0x318a3b);});});})['then'](function(){return new BPromise(function(_0x258935,_0x205624){zipdir(_0x34b375,{'saveTo':_0x614a5},function(_0x1e5169,_0x37cc80){if(_0x1e5169)return _0x205624(_0x1e5169);return _0x258935(_0x37cc80);});})[_0x1402('0x28')](function(){return new BPromise(function(_0x1a68a6,_0x209e22){rimraf(_0x34b375,function(_0x746af8){if(_0x746af8)_0x209e22(_0x746af8);return _0x1a68a6();});});})[_0x1402('0x28')](function(){return _0x3d2de6[_0x1402('0xc4')](_0x614a5,_0x548c1b,function(_0x40158b){if(_0x40158b){console[_0x1402('0xec')](_0x1402('0xed'),_0x40158b);}else{fs[_0x1402('0xee')](_0x614a5);}});});});}else{return _0x3d2de6[_0x1402('0x1f')](0xc8);}})['catch'](handleError(_0x3d2de6,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 75df3d4..794cb1b 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 _0xf7f6=['remove','getUsers','then','map','findAll','setDataValue','unreadMessages','length','emit','hook','WhatsappInteraction','WhatsappMessage','setMaxListeners'];(function(_0x212721,_0x1c0edc){var _0x369f08=function(_0x1c6077){while(--_0x1c6077){_0x212721['push'](_0x212721['shift']());}};_0x369f08(++_0x1c0edc);}(_0xf7f6,0x1b7));var _0x6f7f=function(_0x2d65f4,_0x15df12){_0x2d65f4=_0x2d65f4-0x0;var _0x39025a=_0xf7f6[_0x2d65f4];return _0x39025a;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0x6f7f('0x0')];var WhatsappMessage=require('../../mysqldb')['db'][_0x6f7f('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x6f7f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6f7f('0x3')};function emitEvent(_0x1f0a65){return function(_0x3e3f0f,_0x3002ea,_0x17a176){_0x3e3f0f[_0x6f7f('0x4')]({'attributes':['id'],'raw':!![]})[_0x6f7f('0x5')](function(_0x5af860){_0x3e3f0f['setDataValue']('Users',_0x5af860[_0x6f7f('0x6')](function(_0x3d5c70){return{'id':_0x3d5c70['id']};}));return WhatsappMessage[_0x6f7f('0x7')]({'where':{'WhatsappInteractionId':_0x3e3f0f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6f7f('0x5')](function(_0x19da6a){_0x3e3f0f[_0x6f7f('0x8')](_0x6f7f('0x9'),_0x19da6a[_0x6f7f('0xa')]);WhatsappInteractionEvents[_0x6f7f('0xb')](_0x1f0a65+':'+_0x3e3f0f['id'],_0x3e3f0f);WhatsappInteractionEvents[_0x6f7f('0xb')](_0x1f0a65,_0x3e3f0f);_0x17a176(null);})['catch'](_0x17a176(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x6f7f('0xc')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x9fe6=['unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x507c4b,_0x36cc1a){var _0x1b8bb6=function(_0x5aa094){while(--_0x5aa094){_0x507c4b['push'](_0x507c4b['shift']());}};_0x1b8bb6(++_0x36cc1a);}(_0x9fe6,0x1c7));var _0x69fe=function(_0x4f9fcb,_0x62f84){_0x4f9fcb=_0x4f9fcb-0x0;var _0x3d4552=_0x9fe6[_0x4f9fcb];return _0x3d4552;};'use strict';var EventEmitter=require(_0x69fe('0x0'));var WhatsappInteraction=require(_0x69fe('0x1'))['db'][_0x69fe('0x2')];var WhatsappMessage=require(_0x69fe('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x69fe('0x3')](0x0);var events={'afterCreate':_0x69fe('0x4'),'afterUpdate':_0x69fe('0x5'),'afterDestroy':_0x69fe('0x6')};function emitEvent(_0x4dbcae){return function(_0xb9ba9b,_0x16081f,_0x45a8f6){_0xb9ba9b[_0x69fe('0x7')]({'attributes':['id'],'raw':!![]})[_0x69fe('0x8')](function(_0x564318){_0xb9ba9b[_0x69fe('0x9')](_0x69fe('0xa'),_0x564318[_0x69fe('0xb')](function(_0x51b924){return{'id':_0x51b924['id']};}));return WhatsappMessage[_0x69fe('0xc')]({'where':{'WhatsappInteractionId':_0xb9ba9b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x69fe('0x8')](function(_0x3aa005){_0xb9ba9b[_0x69fe('0x9')](_0x69fe('0xd'),_0x3aa005[_0x69fe('0xe')]);WhatsappInteractionEvents['emit'](_0x4dbcae+':'+_0xb9ba9b['id'],_0xb9ba9b);WhatsappInteractionEvents[_0x69fe('0xf')](_0x4dbcae,_0xb9ba9b);_0x45a8f6(null);})['catch'](_0x45a8f6(null));};}for(var e in events){if(events[_0x69fe('0x10')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x69fe('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 51c1bb6..6fc0e7a 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 _0xde9c=['changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define'];(function(_0x200aa5,_0x197802){var _0x458200=function(_0x594959){while(--_0x594959){_0x200aa5['push'](_0x200aa5['shift']());}};_0x458200(++_0x197802);}(_0xde9c,0x9d));var _0xcde9=function(_0x2d3e1f,_0x5e56ae){_0x2d3e1f=_0x2d3e1f-0x0;var _0x3e3ac8=_0xde9c[_0x2d3e1f];return _0x3e3ac8;};'use strict';var _=require(_0xcde9('0x0'));var util=require('util');var logger=require(_0xcde9('0x1'))(_0xcde9('0x2'));var moment=require(_0xcde9('0x3'));var BPromise=require('bluebird');var rp=require(_0xcde9('0x4'));var fs=require('fs');var path=require(_0xcde9('0x5'));var rimraf=require(_0xcde9('0x6'));var config=require(_0xcde9('0x7'));var attributes=require(_0xcde9('0x8'));module[_0xcde9('0x9')]=function(_0x41e6d0,_0xcac7cc){return _0x41e6d0[_0xcde9('0xa')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e6e4d,_0x2f7255,_0x2e81f6){if(_0x2e6e4d[_0xcde9('0xb')](_0xcde9('0xc'))){_0x2e6e4d['closedAt']=moment()['format'](_0xcde9('0xd'));}_0x2e81f6(null,_0x2e6e4d);}}});}; \ No newline at end of file +var _0x65dd=['YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closedAt','format'];(function(_0x363002,_0x25f058){var _0x1e22dd=function(_0x8a47a0){while(--_0x8a47a0){_0x363002['push'](_0x363002['shift']());}};_0x1e22dd(++_0x25f058);}(_0x65dd,0x81));var _0xd65d=function(_0x1a16a5,_0x4a3a6d){_0x1a16a5=_0x1a16a5-0x0;var _0x4c86c9=_0x65dd[_0x1a16a5];return _0x4c86c9;};'use strict';var _=require(_0xd65d('0x0'));var util=require('util');var logger=require(_0xd65d('0x1'))(_0xd65d('0x2'));var moment=require('moment');var BPromise=require(_0xd65d('0x3'));var rp=require(_0xd65d('0x4'));var fs=require('fs');var path=require(_0xd65d('0x5'));var rimraf=require(_0xd65d('0x6'));var config=require('../../config/environment');var attributes=require(_0xd65d('0x7'));module[_0xd65d('0x8')]=function(_0x1d8946,_0x483847){return _0x1d8946[_0xd65d('0x9')](_0xd65d('0xa'),attributes,{'tableName':_0xd65d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3c97fc,_0x4f0458,_0x4b3ec8){if(_0x3c97fc[_0xd65d('0xc')]('closed')){_0x3c97fc[_0xd65d('0xd')]=moment()[_0xd65d('0xe')](_0xd65d('0xf'));}_0x4b3ec8(null,_0x3c97fc);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index de66f47..60ab45e 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 _0xeea5=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','./whatsappInteraction.socket','request','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','WhatsappInteraction','body','options','limit','then','debug','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','where','addTags','ids','omit','spread','AddTags','util','moment'];(function(_0x56c248,_0x5cb1da){var _0x206c08=function(_0x23d070){while(--_0x23d070){_0x56c248['push'](_0x56c248['shift']());}};_0x206c08(++_0x5cb1da);}(_0xeea5,0xc1));var _0x5eea=function(_0x1abfc2,_0x2e3b98){_0x1abfc2=_0x1abfc2-0x0;var _0x210890=_0xeea5[_0x1abfc2];return _0x210890;};'use strict';var _=require('lodash');var util=require(_0x5eea('0x0'));var moment=require(_0x5eea('0x1'));var BPromise=require(_0x5eea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5eea('0x3'));var db=require(_0x5eea('0x4'))['db'];var utils=require(_0x5eea('0x5'));var logger=require('../../config/logger')(_0x5eea('0x6'));var config=require(_0x5eea('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5eea('0x8')]['http']({'port':0x232a});config[_0x5eea('0x9')]=_[_0x5eea('0xa')](config[_0x5eea('0x9')],{'host':_0x5eea('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5eea('0xc'))['register'](socket);function respondWithRpcPromise(_0x5a7afb,_0x18b839,_0x34fcab){return new BPromise(function(_0x22480f,_0x1f4f1f){return client[_0x5eea('0xd')](_0x5a7afb,_0x34fcab)['then'](function(_0x5f25c8){logger['info'](_0x5eea('0xe'),_0x18b839,_0x5eea('0xf'));logger['debug'](_0x5eea('0x10'),_0x18b839,_0x5eea('0xf'),JSON[_0x5eea('0x11')](_0x5f25c8));if(_0x5f25c8[_0x5eea('0x12')]){if(_0x5f25c8[_0x5eea('0x12')][_0x5eea('0x13')]===0x1f4){logger[_0x5eea('0x12')](_0x5eea('0xe'),_0x18b839,_0x5f25c8[_0x5eea('0x12')][_0x5eea('0x14')]);return _0x1f4f1f(_0x5f25c8[_0x5eea('0x12')][_0x5eea('0x14')]);}logger[_0x5eea('0x12')](_0x5eea('0xe'),_0x18b839,_0x5f25c8['error'][_0x5eea('0x14')]);return _0x22480f(_0x5f25c8[_0x5eea('0x12')][_0x5eea('0x14')]);}else{logger[_0x5eea('0x15')](_0x5eea('0xe'),_0x18b839,'request\x20sent');_0x22480f(_0x5f25c8[_0x5eea('0x16')]['message']);}})[_0x5eea('0x17')](function(_0x40edf2){logger[_0x5eea('0x12')](_0x5eea('0xe'),_0x18b839,_0x40edf2);_0x1f4f1f(_0x40edf2);});});}exports['UpdateWhatsappInteraction']=function(_0x215f13){var _0x207833=this;return new Promise(function(_0xc6760b,_0x1f9913){return db[_0x5eea('0x18')]['update'](_0x215f13[_0x5eea('0x19')],{'raw':_0x215f13[_0x5eea('0x1a')]?_0x215f13['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x215f13[_0x5eea('0x1a')]?_0x215f13[_0x5eea('0x1a')]['where']||null:null,'attributes':_0x215f13[_0x5eea('0x1a')]?_0x215f13['options']['attributes']||null:null,'limit':_0x215f13['options']?_0x215f13[_0x5eea('0x1a')][_0x5eea('0x1b')]||null:null})[_0x5eea('0x1c')](function(_0x262256){logger[_0x5eea('0x15')]('UpdateWhatsappInteraction',_0x215f13);logger[_0x5eea('0x1d')](_0x5eea('0x1e'),_0x215f13,JSON['stringify'](_0x262256));_0xc6760b(_0x262256);})[_0x5eea('0x17')](function(_0x3c09f0){logger['error'](_0x5eea('0x1e'),_0x3c09f0[_0x5eea('0x14')],_0x215f13);_0x1f9913(_0x207833[_0x5eea('0x12')](0x1f4,_0x3c09f0[_0x5eea('0x14')]));});});};exports[_0x5eea('0x1f')]=function(_0x5a229d){return new Promise(function(_0x26155d,_0xdaf7dc){return db[_0x5eea('0x18')][_0x5eea('0x20')]({'where':_0x5a229d[_0x5eea('0x1a')]?_0x5a229d[_0x5eea('0x1a')][_0x5eea('0x21')]||null:null})[_0x5eea('0x1c')](function(_0x185fe6){if(_0x185fe6){return _0x185fe6[_0x5eea('0x22')](_0x5a229d[_0x5eea('0x19')][_0x5eea('0x23')],_[_0x5eea('0x24')](_0x5a229d['body'],[_0x5eea('0x23'),'id'])||{});}})[_0x5eea('0x25')](function(_0x43c3aa){logger[_0x5eea('0x15')](_0x5eea('0x26'),_0x5a229d);logger[_0x5eea('0x1d')]('AddTags',_0x5a229d,JSON[_0x5eea('0x11')](_0x43c3aa));_0x26155d(_0x43c3aa);})[_0x5eea('0x17')](function(_0x1b26c5){logger[_0x5eea('0x12')](_0x5eea('0x26'),_0x1b26c5[_0x5eea('0x14')],_0x5a229d);_0xdaf7dc(_this[_0x5eea('0x12')](0x1f4,_0x1b26c5['message']));});});}; \ No newline at end of file +var _0xa6e6=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis','localhost','socket.io-emitter','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','catch','AddTagsToWhatsappInteraction','find','addTags','ids','spread','AddTags','util','randomstring','ioredis'];(function(_0xb29159,_0x24a72c){var _0x4e6a70=function(_0x2c8a24){while(--_0x2c8a24){_0xb29159['push'](_0xb29159['shift']());}};_0x4e6a70(++_0x24a72c);}(_0xa6e6,0xd5));var _0x6a6e=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0xa6e6[_0x5a6644];return _0x3a2a5d;};'use strict';var _=require('lodash');var util=require(_0x6a6e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6a6e('0x1'));var fs=require('fs');var Redis=require(_0x6a6e('0x2'));var db=require(_0x6a6e('0x3'))['db'];var utils=require(_0x6a6e('0x4'));var logger=require(_0x6a6e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6a6e('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x6a6e('0x7')]=_['defaults'](config[_0x6a6e('0x7')],{'host':_0x6a6e('0x8'),'port':0x18eb});var socket=require(_0x6a6e('0x9'))(new Redis(config[_0x6a6e('0x7')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x54ac54,_0x3fa2bb,_0x5741cb){return new BPromise(function(_0x4c51de,_0xd19f33){return client[_0x6a6e('0xa')](_0x54ac54,_0x5741cb)[_0x6a6e('0xb')](function(_0x517e64){logger[_0x6a6e('0xc')](_0x6a6e('0xd'),_0x3fa2bb,_0x6a6e('0xe'));logger[_0x6a6e('0xf')](_0x6a6e('0x10'),_0x3fa2bb,_0x6a6e('0xe'),JSON[_0x6a6e('0x11')](_0x517e64));if(_0x517e64[_0x6a6e('0x12')]){if(_0x517e64[_0x6a6e('0x12')][_0x6a6e('0x13')]===0x1f4){logger[_0x6a6e('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x3fa2bb,_0x517e64[_0x6a6e('0x12')][_0x6a6e('0x14')]);return _0xd19f33(_0x517e64['error'][_0x6a6e('0x14')]);}logger[_0x6a6e('0x12')](_0x6a6e('0xd'),_0x3fa2bb,_0x517e64['error'][_0x6a6e('0x14')]);return _0x4c51de(_0x517e64[_0x6a6e('0x12')][_0x6a6e('0x14')]);}else{logger[_0x6a6e('0xc')](_0x6a6e('0xd'),_0x3fa2bb,_0x6a6e('0xe'));_0x4c51de(_0x517e64[_0x6a6e('0x15')][_0x6a6e('0x14')]);}})['catch'](function(_0x41d3fc){logger[_0x6a6e('0x12')](_0x6a6e('0xd'),_0x3fa2bb,_0x41d3fc);_0xd19f33(_0x41d3fc);});});}exports[_0x6a6e('0x16')]=function(_0xe227ab){var _0x4d5b2a=this;return new Promise(function(_0x499a88,_0x8917bc){return db[_0x6a6e('0x17')][_0x6a6e('0x18')](_0xe227ab[_0x6a6e('0x19')],{'raw':_0xe227ab[_0x6a6e('0x1a')]?_0xe227ab[_0x6a6e('0x1a')][_0x6a6e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe227ab[_0x6a6e('0x1a')]?_0xe227ab[_0x6a6e('0x1a')][_0x6a6e('0x1c')]||null:null,'attributes':_0xe227ab['options']?_0xe227ab[_0x6a6e('0x1a')]['attributes']||null:null,'limit':_0xe227ab[_0x6a6e('0x1a')]?_0xe227ab[_0x6a6e('0x1a')]['limit']||null:null})[_0x6a6e('0xb')](function(_0x4228f1){logger[_0x6a6e('0xc')](_0x6a6e('0x16'),_0xe227ab);logger[_0x6a6e('0xf')]('UpdateWhatsappInteraction',_0xe227ab,JSON[_0x6a6e('0x11')](_0x4228f1));_0x499a88(_0x4228f1);})[_0x6a6e('0x1d')](function(_0x14dfea){logger[_0x6a6e('0x12')](_0x6a6e('0x16'),_0x14dfea[_0x6a6e('0x14')],_0xe227ab);_0x8917bc(_0x4d5b2a[_0x6a6e('0x12')](0x1f4,_0x14dfea[_0x6a6e('0x14')]));});});};exports[_0x6a6e('0x1e')]=function(_0x15fbae){return new Promise(function(_0x5caecd,_0x920402){return db[_0x6a6e('0x17')][_0x6a6e('0x1f')]({'where':_0x15fbae[_0x6a6e('0x1a')]?_0x15fbae[_0x6a6e('0x1a')][_0x6a6e('0x1c')]||null:null})['then'](function(_0x4d8c95){if(_0x4d8c95){return _0x4d8c95[_0x6a6e('0x20')](_0x15fbae[_0x6a6e('0x19')][_0x6a6e('0x21')],_['omit'](_0x15fbae[_0x6a6e('0x19')],[_0x6a6e('0x21'),'id'])||{});}})[_0x6a6e('0x22')](function(_0x2b71e5){logger[_0x6a6e('0xc')]('AddTags',_0x15fbae);logger[_0x6a6e('0xf')](_0x6a6e('0x23'),_0x15fbae,JSON[_0x6a6e('0x11')](_0x2b71e5));_0x5caecd(_0x2b71e5);})[_0x6a6e('0x1d')](function(_0x1950f0){logger[_0x6a6e('0x12')]('AddTags',_0x1950f0[_0x6a6e('0x14')],_0x15fbae);_0x920402(_this[_0x6a6e('0x12')](0x1f4,_0x1950f0[_0x6a6e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index e493c70..b9e46d3 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 _0x982a=['register','whatsappInteraction:','./whatsappInteraction.events','save','update','removeListener'];(function(_0xe746f1,_0x29a296){var _0x28f7f1=function(_0x5554dc){while(--_0x5554dc){_0xe746f1['push'](_0xe746f1['shift']());}};_0x28f7f1(++_0x29a296);}(_0x982a,0x140));var _0xa982=function(_0x39dfba,_0x3a0ade){_0x39dfba=_0x39dfba-0x0;var _0x4f34f9=_0x982a[_0x39dfba];return _0x4f34f9;};'use strict';var WhatsappInteractionEvents=require(_0xa982('0x0'));var events=[_0xa982('0x1'),'remove',_0xa982('0x2')];function createListener(_0x4f67da,_0x144925){return function(_0x3f11e4){_0x144925['emit'](_0x4f67da,_0x3f11e4);};}function removeListener(_0x5ad79e,_0x442cae){return function(){WhatsappInteractionEvents[_0xa982('0x3')](_0x5ad79e,_0x442cae);};}exports[_0xa982('0x4')]=function(_0x5b7a48){for(var _0x4675cd=0x0,_0x4068fd=events['length'];_0x4675cd<_0x4068fd;_0x4675cd++){var _0x4e9ab6=events[_0x4675cd];var _0x369a3e=createListener(_0xa982('0x5')+_0x4e9ab6,_0x5b7a48);WhatsappInteractionEvents['on'](_0x4e9ab6,_0x369a3e);}}; \ No newline at end of file +var _0x70a4=['length','save','removeListener','register'];(function(_0x41b0a8,_0x1b05cc){var _0x3a83d4=function(_0x3d1011){while(--_0x3d1011){_0x41b0a8['push'](_0x41b0a8['shift']());}};_0x3a83d4(++_0x1b05cc);}(_0x70a4,0x109));var _0x470a=function(_0x365edb,_0x437d86){_0x365edb=_0x365edb-0x0;var _0x26fb71=_0x70a4[_0x365edb];return _0x26fb71;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x470a('0x0'),'remove','update'];function createListener(_0x5ce69d,_0x1aa01b){return function(_0xb4855e){_0x1aa01b['emit'](_0x5ce69d,_0xb4855e);};}function removeListener(_0x346fc1,_0x1cb39a){return function(){WhatsappInteractionEvents[_0x470a('0x1')](_0x346fc1,_0x1cb39a);};}exports[_0x470a('0x2')]=function(_0x515855){for(var _0xb42ea2=0x0,_0x23597f=events[_0x470a('0x3')];_0xb42ea2<_0x23597f;_0xb42ea2++){var _0x5e6c90=events[_0xb42ea2];var _0x7ae64b=createListener('whatsappInteraction:'+_0x5e6c90,_0x515855);WhatsappInteractionEvents['on'](_0x5e6c90,_0x7ae64b);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 9a180cb..5e7d730 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 _0x06c2=['tracked','whatsapp','whatsappmessage:create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','/describe','isAuthenticated','/:id','show','post'];(function(_0x5746a1,_0x11eab1){var _0x551a43=function(_0x7ddcbe){while(--_0x7ddcbe){_0x5746a1['push'](_0x5746a1['shift']());}};_0x551a43(++_0x11eab1);}(_0x06c2,0xb6));var _0x206c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06c2[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x206c('0x0'));var util=require(_0x206c('0x1'));var path=require(_0x206c('0x2'));var timeout=require('connect-timeout');var express=require(_0x206c('0x3'));var router=express[_0x206c('0x4')]();var auth=require(_0x206c('0x5'));var interaction=require(_0x206c('0x6'));var config=require('../../config/environment');var controller=require(_0x206c('0x7'));router[_0x206c('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x206c('0x8')](_0x206c('0x9'),auth[_0x206c('0xa')](),controller['describe']);router['get'](_0x206c('0xb'),auth['isAuthenticated'](),controller[_0x206c('0xc')]);router[_0x206c('0xd')]('/',auth[_0x206c('0xa')](),interaction[_0x206c('0xe')](_0x206c('0xf'),_0x206c('0x10')),controller['create']);router[_0x206c('0xd')](_0x206c('0x11'),controller[_0x206c('0x12')]);router[_0x206c('0x13')](_0x206c('0xb'),auth['isAuthenticated'](),controller[_0x206c('0x14')]);router[_0x206c('0x13')](_0x206c('0x15'),auth['isAuthenticated'](),controller[_0x206c('0x16')]);router['put'](_0x206c('0x17'),auth[_0x206c('0xa')](),controller[_0x206c('0x18')]);router[_0x206c('0x19')](_0x206c('0xb'),auth['isAuthenticated'](),controller[_0x206c('0x1a')]);module[_0x206c('0x1b')]=router; \ No newline at end of file +var _0x0202=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','whatsapp','whatsappmessage:create','/:id/status','status','update','put','/:id/accept','/:id/reject','reject','destroy','exports','multer'];(function(_0x3a5c9a,_0x479498){var _0x422fa4=function(_0x597bbe){while(--_0x597bbe){_0x3a5c9a['push'](_0x3a5c9a['shift']());}};_0x422fa4(++_0x479498);}(_0x0202,0x6b));var _0x2020=function(_0x1c5c75,_0x5e7dbf){_0x1c5c75=_0x1c5c75-0x0;var _0x93b560=_0x0202[_0x1c5c75];return _0x93b560;};'use strict';var multer=require(_0x2020('0x0'));var util=require(_0x2020('0x1'));var path=require(_0x2020('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2020('0x3')]();var auth=require(_0x2020('0x4'));var interaction=require(_0x2020('0x5'));var config=require(_0x2020('0x6'));var controller=require(_0x2020('0x7'));router[_0x2020('0x8')]('/',auth[_0x2020('0x9')](),controller[_0x2020('0xa')]);router[_0x2020('0x8')](_0x2020('0xb'),auth[_0x2020('0x9')](),controller[_0x2020('0xc')]);router[_0x2020('0x8')](_0x2020('0xd'),auth['isAuthenticated'](),controller[_0x2020('0xe')]);router[_0x2020('0xf')]('/',auth[_0x2020('0x9')](),interaction['tracked'](_0x2020('0x10'),_0x2020('0x11')),controller['create']);router[_0x2020('0xf')](_0x2020('0x12'),controller[_0x2020('0x13')]);router['put'](_0x2020('0xd'),auth[_0x2020('0x9')](),controller[_0x2020('0x14')]);router[_0x2020('0x15')](_0x2020('0x16'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x2020('0x17'),auth[_0x2020('0x9')](),controller[_0x2020('0x18')]);router['delete'](_0x2020('0xd'),auth[_0x2020('0x9')](),controller[_0x2020('0x19')]);module[_0x2020('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 89ce83b..e9def17 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 _0x4483=['out','STRING','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x447774,_0x123d39){var _0x51c5a8=function(_0x5413df){while(--_0x5413df){_0x447774['push'](_0x447774['shift']());}};_0x51c5a8(++_0x123d39);}(_0x4483,0x1a3));var _0x3448=function(_0x4dc890,_0x17d897){_0x4dc890=_0x4dc890-0x0;var _0x2336bc=_0x4483[_0x4dc890];return _0x2336bc;};'use strict';var Sequelize=require(_0x3448('0x0'));module[_0x3448('0x1')]={'body':{'type':Sequelize[_0x3448('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x3448('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3448('0x4')]('in',_0x3448('0x5')),'defaultValue':_0x3448('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3448('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x3448('0x7')]},'secret':{'type':Sequelize[_0x3448('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xa1fd=['BOOLEAN','ENUM','out','STRING','DATE','medium'];(function(_0x171e1d,_0x295064){var _0x27b090=function(_0x2ee386){while(--_0x2ee386){_0x171e1d['push'](_0x171e1d['shift']());}};_0x27b090(++_0x295064);}(_0xa1fd,0xad));var _0xda1f=function(_0x38a211,_0x1c21ff){_0x38a211=_0x38a211-0x0;var _0x78f594=_0xa1fd[_0x38a211];return _0x78f594;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0xda1f('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0xda1f('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xda1f('0x2')]('in',_0xda1f('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xda1f('0x4')](0xbe)},'phone':{'type':Sequelize[_0xda1f('0x4')]},'readAt':{'type':Sequelize[_0xda1f('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index ced4501..53b25a7 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 _0x4504=['error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','destroy','end','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','filtears','length','include','create','body','find','params','describe','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteraction','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','whatsapp-interactions','reject','agent','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4f48ec,_0x12b386){var _0x28edf1=function(_0x41097f){while(--_0x41097f){_0x4f48ec['push'](_0x4f48ec['shift']());}};_0x28edf1(++_0x12b386);}(_0x4504,0x178));var _0x4450=function(_0x251869,_0x376099){_0x251869=_0x251869-0x0;var _0x13542f=_0x4504[_0x251869];return _0x13542f;};'use strict';var pdf=require(_0x4450('0x0'));var emlformat=require(_0x4450('0x1'));var rimraf=require(_0x4450('0x2'));var zipdir=require(_0x4450('0x3'));var jsonpatch=require(_0x4450('0x4'));var rp=require(_0x4450('0x5'));var moment=require(_0x4450('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x4450('0x7'));var util=require('util');var path=require(_0x4450('0x8'));var sox=require(_0x4450('0x9'));var csv=require(_0x4450('0xa'));var ejs=require(_0x4450('0xb'));var fs=require('fs');var _=require(_0x4450('0xc'));var squel=require(_0x4450('0xd'));var crypto=require(_0x4450('0xe'));var jsforce=require(_0x4450('0xf'));var deskjs=require(_0x4450('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4450('0x11'));var Papa=require(_0x4450('0x12'));var Redis=require(_0x4450('0x13'));var authService=require(_0x4450('0x14'));var qs=require(_0x4450('0x15'));var as=require(_0x4450('0x16'));var hardwareService=require(_0x4450('0x17'));var logger=require(_0x4450('0x18'))(_0x4450('0x19'));var utils=require(_0x4450('0x1a'));var config=require(_0x4450('0x1b'));var licenseUtil=require(_0x4450('0x1c'));var db=require(_0x4450('0x1d'))['db'];config[_0x4450('0x1e')]=_[_0x4450('0x1f')](config[_0x4450('0x1e')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4450('0x1e')]));require(_0x4450('0x20'))[_0x4450('0x21')](socket);var jayson=require(_0x4450('0x22'));var client=jayson[_0x4450('0x23')]['http']({'port':0x232c});var client9002=jayson[_0x4450('0x23')][_0x4450('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x287220,_0xef912b,_0x3840c4,_0x3c9db4){return new BPromise(function(_0x294ba0,_0x492613){var _0x4afab6=_0x3c9db4||client;return _0x4afab6[_0x4450('0x25')](_0x287220,_0x3840c4)[_0x4450('0x26')](function(_0x17f7b6){logger[_0x4450('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0xef912b,_0x4450('0x28'));logger[_0x4450('0x29')](_0x4450('0x2a'),_0xef912b,_0x4450('0x28'),JSON[_0x4450('0x2b')](_0x17f7b6));if(_0x17f7b6[_0x4450('0x2c')]){if(_0x17f7b6[_0x4450('0x2c')][_0x4450('0x2d')]===0x1f4){logger['error'](_0x4450('0x2e'),_0xef912b,_0x17f7b6[_0x4450('0x2c')][_0x4450('0x2f')]);return _0x492613(_0x17f7b6[_0x4450('0x2c')][_0x4450('0x2f')]);}logger[_0x4450('0x2c')](_0x4450('0x2e'),_0xef912b,_0x17f7b6[_0x4450('0x2c')][_0x4450('0x2f')]);return _0x294ba0(_0x17f7b6[_0x4450('0x2c')][_0x4450('0x2f')]);}else{logger[_0x4450('0x27')](_0x4450('0x2e'),_0xef912b,_0x4450('0x28'));_0x294ba0(_0x17f7b6[_0x4450('0x30')]['message']);}})[_0x4450('0x31')](function(_0x5d7643){logger['error'](_0x4450('0x2e'),_0xef912b,_0x5d7643);_0x492613(_0x5d7643);});});}function respondWithStatusCode(_0x21d103,_0x2f2fda){_0x2f2fda=_0x2f2fda||0xcc;return function(_0x1cdc1c){if(_0x1cdc1c){return _0x21d103[_0x4450('0x32')](_0x2f2fda);}return _0x21d103[_0x4450('0x33')](_0x2f2fda)['end']();};}function respondWithResult(_0x278f66,_0x452aff){_0x452aff=_0x452aff||0xc8;return function(_0x4b3e20){if(_0x4b3e20){return _0x278f66[_0x4450('0x33')](_0x452aff)[_0x4450('0x34')](_0x4b3e20);}};}function respondWithFilteredResult(_0x5aa3b8,_0x44312f){return function(_0x3cea61){if(_0x3cea61){var _0x5a1167=_0x3cea61[_0x4450('0x35')],_0x36d6f7=_0x44312f[_0x4450('0x36')],_0x4ee533=_0x44312f[_0x4450('0x36')]+_0x44312f['limit'],_0x3c2cd2;if(_0x4ee533>=_0x5a1167){_0x4ee533=_0x5a1167;_0x3c2cd2=0xc8;}else{_0x3c2cd2=0xce;}_0x5aa3b8[_0x4450('0x33')](_0x3c2cd2);return _0x5aa3b8[_0x4450('0x37')](_0x4450('0x38'),_0x36d6f7+'-'+_0x4ee533+'/'+_0x5a1167)[_0x4450('0x34')](_0x3cea61);}return null;};}function patchUpdates(_0x232fc1){return function(_0x472a7d){try{jsonpatch[_0x4450('0x39')](_0x472a7d,_0x232fc1,!![]);}catch(_0x4db922){return BPromise['reject'](_0x4db922);}return _0x472a7d[_0x4450('0x3a')]();};}function saveUpdates(_0x39f8ba,_0x373c4a){return function(_0x16b3e7){if(_0x16b3e7){return _0x16b3e7[_0x4450('0x3b')](_0x39f8ba)[_0x4450('0x26')](function(_0xf7cb02){return _0xf7cb02;});}return null;};}function removeEntity(_0x24b5ec,_0x2fb926){return function(_0x9486e9){if(_0x9486e9){return _0x9486e9[_0x4450('0x3c')]()['then'](function(){_0x24b5ec[_0x4450('0x33')](0xcc)[_0x4450('0x3d')]();});}};}function handleEntityNotFound(_0x15d3f7,_0x4df2f3){return function(_0x12604f){if(!_0x12604f){_0x15d3f7[_0x4450('0x32')](0x194);}return _0x12604f;};}function handleError(_0x1a11fb,_0x4cb894){_0x4cb894=_0x4cb894||0x1f4;return function(_0x1f8b91){logger[_0x4450('0x2c')](_0x1f8b91[_0x4450('0x3e')]);if(_0x1f8b91[_0x4450('0x3f')]){delete _0x1f8b91['name'];}_0x1a11fb[_0x4450('0x33')](_0x4cb894)[_0x4450('0x40')](_0x1f8b91);};}exports['index']=function(_0xd3084,_0x4f59fd){var _0x32054f={},_0x5b21aa={},_0x3b0ce5={'count':0x0,'rows':[]};var _0x2e7cd4=_[_0x4450('0x41')](db[_0x4450('0x42')][_0x4450('0x43')],function(_0x3540f6){return{'name':_0x3540f6[_0x4450('0x44')],'type':_0x3540f6['type'][_0x4450('0x45')]};});_0x5b21aa['model']=_['map'](_0x2e7cd4,_0x4450('0x3f'));_0x5b21aa['query']=_[_0x4450('0x46')](_0xd3084[_0x4450('0x47')]);_0x5b21aa[_0x4450('0x48')]=_[_0x4450('0x49')](_0x5b21aa[_0x4450('0x4a')],_0x5b21aa[_0x4450('0x47')]);_0x32054f[_0x4450('0x4b')]=_[_0x4450('0x49')](_0x5b21aa[_0x4450('0x4a')],qs['fields'](_0xd3084[_0x4450('0x47')][_0x4450('0x4c')]));_0x32054f['attributes']=_0x32054f[_0x4450('0x4b')]['length']?_0x32054f[_0x4450('0x4b')]:_0x5b21aa[_0x4450('0x4a')];if(!_0xd3084[_0x4450('0x47')][_0x4450('0x4d')](_0x4450('0x4e'))){_0x32054f[_0x4450('0x4f')]=qs[_0x4450('0x4f')](_0xd3084[_0x4450('0x47')][_0x4450('0x4f')]);_0x32054f['offset']=qs[_0x4450('0x36')](_0xd3084[_0x4450('0x47')][_0x4450('0x36')]);}_0x32054f[_0x4450('0x50')]=qs['sort'](_0xd3084['query'][_0x4450('0x51')]);_0x32054f[_0x4450('0x52')]=qs[_0x4450('0x48')](_[_0x4450('0x53')](_0xd3084[_0x4450('0x47')],_0x5b21aa['filters']),_0x2e7cd4);if(_0xd3084[_0x4450('0x47')][_0x4450('0x54')]){_0x32054f[_0x4450('0x52')]=_['merge'](_0x32054f[_0x4450('0x52')],{'$or':_['map'](_0x2e7cd4,function(_0x17ac6c){if(_0x17ac6c['type']!==_0x4450('0x55')){var _0x1acde6={};_0x1acde6[_0x17ac6c[_0x4450('0x3f')]]={'$like':'%'+_0xd3084[_0x4450('0x47')][_0x4450('0x54')]+'%'};return _0x1acde6;}})});}_0x32054f=_[_0x4450('0x56')]({},_0x32054f,_0xd3084[_0x4450('0x57')]);var _0x5a17b4={'where':_0x32054f[_0x4450('0x52')]};return db[_0x4450('0x42')][_0x4450('0x35')](_0x5a17b4)[_0x4450('0x26')](function(_0x223c1d){_0x3b0ce5[_0x4450('0x35')]=_0x223c1d;if(_0xd3084['query'][_0x4450('0x58')]){_0x32054f['include']=[{'all':!![]}];}return db[_0x4450('0x42')][_0x4450('0x59')](_0x32054f);})[_0x4450('0x26')](function(_0x1b23f9){_0x3b0ce5[_0x4450('0x5a')]=_0x1b23f9;return _0x3b0ce5;})[_0x4450('0x26')](respondWithFilteredResult(_0x4f59fd,_0x32054f))[_0x4450('0x31')](handleError(_0x4f59fd,null));};exports[_0x4450('0x5b')]=function(_0x4395ac,_0x504b63){var _0x481797={'raw':!![],'where':{'id':_0x4395ac['params']['id']}},_0x10a14b={};_0x10a14b[_0x4450('0x4a')]=_['keys'](db[_0x4450('0x42')][_0x4450('0x43')]);_0x10a14b['query']=_[_0x4450('0x46')](_0x4395ac[_0x4450('0x47')]);_0x10a14b[_0x4450('0x5c')]=_['intersection'](_0x10a14b[_0x4450('0x4a')],_0x10a14b[_0x4450('0x47')]);_0x481797[_0x4450('0x4b')]=_[_0x4450('0x49')](_0x10a14b['model'],qs[_0x4450('0x4c')](_0x4395ac['query']['fields']));_0x481797[_0x4450('0x4b')]=_0x481797[_0x4450('0x4b')][_0x4450('0x5d')]?_0x481797[_0x4450('0x4b')]:_0x10a14b[_0x4450('0x4a')];if(_0x4395ac[_0x4450('0x47')][_0x4450('0x58')]){_0x481797[_0x4450('0x5e')]=[{'all':!![]}];}_0x481797=_['merge']({},_0x481797,_0x4395ac[_0x4450('0x57')]);return db[_0x4450('0x42')]['find'](_0x481797)['then'](handleEntityNotFound(_0x504b63,null))[_0x4450('0x26')](respondWithResult(_0x504b63,null))[_0x4450('0x31')](handleError(_0x504b63,null));};exports[_0x4450('0x5f')]=function(_0x4bf222,_0x1a5311){return db['WhatsappMessage'][_0x4450('0x5f')](_0x4bf222[_0x4450('0x60')],{})[_0x4450('0x26')](respondWithResult(_0x1a5311,0xc9))[_0x4450('0x31')](handleError(_0x1a5311,null));};exports[_0x4450('0x3b')]=function(_0x1f8da0,_0x35fc79){if(_0x1f8da0[_0x4450('0x60')]['id']){delete _0x1f8da0[_0x4450('0x60')]['id'];}return db['WhatsappMessage'][_0x4450('0x61')]({'where':{'id':_0x1f8da0['params']['id']}})[_0x4450('0x26')](handleEntityNotFound(_0x35fc79,null))['then'](saveUpdates(_0x1f8da0[_0x4450('0x60')],null))[_0x4450('0x26')](respondWithResult(_0x35fc79,null))[_0x4450('0x31')](handleError(_0x35fc79,null));};exports[_0x4450('0x3c')]=function(_0xaa3d3e,_0x2500a8){return db[_0x4450('0x42')]['find']({'where':{'id':_0xaa3d3e[_0x4450('0x62')]['id']}})[_0x4450('0x26')](handleEntityNotFound(_0x2500a8,null))[_0x4450('0x26')](removeEntity(_0x2500a8,null))[_0x4450('0x31')](handleError(_0x2500a8,null));};exports[_0x4450('0x63')]=function(_0x49879f,_0x4f4f2a){return db[_0x4450('0x42')][_0x4450('0x63')]()['then'](respondWithResult(_0x4f4f2a,null))[_0x4450('0x31')](handleError(_0x4f4f2a,null));};var interaction_log=require(_0x4450('0x18'))('whatsapp-interactions');exports['accept']=function(_0x4a9788,_0x75be95,_0xffd9de){var _0x444bc8={'channel':'whatsapp'};if(_0x4a9788[_0x4450('0x60')]['id']){delete _0x4a9788[_0x4450('0x60')]['id'];}_0x4a9788[_0x4450('0x60')][_0x4450('0x64')]=!![];_0x4a9788[_0x4450('0x60')][_0x4450('0x65')]=moment()[_0x4450('0x66')](_0x4450('0x67'));_0x4a9788[_0x4450('0x60')][_0x4450('0x68')]=_0x4a9788[_0x4450('0x60')]['UserId']||_0x4a9788[_0x4450('0x69')]['id'];return db[_0x4450('0x42')][_0x4450('0x61')]({'where':{'id':_0x4a9788['params']['id'],'UserId':null},'include':[{'model':db[_0x4450('0x6a')],'as':_0x4450('0x6b')}]})['then'](handleEntityNotFound(_0x75be95,null))[_0x4450('0x26')](saveUpdates(_0x4a9788[_0x4450('0x60')],null))[_0x4450('0x26')](function(_0xabba78){if(_0xabba78){_0x444bc8[_0x4450('0x2f')]=_0xabba78[_0x4450('0x6c')]({'plain':!![]});return db[_0x4450('0x6d')][_0x4450('0x61')]({'where':{'id':_0xabba78['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x75be95,null))[_0x4450('0x26')](function(_0x353c90){if(_0x353c90){return _0x353c90['update']({'UserId':_0x4a9788[_0x4450('0x60')][_0x4450('0x68')],'read1stAt':_['isNil'](_0x353c90[_0x4450('0x6e')])?moment()['format'](_0x4450('0x67')):undefined});}return null;})[_0x4450('0x26')](function(_0x11548f){if(_0x11548f){_0x444bc8[_0x4450('0x6f')]=_0x11548f[_0x4450('0x6c')]({'plain':!![]});interaction_log[_0x4450('0x27')](_0x4450('0x70'),_0x4a9788[_0x4450('0x69')]['id'],_0x4a9788[_0x4450('0x69')][_0x4450('0x3f')],_0x4a9788['user'][_0x4450('0x71')],_0x444bc8[_0x4450('0x6f')]['id'],_0x4a9788[_0x4450('0x60')]?JSON['stringify'](_0x4a9788[_0x4450('0x60')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x444bc8);}return null;})[_0x4450('0x26')](function(_0x465092){if(_0x465092){if(_0x4a9788[_0x4450('0x60')][_0x4450('0x72')]){_0x444bc8['message'][_0x4450('0x73')]=util[_0x4450('0x66')](_0x4450('0x74'),_0x4a9788[_0x4450('0x69')][_0x4450('0x3f')]);_0x444bc8['message']['channel']=_0x444bc8[_0x4450('0x75')];_0x444bc8[_0x4450('0x2f')][_0x4450('0x76')]=_0x4450('0x77');return respondWithRpcPromise('EventManager',_0x4450('0x78'),{'event':_0x4450('0x79'),'message':_0x444bc8[_0x4450('0x2f')]},client9002)[_0x4450('0x26')](function(){return _0x444bc8;});}return _0x444bc8;}return null;})[_0x4450('0x26')](respondWithResult(_0x75be95,null))[_0x4450('0x31')](handleError(_0x75be95,null));};var interaction_log=require(_0x4450('0x18'))(_0x4450('0x7a'));exports[_0x4450('0x7b')]=function(_0x13be4a,_0x484ac7,_0x2481a1){var _0x2d00dd={'agent':{},'channel':'whatsapp'};if(_0x13be4a['body']['id']){delete _0x13be4a[_0x4450('0x60')]['id'];}_0x13be4a['body'][_0x4450('0x68')]=_0x13be4a['body'][_0x4450('0x68')]||_0x13be4a[_0x4450('0x69')]['id'];_0x2d00dd[_0x4450('0x7c')]['id']=_0x13be4a[_0x4450('0x60')][_0x4450('0x68')];return db[_0x4450('0x42')]['find']({'where':{'id':_0x13be4a[_0x4450('0x62')]['id'],'UserId':null}})[_0x4450('0x26')](handleEntityNotFound(_0x484ac7,null))[_0x4450('0x26')](function(_0x312ce8){if(_0x312ce8){_0x2d00dd[_0x4450('0x2f')]=_0x312ce8[_0x4450('0x6c')]({'plain':!![]});return db[_0x4450('0x6d')][_0x4450('0x61')]({'where':{'id':_0x312ce8[_0x4450('0x7d')]}});}return null;})[_0x4450('0x26')](handleEntityNotFound(_0x484ac7,null))[_0x4450('0x26')](function(_0x607995){if(_0x607995){_0x2d00dd['interaction']=_0x607995[_0x4450('0x6c')]({'plain':!![]});interaction_log[_0x4450('0x27')](_0x4450('0x7e'),_0x13be4a[_0x4450('0x69')]['id'],_0x13be4a[_0x4450('0x69')]['name'],_0x13be4a['user'][_0x4450('0x71')],_0x2d00dd[_0x4450('0x6f')]['id'],_0x13be4a[_0x4450('0x60')]?JSON[_0x4450('0x2b')](_0x13be4a[_0x4450('0x60')]):_0x4450('0x7f'));return respondWithRpcPromise(_0x4450('0x80'),'rejectMessage',_0x2d00dd);}return null;})['then'](function(_0x490137){if(_0x490137){_0x490137[_0x4450('0x2f')][_0x4450('0x73')]=util['format'](_0x4450('0x74'),_0x13be4a[_0x4450('0x69')][_0x4450('0x3f')]);_0x490137[_0x4450('0x2f')][_0x4450('0x75')]=_0x2d00dd[_0x4450('0x75')];_0x490137[_0x4450('0x2f')]['event']=_0x4450('0x7b');respondWithRpcPromise(_0x4450('0x78'),_0x4450('0x78'),{'event':_0x4450('0x81'),'message':_0x490137[_0x4450('0x2f')]},client9002);return _0x2d00dd;}return null;})[_0x4450('0x26')](respondWithResult(_0x484ac7,null))[_0x4450('0x31')](handleError(_0x484ac7,null));};exports[_0x4450('0x33')]=function(_0x558a09,_0x68122b,_0x235a30){if(_0x558a09[_0x4450('0x60')]['id']){delete _0x558a09[_0x4450('0x60')]['id'];}var _0x56d6ef;return db[_0x4450('0x42')][_0x4450('0x61')]({'where':{'id':_0x558a09[_0x4450('0x62')]['id']}})['then'](handleEntityNotFound(_0x68122b,null))['then'](function(_0x19e740){if(_0x19e740){_0x56d6ef=_0x19e740;return db[_0x4450('0x82')][_0x4450('0x61')]({'where':{'id':_0x19e740['WhatsappAccountId']}});}})[_0x4450('0x26')](handleEntityNotFound(_0x68122b,null))[_0x4450('0x26')](function(_0x39af67){if(_0x39af67){logger[_0x4450('0x29')](_0x4450('0x83'),_0x4450('0x33'),_0x4450('0x84'),_0x39af67[_0x4450('0x85')],util[_0x4450('0x86')](_0x558a09[_0x4450('0x60')],{'showHidden':![],'depth':null}));switch(_0x39af67[_0x4450('0x85')]){case _0x4450('0x87'):if(_0x558a09[_0x4450('0x60')][_0x4450('0x88')]&&_0x558a09['body'][_0x4450('0x88')]===_0x56d6ef[_0x4450('0x89')]&&_0x558a09[_0x4450('0x60')][_0x4450('0x8a')]&&_0x558a09[_0x4450('0x60')][_0x4450('0x8a')]===_0x4450('0x64')){return _0x56d6ef[_0x4450('0x3b')]({'read':!![]});}else{logger[_0x4450('0x2c')](_0x4450('0x8b'),_0x4450('0x33'),_0x4450('0x87'),util[_0x4450('0x86')](_0x558a09['body'],{'showHidden':![],'depth':null}));}break;}return _0x56d6ef;}})[_0x4450('0x26')](respondWithResult(_0x68122b,null))[_0x4450('0x31')](handleError(_0x68122b,null));}; \ No newline at end of file +var _0x9a62=['create','body','update','describe','whatsapp-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','isNil','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','EventManager','reject','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','event','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','limit','set','apply','destroy','name','send','index','WhatsappMessage','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','map','merge','includeAll','include','findAll','rows','show','params','keys','filtears','find'];(function(_0x3df7c2,_0x21b7f3){var _0x3fe4a1=function(_0x58ae8c){while(--_0x58ae8c){_0x3df7c2['push'](_0x3df7c2['shift']());}};_0x3fe4a1(++_0x21b7f3);}(_0x9a62,0x120));var _0x29a6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9a62[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x29a6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29a6('0x1'));var rp=require(_0x29a6('0x2'));var moment=require(_0x29a6('0x3'));var BPromise=require(_0x29a6('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x29a6('0x5'));var sox=require(_0x29a6('0x6'));var csv=require(_0x29a6('0x7'));var ejs=require(_0x29a6('0x8'));var fs=require('fs');var _=require(_0x29a6('0x9'));var squel=require(_0x29a6('0xa'));var crypto=require(_0x29a6('0xb'));var jsforce=require(_0x29a6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x29a6('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x29a6('0xd'));var as=require(_0x29a6('0xe'));var hardwareService=require(_0x29a6('0xf'));var logger=require(_0x29a6('0x10'))(_0x29a6('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x29a6('0x12'));var db=require(_0x29a6('0x13'))['db'];config[_0x29a6('0x14')]=_[_0x29a6('0x15')](config[_0x29a6('0x14')],{'host':_0x29a6('0x16'),'port':0x18eb});var socket=require(_0x29a6('0x17'))(new Redis(config['redis']));require(_0x29a6('0x18'))[_0x29a6('0x19')](socket);var jayson=require(_0x29a6('0x1a'));var client=jayson[_0x29a6('0x1b')][_0x29a6('0x1c')]({'port':0x232c});var client9002=jayson[_0x29a6('0x1b')][_0x29a6('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x70dbac,_0x5321dd,_0x4f2bdd,_0xe6baa){return new BPromise(function(_0x550aea,_0x1e682e){var _0x316054=_0xe6baa||client;return _0x316054[_0x29a6('0x1d')](_0x70dbac,_0x4f2bdd)[_0x29a6('0x1e')](function(_0x48d6b0){logger[_0x29a6('0x1f')](_0x29a6('0x20'),_0x5321dd,'request\x20sent');logger[_0x29a6('0x21')](_0x29a6('0x22'),_0x5321dd,_0x29a6('0x23'),JSON[_0x29a6('0x24')](_0x48d6b0));if(_0x48d6b0[_0x29a6('0x25')]){if(_0x48d6b0[_0x29a6('0x25')][_0x29a6('0x26')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x5321dd,_0x48d6b0[_0x29a6('0x25')][_0x29a6('0x27')]);return _0x1e682e(_0x48d6b0[_0x29a6('0x25')][_0x29a6('0x27')]);}logger[_0x29a6('0x25')](_0x29a6('0x20'),_0x5321dd,_0x48d6b0['error'][_0x29a6('0x27')]);return _0x550aea(_0x48d6b0['error'][_0x29a6('0x27')]);}else{logger[_0x29a6('0x1f')](_0x29a6('0x20'),_0x5321dd,_0x29a6('0x23'));_0x550aea(_0x48d6b0[_0x29a6('0x28')][_0x29a6('0x27')]);}})[_0x29a6('0x29')](function(_0x2d1bf5){logger[_0x29a6('0x25')](_0x29a6('0x20'),_0x5321dd,_0x2d1bf5);_0x1e682e(_0x2d1bf5);});});}function respondWithStatusCode(_0x19e38c,_0x58b6e5){_0x58b6e5=_0x58b6e5||0xcc;return function(_0x474b3c){if(_0x474b3c){return _0x19e38c[_0x29a6('0x2a')](_0x58b6e5);}return _0x19e38c[_0x29a6('0x2b')](_0x58b6e5)[_0x29a6('0x2c')]();};}function respondWithResult(_0x527c17,_0x1b7c20){_0x1b7c20=_0x1b7c20||0xc8;return function(_0x3a6f65){if(_0x3a6f65){return _0x527c17[_0x29a6('0x2b')](_0x1b7c20)[_0x29a6('0x2d')](_0x3a6f65);}};}function respondWithFilteredResult(_0x569f0b,_0x42021d){return function(_0x1560e7){if(_0x1560e7){var _0x500fbf=_0x1560e7[_0x29a6('0x2e')],_0x56f07f=_0x42021d['offset'],_0x52ef09=_0x42021d['offset']+_0x42021d[_0x29a6('0x2f')],_0x10c740;if(_0x52ef09>=_0x500fbf){_0x52ef09=_0x500fbf;_0x10c740=0xc8;}else{_0x10c740=0xce;}_0x569f0b[_0x29a6('0x2b')](_0x10c740);return _0x569f0b[_0x29a6('0x30')]('Content-Range',_0x56f07f+'-'+_0x52ef09+'/'+_0x500fbf)['json'](_0x1560e7);}return null;};}function patchUpdates(_0x1e24bb){return function(_0x3076ea){try{jsonpatch[_0x29a6('0x31')](_0x3076ea,_0x1e24bb,!![]);}catch(_0xfbed66){return BPromise['reject'](_0xfbed66);}return _0x3076ea['save']();};}function saveUpdates(_0x5f467d,_0x5ba603){return function(_0x2b1eec){if(_0x2b1eec){return _0x2b1eec['update'](_0x5f467d)[_0x29a6('0x1e')](function(_0x265c31){return _0x265c31;});}return null;};}function removeEntity(_0x2bbb15,_0x4f2762){return function(_0x26e881){if(_0x26e881){return _0x26e881[_0x29a6('0x32')]()[_0x29a6('0x1e')](function(){_0x2bbb15[_0x29a6('0x2b')](0xcc)[_0x29a6('0x2c')]();});}};}function handleEntityNotFound(_0x1a5c3d,_0x42bd51){return function(_0x125c1a){if(!_0x125c1a){_0x1a5c3d[_0x29a6('0x2a')](0x194);}return _0x125c1a;};}function handleError(_0x34619b,_0x3b6653){_0x3b6653=_0x3b6653||0x1f4;return function(_0x5a1ca7){logger[_0x29a6('0x25')](_0x5a1ca7['stack']);if(_0x5a1ca7[_0x29a6('0x33')]){delete _0x5a1ca7['name'];}_0x34619b[_0x29a6('0x2b')](_0x3b6653)[_0x29a6('0x34')](_0x5a1ca7);};}exports[_0x29a6('0x35')]=function(_0x259afa,_0x53b03b){var _0xe01ad5={},_0x31b05f={},_0xd091a4={'count':0x0,'rows':[]};var _0x1ee21b=_['map'](db[_0x29a6('0x36')][_0x29a6('0x37')],function(_0x16bd95){return{'name':_0x16bd95[_0x29a6('0x38')],'type':_0x16bd95[_0x29a6('0x39')]['key']};});_0x31b05f[_0x29a6('0x3a')]=_['map'](_0x1ee21b,_0x29a6('0x33'));_0x31b05f[_0x29a6('0x3b')]=_['keys'](_0x259afa[_0x29a6('0x3b')]);_0x31b05f[_0x29a6('0x3c')]=_[_0x29a6('0x3d')](_0x31b05f['model'],_0x31b05f[_0x29a6('0x3b')]);_0xe01ad5[_0x29a6('0x3e')]=_[_0x29a6('0x3d')](_0x31b05f[_0x29a6('0x3a')],qs['fields'](_0x259afa['query'][_0x29a6('0x3f')]));_0xe01ad5['attributes']=_0xe01ad5[_0x29a6('0x3e')][_0x29a6('0x40')]?_0xe01ad5['attributes']:_0x31b05f[_0x29a6('0x3a')];if(!_0x259afa['query'][_0x29a6('0x41')](_0x29a6('0x42'))){_0xe01ad5['limit']=qs[_0x29a6('0x2f')](_0x259afa[_0x29a6('0x3b')]['limit']);_0xe01ad5[_0x29a6('0x43')]=qs[_0x29a6('0x43')](_0x259afa[_0x29a6('0x3b')][_0x29a6('0x43')]);}_0xe01ad5[_0x29a6('0x44')]=qs['sort'](_0x259afa['query'][_0x29a6('0x45')]);_0xe01ad5[_0x29a6('0x46')]=qs[_0x29a6('0x3c')](_[_0x29a6('0x47')](_0x259afa['query'],_0x31b05f[_0x29a6('0x3c')]),_0x1ee21b);if(_0x259afa[_0x29a6('0x3b')][_0x29a6('0x48')]){_0xe01ad5[_0x29a6('0x46')]=_['merge'](_0xe01ad5['where'],{'$or':_[_0x29a6('0x49')](_0x1ee21b,function(_0x3b198c){if(_0x3b198c[_0x29a6('0x39')]!=='VIRTUAL'){var _0x58ff4e={};_0x58ff4e[_0x3b198c[_0x29a6('0x33')]]={'$like':'%'+_0x259afa[_0x29a6('0x3b')][_0x29a6('0x48')]+'%'};return _0x58ff4e;}})});}_0xe01ad5=_[_0x29a6('0x4a')]({},_0xe01ad5,_0x259afa['options']);var _0x349251={'where':_0xe01ad5[_0x29a6('0x46')]};return db[_0x29a6('0x36')][_0x29a6('0x2e')](_0x349251)[_0x29a6('0x1e')](function(_0x3cd530){_0xd091a4[_0x29a6('0x2e')]=_0x3cd530;if(_0x259afa[_0x29a6('0x3b')][_0x29a6('0x4b')]){_0xe01ad5[_0x29a6('0x4c')]=[{'all':!![]}];}return db[_0x29a6('0x36')][_0x29a6('0x4d')](_0xe01ad5);})[_0x29a6('0x1e')](function(_0x1b5b8f){_0xd091a4[_0x29a6('0x4e')]=_0x1b5b8f;return _0xd091a4;})[_0x29a6('0x1e')](respondWithFilteredResult(_0x53b03b,_0xe01ad5))[_0x29a6('0x29')](handleError(_0x53b03b,null));};exports[_0x29a6('0x4f')]=function(_0x44474b,_0x55be09){var _0x5cd6fb={'raw':!![],'where':{'id':_0x44474b[_0x29a6('0x50')]['id']}},_0x49171f={};_0x49171f[_0x29a6('0x3a')]=_[_0x29a6('0x51')](db[_0x29a6('0x36')]['rawAttributes']);_0x49171f[_0x29a6('0x3b')]=_[_0x29a6('0x51')](_0x44474b[_0x29a6('0x3b')]);_0x49171f[_0x29a6('0x52')]=_['intersection'](_0x49171f['model'],_0x49171f[_0x29a6('0x3b')]);_0x5cd6fb[_0x29a6('0x3e')]=_['intersection'](_0x49171f[_0x29a6('0x3a')],qs[_0x29a6('0x3f')](_0x44474b[_0x29a6('0x3b')]['fields']));_0x5cd6fb[_0x29a6('0x3e')]=_0x5cd6fb['attributes']['length']?_0x5cd6fb[_0x29a6('0x3e')]:_0x49171f[_0x29a6('0x3a')];if(_0x44474b[_0x29a6('0x3b')][_0x29a6('0x4b')]){_0x5cd6fb[_0x29a6('0x4c')]=[{'all':!![]}];}_0x5cd6fb=_[_0x29a6('0x4a')]({},_0x5cd6fb,_0x44474b['options']);return db[_0x29a6('0x36')][_0x29a6('0x53')](_0x5cd6fb)[_0x29a6('0x1e')](handleEntityNotFound(_0x55be09,null))[_0x29a6('0x1e')](respondWithResult(_0x55be09,null))[_0x29a6('0x29')](handleError(_0x55be09,null));};exports[_0x29a6('0x54')]=function(_0x48aa3c,_0x126199){return db['WhatsappMessage']['create'](_0x48aa3c[_0x29a6('0x55')],{})['then'](respondWithResult(_0x126199,0xc9))[_0x29a6('0x29')](handleError(_0x126199,null));};exports[_0x29a6('0x56')]=function(_0x37bfd8,_0x21744b){if(_0x37bfd8[_0x29a6('0x55')]['id']){delete _0x37bfd8[_0x29a6('0x55')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x37bfd8[_0x29a6('0x50')]['id']}})[_0x29a6('0x1e')](handleEntityNotFound(_0x21744b,null))['then'](saveUpdates(_0x37bfd8[_0x29a6('0x55')],null))[_0x29a6('0x1e')](respondWithResult(_0x21744b,null))[_0x29a6('0x29')](handleError(_0x21744b,null));};exports[_0x29a6('0x32')]=function(_0x5cfc09,_0x21db54){return db[_0x29a6('0x36')][_0x29a6('0x53')]({'where':{'id':_0x5cfc09[_0x29a6('0x50')]['id']}})[_0x29a6('0x1e')](handleEntityNotFound(_0x21db54,null))[_0x29a6('0x1e')](removeEntity(_0x21db54,null))[_0x29a6('0x29')](handleError(_0x21db54,null));};exports[_0x29a6('0x57')]=function(_0x2b387d,_0xa4a24b){return db[_0x29a6('0x36')][_0x29a6('0x57')]()[_0x29a6('0x1e')](respondWithResult(_0xa4a24b,null))[_0x29a6('0x29')](handleError(_0xa4a24b,null));};var interaction_log=require('../../config/logger')(_0x29a6('0x58'));exports[_0x29a6('0x59')]=function(_0x4cab18,_0x24a78c,_0x43593d){var _0x4aff93={'channel':'whatsapp'};if(_0x4cab18['body']['id']){delete _0x4cab18[_0x29a6('0x55')]['id'];}_0x4cab18[_0x29a6('0x55')]['read']=!![];_0x4cab18['body'][_0x29a6('0x5a')]=moment()[_0x29a6('0x5b')](_0x29a6('0x5c'));_0x4cab18[_0x29a6('0x55')][_0x29a6('0x5d')]=_0x4cab18[_0x29a6('0x55')][_0x29a6('0x5d')]||_0x4cab18[_0x29a6('0x5e')]['id'];return db[_0x29a6('0x36')]['find']({'where':{'id':_0x4cab18[_0x29a6('0x50')]['id'],'UserId':null},'include':[{'model':db[_0x29a6('0x5f')],'as':_0x29a6('0x60')}]})['then'](handleEntityNotFound(_0x24a78c,null))[_0x29a6('0x1e')](saveUpdates(_0x4cab18[_0x29a6('0x55')],null))['then'](function(_0x20e231){if(_0x20e231){_0x4aff93['message']=_0x20e231[_0x29a6('0x61')]({'plain':!![]});return db[_0x29a6('0x62')][_0x29a6('0x53')]({'where':{'id':_0x20e231[_0x29a6('0x63')]}});}return null;})[_0x29a6('0x1e')](handleEntityNotFound(_0x24a78c,null))[_0x29a6('0x1e')](function(_0x2b7084){if(_0x2b7084){return _0x2b7084[_0x29a6('0x56')]({'UserId':_0x4cab18[_0x29a6('0x55')]['UserId'],'read1stAt':_[_0x29a6('0x64')](_0x2b7084['read1stAt'])?moment()[_0x29a6('0x5b')](_0x29a6('0x5c')):undefined});}return null;})[_0x29a6('0x1e')](function(_0x447838){if(_0x447838){_0x4aff93['interaction']=_0x447838['get']({'plain':!![]});interaction_log[_0x29a6('0x1f')](_0x29a6('0x65'),_0x4cab18[_0x29a6('0x5e')]['id'],_0x4cab18[_0x29a6('0x5e')]['name'],_0x4cab18[_0x29a6('0x5e')][_0x29a6('0x66')],_0x4aff93[_0x29a6('0x67')]['id'],_0x4cab18[_0x29a6('0x55')]?JSON['stringify'](_0x4cab18[_0x29a6('0x55')]):_0x29a6('0x68'));return respondWithRpcPromise(_0x29a6('0x69'),_0x29a6('0x6a'),_0x4aff93);}return null;})['then'](function(_0x2d8ab6){if(_0x2d8ab6){if(_0x4cab18['body']['manual']){_0x4aff93[_0x29a6('0x27')][_0x29a6('0x6b')]=util[_0x29a6('0x5b')](_0x29a6('0x6c'),_0x4cab18[_0x29a6('0x5e')]['name']);_0x4aff93[_0x29a6('0x27')][_0x29a6('0x6d')]=_0x4aff93['channel'];_0x4aff93[_0x29a6('0x27')]['event']=_0x29a6('0x59');return respondWithRpcPromise(_0x29a6('0x6e'),_0x29a6('0x6e'),{'event':'acceptmessage','message':_0x4aff93[_0x29a6('0x27')]},client9002)[_0x29a6('0x1e')](function(){return _0x4aff93;});}return _0x4aff93;}return null;})['then'](respondWithResult(_0x24a78c,null))['catch'](handleError(_0x24a78c,null));};var interaction_log=require('../../config/logger')(_0x29a6('0x58'));exports[_0x29a6('0x6f')]=function(_0x96bb42,_0x5a3273,_0x117be0){var _0xae2480={'agent':{},'channel':_0x29a6('0x70')};if(_0x96bb42[_0x29a6('0x55')]['id']){delete _0x96bb42[_0x29a6('0x55')]['id'];}_0x96bb42[_0x29a6('0x55')]['UserId']=_0x96bb42[_0x29a6('0x55')][_0x29a6('0x5d')]||_0x96bb42['user']['id'];_0xae2480['agent']['id']=_0x96bb42['body'][_0x29a6('0x5d')];return db['WhatsappMessage'][_0x29a6('0x53')]({'where':{'id':_0x96bb42[_0x29a6('0x50')]['id'],'UserId':null}})[_0x29a6('0x1e')](handleEntityNotFound(_0x5a3273,null))[_0x29a6('0x1e')](function(_0x27eb7d){if(_0x27eb7d){_0xae2480[_0x29a6('0x27')]=_0x27eb7d[_0x29a6('0x61')]({'plain':!![]});return db['WhatsappInteraction'][_0x29a6('0x53')]({'where':{'id':_0x27eb7d[_0x29a6('0x63')]}});}return null;})[_0x29a6('0x1e')](handleEntityNotFound(_0x5a3273,null))[_0x29a6('0x1e')](function(_0x34fee6){if(_0x34fee6){_0xae2480['interaction']=_0x34fee6['get']({'plain':!![]});interaction_log[_0x29a6('0x1f')](_0x29a6('0x71'),_0x96bb42[_0x29a6('0x5e')]['id'],_0x96bb42[_0x29a6('0x5e')][_0x29a6('0x33')],_0x96bb42[_0x29a6('0x5e')][_0x29a6('0x66')],_0xae2480['interaction']['id'],_0x96bb42[_0x29a6('0x55')]?JSON[_0x29a6('0x24')](_0x96bb42[_0x29a6('0x55')]):_0x29a6('0x68'));return respondWithRpcPromise('RejectMessage',_0x29a6('0x72'),_0xae2480);}return null;})[_0x29a6('0x1e')](function(_0x27b4fd){if(_0x27b4fd){_0x27b4fd['message']['interface']=util[_0x29a6('0x5b')](_0x29a6('0x6c'),_0x96bb42[_0x29a6('0x5e')]['name']);_0x27b4fd[_0x29a6('0x27')][_0x29a6('0x6d')]=_0xae2480[_0x29a6('0x6d')];_0x27b4fd['message'][_0x29a6('0x73')]=_0x29a6('0x6f');respondWithRpcPromise('EventManager',_0x29a6('0x6e'),{'event':'rejectmessage','message':_0x27b4fd[_0x29a6('0x27')]},client9002);return _0xae2480;}return null;})[_0x29a6('0x1e')](respondWithResult(_0x5a3273,null))[_0x29a6('0x29')](handleError(_0x5a3273,null));};exports[_0x29a6('0x2b')]=function(_0x55f4d4,_0x21d634,_0x5422be){if(_0x55f4d4[_0x29a6('0x55')]['id']){delete _0x55f4d4[_0x29a6('0x55')]['id'];}var _0x191bed;return db['WhatsappMessage']['find']({'where':{'id':_0x55f4d4[_0x29a6('0x50')]['id']}})[_0x29a6('0x1e')](handleEntityNotFound(_0x21d634,null))[_0x29a6('0x1e')](function(_0x5347d4){if(_0x5347d4){_0x191bed=_0x5347d4;return db['WhatsappAccount'][_0x29a6('0x53')]({'where':{'id':_0x5347d4['WhatsappAccountId']}});}})[_0x29a6('0x1e')](handleEntityNotFound(_0x21d634,null))[_0x29a6('0x1e')](function(_0xabd13a){if(_0xabd13a){logger[_0x29a6('0x21')](_0x29a6('0x74'),'status',_0x29a6('0x75'),_0xabd13a[_0x29a6('0x39')],util[_0x29a6('0x76')](_0x55f4d4[_0x29a6('0x55')],{'showHidden':![],'depth':null}));switch(_0xabd13a[_0x29a6('0x39')]){case _0x29a6('0x77'):if(_0x55f4d4[_0x29a6('0x55')]['MessageSid']&&_0x55f4d4[_0x29a6('0x55')][_0x29a6('0x78')]===_0x191bed['messageId']&&_0x55f4d4[_0x29a6('0x55')][_0x29a6('0x79')]&&_0x55f4d4['body'][_0x29a6('0x79')]===_0x29a6('0x7a')){return _0x191bed['update']({'read':!![]});}else{logger[_0x29a6('0x25')](_0x29a6('0x7b'),_0x29a6('0x2b'),_0x29a6('0x77'),util[_0x29a6('0x76')](_0x55f4d4[_0x29a6('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x191bed;}})['then'](respondWithResult(_0x21d634,null))[_0x29a6('0x29')](handleError(_0x21d634,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index a9b1a70..095ed4f 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['WhatsappMessage','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x2a3aa1,_0x4de88b){var _0x58a3da=function(_0x41abfd){while(--_0x41abfd){_0x2a3aa1['push'](_0x2a3aa1['shift']());}};_0x58a3da(++_0x4de88b);}(_0x7a54,0x106));var _0x47a5=function(_0x2b9e2a,_0x5dbce0){_0x2b9e2a=_0x2b9e2a-0x0;var _0x5ef67a=_0x7a54[_0x2b9e2a];return _0x5ef67a;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var WhatsappMessage=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){WhatsappMessageEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);WhatsappMessageEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x2a84f3,_0x2ca153){var _0xa062c0=function(_0x52af4c){while(--_0x52af4c){_0x2a84f3['push'](_0x2a84f3['shift']());}};_0xa062c0(++_0x2ca153);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2a66f6,_0x38e84f){_0x2a66f6=_0x2a66f6-0x0;var _0x27e8ac=_0x5f2f[_0x2a66f6];return _0x27e8ac;};'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 7e30deb..2014707 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 _0xed52=['messages','create','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappMessage.attributes','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xed52,0x171));var _0x2ed5=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xed52[_0xbe200f];return _0x192597;};'use strict';var _=require('lodash');var util=require(_0x2ed5('0x0'));var logger=require(_0x2ed5('0x1'))(_0x2ed5('0x2'));var moment=require(_0x2ed5('0x3'));var BPromise=require(_0x2ed5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ed5('0x5'));var rimraf=require(_0x2ed5('0x6'));var config=require(_0x2ed5('0x7'));var attributes=require(_0x2ed5('0x8'));module['exports']=function(_0x460a34,_0x26f10d){return _0x460a34['define'](_0x2ed5('0x9'),attributes,{'tableName':_0x2ed5('0xa'),'paranoid':![],'indexes':[{'name':_0x2ed5('0xb'),'fields':['messageId']},{'name':_0x2ed5('0xc'),'fields':[_0x2ed5('0xd')],'type':_0x2ed5('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x23f2a6,_0x42a829,_0x1a25fc){var _0x27f73e=_0x460a34[_0x2ed5('0xf')];var _0x4e9365=_0x23f2a6['get']({'plain':!![]});if(_0x4e9365[_0x2ed5('0x10')][_0x2ed5('0x11')]()==='in'||_0x4e9365[_0x2ed5('0x10')][_0x2ed5('0x11')]()===_0x2ed5('0x12')&&!_0x4e9365[_0x2ed5('0x13')]&&!_[_0x2ed5('0x14')](_0x4e9365[_0x2ed5('0x15')])){_0x27f73e[_0x2ed5('0x16')]['findOne']({'where':{'id':_0x4e9365[_0x2ed5('0x17')]}})[_0x2ed5('0x18')](function(_0x14f6e1){if(_0x14f6e1){_0x14f6e1[_0x2ed5('0x19')]({'lastMsgAt':_0x4e9365['createdAt'],'lastMsgDirection':_0x4e9365['direction']['toLowerCase']()});}})[_0x2ed5('0x1a')](function(_0x30558e){console[_0x2ed5('0x1b')](_0x30558e);});}if(_0x4e9365[_0x2ed5('0x10')]==='out'&&!_0x4e9365[_0x2ed5('0x13')]){var _0x2497d7;_0x27f73e[_0x2ed5('0x1c')][_0x2ed5('0x1d')]({'where':{'id':_0x4e9365[_0x2ed5('0x1e')]},'raw':!![]})['then'](function(_0x5eb421){_0x2497d7=_0x5eb421;if(_0x2497d7&&_0x2497d7[_0x2ed5('0x1f')]){switch(_0x2497d7[_0x2ed5('0x1f')]){case _0x2ed5('0x20'):var _0x252bb6=require(_0x2ed5('0x20'));if(_0x2497d7[_0x2ed5('0x21')]&&_0x2497d7[_0x2ed5('0x22')]&&_0x2497d7[_0x2ed5('0x23')]){var _0x35a555=new _0x252bb6(_0x2497d7[_0x2ed5('0x21')],_0x2497d7[_0x2ed5('0x22')]);_0x35a555[_0x2ed5('0x24')][_0x2ed5('0x25')]({'body':_0x4e9365[_0x2ed5('0xd')],'to':'whatsapp:'+_0x4e9365[_0x2ed5('0x23')],'from':'whatsapp:'+_0x2497d7['phone'],'statusCallback':_0x2497d7[_0x2ed5('0x26')]+_0x2ed5('0x27')+_0x4e9365['id']+_0x2ed5('0x28')+_0x2497d7['token']})[_0x2ed5('0x18')](function(_0x639b5a){if(_0x639b5a['sid']){return _0x23f2a6[_0x2ed5('0x19')]({'messageId':_0x639b5a[_0x2ed5('0x29')]});}})[_0x2ed5('0x1a')](function(_0x56362a){logger[_0x2ed5('0x1b')](_0x2ed5('0x2a'),_0x2ed5('0x2b'),'twilio',util['inspect'](_0x56362a,{'showHidden':![],'depth':null}));});}else{logger[_0x2ed5('0x1b')](_0x2ed5('0x2a'),_0x2ed5('0x2b'),_0x2ed5('0x20'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})['finally'](function(){_0x1a25fc();});}else{_0x1a25fc();}}},'charset':'utf8mb4','collate':_0x2ed5('0x2c')});}; \ No newline at end of file +var _0x2437=['moment','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','get','direction','toLowerCase','out','isNil','UserId','findOne','WhatsappInteractionId','then','update','catch','error','secret','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','lodash','api'];(function(_0x49ad79,_0x48ee93){var _0xa4e38a=function(_0x4925c7){while(--_0x4925c7){_0x49ad79['push'](_0x49ad79['shift']());}};_0xa4e38a(++_0x48ee93);}(_0x2437,0xb6));var _0x7243=function(_0x37ee23,_0x3862ef){_0x37ee23=_0x37ee23-0x0;var _0x599920=_0x2437[_0x37ee23];return _0x599920;};'use strict';var _=require(_0x7243('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7243('0x1'));var moment=require(_0x7243('0x2'));var BPromise=require('bluebird');var rp=require(_0x7243('0x3'));var fs=require('fs');var path=require(_0x7243('0x4'));var rimraf=require(_0x7243('0x5'));var config=require(_0x7243('0x6'));var attributes=require('./whatsappMessage.attributes');module[_0x7243('0x7')]=function(_0x4249ab,_0x3184b4){return _0x4249ab[_0x7243('0x8')](_0x7243('0x9'),attributes,{'tableName':_0x7243('0xa'),'paranoid':![],'indexes':[{'name':_0x7243('0xb'),'fields':[_0x7243('0xb')]},{'name':_0x7243('0xc'),'fields':[_0x7243('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x59a27c,_0x57063e,_0x4fb6b0){var _0x200ad3=_0x4249ab['models'];var _0x4b5941=_0x59a27c[_0x7243('0xe')]({'plain':!![]});if(_0x4b5941[_0x7243('0xf')][_0x7243('0x10')]()==='in'||_0x4b5941[_0x7243('0xf')]['toLowerCase']()===_0x7243('0x11')&&!_0x4b5941['secret']&&!_[_0x7243('0x12')](_0x4b5941[_0x7243('0x13')])){_0x200ad3['WhatsappInteraction'][_0x7243('0x14')]({'where':{'id':_0x4b5941[_0x7243('0x15')]}})[_0x7243('0x16')](function(_0x10ec20){if(_0x10ec20){_0x10ec20[_0x7243('0x17')]({'lastMsgAt':_0x4b5941['createdAt'],'lastMsgDirection':_0x4b5941[_0x7243('0xf')][_0x7243('0x10')]()});}})[_0x7243('0x18')](function(_0x3a65cc){console[_0x7243('0x19')](_0x3a65cc);});}if(_0x4b5941[_0x7243('0xf')]===_0x7243('0x11')&&!_0x4b5941[_0x7243('0x1a')]){var _0x4f6a08;_0x200ad3[_0x7243('0x1b')][_0x7243('0x1c')]({'where':{'id':_0x4b5941['WhatsappAccountId']},'raw':!![]})[_0x7243('0x16')](function(_0x3e6fb8){_0x4f6a08=_0x3e6fb8;if(_0x4f6a08&&_0x4f6a08[_0x7243('0x1d')]){switch(_0x4f6a08[_0x7243('0x1d')]){case _0x7243('0x1e'):var _0x55f031=require('twilio');if(_0x4f6a08[_0x7243('0x1f')]&&_0x4f6a08[_0x7243('0x20')]&&_0x4f6a08[_0x7243('0x21')]){var _0x3b609d=new _0x55f031(_0x4f6a08[_0x7243('0x1f')],_0x4f6a08[_0x7243('0x20')]);_0x3b609d[_0x7243('0x22')][_0x7243('0x23')]({'body':_0x4b5941[_0x7243('0xd')],'to':'whatsapp:'+_0x4b5941[_0x7243('0x21')],'from':_0x7243('0x24')+_0x4f6a08[_0x7243('0x21')],'statusCallback':_0x4f6a08[_0x7243('0x25')]+_0x7243('0x26')+_0x4b5941['id']+_0x7243('0x27')+_0x4f6a08['token']})['then'](function(_0x505ad1){if(_0x505ad1['sid']){return _0x59a27c[_0x7243('0x17')]({'messageId':_0x505ad1[_0x7243('0x28')]});}})[_0x7243('0x18')](function(_0x3cb0df){logger[_0x7243('0x19')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x7243('0x29'),_0x7243('0x1e'),util[_0x7243('0x2a')](_0x3cb0df,{'showHidden':![],'depth':null}));});}else{logger[_0x7243('0x19')](_0x7243('0x2b'),'afterCreate',_0x7243('0x1e'),_0x7243('0x2c'));}break;}}})['finally'](function(){_0x4fb6b0();});}else{_0x4fb6b0();}}},'charset':_0x7243('0x2d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index f857a5e..1fe2c5e 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 _0xb263=['code','message','result','catch','CreateWhatsappMessage','create','body','options','raw','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xb263,0x195));var _0x3b26=function(_0x18a01b,_0xd559db){_0x18a01b=_0x18a01b-0x0;var _0x4237e0=_0xb263[_0x18a01b];return _0x4237e0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3b26('0x0'));var rs=require(_0x3b26('0x1'));var fs=require('fs');var Redis=require(_0x3b26('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b26('0x3'));var logger=require(_0x3b26('0x4'))(_0x3b26('0x5'));var config=require(_0x3b26('0x6'));var jayson=require(_0x3b26('0x7'));var client=jayson[_0x3b26('0x8')][_0x3b26('0x9')]({'port':0x232a});config['redis']=_[_0x3b26('0xa')](config[_0x3b26('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3b26('0xc'))(new Redis(config[_0x3b26('0xb')]));require(_0x3b26('0xd'))[_0x3b26('0xe')](socket);function respondWithRpcPromise(_0x1ba86f,_0x2c493e,_0x45fddd){return new BPromise(function(_0x23d716,_0x3bab5f){return client[_0x3b26('0xf')](_0x1ba86f,_0x45fddd)[_0x3b26('0x10')](function(_0x371911){logger[_0x3b26('0x11')](_0x3b26('0x12'),_0x2c493e,_0x3b26('0x13'));logger[_0x3b26('0x14')](_0x3b26('0x15'),_0x2c493e,'request\x20sent',JSON[_0x3b26('0x16')](_0x371911));if(_0x371911[_0x3b26('0x17')]){if(_0x371911[_0x3b26('0x17')][_0x3b26('0x18')]===0x1f4){logger[_0x3b26('0x17')](_0x3b26('0x12'),_0x2c493e,_0x371911[_0x3b26('0x17')][_0x3b26('0x19')]);return _0x3bab5f(_0x371911[_0x3b26('0x17')][_0x3b26('0x19')]);}logger[_0x3b26('0x17')](_0x3b26('0x12'),_0x2c493e,_0x371911[_0x3b26('0x17')][_0x3b26('0x19')]);return _0x23d716(_0x371911[_0x3b26('0x17')][_0x3b26('0x19')]);}else{logger[_0x3b26('0x11')](_0x3b26('0x12'),_0x2c493e,'request\x20sent');_0x23d716(_0x371911[_0x3b26('0x1a')][_0x3b26('0x19')]);}})[_0x3b26('0x1b')](function(_0x55a190){logger[_0x3b26('0x17')](_0x3b26('0x12'),_0x2c493e,_0x55a190);_0x3bab5f(_0x55a190);});});}exports[_0x3b26('0x1c')]=function(_0x540205){var _0x4c3213=this;return new Promise(function(_0x887241,_0x59d162){return db['WhatsappMessage'][_0x3b26('0x1d')](_0x540205[_0x3b26('0x1e')],{'raw':_0x540205[_0x3b26('0x1f')]?_0x540205[_0x3b26('0x1f')][_0x3b26('0x20')]===undefined?!![]:![]:!![]})[_0x3b26('0x10')](function(_0x4ac91f){logger['info'](_0x3b26('0x1c'),_0x540205);logger[_0x3b26('0x14')](_0x3b26('0x1c'),_0x540205,JSON['stringify'](_0x4ac91f));_0x887241(_0x4ac91f);})['catch'](function(_0x5bcdd5){logger['error'](_0x3b26('0x1c'),_0x5bcdd5['message'],_0x540205);_0x59d162(_0x4c3213['error'](0x1f4,_0x5bcdd5[_0x3b26('0x19')]));});});}; \ No newline at end of file +var _0x81ba=['debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x81ba,0x1a5));var _0xa81b=function(_0x4adb7a,_0x3ee05d){_0x4adb7a=_0x4adb7a-0x0;var _0x74ab12=_0x81ba[_0x4adb7a];return _0x74ab12;};'use strict';var _=require(_0xa81b('0x0'));var util=require(_0xa81b('0x1'));var moment=require(_0xa81b('0x2'));var BPromise=require(_0xa81b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa81b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa81b('0x5'));var logger=require(_0xa81b('0x6'))(_0xa81b('0x7'));var config=require(_0xa81b('0x8'));var jayson=require(_0xa81b('0x9'));var client=jayson['client'][_0xa81b('0xa')]({'port':0x232a});config[_0xa81b('0xb')]=_[_0xa81b('0xc')](config['redis'],{'host':_0xa81b('0xd'),'port':0x18eb});var socket=require(_0xa81b('0xe'))(new Redis(config[_0xa81b('0xb')]));require(_0xa81b('0xf'))['register'](socket);function respondWithRpcPromise(_0x16ce13,_0xe566bd,_0x12e2c0){return new BPromise(function(_0x20ac3e,_0x3ebed8){return client[_0xa81b('0x10')](_0x16ce13,_0x12e2c0)[_0xa81b('0x11')](function(_0x5175fc){logger[_0xa81b('0x12')](_0xa81b('0x13'),_0xe566bd,_0xa81b('0x14'));logger[_0xa81b('0x15')](_0xa81b('0x16'),_0xe566bd,_0xa81b('0x14'),JSON[_0xa81b('0x17')](_0x5175fc));if(_0x5175fc[_0xa81b('0x18')]){if(_0x5175fc['error'][_0xa81b('0x19')]===0x1f4){logger[_0xa81b('0x18')](_0xa81b('0x13'),_0xe566bd,_0x5175fc[_0xa81b('0x18')][_0xa81b('0x1a')]);return _0x3ebed8(_0x5175fc[_0xa81b('0x18')][_0xa81b('0x1a')]);}logger['error'](_0xa81b('0x13'),_0xe566bd,_0x5175fc[_0xa81b('0x18')][_0xa81b('0x1a')]);return _0x20ac3e(_0x5175fc['error'][_0xa81b('0x1a')]);}else{logger[_0xa81b('0x12')](_0xa81b('0x13'),_0xe566bd,'request\x20sent');_0x20ac3e(_0x5175fc['result'][_0xa81b('0x1a')]);}})[_0xa81b('0x1b')](function(_0x3bf6e7){logger[_0xa81b('0x18')](_0xa81b('0x13'),_0xe566bd,_0x3bf6e7);_0x3ebed8(_0x3bf6e7);});});}exports[_0xa81b('0x1c')]=function(_0x4f19b1){var _0x17aab4=this;return new Promise(function(_0x43913b,_0x4fc9f9){return db[_0xa81b('0x1d')][_0xa81b('0x1e')](_0x4f19b1[_0xa81b('0x1f')],{'raw':_0x4f19b1[_0xa81b('0x20')]?_0x4f19b1[_0xa81b('0x20')][_0xa81b('0x21')]===undefined?!![]:![]:!![]})[_0xa81b('0x11')](function(_0xfecac2){logger[_0xa81b('0x12')](_0xa81b('0x1c'),_0x4f19b1);logger[_0xa81b('0x15')](_0xa81b('0x1c'),_0x4f19b1,JSON[_0xa81b('0x17')](_0xfecac2));_0x43913b(_0xfecac2);})[_0xa81b('0x1b')](function(_0x1d097d){logger[_0xa81b('0x18')]('CreateWhatsappMessage',_0x1d097d[_0xa81b('0x1a')],_0x4f19b1);_0x4fc9f9(_0x17aab4[_0xa81b('0x18')](0x1f4,_0x1d097d['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 9647da5..f8d3e55 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 _0x85e9=['update','emit','register','length','whatsappMessage:','./whatsappMessage.events','save','remove'];(function(_0x24bc5b,_0x4873ca){var _0x426b18=function(_0x1b1d7d){while(--_0x1b1d7d){_0x24bc5b['push'](_0x24bc5b['shift']());}};_0x426b18(++_0x4873ca);}(_0x85e9,0x185));var _0x985e=function(_0x125534,_0x17f651){_0x125534=_0x125534-0x0;var _0x4d7e18=_0x85e9[_0x125534];return _0x4d7e18;};'use strict';var WhatsappMessageEvents=require(_0x985e('0x0'));var events=[_0x985e('0x1'),_0x985e('0x2'),_0x985e('0x3')];function createListener(_0x41b499,_0x41726a){return function(_0x3b00a9){_0x41726a[_0x985e('0x4')](_0x41b499,_0x3b00a9);};}function removeListener(_0x152b54,_0x44e85c){return function(){WhatsappMessageEvents['removeListener'](_0x152b54,_0x44e85c);};}exports[_0x985e('0x5')]=function(_0x43dc5e){for(var _0x3f8533=0x0,_0x59f43c=events[_0x985e('0x6')];_0x3f8533<_0x59f43c;_0x3f8533++){var _0x404ab4=events[_0x3f8533];var _0x1848c7=createListener(_0x985e('0x7')+_0x404ab4,_0x43dc5e);WhatsappMessageEvents['on'](_0x404ab4,_0x1848c7);}}; \ No newline at end of file +var _0xe3e3=['length','whatsappMessage:','remove','update','emit','removeListener','register'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xe3e3,0x9c));var _0x3e3e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xe3e3[_0x3bf83f];return _0x22c4a9;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0x3e3e('0x0'),_0x3e3e('0x1')];function createListener(_0x3fe107,_0x4c2499){return function(_0xce67a2){_0x4c2499[_0x3e3e('0x2')](_0x3fe107,_0xce67a2);};}function removeListener(_0x47fafd,_0x569417){return function(){WhatsappMessageEvents[_0x3e3e('0x3')](_0x47fafd,_0x569417);};}exports[_0x3e3e('0x4')]=function(_0x23388c){for(var _0x222962=0x0,_0x12a63b=events[_0x3e3e('0x5')];_0x222962<_0x12a63b;_0x222962++){var _0x3b19b6=events[_0x222962];var _0x14b006=createListener(_0x3e3e('0x6')+_0x3b19b6,_0x23388c);WhatsappMessageEvents['on'](_0x3b19b6,_0x14b006);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 68e9fee..ec7b1ab 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 _0x6764=['../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','isAuthenticated','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addAgents','put','/:id','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','../../components/auth/service'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x6764,0x1e1));var _0x4676=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x6764[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0x4676('0x0'));var util=require(_0x4676('0x1'));var path=require(_0x4676('0x2'));var timeout=require(_0x4676('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x4676('0x4'));var interaction=require(_0x4676('0x5'));var config=require(_0x4676('0x6'));var controller=require(_0x4676('0x7'));router[_0x4676('0x8')]('/',auth['isAuthenticated'](),controller[_0x4676('0x9')]);router[_0x4676('0x8')](_0x4676('0xa'),auth[_0x4676('0xb')](),controller['describe']);router[_0x4676('0x8')]('/:id',auth[_0x4676('0xb')](),controller[_0x4676('0xc')]);router[_0x4676('0x8')](_0x4676('0xd'),auth[_0x4676('0xb')](),controller[_0x4676('0xe')]);router['get'](_0x4676('0xf'),auth[_0x4676('0xb')](),controller['getTeams']);router[_0x4676('0x8')](_0x4676('0x10'),auth[_0x4676('0xb')](),controller[_0x4676('0x11')]);router['post']('/',auth[_0x4676('0xb')](),controller['create']);router['post'](_0x4676('0xf'),auth['isAuthenticated'](),controller['addTeams']);router[_0x4676('0x12')](_0x4676('0x10'),auth[_0x4676('0xb')](),controller[_0x4676('0x13')]);router[_0x4676('0x14')](_0x4676('0x15'),auth[_0x4676('0xb')](),controller[_0x4676('0x16')]);router[_0x4676('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/teams',auth[_0x4676('0xb')](),controller[_0x4676('0x18')]);router[_0x4676('0x17')](_0x4676('0x10'),auth['isAuthenticated'](),controller[_0x4676('0x19')]);module[_0x4676('0x1a')]=router; \ No newline at end of file +var _0x6864=['exports','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','update','delete','removeTeams','removeAgents'];(function(_0x42a5d1,_0x5ca20a){var _0x34702c=function(_0x43b53f){while(--_0x43b53f){_0x42a5d1['push'](_0x42a5d1['shift']());}};_0x34702c(++_0x5ca20a);}(_0x6864,0xfd));var _0x4686=function(_0x1a0b13,_0x5424ba){_0x1a0b13=_0x1a0b13-0x0;var _0x12490b=_0x6864[_0x1a0b13];return _0x12490b;};'use strict';var multer=require('multer');var util=require(_0x4686('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4686('0x1'));var router=express['Router']();var auth=require(_0x4686('0x2'));var interaction=require(_0x4686('0x3'));var config=require(_0x4686('0x4'));var controller=require(_0x4686('0x5'));router[_0x4686('0x6')]('/',auth['isAuthenticated'](),controller[_0x4686('0x7')]);router[_0x4686('0x6')](_0x4686('0x8'),auth[_0x4686('0x9')](),controller[_0x4686('0xa')]);router[_0x4686('0x6')](_0x4686('0xb'),auth['isAuthenticated'](),controller[_0x4686('0xc')]);router[_0x4686('0x6')](_0x4686('0xd'),auth[_0x4686('0x9')](),controller[_0x4686('0xe')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0x4686('0xf')]);router[_0x4686('0x6')](_0x4686('0x10'),auth[_0x4686('0x9')](),controller[_0x4686('0x11')]);router[_0x4686('0x12')]('/',auth[_0x4686('0x9')](),controller[_0x4686('0x13')]);router[_0x4686('0x12')](_0x4686('0x14'),auth[_0x4686('0x9')](),controller[_0x4686('0x15')]);router[_0x4686('0x12')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x4686('0x16')]('/:id',auth[_0x4686('0x9')](),controller[_0x4686('0x17')]);router[_0x4686('0x18')]('/:id',auth[_0x4686('0x9')](),controller['destroy']);router[_0x4686('0x18')](_0x4686('0x14'),auth[_0x4686('0x9')](),controller[_0x4686('0x19')]);router[_0x4686('0x18')]('/:id/users',auth[_0x4686('0x9')](),controller[_0x4686('0x1a')]);module[_0x4686('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 f055e0f..eae7a44 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 _0x0980=['exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x4d6678,_0x335efd){var _0x1c8760=function(_0x4d750e){while(--_0x4d750e){_0x4d6678['push'](_0x4d6678['shift']());}};_0x1c8760(++_0x335efd);}(_0x0980,0x14f));var _0x0098=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x0980[_0x36ed48];return _0x51c63a;};'use strict';var Sequelize=require(_0x0098('0x0'));module[_0x0098('0x1')]={'name':{'type':Sequelize[_0x0098('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x0098('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0098('0x4')](_0x0098('0x5'),_0x0098('0x6'),_0x0098('0x7'))},'description':{'type':Sequelize[_0x0098('0x2')]}}; \ No newline at end of file +var _0xfa02=['STRING','name','ENUM','rrmemory','roundrobin'];(function(_0x46d4f6,_0x1247b2){var _0x1900b5=function(_0x1c7808){while(--_0x1c7808){_0x46d4f6['push'](_0x46d4f6['shift']());}};_0x1900b5(++_0x1247b2);}(_0xfa02,0x7d));var _0x2fa0=function(_0x39f63b,_0x16d5ec){_0x39f63b=_0x39f63b-0x0;var _0x58ecec=_0xfa02[_0x39f63b];return _0x58ecec;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2fa0('0x0')],'unique':_0x2fa0('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2fa0('0x2')](_0x2fa0('0x3'),'beepall',_0x2fa0('0x4'))},'description':{'type':Sequelize[_0x2fa0('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index ba123d4..f193259 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 _0xf7ce=['save','update','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','filtears','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','User','agent','whatsappPause','updatedAt','createdAt','format','getTeams','Team','addTeams','Agents','online','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userWhatsappQueue:save','ids','select','field','team_has_whatsapp_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','includes','all','union','compact','value','transaction','removeTeams','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','json','count','offset','limit','Content-Range','apply','reject'];(function(_0x101802,_0x11f913){var _0x5d61ce=function(_0x4acc0){while(--_0x4acc0){_0x101802['push'](_0x101802['shift']());}};_0x5d61ce(++_0x11f913);}(_0xf7ce,0x65));var _0xef7c=function(_0x152998,_0x673cc5){_0x152998=_0x152998-0x0;var _0x348f90=_0xf7ce[_0x152998];return _0x348f90;};'use strict';var pdf=require(_0xef7c('0x0'));var emlformat=require(_0xef7c('0x1'));var rimraf=require(_0xef7c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xef7c('0x3'));var rp=require(_0xef7c('0x4'));var moment=require('moment');var BPromise=require(_0xef7c('0x5'));var Mustache=require(_0xef7c('0x6'));var util=require(_0xef7c('0x7'));var path=require(_0xef7c('0x8'));var sox=require(_0xef7c('0x9'));var csv=require('to-csv');var ejs=require(_0xef7c('0xa'));var fs=require('fs');var _=require(_0xef7c('0xb'));var squel=require(_0xef7c('0xc'));var crypto=require(_0xef7c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xef7c('0xe'));var toCsv=require(_0xef7c('0xf'));var querystring=require(_0xef7c('0x10'));var Papa=require(_0xef7c('0x11'));var Redis=require(_0xef7c('0x12'));var authService=require(_0xef7c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xef7c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xef7c('0x15'))('api');var utils=require(_0xef7c('0x16'));var config=require(_0xef7c('0x17'));var licenseUtil=require(_0xef7c('0x18'));var db=require('../../mysqldb')['db'];config[_0xef7c('0x19')]=_[_0xef7c('0x1a')](config['redis'],{'host':_0xef7c('0x1b'),'port':0x18eb});var socket=require(_0xef7c('0x1c'))(new Redis(config['redis']));require(_0xef7c('0x1d'))[_0xef7c('0x1e')](socket);function respondWithStatusCode(_0x34d580,_0x17e1bf){_0x17e1bf=_0x17e1bf||0xcc;return function(_0x244ab5){if(_0x244ab5){return _0x34d580['sendStatus'](_0x17e1bf);}return _0x34d580[_0xef7c('0x1f')](_0x17e1bf)[_0xef7c('0x20')]();};}function respondWithResult(_0x4ee52e,_0xcdfc3d){_0xcdfc3d=_0xcdfc3d||0xc8;return function(_0x388523){if(_0x388523){return _0x4ee52e[_0xef7c('0x1f')](_0xcdfc3d)[_0xef7c('0x21')](_0x388523);}};}function respondWithFilteredResult(_0x40be79,_0x1955e0){return function(_0x392637){if(_0x392637){var _0x3162e8=_0x392637[_0xef7c('0x22')],_0x5c65b0=_0x1955e0[_0xef7c('0x23')],_0x5e5fcc=_0x1955e0[_0xef7c('0x23')]+_0x1955e0[_0xef7c('0x24')],_0x33df91;if(_0x5e5fcc>=_0x3162e8){_0x5e5fcc=_0x3162e8;_0x33df91=0xc8;}else{_0x33df91=0xce;}_0x40be79[_0xef7c('0x1f')](_0x33df91);return _0x40be79['set'](_0xef7c('0x25'),_0x5c65b0+'-'+_0x5e5fcc+'/'+_0x3162e8)['json'](_0x392637);}return null;};}function patchUpdates(_0x325fa0){return function(_0x1b44ee){try{jsonpatch[_0xef7c('0x26')](_0x1b44ee,_0x325fa0,!![]);}catch(_0x470d5a){return BPromise[_0xef7c('0x27')](_0x470d5a);}return _0x1b44ee[_0xef7c('0x28')]();};}function saveUpdates(_0xdd7106,_0xf0842e){return function(_0x58e6ee){if(_0x58e6ee){return _0x58e6ee[_0xef7c('0x29')](_0xdd7106)[_0xef7c('0x2a')](function(_0x259556){return _0x259556;});}return null;};}function removeEntity(_0x5bd364,_0x431347){return function(_0x151985){if(_0x151985){return _0x151985['destroy']()['then'](function(){var _0x2da15c=_0x151985[_0xef7c('0x2b')]({'plain':!![]});var _0x287ee0=_0xef7c('0x2c');return db[_0xef7c('0x2d')][_0xef7c('0x2e')]({'where':{'type':_0x287ee0,'resourceId':_0x2da15c['id']}})[_0xef7c('0x2a')](function(){return _0x151985;});})[_0xef7c('0x2a')](function(){_0x5bd364['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59af40,_0x546b60){return function(_0x940ea2){if(!_0x940ea2){_0x59af40['sendStatus'](0x194);}return _0x940ea2;};}function handleError(_0x19bc1b,_0x4aeca2){_0x4aeca2=_0x4aeca2||0x1f4;return function(_0x5c495a){logger[_0xef7c('0x2f')](_0x5c495a[_0xef7c('0x30')]);if(_0x5c495a['name']){delete _0x5c495a[_0xef7c('0x31')];}_0x19bc1b[_0xef7c('0x1f')](_0x4aeca2)[_0xef7c('0x32')](_0x5c495a);};}exports[_0xef7c('0x33')]=function(_0x13dace,_0x556b69){var _0x4e2bf8={},_0x2a87f0={},_0x551fe6={'count':0x0,'rows':[]};var _0x29e403=_[_0xef7c('0x34')](db[_0xef7c('0x35')][_0xef7c('0x36')],function(_0x2e0818){return{'name':_0x2e0818['fieldName'],'type':_0x2e0818[_0xef7c('0x37')][_0xef7c('0x38')]};});_0x2a87f0[_0xef7c('0x39')]=_['map'](_0x29e403,_0xef7c('0x31'));_0x2a87f0['query']=_[_0xef7c('0x3a')](_0x13dace[_0xef7c('0x3b')]);_0x2a87f0['filters']=_[_0xef7c('0x3c')](_0x2a87f0[_0xef7c('0x39')],_0x2a87f0[_0xef7c('0x3b')]);_0x4e2bf8['attributes']=_[_0xef7c('0x3c')](_0x2a87f0['model'],qs[_0xef7c('0x3d')](_0x13dace[_0xef7c('0x3b')][_0xef7c('0x3d')]));_0x4e2bf8[_0xef7c('0x3e')]=_0x4e2bf8[_0xef7c('0x3e')][_0xef7c('0x3f')]?_0x4e2bf8[_0xef7c('0x3e')]:_0x2a87f0['model'];if(!_0x13dace[_0xef7c('0x3b')][_0xef7c('0x40')](_0xef7c('0x41'))){_0x4e2bf8[_0xef7c('0x24')]=qs[_0xef7c('0x24')](_0x13dace[_0xef7c('0x3b')][_0xef7c('0x24')]);_0x4e2bf8[_0xef7c('0x23')]=qs[_0xef7c('0x23')](_0x13dace[_0xef7c('0x3b')][_0xef7c('0x23')]);}_0x4e2bf8[_0xef7c('0x42')]=qs[_0xef7c('0x43')](_0x13dace['query'][_0xef7c('0x43')]);_0x4e2bf8[_0xef7c('0x44')]=qs[_0xef7c('0x45')](_[_0xef7c('0x46')](_0x13dace['query'],_0x2a87f0['filters']),_0x29e403);if(_0x13dace[_0xef7c('0x3b')][_0xef7c('0x47')]){_0x4e2bf8[_0xef7c('0x44')]=_[_0xef7c('0x48')](_0x4e2bf8['where'],{'$or':_[_0xef7c('0x34')](_0x29e403,function(_0x5a1a68){if(_0x5a1a68[_0xef7c('0x37')]!==_0xef7c('0x49')){var _0x4ced06={};_0x4ced06[_0x5a1a68['name']]={'$like':'%'+_0x13dace[_0xef7c('0x3b')][_0xef7c('0x47')]+'%'};return _0x4ced06;}})});}_0x4e2bf8=_[_0xef7c('0x48')]({},_0x4e2bf8,_0x13dace[_0xef7c('0x4a')]);var _0x4c5cd9={'where':_0x4e2bf8[_0xef7c('0x44')]};return db['WhatsappQueue'][_0xef7c('0x22')](_0x4c5cd9)['then'](function(_0x2a6459){_0x551fe6['count']=_0x2a6459;if(_0x13dace[_0xef7c('0x3b')]['includeAll']){_0x4e2bf8[_0xef7c('0x4b')]=[{'all':!![]}];}return db[_0xef7c('0x35')][_0xef7c('0x4c')](_0x4e2bf8);})[_0xef7c('0x2a')](function(_0x163737){_0x551fe6[_0xef7c('0x4d')]=_0x163737;return _0x551fe6;})[_0xef7c('0x2a')](respondWithFilteredResult(_0x556b69,_0x4e2bf8))[_0xef7c('0x4e')](handleError(_0x556b69,null));};exports[_0xef7c('0x4f')]=function(_0x7a142a,_0x13d2dd){var _0x533e9e={'raw':!![],'where':{'id':_0x7a142a[_0xef7c('0x50')]['id']}},_0x3c1eda={};_0x3c1eda[_0xef7c('0x39')]=_[_0xef7c('0x3a')](db[_0xef7c('0x35')][_0xef7c('0x36')]);_0x3c1eda[_0xef7c('0x3b')]=_[_0xef7c('0x3a')](_0x7a142a[_0xef7c('0x3b')]);_0x3c1eda[_0xef7c('0x51')]=_[_0xef7c('0x3c')](_0x3c1eda[_0xef7c('0x39')],_0x3c1eda[_0xef7c('0x3b')]);_0x533e9e['attributes']=_[_0xef7c('0x3c')](_0x3c1eda['model'],qs[_0xef7c('0x3d')](_0x7a142a[_0xef7c('0x3b')][_0xef7c('0x3d')]));_0x533e9e['attributes']=_0x533e9e['attributes'][_0xef7c('0x3f')]?_0x533e9e[_0xef7c('0x3e')]:_0x3c1eda[_0xef7c('0x39')];if(_0x7a142a[_0xef7c('0x3b')][_0xef7c('0x52')]){_0x533e9e[_0xef7c('0x4b')]=[{'all':!![]}];}_0x533e9e=_[_0xef7c('0x48')]({},_0x533e9e,_0x7a142a['options']);return db[_0xef7c('0x35')]['find'](_0x533e9e)[_0xef7c('0x2a')](handleEntityNotFound(_0x13d2dd,null))[_0xef7c('0x2a')](respondWithResult(_0x13d2dd,null))[_0xef7c('0x4e')](handleError(_0x13d2dd,null));};exports[_0xef7c('0x53')]=function(_0x57c768,_0x14467e){return db[_0xef7c('0x35')]['create'](_0x57c768[_0xef7c('0x54')],{})[_0xef7c('0x2a')](function(_0x41a783){var _0x5a64fa=_0x57c768['user']['get']({'plain':!![]});if(!_0x5a64fa)throw new Error(_0xef7c('0x55'));if(_0x5a64fa[_0xef7c('0x56')]===_0xef7c('0x57')){var _0x569448=_0x41a783[_0xef7c('0x2b')]({'plain':!![]});var _0x4421e0=_0xef7c('0x2c');return db[_0xef7c('0x58')][_0xef7c('0x59')]({'where':{'name':_0x4421e0,'userProfileId':_0x5a64fa['userProfileId']},'raw':!![]})['then'](function(_0x5b0045){if(_0x5b0045&&_0x5b0045['autoAssociation']===0x0){return db[_0xef7c('0x2d')][_0xef7c('0x53')]({'name':_0x569448[_0xef7c('0x31')],'resourceId':_0x569448['id'],'type':_0x5b0045[_0xef7c('0x31')],'sectionId':_0x5b0045['id']},{})[_0xef7c('0x2a')](function(){return _0x41a783;});}else{return _0x41a783;}})[_0xef7c('0x4e')](function(_0x24ab64){logger[_0xef7c('0x2f')](_0xef7c('0x5a'),_0x24ab64);throw _0x24ab64;});}return _0x41a783;})['then'](respondWithResult(_0x14467e,0xc9))[_0xef7c('0x4e')](handleError(_0x14467e,null));};exports[_0xef7c('0x29')]=function(_0x41368a,_0x40e951){if(_0x41368a[_0xef7c('0x54')]['id']){delete _0x41368a['body']['id'];}return db['WhatsappQueue'][_0xef7c('0x59')]({'where':{'id':_0x41368a['params']['id']}})[_0xef7c('0x2a')](handleEntityNotFound(_0x40e951,null))[_0xef7c('0x2a')](saveUpdates(_0x41368a[_0xef7c('0x54')],null))[_0xef7c('0x2a')](respondWithResult(_0x40e951,null))['catch'](handleError(_0x40e951,null));};exports[_0xef7c('0x2e')]=function(_0x3b0519,_0x3614b1){return db[_0xef7c('0x35')]['find']({'where':{'id':_0x3b0519[_0xef7c('0x50')]['id']}})[_0xef7c('0x2a')](handleEntityNotFound(_0x3614b1,null))['then'](removeEntity(_0x3614b1,null))[_0xef7c('0x4e')](handleError(_0x3614b1,null));};exports[_0xef7c('0x5b')]=function(_0x386877,_0x25793d){return db[_0xef7c('0x35')][_0xef7c('0x5b')]()['then'](respondWithResult(_0x25793d,null))[_0xef7c('0x4e')](handleError(_0x25793d,null));};exports[_0xef7c('0x5c')]=function(_0x2d565e,_0x4a7f97,_0x1eb89a){var _0x4b578f={'raw':!![],'where':{}},_0x148944={},_0x3d0877;return db[_0xef7c('0x35')][_0xef7c('0x5d')]({'where':{'id':_0x2d565e[_0xef7c('0x50')]['id']}})['then'](handleEntityNotFound(_0x4a7f97,null))[_0xef7c('0x2a')](function(_0x10ec25){if(_0x10ec25){_0x3d0877=_0x10ec25['get']({'plain':!![]});_0x148944[_0xef7c('0x39')]=_[_0xef7c('0x3a')](db[_0xef7c('0x5e')][_0xef7c('0x36')]);_0x148944['query']=_[_0xef7c('0x3a')](_0x2d565e[_0xef7c('0x3b')]);_0x148944[_0xef7c('0x45')]=_[_0xef7c('0x3c')](_0x148944[_0xef7c('0x39')],_0x148944['query']);_0x4b578f['attributes']=_[_0xef7c('0x3c')](_0x148944[_0xef7c('0x39')],qs[_0xef7c('0x3d')](_0x2d565e[_0xef7c('0x3b')]['fields']));_0x4b578f['attributes']=_0x4b578f[_0xef7c('0x3e')]['length']?_0x4b578f[_0xef7c('0x3e')]:_0x148944[_0xef7c('0x39')];if(!_0x2d565e[_0xef7c('0x3b')][_0xef7c('0x40')](_0xef7c('0x41'))){_0x4b578f[_0xef7c('0x24')]=qs[_0xef7c('0x24')](_0x2d565e['query'][_0xef7c('0x24')]);_0x4b578f['offset']=qs[_0xef7c('0x23')](_0x2d565e[_0xef7c('0x3b')][_0xef7c('0x23')]);}_0x4b578f[_0xef7c('0x42')]=qs[_0xef7c('0x43')](_0x2d565e[_0xef7c('0x3b')][_0xef7c('0x43')]);_0x4b578f['where']=qs['filters'](_[_0xef7c('0x46')](_0x2d565e[_0xef7c('0x3b')],_0x148944[_0xef7c('0x45')]));_0x4b578f[_0xef7c('0x44')][_0xef7c('0x5f')]=_0x10ec25['id'];if(_0x2d565e[_0xef7c('0x3b')]['filter']){_0x4b578f['where']=_[_0xef7c('0x48')](_0x4b578f[_0xef7c('0x44')],{'$or':_['map'](_0x4b578f['attributes'],function(_0x353846){var _0x4588f5={};_0x4588f5[_0x353846]={'$like':'%'+_0x2d565e[_0xef7c('0x3b')][_0xef7c('0x47')]+'%'};return _0x4588f5;})});}_0x4b578f=_[_0xef7c('0x48')]({},_0x4b578f,_0x2d565e[_0xef7c('0x4a')]);return db['UserWhatsappQueue'][_0xef7c('0x4c')](_0x4b578f);}})[_0xef7c('0x2a')](function(_0x5f396d){if(_0x5f396d){return db[_0xef7c('0x60')]['findAndCountAll']({'where':{'id':_['map'](_0x5f396d,'UserId'),'role':_0xef7c('0x61')},'attributes':['id',_0xef7c('0x31'),_0xef7c('0x62'),_0xef7c('0x63'),_0xef7c('0x64')]});}})[_0xef7c('0x2a')](function(_0x209c92){if(_0x209c92){return{'count':_0x209c92[_0xef7c('0x22')],'rows':_[_0xef7c('0x34')](_0x209c92['rows'],function(_0x4cf3af){return{'membername':_0x4cf3af[_0xef7c('0x31')],'UserId':_0x4cf3af['id'],'queue_name':_0x3d0877['name'],'WhatsappQueueId':_0x3d0877['id'],'interface':util[_0xef7c('0x65')]('%s/%s','SIP',_0x4cf3af['name']),'penalty':0x0,'paused':_0x4cf3af[_0xef7c('0x62')],'createdAt':_0x4cf3af[_0xef7c('0x64')],'updatedAt':_0x4cf3af[_0xef7c('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xef7c('0x2a')](respondWithFilteredResult(_0x4a7f97,_0x4b578f))[_0xef7c('0x4e')](handleError(_0x4a7f97,null));};exports[_0xef7c('0x66')]=function(_0x35627a,_0x3324f0,_0x29404b){var _0x38627c={};var _0x42c463={};var _0x429392;var _0x382e52;return db[_0xef7c('0x35')][_0xef7c('0x5d')]({'where':{'id':_0x35627a[_0xef7c('0x50')]['id']}})[_0xef7c('0x2a')](handleEntityNotFound(_0x3324f0,null))[_0xef7c('0x2a')](function(_0x496c80){if(_0x496c80){_0x429392=_0x496c80;_0x42c463[_0xef7c('0x39')]=_[_0xef7c('0x3a')](db[_0xef7c('0x67')]['rawAttributes']);_0x42c463[_0xef7c('0x3b')]=_[_0xef7c('0x3a')](_0x35627a[_0xef7c('0x3b')]);_0x42c463[_0xef7c('0x45')]=_[_0xef7c('0x3c')](_0x42c463[_0xef7c('0x39')],_0x42c463[_0xef7c('0x3b')]);_0x38627c['attributes']=_[_0xef7c('0x3c')](_0x42c463[_0xef7c('0x39')],qs['fields'](_0x35627a['query'][_0xef7c('0x3d')]));_0x38627c[_0xef7c('0x3e')]=_0x38627c[_0xef7c('0x3e')][_0xef7c('0x3f')]?_0x38627c[_0xef7c('0x3e')]:_0x42c463['model'];_0x38627c[_0xef7c('0x42')]=qs[_0xef7c('0x43')](_0x35627a['query']['sort']);_0x38627c[_0xef7c('0x44')]=qs[_0xef7c('0x45')](_[_0xef7c('0x46')](_0x35627a[_0xef7c('0x3b')],_0x42c463[_0xef7c('0x45')]));if(_0x35627a[_0xef7c('0x3b')]['filter']){_0x38627c['where']=_['merge'](_0x38627c[_0xef7c('0x44')],{'$or':_[_0xef7c('0x34')](_0x38627c[_0xef7c('0x3e')],function(_0x10ee31){var _0x6a445f={};_0x6a445f[_0x10ee31]={'$like':'%'+_0x35627a['query'][_0xef7c('0x47')]+'%'};return _0x6a445f;})});}_0x38627c=_[_0xef7c('0x48')]({},_0x38627c,_0x35627a['options']);return _0x429392[_0xef7c('0x66')](_0x38627c);}})['then'](function(_0x4d6801){if(_0x4d6801){_0x382e52=_0x4d6801[_0xef7c('0x3f')];if(!_0x35627a[_0xef7c('0x3b')][_0xef7c('0x40')]('nolimit')){_0x38627c[_0xef7c('0x24')]=qs['limit'](_0x35627a[_0xef7c('0x3b')]['limit']);_0x38627c[_0xef7c('0x23')]=qs[_0xef7c('0x23')](_0x35627a[_0xef7c('0x3b')][_0xef7c('0x23')]);}return _0x429392[_0xef7c('0x66')](_0x38627c);}})[_0xef7c('0x2a')](function(_0x244f92){if(_0x244f92){return _0x244f92?{'count':_0x382e52,'rows':_0x244f92}:null;}})['then'](respondWithResult(_0x3324f0,null))['catch'](handleError(_0x3324f0,null));};exports[_0xef7c('0x68')]=function(_0xb3d435,_0x3dadc9,_0x2093c3){var _0x1e6084=_0xb3d435[_0xef7c('0x54')]['ids'];return db[_0xef7c('0x67')][_0xef7c('0x4c')]({'where':{'id':_0x1e6084},'attributes':['id'],'include':[{'model':db[_0xef7c('0x60')],'as':_0xef7c('0x69'),'attributes':['id',_0xef7c('0x31'),_0xef7c('0x6a'),'voicePause',_0xef7c('0x6b')],'raw':!![]}]})['then'](function(_0x4a222c){if(_0x4a222c){var _0x5c77f1=_[_0xef7c('0x6c')](_0x4a222c,function(_0x5a2d06){var _0x210a2c=_0x5a2d06[_0xef7c('0x2b')]({'plain':!![]});return _0x210a2c[_0xef7c('0x69')];});return db[_0xef7c('0x35')]['find']({'where':{'id':_0xb3d435['params']['id']}})[_0xef7c('0x2a')](function(_0x2c5b9c){return db[_0xef7c('0x6d')]['transaction'](function(_0x33a5bf){return _0x2c5b9c[_0xef7c('0x68')](_0x1e6084,{'transaction':_0x33a5bf})[_0xef7c('0x2a')](function(){return BPromise[_0xef7c('0x6e')](_0x5c77f1,function(_0x151ed8){return db['UserWhatsappQueue'][_0xef7c('0x6f')]({'where':{'UserId':_0x151ed8['id'],'WhatsappQueueId':_0xb3d435[_0xef7c('0x50')]['id']},'transaction':_0x33a5bf});});})['then'](function(){_0x5c77f1[_0xef7c('0x70')](function(_0x15ab36){socket[_0xef7c('0x71')](_0xef7c('0x72'),{'UserId':_0x15ab36['id'],'WhatsappQueueId':_0x2c5b9c['id']});});});});});}})['then'](respondWithStatusCode(_0x3dadc9,null))[_0xef7c('0x4e')](handleError(_0x3dadc9,null));};exports['removeTeams']=function(_0x15ed79,_0x4c4f93,_0x1b58b5){return db[_0xef7c('0x67')][_0xef7c('0x4c')]({'where':{'id':_0x15ed79[_0xef7c('0x3b')][_0xef7c('0x73')]},'attributes':['id'],'include':[{'model':db[_0xef7c('0x60')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4c4f93,null))[_0xef7c('0x2a')](function(_0x1bfea3){var _0x1ed849=_[_0xef7c('0x34')](_0x1bfea3,'id');var _0xf4643a=[];var _0x5a75e1=[];var _0x2432f2=squel[_0xef7c('0x74')]();_0x2432f2[_0xef7c('0x75')]('tq.TeamId')['from'](_0xef7c('0x76'),'tq')[_0xef7c('0x77')](_0xef7c('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('WhatsappQueueId\x20=\x20?',_0x15ed79[_0xef7c('0x50')]['id']);for(var _0x5deed5=0x0;_0x5deed5<_0x1bfea3['length'];_0x5deed5+=0x1){let _0x3fef94=_0x1bfea3[_0x5deed5];for(var _0x4b320e=0x0;_0x4b320e<_0x3fef94['Agents'][_0xef7c('0x3f')];_0x4b320e+=0x1){let _0x26a727=_0x3fef94['Agents'][_0x4b320e];var _0x2284f2=_0x2432f2[_0xef7c('0x79')]();_0x2284f2['where'](_0xef7c('0x7a'),_0x26a727['id']);_0x5a75e1[_0xef7c('0x7b')](db['sequelize'][_0xef7c('0x3b')](_0x2284f2[_0xef7c('0x7c')](),{'type':db[_0xef7c('0x6d')]['QueryTypes'][_0xef7c('0x7d')]})[_0xef7c('0x2a')](function(_0x266cf3){if(_0x266cf3[_0xef7c('0x3f')]===0x1){return _0x26a727['id'];}else{var _0x429ec3=_['every'](_[_0xef7c('0x34')](_0x266cf3,_0xef7c('0x7e')),function(_0x539f1a){return _[_0xef7c('0x7f')](_0x1ed849,_0x539f1a);});if(_0x429ec3){return _0x26a727['id'];}}}));}}return BPromise[_0xef7c('0x80')](_0x5a75e1)[_0xef7c('0x2a')](function(_0x48b7f4){_0xf4643a=_(_0xf4643a)[_0xef7c('0x81')](_0x48b7f4)[_0xef7c('0x82')]()[_0xef7c('0x83')]();return db[_0xef7c('0x35')][_0xef7c('0x59')]({'where':{'id':_0x15ed79[_0xef7c('0x50')]['id']}})['then'](function(_0x44ebe9){return db['sequelize'][_0xef7c('0x84')](function(_0x3576e2){return _0x44ebe9[_0xef7c('0x85')](_0x15ed79[_0xef7c('0x3b')]['ids'],{'transaction':_0x3576e2})[_0xef7c('0x2a')](function(){if(!_['isEmpty'](_0xf4643a)){return _0x44ebe9[_0xef7c('0x86')](_0xf4643a,{'transaction':_0x3576e2});}})[_0xef7c('0x2a')](function(){_0xf4643a[_0xef7c('0x70')](function(_0x5cca80){socket[_0xef7c('0x71')](_0xef7c('0x87'),{'UserId':_0x5cca80,'WhatsappQueueId':_0x44ebe9['id']});});});});});});})[_0xef7c('0x2a')](respondWithStatusCode(_0x4c4f93,null))[_0xef7c('0x4e')](handleError(_0x4c4f93,null));};exports[_0xef7c('0x88')]=function(_0xd9ac55,_0x3a6049,_0x454f2e){return db[_0xef7c('0x35')][_0xef7c('0x59')]({'where':{'id':_0xd9ac55['params']['id']}})[_0xef7c('0x2a')](handleEntityNotFound(_0x3a6049,null))['then'](function(_0x449058){if(_0x449058){return _0x449058[_0xef7c('0x88')](_0xd9ac55['body'][_0xef7c('0x73')],_[_0xef7c('0x89')](_0xd9ac55[_0xef7c('0x54')],[_0xef7c('0x73'),'id'])||{})[_0xef7c('0x8a')](function(_0x2cbdc5){for(var _0x531460=0x0;_0x531460<_0xd9ac55[_0xef7c('0x54')][_0xef7c('0x73')]['length'];_0x531460+=0x1){socket[_0xef7c('0x71')](_0xef7c('0x72'),{'UserId':_0xd9ac55[_0xef7c('0x54')][_0xef7c('0x73')][_0x531460],'WhatsappQueueId':_0xd9ac55[_0xef7c('0x50')]['id']});}return _0x2cbdc5;});}})['then'](respondWithResult(_0x3a6049,null))[_0xef7c('0x4e')](handleError(_0x3a6049,null));};exports[_0xef7c('0x86')]=function(_0x21e3f1,_0x45e250,_0x2d29c6){return db[_0xef7c('0x35')][_0xef7c('0x59')]({'where':{'id':_0x21e3f1['params']['id']}})[_0xef7c('0x2a')](handleEntityNotFound(_0x45e250,null))[_0xef7c('0x2a')](function(_0x18ec82){if(_0x18ec82){return _0x18ec82[_0xef7c('0x86')](_0x21e3f1[_0xef7c('0x3b')]['ids'])[_0xef7c('0x2a')](function(){if(_[_0xef7c('0x8b')](_0x21e3f1[_0xef7c('0x3b')][_0xef7c('0x73')])){for(var _0x3c955c=0x0;_0x3c955c<_0x21e3f1['query'][_0xef7c('0x73')][_0xef7c('0x3f')];_0x3c955c+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x21e3f1[_0xef7c('0x3b')]['ids'][_0x3c955c]),'WhatsappQueueId':Number(_0x21e3f1['params']['id'])});}}else{socket[_0xef7c('0x71')](_0xef7c('0x87'),{'UserId':Number(_0x21e3f1['query'][_0xef7c('0x73')]),'WhatsappQueueId':Number(_0x21e3f1[_0xef7c('0x50')]['id'])});}});}})[_0xef7c('0x2a')](respondWithStatusCode(_0x45e250,null))[_0xef7c('0x4e')](handleError(_0x45e250,null));};exports[_0xef7c('0x8c')]=function(_0x41e50e,_0x29c808,_0x26ea72){var _0x5aed2c={};var _0xd8df81={};var _0x1ca997;var _0x571649;return db['WhatsappQueue'][_0xef7c('0x5d')]({'where':{'id':_0x41e50e[_0xef7c('0x50')]['id']}})['then'](handleEntityNotFound(_0x29c808,null))[_0xef7c('0x2a')](function(_0x27173c){if(_0x27173c){_0x1ca997=_0x27173c;_0xd8df81[_0xef7c('0x39')]=_[_0xef7c('0x3a')](db[_0xef7c('0x60')][_0xef7c('0x36')]);_0xd8df81[_0xef7c('0x3b')]=_[_0xef7c('0x3a')](_0x41e50e['query']);_0xd8df81[_0xef7c('0x45')]=_[_0xef7c('0x3c')](_0xd8df81[_0xef7c('0x39')],_0xd8df81[_0xef7c('0x3b')]);_0x5aed2c[_0xef7c('0x3e')]=_[_0xef7c('0x3c')](_0xd8df81['model'],qs[_0xef7c('0x3d')](_0x41e50e[_0xef7c('0x3b')][_0xef7c('0x3d')]));_0x5aed2c[_0xef7c('0x3e')]=_0x5aed2c[_0xef7c('0x3e')][_0xef7c('0x3f')]?_0x5aed2c[_0xef7c('0x3e')]:_0xd8df81[_0xef7c('0x39')];_0x5aed2c['order']=qs[_0xef7c('0x43')](_0x41e50e[_0xef7c('0x3b')][_0xef7c('0x43')]);_0x5aed2c[_0xef7c('0x44')]=qs['filters'](_[_0xef7c('0x46')](_0x41e50e[_0xef7c('0x3b')],_0xd8df81['filters']));if(_0x41e50e['query']['filter']){_0x5aed2c[_0xef7c('0x44')]=_[_0xef7c('0x48')](_0x5aed2c[_0xef7c('0x44')],{'$or':_['map'](_0x5aed2c['attributes'],function(_0x5af5eb){var _0x2a8773={};_0x2a8773[_0x5af5eb]={'$like':'%'+_0x41e50e[_0xef7c('0x3b')][_0xef7c('0x47')]+'%'};return _0x2a8773;})});}_0x5aed2c=_['merge']({},_0x5aed2c,_0x41e50e[_0xef7c('0x4a')]);return _0x1ca997[_0xef7c('0x8c')](_0x5aed2c);}})[_0xef7c('0x2a')](function(_0x19b3fd){if(_0x19b3fd){_0x571649=_0x19b3fd[_0xef7c('0x3f')];if(!_0x41e50e[_0xef7c('0x3b')][_0xef7c('0x40')]('nolimit')){_0x5aed2c[_0xef7c('0x24')]=qs[_0xef7c('0x24')](_0x41e50e[_0xef7c('0x3b')]['limit']);_0x5aed2c[_0xef7c('0x23')]=qs['offset'](_0x41e50e[_0xef7c('0x3b')][_0xef7c('0x23')]);}return _0x1ca997[_0xef7c('0x8c')](_0x5aed2c);}})[_0xef7c('0x2a')](function(_0x14cad7){if(_0x14cad7){return _0x14cad7?{'count':_0x571649,'rows':_0x14cad7}:null;}})[_0xef7c('0x2a')](respondWithResult(_0x29c808,null))[_0xef7c('0x4e')](handleError(_0x29c808,null));}; \ No newline at end of file +var _0x9f8b=['UserWhatsappQueue','User','findAndCountAll','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','interface','sequelize','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','ids','select','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','all','union','value','removeTeams','userWhatsappQueue:remove','addAgents','omit','removeAgents','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','get','WhatsappQueues','then','error','stack','name','index','map','WhatsappQueue','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','filtears','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','order','WhatsappQueueId'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0x9f8b,0xb6));var _0xb9f8=function(_0x338b4c,_0x48f49e){_0x338b4c=_0x338b4c-0x0;var _0x3442f8=_0x9f8b[_0x338b4c];return _0x3442f8;};'use strict';var pdf=require(_0xb9f8('0x0'));var emlformat=require(_0xb9f8('0x1'));var rimraf=require(_0xb9f8('0x2'));var zipdir=require(_0xb9f8('0x3'));var jsonpatch=require(_0xb9f8('0x4'));var rp=require(_0xb9f8('0x5'));var moment=require(_0xb9f8('0x6'));var BPromise=require(_0xb9f8('0x7'));var Mustache=require(_0xb9f8('0x8'));var util=require(_0xb9f8('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xb9f8('0xa'));var ejs=require(_0xb9f8('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb9f8('0xc'));var crypto=require(_0xb9f8('0xd'));var jsforce=require(_0xb9f8('0xe'));var deskjs=require(_0xb9f8('0xf'));var toCsv=require(_0xb9f8('0xa'));var querystring=require(_0xb9f8('0x10'));var Papa=require(_0xb9f8('0x11'));var Redis=require(_0xb9f8('0x12'));var authService=require(_0xb9f8('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9f8('0x14'));var logger=require(_0xb9f8('0x15'))(_0xb9f8('0x16'));var utils=require(_0xb9f8('0x17'));var config=require(_0xb9f8('0x18'));var licenseUtil=require(_0xb9f8('0x19'));var db=require(_0xb9f8('0x1a'))['db'];config['redis']=_[_0xb9f8('0x1b')](config[_0xb9f8('0x1c')],{'host':_0xb9f8('0x1d'),'port':0x18eb});var socket=require(_0xb9f8('0x1e'))(new Redis(config[_0xb9f8('0x1c')]));require(_0xb9f8('0x1f'))[_0xb9f8('0x20')](socket);function respondWithStatusCode(_0xe3d3c7,_0xe7e437){_0xe7e437=_0xe7e437||0xcc;return function(_0x4a797b){if(_0x4a797b){return _0xe3d3c7[_0xb9f8('0x21')](_0xe7e437);}return _0xe3d3c7[_0xb9f8('0x22')](_0xe7e437)[_0xb9f8('0x23')]();};}function respondWithResult(_0x109b23,_0x1914a3){_0x1914a3=_0x1914a3||0xc8;return function(_0x3f7b62){if(_0x3f7b62){return _0x109b23['status'](_0x1914a3)[_0xb9f8('0x24')](_0x3f7b62);}};}function respondWithFilteredResult(_0x4c7355,_0x2bcaac){return function(_0x3e9ca1){if(_0x3e9ca1){var _0xde39fb=_0x3e9ca1[_0xb9f8('0x25')],_0x1803e9=_0x2bcaac['offset'],_0x4263d0=_0x2bcaac[_0xb9f8('0x26')]+_0x2bcaac[_0xb9f8('0x27')],_0x4122a7;if(_0x4263d0>=_0xde39fb){_0x4263d0=_0xde39fb;_0x4122a7=0xc8;}else{_0x4122a7=0xce;}_0x4c7355[_0xb9f8('0x22')](_0x4122a7);return _0x4c7355[_0xb9f8('0x28')](_0xb9f8('0x29'),_0x1803e9+'-'+_0x4263d0+'/'+_0xde39fb)['json'](_0x3e9ca1);}return null;};}function patchUpdates(_0x26ac84){return function(_0x18b706){try{jsonpatch[_0xb9f8('0x2a')](_0x18b706,_0x26ac84,!![]);}catch(_0x5ce8e5){return BPromise['reject'](_0x5ce8e5);}return _0x18b706[_0xb9f8('0x2b')]();};}function saveUpdates(_0x1ec442,_0x119d26){return function(_0x32a15e){if(_0x32a15e){return _0x32a15e[_0xb9f8('0x2c')](_0x1ec442)['then'](function(_0x5b1105){return _0x5b1105;});}return null;};}function removeEntity(_0xbe5958,_0x56d270){return function(_0x328561){if(_0x328561){return _0x328561[_0xb9f8('0x2d')]()['then'](function(){var _0x7344bc=_0x328561[_0xb9f8('0x2e')]({'plain':!![]});var _0x185f9a=_0xb9f8('0x2f');return db['UserProfileResource'][_0xb9f8('0x2d')]({'where':{'type':_0x185f9a,'resourceId':_0x7344bc['id']}})[_0xb9f8('0x30')](function(){return _0x328561;});})[_0xb9f8('0x30')](function(){_0xbe5958[_0xb9f8('0x22')](0xcc)[_0xb9f8('0x23')]();});}};}function handleEntityNotFound(_0x2f4c63,_0x97992e){return function(_0x21f9f3){if(!_0x21f9f3){_0x2f4c63[_0xb9f8('0x21')](0x194);}return _0x21f9f3;};}function handleError(_0x149550,_0x355f92){_0x355f92=_0x355f92||0x1f4;return function(_0x5f1541){logger[_0xb9f8('0x31')](_0x5f1541[_0xb9f8('0x32')]);if(_0x5f1541[_0xb9f8('0x33')]){delete _0x5f1541['name'];}_0x149550[_0xb9f8('0x22')](_0x355f92)['send'](_0x5f1541);};}exports[_0xb9f8('0x34')]=function(_0x241bee,_0xc74ef6){var _0x3f23a2={},_0xd3fce5={},_0x44a3e2={'count':0x0,'rows':[]};var _0x5b3a0d=_[_0xb9f8('0x35')](db[_0xb9f8('0x36')]['rawAttributes'],function(_0x32152a){return{'name':_0x32152a[_0xb9f8('0x37')],'type':_0x32152a[_0xb9f8('0x38')][_0xb9f8('0x39')]};});_0xd3fce5[_0xb9f8('0x3a')]=_[_0xb9f8('0x35')](_0x5b3a0d,_0xb9f8('0x33'));_0xd3fce5['query']=_[_0xb9f8('0x3b')](_0x241bee['query']);_0xd3fce5[_0xb9f8('0x3c')]=_[_0xb9f8('0x3d')](_0xd3fce5[_0xb9f8('0x3a')],_0xd3fce5[_0xb9f8('0x3e')]);_0x3f23a2[_0xb9f8('0x3f')]=_[_0xb9f8('0x3d')](_0xd3fce5['model'],qs[_0xb9f8('0x40')](_0x241bee[_0xb9f8('0x3e')][_0xb9f8('0x40')]));_0x3f23a2['attributes']=_0x3f23a2['attributes'][_0xb9f8('0x41')]?_0x3f23a2['attributes']:_0xd3fce5[_0xb9f8('0x3a')];if(!_0x241bee[_0xb9f8('0x3e')][_0xb9f8('0x42')](_0xb9f8('0x43'))){_0x3f23a2[_0xb9f8('0x27')]=qs[_0xb9f8('0x27')](_0x241bee[_0xb9f8('0x3e')][_0xb9f8('0x27')]);_0x3f23a2['offset']=qs[_0xb9f8('0x26')](_0x241bee[_0xb9f8('0x3e')]['offset']);}_0x3f23a2['order']=qs['sort'](_0x241bee[_0xb9f8('0x3e')][_0xb9f8('0x44')]);_0x3f23a2[_0xb9f8('0x45')]=qs['filters'](_[_0xb9f8('0x46')](_0x241bee['query'],_0xd3fce5[_0xb9f8('0x3c')]),_0x5b3a0d);if(_0x241bee[_0xb9f8('0x3e')][_0xb9f8('0x47')]){_0x3f23a2[_0xb9f8('0x45')]=_[_0xb9f8('0x48')](_0x3f23a2['where'],{'$or':_[_0xb9f8('0x35')](_0x5b3a0d,function(_0x3ecca3){if(_0x3ecca3[_0xb9f8('0x38')]!==_0xb9f8('0x49')){var _0x3ce336={};_0x3ce336[_0x3ecca3['name']]={'$like':'%'+_0x241bee['query']['filter']+'%'};return _0x3ce336;}})});}_0x3f23a2=_[_0xb9f8('0x48')]({},_0x3f23a2,_0x241bee[_0xb9f8('0x4a')]);var _0x311a6f={'where':_0x3f23a2[_0xb9f8('0x45')]};return db[_0xb9f8('0x36')]['count'](_0x311a6f)[_0xb9f8('0x30')](function(_0x2b6516){_0x44a3e2[_0xb9f8('0x25')]=_0x2b6516;if(_0x241bee[_0xb9f8('0x3e')][_0xb9f8('0x4b')]){_0x3f23a2[_0xb9f8('0x4c')]=[{'all':!![]}];}return db[_0xb9f8('0x36')][_0xb9f8('0x4d')](_0x3f23a2);})[_0xb9f8('0x30')](function(_0x43e5ab){_0x44a3e2[_0xb9f8('0x4e')]=_0x43e5ab;return _0x44a3e2;})[_0xb9f8('0x30')](respondWithFilteredResult(_0xc74ef6,_0x3f23a2))['catch'](handleError(_0xc74ef6,null));};exports[_0xb9f8('0x4f')]=function(_0xf8d35d,_0x1929e2){var _0x2363c7={'raw':!![],'where':{'id':_0xf8d35d[_0xb9f8('0x50')]['id']}},_0x21fbdb={};_0x21fbdb[_0xb9f8('0x3a')]=_[_0xb9f8('0x3b')](db[_0xb9f8('0x36')][_0xb9f8('0x51')]);_0x21fbdb[_0xb9f8('0x3e')]=_['keys'](_0xf8d35d[_0xb9f8('0x3e')]);_0x21fbdb[_0xb9f8('0x52')]=_[_0xb9f8('0x3d')](_0x21fbdb[_0xb9f8('0x3a')],_0x21fbdb[_0xb9f8('0x3e')]);_0x2363c7[_0xb9f8('0x3f')]=_['intersection'](_0x21fbdb['model'],qs['fields'](_0xf8d35d[_0xb9f8('0x3e')][_0xb9f8('0x40')]));_0x2363c7[_0xb9f8('0x3f')]=_0x2363c7['attributes'][_0xb9f8('0x41')]?_0x2363c7[_0xb9f8('0x3f')]:_0x21fbdb[_0xb9f8('0x3a')];if(_0xf8d35d[_0xb9f8('0x3e')][_0xb9f8('0x4b')]){_0x2363c7['include']=[{'all':!![]}];}_0x2363c7=_[_0xb9f8('0x48')]({},_0x2363c7,_0xf8d35d['options']);return db[_0xb9f8('0x36')][_0xb9f8('0x53')](_0x2363c7)['then'](handleEntityNotFound(_0x1929e2,null))['then'](respondWithResult(_0x1929e2,null))[_0xb9f8('0x54')](handleError(_0x1929e2,null));};exports[_0xb9f8('0x55')]=function(_0x58f098,_0x43c99a){return db[_0xb9f8('0x36')]['create'](_0x58f098[_0xb9f8('0x56')],{})[_0xb9f8('0x30')](function(_0x55cf31){var _0x25b0e7=_0x58f098['user'][_0xb9f8('0x2e')]({'plain':!![]});if(!_0x25b0e7)throw new Error(_0xb9f8('0x57'));if(_0x25b0e7['role']===_0xb9f8('0x58')){var _0x39273f=_0x55cf31['get']({'plain':!![]});var _0x4d9dea='WhatsappQueues';return db[_0xb9f8('0x59')][_0xb9f8('0x53')]({'where':{'name':_0x4d9dea,'userProfileId':_0x25b0e7['userProfileId']},'raw':!![]})[_0xb9f8('0x30')](function(_0x20687d){if(_0x20687d&&_0x20687d[_0xb9f8('0x5a')]===0x0){return db[_0xb9f8('0x5b')][_0xb9f8('0x55')]({'name':_0x39273f[_0xb9f8('0x33')],'resourceId':_0x39273f['id'],'type':_0x20687d['name'],'sectionId':_0x20687d['id']},{})['then'](function(){return _0x55cf31;});}else{return _0x55cf31;}})[_0xb9f8('0x54')](function(_0x158edf){logger[_0xb9f8('0x31')](_0xb9f8('0x5c'),_0x158edf);throw _0x158edf;});}return _0x55cf31;})[_0xb9f8('0x30')](respondWithResult(_0x43c99a,0xc9))[_0xb9f8('0x54')](handleError(_0x43c99a,null));};exports[_0xb9f8('0x2c')]=function(_0x118fdc,_0x175380){if(_0x118fdc[_0xb9f8('0x56')]['id']){delete _0x118fdc[_0xb9f8('0x56')]['id'];}return db['WhatsappQueue'][_0xb9f8('0x53')]({'where':{'id':_0x118fdc[_0xb9f8('0x50')]['id']}})['then'](handleEntityNotFound(_0x175380,null))[_0xb9f8('0x30')](saveUpdates(_0x118fdc['body'],null))[_0xb9f8('0x30')](respondWithResult(_0x175380,null))['catch'](handleError(_0x175380,null));};exports['destroy']=function(_0x31c674,_0x2f3761){return db[_0xb9f8('0x36')]['find']({'where':{'id':_0x31c674[_0xb9f8('0x50')]['id']}})[_0xb9f8('0x30')](handleEntityNotFound(_0x2f3761,null))[_0xb9f8('0x30')](removeEntity(_0x2f3761,null))[_0xb9f8('0x54')](handleError(_0x2f3761,null));};exports[_0xb9f8('0x5d')]=function(_0x2a0bdf,_0x8e60b2){return db['WhatsappQueue'][_0xb9f8('0x5d')]()['then'](respondWithResult(_0x8e60b2,null))[_0xb9f8('0x54')](handleError(_0x8e60b2,null));};exports[_0xb9f8('0x5e')]=function(_0x135546,_0x50125f,_0x277cd2){var _0x41cdfe={'raw':!![],'where':{}},_0x379898={},_0x255f5b;return db[_0xb9f8('0x36')][_0xb9f8('0x5f')]({'where':{'id':_0x135546['params']['id']}})[_0xb9f8('0x30')](handleEntityNotFound(_0x50125f,null))[_0xb9f8('0x30')](function(_0x288b13){if(_0x288b13){_0x255f5b=_0x288b13[_0xb9f8('0x2e')]({'plain':!![]});_0x379898['model']=_[_0xb9f8('0x3b')](db['UserWhatsappQueue'][_0xb9f8('0x51')]);_0x379898[_0xb9f8('0x3e')]=_[_0xb9f8('0x3b')](_0x135546[_0xb9f8('0x3e')]);_0x379898[_0xb9f8('0x3c')]=_[_0xb9f8('0x3d')](_0x379898['model'],_0x379898[_0xb9f8('0x3e')]);_0x41cdfe['attributes']=_[_0xb9f8('0x3d')](_0x379898[_0xb9f8('0x3a')],qs[_0xb9f8('0x40')](_0x135546[_0xb9f8('0x3e')][_0xb9f8('0x40')]));_0x41cdfe[_0xb9f8('0x3f')]=_0x41cdfe[_0xb9f8('0x3f')][_0xb9f8('0x41')]?_0x41cdfe[_0xb9f8('0x3f')]:_0x379898[_0xb9f8('0x3a')];if(!_0x135546[_0xb9f8('0x3e')]['hasOwnProperty'](_0xb9f8('0x43'))){_0x41cdfe['limit']=qs[_0xb9f8('0x27')](_0x135546[_0xb9f8('0x3e')][_0xb9f8('0x27')]);_0x41cdfe[_0xb9f8('0x26')]=qs['offset'](_0x135546['query'][_0xb9f8('0x26')]);}_0x41cdfe[_0xb9f8('0x60')]=qs[_0xb9f8('0x44')](_0x135546['query'][_0xb9f8('0x44')]);_0x41cdfe[_0xb9f8('0x45')]=qs[_0xb9f8('0x3c')](_[_0xb9f8('0x46')](_0x135546['query'],_0x379898[_0xb9f8('0x3c')]));_0x41cdfe[_0xb9f8('0x45')][_0xb9f8('0x61')]=_0x288b13['id'];if(_0x135546[_0xb9f8('0x3e')][_0xb9f8('0x47')]){_0x41cdfe[_0xb9f8('0x45')]=_[_0xb9f8('0x48')](_0x41cdfe[_0xb9f8('0x45')],{'$or':_['map'](_0x41cdfe[_0xb9f8('0x3f')],function(_0x217d68){var _0x457e82={};_0x457e82[_0x217d68]={'$like':'%'+_0x135546[_0xb9f8('0x3e')][_0xb9f8('0x47')]+'%'};return _0x457e82;})});}_0x41cdfe=_[_0xb9f8('0x48')]({},_0x41cdfe,_0x135546[_0xb9f8('0x4a')]);return db[_0xb9f8('0x62')]['findAll'](_0x41cdfe);}})[_0xb9f8('0x30')](function(_0x591b3c){if(_0x591b3c){return db[_0xb9f8('0x63')][_0xb9f8('0x64')]({'where':{'id':_[_0xb9f8('0x35')](_0x591b3c,'UserId'),'role':'agent'},'attributes':['id',_0xb9f8('0x33'),'whatsappPause',_0xb9f8('0x65'),_0xb9f8('0x66')]});}})[_0xb9f8('0x30')](function(_0x572b21){if(_0x572b21){return{'count':_0x572b21[_0xb9f8('0x25')],'rows':_['map'](_0x572b21[_0xb9f8('0x4e')],function(_0x178aca){return{'membername':_0x178aca[_0xb9f8('0x33')],'UserId':_0x178aca['id'],'queue_name':_0x255f5b['name'],'WhatsappQueueId':_0x255f5b['id'],'interface':util['format'](_0xb9f8('0x67'),_0xb9f8('0x68'),_0x178aca['name']),'penalty':0x0,'paused':_0x178aca['whatsappPause'],'createdAt':_0x178aca['createdAt'],'updatedAt':_0x178aca[_0xb9f8('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x50125f,_0x41cdfe))[_0xb9f8('0x54')](handleError(_0x50125f,null));};exports[_0xb9f8('0x69')]=function(_0x24a260,_0x5579e9,_0x46d5fe){var _0x3f4c6e={};var _0x38f270={};var _0x201f90;var _0x4625ad;return db[_0xb9f8('0x36')][_0xb9f8('0x5f')]({'where':{'id':_0x24a260['params']['id']}})[_0xb9f8('0x30')](handleEntityNotFound(_0x5579e9,null))[_0xb9f8('0x30')](function(_0x387c23){if(_0x387c23){_0x201f90=_0x387c23;_0x38f270[_0xb9f8('0x3a')]=_[_0xb9f8('0x3b')](db[_0xb9f8('0x6a')][_0xb9f8('0x51')]);_0x38f270[_0xb9f8('0x3e')]=_[_0xb9f8('0x3b')](_0x24a260['query']);_0x38f270[_0xb9f8('0x3c')]=_[_0xb9f8('0x3d')](_0x38f270['model'],_0x38f270[_0xb9f8('0x3e')]);_0x3f4c6e['attributes']=_['intersection'](_0x38f270['model'],qs['fields'](_0x24a260['query'][_0xb9f8('0x40')]));_0x3f4c6e[_0xb9f8('0x3f')]=_0x3f4c6e[_0xb9f8('0x3f')][_0xb9f8('0x41')]?_0x3f4c6e[_0xb9f8('0x3f')]:_0x38f270['model'];_0x3f4c6e[_0xb9f8('0x60')]=qs[_0xb9f8('0x44')](_0x24a260[_0xb9f8('0x3e')]['sort']);_0x3f4c6e['where']=qs['filters'](_[_0xb9f8('0x46')](_0x24a260['query'],_0x38f270[_0xb9f8('0x3c')]));if(_0x24a260[_0xb9f8('0x3e')][_0xb9f8('0x47')]){_0x3f4c6e[_0xb9f8('0x45')]=_[_0xb9f8('0x48')](_0x3f4c6e[_0xb9f8('0x45')],{'$or':_[_0xb9f8('0x35')](_0x3f4c6e['attributes'],function(_0x3fb505){var _0x1e3ad7={};_0x1e3ad7[_0x3fb505]={'$like':'%'+_0x24a260[_0xb9f8('0x3e')][_0xb9f8('0x47')]+'%'};return _0x1e3ad7;})});}_0x3f4c6e=_['merge']({},_0x3f4c6e,_0x24a260[_0xb9f8('0x4a')]);return _0x201f90[_0xb9f8('0x69')](_0x3f4c6e);}})[_0xb9f8('0x30')](function(_0x38a6e5){if(_0x38a6e5){_0x4625ad=_0x38a6e5[_0xb9f8('0x41')];if(!_0x24a260[_0xb9f8('0x3e')]['hasOwnProperty'](_0xb9f8('0x43'))){_0x3f4c6e['limit']=qs['limit'](_0x24a260[_0xb9f8('0x3e')][_0xb9f8('0x27')]);_0x3f4c6e['offset']=qs[_0xb9f8('0x26')](_0x24a260[_0xb9f8('0x3e')][_0xb9f8('0x26')]);}return _0x201f90['getTeams'](_0x3f4c6e);}})[_0xb9f8('0x30')](function(_0x373d29){if(_0x373d29){return _0x373d29?{'count':_0x4625ad,'rows':_0x373d29}:null;}})[_0xb9f8('0x30')](respondWithResult(_0x5579e9,null))[_0xb9f8('0x54')](handleError(_0x5579e9,null));};exports[_0xb9f8('0x6b')]=function(_0x3b0deb,_0x442187,_0x5b724f){var _0x329b24=_0x3b0deb[_0xb9f8('0x56')]['ids'];return db[_0xb9f8('0x6a')][_0xb9f8('0x4d')]({'where':{'id':_0x329b24},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb9f8('0x6c'),'attributes':['id',_0xb9f8('0x33'),_0xb9f8('0x6d'),'voicePause',_0xb9f8('0x6e')],'raw':!![]}]})[_0xb9f8('0x30')](function(_0x5159d9){if(_0x5159d9){var _0x126b60=_['flatMap'](_0x5159d9,function(_0x238752){var _0x3b0b17=_0x238752[_0xb9f8('0x2e')]({'plain':!![]});return _0x3b0b17[_0xb9f8('0x6c')];});return db[_0xb9f8('0x36')]['find']({'where':{'id':_0x3b0deb['params']['id']}})['then'](function(_0x4ba595){return db[_0xb9f8('0x6f')][_0xb9f8('0x70')](function(_0x2c525d){return _0x4ba595[_0xb9f8('0x6b')](_0x329b24,{'transaction':_0x2c525d})[_0xb9f8('0x30')](function(){return BPromise['each'](_0x126b60,function(_0x4656a9){return db[_0xb9f8('0x62')][_0xb9f8('0x71')]({'where':{'UserId':_0x4656a9['id'],'WhatsappQueueId':_0x3b0deb[_0xb9f8('0x50')]['id']},'transaction':_0x2c525d});});})['then'](function(){_0x126b60[_0xb9f8('0x72')](function(_0x10f62e){socket[_0xb9f8('0x73')](_0xb9f8('0x74'),{'UserId':_0x10f62e['id'],'WhatsappQueueId':_0x4ba595['id']});});});});});}})[_0xb9f8('0x30')](respondWithStatusCode(_0x442187,null))[_0xb9f8('0x54')](handleError(_0x442187,null));};exports['removeTeams']=function(_0x10e491,_0x5eff55,_0x16dbb1){return db[_0xb9f8('0x6a')][_0xb9f8('0x4d')]({'where':{'id':_0x10e491[_0xb9f8('0x3e')][_0xb9f8('0x75')]},'attributes':['id'],'include':[{'model':db[_0xb9f8('0x63')],'as':_0xb9f8('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xb9f8('0x30')](handleEntityNotFound(_0x5eff55,null))[_0xb9f8('0x30')](function(_0x255da0){var _0x490a7=_[_0xb9f8('0x35')](_0x255da0,'id');var _0x4880f3=[];var _0x4ef13f=[];var _0x7d2cb9=squel[_0xb9f8('0x76')]();_0x7d2cb9['field']('tq.TeamId')[_0xb9f8('0x77')]('team_has_whatsapp_queues','tq')[_0xb9f8('0x78')](_0xb9f8('0x79'),'ut',_0xb9f8('0x7a'))[_0xb9f8('0x45')](_0xb9f8('0x7b'),_0x10e491[_0xb9f8('0x50')]['id']);for(var _0x1fdb35=0x0;_0x1fdb35<_0x255da0[_0xb9f8('0x41')];_0x1fdb35+=0x1){let _0x156874=_0x255da0[_0x1fdb35];for(var _0x131bc3=0x0;_0x131bc3<_0x156874[_0xb9f8('0x6c')][_0xb9f8('0x41')];_0x131bc3+=0x1){let _0x467a9f=_0x156874[_0xb9f8('0x6c')][_0x131bc3];var _0xcadde8=_0x7d2cb9[_0xb9f8('0x7c')]();_0xcadde8[_0xb9f8('0x45')](_0xb9f8('0x7d'),_0x467a9f['id']);_0x4ef13f[_0xb9f8('0x7e')](db['sequelize'][_0xb9f8('0x3e')](_0xcadde8['toString'](),{'type':db['sequelize'][_0xb9f8('0x7f')][_0xb9f8('0x80')]})[_0xb9f8('0x30')](function(_0x529c68){if(_0x529c68[_0xb9f8('0x41')]===0x1){return _0x467a9f['id'];}else{var _0x260853=_['every'](_[_0xb9f8('0x35')](_0x529c68,_0xb9f8('0x81')),function(_0x6dc6c){return _[_0xb9f8('0x82')](_0x490a7,_0x6dc6c);});if(_0x260853){return _0x467a9f['id'];}}}));}}return BPromise[_0xb9f8('0x83')](_0x4ef13f)[_0xb9f8('0x30')](function(_0x30bf7e){_0x4880f3=_(_0x4880f3)[_0xb9f8('0x84')](_0x30bf7e)['compact']()[_0xb9f8('0x85')]();return db[_0xb9f8('0x36')][_0xb9f8('0x53')]({'where':{'id':_0x10e491['params']['id']}})[_0xb9f8('0x30')](function(_0x5e0b25){return db['sequelize'][_0xb9f8('0x70')](function(_0x2ff3f5){return _0x5e0b25[_0xb9f8('0x86')](_0x10e491[_0xb9f8('0x3e')][_0xb9f8('0x75')],{'transaction':_0x2ff3f5})['then'](function(){if(!_['isEmpty'](_0x4880f3)){return _0x5e0b25['removeAgents'](_0x4880f3,{'transaction':_0x2ff3f5});}})['then'](function(){_0x4880f3[_0xb9f8('0x72')](function(_0x5b461a){socket[_0xb9f8('0x73')](_0xb9f8('0x87'),{'UserId':_0x5b461a,'WhatsappQueueId':_0x5e0b25['id']});});});});});});})[_0xb9f8('0x30')](respondWithStatusCode(_0x5eff55,null))[_0xb9f8('0x54')](handleError(_0x5eff55,null));};exports[_0xb9f8('0x88')]=function(_0xe74047,_0x78dc18,_0x2f4576){return db[_0xb9f8('0x36')][_0xb9f8('0x53')]({'where':{'id':_0xe74047['params']['id']}})[_0xb9f8('0x30')](handleEntityNotFound(_0x78dc18,null))[_0xb9f8('0x30')](function(_0x252548){if(_0x252548){return _0x252548[_0xb9f8('0x88')](_0xe74047['body'][_0xb9f8('0x75')],_[_0xb9f8('0x89')](_0xe74047[_0xb9f8('0x56')],[_0xb9f8('0x75'),'id'])||{})['spread'](function(_0x45e252){for(var _0x5d62a1=0x0;_0x5d62a1<_0xe74047[_0xb9f8('0x56')]['ids'][_0xb9f8('0x41')];_0x5d62a1+=0x1){socket['emit'](_0xb9f8('0x74'),{'UserId':_0xe74047[_0xb9f8('0x56')][_0xb9f8('0x75')][_0x5d62a1],'WhatsappQueueId':_0xe74047['params']['id']});}return _0x45e252;});}})['then'](respondWithResult(_0x78dc18,null))[_0xb9f8('0x54')](handleError(_0x78dc18,null));};exports[_0xb9f8('0x8a')]=function(_0x1d42e6,_0x4f48a2,_0x52e823){return db['WhatsappQueue']['find']({'where':{'id':_0x1d42e6[_0xb9f8('0x50')]['id']}})[_0xb9f8('0x30')](handleEntityNotFound(_0x4f48a2,null))['then'](function(_0xf215bb){if(_0xf215bb){return _0xf215bb['removeAgents'](_0x1d42e6[_0xb9f8('0x3e')]['ids'])[_0xb9f8('0x30')](function(){if(_['isArray'](_0x1d42e6[_0xb9f8('0x3e')][_0xb9f8('0x75')])){for(var _0x5e1f0a=0x0;_0x5e1f0a<_0x1d42e6[_0xb9f8('0x3e')][_0xb9f8('0x75')][_0xb9f8('0x41')];_0x5e1f0a+=0x1){socket[_0xb9f8('0x73')]('userWhatsappQueue:remove',{'UserId':Number(_0x1d42e6[_0xb9f8('0x3e')][_0xb9f8('0x75')][_0x5e1f0a]),'WhatsappQueueId':Number(_0x1d42e6[_0xb9f8('0x50')]['id'])});}}else{socket[_0xb9f8('0x73')](_0xb9f8('0x87'),{'UserId':Number(_0x1d42e6[_0xb9f8('0x3e')][_0xb9f8('0x75')]),'WhatsappQueueId':Number(_0x1d42e6['params']['id'])});}});}})[_0xb9f8('0x30')](respondWithStatusCode(_0x4f48a2,null))[_0xb9f8('0x54')](handleError(_0x4f48a2,null));};exports[_0xb9f8('0x8b')]=function(_0x1bd440,_0x2ac4e4,_0x2b3ae8){var _0xc67d2={};var _0x3fa03e={};var _0x5488bd;var _0x55e67f;return db[_0xb9f8('0x36')][_0xb9f8('0x5f')]({'where':{'id':_0x1bd440[_0xb9f8('0x50')]['id']}})[_0xb9f8('0x30')](handleEntityNotFound(_0x2ac4e4,null))[_0xb9f8('0x30')](function(_0x459c60){if(_0x459c60){_0x5488bd=_0x459c60;_0x3fa03e[_0xb9f8('0x3a')]=_[_0xb9f8('0x3b')](db['User'][_0xb9f8('0x51')]);_0x3fa03e[_0xb9f8('0x3e')]=_[_0xb9f8('0x3b')](_0x1bd440[_0xb9f8('0x3e')]);_0x3fa03e[_0xb9f8('0x3c')]=_[_0xb9f8('0x3d')](_0x3fa03e['model'],_0x3fa03e['query']);_0xc67d2[_0xb9f8('0x3f')]=_[_0xb9f8('0x3d')](_0x3fa03e[_0xb9f8('0x3a')],qs['fields'](_0x1bd440[_0xb9f8('0x3e')][_0xb9f8('0x40')]));_0xc67d2['attributes']=_0xc67d2['attributes'][_0xb9f8('0x41')]?_0xc67d2[_0xb9f8('0x3f')]:_0x3fa03e[_0xb9f8('0x3a')];_0xc67d2[_0xb9f8('0x60')]=qs[_0xb9f8('0x44')](_0x1bd440[_0xb9f8('0x3e')][_0xb9f8('0x44')]);_0xc67d2['where']=qs['filters'](_[_0xb9f8('0x46')](_0x1bd440[_0xb9f8('0x3e')],_0x3fa03e['filters']));if(_0x1bd440[_0xb9f8('0x3e')][_0xb9f8('0x47')]){_0xc67d2['where']=_[_0xb9f8('0x48')](_0xc67d2[_0xb9f8('0x45')],{'$or':_[_0xb9f8('0x35')](_0xc67d2['attributes'],function(_0x5bb7f6){var _0x6abcda={};_0x6abcda[_0x5bb7f6]={'$like':'%'+_0x1bd440[_0xb9f8('0x3e')][_0xb9f8('0x47')]+'%'};return _0x6abcda;})});}_0xc67d2=_[_0xb9f8('0x48')]({},_0xc67d2,_0x1bd440[_0xb9f8('0x4a')]);return _0x5488bd['getAgents'](_0xc67d2);}})[_0xb9f8('0x30')](function(_0x20e55e){if(_0x20e55e){_0x55e67f=_0x20e55e['length'];if(!_0x1bd440['query']['hasOwnProperty'](_0xb9f8('0x43'))){_0xc67d2['limit']=qs[_0xb9f8('0x27')](_0x1bd440['query'][_0xb9f8('0x27')]);_0xc67d2[_0xb9f8('0x26')]=qs['offset'](_0x1bd440['query'][_0xb9f8('0x26')]);}return _0x5488bd[_0xb9f8('0x8b')](_0xc67d2);}})[_0xb9f8('0x30')](function(_0x10266e){if(_0x10266e){return _0x10266e?{'count':_0x55e67f,'rows':_0x10266e}:null;}})[_0xb9f8('0x30')](respondWithResult(_0x2ac4e4,null))[_0xb9f8('0x54')](handleError(_0x2ac4e4,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 7c61356..847c057 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 _0x0298=['update','remove','emit','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save'];(function(_0x4d8a61,_0x25b195){var _0x3b94d=function(_0x34bf77){while(--_0x34bf77){_0x4d8a61['push'](_0x4d8a61['shift']());}};_0x3b94d(++_0x25b195);}(_0x0298,0x1a9));var _0x8029=function(_0x5be3cc,_0x3b5c7d){_0x5be3cc=_0x5be3cc-0x0;var _0x1162a2=_0x0298[_0x5be3cc];return _0x1162a2;};'use strict';var EventEmitter=require(_0x8029('0x0'));var WhatsappQueue=require(_0x8029('0x1'))['db'][_0x8029('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8029('0x3')](0x0);var events={'afterCreate':_0x8029('0x4'),'afterUpdate':_0x8029('0x5'),'afterDestroy':_0x8029('0x6')};function emitEvent(_0x112a1d){return function(_0xbc98b0,_0x2eb94b,_0x56a430){WhatsappQueueEvents[_0x8029('0x7')](_0x112a1d+':'+_0xbc98b0['id'],_0xbc98b0);WhatsappQueueEvents['emit'](_0x112a1d,_0xbc98b0);_0x56a430(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x8029('0x8')](e,emitEvent(event));}}module[_0x8029('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0x7b7b=['WhatsappQueue','setMaxListeners','save','update','remove','hasOwnProperty','events','../../mysqldb'];(function(_0x5b76f1,_0x149656){var _0x3907f5=function(_0x235725){while(--_0x235725){_0x5b76f1['push'](_0x5b76f1['shift']());}};_0x3907f5(++_0x149656);}(_0x7b7b,0x12e));var _0xb7b7=function(_0x56b034,_0xb96f9b){_0x56b034=_0x56b034-0x0;var _0x25f338=_0x7b7b[_0x56b034];return _0x25f338;};'use strict';var EventEmitter=require(_0xb7b7('0x0'));var WhatsappQueue=require(_0xb7b7('0x1'))['db'][_0xb7b7('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xb7b7('0x3')](0x0);var events={'afterCreate':_0xb7b7('0x4'),'afterUpdate':_0xb7b7('0x5'),'afterDestroy':_0xb7b7('0x6')};function emitEvent(_0x53b87c){return function(_0x24958b,_0x59ebe5,_0x5a61fd){WhatsappQueueEvents['emit'](_0x53b87c+':'+_0x24958b['id'],_0x24958b);WhatsappQueueEvents['emit'](_0x53b87c,_0x24958b);_0x5a61fd(null);};}for(var e in events){if(events[_0xb7b7('0x7')](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 207ae9c..1cbd95f 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 _0x9a55=['moment','bluebird','request-promise','../../config/environment','exports','WhatsappQueue','lodash','util','../../config/logger','api'];(function(_0x33050f,_0x2c5153){var _0x2e3f76=function(_0x3c5e83){while(--_0x3c5e83){_0x33050f['push'](_0x33050f['shift']());}};_0x2e3f76(++_0x2c5153);}(_0x9a55,0x178));var _0x59a5=function(_0x56edef,_0x4ed490){_0x56edef=_0x56edef-0x0;var _0x18c156=_0x9a55[_0x56edef];return _0x18c156;};'use strict';var _=require(_0x59a5('0x0'));var util=require(_0x59a5('0x1'));var logger=require(_0x59a5('0x2'))(_0x59a5('0x3'));var moment=require(_0x59a5('0x4'));var BPromise=require(_0x59a5('0x5'));var rp=require(_0x59a5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x59a5('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0x59a5('0x8')]=function(_0x41688e,_0x58ade0){return _0x41688e['define'](_0x59a5('0x9'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0d9=['define','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./whatsappQueue.attributes','exports'];(function(_0x26879f,_0xef2dcf){var _0x233534=function(_0xaea9b1){while(--_0xaea9b1){_0x26879f['push'](_0x26879f['shift']());}};_0x233534(++_0xef2dcf);}(_0xb0d9,0x1ca));var _0x9b0d=function(_0x24b05b,_0x55865c){_0x24b05b=_0x24b05b-0x0;var _0x570a16=_0xb0d9[_0x24b05b];return _0x570a16;};'use strict';var _=require(_0x9b0d('0x0'));var util=require(_0x9b0d('0x1'));var logger=require(_0x9b0d('0x2'))(_0x9b0d('0x3'));var moment=require(_0x9b0d('0x4'));var BPromise=require(_0x9b0d('0x5'));var rp=require(_0x9b0d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9b0d('0x7'));var config=require('../../config/environment');var attributes=require(_0x9b0d('0x8'));module[_0x9b0d('0x9')]=function(_0x193c79,_0x6b3cfd){return _0x193c79[_0x9b0d('0xa')]('WhatsappQueue',attributes,{'tableName':_0x9b0d('0xb'),'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 662f63d..3e8b1d7 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 _0x52c1=['localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowWhatsappQueue','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x14e3cf,_0x4c2a07){var _0x2db962=function(_0x39bc2d){while(--_0x39bc2d){_0x14e3cf['push'](_0x14e3cf['shift']());}};_0x2db962(++_0x4c2a07);}(_0x52c1,0x18d));var _0x152c=function(_0x2ecbc0,_0x26ee68){_0x2ecbc0=_0x2ecbc0-0x0;var _0x5c25db=_0x52c1[_0x2ecbc0];return _0x5c25db;};'use strict';var _=require(_0x152c('0x0'));var util=require(_0x152c('0x1'));var moment=require(_0x152c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x152c('0x3'));var db=require(_0x152c('0x4'))['db'];var utils=require(_0x152c('0x5'));var logger=require(_0x152c('0x6'))(_0x152c('0x7'));var config=require(_0x152c('0x8'));var jayson=require(_0x152c('0x9'));var client=jayson['client'][_0x152c('0xa')]({'port':0x232a});config[_0x152c('0xb')]=_[_0x152c('0xc')](config[_0x152c('0xb')],{'host':_0x152c('0xd'),'port':0x18eb});var socket=require(_0x152c('0xe'))(new Redis(config[_0x152c('0xb')]));require(_0x152c('0xf'))[_0x152c('0x10')](socket);function respondWithRpcPromise(_0x3a39e2,_0x50f211,_0x5aab5f){return new BPromise(function(_0x57dea9,_0x3976ce){return client[_0x152c('0x11')](_0x3a39e2,_0x5aab5f)[_0x152c('0x12')](function(_0x4cb3d3){logger[_0x152c('0x13')](_0x152c('0x14'),_0x50f211,_0x152c('0x15'));logger[_0x152c('0x16')](_0x152c('0x17'),_0x50f211,_0x152c('0x15'),JSON[_0x152c('0x18')](_0x4cb3d3));if(_0x4cb3d3[_0x152c('0x19')]){if(_0x4cb3d3['error'][_0x152c('0x1a')]===0x1f4){logger[_0x152c('0x19')](_0x152c('0x14'),_0x50f211,_0x4cb3d3[_0x152c('0x19')]['message']);return _0x3976ce(_0x4cb3d3[_0x152c('0x19')][_0x152c('0x1b')]);}logger[_0x152c('0x19')](_0x152c('0x14'),_0x50f211,_0x4cb3d3[_0x152c('0x19')][_0x152c('0x1b')]);return _0x57dea9(_0x4cb3d3['error'][_0x152c('0x1b')]);}else{logger[_0x152c('0x13')](_0x152c('0x14'),_0x50f211,_0x152c('0x15'));_0x57dea9(_0x4cb3d3['result']['message']);}})[_0x152c('0x1c')](function(_0x312ceb){logger[_0x152c('0x19')](_0x152c('0x14'),_0x50f211,_0x312ceb);_0x3976ce(_0x312ceb);});});}exports[_0x152c('0x1d')]=function(_0x2190b9){var _0x349b5a=this;return new Promise(function(_0x1e02a6,_0x340467){return db[_0x152c('0x1e')][_0x152c('0x1f')]({'raw':_0x2190b9['options']?_0x2190b9[_0x152c('0x20')][_0x152c('0x21')]===undefined?!![]:![]:!![],'where':_0x2190b9[_0x152c('0x20')]?_0x2190b9[_0x152c('0x20')][_0x152c('0x22')]||null:null,'attributes':_0x2190b9['options']?_0x2190b9[_0x152c('0x20')]['attributes']||null:null,'limit':_0x2190b9[_0x152c('0x20')]?_0x2190b9[_0x152c('0x20')][_0x152c('0x23')]||null:null,'include':_0x2190b9[_0x152c('0x20')]?_0x2190b9[_0x152c('0x20')][_0x152c('0x24')]?_[_0x152c('0x25')](_0x2190b9['options'][_0x152c('0x24')],function(_0x5b6108){return{'model':db[_0x5b6108['model']],'as':_0x5b6108['as'],'attributes':_0x5b6108['attributes'],'include':_0x5b6108[_0x152c('0x24')]?_['map'](_0x5b6108['include'],function(_0x5ad505){return{'model':db[_0x5ad505[_0x152c('0x26')]],'as':_0x5ad505['as'],'attributes':_0x5ad505[_0x152c('0x27')],'include':_0x5ad505['include']?_['map'](_0x5ad505[_0x152c('0x24')],function(_0x26cbfa){return{'model':db[_0x26cbfa[_0x152c('0x26')]],'as':_0x26cbfa['as'],'attributes':_0x26cbfa[_0x152c('0x27')]};}):[]};}):[]};}):[]:[]})[_0x152c('0x12')](function(_0x5c1f28){logger[_0x152c('0x13')](_0x152c('0x1d'),_0x2190b9);logger[_0x152c('0x16')](_0x152c('0x1d'),_0x2190b9,JSON[_0x152c('0x18')](_0x5c1f28));_0x1e02a6(_0x5c1f28);})[_0x152c('0x1c')](function(_0x1ecdba){logger[_0x152c('0x19')](_0x152c('0x1d'),_0x1ecdba[_0x152c('0x1b')],_0x2190b9);_0x340467(_0x349b5a[_0x152c('0x19')](0x1f4,_0x1ecdba[_0x152c('0x1b')]));});});};exports[_0x152c('0x28')]=function(_0x5072c9){var _0x15b75f=this;return new Promise(function(_0x48f21c,_0x13f116){return db[_0x152c('0x1e')]['find']({'raw':_0x5072c9[_0x152c('0x20')]?_0x5072c9[_0x152c('0x20')][_0x152c('0x21')]===undefined?!![]:![]:!![],'where':_0x5072c9[_0x152c('0x20')]?_0x5072c9[_0x152c('0x20')][_0x152c('0x22')]||null:null,'attributes':_0x5072c9[_0x152c('0x20')]?_0x5072c9[_0x152c('0x20')][_0x152c('0x27')]||null:null,'include':_0x5072c9[_0x152c('0x20')]?_0x5072c9[_0x152c('0x20')][_0x152c('0x24')]?_['map'](_0x5072c9['options']['include'],function(_0x157676){return{'model':db[_0x157676[_0x152c('0x26')]],'as':_0x157676['as'],'attributes':_0x157676[_0x152c('0x27')],'include':_0x157676[_0x152c('0x24')]?_[_0x152c('0x25')](_0x157676['include'],function(_0x2f7262){return{'model':db[_0x2f7262[_0x152c('0x26')]],'as':_0x2f7262['as'],'attributes':_0x2f7262[_0x152c('0x27')],'include':_0x2f7262[_0x152c('0x24')]?_[_0x152c('0x25')](_0x2f7262['include'],function(_0x1e7be6){return{'model':db[_0x1e7be6[_0x152c('0x26')]],'as':_0x1e7be6['as'],'attributes':_0x1e7be6[_0x152c('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e63b5){logger[_0x152c('0x13')](_0x152c('0x28'),_0x5072c9);logger[_0x152c('0x16')]('ShowWhatsappQueue',_0x5072c9,JSON[_0x152c('0x18')](_0x2e63b5));_0x48f21c(_0x2e63b5);})[_0x152c('0x1c')](function(_0x343dc1){logger[_0x152c('0x19')]('ShowWhatsappQueue',_0x343dc1[_0x152c('0x1b')],_0x5072c9);_0x13f116(_0x15b75f[_0x152c('0x19')](0x1f4,_0x343dc1[_0x152c('0x1b')]));});});}; \ No newline at end of file +var _0x1d74=['ShowWhatsappQueue','WhatsappQueue','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappQueue.socket','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetWhatsappQueue','findAll','options','where','attributes','limit','include','model','map','then'];(function(_0x1165c6,_0x18238a){var _0x53d16a=function(_0x5e46ff){while(--_0x5e46ff){_0x1165c6['push'](_0x1165c6['shift']());}};_0x53d16a(++_0x18238a);}(_0x1d74,0xc1));var _0x41d7=function(_0x27c011,_0x234899){_0x27c011=_0x27c011-0x0;var _0x4b210c=_0x1d74[_0x27c011];return _0x4b210c;};'use strict';var _=require(_0x41d7('0x0'));var util=require(_0x41d7('0x1'));var moment=require(_0x41d7('0x2'));var BPromise=require(_0x41d7('0x3'));var rs=require(_0x41d7('0x4'));var fs=require('fs');var Redis=require(_0x41d7('0x5'));var db=require(_0x41d7('0x6'))['db'];var utils=require(_0x41d7('0x7'));var logger=require(_0x41d7('0x8'))(_0x41d7('0x9'));var config=require('../../config/environment');var jayson=require(_0x41d7('0xa'));var client=jayson[_0x41d7('0xb')]['http']({'port':0x232a});config[_0x41d7('0xc')]=_['defaults'](config[_0x41d7('0xc')],{'host':_0x41d7('0xd'),'port':0x18eb});var socket=require(_0x41d7('0xe'))(new Redis(config[_0x41d7('0xc')]));require(_0x41d7('0xf'))['register'](socket);function respondWithRpcPromise(_0x5312bc,_0x3689f8,_0x401e19){return new BPromise(function(_0x3426a0,_0x86dfaa){return client['request'](_0x5312bc,_0x401e19)['then'](function(_0x1ebbfc){logger[_0x41d7('0x10')](_0x41d7('0x11'),_0x3689f8,_0x41d7('0x12'));logger[_0x41d7('0x13')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3689f8,'request\x20sent',JSON['stringify'](_0x1ebbfc));if(_0x1ebbfc[_0x41d7('0x14')]){if(_0x1ebbfc[_0x41d7('0x14')][_0x41d7('0x15')]===0x1f4){logger[_0x41d7('0x14')](_0x41d7('0x11'),_0x3689f8,_0x1ebbfc[_0x41d7('0x14')]['message']);return _0x86dfaa(_0x1ebbfc[_0x41d7('0x14')][_0x41d7('0x16')]);}logger['error'](_0x41d7('0x11'),_0x3689f8,_0x1ebbfc[_0x41d7('0x14')][_0x41d7('0x16')]);return _0x3426a0(_0x1ebbfc[_0x41d7('0x14')][_0x41d7('0x16')]);}else{logger[_0x41d7('0x10')](_0x41d7('0x11'),_0x3689f8,_0x41d7('0x12'));_0x3426a0(_0x1ebbfc[_0x41d7('0x17')][_0x41d7('0x16')]);}})[_0x41d7('0x18')](function(_0x27db28){logger[_0x41d7('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x3689f8,_0x27db28);_0x86dfaa(_0x27db28);});});}exports[_0x41d7('0x19')]=function(_0x3490a3){var _0x125814=this;return new Promise(function(_0x4b655a,_0x56a7a9){return db['WhatsappQueue'][_0x41d7('0x1a')]({'raw':_0x3490a3[_0x41d7('0x1b')]?_0x3490a3[_0x41d7('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3490a3[_0x41d7('0x1b')]?_0x3490a3['options'][_0x41d7('0x1c')]||null:null,'attributes':_0x3490a3[_0x41d7('0x1b')]?_0x3490a3[_0x41d7('0x1b')][_0x41d7('0x1d')]||null:null,'limit':_0x3490a3[_0x41d7('0x1b')]?_0x3490a3[_0x41d7('0x1b')][_0x41d7('0x1e')]||null:null,'include':_0x3490a3[_0x41d7('0x1b')]?_0x3490a3[_0x41d7('0x1b')]['include']?_['map'](_0x3490a3[_0x41d7('0x1b')][_0x41d7('0x1f')],function(_0x980d54){return{'model':db[_0x980d54[_0x41d7('0x20')]],'as':_0x980d54['as'],'attributes':_0x980d54['attributes'],'include':_0x980d54[_0x41d7('0x1f')]?_['map'](_0x980d54[_0x41d7('0x1f')],function(_0x33ca2f){return{'model':db[_0x33ca2f[_0x41d7('0x20')]],'as':_0x33ca2f['as'],'attributes':_0x33ca2f[_0x41d7('0x1d')],'include':_0x33ca2f[_0x41d7('0x1f')]?_[_0x41d7('0x21')](_0x33ca2f['include'],function(_0x3c8a70){return{'model':db[_0x3c8a70[_0x41d7('0x20')]],'as':_0x3c8a70['as'],'attributes':_0x3c8a70[_0x41d7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x41d7('0x22')](function(_0x41bb42){logger[_0x41d7('0x10')](_0x41d7('0x19'),_0x3490a3);logger['debug'](_0x41d7('0x19'),_0x3490a3,JSON['stringify'](_0x41bb42));_0x4b655a(_0x41bb42);})['catch'](function(_0x221296){logger[_0x41d7('0x14')](_0x41d7('0x19'),_0x221296[_0x41d7('0x16')],_0x3490a3);_0x56a7a9(_0x125814[_0x41d7('0x14')](0x1f4,_0x221296[_0x41d7('0x16')]));});});};exports[_0x41d7('0x23')]=function(_0x40ca82){var _0x125407=this;return new Promise(function(_0x41c84f,_0x5d8d46){return db[_0x41d7('0x24')]['find']({'raw':_0x40ca82[_0x41d7('0x1b')]?_0x40ca82['options']['raw']===undefined?!![]:![]:!![],'where':_0x40ca82[_0x41d7('0x1b')]?_0x40ca82[_0x41d7('0x1b')]['where']||null:null,'attributes':_0x40ca82[_0x41d7('0x1b')]?_0x40ca82[_0x41d7('0x1b')][_0x41d7('0x1d')]||null:null,'include':_0x40ca82[_0x41d7('0x1b')]?_0x40ca82[_0x41d7('0x1b')][_0x41d7('0x1f')]?_[_0x41d7('0x21')](_0x40ca82[_0x41d7('0x1b')][_0x41d7('0x1f')],function(_0x2addee){return{'model':db[_0x2addee['model']],'as':_0x2addee['as'],'attributes':_0x2addee[_0x41d7('0x1d')],'include':_0x2addee[_0x41d7('0x1f')]?_['map'](_0x2addee[_0x41d7('0x1f')],function(_0x4d8672){return{'model':db[_0x4d8672['model']],'as':_0x4d8672['as'],'attributes':_0x4d8672[_0x41d7('0x1d')],'include':_0x4d8672[_0x41d7('0x1f')]?_[_0x41d7('0x21')](_0x4d8672[_0x41d7('0x1f')],function(_0x572a90){return{'model':db[_0x572a90[_0x41d7('0x20')]],'as':_0x572a90['as'],'attributes':_0x572a90[_0x41d7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x41d7('0x22')](function(_0x66e142){logger['info'](_0x41d7('0x23'),_0x40ca82);logger[_0x41d7('0x13')](_0x41d7('0x23'),_0x40ca82,JSON[_0x41d7('0x25')](_0x66e142));_0x41c84f(_0x66e142);})['catch'](function(_0x4d8690){logger[_0x41d7('0x14')](_0x41d7('0x23'),_0x4d8690[_0x41d7('0x16')],_0x40ca82);_0x5d8d46(_0x125407['error'](0x1f4,_0x4d8690[_0x41d7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index fb7f7c4..bfbde82 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 _0xbf01=['remove','emit','removeListener','length','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0xbf01,0x83));var _0x1bf0=function(_0x51bb38,_0x4e57a0){_0x51bb38=_0x51bb38-0x0;var _0x51c09b=_0xbf01[_0x51bb38];return _0x51c09b;};'use strict';var WhatsappQueueEvents=require(_0x1bf0('0x0'));var events=[_0x1bf0('0x1'),_0x1bf0('0x2'),'update'];function createListener(_0x3a021e,_0x1f3bfc){return function(_0x143189){_0x1f3bfc[_0x1bf0('0x3')](_0x3a021e,_0x143189);};}function removeListener(_0x3a557e,_0x3d785d){return function(){WhatsappQueueEvents[_0x1bf0('0x4')](_0x3a557e,_0x3d785d);};}exports['register']=function(_0x579867){for(var _0x4745b9=0x0,_0x109739=events[_0x1bf0('0x5')];_0x4745b9<_0x109739;_0x4745b9++){var _0x340b13=events[_0x4745b9];var _0xdd88af=createListener(_0x1bf0('0x6')+_0x340b13,_0x579867);WhatsappQueueEvents['on'](_0x340b13,_0xdd88af);}}; \ No newline at end of file +var _0x24ff=['save','update','emit','register','length','whatsappQueue:'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x24ff,0x78));var _0xf24f=function(_0x394fc8,_0x9d8a3d){_0x394fc8=_0x394fc8-0x0;var _0x212f15=_0x24ff[_0x394fc8];return _0x212f15;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xf24f('0x0'),'remove',_0xf24f('0x1')];function createListener(_0xa8745,_0x3219e7){return function(_0x2147da){_0x3219e7[_0xf24f('0x2')](_0xa8745,_0x2147da);};}function removeListener(_0x4055c8,_0x42d517){return function(){WhatsappQueueEvents['removeListener'](_0x4055c8,_0x42d517);};}exports[_0xf24f('0x3')]=function(_0x938cd4){for(var _0x166e1e=0x0,_0x32e777=events[_0xf24f('0x4')];_0x166e1e<_0x32e777;_0x166e1e++){var _0x3cb87c=events[_0x166e1e];var _0x3bb609=createListener(_0xf24f('0x5')+_0x3cb87c,_0x938cd4);WhatsappQueueEvents['on'](_0x3cb87c,_0x3bb609);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 475a6e8..ef066ab 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 _0x0496=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','create','/:id','update'];(function(_0x57d0f7,_0x29acbe){var _0x194bf5=function(_0x24b049){while(--_0x24b049){_0x57d0f7['push'](_0x57d0f7['shift']());}};_0x194bf5(++_0x29acbe);}(_0x0496,0x199));var _0x6049=function(_0x169bdb,_0x4c1f87){_0x169bdb=_0x169bdb-0x0;var _0x5ec7d7=_0x0496[_0x169bdb];return _0x5ec7d7;};'use strict';var multer=require(_0x6049('0x0'));var util=require('util');var path=require(_0x6049('0x1'));var timeout=require(_0x6049('0x2'));var express=require(_0x6049('0x3'));var router=express[_0x6049('0x4')]();var auth=require(_0x6049('0x5'));var interaction=require(_0x6049('0x6'));var config=require('../../config/environment');var controller=require(_0x6049('0x7'));router[_0x6049('0x8')]('/',auth[_0x6049('0x9')](),controller[_0x6049('0xa')]);router[_0x6049('0x8')](_0x6049('0xb'),auth[_0x6049('0x9')](),controller[_0x6049('0xc')]);router[_0x6049('0x8')]('/:id',auth[_0x6049('0x9')](),controller['show']);router['post']('/',auth[_0x6049('0x9')](),controller[_0x6049('0xd')]);router['put'](_0x6049('0xe'),auth['isAuthenticated'](),controller[_0x6049('0xf')]);router['delete'](_0x6049('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x6049('0x10')]=router; \ No newline at end of file +var _0xf34b=['/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','/describe','describe'];(function(_0x4cc588,_0x4a9bc4){var _0x36619d=function(_0x12ee64){while(--_0x12ee64){_0x4cc588['push'](_0x4cc588['shift']());}};_0x36619d(++_0x4a9bc4);}(_0xf34b,0xa3));var _0xbf34=function(_0x30531b,_0xf42e3b){_0x30531b=_0x30531b-0x0;var _0x52e1ea=_0xf34b[_0x30531b];return _0x52e1ea;};'use strict';var multer=require(_0xbf34('0x0'));var util=require(_0xbf34('0x1'));var path=require(_0xbf34('0x2'));var timeout=require(_0xbf34('0x3'));var express=require(_0xbf34('0x4'));var router=express[_0xbf34('0x5')]();var auth=require(_0xbf34('0x6'));var interaction=require(_0xbf34('0x7'));var config=require(_0xbf34('0x8'));var controller=require(_0xbf34('0x9'));router[_0xbf34('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbf34('0xa')](_0xbf34('0xb'),auth['isAuthenticated'](),controller[_0xbf34('0xc')]);router[_0xbf34('0xa')](_0xbf34('0xd'),auth[_0xbf34('0xe')](),controller[_0xbf34('0xf')]);router[_0xbf34('0x10')]('/',auth[_0xbf34('0xe')](),controller[_0xbf34('0x11')]);router[_0xbf34('0x12')](_0xbf34('0xd'),auth[_0xbf34('0xe')](),controller[_0xbf34('0x13')]);router[_0xbf34('0x14')](_0xbf34('0xd'),auth['isAuthenticated'](),controller[_0xbf34('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 94c30a6..c063375 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 _0xa41a=['exports','STRING','DATE','sequelize'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xa41a,0x6b));var _0xaa41=function(_0x2a84d8,_0x4a3617){_0x2a84d8=_0x2a84d8-0x0;var _0x1c7241=_0xa41a[_0x2a84d8];return _0x1c7241;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xaa41('0x2')]},'joinAt':{'type':Sequelize[_0xaa41('0x3')]},'leaveAt':{'type':Sequelize[_0xaa41('0x3')]},'acceptAt':{'type':Sequelize[_0xaa41('0x3')]},'exitAt':{'type':Sequelize[_0xaa41('0x3')]},'reason':{'type':Sequelize[_0xaa41('0x2')]}}; \ No newline at end of file +var _0xf3cd=['STRING','DATE','sequelize','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x32a767,_0x4e3e76){_0x32a767=_0x32a767-0x0;var _0x2b4e6d=_0xf3cd[_0x32a767];return _0x2b4e6d;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdf3c('0x2')]},'joinAt':{'type':Sequelize[_0xdf3c('0x3')]},'leaveAt':{'type':Sequelize[_0xdf3c('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xdf3c('0x3')]},'reason':{'type':Sequelize[_0xdf3c('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 875c4f3..e5de708 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 _0x3fc6=['stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','params','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','error'];(function(_0x5d2d5c,_0x20522d){var _0x37975b=function(_0x55627e){while(--_0x55627e){_0x5d2d5c['push'](_0x5d2d5c['shift']());}};_0x37975b(++_0x20522d);}(_0x3fc6,0x159));var _0x63fc=function(_0x20d091,_0x5d4fd0){_0x20d091=_0x20d091-0x0;var _0x353978=_0x3fc6[_0x20d091];return _0x353978;};'use strict';var pdf=require(_0x63fc('0x0'));var emlformat=require(_0x63fc('0x1'));var rimraf=require(_0x63fc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x63fc('0x3'));var rp=require(_0x63fc('0x4'));var moment=require(_0x63fc('0x5'));var BPromise=require(_0x63fc('0x6'));var Mustache=require(_0x63fc('0x7'));var util=require(_0x63fc('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x63fc('0x9'));var ejs=require(_0x63fc('0xa'));var fs=require('fs');var _=require(_0x63fc('0xb'));var squel=require('squel');var crypto=require(_0x63fc('0xc'));var jsforce=require(_0x63fc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x63fc('0x9'));var querystring=require(_0x63fc('0xe'));var Papa=require(_0x63fc('0xf'));var Redis=require(_0x63fc('0x10'));var authService=require(_0x63fc('0x11'));var qs=require(_0x63fc('0x12'));var as=require(_0x63fc('0x13'));var hardwareService=require(_0x63fc('0x14'));var logger=require(_0x63fc('0x15'))(_0x63fc('0x16'));var utils=require('../../config/utils');var config=require(_0x63fc('0x17'));var licenseUtil=require(_0x63fc('0x18'));var db=require(_0x63fc('0x19'))['db'];function respondWithStatusCode(_0x4cdde1,_0x493528){_0x493528=_0x493528||0xcc;return function(_0x293c4c){if(_0x293c4c){return _0x4cdde1[_0x63fc('0x1a')](_0x493528);}return _0x4cdde1[_0x63fc('0x1b')](_0x493528)[_0x63fc('0x1c')]();};}function respondWithResult(_0xed9cc1,_0x1bcf57){_0x1bcf57=_0x1bcf57||0xc8;return function(_0x4ebbbf){if(_0x4ebbbf){return _0xed9cc1[_0x63fc('0x1b')](_0x1bcf57)[_0x63fc('0x1d')](_0x4ebbbf);}};}function respondWithFilteredResult(_0x46926d,_0x337192){return function(_0x5c4c72){if(_0x5c4c72){var _0x3cd826=_0x5c4c72[_0x63fc('0x1e')],_0x50b9c9=_0x337192[_0x63fc('0x1f')],_0x29614a=_0x337192[_0x63fc('0x1f')]+_0x337192['limit'],_0x35631f;if(_0x29614a>=_0x3cd826){_0x29614a=_0x3cd826;_0x35631f=0xc8;}else{_0x35631f=0xce;}_0x46926d[_0x63fc('0x1b')](_0x35631f);return _0x46926d[_0x63fc('0x20')](_0x63fc('0x21'),_0x50b9c9+'-'+_0x29614a+'/'+_0x3cd826)['json'](_0x5c4c72);}return null;};}function patchUpdates(_0x5c1cec){return function(_0x6e1361){try{jsonpatch[_0x63fc('0x22')](_0x6e1361,_0x5c1cec,!![]);}catch(_0x516872){return BPromise[_0x63fc('0x23')](_0x516872);}return _0x6e1361['save']();};}function saveUpdates(_0x1c2198,_0x2c6d11){return function(_0xb776fd){if(_0xb776fd){return _0xb776fd[_0x63fc('0x24')](_0x1c2198)[_0x63fc('0x25')](function(_0x9ba49){return _0x9ba49;});}return null;};}function removeEntity(_0x3047cf,_0x57528b){return function(_0x2e991e){if(_0x2e991e){return _0x2e991e[_0x63fc('0x26')]()[_0x63fc('0x25')](function(){_0x3047cf[_0x63fc('0x1b')](0xcc)[_0x63fc('0x1c')]();});}};}function handleEntityNotFound(_0x561c9b,_0x4f6498){return function(_0x3ceecc){if(!_0x3ceecc){_0x561c9b[_0x63fc('0x1a')](0x194);}return _0x3ceecc;};}function handleError(_0x1fb3fc,_0x3b6ac1){_0x3b6ac1=_0x3b6ac1||0x1f4;return function(_0x59b130){logger[_0x63fc('0x27')](_0x59b130[_0x63fc('0x28')]);if(_0x59b130[_0x63fc('0x29')]){delete _0x59b130[_0x63fc('0x29')];}_0x1fb3fc[_0x63fc('0x1b')](_0x3b6ac1)[_0x63fc('0x2a')](_0x59b130);};}exports[_0x63fc('0x2b')]=function(_0x2ea402,_0x5da5bd){var _0x585956={},_0x1d84f1={},_0x39dac8={'count':0x0,'rows':[]};var _0x596d61=_['map'](db['WhatsappQueueReport'][_0x63fc('0x2c')],function(_0x17c0fd){return{'name':_0x17c0fd[_0x63fc('0x2d')],'type':_0x17c0fd[_0x63fc('0x2e')][_0x63fc('0x2f')]};});_0x1d84f1[_0x63fc('0x30')]=_[_0x63fc('0x31')](_0x596d61,'name');_0x1d84f1[_0x63fc('0x32')]=_[_0x63fc('0x33')](_0x2ea402['query']);_0x1d84f1[_0x63fc('0x34')]=_[_0x63fc('0x35')](_0x1d84f1[_0x63fc('0x30')],_0x1d84f1['query']);_0x585956[_0x63fc('0x36')]=_['intersection'](_0x1d84f1[_0x63fc('0x30')],qs[_0x63fc('0x37')](_0x2ea402[_0x63fc('0x32')]['fields']));_0x585956[_0x63fc('0x36')]=_0x585956[_0x63fc('0x36')][_0x63fc('0x38')]?_0x585956['attributes']:_0x1d84f1[_0x63fc('0x30')];if(!_0x2ea402['query'][_0x63fc('0x39')](_0x63fc('0x3a'))){_0x585956[_0x63fc('0x3b')]=qs['limit'](_0x2ea402[_0x63fc('0x32')][_0x63fc('0x3b')]);_0x585956[_0x63fc('0x1f')]=qs['offset'](_0x2ea402[_0x63fc('0x32')]['offset']);}_0x585956[_0x63fc('0x3c')]=qs[_0x63fc('0x3d')](_0x2ea402['query'][_0x63fc('0x3d')]);_0x585956[_0x63fc('0x3e')]=qs['filters'](_[_0x63fc('0x3f')](_0x2ea402['query'],_0x1d84f1['filters']),_0x596d61);if(_0x2ea402['query']['filter']){_0x585956[_0x63fc('0x3e')]=_[_0x63fc('0x40')](_0x585956[_0x63fc('0x3e')],{'$or':_['map'](_0x596d61,function(_0x25a838){if(_0x25a838[_0x63fc('0x2e')]!=='VIRTUAL'){var _0x5673e3={};_0x5673e3[_0x25a838[_0x63fc('0x29')]]={'$like':'%'+_0x2ea402[_0x63fc('0x32')]['filter']+'%'};return _0x5673e3;}})});}_0x585956=_[_0x63fc('0x40')]({},_0x585956,_0x2ea402[_0x63fc('0x41')]);var _0x49537f={'where':_0x585956['where']};return db[_0x63fc('0x42')][_0x63fc('0x1e')](_0x49537f)[_0x63fc('0x25')](function(_0x2c9a5e){_0x39dac8[_0x63fc('0x1e')]=_0x2c9a5e;if(_0x2ea402[_0x63fc('0x32')][_0x63fc('0x43')]){_0x585956[_0x63fc('0x44')]=[{'all':!![]}];}return db[_0x63fc('0x42')][_0x63fc('0x45')](_0x585956);})['then'](function(_0x76c937){_0x39dac8[_0x63fc('0x46')]=_0x76c937;return _0x39dac8;})[_0x63fc('0x25')](respondWithFilteredResult(_0x5da5bd,_0x585956))[_0x63fc('0x47')](handleError(_0x5da5bd,null));};exports['show']=function(_0x3d66f7,_0x1a3f04){var _0x282f7a={'raw':!![],'where':{'id':_0x3d66f7[_0x63fc('0x48')]['id']}},_0x3e6936={};_0x3e6936[_0x63fc('0x30')]=_['keys'](db[_0x63fc('0x42')][_0x63fc('0x2c')]);_0x3e6936[_0x63fc('0x32')]=_[_0x63fc('0x33')](_0x3d66f7[_0x63fc('0x32')]);_0x3e6936['filtears']=_[_0x63fc('0x35')](_0x3e6936[_0x63fc('0x30')],_0x3e6936[_0x63fc('0x32')]);_0x282f7a[_0x63fc('0x36')]=_[_0x63fc('0x35')](_0x3e6936[_0x63fc('0x30')],qs[_0x63fc('0x37')](_0x3d66f7[_0x63fc('0x32')][_0x63fc('0x37')]));_0x282f7a[_0x63fc('0x36')]=_0x282f7a[_0x63fc('0x36')]['length']?_0x282f7a[_0x63fc('0x36')]:_0x3e6936['model'];if(_0x3d66f7[_0x63fc('0x32')]['includeAll']){_0x282f7a[_0x63fc('0x44')]=[{'all':!![]}];}_0x282f7a=_['merge']({},_0x282f7a,_0x3d66f7['options']);return db['WhatsappQueueReport'][_0x63fc('0x49')](_0x282f7a)['then'](handleEntityNotFound(_0x1a3f04,null))['then'](respondWithResult(_0x1a3f04,null))[_0x63fc('0x47')](handleError(_0x1a3f04,null));};exports['create']=function(_0x4ca595,_0x49dd37){return db[_0x63fc('0x42')][_0x63fc('0x4a')](_0x4ca595['body'],{})[_0x63fc('0x25')](respondWithResult(_0x49dd37,0xc9))['catch'](handleError(_0x49dd37,null));};exports[_0x63fc('0x24')]=function(_0x569633,_0x15c839){if(_0x569633[_0x63fc('0x4b')]['id']){delete _0x569633[_0x63fc('0x4b')]['id'];}return db[_0x63fc('0x42')][_0x63fc('0x49')]({'where':{'id':_0x569633[_0x63fc('0x48')]['id']}})['then'](handleEntityNotFound(_0x15c839,null))[_0x63fc('0x25')](saveUpdates(_0x569633[_0x63fc('0x4b')],null))[_0x63fc('0x25')](respondWithResult(_0x15c839,null))[_0x63fc('0x47')](handleError(_0x15c839,null));};exports['destroy']=function(_0x3347da,_0x373ba1){return db[_0x63fc('0x42')]['find']({'where':{'id':_0x3347da[_0x63fc('0x48')]['id']}})[_0x63fc('0x25')](handleEntityNotFound(_0x373ba1,null))[_0x63fc('0x25')](removeEntity(_0x373ba1,null))[_0x63fc('0x47')](handleError(_0x373ba1,null));};exports[_0x63fc('0x4c')]=function(_0x3910ef,_0x2ea6f3){return db[_0x63fc('0x42')][_0x63fc('0x4c')]()[_0x63fc('0x25')](respondWithResult(_0x2ea6f3,null))[_0x63fc('0x47')](handleError(_0x2ea6f3,null));}; \ No newline at end of file +var _0x7266=['create','body','update','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','params','filtears'];(function(_0x5cef20,_0x26937c){var _0x12d6bc=function(_0x489498){while(--_0x489498){_0x5cef20['push'](_0x5cef20['shift']());}};_0x12d6bc(++_0x26937c);}(_0x7266,0xec));var _0x6726=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7266[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x6726('0x0'));var emlformat=require(_0x6726('0x1'));var rimraf=require(_0x6726('0x2'));var zipdir=require(_0x6726('0x3'));var jsonpatch=require(_0x6726('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6726('0x5'));var Mustache=require(_0x6726('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6726('0x7'));var csv=require(_0x6726('0x8'));var ejs=require(_0x6726('0x9'));var fs=require('fs');var _=require(_0x6726('0xa'));var squel=require(_0x6726('0xb'));var crypto=require(_0x6726('0xc'));var jsforce=require(_0x6726('0xd'));var deskjs=require(_0x6726('0xe'));var toCsv=require(_0x6726('0x8'));var querystring=require(_0x6726('0xf'));var Papa=require(_0x6726('0x10'));var Redis=require(_0x6726('0x11'));var authService=require(_0x6726('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6726('0x13'));var hardwareService=require(_0x6726('0x14'));var logger=require(_0x6726('0x15'))(_0x6726('0x16'));var utils=require('../../config/utils');var config=require(_0x6726('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6726('0x18'))['db'];function respondWithStatusCode(_0x15640f,_0x59c044){_0x59c044=_0x59c044||0xcc;return function(_0x1d088c){if(_0x1d088c){return _0x15640f[_0x6726('0x19')](_0x59c044);}return _0x15640f[_0x6726('0x1a')](_0x59c044)[_0x6726('0x1b')]();};}function respondWithResult(_0x587b52,_0x33b6d7){_0x33b6d7=_0x33b6d7||0xc8;return function(_0x2eb2bc){if(_0x2eb2bc){return _0x587b52['status'](_0x33b6d7)[_0x6726('0x1c')](_0x2eb2bc);}};}function respondWithFilteredResult(_0x5d3458,_0x12f043){return function(_0x36361d){if(_0x36361d){var _0xc1fed9=_0x36361d[_0x6726('0x1d')],_0x3a3b6a=_0x12f043['offset'],_0x5ea0cc=_0x12f043[_0x6726('0x1e')]+_0x12f043['limit'],_0x8323b2;if(_0x5ea0cc>=_0xc1fed9){_0x5ea0cc=_0xc1fed9;_0x8323b2=0xc8;}else{_0x8323b2=0xce;}_0x5d3458['status'](_0x8323b2);return _0x5d3458['set'](_0x6726('0x1f'),_0x3a3b6a+'-'+_0x5ea0cc+'/'+_0xc1fed9)[_0x6726('0x1c')](_0x36361d);}return null;};}function patchUpdates(_0x5860c5){return function(_0x3a27d2){try{jsonpatch[_0x6726('0x20')](_0x3a27d2,_0x5860c5,!![]);}catch(_0x27562c){return BPromise[_0x6726('0x21')](_0x27562c);}return _0x3a27d2[_0x6726('0x22')]();};}function saveUpdates(_0x37f0ad,_0x4af165){return function(_0x300e56){if(_0x300e56){return _0x300e56['update'](_0x37f0ad)[_0x6726('0x23')](function(_0x1efc5b){return _0x1efc5b;});}return null;};}function removeEntity(_0x429a42,_0x1aa422){return function(_0xd10662){if(_0xd10662){return _0xd10662[_0x6726('0x24')]()['then'](function(){_0x429a42[_0x6726('0x1a')](0xcc)[_0x6726('0x1b')]();});}};}function handleEntityNotFound(_0xf9d466,_0x21618c){return function(_0x544b2b){if(!_0x544b2b){_0xf9d466[_0x6726('0x19')](0x194);}return _0x544b2b;};}function handleError(_0x48373b,_0x497d49){_0x497d49=_0x497d49||0x1f4;return function(_0x3cce96){logger[_0x6726('0x25')](_0x3cce96[_0x6726('0x26')]);if(_0x3cce96[_0x6726('0x27')]){delete _0x3cce96['name'];}_0x48373b[_0x6726('0x1a')](_0x497d49)[_0x6726('0x28')](_0x3cce96);};}exports[_0x6726('0x29')]=function(_0x4947f2,_0x2c6d07){var _0x5d25a0={},_0x4fd2fd={},_0x50c743={'count':0x0,'rows':[]};var _0x23e557=_[_0x6726('0x2a')](db[_0x6726('0x2b')][_0x6726('0x2c')],function(_0x5156ae){return{'name':_0x5156ae[_0x6726('0x2d')],'type':_0x5156ae[_0x6726('0x2e')][_0x6726('0x2f')]};});_0x4fd2fd['model']=_[_0x6726('0x2a')](_0x23e557,_0x6726('0x27'));_0x4fd2fd['query']=_[_0x6726('0x30')](_0x4947f2[_0x6726('0x31')]);_0x4fd2fd[_0x6726('0x32')]=_[_0x6726('0x33')](_0x4fd2fd[_0x6726('0x34')],_0x4fd2fd[_0x6726('0x31')]);_0x5d25a0[_0x6726('0x35')]=_[_0x6726('0x33')](_0x4fd2fd['model'],qs[_0x6726('0x36')](_0x4947f2[_0x6726('0x31')][_0x6726('0x36')]));_0x5d25a0[_0x6726('0x35')]=_0x5d25a0[_0x6726('0x35')][_0x6726('0x37')]?_0x5d25a0[_0x6726('0x35')]:_0x4fd2fd[_0x6726('0x34')];if(!_0x4947f2['query']['hasOwnProperty'](_0x6726('0x38'))){_0x5d25a0['limit']=qs[_0x6726('0x39')](_0x4947f2[_0x6726('0x31')]['limit']);_0x5d25a0[_0x6726('0x1e')]=qs[_0x6726('0x1e')](_0x4947f2[_0x6726('0x31')]['offset']);}_0x5d25a0[_0x6726('0x3a')]=qs[_0x6726('0x3b')](_0x4947f2['query']['sort']);_0x5d25a0[_0x6726('0x3c')]=qs[_0x6726('0x32')](_[_0x6726('0x3d')](_0x4947f2[_0x6726('0x31')],_0x4fd2fd[_0x6726('0x32')]),_0x23e557);if(_0x4947f2[_0x6726('0x31')]['filter']){_0x5d25a0['where']=_[_0x6726('0x3e')](_0x5d25a0[_0x6726('0x3c')],{'$or':_[_0x6726('0x2a')](_0x23e557,function(_0x30444c){if(_0x30444c[_0x6726('0x2e')]!=='VIRTUAL'){var _0x137690={};_0x137690[_0x30444c[_0x6726('0x27')]]={'$like':'%'+_0x4947f2['query'][_0x6726('0x3f')]+'%'};return _0x137690;}})});}_0x5d25a0=_[_0x6726('0x3e')]({},_0x5d25a0,_0x4947f2[_0x6726('0x40')]);var _0x22834a={'where':_0x5d25a0[_0x6726('0x3c')]};return db[_0x6726('0x2b')][_0x6726('0x1d')](_0x22834a)[_0x6726('0x23')](function(_0x2dab3b){_0x50c743[_0x6726('0x1d')]=_0x2dab3b;if(_0x4947f2[_0x6726('0x31')][_0x6726('0x41')]){_0x5d25a0[_0x6726('0x42')]=[{'all':!![]}];}return db[_0x6726('0x2b')][_0x6726('0x43')](_0x5d25a0);})[_0x6726('0x23')](function(_0xfe28b){_0x50c743[_0x6726('0x44')]=_0xfe28b;return _0x50c743;})[_0x6726('0x23')](respondWithFilteredResult(_0x2c6d07,_0x5d25a0))[_0x6726('0x45')](handleError(_0x2c6d07,null));};exports['show']=function(_0x517c90,_0x41dc9f){var _0x481f3d={'raw':!![],'where':{'id':_0x517c90[_0x6726('0x46')]['id']}},_0x39f51f={};_0x39f51f[_0x6726('0x34')]=_[_0x6726('0x30')](db[_0x6726('0x2b')][_0x6726('0x2c')]);_0x39f51f['query']=_[_0x6726('0x30')](_0x517c90['query']);_0x39f51f[_0x6726('0x47')]=_['intersection'](_0x39f51f['model'],_0x39f51f[_0x6726('0x31')]);_0x481f3d[_0x6726('0x35')]=_['intersection'](_0x39f51f[_0x6726('0x34')],qs[_0x6726('0x36')](_0x517c90['query'][_0x6726('0x36')]));_0x481f3d['attributes']=_0x481f3d['attributes']['length']?_0x481f3d[_0x6726('0x35')]:_0x39f51f['model'];if(_0x517c90['query'][_0x6726('0x41')]){_0x481f3d['include']=[{'all':!![]}];}_0x481f3d=_['merge']({},_0x481f3d,_0x517c90[_0x6726('0x40')]);return db[_0x6726('0x2b')]['find'](_0x481f3d)['then'](handleEntityNotFound(_0x41dc9f,null))[_0x6726('0x23')](respondWithResult(_0x41dc9f,null))[_0x6726('0x45')](handleError(_0x41dc9f,null));};exports[_0x6726('0x48')]=function(_0x3ef135,_0xcad4e4){return db[_0x6726('0x2b')][_0x6726('0x48')](_0x3ef135[_0x6726('0x49')],{})[_0x6726('0x23')](respondWithResult(_0xcad4e4,0xc9))[_0x6726('0x45')](handleError(_0xcad4e4,null));};exports[_0x6726('0x4a')]=function(_0x372f47,_0x5254b0){if(_0x372f47[_0x6726('0x49')]['id']){delete _0x372f47[_0x6726('0x49')]['id'];}return db['WhatsappQueueReport'][_0x6726('0x4b')]({'where':{'id':_0x372f47[_0x6726('0x46')]['id']}})[_0x6726('0x23')](handleEntityNotFound(_0x5254b0,null))[_0x6726('0x23')](saveUpdates(_0x372f47[_0x6726('0x49')],null))['then'](respondWithResult(_0x5254b0,null))[_0x6726('0x45')](handleError(_0x5254b0,null));};exports[_0x6726('0x24')]=function(_0x2bd1c8,_0x185dd8){return db[_0x6726('0x2b')][_0x6726('0x4b')]({'where':{'id':_0x2bd1c8[_0x6726('0x46')]['id']}})[_0x6726('0x23')](handleEntityNotFound(_0x185dd8,null))['then'](removeEntity(_0x185dd8,null))['catch'](handleError(_0x185dd8,null));};exports[_0x6726('0x4c')]=function(_0x415643,_0x35c310){return db[_0x6726('0x2b')]['describe']()[_0x6726('0x23')](respondWithResult(_0x35c310,null))[_0x6726('0x45')](handleError(_0x35c310,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index a33e499..11f0e7f 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 _0xa405=['lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueueReport.attributes','define','report_whatsapp_queue','uniqueid'];(function(_0x4c6835,_0x259c94){var _0x2a11c4=function(_0x322a6b){while(--_0x322a6b){_0x4c6835['push'](_0x4c6835['shift']());}};_0x2a11c4(++_0x259c94);}(_0xa405,0x6e));var _0x5a40=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa405[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x5a40('0x0'));var util=require('util');var logger=require(_0x5a40('0x1'))('api');var moment=require(_0x5a40('0x2'));var BPromise=require(_0x5a40('0x3'));var rp=require(_0x5a40('0x4'));var fs=require('fs');var path=require(_0x5a40('0x5'));var rimraf=require('rimraf');var config=require(_0x5a40('0x6'));var attributes=require(_0x5a40('0x7'));module['exports']=function(_0x22eb40,_0x320430){return _0x22eb40[_0x5a40('0x8')]('WhatsappQueueReport',attributes,{'tableName':_0x5a40('0x9'),'paranoid':![],'indexes':[{'name':_0x5a40('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xba0e=['path','rimraf','../../config/environment','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x248db2,_0x1a0bd7){var _0xf80c5d=function(_0x4941ab){while(--_0x4941ab){_0x248db2['push'](_0x248db2['shift']());}};_0xf80c5d(++_0x1a0bd7);}(_0xba0e,0x1ab));var _0xeba0=function(_0x450ca6,_0xbbf162){_0x450ca6=_0x450ca6-0x0;var _0x286a84=_0xba0e[_0x450ca6];return _0x286a84;};'use strict';var _=require(_0xeba0('0x0'));var util=require(_0xeba0('0x1'));var logger=require(_0xeba0('0x2'))(_0xeba0('0x3'));var moment=require(_0xeba0('0x4'));var BPromise=require(_0xeba0('0x5'));var rp=require(_0xeba0('0x6'));var fs=require('fs');var path=require(_0xeba0('0x7'));var rimraf=require(_0xeba0('0x8'));var config=require(_0xeba0('0x9'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x1f7a4a,_0x26b3c1){return _0x1f7a4a[_0xeba0('0xa')](_0xeba0('0xb'),attributes,{'tableName':_0xeba0('0xc'),'paranoid':![],'indexes':[{'name':_0xeba0('0xd'),'fields':[_0xeba0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 7dbc702..3e7bd25 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 _0xda5c=['message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','update','raw','where','limit','UpdateWhatsappQueueReport','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0xda5c,0xb7));var _0xcda5=function(_0x1c5280,_0x419e49){_0x1c5280=_0x1c5280-0x0;var _0x24b5a6=_0xda5c[_0x1c5280];return _0x24b5a6;};'use strict';var _=require('lodash');var util=require(_0xcda5('0x0'));var moment=require(_0xcda5('0x1'));var BPromise=require('bluebird');var rs=require(_0xcda5('0x2'));var fs=require('fs');var Redis=require(_0xcda5('0x3'));var db=require(_0xcda5('0x4'))['db'];var utils=require(_0xcda5('0x5'));var logger=require(_0xcda5('0x6'))(_0xcda5('0x7'));var config=require(_0xcda5('0x8'));var jayson=require(_0xcda5('0x9'));var client=jayson[_0xcda5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x885e78,_0x4898a5,_0x4786fe){return new BPromise(function(_0x5848bc,_0x3d81fd){return client[_0xcda5('0xb')](_0x885e78,_0x4786fe)[_0xcda5('0xc')](function(_0x26ee4e){logger[_0xcda5('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4898a5,'request\x20sent');logger[_0xcda5('0xe')](_0xcda5('0xf'),_0x4898a5,_0xcda5('0x10'),JSON[_0xcda5('0x11')](_0x26ee4e));if(_0x26ee4e[_0xcda5('0x12')]){if(_0x26ee4e[_0xcda5('0x12')][_0xcda5('0x13')]===0x1f4){logger[_0xcda5('0x12')](_0xcda5('0x14'),_0x4898a5,_0x26ee4e['error']['message']);return _0x3d81fd(_0x26ee4e['error'][_0xcda5('0x15')]);}logger[_0xcda5('0x12')](_0xcda5('0x14'),_0x4898a5,_0x26ee4e[_0xcda5('0x12')][_0xcda5('0x15')]);return _0x5848bc(_0x26ee4e[_0xcda5('0x12')][_0xcda5('0x15')]);}else{logger['info'](_0xcda5('0x14'),_0x4898a5,_0xcda5('0x10'));_0x5848bc(_0x26ee4e[_0xcda5('0x16')][_0xcda5('0x15')]);}})[_0xcda5('0x17')](function(_0x138508){logger[_0xcda5('0x12')](_0xcda5('0x14'),_0x4898a5,_0x138508);_0x3d81fd(_0x138508);});});}exports[_0xcda5('0x18')]=function(_0x156db1){var _0x274e89=this;return new Promise(function(_0x5d5a82,_0x3bb023){return db[_0xcda5('0x19')][_0xcda5('0x1a')](_0x156db1[_0xcda5('0x1b')],{'raw':_0x156db1[_0xcda5('0x1c')]?_0x156db1['options']['raw']===undefined?!![]:![]:!![]})[_0xcda5('0xc')](function(_0x3e4be4){logger[_0xcda5('0xd')](_0xcda5('0x18'),_0x156db1);logger[_0xcda5('0xe')](_0xcda5('0x18'),_0x156db1,JSON[_0xcda5('0x11')](_0x3e4be4));_0x5d5a82(_0x3e4be4);})['catch'](function(_0x538f42){logger[_0xcda5('0x12')](_0xcda5('0x18'),_0x538f42[_0xcda5('0x15')],_0x156db1);_0x3bb023(_0x274e89['error'](0x1f4,_0x538f42[_0xcda5('0x15')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x21c0d8){var _0x5d40bd=this;return new Promise(function(_0x5ca13c,_0x36c375){return db[_0xcda5('0x19')][_0xcda5('0x1d')](_0x21c0d8[_0xcda5('0x1b')],{'raw':_0x21c0d8[_0xcda5('0x1c')]?_0x21c0d8['options'][_0xcda5('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21c0d8[_0xcda5('0x1c')]?_0x21c0d8[_0xcda5('0x1c')][_0xcda5('0x1f')]||null:null,'attributes':_0x21c0d8[_0xcda5('0x1c')]?_0x21c0d8['options']['attributes']||null:null,'limit':_0x21c0d8[_0xcda5('0x1c')]?_0x21c0d8[_0xcda5('0x1c')][_0xcda5('0x20')]||null:null})[_0xcda5('0xc')](function(_0xbfbe32){logger['info']('UpdateWhatsappQueueReport',_0x21c0d8);logger[_0xcda5('0xe')](_0xcda5('0x21'),_0x21c0d8,JSON[_0xcda5('0x11')](_0xbfbe32));_0x5ca13c(_0xbfbe32);})['catch'](function(_0x561ab2){logger[_0xcda5('0x12')](_0xcda5('0x21'),_0x561ab2['message'],_0x21c0d8);_0x36c375(_0x5d40bd[_0xcda5('0x12')](0x1f4,_0x561ab2[_0xcda5('0x15')]));});});}; \ No newline at end of file +var _0x28e5=['client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','update','where','attributes','limit','UpdateWhatsappQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x28e5,0x122));var _0x528e=function(_0x338710,_0x50656c){_0x338710=_0x338710-0x0;var _0x3c5941=_0x28e5[_0x338710];return _0x3c5941;};'use strict';var _=require(_0x528e('0x0'));var util=require(_0x528e('0x1'));var moment=require('moment');var BPromise=require(_0x528e('0x2'));var rs=require(_0x528e('0x3'));var fs=require('fs');var Redis=require(_0x528e('0x4'));var db=require(_0x528e('0x5'))['db'];var utils=require(_0x528e('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x528e('0x7')][_0x528e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x590c31,_0x3f88c8,_0x4075e2){return new BPromise(function(_0x2f7271,_0x818a3c){return client[_0x528e('0x9')](_0x590c31,_0x4075e2)[_0x528e('0xa')](function(_0x3c59ae){logger[_0x528e('0xb')](_0x528e('0xc'),_0x3f88c8,_0x528e('0xd'));logger[_0x528e('0xe')](_0x528e('0xf'),_0x3f88c8,_0x528e('0xd'),JSON[_0x528e('0x10')](_0x3c59ae));if(_0x3c59ae[_0x528e('0x11')]){if(_0x3c59ae[_0x528e('0x11')][_0x528e('0x12')]===0x1f4){logger[_0x528e('0x11')](_0x528e('0xc'),_0x3f88c8,_0x3c59ae[_0x528e('0x11')][_0x528e('0x13')]);return _0x818a3c(_0x3c59ae[_0x528e('0x11')]['message']);}logger[_0x528e('0x11')](_0x528e('0xc'),_0x3f88c8,_0x3c59ae[_0x528e('0x11')][_0x528e('0x13')]);return _0x2f7271(_0x3c59ae['error']['message']);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x3f88c8,_0x528e('0xd'));_0x2f7271(_0x3c59ae[_0x528e('0x14')][_0x528e('0x13')]);}})[_0x528e('0x15')](function(_0x236c3a){logger[_0x528e('0x11')](_0x528e('0xc'),_0x3f88c8,_0x236c3a);_0x818a3c(_0x236c3a);});});}exports['CreateWhatsappQueueReport']=function(_0x16b8be){var _0x1c8633=this;return new Promise(function(_0x473e32,_0x25ad8f){return db[_0x528e('0x16')][_0x528e('0x17')](_0x16b8be[_0x528e('0x18')],{'raw':_0x16b8be[_0x528e('0x19')]?_0x16b8be[_0x528e('0x19')][_0x528e('0x1a')]===undefined?!![]:![]:!![]})[_0x528e('0xa')](function(_0x15c612){logger[_0x528e('0xb')]('CreateWhatsappQueueReport',_0x16b8be);logger[_0x528e('0xe')](_0x528e('0x1b'),_0x16b8be,JSON[_0x528e('0x10')](_0x15c612));_0x473e32(_0x15c612);})[_0x528e('0x15')](function(_0x1fc52d){logger[_0x528e('0x11')]('CreateWhatsappQueueReport',_0x1fc52d[_0x528e('0x13')],_0x16b8be);_0x25ad8f(_0x1c8633[_0x528e('0x11')](0x1f4,_0x1fc52d[_0x528e('0x13')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x33575a){var _0x1e71e2=this;return new Promise(function(_0x269aec,_0x18d434){return db['WhatsappQueueReport'][_0x528e('0x1c')](_0x33575a[_0x528e('0x18')],{'raw':_0x33575a[_0x528e('0x19')]?_0x33575a[_0x528e('0x19')][_0x528e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33575a[_0x528e('0x19')]?_0x33575a[_0x528e('0x19')][_0x528e('0x1d')]||null:null,'attributes':_0x33575a[_0x528e('0x19')]?_0x33575a[_0x528e('0x19')][_0x528e('0x1e')]||null:null,'limit':_0x33575a[_0x528e('0x19')]?_0x33575a[_0x528e('0x19')][_0x528e('0x1f')]||null:null})['then'](function(_0x2c756b){logger['info'](_0x528e('0x20'),_0x33575a);logger[_0x528e('0xe')](_0x528e('0x20'),_0x33575a,JSON[_0x528e('0x10')](_0x2c756b));_0x269aec(_0x2c756b);})[_0x528e('0x15')](function(_0x5224a5){logger[_0x528e('0x11')]('UpdateWhatsappQueueReport',_0x5224a5[_0x528e('0x13')],_0x33575a);_0x18d434(_0x1e71e2[_0x528e('0x11')](0x1f4,_0x5224a5['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 29f7bb3..87b263c 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 _0x5b93=['index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x5b93,0x13b));var _0x35b9=function(_0x4fd82d,_0x4c28e0){_0x4fd82d=_0x4fd82d-0x0;var _0x4b45ea=_0x5b93[_0x4fd82d];return _0x4b45ea;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x35b9('0x0'));var timeout=require(_0x35b9('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x35b9('0x2'));var interaction=require(_0x35b9('0x3'));var config=require(_0x35b9('0x4'));var controller=require(_0x35b9('0x5'));router[_0x35b9('0x6')]('/',auth[_0x35b9('0x7')](),controller[_0x35b9('0x8')]);router['get'](_0x35b9('0x9'),auth[_0x35b9('0x7')](),controller[_0x35b9('0xa')]);router[_0x35b9('0x6')](_0x35b9('0xb'),auth[_0x35b9('0x7')](),controller[_0x35b9('0xc')]);router['post']('/',auth[_0x35b9('0x7')](),controller[_0x35b9('0xd')]);router[_0x35b9('0xe')]('/:id',auth[_0x35b9('0x7')](),controller[_0x35b9('0xf')]);router[_0x35b9('0x10')](_0x35b9('0xb'),auth[_0x35b9('0x7')](),controller[_0x35b9('0x11')]);module[_0x35b9('0x12')]=router; \ No newline at end of file +var _0x1735=['isAuthenticated','describe','/:id','show','post','create','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','index','/describe'];(function(_0x3107b0,_0x335118){var _0x11220d=function(_0x4a8958){while(--_0x4a8958){_0x3107b0['push'](_0x3107b0['shift']());}};_0x11220d(++_0x335118);}(_0x1735,0xb1));var _0x5173=function(_0x48591e,_0xbf1066){_0x48591e=_0x48591e-0x0;var _0x2c04ba=_0x1735[_0x48591e];return _0x2c04ba;};'use strict';var multer=require(_0x5173('0x0'));var util=require(_0x5173('0x1'));var path=require(_0x5173('0x2'));var timeout=require(_0x5173('0x3'));var express=require(_0x5173('0x4'));var router=express['Router']();var auth=require(_0x5173('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5173('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0x5173('0x7')]('/',auth['isAuthenticated'](),controller[_0x5173('0x8')]);router[_0x5173('0x7')](_0x5173('0x9'),auth[_0x5173('0xa')](),controller[_0x5173('0xb')]);router[_0x5173('0x7')](_0x5173('0xc'),auth[_0x5173('0xa')](),controller[_0x5173('0xd')]);router[_0x5173('0xe')]('/',auth[_0x5173('0xa')](),controller[_0x5173('0xf')]);router['put'](_0x5173('0xc'),auth[_0x5173('0xa')](),controller['update']);router[_0x5173('0x10')](_0x5173('0xc'),auth[_0x5173('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 7ffec0e..fbbccd5 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['queue','DATE','exports','ENUM','account','agent'];(function(_0x3be7ff,_0x12e714){var _0x186721=function(_0x2bc9e1){while(--_0x2bc9e1){_0x3be7ff['push'](_0x3be7ff['shift']());}};_0x186721(++_0x12e714);}(_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')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65f6('0x1')](_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65f6('0x5')]}}; \ No newline at end of file +var _0x5f66=['queue','DATE','exports','ENUM','account','agent'];(function(_0x2d9535,_0x4bc592){var _0xb4e710=function(_0x50b9a9){while(--_0x50b9a9){_0x2d9535['push'](_0x2d9535['shift']());}};_0xb4e710(++_0x4bc592);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65f6('0x1')](_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65f6('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index a0c13cb..96fdb84 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 _0xf2d9=['to-csv','ejs','lodash','squel','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','WhatsappTransferReport','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','filtears','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox'];(function(_0x5afad4,_0x19fff4){var _0x4958a8=function(_0x365dfb){while(--_0x365dfb){_0x5afad4['push'](_0x5afad4['shift']());}};_0x4958a8(++_0x19fff4);}(_0xf2d9,0xd9));var _0x9f2d=function(_0x4898a4,_0x56e377){_0x4898a4=_0x4898a4-0x0;var _0x3805b3=_0xf2d9[_0x4898a4];return _0x3805b3;};'use strict';var pdf=require(_0x9f2d('0x0'));var emlformat=require(_0x9f2d('0x1'));var rimraf=require(_0x9f2d('0x2'));var zipdir=require(_0x9f2d('0x3'));var jsonpatch=require(_0x9f2d('0x4'));var rp=require(_0x9f2d('0x5'));var moment=require(_0x9f2d('0x6'));var BPromise=require(_0x9f2d('0x7'));var Mustache=require('mustache');var util=require(_0x9f2d('0x8'));var path=require(_0x9f2d('0x9'));var sox=require(_0x9f2d('0xa'));var csv=require(_0x9f2d('0xb'));var ejs=require(_0x9f2d('0xc'));var fs=require('fs');var _=require(_0x9f2d('0xd'));var squel=require(_0x9f2d('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9f2d('0xb'));var querystring=require(_0x9f2d('0xf'));var Papa=require(_0x9f2d('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9f2d('0x11'));var as=require(_0x9f2d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f2d('0x13'))(_0x9f2d('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9f2d('0x15'));var db=require(_0x9f2d('0x16'))['db'];function respondWithStatusCode(_0x5d002e,_0xac21b0){_0xac21b0=_0xac21b0||0xcc;return function(_0x417599){if(_0x417599){return _0x5d002e[_0x9f2d('0x17')](_0xac21b0);}return _0x5d002e[_0x9f2d('0x18')](_0xac21b0)['end']();};}function respondWithResult(_0x4b8e27,_0x4adc2d){_0x4adc2d=_0x4adc2d||0xc8;return function(_0x13d4b2){if(_0x13d4b2){return _0x4b8e27[_0x9f2d('0x18')](_0x4adc2d)[_0x9f2d('0x19')](_0x13d4b2);}};}function respondWithFilteredResult(_0x44e63a,_0x31f726){return function(_0x3e40b1){if(_0x3e40b1){var _0x563edb=_0x3e40b1[_0x9f2d('0x1a')],_0xe97bd5=_0x31f726[_0x9f2d('0x1b')],_0x24089a=_0x31f726[_0x9f2d('0x1b')]+_0x31f726['limit'],_0x595765;if(_0x24089a>=_0x563edb){_0x24089a=_0x563edb;_0x595765=0xc8;}else{_0x595765=0xce;}_0x44e63a[_0x9f2d('0x18')](_0x595765);return _0x44e63a[_0x9f2d('0x1c')](_0x9f2d('0x1d'),_0xe97bd5+'-'+_0x24089a+'/'+_0x563edb)[_0x9f2d('0x19')](_0x3e40b1);}return null;};}function patchUpdates(_0x8ea52d){return function(_0x291983){try{jsonpatch[_0x9f2d('0x1e')](_0x291983,_0x8ea52d,!![]);}catch(_0x2b57ec){return BPromise[_0x9f2d('0x1f')](_0x2b57ec);}return _0x291983[_0x9f2d('0x20')]();};}function saveUpdates(_0x272829,_0x280813){return function(_0x2f1a9a){if(_0x2f1a9a){return _0x2f1a9a[_0x9f2d('0x21')](_0x272829)['then'](function(_0x419590){return _0x419590;});}return null;};}function removeEntity(_0x29525c,_0x92d322){return function(_0x5ac58b){if(_0x5ac58b){return _0x5ac58b[_0x9f2d('0x22')]()[_0x9f2d('0x23')](function(){_0x29525c[_0x9f2d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50ee2a,_0x2dcfda){return function(_0x4b588f){if(!_0x4b588f){_0x50ee2a[_0x9f2d('0x17')](0x194);}return _0x4b588f;};}function handleError(_0x7dccc3,_0x5dc859){_0x5dc859=_0x5dc859||0x1f4;return function(_0x5f6644){logger[_0x9f2d('0x24')](_0x5f6644[_0x9f2d('0x25')]);if(_0x5f6644['name']){delete _0x5f6644[_0x9f2d('0x26')];}_0x7dccc3[_0x9f2d('0x18')](_0x5dc859)[_0x9f2d('0x27')](_0x5f6644);};}exports[_0x9f2d('0x28')]=function(_0x4f6c9e,_0x48ec01){var _0x242c0c={},_0x4f28be={},_0x10aa1d={'count':0x0,'rows':[]};var _0x196a9a=_['map'](db[_0x9f2d('0x29')][_0x9f2d('0x2a')],function(_0x437c6c){return{'name':_0x437c6c['fieldName'],'type':_0x437c6c[_0x9f2d('0x2b')][_0x9f2d('0x2c')]};});_0x4f28be[_0x9f2d('0x2d')]=_[_0x9f2d('0x2e')](_0x196a9a,_0x9f2d('0x26'));_0x4f28be[_0x9f2d('0x2f')]=_[_0x9f2d('0x30')](_0x4f6c9e['query']);_0x4f28be['filters']=_['intersection'](_0x4f28be['model'],_0x4f28be['query']);_0x242c0c['attributes']=_[_0x9f2d('0x31')](_0x4f28be[_0x9f2d('0x2d')],qs[_0x9f2d('0x32')](_0x4f6c9e[_0x9f2d('0x2f')][_0x9f2d('0x32')]));_0x242c0c[_0x9f2d('0x33')]=_0x242c0c[_0x9f2d('0x33')][_0x9f2d('0x34')]?_0x242c0c['attributes']:_0x4f28be['model'];if(!_0x4f6c9e['query'][_0x9f2d('0x35')](_0x9f2d('0x36'))){_0x242c0c['limit']=qs[_0x9f2d('0x37')](_0x4f6c9e[_0x9f2d('0x2f')][_0x9f2d('0x37')]);_0x242c0c['offset']=qs[_0x9f2d('0x1b')](_0x4f6c9e[_0x9f2d('0x2f')]['offset']);}_0x242c0c[_0x9f2d('0x38')]=qs[_0x9f2d('0x39')](_0x4f6c9e[_0x9f2d('0x2f')]['sort']);_0x242c0c[_0x9f2d('0x3a')]=qs[_0x9f2d('0x3b')](_[_0x9f2d('0x3c')](_0x4f6c9e[_0x9f2d('0x2f')],_0x4f28be[_0x9f2d('0x3b')]),_0x196a9a);if(_0x4f6c9e[_0x9f2d('0x2f')]['filter']){_0x242c0c[_0x9f2d('0x3a')]=_['merge'](_0x242c0c['where'],{'$or':_[_0x9f2d('0x2e')](_0x196a9a,function(_0x2bd05d){if(_0x2bd05d[_0x9f2d('0x2b')]!==_0x9f2d('0x3d')){var _0xa96833={};_0xa96833[_0x2bd05d[_0x9f2d('0x26')]]={'$like':'%'+_0x4f6c9e[_0x9f2d('0x2f')][_0x9f2d('0x3e')]+'%'};return _0xa96833;}})});}_0x242c0c=_['merge']({},_0x242c0c,_0x4f6c9e[_0x9f2d('0x3f')]);var _0x7214ed={'where':_0x242c0c[_0x9f2d('0x3a')]};return db[_0x9f2d('0x29')][_0x9f2d('0x1a')](_0x7214ed)[_0x9f2d('0x23')](function(_0x3e8e13){_0x10aa1d[_0x9f2d('0x1a')]=_0x3e8e13;if(_0x4f6c9e[_0x9f2d('0x2f')][_0x9f2d('0x40')]){_0x242c0c[_0x9f2d('0x41')]=[{'all':!![]}];}return db[_0x9f2d('0x29')][_0x9f2d('0x42')](_0x242c0c);})['then'](function(_0x3133cb){_0x10aa1d[_0x9f2d('0x43')]=_0x3133cb;return _0x10aa1d;})[_0x9f2d('0x23')](respondWithFilteredResult(_0x48ec01,_0x242c0c))[_0x9f2d('0x44')](handleError(_0x48ec01,null));};exports[_0x9f2d('0x45')]=function(_0x16d71a,_0x534641){var _0x592581={'raw':!![],'where':{'id':_0x16d71a['params']['id']}},_0x392c49={};_0x392c49['model']=_[_0x9f2d('0x30')](db[_0x9f2d('0x29')]['rawAttributes']);_0x392c49[_0x9f2d('0x2f')]=_['keys'](_0x16d71a[_0x9f2d('0x2f')]);_0x392c49[_0x9f2d('0x46')]=_[_0x9f2d('0x31')](_0x392c49[_0x9f2d('0x2d')],_0x392c49[_0x9f2d('0x2f')]);_0x592581['attributes']=_[_0x9f2d('0x31')](_0x392c49['model'],qs['fields'](_0x16d71a[_0x9f2d('0x2f')]['fields']));_0x592581['attributes']=_0x592581[_0x9f2d('0x33')]['length']?_0x592581[_0x9f2d('0x33')]:_0x392c49['model'];if(_0x16d71a[_0x9f2d('0x2f')][_0x9f2d('0x40')]){_0x592581[_0x9f2d('0x41')]=[{'all':!![]}];}_0x592581=_['merge']({},_0x592581,_0x16d71a[_0x9f2d('0x3f')]);return db[_0x9f2d('0x29')][_0x9f2d('0x47')](_0x592581)[_0x9f2d('0x23')](handleEntityNotFound(_0x534641,null))[_0x9f2d('0x23')](respondWithResult(_0x534641,null))[_0x9f2d('0x44')](handleError(_0x534641,null));};exports['create']=function(_0x1089dc,_0xb61266){return db[_0x9f2d('0x29')][_0x9f2d('0x48')](_0x1089dc[_0x9f2d('0x49')],{})[_0x9f2d('0x23')](respondWithResult(_0xb61266,0xc9))[_0x9f2d('0x44')](handleError(_0xb61266,null));};exports['update']=function(_0x21d730,_0x1bb3f1){if(_0x21d730[_0x9f2d('0x49')]['id']){delete _0x21d730[_0x9f2d('0x49')]['id'];}return db[_0x9f2d('0x29')][_0x9f2d('0x47')]({'where':{'id':_0x21d730[_0x9f2d('0x4a')]['id']}})[_0x9f2d('0x23')](handleEntityNotFound(_0x1bb3f1,null))['then'](saveUpdates(_0x21d730[_0x9f2d('0x49')],null))[_0x9f2d('0x23')](respondWithResult(_0x1bb3f1,null))[_0x9f2d('0x44')](handleError(_0x1bb3f1,null));};exports['destroy']=function(_0x2e8605,_0x4cf546){return db[_0x9f2d('0x29')][_0x9f2d('0x47')]({'where':{'id':_0x2e8605[_0x9f2d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4cf546,null))[_0x9f2d('0x23')](removeEntity(_0x4cf546,null))[_0x9f2d('0x44')](handleError(_0x4cf546,null));};exports['describe']=function(_0x2dfbcc,_0x16e5fa){return db[_0x9f2d('0x29')][_0x9f2d('0x4b')]()[_0x9f2d('0x23')](respondWithResult(_0x16e5fa,null))[_0x9f2d('0x44')](handleError(_0x16e5fa,null));}; \ No newline at end of file +var _0x88e9=['count','then','includeAll','findAll','rows','catch','show','keys','length','include','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','reject','update','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','VIRTUAL','options','WhatsappTransferReport'];(function(_0x115c7c,_0x1bd054){var _0x494cbd=function(_0x22290d){while(--_0x22290d){_0x115c7c['push'](_0x115c7c['shift']());}};_0x494cbd(++_0x1bd054);}(_0x88e9,0xf2));var _0x988e=function(_0x3cacf1,_0x503b2d){_0x3cacf1=_0x3cacf1-0x0;var _0x96095b=_0x88e9[_0x3cacf1];return _0x96095b;};'use strict';var pdf=require(_0x988e('0x0'));var emlformat=require(_0x988e('0x1'));var rimraf=require(_0x988e('0x2'));var zipdir=require(_0x988e('0x3'));var jsonpatch=require(_0x988e('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x988e('0x5'));var Mustache=require(_0x988e('0x6'));var util=require(_0x988e('0x7'));var path=require(_0x988e('0x8'));var sox=require(_0x988e('0x9'));var csv=require(_0x988e('0xa'));var ejs=require(_0x988e('0xb'));var fs=require('fs');var _=require(_0x988e('0xc'));var squel=require('squel');var crypto=require(_0x988e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x988e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x988e('0xf'));var Papa=require(_0x988e('0x10'));var Redis=require(_0x988e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x988e('0x12'));var as=require(_0x988e('0x13'));var hardwareService=require(_0x988e('0x14'));var logger=require(_0x988e('0x15'))(_0x988e('0x16'));var utils=require(_0x988e('0x17'));var config=require(_0x988e('0x18'));var licenseUtil=require(_0x988e('0x19'));var db=require(_0x988e('0x1a'))['db'];function respondWithStatusCode(_0x3dffeb,_0x488988){_0x488988=_0x488988||0xcc;return function(_0x139186){if(_0x139186){return _0x3dffeb['sendStatus'](_0x488988);}return _0x3dffeb[_0x988e('0x1b')](_0x488988)[_0x988e('0x1c')]();};}function respondWithResult(_0x2e765c,_0x27b4d3){_0x27b4d3=_0x27b4d3||0xc8;return function(_0x1b8774){if(_0x1b8774){return _0x2e765c[_0x988e('0x1b')](_0x27b4d3)[_0x988e('0x1d')](_0x1b8774);}};}function respondWithFilteredResult(_0x9e28f7,_0x4e7912){return function(_0x3d8974){if(_0x3d8974){var _0x4b2276=_0x3d8974['count'],_0x598f65=_0x4e7912[_0x988e('0x1e')],_0x44d752=_0x4e7912[_0x988e('0x1e')]+_0x4e7912[_0x988e('0x1f')],_0x3d57bd;if(_0x44d752>=_0x4b2276){_0x44d752=_0x4b2276;_0x3d57bd=0xc8;}else{_0x3d57bd=0xce;}_0x9e28f7[_0x988e('0x1b')](_0x3d57bd);return _0x9e28f7[_0x988e('0x20')]('Content-Range',_0x598f65+'-'+_0x44d752+'/'+_0x4b2276)['json'](_0x3d8974);}return null;};}function patchUpdates(_0x369494){return function(_0x34eb15){try{jsonpatch['apply'](_0x34eb15,_0x369494,!![]);}catch(_0x134c50){return BPromise[_0x988e('0x21')](_0x134c50);}return _0x34eb15['save']();};}function saveUpdates(_0x3929be,_0x22222c){return function(_0x118f92){if(_0x118f92){return _0x118f92[_0x988e('0x22')](_0x3929be)['then'](function(_0x54d012){return _0x54d012;});}return null;};}function removeEntity(_0x32f05a,_0x439a42){return function(_0x39216a){if(_0x39216a){return _0x39216a[_0x988e('0x23')]()['then'](function(){_0x32f05a[_0x988e('0x1b')](0xcc)[_0x988e('0x1c')]();});}};}function handleEntityNotFound(_0x3540e0,_0x3b05a7){return function(_0x63e894){if(!_0x63e894){_0x3540e0[_0x988e('0x24')](0x194);}return _0x63e894;};}function handleError(_0x25c90b,_0x3237a8){_0x3237a8=_0x3237a8||0x1f4;return function(_0x337bbd){logger[_0x988e('0x25')](_0x337bbd[_0x988e('0x26')]);if(_0x337bbd['name']){delete _0x337bbd[_0x988e('0x27')];}_0x25c90b[_0x988e('0x1b')](_0x3237a8)[_0x988e('0x28')](_0x337bbd);};}exports[_0x988e('0x29')]=function(_0x27a770,_0x106f7b){var _0x1dbb8d={},_0x30b9be={},_0x26336c={'count':0x0,'rows':[]};var _0x529716=_['map'](db['WhatsappTransferReport'][_0x988e('0x2a')],function(_0x105883){return{'name':_0x105883[_0x988e('0x2b')],'type':_0x105883[_0x988e('0x2c')]['key']};});_0x30b9be['model']=_['map'](_0x529716,_0x988e('0x27'));_0x30b9be[_0x988e('0x2d')]=_['keys'](_0x27a770[_0x988e('0x2d')]);_0x30b9be['filters']=_[_0x988e('0x2e')](_0x30b9be[_0x988e('0x2f')],_0x30b9be[_0x988e('0x2d')]);_0x1dbb8d['attributes']=_[_0x988e('0x2e')](_0x30b9be[_0x988e('0x2f')],qs[_0x988e('0x30')](_0x27a770[_0x988e('0x2d')][_0x988e('0x30')]));_0x1dbb8d['attributes']=_0x1dbb8d[_0x988e('0x31')]['length']?_0x1dbb8d['attributes']:_0x30b9be[_0x988e('0x2f')];if(!_0x27a770[_0x988e('0x2d')][_0x988e('0x32')](_0x988e('0x33'))){_0x1dbb8d[_0x988e('0x1f')]=qs['limit'](_0x27a770[_0x988e('0x2d')]['limit']);_0x1dbb8d[_0x988e('0x1e')]=qs['offset'](_0x27a770['query']['offset']);}_0x1dbb8d[_0x988e('0x34')]=qs['sort'](_0x27a770['query'][_0x988e('0x35')]);_0x1dbb8d[_0x988e('0x36')]=qs['filters'](_['pick'](_0x27a770[_0x988e('0x2d')],_0x30b9be[_0x988e('0x37')]),_0x529716);if(_0x27a770['query'][_0x988e('0x38')]){_0x1dbb8d[_0x988e('0x36')]=_[_0x988e('0x39')](_0x1dbb8d[_0x988e('0x36')],{'$or':_[_0x988e('0x3a')](_0x529716,function(_0x41ec92){if(_0x41ec92['type']!==_0x988e('0x3b')){var _0x596732={};_0x596732[_0x41ec92[_0x988e('0x27')]]={'$like':'%'+_0x27a770[_0x988e('0x2d')][_0x988e('0x38')]+'%'};return _0x596732;}})});}_0x1dbb8d=_[_0x988e('0x39')]({},_0x1dbb8d,_0x27a770[_0x988e('0x3c')]);var _0x38f7f3={'where':_0x1dbb8d['where']};return db[_0x988e('0x3d')][_0x988e('0x3e')](_0x38f7f3)[_0x988e('0x3f')](function(_0x42cd){_0x26336c[_0x988e('0x3e')]=_0x42cd;if(_0x27a770['query'][_0x988e('0x40')]){_0x1dbb8d['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x988e('0x41')](_0x1dbb8d);})['then'](function(_0xd06b04){_0x26336c[_0x988e('0x42')]=_0xd06b04;return _0x26336c;})[_0x988e('0x3f')](respondWithFilteredResult(_0x106f7b,_0x1dbb8d))[_0x988e('0x43')](handleError(_0x106f7b,null));};exports[_0x988e('0x44')]=function(_0x4e81ae,_0x193af1){var _0x2abd25={'raw':!![],'where':{'id':_0x4e81ae['params']['id']}},_0x3761d8={};_0x3761d8[_0x988e('0x2f')]=_[_0x988e('0x45')](db['WhatsappTransferReport'][_0x988e('0x2a')]);_0x3761d8[_0x988e('0x2d')]=_[_0x988e('0x45')](_0x4e81ae['query']);_0x3761d8['filtears']=_[_0x988e('0x2e')](_0x3761d8[_0x988e('0x2f')],_0x3761d8['query']);_0x2abd25[_0x988e('0x31')]=_[_0x988e('0x2e')](_0x3761d8[_0x988e('0x2f')],qs[_0x988e('0x30')](_0x4e81ae['query'][_0x988e('0x30')]));_0x2abd25[_0x988e('0x31')]=_0x2abd25[_0x988e('0x31')][_0x988e('0x46')]?_0x2abd25['attributes']:_0x3761d8[_0x988e('0x2f')];if(_0x4e81ae[_0x988e('0x2d')][_0x988e('0x40')]){_0x2abd25[_0x988e('0x47')]=[{'all':!![]}];}_0x2abd25=_['merge']({},_0x2abd25,_0x4e81ae['options']);return db[_0x988e('0x3d')][_0x988e('0x48')](_0x2abd25)[_0x988e('0x3f')](handleEntityNotFound(_0x193af1,null))['then'](respondWithResult(_0x193af1,null))[_0x988e('0x43')](handleError(_0x193af1,null));};exports[_0x988e('0x49')]=function(_0x2c2d3a,_0x3ba7d1){return db[_0x988e('0x3d')][_0x988e('0x49')](_0x2c2d3a['body'],{})[_0x988e('0x3f')](respondWithResult(_0x3ba7d1,0xc9))[_0x988e('0x43')](handleError(_0x3ba7d1,null));};exports[_0x988e('0x22')]=function(_0x1813db,_0x5e23c4){if(_0x1813db['body']['id']){delete _0x1813db[_0x988e('0x4a')]['id'];}return db[_0x988e('0x3d')]['find']({'where':{'id':_0x1813db[_0x988e('0x4b')]['id']}})[_0x988e('0x3f')](handleEntityNotFound(_0x5e23c4,null))[_0x988e('0x3f')](saveUpdates(_0x1813db[_0x988e('0x4a')],null))[_0x988e('0x3f')](respondWithResult(_0x5e23c4,null))['catch'](handleError(_0x5e23c4,null));};exports[_0x988e('0x23')]=function(_0x421260,_0x5c1d3f){return db['WhatsappTransferReport'][_0x988e('0x48')]({'where':{'id':_0x421260[_0x988e('0x4b')]['id']}})[_0x988e('0x3f')](handleEntityNotFound(_0x5c1d3f,null))[_0x988e('0x3f')](removeEntity(_0x5c1d3f,null))[_0x988e('0x43')](handleError(_0x5c1d3f,null));};exports['describe']=function(_0x26e252,_0x2b5cfd){return db[_0x988e('0x3d')]['describe']()[_0x988e('0x3f')](respondWithResult(_0x2b5cfd,null))[_0x988e('0x43')](handleError(_0x2b5cfd,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index e5cf90c..498b0d1 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 _0xad28=['path','rimraf','exports','define','report_whatsapp_transfer','uniqueid','lodash','../../config/logger','moment','bluebird'];(function(_0x33e9b5,_0x36fbf1){var _0x3244c0=function(_0xeed14a){while(--_0xeed14a){_0x33e9b5['push'](_0x33e9b5['shift']());}};_0x3244c0(++_0x36fbf1);}(_0xad28,0x182));var _0x8ad2=function(_0x4fc80b,_0xfe1b3d){_0x4fc80b=_0x4fc80b-0x0;var _0x119dba=_0xad28[_0x4fc80b];return _0x119dba;};'use strict';var _=require(_0x8ad2('0x0'));var util=require('util');var logger=require(_0x8ad2('0x1'))('api');var moment=require(_0x8ad2('0x2'));var BPromise=require(_0x8ad2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ad2('0x4'));var rimraf=require(_0x8ad2('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0x8ad2('0x6')]=function(_0x156c4f,_0x4e31f1){return _0x156c4f[_0x8ad2('0x7')]('WhatsappTransferReport',attributes,{'tableName':_0x8ad2('0x8'),'paranoid':![],'indexes':[{'name':_0x8ad2('0x9'),'fields':[_0x8ad2('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xee06=['util','../../config/logger','bluebird','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0x3095e9,_0x3b52f5){var _0x56edfb=function(_0x523fd5){while(--_0x523fd5){_0x3095e9['push'](_0x3095e9['shift']());}};_0x56edfb(++_0x3b52f5);}(_0xee06,0x78));var _0x6ee0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee06[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x6ee0('0x0'));var logger=require(_0x6ee0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6ee0('0x2'));var rp=require(_0x6ee0('0x3'));var fs=require('fs');var path=require(_0x6ee0('0x4'));var rimraf=require('rimraf');var config=require(_0x6ee0('0x5'));var attributes=require(_0x6ee0('0x6'));module[_0x6ee0('0x7')]=function(_0x1a57d5,_0x55e7b6){return _0x1a57d5[_0x6ee0('0x8')](_0x6ee0('0x9'),attributes,{'tableName':_0x6ee0('0xa'),'paranoid':![],'indexes':[{'name':_0x6ee0('0xb'),'fields':[_0x6ee0('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 a42f31f..9d84275 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(_0x111301,_0x882260){var _0x50c4f1=function(_0x129e16){while(--_0x129e16){_0x111301['push'](_0x111301['shift']());}};_0x50c4f1(++_0x882260);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0x2505b8,_0x34e190){var _0x3fd3a7=function(_0xceba51){while(--_0xceba51){_0x2505b8['push'](_0x2505b8['shift']());}};_0x3fd3a7(++_0x34e190);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 77534af..4ec7417 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0802=['./config/schedule/transcribe','sequelize','then','listen','start','info','Online\x20apps:','map','filter','name','join','Offline\x20apps:','status','online','None','seedDB','./config/seedDB','default','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./config/environment','app','./config/pm2','./config/schedule'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0802,0x164));var _0x2080=function(_0x4b91b3,_0xb074bc){_0x4b91b3=_0x4b91b3-0x0;var _0x39d628=_0x0802[_0x4b91b3];return _0x39d628;};'use strict';var _=require('lodash');var mysqldb=require('./mysqldb');var rpc=require('./rpc');var config=require(_0x2080('0x0'));var logger=require('./config/logger')(_0x2080('0x1'));var pm2=require(_0x2080('0x2'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x2080('0x3'));var chat=require('./config/schedule/chat');var transcribe=require(_0x2080('0x4'));function main(){return mysqldb['db'][_0x2080('0x5')]['sync']()[_0x2080('0x6')](function(){return rpc[_0x2080('0x7')]();})[_0x2080('0x6')](function(_0x220522){logger['info'](_0x220522);return chat[_0x2080('0x8')]();})[_0x2080('0x6')](function(){return schedule['start']();})[_0x2080('0x6')](function(){return transcribe[_0x2080('0x8')]();})[_0x2080('0x6')](function(_0x39b1e3){logger[_0x2080('0x9')](_0x39b1e3);return pm2[_0x2080('0x8')](pm2Config);})[_0x2080('0x6')](function(_0x5359da){logger['info'](_0x2080('0xa'),_[_0x2080('0xb')](_[_0x2080('0xc')](_0x5359da,{'status':'online'}),_0x2080('0xd'))[_0x2080('0xe')]());logger[_0x2080('0x9')](_0x2080('0xf'),_[_0x2080('0xb')](_['filter'](_0x5359da,function(_0x21a027){return _0x21a027[_0x2080('0x10')]!==_0x2080('0x11');}),_0x2080('0xd'))['join']()||_0x2080('0x12'));config[_0x2080('0x13')]&&require(_0x2080('0x14'))[_0x2080('0x15')]();require('./config/license')[_0x2080('0x15')]();})['catch'](function(_0x2bdf42){logger[_0x2080('0x16')](_0x2080('0x17'),_0x2bdf42);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x90c0=['Online\x20apps:','map','online','name','join','Offline\x20apps:','filter','status','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/environment','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','listen','start','info'];(function(_0x1269c6,_0x1c8942){var _0x4868c7=function(_0x1661bc){while(--_0x1661bc){_0x1269c6['push'](_0x1269c6['shift']());}};_0x4868c7(++_0x1c8942);}(_0x90c0,0xf9));var _0x090c=function(_0x111311,_0x1e2f69){_0x111311=_0x111311-0x0;var _0x4cef39=_0x90c0[_0x111311];return _0x4cef39;};'use strict';var _=require('lodash');var mysqldb=require(_0x090c('0x0'));var rpc=require('./rpc');var config=require(_0x090c('0x1'));var logger=require('./config/logger')('app');var pm2=require('./config/pm2');var pm2Config=require(_0x090c('0x2'));var schedule=require(_0x090c('0x3'));var chat=require(_0x090c('0x4'));var transcribe=require(_0x090c('0x5'));function main(){return mysqldb['db'][_0x090c('0x6')][_0x090c('0x7')]()[_0x090c('0x8')](function(){return rpc[_0x090c('0x9')]();})['then'](function(_0x5f2d2b){logger['info'](_0x5f2d2b);return chat[_0x090c('0xa')]();})[_0x090c('0x8')](function(){return schedule[_0x090c('0xa')]();})['then'](function(){return transcribe[_0x090c('0xa')]();})[_0x090c('0x8')](function(_0x4e0834){logger['info'](_0x4e0834);return pm2[_0x090c('0xa')](pm2Config);})[_0x090c('0x8')](function(_0x42ac5c){logger[_0x090c('0xb')](_0x090c('0xc'),_[_0x090c('0xd')](_['filter'](_0x42ac5c,{'status':_0x090c('0xe')}),_0x090c('0xf'))[_0x090c('0x10')]());logger[_0x090c('0xb')](_0x090c('0x11'),_[_0x090c('0xd')](_[_0x090c('0x12')](_0x42ac5c,function(_0x549ae1){return _0x549ae1[_0x090c('0x13')]!==_0x090c('0xe');}),_0x090c('0xf'))['join']()||_0x090c('0x14'));config[_0x090c('0x15')]&&require(_0x090c('0x16'))[_0x090c('0x17')]();require(_0x090c('0x18'))[_0x090c('0x17')]();})[_0x090c('0x19')](function(_0x4b32a3){logger[_0x090c('0x1a')](_0x090c('0x1b'),_0x4b32a3);process[_0x090c('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 688c566..0c61a09 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 _0x5e46=['../encryptor','lodash','jsonwebtoken','express-jwt','crypto','bluebird','util','secrets','session','role','internal','email','userpic','voicePause','faxPause','smsPause','pauseType','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','ChatInteraction','params','closed','disposition','then','unmanaged','json','Unmanaged.','catch','use','startsWith','headers','authorization','Basic','User','name','pass','status','Wrong\x20credentials.','user','Bearer','apikey','getUuid','query','find','sub','isEqual','apiKeyNonce','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','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~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','decryptString','length','unshift','encryptString','join','promisify','secret','payload','options','randomBytes','floor','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util'];(function(_0x5b22e5,_0x50a727){var _0x50aa89=function(_0x391c4e){while(--_0x391c4e){_0x5b22e5['push'](_0x5b22e5['shift']());}};_0x50aa89(++_0x50a727);}(_0x5e46,0xda));var _0x65e4=function(_0x5ee745,_0xf78787){_0x5ee745=_0x5ee745-0x0;var _0x1710ef=_0x5e46[_0x5ee745];return _0x1710ef;};'use strict';var db=require(_0x65e4('0x0'))['db'];var config=require(_0x65e4('0x1'));var hardwareConf=require(_0x65e4('0x2'));var licenseUtil=require(_0x65e4('0x3'));var encryptor=require(_0x65e4('0x4'));var _=require(_0x65e4('0x5'));var jwt=require(_0x65e4('0x6'));var expressJwt=require(_0x65e4('0x7'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require(_0x65e4('0x8'));var BPromise=require(_0x65e4('0x9'));var util=require(_0x65e4('0xa'));var validateJwt=expressJwt({'secret':config[_0x65e4('0xb')][_0x65e4('0xc')]});var userAttributes=['id',_0x65e4('0xd'),'fullname','name',_0x65e4('0xe'),_0x65e4('0xf'),_0x65e4('0x10'),'permissions','md5secret',_0x65e4('0x11'),'chatPause','mailPause',_0x65e4('0x12'),_0x65e4('0x13'),'openchannelPause',_0x65e4('0x14'),'showWebBar',_0x65e4('0x15'),'lastPauseAt',_0x65e4('0x16'),_0x65e4('0x17'),_0x65e4('0x18'),_0x65e4('0x19'),_0x65e4('0x1a'),_0x65e4('0x1b'),_0x65e4('0x1c'),_0x65e4('0x1d'),_0x65e4('0x1e'),_0x65e4('0x1f'),'phoneBarExpires',_0x65e4('0x20'),_0x65e4('0x21'),_0x65e4('0x22'),'hotdesk',_0x65e4('0x23'),_0x65e4('0x24'),_0x65e4('0x25')];exports[_0x65e4('0x26')]=function(){return this[_0x65e4('0x27')](!![])['use'](function(_0x4639ff,_0x35e164,_0x3c4d1a){if(_0x4639ff['user']){_0x3c4d1a();}else{return db[_0x65e4('0x28')]['findOne']({'where':{'id':_0x4639ff[_0x65e4('0x29')]['id']},'attributes':['id',_0x65e4('0x2a'),_0x65e4('0x2b')],'raw':!![]})[_0x65e4('0x2c')](function(_0x1c4000){if(_0x1c4000&&_0x1c4000[_0x65e4('0x2a')]){return _0x35e164['status'](_0x1c4000[_0x65e4('0x2b')]===_0x65e4('0x2d')?0x195:0x193)[_0x65e4('0x2e')]({'message':_0x1c4000[_0x65e4('0x2b')]===_0x65e4('0x2d')?_0x65e4('0x2f'):'Forbidden.'});}else{_0x3c4d1a();}})[_0x65e4('0x30')](function(_0xe54ad7){_0x3c4d1a(_0xe54ad7);});}});};exports['isAuthenticated']=function isAuthenticated(_0x4564a6){return compose()[_0x65e4('0x31')](function(_0x5cd15f,_0x596893,_0x598571){if(_0x5cd15f['headers']['authorization']){if(_[_0x65e4('0x32')](_0x5cd15f[_0x65e4('0x33')][_0x65e4('0x34')],_0x65e4('0x35'))){var _0x312949=basicAuth(_0x5cd15f);db[_0x65e4('0x36')]['find']({'where':{'name':_0x312949[_0x65e4('0x37')]}})[_0x65e4('0x2c')](function(_0xf58dae){if(!_0xf58dae||!_0xf58dae['authenticate'](_0x312949[_0x65e4('0x38')])){return _0x596893[_0x65e4('0x39')](0x191)[_0x65e4('0x2e')]({'message':_0x65e4('0x3a')});}_0x5cd15f[_0x65e4('0x3b')]={'id':_0xf58dae['id']};_0x598571();})[_0x65e4('0x30')](function(_0x5039d2){_0x598571(_0x5039d2);});}else if(_[_0x65e4('0x32')](_0x5cd15f[_0x65e4('0x33')][_0x65e4('0x34')],_0x65e4('0x3c'))){validateJwt(_0x5cd15f,_0x596893,_0x598571);}else{if(_0x4564a6){_0x598571();}else{return _0x596893['status'](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x5cd15f['query'][_0x65e4('0x3d')]){try{var _0x542e95={'audience':hardwareConf[_0x65e4('0x3e')](),'issuer':hardwareConf[_0x65e4('0x3e')]()};verifyJwt(_0x5cd15f[_0x65e4('0x3f')][_0x65e4('0x3d')],_0x542e95)['then'](function(_0x167815){return db['User'][_0x65e4('0x40')]({'where':{'id':_0x167815[_0x65e4('0x41')]}})[_0x65e4('0x2c')](function(_0x387b5c){if(!_0x387b5c||!_[_0x65e4('0x42')](_0x387b5c[_0x65e4('0x43')],_0x167815['nonce'])){return _0x596893[_0x65e4('0x39')](0x191)[_0x65e4('0x2e')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x5cd15f[_0x65e4('0x3b')]={'id':_0x387b5c['id']};_0x598571();});})[_0x65e4('0x30')](function(){return _0x596893['status'](0x191)['json']({'message':_0x65e4('0x44')});});}catch(_0x577d47){_0x598571(_0x577d47);}}else if(_0x4564a6){_0x598571();}else{return _0x596893[_0x65e4('0x39')](0x193)[_0x65e4('0x2e')]({'message':_0x65e4('0x45')});}})[_0x65e4('0x31')](function(_0x3a8037,_0x5c5be7,_0x51d8ee){if(_0x3a8037[_0x65e4('0x3b')]){db[_0x65e4('0x36')][_0x65e4('0x40')]({'where':{'id':_0x3a8037[_0x65e4('0x3b')]['id']},'attributes':userAttributes})[_0x65e4('0x2c')](function(_0x47dbff){if(!_0x47dbff){return _0x5c5be7[_0x65e4('0x39')](0x194)[_0x65e4('0x2e')]({'message':_0x65e4('0x46')});}_0x3a8037['user']=_0x47dbff;_0x51d8ee();})[_0x65e4('0x30')](function(_0x5e5197){_0x51d8ee(_0x5e5197);});}else if(_0x4564a6){_0x51d8ee();}else{return _0x5c5be7[_0x65e4('0x39')](0x194)[_0x65e4('0x2e')]({'message':_0x65e4('0x47')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x65e4('0x31')](function(_0x166101,_0x37f6aa,_0x22382b){return licenseUtil[_0x65e4('0x48')]()[_0x65e4('0x2c')](function(_0x277b75){if(_0x277b75[_0x65e4('0x49')]){_0x22382b();}else{return _0x37f6aa[_0x65e4('0x39')](0x193)[_0x65e4('0x2e')]({'message':_0x65e4('0x4a')});}})[_0x65e4('0x30')](function(_0x278d15){_0x22382b(_0x278d15);});});};exports[_0x65e4('0x4b')]=function(_0x3fb4a0,_0x55dbca,_0x2c88aa){_0x3fb4a0[_0x65e4('0x4b')]=!![];return _0x2c88aa();};exports['signToken']=function signToken(_0x4643b5){return signJwt(_0x4643b5);};exports[_0x65e4('0x4c')]=function(_0x298c87,_0xf200f0){if(!_0x298c87[_0x65e4('0x3b')]){return _0xf200f0[_0x65e4('0x39')](0x194)[_0x65e4('0x2e')]({'message':_0x65e4('0x4d')});}var _0x2a7883={'payload':{'id':_0x298c87[_0x65e4('0x3b')]['id'],'role':_0x298c87['user'][_0x65e4('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x2a7883)[_0x65e4('0x2c')](function(_0x47a655){_0xf200f0[_0x65e4('0x4e')](_0x65e4('0x4f'),_0x47a655);_0xf200f0[_0x65e4('0x50')]('/dashboards/general');})[_0x65e4('0x30')](function(_0x3dc587){return _0xf200f0[_0x65e4('0x39')](0x1f4)[_0x65e4('0x51')](_0x3dc587);});};exports[_0x65e4('0x52')]=function(_0x8af8de){if(_[_0x65e4('0x53')](_0x8af8de['apiKeyNonce'])||_[_0x65e4('0x53')](_0x8af8de[_0x65e4('0x54')])){return null;}else{return createJwt(_0x8af8de);}};exports[_0x65e4('0x55')]=function(_0x472467){_0x472467[_0x65e4('0x43')]=generateNonce();_0x472467[_0x65e4('0x54')]=generateIssuedAt();return createJwt(_0x472467);};exports[_0x65e4('0x56')]=function(_0x3ae59d,_0x292233){var _0x780be7=_0x3ae59d[_0x65e4('0x3f')][_0x65e4('0x3d')];if(_0x780be7){var _0x273e64={'nonce':_0x292233[_0x65e4('0x43')],'iat':_0x292233[_0x65e4('0x54')],'audience':hardwareConf[_0x65e4('0x3e')](),'issuer':hardwareConf[_0x65e4('0x3e')]()};return verifyJwt(_0x780be7,_0x273e64)['then'](function(){return generateApiKey(_0x292233);});}else{throw{'message':_0x65e4('0x57')};}};exports[_0x65e4('0x58')]=function(_0xb72fa6){var _0x4c478c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4c478c[_0x65e4('0x59')](_0xb72fa6))throw new db['Sequelize'][(_0x65e4('0x5a'))](_0x65e4('0x5b'));return;};exports[_0x65e4('0x5c')]=function(_0x3bcf39,_0x274e6a,_0x3e0922){var _0x535295=encryptor['decryptString'](_0x274e6a)[_0x65e4('0x5d')](',');for(var _0x3b37f2=0x0;_0x3b37f2<_0x3e0922;_0x3b37f2++){if(!_0x535295[_0x3b37f2])break;if(_0x3bcf39[_0x65e4('0x5e')]()===_0x535295[_0x3b37f2][_0x65e4('0x5e')]()){var _0x561fde=util[_0x65e4('0x5f')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x3e0922);if(_0x3e0922===0x1){_0x561fde=_0x65e4('0x60');}throw new db[(_0x65e4('0x61'))][(_0x65e4('0x5a'))](_0x561fde);}}return;};exports['updatePasswordsHistory']=function(_0xbeeb57,_0x36ca4d){var _0x1ac33b=_0x36ca4d?encryptor[_0x65e4('0x62')](_0x36ca4d)[_0x65e4('0x5d')](','):[];if(_0x1ac33b[_0x65e4('0x63')]===0x5){_0x1ac33b['splice'](-0x1,0x1);}_0x1ac33b[_0x65e4('0x64')](_0xbeeb57);return encryptor[_0x65e4('0x65')](_0x1ac33b[_0x65e4('0x66')](','));};function signJwt(_0x3cd632){var _0x1ce6ec=BPromise[_0x65e4('0x67')](jwt['sign'],{'context':jwt});var _0x104c33=_0x3cd632[_0x65e4('0x68')]||config[_0x65e4('0xb')][_0x65e4('0xc')];return new BPromise(function(_0x465e51,_0x58554e){_0x1ce6ec(_0x3cd632[_0x65e4('0x69')],_0x104c33,_0x3cd632[_0x65e4('0x6a')])['then'](function(_0x52f8c4){_0x465e51(_0x52f8c4);})[_0x65e4('0x30')](function(_0x5b6755){_0x58554e(_0x5b6755);});});}function verifyJwt(_0xe12c39,_0x185c1d,_0x244adf){var _0x44fac1=BPromise['promisify'](jwt['verify'],{'context':jwt});var _0x5d6a70=_0x244adf||config[_0x65e4('0xb')][_0x65e4('0xc')];return new BPromise(function(_0x3bd0bc,_0x287d35){_0x44fac1(_0xe12c39,_0x5d6a70,_0x185c1d)[_0x65e4('0x2c')](function(_0x48f781){_0x3bd0bc(_0x48f781);})[_0x65e4('0x30')](function(_0x387532){_0x287d35(_0x387532);});});}function generateNonce(){return crypto[_0x65e4('0x6b')](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0x65e4('0x6c')](Date['now']()/0x3e8)[_0x65e4('0x6d')]();}function createJwt(_0x127b7f){var _0x61d6ec={'payload':{'iat':_0x127b7f[_0x65e4('0x54')],'nonce':_0x127b7f[_0x65e4('0x43')]},'options':{'algorithm':_0x65e4('0x6e'),'subject':_0x127b7f['id'][_0x65e4('0x6d')](),'issuer':hardwareConf[_0x65e4('0x3e')](),'audience':hardwareConf[_0x65e4('0x3e')]()}};return signJwt(_0x61d6ec)[_0x65e4('0x2c')](function(_0x8164cf){return{'iat':_0x127b7f[_0x65e4('0x54')],'nonce':_0x127b7f[_0x65e4('0x43')],'token':_0x8164cf};});} \ No newline at end of file +var _0x4981=['phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','startsWith','authorization','User','find','authenticate','headers','status','Unknown\x20authorization\x20format','query','apikey','getUuid','then','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','role','motion.token','retrieveApiKey','isNil','apiKeyIat','generateApiKey','apiKeyNonce','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','splice','unshift','encryptString','join','promisify','sign','secret','options','verify','session','toString','hex','floor','HS512','../../mysqldb','../../config/environment','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','util','secrets','fullname','internal','email','userpic','permissions','md5secret','voicePause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4981,0x139));var _0x1498=function(_0x143b14,_0x374bd0){_0x143b14=_0x143b14-0x0;var _0x10bc6d=_0x4981[_0x143b14];return _0x10bc6d;};'use strict';var db=require(_0x1498('0x0'))['db'];var config=require(_0x1498('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0x1498('0x2'));var jwt=require(_0x1498('0x3'));var expressJwt=require(_0x1498('0x4'));var compose=require('composable-middleware');var basicAuth=require(_0x1498('0x5'));var crypto=require(_0x1498('0x6'));var BPromise=require(_0x1498('0x7'));var util=require(_0x1498('0x8'));var validateJwt=expressJwt({'secret':config[_0x1498('0x9')]['session']});var userAttributes=['id','role',_0x1498('0xa'),'name',_0x1498('0xb'),_0x1498('0xc'),_0x1498('0xd'),_0x1498('0xe'),_0x1498('0xf'),_0x1498('0x10'),'chatPause',_0x1498('0x11'),_0x1498('0x12'),_0x1498('0x13'),_0x1498('0x14'),_0x1498('0x15'),_0x1498('0x16'),_0x1498('0x17'),_0x1498('0x18'),'crudPermissions',_0x1498('0x19'),_0x1498('0x1a'),_0x1498('0x1b'),_0x1498('0x1c'),'phoneBarAutoAnswerDelay',_0x1498('0x1d'),_0x1498('0x1e'),_0x1498('0x1f'),'phoneBarEnableSettings',_0x1498('0x20'),_0x1498('0x21'),_0x1498('0x22'),_0x1498('0x23'),_0x1498('0x24'),_0x1498('0x25'),_0x1498('0x26'),_0x1498('0x27')];exports[_0x1498('0x28')]=function(){return this[_0x1498('0x29')](!![])[_0x1498('0x2a')](function(_0x3f3d4e,_0x5d094b,_0x5e6f66){if(_0x3f3d4e[_0x1498('0x2b')]){_0x5e6f66();}else{return db[_0x1498('0x2c')][_0x1498('0x2d')]({'where':{'id':_0x3f3d4e[_0x1498('0x2e')]['id']},'attributes':['id',_0x1498('0x2f'),_0x1498('0x30')],'raw':!![]})['then'](function(_0x5f0788){if(_0x5f0788&&_0x5f0788['closed']){return _0x5d094b['status'](_0x5f0788[_0x1498('0x30')]===_0x1498('0x31')?0x195:0x193)[_0x1498('0x32')]({'message':_0x5f0788['disposition']===_0x1498('0x31')?_0x1498('0x33'):_0x1498('0x34')});}else{_0x5e6f66();}})[_0x1498('0x35')](function(_0x586f3f){_0x5e6f66(_0x586f3f);});}});};exports[_0x1498('0x29')]=function isAuthenticated(_0x2cf26f){return compose()[_0x1498('0x2a')](function(_0x224287,_0x23fe88,_0x55df4e){if(_0x224287['headers']['authorization']){if(_[_0x1498('0x36')](_0x224287['headers'][_0x1498('0x37')],'Basic')){var _0xfae5fd=basicAuth(_0x224287);db[_0x1498('0x38')][_0x1498('0x39')]({'where':{'name':_0xfae5fd['name']}})['then'](function(_0x50f46a){if(!_0x50f46a||!_0x50f46a[_0x1498('0x3a')](_0xfae5fd['pass'])){return _0x23fe88['status'](0x191)[_0x1498('0x32')]({'message':'Wrong\x20credentials.'});}_0x224287[_0x1498('0x2b')]={'id':_0x50f46a['id']};_0x55df4e();})[_0x1498('0x35')](function(_0x2a316f){_0x55df4e(_0x2a316f);});}else if(_[_0x1498('0x36')](_0x224287[_0x1498('0x3b')][_0x1498('0x37')],'Bearer')){validateJwt(_0x224287,_0x23fe88,_0x55df4e);}else{if(_0x2cf26f){_0x55df4e();}else{return _0x23fe88[_0x1498('0x3c')](0x193)[_0x1498('0x32')]({'message':_0x1498('0x3d')});}}}else if(_0x224287[_0x1498('0x3e')][_0x1498('0x3f')]){try{var _0x373f60={'audience':hardwareConf[_0x1498('0x40')](),'issuer':hardwareConf[_0x1498('0x40')]()};verifyJwt(_0x224287[_0x1498('0x3e')][_0x1498('0x3f')],_0x373f60)[_0x1498('0x41')](function(_0x3c84e4){return db[_0x1498('0x38')]['find']({'where':{'id':_0x3c84e4['sub']}})[_0x1498('0x41')](function(_0x59f1c9){if(!_0x59f1c9||!_[_0x1498('0x42')](_0x59f1c9['apiKeyNonce'],_0x3c84e4[_0x1498('0x43')])){return _0x23fe88[_0x1498('0x3c')](0x191)['json']({'message':_0x1498('0x44')});}_0x224287[_0x1498('0x2b')]={'id':_0x59f1c9['id']};_0x55df4e();});})[_0x1498('0x35')](function(){return _0x23fe88['status'](0x191)[_0x1498('0x32')]({'message':_0x1498('0x45')});});}catch(_0x4deae3){_0x55df4e(_0x4deae3);}}else if(_0x2cf26f){_0x55df4e();}else{return _0x23fe88[_0x1498('0x3c')](0x193)['json']({'message':_0x1498('0x3d')});}})[_0x1498('0x2a')](function(_0x4c140a,_0x2c3e97,_0x24813f){if(_0x4c140a[_0x1498('0x2b')]){db[_0x1498('0x38')]['find']({'where':{'id':_0x4c140a[_0x1498('0x2b')]['id']},'attributes':userAttributes})['then'](function(_0x366464){if(!_0x366464){return _0x2c3e97[_0x1498('0x3c')](0x194)['json']({'message':_0x1498('0x46')});}_0x4c140a[_0x1498('0x2b')]=_0x366464;_0x24813f();})[_0x1498('0x35')](function(_0x3380e3){_0x24813f(_0x3380e3);});}else if(_0x2cf26f){_0x24813f();}else{return _0x2c3e97['status'](0x194)[_0x1498('0x32')]({'message':_0x1498('0x47')});}});};exports[_0x1498('0x48')]=function canUpdate(){return compose()[_0x1498('0x2a')](function(_0x560670,_0x572b97,_0xe53fc1){return licenseUtil[_0x1498('0x49')]()['then'](function(_0x36a986){if(_0x36a986[_0x1498('0x4a')]){_0xe53fc1();}else{return _0x572b97[_0x1498('0x3c')](0x193)['json']({'message':_0x1498('0x4b')});}})['catch'](function(_0x5d5da5){_0xe53fc1(_0x5d5da5);});});};exports[_0x1498('0x4c')]=function(_0x281b00,_0x547de8,_0x5c8ca7){_0x281b00[_0x1498('0x4c')]=!![];return _0x5c8ca7();};exports[_0x1498('0x4d')]=function signToken(_0x171a2d){return signJwt(_0x171a2d);};exports['setTokenCookie']=function(_0xd7006b,_0x1bb75b){if(!_0xd7006b[_0x1498('0x2b')]){return _0x1bb75b[_0x1498('0x3c')](0x194)[_0x1498('0x32')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x5a5138={'payload':{'id':_0xd7006b[_0x1498('0x2b')]['id'],'role':_0xd7006b[_0x1498('0x2b')][_0x1498('0x4e')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5a5138)[_0x1498('0x41')](function(_0x280299){_0x1bb75b['cookie'](_0x1498('0x4f'),_0x280299);_0x1bb75b['redirect']('/dashboards/general');})[_0x1498('0x35')](function(_0x40dd3b){return _0x1bb75b['status'](0x1f4)['send'](_0x40dd3b);});};exports[_0x1498('0x50')]=function(_0x4d66bc){if(_[_0x1498('0x51')](_0x4d66bc['apiKeyNonce'])||_[_0x1498('0x51')](_0x4d66bc[_0x1498('0x52')])){return null;}else{return createJwt(_0x4d66bc);}};exports[_0x1498('0x53')]=function(_0x4f2be9){_0x4f2be9[_0x1498('0x54')]=generateNonce();_0x4f2be9[_0x1498('0x52')]=generateIssuedAt();return createJwt(_0x4f2be9);};exports[_0x1498('0x55')]=function(_0x17afba,_0x3602c0){var _0x1afc7c=_0x17afba[_0x1498('0x3e')]['apikey'];if(_0x1afc7c){var _0x52ff3a={'nonce':_0x3602c0[_0x1498('0x54')],'iat':_0x3602c0[_0x1498('0x52')],'audience':hardwareConf[_0x1498('0x40')](),'issuer':hardwareConf[_0x1498('0x40')]()};return verifyJwt(_0x1afc7c,_0x52ff3a)['then'](function(){return generateApiKey(_0x3602c0);});}else{throw{'message':_0x1498('0x56')};}};exports[_0x1498('0x57')]=function(_0x3ef116){var _0x189044=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x189044[_0x1498('0x58')](_0x3ef116))throw new db[(_0x1498('0x59'))][(_0x1498('0x5a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x1498('0x5b')]=function(_0x3c0bbd,_0x11686c,_0x2498b7){var _0x2130e8=encryptor['decryptString'](_0x11686c)[_0x1498('0x5c')](',');for(var _0x51cd7d=0x0;_0x51cd7d<_0x2498b7;_0x51cd7d++){if(!_0x2130e8[_0x51cd7d])break;if(_0x3c0bbd[_0x1498('0x5d')]()===_0x2130e8[_0x51cd7d]['toLowerCase']()){var _0x18bb3c=util[_0x1498('0x5e')](_0x1498('0x5f'),_0x2498b7);if(_0x2498b7===0x1){_0x18bb3c=_0x1498('0x60');}throw new db['Sequelize'][(_0x1498('0x5a'))](_0x18bb3c);}}return;};exports[_0x1498('0x61')]=function(_0xadb1d2,_0x5ba32a){var _0x1a9e7d=_0x5ba32a?encryptor[_0x1498('0x62')](_0x5ba32a)[_0x1498('0x5c')](','):[];if(_0x1a9e7d[_0x1498('0x63')]===0x5){_0x1a9e7d[_0x1498('0x64')](-0x1,0x1);}_0x1a9e7d[_0x1498('0x65')](_0xadb1d2);return encryptor[_0x1498('0x66')](_0x1a9e7d[_0x1498('0x67')](','));};function signJwt(_0x1b1e6b){var _0x42471a=BPromise[_0x1498('0x68')](jwt[_0x1498('0x69')],{'context':jwt});var _0x27eb26=_0x1b1e6b[_0x1498('0x6a')]||config['secrets']['session'];return new BPromise(function(_0x486751,_0x59280e){_0x42471a(_0x1b1e6b['payload'],_0x27eb26,_0x1b1e6b[_0x1498('0x6b')])[_0x1498('0x41')](function(_0x1d385e){_0x486751(_0x1d385e);})['catch'](function(_0x57cf86){_0x59280e(_0x57cf86);});});}function verifyJwt(_0x7d8fc4,_0x31f972,_0x5b7997){var _0x793925=BPromise['promisify'](jwt[_0x1498('0x6c')],{'context':jwt});var _0x20cf90=_0x5b7997||config[_0x1498('0x9')][_0x1498('0x6d')];return new BPromise(function(_0x46a4e1,_0x5246bb){_0x793925(_0x7d8fc4,_0x20cf90,_0x31f972)[_0x1498('0x41')](function(_0x1b74c0){_0x46a4e1(_0x1b74c0);})[_0x1498('0x35')](function(_0x38ab25){_0x5246bb(_0x38ab25);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x1498('0x6e')](_0x1498('0x6f'));}function generateIssuedAt(){return Math[_0x1498('0x70')](Date['now']()/0x3e8)[_0x1498('0x6e')]();}function createJwt(_0x2404c0){var _0x475092={'payload':{'iat':_0x2404c0['apiKeyIat'],'nonce':_0x2404c0[_0x1498('0x54')]},'options':{'algorithm':_0x1498('0x71'),'subject':_0x2404c0['id'][_0x1498('0x6e')](),'issuer':hardwareConf[_0x1498('0x40')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x475092)['then'](function(_0x54794c){return{'iat':_0x2404c0[_0x1498('0x52')],'nonce':_0x2404c0[_0x1498('0x54')],'token':_0x54794c};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 2fd2e4d..cbe7a79 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 _0x1623=['aes192','hasOwnProperty','encryptFile','createReadStream','createCipher','algorithm','data','update','binary','write','close','unlink','createWriteStream','createDecipher','end','final','encryptString','secret','utf8','base64','decryptString','crypto','secrets','session','aes-256-ctr'];(function(_0x381379,_0x3f3b86){var _0x3e1063=function(_0x4c282d){while(--_0x4c282d){_0x381379['push'](_0x381379['shift']());}};_0x3e1063(++_0x3f3b86);}(_0x1623,0xab));var _0x3162=function(_0x1e16ed,_0x24fac8){_0x1e16ed=_0x1e16ed-0x0;var _0x396286=_0x1623[_0x1e16ed];return _0x396286;};'use strict';var crypto=require(_0x3162('0x0'));var fs=require('fs');var BPromise=require('bluebird');var config=require('../../config/environment');const stringOptions={'secret':config[_0x3162('0x1')][_0x3162('0x2')],'algorithm':_0x3162('0x3')};const fileOptions={'algorithm':_0x3162('0x4')};function combineOptions(_0x428dd7){var _0x4ce2bd={};for(var _0x5d49d0 in fileOptions){if(fileOptions[_0x3162('0x5')](_0x5d49d0)){_0x4ce2bd[_0x5d49d0]=fileOptions[_0x5d49d0];}}if(_0x428dd7){for(var _0x4b77c4 in _0x428dd7){if(_0x428dd7[_0x3162('0x5')](_0x4b77c4)){_0x4ce2bd[_0x4b77c4]=_0x428dd7[_0x4b77c4];}}}return _0x4ce2bd;}exports[_0x3162('0x6')]=function(_0x53260d,_0xffe9b6,_0x2dc07e,_0x26ee32){return new BPromise(function(_0x36609e,_0x10d684){_0x26ee32=combineOptions(_0x26ee32);var _0x382676=new Buffer(_0x2dc07e);var _0xe43099=fs[_0x3162('0x7')](_0x53260d);var _0x4bde10=fs['createWriteStream'](_0xffe9b6);var _0x270de3=crypto[_0x3162('0x8')](_0x26ee32[_0x3162('0x9')],_0x382676);_0xe43099['on'](_0x3162('0xa'),function(_0x813d62){var _0x208f4e=new Buffer(_0x270de3[_0x3162('0xb')](_0x813d62),_0x3162('0xc'));_0x4bde10[_0x3162('0xd')](_0x208f4e);});_0xe43099['on']('end',function(){try{var _0x2d11c5=new Buffer(_0x270de3['final'](_0x3162('0xc')),_0x3162('0xc'));_0x4bde10['write'](_0x2d11c5);_0x4bde10['end']();_0x4bde10['on'](_0x3162('0xe'),function(){return _0x36609e(_0xffe9b6);});}catch(_0x2bb738){fs[_0x3162('0xf')](_0xffe9b6);return _0x10d684(_0x2bb738);}});});};exports['decryptFile']=function(_0x15e348,_0x3d0bea,_0x2705d1,_0x490371){return new BPromise(function(_0x78a56c,_0x42cf7d){_0x490371=combineOptions(_0x490371);var _0x46864e=new Buffer(_0x2705d1);var _0xc3ee06=fs[_0x3162('0x7')](_0x15e348);var _0x1eed46=fs[_0x3162('0x10')](_0x3d0bea);var _0x4b2bf3=crypto[_0x3162('0x11')](_0x490371[_0x3162('0x9')],_0x46864e);_0xc3ee06['on'](_0x3162('0xa'),function(_0x36ca97){var _0x491144=new Buffer(_0x4b2bf3[_0x3162('0xb')](_0x36ca97),'binary');_0x1eed46['write'](_0x491144);});_0xc3ee06['on'](_0x3162('0x12'),function(){try{var _0x3e4d23=new Buffer(_0x4b2bf3[_0x3162('0x13')]('binary'),'binary');_0x1eed46[_0x3162('0xd')](_0x3e4d23);_0x1eed46[_0x3162('0x12')]();_0x1eed46['on'](_0x3162('0xe'),function(){return _0x78a56c(_0x3d0bea);});}catch(_0x26c90d){fs[_0x3162('0xf')](_0x3d0bea);return _0x42cf7d(_0x26c90d);}});});};exports[_0x3162('0x14')]=function(_0x52ae25,_0x1b2713,_0x5a4994){var _0xd283d6=_0x5a4994||stringOptions[_0x3162('0x9')];var _0x3919e7=_0x1b2713||stringOptions[_0x3162('0x15')];var _0x1c9992=crypto[_0x3162('0x8')](_0xd283d6,_0x3919e7);var _0x30552f=_0x1c9992[_0x3162('0xb')](_0x52ae25,_0x3162('0x16'),_0x3162('0x17'));_0x30552f+=_0x1c9992[_0x3162('0x13')](_0x3162('0x17'));return _0x30552f;};exports[_0x3162('0x18')]=function(_0x48de45,_0x4025c3,_0x552469){var _0x37acdd=_0x552469||stringOptions[_0x3162('0x9')];var _0x10c90b=_0x4025c3||stringOptions['secret'];var _0x4903e7=crypto[_0x3162('0x11')](_0x37acdd,_0x10c90b);var _0xaa1f35=_0x4903e7[_0x3162('0xb')](_0x48de45,_0x3162('0x17'),_0x3162('0x16'));_0xaa1f35+=_0x4903e7['final'](_0x3162('0x16'));return _0xaa1f35;}; \ No newline at end of file +var _0xd101=['secret','utf8','base64','decryptString','crypto','../../config/environment','secrets','session','aes-256-ctr','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','update','binary','write','final','end','unlink','decryptFile','createDecipher','data','close','encryptString'];(function(_0x2bb38c,_0xa429b3){var _0x573d77=function(_0x308ea2){while(--_0x308ea2){_0x2bb38c['push'](_0x2bb38c['shift']());}};_0x573d77(++_0xa429b3);}(_0xd101,0xc1));var _0x1d10=function(_0x1254e5,_0x37e243){_0x1254e5=_0x1254e5-0x0;var _0x3812de=_0xd101[_0x1254e5];return _0x3812de;};'use strict';var crypto=require(_0x1d10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var config=require(_0x1d10('0x1'));const stringOptions={'secret':config[_0x1d10('0x2')][_0x1d10('0x3')],'algorithm':_0x1d10('0x4')};const fileOptions={'algorithm':_0x1d10('0x5')};function combineOptions(_0x25b425){var _0x12c320={};for(var _0x1e83e0 in fileOptions){if(fileOptions['hasOwnProperty'](_0x1e83e0)){_0x12c320[_0x1e83e0]=fileOptions[_0x1e83e0];}}if(_0x25b425){for(var _0x42b6d2 in _0x25b425){if(_0x25b425[_0x1d10('0x6')](_0x42b6d2)){_0x12c320[_0x42b6d2]=_0x25b425[_0x42b6d2];}}}return _0x12c320;}exports[_0x1d10('0x7')]=function(_0x27d569,_0xb9e08,_0x36335e,_0x6d6def){return new BPromise(function(_0x43df2c,_0x3a15c8){_0x6d6def=combineOptions(_0x6d6def);var _0x182c87=new Buffer(_0x36335e);var _0xf7926b=fs[_0x1d10('0x8')](_0x27d569);var _0x1610b4=fs[_0x1d10('0x9')](_0xb9e08);var _0x42efad=crypto[_0x1d10('0xa')](_0x6d6def[_0x1d10('0xb')],_0x182c87);_0xf7926b['on']('data',function(_0x3a2050){var _0x93cb59=new Buffer(_0x42efad[_0x1d10('0xc')](_0x3a2050),_0x1d10('0xd'));_0x1610b4[_0x1d10('0xe')](_0x93cb59);});_0xf7926b['on']('end',function(){try{var _0x3f6bd8=new Buffer(_0x42efad[_0x1d10('0xf')](_0x1d10('0xd')),_0x1d10('0xd'));_0x1610b4[_0x1d10('0xe')](_0x3f6bd8);_0x1610b4[_0x1d10('0x10')]();_0x1610b4['on']('close',function(){return _0x43df2c(_0xb9e08);});}catch(_0x905f66){fs[_0x1d10('0x11')](_0xb9e08);return _0x3a15c8(_0x905f66);}});});};exports[_0x1d10('0x12')]=function(_0x2ad3c0,_0x4f014a,_0x3aedf7,_0x3fe555){return new BPromise(function(_0x41152c,_0x3f2f2b){_0x3fe555=combineOptions(_0x3fe555);var _0x1b2051=new Buffer(_0x3aedf7);var _0x382b37=fs[_0x1d10('0x8')](_0x2ad3c0);var _0x4f3e2a=fs[_0x1d10('0x9')](_0x4f014a);var _0x1163dd=crypto[_0x1d10('0x13')](_0x3fe555[_0x1d10('0xb')],_0x1b2051);_0x382b37['on'](_0x1d10('0x14'),function(_0x5e61f8){var _0x47d4e2=new Buffer(_0x1163dd[_0x1d10('0xc')](_0x5e61f8),'binary');_0x4f3e2a['write'](_0x47d4e2);});_0x382b37['on']('end',function(){try{var _0x237b92=new Buffer(_0x1163dd[_0x1d10('0xf')](_0x1d10('0xd')),_0x1d10('0xd'));_0x4f3e2a['write'](_0x237b92);_0x4f3e2a['end']();_0x4f3e2a['on'](_0x1d10('0x15'),function(){return _0x41152c(_0x4f014a);});}catch(_0x5da6cf){fs[_0x1d10('0x11')](_0x4f014a);return _0x3f2f2b(_0x5da6cf);}});});};exports[_0x1d10('0x16')]=function(_0x160802,_0x37f22d,_0x127b37){var _0x3601ba=_0x127b37||stringOptions[_0x1d10('0xb')];var _0x3af06d=_0x37f22d||stringOptions[_0x1d10('0x17')];var _0x84055f=crypto[_0x1d10('0xa')](_0x3601ba,_0x3af06d);var _0x5abc58=_0x84055f[_0x1d10('0xc')](_0x160802,_0x1d10('0x18'),_0x1d10('0x19'));_0x5abc58+=_0x84055f[_0x1d10('0xf')](_0x1d10('0x19'));return _0x5abc58;};exports[_0x1d10('0x1a')]=function(_0x38f583,_0xaa8ab6,_0x4f7837){var _0x355e10=_0x4f7837||stringOptions[_0x1d10('0xb')];var _0x59b5eb=_0xaa8ab6||stringOptions[_0x1d10('0x17')];var _0x52d514=crypto['createDecipher'](_0x355e10,_0x59b5eb);var _0x41b5b8=_0x52d514['update'](_0x38f583,_0x1d10('0x19'),_0x1d10('0x18'));_0x41b5b8+=_0x52d514[_0x1d10('0xf')](_0x1d10('0x18'));return _0x41b5b8;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index d4f7cc7..d05137f 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 _0x34e8=['format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','push','dirname','.csv','join','mkdirSync','%s%d.%s','csv','then','%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','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x34e8,0x12c));var _0x834e=function(_0x263314,_0x5b88bf){_0x263314=_0x263314-0x0;var _0x534d73=_0x34e8[_0x263314];return _0x534d73;};'use strict';var util=require(_0x834e('0x0'));var path=require(_0x834e('0x1'));var _=require(_0x834e('0x2'));var csv=require(_0x834e('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x834e('0x4'));var rimraf=require(_0x834e('0x5'));var db=require(_0x834e('0x6'))['db'];var dbH=require(_0x834e('0x6'))[_0x834e('0x7')];var logger=require(_0x834e('0x8'))(_0x834e('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x834e('0xa')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x3e16d2,_0x3cc2e3){var _0x3a3ef6={'status':_0x3e16d2};var _0x2e69e2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3cc2e3){_0x3a3ef6[_0x834e('0xb')]=_0x3cc2e3;}return db[_0x834e('0xc')][_0x834e('0xd')](_0x3a3ef6,_0x2e69e2);}function main(){var _0x1af45a=0x1388;var _0x3bdda9;logger[_0x834e('0xe')](util[_0x834e('0xf')](_0x834e('0x10'),EXTRACTED_REPORT_ID,_0x834e('0x11')));return db[_0x834e('0x12')][_0x834e('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x834e('0x14'),_0x834e('0x15')]})['then'](function(_0x5e5b6d){if(_0x5e5b6d){_0x3bdda9=_0x5e5b6d;_0x1af45a=_0x3bdda9[_0x834e('0x15')]||0x1388;}})['then'](function(){return dbH[_0x834e('0x16')][_0x834e('0x17')](util[_0x834e('0xf')](_0x834e('0x18'),QUERY),{'type':dbH['sequelize'][_0x834e('0x19')][_0x834e('0x1a')]});})['then'](function(_0x316205){if(!_0x316205[0x0]['num']){return analyticExtractedReport(_0x834e('0x1b'));}var _0x36d443=[];var _0x478afe=0x0;var _0x43ac41=!![];if(_0x316205&&_0x316205[_0x834e('0x1c')]){var _0x370fb5=_0x316205[0x0]['num']%(_0x478afe+_0x1af45a);if(_0x3bdda9[_0x834e('0x14')]){for(;_0x43ac41;_0x478afe+=_0x1af45a,_0x370fb5=_0x316205[0x0][_0x834e('0x1d')]%(_0x478afe+_0x1af45a)){if(_0x370fb5==0x0||_0x370fb5==_0x316205[0x0][_0x834e('0x1d')]){_0x43ac41=![];}_0x36d443[_0x834e('0x1e')](dbH[_0x834e('0x16')][_0x834e('0x17')](util[_0x834e('0xf')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1af45a,_0x478afe),{'type':dbH[_0x834e('0x16')][_0x834e('0x19')][_0x834e('0x1a')]}));}}else{_0x36d443[_0x834e('0x1e')](dbH['sequelize'][_0x834e('0x17')](QUERY,{'type':dbH[_0x834e('0x16')]['QueryTypes'][_0x834e('0x1a')]}));}}var _0x28d687=path[_0x834e('0x1f')](PATH);var _0x5c55ca=path['basename'](PATH,_0x834e('0x20'));var _0x34563b=_0x3bdda9['split']&&_0x36d443[_0x834e('0x1c')]>0x1;var _0x1dc1e0=[];if(!fs['existsSync'](path[_0x834e('0x21')](_0x28d687,_0x5c55ca))&&_0x34563b){fs[_0x834e('0x22')](path[_0x834e('0x21')](_0x28d687,_0x5c55ca));}return BPromise['each'](_0x36d443,function(_0x24fcf7){_0x1dc1e0[_0x834e('0x1e')](_0x24fcf7);})['then'](function(){for(var _0x5bef62=0x0;_0x5bef62<_0x1dc1e0[_0x834e('0x1c')];_0x5bef62+=0x1){var _0x508a1d;var _0x2826ec=_0x1dc1e0[_0x5bef62];if(_0x34563b){_0x508a1d=path[_0x834e('0x21')](_0x28d687,_0x5c55ca,util[_0x834e('0xf')](_0x834e('0x23'),_0x5c55ca,_0x5bef62,_0x834e('0x24')));}else{_0x508a1d=path[_0x834e('0x21')](_0x28d687,util['format']('%s.%s',_0x5c55ca,'csv'));}fs['writeFileSync'](_0x508a1d,csv(_0x2826ec));}})[_0x834e('0x25')](function(){if(_0x34563b){zipdir(path[_0x834e('0x21')](_0x28d687,_0x5c55ca),{'saveTo':path[_0x834e('0x21')](_0x28d687,util['format'](_0x834e('0x26'),_0x5c55ca,_0x834e('0x27')))},function(_0x1f3671,_0x1e026a){});rimraf(path[_0x834e('0x21')](_0x28d687,_0x5c55ca),function(){});}})[_0x834e('0x25')](function(){logger[_0x834e('0xe')](util[_0x834e('0xf')](_0x834e('0x28'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x834e('0x29'),_0x34563b?util['format'](_0x834e('0x26'),_0x5c55ca,_0x34563b?_0x834e('0x27'):_0x834e('0x24')):null);});})[_0x834e('0x2a')](function(_0x444366){logger[_0x834e('0xe')](util[_0x834e('0xf')](_0x834e('0x2b'),EXTRACTED_REPORT_ID,_0x834e('0x11')),util[_0x834e('0x2c')](_0x444366,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xee5b=['rimraf','../../mysqldb','analytics','argv','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty','length','num','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','.csv','existsSync','join','csv','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','lodash','to-csv','zip-dir'];(function(_0x5a6aa7,_0xff2a57){var _0x316b32=function(_0x1019fc){while(--_0x1019fc){_0x5a6aa7['push'](_0x5a6aa7['shift']());}};_0x316b32(++_0xff2a57);}(_0xee5b,0x1f4));var _0xbee5=function(_0x3e857b,_0x2cf089){_0x3e857b=_0x3e857b-0x0;var _0x2384ea=_0xee5b[_0x3e857b];return _0x2384ea;};'use strict';var util=require(_0xbee5('0x0'));var path=require('path');var _=require(_0xbee5('0x1'));var csv=require(_0xbee5('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xbee5('0x3'));var rimraf=require(_0xbee5('0x4'));var db=require(_0xbee5('0x5'))['db'];var dbH=require(_0xbee5('0x5'))['dbH'];var logger=require('../../config/logger')(_0xbee5('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xbee5('0x7')][0x2]);var QUERY=process[_0xbee5('0x7')][0x3];var PATH=process[_0xbee5('0x7')][0x4];function analyticExtractedReport(_0x4f5065,_0x5505e3){var _0x53d5b9={'status':_0x4f5065};var _0x5baf5c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5505e3){_0x53d5b9['savename']=_0x5505e3;}return db[_0xbee5('0x8')][_0xbee5('0x9')](_0x53d5b9,_0x5baf5c);}function main(){var _0x45c2c7=0x1388;var _0x20f717;logger['info'](util[_0xbee5('0xa')](_0xbee5('0xb'),EXTRACTED_REPORT_ID,_0xbee5('0xc')));return db[_0xbee5('0xd')][_0xbee5('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbee5('0xf'),_0xbee5('0x10')]})[_0xbee5('0x11')](function(_0xcef158){if(_0xcef158){_0x20f717=_0xcef158;_0x45c2c7=_0x20f717['splitSizeCsv']||0x1388;}})[_0xbee5('0x11')](function(){return dbH['sequelize'][_0xbee5('0x12')](util[_0xbee5('0xa')](_0xbee5('0x13'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xbee5('0x14')]});})['then'](function(_0x40afcb){if(!_0x40afcb[0x0]['num']){return analyticExtractedReport(_0xbee5('0x15'));}var _0x141878=[];var _0xf676b1=0x0;var _0x53b269=!![];if(_0x40afcb&&_0x40afcb[_0xbee5('0x16')]){var _0x662d2c=_0x40afcb[0x0]['num']%(_0xf676b1+_0x45c2c7);if(_0x20f717[_0xbee5('0xf')]){for(;_0x53b269;_0xf676b1+=_0x45c2c7,_0x662d2c=_0x40afcb[0x0][_0xbee5('0x17')]%(_0xf676b1+_0x45c2c7)){if(_0x662d2c==0x0||_0x662d2c==_0x40afcb[0x0][_0xbee5('0x17')]){_0x53b269=![];}_0x141878[_0xbee5('0x18')](dbH[_0xbee5('0x19')][_0xbee5('0x12')](util[_0xbee5('0xa')](_0xbee5('0x1a'),QUERY,_0x45c2c7,_0xf676b1),{'type':dbH[_0xbee5('0x19')][_0xbee5('0x1b')][_0xbee5('0x14')]}));}}else{_0x141878[_0xbee5('0x18')](dbH[_0xbee5('0x19')][_0xbee5('0x12')](QUERY,{'type':dbH[_0xbee5('0x19')]['QueryTypes']['SELECT']}));}}var _0x469a7a=path['dirname'](PATH);var _0x205491=path[_0xbee5('0x1c')](PATH,_0xbee5('0x1d'));var _0x2bfb0f=_0x20f717[_0xbee5('0xf')]&&_0x141878[_0xbee5('0x16')]>0x1;var _0x359ccf=[];if(!fs[_0xbee5('0x1e')](path[_0xbee5('0x1f')](_0x469a7a,_0x205491))&&_0x2bfb0f){fs['mkdirSync'](path['join'](_0x469a7a,_0x205491));}return BPromise['each'](_0x141878,function(_0x519473){_0x359ccf['push'](_0x519473);})[_0xbee5('0x11')](function(){for(var _0x18d7f4=0x0;_0x18d7f4<_0x359ccf[_0xbee5('0x16')];_0x18d7f4+=0x1){var _0x28c74d;var _0x169042=_0x359ccf[_0x18d7f4];if(_0x2bfb0f){_0x28c74d=path[_0xbee5('0x1f')](_0x469a7a,_0x205491,util[_0xbee5('0xa')]('%s%d.%s',_0x205491,_0x18d7f4,_0xbee5('0x20')));}else{_0x28c74d=path[_0xbee5('0x1f')](_0x469a7a,util[_0xbee5('0xa')](_0xbee5('0x21'),_0x205491,_0xbee5('0x20')));}fs['writeFileSync'](_0x28c74d,csv(_0x169042));}})[_0xbee5('0x11')](function(){if(_0x2bfb0f){zipdir(path[_0xbee5('0x1f')](_0x469a7a,_0x205491),{'saveTo':path[_0xbee5('0x1f')](_0x469a7a,util[_0xbee5('0xa')](_0xbee5('0x21'),_0x205491,_0xbee5('0x22')))},function(_0x34b7df,_0x36e8bb){});rimraf(path[_0xbee5('0x1f')](_0x469a7a,_0x205491),function(){});}})['then'](function(){logger[_0xbee5('0x23')](util['format'](_0xbee5('0x24'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbee5('0x25'),_0x2bfb0f?util['format'](_0xbee5('0x21'),_0x205491,_0x2bfb0f?'zip':_0xbee5('0x20')):null);});})[_0xbee5('0x26')](function(_0x36eb70){logger[_0xbee5('0x23')](util['format'](_0xbee5('0x27'),EXTRACTED_REPORT_ID,_0xbee5('0xc')),util[_0xbee5('0x28')](_0x36eb70,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbee5('0x29'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 3134bc1..bf3b80d 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(_0x255cd2,_0x2fef7e){var _0x24b4ab=function(_0x2ab58a){while(--_0x2ab58a){_0x255cd2['push'](_0x255cd2['shift']());}};_0x24b4ab(++_0x2fef7e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3de50d,_0x4129c1){_0x3de50d=_0x3de50d-0x0;var _0x10cc26=_0x5f2f[_0x3de50d];return _0x10cc26;};'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(_0x5ad51a,_0x41fa41){var _0x5f45a8=function(_0x3ead46){while(--_0x3ead46){_0x5ad51a['push'](_0x5ad51a['shift']());}};_0x5f45a8(++_0x41fa41);}(_0xb10b,0x12a));var _0xbb10=function(_0x12dd11,_0x52b882){_0x12dd11=_0x12dd11-0x0;var _0x3a502b=_0xb10b[_0x12dd11];return _0x3a502b;};'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 3e08bdd..dce9370 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 _0xed9b=['basename','.xlsx','existsSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Setting','find','split','then','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xed9b,0xd2));var _0xbed9=function(_0x4d08b8,_0x34c445){_0x4d08b8=_0x4d08b8-0x0;var _0x70214a=_0xed9b[_0x4d08b8];return _0x70214a;};'use strict';var util=require('util');var path=require(_0xbed9('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xbed9('0x1'));var zipdir=require(_0xbed9('0x2'));var rimraf=require(_0xbed9('0x3'));var db=require(_0xbed9('0x4'))['db'];var dbH=require(_0xbed9('0x4'))[_0xbed9('0x5')];var logger=require(_0xbed9('0x6'))(_0xbed9('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xbed9('0x8')][0x3];var PATH=process[_0xbed9('0x8')][0x4];function analyticExtractedReport(_0x5d404a,_0x2c7a27){var _0x4f65dc={'status':_0x5d404a};var _0x9c3f38={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2c7a27){_0x4f65dc[_0xbed9('0x9')]=_0x2c7a27;}return db[_0xbed9('0xa')][_0xbed9('0xb')](_0x4f65dc,_0x9c3f38);}function main(){var _0x20d8d6=0x1388;var _0x472f9f;logger[_0xbed9('0xc')](util[_0xbed9('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0xbed9('0xe')][_0xbed9('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbed9('0x10'),'splitSizeXlsx']})[_0xbed9('0x11')](function(_0x8e7ef4){if(_0x8e7ef4){_0x472f9f=_0x8e7ef4;_0x20d8d6=_0x472f9f[_0xbed9('0x12')]||0x1388;}})[_0xbed9('0x11')](function(){return dbH[_0xbed9('0x13')][_0xbed9('0x14')](util[_0xbed9('0xd')](_0xbed9('0x15'),QUERY),{'type':dbH[_0xbed9('0x13')][_0xbed9('0x16')][_0xbed9('0x17')]});})[_0xbed9('0x11')](function(_0x1c3d95){if(!_0x1c3d95[0x0][_0xbed9('0x18')]){return analyticExtractedReport(_0xbed9('0x19'));}var _0x2c18ab=[];var _0x2b4a08=0x0;var _0x297ca1=!![];if(_0x472f9f['split']){if(_0x1c3d95&&_0x1c3d95[_0xbed9('0x1a')]){var _0xc0fb44=_0x1c3d95[0x0][_0xbed9('0x18')]%(_0x2b4a08+_0x20d8d6);for(;_0x297ca1;_0x2b4a08+=_0x20d8d6,_0xc0fb44=_0x1c3d95[0x0][_0xbed9('0x18')]%(_0x2b4a08+_0x20d8d6)){if(_0xc0fb44==0x0||_0xc0fb44==_0x1c3d95[0x0][_0xbed9('0x18')]){_0x297ca1=![];}_0x2c18ab[_0xbed9('0x1b')](dbH[_0xbed9('0x13')][_0xbed9('0x14')](util[_0xbed9('0xd')](_0xbed9('0x1c'),QUERY,_0x20d8d6,_0x2b4a08),{'type':dbH[_0xbed9('0x13')][_0xbed9('0x16')][_0xbed9('0x17')]}));}}}else{_0x2c18ab[_0xbed9('0x1b')](dbH[_0xbed9('0x13')]['query'](QUERY,{'type':dbH[_0xbed9('0x13')][_0xbed9('0x16')][_0xbed9('0x17')]}));}var _0x1af2ec=path[_0xbed9('0x1d')](PATH);var _0x438bd0=path[_0xbed9('0x1e')](PATH,_0xbed9('0x1f'));var _0x1b9869=_0x472f9f[_0xbed9('0x10')]&&_0x2c18ab['length']>0x1;var _0x1c174b=[];if(!fs[_0xbed9('0x20')](path['join'](_0x1af2ec,_0x438bd0))&&_0x1b9869){fs['mkdirSync'](path[_0xbed9('0x21')](_0x1af2ec,_0x438bd0));}return BPromise[_0xbed9('0x22')](_0x2c18ab,function(_0x4a460f){_0x1c174b[_0xbed9('0x1b')](_0x4a460f);})['then'](function(){for(var _0x5aaf3b=0x0;_0x5aaf3b<_0x1c174b['length'];_0x5aaf3b+=0x1){var _0x296a97;var _0x5a56b0=_0x1c174b[_0x5aaf3b];if(_0x1b9869){_0x296a97=path[_0xbed9('0x21')](_0x1af2ec,_0x438bd0,util[_0xbed9('0xd')](_0xbed9('0x23'),_0x438bd0,_0x5aaf3b,_0xbed9('0x24')));}else{_0x296a97=path[_0xbed9('0x21')](_0x1af2ec,util[_0xbed9('0xd')](_0xbed9('0x25'),_0x438bd0,'xlsx'));}fs[_0xbed9('0x26')](_0x296a97,json2xls(_0x5a56b0),_0xbed9('0x27'));}})[_0xbed9('0x11')](function(){if(_0x1b9869){zipdir(path[_0xbed9('0x21')](_0x1af2ec,_0x438bd0),{'saveTo':path[_0xbed9('0x21')](_0x1af2ec,util['format'](_0xbed9('0x25'),_0x438bd0,_0xbed9('0x28')))},function(_0x2fcb6e,_0x229978){});rimraf(path['join'](_0x1af2ec,_0x438bd0),function(){});}})['then'](function(){logger['info'](util[_0xbed9('0xd')](_0xbed9('0x29'),EXTRACTED_REPORT_ID,_0xbed9('0x2a')));return analyticExtractedReport(_0xbed9('0x2b'),_0x1b9869?util[_0xbed9('0xd')](_0xbed9('0x25'),_0x438bd0,_0x1b9869?_0xbed9('0x28'):_0xbed9('0x24')):null);});})[_0xbed9('0x2c')](function(_0x32078a){logger[_0xbed9('0xc')](util['format'](_0xbed9('0x2d'),EXTRACTED_REPORT_ID,_0xbed9('0x2a')),util[_0xbed9('0x2e')](_0x32078a,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbed9('0x2f'));});}main(); \ No newline at end of file +var _0xd535=['xlsx','%s.%s','writeFileSync','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','then','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','dirname','basename','existsSync','join','each','%s%d.%s'];(function(_0x2f8230,_0x698070){var _0x2fea7c=function(_0x365351){while(--_0x365351){_0x2f8230['push'](_0x2f8230['shift']());}};_0x2fea7c(++_0x698070);}(_0xd535,0x161));var _0x5d53=function(_0x190562,_0x908684){_0x190562=_0x190562-0x0;var _0x1a6ee7=_0xd535[_0x190562];return _0x1a6ee7;};'use strict';var util=require(_0x5d53('0x0'));var path=require(_0x5d53('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0x5d53('0x2'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x5d53('0x3'))[_0x5d53('0x4')];var logger=require(_0x5d53('0x5'))(_0x5d53('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x5d53('0x7')][0x2]);var QUERY=process[_0x5d53('0x7')][0x3];var PATH=process[_0x5d53('0x7')][0x4];function analyticExtractedReport(_0x1f8b5a,_0x18a64b){var _0x33e097={'status':_0x1f8b5a};var _0x4e9a58={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x18a64b){_0x33e097[_0x5d53('0x8')]=_0x18a64b;}return db['AnalyticExtractedReport'][_0x5d53('0x9')](_0x33e097,_0x4e9a58);}function main(){var _0xf811bb=0x1388;var _0x409b08;logger[_0x5d53('0xa')](util[_0x5d53('0xb')](_0x5d53('0xc'),EXTRACTED_REPORT_ID,_0x5d53('0xd')));return db[_0x5d53('0xe')][_0x5d53('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5d53('0x10'),'splitSizeXlsx']})[_0x5d53('0x11')](function(_0x2dff7c){if(_0x2dff7c){_0x409b08=_0x2dff7c;_0xf811bb=_0x409b08[_0x5d53('0x12')]||0x1388;}})[_0x5d53('0x11')](function(){return dbH[_0x5d53('0x13')][_0x5d53('0x14')](util[_0x5d53('0xb')](_0x5d53('0x15'),QUERY),{'type':dbH[_0x5d53('0x13')][_0x5d53('0x16')][_0x5d53('0x17')]});})[_0x5d53('0x11')](function(_0x3e8d72){if(!_0x3e8d72[0x0][_0x5d53('0x18')]){return analyticExtractedReport(_0x5d53('0x19'));}var _0x5f2453=[];var _0x4e716b=0x0;var _0x894bcc=!![];if(_0x409b08['split']){if(_0x3e8d72&&_0x3e8d72[_0x5d53('0x1a')]){var _0x44afa2=_0x3e8d72[0x0][_0x5d53('0x18')]%(_0x4e716b+_0xf811bb);for(;_0x894bcc;_0x4e716b+=_0xf811bb,_0x44afa2=_0x3e8d72[0x0][_0x5d53('0x18')]%(_0x4e716b+_0xf811bb)){if(_0x44afa2==0x0||_0x44afa2==_0x3e8d72[0x0][_0x5d53('0x18')]){_0x894bcc=![];}_0x5f2453[_0x5d53('0x1b')](dbH[_0x5d53('0x13')][_0x5d53('0x14')](util[_0x5d53('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xf811bb,_0x4e716b),{'type':dbH[_0x5d53('0x13')][_0x5d53('0x16')]['SELECT']}));}}}else{_0x5f2453[_0x5d53('0x1b')](dbH[_0x5d53('0x13')]['query'](QUERY,{'type':dbH[_0x5d53('0x13')][_0x5d53('0x16')][_0x5d53('0x17')]}));}var _0x1afcac=path[_0x5d53('0x1c')](PATH);var _0x438a61=path[_0x5d53('0x1d')](PATH,'.xlsx');var _0x3faf26=_0x409b08[_0x5d53('0x10')]&&_0x5f2453[_0x5d53('0x1a')]>0x1;var _0x441b66=[];if(!fs[_0x5d53('0x1e')](path[_0x5d53('0x1f')](_0x1afcac,_0x438a61))&&_0x3faf26){fs['mkdirSync'](path[_0x5d53('0x1f')](_0x1afcac,_0x438a61));}return BPromise[_0x5d53('0x20')](_0x5f2453,function(_0x480347){_0x441b66[_0x5d53('0x1b')](_0x480347);})[_0x5d53('0x11')](function(){for(var _0x23f77c=0x0;_0x23f77c<_0x441b66['length'];_0x23f77c+=0x1){var _0x3a891e;var _0x214602=_0x441b66[_0x23f77c];if(_0x3faf26){_0x3a891e=path[_0x5d53('0x1f')](_0x1afcac,_0x438a61,util[_0x5d53('0xb')](_0x5d53('0x21'),_0x438a61,_0x23f77c,_0x5d53('0x22')));}else{_0x3a891e=path['join'](_0x1afcac,util['format'](_0x5d53('0x23'),_0x438a61,_0x5d53('0x22')));}fs[_0x5d53('0x24')](_0x3a891e,json2xls(_0x214602),'binary');}})[_0x5d53('0x11')](function(){if(_0x3faf26){zipdir(path['join'](_0x1afcac,_0x438a61),{'saveTo':path[_0x5d53('0x1f')](_0x1afcac,util[_0x5d53('0xb')](_0x5d53('0x23'),_0x438a61,'zip'))},function(_0x3b23d5,_0x4136ea){});rimraf(path['join'](_0x1afcac,_0x438a61),function(){});}})['then'](function(){logger[_0x5d53('0xa')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x5d53('0xd')));return analyticExtractedReport(_0x5d53('0x25'),_0x3faf26?util[_0x5d53('0xb')]('%s.%s',_0x438a61,_0x3faf26?_0x5d53('0x26'):_0x5d53('0x22')):null);});})[_0x5d53('0x27')](function(_0x5e9a32){logger[_0x5d53('0xa')](util[_0x5d53('0xb')](_0x5d53('0x28'),EXTRACTED_REPORT_ID,_0x5d53('0xd')),util[_0x5d53('0x29')](_0x5e9a32,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x5d53('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 1d88da4..fc30aa5 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 _0xb240=['intervals','VoiceExtension','IntervalId','map','filter','groupBy','queue','hasOwnProperty','exten','extensions','push','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','priority','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','createdAt','updatedAt','*,*,*,*','tag','outbound','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','concat','Hangup','transaction','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then'];(function(_0x31f68a,_0x3a8e65){var _0xc44561=function(_0x1d8685){while(--_0x1d8685){_0x31f68a['push'](_0x31f68a['shift']());}};_0xc44561(++_0x3a8e65);}(_0xb240,0x7e));var _0x0b24=function(_0x4a8c11,_0x26aa24){_0x4a8c11=_0x4a8c11-0x0;var _0x408c7f=_0xb240[_0x4a8c11];return _0x408c7f;};'use strict';var _=require(_0x0b24('0x0'));var util=require(_0x0b24('0x1'));function rewrite(_0x1a79be,_0x2ad2a5){var _0x28ed39=this;return _0x1a79be[_0x0b24('0x2')][_0x0b24('0x3')][_0x0b24('0x4')]({'raw':!![]})[_0x0b24('0x5')](function(_0x567c96){_0x28ed39[_0x0b24('0x6')]=_0x567c96;return _0x1a79be[_0x0b24('0x2')][_0x0b24('0x7')][_0x0b24('0x4')]({'where':{'IntervalId':_0x2ad2a5[_0x0b24('0x8')]},'raw':!![]});})['then'](function(_0x238a19){return _0x1a79be[_0x0b24('0x2')][_0x0b24('0x7')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0x0b24('0x9')](_0x238a19,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x0b24('0x5')](function(_0x232db0){var _0x2c4871=_[_0x0b24('0xa')](_0x232db0,{'priority':'1'});var _0x31ba86=_[_0x0b24('0xa')](_0x232db0,{'isApp':0x1});var _0x27d44b=_[_0x0b24('0xb')](_0x31ba86,'exten');var _0x46957d=[_0x0b24('0xc'),'playback'];var _0x385410=[];var _0x109abf=[];for(var _0x3ed2b3 in _0x27d44b){if(_0x27d44b[_0x0b24('0xd')](_0x3ed2b3)){_0x28ed39['priority']=0x2;_0x28ed39['extensions']=[];_0x28ed39['extension']=_['find'](_0x2c4871,{'exten':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0xe')]});_0x28ed39[_0x0b24('0xf')][_0x0b24('0x10')]({'type':_0x27d44b[_0x3ed2b3][0x0]['type'],'app':_0x0b24('0x11'),'appdata':util[_0x0b24('0x12')](_0x0b24('0x13'),_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x14')]),'context':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x15')],'exten':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0xe')],'priority':_0x28ed39['priority']++,'VoiceExtensionId':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x16')]});if(_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x14')]==='outbound'){if(_0x28ed39[_0x0b24('0x17')]){_0x28ed39['extensions']['push']({'type':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x14')],'app':_0x0b24('0x11'),'appdata':_0x0b24('0x18')+(_0x28ed39['extension'][_0x0b24('0x19')]?_0x0b24('0x1a')+_0x28ed39['extension'][_0x0b24('0x19')]+'}':_0x0b24('0x1b')),'context':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x15')],'exten':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0xe')],'priority':_0x28ed39[_0x0b24('0x1c')]++,'VoiceExtensionId':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x16')]});}_0x28ed39[_0x0b24('0xf')][_0x0b24('0x10')]({'type':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x14')],'app':'Set','appdata':'CDR(routeid)='+_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x16')],'context':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x15')],'exten':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0xe')],'priority':_0x28ed39[_0x0b24('0x1c')]++,'VoiceExtensionId':_0x27d44b[_0x3ed2b3][0x0]['VoiceExtensionId']});var _0x294d39=_0x28ed39['priority']++;_0x28ed39[_0x0b24('0xf')][_0x0b24('0x10')]({'type':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x14')],'app':_0x0b24('0x1d'),'appdata':_0x0b24('0x1e')+(_0x294d39+0x2)+_0x0b24('0x1f')+(_0x294d39+0x1)+')','context':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x15')],'exten':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0xe')],'priority':_0x294d39,'VoiceExtensionId':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x16')]});if(_0x28ed39[_0x0b24('0x17')]){_0x28ed39[_0x0b24('0xf')][_0x0b24('0x10')]({'type':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x14')],'app':_0x0b24('0x11'),'appdata':_0x28ed39[_0x0b24('0x17')][_0x0b24('0x19')]?_0x0b24('0x20')+_0x28ed39[_0x0b24('0x17')][_0x0b24('0x19')]+'}':_0x0b24('0x21'),'context':_0x27d44b[_0x3ed2b3][0x0]['context'],'exten':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0xe')],'priority':_0x28ed39['priority']++,'VoiceExtensionId':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x16')]});}_0x28ed39[_0x0b24('0xf')]['push']({'type':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x14')],'app':_0x0b24('0x11'),'appdata':_0x0b24('0x22')+_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x16')],'context':_0x27d44b[_0x3ed2b3][0x0]['context'],'exten':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0xe')],'priority':_0x28ed39[_0x0b24('0x1c')]++,'VoiceExtensionId':_0x27d44b[_0x3ed2b3][0x0]['VoiceExtensionId']});if(_0x28ed39[_0x0b24('0x17')]&&_0x28ed39[_0x0b24('0x17')][_0x0b24('0xd')](_0x0b24('0x23'))&&_0x28ed39[_0x0b24('0x17')][_0x0b24('0x23')]!==_0x0b24('0x24')){_0x28ed39[_0x0b24('0xf')][_0x0b24('0x10')]({'type':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x14')],'app':'Set','appdata':_0x0b24('0x25'),'context':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x15')],'exten':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0xe')],'priority':_0x28ed39['priority']++,'VoiceExtensionId':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x16')]});_0x28ed39[_0x0b24('0xf')][_0x0b24('0x10')]({'type':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x14')],'app':'Set','appdata':_0x0b24('0x26')+_0x28ed39[_0x0b24('0x17')][_0x0b24('0x23')]||_0x0b24('0x27'),'context':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x15')],'exten':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0xe')],'priority':_0x28ed39[_0x0b24('0x1c')]++,'VoiceExtensionId':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x16')]});}}_0x28ed39[_0x0b24('0xf')][_0x0b24('0x10')]({'type':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x14')],'app':_0x0b24('0x11'),'appdata':_0x0b24('0x28'),'context':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x15')],'exten':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0xe')],'priority':_0x28ed39[_0x0b24('0x1c')]++,'VoiceExtensionId':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x16')]});_0x28ed39[_0x0b24('0xf')][_0x0b24('0x10')]({'type':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x14')],'app':_0x0b24('0x11'),'appdata':_0x0b24('0x29'),'context':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x15')],'exten':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0xe')],'priority':_0x28ed39['priority']++,'VoiceExtensionId':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x16')]});_0x28ed39[_0x0b24('0xf')][_0x0b24('0x10')]({'type':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x14')],'app':_0x0b24('0x11'),'appdata':_0x0b24('0x2a'),'context':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x15')],'exten':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0xe')],'priority':_0x28ed39[_0x0b24('0x1c')]++,'VoiceExtensionId':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x16')]});for(var _0x53a721=0x0,_0x331fff=0x0;_0x53a721<_0x27d44b[_0x3ed2b3]['length'];_0x53a721+=0x1,_0x331fff=0x0){var _0x3ccbb4=_0x27d44b[_0x3ed2b3][_0x53a721];if(_0x3ccbb4[_0x0b24('0x14')]){_0x3ccbb4[_0x0b24('0x14')]=_0x3ccbb4['type']['toLowerCase']();}var _0x33ddba=[];var _0x480e4d=[];delete _0x3ccbb4['id'];delete _0x3ccbb4[_0x0b24('0x2b')];delete _0x3ccbb4[_0x0b24('0x2c')];var _0x3416f5=_0x3ccbb4['interval']!==_0x0b24('0x2d')?[_0x3ccbb4['interval']]:_0x3ccbb4[_0x0b24('0x8')]?_[_0x0b24('0x9')](_['filter'](_0x28ed39['intervals'],{'IntervalId':_0x3ccbb4[_0x0b24('0x8')]}),'interval'):[];if(_0x3ccbb4[_0x0b24('0xd')](_0x0b24('0x2e'))){if(_0x3ccbb4[_0x0b24('0x2e')]&&_0x3ccbb4[_0x0b24('0x2e')]!=='--'){_0x33ddba[_0x0b24('0x10')]({'type':_0x3ccbb4[_0x0b24('0x14')],'app':_0x0b24('0x11'),'appdata':'CDR(tag)='+_0x3ccbb4[_0x0b24('0x2e')],'context':_0x3ccbb4[_0x0b24('0x15')],'exten':_0x3ccbb4[_0x0b24('0xe')],'priority':_0x3416f5['length']+_0x28ed39[_0x0b24('0x1c')]+_0x331fff++,'VoiceExtensionId':_0x3ccbb4['VoiceExtensionId']});}}if(_0x3ccbb4[_0x0b24('0x14')]===_0x0b24('0x2f')&&_0x3ccbb4[_0x0b24('0xd')]('callerID')){if(_0x3ccbb4['callerID']){_0x33ddba[_0x0b24('0x10')]({'type':_0x3ccbb4[_0x0b24('0x14')],'app':_0x0b24('0x1d'),'appdata':_0x0b24('0x30')+_0x3ccbb4['callerID']+')','context':_0x3ccbb4[_0x0b24('0x15')],'exten':_0x3ccbb4[_0x0b24('0xe')],'priority':_0x3416f5[_0x0b24('0x31')]+_0x28ed39[_0x0b24('0x1c')]+_0x331fff++,'VoiceExtensionId':_0x3ccbb4[_0x0b24('0x16')]});}else{_0x33ddba[_0x0b24('0x10')]({'type':_0x3ccbb4[_0x0b24('0x14')],'app':_0x0b24('0x1d'),'appdata':_0x0b24('0x32'),'context':_0x3ccbb4[_0x0b24('0x15')],'exten':_0x3ccbb4['exten'],'priority':_0x3416f5[_0x0b24('0x31')]+_0x28ed39[_0x0b24('0x1c')]+_0x331fff++,'VoiceExtensionId':_0x3ccbb4['VoiceExtensionId']});}}if(_0x3ccbb4[_0x0b24('0xd')](_0x0b24('0x33'))){if(_0x46957d['indexOf'](_0x3ccbb4[_0x0b24('0x34')]['toLowerCase']())>=0x0&&_0x3ccbb4['appType']!==_0x0b24('0x35')){if(_0x3ccbb4['answer']){_0x33ddba[_0x0b24('0x10')]({'type':_0x3ccbb4[_0x0b24('0x14')],'app':_0x0b24('0x1d'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x3ccbb4[_0x0b24('0x15')],'exten':_0x3ccbb4[_0x0b24('0xe')],'priority':_0x3416f5[_0x0b24('0x31')]+_0x28ed39[_0x0b24('0x1c')]+_0x331fff++,'VoiceExtensionId':_0x3ccbb4['VoiceExtensionId']});_0x33ddba[_0x0b24('0x10')]({'type':_0x3ccbb4[_0x0b24('0x14')],'app':_0x0b24('0x11'),'appdata':_0x0b24('0x36'),'context':_0x3ccbb4[_0x0b24('0x15')],'exten':_0x3ccbb4[_0x0b24('0xe')],'priority':_0x3416f5['length']+_0x28ed39[_0x0b24('0x1c')]+_0x331fff++,'VoiceExtensionId':_0x3ccbb4[_0x0b24('0x16')]});}else{_0x33ddba[_0x0b24('0x10')]({'type':_0x3ccbb4['type'],'app':_0x0b24('0x1d'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x3ccbb4[_0x0b24('0x15')],'exten':_0x3ccbb4[_0x0b24('0xe')],'priority':_0x3416f5[_0x0b24('0x31')]+_0x28ed39[_0x0b24('0x1c')]+_0x331fff++,'VoiceExtensionId':_0x3ccbb4[_0x0b24('0x16')]});_0x33ddba['push']({'type':_0x3ccbb4['type'],'app':_0x0b24('0x11'),'appdata':_0x0b24('0x37'),'context':_0x3ccbb4[_0x0b24('0x15')],'exten':_0x3ccbb4['exten'],'priority':_0x3416f5[_0x0b24('0x31')]+_0x28ed39[_0x0b24('0x1c')]+_0x331fff++,'VoiceExtensionId':_0x3ccbb4[_0x0b24('0x16')]});}}}for(var _0x18b7dc=0x0;_0x18b7dc<_0x3416f5[_0x0b24('0x31')];_0x18b7dc+=0x1){var _0x492c18=_0x28ed39[_0x0b24('0x1c')]+_0x3416f5[_0x0b24('0x31')];var _0x3c3c6c=_0x18b7dc===_0x3416f5['length']-0x1?_0x28ed39[_0x0b24('0x1c')]+_0x33ddba[_0x0b24('0x31')]+_0x480e4d[_0x0b24('0x31')]+0x2:_0x28ed39[_0x0b24('0x1c')]+_0x18b7dc+0x1;_0x33ddba[_0x0b24('0x38')](_0x18b7dc,0x0,{'type':_0x3ccbb4[_0x0b24('0x14')],'app':'GotoIfTime','appdata':_0x3416f5[_0x18b7dc]+'?'+_0x3ccbb4[_0x0b24('0x15')]+',${EXTEN},'+_0x492c18+':'+_0x3ccbb4[_0x0b24('0x15')]+_0x0b24('0x39')+_0x3c3c6c,'exten':_0x3ccbb4['exten'],'context':_0x3ccbb4['context'],'priority':_0x28ed39[_0x0b24('0x1c')]+_0x18b7dc,'VoiceExtensionId':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x16')]});}_0x3ccbb4['priority']=_0x33ddba[_0x0b24('0x31')]?_['last'](_0x33ddba)[_0x0b24('0x1c')]+0x1:_0x28ed39['priority'];_0x28ed39[_0x0b24('0x1c')]=(_0x480e4d[_0x0b24('0x31')]?_['last'](_0x480e4d)[_0x0b24('0x1c')]:_0x3ccbb4[_0x0b24('0x1c')])+0x1;_0x28ed39[_0x0b24('0xf')]=_[_0x0b24('0x3a')](_0x28ed39[_0x0b24('0xf')],_0x33ddba,[_0x3ccbb4],_0x480e4d);}_0x28ed39[_0x0b24('0xf')]['push']({'type':_0x27d44b[_0x3ed2b3][0x0]['type'],'app':_0x0b24('0x3b'),'exten':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0xe')],'context':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x15')],'priority':_0x28ed39[_0x0b24('0x1c')],'VoiceExtensionId':_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x16')]});_0x385410[_0x0b24('0x10')](_0x27d44b[_0x3ed2b3][0x0][_0x0b24('0x16')]);_0x109abf=_['concat'](_0x109abf,_0x28ed39[_0x0b24('0xf')]);}}return _0x1a79be[_0x0b24('0x3c')](function(_0x332fef){return _0x1a79be[_0x0b24('0x2')]['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x385410}},'transaction':_0x332fef})[_0x0b24('0x5')](function(_0x28ebbe){return _0x1a79be[_0x0b24('0x2')][_0x0b24('0x7')][_0x0b24('0x3d')](_[_0x0b24('0x3e')](_0x109abf,_0x0b24('0x1c')),{'transaction':_0x332fef});});});})[_0x0b24('0x3f')](function(_0xf70a4d){console[_0x0b24('0x40')](_0xf70a4d);});}exports[_0x0b24('0x41')]=rewrite; \ No newline at end of file +var _0x950a=['VoiceExtension','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','priority','extension','extensions','push','type','format','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','context','CDR(routeid)=','Set','CDR(prefix)=${EXTEN:0:','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','updatedAt','interval','IntervalId','map','hasOwnProperty','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','answer','indexOf','appType','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','catch','error','rewrite','lodash','util','findAll','then','intervals','models'];(function(_0x39d39d,_0x5586bd){var _0x577ac3=function(_0x12f9f2){while(--_0x12f9f2){_0x39d39d['push'](_0x39d39d['shift']());}};_0x577ac3(++_0x5586bd);}(_0x950a,0x174));var _0xa950=function(_0x1cbe9e,_0x270135){_0x1cbe9e=_0x1cbe9e-0x0;var _0x464350=_0x950a[_0x1cbe9e];return _0x464350;};'use strict';var _=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));function rewrite(_0x4e78f9,_0x4e4ab0){var _0x4738c5=this;return _0x4e78f9['models']['Interval'][_0xa950('0x2')]({'raw':!![]})[_0xa950('0x3')](function(_0x35f833){_0x4738c5[_0xa950('0x4')]=_0x35f833;return _0x4e78f9[_0xa950('0x5')][_0xa950('0x6')][_0xa950('0x2')]({'where':{'IntervalId':_0x4e4ab0['IntervalId']},'raw':!![]});})[_0xa950('0x3')](function(_0x11bd04){return _0x4e78f9[_0xa950('0x5')][_0xa950('0x6')][_0xa950('0x2')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x11bd04,'exten'))}},'order':[{'raw':_0xa950('0x7')}],'raw':!![]});})[_0xa950('0x3')](function(_0x7b8429){var _0xf1ac95=_[_0xa950('0x8')](_0x7b8429,{'priority':'1'});var _0x243496=_[_0xa950('0x8')](_0x7b8429,{'isApp':0x1});var _0x2cccf8=_[_0xa950('0x9')](_0x243496,_0xa950('0xa'));var _0x57329a=['queue','playback'];var _0x3297d5=[];var _0x420fdd=[];for(var _0x21ff25 in _0x2cccf8){if(_0x2cccf8['hasOwnProperty'](_0x21ff25)){_0x4738c5[_0xa950('0xb')]=0x2;_0x4738c5['extensions']=[];_0x4738c5[_0xa950('0xc')]=_['find'](_0xf1ac95,{'exten':_0x2cccf8[_0x21ff25][0x0][_0xa950('0xa')]});_0x4738c5[_0xa950('0xd')][_0xa950('0xe')]({'type':_0x2cccf8[_0x21ff25][0x0][_0xa950('0xf')],'app':'Set','appdata':util[_0xa950('0x10')]('CDR(type)=%s',_0x2cccf8[_0x21ff25][0x0][_0xa950('0xf')]),'context':_0x2cccf8[_0x21ff25][0x0]['context'],'exten':_0x2cccf8[_0x21ff25][0x0][_0xa950('0xa')],'priority':_0x4738c5[_0xa950('0xb')]++,'VoiceExtensionId':_0x2cccf8[_0x21ff25][0x0][_0xa950('0x11')]});if(_0x2cccf8[_0x21ff25][0x0]['type']===_0xa950('0x12')){if(_0x4738c5[_0xa950('0xc')]){_0x4738c5[_0xa950('0xd')][_0xa950('0xe')]({'type':_0x2cccf8[_0x21ff25][0x0]['type'],'app':'Set','appdata':_0xa950('0x13')+(_0x4738c5[_0xa950('0xc')][_0xa950('0x14')]?_0xa950('0x15')+_0x4738c5['extension'][_0xa950('0x14')]+'}':_0xa950('0x16')),'context':_0x2cccf8[_0x21ff25][0x0][_0xa950('0x17')],'exten':_0x2cccf8[_0x21ff25][0x0][_0xa950('0xa')],'priority':_0x4738c5[_0xa950('0xb')]++,'VoiceExtensionId':_0x2cccf8[_0x21ff25][0x0][_0xa950('0x11')]});}_0x4738c5[_0xa950('0xd')]['push']({'type':_0x2cccf8[_0x21ff25][0x0][_0xa950('0xf')],'app':'Set','appdata':_0xa950('0x18')+_0x2cccf8[_0x21ff25][0x0][_0xa950('0x11')],'context':_0x2cccf8[_0x21ff25][0x0][_0xa950('0x17')],'exten':_0x2cccf8[_0x21ff25][0x0]['exten'],'priority':_0x4738c5['priority']++,'VoiceExtensionId':_0x2cccf8[_0x21ff25][0x0][_0xa950('0x11')]});var _0x3b2732=_0x4738c5[_0xa950('0xb')]++;_0x4738c5[_0xa950('0xd')][_0xa950('0xe')]({'type':_0x2cccf8[_0x21ff25][0x0][_0xa950('0xf')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3b2732+0x2)+'):Goto('+(_0x3b2732+0x1)+')','context':_0x2cccf8[_0x21ff25][0x0][_0xa950('0x17')],'exten':_0x2cccf8[_0x21ff25][0x0][_0xa950('0xa')],'priority':_0x3b2732,'VoiceExtensionId':_0x2cccf8[_0x21ff25][0x0]['VoiceExtensionId']});if(_0x4738c5[_0xa950('0xc')]){_0x4738c5[_0xa950('0xd')][_0xa950('0xe')]({'type':_0x2cccf8[_0x21ff25][0x0][_0xa950('0xf')],'app':_0xa950('0x19'),'appdata':_0x4738c5[_0xa950('0xc')]['cutdigits']?_0xa950('0x1a')+_0x4738c5[_0xa950('0xc')][_0xa950('0x14')]+'}':'CDR(prefix)=noprefix','context':_0x2cccf8[_0x21ff25][0x0]['context'],'exten':_0x2cccf8[_0x21ff25][0x0][_0xa950('0xa')],'priority':_0x4738c5['priority']++,'VoiceExtensionId':_0x2cccf8[_0x21ff25][0x0][_0xa950('0x11')]});}_0x4738c5[_0xa950('0xd')][_0xa950('0xe')]({'type':_0x2cccf8[_0x21ff25][0x0][_0xa950('0xf')],'app':_0xa950('0x19'),'appdata':'outboundrouteid='+_0x2cccf8[_0x21ff25][0x0][_0xa950('0x11')],'context':_0x2cccf8[_0x21ff25][0x0]['context'],'exten':_0x2cccf8[_0x21ff25][0x0][_0xa950('0xa')],'priority':_0x4738c5[_0xa950('0xb')]++,'VoiceExtensionId':_0x2cccf8[_0x21ff25][0x0][_0xa950('0x11')]});if(_0x4738c5['extension']&&_0x4738c5[_0xa950('0xc')]['hasOwnProperty']('recordingFormat')&&_0x4738c5[_0xa950('0xc')][_0xa950('0x1b')]!==_0xa950('0x1c')){_0x4738c5[_0xa950('0xd')][_0xa950('0xe')]({'type':_0x2cccf8[_0x21ff25][0x0][_0xa950('0xf')],'app':_0xa950('0x19'),'appdata':_0xa950('0x1d'),'context':_0x2cccf8[_0x21ff25][0x0][_0xa950('0x17')],'exten':_0x2cccf8[_0x21ff25][0x0][_0xa950('0xa')],'priority':_0x4738c5[_0xa950('0xb')]++,'VoiceExtensionId':_0x2cccf8[_0x21ff25][0x0]['VoiceExtensionId']});_0x4738c5[_0xa950('0xd')][_0xa950('0xe')]({'type':_0x2cccf8[_0x21ff25][0x0][_0xa950('0xf')],'app':'Set','appdata':_0xa950('0x1e')+_0x4738c5[_0xa950('0xc')][_0xa950('0x1b')]||_0xa950('0x1f'),'context':_0x2cccf8[_0x21ff25][0x0][_0xa950('0x17')],'exten':_0x2cccf8[_0x21ff25][0x0][_0xa950('0xa')],'priority':_0x4738c5[_0xa950('0xb')]++,'VoiceExtensionId':_0x2cccf8[_0x21ff25][0x0][_0xa950('0x11')]});}}_0x4738c5[_0xa950('0xd')]['push']({'type':_0x2cccf8[_0x21ff25][0x0]['type'],'app':_0xa950('0x19'),'appdata':_0xa950('0x20'),'context':_0x2cccf8[_0x21ff25][0x0][_0xa950('0x17')],'exten':_0x2cccf8[_0x21ff25][0x0]['exten'],'priority':_0x4738c5[_0xa950('0xb')]++,'VoiceExtensionId':_0x2cccf8[_0x21ff25][0x0]['VoiceExtensionId']});_0x4738c5['extensions'][_0xa950('0xe')]({'type':_0x2cccf8[_0x21ff25][0x0][_0xa950('0xf')],'app':'Set','appdata':_0xa950('0x21'),'context':_0x2cccf8[_0x21ff25][0x0][_0xa950('0x17')],'exten':_0x2cccf8[_0x21ff25][0x0][_0xa950('0xa')],'priority':_0x4738c5[_0xa950('0xb')]++,'VoiceExtensionId':_0x2cccf8[_0x21ff25][0x0]['VoiceExtensionId']});_0x4738c5[_0xa950('0xd')][_0xa950('0xe')]({'type':_0x2cccf8[_0x21ff25][0x0]['type'],'app':'Set','appdata':_0xa950('0x22'),'context':_0x2cccf8[_0x21ff25][0x0][_0xa950('0x17')],'exten':_0x2cccf8[_0x21ff25][0x0][_0xa950('0xa')],'priority':_0x4738c5[_0xa950('0xb')]++,'VoiceExtensionId':_0x2cccf8[_0x21ff25][0x0]['VoiceExtensionId']});for(var _0x5345bd=0x0,_0x250f5f=0x0;_0x5345bd<_0x2cccf8[_0x21ff25][_0xa950('0x23')];_0x5345bd+=0x1,_0x250f5f=0x0){var _0x1f999a=_0x2cccf8[_0x21ff25][_0x5345bd];if(_0x1f999a[_0xa950('0xf')]){_0x1f999a['type']=_0x1f999a[_0xa950('0xf')]['toLowerCase']();}var _0x4fdfd9=[];var _0x521651=[];delete _0x1f999a['id'];delete _0x1f999a['createdAt'];delete _0x1f999a[_0xa950('0x24')];var _0x30b8e3=_0x1f999a[_0xa950('0x25')]!=='*,*,*,*'?[_0x1f999a[_0xa950('0x25')]]:_0x1f999a[_0xa950('0x26')]?_[_0xa950('0x27')](_[_0xa950('0x8')](_0x4738c5[_0xa950('0x4')],{'IntervalId':_0x1f999a[_0xa950('0x26')]}),_0xa950('0x25')):[];if(_0x1f999a[_0xa950('0x28')](_0xa950('0x29'))){if(_0x1f999a[_0xa950('0x29')]&&_0x1f999a[_0xa950('0x29')]!=='--'){_0x4fdfd9['push']({'type':_0x1f999a[_0xa950('0xf')],'app':_0xa950('0x19'),'appdata':_0xa950('0x2a')+_0x1f999a[_0xa950('0x29')],'context':_0x1f999a['context'],'exten':_0x1f999a[_0xa950('0xa')],'priority':_0x30b8e3[_0xa950('0x23')]+_0x4738c5[_0xa950('0xb')]+_0x250f5f++,'VoiceExtensionId':_0x1f999a[_0xa950('0x11')]});}}if(_0x1f999a[_0xa950('0xf')]==='outbound'&&_0x1f999a[_0xa950('0x28')]('callerID')){if(_0x1f999a['callerID']){_0x4fdfd9[_0xa950('0xe')]({'type':_0x1f999a[_0xa950('0xf')],'app':_0xa950('0x2b'),'appdata':_0xa950('0x2c')+_0x1f999a[_0xa950('0x2d')]+')','context':_0x1f999a[_0xa950('0x17')],'exten':_0x1f999a[_0xa950('0xa')],'priority':_0x30b8e3['length']+_0x4738c5[_0xa950('0xb')]+_0x250f5f++,'VoiceExtensionId':_0x1f999a['VoiceExtensionId']});}else{_0x4fdfd9[_0xa950('0xe')]({'type':_0x1f999a[_0xa950('0xf')],'app':_0xa950('0x2b'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x1f999a[_0xa950('0x17')],'exten':_0x1f999a[_0xa950('0xa')],'priority':_0x30b8e3[_0xa950('0x23')]+_0x4738c5['priority']+_0x250f5f++,'VoiceExtensionId':_0x1f999a[_0xa950('0x11')]});}}if(_0x1f999a[_0xa950('0x28')](_0xa950('0x2e'))){if(_0x57329a[_0xa950('0x2f')](_0x1f999a['app']['toLowerCase']())>=0x0&&_0x1f999a[_0xa950('0x30')]!==_0xa950('0x31')){if(_0x1f999a[_0xa950('0x2e')]){_0x4fdfd9[_0xa950('0xe')]({'type':_0x1f999a[_0xa950('0xf')],'app':_0xa950('0x2b'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x1f999a[_0xa950('0x17')],'exten':_0x1f999a[_0xa950('0xa')],'priority':_0x30b8e3[_0xa950('0x23')]+_0x4738c5['priority']+_0x250f5f++,'VoiceExtensionId':_0x1f999a[_0xa950('0x11')]});_0x4fdfd9['push']({'type':_0x1f999a[_0xa950('0xf')],'app':'Set','appdata':_0xa950('0x32'),'context':_0x1f999a['context'],'exten':_0x1f999a[_0xa950('0xa')],'priority':_0x30b8e3[_0xa950('0x23')]+_0x4738c5['priority']+_0x250f5f++,'VoiceExtensionId':_0x1f999a[_0xa950('0x11')]});}else{_0x4fdfd9[_0xa950('0xe')]({'type':_0x1f999a[_0xa950('0xf')],'app':_0xa950('0x2b'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x1f999a['context'],'exten':_0x1f999a['exten'],'priority':_0x30b8e3[_0xa950('0x23')]+_0x4738c5[_0xa950('0xb')]+_0x250f5f++,'VoiceExtensionId':_0x1f999a[_0xa950('0x11')]});_0x4fdfd9[_0xa950('0xe')]({'type':_0x1f999a[_0xa950('0xf')],'app':_0xa950('0x19'),'appdata':_0xa950('0x33'),'context':_0x1f999a[_0xa950('0x17')],'exten':_0x1f999a['exten'],'priority':_0x30b8e3['length']+_0x4738c5['priority']+_0x250f5f++,'VoiceExtensionId':_0x1f999a[_0xa950('0x11')]});}}}for(var _0x396c2d=0x0;_0x396c2d<_0x30b8e3[_0xa950('0x23')];_0x396c2d+=0x1){var _0x39fb4b=_0x4738c5[_0xa950('0xb')]+_0x30b8e3[_0xa950('0x23')];var _0x45cea7=_0x396c2d===_0x30b8e3['length']-0x1?_0x4738c5[_0xa950('0xb')]+_0x4fdfd9[_0xa950('0x23')]+_0x521651[_0xa950('0x23')]+0x2:_0x4738c5[_0xa950('0xb')]+_0x396c2d+0x1;_0x4fdfd9[_0xa950('0x34')](_0x396c2d,0x0,{'type':_0x1f999a['type'],'app':_0xa950('0x35'),'appdata':_0x30b8e3[_0x396c2d]+'?'+_0x1f999a[_0xa950('0x17')]+',${EXTEN},'+_0x39fb4b+':'+_0x1f999a[_0xa950('0x17')]+_0xa950('0x36')+_0x45cea7,'exten':_0x1f999a[_0xa950('0xa')],'context':_0x1f999a['context'],'priority':_0x4738c5['priority']+_0x396c2d,'VoiceExtensionId':_0x2cccf8[_0x21ff25][0x0]['VoiceExtensionId']});}_0x1f999a[_0xa950('0xb')]=_0x4fdfd9['length']?_[_0xa950('0x37')](_0x4fdfd9)[_0xa950('0xb')]+0x1:_0x4738c5[_0xa950('0xb')];_0x4738c5[_0xa950('0xb')]=(_0x521651[_0xa950('0x23')]?_[_0xa950('0x37')](_0x521651)[_0xa950('0xb')]:_0x1f999a[_0xa950('0xb')])+0x1;_0x4738c5['extensions']=_[_0xa950('0x38')](_0x4738c5[_0xa950('0xd')],_0x4fdfd9,[_0x1f999a],_0x521651);}_0x4738c5[_0xa950('0xd')][_0xa950('0xe')]({'type':_0x2cccf8[_0x21ff25][0x0]['type'],'app':_0xa950('0x39'),'exten':_0x2cccf8[_0x21ff25][0x0][_0xa950('0xa')],'context':_0x2cccf8[_0x21ff25][0x0][_0xa950('0x17')],'priority':_0x4738c5[_0xa950('0xb')],'VoiceExtensionId':_0x2cccf8[_0x21ff25][0x0][_0xa950('0x11')]});_0x3297d5[_0xa950('0xe')](_0x2cccf8[_0x21ff25][0x0]['VoiceExtensionId']);_0x420fdd=_[_0xa950('0x38')](_0x420fdd,_0x4738c5[_0xa950('0xd')]);}}return _0x4e78f9['transaction'](function(_0x7f6f69){return _0x4e78f9['models']['VoiceExtension'][_0xa950('0x3a')]({'where':{'VoiceExtensionId':{'$in':_0x3297d5}},'transaction':_0x7f6f69})[_0xa950('0x3')](function(_0x52b7fa){return _0x4e78f9[_0xa950('0x5')][_0xa950('0x6')][_0xa950('0x3b')](_['sortBy'](_0x420fdd,'priority'),{'transaction':_0x7f6f69});});});})[_0xa950('0x3c')](function(_0x37c7f9){console[_0xa950('0x3d')](_0x37c7f9);});}exports[_0xa950('0x3e')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 8ec12c7..43aabb5 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate'];(function(_0xc875d7,_0x283704){var _0x24bb2c=function(_0x575a01){while(--_0x575a01){_0xc875d7['push'](_0xc875d7['shift']());}};_0x24bb2c(++_0x283704);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file +var _0xbaf0=['YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','into','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','fromQuery','cm_contacts','str','cm_hopper_final','\x20=\x20?','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','onlyIfOpen','catch','all','BlackLists','get','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','duplicate','pause','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate'];(function(_0x152f66,_0x41999b){var _0x41e408=function(_0xc56ca4){while(--_0xc56ca4){_0x152f66['push'](_0x152f66['shift']());}};_0x41e408(++_0x41999b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var BPromise=require('bluebird');var util=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var fs=require('fs');var squel=require(_0x0baf('0x2'));var Papa=require(_0x0baf('0x3'));var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));config[_0x0baf('0x8')]=_[_0x0baf('0x9')](config[_0x0baf('0x8')],{'host':_0x0baf('0xa'),'port':0x18eb});var socket=require(_0x0baf('0xb'))(new Redis(config[_0x0baf('0x8')]));require(_0x0baf('0xc'))['register'](socket);try{if(!process[_0x0baf('0xd')][0x2]||process['argv'][0x2]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x2]===_0x0baf('0xf')){throw new Error(_0x0baf('0x10'));}var FILEPATH=process[_0x0baf('0xd')][0x2];if(!process[_0x0baf('0xd')][0x3]||process[_0x0baf('0xd')][0x3]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x3]===_0x0baf('0xf')||!process[_0x0baf('0xd')][0x4]||process['argv'][0x4]==='undefined'||process[_0x0baf('0xd')][0x4]===_0x0baf('0xf')){throw new Error(_0x0baf('0x11'));}var FIELDS=_[_0x0baf('0x12')](process['argv'][0x3][_0x0baf('0x13')](','),process['argv'][0x4][_0x0baf('0x13')](','));if(!process[_0x0baf('0xd')][0x5]||process[_0x0baf('0xd')][0x5]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x5]===_0x0baf('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x0baf('0xd')][0x6]&&process[_0x0baf('0xd')][0x6]!==_0x0baf('0xe')&&process[_0x0baf('0xd')][0x6]!==_0x0baf('0xf')?process[_0x0baf('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x0baf('0xd')][0x7]!==_0x0baf('0xe')&&process[_0x0baf('0xd')][0x7]!==_0x0baf('0xf')?process[_0x0baf('0xd')][0x7]:null;if(!process[_0x0baf('0xd')][0x8]||process['argv'][0x8]==='undefined'||process[_0x0baf('0xd')][0x8]===_0x0baf('0xf')){throw new Error(_0x0baf('0x14'));}var SOCKET_TIMESTAMP=process[_0x0baf('0xd')][0x8];}catch(_0x1fa92b){logger[_0x0baf('0x15')](_0x1fa92b);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(_0x210cd8,_0x636a13,_0x2c42e2,_0x15a2c3){var _0x54f2fa={'message':_0x636a13};_0x54f2fa[_0x210cd8]=!![];if(_0x2c42e2){_0x54f2fa[_0x0baf('0x16')]=_0x2c42e2;}if(_0x15a2c3){_0x54f2fa['index']=_0x15a2c3;}return _0x54f2fa;}function isEmail(_0xf6c158){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0xf6c158);}function checkRow(_0x4de74c,_0x2ef0aa,_0x48a0e9){return new BPromise(function(_0x4be1b9,_0x47c4b){if(_[_0x0baf('0x17')](_0x4de74c)){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x18'),null,_0x48a0e9));}if(_0x4de74c[_0x0baf('0x19')]&&_0x4de74c['errors'][_0x0baf('0x1a')]){var _0x4681c5=_[_0x0baf('0x1b')](_0x4de74c[_0x0baf('0x19')],_0x0baf('0x1c'))[_0x0baf('0x1d')](';');return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x4681c5,null,_0x48a0e9));}var _0x549fd0={};for(var _0x1590b4 in FIELDS){if(FIELDS[_0x0baf('0x1e')](_0x1590b4)&&FIELDS[_0x1590b4]){_0x549fd0[_0x1590b4]=_0x4de74c[_0x0baf('0x1f')][0x0][FIELDS[_0x1590b4]]||_0x4de74c[_0x0baf('0x1f')][0x0]['\ufeff'+FIELDS[_0x1590b4]];}}if(!_0x549fd0['firstName']){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x20'),null,_0x48a0e9));}if(!_0x549fd0['phone']){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x21'),null,_0x48a0e9));}if(_0x549fd0[_0x0baf('0x22')]){var _0xb4dbb1=moment(_0x549fd0[_0x0baf('0x22')],_0x0baf('0x23'));if(!_0xb4dbb1[_0x0baf('0x24')]()){return _0x47c4b(handleCheckRowError('error',_0x0baf('0x25'),null,_0x48a0e9));}}if(_0x549fd0[_0x0baf('0x26')]){if(!isEmail(_0x549fd0[_0x0baf('0x26')])){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x27'),null,_0x48a0e9));}}_0x549fd0[_0x0baf('0x28')]=LISTID;_0x549fd0[_0x0baf('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0baf('0x1a')]&&_0x2ef0aa){var _0x59431b={};for(var _0x3ded64=0x0,_0x2adfd7=DUPLICATES[_0x0baf('0x1a')];_0x3ded64<_0x2adfd7;_0x3ded64+=0x1){_0x59431b[DUPLICATES[_0x3ded64]]=_0x549fd0[DUPLICATES[_0x3ded64]];}var _0x45294a=_[_0x0baf('0x2a')](_0x2ef0aa,_0x59431b);if(_0x45294a){return _0x47c4b(handleCheckRowError('duplicate',_0x0baf('0x2b'),_0x45294a,_0x48a0e9));}}return db['CmContact'][_0x0baf('0x2c')](_0x549fd0,{'raw':!![],'hooks':![],'fields':_[_0x0baf('0x2d')](_0x549fd0)})[_0x0baf('0x2e')](function(_0x3d65f2){if(DUPLICATES&&DUPLICATES['length']&&_0x2ef0aa){_0x2ef0aa[_0x0baf('0x2f')](_[_0x0baf('0x30')](_0x549fd0,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3d65f2['id'];return _0x4be1b9();})['catch'](function(_0x23d890){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x31')+(_0x23d890[_0x0baf('0x1c')]||JSON[_0x0baf('0x32')](_0x23d890)),null,_0x48a0e9));});});}function checkHopper(){function _0x1b0991(){return function(_0xe03d82){logger[_0x0baf('0x15')]('cmContact',_0x0baf('0x33'),util[_0x0baf('0x34')](_0xe03d82,{'showHidden':![],'depth':null}));};}var _0x5b991f=function(_0x32c022,_0x57783c){var _0x5c545f=squel[_0x0baf('0x35')]()[_0x0baf('0x36')]('cm_hopper')['fromQuery']([_0x0baf('0x37'),_0x0baf('0x38'),_0x0baf('0x39'),_0x0baf('0x28'),_0x57783c,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),_0x0baf('0x37'))[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x38'))[_0x0baf('0x3d')]('id','ContactId')[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),'ListId')[_0x0baf('0x3d')](_0x32c022['id'][_0x0baf('0x3f')](),_0x57783c)[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3a'))[_0x0baf('0x3d')]('NOW()',_0x0baf('0x3b'))[_0x0baf('0x40')]('cm_contacts')[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')](_0x0baf('0x43'),LISTID['toString']())[_0x0baf('0x41')](_0x0baf('0x44'))[_0x0baf('0x41')](_0x0baf('0x45'),squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'))[_0x0baf('0x40')](_0x0baf('0x46'))[_0x0baf('0x41')](_0x57783c+'\x20=\x20?',_0x32c022['id'][_0x0baf('0x3f')]())))[_0x0baf('0x3f')]();return _0x5c545f;};var _0x1daf1d=function(_0x339aff,_0x22207a){var _0x55f4f8=squel[_0x0baf('0x35')]()[_0x0baf('0x36')](_0x0baf('0x46'))[_0x0baf('0x47')]([_0x0baf('0x37'),'scheduledAt',_0x0baf('0x39'),_0x0baf('0x28'),_0x22207a,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),'phone')[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x38'))['field']('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),_0x0baf('0x28'))[_0x0baf('0x3d')](_0x339aff['id'][_0x0baf('0x3f')](),_0x22207a)[_0x0baf('0x3d')]('NOW()',_0x0baf('0x3a'))[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')](_0x0baf('0x43'),LISTID[_0x0baf('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44'))[_0x0baf('0x41')](_0x0baf('0x45'),squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')]('calleridnum')[_0x0baf('0x40')](_0x0baf('0x4a'))[_0x0baf('0x41')](_0x22207a+_0x0baf('0x4b'),_0x339aff['id'][_0x0baf('0x3f')]()))[_0x0baf('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0baf('0x3c')]()['field'](_0x0baf('0x37'))['from'](_0x0baf('0x46'))['where'](_0x22207a+_0x0baf('0x4b'),_0x339aff['id']['toString']())))[_0x0baf('0x3f')]();return _0x55f4f8;};function _0xcf7b8d(_0x411c1f,_0x4520d1){var _0x42a68b=squel['insert']()[_0x0baf('0x36')](_0x0baf('0x46'))[_0x0baf('0x47')]([_0x0baf('0x37'),_0x0baf('0x38'),_0x0baf('0x39'),'ListId',_0x4520d1,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),_0x0baf('0x37'))[_0x0baf('0x3d')]('NOW()','scheduledAt')[_0x0baf('0x3d')]('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),_0x0baf('0x28'))[_0x0baf('0x3d')](_0x411c1f['id'][_0x0baf('0x3f')](),_0x4520d1)[_0x0baf('0x3d')](_0x0baf('0x3e'),'createdAt')[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))['where'](_0x0baf('0x43'),LISTID[_0x0baf('0x3f')]())[_0x0baf('0x41')](_0x0baf('0x4c'),squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44')))[_0x0baf('0x3f')]();return _0x42a68b;}function _0x498405(_0x178495,_0x5dc434){var _0x3c00e7=squel['insert']()['into'](_0x0baf('0x4d'))['fromQuery']([_0x0baf('0x37'),_0x0baf('0x39'),'ListId',_0x5dc434,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()['field']('phone',_0x0baf('0x37'))[_0x0baf('0x3d')]('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),'ListId')[_0x0baf('0x3d')](_0x178495['id']['toString'](),_0x5dc434)['field']('NOW()',_0x0baf('0x3a'))['field']('NOW()',_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')]('ListId\x20=\x20?',LISTID[_0x0baf('0x3f')]())[_0x0baf('0x41')](_0x0baf('0x4c'),squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44')))['toString']();return _0x3c00e7;}return db[_0x0baf('0x4e')][_0x0baf('0x4f')]({'where':{'type':_0x0baf('0x50')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x0baf('0x51')],'as':_0x0baf('0x52'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x2c20fe){var _0x125906=[];if(_0x2c20fe){var _0x27a959;for(var _0x4cc046=0x0,_0x5874cc;_0x4cc046<_0x2c20fe['length'];_0x4cc046+=0x1){_0x5874cc=_0x2c20fe[_0x4cc046]['get']({'plain':!![]});switch(_0x5874cc[_0x0baf('0x53')]){case _0x0baf('0x54'):_0x125906[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x1daf1d(_0x5874cc,_0x0baf('0x57')))['then'](function(){})['catch'](_0x1b0991()));break;case _0x0baf('0x58'):_0x125906['push'](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x5b991f(_0x5874cc,'VoiceQueueId'))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));break;default:_0x125906[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0xcf7b8d(_0x5874cc,_0x0baf('0x57')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}}return _0x125906;})[_0x0baf('0x5a')]()['then'](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0baf('0x5b'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x333b07){var _0x20a514=[];if(_0x333b07){var _0x5093f5;for(var _0x1be7f2=0x0,_0x410f6c;_0x1be7f2<_0x333b07['length'];_0x1be7f2+=0x1){_0x410f6c=_0x333b07[_0x1be7f2]['get']({'plain':!![]});_0x20a514[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x498405(_0x410f6c,_0x0baf('0x57')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}return _0x20a514;})[_0x0baf('0x5a')]();})[_0x0baf('0x2e')](function(){return db['Campaign'][_0x0baf('0x4f')]({'attributes':['id',_0x0baf('0x53')],'include':[{'model':db['CmList'],'as':_0x0baf('0x52'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x538f24){var _0x97d385=[];if(_0x538f24){for(var _0x4043d5=0x0,_0x421ca0;_0x4043d5<_0x538f24[_0x0baf('0x1a')];_0x4043d5+=0x1){_0x421ca0=_0x538f24[_0x4043d5][_0x0baf('0x5c')]({'plain':!![]});switch(_0x421ca0['dialCheckDuplicateType']){case'always':_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')]['query'](_0x1daf1d(_0x421ca0,_0x0baf('0x5d')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));break;case'onlyIfOpen':_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x5b991f(_0x421ca0,'CampaignId'))[_0x0baf('0x2e')](function(){})['catch'](_0x1b0991()));break;default:_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0xcf7b8d(_0x421ca0,_0x0baf('0x5d')))[_0x0baf('0x2e')](function(){})['catch'](_0x1b0991()));}}}return _0x97d385;})[_0x0baf('0x5a')]();})[_0x0baf('0x2e')](function(){return db['Campaign'][_0x0baf('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x0baf('0x51')],'as':_0x0baf('0x5b'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x1cbbcc){var _0x250df2=[];if(_0x1cbbcc){for(var _0xa4fd1b=0x0,_0x1cda78;_0xa4fd1b<_0x1cbbcc[_0x0baf('0x1a')];_0xa4fd1b+=0x1){_0x1cda78=_0x1cbbcc[_0xa4fd1b][_0x0baf('0x5c')]({'plain':!![]});_0x250df2[_0x0baf('0x2f')](db[_0x0baf('0x55')]['query'](_0x498405(_0x1cda78,'CampaignId'))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}return _0x250df2;})[_0x0baf('0x5a')]();})['catch'](function(_0x507783){logger[_0x0baf('0x15')](_0x0baf('0x5e'),_0x0baf('0x5f'),_0x507783[_0x0baf('0x1c')]);});}var processPromises=function(_0x2dcdfe){return BPromise[_0x0baf('0x5a')](promises)[_0x0baf('0x2e')](function(_0xa2d315){})[_0x0baf('0x59')](function(_0x4e8e85){logger[_0x0baf('0x15')](_0x0baf('0x60'),JSON[_0x0baf('0x32')](_0x4e8e85));})[_0x0baf('0x61')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2dcdfe){return _0x2dcdfe['resume']();}});};var endCsv=function(){return BPromise[_0x0baf('0x62')]()[_0x0baf('0x2e')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x0baf('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0baf('0x64')](FILEPATH);}catch(_0x52e0c4){logger[_0x0baf('0x15')](_0x0baf('0x65'),JSON[_0x0baf('0x32')](_0x52e0c4));}finally{process[_0x0baf('0x66')](0x0);}});};process['on'](_0x0baf('0x67'),function(){logger[_0x0baf('0x68')](_0x0baf('0x69'));endCsv();});function main(){return BPromise[_0x0baf('0x62')]()[_0x0baf('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0baf('0x13')](',');return db[_0x0baf('0x6a')][_0x0baf('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1ed607){var _0xd0f63b=fs[_0x0baf('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0baf('0x6c')](_0xd0f63b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3c37b4,_0x195303){total+=0x1;var _0x49d411=total;promises[_0x0baf('0x2f')](checkRow(_0x3c37b4,_0x1ed607,_0x49d411)[_0x0baf('0x2e')](function(){success+=0x1;})[_0x0baf('0x59')](function(_0x457ae8){if(_0x457ae8[_0x0baf('0x15')]){errors+=0x1;delete _0x457ae8['error'];}else if(_0x457ae8[_0x0baf('0x6d')]){duplicates+=0x1;delete _0x457ae8[_0x0baf('0x6d')];}rows[_0x0baf('0x2f')](_0x457ae8);}));if(total%0xc8===0x0){_0x195303[_0x0baf('0x6e')]();return processPromises(_0x195303);}},'complete':function(){return processPromises()[_0x0baf('0x2e')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0xb5f4e5,_0x5a2454){logger[_0x0baf('0x68')]('CSV\x20parse\x20error',JSON[_0x0baf('0x32')](_0xb5f4e5));endCsv();}});})[_0x0baf('0x59')](function(_0x1ce7bb){logger[_0x0baf('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x0baf('0x32')](_0x1ce7bb));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 17551ef..2991657 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 _0x71db=['cm_contacts.phone\x20NOT\x20IN\x20(?)','field','ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','info','Received\x20SIGINT','error','message','errors','push','sequelize','query','spread','main','send','start','binding','root','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','length','rows','hasOwnProperty','trim','data','replace','scheduledat','isValid','isNaN','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','format','isNil',',\x20scheduledAt\x20=\x20NOW()','voice_queues','VoiceQueueId','CampaignId','each','finish','affectedRows','unlink','exit','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','localhost','YYYY-MM-DD\x20HH:mm:ss','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','updatedAt','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','\x22always\x22','toString','cm_contacts.createdAt','cm_contacts.updatedAt','cm_hopper_black','ContactId','ListId','cm_contacts.createdAt\x20=\x20?'];(function(_0x5cd5f3,_0x41493c){var _0xd73c5c=function(_0xac6b87){while(--_0xac6b87){_0x5cd5f3['push'](_0x5cd5f3['shift']());}};_0xd73c5c(++_0x41493c);}(_0x71db,0x146));var _0xb71d=function(_0x2a0fc4,_0x2eaf74){_0x2a0fc4=_0x2a0fc4-0x0;var _0x531d00=_0x71db[_0x2a0fc4];return _0x531d00;};'use strict';var fs=require('fs');var path=require(_0xb71d('0x0'));var _=require('lodash');var Papa=require(_0xb71d('0x1'));var util=require(_0xb71d('0x2'));var BPromise=require(_0xb71d('0x3'));var moment=require(_0xb71d('0x4'));var squel=require(_0xb71d('0x5'));var Redis=require(_0xb71d('0x6'));var db=require(_0xb71d('0x7'))['db'];var config=require(_0xb71d('0x8'));var logger=require('../../../config/logger')(_0xb71d('0x9'));config[_0xb71d('0xa')]=_[_0xb71d('0xb')](config[_0xb71d('0xa')],{'host':_0xb71d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb71d('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0xb71d('0xd'));function isEmail(_0x56a455){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x56a455);}function selectNotIn(_0x2c4bde,_0x2a00b9,_0x40c614,_0x57c51a,_0xdd1efe){return squel[_0xb71d('0xe')]()['field'](_0xb71d('0xf'))[_0xb71d('0x10')](_0x57c51a)[_0xb71d('0x11')](_0x2a00b9,null,_0x2a00b9+_0xb71d('0x12')+_0x57c51a+'.'+_0x40c614)[_0xb71d('0x13')](_0x57c51a+'.'+_0x40c614+_0xb71d('0x14')+_0x2c4bde+'.'+_0x40c614)['where'](_0x2a00b9+'.dialCheckDuplicateType\x20IN\x20('+_0xdd1efe[_0xb71d('0x11')]()+')');}function insertCmHopper(_0x2f8e03,_0xa8c7aa,_0x11866e,_0x1f3c15,_0x45b306){var _0x2ed7ad=[_0xb71d('0x15'),'cm_contacts.scheduledat',_0xb71d('0x16'),_0xb71d('0x17'),_0xa8c7aa+'.'+_0x1f3c15,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xb71d('0x18'),_0xb71d('0x19'),'\x22'+_0x45b306+'\x22'];return squel[_0xb71d('0x1a')]()[_0xb71d('0x1b')](_0xb71d('0x1c'))[_0xb71d('0x1d')](['phone','scheduledat','ContactId','ListId',_0x1f3c15,'createdAt',_0xb71d('0x1e'),_0xb71d('0x1f'),_0xb71d('0x20'),'recallme'],squel[_0xb71d('0xe')]()[_0xb71d('0x21')](_0x2ed7ad)[_0xb71d('0x10')](_0xa8c7aa)[_0xb71d('0x11')](_0xb71d('0x22'),null,_0xb71d('0x23')+_0xa8c7aa+_0xb71d('0x24'))[_0xb71d('0x11')](_0x11866e,null,_0x11866e+_0xb71d('0x12')+_0xa8c7aa+'.'+_0x1f3c15)[_0xb71d('0x13')](_0xa8c7aa+_0xb71d('0x25'),_0x2f8e03)[_0xb71d('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb71d('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xa8c7aa,_0x11866e,_0x1f3c15,'cm_hopper',[_0xb71d('0x26'),'\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xa8c7aa,_0x11866e,_0x1f3c15,'cm_hopper',[_0xb71d('0x26')])))[_0xb71d('0x27')]();}function insertCmHopperBlack(_0x4e0832,_0x4f0060,_0x49523b,_0x4164fe){var _0x543f31=[_0xb71d('0x15'),_0xb71d('0x16'),_0xb71d('0x17'),_0x4f0060+'.'+_0x4164fe,_0xb71d('0x28'),_0xb71d('0x29')];return squel[_0xb71d('0x1a')]()[_0xb71d('0x1b')](_0xb71d('0x2a'))[_0xb71d('0x1d')]([_0xb71d('0xf'),_0xb71d('0x2b'),_0xb71d('0x2c'),_0x4164fe,'createdAt','updatedAt'],squel[_0xb71d('0xe')]()[_0xb71d('0x21')](_0x543f31)[_0xb71d('0x10')](_0x4f0060)[_0xb71d('0x11')](_0xb71d('0x22'),null,_0xb71d('0x23')+_0x4f0060+_0xb71d('0x24'))[_0xb71d('0x11')](_0x49523b,null,_0x49523b+_0xb71d('0x12')+_0x4f0060+'.'+_0x4164fe)[_0xb71d('0x13')](_0x4f0060+_0xb71d('0x25'),_0x4e0832)[_0xb71d('0x13')](_0xb71d('0x2d'),NOW)['where'](_0xb71d('0x2e'),squel['select']()[_0xb71d('0x2f')](_0xb71d('0xf'))[_0xb71d('0x10')](_0xb71d('0x2a'))[_0xb71d('0x13')](_0xb71d('0x30'),_0x4e0832)[_0xb71d('0x13')](_0x4164fe+'\x20=\x20?',_0x4f0060+'.'+_0x4164fe)))['toString']();}function insertCmContact(_0x1dc4e6,_0x7b4386,_0x514f6e,_0xbef522){var _0x360604=_[_0xb71d('0x31')](_[_0xb71d('0x32')](_0xbef522),['ListId',_0xb71d('0x33'),'createdAt',_0xb71d('0x1e')]);return squel[_0xb71d('0x1a')]()[_0xb71d('0x1b')]('cm_contacts')[_0xb71d('0x1d')](_0x360604,squel[_0xb71d('0xe')]()[_0xb71d('0x21')](_0x360604)[_0xb71d('0x10')](_0x7b4386)['where']('('+_0x514f6e['join'](',')+_0xb71d('0x34'),squel[_0xb71d('0xe')]()[_0xb71d('0x21')](_0x514f6e)[_0xb71d('0x10')](_0xb71d('0x22'))[_0xb71d('0x13')](_0xb71d('0x30'),_0x1dc4e6)[_0xb71d('0x13')](_0xb71d('0x35')))['where']('id\x20IN\x20?',squel['select']()[_0xb71d('0x2f')](_0xb71d('0x36'),'min_id')[_0xb71d('0x10')](_0x7b4386)['group'](_0x514f6e['join'](','))))[_0xb71d('0x27')]();}function handleStop(){logger[_0xb71d('0x37')](_0xb71d('0x38'));stopped=!![];}function handleUncaughtException(_0x204e26){logger[_0xb71d('0x39')](_0x204e26[_0xb71d('0x3a')]);process['exit'](0x1);}function handleError(_0x45bd80,_0x441abf){stats[_0xb71d('0x3b')][_0xb71d('0x3c')]({'name':_0x441abf['code'],'message':_0x441abf[_0xb71d('0x3a')],'row':_0x45bd80});}function handleQuery(_0x56c12b){logger['info'](_0x56c12b);return db[_0xb71d('0x3d')][_0xb71d('0x3e')](_0x56c12b)[_0xb71d('0x3f')](function(_0x45766d){results[_0xb71d('0x3c')](_0x45766d);})['catch'](function(_0x579a2e){logger[_0xb71d('0x39')](_0x579a2e[_0xb71d('0x3a')]);});}function main(_0x20086a,_0x50f497,_0x48edf6,_0x54ac12){logger[_0xb71d('0x37')](_0xb71d('0x40'),_0x20086a,JSON['stringify'](_0x50f497));process[_0xb71d('0x41')](_0xb71d('0x42'));var _0x3c8aa1=_0x50f497[_0xb71d('0x43')];var _0x347a78=_0x50f497['socket_timestamp'];var _0x3ed776=path[_0xb71d('0x11')](config[_0xb71d('0x44')],_0xb71d('0x45'),_0x347a78+_0xb71d('0x46'));var _0x3ae23b=_[_0xb71d('0x32')](_0x3c8aa1)[_0xb71d('0x11')]();logger[_0xb71d('0x37')](_0xb71d('0x47'),_0x3ae23b);fs[_0xb71d('0x48')](_0x3ed776,_0x3ae23b+'\x0a');Papa[_0xb71d('0x49')](fs[_0xb71d('0x4a')](_0x20086a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x510f71,_0x4afb7b){try{for(var _0x409aa6=0x0,_0x4fe093=[];_0x409aa6<_0x510f71['data'][_0xb71d('0x4b')];_0x409aa6++){stats[_0xb71d('0x4c')]+=0x1;if(_0x510f71[_0xb71d('0x3b')][_0x409aa6]){handleError(_0x510f71['data'][_0x409aa6],_0x510f71[_0xb71d('0x3b')][_0x409aa6]);}else{var _0x57fe44=[];for(var _0x1608ca in _0x3c8aa1){if(_0x3c8aa1[_0xb71d('0x4d')](_0x1608ca)){if(_0x510f71['data'][_0x409aa6][_0x3c8aa1[_0x1608ca]]){var _0x5eb766=_[_0xb71d('0x4e')](_0x510f71[_0xb71d('0x4f')][_0x409aa6][_0x3c8aa1[_0x1608ca]][_0xb71d('0x50')](/"/g,'\x27'));switch(_0x1608ca){case _0xb71d('0x51'):var _0x112413=moment(_0x5eb766,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x112413[_0xb71d('0x52')]()){_0x4fe093[_0xb71d('0x3c')]('\x22'+_0x5eb766+'\x22');}else{_0x57fe44[_0xb71d('0x3c')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xb71d('0x1f'):var _0x43a66f=parseInt(_0x5eb766);_0x5eb766=_[_0xb71d('0x53')](_0x43a66f)||_0x43a66f<0x0||_0x43a66f>0x4?_0x54ac12?0x3:0x2:_0x43a66f;_0x4fe093[_0xb71d('0x3c')]('\x22'+_0x5eb766+'\x22');break;case _0xb71d('0x20'):var _0x2b3557=parseInt(_0x5eb766);if(_['isNumber'](_0x2b3557)&&_[_0xb71d('0x54')](_0x48edf6,_0x2b3557)){_0x4fe093[_0xb71d('0x3c')]('\x22'+_0x2b3557+'\x22');}else{_0x57fe44[_0xb71d('0x3c')](_0xb71d('0x55'));}break;case _0xb71d('0x56'):if(isEmail(_0x5eb766)){_0x4fe093[_0xb71d('0x3c')]('\x22'+_0x5eb766+'\x22');}else{_0x57fe44[_0xb71d('0x3c')](_0xb71d('0x57'));}break;case _0xb71d('0x58'):var _0xccb0af=moment(_0x5eb766,_0xb71d('0x59'),!![]);if(_0xccb0af[_0xb71d('0x52')]()){_0x4fe093[_0xb71d('0x3c')]('\x22'+_0x5eb766+'\x22');}else{_0x57fe44[_0xb71d('0x3c')](_0xb71d('0x5a'));}break;default:_0x4fe093[_0xb71d('0x3c')]('\x22'+_0x5eb766+'\x22');}}else{switch(_0x1608ca){case _0xb71d('0x5b'):case _0xb71d('0xf'):_0x57fe44[_0xb71d('0x3c')](_0x1608ca+'\x20not\x20specified');break;default:_0x4fe093[_0xb71d('0x3c')]('\x22\x22');}}}}if(_0x57fe44[_0xb71d('0x4b')]){handleError(_0x510f71['data'][_0x409aa6],{'code':_0xb71d('0x5c'),'message':_0x57fe44[_0xb71d('0x11')]()});}else{fs[_0xb71d('0x5d')](_0x3ed776,_0x4fe093[_0xb71d('0x11')]()+'\x0a');}_0x4fe093=[];}if(!(stats[_0xb71d('0x4c')]%0xc8)){socket['emit'](_0xb71d('0x5e')+_0x347a78,stats);stats[_0xb71d('0x3b')]=[];}}if(stopped){logger['info'](_0xb71d('0x5f'));_0x4afb7b[_0xb71d('0x60')]();}}catch(_0x44b825){handleError(_0x510f71[_0xb71d('0x4f')][_0x409aa6],{'code':_0xb71d('0x61'),'message':_0x44b825['message']});logger['error'](_0xb71d('0x62'),_0x44b825[_0xb71d('0x3a')]);}},'complete':function(){try{var _0x3ebd97=[];var _0x4311f7='cm_contacts';if(_0x50f497[_0xb71d('0x63')]&&_0x50f497['duplicates'][_0xb71d('0x4b')]){_0x4311f7=_0xb71d('0x64')+_0x347a78;_0x3ebd97[_0xb71d('0x3c')](_0xb71d('0x65')+_0x4311f7+_0xb71d('0x66'));}var _0x52f262=util[_0xb71d('0x67')]('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',_0x3ed776,_0x4311f7,_0x3ae23b,_0x50f497[_0xb71d('0x2c')],_0x50f497[_0xb71d('0x33')]||null,NOW,NOW);if(_[_0xb71d('0x68')](_0x3c8aa1['scheduledat'])){_0x52f262+=_0xb71d('0x69');}_0x3ebd97[_0xb71d('0x3c')](_0x52f262);if(_0x50f497[_0xb71d('0x63')]&&_0x50f497['duplicates']['length']){_0x3ebd97['push'](insertCmContact(_0x50f497[_0xb71d('0x2c')],_0x4311f7,_0x50f497[_0xb71d('0x63')],_0x3c8aa1));_0x3ebd97[_0xb71d('0x3c')]('DROP\x20TABLE\x20'+_0x4311f7+';');}_0x3ebd97['push'](insertCmHopper(_0x50f497['ListId'],'voice_queues_has_cm_lists',_0xb71d('0x6a'),_0xb71d('0x6b'),_0x54ac12));_0x3ebd97[_0xb71d('0x3c')](insertCmHopperBlack(_0x50f497[_0xb71d('0x2c')],'voice_queues_has_cm_blacklists',_0xb71d('0x6a'),_0xb71d('0x6b')));_0x3ebd97['push'](insertCmHopper(_0x50f497[_0xb71d('0x2c')],'campaigns_has_cm_lists','campaigns',_0xb71d('0x6c'),_0x54ac12));_0x3ebd97[_0xb71d('0x3c')](insertCmHopperBlack(_0x50f497['ListId'],'campaigns_has_cm_blacklists','campaigns','CampaignId'));BPromise[_0xb71d('0x6d')](_0x3ebd97,handleQuery)['then'](function(_0x3b9cb3){stats[_0xb71d('0x6e')]=!![];stats['affectedRows']=_0x50f497[_0xb71d('0x63')]&&_0x50f497['duplicates'][_0xb71d('0x4b')]?results[0x2][_0xb71d('0x6f')]:results[0x0][_0xb71d('0x6f')];socket['emit'](_0xb71d('0x5e')+_0x347a78,stats);fs[_0xb71d('0x70')](_0x20086a);fs[_0xb71d('0x70')](_0x3ed776);process[_0xb71d('0x71')](0x0);})['catch'](function(_0x5eda9a){logger[_0xb71d('0x39')](_0x5eda9a['message']);process[_0xb71d('0x71')](0x1);});}catch(_0x22e14e){logger[_0xb71d('0x39')](_0xb71d('0x72'),_0x22e14e[_0xb71d('0x3a')]);process[_0xb71d('0x71')](0x1);}},'error':function(_0x5ba20b,_0x374a1c,_0x255edb,_0x2049df){throw new Error(_0x2049df);}});}function validate(){if(process[_0xb71d('0x73')]&&process[_0xb71d('0x73')][_0xb71d('0x4b')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x2e48f5=path[_0xb71d('0x11')](config[_0xb71d('0x44')],_0xb71d('0x45'),process[_0xb71d('0x73')][0x2]);if(!fs[_0xb71d('0x74')](_0x2e48f5)){throw new Error(_0xb71d('0x75'));}var _0x55cef4={};try{_0x55cef4=JSON['parse'](process['argv'][0x3]);if(!_0x55cef4[_0xb71d('0x43')]){throw new Error(_0xb71d('0x76'));}if(!_0x55cef4[_0xb71d('0x43')][_0xb71d('0xf')]){throw new Error(_0xb71d('0x77'));}if(!_0x55cef4[_0xb71d('0x43')]['firstName']){throw new Error('firstName\x20is\x20mandatory');}var _0xad009a=0x0;if(_0x55cef4[_0xb71d('0x43')][_0xb71d('0x20')]){_0xad009a=0x1;}if(!_0x55cef4[_0xb71d('0x2c')]){throw new Error(_0xb71d('0x78'));}}catch(_0x16147c){throw new Error(_0xb71d('0x79'));}var _0x4de60e=[];try{_0x4de60e=_['map'](JSON[_0xb71d('0x49')](process[_0xb71d('0x73')][0x4]),'id');}catch(_0x1941a4){logger['info']('No\x20agent\x20available');}main(_0x2e48f5,_0x55cef4,_0x4de60e,_0xad009a);}validate();process['on'](_0xb71d('0x7a'),handleStop);process['on'](_0xb71d('0x7b'),handleUncaughtException); \ No newline at end of file +var _0x4d5b=['firstName','\x20not\x20specified','length','SystemRow','appendFileSync','contact:import:','Abort\x20parser','SystemError','error','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','isNil','duplicates','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','each','then','finish','affectedRows','emit','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','select','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','fields','ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','message','exit','errors','sequelize','query','spread','push','catch','main','stringify','send','root','server/files/tmp','.csv','header','parse','createReadStream','data','rows','hasOwnProperty','trim','replace','isValid','UserId','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD'];(function(_0x8a788d,_0x3279a3){var _0x2c1d18=function(_0x2e3895){while(--_0x2e3895){_0x8a788d['push'](_0x8a788d['shift']());}};_0x2c1d18(++_0x3279a3);}(_0x4d5b,0x12d));var _0xb4d5=function(_0x3318de,_0x114d1f){_0x3318de=_0x3318de-0x0;var _0x23e692=_0x4d5b[_0x3318de];return _0x23e692;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xb4d5('0x0'));var Papa=require(_0xb4d5('0x1'));var util=require(_0xb4d5('0x2'));var BPromise=require(_0xb4d5('0x3'));var moment=require(_0xb4d5('0x4'));var squel=require(_0xb4d5('0x5'));var Redis=require(_0xb4d5('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0xb4d5('0x7'));var logger=require(_0xb4d5('0x8'))('import');config[_0xb4d5('0x9')]=_[_0xb4d5('0xa')](config['redis'],{'host':_0xb4d5('0xb'),'port':0x18eb});var socket=require(_0xb4d5('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xb4d5('0xd')](_0xb4d5('0xe'));function isEmail(_0xeb20b9){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))*$/[_0xb4d5('0xf')](_0xeb20b9);}function selectNotIn(_0x702c04,_0xb4d3aa,_0x64cbdd,_0x39625e,_0x31330f){return squel['select']()[_0xb4d5('0x10')](_0xb4d5('0x11'))[_0xb4d5('0x12')](_0x39625e)[_0xb4d5('0x13')](_0xb4d3aa,null,_0xb4d3aa+_0xb4d5('0x14')+_0x39625e+'.'+_0x64cbdd)[_0xb4d5('0x15')](_0x39625e+'.'+_0x64cbdd+'\x20=\x20'+_0x702c04+'.'+_0x64cbdd)['where'](_0xb4d3aa+_0xb4d5('0x16')+_0x31330f['join']()+')');}function insertCmHopper(_0x3f1b81,_0x100e39,_0x512f2a,_0x548bad,_0x13045a){var _0x11e575=['cm_contacts.phone',_0xb4d5('0x17'),'cm_contacts.id','cm_contacts.ListId',_0x100e39+'.'+_0x548bad,_0xb4d5('0x18'),_0xb4d5('0x19'),_0xb4d5('0x1a'),_0xb4d5('0x1b'),'\x22'+_0x13045a+'\x22'];return squel[_0xb4d5('0x1c')]()[_0xb4d5('0x1d')](_0xb4d5('0x1e'))[_0xb4d5('0x1f')]([_0xb4d5('0x11'),_0xb4d5('0x20'),_0xb4d5('0x21'),_0xb4d5('0x22'),_0x548bad,_0xb4d5('0x23'),_0xb4d5('0x24'),_0xb4d5('0x25'),'UserId',_0xb4d5('0x26')],squel[_0xb4d5('0x27')]()['fields'](_0x11e575)['from'](_0x100e39)[_0xb4d5('0x13')](_0xb4d5('0x28'),null,_0xb4d5('0x29')+_0x100e39+_0xb4d5('0x2a'))[_0xb4d5('0x13')](_0x512f2a,null,_0x512f2a+'.id\x20=\x20'+_0x100e39+'.'+_0x548bad)[_0xb4d5('0x15')](_0x100e39+'.CmListId\x20=\x20?',_0x3f1b81)['where'](_0xb4d5('0x2b'),NOW)[_0xb4d5('0x15')](_0xb4d5('0x2c'),selectNotIn(_0x100e39,_0x512f2a,_0x548bad,'cm_hopper',[_0xb4d5('0x2d'),_0xb4d5('0x2e')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x100e39,_0x512f2a,_0x548bad,_0xb4d5('0x1e'),[_0xb4d5('0x2d')])))[_0xb4d5('0x2f')]();}function insertCmHopperBlack(_0x58e076,_0x656f04,_0x48b24a,_0xd86a7a){var _0x204ecd=['cm_contacts.phone','cm_contacts.id','cm_contacts.ListId',_0x656f04+'.'+_0xd86a7a,_0xb4d5('0x18'),_0xb4d5('0x19')];return squel[_0xb4d5('0x1c')]()[_0xb4d5('0x1d')](_0xb4d5('0x30'))[_0xb4d5('0x1f')](['phone','ContactId',_0xb4d5('0x22'),_0xd86a7a,_0xb4d5('0x23'),_0xb4d5('0x24')],squel[_0xb4d5('0x27')]()[_0xb4d5('0x31')](_0x204ecd)[_0xb4d5('0x12')](_0x656f04)[_0xb4d5('0x13')](_0xb4d5('0x28'),null,_0xb4d5('0x29')+_0x656f04+_0xb4d5('0x2a'))[_0xb4d5('0x13')](_0x48b24a,null,_0x48b24a+_0xb4d5('0x14')+_0x656f04+'.'+_0xd86a7a)[_0xb4d5('0x15')](_0x656f04+'.CmListId\x20=\x20?',_0x58e076)[_0xb4d5('0x15')](_0xb4d5('0x2b'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xb4d5('0x27')]()['field']('phone')[_0xb4d5('0x12')](_0xb4d5('0x30'))[_0xb4d5('0x15')](_0xb4d5('0x32'),_0x58e076)[_0xb4d5('0x15')](_0xd86a7a+'\x20=\x20?',_0x656f04+'.'+_0xd86a7a)))[_0xb4d5('0x2f')]();}function insertCmContact(_0x3b5a55,_0x3e37ca,_0x1b88be,_0x420f76){var _0x3a2f18=_[_0xb4d5('0x33')](_[_0xb4d5('0x34')](_0x420f76),[_0xb4d5('0x22'),_0xb4d5('0x35'),_0xb4d5('0x23'),'updatedAt']);return squel[_0xb4d5('0x1c')]()[_0xb4d5('0x1d')]('cm_contacts')[_0xb4d5('0x1f')](_0x3a2f18,squel[_0xb4d5('0x27')]()['fields'](_0x3a2f18)['from'](_0x3e37ca)[_0xb4d5('0x15')]('('+_0x1b88be[_0xb4d5('0x13')](',')+_0xb4d5('0x36'),squel[_0xb4d5('0x27')]()['fields'](_0x1b88be)[_0xb4d5('0x12')](_0xb4d5('0x28'))[_0xb4d5('0x15')](_0xb4d5('0x32'),_0x3b5a55)[_0xb4d5('0x15')](_0xb4d5('0x37')))['where'](_0xb4d5('0x38'),squel['select']()[_0xb4d5('0x10')]('MIN(id)',_0xb4d5('0x39'))['from'](_0x3e37ca)[_0xb4d5('0x3a')](_0x1b88be[_0xb4d5('0x13')](','))))[_0xb4d5('0x2f')]();}function handleStop(){logger[_0xb4d5('0x3b')](_0xb4d5('0x3c'));stopped=!![];}function handleUncaughtException(_0x13f685){logger['error'](_0x13f685[_0xb4d5('0x3d')]);process[_0xb4d5('0x3e')](0x1);}function handleError(_0x4ea59e,_0x2ae0a0){stats[_0xb4d5('0x3f')]['push']({'name':_0x2ae0a0['code'],'message':_0x2ae0a0[_0xb4d5('0x3d')],'row':_0x4ea59e});}function handleQuery(_0x4a64da){logger[_0xb4d5('0x3b')](_0x4a64da);return db[_0xb4d5('0x40')][_0xb4d5('0x41')](_0x4a64da)[_0xb4d5('0x42')](function(_0x3c0ae8){results[_0xb4d5('0x43')](_0x3c0ae8);})[_0xb4d5('0x44')](function(_0x377464){logger['error'](_0x377464[_0xb4d5('0x3d')]);});}function main(_0x3c0a22,_0x4c0390,_0x19ab68,_0x421daa){logger['info'](_0xb4d5('0x45'),_0x3c0a22,JSON[_0xb4d5('0x46')](_0x4c0390));process[_0xb4d5('0x47')]('start');var _0x3401cb=_0x4c0390['binding'];var _0x20405c=_0x4c0390['socket_timestamp'];var _0x186f41=path[_0xb4d5('0x13')](config[_0xb4d5('0x48')],_0xb4d5('0x49'),_0x20405c+_0xb4d5('0x4a'));var _0x4f99de=_[_0xb4d5('0x34')](_0x3401cb)[_0xb4d5('0x13')]();logger[_0xb4d5('0x3b')](_0xb4d5('0x4b'),_0x4f99de);fs['writeFileSync'](_0x186f41,_0x4f99de+'\x0a');Papa[_0xb4d5('0x4c')](fs[_0xb4d5('0x4d')](_0x3c0a22),{'header':!![],'skipEmptyLines':!![],'step':function(_0x510fe0,_0x16e52d){try{for(var _0x2d6af1=0x0,_0x30e8da=[];_0x2d6af1<_0x510fe0[_0xb4d5('0x4e')]['length'];_0x2d6af1++){stats[_0xb4d5('0x4f')]+=0x1;if(_0x510fe0[_0xb4d5('0x3f')][_0x2d6af1]){handleError(_0x510fe0[_0xb4d5('0x4e')][_0x2d6af1],_0x510fe0[_0xb4d5('0x3f')][_0x2d6af1]);}else{var _0x181383=[];for(var _0x3c4650 in _0x3401cb){if(_0x3401cb[_0xb4d5('0x50')](_0x3c4650)){if(_0x510fe0['data'][_0x2d6af1][_0x3401cb[_0x3c4650]]){var _0x29f4d3=_[_0xb4d5('0x51')](_0x510fe0[_0xb4d5('0x4e')][_0x2d6af1][_0x3401cb[_0x3c4650]][_0xb4d5('0x52')](/"/g,'\x27'));switch(_0x3c4650){case _0xb4d5('0x20'):var _0xa00d34=moment(_0x29f4d3,_0xb4d5('0xe'),!![]);if(_0xa00d34[_0xb4d5('0x53')]()){_0x30e8da[_0xb4d5('0x43')]('\x22'+_0x29f4d3+'\x22');}else{_0x181383['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xb4d5('0x25'):var _0x558190=parseInt(_0x29f4d3);_0x29f4d3=_['isNaN'](_0x558190)||_0x558190<0x0||_0x558190>0x4?_0x421daa?0x3:0x2:_0x558190;_0x30e8da[_0xb4d5('0x43')]('\x22'+_0x29f4d3+'\x22');break;case _0xb4d5('0x54'):var _0x486e4c=parseInt(_0x29f4d3);if(_[_0xb4d5('0x55')](_0x486e4c)&&_[_0xb4d5('0x56')](_0x19ab68,_0x486e4c)){_0x30e8da[_0xb4d5('0x43')]('\x22'+_0x486e4c+'\x22');}else{_0x181383[_0xb4d5('0x43')](_0xb4d5('0x57'));}break;case _0xb4d5('0x58'):if(isEmail(_0x29f4d3)){_0x30e8da['push']('\x22'+_0x29f4d3+'\x22');}else{_0x181383[_0xb4d5('0x43')](_0xb4d5('0x59'));}break;case _0xb4d5('0x5a'):var _0x3c6246=moment(_0x29f4d3,_0xb4d5('0x5b'),!![]);if(_0x3c6246[_0xb4d5('0x53')]()){_0x30e8da[_0xb4d5('0x43')]('\x22'+_0x29f4d3+'\x22');}else{_0x181383[_0xb4d5('0x43')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x30e8da[_0xb4d5('0x43')]('\x22'+_0x29f4d3+'\x22');}}else{switch(_0x3c4650){case _0xb4d5('0x5c'):case _0xb4d5('0x11'):_0x181383[_0xb4d5('0x43')](_0x3c4650+_0xb4d5('0x5d'));break;default:_0x30e8da['push']('\x22\x22');}}}}if(_0x181383[_0xb4d5('0x5e')]){handleError(_0x510fe0[_0xb4d5('0x4e')][_0x2d6af1],{'code':_0xb4d5('0x5f'),'message':_0x181383[_0xb4d5('0x13')]()});}else{fs[_0xb4d5('0x60')](_0x186f41,_0x30e8da[_0xb4d5('0x13')]()+'\x0a');}_0x30e8da=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0xb4d5('0x61')+_0x20405c,stats);stats['errors']=[];}}if(stopped){logger[_0xb4d5('0x3b')](_0xb4d5('0x62'));_0x16e52d['abort']();}}catch(_0x3e4033){handleError(_0x510fe0['data'][_0x2d6af1],{'code':_0xb4d5('0x63'),'message':_0x3e4033['message']});logger[_0xb4d5('0x64')]('step',_0x3e4033[_0xb4d5('0x3d')]);}},'complete':function(){try{var _0x3e450f=[];var _0x565c13='cm_contacts';if(_0x4c0390['duplicates']&&_0x4c0390['duplicates'][_0xb4d5('0x5e')]){_0x565c13='cm_contacts_'+_0x20405c;_0x3e450f[_0xb4d5('0x43')](_0xb4d5('0x65')+_0x565c13+_0xb4d5('0x66'));}var _0x1ef532=util[_0xb4d5('0xd')]('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',_0x186f41,_0x565c13,_0x4f99de,_0x4c0390[_0xb4d5('0x22')],_0x4c0390['CompanyId']||null,NOW,NOW);if(_[_0xb4d5('0x67')](_0x3401cb[_0xb4d5('0x20')])){_0x1ef532+=',\x20scheduledAt\x20=\x20NOW()';}_0x3e450f[_0xb4d5('0x43')](_0x1ef532);if(_0x4c0390[_0xb4d5('0x68')]&&_0x4c0390[_0xb4d5('0x68')][_0xb4d5('0x5e')]){_0x3e450f['push'](insertCmContact(_0x4c0390[_0xb4d5('0x22')],_0x565c13,_0x4c0390[_0xb4d5('0x68')],_0x3401cb));_0x3e450f[_0xb4d5('0x43')](_0xb4d5('0x69')+_0x565c13+';');}_0x3e450f[_0xb4d5('0x43')](insertCmHopper(_0x4c0390['ListId'],_0xb4d5('0x6a'),_0xb4d5('0x6b'),_0xb4d5('0x6c'),_0x421daa));_0x3e450f['push'](insertCmHopperBlack(_0x4c0390[_0xb4d5('0x22')],_0xb4d5('0x6d'),_0xb4d5('0x6b'),'VoiceQueueId'));_0x3e450f[_0xb4d5('0x43')](insertCmHopper(_0x4c0390['ListId'],_0xb4d5('0x6e'),_0xb4d5('0x6f'),'CampaignId',_0x421daa));_0x3e450f[_0xb4d5('0x43')](insertCmHopperBlack(_0x4c0390[_0xb4d5('0x22')],_0xb4d5('0x70'),_0xb4d5('0x6f'),'CampaignId'));BPromise[_0xb4d5('0x71')](_0x3e450f,handleQuery)[_0xb4d5('0x72')](function(_0x3fa2f9){stats[_0xb4d5('0x73')]=!![];stats['affectedRows']=_0x4c0390[_0xb4d5('0x68')]&&_0x4c0390[_0xb4d5('0x68')]['length']?results[0x2][_0xb4d5('0x74')]:results[0x0][_0xb4d5('0x74')];socket[_0xb4d5('0x75')]('contact:import:'+_0x20405c,stats);fs['unlink'](_0x3c0a22);fs[_0xb4d5('0x76')](_0x186f41);process[_0xb4d5('0x3e')](0x0);})[_0xb4d5('0x44')](function(_0x522f92){logger[_0xb4d5('0x64')](_0x522f92[_0xb4d5('0x3d')]);process[_0xb4d5('0x3e')](0x1);});}catch(_0x563d1c){logger[_0xb4d5('0x64')](_0xb4d5('0x77'),_0x563d1c[_0xb4d5('0x3d')]);process[_0xb4d5('0x3e')](0x1);}},'error':function(_0x34b172,_0x5a02df,_0x8c5fa9,_0x1577cd){throw new Error(_0x1577cd);}});}function validate(){if(process[_0xb4d5('0x78')]&&process[_0xb4d5('0x78')][_0xb4d5('0x5e')]<0x4){throw new Error(_0xb4d5('0x79'));}var _0x5632ee=path[_0xb4d5('0x13')](config[_0xb4d5('0x48')],_0xb4d5('0x49'),process[_0xb4d5('0x78')][0x2]);if(!fs[_0xb4d5('0x7a')](_0x5632ee)){throw new Error(_0xb4d5('0x7b'));}var _0xd7df2b={};try{_0xd7df2b=JSON[_0xb4d5('0x4c')](process[_0xb4d5('0x78')][0x3]);if(!_0xd7df2b[_0xb4d5('0x7c')]){throw new Error(_0xb4d5('0x7d'));}if(!_0xd7df2b['binding']['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0xd7df2b['binding'][_0xb4d5('0x5c')]){throw new Error(_0xb4d5('0x7e'));}var _0x196a47=0x0;if(_0xd7df2b[_0xb4d5('0x7c')]['UserId']){_0x196a47=0x1;}if(!_0xd7df2b[_0xb4d5('0x22')]){throw new Error(_0xb4d5('0x7f'));}}catch(_0x34d35c){throw new Error(_0xb4d5('0x80'));}var _0x58d783=[];try{_0x58d783=_[_0xb4d5('0x81')](JSON[_0xb4d5('0x4c')](process['argv'][0x4]),'id');}catch(_0x12648c){logger[_0xb4d5('0x3b')](_0xb4d5('0x82'));}main(_0x5632ee,_0xd7df2b,_0x58d783,_0x196a47);}validate();process['on']('SIGINT',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 d800f47..3067a89 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 _0x3c18=['join','sequelize','query','spread','isNil','phone','AdditionalPhones','push','all','catch','error','split','length','then','CmContactHasItem','update','updated','create','inserted','CmContact','CmHopper','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','insert','cm_hopper','fromQuery','ListId','createdAt','updatedAt','priority','UserId','recallme','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone','into','cm_hopper_black','ContactId','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','toString','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','fields','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',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','message','exit','errors','code','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','findAll','name','keys','parse','data','rows','find','hasOwnProperty','trim','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','emit','contact:import:','Abort\x20parser','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','orderBy','DROP\x20TABLE\x20','affectedRows','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','squel','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','select','from','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20('];(function(_0x3425b2,_0x26dc6){var _0x325f90=function(_0x507ccf){while(--_0x507ccf){_0x3425b2['push'](_0x3425b2['shift']());}};_0x325f90(++_0x26dc6);}(_0x3c18,0x7e));var _0x83c1=function(_0x4463a8,_0x4c7fd2){_0x4463a8=_0x4463a8-0x0;var _0x719157=_0x3c18[_0x4463a8];return _0x719157;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x83c1('0x0'));var Papa=require(_0x83c1('0x1'));var util=require(_0x83c1('0x2'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x83c1('0x3'));var Redis=require(_0x83c1('0x4'));var db=require(_0x83c1('0x5'))['db'];var config=require(_0x83c1('0x6'));var logger=require('../../../config/logger')(_0x83c1('0x7'));config[_0x83c1('0x8')]=_[_0x83c1('0x9')](config[_0x83c1('0x8')],{'host':_0x83c1('0xa'),'port':0x18eb});var socket=require(_0x83c1('0xb'))(new Redis(config[_0x83c1('0x8')]));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()[_0x83c1('0xc')](_0x83c1('0xd'));var tempTableName='cm_contacts_temp_'+moment()[_0x83c1('0xc')](_0x83c1('0xe'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x3773a4){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x3773a4);}function selectNotIn(_0x28c49a,_0x3e8751,_0x2dfbe0,_0x2987bb,_0x48a9ca){return squel[_0x83c1('0xf')]()['field']('phone')[_0x83c1('0x10')](_0x2987bb)['join'](_0x3e8751,null,_0x3e8751+_0x83c1('0x11')+_0x2987bb+'.'+_0x2dfbe0)['where'](_0x2987bb+'.'+_0x2dfbe0+_0x83c1('0x12')+_0x28c49a+'.'+_0x2dfbe0)[_0x83c1('0x13')](_0x3e8751+_0x83c1('0x14')+_0x48a9ca[_0x83c1('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x273eee,_0x14eb14){promisesAdditionalPhones=[];promisesContact=[];return db[_0x83c1('0x16')][_0x83c1('0x17')]('select\x20*\x20from\x20'+tempTableName)[_0x83c1('0x18')](function(_0x36618b){if(_0x36618b!==null){var _0x53742a=[];for(var _0x1e144c=0x0;_0x1e144c<_0x36618b['length'];_0x1e144c++){var _0x152453=_0x36618b[_0x1e144c];if(!_[_0x83c1('0x19')](_0x152453[_0x83c1('0x1a')])){if(!_[_0x83c1('0x19')](_0x152453[_0x83c1('0x1b')]))_0x53742a[_0x83c1('0x1c')](insertAdditionalPhones(_0x152453));promisesContact['push']({'contact':_0x152453});}}}Promise[_0x83c1('0x1d')](_0x53742a)['then'](function(){_0x273eee({'val':0x1});});})[_0x83c1('0x1e')](function(_0x362679){logger[_0x83c1('0x1f')](_0x362679['message']);});});}function insertAdditionalPhones(_0x509742){return new Promise(function(_0x59c9be,_0x12ee1f){var _0x4ccf9a=_0x509742[_0x83c1('0x1b')];if(_['isNil'](_0x4ccf9a))_0x12ee1f({'val':0x0});else{var _0x312c54=_0x4ccf9a[_0x83c1('0x20')](';');var _0x9cd855=[];orderBy=0x0;for(var _0x38a4ea=0x0;_0x38a4ea<_0x312c54[_0x83c1('0x21')];_0x38a4ea++){_0x9cd855[_0x83c1('0x1c')](splitAdditionalPhone(_0x509742['id'],_0x312c54[_0x38a4ea]));}Promise[_0x83c1('0x1d')](_0x9cd855)[_0x83c1('0x22')](function(){_0x59c9be({'val':_0x312c54[_0x83c1('0x21')]});});}});}function splitAdditionalPhone(_0x368ac1,_0x12305e){return new Promise(function(_0x4ef7d6,_0x146ae5){var _0x5e586d=_0x12305e['split'](':');var _0x1f6409=_0x5e586d[0x0];var _0x56fd7a=_0x5e586d[0x1];if(_0x56fd7a!==''){var _0x3afc44=_0x56fd7a[_0x83c1('0x20')]('|');var _0x1ba217=[];for(var _0x107726=0x0;_0x107726<_0x3afc44[_0x83c1('0x21')];_0x107726++){if(_0x3afc44[_0x107726]!==''){var _0x347507=_['filter'](promisesAdditionalPhones,{'contactId':_0x368ac1,'phone':_0x3afc44[_0x107726]});if(_0x347507[_0x83c1('0x21')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x368ac1,'contactTypeId':_0x1f6409,'phone':_0x3afc44[_0x107726],'orderBy':orderBy});}}}_0x4ef7d6({'ok':0x1});}else _0x4ef7d6({'res':0x0});});}function createAdditionalPhone(_0x2e389f,_0x3ba781,_0x288a14,_0x4e634b){return new Promise(function(_0x28f011,_0x1b907a){return db[_0x83c1('0x23')]['findOne']({'where':{'CmContactId':_0x2e389f,'item':_0x288a14}})['then'](function(_0x10e153){if(_0x10e153){return db[_0x83c1('0x23')][_0x83c1('0x24')]({'ItemTypeId':_0x3ba781,'OrderBy':_0x4e634b},{'where':{'CmContactId':_0x2e389f,'item':_0x288a14}})[_0x83c1('0x22')](function(_0x4be7eb){_0x28f011({'res':_0x83c1('0x25')});});}else{return db[_0x83c1('0x23')][_0x83c1('0x26')]({'CmContactId':_0x2e389f,'item':_0x288a14,'ItemTypeId':_0x3ba781,'OrderBy':_0x4e634b,'ItemClass':'PHONE'})[_0x83c1('0x22')](function(_0x4d8149){_0x28f011({'res':_0x83c1('0x27')});});}});});}function updateContact(_0x4cee65){return new Promise(function(_0x4aef16,_0x35be86){var _0x184575=_0x4cee65['id'];delete _0x4cee65['id'];return db[_0x83c1('0x28')][_0x83c1('0x24')](_0x4cee65,{'where':{'id':_0x184575}})[_0x83c1('0x22')](function(_0x563ced){updatedRows+=0x1;return db[_0x83c1('0x29')][_0x83c1('0x24')]({'phone':_0x4cee65[_0x83c1('0x1a')]},{'where':{'ContactId':_0x184575}})[_0x83c1('0x22')](function(_0x51ee40){_0x4aef16({'ret':'OK'});});});});}function insertCmHopper(_0x51b029,_0x41ecb1,_0x2f70d8,_0x37c0bc,_0x50b918){var _0x4daee0=['cm_contacts.phone',_0x83c1('0x2a'),_0x83c1('0x2b'),'cm_contacts.ListId',_0x41ecb1+'.'+_0x37c0bc,_0x83c1('0x2c'),_0x83c1('0x2d'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x50b918+'\x22'];return squel[_0x83c1('0x2e')]()['into'](_0x83c1('0x2f'))[_0x83c1('0x30')]([_0x83c1('0x1a'),'scheduledat','ContactId',_0x83c1('0x31'),_0x37c0bc,_0x83c1('0x32'),_0x83c1('0x33'),_0x83c1('0x34'),_0x83c1('0x35'),_0x83c1('0x36')],squel[_0x83c1('0xf')]()['fields'](_0x4daee0)[_0x83c1('0x10')](_0x41ecb1)[_0x83c1('0x15')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x41ecb1+_0x83c1('0x37'))[_0x83c1('0x15')](_0x2f70d8,null,_0x2f70d8+'.id\x20=\x20'+_0x41ecb1+'.'+_0x37c0bc)['where'](_0x41ecb1+'.CmListId\x20=\x20?',_0x51b029)['where'](_0x83c1('0x38'),NOW)[_0x83c1('0x13')](_0x83c1('0x39'),selectNotIn(_0x41ecb1,_0x2f70d8,_0x37c0bc,'cm_hopper',[_0x83c1('0x3a'),_0x83c1('0x3b')]))[_0x83c1('0x13')](_0x83c1('0x39'),selectNotIn(_0x41ecb1,_0x2f70d8,_0x37c0bc,_0x83c1('0x2f'),[_0x83c1('0x3a')])))['toString']();}function insertCmHopperBlack(_0x3fd10f,_0x4c4247,_0x5e0971,_0x4c564c){var _0x1ff1c2=[_0x83c1('0x3c'),_0x83c1('0x2b'),'cm_contacts.ListId',_0x4c4247+'.'+_0x4c564c,_0x83c1('0x2c'),_0x83c1('0x2d')];return squel[_0x83c1('0x2e')]()[_0x83c1('0x3d')](_0x83c1('0x3e'))[_0x83c1('0x30')]([_0x83c1('0x1a'),_0x83c1('0x3f'),_0x83c1('0x31'),_0x4c564c,_0x83c1('0x32'),_0x83c1('0x33')],squel[_0x83c1('0xf')]()['fields'](_0x1ff1c2)[_0x83c1('0x10')](_0x4c4247)[_0x83c1('0x15')](_0x83c1('0x40'),null,_0x83c1('0x41')+_0x4c4247+'.CmListId')[_0x83c1('0x15')](_0x5e0971,null,_0x5e0971+_0x83c1('0x11')+_0x4c4247+'.'+_0x4c564c)[_0x83c1('0x13')](_0x4c4247+_0x83c1('0x42'),_0x3fd10f)[_0x83c1('0x13')](_0x83c1('0x38'),NOW)[_0x83c1('0x13')](_0x83c1('0x39'),squel[_0x83c1('0xf')]()['field']('phone')[_0x83c1('0x10')]('cm_hopper_black')[_0x83c1('0x13')](_0x83c1('0x43'),_0x3fd10f)[_0x83c1('0x13')](_0x4c564c+_0x83c1('0x44'),_0x4c4247+'.'+_0x4c564c)))[_0x83c1('0x45')]();}function insertCmHopperAdditionalPhones(_0x2512e2){var _0x205bcf=['cm_hopper.id','cm_contact_has_items.item',_0x83c1('0x46'),_0x83c1('0x47'),_0x83c1('0x48')];return squel['insert']()[_0x83c1('0x3d')](_0x83c1('0x49'))[_0x83c1('0x30')](['CmHopperId',_0x83c1('0x1a'),_0x83c1('0x4a'),_0x83c1('0x32'),_0x83c1('0x33')],squel['select']()[_0x83c1('0x4b')](_0x205bcf)[_0x83c1('0x10')](_0x83c1('0x2f'))['join'](_0x83c1('0x40'),null,_0x83c1('0x4c'))[_0x83c1('0x15')](_0x83c1('0x4d'),null,_0x83c1('0x4e'))[_0x83c1('0x13')](_0x83c1('0x4f'),_0x2512e2)['where'](_0x83c1('0x38'),NOW))['toString']();}function insertCmContact(_0x1cad58,_0x39baa2,_0x5372e6,_0xd1b89c){var _0x59248f=_[_0x83c1('0x50')](_['keys'](_0xd1b89c),[_0x83c1('0x31'),_0x83c1('0x51'),_0x83c1('0x32'),_0x83c1('0x33')]);return squel[_0x83c1('0x2e')]()[_0x83c1('0x3d')](_0x83c1('0x40'))['fromQuery'](_0x59248f,squel[_0x83c1('0xf')]()[_0x83c1('0x4b')](_0x59248f)['from'](_0x39baa2)['where']('('+_0x5372e6['join'](',')+_0x83c1('0x52'),squel[_0x83c1('0xf')]()[_0x83c1('0x4b')](_0x5372e6)[_0x83c1('0x10')](_0x83c1('0x40'))[_0x83c1('0x13')](_0x83c1('0x43'),_0x1cad58))[_0x83c1('0x13')](_0x83c1('0x53'),squel['select']()['field'](_0x83c1('0x54'),'min_id')[_0x83c1('0x10')](_0x39baa2)[_0x83c1('0x55')](_0x5372e6['join'](','))))[_0x83c1('0x45')]();}function handleStop(){logger[_0x83c1('0x56')](_0x83c1('0x57'));stopped=!![];}function handleUncaughtException(_0x30230b){logger[_0x83c1('0x1f')](_0x30230b[_0x83c1('0x58')]);process[_0x83c1('0x59')](0x1);}function handleError(_0x7903d6,_0x5e3f35){stats[_0x83c1('0x5a')][_0x83c1('0x1c')]({'name':_0x5e3f35[_0x83c1('0x5b')],'message':_0x5e3f35[_0x83c1('0x58')],'row':_0x7903d6});}function handleQuery(_0x2eeaba){logger[_0x83c1('0x56')](_0x2eeaba);return db[_0x83c1('0x16')][_0x83c1('0x17')](_0x2eeaba)['spread'](function(_0x42085b){results[_0x83c1('0x1c')](_0x42085b);})[_0x83c1('0x1e')](function(_0x2b3d0f){logger['error'](_0x2b3d0f[_0x83c1('0x58')]);});}function main(_0x4fd101,_0x412461,_0x171f1b,_0x10dccc){logger[_0x83c1('0x56')]('main',_0x4fd101,JSON['stringify'](_0x412461));process[_0x83c1('0x5c')](_0x83c1('0x5d'));var _0x49a59f=_0x412461[_0x83c1('0x5e')];var _0x25d79a=_[_0x83c1('0x5f')](_0x49a59f);var _0x53744c=_0x412461[_0x83c1('0x60')];var _0x225ecb=path[_0x83c1('0x15')](config[_0x83c1('0x61')],_0x83c1('0x62'),_0x53744c+_0x83c1('0x63'));logger[_0x83c1('0x56')]('body',_0x412461);db['ContactItemType'][_0x83c1('0x64')]({'raw':!![],'attributes':['id',_0x83c1('0x65')]})[_0x83c1('0x22')](function(_0x55b59a){for(var _0x250600=0x0;_0x250600<_0x55b59a['length'];_0x250600++){if(_0x55b59a[_0x250600][_0x83c1('0x65')]in _0x49a59f){contactItemTypes[_0x83c1('0x1c')](_0x55b59a[_0x250600]);delete _0x25d79a[_0x55b59a[_0x250600][_0x83c1('0x65')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x25d79a[_0x83c1('0x1b')]='';var _0x485802=_[_0x83c1('0x66')](_0x25d79a)['join']();logger[_0x83c1('0x56')]('header',_0x485802);fs['writeFileSync'](_0x225ecb,_0x485802+'\x0a');Papa[_0x83c1('0x67')](fs['createReadStream'](_0x4fd101),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4d902d,_0x1a09df){try{for(var _0x3c55f0=0x0,_0x1f233a=[];_0x3c55f0<_0x4d902d[_0x83c1('0x68')][_0x83c1('0x21')];_0x3c55f0++){stats[_0x83c1('0x69')]+=0x1;if(_0x4d902d['errors'][_0x3c55f0]){handleError(_0x4d902d[_0x83c1('0x68')][_0x3c55f0],_0x4d902d[_0x83c1('0x5a')][_0x3c55f0]);}else{var _0x3a413a=[];var _0x1084df=[];for(var _0x3f4b78 in _0x49a59f){let _0x2ea808=contactItemTypes[_0x83c1('0x6a')](_0x550e15=>_0x550e15[_0x83c1('0x65')]===_0x3f4b78);if(_[_0x83c1('0x19')](_0x2ea808)){if(_0x49a59f[_0x83c1('0x6b')](_0x3f4b78)){if(_0x4d902d[_0x83c1('0x68')][_0x3c55f0][_0x49a59f[_0x3f4b78]]){var _0x111b9e=_[_0x83c1('0x6c')](_0x4d902d[_0x83c1('0x68')][_0x3c55f0][_0x49a59f[_0x3f4b78]][_0x83c1('0x6d')](/"/g,'\x27'));switch(_0x3f4b78){case _0x83c1('0x6e'):var _0xa86f5e=moment(_0x111b9e,_0x83c1('0xd'),!![]);if(_0xa86f5e[_0x83c1('0x6f')]()){_0x1f233a[_0x83c1('0x1c')]('\x22'+_0x111b9e+'\x22');}else{_0x3a413a[_0x83c1('0x1c')](_0x83c1('0x70'));}break;case _0x83c1('0x34'):var _0x58f97b=parseInt(_0x111b9e);_0x111b9e=_[_0x83c1('0x71')](_0x58f97b)||_0x58f97b<0x0||_0x58f97b>0x4?_0x10dccc?0x3:0x2:_0x58f97b;_0x1f233a['push']('\x22'+_0x111b9e+'\x22');break;case _0x83c1('0x35'):var _0x144b4e=parseInt(_0x111b9e);if(_[_0x83c1('0x72')](_0x144b4e)&&_[_0x83c1('0x73')](_0x171f1b,_0x144b4e)){_0x1f233a[_0x83c1('0x1c')]('\x22'+_0x144b4e+'\x22');}else{_0x3a413a['push'](_0x83c1('0x74'));}break;case _0x83c1('0x75'):if(isEmail(_0x111b9e)){_0x1f233a[_0x83c1('0x1c')]('\x22'+_0x111b9e+'\x22');}else{_0x3a413a[_0x83c1('0x1c')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x485cdf=moment(_0x111b9e,_0x83c1('0x76'),!![]);if(_0x485cdf[_0x83c1('0x6f')]()){_0x1f233a['push']('\x22'+_0x111b9e+'\x22');}else{_0x3a413a[_0x83c1('0x1c')](_0x83c1('0x77'));}break;default:_0x1f233a[_0x83c1('0x1c')]('\x22'+_0x111b9e+'\x22');}}else{switch(_0x3f4b78){case _0x83c1('0x78'):case'phone':_0x3a413a[_0x83c1('0x1c')](_0x3f4b78+'\x20not\x20specified');break;default:_0x1f233a[_0x83c1('0x1c')]('\x22\x22');}}}}else{var _0x5e32df='';for(var _0x3feec0=0x0;_0x3feec0<_0x49a59f[_0x3f4b78][_0x83c1('0x21')];_0x3feec0++){var _0x111b9e=_[_0x83c1('0x6c')](_0x4d902d['data'][_0x3c55f0][_0x49a59f[_0x3f4b78][_0x3feec0]][_0x83c1('0x6d')](/"/g,'\x27'));if(_0x5e32df=='')_0x5e32df=_0x111b9e;else _0x5e32df+='|'+_0x111b9e;}_0x1084df[_0x83c1('0x1c')](_0x2ea808['id']+':'+_0x5e32df);}}if(hasAdditionalPhones){_0x1f233a[_0x83c1('0x1c')]('\x22'+_0x1084df['join'](';')+'\x22');}if(_0x3a413a[_0x83c1('0x21')]){handleError(_0x4d902d[_0x83c1('0x68')][_0x3c55f0],{'code':'SystemRow','message':_0x3a413a[_0x83c1('0x15')]()});}else{fs['appendFileSync'](_0x225ecb,_0x1f233a['join']()+'\x0a');}_0x1f233a=[];}if(!(stats[_0x83c1('0x69')]%0xc8)){socket[_0x83c1('0x79')](_0x83c1('0x7a')+_0x53744c,stats);stats[_0x83c1('0x5a')]=[];}}if(stopped){logger[_0x83c1('0x56')](_0x83c1('0x7b'));_0x1a09df['abort']();}}catch(_0x4b42f4){handleError(_0x4d902d['data'][_0x3c55f0],{'code':'SystemError','message':_0x4b42f4[_0x83c1('0x58')]});logger['error']('step',_0x4b42f4[_0x83c1('0x58')]);}},'complete':function(){try{var _0x266fe0=[];var _0x4c9624=tempTableName;_0x266fe0['push'](_0x83c1('0x7c')+_0x4c9624+_0x83c1('0x7d'));logger[_0x83c1('0x56')](_0x83c1('0x7e'),contactItemTypes[_0x83c1('0x21')]);var _0x4f63ad=util[_0x83c1('0xc')](_0x83c1('0x7f'),_0x225ecb,_0x4c9624,_0x485802,_0x412461[_0x83c1('0x31')],_0x412461[_0x83c1('0x51')]||null,NOW,NOW);if(_[_0x83c1('0x19')](_0x49a59f[_0x83c1('0x6e')])){_0x4f63ad+=_0x83c1('0x80');}_0x266fe0[_0x83c1('0x1c')](_0x4f63ad);BPromise[_0x83c1('0x81')](_0x266fe0,handleQuery)[_0x83c1('0x22')](function(_0x3e1af1){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x266fe0=[];for(var _0x48c384=0x0;_0x48c384\x20\x20');}var _0x56b956=path[_0x83c1('0x15')](config[_0x83c1('0x61')],_0x83c1('0x62'),process[_0x83c1('0x89')][0x2]);if(!fs[_0x83c1('0x8a')](_0x56b956)){throw new Error(_0x83c1('0x8b'));}var _0x55bc25={};try{_0x55bc25=JSON['parse'](process['argv'][0x3]);if(!_0x55bc25['binding']){throw new Error(_0x83c1('0x8c'));}var _0x2c6c82=0x0;if(_0x55bc25[_0x83c1('0x5e')][_0x83c1('0x35')]){_0x2c6c82=0x1;}if(!_0x55bc25['ListId']){throw new Error(_0x83c1('0x8d'));}}catch(_0x5642db){throw new Error(_0x83c1('0x8e'));}var _0x551a1c=[];try{_0x551a1c=_[_0x83c1('0x8f')](JSON[_0x83c1('0x67')](process[_0x83c1('0x89')][0x4]),'id');}catch(_0x1170a1){logger[_0x83c1('0x56')](_0x83c1('0x90'));}main(_0x56b956,_0x55bc25,_0x551a1c,_0x2c6c82);}validate();process['on'](_0x83c1('0x91'),handleStop);process['on'](_0x83c1('0x92'),handleUncaughtException); \ No newline at end of file +var _0x2743=['cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','cm_hopper','fromQuery','scheduledat','ContactId','ListId','updatedAt','recallme','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','into','createdAt','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','\x20=\x20?','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contact_has_items','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','exit','errors','sequelize','catch','main','stringify','binding','clone','socket_timestamp','server/files/tmp','.csv','body','ContactItemType','name','header','writeFileSync','createReadStream','data','rows','hasOwnProperty','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','UserId','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','trim','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','contact','contactId','orderBy','DROP\x20TABLE\x20','each','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','query','select\x20*\x20from\x20','spread','length','AdditionalPhones','push','then','message','isNil','split','all','filter','CmContactHasItem','findOne','create','PHONE','inserted','CmContact','CmHopper','update','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x2743,0x101));var _0x3274=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2743[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x3274('0x0'));var Papa=require(_0x3274('0x1'));var util=require(_0x3274('0x2'));var BPromise=require(_0x3274('0x3'));var moment=require(_0x3274('0x4'));var squel=require('squel');var Redis=require(_0x3274('0x5'));var db=require(_0x3274('0x6'))['db'];var config=require(_0x3274('0x7'));var logger=require(_0x3274('0x8'))(_0x3274('0x9'));config[_0x3274('0xa')]=_[_0x3274('0xb')](config[_0x3274('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3274('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName='cm_contacts_temp_'+moment()[_0x3274('0xd')](_0x3274('0xe'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0xcc0c63){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))*$/[_0x3274('0xf')](_0xcc0c63);}function selectNotIn(_0x1aa64b,_0x3f188f,_0x15cbf3,_0x35ed29,_0x527a01){return squel[_0x3274('0x10')]()[_0x3274('0x11')](_0x3274('0x12'))[_0x3274('0x13')](_0x35ed29)[_0x3274('0x14')](_0x3f188f,null,_0x3f188f+_0x3274('0x15')+_0x35ed29+'.'+_0x15cbf3)[_0x3274('0x16')](_0x35ed29+'.'+_0x15cbf3+_0x3274('0x17')+_0x1aa64b+'.'+_0x15cbf3)[_0x3274('0x16')](_0x3f188f+'.dialCheckDuplicateType\x20IN\x20('+_0x527a01[_0x3274('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x417b02,_0x862ff3){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x3274('0x18')](_0x3274('0x19')+tempTableName)[_0x3274('0x1a')](function(_0x2de546){if(_0x2de546!==null){var _0x5b33c9=[];for(var _0x597c55=0x0;_0x597c55<_0x2de546[_0x3274('0x1b')];_0x597c55++){var _0x596563=_0x2de546[_0x597c55];if(!_['isNil'](_0x596563['phone'])){if(!_['isNil'](_0x596563[_0x3274('0x1c')]))_0x5b33c9['push'](insertAdditionalPhones(_0x596563));promisesContact[_0x3274('0x1d')]({'contact':_0x596563});}}}Promise['all'](_0x5b33c9)[_0x3274('0x1e')](function(){_0x417b02({'val':0x1});});})['catch'](function(_0x10f1e4){logger['error'](_0x10f1e4[_0x3274('0x1f')]);});});}function insertAdditionalPhones(_0x2052ca){return new Promise(function(_0x517f72,_0x1739d5){var _0xa93e4=_0x2052ca[_0x3274('0x1c')];if(_[_0x3274('0x20')](_0xa93e4))_0x1739d5({'val':0x0});else{var _0xf3ef0=_0xa93e4[_0x3274('0x21')](';');var _0xd399a2=[];orderBy=0x0;for(var _0x33127b=0x0;_0x33127b<_0xf3ef0[_0x3274('0x1b')];_0x33127b++){_0xd399a2[_0x3274('0x1d')](splitAdditionalPhone(_0x2052ca['id'],_0xf3ef0[_0x33127b]));}Promise[_0x3274('0x22')](_0xd399a2)[_0x3274('0x1e')](function(){_0x517f72({'val':_0xf3ef0[_0x3274('0x1b')]});});}});}function splitAdditionalPhone(_0x2234b9,_0x17ff5d){return new Promise(function(_0x1c94f7,_0x4a7c1f){var _0x16deec=_0x17ff5d[_0x3274('0x21')](':');var _0x41f09c=_0x16deec[0x0];var _0x19142f=_0x16deec[0x1];if(_0x19142f!==''){var _0x5640d7=_0x19142f[_0x3274('0x21')]('|');var _0x3434a4=[];for(var _0x1997ef=0x0;_0x1997ef<_0x5640d7[_0x3274('0x1b')];_0x1997ef++){if(_0x5640d7[_0x1997ef]!==''){var _0x3e3f0d=_[_0x3274('0x23')](promisesAdditionalPhones,{'contactId':_0x2234b9,'phone':_0x5640d7[_0x1997ef]});if(_0x3e3f0d[_0x3274('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x3274('0x1d')]({'contactId':_0x2234b9,'contactTypeId':_0x41f09c,'phone':_0x5640d7[_0x1997ef],'orderBy':orderBy});}}}_0x1c94f7({'ok':0x1});}else _0x1c94f7({'res':0x0});});}function createAdditionalPhone(_0x49b11a,_0x84691f,_0x1d6fe8,_0x3d9b58){return new Promise(function(_0x43dbb9,_0x4c5f4a){return db[_0x3274('0x24')][_0x3274('0x25')]({'where':{'CmContactId':_0x49b11a,'item':_0x1d6fe8}})[_0x3274('0x1e')](function(_0x1e399a){if(_0x1e399a){return db[_0x3274('0x24')]['update']({'ItemTypeId':_0x84691f,'OrderBy':_0x3d9b58},{'where':{'CmContactId':_0x49b11a,'item':_0x1d6fe8}})[_0x3274('0x1e')](function(_0x2a1061){_0x43dbb9({'res':'updated'});});}else{return db[_0x3274('0x24')][_0x3274('0x26')]({'CmContactId':_0x49b11a,'item':_0x1d6fe8,'ItemTypeId':_0x84691f,'OrderBy':_0x3d9b58,'ItemClass':_0x3274('0x27')})[_0x3274('0x1e')](function(_0x114e5a){_0x43dbb9({'res':_0x3274('0x28')});});}});});}function updateContact(_0x475b1e){return new Promise(function(_0x145350,_0x8cd61d){var _0x4732a2=_0x475b1e['id'];delete _0x475b1e['id'];return db[_0x3274('0x29')]['update'](_0x475b1e,{'where':{'id':_0x4732a2}})[_0x3274('0x1e')](function(_0x4fdf63){updatedRows+=0x1;return db[_0x3274('0x2a')][_0x3274('0x2b')]({'phone':_0x475b1e[_0x3274('0x12')]},{'where':{'ContactId':_0x4732a2}})[_0x3274('0x1e')](function(_0xc2cf5){_0x145350({'ret':'OK'});});});});}function insertCmHopper(_0x33b2fc,_0x21171f,_0x352165,_0x5e4258,_0x536cb0){var _0xb6676c=[_0x3274('0x2c'),_0x3274('0x2d'),'cm_contacts.id',_0x3274('0x2e'),_0x21171f+'.'+_0x5e4258,_0x3274('0x2f'),_0x3274('0x30'),_0x3274('0x31'),'cm_contacts.UserId','\x22'+_0x536cb0+'\x22'];return squel[_0x3274('0x32')]()['into'](_0x3274('0x33'))[_0x3274('0x34')](['phone',_0x3274('0x35'),_0x3274('0x36'),_0x3274('0x37'),_0x5e4258,'createdAt',_0x3274('0x38'),'priority','UserId',_0x3274('0x39')],squel[_0x3274('0x10')]()[_0x3274('0x3a')](_0xb6676c)[_0x3274('0x13')](_0x21171f)[_0x3274('0x14')](_0x3274('0x3b'),null,'cm_contacts.ListId\x20=\x20'+_0x21171f+_0x3274('0x3c'))[_0x3274('0x14')](_0x352165,null,_0x352165+_0x3274('0x15')+_0x21171f+'.'+_0x5e4258)['where'](_0x21171f+_0x3274('0x3d'),_0x33b2fc)[_0x3274('0x16')](_0x3274('0x3e'),NOW)[_0x3274('0x16')](_0x3274('0x3f'),selectNotIn(_0x21171f,_0x352165,_0x5e4258,'cm_hopper',[_0x3274('0x40'),'\x22onlyIfOpen\x22']))[_0x3274('0x16')](_0x3274('0x3f'),selectNotIn(_0x21171f,_0x352165,_0x5e4258,'cm_hopper',[_0x3274('0x40')])))[_0x3274('0x41')]();}function insertCmHopperBlack(_0x31eb51,_0x427dfd,_0x348e08,_0x54813c){var _0x5a6df3=[_0x3274('0x2c'),'cm_contacts.id',_0x3274('0x2e'),_0x427dfd+'.'+_0x54813c,_0x3274('0x2f'),_0x3274('0x30')];return squel[_0x3274('0x32')]()[_0x3274('0x42')]('cm_hopper_black')[_0x3274('0x34')]([_0x3274('0x12'),_0x3274('0x36'),_0x3274('0x37'),_0x54813c,_0x3274('0x43'),_0x3274('0x38')],squel[_0x3274('0x10')]()[_0x3274('0x3a')](_0x5a6df3)[_0x3274('0x13')](_0x427dfd)[_0x3274('0x14')](_0x3274('0x3b'),null,_0x3274('0x44')+_0x427dfd+'.CmListId')['join'](_0x348e08,null,_0x348e08+_0x3274('0x15')+_0x427dfd+'.'+_0x54813c)[_0x3274('0x16')](_0x427dfd+_0x3274('0x3d'),_0x31eb51)[_0x3274('0x16')](_0x3274('0x3e'),NOW)[_0x3274('0x16')](_0x3274('0x3f'),squel[_0x3274('0x10')]()[_0x3274('0x11')]('phone')[_0x3274('0x13')]('cm_hopper_black')[_0x3274('0x16')](_0x3274('0x45'),_0x31eb51)['where'](_0x54813c+_0x3274('0x46'),_0x427dfd+'.'+_0x54813c)))[_0x3274('0x41')]();}function insertCmHopperAdditionalPhones(_0x5231a2){var _0x5f5708=['cm_hopper.id','cm_contact_has_items.item',_0x3274('0x47'),_0x3274('0x48'),_0x3274('0x49')];return squel['insert']()['into'](_0x3274('0x4a'))['fromQuery'](['CmHopperId','phone',_0x3274('0x4b'),_0x3274('0x43'),_0x3274('0x38')],squel[_0x3274('0x10')]()[_0x3274('0x3a')](_0x5f5708)[_0x3274('0x13')](_0x3274('0x33'))[_0x3274('0x14')](_0x3274('0x3b'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x3274('0x14')](_0x3274('0x4c'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x3274('0x16')]('cm_hopper.ListId\x20=\x20?',_0x5231a2)['where'](_0x3274('0x3e'),NOW))[_0x3274('0x41')]();}function insertCmContact(_0x245a53,_0x46b064,_0x4a6093,_0x6001fb){var _0x5e7473=_[_0x3274('0x4d')](_[_0x3274('0x4e')](_0x6001fb),['ListId',_0x3274('0x4f'),'createdAt',_0x3274('0x38')]);return squel['insert']()[_0x3274('0x42')]('cm_contacts')['fromQuery'](_0x5e7473,squel['select']()['fields'](_0x5e7473)[_0x3274('0x13')](_0x46b064)[_0x3274('0x16')]('('+_0x4a6093[_0x3274('0x14')](',')+_0x3274('0x50'),squel[_0x3274('0x10')]()['fields'](_0x4a6093)['from'](_0x3274('0x3b'))[_0x3274('0x16')](_0x3274('0x45'),_0x245a53))[_0x3274('0x16')](_0x3274('0x51'),squel[_0x3274('0x10')]()[_0x3274('0x11')](_0x3274('0x52'),_0x3274('0x53'))[_0x3274('0x13')](_0x46b064)[_0x3274('0x54')](_0x4a6093[_0x3274('0x14')](','))))[_0x3274('0x41')]();}function handleStop(){logger[_0x3274('0x55')](_0x3274('0x56'));stopped=!![];}function handleUncaughtException(_0xa8daf1){logger[_0x3274('0x57')](_0xa8daf1[_0x3274('0x1f')]);process[_0x3274('0x58')](0x1);}function handleError(_0x471934,_0x3f0911){stats[_0x3274('0x59')][_0x3274('0x1d')]({'name':_0x3f0911['code'],'message':_0x3f0911['message'],'row':_0x471934});}function handleQuery(_0x1f199b){logger[_0x3274('0x55')](_0x1f199b);return db[_0x3274('0x5a')][_0x3274('0x18')](_0x1f199b)[_0x3274('0x1a')](function(_0x4a7a97){results[_0x3274('0x1d')](_0x4a7a97);})[_0x3274('0x5b')](function(_0x58d49a){logger[_0x3274('0x57')](_0x58d49a[_0x3274('0x1f')]);});}function main(_0x40b483,_0x4c0d73,_0x471852,_0x38b319){logger[_0x3274('0x55')](_0x3274('0x5c'),_0x40b483,JSON[_0x3274('0x5d')](_0x4c0d73));process['send']('start');var _0xd09b6f=_0x4c0d73[_0x3274('0x5e')];var _0xe3ef5c=_[_0x3274('0x5f')](_0xd09b6f);var _0xb9f00c=_0x4c0d73[_0x3274('0x60')];var _0x4d4ac1=path[_0x3274('0x14')](config['root'],_0x3274('0x61'),_0xb9f00c+_0x3274('0x62'));logger[_0x3274('0x55')](_0x3274('0x63'),_0x4c0d73);db[_0x3274('0x64')]['findAll']({'raw':!![],'attributes':['id','name']})[_0x3274('0x1e')](function(_0x15d183){for(var _0x55b7d9=0x0;_0x55b7d9<_0x15d183[_0x3274('0x1b')];_0x55b7d9++){if(_0x15d183[_0x55b7d9][_0x3274('0x65')]in _0xd09b6f){contactItemTypes['push'](_0x15d183[_0x55b7d9]);delete _0xe3ef5c[_0x15d183[_0x55b7d9]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0xe3ef5c[_0x3274('0x1c')]='';var _0x17d44c=_['keys'](_0xe3ef5c)[_0x3274('0x14')]();logger['info'](_0x3274('0x66'),_0x17d44c);fs[_0x3274('0x67')](_0x4d4ac1,_0x17d44c+'\x0a');Papa['parse'](fs[_0x3274('0x68')](_0x40b483),{'header':!![],'skipEmptyLines':!![],'step':function(_0x339221,_0x248e35){try{for(var _0x47e30a=0x0,_0x570130=[];_0x47e30a<_0x339221[_0x3274('0x69')]['length'];_0x47e30a++){stats[_0x3274('0x6a')]+=0x1;if(_0x339221['errors'][_0x47e30a]){handleError(_0x339221[_0x3274('0x69')][_0x47e30a],_0x339221[_0x3274('0x59')][_0x47e30a]);}else{var _0x54f31b=[];var _0x5751f3=[];for(var _0x269fd7 in _0xd09b6f){let _0x24fd61=contactItemTypes['find'](_0x4d965d=>_0x4d965d['name']===_0x269fd7);if(_[_0x3274('0x20')](_0x24fd61)){if(_0xd09b6f[_0x3274('0x6b')](_0x269fd7)){if(_0x339221[_0x3274('0x69')][_0x47e30a][_0xd09b6f[_0x269fd7]]){var _0x2cfb6a=_['trim'](_0x339221[_0x3274('0x69')][_0x47e30a][_0xd09b6f[_0x269fd7]][_0x3274('0x6c')](/"/g,'\x27'));switch(_0x269fd7){case _0x3274('0x35'):var _0x50ec1b=moment(_0x2cfb6a,_0x3274('0x6d'),!![]);if(_0x50ec1b[_0x3274('0x6e')]()){_0x570130['push']('\x22'+_0x2cfb6a+'\x22');}else{_0x54f31b[_0x3274('0x1d')](_0x3274('0x6f'));}break;case _0x3274('0x70'):var _0x58d0e3=parseInt(_0x2cfb6a);_0x2cfb6a=_[_0x3274('0x71')](_0x58d0e3)||_0x58d0e3<0x0||_0x58d0e3>0x4?_0x38b319?0x3:0x2:_0x58d0e3;_0x570130['push']('\x22'+_0x2cfb6a+'\x22');break;case _0x3274('0x72'):var _0x370ad1=parseInt(_0x2cfb6a);if(_[_0x3274('0x73')](_0x370ad1)&&_[_0x3274('0x74')](_0x471852,_0x370ad1)){_0x570130[_0x3274('0x1d')]('\x22'+_0x370ad1+'\x22');}else{_0x54f31b[_0x3274('0x1d')](_0x3274('0x75'));}break;case'email':if(isEmail(_0x2cfb6a)){_0x570130[_0x3274('0x1d')]('\x22'+_0x2cfb6a+'\x22');}else{_0x54f31b[_0x3274('0x1d')](_0x3274('0x76'));}break;case _0x3274('0x77'):var _0x2d6339=moment(_0x2cfb6a,_0x3274('0x78'),!![]);if(_0x2d6339[_0x3274('0x6e')]()){_0x570130[_0x3274('0x1d')]('\x22'+_0x2cfb6a+'\x22');}else{_0x54f31b['push'](_0x3274('0x79'));}break;default:_0x570130[_0x3274('0x1d')]('\x22'+_0x2cfb6a+'\x22');}}else{switch(_0x269fd7){case _0x3274('0x7a'):case'phone':_0x54f31b[_0x3274('0x1d')](_0x269fd7+'\x20not\x20specified');break;default:_0x570130[_0x3274('0x1d')]('\x22\x22');}}}}else{var _0x516503='';for(var _0xe9834e=0x0;_0xe9834e<_0xd09b6f[_0x269fd7][_0x3274('0x1b')];_0xe9834e++){var _0x2cfb6a=_[_0x3274('0x7b')](_0x339221[_0x3274('0x69')][_0x47e30a][_0xd09b6f[_0x269fd7][_0xe9834e]]['replace'](/"/g,'\x27'));if(_0x516503=='')_0x516503=_0x2cfb6a;else _0x516503+='|'+_0x2cfb6a;}_0x5751f3['push'](_0x24fd61['id']+':'+_0x516503);}}if(hasAdditionalPhones){_0x570130[_0x3274('0x1d')]('\x22'+_0x5751f3[_0x3274('0x14')](';')+'\x22');}if(_0x54f31b['length']){handleError(_0x339221[_0x3274('0x69')][_0x47e30a],{'code':_0x3274('0x7c'),'message':_0x54f31b['join']()});}else{fs[_0x3274('0x7d')](_0x4d4ac1,_0x570130['join']()+'\x0a');}_0x570130=[];}if(!(stats[_0x3274('0x6a')]%0xc8)){socket[_0x3274('0x7e')](_0x3274('0x7f')+_0xb9f00c,stats);stats[_0x3274('0x59')]=[];}}if(stopped){logger[_0x3274('0x55')]('Abort\x20parser');_0x248e35[_0x3274('0x80')]();}}catch(_0x12e8f6){handleError(_0x339221[_0x3274('0x69')][_0x47e30a],{'code':_0x3274('0x81'),'message':_0x12e8f6[_0x3274('0x1f')]});logger[_0x3274('0x57')](_0x3274('0x82'),_0x12e8f6['message']);}},'complete':function(){try{var _0xc1e7c=[];var _0x50baab=tempTableName;_0xc1e7c[_0x3274('0x1d')](_0x3274('0x83')+_0x50baab+_0x3274('0x84'));logger[_0x3274('0x55')](_0x3274('0x85'),contactItemTypes[_0x3274('0x1b')]);var _0x4b5cb7=util[_0x3274('0xd')](_0x3274('0x86'),_0x4d4ac1,_0x50baab,_0x17d44c,_0x4c0d73[_0x3274('0x37')],_0x4c0d73['CompanyId']||null,NOW,NOW);if(_['isNil'](_0xd09b6f[_0x3274('0x35')])){_0x4b5cb7+=_0x3274('0x87');}_0xc1e7c['push'](_0x4b5cb7);BPromise['each'](_0xc1e7c,handleQuery)[_0x3274('0x1e')](function(_0x2f8d83){BPromise[_0x3274('0x22')]([handleAdditionalPhones()])[_0x3274('0x1e')](function(){_0xc1e7c=[];for(var _0x5c47e8=0x0;_0x5c47e8=_0x5bead1){return _0x4d4ec7[_0x7696('0x12')](0x193)[_0x7696('0x13')]({'message':util['format'](_0x7696('0x14'),_0xb13875)});}_0x387438();})['catch'](function(_0x3a67b5){_0x387438(_0x3a67b5);});});}function isUserLimit(){return isLimit(_0x7696('0x15'),0x1,db[_0x7696('0x16')],{'where':{'$or':[{'role':_0x7696('0x17')},{'role':_0x7696('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xef9a=['utf8','final','parse','hasOwnProperty','use','License','then','status','json','users','User','admin','user','isUserLimit','crypto','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','format','%s:%s:%s','update','base64'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xef9a,0x1ae));var _0xaef9=function(_0x4390c2,_0x35271a){_0x4390c2=_0x4390c2-0x0;var _0x3a02f0=_0xef9a[_0x4390c2];return _0x3a02f0;};'use strict';var crypto=require(_0xaef9('0x0'));var util=require('util');var compose=require(_0xaef9('0x1'));var db=require(_0xaef9('0x2'))['db'];var config=require(_0xaef9('0x3'));function getValueFromLicense(_0x400113,_0x221023){if(_0x400113&&_0x221023){if(_0x221023['data1']&&_0x221023['license']){var _0x2f6a23=_0x221023[_0xaef9('0x4')];var _0x433e36=_0x221023[_0xaef9('0x5')];var _0x477ea2=_0x2f6a23[_0xaef9('0x6')]('-')[0x4];var _0x361439=_0x2f6a23[_0xaef9('0x6')]('-')[0x0];var _0x22325f=crypto[_0xaef9('0x7')]('aes-256-ctr',util[_0xaef9('0x8')](_0xaef9('0x9'),_0x477ea2,_0x2f6a23,_0x361439));var _0xc35f19=_0x22325f[_0xaef9('0xa')](_0x433e36,_0xaef9('0xb'),_0xaef9('0xc'));_0xc35f19+=_0x22325f[_0xaef9('0xd')]('utf8');var _0x5d9a78=JSON[_0xaef9('0xe')](_0xc35f19);return _0x5d9a78[_0xaef9('0xf')](_0x400113)?_0x5d9a78[_0x400113]:null;}}return null;}function isLimit(_0x5a1eb1,_0x3485d1,_0x310e47,_0x7d0142){var _0x42f9e9=_0x3485d1;return compose()[_0xaef9('0x10')](function(_0x462edc,_0x5c953e,_0x356a9d){return db[_0xaef9('0x11')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x2c9890){var _0x11daaf=getValueFromLicense(_0x5a1eb1,_0x2c9890);return _0x11daaf?_0x11daaf:_0x42f9e9;})[_0xaef9('0x12')](function(_0x46e6b9){_0x42f9e9=_0x46e6b9;return _0x310e47['count'](_0x7d0142);})['then'](function(_0x883cda){if(_0x883cda>=_0x42f9e9){return _0x5c953e[_0xaef9('0x13')](0x193)[_0xaef9('0x14')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x5a1eb1)});}_0x356a9d();})['catch'](function(_0x3f83b0){_0x356a9d(_0x3f83b0);});});}function isUserLimit(){return isLimit(_0xaef9('0x15'),0x1,db[_0xaef9('0x16')],{'where':{'$or':[{'role':_0xaef9('0x17')},{'role':_0xaef9('0x18')}]}});}exports[_0xaef9('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 753976b..fc3e7af 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 _0xee52=['forEach','shift','match','filter','indexOf','map','conditions','push','DATE','operator','$eq','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','$substring','$between','pop','utcOffset','hours','seconds','moment','sqlOperator','startsWith','[$or]','replace','[$and]','split'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xee52,0x137));var _0x2ee5=function(_0x2bbbeb,_0x42a398){_0x2bbbeb=_0x2bbbeb-0x0;var _0x5d5a8a=_0xee52[_0x2bbbeb];return _0x5d5a8a;};'use strict';var _=require('lodash');var moment=require(_0x2ee5('0x0'));exports['parseSearch']=function(_0x284f60){var _0x351292={'conditions':[]};_0x351292[_0x2ee5('0x1')]=_[_0x2ee5('0x2')](_0x284f60,_0x2ee5('0x3'))?'or':'and';var _0x182c42=_0x284f60[_0x2ee5('0x4')](_0x2ee5('0x5'),'')[_0x2ee5('0x4')](_0x2ee5('0x3'),'')[_0x2ee5('0x6')]('||');for(var _0x5ce8f9=0x0;_0x5ce8f9<_0x182c42['length'];_0x5ce8f9++){var _0x3edeab=_0x182c42[_0x5ce8f9][_0x2ee5('0x6')](':=');var _0x525529=_0x3edeab[0x0];var _0x5a9a93=_0x3edeab['slice'](0x1);_0x5a9a93[_0x2ee5('0x7')](function(_0x5f1570){var _0x599810=_0x5f1570[_0x2ee5('0x6')]('[')[_0x2ee5('0x8')]();var _0x30fd41=_0x5f1570[_0x2ee5('0x9')](/\[(.*?)\]/g);_0x30fd41[_0x2ee5('0x7')](function(_0x17b200){var _0x3c3044=_0x17b200[_0x2ee5('0x6')]('[')[_0x2ee5('0xa')](function(_0x2ca367){return _0x2ca367[_0x2ee5('0xb')](']')>-0x1;})[_0x2ee5('0xc')](function(_0x4fc694){return _0x4fc694[_0x2ee5('0x6')](']')[0x0];})[0x0];_0x351292[_0x2ee5('0xd')][_0x2ee5('0xe')]({'field':_0x525529,'operator':_0x599810,'value':_0x3c3044});});});}return _0x351292;};exports['buildExpression']=function(_0x1bfcdd,_0x7fface,_0xe83832){var _0x58910e={};if(_0x7fface===_0x2ee5('0xf')){if(_0xe83832[_0x2ee5('0x10')]===_0x2ee5('0x11')){_0xe83832[_0x2ee5('0x10')]='$between';_0xe83832[_0x2ee5('0x12')]+=','+_0xe83832[_0x2ee5('0x12')];}else if(_[_0x2ee5('0x13')]([_0x2ee5('0x14'),_0x2ee5('0x15')],_0xe83832[_0x2ee5('0x10')])){_0xe83832[_0x2ee5('0x12')]=moment(_0xe83832[_0x2ee5('0x12')])[_0x2ee5('0x16')](0x1,_0x2ee5('0x17'))[_0x2ee5('0x18')](_0x2ee5('0x19'));}}if(_0xe83832[_0x2ee5('0x1a')]){_0x7fface=_0xe83832[_0x2ee5('0x1a')];_0x58910e[_0x2ee5('0x1b')]='CAST('+_0x1bfcdd+'.'+_0xe83832[_0x2ee5('0x1c')]+_0x2ee5('0x1d')+_0xe83832['castTo']+')\x20'+parseOperator(_0xe83832[_0x2ee5('0x10')]);}else{_0x58910e[_0x2ee5('0x1b')]=_0x1bfcdd+'.'+_0xe83832[_0x2ee5('0x1c')]+'\x20'+parseOperator(_0xe83832[_0x2ee5('0x10')]);}if(_[_0x2ee5('0x13')]([_0x2ee5('0x1e'),_0x2ee5('0x1f')],_0xe83832[_0x2ee5('0x10')]))_0x58910e['text']='('+_0x58910e[_0x2ee5('0x1b')]+_0x2ee5('0x20')+_0x1bfcdd+'.'+_0xe83832[_0x2ee5('0x1c')]+_0x2ee5('0x21');_0x58910e['value']=parseValue(_0x7fface,_0xe83832[_0x2ee5('0x10')],_0xe83832[_0x2ee5('0x12')]);return _0x58910e;};function parseOperator(_0x3f68cf){var _0x30565d;switch(_0x3f68cf){case'$in':_0x30565d=_0x2ee5('0x22');break;case'$notIn':_0x30565d=_0x2ee5('0x23');break;case'$eq':_0x30565d=_0x2ee5('0x24');break;case'$ne':_0x30565d=_0x2ee5('0x25');break;case'$substring':case _0x2ee5('0x26'):case _0x2ee5('0x27'):_0x30565d=_0x2ee5('0x28');break;case _0x2ee5('0x29'):_0x30565d=_0x2ee5('0x2a');break;case'$gt':_0x30565d='>\x20?';break;case _0x2ee5('0x15'):_0x30565d=_0x2ee5('0x2b');break;case _0x2ee5('0x2c'):_0x30565d='>=\x20?';break;case'$between':_0x30565d=_0x2ee5('0x2d');break;}return _0x30565d;}function parseValue(_0x1aac05,_0x51ba0e,_0x2d4a05){var _0x4451d3={'start':undefined,'end':undefined};switch(_0x51ba0e){case'$in':case'$notIn':_0x4451d3[_0x2ee5('0x2e')]=_0x2d4a05[_0x2ee5('0x6')](',');break;case _0x2ee5('0x2f'):_0x4451d3['start']='%'+_0x2d4a05+'%';break;case _0x2ee5('0x26'):_0x4451d3[_0x2ee5('0x2e')]=_0x2d4a05+'%';break;case _0x2ee5('0x27'):_0x4451d3[_0x2ee5('0x2e')]='%'+_0x2d4a05;break;case _0x2ee5('0x30'):var _0x394611=_0x2d4a05[_0x2ee5('0x6')](',');var _0x2d4a05=_0x394611[_0x2ee5('0x8')]();var _0x5496c2=_0x394611[_0x2ee5('0x31')]();if(_0x1aac05==='DATE'){_0x2d4a05=moment(_0x2d4a05)[_0x2ee5('0x32')](0x0,!![])[_0x2ee5('0x18')]();_0x5496c2=moment(_0x5496c2)['utcOffset'](0x0,!![])[_0x2ee5('0x16')](0x17,_0x2ee5('0x33'))[_0x2ee5('0x16')](0x3b,'minutes')[_0x2ee5('0x16')](0x3b,_0x2ee5('0x34'))['format']();}_0x4451d3={'start':_0x2d4a05,'end':_0x5496c2};break;default:_0x4451d3[_0x2ee5('0x2e')]=_0x2d4a05;break;}return _0x4451d3;} \ No newline at end of file +var _0x2f54=['seconds','format','lodash','sqlOperator','[$or]','and','[$and]','replace','split','length','shift','match','filter','conditions','buildExpression','DATE','operator','$eq','value','add','days','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','<\x20?','>\x20?','$lte','>=\x20?','$between','start','$startsWith','$endsWith','pop','utcOffset','minutes'];(function(_0x292a5f,_0x538c48){var _0x135b28=function(_0xb220c3){while(--_0xb220c3){_0x292a5f['push'](_0x292a5f['shift']());}};_0x135b28(++_0x538c48);}(_0x2f54,0x116));var _0x42f5=function(_0x14ee69,_0x436a8a){_0x14ee69=_0x14ee69-0x0;var _0x4d5664=_0x2f54[_0x14ee69];return _0x4d5664;};'use strict';var _=require(_0x42f5('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x5ab53d){var _0x22d798={'conditions':[]};_0x22d798[_0x42f5('0x1')]=_['startsWith'](_0x5ab53d,_0x42f5('0x2'))?'or':_0x42f5('0x3');var _0x35aac9=_0x5ab53d['replace'](_0x42f5('0x4'),'')[_0x42f5('0x5')]('[$or]','')[_0x42f5('0x6')]('||');for(var _0x1de875=0x0;_0x1de875<_0x35aac9[_0x42f5('0x7')];_0x1de875++){var _0x4f2778=_0x35aac9[_0x1de875][_0x42f5('0x6')](':=');var _0x36b3b3=_0x4f2778[0x0];var _0x162dd0=_0x4f2778['slice'](0x1);_0x162dd0['forEach'](function(_0x2eaf0e){var _0x46bbbc=_0x2eaf0e['split']('[')[_0x42f5('0x8')]();var _0x53eb27=_0x2eaf0e[_0x42f5('0x9')](/\[(.*?)\]/g);_0x53eb27['forEach'](function(_0x5932ca){var _0x4c6967=_0x5932ca['split']('[')[_0x42f5('0xa')](function(_0x1b0eaa){return _0x1b0eaa['indexOf'](']')>-0x1;})['map'](function(_0x25e223){return _0x25e223['split'](']')[0x0];})[0x0];_0x22d798[_0x42f5('0xb')]['push']({'field':_0x36b3b3,'operator':_0x46bbbc,'value':_0x4c6967});});});}return _0x22d798;};exports[_0x42f5('0xc')]=function(_0x14b32b,_0xa04209,_0x37fea3){var _0x32c5aa={};if(_0xa04209===_0x42f5('0xd')){if(_0x37fea3[_0x42f5('0xe')]===_0x42f5('0xf')){_0x37fea3[_0x42f5('0xe')]='$between';_0x37fea3[_0x42f5('0x10')]+=','+_0x37fea3[_0x42f5('0x10')];}else if(_['includes'](['$gt','$lte'],_0x37fea3[_0x42f5('0xe')])){_0x37fea3[_0x42f5('0x10')]=moment(_0x37fea3[_0x42f5('0x10')])[_0x42f5('0x11')](0x1,_0x42f5('0x12'))['format'](_0x42f5('0x13'));}}if(_0x37fea3[_0x42f5('0x14')]){_0xa04209=_0x37fea3[_0x42f5('0x14')];_0x32c5aa[_0x42f5('0x15')]=_0x42f5('0x16')+_0x14b32b+'.'+_0x37fea3[_0x42f5('0x17')]+_0x42f5('0x18')+_0x37fea3[_0x42f5('0x14')]+')\x20'+parseOperator(_0x37fea3[_0x42f5('0xe')]);}else{_0x32c5aa['text']=_0x14b32b+'.'+_0x37fea3['field']+'\x20'+parseOperator(_0x37fea3['operator']);}if(_['includes']([_0x42f5('0x19'),_0x42f5('0x1a')],_0x37fea3[_0x42f5('0xe')]))_0x32c5aa['text']='('+_0x32c5aa['text']+'\x20OR\x20'+_0x14b32b+'.'+_0x37fea3[_0x42f5('0x17')]+_0x42f5('0x1b');_0x32c5aa[_0x42f5('0x10')]=parseValue(_0xa04209,_0x37fea3['operator'],_0x37fea3[_0x42f5('0x10')]);return _0x32c5aa;};function parseOperator(_0xcd1f94){var _0x4643ab;switch(_0xcd1f94){case _0x42f5('0x1c'):_0x4643ab=_0x42f5('0x1d');break;case _0x42f5('0x1a'):_0x4643ab=_0x42f5('0x1e');break;case'$eq':_0x4643ab='=\x20?';break;case _0x42f5('0x19'):_0x4643ab=_0x42f5('0x1f');break;case _0x42f5('0x20'):case'$startsWith':case'$endsWith':_0x4643ab='LIKE\x20?';break;case'$lt':_0x4643ab=_0x42f5('0x21');break;case'$gt':_0x4643ab=_0x42f5('0x22');break;case _0x42f5('0x23'):_0x4643ab='<=\x20?';break;case'$gte':_0x4643ab=_0x42f5('0x24');break;case _0x42f5('0x25'):_0x4643ab='BETWEEN\x20?\x20AND\x20?';break;}return _0x4643ab;}function parseValue(_0xb2c27a,_0x37c3cf,_0x567be6){var _0x2d885d={'start':undefined,'end':undefined};switch(_0x37c3cf){case _0x42f5('0x1c'):case'$notIn':_0x2d885d[_0x42f5('0x26')]=_0x567be6[_0x42f5('0x6')](',');break;case _0x42f5('0x20'):_0x2d885d[_0x42f5('0x26')]='%'+_0x567be6+'%';break;case _0x42f5('0x27'):_0x2d885d[_0x42f5('0x26')]=_0x567be6+'%';break;case _0x42f5('0x28'):_0x2d885d[_0x42f5('0x26')]='%'+_0x567be6;break;case'$between':var _0x556ee4=_0x567be6[_0x42f5('0x6')](',');var _0x567be6=_0x556ee4[_0x42f5('0x8')]();var _0xdcee56=_0x556ee4[_0x42f5('0x29')]();if(_0xb2c27a===_0x42f5('0xd')){_0x567be6=moment(_0x567be6)[_0x42f5('0x2a')](0x0,!![])['format']();_0xdcee56=moment(_0xdcee56)[_0x42f5('0x2a')](0x0,!![])['add'](0x17,'hours')[_0x42f5('0x11')](0x3b,_0x42f5('0x2b'))[_0x42f5('0x11')](0x3b,_0x42f5('0x2c'))[_0x42f5('0x2d')]();}_0x2d885d={'start':_0x567be6,'end':_0xdcee56};break;default:_0x2d885d[_0x42f5('0x26')]=_0x567be6;break;}return _0x2d885d;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 7771106..1840674 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 _0xac7a=['isObject','isString','length','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','toString','join','lodash','sequelize','moment','fields','split','isEmpty','forOwn','find','type','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','$lte','subtract','isArray','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit'];(function(_0x2af160,_0x765b1){var _0x439d67=function(_0x4d26af){while(--_0x4d26af){_0x2af160['push'](_0x2af160['shift']());}};_0x439d67(++_0x765b1);}(_0xac7a,0x128));var _0xaac7=function(_0x52a61d,_0x16d3a5){_0x52a61d=_0x52a61d-0x0;var _0xfee081=_0xac7a[_0x52a61d];return _0xfee081;};'use strict';var _=require(_0xaac7('0x0'));var sequelize=require(_0xaac7('0x1'));var moment=require(_0xaac7('0x2'));var LIMIT_VALUE=0xfa;exports[_0xaac7('0x3')]=function(_0x442ee3){var _0x1afd00=null;if(_0x442ee3){_0x1afd00=_0x442ee3[_0xaac7('0x4')](',');}return _0x1afd00;};exports['filters']=function(_0xbf6ee6,_0x5bbe53){var _0x407b2d={};if(!_[_0xaac7('0x5')](_0xbf6ee6)){_[_0xaac7('0x6')](_0xbf6ee6,function(_0x3be7be,_0x2239bc){try{if(_0x5bbe53){var _0x381323=_[_0xaac7('0x7')](_0x5bbe53,{'name':_0x2239bc})||{};if(_0x381323[_0xaac7('0x8')]===_0xaac7('0x9')&&_[_0xaac7('0xa')](_0x3be7be)){var _0x249011=JSON[_0xaac7('0xb')](_0x3be7be);var _0xb38cdc={'$gte':moment(moment(_0x249011[_0xaac7('0xc')])[_0xaac7('0xd')](_0xaac7('0xe')))[_0xaac7('0xf')]()[_0xaac7('0xd')](),'$lte':moment(moment(_0x249011[_0xaac7('0x10')])[_0xaac7('0xd')](_0xaac7('0xe')))['utc']()[_0xaac7('0x11')](0x1,'s')[_0xaac7('0xd')]()};_0x407b2d[_0x2239bc]=_0xb38cdc;}else{_0x407b2d[_0x2239bc]=_[_0xaac7('0x12')](_0x3be7be)?_0x3be7be:JSON[_0xaac7('0xb')](_0x3be7be);}}else{_0x407b2d[_0x2239bc]=_['isArray'](_0x3be7be)?_0x3be7be:JSON['parse'](_0x3be7be);}}catch(_0x864f94){_0x407b2d[_0x2239bc]=_0x3be7be[_0xaac7('0x4')](',');}});}return _0x407b2d;};exports[_0xaac7('0x13')]=function(_0x1f6e62){_0x1f6e62=parseInt(_0x1f6e62,0xa);if(!_0x1f6e62||_0x1f6e62<0x0){_0x1f6e62=LIMIT_VALUE;}return _0x1f6e62;};exports[_0xaac7('0x14')]=function(_0xfbefaa){_0xfbefaa=parseInt(_0xfbefaa,0xa);if(!_0xfbefaa||_0xfbefaa<0x0){_0xfbefaa=0x0;}return _0xfbefaa;};exports[_0xaac7('0x15')]=function(_0x4eec65){var _0x5d4833,_0x1ae66a=null;if(_0x4eec65){_0x5d4833=_0x4eec65['split'](',');_0x1ae66a=_[_0xaac7('0x16')](_0x5d4833,function(_0x5637c8){if(_0x5637c8[_0xaac7('0x17')]('-')===0x0){return[_0x5637c8===_0xaac7('0x18')?sequelize[_0xaac7('0x19')](sequelize[_0xaac7('0x1a')]('priority'),_0xaac7('0x1b')):_0x5637c8[_0xaac7('0x1c')](0x1),_0xaac7('0x1d')];}else{return[_0x5637c8===_0xaac7('0x18')?sequelize['cast'](sequelize[_0xaac7('0x1a')](_0xaac7('0x18')),_0xaac7('0x1b')):_0x5637c8,_0xaac7('0x1e')];}});}return _0x1ae66a;};exports[_0xaac7('0x1f')]=function(_0x205ded,_0x33fffc){if(_['isEmpty'](_0x205ded)){return _0x205ded;}if(_[_0xaac7('0x12')](_0x205ded)){for(var _0x1be4f3=0x0;_0x1be4f3<_0x205ded['length'];_0x1be4f3+=0x1){_0x205ded[_0x1be4f3]=this[_0xaac7('0x1f')](_0x205ded[_0x1be4f3],_0x33fffc);}return _0x205ded;}if(!_[_0xaac7('0x20')](_0x205ded)){return _0x205ded;}if(_[_0xaac7('0x21')](_0x33fffc)){_0x33fffc=[_0x33fffc];}if(!_['isArray'](_0x33fffc)){return _0x205ded;}for(var _0x99121b=0x0;_0x99121b<_0x33fffc[_0xaac7('0x22')];_0x99121b+=0x1){_['unset'](_0x205ded,_0x33fffc[_0x99121b]);}for(var _0x1e2a4e in _0x205ded){if(_0x205ded['hasOwnProperty'](_0x1e2a4e)){_0x205ded[_0x1e2a4e]=this[_0xaac7('0x1f')](_0x205ded[_0x1e2a4e],_0x33fffc);}}return _0x205ded;};exports[_0xaac7('0x23')]=function(_0x3cd44f){return _0x3cd44f[_0xaac7('0x24')](RegExp(_0xaac7('0x25')))?!![]:![];};exports['isEmail']=function(_0xea2ed){return _0xea2ed['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xaac7('0x26')]=function(_0x1f2529){var _0x26b2b8=[];_0x1f2529[_0xaac7('0x4')]('\x20')['forEach'](function(_0x4547cf){_0x26b2b8['push']('+'+_0x4547cf[_0xaac7('0x27')]()+'*');});return _0x26b2b8[_0xaac7('0x28')]('\x20');}; \ No newline at end of file +var _0xe27e=['fields','split','filters','isEmpty','forOwn','DATE','$gte','format','YYYY-MM-DD','utc','isArray','parse','limit','offset','sort','map','indexOf','priority','unsigned','substr','omit','isObject','isString','length','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','push','toString','join','lodash','moment'];(function(_0x5813f9,_0x217784){var _0xc095ce=function(_0xd29077){while(--_0xd29077){_0x5813f9['push'](_0x5813f9['shift']());}};_0xc095ce(++_0x217784);}(_0xe27e,0xa8));var _0xee27=function(_0x2abaae,_0x29fd8b){_0x2abaae=_0x2abaae-0x0;var _0x5b5745=_0xe27e[_0x2abaae];return _0x5b5745;};'use strict';var _=require(_0xee27('0x0'));var sequelize=require('sequelize');var moment=require(_0xee27('0x1'));var LIMIT_VALUE=0xfa;exports[_0xee27('0x2')]=function(_0x25df99){var _0x1bb45d=null;if(_0x25df99){_0x1bb45d=_0x25df99[_0xee27('0x3')](',');}return _0x1bb45d;};exports[_0xee27('0x4')]=function(_0x36718b,_0x1f9d0c){var _0x5db5ad={};if(!_[_0xee27('0x5')](_0x36718b)){_[_0xee27('0x6')](_0x36718b,function(_0x3a19b0,_0x199a2e){try{if(_0x1f9d0c){var _0x4d16d6=_['find'](_0x1f9d0c,{'name':_0x199a2e})||{};if(_0x4d16d6['type']===_0xee27('0x7')&&_['isPlainObject'](_0x3a19b0)){var _0x4f69ca=JSON['parse'](_0x3a19b0);var _0x443603={'$gte':moment(moment(_0x4f69ca[_0xee27('0x8')])[_0xee27('0x9')](_0xee27('0xa')))[_0xee27('0xb')]()[_0xee27('0x9')](),'$lte':moment(moment(_0x4f69ca['$lte'])[_0xee27('0x9')]('YYYY-MM-DD'))[_0xee27('0xb')]()['subtract'](0x1,'s')['format']()};_0x5db5ad[_0x199a2e]=_0x443603;}else{_0x5db5ad[_0x199a2e]=_[_0xee27('0xc')](_0x3a19b0)?_0x3a19b0:JSON[_0xee27('0xd')](_0x3a19b0);}}else{_0x5db5ad[_0x199a2e]=_[_0xee27('0xc')](_0x3a19b0)?_0x3a19b0:JSON[_0xee27('0xd')](_0x3a19b0);}}catch(_0x333884){_0x5db5ad[_0x199a2e]=_0x3a19b0[_0xee27('0x3')](',');}});}return _0x5db5ad;};exports[_0xee27('0xe')]=function(_0x4e569b){_0x4e569b=parseInt(_0x4e569b,0xa);if(!_0x4e569b||_0x4e569b<0x0){_0x4e569b=LIMIT_VALUE;}return _0x4e569b;};exports[_0xee27('0xf')]=function(_0x27a20d){_0x27a20d=parseInt(_0x27a20d,0xa);if(!_0x27a20d||_0x27a20d<0x0){_0x27a20d=0x0;}return _0x27a20d;};exports[_0xee27('0x10')]=function(_0x12963e){var _0x18b0a8,_0x1425c4=null;if(_0x12963e){_0x18b0a8=_0x12963e[_0xee27('0x3')](',');_0x1425c4=_[_0xee27('0x11')](_0x18b0a8,function(_0x218725){if(_0x218725[_0xee27('0x12')]('-')===0x0){return[_0x218725===_0xee27('0x13')?sequelize['cast'](sequelize['col']('priority'),_0xee27('0x14')):_0x218725[_0xee27('0x15')](0x1),'DESC'];}else{return[_0x218725===_0xee27('0x13')?sequelize['cast'](sequelize['col'](_0xee27('0x13')),_0xee27('0x14')):_0x218725,'ASC'];}});}return _0x1425c4;};exports[_0xee27('0x16')]=function(_0x463dd5,_0x25b16f){if(_['isEmpty'](_0x463dd5)){return _0x463dd5;}if(_[_0xee27('0xc')](_0x463dd5)){for(var _0x22084b=0x0;_0x22084b<_0x463dd5['length'];_0x22084b+=0x1){_0x463dd5[_0x22084b]=this[_0xee27('0x16')](_0x463dd5[_0x22084b],_0x25b16f);}return _0x463dd5;}if(!_[_0xee27('0x17')](_0x463dd5)){return _0x463dd5;}if(_[_0xee27('0x18')](_0x25b16f)){_0x25b16f=[_0x25b16f];}if(!_[_0xee27('0xc')](_0x25b16f)){return _0x463dd5;}for(var _0x96119c=0x0;_0x96119c<_0x25b16f[_0xee27('0x19')];_0x96119c+=0x1){_['unset'](_0x463dd5,_0x25b16f[_0x96119c]);}for(var _0x4ff593 in _0x463dd5){if(_0x463dd5[_0xee27('0x1a')](_0x4ff593)){_0x463dd5[_0x4ff593]=this[_0xee27('0x16')](_0x463dd5[_0x4ff593],_0x25b16f);}}return _0x463dd5;};exports[_0xee27('0x1b')]=function(_0x5a15df){return _0x5a15df[_0xee27('0x1c')](RegExp(_0xee27('0x1d')))?!![]:![];};exports[_0xee27('0x1e')]=function(_0x46cc7a){return _0x46cc7a[_0xee27('0x1c')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x4c87a5){var _0x323660=[];_0x4c87a5['split']('\x20')['forEach'](function(_0x3ef660){_0x323660[_0xee27('0x1f')]('+'+_0x3ef660[_0xee27('0x20')]()+'*');});return _0x323660[_0xee27('0x21')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index a7e85df..4a73168 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1405=['/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','express','body-parser','cookie-parser','errorhandler','passport','default','get','env','production','development','set','join','root','client','use','json\x20replacer','toISOString','static','appPath','views'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x1405,0x64));var _0x5140=function(_0x2c3903,_0x31042d){_0x2c3903=_0x2c3903-0x0;var _0x490986=_0x1405[_0x2c3903];return _0x490986;};'use strict';var express=require(_0x5140('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x5140('0x1'));var methodOverride=require('method-override');var cookieParser=require(_0x5140('0x2'));var errorHandler=require(_0x5140('0x3'));var path=require('path');var passport=require(_0x5140('0x4'));var cors=require('cors');var moment=require('moment');var config=require('./environment');var db=require('../mysqldb')['db'];exports[_0x5140('0x5')]=function(_0x4607ff){var _0x2629bc=_0x4607ff[_0x5140('0x6')](_0x5140('0x7'));if(_0x2629bc===_0x5140('0x8')){_0x4607ff['set']('appPath',path['join'](config['root'],'public'));}if(_0x2629bc===_0x5140('0x9')||_0x2629bc==='test'){_0x4607ff[_0x5140('0xa')]('appPath',path[_0x5140('0xb')](config[_0x5140('0xc')],_0x5140('0xd')));_0x4607ff[_0x5140('0xe')](errorHandler());}_0x4607ff[_0x5140('0xa')](_0x5140('0xf'),function(_0x324d16,_0x481912){if(this[_0x324d16]instanceof Date){_0x481912=this[_0x324d16][_0x5140('0x10')]()['split']('.')[0x0]+'Z';}return _0x481912;});_0x4607ff[_0x5140('0xe')](express[_0x5140('0x11')](_0x4607ff['get'](_0x5140('0x12'))));_0x4607ff['set'](_0x5140('0x13'),config[_0x5140('0xc')]+_0x5140('0x14'));_0x4607ff[_0x5140('0x15')](_0x5140('0x16'),require(_0x5140('0x17'))[_0x5140('0x18')]);_0x4607ff[_0x5140('0xa')](_0x5140('0x19'),_0x5140('0x16'));_0x4607ff[_0x5140('0xe')](bodyParser[_0x5140('0x1a')]({'limit':_0x5140('0x1b'),'extended':!![]}));_0x4607ff[_0x5140('0xe')](bodyParser[_0x5140('0x1c')]({'limit':'50mb'}));_0x4607ff[_0x5140('0xe')](cors());_0x4607ff[_0x5140('0xe')](methodOverride());_0x4607ff[_0x5140('0xe')](cookieParser());_0x4607ff[_0x5140('0xe')](passport[_0x5140('0x1d')]());}; \ No newline at end of file +var _0x068a=['html','ejs','renderFile','view\x20engine','urlencoded','json','initialize','express','serve-favicon','body-parser','method-override','passport','./environment','../mysqldb','default','get','env','production','join','root','public','development','test','set','client','use','json\x20replacer','toISOString','split','static','appPath','views','engine'];(function(_0x41d588,_0x121a75){var _0x2ba9ae=function(_0x2a34cd){while(--_0x2a34cd){_0x41d588['push'](_0x41d588['shift']());}};_0x2ba9ae(++_0x121a75);}(_0x068a,0x130));var _0xa068=function(_0x915635,_0x50233f){_0x915635=_0x915635-0x0;var _0x154584=_0x068a[_0x915635];return _0x154584;};'use strict';var express=require(_0xa068('0x0'));var favicon=require(_0xa068('0x1'));var bodyParser=require(_0xa068('0x2'));var methodOverride=require(_0xa068('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0xa068('0x4'));var cors=require('cors');var moment=require('moment');var config=require(_0xa068('0x5'));var db=require(_0xa068('0x6'))['db'];exports[_0xa068('0x7')]=function(_0x1d0df7){var _0x16eddb=_0x1d0df7[_0xa068('0x8')](_0xa068('0x9'));if(_0x16eddb===_0xa068('0xa')){_0x1d0df7['set']('appPath',path[_0xa068('0xb')](config[_0xa068('0xc')],_0xa068('0xd')));}if(_0x16eddb===_0xa068('0xe')||_0x16eddb===_0xa068('0xf')){_0x1d0df7[_0xa068('0x10')]('appPath',path[_0xa068('0xb')](config['root'],_0xa068('0x11')));_0x1d0df7[_0xa068('0x12')](errorHandler());}_0x1d0df7['set'](_0xa068('0x13'),function(_0x3d94bf,_0x1272da){if(this[_0x3d94bf]instanceof Date){_0x1272da=this[_0x3d94bf][_0xa068('0x14')]()[_0xa068('0x15')]('.')[0x0]+'Z';}return _0x1272da;});_0x1d0df7[_0xa068('0x12')](express[_0xa068('0x16')](_0x1d0df7[_0xa068('0x8')](_0xa068('0x17'))));_0x1d0df7[_0xa068('0x10')](_0xa068('0x18'),config[_0xa068('0xc')]+'/server/views');_0x1d0df7[_0xa068('0x19')](_0xa068('0x1a'),require(_0xa068('0x1b'))[_0xa068('0x1c')]);_0x1d0df7['set'](_0xa068('0x1d'),_0xa068('0x1a'));_0x1d0df7[_0xa068('0x12')](bodyParser[_0xa068('0x1e')]({'limit':'50mb','extended':!![]}));_0x1d0df7[_0xa068('0x12')](bodyParser[_0xa068('0x1f')]({'limit':'50mb'}));_0x1d0df7[_0xa068('0x12')](cors());_0x1d0df7[_0xa068('0x12')](methodOverride());_0x1d0df7[_0xa068('0x12')](cookieParser());_0x1d0df7[_0xa068('0x12')](passport[_0xa068('0x20')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index ebb242e..c78c679 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 _0x979e=['ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','networkInterfaces','orderBy','filter','family','IPv4','internal','concat','head','mac','address','127.0.0.1','cpus','map','model','join','createHash','update','digest','hex','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress'];(function(_0x12b650,_0x3c6ae0){var _0x2f963b=function(_0x21c91c){while(--_0x21c91c){_0x12b650['push'](_0x12b650['shift']());}};_0x2f963b(++_0x3c6ae0);}(_0x979e,0x195));var _0xe979=function(_0x79cadf,_0x339aae){_0x79cadf=_0x79cadf-0x0;var _0x5cc032=_0x979e[_0x79cadf];return _0x5cc032;};'use strict';var _=require(_0xe979('0x0'));var os=require('os');var crypto=require(_0xe979('0x1'));var machine=require(_0xe979('0x2'));var exec=require(_0xe979('0x3'))['execSync'];function getInterfaces(){var _0x10fb90=[];var _0x47321a=os[_0xe979('0x4')]();var _0x3b4b06=_[_0xe979('0x5')](_['keys'](_0x47321a));for(var _0x19f988=0x0;_0x19f988<_0x3b4b06['length'];_0x19f988++){var _0x1a0d35=_0x47321a[_0x3b4b06[_0x19f988]][_0xe979('0x6')](function(_0x441ffe){return _0x441ffe[_0xe979('0x7')]===_0xe979('0x8')&&_0x441ffe[_0xe979('0x9')]===![];});_0x10fb90=_0x10fb90[_0xe979('0xa')](_0x1a0d35);}return _0x10fb90;}function getFirstInterface(){var _0x29a97c=_[_0xe979('0xb')](getInterfaces());return{'macAddress':_0x29a97c&&_0x29a97c[_0xe979('0xc')]?_0x29a97c[_0xe979('0xc')]:'00:00:00:00:00:00','ipAddress':_0x29a97c&&_0x29a97c[_0xe979('0xd')]?_0x29a97c[_0xe979('0xd')]:_0xe979('0xe')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x18fe2b=_[_0xe979('0x5')](os[_0xe979('0xf')]()[_0xe979('0x10')](function(_0x2f76cb){return _0x2f76cb[_0xe979('0x11')];}))[_0xe979('0x12')](':');return crypto[_0xe979('0x13')]('md5')[_0xe979('0x14')](_0x18fe2b)[_0xe979('0x15')](_0xe979('0x16'));}exports['getUuid']=function(){switch(os['platform']()){case _0xe979('0x17'):return exec(_0xe979('0x18'),{'encoding':_0xe979('0x19')})[_0xe979('0x1a')]('\x0d\x0a','');default:var _0x49de62=getFirstInterface();var _0x10ed22=getCPUhash();var _0x93e48c=_0x10ed22+'|'+os[_0xe979('0x1b')]()+'|'+_0x49de62[_0xe979('0x1c')]+'|'+_0x49de62[_0xe979('0x1d')];var _0x2d6892=crypto[_0xe979('0x13')]('md5')[_0xe979('0x14')](_0x93e48c)['digest']('hex');return _0x2d6892[_0xe979('0x1e')](0x0,0x8)+'-'+_0x2d6892[_0xe979('0x1e')](0x8,0xc)+'-'+_0x2d6892[_0xe979('0x1e')](0xc,0x10)+'-'+_0x2d6892[_0xe979('0x1e')](0x10,0x14)+'-'+_0x2d6892['substring'](0x14);}}; \ No newline at end of file +var _0x1c9a=['IPv4','internal','concat','head','mac','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','child_process','execSync','networkInterfaces','orderBy','length','filter','family'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0xf2c7be,_0x7ac190){_0xf2c7be=_0xf2c7be-0x0;var _0x238d0a=_0x1c9a[_0xf2c7be];return _0x238d0a;};'use strict';var _=require(_0xa1c9('0x0'));var os=require('os');var crypto=require(_0xa1c9('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0xa1c9('0x2'))[_0xa1c9('0x3')];function getInterfaces(){var _0x38c48f=[];var _0x408418=os[_0xa1c9('0x4')]();var _0x4a0d3d=_[_0xa1c9('0x5')](_['keys'](_0x408418));for(var _0x1716cb=0x0;_0x1716cb<_0x4a0d3d[_0xa1c9('0x6')];_0x1716cb++){var _0x237862=_0x408418[_0x4a0d3d[_0x1716cb]][_0xa1c9('0x7')](function(_0x1a0364){return _0x1a0364[_0xa1c9('0x8')]===_0xa1c9('0x9')&&_0x1a0364[_0xa1c9('0xa')]===![];});_0x38c48f=_0x38c48f[_0xa1c9('0xb')](_0x237862);}return _0x38c48f;}function getFirstInterface(){var _0xfab70b=_[_0xa1c9('0xc')](getInterfaces());return{'macAddress':_0xfab70b&&_0xfab70b[_0xa1c9('0xd')]?_0xfab70b['mac']:'00:00:00:00:00:00','ipAddress':_0xfab70b&&_0xfab70b[_0xa1c9('0xe')]?_0xfab70b['address']:_0xa1c9('0xf')};}exports[_0xa1c9('0x10')]=getFirstInterface;function getCPUhash(){var _0x20493a=_[_0xa1c9('0x5')](os[_0xa1c9('0x11')]()[_0xa1c9('0x12')](function(_0x390bd3){return _0x390bd3[_0xa1c9('0x13')];}))[_0xa1c9('0x14')](':');return crypto[_0xa1c9('0x15')](_0xa1c9('0x16'))[_0xa1c9('0x17')](_0x20493a)[_0xa1c9('0x18')](_0xa1c9('0x19'));}exports[_0xa1c9('0x1a')]=function(){switch(os[_0xa1c9('0x1b')]()){case _0xa1c9('0x1c'):return exec(_0xa1c9('0x1d'),{'encoding':_0xa1c9('0x1e')})[_0xa1c9('0x1f')]('\x0d\x0a','');default:var _0x59463b=getFirstInterface();var _0x391c97=getCPUhash();var _0x5a9d3a=_0x391c97+'|'+os[_0xa1c9('0x20')]()+'|'+_0x59463b[_0xa1c9('0x21')]+'|'+_0x59463b[_0xa1c9('0x22')];var _0xcce312=crypto[_0xa1c9('0x15')](_0xa1c9('0x16'))[_0xa1c9('0x17')](_0x5a9d3a)[_0xa1c9('0x18')](_0xa1c9('0x19'));return _0xcce312[_0xa1c9('0x23')](0x0,0x8)+'-'+_0xcce312[_0xa1c9('0x23')](0x8,0xc)+'-'+_0xcce312[_0xa1c9('0x23')](0xc,0x10)+'-'+_0xcce312['substring'](0x10,0x14)+'-'+_0xcce312[_0xa1c9('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 869d892..9abedef 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 _0x6796=['DEMO\x20START\x20AT\x20%s','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','version','../../mysqldb','../../components/encryptor','../logger','license','../../api/jira/jira.controller','process','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','|machineUuid|','|email|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','email','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','data1','uuid','YYYY-MM-DD\x20HH:mm','diff','decryptString','days'];(function(_0x4cfcac,_0x15c257){var _0x2e691d=function(_0x62bcbb){while(--_0x62bcbb){_0x4cfcac['push'](_0x4cfcac['shift']());}};_0x2e691d(++_0x15c257);}(_0x6796,0x1b1));var _0x6679=function(_0x6a0266,_0x1552d6){_0x6a0266=_0x6a0266-0x0;var _0x309e00=_0x6796[_0x6a0266];return _0x309e00;};'use strict';var util=require(_0x6679('0x0'));var moment=require(_0x6679('0x1'));var rp=require(_0x6679('0x2'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0x6679('0x3'));var db=require(_0x6679('0x4'))['db'];var encryptor=require(_0x6679('0x5'));var hardware=require('./hardware');var logger=require(_0x6679('0x6'))(_0x6679('0x7'));var jira=require(_0x6679('0x8'));const {config}=require(_0x6679('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x1a8fff){return new BPromise(function(_0x6fd25d,_0xfd39d4){var _0x3f2c1d=util[_0x6679('0xa')]('%s/api/servers/%s/check?version=%s',HOST,_0x1a8fff,module[_0x6679('0xb')]['version']);if(oldToken){_0x3f2c1d=util[_0x6679('0xa')](_0x6679('0xc'),HOST,_0x1a8fff,module['exports']['version'],oldToken);}var _0x3c6c95={'uri':_0x3f2c1d,'method':_0x6679('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x3c6c95)[_0x6679('0xe')](function(_0x3ef36e){_0x6fd25d(_0x3ef36e);})[_0x6679('0xf')](function(_0x4f097b){_0xfd39d4(_0x4f097b);});});}function sendJiraAlert(_0x43d429,_0x52c57e,_0x106e9f){var _0x5996e5=_0x6679('0x10');return db[_0x6679('0x11')][_0x6679('0x12')]({'where':{'role':_0x6679('0x13')},'attributes':[_0x6679('0x14'),'email'],'raw':!![]})[_0x6679('0xe')](function(_0x2356b0){ADMIN=_0x2356b0;_0x5996e5+='|reason|'+_0x106e9f+'|\x0a';_0x5996e5+='|uuid|'+_0x43d429+'|\x0a';_0x5996e5+=_0x6679('0x15')+_0x52c57e+'|\x0a';_0x5996e5+='|name|'+ADMIN['fullname']+'|\x0a';_0x5996e5+=_0x6679('0x16')+ADMIN['email']+'|\x0a';return _0x5996e5;})[_0x6679('0xe')](function(_0x35263d){var _0x1ac1a7=hardware[_0x6679('0x17')]()[_0x6679('0x18')];return jira[_0x6679('0x19')]({'key':_0x6679('0x1a'),'summary':_0x6679('0x1b'),'description':_0x35263d,'issuetype':_0x6679('0x1c'),'oldToken':_0x43d429,'newToken':_0x52c57e,'email':ADMIN[_0x6679('0x1d')],'name':ADMIN[_0x6679('0x14')],'reason':GRAY_PERIOD_REASON,'ip':_0x1ac1a7});});}function manageLicense(_0x39b8e9,_0x2f527b){var _0x5e2728=_0x2f527b['get']({'plain':!![]});httpRequest(_0x39b8e9)[_0x6679('0xe')](function(_0x128e74){if(oldToken){oldToken=undefined;}if(_0x128e74[_0x6679('0x1e')]){if(!_0x5e2728[_0x6679('0x7')]&&_0x5e2728[_0x6679('0x7')]!=_0x128e74['license']||_0x5e2728[_0x6679('0x7')]&&_0x5e2728[_0x6679('0x1f')]){logger[_0x6679('0x20')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x5e2728['license']&&!_0x5e2728[_0x6679('0x1f')]&&_0x5e2728[_0x6679('0x7')]!=_0x128e74['license']){logger[_0x6679('0x20')](_0x6679('0x21'));}if(_0x5e2728['license']&&!_0x5e2728[_0x6679('0x1f')]&&_0x5e2728[_0x6679('0x7')]==_0x128e74[_0x6679('0x7')]){return _0x2f527b;}return _0x2f527b[_0x6679('0x22')]({'data1':_0x39b8e9,'data2':null,'license':_0x128e74[_0x6679('0x7')]});}else{if(_0x128e74[_0x6679('0x7')]||_0x5e2728['license']){if(!_0x5e2728['data2']){if(_0x5e2728['data1']==_0x39b8e9){GRAY_PERIOD_REASON=_0x6679('0x23');logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x6679('0x24');oldToken=_0x5e2728['data1'];logger[_0x6679('0x20')](_0x6679('0x25'),_0x5e2728[_0x6679('0x26')],_0x39b8e9);}sendJiraAlert(_0x5e2728[_0x6679('0x26')],_0x128e74[_0x6679('0x27')],GRAY_PERIOD_REASON);logger[_0x6679('0x20')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0x6679('0x28')));return _0x2f527b[_0x6679('0x22')]({'data2':encryptor['encryptString'](moment()['format'](_0x6679('0x28')))});}else{if(moment()[_0x6679('0x29')](encryptor[_0x6679('0x2a')](_0x5e2728[_0x6679('0x1f')]),_0x6679('0x2b'))>DAYS){logger[_0x6679('0x20')](_0x6679('0x2c'),moment()[_0x6679('0xa')](_0x6679('0x28')));return _0x2f527b[_0x6679('0x22')]({'data1':_0x39b8e9,'data2':null,'license':null});}}}else{if(_0x5e2728[_0x6679('0x26')]!=_0x39b8e9){logger[_0x6679('0x20')](_0x6679('0x25'),_0x5e2728[_0x6679('0x26')],_0x39b8e9);return _0x2f527b[_0x6679('0x22')]({'data1':_0x39b8e9,'data2':null,'license':null});}}}return _0x2f527b;})[_0x6679('0xe')](function(_0x4e2795){_0x2f527b=_0x4e2795;})['catch'](function(_0x54b721){logger[_0x6679('0x2d')](_0x54b721[_0x6679('0x2e')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x6679('0x2f')](),_0x2f527b);},TIME);});}function defaultLicense(){var _0x493d48=hardware[_0x6679('0x2f')]();if(_0x493d48){return db[_0x6679('0x30')][_0x6679('0x31')]({'where':{'id':0x1},'defaults':{'data1':_0x493d48}})[_0x6679('0x32')](function(_0x279e57,_0x436644){logger[_0x6679('0x20')](_0x6679('0x33'),_0x493d48);manageLicense(_0x493d48,_0x279e57);})['catch'](function(_0x9c3aec){logger[_0x6679('0x2d')](_0x9c3aec[_0x6679('0x2e')]);});}}exports[_0x6679('0x34')]=defaultLicense; \ No newline at end of file +var _0xbedf=['|reason|','|uuid|','|machineUuid|','|name|','fullname','|email|','getFirstInterface','ipAddress','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','data1','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','pkginfo','../../components/encryptor','./hardware','../logger','license','../../api/jira/jira.controller','process','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','||FIELD||VALUE||\x0a','User','findOne','admin','email','then'];(function(_0x5ddf37,_0x1f7aef){var _0x543cd9=function(_0x393224){while(--_0x393224){_0x5ddf37['push'](_0x5ddf37['shift']());}};_0x543cd9(++_0x1f7aef);}(_0xbedf,0x151));var _0xfbed=function(_0x2b8722,_0x50d540){_0x2b8722=_0x2b8722-0x0;var _0x20c180=_0xbedf[_0x2b8722];return _0x20c180;};'use strict';var util=require(_0xfbed('0x0'));var moment=require(_0xfbed('0x1'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0xfbed('0x2'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0xfbed('0x3'));var hardware=require(_0xfbed('0x4'));var logger=require(_0xfbed('0x5'))(_0xfbed('0x6'));var jira=require(_0xfbed('0x7'));const {config}=require(_0xfbed('0x8'));var HOST=_0xfbed('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x4e4aa4){return new BPromise(function(_0x1847e0,_0x249d1e){var _0x2844a4=util[_0xfbed('0xa')](_0xfbed('0xb'),HOST,_0x4e4aa4,module[_0xfbed('0xc')][_0xfbed('0xd')]);if(oldToken){_0x2844a4=util[_0xfbed('0xa')](_0xfbed('0xe'),HOST,_0x4e4aa4,module[_0xfbed('0xc')]['version'],oldToken);}var _0x5cfadc={'uri':_0x2844a4,'method':_0xfbed('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x5cfadc)['then'](function(_0x1e1e2e){_0x1847e0(_0x1e1e2e);})[_0xfbed('0x10')](function(_0x3c5297){_0x249d1e(_0x3c5297);});});}function sendJiraAlert(_0x21394b,_0x266c1a,_0x11fd9e){var _0x57edb3=_0xfbed('0x11');return db[_0xfbed('0x12')][_0xfbed('0x13')]({'where':{'role':_0xfbed('0x14')},'attributes':['fullname',_0xfbed('0x15')],'raw':!![]})[_0xfbed('0x16')](function(_0x3d92d9){ADMIN=_0x3d92d9;_0x57edb3+=_0xfbed('0x17')+_0x11fd9e+'|\x0a';_0x57edb3+=_0xfbed('0x18')+_0x21394b+'|\x0a';_0x57edb3+=_0xfbed('0x19')+_0x266c1a+'|\x0a';_0x57edb3+=_0xfbed('0x1a')+ADMIN[_0xfbed('0x1b')]+'|\x0a';_0x57edb3+=_0xfbed('0x1c')+ADMIN[_0xfbed('0x15')]+'|\x0a';return _0x57edb3;})['then'](function(_0x40e2ee){var _0x1f94fe=hardware[_0xfbed('0x1d')]()[_0xfbed('0x1e')];return jira['openIssue']({'key':_0xfbed('0x1f'),'summary':_0xfbed('0x20'),'description':_0x40e2ee,'issuetype':_0xfbed('0x21'),'oldToken':_0x21394b,'newToken':_0x266c1a,'email':ADMIN[_0xfbed('0x15')],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x1f94fe});});}function manageLicense(_0x533956,_0x1d17d5){var _0x135973=_0x1d17d5[_0xfbed('0x22')]({'plain':!![]});httpRequest(_0x533956)['then'](function(_0x1b3b55){if(oldToken){oldToken=undefined;}if(_0x1b3b55[_0xfbed('0x23')]){if(!_0x135973[_0xfbed('0x6')]&&_0x135973[_0xfbed('0x6')]!=_0x1b3b55[_0xfbed('0x6')]||_0x135973[_0xfbed('0x6')]&&_0x135973['data2']){logger[_0xfbed('0x24')](_0xfbed('0x25'));}if(_0x135973[_0xfbed('0x6')]&&!_0x135973[_0xfbed('0x26')]&&_0x135973['license']!=_0x1b3b55[_0xfbed('0x6')]){logger[_0xfbed('0x24')](_0xfbed('0x27'));}if(_0x135973['license']&&!_0x135973[_0xfbed('0x26')]&&_0x135973['license']==_0x1b3b55['license']){return _0x1d17d5;}return _0x1d17d5[_0xfbed('0x28')]({'data1':_0x533956,'data2':null,'license':_0x1b3b55[_0xfbed('0x6')]});}else{if(_0x1b3b55[_0xfbed('0x6')]||_0x135973[_0xfbed('0x6')]){if(!_0x135973['data2']){if(_0x135973['data1']==_0x533956){GRAY_PERIOD_REASON='Disabled';logger[_0xfbed('0x24')](_0xfbed('0x29'));}else{GRAY_PERIOD_REASON=_0xfbed('0x2a');oldToken=_0x135973[_0xfbed('0x2b')];logger['info'](_0xfbed('0x2c'),_0x135973['data1'],_0x533956);}sendJiraAlert(_0x135973[_0xfbed('0x2b')],_0x1b3b55[_0xfbed('0x2d')],GRAY_PERIOD_REASON);logger[_0xfbed('0x24')](_0xfbed('0x2e'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xfbed('0xa')](_0xfbed('0x2f')));return _0x1d17d5['update']({'data2':encryptor['encryptString'](moment()[_0xfbed('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xfbed('0x30')](encryptor[_0xfbed('0x31')](_0x135973[_0xfbed('0x26')]),_0xfbed('0x32'))>DAYS){logger[_0xfbed('0x24')]('DEMO\x20START\x20AT\x20%s',moment()['format'](_0xfbed('0x2f')));return _0x1d17d5[_0xfbed('0x28')]({'data1':_0x533956,'data2':null,'license':null});}}}else{if(_0x135973[_0xfbed('0x2b')]!=_0x533956){logger['info'](_0xfbed('0x2c'),_0x135973['data1'],_0x533956);return _0x1d17d5[_0xfbed('0x28')]({'data1':_0x533956,'data2':null,'license':null});}}}return _0x1d17d5;})[_0xfbed('0x16')](function(_0x3a32c6){_0x1d17d5=_0x3a32c6;})['catch'](function(_0xc1979f){logger[_0xfbed('0x33')](_0xc1979f[_0xfbed('0x34')]);})[_0xfbed('0x35')](function(){setTimeout(function(){manageLicense(hardware[_0xfbed('0x36')](),_0x1d17d5);},TIME);});}function defaultLicense(){var _0x24ba6b=hardware[_0xfbed('0x36')]();if(_0x24ba6b){return db[_0xfbed('0x37')][_0xfbed('0x38')]({'where':{'id':0x1},'defaults':{'data1':_0x24ba6b}})[_0xfbed('0x39')](function(_0x583584,_0x9a7b00){logger['info'](_0xfbed('0x3a'),_0x24ba6b);manageLicense(_0x24ba6b,_0x583584);})['catch'](function(_0x5322f3){logger[_0xfbed('0x33')](_0x5322f3[_0xfbed('0x34')]);});}}exports[_0xfbed('0x3b')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 2590799..d3a6e6c 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 _0x0e5f=['../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','defaults','then','data1','license','data2','split','decryptString','parse','demo','uuid','machineUuid','gray','add','days','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','forEach','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird'];(function(_0x14fce2,_0x4707ae){var _0x2f712e=function(_0x3728bc){while(--_0x3728bc){_0x14fce2['push'](_0x14fce2['shift']());}};_0x2f712e(++_0x4707ae);}(_0x0e5f,0x165));var _0xf0e5=function(_0x325fce,_0x4ebd67){_0x325fce=_0x325fce-0x0;var _0xd50e45=_0x0e5f[_0x325fce];return _0xd50e45;};'use strict';var util=require(_0xf0e5('0x0'));var _=require('lodash');var moment=require(_0xf0e5('0x1'));var BPromise=require(_0xf0e5('0x2'));var hardware=require('./hardware');var encryptor=require(_0xf0e5('0x3'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf0e5('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xf0e5('0x5'),'machineUuid':hardware[_0xf0e5('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf0e5('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xf0e5('0x7'),'machineUuid':hardware[_0xf0e5('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x36aeff){return new BPromise(function(_0x14516e,_0x355f5f){return db[_0xf0e5('0x8')]['find'](_[_0xf0e5('0x9')](_0x36aeff,{'raw':!![],'where':{'id':0x1}}))[_0xf0e5('0xa')](function(_0x87491b){return checkLicense(_0x87491b,null);})[_0xf0e5('0xa')](function(_0x3aba99){_0x14516e(_0x3aba99);return;})['catch'](function(_0x4ff273){_0x355f5f(_0x4ff273);});});}function checkLicense(_0x13854e,_0x1d2ee0){if(!_0x13854e){demoLicense['uuid']=_0x13854e[_0xf0e5('0xb')];return demoLicense;}try{var _0x29a4fe=_0x1d2ee0||_0x13854e[_0xf0e5('0xc')];if(_['isEmpty'](_0x29a4fe)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x402c4c=_0x13854e[_0xf0e5('0xb')];var _0xe4a738=_0x13854e[_0xf0e5('0xd')];var _0x43ecbe=_0x402c4c[_0xf0e5('0xe')]('-')[0x4];var _0x17f02d=_0x402c4c[_0xf0e5('0xe')]('-')[0x0];var _0x41f652=encryptor[_0xf0e5('0xf')](_0x29a4fe,util['format']('%s:%s:%s',_0x43ecbe,_0x402c4c,_0x17f02d));var _0x5f1cb0=JSON[_0xf0e5('0x10')](_0x41f652);_0x5f1cb0[_0xf0e5('0x11')]=![];_0x5f1cb0[_0xf0e5('0x12')]=_0x402c4c;_0x5f1cb0[_0xf0e5('0x13')]=hardware[_0xf0e5('0x6')]();if(_0xe4a738){var _0x3ff60d=encryptor[_0xf0e5('0xf')](_0xe4a738);_0x5f1cb0[_0xf0e5('0x14')]=_0x3ff60d;_0x5f1cb0['deadline']=moment(_0x3ff60d)[_0xf0e5('0x15')](0x7,_0xf0e5('0x16'))['format']();_0x5f1cb0['grayReason']=_0x5f1cb0[_0xf0e5('0x12')]!=_0x5f1cb0[_0xf0e5('0x13')]?_0xf0e5('0x17'):_0xf0e5('0x18');}return _0x5f1cb0;}catch(_0x4c4649){breakingLicense[_0xf0e5('0x12')]=_0x13854e['data1'];breakingLicense[_0xf0e5('0x19')]=_0x4c4649[_0xf0e5('0x19')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5026ea,_0x1f5161){getLicense()[_0xf0e5('0xa')](function(_0x48e507){return db[_0xf0e5('0x1a')][_0xf0e5('0x1b')]({'attributes':[_0xf0e5('0x1c'),[db[_0xf0e5('0x1d')]['fn'](_0xf0e5('0x1e'),db[_0xf0e5('0x1d')][_0xf0e5('0x1f')](_0xf0e5('0x1c'))),_0xf0e5('0x20')]],'group':_0xf0e5('0x1c'),'where':{'role':{'$or':[_0xf0e5('0x21'),_0xf0e5('0x22'),_0xf0e5('0x23')]}},'raw':!![]})['then'](function(_0x4f9268){var _0x17c740={'user':_0x48e507[_0xf0e5('0x24')]||0x0,'telephone':_0x48e507[_0xf0e5('0x25')]||0x0};_0x4f9268[_0xf0e5('0x26')](function(_0x347550){var _0x25231f=_0x347550[_0xf0e5('0x1c')]===_0xf0e5('0x21')?_0xf0e5('0x22'):_0x347550[_0xf0e5('0x1c')];_0x17c740[_0x25231f]-=_0x347550[_0xf0e5('0x20')];if(_0x17c740[_0x25231f]<0x0)_0x17c740[_0x25231f]=0x0;});_0x5026ea(_0x17c740);return;});})[_0xf0e5('0x27')](function(_0x2e4861){_0x1f5161(_0x2e4861);});});}function checkUserLimits(_0x262fff){return new BPromise(function(_0x5a0739,_0x311d3a){getLimits()['then'](function(_0x4ba364){var _0x6d30a2=_[_0xf0e5('0x28')](_[_0xf0e5('0x29')](_0x262fff,'role'),[_0xf0e5('0x21'),_0xf0e5('0x22'),_0xf0e5('0x23')]);var _0x16ac23=(_0x6d30a2[_0xf0e5('0x21')]||0x0)+(_0x6d30a2[_0xf0e5('0x22')]||0x0);var _0x37b76f=_0x6d30a2[_0xf0e5('0x23')]||0x0;if(_0x16ac23>_0x4ba364['user'])return _0x311d3a(_0xf0e5('0x2a'));if(_0x37b76f>_0x4ba364['telephone'])return _0x311d3a(_0xf0e5('0x2b'));return _0x5a0739();})['catch'](function(_0x1a1104){_0x311d3a(_0x1a1104);});});}module[_0xf0e5('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xfe8c=['gray','deadline','days','changed','disabled','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','license','isEmpty','data1','data2','split','format','%s:%s:%s','parse','demo','machineUuid','decryptString'];(function(_0x5dfc2a,_0x1a953f){var _0x3f1a71=function(_0x15916){while(--_0x15916){_0x5dfc2a['push'](_0x5dfc2a['shift']());}};_0x3f1a71(++_0x1a953f);}(_0xfe8c,0xda));var _0xcfe8=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xfe8c[_0x5d2803];return _0xdcad2c;};'use strict';var util=require(_0xcfe8('0x0'));var _=require(_0xcfe8('0x1'));var moment=require(_0xcfe8('0x2'));var BPromise=require(_0xcfe8('0x3'));var hardware=require(_0xcfe8('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0xcfe8('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcfe8('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xcfe8('0x7'),'machineUuid':hardware[_0xcfe8('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xcfe8('0x9'),'machineUuid':hardware[_0xcfe8('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2e307f){return new BPromise(function(_0xcfb146,_0x5bf753){return db[_0xcfe8('0xa')][_0xcfe8('0xb')](_[_0xcfe8('0xc')](_0x2e307f,{'raw':!![],'where':{'id':0x1}}))[_0xcfe8('0xd')](function(_0x3ca254){return checkLicense(_0x3ca254,null);})[_0xcfe8('0xd')](function(_0x2c47eb){_0xcfb146(_0x2c47eb);return;})[_0xcfe8('0xe')](function(_0xc44331){_0x5bf753(_0xc44331);});});}function checkLicense(_0x3d47ad,_0x5e9dd0){if(!_0x3d47ad){demoLicense[_0xcfe8('0xf')]=_0x3d47ad['data1'];return demoLicense;}try{var _0x57429e=_0x5e9dd0||_0x3d47ad[_0xcfe8('0x10')];if(_[_0xcfe8('0x11')](_0x57429e)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0xf0aa56=_0x3d47ad[_0xcfe8('0x12')];var _0xfb3cf9=_0x3d47ad[_0xcfe8('0x13')];var _0x2078fe=_0xf0aa56[_0xcfe8('0x14')]('-')[0x4];var _0x508656=_0xf0aa56[_0xcfe8('0x14')]('-')[0x0];var _0x19e061=encryptor['decryptString'](_0x57429e,util[_0xcfe8('0x15')](_0xcfe8('0x16'),_0x2078fe,_0xf0aa56,_0x508656));var _0x36601d=JSON[_0xcfe8('0x17')](_0x19e061);_0x36601d[_0xcfe8('0x18')]=![];_0x36601d['uuid']=_0xf0aa56;_0x36601d[_0xcfe8('0x19')]=hardware['getUuid']();if(_0xfb3cf9){var _0x6bf7cd=encryptor[_0xcfe8('0x1a')](_0xfb3cf9);_0x36601d[_0xcfe8('0x1b')]=_0x6bf7cd;_0x36601d[_0xcfe8('0x1c')]=moment(_0x6bf7cd)['add'](0x7,_0xcfe8('0x1d'))[_0xcfe8('0x15')]();_0x36601d['grayReason']=_0x36601d[_0xcfe8('0xf')]!=_0x36601d['machineUuid']?_0xcfe8('0x1e'):_0xcfe8('0x1f');}return _0x36601d;}catch(_0x380097){breakingLicense[_0xcfe8('0xf')]=_0x3d47ad[_0xcfe8('0x12')];breakingLicense['message']=_0x380097['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x56bafc,_0x53cc63){getLicense()[_0xcfe8('0xd')](function(_0x5c4141){return db['User'][_0xcfe8('0x20')]({'attributes':[_0xcfe8('0x21'),[db[_0xcfe8('0x22')]['fn'](_0xcfe8('0x23'),db[_0xcfe8('0x22')][_0xcfe8('0x24')]('role')),_0xcfe8('0x25')]],'group':_0xcfe8('0x21'),'where':{'role':{'$or':[_0xcfe8('0x26'),_0xcfe8('0x27'),_0xcfe8('0x28')]}},'raw':!![]})[_0xcfe8('0xd')](function(_0x358953){var _0xa3fa48={'user':_0x5c4141[_0xcfe8('0x29')]||0x0,'telephone':_0x5c4141[_0xcfe8('0x2a')]||0x0};_0x358953[_0xcfe8('0x2b')](function(_0x585698){var _0x28ddb6=_0x585698['role']===_0xcfe8('0x26')?_0xcfe8('0x27'):_0x585698[_0xcfe8('0x21')];_0xa3fa48[_0x28ddb6]-=_0x585698[_0xcfe8('0x25')];if(_0xa3fa48[_0x28ddb6]<0x0)_0xa3fa48[_0x28ddb6]=0x0;});_0x56bafc(_0xa3fa48);return;});})[_0xcfe8('0xe')](function(_0x277ff3){_0x53cc63(_0x277ff3);});});}function checkUserLimits(_0x1a9f9c){return new BPromise(function(_0x5292e4,_0x3a2415){getLimits()[_0xcfe8('0xd')](function(_0x2148ae){var _0x22bacd=_[_0xcfe8('0x2c')](_[_0xcfe8('0x2d')](_0x1a9f9c,_0xcfe8('0x21')),[_0xcfe8('0x26'),_0xcfe8('0x27'),_0xcfe8('0x28')]);var _0x5966a6=(_0x22bacd[_0xcfe8('0x26')]||0x0)+(_0x22bacd['user']||0x0);var _0x4b014f=_0x22bacd[_0xcfe8('0x28')]||0x0;if(_0x5966a6>_0x2148ae[_0xcfe8('0x27')])return _0x3a2415(_0xcfe8('0x2e'));if(_0x4b014f>_0x2148ae[_0xcfe8('0x28')])return _0x3a2415(_0xcfe8('0x2f'));return _0x5292e4();})[_0xcfe8('0xe')](function(_0x3dcb31){_0x3a2415(_0x3dcb31);});});}module[_0xcfe8('0x30')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index b7bfbce..c0d6298 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 _0x048e=['app-id','secret','exports','myappanuglar-secret'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x048e,0x1aa));var _0xe048=function(_0xa0b217,_0x3db7c5){_0xa0b217=_0xa0b217-0x0;var _0x13d32e=_0x048e[_0xa0b217];return _0x13d32e;};'use strict';module[_0xe048('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xe048('0x1'),'GOOGLE_ID':_0xe048('0x2'),'GOOGLE_SECRET':_0xe048('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xf597=['app-id','secret'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf597,0xfc));var _0x7f59=function(_0x23f4b0,_0x312af4){_0x23f4b0=_0x23f4b0-0x0;var _0x41b106=_0xf597[_0x23f4b0];return _0x41b106;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x7f59('0x0'),'GOOGLE_SECRET':_0x7f59('0x1'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index b3be76a..5b4b6b4 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a24=['info','env','debugLevel','moment','winston','util','path','/var','log','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','exports','Logger','transports','File','%s-%s','error'];(function(_0x3bf925,_0x4dd8e4){var _0x2128a1=function(_0x4d2049){while(--_0x4d2049){_0x3bf925['push'](_0x3bf925['shift']());}};_0x2128a1(++_0x4dd8e4);}(_0x9a24,0xab));var _0x49a2=function(_0x4c335d,_0x419504){_0x4c335d=_0x4c335d-0x0;var _0x947bcd=_0x9a24[_0x4c335d];return _0x947bcd;};'use strict';var moment=require(_0x49a2('0x0'));var winston=require(_0x49a2('0x1'));var util=require(_0x49a2('0x2'));var path=require(_0x49a2('0x3'));var debugLevel='INFO';function filename(_0x3e93d9,_0x14623c){return path['join'](_0x49a2('0x4'),_0x49a2('0x5'),'xcally',util[_0x49a2('0x6')]('%s-%s.log',_0x3e93d9,_0x14623c));}function formatter(_0x684d31,_0x26d6e6){return util['format'](_0x49a2('0x7'),moment()[_0x49a2('0x6')](_0x49a2('0x8')),_0x26d6e6[_0x49a2('0x9')][_0x49a2('0xa')](),_0x684d31,_0x26d6e6[_0x49a2('0xb')]);}module[_0x49a2('0xc')]=function(_0x3b2301){return new winston[(_0x49a2('0xd'))]({'transports':[new winston[(_0x49a2('0xe'))][(_0x49a2('0xf'))]({'name':util[_0x49a2('0x6')](_0x49a2('0x10'),_0x3b2301,'error'),'filename':filename(_0x3b2301,_0x49a2('0x11')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5cc049){return formatter(_0x3b2301,_0x5cc049);}}),new winston['transports']['File']({'name':util['format'](_0x49a2('0x10'),_0x3b2301,_0x49a2('0x12')),'filename':filename(_0x3b2301,'info'),'level':_0x49a2('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4cfa1c){return formatter(_0x3b2301,_0x4cfa1c);}}),new winston['transports']['Console']({'level':process[_0x49a2('0x13')][_0x49a2('0x14')]||debugLevel,'json':![],'formatter':function(_0x45033c){return formatter(_0x3b2301,_0x45033c);}})]});}; \ No newline at end of file +var _0xd6c8=['Console','env','debugLevel','moment','winston','util','path','INFO','join','/var','log','xcally','format','level','message','Logger','transports','%s-%s','error','File','info'];(function(_0x4b5c3e,_0x4fa764){var _0x4ccefe=function(_0x20042f){while(--_0x20042f){_0x4b5c3e['push'](_0x4b5c3e['shift']());}};_0x4ccefe(++_0x4fa764);}(_0xd6c8,0x96));var _0x8d6c=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0xd6c8[_0x1ad926];return _0x1b81dc;};'use strict';var moment=require(_0x8d6c('0x0'));var winston=require(_0x8d6c('0x1'));var util=require(_0x8d6c('0x2'));var path=require(_0x8d6c('0x3'));var debugLevel=_0x8d6c('0x4');function filename(_0x4a5bf9,_0x1266b3){return path[_0x8d6c('0x5')](_0x8d6c('0x6'),_0x8d6c('0x7'),_0x8d6c('0x8'),util[_0x8d6c('0x9')]('%s-%s.log',_0x4a5bf9,_0x1266b3));}function formatter(_0x5139e1,_0x33171d){return util[_0x8d6c('0x9')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x8d6c('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),_0x33171d[_0x8d6c('0xa')]['toUpperCase'](),_0x5139e1,_0x33171d[_0x8d6c('0xb')]);}module['exports']=function(_0x1261db){return new winston[(_0x8d6c('0xc'))]({'transports':[new winston[(_0x8d6c('0xd'))]['File']({'name':util[_0x8d6c('0x9')](_0x8d6c('0xe'),_0x1261db,_0x8d6c('0xf')),'filename':filename(_0x1261db,'error'),'level':_0x8d6c('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xb70e60){return formatter(_0x1261db,_0xb70e60);}}),new winston[(_0x8d6c('0xd'))][(_0x8d6c('0x10'))]({'name':util[_0x8d6c('0x9')](_0x8d6c('0xe'),_0x1261db,_0x8d6c('0x11')),'filename':filename(_0x1261db,'info'),'level':_0x8d6c('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3cad82){return formatter(_0x1261db,_0x3cad82);}}),new winston[(_0x8d6c('0xd'))][(_0x8d6c('0x12'))]({'level':process[_0x8d6c('0x13')][_0x8d6c('0x14')]||debugLevel,'json':![],'formatter':function(_0x42dfb0){return formatter(_0x1261db,_0x42dfb0);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index eed427c..5fdbe03 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 _0x3cbc=['join','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/xdr/index.js','exports','path','express','../../services/express/index.js','ami'];(function(_0x3ebee8,_0x291038){var _0x5c7ed6=function(_0x274790){while(--_0x274790){_0x3ebee8['push'](_0x3ebee8['shift']());}};_0x5c7ed6(++_0x291038);}(_0x3cbc,0x151));var _0xc3cb=function(_0x4d2b49,_0x102f86){_0x4d2b49=_0x4d2b49-0x0;var _0x3bc595=_0x3cbc[_0x4d2b49];return _0x3bc595;};'use strict';var path=require(_0xc3cb('0x0'));var os=require('os');var config={'apps':[{'name':_0xc3cb('0x1'),'script':path['join'](__dirname,_0xc3cb('0x2'))},{'name':_0xc3cb('0x3'),'script':path[_0xc3cb('0x4')](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path[_0xc3cb('0x4')](__dirname,_0xc3cb('0x5'))},{'name':_0xc3cb('0x6'),'script':path['join'](__dirname,_0xc3cb('0x7'))},{'name':_0xc3cb('0x8'),'script':path[_0xc3cb('0x4')](__dirname,'../../services/routing/index.js')},{'name':'xdr','script':path[_0xc3cb('0x4')](__dirname,_0xc3cb('0x9'))}]};module[_0xc3cb('0xa')]=config; \ No newline at end of file +var _0x87ae=['join','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/routing/index.js','../../services/xdr/index.js'];(function(_0x3d7fb5,_0x16eb5c){var _0x3a9642=function(_0x3f5b2a){while(--_0x3f5b2a){_0x3d7fb5['push'](_0x3d7fb5['shift']());}};_0x3a9642(++_0x16eb5c);}(_0x87ae,0xf5));var _0xe87a=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x87ae[_0x160c73];return _0xd9302;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path[_0xe87a('0x0')](__dirname,'../../services/express/index.js')},{'name':'ami','script':path[_0xe87a('0x0')](__dirname,_0xe87a('0x1'))},{'name':_0xe87a('0x2'),'script':path['join'](__dirname,_0xe87a('0x3'))},{'name':_0xe87a('0x4'),'script':path[_0xe87a('0x0')](__dirname,'../../services/email/index.js')},{'name':'routing','script':path[_0xe87a('0x0')](__dirname,_0xe87a('0x5'))},{'name':'xdr','script':path[_0xe87a('0x0')](__dirname,_0xe87a('0x6'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 7228e4d..5303aaa 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 _0x8e0f=['list','describe','delete','dump','pm2','bluebird','./config','connect','start','then','disconnect','stop','restart'];(function(_0x4978e6,_0x3e5191){var _0x20cf9a=function(_0x4b8612){while(--_0x4b8612){_0x4978e6['push'](_0x4978e6['shift']());}};_0x20cf9a(++_0x3e5191);}(_0x8e0f,0x12f));var _0xf8e0=function(_0x2cdd86,_0x218d3c){_0x2cdd86=_0x2cdd86-0x0;var _0x35aeae=_0x8e0f[_0x2cdd86];return _0x35aeae;};'use strict';var pm2=require(_0xf8e0('0x0'));var BPromise=require(_0xf8e0('0x1'));var config=require(_0xf8e0('0x2'));function connect(){return new BPromise(function(_0x5103f1,_0x38282a){return pm2[_0xf8e0('0x3')](function(_0x2ce589){if(_0x2ce589){return _0x38282a(_0x2ce589);}return _0x5103f1('connected');});});};exports[_0xf8e0('0x4')]=function(_0x4a6acb){return connect()[_0xf8e0('0x5')](function(){return new BPromise(function(_0x3d8d42,_0x4f3b30){return pm2[_0xf8e0('0x4')](_0x4a6acb,function(_0x30d044,_0x454a2c){if(_0x30d044){return _0x4f3b30(_0x30d044);}pm2[_0xf8e0('0x6')]();return _0x3d8d42(_0x454a2c);});});});};exports['stop']=function(_0x12a7b5){return connect()[_0xf8e0('0x5')](function(){return new BPromise(function(_0x5c644c,_0x51677a){return pm2[_0xf8e0('0x7')](_0x12a7b5,function(_0x17e783,_0x9df814){if(_0x17e783){return _0x51677a(_0x17e783);}pm2[_0xf8e0('0x6')]();return _0x5c644c(_0x9df814);});});});};exports[_0xf8e0('0x8')]=function(_0x271792){return connect()[_0xf8e0('0x5')](function(){return new BPromise(function(_0x462994,_0xaf2a8c){return pm2['restart'](_0x271792,function(_0x1272ff,_0x113b45){if(_0x1272ff){return _0xaf2a8c(_0x1272ff);}pm2[_0xf8e0('0x6')]();return _0x462994(_0x113b45);});});});};exports[_0xf8e0('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0xf9ec0f,_0x5e958d){return pm2[_0xf8e0('0x9')](function(_0x443445,_0x321785){if(_0x443445){return _0x5e958d(_0x443445);}pm2['disconnect']();return _0xf9ec0f(_0x321785);});});});};exports[_0xf8e0('0xa')]=function(_0x534844){return connect()[_0xf8e0('0x5')](function(){return new BPromise(function(_0x4de3de,_0x430b06){return pm2[_0xf8e0('0xa')](_0x534844,function(_0x3a5140,_0x32715f){if(_0x3a5140){return _0x430b06(_0x3a5140);}pm2[_0xf8e0('0x6')]();return _0x4de3de(_0x32715f);});});});};exports['delete']=function(_0x616054){return connect()['then'](function(){return new BPromise(function(_0x410c3c,_0x13a29b){return pm2[_0xf8e0('0xb')](_0x616054,function(_0x366925,_0x548049){if(_0x366925){return _0x13a29b(_0x366925);}pm2['disconnect']();return _0x410c3c(_0x548049);});});});};exports[_0xf8e0('0xc')]=function(){return connect()[_0xf8e0('0x5')](function(){return new BPromise(function(_0x46f109,_0x1809a4){return pm2['dump'](function(_0x21831e){if(_0x21831e){return _0x1809a4(_0x21831e);}return _0x46f109('saved');});});});}; \ No newline at end of file +var _0xf29c=['list','describe','dump','saved','bluebird','./config','connect','connected','start','then','disconnect','stop','restart'];(function(_0x1007b5,_0x876ab1){var _0x4063f3=function(_0x63666){while(--_0x63666){_0x1007b5['push'](_0x1007b5['shift']());}};_0x4063f3(++_0x876ab1);}(_0xf29c,0xc7));var _0xcf29=function(_0x40b03c,_0x319b91){_0x40b03c=_0x40b03c-0x0;var _0x5859ad=_0xf29c[_0x40b03c];return _0x5859ad;};'use strict';var pm2=require('pm2');var BPromise=require(_0xcf29('0x0'));var config=require(_0xcf29('0x1'));function connect(){return new BPromise(function(_0x263eb0,_0x326d3c){return pm2[_0xcf29('0x2')](function(_0xe7c034){if(_0xe7c034){return _0x326d3c(_0xe7c034);}return _0x263eb0(_0xcf29('0x3'));});});};exports[_0xcf29('0x4')]=function(_0x1f2b5d){return connect()[_0xcf29('0x5')](function(){return new BPromise(function(_0x19f823,_0x89a1c8){return pm2[_0xcf29('0x4')](_0x1f2b5d,function(_0x157dfe,_0x15ab38){if(_0x157dfe){return _0x89a1c8(_0x157dfe);}pm2[_0xcf29('0x6')]();return _0x19f823(_0x15ab38);});});});};exports['stop']=function(_0x5ec45f){return connect()[_0xcf29('0x5')](function(){return new BPromise(function(_0x2694c8,_0x2e9d52){return pm2[_0xcf29('0x7')](_0x5ec45f,function(_0x4268c6,_0x2f3bd5){if(_0x4268c6){return _0x2e9d52(_0x4268c6);}pm2[_0xcf29('0x6')]();return _0x2694c8(_0x2f3bd5);});});});};exports[_0xcf29('0x8')]=function(_0x2fbdfa){return connect()[_0xcf29('0x5')](function(){return new BPromise(function(_0xb13a72,_0x11d304){return pm2['restart'](_0x2fbdfa,function(_0x41a51c,_0x1f310d){if(_0x41a51c){return _0x11d304(_0x41a51c);}pm2['disconnect']();return _0xb13a72(_0x1f310d);});});});};exports[_0xcf29('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x381735,_0x258108){return pm2[_0xcf29('0x9')](function(_0x1bf502,_0xd49096){if(_0x1bf502){return _0x258108(_0x1bf502);}pm2[_0xcf29('0x6')]();return _0x381735(_0xd49096);});});});};exports[_0xcf29('0xa')]=function(_0x3bc380){return connect()[_0xcf29('0x5')](function(){return new BPromise(function(_0x4d8134,_0x32087f){return pm2['describe'](_0x3bc380,function(_0x695dfb,_0x5f31f7){if(_0x695dfb){return _0x32087f(_0x695dfb);}pm2[_0xcf29('0x6')]();return _0x4d8134(_0x5f31f7);});});});};exports['delete']=function(_0x119a91){return connect()['then'](function(){return new BPromise(function(_0x39849e,_0x56c6e9){return pm2['delete'](_0x119a91,function(_0xe2b5b1,_0x8af9da){if(_0xe2b5b1){return _0x56c6e9(_0xe2b5b1);}pm2['disconnect']();return _0x39849e(_0x8af9da);});});});};exports[_0xcf29('0xb')]=function(){return connect()[_0xcf29('0x5')](function(){return new BPromise(function(_0x51f4b8,_0x47efbc){return pm2['dump'](function(_0x4d484c){if(_0x4d484c){return _0x47efbc(_0x4d484c);}return _0x51f4b8(_0xcf29('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index ac3cee4..9211ead 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 _0x1952=['findAll','lastMsgAt','subtract','minutes','then','ChatInteraction','update','timeout','format','map','length','chatInteraction:update','catch','error','lodash','moment','ioredis','../../config/environment','defaults','redis','localhost','socket.io-emitter','chatTimeout'];(function(_0x3546eb,_0x440f3f){var _0xe660bf=function(_0x282566){while(--_0x282566){_0x3546eb['push'](_0x3546eb['shift']());}};_0xe660bf(++_0x440f3f);}(_0x1952,0xaf));var _0x2195=function(_0x4d8764,_0xd13d7b){_0x4d8764=_0x4d8764-0x0;var _0x4e0b49=_0x1952[_0x4d8764];return _0x4e0b49;};'use strict';var _=require(_0x2195('0x0'));var moment=require(_0x2195('0x1'));var Redis=require(_0x2195('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x2195('0x3'));config['redis']=_[_0x2195('0x4')](config[_0x2195('0x5')],{'host':_0x2195('0x6'),'port':0x18eb});var io=require(_0x2195('0x7'))(new Redis(config[_0x2195('0x5')]));function closeInteractions(){var _0x3f5de2=0x0;var _0x3ec0e2=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0x2195('0x8')],'where':{'id':0x1}})['then'](function(_0x5cc798){_0x3f5de2=_0x5cc798['chatTimeout'];if(_0x3f5de2){return db['ChatInteraction'][_0x2195('0x9')]({'raw':!![],'attributes':['id',_0x2195('0xa')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2195('0xb')](_0x5cc798[_0x2195('0x8')],_0x2195('0xc'))}}});}else{return[];}})[_0x2195('0xd')](function(_0x30e291){_0x3ec0e2=_0x30e291;if(_0x3f5de2){return db[_0x2195('0xe')][_0x2195('0xf')]({'closeReason':'system','disposition':_0x2195('0x10'),'closed':!![],'closedAt':moment()[_0x2195('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_[_0x2195('0x12')](_0x3ec0e2||[],'id')}});}})[_0x2195('0xd')](function(_0x25a867){for(var _0x3d9148=0x0;_0x3d9148<_0x3ec0e2[_0x2195('0x13')];_0x3d9148++){io['emit'](_0x2195('0x14'),{'id':_0x3ec0e2[_0x3d9148]['id'],'closed':!![]});}})[_0x2195('0x15')](function(_0x3a7b09){console[_0x2195('0x16')](_0x3a7b09);});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6e84=['ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','emit','chatInteraction:update','error','start','ioredis','../../mysqldb','../../config/environment','redis','defaults','Setting','chatTimeout','then','lastMsgAt','subtract'];(function(_0x46aaaa,_0x3af897){var _0x26d04e=function(_0x4373ba){while(--_0x4373ba){_0x46aaaa['push'](_0x46aaaa['shift']());}};_0x26d04e(++_0x3af897);}(_0x6e84,0x19a));var _0x46e8=function(_0x4aa527,_0x2b3a5e){_0x4aa527=_0x4aa527-0x0;var _0x1960b2=_0x6e84[_0x4aa527];return _0x1960b2;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x46e8('0x0'));var db=require(_0x46e8('0x1'))['db'];var config=require(_0x46e8('0x2'));config[_0x46e8('0x3')]=_[_0x46e8('0x4')](config[_0x46e8('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x29bda7=0x0;var _0x3962fd=[];return db[_0x46e8('0x5')]['find']({'raw':!![],'attributes':['id',_0x46e8('0x6')],'where':{'id':0x1}})[_0x46e8('0x7')](function(_0x5782fd){_0x29bda7=_0x5782fd[_0x46e8('0x6')];if(_0x29bda7){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id',_0x46e8('0x8')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x46e8('0x9')](_0x5782fd['chatTimeout'],'minutes')}}});}else{return[];}})[_0x46e8('0x7')](function(_0x3a4855){_0x3962fd=_0x3a4855;if(_0x29bda7){return db[_0x46e8('0xa')][_0x46e8('0xb')]({'closeReason':_0x46e8('0xc'),'disposition':_0x46e8('0xd'),'closed':!![],'closedAt':moment()[_0x46e8('0xe')](_0x46e8('0xf'))},{'where':{'id':_['map'](_0x3962fd||[],'id')}});}})[_0x46e8('0x7')](function(_0x47ed62){for(var _0xe70b3b=0x0;_0xe70b3b<_0x3962fd[_0x46e8('0x10')];_0xe70b3b++){io[_0x46e8('0x11')](_0x46e8('0x12'),{'id':_0x3962fd[_0xe70b3b]['id'],'closed':!![]});}})['catch'](function(_0x5080d9){console[_0x46e8('0x13')](_0x5080d9);});}exports[_0x46e8('0x14')]=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 ec6f0ef..bfc37d9 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 _0x755f=['request','error','error\x20mail','catch','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','isNil','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','exists','stop','deleteJob','delete\x20cron','toRun','length','index','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','update','run','util','path','moment','jayson/promise','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','secure','authentication','auth','format','\x22%s\x22\x20<%s>','email','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','../../files/reports','savename','basename','extname','zip','existsSync','status','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'];(function(_0x290a8b,_0x31cae2){var _0x12dbb2=function(_0x7d723c){while(--_0x7d723c){_0x290a8b['push'](_0x290a8b['shift']());}};_0x12dbb2(++_0x31cae2);}(_0x755f,0x185));var _0xf755=function(_0x23e3b0,_0x5f2901){_0x23e3b0=_0x23e3b0-0x0;var _0x13c675=_0x755f[_0x23e3b0];return _0x13c675;};'use strict';var fs=require('fs');var util=require(_0xf755('0x0'));var path=require(_0xf755('0x1'));var _=require('lodash');var moment=require(_0xf755('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xf755('0x3'));var BPromise=require('bluebird');var logger=require('../logger')('schedule');var db=require(_0xf755('0x4'))['db'];var analyticCustomReportController=require(_0xf755('0x5'));var analyticDefaultReportController=require(_0xf755('0x6'));var client=jayson[_0xf755('0x7')][_0xf755('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1229c3,_0x403181){return function(){logger[_0xf755('0x9')](_0xf755('0xa'),_0x1229c3['email']);var _0x4287b2=!![];var _0x1c76ad={'tls':{'rejectUnauthorized':![]}};if(_0x1229c3[_0xf755('0xb')][_0xf755('0xc')][_0xf755('0xd')]){_0x1c76ad[_0xf755('0xd')]=_0x1229c3[_0xf755('0xb')][_0xf755('0xc')][_0xf755('0xd')];}else{_0x1c76ad[_0xf755('0xe')]=_0x1229c3[_0xf755('0xb')]['Smtp']['host'];_0x1c76ad[_0xf755('0xf')]=_0x1229c3[_0xf755('0xb')]['Smtp']['port'];_0x1c76ad[_0xf755('0x10')]=_0x1229c3['MailAccount']['Smtp'][_0xf755('0x10')];}if(_0x1229c3[_0xf755('0xb')][_0xf755('0xc')][_0xf755('0x11')]){_0x1c76ad[_0xf755('0x12')]={'user':_0x1229c3[_0xf755('0xb')]['Smtp']['user'],'pass':_0x1229c3[_0xf755('0xb')][_0xf755('0xc')]['pass']};}var _0x52621e={'account':_0x1c76ad,'message':{'from':util[_0xf755('0x13')](_0xf755('0x14'),_0x1229c3['MailAccount']['name'],_0x1229c3[_0xf755('0xb')][_0xf755('0x15')]||_0x1229c3[_0xf755('0xb')][_0xf755('0xc')][_0xf755('0x16')]),'to':_0x1229c3[_0xf755('0x15')],'cc':_0x1229c3['cc'],'bcc':_0x1229c3[_0xf755('0x17')],'subject':util[_0xf755('0x13')](_0xf755('0x18'),_0x403181[_0xf755('0x19')],_0x1229c3[_0xf755('0x1a')],_0x1229c3[_0xf755('0x1b')])}};var _0xa1cc69=path[_0xf755('0x1c')](__dirname,_0xf755('0x1d'));var _0x173b79=_0x403181[_0xf755('0x1e')];var _0x378d4d=util[_0xf755('0x13')]('%s.%s',path[_0xf755('0x1f')](_0x403181[_0xf755('0x1e')],path[_0xf755('0x20')](_0x403181[_0xf755('0x1e')])),_0xf755('0x21'));var _0x408545=path[_0xf755('0x1c')](_0xa1cc69,_0x173b79);var _0x553a3d=path[_0xf755('0x1c')](_0xa1cc69,_0x378d4d);if(fs[_0xf755('0x22')](_0x408545)){_0x403181[_0xf755('0x23')]='Sent';_0x52621e[_0xf755('0x24')]['attachments']=[{'filename':_0x173b79,'path':_0x408545}];_0x52621e['message'][_0xf755('0x25')]=util[_0xf755('0x13')](_0xf755('0x26'),JSON[_0xf755('0x27')](_0x403181,null,0x2));}else if(fs[_0xf755('0x22')](_0x553a3d)){_0x403181[_0xf755('0x23')]='Sent';_0x52621e['message']['attachments']=[{'filename':_0x378d4d,'path':_0x553a3d}];}else{_0x52621e['message'][_0xf755('0x25')]=_0xf755('0x28');if(!_0x1229c3['sendIfEmpty']){_0x4287b2=![];logger[_0xf755('0x9')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x4287b2){return client[_0xf755('0x29')]('SendMail',_0x52621e)['then'](function(_0x28ab42){if(_0x28ab42[_0xf755('0x2a')]){return logger[_0xf755('0x2a')](_0xf755('0x2b'),JSON[_0xf755('0x27')](_0x28ab42));}return logger[_0xf755('0x9')]('email\x20sent');})[_0xf755('0x2c')](function(_0x3a0650){return logger[_0xf755('0x2a')](_0xf755('0x2b'),JSON[_0xf755('0x27')](_0x3a0650));});}};}function handleError(){return function(_0x409e65){return logger[_0xf755('0x2a')](JSON[_0xf755('0x27')](_0x409e65));};}function handleResult(_0x203347){return function(_0x14f024){logger[_0xf755('0x9')]('data',JSON[_0xf755('0x27')](_0x14f024));if(_0x203347['MailAccount']&&_0x203347['MailAccount'][_0xf755('0xc')]&&!_['isNil'](_0x203347[_0xf755('0x15')])){setTimeout(handleSendEmail(_0x203347,_0x14f024),0x3c*0x3e8);}};}function handleJob(_0x3c2622){return function(){try{if(_['isNil'](_0x3c2622[_0xf755('0x1a')])){return logger[_0xf755('0x9')](_0xf755('0x2d'));}if(_['isNil'](_0x3c2622[_0xf755('0x1b')])){return logger[_0xf755('0x9')]('subtractUnit\x20null\x20or\x20undefined');}var _0x415533={'startDate':moment()[_0xf755('0x2e')](_0x3c2622['subtractNumber'],_0x3c2622[_0xf755('0x1b')])[_0xf755('0x13')](_0xf755('0x2f')),'endDate':moment()[_0xf755('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xf755('0x30'),'output':_0x3c2622[_0xf755('0x31')],'name':_0x3c2622['name']};if(!_['isNil'](_0x3c2622[_0xf755('0x32')])){logger[_0xf755('0x9')](_0xf755('0x33'),_0x3c2622[_0xf755('0x32')]);return analyticDefaultReportController[_0xf755('0x34')]({'id':_0x3c2622[_0xf755('0x32')]},_0x415533)[_0xf755('0x35')](handleResult(_0x3c2622))[_0xf755('0x2c')](handleError());}if(!_[_0xf755('0x36')](_0x3c2622['CustomReportId'])){logger[_0xf755('0x9')](_0xf755('0x37'),_0x3c2622['CustomReportId']);return analyticCustomReportController[_0xf755('0x34')]({'id':_0x3c2622['CustomReportId']},_0x415533)[_0xf755('0x35')](handleResult(_0x3c2622))['catch'](handleError());}}catch(_0x4b406e){logger[_0xf755('0x2a')](JSON['stringify'](_0x4b406e));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x149b5d){var _0x3c30b7={};if(_0x149b5d){_0x3c30b7['id']=_0x149b5d;}return db[_0xf755('0x38')][_0xf755('0x39')]({'where':_0x3c30b7,'include':[{'model':db[_0xf755('0xb')],'attributes':['id',_0xf755('0x19'),_0xf755('0x15')],'include':[{'model':db[_0xf755('0x3a')],'as':_0xf755('0xc')}]}]})[_0xf755('0x35')](function(_0x469dab){var _0x322cec=_[_0xf755('0x3b')](manager[_0xf755('0x3c')]);var _0x5d5d07=_[_0xf755('0x3d')](_0x469dab,function(_0xebe7a2){return _0xebe7a2['id'][_0xf755('0x3e')]();});var _0x2e623b=_[_0xf755('0x3f')](_0x469dab,function(_0x26f879){return _0x26f879['id']['toString']();});var _0x899081=_0x149b5d?_0x5d5d07:_[_0xf755('0x40')](_0x5d5d07,_0x322cec);var _0x10b499=_[_0xf755('0x41')](_0x5d5d07,_0x322cec);var _0x288bba=_[_0xf755('0x40')](_0x322cec,_0x5d5d07);var _0x1bdcc5;var _0x2d4a0e;for(_0x1bdcc5=0x0;_0x1bdcc5<_0x288bba['length']&&!_0x149b5d;_0x1bdcc5+=0x1){_0x2d4a0e=_0x288bba[_0x1bdcc5][_0xf755('0x3e')]();if(manager[_0xf755('0x42')](_0x2d4a0e)){manager[_0xf755('0x43')](_0x2d4a0e);manager[_0xf755('0x44')](_0x2d4a0e);logger[_0xf755('0x9')](_0xf755('0x45'),_0x2d4a0e);}}logger[_0xf755('0x9')](_0xf755('0x46'),JSON[_0xf755('0x27')](_0x899081));for(_0x1bdcc5=0x0;_0x1bdcc5<_0x899081[_0xf755('0x47')];_0x1bdcc5+=0x1){_0x2d4a0e=_0x899081[_0x1bdcc5][_0xf755('0x3e')]();logger['info'](_0xf755('0x48'),_0x2d4a0e);if(_0x149b5d){logger['info'](_0xf755('0x49'),_0x149b5d);logger[_0xf755('0x9')](JSON[_0xf755('0x27')](_0x2e623b[_0x2d4a0e]));BPromise['resolve']()[_0xf755('0x35')](handleJob(_0x2e623b[_0x2d4a0e]));logger[_0xf755('0x9')](_0xf755('0x4a'),_0x2e623b[_0x2d4a0e][_0xf755('0x19')],_0x2e623b[_0x2d4a0e][_0xf755('0x4b')]);}else if(_0x2e623b[_0x2d4a0e][_0xf755('0x4b')]&&_0x2e623b[_0x2d4a0e][_0xf755('0x4c')]&&moment()[_0xf755('0x4d')](_0x2e623b[_0x2d4a0e][_0xf755('0x4e')],_0x2e623b[_0x2d4a0e][_0xf755('0x4f')])){manager[_0xf755('0x50')](_0x2d4a0e,_0x2e623b[_0x2d4a0e][_0xf755('0x4b')],handleJob(_0x2e623b[_0x2d4a0e]));manager[_0xf755('0x51')](_0x2d4a0e);logger['info'](_0xf755('0x52'),_0x2e623b[_0x2d4a0e][_0xf755('0x19')],_0x2e623b[_0x2d4a0e][_0xf755('0x4b')]);}else if(manager[_0xf755('0x42')](_0x2d4a0e)){manager[_0xf755('0x43')](_0x2d4a0e);manager[_0xf755('0x44')](_0x2d4a0e);logger[_0xf755('0x9')](_0xf755('0x53'),_0x2e623b[_0x2d4a0e]['name'],_0x2e623b[_0x2d4a0e][_0xf755('0x4b')]);}}for(_0x1bdcc5=0x0,_0x2d4a0e;_0x1bdcc5<_0x10b499[_0xf755('0x47')]&&!_0x149b5d;_0x1bdcc5+=0x1){_0x2d4a0e=_0x10b499[_0x1bdcc5][_0xf755('0x3e')]();if(manager[_0xf755('0x42')](_0x2d4a0e)){if(_0x2e623b[_0x2d4a0e]['cron']&&_0x2e623b[_0x2d4a0e][_0xf755('0x4c')]&&moment()['isBetween'](_0x2e623b[_0x2d4a0e][_0xf755('0x4e')],_0x2e623b[_0x2d4a0e][_0xf755('0x4f')])){manager[_0xf755('0x54')](_0x2d4a0e,_0x2e623b[_0x2d4a0e]['cron'],handleJob(_0x2e623b[_0x2d4a0e]));logger[_0xf755('0x9')]('update\x20cron',_0x2e623b[_0x2d4a0e][_0xf755('0x19')],_0x2e623b[_0x2d4a0e]['cron']);}else{manager[_0xf755('0x43')](_0x2d4a0e);manager[_0xf755('0x44')](_0x2d4a0e);logger[_0xf755('0x9')](_0xf755('0x53'),_0x2e623b[_0x2d4a0e]['name'],_0x2e623b[_0x2d4a0e]['cron']);}}}})['catch'](function(_0x1f0c03){logger[_0xf755('0x2a')](JSON[_0xf755('0x27')](_0x1f0c03));});}exports[_0xf755('0x55')]=function(_0x3f8362){return getJobs(_0x3f8362);};exports[_0xf755('0x51')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x29dd=['add','start','add\x20cron','exists','stop\x20cron','startAt','update','update\x20cron','run','util','path','lodash','moment','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','email','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','../../files/reports','savename','basename','extname','status','Sent','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','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','stringify','email\x20sent','catch','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','keys','jobs','map','toString','difference','intersection','length','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','cron','endAt'];(function(_0x5e716b,_0x33e308){var _0x50be28=function(_0x88d2bc){while(--_0x88d2bc){_0x5e716b['push'](_0x5e716b['shift']());}};_0x50be28(++_0x33e308);}(_0x29dd,0xc3));var _0xd29d=function(_0x29d335,_0x37556b){_0x29d335=_0x29d335-0x0;var _0x1e38ca=_0x29dd[_0x29d335];return _0x1e38ca;};'use strict';var fs=require('fs');var util=require(_0xd29d('0x0'));var path=require(_0xd29d('0x1'));var _=require(_0xd29d('0x2'));var moment=require(_0xd29d('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xd29d('0x4'));var BPromise=require(_0xd29d('0x5'));var logger=require(_0xd29d('0x6'))('schedule');var db=require(_0xd29d('0x7'))['db'];var analyticCustomReportController=require(_0xd29d('0x8'));var analyticDefaultReportController=require(_0xd29d('0x9'));var client=jayson[_0xd29d('0xa')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x42eb72,_0x561fee){return function(){logger[_0xd29d('0xb')](_0xd29d('0xc'),_0x42eb72['email']);var _0x5aa4b2=!![];var _0x239835={'tls':{'rejectUnauthorized':![]}};if(_0x42eb72[_0xd29d('0xd')][_0xd29d('0xe')][_0xd29d('0xf')]){_0x239835[_0xd29d('0xf')]=_0x42eb72['MailAccount'][_0xd29d('0xe')]['service'];}else{_0x239835[_0xd29d('0x10')]=_0x42eb72[_0xd29d('0xd')]['Smtp'][_0xd29d('0x10')];_0x239835[_0xd29d('0x11')]=_0x42eb72[_0xd29d('0xd')][_0xd29d('0xe')][_0xd29d('0x11')];_0x239835[_0xd29d('0x12')]=_0x42eb72[_0xd29d('0xd')][_0xd29d('0xe')][_0xd29d('0x12')];}if(_0x42eb72['MailAccount'][_0xd29d('0xe')][_0xd29d('0x13')]){_0x239835[_0xd29d('0x14')]={'user':_0x42eb72[_0xd29d('0xd')][_0xd29d('0xe')][_0xd29d('0x15')],'pass':_0x42eb72[_0xd29d('0xd')][_0xd29d('0xe')][_0xd29d('0x16')]};}var _0x8eed95={'account':_0x239835,'message':{'from':util[_0xd29d('0x17')](_0xd29d('0x18'),_0x42eb72[_0xd29d('0xd')]['name'],_0x42eb72[_0xd29d('0xd')][_0xd29d('0x19')]||_0x42eb72[_0xd29d('0xd')]['Smtp'][_0xd29d('0x15')]),'to':_0x42eb72[_0xd29d('0x19')],'cc':_0x42eb72['cc'],'bcc':_0x42eb72[_0xd29d('0x1a')],'subject':util['format'](_0xd29d('0x1b'),_0x561fee[_0xd29d('0x1c')],_0x42eb72[_0xd29d('0x1d')],_0x42eb72[_0xd29d('0x1e')])}};var _0x4fc859=path[_0xd29d('0x1f')](__dirname,_0xd29d('0x20'));var _0xe12517=_0x561fee[_0xd29d('0x21')];var _0x14076d=util[_0xd29d('0x17')]('%s.%s',path[_0xd29d('0x22')](_0x561fee[_0xd29d('0x21')],path[_0xd29d('0x23')](_0x561fee[_0xd29d('0x21')])),'zip');var _0x5d3fbf=path[_0xd29d('0x1f')](_0x4fc859,_0xe12517);var _0x3e7ffb=path[_0xd29d('0x1f')](_0x4fc859,_0x14076d);if(fs['existsSync'](_0x5d3fbf)){_0x561fee[_0xd29d('0x24')]=_0xd29d('0x25');_0x8eed95[_0xd29d('0x26')]['attachments']=[{'filename':_0xe12517,'path':_0x5d3fbf}];_0x8eed95[_0xd29d('0x26')][_0xd29d('0x27')]=util[_0xd29d('0x17')](_0xd29d('0x28'),JSON['stringify'](_0x561fee,null,0x2));}else if(fs['existsSync'](_0x3e7ffb)){_0x561fee[_0xd29d('0x24')]=_0xd29d('0x25');_0x8eed95[_0xd29d('0x26')][_0xd29d('0x29')]=[{'filename':_0x14076d,'path':_0x3e7ffb}];}else{_0x8eed95[_0xd29d('0x26')][_0xd29d('0x27')]=_0xd29d('0x2a');if(!_0x42eb72[_0xd29d('0x2b')]){_0x5aa4b2=![];logger['info'](_0xd29d('0x2c'));}}if(_0x5aa4b2){return client[_0xd29d('0x2d')](_0xd29d('0x2e'),_0x8eed95)[_0xd29d('0x2f')](function(_0x2d1aec){if(_0x2d1aec[_0xd29d('0x30')]){return logger[_0xd29d('0x30')]('error\x20mail',JSON[_0xd29d('0x31')](_0x2d1aec));}return logger['info'](_0xd29d('0x32'));})[_0xd29d('0x33')](function(_0x4edd76){return logger['error'](_0xd29d('0x34'),JSON['stringify'](_0x4edd76));});}};}function handleError(){return function(_0x1cdbba){return logger['error'](JSON['stringify'](_0x1cdbba));};}function handleResult(_0x32ef64){return function(_0xeb0c07){logger['info'](_0xd29d('0x35'),JSON[_0xd29d('0x31')](_0xeb0c07));if(_0x32ef64[_0xd29d('0xd')]&&_0x32ef64[_0xd29d('0xd')][_0xd29d('0xe')]&&!_[_0xd29d('0x36')](_0x32ef64[_0xd29d('0x19')])){setTimeout(handleSendEmail(_0x32ef64,_0xeb0c07),0x3c*0x3e8);}};}function handleJob(_0x372cb7){return function(){try{if(_['isNil'](_0x372cb7[_0xd29d('0x1d')])){return logger[_0xd29d('0xb')](_0xd29d('0x37'));}if(_[_0xd29d('0x36')](_0x372cb7[_0xd29d('0x1e')])){return logger[_0xd29d('0xb')](_0xd29d('0x38'));}var _0x2f9c78={'startDate':moment()[_0xd29d('0x39')](_0x372cb7[_0xd29d('0x1d')],_0x372cb7[_0xd29d('0x1e')])[_0xd29d('0x17')](_0xd29d('0x3a')),'endDate':moment()[_0xd29d('0x17')](_0xd29d('0x3a')),'type':'scheduled','output':_0x372cb7[_0xd29d('0x3b')],'name':_0x372cb7[_0xd29d('0x1c')]};if(!_[_0xd29d('0x36')](_0x372cb7[_0xd29d('0x3c')])){logger[_0xd29d('0xb')](_0xd29d('0x3d'),_0x372cb7[_0xd29d('0x3c')]);return analyticDefaultReportController[_0xd29d('0x3e')]({'id':_0x372cb7['DefaultReportId']},_0x2f9c78)[_0xd29d('0x2f')](handleResult(_0x372cb7))[_0xd29d('0x33')](handleError());}if(!_[_0xd29d('0x36')](_0x372cb7[_0xd29d('0x3f')])){logger['info'](_0xd29d('0x40'),_0x372cb7['CustomReportId']);return analyticCustomReportController[_0xd29d('0x3e')]({'id':_0x372cb7[_0xd29d('0x3f')]},_0x2f9c78)['then'](handleResult(_0x372cb7))[_0xd29d('0x33')](handleError());}}catch(_0x3a6e27){logger[_0xd29d('0x30')](JSON[_0xd29d('0x31')](_0x3a6e27));}return logger[_0xd29d('0xb')](_0xd29d('0x41'));};}function getJobs(_0x4d63b2){var _0x512b31={};if(_0x4d63b2){_0x512b31['id']=_0x4d63b2;}return db[_0xd29d('0x42')][_0xd29d('0x43')]({'where':_0x512b31,'include':[{'model':db[_0xd29d('0xd')],'attributes':['id','name',_0xd29d('0x19')],'include':[{'model':db['MailServerOut'],'as':_0xd29d('0xe')}]}]})[_0xd29d('0x2f')](function(_0x3c0551){var _0x261a56=_[_0xd29d('0x44')](manager[_0xd29d('0x45')]);var _0x632d05=_[_0xd29d('0x46')](_0x3c0551,function(_0x1d3578){return _0x1d3578['id']['toString']();});var _0x4e8936=_['keyBy'](_0x3c0551,function(_0x281abe){return _0x281abe['id'][_0xd29d('0x47')]();});var _0x4cf05f=_0x4d63b2?_0x632d05:_[_0xd29d('0x48')](_0x632d05,_0x261a56);var _0x19e2fd=_[_0xd29d('0x49')](_0x632d05,_0x261a56);var _0x451776=_[_0xd29d('0x48')](_0x261a56,_0x632d05);var _0x5434b9;var _0x3a9838;for(_0x5434b9=0x0;_0x5434b9<_0x451776[_0xd29d('0x4a')]&&!_0x4d63b2;_0x5434b9+=0x1){_0x3a9838=_0x451776[_0x5434b9][_0xd29d('0x47')]();if(manager['exists'](_0x3a9838)){manager[_0xd29d('0x4b')](_0x3a9838);manager[_0xd29d('0x4c')](_0x3a9838);logger['info'](_0xd29d('0x4d'),_0x3a9838);}}logger[_0xd29d('0xb')](_0xd29d('0x4e'),JSON[_0xd29d('0x31')](_0x4cf05f));for(_0x5434b9=0x0;_0x5434b9<_0x4cf05f[_0xd29d('0x4a')];_0x5434b9+=0x1){_0x3a9838=_0x4cf05f[_0x5434b9]['toString']();logger['info'](_0xd29d('0x4f'),_0x3a9838);if(_0x4d63b2){logger[_0xd29d('0xb')](_0xd29d('0x50'),_0x4d63b2);logger[_0xd29d('0xb')](JSON['stringify'](_0x4e8936[_0x3a9838]));BPromise[_0xd29d('0x51')]()[_0xd29d('0x2f')](handleJob(_0x4e8936[_0x3a9838]));logger[_0xd29d('0xb')]('run\x20job',_0x4e8936[_0x3a9838]['name'],_0x4e8936[_0x3a9838]['cron']);}else if(_0x4e8936[_0x3a9838][_0xd29d('0x52')]&&_0x4e8936[_0x3a9838]['active']&&moment()['isBetween'](_0x4e8936[_0x3a9838]['startAt'],_0x4e8936[_0x3a9838][_0xd29d('0x53')])){manager[_0xd29d('0x54')](_0x3a9838,_0x4e8936[_0x3a9838][_0xd29d('0x52')],handleJob(_0x4e8936[_0x3a9838]));manager[_0xd29d('0x55')](_0x3a9838);logger[_0xd29d('0xb')](_0xd29d('0x56'),_0x4e8936[_0x3a9838][_0xd29d('0x1c')],_0x4e8936[_0x3a9838][_0xd29d('0x52')]);}else if(manager[_0xd29d('0x57')](_0x3a9838)){manager['stop'](_0x3a9838);manager[_0xd29d('0x4c')](_0x3a9838);logger['info'](_0xd29d('0x58'),_0x4e8936[_0x3a9838][_0xd29d('0x1c')],_0x4e8936[_0x3a9838][_0xd29d('0x52')]);}}for(_0x5434b9=0x0,_0x3a9838;_0x5434b9<_0x19e2fd['length']&&!_0x4d63b2;_0x5434b9+=0x1){_0x3a9838=_0x19e2fd[_0x5434b9][_0xd29d('0x47')]();if(manager[_0xd29d('0x57')](_0x3a9838)){if(_0x4e8936[_0x3a9838]['cron']&&_0x4e8936[_0x3a9838]['active']&&moment()['isBetween'](_0x4e8936[_0x3a9838][_0xd29d('0x59')],_0x4e8936[_0x3a9838][_0xd29d('0x53')])){manager[_0xd29d('0x5a')](_0x3a9838,_0x4e8936[_0x3a9838][_0xd29d('0x52')],handleJob(_0x4e8936[_0x3a9838]));logger[_0xd29d('0xb')](_0xd29d('0x5b'),_0x4e8936[_0x3a9838]['name'],_0x4e8936[_0x3a9838][_0xd29d('0x52')]);}else{manager[_0xd29d('0x4b')](_0x3a9838);manager[_0xd29d('0x4c')](_0x3a9838);logger['info'](_0xd29d('0x58'),_0x4e8936[_0x3a9838][_0xd29d('0x1c')],_0x4e8936[_0x3a9838][_0xd29d('0x52')]);}}}})[_0xd29d('0x33')](function(_0x50b8f0){logger[_0xd29d('0x30')](JSON[_0xd29d('0x31')](_0x50b8f0));});}exports[_0xd29d('0x5c')]=function(_0x2c00f9){return getJobs(_0x2c00f9);};exports[_0xd29d('0x55')]=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 937e9cc..2044efd 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 _0xb9d6=['../../config/logger','transcribe','getTranscriptionJob','detectSentiment','substring','info','data1','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','format','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Negative','SentimentScore','Mixed','Neutral','FAILED','FailureReason','resolve','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','start','lodash','aws-sdk','request-promise','util','../../mysqldb'];(function(_0x3074d8,_0x3cc4c7){var _0x4476ee=function(_0x4be080){while(--_0x4be080){_0x3074d8['push'](_0x3074d8['shift']());}};_0x4476ee(++_0x3cc4c7);}(_0xb9d6,0x163));var _0x6b9d=function(_0x369f62,_0x17a354){_0x369f62=_0x369f62-0x0;var _0x323a6d=_0xb9d6[_0x369f62];return _0x323a6d;};var _=require(_0x6b9d('0x0'));var AWS=require(_0x6b9d('0x1'));var rp=require(_0x6b9d('0x2'));var util=require(_0x6b9d('0x3'));var BPromise=require('bluebird');var db=require(_0x6b9d('0x4'))['db'];var logger=require(_0x6b9d('0x5'))(_0x6b9d('0x6'));function getTranscriptionJob(_0xca10b6,_0x42a237,_0x1e5c20,_0x5cfc17){return new Promise(function(_0x2eebdb,_0x1c6894){var _0x5e6231=new AWS['TranscribeService']({'accessKeyId':_0x42a237,'secretAccessKey':_0xca10b6,'region':_0x1e5c20});_0x5e6231[_0x6b9d('0x7')]({'TranscriptionJobName':_0x5cfc17},function(_0x3d71eb,_0x576cff){if(_0x3d71eb){return _0x1c6894(_0x3d71eb);}else{return _0x2eebdb(_0x576cff);}});});}function sentiment(_0x562bd0,_0x1d4213,_0xb136a9,_0x3d5af0,_0x2a3c7e){return new Promise(function(_0x54bc67,_0x20c90d){var _0x92952a=new AWS['Comprehend']({'accessKeyId':_0x1d4213,'secretAccessKey':_0x562bd0,'region':_0xb136a9});_0x92952a[_0x6b9d('0x8')]({'Text':_0x3d5af0,'LanguageCode':_0x2a3c7e[_0x6b9d('0x9')](0x0,0x2)},function(_0x46fd0e,_0x253631){if(_0x46fd0e){return _0x20c90d(_0x46fd0e);}else{return _0x54bc67(_0x253631);}});});}function checkTranscribeJob(_0x584900,_0x2746fe,_0x54d0f7){var _0x50420e;return new BPromise(function(_0x28859e,_0x3004cb){logger[_0x6b9d('0xa')](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x584900['id'],_0x584900['transcribeName']));return getTranscriptionJob(_0x54d0f7[_0x6b9d('0xb')],_0x54d0f7['data2'],_0x2746fe[_0x6b9d('0xc')],_0x584900[_0x6b9d('0xd')])[_0x6b9d('0xe')](function(_0x19146c){logger[_0x6b9d('0xa')](util['format'](_0x6b9d('0xf'),_0x584900['id'],_0x584900[_0x6b9d('0xd')],_0x19146c[_0x6b9d('0x10')][_0x6b9d('0x11')]));if(!_0x584900[_0x6b9d('0x12')]){switch(_0x19146c[_0x6b9d('0x10')][_0x6b9d('0x11')]){case'COMPLETED':var _0x4151e6={'transcribeStatus':_0x19146c['TranscriptionJob'][_0x6b9d('0x11')],'fileUri':_0x19146c[_0x6b9d('0x10')][_0x6b9d('0x13')][_0x6b9d('0x14')]};logger[_0x6b9d('0xa')](util['format'](_0x6b9d('0x15'),_0x584900['id']));return rp({'uri':_0x19146c[_0x6b9d('0x10')][_0x6b9d('0x13')][_0x6b9d('0x14')],'json':!![]})[_0x6b9d('0xe')](function(_0xd1aa71){logger['info'](util['format'](_0x6b9d('0x16'),_0x584900['id']));if(_0xd1aa71&&_0xd1aa71[_0x6b9d('0x17')]&&_0xd1aa71['results'][_0x6b9d('0x18')]&&_0xd1aa71[_0x6b9d('0x17')][_0x6b9d('0x18')][_0x6b9d('0x19')]){_0x4151e6[_0x6b9d('0x12')]='';for(var _0x347029=0x0;_0x347029<_0xd1aa71['results']['transcripts'][_0x6b9d('0x19')];_0x347029++){_0x4151e6[_0x6b9d('0x12')]+=_0xd1aa71[_0x6b9d('0x17')][_0x6b9d('0x18')][_0x347029][_0x6b9d('0x1a')]+'';}}return _0x584900[_0x6b9d('0x1b')](_0x4151e6);})[_0x6b9d('0xe')](function(){logger[_0x6b9d('0xa')](util[_0x6b9d('0x1c')](_0x6b9d('0x1d'),_0x584900['id']));if(!_0x584900[_0x6b9d('0x1e')]){throw new db['Sequelize'][(_0x6b9d('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2746fe[_0x6b9d('0x20')]||!_0x2746fe[_0x6b9d('0x21')]||!_0x2746fe[_0x6b9d('0x22')]||!_0x2746fe[_0x6b9d('0x23')]||!_0x2746fe[_0x6b9d('0x24')]){throw new db[(_0x6b9d('0x25'))][(_0x6b9d('0x1f'))](_0x6b9d('0x26'));}if(!_0x4151e6['fileText']){throw new Error(_0x6b9d('0x27'));}if(_0x2746fe['sentimentAccountId']===_0x54d0f7['id']){return _0x54d0f7;}else{return db[_0x6b9d('0x28')][_0x6b9d('0x29')]({'where':{'id':_settings[_0x6b9d('0x21')]}});}})[_0x6b9d('0xe')](function(_0x37a3cb){if(!_0x37a3cb){throw new db[(_0x6b9d('0x25'))][(_0x6b9d('0x1f'))](_0x6b9d('0x2a'));}if(!_0x37a3cb['data1']||!_0x37a3cb[_0x6b9d('0x2b')]){throw new db[(_0x6b9d('0x25'))][(_0x6b9d('0x1f'))](_0x6b9d('0x2c'));}_0x50420e=_0x37a3cb;logger['info'](util[_0x6b9d('0x1c')](_0x6b9d('0x2d'),_0x584900['id']));return sentiment(_0x50420e[_0x6b9d('0xb')],_0x50420e['data2'],_0x2746fe['sentimentRegion'],_0x4151e6[_0x6b9d('0x12')],_0x2746fe['language']);})[_0x6b9d('0xe')](function(_0x4407b8){logger[_0x6b9d('0xa')](util[_0x6b9d('0x1c')](_0x6b9d('0x2e'),_0x584900['id']));return _0x584900[_0x6b9d('0x1b')]({'sentiment':_0x4407b8[_0x6b9d('0x2f')],'sPositive':_0x4407b8['SentimentScore']['Positive'],'sNegative':_0x4407b8['SentimentScore'][_0x6b9d('0x30')],'sMixed':_0x4407b8[_0x6b9d('0x31')][_0x6b9d('0x32')],'sNeutral':_0x4407b8[_0x6b9d('0x31')][_0x6b9d('0x33')]});})[_0x6b9d('0xe')](function(){logger[_0x6b9d('0xa')](util[_0x6b9d('0x1c')](_0x6b9d('0x1d'),_0x584900['id']));_0x28859e();});case'FAILED':return _0x584900[_0x6b9d('0x1b')]({'transcribeStatus':_0x6b9d('0x34'),'failureReason':_0x19146c[_0x6b9d('0x10')][_0x6b9d('0x35')]})[_0x6b9d('0xe')](function(){logger['info'](util['format'](_0x6b9d('0x1d'),_0x584900['id']));_0x28859e();});default:logger[_0x6b9d('0xa')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x584900['id']));break;}}else{return BPromise[_0x6b9d('0x36')]()['then'](function(){if(!_0x584900[_0x6b9d('0x1e')]){throw new db[(_0x6b9d('0x25'))][(_0x6b9d('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2746fe[_0x6b9d('0x20')]||!_0x2746fe[_0x6b9d('0x21')]||!_0x2746fe[_0x6b9d('0x22')]||!_0x2746fe[_0x6b9d('0x23')]||!_0x2746fe[_0x6b9d('0x24')]){throw new db[(_0x6b9d('0x25'))]['ValidationError'](_0x6b9d('0x26'));}if(!_0x584900[_0x6b9d('0x12')]){throw new Error(_0x6b9d('0x27'));}if(_0x2746fe[_0x6b9d('0x21')]===_0x54d0f7['id']){return _0x54d0f7;}else{return db[_0x6b9d('0x28')]['findOne']({'where':{'id':_settings[_0x6b9d('0x21')]}});}})[_0x6b9d('0xe')](function(_0x342740){if(!_0x342740){throw new db[(_0x6b9d('0x25'))][(_0x6b9d('0x1f'))](_0x6b9d('0x2a'));}if(!_0x342740[_0x6b9d('0xb')]||!_0x342740[_0x6b9d('0x2b')]){throw new db[(_0x6b9d('0x25'))][(_0x6b9d('0x1f'))](_0x6b9d('0x2c'));}_0x50420e=_0x342740;logger[_0x6b9d('0xa')](util[_0x6b9d('0x1c')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x584900['id']));return sentiment(_0x50420e['data1'],_0x50420e[_0x6b9d('0x2b')],_0x2746fe[_0x6b9d('0x22')],_0x584900[_0x6b9d('0x12')],_0x2746fe[_0x6b9d('0x23')]);})[_0x6b9d('0xe')](function(_0x14fd82){logger['info'](util['format'](_0x6b9d('0x2e'),_0x584900['id']));return _0x584900[_0x6b9d('0x1b')]({'sentiment':_0x14fd82[_0x6b9d('0x2f')],'sPositive':_0x14fd82[_0x6b9d('0x31')][_0x6b9d('0x37')],'sNegative':_0x14fd82[_0x6b9d('0x31')][_0x6b9d('0x30')],'sMixed':_0x14fd82[_0x6b9d('0x31')][_0x6b9d('0x32')],'sNeutral':_0x14fd82[_0x6b9d('0x31')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0x6b9d('0xe')](function(){logger[_0x6b9d('0xa')](util[_0x6b9d('0x1c')](_0x6b9d('0x1d'),_0x584900['id']));_0x28859e();});}})[_0x6b9d('0x38')](function(_0x1f329b){if(_0x1f329b){if(!_0x1f329b[_0x6b9d('0x39')]||_0x1f329b[_0x6b9d('0x39')]!==_0x6b9d('0x3a')){logger[_0x6b9d('0x3b')](util[_0x6b9d('0x1c')](_0x6b9d('0x3c'),_0x584900['id']),util[_0x6b9d('0x3d')](_0x1f329b,{'showHidden':![],'depth':null}));}}_0x28859e();});});}function checkTranscribe(){var _0x1e851a;var _0x5f0782;var _0x54300b;return db[_0x6b9d('0x3e')][_0x6b9d('0x3f')]({'where':{'transcribeStatus':_0x6b9d('0x40')}})[_0x6b9d('0xe')](function(_0x11917c){if(!_0x11917c||!_0x11917c[_0x6b9d('0x19')]){throw new db[(_0x6b9d('0x25'))][(_0x6b9d('0x1f'))](_0x6b9d('0x41'));}_0x1e851a=_0x11917c;return db['Setting'][_0x6b9d('0x29')]({'where':{'id':0x1}});})[_0x6b9d('0xe')](function(_0xede42d){if(!_0xede42d){throw new db[(_0x6b9d('0x25'))][(_0x6b9d('0x1f'))](_0x6b9d('0x42'));}_0x5f0782=_0xede42d;if(!_0x5f0782['transcribe']||!_0x5f0782[_0x6b9d('0x43')]||!_0x5f0782[_0x6b9d('0xc')]||!_0x5f0782[_0x6b9d('0x23')]||!_0x5f0782[_0x6b9d('0x24')]){throw new db[(_0x6b9d('0x25'))]['ValidationError'](_0x6b9d('0x44'));}return db[_0x6b9d('0x28')][_0x6b9d('0x29')]({'where':{'id':_0x5f0782[_0x6b9d('0x43')]}});})['then'](function(_0x4f8eea){if(!_0x4f8eea){throw new db[(_0x6b9d('0x25'))][(_0x6b9d('0x1f'))](_0x6b9d('0x2a'));}if(!_0x4f8eea['data1']||!_0x4f8eea[_0x6b9d('0x2b')]){throw new db[(_0x6b9d('0x25'))][(_0x6b9d('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x54300b=_0x4f8eea;var _0x194428=[];_0x1e851a[_0x6b9d('0x45')](function(_0x54575e){_0x194428['push'](checkTranscribeJob(_0x54575e,_0x5f0782,_0x54300b));});return BPromise[_0x6b9d('0x46')](_0x194428);})['catch'](function(_0x59bbc4){if(_0x59bbc4){if(!_0x59bbc4[_0x6b9d('0x39')]||_0x59bbc4[_0x6b9d('0x39')]!==_0x6b9d('0x3a')){logger[_0x6b9d('0x3b')](util[_0x6b9d('0x3d')](_0x59bbc4,{'showHidden':![],'depth':null}));}}});}exports[_0x6b9d('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xd9f8=['transcribeAccountId','forEach','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','transcribeName','data2','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','ValidationError','sentiment','sentimentAccountId','sentimentRegion','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','Positive','SentimentScore','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','bucket','CloudProvider','findOne','Negative','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting'];(function(_0x51b80a,_0x355fe3){var _0x22fdf0=function(_0x152b3e){while(--_0x152b3e){_0x51b80a['push'](_0x51b80a['shift']());}};_0x22fdf0(++_0x355fe3);}(_0xd9f8,0x123));var _0x8d9f=function(_0x3c2ceb,_0x1cddb0){_0x3c2ceb=_0x3c2ceb-0x0;var _0x34ecf0=_0xd9f8[_0x3c2ceb];return _0x34ecf0;};var _=require(_0x8d9f('0x0'));var AWS=require(_0x8d9f('0x1'));var rp=require(_0x8d9f('0x2'));var util=require(_0x8d9f('0x3'));var BPromise=require(_0x8d9f('0x4'));var db=require(_0x8d9f('0x5'))['db'];var logger=require(_0x8d9f('0x6'))(_0x8d9f('0x7'));function getTranscriptionJob(_0x30505c,_0x552006,_0x7a03b1,_0x3822a7){return new Promise(function(_0x15ac33,_0x46f95f){var _0xd82d85=new AWS[(_0x8d9f('0x8'))]({'accessKeyId':_0x552006,'secretAccessKey':_0x30505c,'region':_0x7a03b1});_0xd82d85[_0x8d9f('0x9')]({'TranscriptionJobName':_0x3822a7},function(_0x12cd2d,_0x12e1fd){if(_0x12cd2d){return _0x46f95f(_0x12cd2d);}else{return _0x15ac33(_0x12e1fd);}});});}function sentiment(_0x4b519d,_0xfcd81c,_0x2bcc23,_0x2a1e9b,_0x358e36){return new Promise(function(_0x1d1d29,_0x1e6aee){var _0xa05985=new AWS[(_0x8d9f('0xa'))]({'accessKeyId':_0xfcd81c,'secretAccessKey':_0x4b519d,'region':_0x2bcc23});_0xa05985[_0x8d9f('0xb')]({'Text':_0x2a1e9b,'LanguageCode':_0x358e36[_0x8d9f('0xc')](0x0,0x2)},function(_0x5d0a0c,_0x280b7e){if(_0x5d0a0c){return _0x1e6aee(_0x5d0a0c);}else{return _0x1d1d29(_0x280b7e);}});});}function checkTranscribeJob(_0x4d3b47,_0x5b1ab4,_0x53655e){var _0x3d80c9;return new BPromise(function(_0x3780e1,_0x23d9f0){logger[_0x8d9f('0xd')](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x4d3b47['id'],_0x4d3b47[_0x8d9f('0xe')]));return getTranscriptionJob(_0x53655e['data1'],_0x53655e[_0x8d9f('0xf')],_0x5b1ab4['transcribeRegion'],_0x4d3b47['transcribeName'])[_0x8d9f('0x10')](function(_0x4abd64){logger[_0x8d9f('0xd')](util[_0x8d9f('0x11')](_0x8d9f('0x12'),_0x4d3b47['id'],_0x4d3b47['transcribeName'],_0x4abd64[_0x8d9f('0x13')][_0x8d9f('0x14')]));if(!_0x4d3b47[_0x8d9f('0x15')]){switch(_0x4abd64[_0x8d9f('0x13')][_0x8d9f('0x14')]){case _0x8d9f('0x16'):var _0x9f04a2={'transcribeStatus':_0x4abd64[_0x8d9f('0x13')][_0x8d9f('0x14')],'fileUri':_0x4abd64[_0x8d9f('0x13')]['Transcript'][_0x8d9f('0x17')]};logger[_0x8d9f('0xd')](util['format'](_0x8d9f('0x18'),_0x4d3b47['id']));return rp({'uri':_0x4abd64['TranscriptionJob'][_0x8d9f('0x19')][_0x8d9f('0x17')],'json':!![]})[_0x8d9f('0x10')](function(_0x25eb2d){logger['info'](util[_0x8d9f('0x11')](_0x8d9f('0x1a'),_0x4d3b47['id']));if(_0x25eb2d&&_0x25eb2d['results']&&_0x25eb2d[_0x8d9f('0x1b')][_0x8d9f('0x1c')]&&_0x25eb2d[_0x8d9f('0x1b')]['transcripts'][_0x8d9f('0x1d')]){_0x9f04a2[_0x8d9f('0x15')]='';for(var _0xf8f3fd=0x0;_0xf8f3fd<_0x25eb2d[_0x8d9f('0x1b')][_0x8d9f('0x1c')][_0x8d9f('0x1d')];_0xf8f3fd++){_0x9f04a2[_0x8d9f('0x15')]+=_0x25eb2d['results'][_0x8d9f('0x1c')][_0xf8f3fd][_0x8d9f('0x1e')]+'';}}return _0x4d3b47['update'](_0x9f04a2);})[_0x8d9f('0x10')](function(){logger[_0x8d9f('0xd')](util[_0x8d9f('0x11')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4d3b47['id']));if(!_0x4d3b47['tempSentiment']){throw new db['Sequelize'][(_0x8d9f('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5b1ab4[_0x8d9f('0x20')]||!_0x5b1ab4[_0x8d9f('0x21')]||!_0x5b1ab4[_0x8d9f('0x22')]||!_0x5b1ab4['language']||!_0x5b1ab4['bucket']){throw new db[(_0x8d9f('0x23'))]['ValidationError'](_0x8d9f('0x24'));}if(!_0x9f04a2[_0x8d9f('0x15')]){throw new Error(_0x8d9f('0x25'));}if(_0x5b1ab4[_0x8d9f('0x21')]===_0x53655e['id']){return _0x53655e;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x8d9f('0x21')]}});}})[_0x8d9f('0x10')](function(_0x3157cf){if(!_0x3157cf){throw new db[(_0x8d9f('0x23'))][(_0x8d9f('0x1f'))](_0x8d9f('0x26'));}if(!_0x3157cf[_0x8d9f('0x27')]||!_0x3157cf[_0x8d9f('0xf')]){throw new db[(_0x8d9f('0x23'))][(_0x8d9f('0x1f'))](_0x8d9f('0x28'));}_0x3d80c9=_0x3157cf;logger['info'](util[_0x8d9f('0x11')](_0x8d9f('0x29'),_0x4d3b47['id']));return sentiment(_0x3d80c9[_0x8d9f('0x27')],_0x3d80c9[_0x8d9f('0xf')],_0x5b1ab4['sentimentRegion'],_0x9f04a2['fileText'],_0x5b1ab4[_0x8d9f('0x2a')]);})[_0x8d9f('0x10')](function(_0x3058b9){logger[_0x8d9f('0xd')](util[_0x8d9f('0x11')](_0x8d9f('0x2b'),_0x4d3b47['id']));return _0x4d3b47[_0x8d9f('0x2c')]({'sentiment':_0x3058b9[_0x8d9f('0x2d')],'sPositive':_0x3058b9['SentimentScore'][_0x8d9f('0x2e')],'sNegative':_0x3058b9[_0x8d9f('0x2f')]['Negative'],'sMixed':_0x3058b9[_0x8d9f('0x2f')][_0x8d9f('0x30')],'sNeutral':_0x3058b9['SentimentScore'][_0x8d9f('0x31')]});})[_0x8d9f('0x10')](function(){logger[_0x8d9f('0xd')](util[_0x8d9f('0x11')](_0x8d9f('0x32'),_0x4d3b47['id']));_0x3780e1();});case _0x8d9f('0x33'):return _0x4d3b47['update']({'transcribeStatus':_0x8d9f('0x33'),'failureReason':_0x4abd64[_0x8d9f('0x13')]['FailureReason']})[_0x8d9f('0x10')](function(){logger[_0x8d9f('0xd')](util[_0x8d9f('0x11')](_0x8d9f('0x32'),_0x4d3b47['id']));_0x3780e1();});default:logger[_0x8d9f('0xd')](util[_0x8d9f('0x11')](_0x8d9f('0x34'),_0x4d3b47['id']));break;}}else{return BPromise[_0x8d9f('0x35')]()[_0x8d9f('0x10')](function(){if(!_0x4d3b47[_0x8d9f('0x36')]){throw new db[(_0x8d9f('0x23'))][(_0x8d9f('0x1f'))](_0x8d9f('0x37'));}if(!_0x5b1ab4[_0x8d9f('0x20')]||!_0x5b1ab4[_0x8d9f('0x21')]||!_0x5b1ab4[_0x8d9f('0x22')]||!_0x5b1ab4[_0x8d9f('0x2a')]||!_0x5b1ab4[_0x8d9f('0x38')]){throw new db['Sequelize'][(_0x8d9f('0x1f'))](_0x8d9f('0x24'));}if(!_0x4d3b47['fileText']){throw new Error(_0x8d9f('0x25'));}if(_0x5b1ab4['sentimentAccountId']===_0x53655e['id']){return _0x53655e;}else{return db[_0x8d9f('0x39')][_0x8d9f('0x3a')]({'where':{'id':_settings[_0x8d9f('0x21')]}});}})[_0x8d9f('0x10')](function(_0x5d74c3){if(!_0x5d74c3){throw new db[(_0x8d9f('0x23'))][(_0x8d9f('0x1f'))](_0x8d9f('0x26'));}if(!_0x5d74c3[_0x8d9f('0x27')]||!_0x5d74c3[_0x8d9f('0xf')]){throw new db[(_0x8d9f('0x23'))]['ValidationError'](_0x8d9f('0x28'));}_0x3d80c9=_0x5d74c3;logger[_0x8d9f('0xd')](util[_0x8d9f('0x11')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4d3b47['id']));return sentiment(_0x3d80c9[_0x8d9f('0x27')],_0x3d80c9['data2'],_0x5b1ab4[_0x8d9f('0x22')],_0x4d3b47[_0x8d9f('0x15')],_0x5b1ab4[_0x8d9f('0x2a')]);})[_0x8d9f('0x10')](function(_0x5245fb){logger[_0x8d9f('0xd')](util[_0x8d9f('0x11')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4d3b47['id']));return _0x4d3b47['update']({'sentiment':_0x5245fb[_0x8d9f('0x2d')],'sPositive':_0x5245fb[_0x8d9f('0x2f')][_0x8d9f('0x2e')],'sNegative':_0x5245fb[_0x8d9f('0x2f')][_0x8d9f('0x3b')],'sMixed':_0x5245fb[_0x8d9f('0x2f')]['Mixed'],'sNeutral':_0x5245fb[_0x8d9f('0x2f')][_0x8d9f('0x31')],'transcribeStatus':_0x8d9f('0x16')});})[_0x8d9f('0x10')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4d3b47['id']));_0x3780e1();});}})['catch'](function(_0x2541b5){if(_0x2541b5){if(!_0x2541b5[_0x8d9f('0x3c')]||_0x2541b5[_0x8d9f('0x3c')]!==_0x8d9f('0x3d')){logger[_0x8d9f('0x3e')](util[_0x8d9f('0x11')](_0x8d9f('0x3f'),_0x4d3b47['id']),util[_0x8d9f('0x40')](_0x2541b5,{'showHidden':![],'depth':null}));}}_0x3780e1();});});}function checkTranscribe(){var _0x299819;var _0x2e5aaf;var _0x9ae92a;return db[_0x8d9f('0x41')][_0x8d9f('0x42')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x59c121){if(!_0x59c121||!_0x59c121['length']){throw new db[(_0x8d9f('0x23'))][(_0x8d9f('0x1f'))](_0x8d9f('0x43'));}_0x299819=_0x59c121;return db[_0x8d9f('0x44')][_0x8d9f('0x3a')]({'where':{'id':0x1}});})[_0x8d9f('0x10')](function(_0x56e543){if(!_0x56e543){throw new db[(_0x8d9f('0x23'))][(_0x8d9f('0x1f'))]('Settings\x20not\x20available');}_0x2e5aaf=_0x56e543;if(!_0x2e5aaf[_0x8d9f('0x7')]||!_0x2e5aaf[_0x8d9f('0x45')]||!_0x2e5aaf['transcribeRegion']||!_0x2e5aaf[_0x8d9f('0x2a')]||!_0x2e5aaf[_0x8d9f('0x38')]){throw new db['Sequelize'][(_0x8d9f('0x1f'))]('Transcribe\x20not\x20configured');}return db[_0x8d9f('0x39')]['findOne']({'where':{'id':_0x2e5aaf[_0x8d9f('0x45')]}});})[_0x8d9f('0x10')](function(_0x181158){if(!_0x181158){throw new db[(_0x8d9f('0x23'))][(_0x8d9f('0x1f'))](_0x8d9f('0x26'));}if(!_0x181158['data1']||!_0x181158[_0x8d9f('0xf')]){throw new db['Sequelize'][(_0x8d9f('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x9ae92a=_0x181158;var _0x17cf5c=[];_0x299819[_0x8d9f('0x46')](function(_0x56a3bd){_0x17cf5c['push'](checkTranscribeJob(_0x56a3bd,_0x2e5aaf,_0x9ae92a));});return BPromise['all'](_0x17cf5c);})['catch'](function(_0xd2912e){if(_0xd2912e){if(!_0xd2912e[_0x8d9f('0x3c')]||_0xd2912e[_0x8d9f('0x3c')]!==_0x8d9f('0x3d')){logger['error'](util['inspect'](_0xd2912e,{'showHidden':![],'depth':null}));}}});}exports[_0x8d9f('0x47')]=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 c139513..43cd16b 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb272=['@xcally.com','now','destroy','then','CmContact','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','hopper2','catch','push','Innocenzo','Biondo','innocenzo.biondo'];(function(_0x317caa,_0x53b6e3){var _0x51490c=function(_0x3e2362){while(--_0x3e2362){_0x317caa['push'](_0x317caa['shift']());}};_0x51490c(++_0x53b6e3);}(_0xb272,0x84));var _0x2b27=function(_0x325ee2,_0xaf1371){_0x325ee2=_0x325ee2-0x0;var _0x7f2741=_0xb272[_0x325ee2];return _0x7f2741;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x2b27('0x0')]({'id':i,'firstName':_0x2b27('0x1')+i,'lastName':_0x2b27('0x2')+i,'phone':0xf879fb460+i,'email':_0x2b27('0x3')+i+_0x2b27('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2b27('0x0')]({'id':i,'active':![],'scheduledat':Date[_0x2b27('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2b27('0x5')](),'updatedAt':Date[_0x2b27('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2b27('0x0')]({'id':i,'firstName':_0x2b27('0x1')+i,'lastName':_0x2b27('0x2')+i,'phone':0xf879fb460+i,'email':_0x2b27('0x3')+i+_0x2b27('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2b27('0x0')]({'id':i,'active':![],'scheduledat':Date[_0x2b27('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2b27('0x5')](),'updatedAt':Date[_0x2b27('0x5')]()});}db['CmContact'][_0x2b27('0x6')]({'where':{}})[_0x2b27('0x7')](function(){return db[_0x2b27('0x8')][_0x2b27('0x9')](contacts);})['then'](function(){console[_0x2b27('0xa')](_0x2b27('0xb'),_0x2b27('0xc'));return db['CmHopper'][_0x2b27('0x6')]({'where':{}});})['then'](function(){return db[_0x2b27('0xd')][_0x2b27('0x9')](hopper);})[_0x2b27('0x7')](function(){console['log'](_0x2b27('0xb'),_0x2b27('0xe'));return db[_0x2b27('0x8')][_0x2b27('0x9')](contacts2);})[_0x2b27('0x7')](function(){console[_0x2b27('0xa')](_0x2b27('0xb'),'contacts2');return db[_0x2b27('0xd')][_0x2b27('0x9')](hopper2);})[_0x2b27('0x7')](function(){console[_0x2b27('0xa')](_0x2b27('0xb'),_0x2b27('0xf'));})[_0x2b27('0x10')](function(_0x8fe063){console[_0x2b27('0xa')](_0x8fe063);}); \ No newline at end of file +var _0xc26f=['bulkCreate','then','finished\x20populating','contacts1','CmHopper','log','hopper1','catch','util','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','destroy','CmContact'];(function(_0x589c13,_0xba19d4){var _0x168170=function(_0x33ca61){while(--_0x33ca61){_0x589c13['push'](_0x589c13['shift']());}};_0x168170(++_0xba19d4);}(_0xc26f,0x13a));var _0xfc26=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xc26f[_0x49b207];return _0x2dc8fa;};'use strict';var util=require(_0xfc26('0x0'));var db=require(_0xfc26('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xfc26('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xfc26('0x3')+i,'phone':0xf879fb460+i,'email':_0xfc26('0x4')+i+_0xfc26('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xfc26('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xfc26('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xfc26('0x2')]({'id':i,'firstName':_0xfc26('0x7')+i,'lastName':_0xfc26('0x3')+i,'phone':0xf879fb460+i,'email':_0xfc26('0x4')+i+_0xfc26('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xfc26('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xfc26('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xfc26('0x6')](),'updatedAt':Date[_0xfc26('0x6')]()});}db['CmContact'][_0xfc26('0x8')]({'where':{}})['then'](function(){return db[_0xfc26('0x9')][_0xfc26('0xa')](contacts);})[_0xfc26('0xb')](function(){console['log'](_0xfc26('0xc'),_0xfc26('0xd'));return db[_0xfc26('0xe')][_0xfc26('0x8')]({'where':{}});})['then'](function(){return db[_0xfc26('0xe')][_0xfc26('0xa')](hopper);})['then'](function(){console[_0xfc26('0xf')](_0xfc26('0xc'),_0xfc26('0x10'));return db[_0xfc26('0x9')][_0xfc26('0xa')](contacts2);})['then'](function(){console[_0xfc26('0xf')](_0xfc26('0xc'),'contacts2');return db[_0xfc26('0xe')][_0xfc26('0xa')](hopper2);})['then'](function(){console[_0xfc26('0xf')](_0xfc26('0xc'),'hopper2');})[_0xfc26('0x11')](function(_0xb40da6){console[_0xfc26('0xf')](_0xb40da6);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index a93b61d..c80a05a 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9620=['udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log','add\x20user','catch','util','push','format','%s%s','agent','%s%s@xcally.com','friend'];(function(_0x2fd0f0,_0x4b634e){var _0x57f71a=function(_0x400d6f){while(--_0x400d6f){_0x2fd0f0['push'](_0x2fd0f0['shift']());}};_0x57f71a(++_0x4b634e);}(_0x9620,0x1dc));var _0x0962=function(_0x43b7c9,_0x43fb37){_0x43b7c9=_0x43b7c9-0x0;var _0x4fce45=_0x9620[_0x43b7c9];return _0x4fce45;};'use strict';var util=require(_0x0962('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x0962('0x1')]({'name':util[_0x0962('0x2')](_0x0962('0x3'),_0x0962('0x4'),i),'fullname':util[_0x0962('0x2')]('%s%s',_0x0962('0x4'),i),'email':util['format'](_0x0962('0x5'),_0x0962('0x4'),i),'role':_0x0962('0x4'),'password':'password','internal':0xfa0+i,'type':_0x0962('0x6'),'transport':[_0x0962('0x7'),'ws',_0x0962('0x8')],'disallow':[_0x0962('0x9')],'allow':[_0x0962('0xa')],'defaultuser':util['format'](_0x0962('0x3'),_0x0962('0x4'),i),'encryption':_0x0962('0xb'),'avpf':_0x0962('0xb'),'force_avp':'yes','icesupport':_0x0962('0xb'),'dtlsenable':_0x0962('0xb'),'dtlsverify':'no','dtlscertfile':_0x0962('0xc'),'dtlsprivatekey':_0x0962('0xd'),'dtlssetup':_0x0962('0xe'),'callerid':util[_0x0962('0x2')]('\x22%s\x22\x20<%s>',util[_0x0962('0x2')]('%s%s',_0x0962('0x4'),i),0xfa0+i)});}db[_0x0962('0xf')][_0x0962('0x10')](users)[_0x0962('0x11')](function(){console[_0x0962('0x12')](_0x0962('0x13'));})[_0x0962('0x14')](function(_0x264680){console[_0x0962('0x12')](_0x264680);}); \ No newline at end of file +var _0x9763=['format','%s%s','%s%s@xcally.com','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','util','../mysqldb','push','agent'];(function(_0x1a8ff0,_0x20788d){var _0x3588bf=function(_0x3b5499){while(--_0x3b5499){_0x1a8ff0['push'](_0x1a8ff0['shift']());}};_0x3588bf(++_0x20788d);}(_0x9763,0x172));var _0x3976=function(_0x3b29b7,_0x31831e){_0x3b29b7=_0x3b29b7-0x0;var _0x2b2669=_0x9763[_0x3b29b7];return _0x2b2669;};'use strict';var util=require(_0x3976('0x0'));var db=require(_0x3976('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x3976('0x2')]({'name':util['format']('%s%s',_0x3976('0x3'),i),'fullname':util[_0x3976('0x4')](_0x3976('0x5'),_0x3976('0x3'),i),'email':util[_0x3976('0x4')](_0x3976('0x6'),_0x3976('0x3'),i),'role':_0x3976('0x3'),'password':_0x3976('0x7'),'internal':0xfa0+i,'type':_0x3976('0x8'),'transport':[_0x3976('0x9'),'ws',_0x3976('0xa')],'disallow':['all'],'allow':[_0x3976('0xb')],'defaultuser':util[_0x3976('0x4')](_0x3976('0x5'),_0x3976('0x3'),i),'encryption':'yes','avpf':_0x3976('0xc'),'force_avp':'yes','icesupport':_0x3976('0xc'),'dtlsenable':_0x3976('0xc'),'dtlsverify':'no','dtlscertfile':_0x3976('0xd'),'dtlsprivatekey':_0x3976('0xe'),'dtlssetup':_0x3976('0xf'),'callerid':util[_0x3976('0x4')](_0x3976('0x10'),util[_0x3976('0x4')](_0x3976('0x5'),_0x3976('0x3'),i),0xfa0+i)});}db[_0x3976('0x11')]['bulkCreate'](users)[_0x3976('0x12')](function(){console[_0x3976('0x13')](_0x3976('0x14'));})[_0x3976('0x15')](function(_0x4f154b){console[_0x3976('0x13')](_0x4f154b);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 890f5a2..0ead415 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bc1=['openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','setMaxListeners','address','request','connection','log','SocketIO\x20','disconnect','CONNECTED','lodash','util','bluebird','../mysqldb','Agents','User','name','role','agent','telephone','type','ivr','then','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','Campaign','format','%s:queue:%s','length','user:%s','handshake','find','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:outbound','ChatQueue','SmsQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','fax','sms'];(function(_0xde5648,_0x1dde49){var _0x1653a4=function(_0x167019){while(--_0x167019){_0xde5648['push'](_0xde5648['shift']());}};_0x1653a4(++_0x1dde49);}(_0x0bc1,0x1ae));var _0x10bc=function(_0x113f25,_0x56630a){_0x113f25=_0x113f25-0x0;var _0x2440dd=_0x0bc1[_0x113f25];return _0x2440dd;};'use strict';var _=require(_0x10bc('0x0'));var util=require(_0x10bc('0x1'));var BPromise=require(_0x10bc('0x2'));var db=require(_0x10bc('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0x10bc('0x4'),'model':db[_0x10bc('0x5')],'attributes':['id',_0x10bc('0x6'),_0x10bc('0x7')],'raw':!![],'where':{'role':_0x10bc('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x10bc('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x10bc('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0x10bc('0x6')],'where':{'role':_0x10bc('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x10bc('0x6'),_0x10bc('0xa')],'where':{'type':_0x10bc('0xb')}};function getAssociatedResources(_0x4540cb,_0x521d7d,_0x11bd0d){return db['UserProfileSection']['findOne']({'where':{'name':_0x4540cb,'userProfileId':_0x521d7d},'raw':!![]})[_0x10bc('0xc')](function(_0x3e0414){if(_0x3e0414){if(_0x3e0414['autoAssociation']){switch(_0x4540cb){case _0x10bc('0xd'):case _0x10bc('0xe'):case _0x10bc('0xf'):case'SmsQueues':case _0x10bc('0x10'):case _0x10bc('0x11'):case _0x10bc('0x12'):return db[_0x11bd0d][_0x10bc('0x13')](queryQueues);case _0x10bc('0x14'):return db[_0x11bd0d][_0x10bc('0x13')](queryTelephones);case _0x10bc('0x15'):return db[_0x11bd0d][_0x10bc('0x13')](queryTrunks);case _0x10bc('0x16'):return db[_0x11bd0d][_0x10bc('0x13')](queryCampaigns);}}else{return db[_0x10bc('0x17')][_0x10bc('0x13')]({'attributes':[_0x10bc('0x18')],'where':{'sectionId':_0x3e0414['id']},'raw':!![]})[_0x10bc('0xc')](function(_0x3ba14f){if(_0x3ba14f){var _0xf82b30={'where':{'id':_[_0x10bc('0x19')](_0x3ba14f,_0x10bc('0x18'))},'raw':!![]};switch(_0x11bd0d){case _0x10bc('0x5'):_0xf82b30['where'][_0x10bc('0x7')]='telephone';break;case _0x10bc('0x1a'):_0xf82b30['where']['type']=_0x10bc('0xb');break;}return db[_0x11bd0d][_0x10bc('0x13')](_0xf82b30);}else{return[];}});}}else{return[];}})[_0x10bc('0xc')](function(_0x56f6ee){return _0x56f6ee;});}function joinOrLeaveQueues(_0xa82d37,_0x4fde9e,_0x178915,_0x5ad529){_0xa82d37[_0x4fde9e](util[_0x10bc('0x1b')](_0x10bc('0x1c'),_0x178915,_0x5ad529['name']));if(_0x5ad529[_0x10bc('0x4')]){for(var _0xc15dcc=0x0;_0xc15dcc<_0x5ad529['Agents'][_0x10bc('0x1d')];_0xc15dcc+=0x1){_0xa82d37[_0x4fde9e](util[_0x10bc('0x1b')](_0x10bc('0x1e'),_0x5ad529[_0x10bc('0x4')][_0xc15dcc][_0x10bc('0x6')]));}}}function joinOrLeave(_0xbf6ac5,_0x5dd52b,_0x534a34){var _0x18d4d1;if(_0xbf6ac5[_0x10bc('0x1f')]['query']['id']){db[_0x10bc('0x5')][_0x10bc('0x20')]({'attributes':['id',_0x10bc('0x6'),_0x10bc('0x7'),_0x10bc('0x21')],'where':{'id':_0xbf6ac5[_0x10bc('0x1f')][_0x10bc('0x22')]['id']},'include':[{'model':db[_0x10bc('0x23')],'as':_0x10bc('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x10bc('0x25')],'as':_0x10bc('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x10bc('0x27')],'as':_0x10bc('0x28'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x10bc('0x29'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x10bc('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x10bc('0x2b')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x10bc('0xc')](function(_0x4154e6){if(_0x4154e6){_0x18d4d1=_0x4154e6;_0xbf6ac5[_0x5dd52b](util[_0x10bc('0x1b')](_0x10bc('0x1e'),_0x4154e6[_0x10bc('0x6')]));var _0x34037a=[];switch(_0x4154e6[_0x10bc('0x7')]){case _0x10bc('0x2c'):_0xbf6ac5[_0x5dd52b](_0x10bc('0x2d'));_0xbf6ac5[_0x5dd52b]('voice:outbound');if(queryQueues[_0x10bc('0x2e')](_0x10bc('0x2f'))){delete queryQueues[_0x10bc('0x2f')];}_0x34037a[_0x10bc('0x30')](db[_0x10bc('0x31')][_0x10bc('0x13')](queryQueues));_0x34037a['push'](db['ChatQueue']['findAll'](queryQueues));_0x34037a[_0x10bc('0x30')](db[_0x10bc('0x32')][_0x10bc('0x13')](queryQueues));_0x34037a[_0x10bc('0x30')](db[_0x10bc('0x33')]['findAll'](queryQueues));_0x34037a[_0x10bc('0x30')](db[_0x10bc('0x34')][_0x10bc('0x13')](queryQueues));_0x34037a[_0x10bc('0x30')](db[_0x10bc('0x35')][_0x10bc('0x13')](queryQueues));_0x34037a[_0x10bc('0x30')](db[_0x10bc('0x36')][_0x10bc('0x13')](queryQueues));_0x34037a['push'](db[_0x10bc('0x5')][_0x10bc('0x13')](queryTelephones));_0x34037a[_0x10bc('0x30')](db[_0x10bc('0x37')][_0x10bc('0x13')](queryTrunks));_0x34037a['push'](db['Campaign']['findAll'](queryCampaigns));_0x34037a[_0x10bc('0x30')](db[_0x10bc('0x5')][_0x10bc('0x13')](queryAgents));break;case _0x10bc('0x38'):_0xbf6ac5[_0x5dd52b](_0x10bc('0x2d'));_0xbf6ac5[_0x5dd52b](_0x10bc('0x39'));_0x34037a['push'](getAssociatedResources(_0x10bc('0xd'),_0x4154e6[_0x10bc('0x21')],_0x10bc('0x31')));_0x34037a[_0x10bc('0x30')](getAssociatedResources(_0x10bc('0xe'),_0x4154e6[_0x10bc('0x21')],_0x10bc('0x3a')));_0x34037a['push'](getAssociatedResources(_0x10bc('0xf'),_0x4154e6[_0x10bc('0x21')],_0x10bc('0x32')));_0x34037a[_0x10bc('0x30')](getAssociatedResources(_0x10bc('0x3b'),_0x4154e6[_0x10bc('0x21')],'SmsQueue'));_0x34037a[_0x10bc('0x30')](getAssociatedResources(_0x10bc('0x10'),_0x4154e6[_0x10bc('0x21')],_0x10bc('0x34')));_0x34037a[_0x10bc('0x30')](getAssociatedResources(_0x10bc('0x11'),_0x4154e6[_0x10bc('0x21')],_0x10bc('0x35')));_0x34037a[_0x10bc('0x30')](getAssociatedResources('WhatsappQueues',_0x4154e6['userProfileId'],_0x10bc('0x36')));_0x34037a[_0x10bc('0x30')](getAssociatedResources(_0x10bc('0x14'),_0x4154e6[_0x10bc('0x21')],_0x10bc('0x5')));_0x34037a['push'](getAssociatedResources(_0x10bc('0x15'),_0x4154e6[_0x10bc('0x21')],_0x10bc('0x37')));_0x34037a['push'](getAssociatedResources('IvrCampaigns',_0x4154e6[_0x10bc('0x21')],_0x10bc('0x1a')));_0x34037a[_0x10bc('0x30')](db[_0x10bc('0x5')][_0x10bc('0x13')](queryAgents));break;case _0x10bc('0x8'):_0xbf6ac5[_0x5dd52b](_0x10bc('0x2d'));_0xbf6ac5[_0x5dd52b](_0x10bc('0x39'));_0x34037a['push'](_0x4154e6[_0x10bc('0x3c')]({'attributes':['id',_0x10bc('0x6')]}));_0x34037a[_0x10bc('0x30')](_0x4154e6[_0x10bc('0x3d')]({'attributes':['id',_0x10bc('0x6')]}));_0x34037a[_0x10bc('0x30')](_0x4154e6[_0x10bc('0x3e')]({'attributes':['id','name']}));_0x34037a[_0x10bc('0x30')](_0x4154e6[_0x10bc('0x3f')]({'attributes':['id',_0x10bc('0x6')]}));_0x34037a[_0x10bc('0x30')](_0x4154e6['getMailQueues']({'attributes':['id',_0x10bc('0x6')]}));_0x34037a[_0x10bc('0x30')](_0x4154e6[_0x10bc('0x40')]({'attributes':['id',_0x10bc('0x6')]}));_0x34037a[_0x10bc('0x30')](_0x4154e6[_0x10bc('0x41')]({'attributes':['id',_0x10bc('0x6')]}));break;}return BPromise['all'](_0x34037a);}})[_0x10bc('0xc')](function(_0x5cc9fc){if(_0x5cc9fc&&_0x5cc9fc[_0x10bc('0x1d')]){for(var _0x40d432=0x0;_0x40d432<_0x5cc9fc[_0x10bc('0x1d')];_0x40d432+=0x1){for(var _0x57f9ea=0x0;_0x57f9ea<_0x5cc9fc[_0x40d432][_0x10bc('0x1d')];_0x57f9ea+=0x1){switch(_0x40d432){case 0x0:joinOrLeaveQueues(_0xbf6ac5,_0x5dd52b,_0x10bc('0x42'),_0x5cc9fc[_0x40d432][_0x57f9ea]);break;case 0x1:joinOrLeaveQueues(_0xbf6ac5,_0x5dd52b,_0x10bc('0x43'),_0x5cc9fc[_0x40d432][_0x57f9ea]);break;case 0x2:joinOrLeaveQueues(_0xbf6ac5,_0x5dd52b,_0x10bc('0x44'),_0x5cc9fc[_0x40d432][_0x57f9ea]);break;case 0x3:joinOrLeaveQueues(_0xbf6ac5,_0x5dd52b,_0x10bc('0x45'),_0x5cc9fc[_0x40d432][_0x57f9ea]);break;case 0x4:joinOrLeaveQueues(_0xbf6ac5,_0x5dd52b,'mail',_0x5cc9fc[_0x40d432][_0x57f9ea]);break;case 0x5:joinOrLeaveQueues(_0xbf6ac5,_0x5dd52b,_0x10bc('0x46'),_0x5cc9fc[_0x40d432][_0x57f9ea]);break;case 0x6:joinOrLeaveQueues(_0xbf6ac5,_0x5dd52b,_0x10bc('0x47'),_0x5cc9fc[_0x40d432][_0x57f9ea]);break;case 0x7:_0xbf6ac5[_0x5dd52b](util[_0x10bc('0x1b')](_0x10bc('0x48'),_0x5cc9fc[_0x40d432][_0x57f9ea][_0x10bc('0x6')]));break;case 0x8:_0xbf6ac5[_0x5dd52b](util[_0x10bc('0x1b')](_0x10bc('0x49'),_0x5cc9fc[_0x40d432][_0x57f9ea][_0x10bc('0x6')]));break;case 0x9:_0xbf6ac5[_0x5dd52b](util[_0x10bc('0x1b')](_0x10bc('0x4a'),_0x5cc9fc[_0x40d432][_0x57f9ea]['type'],_0x5cc9fc[_0x40d432][_0x57f9ea][_0x10bc('0x6')]));break;case 0xa:_0xbf6ac5[_0x5dd52b](util[_0x10bc('0x1b')](_0x10bc('0x1e'),_0x5cc9fc[_0x40d432][_0x57f9ea][_0x10bc('0x6')]));break;}}}}})[_0x10bc('0xc')](function(){if(_0x5dd52b===_0x10bc('0x4b')){var _0x2e9d54=_['map'](_0x18d4d1['ChatInteractions'],'id');return _0x18d4d1[_0x10bc('0x4c')](_0x2e9d54)[_0x10bc('0xc')](function(){for(var _0x253761=0x0;_0x253761<_0x2e9d54[_0x10bc('0x1d')];_0x253761+=0x1){_0x534a34[_0x10bc('0x4d')](_0x10bc('0x4e'),{'ChatInteractionId':Number(_0x2e9d54[_0x253761]),'UserId':Number(_0x18d4d1['id'])});}});}})[_0x10bc('0xc')](function(){if(_0x5dd52b===_0x10bc('0x4b')){var _0x4e264c=_['map'](_0x18d4d1[_0x10bc('0x26')],'id');return _0x18d4d1['removeMailInteractions'](_0x4e264c)[_0x10bc('0xc')](function(){for(var _0x12910f=0x0;_0x12910f<_0x4e264c[_0x10bc('0x1d')];_0x12910f+=0x1){_0x534a34[_0x10bc('0x4d')](_0x10bc('0x4f'),{'MailInteractionId':Number(_0x4e264c[_0x12910f]),'UserId':Number(_0x18d4d1['id'])});}});}})[_0x10bc('0xc')](function(){if(_0x5dd52b===_0x10bc('0x4b')){var _0x4efb35=_[_0x10bc('0x19')](_0x18d4d1[_0x10bc('0x28')],'id');return _0x18d4d1[_0x10bc('0x50')](_0x4efb35)[_0x10bc('0xc')](function(){for(var _0x10ce63=0x0;_0x10ce63<_0x4efb35['length'];_0x10ce63+=0x1){_0x534a34[_0x10bc('0x4d')](_0x10bc('0x51'),{'FaxInteractionId':Number(_0x4efb35[_0x10ce63]),'UserId':Number(_0x18d4d1['id'])});}});}})[_0x10bc('0xc')](function(){if(_0x5dd52b===_0x10bc('0x4b')){var _0x42ab53=_[_0x10bc('0x19')](_0x18d4d1[_0x10bc('0x29')],'id');return _0x18d4d1[_0x10bc('0x52')](_0x42ab53)[_0x10bc('0xc')](function(){for(var _0x4dcbfe=0x0;_0x4dcbfe<_0x42ab53[_0x10bc('0x1d')];_0x4dcbfe+=0x1){_0x534a34['emit'](_0x10bc('0x53'),{'SmsInteractionId':Number(_0x42ab53[_0x4dcbfe]),'UserId':Number(_0x18d4d1['id'])});}});}})[_0x10bc('0xc')](function(){if(_0x5dd52b==='leave'){var _0x4b0729=_['map'](_0x18d4d1[_0x10bc('0x2a')],'id');return _0x18d4d1[_0x10bc('0x54')](_0x4b0729)[_0x10bc('0xc')](function(){for(var _0x15e558=0x0;_0x15e558<_0x4b0729[_0x10bc('0x1d')];_0x15e558+=0x1){_0x534a34['emit'](_0x10bc('0x55'),{'OpenchannelInteractionId':Number(_0x4b0729[_0x15e558]),'UserId':Number(_0x18d4d1['id'])});}});}})['then'](function(){if(_0x5dd52b===_0x10bc('0x4b')){var _0xf973bc=_['map'](_0x18d4d1[_0x10bc('0x56')],'id');return _0x18d4d1[_0x10bc('0x57')](_0xf973bc)[_0x10bc('0xc')](function(){for(var _0x36eb08=0x0;_0x36eb08<_0xf973bc['length'];_0x36eb08+=0x1){_0x534a34[_0x10bc('0x4d')](_0x10bc('0x58'),{'WhatsappInteractionId':Number(_0xf973bc[_0x36eb08]),'UserId':Number(_0x18d4d1['id'])});}});}})[_0x10bc('0x59')](function(_0x313488){_0xbf6ac5['log'](_0x313488);});}}function onDisconnect(_0x2442f3,_0x187e9e){joinOrLeave(_0x2442f3,'leave',_0x187e9e);}function onConnect(_0x416b00){joinOrLeave(_0x416b00,_0x10bc('0x5a'));}exports[_0x10bc('0x5b')]=function(_0x32b6cb){_0x32b6cb['on']('connection',function(_0x54b1b0){_0x54b1b0[_0x10bc('0x5c')](0x0);_0x54b1b0[_0x10bc('0x5d')]=_0x54b1b0[_0x10bc('0x5e')][_0x10bc('0x5f')]['remoteAddress']+':'+_0x54b1b0[_0x10bc('0x5e')][_0x10bc('0x5f')]['remotePort'];_0x54b1b0['connectedAt']=new Date();_0x54b1b0[_0x10bc('0x60')]=function(_0x1f9e4a){console[_0x10bc('0x60')](_0x10bc('0x61')+_0x54b1b0['nsp'][_0x10bc('0x6')]+'['+_0x54b1b0[_0x10bc('0x5d')]+']',_0x1f9e4a);};_0x54b1b0['on'](_0x10bc('0x62'),function(){onDisconnect(_0x54b1b0,_0x32b6cb);_0x54b1b0[_0x10bc('0x60')]('DISCONNECTED');});onConnect(_0x54b1b0);_0x54b1b0[_0x10bc('0x60')](_0x10bc('0x63'));});}; \ No newline at end of file +var _0xba73=['connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','Agents','name','role','agent','telephone','type','ivr','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','UserProfileResource','map','resourceId','Campaign','format','length','user:%s','handshake','User','find','userProfileId','query','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','Trunk','ChatQueues','OpenchannelQueue','WhatsappQueue','Telephones','IvrCampaigns','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','campaign:%s:%s','leave','ChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','remoteAddress','request','remotePort'];(function(_0x4f5dbe,_0x81aa60){var _0x6972cb=function(_0x4b87d6){while(--_0x4b87d6){_0x4f5dbe['push'](_0x4f5dbe['shift']());}};_0x6972cb(++_0x81aa60);}(_0xba73,0x6b));var _0x3ba7=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xba73[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require('lodash');var util=require(_0x3ba7('0x0'));var BPromise=require(_0x3ba7('0x1'));var db=require(_0x3ba7('0x2'))['db'];var config=require(_0x3ba7('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x3ba7('0x4'),'model':db['User'],'attributes':['id',_0x3ba7('0x5'),_0x3ba7('0x6')],'raw':!![],'where':{'role':_0x3ba7('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x3ba7('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x3ba7('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x3ba7('0x5')],'where':{'role':_0x3ba7('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x3ba7('0x5'),_0x3ba7('0x9')],'where':{'type':_0x3ba7('0xa')}};function getAssociatedResources(_0x2e5269,_0x24f063,_0x4448de){return db['UserProfileSection']['findOne']({'where':{'name':_0x2e5269,'userProfileId':_0x24f063},'raw':!![]})[_0x3ba7('0xb')](function(_0x274ee5){if(_0x274ee5){if(_0x274ee5[_0x3ba7('0xc')]){switch(_0x2e5269){case _0x3ba7('0xd'):case'ChatQueues':case _0x3ba7('0xe'):case _0x3ba7('0xf'):case _0x3ba7('0x10'):case _0x3ba7('0x11'):case _0x3ba7('0x12'):return db[_0x4448de][_0x3ba7('0x13')](queryQueues);case'Telephones':return db[_0x4448de][_0x3ba7('0x13')](queryTelephones);case _0x3ba7('0x14'):return db[_0x4448de][_0x3ba7('0x13')](queryTrunks);case'IvrCampaigns':return db[_0x4448de]['findAll'](queryCampaigns);}}else{return db[_0x3ba7('0x15')][_0x3ba7('0x13')]({'attributes':['resourceId'],'where':{'sectionId':_0x274ee5['id']},'raw':!![]})[_0x3ba7('0xb')](function(_0xe0c7bd){if(_0xe0c7bd){var _0xbed82e={'where':{'id':_[_0x3ba7('0x16')](_0xe0c7bd,_0x3ba7('0x17'))},'raw':!![]};switch(_0x4448de){case'User':_0xbed82e['where'][_0x3ba7('0x6')]='telephone';break;case _0x3ba7('0x18'):_0xbed82e['where'][_0x3ba7('0x9')]='ivr';break;}return db[_0x4448de][_0x3ba7('0x13')](_0xbed82e);}else{return[];}});}}else{return[];}})[_0x3ba7('0xb')](function(_0x4dac4f){return _0x4dac4f;});}function joinOrLeaveQueues(_0x47f685,_0x47cdf3,_0x3abf58,_0x144b46){_0x47f685[_0x47cdf3](util[_0x3ba7('0x19')]('%s:queue:%s',_0x3abf58,_0x144b46[_0x3ba7('0x5')]));if(_0x144b46[_0x3ba7('0x4')]){for(var _0x2f9a3b=0x0;_0x2f9a3b<_0x144b46[_0x3ba7('0x4')][_0x3ba7('0x1a')];_0x2f9a3b+=0x1){_0x47f685[_0x47cdf3](util[_0x3ba7('0x19')](_0x3ba7('0x1b'),_0x144b46[_0x3ba7('0x4')][_0x2f9a3b][_0x3ba7('0x5')]));}}}function joinOrLeave(_0x315522,_0x38cac6,_0x1b271d){var _0x301076;if(_0x315522[_0x3ba7('0x1c')]['query']['id']){db[_0x3ba7('0x1d')][_0x3ba7('0x1e')]({'attributes':['id',_0x3ba7('0x5'),_0x3ba7('0x6'),_0x3ba7('0x1f')],'where':{'id':_0x315522[_0x3ba7('0x1c')][_0x3ba7('0x20')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x3ba7('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x3ba7('0x22')],'as':_0x3ba7('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x3ba7('0x24')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x3ba7('0x25')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x3ba7('0x26')],'as':_0x3ba7('0x27'),'attributes':['id'],'raw':!![]}]})[_0x3ba7('0xb')](function(_0x5f269c){if(_0x5f269c){_0x301076=_0x5f269c;_0x315522[_0x38cac6](util[_0x3ba7('0x19')](_0x3ba7('0x1b'),_0x5f269c['name']));var _0x27272a=[];switch(_0x5f269c[_0x3ba7('0x6')]){case'admin':_0x315522[_0x38cac6](_0x3ba7('0x28'));_0x315522[_0x38cac6](_0x3ba7('0x29'));if(queryQueues['hasOwnProperty'](_0x3ba7('0x2a'))){delete queryQueues[_0x3ba7('0x2a')];}_0x27272a['push'](db[_0x3ba7('0x2b')][_0x3ba7('0x13')](queryQueues));_0x27272a[_0x3ba7('0x2c')](db[_0x3ba7('0x2d')]['findAll'](queryQueues));_0x27272a[_0x3ba7('0x2c')](db[_0x3ba7('0x2e')]['findAll'](queryQueues));_0x27272a[_0x3ba7('0x2c')](db[_0x3ba7('0x2f')][_0x3ba7('0x13')](queryQueues));_0x27272a[_0x3ba7('0x2c')](db[_0x3ba7('0x30')][_0x3ba7('0x13')](queryQueues));_0x27272a[_0x3ba7('0x2c')](db['OpenchannelQueue'][_0x3ba7('0x13')](queryQueues));_0x27272a[_0x3ba7('0x2c')](db['WhatsappQueue'][_0x3ba7('0x13')](queryQueues));_0x27272a[_0x3ba7('0x2c')](db['User'][_0x3ba7('0x13')](queryTelephones));_0x27272a[_0x3ba7('0x2c')](db[_0x3ba7('0x31')][_0x3ba7('0x13')](queryTrunks));_0x27272a[_0x3ba7('0x2c')](db[_0x3ba7('0x18')][_0x3ba7('0x13')](queryCampaigns));_0x27272a[_0x3ba7('0x2c')](db['User'][_0x3ba7('0x13')](queryAgents));break;case'user':_0x315522[_0x38cac6](_0x3ba7('0x28'));_0x315522[_0x38cac6](_0x3ba7('0x29'));_0x27272a['push'](getAssociatedResources(_0x3ba7('0xd'),_0x5f269c[_0x3ba7('0x1f')],_0x3ba7('0x2b')));_0x27272a[_0x3ba7('0x2c')](getAssociatedResources(_0x3ba7('0x32'),_0x5f269c['userProfileId'],_0x3ba7('0x2d')));_0x27272a[_0x3ba7('0x2c')](getAssociatedResources('FaxQueues',_0x5f269c[_0x3ba7('0x1f')],_0x3ba7('0x2e')));_0x27272a[_0x3ba7('0x2c')](getAssociatedResources(_0x3ba7('0xf'),_0x5f269c[_0x3ba7('0x1f')],_0x3ba7('0x2f')));_0x27272a['push'](getAssociatedResources(_0x3ba7('0x10'),_0x5f269c['userProfileId'],_0x3ba7('0x30')));_0x27272a['push'](getAssociatedResources('OpenchannelQueues',_0x5f269c[_0x3ba7('0x1f')],_0x3ba7('0x33')));_0x27272a[_0x3ba7('0x2c')](getAssociatedResources(_0x3ba7('0x12'),_0x5f269c['userProfileId'],_0x3ba7('0x34')));_0x27272a[_0x3ba7('0x2c')](getAssociatedResources(_0x3ba7('0x35'),_0x5f269c[_0x3ba7('0x1f')],'User'));_0x27272a[_0x3ba7('0x2c')](getAssociatedResources(_0x3ba7('0x14'),_0x5f269c[_0x3ba7('0x1f')],_0x3ba7('0x31')));_0x27272a[_0x3ba7('0x2c')](getAssociatedResources(_0x3ba7('0x36'),_0x5f269c[_0x3ba7('0x1f')],_0x3ba7('0x18')));_0x27272a['push'](db[_0x3ba7('0x1d')][_0x3ba7('0x13')](queryAgents));break;case'agent':_0x315522[_0x38cac6](_0x3ba7('0x28'));_0x315522[_0x38cac6]('voice:outbound');_0x27272a[_0x3ba7('0x2c')](_0x5f269c[_0x3ba7('0x37')]({'attributes':['id','name']}));_0x27272a[_0x3ba7('0x2c')](_0x5f269c[_0x3ba7('0x38')]({'attributes':['id',_0x3ba7('0x5')]}));_0x27272a[_0x3ba7('0x2c')](_0x5f269c['getFaxQueues']({'attributes':['id',_0x3ba7('0x5')]}));_0x27272a[_0x3ba7('0x2c')](_0x5f269c[_0x3ba7('0x39')]({'attributes':['id','name']}));_0x27272a['push'](_0x5f269c[_0x3ba7('0x3a')]({'attributes':['id',_0x3ba7('0x5')]}));_0x27272a[_0x3ba7('0x2c')](_0x5f269c[_0x3ba7('0x3b')]({'attributes':['id','name']}));_0x27272a[_0x3ba7('0x2c')](_0x5f269c[_0x3ba7('0x3c')]({'attributes':['id',_0x3ba7('0x5')]}));break;}return BPromise[_0x3ba7('0x3d')](_0x27272a);}})[_0x3ba7('0xb')](function(_0x182f5f){if(_0x182f5f&&_0x182f5f[_0x3ba7('0x1a')]){for(var _0x1027e6=0x0;_0x1027e6<_0x182f5f[_0x3ba7('0x1a')];_0x1027e6+=0x1){for(var _0x30723a=0x0;_0x30723a<_0x182f5f[_0x1027e6]['length'];_0x30723a+=0x1){switch(_0x1027e6){case 0x0:joinOrLeaveQueues(_0x315522,_0x38cac6,_0x3ba7('0x3e'),_0x182f5f[_0x1027e6][_0x30723a]);break;case 0x1:joinOrLeaveQueues(_0x315522,_0x38cac6,_0x3ba7('0x3f'),_0x182f5f[_0x1027e6][_0x30723a]);break;case 0x2:joinOrLeaveQueues(_0x315522,_0x38cac6,_0x3ba7('0x40'),_0x182f5f[_0x1027e6][_0x30723a]);break;case 0x3:joinOrLeaveQueues(_0x315522,_0x38cac6,_0x3ba7('0x41'),_0x182f5f[_0x1027e6][_0x30723a]);break;case 0x4:joinOrLeaveQueues(_0x315522,_0x38cac6,_0x3ba7('0x42'),_0x182f5f[_0x1027e6][_0x30723a]);break;case 0x5:joinOrLeaveQueues(_0x315522,_0x38cac6,_0x3ba7('0x43'),_0x182f5f[_0x1027e6][_0x30723a]);break;case 0x6:joinOrLeaveQueues(_0x315522,_0x38cac6,_0x3ba7('0x44'),_0x182f5f[_0x1027e6][_0x30723a]);break;case 0x7:_0x315522[_0x38cac6](util[_0x3ba7('0x19')]('telephone:%s',_0x182f5f[_0x1027e6][_0x30723a][_0x3ba7('0x5')]));break;case 0x8:_0x315522[_0x38cac6](util[_0x3ba7('0x19')]('trunk:%s',_0x182f5f[_0x1027e6][_0x30723a][_0x3ba7('0x5')]));break;case 0x9:_0x315522[_0x38cac6](util[_0x3ba7('0x19')](_0x3ba7('0x45'),_0x182f5f[_0x1027e6][_0x30723a][_0x3ba7('0x9')],_0x182f5f[_0x1027e6][_0x30723a][_0x3ba7('0x5')]));break;case 0xa:_0x315522[_0x38cac6](util[_0x3ba7('0x19')](_0x3ba7('0x1b'),_0x182f5f[_0x1027e6][_0x30723a][_0x3ba7('0x5')]));break;}}}}})['then'](function(){if(_0x38cac6===_0x3ba7('0x46')){var _0x4e7d0a=_[_0x3ba7('0x16')](_0x301076[_0x3ba7('0x47')],'id');return _0x301076['removeChatInteractions'](_0x4e7d0a)[_0x3ba7('0xb')](function(){for(var _0x4d2a4e=0x0;_0x4d2a4e<_0x4e7d0a[_0x3ba7('0x1a')];_0x4d2a4e+=0x1){_0x1b271d[_0x3ba7('0x48')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x4e7d0a[_0x4d2a4e]),'UserId':Number(_0x301076['id'])});}});}})['then'](function(){if(_0x38cac6===_0x3ba7('0x46')){var _0x1117f5=_['map'](_0x301076[_0x3ba7('0x21')],'id');return _0x301076[_0x3ba7('0x49')](_0x1117f5)[_0x3ba7('0xb')](function(){for(var _0x1e9598=0x0;_0x1e9598<_0x1117f5[_0x3ba7('0x1a')];_0x1e9598+=0x1){_0x1b271d['emit'](_0x3ba7('0x4a'),{'MailInteractionId':Number(_0x1117f5[_0x1e9598]),'UserId':Number(_0x301076['id'])});}});}})[_0x3ba7('0xb')](function(){if(_0x38cac6===_0x3ba7('0x46')){var _0xc02c99=_['map'](_0x301076[_0x3ba7('0x23')],'id');return _0x301076[_0x3ba7('0x4b')](_0xc02c99)['then'](function(){for(var _0x5f36e4=0x0;_0x5f36e4<_0xc02c99[_0x3ba7('0x1a')];_0x5f36e4+=0x1){_0x1b271d['emit'](_0x3ba7('0x4c'),{'FaxInteractionId':Number(_0xc02c99[_0x5f36e4]),'UserId':Number(_0x301076['id'])});}});}})[_0x3ba7('0xb')](function(){if(_0x38cac6===_0x3ba7('0x46')){var _0x3e057a=_[_0x3ba7('0x16')](_0x301076[_0x3ba7('0x4d')],'id');return _0x301076[_0x3ba7('0x4e')](_0x3e057a)['then'](function(){for(var _0x3e6496=0x0;_0x3e6496<_0x3e057a[_0x3ba7('0x1a')];_0x3e6496+=0x1){_0x1b271d['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x3e057a[_0x3e6496]),'UserId':Number(_0x301076['id'])});}});}})['then'](function(){if(_0x38cac6===_0x3ba7('0x46')){var _0x550e44=_['map'](_0x301076[_0x3ba7('0x4f')],'id');return _0x301076[_0x3ba7('0x50')](_0x550e44)[_0x3ba7('0xb')](function(){for(var _0x41e15c=0x0;_0x41e15c<_0x550e44[_0x3ba7('0x1a')];_0x41e15c+=0x1){_0x1b271d[_0x3ba7('0x48')](_0x3ba7('0x51'),{'OpenchannelInteractionId':Number(_0x550e44[_0x41e15c]),'UserId':Number(_0x301076['id'])});}});}})['then'](function(){if(_0x38cac6===_0x3ba7('0x46')){var _0x25218d=_[_0x3ba7('0x16')](_0x301076['WhatsappInteractions'],'id');return _0x301076[_0x3ba7('0x52')](_0x25218d)[_0x3ba7('0xb')](function(){for(var _0x3f3bad=0x0;_0x3f3bad<_0x25218d[_0x3ba7('0x1a')];_0x3f3bad+=0x1){_0x1b271d[_0x3ba7('0x48')](_0x3ba7('0x53'),{'WhatsappInteractionId':Number(_0x25218d[_0x3f3bad]),'UserId':Number(_0x301076['id'])});}});}})[_0x3ba7('0x54')](function(_0x5cf9a5){_0x315522['log'](_0x5cf9a5);});}}function onDisconnect(_0x3d6d9c,_0x282200){joinOrLeave(_0x3d6d9c,_0x3ba7('0x46'),_0x282200);}function onConnect(_0x523470){joinOrLeave(_0x523470,_0x3ba7('0x55'));}exports[_0x3ba7('0x56')]=function(_0x53c934){_0x53c934['on'](_0x3ba7('0x57'),function(_0xb8ebb0){_0xb8ebb0[_0x3ba7('0x58')](0x0);_0xb8ebb0[_0x3ba7('0x59')]=_0xb8ebb0['request'][_0x3ba7('0x57')][_0x3ba7('0x5a')]+':'+_0xb8ebb0[_0x3ba7('0x5b')][_0x3ba7('0x57')][_0x3ba7('0x5c')];_0xb8ebb0[_0x3ba7('0x5d')]=new Date();_0xb8ebb0[_0x3ba7('0x5e')]=function(_0x51ceed){console[_0x3ba7('0x5e')](_0x3ba7('0x5f')+_0xb8ebb0[_0x3ba7('0x60')]['name']+'['+_0xb8ebb0[_0x3ba7('0x59')]+']',_0x51ceed);};_0xb8ebb0['on'](_0x3ba7('0x61'),function(){onDisconnect(_0xb8ebb0,_0x53c934);_0xb8ebb0[_0x3ba7('0x5e')](_0x3ba7('0x62'));});onConnect(_0xb8ebb0);_0xb8ebb0[_0x3ba7('0x5e')](_0x3ba7('0x63'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index f47eb72..6dcfaf2 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 _0xdb51=['Chat','ChatInteraction','afterUpdate','closedinteraction','afterCreate','newmessage','Sms','SmsInteraction','newinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','then','info','Trigger,\x20%s','EventManager','error','code','catch','get','channel','direction','UserId','find','name','interface','format','SIP/%s','incomingmessage','outgoingmessage','event','opened','changed','closed','User','default','length','hasOwnProperty','model','hook','../../mysqldb','jayson/promise','../logger','triggers','client'];(function(_0x498e3c,_0x2455c4){var _0x1e5f5f=function(_0x1d981b){while(--_0x1d981b){_0x498e3c['push'](_0x498e3c['shift']());}};_0x1e5f5f(++_0x2455c4);}(_0xdb51,0x1cf));var _0x1db5=function(_0x5f0c8c,_0x1f9ee0){_0x5f0c8c=_0x5f0c8c-0x0;var _0xbe7ad3=_0xdb51[_0x5f0c8c];return _0xbe7ad3;};'use strict';var util=require('util');var db=require(_0x1db5('0x0'))['db'];var jayson=require(_0x1db5('0x1'));var logger=require(_0x1db5('0x2'))(_0x1db5('0x3'));var client=jayson[_0x1db5('0x4')]['http']({'port':0x232a});var triggers=[{'channel':_0x1db5('0x5'),'model':'ChatInteraction','event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x1db5('0x5'),'model':_0x1db5('0x6'),'event':_0x1db5('0x7'),'condition':_0x1db5('0x8'),'callback':afterUpdate},{'channel':_0x1db5('0x5'),'model':'ChatMessage','event':_0x1db5('0x9'),'condition':_0x1db5('0xa'),'callback':afterCreateMessage},{'channel':_0x1db5('0xb'),'model':_0x1db5('0xc'),'event':'afterCreate','condition':_0x1db5('0xd'),'callback':afterCreate},{'channel':_0x1db5('0xb'),'model':'SmsInteraction','event':_0x1db5('0x7'),'condition':_0x1db5('0x8'),'callback':afterUpdate},{'channel':_0x1db5('0xb'),'model':_0x1db5('0xe'),'event':_0x1db5('0x9'),'condition':_0x1db5('0xa'),'callback':afterCreateMessage},{'channel':_0x1db5('0xf'),'model':_0x1db5('0x10'),'event':_0x1db5('0x9'),'condition':_0x1db5('0xd'),'callback':afterCreate},{'channel':'Whatsapp','model':_0x1db5('0x10'),'event':_0x1db5('0x7'),'condition':_0x1db5('0x8'),'callback':afterUpdate},{'channel':_0x1db5('0xf'),'model':_0x1db5('0x11'),'event':_0x1db5('0x9'),'condition':_0x1db5('0xa'),'callback':afterCreateMessage},{'channel':_0x1db5('0x12'),'model':_0x1db5('0x13'),'event':_0x1db5('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':'Fax','model':_0x1db5('0x13'),'event':_0x1db5('0x7'),'condition':_0x1db5('0x8'),'callback':afterUpdate},{'channel':_0x1db5('0x12'),'model':'FaxMessage','event':_0x1db5('0x9'),'condition':_0x1db5('0xa'),'callback':afterCreateMessage},{'channel':'Mail','model':'MailInteraction','event':_0x1db5('0x9'),'condition':_0x1db5('0xd'),'callback':afterCreate},{'channel':'Mail','model':_0x1db5('0x14'),'event':_0x1db5('0x7'),'condition':_0x1db5('0x8'),'callback':afterUpdate},{'channel':'Mail','model':'MailMessage','event':_0x1db5('0x9'),'condition':_0x1db5('0xa'),'callback':afterCreateMessage},{'channel':_0x1db5('0x15'),'model':_0x1db5('0x16'),'event':_0x1db5('0x9'),'condition':_0x1db5('0xd'),'callback':afterCreate},{'channel':_0x1db5('0x15'),'model':_0x1db5('0x16'),'event':_0x1db5('0x7'),'condition':_0x1db5('0x8'),'callback':afterUpdate},{'channel':_0x1db5('0x15'),'model':_0x1db5('0x17'),'event':_0x1db5('0x9'),'condition':_0x1db5('0xa'),'callback':afterCreateMessage}];function request(_0x17c5fc){return client['request']('EventManager',_0x17c5fc)[_0x1db5('0x18')](function(_0x181757){logger[_0x1db5('0x19')](_0x1db5('0x1a'),_0x1db5('0x1b'),_0x181757);if(_0x181757[_0x1db5('0x1c')]){if(_0x181757['error'][_0x1db5('0x1d')]===0x1f4){logger['error'](_0x1db5('0x1a'),_0x1db5('0x1b'),_0x181757[_0x1db5('0x1c')]);}}})[_0x1db5('0x1e')](function(_0x52fa8e){logger['error'](_0x1db5('0x1a'),_0x1db5('0x1b'),_0x52fa8e);});}function afterCreateMessage(_0x317288,_0xdc0ff){return function(_0x4c1c4c,_0x15e9bf){_0x4c1c4c=_0x4c1c4c[_0x1db5('0x1f')]({'plain':!![]});_0x4c1c4c[_0x1db5('0x20')]=_0x317288;_0x4c1c4c['event']=_0x4c1c4c[_0x1db5('0x21')];if(_0x4c1c4c[_0x1db5('0x22')]){return db['User'][_0x1db5('0x23')]({'where':{'id':_0x4c1c4c[_0x1db5('0x22')]},'attributes':['id',_0x1db5('0x24')],'raw':!![]})[_0x1db5('0x18')](function(_0x44f995){_0x4c1c4c[_0x1db5('0x25')]=util[_0x1db5('0x26')](_0x1db5('0x27'),_0x44f995[_0x1db5('0x24')]);_0x4c1c4c[_0x1db5('0x20')]=_0x317288;return request({'event':_0x1db5('0x28'),'message':_0x4c1c4c});})['catch'](function(_0x1f2175){console[_0x1db5('0x1c')](_0x1f2175);});}else{return request({'event':_0x1db5('0x29'),'message':_0x4c1c4c});}};}function afterCreate(_0x26fc48,_0x4838f5){return function(_0x5e0480,_0x26ab6e){_0x5e0480=_0x5e0480[_0x1db5('0x1f')]({'plain':!![]});_0x5e0480['channel']=_0x26fc48;_0x5e0480[_0x1db5('0x2a')]=_0x1db5('0x2b');return request({'event':_0x4838f5,'message':_0x5e0480});};}function afterUpdate(_0x131669,_0x16ddff){return function(_0x19507f,_0x4ff59c){if(_0x19507f[_0x1db5('0x2c')](_0x1db5('0x2d'))&&_0x19507f[_0x1db5('0x2d')]){_0x19507f=_0x19507f[_0x1db5('0x1f')]({'plain':!![]});_0x19507f[_0x1db5('0x20')]=_0x131669;_0x19507f[_0x1db5('0x2a')]=_0x1db5('0x2d');if(_0x19507f[_0x1db5('0x22')]){return db[_0x1db5('0x2e')][_0x1db5('0x23')]({'where':{'id':_0x19507f[_0x1db5('0x22')]},'attributes':['id',_0x1db5('0x24')],'raw':!![]})[_0x1db5('0x18')](function(_0x2d56ff){_0x19507f[_0x1db5('0x25')]=util[_0x1db5('0x26')](_0x1db5('0x27'),_0x2d56ff['name']);return request({'event':_0x16ddff,'message':_0x19507f});})[_0x1db5('0x1e')](function(_0x43a8ec){console[_0x1db5('0x1c')](_0x43a8ec);});}else{return request({'event':_0x16ddff,'message':_0x19507f});}}};}exports[_0x1db5('0x2f')]=function(){for(var _0x34d74a=0x0;_0x34d74a=_0x436d62[_0xb841('0x14')]){throw Error(_0xb841('0x15'));}_0x5ba873(_0x360ef8);})[_0xb841('0x16')](function(_0x1d399e){_0x3be505(_0x1d399e);});});}; \ No newline at end of file +var _0xa12b=['agents','catch','lodash','../mysqldb','./license/util','mail','chat','sms','whatsapp','getChannels','isValidChannel','toLowerCase','includes','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','count','then'];(function(_0x4214ae,_0x2dd218){var _0x1f15ec=function(_0x398062){while(--_0x398062){_0x4214ae['push'](_0x4214ae['shift']());}};_0x1f15ec(++_0x2dd218);}(_0xa12b,0x10a));var _0xba12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa12b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xba12('0x0'));var BPromise=require('bluebird');var db=require(_0xba12('0x1'))['db'];var util=require(_0xba12('0x2'));var channels=['voice',_0xba12('0x3'),_0xba12('0x4'),'fax',_0xba12('0x5'),_0xba12('0x6'),'openchannel'];exports[_0xba12('0x7')]=function(){return channels;};exports[_0xba12('0x8')]=function(_0x278e27){_0x278e27=_0x278e27[_0xba12('0x9')]();return _[_0xba12('0xa')](channels,_0x278e27);};exports['clearBlockUser']=function(_0x25d1b2,_0x1d7e3e,_0x2666c4,_0x168f5c){var _0x11dd23={'loginAttempts':_0x1d7e3e,'blocked':_0x2666c4};if(!_[_0xba12('0xb')](_0x168f5c)){_0x11dd23[_0xba12('0xc')]=_0x168f5c;}return _0x25d1b2[_0xba12('0xd')](_0x11dd23);};exports[_0xba12('0xe')]=function(_0x2ab1f7){return new BPromise(function(_0xdc43d,_0x4b0d04){var _0x549aa0=0x0;if(_0x2ab1f7[_0xba12('0xf')]!==_0xba12('0x10')){_0xdc43d(_0x2ab1f7);}db[_0xba12('0x11')][_0xba12('0x12')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x2ab1f7['id']}}})[_0xba12('0x13')](function(_0x38654d){_0x549aa0=_0x38654d;return util[_0xba12('0xe')]();})[_0xba12('0x13')](function(_0x5428ce){if(_0x5428ce&&_0x5428ce[_0xba12('0x14')]&&_0x549aa0>=_0x5428ce[_0xba12('0x14')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0xdc43d(_0x2ab1f7);})[_0xba12('0x15')](function(_0x217177){_0x4b0d04(_0x217177);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index e3b1b38..407e5d4 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe20e=['json','send','exports','404','status','render'];(function(_0x2f6a8b,_0x3d749b){var _0x3a1504=function(_0x14d88c){while(--_0x14d88c){_0x2f6a8b['push'](_0x2f6a8b['shift']());}};_0x3a1504(++_0x3d749b);}(_0xe20e,0x1e2));var _0xee20=function(_0x5d2c6a,_0x196724){_0x5d2c6a=_0x5d2c6a-0x0;var _0x4420af=_0xe20e[_0x5d2c6a];return _0x4420af;};'use strict';module[_0xee20('0x0')][0x194]=function pageNotFound(_0xaaa463,_0x9cf566){var _0x19ca59=_0xee20('0x1');var _0x495cab=0x194;var _0x1ca50d={'status':_0x495cab};_0x9cf566[_0xee20('0x2')](_0x1ca50d['status']);_0x9cf566[_0xee20('0x3')](_0x19ca59,{},function(_0x4be995,_0x413468){if(_0x4be995){return _0x9cf566[_0xee20('0x2')](_0x1ca50d['status'])[_0xee20('0x4')](_0x1ca50d);}_0x9cf566[_0xee20('0x5')](_0x413468);});}; \ No newline at end of file +var _0x2bdf=['404','status','json'];(function(_0x3697be,_0x436021){var _0x27c201=function(_0x1a5481){while(--_0x1a5481){_0x3697be['push'](_0x3697be['shift']());}};_0x27c201(++_0x436021);}(_0x2bdf,0x1ef));var _0xf2bd=function(_0x1e8cdb,_0x3e89d5){_0x1e8cdb=_0x1e8cdb-0x0;var _0x35c91c=_0x2bdf[_0x1e8cdb];return _0x35c91c;};'use strict';module['exports'][0x194]=function pageNotFound(_0x2c0cae,_0x5cefde){var _0x347048=_0xf2bd('0x0');var _0x2a3ac0=0x194;var _0x5c126f={'status':_0x2a3ac0};_0x5cefde['status'](_0x5c126f[_0xf2bd('0x1')]);_0x5cefde['render'](_0x347048,{},function(_0x120d4a,_0x2f0b21){if(_0x120d4a){return _0x5cefde[_0xf2bd('0x1')](_0x5c126f[_0xf2bd('0x1')])[_0xf2bd('0x2')](_0x5c126f);}_0x5cefde['send'](_0x2f0b21);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index dc9806e..0c4d3ee 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4870=['Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Tag','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','Notification','../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','hasOne','cascade','UserId','hasMany','HopperHistory','ChatInteractions','SmsInteractions','FaxInteractions','WhatsappInteractions','Notifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','ChatInteraction','user_has_fax_interactions','OpenchannelInteractions','user_has_openchannel_interactions','VoiceQueues','MailQueues','UserMailQueue','ChatQueues','FaxQueues','UserFaxQueue','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccount','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','SpiedAgents','VoiceContext','VoiceMusicOnHold','Sound','Sounds','moh_has_sounds','UserVoiceQueueRt','Members','VoiceQueueId','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','Contact','ContactId','MailAccountId','MailServerIn','Imap','Smtp','Answers','MailApplication','List','ListId','Template','TemplateId','mandatoryDispositionPause','Teams','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','restrict','TagId','Items','Dispositions','FaxAccountId','Interactions','Applications','Exntensions','FaxMessage','FaxQueue','FaxInteractionId','fax_interaction_has_tags','Interaction','Attachment','AttachmentId','SmsAccountId','IntervalId','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','ChatApplication','OpenchannelQueueReport','Agent','Queue','Website','ChatInteractionId','team_has_chat_queues','ChatGroupId','CmCompany','Hoppers','Company','CompanyId','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','chat_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','AnyCondition','AnalyticCustomReport','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','Subject','Description','FieldId','VariableId','SugarcrmField','Field','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerField','ServicenowAccount','Dynamics365Account','Dynamics365Configuration','ChatQueueReport','FromId','ToId','ProjectId','SquareProject','team_has_mail_queues','team_has_fax_queues','team_has_whatsapp_queues','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','Queues','Extensions','user_has_voice_prefixes','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappQueueReport','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','sequelize','lodash','jstz','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8_general_ci','sequelizeHistory','127.0.0.1','utf8','database','password','options','username','User','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','import','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model'];(function(_0x5d27c3,_0x5ac158){var _0xed73f8=function(_0xc9c3d2){while(--_0xc9c3d2){_0x5d27c3['push'](_0x5d27c3['shift']());}};_0xed73f8(++_0x5ac158);}(_0x4870,0x1d0));var _0x0487=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x4870[_0x11005e];return _0x29338f;};'use strict';var path=require(_0x0487('0x0'));var config=require(_0x0487('0x1'));var Sequelize=require(_0x0487('0x2'));var _=require(_0x0487('0x3'));var jstz=require(_0x0487('0x4'));var timezone=jstz['determine']();config['sequelize']=_[_0x0487('0x5')](config[_0x0487('0x2')],{'database':_0x0487('0x6'),'username':_0x0487('0x7'),'password':_0x0487('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x0487('0x9'),'dialectOptions':{'charset':_0x0487('0xa')},'logging':![],'timezone':timezone[_0x0487('0xb')](),'define':{'charset':'utf8','collate':_0x0487('0xc')}}});config[_0x0487('0xd')]=_[_0x0487('0x5')](config['sequelizeHistory'],{'database':'motion2','username':'xcall','password':_0x0487('0x8'),'options':{'host':_0x0487('0xe'),'port':0xcea,'dialect':_0x0487('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x0487('0xb')](),'define':{'charset':_0x0487('0xf'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x0487('0x10')],config[_0x0487('0x2')]['username'],config[_0x0487('0x2')][_0x0487('0x11')],config['sequelize'][_0x0487('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x0487('0xd')][_0x0487('0x10')],config[_0x0487('0xd')][_0x0487('0x13')],config[_0x0487('0xd')][_0x0487('0x11')],config['sequelizeHistory'][_0x0487('0x12')])};db[_0x0487('0x14')]=db['sequelize']['import'](_0x0487('0x15'));db[_0x0487('0x16')]=db['sequelize']['import'](_0x0487('0x17'));db['VoiceContext']=db[_0x0487('0x2')]['import'](_0x0487('0x18'));db[_0x0487('0x19')]=db[_0x0487('0x2')][_0x0487('0x1a')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db['sequelize'][_0x0487('0x1a')](_0x0487('0x1b'));db[_0x0487('0x1c')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x1d'));db[_0x0487('0x1e')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0x1f'));db[_0x0487('0x20')]=db['sequelize']['import']('../api/screenRecording/screenRecording.model');db[_0x0487('0x21')]=db[_0x0487('0x2')]['import'](_0x0487('0x22'));db['VoiceMailMessage']=db['sequelize'][_0x0487('0x1a')](_0x0487('0x23'));db[_0x0487('0x24')]=db[_0x0487('0x2')][_0x0487('0x1a')]('../api/voiceCallReport/voiceCallReport.model');db[_0x0487('0x25')]=db['sequelize']['import'](_0x0487('0x26'));db[_0x0487('0x27')]=db['sequelize']['import'](_0x0487('0x28'));db[_0x0487('0x29')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x2a'));db[_0x0487('0x2b')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x2c'));db[_0x0487('0x2d')]=db[_0x0487('0x2')]['import'](_0x0487('0x2e'));db[_0x0487('0x2f')]=db[_0x0487('0x2')]['import'](_0x0487('0x30'));db['UserVoiceQueueRt']=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x31'));db[_0x0487('0x32')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x33'));db[_0x0487('0x34')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x35'));db['UserMailQueue']=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x36'));db['UserFaxQueue']=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x37'));db['UserSmsQueue']=db['sequelize'][_0x0487('0x1a')](_0x0487('0x38'));db[_0x0487('0x39')]=db['sequelize'][_0x0487('0x1a')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x0487('0x3a')]=db['sequelize'][_0x0487('0x1a')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db[_0x0487('0x2')][_0x0487('0x1a')]('../api/mailServerIn/mailServerIn.model');db[_0x0487('0x3b')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x3c'));db[_0x0487('0x3d')]=db[_0x0487('0x2')][_0x0487('0x1a')]('../api/mailAccount/mailAccount.model');db[_0x0487('0x3e')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0x3f'));db[_0x0487('0x40')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x41'));db[_0x0487('0x42')]=db[_0x0487('0x2')]['import'](_0x0487('0x43'));db[_0x0487('0x44')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x45'));db['MailApplication']=db[_0x0487('0x2')]['import'](_0x0487('0x46'));db[_0x0487('0x47')]=db['sequelize']['import'](_0x0487('0x48'));db[_0x0487('0x49')]=db[_0x0487('0x2')]['import']('../api/dashboard/dashboard.model');db[_0x0487('0x4a')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0x4b'));db['FaxAccount']=db[_0x0487('0x2')]['import'](_0x0487('0x4c'));db[_0x0487('0x4d')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0x4e'));db[_0x0487('0x4f')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0x50'));db['FaxMessage']=db['sequelize'][_0x0487('0x1a')]('../api/faxMessage/faxMessage.model');db['FaxQueue']=db[_0x0487('0x2')][_0x0487('0x1a')]('../api/faxQueue/faxQueue.model');db[_0x0487('0x51')]=db[_0x0487('0x2')][_0x0487('0x1a')]('../api/faxQueueReport/faxQueueReport.model');db[_0x0487('0x52')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x53'));db[_0x0487('0x54')]=db[_0x0487('0x2')][_0x0487('0x1a')]('../api/smsApplication/smsApplication.model');db[_0x0487('0x55')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x56'));db[_0x0487('0x57')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x58'));db[_0x0487('0x59')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x5a'));db['OpenchannelAccount']=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x5b'));db['OpenchannelApplication']=db[_0x0487('0x2')]['import'](_0x0487('0x5c'));db[_0x0487('0x5d')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x5e'));db[_0x0487('0x5f')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x60'));db[_0x0487('0x61')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x62'));db[_0x0487('0x63')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x64'));db['OpenchannelQueueReport']=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x65'));db['ChatApplication']=db[_0x0487('0x2')]['import'](_0x0487('0x66'));db['ChatInteraction']=db['sequelize'][_0x0487('0x1a')]('../api/chatInteraction/chatInteraction.model');db[_0x0487('0x67')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x68'));db[_0x0487('0x69')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x6a'));db[_0x0487('0x6b')]=db[_0x0487('0x2')][_0x0487('0x1a')]('../api/chatQueue/chatQueue.model');db[_0x0487('0x6c')]=db[_0x0487('0x2')]['import'](_0x0487('0x6d'));db[_0x0487('0x6e')]=db[_0x0487('0x2')]['import'](_0x0487('0x6f'));db['CmCompany']=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x70'));db[_0x0487('0x71')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x72'));db[_0x0487('0x73')]=db['sequelize']['import'](_0x0487('0x74'));db[_0x0487('0x75')]=db[_0x0487('0x2')]['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0x0487('0x76')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0x77'));db[_0x0487('0x78')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x79'));db[_0x0487('0x7a')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x7b'));db['CmCustomField']=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x7c'));db[_0x0487('0x7d')]=db[_0x0487('0x2')]['import'](_0x0487('0x7e'));db[_0x0487('0x7f')]=db[_0x0487('0x2')]['import']('../api/automation/automation.model');db[_0x0487('0x80')]=db[_0x0487('0x2')][_0x0487('0x1a')]('../api/cannedAnswer/cannedAnswer.model');db[_0x0487('0x81')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x82'));db[_0x0487('0x83')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x84'));db[_0x0487('0x85')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x86'));db[_0x0487('0x87')]=db[_0x0487('0x2')]['import'](_0x0487('0x88'));db[_0x0487('0x89')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x8a'));db[_0x0487('0x8b')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0x8c'));db[_0x0487('0x8d')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0x8e'));db['Sound']=db[_0x0487('0x2')][_0x0487('0x1a')]('../api/sound/sound.model');db[_0x0487('0x8f')]=db['sequelize'][_0x0487('0x1a')]('../api/tag/tag.model');db['Template']=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x90'));db[_0x0487('0x91')]=db['sequelize']['import'](_0x0487('0x92'));db[_0x0487('0x93')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x94'));db[_0x0487('0x95')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x96'));db[_0x0487('0x97')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x98'));db['AnalyticCustomReport']=db[_0x0487('0x2')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0x0487('0x99')]=db[_0x0487('0x2')]['import'](_0x0487('0x9a'));db[_0x0487('0x9b')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x9c'));db[_0x0487('0x9d')]=db[_0x0487('0x2')]['import'](_0x0487('0x9e'));db[_0x0487('0x9f')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xa0'));db[_0x0487('0xa1')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xa2'));db[_0x0487('0xa3')]=db[_0x0487('0x2')]['import'](_0x0487('0xa4'));db[_0x0487('0xa5')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0xa6'));db[_0x0487('0xa7')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0xa8'));db[_0x0487('0xa9')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xaa'));db[_0x0487('0xab')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0xac'));db['SugarcrmField']=db['sequelize'][_0x0487('0x1a')](_0x0487('0xad'));db[_0x0487('0xae')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xaf'));db[_0x0487('0xb0')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0xb1'));db[_0x0487('0xb2')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xb3'));db[_0x0487('0xb4')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xb5'));db[_0x0487('0xb6')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xb7'));db[_0x0487('0xb8')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0xb9'));db[_0x0487('0xba')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0xbb'));db[_0x0487('0xbc')]=db[_0x0487('0x2')]['import'](_0x0487('0xbd'));db[_0x0487('0xbe')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xbf'));db[_0x0487('0xc0')]=db[_0x0487('0x2')][_0x0487('0x1a')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x0487('0xc1')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xc2'));db['FreshdeskField']=db['sequelize'][_0x0487('0x1a')](_0x0487('0xc3'));db[_0x0487('0xc4')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0xc5'));db[_0x0487('0xc6')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0xc7'));db['VtigerField']=db[_0x0487('0x2')]['import'](_0x0487('0xc8'));db['ServicenowAccount']=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xc9'));db[_0x0487('0xca')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xcb'));db[_0x0487('0xcc')]=db['sequelize']['import'](_0x0487('0xcd'));db['Dynamics365Account']=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xce'));db['Dynamics365Configuration']=db[_0x0487('0x2')][_0x0487('0x1a')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x0487('0xcf')]=db[_0x0487('0x2')]['import'](_0x0487('0xd0'));db[_0x0487('0xd1')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xd2'));db[_0x0487('0xd3')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xd4'));db[_0x0487('0xd5')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xd6'));db[_0x0487('0x95')]=db['sequelize']['import']('../api/integration/integration.model');db[_0x0487('0xd7')]=db['sequelize']['import'](_0x0487('0xd8'));db['ChatQueueReport']=db[_0x0487('0x2')][_0x0487('0x1a')]('../api/chatQueueReport/chatQueueReport.model');db[_0x0487('0xd9')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0xda'));db[_0x0487('0xdb')]=db[_0x0487('0x2')][_0x0487('0x1a')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x0487('0xdc')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0xdd'));db[_0x0487('0xde')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xdf'));db[_0x0487('0xe0')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0xe1'));db[_0x0487('0xe2')]=db[_0x0487('0x2')][_0x0487('0x1a')]('../api/squareReport/squareReport.model');db[_0x0487('0xe3')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xe4'));db[_0x0487('0xe5')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0xe6'));db[_0x0487('0xe7')]=db['sequelize']['import'](_0x0487('0xe8'));db[_0x0487('0xe9')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xea'));db['SquareProject']=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xeb'));db[_0x0487('0xec')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xed'));db['SquareMessage']=db['sequelize']['import'](_0x0487('0xee'));db[_0x0487('0xef')]=db['sequelize']['import'](_0x0487('0xf0'));db['License']=db[_0x0487('0x2')]['import'](_0x0487('0xf1'));db[_0x0487('0xf2')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xf3'));db[_0x0487('0xf4')]=db[_0x0487('0x2')][_0x0487('0x1a')]('../api/migration/migration.model');db['Attachment']=db['sequelize'][_0x0487('0x1a')]('../api/attachment/attachment.model');db[_0x0487('0xf5')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xf6'));db[_0x0487('0xf7')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xf8'));db[_0x0487('0xf9')]=db['sequelize'][_0x0487('0x1a')]('../api/chatTransferReport/chatTransferReport.model');db[_0x0487('0xfa')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0xfb'));db[_0x0487('0xfc')]=db['sequelize']['import'](_0x0487('0xfd'));db[_0x0487('0xfe')]=db[_0x0487('0x2')][_0x0487('0x1a')]('../api/smsTransferReport/smsTransferReport.model');db[_0x0487('0xff')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x100'));db[_0x0487('0x101')]=db['sequelize']['import'](_0x0487('0x102'));db[_0x0487('0x103')]=db[_0x0487('0x2')][_0x0487('0x1a')]('../api/userProfile/userProfile.model');db[_0x0487('0x104')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x105'));db[_0x0487('0x106')]=db[_0x0487('0x2')][_0x0487('0x1a')]('../api/userProfileResource/userProfileResource.model');db[_0x0487('0x107')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0x108'));db[_0x0487('0x109')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x10a'));db[_0x0487('0x10b')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x10c'));db[_0x0487('0x10d')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x10e'));db[_0x0487('0x10f')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0x110'));db['WhatsappQueueReport']=db[_0x0487('0x2')][_0x0487('0x1a')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x0487('0x111')]=db[_0x0487('0x2')][_0x0487('0x1a')](_0x0487('0x112'));db[_0x0487('0x113')]=db['sequelize'][_0x0487('0x1a')](_0x0487('0x114'));db[_0x0487('0x115')]=db['sequelize'][_0x0487('0x1a')]('../api/cloudProvider/cloudProvider.model');db[_0x0487('0x14')][_0x0487('0x116')](db[_0x0487('0x21')],{'as':_0x0487('0x21'),'onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x118')});db[_0x0487('0x14')]['hasMany'](db['VoiceRecording'],{'as':'Recordings','foreignKey':'UserId'});db['User'][_0x0487('0x119')](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':_0x0487('0x118')});db['User'][_0x0487('0x119')](db[_0x0487('0x19')],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db[_0x0487('0x14')][_0x0487('0x119')](db[_0x0487('0x76')],{'as':'HopperFinals','foreignKey':_0x0487('0x118')});db['User'][_0x0487('0x119')](db[_0x0487('0x78')],{'as':_0x0487('0x11a'),'foreignKey':'UserId'});db[_0x0487('0x14')]['hasMany'](db[_0x0487('0x7a')],{'as':_0x0487('0x7a'),'foreignKey':_0x0487('0x118')});db[_0x0487('0x14')]['hasMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':'UserId'});db[_0x0487('0x14')]['hasMany'](db['ChatInteraction'],{'as':_0x0487('0x11b'),'foreignKey':_0x0487('0x118')});db[_0x0487('0x14')][_0x0487('0x119')](db[_0x0487('0x55')],{'as':_0x0487('0x11c'),'foreignKey':_0x0487('0x118')});db[_0x0487('0x14')][_0x0487('0x119')](db[_0x0487('0x4f')],{'as':_0x0487('0x11d'),'foreignKey':_0x0487('0x118')});db[_0x0487('0x14')][_0x0487('0x119')](db[_0x0487('0x42')],{'as':'MailInteractions','foreignKey':_0x0487('0x118')});db['User'][_0x0487('0x119')](db[_0x0487('0x10d')],{'as':_0x0487('0x11e'),'foreignKey':_0x0487('0x118')});db['User'][_0x0487('0x119')](db[_0x0487('0x107')],{'as':_0x0487('0x11f'),'foreignKey':_0x0487('0x120')});db[_0x0487('0x14')][_0x0487('0x121')](db[_0x0487('0x103')],{'as':_0x0487('0x103'),'foreignKey':_0x0487('0x122')});db[_0x0487('0x14')][_0x0487('0x123')](db['ChatGroup'],{'as':_0x0487('0x124'),'through':_0x0487('0x125')});db[_0x0487('0x14')][_0x0487('0x123')](db[_0x0487('0x71')],{'as':_0x0487('0x126'),'through':_0x0487('0x127')});db['User'][_0x0487('0x123')](db[_0x0487('0xff')],{'as':_0x0487('0x128'),'through':_0x0487('0x129')});db[_0x0487('0x14')][_0x0487('0x123')](db[_0x0487('0xef')],{'through':_0x0487('0x12a')});db[_0x0487('0x14')][_0x0487('0x123')](db[_0x0487('0x42')],{'as':_0x0487('0x12b'),'through':_0x0487('0x12c')});db[_0x0487('0x14')][_0x0487('0x123')](db[_0x0487('0x12d')],{'as':_0x0487('0x11b'),'through':'user_has_chat_interactions'});db[_0x0487('0x14')][_0x0487('0x123')](db[_0x0487('0x4f')],{'as':_0x0487('0x11d'),'through':_0x0487('0x12e')});db[_0x0487('0x14')]['belongsToMany'](db[_0x0487('0x55')],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0x0487('0x14')][_0x0487('0x123')](db[_0x0487('0x5d')],{'as':_0x0487('0x12f'),'through':_0x0487('0x130')});db[_0x0487('0x14')][_0x0487('0x123')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0x0487('0x14')]['belongsToMany'](db[_0x0487('0x1c')],{'as':_0x0487('0x131'),'through':_0x0487('0x32'),'required':![]});db[_0x0487('0x14')][_0x0487('0x123')](db[_0x0487('0x3e')],{'as':_0x0487('0x132'),'through':_0x0487('0x133'),'required':![]});db[_0x0487('0x14')][_0x0487('0x123')](db[_0x0487('0x6b')],{'as':_0x0487('0x134'),'through':_0x0487('0x34'),'required':![],'hooks':!![]});db[_0x0487('0x14')]['belongsToMany'](db['FaxQueue'],{'as':_0x0487('0x135'),'through':_0x0487('0x136'),'required':![]});db[_0x0487('0x14')][_0x0487('0x123')](db[_0x0487('0x59')],{'as':_0x0487('0x137'),'through':_0x0487('0x138'),'required':![]});db[_0x0487('0x14')][_0x0487('0x123')](db['OpenchannelQueue'],{'as':_0x0487('0x139'),'through':_0x0487('0x39'),'required':![]});db[_0x0487('0x14')]['belongsToMany'](db[_0x0487('0x113')],{'as':_0x0487('0x13a'),'through':'UserWhatsappQueue','required':![]});db[_0x0487('0x14')]['belongsToMany'](db[_0x0487('0xff')],{'through':_0x0487('0x129')});db[_0x0487('0x14')][_0x0487('0x123')](db[_0x0487('0x101')],{'as':'VoicePrefixes','through':'user_has_voice_prefixes','required':![]});db[_0x0487('0x14')]['belongsToMany'](db[_0x0487('0x63')],{'as':_0x0487('0x13b'),'through':_0x0487('0x13c')});db['User'][_0x0487('0x123')](db[_0x0487('0x13d')],{'as':'FaxAccounts','through':_0x0487('0x13e')});db[_0x0487('0x14')]['belongsToMany'](db[_0x0487('0x3d')],{'as':'MailAccounts','through':_0x0487('0x13f')});db[_0x0487('0x14')][_0x0487('0x123')](db[_0x0487('0x140')],{'as':_0x0487('0x141'),'through':_0x0487('0x142')});db[_0x0487('0x14')][_0x0487('0x123')](db[_0x0487('0x52')],{'as':'SmsAccounts','through':_0x0487('0x143')});db[_0x0487('0x14')][_0x0487('0x123')](db['WhatsappAccount'],{'as':_0x0487('0x144'),'through':_0x0487('0x145')});db[_0x0487('0x14')][_0x0487('0x123')](db['SquareProject'],{'as':'SquareProjects','through':_0x0487('0x146')});db[_0x0487('0x16')][_0x0487('0x119')](db[_0x0487('0x19')],{'as':_0x0487('0x147'),'onDelete':_0x0487('0x117'),'foreignKey':'ChanSpyId'});db[_0x0487('0x148')][_0x0487('0x119')](db[_0x0487('0x19')],{'onDelete':_0x0487('0x117')});db[_0x0487('0x19')][_0x0487('0x119')](db['VoiceExtension'],{'as':'Applications','onDelete':_0x0487('0x117')});db[_0x0487('0x149')]['belongsToMany'](db[_0x0487('0x14a')],{'as':_0x0487('0x14b'),'through':_0x0487('0x14c')});db[_0x0487('0x1c')][_0x0487('0x119')](db[_0x0487('0x14d')],{'as':_0x0487('0x14e'),'foreignKey':'VoiceQueueId'});db[_0x0487('0x1c')][_0x0487('0x119')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x0487('0x14f')});db['VoiceQueue']['hasMany'](db[_0x0487('0x76')],{'as':_0x0487('0x150'),'foreignKey':'VoiceQueueId'});db[_0x0487('0x1c')][_0x0487('0x119')](db[_0x0487('0x78')],{'as':_0x0487('0x151'),'foreignKey':_0x0487('0x14f')});db[_0x0487('0x1c')]['hasMany'](db['ReportAgentPreview'],{'as':_0x0487('0x7a'),'foreignKey':_0x0487('0x14f')});db[_0x0487('0x1c')][_0x0487('0x119')](db[_0x0487('0x75')],{'as':_0x0487('0x152'),'foreignKey':'VoiceQueueId'});db[_0x0487('0x1c')][_0x0487('0x119')](db[_0x0487('0xde')],{'as':_0x0487('0x153'),'foreignKey':'VoiceQueueId'});db[_0x0487('0x1c')][_0x0487('0x121')](db[_0x0487('0x2d')],{'as':_0x0487('0x2d'),'foreignKey':_0x0487('0x154')});db[_0x0487('0x1c')][_0x0487('0x121')](db[_0x0487('0x2d')],{'as':_0x0487('0x155'),'foreignKey':_0x0487('0x156')});db[_0x0487('0x1c')]['belongsTo'](db['Interval'],{'as':_0x0487('0x85'),'foreignKey':'IntervalId'});db['VoiceQueue'][_0x0487('0x121')](db[_0x0487('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0x0487('0x157')});db[_0x0487('0x1c')][_0x0487('0x123')](db[_0x0487('0xff')],{'as':_0x0487('0x128'),'through':_0x0487('0x158')});db[_0x0487('0x1c')][_0x0487('0x123')](db[_0x0487('0x14')],{'as':_0x0487('0x159'),'through':'UserVoiceQueue'});db[_0x0487('0x1c')][_0x0487('0x123')](db[_0x0487('0xef')],{'as':'Teams','through':_0x0487('0x15a')});db['VoiceQueue'][_0x0487('0x123')](db[_0x0487('0xff')],{'as':_0x0487('0x15b'),'through':_0x0487('0x15c')});db[_0x0487('0x1e')][_0x0487('0x121')](db[_0x0487('0x14')],{'as':'User','foreignKey':_0x0487('0x118')});db[_0x0487('0x20')][_0x0487('0x121')](db['User'],{'as':'User','foreignKey':_0x0487('0x118')});db[_0x0487('0x21')]['hasMany'](db[_0x0487('0x15d')],{'as':_0x0487('0x15e'),'onDelete':_0x0487('0x117'),'foreignKey':'mailboxuser','sourceKey':_0x0487('0x15f')});db[_0x0487('0x15d')][_0x0487('0x121')](db[_0x0487('0x21')],{'foreignKey':_0x0487('0x160'),'targetKey':_0x0487('0x15f')});db[_0x0487('0x24')][_0x0487('0x119')](db[_0x0487('0x29')],{'as':_0x0487('0x161'),'foreignKey':_0x0487('0x162'),'constraints':![]});db[_0x0487('0x24')]['hasMany'](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0x0487('0x24')][_0x0487('0x121')](db['User'],{'as':_0x0487('0x14'),'foreignKey':'UserId'});db['VoiceCallReport'][_0x0487('0x121')](db[_0x0487('0x71')],{'as':_0x0487('0x163'),'foreignKey':_0x0487('0x164')});db['MailServerIn']['belongsTo'](db[_0x0487('0x3d')],{'as':_0x0487('0x3d'),'foreignKey':_0x0487('0x165')});db[_0x0487('0x3b')][_0x0487('0x121')](db['MailAccount'],{'as':_0x0487('0x3d'),'foreignKey':_0x0487('0x165')});db[_0x0487('0x3d')][_0x0487('0x116')](db[_0x0487('0x166')],{'as':_0x0487('0x167'),'onDelete':_0x0487('0x117')});db['MailAccount'][_0x0487('0x116')](db[_0x0487('0x3b')],{'as':_0x0487('0x168'),'onDelete':_0x0487('0x117')});db[_0x0487('0x3d')][_0x0487('0x119')](db[_0x0487('0x81')],{'as':'Dispositions','foreignKey':'MailAccountId'});db['MailAccount'][_0x0487('0x119')](db[_0x0487('0x80')],{'as':_0x0487('0x169'),'foreignKey':'MailAccountId'});db['MailAccount']['hasMany'](db[_0x0487('0x44')],{'as':'Messages','foreignKey':_0x0487('0x165')});db['MailAccount'][_0x0487('0x119')](db[_0x0487('0x42')],{'as':'Interactions'});db[_0x0487('0x3d')][_0x0487('0x119')](db[_0x0487('0x16a')],{'as':'Applications'});db[_0x0487('0x3d')][_0x0487('0x121')](db[_0x0487('0xff')],{'as':_0x0487('0x16b'),'foreignKey':_0x0487('0x16c')});db['MailAccount'][_0x0487('0x121')](db['Template'],{'as':_0x0487('0x16d'),'foreignKey':_0x0487('0x16e')});db[_0x0487('0x3d')][_0x0487('0x121')](db[_0x0487('0x87')],{'as':_0x0487('0x16f'),'foreignKey':_0x0487('0x157')});db['MailAccount'][_0x0487('0x123')](db[_0x0487('0x14')],{'as':_0x0487('0x159'),'through':_0x0487('0x13f')});db['MailQueue'][_0x0487('0x123')](db[_0x0487('0x14')],{'as':_0x0487('0x159'),'through':'UserMailQueue'});db['MailQueue']['belongsToMany'](db['Team'],{'through':'team_has_mail_queues','as':_0x0487('0x170')});db['MailInteraction']['hasMany'](db[_0x0487('0x44')],{'as':_0x0487('0x15e'),'onDelete':'cascade','foreignKey':_0x0487('0x171')});db[_0x0487('0x42')]['belongsTo'](db[_0x0487('0x3d')],{'as':_0x0487('0x172'),'foreignKey':'MailAccountId'});db['MailInteraction']['belongsTo'](db[_0x0487('0x71')],{'as':_0x0487('0x163'),'foreignKey':_0x0487('0x164')});db[_0x0487('0x42')][_0x0487('0x121')](db[_0x0487('0x14')],{'as':_0x0487('0x173'),'foreignKey':_0x0487('0x118')});db['MailInteraction']['belongsToMany'](db[_0x0487('0x8f')],{'through':_0x0487('0x174'),'as':_0x0487('0x175')});db[_0x0487('0x42')][_0x0487('0x123')](db['Tag'],{'through':_0x0487('0x174'),'as':_0x0487('0x176')});db[_0x0487('0x42')][_0x0487('0x123')](db['User'],{'as':_0x0487('0x177'),'through':_0x0487('0x12c'),'foreignKey':_0x0487('0x171')});db['MailMessage']['hasMany'](db['Attachment'],{'as':_0x0487('0x178'),'onDelete':'cascade'});db['MailMessage'][_0x0487('0x121')](db[_0x0487('0x14')],{'as':_0x0487('0x14')});db[_0x0487('0x44')][_0x0487('0x121')](db[_0x0487('0x71')],{'onDelete':_0x0487('0x117'),'as':_0x0487('0x163')});db[_0x0487('0x44')][_0x0487('0x121')](db[_0x0487('0x42')],{'as':'Interaction','foreignKey':_0x0487('0x171')});db[_0x0487('0x44')][_0x0487('0x121')](db[_0x0487('0x3d')],{'as':_0x0487('0x172'),'foreignKey':_0x0487('0x165')});db[_0x0487('0x16a')]['belongsTo'](db[_0x0487('0x14')],{'onDelete':_0x0487('0x179')});db[_0x0487('0x16a')][_0x0487('0x121')](db['MailQueue'],{'onDelete':_0x0487('0x179')});db[_0x0487('0x16a')]['belongsTo'](db[_0x0487('0x3d')],{'onDelete':_0x0487('0x179')});db['MailApplication']['belongsTo'](db[_0x0487('0x85')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['MailApplication']['belongsTo'](db[_0x0487('0x8f')],{'onDelete':_0x0487('0x179'),'foreignKey':_0x0487('0x17a')});db[_0x0487('0x47')]['belongsTo'](db[_0x0487('0x3d')],{});db[_0x0487('0x47')]['belongsTo'](db[_0x0487('0xff')],{'as':_0x0487('0x16b'),'foreignKey':_0x0487('0x16c')});db[_0x0487('0x47')][_0x0487('0x121')](db[_0x0487('0x71')],{'as':'Contact','foreignKey':'ContactId'});db[_0x0487('0x47')][_0x0487('0x121')](db[_0x0487('0x42')],{});db['MailQueueReport']['belongsTo'](db['MailMessage'],{});db[_0x0487('0x47')]['belongsTo'](db[_0x0487('0x14')],{});db[_0x0487('0x47')]['belongsTo'](db[_0x0487('0x3e')],{});db[_0x0487('0x49')][_0x0487('0x119')](db['DashboardItem'],{'as':_0x0487('0x17b'),'onDelete':_0x0487('0x117')});db[_0x0487('0x13d')][_0x0487('0x119')](db['Disposition'],{'as':_0x0487('0x17c'),'foreignKey':_0x0487('0x17d')});db[_0x0487('0x13d')][_0x0487('0x119')](db[_0x0487('0x80')],{'as':'Answers','foreignKey':_0x0487('0x17d')});db[_0x0487('0x13d')]['hasMany'](db[_0x0487('0x4f')],{'as':_0x0487('0x17e')});db[_0x0487('0x13d')][_0x0487('0x119')](db[_0x0487('0x4d')],{'as':_0x0487('0x17f')});db[_0x0487('0x13d')][_0x0487('0x119')](db[_0x0487('0x19')],{'as':_0x0487('0x180'),'onDelete':'cascade'});db[_0x0487('0x13d')]['hasMany'](db[_0x0487('0x181')],{'as':'Messages'});db[_0x0487('0x13d')][_0x0487('0x121')](db[_0x0487('0x2d')],{'as':'Trunk'});db['FaxAccount'][_0x0487('0x121')](db[_0x0487('0xff')],{'as':_0x0487('0x16b'),'foreignKey':_0x0487('0x16c')});db[_0x0487('0x13d')][_0x0487('0x121')](db['Pause'],{'as':_0x0487('0x16f'),'foreignKey':_0x0487('0x157')});db[_0x0487('0x13d')][_0x0487('0x123')](db['User'],{'as':_0x0487('0x159'),'through':_0x0487('0x13e')});db['FaxApplication']['belongsTo'](db[_0x0487('0x14')],{'onDelete':_0x0487('0x179')});db[_0x0487('0x4d')][_0x0487('0x121')](db[_0x0487('0x182')],{'onDelete':_0x0487('0x179')});db['FaxApplication'][_0x0487('0x121')](db[_0x0487('0x13d')],{'onDelete':_0x0487('0x179')});db['FaxApplication'][_0x0487('0x121')](db['Tag'],{'onDelete':_0x0487('0x179'),'foreignKey':'TagId'});db[_0x0487('0x4f')]['hasMany'](db[_0x0487('0x181')],{'as':_0x0487('0x15e'),'onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x183')});db[_0x0487('0x4f')][_0x0487('0x121')](db[_0x0487('0x13d')],{'as':_0x0487('0x172'),'foreignKey':_0x0487('0x17d')});db['FaxInteraction']['belongsTo'](db['CmContact'],{'as':_0x0487('0x163'),'foreignKey':_0x0487('0x164')});db[_0x0487('0x4f')][_0x0487('0x121')](db[_0x0487('0x14')],{'as':_0x0487('0x173'),'foreignKey':'UserId'});db[_0x0487('0x4f')][_0x0487('0x123')](db[_0x0487('0x8f')],{'through':_0x0487('0x184'),'as':_0x0487('0x175')});db['FaxInteraction'][_0x0487('0x123')](db[_0x0487('0x8f')],{'through':_0x0487('0x184'),'as':_0x0487('0x176')});db[_0x0487('0x4f')][_0x0487('0x123')](db[_0x0487('0x14')],{'as':'Users','through':_0x0487('0x12e'),'foreignKey':'FaxInteractionId'});db[_0x0487('0x181')][_0x0487('0x121')](db[_0x0487('0x14')],{'onDelete':_0x0487('0x117'),'as':_0x0487('0x14')});db[_0x0487('0x181')]['belongsTo'](db['FaxInteraction'],{'as':_0x0487('0x185'),'foreignKey':_0x0487('0x183')});db[_0x0487('0x181')][_0x0487('0x121')](db[_0x0487('0x71')],{'onDelete':_0x0487('0x117'),'as':'Contact'});db[_0x0487('0x181')][_0x0487('0x121')](db[_0x0487('0x186')],{'as':_0x0487('0x186'),'foreignKey':_0x0487('0x187')});db[_0x0487('0x181')]['belongsTo'](db[_0x0487('0x13d')],{'as':_0x0487('0x172'),'foreignKey':_0x0487('0x17d')});db[_0x0487('0x182')][_0x0487('0x123')](db[_0x0487('0x14')],{'as':_0x0487('0x159'),'through':_0x0487('0x136')});db[_0x0487('0x182')][_0x0487('0x123')](db[_0x0487('0xef')],{'through':'team_has_fax_queues','as':'Teams'});db[_0x0487('0x51')][_0x0487('0x121')](db[_0x0487('0x13d')],{});db[_0x0487('0x51')][_0x0487('0x121')](db[_0x0487('0xff')],{'as':_0x0487('0x16b'),'foreignKey':_0x0487('0x16c')});db['FaxQueueReport']['belongsTo'](db[_0x0487('0x71')],{'as':_0x0487('0x163'),'foreignKey':_0x0487('0x164')});db[_0x0487('0x51')][_0x0487('0x121')](db[_0x0487('0x4f')],{});db[_0x0487('0x51')][_0x0487('0x121')](db[_0x0487('0x181')],{});db[_0x0487('0x51')]['belongsTo'](db[_0x0487('0x14')],{});db[_0x0487('0x51')][_0x0487('0x121')](db[_0x0487('0x182')],{});db[_0x0487('0x52')][_0x0487('0x119')](db[_0x0487('0x81')],{'as':_0x0487('0x17c'),'foreignKey':_0x0487('0x188')});db[_0x0487('0x52')][_0x0487('0x119')](db[_0x0487('0x80')],{'as':'Answers','foreignKey':_0x0487('0x188')});db[_0x0487('0x52')][_0x0487('0x119')](db[_0x0487('0x57')],{'as':'Messages','foreignKey':_0x0487('0x188')});db[_0x0487('0x52')]['hasMany'](db[_0x0487('0x55')],{'as':_0x0487('0x17e')});db[_0x0487('0x52')]['hasMany'](db['SmsApplication'],{'as':_0x0487('0x17f')});db['SmsAccount'][_0x0487('0x121')](db[_0x0487('0xff')],{'as':'List','foreignKey':_0x0487('0x16c')});db[_0x0487('0x52')]['belongsTo'](db[_0x0487('0x87')],{'as':_0x0487('0x16f'),'foreignKey':_0x0487('0x157')});db['SmsAccount']['belongsToMany'](db[_0x0487('0x14')],{'as':_0x0487('0x159'),'through':_0x0487('0x143')});db[_0x0487('0x54')][_0x0487('0x121')](db[_0x0487('0x14')],{'onDelete':_0x0487('0x179')});db['SmsApplication'][_0x0487('0x121')](db['SmsQueue'],{'onDelete':_0x0487('0x179')});db[_0x0487('0x54')][_0x0487('0x121')](db[_0x0487('0x52')],{'onDelete':_0x0487('0x179')});db[_0x0487('0x54')][_0x0487('0x121')](db[_0x0487('0x85')],{'onDelete':'restrict','foreignKey':_0x0487('0x189')});db[_0x0487('0x54')]['belongsTo'](db[_0x0487('0x8f')],{'onDelete':'restrict','foreignKey':_0x0487('0x17a')});db['SmsInteraction']['hasMany'](db[_0x0487('0x57')],{'as':_0x0487('0x15e'),'onDelete':'cascade','foreignKey':_0x0487('0x18a')});db['SmsInteraction'][_0x0487('0x121')](db[_0x0487('0x52')],{'as':'Account','foreignKey':_0x0487('0x188')});db[_0x0487('0x55')][_0x0487('0x121')](db[_0x0487('0x71')],{'as':_0x0487('0x163'),'foreignKey':_0x0487('0x164')});db[_0x0487('0x55')][_0x0487('0x121')](db[_0x0487('0x14')],{'as':'Owner','foreignKey':_0x0487('0x118')});db[_0x0487('0x55')][_0x0487('0x123')](db['Tag'],{'through':_0x0487('0x18b'),'as':_0x0487('0x175')});db[_0x0487('0x55')]['belongsToMany'](db[_0x0487('0x8f')],{'through':_0x0487('0x18b'),'as':_0x0487('0x176')});db[_0x0487('0x55')][_0x0487('0x123')](db['User'],{'as':_0x0487('0x177'),'through':_0x0487('0x18c'),'foreignKey':_0x0487('0x18a')});db[_0x0487('0x57')][_0x0487('0x121')](db[_0x0487('0x14')],{'as':_0x0487('0x14')});db[_0x0487('0x57')][_0x0487('0x121')](db[_0x0487('0x71')],{'onDelete':_0x0487('0x117'),'as':'Contact'});db[_0x0487('0x57')]['belongsTo'](db[_0x0487('0x55')],{'onDelete':_0x0487('0x117'),'as':_0x0487('0x185'),'foreignKey':_0x0487('0x18a')});db[_0x0487('0x57')][_0x0487('0x121')](db[_0x0487('0x52')],{'as':_0x0487('0x172'),'foreignKey':_0x0487('0x188')});db[_0x0487('0x59')][_0x0487('0x123')](db['User'],{'as':_0x0487('0x159'),'through':_0x0487('0x138'),'foreignKey':_0x0487('0x18d')});db['SmsQueue'][_0x0487('0x123')](db[_0x0487('0xef')],{'through':_0x0487('0x18e'),'as':'Teams'});db[_0x0487('0x140')][_0x0487('0x119')](db[_0x0487('0x81')],{'as':_0x0487('0x17c'),'foreignKey':_0x0487('0x18f')});db[_0x0487('0x140')]['hasMany'](db[_0x0487('0x80')],{'as':_0x0487('0x169'),'foreignKey':'OpenchannelAccountId'});db[_0x0487('0x140')][_0x0487('0x119')](db[_0x0487('0x5d')],{'as':_0x0487('0x17e'),'foreignKey':_0x0487('0x18f')});db[_0x0487('0x140')]['hasMany'](db[_0x0487('0x5f')],{'as':_0x0487('0x15e'),'foreignKey':'OpenchannelAccountId'});db[_0x0487('0x140')][_0x0487('0x119')](db[_0x0487('0x190')],{'as':_0x0487('0x17f'),'foreignKey':'OpenchannelAccountId'});db[_0x0487('0x140')]['belongsTo'](db['CmList'],{'as':_0x0487('0x16b'),'foreignKey':_0x0487('0x16c')});db[_0x0487('0x140')][_0x0487('0x121')](db[_0x0487('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0x0487('0x157')});db[_0x0487('0x140')][_0x0487('0x123')](db['User'],{'as':_0x0487('0x159'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x0487('0x121')](db[_0x0487('0x14')],{'onDelete':_0x0487('0x179')});db['OpenchannelApplication'][_0x0487('0x121')](db[_0x0487('0x61')],{'onDelete':_0x0487('0x179'),'foreignKey':'OpenchannelQueueId'});db[_0x0487('0x190')][_0x0487('0x121')](db[_0x0487('0x140')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0x0487('0x190')]['belongsTo'](db[_0x0487('0x85')],{'onDelete':_0x0487('0x179'),'foreignKey':_0x0487('0x189')});db[_0x0487('0x190')][_0x0487('0x121')](db[_0x0487('0x8f')],{'onDelete':'restrict','foreignKey':_0x0487('0x17a')});db[_0x0487('0x5d')][_0x0487('0x119')](db[_0x0487('0x5f')],{'as':_0x0487('0x15e'),'onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x191')});db['OpenchannelInteraction']['belongsTo'](db[_0x0487('0x140')],{'as':_0x0487('0x172'),'foreignKey':_0x0487('0x18f')});db[_0x0487('0x5d')]['belongsTo'](db[_0x0487('0x71')],{'as':_0x0487('0x163'),'foreignKey':'ContactId'});db[_0x0487('0x5d')][_0x0487('0x121')](db[_0x0487('0x14')],{'as':_0x0487('0x173'),'foreignKey':_0x0487('0x118')});db[_0x0487('0x5d')][_0x0487('0x123')](db['Tag'],{'through':_0x0487('0x192'),'as':_0x0487('0x175')});db[_0x0487('0x5d')][_0x0487('0x123')](db[_0x0487('0x8f')],{'through':'openchannel_interaction_has_tags','as':_0x0487('0x176')});db[_0x0487('0x5d')][_0x0487('0x123')](db[_0x0487('0x14')],{'as':_0x0487('0x177'),'through':'user_has_openchannel_interactions','foreignKey':_0x0487('0x191')});db[_0x0487('0x5f')][_0x0487('0x121')](db['User'],{'onDelete':'cascade','as':_0x0487('0x14')});db[_0x0487('0x5f')][_0x0487('0x121')](db[_0x0487('0x71')],{'onDelete':'cascade','as':_0x0487('0x163')});db[_0x0487('0x5f')][_0x0487('0x121')](db['OpenchannelInteraction'],{'onDelete':_0x0487('0x117'),'as':_0x0487('0x185'),'foreignKey':_0x0487('0x191')});db[_0x0487('0x5f')][_0x0487('0x121')](db['Attachment'],{'as':_0x0487('0x186'),'foreignKey':'AttachmentId'});db[_0x0487('0x5f')]['belongsTo'](db[_0x0487('0x140')],{'as':_0x0487('0x172'),'foreignKey':_0x0487('0x18f')});db[_0x0487('0x61')][_0x0487('0x123')](db[_0x0487('0x14')],{'as':_0x0487('0x159'),'through':'UserOpenchannelQueue','foreignKey':_0x0487('0x193')});db['OpenchannelQueue'][_0x0487('0x123')](db[_0x0487('0xef')],{'through':_0x0487('0x194'),'as':_0x0487('0x170')});db[_0x0487('0x63')][_0x0487('0x119')](db[_0x0487('0x81')],{'as':_0x0487('0x17c'),'foreignKey':'ChatWebsiteId'});db[_0x0487('0x63')][_0x0487('0x119')](db[_0x0487('0x80')],{'as':_0x0487('0x169'),'foreignKey':_0x0487('0x195')});db['ChatWebsite'][_0x0487('0x119')](db[_0x0487('0x6e')],{'as':'ProactiveActions'});db[_0x0487('0x63')]['hasMany'](db[_0x0487('0x12d')],{'as':_0x0487('0x17e')});db[_0x0487('0x63')][_0x0487('0x119')](db[_0x0487('0x196')],{'as':_0x0487('0x17f')});db[_0x0487('0x63')][_0x0487('0x119')](db[_0x0487('0x67')],{'as':'Messages'});db['ChatWebsite'][_0x0487('0x121')](db[_0x0487('0xff')],{'as':'List','foreignKey':_0x0487('0x16c')});db[_0x0487('0x63')][_0x0487('0x121')](db[_0x0487('0x85')],{'as':_0x0487('0x85'),'foreignKey':_0x0487('0x189')});db[_0x0487('0x63')][_0x0487('0x121')](db['Pause'],{'as':_0x0487('0x16f'),'foreignKey':_0x0487('0x157')});db[_0x0487('0x63')][_0x0487('0x123')](db['User'],{'as':'Agents','through':_0x0487('0x13c')});db[_0x0487('0x197')][_0x0487('0x121')](db[_0x0487('0x140')],{});db[_0x0487('0x197')][_0x0487('0x121')](db['CmList'],{'as':'List','foreignKey':_0x0487('0x16c')});db[_0x0487('0x197')][_0x0487('0x121')](db['CmContact'],{'as':_0x0487('0x163'),'foreignKey':_0x0487('0x164')});db[_0x0487('0x197')][_0x0487('0x121')](db[_0x0487('0x5d')],{});db[_0x0487('0x197')][_0x0487('0x121')](db['OpenchannelMessage'],{});db[_0x0487('0x197')][_0x0487('0x121')](db[_0x0487('0x14')],{});db[_0x0487('0x197')][_0x0487('0x121')](db[_0x0487('0x61')],{});db[_0x0487('0x196')][_0x0487('0x121')](db[_0x0487('0x14')],{'as':_0x0487('0x198'),'foreignKey':_0x0487('0x118'),'onDelete':'restrict'});db[_0x0487('0x196')][_0x0487('0x121')](db['ChatQueue'],{'as':_0x0487('0x199'),'foreignKey':'ChatQueueId','onDelete':_0x0487('0x179')});db[_0x0487('0x196')][_0x0487('0x121')](db[_0x0487('0x63')],{'as':_0x0487('0x19a'),'foreignKey':_0x0487('0x195'),'onDelete':_0x0487('0x179')});db[_0x0487('0x196')]['belongsTo'](db[_0x0487('0x8f')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x0487('0x12d')][_0x0487('0x119')](db[_0x0487('0x67')],{'as':_0x0487('0x15e'),'onDelete':_0x0487('0x117'),'foreignKey':'ChatInteractionId'});db[_0x0487('0x12d')][_0x0487('0x121')](db[_0x0487('0x63')],{'as':_0x0487('0x172'),'foreignKey':_0x0487('0x195')});db[_0x0487('0x12d')][_0x0487('0x121')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x0487('0x12d')][_0x0487('0x121')](db[_0x0487('0x14')],{'as':_0x0487('0x173'),'foreignKey':_0x0487('0x118')});db[_0x0487('0x12d')][_0x0487('0x123')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x0487('0x175')});db['ChatInteraction'][_0x0487('0x123')](db[_0x0487('0x8f')],{'through':'chat_interaction_has_tags','as':_0x0487('0x176')});db[_0x0487('0x12d')]['belongsToMany'](db[_0x0487('0x14')],{'as':_0x0487('0x177'),'through':'user_has_chat_interactions','foreignKey':_0x0487('0x19b')});db['ChatMessage']['belongsTo'](db[_0x0487('0x14')],{'onDelete':'cascade','as':'User'});db[_0x0487('0x67')]['belongsTo'](db[_0x0487('0x71')],{'onDelete':_0x0487('0x117'),'as':_0x0487('0x163'),'foreignKey':_0x0487('0x164')});db[_0x0487('0x67')][_0x0487('0x121')](db[_0x0487('0x12d')],{'onDelete':_0x0487('0x117'),'as':'Interaction','foreignKey':'ChatInteractionId'});db['ChatMessage']['belongsTo'](db[_0x0487('0x186')],{'as':_0x0487('0x186'),'foreignKey':_0x0487('0x187')});db['ChatMessage']['belongsTo'](db[_0x0487('0x63')],{'as':_0x0487('0x172'),'foreignKey':_0x0487('0x195')});db['ChatOfflineMessage'][_0x0487('0x121')](db[_0x0487('0x71')],{'onDelete':_0x0487('0x117'),'as':_0x0487('0x163'),'foreignKey':_0x0487('0x164')});db[_0x0487('0x69')]['belongsTo'](db[_0x0487('0x63')],{'as':'Account','foreignKey':_0x0487('0x195')});db[_0x0487('0x6b')][_0x0487('0x123')](db[_0x0487('0x14')],{'as':_0x0487('0x159'),'through':_0x0487('0x34'),'hooks':!![]});db['ChatQueue'][_0x0487('0x123')](db[_0x0487('0xef')],{'through':_0x0487('0x19c'),'as':_0x0487('0x170')});db[_0x0487('0x6c')]['hasMany'](db[_0x0487('0xd9')],{'as':_0x0487('0x15e'),'foreignKey':_0x0487('0x19d'),'onDelete':_0x0487('0x117')});db[_0x0487('0x6c')][_0x0487('0x123')](db[_0x0487('0x14')],{'as':_0x0487('0x14e'),'through':_0x0487('0x125')});db['ChatProactiveAction'][_0x0487('0x121')](db[_0x0487('0x63')],{'as':_0x0487('0x19a'),'foreignKey':_0x0487('0x195')});db[_0x0487('0x19e')][_0x0487('0x119')](db[_0x0487('0x71')],{'as':_0x0487('0x126'),'foreignKey':'CompanyId'});db[_0x0487('0x71')][_0x0487('0x119')](db[_0x0487('0x73')],{'as':_0x0487('0x19f'),'foreignKey':'ContactId'});db[_0x0487('0x71')][_0x0487('0x119')](db[_0x0487('0x76')],{'as':'HopperFinals','foreignKey':_0x0487('0x164')});db[_0x0487('0x71')]['hasMany'](db[_0x0487('0x78')],{'as':_0x0487('0x151'),'foreignKey':'ContactId'});db['CmContact'][_0x0487('0x119')](db[_0x0487('0x7a')],{'as':_0x0487('0x7a'),'foreignKey':_0x0487('0x164')});db['CmContact']['hasMany'](db['JscriptySessionReport'],{'as':_0x0487('0x153'),'foreignKey':_0x0487('0x164')});db['CmContact'][_0x0487('0x119')](db['OpenchannelInteraction'],{'as':_0x0487('0x12f'),'foreignKey':_0x0487('0x164'),'onDelete':_0x0487('0x179')});db[_0x0487('0x71')][_0x0487('0x119')](db[_0x0487('0x12d')],{'as':_0x0487('0x11b'),'foreignKey':_0x0487('0x164'),'onDelete':_0x0487('0x179')});db[_0x0487('0x71')][_0x0487('0x119')](db[_0x0487('0x55')],{'as':'SmsInteractions','foreignKey':_0x0487('0x164'),'onDelete':_0x0487('0x179')});db['CmContact'][_0x0487('0x119')](db['FaxInteraction'],{'as':_0x0487('0x11d'),'foreignKey':'ContactId','onDelete':_0x0487('0x179')});db[_0x0487('0x71')]['hasMany'](db[_0x0487('0x42')],{'as':_0x0487('0x12b'),'foreignKey':_0x0487('0x164'),'onDelete':'restrict'});db[_0x0487('0x71')]['belongsTo'](db['CmCompany'],{'as':_0x0487('0x1a0'),'foreignKey':_0x0487('0x1a1')});db[_0x0487('0x71')][_0x0487('0x121')](db[_0x0487('0xff')],{'as':_0x0487('0x16b'),'foreignKey':_0x0487('0x16c'),'onDelete':_0x0487('0x117')});db[_0x0487('0x71')][_0x0487('0x123')](db[_0x0487('0x14')],{'as':_0x0487('0x177'),'through':'cm_user_has_contacts'});db[_0x0487('0x71')][_0x0487('0x123')](db[_0x0487('0x8f')],{'as':_0x0487('0x175'),'through':_0x0487('0x1a2')});db['CmContact']['belongsToMany'](db[_0x0487('0x8f')],{'through':_0x0487('0x1a2'),'as':_0x0487('0x176')});db[_0x0487('0x73')][_0x0487('0x121')](db['CmContact'],{'as':_0x0487('0x163'),'foreignKey':_0x0487('0x164'),'onDelete':_0x0487('0x117')});db[_0x0487('0x73')][_0x0487('0x121')](db[_0x0487('0xff')],{'as':_0x0487('0x16b'),'foreignKey':_0x0487('0x16c'),'onDelete':_0x0487('0x117')});db['CmHopper'][_0x0487('0x121')](db[_0x0487('0x14')],{'as':_0x0487('0x198'),'foreignKey':_0x0487('0x118')});db['CmHopper'][_0x0487('0x121')](db[_0x0487('0x1c')],{'as':_0x0487('0x199'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0487('0x73')]['belongsTo'](db[_0x0487('0xf2')],{'as':'Campaign','foreignKey':_0x0487('0x1a3'),'onDelete':'cascade'});db[_0x0487('0x73')][_0x0487('0x121')](db['User'],{'as':_0x0487('0x173'),'foreignKey':_0x0487('0x1a4')});db[_0x0487('0x75')][_0x0487('0x121')](db[_0x0487('0x71')],{'as':_0x0487('0x163'),'foreignKey':_0x0487('0x164'),'onDelete':_0x0487('0x117')});db[_0x0487('0x75')][_0x0487('0x121')](db[_0x0487('0xff')],{'as':_0x0487('0x16b'),'foreignKey':_0x0487('0x16c'),'onDelete':_0x0487('0x117')});db[_0x0487('0x75')][_0x0487('0x121')](db[_0x0487('0x1c')],{'as':'Queue','foreignKey':_0x0487('0x14f'),'onDelete':_0x0487('0x117')});db[_0x0487('0x75')][_0x0487('0x121')](db[_0x0487('0xf2')],{'as':_0x0487('0xf2'),'foreignKey':'CampaignId','onDelete':'cascade'});db['Automation'][_0x0487('0x119')](db[_0x0487('0x83')],{'as':{'plural':_0x0487('0x1a5'),'singular':_0x0487('0x1a6')},'foreignKey':_0x0487('0x1a7'),'onDelete':_0x0487('0x117'),'hooks':!![]});db[_0x0487('0x7f')][_0x0487('0x119')](db['Condition'],{'as':{'plural':_0x0487('0x1a8'),'singular':_0x0487('0x1a9')},'foreignKey':_0x0487('0x1aa'),'onDelete':'cascade','hooks':!![]});db[_0x0487('0x7f')][_0x0487('0x119')](db[_0x0487('0x7d')],{'as':_0x0487('0x1ab'),'foreignKey':_0x0487('0x1ac'),'onDelete':_0x0487('0x117'),'hooks':!![]});db[_0x0487('0x81')]['hasMany'](db[_0x0487('0x81')],{'as':_0x0487('0x17c'),'foreignKey':'ParentId','onDelete':_0x0487('0x117')});db['Interval'][_0x0487('0x119')](db[_0x0487('0x85')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0x0487('0x117'),'hooks':!![],'required':![]});db[_0x0487('0x85')][_0x0487('0x119')](db[_0x0487('0x19')],{'as':'Extensions','foreignKey':_0x0487('0x189'),'onDelete':'restrict'});db[_0x0487('0x85')][_0x0487('0x119')](db[_0x0487('0x16a')],{'as':_0x0487('0x1ad'),'foreignKey':_0x0487('0x189')});db[_0x0487('0x85')][_0x0487('0x119')](db[_0x0487('0x196')],{'as':_0x0487('0x1ae'),'foreignKey':'IntervalId'});db[_0x0487('0x85')][_0x0487('0x119')](db[_0x0487('0x4d')],{'as':_0x0487('0x1af'),'foreignKey':_0x0487('0x189')});db[_0x0487('0x85')][_0x0487('0x119')](db[_0x0487('0x54')],{'as':_0x0487('0x1b0'),'foreignKey':'IntervalId'});db['Schedule'][_0x0487('0x121')](db[_0x0487('0x3d')],{});db[_0x0487('0x8d')][_0x0487('0x121')](db[_0x0487('0x99')],{'foreignKey':_0x0487('0x1b1')});db[_0x0487('0x8d')][_0x0487('0x121')](db['AnalyticCustomReport'],{'foreignKey':_0x0487('0x1b2')});db[_0x0487('0x14a')][_0x0487('0x123')](db['VoiceMusicOnHold'],{'as':_0x0487('0x1b3'),'through':_0x0487('0x14c'),'onDelete':_0x0487('0x179')});db[_0x0487('0x8f')][_0x0487('0x123')](db[_0x0487('0x71')],{'through':_0x0487('0x1a2')});db[_0x0487('0x8f')]['belongsToMany'](db[_0x0487('0x12d')],{'through':_0x0487('0x1b4')});db[_0x0487('0x8f')]['belongsToMany'](db[_0x0487('0x42')],{'through':_0x0487('0x174')});db[_0x0487('0x8f')]['belongsToMany'](db[_0x0487('0x55')],{'through':_0x0487('0x18b')});db[_0x0487('0x8f')]['belongsToMany'](db[_0x0487('0x4f')],{'through':_0x0487('0x184')});db[_0x0487('0x8f')][_0x0487('0x123')](db[_0x0487('0x5d')],{'through':_0x0487('0x192')});db['Tag'][_0x0487('0x123')](db[_0x0487('0x10d')],{'through':_0x0487('0x1b5')});db['Trigger'][_0x0487('0x119')](db[_0x0487('0x83')],{'as':{'plural':_0x0487('0x1b6'),'singular':_0x0487('0x1b7')},'foreignKey':'TriggerAllId','onDelete':_0x0487('0x117'),'hooks':!![]});db[_0x0487('0x91')][_0x0487('0x119')](db[_0x0487('0x83')],{'as':{'plural':'AnyConditions','singular':_0x0487('0x1b8')},'foreignKey':'TriggerAnyId','onDelete':_0x0487('0x117'),'hooks':!![]});db[_0x0487('0x91')][_0x0487('0x119')](db[_0x0487('0x7d')],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0x0487('0x117'),'hooks':!![]});db[_0x0487('0x1b9')][_0x0487('0x119')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x0487('0x117'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x0487('0x99')][_0x0487('0x119')](db[_0x0487('0x9f')],{'as':_0x0487('0x1ba'),'onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x1b1')});db[_0x0487('0x9d')][_0x0487('0x119')](db[_0x0487('0x9f')],{'as':'Fields','onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x1bb')});db['AnalyticFieldReport'][_0x0487('0x121')](db[_0x0487('0x9d')],{'foreignKey':_0x0487('0x1bb')});db[_0x0487('0xa3')]['hasMany'](db[_0x0487('0xa5')],{'as':_0x0487('0x1bc'),'onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x1bd')});db[_0x0487('0xa5')]['hasMany'](db[_0x0487('0xa7')],{'as':_0x0487('0x1be'),'onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x1bf')});db[_0x0487('0xa5')][_0x0487('0x119')](db[_0x0487('0xa7')],{'as':_0x0487('0x1c0'),'onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x1c1')});db[_0x0487('0xa5')][_0x0487('0x119')](db[_0x0487('0xa7')],{'as':_0x0487('0x1ba'),'onDelete':_0x0487('0x117'),'foreignKey':'FieldId'});db[_0x0487('0xa5')][_0x0487('0x121')](db[_0x0487('0xa3')],{'as':_0x0487('0x172'),'foreignKey':_0x0487('0x1bd')});db[_0x0487('0xa7')][_0x0487('0x119')](db[_0x0487('0xa7')],{'as':_0x0487('0x1c2'),'foreignKey':_0x0487('0x1bf')});db[_0x0487('0xa7')]['hasMany'](db[_0x0487('0xa7')],{'as':_0x0487('0x1c3'),'foreignKey':_0x0487('0x1c1')});db[_0x0487('0xa7')][_0x0487('0x119')](db[_0x0487('0xa7')],{'as':'Field','foreignKey':_0x0487('0x1c4')});db[_0x0487('0xa7')][_0x0487('0x121')](db[_0x0487('0x93')],{'as':_0x0487('0x93'),'foreignKey':_0x0487('0x1c5')});db[_0x0487('0xa9')][_0x0487('0x119')](db[_0x0487('0xab')],{'as':_0x0487('0x1bc'),'onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x1bd')});db[_0x0487('0xab')][_0x0487('0x119')](db[_0x0487('0x1c6')],{'as':_0x0487('0x1be'),'onDelete':_0x0487('0x117'),'foreignKey':'SubjectId'});db[_0x0487('0xab')][_0x0487('0x119')](db[_0x0487('0x1c6')],{'as':_0x0487('0x1c0'),'onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x1c1')});db[_0x0487('0xab')][_0x0487('0x119')](db[_0x0487('0x1c6')],{'as':_0x0487('0x1ba'),'onDelete':'cascade','foreignKey':_0x0487('0x1c4')});db[_0x0487('0xab')][_0x0487('0x121')](db['SugarcrmAccount'],{'as':_0x0487('0x172'),'foreignKey':_0x0487('0x1bd')});db[_0x0487('0x1c6')][_0x0487('0x119')](db[_0x0487('0x1c6')],{'as':'Subject','foreignKey':_0x0487('0x1bf')});db[_0x0487('0x1c6')]['hasMany'](db[_0x0487('0x1c6')],{'as':'Description','foreignKey':_0x0487('0x1c1')});db[_0x0487('0x1c6')][_0x0487('0x119')](db['SugarcrmField'],{'as':_0x0487('0x1c7'),'foreignKey':'FieldId'});db['SugarcrmField']['belongsTo'](db[_0x0487('0x93')],{'as':'Variable','foreignKey':'VariableId'});db[_0x0487('0xae')][_0x0487('0x119')](db['DeskConfiguration'],{'as':_0x0487('0x1bc'),'onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x1bd')});db[_0x0487('0xb0')][_0x0487('0x119')](db[_0x0487('0xb2')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x0487('0x1bf')});db['DeskConfiguration'][_0x0487('0x119')](db[_0x0487('0xb2')],{'as':_0x0487('0x1c0'),'onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x1c1')});db[_0x0487('0xb0')][_0x0487('0x119')](db['DeskField'],{'as':_0x0487('0x1ba'),'onDelete':'cascade','foreignKey':_0x0487('0x1c4')});db[_0x0487('0xb0')][_0x0487('0x121')](db[_0x0487('0xae')],{'as':'Account','foreignKey':_0x0487('0x1bd')});db['DeskConfiguration'][_0x0487('0x123')](db[_0x0487('0x8f')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0487('0x119')](db[_0x0487('0xb2')],{'as':_0x0487('0x1c2'),'foreignKey':_0x0487('0x1bf')});db[_0x0487('0xb2')][_0x0487('0x119')](db[_0x0487('0xb2')],{'as':_0x0487('0x1c3'),'foreignKey':_0x0487('0x1c1')});db[_0x0487('0xb2')]['hasMany'](db[_0x0487('0xb2')],{'as':_0x0487('0x1c7'),'foreignKey':_0x0487('0x1c4')});db[_0x0487('0xb2')][_0x0487('0x121')](db['Variable'],{'as':_0x0487('0x93'),'foreignKey':_0x0487('0x1c5')});db[_0x0487('0xb4')][_0x0487('0x119')](db[_0x0487('0xb6')],{'as':_0x0487('0x1bc'),'onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x1bd')});db[_0x0487('0xb6')][_0x0487('0x119')](db['ZohoField'],{'as':'Subjects','onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x1bf')});db['ZohoConfiguration'][_0x0487('0x119')](db[_0x0487('0xb8')],{'as':_0x0487('0x1c0'),'onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x1c1')});db[_0x0487('0xb6')][_0x0487('0x119')](db[_0x0487('0xb8')],{'as':_0x0487('0x1ba'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x0487('0xb6')]['belongsTo'](db['ZohoAccount'],{'as':'Account','foreignKey':_0x0487('0x1bd')});db[_0x0487('0xb8')][_0x0487('0x119')](db[_0x0487('0xb8')],{'as':_0x0487('0x1c2'),'foreignKey':_0x0487('0x1bf')});db[_0x0487('0xb8')][_0x0487('0x119')](db[_0x0487('0xb8')],{'as':_0x0487('0x1c3'),'foreignKey':_0x0487('0x1c1')});db[_0x0487('0xb8')][_0x0487('0x119')](db[_0x0487('0xb8')],{'as':'Field','foreignKey':_0x0487('0x1c4')});db[_0x0487('0xb8')]['belongsTo'](db[_0x0487('0x93')],{'as':_0x0487('0x93'),'foreignKey':_0x0487('0x1c5')});db[_0x0487('0xba')][_0x0487('0x119')](db[_0x0487('0xbc')],{'as':_0x0487('0x1bc'),'onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x1bd')});db[_0x0487('0xbc')][_0x0487('0x119')](db[_0x0487('0xbe')],{'as':_0x0487('0x1be'),'foreignKey':_0x0487('0x1bf')});db[_0x0487('0xbc')][_0x0487('0x119')](db[_0x0487('0xbe')],{'as':_0x0487('0x1c0'),'foreignKey':_0x0487('0x1c1')});db[_0x0487('0xbc')][_0x0487('0x119')](db['ZendeskField'],{'as':_0x0487('0x1ba'),'foreignKey':_0x0487('0x1c4')});db['ZendeskConfiguration']['belongsTo'](db[_0x0487('0xba')],{'as':_0x0487('0x172'),'foreignKey':'AccountId'});db[_0x0487('0xbc')][_0x0487('0x123')](db[_0x0487('0x8f')],{'through':_0x0487('0x1c8')});db[_0x0487('0xbe')][_0x0487('0x119')](db[_0x0487('0xbe')],{'as':_0x0487('0x1c2'),'foreignKey':_0x0487('0x1bf')});db['ZendeskField'][_0x0487('0x119')](db[_0x0487('0xbe')],{'as':_0x0487('0x1c3'),'foreignKey':_0x0487('0x1c1')});db[_0x0487('0xbe')]['hasMany'](db[_0x0487('0xbe')],{'as':_0x0487('0x1c7'),'foreignKey':_0x0487('0x1c4')});db[_0x0487('0xbe')][_0x0487('0x121')](db[_0x0487('0x93')],{'as':_0x0487('0x93'),'foreignKey':_0x0487('0x1c5')});db[_0x0487('0xc0')][_0x0487('0x119')](db[_0x0487('0xc1')],{'as':_0x0487('0x1bc'),'onDelete':_0x0487('0x117'),'foreignKey':'AccountId'});db[_0x0487('0xc1')][_0x0487('0x119')](db[_0x0487('0x1c9')],{'as':_0x0487('0x1be'),'onDelete':'cascade','foreignKey':_0x0487('0x1bf')});db[_0x0487('0xc1')][_0x0487('0x119')](db[_0x0487('0x1c9')],{'as':_0x0487('0x1c0'),'onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x1c1')});db[_0x0487('0xc1')][_0x0487('0x119')](db[_0x0487('0x1c9')],{'as':_0x0487('0x1ba'),'onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x1c4')});db[_0x0487('0xc1')][_0x0487('0x121')](db[_0x0487('0xc0')],{'as':_0x0487('0x172'),'foreignKey':'AccountId'});db[_0x0487('0xc1')]['belongsToMany'](db['Tag'],{'through':_0x0487('0x1ca')});db[_0x0487('0x1c9')][_0x0487('0x119')](db[_0x0487('0x1c9')],{'as':'Subject','foreignKey':_0x0487('0x1bf')});db['FreshdeskField'][_0x0487('0x119')](db[_0x0487('0x1c9')],{'as':_0x0487('0x1c3'),'foreignKey':_0x0487('0x1c1')});db[_0x0487('0x1c9')][_0x0487('0x119')](db[_0x0487('0x1c9')],{'as':_0x0487('0x1c7'),'foreignKey':_0x0487('0x1c4')});db[_0x0487('0x1c9')][_0x0487('0x121')](db['Variable'],{'as':_0x0487('0x93'),'foreignKey':_0x0487('0x1c5')});db[_0x0487('0xc4')]['hasMany'](db[_0x0487('0xc6')],{'as':_0x0487('0x1bc'),'onDelete':_0x0487('0x117'),'foreignKey':'AccountId'});db[_0x0487('0xc6')][_0x0487('0x119')](db[_0x0487('0x1cb')],{'as':_0x0487('0x1be'),'foreignKey':_0x0487('0x1bf')});db[_0x0487('0xc6')]['hasMany'](db['VtigerField'],{'as':'Descriptions','foreignKey':_0x0487('0x1c1')});db['VtigerConfiguration']['hasMany'](db['VtigerField'],{'as':'Fields','foreignKey':_0x0487('0x1c4')});db['VtigerConfiguration'][_0x0487('0x121')](db[_0x0487('0xc4')],{'as':_0x0487('0x172'),'foreignKey':'AccountId'});db[_0x0487('0x1cb')]['hasMany'](db['VtigerField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0487('0x1cb')]['hasMany'](db[_0x0487('0x1cb')],{'as':_0x0487('0x1c3'),'foreignKey':'DescriptionId'});db[_0x0487('0x1cb')][_0x0487('0x119')](db[_0x0487('0x1cb')],{'as':_0x0487('0x1c7'),'foreignKey':_0x0487('0x1c4')});db[_0x0487('0x1cb')][_0x0487('0x121')](db['Variable'],{'as':_0x0487('0x93'),'foreignKey':'VariableId'});db[_0x0487('0x1cc')]['hasMany'](db[_0x0487('0xca')],{'as':'Configurations','onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x1bd')});db[_0x0487('0xca')][_0x0487('0x119')](db[_0x0487('0xcc')],{'as':'Subjects','foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x0487('0x119')](db[_0x0487('0xcc')],{'as':_0x0487('0x1c0'),'foreignKey':_0x0487('0x1c1')});db[_0x0487('0xca')][_0x0487('0x119')](db[_0x0487('0xcc')],{'as':'Fields','foreignKey':_0x0487('0x1c4')});db['ServicenowConfiguration'][_0x0487('0x121')](db['ServicenowAccount'],{'as':'Account','foreignKey':_0x0487('0x1bd')});db['ServicenowField'][_0x0487('0x119')](db[_0x0487('0xcc')],{'as':'Subject','foreignKey':_0x0487('0x1bf')});db[_0x0487('0xcc')][_0x0487('0x119')](db[_0x0487('0xcc')],{'as':_0x0487('0x1c3'),'foreignKey':_0x0487('0x1c1')});db[_0x0487('0xcc')][_0x0487('0x119')](db[_0x0487('0xcc')],{'as':_0x0487('0x1c7'),'foreignKey':_0x0487('0x1c4')});db[_0x0487('0xcc')][_0x0487('0x121')](db[_0x0487('0x93')],{'as':_0x0487('0x93'),'foreignKey':'VariableId'});db[_0x0487('0x1cd')]['hasMany'](db[_0x0487('0x1ce')],{'as':_0x0487('0x1bc'),'onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x1bd')});db[_0x0487('0x1ce')][_0x0487('0x119')](db[_0x0487('0xcf')],{'as':'Subjects','onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x1bf')});db['Dynamics365Configuration'][_0x0487('0x119')](db['Dynamics365Field'],{'as':_0x0487('0x1c0'),'onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x1c1')});db[_0x0487('0x1ce')][_0x0487('0x119')](db[_0x0487('0xcf')],{'as':_0x0487('0x1ba'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x0487('0x1ce')][_0x0487('0x121')](db[_0x0487('0x1cd')],{'as':_0x0487('0x172'),'foreignKey':_0x0487('0x1bd')});db[_0x0487('0xcf')]['hasMany'](db[_0x0487('0xcf')],{'as':_0x0487('0x1c2'),'foreignKey':_0x0487('0x1bf')});db[_0x0487('0xcf')][_0x0487('0x119')](db[_0x0487('0xcf')],{'as':_0x0487('0x1c3'),'foreignKey':_0x0487('0x1c1')});db[_0x0487('0xcf')]['hasMany'](db[_0x0487('0xcf')],{'as':_0x0487('0x1c7'),'foreignKey':_0x0487('0x1c4')});db['Dynamics365Field']['belongsTo'](db[_0x0487('0x93')],{'as':_0x0487('0x93'),'foreignKey':_0x0487('0x1c5')});db['FreshsalesAccount']['hasMany'](db[_0x0487('0xd3')],{'as':_0x0487('0x1bc'),'onDelete':'cascade','foreignKey':_0x0487('0x1bd')});db[_0x0487('0xd3')]['hasMany'](db[_0x0487('0xd5')],{'as':_0x0487('0x1be'),'foreignKey':_0x0487('0x1bf')});db[_0x0487('0xd3')][_0x0487('0x119')](db[_0x0487('0xd5')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x0487('0xd3')][_0x0487('0x119')](db['FreshsalesField'],{'as':_0x0487('0x1ba'),'foreignKey':_0x0487('0x1c4')});db['FreshsalesConfiguration'][_0x0487('0x121')](db[_0x0487('0xd1')],{'as':_0x0487('0x172'),'foreignKey':_0x0487('0x1bd')});db[_0x0487('0xd5')][_0x0487('0x119')](db['FreshsalesField'],{'as':_0x0487('0x1c2'),'foreignKey':_0x0487('0x1bf')});db[_0x0487('0xd5')][_0x0487('0x119')](db[_0x0487('0xd5')],{'as':'Description','foreignKey':_0x0487('0x1c1')});db[_0x0487('0xd5')][_0x0487('0x119')](db[_0x0487('0xd5')],{'as':_0x0487('0x1c7'),'foreignKey':_0x0487('0x1c4')});db[_0x0487('0xd5')][_0x0487('0x121')](db[_0x0487('0x93')],{'as':_0x0487('0x93'),'foreignKey':_0x0487('0x1c5')});db[_0x0487('0x1cf')][_0x0487('0x121')](db[_0x0487('0x63')],{});db['ChatQueueReport']['belongsTo'](db['CmList'],{'as':_0x0487('0x16b'),'foreignKey':'ListId'});db[_0x0487('0x1cf')][_0x0487('0x121')](db[_0x0487('0x71')],{'as':_0x0487('0x163'),'foreignKey':'ContactId'});db['ChatQueueReport'][_0x0487('0x121')](db[_0x0487('0x12d')],{});db['ChatQueueReport'][_0x0487('0x121')](db[_0x0487('0x67')],{});db['ChatQueueReport'][_0x0487('0x121')](db[_0x0487('0x14')],{});db['ChatQueueReport'][_0x0487('0x121')](db[_0x0487('0x6b')],{});db[_0x0487('0xd9')][_0x0487('0x121')](db['User'],{'onDelete':'cascade','foreignKey':_0x0487('0x1d0')});db[_0x0487('0xd9')][_0x0487('0x121')](db['User'],{'onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x1d1')});db[_0x0487('0xde')][_0x0487('0x119')](db[_0x0487('0xdc')],{'foreignKey':'SessionId','onDelete':'cascade'});db['JscriptySessionReport'][_0x0487('0x119')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0x0487('0x117')});db[_0x0487('0xe0')][_0x0487('0x121')](db[_0x0487('0x52')],{});db[_0x0487('0xe0')][_0x0487('0x121')](db[_0x0487('0xff')],{'as':_0x0487('0x16b'),'foreignKey':_0x0487('0x16c')});db[_0x0487('0xe0')][_0x0487('0x121')](db[_0x0487('0x71')],{'as':_0x0487('0x163'),'foreignKey':_0x0487('0x164')});db[_0x0487('0xe0')][_0x0487('0x121')](db[_0x0487('0x55')],{});db[_0x0487('0xe0')]['belongsTo'](db[_0x0487('0x57')],{});db['SmsQueueReport']['belongsTo'](db[_0x0487('0x14')],{});db['SmsQueueReport'][_0x0487('0x121')](db[_0x0487('0x59')],{});db['JscriptyProject'][_0x0487('0x119')](db[_0x0487('0xde')],{'foreignKey':_0x0487('0x1d2')});db['JscriptyProject'][_0x0487('0x119')](db['JscriptyQuestionReport'],{'foreignKey':_0x0487('0x1d2')});db[_0x0487('0xe5')]['hasMany'](db[_0x0487('0xdb')],{'foreignKey':_0x0487('0x1d2')});db[_0x0487('0x1d3')][_0x0487('0x123')](db[_0x0487('0x14')],{'as':_0x0487('0x177'),'through':_0x0487('0x146')});db['Team'][_0x0487('0x123')](db[_0x0487('0x14')],{'as':'Agents','through':_0x0487('0x12a')});db[_0x0487('0xef')]['belongsToMany'](db[_0x0487('0x1c')],{'through':_0x0487('0x15a'),'as':_0x0487('0x131')});db['Team'][_0x0487('0x123')](db[_0x0487('0x3e')],{'through':_0x0487('0x1d4'),'as':'MailQueues'});db[_0x0487('0xef')][_0x0487('0x123')](db[_0x0487('0x6b')],{'through':_0x0487('0x19c'),'as':_0x0487('0x134')});db['Team']['belongsToMany'](db[_0x0487('0x182')],{'through':_0x0487('0x1d5'),'as':_0x0487('0x135')});db['Team'][_0x0487('0x123')](db[_0x0487('0x59')],{'through':'team_has_sms_queues','as':_0x0487('0x137')});db['Team'][_0x0487('0x123')](db[_0x0487('0x61')],{'through':_0x0487('0x194'),'as':_0x0487('0x139')});db[_0x0487('0xef')][_0x0487('0x123')](db[_0x0487('0x113')],{'through':_0x0487('0x1d6'),'as':_0x0487('0x13a')});db['Campaign'][_0x0487('0x119')](db['CmHopper'],{'as':_0x0487('0x19f'),'foreignKey':_0x0487('0x1a3')});db[_0x0487('0xf2')]['hasMany'](db[_0x0487('0x76')],{'as':_0x0487('0x150'),'foreignKey':'CampaignId'});db[_0x0487('0xf2')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x0487('0x1a3')});db['Campaign']['hasMany'](db[_0x0487('0x75')],{'as':'HopperBlacks','foreignKey':_0x0487('0x1a3')});db[_0x0487('0xf2')]['belongsTo'](db['Trunk'],{'as':_0x0487('0x2d'),'foreignKey':_0x0487('0x154')});db[_0x0487('0xf2')][_0x0487('0x121')](db[_0x0487('0x2d')],{'as':_0x0487('0x155'),'foreignKey':_0x0487('0x156')});db[_0x0487('0xf2')][_0x0487('0x121')](db[_0x0487('0x85')],{'as':_0x0487('0x85'),'foreignKey':_0x0487('0x189')});db['Campaign'][_0x0487('0x121')](db[_0x0487('0x1d3')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0x0487('0xf2')][_0x0487('0x123')](db[_0x0487('0xff')],{'as':_0x0487('0x128'),'through':_0x0487('0x1d7')});db[_0x0487('0xf2')][_0x0487('0x123')](db[_0x0487('0xff')],{'as':_0x0487('0x15b'),'through':_0x0487('0x1d8')});db[_0x0487('0xf7')]['belongsTo'](db[_0x0487('0x44')],{});db[_0x0487('0xf7')][_0x0487('0x121')](db[_0x0487('0x42')],{});db[_0x0487('0xf7')][_0x0487('0x121')](db[_0x0487('0x3d')],{'foreignKey':_0x0487('0x1d9'),'as':_0x0487('0x1da')});db[_0x0487('0xf7')][_0x0487('0x121')](db[_0x0487('0x14')],{'foreignKey':_0x0487('0x1db'),'as':'FromAgent'});db['MailTransferReport'][_0x0487('0x121')](db[_0x0487('0x14')],{'foreignKey':_0x0487('0x1dc'),'as':_0x0487('0x1dd')});db['MailTransferReport'][_0x0487('0x121')](db[_0x0487('0x3e')],{'foreignKey':_0x0487('0x1de'),'as':_0x0487('0x1df')});db[_0x0487('0xf7')][_0x0487('0x121')](db[_0x0487('0x3d')],{'foreignKey':_0x0487('0x1e0'),'as':_0x0487('0x1e1')});db[_0x0487('0xf9')][_0x0487('0x121')](db[_0x0487('0x67')],{});db[_0x0487('0xf9')][_0x0487('0x121')](db[_0x0487('0x12d')],{});db['ChatTransferReport'][_0x0487('0x121')](db[_0x0487('0x63')],{'foreignKey':_0x0487('0x1e2'),'as':'FromAccount'});db[_0x0487('0xf9')][_0x0487('0x121')](db[_0x0487('0x14')],{'foreignKey':'FromUserId','as':_0x0487('0x1e3')});db[_0x0487('0xf9')]['belongsTo'](db[_0x0487('0x14')],{'foreignKey':_0x0487('0x1dc'),'as':'ToAgent'});db[_0x0487('0xf9')]['belongsTo'](db[_0x0487('0x6b')],{'foreignKey':_0x0487('0x1e4'),'as':'ToQueue'});db['ChatTransferReport'][_0x0487('0x121')](db['ChatWebsite'],{'foreignKey':_0x0487('0x1e5'),'as':'ToAccount'});db[_0x0487('0xfa')][_0x0487('0x121')](db[_0x0487('0x181')],{});db[_0x0487('0xfa')][_0x0487('0x121')](db[_0x0487('0x4f')],{});db['FaxTransferReport'][_0x0487('0x121')](db[_0x0487('0x13d')],{'foreignKey':_0x0487('0x1e6'),'as':_0x0487('0x1da')});db[_0x0487('0xfa')][_0x0487('0x121')](db['User'],{'foreignKey':_0x0487('0x1db'),'as':_0x0487('0x1e3')});db[_0x0487('0xfa')][_0x0487('0x121')](db[_0x0487('0x14')],{'foreignKey':'ToUserId','as':_0x0487('0x1dd')});db[_0x0487('0xfa')][_0x0487('0x121')](db[_0x0487('0x182')],{'foreignKey':_0x0487('0x1e7'),'as':_0x0487('0x1df')});db['FaxTransferReport']['belongsTo'](db[_0x0487('0x13d')],{'foreignKey':_0x0487('0x1e8'),'as':_0x0487('0x1e1')});db[_0x0487('0xfc')]['belongsTo'](db[_0x0487('0x5f')],{});db[_0x0487('0xfc')]['belongsTo'](db[_0x0487('0x5d')],{});db[_0x0487('0xfc')][_0x0487('0x121')](db['OpenchannelAccount'],{'foreignKey':_0x0487('0x1e9'),'as':_0x0487('0x1da')});db[_0x0487('0xfc')]['belongsTo'](db[_0x0487('0x14')],{'foreignKey':_0x0487('0x1db'),'as':_0x0487('0x1e3')});db[_0x0487('0xfc')][_0x0487('0x121')](db[_0x0487('0x14')],{'foreignKey':_0x0487('0x1dc'),'as':_0x0487('0x1dd')});db[_0x0487('0xfc')][_0x0487('0x121')](db['OpenchannelQueue'],{'foreignKey':_0x0487('0x1ea'),'as':_0x0487('0x1df')});db[_0x0487('0xfc')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':_0x0487('0x1e1')});db[_0x0487('0xfe')][_0x0487('0x121')](db[_0x0487('0x57')],{});db[_0x0487('0xfe')][_0x0487('0x121')](db[_0x0487('0x55')],{});db[_0x0487('0xfe')]['belongsTo'](db[_0x0487('0x52')],{'foreignKey':_0x0487('0x1eb'),'as':'FromAccount'});db[_0x0487('0xfe')][_0x0487('0x121')](db[_0x0487('0x14')],{'foreignKey':_0x0487('0x1db'),'as':_0x0487('0x1e3')});db[_0x0487('0xfe')]['belongsTo'](db[_0x0487('0x14')],{'foreignKey':_0x0487('0x1dc'),'as':_0x0487('0x1dd')});db[_0x0487('0xfe')][_0x0487('0x121')](db[_0x0487('0x59')],{'foreignKey':_0x0487('0x1ec'),'as':'ToQueue'});db[_0x0487('0xfe')][_0x0487('0x121')](db[_0x0487('0x52')],{'foreignKey':_0x0487('0x1ed'),'as':_0x0487('0x1e1')});db['CmList'][_0x0487('0x119')](db[_0x0487('0x81')],{'as':'Dispositions','foreignKey':_0x0487('0x16c')});db['CmList'][_0x0487('0x119')](db[_0x0487('0x1ee')],{'as':_0x0487('0x1ef'),'foreignKey':_0x0487('0x16c')});db[_0x0487('0xff')]['hasMany'](db[_0x0487('0x71')],{'as':'Contacts','onDelete':_0x0487('0x117'),'foreignKey':_0x0487('0x16c')});db[_0x0487('0xff')][_0x0487('0x119')](db[_0x0487('0x76')],{'as':'HopperFinals','foreignKey':_0x0487('0x16c')});db[_0x0487('0xff')][_0x0487('0x119')](db[_0x0487('0x78')],{'as':_0x0487('0x11a'),'foreignKey':_0x0487('0x16c')});db[_0x0487('0xff')][_0x0487('0x119')](db[_0x0487('0x7a')],{'as':'ReportAgentPreview','foreignKey':_0x0487('0x16c')});db['CmList'][_0x0487('0x123')](db[_0x0487('0x1c')],{'as':_0x0487('0x1f0'),'through':_0x0487('0x158')});db['CmList'][_0x0487('0x123')](db[_0x0487('0x14')],{'as':_0x0487('0x159'),'through':'cm_user_has_lists'});db[_0x0487('0x101')]['hasMany'](db[_0x0487('0x19')],{'as':_0x0487('0x1f1'),'onDelete':_0x0487('0x117')});db[_0x0487('0x101')]['belongsToMany'](db['User'],{'as':_0x0487('0x159'),'through':_0x0487('0x1f2')});db[_0x0487('0x103')][_0x0487('0x119')](db['User'],{'as':_0x0487('0x177'),'foreignKey':'userProfileId'});db[_0x0487('0x103')]['hasMany'](db[_0x0487('0x104')],{'as':'UserProfileSections','foreignKey':_0x0487('0x122'),'onDelete':_0x0487('0x117')});db[_0x0487('0x104')]['hasMany'](db[_0x0487('0x106')],{'as':_0x0487('0x1f3'),'foreignKey':_0x0487('0x1f4'),'onDelete':'cascade'});db[_0x0487('0x109')][_0x0487('0x119')](db['Disposition'],{'as':_0x0487('0x17c'),'foreignKey':_0x0487('0x1f5')});db[_0x0487('0x109')][_0x0487('0x119')](db[_0x0487('0x80')],{'as':_0x0487('0x169'),'foreignKey':_0x0487('0x1f5')});db[_0x0487('0x109')]['hasMany'](db[_0x0487('0x10f')],{'as':_0x0487('0x15e'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x0487('0x119')](db[_0x0487('0x10d')],{'as':_0x0487('0x17e')});db[_0x0487('0x109')][_0x0487('0x119')](db['WhatsappApplication'],{'as':_0x0487('0x17f')});db[_0x0487('0x109')]['belongsTo'](db[_0x0487('0xff')],{'as':_0x0487('0x16b'),'foreignKey':'ListId'});db['WhatsappAccount'][_0x0487('0x121')](db[_0x0487('0x87')],{'as':_0x0487('0x16f'),'foreignKey':_0x0487('0x157')});db[_0x0487('0x109')]['belongsToMany'](db[_0x0487('0x14')],{'as':_0x0487('0x159'),'through':_0x0487('0x145')});db[_0x0487('0x10b')][_0x0487('0x121')](db[_0x0487('0x14')],{'onDelete':_0x0487('0x179')});db[_0x0487('0x10b')][_0x0487('0x121')](db[_0x0487('0x113')],{'onDelete':'restrict'});db[_0x0487('0x10b')][_0x0487('0x121')](db[_0x0487('0x109')],{'onDelete':'restrict'});db[_0x0487('0x10b')][_0x0487('0x121')](db['Interval'],{'onDelete':_0x0487('0x179'),'foreignKey':_0x0487('0x189')});db[_0x0487('0x10b')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0x0487('0x17a')});db[_0x0487('0x10d')][_0x0487('0x119')](db[_0x0487('0x10f')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0487('0x1f6')});db[_0x0487('0x10d')]['belongsTo'](db[_0x0487('0x109')],{'as':'Account','foreignKey':_0x0487('0x1f5')});db['WhatsappInteraction'][_0x0487('0x121')](db[_0x0487('0x71')],{'as':_0x0487('0x163'),'foreignKey':_0x0487('0x164')});db['WhatsappInteraction']['belongsTo'](db[_0x0487('0x14')],{'as':_0x0487('0x173'),'foreignKey':'UserId'});db['WhatsappInteraction']['belongsToMany'](db[_0x0487('0x8f')],{'through':_0x0487('0x1b5'),'as':_0x0487('0x175')});db[_0x0487('0x10d')]['belongsToMany'](db[_0x0487('0x8f')],{'through':_0x0487('0x1b5'),'as':'ThroughTags'});db[_0x0487('0x10d')]['belongsToMany'](db[_0x0487('0x14')],{'as':'Users','through':_0x0487('0x1f7'),'foreignKey':_0x0487('0x1f6')});db['WhatsappMessage'][_0x0487('0x121')](db[_0x0487('0x14')],{'as':_0x0487('0x14')});db['WhatsappMessage']['belongsTo'](db[_0x0487('0x71')],{'onDelete':_0x0487('0x117'),'as':_0x0487('0x163')});db[_0x0487('0x10f')][_0x0487('0x121')](db[_0x0487('0x10d')],{'onDelete':_0x0487('0x117'),'as':'Interaction','foreignKey':_0x0487('0x1f6')});db[_0x0487('0x10f')][_0x0487('0x121')](db[_0x0487('0x109')],{'as':_0x0487('0x172'),'foreignKey':_0x0487('0x1f5')});db['WhatsappQueueReport']['belongsTo'](db[_0x0487('0x109')],{});db[_0x0487('0x1f8')][_0x0487('0x121')](db[_0x0487('0xff')],{'as':_0x0487('0x16b'),'foreignKey':'ListId'});db['WhatsappQueueReport']['belongsTo'](db[_0x0487('0x71')],{'as':_0x0487('0x163'),'foreignKey':_0x0487('0x164')});db['WhatsappQueueReport'][_0x0487('0x121')](db[_0x0487('0x10d')],{});db[_0x0487('0x1f8')][_0x0487('0x121')](db[_0x0487('0x113')],{});db['WhatsappQueueReport'][_0x0487('0x121')](db['WhatsappMessage'],{});db[_0x0487('0x1f8')][_0x0487('0x121')](db[_0x0487('0x14')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x0487('0x10f')],{});db[_0x0487('0x111')]['belongsTo'](db[_0x0487('0x10d')],{});db['WhatsappTransferReport'][_0x0487('0x121')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db[_0x0487('0x111')][_0x0487('0x121')](db['WhatsappAccount'],{'foreignKey':_0x0487('0x1f9'),'as':_0x0487('0x1e1')});db[_0x0487('0x111')]['belongsTo'](db[_0x0487('0x113')],{'foreignKey':_0x0487('0x1fa'),'as':_0x0487('0x1df')});db[_0x0487('0x111')]['belongsTo'](db[_0x0487('0x14')],{'foreignKey':_0x0487('0x1db'),'as':_0x0487('0x1e3')});db[_0x0487('0x111')][_0x0487('0x121')](db['User'],{'foreignKey':_0x0487('0x1dc'),'as':_0x0487('0x1dd')});db[_0x0487('0x113')][_0x0487('0x123')](db[_0x0487('0x14')],{'as':_0x0487('0x159'),'through':_0x0487('0x3a'),'foreignKey':_0x0487('0x1fb')});db['WhatsappQueue'][_0x0487('0x123')](db[_0x0487('0xef')],{'through':_0x0487('0x1d6'),'as':_0x0487('0x170')});module[_0x0487('0x1fc')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x8b47=['../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','Sound','../api/sound/sound.model','Tag','Template','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','ZohoAccount','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../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','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','CloudProvider','../api/cloudProvider/cloudProvider.model','User','hasOne','VoiceMail','cascade','UserId','hasMany','Recordings','UserVoiceQueueRt','VoiceQueuesRt','Extensions','CmHopperFinal','HopperFinals','HopperHistory','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','userProfileId','belongsToMany','Groups','chat_group_has_users','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','VoiceQueues','MailQueue','MailQueues','ChatQueues','SmsQueue','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','VoiceQueue','VoiceQueueId','CmHopper','HopperBlacks','JscriptySessions','belongsTo','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','UserVoiceQueue','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceCallReport','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','Imap','Smtp','Disposition','Dispositions','CannedAnswer','ListId','TemplateId','team_has_mail_queues','MailInteractionId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Attachments','Interaction','Account','restrict','MailQueueReport','Dashboard','Items','Answers','FaxAccountId','Interactions','Exntensions','List','user_has_fax_accounts','TagId','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','team_has_fax_queues','SmsAccountId','SmsInteractionId','SmsInteraction','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelInteractionId','openchannel_interaction_has_tags','Users','AttachmentId','ChatWebsiteId','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','team_has_chat_queues','ChatGroupId','Members','CmCompany','Contacts','CompanyId','HopperHistories','cm_contact_has_tags','CampaignId','OwnerId','Condition','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','AutomationId','Intervals','ChatApplications','FaxApplications','SmsApplications','CustomReportId','whatsapp_interaction_has_tags','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','Actions','TriggerId','AnalyticFieldReport','Fields','DefaultReportId','SalesforceAccount','AccountId','Subjects','SubjectId','Descriptions','FieldId','DescriptionId','Field','VariableId','SugarcrmConfiguration','Configurations','Subject','Description','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskConfiguration','int_zendesk_configuration_has_tags','VtigerField','ServicenowAccount','FreshsalesConfiguration','ChatInternalMessage','FromId','ToId','SessionId','SmsQueueReport','ProjectId','team_has_whatsapp_queues','Hoppers','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToAccount','ChatTransferReport','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','ToFaxQueueId','ToQueue','ToFaxAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','user_has_voice_prefixes','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','lodash','jstz','determine','sequelize','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','defaultsDeep','sequelizeHistory','utf8_general_ci','database','username','options','password','import','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../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/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact'];(function(_0x769475,_0x193762){var _0x48b38e=function(_0x573005){while(--_0x573005){_0x769475['push'](_0x769475['shift']());}};_0x48b38e(++_0x193762);}(_0x8b47,0x182));var _0x78b4=function(_0x542a9d,_0x48c739){_0x542a9d=_0x542a9d-0x0;var _0x7d2c3e=_0x8b47[_0x542a9d];return _0x7d2c3e;};'use strict';var path=require(_0x78b4('0x0'));var config=require(_0x78b4('0x1'));var Sequelize=require('sequelize');var _=require(_0x78b4('0x2'));var jstz=require(_0x78b4('0x3'));var timezone=jstz[_0x78b4('0x4')]();config[_0x78b4('0x5')]=_['defaultsDeep'](config[_0x78b4('0x5')],{'database':_0x78b4('0x6'),'username':_0x78b4('0x7'),'password':_0x78b4('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x78b4('0x9'),'dialectOptions':{'charset':_0x78b4('0xa')},'logging':![],'timezone':timezone[_0x78b4('0xb')](),'define':{'charset':_0x78b4('0xc'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x78b4('0xd')](config[_0x78b4('0xe')],{'database':_0x78b4('0x6'),'username':_0x78b4('0x7'),'password':_0x78b4('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x78b4('0x9'),'dialectOptions':{'charset':_0x78b4('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x78b4('0xc'),'collate':_0x78b4('0xf')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x78b4('0x5')][_0x78b4('0x10')],config[_0x78b4('0x5')][_0x78b4('0x11')],config[_0x78b4('0x5')]['password'],config[_0x78b4('0x5')][_0x78b4('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x78b4('0x10')],config[_0x78b4('0xe')][_0x78b4('0x11')],config[_0x78b4('0xe')][_0x78b4('0x13')],config[_0x78b4('0xe')]['options'])};db['User']=db['sequelize'][_0x78b4('0x14')]('../api/user/user.model');db['VoiceChanSpy']=db['sequelize'][_0x78b4('0x14')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x78b4('0x15')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x16'));db[_0x78b4('0x17')]=db[_0x78b4('0x5')]['import'](_0x78b4('0x18'));db[_0x78b4('0x19')]=db[_0x78b4('0x5')][_0x78b4('0x14')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db[_0x78b4('0x5')]['import'](_0x78b4('0x1a'));db[_0x78b4('0x1b')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x1c'));db[_0x78b4('0x1d')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x1e'));db['VoiceMail']=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x1f'));db[_0x78b4('0x20')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x21'));db['VoiceCallReport']=db[_0x78b4('0x5')][_0x78b4('0x14')]('../api/voiceCallReport/voiceCallReport.model');db[_0x78b4('0x22')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x23'));db['VoiceAgentReport']=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x24'));db[_0x78b4('0x25')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x26'));db[_0x78b4('0x27')]=db[_0x78b4('0x5')]['import'](_0x78b4('0x28'));db[_0x78b4('0x29')]=db['sequelize'][_0x78b4('0x14')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x2a'));db['UserVoiceQueueRt']=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x2b'));db['UserVoiceQueue']=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x2c'));db[_0x78b4('0x2d')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x2e'));db[_0x78b4('0x2f')]=db['sequelize']['import'](_0x78b4('0x30'));db[_0x78b4('0x31')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x32'));db['UserSmsQueue']=db[_0x78b4('0x5')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0x78b4('0x33')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x34'));db[_0x78b4('0x35')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x36'));db[_0x78b4('0x37')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x38'));db[_0x78b4('0x39')]=db[_0x78b4('0x5')][_0x78b4('0x14')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db['sequelize'][_0x78b4('0x14')]('../api/mailAccount/mailAccount.model');db['MailQueue']=db[_0x78b4('0x5')]['import'](_0x78b4('0x3a'));db['MailSubstatus']=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x3b'));db[_0x78b4('0x3c')]=db[_0x78b4('0x5')]['import'](_0x78b4('0x3d'));db[_0x78b4('0x3e')]=db[_0x78b4('0x5')][_0x78b4('0x14')]('../api/mailMessage/mailMessage.model');db[_0x78b4('0x3f')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x40'));db['MailQueueReport']=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x41'));db['Dashboard']=db['sequelize']['import'](_0x78b4('0x42'));db[_0x78b4('0x43')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x44'));db['FaxAccount']=db[_0x78b4('0x5')]['import'](_0x78b4('0x45'));db[_0x78b4('0x46')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x47'));db['FaxInteraction']=db['sequelize'][_0x78b4('0x14')](_0x78b4('0x48'));db[_0x78b4('0x49')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x4a'));db[_0x78b4('0x4b')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x4c'));db[_0x78b4('0x4d')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x4e'));db['SmsAccount']=db['sequelize']['import'](_0x78b4('0x4f'));db[_0x78b4('0x50')]=db[_0x78b4('0x5')]['import']('../api/smsApplication/smsApplication.model');db['SmsInteraction']=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x51'));db[_0x78b4('0x52')]=db['sequelize'][_0x78b4('0x14')](_0x78b4('0x53'));db['SmsQueue']=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x54'));db[_0x78b4('0x55')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x56'));db[_0x78b4('0x57')]=db['sequelize'][_0x78b4('0x14')](_0x78b4('0x58'));db[_0x78b4('0x59')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x5a'));db[_0x78b4('0x5b')]=db['sequelize'][_0x78b4('0x14')](_0x78b4('0x5c'));db[_0x78b4('0x5d')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x5e'));db[_0x78b4('0x5f')]=db[_0x78b4('0x5')][_0x78b4('0x14')]('../api/chatWebsite/chatWebsite.model');db[_0x78b4('0x60')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x61'));db[_0x78b4('0x62')]=db['sequelize'][_0x78b4('0x14')](_0x78b4('0x63'));db[_0x78b4('0x64')]=db['sequelize'][_0x78b4('0x14')](_0x78b4('0x65'));db[_0x78b4('0x66')]=db[_0x78b4('0x5')]['import']('../api/chatMessage/chatMessage.model');db[_0x78b4('0x67')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x68'));db[_0x78b4('0x69')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x6a'));db[_0x78b4('0x6b')]=db['sequelize']['import'](_0x78b4('0x6c'));db[_0x78b4('0x6d')]=db[_0x78b4('0x5')]['import'](_0x78b4('0x6e'));db['CmCompany']=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x6f'));db[_0x78b4('0x70')]=db['sequelize'][_0x78b4('0x14')](_0x78b4('0x71'));db['CmHopper']=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x72'));db[_0x78b4('0x73')]=db['sequelize'][_0x78b4('0x14')]('../api/cmHopperBlack/cmHopperBlack.model');db['CmHopperFinal']=db[_0x78b4('0x5')][_0x78b4('0x14')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x78b4('0x74')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x75'));db[_0x78b4('0x76')]=db['sequelize']['import'](_0x78b4('0x77'));db[_0x78b4('0x78')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x79'));db[_0x78b4('0x7a')]=db['sequelize']['import'](_0x78b4('0x7b'));db[_0x78b4('0x7c')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x7d'));db['CannedAnswer']=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x7e'));db['Disposition']=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x7f'));db['Condition']=db['sequelize'][_0x78b4('0x14')](_0x78b4('0x80'));db[_0x78b4('0x81')]=db[_0x78b4('0x5')]['import'](_0x78b4('0x82'));db['Pause']=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x83'));db['Cdr']=db['sequelize'][_0x78b4('0x14')](_0x78b4('0x84'));db[_0x78b4('0x85')]=db[_0x78b4('0x5')][_0x78b4('0x14')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x78b4('0x86')]=db[_0x78b4('0x5')][_0x78b4('0x14')]('../api/schedule/schedule.model');db[_0x78b4('0x87')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x88'));db[_0x78b4('0x89')]=db[_0x78b4('0x5')][_0x78b4('0x14')]('../api/tag/tag.model');db[_0x78b4('0x8a')]=db['sequelize']['import']('../api/template/template.model');db['Trigger']=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x8b'));db[_0x78b4('0x8c')]=db[_0x78b4('0x5')][_0x78b4('0x14')]('../api/variable/variable.model');db[_0x78b4('0x8d')]=db['sequelize']['import'](_0x78b4('0x8e'));db['IntegrationReport']=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x8f'));db[_0x78b4('0x90')]=db['sequelize'][_0x78b4('0x14')](_0x78b4('0x91'));db[_0x78b4('0x92')]=db[_0x78b4('0x5')]['import'](_0x78b4('0x93'));db[_0x78b4('0x94')]=db[_0x78b4('0x5')]['import'](_0x78b4('0x95'));db[_0x78b4('0x96')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x97'));db['AnalyticFieldReport']=db[_0x78b4('0x5')][_0x78b4('0x14')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x78b4('0x98')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x99'));db['SalesforceAccount']=db['sequelize'][_0x78b4('0x14')](_0x78b4('0x9a'));db[_0x78b4('0x9b')]=db['sequelize'][_0x78b4('0x14')](_0x78b4('0x9c'));db[_0x78b4('0x9d')]=db[_0x78b4('0x5')][_0x78b4('0x14')]('../api/intSalesforceField/intSalesforceField.model');db[_0x78b4('0x9e')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x9f'));db['SugarcrmConfiguration']=db['sequelize']['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x78b4('0xa0')]=db[_0x78b4('0x5')]['import'](_0x78b4('0xa1'));db[_0x78b4('0xa2')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xa3'));db[_0x78b4('0xa4')]=db[_0x78b4('0x5')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x78b4('0xa5')]=db[_0x78b4('0x5')][_0x78b4('0x14')]('../api/intDeskField/intDeskField.model');db[_0x78b4('0xa6')]=db[_0x78b4('0x5')][_0x78b4('0x14')]('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db[_0x78b4('0x5')]['import'](_0x78b4('0xa7'));db[_0x78b4('0xa8')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xa9'));db[_0x78b4('0xaa')]=db['sequelize'][_0x78b4('0x14')](_0x78b4('0xab'));db['ZendeskConfiguration']=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xac'));db[_0x78b4('0xad')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xae'));db[_0x78b4('0xaf')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xb0'));db[_0x78b4('0xb1')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xb2'));db[_0x78b4('0xb3')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xb4'));db[_0x78b4('0xb5')]=db[_0x78b4('0x5')]['import'](_0x78b4('0xb6'));db[_0x78b4('0xb7')]=db['sequelize'][_0x78b4('0x14')](_0x78b4('0xb8'));db['VtigerField']=db[_0x78b4('0x5')]['import']('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xb9'));db[_0x78b4('0xba')]=db[_0x78b4('0x5')]['import'](_0x78b4('0xbb'));db[_0x78b4('0xbc')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xbd'));db[_0x78b4('0xbe')]=db[_0x78b4('0x5')][_0x78b4('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x78b4('0xbf')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xc0'));db[_0x78b4('0xc1')]=db[_0x78b4('0x5')]['import']('../api/intDynamics365Field/intDynamics365Field.model');db[_0x78b4('0xc2')]=db[_0x78b4('0x5')]['import'](_0x78b4('0xc3'));db['FreshsalesConfiguration']=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xc4'));db[_0x78b4('0xc5')]=db[_0x78b4('0x5')][_0x78b4('0x14')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x78b4('0x8d')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x8e'));db[_0x78b4('0xc6')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xc7'));db[_0x78b4('0xc8')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xc9'));db['ChatInternalMessage']=db['sequelize'][_0x78b4('0x14')](_0x78b4('0xca'));db[_0x78b4('0xcb')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xcc'));db[_0x78b4('0xcd')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xce'));db[_0x78b4('0xcf')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xd0'));db['SmsQueueReport']=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xd1'));db[_0x78b4('0xd2')]=db[_0x78b4('0x5')]['import'](_0x78b4('0xd3'));db[_0x78b4('0xd4')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xd5'));db[_0x78b4('0xd6')]=db['sequelize'][_0x78b4('0x14')](_0x78b4('0xd7'));db[_0x78b4('0xd8')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xd9'));db[_0x78b4('0xda')]=db[_0x78b4('0x5')][_0x78b4('0x14')]('../api/squareOdbc/squareOdbc.model');db[_0x78b4('0xdb')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xdc'));db[_0x78b4('0xdd')]=db['sequelize']['import']('../api/squareRecording/squareRecording.model');db[_0x78b4('0xde')]=db['sequelize'][_0x78b4('0x14')](_0x78b4('0xdf'));db['Team']=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xe0'));db[_0x78b4('0xe1')]=db['sequelize'][_0x78b4('0x14')]('../api/license/license.model');db[_0x78b4('0xe2')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xe3'));db[_0x78b4('0xe4')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xe5'));db[_0x78b4('0xe6')]=db['sequelize']['import']('../api/attachment/attachment.model');db['Plugin']=db['sequelize'][_0x78b4('0x14')](_0x78b4('0xe7'));db[_0x78b4('0xe8')]=db['sequelize']['import'](_0x78b4('0xe9'));db['ChatTransferReport']=db[_0x78b4('0x5')][_0x78b4('0x14')]('../api/chatTransferReport/chatTransferReport.model');db[_0x78b4('0xea')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xeb'));db[_0x78b4('0xec')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xed'));db[_0x78b4('0xee')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xef'));db['CmList']=db[_0x78b4('0x5')]['import'](_0x78b4('0xf0'));db[_0x78b4('0xf1')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xf2'));db[_0x78b4('0xf3')]=db[_0x78b4('0x5')][_0x78b4('0x14')]('../api/userProfile/userProfile.model');db[_0x78b4('0xf4')]=db['sequelize'][_0x78b4('0x14')]('../api/userProfileSection/userProfileSection.model');db[_0x78b4('0xf5')]=db[_0x78b4('0x5')]['import'](_0x78b4('0xf6'));db[_0x78b4('0xf7')]=db[_0x78b4('0x5')]['import'](_0x78b4('0xf8'));db[_0x78b4('0xf9')]=db[_0x78b4('0x5')]['import'](_0x78b4('0xfa'));db[_0x78b4('0xfb')]=db['sequelize'][_0x78b4('0x14')](_0x78b4('0xfc'));db[_0x78b4('0xfd')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0xfe'));db[_0x78b4('0xff')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x100'));db[_0x78b4('0x101')]=db[_0x78b4('0x5')][_0x78b4('0x14')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x78b4('0x102')]=db[_0x78b4('0x5')][_0x78b4('0x14')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db['sequelize'][_0x78b4('0x14')]('../api/whatsappQueue/whatsappQueue.model');db[_0x78b4('0x103')]=db[_0x78b4('0x5')][_0x78b4('0x14')](_0x78b4('0x104'));db[_0x78b4('0x105')][_0x78b4('0x106')](db[_0x78b4('0x107')],{'as':_0x78b4('0x107'),'onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x109')});db[_0x78b4('0x105')][_0x78b4('0x10a')](db[_0x78b4('0x1b')],{'as':_0x78b4('0x10b'),'foreignKey':_0x78b4('0x109')});db[_0x78b4('0x105')]['hasMany'](db[_0x78b4('0x10c')],{'as':_0x78b4('0x10d'),'foreignKey':_0x78b4('0x109')});db[_0x78b4('0x105')]['hasMany'](db[_0x78b4('0x17')],{'as':_0x78b4('0x10e'),'onDelete':_0x78b4('0x108'),'hooks':!![]});db[_0x78b4('0x105')][_0x78b4('0x10a')](db[_0x78b4('0x10f')],{'as':_0x78b4('0x110'),'foreignKey':_0x78b4('0x109')});db[_0x78b4('0x105')]['hasMany'](db[_0x78b4('0x74')],{'as':_0x78b4('0x111'),'foreignKey':_0x78b4('0x109')});db[_0x78b4('0x105')]['hasMany'](db[_0x78b4('0x76')],{'as':_0x78b4('0x76'),'foreignKey':'UserId'});db[_0x78b4('0x105')][_0x78b4('0x10a')](db[_0x78b4('0x59')],{'as':'OpenchannelInteractions','foreignKey':_0x78b4('0x109')});db[_0x78b4('0x105')]['hasMany'](db[_0x78b4('0x64')],{'as':'ChatInteractions','foreignKey':_0x78b4('0x109')});db[_0x78b4('0x105')][_0x78b4('0x10a')](db['SmsInteraction'],{'as':_0x78b4('0x112'),'foreignKey':_0x78b4('0x109')});db['User']['hasMany'](db[_0x78b4('0x113')],{'as':_0x78b4('0x114'),'foreignKey':_0x78b4('0x109')});db[_0x78b4('0x105')]['hasMany'](db[_0x78b4('0x3c')],{'as':_0x78b4('0x115'),'foreignKey':_0x78b4('0x109')});db[_0x78b4('0x105')][_0x78b4('0x10a')](db[_0x78b4('0xfd')],{'as':_0x78b4('0x116'),'foreignKey':'UserId'});db['User'][_0x78b4('0x10a')](db[_0x78b4('0xf7')],{'as':_0x78b4('0x117'),'foreignKey':_0x78b4('0x118')});db[_0x78b4('0x105')]['belongsTo'](db[_0x78b4('0xf3')],{'as':_0x78b4('0xf3'),'foreignKey':_0x78b4('0x119')});db[_0x78b4('0x105')][_0x78b4('0x11a')](db[_0x78b4('0x6b')],{'as':_0x78b4('0x11b'),'through':_0x78b4('0x11c')});db[_0x78b4('0x105')][_0x78b4('0x11a')](db['CmContact'],{'as':'Contacts','through':_0x78b4('0x11d')});db[_0x78b4('0x105')][_0x78b4('0x11a')](db['CmList'],{'as':_0x78b4('0x11e'),'through':_0x78b4('0x11f')});db['User'][_0x78b4('0x11a')](db[_0x78b4('0x120')],{'through':_0x78b4('0x121')});db[_0x78b4('0x105')][_0x78b4('0x11a')](db[_0x78b4('0x3c')],{'as':_0x78b4('0x115'),'through':_0x78b4('0x122')});db[_0x78b4('0x105')][_0x78b4('0x11a')](db['ChatInteraction'],{'as':_0x78b4('0x123'),'through':'user_has_chat_interactions'});db['User'][_0x78b4('0x11a')](db[_0x78b4('0x113')],{'as':_0x78b4('0x114'),'through':'user_has_fax_interactions'});db['User'][_0x78b4('0x11a')](db['SmsInteraction'],{'as':_0x78b4('0x112'),'through':_0x78b4('0x124')});db[_0x78b4('0x105')][_0x78b4('0x11a')](db['OpenchannelInteraction'],{'as':_0x78b4('0x125'),'through':_0x78b4('0x126')});db[_0x78b4('0x105')][_0x78b4('0x11a')](db[_0x78b4('0xfd')],{'as':_0x78b4('0x116'),'through':'user_has_whatsapp_interactions'});db[_0x78b4('0x105')][_0x78b4('0x11a')](db['VoiceQueue'],{'as':_0x78b4('0x127'),'through':'UserVoiceQueue','required':![]});db[_0x78b4('0x105')][_0x78b4('0x11a')](db[_0x78b4('0x128')],{'as':_0x78b4('0x129'),'through':'UserMailQueue','required':![]});db['User'][_0x78b4('0x11a')](db['ChatQueue'],{'as':_0x78b4('0x12a'),'through':_0x78b4('0x2d'),'required':![],'hooks':!![]});db[_0x78b4('0x105')][_0x78b4('0x11a')](db['FaxQueue'],{'as':'FaxQueues','through':_0x78b4('0x31'),'required':![]});db[_0x78b4('0x105')][_0x78b4('0x11a')](db[_0x78b4('0x12b')],{'as':_0x78b4('0x12c'),'through':_0x78b4('0x12d'),'required':![]});db[_0x78b4('0x105')]['belongsToMany'](db[_0x78b4('0x5d')],{'as':_0x78b4('0x12e'),'through':_0x78b4('0x33'),'required':![]});db[_0x78b4('0x105')]['belongsToMany'](db[_0x78b4('0x12f')],{'as':_0x78b4('0x130'),'through':_0x78b4('0x35'),'required':![]});db[_0x78b4('0x105')][_0x78b4('0x11a')](db[_0x78b4('0x131')],{'through':'cm_user_has_lists'});db['User'][_0x78b4('0x11a')](db[_0x78b4('0xf1')],{'as':'VoicePrefixes','through':'user_has_voice_prefixes','required':![]});db[_0x78b4('0x105')]['belongsToMany'](db[_0x78b4('0x5f')],{'as':_0x78b4('0x132'),'through':_0x78b4('0x133')});db[_0x78b4('0x105')][_0x78b4('0x11a')](db[_0x78b4('0x134')],{'as':_0x78b4('0x135'),'through':'user_has_fax_accounts'});db[_0x78b4('0x105')][_0x78b4('0x11a')](db[_0x78b4('0x136')],{'as':_0x78b4('0x137'),'through':_0x78b4('0x138')});db['User'][_0x78b4('0x11a')](db[_0x78b4('0x55')],{'as':_0x78b4('0x139'),'through':'user_has_openchannel_accounts'});db[_0x78b4('0x105')][_0x78b4('0x11a')](db[_0x78b4('0x13a')],{'as':_0x78b4('0x13b'),'through':_0x78b4('0x13c')});db[_0x78b4('0x105')][_0x78b4('0x11a')](db[_0x78b4('0xf9')],{'as':_0x78b4('0x13d'),'through':_0x78b4('0x13e')});db['User']['belongsToMany'](db['SquareProject'],{'as':_0x78b4('0x13f'),'through':_0x78b4('0x140')});db[_0x78b4('0x141')][_0x78b4('0x10a')](db[_0x78b4('0x17')],{'as':_0x78b4('0x142'),'onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x143')});db[_0x78b4('0x15')][_0x78b4('0x10a')](db[_0x78b4('0x17')],{'onDelete':_0x78b4('0x108')});db[_0x78b4('0x17')][_0x78b4('0x10a')](db['VoiceExtension'],{'as':_0x78b4('0x144'),'onDelete':_0x78b4('0x108')});db[_0x78b4('0x19')][_0x78b4('0x11a')](db['Sound'],{'as':_0x78b4('0x145'),'through':_0x78b4('0x146')});db[_0x78b4('0x147')][_0x78b4('0x10a')](db[_0x78b4('0x10c')],{'as':'Members','foreignKey':_0x78b4('0x148')});db['VoiceQueue'][_0x78b4('0x10a')](db[_0x78b4('0x149')],{'as':'Hoppers','foreignKey':_0x78b4('0x148')});db[_0x78b4('0x147')][_0x78b4('0x10a')](db['CmHopperFinal'],{'as':_0x78b4('0x110'),'foreignKey':_0x78b4('0x148')});db[_0x78b4('0x147')][_0x78b4('0x10a')](db[_0x78b4('0x74')],{'as':'HopperHistories','foreignKey':_0x78b4('0x148')});db[_0x78b4('0x147')]['hasMany'](db['ReportAgentPreview'],{'as':_0x78b4('0x76'),'foreignKey':_0x78b4('0x148')});db[_0x78b4('0x147')][_0x78b4('0x10a')](db[_0x78b4('0x73')],{'as':_0x78b4('0x14a'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x78b4('0x10a')](db[_0x78b4('0xcf')],{'as':_0x78b4('0x14b'),'foreignKey':'VoiceQueueId'});db[_0x78b4('0x147')][_0x78b4('0x14c')](db['Trunk'],{'as':_0x78b4('0x29'),'foreignKey':_0x78b4('0x14d')});db[_0x78b4('0x147')][_0x78b4('0x14c')](db[_0x78b4('0x29')],{'as':_0x78b4('0x14e'),'foreignKey':_0x78b4('0x14f')});db[_0x78b4('0x147')][_0x78b4('0x14c')](db[_0x78b4('0x81')],{'as':_0x78b4('0x81'),'foreignKey':_0x78b4('0x150')});db[_0x78b4('0x147')][_0x78b4('0x14c')](db[_0x78b4('0x151')],{'as':_0x78b4('0x152'),'foreignKey':_0x78b4('0x153')});db[_0x78b4('0x147')][_0x78b4('0x11a')](db[_0x78b4('0x131')],{'as':_0x78b4('0x11e'),'through':_0x78b4('0x154')});db[_0x78b4('0x147')][_0x78b4('0x11a')](db['User'],{'as':_0x78b4('0x155'),'through':_0x78b4('0x156')});db[_0x78b4('0x147')][_0x78b4('0x11a')](db['Team'],{'as':_0x78b4('0x157'),'through':_0x78b4('0x158')});db[_0x78b4('0x147')]['belongsToMany'](db[_0x78b4('0x131')],{'as':_0x78b4('0x159'),'through':_0x78b4('0x15a')});db[_0x78b4('0x1b')][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'as':_0x78b4('0x105'),'foreignKey':'UserId'});db[_0x78b4('0x1d')]['belongsTo'](db[_0x78b4('0x105')],{'as':_0x78b4('0x105'),'foreignKey':'UserId'});db[_0x78b4('0x107')][_0x78b4('0x10a')](db[_0x78b4('0x20')],{'as':_0x78b4('0x15b'),'onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x15c'),'sourceKey':_0x78b4('0x15d')});db[_0x78b4('0x20')][_0x78b4('0x14c')](db[_0x78b4('0x107')],{'foreignKey':_0x78b4('0x15c'),'targetKey':'mailbox'});db[_0x78b4('0x15e')][_0x78b4('0x10a')](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':_0x78b4('0x15f'),'constraints':![]});db[_0x78b4('0x15e')][_0x78b4('0x10a')](db[_0x78b4('0x160')],{'as':_0x78b4('0x161'),'foreignKey':'uniqueid','constraints':![]});db[_0x78b4('0x15e')][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'as':_0x78b4('0x105'),'foreignKey':_0x78b4('0x109')});db['VoiceCallReport'][_0x78b4('0x14c')](db['CmContact'],{'as':_0x78b4('0x162'),'foreignKey':_0x78b4('0x163')});db['MailServerIn'][_0x78b4('0x14c')](db[_0x78b4('0x136')],{'as':_0x78b4('0x136'),'foreignKey':'MailAccountId'});db[_0x78b4('0x39')][_0x78b4('0x14c')](db[_0x78b4('0x136')],{'as':_0x78b4('0x136'),'foreignKey':_0x78b4('0x164')});db[_0x78b4('0x136')][_0x78b4('0x106')](db['MailServerIn'],{'as':_0x78b4('0x165'),'onDelete':_0x78b4('0x108')});db[_0x78b4('0x136')][_0x78b4('0x106')](db[_0x78b4('0x39')],{'as':_0x78b4('0x166'),'onDelete':_0x78b4('0x108')});db[_0x78b4('0x136')]['hasMany'](db[_0x78b4('0x167')],{'as':_0x78b4('0x168'),'foreignKey':_0x78b4('0x164')});db[_0x78b4('0x136')]['hasMany'](db[_0x78b4('0x169')],{'as':'Answers','foreignKey':_0x78b4('0x164')});db['MailAccount']['hasMany'](db[_0x78b4('0x3e')],{'as':_0x78b4('0x15b'),'foreignKey':_0x78b4('0x164')});db['MailAccount']['hasMany'](db['MailInteraction'],{'as':'Interactions'});db[_0x78b4('0x136')][_0x78b4('0x10a')](db[_0x78b4('0x3f')],{'as':'Applications'});db['MailAccount']['belongsTo'](db[_0x78b4('0x131')],{'as':'List','foreignKey':_0x78b4('0x16a')});db['MailAccount'][_0x78b4('0x14c')](db[_0x78b4('0x8a')],{'as':_0x78b4('0x8a'),'foreignKey':_0x78b4('0x16b')});db[_0x78b4('0x136')]['belongsTo'](db[_0x78b4('0x151')],{'as':_0x78b4('0x152'),'foreignKey':_0x78b4('0x153')});db[_0x78b4('0x136')]['belongsToMany'](db[_0x78b4('0x105')],{'as':_0x78b4('0x155'),'through':_0x78b4('0x138')});db[_0x78b4('0x128')][_0x78b4('0x11a')](db[_0x78b4('0x105')],{'as':_0x78b4('0x155'),'through':_0x78b4('0x2f')});db[_0x78b4('0x128')][_0x78b4('0x11a')](db[_0x78b4('0x120')],{'through':_0x78b4('0x16c'),'as':_0x78b4('0x157')});db[_0x78b4('0x3c')][_0x78b4('0x10a')](db['MailMessage'],{'as':_0x78b4('0x15b'),'onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x16d')});db[_0x78b4('0x3c')]['belongsTo'](db['MailAccount'],{'as':'Account','foreignKey':_0x78b4('0x164')});db['MailInteraction']['belongsTo'](db[_0x78b4('0x70')],{'as':_0x78b4('0x162'),'foreignKey':'ContactId'});db[_0x78b4('0x3c')][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'as':_0x78b4('0x16e'),'foreignKey':_0x78b4('0x109')});db[_0x78b4('0x3c')][_0x78b4('0x11a')](db[_0x78b4('0x89')],{'through':_0x78b4('0x16f'),'as':_0x78b4('0x170')});db[_0x78b4('0x3c')][_0x78b4('0x11a')](db[_0x78b4('0x89')],{'through':_0x78b4('0x16f'),'as':_0x78b4('0x171')});db['MailInteraction']['belongsToMany'](db['User'],{'as':'Users','through':_0x78b4('0x122'),'foreignKey':_0x78b4('0x16d')});db['MailMessage'][_0x78b4('0x10a')](db[_0x78b4('0xe6')],{'as':_0x78b4('0x172'),'onDelete':_0x78b4('0x108')});db[_0x78b4('0x3e')][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'as':_0x78b4('0x105')});db[_0x78b4('0x3e')]['belongsTo'](db['CmContact'],{'onDelete':_0x78b4('0x108'),'as':_0x78b4('0x162')});db['MailMessage'][_0x78b4('0x14c')](db[_0x78b4('0x3c')],{'as':_0x78b4('0x173'),'foreignKey':_0x78b4('0x16d')});db[_0x78b4('0x3e')]['belongsTo'](db[_0x78b4('0x136')],{'as':_0x78b4('0x174'),'foreignKey':_0x78b4('0x164')});db['MailApplication'][_0x78b4('0x14c')](db['User'],{'onDelete':_0x78b4('0x175')});db['MailApplication'][_0x78b4('0x14c')](db[_0x78b4('0x128')],{'onDelete':_0x78b4('0x175')});db['MailApplication']['belongsTo'](db['MailAccount'],{'onDelete':_0x78b4('0x175')});db[_0x78b4('0x3f')][_0x78b4('0x14c')](db[_0x78b4('0x81')],{'onDelete':_0x78b4('0x175'),'foreignKey':_0x78b4('0x150')});db['MailApplication'][_0x78b4('0x14c')](db[_0x78b4('0x89')],{'onDelete':_0x78b4('0x175'),'foreignKey':'TagId'});db['MailQueueReport'][_0x78b4('0x14c')](db[_0x78b4('0x136')],{});db['MailQueueReport'][_0x78b4('0x14c')](db[_0x78b4('0x131')],{'as':'List','foreignKey':'ListId'});db[_0x78b4('0x176')][_0x78b4('0x14c')](db[_0x78b4('0x70')],{'as':_0x78b4('0x162'),'foreignKey':'ContactId'});db[_0x78b4('0x176')]['belongsTo'](db[_0x78b4('0x3c')],{});db[_0x78b4('0x176')][_0x78b4('0x14c')](db[_0x78b4('0x3e')],{});db[_0x78b4('0x176')][_0x78b4('0x14c')](db[_0x78b4('0x105')],{});db[_0x78b4('0x176')][_0x78b4('0x14c')](db['MailQueue'],{});db[_0x78b4('0x177')][_0x78b4('0x10a')](db[_0x78b4('0x43')],{'as':_0x78b4('0x178'),'onDelete':_0x78b4('0x108')});db[_0x78b4('0x134')][_0x78b4('0x10a')](db['Disposition'],{'as':_0x78b4('0x168'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0x78b4('0x10a')](db[_0x78b4('0x169')],{'as':_0x78b4('0x179'),'foreignKey':_0x78b4('0x17a')});db[_0x78b4('0x134')][_0x78b4('0x10a')](db[_0x78b4('0x113')],{'as':_0x78b4('0x17b')});db[_0x78b4('0x134')][_0x78b4('0x10a')](db['FaxApplication'],{'as':_0x78b4('0x144')});db[_0x78b4('0x134')][_0x78b4('0x10a')](db[_0x78b4('0x17')],{'as':_0x78b4('0x17c'),'onDelete':_0x78b4('0x108')});db[_0x78b4('0x134')][_0x78b4('0x10a')](db[_0x78b4('0x49')],{'as':'Messages'});db[_0x78b4('0x134')][_0x78b4('0x14c')](db[_0x78b4('0x29')],{'as':_0x78b4('0x29')});db['FaxAccount'][_0x78b4('0x14c')](db[_0x78b4('0x131')],{'as':_0x78b4('0x17d'),'foreignKey':_0x78b4('0x16a')});db[_0x78b4('0x134')][_0x78b4('0x14c')](db[_0x78b4('0x151')],{'as':_0x78b4('0x152'),'foreignKey':_0x78b4('0x153')});db[_0x78b4('0x134')][_0x78b4('0x11a')](db[_0x78b4('0x105')],{'as':_0x78b4('0x155'),'through':_0x78b4('0x17e')});db[_0x78b4('0x46')]['belongsTo'](db['User'],{'onDelete':'restrict'});db[_0x78b4('0x46')][_0x78b4('0x14c')](db['FaxQueue'],{'onDelete':_0x78b4('0x175')});db['FaxApplication'][_0x78b4('0x14c')](db[_0x78b4('0x134')],{'onDelete':_0x78b4('0x175')});db['FaxApplication']['belongsTo'](db[_0x78b4('0x89')],{'onDelete':_0x78b4('0x175'),'foreignKey':_0x78b4('0x17f')});db['FaxInteraction'][_0x78b4('0x10a')](db[_0x78b4('0x49')],{'as':_0x78b4('0x15b'),'onDelete':'cascade','foreignKey':_0x78b4('0x180')});db[_0x78b4('0x113')][_0x78b4('0x14c')](db[_0x78b4('0x134')],{'as':_0x78b4('0x174'),'foreignKey':'FaxAccountId'});db[_0x78b4('0x113')][_0x78b4('0x14c')](db['CmContact'],{'as':'Contact','foreignKey':_0x78b4('0x163')});db['FaxInteraction'][_0x78b4('0x14c')](db['User'],{'as':_0x78b4('0x16e'),'foreignKey':_0x78b4('0x109')});db[_0x78b4('0x113')][_0x78b4('0x11a')](db[_0x78b4('0x89')],{'through':_0x78b4('0x181'),'as':'Tags'});db[_0x78b4('0x113')][_0x78b4('0x11a')](db['Tag'],{'through':_0x78b4('0x181'),'as':_0x78b4('0x171')});db[_0x78b4('0x113')][_0x78b4('0x11a')](db[_0x78b4('0x105')],{'as':'Users','through':_0x78b4('0x182'),'foreignKey':_0x78b4('0x180')});db[_0x78b4('0x49')][_0x78b4('0x14c')](db['User'],{'onDelete':'cascade','as':_0x78b4('0x105')});db['FaxMessage']['belongsTo'](db[_0x78b4('0x113')],{'as':_0x78b4('0x173'),'foreignKey':_0x78b4('0x180')});db['FaxMessage'][_0x78b4('0x14c')](db[_0x78b4('0x70')],{'onDelete':_0x78b4('0x108'),'as':_0x78b4('0x162')});db['FaxMessage'][_0x78b4('0x14c')](db[_0x78b4('0xe6')],{'as':_0x78b4('0xe6'),'foreignKey':'AttachmentId'});db[_0x78b4('0x49')][_0x78b4('0x14c')](db['FaxAccount'],{'as':_0x78b4('0x174'),'foreignKey':'FaxAccountId'});db['FaxQueue'][_0x78b4('0x11a')](db[_0x78b4('0x105')],{'as':'Agents','through':_0x78b4('0x31')});db[_0x78b4('0x4b')]['belongsToMany'](db[_0x78b4('0x120')],{'through':_0x78b4('0x183'),'as':_0x78b4('0x157')});db[_0x78b4('0x4d')][_0x78b4('0x14c')](db[_0x78b4('0x134')],{});db[_0x78b4('0x4d')][_0x78b4('0x14c')](db[_0x78b4('0x131')],{'as':_0x78b4('0x17d'),'foreignKey':_0x78b4('0x16a')});db[_0x78b4('0x4d')][_0x78b4('0x14c')](db[_0x78b4('0x70')],{'as':_0x78b4('0x162'),'foreignKey':_0x78b4('0x163')});db[_0x78b4('0x4d')][_0x78b4('0x14c')](db[_0x78b4('0x113')],{});db['FaxQueueReport']['belongsTo'](db[_0x78b4('0x49')],{});db[_0x78b4('0x4d')][_0x78b4('0x14c')](db[_0x78b4('0x105')],{});db[_0x78b4('0x4d')][_0x78b4('0x14c')](db['FaxQueue'],{});db[_0x78b4('0x13a')][_0x78b4('0x10a')](db[_0x78b4('0x167')],{'as':_0x78b4('0x168'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x78b4('0x10a')](db[_0x78b4('0x169')],{'as':_0x78b4('0x179'),'foreignKey':_0x78b4('0x184')});db['SmsAccount']['hasMany'](db[_0x78b4('0x52')],{'as':'Messages','foreignKey':_0x78b4('0x184')});db[_0x78b4('0x13a')]['hasMany'](db['SmsInteraction'],{'as':_0x78b4('0x17b')});db['SmsAccount'][_0x78b4('0x10a')](db['SmsApplication'],{'as':_0x78b4('0x144')});db[_0x78b4('0x13a')][_0x78b4('0x14c')](db[_0x78b4('0x131')],{'as':_0x78b4('0x17d'),'foreignKey':_0x78b4('0x16a')});db[_0x78b4('0x13a')][_0x78b4('0x14c')](db[_0x78b4('0x151')],{'as':_0x78b4('0x152'),'foreignKey':_0x78b4('0x153')});db[_0x78b4('0x13a')][_0x78b4('0x11a')](db[_0x78b4('0x105')],{'as':'Agents','through':'user_has_sms_accounts'});db['SmsApplication'][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'onDelete':_0x78b4('0x175')});db['SmsApplication']['belongsTo'](db[_0x78b4('0x12b')],{'onDelete':'restrict'});db[_0x78b4('0x50')][_0x78b4('0x14c')](db['SmsAccount'],{'onDelete':'restrict'});db[_0x78b4('0x50')][_0x78b4('0x14c')](db[_0x78b4('0x81')],{'onDelete':_0x78b4('0x175'),'foreignKey':_0x78b4('0x150')});db[_0x78b4('0x50')][_0x78b4('0x14c')](db[_0x78b4('0x89')],{'onDelete':'restrict','foreignKey':_0x78b4('0x17f')});db['SmsInteraction'][_0x78b4('0x10a')](db[_0x78b4('0x52')],{'as':'Messages','onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x185')});db[_0x78b4('0x186')][_0x78b4('0x14c')](db[_0x78b4('0x13a')],{'as':_0x78b4('0x174'),'foreignKey':'SmsAccountId'});db['SmsInteraction'][_0x78b4('0x14c')](db[_0x78b4('0x70')],{'as':_0x78b4('0x162'),'foreignKey':_0x78b4('0x163')});db[_0x78b4('0x186')][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'as':_0x78b4('0x16e'),'foreignKey':'UserId'});db[_0x78b4('0x186')][_0x78b4('0x11a')](db[_0x78b4('0x89')],{'through':_0x78b4('0x187'),'as':_0x78b4('0x170')});db[_0x78b4('0x186')][_0x78b4('0x11a')](db[_0x78b4('0x89')],{'through':_0x78b4('0x187'),'as':'ThroughTags'});db[_0x78b4('0x186')][_0x78b4('0x11a')](db[_0x78b4('0x105')],{'as':'Users','through':_0x78b4('0x124'),'foreignKey':_0x78b4('0x185')});db[_0x78b4('0x52')][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'as':_0x78b4('0x105')});db[_0x78b4('0x52')][_0x78b4('0x14c')](db['CmContact'],{'onDelete':_0x78b4('0x108'),'as':'Contact'});db['SmsMessage'][_0x78b4('0x14c')](db['SmsInteraction'],{'onDelete':'cascade','as':_0x78b4('0x173'),'foreignKey':_0x78b4('0x185')});db['SmsMessage']['belongsTo'](db[_0x78b4('0x13a')],{'as':_0x78b4('0x174'),'foreignKey':_0x78b4('0x184')});db['SmsQueue'][_0x78b4('0x11a')](db[_0x78b4('0x105')],{'as':_0x78b4('0x155'),'through':_0x78b4('0x12d'),'foreignKey':_0x78b4('0x188')});db[_0x78b4('0x12b')][_0x78b4('0x11a')](db[_0x78b4('0x120')],{'through':_0x78b4('0x189'),'as':_0x78b4('0x157')});db[_0x78b4('0x55')][_0x78b4('0x10a')](db['Disposition'],{'as':_0x78b4('0x168'),'foreignKey':_0x78b4('0x18a')});db[_0x78b4('0x55')][_0x78b4('0x10a')](db['CannedAnswer'],{'as':_0x78b4('0x179'),'foreignKey':_0x78b4('0x18a')});db[_0x78b4('0x55')]['hasMany'](db[_0x78b4('0x59')],{'as':_0x78b4('0x17b'),'foreignKey':_0x78b4('0x18a')});db[_0x78b4('0x55')][_0x78b4('0x10a')](db[_0x78b4('0x5b')],{'as':_0x78b4('0x15b'),'foreignKey':_0x78b4('0x18a')});db[_0x78b4('0x55')][_0x78b4('0x10a')](db['OpenchannelApplication'],{'as':_0x78b4('0x144'),'foreignKey':_0x78b4('0x18a')});db[_0x78b4('0x55')][_0x78b4('0x14c')](db['CmList'],{'as':'List','foreignKey':_0x78b4('0x16a')});db[_0x78b4('0x55')]['belongsTo'](db[_0x78b4('0x151')],{'as':'mandatoryDispositionPause','foreignKey':_0x78b4('0x153')});db[_0x78b4('0x55')]['belongsToMany'](db[_0x78b4('0x105')],{'as':_0x78b4('0x155'),'through':_0x78b4('0x18b')});db[_0x78b4('0x57')]['belongsTo'](db[_0x78b4('0x105')],{'onDelete':_0x78b4('0x175')});db[_0x78b4('0x57')]['belongsTo'](db[_0x78b4('0x5d')],{'onDelete':_0x78b4('0x175'),'foreignKey':'OpenchannelQueueId'});db[_0x78b4('0x57')][_0x78b4('0x14c')](db[_0x78b4('0x55')],{'onDelete':_0x78b4('0x175'),'foreignKey':_0x78b4('0x18a')});db[_0x78b4('0x57')][_0x78b4('0x14c')](db[_0x78b4('0x81')],{'onDelete':_0x78b4('0x175'),'foreignKey':'IntervalId'});db[_0x78b4('0x57')]['belongsTo'](db[_0x78b4('0x89')],{'onDelete':_0x78b4('0x175'),'foreignKey':_0x78b4('0x17f')});db[_0x78b4('0x59')][_0x78b4('0x10a')](db[_0x78b4('0x5b')],{'as':_0x78b4('0x15b'),'onDelete':'cascade','foreignKey':_0x78b4('0x18c')});db[_0x78b4('0x59')]['belongsTo'](db[_0x78b4('0x55')],{'as':'Account','foreignKey':_0x78b4('0x18a')});db[_0x78b4('0x59')][_0x78b4('0x14c')](db['CmContact'],{'as':_0x78b4('0x162'),'foreignKey':'ContactId'});db[_0x78b4('0x59')][_0x78b4('0x14c')](db['User'],{'as':_0x78b4('0x16e'),'foreignKey':_0x78b4('0x109')});db[_0x78b4('0x59')][_0x78b4('0x11a')](db[_0x78b4('0x89')],{'through':_0x78b4('0x18d'),'as':_0x78b4('0x170')});db[_0x78b4('0x59')][_0x78b4('0x11a')](db[_0x78b4('0x89')],{'through':_0x78b4('0x18d'),'as':'ThroughTags'});db[_0x78b4('0x59')]['belongsToMany'](db[_0x78b4('0x105')],{'as':_0x78b4('0x18e'),'through':_0x78b4('0x126'),'foreignKey':_0x78b4('0x18c')});db['OpenchannelMessage'][_0x78b4('0x14c')](db['User'],{'onDelete':'cascade','as':_0x78b4('0x105')});db[_0x78b4('0x5b')]['belongsTo'](db[_0x78b4('0x70')],{'onDelete':_0x78b4('0x108'),'as':_0x78b4('0x162')});db['OpenchannelMessage'][_0x78b4('0x14c')](db[_0x78b4('0x59')],{'onDelete':_0x78b4('0x108'),'as':_0x78b4('0x173'),'foreignKey':_0x78b4('0x18c')});db[_0x78b4('0x5b')][_0x78b4('0x14c')](db['Attachment'],{'as':_0x78b4('0xe6'),'foreignKey':_0x78b4('0x18f')});db[_0x78b4('0x5b')][_0x78b4('0x14c')](db[_0x78b4('0x55')],{'as':_0x78b4('0x174'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue'][_0x78b4('0x11a')](db[_0x78b4('0x105')],{'as':'Agents','through':_0x78b4('0x33'),'foreignKey':'OpenchannelQueueId'});db[_0x78b4('0x5d')][_0x78b4('0x11a')](db[_0x78b4('0x120')],{'through':'team_has_openchannel_queues','as':_0x78b4('0x157')});db[_0x78b4('0x5f')][_0x78b4('0x10a')](db[_0x78b4('0x167')],{'as':_0x78b4('0x168'),'foreignKey':_0x78b4('0x190')});db[_0x78b4('0x5f')]['hasMany'](db[_0x78b4('0x169')],{'as':'Answers','foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x78b4('0x10a')](db[_0x78b4('0x6d')],{'as':'ProactiveActions'});db[_0x78b4('0x5f')][_0x78b4('0x10a')](db[_0x78b4('0x64')],{'as':'Interactions'});db[_0x78b4('0x5f')][_0x78b4('0x10a')](db[_0x78b4('0x62')],{'as':'Applications'});db[_0x78b4('0x5f')][_0x78b4('0x10a')](db['ChatMessage'],{'as':_0x78b4('0x15b')});db[_0x78b4('0x5f')]['belongsTo'](db[_0x78b4('0x131')],{'as':'List','foreignKey':'ListId'});db[_0x78b4('0x5f')][_0x78b4('0x14c')](db[_0x78b4('0x81')],{'as':'Interval','foreignKey':_0x78b4('0x150')});db[_0x78b4('0x5f')][_0x78b4('0x14c')](db['Pause'],{'as':_0x78b4('0x152'),'foreignKey':_0x78b4('0x153')});db[_0x78b4('0x5f')][_0x78b4('0x11a')](db['User'],{'as':'Agents','through':'user_has_chat_websites'});db[_0x78b4('0x60')][_0x78b4('0x14c')](db[_0x78b4('0x55')],{});db[_0x78b4('0x60')][_0x78b4('0x14c')](db['CmList'],{'as':_0x78b4('0x17d'),'foreignKey':'ListId'});db[_0x78b4('0x60')]['belongsTo'](db[_0x78b4('0x70')],{'as':_0x78b4('0x162'),'foreignKey':'ContactId'});db[_0x78b4('0x60')]['belongsTo'](db[_0x78b4('0x59')],{});db[_0x78b4('0x60')][_0x78b4('0x14c')](db[_0x78b4('0x5b')],{});db[_0x78b4('0x60')][_0x78b4('0x14c')](db[_0x78b4('0x105')],{});db['OpenchannelQueueReport'][_0x78b4('0x14c')](db[_0x78b4('0x5d')],{});db[_0x78b4('0x62')][_0x78b4('0x14c')](db['User'],{'as':_0x78b4('0x191'),'foreignKey':'UserId','onDelete':_0x78b4('0x175')});db[_0x78b4('0x62')][_0x78b4('0x14c')](db[_0x78b4('0x69')],{'as':_0x78b4('0x192'),'foreignKey':'ChatQueueId','onDelete':_0x78b4('0x175')});db[_0x78b4('0x62')][_0x78b4('0x14c')](db[_0x78b4('0x5f')],{'as':_0x78b4('0x193'),'foreignKey':_0x78b4('0x190'),'onDelete':_0x78b4('0x175')});db['ChatApplication'][_0x78b4('0x14c')](db[_0x78b4('0x89')],{'onDelete':'restrict','foreignKey':_0x78b4('0x17f')});db[_0x78b4('0x64')][_0x78b4('0x10a')](db[_0x78b4('0x66')],{'as':_0x78b4('0x15b'),'onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x194')});db[_0x78b4('0x64')][_0x78b4('0x14c')](db[_0x78b4('0x5f')],{'as':_0x78b4('0x174'),'foreignKey':_0x78b4('0x190')});db[_0x78b4('0x64')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x78b4('0x163')});db[_0x78b4('0x64')][_0x78b4('0x14c')](db['User'],{'as':_0x78b4('0x16e'),'foreignKey':_0x78b4('0x109')});db['ChatInteraction']['belongsToMany'](db['Tag'],{'through':_0x78b4('0x195'),'as':_0x78b4('0x170')});db[_0x78b4('0x64')]['belongsToMany'](db[_0x78b4('0x89')],{'through':_0x78b4('0x195'),'as':_0x78b4('0x171')});db[_0x78b4('0x64')][_0x78b4('0x11a')](db[_0x78b4('0x105')],{'as':_0x78b4('0x18e'),'through':_0x78b4('0x196'),'foreignKey':_0x78b4('0x194')});db[_0x78b4('0x66')][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'onDelete':'cascade','as':_0x78b4('0x105')});db['ChatMessage'][_0x78b4('0x14c')](db[_0x78b4('0x70')],{'onDelete':_0x78b4('0x108'),'as':_0x78b4('0x162'),'foreignKey':_0x78b4('0x163')});db[_0x78b4('0x66')][_0x78b4('0x14c')](db[_0x78b4('0x64')],{'onDelete':_0x78b4('0x108'),'as':_0x78b4('0x173'),'foreignKey':_0x78b4('0x194')});db[_0x78b4('0x66')]['belongsTo'](db['Attachment'],{'as':_0x78b4('0xe6'),'foreignKey':_0x78b4('0x18f')});db['ChatMessage'][_0x78b4('0x14c')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x78b4('0x190')});db['ChatOfflineMessage']['belongsTo'](db[_0x78b4('0x70')],{'onDelete':'cascade','as':_0x78b4('0x162'),'foreignKey':_0x78b4('0x163')});db[_0x78b4('0x67')][_0x78b4('0x14c')](db['ChatWebsite'],{'as':_0x78b4('0x174'),'foreignKey':'ChatWebsiteId'});db['ChatQueue']['belongsToMany'](db[_0x78b4('0x105')],{'as':_0x78b4('0x155'),'through':_0x78b4('0x2d'),'hooks':!![]});db[_0x78b4('0x69')][_0x78b4('0x11a')](db[_0x78b4('0x120')],{'through':_0x78b4('0x197'),'as':_0x78b4('0x157')});db[_0x78b4('0x6b')]['hasMany'](db['ChatInternalMessage'],{'as':_0x78b4('0x15b'),'foreignKey':_0x78b4('0x198'),'onDelete':'cascade'});db[_0x78b4('0x6b')][_0x78b4('0x11a')](db[_0x78b4('0x105')],{'as':_0x78b4('0x199'),'through':'chat_group_has_users'});db[_0x78b4('0x6d')]['belongsTo'](db['ChatWebsite'],{'as':_0x78b4('0x193'),'foreignKey':_0x78b4('0x190')});db[_0x78b4('0x19a')][_0x78b4('0x10a')](db[_0x78b4('0x70')],{'as':_0x78b4('0x19b'),'foreignKey':_0x78b4('0x19c')});db[_0x78b4('0x70')][_0x78b4('0x10a')](db[_0x78b4('0x149')],{'as':'Hoppers','foreignKey':'ContactId'});db[_0x78b4('0x70')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x78b4('0x163')});db['CmContact'][_0x78b4('0x10a')](db['CmHopperHistory'],{'as':_0x78b4('0x19d'),'foreignKey':_0x78b4('0x163')});db['CmContact']['hasMany'](db[_0x78b4('0x76')],{'as':_0x78b4('0x76'),'foreignKey':'ContactId'});db['CmContact'][_0x78b4('0x10a')](db[_0x78b4('0xcf')],{'as':_0x78b4('0x14b'),'foreignKey':_0x78b4('0x163')});db['CmContact'][_0x78b4('0x10a')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x78b4('0x70')][_0x78b4('0x10a')](db['ChatInteraction'],{'as':_0x78b4('0x123'),'foreignKey':_0x78b4('0x163'),'onDelete':'restrict'});db['CmContact']['hasMany'](db[_0x78b4('0x186')],{'as':_0x78b4('0x112'),'foreignKey':_0x78b4('0x163'),'onDelete':_0x78b4('0x175')});db[_0x78b4('0x70')]['hasMany'](db['FaxInteraction'],{'as':_0x78b4('0x114'),'foreignKey':_0x78b4('0x163'),'onDelete':_0x78b4('0x175')});db[_0x78b4('0x70')][_0x78b4('0x10a')](db['MailInteraction'],{'as':_0x78b4('0x115'),'foreignKey':_0x78b4('0x163'),'onDelete':_0x78b4('0x175')});db['CmContact']['belongsTo'](db['CmCompany'],{'as':'Company','foreignKey':_0x78b4('0x19c')});db[_0x78b4('0x70')][_0x78b4('0x14c')](db[_0x78b4('0x131')],{'as':'List','foreignKey':_0x78b4('0x16a'),'onDelete':_0x78b4('0x108')});db[_0x78b4('0x70')][_0x78b4('0x11a')](db['User'],{'as':_0x78b4('0x18e'),'through':_0x78b4('0x11d')});db[_0x78b4('0x70')][_0x78b4('0x11a')](db['Tag'],{'as':'Tags','through':_0x78b4('0x19e')});db['CmContact'][_0x78b4('0x11a')](db[_0x78b4('0x89')],{'through':'cm_contact_has_tags','as':_0x78b4('0x171')});db[_0x78b4('0x149')][_0x78b4('0x14c')](db['CmContact'],{'as':_0x78b4('0x162'),'foreignKey':_0x78b4('0x163'),'onDelete':_0x78b4('0x108')});db['CmHopper']['belongsTo'](db[_0x78b4('0x131')],{'as':_0x78b4('0x17d'),'foreignKey':_0x78b4('0x16a'),'onDelete':_0x78b4('0x108')});db[_0x78b4('0x149')][_0x78b4('0x14c')](db['User'],{'as':_0x78b4('0x191'),'foreignKey':_0x78b4('0x109')});db[_0x78b4('0x149')]['belongsTo'](db[_0x78b4('0x147')],{'as':_0x78b4('0x192'),'foreignKey':'VoiceQueueId','onDelete':_0x78b4('0x108')});db[_0x78b4('0x149')]['belongsTo'](db[_0x78b4('0xe2')],{'as':_0x78b4('0xe2'),'foreignKey':_0x78b4('0x19f'),'onDelete':_0x78b4('0x108')});db['CmHopper'][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'as':_0x78b4('0x16e'),'foreignKey':_0x78b4('0x1a0')});db[_0x78b4('0x73')][_0x78b4('0x14c')](db[_0x78b4('0x70')],{'as':_0x78b4('0x162'),'foreignKey':_0x78b4('0x163'),'onDelete':_0x78b4('0x108')});db[_0x78b4('0x73')][_0x78b4('0x14c')](db[_0x78b4('0x131')],{'as':_0x78b4('0x17d'),'foreignKey':_0x78b4('0x16a'),'onDelete':_0x78b4('0x108')});db[_0x78b4('0x73')]['belongsTo'](db[_0x78b4('0x147')],{'as':_0x78b4('0x192'),'foreignKey':_0x78b4('0x148'),'onDelete':'cascade'});db[_0x78b4('0x73')][_0x78b4('0x14c')](db['Campaign'],{'as':_0x78b4('0xe2'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0x78b4('0x7c')][_0x78b4('0x10a')](db[_0x78b4('0x1a1')],{'as':{'plural':_0x78b4('0x1a2'),'singular':_0x78b4('0x1a3')},'foreignKey':_0x78b4('0x1a4'),'onDelete':_0x78b4('0x108'),'hooks':!![]});db[_0x78b4('0x7c')][_0x78b4('0x10a')](db[_0x78b4('0x1a1')],{'as':{'plural':'Any','singular':_0x78b4('0x1a5')},'foreignKey':_0x78b4('0x1a6'),'onDelete':_0x78b4('0x108'),'hooks':!![]});db[_0x78b4('0x7c')][_0x78b4('0x10a')](db[_0x78b4('0x7a')],{'as':'Actions','foreignKey':_0x78b4('0x1a7'),'onDelete':_0x78b4('0x108'),'hooks':!![]});db[_0x78b4('0x167')][_0x78b4('0x10a')](db[_0x78b4('0x167')],{'as':_0x78b4('0x168'),'foreignKey':'ParentId','onDelete':_0x78b4('0x108')});db[_0x78b4('0x81')][_0x78b4('0x10a')](db[_0x78b4('0x81')],{'as':_0x78b4('0x1a8'),'foreignKey':_0x78b4('0x150'),'onDelete':_0x78b4('0x108'),'hooks':!![],'required':![]});db['Interval'][_0x78b4('0x10a')](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0x78b4('0x150'),'onDelete':_0x78b4('0x175')});db[_0x78b4('0x81')][_0x78b4('0x10a')](db[_0x78b4('0x3f')],{'as':'MailApplications','foreignKey':_0x78b4('0x150')});db[_0x78b4('0x81')][_0x78b4('0x10a')](db['ChatApplication'],{'as':_0x78b4('0x1a9'),'foreignKey':'IntervalId'});db['Interval'][_0x78b4('0x10a')](db[_0x78b4('0x46')],{'as':_0x78b4('0x1aa'),'foreignKey':'IntervalId'});db[_0x78b4('0x81')][_0x78b4('0x10a')](db[_0x78b4('0x50')],{'as':_0x78b4('0x1ab'),'foreignKey':_0x78b4('0x150')});db['Schedule'][_0x78b4('0x14c')](db['MailAccount'],{});db[_0x78b4('0x86')][_0x78b4('0x14c')](db[_0x78b4('0x92')],{'foreignKey':'DefaultReportId'});db[_0x78b4('0x86')]['belongsTo'](db[_0x78b4('0x90')],{'foreignKey':_0x78b4('0x1ac')});db[_0x78b4('0x87')][_0x78b4('0x11a')](db[_0x78b4('0x19')],{'as':'Mohs','through':'moh_has_sounds','onDelete':'restrict'});db[_0x78b4('0x89')]['belongsToMany'](db[_0x78b4('0x70')],{'through':'cm_contact_has_tags'});db['Tag']['belongsToMany'](db['ChatInteraction'],{'through':_0x78b4('0x195')});db[_0x78b4('0x89')][_0x78b4('0x11a')](db[_0x78b4('0x3c')],{'through':_0x78b4('0x16f')});db[_0x78b4('0x89')][_0x78b4('0x11a')](db[_0x78b4('0x186')],{'through':'sms_interaction_has_tags'});db['Tag'][_0x78b4('0x11a')](db[_0x78b4('0x113')],{'through':_0x78b4('0x181')});db[_0x78b4('0x89')]['belongsToMany'](db[_0x78b4('0x59')],{'through':_0x78b4('0x18d')});db[_0x78b4('0x89')][_0x78b4('0x11a')](db[_0x78b4('0xfd')],{'through':_0x78b4('0x1ad')});db[_0x78b4('0x1ae')]['hasMany'](db[_0x78b4('0x1a1')],{'as':{'plural':_0x78b4('0x1af'),'singular':_0x78b4('0x1b0')},'foreignKey':_0x78b4('0x1b1'),'onDelete':'cascade','hooks':!![]});db[_0x78b4('0x1ae')]['hasMany'](db[_0x78b4('0x1a1')],{'as':{'plural':_0x78b4('0x1b2'),'singular':_0x78b4('0x1b3')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db[_0x78b4('0x1ae')][_0x78b4('0x10a')](db[_0x78b4('0x7a')],{'as':_0x78b4('0x1b4'),'foreignKey':_0x78b4('0x1b5'),'onDelete':_0x78b4('0x108'),'hooks':!![]});db[_0x78b4('0x90')]['hasMany'](db[_0x78b4('0x1b6')],{'as':_0x78b4('0x1b7'),'onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x1ac'),'hooks':!![]});db[_0x78b4('0x92')][_0x78b4('0x10a')](db[_0x78b4('0x1b6')],{'as':_0x78b4('0x1b7'),'onDelete':'cascade','foreignKey':_0x78b4('0x1b8')});db[_0x78b4('0x96')][_0x78b4('0x10a')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':'cascade','foreignKey':'MetricId'});db[_0x78b4('0x1b6')][_0x78b4('0x14c')](db[_0x78b4('0x96')],{'foreignKey':'MetricId'});db[_0x78b4('0x1b9')][_0x78b4('0x10a')](db[_0x78b4('0x9b')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x78b4('0x1ba')});db['SalesforceConfiguration'][_0x78b4('0x10a')](db[_0x78b4('0x9d')],{'as':_0x78b4('0x1bb'),'onDelete':'cascade','foreignKey':_0x78b4('0x1bc')});db[_0x78b4('0x9b')][_0x78b4('0x10a')](db[_0x78b4('0x9d')],{'as':_0x78b4('0x1bd'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x78b4('0x9b')]['hasMany'](db[_0x78b4('0x9d')],{'as':_0x78b4('0x1b7'),'onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x1be')});db[_0x78b4('0x9b')][_0x78b4('0x14c')](db['SalesforceAccount'],{'as':_0x78b4('0x174'),'foreignKey':_0x78b4('0x1ba')});db[_0x78b4('0x9d')][_0x78b4('0x10a')](db[_0x78b4('0x9d')],{'as':'Subject','foreignKey':_0x78b4('0x1bc')});db[_0x78b4('0x9d')][_0x78b4('0x10a')](db[_0x78b4('0x9d')],{'as':'Description','foreignKey':_0x78b4('0x1bf')});db[_0x78b4('0x9d')]['hasMany'](db['SalesforceField'],{'as':_0x78b4('0x1c0'),'foreignKey':_0x78b4('0x1be')});db[_0x78b4('0x9d')]['belongsTo'](db[_0x78b4('0x8c')],{'as':_0x78b4('0x8c'),'foreignKey':_0x78b4('0x1c1')});db[_0x78b4('0x9e')][_0x78b4('0x10a')](db[_0x78b4('0x1c2')],{'as':_0x78b4('0x1c3'),'onDelete':'cascade','foreignKey':_0x78b4('0x1ba')});db[_0x78b4('0x1c2')]['hasMany'](db['SugarcrmField'],{'as':_0x78b4('0x1bb'),'onDelete':'cascade','foreignKey':_0x78b4('0x1bc')});db[_0x78b4('0x1c2')][_0x78b4('0x10a')](db[_0x78b4('0xa0')],{'as':_0x78b4('0x1bd'),'onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x1bf')});db[_0x78b4('0x1c2')][_0x78b4('0x10a')](db['SugarcrmField'],{'as':'Fields','onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x1be')});db[_0x78b4('0x1c2')][_0x78b4('0x14c')](db[_0x78b4('0x9e')],{'as':_0x78b4('0x174'),'foreignKey':_0x78b4('0x1ba')});db[_0x78b4('0xa0')]['hasMany'](db[_0x78b4('0xa0')],{'as':_0x78b4('0x1c4'),'foreignKey':_0x78b4('0x1bc')});db[_0x78b4('0xa0')][_0x78b4('0x10a')](db['SugarcrmField'],{'as':_0x78b4('0x1c5'),'foreignKey':'DescriptionId'});db[_0x78b4('0xa0')][_0x78b4('0x10a')](db['SugarcrmField'],{'as':_0x78b4('0x1c0'),'foreignKey':_0x78b4('0x1be')});db[_0x78b4('0xa0')][_0x78b4('0x14c')](db[_0x78b4('0x8c')],{'as':_0x78b4('0x8c'),'foreignKey':'VariableId'});db['DeskAccount'][_0x78b4('0x10a')](db[_0x78b4('0xa4')],{'as':'Configurations','onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x1ba')});db['DeskConfiguration']['hasMany'](db[_0x78b4('0xa5')],{'as':_0x78b4('0x1bb'),'onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x1bc')});db['DeskConfiguration'][_0x78b4('0x10a')](db['DeskField'],{'as':_0x78b4('0x1bd'),'onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x1bf')});db[_0x78b4('0xa4')][_0x78b4('0x10a')](db['DeskField'],{'as':_0x78b4('0x1b7'),'onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x1be')});db[_0x78b4('0xa4')][_0x78b4('0x14c')](db[_0x78b4('0xa2')],{'as':_0x78b4('0x174'),'foreignKey':_0x78b4('0x1ba')});db['DeskConfiguration'][_0x78b4('0x11a')](db[_0x78b4('0x89')],{'through':_0x78b4('0x1c6')});db[_0x78b4('0xa5')][_0x78b4('0x10a')](db[_0x78b4('0xa5')],{'as':_0x78b4('0x1c4'),'foreignKey':_0x78b4('0x1bc')});db['DeskField'][_0x78b4('0x10a')](db['DeskField'],{'as':_0x78b4('0x1c5'),'foreignKey':_0x78b4('0x1bf')});db['DeskField'][_0x78b4('0x10a')](db[_0x78b4('0xa5')],{'as':_0x78b4('0x1c0'),'foreignKey':_0x78b4('0x1be')});db[_0x78b4('0xa5')][_0x78b4('0x14c')](db[_0x78b4('0x8c')],{'as':_0x78b4('0x8c'),'foreignKey':_0x78b4('0x1c1')});db[_0x78b4('0xa6')]['hasMany'](db[_0x78b4('0x1c7')],{'as':_0x78b4('0x1c3'),'onDelete':_0x78b4('0x108'),'foreignKey':'AccountId'});db[_0x78b4('0x1c7')][_0x78b4('0x10a')](db[_0x78b4('0xa8')],{'as':_0x78b4('0x1bb'),'onDelete':'cascade','foreignKey':_0x78b4('0x1bc')});db[_0x78b4('0x1c7')]['hasMany'](db[_0x78b4('0xa8')],{'as':_0x78b4('0x1bd'),'onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x1bf')});db[_0x78b4('0x1c7')][_0x78b4('0x10a')](db[_0x78b4('0xa8')],{'as':_0x78b4('0x1b7'),'onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x1be')});db[_0x78b4('0x1c7')][_0x78b4('0x14c')](db['ZohoAccount'],{'as':_0x78b4('0x174'),'foreignKey':'AccountId'});db['ZohoField'][_0x78b4('0x10a')](db[_0x78b4('0xa8')],{'as':_0x78b4('0x1c4'),'foreignKey':'SubjectId'});db['ZohoField'][_0x78b4('0x10a')](db['ZohoField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x78b4('0xa8')][_0x78b4('0x10a')](db[_0x78b4('0xa8')],{'as':_0x78b4('0x1c0'),'foreignKey':_0x78b4('0x1be')});db[_0x78b4('0xa8')][_0x78b4('0x14c')](db[_0x78b4('0x8c')],{'as':_0x78b4('0x8c'),'foreignKey':_0x78b4('0x1c1')});db[_0x78b4('0xaa')]['hasMany'](db[_0x78b4('0x1c8')],{'as':_0x78b4('0x1c3'),'onDelete':'cascade','foreignKey':_0x78b4('0x1ba')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0x78b4('0x1bb'),'foreignKey':_0x78b4('0x1bc')});db[_0x78b4('0x1c8')][_0x78b4('0x10a')](db[_0x78b4('0xad')],{'as':_0x78b4('0x1bd'),'foreignKey':_0x78b4('0x1bf')});db[_0x78b4('0x1c8')]['hasMany'](db[_0x78b4('0xad')],{'as':_0x78b4('0x1b7'),'foreignKey':'FieldId'});db[_0x78b4('0x1c8')][_0x78b4('0x14c')](db['ZendeskAccount'],{'as':_0x78b4('0x174'),'foreignKey':_0x78b4('0x1ba')});db['ZendeskConfiguration'][_0x78b4('0x11a')](db['Tag'],{'through':_0x78b4('0x1c9')});db[_0x78b4('0xad')]['hasMany'](db[_0x78b4('0xad')],{'as':_0x78b4('0x1c4'),'foreignKey':_0x78b4('0x1bc')});db[_0x78b4('0xad')]['hasMany'](db[_0x78b4('0xad')],{'as':_0x78b4('0x1c5'),'foreignKey':_0x78b4('0x1bf')});db[_0x78b4('0xad')][_0x78b4('0x10a')](db[_0x78b4('0xad')],{'as':_0x78b4('0x1c0'),'foreignKey':_0x78b4('0x1be')});db[_0x78b4('0xad')][_0x78b4('0x14c')](db['Variable'],{'as':_0x78b4('0x8c'),'foreignKey':_0x78b4('0x1c1')});db[_0x78b4('0xaf')]['hasMany'](db[_0x78b4('0xb1')],{'as':'Configurations','onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x1ba')});db[_0x78b4('0xb1')]['hasMany'](db[_0x78b4('0xb3')],{'as':_0x78b4('0x1bb'),'onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x1bc')});db[_0x78b4('0xb1')]['hasMany'](db[_0x78b4('0xb3')],{'as':_0x78b4('0x1bd'),'onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x1bf')});db[_0x78b4('0xb1')][_0x78b4('0x10a')](db[_0x78b4('0xb3')],{'as':_0x78b4('0x1b7'),'onDelete':_0x78b4('0x108'),'foreignKey':'FieldId'});db[_0x78b4('0xb1')][_0x78b4('0x14c')](db[_0x78b4('0xaf')],{'as':'Account','foreignKey':_0x78b4('0x1ba')});db[_0x78b4('0xb1')]['belongsToMany'](db[_0x78b4('0x89')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x78b4('0xb3')][_0x78b4('0x10a')](db['FreshdeskField'],{'as':_0x78b4('0x1c4'),'foreignKey':_0x78b4('0x1bc')});db[_0x78b4('0xb3')][_0x78b4('0x10a')](db[_0x78b4('0xb3')],{'as':'Description','foreignKey':_0x78b4('0x1bf')});db[_0x78b4('0xb3')]['hasMany'](db['FreshdeskField'],{'as':_0x78b4('0x1c0'),'foreignKey':'FieldId'});db[_0x78b4('0xb3')][_0x78b4('0x14c')](db[_0x78b4('0x8c')],{'as':_0x78b4('0x8c'),'foreignKey':_0x78b4('0x1c1')});db[_0x78b4('0xb5')][_0x78b4('0x10a')](db[_0x78b4('0xb7')],{'as':_0x78b4('0x1c3'),'onDelete':_0x78b4('0x108'),'foreignKey':'AccountId'});db[_0x78b4('0xb7')][_0x78b4('0x10a')](db[_0x78b4('0x1ca')],{'as':_0x78b4('0x1bb'),'foreignKey':_0x78b4('0x1bc')});db['VtigerConfiguration'][_0x78b4('0x10a')](db[_0x78b4('0x1ca')],{'as':'Descriptions','foreignKey':_0x78b4('0x1bf')});db[_0x78b4('0xb7')][_0x78b4('0x10a')](db[_0x78b4('0x1ca')],{'as':_0x78b4('0x1b7'),'foreignKey':'FieldId'});db[_0x78b4('0xb7')][_0x78b4('0x14c')](db[_0x78b4('0xb5')],{'as':_0x78b4('0x174'),'foreignKey':_0x78b4('0x1ba')});db[_0x78b4('0x1ca')]['hasMany'](db[_0x78b4('0x1ca')],{'as':_0x78b4('0x1c4'),'foreignKey':_0x78b4('0x1bc')});db[_0x78b4('0x1ca')][_0x78b4('0x10a')](db[_0x78b4('0x1ca')],{'as':_0x78b4('0x1c5'),'foreignKey':_0x78b4('0x1bf')});db[_0x78b4('0x1ca')][_0x78b4('0x10a')](db['VtigerField'],{'as':_0x78b4('0x1c0'),'foreignKey':_0x78b4('0x1be')});db[_0x78b4('0x1ca')]['belongsTo'](db['Variable'],{'as':_0x78b4('0x8c'),'foreignKey':_0x78b4('0x1c1')});db[_0x78b4('0x1cb')][_0x78b4('0x10a')](db[_0x78b4('0xba')],{'as':_0x78b4('0x1c3'),'onDelete':_0x78b4('0x108'),'foreignKey':'AccountId'});db[_0x78b4('0xba')][_0x78b4('0x10a')](db[_0x78b4('0xbc')],{'as':_0x78b4('0x1bb'),'foreignKey':'SubjectId'});db['ServicenowConfiguration']['hasMany'](db[_0x78b4('0xbc')],{'as':_0x78b4('0x1bd'),'foreignKey':_0x78b4('0x1bf')});db['ServicenowConfiguration']['hasMany'](db[_0x78b4('0xbc')],{'as':_0x78b4('0x1b7'),'foreignKey':_0x78b4('0x1be')});db[_0x78b4('0xba')]['belongsTo'](db['ServicenowAccount'],{'as':'Account','foreignKey':'AccountId'});db['ServicenowField'][_0x78b4('0x10a')](db['ServicenowField'],{'as':'Subject','foreignKey':_0x78b4('0x1bc')});db[_0x78b4('0xbc')][_0x78b4('0x10a')](db[_0x78b4('0xbc')],{'as':_0x78b4('0x1c5'),'foreignKey':'DescriptionId'});db['ServicenowField']['hasMany'](db[_0x78b4('0xbc')],{'as':'Field','foreignKey':_0x78b4('0x1be')});db[_0x78b4('0xbc')][_0x78b4('0x14c')](db[_0x78b4('0x8c')],{'as':'Variable','foreignKey':_0x78b4('0x1c1')});db[_0x78b4('0xbe')][_0x78b4('0x10a')](db[_0x78b4('0xbf')],{'as':'Configurations','onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x1ba')});db[_0x78b4('0xbf')][_0x78b4('0x10a')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x78b4('0x1bc')});db[_0x78b4('0xbf')]['hasMany'](db[_0x78b4('0xc1')],{'as':_0x78b4('0x1bd'),'onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x1bf')});db['Dynamics365Configuration'][_0x78b4('0x10a')](db[_0x78b4('0xc1')],{'as':_0x78b4('0x1b7'),'onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x1be')});db[_0x78b4('0xbf')][_0x78b4('0x14c')](db[_0x78b4('0xbe')],{'as':_0x78b4('0x174'),'foreignKey':_0x78b4('0x1ba')});db['Dynamics365Field']['hasMany'](db[_0x78b4('0xc1')],{'as':'Subject','foreignKey':_0x78b4('0x1bc')});db[_0x78b4('0xc1')][_0x78b4('0x10a')](db[_0x78b4('0xc1')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x78b4('0xc1')]['hasMany'](db[_0x78b4('0xc1')],{'as':'Field','foreignKey':'FieldId'});db[_0x78b4('0xc1')][_0x78b4('0x14c')](db['Variable'],{'as':_0x78b4('0x8c'),'foreignKey':'VariableId'});db[_0x78b4('0xc2')][_0x78b4('0x10a')](db[_0x78b4('0x1cc')],{'as':'Configurations','onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x1ba')});db[_0x78b4('0x1cc')]['hasMany'](db[_0x78b4('0xc5')],{'as':_0x78b4('0x1bb'),'foreignKey':_0x78b4('0x1bc')});db['FreshsalesConfiguration'][_0x78b4('0x10a')](db[_0x78b4('0xc5')],{'as':_0x78b4('0x1bd'),'foreignKey':_0x78b4('0x1bf')});db['FreshsalesConfiguration'][_0x78b4('0x10a')](db[_0x78b4('0xc5')],{'as':_0x78b4('0x1b7'),'foreignKey':_0x78b4('0x1be')});db[_0x78b4('0x1cc')]['belongsTo'](db['FreshsalesAccount'],{'as':_0x78b4('0x174'),'foreignKey':'AccountId'});db['FreshsalesField']['hasMany'](db[_0x78b4('0xc5')],{'as':'Subject','foreignKey':_0x78b4('0x1bc')});db[_0x78b4('0xc5')]['hasMany'](db[_0x78b4('0xc5')],{'as':_0x78b4('0x1c5'),'foreignKey':'DescriptionId'});db[_0x78b4('0xc5')]['hasMany'](db[_0x78b4('0xc5')],{'as':'Field','foreignKey':'FieldId'});db[_0x78b4('0xc5')][_0x78b4('0x14c')](db['Variable'],{'as':_0x78b4('0x8c'),'foreignKey':_0x78b4('0x1c1')});db[_0x78b4('0xc8')][_0x78b4('0x14c')](db[_0x78b4('0x5f')],{});db[_0x78b4('0xc8')][_0x78b4('0x14c')](db[_0x78b4('0x131')],{'as':'List','foreignKey':_0x78b4('0x16a')});db['ChatQueueReport'][_0x78b4('0x14c')](db['CmContact'],{'as':_0x78b4('0x162'),'foreignKey':'ContactId'});db[_0x78b4('0xc8')][_0x78b4('0x14c')](db['ChatInteraction'],{});db[_0x78b4('0xc8')][_0x78b4('0x14c')](db[_0x78b4('0x66')],{});db[_0x78b4('0xc8')][_0x78b4('0x14c')](db['User'],{});db[_0x78b4('0xc8')][_0x78b4('0x14c')](db[_0x78b4('0x69')],{});db[_0x78b4('0x1cd')][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x1ce')});db[_0x78b4('0x1cd')][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x1cf')});db['JscriptySessionReport'][_0x78b4('0x10a')](db['JscriptyQuestionReport'],{'foreignKey':_0x78b4('0x1d0'),'onDelete':'cascade'});db[_0x78b4('0xcf')][_0x78b4('0x10a')](db[_0x78b4('0xcb')],{'foreignKey':_0x78b4('0x1d0'),'onDelete':_0x78b4('0x108')});db['SmsQueueReport'][_0x78b4('0x14c')](db['SmsAccount'],{});db[_0x78b4('0x1d1')][_0x78b4('0x14c')](db[_0x78b4('0x131')],{'as':_0x78b4('0x17d'),'foreignKey':_0x78b4('0x16a')});db[_0x78b4('0x1d1')][_0x78b4('0x14c')](db[_0x78b4('0x70')],{'as':_0x78b4('0x162'),'foreignKey':_0x78b4('0x163')});db[_0x78b4('0x1d1')]['belongsTo'](db['SmsInteraction'],{});db[_0x78b4('0x1d1')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x78b4('0x14c')](db[_0x78b4('0x105')],{});db['SmsQueueReport'][_0x78b4('0x14c')](db[_0x78b4('0x12b')],{});db[_0x78b4('0xd6')][_0x78b4('0x10a')](db[_0x78b4('0xcf')],{'foreignKey':_0x78b4('0x1d2')});db['JscriptyProject']['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x78b4('0x1d2')});db[_0x78b4('0xd6')][_0x78b4('0x10a')](db[_0x78b4('0xcb')],{'foreignKey':_0x78b4('0x1d2')});db[_0x78b4('0xdb')][_0x78b4('0x11a')](db[_0x78b4('0x105')],{'as':_0x78b4('0x18e'),'through':_0x78b4('0x140')});db[_0x78b4('0x120')]['belongsToMany'](db['User'],{'as':_0x78b4('0x155'),'through':_0x78b4('0x121')});db[_0x78b4('0x120')]['belongsToMany'](db[_0x78b4('0x147')],{'through':_0x78b4('0x158'),'as':_0x78b4('0x127')});db[_0x78b4('0x120')]['belongsToMany'](db[_0x78b4('0x128')],{'through':_0x78b4('0x16c'),'as':'MailQueues'});db['Team'][_0x78b4('0x11a')](db[_0x78b4('0x69')],{'through':_0x78b4('0x197'),'as':_0x78b4('0x12a')});db[_0x78b4('0x120')][_0x78b4('0x11a')](db['FaxQueue'],{'through':_0x78b4('0x183'),'as':'FaxQueues'});db['Team'][_0x78b4('0x11a')](db['SmsQueue'],{'through':_0x78b4('0x189'),'as':_0x78b4('0x12c')});db[_0x78b4('0x120')][_0x78b4('0x11a')](db[_0x78b4('0x5d')],{'through':'team_has_openchannel_queues','as':_0x78b4('0x12e')});db[_0x78b4('0x120')][_0x78b4('0x11a')](db[_0x78b4('0x12f')],{'through':_0x78b4('0x1d3'),'as':_0x78b4('0x130')});db[_0x78b4('0xe2')][_0x78b4('0x10a')](db[_0x78b4('0x149')],{'as':_0x78b4('0x1d4'),'foreignKey':'CampaignId'});db[_0x78b4('0xe2')]['hasMany'](db[_0x78b4('0x10f')],{'as':'HopperFinals','foreignKey':_0x78b4('0x19f')});db[_0x78b4('0xe2')][_0x78b4('0x10a')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x78b4('0x19f')});db[_0x78b4('0xe2')]['hasMany'](db[_0x78b4('0x73')],{'as':_0x78b4('0x14a'),'foreignKey':_0x78b4('0x19f')});db['Campaign'][_0x78b4('0x14c')](db[_0x78b4('0x29')],{'as':'Trunk','foreignKey':_0x78b4('0x14d')});db['Campaign'][_0x78b4('0x14c')](db[_0x78b4('0x29')],{'as':_0x78b4('0x14e'),'foreignKey':_0x78b4('0x14f')});db[_0x78b4('0xe2')]['belongsTo'](db[_0x78b4('0x81')],{'as':_0x78b4('0x81'),'foreignKey':_0x78b4('0x150')});db[_0x78b4('0xe2')]['belongsTo'](db[_0x78b4('0xdb')],{'as':_0x78b4('0xdb'),'foreignKey':'SquareProjectId'});db[_0x78b4('0xe2')][_0x78b4('0x11a')](db['CmList'],{'as':'Lists','through':'campaigns_has_cm_lists'});db['Campaign'][_0x78b4('0x11a')](db[_0x78b4('0x131')],{'as':'BlackLists','through':_0x78b4('0x1d5')});db['MailTransferReport'][_0x78b4('0x14c')](db[_0x78b4('0x3e')],{});db[_0x78b4('0xe8')]['belongsTo'](db[_0x78b4('0x3c')],{});db['MailTransferReport'][_0x78b4('0x14c')](db['MailAccount'],{'foreignKey':_0x78b4('0x1d6'),'as':_0x78b4('0x1d7')});db[_0x78b4('0xe8')][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'foreignKey':_0x78b4('0x1d8'),'as':_0x78b4('0x1d9')});db[_0x78b4('0xe8')][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'foreignKey':_0x78b4('0x1da'),'as':_0x78b4('0x1db')});db[_0x78b4('0xe8')][_0x78b4('0x14c')](db[_0x78b4('0x128')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x78b4('0xe8')][_0x78b4('0x14c')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0x78b4('0x1dc')});db[_0x78b4('0x1dd')][_0x78b4('0x14c')](db[_0x78b4('0x66')],{});db['ChatTransferReport']['belongsTo'](db[_0x78b4('0x64')],{});db['ChatTransferReport'][_0x78b4('0x14c')](db[_0x78b4('0x5f')],{'foreignKey':_0x78b4('0x1de'),'as':'FromAccount'});db[_0x78b4('0x1dd')][_0x78b4('0x14c')](db['User'],{'foreignKey':_0x78b4('0x1d8'),'as':_0x78b4('0x1d9')});db[_0x78b4('0x1dd')][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'foreignKey':_0x78b4('0x1da'),'as':_0x78b4('0x1db')});db[_0x78b4('0x1dd')][_0x78b4('0x14c')](db[_0x78b4('0x69')],{'foreignKey':_0x78b4('0x1df'),'as':'ToQueue'});db[_0x78b4('0x1dd')][_0x78b4('0x14c')](db['ChatWebsite'],{'foreignKey':_0x78b4('0x1e0'),'as':_0x78b4('0x1dc')});db[_0x78b4('0xea')][_0x78b4('0x14c')](db[_0x78b4('0x49')],{});db[_0x78b4('0xea')][_0x78b4('0x14c')](db[_0x78b4('0x113')],{});db[_0x78b4('0xea')][_0x78b4('0x14c')](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':_0x78b4('0x1d7')});db['FaxTransferReport'][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'foreignKey':_0x78b4('0x1d8'),'as':_0x78b4('0x1d9')});db[_0x78b4('0xea')][_0x78b4('0x14c')](db['User'],{'foreignKey':_0x78b4('0x1da'),'as':_0x78b4('0x1db')});db[_0x78b4('0xea')][_0x78b4('0x14c')](db[_0x78b4('0x4b')],{'foreignKey':_0x78b4('0x1e1'),'as':_0x78b4('0x1e2')});db[_0x78b4('0xea')][_0x78b4('0x14c')](db[_0x78b4('0x134')],{'foreignKey':_0x78b4('0x1e3'),'as':_0x78b4('0x1dc')});db['OpenchannelTransferReport'][_0x78b4('0x14c')](db[_0x78b4('0x5b')],{});db[_0x78b4('0xec')][_0x78b4('0x14c')](db[_0x78b4('0x59')],{});db[_0x78b4('0xec')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db[_0x78b4('0xec')][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'foreignKey':_0x78b4('0x1d8'),'as':_0x78b4('0x1d9')});db[_0x78b4('0xec')][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x78b4('0xec')][_0x78b4('0x14c')](db[_0x78b4('0x5d')],{'foreignKey':'ToOpenchannelQueueId','as':_0x78b4('0x1e2')});db['OpenchannelTransferReport']['belongsTo'](db[_0x78b4('0x55')],{'foreignKey':'ToOpenchannelAccountId','as':_0x78b4('0x1dc')});db['SmsTransferReport'][_0x78b4('0x14c')](db[_0x78b4('0x52')],{});db['SmsTransferReport'][_0x78b4('0x14c')](db[_0x78b4('0x186')],{});db['SmsTransferReport'][_0x78b4('0x14c')](db['SmsAccount'],{'foreignKey':_0x78b4('0x1e4'),'as':'FromAccount'});db[_0x78b4('0xee')][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'foreignKey':_0x78b4('0x1d8'),'as':_0x78b4('0x1d9')});db[_0x78b4('0xee')][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'foreignKey':_0x78b4('0x1da'),'as':_0x78b4('0x1db')});db[_0x78b4('0xee')][_0x78b4('0x14c')](db[_0x78b4('0x12b')],{'foreignKey':_0x78b4('0x1e5'),'as':'ToQueue'});db[_0x78b4('0xee')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x78b4('0x1e6'),'as':_0x78b4('0x1dc')});db['CmList'][_0x78b4('0x10a')](db[_0x78b4('0x167')],{'as':_0x78b4('0x168'),'foreignKey':_0x78b4('0x16a')});db[_0x78b4('0x131')][_0x78b4('0x10a')](db[_0x78b4('0x78')],{'as':_0x78b4('0x1e7'),'foreignKey':'ListId'});db['CmList'][_0x78b4('0x10a')](db[_0x78b4('0x70')],{'as':_0x78b4('0x19b'),'onDelete':'cascade','foreignKey':_0x78b4('0x16a')});db[_0x78b4('0x131')][_0x78b4('0x10a')](db[_0x78b4('0x10f')],{'as':_0x78b4('0x110'),'foreignKey':_0x78b4('0x16a')});db[_0x78b4('0x131')][_0x78b4('0x10a')](db['CmHopperHistory'],{'as':_0x78b4('0x111'),'foreignKey':_0x78b4('0x16a')});db[_0x78b4('0x131')]['hasMany'](db['ReportAgentPreview'],{'as':_0x78b4('0x76'),'foreignKey':_0x78b4('0x16a')});db[_0x78b4('0x131')]['belongsToMany'](db[_0x78b4('0x147')],{'as':_0x78b4('0x1e8'),'through':_0x78b4('0x154')});db['CmList'][_0x78b4('0x11a')](db[_0x78b4('0x105')],{'as':_0x78b4('0x155'),'through':'cm_user_has_lists'});db[_0x78b4('0xf1')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','onDelete':'cascade'});db['VoicePrefix'][_0x78b4('0x11a')](db['User'],{'as':_0x78b4('0x155'),'through':_0x78b4('0x1e9')});db['UserProfile'][_0x78b4('0x10a')](db[_0x78b4('0x105')],{'as':'Users','foreignKey':'userProfileId'});db[_0x78b4('0xf3')][_0x78b4('0x10a')](db[_0x78b4('0xf4')],{'as':'UserProfileSections','foreignKey':_0x78b4('0x119'),'onDelete':_0x78b4('0x108')});db['UserProfileSection'][_0x78b4('0x10a')](db[_0x78b4('0xf5')],{'as':_0x78b4('0x1ea'),'foreignKey':_0x78b4('0x1eb'),'onDelete':'cascade'});db[_0x78b4('0xf9')][_0x78b4('0x10a')](db[_0x78b4('0x167')],{'as':_0x78b4('0x168'),'foreignKey':_0x78b4('0x1ec')});db[_0x78b4('0xf9')][_0x78b4('0x10a')](db['CannedAnswer'],{'as':_0x78b4('0x179'),'foreignKey':_0x78b4('0x1ec')});db[_0x78b4('0xf9')][_0x78b4('0x10a')](db[_0x78b4('0xff')],{'as':_0x78b4('0x15b'),'foreignKey':_0x78b4('0x1ec')});db[_0x78b4('0xf9')][_0x78b4('0x10a')](db[_0x78b4('0xfd')],{'as':_0x78b4('0x17b')});db[_0x78b4('0xf9')][_0x78b4('0x10a')](db[_0x78b4('0xfb')],{'as':_0x78b4('0x144')});db['WhatsappAccount'][_0x78b4('0x14c')](db[_0x78b4('0x131')],{'as':_0x78b4('0x17d'),'foreignKey':_0x78b4('0x16a')});db[_0x78b4('0xf9')][_0x78b4('0x14c')](db[_0x78b4('0x151')],{'as':_0x78b4('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x78b4('0xf9')][_0x78b4('0x11a')](db[_0x78b4('0x105')],{'as':_0x78b4('0x155'),'through':_0x78b4('0x13e')});db['WhatsappApplication'][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'onDelete':'restrict'});db[_0x78b4('0xfb')][_0x78b4('0x14c')](db[_0x78b4('0x12f')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x78b4('0x14c')](db['WhatsappAccount'],{'onDelete':_0x78b4('0x175')});db[_0x78b4('0xfb')][_0x78b4('0x14c')](db[_0x78b4('0x81')],{'onDelete':_0x78b4('0x175'),'foreignKey':_0x78b4('0x150')});db[_0x78b4('0xfb')][_0x78b4('0x14c')](db[_0x78b4('0x89')],{'onDelete':_0x78b4('0x175'),'foreignKey':_0x78b4('0x17f')});db[_0x78b4('0xfd')][_0x78b4('0x10a')](db[_0x78b4('0xff')],{'as':_0x78b4('0x15b'),'onDelete':_0x78b4('0x108'),'foreignKey':_0x78b4('0x1ed')});db[_0x78b4('0xfd')]['belongsTo'](db[_0x78b4('0xf9')],{'as':_0x78b4('0x174'),'foreignKey':_0x78b4('0x1ec')});db[_0x78b4('0xfd')][_0x78b4('0x14c')](db[_0x78b4('0x70')],{'as':_0x78b4('0x162'),'foreignKey':_0x78b4('0x163')});db['WhatsappInteraction'][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'as':_0x78b4('0x16e'),'foreignKey':_0x78b4('0x109')});db[_0x78b4('0xfd')][_0x78b4('0x11a')](db[_0x78b4('0x89')],{'through':_0x78b4('0x1ad'),'as':_0x78b4('0x170')});db[_0x78b4('0xfd')]['belongsToMany'](db[_0x78b4('0x89')],{'through':_0x78b4('0x1ad'),'as':_0x78b4('0x171')});db[_0x78b4('0xfd')][_0x78b4('0x11a')](db[_0x78b4('0x105')],{'as':_0x78b4('0x18e'),'through':_0x78b4('0x1ee'),'foreignKey':_0x78b4('0x1ed')});db[_0x78b4('0xff')]['belongsTo'](db[_0x78b4('0x105')],{'as':_0x78b4('0x105')});db[_0x78b4('0xff')][_0x78b4('0x14c')](db[_0x78b4('0x70')],{'onDelete':_0x78b4('0x108'),'as':_0x78b4('0x162')});db[_0x78b4('0xff')]['belongsTo'](db['WhatsappInteraction'],{'onDelete':_0x78b4('0x108'),'as':'Interaction','foreignKey':_0x78b4('0x1ed')});db[_0x78b4('0xff')][_0x78b4('0x14c')](db['WhatsappAccount'],{'as':'Account','foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport'][_0x78b4('0x14c')](db[_0x78b4('0xf9')],{});db[_0x78b4('0x101')][_0x78b4('0x14c')](db[_0x78b4('0x131')],{'as':_0x78b4('0x17d'),'foreignKey':_0x78b4('0x16a')});db[_0x78b4('0x101')][_0x78b4('0x14c')](db[_0x78b4('0x70')],{'as':_0x78b4('0x162'),'foreignKey':'ContactId'});db[_0x78b4('0x101')][_0x78b4('0x14c')](db[_0x78b4('0xfd')],{});db['WhatsappQueueReport'][_0x78b4('0x14c')](db[_0x78b4('0x12f')],{});db[_0x78b4('0x101')][_0x78b4('0x14c')](db[_0x78b4('0xff')],{});db['WhatsappQueueReport'][_0x78b4('0x14c')](db[_0x78b4('0x105')],{});db[_0x78b4('0x102')][_0x78b4('0x14c')](db[_0x78b4('0xff')],{});db[_0x78b4('0x102')][_0x78b4('0x14c')](db['WhatsappInteraction'],{});db['WhatsappTransferReport'][_0x78b4('0x14c')](db['WhatsappAccount'],{'foreignKey':_0x78b4('0x1ef'),'as':'FromAccount'});db[_0x78b4('0x102')][_0x78b4('0x14c')](db['WhatsappAccount'],{'foreignKey':'ToWhatsappAccountId','as':'ToAccount'});db[_0x78b4('0x102')][_0x78b4('0x14c')](db[_0x78b4('0x12f')],{'foreignKey':_0x78b4('0x1f0'),'as':_0x78b4('0x1e2')});db[_0x78b4('0x102')][_0x78b4('0x14c')](db[_0x78b4('0x105')],{'foreignKey':_0x78b4('0x1d8'),'as':'FromAgent'});db[_0x78b4('0x102')]['belongsTo'](db[_0x78b4('0x105')],{'foreignKey':_0x78b4('0x1da'),'as':_0x78b4('0x1db')});db['WhatsappQueue']['belongsToMany'](db['User'],{'as':'Agents','through':_0x78b4('0x35'),'foreignKey':_0x78b4('0x1f1')});db[_0x78b4('0x12f')][_0x78b4('0x11a')](db[_0x78b4('0x120')],{'through':_0x78b4('0x1d3'),'as':_0x78b4('0x157')});module[_0x78b4('0x1f2')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 1fa3cf6..80624fb 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeef2=['/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/field_reports','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','/api/mail/reports/transfer','./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/cm/lists','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','./api/notification','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','./api/webbar','/apidoc','root','/www','join','/demo','static','snippet','1.0.16','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','path','express','express-winston','util','./errors','./config/environment','./config/logger','api','auth','default','use','logger','format','method','headers','x-forwarded-for','remoteAddress','url','statusCode','user','role','body','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','responseTime','name','other','agent_id','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication'];(function(_0x5419b2,_0x5aac17){var _0xe018fd=function(_0x502a06){while(--_0x502a06){_0x5419b2['push'](_0x5419b2['shift']());}};_0xe018fd(++_0x5aac17);}(_0xeef2,0xc8));var _0x2eef=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeef2[_0x20a584];return _0x4b41a8;};'use strict';var path=require(_0x2eef('0x0'));var express=require(_0x2eef('0x1'));var ewinston=require(_0x2eef('0x2'));var util=require(_0x2eef('0x3'));var errors=require(_0x2eef('0x4'));var config=require(_0x2eef('0x5'));var logger=require(_0x2eef('0x6'))(_0x2eef('0x7'));var authLogger=require(_0x2eef('0x6'))(_0x2eef('0x8'));exports[_0x2eef('0x9')]=function(_0x21fc0b){_0x21fc0b[_0x2eef('0xa')](ewinston[_0x2eef('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x419837,_0x5b1be1){return util[_0x2eef('0xc')]('%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s',_0x419837[_0x2eef('0xd')],_0x419837[_0x2eef('0xe')][_0x2eef('0xf')]?_0x419837['headers'][_0x2eef('0xf')]:_0x419837['connection'][_0x2eef('0x10')]||_0x419837['ip'],_0x419837[_0x2eef('0x11')],_0x5b1be1[_0x2eef('0x12')],_0x5b1be1['responseTime'],_0x419837['user']?_0x419837[_0x2eef('0x13')]['id']:null,_0x419837[_0x2eef('0x13')]?_0x419837[_0x2eef('0x13')]['name']:null,_0x419837[_0x2eef('0x13')]?_0x419837[_0x2eef('0x13')][_0x2eef('0x14')]:null);}}));_0x21fc0b[_0x2eef('0xa')](ewinston[_0x2eef('0xb')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x444f6e,_0x439dc7){var _0x2507b8='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x444f6e[_0x2eef('0x15')]&&_0x444f6e[_0x2eef('0x15')][_0x2eef('0x16')]&&_0x444f6e[_0x2eef('0x15')]['agent_id']){_0x2507b8=_0x2eef('0x17');}return util[_0x2eef('0xc')](_0x2507b8,_0x444f6e[_0x2eef('0xd')],_0x444f6e[_0x2eef('0xe')][_0x2eef('0xf')]?_0x444f6e['headers'][_0x2eef('0xf')]:_0x444f6e[_0x2eef('0x18')]['remoteAddress']||_0x444f6e['ip'],_0x444f6e[_0x2eef('0x11')],_0x439dc7[_0x2eef('0x12')],_0x439dc7[_0x2eef('0x19')],_0x444f6e['user']?_0x444f6e[_0x2eef('0x13')]['id']:null,_0x444f6e[_0x2eef('0x13')]?_0x444f6e['user'][_0x2eef('0x1a')]:null,_0x444f6e[_0x2eef('0x13')]?_0x444f6e[_0x2eef('0x13')]['role']:null,_0x444f6e['body']&&_0x444f6e[_0x2eef('0x15')][_0x2eef('0x16')]?_0x444f6e['body'][_0x2eef('0x16')]:_0x2eef('0x1b'),_0x444f6e[_0x2eef('0x15')]&&_0x444f6e['body'][_0x2eef('0x1c')]?_0x444f6e[_0x2eef('0x15')][_0x2eef('0x1c')]:'',_0x444f6e[_0x2eef('0x15')]&&_0x444f6e[_0x2eef('0x15')][_0x2eef('0x1d')]?_0x444f6e[_0x2eef('0x15')]['agent_name']:'');},'ignoreRoute':function(_0x2e82e8){var _0x4d0e71=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4d0e71[_0x2eef('0x1e')](_0x2e82e8[_0x2eef('0x11')]);}}));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x1f'),require(_0x2eef('0x20')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x21'),require(_0x2eef('0x22')));_0x21fc0b['use']('/api/voice/contexts',require('./api/voiceContext'));_0x21fc0b['use']('/api/voice/extensions',require('./api/voiceExtension'));_0x21fc0b[_0x2eef('0xa')]('/api/voice/mohs',require(_0x2eef('0x23')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x24'),require(_0x2eef('0x25')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x26'),require(_0x2eef('0x27')));_0x21fc0b['use'](_0x2eef('0x28'),require(_0x2eef('0x29')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x2a'),require('./api/voiceMail'));_0x21fc0b[_0x2eef('0xa')]('/api/voice/mails/messages',require(_0x2eef('0x2b')));_0x21fc0b['use'](_0x2eef('0x2c'),require(_0x2eef('0x2d')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x2e'),require('./api/voiceDialReport'));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x2f'),require(_0x2eef('0x30')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x31'),require(_0x2eef('0x32')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x33'),require(_0x2eef('0x34')));_0x21fc0b['use']('/api/trunks',require(_0x2eef('0x35')));_0x21fc0b[_0x2eef('0xa')]('/api/voice/transfers/reports',require(_0x2eef('0x36')));_0x21fc0b['use'](_0x2eef('0x37'),require(_0x2eef('0x38')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x39'),require(_0x2eef('0x3a')));_0x21fc0b['use'](_0x2eef('0x3b'),require(_0x2eef('0x3c')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x3d'),require(_0x2eef('0x3e')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x3f'),require(_0x2eef('0x40')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x41'),require(_0x2eef('0x42')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x43'),require(_0x2eef('0x44')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x45'),require(_0x2eef('0x46')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x47'),require(_0x2eef('0x48')));_0x21fc0b[_0x2eef('0xa')]('/api/dashboards/items',require(_0x2eef('0x49')));_0x21fc0b[_0x2eef('0xa')]('/api/fax/accounts',require('./api/faxAccount'));_0x21fc0b['use'](_0x2eef('0x4a'),require(_0x2eef('0x4b')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x4c'),require('./api/faxInteraction'));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x4d'),require('./api/faxMessage'));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x4e'),require(_0x2eef('0x4f')));_0x21fc0b['use'](_0x2eef('0x50'),require('./api/faxQueueReport'));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x51'),require('./api/smsAccount'));_0x21fc0b[_0x2eef('0xa')]('/api/sms/applications',require(_0x2eef('0x52')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x53'),require('./api/smsInteraction'));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x54'),require(_0x2eef('0x55')));_0x21fc0b['use'](_0x2eef('0x56'),require(_0x2eef('0x57')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x58'),require('./api/openchannelAccount'));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x59'),require(_0x2eef('0x5a')));_0x21fc0b['use'](_0x2eef('0x5b'),require(_0x2eef('0x5c')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x5d'),require('./api/openchannelMessage'));_0x21fc0b['use']('/api/openchannel/queues',require(_0x2eef('0x5e')));_0x21fc0b['use'](_0x2eef('0x5f'),require(_0x2eef('0x60')));_0x21fc0b[_0x2eef('0xa')]('/api/openchannel/reports/queue',require(_0x2eef('0x61')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x62'),require(_0x2eef('0x63')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x64'),require(_0x2eef('0x65')));_0x21fc0b['use'](_0x2eef('0x66'),require(_0x2eef('0x67')));_0x21fc0b['use']('/api/chat/offline_messages',require(_0x2eef('0x68')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x69'),require(_0x2eef('0x6a')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x6b'),require('./api/chatGroup'));_0x21fc0b[_0x2eef('0xa')]('/api/chat/proactive_actions',require(_0x2eef('0x6c')));_0x21fc0b[_0x2eef('0xa')]('/api/cm/companies',require(_0x2eef('0x6d')));_0x21fc0b['use'](_0x2eef('0x6e'),require(_0x2eef('0x6f')));_0x21fc0b['use'](_0x2eef('0x70'),require(_0x2eef('0x71')));_0x21fc0b[_0x2eef('0xa')]('/api/cm/hopper_black',require(_0x2eef('0x72')));_0x21fc0b[_0x2eef('0xa')]('/api/cm/hopper_final',require(_0x2eef('0x73')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x74'),require(_0x2eef('0x75')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x76'),require(_0x2eef('0x77')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x78'),require(_0x2eef('0x79')));_0x21fc0b[_0x2eef('0xa')]('/api/automations',require(_0x2eef('0x7a')));_0x21fc0b['use']('/api/canned_answers',require(_0x2eef('0x7b')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x7c'),require('./api/disposition'));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x7d'),require(_0x2eef('0x7e')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x7f'),require(_0x2eef('0x80')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x81'),require(_0x2eef('0x82')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x83'),require(_0x2eef('0x84')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x85'),require(_0x2eef('0x86')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x87'),require(_0x2eef('0x88')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x89'),require(_0x2eef('0x8a')));_0x21fc0b['use'](_0x2eef('0x8b'),require('./api/tag'));_0x21fc0b['use'](_0x2eef('0x8c'),require(_0x2eef('0x8d')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x8e'),require(_0x2eef('0x8f')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x90'),require(_0x2eef('0x91')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x92'),require('./api/integration'));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x93'),require(_0x2eef('0x94')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x95'),require(_0x2eef('0x96')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x97'),require('./api/analyticDefaultReport'));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x98'),require(_0x2eef('0x99')));_0x21fc0b[_0x2eef('0xa')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x21fc0b['use'](_0x2eef('0x9a'),require('./api/analyticFieldReport'));_0x21fc0b[_0x2eef('0xa')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x21fc0b['use']('/api/integrations/salesforce/accounts',require(_0x2eef('0x9b')));_0x21fc0b[_0x2eef('0xa')]('/api/integrations/salesforce/configurations',require(_0x2eef('0x9c')));_0x21fc0b['use'](_0x2eef('0x9d'),require('./api/intSalesforceField'));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x9e'),require('./api/intSugarcrmAccount'));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x9f'),require(_0x2eef('0xa0')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xa1'),require(_0x2eef('0xa2')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xa3'),require(_0x2eef('0xa4')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xa5'),require(_0x2eef('0xa6')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xa7'),require(_0x2eef('0xa8')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xa9'),require(_0x2eef('0xaa')));_0x21fc0b['use'](_0x2eef('0xab'),require(_0x2eef('0xac')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xad'),require(_0x2eef('0xae')));_0x21fc0b['use'](_0x2eef('0xaf'),require(_0x2eef('0xb0')));_0x21fc0b[_0x2eef('0xa')]('/api/integrations/zendesk/configurations',require(_0x2eef('0xb1')));_0x21fc0b['use']('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x21fc0b[_0x2eef('0xa')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xb2'),require('./api/intFreshdeskConfiguration'));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xb3'),require(_0x2eef('0xb4')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xb5'),require(_0x2eef('0xb6')));_0x21fc0b[_0x2eef('0xa')]('/api/integrations/vtiger/configurations',require(_0x2eef('0xb7')));_0x21fc0b['use']('/api/integrations/vtiger/fields',require(_0x2eef('0xb8')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xb9'),require(_0x2eef('0xba')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xbb'),require(_0x2eef('0xbc')));_0x21fc0b['use'](_0x2eef('0xbd'),require(_0x2eef('0xbe')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xbf'),require(_0x2eef('0xc0')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xc1'),require(_0x2eef('0xc2')));_0x21fc0b[_0x2eef('0xa')]('/api/integrations/dynamics365/fields',require(_0x2eef('0xc3')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xc4'),require(_0x2eef('0xc5')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xc6'),require('./api/intFreshsalesConfiguration'));_0x21fc0b[_0x2eef('0xa')]('/api/integrations/freshsales/fields',require(_0x2eef('0xc7')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xc8'),require(_0x2eef('0xc9')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xca'),require('./api/chatQueueReport'));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xcb'),require(_0x2eef('0xcc')));_0x21fc0b['use'](_0x2eef('0xcd'),require('./api/jscriptyAnswerReport'));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xce'),require(_0x2eef('0xcf')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xd0'),require(_0x2eef('0xd1')));_0x21fc0b[_0x2eef('0xa')]('/api/sms/reports/queue',require(_0x2eef('0xd2')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xd3'),require('./api/squareReport'));_0x21fc0b[_0x2eef('0xa')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x21fc0b['use'](_0x2eef('0xd4'),require('./api/jscriptyProject'));_0x21fc0b['use'](_0x2eef('0xd5'),require(_0x2eef('0xd6')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xd7'),require(_0x2eef('0xd8')));_0x21fc0b['use'](_0x2eef('0xd9'),require(_0x2eef('0xda')));_0x21fc0b['use'](_0x2eef('0xdb'),require(_0x2eef('0xdc')));_0x21fc0b[_0x2eef('0xa')]('/api/square/messages',require(_0x2eef('0xdd')));_0x21fc0b['use'](_0x2eef('0xde'),require(_0x2eef('0xdf')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xe0'),require(_0x2eef('0xe1')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xe2'),require(_0x2eef('0xe3')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xe4'),require(_0x2eef('0xe5')));_0x21fc0b[_0x2eef('0xa')]('/api/attachments',require(_0x2eef('0xe6')));_0x21fc0b['use'](_0x2eef('0xe7'),require('./api/plugin'));_0x21fc0b['use'](_0x2eef('0xe8'),require(_0x2eef('0xe9')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xea'),require(_0x2eef('0xeb')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xec'),require(_0x2eef('0xed')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xee'),require(_0x2eef('0xef')));_0x21fc0b['use'](_0x2eef('0xf0'),require(_0x2eef('0xf1')));_0x21fc0b['use'](_0x2eef('0xf2'),require('./api/cmList'));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xf3'),require('./api/voicePrefix'));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xf4'),require(_0x2eef('0xf5')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xf6'),require(_0x2eef('0xf7')));_0x21fc0b['use']('/api/userProfile/resources',require(_0x2eef('0xf8')));_0x21fc0b[_0x2eef('0xa')]('/api/notifications',require(_0x2eef('0xf9')));_0x21fc0b[_0x2eef('0xa')]('/api/whatsapp/accounts',require(_0x2eef('0xfa')));_0x21fc0b['use'](_0x2eef('0xfb'),require('./api/whatsappApplication'));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xfc'),require(_0x2eef('0xfd')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xfe'),require('./api/whatsappMessage'));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0xff'),require(_0x2eef('0x100')));_0x21fc0b[_0x2eef('0xa')]('/api/whatsapp/reports/transfer',require(_0x2eef('0x101')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x102'),require(_0x2eef('0x103')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x104'),require(_0x2eef('0x105')));_0x21fc0b['use'](_0x2eef('0x106'),require(_0x2eef('0x107')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x108'),require(_0x2eef('0x109')));_0x21fc0b[_0x2eef('0xa')]('/api/jira',require(_0x2eef('0x10a')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x10b'),require(_0x2eef('0x10c')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x10d'),require(_0x2eef('0x10e')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x10f'),require('./api/system'));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x110'),require(_0x2eef('0x111')));_0x21fc0b[_0x2eef('0xa')]('/api/webbar',require(_0x2eef('0x112')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x113'),express['static'](path['join'](config[_0x2eef('0x114')],_0x2eef('0x113'))));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x115'),express['static'](path[_0x2eef('0x116')](config[_0x2eef('0x114')],'/www')));_0x21fc0b[_0x2eef('0xa')](_0x2eef('0x117'),express[_0x2eef('0x118')](path[_0x2eef('0x116')](config[_0x2eef('0x114')],'/demo')));_0x21fc0b[_0x2eef('0xa')]('/snippet',express['static'](path[_0x2eef('0x116')](config[_0x2eef('0x114')],_0x2eef('0x119'),_0x2eef('0x11a'))));_0x21fc0b['use'](_0x2eef('0x11b'),express['static'](path[_0x2eef('0x116')](config['root'],_0x2eef('0x11c'))));_0x21fc0b[_0x2eef('0x11d')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x2eef('0x11e')](errors[0x194]);_0x21fc0b['route']('/*')[_0x2eef('0x11e')](function(_0x177135,_0x2a25da){_0x2a25da[_0x2eef('0x11f')](path[_0x2eef('0x120')](_0x21fc0b[_0x2eef('0x11e')](_0x2eef('0x121'))+_0x2eef('0x122')));});}; \ No newline at end of file +var _0x06b1=['/api/integrations/zoho/accounts','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/settings','./api/setting','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/migration','/api/attachments','./api/attachment','./api/plugin','./api/mailTransferReport','./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/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/jira','/api/rpc','/api/version','/api/system','/api/pm2','./api/pm2','./api/webbar','/apidoc','static','join','root','/www','/demo','snippet','1.0.16','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','path','express','util','./errors','./config/logger','auth','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','agent_id','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','/api/voice/queues','/api/voice/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./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/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','/api/triggers','./api/variable','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField'];(function(_0x5dac79,_0xf8f250){var _0x1b3600=function(_0x389d7b){while(--_0x389d7b){_0x5dac79['push'](_0x5dac79['shift']());}};_0x1b3600(++_0xf8f250);}(_0x06b1,0x178));var _0x106b=function(_0x117765,_0x13a512){_0x117765=_0x117765-0x0;var _0x367809=_0x06b1[_0x117765];return _0x367809;};'use strict';var path=require(_0x106b('0x0'));var express=require(_0x106b('0x1'));var ewinston=require('express-winston');var util=require(_0x106b('0x2'));var errors=require(_0x106b('0x3'));var config=require('./config/environment');var logger=require(_0x106b('0x4'))('api');var authLogger=require('./config/logger')(_0x106b('0x5'));exports[_0x106b('0x6')]=function(_0x35086a){_0x35086a[_0x106b('0x7')](ewinston[_0x106b('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x58ebc2,_0x285f6e){return util[_0x106b('0x9')](_0x106b('0xa'),_0x58ebc2[_0x106b('0xb')],_0x58ebc2[_0x106b('0xc')][_0x106b('0xd')]?_0x58ebc2[_0x106b('0xc')][_0x106b('0xd')]:_0x58ebc2[_0x106b('0xe')][_0x106b('0xf')]||_0x58ebc2['ip'],_0x58ebc2[_0x106b('0x10')],_0x285f6e[_0x106b('0x11')],_0x285f6e[_0x106b('0x12')],_0x58ebc2['user']?_0x58ebc2[_0x106b('0x13')]['id']:null,_0x58ebc2[_0x106b('0x13')]?_0x58ebc2['user'][_0x106b('0x14')]:null,_0x58ebc2[_0x106b('0x13')]?_0x58ebc2[_0x106b('0x13')][_0x106b('0x15')]:null);}}));_0x35086a['use'](ewinston[_0x106b('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x540e3e,_0x96c267){var _0x2f0fd2=_0x106b('0x16');if(_0x540e3e[_0x106b('0x17')]&&_0x540e3e[_0x106b('0x17')][_0x106b('0x18')]&&_0x540e3e[_0x106b('0x17')][_0x106b('0x19')]){_0x2f0fd2='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x106b('0x9')](_0x2f0fd2,_0x540e3e[_0x106b('0xb')],_0x540e3e[_0x106b('0xc')][_0x106b('0xd')]?_0x540e3e['headers'][_0x106b('0xd')]:_0x540e3e['connection'][_0x106b('0xf')]||_0x540e3e['ip'],_0x540e3e[_0x106b('0x10')],_0x96c267[_0x106b('0x11')],_0x96c267[_0x106b('0x12')],_0x540e3e[_0x106b('0x13')]?_0x540e3e['user']['id']:null,_0x540e3e['user']?_0x540e3e[_0x106b('0x13')][_0x106b('0x14')]:null,_0x540e3e[_0x106b('0x13')]?_0x540e3e[_0x106b('0x13')][_0x106b('0x15')]:null,_0x540e3e[_0x106b('0x17')]&&_0x540e3e[_0x106b('0x17')]['device']?_0x540e3e[_0x106b('0x17')]['device']:_0x106b('0x1a'),_0x540e3e['body']&&_0x540e3e[_0x106b('0x17')][_0x106b('0x19')]?_0x540e3e[_0x106b('0x17')][_0x106b('0x19')]:'',_0x540e3e[_0x106b('0x17')]&&_0x540e3e['body'][_0x106b('0x1b')]?_0x540e3e[_0x106b('0x17')]['agent_name']:'');},'ignoreRoute':function(_0x46ec69){var _0x21d23f=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x21d23f[_0x106b('0x1c')](_0x46ec69['url']);}}));_0x35086a[_0x106b('0x7')](_0x106b('0x1d'),require(_0x106b('0x1e')));_0x35086a['use'](_0x106b('0x1f'),require(_0x106b('0x20')));_0x35086a['use'](_0x106b('0x21'),require(_0x106b('0x22')));_0x35086a[_0x106b('0x7')](_0x106b('0x23'),require('./api/voiceExtension'));_0x35086a[_0x106b('0x7')](_0x106b('0x24'),require('./api/voiceMusicOnHold'));_0x35086a[_0x106b('0x7')](_0x106b('0x25'),require('./api/voiceQueue'));_0x35086a[_0x106b('0x7')](_0x106b('0x26'),require('./api/voiceRecording'));_0x35086a[_0x106b('0x7')]('/api/screen/recordings',require(_0x106b('0x27')));_0x35086a['use'](_0x106b('0x28'),require('./api/voiceMail'));_0x35086a[_0x106b('0x7')](_0x106b('0x29'),require('./api/voiceMailMessage'));_0x35086a[_0x106b('0x7')](_0x106b('0x2a'),require(_0x106b('0x2b')));_0x35086a[_0x106b('0x7')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x35086a[_0x106b('0x7')](_0x106b('0x2c'),require(_0x106b('0x2d')));_0x35086a[_0x106b('0x7')]('/api/voice/queues/reports',require(_0x106b('0x2e')));_0x35086a[_0x106b('0x7')](_0x106b('0x2f'),require(_0x106b('0x30')));_0x35086a[_0x106b('0x7')](_0x106b('0x31'),require(_0x106b('0x32')));_0x35086a[_0x106b('0x7')](_0x106b('0x33'),require(_0x106b('0x34')));_0x35086a[_0x106b('0x7')](_0x106b('0x35'),require(_0x106b('0x36')));_0x35086a[_0x106b('0x7')](_0x106b('0x37'),require('./api/mailAccount'));_0x35086a[_0x106b('0x7')]('/api/mail/queues',require(_0x106b('0x38')));_0x35086a[_0x106b('0x7')](_0x106b('0x39'),require(_0x106b('0x3a')));_0x35086a[_0x106b('0x7')](_0x106b('0x3b'),require(_0x106b('0x3c')));_0x35086a['use'](_0x106b('0x3d'),require(_0x106b('0x3e')));_0x35086a[_0x106b('0x7')](_0x106b('0x3f'),require('./api/mailApplication'));_0x35086a[_0x106b('0x7')](_0x106b('0x40'),require(_0x106b('0x41')));_0x35086a[_0x106b('0x7')](_0x106b('0x42'),require('./api/dashboard'));_0x35086a[_0x106b('0x7')](_0x106b('0x43'),require('./api/dashboardItem'));_0x35086a[_0x106b('0x7')](_0x106b('0x44'),require(_0x106b('0x45')));_0x35086a[_0x106b('0x7')]('/api/fax/applications',require(_0x106b('0x46')));_0x35086a['use'](_0x106b('0x47'),require(_0x106b('0x48')));_0x35086a[_0x106b('0x7')]('/api/fax/messages',require(_0x106b('0x49')));_0x35086a[_0x106b('0x7')](_0x106b('0x4a'),require(_0x106b('0x4b')));_0x35086a[_0x106b('0x7')]('/api/fax/reports/queue',require(_0x106b('0x4c')));_0x35086a[_0x106b('0x7')](_0x106b('0x4d'),require(_0x106b('0x4e')));_0x35086a['use'](_0x106b('0x4f'),require(_0x106b('0x50')));_0x35086a['use'](_0x106b('0x51'),require('./api/smsInteraction'));_0x35086a[_0x106b('0x7')]('/api/sms/messages',require(_0x106b('0x52')));_0x35086a[_0x106b('0x7')](_0x106b('0x53'),require(_0x106b('0x54')));_0x35086a[_0x106b('0x7')]('/api/openchannel/accounts',require(_0x106b('0x55')));_0x35086a[_0x106b('0x7')]('/api/openchannel/applications',require(_0x106b('0x56')));_0x35086a[_0x106b('0x7')]('/api/openchannel/interactions',require(_0x106b('0x57')));_0x35086a[_0x106b('0x7')](_0x106b('0x58'),require(_0x106b('0x59')));_0x35086a[_0x106b('0x7')](_0x106b('0x5a'),require('./api/openchannelQueue'));_0x35086a[_0x106b('0x7')](_0x106b('0x5b'),require('./api/chatWebsite'));_0x35086a[_0x106b('0x7')](_0x106b('0x5c'),require(_0x106b('0x5d')));_0x35086a['use'](_0x106b('0x5e'),require(_0x106b('0x5f')));_0x35086a[_0x106b('0x7')](_0x106b('0x60'),require('./api/chatInteraction'));_0x35086a['use'](_0x106b('0x61'),require(_0x106b('0x62')));_0x35086a[_0x106b('0x7')](_0x106b('0x63'),require(_0x106b('0x64')));_0x35086a[_0x106b('0x7')]('/api/chat/queues',require(_0x106b('0x65')));_0x35086a[_0x106b('0x7')](_0x106b('0x66'),require(_0x106b('0x67')));_0x35086a[_0x106b('0x7')](_0x106b('0x68'),require('./api/chatProactiveAction'));_0x35086a[_0x106b('0x7')](_0x106b('0x69'),require(_0x106b('0x6a')));_0x35086a[_0x106b('0x7')](_0x106b('0x6b'),require(_0x106b('0x6c')));_0x35086a[_0x106b('0x7')]('/api/cm/hopper',require(_0x106b('0x6d')));_0x35086a[_0x106b('0x7')](_0x106b('0x6e'),require(_0x106b('0x6f')));_0x35086a['use'](_0x106b('0x70'),require(_0x106b('0x71')));_0x35086a[_0x106b('0x7')](_0x106b('0x72'),require(_0x106b('0x73')));_0x35086a['use'](_0x106b('0x74'),require(_0x106b('0x75')));_0x35086a['use']('/api/actions',require(_0x106b('0x76')));_0x35086a['use']('/api/automations',require(_0x106b('0x77')));_0x35086a[_0x106b('0x7')]('/api/canned_answers',require(_0x106b('0x78')));_0x35086a[_0x106b('0x7')](_0x106b('0x79'),require(_0x106b('0x7a')));_0x35086a[_0x106b('0x7')]('/api/conditions',require(_0x106b('0x7b')));_0x35086a[_0x106b('0x7')](_0x106b('0x7c'),require(_0x106b('0x7d')));_0x35086a[_0x106b('0x7')](_0x106b('0x7e'),require(_0x106b('0x7f')));_0x35086a[_0x106b('0x7')](_0x106b('0x80'),require(_0x106b('0x81')));_0x35086a[_0x106b('0x7')](_0x106b('0x82'),require('./api/voiceQueuesLog'));_0x35086a[_0x106b('0x7')](_0x106b('0x83'),require(_0x106b('0x84')));_0x35086a[_0x106b('0x7')](_0x106b('0x85'),require(_0x106b('0x86')));_0x35086a[_0x106b('0x7')](_0x106b('0x87'),require('./api/tag'));_0x35086a[_0x106b('0x7')](_0x106b('0x88'),require(_0x106b('0x89')));_0x35086a[_0x106b('0x7')](_0x106b('0x8a'),require('./api/trigger'));_0x35086a[_0x106b('0x7')]('/api/variables',require(_0x106b('0x8b')));_0x35086a[_0x106b('0x7')]('/api/integrations',require(_0x106b('0x8c')));_0x35086a[_0x106b('0x7')]('/api/integrations/reports',require(_0x106b('0x8d')));_0x35086a[_0x106b('0x7')](_0x106b('0x8e'),require(_0x106b('0x8f')));_0x35086a[_0x106b('0x7')]('/api/analytics/default_reports',require(_0x106b('0x90')));_0x35086a['use']('/api/analytics/extracted_reports',require(_0x106b('0x91')));_0x35086a[_0x106b('0x7')](_0x106b('0x92'),require(_0x106b('0x93')));_0x35086a[_0x106b('0x7')]('/api/analytics/field_reports',require(_0x106b('0x94')));_0x35086a[_0x106b('0x7')](_0x106b('0x95'),require('./api/analyticTreeReport'));_0x35086a['use'](_0x106b('0x96'),require('./api/intSalesforceAccount'));_0x35086a[_0x106b('0x7')](_0x106b('0x97'),require(_0x106b('0x98')));_0x35086a[_0x106b('0x7')](_0x106b('0x99'),require(_0x106b('0x9a')));_0x35086a[_0x106b('0x7')](_0x106b('0x9b'),require(_0x106b('0x9c')));_0x35086a[_0x106b('0x7')](_0x106b('0x9d'),require(_0x106b('0x9e')));_0x35086a[_0x106b('0x7')](_0x106b('0x9f'),require(_0x106b('0xa0')));_0x35086a[_0x106b('0x7')]('/api/integrations/desk/accounts',require(_0x106b('0xa1')));_0x35086a[_0x106b('0x7')](_0x106b('0xa2'),require(_0x106b('0xa3')));_0x35086a[_0x106b('0x7')](_0x106b('0xa4'),require(_0x106b('0xa5')));_0x35086a[_0x106b('0x7')](_0x106b('0xa6'),require('./api/intZohoAccount'));_0x35086a[_0x106b('0x7')]('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x35086a['use'](_0x106b('0xa7'),require(_0x106b('0xa8')));_0x35086a[_0x106b('0x7')](_0x106b('0xa9'),require(_0x106b('0xaa')));_0x35086a[_0x106b('0x7')]('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x35086a[_0x106b('0x7')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x35086a[_0x106b('0x7')](_0x106b('0xab'),require('./api/intFreshdeskAccount'));_0x35086a['use'](_0x106b('0xac'),require('./api/intFreshdeskConfiguration'));_0x35086a['use']('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x35086a[_0x106b('0x7')](_0x106b('0xad'),require('./api/intVtigerAccount'));_0x35086a[_0x106b('0x7')](_0x106b('0xae'),require(_0x106b('0xaf')));_0x35086a[_0x106b('0x7')]('/api/integrations/vtiger/fields',require(_0x106b('0xb0')));_0x35086a[_0x106b('0x7')](_0x106b('0xb1'),require(_0x106b('0xb2')));_0x35086a['use'](_0x106b('0xb3'),require(_0x106b('0xb4')));_0x35086a[_0x106b('0x7')](_0x106b('0xb5'),require(_0x106b('0xb6')));_0x35086a[_0x106b('0x7')](_0x106b('0xb7'),require(_0x106b('0xb8')));_0x35086a['use']('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x35086a[_0x106b('0x7')]('/api/integrations/dynamics365/fields',require(_0x106b('0xb9')));_0x35086a['use'](_0x106b('0xba'),require(_0x106b('0xbb')));_0x35086a['use'](_0x106b('0xbc'),require(_0x106b('0xbd')));_0x35086a['use'](_0x106b('0xbe'),require(_0x106b('0xbf')));_0x35086a[_0x106b('0x7')](_0x106b('0xc0'),require('./api/network'));_0x35086a[_0x106b('0x7')]('/api/chat/reports/queue',require(_0x106b('0xc1')));_0x35086a[_0x106b('0x7')](_0x106b('0xc2'),require(_0x106b('0xc3')));_0x35086a[_0x106b('0x7')](_0x106b('0xc4'),require(_0x106b('0xc5')));_0x35086a[_0x106b('0x7')]('/api/jscripty/questions/reports',require(_0x106b('0xc6')));_0x35086a[_0x106b('0x7')](_0x106b('0xc7'),require(_0x106b('0xc8')));_0x35086a[_0x106b('0x7')]('/api/sms/reports/queue',require(_0x106b('0xc9')));_0x35086a[_0x106b('0x7')](_0x106b('0xca'),require(_0x106b('0xcb')));_0x35086a[_0x106b('0x7')]('/api/square/details/reports',require(_0x106b('0xcc')));_0x35086a[_0x106b('0x7')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x35086a[_0x106b('0x7')](_0x106b('0xcd'),require(_0x106b('0xce')));_0x35086a[_0x106b('0x7')]('/api/square/odbc',require('./api/squareOdbc'));_0x35086a[_0x106b('0x7')](_0x106b('0xcf'),require(_0x106b('0xd0')));_0x35086a[_0x106b('0x7')](_0x106b('0xd1'),require('./api/squareRecording'));_0x35086a['use']('/api/square/messages',require(_0x106b('0xd2')));_0x35086a[_0x106b('0x7')](_0x106b('0xd3'),require(_0x106b('0xd4')));_0x35086a[_0x106b('0x7')](_0x106b('0xd5'),require(_0x106b('0xd6')));_0x35086a[_0x106b('0x7')](_0x106b('0xd7'),require('./api/campaign'));_0x35086a['use']('/api/migrations',require(_0x106b('0xd8')));_0x35086a[_0x106b('0x7')](_0x106b('0xd9'),require(_0x106b('0xda')));_0x35086a[_0x106b('0x7')]('/api/plugins',require(_0x106b('0xdb')));_0x35086a[_0x106b('0x7')]('/api/mail/reports/transfer',require(_0x106b('0xdc')));_0x35086a['use']('/api/chat/reports/transfer',require(_0x106b('0xdd')));_0x35086a['use']('/api/fax/reports/transfer',require(_0x106b('0xde')));_0x35086a[_0x106b('0x7')](_0x106b('0xdf'),require(_0x106b('0xe0')));_0x35086a[_0x106b('0x7')](_0x106b('0xe1'),require(_0x106b('0xe2')));_0x35086a[_0x106b('0x7')](_0x106b('0xe3'),require(_0x106b('0xe4')));_0x35086a[_0x106b('0x7')](_0x106b('0xe5'),require(_0x106b('0xe6')));_0x35086a[_0x106b('0x7')](_0x106b('0xe7'),require(_0x106b('0xe8')));_0x35086a[_0x106b('0x7')](_0x106b('0xe9'),require(_0x106b('0xea')));_0x35086a[_0x106b('0x7')]('/api/userProfile/resources',require(_0x106b('0xeb')));_0x35086a[_0x106b('0x7')](_0x106b('0xec'),require(_0x106b('0xed')));_0x35086a['use'](_0x106b('0xee'),require(_0x106b('0xef')));_0x35086a[_0x106b('0x7')]('/api/whatsapp/applications',require(_0x106b('0xf0')));_0x35086a['use'](_0x106b('0xf1'),require(_0x106b('0xf2')));_0x35086a[_0x106b('0x7')]('/api/whatsapp/messages',require(_0x106b('0xf3')));_0x35086a[_0x106b('0x7')](_0x106b('0xf4'),require('./api/whatsappQueueReport'));_0x35086a['use'](_0x106b('0xf5'),require(_0x106b('0xf6')));_0x35086a[_0x106b('0x7')](_0x106b('0xf7'),require('./api/whatsappQueue'));_0x35086a['use']('/api/cloudProviders',require(_0x106b('0xf8')));_0x35086a['use'](_0x106b('0xf9'),require(_0x106b('0xfa')));_0x35086a[_0x106b('0x7')]('/api/auth/google',require('./api/authGoogle'));_0x35086a[_0x106b('0x7')](_0x106b('0xfb'),require('./api/jira'));_0x35086a['use'](_0x106b('0xfc'),require('./api/rpc'));_0x35086a[_0x106b('0x7')](_0x106b('0xfd'),require('./api/version'));_0x35086a[_0x106b('0x7')](_0x106b('0xfe'),require('./api/system'));_0x35086a[_0x106b('0x7')](_0x106b('0xff'),require(_0x106b('0x100')));_0x35086a[_0x106b('0x7')]('/api/webbar',require(_0x106b('0x101')));_0x35086a[_0x106b('0x7')](_0x106b('0x102'),express[_0x106b('0x103')](path[_0x106b('0x104')](config[_0x106b('0x105')],'/apidoc')));_0x35086a[_0x106b('0x7')]('/www',express[_0x106b('0x103')](path[_0x106b('0x104')](config[_0x106b('0x105')],_0x106b('0x106'))));_0x35086a[_0x106b('0x7')](_0x106b('0x107'),express[_0x106b('0x103')](path[_0x106b('0x104')](config[_0x106b('0x105')],_0x106b('0x107'))));_0x35086a['use']('/snippet',express[_0x106b('0x103')](path[_0x106b('0x104')](config['root'],_0x106b('0x108'),_0x106b('0x109'))));_0x35086a['use']('/plugins',express[_0x106b('0x103')](path[_0x106b('0x104')](config['root'],_0x106b('0x10a'))));_0x35086a['route'](_0x106b('0x10b'))[_0x106b('0x10c')](errors[0x194]);_0x35086a['route']('/*')['get'](function(_0x3992f8,_0x55cb8a){_0x55cb8a[_0x106b('0x10d')](path['resolve'](_0x35086a[_0x106b('0x10c')](_0x106b('0x10e'))+'/index.html'));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index f409286..3ee9288 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6196=['../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/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.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/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','listen','log','../config/triggers','default','jayson/promise','bluebird','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc'];(function(_0xc36d01,_0x3bf1a6){var _0xecb231=function(_0x2fb301){while(--_0x2fb301){_0xc36d01['push'](_0xc36d01['shift']());}};_0xecb231(++_0x3bf1a6);}(_0x6196,0x81));var _0x6619=function(_0x367621,_0x5bd8bd){_0x367621=_0x367621-0x0;var _0x43e320=_0x6196[_0x367621];return _0x43e320;};'use strict';var jayson=require(_0x6619('0x0'));var BPromise=require(_0x6619('0x1'));var _=require(_0x6619('0x2'));var config=require(_0x6619('0x3'));exports['listen']=function(){return new BPromise(function(_0x24491e,_0x58b931){var _0x4eb215={};_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x5')));_0x4eb215=_['merge'](_0x4eb215,require(_0x6619('0x6')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x7')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x8')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x4eb215=_['merge'](_0x4eb215,require(_0x6619('0x9')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0xa')));_0x4eb215=_['merge'](_0x4eb215,require(_0x6619('0xb')));_0x4eb215=_['merge'](_0x4eb215,require(_0x6619('0xc')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0xd')));_0x4eb215=_['merge'](_0x4eb215,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0xe')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0xf')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x10')));_0x4eb215=_['merge'](_0x4eb215,require(_0x6619('0x11')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require('../api/mailInteraction/mailInteraction.rpc'));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x12')));_0x4eb215=_['merge'](_0x4eb215,require(_0x6619('0x13')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x4eb215=_['merge'](_0x4eb215,require(_0x6619('0x14')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x15')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require('../api/faxInteraction/faxInteraction.rpc'));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x16')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x17')));_0x4eb215=_['merge'](_0x4eb215,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x18')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x19')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require('../api/smsMessage/smsMessage.rpc'));_0x4eb215=_['merge'](_0x4eb215,require(_0x6619('0x1a')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x4eb215=_['merge'](_0x4eb215,require(_0x6619('0x1b')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x1c')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x1d')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x1e')));_0x4eb215=_['merge'](_0x4eb215,require('../api/chatMessage/chatMessage.rpc'));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x1f')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x20')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x21')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x22')));_0x4eb215=_['merge'](_0x4eb215,require(_0x6619('0x23')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x24')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x25')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x26')));_0x4eb215=_['merge'](_0x4eb215,require(_0x6619('0x27')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x28')));_0x4eb215=_['merge'](_0x4eb215,require('../api/trigger/trigger.rpc'));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x29')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x2a')));_0x4eb215=_['merge'](_0x4eb215,require(_0x6619('0x2b')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x2c')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x2d')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x4eb215=_['merge'](_0x4eb215,require(_0x6619('0x2e')));_0x4eb215=_['merge'](_0x4eb215,require(_0x6619('0x2f')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x30')));_0x4eb215=_['merge'](_0x4eb215,require(_0x6619('0x31')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x32')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x33')));_0x4eb215=_['merge'](_0x4eb215,require('../api/squareReport/squareReport.rpc'));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x34')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x35')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x36')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x37')));_0x4eb215=_['merge'](_0x4eb215,require(_0x6619('0x38')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x39')));_0x4eb215=_['merge'](_0x4eb215,require(_0x6619('0x3a')));_0x4eb215=_['merge'](_0x4eb215,require(_0x6619('0x3b')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x3c')));_0x4eb215=_[_0x6619('0x4')](_0x4eb215,require(_0x6619('0x3d')));var _0x18c1d6=jayson[_0x6619('0x3e')](_0x4eb215)[_0x6619('0x3f')]();var _0x3a12a6=config[_0x6619('0x40')][_0x6619('0x41')]||config['port']+0x1;var _0x21cbd8=config[_0x6619('0x40')]['ip']||_0x6619('0x42');_0x18c1d6['on'](_0x6619('0x43'),function(_0x43f125){return _0x58b931(_0x43f125);});_0x18c1d6[_0x6619('0x44')](_0x3a12a6,_0x21cbd8,function(){console[_0x6619('0x45')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x21cbd8,_0x3a12a6);require(_0x6619('0x46'))[_0x6619('0x47')]();return _0x24491e('RPC\x20listening\x20on\x20'+_0x21cbd8+':'+_0x3a12a6);});});}; \ No newline at end of file +var _0x68ef=['../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.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/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc'];(function(_0x2dd10e,_0x215c92){var _0x3ead50=function(_0x3c70dd){while(--_0x3c70dd){_0x2dd10e['push'](_0x2dd10e['shift']());}};_0x3ead50(++_0x215c92);}(_0x68ef,0xa9));var _0xf68e=function(_0x1cd7f6,_0x4ecb65){_0x1cd7f6=_0x1cd7f6-0x0;var _0x1cf26a=_0x68ef[_0x1cd7f6];return _0x1cf26a;};'use strict';var jayson=require(_0xf68e('0x0'));var BPromise=require(_0xf68e('0x1'));var _=require('lodash');var config=require(_0xf68e('0x2'));exports[_0xf68e('0x3')]=function(){return new BPromise(function(_0x2c63f3,_0xf1738a){var _0x2242d8={};_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require('../api/user/user.rpc'));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x5')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x6')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x7')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x8')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x9')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0xa')));_0x2242d8=_['merge'](_0x2242d8,require(_0xf68e('0xb')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0xc')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0xd')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0xe')));_0x2242d8=_['merge'](_0x2242d8,require(_0xf68e('0xf')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x10')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x11')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require('../api/mailQueue/mailQueue.rpc'));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x12')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x13')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x14')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x15')));_0x2242d8=_['merge'](_0x2242d8,require(_0xf68e('0x16')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require('../api/faxApplication/faxApplication.rpc'));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x17')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x18')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x19')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x1a')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x1b')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x1c')));_0x2242d8=_['merge'](_0x2242d8,require(_0xf68e('0x1d')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x1e')));_0x2242d8=_['merge'](_0x2242d8,require(_0xf68e('0x1f')));_0x2242d8=_['merge'](_0x2242d8,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x2242d8=_['merge'](_0x2242d8,require(_0xf68e('0x20')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x21')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require('../api/chatMessage/chatMessage.rpc'));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x22')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x23')));_0x2242d8=_['merge'](_0x2242d8,require(_0xf68e('0x24')));_0x2242d8=_['merge'](_0x2242d8,require(_0xf68e('0x25')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x26')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require('../api/interval/interval.rpc'));_0x2242d8=_['merge'](_0x2242d8,require(_0xf68e('0x27')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x28')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x29')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x2a')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x2b')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x2c')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x2d')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x2e')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x2f')));_0x2242d8=_['merge'](_0x2242d8,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x2242d8=_['merge'](_0x2242d8,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x30')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x31')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x32')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x33')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x34')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x35')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x36')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x37')));_0x2242d8=_['merge'](_0x2242d8,require(_0xf68e('0x38')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x39')));_0x2242d8=_['merge'](_0x2242d8,require(_0xf68e('0x3a')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x3b')));_0x2242d8=_['merge'](_0x2242d8,require(_0xf68e('0x3c')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x3d')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x3e')));_0x2242d8=_[_0xf68e('0x4')](_0x2242d8,require(_0xf68e('0x3f')));var _0x3f7b96=jayson[_0xf68e('0x40')](_0x2242d8)['http']();var _0x4a6311=config[_0xf68e('0x41')][_0xf68e('0x42')]||config[_0xf68e('0x42')]+0x1;var _0x26849f=config[_0xf68e('0x41')]['ip']||'localhost';_0x3f7b96['on']('error',function(_0x185667){return _0xf1738a(_0x185667);});_0x3f7b96[_0xf68e('0x3')](_0x4a6311,_0x26849f,function(){console[_0xf68e('0x43')](_0xf68e('0x44'),_0x26849f,_0x4a6311);require('../config/triggers')[_0xf68e('0x45')]();return _0x2c63f3(_0xf68e('0x46')+_0x26849f+':'+_0x4a6311);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 6390803..8d1c490 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 _0xe706=['wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','util','lodash','events','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','search','520\x20End\x20of\x20proper','function','substring','no\x20code','indexOf','startsWith','split','length','error','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','command','sync','answer','sendRequest','prototype','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile'];(function(_0x1f404a,_0x5088b2){var _0x2cdcd5=function(_0xe30d8c){while(--_0xe30d8c){_0x1f404a['push'](_0x1f404a['shift']());}};_0x2cdcd5(++_0x5088b2);}(_0xe706,0xa3));var _0x6e70=function(_0x45cd35,_0x41147c){_0x45cd35=_0x45cd35-0x0;var _0x16db84=_0xe706[_0x45cd35];return _0x16db84;};'use strict';var util=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIReply=require(_0x6e70('0x3'));var AGIError=require(_0x6e70('0x4'));function AGIChannel(_0x2ca810){var _0x7dfbc3=this,_0x142c27=new AGIReply(),_0x2164a4=![],_0x376a8d={};EventEmitter[_0x6e70('0x5')](_0x7dfbc3);_0x2ca810[_0x6e70('0x6')](_0x6e70('0x7'));_0x2ca810[_0x6e70('0x8')](0x8*0x3c*0x3c*0x3e8);_0x142c27[_0x6e70('0x6')](_0x6e70('0x7'));_0x142c27['on'](_0x6e70('0x9'),function(_0x3c4843){for(var _0x449b48 in _0x3c4843){_0x7dfbc3[_0x449b48]=_0x3c4843[_0x449b48];}_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0xb'));});_0x142c27['on'](_0x6e70('0xc'),function(_0x463853){if(_0x463853[_0x6e70('0xd')]()==_0x6e70('0xe')){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0xe'));return;}if(_0x463853['substring'](0x0,0xb)=='520-Invalid'){_0x2164a4=!![];}if(_0x2164a4){_0x376a8d['rx']+=_0x463853+'\x0a';if(_0x463853[_0x6e70('0xf')](_0x6e70('0x10'))!=-0x1){_0x2164a4=![];}}else{_0x376a8d['rx']=_0x463853;}if(_0x2164a4){return;}if(typeof _0x376a8d['cb']==_0x6e70('0x11')){var _0x27dd9b=_0x376a8d['rx'][_0x6e70('0x12')](0x0,0x3),_0x3b38f3=null,_0x310eb7=null;_0x27dd9b=parseInt(_0x27dd9b);if(isNaN(_0x27dd9b)){_0x376a8d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6e70('0x13')});return;}if(_0x27dd9b!=0xc8){_0x376a8d['cb'](null,{'code':_0x27dd9b,'result':-0x1,'extra':'KO'});return;}_0x3b38f3=_0x376a8d['rx']['substring'](0x4)['replace']('result=','');if(_0x3b38f3[_0x6e70('0x14')]('\x20')!=-0x1){_0x3b38f3=_0x3b38f3['substr'](0x0,_0x3b38f3['indexOf']('\x20'));}if(_[_0x6e70('0x15')](_0x3b38f3,'-1')){_0x3b38f3=parseInt(_0x3b38f3);}_0x310eb7=_0x376a8d['rx'][_0x6e70('0x16')]('\x20');if(_0x310eb7['length']==0x3){_0x310eb7=_0x310eb7[0x2][_0x6e70('0x12')](0x1,_0x310eb7[0x2]['length']-0x1);}else if(_0x310eb7[_0x6e70('0x17')]>0x3){var _0x161f23=/\((.+)\)/;var _0x4ca554=_0x376a8d['rx']['match'](_0x161f23);if(_0x4ca554){_0x310eb7=_0x4ca554[0x1];}else{_0x310eb7=null;}}else{_0x310eb7=null;}_0x376a8d['cb'](null,{'code':_0x27dd9b,'result':_0x3b38f3,'extra':_0x310eb7});}});_0x2ca810['on'](_0x6e70('0x18'),function(_0x5ea7a5){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x5ea7a5['code']));});_0x2ca810['on'](_0x6e70('0x19'),function(){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x19'),new AGIError(_0x6e70('0x1a')));});_0x2ca810['on'](_0x6e70('0x1b'),function(){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x1b'),new AGIError(_0x6e70('0x1c')));_0x2ca810[_0x6e70('0x1d')]();});_0x2ca810[_0x6e70('0x1e')](_0x142c27);this['command']=function(_0x228350,_0x344b65){var _0x228350=_0x228350||'',_0x344b65=typeof _0x344b65==_0x6e70('0x11')?_0x344b65:new Function();_0x376a8d={'tx':_0x228350,'rx':'','cb':_0x344b65};_0x2ca810[_0x6e70('0x1f')](_0x228350+'\x0a');},this[_0x6e70('0x19')]=function(){_0x2ca810['destroy']();};}util[_0x6e70('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x4e97c7){return this[_0x6e70('0x21')][_0x6e70('0x22')](this,_0x4e97c7);};AGIChannel['prototype'][_0x6e70('0x23')]=function(){return this[_0x6e70('0x24')]('ANSWER');};AGIChannel[_0x6e70('0x25')][_0x6e70('0x26')]=function(_0x2bb231,_0x4a67ac,_0x54a5fe){_0x2bb231=_0x2bb231===undefined?_0x6e70('0x27'):_0x2bb231;_0x4a67ac=_0x4a67ac===undefined?'5':_0x4a67ac;_0x54a5fe=_0x54a5fe===undefined?'1':_0x54a5fe;return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x29'),_0x2bb231,_0x4a67ac*0x3e8,_0x54a5fe));};AGIChannel[_0x6e70('0x25')]['noop']=function(_0x1952ea){_0x1952ea=_0x1952ea||_0x6e70('0x2a');return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x2b'),_0x1952ea));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x2c')]=function(_0x24114a,_0x3a0821){if(_[_0x6e70('0x2d')](_0x3a0821)){return this['sendRequest'](util[_0x6e70('0x28')]('EXEC\x20%s\x20%s',_0x24114a,_0x3a0821[_0x6e70('0x2e')](',')));}return this['sendRequest'](util[_0x6e70('0x28')](_0x6e70('0x2f'),_0x24114a,_0x3a0821));};AGIChannel[_0x6e70('0x25')]['setContext']=function(_0x38c40d){return this[_0x6e70('0x24')](util['format'](_0x6e70('0x30'),_0x38c40d));};AGIChannel[_0x6e70('0x25')]['setExtension']=function(_0x10d8f6){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x31'),_0x10d8f6));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x32')]=function(_0x44b19d){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x33'),_0x44b19d));};AGIChannel['prototype'][_0x6e70('0xe')]=function(){return this['sendRequest'](_0x6e70('0x34'));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x35')]=function(_0x32d12d,_0x233a83){var _0x989b80=_[_0x6e70('0x36')](_0x233a83)||_[_0x6e70('0x37')](_0x233a83)?_0x233a83[_0x6e70('0x38')]():_0x233a83;return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x39'),_0x32d12d,_0x989b80?_0x989b80[_0x6e70('0x38')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x155a46,_0x3841a0){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3a'),_0x155a46,_0x3841a0));};AGIChannel[_0x6e70('0x25')]['sayDigits']=function(_0x3b508c,_0x9e7ad2){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3b'),_0x3b508c,_0x9e7ad2));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x3c')]=function(_0x16fc7d,_0x5be100){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3d'),_0x16fc7d,_0x5be100));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x3e')]=function(_0x1de947,_0x21b0e7,_0x4a8adc){_0x21b0e7=_0x21b0e7||this['extension'];_0x4a8adc=_0x4a8adc||0x1;this['setContext'](_0x1de947);this[_0x6e70('0x3f')](_0x21b0e7);this[_0x6e70('0x32')](_0x4a8adc);return this[_0x6e70('0x40')](util[_0x6e70('0x28')](_0x6e70('0x41'),_0x1de947,_0x21b0e7,_0x4a8adc));};AGIChannel['prototype'][_0x6e70('0x42')]=function(_0x2a58d7){return this[_0x6e70('0x24')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x2a58d7));};AGIChannel['prototype'][_0x6e70('0x43')]=function(_0x5cca5b,_0x42f49a,_0x39913a,_0x3fed21,_0x75a90d,_0x59c87d){_0x42f49a=_0x42f49a||_0x6e70('0x44');_0x39913a=_0x39913a||'';_0x3fed21=_0x3fed21===undefined?-0x1:_0x3fed21==='-1'?-0x1:_0x3fed21*0x3e8;_0x75a90d=_0x75a90d===undefined?'':'s='+_0x75a90d;_0x59c87d=_0x59c87d?'BEEP':'';return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x45'),_0x5cca5b,_0x42f49a,_0x39913a,_0x3fed21,_0x59c87d,_0x75a90d));};AGIChannel[_0x6e70('0x25')]['streamFile']=function(_0x291de6,_0x44b637){_0x44b637=_0x44b637||'';return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x46'),_0x291de6,_0x44b637));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x47')]=function(_0x552e7e){return this[_0x6e70('0x2c')](_0x6e70('0x48'),_0x552e7e);};AGIChannel[_0x6e70('0x25')][_0x6e70('0x49')]=function(_0x3f86cf){return this[_0x6e70('0x2c')](_0x6e70('0x4a'),_0x3f86cf);};AGIChannel['prototype'][_0x6e70('0x18')]=function(_0x50cdf1,_0x11794e){this[_0x6e70('0x40')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x50cdf1['id'],_0x50cdf1[_0x6e70('0x4b')],_0x11794e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6e70('0x4c')]=AGIChannel; \ No newline at end of file +var _0xa9e0=['utf8','setTimeout','setEncoding','ready','line','toLowerCase','hangup','emit','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','write','inherits','prototype','sendRequest','command','sync','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','label','exports','util','lodash','events','./error','call'];(function(_0x186712,_0x302720){var _0x4ed126=function(_0x5d99ea){while(--_0x5d99ea){_0x186712['push'](_0x186712['shift']());}};_0x4ed126(++_0x302720);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x0a9e('0x3'));function AGIChannel(_0x4ce2f1){var _0x333808=this,_0x432180=new AGIReply(),_0x2ab90b=![],_0x991246={};EventEmitter[_0x0a9e('0x4')](_0x333808);_0x4ce2f1['setEncoding'](_0x0a9e('0x5'));_0x4ce2f1[_0x0a9e('0x6')](0x8*0x3c*0x3c*0x3e8);_0x432180[_0x0a9e('0x7')]('utf8');_0x432180['on']('headers',function(_0xe42b77){for(var _0x56465b in _0xe42b77){_0x333808[_0x56465b]=_0xe42b77[_0x56465b];}_0x333808['emit'](_0x0a9e('0x8'));});_0x432180['on'](_0x0a9e('0x9'),function(_0x307b3e){if(_0x307b3e[_0x0a9e('0xa')]()==_0x0a9e('0xb')){_0x333808[_0x0a9e('0xc')]('hangup');return;}if(_0x307b3e['substring'](0x0,0xb)=='520-Invalid'){_0x2ab90b=!![];}if(_0x2ab90b){_0x991246['rx']+=_0x307b3e+'\x0a';if(_0x307b3e['search'](_0x0a9e('0xd'))!=-0x1){_0x2ab90b=![];}}else{_0x991246['rx']=_0x307b3e;}if(_0x2ab90b){return;}if(typeof _0x991246['cb']==_0x0a9e('0xe')){var _0xd5b662=_0x991246['rx'][_0x0a9e('0xf')](0x0,0x3),_0x26d672=null,_0x32d742=null;_0xd5b662=parseInt(_0xd5b662);if(isNaN(_0xd5b662)){_0x991246['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xd5b662!=0xc8){_0x991246['cb'](null,{'code':_0xd5b662,'result':-0x1,'extra':'KO'});return;}_0x26d672=_0x991246['rx'][_0x0a9e('0xf')](0x4)[_0x0a9e('0x10')](_0x0a9e('0x11'),'');if(_0x26d672[_0x0a9e('0x12')]('\x20')!=-0x1){_0x26d672=_0x26d672[_0x0a9e('0x13')](0x0,_0x26d672[_0x0a9e('0x12')]('\x20'));}if(_['startsWith'](_0x26d672,'-1')){_0x26d672=parseInt(_0x26d672);}_0x32d742=_0x991246['rx'][_0x0a9e('0x14')]('\x20');if(_0x32d742['length']==0x3){_0x32d742=_0x32d742[0x2][_0x0a9e('0xf')](0x1,_0x32d742[0x2]['length']-0x1);}else if(_0x32d742[_0x0a9e('0x15')]>0x3){var _0x12066b=/\((.+)\)/;var _0x48f32d=_0x991246['rx'][_0x0a9e('0x16')](_0x12066b);if(_0x48f32d){_0x32d742=_0x48f32d[0x1];}else{_0x32d742=null;}}else{_0x32d742=null;}_0x991246['cb'](null,{'code':_0xd5b662,'result':_0x26d672,'extra':_0x32d742});}});_0x4ce2f1['on']('error',function(_0x459eb1){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x17'),new AGIError(_0x0a9e('0x18'),_0x459eb1[_0x0a9e('0x19')]));});_0x4ce2f1['on'](_0x0a9e('0x1a'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1a'),new AGIError(_0x0a9e('0x1b')));});_0x4ce2f1['on'](_0x0a9e('0x1c'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4ce2f1[_0x0a9e('0x1d')]();});_0x4ce2f1[_0x0a9e('0x1e')](_0x432180);this['command']=function(_0x20f109,_0x5a09ef){var _0x20f109=_0x20f109||'',_0x5a09ef=typeof _0x5a09ef==_0x0a9e('0xe')?_0x5a09ef:new Function();_0x991246={'tx':_0x20f109,'rx':'','cb':_0x5a09ef};_0x4ce2f1[_0x0a9e('0x1f')](_0x20f109+'\x0a');},this[_0x0a9e('0x1a')]=function(){_0x4ce2f1['destroy']();};}util[_0x0a9e('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x22')]=function(_0x4d00e6){return this[_0x0a9e('0x23')][_0x0a9e('0x24')](this,_0x4d00e6);};AGIChannel[_0x0a9e('0x21')]['answer']=function(){return this['sendRequest'](_0x0a9e('0x25'));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x26')]=function(_0x33161b,_0x526cf3,_0x384319){_0x33161b=_0x33161b===undefined?'beep':_0x33161b;_0x526cf3=_0x526cf3===undefined?'5':_0x526cf3;_0x384319=_0x384319===undefined?'1':_0x384319;return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x27'),_0x33161b,_0x526cf3*0x3e8,_0x384319));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x28')]=function(_0x14433c){_0x14433c=_0x14433c||_0x0a9e('0x29');return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x14433c));};AGIChannel['prototype'][_0x0a9e('0x2c')]=function(_0x468813,_0x2b1f27){if(_[_0x0a9e('0x2d')](_0x2b1f27)){return this['sendRequest'](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27[_0x0a9e('0x2f')](',')));}return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x30')]=function(_0x1dbde2){return this['sendRequest'](util[_0x0a9e('0x2a')]('SET\x20CONTEXT\x20%s',_0x1dbde2));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x31')]=function(_0x1122db){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20EXTENSION\x20%s',_0x1122db));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x32')]=function(_0x40cb85){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x33'),_0x40cb85));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0xb')]=function(){return this['sendRequest'](_0x0a9e('0x34'));};AGIChannel['prototype'][_0x0a9e('0x35')]=function(_0x14b13f,_0x2b7e7f){var _0x3f3d41=_['isBoolean'](_0x2b7e7f)||_[_0x0a9e('0x36')](_0x2b7e7f)?_0x2b7e7f[_0x0a9e('0x37')]():_0x2b7e7f;return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x14b13f,_0x3f3d41?_0x3f3d41['toString']()[_0x0a9e('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x39'),_0x3d9717,_0x381c37));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3a')]=function(_0x533942,_0x1dbf74){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x533942,_0x1dbf74));};AGIChannel['prototype'][_0x0a9e('0x3b')]=function(_0x40d766,_0x5adda1){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3c'),_0x40d766,_0x5adda1));};AGIChannel[_0x0a9e('0x21')]['continueAt']=function(_0x5a594b,_0x15e37d,_0x45b3d0){_0x15e37d=_0x15e37d||this['extension'];_0x45b3d0=_0x45b3d0||0x1;this[_0x0a9e('0x30')](_0x5a594b);this[_0x0a9e('0x31')](_0x15e37d);this[_0x0a9e('0x32')](_0x45b3d0);return this['noop'](util[_0x0a9e('0x2a')](_0x0a9e('0x3d'),_0x5a594b,_0x15e37d,_0x45b3d0));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3e')]=function(_0x13cb1f){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3f'),_0x13cb1f));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x40')]=function(_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x37f6cc,_0x4d04c8){_0x148007=_0x148007||'wav';_0x1a7bce=_0x1a7bce||'';_0x11ca30=_0x11ca30===undefined?-0x1:_0x11ca30==='-1'?-0x1:_0x11ca30*0x3e8;_0x37f6cc=_0x37f6cc===undefined?'':'s='+_0x37f6cc;_0x4d04c8=_0x4d04c8?_0x0a9e('0x41'):'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x42'),_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x4d04c8,_0x37f6cc));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x43')]=function(_0x10b040,_0x445e25){_0x445e25=_0x445e25||'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x44'),_0x10b040,_0x445e25));};AGIChannel[_0x0a9e('0x21')]['agi']=function(_0x117c99){return this[_0x0a9e('0x2c')](_0x0a9e('0x45'),_0x117c99);};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x46')]=function(_0xbe9d19){return this[_0x0a9e('0x2c')](_0x0a9e('0x47'),_0xbe9d19);};AGIChannel['prototype'][_0x0a9e('0x17')]=function(_0x48fd45,_0x473dc8){this[_0x0a9e('0x28')](util[_0x0a9e('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x48fd45['id'],_0x48fd45[_0x0a9e('0x48')],_0x473dc8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0a9e('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 60faa35..6b2cb8b 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 _0xeec3=['util','Undefined\x20error.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','name'];(function(_0x47024a,_0x2b601d){var _0x2bb25c=function(_0x354785){while(--_0x354785){_0x47024a['push'](_0x47024a['shift']());}};_0x2bb25c(++_0x2b601d);}(_0xeec3,0x1c3));var _0x3eec=function(_0x58419e,_0x2ebedc){_0x58419e=_0x58419e-0x0;var _0x4414cd=_0xeec3[_0x58419e];return _0x4414cd;};'use strict';var util=require(_0x3eec('0x0'));var error={'E_AGI_UNDEFINED':_0x3eec('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x3eec('0x2'),'E_AGI_SOCKET_CLOSE':_0x3eec('0x3'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x3eec('0x4'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x3eec('0x5')};function AGIError(_0x115be5){var _0x115be5=_0x115be5||null,_0x3a019f=_0x3a019f||[],_0x3b8171=0x1,_0xa6821e='';if(!error[_0x115be5]){_0x115be5=_0x3eec('0x6');}_0x3a019f[_0x3eec('0x7')](error[_0x115be5]);while(arguments[_0x3b8171]){_0x3a019f[_0x3eec('0x7')](arguments[_0x3b8171]);_0x3b8171++;}_0xa6821e=util[_0x3eec('0x8')][_0x3eec('0x9')](util,_0x3a019f);this['message']=_0xa6821e;this[_0x3eec('0xa')]=_0x115be5;}module['exports']=AGIError; \ No newline at end of file +var _0xfc79=['Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','message','name','exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.'];(function(_0x2966de,_0xc756d5){var _0x4e75a2=function(_0x15b554){while(--_0x15b554){_0x2966de['push'](_0x2966de['shift']());}};_0x4e75a2(++_0xc756d5);}(_0xfc79,0x1c3));var _0x9fc7=function(_0xdbbcd,_0x2ca804){_0xdbbcd=_0xdbbcd-0x0;var _0x4ee789=_0xfc79[_0xdbbcd];return _0x4ee789;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x9fc7('0x0'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x9fc7('0x1'),'E_AGI_SERVER_VOICE_DISABLED':_0x9fc7('0x2'),'E_AGI_SOCKET_ERROR':_0x9fc7('0x3'),'E_AGI_SOCKET_CLOSE':_0x9fc7('0x4'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x9fc7('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x9fc7('0x6'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x32c028){var _0x32c028=_0x32c028||null,_0x2b6bdf=_0x2b6bdf||[],_0x1d6aa8=0x1,_0x9dd61b='';if(!error[_0x32c028]){_0x32c028=_0x9fc7('0x7');}_0x2b6bdf[_0x9fc7('0x8')](error[_0x32c028]);while(arguments[_0x1d6aa8]){_0x2b6bdf[_0x9fc7('0x8')](arguments[_0x1d6aa8]);_0x1d6aa8++;}_0x9dd61b=util['format']['apply'](util,_0x2b6bdf);this[_0x9fc7('0x9')]=_0x9dd61b;this[_0x9fc7('0xa')]=_0x32c028;}module[_0x9fc7('0xb')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 0283079..a1a39b2 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 _0x6599=['default','target','invalid','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','../../../config/logger','agi','menu','getdigits','getsecretdigits','edges','prototype','vertices','numberOfEdges','size','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand'];(function(_0xfca7c8,_0x2f259d){var _0x5aa0e4=function(_0x561258){while(--_0x561258){_0xfca7c8['push'](_0xfca7c8['shift']());}};_0x5aa0e4(++_0x2f259d);}(_0x6599,0xb0));var _0x9659=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x6599[_0xac151d];return _0x111dba;};'use strict';var _=require('lodash');var logger=require(_0x9659('0x0'))(_0x9659('0x1'));var verticesWithRetry=[_0x9659('0x2'),_0x9659('0x3'),_0x9659('0x4')];var Graph=function(){this['vertices']={};this[_0x9659('0x5')]={};this['numberOfEdges']=0x0;};Graph[_0x9659('0x6')]['addVertex']=function(_0x2acc26){this[_0x9659('0x7')][_0x2acc26['id']]=_0x2acc26;this[_0x9659('0x5')][_0x2acc26['id']]=[];};Graph['prototype']['addEdge']=function(_0xabdd12,_0x14cb81,_0x4d0a52){this[_0x9659('0x5')][_0xabdd12]['push']({'target':_0x14cb81,'condition':_0x4d0a52});this[_0x9659('0x8')]+=0x1;};Graph[_0x9659('0x6')]['size']=function(){return _[_0x9659('0x9')](this[_0x9659('0x7')]);};Graph[_0x9659('0x6')]['relations']=function(){return this[_0x9659('0x8')];};Graph['prototype'][_0x9659('0xa')]=function(_0xb33eca){return this[_0x9659('0x7')][_0xb33eca];};Graph['prototype'][_0x9659('0xb')]=function(_0x414542,_0x3f7865){if(!this[_0x9659('0x7')][_0x414542]){return logger[_0x9659('0xc')](_0x9659('0xd'));}var _0x805d8c=_0x3f7865(this[_0x9659('0x7')][_0x414542]);if(!_0x805d8c){return logger[_0x9659('0xc')](_0x9659('0xe'));}if(this[_0x9659('0x5')][_0x414542][_0x9659('0xf')]===0x0){return logger[_0x9659('0xc')](_0x9659('0x10'));}for(var _0x575f53=0x0,_0x281df8=[],_0xd1ab56=![];_0x575f53\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','agicommand','maxRetry','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','then','createSquareReport','catch','hasOwnProperty','agi_','substring','inspect','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','sync','production','start','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','stringify','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[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','close','Project\x20%s\x20not\x20published','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','[ERROR]\x20%s'];(function(_0x147a58,_0xf665c8){var _0x161070=function(_0x181a19){while(--_0x181a19){_0x147a58['push'](_0x147a58['shift']());}};_0x161070(++_0xf665c8);}(_0x17ba,0xab));var _0xa17b=function(_0x31b4f5,_0x53d0d1){_0x31b4f5=_0x31b4f5-0x0;var _0x1ccf4e=_0x17ba[_0x31b4f5];return _0x1ccf4e;};'use strict';var parser=require(_0xa17b('0x0'));var _=require(_0xa17b('0x1'));var syncho=require('syncho');var util=require(_0xa17b('0x2'));var moment=require(_0xa17b('0x3'));var config=require(_0xa17b('0x4'));var logger=require(_0xa17b('0x5'))(_0xa17b('0x6'));var utilLicense=require(_0xa17b('0x7'));var rpc=require(_0xa17b('0x8'));var mailRpc=require(_0xa17b('0x9'));var Graph=require(_0xa17b('0xa'));var Vertices=require(_0xa17b('0xb'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xa17b('0x6')]=_[_0xa17b('0xc')](config[_0xa17b('0x6')],{'ip':_0xa17b('0xd'),'port':0x11dd});function connectionHandler(_0x2ca4d3){process[_0xa17b('0xe')](function(){syncho(function(){try{setChannelVariables(_0x2ca4d3);agiHandler(_0x2ca4d3);}catch(_0x2d7aa4){logger[_0xa17b('0xf')](_0x2d7aa4[_0xa17b('0x10')]);}});});}function listeningHandler(){console['log'](_0xa17b('0x11'),config[_0xa17b('0x6')][_0xa17b('0x12')]);logger[_0xa17b('0x13')](util[_0xa17b('0x14')](_0xa17b('0x15'),config[_0xa17b('0x6')]['ip'],config['agi'][_0xa17b('0x12')]));}function errorHandler(_0x3e92e4){if(_0x3e92e4&&_0x3e92e4[_0xa17b('0x16')]&&_0x3e92e4['message']){logger[_0xa17b('0xf')](util[_0xa17b('0x14')](_0xa17b('0x17'),_0x3e92e4[_0xa17b('0x16')],_0x3e92e4['message']));}else{logger[_0xa17b('0xf')](util['format'](_0xa17b('0x18'),_0x3e92e4[_0xa17b('0x10')]));}}function closeHandler(){logger['info'](util[_0xa17b('0x14')](_0xa17b('0x19'),this[_0xa17b('0x1a')],this[_0xa17b('0x1b')],this['callerid'],this[_0xa17b('0x1c')],this['uniqueid']));try{createSquareReport(this);}catch(_0x4d5592){logger['error'](_0x4d5592[_0xa17b('0x10')]);}}function timeoutHandler(){logger[_0xa17b('0x13')](util['format'](_0xa17b('0x1d'),this[_0xa17b('0x1a')],this[_0xa17b('0x1b')],this[_0xa17b('0x1e')],this[_0xa17b('0x1c')],this[_0xa17b('0x1f')]));}function hangupHandler(){logger[_0xa17b('0x13')](util['format'](_0xa17b('0x20'),this[_0xa17b('0x1a')],this[_0xa17b('0x1b')],this['callerid'],this[_0xa17b('0x1c')],this[_0xa17b('0x1f')]));this[_0xa17b('0x21')]=!![];}function getRoot(_0xbbbb62){return parser[_0xa17b('0x22')](_0xbbbb62,{'object':!![]})[_0xa17b('0x23')]['root'];}function addVertex(_0x3df11f,_0x4d4a65,_0xa34739){_0x4d4a65[_0xa17b('0x24')]=_0xa34739;if(_0x4d4a65['hasOwnProperty']('retry')){_0x4d4a65[_0xa17b('0x25')]=parseInt(_0x4d4a65[_0xa17b('0x26')],0xa);}_0x3df11f[_0xa17b('0x27')](_[_0xa17b('0x28')](_0x4d4a65,_0xa17b('0x29')));}function initGraph(_0x3a64f5,_0x4cd38e){var _0x47aff8=new Graph();for(var _0x5c98fe in _0x3a64f5){if(_0x3a64f5['hasOwnProperty'](_0x5c98fe)){if(_[_0xa17b('0x2a')](_0x3a64f5[_0x5c98fe])){for(var _0x5ef356=0x0;_0x5ef356<_0x3a64f5[_0x5c98fe][_0xa17b('0x2b')];_0x5ef356+=0x1){addVertex(_0x47aff8,_0x3a64f5[_0x5c98fe][_0x5ef356],_0x5c98fe);}}else{addVertex(_0x47aff8,_0x3a64f5[_0x5c98fe],_0x5c98fe);}}}for(var _0x4ff3f8=0x0;_0x4ff3f8<_0x4cd38e[_0xa17b('0x2b')];_0x4ff3f8+=0x1){if(_0x4cd38e[_0x4ff3f8][_0xa17b('0x2c')]&&_0x4cd38e[_0x4ff3f8][_0xa17b('0x2d')]){_0x47aff8[_0xa17b('0x2e')](_0x4cd38e[_0x4ff3f8][_0xa17b('0x2c')],_0x4cd38e[_0x4ff3f8][_0xa17b('0x2d')],_0x4cd38e[_0x4ff3f8][_0xa17b('0x2f')]);}}return _0x47aff8;}function getSquareProject(_0x366b47,_0x43b1f5){rpc[_0xa17b('0x30')](_0x366b47)[_0xa17b('0x31')](function(_0x573585){_0x43b1f5(null,_0x573585);})['catch'](function(_0x58d7b6){_0x43b1f5(null,_0x58d7b6);});}function createSquareReport(_0x404369,_0x11070a){rpc[_0xa17b('0x32')](_0x404369)[_0xa17b('0x31')](function(_0x16dd1f){if(_0x11070a){_0x11070a(null,_0x16dd1f);}})[_0xa17b('0x33')](function(_0x312ac3){if(_0x11070a){_0x11070a(null,_0x312ac3);}});}function setChannelVariables(_0x1bdd09){for(var _0x5884af in _0x1bdd09){if(_0x1bdd09[_0xa17b('0x34')](_0x5884af)){if(_0x5884af['indexOf'](_0xa17b('0x35'))===0x0){_0x1bdd09[_0x5884af[_0xa17b('0x36')](0x4)]=_0x1bdd09[_0x5884af];delete _0x1bdd09[_0x5884af];}}}}function getLogFromObject(_0x198ceb){return util[_0xa17b('0x37')](_0x198ceb,{'showHidden':![],'depth':null});}function agiHandler(_0x4ec38d){var _0x243876,_0x596d48,_0x3031b5,_0xc33f5e,_0x323e0e;logger[_0xa17b('0x38')](_0xa17b('0x39'),JSON['stringify'](_0x4ec38d,null,0x2));logger[_0xa17b('0x13')](util['format'](_0xa17b('0x3a'),_0x4ec38d['arg_1'],_0x4ec38d[_0xa17b('0x1b')],_0x4ec38d[_0xa17b('0x1e')],_0x4ec38d['dnid'],_0x4ec38d[_0xa17b('0x1f')]));_0x4ec38d['on'](_0xa17b('0xf'),errorHandler);_0x4ec38d['on']('close',closeHandler);_0x4ec38d['on'](_0xa17b('0x3b'),timeoutHandler);_0x4ec38d[_0xa17b('0x21')]=![];_0x4ec38d['on'](_0xa17b('0x3c'),hangupHandler);var _0x55c1b6=getSquareProject[_0xa17b('0x3d')](null,_0x4ec38d['arg_1']);if(_0x55c1b6){if(_0x55c1b6[_0xa17b('0x3e')]){_0x243876=getRoot(_0x55c1b6['production']);if(_0x243876&&_0x243876[_0xa17b('0x3f')]){logger['debug'](_0xa17b('0x40'),JSON['stringify'](_0x243876,null,0x2));_0x4ec38d[_0xa17b('0x41')]=moment()['format'](_0xa17b('0x42'));_0x596d48=initGraph(_['omit'](_0x243876,_0xa17b('0x29')),_0x243876[_0xa17b('0x29')]);_0x3031b5=new Vertices(_0x4ec38d,rpc,mailRpc);logger[_0xa17b('0x13')](util[_0xa17b('0x14')](_0xa17b('0x43'),_0x4ec38d[_0xa17b('0x1a')],_0x4ec38d[_0xa17b('0x1b')],_0x4ec38d[_0xa17b('0x1e')],_0x4ec38d['dnid'],_0x4ec38d[_0xa17b('0x1f')]));_0x596d48[_0xa17b('0x44')](_0x243876['start']['id'],function(_0x477922){try{_0x477922=_0x3031b5[_0xa17b('0x45')](_0x477922);logger[_0xa17b('0x38')](_0xa17b('0x46'),JSON[_0xa17b('0x47')](_0x477922,null,0x2));if(_0x477922[_0xa17b('0x24')]==='gotoc'){logger[_0xa17b('0x13')](_0xa17b('0x48'));_0x4ec38d[_0xa17b('0x49')]=_0x477922['context']||_0x4ec38d['context'];_0x4ec38d['extension']=_0x477922[_0xa17b('0x4a')];_0x4ec38d[_0xa17b('0x4b')]=_0x477922[_0xa17b('0x4b')]?_0x477922[_0xa17b('0x4b')]-0x1:0x1;return null;}else if(_0x477922&&_0x3031b5[_0x477922[_0xa17b('0x24')]]){_0x323e0e=_0x3031b5[_0x477922[_0xa17b('0x24')]](_0x477922);logger[_0xa17b('0x13')](_0xa17b('0x4c'),JSON[_0xa17b('0x47')](_0x323e0e,null,0x2));if(_0x323e0e&&_0x323e0e[_0xa17b('0x4d')]===AGI_CODE_SUCCESS&&_0x323e0e[_0xa17b('0x4e')]!==AGI_RESULT_ERROR&&!_0x4ec38d[_0xa17b('0x21')]){logger['debug'](_0xa17b('0x4c'),getLogFromObject(_0x323e0e));return _[_0xa17b('0x4f')](_0x323e0e[_0xa17b('0x4e')])?null:_0x323e0e[_0xa17b('0x4e')][_0xa17b('0x50')]();}else{logger[_0xa17b('0xf')]('response',getLogFromObject(_0x323e0e));return null;}}else{logger[_0xa17b('0xf')](_0xa17b('0x51'));return null;}}catch(_0x5e04f1){logger[_0xa17b('0xf')](_0x5e04f1[_0xa17b('0x10')]);return null;}});if(_0x243876['finally']){logger[_0xa17b('0x13')](util[_0xa17b('0x14')](_0xa17b('0x52'),_0x4ec38d[_0xa17b('0x1a')],_0x4ec38d['calleridname'],_0x4ec38d[_0xa17b('0x1e')],_0x4ec38d[_0xa17b('0x1c')],_0x4ec38d[_0xa17b('0x1f')]));_0x596d48[_0xa17b('0x44')](_0x243876[_0xa17b('0x53')]['id'],function(_0x19dee2){try{_0x19dee2=_0x3031b5[_0xa17b('0x45')](_0x19dee2);logger['debug'](_0xa17b('0x46'),JSON[_0xa17b('0x47')](_0x19dee2,null,0x2));if(_0x19dee2&&_0x3031b5[_0x19dee2['agicommand']]){_0x323e0e=_0x3031b5[_0x19dee2[_0xa17b('0x24')]](_0x19dee2);if(_0x323e0e){logger[_0xa17b('0x38')](_0xa17b('0x4c'),getLogFromObject(_0x323e0e));return _['isUndefined'](_0x323e0e[_0xa17b('0x4e')])?null:_0x323e0e[_0xa17b('0x4e')]['toString']();}else{logger[_0xa17b('0xf')](_0xa17b('0x4c'),getLogFromObject(_0x323e0e));return null;}}else{logger['error'](_0xa17b('0x51'));return null;}}catch(_0x347436){logger['error'](_0x347436[_0xa17b('0x10')]);return null;}});}logger[_0xa17b('0x13')](util[_0xa17b('0x14')](_0xa17b('0x54'),_0x4ec38d[_0xa17b('0x1a')],_0x4ec38d[_0xa17b('0x1b')],_0x4ec38d[_0xa17b('0x1e')],_0x4ec38d['dnid'],_0x4ec38d[_0xa17b('0x1f')]));logger[_0xa17b('0x13')](util[_0xa17b('0x14')](_0xa17b('0x55'),_0x4ec38d[_0xa17b('0x49')],_0x4ec38d[_0xa17b('0x4a')],parseInt(_0x4ec38d[_0xa17b('0x4b')],0xa)+0x1));_0x4ec38d[_0xa17b('0x56')](_0x4ec38d[_0xa17b('0x49')],_0x4ec38d[_0xa17b('0x4a')],parseInt(_0x4ec38d[_0xa17b('0x4b')],0xa)+0x1);_0x4ec38d[_0xa17b('0x57')]();}}else{logger[_0xa17b('0xf')](util['format'](_0xa17b('0x58'),_0x4ec38d[_0xa17b('0x1a')]));_0x4ec38d[_0xa17b('0x56')](_0x4ec38d[_0xa17b('0x49')],_0x4ec38d[_0xa17b('0x4a')],parseInt(_0x4ec38d[_0xa17b('0x4b')],0xa)+0x1);_0x4ec38d[_0xa17b('0x57')]();}}else{logger[_0xa17b('0xf')](util[_0xa17b('0x14')]('Project\x20%s\x20not\x20found',_0x4ec38d['arg_1']));_0x4ec38d[_0xa17b('0x56')](_0x4ec38d[_0xa17b('0x49')],_0x4ec38d['extension'],parseInt(_0x4ec38d['priority'],0xa)+0x1);_0x4ec38d['close']();}}function main(){var _0x471cb2;return utilLicense[_0xa17b('0x59')]()[_0xa17b('0x31')](function(_0x5c6a15){if(_0x5c6a15){if(_0x5c6a15[_0xa17b('0x5a')]){if(_0x5c6a15[_0xa17b('0x5b')]&&_0x5c6a15['callysquare']>0x0){logger['info'](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x5c6a15['callysquare']));_0x471cb2=_0x5c6a15[_0xa17b('0x5b')];}else{logger[_0xa17b('0x13')](_0xa17b('0x5c'));}}else{logger[_0xa17b('0x13')](_0xa17b('0x5d'));_0x471cb2=-0x1;}}})[_0xa17b('0x33')](function(_0x3270a0){logger['error'](_0xa17b('0x5e'),_0x3270a0[_0xa17b('0x10')]);})[_0xa17b('0x53')](function(){var _0x2d744d=require(_0xa17b('0x5f'))(config[_0xa17b('0x6')][_0xa17b('0x12')],config[_0xa17b('0x6')]['ip'],_0x471cb2);_0x2d744d['on'](_0xa17b('0xf'),errorHandler);_0x2d744d['on'](_0xa17b('0x60'),listeningHandler);_0x2d744d['on'](_0xa17b('0x61'),connectionHandler);_0x2d744d['on'](_0xa17b('0x57'),closeHandler);});}main(); \ No newline at end of file +var _0x85d0=['gotoc','context','extension','priority','code','result','response','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','connection','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./graph','defaults','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\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','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','toJson','mxGraphModel','root','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','value','getSquareProject','then','catch','createSquareReport','agi_','substring','inspect','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','evtHangup','sync','production','start','debug','joinAt','clear','agicommand'];(function(_0x530330,_0x3028f1){var _0x36091e=function(_0x403749){while(--_0x403749){_0x530330['push'](_0x530330['shift']());}};_0x36091e(++_0x3028f1);}(_0x85d0,0x164));var _0x085d=function(_0x5a0b20,_0x66009a){_0x5a0b20=_0x5a0b20-0x0;var _0x5171bd=_0x85d0[_0x5a0b20];return _0x5171bd;};'use strict';var parser=require('xml2json');var _=require('lodash');var syncho=require('syncho');var util=require('util');var moment=require(_0x085d('0x0'));var config=require(_0x085d('0x1'));var logger=require(_0x085d('0x2'))(_0x085d('0x3'));var utilLicense=require(_0x085d('0x4'));var rpc=require(_0x085d('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0x085d('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x085d('0x3')]=_[_0x085d('0x7')](config[_0x085d('0x3')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0xf65d01){process[_0x085d('0x8')](function(){syncho(function(){try{setChannelVariables(_0xf65d01);agiHandler(_0xf65d01);}catch(_0x210aa0){logger[_0x085d('0x9')](_0x210aa0[_0x085d('0xa')]);}});});}function listeningHandler(){console[_0x085d('0xb')](_0x085d('0xc'),config[_0x085d('0x3')][_0x085d('0xd')]);logger['info'](util[_0x085d('0xe')](_0x085d('0xf'),config[_0x085d('0x3')]['ip'],config[_0x085d('0x3')]['port']));}function errorHandler(_0x2ac89a){if(_0x2ac89a&&_0x2ac89a[_0x085d('0x10')]&&_0x2ac89a['message']){logger[_0x085d('0x9')](util[_0x085d('0xe')](_0x085d('0x11'),_0x2ac89a[_0x085d('0x10')],_0x2ac89a['message']));}else{logger[_0x085d('0x9')](util[_0x085d('0xe')]('[ERROR]\x20%s',_0x2ac89a['stack']));}}function closeHandler(){logger[_0x085d('0x12')](util[_0x085d('0xe')](_0x085d('0x13'),this[_0x085d('0x14')],this[_0x085d('0x15')],this['callerid'],this[_0x085d('0x16')],this[_0x085d('0x17')]));try{createSquareReport(this);}catch(_0x1efea9){logger[_0x085d('0x9')](_0x1efea9[_0x085d('0xa')]);}}function timeoutHandler(){logger[_0x085d('0x12')](util[_0x085d('0xe')](_0x085d('0x18'),this[_0x085d('0x14')],this['calleridname'],this[_0x085d('0x19')],this[_0x085d('0x16')],this[_0x085d('0x17')]));}function hangupHandler(){logger[_0x085d('0x12')](util[_0x085d('0xe')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x085d('0x14')],this[_0x085d('0x15')],this[_0x085d('0x19')],this[_0x085d('0x16')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x4cdb11){return parser[_0x085d('0x1a')](_0x4cdb11,{'object':!![]})[_0x085d('0x1b')][_0x085d('0x1c')];}function addVertex(_0x10aa9d,_0x4715d6,_0x17dafb){_0x4715d6['agicommand']=_0x17dafb;if(_0x4715d6[_0x085d('0x1d')](_0x085d('0x1e'))){_0x4715d6[_0x085d('0x1f')]=parseInt(_0x4715d6['retry'],0xa);}_0x10aa9d[_0x085d('0x20')](_[_0x085d('0x21')](_0x4715d6,_0x085d('0x22')));}function initGraph(_0x31d807,_0x300295){var _0x4b9032=new Graph();for(var _0x5e5228 in _0x31d807){if(_0x31d807['hasOwnProperty'](_0x5e5228)){if(_[_0x085d('0x23')](_0x31d807[_0x5e5228])){for(var _0x102dfc=0x0;_0x102dfc<_0x31d807[_0x5e5228][_0x085d('0x24')];_0x102dfc+=0x1){addVertex(_0x4b9032,_0x31d807[_0x5e5228][_0x102dfc],_0x5e5228);}}else{addVertex(_0x4b9032,_0x31d807[_0x5e5228],_0x5e5228);}}}for(var _0x58afcf=0x0;_0x58afcf<_0x300295[_0x085d('0x24')];_0x58afcf+=0x1){if(_0x300295[_0x58afcf][_0x085d('0x25')]&&_0x300295[_0x58afcf][_0x085d('0x26')]){_0x4b9032['addEdge'](_0x300295[_0x58afcf][_0x085d('0x25')],_0x300295[_0x58afcf][_0x085d('0x26')],_0x300295[_0x58afcf][_0x085d('0x27')]);}}return _0x4b9032;}function getSquareProject(_0x26aa90,_0x4e37ad){rpc[_0x085d('0x28')](_0x26aa90)[_0x085d('0x29')](function(_0x494070){_0x4e37ad(null,_0x494070);})[_0x085d('0x2a')](function(_0x326a12){_0x4e37ad(null,_0x326a12);});}function createSquareReport(_0x4b0066,_0x2b8858){rpc[_0x085d('0x2b')](_0x4b0066)[_0x085d('0x29')](function(_0x4d14b4){if(_0x2b8858){_0x2b8858(null,_0x4d14b4);}})[_0x085d('0x2a')](function(_0x36bd27){if(_0x2b8858){_0x2b8858(null,_0x36bd27);}});}function setChannelVariables(_0x1e5cae){for(var _0x4ff325 in _0x1e5cae){if(_0x1e5cae[_0x085d('0x1d')](_0x4ff325)){if(_0x4ff325['indexOf'](_0x085d('0x2c'))===0x0){_0x1e5cae[_0x4ff325[_0x085d('0x2d')](0x4)]=_0x1e5cae[_0x4ff325];delete _0x1e5cae[_0x4ff325];}}}}function getLogFromObject(_0x142503){return util[_0x085d('0x2e')](_0x142503,{'showHidden':![],'depth':null});}function agiHandler(_0x5c71f3){var _0x1f6f72,_0xeb409e,_0x25461e,_0x7a776c,_0x54e579;logger['debug'](_0x085d('0x2f'),JSON[_0x085d('0x30')](_0x5c71f3,null,0x2));logger[_0x085d('0x12')](util[_0x085d('0xe')](_0x085d('0x31'),_0x5c71f3[_0x085d('0x14')],_0x5c71f3[_0x085d('0x15')],_0x5c71f3[_0x085d('0x19')],_0x5c71f3[_0x085d('0x16')],_0x5c71f3['uniqueid']));_0x5c71f3['on'](_0x085d('0x9'),errorHandler);_0x5c71f3['on'](_0x085d('0x32'),closeHandler);_0x5c71f3['on']('timeout',timeoutHandler);_0x5c71f3[_0x085d('0x33')]=![];_0x5c71f3['on']('hangup',hangupHandler);var _0x1cc755=getSquareProject[_0x085d('0x34')](null,_0x5c71f3['arg_1']);if(_0x1cc755){if(_0x1cc755[_0x085d('0x35')]){_0x1f6f72=getRoot(_0x1cc755[_0x085d('0x35')]);if(_0x1f6f72&&_0x1f6f72[_0x085d('0x36')]){logger[_0x085d('0x37')](_0x085d('0x1c'),JSON['stringify'](_0x1f6f72,null,0x2));_0x5c71f3[_0x085d('0x38')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xeb409e=initGraph(_[_0x085d('0x21')](_0x1f6f72,_0x085d('0x22')),_0x1f6f72[_0x085d('0x22')]);_0x25461e=new Vertices(_0x5c71f3,rpc,mailRpc);logger[_0x085d('0x12')](util[_0x085d('0xe')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5c71f3[_0x085d('0x14')],_0x5c71f3['calleridname'],_0x5c71f3[_0x085d('0x19')],_0x5c71f3[_0x085d('0x16')],_0x5c71f3[_0x085d('0x17')]));_0xeb409e['traverseBFS'](_0x1f6f72[_0x085d('0x36')]['id'],function(_0x55d81a){try{_0x55d81a=_0x25461e[_0x085d('0x39')](_0x55d81a);logger[_0x085d('0x37')]('vertex',JSON[_0x085d('0x30')](_0x55d81a,null,0x2));if(_0x55d81a[_0x085d('0x3a')]===_0x085d('0x3b')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x5c71f3[_0x085d('0x3c')]=_0x55d81a[_0x085d('0x3c')]||_0x5c71f3[_0x085d('0x3c')];_0x5c71f3[_0x085d('0x3d')]=_0x55d81a[_0x085d('0x3d')];_0x5c71f3[_0x085d('0x3e')]=_0x55d81a[_0x085d('0x3e')]?_0x55d81a[_0x085d('0x3e')]-0x1:0x1;return null;}else if(_0x55d81a&&_0x25461e[_0x55d81a[_0x085d('0x3a')]]){_0x54e579=_0x25461e[_0x55d81a[_0x085d('0x3a')]](_0x55d81a);logger['info']('response',JSON[_0x085d('0x30')](_0x54e579,null,0x2));if(_0x54e579&&_0x54e579[_0x085d('0x3f')]===AGI_CODE_SUCCESS&&_0x54e579[_0x085d('0x40')]!==AGI_RESULT_ERROR&&!_0x5c71f3[_0x085d('0x33')]){logger[_0x085d('0x37')](_0x085d('0x41'),getLogFromObject(_0x54e579));return _[_0x085d('0x42')](_0x54e579[_0x085d('0x40')])?null:_0x54e579[_0x085d('0x40')][_0x085d('0x43')]();}else{logger[_0x085d('0x9')]('response',getLogFromObject(_0x54e579));return null;}}else{logger[_0x085d('0x9')](_0x085d('0x44'));return null;}}catch(_0x1df88b){logger[_0x085d('0x9')](_0x1df88b[_0x085d('0xa')]);return null;}});if(_0x1f6f72['finally']){logger[_0x085d('0x12')](util['format'](_0x085d('0x45'),_0x5c71f3['arg_1'],_0x5c71f3['calleridname'],_0x5c71f3[_0x085d('0x19')],_0x5c71f3[_0x085d('0x16')],_0x5c71f3[_0x085d('0x17')]));_0xeb409e[_0x085d('0x46')](_0x1f6f72[_0x085d('0x47')]['id'],function(_0x52148f){try{_0x52148f=_0x25461e['clear'](_0x52148f);logger['debug']('vertex',JSON['stringify'](_0x52148f,null,0x2));if(_0x52148f&&_0x25461e[_0x52148f[_0x085d('0x3a')]]){_0x54e579=_0x25461e[_0x52148f[_0x085d('0x3a')]](_0x52148f);if(_0x54e579){logger['debug'](_0x085d('0x41'),getLogFromObject(_0x54e579));return _['isUndefined'](_0x54e579['result'])?null:_0x54e579[_0x085d('0x40')][_0x085d('0x43')]();}else{logger[_0x085d('0x9')](_0x085d('0x41'),getLogFromObject(_0x54e579));return null;}}else{logger['error'](_0x085d('0x44'));return null;}}catch(_0x5ec8dc){logger[_0x085d('0x9')](_0x5ec8dc[_0x085d('0xa')]);return null;}});}logger['info'](util[_0x085d('0xe')](_0x085d('0x48'),_0x5c71f3[_0x085d('0x14')],_0x5c71f3[_0x085d('0x15')],_0x5c71f3['callerid'],_0x5c71f3[_0x085d('0x16')],_0x5c71f3['uniqueid']));logger[_0x085d('0x12')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x5c71f3[_0x085d('0x3c')],_0x5c71f3[_0x085d('0x3d')],parseInt(_0x5c71f3[_0x085d('0x3e')],0xa)+0x1));_0x5c71f3[_0x085d('0x49')](_0x5c71f3[_0x085d('0x3c')],_0x5c71f3[_0x085d('0x3d')],parseInt(_0x5c71f3[_0x085d('0x3e')],0xa)+0x1);_0x5c71f3[_0x085d('0x32')]();}}else{logger['error'](util['format']('Project\x20%s\x20not\x20published',_0x5c71f3[_0x085d('0x14')]));_0x5c71f3['continueAt'](_0x5c71f3[_0x085d('0x3c')],_0x5c71f3['extension'],parseInt(_0x5c71f3[_0x085d('0x3e')],0xa)+0x1);_0x5c71f3[_0x085d('0x32')]();}}else{logger[_0x085d('0x9')](util[_0x085d('0xe')]('Project\x20%s\x20not\x20found',_0x5c71f3['arg_1']));_0x5c71f3[_0x085d('0x49')](_0x5c71f3[_0x085d('0x3c')],_0x5c71f3['extension'],parseInt(_0x5c71f3[_0x085d('0x3e')],0xa)+0x1);_0x5c71f3[_0x085d('0x32')]();}}function main(){var _0x357661;return utilLicense[_0x085d('0x4a')]()[_0x085d('0x29')](function(_0xc5464e){if(_0xc5464e){if(_0xc5464e[_0x085d('0x4b')]){if(_0xc5464e[_0x085d('0x4c')]&&_0xc5464e['callysquare']>0x0){logger[_0x085d('0x12')](util['format'](_0x085d('0x4d'),_0xc5464e['callysquare']));_0x357661=_0xc5464e[_0x085d('0x4c')];}else{logger['info'](_0x085d('0x4e'));}}else{logger[_0x085d('0x12')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x357661=-0x1;}}})['catch'](function(_0x313506){logger[_0x085d('0x9')](_0x085d('0x4f'),_0x313506[_0x085d('0xa')]);})[_0x085d('0x47')](function(){var _0x1165b0=require(_0x085d('0x50'))(config[_0x085d('0x3')][_0x085d('0xd')],config[_0x085d('0x3')]['ip'],_0x357661);_0x1165b0['on'](_0x085d('0x9'),errorHandler);_0x1165b0['on'](_0x085d('0x51'),listeningHandler);_0x1165b0['on'](_0x085d('0x52'),connectionHandler);_0x1165b0['on'](_0x085d('0x32'),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 3b58789..c998cb8 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(_0x198cc4,_0x334fb6){var _0x134413=function(_0x2717c1){while(--_0x2717c1){_0x198cc4['push'](_0x198cc4['shift']());}};_0x134413(++_0x334fb6);}(_0x34e8,0x12c));var _0x834e=function(_0x2ffc84,_0x52b224){_0x2ffc84=_0x2ffc84-0x0;var _0x29a9e5=_0x34e8[_0x2ffc84];return _0x29a9e5;};'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(_0x53a4d7,_0x4aceeb){var _0x18030b=function(_0x1e4386){while(--_0x1e4386){_0x53a4d7['push'](_0x53a4d7['shift']());}};_0x18030b(++_0x4aceeb);}(_0x34e8,0x12c));var _0x834e=function(_0x1a543b,_0x34afca){_0x1a543b=_0x1a543b-0x0;var _0x518bba=_0x34e8[_0x1a543b];return _0x518bba;};'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 a2a29fb..28ea626 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x47bf54,_0x327a53){var _0x2b75bc=function(_0x4dbcd){while(--_0x4dbcd){_0x47bf54['push'](_0x47bf54['shift']());}};_0x2b75bc(++_0x327a53);}(_0x7a54,0x106));var _0x47a5=function(_0x33fccd,_0xc75fa3){_0x33fccd=_0x33fccd-0x0;var _0xa63a43=_0x7a54[_0x33fccd];return _0xa63a43;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x149c07,_0x181628){var _0x158124=function(_0x5e2cae){while(--_0x5e2cae){_0x149c07['push'](_0x149c07['shift']());}};_0x158124(++_0x181628);}(_0x5f2f,0x73));var _0xf5f2=function(_0x22340d,_0x29e79b){_0x22340d=_0x22340d-0x0;var _0xac4f48=_0x5f2f[_0x22340d];return _0xac4f48;};'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 b2ff84d..550fe83 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 _0x26fb=['createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','request','then','error','message','result','catch','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x26fb,0x1f4));var _0xb26f=function(_0x58fe01,_0x42ccdf){_0x58fe01=_0x58fe01-0x0;var _0x758a11=_0x26fb[_0x58fe01];return _0x758a11;};'use strict';var BPromise=require(_0xb26f('0x0'));var moment=require(_0xb26f('0x1'));var _=require(_0xb26f('0x2'));var util=require(_0xb26f('0x3'));var jayson=require(_0xb26f('0x4'));var client=jayson[_0xb26f('0x5')][_0xb26f('0x6')]({'port':0x2329});function request(_0x150c69,_0x5ac713){return new BPromise(function(_0xa7193e,_0x1c50e8){return client[_0xb26f('0x7')](_0x150c69,_0x5ac713)[_0xb26f('0x8')](function(_0x227c7f){if(_0x227c7f['error']){return _0x1c50e8(_0x227c7f[_0xb26f('0x9')][_0xb26f('0xa')]);}else{return _0xa7193e(_0x227c7f[_0xb26f('0xb')]);}})[_0xb26f('0xc')](function(_0x429448){return _0x1c50e8(_0x429448);});});}exports['getSquareProject']=function(_0x11f0d9){return request(_0xb26f('0xd'),{'options':{'raw':![],'where':{'name':_0x11f0d9},'attributes':[_0xb26f('0xe')]}});};exports[_0xb26f('0xf')]=function(_0x229e29){return request(_0xb26f('0x10'),{'options':{'raw':![],'where':{'id':_0x229e29},'include':[{'model':_0xb26f('0x11'),'as':_0xb26f('0x12')}],'attributes':['id',_0xb26f('0x13'),_0xb26f('0x14')]}});};exports[_0xb26f('0x15')]=function(_0x41a66d){return request(_0xb26f('0xd'),{'options':{'where':{'id':_0x41a66d},'attributes':[_0xb26f('0x13')]}});};exports['getVoiceQueueById']=function(_0x258d9f){return request(_0xb26f('0x16'),{'options':{'where':{'id':_0x258d9f},'attributes':[_0xb26f('0x13')]}});};exports[_0xb26f('0x17')]=function(_0x105399){return request(_0xb26f('0x18'),{'options':{'where':{'id':_0x105399},'attributes':[_0xb26f('0x13')]}});};exports['getSquareOdbcById']=function(_0x50132c){return request(_0xb26f('0x19'),{'options':{'where':{'id':_0x50132c},'attributes':[_0xb26f('0x1a')]}});};exports[_0xb26f('0x1b')]=function(_0x3d149e){return request('ShowUser',{'options':{'where':{'id':_0x3d149e},'attributes':[_0xb26f('0x13')]}});};exports[_0xb26f('0x1c')]=function(_0x50676b){return request('ShowTrunk',{'options':{'where':{'id':_0x50676b},'attributes':[_0xb26f('0x13')]}});};exports[_0xb26f('0x1d')]=function(_0x50fd0b){return request(_0xb26f('0x1e'),{'options':{'where':{'id':_0x50fd0b},'attributes':[_0xb26f('0x1f')]}});};exports[_0xb26f('0x20')]=function(_0xebb0c1){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0xebb0c1},'include':[{'model':_0xb26f('0x21'),'as':'Intervals'}]}});};exports[_0xb26f('0x22')]=function(_0x2a6161){return request(_0xb26f('0x23'),{'options':{'where':{'id':_0x2a6161},'attributes':['id','name']}});};exports[_0xb26f('0x24')]=function(_0x50458e){return request(_0xb26f('0x25'),{'body':_0x50458e});};exports['createSquareDetailsReport']=function(_0x17957f){return request(_0xb26f('0x26'),{'body':_0x17957f});};exports[_0xb26f('0x27')]=function(_0x4a7cdb){return request(_0xb26f('0x28'),{'body':_[_0xb26f('0x29')](_0x4a7cdb,{'project_name':_0x4a7cdb[_0xb26f('0x2a')],'prev_project_name':_0x4a7cdb[_0xb26f('0x2b')]||'','is_subproject':_0x4a7cdb['arg_2']?!![]:![],'leaveAt':moment()[_0xb26f('0x2c')](_0xb26f('0x2d'))})});};exports[_0xb26f('0x2e')]=function(_0x2a2eaa){return request(_0xb26f('0x2f'),{'body':_0x2a2eaa});};exports['createSquareMessage']=function(_0x9ad749){return request(_0xb26f('0x30'),{'body':_0x9ad749});};exports[_0xb26f('0x31')]=function(_0x3a375f){return request(_0xb26f('0x32'),{'options':{'raw':![],'where':{'phone':_0x3a375f[_0xb26f('0x33')],'ListId':_0x3a375f[_0xb26f('0x34')]}}})[_0xb26f('0x8')](function(_0x5f1fb5){if(_0x5f1fb5){return _0x5f1fb5;}return request(_0xb26f('0x35'),{'body':_0x3a375f});});};exports[_0xb26f('0x36')]=function(_0x415bff){return request('ShowPause',{'options':{'where':{'id':_0x415bff},'attributes':['name']}});};exports[_0xb26f('0x37')]=function(_0xbf3c8b,_0x7d2230){return request(_0xb26f('0x38'),{'body':{'interface':_0x7d2230},'options':{'where':_0xbf3c8b}});};exports[_0xb26f('0x39')]=function(_0x48cc41,_0x3e0faf,_0x1737ed){return request('PauseUser',{'body':{'type':_0x3e0faf,'uniqueid':_0x1737ed},'options':{'where':_0x48cc41}});};exports[_0xb26f('0x3a')]=function(_0x1c40ae){return request(_0xb26f('0x3b'),{'body':{},'options':{'where':_0x1c40ae}});};exports['agentLogout']=function(_0x26cc08){return request(_0xb26f('0x3c'),{'body':{},'options':{'where':_0x26cc08}});}; \ No newline at end of file +var _0x9aa2=['arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','bluebird','lodash','jayson/promise','http','then','error','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','ShowSquareOdbc','getUserById','ShowUser','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge'];(function(_0x5279cb,_0x1601be){var _0x55785a=function(_0x33fd36){while(--_0x33fd36){_0x5279cb['push'](_0x5279cb['shift']());}};_0x55785a(++_0x1601be);}(_0x9aa2,0x125));var _0x29aa=function(_0x536710,_0x3c0d99){_0x536710=_0x536710-0x0;var _0x2ee6a8=_0x9aa2[_0x536710];return _0x2ee6a8;};'use strict';var BPromise=require(_0x29aa('0x0'));var moment=require('moment');var _=require(_0x29aa('0x1'));var util=require('util');var jayson=require(_0x29aa('0x2'));var client=jayson['client'][_0x29aa('0x3')]({'port':0x2329});function request(_0x42693a,_0x57769d){return new BPromise(function(_0x45082b,_0x1f8950){return client['request'](_0x42693a,_0x57769d)[_0x29aa('0x4')](function(_0xcbbf34){if(_0xcbbf34[_0x29aa('0x5')]){return _0x1f8950(_0xcbbf34['error']['message']);}else{return _0x45082b(_0xcbbf34['result']);}})[_0x29aa('0x6')](function(_0x4e08d2){return _0x1f8950(_0x4e08d2);});});}exports[_0x29aa('0x7')]=function(_0x707f8){return request(_0x29aa('0x8'),{'options':{'raw':![],'where':{'name':_0x707f8},'attributes':[_0x29aa('0x9')]}});};exports[_0x29aa('0xa')]=function(_0x52385a){return request(_0x29aa('0xb'),{'options':{'raw':![],'where':{'id':_0x52385a},'include':[{'model':_0x29aa('0xc'),'as':'Smtp'}],'attributes':['id',_0x29aa('0xd'),_0x29aa('0xe')]}});};exports[_0x29aa('0xf')]=function(_0x1bafb0){return request(_0x29aa('0x8'),{'options':{'where':{'id':_0x1bafb0},'attributes':[_0x29aa('0xd')]}});};exports[_0x29aa('0x10')]=function(_0xee1459){return request(_0x29aa('0x11'),{'options':{'where':{'id':_0xee1459},'attributes':[_0x29aa('0xd')]}});};exports['getVariableById']=function(_0x138ee4){return request(_0x29aa('0x12'),{'options':{'where':{'id':_0x138ee4},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x1455fb){return request(_0x29aa('0x13'),{'options':{'where':{'id':_0x1455fb},'attributes':['dsn']}});};exports[_0x29aa('0x14')]=function(_0x5a866a){return request(_0x29aa('0x15'),{'options':{'where':{'id':_0x5a866a},'attributes':[_0x29aa('0xd')]}});};exports['getTrunkById']=function(_0x41425c){return request(_0x29aa('0x16'),{'options':{'where':{'id':_0x41425c},'attributes':[_0x29aa('0xd')]}});};exports[_0x29aa('0x17')]=function(_0x35635d){return request(_0x29aa('0x18'),{'options':{'where':{'id':_0x35635d},'attributes':[_0x29aa('0x19')]}});};exports[_0x29aa('0x1a')]=function(_0x26f8e1){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x26f8e1},'include':[{'model':_0x29aa('0x1b'),'as':_0x29aa('0x1c')}]}});};exports['getSmsAccountById']=function(_0x45bc1a){return request(_0x29aa('0x1d'),{'options':{'where':{'id':_0x45bc1a},'attributes':['id',_0x29aa('0xd')]}});};exports[_0x29aa('0x1e')]=function(_0x30b500){return request(_0x29aa('0x1f'),{'body':_0x30b500});};exports[_0x29aa('0x20')]=function(_0xca24f6){return request(_0x29aa('0x21'),{'body':_0xca24f6});};exports[_0x29aa('0x22')]=function(_0x225875){return request(_0x29aa('0x23'),{'body':_[_0x29aa('0x24')](_0x225875,{'project_name':_0x225875[_0x29aa('0x25')],'prev_project_name':_0x225875['arg_2']||'','is_subproject':_0x225875[_0x29aa('0x26')]?!![]:![],'leaveAt':moment()[_0x29aa('0x27')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x29aa('0x28')]=function(_0x90596a){return request(_0x29aa('0x29'),{'body':_0x90596a});};exports[_0x29aa('0x2a')]=function(_0x3c611f){return request(_0x29aa('0x2b'),{'body':_0x3c611f});};exports[_0x29aa('0x2c')]=function(_0x5ef7e2){return request(_0x29aa('0x2d'),{'options':{'raw':![],'where':{'phone':_0x5ef7e2[_0x29aa('0x2e')],'ListId':_0x5ef7e2['ListId']}}})[_0x29aa('0x4')](function(_0x140558){if(_0x140558){return _0x140558;}return request(_0x29aa('0x2f'),{'body':_0x5ef7e2});});};exports[_0x29aa('0x30')]=function(_0x48fe09){return request('ShowPause',{'options':{'where':{'id':_0x48fe09},'attributes':[_0x29aa('0xd')]}});};exports[_0x29aa('0x31')]=function(_0x1140b4,_0xfa5a79){return request(_0x29aa('0x32'),{'body':{'interface':_0xfa5a79},'options':{'where':_0x1140b4}});};exports[_0x29aa('0x33')]=function(_0x18e60a,_0x1c4aa2,_0x1ab5d1){return request('PauseUser',{'body':{'type':_0x1c4aa2,'uniqueid':_0x1ab5d1},'options':{'where':_0x18e60a}});};exports[_0x29aa('0x34')]=function(_0x297ad9){return request(_0x29aa('0x35'),{'body':{},'options':{'where':_0x297ad9}});};exports[_0x29aa('0x36')]=function(_0x105fd9){return request('LogoutUser',{'body':{},'options':{'where':_0x105fd9}});}; \ 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 8acc66b..37262ad 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 _0xbec5=['./lex','./polly'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0xbec5,0xe5));var _0x5bec=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0xbec5[_0x1e6db3];return _0x1de886;};var polly=require(_0x5bec('0x0'));var lex=require(_0x5bec('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xaba6=['./polly','./lex'];(function(_0x2f1114,_0x4561f1){var _0x2fe856=function(_0x8397f8){while(--_0x8397f8){_0x2f1114['push'](_0x2f1114['shift']());}};_0x2fe856(++_0x4561f1);}(_0xaba6,0xe2));var _0x6aba=function(_0x4ae32d,_0x256489){_0x4ae32d=_0x4ae32d-0x0;var _0x550537=_0xaba6[_0x4ae32d];return _0x550537;};var polly=require(_0x6aba('0x0'));var lex=require(_0x6aba('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 8aafa47..68bbc02 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 _0x8db0=['exports','./lib/api'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x8db0,0x65));var _0x08db=function(_0x14e27a,_0x3b4136){_0x14e27a=_0x14e27a-0x0;var _0x288688=_0x8db0[_0x14e27a];return _0x288688;};'use strict';var lex=require(_0x08db('0x0'));module[_0x08db('0x1')]=function(_0x50fae4,_0x6e32bb,_0x2ac694,_0x17ccf3,_0x5eb423,_0x3b5170){return lex(_0x50fae4,_0x6e32bb,_0x2ac694,_0x17ccf3,_0x5eb423,_0x3b5170);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x3189a3,_0x16bda9,_0x421661,_0x386bc3,_0x1c0219,_0x5f000c){return lex(_0x3189a3,_0x16bda9,_0x421661,_0x386bc3,_0x1c0219,_0x5f000c);}; \ 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 2b148db..03c4816 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 _0x03bd=['exports','LexRuntime','$LATEST','slots','hasOwnProperty','slot_'];(function(_0x4cb8f9,_0x52e713){var _0x4d4f9f=function(_0x4719d3){while(--_0x4719d3){_0x4cb8f9['push'](_0x4cb8f9['shift']());}};_0x4d4f9f(++_0x52e713);}(_0x03bd,0x11d));var _0xd03b=function(_0xe7e717,_0x54e93f){_0xe7e717=_0xe7e717-0x0;var _0x3d55a1=_0x03bd[_0xe7e717];return _0x3d55a1;};'use strict';var BPromise=require('bluebird');var AWS=require('aws-sdk');function lexResult(_0x378aa3,_0xf3916d){return new BPromise(function(_0x2d3699,_0x1ab310){_0x378aa3['postText'](_0xf3916d,function(_0x1fd5dd,_0x53bcde){if(_0x1fd5dd){_0x1ab310(_0x1fd5dd);}if(_0x53bcde[_0xd03b('0x0')]){for(const _0x55c66a in _0x53bcde[_0xd03b('0x0')]){if(_0x53bcde[_0xd03b('0x0')][_0xd03b('0x1')](_0x55c66a)){var _0x5292d9=_0x53bcde['slots'][_0x55c66a];_0x53bcde[_0xd03b('0x2')+_0x55c66a]=_0x5292d9;}}}_0x2d3699(_0x53bcde);});});}module[_0xd03b('0x3')]=function(_0x1d7de2,_0x1b501e,_0x46f37a,_0x458a32,_0x256c50,_0x121d02){var _0x1ba2f2=new AWS[(_0xd03b('0x4'))]({'accessKeyId':_0x1b501e,'secretAccessKey':_0x46f37a,'region':_0x458a32});var _0x59ec60={'botAlias':_0xd03b('0x5'),'botName':_0x121d02,'inputText':_0x256c50,'userId':_0x1d7de2};return lexResult(_0x1ba2f2,_0x59ec60);}; \ No newline at end of file +var _0x7a08=['slots','hasOwnProperty','slot_','exports','LexRuntime','$LATEST','bluebird','aws-sdk','postText'];(function(_0x184b12,_0x9020f0){var _0x1ea2ae=function(_0x3b3575){while(--_0x3b3575){_0x184b12['push'](_0x184b12['shift']());}};_0x1ea2ae(++_0x9020f0);}(_0x7a08,0xc3));var _0x87a0=function(_0x3c9a89,_0x378778){_0x3c9a89=_0x3c9a89-0x0;var _0x1eb47b=_0x7a08[_0x3c9a89];return _0x1eb47b;};'use strict';var BPromise=require(_0x87a0('0x0'));var AWS=require(_0x87a0('0x1'));function lexResult(_0x32e625,_0x20131b){return new BPromise(function(_0x41c329,_0x5ad8c2){_0x32e625[_0x87a0('0x2')](_0x20131b,function(_0x2ffe4d,_0x3ba9ec){if(_0x2ffe4d){_0x5ad8c2(_0x2ffe4d);}if(_0x3ba9ec[_0x87a0('0x3')]){for(const _0x2e981f in _0x3ba9ec['slots']){if(_0x3ba9ec[_0x87a0('0x3')][_0x87a0('0x4')](_0x2e981f)){var _0x3b71cb=_0x3ba9ec[_0x87a0('0x3')][_0x2e981f];_0x3ba9ec[_0x87a0('0x5')+_0x2e981f]=_0x3b71cb;}}}_0x41c329(_0x3ba9ec);});});}module[_0x87a0('0x6')]=function(_0x32e602,_0x21169d,_0x127246,_0xb72230,_0x27bc51,_0x38bd71){var _0x481d28=new AWS[(_0x87a0('0x7'))]({'accessKeyId':_0x21169d,'secretAccessKey':_0x127246,'region':_0xb72230});var _0x1e9290={'botAlias':_0x87a0('0x8'),'botName':_0x38bd71,'inputText':_0x27bc51,'userId':_0x32e602};return lexResult(_0x481d28,_0x1e9290);}; \ 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 4378b19..f7bca74 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 _0x1024=['exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x1024,0x107));var _0x4102=function(_0x56e1c3,_0x4fe9f3){_0x56e1c3=_0x56e1c3-0x0;var _0x429e77=_0x1024[_0x56e1c3];return _0x429e77;};'use strict';var polly=require('./lib/api');module[_0x4102('0x0')]=function(_0x22f93b,_0x50fd2f,_0x281c29,_0x45154e,_0x48f0fa,_0x18d44c,_0xcb7bf6){return polly(_0x22f93b,_0x50fd2f,_0x281c29,_0x45154e,_0x48f0fa,_0x18d44c,_0xcb7bf6);}; \ No newline at end of file +var _0x9fba=['./lib/api'];(function(_0x9a66d6,_0x3ee788){var _0x193964=function(_0x29b4b1){while(--_0x29b4b1){_0x9a66d6['push'](_0x9a66d6['shift']());}};_0x193964(++_0x3ee788);}(_0x9fba,0x11f));var _0xa9fb=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x9fba[_0x1e7b16];return _0x37fadc;};'use strict';var polly=require(_0xa9fb('0x0'));module['exports']=function(_0x10ac51,_0x227c27,_0x1fd9bb,_0x56c84a,_0x1d4df6,_0x481c65,_0x5d444d){return polly(_0x10ac51,_0x227c27,_0x1fd9bb,_0x56c84a,_0x1d4df6,_0x481c65,_0x5d444d);}; \ 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 e6969b8..661d21a 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 _0xb6b0=['path','bluebird','randomstring','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xb6b0,0x1c2));var _0x0b6b=function(_0x164905,_0x239fb9){_0x164905=_0x164905-0x0;var _0x43ce40=_0xb6b0[_0x164905];return _0x43ce40;};'use strict';var fs=require('fs');var path=require(_0x0b6b('0x0'));var BPromise=require(_0x0b6b('0x1'));var rs=require(_0x0b6b('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x3e9277,_0x5dd590,_0x587b32){return new BPromise(function(_0x2fe89e,_0x1e9801){_0x3e9277['synthesizeSpeech'](_0x5dd590,function(_0x3f46a8,_0x440417){if(_0x3f46a8){_0x1e9801(_0x3f46a8);}else if(_0x440417){if(_0x440417['AudioStream']instanceof Buffer){fs[_0x0b6b('0x3')](_0x587b32,_0x440417[_0x0b6b('0x4')],function(_0x1a565a){if(_0x1a565a){_0x1e9801(_0x1a565a);}else{_0x2fe89e();}});}else{_0x1e9801(new Error(_0x0b6b('0x5')));}}else{_0x1e9801(new Error(_0x0b6b('0x6')));}});});}module[_0x0b6b('0x7')]=function(_0x50aade,_0x2af7bf,_0x32374c,_0x1bb676,_0x4b6cbf,_0x4a7edf,_0x4c509d){var _0x4ae8c1=new AWS[(_0x0b6b('0x8'))]({'accessKeyId':_0x50aade,'secretAccessKey':_0x2af7bf,'region':_0x32374c});var _0x2699fc={'Text':_0x4b6cbf,'TextType':_0x4a7edf||_0x0b6b('0x9'),'OutputFormat':'mp3','VoiceId':_0x1bb676};return pollyResult(_0x4ae8c1,_0x2699fc,_0x4c509d);}; \ No newline at end of file +var _0xe545=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x11d1b9,_0x56c58f){var _0x46c020=function(_0x154bad){while(--_0x154bad){_0x11d1b9['push'](_0x11d1b9['shift']());}};_0x46c020(++_0x56c58f);}(_0xe545,0x171));var _0x5e54=function(_0x2006c9,_0x1100db){_0x2006c9=_0x2006c9-0x0;var _0x2d61d1=_0xe545[_0x2006c9];return _0x2d61d1;};'use strict';var fs=require('fs');var path=require(_0x5e54('0x0'));var BPromise=require(_0x5e54('0x1'));var rs=require(_0x5e54('0x2'));var AWS=require(_0x5e54('0x3'));function pollyResult(_0x528942,_0x2163e0,_0x9c0e4b){return new BPromise(function(_0x268999,_0x165ff4){_0x528942[_0x5e54('0x4')](_0x2163e0,function(_0x2bbc79,_0x54475b){if(_0x2bbc79){_0x165ff4(_0x2bbc79);}else if(_0x54475b){if(_0x54475b[_0x5e54('0x5')]instanceof Buffer){fs[_0x5e54('0x6')](_0x9c0e4b,_0x54475b[_0x5e54('0x5')],function(_0x1f0ae3){if(_0x1f0ae3){_0x165ff4(_0x1f0ae3);}else{_0x268999();}});}else{_0x165ff4(new Error(_0x5e54('0x7')));}}else{_0x165ff4(new Error(_0x5e54('0x8')));}});});}module[_0x5e54('0x9')]=function(_0x58eca0,_0x19ef89,_0xc0d410,_0x48287e,_0x134173,_0x3a78e9,_0x5d71a4){var _0x5905a6=new AWS[(_0x5e54('0xa'))]({'accessKeyId':_0x58eca0,'secretAccessKey':_0x19ef89,'region':_0xc0d410});var _0x1d93e3={'Text':_0x134173,'TextType':_0x3a78e9||_0x5e54('0xb'),'OutputFormat':_0x5e54('0xc'),'VoiceId':_0x48287e};return pollyResult(_0x5905a6,_0x1d93e3,_0x5d71a4);}; \ 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 f2ee211..e6aa3fe 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 _0x046c=['./lib/api'];(function(_0x468c03,_0x190103){var _0x5b12ba=function(_0xcc8da0){while(--_0xcc8da0){_0x468c03['push'](_0x468c03['shift']());}};_0x5b12ba(++_0x190103);}(_0x046c,0x13f));var _0xc046=function(_0x286305,_0x413532){_0x286305=_0x286305-0x0;var _0x130437=_0x046c[_0x286305];return _0x130437;};'use strict';var asr=require(_0xc046('0x0'));module['exports']=function(_0x4db6ab,_0x5dfb03,_0x4ef052,_0x2e0946){return asr(_0x4db6ab,_0x5dfb03,_0x4ef052);}; \ No newline at end of file +var _0x4ac4=['exports','./lib/api'];(function(_0x1076e1,_0x162f7c){var _0x1c3d54=function(_0x5a9a81){while(--_0x5a9a81){_0x1076e1['push'](_0x1076e1['shift']());}};_0x1c3d54(++_0x162f7c);}(_0x4ac4,0x19b));var _0x44ac=function(_0x550040,_0x47a2f5){_0x550040=_0x550040-0x0;var _0x3667cb=_0x4ac4[_0x550040];return _0x3667cb;};'use strict';var asr=require(_0x44ac('0x0'));module[_0x44ac('0x1')]=function(_0x45812f,_0x43ad5a,_0xbd9fb0,_0xf0fd87){return asr(_0x45812f,_0x43ad5a,_0xbd9fb0);}; \ 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 117db10..a7fc51c 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 _0x1c50=['length','filepath\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','base64','POST','/v1/speech:recognize?key=','url','bluebird','exports','string'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x1c50,0x146));var _0x01c5=function(_0x5d9bd8,_0x3c9231){_0x5d9bd8=_0x5d9bd8-0x0;var _0x58d5fc=_0x1c50[_0x5d9bd8];return _0x58d5fc;};'use strict';var url=require(_0x01c5('0x0'));var BPromise=require(_0x01c5('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x01c5('0x2')]=function(_0x28c2a6,_0x3aa594,_0x42fd54){return new BPromise(function(_0x59643f,_0x34b913){var _0x134bcc;if(typeof _0x28c2a6!==_0x01c5('0x3')||_0x28c2a6[_0x01c5('0x4')]===0x0){return _0x34b913(_0x01c5('0x5'));}if(typeof _0x3aa594!==_0x01c5('0x3')||_0x3aa594[_0x01c5('0x4')]===0x0){return _0x34b913('key\x20should\x20be\x20a\x20string');}if(typeof _0x42fd54!=='undefined'&&(typeof _0x42fd54!==_0x01c5('0x3')||_0x42fd54['length']===0x0)){return _0x34b913(_0x01c5('0x6'));}try{_0x134bcc=fs['readFileSync'](_0x28c2a6)['toString'](_0x01c5('0x7'));}catch(_0xb37d4b){return _0x34b913(_0xb37d4b);}return _0x59643f({'method':_0x01c5('0x8'),'uri':host+_0x01c5('0x9')+_0x3aa594,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x42fd54},'audio':{'content':_0x134bcc}},'json':!![]});});}; \ No newline at end of file +var _0xf6da=['key\x20should\x20be\x20a\x20string','undefined','base64','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','string','length'];(function(_0x2b9028,_0x1780e2){var _0x36032b=function(_0xfe9103){while(--_0xfe9103){_0x2b9028['push'](_0x2b9028['shift']());}};_0x36032b(++_0x1780e2);}(_0xf6da,0x1e5));var _0xaf6d=function(_0x31ca19,_0x58d80d){_0x31ca19=_0x31ca19-0x0;var _0x291405=_0xf6da[_0x31ca19];return _0x291405;};'use strict';var url=require(_0xaf6d('0x0'));var BPromise=require(_0xaf6d('0x1'));var fs=require('fs');var host=_0xaf6d('0x2');module['exports']=function(_0x5e512a,_0x28bc0d,_0x1f4910){return new BPromise(function(_0x42d4d3,_0xc2f09c){var _0x9d5541;if(typeof _0x5e512a!==_0xaf6d('0x3')||_0x5e512a[_0xaf6d('0x4')]===0x0){return _0xc2f09c('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x28bc0d!==_0xaf6d('0x3')||_0x28bc0d[_0xaf6d('0x4')]===0x0){return _0xc2f09c(_0xaf6d('0x5'));}if(typeof _0x1f4910!==_0xaf6d('0x6')&&(typeof _0x1f4910!==_0xaf6d('0x3')||_0x1f4910[_0xaf6d('0x4')]===0x0)){return _0xc2f09c('lang\x20should\x20be\x20a\x20string');}try{_0x9d5541=fs['readFileSync'](_0x5e512a)['toString'](_0xaf6d('0x7'));}catch(_0xd5c4de){return _0xc2f09c(_0xd5c4de);}return _0x42d4d3({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x28bc0d,'body':{'config':{'encoding':_0xaf6d('0x8'),'sampleRateHertz':_0xaf6d('0x9'),'languageCode':_0x1f4910},'audio':{'content':_0x9d5541}},'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 a284044..37f3169 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 _0x47cb=['./asr','exports'];(function(_0x46ec78,_0x2642cc){var _0x4a622e=function(_0x43df3a){while(--_0x43df3a){_0x46ec78['push'](_0x46ec78['shift']());}};_0x4a622e(++_0x2642cc);}(_0x47cb,0x74));var _0xb47c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x47cb[_0x3dd15e];return _0x231fd0;};var asr=require(_0xb47c('0x0'));module[_0xb47c('0x1')]={'asr':asr}; \ No newline at end of file +var _0x6c00=['exports','./asr'];(function(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0x6c00,0x1a9));var _0x06c0=function(_0x5be795,_0x1cb1b8){_0x5be795=_0x5be795-0x0;var _0x4e8a3b=_0x6c00[_0x5be795];return _0x4e8a3b;};var asr=require(_0x06c0('0x0'));module[_0x06c0('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 42449d9..bd1d849 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 _0x98d5=['Tilde\x20ASR\x20confidence','awsPolly','lex','stringify','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','text','channelData','CustomAction','AudioFromTts','audiofile','dirName','path','http','https','url','parse','bluebird','randomstring','sox','request-promise','querystring','google-tts-api','apiai-promise','md5','./google','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','WHAT_EVER','wav','finish\x20to\x20convert','tmp','generate','.wav','writeFileSync','base64','then','777','split','readFileSync','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','audioContent','writeFile','resolve','googleCloudTTS\x20path','googleTTS','chmodSync','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription'];(function(_0x15a2b9,_0x3383f3){var _0x5c26bd=function(_0x59220d){while(--_0x59220d){_0x15a2b9['push'](_0x15a2b9['shift']());}};_0x5c26bd(++_0x3383f3);}(_0x98d5,0x157));var _0x598d=function(_0x3f3487,_0x1b497c){_0x3f3487=_0x3f3487-0x0;var _0x46d126=_0x98d5[_0x3f3487];return _0x46d126;};'use strict';var fs=require('fs');var path=require(_0x598d('0x0'));var http=require(_0x598d('0x1'));var https=require(_0x598d('0x2'));var urlParse=require(_0x598d('0x3'))[_0x598d('0x4')];var BPromise=require(_0x598d('0x5'));var rs=require(_0x598d('0x6'));var sox=require(_0x598d('0x7'));var rp=require(_0x598d('0x8'));var util=require('util');var querystring=require(_0x598d('0x9'));var tts=require(_0x598d('0xa'));var apiai=require(_0x598d('0xb'));var md5=require(_0x598d('0xc'));var google=require(_0x598d('0xd'));var aws=require('./aws');var tilde=require('./tilde');var sestek=require('./sestek');var logger=require(_0x598d('0xe'))(_0x598d('0xf'));var ISPEECH_API=_0x598d('0x10');function downloadFile(_0x1373e4,_0x589752){return new BPromise(function(_0x1c62d7,_0x55146d){var _0xec0cb5=urlParse(_0x1373e4);var _0x18df63=_0xec0cb5[_0x598d('0x11')]===_0x598d('0x12')?https:http;var _0x5e4ae1={'host':_0xec0cb5[_0x598d('0x13')],'path':_0xec0cb5['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x18df63[_0x598d('0x14')](_0x5e4ae1,function(_0x1c3f8d){if(_0x1c3f8d[_0x598d('0x15')]!==0xc8){logger[_0x598d('0x16')](_0x598d('0x17')+_0x1373e4+_0x598d('0x18')+_0x1c3f8d[_0x598d('0x15')]+'\x20('+_0x1c3f8d['statusMessage']+')');_0x55146d(new Error('request\x20to\x20'+_0x1373e4+_0x598d('0x18')+_0x1c3f8d[_0x598d('0x15')]+'\x20('+_0x1c3f8d[_0x598d('0x19')]+')'));return;}var _0x26de43=fs[_0x598d('0x1a')](_0x589752);_0x26de43['on']('finish',function(){logger[_0x598d('0x1b')](_0x598d('0x1c'));_0x26de43[_0x598d('0x1d')](_0x1c62d7);});_0x26de43['on']('error',function(_0x3b853c){fs[_0x598d('0x1e')](_0x589752);logger['error'](_0x598d('0x1f'),_0x3b853c);_0x55146d(_0x3b853c);});_0x1c3f8d[_0x598d('0x20')](_0x26de43);})['on'](_0x598d('0x16'),function(_0x3ee609){logger[_0x598d('0x16')](_0x3ee609);_0x55146d(_0x3ee609);})[_0x598d('0x21')]();});}function uploadFile(_0x530d50){return new BPromise(function(_0x33f68e,_0x5d2d84){var _0x54b2bf=urlParse(_0x530d50);var _0x3fbe6b=_0x54b2bf[_0x598d('0x11')]===_0x598d('0x12')?https:http;var _0x29074e={'host':_0x54b2bf[_0x598d('0x13')],'path':_0x54b2bf[_0x598d('0x0')],'headers':{'user-agent':_0x598d('0x22')}};_0x3fbe6b[_0x598d('0x14')](_0x29074e,function(_0x3cd184){if(_0x3cd184['statusCode']!==0xc8){_0x5d2d84(new Error(_0x598d('0x17')+_0x530d50+_0x598d('0x18')+_0x3cd184[_0x598d('0x15')]+'\x20('+_0x3cd184['statusMessage']+')'));return;}var _0x324693='';_0x3cd184['on']('data',function(_0xf6a4f2){_0x324693+=_0xf6a4f2;});_0x3cd184['on'](_0x598d('0x21'),function(){_0x33f68e(_0x324693);});})['on'](_0x598d('0x16'),function(_0x5a8d3f){_0x5d2d84(_0x5a8d3f);})[_0x598d('0x21')]();});}function convertFile(_0x45a49a,_0x437f1b){return new BPromise(function(_0x3c59d1,_0x20ced4){var _0x5b6c5f=sox['transcode'](_0x45a49a,_0x437f1b,{'sampleRate':0x1f40,'format':_0x598d('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5b6c5f['on'](_0x598d('0x16'),function(_0x3757f4){logger['error']('error\x20convert',_0x3757f4);_0x20ced4(_0x3757f4);});_0x5b6c5f['on'](_0x598d('0x21'),function(){logger[_0x598d('0x1b')](_0x598d('0x24'));_0x3c59d1();});_0x5b6c5f['start']();});}function base64Decode(_0x592957,_0x5f086f){var _0x260cfd=path['resolve'](__dirname,_0x598d('0x25'),rs[_0x598d('0x26')](0x4)+_0x598d('0x27'));fs[_0x598d('0x28')](_0x260cfd,_0x592957,_0x598d('0x29'));return convertFile(_0x260cfd,_0x5f086f)[_0x598d('0x2a')](function(){try{fs[_0x598d('0x1e')](_0x260cfd);fs['chmodSync'](_0x5f086f,_0x598d('0x2b'));}catch(_0x6fc350){logger[_0x598d('0x16')](_0x6fc350);}return _0x5f086f[_0x598d('0x2c')]('.')[0x0];});}function base64Encode(_0x526b24){var _0x1407f2=fs[_0x598d('0x2d')](_0x526b24);return new Buffer(_0x1407f2)[_0x598d('0x2e')](_0x598d('0x29'));}exports[_0x598d('0x2f')]=function(_0x2e50be,_0x50697a,_0x51ccd5,_0x3f3c15,_0x5df665,_0x5834bd){var _0x254ebe,_0x3d65b7;var _0x2bcdd9='https://texttospeech.googleapis.com/v1/';var _0x388c8b=_0x598d('0x30')+_0x2e50be;var _0x4eb938={};if(_0x50697a===_0x598d('0x31')){_0x4eb938[_0x598d('0x32')]={'ssml':_0x51ccd5};}else{_0x4eb938[_0x598d('0x32')]={'text':_0x51ccd5};};_0x4eb938[_0x598d('0x33')]={'languageCode':_0x3f3c15,'ssmlGender':_0x5df665};_0x4eb938[_0x598d('0x34')]={'audioEncoding':_0x598d('0x35'),'sampleRateHertz':0x1f40};var _0x488a5d={'url':_0x2bcdd9+_0x598d('0x36')+_0x388c8b,'method':_0x598d('0x37'),'json':!![],'body':_0x4eb938};return rp(_0x488a5d)[_0x598d('0x2a')](function(_0xb1e10f){return new BPromise(function(_0x50895e,_0x3fb3b4){_0x254ebe=path['resolve'](__dirname,_0x598d('0x25'),rs[_0x598d('0x26')](0x4)+_0x598d('0x38'));var _0x4afbb3=Buffer['from'](_0xb1e10f[_0x598d('0x39')],_0x598d('0x29'));return fs[_0x598d('0x3a')](_0x254ebe,_0x4afbb3,function(_0x187ddf){_0x3fb3b4(_0x187ddf);},function(_0x564e94){fs['chmodSync'](_0x254ebe,'777');_0x50895e(_0x564e94);});});})[_0x598d('0x2a')](function(_0x4ffb3c){_0x3d65b7=path[_0x598d('0x3b')](__dirname,_0x598d('0x25'),rs[_0x598d('0x26')](0x4)+_0x598d('0x27'));return convertFile(_0x254ebe,_0x3d65b7);})[_0x598d('0x2a')](function(){try{fs[_0x598d('0x1e')](_0x254ebe);fs['chmodSync'](_0x3d65b7,_0x598d('0x2b'));}catch(_0x5af527){logger[_0x598d('0x16')](_0x5af527);}logger[_0x598d('0x1b')](_0x598d('0x3c'),_0x3d65b7['split']('.')[0x0]);return _0x3d65b7['split']('.')[0x0];});};exports[_0x598d('0x3d')]=function(_0x295513,_0x29fb62){var _0x2387d2,_0x3b9425;return tts(_0x295513,_0x29fb62||'en',0x1)[_0x598d('0x2a')](function(_0x3fe5aa){logger[_0x598d('0x1b')](_0x3fe5aa);_0x2387d2=path[_0x598d('0x3b')](__dirname,'tmp',rs[_0x598d('0x26')](0x4)+'.mp3');return downloadFile(_0x3fe5aa,_0x2387d2);})[_0x598d('0x2a')](function(){_0x3b9425=path[_0x598d('0x3b')](__dirname,_0x598d('0x25'),rs[_0x598d('0x26')](0x4)+_0x598d('0x27'));return convertFile(_0x2387d2,_0x3b9425);})[_0x598d('0x2a')](function(){try{fs[_0x598d('0x1e')](_0x2387d2);fs[_0x598d('0x3e')](_0x3b9425,_0x598d('0x2b'));}catch(_0x6bdf2d){logger[_0x598d('0x16')](_0x6bdf2d);}logger[_0x598d('0x1b')](_0x598d('0x3f'),_0x3b9425[_0x598d('0x2c')]('.')[0x0]);return _0x3b9425[_0x598d('0x2c')]('.')[0x0];});};exports['googleASR']=function(_0x1d84c8,_0x1d7541,_0x4b2666){return google[_0x598d('0x40')](_0x1d84c8,_0x1d7541,_0x4b2666)[_0x598d('0x2a')](function(_0x357c5d){logger['info'](_0x357c5d[_0x598d('0x41')]);return rp(_0x357c5d);})[_0x598d('0x2a')](function(_0x50bf88){var _0xaa4882='';var _0xd738f0=0x0;try{fs[_0x598d('0x1e')](_0x1d84c8);}catch(_0xe65768){logger[_0x598d('0x16')](_0xe65768);}if(_0x50bf88&&_0x50bf88[_0x598d('0x42')]){_0xaa4882=_0x50bf88[_0x598d('0x42')][_0x598d('0x43')](function(_0x2d2087){return _0x2d2087&&_0x2d2087[_0x598d('0x44')][0x0]&&_0x2d2087['alternatives'][0x0][_0x598d('0x45')]?_0x2d2087['alternatives'][0x0]['transcript']:'';})['join']('\x0a');_0xd738f0=_0x50bf88[_0x598d('0x42')]['map'](function(_0x2e4d19){return _0x2e4d19&&_0x2e4d19[_0x598d('0x44')][0x0]&&_0x2e4d19['alternatives'][0x0][_0x598d('0x46')]?_0x2e4d19[_0x598d('0x44')][0x0][_0x598d('0x46')]:0x0;})[_0x598d('0x47')]('\x0a');}logger[_0x598d('0x1b')](_0x598d('0x48'),_0xaa4882);logger[_0x598d('0x1b')]('googleASR\x20confidence',_0xd738f0);return{'transcript':_0xaa4882,'confidence':_0xd738f0};})[_0x598d('0x49')](function(_0x34f838){logger[_0x598d('0x16')](_0x598d('0x4a'),_0x34f838[_0x598d('0x15')],_0x34f838[_0x598d('0x4b')],_0x34f838[_0x598d('0x4c')]);});};exports[_0x598d('0x4d')]=function(_0x8aca83,_0x3c4246,_0x13eb14,_0x287222){var _0x32c820=apiai(_0x3c4246,{'language':_0x287222||'en'});return _0x32c820[_0x598d('0x4e')](_0x13eb14,{'sessionId':md5(_0x8aca83)})[_0x598d('0x2a')](function(_0x5de628){logger[_0x598d('0x1b')](JSON['stringify'](_0x5de628));return{'source':_0x5de628[_0x598d('0x4f')][_0x598d('0x50')],'resolvedQuery':_0x5de628[_0x598d('0x4f')][_0x598d('0x51')],'action':_0x5de628[_0x598d('0x4f')]['action'],'actionIncomplete':_0x5de628[_0x598d('0x4f')][_0x598d('0x52')],'speech':_0x5de628['result'][_0x598d('0x53')][_0x598d('0x54')],'score':_0x5de628[_0x598d('0x4f')][_0x598d('0x55')],'statusCode':_0x5de628[_0x598d('0x56')][_0x598d('0x57')],'endConversation':_0x5de628[_0x598d('0x4f')][_0x598d('0x58')][_0x598d('0x59')]||![],'isFallbackIntent':_0x5de628[_0x598d('0x4f')][_0x598d('0x58')][_0x598d('0x5a')]};});};exports[_0x598d('0x5b')]=function(_0x1db6aa,_0x489888,_0x269630,_0x50b635){return tilde[_0x598d('0x40')](_0x1db6aa,_0x489888,_0x269630,_0x50b635)[_0x598d('0x2a')](function(_0x247394){try{fs['unlink'](_0x1db6aa);}catch(_0x4b60c3){logger['error'](_0x4b60c3);}logger['info'](_0x598d('0x5c'),_0x247394[_0x598d('0x45')]);logger[_0x598d('0x1b')](_0x598d('0x5d'),_0x247394[_0x598d('0x46')]);return _0x247394;});};exports[_0x598d('0x5e')]=function(_0x2cdc58,_0x5e1b02,_0x395b34,_0x899cbe,_0x5f5cc4,_0x1e6706){var _0x58d8da=path[_0x598d('0x3b')](__dirname,_0x598d('0x25'),rs[_0x598d('0x26')](0x4)+_0x598d('0x38'));var _0x552afa;return aws['polly'](_0x2cdc58,_0x5e1b02,_0x395b34,_0x899cbe,_0x5f5cc4,_0x1e6706,_0x58d8da)['then'](function(){_0x552afa=path[_0x598d('0x3b')](__dirname,_0x598d('0x25'),rs['generate'](0x4)+_0x598d('0x27'));return convertFile(_0x58d8da,_0x552afa);})[_0x598d('0x2a')](function(){try{fs[_0x598d('0x1e')](_0x58d8da);fs[_0x598d('0x3e')](_0x552afa,_0x598d('0x2b'));}catch(_0x244280){logger[_0x598d('0x16')](_0x244280);}return _0x552afa[_0x598d('0x2c')]('.')[0x0];});};exports['awsLex']=function(_0x26381b,_0x562758,_0x3a4135,_0xc3e6c0,_0x398a93,_0x5b6e31){return aws[_0x598d('0x5f')](_0x26381b,_0x562758,_0x3a4135,_0xc3e6c0,_0x398a93,_0x5b6e31)['then'](function(_0x28980e){logger[_0x598d('0x1b')](JSON[_0x598d('0x60')](_0x28980e));return _0x28980e;});};exports['ispeechTTS']=function(_0x4b825f,_0x106a17,_0x3ff6d9,_0x42bb39){var _0x2ba877=util[_0x598d('0x61')](_0x598d('0x62'),ISPEECH_API,_0x4b825f,encodeURIComponent(_0x106a17),_0x3ff6d9,_0x42bb39);var _0x405217=path[_0x598d('0x3b')](__dirname,'tmp',rs[_0x598d('0x26')](0x4)+_0x598d('0x38'));var _0xd3b2c;return downloadFile(_0x2ba877,_0x405217)[_0x598d('0x2a')](function(){_0xd3b2c=path[_0x598d('0x3b')](__dirname,_0x598d('0x25'),rs[_0x598d('0x26')](0x4)+_0x598d('0x27'));return convertFile(_0x405217,_0xd3b2c);})[_0x598d('0x2a')](function(){try{fs[_0x598d('0x1e')](_0x405217);fs[_0x598d('0x3e')](_0xd3b2c,_0x598d('0x2b'));}catch(_0x571ad8){logger[_0x598d('0x16')](_0x571ad8);}return _0xd3b2c['split']('.')[0x0];});};exports[_0x598d('0x63')]=function(_0x54fa29,_0x49d345,_0x324f5d,_0x44bd2f){var _0x5d1db4=util[_0x598d('0x61')](_0x598d('0x64'),ISPEECH_API,_0x49d345,_0x324f5d,base64Encode(_0x54fa29),_0x44bd2f?util[_0x598d('0x61')]('model=%s',encodeURIComponent(_0x44bd2f)):_0x598d('0x65'));return uploadFile(_0x5d1db4)[_0x598d('0x2a')](function(_0x39c596){return querystring[_0x598d('0x4')](_0x39c596);});};exports[_0x598d('0x66')]=function(_0x3c2cfc,_0x464663){return sestek['nda'](_0x3c2cfc,_0x464663)[_0x598d('0x2a')](function(_0x2f0d64){logger[_0x598d('0x1b')](JSON[_0x598d('0x60')](_0x2f0d64));var _0xf76edc={'speech':_0x2f0d64[_0x598d('0x67')],'action':_0x2f0d64['channelData']?_0x2f0d64[_0x598d('0x68')][_0x598d('0x69')]:undefined,'actiondata':_0x2f0d64[_0x598d('0x68')]?_0x2f0d64['channelData']['CustomActionData']:undefined};if(_0x2f0d64['channelData']&&_0x2f0d64[_0x598d('0x68')]['AudioFromTts']){return base64Decode(_0x2f0d64[_0x598d('0x68')][_0x598d('0x6a')]['Data'],path[_0x598d('0x3b')](__dirname,_0x598d('0x25'),rs['generate'](0x4)+_0x598d('0x27')))['then'](function(_0x5e75ab){_0xf76edc[_0x598d('0x6b')]=_0x5e75ab;return _0xf76edc;});}return _0xf76edc;});};exports[_0x598d('0x6c')]=function(){return __dirname;}; \ No newline at end of file +var _0x7dcf=['confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','message','googleDialogflow','textRequest','stringify','result','action','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','.mp3','polly','lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','path','https','parse','bluebird','randomstring','sox','request-promise','querystring','google-tts-api','apiai-promise','md5','./google','./tilde','./sestek','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','finish\x20download\x20file','close','download\x20error','pipe','https:','data','end','transcode','wav','info','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','from','audioContent','writeFile','tmp','googleCloudTTS\x20path','googleTTS','googleASR','asr','results','map','alternatives','transcript','join'];(function(_0x5a59f2,_0x3a2070){var _0x142b1f=function(_0x326c4f){while(--_0x326c4f){_0x5a59f2['push'](_0x5a59f2['shift']());}};_0x142b1f(++_0x3a2070);}(_0x7dcf,0x168));var _0xf7dc=function(_0x125106,_0x1a5f5d){_0x125106=_0x125106-0x0;var _0xc1ffd5=_0x7dcf[_0x125106];return _0xc1ffd5;};'use strict';var fs=require('fs');var path=require(_0xf7dc('0x0'));var http=require('http');var https=require(_0xf7dc('0x1'));var urlParse=require('url')[_0xf7dc('0x2')];var BPromise=require(_0xf7dc('0x3'));var rs=require(_0xf7dc('0x4'));var sox=require(_0xf7dc('0x5'));var rp=require(_0xf7dc('0x6'));var util=require('util');var querystring=require(_0xf7dc('0x7'));var tts=require(_0xf7dc('0x8'));var apiai=require(_0xf7dc('0x9'));var md5=require(_0xf7dc('0xa'));var google=require(_0xf7dc('0xb'));var aws=require('./aws');var tilde=require(_0xf7dc('0xc'));var sestek=require(_0xf7dc('0xd'));var logger=require('../../../config/logger')(_0xf7dc('0xe'));var ISPEECH_API=_0xf7dc('0xf');function downloadFile(_0x2e8f10,_0x51ebd5){return new BPromise(function(_0x7dd9c6,_0x320bdd){var _0x46cd8f=urlParse(_0x2e8f10);var _0x31942c=_0x46cd8f[_0xf7dc('0x10')]==='https:'?https:http;var _0x11633d={'host':_0x46cd8f[_0xf7dc('0x11')],'path':_0x46cd8f['path'],'headers':{'user-agent':_0xf7dc('0x12')}};_0x31942c[_0xf7dc('0x13')](_0x11633d,function(_0x535015){if(_0x535015[_0xf7dc('0x14')]!==0xc8){logger[_0xf7dc('0x15')](_0xf7dc('0x16')+_0x2e8f10+_0xf7dc('0x17')+_0x535015[_0xf7dc('0x14')]+'\x20('+_0x535015[_0xf7dc('0x18')]+')');_0x320bdd(new Error(_0xf7dc('0x16')+_0x2e8f10+_0xf7dc('0x17')+_0x535015[_0xf7dc('0x14')]+'\x20('+_0x535015[_0xf7dc('0x18')]+')'));return;}var _0x5c4a02=fs[_0xf7dc('0x19')](_0x51ebd5);_0x5c4a02['on'](_0xf7dc('0x1a'),function(){logger['info'](_0xf7dc('0x1b'));_0x5c4a02[_0xf7dc('0x1c')](_0x7dd9c6);});_0x5c4a02['on'](_0xf7dc('0x15'),function(_0x543565){fs['unlink'](_0x51ebd5);logger['error'](_0xf7dc('0x1d'),_0x543565);_0x320bdd(_0x543565);});_0x535015[_0xf7dc('0x1e')](_0x5c4a02);})['on'](_0xf7dc('0x15'),function(_0x494351){logger[_0xf7dc('0x15')](_0x494351);_0x320bdd(_0x494351);})['end']();});}function uploadFile(_0x5763ff){return new BPromise(function(_0xd13fe6,_0xa45836){var _0x14f2dc=urlParse(_0x5763ff);var _0x1a9455=_0x14f2dc[_0xf7dc('0x10')]===_0xf7dc('0x1f')?https:http;var _0x2df7ef={'host':_0x14f2dc[_0xf7dc('0x11')],'path':_0x14f2dc[_0xf7dc('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x1a9455[_0xf7dc('0x13')](_0x2df7ef,function(_0x9e8ec3){if(_0x9e8ec3[_0xf7dc('0x14')]!==0xc8){_0xa45836(new Error(_0xf7dc('0x16')+_0x5763ff+_0xf7dc('0x17')+_0x9e8ec3[_0xf7dc('0x14')]+'\x20('+_0x9e8ec3[_0xf7dc('0x18')]+')'));return;}var _0x2b88c5='';_0x9e8ec3['on'](_0xf7dc('0x20'),function(_0x33d584){_0x2b88c5+=_0x33d584;});_0x9e8ec3['on'](_0xf7dc('0x21'),function(){_0xd13fe6(_0x2b88c5);});})['on']('error',function(_0x553664){_0xa45836(_0x553664);})[_0xf7dc('0x21')]();});}function convertFile(_0x23d217,_0x46df5b){return new BPromise(function(_0x7df1,_0x2cc869){var _0x1d6fdd=sox[_0xf7dc('0x22')](_0x23d217,_0x46df5b,{'sampleRate':0x1f40,'format':_0xf7dc('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1d6fdd['on'](_0xf7dc('0x15'),function(_0x5eaca9){logger[_0xf7dc('0x15')]('error\x20convert',_0x5eaca9);_0x2cc869(_0x5eaca9);});_0x1d6fdd['on']('end',function(){logger[_0xf7dc('0x24')](_0xf7dc('0x25'));_0x7df1();});_0x1d6fdd[_0xf7dc('0x26')]();});}function base64Decode(_0x13c966,_0x598593){var _0x384d24=path[_0xf7dc('0x27')](__dirname,'tmp',rs[_0xf7dc('0x28')](0x4)+_0xf7dc('0x29'));fs[_0xf7dc('0x2a')](_0x384d24,_0x13c966,_0xf7dc('0x2b'));return convertFile(_0x384d24,_0x598593)[_0xf7dc('0x2c')](function(){try{fs[_0xf7dc('0x2d')](_0x384d24);fs[_0xf7dc('0x2e')](_0x598593,_0xf7dc('0x2f'));}catch(_0x5d0d3a){logger[_0xf7dc('0x15')](_0x5d0d3a);}return _0x598593[_0xf7dc('0x30')]('.')[0x0];});}function base64Encode(_0x18fb7c){var _0x13c1a6=fs[_0xf7dc('0x31')](_0x18fb7c);return new Buffer(_0x13c1a6)['toString'](_0xf7dc('0x2b'));}exports[_0xf7dc('0x32')]=function(_0x13d8c5,_0x340acb,_0x3b7bb7,_0x1dea7e,_0x9e3fc2,_0x3c8819){var _0x3897e3,_0x321d6d;var _0xec11d3=_0xf7dc('0x33');var _0x2e2c7a=_0xf7dc('0x34')+_0x13d8c5;var _0x1c139a={};if(_0x340acb==='ssml'){_0x1c139a['input']={'ssml':_0x3b7bb7};}else{_0x1c139a[_0xf7dc('0x35')]={'text':_0x3b7bb7};};_0x1c139a[_0xf7dc('0x36')]={'languageCode':_0x1dea7e,'ssmlGender':_0x9e3fc2};_0x1c139a[_0xf7dc('0x37')]={'audioEncoding':_0xf7dc('0x38'),'sampleRateHertz':0x1f40};var _0xc06775={'url':_0xec11d3+_0xf7dc('0x39')+_0x2e2c7a,'method':_0xf7dc('0x3a'),'json':!![],'body':_0x1c139a};return rp(_0xc06775)[_0xf7dc('0x2c')](function(_0x25b1cc){return new BPromise(function(_0x56888a,_0x3ccb3e){_0x3897e3=path[_0xf7dc('0x27')](__dirname,'tmp',rs[_0xf7dc('0x28')](0x4)+'.mp3');var _0x2fd3ce=Buffer[_0xf7dc('0x3b')](_0x25b1cc[_0xf7dc('0x3c')],'base64');return fs[_0xf7dc('0x3d')](_0x3897e3,_0x2fd3ce,function(_0x1d223e){_0x3ccb3e(_0x1d223e);},function(_0x542f5c){fs[_0xf7dc('0x2e')](_0x3897e3,'777');_0x56888a(_0x542f5c);});});})[_0xf7dc('0x2c')](function(_0x252010){_0x321d6d=path['resolve'](__dirname,_0xf7dc('0x3e'),rs[_0xf7dc('0x28')](0x4)+_0xf7dc('0x29'));return convertFile(_0x3897e3,_0x321d6d);})[_0xf7dc('0x2c')](function(){try{fs['unlink'](_0x3897e3);fs[_0xf7dc('0x2e')](_0x321d6d,_0xf7dc('0x2f'));}catch(_0x417f41){logger[_0xf7dc('0x15')](_0x417f41);}logger['info'](_0xf7dc('0x3f'),_0x321d6d[_0xf7dc('0x30')]('.')[0x0]);return _0x321d6d[_0xf7dc('0x30')]('.')[0x0];});};exports[_0xf7dc('0x40')]=function(_0x2e23c6,_0x35723a){var _0x56a06a,_0x4e8662;return tts(_0x2e23c6,_0x35723a||'en',0x1)[_0xf7dc('0x2c')](function(_0x261763){logger[_0xf7dc('0x24')](_0x261763);_0x56a06a=path[_0xf7dc('0x27')](__dirname,_0xf7dc('0x3e'),rs[_0xf7dc('0x28')](0x4)+'.mp3');return downloadFile(_0x261763,_0x56a06a);})['then'](function(){_0x4e8662=path[_0xf7dc('0x27')](__dirname,_0xf7dc('0x3e'),rs[_0xf7dc('0x28')](0x4)+_0xf7dc('0x29'));return convertFile(_0x56a06a,_0x4e8662);})['then'](function(){try{fs[_0xf7dc('0x2d')](_0x56a06a);fs[_0xf7dc('0x2e')](_0x4e8662,_0xf7dc('0x2f'));}catch(_0x11ae01){logger[_0xf7dc('0x15')](_0x11ae01);}logger[_0xf7dc('0x24')]('goggleTTS\x20path',_0x4e8662[_0xf7dc('0x30')]('.')[0x0]);return _0x4e8662['split']('.')[0x0];});};exports[_0xf7dc('0x41')]=function(_0x3dfbd8,_0x36aca3,_0xedc733){return google[_0xf7dc('0x42')](_0x3dfbd8,_0x36aca3,_0xedc733)[_0xf7dc('0x2c')](function(_0x4568c8){logger[_0xf7dc('0x24')](_0x4568c8['uri']);return rp(_0x4568c8);})[_0xf7dc('0x2c')](function(_0x432129){var _0x359172='';var _0x3b646a=0x0;try{fs['unlink'](_0x3dfbd8);}catch(_0x16ef62){logger[_0xf7dc('0x15')](_0x16ef62);}if(_0x432129&&_0x432129[_0xf7dc('0x43')]){_0x359172=_0x432129['results'][_0xf7dc('0x44')](function(_0x124aee){return _0x124aee&&_0x124aee[_0xf7dc('0x45')][0x0]&&_0x124aee['alternatives'][0x0][_0xf7dc('0x46')]?_0x124aee['alternatives'][0x0][_0xf7dc('0x46')]:'';})[_0xf7dc('0x47')]('\x0a');_0x3b646a=_0x432129[_0xf7dc('0x43')][_0xf7dc('0x44')](function(_0x4668c7){return _0x4668c7&&_0x4668c7['alternatives'][0x0]&&_0x4668c7[_0xf7dc('0x45')][0x0][_0xf7dc('0x48')]?_0x4668c7['alternatives'][0x0][_0xf7dc('0x48')]:0x0;})[_0xf7dc('0x47')]('\x0a');}logger[_0xf7dc('0x24')](_0xf7dc('0x49'),_0x359172);logger['info'](_0xf7dc('0x4a'),_0x3b646a);return{'transcript':_0x359172,'confidence':_0x3b646a};})['catch'](function(_0xb5b17){logger[_0xf7dc('0x15')](_0xf7dc('0x4b'),_0xb5b17[_0xf7dc('0x14')],_0xb5b17['name'],_0xb5b17[_0xf7dc('0x4c')]);});};exports[_0xf7dc('0x4d')]=function(_0x51ecf5,_0x5bc942,_0x21fcd7,_0x7c40fd){var _0xd109e5=apiai(_0x5bc942,{'language':_0x7c40fd||'en'});return _0xd109e5[_0xf7dc('0x4e')](_0x21fcd7,{'sessionId':md5(_0x51ecf5)})[_0xf7dc('0x2c')](function(_0x2323af){logger[_0xf7dc('0x24')](JSON[_0xf7dc('0x4f')](_0x2323af));return{'source':_0x2323af[_0xf7dc('0x50')]['source'],'resolvedQuery':_0x2323af[_0xf7dc('0x50')]['resolvedQuery'],'action':_0x2323af[_0xf7dc('0x50')][_0xf7dc('0x51')],'actionIncomplete':_0x2323af[_0xf7dc('0x50')]['actionIncomplete'],'speech':_0x2323af[_0xf7dc('0x50')][_0xf7dc('0x52')][_0xf7dc('0x53')],'score':_0x2323af[_0xf7dc('0x50')][_0xf7dc('0x54')],'statusCode':_0x2323af[_0xf7dc('0x55')][_0xf7dc('0x56')],'endConversation':_0x2323af[_0xf7dc('0x50')][_0xf7dc('0x57')][_0xf7dc('0x58')]||![],'isFallbackIntent':_0x2323af[_0xf7dc('0x50')][_0xf7dc('0x57')][_0xf7dc('0x59')]};});};exports['tildeASR']=function(_0x4cf2cd,_0x3d4f45,_0x4b73c2,_0x2b5a2a){return tilde[_0xf7dc('0x42')](_0x4cf2cd,_0x3d4f45,_0x4b73c2,_0x2b5a2a)['then'](function(_0x2017ae){try{fs[_0xf7dc('0x2d')](_0x4cf2cd);}catch(_0x3b8f9b){logger[_0xf7dc('0x15')](_0x3b8f9b);}logger[_0xf7dc('0x24')](_0xf7dc('0x5a'),_0x2017ae[_0xf7dc('0x46')]);logger[_0xf7dc('0x24')](_0xf7dc('0x5b'),_0x2017ae[_0xf7dc('0x48')]);return _0x2017ae;});};exports['awsPolly']=function(_0x318410,_0xbdd6c6,_0x3a31da,_0x5b3a69,_0x43ae00,_0x2a53ba){var _0xffea64=path[_0xf7dc('0x27')](__dirname,_0xf7dc('0x3e'),rs['generate'](0x4)+_0xf7dc('0x5c'));var _0x594f81;return aws[_0xf7dc('0x5d')](_0x318410,_0xbdd6c6,_0x3a31da,_0x5b3a69,_0x43ae00,_0x2a53ba,_0xffea64)[_0xf7dc('0x2c')](function(){_0x594f81=path['resolve'](__dirname,_0xf7dc('0x3e'),rs[_0xf7dc('0x28')](0x4)+_0xf7dc('0x29'));return convertFile(_0xffea64,_0x594f81);})[_0xf7dc('0x2c')](function(){try{fs['unlink'](_0xffea64);fs['chmodSync'](_0x594f81,_0xf7dc('0x2f'));}catch(_0x39065c){logger[_0xf7dc('0x15')](_0x39065c);}return _0x594f81[_0xf7dc('0x30')]('.')[0x0];});};exports['awsLex']=function(_0x17e3ab,_0x52e321,_0x206757,_0x3b2db9,_0x308f8f,_0x15fbde){return aws[_0xf7dc('0x5e')](_0x17e3ab,_0x52e321,_0x206757,_0x3b2db9,_0x308f8f,_0x15fbde)[_0xf7dc('0x2c')](function(_0x27b924){logger[_0xf7dc('0x24')](JSON['stringify'](_0x27b924));return _0x27b924;});};exports[_0xf7dc('0x5f')]=function(_0x3a0733,_0x3c6dbb,_0x280e25,_0x4b1e3a){var _0x45c0f2=util[_0xf7dc('0x60')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x3a0733,encodeURIComponent(_0x3c6dbb),_0x280e25,_0x4b1e3a);var _0x14e22c=path[_0xf7dc('0x27')](__dirname,_0xf7dc('0x3e'),rs[_0xf7dc('0x28')](0x4)+'.mp3');var _0x59e507;return downloadFile(_0x45c0f2,_0x14e22c)[_0xf7dc('0x2c')](function(){_0x59e507=path[_0xf7dc('0x27')](__dirname,_0xf7dc('0x3e'),rs[_0xf7dc('0x28')](0x4)+_0xf7dc('0x29'));return convertFile(_0x14e22c,_0x59e507);})[_0xf7dc('0x2c')](function(){try{fs[_0xf7dc('0x2d')](_0x14e22c);fs[_0xf7dc('0x2e')](_0x59e507,'777');}catch(_0x557b6f){logger[_0xf7dc('0x15')](_0x557b6f);}return _0x59e507[_0xf7dc('0x30')]('.')[0x0];});};exports[_0xf7dc('0x61')]=function(_0x432e8d,_0x18ba9c,_0x2f91bf,_0x266e77){var _0x10198f=util[_0xf7dc('0x60')](_0xf7dc('0x62'),ISPEECH_API,_0x18ba9c,_0x2f91bf,base64Encode(_0x432e8d),_0x266e77?util[_0xf7dc('0x60')](_0xf7dc('0x63'),encodeURIComponent(_0x266e77)):'freeform=3');return uploadFile(_0x10198f)[_0xf7dc('0x2c')](function(_0x50b3f9){return querystring[_0xf7dc('0x2')](_0x50b3f9);});};exports[_0xf7dc('0x64')]=function(_0x8dd96a,_0x1966e2){return sestek['nda'](_0x8dd96a,_0x1966e2)[_0xf7dc('0x2c')](function(_0x1acd1f){logger[_0xf7dc('0x24')](JSON[_0xf7dc('0x4f')](_0x1acd1f));var _0x78286e={'speech':_0x1acd1f[_0xf7dc('0x65')],'action':_0x1acd1f[_0xf7dc('0x66')]?_0x1acd1f[_0xf7dc('0x66')][_0xf7dc('0x67')]:undefined,'actiondata':_0x1acd1f[_0xf7dc('0x66')]?_0x1acd1f[_0xf7dc('0x66')][_0xf7dc('0x68')]:undefined};if(_0x1acd1f[_0xf7dc('0x66')]&&_0x1acd1f[_0xf7dc('0x66')][_0xf7dc('0x69')]){return base64Decode(_0x1acd1f[_0xf7dc('0x66')][_0xf7dc('0x69')]['Data'],path[_0xf7dc('0x27')](__dirname,_0xf7dc('0x3e'),rs['generate'](0x4)+'.wav'))[_0xf7dc('0x2c')](function(_0x5d9e14){_0x78286e[_0xf7dc('0x6a')]=_0x5d9e14;return _0x78286e;});}return _0x78286e;});};exports[_0xf7dc('0x6b')]=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 fcf9fe4..52ffd3a 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 _0x1cfc=['./nda'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cfc,0x16a));var _0xc1cf=function(_0x1c7238,_0x73cfec){_0x1c7238=_0x1c7238-0x0;var _0x54da8a=_0x1cfc[_0x1c7238];return _0x54da8a;};var nda=require(_0xc1cf('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x1a60=['exports'];(function(_0x1872fa,_0x437479){var _0x29a870=function(_0x510c20){while(--_0x510c20){_0x1872fa['push'](_0x1872fa['shift']());}};_0x29a870(++_0x437479);}(_0x1a60,0x9d));var _0x01a6=function(_0x4c912d,_0x414d77){_0x4c912d=_0x4c912d-0x0;var _0x456a7e=_0x1a60[_0x4c912d];return _0x456a7e;};var nda=require('./nda');module[_0x01a6('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 63bfbd7..7f5cdac 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 _0x0af1=['calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','ndauth_url','/token','username','then','resolve','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid'];(function(_0x210040,_0x27d6b4){var _0x1f886f=function(_0xaa74c8){while(--_0xaa74c8){_0x210040['push'](_0x210040['shift']());}};_0x1f886f(++_0x27d6b4);}(_0x0af1,0x110));var _0x10af=function(_0x5f3bc9,_0x449e2d){_0x5f3bc9=_0x5f3bc9-0x0;var _0x25697d=_0x0af1[_0x5f3bc9];return _0x25697d;};'use strict';var rp=require(_0x10af('0x0'));var url=require(_0x10af('0x1'));var logger=require(_0x10af('0x2'))(_0x10af('0x3'));module[_0x10af('0x4')]=function(_0x500f07,_0xfa112c){var _0x122566={'method':_0x10af('0x5'),'uri':url['resolve'](_0xfa112c[_0x10af('0x6')],_0x10af('0x7')),'form':{'grant_type':'password','username':_0xfa112c[_0x10af('0x8')],'password':_0xfa112c['password']},'json':!![]};return rp(_0x122566)[_0x10af('0x9')](function(_0x187cef){var _0x15f69a={'method':_0x10af('0x5'),'uri':url[_0x10af('0xa')](_0xfa112c['ndassistant_url'],_0x10af('0xb')),'body':{'type':_0xfa112c[_0x10af('0xc')]||_0x10af('0xd'),'channelId':_0x10af('0xe'),'conversation':{'id':_0x500f07['uniqueid']},'from':{'id':_0x500f07[_0x10af('0xf')],'name':_0x500f07[_0x10af('0x10')]},'recipient':{'id':_0x500f07[_0x10af('0x11')],'name':_0x500f07[_0x10af('0x12')]},'text':_0xfa112c[_0x10af('0x13')],'channelData':{}},'headers':{'Authorization':_0x10af('0x14')+_0x187cef[_0x10af('0x15')]},'json':!![]};if(_0xfa112c[_0x10af('0x16')]){_0x15f69a[_0x10af('0x17')][_0x10af('0x18')]['ProjectName']=_0xfa112c[_0x10af('0x16')];}if(_0xfa112c[_0x10af('0x19')]=='1'){_0x15f69a[_0x10af('0x17')][_0x10af('0x18')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x10af('0x1a')};}if(_0xfa112c[_0x10af('0x1b')]){_0x15f69a['body'][_0x10af('0x18')][_0x10af('0x1c')]=_0xfa112c[_0x10af('0x1b')];if(_0xfa112c[_0x10af('0x1d')]){_0x15f69a[_0x10af('0x17')][_0x10af('0x18')]['CustomActionData']=_0xfa112c[_0x10af('0x1d')];}}logger[_0x10af('0x1e')](JSON[_0x10af('0x1f')](_0x15f69a));return rp(_0x15f69a);});}; \ No newline at end of file +var _0x60c1=['custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','POST','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','body','channelData','project','ndagenerate_audio','AudioOutputSettings','audio/wav'];(function(_0x2f4c7d,_0x4cb1a9){var _0x41914e=function(_0x1c7211){while(--_0x1c7211){_0x2f4c7d['push'](_0x2f4c7d['shift']());}};_0x41914e(++_0x4cb1a9);}(_0x60c1,0xcc));var _0x160c=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x60c1[_0x199572];return _0x13cfa3;};'use strict';var rp=require(_0x160c('0x0'));var url=require(_0x160c('0x1'));var logger=require(_0x160c('0x2'))(_0x160c('0x3'));module['exports']=function(_0x3f5fc1,_0x388258){var _0x4c420a={'method':_0x160c('0x4'),'uri':url['resolve'](_0x388258['ndauth_url'],_0x160c('0x5')),'form':{'grant_type':_0x160c('0x6'),'username':_0x388258['username'],'password':_0x388258[_0x160c('0x6')]},'json':!![]};return rp(_0x4c420a)[_0x160c('0x7')](function(_0xd25524){var _0x625e12={'method':_0x160c('0x4'),'uri':url['resolve'](_0x388258[_0x160c('0x8')],_0x160c('0x9')),'body':{'type':_0x388258[_0x160c('0xa')]||_0x160c('0xb'),'channelId':_0x160c('0xc'),'conversation':{'id':_0x3f5fc1[_0x160c('0xd')]},'from':{'id':_0x3f5fc1[_0x160c('0xe')],'name':_0x3f5fc1[_0x160c('0xf')]},'recipient':{'id':_0x3f5fc1[_0x160c('0x10')],'name':_0x3f5fc1[_0x160c('0x11')]},'text':_0x388258[_0x160c('0x12')],'channelData':{}},'headers':{'Authorization':_0x160c('0x13')+_0xd25524[_0x160c('0x14')]},'json':!![]};if(_0x388258['project']){_0x625e12[_0x160c('0x15')][_0x160c('0x16')]['ProjectName']=_0x388258[_0x160c('0x17')];}if(_0x388258[_0x160c('0x18')]=='1'){_0x625e12[_0x160c('0x15')]['channelData'][_0x160c('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x160c('0x1a')};}if(_0x388258[_0x160c('0x1b')]){_0x625e12['body'][_0x160c('0x16')][_0x160c('0x1c')]=_0x388258[_0x160c('0x1b')];if(_0x388258[_0x160c('0x1d')]){_0x625e12['body'][_0x160c('0x16')][_0x160c('0x1e')]=_0x388258[_0x160c('0x1d')];}}logger[_0x160c('0x1f')](JSON[_0x160c('0x20')](_0x625e12));return rp(_0x625e12);});}; \ 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 a47f6a6..44fc22b 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 _0xdda4=['./lib/api','exports'];(function(_0x36a1a9,_0x36c6e2){var _0x1134bb=function(_0x396100){while(--_0x396100){_0x36a1a9['push'](_0x36a1a9['shift']());}};_0x1134bb(++_0x36c6e2);}(_0xdda4,0x1b2));var _0x4dda=function(_0x297eea,_0x5060be){_0x297eea=_0x297eea-0x0;var _0x1c42d2=_0xdda4[_0x297eea];return _0x1c42d2;};'use strict';var asr=require(_0x4dda('0x0'));module[_0x4dda('0x1')]=function(_0x1b7060,_0x27bd0b,_0x31a68e,_0x5d24d6){return asr(_0x1b7060,_0x27bd0b,_0x31a68e,_0x5d24d6);}; \ No newline at end of file +var _0x21d6=['exports','./lib/api'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x21d6,0x10d));var _0x621d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x21d6[_0x4a9fb1];return _0x348672;};'use strict';var asr=require(_0x621d('0x0'));module[_0x621d('0x1')]=function(_0x53f633,_0x506852,_0x1a8b75,_0x1fca25){return asr(_0x53f633,_0x506852,_0x1a8b75,_0x1fca25);}; \ 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 869cc92..477db39 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 _0xf6e7=['sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','send','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','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','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','moment','crypto','../../../../../../config/logger','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','createHash'];(function(_0x3874ce,_0x307d61){var _0x1c71b8=function(_0x4a8837){while(--_0x4a8837){_0x3874ce['push'](_0x3874ce['shift']());}};_0x1c71b8(++_0x307d61);}(_0xf6e7,0x1e2));var _0x7f6e=function(_0x2ffebb,_0x5f1f6f){_0x2ffebb=_0x2ffebb-0x0;var _0x4d86e5=_0xf6e7[_0x2ffebb];return _0x4d86e5;};'use strict';var BPromise=require(_0x7f6e('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x7f6e('0x1'));var crypto=require(_0x7f6e('0x2'));var logger=require(_0x7f6e('0x3'))(_0x7f6e('0x4'));module['exports']=function(_0xb7baae,_0x421564,_0x59e7db,_0x454727){return new BPromise(function(_0x32fae3,_0x21e7ea){logger[_0x7f6e('0x5')](_0x7f6e('0x6'),_0x454727||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x43542c=new WebSocket(_0x454727||_0x7f6e('0x7'),{'perMessageDeflate':![]});var _0x439cc7='';var _0x1e9d66='0';var _0x1fb7d1='1';var _0x572b6a=_0x7f6e('0x8');function _0x50bcda(_0x14f76c){var _0x40c324=crypto[_0x7f6e('0x9')](_0x7f6e('0xa'));_0x40c324[_0x7f6e('0xb')](_0x14f76c);return _0x40c324[_0x7f6e('0xc')](_0x7f6e('0xd'));}function _0x59adc6(){try{logger[_0x7f6e('0x5')](_0x7f6e('0xe'));var _0x2a9e51=moment()['unix']();var _0x306f6a=_0x50bcda(_0x2a9e51+_0x421564+_0x59e7db);_0x43542c[_0x7f6e('0xf')](JSON['stringify']({'appID':_0x421564,'timestamp':_0x2a9e51,'appKey':_0x306f6a}));var _0x5e3c63=fs[_0x7f6e('0x10')](_0xb7baae);_0x5e3c63['on'](_0x7f6e('0x11'),function(_0x335f41){_0x43542c[_0x7f6e('0xf')](_0x335f41);});_0x5e3c63['on'](_0x7f6e('0x12'),function(){_0x43542c[_0x7f6e('0xf')](_0x7f6e('0x13'));});}catch(_0x133f44){logger['error'](_0x7f6e('0x14'),JSON[_0x7f6e('0x15')](_0x133f44));_0x43542c[_0x7f6e('0x16')]();}}function _0x116c85(_0x470c41){try{if(_0x470c41){var _0x46c1c9=JSON[_0x7f6e('0x17')](_0x470c41);switch(_0x46c1c9[_0x7f6e('0x18')]){case 0x0:if(_0x46c1c9[_0x7f6e('0x19')]){if(_0x46c1c9[_0x7f6e('0x19')][_0x7f6e('0x1a')]){logger[_0x7f6e('0x5')](_0x7f6e('0x1b'),JSON[_0x7f6e('0x15')](_0x46c1c9[_0x7f6e('0x19')][_0x7f6e('0x1c')]));_0x439cc7=_0x46c1c9[_0x7f6e('0x19')][_0x7f6e('0x1c')][0x0]['transcript'];_0x1e9d66=_0x46c1c9[_0x7f6e('0x19')][_0x7f6e('0x1c')][0x0][_0x7f6e('0x1d')];_0x1fb7d1='0';_0x572b6a=_0x7f6e('0x1e');_0x43542c[_0x7f6e('0x16')]();}}break;case 0x1:logger[_0x7f6e('0x5')](_0x7f6e('0x8'));_0x1fb7d1='1';_0x572b6a=_0x7f6e('0x8');break;case 0x2:logger[_0x7f6e('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x1fb7d1='2';_0x572b6a=_0x7f6e('0x1f');break;case 0x9:logger['info'](_0x7f6e('0x20'));_0x1fb7d1='9';_0x572b6a=_0x7f6e('0x20');break;case 0xa:logger[_0x7f6e('0x5')](_0x7f6e('0x21'));_0x1fb7d1='10';_0x572b6a=_0x7f6e('0x21');break;case 0xb:logger[_0x7f6e('0x5')](_0x7f6e('0x22'));_0x1fb7d1='11';_0x572b6a='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x15c26d){logger[_0x7f6e('0x23')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x7f6e('0x15')](_0x15c26d));_0x43542c['terminate']();}}function _0x397da5(){logger[_0x7f6e('0x5')](_0x7f6e('0x24'));_0x32fae3({'transcript':_0x439cc7,'confidence':_0x1e9d66,'status':_0x1fb7d1,'status_message':_0x572b6a});}function _0x2aca4a(_0xd3e4c2){logger[_0x7f6e('0x23')](_0x7f6e('0x25'));if(!_['isNil'](_0xd3e4c2)){logger['error'](_[_0x7f6e('0x26')](_0xd3e4c2)?JSON[_0x7f6e('0x15')](_0xd3e4c2):_0xd3e4c2);}}_0x43542c['on'](_0x7f6e('0x27'),_0x59adc6);_0x43542c['on'](_0x7f6e('0x28'),_0x116c85);_0x43542c['on'](_0x7f6e('0x12'),_0x397da5);_0x43542c['on'](_0x7f6e('0x23'),_0x2aca4a);});}; \ No newline at end of file +var _0x27c5=['sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','transcript','hypotheses','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','Error\x20Tilde\x20ASR\x20socket','open','message','bluebird','lodash','moment','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'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x27c5,0x1f2));var _0x527c=function(_0x346d45,_0x6db175){_0x346d45=_0x346d45-0x0;var _0x548330=_0x27c5[_0x346d45];return _0x548330;};'use strict';var BPromise=require(_0x527c('0x0'));var _=require(_0x527c('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x527c('0x2'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')(_0x527c('0x3'));module[_0x527c('0x4')]=function(_0x48abaa,_0x4300c2,_0x5074a2,_0x417b77){return new BPromise(function(_0x4c86f5,_0x3f5e94){logger[_0x527c('0x5')]('Tilde\x20URI',_0x417b77||_0x527c('0x6'));var _0x322261=new WebSocket(_0x417b77||_0x527c('0x6'),{'perMessageDeflate':![]});var _0x3ae19d='';var _0x2f3ae2='0';var _0x1668ab='1';var _0x29c0aa=_0x527c('0x7');function _0x94143f(_0x38ee84){var _0x252b80=crypto[_0x527c('0x8')](_0x527c('0x9'));_0x252b80['update'](_0x38ee84);return _0x252b80[_0x527c('0xa')](_0x527c('0xb'));}function _0x132efc(){try{logger['info'](_0x527c('0xc'));var _0x188889=moment()[_0x527c('0xd')]();var _0x105261=_0x94143f(_0x188889+_0x4300c2+_0x5074a2);_0x322261[_0x527c('0xe')](JSON[_0x527c('0xf')]({'appID':_0x4300c2,'timestamp':_0x188889,'appKey':_0x105261}));var _0x5b4e5d=fs[_0x527c('0x10')](_0x48abaa);_0x5b4e5d['on'](_0x527c('0x11'),function(_0x39e249){_0x322261[_0x527c('0xe')](_0x39e249);});_0x5b4e5d['on'](_0x527c('0x12'),function(){_0x322261[_0x527c('0xe')](_0x527c('0x13'));});}catch(_0x1b6ad5){logger['error']('Tilde\x20ASR\x20send\x20error',JSON[_0x527c('0xf')](_0x1b6ad5));_0x322261[_0x527c('0x14')]();}}function _0x2016e9(_0x174735){try{if(_0x174735){var _0x4f310a=JSON[_0x527c('0x15')](_0x174735);switch(_0x4f310a[_0x527c('0x16')]){case 0x0:if(_0x4f310a['result']){if(_0x4f310a[_0x527c('0x17')][_0x527c('0x18')]){logger['info'](_0x527c('0x19'),JSON[_0x527c('0xf')](_0x4f310a[_0x527c('0x17')]['hypotheses']));_0x3ae19d=_0x4f310a[_0x527c('0x17')]['hypotheses'][0x0][_0x527c('0x1a')];_0x2f3ae2=_0x4f310a[_0x527c('0x17')][_0x527c('0x1b')][0x0]['likelihood'];_0x1668ab='0';_0x29c0aa=_0x527c('0x1c');_0x322261[_0x527c('0x14')]();}}break;case 0x1:logger[_0x527c('0x5')](_0x527c('0x7'));_0x1668ab='1';_0x29c0aa=_0x527c('0x7');break;case 0x2:logger[_0x527c('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x1668ab='2';_0x29c0aa=_0x527c('0x1d');break;case 0x9:logger['info'](_0x527c('0x1e'));_0x1668ab='9';_0x29c0aa='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x527c('0x5')](_0x527c('0x1f'));_0x1668ab='10';_0x29c0aa=_0x527c('0x1f');break;case 0xb:logger[_0x527c('0x5')](_0x527c('0x20'));_0x1668ab='11';_0x29c0aa=_0x527c('0x20');}}}catch(_0x2b8651){logger['error'](_0x527c('0x21'),JSON[_0x527c('0xf')](_0x2b8651));_0x322261[_0x527c('0x14')]();}}function _0x41a12a(){logger[_0x527c('0x5')](_0x527c('0x22'));_0x4c86f5({'transcript':_0x3ae19d,'confidence':_0x2f3ae2,'status':_0x1668ab,'status_message':_0x29c0aa});}function _0x443da0(_0x323755){logger[_0x527c('0x23')](_0x527c('0x24'));if(!_['isNil'](_0x323755)){logger[_0x527c('0x23')](_['isObject'](_0x323755)?JSON[_0x527c('0xf')](_0x323755):_0x323755);}}_0x322261['on'](_0x527c('0x25'),_0x132efc);_0x322261['on'](_0x527c('0x26'),_0x2016e9);_0x322261['on'](_0x527c('0x12'),_0x41a12a);_0x322261['on'](_0x527c('0x23'),_0x443da0);});}; \ 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 b2802c6..9af2c1b 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 _0xa861=['./asr','exports'];(function(_0x4c9915,_0x406b1a){var _0x473218=function(_0x2536ba){while(--_0x2536ba){_0x4c9915['push'](_0x4c9915['shift']());}};_0x473218(++_0x406b1a);}(_0xa861,0x13a));var _0x1a86=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0xa861[_0x2ae2ad];return _0x26dbd7;};var asr=require(_0x1a86('0x0'));module[_0x1a86('0x1')]={'asr':asr}; \ No newline at end of file +var _0x41e0=['exports','./asr'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x41e0,0x18f));var _0x041e=function(_0x1c013d,_0x15a3df){_0x1c013d=_0x1c013d-0x0;var _0xda7764=_0x41e0[_0x1c013d];return _0xda7764;};var asr=require(_0x041e('0x0'));module[_0x041e('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 768691e..f0c3071 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 _0xd4b6=['ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','EventEmitter','./error','127.0.0.1','call','emit','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','error','destroy','E_AGI_SERVER_MAXCONNECTION'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd4b6,0x13f));var _0x6d4b=function(_0xaa5a2d,_0x5d8073){_0xaa5a2d=_0xaa5a2d-0x0;var _0xc64dc2=_0xd4b6[_0xaa5a2d];return _0xc64dc2;};'use strict';var util=require(_0x6d4b('0x0'));var net=require(_0x6d4b('0x1'));var EventEmitter=require('events')[_0x6d4b('0x2')];var AGIError=require(_0x6d4b('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x270e1e,_0x5bba96,_0x56302c){var _0x51dac0=this,_0x270e1e=_0x270e1e||0x11dd,_0x5bba96=_0x5bba96||_0x6d4b('0x4'),_0x442164=null,_0x5daf08=0x0;EventEmitter[_0x6d4b('0x5')](_0x51dac0);function _0x424690(){if(!_0x270e1e){_0x51dac0[_0x6d4b('0x6')]('error',new AGIError(_0x6d4b('0x7')));return![];}_0x442164=net[_0x6d4b('0x8')]();_0x442164[_0x6d4b('0x9')](_0x270e1e,_0x5bba96);_0x442164['on'](_0x6d4b('0xa'),function(){_0x51dac0['emit'](_0x6d4b('0xa'));});_0x442164['on'](_0x6d4b('0xb'),function(_0x97aff7){_0x442164[_0x6d4b('0xc')](function(_0x401e05,_0x45126d){if(_0x401e05){_0x51dac0[_0x6d4b('0x6')]('error',new AGIError(_0x6d4b('0xd'),_0x401e05));}else if(_0x56302c&&_0x56302c<0x0){_0x51dac0[_0x6d4b('0x6')](_0x6d4b('0xe'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x97aff7[_0x6d4b('0xf')]();}else if(_0x56302c&&_0x56302c>0x0&&_0x56302c<_0x45126d){_0x5daf08+=0x1;_0x51dac0[_0x6d4b('0x6')](_0x6d4b('0xe'),new AGIError(_0x6d4b('0x10'),_0x5daf08));_0x97aff7[_0x6d4b('0xf')]();}else{var _0x2bca8b=new AGIChannel(_0x97aff7);_0x2bca8b['on'](_0x6d4b('0x11'),function(){_0x51dac0[_0x6d4b('0x6')](_0x6d4b('0xb'),_0x2bca8b);});}});});_0x442164['on'](_0x6d4b('0xe'),function(_0x591157){_0x51dac0[_0x6d4b('0x6')]('error',new AGIError(_0x6d4b('0xd'),_0x591157[_0x6d4b('0x12')]));});_0x442164['on']('close',function(){_0x51dac0['emit'](_0x6d4b('0x13'),new AGIError(_0x6d4b('0x14')));});}process[_0x6d4b('0x15')](function(){_0x424690();});};util[_0x6d4b('0x16')](AGIServer,EventEmitter);module[_0x6d4b('0x17')]=function(_0x35cf05,_0x188578,_0x162865){return new AGIServer(_0x35cf05,_0x188578,_0x162865);}; \ No newline at end of file +var _0xe914=['getConnections','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','util','net','EventEmitter','./error','./channel','127.0.0.1','call','E_AGI_ARGUMENT_PORT','listening','emit','connection'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0xe914,0x7f));var _0x4e91=function(_0x5a0e32,_0x347ae2){_0x5a0e32=_0x5a0e32-0x0;var _0xea8f24=_0xe914[_0x5a0e32];return _0xea8f24;};'use strict';var util=require(_0x4e91('0x0'));var net=require(_0x4e91('0x1'));var EventEmitter=require('events')[_0x4e91('0x2')];var AGIError=require(_0x4e91('0x3'));var AGIChannel=require(_0x4e91('0x4'));var AGIServer=function(_0x471f1d,_0x297dc0,_0x59e102){var _0x4f4e88=this,_0x471f1d=_0x471f1d||0x11dd,_0x297dc0=_0x297dc0||_0x4e91('0x5'),_0x5d4c14=null,_0x29c27c=0x0;EventEmitter[_0x4e91('0x6')](_0x4f4e88);function _0x2f2098(){if(!_0x471f1d){_0x4f4e88['emit']('error',new AGIError(_0x4e91('0x7')));return![];}_0x5d4c14=net['createServer']();_0x5d4c14['listen'](_0x471f1d,_0x297dc0);_0x5d4c14['on'](_0x4e91('0x8'),function(){_0x4f4e88[_0x4e91('0x9')](_0x4e91('0x8'));});_0x5d4c14['on'](_0x4e91('0xa'),function(_0x4c690f){_0x5d4c14[_0x4e91('0xb')](function(_0x200bd1,_0x38d3b4){if(_0x200bd1){_0x4f4e88['emit'](_0x4e91('0xc'),new AGIError(_0x4e91('0xd'),_0x200bd1));}else if(_0x59e102&&_0x59e102<0x0){_0x4f4e88[_0x4e91('0x9')](_0x4e91('0xc'),new AGIError(_0x4e91('0xe')));_0x4c690f[_0x4e91('0xf')]();}else if(_0x59e102&&_0x59e102>0x0&&_0x59e102<_0x38d3b4){_0x29c27c+=0x1;_0x4f4e88[_0x4e91('0x9')](_0x4e91('0xc'),new AGIError(_0x4e91('0x10'),_0x29c27c));_0x4c690f['destroy']();}else{var _0x523594=new AGIChannel(_0x4c690f);_0x523594['on'](_0x4e91('0x11'),function(){_0x4f4e88[_0x4e91('0x9')]('connection',_0x523594);});}});});_0x5d4c14['on'](_0x4e91('0xc'),function(_0x83fe44){_0x4f4e88[_0x4e91('0x9')](_0x4e91('0xc'),new AGIError(_0x4e91('0xd'),_0x83fe44[_0x4e91('0x12')]));});_0x5d4c14['on'](_0x4e91('0x13'),function(){_0x4f4e88[_0x4e91('0x9')]('close',new AGIError(_0x4e91('0x14')));});}process[_0x4e91('0x15')](function(){_0x2f2098();});};util[_0x4e91('0x16')](AGIServer,EventEmitter);module['exports']=function(_0x23caed,_0x16947e,_0x4a332b){return new AGIServer(_0x23caed,_0x16947e,_0x4a332b);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index d1c313b..b1d11a5 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 _0xbe78=['Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','shelljs','odbc','randomstring','mustache','../../config/logger','agi','../../config/environment','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','prototype','getSquareProject','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','createSmsMessage','createSquareDetailsReport','uniqueid','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','MP3','googleTTS','restAPI','url','method','timeout','includes','POST','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','headers','stringify','render','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','ispeechTTS','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','appid','appsecret','clear','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','saveRestApiResult','%s.%s','setVariable','split','length','replaceAll','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','label','noop','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','sestekNDA','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','no\x20trunk\x20selected','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','phone','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','tildeASR','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','escape_digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','bcc','subject','service','host','secure','authentication','auth','user','pass','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','getSmsAccount','sms_account_id','no\x20sms\x20account\x20found','sms_text','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','yes'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0xbe78,0x1e4));var _0x8be7=function(_0x26acad,_0x34a85d){_0x26acad=_0x26acad-0x0;var _0x5ca7ea=_0xbe78[_0x26acad];return _0x5ca7ea;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x8be7('0x0'));var _=require('lodash');var sh=require(_0x8be7('0x1'));var odbc=require(_0x8be7('0x2'))();var rs=require(_0x8be7('0x3'));var moment=require('moment');var Mustache=require(_0x8be7('0x4'));var rp=require('request-promise');var logger=require(_0x8be7('0x5'))(_0x8be7('0x6'));var config=require(_0x8be7('0x7'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x8be7('0x8'),_0x8be7('0x9')];var verticesWithRetry=['menu',_0x8be7('0xa'),_0x8be7('0xb')];var AGIVertices=function(_0x39e873,_0x165d81,_0x3e0b14){this[_0x8be7('0xc')]=_0x39e873;this[_0x8be7('0xd')]=_0x165d81;this[_0x8be7('0xe')]=_0x3e0b14;};AGIVertices['prototype'][_0x8be7('0xf')]=function(_0x55f798,_0xe0b67f){this[_0x8be7('0xd')][_0x8be7('0x10')](_0x55f798)[_0x8be7('0x11')](function(_0x5d0df8){_0xe0b67f(null,_0x5d0df8?_0x5d0df8[_0x8be7('0x12')]:![]);})[_0x8be7('0x13')](function(_0x303344){_0xe0b67f(_0x303344);});};AGIVertices['prototype'][_0x8be7('0x14')]=function(_0x3ea007,_0x50417a){this[_0x8be7('0xd')][_0x8be7('0x15')](_0x3ea007)['then'](function(_0x33c895){_0x50417a(null,_0x33c895?_0x33c895[_0x8be7('0x12')]:![]);})['catch'](function(_0x2a4ff4){_0x50417a(_0x2a4ff4);});};AGIVertices[_0x8be7('0x16')][_0x8be7('0x17')]=function(_0xfbaca8,_0x492f5b){this['rpc']['getSquareProjectById'](_0xfbaca8)[_0x8be7('0x11')](function(_0x20703d){_0x492f5b(null,_0x20703d?_0x20703d[_0x8be7('0x12')]:![]);})[_0x8be7('0x13')](function(_0x2d0bb4){_0x492f5b(_0x2d0bb4);});};AGIVertices[_0x8be7('0x16')]['getSquareOdbc']=function(_0x518733,_0x4f37f1){this[_0x8be7('0xd')][_0x8be7('0x18')](_0x518733)['then'](function(_0x29c5a5){_0x4f37f1(null,_0x29c5a5?_0x29c5a5[_0x8be7('0x19')]:![]);})[_0x8be7('0x13')](function(_0x429c03){_0x4f37f1(_0x429c03);});};AGIVertices[_0x8be7('0x16')][_0x8be7('0x1a')]=function(_0x1c01c6,_0x346362){this['rpc'][_0x8be7('0x1b')](_0x1c01c6)[_0x8be7('0x11')](function(_0x31c6e1){_0x346362(null,_0x31c6e1?_0x31c6e1['name']:![]);})[_0x8be7('0x13')](function(_0x86f368){_0x346362(_0x86f368);});};AGIVertices[_0x8be7('0x16')][_0x8be7('0x1c')]=function(_0x10189f,_0x1be82f){this[_0x8be7('0xd')][_0x8be7('0x1d')](_0x10189f)['then'](function(_0x947f3a){_0x1be82f(null,_0x947f3a?_0x947f3a[_0x8be7('0x12')]:![]);})[_0x8be7('0x13')](function(_0x3c4c7f){_0x1be82f(_0x3c4c7f);});};AGIVertices[_0x8be7('0x16')]['getSound']=function(_0x896fa3,_0x447caa){var _0x59ddd=this;this[_0x8be7('0xd')][_0x8be7('0x1e')](_0x896fa3)[_0x8be7('0x11')](function(_0x4a1b97){_0x447caa(null,_0x4a1b97?_0x59ddd['getSoundPath'](_0x4a1b97[_0x8be7('0x1f')]):![]);})['catch'](function(_0x3b117f){_0x447caa(_0x3b117f);});};AGIVertices['prototype'][_0x8be7('0x20')]=function(_0x127283,_0x14adb3){this[_0x8be7('0xd')][_0x8be7('0x21')](_0x127283)['then'](function(_0x3431c8){_0x14adb3(null,_0x3431c8?_0x3431c8:![]);})['catch'](function(_0x2ded9a){_0x14adb3(_0x2ded9a);});};AGIVertices[_0x8be7('0x16')][_0x8be7('0x22')]=function(_0x306a21,_0x2ca86e,_0x54a237){this[_0x8be7('0xe')][_0x8be7('0x22')](_0x306a21,_0x2ca86e)['then'](function(){_0x54a237(null);})[_0x8be7('0x13')](function(_0x31b4fe){_0x54a237(_0x31b4fe);});};AGIVertices['prototype'][_0x8be7('0x23')]=function(_0x44f94b,_0x459720){this[_0x8be7('0xd')]['getIntervalById'](_0x44f94b)[_0x8be7('0x11')](function(_0x2f813a){if(_0x2f813a){if(_0x2f813a[_0x8be7('0x24')]){_0x459720(null,[_0x2f813a[_0x8be7('0x25')]]);}else{_0x459720(null,_[_0x8be7('0x26')](_0x2f813a['Intervals'],_0x8be7('0x25')));}}else{_0x459720(null,![]);}})[_0x8be7('0x13')](function(_0x427463){_0x459720(_0x427463);});};AGIVertices[_0x8be7('0x16')][_0x8be7('0x27')]=function(_0x5a2f81){return util[_0x8be7('0x28')](_0x8be7('0x29'),FILES_PATH,_0x5a2f81);};AGIVertices['prototype'][_0x8be7('0x2a')]=function(_0x5881ac,_0x446a57,_0x1ad684){odbc[_0x8be7('0x2b')](_0x5881ac,function(_0x32f4a5){if(_0x32f4a5){logger['error'](_0x8be7('0x2c'),_0x32f4a5);_0x1ad684(_0x32f4a5);}else{logger[_0x8be7('0x2d')](_0x8be7('0x2e'));odbc['query'](_0x446a57,function(_0x8293a2,_0x2802f1){if(_0x8293a2){logger[_0x8be7('0x2d')](_0x8be7('0x2f'),_0x446a57);_0x1ad684(_0x8293a2);}else{logger[_0x8be7('0x2d')](_0x8be7('0x30'),_0x446a57);odbc[_0x8be7('0x31')](function(_0x4b3408){if(_0x4b3408){logger[_0x8be7('0x32')](_0x8be7('0x33'),_0x4b3408);}_0x1ad684(null,_0x2802f1);});}});}});};AGIVertices[_0x8be7('0x16')]['getSmsAccount']=function(_0x3e90ca,_0x5d60f1){this[_0x8be7('0xd')]['getSmsAccountById'](_0x3e90ca)[_0x8be7('0x11')](function(_0x235d47){_0x5d60f1(null,_0x235d47?_0x235d47:![]);})[_0x8be7('0x13')](function(_0x4cd009){_0x5d60f1(_0x4cd009);});};AGIVertices[_0x8be7('0x16')]['createSmsMessage']=function(_0x136870,_0x1613e0){this[_0x8be7('0xd')][_0x8be7('0x34')](_0x136870)[_0x8be7('0x11')](function(_0x434dec){_0x1613e0(null,_0x434dec);})[_0x8be7('0x13')](function(_0x392e19){_0x1613e0(_0x392e19);});};AGIVertices[_0x8be7('0x16')][_0x8be7('0x35')]=function(_0x4ee049,_0xb0b211,_0x5bc561){this['rpc'][_0x8be7('0x35')]({'uniqueid':this[_0x8be7('0xc')][_0x8be7('0x36')],'node':_0x4ee049['label'],'application':_0x4ee049['agicommand'],'data':_0xb0b211||null,'project_name':this['channel'][_0x8be7('0x37')],'callerid':this[_0x8be7('0xc')][_0x8be7('0x38')]})[_0x8be7('0x11')](function(_0x5b9b05){if(_0x5bc561){_0x5bc561(null,_0x5b9b05);}})[_0x8be7('0x13')](function(_0x2e02b2){if(_0x5bc561){_0x5bc561(_0x2e02b2);}});};AGIVertices['prototype']['createSquareRecording']=function(_0xfb3959,_0x37801,_0x41d696,_0x44cbbc){this[_0x8be7('0xd')][_0x8be7('0x39')]({'uniqueid':this['channel'][_0x8be7('0x36')],'callerid':this['channel'][_0x8be7('0x38')],'calleridname':this[_0x8be7('0xc')][_0x8be7('0x3a')],'context':this[_0x8be7('0xc')][_0x8be7('0x3b')],'extension':this[_0x8be7('0xc')][_0x8be7('0x3c')],'priority':this[_0x8be7('0xc')]['priority'],'accountcode':this['channel'][_0x8be7('0x3d')],'dnid':this[_0x8be7('0xc')]['dnid'],'projectName':this[_0x8be7('0xc')][_0x8be7('0x37')],'saveName':_0x37801,'filename':_0xfb3959['file']||_0x37801,'savePath':_0x41d696})[_0x8be7('0x11')](function(_0x1db3aa){_0x44cbbc(null,_0x1db3aa);})[_0x8be7('0x13')](function(_0x3b5cc7){_0x44cbbc(_0x3b5cc7);});};AGIVertices['prototype'][_0x8be7('0x3e')]=function(_0x3a7e25,_0x571dff,_0x20b42d){this[_0x8be7('0xd')][_0x8be7('0x3e')]({'uniqueid':this[_0x8be7('0xc')][_0x8be7('0x36')],'body':_0x3a7e25,'direction':_0x571dff})['then'](function(_0x1bad1c){if(_0x20b42d){_0x20b42d(null,_0x1bad1c);}})[_0x8be7('0x13')](function(_0x2ffac2){if(_0x20b42d){_0x20b42d(_0x2ffac2);}});};AGIVertices[_0x8be7('0x16')][_0x8be7('0x3f')]=function(_0x56d7b6,_0x2657ee){this[_0x8be7('0xd')][_0x8be7('0x3f')]({'firstName':_[_0x8be7('0x40')](_0x56d7b6[_0x8be7('0x12')])||_[_0x8be7('0x41')](_0x56d7b6[_0x8be7('0x12')])?_0x8be7('0x42')+Math[_0x8be7('0x43')]():_0x56d7b6[_0x8be7('0x12')],'lastName':_[_0x8be7('0x40')](_0x56d7b6[_0x8be7('0x44')])||_[_0x8be7('0x41')](_0x56d7b6[_0x8be7('0x44')])?null:_0x56d7b6[_0x8be7('0x44')],'phone':_0x56d7b6['phone'],'ListId':_0x56d7b6[_0x8be7('0x45')],'scheduledat':_0x56d7b6[_0x8be7('0x46')],'callbackUniqueid':this[_0x8be7('0xc')][_0x8be7('0x36')],'tags':_0x8be7('0x47'),'description':_0x8be7('0x48')+_0x56d7b6[_0x8be7('0x46')]['toString'](),'priority':_0x56d7b6[_0x8be7('0x49')]})[_0x8be7('0x11')](function(_0x5ed5c6){_0x2657ee(null,_0x5ed5c6);})[_0x8be7('0x13')](function(_0x3b16b6){_0x2657ee(_0x3b16b6);});};AGIVertices[_0x8be7('0x16')][_0x8be7('0x4a')]=function(_0x5053a7,_0x422b37){this[_0x8be7('0xd')][_0x8be7('0x4b')](_0x5053a7)[_0x8be7('0x11')](function(_0x5d779b){_0x422b37(null,_0x5d779b?_0x5d779b[_0x8be7('0x12')]:![]);})['catch'](function(_0x6269cc){_0x422b37(_0x6269cc);});};AGIVertices['prototype'][_0x8be7('0x4c')]=function(_0xc79582,_0x5554ca,_0x18e5fd){var _0x5d7820={'role':_0x8be7('0x4d')};_0x5d7820[_0xc79582]=this[_0x8be7('0xc')][_0x8be7('0x38')];this[_0x8be7('0xd')][_0x8be7('0x4c')](_0x5d7820,_0x5554ca,this[_0x8be7('0xc')][_0x8be7('0x36')])[_0x8be7('0x11')](function(_0x36416b){_0x18e5fd(null,_[_0x8be7('0x41')](_0x36416b)?![]:!![]);})[_0x8be7('0x13')](function(_0x3c534f){logger['error'](_0x3c534f);_0x18e5fd(null,![]);});};AGIVertices[_0x8be7('0x16')][_0x8be7('0x4e')]=function(_0x53206a,_0x2b3cbe){var _0x351cba={'role':_0x8be7('0x4d')};_0x351cba[_0x53206a]=this[_0x8be7('0xc')]['callerid'];this[_0x8be7('0xd')]['agentUnpause'](_0x351cba)[_0x8be7('0x11')](function(_0x5ec189){_0x2b3cbe(null,_[_0x8be7('0x41')](_0x5ec189)?![]:!![]);})[_0x8be7('0x13')](function(_0x4dec7a){logger[_0x8be7('0x32')](_0x4dec7a);_0x2b3cbe(null,![]);});};AGIVertices[_0x8be7('0x16')]['agentLogout']=function(_0x3ae043,_0x4d9d11){var _0x122a51={'role':_0x8be7('0x4d')};_0x122a51[_0x3ae043]=this[_0x8be7('0xc')][_0x8be7('0x38')];this[_0x8be7('0xd')][_0x8be7('0x4f')](_0x122a51)['then'](function(_0x353885){_0x4d9d11(null,_[_0x8be7('0x41')](_0x353885)?![]:!![]);})[_0x8be7('0x13')](function(_0x3d3a20){logger[_0x8be7('0x32')](_0x3d3a20);_0x4d9d11(null,![]);});};AGIVertices[_0x8be7('0x16')][_0x8be7('0x50')]=function(_0x47e172,_0x8c532a){var _0x4a6628={'role':_0x8be7('0x4d')};_0x4a6628[_0x47e172]=this[_0x8be7('0xc')]['callerid'];var _0x16ac6b=_0x47e172!=_0x8be7('0x51')?util[_0x8be7('0x28')](_0x8be7('0x52'),_0x8be7('0x53'),this[_0x8be7('0xc')][_0x8be7('0x38')]):undefined;this[_0x8be7('0xd')][_0x8be7('0x50')](_0x4a6628,_0x16ac6b)[_0x8be7('0x11')](function(_0x3856d0){_0x8c532a(null,_[_0x8be7('0x41')](_0x3856d0)?![]:!![]);})[_0x8be7('0x13')](function(_0x551161){logger[_0x8be7('0x32')](_0x551161);_0x8c532a(null,![]);});};AGIVertices[_0x8be7('0x16')][_0x8be7('0x54')]=function(_0x3cbc51,_0x4214e1){sh['exec'](_[_0x8be7('0x55')](_0x3cbc51),function(_0x2226a6,_0x320d0c){var _0x447675=_0x320d0c[_0x8be7('0x56')](/(\r\n|\n|\r)/gm,'');_0x4214e1(null,_0x447675);});};AGIVertices[_0x8be7('0x16')][_0x8be7('0x57')]=function(_0x597342,_0x2199ca){scripts[_0x8be7('0x57')](_0x597342[_0x8be7('0x58')],_0x597342['google_cloud_tts_text_type']||_0x8be7('0x59'),_0x597342[_0x8be7('0x59')],_0x597342[_0x8be7('0x5a')]||_0x8be7('0x5b'),_0x597342[_0x8be7('0x5c')]||_0x8be7('0x5d'),_0x597342['audioEncoding']||_0x8be7('0x5e'))['then'](function(_0x3c0dcc){_0x2199ca(null,_0x3c0dcc);})[_0x8be7('0x13')](function(_0x52dc2a){_0x2199ca(_0x52dc2a);});};AGIVertices[_0x8be7('0x16')][_0x8be7('0x5f')]=function(_0x220e7f,_0x3f8ee3){scripts[_0x8be7('0x5f')](_0x220e7f[_0x8be7('0x59')],_0x220e7f['google_tts_language']||'en',0x1)['then'](function(_0xb48b34){_0x3f8ee3(null,_0xb48b34);})['catch'](function(_0x27a098){_0x3f8ee3(_0x27a098);});};AGIVertices[_0x8be7('0x16')][_0x8be7('0x60')]=function(_0x9f670f,_0x967db5){var _0x315aec={'uri':_0x9f670f[_0x8be7('0x61')],'method':_0x9f670f[_0x8be7('0x62')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9f670f[_0x8be7('0x63')])==='number'&&parseInt(_0x9f670f[_0x8be7('0x63')])>=0x1?parseInt(_0x9f670f['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x8be7('0x64')]([_0x8be7('0x65'),'PUT'],_0x315aec[_0x8be7('0x62')][_0x8be7('0x66')]())){try{_0x315aec[_0x8be7('0x67')]=_0x9f670f['rawBody']?JSON[_0x8be7('0x68')](_0x9f670f[_0x8be7('0x9')]):{};}catch(_0x596a52){logger[_0x8be7('0x32')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x596a52);}}try{_0x315aec['headers']=_0x9f670f[_0x8be7('0x8')]?JSON[_0x8be7('0x68')](_0x9f670f[_0x8be7('0x8')]):{};}catch(_0x223c0d){logger['error'](_0x8be7('0x69'),_0x223c0d);}if(_0x9f670f[_0x8be7('0x6a')]){try{var _0x24031a=require(_0x9f670f[_0x8be7('0x6a')])[_0x8be7('0x6b')](this,_0x315aec);_0x315aec[_0x8be7('0x6c')]=Mustache['render'](_0x9f670f[_0x8be7('0x61')],_0x24031a,{},['$$','$$']);if(_0x315aec[_0x8be7('0x6d')]){_0x315aec[_0x8be7('0x6d')]=JSON[_0x8be7('0x68')](Mustache['render'](JSON[_0x8be7('0x6e')](_0x315aec[_0x8be7('0x6d')]),_0x24031a,{},['$$','$$']));}if(_0x315aec[_0x8be7('0x67')]){_0x315aec['body']=JSON['parse'](Mustache[_0x8be7('0x6f')](JSON[_0x8be7('0x6e')](_0x315aec[_0x8be7('0x67')]),_0x24031a,{},['$$','$$']));}}catch(_0x20cc23){logger[_0x8be7('0x32')](_0x8be7('0x70'),_0x20cc23);}}rp(_0x315aec)[_0x8be7('0x11')](function(_0x370b36){var _0x25c698={'statusCode':_0x370b36[_0x8be7('0x71')]||0xc8,'statusMessage':_0x370b36['statusMessage']||'OK','headers':_0x370b36[_0x8be7('0x6d')]||{},'body':_0x370b36['body']||{}};_0x967db5(null,_0x25c698);})['catch'](function(_0x1478b8){var _0x46e63a={'statusCode':_0x1478b8['statusCode']||0x1f4,'statusMessage':_0x1478b8[_0x8be7('0x72')]||_0x8be7('0x73'),'headers':_0x1478b8[_0x8be7('0x74')]['headers']||{},'body':_0x1478b8[_0x8be7('0x74')][_0x8be7('0x67')]||{}};_0x967db5(null,_0x46e63a);});};AGIVertices['prototype'][_0x8be7('0x75')]=function(_0xb17bde,_0x4ea475){scripts[_0x8be7('0x75')](this[_0x8be7('0xc')][_0x8be7('0x36')],_0xb17bde[_0x8be7('0x76')],_0xb17bde[_0x8be7('0x59')],_0xb17bde['dialogflow_language']||'en')[_0x8be7('0x11')](function(_0x25484c){_0x4ea475(null,_0x25484c);})['catch'](function(_0x5a83de){_0x4ea475(_0x5a83de);});};AGIVertices[_0x8be7('0x16')]['sestekNDA']=function(_0x3c9fa7,_0x41d039){scripts['sestekNDA'](this['channel'],_0x3c9fa7)[_0x8be7('0x11')](function(_0x1b7f7a){_0x41d039(null,_0x1b7f7a);})['catch'](function(_0x10728a){_0x41d039(_0x10728a);});};AGIVertices['prototype']['ispeechTTS']=function(_0x66ad04,_0x588699){scripts[_0x8be7('0x77')](_0x66ad04[_0x8be7('0x76')],_0x66ad04[_0x8be7('0x59')],_0x66ad04['ispeech_tts_language']||_0x8be7('0x5b'),_0x66ad04[_0x8be7('0x78')])[_0x8be7('0x11')](function(_0x4c56f3){_0x588699(null,_0x4c56f3);})[_0x8be7('0x13')](function(_0xd7fdc0){_0x588699(_0xd7fdc0);});};AGIVertices[_0x8be7('0x16')][_0x8be7('0x79')]=function(_0x341638,_0x5ac0b6,_0x3a98e6){scripts['ispeechASR'](_0x5ac0b6,_0x341638['key'],_0x341638['ispeech_asr_language']||_0x8be7('0x5b'),this[_0x8be7('0x7a')](_0x341638[_0x8be7('0x7b')])?_0x341638['model']:undefined)['then'](function(_0x4a7c90){_0x3a98e6(null,_0x4a7c90);})[_0x8be7('0x13')](function(_0x5b6c4e){_0x3a98e6(_0x5b6c4e);});};AGIVertices['prototype']['awsPolly']=function(_0x298e88,_0x3fa7d5){scripts[_0x8be7('0x7c')](_0x298e88[_0x8be7('0x7d')],_0x298e88[_0x8be7('0x7e')],_0x298e88[_0x8be7('0x7f')],_0x298e88[_0x8be7('0x80')]||_0x8be7('0x81'),_0x298e88[_0x8be7('0x59')],_0x298e88[_0x8be7('0x82')]||_0x8be7('0x59'))[_0x8be7('0x11')](function(_0x2f53a2){_0x3fa7d5(null,_0x2f53a2);})[_0x8be7('0x13')](function(_0x2de85d){_0x3fa7d5(_0x2de85d);});};AGIVertices[_0x8be7('0x16')][_0x8be7('0x83')]=function(_0x3c020b,_0x62184){scripts[_0x8be7('0x83')](this[_0x8be7('0xc')][_0x8be7('0x36')],_0x3c020b[_0x8be7('0x7d')],_0x3c020b[_0x8be7('0x7e')],_0x3c020b[_0x8be7('0x84')],_0x3c020b[_0x8be7('0x59')],_0x3c020b[_0x8be7('0x85')])[_0x8be7('0x11')](function(_0x266bf1){_0x62184(null,_0x266bf1);})[_0x8be7('0x13')](function(_0x463330){_0x62184(_0x463330);});};AGIVertices[_0x8be7('0x16')][_0x8be7('0x86')]=function(_0x48fc01,_0x423c60,_0x2cb0a8){scripts['googleASR'](_0x423c60,_0x48fc01[_0x8be7('0x76')],_0x48fc01[_0x8be7('0x87')]||_0x8be7('0x5b'))[_0x8be7('0x11')](function(_0x4f156e){_0x2cb0a8(null,_0x4f156e);})['catch'](function(_0x488903){_0x2cb0a8(_0x488903);});};AGIVertices[_0x8be7('0x16')]['tildeASR']=function(_0x2a8089,_0x58615e,_0xfd4b8a){scripts['tildeASR'](_0x58615e,_0x2a8089[_0x8be7('0x88')],_0x2a8089[_0x8be7('0x89')],_0x2a8089[_0x8be7('0x6c')])[_0x8be7('0x11')](function(_0x2c662c){_0xfd4b8a(null,_0x2c662c);})[_0x8be7('0x13')](function(_0x43efb0){_0xfd4b8a(_0x43efb0);});};AGIVertices['prototype'][_0x8be7('0x8a')]=function(_0x67771a){var _0x4e5c66=_[_0x8be7('0x64')](verticesWithRetry,_0x67771a[_0x8be7('0x8b')])?_0x67771a:_[_0x8be7('0x8c')](_0x67771a);for(var _0x94906e in _0x4e5c66){if(_0x4e5c66[_0x8be7('0x8d')](_0x94906e)){if(_0x4e5c66[_0x94906e]&&_[_0x8be7('0x8e')](_0x4e5c66[_0x94906e])){if(_['includes'](recursiveMapAttributes,_0x94906e)){_0x4e5c66[_0x94906e]=this[_0x8be7('0x8f')](_0x4e5c66[_0x94906e]);}else{_0x4e5c66[_0x94906e]=this[_0x8be7('0x90')](_0x4e5c66[_0x94906e]);}}}}return _0x4e5c66;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0x4748e1){for(var _0x5d8f7a in _0x4748e1){if(_0x4748e1[_0x8be7('0x8d')](_0x5d8f7a)){if(_['isPlainObject'](_0x4748e1[_0x5d8f7a])){this[_0x8be7('0x91')](_0x4748e1[_0x5d8f7a]);}else if(_['isArray'](_0x4748e1[_0x5d8f7a])){for(var _0x58a1a0=0x0;_0x58a1a0<_0x4748e1[_0x5d8f7a]['length'];_0x58a1a0++){this['recursiveNodeIndex'](_0x4748e1[_0x5d8f7a][_0x58a1a0]);}}else if(_[_0x8be7('0x8e')](_0x4748e1[_0x5d8f7a])){_0x4748e1[_0x5d8f7a]=this[_0x8be7('0x90')](_0x4748e1[_0x5d8f7a]);}}}};AGIVertices[_0x8be7('0x16')]['saveRestApiResult']=function(_0x182e8e,_0x314734){for(var _0x4aac88 in _0x182e8e){if(_0x182e8e[_0x8be7('0x8d')](_0x4aac88)){if(_[_0x8be7('0x92')](_0x182e8e[_0x4aac88])){if(!_[_0x8be7('0x40')](_0x182e8e[_0x4aac88])){this[_0x8be7('0x93')](_0x182e8e[_0x4aac88],util[_0x8be7('0x28')](_0x8be7('0x94'),_0x314734,_0x4aac88));}}else if(_['isArray'](_0x182e8e[_0x4aac88])){for(var _0x5d11ac=0x0;_0x5d11ac<_0x182e8e[_0x4aac88]['length'];_0x5d11ac++){this[_0x8be7('0x93')](_0x182e8e[_0x4aac88][_0x5d11ac],util[_0x8be7('0x28')](_0x8be7('0x94'),_0x314734,_0x4aac88+'['+_0x5d11ac+']'));}}else{if(!_[_0x8be7('0x41')](_0x182e8e[_0x4aac88])){this['channel'][_0x8be7('0x95')](util[_0x8be7('0x28')](_0x8be7('0x94'),_0x314734,_0x4aac88),_0x182e8e[_0x4aac88]);}}}}};AGIVertices[_0x8be7('0x16')][_0x8be7('0x8f')]=function(_0xc96d17){try{var _0x171dc0=JSON[_0x8be7('0x68')](_0xc96d17);this[_0x8be7('0x91')](_0x171dc0);return JSON[_0x8be7('0x6e')](_0x171dc0);}catch(_0x5bdb65){return this[_0x8be7('0x90')](_0xc96d17);}};AGIVertices[_0x8be7('0x16')][_0x8be7('0x90')]=function(_0x3cc9a7){var _0x5f563f=_0x3cc9a7[_0x8be7('0x96')]('{');for(var _0x20442c=0x1;_0x20442c<_0x5f563f[_0x8be7('0x97')];_0x20442c+=0x1){var _0x3cea13=_0x5f563f[_0x20442c][_0x8be7('0x96')]('}');if(_0x3cea13[_0x8be7('0x97')]>0x1){_0x3cc9a7=_0x3cc9a7[_0x8be7('0x98')]('{'+_0x3cea13[0x0]+'}',this[_0x8be7('0xc')][_0x8be7('0xf')](_0x3cea13[0x0])[_0x8be7('0x99')]||_0x3cea13[0x0]);}}if(_0x5f563f[_0x8be7('0x97')]===0x1){return _0x3cc9a7[_0x8be7('0x9a')]();}return this[_0x8be7('0x90')](_0x3cc9a7);};AGIVertices[_0x8be7('0x16')][_0x8be7('0x9b')]=function(_0x372c9c,_0xd31306){var _0x26c0c6=this[_0x8be7('0xc')]['getVariable'](_0x372c9c);if(_0x26c0c6[_0x8be7('0x9c')]===-0x1){return _0x26c0c6;}logger['info'](util[_0x8be7('0x28')](_0x8be7('0x9d'),_0xd31306,_0x26c0c6[_0x8be7('0x99')]));return this[_0x8be7('0xc')]['setVariable'](_0xd31306,_0x26c0c6[_0x8be7('0x99')]);};AGIVertices['prototype'][_0x8be7('0x7a')]=function(_0x388542){return _0x388542&&_0x388542!=='0'&&_0x388542!=='-1'&&_0x388542!=='';};AGIVertices['prototype'][_0x8be7('0x9e')]=function(_0x4e1572){this[_0x8be7('0x35')][_0x8be7('0x6b')](this,_0x4e1572,'-');_0x4e1572[_0x8be7('0x9f')]=_0x4e1572['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x8be7('0x16')][_0x8be7('0xa0')]=function(_0x1a00a4){logger[_0x8be7('0x2d')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x1a00a4[_0x8be7('0xa1')]));if(!this[_0x8be7('0x7a')](_0x1a00a4[_0x8be7('0x59')])){return this[_0x8be7('0xc')][_0x8be7('0xa2')]('no\x20text\x20configured');}var _0x583a1e='\x22'+_0x1a00a4['text']+'\x22';if(this['isConfigured'](_0x1a00a4[_0x8be7('0x74')])){_0x583a1e+=','+_0x1a00a4[_0x8be7('0x74')];}var _0x5ad76e=this[_0x8be7('0xc')][_0x8be7('0xa3')](_0x8be7('0xa4'),_0x583a1e);if(_0x5ad76e[_0x8be7('0x9c')]===-0x1){return _0x5ad76e;}return this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0xa5'),_0x583a1e));};AGIVertices[_0x8be7('0x16')][_0x8be7('0xa6')]=function(_0x973f90){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x973f90[_0x8be7('0xa1')]));if(!this[_0x8be7('0x7a')](_0x973f90['grammar'])){return this[_0x8be7('0xc')][_0x8be7('0xa2')]('no\x20grammar\x20configured');}var _0x1c6eaf=_0x973f90['grammar'];if(this[_0x8be7('0x7a')](_0x973f90[_0x8be7('0x74')])){_0x1c6eaf+=','+_0x973f90['options'];}var _0x167237=this[_0x8be7('0xc')][_0x8be7('0xa3')](_0x8be7('0xa7'),_0x1c6eaf);if(_0x167237[_0x8be7('0x9c')]===-0x1){return _0x167237;}var _0x2f8bf4=this['getAndSetVariable'](_0x8be7('0xa8'),'MRCP_RECOG_CONFIDENCE');if(_0x2f8bf4['result']===-0x1){return _0x2f8bf4;}var _0x13d80d=this['getAndSetVariable'](_0x8be7('0xa9'),_0x8be7('0xaa'));if(_0x13d80d[_0x8be7('0x9c')]===-0x1){return _0x13d80d;}var _0x208503=this['getAndSetVariable']('RECOG_INSTANCE()',_0x8be7('0xab'));if(_0x208503[_0x8be7('0x9c')]===-0x1){return _0x208503;}return this[_0x8be7('0xc')][_0x8be7('0xa2')](util['format'](_0x8be7('0xac'),_0x1c6eaf));};AGIVertices[_0x8be7('0x16')][_0x8be7('0x6')]=function(_0xe0dcf9){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0xad'),_0xe0dcf9[_0x8be7('0xa1')]));return this['channel']['agi']([_0xe0dcf9[_0x8be7('0xae')],_0xe0dcf9[_0x8be7('0xaf')]]);};AGIVertices[_0x8be7('0x16')][_0x8be7('0xb0')]=function(_0xc19ea7){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0xb1'),_0xc19ea7[_0x8be7('0xa1')]));if(this[_0x8be7('0x7a')](_0xc19ea7[_0x8be7('0x63')])){logger['info'](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0xc19ea7[_0x8be7('0x63')]));var _0x59ab30=this[_0x8be7('0xc')][_0x8be7('0xb2')](_0xc19ea7[_0x8be7('0x63')]);if(_0x59ab30[_0x8be7('0x9c')]===-0x1){return _0x59ab30;}}return this[_0x8be7('0xc')][_0x8be7('0xb0')]();};AGIVertices[_0x8be7('0x16')][_0x8be7('0x47')]=function(_0xbf1779){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0xb3'),_0xbf1779[_0x8be7('0xa1')]));if(!this['isConfigured'](_0xbf1779['list_id'])){return this[_0x8be7('0xc')]['error'](_0xbf1779,_0x8be7('0xb4'));}_0xbf1779['scheduledAt']=moment();if(this[_0x8be7('0x7a')](_0xbf1779['delay'])){_0xbf1779[_0x8be7('0x46')]=moment()[_0x8be7('0xb5')](_0xbf1779[_0x8be7('0xb6')],_0x8be7('0xb7'));}if(!this[_0x8be7('0x7a')](_0xbf1779['callback_priority'])){_0xbf1779[_0x8be7('0x49')]=0x2;}this[_0x8be7('0x3f')]['sync'](this,_0xbf1779);return this[_0x8be7('0xc')][_0x8be7('0xa2')](util['format'](_0x8be7('0xb8'),_0xbf1779['phone'],_0xbf1779[_0x8be7('0x45')],_0xbf1779[_0x8be7('0x46')]));};AGIVertices[_0x8be7('0x16')][_0x8be7('0xb9')]=function(_0x1885fe){logger['info'](util[_0x8be7('0x28')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x1885fe['label']));var _0x55afa5=this[_0x8be7('0xc')][_0x8be7('0xa3')](_0x1885fe[_0x8be7('0xba')],_0x1885fe[_0x8be7('0x74')]);if(_0x55afa5[_0x8be7('0x9c')]===-0x1){return _0x55afa5;}return this[_0x8be7('0xc')]['noop'](util[_0x8be7('0x28')](_0x8be7('0xbb'),_0x1885fe[_0x8be7('0xba')],_0x1885fe[_0x8be7('0x74')]));};AGIVertices['prototype'][_0x8be7('0xbc')]=function(_0x3c7301){logger[_0x8be7('0x2d')](util['format'](_0x8be7('0xbd'),_0x3c7301[_0x8be7('0xa1')]));if(!this[_0x8be7('0x7a')](_0x3c7301[_0x8be7('0x59')])){return this[_0x8be7('0xc')][_0x8be7('0xa2')](_0x8be7('0xbe'));}var _0x300063='\x22'+_0x3c7301[_0x8be7('0x59')]+'\x22';if(this[_0x8be7('0x7a')](_0x3c7301[_0x8be7('0x74')])){_0x300063+=','+_0x3c7301[_0x8be7('0x74')];}var _0xe8272b=this[_0x8be7('0xc')]['exec'](_0x8be7('0xa4'),_0x300063);if(_0xe8272b[_0x8be7('0x9c')]===-0x1){return _0xe8272b;}return this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0xa5'),_0x300063));};AGIVertices[_0x8be7('0x16')]['sestektts']=function(_0x116942){logger[_0x8be7('0x2d')](util['format'](_0x8be7('0xbf'),_0x116942[_0x8be7('0xa1')]));if(!this['isConfigured'](_0x116942['text'])){return this[_0x8be7('0xc')][_0x8be7('0xa2')](_0x8be7('0xbe'));}var _0x483e36='\x22'+_0x116942['text']+'\x22';if(this[_0x8be7('0x7a')](_0x116942[_0x8be7('0x74')])){_0x483e36+=','+_0x116942[_0x8be7('0x74')];}var _0x411c5c=this[_0x8be7('0xc')][_0x8be7('0xa3')](_0x8be7('0xa4'),_0x483e36);if(_0x411c5c[_0x8be7('0x9c')]===-0x1){return _0x411c5c;}return this['channel'][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0xa5'),_0x483e36));};AGIVertices[_0x8be7('0x16')][_0x8be7('0xc0')]=function(_0x591f2a){logger[_0x8be7('0x2d')](util['format'](_0x8be7('0xc1'),_0x591f2a[_0x8be7('0xa1')]));if(!this[_0x8be7('0x7a')](_0x591f2a[_0x8be7('0xc2')])){return this[_0x8be7('0xc')][_0x8be7('0xa2')]('no\x20grammar\x20configured');}var _0x3671d6=_0x591f2a[_0x8be7('0xc2')];if(this[_0x8be7('0x7a')](_0x591f2a[_0x8be7('0x74')])){_0x3671d6+=','+_0x591f2a[_0x8be7('0x74')];}var _0x268cb5=this[_0x8be7('0xc')][_0x8be7('0xa3')](_0x8be7('0xa7'),_0x3671d6);if(_0x268cb5[_0x8be7('0x9c')]===-0x1){return _0x268cb5;}var _0x38223a=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x8be7('0xc3'));if(_0x38223a[_0x8be7('0x9c')]===-0x1){return _0x38223a;}var _0xb120e4=this[_0x8be7('0x9b')]('RECOG_INPUT()',_0x8be7('0xc4'));if(_0xb120e4['result']===-0x1){return _0xb120e4;}var _0xc87dbb=this[_0x8be7('0x9b')](_0x8be7('0xc5'),_0x8be7('0xc6'));if(_0xc87dbb['result']===-0x1){return _0xc87dbb;}return this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3671d6));};AGIVertices['prototype'][_0x8be7('0xc7')]=function(_0x474a70){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0xc8'),_0x474a70['label']));if(!this[_0x8be7('0x7a')](_0x474a70['grammar'])){return this[_0x8be7('0xc')]['noop'](_0x8be7('0xc9'));}var _0x1f90dc=_0x474a70[_0x8be7('0xc2')];if(this['isConfigured'](_0x474a70[_0x8be7('0x74')])){_0x1f90dc+=','+_0x474a70[_0x8be7('0x74')];}var _0x557127=this['channel']['exec']('MRCPRecog',_0x1f90dc);if(_0x557127[_0x8be7('0x9c')]===-0x1){return _0x557127;}var _0x5b7433=this[_0x8be7('0x9b')](_0x8be7('0xa8'),_0x8be7('0xca'));if(_0x5b7433[_0x8be7('0x9c')]===-0x1){return _0x5b7433;}var _0x15075b=this[_0x8be7('0x9b')](_0x8be7('0xa9'),_0x8be7('0xcb'));if(_0x15075b['result']===-0x1){return _0x15075b;}var _0x4244ca=this[_0x8be7('0x9b')](_0x8be7('0xc5'),_0x8be7('0xcc'));if(_0x4244ca[_0x8be7('0x9c')]===-0x1){return _0x4244ca;}return this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0xac'),_0x1f90dc));};AGIVertices[_0x8be7('0x16')][_0x8be7('0xcd')]=function(_0x417563){logger['info'](util[_0x8be7('0x28')](_0x8be7('0xce'),_0x417563[_0x8be7('0xa1')]));if(!this['isConfigured'](_0x417563[_0x8be7('0xcf')])){return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x417563,'no\x20database\x20selected');}var _0x37e199=this['getSquareOdbc']['sync'](this,_0x417563[_0x8be7('0xcf')]);if(!_0x37e199){return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x417563,_0x8be7('0xd0'));}if(!this[_0x8be7('0x7a')](_0x417563[_0x8be7('0xd1')])){return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x417563,_0x8be7('0xd2'));}var _0x3d4f7c=_0x417563['query'][_0x8be7('0x56')](/(\r\n|\n|\r)/gm,'\x20');this[_0x8be7('0xc')][_0x8be7('0xa2')](util['format'](_0x8be7('0xd3'),_0x3d4f7c));var _0x7648bc=this[_0x8be7('0x2a')][_0x8be7('0x6b')](this,_0x37e199,_0x3d4f7c);this[_0x8be7('0x35')][_0x8be7('0x6b')](this,_0x417563,_0x3d4f7c);if(!this['isConfigured'](_0x417563['variable_id'])){return this[_0x8be7('0xc')][_0x8be7('0xa2')](_0x8be7('0xd4'));}var _0x213542=this['getVariable']['sync'](this,_0x417563[_0x8be7('0xd5')]);if(!_0x213542){return this['channel'][_0x8be7('0x32')](_0x417563,'no\x20variable\x20found');}var _0x466203=this;_0x7648bc[_0x8be7('0xd6')](function(_0x30e747,_0x5c1f1a){Object[_0x8be7('0xd7')](_0x30e747)[_0x8be7('0xd6')](function(_0x150dec){_0x466203[_0x8be7('0xc')][_0x8be7('0x95')](util[_0x8be7('0x28')](_0x8be7('0xd8'),_0x213542,_0x5c1f1a,_0x150dec),_0x30e747[_0x150dec]);});});this['channel']['setVariable'](util['format'](_0x8be7('0xd9'),_0x213542),_0x7648bc[_0x8be7('0x97')]);return this[_0x8be7('0xc')][_0x8be7('0xa2')](util['format'](_0x8be7('0xda'),_0x213542));};AGIVertices[_0x8be7('0x16')]['dial']=function(_0x450592){logger[_0x8be7('0xdb')](util[_0x8be7('0x28')](_0x8be7('0xdc'),_0x450592['label']));if(!this[_0x8be7('0x7a')](_0x450592['sip_id'])){return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x450592,_0x8be7('0xdd'));}var _0x9fa30b=this[_0x8be7('0x1a')][_0x8be7('0x6b')](this,_0x450592[_0x8be7('0xde')]);if(!_0x9fa30b){return this['channel'][_0x8be7('0x32')](_0x450592,_0x8be7('0xdf'));}var _0x7d205=this[_0x8be7('0xc')][_0x8be7('0xa3')](_0x8be7('0xe0'),[util[_0x8be7('0x28')](_0x8be7('0xe1'),_0x9fa30b),_0x450592[_0x8be7('0x63')],_0x450592[_0x8be7('0xe2')],_0x450592['url']]);if(_0x7d205[_0x8be7('0x9c')]===-0x1){return _0x7d205;}return this['channel']['noop'](util[_0x8be7('0x28')](_0x8be7('0xe3'),'DIAL'));};AGIVertices[_0x8be7('0x16')][_0x8be7('0xe4')]=function(_0x47193d){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0xe5'),_0x47193d['label']));if(!this['isConfigured'](_0x47193d[_0x8be7('0x76')])){return this[_0x8be7('0xc')]['noop'](_0x8be7('0xe6'));}if(!this[_0x8be7('0x7a')](_0x47193d[_0x8be7('0x59')])){return this[_0x8be7('0xc')][_0x8be7('0xa2')]('no\x20text\x20configured');}this[_0x8be7('0xc')][_0x8be7('0xe7')]=!![];this[_0x8be7('0x35')](_0x47193d);this[_0x8be7('0x3e')](_0x47193d[_0x8be7('0x59')],'in');this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')]('Trying\x20Dialogflow:\x20%s',_0x47193d[_0x8be7('0x59')]));var _0x5619c0=this['googleDialogflow'][_0x8be7('0x6b')](this,_0x47193d);if(_0x5619c0){for(var _0xf8267a in _0x5619c0){if(_0x5619c0['hasOwnProperty'](_0xf8267a)){this[_0x8be7('0xc')][_0x8be7('0x95')](util['format'](_0x8be7('0xe8'),_0xf8267a['toUpperCase']()),_0x5619c0[_0xf8267a]);}}this[_0x8be7('0x3e')](_0x5619c0[_0x8be7('0xe9')],_0x8be7('0xea'));return this[_0x8be7('0xc')]['noop'](util[_0x8be7('0x28')](_0x8be7('0xeb'),_0x5619c0['speech']));}return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x47193d,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x8be7('0x16')][_0x8be7('0xec')]=function(_0x1b3ea2){logger['info'](util[_0x8be7('0x28')](_0x8be7('0xed'),_0x1b3ea2[_0x8be7('0xa1')]));if(!this['isConfigured'](_0x1b3ea2['ndauth_url'])){return this[_0x8be7('0xc')][_0x8be7('0xa2')](_0x8be7('0xee'));}if(!this[_0x8be7('0x7a')](_0x1b3ea2[_0x8be7('0xef')])){return this[_0x8be7('0xc')][_0x8be7('0xa2')](_0x8be7('0xf0'));}if(!this['isConfigured'](_0x1b3ea2[_0x8be7('0xf1')])){return this[_0x8be7('0xc')][_0x8be7('0xa2')](_0x8be7('0xf2'));}if(!this[_0x8be7('0x7a')](_0x1b3ea2[_0x8be7('0xf3')])){return this['channel'][_0x8be7('0xa2')](_0x8be7('0xbe'));}this[_0x8be7('0xc')][_0x8be7('0xe7')]=!![];this[_0x8be7('0x35')](_0x1b3ea2);this['createSquareMessage'](_0x1b3ea2['text'],'in');this[_0x8be7('0xc')]['noop'](util[_0x8be7('0x28')](_0x8be7('0xf4'),_0x1b3ea2['text']));var _0x42ebb6=this[_0x8be7('0xf5')]['sync'](this,_0x1b3ea2);if(_0x42ebb6){for(var _0x578c76 in _0x42ebb6){if(_0x42ebb6[_0x8be7('0x8d')](_0x578c76)){this['channel'][_0x8be7('0x95')](util[_0x8be7('0x28')]('SESTEK_NDA_%s',_0x578c76['toUpperCase']()),_0x42ebb6[_0x578c76]);}}this[_0x8be7('0x3e')](_0x42ebb6['speech'],_0x8be7('0xea'));if(_0x42ebb6['audiofile']){this[_0x8be7('0xc')]['noop'](util[_0x8be7('0x28')](_0x8be7('0xf6'),_0x42ebb6[_0x8be7('0xf7')]));var _0x558458=this[_0x8be7('0xc')][_0x8be7('0xf8')](_0x42ebb6[_0x8be7('0xf7')]);try{fs[_0x8be7('0xf9')](_0x42ebb6['audiofile']+_0x8be7('0xfa'));}catch(_0x185f28){logger[_0x8be7('0x32')](_0x185f28);}return _0x558458;}else{return this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0xfb'),_0x42ebb6[_0x8be7('0xe9')]));}}return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x1b3ea2,_0x8be7('0xfc'));};AGIVertices[_0x8be7('0x16')][_0x8be7('0xfd')]=function(_0x25e27b){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')]('Enter\x20in\x20END\x20(%s)\x20block',_0x25e27b['label']));return this[_0x8be7('0xc')][_0x8be7('0xa2')](_0x8be7('0xfd'));};AGIVertices[_0x8be7('0x16')][_0x8be7('0xfe')]=function(_0x571226){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0xff'),_0x571226[_0x8be7('0xa1')]));var _0x56ea1b='';if(_0x571226['trunk_id']){if(!this[_0x8be7('0x7a')](_0x571226['trunk_id'])){return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x571226,_0x8be7('0x100'));}else{var _0x22ed70=parseInt(_0x571226['trunk_id'],0xa);if(isNaN(_0x22ed70)){_0x56ea1b=_0x571226[_0x8be7('0x101')];}else{_0x56ea1b=this[_0x8be7('0x1c')][_0x8be7('0x6b')](this,_0x571226['trunk_id']);if(!_0x56ea1b){return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x571226,_0x8be7('0x102'));}}}}else if(_0x571226[_0x8be7('0x103')]){_0x56ea1b=_0x571226['trunk_name'];}else{return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x571226,_0x8be7('0x100'));}var _0x264aec=this[_0x8be7('0xc')][_0x8be7('0xa3')](_0x8be7('0xe0'),[util[_0x8be7('0x28')](_0x8be7('0x104'),_0x56ea1b,_0x571226[_0x8be7('0x105')]),_0x571226[_0x8be7('0x63')],_0x571226[_0x8be7('0xe2')],_0x571226[_0x8be7('0x61')]]);if(_0x264aec[_0x8be7('0x9c')]===-0x1){return _0x264aec;}return this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0xe3'),_0x8be7('0xe0')));};AGIVertices[_0x8be7('0x16')]['finally']=function(_0x481a0a){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x106'),_0x481a0a[_0x8be7('0xa1')]));return this[_0x8be7('0xc')]['noop'](_0x8be7('0x107'));};AGIVertices[_0x8be7('0x16')]['getdigits']=function(_0x3c4c19){logger[_0x8be7('0x2d')](util['format'](_0x8be7('0x108'),_0x3c4c19[_0x8be7('0xa1')]));if(_0x3c4c19[_0x8be7('0x9f')]===0x0){return this[_0x8be7('0x9e')](_0x3c4c19);}_0x3c4c19['retry']-=0x1;if(!this[_0x8be7('0x7a')](_0x3c4c19[_0x8be7('0x109')])){return this[_0x8be7('0xc')]['error'](_0x3c4c19,'no\x20file\x20audio\x20selected');}var _0x1c30b3=this['getSound'][_0x8be7('0x6b')](this,_0x3c4c19[_0x8be7('0x109')]);if(!_0x1c30b3){return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x3c4c19,_0x8be7('0x10a'));}if(!this['isConfigured'](_0x3c4c19[_0x8be7('0xd5')])){return this['channel'][_0x8be7('0x32')](_0x8be7('0xd4'));}var _0x16305c=this[_0x8be7('0xc')]['getData'](_0x1c30b3,_0x3c4c19['response'],_0x3c4c19[_0x8be7('0x10b')]);var _0x386a4f=_0x16305c['result']?_0x16305c['result'][_0x8be7('0x9a')]():'';logger[_0x8be7('0x2d')]('test',JSON[_0x8be7('0x6e')](_0x16305c));if(_0x16305c[_0x8be7('0x9c')]===-0x1){this[_0x8be7('0x35')][_0x8be7('0x6b')](this,_0x3c4c19,_0x386a4f);return _0x16305c;}else if(_0x16305c['extra']==='timeout'){_0x16305c[_0x8be7('0x9c')]=_0x386a4f[_0x8be7('0x97')]>=parseInt(_0x3c4c19[_0x8be7('0x10c')])?'x':'i';}else{_0x16305c[_0x8be7('0x9c')]=_0x386a4f[_0x8be7('0x97')]>=parseInt(_0x3c4c19['mindigit'])&&_0x386a4f[_0x8be7('0x97')]<=parseInt(_0x3c4c19[_0x8be7('0x10b')])?'x':'i';}var _0x205868=this[_0x8be7('0xf')]['sync'](this,_0x3c4c19[_0x8be7('0xd5')]);if(!_0x205868){return this[_0x8be7('0xc')]['error'](_0x3c4c19,_0x8be7('0x10d'));}this['channel'][_0x8be7('0x95')](_0x205868,_0x386a4f);if(this[_0x8be7('0x7a')](_0x3c4c19['hiddendigitsnum'])){var _0x18a8de=parseInt(_0x3c4c19[_0x8be7('0x10e')],0xa);var _0x6f19a6=rs[_0x8be7('0x10f')]({'charset':'*','length':_0x18a8de});var _0x26f91c=_0x386a4f[_0x8be7('0x97')];if(_0x26f91c>0x0){if(_0x26f91c>_0x18a8de){this[_0x8be7('0x35')][_0x8be7('0x6b')](this,_0x3c4c19,_0x3c4c19[_0x8be7('0x110')]===_0x8be7('0x111')?_0x6f19a6+_0x386a4f['substr'](_0x18a8de):_0x386a4f[_0x8be7('0x112')](0x0,_0x26f91c-_0x18a8de)+_0x6f19a6);}else{this[_0x8be7('0x35')][_0x8be7('0x6b')](this,_0x3c4c19,rs[_0x8be7('0x10f')]({'charset':'*','length':_0x26f91c}));}}else{this[_0x8be7('0x35')]['sync'](this,_0x3c4c19,'');}}else{this[_0x8be7('0x35')]['sync'](this,_0x3c4c19,_0x386a4f);}return _0x16305c;};AGIVertices['prototype']['getsecretdigits']=function(_0x490383){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x490383['label']));return this[_0x8be7('0xa')](_0x490383);};AGIVertices[_0x8be7('0x16')][_0x8be7('0x113')]=function(_0x48a54a){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x114'),_0x48a54a[_0x8be7('0xa1')]));this[_0x8be7('0x35')][_0x8be7('0x6b')](this,_0x48a54a,_0x48a54a[_0x8be7('0x115')]);return this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0x116'),_0x48a54a[_0x8be7('0x115')]));};AGIVertices[_0x8be7('0x16')][_0x8be7('0x117')]=function(_0x18f6a7){logger[_0x8be7('0x2d')](util['format'](_0x8be7('0x118'),_0x18f6a7['label']));if(!this[_0x8be7('0x7a')](_0x18f6a7[_0x8be7('0x7d')])||!this[_0x8be7('0x7a')](_0x18f6a7[_0x8be7('0x7e')])){return this[_0x8be7('0xc')][_0x8be7('0xa2')](_0x8be7('0x119'));}if(!this[_0x8be7('0x7a')](_0x18f6a7[_0x8be7('0x59')])){return this[_0x8be7('0xc')][_0x8be7('0xa2')]('no\x20text\x20configured');}this[_0x8be7('0xc')][_0x8be7('0xa2')](util['format'](_0x8be7('0x11a'),_0x18f6a7[_0x8be7('0x59')]));var _0x599f32=this[_0x8be7('0x7c')][_0x8be7('0x6b')](this,_0x18f6a7);if(_0x599f32){this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0x11b'),_0x599f32));var _0x481d3d=this['channel'][_0x8be7('0xf8')](_0x599f32);try{fs[_0x8be7('0xf9')](_0x599f32+_0x8be7('0xfa'));}catch(_0x1b1e46){logger[_0x8be7('0x32')](_0x1b1e46);}return _0x481d3d;}return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x18f6a7,_0x8be7('0x11c'));};AGIVertices[_0x8be7('0x16')][_0x8be7('0x11d')]=function(_0x404bff){logger[_0x8be7('0x2d')](util['format'](_0x8be7('0x11e'),_0x404bff[_0x8be7('0xa1')]));if(!this[_0x8be7('0x7a')](_0x404bff[_0x8be7('0x7d')])||!this['isConfigured'](_0x404bff[_0x8be7('0x7e')])){return this[_0x8be7('0xc')]['noop'](_0x8be7('0x119'));}if(!this[_0x8be7('0x7a')](_0x404bff[_0x8be7('0x85')])){return this[_0x8be7('0xc')][_0x8be7('0xa2')](_0x8be7('0x11f'));}if(!this[_0x8be7('0x7a')](_0x404bff[_0x8be7('0x59')])){return this['channel'][_0x8be7('0xa2')](_0x8be7('0xbe'));}this[_0x8be7('0xc')]['bot']=!![];this['createSquareDetailsReport'](_0x404bff);this[_0x8be7('0x3e')](_0x404bff[_0x8be7('0x59')],'in');this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')]('Trying\x20Amazon\x20Lex:\x20%s',_0x404bff[_0x8be7('0x59')]));var _0x16cf3c=this['awsLex']['sync'](this,_0x404bff);if(_0x16cf3c){for(var _0x2a9967 in _0x16cf3c){if(_0x16cf3c[_0x8be7('0x8d')](_0x2a9967)&&_[_0x8be7('0x8e')](_0x16cf3c[_0x2a9967])){this[_0x8be7('0xc')]['setVariable'](util[_0x8be7('0x28')](_0x8be7('0x120'),_0x2a9967['toUpperCase']()),_0x16cf3c[_0x2a9967]);}}if(_[_0x8be7('0x41')](_0x16cf3c[_0x8be7('0x72')])){return this[_0x8be7('0xc')]['noop'](_0x8be7('0x121'));}else{this[_0x8be7('0x3e')](_0x16cf3c[_0x8be7('0x72')],'out');return this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0x122'),_0x16cf3c['message']));}}return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x404bff,_0x8be7('0x123'));};AGIVertices['prototype'][_0x8be7('0x124')]=function(_0x2c5e93){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x2c5e93[_0x8be7('0xa1')],_0x2c5e93[_0x8be7('0x63')]));if(!this[_0x8be7('0x7a')](_0x2c5e93[_0x8be7('0x76')])){return this[_0x8be7('0xc')][_0x8be7('0xa2')]('no\x20key\x20configured');}var _0x50e1c6=_0x8be7('0x125');var _0x4e0dc5=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x275bc4=util[_0x8be7('0x28')](_0x8be7('0x94'),_0x4e0dc5,_0x50e1c6);var _0x5a7176=!![];if(_0x2c5e93[_0x8be7('0x126')]===_0x8be7('0x127')){_0x5a7176=![];}var _0x21971f=this[_0x8be7('0xc')][_0x8be7('0x128')](_0x4e0dc5,_0x50e1c6,_0x2c5e93[_0x8be7('0x129')],_0x2c5e93[_0x8be7('0x63')],undefined,_0x5a7176);if(_0x21971f[_0x8be7('0x9c')]!==-0x1){this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0x12a'),_0x275bc4));var _0x5b9847=this[_0x8be7('0x86')]['sync'](this,_0x2c5e93,_0x275bc4);if(_0x5b9847){for(var _0xdd5cc6 in _0x5b9847){if(_0x5b9847[_0x8be7('0x8d')](_0xdd5cc6)){this[_0x8be7('0xc')][_0x8be7('0x95')](util[_0x8be7('0x28')](_0x8be7('0x12b'),_0xdd5cc6['toUpperCase']()),_0x5b9847[_0xdd5cc6]);}}return this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0x12c'),JSON[_0x8be7('0x6e')](_0x5b9847)));}}return _0x21971f;};AGIVertices[_0x8be7('0x16')][_0x8be7('0x12d')]=function(_0x4f9f08){logger['info'](util[_0x8be7('0x28')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x4f9f08[_0x8be7('0xa1')]));if(!this[_0x8be7('0x7a')](_0x4f9f08[_0x8be7('0x88')])){return this[_0x8be7('0xc')][_0x8be7('0xa2')](_0x8be7('0x12e'));}if(!this[_0x8be7('0x7a')](_0x4f9f08[_0x8be7('0x89')])){return this['channel']['noop'](_0x8be7('0x12f'));}var _0x414bb2=_0x8be7('0x125');var _0x122f17=util[_0x8be7('0x28')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x193d04=util['format']('%s.%s',_0x122f17,_0x414bb2);var _0x2fba4d=!![];if(_0x4f9f08[_0x8be7('0x126')]===_0x8be7('0x127')){_0x2fba4d=![];}var _0x25237b=this['channel'][_0x8be7('0x128')](_0x122f17,_0x414bb2,_0x4f9f08[_0x8be7('0x129')],_0x4f9f08['timeout'],undefined,_0x2fba4d);if(_0x25237b['result']!==-0x1){this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0x130'),_0x193d04));var _0x2c449e=this[_0x8be7('0x131')]['sync'](this,_0x4f9f08,_0x193d04);if(_0x2c449e){for(var _0x41ec04 in _0x2c449e){if(_0x2c449e[_0x8be7('0x8d')](_0x41ec04)){this[_0x8be7('0xc')]['setVariable'](util['format'](_0x8be7('0x132'),_0x41ec04[_0x8be7('0x66')]()),_0x2c449e[_0x41ec04]);}}return this[_0x8be7('0xc')]['noop'](util[_0x8be7('0x28')](_0x8be7('0x133'),JSON[_0x8be7('0x6e')](_0x2c449e)));}}return _0x25237b;};AGIVertices['prototype'][_0x8be7('0x134')]=function(_0x37d991){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x135'),_0x37d991[_0x8be7('0xa1')]));return this[_0x8be7('0xc')][_0x8be7('0x136')](_0x37d991[_0x8be7('0x3b')],_0x37d991[_0x8be7('0x3c')],_0x37d991['priority']);};AGIVertices[_0x8be7('0x16')][_0x8be7('0x137')]=function(_0x6d2225){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x138'),_0x6d2225[_0x8be7('0xa1')]));if(!this[_0x8be7('0x7a')](_0x6d2225[_0x8be7('0x139')])){return this['channel']['error'](_0x6d2225,_0x8be7('0x13a'));}try{var _0x272021=eval(_0x6d2225['condition'])?_0x8be7('0x13b'):_0x8be7('0x13c');this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')]('EVAL\x20CONDITION\x20%s\x20%s',_0x6d2225[_0x8be7('0x139')],_0x272021));return{'code':0xc8,'result':_0x272021};}catch(_0x39c90b){return{'code':0xc8,'result':_0x8be7('0x13c')};}};AGIVertices[_0x8be7('0x16')][_0x8be7('0x13d')]=function(_0xbb9125){logger['info'](util[_0x8be7('0x28')](_0x8be7('0x13e'),_0xbb9125[_0x8be7('0xa1')]));if(!this[_0x8be7('0x7a')](_0xbb9125['interval_id'])){return this[_0x8be7('0xc')][_0x8be7('0x32')](_0xbb9125,_0x8be7('0x13f'));}var _0x5cfadb=this[_0x8be7('0x23')]['sync'](this,_0xbb9125[_0x8be7('0x140')]);if(!_0x5cfadb){return this[_0x8be7('0xc')]['error'](_0xbb9125,_0x8be7('0x141'));}for(var _0x620c06=0x0;_0x620c06<_0x5cfadb[_0x8be7('0x97')];_0x620c06+=0x1){var _0x2e2b3a=this[_0x8be7('0xc')][_0x8be7('0xf')](util[_0x8be7('0x28')](_0x8be7('0x142'),_0x5cfadb[_0x620c06]));if(_0x2e2b3a['result']===-0x1){return _0x2e2b3a;}logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x143'),_0x5cfadb[_0x620c06],_0x2e2b3a[_0x8be7('0x99')]));if(_0x2e2b3a['extra']==='true'){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')]('IFTIME\x20%s\x20%s',_0x5cfadb[_0x620c06],_0x8be7('0x13b')));this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0x143'),_0x5cfadb[_0x620c06],_0x8be7('0x13b')));return{'code':0xc8,'result':_0x8be7('0x13b')};}else{logger['info'](util[_0x8be7('0x28')](_0x8be7('0x143'),_0x5cfadb[_0x620c06],_0x8be7('0x13c')));this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0x143'),_0x5cfadb[_0x620c06],'false'));}}return{'code':0xc8,'result':_0x8be7('0x13c')};};AGIVertices['prototype']['hangup']=function(_0x5b1733){logger[_0x8be7('0x2d')](util['format'](_0x8be7('0x144'),_0x5b1733['label']));return this[_0x8be7('0xc')][_0x8be7('0x145')]();};AGIVertices['prototype'][_0x8be7('0x146')]=function(_0x1a02ba){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x147'),_0x1a02ba[_0x8be7('0xa1')]));if(!this[_0x8be7('0x7a')](_0x1a02ba[_0x8be7('0x76')])){return this[_0x8be7('0xc')][_0x8be7('0xa2')](_0x8be7('0xe6'));}var _0x4e943a=_0x8be7('0x125');var _0x161bb2=util['format'](_0x8be7('0x148'),FILES_PATH,rs[_0x8be7('0x10f')](0x4));var _0x1f45d2=util['format']('%s.%s',_0x161bb2,_0x4e943a);var _0x12f31d=!![];if(_0x1a02ba['beep']===_0x8be7('0x127')){_0x12f31d=![];}var _0x45ef0a=this[_0x8be7('0xc')][_0x8be7('0x128')](_0x161bb2,_0x4e943a,_0x1a02ba[_0x8be7('0x129')],_0x1a02ba['timeout'],undefined,_0x12f31d);if(_0x45ef0a[_0x8be7('0x9c')]!==-0x1){this[_0x8be7('0xc')]['noop'](util[_0x8be7('0x28')](_0x8be7('0x149'),_0x1f45d2));var _0x494ff1=this[_0x8be7('0x79')]['sync'](this,_0x1a02ba,_0x1f45d2);if(_0x494ff1){for(var _0x22d3ab in _0x494ff1){if(_0x494ff1[_0x8be7('0x8d')](_0x22d3ab)){this[_0x8be7('0xc')][_0x8be7('0x95')](util['format'](_0x8be7('0x14a'),_0x22d3ab[_0x8be7('0x66')]()),_0x494ff1[_0x22d3ab]);}}return this[_0x8be7('0xc')]['noop'](util['format'](_0x8be7('0x14b'),JSON[_0x8be7('0x6e')](_0x494ff1)));}}return _0x45ef0a;};AGIVertices[_0x8be7('0x16')]['ispeechtts']=function(_0x401546){logger[_0x8be7('0x2d')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x401546[_0x8be7('0xa1')]));if(!this[_0x8be7('0x7a')](_0x401546[_0x8be7('0x76')])){return this[_0x8be7('0xc')][_0x8be7('0xa2')](_0x8be7('0xe6'));}if(!this[_0x8be7('0x7a')](_0x401546[_0x8be7('0x59')])){return this[_0x8be7('0xc')][_0x8be7('0xa2')](_0x8be7('0xbe'));}this['channel']['noop'](util['format'](_0x8be7('0x14c'),_0x401546[_0x8be7('0x59')]));var _0x1a73f4=this[_0x8be7('0x77')][_0x8be7('0x6b')](this,_0x401546);if(_0x1a73f4){this[_0x8be7('0xc')][_0x8be7('0xa2')](util['format'](_0x8be7('0x149'),_0x1a73f4));var _0x128ae1=this['channel'][_0x8be7('0xf8')](_0x1a73f4,_0x401546[_0x8be7('0x129')]);try{fs[_0x8be7('0xf9')](_0x1a73f4+_0x8be7('0xfa'));}catch(_0x1d9339){logger[_0x8be7('0x32')](_0x1d9339);}return _0x128ae1;}return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x401546,_0x8be7('0x14d'));};AGIVertices[_0x8be7('0x16')]['login']=function(_0x2a5883){logger[_0x8be7('0x2d')](util['format'](_0x8be7('0x14e'),_0x2a5883[_0x8be7('0xa1')]));if(!this['isConfigured'](_0x2a5883[_0x8be7('0x14f')])){return this[_0x8be7('0xc')]['error'](_0x2a5883,_0x8be7('0x150'));}logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x151'),this[_0x8be7('0xc')][_0x8be7('0x38')],_0x2a5883['findBy']));var _0x2bbc78=this[_0x8be7('0x50')][_0x8be7('0x6b')](this,_0x2a5883[_0x8be7('0x14f')]);if(_0x2bbc78){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8be7('0xc')][_0x8be7('0x38')],_0x2a5883['findBy']));this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0x152'),this[_0x8be7('0xc')][_0x8be7('0x38')],_0x2a5883['findBy']));return{'code':0xc8,'result':_0x8be7('0x153')};}else{logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x154'),this['channel'][_0x8be7('0x38')],_0x2a5883[_0x8be7('0x14f')]));this[_0x8be7('0xc')][_0x8be7('0xa2')](util['format'](_0x8be7('0x154'),this[_0x8be7('0xc')][_0x8be7('0x38')],_0x2a5883[_0x8be7('0x14f')]));return{'code':0xc8,'result':_0x8be7('0x155')};}};AGIVertices[_0x8be7('0x16')]['logout']=function(_0x1ccbc3){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x156'),_0x1ccbc3['label']));if(!this[_0x8be7('0x7a')](_0x1ccbc3[_0x8be7('0x14f')])){return this['channel'][_0x8be7('0x32')](_0x1ccbc3,_0x8be7('0x150'));}logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x151'),this[_0x8be7('0xc')][_0x8be7('0x38')],_0x1ccbc3[_0x8be7('0x14f')]));var _0x423afd=this[_0x8be7('0x4f')]['sync'](this,_0x1ccbc3['findBy']);if(_0x423afd){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x152'),this['channel'][_0x8be7('0x38')],_0x1ccbc3['findBy']));this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0x152'),this[_0x8be7('0xc')][_0x8be7('0x38')],_0x1ccbc3[_0x8be7('0x14f')]));return{'code':0xc8,'result':_0x8be7('0x153')};}else{logger[_0x8be7('0x2d')](util['format'](_0x8be7('0x154'),this[_0x8be7('0xc')][_0x8be7('0x38')],_0x1ccbc3['findBy']));this[_0x8be7('0xc')]['noop'](util[_0x8be7('0x28')](_0x8be7('0x154'),this[_0x8be7('0xc')][_0x8be7('0x38')],_0x1ccbc3[_0x8be7('0x14f')]));return{'code':0xc8,'result':_0x8be7('0x155')};}};AGIVertices[_0x8be7('0x16')][_0x8be7('0x157')]=function(_0xbfc980){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x158'),_0xbfc980['label']));if(!this[_0x8be7('0x7a')](_0xbfc980[_0x8be7('0x159')])){return this[_0x8be7('0xc')][_0x8be7('0x32')](_0xbfc980,_0x8be7('0x15a'));}this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0x15b'),_0xbfc980[_0x8be7('0x159')]));var _0x8021a5=eval(_0xbfc980['operation']);if(!this['isConfigured'](_0xbfc980[_0x8be7('0xd5')])){return this['channel']['noop'](_0x8be7('0xd4'));}var _0x3940c6=this[_0x8be7('0xf')][_0x8be7('0x6b')](this,_0xbfc980[_0x8be7('0xd5')]);if(!_0x3940c6){return this['channel'][_0x8be7('0x32')](_0xbfc980,'no\x20variable\x20found');}if(_['isArray'](_0x8021a5)){var _0x44ab67=this;_0x8021a5[_0x8be7('0xd6')](function(_0x43820a,_0x2d5e6e){_0x44ab67[_0x8be7('0xc')][_0x8be7('0x95')](util[_0x8be7('0x28')](_0x8be7('0x15c'),_0x3940c6,_0x2d5e6e),_0x43820a);});return this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')]('variable\x20%s[key]\x20set',_0x3940c6));}else{return this['channel'][_0x8be7('0x95')](_0x3940c6,_0x8021a5);}};AGIVertices['prototype'][_0x8be7('0x15d')]=function(_0x1baa61){logger['info'](util[_0x8be7('0x28')](_0x8be7('0x15e'),_0x1baa61['label']));if(_0x1baa61[_0x8be7('0x9f')]===0x0){return this[_0x8be7('0x9e')](_0x1baa61);}_0x1baa61['retry']-=0x1;if(!this[_0x8be7('0x7a')](_0x1baa61[_0x8be7('0x109')])){return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x1baa61,_0x8be7('0x15f'));}var _0x47611c=this[_0x8be7('0x160')][_0x8be7('0x6b')](this,_0x1baa61[_0x8be7('0x109')]);if(!_0x47611c){return this[_0x8be7('0xc')]['error'](_0x1baa61,_0x8be7('0x10a'));}var _0x480552=this[_0x8be7('0xc')][_0x8be7('0x161')](_0x47611c,_0x1baa61['response'],_0x1baa61[_0x8be7('0x162')]);var _0x1071b4=_0x480552[_0x8be7('0x9c')];if(_0x480552[_0x8be7('0x9c')]===-0x1){this[_0x8be7('0x35')]['sync'](this,_0x1baa61,'-1');return _0x480552;}else if(_0x480552['extra']==='timeout'){_0x480552[_0x8be7('0x9c')]=_0x480552[_0x8be7('0x9c')]['length']>0x0?_0x480552[_0x8be7('0x9c')]:'t';}else if(_['isEmpty'](_0x480552['result'])){_0x480552['result']='#';_0x1071b4='#';}if(!this[_0x8be7('0x7a')](_0x1baa61[_0x8be7('0xd5')])){this[_0x8be7('0xc')][_0x8be7('0xa2')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x5c3d00=this[_0x8be7('0xf')][_0x8be7('0x6b')](this,_0x1baa61[_0x8be7('0xd5')]);if(!_0x5c3d00){return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x1baa61,_0x8be7('0x10d'));}this[_0x8be7('0xc')]['setVariable'](_0x5c3d00,_0x1071b4);}this[_0x8be7('0x35')][_0x8be7('0x6b')](this,_0x1baa61,_0x1071b4);return _0x480552;};AGIVertices['prototype']['noop']=function(_0x252b82){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x163'),_0x252b82[_0x8be7('0xa1')]));return this[_0x8be7('0xc')][_0x8be7('0xa2')](_0x252b82['output']||_0x252b82[_0x8be7('0xa1')]);};AGIVertices[_0x8be7('0x16')][_0x8be7('0x164')]=function(_0x5540e6){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x165'),_0x5540e6[_0x8be7('0xa1')]));if(!this['isConfigured'](_0x5540e6[_0x8be7('0x14f')])){return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x5540e6,_0x8be7('0x150'));}logger['info'](util[_0x8be7('0x28')](_0x8be7('0x151'),this[_0x8be7('0xc')]['callerid'],_0x5540e6[_0x8be7('0x14f')]));var _0x5942c1=this['getPause']['sync'](this,_0x5540e6[_0x8be7('0x166')]);var _0x4401aa=this[_0x8be7('0x4c')]['sync'](this,_0x5540e6['findBy'],_0x5942c1);if(_0x4401aa){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x152'),this['channel'][_0x8be7('0x38')],_0x5540e6[_0x8be7('0x14f')]));this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0x152'),this[_0x8be7('0xc')][_0x8be7('0x38')],_0x5540e6[_0x8be7('0x14f')]));return{'code':0xc8,'result':_0x8be7('0x153')};}else{logger['info'](util['format'](_0x8be7('0x154'),this[_0x8be7('0xc')][_0x8be7('0x38')],_0x5540e6['findBy']));this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0x152'),this[_0x8be7('0xc')][_0x8be7('0x38')],_0x5540e6[_0x8be7('0x14f')]));return{'code':0xc8,'result':_0x8be7('0x155')};}};AGIVertices[_0x8be7('0x16')]['playback']=function(_0x1b8bbb){logger['info'](util['format'](_0x8be7('0x167'),_0x1b8bbb[_0x8be7('0xa1')]));if(!this['isConfigured'](_0x1b8bbb['file_id'])){return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x1b8bbb,_0x8be7('0x15f'));}var _0xcda506=this['getSound'][_0x8be7('0x6b')](this,_0x1b8bbb[_0x8be7('0x109')]);if(!_0xcda506){return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x1b8bbb,_0x8be7('0x10a'));}var _0x34c18d=this[_0x8be7('0xc')][_0x8be7('0xa3')]('PLAYBACK',[_0xcda506,_0x1b8bbb[_0x8be7('0xe2')]]);if(_0x34c18d['result']===-0x1){return _0x34c18d;}return this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0xbb'),'PLAYBACK',_0xcda506));};AGIVertices['prototype'][_0x8be7('0x168')]=function(_0x35b17e){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x35b17e[_0x8be7('0xa1')]));if(!this[_0x8be7('0x7a')](_0x35b17e[_0x8be7('0x169')])){return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x35b17e,_0x8be7('0x16a'));}var _0x34df5f='';var _0x18d273=parseInt(_0x35b17e[_0x8be7('0x169')],0xa);if(isNaN(_0x18d273)){_0x34df5f=_0x35b17e[_0x8be7('0x169')];}else{_0x34df5f=this[_0x8be7('0x14')]['sync'](this,_0x35b17e[_0x8be7('0x169')]);if(!_0x34df5f){return this['channel'][_0x8be7('0x32')](_0x35b17e,_0x8be7('0x16b'));}}var _0x53fe7d='';if(this['isConfigured'](_0x35b17e['file_id'])){var _0x5778f8=this['getSound']['sync'](this,_0x35b17e[_0x8be7('0x109')]);if(_0x5778f8){_0x53fe7d=_0x5778f8;}}this[_0x8be7('0x35')][_0x8be7('0x6b')](this,_0x35b17e,_0x34df5f);if(_0x35b17e[_0x8be7('0xe2')][_0x8be7('0x16c')]('x')<0x0){_0x35b17e['opts']+='x';}if(_0x35b17e[_0x8be7('0xe2')][_0x8be7('0x16c')]('X')<0x0){_0x35b17e[_0x8be7('0xe2')]+='X';}this[_0x8be7('0xc')][_0x8be7('0x95')]('XMCS-QUEUE',_0x34df5f?_0x34df5f[_0x8be7('0x16d')]():'');var _0x334773=this[_0x8be7('0xc')][_0x8be7('0xa3')](_0x8be7('0x16e'),[_0x34df5f,_0x35b17e['opts'],_0x35b17e[_0x8be7('0x61')],_0x53fe7d,_0x35b17e[_0x8be7('0x63')],_0x35b17e[_0x8be7('0x6')],_0x35b17e[_0x8be7('0x16f')],_0x35b17e[_0x8be7('0x170')],'',_0x35b17e[_0x8be7('0x171')]]);if(_0x334773['result']===-0x1){return _0x334773;}return this['channel'][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0xbb'),_0x8be7('0x16e'),_0x34df5f));};AGIVertices[_0x8be7('0x16')]['record']=function(_0x5db3a2){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x172'),_0x5db3a2[_0x8be7('0xa1')]));var _0x4a2584=_0x5db3a2[_0x8be7('0x173')]||_0x8be7('0x125');var _0x32091c=util[_0x8be7('0x28')](_0x8be7('0x174'),this['channel']['uniqueid'],rs[_0x8be7('0x10f')](0x5));var _0x2d7865=util['format'](_0x8be7('0x175'),FILES_PATH,_0x32091c,_0x4a2584);var _0x1721ec=util['format'](_0x8be7('0x148'),FILES_PATH,_0x32091c);this[_0x8be7('0x39')][_0x8be7('0x6b')](this,_0x5db3a2,_0x32091c,_0x2d7865);this[_0x8be7('0xc')][_0x8be7('0x95')](_0x8be7('0x176'),_0x32091c);logger[_0x8be7('0x2d')](_0x8be7('0x177'),_0x1721ec,_0x4a2584,_0x5db3a2['escape_digits'],_0x5db3a2[_0x8be7('0x63')]);return this['channel']['recordFile'](_0x1721ec,_0x4a2584,_0x5db3a2['escape_digits'],_0x5db3a2[_0x8be7('0x63')],undefined,!![]);};AGIVertices['prototype'][_0x8be7('0x178')]=function(_0x22dabe){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x179'),_0x22dabe[_0x8be7('0xa1')]));if(!this[_0x8be7('0x7a')](_0x22dabe[_0x8be7('0x61')])){return this[_0x8be7('0xc')][_0x8be7('0xa2')](_0x8be7('0x17a'));}var _0x51e81c=this[_0x8be7('0x60')][_0x8be7('0x6b')](this,_0x22dabe);logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x17b'),util['inspect'](_0x51e81c,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x22dabe[_0x8be7('0xd5')])){return this['channel'][_0x8be7('0xa2')](_0x8be7('0x17c'));}var _0x5255a3=this[_0x8be7('0xf')][_0x8be7('0x6b')](this,_0x22dabe['variable_id']);if(!_0x5255a3){return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x22dabe,_0x8be7('0x10d'));}this[_0x8be7('0xc')][_0x8be7('0x95')](util[_0x8be7('0x28')](_0x8be7('0x17d'),_0x5255a3),_0x51e81c[_0x8be7('0x71')]?_0x51e81c[_0x8be7('0x71')]:_0x8be7('0x17e'));this[_0x8be7('0xc')][_0x8be7('0x95')](util[_0x8be7('0x28')](_0x8be7('0x17f'),_0x5255a3),_0x51e81c[_0x8be7('0x180')]?_0x51e81c[_0x8be7('0x180')]:'OK');if(_0x51e81c[_0x8be7('0x67')]){try{this[_0x8be7('0x93')](_0x51e81c[_0x8be7('0x67')],_0x5255a3);}catch(_0x464624){logger[_0x8be7('0x32')](util[_0x8be7('0x28')](_0x8be7('0x181'),_0x5255a3));}}return this['channel']['noop'](util[_0x8be7('0x28')](_0x8be7('0xda'),_0x5255a3));};AGIVertices[_0x8be7('0x16')][_0x8be7('0x182')]=function(_0x595406){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x183'),_0x595406[_0x8be7('0xa1')]));return this[_0x8be7('0xc')][_0x8be7('0x184')](_0x595406[_0x8be7('0x185')][_0x8be7('0x56')](/\s+/g,''),_0x595406[_0x8be7('0x186')]);};AGIVertices[_0x8be7('0x16')][_0x8be7('0x187')]=function(_0x5d022a){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x5d022a[_0x8be7('0xa1')]));return this['channel'][_0x8be7('0x188')](_0x5d022a['number']['replace'](/\s+/g,''),_0x5d022a[_0x8be7('0x186')]);};AGIVertices[_0x8be7('0x16')][_0x8be7('0x189')]=function(_0x4cf74f){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x18a'),_0x4cf74f[_0x8be7('0xa1')]));return this[_0x8be7('0xc')][_0x8be7('0x18b')](_0x4cf74f[_0x8be7('0x59')],_0x4cf74f[_0x8be7('0x186')]);};AGIVertices['prototype'][_0x8be7('0x18c')]=function(_0x4eb7b3){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x18d'),_0x4eb7b3['label']));if(!this[_0x8be7('0x7a')](_0x4eb7b3[_0x8be7('0x18e')])){return this[_0x8be7('0xc')][_0x8be7('0xa2')](_0x8be7('0x18f'));}var _0x3f9c8a=this[_0x8be7('0x20')]['sync'](this,_0x4eb7b3[_0x8be7('0x18e')]);if(!_0x3f9c8a||!_0x3f9c8a[_0x8be7('0x190')]){return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x4eb7b3,'no\x20mail\x20account\x20found');}var _0xd86b2c={'from':util[_0x8be7('0x28')](_0x8be7('0x191'),_0x3f9c8a['name'],_0x3f9c8a[_0x8be7('0x192')]||_0x3f9c8a['Smtp']['user']),'to':_0x4eb7b3['to']||'','cc':_0x4eb7b3['cc']||'','bcc':_0x4eb7b3[_0x8be7('0x193')]||'','subject':_0x4eb7b3[_0x8be7('0x194')],'html':_0x4eb7b3[_0x8be7('0x59')],'text':_0x4eb7b3[_0x8be7('0x59')]};var _0x73a870={'tls':{'rejectUnauthorized':![]}};if(_0x3f9c8a['Smtp'][_0x8be7('0x195')]){_0x73a870['service']=_0x3f9c8a['Smtp'][_0x8be7('0x195')];}else{_0x73a870[_0x8be7('0x196')]=_0x3f9c8a[_0x8be7('0x190')]['host'];_0x73a870['port']=_0x3f9c8a[_0x8be7('0x190')]['port'];_0x73a870['secure']=_0x3f9c8a[_0x8be7('0x190')][_0x8be7('0x197')];}if(_0x3f9c8a['Smtp'][_0x8be7('0x198')]){_0x73a870[_0x8be7('0x199')]={'user':_0x3f9c8a[_0x8be7('0x190')][_0x8be7('0x19a')],'pass':_0x3f9c8a[_0x8be7('0x190')][_0x8be7('0x19b')]};}if(this[_0x8be7('0x7a')](_0x4eb7b3['template_id'])){}logger[_0x8be7('0xdb')](_0x8be7('0x19c'),JSON[_0x8be7('0x6e')](_0xd86b2c));this[_0x8be7('0x35')]['sync'](this,_0x4eb7b3,_0x4eb7b3['account_id']);this['channel'][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0x19d'),_0x3f9c8a['name']));this[_0x8be7('0x22')]['sync'](this,_0x73a870,_0xd86b2c);return this['channel']['noop'](_0x8be7('0x19e'));};AGIVertices[_0x8be7('0x16')]['sendFax']=function(_0x5c91b6){logger[_0x8be7('0x2d')](util['format'](_0x8be7('0x19f'),_0x5c91b6[_0x8be7('0xa1')]));return this[_0x8be7('0xc')]['noop'](_0x8be7('0x1a0'));};AGIVertices['prototype'][_0x8be7('0x1a1')]=function(_0x42eb2c){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x1a2'),_0x42eb2c['label']));if(!this[_0x8be7('0x7a')](_0x42eb2c['sms_account_id'])){return this[_0x8be7('0xc')][_0x8be7('0xa2')](_0x8be7('0x1a3'));}var _0xe93813=this[_0x8be7('0x1a4')][_0x8be7('0x6b')](this,_0x42eb2c[_0x8be7('0x1a5')]);if(!_0xe93813){return this[_0x8be7('0xc')]['error'](_0x42eb2c,_0x8be7('0x1a6'));}var _0x4fd228={'body':_0x42eb2c[_0x8be7('0x1a7')],'phone':_0x42eb2c['to']||'','SmsAccountId':_0xe93813['id']};logger[_0x8be7('0xdb')]('sendSMS\x20message',JSON[_0x8be7('0x6e')](_0x4fd228));this[_0x8be7('0x35')][_0x8be7('0x6b')](this,_0x42eb2c,_0x42eb2c['sms_account_id']);this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0xe93813['name']));this['createSmsMessage'][_0x8be7('0x6b')](this,_0x4fd228);return this[_0x8be7('0xc')][_0x8be7('0xa2')](_0x8be7('0x1a8'));};AGIVertices[_0x8be7('0x16')]['set']=function(_0xe7a83e){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')](_0x8be7('0x1a9'),_0xe7a83e[_0x8be7('0xa1')]));if(!this[_0x8be7('0x7a')](_0xe7a83e[_0x8be7('0xd5')])){return this[_0x8be7('0xc')][_0x8be7('0x32')](_0xe7a83e,_0x8be7('0x1aa'));}var _0x52883d=this['getVariable'][_0x8be7('0x6b')](this,_0xe7a83e[_0x8be7('0xd5')]);if(!_0x52883d){return this[_0x8be7('0xc')]['error'](_0xe7a83e,_0x8be7('0x10d'));}return this[_0x8be7('0xc')][_0x8be7('0x95')](_0x52883d,_0xe7a83e[_0x8be7('0x1ab')]);};AGIVertices[_0x8be7('0x16')][_0x8be7('0x1ac')]=function(_0x5093f1){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')]('Enter\x20in\x20START\x20(%s)\x20block',_0x5093f1[_0x8be7('0xa1')]));this[_0x8be7('0xc')][_0x8be7('0xa2')]('START\x20CALLY\x20SQUARE');if(_0x5093f1['answer']===_0x8be7('0x1ad')){this[_0x8be7('0xc')][_0x8be7('0xa2')]('Answer');return this[_0x8be7('0xc')][_0x8be7('0xb0')]();}return this['channel'][_0x8be7('0xa2')](_0x8be7('0x1ae'));};AGIVertices[_0x8be7('0x16')][_0x8be7('0x1af')]=function(_0x33d100){logger[_0x8be7('0x2d')](util['format'](_0x8be7('0x1b0'),_0x33d100['label']));if(!this[_0x8be7('0x7a')](_0x33d100[_0x8be7('0x1b1')])){return this['channel'][_0x8be7('0x32')](_0x33d100,'no\x20subproject\x20selected');}var _0x444278=this['getSquareProject'][_0x8be7('0x6b')](this,_0x33d100['project_id']);if(!this[_0x8be7('0x7a')](_0x444278)){return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x33d100,util['format'](_0x8be7('0x1b2'),_0x33d100[_0x8be7('0x1b1')]));}if(_0x444278===this[_0x8be7('0xc')][_0x8be7('0x37')]){return this[_0x8be7('0xc')]['error'](_0x33d100,_0x8be7('0x1b3'));}this[_0x8be7('0x35')]['sync'](this,_0x33d100,_0x444278);var _0x36faa7=this[_0x8be7('0xc')][_0x8be7('0xa3')](_0x8be7('0x1b4'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x8be7('0x6')][_0x8be7('0x196')]||_0x8be7('0x1b5'),_0x444278,this['channel']['arg_1']));if(_0x36faa7[_0x8be7('0x9c')]===-0x1){return _0x36faa7;}return this[_0x8be7('0xc')]['noop'](util[_0x8be7('0x28')](_0x8be7('0xbb'),_0x8be7('0x1b4'),_0x444278));};AGIVertices[_0x8be7('0x16')][_0x8be7('0x1b6')]=function(_0x47609f){logger['info'](util[_0x8be7('0x28')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x47609f[_0x8be7('0xa1')]));var _0x25ee86=this[_0x8be7('0x54')][_0x8be7('0x6b')](this,_0x47609f[_0x8be7('0xae')]);this['createSquareDetailsReport'][_0x8be7('0x6b')](this,_0x47609f,_0x47609f[_0x8be7('0xae')]);if(this[_0x8be7('0x7a')](_0x47609f[_0x8be7('0xd5')])){var _0x571fef=this[_0x8be7('0xf')][_0x8be7('0x6b')](this,_0x47609f[_0x8be7('0xd5')]);if(_0x571fef){this[_0x8be7('0xc')][_0x8be7('0x95')](_0x571fef,_0x25ee86);return this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0x1b7'),_0x47609f[_0x8be7('0xae')],_0x571fef));}}return this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x47609f[_0x8be7('0xae')]));};AGIVertices[_0x8be7('0x16')][_0x8be7('0x1b8')]=function(_0x359a55){logger[_0x8be7('0x2d')](util['format'](_0x8be7('0x1b9'),_0x359a55[_0x8be7('0xa1')]));_0x359a55['text']=_0x359a55[_0x8be7('0x59')][_0x8be7('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8be7('0x7a')](_0x359a55[_0x8be7('0x58')])){return this[_0x8be7('0xc')][_0x8be7('0xa2')](_0x8be7('0x1ba'));}if(!this[_0x8be7('0x7a')](_0x359a55[_0x8be7('0x59')])){return this['channel']['noop'](_0x8be7('0xbe'));}this['channel'][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0x1bb'),_0x359a55[_0x8be7('0x59')]));var _0x37cb9a=this[_0x8be7('0x57')][_0x8be7('0x6b')](this,_0x359a55);if(_0x37cb9a){this[_0x8be7('0xc')][_0x8be7('0xa2')](util['format'](_0x8be7('0x1bc'),_0x37cb9a));var _0x452f43=this[_0x8be7('0xc')]['streamFile'](_0x37cb9a);try{fs['unlink'](_0x37cb9a+_0x8be7('0xfa'));}catch(_0x241280){logger[_0x8be7('0x32')](_0x241280);}return _0x452f43;}return this['channel'][_0x8be7('0x32')](_0x359a55,_0x8be7('0x1bd'));};AGIVertices[_0x8be7('0x16')][_0x8be7('0x1be')]=function(_0x45c174){logger['info'](util[_0x8be7('0x28')](_0x8be7('0x1bf'),_0x45c174[_0x8be7('0xa1')]));_0x45c174['text']=_0x45c174['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8be7('0x7a')](_0x45c174[_0x8be7('0x59')])){return this['channel'][_0x8be7('0xa2')]('no\x20text\x20configured');}this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')]('Trying\x20Google\x20TTS\x20%s',_0x45c174[_0x8be7('0x59')]));var _0x1f9ab8=this[_0x8be7('0x5f')][_0x8be7('0x6b')](this,_0x45c174);if(_0x1f9ab8){this['channel'][_0x8be7('0xa2')](util['format'](_0x8be7('0x1c0'),_0x1f9ab8));var _0x434c1d=this[_0x8be7('0xc')]['streamFile'](_0x1f9ab8);try{fs[_0x8be7('0xf9')](_0x1f9ab8+_0x8be7('0xfa'));}catch(_0x263386){logger[_0x8be7('0x32')](_0x263386);}return _0x434c1d;}return this['channel']['error'](_0x45c174,_0x8be7('0x1c1'));};AGIVertices[_0x8be7('0x16')]['unpause']=function(_0x56b16c){logger[_0x8be7('0x2d')](util['format'](_0x8be7('0x1c2'),_0x56b16c[_0x8be7('0xa1')]));if(!this['isConfigured'](_0x56b16c[_0x8be7('0x14f')])){return this[_0x8be7('0xc')]['error'](_0x56b16c,'no\x20find\x20by\x20configured');}logger[_0x8be7('0x2d')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x8be7('0x38')],_0x56b16c[_0x8be7('0x14f')]));var _0x2e6706=this[_0x8be7('0x4e')][_0x8be7('0x6b')](this,_0x56b16c[_0x8be7('0x14f')]);if(_0x2e6706){logger['info'](util['format'](_0x8be7('0x152'),this[_0x8be7('0xc')][_0x8be7('0x38')],_0x56b16c['findBy']));this[_0x8be7('0xc')]['noop'](util[_0x8be7('0x28')](_0x8be7('0x152'),this['channel'][_0x8be7('0x38')],_0x56b16c[_0x8be7('0x14f')]));return{'code':0xc8,'result':_0x8be7('0x153')};}else{logger['info'](util[_0x8be7('0x28')](_0x8be7('0x154'),this[_0x8be7('0xc')][_0x8be7('0x38')],_0x56b16c[_0x8be7('0x14f')]));this[_0x8be7('0xc')][_0x8be7('0xa2')](util['format'](_0x8be7('0x154'),this[_0x8be7('0xc')][_0x8be7('0x38')],_0x56b16c[_0x8be7('0x14f')]));return{'code':0xc8,'result':_0x8be7('0x155')};}};AGIVertices[_0x8be7('0x16')][_0x8be7('0x1c3')]=function(_0x426a0b){logger[_0x8be7('0x2d')](util[_0x8be7('0x28')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x426a0b[_0x8be7('0xa1')]));var _0x942275=this[_0x8be7('0xc')][_0x8be7('0xa3')](_0x8be7('0x1c4'),[_0x426a0b['mailbox'],_0x426a0b[_0x8be7('0x74')]]);if(_0x942275[_0x8be7('0x9c')]===-0x1){return _0x942275;}return this[_0x8be7('0xc')][_0x8be7('0xa2')](util[_0x8be7('0x28')](_0x8be7('0xbb'),_0x8be7('0x1c4'),_0x426a0b['mailbox']));};AGIVertices[_0x8be7('0x16')][_0x8be7('0x1c5')]=function(_0x3c1300){logger['info'](util[_0x8be7('0x28')](_0x8be7('0x1c6'),_0x3c1300['label']));if(!this[_0x8be7('0x7a')](_0x3c1300[_0x8be7('0xd5')])){return this[_0x8be7('0xc')][_0x8be7('0x32')](_0x3c1300,'no\x20variable\x20selected');}var _0x4ed978=this['getVariable'][_0x8be7('0x6b')](this,_0x3c1300[_0x8be7('0xd5')]);if(!_0x4ed978){return this['channel'][_0x8be7('0x32')](_0x3c1300,_0x8be7('0x10d'));}var _0x45d8df=this['channel'][_0x8be7('0xf')](_0x4ed978);return{'code':0xc8,'result':_0x45d8df['extra']?_0x45d8df[_0x8be7('0x99')]:'-'};};String[_0x8be7('0x16')]['replaceAll']=function(_0xd8c598,_0x4dfb61){return this[_0x8be7('0x96')](_0xd8c598)[_0x8be7('0x1c7')](_0x4dfb61);};module[_0x8be7('0x1c8')]=AGIVertices; \ No newline at end of file +var _0x66ba=['agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','shelljs','randomstring','mustache','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','menu','getdigits','channel','rpc','prototype','getVariable','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','then','getTrunk','getSoundById','save_name','getMailAccount','sendMailMessage','mailRpc','getIntervals','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','createSquareRecording','uniqueid','callerid','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agent','error','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','replace','googleCloudTTS','apiKey','text','languageCode','en-US','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','rawBody','parse','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','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','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','tildeASR','appid','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','command','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','setVariable','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','beep','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','Enter\x20in\x20MENU\x20(%s)\x20block','digit','no\x20variable\x20found','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','record','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','statusMessage','saydigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','email','Smtp','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d'];(function(_0x43f2b6,_0x17d6d4){var _0x4106a9=function(_0x39543e){while(--_0x39543e){_0x43f2b6['push'](_0x43f2b6['shift']());}};_0x4106a9(++_0x17d6d4);}(_0x66ba,0x1c8));var _0xa66b=function(_0x333683,_0x2e51dc){_0x333683=_0x333683-0x0;var _0x570c76=_0x66ba[_0x333683];return _0x570c76;};'use strict';var fs=require('fs');var path=require(_0xa66b('0x0'));var util=require(_0xa66b('0x1'));var _=require(_0xa66b('0x2'));var sh=require(_0xa66b('0x3'));var odbc=require('odbc')();var rs=require(_0xa66b('0x4'));var moment=require('moment');var Mustache=require(_0xa66b('0x5'));var rp=require('request-promise');var logger=require(_0xa66b('0x6'))(_0xa66b('0x7'));var config=require(_0xa66b('0x8'));var scripts=require(_0xa66b('0x9'));var FILES_PATH=_0xa66b('0xa');var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=[_0xa66b('0xb'),_0xa66b('0xc'),'getsecretdigits'];var AGIVertices=function(_0x5cafe7,_0x17cb34,_0x24a72a){this[_0xa66b('0xd')]=_0x5cafe7;this[_0xa66b('0xe')]=_0x17cb34;this['mailRpc']=_0x24a72a;};AGIVertices[_0xa66b('0xf')][_0xa66b('0x10')]=function(_0x2ba4b1,_0x5ef8d4){this['rpc']['getVariableById'](_0x2ba4b1)['then'](function(_0x464add){_0x5ef8d4(null,_0x464add?_0x464add[_0xa66b('0x11')]:![]);})[_0xa66b('0x12')](function(_0x2ae079){_0x5ef8d4(_0x2ae079);});};AGIVertices[_0xa66b('0xf')][_0xa66b('0x13')]=function(_0x1a73ff,_0xf6ec48){this[_0xa66b('0xe')][_0xa66b('0x14')](_0x1a73ff)['then'](function(_0xa3a4b5){_0xf6ec48(null,_0xa3a4b5?_0xa3a4b5[_0xa66b('0x11')]:![]);})['catch'](function(_0xccadff){_0xf6ec48(_0xccadff);});};AGIVertices[_0xa66b('0xf')]['getSquareProject']=function(_0x22dc7e,_0x24b968){this['rpc'][_0xa66b('0x15')](_0x22dc7e)['then'](function(_0x144d51){_0x24b968(null,_0x144d51?_0x144d51[_0xa66b('0x11')]:![]);})['catch'](function(_0x2a8a37){_0x24b968(_0x2a8a37);});};AGIVertices[_0xa66b('0xf')][_0xa66b('0x16')]=function(_0xd50feb,_0x50565b){this[_0xa66b('0xe')][_0xa66b('0x17')](_0xd50feb)['then'](function(_0x824cb1){_0x50565b(null,_0x824cb1?_0x824cb1[_0xa66b('0x18')]:![]);})[_0xa66b('0x12')](function(_0x3e00ca){_0x50565b(_0x3e00ca);});};AGIVertices['prototype'][_0xa66b('0x19')]=function(_0xefee11,_0x517502){this[_0xa66b('0xe')][_0xa66b('0x1a')](_0xefee11)[_0xa66b('0x1b')](function(_0x1dba0c){_0x517502(null,_0x1dba0c?_0x1dba0c[_0xa66b('0x11')]:![]);})[_0xa66b('0x12')](function(_0x486d92){_0x517502(_0x486d92);});};AGIVertices[_0xa66b('0xf')][_0xa66b('0x1c')]=function(_0x202983,_0x34b502){this[_0xa66b('0xe')]['getTrunkById'](_0x202983)[_0xa66b('0x1b')](function(_0x1900db){_0x34b502(null,_0x1900db?_0x1900db['name']:![]);})[_0xa66b('0x12')](function(_0x38f87c){_0x34b502(_0x38f87c);});};AGIVertices[_0xa66b('0xf')]['getSound']=function(_0x55d9ed,_0x1a09b1){var _0x39438c=this;this[_0xa66b('0xe')][_0xa66b('0x1d')](_0x55d9ed)['then'](function(_0x226d97){_0x1a09b1(null,_0x226d97?_0x39438c['getSoundPath'](_0x226d97[_0xa66b('0x1e')]):![]);})[_0xa66b('0x12')](function(_0x285a0c){_0x1a09b1(_0x285a0c);});};AGIVertices['prototype'][_0xa66b('0x1f')]=function(_0x3f7dc9,_0x198a70){this[_0xa66b('0xe')]['getMailAccountById'](_0x3f7dc9)[_0xa66b('0x1b')](function(_0x237f7b){_0x198a70(null,_0x237f7b?_0x237f7b:![]);})[_0xa66b('0x12')](function(_0x4dd625){_0x198a70(_0x4dd625);});};AGIVertices['prototype'][_0xa66b('0x20')]=function(_0x273bc6,_0x5b4514,_0x5c0b87){this[_0xa66b('0x21')][_0xa66b('0x20')](_0x273bc6,_0x5b4514)[_0xa66b('0x1b')](function(){_0x5c0b87(null);})[_0xa66b('0x12')](function(_0x4285ff){_0x5c0b87(_0x4285ff);});};AGIVertices[_0xa66b('0xf')][_0xa66b('0x22')]=function(_0x164674,_0x4008b2){this[_0xa66b('0xe')]['getIntervalById'](_0x164674)[_0xa66b('0x1b')](function(_0x367733){if(_0x367733){if(_0x367733['IntervalId']){_0x4008b2(null,[_0x367733['interval']]);}else{_0x4008b2(null,_[_0xa66b('0x23')](_0x367733[_0xa66b('0x24')],'interval'));}}else{_0x4008b2(null,![]);}})[_0xa66b('0x12')](function(_0x22864a){_0x4008b2(_0x22864a);});};AGIVertices[_0xa66b('0xf')]['getSoundPath']=function(_0x439cb6){return util[_0xa66b('0x25')](_0xa66b('0x26'),FILES_PATH,_0x439cb6);};AGIVertices[_0xa66b('0xf')][_0xa66b('0x27')]=function(_0x40dc62,_0x3fb309,_0x563082){odbc['open'](_0x40dc62,function(_0x310695){if(_0x310695){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x310695);_0x563082(_0x310695);}else{logger[_0xa66b('0x28')](_0xa66b('0x29'));odbc[_0xa66b('0x2a')](_0x3fb309,function(_0xace435,_0x5d19ea){if(_0xace435){logger[_0xa66b('0x28')]('Error\x20executing\x20query\x20%s',_0x3fb309);_0x563082(_0xace435);}else{logger[_0xa66b('0x28')](_0xa66b('0x2b'),_0x3fb309);odbc[_0xa66b('0x2c')](function(_0x9ab7d5){if(_0x9ab7d5){logger['error'](_0xa66b('0x2d'),_0x9ab7d5);}_0x563082(null,_0x5d19ea);});}});}});};AGIVertices['prototype'][_0xa66b('0x2e')]=function(_0x33a40b,_0x2b9621){this[_0xa66b('0xe')][_0xa66b('0x2f')](_0x33a40b)['then'](function(_0x38db5e){_0x2b9621(null,_0x38db5e?_0x38db5e:![]);})[_0xa66b('0x12')](function(_0x38a1c8){_0x2b9621(_0x38a1c8);});};AGIVertices[_0xa66b('0xf')]['createSmsMessage']=function(_0x521952,_0x511350){this[_0xa66b('0xe')][_0xa66b('0x30')](_0x521952)[_0xa66b('0x1b')](function(_0x54d2f3){_0x511350(null,_0x54d2f3);})['catch'](function(_0x271062){_0x511350(_0x271062);});};AGIVertices[_0xa66b('0xf')][_0xa66b('0x31')]=function(_0x4e0ceb,_0x1790ff,_0x3c65e9){this[_0xa66b('0xe')]['createSquareDetailsReport']({'uniqueid':this[_0xa66b('0xd')]['uniqueid'],'node':_0x4e0ceb[_0xa66b('0x32')],'application':_0x4e0ceb[_0xa66b('0x33')],'data':_0x1790ff||null,'project_name':this[_0xa66b('0xd')][_0xa66b('0x34')],'callerid':this['channel']['callerid']})[_0xa66b('0x1b')](function(_0x579063){if(_0x3c65e9){_0x3c65e9(null,_0x579063);}})[_0xa66b('0x12')](function(_0x567a7c){if(_0x3c65e9){_0x3c65e9(_0x567a7c);}});};AGIVertices[_0xa66b('0xf')]['createSquareRecording']=function(_0x5e4123,_0x23070f,_0xdc6bf9,_0x5e365c){this[_0xa66b('0xe')][_0xa66b('0x35')]({'uniqueid':this['channel'][_0xa66b('0x36')],'callerid':this['channel'][_0xa66b('0x37')],'calleridname':this['channel'][_0xa66b('0x38')],'context':this[_0xa66b('0xd')][_0xa66b('0x39')],'extension':this[_0xa66b('0xd')][_0xa66b('0x3a')],'priority':this[_0xa66b('0xd')][_0xa66b('0x3b')],'accountcode':this[_0xa66b('0xd')]['accountcode'],'dnid':this[_0xa66b('0xd')][_0xa66b('0x3c')],'projectName':this['channel'][_0xa66b('0x34')],'saveName':_0x23070f,'filename':_0x5e4123[_0xa66b('0x3d')]||_0x23070f,'savePath':_0xdc6bf9})[_0xa66b('0x1b')](function(_0xee44f3){_0x5e365c(null,_0xee44f3);})['catch'](function(_0x5b10b0){_0x5e365c(_0x5b10b0);});};AGIVertices['prototype'][_0xa66b('0x3e')]=function(_0x10315c,_0x165f85,_0x2a0e36){this[_0xa66b('0xe')][_0xa66b('0x3e')]({'uniqueid':this[_0xa66b('0xd')][_0xa66b('0x36')],'body':_0x10315c,'direction':_0x165f85})[_0xa66b('0x1b')](function(_0x23f11a){if(_0x2a0e36){_0x2a0e36(null,_0x23f11a);}})[_0xa66b('0x12')](function(_0x5bfdf5){if(_0x2a0e36){_0x2a0e36(_0x5bfdf5);}});};AGIVertices[_0xa66b('0xf')][_0xa66b('0x3f')]=function(_0x29ef29,_0x42b823){this['rpc'][_0xa66b('0x3f')]({'firstName':_[_0xa66b('0x40')](_0x29ef29[_0xa66b('0x11')])||_['isNil'](_0x29ef29['name'])?_0xa66b('0x41')+Math[_0xa66b('0x42')]():_0x29ef29[_0xa66b('0x11')],'lastName':_[_0xa66b('0x40')](_0x29ef29[_0xa66b('0x43')])||_[_0xa66b('0x44')](_0x29ef29[_0xa66b('0x43')])?null:_0x29ef29[_0xa66b('0x43')],'phone':_0x29ef29[_0xa66b('0x45')],'ListId':_0x29ef29[_0xa66b('0x46')],'scheduledat':_0x29ef29[_0xa66b('0x47')],'callbackUniqueid':this[_0xa66b('0xd')][_0xa66b('0x36')],'tags':_0xa66b('0x48'),'description':_0xa66b('0x49')+_0x29ef29[_0xa66b('0x47')][_0xa66b('0x4a')](),'priority':_0x29ef29[_0xa66b('0x4b')]})[_0xa66b('0x1b')](function(_0x3ac5a6){_0x42b823(null,_0x3ac5a6);})[_0xa66b('0x12')](function(_0x4b4bb2){_0x42b823(_0x4b4bb2);});};AGIVertices[_0xa66b('0xf')][_0xa66b('0x4c')]=function(_0x632701,_0x20f576){this[_0xa66b('0xe')][_0xa66b('0x4d')](_0x632701)[_0xa66b('0x1b')](function(_0x4a916a){_0x20f576(null,_0x4a916a?_0x4a916a[_0xa66b('0x11')]:![]);})[_0xa66b('0x12')](function(_0x5a5e60){_0x20f576(_0x5a5e60);});};AGIVertices[_0xa66b('0xf')][_0xa66b('0x4e')]=function(_0xfa7a86,_0x4694cf,_0xf4c9c9){var _0x105642={'role':'agent'};_0x105642[_0xfa7a86]=this[_0xa66b('0xd')]['callerid'];this['rpc'][_0xa66b('0x4e')](_0x105642,_0x4694cf,this[_0xa66b('0xd')][_0xa66b('0x36')])['then'](function(_0x1ab87b){_0xf4c9c9(null,_['isNil'](_0x1ab87b)?![]:!![]);})['catch'](function(_0x413531){logger['error'](_0x413531);_0xf4c9c9(null,![]);});};AGIVertices[_0xa66b('0xf')][_0xa66b('0x4f')]=function(_0x1ed115,_0x54b022){var _0x4b2140={'role':_0xa66b('0x50')};_0x4b2140[_0x1ed115]=this[_0xa66b('0xd')][_0xa66b('0x37')];this['rpc']['agentUnpause'](_0x4b2140)[_0xa66b('0x1b')](function(_0x3fcc6e){_0x54b022(null,_[_0xa66b('0x44')](_0x3fcc6e)?![]:!![]);})[_0xa66b('0x12')](function(_0x3b8ad4){logger[_0xa66b('0x51')](_0x3b8ad4);_0x54b022(null,![]);});};AGIVertices[_0xa66b('0xf')][_0xa66b('0x52')]=function(_0x47445d,_0x1fe6c8){var _0x48d4a6={'role':_0xa66b('0x50')};_0x48d4a6[_0x47445d]=this[_0xa66b('0xd')][_0xa66b('0x37')];this[_0xa66b('0xe')][_0xa66b('0x52')](_0x48d4a6)[_0xa66b('0x1b')](function(_0x2d2dab){_0x1fe6c8(null,_[_0xa66b('0x44')](_0x2d2dab)?![]:!![]);})[_0xa66b('0x12')](function(_0x27e7e6){logger[_0xa66b('0x51')](_0x27e7e6);_0x1fe6c8(null,![]);});};AGIVertices[_0xa66b('0xf')][_0xa66b('0x53')]=function(_0xdf1e22,_0x5ffe6e){var _0x484bd6={'role':_0xa66b('0x50')};_0x484bd6[_0xdf1e22]=this[_0xa66b('0xd')][_0xa66b('0x37')];var _0x38b947=_0xdf1e22!=_0xa66b('0x54')?util['format'](_0xa66b('0x55'),'LOCAL',this['channel']['callerid']):undefined;this[_0xa66b('0xe')][_0xa66b('0x53')](_0x484bd6,_0x38b947)[_0xa66b('0x1b')](function(_0x3a21d9){_0x5ffe6e(null,_[_0xa66b('0x44')](_0x3a21d9)?![]:!![]);})[_0xa66b('0x12')](function(_0x33d35e){logger[_0xa66b('0x51')](_0x33d35e);_0x5ffe6e(null,![]);});};AGIVertices['prototype'][_0xa66b('0x56')]=function(_0x58e00c,_0x3d345e){sh['exec'](_['trim'](_0x58e00c),function(_0x55703f,_0x51f426){var _0x326c8f=_0x51f426[_0xa66b('0x57')](/(\r\n|\n|\r)/gm,'');_0x3d345e(null,_0x326c8f);});};AGIVertices[_0xa66b('0xf')]['googleCloudTTS']=function(_0x1cc97a,_0xbbc077){scripts[_0xa66b('0x58')](_0x1cc97a[_0xa66b('0x59')],_0x1cc97a['google_cloud_tts_text_type']||'text',_0x1cc97a[_0xa66b('0x5a')],_0x1cc97a[_0xa66b('0x5b')]||_0xa66b('0x5c'),_0x1cc97a['ssmlGender']||_0xa66b('0x5d'),_0x1cc97a[_0xa66b('0x5e')]||'MP3')[_0xa66b('0x1b')](function(_0x24bfae){_0xbbc077(null,_0x24bfae);})['catch'](function(_0x57be4e){_0xbbc077(_0x57be4e);});};AGIVertices[_0xa66b('0xf')]['googleTTS']=function(_0x161d46,_0x5e2cbe){scripts[_0xa66b('0x5f')](_0x161d46[_0xa66b('0x5a')],_0x161d46[_0xa66b('0x60')]||'en',0x1)['then'](function(_0x455e95){_0x5e2cbe(null,_0x455e95);})[_0xa66b('0x12')](function(_0x3ca83b){_0x5e2cbe(_0x3ca83b);});};AGIVertices[_0xa66b('0xf')][_0xa66b('0x61')]=function(_0x416592,_0x47f5d3){var _0x2c59be={'uri':_0x416592[_0xa66b('0x62')],'method':_0x416592[_0xa66b('0x63')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x416592[_0xa66b('0x64')])===_0xa66b('0x65')&&parseInt(_0x416592[_0xa66b('0x64')])>=0x1?parseInt(_0x416592[_0xa66b('0x64')])*0x3e8:0x5*0x3e8};if(_[_0xa66b('0x66')]([_0xa66b('0x67'),_0xa66b('0x68')],_0x2c59be[_0xa66b('0x63')][_0xa66b('0x69')]())){try{_0x2c59be['body']=_0x416592[_0xa66b('0x6a')]?JSON[_0xa66b('0x6b')](_0x416592[_0xa66b('0x6a')]):{};}catch(_0x521837){logger['error']('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x521837);}}try{_0x2c59be[_0xa66b('0x6c')]=_0x416592[_0xa66b('0x6d')]?JSON[_0xa66b('0x6b')](_0x416592[_0xa66b('0x6d')]):{};}catch(_0x50f16d){logger[_0xa66b('0x51')](_0xa66b('0x6e'),_0x50f16d);}if(_0x416592[_0xa66b('0x6f')]){try{var _0x4bb585=require(_0x416592[_0xa66b('0x6f')])[_0xa66b('0x70')](this,_0x2c59be);_0x2c59be[_0xa66b('0x71')]=Mustache['render'](_0x416592[_0xa66b('0x62')],_0x4bb585,{},['$$','$$']);if(_0x2c59be[_0xa66b('0x6c')]){_0x2c59be[_0xa66b('0x6c')]=JSON[_0xa66b('0x6b')](Mustache[_0xa66b('0x72')](JSON[_0xa66b('0x73')](_0x2c59be['headers']),_0x4bb585,{},['$$','$$']));}if(_0x2c59be[_0xa66b('0x74')]){_0x2c59be[_0xa66b('0x74')]=JSON[_0xa66b('0x6b')](Mustache[_0xa66b('0x72')](JSON[_0xa66b('0x73')](_0x2c59be[_0xa66b('0x74')]),_0x4bb585,{},['$$','$$']));}}catch(_0x1d3f77){logger[_0xa66b('0x51')](_0xa66b('0x75'),_0x1d3f77);}}rp(_0x2c59be)['then'](function(_0x1a4a4b){var _0x56b665={'statusCode':_0x1a4a4b[_0xa66b('0x76')]||0xc8,'statusMessage':_0x1a4a4b['statusMessage']||'OK','headers':_0x1a4a4b[_0xa66b('0x6c')]||{},'body':_0x1a4a4b['body']||{}};_0x47f5d3(null,_0x56b665);})[_0xa66b('0x12')](function(_0x5db5dd){var _0x1e3ce8={'statusCode':_0x5db5dd[_0xa66b('0x76')]||0x1f4,'statusMessage':_0x5db5dd[_0xa66b('0x77')]||_0xa66b('0x78'),'headers':_0x5db5dd[_0xa66b('0x79')]['headers']||{},'body':_0x5db5dd['options'][_0xa66b('0x74')]||{}};_0x47f5d3(null,_0x1e3ce8);});};AGIVertices[_0xa66b('0xf')][_0xa66b('0x7a')]=function(_0x3cd568,_0x5d39e5){scripts[_0xa66b('0x7a')](this[_0xa66b('0xd')][_0xa66b('0x36')],_0x3cd568[_0xa66b('0x7b')],_0x3cd568[_0xa66b('0x5a')],_0x3cd568[_0xa66b('0x7c')]||'en')[_0xa66b('0x1b')](function(_0x592a20){_0x5d39e5(null,_0x592a20);})[_0xa66b('0x12')](function(_0x57e7c1){_0x5d39e5(_0x57e7c1);});};AGIVertices[_0xa66b('0xf')][_0xa66b('0x7d')]=function(_0x14d768,_0xcb4017){scripts[_0xa66b('0x7d')](this[_0xa66b('0xd')],_0x14d768)[_0xa66b('0x1b')](function(_0x207176){_0xcb4017(null,_0x207176);})[_0xa66b('0x12')](function(_0x244446){_0xcb4017(_0x244446);});};AGIVertices[_0xa66b('0xf')]['ispeechTTS']=function(_0x40c7b3,_0x2d5a9d){scripts[_0xa66b('0x7e')](_0x40c7b3[_0xa66b('0x7b')],_0x40c7b3['text'],_0x40c7b3[_0xa66b('0x7f')]||_0xa66b('0x5c'),_0x40c7b3[_0xa66b('0x80')])[_0xa66b('0x1b')](function(_0x2275f5){_0x2d5a9d(null,_0x2275f5);})[_0xa66b('0x12')](function(_0x4e88b7){_0x2d5a9d(_0x4e88b7);});};AGIVertices[_0xa66b('0xf')][_0xa66b('0x81')]=function(_0x468a83,_0x236c7f,_0x9aae88){scripts[_0xa66b('0x81')](_0x236c7f,_0x468a83[_0xa66b('0x7b')],_0x468a83[_0xa66b('0x82')]||_0xa66b('0x5c'),this[_0xa66b('0x83')](_0x468a83[_0xa66b('0x84')])?_0x468a83['model']:undefined)[_0xa66b('0x1b')](function(_0x9d5e11){_0x9aae88(null,_0x9d5e11);})[_0xa66b('0x12')](function(_0x5c73a9){_0x9aae88(_0x5c73a9);});};AGIVertices[_0xa66b('0xf')][_0xa66b('0x85')]=function(_0x5e65ea,_0x16006a){scripts[_0xa66b('0x85')](_0x5e65ea[_0xa66b('0x86')],_0x5e65ea[_0xa66b('0x87')],_0x5e65ea[_0xa66b('0x88')],_0x5e65ea[_0xa66b('0x89')]||_0xa66b('0x8a'),_0x5e65ea[_0xa66b('0x5a')],_0x5e65ea[_0xa66b('0x8b')]||'text')['then'](function(_0x9b7ec7){_0x16006a(null,_0x9b7ec7);})[_0xa66b('0x12')](function(_0x5b771c){_0x16006a(_0x5b771c);});};AGIVertices[_0xa66b('0xf')][_0xa66b('0x8c')]=function(_0xb7ed8,_0x50b863){scripts[_0xa66b('0x8c')](this['channel']['uniqueid'],_0xb7ed8['aws_access_key_id'],_0xb7ed8[_0xa66b('0x87')],_0xb7ed8['aws_lex_region'],_0xb7ed8['text'],_0xb7ed8[_0xa66b('0x8d')])[_0xa66b('0x1b')](function(_0x2a84fc){_0x50b863(null,_0x2a84fc);})[_0xa66b('0x12')](function(_0x4e55a8){_0x50b863(_0x4e55a8);});};AGIVertices[_0xa66b('0xf')][_0xa66b('0x8e')]=function(_0x1e8f98,_0x2c02d2,_0x866794){scripts['googleASR'](_0x2c02d2,_0x1e8f98[_0xa66b('0x7b')],_0x1e8f98['google_asr_language']||_0xa66b('0x5c'))[_0xa66b('0x1b')](function(_0x195396){_0x866794(null,_0x195396);})['catch'](function(_0x3e30a2){_0x866794(_0x3e30a2);});};AGIVertices[_0xa66b('0xf')][_0xa66b('0x8f')]=function(_0x405f24,_0x3570ae,_0x178586){scripts['tildeASR'](_0x3570ae,_0x405f24[_0xa66b('0x90')],_0x405f24['appsecret'],_0x405f24[_0xa66b('0x71')])[_0xa66b('0x1b')](function(_0x49848a){_0x178586(null,_0x49848a);})[_0xa66b('0x12')](function(_0x400037){_0x178586(_0x400037);});};AGIVertices[_0xa66b('0xf')][_0xa66b('0x91')]=function(_0x5ab475){var _0x1e01c7=_['includes'](verticesWithRetry,_0x5ab475[_0xa66b('0x33')])?_0x5ab475:_[_0xa66b('0x92')](_0x5ab475);for(var _0x1302e2 in _0x1e01c7){if(_0x1e01c7[_0xa66b('0x93')](_0x1302e2)){if(_0x1e01c7[_0x1302e2]&&_[_0xa66b('0x94')](_0x1e01c7[_0x1302e2])){if(_[_0xa66b('0x66')](recursiveMapAttributes,_0x1302e2)){_0x1e01c7[_0x1302e2]=this[_0xa66b('0x95')](_0x1e01c7[_0x1302e2]);}else{_0x1e01c7[_0x1302e2]=this[_0xa66b('0x96')](_0x1e01c7[_0x1302e2]);}}}}return _0x1e01c7;};AGIVertices['prototype'][_0xa66b('0x97')]=function(_0x4de1c9){for(var _0x4aaabb in _0x4de1c9){if(_0x4de1c9['hasOwnProperty'](_0x4aaabb)){if(_[_0xa66b('0x98')](_0x4de1c9[_0x4aaabb])){this[_0xa66b('0x97')](_0x4de1c9[_0x4aaabb]);}else if(_[_0xa66b('0x99')](_0x4de1c9[_0x4aaabb])){for(var _0x15c71a=0x0;_0x15c71a<_0x4de1c9[_0x4aaabb][_0xa66b('0x9a')];_0x15c71a++){this[_0xa66b('0x97')](_0x4de1c9[_0x4aaabb][_0x15c71a]);}}else if(_['isString'](_0x4de1c9[_0x4aaabb])){_0x4de1c9[_0x4aaabb]=this[_0xa66b('0x96')](_0x4de1c9[_0x4aaabb]);}}}};AGIVertices['prototype'][_0xa66b('0x9b')]=function(_0x41962e,_0x2f23d1){for(var _0x3af190 in _0x41962e){if(_0x41962e[_0xa66b('0x93')](_0x3af190)){if(_[_0xa66b('0x98')](_0x41962e[_0x3af190])){if(!_[_0xa66b('0x40')](_0x41962e[_0x3af190])){this['saveRestApiResult'](_0x41962e[_0x3af190],util[_0xa66b('0x25')](_0xa66b('0x9c'),_0x2f23d1,_0x3af190));}}else if(_['isArray'](_0x41962e[_0x3af190])){for(var _0x404890=0x0;_0x404890<_0x41962e[_0x3af190][_0xa66b('0x9a')];_0x404890++){this[_0xa66b('0x9b')](_0x41962e[_0x3af190][_0x404890],util[_0xa66b('0x25')]('%s.%s',_0x2f23d1,_0x3af190+'['+_0x404890+']'));}}else{if(!_[_0xa66b('0x44')](_0x41962e[_0x3af190])){this['channel']['setVariable'](util['format'](_0xa66b('0x9c'),_0x2f23d1,_0x3af190),_0x41962e[_0x3af190]);}}}}};AGIVertices[_0xa66b('0xf')]['replaceObjectAllVariables']=function(_0x5ca7a2){try{var _0x2086ee=JSON[_0xa66b('0x6b')](_0x5ca7a2);this['recursiveNodeIndex'](_0x2086ee);return JSON[_0xa66b('0x73')](_0x2086ee);}catch(_0x5a9a19){return this[_0xa66b('0x96')](_0x5ca7a2);}};AGIVertices[_0xa66b('0xf')][_0xa66b('0x96')]=function(_0x1d1858){var _0x34dfce=_0x1d1858['split']('{');for(var _0x3b7473=0x1;_0x3b7473<_0x34dfce[_0xa66b('0x9a')];_0x3b7473+=0x1){var _0x5c2f28=_0x34dfce[_0x3b7473][_0xa66b('0x9d')]('}');if(_0x5c2f28['length']>0x1){_0x1d1858=_0x1d1858[_0xa66b('0x9e')]('{'+_0x5c2f28[0x0]+'}',this[_0xa66b('0xd')][_0xa66b('0x10')](_0x5c2f28[0x0])['extra']||_0x5c2f28[0x0]);}}if(_0x34dfce[_0xa66b('0x9a')]===0x1){return _0x1d1858[_0xa66b('0x4a')]();}return this[_0xa66b('0x96')](_0x1d1858);};AGIVertices['prototype'][_0xa66b('0x9f')]=function(_0x550b99,_0x5f45e4){var _0x16f601=this[_0xa66b('0xd')][_0xa66b('0x10')](_0x550b99);if(_0x16f601[_0xa66b('0xa0')]===-0x1){return _0x16f601;}logger['info'](util[_0xa66b('0x25')](_0xa66b('0xa1'),_0x5f45e4,_0x16f601[_0xa66b('0xa2')]));return this[_0xa66b('0xd')]['setVariable'](_0x5f45e4,_0x16f601[_0xa66b('0xa2')]);};AGIVertices[_0xa66b('0xf')][_0xa66b('0x83')]=function(_0x23faf2){return _0x23faf2&&_0x23faf2!=='0'&&_0x23faf2!=='-1'&&_0x23faf2!=='';};AGIVertices[_0xa66b('0xf')][_0xa66b('0xa3')]=function(_0x2772e3){this[_0xa66b('0x31')]['sync'](this,_0x2772e3,'-');_0x2772e3[_0xa66b('0xa4')]=_0x2772e3[_0xa66b('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xa66b('0xf')][_0xa66b('0xa5')]=function(_0x488da3){logger['info'](util[_0xa66b('0x25')](_0xa66b('0xa6'),_0x488da3[_0xa66b('0x32')]));if(!this[_0xa66b('0x83')](_0x488da3[_0xa66b('0x5a')])){return this[_0xa66b('0xd')][_0xa66b('0xa7')](_0xa66b('0xa8'));}var _0x5683e7='\x22'+_0x488da3['text']+'\x22';if(this[_0xa66b('0x83')](_0x488da3[_0xa66b('0x79')])){_0x5683e7+=','+_0x488da3[_0xa66b('0x79')];}var _0x3a42cc=this[_0xa66b('0xd')][_0xa66b('0xa9')](_0xa66b('0xaa'),_0x5683e7);if(_0x3a42cc[_0xa66b('0xa0')]===-0x1){return _0x3a42cc;}return this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0xab'),_0x5683e7));};AGIVertices['prototype'][_0xa66b('0xac')]=function(_0x4fa9f9){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0xad'),_0x4fa9f9[_0xa66b('0x32')]));if(!this['isConfigured'](_0x4fa9f9[_0xa66b('0xae')])){return this[_0xa66b('0xd')][_0xa66b('0xa7')](_0xa66b('0xaf'));}var _0x2d7c81=_0x4fa9f9[_0xa66b('0xae')];if(this[_0xa66b('0x83')](_0x4fa9f9[_0xa66b('0x79')])){_0x2d7c81+=','+_0x4fa9f9[_0xa66b('0x79')];}var _0xd26fe6=this[_0xa66b('0xd')][_0xa66b('0xa9')](_0xa66b('0xb0'),_0x2d7c81);if(_0xd26fe6[_0xa66b('0xa0')]===-0x1){return _0xd26fe6;}var _0xdfef00=this[_0xa66b('0x9f')](_0xa66b('0xb1'),_0xa66b('0xb2'));if(_0xdfef00[_0xa66b('0xa0')]===-0x1){return _0xdfef00;}var _0x551b13=this['getAndSetVariable'](_0xa66b('0xb3'),'MRCP_RECOG_TRANSCRIPT');if(_0x551b13[_0xa66b('0xa0')]===-0x1){return _0x551b13;}var _0x21c937=this[_0xa66b('0x9f')](_0xa66b('0xb4'),_0xa66b('0xb5'));if(_0x21c937['result']===-0x1){return _0x21c937;}return this[_0xa66b('0xd')]['noop'](util[_0xa66b('0x25')]('Executed\x20command\x20MRCPRecog\x20%s',_0x2d7c81));};AGIVertices[_0xa66b('0xf')][_0xa66b('0x7')]=function(_0x28cf24){logger['info'](util[_0xa66b('0x25')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x28cf24[_0xa66b('0x32')]));return this['channel'][_0xa66b('0x7')]([_0x28cf24[_0xa66b('0xb6')],_0x28cf24['args']]);};AGIVertices['prototype']['answer']=function(_0x23787a){logger[_0xa66b('0x28')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x23787a[_0xa66b('0x32')]));if(this['isConfigured'](_0x23787a[_0xa66b('0x64')])){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0xb7'),_0x23787a[_0xa66b('0x64')]));var _0xd98af1=this[_0xa66b('0xd')][_0xa66b('0xb8')](_0x23787a['timeout']);if(_0xd98af1[_0xa66b('0xa0')]===-0x1){return _0xd98af1;}}return this[_0xa66b('0xd')][_0xa66b('0xb9')]();};AGIVertices[_0xa66b('0xf')]['callback']=function(_0x45a1c2){logger['info'](util[_0xa66b('0x25')](_0xa66b('0xba'),_0x45a1c2['label']));if(!this[_0xa66b('0x83')](_0x45a1c2[_0xa66b('0x46')])){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x45a1c2,_0xa66b('0xbb'));}_0x45a1c2[_0xa66b('0x47')]=moment();if(this[_0xa66b('0x83')](_0x45a1c2[_0xa66b('0xbc')])){_0x45a1c2[_0xa66b('0x47')]=moment()['add'](_0x45a1c2['delay'],_0xa66b('0xbd'));}if(!this[_0xa66b('0x83')](_0x45a1c2[_0xa66b('0x4b')])){_0x45a1c2[_0xa66b('0x4b')]=0x2;}this[_0xa66b('0x3f')][_0xa66b('0x70')](this,_0x45a1c2);return this[_0xa66b('0xd')]['noop'](util[_0xa66b('0x25')](_0xa66b('0xbe'),_0x45a1c2['phone'],_0x45a1c2['list_id'],_0x45a1c2[_0xa66b('0x47')]));};AGIVertices[_0xa66b('0xf')]['custom_app']=function(_0x1645e3){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0xbf'),_0x1645e3[_0xa66b('0x32')]));var _0x518f08=this[_0xa66b('0xd')]['exec'](_0x1645e3[_0xa66b('0xc0')],_0x1645e3[_0xa66b('0x79')]);if(_0x518f08[_0xa66b('0xa0')]===-0x1){return _0x518f08;}return this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0xc1'),_0x1645e3[_0xa66b('0xc0')],_0x1645e3[_0xa66b('0x79')]));};AGIVertices[_0xa66b('0xf')][_0xa66b('0xc2')]=function(_0x4ed44d){logger[_0xa66b('0x28')](util[_0xa66b('0x25')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x4ed44d[_0xa66b('0x32')]));if(!this[_0xa66b('0x83')](_0x4ed44d[_0xa66b('0x5a')])){return this[_0xa66b('0xd')][_0xa66b('0xa7')]('no\x20text\x20configured');}var _0x29afc5='\x22'+_0x4ed44d['text']+'\x22';if(this[_0xa66b('0x83')](_0x4ed44d[_0xa66b('0x79')])){_0x29afc5+=','+_0x4ed44d[_0xa66b('0x79')];}var _0x5a4600=this[_0xa66b('0xd')]['exec'](_0xa66b('0xaa'),_0x29afc5);if(_0x5a4600['result']===-0x1){return _0x5a4600;}return this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0xab'),_0x29afc5));};AGIVertices[_0xa66b('0xf')][_0xa66b('0xc3')]=function(_0x3686f2){logger[_0xa66b('0x28')](util[_0xa66b('0x25')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x3686f2[_0xa66b('0x32')]));if(!this['isConfigured'](_0x3686f2[_0xa66b('0x5a')])){return this[_0xa66b('0xd')][_0xa66b('0xa7')](_0xa66b('0xa8'));}var _0x5d46f3='\x22'+_0x3686f2[_0xa66b('0x5a')]+'\x22';if(this[_0xa66b('0x83')](_0x3686f2[_0xa66b('0x79')])){_0x5d46f3+=','+_0x3686f2[_0xa66b('0x79')];}var _0x3fae3d=this[_0xa66b('0xd')][_0xa66b('0xa9')](_0xa66b('0xaa'),_0x5d46f3);if(_0x3fae3d['result']===-0x1){return _0x3fae3d;}return this['channel']['noop'](util[_0xa66b('0x25')](_0xa66b('0xab'),_0x5d46f3));};AGIVertices[_0xa66b('0xf')][_0xa66b('0xc4')]=function(_0x44443b){logger['info'](util[_0xa66b('0x25')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x44443b[_0xa66b('0x32')]));if(!this[_0xa66b('0x83')](_0x44443b['grammar'])){return this[_0xa66b('0xd')][_0xa66b('0xa7')](_0xa66b('0xaf'));}var _0x322928=_0x44443b[_0xa66b('0xae')];if(this[_0xa66b('0x83')](_0x44443b[_0xa66b('0x79')])){_0x322928+=','+_0x44443b['options'];}var _0x474236=this[_0xa66b('0xd')][_0xa66b('0xa9')]('MRCPRecog',_0x322928);if(_0x474236[_0xa66b('0xa0')]===-0x1){return _0x474236;}var _0x5a8211=this[_0xa66b('0x9f')](_0xa66b('0xb1'),_0xa66b('0xc5'));if(_0x5a8211[_0xa66b('0xa0')]===-0x1){return _0x5a8211;}var _0x47dffd=this[_0xa66b('0x9f')]('RECOG_INPUT()',_0xa66b('0xc6'));if(_0x47dffd[_0xa66b('0xa0')]===-0x1){return _0x47dffd;}var _0x1d2d44=this[_0xa66b('0x9f')](_0xa66b('0xb4'),_0xa66b('0xc7'));if(_0x1d2d44[_0xa66b('0xa0')]===-0x1){return _0x1d2d44;}return this[_0xa66b('0xd')][_0xa66b('0xa7')](util['format'](_0xa66b('0xc8'),_0x322928));};AGIVertices[_0xa66b('0xf')][_0xa66b('0xc9')]=function(_0xc232c6){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0xca'),_0xc232c6['label']));if(!this[_0xa66b('0x83')](_0xc232c6[_0xa66b('0xae')])){return this[_0xa66b('0xd')][_0xa66b('0xa7')](_0xa66b('0xaf'));}var _0x3d95a6=_0xc232c6[_0xa66b('0xae')];if(this[_0xa66b('0x83')](_0xc232c6[_0xa66b('0x79')])){_0x3d95a6+=','+_0xc232c6[_0xa66b('0x79')];}var _0x46adad=this['channel'][_0xa66b('0xa9')](_0xa66b('0xb0'),_0x3d95a6);if(_0x46adad['result']===-0x1){return _0x46adad;}var _0x225b6d=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xa66b('0xcb'));if(_0x225b6d[_0xa66b('0xa0')]===-0x1){return _0x225b6d;}var _0x3e9bfd=this[_0xa66b('0x9f')](_0xa66b('0xb3'),_0xa66b('0xcc'));if(_0x3e9bfd[_0xa66b('0xa0')]===-0x1){return _0x3e9bfd;}var _0x46ad12=this[_0xa66b('0x9f')](_0xa66b('0xb4'),'SESTEK_ASR_INSTANCE');if(_0x46ad12[_0xa66b('0xa0')]===-0x1){return _0x46ad12;}return this['channel'][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0xc8'),_0x3d95a6));};AGIVertices[_0xa66b('0xf')][_0xa66b('0xcd')]=function(_0x5d16ae){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0xce'),_0x5d16ae[_0xa66b('0x32')]));if(!this[_0xa66b('0x83')](_0x5d16ae['odbc_id'])){return this[_0xa66b('0xd')]['error'](_0x5d16ae,_0xa66b('0xcf'));}var _0x561dcb=this[_0xa66b('0x16')]['sync'](this,_0x5d16ae['odbc_id']);if(!_0x561dcb){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x5d16ae,_0xa66b('0xd0'));}if(!this[_0xa66b('0x83')](_0x5d16ae[_0xa66b('0x2a')])){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x5d16ae,'no\x20query\x20configured');}var _0x274318=_0x5d16ae['query'][_0xa66b('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0xd1'),_0x274318));var _0x56bac2=this['getQueryOdbc']['sync'](this,_0x561dcb,_0x274318);this[_0xa66b('0x31')][_0xa66b('0x70')](this,_0x5d16ae,_0x274318);if(!this[_0xa66b('0x83')](_0x5d16ae[_0xa66b('0xd2')])){return this[_0xa66b('0xd')][_0xa66b('0xa7')](_0xa66b('0xd3'));}var _0x100a2a=this[_0xa66b('0x10')][_0xa66b('0x70')](this,_0x5d16ae[_0xa66b('0xd2')]);if(!_0x100a2a){return this['channel'][_0xa66b('0x51')](_0x5d16ae,'no\x20variable\x20found');}var _0x57c8c5=this;_0x56bac2[_0xa66b('0xd4')](function(_0x504e24,_0x252198){Object[_0xa66b('0xd5')](_0x504e24)['forEach'](function(_0x3f5932){_0x57c8c5[_0xa66b('0xd')][_0xa66b('0xd6')](util['format']('%s[%s][%s]',_0x100a2a,_0x252198,_0x3f5932),_0x504e24[_0x3f5932]);});});this['channel'][_0xa66b('0xd6')](util['format'](_0xa66b('0xd7'),_0x100a2a),_0x56bac2[_0xa66b('0x9a')]);return this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0xd8'),_0x100a2a));};AGIVertices[_0xa66b('0xf')][_0xa66b('0xd9')]=function(_0x170ce5){logger[_0xa66b('0xda')](util[_0xa66b('0x25')](_0xa66b('0xdb'),_0x170ce5[_0xa66b('0x32')]));if(!this[_0xa66b('0x83')](_0x170ce5[_0xa66b('0xdc')])){return this[_0xa66b('0xd')]['error'](_0x170ce5,_0xa66b('0xdd'));}var _0x1e9695=this[_0xa66b('0x19')][_0xa66b('0x70')](this,_0x170ce5[_0xa66b('0xdc')]);if(!_0x1e9695){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x170ce5,'no\x20user\x20found');}var _0x6a8d98=this[_0xa66b('0xd')][_0xa66b('0xa9')](_0xa66b('0xde'),[util[_0xa66b('0x25')](_0xa66b('0xdf'),_0x1e9695),_0x170ce5[_0xa66b('0x64')],_0x170ce5[_0xa66b('0xe0')],_0x170ce5['url']]);if(_0x6a8d98[_0xa66b('0xa0')]===-0x1){return _0x6a8d98;}return this['channel']['noop'](util[_0xa66b('0x25')](_0xa66b('0xe1'),_0xa66b('0xde')));};AGIVertices[_0xa66b('0xf')][_0xa66b('0xe2')]=function(_0x5d2e39){logger['info'](util[_0xa66b('0x25')](_0xa66b('0xe3'),_0x5d2e39[_0xa66b('0x32')]));if(!this[_0xa66b('0x83')](_0x5d2e39[_0xa66b('0x7b')])){return this['channel'][_0xa66b('0xa7')](_0xa66b('0xe4'));}if(!this['isConfigured'](_0x5d2e39[_0xa66b('0x5a')])){return this[_0xa66b('0xd')]['noop']('no\x20text\x20configured');}this[_0xa66b('0xd')][_0xa66b('0xe5')]=!![];this[_0xa66b('0x31')](_0x5d2e39);this[_0xa66b('0x3e')](_0x5d2e39[_0xa66b('0x5a')],'in');this['channel']['noop'](util[_0xa66b('0x25')]('Trying\x20Dialogflow:\x20%s',_0x5d2e39[_0xa66b('0x5a')]));var _0x436d08=this[_0xa66b('0x7a')]['sync'](this,_0x5d2e39);if(_0x436d08){for(var _0x42fa68 in _0x436d08){if(_0x436d08[_0xa66b('0x93')](_0x42fa68)){this[_0xa66b('0xd')][_0xa66b('0xd6')](util[_0xa66b('0x25')](_0xa66b('0xe6'),_0x42fa68[_0xa66b('0x69')]()),_0x436d08[_0x42fa68]);}}this[_0xa66b('0x3e')](_0x436d08[_0xa66b('0xe7')],_0xa66b('0xe8'));return this[_0xa66b('0xd')][_0xa66b('0xa7')](util['format'](_0xa66b('0xe9'),_0x436d08[_0xa66b('0xe7')]));}return this['channel'][_0xa66b('0x51')](_0x5d2e39,_0xa66b('0xea'));};AGIVertices['prototype']['sesteknda']=function(_0xbe496){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0xeb'),_0xbe496[_0xa66b('0x32')]));if(!this[_0xa66b('0x83')](_0xbe496[_0xa66b('0xec')])){return this['channel'][_0xa66b('0xa7')](_0xa66b('0xed'));}if(!this[_0xa66b('0x83')](_0xbe496['username'])){return this['channel']['noop']('no\x20username\x20configured');}if(!this[_0xa66b('0x83')](_0xbe496[_0xa66b('0xee')])){return this['channel']['noop'](_0xa66b('0xef'));}if(!this[_0xa66b('0x83')](_0xbe496[_0xa66b('0xf0')])){return this['channel'][_0xa66b('0xa7')](_0xa66b('0xa8'));}this['channel'][_0xa66b('0xe5')]=!![];this[_0xa66b('0x31')](_0xbe496);this[_0xa66b('0x3e')](_0xbe496['text'],'in');this['channel'][_0xa66b('0xa7')](util['format'](_0xa66b('0xf1'),_0xbe496[_0xa66b('0x5a')]));var _0x417af8=this[_0xa66b('0x7d')][_0xa66b('0x70')](this,_0xbe496);if(_0x417af8){for(var _0x32fce0 in _0x417af8){if(_0x417af8[_0xa66b('0x93')](_0x32fce0)){this['channel'][_0xa66b('0xd6')](util[_0xa66b('0x25')](_0xa66b('0xf2'),_0x32fce0['toUpperCase']()),_0x417af8[_0x32fce0]);}}this['createSquareMessage'](_0x417af8[_0xa66b('0xe7')],_0xa66b('0xe8'));if(_0x417af8[_0xa66b('0xf3')]){this['channel'][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0xf4'),_0x417af8[_0xa66b('0xf3')]));var _0x1a998a=this['channel'][_0xa66b('0xf5')](_0x417af8[_0xa66b('0xf3')]);try{fs[_0xa66b('0xf6')](_0x417af8[_0xa66b('0xf3')]+_0xa66b('0xf7'));}catch(_0x8556da){logger[_0xa66b('0x51')](_0x8556da);}return _0x1a998a;}else{return this['channel']['noop'](util['format'](_0xa66b('0xf8'),_0x417af8['speech']));}}return this[_0xa66b('0xd')][_0xa66b('0x51')](_0xbe496,_0xa66b('0xf9'));};AGIVertices[_0xa66b('0xf')][_0xa66b('0xfa')]=function(_0x2fd950){logger[_0xa66b('0x28')](util['format'](_0xa66b('0xfb'),_0x2fd950['label']));return this[_0xa66b('0xd')][_0xa66b('0xa7')](_0xa66b('0xfa'));};AGIVertices['prototype'][_0xa66b('0xfc')]=function(_0x1173ab){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0xfd'),_0x1173ab[_0xa66b('0x32')]));var _0x2f31cc='';if(_0x1173ab[_0xa66b('0xfe')]){if(!this[_0xa66b('0x83')](_0x1173ab[_0xa66b('0xfe')])){return this['channel'][_0xa66b('0x51')](_0x1173ab,'no\x20trunk\x20selected');}else{var _0x113c50=parseInt(_0x1173ab['trunk_id'],0xa);if(isNaN(_0x113c50)){_0x2f31cc=_0x1173ab['trunk_id'];}else{_0x2f31cc=this[_0xa66b('0x1c')][_0xa66b('0x70')](this,_0x1173ab[_0xa66b('0xfe')]);if(!_0x2f31cc){return this['channel']['error'](_0x1173ab,_0xa66b('0xff'));}}}}else if(_0x1173ab['trunk_name']){_0x2f31cc=_0x1173ab[_0xa66b('0x100')];}else{return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x1173ab,'no\x20trunk\x20selected');}var _0x3ccd8b=this[_0xa66b('0xd')][_0xa66b('0xa9')]('DIAL',[util[_0xa66b('0x25')](_0xa66b('0x101'),_0x2f31cc,_0x1173ab['phone']),_0x1173ab[_0xa66b('0x64')],_0x1173ab[_0xa66b('0xe0')],_0x1173ab[_0xa66b('0x62')]]);if(_0x3ccd8b[_0xa66b('0xa0')]===-0x1){return _0x3ccd8b;}return this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0xe1'),'DIAL'));};AGIVertices[_0xa66b('0xf')][_0xa66b('0x102')]=function(_0x128b5f){logger[_0xa66b('0x28')](util[_0xa66b('0x25')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x128b5f[_0xa66b('0x32')]));return this['channel'][_0xa66b('0xa7')]('finally');};AGIVertices['prototype'][_0xa66b('0xc')]=function(_0x205f3b){logger['info'](util['format'](_0xa66b('0x103'),_0x205f3b[_0xa66b('0x32')]));if(_0x205f3b['retry']===0x0){return this[_0xa66b('0xa3')](_0x205f3b);}_0x205f3b[_0xa66b('0xa4')]-=0x1;if(!this[_0xa66b('0x83')](_0x205f3b[_0xa66b('0x104')])){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x205f3b,_0xa66b('0x105'));}var _0x58ca2d=this[_0xa66b('0x106')][_0xa66b('0x70')](this,_0x205f3b['file_id']);if(!_0x58ca2d){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x205f3b,_0xa66b('0x107'));}if(!this['isConfigured'](_0x205f3b[_0xa66b('0xd2')])){return this['channel']['error'](_0xa66b('0xd3'));}var _0x213932=this['channel'][_0xa66b('0x108')](_0x58ca2d,_0x205f3b[_0xa66b('0x109')],_0x205f3b['maxdigit']);var _0x52e70b=_0x213932[_0xa66b('0xa0')]?_0x213932['result'][_0xa66b('0x4a')]():'';logger[_0xa66b('0x28')](_0xa66b('0x10a'),JSON[_0xa66b('0x73')](_0x213932));if(_0x213932[_0xa66b('0xa0')]===-0x1){this[_0xa66b('0x31')]['sync'](this,_0x205f3b,_0x52e70b);return _0x213932;}else if(_0x213932[_0xa66b('0xa2')]===_0xa66b('0x64')){_0x213932[_0xa66b('0xa0')]=_0x52e70b[_0xa66b('0x9a')]>=parseInt(_0x205f3b[_0xa66b('0x10b')])?'x':'i';}else{_0x213932[_0xa66b('0xa0')]=_0x52e70b[_0xa66b('0x9a')]>=parseInt(_0x205f3b['mindigit'])&&_0x52e70b['length']<=parseInt(_0x205f3b[_0xa66b('0x10c')])?'x':'i';}var _0xf90c77=this[_0xa66b('0x10')]['sync'](this,_0x205f3b['variable_id']);if(!_0xf90c77){return this['channel'][_0xa66b('0x51')](_0x205f3b,'no\x20variable\x20found');}this[_0xa66b('0xd')][_0xa66b('0xd6')](_0xf90c77,_0x52e70b);if(this[_0xa66b('0x83')](_0x205f3b[_0xa66b('0x10d')])){var _0x223a25=parseInt(_0x205f3b['hiddendigitsnum'],0xa);var _0x452bc2=rs['generate']({'charset':'*','length':_0x223a25});var _0x11b1a2=_0x52e70b[_0xa66b('0x9a')];if(_0x11b1a2>0x0){if(_0x11b1a2>_0x223a25){this[_0xa66b('0x31')]['sync'](this,_0x205f3b,_0x205f3b[_0xa66b('0x10e')]===_0xa66b('0x10f')?_0x452bc2+_0x52e70b['substr'](_0x223a25):_0x52e70b[_0xa66b('0x110')](0x0,_0x11b1a2-_0x223a25)+_0x452bc2);}else{this[_0xa66b('0x31')]['sync'](this,_0x205f3b,rs[_0xa66b('0x111')]({'charset':'*','length':_0x11b1a2}));}}else{this[_0xa66b('0x31')][_0xa66b('0x70')](this,_0x205f3b,'');}}else{this[_0xa66b('0x31')][_0xa66b('0x70')](this,_0x205f3b,_0x52e70b);}return _0x213932;};AGIVertices[_0xa66b('0xf')]['getsecretdigits']=function(_0x22895f){logger['info'](util[_0xa66b('0x25')](_0xa66b('0x112'),_0x22895f[_0xa66b('0x32')]));return this[_0xa66b('0xc')](_0x22895f);};AGIVertices[_0xa66b('0xf')]['goal']=function(_0x3e9ee8){logger[_0xa66b('0x28')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x3e9ee8[_0xa66b('0x32')]));this[_0xa66b('0x31')][_0xa66b('0x70')](this,_0x3e9ee8,_0x3e9ee8[_0xa66b('0x113')]);return this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')]('GOAL\x20%s',_0x3e9ee8['goalname']));};AGIVertices[_0xa66b('0xf')][_0xa66b('0x114')]=function(_0xf6649f){logger['info'](util[_0xa66b('0x25')](_0xa66b('0x115'),_0xf6649f['label']));if(!this[_0xa66b('0x83')](_0xf6649f['aws_access_key_id'])||!this[_0xa66b('0x83')](_0xf6649f[_0xa66b('0x87')])){return this[_0xa66b('0xd')][_0xa66b('0xa7')](_0xa66b('0x116'));}if(!this[_0xa66b('0x83')](_0xf6649f['text'])){return this[_0xa66b('0xd')]['noop'](_0xa66b('0xa8'));}this[_0xa66b('0xd')][_0xa66b('0xa7')](util['format'](_0xa66b('0x117'),_0xf6649f[_0xa66b('0x5a')]));var _0x2798b1=this['awsPolly'][_0xa66b('0x70')](this,_0xf6649f);if(_0x2798b1){this[_0xa66b('0xd')]['noop'](util[_0xa66b('0x25')](_0xa66b('0x118'),_0x2798b1));var _0x3ed488=this['channel'][_0xa66b('0xf5')](_0x2798b1);try{fs['unlink'](_0x2798b1+'.wav');}catch(_0x19280f){logger[_0xa66b('0x51')](_0x19280f);}return _0x3ed488;}return this[_0xa66b('0xd')][_0xa66b('0x51')](_0xf6649f,_0xa66b('0x119'));};AGIVertices[_0xa66b('0xf')][_0xa66b('0x11a')]=function(_0x220ab4){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x11b'),_0x220ab4[_0xa66b('0x32')]));if(!this['isConfigured'](_0x220ab4[_0xa66b('0x86')])||!this[_0xa66b('0x83')](_0x220ab4[_0xa66b('0x87')])){return this[_0xa66b('0xd')][_0xa66b('0xa7')](_0xa66b('0x116'));}if(!this[_0xa66b('0x83')](_0x220ab4[_0xa66b('0x8d')])){return this[_0xa66b('0xd')]['noop'](_0xa66b('0x11c'));}if(!this['isConfigured'](_0x220ab4[_0xa66b('0x5a')])){return this['channel'][_0xa66b('0xa7')](_0xa66b('0xa8'));}this[_0xa66b('0xd')][_0xa66b('0xe5')]=!![];this['createSquareDetailsReport'](_0x220ab4);this['createSquareMessage'](_0x220ab4['text'],'in');this['channel'][_0xa66b('0xa7')](util[_0xa66b('0x25')]('Trying\x20Amazon\x20Lex:\x20%s',_0x220ab4[_0xa66b('0x5a')]));var _0x458c9c=this['awsLex'][_0xa66b('0x70')](this,_0x220ab4);if(_0x458c9c){for(var _0x82c9f4 in _0x458c9c){if(_0x458c9c[_0xa66b('0x93')](_0x82c9f4)&&_[_0xa66b('0x94')](_0x458c9c[_0x82c9f4])){this[_0xa66b('0xd')][_0xa66b('0xd6')](util[_0xa66b('0x25')](_0xa66b('0x11d'),_0x82c9f4['toUpperCase']()),_0x458c9c[_0x82c9f4]);}}if(_[_0xa66b('0x44')](_0x458c9c['message'])){return this['channel'][_0xa66b('0xa7')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xa66b('0x3e')](_0x458c9c[_0xa66b('0x77')],'out');return this['channel'][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0x11e'),_0x458c9c[_0xa66b('0x77')]));}}return this['channel']['error'](_0x220ab4,_0xa66b('0x11f'));};AGIVertices[_0xa66b('0xf')][_0xa66b('0x120')]=function(_0x1f5be1){logger[_0xa66b('0x28')](util[_0xa66b('0x25')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x1f5be1[_0xa66b('0x32')],_0x1f5be1['timeout']));if(!this['isConfigured'](_0x1f5be1['key'])){return this[_0xa66b('0xd')][_0xa66b('0xa7')](_0xa66b('0xe4'));}var _0x58fe08=_0xa66b('0x121');var _0x3656bf=util['format'](_0xa66b('0x122'),FILES_PATH,rs['generate'](0x4));var _0x13dfb5=util['format'](_0xa66b('0x9c'),_0x3656bf,_0x58fe08);var _0x2d7a33=!![];if(_0x1f5be1['beep']===_0xa66b('0x123')){_0x2d7a33=![];}var _0x3ec3bf=this[_0xa66b('0xd')][_0xa66b('0x124')](_0x3656bf,_0x58fe08,_0x1f5be1[_0xa66b('0x125')],_0x1f5be1[_0xa66b('0x64')],undefined,_0x2d7a33);if(_0x3ec3bf['result']!==-0x1){this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0x126'),_0x13dfb5));var _0x11d680=this[_0xa66b('0x8e')]['sync'](this,_0x1f5be1,_0x13dfb5);if(_0x11d680){for(var _0xe2f006 in _0x11d680){if(_0x11d680[_0xa66b('0x93')](_0xe2f006)){this[_0xa66b('0xd')]['setVariable'](util['format'](_0xa66b('0x127'),_0xe2f006[_0xa66b('0x69')]()),_0x11d680[_0xe2f006]);}}return this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0x128'),JSON[_0xa66b('0x73')](_0x11d680)));}}return _0x3ec3bf;};AGIVertices[_0xa66b('0xf')][_0xa66b('0x129')]=function(_0x447f89){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x12a'),_0x447f89[_0xa66b('0x32')]));if(!this[_0xa66b('0x83')](_0x447f89['appid'])){return this['channel'][_0xa66b('0xa7')](_0xa66b('0x12b'));}if(!this[_0xa66b('0x83')](_0x447f89['appsecret'])){return this[_0xa66b('0xd')][_0xa66b('0xa7')]('no\x20appsecret\x20configured');}var _0x1899b1=_0xa66b('0x121');var _0x541e1a=util[_0xa66b('0x25')](_0xa66b('0x122'),FILES_PATH,rs[_0xa66b('0x111')](0x4));var _0x267e68=util[_0xa66b('0x25')](_0xa66b('0x9c'),_0x541e1a,_0x1899b1);var _0x188db7=!![];if(_0x447f89[_0xa66b('0x12c')]==='NOBEEP'){_0x188db7=![];}var _0x11d3ac=this['channel']['recordFile'](_0x541e1a,_0x1899b1,_0x447f89[_0xa66b('0x125')],_0x447f89[_0xa66b('0x64')],undefined,_0x188db7);if(_0x11d3ac['result']!==-0x1){this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0x12d'),_0x267e68));var _0x36b6d1=this[_0xa66b('0x8f')][_0xa66b('0x70')](this,_0x447f89,_0x267e68);if(_0x36b6d1){for(var _0x248f67 in _0x36b6d1){if(_0x36b6d1['hasOwnProperty'](_0x248f67)){this[_0xa66b('0xd')]['setVariable'](util[_0xa66b('0x25')]('TILDE_ASR_%s',_0x248f67[_0xa66b('0x69')]()),_0x36b6d1[_0x248f67]);}}return this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0x12e'),JSON['stringify'](_0x36b6d1)));}}return _0x11d3ac;};AGIVertices[_0xa66b('0xf')][_0xa66b('0x12f')]=function(_0x3b0903){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x130'),_0x3b0903['label']));return this[_0xa66b('0xd')][_0xa66b('0x131')](_0x3b0903['context'],_0x3b0903[_0xa66b('0x3a')],_0x3b0903[_0xa66b('0x3b')]);};AGIVertices['prototype']['gotoif']=function(_0xa79b6f){logger['info'](util[_0xa66b('0x25')](_0xa66b('0x132'),_0xa79b6f['label']));if(!this[_0xa66b('0x83')](_0xa79b6f[_0xa66b('0x133')])){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0xa79b6f,'no\x20condition\x20configured');}try{var _0xedfd54=eval(_0xa79b6f[_0xa66b('0x133')])?_0xa66b('0x134'):_0xa66b('0x135');this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0x136'),_0xa79b6f['condition'],_0xedfd54));return{'code':0xc8,'result':_0xedfd54};}catch(_0x44d743){return{'code':0xc8,'result':_0xa66b('0x135')};}};AGIVertices[_0xa66b('0xf')][_0xa66b('0x137')]=function(_0x477b4a){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x138'),_0x477b4a[_0xa66b('0x32')]));if(!this[_0xa66b('0x83')](_0x477b4a[_0xa66b('0x139')])){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x477b4a,_0xa66b('0x13a'));}var _0x67e56=this[_0xa66b('0x22')][_0xa66b('0x70')](this,_0x477b4a[_0xa66b('0x139')]);if(!_0x67e56){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x477b4a,_0xa66b('0x13b'));}for(var _0x38f892=0x0;_0x38f892<_0x67e56['length'];_0x38f892+=0x1){var _0x45245a=this['channel'][_0xa66b('0x10')](util[_0xa66b('0x25')](_0xa66b('0x13c'),_0x67e56[_0x38f892]));if(_0x45245a['result']===-0x1){return _0x45245a;}logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x13d'),_0x67e56[_0x38f892],_0x45245a[_0xa66b('0xa2')]));if(_0x45245a[_0xa66b('0xa2')]===_0xa66b('0x134')){logger[_0xa66b('0x28')](util['format'](_0xa66b('0x13d'),_0x67e56[_0x38f892],_0xa66b('0x134')));this[_0xa66b('0xd')]['noop'](util['format'](_0xa66b('0x13d'),_0x67e56[_0x38f892],_0xa66b('0x134')));return{'code':0xc8,'result':_0xa66b('0x134')};}else{logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x13d'),_0x67e56[_0x38f892],_0xa66b('0x135')));this[_0xa66b('0xd')][_0xa66b('0xa7')](util['format'](_0xa66b('0x13d'),_0x67e56[_0x38f892],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xa66b('0xf')]['hangup']=function(_0x62a4ed){logger[_0xa66b('0x28')](util['format'](_0xa66b('0x13e'),_0x62a4ed['label']));return this[_0xa66b('0xd')][_0xa66b('0x13f')]();};AGIVertices[_0xa66b('0xf')][_0xa66b('0x140')]=function(_0x46b9a7){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x141'),_0x46b9a7[_0xa66b('0x32')]));if(!this[_0xa66b('0x83')](_0x46b9a7['key'])){return this[_0xa66b('0xd')][_0xa66b('0xa7')](_0xa66b('0xe4'));}var _0x4c7f7c=_0xa66b('0x121');var _0x19286e=util['format'](_0xa66b('0x122'),FILES_PATH,rs[_0xa66b('0x111')](0x4));var _0x553dac=util['format'](_0xa66b('0x9c'),_0x19286e,_0x4c7f7c);var _0x5da327=!![];if(_0x46b9a7[_0xa66b('0x12c')]===_0xa66b('0x123')){_0x5da327=![];}var _0x1087b3=this[_0xa66b('0xd')][_0xa66b('0x124')](_0x19286e,_0x4c7f7c,_0x46b9a7['intKey'],_0x46b9a7[_0xa66b('0x64')],undefined,_0x5da327);if(_0x1087b3[_0xa66b('0xa0')]!==-0x1){this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0x142'),_0x553dac));var _0x2c3f09=this[_0xa66b('0x81')][_0xa66b('0x70')](this,_0x46b9a7,_0x553dac);if(_0x2c3f09){for(var _0x3f5cac in _0x2c3f09){if(_0x2c3f09[_0xa66b('0x93')](_0x3f5cac)){this['channel'][_0xa66b('0xd6')](util['format'](_0xa66b('0x143'),_0x3f5cac['toUpperCase']()),_0x2c3f09[_0x3f5cac]);}}return this[_0xa66b('0xd')][_0xa66b('0xa7')](util['format'](_0xa66b('0x144'),JSON[_0xa66b('0x73')](_0x2c3f09)));}}return _0x1087b3;};AGIVertices['prototype']['ispeechtts']=function(_0x2aa832){logger[_0xa66b('0x28')](util['format'](_0xa66b('0x145'),_0x2aa832[_0xa66b('0x32')]));if(!this[_0xa66b('0x83')](_0x2aa832[_0xa66b('0x7b')])){return this[_0xa66b('0xd')][_0xa66b('0xa7')](_0xa66b('0xe4'));}if(!this[_0xa66b('0x83')](_0x2aa832['text'])){return this[_0xa66b('0xd')][_0xa66b('0xa7')](_0xa66b('0xa8'));}this[_0xa66b('0xd')][_0xa66b('0xa7')](util['format'](_0xa66b('0x146'),_0x2aa832[_0xa66b('0x5a')]));var _0x7901f1=this['ispeechTTS'][_0xa66b('0x70')](this,_0x2aa832);if(_0x7901f1){this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0x142'),_0x7901f1));var _0x41102e=this[_0xa66b('0xd')][_0xa66b('0xf5')](_0x7901f1,_0x2aa832[_0xa66b('0x125')]);try{fs['unlink'](_0x7901f1+'.wav');}catch(_0x5c425e){logger[_0xa66b('0x51')](_0x5c425e);}return _0x41102e;}return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x2aa832,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xa66b('0xf')][_0xa66b('0x147')]=function(_0x29c8ea){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x148'),_0x29c8ea[_0xa66b('0x32')]));if(!this['isConfigured'](_0x29c8ea['findBy'])){return this[_0xa66b('0xd')]['error'](_0x29c8ea,_0xa66b('0x149'));}logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x14a'),this[_0xa66b('0xd')][_0xa66b('0x37')],_0x29c8ea[_0xa66b('0x14b')]));var _0x2688f0=this[_0xa66b('0x53')]['sync'](this,_0x29c8ea[_0xa66b('0x14b')]);if(_0x2688f0){logger['info'](util['format'](_0xa66b('0x14c'),this[_0xa66b('0xd')][_0xa66b('0x37')],_0x29c8ea['findBy']));this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0x14c'),this['channel']['callerid'],_0x29c8ea[_0xa66b('0x14b')]));return{'code':0xc8,'result':_0xa66b('0x14d')};}else{logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x14e'),this[_0xa66b('0xd')][_0xa66b('0x37')],_0x29c8ea[_0xa66b('0x14b')]));this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xa66b('0x37')],_0x29c8ea[_0xa66b('0x14b')]));return{'code':0xc8,'result':_0xa66b('0x14f')};}};AGIVertices[_0xa66b('0xf')][_0xa66b('0x150')]=function(_0x460bf6){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x151'),_0x460bf6[_0xa66b('0x32')]));if(!this[_0xa66b('0x83')](_0x460bf6['findBy'])){return this['channel'][_0xa66b('0x51')](_0x460bf6,'no\x20find\x20by\x20configured');}logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x14a'),this[_0xa66b('0xd')][_0xa66b('0x37')],_0x460bf6[_0xa66b('0x14b')]));var _0x1b9d54=this[_0xa66b('0x52')]['sync'](this,_0x460bf6[_0xa66b('0x14b')]);if(_0x1b9d54){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x14c'),this[_0xa66b('0xd')][_0xa66b('0x37')],_0x460bf6[_0xa66b('0x14b')]));this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0x14c'),this[_0xa66b('0xd')][_0xa66b('0x37')],_0x460bf6[_0xa66b('0x14b')]));return{'code':0xc8,'result':_0xa66b('0x14d')};}else{logger[_0xa66b('0x28')](util[_0xa66b('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa66b('0xd')][_0xa66b('0x37')],_0x460bf6[_0xa66b('0x14b')]));this['channel'][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0x14e'),this[_0xa66b('0xd')][_0xa66b('0x37')],_0x460bf6[_0xa66b('0x14b')]));return{'code':0xc8,'result':_0xa66b('0x14f')};}};AGIVertices[_0xa66b('0xf')]['math']=function(_0x106cdf){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x152'),_0x106cdf[_0xa66b('0x32')]));if(!this[_0xa66b('0x83')](_0x106cdf['operation'])){return this[_0xa66b('0xd')]['error'](_0x106cdf,_0xa66b('0x153'));}this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0x154'),_0x106cdf[_0xa66b('0x155')]));var _0x1b491a=eval(_0x106cdf[_0xa66b('0x155')]);if(!this[_0xa66b('0x83')](_0x106cdf[_0xa66b('0xd2')])){return this[_0xa66b('0xd')][_0xa66b('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x20bc5a=this[_0xa66b('0x10')]['sync'](this,_0x106cdf['variable_id']);if(!_0x20bc5a){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x106cdf,'no\x20variable\x20found');}if(_['isArray'](_0x1b491a)){var _0x135bf0=this;_0x1b491a[_0xa66b('0xd4')](function(_0x27710b,_0x1e46ac){_0x135bf0[_0xa66b('0xd')][_0xa66b('0xd6')](util[_0xa66b('0x25')]('%s[%s]',_0x20bc5a,_0x1e46ac),_0x27710b);});return this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')]('variable\x20%s[key]\x20set',_0x20bc5a));}else{return this['channel'][_0xa66b('0xd6')](_0x20bc5a,_0x1b491a);}};AGIVertices[_0xa66b('0xf')][_0xa66b('0xb')]=function(_0x4fe5ca){logger[_0xa66b('0x28')](util['format'](_0xa66b('0x156'),_0x4fe5ca[_0xa66b('0x32')]));if(_0x4fe5ca[_0xa66b('0xa4')]===0x0){return this[_0xa66b('0xa3')](_0x4fe5ca);}_0x4fe5ca[_0xa66b('0xa4')]-=0x1;if(!this['isConfigured'](_0x4fe5ca[_0xa66b('0x104')])){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x4fe5ca,_0xa66b('0x105'));}var _0x4da03e=this[_0xa66b('0x106')][_0xa66b('0x70')](this,_0x4fe5ca['file_id']);if(!_0x4da03e){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x4fe5ca,'no\x20file\x20audio\x20found');}var _0x536fbf=this[_0xa66b('0xd')]['getData'](_0x4da03e,_0x4fe5ca[_0xa66b('0x109')],_0x4fe5ca[_0xa66b('0x157')]);var _0x15aa42=_0x536fbf['result'];if(_0x536fbf[_0xa66b('0xa0')]===-0x1){this[_0xa66b('0x31')][_0xa66b('0x70')](this,_0x4fe5ca,'-1');return _0x536fbf;}else if(_0x536fbf[_0xa66b('0xa2')]===_0xa66b('0x64')){_0x536fbf[_0xa66b('0xa0')]=_0x536fbf['result'][_0xa66b('0x9a')]>0x0?_0x536fbf[_0xa66b('0xa0')]:'t';}else if(_[_0xa66b('0x40')](_0x536fbf[_0xa66b('0xa0')])){_0x536fbf[_0xa66b('0xa0')]='#';_0x15aa42='#';}if(!this['isConfigured'](_0x4fe5ca[_0xa66b('0xd2')])){this[_0xa66b('0xd')][_0xa66b('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x21c011=this['getVariable'][_0xa66b('0x70')](this,_0x4fe5ca['variable_id']);if(!_0x21c011){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x4fe5ca,_0xa66b('0x158'));}this['channel']['setVariable'](_0x21c011,_0x15aa42);}this[_0xa66b('0x31')][_0xa66b('0x70')](this,_0x4fe5ca,_0x15aa42);return _0x536fbf;};AGIVertices[_0xa66b('0xf')][_0xa66b('0xa7')]=function(_0x403a78){logger[_0xa66b('0x28')](util[_0xa66b('0x25')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x403a78[_0xa66b('0x32')]));return this[_0xa66b('0xd')][_0xa66b('0xa7')](_0x403a78['output']||_0x403a78['label']);};AGIVertices[_0xa66b('0xf')][_0xa66b('0x159')]=function(_0x25a39a){logger[_0xa66b('0x28')](util[_0xa66b('0x25')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x25a39a['label']));if(!this['isConfigured'](_0x25a39a[_0xa66b('0x14b')])){return this[_0xa66b('0xd')]['error'](_0x25a39a,_0xa66b('0x149'));}logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x14a'),this[_0xa66b('0xd')]['callerid'],_0x25a39a['findBy']));var _0x1ae76c=this[_0xa66b('0x4c')][_0xa66b('0x70')](this,_0x25a39a[_0xa66b('0x15a')]);var _0x3aeffe=this[_0xa66b('0x4e')][_0xa66b('0x70')](this,_0x25a39a[_0xa66b('0x14b')],_0x1ae76c);if(_0x3aeffe){logger['info'](util[_0xa66b('0x25')](_0xa66b('0x14c'),this[_0xa66b('0xd')][_0xa66b('0x37')],_0x25a39a[_0xa66b('0x14b')]));this[_0xa66b('0xd')]['noop'](util['format'](_0xa66b('0x14c'),this[_0xa66b('0xd')][_0xa66b('0x37')],_0x25a39a[_0xa66b('0x14b')]));return{'code':0xc8,'result':_0xa66b('0x14d')};}else{logger['info'](util[_0xa66b('0x25')](_0xa66b('0x14e'),this[_0xa66b('0xd')]['callerid'],_0x25a39a['findBy']));this['channel'][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0x14c'),this['channel'][_0xa66b('0x37')],_0x25a39a[_0xa66b('0x14b')]));return{'code':0xc8,'result':_0xa66b('0x14f')};}};AGIVertices[_0xa66b('0xf')][_0xa66b('0x15b')]=function(_0x4a7e95){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x15c'),_0x4a7e95[_0xa66b('0x32')]));if(!this['isConfigured'](_0x4a7e95['file_id'])){return this[_0xa66b('0xd')]['error'](_0x4a7e95,_0xa66b('0x105'));}var _0x2ab601=this[_0xa66b('0x106')][_0xa66b('0x70')](this,_0x4a7e95[_0xa66b('0x104')]);if(!_0x2ab601){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x4a7e95,_0xa66b('0x107'));}var _0x1a05de=this[_0xa66b('0xd')]['exec'](_0xa66b('0x15d'),[_0x2ab601,_0x4a7e95[_0xa66b('0xe0')]]);if(_0x1a05de['result']===-0x1){return _0x1a05de;}return this[_0xa66b('0xd')]['noop'](util[_0xa66b('0x25')](_0xa66b('0xc1'),_0xa66b('0x15d'),_0x2ab601));};AGIVertices[_0xa66b('0xf')]['queue']=function(_0x299234){logger['info'](util[_0xa66b('0x25')](_0xa66b('0x15e'),_0x299234[_0xa66b('0x32')]));if(!this[_0xa66b('0x83')](_0x299234['queue_id'])){return this[_0xa66b('0xd')]['error'](_0x299234,'no\x20queue\x20selected');}var _0x142dee='';var _0x2c5a67=parseInt(_0x299234[_0xa66b('0x15f')],0xa);if(isNaN(_0x2c5a67)){_0x142dee=_0x299234[_0xa66b('0x15f')];}else{_0x142dee=this[_0xa66b('0x13')][_0xa66b('0x70')](this,_0x299234[_0xa66b('0x15f')]);if(!_0x142dee){return this['channel']['error'](_0x299234,'no\x20queue\x20found');}}var _0x284c4b='';if(this['isConfigured'](_0x299234[_0xa66b('0x104')])){var _0x3d4453=this[_0xa66b('0x106')][_0xa66b('0x70')](this,_0x299234[_0xa66b('0x104')]);if(_0x3d4453){_0x284c4b=_0x3d4453;}}this[_0xa66b('0x31')][_0xa66b('0x70')](this,_0x299234,_0x142dee);if(_0x299234['opts'][_0xa66b('0x160')]('x')<0x0){_0x299234['opts']+='x';}if(_0x299234['opts']['indexOf']('X')<0x0){_0x299234[_0xa66b('0xe0')]+='X';}this[_0xa66b('0xd')][_0xa66b('0xd6')](_0xa66b('0x161'),_0x142dee?_0x142dee[_0xa66b('0x162')]():'');var _0x26c2b7=this[_0xa66b('0xd')]['exec'](_0xa66b('0x163'),[_0x142dee,_0x299234['opts'],_0x299234[_0xa66b('0x62')],_0x284c4b,_0x299234[_0xa66b('0x64')],_0x299234[_0xa66b('0x7')],_0x299234[_0xa66b('0x164')],_0x299234['gosub'],'',_0x299234['position']]);if(_0x26c2b7[_0xa66b('0xa0')]===-0x1){return _0x26c2b7;}return this[_0xa66b('0xd')]['noop'](util[_0xa66b('0x25')](_0xa66b('0xc1'),_0xa66b('0x163'),_0x142dee));};AGIVertices['prototype'][_0xa66b('0x165')]=function(_0x24d065){logger[_0xa66b('0x28')](util[_0xa66b('0x25')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x24d065[_0xa66b('0x32')]));var _0x3b43b0=_0x24d065[_0xa66b('0x166')]||_0xa66b('0x121');var _0x1b7208=util[_0xa66b('0x25')](_0xa66b('0x167'),this[_0xa66b('0xd')][_0xa66b('0x36')],rs[_0xa66b('0x111')](0x5));var _0x3cdb78=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x1b7208,_0x3b43b0);var _0x48acb3=util['format'](_0xa66b('0x122'),FILES_PATH,_0x1b7208);this['createSquareRecording']['sync'](this,_0x24d065,_0x1b7208,_0x3cdb78);this[_0xa66b('0xd')][_0xa66b('0xd6')](_0xa66b('0x168'),_0x1b7208);logger[_0xa66b('0x28')](_0xa66b('0x169'),_0x48acb3,_0x3b43b0,_0x24d065['escape_digits'],_0x24d065[_0xa66b('0x64')]);return this['channel'][_0xa66b('0x124')](_0x48acb3,_0x3b43b0,_0x24d065[_0xa66b('0x16a')],_0x24d065['timeout'],undefined,!![]);};AGIVertices[_0xa66b('0xf')]['restapi']=function(_0x1ee43e){logger['info'](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x1ee43e['label']));if(!this['isConfigured'](_0x1ee43e[_0xa66b('0x62')])){return this[_0xa66b('0xd')][_0xa66b('0xa7')]('no\x20url\x20configured');}var _0x229bb8=this[_0xa66b('0x61')][_0xa66b('0x70')](this,_0x1ee43e);logger[_0xa66b('0x28')](util['format'](_0xa66b('0x16b'),util[_0xa66b('0x16c')](_0x229bb8,{'showHidden':![],'depth':null})));if(!this[_0xa66b('0x83')](_0x1ee43e[_0xa66b('0xd2')])){return this[_0xa66b('0xd')][_0xa66b('0xa7')](_0xa66b('0x16d'));}var _0x568930=this[_0xa66b('0x10')][_0xa66b('0x70')](this,_0x1ee43e[_0xa66b('0xd2')]);if(!_0x568930){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x1ee43e,_0xa66b('0x158'));}this[_0xa66b('0xd')][_0xa66b('0xd6')](util[_0xa66b('0x25')]('%s_STATUS_CODE',_0x568930),_0x229bb8[_0xa66b('0x76')]?_0x229bb8['statusCode']:_0xa66b('0x16e'));this[_0xa66b('0xd')][_0xa66b('0xd6')](util[_0xa66b('0x25')]('%s_STATUS_MESSAGE',_0x568930),_0x229bb8['statusMessage']?_0x229bb8[_0xa66b('0x16f')]:'OK');if(_0x229bb8[_0xa66b('0x74')]){try{this[_0xa66b('0x9b')](_0x229bb8['body'],_0x568930);}catch(_0x3326d2){logger['error'](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x568930));}}return this[_0xa66b('0xd')][_0xa66b('0xa7')](util['format'](_0xa66b('0xd8'),_0x568930));};AGIVertices['prototype'][_0xa66b('0x170')]=function(_0x46c52e){logger[_0xa66b('0x28')](util[_0xa66b('0x25')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x46c52e[_0xa66b('0x32')]));return this['channel']['sayDigits'](_0x46c52e[_0xa66b('0x171')][_0xa66b('0x57')](/\s+/g,''),_0x46c52e[_0xa66b('0x16a')]);};AGIVertices[_0xa66b('0xf')][_0xa66b('0x172')]=function(_0x5338cb){logger['info'](util['format'](_0xa66b('0x173'),_0x5338cb[_0xa66b('0x32')]));return this[_0xa66b('0xd')][_0xa66b('0x174')](_0x5338cb[_0xa66b('0x65')]['replace'](/\s+/g,''),_0x5338cb[_0xa66b('0x16a')]);};AGIVertices[_0xa66b('0xf')][_0xa66b('0x175')]=function(_0x313687){logger[_0xa66b('0x28')](util[_0xa66b('0x25')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x313687[_0xa66b('0x32')]));return this['channel'][_0xa66b('0x176')](_0x313687[_0xa66b('0x5a')],_0x313687[_0xa66b('0x16a')]);};AGIVertices[_0xa66b('0xf')][_0xa66b('0x177')]=function(_0x3f1b79){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x178'),_0x3f1b79[_0xa66b('0x32')]));if(!this['isConfigured'](_0x3f1b79[_0xa66b('0x179')])){return this[_0xa66b('0xd')][_0xa66b('0xa7')](_0xa66b('0x17a'));}var _0x1ad518=this[_0xa66b('0x1f')][_0xa66b('0x70')](this,_0x3f1b79[_0xa66b('0x179')]);if(!_0x1ad518||!_0x1ad518['Smtp']){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x3f1b79,_0xa66b('0x17b'));}var _0x5c7c28={'from':util[_0xa66b('0x25')]('\x22%s\x22\x20<%s>',_0x1ad518['name'],_0x1ad518[_0xa66b('0x17c')]||_0x1ad518[_0xa66b('0x17d')]['user']),'to':_0x3f1b79['to']||'','cc':_0x3f1b79['cc']||'','bcc':_0x3f1b79[_0xa66b('0x17e')]||'','subject':_0x3f1b79[_0xa66b('0x17f')],'html':_0x3f1b79[_0xa66b('0x5a')],'text':_0x3f1b79[_0xa66b('0x5a')]};var _0x596329={'tls':{'rejectUnauthorized':![]}};if(_0x1ad518[_0xa66b('0x17d')]['service']){_0x596329[_0xa66b('0x180')]=_0x1ad518['Smtp']['service'];}else{_0x596329[_0xa66b('0x181')]=_0x1ad518[_0xa66b('0x17d')][_0xa66b('0x181')];_0x596329[_0xa66b('0x182')]=_0x1ad518[_0xa66b('0x17d')][_0xa66b('0x182')];_0x596329['secure']=_0x1ad518['Smtp'][_0xa66b('0x183')];}if(_0x1ad518[_0xa66b('0x17d')][_0xa66b('0x184')]){_0x596329[_0xa66b('0x185')]={'user':_0x1ad518[_0xa66b('0x17d')]['user'],'pass':_0x1ad518['Smtp'][_0xa66b('0x186')]};}if(this[_0xa66b('0x83')](_0x3f1b79[_0xa66b('0x187')])){}logger[_0xa66b('0xda')]('sendMail\x20message',JSON['stringify'](_0x5c7c28));this[_0xa66b('0x31')][_0xa66b('0x70')](this,_0x3f1b79,_0x3f1b79[_0xa66b('0x179')]);this[_0xa66b('0xd')]['noop'](util[_0xa66b('0x25')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x1ad518[_0xa66b('0x11')]));this[_0xa66b('0x20')][_0xa66b('0x70')](this,_0x596329,_0x5c7c28);return this['channel'][_0xa66b('0xa7')](_0xa66b('0x188'));};AGIVertices[_0xa66b('0xf')]['sendFax']=function(_0x1f82d7){logger['info'](util[_0xa66b('0x25')](_0xa66b('0x189'),_0x1f82d7['label']));return this[_0xa66b('0xd')]['noop'](_0xa66b('0x18a'));};AGIVertices['prototype'][_0xa66b('0x18b')]=function(_0x50d4e7){logger[_0xa66b('0x28')](util[_0xa66b('0x25')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x50d4e7[_0xa66b('0x32')]));if(!this[_0xa66b('0x83')](_0x50d4e7[_0xa66b('0x18c')])){return this[_0xa66b('0xd')][_0xa66b('0xa7')](_0xa66b('0x18d'));}var _0x4e88f4=this[_0xa66b('0x2e')][_0xa66b('0x70')](this,_0x50d4e7[_0xa66b('0x18c')]);if(!_0x4e88f4){return this[_0xa66b('0xd')]['error'](_0x50d4e7,_0xa66b('0x18e'));}var _0x3712c3={'body':_0x50d4e7[_0xa66b('0x18f')],'phone':_0x50d4e7['to']||'','SmsAccountId':_0x4e88f4['id']};logger[_0xa66b('0xda')](_0xa66b('0x190'),JSON[_0xa66b('0x73')](_0x3712c3));this['createSquareDetailsReport'][_0xa66b('0x70')](this,_0x50d4e7,_0x50d4e7[_0xa66b('0x18c')]);this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0x191'),_0x4e88f4['name']));this[_0xa66b('0x30')][_0xa66b('0x70')](this,_0x3712c3);return this[_0xa66b('0xd')]['noop'](_0xa66b('0x192'));};AGIVertices[_0xa66b('0xf')][_0xa66b('0x193')]=function(_0x462296){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x194'),_0x462296['label']));if(!this[_0xa66b('0x83')](_0x462296[_0xa66b('0xd2')])){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x462296,'no\x20variable\x20selected');}var _0xb9a6ed=this['getVariable']['sync'](this,_0x462296[_0xa66b('0xd2')]);if(!_0xb9a6ed){return this['channel'][_0xa66b('0x51')](_0x462296,_0xa66b('0x158'));}return this[_0xa66b('0xd')][_0xa66b('0xd6')](_0xb9a6ed,_0x462296['variable_value']);};AGIVertices[_0xa66b('0xf')]['start']=function(_0x40f567){logger[_0xa66b('0x28')](util[_0xa66b('0x25')]('Enter\x20in\x20START\x20(%s)\x20block',_0x40f567['label']));this[_0xa66b('0xd')][_0xa66b('0xa7')](_0xa66b('0x195'));if(_0x40f567[_0xa66b('0xb9')]===_0xa66b('0x196')){this[_0xa66b('0xd')][_0xa66b('0xa7')](_0xa66b('0x197'));return this[_0xa66b('0xd')][_0xa66b('0xb9')]();}return this[_0xa66b('0xd')][_0xa66b('0xa7')](_0xa66b('0x198'));};AGIVertices['prototype'][_0xa66b('0x199')]=function(_0x8afd43){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x19a'),_0x8afd43['label']));if(!this[_0xa66b('0x83')](_0x8afd43[_0xa66b('0x19b')])){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x8afd43,_0xa66b('0x19c'));}var _0x40d1bf=this['getSquareProject'][_0xa66b('0x70')](this,_0x8afd43[_0xa66b('0x19b')]);if(!this[_0xa66b('0x83')](_0x40d1bf)){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x8afd43,util[_0xa66b('0x25')](_0xa66b('0x19d'),_0x8afd43[_0xa66b('0x19b')]));}if(_0x40d1bf===this[_0xa66b('0xd')][_0xa66b('0x34')]){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x8afd43,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xa66b('0x31')][_0xa66b('0x70')](this,_0x8afd43,_0x40d1bf);var _0x176e85=this[_0xa66b('0xd')][_0xa66b('0xa9')]('AGI',util[_0xa66b('0x25')](_0xa66b('0x19e'),config[_0xa66b('0x7')][_0xa66b('0x181')]||_0xa66b('0x19f'),_0x40d1bf,this[_0xa66b('0xd')]['arg_1']));if(_0x176e85[_0xa66b('0xa0')]===-0x1){return _0x176e85;}return this[_0xa66b('0xd')][_0xa66b('0xa7')](util['format']('Executed\x20command\x20%s\x20%s',_0xa66b('0x1a0'),_0x40d1bf));};AGIVertices[_0xa66b('0xf')]['system']=function(_0x1e1602){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x1a1'),_0x1e1602[_0xa66b('0x32')]));var _0x18bf9b=this[_0xa66b('0x56')][_0xa66b('0x70')](this,_0x1e1602[_0xa66b('0xb6')]);this[_0xa66b('0x31')][_0xa66b('0x70')](this,_0x1e1602,_0x1e1602[_0xa66b('0xb6')]);if(this[_0xa66b('0x83')](_0x1e1602[_0xa66b('0xd2')])){var _0xdae069=this['getVariable']['sync'](this,_0x1e1602[_0xa66b('0xd2')]);if(_0xdae069){this[_0xa66b('0xd')][_0xa66b('0xd6')](_0xdae069,_0x18bf9b);return this[_0xa66b('0xd')][_0xa66b('0xa7')](util['format'](_0xa66b('0x1a2'),_0x1e1602[_0xa66b('0xb6')],_0xdae069));}}return this[_0xa66b('0xd')][_0xa66b('0xa7')](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x1e1602[_0xa66b('0xb6')]));};AGIVertices[_0xa66b('0xf')]['google_cloud_tts']=function(_0x5d1786){logger[_0xa66b('0x28')](util['format'](_0xa66b('0x1a3'),_0x5d1786[_0xa66b('0x32')]));_0x5d1786['text']=_0x5d1786[_0xa66b('0x5a')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa66b('0x83')](_0x5d1786[_0xa66b('0x59')])){return this[_0xa66b('0xd')][_0xa66b('0xa7')](_0xa66b('0x1a4'));}if(!this[_0xa66b('0x83')](_0x5d1786[_0xa66b('0x5a')])){return this[_0xa66b('0xd')][_0xa66b('0xa7')]('no\x20text\x20configured');}this['channel'][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0x1a5'),_0x5d1786[_0xa66b('0x5a')]));var _0x3a2129=this[_0xa66b('0x58')][_0xa66b('0x70')](this,_0x5d1786);if(_0x3a2129){this['channel']['noop'](util[_0xa66b('0x25')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x3a2129));var _0x42df94=this[_0xa66b('0xd')]['streamFile'](_0x3a2129);try{fs[_0xa66b('0xf6')](_0x3a2129+'.wav');}catch(_0x2ee93b){logger['error'](_0x2ee93b);}return _0x42df94;}return this[_0xa66b('0xd')]['error'](_0x5d1786,_0xa66b('0x1a6'));};AGIVertices[_0xa66b('0xf')][_0xa66b('0x1a7')]=function(_0xed5c41){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x1a8'),_0xed5c41[_0xa66b('0x32')]));_0xed5c41['text']=_0xed5c41[_0xa66b('0x5a')][_0xa66b('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa66b('0x83')](_0xed5c41[_0xa66b('0x5a')])){return this[_0xa66b('0xd')][_0xa66b('0xa7')](_0xa66b('0xa8'));}this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')]('Trying\x20Google\x20TTS\x20%s',_0xed5c41[_0xa66b('0x5a')]));var _0xa6813b=this[_0xa66b('0x5f')][_0xa66b('0x70')](this,_0xed5c41);if(_0xa6813b){this['channel'][_0xa66b('0xa7')](util[_0xa66b('0x25')]('Google\x20TTS\x20%s\x20file\x20created',_0xa6813b));var _0x4471eb=this[_0xa66b('0xd')][_0xa66b('0xf5')](_0xa6813b);try{fs[_0xa66b('0xf6')](_0xa6813b+_0xa66b('0xf7'));}catch(_0x30dd13){logger[_0xa66b('0x51')](_0x30dd13);}return _0x4471eb;}return this[_0xa66b('0xd')]['error'](_0xed5c41,_0xa66b('0x1a9'));};AGIVertices['prototype'][_0xa66b('0x1aa')]=function(_0x658506){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x1ab'),_0x658506['label']));if(!this[_0xa66b('0x83')](_0x658506[_0xa66b('0x14b')])){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x658506,_0xa66b('0x149'));}logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x14a'),this[_0xa66b('0xd')][_0xa66b('0x37')],_0x658506['findBy']));var _0x199cb4=this['agentUnpause'][_0xa66b('0x70')](this,_0x658506[_0xa66b('0x14b')]);if(_0x199cb4){logger[_0xa66b('0x28')](util[_0xa66b('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa66b('0xd')]['callerid'],_0x658506[_0xa66b('0x14b')]));this[_0xa66b('0xd')][_0xa66b('0xa7')](util[_0xa66b('0x25')](_0xa66b('0x14c'),this[_0xa66b('0xd')][_0xa66b('0x37')],_0x658506[_0xa66b('0x14b')]));return{'code':0xc8,'result':_0xa66b('0x14d')};}else{logger['info'](util[_0xa66b('0x25')](_0xa66b('0x14e'),this[_0xa66b('0xd')][_0xa66b('0x37')],_0x658506[_0xa66b('0x14b')]));this[_0xa66b('0xd')][_0xa66b('0xa7')](util['format'](_0xa66b('0x14e'),this[_0xa66b('0xd')][_0xa66b('0x37')],_0x658506[_0xa66b('0x14b')]));return{'code':0xc8,'result':_0xa66b('0x14f')};}};AGIVertices[_0xa66b('0xf')]['voicemail']=function(_0x3702c8){logger[_0xa66b('0x28')](util[_0xa66b('0x25')](_0xa66b('0x1ac'),_0x3702c8[_0xa66b('0x32')]));var _0x1c193c=this[_0xa66b('0xd')][_0xa66b('0xa9')](_0xa66b('0x1ad'),[_0x3702c8[_0xa66b('0x1ae')],_0x3702c8[_0xa66b('0x79')]]);if(_0x1c193c[_0xa66b('0xa0')]===-0x1){return _0x1c193c;}return this['channel'][_0xa66b('0xa7')](util['format']('Executed\x20command\x20%s\x20%s',_0xa66b('0x1ad'),_0x3702c8[_0xa66b('0x1ae')]));};AGIVertices[_0xa66b('0xf')][_0xa66b('0x1af')]=function(_0x136094){logger['info'](util[_0xa66b('0x25')](_0xa66b('0x1b0'),_0x136094['label']));if(!this[_0xa66b('0x83')](_0x136094['variable_id'])){return this[_0xa66b('0xd')][_0xa66b('0x51')](_0x136094,'no\x20variable\x20selected');}var _0x470e2f=this['getVariable'][_0xa66b('0x70')](this,_0x136094[_0xa66b('0xd2')]);if(!_0x470e2f){return this[_0xa66b('0xd')]['error'](_0x136094,_0xa66b('0x158'));}var _0x26bca8=this[_0xa66b('0xd')]['getVariable'](_0x470e2f);return{'code':0xc8,'result':_0x26bca8[_0xa66b('0xa2')]?_0x26bca8[_0xa66b('0xa2')]:'-'};};String[_0xa66b('0xf')][_0xa66b('0x9e')]=function(_0x419eb2,_0x16be6d){return this[_0xa66b('0x9d')](_0x419eb2)[_0xa66b('0x1b1')](_0x16be6d);};module[_0xa66b('0x1b2')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index b5ab5d3..3906775 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 _0x0e85=['[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','uniqueid','queue','updateAcw','update','catch','error','[%s][UPDATE][ERRORS:%s]','[ACW][START]\x20%s','prototype','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','message','acw','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','linkedid','isUndefined','attended','[%s][HANGUP:LINKEDID]','startAcw','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','transfereeuniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../ami','../../../config/logger','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','milliseconds','diff','seconds','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','Action','QueuePause','then','voicePause','info','destlinkedid','savePause'];(function(_0x2da228,_0x392b3f){var _0x5514fc=function(_0xcc801c){while(--_0xcc801c){_0x2da228['push'](_0x2da228['shift']());}};_0x5514fc(++_0x392b3f);}(_0x0e85,0x7c));var _0x50e8=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x0e85[_0x25e7cb];return _0x375d92;};'use strict';var util=require(_0x50e8('0x0'));var _=require(_0x50e8('0x1'));var moment=require('moment');var ami=require(_0x50e8('0x2'));var logger=require(_0x50e8('0x3'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x236cf3){this['voiceQueues']=_0x236cf3[_0x50e8('0x4')];this[_0x50e8('0x5')]=_0x236cf3[_0x50e8('0x5')];this[_0x50e8('0x6')]=_0x236cf3['timers'];this[_0x50e8('0x7')]={};ami['on'](_0x50e8('0x8'),this[_0x50e8('0x9')][_0x50e8('0xa')](this));ami['on'](_0x50e8('0xb'),this[_0x50e8('0xc')]['bind'](this));ami['on'](_0x50e8('0xd'),this[_0x50e8('0xe')][_0x50e8('0xa')](this));ami['on'](_0x50e8('0xf'),this[_0x50e8('0x10')][_0x50e8('0xa')](this));ami['on'](_0x50e8('0x11'),this[_0x50e8('0x12')]['bind'](this));ami['on']('blindtransfer',this[_0x50e8('0x13')][_0x50e8('0xa')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0x50e8('0xa')](this));}function getDiff(_0x2abda1){var _0x1a4c85=moment()[_0x50e8('0x14')](0x0);var _0x54efd3=moment(_0x2abda1)[_0x50e8('0x14')](0x0);return _0x1a4c85[_0x50e8('0x15')](_0x54efd3,_0x50e8('0x16'));}Acw['prototype']['startAcw']=function(_0x30a872){try{var _0xf02b48=this;var _0x40c184=this[_0x50e8('0x7')][_0x30a872][_0x50e8('0x17')];var _0x1f0338=this['channels'][_0x30a872]['queue'];var _0x441f25=this[_0x50e8('0x4')][_0x1f0338];var _0x40d060=![];var _0x45ce11=_0x50e8('0x18');if(_0x441f25[_0x50e8('0x19')]){if(_0x441f25[_0x50e8('0x1a')]['name']){_0x40d060=!![];_0x45ce11=_0x441f25[_0x50e8('0x1a')]['name'];}}ami[_0x50e8('0x1b')]({'action':_0x50e8('0x1c'),'interface':_0x40c184,'paused':!![],'reason':_0x45ce11})[_0x50e8('0x1d')](function(_0x20f835){if(_0xf02b48[_0x50e8('0x5')][_0x40c184]){return RpcUser['getAgent'](_0xf02b48[_0x50e8('0x5')][_0x40c184]['id'])[_0x50e8('0x1d')](function(_0x58110d){if(_0x58110d&&!_0x58110d[_0x50e8('0x1e')]){logger[_0x50e8('0x1f')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x30a872,_0x40c184,_0x1f0338);var _0x1ce7fc=_0xf02b48[_0x50e8('0x7')][_0x30a872]['attended']&&_0xf02b48['channels'][_0x30a872]['destlinkedid']?_0xf02b48[_0x50e8('0x7')][_0x30a872][_0x50e8('0x20')]:_0x30a872;return RpcUser[_0x50e8('0x21')](_0xf02b48[_0x50e8('0x5')][_0x40c184],_0x45ce11,_0x1ce7fc)[_0x50e8('0x1d')](function(_0x13b6e9){if(!_0x40d060){_0xf02b48['timers'][_0x40c184]={};logger[_0x50e8('0x1f')](_0x50e8('0x22'),_0x30a872,_0xf02b48['voiceQueues'][_0x1f0338][_0x50e8('0x23')],_0x40c184,_0x1f0338);_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x24')]=setTimeout(_0xf02b48[_0x50e8('0x25')]['bind'](_0xf02b48,_0x40c184),_0xf02b48[_0x50e8('0x4')][_0x1f0338]['acwTimeout']*0x3e8);_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x26')]=moment()[_0x50e8('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x28')]=_0x30a872;_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x29')]=_0x1f0338;_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x2a')]=function(){var _0x2c6fb3=getDiff(_0xf02b48['timers'][_0x40c184][_0x50e8('0x26')]);clearTimeout(_0xf02b48[_0x50e8('0x6')][_0x40c184]['timer']);_0xf02b48['timers'][_0x40c184][_0x50e8('0x24')]=![];RpcVoiceAgentReport[_0x50e8('0x2b')]({'acwtime':_0x2c6fb3},_0xf02b48[_0x50e8('0x6')][_0x40c184]['uniqueid'],_0x40c184)['then'](function(_0x3e58a9){logger[_0x50e8('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x30a872,_0x2c6fb3,_0x3e58a9);})[_0x50e8('0x2c')](function(_0x17c6a5){logger[_0x50e8('0x2d')](_0x50e8('0x2e'),_0x30a872,_0x17c6a5);});delete _0xf02b48['timers'][_0x40c184];};}});}else{logger[_0x50e8('0x1f')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x30a872,_0x40c184,_0x1f0338);}});}})[_0x50e8('0x2c')](function(_0x33fc5b){logger[_0x50e8('0x2d')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x30a872,_0xf02b48[_0x50e8('0x4')][_0x1f0338][_0x50e8('0x23')],_0x40c184,_0x1f0338);})['finally'](function(){delete _0xf02b48[_0x50e8('0x7')][_0x30a872];});}catch(_0x1c2fdb){logger[_0x50e8('0x2d')](_0x50e8('0x2f'),_0x1c2fdb['message']);}};Acw[_0x50e8('0x30')][_0x50e8('0x25')]=function(_0x24d3ea){try{var _0x4e2a37=this;if(_0x4e2a37['timers'][_0x24d3ea]){_0x4e2a37[_0x50e8('0x6')][_0x24d3ea][_0x50e8('0x24')]=![];var _0x3f01ee=_0x4e2a37['timers'][_0x24d3ea]['uniqueid'];var _0x5dff99=_0x4e2a37[_0x50e8('0x6')][_0x24d3ea][_0x50e8('0x29')];var _0x2cbee3=_0x4e2a37[_0x50e8('0x4')][_0x5dff99][_0x50e8('0x23')];logger[_0x50e8('0x1f')](_0x50e8('0x31'),_0x24d3ea);RpcUser[_0x50e8('0x32')](this[_0x50e8('0x5')][_0x24d3ea]);RpcVoiceAgentReport[_0x50e8('0x2b')]({'acwtime':_0x2cbee3,'agentacw':!![]},_0x3f01ee,_0x24d3ea)['then'](function(_0x3371a4){logger[_0x50e8('0x1f')](_0x50e8('0x33'),_0x3f01ee,_0x2cbee3,_0x3371a4);})[_0x50e8('0x2c')](function(_0x5dbbe1){logger[_0x50e8('0x2d')](_0x50e8('0x2e'),_0x3f01ee,_0x5dbbe1);});}else{logger[_0x50e8('0x2d')](_0x50e8('0x34'),_0x24d3ea);if(_0x4e2a37[_0x50e8('0x6')]){logger['info']('[ACW][TIMERS]',JSON[_0x50e8('0x35')](_0x4e2a37[_0x50e8('0x6')]));}}}catch(_0x53705e){logger[_0x50e8('0x2d')](_0x50e8('0x36'),_0x53705e[_0x50e8('0x37')]);}};Acw[_0x50e8('0x30')][_0x50e8('0x9')]=function(_0x313e7b){try{if(this[_0x50e8('0x4')][_0x313e7b[_0x50e8('0x29')]]&&(this['voiceQueues'][_0x313e7b[_0x50e8('0x29')]][_0x50e8('0x38')]||this[_0x50e8('0x4')][_0x313e7b[_0x50e8('0x29')]]['mandatoryDisposition'])){if(this[_0x50e8('0x5')][_0x313e7b[_0x50e8('0x17')]]){this[_0x50e8('0x7')][_0x313e7b[_0x50e8('0x28')]]={'queue':_0x313e7b['queue'],'interface':_0x313e7b[_0x50e8('0x17')],'destlinkedid':_0x313e7b['destlinkedid']};}}}catch(_0x4a2619){logger['error'](_0x50e8('0x39'),_0x4a2619[_0x50e8('0x37')]);}};Acw['prototype'][_0x50e8('0x3a')]=function(_0x2007c4){try{if(this[_0x50e8('0x4')][_0x2007c4[_0x50e8('0x29')]]&&(this[_0x50e8('0x4')][_0x2007c4[_0x50e8('0x29')]]['acw']||this[_0x50e8('0x4')][_0x2007c4['queue']][_0x50e8('0x19')])){if(this[_0x50e8('0x5')][_0x2007c4['interface']]){this[_0x50e8('0x7')][_0x2007c4['uniqueid']]={'queue':_0x2007c4[_0x50e8('0x29')],'interface':_0x2007c4[_0x50e8('0x17')]};}}}catch(_0x2e55ed){logger[_0x50e8('0x2d')](_0x50e8('0x3b'),_0x2e55ed[_0x50e8('0x37')]);}};Acw[_0x50e8('0x30')][_0x50e8('0xc')]=function(_0x141bd4){try{if(this[_0x50e8('0x7')][_0x141bd4[_0x50e8('0x28')]]&&_['isUndefined'](this[_0x50e8('0x7')][_0x141bd4[_0x50e8('0x28')]]['attended'])){logger[_0x50e8('0x1f')]('[%s][HANGUP:UNIQUEID]',_0x141bd4[_0x50e8('0x28')]);this['startAcw'](_0x141bd4[_0x50e8('0x28')]);}else if(this[_0x50e8('0x7')][_0x141bd4[_0x50e8('0x3c')]]&&_[_0x50e8('0x3d')](this[_0x50e8('0x7')][_0x141bd4[_0x50e8('0x3c')]][_0x50e8('0x3e')])){logger['info'](_0x50e8('0x3f'),_0x141bd4[_0x50e8('0x3c')]);this[_0x50e8('0x40')](_0x141bd4[_0x50e8('0x3c')]);}}catch(_0x3303f5){logger[_0x50e8('0x2d')]('[ACW][syncHangupRequest]\x20%s',_0x3303f5[_0x50e8('0x37')]);}};Acw[_0x50e8('0x30')][_0x50e8('0xe')]=function(_0x27c80a){try{if(this['channels'][_0x27c80a[_0x50e8('0x28')]]&&this[_0x50e8('0x7')][_0x27c80a[_0x50e8('0x28')]][_0x50e8('0x3e')]){logger[_0x50e8('0x1f')](_0x50e8('0x41'),_0x27c80a[_0x50e8('0x28')]);this['startAcw'](_0x27c80a['uniqueid']);}else if(this['channels'][_0x27c80a[_0x50e8('0x3c')]]&&this[_0x50e8('0x7')][_0x27c80a[_0x50e8('0x3c')]][_0x50e8('0x3e')]){logger[_0x50e8('0x1f')](_0x50e8('0x42'),_0x27c80a['linkedid']);this[_0x50e8('0x40')](_0x27c80a[_0x50e8('0x3c')]);}}catch(_0x460c8e){logger[_0x50e8('0x2d')]('[ACW][syncHangup]\x20%s',_0x460c8e[_0x50e8('0x37')]);}};Acw[_0x50e8('0x30')][_0x50e8('0x12')]=function(_0x1cc5ba){try{if(!_[_0x50e8('0x43')](this[_0x50e8('0x7')][_0x1cc5ba['transfereeuniqueid']])){this[_0x50e8('0x40')](_0x1cc5ba['transfereeuniqueid']);if(this['channels'][_0x1cc5ba['secondtransfereruniqueid']]){this[_0x50e8('0x7')][_0x1cc5ba['secondtransfereruniqueid']][_0x50e8('0x3e')]=!![];this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x44')]]=this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x45')]];delete this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x45')]];}}else if(!_['isNil'](this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x44')]])){this[_0x50e8('0x40')](_0x1cc5ba['transfertargetuniqueid']);if(this['channels'][_0x1cc5ba['origtransfereruniqueid']]){this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x46')]][_0x50e8('0x3e')]=!![];this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x47')]]=this[_0x50e8('0x7')][_0x1cc5ba['origtransfereruniqueid']];delete this[_0x50e8('0x7')][_0x1cc5ba['origtransfereruniqueid']];}}}catch(_0x255b48){logger[_0x50e8('0x2d')]('[ACW][syncAttendedTransfer]\x20%s',_0x255b48['message']);}};Acw['prototype'][_0x50e8('0x13')]=function(_0x3588f0){try{if(this['channels'][_0x3588f0[_0x50e8('0x48')]]){logger[_0x50e8('0x1f')](_0x50e8('0x49'),JSON[_0x50e8('0x35')](_0x3588f0[_0x50e8('0x48')]));this['startAcw'](_0x3588f0[_0x50e8('0x48')]);}else if(this[_0x50e8('0x7')][_0x3588f0[_0x50e8('0x4a')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x50e8('0x35')](_0x3588f0[_0x50e8('0x4a')]));this[_0x50e8('0x40')](_0x3588f0[_0x50e8('0x4a')]);}}catch(_0x2b59f5){logger[_0x50e8('0x2d')]('[ACW][syncBlindTransfer]\x20%s',_0x2b59f5['message']);}};Acw[_0x50e8('0x30')]['syncAgentRingNoAnswer']=function(_0x1fc530){try{if(this[_0x50e8('0x4')][_0x1fc530['queue']]&&this[_0x50e8('0x4')][_0x1fc530['queue']]['autopause']==='all'){if(this[_0x50e8('0x5')][_0x1fc530[_0x50e8('0x17')]]){logger[_0x50e8('0x1f')](_0x50e8('0x4b'),_0x1fc530['uniqueid'],_0x1fc530['interface'],_0x1fc530[_0x50e8('0x29')]);return RpcUser[_0x50e8('0x21')](this[_0x50e8('0x5')][_0x1fc530[_0x50e8('0x17')]],_0x50e8('0x4c'),_0x1fc530[_0x50e8('0x28')]);}}}catch(_0x42e1dd){logger[_0x50e8('0x2d')](_0x50e8('0x4d'),_0x42e1dd[_0x50e8('0x37')]);}};module[_0x50e8('0x4e')]=Acw; \ No newline at end of file +var _0xda55=['[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','info','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','timer','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]'];(function(_0x10791d,_0x2562b6){var _0x1b4f9c=function(_0x3b2815){while(--_0x3b2815){_0x10791d['push'](_0x10791d['shift']());}};_0x1b4f9c(++_0x2562b6);}(_0xda55,0x6d));var _0x5da5=function(_0x401b8e,_0x334bb2){_0x401b8e=_0x401b8e-0x0;var _0x533f3e=_0xda55[_0x401b8e];return _0x533f3e;};'use strict';var util=require(_0x5da5('0x0'));var _=require(_0x5da5('0x1'));var moment=require('moment');var ami=require('../ami');var logger=require(_0x5da5('0x2'))(_0x5da5('0x3'));var RpcUser=require(_0x5da5('0x4'));var RpcVoiceAgentReport=require(_0x5da5('0x5'));function Acw(_0x1c3afd){this['voiceQueues']=_0x1c3afd[_0x5da5('0x6')];this['agents']=_0x1c3afd[_0x5da5('0x7')];this['timers']=_0x1c3afd[_0x5da5('0x8')];this[_0x5da5('0x9')]={};ami['on'](_0x5da5('0xa'),this[_0x5da5('0xb')][_0x5da5('0xc')](this));ami['on'](_0x5da5('0xd'),this[_0x5da5('0xe')][_0x5da5('0xc')](this));ami['on']('hangup',this[_0x5da5('0xf')][_0x5da5('0xc')](this));ami['on'](_0x5da5('0x10'),this[_0x5da5('0x11')][_0x5da5('0xc')](this));ami['on'](_0x5da5('0x12'),this[_0x5da5('0x13')]['bind'](this));ami['on'](_0x5da5('0x14'),this[_0x5da5('0x15')]['bind'](this));ami['on'](_0x5da5('0x16'),this[_0x5da5('0x17')][_0x5da5('0xc')](this));}function getDiff(_0x43d526){var _0x1877d4=moment()[_0x5da5('0x18')](0x0);var _0x481562=moment(_0x43d526)['milliseconds'](0x0);return _0x1877d4['diff'](_0x481562,_0x5da5('0x19'));}Acw[_0x5da5('0x1a')][_0x5da5('0x1b')]=function(_0x665ce8){try{var _0x11bd3=this;var _0x134afa=this[_0x5da5('0x9')][_0x665ce8]['interface'];var _0x124dc5=this[_0x5da5('0x9')][_0x665ce8][_0x5da5('0x1c')];var _0x16b11f=this[_0x5da5('0x6')][_0x124dc5];var _0x428b07=![];var _0x547c58=_0x5da5('0x1d');if(_0x16b11f[_0x5da5('0x1e')]){if(_0x16b11f[_0x5da5('0x1f')][_0x5da5('0x20')]){_0x428b07=!![];_0x547c58=_0x16b11f[_0x5da5('0x1f')]['name'];}}ami[_0x5da5('0x21')]({'action':_0x5da5('0x22'),'interface':_0x134afa,'paused':!![],'reason':_0x547c58})[_0x5da5('0x23')](function(_0x560ea7){if(_0x11bd3[_0x5da5('0x7')][_0x134afa]){return RpcUser[_0x5da5('0x24')](_0x11bd3[_0x5da5('0x7')][_0x134afa]['id'])[_0x5da5('0x23')](function(_0xec69f2){if(_0xec69f2&&!_0xec69f2[_0x5da5('0x25')]){logger['info'](_0x5da5('0x26'),_0x665ce8,_0x134afa,_0x124dc5);var _0x568ddf=_0x11bd3[_0x5da5('0x9')][_0x665ce8][_0x5da5('0x27')]&&_0x11bd3[_0x5da5('0x9')][_0x665ce8]['destlinkedid']?_0x11bd3[_0x5da5('0x9')][_0x665ce8][_0x5da5('0x28')]:_0x665ce8;return RpcUser[_0x5da5('0x29')](_0x11bd3[_0x5da5('0x7')][_0x134afa],_0x547c58,_0x568ddf)['then'](function(_0x5b0b43){if(!_0x428b07){_0x11bd3['timers'][_0x134afa]={};logger[_0x5da5('0x2a')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x665ce8,_0x11bd3['voiceQueues'][_0x124dc5][_0x5da5('0x2b')],_0x134afa,_0x124dc5);_0x11bd3[_0x5da5('0x8')][_0x134afa]['timer']=setTimeout(_0x11bd3[_0x5da5('0x2c')][_0x5da5('0xc')](_0x11bd3,_0x134afa),_0x11bd3['voiceQueues'][_0x124dc5][_0x5da5('0x2b')]*0x3e8);_0x11bd3[_0x5da5('0x8')][_0x134afa][_0x5da5('0x2d')]=moment()[_0x5da5('0x2e')](_0x5da5('0x2f'));_0x11bd3['timers'][_0x134afa][_0x5da5('0x30')]=_0x665ce8;_0x11bd3[_0x5da5('0x8')][_0x134afa][_0x5da5('0x1c')]=_0x124dc5;_0x11bd3[_0x5da5('0x8')][_0x134afa]['updateAcw']=function(){var _0x5ee7f2=getDiff(_0x11bd3['timers'][_0x134afa][_0x5da5('0x2d')]);clearTimeout(_0x11bd3[_0x5da5('0x8')][_0x134afa][_0x5da5('0x31')]);_0x11bd3[_0x5da5('0x8')][_0x134afa]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x5ee7f2},_0x11bd3[_0x5da5('0x8')][_0x134afa]['uniqueid'],_0x134afa)['then'](function(_0x2dd4b6){logger['info'](_0x5da5('0x32'),_0x665ce8,_0x5ee7f2,_0x2dd4b6);})[_0x5da5('0x33')](function(_0x33f138){logger[_0x5da5('0x34')](_0x5da5('0x35'),_0x665ce8,_0x33f138);});delete _0x11bd3[_0x5da5('0x8')][_0x134afa];};}});}else{logger[_0x5da5('0x2a')](_0x5da5('0x36'),_0x665ce8,_0x134afa,_0x124dc5);}});}})['catch'](function(_0x231e8c){logger['error'](_0x5da5('0x37'),_0x665ce8,_0x11bd3[_0x5da5('0x6')][_0x124dc5][_0x5da5('0x2b')],_0x134afa,_0x124dc5);})[_0x5da5('0x38')](function(){delete _0x11bd3[_0x5da5('0x9')][_0x665ce8];});}catch(_0x9aba42){logger[_0x5da5('0x34')](_0x5da5('0x39'),_0x9aba42[_0x5da5('0x3a')]);}};Acw[_0x5da5('0x1a')][_0x5da5('0x2c')]=function(_0x33429f){try{var _0x3ba804=this;if(_0x3ba804['timers'][_0x33429f]){_0x3ba804[_0x5da5('0x8')][_0x33429f]['timer']=![];var _0x2d6280=_0x3ba804[_0x5da5('0x8')][_0x33429f][_0x5da5('0x30')];var _0x24842c=_0x3ba804['timers'][_0x33429f][_0x5da5('0x1c')];var _0x2f2596=_0x3ba804[_0x5da5('0x6')][_0x24842c]['acwTimeout'];logger[_0x5da5('0x2a')](_0x5da5('0x3b'),_0x33429f);RpcUser['saveUnpause'](this[_0x5da5('0x7')][_0x33429f]);RpcVoiceAgentReport[_0x5da5('0x3c')]({'acwtime':_0x2f2596,'agentacw':!![]},_0x2d6280,_0x33429f)[_0x5da5('0x23')](function(_0x38a974){logger[_0x5da5('0x2a')](_0x5da5('0x32'),_0x2d6280,_0x2f2596,_0x38a974);})['catch'](function(_0x1ab02){logger[_0x5da5('0x34')](_0x5da5('0x35'),_0x2d6280,_0x1ab02);});}else{logger[_0x5da5('0x34')](_0x5da5('0x3d'),_0x33429f);if(_0x3ba804['timers']){logger[_0x5da5('0x2a')](_0x5da5('0x3e'),JSON['stringify'](_0x3ba804[_0x5da5('0x8')]));}}}catch(_0x5643e7){logger['error'](_0x5da5('0x3f'),_0x5643e7[_0x5da5('0x3a')]);}};Acw[_0x5da5('0x1a')][_0x5da5('0xb')]=function(_0x52b618){try{if(this[_0x5da5('0x6')][_0x52b618[_0x5da5('0x1c')]]&&(this[_0x5da5('0x6')][_0x52b618[_0x5da5('0x1c')]][_0x5da5('0x3')]||this[_0x5da5('0x6')][_0x52b618[_0x5da5('0x1c')]][_0x5da5('0x1e')])){if(this[_0x5da5('0x7')][_0x52b618[_0x5da5('0x40')]]){this[_0x5da5('0x9')][_0x52b618[_0x5da5('0x30')]]={'queue':_0x52b618[_0x5da5('0x1c')],'interface':_0x52b618[_0x5da5('0x40')],'destlinkedid':_0x52b618[_0x5da5('0x28')]};}}}catch(_0x59acfe){logger['error'](_0x5da5('0x41'),_0x59acfe[_0x5da5('0x3a')]);}};Acw['prototype'][_0x5da5('0x17')]=function(_0x1a188b){try{if(this[_0x5da5('0x6')][_0x1a188b[_0x5da5('0x1c')]]&&(this[_0x5da5('0x6')][_0x1a188b[_0x5da5('0x1c')]][_0x5da5('0x3')]||this[_0x5da5('0x6')][_0x1a188b[_0x5da5('0x1c')]][_0x5da5('0x1e')])){if(this['agents'][_0x1a188b[_0x5da5('0x40')]]){this['channels'][_0x1a188b['uniqueid']]={'queue':_0x1a188b[_0x5da5('0x1c')],'interface':_0x1a188b[_0x5da5('0x40')]};}}}catch(_0x455caf){logger[_0x5da5('0x34')](_0x5da5('0x42'),_0x455caf[_0x5da5('0x3a')]);}};Acw['prototype'][_0x5da5('0xe')]=function(_0x536ca2){try{if(this['channels'][_0x536ca2[_0x5da5('0x30')]]&&_[_0x5da5('0x43')](this['channels'][_0x536ca2[_0x5da5('0x30')]][_0x5da5('0x27')])){logger[_0x5da5('0x2a')](_0x5da5('0x44'),_0x536ca2[_0x5da5('0x30')]);this['startAcw'](_0x536ca2[_0x5da5('0x30')]);}else if(this['channels'][_0x536ca2['linkedid']]&&_[_0x5da5('0x43')](this['channels'][_0x536ca2[_0x5da5('0x45')]][_0x5da5('0x27')])){logger[_0x5da5('0x2a')](_0x5da5('0x46'),_0x536ca2[_0x5da5('0x45')]);this[_0x5da5('0x1b')](_0x536ca2['linkedid']);}}catch(_0x5cb8d8){logger[_0x5da5('0x34')](_0x5da5('0x47'),_0x5cb8d8['message']);}};Acw['prototype'][_0x5da5('0xf')]=function(_0x4c1321){try{if(this[_0x5da5('0x9')][_0x4c1321['uniqueid']]&&this['channels'][_0x4c1321[_0x5da5('0x30')]][_0x5da5('0x27')]){logger[_0x5da5('0x2a')](_0x5da5('0x48'),_0x4c1321['uniqueid']);this[_0x5da5('0x1b')](_0x4c1321[_0x5da5('0x30')]);}else if(this[_0x5da5('0x9')][_0x4c1321['linkedid']]&&this[_0x5da5('0x9')][_0x4c1321[_0x5da5('0x45')]][_0x5da5('0x27')]){logger[_0x5da5('0x2a')](_0x5da5('0x49'),_0x4c1321[_0x5da5('0x45')]);this[_0x5da5('0x1b')](_0x4c1321[_0x5da5('0x45')]);}}catch(_0x3d1a54){logger[_0x5da5('0x34')](_0x5da5('0x4a'),_0x3d1a54[_0x5da5('0x3a')]);}};Acw[_0x5da5('0x1a')][_0x5da5('0x13')]=function(_0xb3a0b0){try{if(!_[_0x5da5('0x4b')](this[_0x5da5('0x9')][_0xb3a0b0[_0x5da5('0x4c')]])){this[_0x5da5('0x1b')](_0xb3a0b0[_0x5da5('0x4c')]);if(this[_0x5da5('0x9')][_0xb3a0b0['secondtransfereruniqueid']]){this[_0x5da5('0x9')][_0xb3a0b0[_0x5da5('0x4d')]]['attended']=!![];this['channels'][_0xb3a0b0['transfertargetuniqueid']]=this[_0x5da5('0x9')][_0xb3a0b0[_0x5da5('0x4d')]];delete this[_0x5da5('0x9')][_0xb3a0b0['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0x5da5('0x9')][_0xb3a0b0[_0x5da5('0x4e')]])){this[_0x5da5('0x1b')](_0xb3a0b0[_0x5da5('0x4e')]);if(this['channels'][_0xb3a0b0[_0x5da5('0x4f')]]){this[_0x5da5('0x9')][_0xb3a0b0[_0x5da5('0x4f')]]['attended']=!![];this[_0x5da5('0x9')][_0xb3a0b0['transfereeuniqueid']]=this[_0x5da5('0x9')][_0xb3a0b0[_0x5da5('0x4f')]];delete this[_0x5da5('0x9')][_0xb3a0b0[_0x5da5('0x4f')]];}}}catch(_0x12c983){logger[_0x5da5('0x34')](_0x5da5('0x50'),_0x12c983[_0x5da5('0x3a')]);}};Acw[_0x5da5('0x1a')][_0x5da5('0x15')]=function(_0x2f9f72){try{if(this[_0x5da5('0x9')][_0x2f9f72[_0x5da5('0x51')]]){logger[_0x5da5('0x2a')](_0x5da5('0x52'),JSON[_0x5da5('0x53')](_0x2f9f72[_0x5da5('0x51')]));this[_0x5da5('0x1b')](_0x2f9f72[_0x5da5('0x51')]);}else if(this[_0x5da5('0x9')][_0x2f9f72[_0x5da5('0x54')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x5da5('0x53')](_0x2f9f72[_0x5da5('0x54')]));this[_0x5da5('0x1b')](_0x2f9f72['transfererlinkedid']);}}catch(_0x2ca7b9){logger[_0x5da5('0x34')](_0x5da5('0x55'),_0x2ca7b9[_0x5da5('0x3a')]);}};Acw['prototype'][_0x5da5('0x11')]=function(_0x5f3753){try{if(this[_0x5da5('0x6')][_0x5f3753[_0x5da5('0x1c')]]&&this[_0x5da5('0x6')][_0x5f3753[_0x5da5('0x1c')]][_0x5da5('0x56')]===_0x5da5('0x57')){if(this[_0x5da5('0x7')][_0x5f3753['interface']]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x5f3753[_0x5da5('0x30')],_0x5f3753[_0x5da5('0x40')],_0x5f3753[_0x5da5('0x1c')]);return RpcUser[_0x5da5('0x29')](this[_0x5da5('0x7')][_0x5f3753[_0x5da5('0x40')]],_0x5da5('0x58'),_0x5f3753[_0x5da5('0x30')]);}}}catch(_0x5f4529){logger[_0x5da5('0x34')](_0x5da5('0x59'),_0x5f4529['message']);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 93e6b34..9bad45d 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 _0xe436=['username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','catch','log','exports','bluebird','moment','../../config/logger','ami','port','asterisk'];(function(_0x2fc8f8,_0x2cc28d){var _0x52497b=function(_0x14f72e){while(--_0x14f72e){_0x2fc8f8['push'](_0x2fc8f8['shift']());}};_0x52497b(++_0x2cc28d);}(_0xe436,0x69));var _0x6e43=function(_0x3b3df7,_0x1c156e){_0x3b3df7=_0x3b3df7-0x0;var _0x18007a=_0xe436[_0x3b3df7];return _0x18007a;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x6e43('0x0'));var moment=require(_0x6e43('0x1'));var util=require('util');var _=require('lodash');var logger=require(_0x6e43('0x2'))(_0x6e43('0x3'));var config=require('../../config/environment');var ami=new Manager(config['asterisk'][_0x6e43('0x4')],config[_0x6e43('0x5')]['ip'],config[_0x6e43('0x5')][_0x6e43('0x6')],config[_0x6e43('0x5')][_0x6e43('0x7')],!![]);ami[_0x6e43('0x8')]();ami[_0x6e43('0x9')]=BPromise[_0x6e43('0xa')](ami[_0x6e43('0xb')]);function error(_0x152f2b){logger[_0x6e43('0xc')](util[_0x6e43('0xd')](_0x6e43('0xe'),config[_0x6e43('0x5')][_0x6e43('0x6')],config[_0x6e43('0x5')]['ip'],config[_0x6e43('0x5')][_0x6e43('0x4')],util[_0x6e43('0xf')](_0x152f2b,![],null)));}function close(){logger[_0x6e43('0xc')](util[_0x6e43('0xd')](_0x6e43('0x10'),config['asterisk'][_0x6e43('0x6')],config['asterisk']['ip'],config[_0x6e43('0x5')][_0x6e43('0x4')]));}ami[_0x6e43('0x11')]=function(){return function(){return ami[_0x6e43('0x9')]({'action':_0x6e43('0x12')});};};ami[_0x6e43('0x13')]=function(){return function(){return ami[_0x6e43('0x9')]({'action':_0x6e43('0x14')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0x6e43('0x15')});};};ami[_0x6e43('0x16')]=function(){return function(){return ami[_0x6e43('0x9')]({'action':_0x6e43('0x17')});};};ami[_0x6e43('0x18')]=function(){return function(){return ami[_0x6e43('0x9')]({'action':_0x6e43('0x19')});};};function connect(_0xa5fa56){logger[_0x6e43('0x1a')](util[_0x6e43('0xd')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x6e43('0x5')][_0x6e43('0x6')],config[_0x6e43('0x5')]['ip'],config['asterisk']['port']));ami[_0x6e43('0x1b')]('error',error);ami[_0x6e43('0x1b')](_0x6e43('0x1c'),close);}ami['on'](_0x6e43('0x1d'),connect);ami['on']('shutdown',function(_0x18b7a6){logger[_0x6e43('0x1a')](util[_0x6e43('0xd')](_0x6e43('0x1e'),config[_0x6e43('0x5')][_0x6e43('0x6')],config[_0x6e43('0x5')]['ip'],config[_0x6e43('0x5')][_0x6e43('0x4')],util['inspect'](_0x18b7a6,![],null)));});ami['on'](_0x6e43('0x1f'),function(_0x30cbe4){logger[_0x6e43('0x1a')](util[_0x6e43('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x6e43('0x5')]['username'],config[_0x6e43('0x5')]['ip'],config[_0x6e43('0x5')][_0x6e43('0x4')]));return BPromise[_0x6e43('0x20')]()[_0x6e43('0x21')](ami[_0x6e43('0x11')]())['then'](ami[_0x6e43('0x13')]())[_0x6e43('0x21')](ami['actionSipPeerStatus']())[_0x6e43('0x21')](ami[_0x6e43('0x16')]())[_0x6e43('0x21')](ami[_0x6e43('0x18')]())[_0x6e43('0x22')](function(_0x289164){console[_0x6e43('0x23')](_0x289164);});});ami[_0x6e43('0x1b')]('error',error);ami[_0x6e43('0x1b')]('close',close);module[_0x6e43('0x24')]=ami; \ No newline at end of file +var _0x0e85=['connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','log','exports','asterisk-manager','bluebird','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','Action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x0e85,0x170));var _0x50e8=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x0e85[_0x4a53d];return _0x27410e;};'use strict';var Manager=require(_0x50e8('0x0'));var BPromise=require(_0x50e8('0x1'));var moment=require(_0x50e8('0x2'));var util=require(_0x50e8('0x3'));var _=require(_0x50e8('0x4'));var logger=require(_0x50e8('0x5'))(_0x50e8('0x6'));var config=require('../../config/environment');var ami=new Manager(config[_0x50e8('0x7')][_0x50e8('0x8')],config[_0x50e8('0x7')]['ip'],config[_0x50e8('0x7')][_0x50e8('0x9')],config['asterisk'][_0x50e8('0xa')],!![]);ami['keepConnected']();ami[_0x50e8('0xb')]=BPromise['promisify'](ami['action']);function error(_0x5692f7){logger[_0x50e8('0xc')](util[_0x50e8('0xd')](_0x50e8('0xe'),config[_0x50e8('0x7')][_0x50e8('0x9')],config['asterisk']['ip'],config[_0x50e8('0x7')][_0x50e8('0x8')],util[_0x50e8('0xf')](_0x5692f7,![],null)));}function close(){logger[_0x50e8('0xc')](util[_0x50e8('0xd')](_0x50e8('0x10'),config[_0x50e8('0x7')][_0x50e8('0x9')],config[_0x50e8('0x7')]['ip'],config[_0x50e8('0x7')][_0x50e8('0x8')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x50e8('0xb')]({'action':'sipshowregistry'});};};ami[_0x50e8('0x11')]=function(){return function(){return ami['Action']({'action':_0x50e8('0x12')});};};ami[_0x50e8('0x13')]=function(){return function(){return ami[_0x50e8('0xb')]({'action':_0x50e8('0x14')});};};ami[_0x50e8('0x15')]=function(){return function(){return ami[_0x50e8('0xb')]({'action':'queuesummary'});};};ami[_0x50e8('0x16')]=function(){return function(){return ami[_0x50e8('0xb')]({'action':_0x50e8('0x17')});};};function connect(_0x100607){logger[_0x50e8('0x18')](util[_0x50e8('0xd')](_0x50e8('0x19'),config[_0x50e8('0x7')]['username'],config[_0x50e8('0x7')]['ip'],config['asterisk'][_0x50e8('0x8')]));ami[_0x50e8('0x1a')](_0x50e8('0xc'),error);ami[_0x50e8('0x1a')](_0x50e8('0x1b'),close);}ami['on'](_0x50e8('0x1c'),connect);ami['on']('shutdown',function(_0x353733){logger[_0x50e8('0x18')](util[_0x50e8('0xd')](_0x50e8('0x1d'),config['asterisk'][_0x50e8('0x9')],config[_0x50e8('0x7')]['ip'],config[_0x50e8('0x7')][_0x50e8('0x8')],util[_0x50e8('0xf')](_0x353733,![],null)));});ami['on']('fullybooted',function(_0x4171d7){logger[_0x50e8('0x18')](util['format'](_0x50e8('0x1e'),config[_0x50e8('0x7')]['username'],config[_0x50e8('0x7')]['ip'],config[_0x50e8('0x7')][_0x50e8('0x8')]));return BPromise[_0x50e8('0x1f')]()[_0x50e8('0x20')](ami[_0x50e8('0x21')]())['then'](ami[_0x50e8('0x11')]())['then'](ami[_0x50e8('0x13')]())[_0x50e8('0x20')](ami[_0x50e8('0x15')]())['then'](ami[_0x50e8('0x16')]())['catch'](function(_0x5bd45f){console[_0x50e8('0x22')](_0x5bd45f);});});ami['once']('error',error);ami[_0x50e8('0x1a')](_0x50e8('0x1b'),close);module[_0x50e8('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 50b37d8..9db08ff 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 _0x1995=['http','Request','request','then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','ami'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x1995,0xb3));var _0x5199=function(_0x14dc31,_0x40b590){_0x14dc31=_0x14dc31-0x0;var _0x13b284=_0x1995[_0x14dc31];return _0x13b284;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x5199('0x0'));var logger=require(_0x5199('0x1'))(_0x5199('0x2'));var client=jayson['client'][_0x5199('0x3')]({'port':0x2329});client[_0x5199('0x4')]=function(_0x7ddf7,_0x5e6384){return new BPromise(function(_0x41bc36,_0x2bf506){return client[_0x5199('0x5')](_0x7ddf7,_0x5e6384)[_0x5199('0x6')](function(_0x34cdad){logger['debug'](_0x5199('0x7'),_0x5199('0x8'),_0x7ddf7,_0x5e6384,_0x34cdad);if(_0x34cdad['error']){logger[_0x5199('0x9')](_0x5199('0x7'),'memberReport',_0x7ddf7,_0x34cdad[_0x5199('0x9')][_0x5199('0xa')],_0x5e6384);return _0x2bf506(_0x34cdad[_0x5199('0x9')][_0x5199('0xa')]);}else{return _0x41bc36(_0x34cdad[_0x5199('0xb')]);}})[_0x5199('0xc')](function(_0x184910){logger[_0x5199('0x9')]('rpc',_0x5199('0x8'),_0x7ddf7,_0x184910,_0x5e6384);return _0x2bf506(_0x184910);});});};module[_0x5199('0xd')]=client; \ No newline at end of file +var _0xc374=['error','message','exports','jayson/promise','bluebird','client','http','Request','request','then','rpc','memberReport'];(function(_0x594de,_0x44f5fa){var _0x28dbf5=function(_0x56b235){while(--_0x56b235){_0x594de['push'](_0x594de['shift']());}};_0x28dbf5(++_0x44f5fa);}(_0xc374,0x117));var _0x4c37=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc374[_0x321bb2];return _0x9c12ed;};'use strict';var jayson=require(_0x4c37('0x0'));var BPromise=require(_0x4c37('0x1'));var logger=require('../../config/logger')('ami');var client=jayson[_0x4c37('0x2')][_0x4c37('0x3')]({'port':0x2329});client[_0x4c37('0x4')]=function(_0x158d3c,_0x51b321){return new BPromise(function(_0x53d113,_0x1e224a){return client[_0x4c37('0x5')](_0x158d3c,_0x51b321)[_0x4c37('0x6')](function(_0x149f70){logger['debug'](_0x4c37('0x7'),_0x4c37('0x8'),_0x158d3c,_0x51b321,_0x149f70);if(_0x149f70['error']){logger[_0x4c37('0x9')](_0x4c37('0x7'),_0x4c37('0x8'),_0x158d3c,_0x149f70[_0x4c37('0x9')]['message'],_0x51b321);return _0x1e224a(_0x149f70['error'][_0x4c37('0xa')]);}else{return _0x53d113(_0x149f70['result']);}})['catch'](function(_0x2b4879){logger['error'](_0x4c37('0x7'),_0x4c37('0x8'),_0x158d3c,_0x2b4879,_0x51b321);return _0x1e224a(_0x2b4879);});});};module[_0x4c37('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index f142638..9dc302a 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 _0xc9c3=['getQueue','queue','exports','lodash','moment','isNil','string','voiceQueue','uniqueid','phone','Contact','lastName','number','name','active','type','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','format','callback','callbackuniqueid','recallme','originatecalleridname','prototype','\x22%s\x22\x20<%s>','dialCutDigit'];(function(_0x38e831,_0x173fc0){var _0x497511=function(_0x4d1caa){while(--_0x4d1caa){_0x38e831['push'](_0x38e831['shift']());}};_0x497511(++_0x173fc0);}(_0xc9c3,0xd0));var _0x3c9c=function(_0x4d678b,_0x51c2c0){_0x4d678b=_0x4d678b-0x0;var _0x4b0e8b=_0xc9c3[_0x4d678b];return _0x4b0e8b;};'use strict';var util=require('util');var _=require(_0x3c9c('0x0'));var moment=require(_0x3c9c('0x1'));function checkNameSurname(_0x772a1a,_0x51a13c,_0x4a1db1){var _0x2ca714='';if(!_[_0x3c9c('0x2')](_0x51a13c)&&'string'===typeof _0x51a13c){_0x2ca714+=_0x51a13c;}if(!_[_0x3c9c('0x2')](_0x4a1db1)&&_0x3c9c('0x3')===typeof _0x4a1db1){_0x2ca714+='\x20'+_0x4a1db1;}if(_0x2ca714!==''){return _0x2ca714;}return _0x772a1a;}function Action(_0x321f55,_0xfb5046,_0x40811c){this[_0x3c9c('0x4')]=_0x321f55;this[_0x3c9c('0x5')]=_0x40811c||undefined;this['name']=checkNameSurname(_0xfb5046['Contact'][_0x3c9c('0x6')],_0xfb5046[_0x3c9c('0x7')]['firstName'],_0xfb5046[_0x3c9c('0x7')][_0x3c9c('0x8')]);this[_0x3c9c('0x9')]=_0xfb5046[_0x3c9c('0x7')]['phone'];this['queue']=_0x321f55[_0x3c9c('0xa')];this[_0x3c9c('0xb')]=_0xfb5046[_0x3c9c('0xb')]||![];this[_0x3c9c('0xc')]=_0x321f55['type'];this['dialQueueTimeout']=_0x321f55['dialQueueTimeout']||0x3;this['scheduledat']=_0xfb5046[_0x3c9c('0xd')];this[_0x3c9c('0xe')]=_0xfb5046['countbusyretry'];this[_0x3c9c('0xf')]=_0xfb5046['countcongestionretry'];this[_0x3c9c('0x10')]=_0xfb5046[_0x3c9c('0x10')];this[_0x3c9c('0x11')]=_0xfb5046['countnosuchnumberretry'];this[_0x3c9c('0x12')]=_0xfb5046['countdropretry'];this[_0x3c9c('0x13')]=_0xfb5046['countabandonedretry'];this[_0x3c9c('0x14')]=_0xfb5046[_0x3c9c('0x14')];this[_0x3c9c('0x15')]=_0xfb5046['countagentrejectretry'];this[_0x3c9c('0x16')]=_0xfb5046['ContactId'];this[_0x3c9c('0x17')]=_0xfb5046[_0x3c9c('0x17')];this[_0x3c9c('0x18')]=_0xfb5046[_0x3c9c('0x18')];this[_0x3c9c('0x19')]=_0xfb5046[_0x3c9c('0x19')];this[_0x3c9c('0x1a')]=_0xfb5046[_0x3c9c('0x1a')];this[_0x3c9c('0x1b')]=_0xfb5046['id'];this[_0x3c9c('0x1c')]=_0xfb5046[_0x3c9c('0x7')][_0x3c9c('0x1d')]||'';this['starttime']=moment()[_0x3c9c('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0xfb5046[_0x3c9c('0x1f')];this[_0x3c9c('0x20')]=_0xfb5046[_0x3c9c('0x20')];this['callbackat']=_0xfb5046['callbackat'];this[_0x3c9c('0x21')]=_0xfb5046['recallme'];this['originatecalleridnum']='';this[_0x3c9c('0x22')]='';}Action[_0x3c9c('0x23')]['getCaller']=function(){return util[_0x3c9c('0x1e')](_0x3c9c('0x24'),this[_0x3c9c('0xa')],this[_0x3c9c('0x4')][_0x3c9c('0x25')]>0x0?this[_0x3c9c('0x9')]['substring'](this[_0x3c9c('0x4')]['dialCutDigit']):this['number']);};Action[_0x3c9c('0x23')][_0x3c9c('0x26')]=function(){return this[_0x3c9c('0x27')];};module[_0x3c9c('0x28')]=Action; \ No newline at end of file +var _0xa83a=['exports','lodash','moment','isNil','string','voiceQueue','phone','Contact','firstName','lastName','number','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','substring','dialCutDigit','getQueue'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa83a,0x88));var _0xaa83=function(_0x55fa31,_0x8ccaf0){_0x55fa31=_0x55fa31-0x0;var _0x4b8233=_0xa83a[_0x55fa31];return _0x4b8233;};'use strict';var util=require('util');var _=require(_0xaa83('0x0'));var moment=require(_0xaa83('0x1'));function checkNameSurname(_0x51a44d,_0x4b12fa,_0x17a8bd){var _0x1f3808='';if(!_[_0xaa83('0x2')](_0x4b12fa)&&_0xaa83('0x3')===typeof _0x4b12fa){_0x1f3808+=_0x4b12fa;}if(!_['isNil'](_0x17a8bd)&&_0xaa83('0x3')===typeof _0x17a8bd){_0x1f3808+='\x20'+_0x17a8bd;}if(_0x1f3808!==''){return _0x1f3808;}return _0x51a44d;}function Action(_0x1ff578,_0x280637,_0x9c332d){this[_0xaa83('0x4')]=_0x1ff578;this['uniqueid']=_0x9c332d||undefined;this['name']=checkNameSurname(_0x280637['Contact'][_0xaa83('0x5')],_0x280637[_0xaa83('0x6')][_0xaa83('0x7')],_0x280637[_0xaa83('0x6')][_0xaa83('0x8')]);this[_0xaa83('0x9')]=_0x280637[_0xaa83('0x6')][_0xaa83('0x5')];this['queue']=_0x1ff578[_0xaa83('0xa')];this[_0xaa83('0xb')]=_0x280637['active']||![];this[_0xaa83('0xc')]=_0x1ff578['type'];this[_0xaa83('0xd')]=_0x1ff578['dialQueueTimeout']||0x3;this[_0xaa83('0xe')]=_0x280637[_0xaa83('0xe')];this[_0xaa83('0xf')]=_0x280637['countbusyretry'];this[_0xaa83('0x10')]=_0x280637[_0xaa83('0x10')];this[_0xaa83('0x11')]=_0x280637['countnoanswerretry'];this[_0xaa83('0x12')]=_0x280637[_0xaa83('0x12')];this[_0xaa83('0x13')]=_0x280637[_0xaa83('0x13')];this[_0xaa83('0x14')]=_0x280637[_0xaa83('0x14')];this[_0xaa83('0x15')]=_0x280637[_0xaa83('0x15')];this[_0xaa83('0x16')]=_0x280637[_0xaa83('0x16')];this[_0xaa83('0x17')]=_0x280637[_0xaa83('0x17')];this['ListId']=_0x280637['ListId'];this[_0xaa83('0x18')]=_0x280637[_0xaa83('0x18')];this[_0xaa83('0x19')]=_0x280637[_0xaa83('0x19')];this[_0xaa83('0x1a')]=_0x280637['CampaignId'];this[_0xaa83('0x1b')]=_0x280637['id'];this[_0xaa83('0x1c')]=_0x280637['Contact']['firstName']||'';this[_0xaa83('0x1d')]=moment()[_0xaa83('0x1e')](_0xaa83('0x1f'));this['callback']=_0x280637[_0xaa83('0x20')];this[_0xaa83('0x21')]=_0x280637[_0xaa83('0x21')];this[_0xaa83('0x22')]=_0x280637[_0xaa83('0x22')];this[_0xaa83('0x23')]=_0x280637[_0xaa83('0x23')];this[_0xaa83('0x24')]='';this[_0xaa83('0x25')]='';}Action[_0xaa83('0x26')][_0xaa83('0x27')]=function(){return util[_0xaa83('0x1e')](_0xaa83('0x28'),this[_0xaa83('0xa')],this[_0xaa83('0x4')]['dialCutDigit']>0x0?this[_0xaa83('0x9')][_0xaa83('0x29')](this[_0xaa83('0x4')][_0xaa83('0x2a')]):this[_0xaa83('0x9')]);};Action['prototype'][_0xaa83('0x2b')]=function(){return this['queue'];};module[_0xaa83('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 0d7492a..86085ef 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 _0xdad2=['recallme','ListId','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','calleridnum','number','starttime','responsetime','endtime','talktime','callback','callbackuniqueid','callbackat'];(function(_0x3f94f9,_0x42774b){var _0x46f84f=function(_0xa080d8){while(--_0xa080d8){_0x3f94f9['push'](_0x3f94f9['shift']());}};_0x46f84f(++_0x42774b);}(_0xdad2,0x14c));var _0x2dad=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xdad2[_0x4a9fb1];return _0x348672;};'use strict';var util=require('util');var _=require(_0x2dad('0x0'));var moment=require(_0x2dad('0x1'));function getSeconds(_0x5a35a1,_0x22b0a0){var _0x15946a=moment(_0x5a35a1)[_0x2dad('0x2')](0x0);var _0x58acfe=moment(_0x22b0a0)[_0x2dad('0x2')](0x0);return _0x15946a[_0x2dad('0x3')](_0x58acfe,'seconds');}function AdditionalPhone(_0x1d95bf){this[_0x2dad('0x4')]=_0x1d95bf[_0x2dad('0x4')];this[_0x2dad('0x5')]=_0x1d95bf['scheduledat']||undefined;this['type']=_0x1d95bf[_0x2dad('0x6')];this[_0x2dad('0x7')]=_0x1d95bf[_0x2dad('0x6')]===_0x2dad('0x8')?_0x2dad('0x9'):_0x1d95bf[_0x2dad('0x6')];this['countbusyretry']=_0x1d95bf[_0x2dad('0xa')];this['countcongestionretry']=_0x1d95bf[_0x2dad('0xb')];this[_0x2dad('0xc')]=_0x1d95bf['countnoanswerretry'];this[_0x2dad('0xd')]=_0x1d95bf[_0x2dad('0xa')]+_0x1d95bf[_0x2dad('0xb')]+_0x1d95bf['countnoanswerretry']+_0x1d95bf[_0x2dad('0xe')]+_0x1d95bf[_0x2dad('0xf')]+_0x1d95bf['countabandonedretry']+_0x1d95bf[_0x2dad('0x10')]+_0x1d95bf[_0x2dad('0x11')];this[_0x2dad('0xe')]=_0x1d95bf[_0x2dad('0xe')];this['countdropretry']=_0x1d95bf[_0x2dad('0xf')];this[_0x2dad('0x12')]=_0x1d95bf[_0x2dad('0x12')];this[_0x2dad('0x10')]=_0x1d95bf[_0x2dad('0x10')];this['countagentrejectretry']=_0x1d95bf['countagentrejectretry'];this[_0x2dad('0x9')]=_0x1d95bf['queue'];this['calleridname']=_0x1d95bf['name'];this[_0x2dad('0x13')]=_0x1d95bf[_0x2dad('0x14')];this[_0x2dad('0x15')]=_0x1d95bf[_0x2dad('0x15')];this[_0x2dad('0x16')]=_0x1d95bf['responsetime'];this[_0x2dad('0x17')]=_0x1d95bf[_0x2dad('0x16')];this['ringtime']=getSeconds(_0x1d95bf[_0x2dad('0x16')],_0x1d95bf['starttime']);this['holdtime']=0x0;this[_0x2dad('0x18')]=0x0;this[_0x2dad('0x19')]=_0x1d95bf[_0x2dad('0x19')];this[_0x2dad('0x1a')]=_0x1d95bf[_0x2dad('0x1a')];this[_0x2dad('0x1b')]=_0x1d95bf['callbackat'];this['recallme']=_0x1d95bf[_0x2dad('0x1c')];this['ContactId']=_0x1d95bf['ContactId'];this[_0x2dad('0x1d')]=_0x1d95bf[_0x2dad('0x1d')];this[_0x2dad('0x1e')]=_0x1d95bf['UserId'];this[_0x2dad('0x1f')]=_0x1d95bf['VoiceQueueId'];this[_0x2dad('0x20')]=_0x1d95bf[_0x2dad('0x20')];this[_0x2dad('0x21')]=_0x1d95bf['originatecalleridnum']||'';this[_0x2dad('0x22')]=_0x1d95bf[_0x2dad('0x22')]||'';}module[_0x2dad('0x23')]=History; \ No newline at end of file +var _0x7a17=['countabandonedretry','countagentrejectretry','countmachineretry','queue','name','calleridnum','number','starttime','responsetime','endtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','diff','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x7a17,0x15b));var _0x77a1=function(_0x19ab63,_0x4a1ab3){_0x19ab63=_0x19ab63-0x0;var _0x345fe0=_0x7a17[_0x19ab63];return _0x345fe0;};'use strict';var util=require(_0x77a1('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x355368,_0x9bd39e){var _0x5d3d7b=moment(_0x355368)['milliseconds'](0x0);var _0x5aade4=moment(_0x9bd39e)['milliseconds'](0x0);return _0x5d3d7b[_0x77a1('0x1')](_0x5aade4,'seconds');}function AdditionalPhone(_0x413cbd){this['uniqueid']=_0x413cbd[_0x77a1('0x2')];this[_0x77a1('0x3')]=_0x413cbd[_0x77a1('0x3')]||undefined;this[_0x77a1('0x4')]=_0x413cbd[_0x77a1('0x4')];this[_0x77a1('0x5')]=_0x413cbd[_0x77a1('0x4')]===_0x77a1('0x6')?'queue':_0x413cbd['type'];this[_0x77a1('0x7')]=_0x413cbd[_0x77a1('0x7')];this['countcongestionretry']=_0x413cbd[_0x77a1('0x8')];this[_0x77a1('0x9')]=_0x413cbd[_0x77a1('0x9')];this[_0x77a1('0xa')]=_0x413cbd[_0x77a1('0x7')]+_0x413cbd[_0x77a1('0x8')]+_0x413cbd[_0x77a1('0x9')]+_0x413cbd[_0x77a1('0xb')]+_0x413cbd[_0x77a1('0xc')]+_0x413cbd[_0x77a1('0xd')]+_0x413cbd['countmachineretry']+_0x413cbd[_0x77a1('0xe')];this[_0x77a1('0xb')]=_0x413cbd[_0x77a1('0xb')];this[_0x77a1('0xc')]=_0x413cbd[_0x77a1('0xc')];this[_0x77a1('0xd')]=_0x413cbd[_0x77a1('0xd')];this[_0x77a1('0xf')]=_0x413cbd['countmachineretry'];this[_0x77a1('0xe')]=_0x413cbd['countagentrejectretry'];this[_0x77a1('0x10')]=_0x413cbd['queue'];this['calleridname']=_0x413cbd[_0x77a1('0x11')];this[_0x77a1('0x12')]=_0x413cbd[_0x77a1('0x13')];this[_0x77a1('0x14')]=_0x413cbd['starttime'];this['responsetime']=_0x413cbd[_0x77a1('0x15')];this[_0x77a1('0x16')]=_0x413cbd[_0x77a1('0x15')];this['ringtime']=getSeconds(_0x413cbd[_0x77a1('0x15')],_0x413cbd[_0x77a1('0x14')]);this['holdtime']=0x0;this[_0x77a1('0x17')]=0x0;this['callback']=_0x413cbd[_0x77a1('0x18')];this['callbackuniqueid']=_0x413cbd[_0x77a1('0x19')];this[_0x77a1('0x1a')]=_0x413cbd[_0x77a1('0x1a')];this['recallme']=_0x413cbd[_0x77a1('0x1b')];this[_0x77a1('0x1c')]=_0x413cbd[_0x77a1('0x1c')];this[_0x77a1('0x1d')]=_0x413cbd['ListId'];this['UserId']=_0x413cbd[_0x77a1('0x1e')];this[_0x77a1('0x1f')]=_0x413cbd['VoiceQueueId'];this[_0x77a1('0x20')]=_0x413cbd[_0x77a1('0x20')];this[_0x77a1('0x21')]=_0x413cbd[_0x77a1('0x21')]||'';this[_0x77a1('0x22')]=_0x413cbd[_0x77a1('0x22')]||'';}module[_0x77a1('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 6ef5af3..514971e 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 _0x1781=['holdtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime'];(function(_0x5bf6db,_0x45381b){var _0x4635f1=function(_0x5af55e){while(--_0x5af55e){_0x5bf6db['push'](_0x5bf6db['shift']());}};_0x4635f1(++_0x45381b);}(_0x1781,0xfe));var _0x1178=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1781[_0x17d9e3];return _0x14192d;};'use strict';var util=require(_0x1178('0x0'));var _=require(_0x1178('0x1'));var moment=require('moment');function getSeconds(_0x445390,_0x588bc9){var _0x50207c=moment(_0x445390)[_0x1178('0x2')](0x0);var _0x51e4f6=moment(_0x588bc9)[_0x1178('0x2')](0x0);return _0x50207c[_0x1178('0x3')](_0x51e4f6,'seconds');}function AgentComplete(_0x4d9b14,_0x22d94d){this[_0x1178('0x4')]=0x4;this[_0x1178('0x5')]=_0x1178('0x6');this[_0x1178('0x7')]=_0x4d9b14[_0x1178('0x7')];this['type']=_0x4d9b14[_0x1178('0x8')];this[_0x1178('0x9')]=_0x4d9b14[_0x1178('0x8')]===_0x1178('0xa')?'queue':_0x4d9b14[_0x1178('0x8')];this[_0x1178('0xb')]=_0x4d9b14[_0x1178('0xb')];this[_0x1178('0xc')]=_0x4d9b14[_0x1178('0xc')];this['countnoanswerretry']=_0x4d9b14['countnoanswerretry'];this['countglobal']=_0x4d9b14[_0x1178('0xb')]+_0x4d9b14[_0x1178('0xc')]+_0x4d9b14[_0x1178('0xd')]+_0x4d9b14['countnosuchnumberretry']+_0x4d9b14[_0x1178('0xe')]+_0x4d9b14[_0x1178('0xf')]+_0x4d9b14['countmachineretry']+_0x4d9b14[_0x1178('0x10')];this[_0x1178('0x11')]=_0x4d9b14['countnosuchnumberretry'];this['countdropretry']=_0x4d9b14[_0x1178('0xe')];this[_0x1178('0xf')]=_0x4d9b14[_0x1178('0xf')];this[_0x1178('0x12')]=_0x4d9b14['countmachineretry'];this[_0x1178('0x10')]=_0x4d9b14['countagentrejectretry'];this[_0x1178('0x13')]=_0x22d94d['uniqueid'];this['calleridname']=_0x4d9b14['name'];this['calleridnum']=_0x4d9b14['number'];this['starttime']=_0x4d9b14[_0x1178('0x14')];this['responsetime']=_0x4d9b14[_0x1178('0x15')];this[_0x1178('0x16')]=_0x4d9b14[_0x1178('0x16')];this[_0x1178('0x17')]=moment()['format'](_0x1178('0x18'));this[_0x1178('0x19')]=getSeconds(_0x4d9b14['responsetime'],_0x4d9b14[_0x1178('0x14')]);this[_0x1178('0x1a')]=getSeconds(_0x4d9b14[_0x1178('0x16')],_0x4d9b14['responsetime']);this['talktime']=getSeconds(this['endtime'],_0x4d9b14[_0x1178('0x16')]);this[_0x1178('0x1b')]=_0x22d94d['queue'];this['membername']=_0x22d94d[_0x1178('0x1c')];this[_0x1178('0x1d')]=_0x22d94d[_0x1178('0x1d')];this['callback']=_0x4d9b14[_0x1178('0x1e')];this[_0x1178('0x1f')]=_0x4d9b14[_0x1178('0x1f')];this[_0x1178('0x20')]=_0x4d9b14[_0x1178('0x20')];this['recallme']=_0x4d9b14[_0x1178('0x21')];this['ContactId']=_0x4d9b14[_0x1178('0x22')];this[_0x1178('0x23')]=_0x4d9b14[_0x1178('0x23')];this['UserId']=_0x4d9b14['UserId'];this[_0x1178('0x24')]=_0x4d9b14[_0x1178('0x24')];this[_0x1178('0x25')]=_0x4d9b14[_0x1178('0x25')];this[_0x1178('0x26')]=_0x4d9b14['originatecalleridnum']||'';this[_0x1178('0x27')]=_0x4d9b14[_0x1178('0x27')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0xeee2=['endtime','YYYY-MM-DD\x20HH:mm:ss','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','number','starttime','responsetime','answertime'];(function(_0x528836,_0x541e5e){var _0xe310e9=function(_0x57bc17){while(--_0x57bc17){_0x528836['push'](_0x528836['shift']());}};_0xe310e9(++_0x541e5e);}(_0xeee2,0x1df));var _0x2eee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeee2[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x2eee('0x0'));var moment=require(_0x2eee('0x1'));function getSeconds(_0x1b86a2,_0x3c7f57){var _0x527767=moment(_0x1b86a2)[_0x2eee('0x2')](0x0);var _0x2f85d3=moment(_0x3c7f57)[_0x2eee('0x2')](0x0);return _0x527767[_0x2eee('0x3')](_0x2f85d3,'seconds');}function AgentComplete(_0x52cdd7,_0x585b2c){this[_0x2eee('0x4')]=0x4;this['statedesc']=_0x2eee('0x5');this['scheduledat']=_0x52cdd7[_0x2eee('0x6')];this[_0x2eee('0x7')]=_0x52cdd7['type'];this[_0x2eee('0x8')]=_0x52cdd7[_0x2eee('0x7')]===_0x2eee('0x9')?_0x2eee('0xa'):_0x52cdd7[_0x2eee('0x7')];this[_0x2eee('0xb')]=_0x52cdd7['countbusyretry'];this[_0x2eee('0xc')]=_0x52cdd7['countcongestionretry'];this[_0x2eee('0xd')]=_0x52cdd7[_0x2eee('0xd')];this['countglobal']=_0x52cdd7['countbusyretry']+_0x52cdd7['countcongestionretry']+_0x52cdd7[_0x2eee('0xd')]+_0x52cdd7[_0x2eee('0xe')]+_0x52cdd7[_0x2eee('0xf')]+_0x52cdd7[_0x2eee('0x10')]+_0x52cdd7[_0x2eee('0x11')]+_0x52cdd7['countagentrejectretry'];this[_0x2eee('0xe')]=_0x52cdd7['countnosuchnumberretry'];this['countdropretry']=_0x52cdd7['countdropretry'];this[_0x2eee('0x10')]=_0x52cdd7[_0x2eee('0x10')];this['countmachineretry']=_0x52cdd7[_0x2eee('0x11')];this[_0x2eee('0x12')]=_0x52cdd7[_0x2eee('0x12')];this[_0x2eee('0x13')]=_0x585b2c[_0x2eee('0x13')];this['calleridname']=_0x52cdd7[_0x2eee('0x14')];this['calleridnum']=_0x52cdd7[_0x2eee('0x15')];this[_0x2eee('0x16')]=_0x52cdd7[_0x2eee('0x16')];this['responsetime']=_0x52cdd7[_0x2eee('0x17')];this[_0x2eee('0x18')]=_0x52cdd7[_0x2eee('0x18')];this[_0x2eee('0x19')]=moment()['format'](_0x2eee('0x1a'));this['ringtime']=getSeconds(_0x52cdd7[_0x2eee('0x17')],_0x52cdd7['starttime']);this[_0x2eee('0x1b')]=getSeconds(_0x52cdd7[_0x2eee('0x18')],_0x52cdd7[_0x2eee('0x17')]);this['talktime']=getSeconds(this[_0x2eee('0x19')],_0x52cdd7[_0x2eee('0x18')]);this[_0x2eee('0xa')]=_0x585b2c[_0x2eee('0xa')];this['membername']=_0x585b2c[_0x2eee('0x1c')];this[_0x2eee('0x1d')]=_0x585b2c[_0x2eee('0x1d')];this[_0x2eee('0x1e')]=_0x52cdd7[_0x2eee('0x1e')];this[_0x2eee('0x1f')]=_0x52cdd7[_0x2eee('0x1f')];this[_0x2eee('0x20')]=_0x52cdd7[_0x2eee('0x20')];this[_0x2eee('0x21')]=_0x52cdd7[_0x2eee('0x21')];this[_0x2eee('0x22')]=_0x52cdd7[_0x2eee('0x22')];this[_0x2eee('0x23')]=_0x52cdd7[_0x2eee('0x23')];this['UserId']=_0x52cdd7[_0x2eee('0x24')];this['VoiceQueueId']=_0x52cdd7[_0x2eee('0x25')];this[_0x2eee('0x26')]=_0x52cdd7['CampaignId'];this[_0x2eee('0x27')]=_0x52cdd7[_0x2eee('0x27')]||'';this['originatecalleridname']=_0x52cdd7[_0x2eee('0x28')]||'';}module[_0x2eee('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 b932c03..6a48bba 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 _0xcdb4=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','endtime','responsetime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x10d21f,_0x1e16d4){var _0x2bb09c=function(_0x5cb9){while(--_0x5cb9){_0x10d21f['push'](_0x10d21f['shift']());}};_0x2bb09c(++_0x1e16d4);}(_0xcdb4,0x136));var _0x4cdb=function(_0x41f879,_0x28925c){_0x41f879=_0x41f879-0x0;var _0x535d1d=_0xcdb4[_0x41f879];return _0x535d1d;};'use strict';var util=require(_0x4cdb('0x0'));var _=require(_0x4cdb('0x1'));var moment=require(_0x4cdb('0x2'));function getSeconds(_0x4b6662,_0x4307fe){var _0x5196dc=moment(_0x4b6662)[_0x4cdb('0x3')](0x0);var _0x23ccd1=moment(_0x4307fe)['milliseconds'](0x0);return _0x5196dc[_0x4cdb('0x4')](_0x23ccd1,_0x4cdb('0x5'));}function Final(_0x179b73){this[_0x4cdb('0x6')]=_0x179b73[_0x4cdb('0x6')];this[_0x4cdb('0x7')]=_0x179b73[_0x4cdb('0x7')];this[_0x4cdb('0x8')]=_0x179b73[_0x4cdb('0x8')];this[_0x4cdb('0x9')]=_0x179b73['type']==='outbound'?_0x4cdb('0xa'):_0x179b73[_0x4cdb('0x8')];this['countbusyretry']=_0x179b73[_0x4cdb('0xb')];this[_0x4cdb('0xc')]=_0x179b73[_0x4cdb('0xc')];this['countnoanswerretry']=_0x179b73[_0x4cdb('0xd')];this[_0x4cdb('0xe')]=_0x179b73[_0x4cdb('0xb')]+_0x179b73[_0x4cdb('0xc')]+_0x179b73[_0x4cdb('0xd')]+_0x179b73[_0x4cdb('0xf')]+_0x179b73['countdropretry']+_0x179b73[_0x4cdb('0x10')]+_0x179b73[_0x4cdb('0x11')]+_0x179b73[_0x4cdb('0x12')];this['countnosuchnumberretry']=_0x179b73[_0x4cdb('0xf')];this[_0x4cdb('0x13')]=_0x179b73[_0x4cdb('0x13')];this[_0x4cdb('0x10')]=_0x179b73[_0x4cdb('0x10')];this[_0x4cdb('0x11')]=_0x179b73[_0x4cdb('0x11')];this[_0x4cdb('0x12')]=_0x179b73[_0x4cdb('0x12')];this[_0x4cdb('0xa')]=_0x179b73[_0x4cdb('0xa')];this[_0x4cdb('0x14')]=_0x179b73[_0x4cdb('0x14')];this[_0x4cdb('0x15')]=_0x179b73[_0x4cdb('0x15')];this[_0x4cdb('0x16')]=_0x179b73['starttime'];this['responsetime']=_0x179b73['responsetime'];this[_0x4cdb('0x17')]=_0x179b73[_0x4cdb('0x18')];this['ringtime']=_0x179b73['ringtime']||0x0;this['holdtime']=_0x179b73['holdtime']||0x0;this['talktime']=_0x179b73[_0x4cdb('0x19')]||0x0;this[_0x4cdb('0x1a')]=_0x179b73[_0x4cdb('0x1a')];this[_0x4cdb('0x1b')]=_0x179b73[_0x4cdb('0x1b')];this[_0x4cdb('0x1c')]=_0x179b73[_0x4cdb('0x1c')];this[_0x4cdb('0x1d')]=_0x179b73['recallme'];this[_0x4cdb('0x1e')]=_0x179b73['ContactId'];this[_0x4cdb('0x1f')]=_0x179b73[_0x4cdb('0x1f')];this[_0x4cdb('0x20')]=_0x179b73[_0x4cdb('0x20')];this[_0x4cdb('0x21')]=_0x179b73['VoiceQueueId'];this[_0x4cdb('0x22')]=_0x179b73[_0x4cdb('0x22')];this[_0x4cdb('0x23')]=_0x179b73[_0x4cdb('0x23')]||'';this[_0x4cdb('0x24')]=_0x179b73['originatecalleridname']||'';}module[_0x4cdb('0x25')]=Final; \ No newline at end of file +var _0x4b51=['countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','util','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x1c5e65,_0x57f522){var _0x3ebd76=function(_0x5684b3){while(--_0x5684b3){_0x1c5e65['push'](_0x1c5e65['shift']());}};_0x3ebd76(++_0x57f522);}(_0x4b51,0x11c));var _0x14b5=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0x4b51[_0x4d8666];return _0x37175b;};'use strict';var util=require(_0x14b5('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x1e6218,_0x26ccb1){var _0x1a4791=moment(_0x1e6218)[_0x14b5('0x1')](0x0);var _0x38a843=moment(_0x26ccb1)[_0x14b5('0x1')](0x0);return _0x1a4791['diff'](_0x38a843,_0x14b5('0x2'));}function Final(_0x5cc613){this[_0x14b5('0x3')]=_0x5cc613[_0x14b5('0x3')];this[_0x14b5('0x4')]=_0x5cc613[_0x14b5('0x4')];this['type']=_0x5cc613[_0x14b5('0x5')];this[_0x14b5('0x6')]=_0x5cc613[_0x14b5('0x5')]==='outbound'?'queue':_0x5cc613[_0x14b5('0x5')];this[_0x14b5('0x7')]=_0x5cc613['countbusyretry'];this[_0x14b5('0x8')]=_0x5cc613[_0x14b5('0x8')];this[_0x14b5('0x9')]=_0x5cc613[_0x14b5('0x9')];this[_0x14b5('0xa')]=_0x5cc613[_0x14b5('0x7')]+_0x5cc613[_0x14b5('0x8')]+_0x5cc613['countnoanswerretry']+_0x5cc613[_0x14b5('0xb')]+_0x5cc613[_0x14b5('0xc')]+_0x5cc613['countabandonedretry']+_0x5cc613[_0x14b5('0xd')]+_0x5cc613[_0x14b5('0xe')];this[_0x14b5('0xb')]=_0x5cc613[_0x14b5('0xb')];this[_0x14b5('0xc')]=_0x5cc613[_0x14b5('0xc')];this[_0x14b5('0xf')]=_0x5cc613[_0x14b5('0xf')];this[_0x14b5('0xd')]=_0x5cc613[_0x14b5('0xd')];this[_0x14b5('0xe')]=_0x5cc613[_0x14b5('0xe')];this[_0x14b5('0x10')]=_0x5cc613[_0x14b5('0x10')];this[_0x14b5('0x11')]=_0x5cc613[_0x14b5('0x11')];this[_0x14b5('0x12')]=_0x5cc613[_0x14b5('0x12')];this[_0x14b5('0x13')]=_0x5cc613[_0x14b5('0x13')];this[_0x14b5('0x14')]=_0x5cc613[_0x14b5('0x14')];this['endtime']=_0x5cc613[_0x14b5('0x14')];this[_0x14b5('0x15')]=_0x5cc613['ringtime']||0x0;this[_0x14b5('0x16')]=_0x5cc613[_0x14b5('0x16')]||0x0;this[_0x14b5('0x17')]=_0x5cc613[_0x14b5('0x17')]||0x0;this[_0x14b5('0x18')]=_0x5cc613[_0x14b5('0x18')];this[_0x14b5('0x19')]=_0x5cc613[_0x14b5('0x19')];this[_0x14b5('0x1a')]=_0x5cc613[_0x14b5('0x1a')];this[_0x14b5('0x1b')]=_0x5cc613[_0x14b5('0x1b')];this[_0x14b5('0x1c')]=_0x5cc613[_0x14b5('0x1c')];this[_0x14b5('0x1d')]=_0x5cc613['ListId'];this[_0x14b5('0x1e')]=_0x5cc613['UserId'];this['VoiceQueueId']=_0x5cc613['VoiceQueueId'];this[_0x14b5('0x1f')]=_0x5cc613[_0x14b5('0x1f')];this[_0x14b5('0x20')]=_0x5cc613[_0x14b5('0x20')]||'';this['originatecalleridname']=_0x5cc613['originatecalleridname']||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index fa28c3e..6c8eea6 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 _0xf94b=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','ringtime','holdtime','endtime','queue','membername','IVR','reason','cause-txt'];(function(_0x2e9258,_0x385e57){var _0x45ca8b=function(_0x689f9c){while(--_0x689f9c){_0x2e9258['push'](_0x2e9258['shift']());}};_0x45ca8b(++_0x385e57);}(_0xf94b,0x112));var _0xbf94=function(_0x890b09,_0x3ef535){_0x890b09=_0x890b09-0x0;var _0x539392=_0xf94b[_0x890b09];return _0x539392;};'use strict';var util=require(_0xbf94('0x0'));var _=require(_0xbf94('0x1'));var moment=require(_0xbf94('0x2'));function getSeconds(_0x500bc1,_0x5cca81){var _0x2e2d4d=moment(_0x500bc1)[_0xbf94('0x3')](0x0);var _0x4a4cdd=moment(_0x5cca81)[_0xbf94('0x3')](0x0);return _0x2e2d4d[_0xbf94('0x4')](_0x4a4cdd,'seconds');}function Hangup(_0x40856f,_0x19d49f){this[_0xbf94('0x5')]=0x4;this[_0xbf94('0x6')]=_0xbf94('0x7');this[_0xbf94('0x8')]=_0x40856f[_0xbf94('0x8')];this['type']=_0x40856f[_0xbf94('0x9')];this[_0xbf94('0xa')]=_0x40856f[_0xbf94('0x9')]===_0xbf94('0xb')?'queue':_0x40856f[_0xbf94('0x9')];this[_0xbf94('0xc')]=_0x40856f[_0xbf94('0xc')];this['countcongestionretry']=_0x40856f[_0xbf94('0xd')];this[_0xbf94('0xe')]=_0x40856f[_0xbf94('0xe')];this[_0xbf94('0xf')]=_0x40856f[_0xbf94('0xc')]+_0x40856f[_0xbf94('0xd')]+_0x40856f[_0xbf94('0xe')]+_0x40856f[_0xbf94('0x10')]+_0x40856f[_0xbf94('0x11')]+_0x40856f[_0xbf94('0x12')]+_0x40856f[_0xbf94('0x13')]+_0x40856f['countagentrejectretry'];this['countnosuchnumberretry']=_0x40856f[_0xbf94('0x10')];this[_0xbf94('0x11')]=_0x40856f['countdropretry'];this['countabandonedretry']=_0x40856f[_0xbf94('0x12')];this[_0xbf94('0x13')]=_0x40856f[_0xbf94('0x13')];this[_0xbf94('0x14')]=_0x40856f['countagentrejectretry'];this[_0xbf94('0x15')]=_0x19d49f['uniqueid'];this['calleridname']=_0x40856f['name'];this[_0xbf94('0x16')]=_0x40856f[_0xbf94('0x17')];this[_0xbf94('0x18')]=_0x40856f[_0xbf94('0x18')];this[_0xbf94('0x19')]=_0x40856f[_0xbf94('0x19')];this['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xbf94('0x1a')]=getSeconds(_0x40856f['responsetime'],_0x40856f['starttime']);this[_0xbf94('0x1b')]=0x0;this['talktime']=getSeconds(this[_0xbf94('0x1c')],_0x40856f['responsetime']);this[_0xbf94('0x1d')]=_0x40856f[_0xbf94('0x1d')];this[_0xbf94('0x1e')]=_0xbf94('0x1f');this[_0xbf94('0x20')]=_0x19d49f[_0xbf94('0x21')];this[_0xbf94('0x22')]=_0x40856f[_0xbf94('0x22')];this[_0xbf94('0x23')]=_0x40856f[_0xbf94('0x23')];this[_0xbf94('0x24')]=_0x40856f[_0xbf94('0x24')];this[_0xbf94('0x25')]=_0x40856f[_0xbf94('0x25')];this[_0xbf94('0x26')]=_0x40856f[_0xbf94('0x26')];this['ListId']=_0x40856f[_0xbf94('0x27')];this[_0xbf94('0x28')]=_0x40856f[_0xbf94('0x28')];this[_0xbf94('0x29')]=_0x40856f['VoiceQueueId'];this[_0xbf94('0x2a')]=_0x40856f['CampaignId'];}module[_0xbf94('0x2b')]=Hangup; \ No newline at end of file +var _0x86a0=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','seconds','state','statedesc','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','IVR','reason','callbackuniqueid','callbackat','recallme'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x86a0,0x133));var _0x086a=function(_0x204052,_0x586ca9){_0x204052=_0x204052-0x0;var _0x15e452=_0x86a0[_0x204052];return _0x15e452;};'use strict';var util=require(_0x086a('0x0'));var _=require(_0x086a('0x1'));var moment=require(_0x086a('0x2'));function getSeconds(_0x2dceeb,_0xea9a5e){var _0x30a76e=moment(_0x2dceeb)['milliseconds'](0x0);var _0x4604e3=moment(_0xea9a5e)[_0x086a('0x3')](0x0);return _0x30a76e['diff'](_0x4604e3,_0x086a('0x4'));}function Hangup(_0x598ffd,_0x4fb9bc){this[_0x086a('0x5')]=0x4;this[_0x086a('0x6')]='Answer';this[_0x086a('0x7')]=_0x598ffd[_0x086a('0x7')];this[_0x086a('0x8')]=_0x598ffd[_0x086a('0x8')];this['campaigntype']=_0x598ffd[_0x086a('0x8')]==='outbound'?'queue':_0x598ffd[_0x086a('0x8')];this['countbusyretry']=_0x598ffd[_0x086a('0x9')];this[_0x086a('0xa')]=_0x598ffd[_0x086a('0xa')];this[_0x086a('0xb')]=_0x598ffd[_0x086a('0xb')];this[_0x086a('0xc')]=_0x598ffd['countbusyretry']+_0x598ffd[_0x086a('0xa')]+_0x598ffd[_0x086a('0xb')]+_0x598ffd['countnosuchnumberretry']+_0x598ffd[_0x086a('0xd')]+_0x598ffd['countabandonedretry']+_0x598ffd[_0x086a('0xe')]+_0x598ffd[_0x086a('0xf')];this[_0x086a('0x10')]=_0x598ffd['countnosuchnumberretry'];this['countdropretry']=_0x598ffd[_0x086a('0xd')];this[_0x086a('0x11')]=_0x598ffd[_0x086a('0x11')];this[_0x086a('0xe')]=_0x598ffd[_0x086a('0xe')];this[_0x086a('0xf')]=_0x598ffd[_0x086a('0xf')];this['uniqueid']=_0x4fb9bc[_0x086a('0x12')];this['calleridname']=_0x598ffd[_0x086a('0x13')];this[_0x086a('0x14')]=_0x598ffd[_0x086a('0x15')];this[_0x086a('0x16')]=_0x598ffd['starttime'];this['responsetime']=_0x598ffd[_0x086a('0x17')];this[_0x086a('0x18')]=moment()[_0x086a('0x19')](_0x086a('0x1a'));this[_0x086a('0x1b')]=getSeconds(_0x598ffd[_0x086a('0x17')],_0x598ffd[_0x086a('0x16')]);this[_0x086a('0x1c')]=0x0;this[_0x086a('0x1d')]=getSeconds(this[_0x086a('0x18')],_0x598ffd[_0x086a('0x17')]);this[_0x086a('0x1e')]=_0x598ffd['queue'];this[_0x086a('0x1f')]=_0x086a('0x20');this[_0x086a('0x21')]=_0x4fb9bc['cause-txt'];this['callback']=_0x598ffd['callback'];this[_0x086a('0x22')]=_0x598ffd[_0x086a('0x22')];this[_0x086a('0x23')]=_0x598ffd[_0x086a('0x23')];this[_0x086a('0x24')]=_0x598ffd['recallme'];this[_0x086a('0x25')]=_0x598ffd[_0x086a('0x25')];this[_0x086a('0x26')]=_0x598ffd[_0x086a('0x26')];this[_0x086a('0x27')]=_0x598ffd[_0x086a('0x27')];this[_0x086a('0x28')]=_0x598ffd[_0x086a('0x28')];this['CampaignId']=_0x598ffd[_0x086a('0x29')];}module[_0x086a('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index c35413b..8708d83 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 _0x4876=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number','responsetime','endtime','ringtime','starttime','holdtime'];(function(_0x22586c,_0x296284){var _0x258c0f=function(_0x18a14b){while(--_0x18a14b){_0x22586c['push'](_0x22586c['shift']());}};_0x258c0f(++_0x296284);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x6487('0x0'));function getSeconds(_0x51b8e9,_0x502614){var _0x236189=moment(_0x51b8e9)['milliseconds'](0x0);var _0x43e7e8=moment(_0x502614)[_0x6487('0x1')](0x0);return _0x236189[_0x6487('0x2')](_0x43e7e8,_0x6487('0x3'));}function History(_0x57d99d){this[_0x6487('0x4')]=_0x57d99d[_0x6487('0x4')];this['scheduledat']=_0x57d99d[_0x6487('0x5')]||undefined;this[_0x6487('0x6')]=_0x57d99d[_0x6487('0x6')];this[_0x6487('0x7')]=_0x57d99d[_0x6487('0x6')]===_0x6487('0x8')?_0x6487('0x9'):_0x57d99d[_0x6487('0x6')];this[_0x6487('0xa')]=_0x57d99d['countbusyretry'];this[_0x6487('0xb')]=_0x57d99d[_0x6487('0xb')];this[_0x6487('0xc')]=_0x57d99d[_0x6487('0xc')];this[_0x6487('0xd')]=_0x57d99d[_0x6487('0xa')]+_0x57d99d[_0x6487('0xb')]+_0x57d99d[_0x6487('0xc')]+_0x57d99d['countnosuchnumberretry']+_0x57d99d[_0x6487('0xe')]+_0x57d99d[_0x6487('0xf')]+_0x57d99d[_0x6487('0x10')]+_0x57d99d[_0x6487('0x11')];this['countnosuchnumberretry']=_0x57d99d[_0x6487('0x12')];this[_0x6487('0xe')]=_0x57d99d[_0x6487('0xe')];this[_0x6487('0xf')]=_0x57d99d['countabandonedretry'];this['countmachineretry']=_0x57d99d[_0x6487('0x10')];this['countagentrejectretry']=_0x57d99d[_0x6487('0x11')];this['queue']=_0x57d99d[_0x6487('0x9')];this[_0x6487('0x13')]=_0x57d99d[_0x6487('0x14')];this[_0x6487('0x15')]=_0x57d99d[_0x6487('0x16')];this['starttime']=_0x57d99d['starttime'];this['responsetime']=_0x57d99d[_0x6487('0x17')];this[_0x6487('0x18')]=_0x57d99d[_0x6487('0x17')];this[_0x6487('0x19')]=getSeconds(_0x57d99d[_0x6487('0x17')],_0x57d99d[_0x6487('0x1a')]);this[_0x6487('0x1b')]=0x0;this[_0x6487('0x1c')]=0x0;this[_0x6487('0x1d')]=_0x57d99d[_0x6487('0x1d')];this[_0x6487('0x1e')]=_0x57d99d[_0x6487('0x1e')];this[_0x6487('0x1f')]=_0x57d99d[_0x6487('0x1f')];this[_0x6487('0x20')]=_0x57d99d[_0x6487('0x20')];this[_0x6487('0x21')]=_0x57d99d[_0x6487('0x21')];this[_0x6487('0x22')]=_0x57d99d['ListId'];this['UserId']=_0x57d99d[_0x6487('0x23')];this['VoiceQueueId']=_0x57d99d['VoiceQueueId'];this[_0x6487('0x24')]=_0x57d99d[_0x6487('0x24')];this['originatecalleridnum']=_0x57d99d[_0x6487('0x25')]||'';this[_0x6487('0x26')]=_0x57d99d[_0x6487('0x26')]||'';}module[_0x6487('0x27')]=History; \ No newline at end of file +var _0xbcc2=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbcc2,0xdb));var _0x2bcc=function(_0x3ddcb6,_0x53c8a9){_0x3ddcb6=_0x3ddcb6-0x0;var _0x27fdd6=_0xbcc2[_0x3ddcb6];return _0x27fdd6;};'use strict';var util=require(_0x2bcc('0x0'));var _=require(_0x2bcc('0x1'));var moment=require(_0x2bcc('0x2'));function getSeconds(_0x4e689e,_0x2636f2){var _0x5bffe5=moment(_0x4e689e)[_0x2bcc('0x3')](0x0);var _0x49ca18=moment(_0x2636f2)['milliseconds'](0x0);return _0x5bffe5['diff'](_0x49ca18,_0x2bcc('0x4'));}function History(_0x9346ac){this['uniqueid']=_0x9346ac[_0x2bcc('0x5')];this[_0x2bcc('0x6')]=_0x9346ac[_0x2bcc('0x6')]||undefined;this['type']=_0x9346ac[_0x2bcc('0x7')];this[_0x2bcc('0x8')]=_0x9346ac[_0x2bcc('0x7')]===_0x2bcc('0x9')?_0x2bcc('0xa'):_0x9346ac[_0x2bcc('0x7')];this[_0x2bcc('0xb')]=_0x9346ac['countbusyretry'];this[_0x2bcc('0xc')]=_0x9346ac['countcongestionretry'];this[_0x2bcc('0xd')]=_0x9346ac[_0x2bcc('0xd')];this['countglobal']=_0x9346ac['countbusyretry']+_0x9346ac[_0x2bcc('0xc')]+_0x9346ac['countnoanswerretry']+_0x9346ac['countnosuchnumberretry']+_0x9346ac[_0x2bcc('0xe')]+_0x9346ac[_0x2bcc('0xf')]+_0x9346ac[_0x2bcc('0x10')]+_0x9346ac['countagentrejectretry'];this[_0x2bcc('0x11')]=_0x9346ac[_0x2bcc('0x11')];this[_0x2bcc('0xe')]=_0x9346ac[_0x2bcc('0xe')];this['countabandonedretry']=_0x9346ac[_0x2bcc('0xf')];this[_0x2bcc('0x10')]=_0x9346ac['countmachineretry'];this[_0x2bcc('0x12')]=_0x9346ac[_0x2bcc('0x12')];this[_0x2bcc('0xa')]=_0x9346ac[_0x2bcc('0xa')];this[_0x2bcc('0x13')]=_0x9346ac[_0x2bcc('0x14')];this[_0x2bcc('0x15')]=_0x9346ac[_0x2bcc('0x16')];this[_0x2bcc('0x17')]=_0x9346ac[_0x2bcc('0x17')];this[_0x2bcc('0x18')]=_0x9346ac[_0x2bcc('0x18')];this[_0x2bcc('0x19')]=_0x9346ac[_0x2bcc('0x18')];this[_0x2bcc('0x1a')]=getSeconds(_0x9346ac['responsetime'],_0x9346ac[_0x2bcc('0x17')]);this[_0x2bcc('0x1b')]=0x0;this[_0x2bcc('0x1c')]=0x0;this['callback']=_0x9346ac[_0x2bcc('0x1d')];this[_0x2bcc('0x1e')]=_0x9346ac[_0x2bcc('0x1e')];this['callbackat']=_0x9346ac['callbackat'];this[_0x2bcc('0x1f')]=_0x9346ac[_0x2bcc('0x1f')];this['ContactId']=_0x9346ac[_0x2bcc('0x20')];this[_0x2bcc('0x21')]=_0x9346ac['ListId'];this[_0x2bcc('0x22')]=_0x9346ac['UserId'];this['VoiceQueueId']=_0x9346ac['VoiceQueueId'];this[_0x2bcc('0x23')]=_0x9346ac[_0x2bcc('0x23')];this[_0x2bcc('0x24')]=_0x9346ac['originatecalleridnum']||'';this[_0x2bcc('0x25')]=_0x9346ac[_0x2bcc('0x25')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index f579f89..bbd043f 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 _0x1106=['stringify','format','voice:queue:%s','voice_queue:save','ivr','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','merge','diff','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','starttime','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','hasOwnProperty','sequence','isNil','Action','status','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','pick','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','active','SIP/%s','reachable','uniqueid','variable','exten','xcally-motion-dialer','dialAMDActive','state','HangupInAMD','membername','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[rescheduleContact][Machine]','value','HANGUP','AMD','[syncHangupInAMDIvr][createHistory]','amd','countnosuchnumberretry','stateGlobal','reason19\x20machine....','createStateFinal','syncHangup','[syncHangupIvr][createHistory]','dialQueueProject','cause-txt','Unknow','[syncHangupIvr]','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','Drop','dropreason','TIMEOUT','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','endtime','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','roundrobin','paused','stateinterface','locked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','length','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','iftime\x20%s,%s','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialMethod','dialGlobalInterval','dialTimezone','syncCampaigns','[syncCampaigns]','pow','random','match','originate','voiceQueue\x20is\x20undefine','phone','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','getCaller','XMD-AMDINITIALSILENCE','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','object','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','busy','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','reason','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','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(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','checkContactBlack','[getContactCampaign2]','dialLimitQueue','ACTIVE','[getContactDialer2]','tryOriginatePredictive','not_inuse','checkIsBlackList','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','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]','Umin\x20=\x20','exports','util','bluebird','uuid','moment','md5','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','syncQueueSummary','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./final','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','milliseconds','seconds','emit','type','outbound','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','Trunk','callerid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1106,0x1a2));var _0x6110=function(_0x13a040,_0x58789a){_0x13a040=_0x13a040-0x0;var _0x2543e2=_0x1106[_0x13a040];return _0x2543e2;};'use strict';var util=require(_0x6110('0x0'));var _=require('lodash');var BPromise=require(_0x6110('0x1'));var uuid=require(_0x6110('0x2'));var moment=require(_0x6110('0x3'));var rr=require('rr');var md5=require(_0x6110('0x4'));var Redis=require('ioredis');var ut=require(_0x6110('0x5'));var config=require(_0x6110('0x6'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0x6110('0x7'))(_0x6110('0x8'));var loggerPredictive=require('../../../config/logger')(_0x6110('0x9'));var loggerPredictiveCalls=require(_0x6110('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x6110('0x7'))(_0x6110('0xa'));var ami=require('../ami');config['redis']=_[_0x6110('0xb')](config[_0x6110('0xc')],{'host':_0x6110('0xd'),'port':0x18eb});var io=require(_0x6110('0xe'))(new Redis(config[_0x6110('0xc')]));var cmHopper=require(_0x6110('0xf'));var cmHopperFinal=require(_0x6110('0x10'));var cmHopperHistory=require(_0x6110('0x11'));var cmHopperBlack=require(_0x6110('0x12'));var voiceQueueRt=require(_0x6110('0x13'));var Action=require('./action');var History=require('./history');var Final=require(_0x6110('0x14'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x6110('0x15'));var ipAgi=process[_0x6110('0x16')][_0x6110('0x17')]||_0x6110('0x18');var strategy={'rrmemory':_0x6110('0x19'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x6110('0x1a')][_0x6110('0x1b')]=function(_0x92c5a6){this[_0x6110('0x1c')]=this[_0x6110('0x1c')]?this[_0x6110('0x1c')][_0x6110('0x1d')](_0x92c5a6):_0x92c5a6();};function Dialer(_0x4bf9c2,_0x42f48f){this['sequence']=new Sequence();this[_0x6110('0x1e')]=_0x42f48f;this[_0x6110('0x1f')]=_0x4bf9c2[_0x6110('0x1f')];this[_0x6110('0x20')]=_0x4bf9c2[_0x6110('0x20')];this['agents']=_0x4bf9c2[_0x6110('0x21')];this[_0x6110('0x22')]=_0x4bf9c2[_0x6110('0x22')];this[_0x6110('0x23')]=config[_0x6110('0x23')]||0x2;this[_0x6110('0x24')]={};this[_0x6110('0x25')]={};this[_0x6110('0x26')]={};this[_0x6110('0x27')]={};this['optionPredictive']={};this[_0x6110('0x28')]={};this[_0x6110('0x29')]={};this[_0x6110('0x2a')]={};this[_0x6110('0x2b')]={};this['queueBookedRR']={};ami['on'](_0x6110('0x2c'),this[_0x6110('0x2d')][_0x6110('0x2e')](this));ami['on'](_0x6110('0x2f'),this[_0x6110('0x30')][_0x6110('0x2e')](this));ami['on'](_0x6110('0x31'),this[_0x6110('0x32')][_0x6110('0x2e')](this));ami['on']('agentcomplete',this[_0x6110('0x33')][_0x6110('0x2e')](this));ami['on'](_0x6110('0x34'),this[_0x6110('0xa')][_0x6110('0x2e')](this));ami['on'](_0x6110('0x35'),this['syncHangup'][_0x6110('0x2e')](this));ami['on'](_0x6110('0x36'),this[_0x6110('0x37')][_0x6110('0x2e')](this));ami['on'](_0x6110('0x38'),this[_0x6110('0x39')][_0x6110('0x2e')](this));ami['on'](_0x6110('0x3a'),this[_0x6110('0x3b')][_0x6110('0x2e')](this));ami['on'](_0x6110('0x3c'),this[_0x6110('0x3d')][_0x6110('0x2e')](this));this[_0x6110('0x3e')]();this['loopClearZombieChannels']();}function isNotNull(_0x38f2b9){return _0x38f2b9!==null&&!_[_0x6110('0x3f')](_0x38f2b9);}function checkIsLoggedIn(_0x4a592f,_0x42884a){return function(){if(_0x42884a<=0x0){_0x4a592f[_0x6110('0x40')]=_0x6110('0x41');throw _0x4a592f['name']+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x3980fd){return _0x3980fd;}function checkIsActive(_0x1f5114,_0x1cfadd){return function(){if(!isActive(_0x1cfadd)){_0x1f5114[_0x6110('0x40')]='NOT_ACTIVE';throw _0x1f5114[_0x6110('0x42')]+_0x6110('0x43');}};}function checkInterval(_0x1780f3){return function(){if(!isNotNull(_0x1780f3[_0x6110('0x44')])){_0x1780f3[_0x6110('0x40')]=_0x6110('0x45');throw _0x1780f3[_0x6110('0x42')]+_0x6110('0x46');}if(!isNotNull(_0x1780f3['Interval'][_0x6110('0x47')])){_0x1780f3[_0x6110('0x40')]=_0x6110('0x45');throw _0x1780f3[_0x6110('0x42')]+_0x6110('0x46');}if(!isNotNull(_[_0x6110('0x48')](_0x1780f3[_0x6110('0x44')][_0x6110('0x47')]))){_0x1780f3[_0x6110('0x40')]=_0x6110('0x45');throw _0x1780f3['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x311fee,_0x217ead,_0x47fc73){return{'action':_0x311fee,'response':_0x217ead,'message':_0x47fc73,'stack':_0x47fc73};}function myreject(_0x172ab6){return function(_0xaf7bf7){return _0x172ab6(msgResponse(_0x6110('0x49'),_0x6110('0x4a'),JSON['stringify'](_0xaf7bf7)));};}function getSeconds(_0x28bf71,_0x5a2b20){var _0x5d9af7=moment(_0x28bf71)[_0x6110('0x4b')](0x0);var _0x4cd032=moment(_0x5a2b20)['milliseconds'](0x0);return _0x5d9af7['diff'](_0x4cd032,_0x6110('0x4c'));}function emit(_0x35ece3,_0x5c69f5,_0x1ba7d9){io['to'](_0x35ece3)[_0x6110('0x4d')](_0x5c69f5,_0x1ba7d9);}function emitVoiceQueueSummary(_0x32088c){if(_0x32088c[_0x6110('0x4e')]===_0x6110('0x4f')){var _0x3029c9={'id':_0x32088c['id'],'name':_0x32088c[_0x6110('0x42')],'strategy':_0x32088c['strategy'],'answered':_0x32088c[_0x6110('0x50')],'available':_0x32088c[_0x6110('0x51')],'loggedIn':_0x32088c[_0x6110('0x52')],'pTalking':_0x32088c[_0x6110('0x53')],'sumBillable':_0x32088c['sumBillable'],'sumDuration':_0x32088c[_0x6110('0x54')],'sumHoldTime':_0x32088c[_0x6110('0x55')]||0x0,'talking':_0x32088c['talking'],'total':_0x32088c[_0x6110('0x56')],'type':_0x32088c[_0x6110('0x4e')],'unmanaged':_0x32088c[_0x6110('0x57')],'abandoned':_0x32088c[_0x6110('0x58')],'waiting':_0x32088c[_0x6110('0x59')],'loggedInDb':_0x32088c[_0x6110('0x5a')],'dialActive':_0x32088c[_0x6110('0x5b')],'dialMethod':_0x32088c['dialMethod'],'dialOriginateCallerIdName':_0x32088c[_0x6110('0x5c')],'dialOriginateCallerIdNumber':_0x32088c['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x32088c[_0x6110('0x5d')],'dialPrefix':_0x32088c[_0x6110('0x5e')],'outboundAnswerAgiCallsDay':_0x32088c[_0x6110('0x5f')],'outboundAnswerCallsDay':_0x32088c[_0x6110('0x60')],'outboundBlacklistCallsDay':_0x32088c[_0x6110('0x61')],'outboundBusyCallsDay':_0x32088c[_0x6110('0x62')],'outboundCongestionCallsDay':_0x32088c[_0x6110('0x63')],'outboundDropCallsDayACS':_0x32088c[_0x6110('0x64')],'outboundDropCallsDayCallersExit':_0x32088c[_0x6110('0x65')],'outboundDropCallsDayTimeout':_0x32088c[_0x6110('0x66')],'outboundNoAnswerCallsDay':_0x32088c[_0x6110('0x67')],'outboundNoSuchCallsDay':_0x32088c[_0x6110('0x68')],'outboundOriginateFailureCallsDay':_0x32088c['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x32088c[_0x6110('0x69')],'outboundRejectCallsDay':_0x32088c[_0x6110('0x6a')],'outboundUnknownCallsDay':_0x32088c[_0x6110('0x6b')],'predictiveIntervalAnsweredCalls':_0x32088c[_0x6110('0x6c')],'predictiveIntervalAvgHoldtime':_0x32088c[_0x6110('0x6d')],'predictiveIntervalAvgTalktime':_0x32088c[_0x6110('0x6e')],'predictiveIntervalDroppedCallsCallersExit':_0x32088c['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x32088c[_0x6110('0x6f')],'predictiveIntervalErlangCalls':_0x32088c[_0x6110('0x70')],'predictiveIntervalErlangCallsDroppedCalls':_0x32088c[_0x6110('0x71')],'predictiveIntervalHitRate':_0x32088c[_0x6110('0x72')],'predictiveIntervalMultiplicativeFactor':_0x32088c['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x32088c[_0x6110('0x73')],'predictiveIntervalAvailable':_0x32088c[_0x6110('0x74')],'predictiveIntervalTotalCalls':_0x32088c[_0x6110('0x75')],'message':_0x32088c[_0x6110('0x40')],'originated':_0x32088c[_0x6110('0x76')],'erlangCalls':_0x32088c['erlangCalls'],'erlangCallToSecond':_0x32088c[_0x6110('0x77')],'erlangAbandonmentRate':_0x32088c['erlangAbandonmentRate'],'erlangBusyFactor':_0x32088c['erlangBusyFactor'],'startPredictive':_0x32088c[_0x6110('0x28')],'startProgressive':_0x32088c['startProgressive']};if(_0x32088c['Trunk']){_0x3029c9[_0x6110('0x78')]={'id':_0x32088c['Trunk']['id'],'name':_0x32088c[_0x6110('0x78')][_0x6110('0x42')],'active':_0x32088c[_0x6110('0x78')]['active'],'callerid':_0x32088c['Trunk'][_0x6110('0x79')]};}if(_0x32088c[_0x6110('0x44')]){_0x3029c9['Interval']={'id':_0x32088c[_0x6110('0x44')]['id'],'name':_0x32088c[_0x6110('0x44')][_0x6110('0x42')]};}var _0x5da681=md5(JSON[_0x6110('0x7a')](_0x3029c9));if(_0x32088c[_0x6110('0x4')]!==_0x5da681){_0x32088c['md5']=_0x5da681;emit(util[_0x6110('0x7b')](_0x6110('0x7c'),_0x3029c9[_0x6110('0x42')]),_0x6110('0x7d'),_0x3029c9);}}}function emitCampaignSummary(_0x18b881){if(_0x18b881['type']===_0x6110('0x7e')){emit(util[_0x6110('0x7b')]('campaign:ivr:%s',_0x18b881[_0x6110('0x42')]),_0x6110('0x7f'),_0x18b881);}}function checkGetDataPredictive(_0x576d7a){if(isNotNull(_0x576d7a)){if(!_['isEmpty'](_0x576d7a)){loggerPredictive[_0x6110('0x80')](_0x6110('0x81'));loggerPredictive[_0x6110('0x80')](_0x6110('0x82'),_0x576d7a['predictiveIntervalTotalCalls']);loggerPredictive[_0x6110('0x80')](_0x6110('0x83'),_0x576d7a['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x6110('0x84'),_0x576d7a[_0x6110('0x6f')]);loggerPredictive[_0x6110('0x80')](_0x6110('0x85'),_0x576d7a[_0x6110('0x86')]);loggerPredictive[_0x6110('0x80')](_0x6110('0x87'),_0x576d7a[_0x6110('0x6d')]);loggerPredictive[_0x6110('0x80')](_0x6110('0x88'),_0x576d7a[_0x6110('0x6e')]);loggerPredictive[_0x6110('0x80')](_0x6110('0x89'));if(_0x576d7a[_0x6110('0x75')]>0x0){if(!_['isUndefined'](_0x576d7a['predictiveIntervalAvgTalktime'])&&_0x576d7a[_0x6110('0x6e')]>0x0){return!![];}else{loggerPredictive[_0x6110('0x80')](_0x6110('0x8a'));}if(!_[_0x6110('0x3f')](_0x576d7a[_0x6110('0x6d')])&&_0x576d7a[_0x6110('0x6d')]>0x0){return!![];}else{loggerPredictive[_0x6110('0x80')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x6110('0x80')](_0x6110('0x8b'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x48b9fa){return function(_0x5bcdfd){loggerPredictive[_0x6110('0x80')](_0x6110('0x8c'));loggerPredictive[_0x6110('0x80')](_0x6110('0x8d'),_0x5bcdfd[_0x6110('0x8e')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5bcdfd[_0x6110('0x77')]);loggerPredictive[_0x6110('0x80')](_0x6110('0x8f'),_0x5bcdfd[_0x6110('0x90')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5bcdfd[_0x6110('0x91')]);loggerPredictive[_0x6110('0x80')](_0x6110('0x8f'),_0x5bcdfd[_0x6110('0x90')]);loggerPredictive[_0x6110('0x80')](_0x6110('0x89'));_[_0x6110('0x92')](_0x48b9fa,_0x5bcdfd);};}function getDiff(_0x4164ac){var _0x39157c=moment()['milliseconds'](0x0);var _0x34b094=moment(_0x4164ac)[_0x6110('0x4b')](0x0);return _0x39157c[_0x6110('0x93')](_0x34b094,_0x6110('0x4c'));}function ifInterval(_0x13856c,_0x805d8f){if(_[_0x6110('0x3f')](_0x805d8f)){return![];}if(getDiff(_0x805d8f)<_0x13856c*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x3cb7b1){if(isNotNull(_0x3cb7b1)){if(!_['isUndefined'](_0x3cb7b1['startProgressive'])){_0x3cb7b1[_0x6110('0x29')]=undefined;loggerPredictive[_0x6110('0x80')](_0x3cb7b1[_0x6110('0x42')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x6110('0x3f')](_0x3cb7b1[_0x6110('0x28')])){_0x3cb7b1[_0x6110('0x28')]=undefined;loggerPredictive[_0x6110('0x80')](_0x3cb7b1[_0x6110('0x42')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x6110('0x3f')](_0x3cb7b1['handlePredictive'])){clearInterval(_0x3cb7b1['handlePredictive']);_0x3cb7b1[_0x6110('0x94')]=undefined;loggerPredictive[_0x6110('0x80')](_0x3cb7b1['name'],_0x6110('0x95'));}}}function erlangb(_0x3bd8ab,_0x1d9048){if(_0x1d9048===0x0){return 0x0;}var _0x83071c=0x1;for(var _0x232ee5=0x1;_0x232ee5<=_0x1d9048;_0x232ee5+=0x1){_0x83071c=0x1+_0x83071c*_0x232ee5/_0x3bd8ab;}return 0x1/_0x83071c;}function isVoiceQueueOutbound(_0x33f813){return _0x33f813===_0x6110('0x4f');}function isNotPreview(_0x4ce244){return _0x4ce244!==_0x6110('0x1e');}function isCampaignIvr(_0x5f4403){return _0x5f4403===_0x6110('0x7e');}function getCallerId(_0x1b14b9,_0x6f3c64,_0x3108a6){if(!_[_0x6110('0x3f')](_0x3108a6)&&'string'===typeof _0x3108a6&&!_['isEmpty'](_0x3108a6)){if(!_[_0x6110('0x3f')](_0x6f3c64)&&_0x6110('0x96')===typeof _0x6f3c64&&!_[_0x6110('0x48')](_0x6f3c64)){return util[_0x6110('0x7b')]('\x22%s\x22\x20<%s>',_0x6f3c64,_0x3108a6);}return util[_0x6110('0x7b')](_0x6110('0x97'),_0x3108a6,_0x3108a6);}if(!_[_0x6110('0x3f')](_0x1b14b9)&&_0x6110('0x96')===typeof _0x1b14b9&&!_[_0x6110('0x48')](_0x1b14b9)){return _0x1b14b9;}return _0x6110('0x98');}function loggerCatchQueueSummary(_0x47a1b9,_0x2f84fd){return function(_0x5287ee){freeVariablesPredictive(_0x2f84fd);emitVoiceQueueSummary(_0x2f84fd);emitCampaignSummary(_0x2f84fd);loggerSyncQueueSummary[_0x6110('0x99')](_0x47a1b9,util[_0x6110('0x9a')](_0x5287ee,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x409173,_0x1d5e66){return function(_0x5433b4){loggerPredictive[_0x6110('0x99')](_0x1d5e66[_0x6110('0x42')],_0x409173);loggerPredictive[_0x6110('0x99')](_0x5433b4[_0x6110('0x9b')]);freeVariablesPredictive(_0x1d5e66);};}function loggerCatch(_0x14169f){return function(_0x430bdf){logger[_0x6110('0x99')](_0x14169f,util[_0x6110('0x9a')](_0x430bdf,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x5b0cd8){return _0x5b0cd8&&!_[_0x6110('0x3f')](_0x5b0cd8)&&_0x5b0cd8['length']>0x0;}function decremetOriginate(_0x5c8828){if(!_[_0x6110('0x3f')](_0x5c8828)&&_0x5c8828!==null){if(_0x5c8828['hasOwnProperty'](_0x6110('0x76'))){if(_0x5c8828[_0x6110('0x76')]>0x0){_0x5c8828[_0x6110('0x76')]-=0x1;}else{logger['error'](_0x6110('0x9c'));}}}else{logger[_0x6110('0x99')](_0x6110('0x9d'));}}function checkContactLowerLimitOriginate(_0x3d28dd,_0x1f6205,_0x1d0fc8){if(_0x1f6205>_0x1d0fc8){for(var _0x42b0ff=0x0;_0x42b0ff<_0x1f6205-_0x1d0fc8;_0x42b0ff+=0x1){decremetOriginate(_0x3d28dd);}}}function loggerGetContactDialer(_0x1c5683,_0x21617,_0x22d5a4){return function(_0x5531c5){checkContactLowerLimitOriginate(_0x21617,_0x22d5a4,0x0);logger['error'](_0x1c5683,util[_0x6110('0x9a')](_0x5531c5,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xd69a96){return function(_0x2c519d){if(isNotNull(_0x2c519d)&&isNotNull(_0x2c519d[0x0])){if(_0x2c519d[0x0][_0x6110('0x9e')]>0x0){_0xd69a96[_0x6110('0x40')]='RESCHEDULED_CONTACTS';logger[_0x6110('0x80')]('[getContactDialer2][ReScheduled]'+_0xd69a96[_0x6110('0x42')],_0x2c519d[0x0][_0x6110('0x9e')],'contacts');}else{_0xd69a96[_0x6110('0x40')]=_0x6110('0x9f');logger[_0x6110('0x80')](_0x6110('0xa0')+_0xd69a96['name']);}}};}function notSendMessagesQueue(_0x415677){if(_0x415677[_0x6110('0xa1')]){freeVariablesPredictive(_0x415677);if(_0x415677[_0x6110('0x76')]===0x0&&_0x415677[_0x6110('0xa2')]===0x0&&_0x415677['waiting']===0x0&&(_0x415677[_0x6110('0x53')]||0x0)===0x0){_0x415677[_0x6110('0xa1')]=![];_0x415677[_0x6110('0x51')]=0x0;_0x415677[_0x6110('0x40')]=_0x6110('0xa3');loggerSyncQueueSummary[_0x6110('0x99')](_0x6110('0xa4'),_0x415677['name'],_0x6110('0xa5'));}else{_0x415677[_0x6110('0x40')]=_0x6110('0xa6');loggerSyncQueueSummary[_0x6110('0x99')](_0x6110('0xa4'),_0x415677[_0x6110('0x42')],_0x6110('0xa7'));}emitVoiceQueueSummary(_0x415677);}}function notSendMessagesCampaign(_0x298d1f){if(_0x298d1f[_0x6110('0xa1')]){if(_0x298d1f[_0x6110('0x76')]===0x0){_0x298d1f[_0x6110('0xa1')]=![];_0x298d1f[_0x6110('0x40')]=_0x6110('0xa3');loggerSyncQueueSummary[_0x6110('0x99')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x298d1f[_0x6110('0x42')],_0x6110('0xa5'));}else{_0x298d1f[_0x6110('0x40')]=_0x6110('0xa6');loggerSyncQueueSummary[_0x6110('0x99')](_0x6110('0xa8'),_0x298d1f['name'],'is\x20disactive');}emitCampaignSummary(_0x298d1f);}}function createObjHistory(_0x483b78,_0x1cf4af,_0x4ca7f7,_0x29b861,_0x3270bf){_0x483b78[_0x6110('0x40')]=_0x4ca7f7;var _0x4501fc=new Action(_0x483b78,_0x1cf4af);var _0x5435ca=new History(_0x4501fc);_0x5435ca['state']=_0x29b861;_0x5435ca[_0x6110('0xa9')]=_0x3270bf;_0x5435ca['endtime']=_0x4501fc[_0x6110('0xaa')];return _0x5435ca;}Dialer[_0x6110('0x1a')][_0x6110('0xab')]=function(){var _0x3e7035=this;setInterval(function(){_0x3e7035[_0x6110('0xac')](_0x3e7035[_0x6110('0x27')],_0x6110('0xad'));_0x3e7035[_0x6110('0xac')](_0x3e7035[_0x6110('0x25')],_0x6110('0xae'));},0x32c8);};Dialer[_0x6110('0x1a')][_0x6110('0xac')]=function(_0x47fde1,_0x1adfca){var _0x1b109d=this;for(var _0x17ca4c in _0x47fde1){if(_0x47fde1[_0x6110('0xaf')](_0x17ca4c)){this[_0x6110('0xb0')]['enqueue'](function(){if(!_[_0x6110('0xb1')](_0x47fde1[_0x17ca4c])){return ami[_0x6110('0xb2')]({'action':_0x6110('0xb3'),'channel':_0x47fde1[_0x17ca4c]['channel']})[_0x6110('0xb4')](function(_0x412c5c){if(_0x412c5c[_0x6110('0x40')]===_0x6110('0xb5')){setTimeout(function(){if(_0x47fde1[_0x17ca4c]&&_0x47fde1[_0x17ca4c]['type']!==_0x6110('0x7e')){_0x1b109d[_0x6110('0xb6')](_0x1b109d[_0x6110('0x1f')][_0x47fde1[_0x17ca4c][_0x6110('0xb7')]]);logger[_0x6110('0x99')](_0x6110('0xb8'),_0x1adfca,_0x17ca4c,_0x47fde1[_0x17ca4c][_0x6110('0xb7')]);delete _0x47fde1[_0x17ca4c];}if(_0x47fde1[_0x17ca4c]&&_0x47fde1[_0x17ca4c][_0x6110('0x4e')]===_0x6110('0x7e')){_0x1b109d[_0x6110('0xb6')](_0x1b109d[_0x6110('0x20')][_0x47fde1[_0x17ca4c][_0x6110('0xb7')]]);logger[_0x6110('0x99')](_0x6110('0xb9'),_0x1adfca,_0x17ca4c,_0x47fde1[_0x17ca4c]['queue']);delete _0x47fde1[_0x17ca4c];}},0x2328);}});}});}}};Dialer[_0x6110('0x1a')][_0x6110('0xba')]=function(_0x2ad164){return BPromise[_0x6110('0xbb')]()[_0x6110('0xbc')](cmHopper[_0x6110('0xba')](_0x2ad164))[_0x6110('0xb4')](loggerCatch(_0x6110('0xbd')));};Dialer[_0x6110('0x1a')]['checkIsBlackList']=function(_0x31e512){return BPromise[_0x6110('0xbb')]()[_0x6110('0xbc')](cmHopperBlack['checkIsBlackList'](_0x31e512))[_0x6110('0xb4')](loggerCatch(_0x6110('0xbe')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x14ab27){return BPromise[_0x6110('0xbb')]()[_0x6110('0xbc')](cmHopperBlack[_0x6110('0xbf')](_0x14ab27))['catch'](loggerCatch(_0x6110('0xc0')));};Dialer[_0x6110('0x1a')][_0x6110('0xc1')]=function(_0x1f30b3){return BPromise[_0x6110('0xbb')]()[_0x6110('0xbc')](cmHopperHistory[_0x6110('0xc2')](_0x1f30b3))[_0x6110('0xb4')](loggerCatch(_0x6110('0xc3')));};Dialer[_0x6110('0x1a')]['rescheduleContact']=function(_0x485048){return BPromise[_0x6110('0xbb')]()['then'](cmHopper[_0x6110('0xc4')](_0x485048))['catch'](loggerCatch(_0x6110('0xc5')));};Dialer[_0x6110('0x1a')][_0x6110('0xc6')]=function(_0x1c491c,_0x35129b,_0x309e4f){return BPromise[_0x6110('0xbb')]()[_0x6110('0xbc')](cmHopper[_0x6110('0xc6')](_0x1c491c,_0x35129b,_0x309e4f))[_0x6110('0xb4')](loggerCatch(_0x6110('0xc7')));};Dialer['prototype']['getContactDialer']=function(_0x2077cd,_0x366b82,_0x59b878,_0x1bb26c){return BPromise[_0x6110('0xbb')]()[_0x6110('0xbc')](cmHopper[_0x6110('0xc8')](_0x2077cd,_0x366b82,_0x59b878,_0x1bb26c))[_0x6110('0xb4')](loggerCatch(_0x6110('0xc9')));};Dialer[_0x6110('0x1a')][_0x6110('0xca')]=function(_0x159a85,_0x1e2240,_0x5fe90){return BPromise[_0x6110('0xbb')]()[_0x6110('0xbc')](cmHopper[_0x6110('0xca')](_0x159a85,_0x1e2240,_0x5fe90))[_0x6110('0xb4')](loggerCatch(_0x6110('0xc9')));};Dialer[_0x6110('0x1a')][_0x6110('0xcb')]=function(_0x21c7f9){return BPromise[_0x6110('0xbb')]()[_0x6110('0xbc')](voiceQueueRt[_0x6110('0xcb')](_0x21c7f9))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x6110('0x1a')][_0x6110('0xcc')]=function(_0x20fc4c){return BPromise[_0x6110('0xbb')]()[_0x6110('0xbc')](cmHopper['moveContactManagedDialer'](_0x20fc4c))[_0x6110('0xb4')](loggerCatch(_0x6110('0xcd')));};Dialer[_0x6110('0x1a')]['createHistory']=function(_0x2030b1){return BPromise[_0x6110('0xbb')]()[_0x6110('0xbc')](cmHopperHistory[_0x6110('0xce')](_0x2030b1))[_0x6110('0xb4')](loggerCatch(_0x6110('0xcf')));};Dialer[_0x6110('0x1a')][_0x6110('0xb6')]=function(_0x4f22ed){if(!_[_0x6110('0x3f')](_0x4f22ed)&&_0x4f22ed!==null){if(_0x4f22ed[_0x6110('0xaf')](_0x6110('0x76'))){if(_0x4f22ed[_0x6110('0x76')]>0x0){_0x4f22ed['originated']-=0x1;}else{logger[_0x6110('0x99')](_0x6110('0xd0'));}}}else{logger[_0x6110('0x99')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x6110('0x1a')][_0x6110('0xd1')]=function(_0x17c1a5,_0x20a991){var _0x3b9124=this;return function(_0x28ecd2){_0x3b9124[_0x6110('0xb6')](_0x20a991);logger[_0x6110('0x99')](_0x17c1a5,util[_0x6110('0x9a')](_0x28ecd2,{'showHidden':![],'depth':null}));};};Dialer[_0x6110('0x1a')][_0x6110('0xd2')]=function(_0x58cca1,_0x1e53c4,_0x5e1870){var _0x4e61cf={'state':0x19,'statedesc':_0x6110('0xd3')};this[_0x6110('0xb6')](_0x1e53c4);this['saveInDb'](_[_0x6110('0x92')](_0x4e61cf,_[_0x6110('0xd4')](_0x5e1870,[_0x6110('0xd5'),_0x6110('0xd6'),_0x6110('0xd7'),'VoiceQueueId',_0x6110('0xd8')])),_0x6110('0xd9'),'[emptyContact]');logger[_0x6110('0x99')](_0x58cca1);};Dialer[_0x6110('0x1a')][_0x6110('0xda')]=function(_0x264bbb){return _0x264bbb===_0x6110('0xdb');};Dialer['prototype'][_0x6110('0xdc')]=function(_0x30251a){return!_[_0x6110('0x3f')](_0x30251a)&&_0x30251a&&!_['isUndefined'](_0x30251a[_0x6110('0x42')])&&!_[_0x6110('0x3f')](_0x30251a[_0x6110('0xdd')])&&_0x30251a['active']&&(this['trunks'][util[_0x6110('0x7b')](_0x6110('0xde'),_0x30251a['name'])]['status']===_0x6110('0xdf')||this[_0x6110('0x22')][util[_0x6110('0x7b')](_0x6110('0xde'),_0x30251a[_0x6110('0x42')])][_0x6110('0xb3')]==='unmonitored');};Dialer['prototype']['saveInDb']=function(_0xb7e9a6,_0x55bc32,_0x1db023){this['createHistory'](_0xb7e9a6)[_0x6110('0xb4')](loggerCatch(_0x55bc32));this[_0x6110('0xcc')](_0xb7e9a6)[_0x6110('0xb4')](loggerCatch(_0x1db023));};Dialer['prototype']['syncVarSet']=function(_0x52700f){var _0x4050ba=this['uniqueId'][_0x52700f[_0x6110('0xe0')]];var _0x315c11;if(!_[_0x6110('0xb1')](_0x52700f)&&!_[_0x6110('0xb1')](_0x52700f[_0x6110('0xe1')])&&!_[_0x6110('0xb1')](_0x52700f[_0x6110('0xe1')]['amdstatus'])&&_0x52700f[_0x6110('0xe2')]===_0x6110('0xe3')&&_0x4050ba){if(_0x4050ba[_0x6110('0x4e')]!==_0x6110('0x7e')&&this['voiceQueues'][_0x4050ba[_0x6110('0xb7')]][_0x6110('0xe4')]&&_0x52700f['value']==='HANGUP'){delete this[_0x6110('0x27')][_0x52700f[_0x6110('0xe0')]];this[_0x6110('0xb6')](this['voiceQueues'][_0x4050ba[_0x6110('0xb7')]]);this[_0x6110('0x1f')][_0x4050ba[_0x6110('0xb7')]][_0x6110('0x60')]+=0x1;this[_0x6110('0x1f')][_0x4050ba['queue']][_0x6110('0x5f')]+=0x1;_0x315c11=new Hangup(_0x4050ba,_0x52700f);_0x315c11[_0x6110('0xe5')]=0x12;_0x315c11[_0x6110('0xa9')]=_0x6110('0xe6');_0x315c11[_0x6110('0xe7')]='AMD';this[_0x6110('0xe8')](_0x315c11,_0x6110('0xe9'),_0x6110('0xea'));}if(_0x4050ba[_0x6110('0x4e')]!==_0x6110('0x7e')&&this['voiceQueues'][_0x4050ba[_0x6110('0xb7')]][_0x6110('0xe4')]&&_0x52700f['value']===_0x6110('0xeb')){var _0x5a814e=this;return new BPromise(function(_0x279a11,_0x50e467){delete _0x5a814e[_0x6110('0x27')][_0x52700f['uniqueid']];_0x5a814e[_0x6110('0xb6')](_0x5a814e[_0x6110('0x1f')][_0x4050ba[_0x6110('0xb7')]]);_0x5a814e[_0x6110('0x1f')][_0x4050ba[_0x6110('0xb7')]]['outboundAnswerCallsDay']+=0x1;_0x5a814e['voiceQueues'][_0x4050ba[_0x6110('0xb7')]][_0x6110('0x5f')]+=0x1;var _0x4a37d0=_0x5a814e[_0x6110('0x1f')][_0x4050ba[_0x6110('0xb7')]];var _0x2bdc78=new Hangup(_0x4050ba,_0x52700f);_0x2bdc78[_0x6110('0xe5')]=0x13;_0x2bdc78[_0x6110('0xa9')]=_0x6110('0xec');_0x2bdc78[_0x6110('0xe7')]='AMD';_0x2bdc78[_0x6110('0xed')]+=0x1;_0x2bdc78[_0x6110('0xee')]+=0x1;_0x2bdc78['amd']=!![];_0x5a814e[_0x6110('0xce')](_0x2bdc78)[_0x6110('0xb4')](loggerCatch(_0x6110('0xef')));if(_0x2bdc78[_0x6110('0xf0')]+_0x2bdc78[_0x6110('0xf1')]+_0x2bdc78[_0x6110('0xf2')]+_0x2bdc78['countnosuchnumberretry']+_0x2bdc78[_0x6110('0xf3')]+_0x2bdc78[_0x6110('0xf4')]+_0x2bdc78['countmachineretry']+_0x2bdc78[_0x6110('0xf5')]>=_0x4a37d0[_0x6110('0xf6')]){_0x5a814e['stateGlobal'](_0x2bdc78,_0x279a11,_0x50e467,'reason19\x20machine....');}else{if(_0x2bdc78[_0x6110('0xed')]>=_0x4a37d0[_0x6110('0xf7')]){_0x5a814e['createStateFinal'](_0x2bdc78,_0x279a11,_0x50e467,_0x6110('0xf8'));}else{_0x5a814e['rescheduleContact']({'active':![],'countmachineretry':_0x2bdc78[_0x6110('0xed')],'scheduledat':moment()[_0x6110('0xf9')](_0x4a37d0[_0x6110('0xfa')],_0x6110('0xfb'))[_0x6110('0x7b')](_0x6110('0xfc')),'ContactId':_0x2bdc78[_0x6110('0xd5')],'ListId':_0x2bdc78[_0x6110('0xd6')],'VoiceQueueId':_0x2bdc78[_0x6110('0xfd')]||undefined,'CampaignId':_0x2bdc78['CampaignId']||undefined})[_0x6110('0xb4')](loggerCatch(_0x6110('0xfe')));_0x279a11({'reschedule':0x1});}}});}if(_0x4050ba['type']===_0x6110('0x7e')&&this[_0x6110('0x20')][_0x4050ba['queue']][_0x6110('0xe4')]&&_0x52700f[_0x6110('0xff')]===_0x6110('0x100')){delete this[_0x6110('0x27')][_0x52700f[_0x6110('0xe0')]];this['updateOriginated'](this[_0x6110('0x20')][_0x4050ba[_0x6110('0xb7')]]);_0x315c11=new Hangup(_0x4050ba,_0x52700f);_0x315c11[_0x6110('0xe5')]=0x12;_0x315c11[_0x6110('0xa9')]=_0x6110('0xe6');_0x315c11[_0x6110('0xe7')]=_0x6110('0x101');this[_0x6110('0xe8')](_0x315c11,_0x6110('0x102'),'[syncHangupInAMDIvr]');}if(_0x4050ba[_0x6110('0x4e')]===_0x6110('0x7e')&&this[_0x6110('0x20')][_0x4050ba[_0x6110('0xb7')]]['dialAMDActive']&&_0x52700f[_0x6110('0xff')]===_0x6110('0xeb')){var _0x5a814e=this;return new BPromise(function(_0x23fd56,_0x4aefd0){delete _0x5a814e[_0x6110('0x27')][_0x52700f['uniqueid']];_0x5a814e[_0x6110('0xb6')](_0x5a814e[_0x6110('0x20')][_0x4050ba[_0x6110('0xb7')]]);_0x5a814e[_0x6110('0x20')][_0x4050ba['queue']][_0x6110('0x60')]+=0x1;_0x5a814e[_0x6110('0x20')][_0x4050ba[_0x6110('0xb7')]][_0x6110('0x5f')]+=0x1;var _0x55c5f8=_0x5a814e['campaigns'][_0x4050ba[_0x6110('0xb7')]];var _0x2aaf52=new Hangup(_0x4050ba,_0x52700f);_0x2aaf52['state']=0x13;_0x2aaf52[_0x6110('0xa9')]=_0x6110('0xec');_0x2aaf52[_0x6110('0xe7')]=_0x6110('0x101');_0x2aaf52[_0x6110('0xed')]+=0x1;_0x2aaf52['countglobal']+=0x1;_0x2aaf52[_0x6110('0x103')]=!![];_0x5a814e['createHistory'](_0x2aaf52)['catch'](loggerCatch(_0x6110('0xef')));if(_0x2aaf52['countbusyretry']+_0x2aaf52['countcongestionretry']+_0x2aaf52[_0x6110('0xf2')]+_0x2aaf52[_0x6110('0x104')]+_0x2aaf52[_0x6110('0xf3')]+_0x2aaf52['countabandonedretry']+_0x2aaf52[_0x6110('0xed')]+_0x2aaf52[_0x6110('0xf5')]>=_0x55c5f8[_0x6110('0xf6')]){_0x5a814e[_0x6110('0x105')](_0x2aaf52,_0x23fd56,_0x4aefd0,_0x6110('0x106'));}else{if(_0x2aaf52[_0x6110('0xed')]>=_0x55c5f8[_0x6110('0xf7')]){_0x5a814e[_0x6110('0x107')](_0x2aaf52,_0x23fd56,_0x4aefd0,'reason\x2019\x20machine....');}else{_0x5a814e['rescheduleContact']({'active':![],'countmachineretry':_0x2aaf52[_0x6110('0xed')],'scheduledat':moment()[_0x6110('0xf9')](_0x55c5f8[_0x6110('0xfa')],_0x6110('0xfb'))[_0x6110('0x7b')](_0x6110('0xfc')),'ContactId':_0x2aaf52[_0x6110('0xd5')],'ListId':_0x2aaf52[_0x6110('0xd6')],'VoiceQueueId':_0x2aaf52[_0x6110('0xfd')]||undefined,'CampaignId':_0x2aaf52[_0x6110('0xd8')]||undefined})[_0x6110('0xb4')](loggerCatch(_0x6110('0xfe')));_0x23fd56({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x6110('0x108')]=function(_0x2f1cb1){var _0x42a5ba=this[_0x6110('0x27')][_0x2f1cb1['uniqueid']];var _0xdd558d=this;var _0x34ecdf;if(_0x42a5ba&&_0x42a5ba[_0x6110('0x4e')]===_0x6110('0x7e')){delete this[_0x6110('0x27')][_0x2f1cb1[_0x6110('0xe0')]];this[_0x6110('0xb6')](this[_0x6110('0x20')][_0x42a5ba[_0x6110('0xb7')]]);this[_0x6110('0x20')][_0x42a5ba['queue']]['ivrAnswerCallsDay']+=0x1;_0x34ecdf=new Hangup(_0x42a5ba,_0x2f1cb1);this[_0x6110('0xce')](_0x34ecdf)['catch'](loggerCatch(_0x6110('0x109')));this[_0x6110('0xcc')](_0x34ecdf)[_0x6110('0xb4')](loggerCatch('[syncHangupIvr]'));}if(_0x42a5ba&&_0x42a5ba[_0x6110('0x4e')]!==_0x6110('0x7e')&&isNotNull(this[_0x6110('0x1f')][_0x42a5ba[_0x6110('0xb7')]][_0x6110('0x10a')])){delete this[_0x6110('0x27')][_0x2f1cb1['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x42a5ba['queue']]);this[_0x6110('0x1f')][_0x42a5ba[_0x6110('0xb7')]][_0x6110('0x60')]+=0x1;this[_0x6110('0x1f')][_0x42a5ba['queue']][_0x6110('0x5f')]+=0x1;_0x34ecdf=new Hangup(_0x42a5ba,_0x2f1cb1);_0x34ecdf['state']=0x10;_0x34ecdf['statedesc']='AnswerAGI';_0x34ecdf[_0x6110('0xe7')]='AGI';this['createHistory'](_0x34ecdf)['catch'](loggerCatch(_0x6110('0x109')));this[_0x6110('0xcc')](_0x34ecdf)[_0x6110('0xb4')](loggerCatch('[syncHangupIvr]'));}if(_0x42a5ba&&_0x42a5ba['type']!=='ivr'&&!isNotNull(this[_0x6110('0x1f')][_0x42a5ba[_0x6110('0xb7')]]['dialQueueProject'])){delete this[_0x6110('0x27')][_0x2f1cb1['uniqueid']];this[_0x6110('0xb6')](this['voiceQueues'][_0x42a5ba[_0x6110('0xb7')]]);this[_0x6110('0x1f')][_0x42a5ba[_0x6110('0xb7')]][_0x6110('0x6b')]+=0x1;_0x34ecdf=new Hangup(_0x42a5ba,_0x2f1cb1);_0x34ecdf[_0x6110('0xe5')]=0xc;_0x34ecdf[_0x6110('0xa9')]=_0x2f1cb1[_0x6110('0x10b')];_0x34ecdf[_0x6110('0xe7')]=_0x6110('0x10c');this[_0x6110('0xce')](_0x34ecdf)['catch'](loggerCatch(_0x6110('0x109')));this['moveContactManagedDialer'](_0x34ecdf)[_0x6110('0xb4')](loggerCatch(_0x6110('0x10d')));}};Dialer['prototype'][_0x6110('0x33')]=function(_0x4f7ad9){var _0x384f59=this[_0x6110('0x27')][_0x4f7ad9[_0x6110('0xe0')]];var _0x37ac49=this;if(this['voiceQueues'][_0x4f7ad9[_0x6110('0xb7')]]){if(_0x384f59&&_0x384f59[_0x6110('0x4e')]!=='ivr'){delete this[_0x6110('0x27')][_0x4f7ad9[_0x6110('0xe0')]];this['voiceQueues'][_0x4f7ad9['queue']][_0x6110('0x60')]+=0x1;var _0x135c95=new AgentComplete(_0x384f59,_0x4f7ad9);if(_0x4f7ad9['reason']===_0x6110('0x10e')){_0x135c95[_0x6110('0x10f')]=this[_0x6110('0x1f')][_0x4f7ad9[_0x6110('0xb7')]][_0x6110('0x110')]&&this[_0x6110('0x1f')][_0x4f7ad9['queue']][_0x6110('0x111')]?moment()[_0x6110('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x6110('0xce')](_0x135c95)['catch'](loggerCatch(_0x6110('0x112')));this[_0x6110('0xcc')](_0x135c95)[_0x6110('0xb4')](loggerCatch(_0x6110('0x113')));}}};Dialer[_0x6110('0x1a')][_0x6110('0x2d')]=function(_0xee8b7c){if(this[_0x6110('0x1f')][_0xee8b7c['queue']]){if(this[_0x6110('0x27')][_0xee8b7c[_0x6110('0xe0')]]&&this[_0x6110('0x27')][_0xee8b7c[_0x6110('0xe0')]][_0x6110('0x4e')]!==_0x6110('0x7e')){this['updateOriginated'](this[_0x6110('0x1f')][_0xee8b7c[_0x6110('0xb7')]]);this[_0x6110('0x27')][_0xee8b7c['uniqueid']][_0x6110('0x114')]=moment()[_0x6110('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x25345f){this['createHistory'](_0x25345f)[_0x6110('0xb4')](loggerCatch(_0x6110('0x112')));this[_0x6110('0xcc')](_0x25345f)[_0x6110('0xb4')](loggerCatch(_0x6110('0x115')));};Dialer[_0x6110('0x1a')][_0x6110('0x30')]=function(_0x164cb4){var _0x571983=this[_0x6110('0x27')][_0x164cb4[_0x6110('0xe0')]];var _0x39ae7d=this;if(this[_0x6110('0x1f')][_0x164cb4[_0x6110('0xb7')]]){if(_0x571983&&_0x571983['type']!=='ivr'){delete this[_0x6110('0x27')][_0x164cb4[_0x6110('0xe0')]];this[_0x6110('0xb6')](this[_0x6110('0x1f')][_0x164cb4[_0x6110('0xb7')]]);_0x571983[_0x6110('0x116')]=moment()[_0x6110('0x7b')](_0x6110('0xfc'));var _0x33e4fe=new QueueCallerAbandon(_0x571983,_0x164cb4);if(getSeconds(_0x571983['droptime'],_0x571983[_0x6110('0x117')])>=_0x571983['dialQueueTimeout']){this[_0x6110('0x1f')][_0x164cb4[_0x6110('0xb7')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x6110('0x1f')][_0x164cb4[_0x6110('0xb7')]][_0x6110('0x66')]+=0x1;this[_0x6110('0x1f')][_0x164cb4[_0x6110('0xb7')]][_0x6110('0x71')]+=0x1;_0x33e4fe[_0x6110('0xe5')]=0xa;_0x33e4fe[_0x6110('0xa9')]=_0x6110('0x118');_0x33e4fe[_0x6110('0x119')]=_0x6110('0x11a');_0x33e4fe['agiafterat']=this[_0x6110('0x1f')][_0x164cb4[_0x6110('0xb7')]][_0x6110('0x110')]?moment()[_0x6110('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x33e4fe[_0x6110('0xf3')]+=0x1;_0x33e4fe['countglobal']+=0x1;if(_0x33e4fe['countdropretry']>=this['voiceQueues'][_0x164cb4['queue']][_0x6110('0x11b')]){this[_0x6110('0x11c')](_0x33e4fe);}else{this[_0x6110('0xc4')]({'active':![],'countdropretry':_0x33e4fe[_0x6110('0xf3')],'scheduledat':moment()[_0x6110('0xf9')](this[_0x6110('0x1f')][_0x164cb4[_0x6110('0xb7')]][_0x6110('0x11d')],'minutes')[_0x6110('0x7b')](_0x6110('0xfc')),'ContactId':_0x571983[_0x6110('0xd5')],'ListId':_0x571983['ListId'],'VoiceQueueId':_0x571983[_0x6110('0xfd')]||undefined,'CampaignId':_0x571983[_0x6110('0xd8')]||undefined})[_0x6110('0xb4')](loggerCatch('[rescheduleContact][Drop]'));var _0x4cd6c4=new History(_0x33e4fe);_0x4cd6c4['state']=0xa;_0x4cd6c4['statedesc']=_0x6110('0x118');_0x4cd6c4[_0x6110('0xaa')]=moment()[_0x6110('0x7b')](_0x6110('0xfc'));_0x4cd6c4['endtime']=_0x4cd6c4[_0x6110('0xaa')];_0x4cd6c4[_0x6110('0x11e')]=_0x33e4fe[_0x6110('0x11e')];_0x4cd6c4[_0x6110('0x11f')]=_0x33e4fe[_0x6110('0x11f')];this[_0x6110('0xce')](_0x4cd6c4)[_0x6110('0xb4')](loggerCatch(_0x6110('0x120')));}}else{this[_0x6110('0x1f')][_0x164cb4['queue']][_0x6110('0x86')]+=0x1;this[_0x6110('0x1f')][_0x164cb4[_0x6110('0xb7')]][_0x6110('0x65')]+=0x1;_0x33e4fe[_0x6110('0xe5')]=0xb;_0x33e4fe[_0x6110('0xa9')]=_0x6110('0x121');_0x33e4fe['dropreason']=_0x6110('0x122');_0x33e4fe['countabandonedretry']+=0x1;_0x33e4fe[_0x6110('0xee')]+=0x1;if(_0x33e4fe[_0x6110('0xf4')]>=this[_0x6110('0x1f')][_0x164cb4[_0x6110('0xb7')]][_0x6110('0x123')]){this[_0x6110('0x11c')](_0x33e4fe);}else{this[_0x6110('0xc4')]({'active':![],'countabandonedretry':_0x33e4fe['countabandonedretry'],'scheduledat':moment()[_0x6110('0xf9')](this[_0x6110('0x1f')][_0x164cb4[_0x6110('0xb7')]][_0x6110('0x124')],_0x6110('0xfb'))[_0x6110('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x571983[_0x6110('0xd5')],'ListId':_0x571983[_0x6110('0xd6')],'VoiceQueueId':_0x571983[_0x6110('0xfd')]||undefined,'CampaignId':_0x571983[_0x6110('0xd8')]||undefined})[_0x6110('0xb4')](loggerCatch(_0x6110('0x125')));var _0x4cd6c4=new History(_0x33e4fe);_0x4cd6c4[_0x6110('0xe5')]=0xb;_0x4cd6c4[_0x6110('0xa9')]=_0x6110('0x121');_0x4cd6c4[_0x6110('0xaa')]=moment()[_0x6110('0x7b')](_0x6110('0xfc'));_0x4cd6c4[_0x6110('0x126')]=_0x4cd6c4[_0x6110('0xaa')];_0x4cd6c4[_0x6110('0x11e')]=_0x33e4fe[_0x6110('0x11e')];_0x4cd6c4[_0x6110('0x11f')]=_0x33e4fe[_0x6110('0x11f')];this[_0x6110('0xce')](_0x4cd6c4)[_0x6110('0xb4')](loggerCatch(_0x6110('0x127')));}}}}};Dialer[_0x6110('0x1a')]['syncNewExten']=function(_0x1a7d66){if(this[_0x6110('0x25')][_0x1a7d66[_0x6110('0xe0')]]){this[_0x6110('0x25')][_0x1a7d66[_0x6110('0xe0')]][_0x6110('0x128')]=_0x1a7d66[_0x6110('0x128')];}if(this[_0x6110('0x27')][_0x1a7d66[_0x6110('0xe0')]]){this[_0x6110('0x27')][_0x1a7d66['uniqueid']]['channel']=_0x1a7d66[_0x6110('0x128')];}};Dialer['prototype'][_0x6110('0x3b')]=function(_0x43dce2){if(strategy[this[_0x6110('0x1f')][this[_0x6110('0x25')][_0x43dce2[_0x6110('0x129')]][_0x6110('0xb7')]][_0x6110('0x12a')]]===_0x6110('0x12b')){if(this['actions'][_0x43dce2['actionid']]&&_[_0x6110('0xb1')](this[_0x6110('0x25')][_0x43dce2[_0x6110('0x129')]]['locked'])&&_0x43dce2[_0x6110('0xb3')]==='1'&&_0x43dce2[_0x6110('0x12c')]==='0'){if(this['agents'][_0x43dce2[_0x6110('0x12d')]]){if(!this[_0x6110('0x21')][_0x43dce2[_0x6110('0x12d')]][_0x6110('0x12e')]){this[_0x6110('0x21')][_0x43dce2[_0x6110('0x12d')]][_0x6110('0x12e')]=!![];this['actions'][_0x43dce2[_0x6110('0x129')]][_0x6110('0x12e')]=!![];this[_0x6110('0x25')][_0x43dce2[_0x6110('0x129')]][_0x6110('0x12d')]=_0x43dce2[_0x6110('0x12d')];}}}}else if((strategy[this[_0x6110('0x1f')][this['actions'][_0x43dce2[_0x6110('0x129')]]['queue']][_0x6110('0x12a')]]||_0x6110('0x19'))==='rrmemory'){if(this[_0x6110('0x25')][_0x43dce2[_0x6110('0x129')]]){if(this['agents'][_0x43dce2['stateinterface']]){this['actions'][_0x43dce2['actionid']][_0x6110('0x12d')]=_0x43dce2['stateinterface'];if(_[_0x6110('0xb1')](this['queueBooked'][this[_0x6110('0x25')][_0x43dce2[_0x6110('0x129')]][_0x6110('0xb7')]])){this[_0x6110('0x2b')][this[_0x6110('0x25')][_0x43dce2['actionid']][_0x6110('0xb7')]]=[];}this[_0x6110('0x2b')][this[_0x6110('0x25')][_0x43dce2[_0x6110('0x129')]][_0x6110('0xb7')]][_0x6110('0x12f')](_['merge'](_[_0x6110('0xd4')](this[_0x6110('0x25')][_0x43dce2[_0x6110('0x129')]],[_0x6110('0x130'),'stateinterface']),{'status':_0x43dce2['status'],'paused':_0x43dce2[_0x6110('0x12c')]}));}}}};function unlockQueueStatus(_0x2d0ddb,_0x17d3b0){setTimeout(function(){if(_[_0x6110('0x3f')](_0x2d0ddb[_0x6110('0x131')])){loggerBooked[_0x6110('0x99')](_0x6110('0x132'),_0x17d3b0);}_0x2d0ddb['queueStatusComplete']=!![];loggerBooked[_0x6110('0x80')](_0x6110('0x133'),_0x17d3b0,JSON['stringify'](_[_0x6110('0xd4')](_0x2d0ddb,[_0x6110('0x42'),_0x6110('0x131')])));},0x1f3);}Dialer[_0x6110('0x1a')][_0x6110('0x3d')]=function(_0x511376){var _0x2f08d3=this;var _0x419a32=_0x2f08d3[_0x6110('0x1f')][_0x2f08d3[_0x6110('0x25')][_0x511376[_0x6110('0x129')]]['queue']];if(strategy[this[_0x6110('0x1f')][this[_0x6110('0x25')][_0x511376['actionid']][_0x6110('0xb7')]][_0x6110('0x12a')]]===_0x6110('0x12b')){if(this[_0x6110('0x25')][_0x511376[_0x6110('0x129')]]&&this[_0x6110('0x25')][_0x511376[_0x6110('0x129')]][_0x6110('0x12d')]){this[_0x6110('0x1e')][_0x6110('0x134')](this[_0x6110('0x25')][_0x511376['actionid']][_0x6110('0x130')],this[_0x6110('0x25')][_0x511376[_0x6110('0x129')]][_0x6110('0x12d')])[_0x6110('0xb4')](function(_0x2a6d72){logger['error'](_0x6110('0x135'),util[_0x6110('0x9a')](_0x2a6d72,{'showHidden':![],'depth':null}));})['finally'](function(){_0x2f08d3['updateOriginated'](_0x2f08d3['voiceQueues'][_0x2f08d3[_0x6110('0x25')][_0x511376[_0x6110('0x129')]]['queue']]);_0x2f08d3[_0x6110('0x21')][_0x2f08d3[_0x6110('0x25')][_0x511376[_0x6110('0x129')]][_0x6110('0x12d')]]['locked']=![];delete _0x2f08d3['actions'][_0x511376['actionid']];unlockQueueStatus(_0x419a32);});}else{this[_0x6110('0xb6')](this[_0x6110('0x1f')][this['actions'][_0x511376[_0x6110('0x129')]]['queue']]);this[_0x6110('0xc4')]({'active':![],'ContactId':this['actions'][_0x511376['actionid']][_0x6110('0xd5')],'ListId':this['actions'][_0x511376[_0x6110('0x129')]]['ListId'],'VoiceQueueId':this[_0x6110('0x25')][_0x511376['actionid']][_0x6110('0xfd')]||undefined,'CampaignId':this['actions'][_0x511376['actionid']][_0x6110('0xd8')]||undefined})['catch'](loggerCatch(_0x6110('0x136')));delete this[_0x6110('0x25')][_0x511376['actionid']];unlockQueueStatus(_0x419a32);}}else if((strategy[this[_0x6110('0x1f')][this['actions'][_0x511376[_0x6110('0x129')]][_0x6110('0xb7')]][_0x6110('0x12a')]]||_0x6110('0x19'))===_0x6110('0x19')){var _0x3898e4;if(this['actions'][_0x511376[_0x6110('0x129')]]&&!_[_0x6110('0x48')](this[_0x6110('0x2b')][this[_0x6110('0x25')][_0x511376[_0x6110('0x129')]]['queue']])){if(this[_0x6110('0x137')][_0x2f08d3['actions'][_0x511376[_0x6110('0x129')]][_0x6110('0xb7')]]){this[_0x6110('0x137')][_0x2f08d3[_0x6110('0x25')][_0x511376[_0x6110('0x129')]][_0x6110('0xb7')]]=this[_0x6110('0x137')][this[_0x6110('0x25')][_0x511376['actionid']][_0x6110('0xb7')]]?this[_0x6110('0x137')][this[_0x6110('0x25')][_0x511376[_0x6110('0x129')]][_0x6110('0xb7')]]:this[_0x6110('0x2b')][this['actions'][_0x511376[_0x6110('0x129')]]['queue']]?this['queueBooked'][this[_0x6110('0x25')][_0x511376[_0x6110('0x129')]][_0x6110('0xb7')]][_0x6110('0x138')]||0x0:0x0;}this[_0x6110('0x2b')][this[_0x6110('0x25')][_0x511376['actionid']][_0x6110('0xb7')]][_0x6110('0x138')]=this[_0x6110('0x137')][this['actions'][_0x511376[_0x6110('0x129')]][_0x6110('0xb7')]];for(var _0x30aa25=0x0;_0x30aa25=0x0?!![]:![];})[_0x6110('0xb4')](myreject(_0x4114ac)));}}else{_0x134d86['push'](ami['Action']({'action':_0x6110('0x14e'),'command':util[_0x6110('0x7b')](_0x6110('0x14f'),_0x336627,!_[_0x6110('0x3f')](config['timezones'][_0x1165af])?_0x1165af:'')})[_0x6110('0xbc')](function(_0x5cc4de){return _0x5cc4de['content'][_0x6110('0x151')](_0x6110('0x152'))>=0x0?!![]:![];})[_0x6110('0xb4')](myreject(_0x4114ac)));}BPromise[_0x6110('0x153')](_0x134d86)[_0x6110('0xbc')](function(_0x3945ff){var _0x5607fa=_['some'](_0x3945ff);if(_0x5607fa){return _0x330622(_0x5607fa);}else{_0x296a8c[_0x6110('0x40')]=_0xf99492?_0x6110('0x154'):'INTERVAL_IS_OVERTIME';return _0x4114ac(msgResponse(_0x6110('0x155'),_0x6110('0x148'),_0x6110('0x156')+_0xf99492+'\x20'+_0x2e31fb+'\x20Interval\x20is\x20overtime:\x20'+util[_0x6110('0x9a')](_0x336627,{'showHidden':![],'depth':null})+_0x6110('0x157')+_0x1165af));}})[_0x6110('0xb4')](function(_0x49a513){return _0x4114ac(msgResponse(_0x6110('0x146'),_0x6110('0x148'),JSON[_0x6110('0x7a')](_0x49a513)));});});};Dialer[_0x6110('0x1a')][_0x6110('0x158')]=function(_0x48df1e){var _0x3e2451=this;return function(){switch(_0x48df1e['dialMethod']){case _0x6110('0x159'):freeVariablesPredictive(_0x48df1e);_0x3e2451[_0x6110('0x15a')](_0x48df1e,0x1);break;case _0x6110('0x15b'):freeVariablesPredictive(_0x48df1e);_0x3e2451[_0x6110('0x15a')](_0x48df1e,_0x48df1e[_0x6110('0x15c')]);break;case _0x6110('0x9'):_0x3e2451['predictive'](_0x48df1e);break;case _0x6110('0x8'):freeVariablesPredictive(_0x48df1e);_0x3e2451[_0x6110('0x15a')](_0x48df1e,0x1);break;default:freeVariablesPredictive(_0x48df1e);logger[_0x6110('0x99')](_0x6110('0x15d'),_0x48df1e[_0x6110('0x42')],_0x6110('0x15e'));}};};Dialer['prototype'][_0x6110('0x15f')]=function(_0x156c83){var _0x5a4a82=this;return function(){_0x5a4a82[_0x6110('0x160')](_0x156c83);};};Dialer[_0x6110('0x1a')][_0x6110('0xa')]=function(_0x19f912){var _0x53fc7c=this;if(isNotPreview(_0x19f912[_0x6110('0x161')])){if(isVoiceQueueOutbound(_0x19f912['type'])&&isActive(_0x19f912[_0x6110('0x5b')])){_0x19f912[_0x6110('0xa1')]=!![];BPromise['resolve']()[_0x6110('0xbc')](checkIsLoggedIn(_0x19f912,_0x19f912[_0x6110('0x52')]))[_0x6110('0xbc')](checkIsActive(_0x19f912,_0x19f912[_0x6110('0x5b')]))['then'](checkInterval(_0x19f912))[_0x6110('0xbc')](_0x53fc7c[_0x6110('0x142')](_0x19f912))['then'](_0x53fc7c[_0x6110('0x145')](_0x19f912[_0x6110('0x162')],_0x19f912['dialTimezone'],_0x19f912[_0x6110('0x42')],_0x19f912))['then'](_0x53fc7c['checkIfTimeIntervals'](_0x19f912[_0x6110('0x44')],_0x19f912[_0x6110('0x163')],_0x19f912[_0x6110('0x42')],_0x19f912))[_0x6110('0xbc')](_0x53fc7c[_0x6110('0x158')](_0x19f912))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x19f912));}else{notSendMessagesQueue(_0x19f912);}}else{freeVariablesPredictive(_0x19f912);}};Dialer['prototype'][_0x6110('0x164')]=function(){var _0x3c6b25=this;var _0x45bcaa;for(var _0x524eda in this['campaigns']){if(this[_0x6110('0x20')]['hasOwnProperty'](_0x524eda)){_0x45bcaa=this['campaigns'][_0x524eda];if(isCampaignIvr(_0x45bcaa[_0x6110('0x4e')])&&isActive(_0x45bcaa[_0x6110('0xdd')])){_0x45bcaa[_0x6110('0xa1')]=!![];BPromise['resolve']()[_0x6110('0xbc')](checkIsActive(_0x45bcaa,_0x45bcaa[_0x6110('0xdd')]))[_0x6110('0xbc')](checkInterval(_0x45bcaa))[_0x6110('0xbc')](_0x3c6b25['checkIsTrunkReachable'](_0x45bcaa))[_0x6110('0xbc')](_0x3c6b25[_0x6110('0x145')](_0x45bcaa[_0x6110('0x162')],_0x45bcaa[_0x6110('0x163')],_0x45bcaa['name'],_0x45bcaa))[_0x6110('0xbc')](_0x3c6b25[_0x6110('0x147')](_0x45bcaa['Interval'],_0x45bcaa['dialTimezone'],_0x45bcaa[_0x6110('0x42')],_0x45bcaa))[_0x6110('0xbc')](_0x3c6b25[_0x6110('0x15f')](_0x45bcaa))[_0x6110('0xb4')](loggerCatchQueueSummary(_0x6110('0x165'),_0x45bcaa));}else{notSendMessagesCampaign(_0x45bcaa);}}}};function getCallerIdRandom(_0xbe4f8d,_0x4ce8a3){var _0x15fbd9,_0x32b53b,_0x66bedf;if(_0x4ce8a3<=0x0){_0x4ce8a3=0x1;}_0x15fbd9=new RegExp('\x5cw{0,'+_0x4ce8a3+'}$');_0x32b53b=Math['pow'](0xa,_0x4ce8a3-0x1);_0x66bedf=Math[_0x6110('0x166')](0xa,_0x4ce8a3)-0x1;return util[_0x6110('0x7b')]('%s',_['replace'](_0xbe4f8d,_0x15fbd9,_[_0x6110('0x167')](_0x32b53b,_0x66bedf)));}function extractCalleridName(_0x38923f){var _0x2d13e0=_0x38923f[_0x6110('0x168')](/"(.*?)"/);return _0x2d13e0?_0x2d13e0[0x1]:_0x38923f;}function extractCalleridNumber(_0xa9bf42){var _0x1a8c94=_0xa9bf42[_0x6110('0x168')](/<(.*?)>/);return _0x1a8c94?_0x1a8c94[0x1]:_0xa9bf42;}Dialer['prototype']['actionOriginate']=function(_0x154afb,_0x54da71){var _0x89a1cf=this;var _0x1d726b=uuid['v4']();this[_0x6110('0x25')][_0x1d726b]=new Action(_0x154afb,_0x54da71,_0x1d726b);return new BPromise(function(_0x2a0f3f,_0xb54f85){if(_[_0x6110('0x3f')](_0x154afb)&&'object'!==typeof _0x154afb){return _0xb54f85(msgResponse(_0x6110('0x169'),_0x6110('0x148'),_0x6110('0x16a')));}if(_[_0x6110('0x3f')](_0x54da71['Contact']['phone'])||_0x54da71['Contact'][_0x6110('0x16b')]===null){return _0xb54f85(msgResponse('originate','Failure','contact\x20is\x20undefine'));}var _0x25c92a={'XMD-CALLERID':_0x89a1cf[_0x6110('0x25')][_0x1d726b]['getCaller'](),'XMD-AGI':_0x154afb[_0x6110('0x10a')]?util[_0x6110('0x7b')](_0x6110('0x16c'),ipAgi,_0x154afb[_0x6110('0x10a')]):_0x6110('0x16d'),'XMD-AGIAFTER':_0x154afb[_0x6110('0x110')]?util[_0x6110('0x7b')](_0x6110('0x16c'),ipAgi,_0x154afb[_0x6110('0x110')]):'NONE','XMD-QUEUE':_0x154afb[_0x6110('0x4e')]===_0x6110('0x4f')?util['format'](_0x6110('0x16e'),_0x154afb['name'],_0x154afb[_0x6110('0x16f')]||'',_0x154afb[_0x6110('0x111')]?'c':'',_0x154afb[_0x6110('0x170')]||0x3):_0x6110('0x16d'),'XMD-CONTACTID':_0x54da71[_0x6110('0xd5')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x89a1cf['actions'][_0x1d726b][_0x6110('0x171')](),'XMD-AMD':_0x154afb[_0x6110('0xe4')]?'ACTIVE':_0x6110('0x16d'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x154afb[_0x6110('0xe4')]){_0x25c92a[_0x6110('0x172')]=_0x154afb['dialAMDInitialSilence']||0x9c4;_0x25c92a['XMD-AMDGREETING']=_0x154afb[_0x6110('0x173')]||0x5dc;_0x25c92a[_0x6110('0x174')]=_0x154afb[_0x6110('0x175')]||0x320;_0x25c92a[_0x6110('0x176')]=_0x154afb['dialAMDTotalAnalysisTime']||0x1388;_0x25c92a[_0x6110('0x177')]=_0x154afb['dialAMDMinWordLength']||0x64;_0x25c92a['XMD-AMDBETWEENWORDSSILENCE']=_0x154afb[_0x6110('0x178')]||0x32;_0x25c92a[_0x6110('0x179')]=_0x154afb[_0x6110('0x17a')]||0x3;_0x25c92a[_0x6110('0x17b')]=_0x154afb[_0x6110('0x17c')]||0x100;_0x25c92a[_0x6110('0x17d')]=_0x154afb[_0x6110('0x17e')]||0x1388;}if(_0x154afb[_0x6110('0x4e')]===_0x6110('0x4f')){_0x25c92a[_0x6110('0x17f')]=_0x54da71[_0x6110('0xfd')];}else{_0x25c92a[_0x6110('0x180')]=_0x54da71[_0x6110('0xd8')];}for(var _0x2a5383 in _0x54da71[_0x6110('0x181')]){if(_0x54da71[_0x6110('0x181')]['hasOwnProperty'](_0x2a5383)){if(isNotNull(_0x54da71[_0x6110('0x181')][_0x2a5383])&&_0x2a5383!=='id'&&_0x2a5383!==_0x6110('0x182')&&_0x2a5383!==_0x6110('0x183')&&_0x2a5383!==_0x6110('0x184')){_0x25c92a[util['format'](_0x6110('0x185'),'XMD-',_[_0x6110('0x186')](_0x2a5383))]=_0x54da71['Contact'][_0x2a5383];}}}var _0x507fe4=_0x89a1cf[_0x6110('0xdc')](_0x154afb[_0x6110('0x78')])?getCallerId(_0x154afb[_0x6110('0x78')][_0x6110('0x79')],_0x154afb[_0x6110('0x5c')],_0x154afb[_0x6110('0x187')]>0x0?getCallerIdRandom(_0x154afb['dialOriginateCallerIdNumber'],_0x154afb[_0x6110('0x187')]):_0x154afb[_0x6110('0x188')]):getCallerId(_[_0x6110('0xb1')](_0x154afb[_0x6110('0x189')])?_0x154afb[_0x6110('0x78')][_0x6110('0x79')]:_0x154afb[_0x6110('0x189')][_0x6110('0x79')],_0x154afb['dialOriginateCallerIdName'],_0x154afb[_0x6110('0x187')]>0x0?getCallerIdRandom(_0x154afb[_0x6110('0x188')],_0x154afb[_0x6110('0x187')]):_0x154afb[_0x6110('0x188')]);if(_0x507fe4){_0x25c92a[_0x6110('0x18a')]=_0x89a1cf['actions'][_0x1d726b][_0x6110('0x18b')]=extractCalleridName(_0x507fe4);_0x25c92a[_0x6110('0x18c')]=_0x89a1cf['actions'][_0x1d726b]['originatecalleridnum']=extractCalleridNumber(_0x507fe4);}return ami[_0x6110('0xb2')]({'actionid':_0x1d726b,'action':_0x6110('0x169'),'channel':_0x89a1cf[_0x6110('0xdc')](_0x154afb['Trunk'])?util['format']('SIP/%s/%s%s',_0x154afb[_0x6110('0x78')]['name'],isNotNull(_0x154afb['dialPrefix'])?_0x154afb[_0x6110('0x5e')][_0x6110('0x18d')]()||'':'',_0x154afb[_0x6110('0x18e')]>0x0?_0x54da71['Contact']['phone'][_0x6110('0x18f')](_0x154afb[_0x6110('0x18e')]):_0x54da71[_0x6110('0x181')][_0x6110('0x16b')]):util[_0x6110('0x7b')](_0x6110('0x190'),_[_0x6110('0xb1')](_0x154afb[_0x6110('0x189')])?_0x154afb['Trunk']['name']:_0x154afb[_0x6110('0x189')][_0x6110('0x42')],isNotNull(_0x154afb[_0x6110('0x5e')])?_0x154afb['dialPrefix']['trim']()||'':'',_0x154afb[_0x6110('0x18e')]>0x0?_0x54da71['Contact'][_0x6110('0x16b')][_0x6110('0x18f')](_0x154afb['dialCutDigit']):_0x54da71[_0x6110('0x181')][_0x6110('0x16b')]),'callerid':_0x507fe4,'Exten':_0x6110('0xe3'),'Context':_0x6110('0x191'),'Priority':'1','variable':_0x25c92a,'timeout':(_0x154afb['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1d726b})[_0x6110('0xbc')](function(_0x74ecbc){return _0x2a0f3f(_0x74ecbc);})[_0x6110('0xb4')](function(_0x399234){_0x154afb[_0x6110('0x192')]+=0x1;var _0x3f63ab=new History(_0x89a1cf[_0x6110('0x25')][_0x1d726b]);logger[_0x6110('0x99')](util['format'](_0x6110('0x193'),JSON[_0x6110('0x7a')](_0x399234)));_0x3f63ab[_0x6110('0xe5')]=0xe;_0x3f63ab[_0x6110('0xa9')]=_0x6110('0x194');_0x3f63ab[_0x6110('0xaa')]=moment()[_0x6110('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');_0x3f63ab[_0x6110('0x126')]=_0x3f63ab[_0x6110('0xaa')];_0x89a1cf['createHistory'](_0x3f63ab)[_0x6110('0xb4')](loggerCatch(_0x6110('0x195')));_0x89a1cf['moveContactManagedDialer'](_0x3f63ab)[_0x6110('0xb4')](loggerCatch(_0x6110('0x195')))['finally'](function(){delete _0x89a1cf['actions'][_0x1d726b];return _0xb54f85(msgResponse('originate',_0x6110('0x4a'),_0x6110('0x196')));});});});};Dialer[_0x6110('0x1a')][_0x6110('0x32')]=function(_0x5b8437){var _0x503498=this[_0x6110('0x25')][_0x5b8437[_0x6110('0x129')]];var _0xc23a6d=this;if(_0x503498){delete this[_0x6110('0x25')][_0x5b8437[_0x6110('0x129')]];_0x503498[_0x6110('0x117')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x2e41f1=_0x503498[_0x6110('0x4e')]===_0x6110('0x7e')?this[_0x6110('0x20')][_0x503498[_0x6110('0xb7')]]:this[_0x6110('0x1f')][_0x503498[_0x6110('0x197')]()];if(!this[_0x6110('0xda')](_0x5b8437[_0x6110('0x198')])){this['updateOriginated'](_0x2e41f1);return this[_0x6110('0x199')](_0x503498,_0x2e41f1,_0x5b8437)[_0x6110('0xbc')](function(_0x13195c){})[_0x6110('0xb4')](loggerCatch(_0x6110('0x19a')));}else{this[_0x6110('0x27')][_0x5b8437[_0x6110('0xe0')]]=_0x503498;}}};Dialer[_0x6110('0x1a')]['checkRetriveMax']=function(_0xc306d,_0x57bc42,_0x382fbd){var _0x593229=new History(_0x57bc42);if(_0x593229[_0x6110('0xf0')]+_0x593229[_0x6110('0xf1')]+_0x593229[_0x6110('0xf2')]+_0x593229[_0x6110('0x104')]+_0x593229[_0x6110('0xf3')]+_0x593229[_0x6110('0xf4')]+_0x593229[_0x6110('0xed')]+_0x593229['countagentrejectretry']>=_0x382fbd[_0x6110('0xf6')]-0x1){return!![];}switch(_0xc306d){case 0x3:if(_0x593229[_0x6110('0xf2')]>=_0x382fbd[_0x6110('0x19b')]-0x1){return!![];}else{this[_0x6110('0xc4')]({'active':![],'countnoanswerretry':_0x593229[_0x6110('0xf2')]+=0x1,'scheduledat':moment()[_0x6110('0xf9')](_0x382fbd[_0x6110('0x19c')],_0x6110('0xfb'))[_0x6110('0x7b')](_0x6110('0xfc')),'ContactId':_0x593229['ContactId'],'ListId':_0x593229[_0x6110('0xd6')],'VoiceQueueId':_0x593229[_0x6110('0xfd')]||undefined,'CampaignId':_0x593229[_0x6110('0xd8')]||undefined})[_0x6110('0xb4')](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x593229[_0x6110('0xf0')]>=_0x382fbd[_0x6110('0x19d')]-0x1){return!![];}else{this[_0x6110('0xc4')]({'active':![],'countbusyretry':_0x593229[_0x6110('0xf0')]+=0x1,'scheduledat':moment()[_0x6110('0xf9')](_0x382fbd[_0x6110('0x19e')],'minutes')[_0x6110('0x7b')](_0x6110('0xfc')),'ContactId':_0x593229[_0x6110('0xd5')],'ListId':_0x593229[_0x6110('0xd6')],'VoiceQueueId':_0x593229['VoiceQueueId']||undefined,'CampaignId':_0x593229[_0x6110('0xd8')]||undefined})[_0x6110('0xb4')](loggerCatch('[rescheduleContact]\x20[Busy]'));}break;case 0x8:if(_0x593229[_0x6110('0xf1')]>=_0x382fbd[_0x6110('0x19f')]-0x1){return!![];}else{this[_0x6110('0xc4')]({'active':![],'countcongestionretry':_0x593229['countcongestionretry']+=0x1,'scheduledat':moment()[_0x6110('0xf9')](_0x382fbd['dialCongestionRetryFrequency'],_0x6110('0xfb'))[_0x6110('0x7b')](_0x6110('0xfc')),'ContactId':_0x593229[_0x6110('0xd5')],'ListId':_0x593229[_0x6110('0xd6')],'VoiceQueueId':_0x593229[_0x6110('0xfd')]||undefined,'CampaignId':_0x593229[_0x6110('0xd8')]||undefined})[_0x6110('0xb4')](loggerCatch(_0x6110('0x1a0')));}break;case 0x0:if(_0x593229[_0x6110('0x104')]>=_0x382fbd[_0x6110('0x1a1')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x593229[_0x6110('0x104')]+=0x1,'scheduledat':moment()[_0x6110('0xf9')](_0x382fbd[_0x6110('0x1a2')],'minutes')[_0x6110('0x7b')](_0x6110('0xfc')),'ContactId':_0x593229[_0x6110('0xd5')],'ListId':_0x593229[_0x6110('0xd6')],'VoiceQueueId':_0x593229['VoiceQueueId']||undefined,'CampaignId':_0x593229['CampaignId']||undefined})[_0x6110('0xb4')](loggerCatch(_0x6110('0x1a3')));}break;case 0xa:if(_0x593229[_0x6110('0xf3')]>=_0x382fbd[_0x6110('0x11b')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countdropretry':_0x593229[_0x6110('0xf3')]+=0x1,'scheduledat':moment()[_0x6110('0xf9')](_0x382fbd[_0x6110('0x11d')],'minutes')['format'](_0x6110('0xfc')),'ContactId':_0x593229[_0x6110('0xd5')],'ListId':_0x593229[_0x6110('0xd6')],'VoiceQueueId':_0x593229[_0x6110('0xfd')]||undefined,'CampaignId':_0x593229[_0x6110('0xd8')]||undefined})['catch'](loggerCatch(_0x6110('0x1a4')));}break;case 0xb:if(_0x593229['countabandonedretry']>=_0x382fbd['dialAbandonedMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x593229['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x382fbd[_0x6110('0x124')],'minutes')[_0x6110('0x7b')](_0x6110('0xfc')),'ContactId':_0x593229[_0x6110('0xd5')],'ListId':_0x593229[_0x6110('0xd6')],'VoiceQueueId':_0x593229['VoiceQueueId']||undefined,'CampaignId':_0x593229['CampaignId']||undefined})[_0x6110('0xb4')](loggerCatch('[rescheduleContact][Abandoned]'));}break;case 0x13:if(_0x593229[_0x6110('0xed')]>=_0x382fbd[_0x6110('0xf7')]-0x1){return!![];}else{this[_0x6110('0xc4')]({'active':![],'countmachineretry':_0x593229[_0x6110('0xed')]+=0x1,'scheduledat':moment()[_0x6110('0xf9')](_0x382fbd['dialMachineRetryFrequency'],_0x6110('0xfb'))[_0x6110('0x7b')](_0x6110('0xfc')),'ContactId':_0x593229[_0x6110('0xd5')],'ListId':_0x593229['ListId'],'VoiceQueueId':_0x593229[_0x6110('0xfd')]||undefined,'CampaignId':_0x593229[_0x6110('0xd8')]||undefined})[_0x6110('0xb4')](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x593229[_0x6110('0xf5')]>=_0x382fbd[_0x6110('0x1a5')]-0x1){return!![];}else{this[_0x6110('0xc4')]({'active':![],'countagentrejectretry':_0x593229[_0x6110('0xf5')]+=0x1,'scheduledat':moment()[_0x6110('0xf9')](_0x382fbd[_0x6110('0x1a6')],_0x6110('0xfb'))[_0x6110('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x593229[_0x6110('0xd5')],'ListId':_0x593229[_0x6110('0xd6')],'VoiceQueueId':_0x593229['VoiceQueueId']||undefined,'CampaignId':_0x593229['CampaignId']||undefined})['catch'](loggerCatch(_0x6110('0x1a7')));}break;default:return!![];}};Dialer[_0x6110('0x1a')][_0x6110('0x199')]=function(_0x435902,_0x55085d,_0x4cd8c5){var _0x4c78fc=this;var _0x153dd1=new History(_0x435902);return new BPromise(function(_0x14fe5e,_0x533ba2){if(_[_0x6110('0x3f')](_0x55085d)&&'object'!==typeof _0x55085d){return _0x533ba2(msgResponse(_0x6110('0x1a8'),'Failure','entity\x20is\x20undefine'));}if(_['isUndefined'](_0x4cd8c5)&&_0x6110('0x1a9')!==typeof _0x4cd8c5){return _0x533ba2(msgResponse(_0x6110('0x1a8'),_0x6110('0x148'),_0x6110('0x1aa')));}switch(_0x4cd8c5['reason']){case'0':_0x55085d['outboundNoSuchCallsDay']+=0x1;_0x153dd1[_0x6110('0xe5')]=0x0;_0x153dd1[_0x6110('0xa9')]=_0x6110('0x1ab');_0x153dd1[_0x6110('0x104')]+=0x1;_0x153dd1['countglobal']+=0x1;ami[_0x6110('0x4d')](_0x6110('0x1ac'),ut[_0x6110('0x1ad')](_0x435902,_0x6110('0x1ae')));_0x4c78fc['createHistory'](_0x153dd1)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4c78fc[_0x6110('0x1af')](0x0,_0x435902,_0x55085d)){if(_0x153dd1[_0x6110('0x104')]>=_0x55085d[_0x6110('0x1a1')]){_0x4c78fc[_0x6110('0x107')](_0x153dd1,_0x14fe5e,_0x533ba2,'reason\x200\x20no\x20such\x20number....');}else{_0x4c78fc['stateGlobal'](_0x153dd1,_0x14fe5e,_0x533ba2,_0x6110('0x1b0'));}}break;case'3':_0x55085d[_0x6110('0x67')]+=0x1;_0x153dd1['state']=0x3;_0x153dd1[_0x6110('0xa9')]=_0x6110('0x1b1');_0x153dd1[_0x6110('0xf2')]+=0x1;_0x153dd1[_0x6110('0xee')]+=0x1;ami['emit'](_0x6110('0x1b2'),ut['buildObj'](_0x435902,_0x6110('0x1b3')));_0x4c78fc[_0x6110('0xce')](_0x153dd1)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x4c78fc[_0x6110('0x1af')](0x3,_0x435902,_0x55085d)){if(_0x153dd1[_0x6110('0xf2')]>=_0x55085d[_0x6110('0x19b')]){_0x4c78fc['createStateFinal'](_0x153dd1,_0x14fe5e,_0x533ba2,_0x6110('0x1b4'));}else{_0x4c78fc[_0x6110('0x105')](_0x153dd1,_0x14fe5e,_0x533ba2,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x55085d[_0x6110('0x62')]+=0x1;_0x153dd1['state']=0x5;_0x153dd1[_0x6110('0xa9')]=_0x6110('0x1b5');_0x153dd1[_0x6110('0xf0')]+=0x1;_0x153dd1[_0x6110('0xee')]+=0x1;ami[_0x6110('0x4d')]('custom:agentbusy',ut[_0x6110('0x1ad')](_0x435902,_0x6110('0x1b6')));_0x4c78fc[_0x6110('0xce')](_0x153dd1)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x4c78fc['checkRetriveMax'](0x5,_0x435902,_0x55085d)){if(_0x153dd1['countbusyretry']>=_0x55085d['dialBusyMaxRetry']){_0x4c78fc[_0x6110('0x107')](_0x153dd1,_0x14fe5e,_0x533ba2,_0x6110('0x1b7'));}else{_0x4c78fc['stateGlobal'](_0x153dd1,_0x14fe5e,_0x533ba2,_0x6110('0x1b7'));}}break;case'8':_0x55085d[_0x6110('0x63')]+=0x1;_0x153dd1[_0x6110('0xe5')]=0x8;_0x153dd1[_0x6110('0xa9')]=_0x6110('0x1b8');_0x153dd1[_0x6110('0xf1')]+=0x1;_0x153dd1['countglobal']+=0x1;ami[_0x6110('0x4d')](_0x6110('0x1b9'),ut[_0x6110('0x1ad')](_0x435902,_0x6110('0x1ba')));_0x4c78fc['createHistory'](_0x153dd1)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x4c78fc[_0x6110('0x1af')](0x8,_0x435902,_0x55085d)){if(_0x153dd1[_0x6110('0xf1')]>=_0x55085d[_0x6110('0x19f')]){_0x4c78fc[_0x6110('0x107')](_0x153dd1,_0x14fe5e,_0x533ba2,_0x6110('0x1bb'));}else{_0x4c78fc[_0x6110('0x105')](_0x153dd1,_0x14fe5e,_0x533ba2,_0x6110('0x1bb'));}}break;case'11':_0x55085d[_0x6110('0x1bc')]+=0x1;_0x153dd1[_0x6110('0xe5')]=0xb;_0x153dd1[_0x6110('0xa9')]=_0x6110('0x121');_0x153dd1['countabandonedretry']+=0x1;_0x153dd1[_0x6110('0xee')]+=0x1;_0x4c78fc['createHistory'](_0x153dd1)[_0x6110('0xb4')](loggerCatch(_0x6110('0x127')));if(_0x4c78fc['checkRetriveMax'](0xb,_0x435902,_0x55085d)){if(_0x153dd1['countabandonedretry']>=_0x55085d[_0x6110('0x123')]){_0x4c78fc[_0x6110('0x107')](_0x153dd1,_0x14fe5e,_0x533ba2,_0x6110('0x1bd'));}else{_0x4c78fc[_0x6110('0x105')](_0x153dd1,_0x14fe5e,_0x533ba2,_0x6110('0x1bd'));}}break;case'20':_0x55085d['outboundRejectCallsDay']+=0x1;_0x153dd1[_0x6110('0xe5')]=0x14;_0x153dd1['statedesc']='AgentReject';_0x153dd1['countagentrejectretry']+=0x1;_0x153dd1[_0x6110('0xee')]+=0x1;ami[_0x6110('0x4d')]('custom:agentreject',ut[_0x6110('0x1ad')](_0x435902,'agentreject'));_0x4c78fc[_0x6110('0xce')](_0x153dd1)[_0x6110('0xb4')](loggerCatch(_0x6110('0x1be')));if(_0x4c78fc[_0x6110('0x1af')](0x14,_0x435902,_0x55085d)){if(_0x153dd1[_0x6110('0xf5')]>=_0x55085d[_0x6110('0x1a5')]){_0x4c78fc[_0x6110('0x107')](_0x153dd1,_0x14fe5e,_0x533ba2,'reason\x2020\x20agentreject');}else{_0x4c78fc[_0x6110('0x105')](_0x153dd1,_0x14fe5e,_0x533ba2,_0x6110('0x1bf'));}}break;default:_0x55085d['outboundUnknownCallsDay']+=0x1;_0x153dd1[_0x6110('0xe5')]=0xc;_0x153dd1[_0x6110('0xa9')]=_0x4cd8c5[_0x6110('0x1c0')];_0x4c78fc['createHistory'](_0x153dd1)[_0x6110('0xb4')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x4c78fc['checkRetriveMax'](_0x4cd8c5['reason'],_0x435902,_0x55085d)){if(_0x153dd1['countbusyretry']+_0x153dd1[_0x6110('0xf1')]+_0x153dd1['countnoanswerretry']+_0x153dd1[_0x6110('0x104')]+_0x153dd1[_0x6110('0xf3')]+_0x153dd1[_0x6110('0xf4')]+_0x153dd1[_0x6110('0xed')]+_0x153dd1['countagentrejectretry']>=_0x55085d['dialGlobalMaxRetry']){_0x4c78fc[_0x6110('0x105')](_0x153dd1,_0x14fe5e,_0x533ba2,_0x4cd8c5[_0x6110('0x1c0')]);}else{_0x4c78fc[_0x6110('0x107')](_0x153dd1,_0x14fe5e,_0x533ba2,_0x4cd8c5[_0x6110('0x1c0')]);}}}});};Dialer[_0x6110('0x1a')][_0x6110('0x105')]=function(_0xc1819c,_0x2f61b7,_0x588b98,_0x3179e4){var _0x5e3b35=new Final(_0xc1819c);_0x5e3b35['state']=0xf;_0x5e3b35[_0x6110('0xa9')]=_0x6110('0x1c1');this[_0x6110('0x107')](_0x5e3b35,_0x2f61b7,_0x588b98,_0x3179e4);};Dialer[_0x6110('0x1a')]['createStateFinal']=function(_0x560705,_0xcc94b3,_0xb2c28d,_0x31f8e7){this[_0x6110('0xcc')](_0x560705)['then'](function(_0xe9a86a){return _0xcc94b3(msgResponse(_0x6110('0x1a8'),'Success',_0x31f8e7));})['catch'](function(_0x5d57ed){return _0xb2c28d(msgResponse(_0x6110('0x1c2'),'Failure',_0x6110('0x1c3')));});};Dialer[_0x6110('0x1a')][_0x6110('0x9')]=function(_0x4e3c16){var _0x3f53fd=this;var _0x315574=_0x4e3c16[_0x6110('0x1c4')]/0x64;var _0x1409bd=_0x4e3c16[_0x6110('0x66')]/(_0x4e3c16[_0x6110('0x66')]+_0x4e3c16[_0x6110('0x60')]);var _0x44ec58=Math[_0x6110('0x1c5')](_0x4e3c16[_0x6110('0x74')]*(_0x4e3c16[_0x6110('0x1c6')]/0x64));var _0x33d15c=Math[_0x6110('0x1c5')](_0x4e3c16['predictiveIntervalAvailable']*(_0x4e3c16[_0x6110('0x1c7')]/0x64));var _0x17d536=_0x4e3c16[_0x6110('0x51')]+_0x4e3c16['talking'];var _0x4a4795=Math[_0x6110('0x1c8')](_0x4e3c16['erlangCalls']*_0x4e3c16[_0x6110('0x90')]*_0x4e3c16['predictiveIntervalHitRate']*_0x4e3c16['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x4e3c16[_0x6110('0x29')])){if(!_[_0x6110('0x3f')](_0x4e3c16[_0x6110('0x28')])){_0x4e3c16[_0x6110('0x28')]=undefined;loggerPredictive[_0x6110('0x99')](_0x6110('0x1c9'),_0x6110('0x1ca'));}if(!_[_0x6110('0x3f')](_0x4e3c16['handlePredictive'])){loggerPredictive[_0x6110('0x99')]('[startMethodPredictive][StartProgressive]',_0x6110('0x1cb'));clearInterval(_0x4e3c16['handlePredictive']);_0x4e3c16[_0x6110('0x94')]=undefined;}_0x4e3c16['startProgressive']=moment()[_0x6110('0x7b')](_0x6110('0xfc'));loggerPredictive['info'](_0x4e3c16[_0x6110('0x42')],_0x6110('0x1cc'),_0x4e3c16['startProgressive']);this[_0x6110('0x15a')](_0x4e3c16,0x1);}else if(ifInterval(_0x4e3c16['dialPredictiveInterval'],_0x4e3c16['startProgressive'])){this[_0x6110('0x15a')](_0x4e3c16,0x1);loggerPredictiveCalls['info'](_0x6110('0x1cd'),_0x4e3c16['startProgressive'],_0x4e3c16[_0x6110('0x42')]);_0x4e3c16[_0x6110('0x8e')]=0x0;_0x4e3c16[_0x6110('0x71')]=0x0;}else if(_0x315574<_0x1409bd&&_0x4e3c16[_0x6110('0x1ce')]===_0x6110('0x1cf')){freeVariablesPredictive(_0x4e3c16);loggerPredictive[_0x6110('0x80')](_0x6110('0x1d0'),_0x6110('0x1d1'),_0x1409bd,_0x6110('0x29'),_0x4e3c16['name']);}else if(_0x4a4795<_0x4e3c16[_0x6110('0x71')]&&_0x4e3c16['dialPredictiveOptimization']===_0x6110('0x1cf')){freeVariablesPredictive(_0x4e3c16);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x6110('0x1d2'),_0x4a4795,_0x6110('0x1d3'),_0x4e3c16[_0x6110('0x71')],_0x6110('0x29'),_0x4e3c16[_0x6110('0x42')]);}else if(!ifInterval(_0x4e3c16[_0x6110('0x1d4')],_0x4e3c16[_0x6110('0x29')])&&_['isUndefined'](_0x4e3c16[_0x6110('0x28')])&&!_[_0x6110('0x3f')](_0x4e3c16[_0x6110('0x29')])){_0x4e3c16['startPredictive']=moment()[_0x6110('0x7b')](_0x6110('0xfc'));loggerPredictive[_0x6110('0x80')](_0x4e3c16[_0x6110('0x42')],_0x6110('0x1d5'),_0x4e3c16['startPredictive']);this['averageHandleTime'](_0x4e3c16['dialPredictiveInterval'])['then'](this[_0x6110('0x1d6')](_0x4e3c16))[_0x6110('0xbc')](mergeDataErlangB(_0x4e3c16))['then'](this[_0x6110('0x1d7')](_0x4e3c16))[_0x6110('0xb4')](loggerCatchPredictive(_0x6110('0x1d8'),_0x4e3c16));}else if(!ifInterval(_0x4e3c16[_0x6110('0x1d4')],_0x4e3c16[_0x6110('0x28')])){_0x4e3c16[_0x6110('0x71')]=0x0;_0x4e3c16['startPredictive']=moment()[_0x6110('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x6110('0x80')](_0x4e3c16[_0x6110('0x42')],_0x6110('0x1d9'),_0x4e3c16[_0x6110('0x28')]);clearInterval(_0x4e3c16[_0x6110('0x94')]);_0x4e3c16[_0x6110('0x94')]=undefined;this[_0x6110('0xc1')](_0x4e3c16[_0x6110('0x1d4')])[_0x6110('0xbc')](this[_0x6110('0x1d6')](_0x4e3c16))[_0x6110('0xbc')](mergeDataErlangB(_0x4e3c16))[_0x6110('0xbc')](this[_0x6110('0x1d7')](_0x4e3c16))[_0x6110('0xb4')](loggerCatchPredictive(_0x6110('0x1da'),_0x4e3c16));}else if(_0x4e3c16[_0x6110('0x74')]&&_0x17d536<_0x4e3c16[_0x6110('0x74')]-_0x33d15c){freeVariablesPredictive(_0x4e3c16);loggerPredictive[_0x6110('0x80')](_0x4e3c16[_0x6110('0x42')],_0x6110('0x1db'),_0x17d536,_0x6110('0x1dc'),_0x4e3c16['predictiveIntervalAvailable'],'-',_0x33d15c,'=',_0x4e3c16['predictiveIntervalAvailable']-_0x33d15c,')');}else if(_0x4e3c16[_0x6110('0x74')]&&_0x17d536>_0x4e3c16[_0x6110('0x74')]+_0x44ec58){freeVariablesPredictive(_0x4e3c16);loggerPredictive['info'](_0x4e3c16[_0x6110('0x42')],_0x6110('0x1db'),_0x17d536,_0x6110('0x1dd'),_0x4e3c16[_0x6110('0x74')],'+',_0x44ec58,'=',_0x4e3c16[_0x6110('0x74')]+_0x44ec58,')');}};Dialer[_0x6110('0x1a')]['getDataPredictive']=function(_0x289156){var _0x50bf4d=this;return function(_0x1a7aa5){return new BPromise(function(_0x1af77c,_0x20bbf6){_['merge'](_0x289156,_0x1a7aa5[0x0]);if(checkGetDataPredictive(_0x1a7aa5[0x0])){var _0x33762a=_0x289156[_0x6110('0x74')]=_0x289156[_0x6110('0xa2')]+_0x289156[_0x6110('0x51')];var _0x5a2c39=_0x289156[_0x6110('0x1d4')]*0x3c;var _0x26c390=_0x1a7aa5[0x0][_0x6110('0x6e')]+_0x1a7aa5[0x0]['predictiveIntervalAvgHoldtime'];var _0x244e81=(_0x1a7aa5[0x0][_0x6110('0x6c')]+_0x1a7aa5[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1a7aa5[0x0][_0x6110('0x86')])/_0x1a7aa5[0x0][_0x6110('0x75')];_0x289156['predictiveIntervalHitRate']=_0x244e81>0x0?_0x244e81:0x1;switch(_0x289156['dialPredictiveOptimization']){case'dropRate':var _0x1245c6=_0x289156['dialPredictiveOptimizationPercentage']/0x64;return _0x50bf4d[_0x6110('0x1de')](_0x33762a,_0x5a2c39,_0x26c390,_0x244e81,_0x1245c6)[_0x6110('0xbc')](function(_0x46094e){return _0x1af77c(_0x46094e);});case _0x6110('0x1df'):var _0x6077be=_0x289156['dialPredictiveOptimizationPercentage']/0x64;return _0x50bf4d[_0x6110('0x1e0')](_0x33762a,_0x5a2c39,_0x26c390,_0x244e81,_0x6077be)[_0x6110('0xbc')](function(_0x4d4ff3){return _0x1af77c(_0x4d4ff3);});default:return _0x20bbf6(msgResponse('[getDataPredictive]',_0x6110('0x148'),_0x6110('0x1e1')));}}else{return _0x20bbf6(msgResponse(_0x6110('0x1e2'),_0x6110('0x148'),_0x6110('0x1e3')));}});};};Dialer[_0x6110('0x1a')][_0x6110('0x1e4')]=function(_0x4048e7){var _0x4ffab4=this;return function(_0x417371){return new BPromise(function(_0x314323,_0x48b94d){_[_0x6110('0x92')](_0x4048e7,_0x417371[0x0]);if(checkGetDataPredictive(_0x417371[0x0])){loggerPredictive['info'](JSON[_0x6110('0x7a')](_0x417371[0x0]));if(_0x4048e7['dialPredictiveOptimization']==='dropRate'){return _0x4ffab4[_0x6110('0xcb')](_0x4048e7['id'])[_0x6110('0xbc')](function(_0x2ba068){var _0x42f5fd=_0x4048e7['loggedIn']-_0x2ba068[0x0]['outboundQueuePauses'];var _0x2edb10=_0x4048e7['dialPredictiveInterval']*0x3c;var _0x1fcbde=_0x417371[0x0][_0x6110('0x6e')]+_0x417371[0x0]['predictiveIntervalAvgHoldtime'];var _0x1e9eda=(_0x417371[0x0][_0x6110('0x6c')]+_0x417371[0x0][_0x6110('0x6f')]+_0x417371[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x417371[0x0][_0x6110('0x75')];var _0x2d397a=_0x4048e7['dialPredictiveOptimizationPercentage']/0x64;_0x4048e7[_0x6110('0x73')]=_0x2ba068[0x0]['outboundQueuePauses']||0x0;_0x4048e7[_0x6110('0x72')]=_0x1e9eda>0x0?_0x1e9eda:0x1;return _0x4ffab4[_0x6110('0x1de')](_0x42f5fd,_0x2edb10,_0x1fcbde,_0x1e9eda,_0x2d397a);})[_0x6110('0xbc')](function(_0x415af9){return _0x314323(_0x415af9);})[_0x6110('0xb4')](function(_0x390e70){return _0x48b94d(msgResponse('[CatchErlangB]',_0x6110('0x148'),JSON['stringify'](_0x390e70)));});}if(_0x4048e7[_0x6110('0x1ce')]===_0x6110('0x1df')){return _0x4ffab4['getVoiceQueueRtPauses'](_0x4048e7['id'])[_0x6110('0xbc')](function(_0x37c73a){var _0x1984ce=_0x4048e7['loggedIn']-_0x37c73a[0x0][_0x6110('0x1e5')];var _0x2d54f1=_0x4048e7['dialPredictiveInterval']*0x3c;var _0x27cee5=_0x417371[0x0][_0x6110('0x6e')]+_0x417371[0x0][_0x6110('0x6d')];var _0x30d0f8=(_0x417371[0x0]['predictiveIntervalAnsweredCalls']+_0x417371[0x0][_0x6110('0x6f')]+_0x417371[0x0][_0x6110('0x86')])/_0x417371[0x0][_0x6110('0x75')];var _0xa397f6=_0x4048e7[_0x6110('0x1c4')]/0x64;_0x4048e7[_0x6110('0x73')]=_0x37c73a[0x0]['outboundQueuePauses']||0x0;_0x4048e7[_0x6110('0x72')]=_0x30d0f8>0x0?_0x30d0f8:0x1;return _0x4ffab4[_0x6110('0x1e0')](_0x1984ce,_0x2d54f1,_0x27cee5,_0x30d0f8,_0xa397f6);})[_0x6110('0xbc')](function(_0x13b919){return _0x314323(_0x13b919);})[_0x6110('0xb4')](function(_0x47d2f4){return _0x48b94d(msgResponse('[CatchErlangB]',_0x6110('0x148'),JSON[_0x6110('0x7a')](_0x47d2f4)));});}}else{return _0x48b94d(msgResponse('[getDataPredictive]',_0x6110('0x148'),_0x6110('0x1e3')));}});};};Dialer[_0x6110('0x1a')][_0x6110('0x1d7')]=function(_0x5ee2d7){var _0x2d9e51=this;return function(){var _0x372667=0x0;var _0x1787a8=Math['floor'](_0x5ee2d7[_0x6110('0x77')]*0x3e8);if(_0x1787a8>0x0){_0x1787a8=_0x1787a8<0x64?0x64:_0x1787a8;loggerPredictive[_0x6110('0x80')](_0x5ee2d7[_0x6110('0x42')],'one\x20call\x20every:',_0x1787a8,'milliseconds');_0x5ee2d7[_0x6110('0x94')]=setInterval(function(){_0x2d9e51[_0x6110('0x94')](_0x5ee2d7);loggerPredictiveCalls['info']('[handlePredictive]',_0x372667+=0x1);},_0x1787a8);}else{loggerPredictive[_0x6110('0x80')](_0x5ee2d7[_0x6110('0x42')],_0x6110('0x1e6'));}};};Dialer[_0x6110('0x1a')]['checkContactBlack']=function(_0x3dba07,_0x586f9f){var _0x3c25c4=this;return function(_0x4a7d92){if(_[_0x6110('0x48')](_0x4a7d92)){if(_[_0x6110('0xb1')](_0x586f9f[_0x6110('0xd7')])||!_0x586f9f[_0x6110('0x1e7')]){if(_0x3dba07[_0x6110('0x161')]===_0x6110('0x8')){_0x3dba07['queueStatusComplete']=_[_0x6110('0x3f')](_0x3dba07[_0x6110('0x131')])?!![]:_0x3dba07[_0x6110('0x131')];var _0x25ea7b=uuid['v4']();_0x3c25c4[_0x6110('0x25')][_0x25ea7b]=new Action(_0x3dba07,_0x586f9f,_0x25ea7b);loggerBooked[_0x6110('0x80')](_0x6110('0x1e8'),_0x25ea7b,_0x6110('0x1e9'),JSON[_0x6110('0x7a')](_0x3dba07[_0x6110('0x131')]),_0x6110('0x1ea'),_0x3dba07[_0x6110('0x42')]);if(_0x3dba07[_0x6110('0x131')]){_0x3dba07['queueStatusComplete']=![];_0x3c25c4[_0x6110('0x2b')][_0x3c25c4['actions'][_0x25ea7b][_0x6110('0xb7')]]=[];ami[_0x6110('0xb2')]({'actionid':_0x25ea7b,'action':'queuestatus','queue':_0x3dba07[_0x6110('0x42')]})[_0x6110('0xb4')](function(_0x54203d){_0x3c25c4[_0x6110('0xb6')](_0x3dba07);_0x3c25c4[_0x6110('0xc4')]({'active':![],'ContactId':_0x3c25c4[_0x6110('0x25')][_0x25ea7b][_0x6110('0xd5')],'ListId':_0x3c25c4[_0x6110('0x25')][_0x25ea7b][_0x6110('0xd6')],'VoiceQueueId':_0x3c25c4[_0x6110('0x25')][_0x25ea7b][_0x6110('0xfd')]||undefined,'CampaignId':_0x3c25c4[_0x6110('0x25')][_0x25ea7b]['CampaignId']||undefined})[_0x6110('0xb4')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x3c25c4['actions'][_0x25ea7b];});}else{loggerBooked[_0x6110('0x80')](_0x6110('0x1eb'),JSON['stringify'](_0x3dba07[_0x6110('0x131')]),'Queue:\x20',_0x3dba07[_0x6110('0x42')]);_0x3c25c4[_0x6110('0xb6')](_0x3dba07);_0x3c25c4[_0x6110('0xc4')]({'active':![],'ContactId':_0x3c25c4[_0x6110('0x25')][_0x25ea7b][_0x6110('0xd5')],'ListId':_0x3c25c4[_0x6110('0x25')][_0x25ea7b][_0x6110('0xd6')],'VoiceQueueId':_0x3c25c4['actions'][_0x25ea7b][_0x6110('0xfd')]||undefined,'CampaignId':_0x3c25c4[_0x6110('0x25')][_0x25ea7b][_0x6110('0xd8')]||undefined})['catch'](loggerCatch(_0x6110('0x1ec')));delete _0x3c25c4['actions'][_0x25ea7b];}}else{return _0x3c25c4[_0x6110('0x1ed')](_0x3dba07,_0x586f9f);}}else{if(getDiff(_0x586f9f[_0x6110('0x1ee')])<_0x3dba07[_0x6110('0x1ef')]*0x3c){if(_0x586f9f['Agent']&&!_0x586f9f['Agent']['voicePause']){_0x3c25c4['preview']['run'](_0x586f9f['id'])[_0x6110('0x1d')](function(){_0x3c25c4[_0x6110('0xb6')](_0x3dba07);});}else{_0x3c25c4[_0x6110('0xc6')]({'active':![]},_0x586f9f['id'],0x1)[_0x6110('0x1d')](function(){console['log']('Contact\x20updated');_0x3c25c4['updateOriginated'](_0x3dba07);});}}else{_0x3dba07[_0x6110('0x69')]+=0x1;_0x3c25c4[_0x6110('0xb6')](_0x3dba07);if(_0x3dba07[_0x6110('0x1f0')]){_0x3c25c4['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x586f9f[_0x6110('0xd5')],'ListId':_0x586f9f[_0x6110('0xd6')],'VoiceQueueId':_0x586f9f['VoiceQueueId']||undefined,'CampaignId':_0x586f9f['CampaignId']||undefined})['catch'](loggerCatch(_0x6110('0x1f1')));_0x3c25c4['createHistory'](createObjHistory(_0x3dba07,_0x586f9f,_0x6110('0x1f2'),0x17,_0x6110('0x1f3')))[_0x6110('0xb4')](loggerCatch(_0x6110('0x1f4')));}else{_0x3c25c4[_0x6110('0xe8')](createObjHistory(_0x3dba07,_0x586f9f,_0x6110('0x1f5'),0x16,_0x6110('0x1f6')),'[Originate][HistoryRecallClose][historyCatch]',_0x6110('0x1f7'));}}}}else{_0x3dba07['outboundBlacklistCallsDay']+=0x1;_0x3c25c4[_0x6110('0xe8')](createObjHistory(_0x3dba07,_0x586f9f,'BLACKLIST',0xd,_0x6110('0x1f8')),'[Originate][historyBlacklist]',_0x6110('0x1f9'));throw _0x6110('0x1fa');}};};Dialer[_0x6110('0x1a')][_0x6110('0x160')]=function(_0xb5adc){var _0x477626=this;var _0x2796ce=[];var _0x23296d=_0xb5adc[_0x6110('0x1fb')]-_0xb5adc[_0x6110('0x76')]-_0xb5adc[_0x6110('0x1fc')];emitCampaignSummary(_0xb5adc);if(_0x23296d>0x0){if(_0x23296d>this[_0x6110('0x23')]){_0x23296d=this[_0x6110('0x23')];}_0xb5adc['temp']+=_0x23296d;this[_0x6110('0xca')](_0xb5adc['id'],_0x23296d,_0xb5adc[_0x6110('0x1fd')])[_0x6110('0xbc')](function(_0x5ea2f5){_0xb5adc[_0x6110('0x1fc')]-=_0x23296d;_0xb5adc[_0x6110('0x1fc')]=_0xb5adc[_0x6110('0x1fc')]>0x0?_0xb5adc[_0x6110('0x1fc')]:0x0;if(!checkContactEmpty(_0x5ea2f5)){_0xb5adc['message']=_0x6110('0x9f');logger[_0x6110('0x80')](_0x6110('0x1fe')+_0xb5adc[_0x6110('0x42')]);}else{_0xb5adc['originated']+=_0x5ea2f5['length'];_0xb5adc['message']=_0x6110('0x1ff');for(var _0x446a21=0x0;_0x446a21<_0x5ea2f5[_0x6110('0x139')];_0x446a21+=0x1){_0xb5adc['ivrTotalCallsDays']+=0x1;if(_[_0x6110('0xb1')](_0x5ea2f5[_0x446a21])||_[_0x6110('0xb1')](_0x5ea2f5[_0x446a21][_0x6110('0x181')])||_[_0x6110('0xb1')](_0x5ea2f5[_0x446a21][_0x6110('0x181')][_0x6110('0x16b')])){_0x477626[_0x6110('0xd2')](_0x6110('0x200'),_0xb5adc,_0x5ea2f5[_0x446a21]);}else{_0x477626[_0x6110('0xbf')](_['pick'](_0x5ea2f5[_0x446a21],[_0x6110('0xd8'),_0x6110('0x201')]))[_0x6110('0xbc')](_0x477626[_0x6110('0x202')](_0xb5adc,_0x5ea2f5[_0x446a21]))[_0x6110('0xb4')](_0x477626['loggerHandler']('[actionOriginateIvr]\x20',_0xb5adc));}}}})[_0x6110('0xb4')](loggerGetContactDialer(_0x6110('0x203'),_0xb5adc,_0x23296d));}};Dialer[_0x6110('0x1a')]['handlePower']=function(_0x2c5f0f,_0x11e60c){var _0x105786=this;var _0x3075a1=[];var _0xdbdd7e=_0x11e60c>=0x1?_0x11e60c:0x1;var _0x1dbdff=[];if(_0x2c5f0f['dialMethod']===_0x6110('0x8')){_0xdbdd7e=0x1;}var _0x594672=Math['floor'](_0x2c5f0f['available']*_0xdbdd7e)-_0x2c5f0f[_0x6110('0x76')]-_0x2c5f0f[_0x6110('0x1fc')];emitVoiceQueueSummary(_0x2c5f0f);if(_0x2c5f0f[_0x6110('0x204')]>0x0){var _0x42ded2=_0x2c5f0f[_0x6110('0x204')]-_0x2c5f0f[_0x6110('0x76')]-_0x2c5f0f['talking']-_0x2c5f0f[_0x6110('0x1fc')]-_0x2c5f0f[_0x6110('0x53')];if(_0x594672>_0x42ded2){_0x594672=_0x42ded2;}}if(_0x594672>0x0){if(_0x2c5f0f[_0x6110('0x161')]===_0x6110('0x8')){_0x594672=0x1;}if(_0x594672>this[_0x6110('0x23')]){_0x594672=this[_0x6110('0x23')];}_0x2c5f0f['temp']+=_0x594672;for(var _0x292476 in this['agents']){if(this[_0x6110('0x21')]['hasOwnProperty'](_0x292476)){if(this[_0x6110('0x21')][_0x292476][_0x6110('0xe5')]==='not_inuse'&&this[_0x6110('0x21')][_0x292476][_0x6110('0xb3')]===_0x6110('0xdf')){_0x3075a1[_0x6110('0x12f')](this['agents'][_0x292476]['id']);}}}this[_0x6110('0xc8')](_0x2c5f0f['id'],_0x3075a1,_0x594672,_0x2c5f0f[_0x6110('0x1fd')])[_0x6110('0xbc')](function(_0x4c51f5){_0x2c5f0f[_0x6110('0x1fc')]-=_0x594672;_0x2c5f0f[_0x6110('0x1fc')]=_0x2c5f0f[_0x6110('0x1fc')]>0x0?_0x2c5f0f[_0x6110('0x1fc')]:0x0;if(!checkContactEmpty(_0x4c51f5)){_0x105786[_0x6110('0xba')](_0x2c5f0f)[_0x6110('0xbc')](sendMessageReschedule(_0x2c5f0f))[_0x6110('0xb4')](loggerCatch(_0x6110('0xbd')));}else{_0x2c5f0f[_0x6110('0x76')]+=_0x4c51f5['length'];_0x2c5f0f['message']=_0x2c5f0f[_0x6110('0x161')]==='booked'?_0x6110('0x205'):'RUNNING';for(var _0x618fcc=0x0;_0x618fcc<_0x4c51f5[_0x6110('0x139')];_0x618fcc+=0x1){if(_['isNil'](_0x4c51f5[_0x618fcc])||_[_0x6110('0xb1')](_0x4c51f5[_0x618fcc]['Contact'])||_['isNil'](_0x4c51f5[_0x618fcc][_0x6110('0x181')][_0x6110('0x16b')])){_0x105786[_0x6110('0xd2')]('[actionOriginate]\x20',_0x2c5f0f,_0x4c51f5[_0x618fcc]);}else{_0x105786['checkIsBlackList'](_[_0x6110('0xd4')](_0x4c51f5[_0x618fcc],[_0x6110('0xfd'),'Contact.phone']))[_0x6110('0xbc')](_0x105786['checkContactBlack'](_0x2c5f0f,_0x4c51f5[_0x618fcc]))[_0x6110('0xb4')](_0x105786[_0x6110('0xd1')](_0x6110('0x200'),_0x2c5f0f));}}}})[_0x6110('0xb4')](loggerGetContactDialer(_0x6110('0x206'),_0x2c5f0f,_0x594672));}};Dialer[_0x6110('0x1a')]['handlePredictive']=function(_0x1b29aa){var _0x4d9e48=this;if(_0x1b29aa[_0x6110('0x204')]>0x0){var _0x37e804=_0x1b29aa['dialLimitQueue']-_0x1b29aa[_0x6110('0x76')]-_0x1b29aa['talking'];if(_0x37e804>0x0){this[_0x6110('0x207')](_0x1b29aa);}else{loggerPredictiveCalls[_0x6110('0x80')]('[handlePredictive][limitChannel]');}}else{this[_0x6110('0x207')](_0x1b29aa);}};Dialer['prototype'][_0x6110('0x207')]=function(_0x1c7482){var _0x42b46e=this;var _0x4567d6=[];_0x1c7482[_0x6110('0x76')]+=0x1;for(var _0x37872e in this[_0x6110('0x21')]){if(this['agents'][_0x6110('0xaf')](_0x37872e)){if(this[_0x6110('0x21')][_0x37872e][_0x6110('0xe5')]===_0x6110('0x208')&&this[_0x6110('0x21')][_0x37872e][_0x6110('0xb3')]===_0x6110('0xdf')){_0x4567d6['push'](this['agents'][_0x37872e]['id']);}}}this[_0x6110('0xc8')](_0x1c7482['id'],_0x4567d6,0x1,_0x1c7482[_0x6110('0x1fd')])[_0x6110('0xbc')](function(_0x47804c){if(!checkContactEmpty(_0x47804c)){checkContactLowerLimitOriginate(_0x1c7482,0x1,0x0);_0x42b46e[_0x6110('0xba')](_0x1c7482)[_0x6110('0xbc')](sendMessageReschedule(_0x1c7482))[_0x6110('0xb4')](loggerCatch(_0x6110('0xbd')));}else{_0x1c7482[_0x6110('0x40')]=_0x6110('0x1ff');if(_['isNil'](_0x47804c[0x0])||_[_0x6110('0xb1')](_0x47804c[0x0][_0x6110('0x181')])||_['isNil'](_0x47804c[0x0]['Contact'][_0x6110('0x16b')])){_0x42b46e[_0x6110('0xd2')]('[actionOriginate]\x20',_0x1c7482,_0x47804c[0x0]);}else{_0x42b46e[_0x6110('0x209')](_[_0x6110('0xd4')](_0x47804c[0x0],[_0x6110('0xfd'),_0x6110('0x201')]))[_0x6110('0xbc')](_0x42b46e['checkContactBlack'](_0x1c7482,_0x47804c[0x0]))[_0x6110('0xb4')](_0x42b46e[_0x6110('0xd1')](_0x6110('0x20a'),_0x1c7482));}}})[_0x6110('0xb4')](loggerGetContactDialer(_0x6110('0x20b'),_0x1c7482,0x1));emitVoiceQueueSummary(_0x1c7482);};Dialer[_0x6110('0x1a')][_0x6110('0x1de')]=function(_0x1f1936,_0x4be788,_0x24e143,_0xf9b6cb,_0x4a44ca,_0x313337){loggerPredictive['info'](_0x6110('0x20c'));loggerPredictive[_0x6110('0x80')](_0x6110('0x20d'),_0x1f1936);loggerPredictive[_0x6110('0x80')](_0x6110('0x20e'),_0x4be788);loggerPredictive['info'](_0x6110('0x20f'),_0x24e143);loggerPredictive[_0x6110('0x80')](_0x6110('0x210'),_0xf9b6cb);loggerPredictive[_0x6110('0x80')](_0x6110('0x211'),_0x4a44ca);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x1b65f3,_0x41ef37){if(_0x1f1936<=0x0||isNaN(_0x1f1936)){return _0x41ef37(msgResponse('[abandonmentRate]','Error','m\x20=\x20'+_0x1f1936));}if(_0x24e143<=0x0||isNaN(_0x24e143)){return _0x41ef37(msgResponse(_0x6110('0x212'),_0x6110('0x4a'),_0x6110('0x213')+_0x24e143));}if(_0xf9b6cb<=0x0||isNaN(_0xf9b6cb)){return _0x41ef37(msgResponse(_0x6110('0x212'),_0x6110('0x4a'),_0x6110('0x214')+_0xf9b6cb));}if(_0x4be788<=0x0||isNaN(_0x4be788)){return _0x41ef37(msgResponse(_0x6110('0x212'),'Error',_0x6110('0x215')+_0x4be788));}if(_0x4a44ca<=0x0||isNaN(_0x4a44ca)){return _0x41ef37(msgResponse(_0x6110('0x212'),_0x6110('0x4a'),_0x6110('0x216')+_0x4a44ca));}_0x313337=_0x313337||0x0;var _0x1845a2=0x1/_0x24e143;var _0x21e602=0x0;var _0x329405=0x0;var _0x1b7434=0x0;var _0x59dbd9=0x0;for(var _0x11b705=0x0;_0x1b7434<_0x4a44ca;_0x11b705+=0x1){_0x329405=_0x11b705/_0x4be788;_0x21e602=(_0xf9b6cb*_0x329405+_0x313337)/_0x1845a2;_0x1b7434=erlangb(_0x21e602,_0x1f1936);_0x59dbd9=_0x21e602/_0x1f1936*(0x1-erlangb(_0x21e602,_0x1f1936));}return _0x1b65f3({'erlangCalls':_0x11b705,'erlangCallToSecond':_0x4be788/_0x11b705,'erlangAbandonmentRate':_0x1b7434,'erlangBusyFactor':_0x59dbd9});});};Dialer[_0x6110('0x1a')][_0x6110('0x1e0')]=function(_0x593ea9,_0x46ed02,_0x34e659,_0x3eb52d,_0x5c8be3,_0x27cf81){loggerPredictive[_0x6110('0x80')](_0x6110('0x217'));loggerPredictive['info'](_0x6110('0x20d'),_0x593ea9);loggerPredictive[_0x6110('0x80')](_0x6110('0x20e'),_0x46ed02);loggerPredictive['info'](_0x6110('0x20f'),_0x34e659);loggerPredictive['info'](_0x6110('0x210'),_0x3eb52d);loggerPredictive[_0x6110('0x80')](_0x6110('0x218'),_0x5c8be3);loggerPredictive[_0x6110('0x80')](_0x6110('0x89'));return new BPromise(function(_0x5b62b1,_0x2360ca){if(_0x593ea9<=0x0||isNaN(_0x593ea9)){return _0x2360ca(msgResponse(_0x6110('0x219'),_0x6110('0x4a'),'m\x20=\x20'+_0x593ea9));}if(_0x34e659<=0x0||isNaN(_0x34e659)){return _0x2360ca(msgResponse(_0x6110('0x219'),_0x6110('0x4a'),_0x6110('0x213')+_0x34e659));}if(_0x3eb52d<=0x0||isNaN(_0x3eb52d)){return _0x2360ca(msgResponse(_0x6110('0x219'),_0x6110('0x4a'),_0x6110('0x214')+_0x3eb52d));}if(_0x46ed02<=0x0||isNaN(_0x46ed02)){return _0x2360ca(msgResponse('[busyFactor]',_0x6110('0x4a'),_0x6110('0x215')+_0x46ed02));}if(_0x5c8be3<=0x0||isNaN(_0x5c8be3)){return _0x2360ca(msgResponse(_0x6110('0x219'),_0x6110('0x4a'),_0x6110('0x21a')+_0x5c8be3));}_0x27cf81=_0x27cf81||0x0;var _0x58ffcf=0x1/_0x34e659;var _0x36e3b1=0x0;var _0x2a65eb=0x0;var _0x525092=0x0;var _0x5d929a=0x0;for(var _0x4416cf=0x0;_0x5d929a<_0x5c8be3;_0x4416cf+=0x1){_0x2a65eb=_0x4416cf/_0x46ed02;_0x36e3b1=(_0x3eb52d*_0x2a65eb+_0x27cf81)/_0x58ffcf;_0x525092=erlangb(_0x36e3b1,_0x593ea9);_0x5d929a=_0x36e3b1/_0x593ea9*(0x1-erlangb(_0x36e3b1,_0x593ea9));}return _0x5b62b1({'erlangCalls':_0x4416cf,'erlangCallToSecond':_0x46ed02/_0x4416cf,'erlangAbandonmentRate':_0x525092,'erlangBusyFactor':_0x5d929a});});};module[_0x6110('0x21b')]=Dialer; \ No newline at end of file +var _0x645f=['[originate][error]','originate\x20action\x20Error','getQueue','callProgressDetecting','checkRetriveMax','countbusyretry','dialNoAnswerMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','countnosuchnumberretry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','buildObj','reason\x200\x20no\x20such\x20number....','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','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','predictive','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','averageHandleTime','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','outboundQueuePauses','agentBusyFactor','[CatchErlangB]','check\x20failure','erlangCallToSecond','one\x20call\x20every:','[handlePredictive]','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','temp','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\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','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','Umin\x20=\x20','util','lodash','bluebird','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./final','./agentComplete','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','prototype','enqueue','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','Error','milliseconds','diff','emit','type','outbound','strategy','available','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangBusyFactor','startPredictive','Trunk','active','stringify','md5','ivr','format','campaign:ivr:%s','-----\x20Stats\x20Predictive\x20---','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','string','\x22%s\x22\x20<%s>','error','inspect','stack','length','hasOwnProperty','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','statedesc','starttime','loopClearZombieChannels','[uniqueid]','clearZombieChannels','[actions]','isNil','Action','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','then','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','merge','pick','ListId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','status','SIP/%s','unmonitored','uniqueid','variable','amdstatus','xcally-motion-dialer','value','HANGUP','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','state','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countcongestionretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','VoiceQueueId','[rescheduleContact][Machine]','dialAMDActive','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','countnoanswerretry','countdropretry','countagentrejectretry','dialMachineRetryFrequency','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','outboundUnknownCallsDay','cause-txt','[syncHangupIvr]','reason','agent','agiafterat','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','countabandonedretry','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','channel','actionid','locked','paused','stateinterface','queueStatusComplete','[booked][unlockQueueStatus]','roundrobin','run','idHopper','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncCampaigns','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','timezones','\x20Timezone\x20unknow\x20','isArray','push','command','iftime\x20%s,%s','interval','content','indexOf','true','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','dialActive','loggedIn','checkIsTrunkReachable','checkIfTime','dialTimezone','[syncQueueSummary]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDSILENCETHRESHOLD','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','toUpper','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originateError]:\x20%s'];(function(_0x4381cb,_0x2cda90){var _0x23e9a2=function(_0x34e471){while(--_0x34e471){_0x4381cb['push'](_0x4381cb['shift']());}};_0x23e9a2(++_0x2cda90);}(_0x645f,0x89));var _0xf645=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x645f[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0xf645('0x0'));var _=require(_0xf645('0x1'));var BPromise=require(_0xf645('0x2'));var uuid=require('uuid');var moment=require(_0xf645('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0xf645('0x4'));var ut=require(_0xf645('0x5'));var config=require(_0xf645('0x6'));var logger=require(_0xf645('0x7'))(_0xf645('0x8'));var loggerBooked=require('../../../config/logger')(_0xf645('0x9'));var loggerPredictive=require(_0xf645('0x7'))('predictive');var loggerPredictiveCalls=require(_0xf645('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xf645('0x7'))(_0xf645('0xa'));var ami=require(_0xf645('0xb'));config[_0xf645('0xc')]=_[_0xf645('0xd')](config[_0xf645('0xc')],{'host':_0xf645('0xe'),'port':0x18eb});var io=require(_0xf645('0xf'))(new Redis(config[_0xf645('0xc')]));var cmHopper=require(_0xf645('0x10'));var cmHopperFinal=require(_0xf645('0x11'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xf645('0x12'));var voiceQueueRt=require(_0xf645('0x13'));var Action=require('./action');var History=require(_0xf645('0x14'));var Final=require(_0xf645('0x15'));var AgentComplete=require(_0xf645('0x16'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0xf645('0x17'));var ipAgi=process[_0xf645('0x18')][_0xf645('0x19')]||_0xf645('0x1a');var strategy={'rrmemory':_0xf645('0x1b'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0xf645('0x1c')][_0xf645('0x1d')]=function(_0x54ad65){this['tail']=this['tail']?this['tail'][_0xf645('0x1e')](_0x54ad65):_0x54ad65();};function Dialer(_0x33c78f,_0xa66d12){this[_0xf645('0x1f')]=new Sequence();this[_0xf645('0x20')]=_0xa66d12;this[_0xf645('0x21')]=_0x33c78f[_0xf645('0x21')];this[_0xf645('0x22')]=_0x33c78f[_0xf645('0x22')];this[_0xf645('0x23')]=_0x33c78f[_0xf645('0x23')];this[_0xf645('0x24')]=_0x33c78f[_0xf645('0x24')];this[_0xf645('0x25')]=config[_0xf645('0x25')]||0x2;this[_0xf645('0x26')]={};this[_0xf645('0x27')]={};this[_0xf645('0x28')]={};this[_0xf645('0x29')]={};this[_0xf645('0x2a')]={};this['startPredictive']={};this[_0xf645('0x2b')]={};this[_0xf645('0x2c')]={};this[_0xf645('0x2d')]={};this[_0xf645('0x2e')]={};ami['on'](_0xf645('0x2f'),this[_0xf645('0x30')][_0xf645('0x31')](this));ami['on'](_0xf645('0x32'),this[_0xf645('0x33')]['bind'](this));ami['on'](_0xf645('0x34'),this[_0xf645('0x35')][_0xf645('0x31')](this));ami['on']('agentcomplete',this[_0xf645('0x36')][_0xf645('0x31')](this));ami['on'](_0xf645('0x37'),this[_0xf645('0xa')]['bind'](this));ami['on']('hangup',this[_0xf645('0x38')][_0xf645('0x31')](this));ami['on']('newexten',this[_0xf645('0x39')][_0xf645('0x31')](this));ami['on'](_0xf645('0x3a'),this[_0xf645('0x3b')][_0xf645('0x31')](this));ami['on'](_0xf645('0x3c'),this[_0xf645('0x3d')][_0xf645('0x31')](this));ami['on'](_0xf645('0x3e'),this['syncQueueStatusComplete'][_0xf645('0x31')](this));this[_0xf645('0x3f')]();this['loopClearZombieChannels']();}function isNotNull(_0x8cabeb){return _0x8cabeb!==null&&!_['isUndefined'](_0x8cabeb);}function checkIsLoggedIn(_0x23d128,_0x5c66fd){return function(){if(_0x5c66fd<=0x0){_0x23d128[_0xf645('0x40')]='AGENTS_NOT_LOGGED';throw _0x23d128[_0xf645('0x41')]+_0xf645('0x42');}};}function isActive(_0x96eb9d){return _0x96eb9d;}function checkIsActive(_0x4fcfe7,_0x34ae2d){return function(){if(!isActive(_0x34ae2d)){_0x4fcfe7[_0xf645('0x40')]=_0xf645('0x43');throw _0x4fcfe7['name']+_0xf645('0x44');}};}function checkInterval(_0x36f785){return function(){if(!isNotNull(_0x36f785[_0xf645('0x45')])){_0x36f785[_0xf645('0x40')]=_0xf645('0x46');throw _0x36f785[_0xf645('0x41')]+_0xf645('0x47');}if(!isNotNull(_0x36f785[_0xf645('0x45')]['Intervals'])){_0x36f785['message']=_0xf645('0x46');throw _0x36f785[_0xf645('0x41')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xf645('0x48')](_0x36f785['Interval'][_0xf645('0x49')]))){_0x36f785['message']=_0xf645('0x46');throw _0x36f785[_0xf645('0x41')]+_0xf645('0x47');}};}function msgResponse(_0x185b6b,_0x16e373,_0x350197){return{'action':_0x185b6b,'response':_0x16e373,'message':_0x350197,'stack':_0x350197};}function myreject(_0xee128e){return function(_0x2cd34f){return _0xee128e(msgResponse(_0xf645('0x4a'),_0xf645('0x4b'),JSON['stringify'](_0x2cd34f)));};}function getSeconds(_0x2194a0,_0x2cc245){var _0x19aeca=moment(_0x2194a0)[_0xf645('0x4c')](0x0);var _0x4f920f=moment(_0x2cc245)[_0xf645('0x4c')](0x0);return _0x19aeca[_0xf645('0x4d')](_0x4f920f,'seconds');}function emit(_0x4d094a,_0x5dc227,_0x30523c){io['to'](_0x4d094a)[_0xf645('0x4e')](_0x5dc227,_0x30523c);}function emitVoiceQueueSummary(_0x47db77){if(_0x47db77[_0xf645('0x4f')]===_0xf645('0x50')){var _0x1ae15b={'id':_0x47db77['id'],'name':_0x47db77[_0xf645('0x41')],'strategy':_0x47db77[_0xf645('0x51')],'answered':_0x47db77['answered'],'available':_0x47db77[_0xf645('0x52')],'loggedIn':_0x47db77['loggedIn'],'pTalking':_0x47db77[_0xf645('0x53')],'sumBillable':_0x47db77['sumBillable'],'sumDuration':_0x47db77[_0xf645('0x54')],'sumHoldTime':_0x47db77[_0xf645('0x55')]||0x0,'talking':_0x47db77[_0xf645('0x56')],'total':_0x47db77[_0xf645('0x57')],'type':_0x47db77[_0xf645('0x4f')],'unmanaged':_0x47db77[_0xf645('0x58')],'abandoned':_0x47db77[_0xf645('0x59')],'waiting':_0x47db77[_0xf645('0x5a')],'loggedInDb':_0x47db77[_0xf645('0x5b')],'dialActive':_0x47db77['dialActive'],'dialMethod':_0x47db77[_0xf645('0x5c')],'dialOriginateCallerIdName':_0x47db77[_0xf645('0x5d')],'dialOriginateCallerIdNumber':_0x47db77[_0xf645('0x5e')],'dialOriginateTimeout':_0x47db77['dialOriginateTimeout'],'dialPrefix':_0x47db77[_0xf645('0x5f')],'outboundAnswerAgiCallsDay':_0x47db77['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x47db77['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x47db77[_0xf645('0x60')],'outboundBusyCallsDay':_0x47db77['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x47db77[_0xf645('0x61')],'outboundDropCallsDayACS':_0x47db77[_0xf645('0x62')],'outboundDropCallsDayCallersExit':_0x47db77['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x47db77['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x47db77[_0xf645('0x63')],'outboundNoSuchCallsDay':_0x47db77['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x47db77[_0xf645('0x64')],'outboundReCallsDay':_0x47db77[_0xf645('0x65')],'outboundRejectCallsDay':_0x47db77[_0xf645('0x66')],'outboundUnknownCallsDay':_0x47db77['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x47db77['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x47db77[_0xf645('0x67')],'predictiveIntervalAvgTalktime':_0x47db77[_0xf645('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x47db77[_0xf645('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x47db77[_0xf645('0x6a')],'predictiveIntervalErlangCalls':_0x47db77['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x47db77[_0xf645('0x6b')],'predictiveIntervalHitRate':_0x47db77[_0xf645('0x6c')],'predictiveIntervalMultiplicativeFactor':_0x47db77[_0xf645('0x6d')],'predictiveIntervalPauses':_0x47db77[_0xf645('0x6e')],'predictiveIntervalAvailable':_0x47db77[_0xf645('0x6f')],'predictiveIntervalTotalCalls':_0x47db77[_0xf645('0x70')],'message':_0x47db77[_0xf645('0x40')],'originated':_0x47db77[_0xf645('0x71')],'erlangCalls':_0x47db77[_0xf645('0x72')],'erlangCallToSecond':_0x47db77['erlangCallToSecond'],'erlangAbandonmentRate':_0x47db77['erlangAbandonmentRate'],'erlangBusyFactor':_0x47db77[_0xf645('0x73')],'startPredictive':_0x47db77[_0xf645('0x74')],'startProgressive':_0x47db77[_0xf645('0x2b')]};if(_0x47db77[_0xf645('0x75')]){_0x1ae15b[_0xf645('0x75')]={'id':_0x47db77[_0xf645('0x75')]['id'],'name':_0x47db77[_0xf645('0x75')][_0xf645('0x41')],'active':_0x47db77['Trunk'][_0xf645('0x76')],'callerid':_0x47db77[_0xf645('0x75')]['callerid']};}if(_0x47db77[_0xf645('0x45')]){_0x1ae15b['Interval']={'id':_0x47db77[_0xf645('0x45')]['id'],'name':_0x47db77['Interval'][_0xf645('0x41')]};}var _0x18d591=md5(JSON[_0xf645('0x77')](_0x1ae15b));if(_0x47db77[_0xf645('0x78')]!==_0x18d591){_0x47db77[_0xf645('0x78')]=_0x18d591;emit(util['format']('voice:queue:%s',_0x1ae15b['name']),'voice_queue:save',_0x1ae15b);}}}function emitCampaignSummary(_0x58483e){if(_0x58483e[_0xf645('0x4f')]===_0xf645('0x79')){emit(util[_0xf645('0x7a')](_0xf645('0x7b'),_0x58483e[_0xf645('0x41')]),'campaign:save',_0x58483e);}}function checkGetDataPredictive(_0x2c8b9f){if(isNotNull(_0x2c8b9f)){if(!_[_0xf645('0x48')](_0x2c8b9f)){loggerPredictive['info'](_0xf645('0x7c'));loggerPredictive[_0xf645('0x7d')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2c8b9f['predictiveIntervalTotalCalls']);loggerPredictive[_0xf645('0x7d')](_0xf645('0x7e'),_0x2c8b9f[_0xf645('0x7f')]);loggerPredictive[_0xf645('0x7d')](_0xf645('0x80'),_0x2c8b9f[_0xf645('0x6a')]);loggerPredictive['info'](_0xf645('0x81'),_0x2c8b9f['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xf645('0x7d')](_0xf645('0x82'),_0x2c8b9f[_0xf645('0x67')]);loggerPredictive[_0xf645('0x7d')](_0xf645('0x83'),_0x2c8b9f['predictiveIntervalAvgTalktime']);loggerPredictive['info'](_0xf645('0x84'));if(_0x2c8b9f[_0xf645('0x70')]>0x0){if(!_[_0xf645('0x85')](_0x2c8b9f[_0xf645('0x68')])&&_0x2c8b9f[_0xf645('0x68')]>0x0){return!![];}else{loggerPredictive[_0xf645('0x7d')](_0xf645('0x86'));}if(!_[_0xf645('0x85')](_0x2c8b9f[_0xf645('0x67')])&&_0x2c8b9f[_0xf645('0x67')]>0x0){return!![];}else{loggerPredictive[_0xf645('0x7d')](_0xf645('0x87'));}}else{loggerPredictive['info'](_0xf645('0x88'));}}else{loggerPredictive['info'](_0xf645('0x89'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x21f666){return function(_0xbd7ed9){loggerPredictive[_0xf645('0x7d')](_0xf645('0x8a'));loggerPredictive[_0xf645('0x7d')](_0xf645('0x8b'),_0xbd7ed9[_0xf645('0x72')]);loggerPredictive[_0xf645('0x7d')](_0xf645('0x8c'),_0xbd7ed9['erlangCallToSecond']);loggerPredictive['info'](_0xf645('0x8d'),_0xbd7ed9[_0xf645('0x8e')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xbd7ed9[_0xf645('0x73')]);loggerPredictive[_0xf645('0x7d')](_0xf645('0x8d'),_0xbd7ed9['erlangAbandonmentRate']);loggerPredictive[_0xf645('0x7d')](_0xf645('0x84'));_['merge'](_0x21f666,_0xbd7ed9);};}function getDiff(_0x2f9802){var _0xaeff6c=moment()['milliseconds'](0x0);var _0x5befad=moment(_0x2f9802)[_0xf645('0x4c')](0x0);return _0xaeff6c[_0xf645('0x4d')](_0x5befad,_0xf645('0x8f'));}function ifInterval(_0x42e288,_0x2dce51){if(_[_0xf645('0x85')](_0x2dce51)){return![];}if(getDiff(_0x2dce51)<_0x42e288*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x1dc9c0){if(isNotNull(_0x1dc9c0)){if(!_[_0xf645('0x85')](_0x1dc9c0[_0xf645('0x2b')])){_0x1dc9c0[_0xf645('0x2b')]=undefined;loggerPredictive['info'](_0x1dc9c0['name'],_0xf645('0x90'));}if(!_[_0xf645('0x85')](_0x1dc9c0['startPredictive'])){_0x1dc9c0[_0xf645('0x74')]=undefined;loggerPredictive[_0xf645('0x7d')](_0x1dc9c0[_0xf645('0x41')],_0xf645('0x91'));}if(!_[_0xf645('0x85')](_0x1dc9c0[_0xf645('0x92')])){clearInterval(_0x1dc9c0[_0xf645('0x92')]);_0x1dc9c0['handlePredictive']=undefined;loggerPredictive[_0xf645('0x7d')](_0x1dc9c0['name'],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0xeb04d8,_0x568d7e){if(_0x568d7e===0x0){return 0x0;}var _0x493a8c=0x1;for(var _0x1476f3=0x1;_0x1476f3<=_0x568d7e;_0x1476f3+=0x1){_0x493a8c=0x1+_0x493a8c*_0x1476f3/_0xeb04d8;}return 0x1/_0x493a8c;}function isVoiceQueueOutbound(_0x503bfc){return _0x503bfc==='outbound';}function isNotPreview(_0x94027e){return _0x94027e!==_0xf645('0x20');}function isCampaignIvr(_0x1540eb){return _0x1540eb==='ivr';}function getCallerId(_0x4411b0,_0x3acd17,_0x50753a){if(!_['isUndefined'](_0x50753a)&&'string'===typeof _0x50753a&&!_[_0xf645('0x48')](_0x50753a)){if(!_['isUndefined'](_0x3acd17)&&_0xf645('0x93')===typeof _0x3acd17&&!_[_0xf645('0x48')](_0x3acd17)){return util[_0xf645('0x7a')](_0xf645('0x94'),_0x3acd17,_0x50753a);}return util[_0xf645('0x7a')](_0xf645('0x94'),_0x50753a,_0x50753a);}if(!_[_0xf645('0x85')](_0x4411b0)&&_0xf645('0x93')===typeof _0x4411b0&&!_['isEmpty'](_0x4411b0)){return _0x4411b0;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x557e6b,_0x1df489){return function(_0x1b7c07){freeVariablesPredictive(_0x1df489);emitVoiceQueueSummary(_0x1df489);emitCampaignSummary(_0x1df489);loggerSyncQueueSummary[_0xf645('0x95')](_0x557e6b,util[_0xf645('0x96')](_0x1b7c07,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4e8b89,_0x43a81a){return function(_0x3bfc84){loggerPredictive[_0xf645('0x95')](_0x43a81a['name'],_0x4e8b89);loggerPredictive[_0xf645('0x95')](_0x3bfc84[_0xf645('0x97')]);freeVariablesPredictive(_0x43a81a);};}function loggerCatch(_0x5170d6){return function(_0x27b06f){logger['error'](_0x5170d6,util[_0xf645('0x96')](_0x27b06f,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x100d7c){return _0x100d7c&&!_[_0xf645('0x85')](_0x100d7c)&&_0x100d7c[_0xf645('0x98')]>0x0;}function decremetOriginate(_0x5c5e98){if(!_['isUndefined'](_0x5c5e98)&&_0x5c5e98!==null){if(_0x5c5e98[_0xf645('0x99')](_0xf645('0x71'))){if(_0x5c5e98[_0xf645('0x71')]>0x0){_0x5c5e98[_0xf645('0x71')]-=0x1;}else{logger['error']('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xf645('0x95')](_0xf645('0x9a'));}}function checkContactLowerLimitOriginate(_0x50c62f,_0x3fa77,_0x5e710c){if(_0x3fa77>_0x5e710c){for(var _0x2fdfa9=0x0;_0x2fdfa9<_0x3fa77-_0x5e710c;_0x2fdfa9+=0x1){decremetOriginate(_0x50c62f);}}}function loggerGetContactDialer(_0x49845d,_0x5e56d5,_0x22d970){return function(_0x450cf7){checkContactLowerLimitOriginate(_0x5e56d5,_0x22d970,0x0);logger[_0xf645('0x95')](_0x49845d,util[_0xf645('0x96')](_0x450cf7,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1d2fd9){return function(_0x403244){if(isNotNull(_0x403244)&&isNotNull(_0x403244[0x0])){if(_0x403244[0x0][_0xf645('0x9b')]>0x0){_0x1d2fd9[_0xf645('0x40')]=_0xf645('0x9c');logger[_0xf645('0x7d')](_0xf645('0x9d')+_0x1d2fd9['name'],_0x403244[0x0][_0xf645('0x9b')],_0xf645('0x9e'));}else{_0x1d2fd9[_0xf645('0x40')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xf645('0x7d')]('[getContactDialer2][Empty]'+_0x1d2fd9[_0xf645('0x41')]);}}};}function notSendMessagesQueue(_0x3eb5be){if(_0x3eb5be[_0xf645('0x9f')]){freeVariablesPredictive(_0x3eb5be);if(_0x3eb5be[_0xf645('0x71')]===0x0&&_0x3eb5be['talking']===0x0&&_0x3eb5be[_0xf645('0x5a')]===0x0&&(_0x3eb5be[_0xf645('0x53')]||0x0)===0x0){_0x3eb5be[_0xf645('0x9f')]=![];_0x3eb5be[_0xf645('0x52')]=0x0;_0x3eb5be[_0xf645('0x40')]='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0xf645('0xa0'),_0x3eb5be[_0xf645('0x41')],'is\x20not\x20active');}else{_0x3eb5be[_0xf645('0x40')]=_0xf645('0xa1');loggerSyncQueueSummary['error'](_0xf645('0xa0'),_0x3eb5be['name'],_0xf645('0xa2'));}emitVoiceQueueSummary(_0x3eb5be);}}function notSendMessagesCampaign(_0x1e164d){if(_0x1e164d[_0xf645('0x9f')]){if(_0x1e164d[_0xf645('0x71')]===0x0){_0x1e164d['sendMessageOneNotActive']=![];_0x1e164d['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0xf645('0x95')](_0xf645('0xa3'),_0x1e164d[_0xf645('0x41')],_0xf645('0xa4'));}else{_0x1e164d[_0xf645('0x40')]='IS_DISACTIVED';loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1e164d[_0xf645('0x41')],_0xf645('0xa2'));}emitCampaignSummary(_0x1e164d);}}function createObjHistory(_0x41b7b7,_0x2ae7a7,_0x42ff2f,_0x57406e,_0x35a07a){_0x41b7b7[_0xf645('0x40')]=_0x42ff2f;var _0x219dbe=new Action(_0x41b7b7,_0x2ae7a7);var _0x2b41bc=new History(_0x219dbe);_0x2b41bc['state']=_0x57406e;_0x2b41bc[_0xf645('0xa5')]=_0x35a07a;_0x2b41bc['endtime']=_0x219dbe[_0xf645('0xa6')];return _0x2b41bc;}Dialer[_0xf645('0x1c')][_0xf645('0xa7')]=function(){var _0x566792=this;setInterval(function(){_0x566792['clearZombieChannels'](_0x566792['uniqueId'],_0xf645('0xa8'));_0x566792[_0xf645('0xa9')](_0x566792['actions'],_0xf645('0xaa'));},0x32c8);};Dialer[_0xf645('0x1c')]['clearZombieChannels']=function(_0x5b339f,_0x1e4157){var _0x52a29a=this;for(var _0x11a3fe in _0x5b339f){if(_0x5b339f[_0xf645('0x99')](_0x11a3fe)){this[_0xf645('0x1f')][_0xf645('0x1d')](function(){if(!_[_0xf645('0xab')](_0x5b339f[_0x11a3fe])){return ami[_0xf645('0xac')]({'action':'status','channel':_0x5b339f[_0x11a3fe]['channel']})[_0xf645('0xad')](function(_0x16e726){if(_0x16e726['message']===_0xf645('0xae')){setTimeout(function(){if(_0x5b339f[_0x11a3fe]&&_0x5b339f[_0x11a3fe][_0xf645('0x4f')]!==_0xf645('0x79')){_0x52a29a[_0xf645('0xaf')](_0x52a29a[_0xf645('0x21')][_0x5b339f[_0x11a3fe]['queue']]);logger[_0xf645('0x95')](_0xf645('0xb0'),_0x1e4157,_0x11a3fe,_0x5b339f[_0x11a3fe]['queue']);delete _0x5b339f[_0x11a3fe];}if(_0x5b339f[_0x11a3fe]&&_0x5b339f[_0x11a3fe]['type']===_0xf645('0x79')){_0x52a29a[_0xf645('0xaf')](_0x52a29a[_0xf645('0x22')][_0x5b339f[_0x11a3fe][_0xf645('0xb1')]]);logger[_0xf645('0x95')]('[Dialer][checkChannel][ivr]',_0x1e4157,_0x11a3fe,_0x5b339f[_0x11a3fe][_0xf645('0xb1')]);delete _0x5b339f[_0x11a3fe];}},0x2328);}});}});}}};Dialer[_0xf645('0x1c')][_0xf645('0xb2')]=function(_0x1648a7){return BPromise[_0xf645('0xb3')]()['then'](cmHopper['countReScheduled'](_0x1648a7))[_0xf645('0xad')](loggerCatch(_0xf645('0xb4')));};Dialer[_0xf645('0x1c')][_0xf645('0xb5')]=function(_0x9e4d9b){return BPromise['resolve']()[_0xf645('0xb6')](cmHopperBlack[_0xf645('0xb5')](_0x9e4d9b))[_0xf645('0xad')](loggerCatch(_0xf645('0xb7')));};Dialer[_0xf645('0x1c')][_0xf645('0xb8')]=function(_0xa1e5e){return BPromise['resolve']()[_0xf645('0xb6')](cmHopperBlack[_0xf645('0xb8')](_0xa1e5e))[_0xf645('0xad')](loggerCatch(_0xf645('0xb9')));};Dialer[_0xf645('0x1c')]['averageHandleTime']=function(_0x4af1f1){return BPromise[_0xf645('0xb3')]()[_0xf645('0xb6')](cmHopperHistory[_0xf645('0xba')](_0x4af1f1))['catch'](loggerCatch(_0xf645('0xbb')));};Dialer[_0xf645('0x1c')][_0xf645('0xbc')]=function(_0x41b7bb){return BPromise[_0xf645('0xb3')]()['then'](cmHopper[_0xf645('0xbc')](_0x41b7bb))[_0xf645('0xad')](loggerCatch(_0xf645('0xbd')));};Dialer['prototype'][_0xf645('0xbe')]=function(_0x16d965,_0x47d3ea,_0x4ecc4f){return BPromise[_0xf645('0xb3')]()[_0xf645('0xb6')](cmHopper[_0xf645('0xbe')](_0x16d965,_0x47d3ea,_0x4ecc4f))[_0xf645('0xad')](loggerCatch(_0xf645('0xbf')));};Dialer[_0xf645('0x1c')][_0xf645('0xc0')]=function(_0x1aaafc,_0x335e12,_0xb6ae2b,_0x1c2cff){return BPromise[_0xf645('0xb3')]()[_0xf645('0xb6')](cmHopper[_0xf645('0xc0')](_0x1aaafc,_0x335e12,_0xb6ae2b,_0x1c2cff))['catch'](loggerCatch(_0xf645('0xc1')));};Dialer[_0xf645('0x1c')][_0xf645('0xc2')]=function(_0x2e6313,_0x37e0a1,_0x3d8670){return BPromise[_0xf645('0xb3')]()[_0xf645('0xb6')](cmHopper[_0xf645('0xc2')](_0x2e6313,_0x37e0a1,_0x3d8670))[_0xf645('0xad')](loggerCatch(_0xf645('0xc1')));};Dialer[_0xf645('0x1c')][_0xf645('0xc3')]=function(_0x50ca4e){return BPromise['resolve']()[_0xf645('0xb6')](voiceQueueRt[_0xf645('0xc3')](_0x50ca4e))['catch'](loggerCatch(_0xf645('0xc4')));};Dialer[_0xf645('0x1c')]['moveContactManagedDialer']=function(_0x23274a){return BPromise[_0xf645('0xb3')]()['then'](cmHopper[_0xf645('0xc5')](_0x23274a))[_0xf645('0xad')](loggerCatch(_0xf645('0xc6')));};Dialer[_0xf645('0x1c')][_0xf645('0xc7')]=function(_0x47b972){return BPromise[_0xf645('0xb3')]()[_0xf645('0xb6')](cmHopperHistory['createHistory'](_0x47b972))[_0xf645('0xad')](loggerCatch(_0xf645('0xc8')));};Dialer[_0xf645('0x1c')][_0xf645('0xaf')]=function(_0x147144){if(!_[_0xf645('0x85')](_0x147144)&&_0x147144!==null){if(_0x147144['hasOwnProperty']('originated')){if(_0x147144[_0xf645('0x71')]>0x0){_0x147144[_0xf645('0x71')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xf645('0x95')](_0xf645('0xc9'));}};Dialer[_0xf645('0x1c')][_0xf645('0xca')]=function(_0x36818d,_0x55c547){var _0x34c4ec=this;return function(_0x5c0e50){_0x34c4ec[_0xf645('0xaf')](_0x55c547);logger[_0xf645('0x95')](_0x36818d,util['inspect'](_0x5c0e50,{'showHidden':![],'depth':null}));};};Dialer[_0xf645('0x1c')]['emptyContact']=function(_0x458155,_0x2c7185,_0x14d7f6){var _0x10dbfc={'state':0x19,'statedesc':_0xf645('0xcb')};this[_0xf645('0xaf')](_0x2c7185);this[_0xf645('0xcc')](_[_0xf645('0xcd')](_0x10dbfc,_[_0xf645('0xce')](_0x14d7f6,['ContactId',_0xf645('0xcf'),'UserId','VoiceQueueId',_0xf645('0xd0')])),_0xf645('0xd1'),_0xf645('0xd2'));logger[_0xf645('0x95')](_0x458155);};Dialer[_0xf645('0x1c')][_0xf645('0xd3')]=function(_0x3a483d){return _0x3a483d==='Success';};Dialer['prototype'][_0xf645('0xd4')]=function(_0x51cec3){return!_[_0xf645('0x85')](_0x51cec3)&&_0x51cec3&&!_[_0xf645('0x85')](_0x51cec3[_0xf645('0x41')])&&!_[_0xf645('0x85')](_0x51cec3[_0xf645('0x76')])&&_0x51cec3['active']&&(this[_0xf645('0x24')][util[_0xf645('0x7a')]('SIP/%s',_0x51cec3['name'])][_0xf645('0xd5')]==='reachable'||this[_0xf645('0x24')][util[_0xf645('0x7a')](_0xf645('0xd6'),_0x51cec3['name'])][_0xf645('0xd5')]===_0xf645('0xd7'));};Dialer[_0xf645('0x1c')][_0xf645('0xcc')]=function(_0xa45580,_0x39a24f,_0x42201e){this[_0xf645('0xc7')](_0xa45580)[_0xf645('0xad')](loggerCatch(_0x39a24f));this[_0xf645('0xc5')](_0xa45580)['catch'](loggerCatch(_0x42201e));};Dialer[_0xf645('0x1c')][_0xf645('0x3b')]=function(_0x390691){var _0x3bbefc=this['uniqueId'][_0x390691[_0xf645('0xd8')]];var _0x148bda;if(!_[_0xf645('0xab')](_0x390691)&&!_[_0xf645('0xab')](_0x390691[_0xf645('0xd9')])&&!_['isNil'](_0x390691[_0xf645('0xd9')][_0xf645('0xda')])&&_0x390691['exten']===_0xf645('0xdb')&&_0x3bbefc){if(_0x3bbefc[_0xf645('0x4f')]!==_0xf645('0x79')&&this[_0xf645('0x21')][_0x3bbefc[_0xf645('0xb1')]]['dialAMDActive']&&_0x390691[_0xf645('0xdc')]===_0xf645('0xdd')){delete this[_0xf645('0x29')][_0x390691['uniqueid']];this[_0xf645('0xaf')](this[_0xf645('0x21')][_0x3bbefc[_0xf645('0xb1')]]);this[_0xf645('0x21')][_0x3bbefc['queue']][_0xf645('0xde')]+=0x1;this[_0xf645('0x21')][_0x3bbefc[_0xf645('0xb1')]][_0xf645('0xdf')]+=0x1;_0x148bda=new Hangup(_0x3bbefc,_0x390691);_0x148bda['state']=0x12;_0x148bda['statedesc']=_0xf645('0xe0');_0x148bda[_0xf645('0xe1')]=_0xf645('0xe2');this[_0xf645('0xcc')](_0x148bda,_0xf645('0xe3'),_0xf645('0xe4'));}if(_0x3bbefc[_0xf645('0x4f')]!==_0xf645('0x79')&&this[_0xf645('0x21')][_0x3bbefc[_0xf645('0xb1')]]['dialAMDActive']&&_0x390691[_0xf645('0xdc')]==='MACHINE'){var _0x44c350=this;return new BPromise(function(_0x2093a5,_0x153064){delete _0x44c350[_0xf645('0x29')][_0x390691[_0xf645('0xd8')]];_0x44c350[_0xf645('0xaf')](_0x44c350['voiceQueues'][_0x3bbefc[_0xf645('0xb1')]]);_0x44c350[_0xf645('0x21')][_0x3bbefc['queue']][_0xf645('0xde')]+=0x1;_0x44c350[_0xf645('0x21')][_0x3bbefc[_0xf645('0xb1')]][_0xf645('0xdf')]+=0x1;var _0x21f9f4=_0x44c350[_0xf645('0x21')][_0x3bbefc['queue']];var _0x3e271b=new Hangup(_0x3bbefc,_0x390691);_0x3e271b[_0xf645('0xe5')]=0x13;_0x3e271b[_0xf645('0xa5')]=_0xf645('0xe6');_0x3e271b['membername']=_0xf645('0xe2');_0x3e271b[_0xf645('0xe7')]+=0x1;_0x3e271b[_0xf645('0xe8')]+=0x1;_0x3e271b[_0xf645('0xe9')]=!![];_0x44c350[_0xf645('0xc7')](_0x3e271b)['catch'](loggerCatch(_0xf645('0xea')));if(_0x3e271b['countbusyretry']+_0x3e271b[_0xf645('0xeb')]+_0x3e271b['countnoanswerretry']+_0x3e271b['countnosuchnumberretry']+_0x3e271b['countdropretry']+_0x3e271b['countabandonedretry']+_0x3e271b['countmachineretry']+_0x3e271b['countagentrejectretry']>=_0x21f9f4[_0xf645('0xec')]){_0x44c350[_0xf645('0xed')](_0x3e271b,_0x2093a5,_0x153064,_0xf645('0xee'));}else{if(_0x3e271b[_0xf645('0xe7')]>=_0x21f9f4[_0xf645('0xef')]){_0x44c350[_0xf645('0xf0')](_0x3e271b,_0x2093a5,_0x153064,_0xf645('0xf1'));}else{_0x44c350[_0xf645('0xbc')]({'active':![],'countmachineretry':_0x3e271b['countmachineretry'],'scheduledat':moment()[_0xf645('0xf2')](_0x21f9f4['dialMachineRetryFrequency'],_0xf645('0xf3'))['format'](_0xf645('0xf4')),'ContactId':_0x3e271b[_0xf645('0xf5')],'ListId':_0x3e271b[_0xf645('0xcf')],'VoiceQueueId':_0x3e271b[_0xf645('0xf6')]||undefined,'CampaignId':_0x3e271b[_0xf645('0xd0')]||undefined})[_0xf645('0xad')](loggerCatch(_0xf645('0xf7')));_0x2093a5({'reschedule':0x1});}}});}if(_0x3bbefc[_0xf645('0x4f')]==='ivr'&&this[_0xf645('0x22')][_0x3bbefc[_0xf645('0xb1')]][_0xf645('0xf8')]&&_0x390691[_0xf645('0xdc')]==='HANGUP'){delete this['uniqueId'][_0x390691['uniqueid']];this[_0xf645('0xaf')](this['campaigns'][_0x3bbefc[_0xf645('0xb1')]]);_0x148bda=new Hangup(_0x3bbefc,_0x390691);_0x148bda[_0xf645('0xe5')]=0x12;_0x148bda[_0xf645('0xa5')]=_0xf645('0xe0');_0x148bda['membername']=_0xf645('0xe2');this['saveInDb'](_0x148bda,_0xf645('0xf9'),_0xf645('0xfa'));}if(_0x3bbefc[_0xf645('0x4f')]===_0xf645('0x79')&&this['campaigns'][_0x3bbefc[_0xf645('0xb1')]][_0xf645('0xf8')]&&_0x390691[_0xf645('0xdc')]===_0xf645('0xfb')){var _0x44c350=this;return new BPromise(function(_0x5db07b,_0x215056){delete _0x44c350[_0xf645('0x29')][_0x390691[_0xf645('0xd8')]];_0x44c350[_0xf645('0xaf')](_0x44c350['campaigns'][_0x3bbefc[_0xf645('0xb1')]]);_0x44c350['campaigns'][_0x3bbefc[_0xf645('0xb1')]][_0xf645('0xde')]+=0x1;_0x44c350[_0xf645('0x22')][_0x3bbefc[_0xf645('0xb1')]][_0xf645('0xdf')]+=0x1;var _0x5d9fd8=_0x44c350[_0xf645('0x22')][_0x3bbefc[_0xf645('0xb1')]];var _0x2d46f3=new Hangup(_0x3bbefc,_0x390691);_0x2d46f3[_0xf645('0xe5')]=0x13;_0x2d46f3['statedesc']=_0xf645('0xe6');_0x2d46f3[_0xf645('0xe1')]=_0xf645('0xe2');_0x2d46f3['countmachineretry']+=0x1;_0x2d46f3['countglobal']+=0x1;_0x2d46f3[_0xf645('0xe9')]=!![];_0x44c350[_0xf645('0xc7')](_0x2d46f3)[_0xf645('0xad')](loggerCatch(_0xf645('0xea')));if(_0x2d46f3['countbusyretry']+_0x2d46f3[_0xf645('0xeb')]+_0x2d46f3[_0xf645('0xfc')]+_0x2d46f3['countnosuchnumberretry']+_0x2d46f3[_0xf645('0xfd')]+_0x2d46f3['countabandonedretry']+_0x2d46f3[_0xf645('0xe7')]+_0x2d46f3[_0xf645('0xfe')]>=_0x5d9fd8[_0xf645('0xec')]){_0x44c350['stateGlobal'](_0x2d46f3,_0x5db07b,_0x215056,_0xf645('0xee'));}else{if(_0x2d46f3[_0xf645('0xe7')]>=_0x5d9fd8[_0xf645('0xef')]){_0x44c350[_0xf645('0xf0')](_0x2d46f3,_0x5db07b,_0x215056,'reason\x2019\x20machine....');}else{_0x44c350[_0xf645('0xbc')]({'active':![],'countmachineretry':_0x2d46f3['countmachineretry'],'scheduledat':moment()[_0xf645('0xf2')](_0x5d9fd8[_0xf645('0xff')],_0xf645('0xf3'))[_0xf645('0x7a')](_0xf645('0xf4')),'ContactId':_0x2d46f3[_0xf645('0xf5')],'ListId':_0x2d46f3[_0xf645('0xcf')],'VoiceQueueId':_0x2d46f3[_0xf645('0xf6')]||undefined,'CampaignId':_0x2d46f3[_0xf645('0xd0')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x5db07b({'reschedule':0x1});}}});}}};Dialer[_0xf645('0x1c')][_0xf645('0x38')]=function(_0x578d19){var _0x558b40=this[_0xf645('0x29')][_0x578d19[_0xf645('0xd8')]];var _0x11fb62=this;var _0x27244f;if(_0x558b40&&_0x558b40[_0xf645('0x4f')]===_0xf645('0x79')){delete this[_0xf645('0x29')][_0x578d19[_0xf645('0xd8')]];this['updateOriginated'](this[_0xf645('0x22')][_0x558b40[_0xf645('0xb1')]]);this[_0xf645('0x22')][_0x558b40['queue']]['ivrAnswerCallsDay']+=0x1;_0x27244f=new Hangup(_0x558b40,_0x578d19);this['createHistory'](_0x27244f)[_0xf645('0xad')](loggerCatch(_0xf645('0x100')));this['moveContactManagedDialer'](_0x27244f)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x558b40&&_0x558b40[_0xf645('0x4f')]!==_0xf645('0x79')&&isNotNull(this[_0xf645('0x21')][_0x558b40[_0xf645('0xb1')]][_0xf645('0x101')])){delete this['uniqueId'][_0x578d19[_0xf645('0xd8')]];this[_0xf645('0xaf')](this['voiceQueues'][_0x558b40['queue']]);this[_0xf645('0x21')][_0x558b40['queue']][_0xf645('0xde')]+=0x1;this[_0xf645('0x21')][_0x558b40['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x27244f=new Hangup(_0x558b40,_0x578d19);_0x27244f[_0xf645('0xe5')]=0x10;_0x27244f['statedesc']=_0xf645('0x102');_0x27244f[_0xf645('0xe1')]='AGI';this['createHistory'](_0x27244f)['catch'](loggerCatch(_0xf645('0x100')));this[_0xf645('0xc5')](_0x27244f)[_0xf645('0xad')](loggerCatch('[syncHangupIvr]'));}if(_0x558b40&&_0x558b40[_0xf645('0x4f')]!==_0xf645('0x79')&&!isNotNull(this[_0xf645('0x21')][_0x558b40[_0xf645('0xb1')]][_0xf645('0x101')])){delete this[_0xf645('0x29')][_0x578d19['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x558b40[_0xf645('0xb1')]]);this['voiceQueues'][_0x558b40[_0xf645('0xb1')]][_0xf645('0x103')]+=0x1;_0x27244f=new Hangup(_0x558b40,_0x578d19);_0x27244f[_0xf645('0xe5')]=0xc;_0x27244f['statedesc']=_0x578d19[_0xf645('0x104')];_0x27244f[_0xf645('0xe1')]='Unknow';this[_0xf645('0xc7')](_0x27244f)['catch'](loggerCatch(_0xf645('0x100')));this['moveContactManagedDialer'](_0x27244f)[_0xf645('0xad')](loggerCatch(_0xf645('0x105')));}};Dialer['prototype'][_0xf645('0x36')]=function(_0x49f65b){var _0x3c5ddc=this[_0xf645('0x29')][_0x49f65b['uniqueid']];var _0x23df12=this;if(this[_0xf645('0x21')][_0x49f65b[_0xf645('0xb1')]]){if(_0x3c5ddc&&_0x3c5ddc[_0xf645('0x4f')]!=='ivr'){delete this[_0xf645('0x29')][_0x49f65b[_0xf645('0xd8')]];this[_0xf645('0x21')][_0x49f65b[_0xf645('0xb1')]][_0xf645('0xde')]+=0x1;var _0xbc3e2c=new AgentComplete(_0x3c5ddc,_0x49f65b);if(_0x49f65b[_0xf645('0x106')]===_0xf645('0x107')){_0xbc3e2c[_0xf645('0x108')]=this[_0xf645('0x21')][_0x49f65b[_0xf645('0xb1')]]['dialQueueProject2']&&this[_0xf645('0x21')][_0x49f65b['queue']]['dialAgiAfterHangupAgent']?moment()[_0xf645('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xf645('0xc7')](_0xbc3e2c)['catch'](loggerCatch(_0xf645('0x109')));this['moveContactManagedDialer'](_0xbc3e2c)[_0xf645('0xad')](loggerCatch(_0xf645('0x10a')));}}};Dialer[_0xf645('0x1c')][_0xf645('0x30')]=function(_0x5ca9dd){if(this['voiceQueues'][_0x5ca9dd['queue']]){if(this[_0xf645('0x29')][_0x5ca9dd[_0xf645('0xd8')]]&&this[_0xf645('0x29')][_0x5ca9dd[_0xf645('0xd8')]][_0xf645('0x4f')]!==_0xf645('0x79')){this['updateOriginated'](this['voiceQueues'][_0x5ca9dd[_0xf645('0xb1')]]);this[_0xf645('0x29')][_0x5ca9dd[_0xf645('0xd8')]][_0xf645('0x10b')]=moment()['format'](_0xf645('0xf4'));}}};Dialer[_0xf645('0x1c')][_0xf645('0x10c')]=function(_0x26a0d7){this[_0xf645('0xc7')](_0x26a0d7)['catch'](loggerCatch(_0xf645('0x109')));this[_0xf645('0xc5')](_0x26a0d7)[_0xf645('0xad')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0xf645('0x1c')][_0xf645('0x33')]=function(_0x1c334a){var _0x3bab86=this[_0xf645('0x29')][_0x1c334a[_0xf645('0xd8')]];var _0x1205c5=this;if(this['voiceQueues'][_0x1c334a[_0xf645('0xb1')]]){if(_0x3bab86&&_0x3bab86[_0xf645('0x4f')]!==_0xf645('0x79')){delete this['uniqueId'][_0x1c334a[_0xf645('0xd8')]];this['updateOriginated'](this['voiceQueues'][_0x1c334a[_0xf645('0xb1')]]);_0x3bab86['droptime']=moment()['format'](_0xf645('0xf4'));var _0x3324a0=new QueueCallerAbandon(_0x3bab86,_0x1c334a);if(getSeconds(_0x3bab86[_0xf645('0x10d')],_0x3bab86[_0xf645('0x10e')])>=_0x3bab86[_0xf645('0x10f')]){this['voiceQueues'][_0x1c334a[_0xf645('0xb1')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xf645('0x21')][_0x1c334a[_0xf645('0xb1')]][_0xf645('0x110')]+=0x1;this[_0xf645('0x21')][_0x1c334a['queue']][_0xf645('0x6b')]+=0x1;_0x3324a0[_0xf645('0xe5')]=0xa;_0x3324a0[_0xf645('0xa5')]=_0xf645('0x111');_0x3324a0['dropreason']='TIMEOUT';_0x3324a0[_0xf645('0x108')]=this[_0xf645('0x21')][_0x1c334a['queue']]['dialQueueProject2']?moment()[_0xf645('0x7a')](_0xf645('0xf4')):undefined;_0x3324a0[_0xf645('0xfd')]+=0x1;_0x3324a0[_0xf645('0xe8')]+=0x1;if(_0x3324a0[_0xf645('0xfd')]>=this[_0xf645('0x21')][_0x1c334a[_0xf645('0xb1')]][_0xf645('0x112')]){this[_0xf645('0x10c')](_0x3324a0);}else{this[_0xf645('0xbc')]({'active':![],'countdropretry':_0x3324a0[_0xf645('0xfd')],'scheduledat':moment()['add'](this[_0xf645('0x21')][_0x1c334a[_0xf645('0xb1')]][_0xf645('0x113')],_0xf645('0xf3'))[_0xf645('0x7a')](_0xf645('0xf4')),'ContactId':_0x3bab86[_0xf645('0xf5')],'ListId':_0x3bab86[_0xf645('0xcf')],'VoiceQueueId':_0x3bab86['VoiceQueueId']||undefined,'CampaignId':_0x3bab86['CampaignId']||undefined})[_0xf645('0xad')](loggerCatch(_0xf645('0x114')));var _0x118f9f=new History(_0x3324a0);_0x118f9f['state']=0xa;_0x118f9f[_0xf645('0xa5')]=_0xf645('0x111');_0x118f9f['starttime']=moment()[_0xf645('0x7a')](_0xf645('0xf4'));_0x118f9f[_0xf645('0x115')]=_0x118f9f[_0xf645('0xa6')];_0x118f9f[_0xf645('0x116')]=_0x3324a0[_0xf645('0x116')];_0x118f9f[_0xf645('0x117')]=_0x3324a0[_0xf645('0x117')];this['createHistory'](_0x118f9f)[_0xf645('0xad')](loggerCatch(_0xf645('0x118')));}}else{this[_0xf645('0x21')][_0x1c334a['queue']][_0xf645('0x69')]+=0x1;this['voiceQueues'][_0x1c334a[_0xf645('0xb1')]][_0xf645('0x119')]+=0x1;_0x3324a0[_0xf645('0xe5')]=0xb;_0x3324a0['statedesc']=_0xf645('0x11a');_0x3324a0[_0xf645('0x11b')]=_0xf645('0x11c');_0x3324a0[_0xf645('0x11d')]+=0x1;_0x3324a0[_0xf645('0xe8')]+=0x1;if(_0x3324a0['countabandonedretry']>=this[_0xf645('0x21')][_0x1c334a[_0xf645('0xb1')]][_0xf645('0x11e')]){this['queueCallerAbandonCreateState'](_0x3324a0);}else{this[_0xf645('0xbc')]({'active':![],'countabandonedretry':_0x3324a0['countabandonedretry'],'scheduledat':moment()[_0xf645('0xf2')](this['voiceQueues'][_0x1c334a[_0xf645('0xb1')]]['dialAbandonedRetryFrequency'],'minutes')[_0xf645('0x7a')](_0xf645('0xf4')),'ContactId':_0x3bab86[_0xf645('0xf5')],'ListId':_0x3bab86[_0xf645('0xcf')],'VoiceQueueId':_0x3bab86[_0xf645('0xf6')]||undefined,'CampaignId':_0x3bab86['CampaignId']||undefined})['catch'](loggerCatch(_0xf645('0x11f')));var _0x118f9f=new History(_0x3324a0);_0x118f9f['state']=0xb;_0x118f9f[_0xf645('0xa5')]=_0xf645('0x11a');_0x118f9f[_0xf645('0xa6')]=moment()[_0xf645('0x7a')](_0xf645('0xf4'));_0x118f9f[_0xf645('0x115')]=_0x118f9f[_0xf645('0xa6')];_0x118f9f[_0xf645('0x116')]=_0x3324a0[_0xf645('0x116')];_0x118f9f[_0xf645('0x117')]=_0x3324a0[_0xf645('0x117')];this['createHistory'](_0x118f9f)[_0xf645('0xad')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0xf645('0x1c')][_0xf645('0x39')]=function(_0x50ce11){if(this[_0xf645('0x27')][_0x50ce11['uniqueid']]){this[_0xf645('0x27')][_0x50ce11[_0xf645('0xd8')]]['channel']=_0x50ce11['channel'];}if(this['uniqueId'][_0x50ce11['uniqueid']]){this[_0xf645('0x29')][_0x50ce11[_0xf645('0xd8')]][_0xf645('0x120')]=_0x50ce11[_0xf645('0x120')];}};Dialer[_0xf645('0x1c')][_0xf645('0x3d')]=function(_0x11e50c){if(strategy[this[_0xf645('0x21')][this[_0xf645('0x27')][_0x11e50c[_0xf645('0x121')]]['queue']]['strategy']]==='roundrobin'){if(this[_0xf645('0x27')][_0x11e50c[_0xf645('0x121')]]&&_['isNil'](this['actions'][_0x11e50c[_0xf645('0x121')]][_0xf645('0x122')])&&_0x11e50c[_0xf645('0xd5')]==='1'&&_0x11e50c[_0xf645('0x123')]==='0'){if(this[_0xf645('0x23')][_0x11e50c['stateinterface']]){if(!this[_0xf645('0x23')][_0x11e50c[_0xf645('0x124')]][_0xf645('0x122')]){this[_0xf645('0x23')][_0x11e50c[_0xf645('0x124')]][_0xf645('0x122')]=!![];this[_0xf645('0x27')][_0x11e50c[_0xf645('0x121')]]['locked']=!![];this[_0xf645('0x27')][_0x11e50c[_0xf645('0x121')]][_0xf645('0x124')]=_0x11e50c[_0xf645('0x124')];}}}}else if((strategy[this[_0xf645('0x21')][this[_0xf645('0x27')][_0x11e50c[_0xf645('0x121')]]['queue']]['strategy']]||_0xf645('0x1b'))===_0xf645('0x1b')){if(this[_0xf645('0x27')][_0x11e50c[_0xf645('0x121')]]){if(this['agents'][_0x11e50c[_0xf645('0x124')]]){this[_0xf645('0x27')][_0x11e50c['actionid']]['stateinterface']=_0x11e50c[_0xf645('0x124')];if(_[_0xf645('0xab')](this[_0xf645('0x2d')][this[_0xf645('0x27')][_0x11e50c[_0xf645('0x121')]]['queue']])){this['queueBooked'][this[_0xf645('0x27')][_0x11e50c[_0xf645('0x121')]]['queue']]=[];}this[_0xf645('0x2d')][this[_0xf645('0x27')][_0x11e50c[_0xf645('0x121')]][_0xf645('0xb1')]]['push'](_[_0xf645('0xcd')](_[_0xf645('0xce')](this[_0xf645('0x27')][_0x11e50c[_0xf645('0x121')]],['idHopper','stateinterface']),{'status':_0x11e50c[_0xf645('0xd5')],'paused':_0x11e50c[_0xf645('0x123')]}));}}}};function unlockQueueStatus(_0x1dadf2,_0xff6c01){setTimeout(function(){if(_[_0xf645('0x85')](_0x1dadf2['queueStatusComplete'])){loggerBooked[_0xf645('0x95')]('[unlockQueueStatus][undefined]',_0xff6c01);}_0x1dadf2[_0xf645('0x125')]=!![];loggerBooked[_0xf645('0x7d')](_0xf645('0x126'),_0xff6c01,JSON[_0xf645('0x77')](_['pick'](_0x1dadf2,['name','queueStatusComplete'])));},0x1f3);}Dialer['prototype']['syncQueueStatusComplete']=function(_0x2f4c01){var _0x9f0ca3=this;var _0x52514b=_0x9f0ca3[_0xf645('0x21')][_0x9f0ca3[_0xf645('0x27')][_0x2f4c01[_0xf645('0x121')]][_0xf645('0xb1')]];if(strategy[this[_0xf645('0x21')][this[_0xf645('0x27')][_0x2f4c01[_0xf645('0x121')]][_0xf645('0xb1')]][_0xf645('0x51')]]===_0xf645('0x127')){if(this[_0xf645('0x27')][_0x2f4c01[_0xf645('0x121')]]&&this[_0xf645('0x27')][_0x2f4c01['actionid']]['stateinterface']){this[_0xf645('0x20')][_0xf645('0x128')](this['actions'][_0x2f4c01['actionid']][_0xf645('0x129')],this[_0xf645('0x27')][_0x2f4c01['actionid']][_0xf645('0x124')])['catch'](function(_0x2a71a9){logger[_0xf645('0x95')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xf645('0x96')](_0x2a71a9,{'showHidden':![],'depth':null}));})[_0xf645('0x1e')](function(){_0x9f0ca3[_0xf645('0xaf')](_0x9f0ca3[_0xf645('0x21')][_0x9f0ca3['actions'][_0x2f4c01[_0xf645('0x121')]][_0xf645('0xb1')]]);_0x9f0ca3[_0xf645('0x23')][_0x9f0ca3[_0xf645('0x27')][_0x2f4c01[_0xf645('0x121')]][_0xf645('0x124')]]['locked']=![];delete _0x9f0ca3['actions'][_0x2f4c01[_0xf645('0x121')]];unlockQueueStatus(_0x52514b);});}else{this[_0xf645('0xaf')](this['voiceQueues'][this['actions'][_0x2f4c01['actionid']][_0xf645('0xb1')]]);this[_0xf645('0xbc')]({'active':![],'ContactId':this[_0xf645('0x27')][_0x2f4c01[_0xf645('0x121')]][_0xf645('0xf5')],'ListId':this[_0xf645('0x27')][_0x2f4c01[_0xf645('0x121')]][_0xf645('0xcf')],'VoiceQueueId':this[_0xf645('0x27')][_0x2f4c01['actionid']][_0xf645('0xf6')]||undefined,'CampaignId':this['actions'][_0x2f4c01['actionid']][_0xf645('0xd0')]||undefined})[_0xf645('0xad')](loggerCatch(_0xf645('0x12a')));delete this['actions'][_0x2f4c01[_0xf645('0x121')]];unlockQueueStatus(_0x52514b);}}else if((strategy[this[_0xf645('0x21')][this[_0xf645('0x27')][_0x2f4c01[_0xf645('0x121')]][_0xf645('0xb1')]][_0xf645('0x51')]]||'rrmemory')==='rrmemory'){var _0x4c1508;if(this[_0xf645('0x27')][_0x2f4c01[_0xf645('0x121')]]&&!_[_0xf645('0x48')](this[_0xf645('0x2d')][this[_0xf645('0x27')][_0x2f4c01[_0xf645('0x121')]]['queue']])){if(this[_0xf645('0x2e')][_0x9f0ca3['actions'][_0x2f4c01[_0xf645('0x121')]][_0xf645('0xb1')]]){this[_0xf645('0x2e')][_0x9f0ca3[_0xf645('0x27')][_0x2f4c01[_0xf645('0x121')]][_0xf645('0xb1')]]=this[_0xf645('0x2e')][this[_0xf645('0x27')][_0x2f4c01[_0xf645('0x121')]][_0xf645('0xb1')]]?this[_0xf645('0x2e')][this[_0xf645('0x27')][_0x2f4c01['actionid']][_0xf645('0xb1')]]:this[_0xf645('0x2d')][this[_0xf645('0x27')][_0x2f4c01[_0xf645('0x121')]][_0xf645('0xb1')]]?this[_0xf645('0x2d')][this[_0xf645('0x27')][_0x2f4c01[_0xf645('0x121')]][_0xf645('0xb1')]][_0xf645('0x12b')]||0x0:0x0;}this['queueBooked'][this[_0xf645('0x27')][_0x2f4c01['actionid']][_0xf645('0xb1')]][_0xf645('0x12b')]=this[_0xf645('0x2e')][this[_0xf645('0x27')][_0x2f4c01[_0xf645('0x121')]][_0xf645('0xb1')]];for(var _0x103b52=0x0;_0x103b52=0x0?!![]:![];})[_0xf645('0xad')](myreject(_0x149e51)));}}else{_0x54aaff[_0xf645('0x140')](ami['Action']({'action':'command','command':util[_0xf645('0x7a')]('iftime\x20%s,%s',_0x29357a,!_[_0xf645('0x85')](config['timezones'][_0x44756d])?_0x44756d:'')})[_0xf645('0xb6')](function(_0x494bbc){return _0x494bbc[_0xf645('0x144')]['indexOf'](_0xf645('0x146'))>=0x0?!![]:![];})['catch'](myreject(_0x149e51)));}BPromise['all'](_0x54aaff)[_0xf645('0xb6')](function(_0x48f6c8){var _0x13c655=_[_0xf645('0x147')](_0x48f6c8);if(_0x13c655){return _0x1dd27d(_0x13c655);}else{_0x12bd12[_0xf645('0x40')]=_0x18b077?_0xf645('0x148'):_0xf645('0x149');return _0x149e51(msgResponse(_0xf645('0x14a'),_0xf645('0x13c'),'Global:\x20'+_0x18b077+'\x20'+_0x421caa+_0xf645('0x14b')+util['inspect'](_0x29357a,{'showHidden':![],'depth':null})+_0xf645('0x14c')+_0x44756d));}})[_0xf645('0xad')](function(_0x4178e7){return _0x149e51(msgResponse(_0xf645('0x138'),_0xf645('0x13c'),JSON['stringify'](_0x4178e7)));});});};Dialer[_0xf645('0x1c')][_0xf645('0x14d')]=function(_0x47e345){var _0x20ca72=this;return function(){switch(_0x47e345[_0xf645('0x5c')]){case'progressive':freeVariablesPredictive(_0x47e345);_0x20ca72[_0xf645('0x14e')](_0x47e345,0x1);break;case'power':freeVariablesPredictive(_0x47e345);_0x20ca72[_0xf645('0x14e')](_0x47e345,_0x47e345[_0xf645('0x14f')]);break;case'predictive':_0x20ca72['predictive'](_0x47e345);break;case'booked':freeVariablesPredictive(_0x47e345);_0x20ca72[_0xf645('0x14e')](_0x47e345,0x1);break;default:freeVariablesPredictive(_0x47e345);logger[_0xf645('0x95')](_0xf645('0x150'),_0x47e345[_0xf645('0x41')],_0xf645('0x151'));}};};Dialer[_0xf645('0x1c')][_0xf645('0x152')]=function(_0x2e10a6){var _0x2e986d=this;return function(){_0x2e986d['handleIvr'](_0x2e10a6);};};Dialer[_0xf645('0x1c')][_0xf645('0xa')]=function(_0x2240a3){var _0x27c1d8=this;if(isNotPreview(_0x2240a3['dialMethod'])){if(isVoiceQueueOutbound(_0x2240a3['type'])&&isActive(_0x2240a3[_0xf645('0x153')])){_0x2240a3[_0xf645('0x9f')]=!![];BPromise['resolve']()[_0xf645('0xb6')](checkIsLoggedIn(_0x2240a3,_0x2240a3[_0xf645('0x154')]))[_0xf645('0xb6')](checkIsActive(_0x2240a3,_0x2240a3['dialActive']))[_0xf645('0xb6')](checkInterval(_0x2240a3))[_0xf645('0xb6')](_0x27c1d8[_0xf645('0x155')](_0x2240a3))[_0xf645('0xb6')](_0x27c1d8[_0xf645('0x156')](_0x2240a3['dialGlobalInterval'],_0x2240a3[_0xf645('0x157')],_0x2240a3['name'],_0x2240a3))[_0xf645('0xb6')](_0x27c1d8['checkIfTimeIntervals'](_0x2240a3[_0xf645('0x45')],_0x2240a3[_0xf645('0x157')],_0x2240a3[_0xf645('0x41')],_0x2240a3))['then'](_0x27c1d8['checkDialMethod'](_0x2240a3))[_0xf645('0xad')](loggerCatchQueueSummary(_0xf645('0x158'),_0x2240a3));}else{notSendMessagesQueue(_0x2240a3);}}else{freeVariablesPredictive(_0x2240a3);}};Dialer[_0xf645('0x1c')][_0xf645('0x135')]=function(){var _0x3452ae=this;var _0x34e14c;for(var _0x462a0d in this['campaigns']){if(this['campaigns'][_0xf645('0x99')](_0x462a0d)){_0x34e14c=this[_0xf645('0x22')][_0x462a0d];if(isCampaignIvr(_0x34e14c[_0xf645('0x4f')])&&isActive(_0x34e14c[_0xf645('0x76')])){_0x34e14c[_0xf645('0x9f')]=!![];BPromise['resolve']()[_0xf645('0xb6')](checkIsActive(_0x34e14c,_0x34e14c[_0xf645('0x76')]))[_0xf645('0xb6')](checkInterval(_0x34e14c))[_0xf645('0xb6')](_0x3452ae[_0xf645('0x155')](_0x34e14c))['then'](_0x3452ae['checkIfTime'](_0x34e14c['dialGlobalInterval'],_0x34e14c[_0xf645('0x157')],_0x34e14c[_0xf645('0x41')],_0x34e14c))[_0xf645('0xb6')](_0x3452ae[_0xf645('0x139')](_0x34e14c['Interval'],_0x34e14c[_0xf645('0x157')],_0x34e14c[_0xf645('0x41')],_0x34e14c))[_0xf645('0xb6')](_0x3452ae['launchHandleIvr'](_0x34e14c))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x34e14c));}else{notSendMessagesCampaign(_0x34e14c);}}}};function getCallerIdRandom(_0x5ebadd,_0x5d7814){var _0x1b3334,_0x4b7b78,_0x5af67a;if(_0x5d7814<=0x0){_0x5d7814=0x1;}_0x1b3334=new RegExp(_0xf645('0x159')+_0x5d7814+'}$');_0x4b7b78=Math['pow'](0xa,_0x5d7814-0x1);_0x5af67a=Math[_0xf645('0x15a')](0xa,_0x5d7814)-0x1;return util[_0xf645('0x7a')]('%s',_[_0xf645('0x15b')](_0x5ebadd,_0x1b3334,_[_0xf645('0x15c')](_0x4b7b78,_0x5af67a)));}function extractCalleridName(_0x1155de){var _0x4f742d=_0x1155de[_0xf645('0x15d')](/"(.*?)"/);return _0x4f742d?_0x4f742d[0x1]:_0x1155de;}function extractCalleridNumber(_0x436d3d){var _0x1f4d4f=_0x436d3d[_0xf645('0x15d')](/<(.*?)>/);return _0x1f4d4f?_0x1f4d4f[0x1]:_0x436d3d;}Dialer[_0xf645('0x1c')][_0xf645('0x15e')]=function(_0x540bc5,_0x5a56b3){var _0x2f8051=this;var _0x24b674=uuid['v4']();this['actions'][_0x24b674]=new Action(_0x540bc5,_0x5a56b3,_0x24b674);return new BPromise(function(_0x47f279,_0x5f29a5){if(_['isUndefined'](_0x540bc5)&&_0xf645('0x15f')!==typeof _0x540bc5){return _0x5f29a5(msgResponse(_0xf645('0x160'),_0xf645('0x13c'),_0xf645('0x161')));}if(_[_0xf645('0x85')](_0x5a56b3[_0xf645('0x162')]['phone'])||_0x5a56b3[_0xf645('0x162')][_0xf645('0x163')]===null){return _0x5f29a5(msgResponse('originate',_0xf645('0x13c'),'contact\x20is\x20undefine'));}var _0x214867={'XMD-CALLERID':_0x2f8051[_0xf645('0x27')][_0x24b674][_0xf645('0x164')](),'XMD-AGI':_0x540bc5[_0xf645('0x101')]?util[_0xf645('0x7a')](_0xf645('0x165'),ipAgi,_0x540bc5[_0xf645('0x101')]):_0xf645('0x166'),'XMD-AGIAFTER':_0x540bc5[_0xf645('0x167')]?util[_0xf645('0x7a')](_0xf645('0x165'),ipAgi,_0x540bc5[_0xf645('0x167')]):_0xf645('0x166'),'XMD-QUEUE':_0x540bc5[_0xf645('0x4f')]==='outbound'?util[_0xf645('0x7a')](_0xf645('0x168'),_0x540bc5['name'],_0x540bc5[_0xf645('0x169')]||'',_0x540bc5[_0xf645('0x16a')]?'c':'',_0x540bc5[_0xf645('0x10f')]||0x3):_0xf645('0x166'),'XMD-CONTACTID':_0x5a56b3[_0xf645('0xf5')],'XMD-CDRTYPE':_0xf645('0x8'),'CALLERID(all)':_0x2f8051[_0xf645('0x27')][_0x24b674]['getCaller'](),'XMD-AMD':_0x540bc5[_0xf645('0xf8')]?'ACTIVE':_0xf645('0x166'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x540bc5[_0xf645('0xf8')]){_0x214867[_0xf645('0x16b')]=_0x540bc5['dialAMDInitialSilence']||0x9c4;_0x214867[_0xf645('0x16c')]=_0x540bc5[_0xf645('0x16d')]||0x5dc;_0x214867[_0xf645('0x16e')]=_0x540bc5[_0xf645('0x16f')]||0x320;_0x214867['XMD-AMDTOTALANALYSISTIME']=_0x540bc5['dialAMDTotalAnalysisTime']||0x1388;_0x214867[_0xf645('0x170')]=_0x540bc5['dialAMDMinWordLength']||0x64;_0x214867[_0xf645('0x171')]=_0x540bc5[_0xf645('0x172')]||0x32;_0x214867['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x540bc5['dialAMDMaximumNumberOfWords']||0x3;_0x214867[_0xf645('0x173')]=_0x540bc5['dialAMDSilenceThreshold']||0x100;_0x214867['XMD-AMDMAXIMUMWORDLENGTH']=_0x540bc5['dialAMDMaximumWordLength']||0x1388;}if(_0x540bc5[_0xf645('0x4f')]===_0xf645('0x50')){_0x214867[_0xf645('0x174')]=_0x5a56b3[_0xf645('0xf6')];}else{_0x214867[_0xf645('0x175')]=_0x5a56b3[_0xf645('0xd0')];}for(var _0x3f6206 in _0x5a56b3['Contact']){if(_0x5a56b3['Contact'][_0xf645('0x99')](_0x3f6206)){if(isNotNull(_0x5a56b3[_0xf645('0x162')][_0x3f6206])&&_0x3f6206!=='id'&&_0x3f6206!==_0xf645('0x176')&&_0x3f6206!==_0xf645('0x177')&&_0x3f6206!==_0xf645('0x178')){_0x214867[util[_0xf645('0x7a')]('%s%s','XMD-',_[_0xf645('0x179')](_0x3f6206))]=_0x5a56b3[_0xf645('0x162')][_0x3f6206];}}}var _0x50f94f=_0x2f8051[_0xf645('0xd4')](_0x540bc5[_0xf645('0x75')])?getCallerId(_0x540bc5[_0xf645('0x75')][_0xf645('0x17a')],_0x540bc5[_0xf645('0x5d')],_0x540bc5[_0xf645('0x17b')]>0x0?getCallerIdRandom(_0x540bc5['dialOriginateCallerIdNumber'],_0x540bc5[_0xf645('0x17b')]):_0x540bc5['dialOriginateCallerIdNumber']):getCallerId(_[_0xf645('0xab')](_0x540bc5['TrunkBackup'])?_0x540bc5[_0xf645('0x75')][_0xf645('0x17a')]:_0x540bc5[_0xf645('0x136')][_0xf645('0x17a')],_0x540bc5['dialOriginateCallerIdName'],_0x540bc5[_0xf645('0x17b')]>0x0?getCallerIdRandom(_0x540bc5[_0xf645('0x5e')],_0x540bc5['dialRandomLastDigitCallerIdNumber']):_0x540bc5[_0xf645('0x5e')]);if(_0x50f94f){_0x214867[_0xf645('0x17c')]=_0x2f8051[_0xf645('0x27')][_0x24b674][_0xf645('0x17d')]=extractCalleridName(_0x50f94f);_0x214867['XMD-ORIGINATECALLERIDNUM']=_0x2f8051[_0xf645('0x27')][_0x24b674][_0xf645('0x17e')]=extractCalleridNumber(_0x50f94f);}return ami[_0xf645('0xac')]({'actionid':_0x24b674,'action':_0xf645('0x160'),'channel':_0x2f8051[_0xf645('0xd4')](_0x540bc5['Trunk'])?util[_0xf645('0x7a')](_0xf645('0x17f'),_0x540bc5[_0xf645('0x75')][_0xf645('0x41')],isNotNull(_0x540bc5['dialPrefix'])?_0x540bc5['dialPrefix'][_0xf645('0x180')]()||'':'',_0x540bc5[_0xf645('0x181')]>0x0?_0x5a56b3[_0xf645('0x162')][_0xf645('0x163')][_0xf645('0x182')](_0x540bc5['dialCutDigit']):_0x5a56b3[_0xf645('0x162')][_0xf645('0x163')]):util['format'](_0xf645('0x17f'),_[_0xf645('0xab')](_0x540bc5[_0xf645('0x136')])?_0x540bc5[_0xf645('0x75')][_0xf645('0x41')]:_0x540bc5[_0xf645('0x136')][_0xf645('0x41')],isNotNull(_0x540bc5[_0xf645('0x5f')])?_0x540bc5[_0xf645('0x5f')][_0xf645('0x180')]()||'':'',_0x540bc5[_0xf645('0x181')]>0x0?_0x5a56b3[_0xf645('0x162')]['phone'][_0xf645('0x182')](_0x540bc5[_0xf645('0x181')]):_0x5a56b3[_0xf645('0x162')][_0xf645('0x163')]),'callerid':_0x50f94f,'Exten':_0xf645('0xdb'),'Context':_0xf645('0x183'),'Priority':'1','variable':_0x214867,'timeout':(_0x540bc5[_0xf645('0x184')]||0x1e)*0x3e8,'async':!![],'channelid':_0x24b674})[_0xf645('0xb6')](function(_0x44570f){return _0x47f279(_0x44570f);})[_0xf645('0xad')](function(_0x48a7f4){_0x540bc5[_0xf645('0x64')]+=0x1;var _0x5867f5=new History(_0x2f8051[_0xf645('0x27')][_0x24b674]);logger[_0xf645('0x95')](util['format'](_0xf645('0x185'),JSON[_0xf645('0x77')](_0x48a7f4)));_0x5867f5[_0xf645('0xe5')]=0xe;_0x5867f5[_0xf645('0xa5')]='OriginateError';_0x5867f5[_0xf645('0xa6')]=moment()['format'](_0xf645('0xf4'));_0x5867f5[_0xf645('0x115')]=_0x5867f5[_0xf645('0xa6')];_0x2f8051[_0xf645('0xc7')](_0x5867f5)[_0xf645('0xad')](loggerCatch(_0xf645('0x186')));_0x2f8051[_0xf645('0xc5')](_0x5867f5)[_0xf645('0xad')](loggerCatch(_0xf645('0x186')))[_0xf645('0x1e')](function(){delete _0x2f8051[_0xf645('0x27')][_0x24b674];return _0x5f29a5(msgResponse('originate','Error',_0xf645('0x187')));});});});};Dialer[_0xf645('0x1c')][_0xf645('0x35')]=function(_0x48f910){var _0x47db80=this[_0xf645('0x27')][_0x48f910[_0xf645('0x121')]];var _0x1fdef3=this;if(_0x47db80){delete this['actions'][_0x48f910[_0xf645('0x121')]];_0x47db80[_0xf645('0x10e')]=moment()[_0xf645('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3d6a27=_0x47db80['type']==='ivr'?this[_0xf645('0x22')][_0x47db80[_0xf645('0xb1')]]:this[_0xf645('0x21')][_0x47db80[_0xf645('0x188')]()];if(!this[_0xf645('0xd3')](_0x48f910['response'])){this[_0xf645('0xaf')](_0x3d6a27);return this[_0xf645('0x189')](_0x47db80,_0x3d6a27,_0x48f910)[_0xf645('0xb6')](function(_0x5982a0){})[_0xf645('0xad')](loggerCatch('[callProgressDetecting]\x20'));}else{this[_0xf645('0x29')][_0x48f910[_0xf645('0xd8')]]=_0x47db80;}}};Dialer[_0xf645('0x1c')][_0xf645('0x18a')]=function(_0x16e860,_0x447c88,_0x5b52ac){var _0x50e3fd=new History(_0x447c88);if(_0x50e3fd[_0xf645('0x18b')]+_0x50e3fd[_0xf645('0xeb')]+_0x50e3fd[_0xf645('0xfc')]+_0x50e3fd['countnosuchnumberretry']+_0x50e3fd['countdropretry']+_0x50e3fd[_0xf645('0x11d')]+_0x50e3fd['countmachineretry']+_0x50e3fd['countagentrejectretry']>=_0x5b52ac[_0xf645('0xec')]-0x1){return!![];}switch(_0x16e860){case 0x3:if(_0x50e3fd[_0xf645('0xfc')]>=_0x5b52ac[_0xf645('0x18c')]-0x1){return!![];}else{this[_0xf645('0xbc')]({'active':![],'countnoanswerretry':_0x50e3fd[_0xf645('0xfc')]+=0x1,'scheduledat':moment()['add'](_0x5b52ac['dialNoAnswerRetryFrequency'],'minutes')[_0xf645('0x7a')](_0xf645('0xf4')),'ContactId':_0x50e3fd[_0xf645('0xf5')],'ListId':_0x50e3fd[_0xf645('0xcf')],'VoiceQueueId':_0x50e3fd[_0xf645('0xf6')]||undefined,'CampaignId':_0x50e3fd[_0xf645('0xd0')]||undefined})[_0xf645('0xad')](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x50e3fd[_0xf645('0x18b')]>=_0x5b52ac[_0xf645('0x18d')]-0x1){return!![];}else{this[_0xf645('0xbc')]({'active':![],'countbusyretry':_0x50e3fd[_0xf645('0x18b')]+=0x1,'scheduledat':moment()['add'](_0x5b52ac[_0xf645('0x18e')],_0xf645('0xf3'))['format'](_0xf645('0xf4')),'ContactId':_0x50e3fd[_0xf645('0xf5')],'ListId':_0x50e3fd['ListId'],'VoiceQueueId':_0x50e3fd['VoiceQueueId']||undefined,'CampaignId':_0x50e3fd[_0xf645('0xd0')]||undefined})[_0xf645('0xad')](loggerCatch(_0xf645('0x18f')));}break;case 0x8:if(_0x50e3fd[_0xf645('0xeb')]>=_0x5b52ac[_0xf645('0x190')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countcongestionretry':_0x50e3fd[_0xf645('0xeb')]+=0x1,'scheduledat':moment()[_0xf645('0xf2')](_0x5b52ac[_0xf645('0x191')],_0xf645('0xf3'))['format'](_0xf645('0xf4')),'ContactId':_0x50e3fd['ContactId'],'ListId':_0x50e3fd[_0xf645('0xcf')],'VoiceQueueId':_0x50e3fd[_0xf645('0xf6')]||undefined,'CampaignId':_0x50e3fd[_0xf645('0xd0')]||undefined})[_0xf645('0xad')](loggerCatch('[rescheduleContact]\x20[Congestion]'));}break;case 0x0:if(_0x50e3fd[_0xf645('0x192')]>=_0x5b52ac[_0xf645('0x193')]-0x1){return!![];}else{this[_0xf645('0xbc')]({'active':![],'countnosuchnumberretry':_0x50e3fd[_0xf645('0x192')]+=0x1,'scheduledat':moment()[_0xf645('0xf2')](_0x5b52ac[_0xf645('0x194')],_0xf645('0xf3'))[_0xf645('0x7a')](_0xf645('0xf4')),'ContactId':_0x50e3fd['ContactId'],'ListId':_0x50e3fd[_0xf645('0xcf')],'VoiceQueueId':_0x50e3fd[_0xf645('0xf6')]||undefined,'CampaignId':_0x50e3fd[_0xf645('0xd0')]||undefined})[_0xf645('0xad')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x50e3fd[_0xf645('0xfd')]>=_0x5b52ac[_0xf645('0x112')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countdropretry':_0x50e3fd[_0xf645('0xfd')]+=0x1,'scheduledat':moment()['add'](_0x5b52ac[_0xf645('0x113')],_0xf645('0xf3'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x50e3fd[_0xf645('0xf5')],'ListId':_0x50e3fd[_0xf645('0xcf')],'VoiceQueueId':_0x50e3fd[_0xf645('0xf6')]||undefined,'CampaignId':_0x50e3fd[_0xf645('0xd0')]||undefined})[_0xf645('0xad')](loggerCatch('[rescheduleContact][Drop]'));}break;case 0xb:if(_0x50e3fd[_0xf645('0x11d')]>=_0x5b52ac[_0xf645('0x11e')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x50e3fd[_0xf645('0x11d')]+=0x1,'scheduledat':moment()[_0xf645('0xf2')](_0x5b52ac['dialAbandonedRetryFrequency'],_0xf645('0xf3'))['format'](_0xf645('0xf4')),'ContactId':_0x50e3fd[_0xf645('0xf5')],'ListId':_0x50e3fd[_0xf645('0xcf')],'VoiceQueueId':_0x50e3fd['VoiceQueueId']||undefined,'CampaignId':_0x50e3fd[_0xf645('0xd0')]||undefined})['catch'](loggerCatch(_0xf645('0x11f')));}break;case 0x13:if(_0x50e3fd[_0xf645('0xe7')]>=_0x5b52ac[_0xf645('0xef')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countmachineretry':_0x50e3fd['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x5b52ac[_0xf645('0xff')],_0xf645('0xf3'))[_0xf645('0x7a')](_0xf645('0xf4')),'ContactId':_0x50e3fd[_0xf645('0xf5')],'ListId':_0x50e3fd['ListId'],'VoiceQueueId':_0x50e3fd['VoiceQueueId']||undefined,'CampaignId':_0x50e3fd['CampaignId']||undefined})[_0xf645('0xad')](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x50e3fd[_0xf645('0xfe')]>=_0x5b52ac[_0xf645('0x195')]-0x1){return!![];}else{this[_0xf645('0xbc')]({'active':![],'countagentrejectretry':_0x50e3fd[_0xf645('0xfe')]+=0x1,'scheduledat':moment()[_0xf645('0xf2')](_0x5b52ac[_0xf645('0x196')],'minutes')[_0xf645('0x7a')](_0xf645('0xf4')),'ContactId':_0x50e3fd[_0xf645('0xf5')],'ListId':_0x50e3fd[_0xf645('0xcf')],'VoiceQueueId':_0x50e3fd[_0xf645('0xf6')]||undefined,'CampaignId':_0x50e3fd['CampaignId']||undefined})[_0xf645('0xad')](loggerCatch(_0xf645('0x197')));}break;default:return!![];}};Dialer[_0xf645('0x1c')][_0xf645('0x189')]=function(_0x2967b6,_0x5d8e5f,_0x4dfadc){var _0x568dc1=this;var _0xe2910f=new History(_0x2967b6);return new BPromise(function(_0x395838,_0x5876af){if(_['isUndefined'](_0x5d8e5f)&&_0xf645('0x15f')!==typeof _0x5d8e5f){return _0x5876af(msgResponse(_0xf645('0x198'),'Failure',_0xf645('0x199')));}if(_['isUndefined'](_0x4dfadc)&&'object'!==typeof _0x4dfadc){return _0x5876af(msgResponse('[callProgressDetecting]',_0xf645('0x13c'),_0xf645('0x19a')));}switch(_0x4dfadc[_0xf645('0x106')]){case'0':_0x5d8e5f['outboundNoSuchCallsDay']+=0x1;_0xe2910f[_0xf645('0xe5')]=0x0;_0xe2910f[_0xf645('0xa5')]=_0xf645('0x19b');_0xe2910f[_0xf645('0x192')]+=0x1;_0xe2910f[_0xf645('0xe8')]+=0x1;ami[_0xf645('0x4e')]('custom:agentnosuchnumber',ut[_0xf645('0x19c')](_0x2967b6,'nosuchnumber'));_0x568dc1[_0xf645('0xc7')](_0xe2910f)[_0xf645('0xad')](loggerCatch(_0xf645('0xea')));if(_0x568dc1[_0xf645('0x18a')](0x0,_0x2967b6,_0x5d8e5f)){if(_0xe2910f['countnosuchnumberretry']>=_0x5d8e5f[_0xf645('0x193')]){_0x568dc1['createStateFinal'](_0xe2910f,_0x395838,_0x5876af,'reason\x200\x20no\x20such\x20number....');}else{_0x568dc1['stateGlobal'](_0xe2910f,_0x395838,_0x5876af,_0xf645('0x19d'));}}break;case'3':_0x5d8e5f[_0xf645('0x63')]+=0x1;_0xe2910f[_0xf645('0xe5')]=0x3;_0xe2910f[_0xf645('0xa5')]='NoAnswer';_0xe2910f[_0xf645('0xfc')]+=0x1;_0xe2910f[_0xf645('0xe8')]+=0x1;ami['emit'](_0xf645('0x19e'),ut[_0xf645('0x19c')](_0x2967b6,_0xf645('0x19f')));_0x568dc1[_0xf645('0xc7')](_0xe2910f)[_0xf645('0xad')](loggerCatch(_0xf645('0x1a0')));if(_0x568dc1[_0xf645('0x18a')](0x3,_0x2967b6,_0x5d8e5f)){if(_0xe2910f['countnoanswerretry']>=_0x5d8e5f['dialNoAnswerMaxRetry']){_0x568dc1[_0xf645('0xf0')](_0xe2910f,_0x395838,_0x5876af,_0xf645('0x1a1'));}else{_0x568dc1['stateGlobal'](_0xe2910f,_0x395838,_0x5876af,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x5d8e5f['outboundBusyCallsDay']+=0x1;_0xe2910f['state']=0x5;_0xe2910f['statedesc']=_0xf645('0x1a2');_0xe2910f[_0xf645('0x18b')]+=0x1;_0xe2910f[_0xf645('0xe8')]+=0x1;ami[_0xf645('0x4e')](_0xf645('0x1a3'),ut[_0xf645('0x19c')](_0x2967b6,_0xf645('0x1a4')));_0x568dc1[_0xf645('0xc7')](_0xe2910f)[_0xf645('0xad')](loggerCatch(_0xf645('0x1a5')));if(_0x568dc1[_0xf645('0x18a')](0x5,_0x2967b6,_0x5d8e5f)){if(_0xe2910f[_0xf645('0x18b')]>=_0x5d8e5f['dialBusyMaxRetry']){_0x568dc1[_0xf645('0xf0')](_0xe2910f,_0x395838,_0x5876af,_0xf645('0x1a6'));}else{_0x568dc1[_0xf645('0xed')](_0xe2910f,_0x395838,_0x5876af,_0xf645('0x1a6'));}}break;case'8':_0x5d8e5f[_0xf645('0x61')]+=0x1;_0xe2910f[_0xf645('0xe5')]=0x8;_0xe2910f[_0xf645('0xa5')]=_0xf645('0x1a7');_0xe2910f['countcongestionretry']+=0x1;_0xe2910f[_0xf645('0xe8')]+=0x1;ami[_0xf645('0x4e')](_0xf645('0x1a8'),ut[_0xf645('0x19c')](_0x2967b6,_0xf645('0x1a9')));_0x568dc1[_0xf645('0xc7')](_0xe2910f)[_0xf645('0xad')](loggerCatch(_0xf645('0x1aa')));if(_0x568dc1['checkRetriveMax'](0x8,_0x2967b6,_0x5d8e5f)){if(_0xe2910f[_0xf645('0xeb')]>=_0x5d8e5f[_0xf645('0x190')]){_0x568dc1[_0xf645('0xf0')](_0xe2910f,_0x395838,_0x5876af,_0xf645('0x1ab'));}else{_0x568dc1['stateGlobal'](_0xe2910f,_0x395838,_0x5876af,_0xf645('0x1ab'));}}break;case'11':_0x5d8e5f[_0xf645('0x1ac')]+=0x1;_0xe2910f[_0xf645('0xe5')]=0xb;_0xe2910f[_0xf645('0xa5')]=_0xf645('0x11a');_0xe2910f['countabandonedretry']+=0x1;_0xe2910f[_0xf645('0xe8')]+=0x1;_0x568dc1['createHistory'](_0xe2910f)['catch'](loggerCatch(_0xf645('0x1ad')));if(_0x568dc1[_0xf645('0x18a')](0xb,_0x2967b6,_0x5d8e5f)){if(_0xe2910f['countabandonedretry']>=_0x5d8e5f[_0xf645('0x11e')]){_0x568dc1[_0xf645('0xf0')](_0xe2910f,_0x395838,_0x5876af,_0xf645('0x1ae'));}else{_0x568dc1[_0xf645('0xed')](_0xe2910f,_0x395838,_0x5876af,_0xf645('0x1ae'));}}break;case'20':_0x5d8e5f['outboundRejectCallsDay']+=0x1;_0xe2910f[_0xf645('0xe5')]=0x14;_0xe2910f[_0xf645('0xa5')]=_0xf645('0x1af');_0xe2910f[_0xf645('0xfe')]+=0x1;_0xe2910f[_0xf645('0xe8')]+=0x1;ami['emit'](_0xf645('0x1b0'),ut[_0xf645('0x19c')](_0x2967b6,_0xf645('0x1b1')));_0x568dc1[_0xf645('0xc7')](_0xe2910f)[_0xf645('0xad')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x568dc1[_0xf645('0x18a')](0x14,_0x2967b6,_0x5d8e5f)){if(_0xe2910f[_0xf645('0xfe')]>=_0x5d8e5f[_0xf645('0x195')]){_0x568dc1[_0xf645('0xf0')](_0xe2910f,_0x395838,_0x5876af,_0xf645('0x1b2'));}else{_0x568dc1[_0xf645('0xed')](_0xe2910f,_0x395838,_0x5876af,_0xf645('0x1b2'));}}break;default:_0x5d8e5f['outboundUnknownCallsDay']+=0x1;_0xe2910f[_0xf645('0xe5')]=0xc;_0xe2910f[_0xf645('0xa5')]=_0x4dfadc[_0xf645('0x106')];_0x568dc1[_0xf645('0xc7')](_0xe2910f)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x568dc1[_0xf645('0x18a')](_0x4dfadc['reason'],_0x2967b6,_0x5d8e5f)){if(_0xe2910f[_0xf645('0x18b')]+_0xe2910f['countcongestionretry']+_0xe2910f[_0xf645('0xfc')]+_0xe2910f[_0xf645('0x192')]+_0xe2910f[_0xf645('0xfd')]+_0xe2910f[_0xf645('0x11d')]+_0xe2910f['countmachineretry']+_0xe2910f[_0xf645('0xfe')]>=_0x5d8e5f['dialGlobalMaxRetry']){_0x568dc1[_0xf645('0xed')](_0xe2910f,_0x395838,_0x5876af,_0x4dfadc[_0xf645('0x106')]);}else{_0x568dc1[_0xf645('0xf0')](_0xe2910f,_0x395838,_0x5876af,_0x4dfadc[_0xf645('0x106')]);}}}});};Dialer[_0xf645('0x1c')][_0xf645('0xed')]=function(_0x3733c9,_0x548d50,_0x10e4bc,_0x198f6a){var _0xf52041=new Final(_0x3733c9);_0xf52041[_0xf645('0xe5')]=0xf;_0xf52041['statedesc']=_0xf645('0x1b3');this[_0xf645('0xf0')](_0xf52041,_0x548d50,_0x10e4bc,_0x198f6a);};Dialer[_0xf645('0x1c')][_0xf645('0xf0')]=function(_0x430f10,_0x4b3caa,_0x3b7090,_0x46c445){this[_0xf645('0xc5')](_0x430f10)[_0xf645('0xb6')](function(_0x4cd375){return _0x4b3caa(msgResponse(_0xf645('0x198'),'Success',_0x46c445));})['catch'](function(_0x350b6b){return _0x3b7090(msgResponse(_0xf645('0x1b4'),_0xf645('0x13c'),'contact\x20not\x20moved'));});};Dialer[_0xf645('0x1c')][_0xf645('0x1b5')]=function(_0x2dc83c){var _0x37d90b=this;var _0x592349=_0x2dc83c[_0xf645('0x1b6')]/0x64;var _0x32c2af=_0x2dc83c[_0xf645('0x110')]/(_0x2dc83c[_0xf645('0x110')]+_0x2dc83c[_0xf645('0xde')]);var _0x26e2c8=Math[_0xf645('0x1b7')](_0x2dc83c[_0xf645('0x6f')]*(_0x2dc83c[_0xf645('0x1b8')]/0x64));var _0xe390b7=Math['round'](_0x2dc83c[_0xf645('0x6f')]*(_0x2dc83c[_0xf645('0x1b9')]/0x64));var _0x16a559=_0x2dc83c[_0xf645('0x52')]+_0x2dc83c[_0xf645('0x56')];var _0x411913=Math[_0xf645('0x1ba')](_0x2dc83c[_0xf645('0x72')]*_0x2dc83c[_0xf645('0x8e')]*_0x2dc83c[_0xf645('0x6c')]*_0x2dc83c['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x2dc83c[_0xf645('0x2b')])){if(!_[_0xf645('0x85')](_0x2dc83c['startPredictive'])){_0x2dc83c[_0xf645('0x74')]=undefined;loggerPredictive[_0xf645('0x95')](_0xf645('0x1bb'),_0xf645('0x1bc'));}if(!_[_0xf645('0x85')](_0x2dc83c[_0xf645('0x92')])){loggerPredictive[_0xf645('0x95')](_0xf645('0x1bb'),_0xf645('0x1bd'));clearInterval(_0x2dc83c[_0xf645('0x92')]);_0x2dc83c[_0xf645('0x92')]=undefined;}_0x2dc83c['startProgressive']=moment()[_0xf645('0x7a')](_0xf645('0xf4'));loggerPredictive[_0xf645('0x7d')](_0x2dc83c[_0xf645('0x41')],_0xf645('0x1be'),_0x2dc83c[_0xf645('0x2b')]);this[_0xf645('0x14e')](_0x2dc83c,0x1);}else if(ifInterval(_0x2dc83c['dialPredictiveInterval'],_0x2dc83c[_0xf645('0x2b')])){this[_0xf645('0x14e')](_0x2dc83c,0x1);loggerPredictiveCalls[_0xf645('0x7d')]('[startMethodPredictive][StartProgressive][Loop]',_0x2dc83c[_0xf645('0x2b')],_0x2dc83c[_0xf645('0x41')]);_0x2dc83c[_0xf645('0x72')]=0x0;_0x2dc83c[_0xf645('0x6b')]=0x0;}else if(_0x592349<_0x32c2af&&_0x2dc83c[_0xf645('0x1bf')]==='dropRate'){freeVariablesPredictive(_0x2dc83c);loggerPredictive[_0xf645('0x7d')](_0xf645('0x1c0'),_0xf645('0x1c1'),_0x32c2af,'startProgressive',_0x2dc83c[_0xf645('0x41')]);}else if(_0x411913<_0x2dc83c[_0xf645('0x6b')]&&_0x2dc83c['dialPredictiveOptimization']===_0xf645('0x1c2')){freeVariablesPredictive(_0x2dc83c);loggerPredictive[_0xf645('0x7d')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xf645('0x1c3'),_0x411913,_0xf645('0x1c4'),_0x2dc83c[_0xf645('0x6b')],'startProgressive',_0x2dc83c[_0xf645('0x41')]);}else if(!ifInterval(_0x2dc83c[_0xf645('0x1c5')],_0x2dc83c['startProgressive'])&&_[_0xf645('0x85')](_0x2dc83c['startPredictive'])&&!_[_0xf645('0x85')](_0x2dc83c['startProgressive'])){_0x2dc83c[_0xf645('0x74')]=moment()[_0xf645('0x7a')](_0xf645('0xf4'));loggerPredictive[_0xf645('0x7d')](_0x2dc83c[_0xf645('0x41')],'started\x20in\x20predictive\x20at',_0x2dc83c[_0xf645('0x74')]);this['averageHandleTime'](_0x2dc83c[_0xf645('0x1c5')])[_0xf645('0xb6')](this[_0xf645('0x1c6')](_0x2dc83c))[_0xf645('0xb6')](mergeDataErlangB(_0x2dc83c))[_0xf645('0xb6')](this[_0xf645('0x1c7')](_0x2dc83c))[_0xf645('0xad')](loggerCatchPredictive(_0xf645('0x1c8'),_0x2dc83c));}else if(!ifInterval(_0x2dc83c[_0xf645('0x1c5')],_0x2dc83c[_0xf645('0x74')])){_0x2dc83c[_0xf645('0x6b')]=0x0;_0x2dc83c['startPredictive']=moment()[_0xf645('0x7a')](_0xf645('0xf4'));loggerPredictive[_0xf645('0x7d')](_0x2dc83c[_0xf645('0x41')],_0xf645('0x1c9'),_0x2dc83c[_0xf645('0x74')]);clearInterval(_0x2dc83c[_0xf645('0x92')]);_0x2dc83c[_0xf645('0x92')]=undefined;this[_0xf645('0x1ca')](_0x2dc83c[_0xf645('0x1c5')])['then'](this[_0xf645('0x1c6')](_0x2dc83c))['then'](mergeDataErlangB(_0x2dc83c))[_0xf645('0xb6')](this[_0xf645('0x1c7')](_0x2dc83c))[_0xf645('0xad')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x2dc83c));}else if(_0x2dc83c[_0xf645('0x6f')]&&_0x16a559<_0x2dc83c[_0xf645('0x6f')]-_0xe390b7){freeVariablesPredictive(_0x2dc83c);loggerPredictive[_0xf645('0x7d')](_0x2dc83c[_0xf645('0x41')],_0xf645('0x1cb'),_0x16a559,_0xf645('0x1cc'),_0x2dc83c[_0xf645('0x6f')],'-',_0xe390b7,'=',_0x2dc83c['predictiveIntervalAvailable']-_0xe390b7,')');}else if(_0x2dc83c[_0xf645('0x6f')]&&_0x16a559>_0x2dc83c[_0xf645('0x6f')]+_0x26e2c8){freeVariablesPredictive(_0x2dc83c);loggerPredictive['info'](_0x2dc83c[_0xf645('0x41')],_0xf645('0x1cb'),_0x16a559,_0xf645('0x1cd'),_0x2dc83c[_0xf645('0x6f')],'+',_0x26e2c8,'=',_0x2dc83c[_0xf645('0x6f')]+_0x26e2c8,')');}};Dialer[_0xf645('0x1c')][_0xf645('0x1c6')]=function(_0x14ff26){var _0x199f1e=this;return function(_0x1d95e9){return new BPromise(function(_0x1d42a2,_0xd5f425){_[_0xf645('0xcd')](_0x14ff26,_0x1d95e9[0x0]);if(checkGetDataPredictive(_0x1d95e9[0x0])){var _0x76f4c7=_0x14ff26[_0xf645('0x6f')]=_0x14ff26[_0xf645('0x56')]+_0x14ff26[_0xf645('0x52')];var _0x2cd738=_0x14ff26[_0xf645('0x1c5')]*0x3c;var _0x16e43e=_0x1d95e9[0x0][_0xf645('0x68')]+_0x1d95e9[0x0][_0xf645('0x67')];var _0x5a1224=(_0x1d95e9[0x0][_0xf645('0x7f')]+_0x1d95e9[0x0][_0xf645('0x6a')]+_0x1d95e9[0x0][_0xf645('0x69')])/_0x1d95e9[0x0][_0xf645('0x70')];_0x14ff26[_0xf645('0x6c')]=_0x5a1224>0x0?_0x5a1224:0x1;switch(_0x14ff26['dialPredictiveOptimization']){case _0xf645('0x1c2'):var _0x12ff49=_0x14ff26[_0xf645('0x1b6')]/0x64;return _0x199f1e[_0xf645('0x1ce')](_0x76f4c7,_0x2cd738,_0x16e43e,_0x5a1224,_0x12ff49)[_0xf645('0xb6')](function(_0x565999){return _0x1d42a2(_0x565999);});case'agentBusyFactor':var _0x35abed=_0x14ff26[_0xf645('0x1b6')]/0x64;return _0x199f1e[_0xf645('0x1cf')](_0x76f4c7,_0x2cd738,_0x16e43e,_0x5a1224,_0x35abed)[_0xf645('0xb6')](function(_0x14abfd){return _0x1d42a2(_0x14abfd);});default:return _0xd5f425(msgResponse(_0xf645('0x1d0'),_0xf645('0x13c'),_0xf645('0x1d1')));}}else{return _0xd5f425(msgResponse(_0xf645('0x1d0'),_0xf645('0x13c'),'check\x20failure'));}});};};Dialer[_0xf645('0x1c')]['getDataPredictiveOld']=function(_0x4351bb){var _0x1415cb=this;return function(_0x388a73){return new BPromise(function(_0x5cadec,_0x2fdd1f){_['merge'](_0x4351bb,_0x388a73[0x0]);if(checkGetDataPredictive(_0x388a73[0x0])){loggerPredictive['info'](JSON[_0xf645('0x77')](_0x388a73[0x0]));if(_0x4351bb[_0xf645('0x1bf')]===_0xf645('0x1c2')){return _0x1415cb[_0xf645('0xc3')](_0x4351bb['id'])[_0xf645('0xb6')](function(_0x1269df){var _0x56e964=_0x4351bb[_0xf645('0x154')]-_0x1269df[0x0][_0xf645('0x1d2')];var _0x45a0ef=_0x4351bb[_0xf645('0x1c5')]*0x3c;var _0x3426e0=_0x388a73[0x0][_0xf645('0x68')]+_0x388a73[0x0][_0xf645('0x67')];var _0x9b45f3=(_0x388a73[0x0][_0xf645('0x7f')]+_0x388a73[0x0][_0xf645('0x6a')]+_0x388a73[0x0][_0xf645('0x69')])/_0x388a73[0x0][_0xf645('0x70')];var _0x565427=_0x4351bb[_0xf645('0x1b6')]/0x64;_0x4351bb[_0xf645('0x6e')]=_0x1269df[0x0][_0xf645('0x1d2')]||0x0;_0x4351bb[_0xf645('0x6c')]=_0x9b45f3>0x0?_0x9b45f3:0x1;return _0x1415cb[_0xf645('0x1ce')](_0x56e964,_0x45a0ef,_0x3426e0,_0x9b45f3,_0x565427);})['then'](function(_0x44dbb3){return _0x5cadec(_0x44dbb3);})['catch'](function(_0x2c32af){return _0x2fdd1f(msgResponse('[CatchErlangB]',_0xf645('0x13c'),JSON[_0xf645('0x77')](_0x2c32af)));});}if(_0x4351bb[_0xf645('0x1bf')]===_0xf645('0x1d3')){return _0x1415cb[_0xf645('0xc3')](_0x4351bb['id'])[_0xf645('0xb6')](function(_0x79c0f9){var _0x13f116=_0x4351bb['loggedIn']-_0x79c0f9[0x0][_0xf645('0x1d2')];var _0x1ef954=_0x4351bb[_0xf645('0x1c5')]*0x3c;var _0x5d6a36=_0x388a73[0x0][_0xf645('0x68')]+_0x388a73[0x0][_0xf645('0x67')];var _0x51bd45=(_0x388a73[0x0][_0xf645('0x7f')]+_0x388a73[0x0][_0xf645('0x6a')]+_0x388a73[0x0][_0xf645('0x69')])/_0x388a73[0x0][_0xf645('0x70')];var _0x3f98d4=_0x4351bb[_0xf645('0x1b6')]/0x64;_0x4351bb[_0xf645('0x6e')]=_0x79c0f9[0x0][_0xf645('0x1d2')]||0x0;_0x4351bb[_0xf645('0x6c')]=_0x51bd45>0x0?_0x51bd45:0x1;return _0x1415cb[_0xf645('0x1cf')](_0x13f116,_0x1ef954,_0x5d6a36,_0x51bd45,_0x3f98d4);})[_0xf645('0xb6')](function(_0x5019b0){return _0x5cadec(_0x5019b0);})[_0xf645('0xad')](function(_0x59ff48){return _0x2fdd1f(msgResponse(_0xf645('0x1d4'),'Failure',JSON[_0xf645('0x77')](_0x59ff48)));});}}else{return _0x2fdd1f(msgResponse(_0xf645('0x1d0'),'Failure',_0xf645('0x1d5')));}});};};Dialer[_0xf645('0x1c')][_0xf645('0x1c7')]=function(_0x2c771a){var _0x544b0a=this;return function(){var _0x47f5a4=0x0;var _0x3bbbb9=Math['floor'](_0x2c771a[_0xf645('0x1d6')]*0x3e8);if(_0x3bbbb9>0x0){_0x3bbbb9=_0x3bbbb9<0x64?0x64:_0x3bbbb9;loggerPredictive[_0xf645('0x7d')](_0x2c771a[_0xf645('0x41')],_0xf645('0x1d7'),_0x3bbbb9,'milliseconds');_0x2c771a[_0xf645('0x92')]=setInterval(function(){_0x544b0a[_0xf645('0x92')](_0x2c771a);loggerPredictiveCalls[_0xf645('0x7d')](_0xf645('0x1d8'),_0x47f5a4+=0x1);},_0x3bbbb9);}else{loggerPredictive[_0xf645('0x7d')](_0x2c771a[_0xf645('0x41')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xf645('0x1c')][_0xf645('0x1d9')]=function(_0x23ae82,_0x113629){var _0x193d41=this;return function(_0x227a23){if(_[_0xf645('0x48')](_0x227a23)){if(_[_0xf645('0xab')](_0x113629[_0xf645('0x1da')])||!_0x113629[_0xf645('0x1db')]){if(_0x23ae82['dialMethod']===_0xf645('0x9')){_0x23ae82['queueStatusComplete']=_[_0xf645('0x85')](_0x23ae82[_0xf645('0x125')])?!![]:_0x23ae82[_0xf645('0x125')];var _0x4cb8d3=uuid['v4']();_0x193d41[_0xf645('0x27')][_0x4cb8d3]=new Action(_0x23ae82,_0x113629,_0x4cb8d3);loggerBooked[_0xf645('0x7d')](_0xf645('0x1dc'),_0x4cb8d3,'queueStatusComplete:\x20',JSON[_0xf645('0x77')](_0x23ae82[_0xf645('0x125')]),_0xf645('0x1dd'),_0x23ae82[_0xf645('0x41')]);if(_0x23ae82['queueStatusComplete']){_0x23ae82[_0xf645('0x125')]=![];_0x193d41[_0xf645('0x2d')][_0x193d41[_0xf645('0x27')][_0x4cb8d3][_0xf645('0xb1')]]=[];ami[_0xf645('0xac')]({'actionid':_0x4cb8d3,'action':_0xf645('0x1de'),'queue':_0x23ae82[_0xf645('0x41')]})['catch'](function(_0x5529db){_0x193d41[_0xf645('0xaf')](_0x23ae82);_0x193d41[_0xf645('0xbc')]({'active':![],'ContactId':_0x193d41[_0xf645('0x27')][_0x4cb8d3][_0xf645('0xf5')],'ListId':_0x193d41[_0xf645('0x27')][_0x4cb8d3][_0xf645('0xcf')],'VoiceQueueId':_0x193d41[_0xf645('0x27')][_0x4cb8d3][_0xf645('0xf6')]||undefined,'CampaignId':_0x193d41[_0xf645('0x27')][_0x4cb8d3][_0xf645('0xd0')]||undefined})[_0xf645('0xad')](loggerCatch(_0xf645('0x1df')));delete _0x193d41[_0xf645('0x27')][_0x4cb8d3];});}else{loggerBooked['info'](_0xf645('0x1e0'),JSON[_0xf645('0x77')](_0x23ae82[_0xf645('0x125')]),'Queue:\x20',_0x23ae82[_0xf645('0x41')]);_0x193d41[_0xf645('0xaf')](_0x23ae82);_0x193d41[_0xf645('0xbc')]({'active':![],'ContactId':_0x193d41[_0xf645('0x27')][_0x4cb8d3][_0xf645('0xf5')],'ListId':_0x193d41['actions'][_0x4cb8d3]['ListId'],'VoiceQueueId':_0x193d41[_0xf645('0x27')][_0x4cb8d3][_0xf645('0xf6')]||undefined,'CampaignId':_0x193d41[_0xf645('0x27')][_0x4cb8d3][_0xf645('0xd0')]||undefined})[_0xf645('0xad')](loggerCatch(_0xf645('0x1df')));delete _0x193d41[_0xf645('0x27')][_0x4cb8d3];}}else{return _0x193d41['actionOriginate'](_0x23ae82,_0x113629);}}else{if(getDiff(_0x113629[_0xf645('0x1e1')])<_0x23ae82[_0xf645('0x1e2')]*0x3c){if(_0x113629[_0xf645('0x1e3')]&&!_0x113629['Agent'][_0xf645('0x1e4')]){_0x193d41['preview']['run'](_0x113629['id'])[_0xf645('0x1e')](function(){_0x193d41[_0xf645('0xaf')](_0x23ae82);});}else{_0x193d41[_0xf645('0xbe')]({'active':![]},_0x113629['id'],0x1)['finally'](function(){console['log']('Contact\x20updated');_0x193d41[_0xf645('0xaf')](_0x23ae82);});}}else{_0x23ae82[_0xf645('0x65')]+=0x1;_0x193d41[_0xf645('0xaf')](_0x23ae82);if(_0x23ae82['dialRecallInQueue']){_0x193d41[_0xf645('0xbc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x113629[_0xf645('0xf5')],'ListId':_0x113629[_0xf645('0xcf')],'VoiceQueueId':_0x113629[_0xf645('0xf6')]||undefined,'CampaignId':_0x113629[_0xf645('0xd0')]||undefined})[_0xf645('0xad')](loggerCatch(_0xf645('0x1e5')));_0x193d41['createHistory'](createObjHistory(_0x23ae82,_0x113629,'RECALLINQUEUE',0x17,_0xf645('0x1e6')))[_0xf645('0xad')](loggerCatch(_0xf645('0x1e7')));}else{_0x193d41[_0xf645('0xcc')](createObjHistory(_0x23ae82,_0x113629,'RECALLFAILEDTIMEOUT',0x16,_0xf645('0x1e8')),_0xf645('0x1e9'),_0xf645('0x1ea'));}}}}else{_0x23ae82[_0xf645('0x60')]+=0x1;_0x193d41[_0xf645('0xcc')](createObjHistory(_0x23ae82,_0x113629,_0xf645('0x1eb'),0xd,'Blacklist'),_0xf645('0x1ec'),_0xf645('0x1ed'));throw _0xf645('0x1ee');}};};Dialer[_0xf645('0x1c')][_0xf645('0x1ef')]=function(_0x322921){var _0x2ccf2f=this;var _0x56bb70=[];var _0x1949ff=_0x322921['limitCalls']-_0x322921[_0xf645('0x71')]-_0x322921[_0xf645('0x1f0')];emitCampaignSummary(_0x322921);if(_0x1949ff>0x0){if(_0x1949ff>this[_0xf645('0x25')]){_0x1949ff=this['maxNumberOriginate'];}_0x322921[_0xf645('0x1f0')]+=_0x1949ff;this['getContactDialerIvr'](_0x322921['id'],_0x1949ff,_0x322921[_0xf645('0x1f1')])[_0xf645('0xb6')](function(_0x110f42){_0x322921[_0xf645('0x1f0')]-=_0x1949ff;_0x322921[_0xf645('0x1f0')]=_0x322921[_0xf645('0x1f0')]>0x0?_0x322921[_0xf645('0x1f0')]:0x0;if(!checkContactEmpty(_0x110f42)){_0x322921[_0xf645('0x40')]=_0xf645('0x1f2');logger['info'](_0xf645('0x1f3')+_0x322921[_0xf645('0x41')]);}else{_0x322921[_0xf645('0x71')]+=_0x110f42[_0xf645('0x98')];_0x322921[_0xf645('0x40')]=_0xf645('0x1f4');for(var _0x5c482a=0x0;_0x5c482a<_0x110f42[_0xf645('0x98')];_0x5c482a+=0x1){_0x322921[_0xf645('0x1f5')]+=0x1;if(_[_0xf645('0xab')](_0x110f42[_0x5c482a])||_[_0xf645('0xab')](_0x110f42[_0x5c482a][_0xf645('0x162')])||_['isNil'](_0x110f42[_0x5c482a][_0xf645('0x162')][_0xf645('0x163')])){_0x2ccf2f[_0xf645('0x1f6')](_0xf645('0x1f7'),_0x322921,_0x110f42[_0x5c482a]);}else{_0x2ccf2f[_0xf645('0xb8')](_['pick'](_0x110f42[_0x5c482a],[_0xf645('0xd0'),_0xf645('0x1f8')]))['then'](_0x2ccf2f[_0xf645('0x1d9')](_0x322921,_0x110f42[_0x5c482a]))[_0xf645('0xad')](_0x2ccf2f[_0xf645('0xca')](_0xf645('0x1f9'),_0x322921));}}}})[_0xf645('0xad')](loggerGetContactDialer(_0xf645('0x1fa'),_0x322921,_0x1949ff));}};Dialer['prototype'][_0xf645('0x14e')]=function(_0x47de8c,_0x4e4f04){var _0x517e96=this;var _0x32c9fc=[];var _0x279c47=_0x4e4f04>=0x1?_0x4e4f04:0x1;var _0x200825=[];if(_0x47de8c[_0xf645('0x5c')]===_0xf645('0x9')){_0x279c47=0x1;}var _0x2ebd2f=Math[_0xf645('0x1ba')](_0x47de8c['available']*_0x279c47)-_0x47de8c['originated']-_0x47de8c['temp'];emitVoiceQueueSummary(_0x47de8c);if(_0x47de8c['dialLimitQueue']>0x0){var _0x4cdcd5=_0x47de8c[_0xf645('0x1fb')]-_0x47de8c[_0xf645('0x71')]-_0x47de8c[_0xf645('0x56')]-_0x47de8c[_0xf645('0x1f0')]-_0x47de8c[_0xf645('0x53')];if(_0x2ebd2f>_0x4cdcd5){_0x2ebd2f=_0x4cdcd5;}}if(_0x2ebd2f>0x0){if(_0x47de8c[_0xf645('0x5c')]===_0xf645('0x9')){_0x2ebd2f=0x1;}if(_0x2ebd2f>this['maxNumberOriginate']){_0x2ebd2f=this[_0xf645('0x25')];}_0x47de8c[_0xf645('0x1f0')]+=_0x2ebd2f;for(var _0x216dfd in this[_0xf645('0x23')]){if(this[_0xf645('0x23')][_0xf645('0x99')](_0x216dfd)){if(this[_0xf645('0x23')][_0x216dfd][_0xf645('0xe5')]===_0xf645('0x1fc')&&this[_0xf645('0x23')][_0x216dfd]['status']===_0xf645('0x1fd')){_0x32c9fc[_0xf645('0x140')](this[_0xf645('0x23')][_0x216dfd]['id']);}}}this[_0xf645('0xc0')](_0x47de8c['id'],_0x32c9fc,_0x2ebd2f,_0x47de8c[_0xf645('0x1f1')])['then'](function(_0x153f15){_0x47de8c[_0xf645('0x1f0')]-=_0x2ebd2f;_0x47de8c['temp']=_0x47de8c['temp']>0x0?_0x47de8c[_0xf645('0x1f0')]:0x0;if(!checkContactEmpty(_0x153f15)){_0x517e96['countReScheduled'](_0x47de8c)[_0xf645('0xb6')](sendMessageReschedule(_0x47de8c))[_0xf645('0xad')](loggerCatch(_0xf645('0xb4')));}else{_0x47de8c[_0xf645('0x71')]+=_0x153f15[_0xf645('0x98')];_0x47de8c['message']=_0x47de8c[_0xf645('0x5c')]===_0xf645('0x9')?'ACTIVE':_0xf645('0x1f4');for(var _0x3e909c=0x0;_0x3e909c<_0x153f15[_0xf645('0x98')];_0x3e909c+=0x1){if(_[_0xf645('0xab')](_0x153f15[_0x3e909c])||_[_0xf645('0xab')](_0x153f15[_0x3e909c][_0xf645('0x162')])||_['isNil'](_0x153f15[_0x3e909c][_0xf645('0x162')][_0xf645('0x163')])){_0x517e96['emptyContact']('[actionOriginate]\x20',_0x47de8c,_0x153f15[_0x3e909c]);}else{_0x517e96[_0xf645('0xb5')](_['pick'](_0x153f15[_0x3e909c],[_0xf645('0xf6'),_0xf645('0x1f8')]))['then'](_0x517e96[_0xf645('0x1d9')](_0x47de8c,_0x153f15[_0x3e909c]))[_0xf645('0xad')](_0x517e96[_0xf645('0xca')](_0xf645('0x1f7'),_0x47de8c));}}}})[_0xf645('0xad')](loggerGetContactDialer(_0xf645('0x1fe'),_0x47de8c,_0x2ebd2f));}};Dialer['prototype'][_0xf645('0x92')]=function(_0x9a49c6){var _0x55a28b=this;if(_0x9a49c6[_0xf645('0x1fb')]>0x0){var _0x3a0daa=_0x9a49c6[_0xf645('0x1fb')]-_0x9a49c6[_0xf645('0x71')]-_0x9a49c6[_0xf645('0x56')];if(_0x3a0daa>0x0){this[_0xf645('0x1ff')](_0x9a49c6);}else{loggerPredictiveCalls[_0xf645('0x7d')](_0xf645('0x200'));}}else{this[_0xf645('0x1ff')](_0x9a49c6);}};Dialer[_0xf645('0x1c')][_0xf645('0x1ff')]=function(_0x4a4bfb){var _0x1aca85=this;var _0x62880a=[];_0x4a4bfb[_0xf645('0x71')]+=0x1;for(var _0x391ad9 in this[_0xf645('0x23')]){if(this[_0xf645('0x23')][_0xf645('0x99')](_0x391ad9)){if(this['agents'][_0x391ad9][_0xf645('0xe5')]===_0xf645('0x1fc')&&this[_0xf645('0x23')][_0x391ad9][_0xf645('0xd5')]===_0xf645('0x1fd')){_0x62880a[_0xf645('0x140')](this[_0xf645('0x23')][_0x391ad9]['id']);}}}this[_0xf645('0xc0')](_0x4a4bfb['id'],_0x62880a,0x1,_0x4a4bfb[_0xf645('0x1f1')])['then'](function(_0x1f84f7){if(!checkContactEmpty(_0x1f84f7)){checkContactLowerLimitOriginate(_0x4a4bfb,0x1,0x0);_0x1aca85[_0xf645('0xb2')](_0x4a4bfb)[_0xf645('0xb6')](sendMessageReschedule(_0x4a4bfb))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x4a4bfb[_0xf645('0x40')]=_0xf645('0x1f4');if(_['isNil'](_0x1f84f7[0x0])||_[_0xf645('0xab')](_0x1f84f7[0x0][_0xf645('0x162')])||_['isNil'](_0x1f84f7[0x0][_0xf645('0x162')][_0xf645('0x163')])){_0x1aca85['emptyContact'](_0xf645('0x1f7'),_0x4a4bfb,_0x1f84f7[0x0]);}else{_0x1aca85[_0xf645('0xb5')](_[_0xf645('0xce')](_0x1f84f7[0x0],['VoiceQueueId',_0xf645('0x1f8')]))[_0xf645('0xb6')](_0x1aca85[_0xf645('0x1d9')](_0x4a4bfb,_0x1f84f7[0x0]))[_0xf645('0xad')](_0x1aca85[_0xf645('0xca')](_0xf645('0x201'),_0x4a4bfb));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x4a4bfb,0x1));emitVoiceQueueSummary(_0x4a4bfb);};Dialer['prototype'][_0xf645('0x1ce')]=function(_0x1281e5,_0x28af1e,_0x63575a,_0x57bba2,_0x20eddc,_0xe5eff6){loggerPredictive[_0xf645('0x7d')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xf645('0x7d')](_0xf645('0x202'),_0x1281e5);loggerPredictive[_0xf645('0x7d')](_0xf645('0x203'),_0x28af1e);loggerPredictive[_0xf645('0x7d')](_0xf645('0x204'),_0x63575a);loggerPredictive['info'](_0xf645('0x205'),_0x57bba2);loggerPredictive[_0xf645('0x7d')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x20eddc);loggerPredictive[_0xf645('0x7d')]('---------------------------');return new BPromise(function(_0x519f2f,_0x2a6f88){if(_0x1281e5<=0x0||isNaN(_0x1281e5)){return _0x2a6f88(msgResponse(_0xf645('0x206'),_0xf645('0x4b'),_0xf645('0x207')+_0x1281e5));}if(_0x63575a<=0x0||isNaN(_0x63575a)){return _0x2a6f88(msgResponse(_0xf645('0x206'),'Error',_0xf645('0x208')+_0x63575a));}if(_0x57bba2<=0x0||isNaN(_0x57bba2)){return _0x2a6f88(msgResponse(_0xf645('0x206'),_0xf645('0x4b'),_0xf645('0x209')+_0x57bba2));}if(_0x28af1e<=0x0||isNaN(_0x28af1e)){return _0x2a6f88(msgResponse('[abandonmentRate]',_0xf645('0x4b'),_0xf645('0x20a')+_0x28af1e));}if(_0x20eddc<=0x0||isNaN(_0x20eddc)){return _0x2a6f88(msgResponse(_0xf645('0x206'),'Error',_0xf645('0x20b')+_0x20eddc));}_0xe5eff6=_0xe5eff6||0x0;var _0x4d5e7a=0x1/_0x63575a;var _0x31a506=0x0;var _0x2cffe2=0x0;var _0x5adce2=0x0;var _0x5a018f=0x0;for(var _0x102e06=0x0;_0x5adce2<_0x20eddc;_0x102e06+=0x1){_0x2cffe2=_0x102e06/_0x28af1e;_0x31a506=(_0x57bba2*_0x2cffe2+_0xe5eff6)/_0x4d5e7a;_0x5adce2=erlangb(_0x31a506,_0x1281e5);_0x5a018f=_0x31a506/_0x1281e5*(0x1-erlangb(_0x31a506,_0x1281e5));}return _0x519f2f({'erlangCalls':_0x102e06,'erlangCallToSecond':_0x28af1e/_0x102e06,'erlangAbandonmentRate':_0x5adce2,'erlangBusyFactor':_0x5a018f});});};Dialer['prototype'][_0xf645('0x1cf')]=function(_0x572e2b,_0x2d5edc,_0x1b8fed,_0x407c7f,_0x457721,_0x256d95){loggerPredictive['info'](_0xf645('0x20c'));loggerPredictive[_0xf645('0x7d')](_0xf645('0x202'),_0x572e2b);loggerPredictive[_0xf645('0x7d')](_0xf645('0x203'),_0x2d5edc);loggerPredictive[_0xf645('0x7d')]('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',_0x1b8fed);loggerPredictive[_0xf645('0x7d')](_0xf645('0x205'),_0x407c7f);loggerPredictive[_0xf645('0x7d')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x457721);loggerPredictive[_0xf645('0x7d')]('---------------------------');return new BPromise(function(_0x597e38,_0xc0a5e){if(_0x572e2b<=0x0||isNaN(_0x572e2b)){return _0xc0a5e(msgResponse('[busyFactor]',_0xf645('0x4b'),_0xf645('0x207')+_0x572e2b));}if(_0x1b8fed<=0x0||isNaN(_0x1b8fed)){return _0xc0a5e(msgResponse(_0xf645('0x20d'),_0xf645('0x4b'),'Ts\x20=\x20'+_0x1b8fed));}if(_0x407c7f<=0x0||isNaN(_0x407c7f)){return _0xc0a5e(msgResponse('[busyFactor]',_0xf645('0x4b'),'p\x20=\x20'+_0x407c7f));}if(_0x2d5edc<=0x0||isNaN(_0x2d5edc)){return _0xc0a5e(msgResponse('[busyFactor]',_0xf645('0x4b'),'interval\x20=\x20'+_0x2d5edc));}if(_0x457721<=0x0||isNaN(_0x457721)){return _0xc0a5e(msgResponse(_0xf645('0x20d'),_0xf645('0x4b'),_0xf645('0x20e')+_0x457721));}_0x256d95=_0x256d95||0x0;var _0xcb8e91=0x1/_0x1b8fed;var _0x23ad72=0x0;var _0x3ecc78=0x0;var _0x138224=0x0;var _0x37faeb=0x0;for(var _0x21d509=0x0;_0x37faeb<_0x457721;_0x21d509+=0x1){_0x3ecc78=_0x21d509/_0x2d5edc;_0x23ad72=(_0x407c7f*_0x3ecc78+_0x256d95)/_0xcb8e91;_0x138224=erlangb(_0x23ad72,_0x572e2b);_0x37faeb=_0x23ad72/_0x572e2b*(0x1-erlangb(_0x23ad72,_0x572e2b));}return _0x597e38({'erlangCalls':_0x21d509,'erlangCallToSecond':_0x2d5edc/_0x21d509,'erlangAbandonmentRate':_0x138224,'erlangBusyFactor':_0x37faeb});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 7236fdf..eba0823 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 _0x34e2=['holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime'];(function(_0x367824,_0x329953){var _0x3210f4=function(_0x47f826){while(--_0x47f826){_0x367824['push'](_0x367824['shift']());}};_0x3210f4(++_0x329953);}(_0x34e2,0x114));var _0x234e=function(_0x3bca12,_0x3d262a){_0x3bca12=_0x3bca12-0x0;var _0x55b5b7=_0x34e2[_0x3bca12];return _0x55b5b7;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x234e('0x0'));function getSeconds(_0x55e377,_0x46ad3e){var _0x375b60=moment(_0x55e377)[_0x234e('0x1')](0x0);var _0x3f448f=moment(_0x46ad3e)['milliseconds'](0x0);return _0x375b60[_0x234e('0x2')](_0x3f448f,_0x234e('0x3'));}function QueueCallerAbandon(_0x3db1ab,_0x4b19b9){this[_0x234e('0x4')]=_0x3db1ab[_0x234e('0x4')];this['type']=_0x3db1ab[_0x234e('0x5')];this[_0x234e('0x6')]=_0x3db1ab[_0x234e('0x5')]===_0x234e('0x7')?'queue':_0x3db1ab[_0x234e('0x5')];this[_0x234e('0x8')]=_0x3db1ab[_0x234e('0x8')];this[_0x234e('0x9')]=_0x3db1ab[_0x234e('0x9')];this[_0x234e('0xa')]=_0x3db1ab[_0x234e('0xa')];this['countglobal']=_0x3db1ab[_0x234e('0x8')]+_0x3db1ab['countcongestionretry']+_0x3db1ab[_0x234e('0xa')]+_0x3db1ab[_0x234e('0xb')]+_0x3db1ab[_0x234e('0xc')]+_0x3db1ab[_0x234e('0xd')]+_0x3db1ab[_0x234e('0xe')]+_0x3db1ab['countagentrejectretry'];this['countnosuchnumberretry']=_0x3db1ab['countnosuchnumberretry'];this['countdropretry']=_0x3db1ab['countdropretry'];this[_0x234e('0xd')]=_0x3db1ab[_0x234e('0xd')];this[_0x234e('0xe')]=_0x3db1ab['countmachineretry'];this[_0x234e('0xf')]=_0x3db1ab[_0x234e('0xf')];this[_0x234e('0x10')]=_0x4b19b9['uniqueid'];this['calleridname']=_0x3db1ab[_0x234e('0x11')];this[_0x234e('0x12')]=_0x3db1ab[_0x234e('0x13')];this[_0x234e('0x14')]=_0x3db1ab['starttime'];this[_0x234e('0x15')]=_0x3db1ab['responsetime'];this[_0x234e('0x16')]=_0x3db1ab['droptime'];this[_0x234e('0x17')]=this[_0x234e('0x16')];this[_0x234e('0x18')]=getSeconds(_0x3db1ab['responsetime'],_0x3db1ab[_0x234e('0x14')]);this[_0x234e('0x19')]=getSeconds(this[_0x234e('0x16')],_0x3db1ab[_0x234e('0x15')]);this[_0x234e('0x1a')]=0x0;this[_0x234e('0x1b')]=_0x4b19b9[_0x234e('0x1b')];this[_0x234e('0x1c')]=_0x4b19b9[_0x234e('0x1d')];this[_0x234e('0x1e')]=_0x4b19b9[_0x234e('0x1e')];this[_0x234e('0x1f')]=_0x3db1ab['callback'];this[_0x234e('0x20')]=_0x3db1ab[_0x234e('0x20')];this[_0x234e('0x21')]=_0x3db1ab[_0x234e('0x21')];this[_0x234e('0x22')]=_0x3db1ab['recallme'];this[_0x234e('0x23')]=_0x3db1ab[_0x234e('0x23')];this[_0x234e('0x24')]=_0x3db1ab[_0x234e('0x24')];this[_0x234e('0x25')]=_0x3db1ab['UserId'];this[_0x234e('0x26')]=_0x3db1ab[_0x234e('0x26')];this[_0x234e('0x27')]=_0x3db1ab[_0x234e('0x27')];this[_0x234e('0x28')]=_0x3db1ab[_0x234e('0x28')]||'';this[_0x234e('0x29')]=_0x3db1ab[_0x234e('0x29')]||'';}module[_0x234e('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0xce9a=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','lodash','moment','milliseconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x820307,_0x33406b){var _0x551324=function(_0x1f1e54){while(--_0x1f1e54){_0x820307['push'](_0x820307['shift']());}};_0x551324(++_0x33406b);}(_0xce9a,0x9f));var _0xace9=function(_0x4e089c,_0x4e3974){_0x4e089c=_0x4e089c-0x0;var _0x1d55ef=_0xce9a[_0x4e089c];return _0x1d55ef;};'use strict';var util=require(_0xace9('0x0'));var _=require(_0xace9('0x1'));var moment=require(_0xace9('0x2'));function getSeconds(_0x1e9734,_0x5f459c){var _0x3d5e2b=moment(_0x1e9734)[_0xace9('0x3')](0x0);var _0x4e3562=moment(_0x5f459c)[_0xace9('0x3')](0x0);return _0x3d5e2b['diff'](_0x4e3562,'seconds');}function QueueCallerAbandon(_0x20cb44,_0x5efac5){this[_0xace9('0x4')]=_0x20cb44['scheduledat'];this['type']=_0x20cb44[_0xace9('0x5')];this[_0xace9('0x6')]=_0x20cb44['type']===_0xace9('0x7')?_0xace9('0x8'):_0x20cb44[_0xace9('0x5')];this[_0xace9('0x9')]=_0x20cb44['countbusyretry'];this[_0xace9('0xa')]=_0x20cb44[_0xace9('0xa')];this[_0xace9('0xb')]=_0x20cb44[_0xace9('0xb')];this[_0xace9('0xc')]=_0x20cb44[_0xace9('0x9')]+_0x20cb44[_0xace9('0xa')]+_0x20cb44[_0xace9('0xb')]+_0x20cb44['countnosuchnumberretry']+_0x20cb44[_0xace9('0xd')]+_0x20cb44[_0xace9('0xe')]+_0x20cb44[_0xace9('0xf')]+_0x20cb44[_0xace9('0x10')];this[_0xace9('0x11')]=_0x20cb44[_0xace9('0x11')];this['countdropretry']=_0x20cb44[_0xace9('0xd')];this[_0xace9('0xe')]=_0x20cb44[_0xace9('0xe')];this[_0xace9('0xf')]=_0x20cb44[_0xace9('0xf')];this['countagentrejectretry']=_0x20cb44[_0xace9('0x10')];this[_0xace9('0x12')]=_0x5efac5[_0xace9('0x12')];this[_0xace9('0x13')]=_0x20cb44[_0xace9('0x14')];this[_0xace9('0x15')]=_0x20cb44[_0xace9('0x16')];this[_0xace9('0x17')]=_0x20cb44[_0xace9('0x17')];this[_0xace9('0x18')]=_0x20cb44['responsetime'];this[_0xace9('0x19')]=_0x20cb44['droptime'];this['endtime']=this[_0xace9('0x19')];this[_0xace9('0x1a')]=getSeconds(_0x20cb44[_0xace9('0x18')],_0x20cb44[_0xace9('0x17')]);this[_0xace9('0x1b')]=getSeconds(this[_0xace9('0x19')],_0x20cb44[_0xace9('0x18')]);this[_0xace9('0x1c')]=0x0;this[_0xace9('0x8')]=_0x5efac5['queue'];this[_0xace9('0x1d')]=_0x5efac5[_0xace9('0x1e')];this[_0xace9('0x1f')]=_0x5efac5[_0xace9('0x1f')];this[_0xace9('0x20')]=_0x20cb44[_0xace9('0x20')];this[_0xace9('0x21')]=_0x20cb44[_0xace9('0x21')];this[_0xace9('0x22')]=_0x20cb44['callbackat'];this[_0xace9('0x23')]=_0x20cb44[_0xace9('0x23')];this[_0xace9('0x24')]=_0x20cb44[_0xace9('0x24')];this['ListId']=_0x20cb44[_0xace9('0x25')];this['UserId']=_0x20cb44[_0xace9('0x26')];this[_0xace9('0x27')]=_0x20cb44['VoiceQueueId'];this[_0xace9('0x28')]=_0x20cb44[_0xace9('0x28')];this['originatecalleridnum']=_0x20cb44['originatecalleridnum']||'';this[_0xace9('0x29')]=_0x20cb44['originatecalleridname']||'';}module[_0xace9('0x2a')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index edd5fc7..23689ed 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 _0xdcc9=['path','AttachmentId','util','lodash','moment','uniqueid','channel','format','%s/%s/%s','Trunk','name','fax','localstationid','headerinfo'];(function(_0x18af0a,_0x3ddec9){var _0x15acee=function(_0x4f9adb){while(--_0x4f9adb){_0x18af0a['push'](_0x18af0a['shift']());}};_0x15acee(++_0x3ddec9);}(_0xdcc9,0x1c2));var _0x9dcc=function(_0x1b1f88,_0x3fe1cb){_0x1b1f88=_0x1b1f88-0x0;var _0x5045b9=_0xdcc9[_0x1b1f88];return _0x5045b9;};'use strict';var util=require(_0x9dcc('0x0'));var _=require(_0x9dcc('0x1'));var moment=require(_0x9dcc('0x2'));function Action(_0x49bed8,_0x59dd94,_0x30f8a1){this[_0x9dcc('0x3')]=_0x49bed8||undefined;this[_0x9dcc('0x4')]=util[_0x9dcc('0x5')](_0x9dcc('0x6'),_0x59dd94['tech'],_0x59dd94[_0x9dcc('0x7')][_0x9dcc('0x8')],_0x30f8a1[_0x9dcc('0x9')]);this['localstationid']=_0x59dd94[_0x9dcc('0xa')];this[_0x9dcc('0xb')]=_0x59dd94[_0x9dcc('0xb')];this[_0x9dcc('0xc')]=_0x30f8a1[_0x9dcc('0xc')];this['AttachmentId']=_0x30f8a1[_0x9dcc('0xd')];}module['exports']=Action; \ No newline at end of file +var _0xd3c9=['Trunk','name','fax','localstationid','headerinfo','path','AttachmentId','exports','util','lodash','moment','uniqueid','channel','format','%s/%s/%s','tech'];(function(_0x42fc3e,_0xdc5885){var _0x52e1fa=function(_0x9e9274){while(--_0x9e9274){_0x42fc3e['push'](_0x42fc3e['shift']());}};_0x52e1fa(++_0xdc5885);}(_0xd3c9,0xb8));var _0x9d3c=function(_0x5c80bc,_0xcc4195){_0x5c80bc=_0x5c80bc-0x0;var _0x3c8b48=_0xd3c9[_0x5c80bc];return _0x3c8b48;};'use strict';var util=require(_0x9d3c('0x0'));var _=require(_0x9d3c('0x1'));var moment=require(_0x9d3c('0x2'));function Action(_0x2f46b1,_0x90f650,_0x5c5278){this[_0x9d3c('0x3')]=_0x2f46b1||undefined;this[_0x9d3c('0x4')]=util[_0x9d3c('0x5')](_0x9d3c('0x6'),_0x90f650[_0x9d3c('0x7')],_0x90f650[_0x9d3c('0x8')][_0x9d3c('0x9')],_0x5c5278[_0x9d3c('0xa')]);this[_0x9d3c('0xb')]=_0x90f650[_0x9d3c('0xb')];this[_0x9d3c('0xc')]=_0x90f650['headerinfo'];this[_0x9d3c('0xd')]=_0x5c5278[_0x9d3c('0xd')];this[_0x9d3c('0xe')]=_0x5c5278[_0x9d3c('0xe')];}module[_0x9d3c('0xf')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index acff4ff..4811487 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 _0x69ad=['variablesAction','execOriginate','addVariables','ext','isTrunkReachable','active','SIP/%s','isNil','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','exports','util','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','syncNewState','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','hasOwnProperty','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','then','notify','catch','error','\x20notify\x20','\x20receiveFax\x20','merge','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','stringify','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','Fax\x20failed','checkTrunk','Trunk','Trunk\x20Reachable','format','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif'];(function(_0x11f926,_0x26af58){var _0x355bf6=function(_0x2c2267){while(--_0x2c2267){_0x11f926['push'](_0x11f926['shift']());}};_0x355bf6(++_0x26af58);}(_0x69ad,0xed));var _0xd69a=function(_0xe259b0,_0x1636ce){_0xe259b0=_0xe259b0-0x0;var _0x56897c=_0x69ad[_0xe259b0];return _0x56897c;};'use strict';var util=require(_0xd69a('0x0'));var _=require('lodash');var BPromise=require(_0xd69a('0x1'));var uuid=require('uuid');var moment=require(_0xd69a('0x2'));var path=require(_0xd69a('0x3'));var tiff2pdf=require(_0xd69a('0x4'));var gs=require(_0xd69a('0x5'));var logger=require(_0xd69a('0x6'))(_0xd69a('0x7'));var ami=require(_0xd69a('0x8'));var rpcDb=require(_0xd69a('0x9'));var Channel=require(_0xd69a('0xa'));var ut=require(_0xd69a('0xb'));var Action=require(_0xd69a('0xc'));var faxAccount=require(_0xd69a('0xd'));var attachment=require(_0xd69a('0xe'));var faxMessage=require(_0xd69a('0xf'));function Fax(_0x33dbf0){this['channels']={};this[_0xd69a('0x10')]=_0x33dbf0['faxAccounts'];this[_0xd69a('0x11')]=_0x33dbf0['trunks'];this[_0xd69a('0x12')]={};ami['on']('newchannel',this[_0xd69a('0x13')][_0xd69a('0x14')](this));ami['on'](_0xd69a('0x15'),this[_0xd69a('0x16')]['bind'](this));ami['on']('newstate',this[_0xd69a('0x17')][_0xd69a('0x14')](this));ami['on']('newexten',this['syncNewExten'][_0xd69a('0x14')](this));ami['on'](_0xd69a('0x18'),this[_0xd69a('0x19')][_0xd69a('0x14')](this));ami['on'](_0xd69a('0x1a'),this[_0xd69a('0x1b')][_0xd69a('0x14')](this));ami['on'](_0xd69a('0x1c'),this[_0xd69a('0x1d')][_0xd69a('0x14')](this));ami['on']('originateresponse',this[_0xd69a('0x1e')]['bind'](this));}Fax[_0xd69a('0x1f')][_0xd69a('0x13')]=function(_0x6c80fa){if(_0x6c80fa[_0xd69a('0x20')]===_0xd69a('0x21')){for(var _0x9c12ee in this[_0xd69a('0x10')]){if(this[_0xd69a('0x10')]['hasOwnProperty'](_0x9c12ee)){if(_0x6c80fa['exten']===this[_0xd69a('0x10')][_0x9c12ee][_0xd69a('0x22')]){this[_0xd69a('0x23')][_0x6c80fa[_0xd69a('0x24')]]={};this[_0xd69a('0x23')][_0x6c80fa[_0xd69a('0x24')]][_0xd69a('0x25')]=_0x6c80fa['channel'];this[_0xd69a('0x23')][_0x6c80fa[_0xd69a('0x24')]]['id']=this['faxAccounts'][_0x9c12ee]['id'];this[_0xd69a('0x23')][_0x6c80fa[_0xd69a('0x24')]][_0xd69a('0x26')]=this[_0xd69a('0x10')][_0x9c12ee][_0xd69a('0x26')];logger[_0xd69a('0x27')](_0x6c80fa[_0xd69a('0x24')],_0xd69a('0x28'));}}}}if(this['actions'][_0x6c80fa['uniqueid']]){this['channels'][_0x6c80fa[_0xd69a('0x24')]]={};this['channels'][_0x6c80fa[_0xd69a('0x24')]][_0xd69a('0x25')]=_0x6c80fa[_0xd69a('0x25')];logger[_0xd69a('0x27')](_0x6c80fa['uniqueid'],'\x20syncNewchannel\x20');}};Fax[_0xd69a('0x1f')][_0xd69a('0x16')]=function(_0x19f184){if(this['channels'][_0x19f184[_0xd69a('0x24')]]){for(var _0x5d0da2 in _0x19f184[_0xd69a('0x29')]){if(_0x19f184['variable']['hasOwnProperty'](_0x5d0da2)){this['channels'][_0x19f184[_0xd69a('0x24')]][_0x5d0da2]=_0x19f184[_0xd69a('0x2a')];}}}};Fax[_0xd69a('0x1f')]['syncNewState']=function(_0x183e33){if(this[_0xd69a('0x23')][_0x183e33[_0xd69a('0x24')]]){this[_0xd69a('0x23')][_0x183e33[_0xd69a('0x24')]]['channelstate']=_0x183e33[_0xd69a('0x2b')];this[_0xd69a('0x23')][_0x183e33[_0xd69a('0x24')]][_0xd69a('0x2c')]=_0x183e33[_0xd69a('0x2c')];}};Fax['prototype']['syncNewExten']=function(_0x5498be){if(this[_0xd69a('0x23')][_0x5498be[_0xd69a('0x24')]]){for(var _0x5eb099 in _0x5498be[_0xd69a('0x29')]){if(_0x5498be['variable'][_0xd69a('0x2d')](_0x5eb099)){this[_0xd69a('0x23')][_0x5498be['uniqueid']][_0x5eb099]=_0x5498be['value'];}}}};Fax[_0xd69a('0x1f')][_0xd69a('0x19')]=function(_0x128fbb){if(this[_0xd69a('0x23')][_0x128fbb['uniqueid']]){this[_0xd69a('0x23')][_0x128fbb[_0xd69a('0x24')]][_0xd69a('0x2e')]=_0x128fbb[_0xd69a('0x2e')];this[_0xd69a('0x23')][_0x128fbb[_0xd69a('0x24')]][_0xd69a('0x2f')]=_0x128fbb[_0xd69a('0x2f')];this[_0xd69a('0x23')][_0x128fbb['uniqueid']][_0xd69a('0x22')]=_0x128fbb[_0xd69a('0x22')];this[_0xd69a('0x23')][_0x128fbb[_0xd69a('0x24')]][_0xd69a('0x30')]=_0x128fbb['filename'];logger[_0xd69a('0x27')](_0x128fbb[_0xd69a('0x24')],_0xd69a('0x31'));}};Fax[_0xd69a('0x1f')]['syncReceiveFax']=function(_0x30b69b){var _0x4b758e=this;if(this[_0xd69a('0x23')][_0x30b69b[_0xd69a('0x24')]]){var _0x16c2fe=this[_0xd69a('0x23')][_0x30b69b[_0xd69a('0x24')]]['id'];this[_0xd69a('0x23')][_0x30b69b[_0xd69a('0x24')]]['remotestationid']=_0x30b69b[_0xd69a('0x32')];this[_0xd69a('0x23')][_0x30b69b['uniqueid']]['pagestransferred']=_0x30b69b[_0xd69a('0x33')];this[_0xd69a('0x23')][_0x30b69b['uniqueid']][_0xd69a('0x22')]=_0x30b69b['localstationid'];this[_0xd69a('0x23')][_0x30b69b['uniqueid']][_0xd69a('0x34')]=_0x30b69b[_0xd69a('0x34')];this[_0xd69a('0x23')][_0x30b69b[_0xd69a('0x24')]][_0xd69a('0x35')]=_0x30b69b[_0xd69a('0x35')];this['channels'][_0x30b69b[_0xd69a('0x24')]][_0xd69a('0x30')]=_0x30b69b[_0xd69a('0x30')];this[_0xd69a('0x23')][_0x30b69b[_0xd69a('0x24')]][_0xd69a('0x36')]=_0x30b69b[_0xd69a('0x36')];if(this[_0xd69a('0x23')][_0x30b69b[_0xd69a('0x24')]][_0xd69a('0x33')]>0x0){tiff2pdf(_0x30b69b[_0xd69a('0x30')],_0xd69a('0x37'),function(_0x459107){logger[_0xd69a('0x27')](_0x30b69b[_0xd69a('0x24')],_0xd69a('0x38'),_0x459107['message']);attachment[_0xd69a('0x39')]({'name':path[_0xd69a('0x3a')](_0x30b69b[_0xd69a('0x30')])['name'],'basename':path[_0xd69a('0x3a')](_0x30b69b[_0xd69a('0x30')])[_0xd69a('0x26')]+_0xd69a('0x3b'),'type':'application/pdf'})[_0xd69a('0x3c')](function(_0xe0e31c){faxAccount[_0xd69a('0x3d')](_0x16c2fe,{'from':_0x30b69b['calleridnum'],'mapKey':'fax','body':path[_0xd69a('0x3a')](_0x30b69b['filename'])[_0xd69a('0x26')]+_0xd69a('0x3b'),'AttachmentId':_0xe0e31c['id']})[_0xd69a('0x3e')](function(_0x500361){logger[_0xd69a('0x3f')](_0x30b69b[_0xd69a('0x24')],_0xd69a('0x40'),JSON['stringify'](_0x500361));});})[_0xd69a('0x3e')](function(_0x48e81a){logger[_0xd69a('0x3f')](_0x30b69b[_0xd69a('0x24')],_0xd69a('0x41'),JSON['stringify'](_0x48e81a));});});}logger['info'](_0x30b69b[_0xd69a('0x24')],'\x20receiveFax\x20');}};Fax[_0xd69a('0x1f')][_0xd69a('0x1e')]=function(_0x44c767){if(this[_0xd69a('0x12')][_0x44c767[_0xd69a('0x24')]]){_[_0xd69a('0x42')](this[_0xd69a('0x23')][_0x44c767['uniqueid']],_['pick'](_0x44c767,[_0xd69a('0x43'),_0xd69a('0x44')]));}};function updateStatus(_0x331e98){if(_0x331e98[_0xd69a('0x45')]){faxMessage[_0xd69a('0x46')](_0x331e98[_0xd69a('0x45')],{'failMessage':_0xd69a('0x47')})[_0xd69a('0x3c')](function(_0x3417e0){ut[_0xd69a('0x48')](_0xd69a('0x49'),_0x3417e0);})[_0xd69a('0x3e')](function(_0x4b7d8f){ut[_0xd69a('0x48')](_0xd69a('0x4a'),_0x4b7d8f);});}else{ut['logger'](_0xd69a('0x4b'));}}Fax[_0xd69a('0x1f')][_0xd69a('0x4c')]=function(_0x267402,_0x4e595c,_0x54b59d){var _0x225c9b=this;var _0x287089={};if(_0x4e595c){_0x287089={'read':_0x4e595c};}else{_0x287089={'failMessage':_0x54b59d};}if(this[_0xd69a('0x12')][_0x267402][_0xd69a('0x45')]){faxMessage[_0xd69a('0x46')](this['actions'][_0x267402]['AttachmentId'],_0x287089)[_0xd69a('0x3c')](function(_0x282914){ut[_0xd69a('0x48')]('[Fax][Message][Updated]',_0x282914);})[_0xd69a('0x3e')](function(_0xa27f){ut['logger'](_0xd69a('0x4d'),_0xa27f);})['finally'](function(){delete _0x225c9b['channels'][_0x267402];delete _0x225c9b[_0xd69a('0x12')][_0x267402];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0xd69a('0x23')][_0x267402];delete this[_0xd69a('0x12')][_0x267402];}};Fax[_0xd69a('0x1f')][_0xd69a('0x1d')]=function(_0x51d812){var _0x5a5c3d=this;if(this[_0xd69a('0x23')][_0x51d812[_0xd69a('0x24')]]){if(this['actions'][_0x51d812['uniqueid']]){this[_0xd69a('0x23')][_0x51d812[_0xd69a('0x24')]]['id']=this[_0xd69a('0x12')][_0x51d812[_0xd69a('0x24')]]['id'];this[_0xd69a('0x23')][_0x51d812[_0xd69a('0x24')]][_0xd69a('0x26')]=this[_0xd69a('0x12')][_0x51d812[_0xd69a('0x24')]][_0xd69a('0x26')];}logger[_0xd69a('0x27')](_0x51d812[_0xd69a('0x24')],this[_0xd69a('0x12')][_0x51d812['uniqueid']]?_0xd69a('0x4e'):_0xd69a('0x4f'),JSON[_0xd69a('0x50')](this[_0xd69a('0x23')][_0x51d812[_0xd69a('0x24')]]));if(this[_0xd69a('0x12')][_0x51d812[_0xd69a('0x24')]]){if(this[_0xd69a('0x23')][_0x51d812['uniqueid']][_0xd69a('0x51')]>0x0&&this['channels'][_0x51d812[_0xd69a('0x24')]][_0xd69a('0x18')]===_0xd69a('0x52')){this[_0xd69a('0x4c')](_0x51d812[_0xd69a('0x24')],!![]);}else{this[_0xd69a('0x4c')](_0x51d812[_0xd69a('0x24')],![],this['channels'][_0x51d812['uniqueid']][_0xd69a('0x53')]?'SENDING\x20FAILED:\x20'+this[_0xd69a('0x23')][_0x51d812[_0xd69a('0x24')]][_0xd69a('0x53')]:_0xd69a('0x54'));}}}};Fax[_0xd69a('0x1f')][_0xd69a('0x55')]=function(_0x58172b){var _0x5932d0=this;return new BPromise(function(_0x1a9bad,_0x13c931){_0x5932d0['execOriginate'](_0x58172b,_0x5932d0[_0xd69a('0x10')][_0x58172b[_0xd69a('0x56')]])[_0xd69a('0x3c')](function(_0x19c519){ut['logger'](_0xd69a('0x57'),_0x19c519);_0x1a9bad(ut[_0xd69a('0x58')](_0xd69a('0x59')));})[_0xd69a('0x3e')](function(_0x48bafb){ut[_0xd69a('0x48')]('[Fax][execOriginate][failure]',_0x48bafb);updateStatus(_0x58172b);_0x13c931(ut[_0xd69a('0x58')](_0xd69a('0x5a')));});});};Fax['prototype']['checkAfterSend']=function(_0xbff593){var _0x2d8a6b=this;return new BPromise(function(_0x4c1724,_0x18e6b9){var _0x4fca73=_0x2d8a6b[_0xd69a('0x5b')](_0x2d8a6b[_0xd69a('0x10')][_0xbff593[_0xd69a('0x56')]][_0xd69a('0x5c')],_0xbff593);if(_0x4fca73['isValid']){_0x4c1724(ut[_0xd69a('0x58')](_0xd69a('0x5d')));}else{_0x18e6b9(ut[_0xd69a('0x58')](_0x4fca73[_0xd69a('0x58')]));}});};function originate(_0x5c3f24,_0x1ee65f,_0x3b531b){return new BPromise(function(_0x14ac3a,_0x3ffb75){if(_0x3b531b){var _0x4f7143=util[_0xd69a('0x5e')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0xd69a('0x3a')](_0x5c3f24[_0xd69a('0x3')])[_0xd69a('0x26')],_0x5c3f24[_0xd69a('0x3')]);gs[_0xd69a('0x5f')](_0x4f7143)[_0xd69a('0x3c')](function(){_0x5c3f24[_0xd69a('0x3')]=util[_0xd69a('0x5e')](_0xd69a('0x60'),path['parse'](_0x5c3f24['path'])['dir'],path[_0xd69a('0x3a')](_0x5c3f24[_0xd69a('0x3')])[_0xd69a('0x26')]);_0x1ee65f[_0xd69a('0x61')]=_0x5c3f24[_0xd69a('0x3')];ut[_0xd69a('0x48')](_0xd69a('0x62'),'');ami['Action'](ut[_0xd69a('0x63')](_0x5c3f24,_0x1ee65f))[_0xd69a('0x3c')](function(_0x1da126){_0x14ac3a(_0x1da126);})[_0xd69a('0x3e')](function(_0x356015){_0x3ffb75(_0x356015);});})[_0xd69a('0x3e')](function(_0xad9130){_0x3ffb75(_0xad9130);});}else{ami['Action'](ut[_0xd69a('0x63')](_0x5c3f24,_0x1ee65f))['then'](function(_0x2df01c){_0x14ac3a(_0x2df01c);})[_0xd69a('0x3e')](function(_0x315f42){_0x3ffb75(_0x315f42);});}});}Fax[_0xd69a('0x1f')][_0xd69a('0x64')]=function(_0xff101e,_0x9874a3){var _0x5bf508=this;return new BPromise(function(_0x3f34e0,_0x177f40){var _0x24b05a=uuid['v4']();var _0x248c4d=ut[_0xd69a('0x65')](_0xff101e,_0x9874a3);_0x5bf508[_0xd69a('0x12')][_0x24b05a]=new Action(_0x24b05a,_0x9874a3,_0xff101e);var _0xa09532=_0x5bf508['actions'][_0x24b05a];if(path[_0xd69a('0x3a')](_0xff101e[_0xd69a('0x3')])[_0xd69a('0x66')]===_0xd69a('0x3b')){originate(_0xa09532,_0x248c4d,!![])[_0xd69a('0x3c')](function(_0x2bb9a9){_0x3f34e0(_0x2bb9a9);})[_0xd69a('0x3e')](function(_0x3e6d24){_0x177f40(_0x3e6d24);});}else{originate(_0xa09532,_0x248c4d,![])['then'](function(_0x29b8d8){_0x3f34e0(_0x29b8d8);})[_0xd69a('0x3e')](function(_0x38d450){_0x177f40(_0x38d450);});}});};Fax[_0xd69a('0x1f')][_0xd69a('0x67')]=function(_0x5d2eea){return!_['isNil'](_0x5d2eea)&&!_['isNil'](_0x5d2eea[_0xd69a('0x26')])&&!_['isNil'](_0x5d2eea[_0xd69a('0x68')])&&_0x5d2eea[_0xd69a('0x68')]&&!_['isNil'](this[_0xd69a('0x11')][util[_0xd69a('0x5e')](_0xd69a('0x69'),_0x5d2eea[_0xd69a('0x26')])])&&!_[_0xd69a('0x6a')](this[_0xd69a('0x11')][util[_0xd69a('0x5e')](_0xd69a('0x69'),_0x5d2eea[_0xd69a('0x26')])][_0xd69a('0x2f')])&&(this[_0xd69a('0x11')][util[_0xd69a('0x5e')]('SIP/%s',_0x5d2eea['name'])]['status']===_0xd69a('0x6b')||this['trunks'][util['format'](_0xd69a('0x69'),_0x5d2eea[_0xd69a('0x26')])][_0xd69a('0x2f')]==='unmonitored');};Fax['prototype'][_0xd69a('0x5b')]=function(_0x23ac16,_0x11563e){if(!this[_0xd69a('0x67')](_0x23ac16)){ut[_0xd69a('0x48')](_0xd69a('0x6c'),_[_0xd69a('0x6a')](_0x23ac16)?'':_0x23ac16[_0xd69a('0x26')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_['isNil'](_0x11563e['fax'])){ut[_0xd69a('0x48')](_0xd69a('0x6d'),JSON[_0xd69a('0x50')](_0x11563e));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xd69a('0x6a')](_0x11563e[_0xd69a('0x3')])){ut['logger'](_0xd69a('0x6e'),JSON['stringify'](_0x11563e));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xd69a('0x6f')]=Fax; \ No newline at end of file +var _0xd0e8=['syncNewState','newexten','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','error','catch','\x20receiveFax\x20','stringify','merge','pick','response','AttachmentId','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','bind'];(function(_0x1102cb,_0x3d93f0){var _0x558128=function(_0x471eeb){while(--_0x471eeb){_0x1102cb['push'](_0x1102cb['shift']());}};_0x558128(++_0x3d93f0);}(_0xd0e8,0x64));var _0x8d0e=function(_0x2a09a9,_0x13d647){_0x2a09a9=_0x2a09a9-0x0;var _0x4dcee2=_0xd0e8[_0x2a09a9];return _0x4dcee2;};'use strict';var util=require(_0x8d0e('0x0'));var _=require(_0x8d0e('0x1'));var BPromise=require(_0x8d0e('0x2'));var uuid=require(_0x8d0e('0x3'));var moment=require(_0x8d0e('0x4'));var path=require(_0x8d0e('0x5'));var tiff2pdf=require(_0x8d0e('0x6'));var gs=require('./util/gs');var logger=require(_0x8d0e('0x7'))(_0x8d0e('0x8'));var ami=require(_0x8d0e('0x9'));var rpcDb=require(_0x8d0e('0xa'));var Channel=require('./channel');var ut=require(_0x8d0e('0xb'));var Action=require(_0x8d0e('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x8d0e('0xd'));var faxMessage=require(_0x8d0e('0xe'));function Fax(_0x54c29d){this[_0x8d0e('0xf')]={};this[_0x8d0e('0x10')]=_0x54c29d['faxAccounts'];this[_0x8d0e('0x11')]=_0x54c29d[_0x8d0e('0x11')];this[_0x8d0e('0x12')]={};ami['on'](_0x8d0e('0x13'),this[_0x8d0e('0x14')]['bind'](this));ami['on'](_0x8d0e('0x15'),this['syncVarSet'][_0x8d0e('0x16')](this));ami['on']('newstate',this[_0x8d0e('0x17')][_0x8d0e('0x16')](this));ami['on'](_0x8d0e('0x18'),this[_0x8d0e('0x19')][_0x8d0e('0x16')](this));ami['on'](_0x8d0e('0x1a'),this['syncFaxStatus'][_0x8d0e('0x16')](this));ami['on'](_0x8d0e('0x1b'),this[_0x8d0e('0x1c')][_0x8d0e('0x16')](this));ami['on'](_0x8d0e('0x1d'),this[_0x8d0e('0x1e')][_0x8d0e('0x16')](this));ami['on'](_0x8d0e('0x1f'),this[_0x8d0e('0x20')][_0x8d0e('0x16')](this));}Fax[_0x8d0e('0x21')][_0x8d0e('0x14')]=function(_0x2e1a8f){if(_0x2e1a8f[_0x8d0e('0x22')]===_0x8d0e('0x23')){for(var _0x2ecf73 in this['faxAccounts']){if(this[_0x8d0e('0x10')][_0x8d0e('0x24')](_0x2ecf73)){if(_0x2e1a8f[_0x8d0e('0x25')]===this['faxAccounts'][_0x2ecf73][_0x8d0e('0x26')]){this['channels'][_0x2e1a8f['uniqueid']]={};this['channels'][_0x2e1a8f['uniqueid']]['channel']=_0x2e1a8f['channel'];this[_0x8d0e('0xf')][_0x2e1a8f[_0x8d0e('0x27')]]['id']=this['faxAccounts'][_0x2ecf73]['id'];this[_0x8d0e('0xf')][_0x2e1a8f[_0x8d0e('0x27')]][_0x8d0e('0x28')]=this[_0x8d0e('0x10')][_0x2ecf73]['name'];logger[_0x8d0e('0x29')](_0x2e1a8f[_0x8d0e('0x27')],_0x8d0e('0x2a'));}}}}if(this['actions'][_0x2e1a8f[_0x8d0e('0x27')]]){this[_0x8d0e('0xf')][_0x2e1a8f[_0x8d0e('0x27')]]={};this['channels'][_0x2e1a8f[_0x8d0e('0x27')]]['channel']=_0x2e1a8f['channel'];logger['info'](_0x2e1a8f[_0x8d0e('0x27')],_0x8d0e('0x2a'));}};Fax[_0x8d0e('0x21')]['syncVarSet']=function(_0xa1141d){if(this[_0x8d0e('0xf')][_0xa1141d[_0x8d0e('0x27')]]){for(var _0x544bd3 in _0xa1141d[_0x8d0e('0x2b')]){if(_0xa1141d[_0x8d0e('0x2b')]['hasOwnProperty'](_0x544bd3)){this[_0x8d0e('0xf')][_0xa1141d[_0x8d0e('0x27')]][_0x544bd3]=_0xa1141d[_0x8d0e('0x2c')];}}}};Fax[_0x8d0e('0x21')][_0x8d0e('0x17')]=function(_0x36fe42){if(this[_0x8d0e('0xf')][_0x36fe42[_0x8d0e('0x27')]]){this[_0x8d0e('0xf')][_0x36fe42[_0x8d0e('0x27')]][_0x8d0e('0x2d')]=_0x36fe42[_0x8d0e('0x2d')];this[_0x8d0e('0xf')][_0x36fe42['uniqueid']][_0x8d0e('0x2e')]=_0x36fe42[_0x8d0e('0x2e')];}};Fax[_0x8d0e('0x21')][_0x8d0e('0x19')]=function(_0x5c69ff){if(this[_0x8d0e('0xf')][_0x5c69ff[_0x8d0e('0x27')]]){for(var _0x3955f9 in _0x5c69ff[_0x8d0e('0x2b')]){if(_0x5c69ff[_0x8d0e('0x2b')][_0x8d0e('0x24')](_0x3955f9)){this[_0x8d0e('0xf')][_0x5c69ff[_0x8d0e('0x27')]][_0x3955f9]=_0x5c69ff[_0x8d0e('0x2c')];}}}};Fax[_0x8d0e('0x21')][_0x8d0e('0x2f')]=function(_0x3c1461){if(this['channels'][_0x3c1461[_0x8d0e('0x27')]]){this[_0x8d0e('0xf')][_0x3c1461[_0x8d0e('0x27')]][_0x8d0e('0x30')]=_0x3c1461[_0x8d0e('0x30')];this[_0x8d0e('0xf')][_0x3c1461[_0x8d0e('0x27')]]['status']=_0x3c1461[_0x8d0e('0x31')];this['channels'][_0x3c1461[_0x8d0e('0x27')]][_0x8d0e('0x26')]=_0x3c1461[_0x8d0e('0x26')];this[_0x8d0e('0xf')][_0x3c1461[_0x8d0e('0x27')]][_0x8d0e('0x32')]=_0x3c1461[_0x8d0e('0x32')];logger['info'](_0x3c1461[_0x8d0e('0x27')],_0x8d0e('0x33'));}};Fax[_0x8d0e('0x21')][_0x8d0e('0x1c')]=function(_0x56cf10){var _0x1763ab=this;if(this[_0x8d0e('0xf')][_0x56cf10[_0x8d0e('0x27')]]){var _0x35b7be=this[_0x8d0e('0xf')][_0x56cf10[_0x8d0e('0x27')]]['id'];this[_0x8d0e('0xf')][_0x56cf10[_0x8d0e('0x27')]][_0x8d0e('0x34')]=_0x56cf10[_0x8d0e('0x34')];this[_0x8d0e('0xf')][_0x56cf10['uniqueid']][_0x8d0e('0x35')]=_0x56cf10[_0x8d0e('0x35')];this[_0x8d0e('0xf')][_0x56cf10['uniqueid']][_0x8d0e('0x26')]=_0x56cf10[_0x8d0e('0x26')];this[_0x8d0e('0xf')][_0x56cf10['uniqueid']]['resolution']=_0x56cf10['resolution'];this[_0x8d0e('0xf')][_0x56cf10[_0x8d0e('0x27')]]['transferrate']=_0x56cf10[_0x8d0e('0x36')];this[_0x8d0e('0xf')][_0x56cf10['uniqueid']][_0x8d0e('0x32')]=_0x56cf10[_0x8d0e('0x32')];this['channels'][_0x56cf10['uniqueid']][_0x8d0e('0x37')]=_0x56cf10[_0x8d0e('0x37')];if(this[_0x8d0e('0xf')][_0x56cf10[_0x8d0e('0x27')]]['pagestransferred']>0x0){tiff2pdf(_0x56cf10['filename'],_0x8d0e('0x38'),function(_0x3f4ee4){logger[_0x8d0e('0x29')](_0x56cf10[_0x8d0e('0x27')],'\x20result\x20conversion\x20file\x20',_0x3f4ee4[_0x8d0e('0x39')]);attachment[_0x8d0e('0x3a')]({'name':path[_0x8d0e('0x3b')](_0x56cf10[_0x8d0e('0x32')])[_0x8d0e('0x28')],'basename':path[_0x8d0e('0x3b')](_0x56cf10[_0x8d0e('0x32')])[_0x8d0e('0x28')]+_0x8d0e('0x3c'),'type':_0x8d0e('0x3d')})[_0x8d0e('0x3e')](function(_0x15fba6){faxAccount[_0x8d0e('0x3f')](_0x35b7be,{'from':_0x56cf10['calleridnum'],'mapKey':_0x8d0e('0x8'),'body':path[_0x8d0e('0x3b')](_0x56cf10[_0x8d0e('0x32')])['name']+_0x8d0e('0x3c'),'AttachmentId':_0x15fba6['id']})['catch'](function(_0x4b9f4a){logger[_0x8d0e('0x40')](_0x56cf10['uniqueid'],'\x20notify\x20',JSON['stringify'](_0x4b9f4a));});})[_0x8d0e('0x41')](function(_0x48235e){logger[_0x8d0e('0x40')](_0x56cf10[_0x8d0e('0x27')],_0x8d0e('0x42'),JSON[_0x8d0e('0x43')](_0x48235e));});});}logger[_0x8d0e('0x29')](_0x56cf10['uniqueid'],_0x8d0e('0x42'));}};Fax[_0x8d0e('0x21')]['syncOriginateResponse']=function(_0x36f6be){if(this['actions'][_0x36f6be['uniqueid']]){_[_0x8d0e('0x44')](this[_0x8d0e('0xf')][_0x36f6be[_0x8d0e('0x27')]],_[_0x8d0e('0x45')](_0x36f6be,[_0x8d0e('0x46'),'reason']));}};function updateStatus(_0x1fa774){if(_0x1fa774['AttachmentId']){faxMessage['update'](_0x1fa774[_0x8d0e('0x47')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x8d0e('0x3e')](function(_0xf540cb){ut[_0x8d0e('0x48')]('[Fax][Message][Error][Updated]',_0xf540cb);})[_0x8d0e('0x41')](function(_0x4f8fa3){ut[_0x8d0e('0x48')](_0x8d0e('0x49'),_0x4f8fa3);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x8d0e('0x21')][_0x8d0e('0x4a')]=function(_0x56b63d,_0x50771f,_0x469197){var _0x279ca9=this;var _0x1001fd={};if(_0x50771f){_0x1001fd={'read':_0x50771f};}else{_0x1001fd={'failMessage':_0x469197};}if(this['actions'][_0x56b63d][_0x8d0e('0x47')]){faxMessage[_0x8d0e('0x4b')](this[_0x8d0e('0x12')][_0x56b63d][_0x8d0e('0x47')],_0x1001fd)[_0x8d0e('0x3e')](function(_0x19a708){ut[_0x8d0e('0x48')](_0x8d0e('0x4c'),_0x19a708);})[_0x8d0e('0x41')](function(_0x18a787){ut['logger'](_0x8d0e('0x4d'),_0x18a787);})[_0x8d0e('0x4e')](function(){delete _0x279ca9[_0x8d0e('0xf')][_0x56b63d];delete _0x279ca9[_0x8d0e('0x12')][_0x56b63d];});}else{ut['logger'](_0x8d0e('0x4f'));delete this[_0x8d0e('0xf')][_0x56b63d];delete this[_0x8d0e('0x12')][_0x56b63d];}};Fax[_0x8d0e('0x21')][_0x8d0e('0x1e')]=function(_0x4f81ca){var _0x3dfebe=this;if(this['channels'][_0x4f81ca[_0x8d0e('0x27')]]){if(this[_0x8d0e('0x12')][_0x4f81ca[_0x8d0e('0x27')]]){this['channels'][_0x4f81ca[_0x8d0e('0x27')]]['id']=this[_0x8d0e('0x12')][_0x4f81ca[_0x8d0e('0x27')]]['id'];this[_0x8d0e('0xf')][_0x4f81ca[_0x8d0e('0x27')]][_0x8d0e('0x28')]=this['actions'][_0x4f81ca['uniqueid']][_0x8d0e('0x28')];}logger['info'](_0x4f81ca[_0x8d0e('0x27')],this[_0x8d0e('0x12')][_0x4f81ca['uniqueid']]?_0x8d0e('0x50'):_0x8d0e('0x51'),JSON[_0x8d0e('0x43')](this[_0x8d0e('0xf')][_0x4f81ca[_0x8d0e('0x27')]]));if(this[_0x8d0e('0x12')][_0x4f81ca[_0x8d0e('0x27')]]){if(this[_0x8d0e('0xf')][_0x4f81ca[_0x8d0e('0x27')]][_0x8d0e('0x52')]>0x0&&this[_0x8d0e('0xf')][_0x4f81ca[_0x8d0e('0x27')]][_0x8d0e('0x1a')]===_0x8d0e('0x53')){this[_0x8d0e('0x4a')](_0x4f81ca[_0x8d0e('0x27')],!![]);}else{this['updateStatus'](_0x4f81ca[_0x8d0e('0x27')],![],this[_0x8d0e('0xf')][_0x4f81ca[_0x8d0e('0x27')]][_0x8d0e('0x54')]?_0x8d0e('0x55')+this[_0x8d0e('0xf')][_0x4f81ca['uniqueid']][_0x8d0e('0x54')]:_0x8d0e('0x56'));}}}};Fax[_0x8d0e('0x21')]['send']=function(_0x2687d7){var _0x4447d1=this;return new BPromise(function(_0x2cccd6,_0x37ec58){_0x4447d1[_0x8d0e('0x57')](_0x2687d7,_0x4447d1[_0x8d0e('0x10')][_0x2687d7['FaxAccountId']])[_0x8d0e('0x3e')](function(_0x544c62){ut['logger'](_0x8d0e('0x58'),_0x544c62);_0x2cccd6(ut[_0x8d0e('0x39')](_0x8d0e('0x59')));})[_0x8d0e('0x41')](function(_0x31ce04){ut[_0x8d0e('0x48')](_0x8d0e('0x5a'),_0x31ce04);updateStatus(_0x2687d7);_0x37ec58(ut['message'](_0x8d0e('0x5b')));});});};Fax[_0x8d0e('0x21')][_0x8d0e('0x5c')]=function(_0x3bf40b){var _0x520f4c=this;return new BPromise(function(_0xd348bf,_0x93f595){var _0x2f2699=_0x520f4c[_0x8d0e('0x5d')](_0x520f4c[_0x8d0e('0x10')][_0x3bf40b[_0x8d0e('0x5e')]][_0x8d0e('0x5f')],_0x3bf40b);if(_0x2f2699[_0x8d0e('0x60')]){_0xd348bf(ut[_0x8d0e('0x39')](_0x8d0e('0x61')));}else{_0x93f595(ut[_0x8d0e('0x39')](_0x2f2699[_0x8d0e('0x39')]));}});};function originate(_0x39e08e,_0x4d270c,_0x1bc6be){return new BPromise(function(_0x30bfda,_0x29ba34){if(_0x1bc6be){var _0x24baa1=util[_0x8d0e('0x62')](_0x8d0e('0x63'),path['parse'](_0x39e08e[_0x8d0e('0x5')])[_0x8d0e('0x28')],_0x39e08e[_0x8d0e('0x5')]);gs[_0x8d0e('0x64')](_0x24baa1)['then'](function(){_0x39e08e[_0x8d0e('0x5')]=util[_0x8d0e('0x62')](_0x8d0e('0x65'),path[_0x8d0e('0x3b')](_0x39e08e[_0x8d0e('0x5')])[_0x8d0e('0x66')],path[_0x8d0e('0x3b')](_0x39e08e[_0x8d0e('0x5')])[_0x8d0e('0x28')]);_0x4d270c[_0x8d0e('0x67')]=_0x39e08e['path'];ut[_0x8d0e('0x48')](_0x8d0e('0x68'),'');ami[_0x8d0e('0x69')](ut[_0x8d0e('0x6a')](_0x39e08e,_0x4d270c))[_0x8d0e('0x3e')](function(_0x103a77){_0x30bfda(_0x103a77);})[_0x8d0e('0x41')](function(_0x277227){_0x29ba34(_0x277227);});})['catch'](function(_0x187ef5){_0x29ba34(_0x187ef5);});}else{ami['Action'](ut[_0x8d0e('0x6a')](_0x39e08e,_0x4d270c))[_0x8d0e('0x3e')](function(_0x12ecba){_0x30bfda(_0x12ecba);})[_0x8d0e('0x41')](function(_0x12fdf0){_0x29ba34(_0x12fdf0);});}});}Fax[_0x8d0e('0x21')]['execOriginate']=function(_0x165bc6,_0x4ce0b4){var _0xdb5ea1=this;return new BPromise(function(_0x1260fe,_0x1e8d3b){var _0x5cd4dc=uuid['v4']();var _0x11d669=ut[_0x8d0e('0x6b')](_0x165bc6,_0x4ce0b4);_0xdb5ea1[_0x8d0e('0x12')][_0x5cd4dc]=new Action(_0x5cd4dc,_0x4ce0b4,_0x165bc6);var _0x5959bd=_0xdb5ea1['actions'][_0x5cd4dc];if(path['parse'](_0x165bc6['path'])[_0x8d0e('0x6c')]===_0x8d0e('0x3c')){originate(_0x5959bd,_0x11d669,!![])[_0x8d0e('0x3e')](function(_0x6bb2a5){_0x1260fe(_0x6bb2a5);})[_0x8d0e('0x41')](function(_0x2fcea6){_0x1e8d3b(_0x2fcea6);});}else{originate(_0x5959bd,_0x11d669,![])[_0x8d0e('0x3e')](function(_0x5de828){_0x1260fe(_0x5de828);})['catch'](function(_0x53ec00){_0x1e8d3b(_0x53ec00);});}});};Fax[_0x8d0e('0x21')][_0x8d0e('0x6d')]=function(_0x1b8fb7){return!_[_0x8d0e('0x6e')](_0x1b8fb7)&&!_[_0x8d0e('0x6e')](_0x1b8fb7[_0x8d0e('0x28')])&&!_['isNil'](_0x1b8fb7[_0x8d0e('0x6f')])&&_0x1b8fb7[_0x8d0e('0x6f')]&&!_['isNil'](this[_0x8d0e('0x11')][util[_0x8d0e('0x62')](_0x8d0e('0x70'),_0x1b8fb7[_0x8d0e('0x28')])])&&!_[_0x8d0e('0x6e')](this['trunks'][util[_0x8d0e('0x62')](_0x8d0e('0x70'),_0x1b8fb7[_0x8d0e('0x28')])][_0x8d0e('0x31')])&&(this[_0x8d0e('0x11')][util[_0x8d0e('0x62')](_0x8d0e('0x70'),_0x1b8fb7[_0x8d0e('0x28')])][_0x8d0e('0x31')]===_0x8d0e('0x71')||this[_0x8d0e('0x11')][util[_0x8d0e('0x62')](_0x8d0e('0x70'),_0x1b8fb7['name'])][_0x8d0e('0x31')]===_0x8d0e('0x72'));};Fax[_0x8d0e('0x21')]['checkTrunk']=function(_0x2be5a6,_0x5d349d){if(!this[_0x8d0e('0x6d')](_0x2be5a6)){ut[_0x8d0e('0x48')](_0x8d0e('0x73'),_[_0x8d0e('0x6e')](_0x2be5a6)?'':_0x2be5a6[_0x8d0e('0x28')]+_0x8d0e('0x74'));return{'isValid':![],'message':_0x8d0e('0x75')};}if(_[_0x8d0e('0x6e')](_0x5d349d[_0x8d0e('0x8')])){ut['logger'](_0x8d0e('0x76'),JSON[_0x8d0e('0x43')](_0x5d349d));return{'isValid':![],'message':_0x8d0e('0x77')};}if(_['isNil'](_0x5d349d[_0x8d0e('0x5')])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON[_0x8d0e('0x43')](_0x5d349d));return{'isValid':![],'message':_0x8d0e('0x78')};}return{'isValid':!![],'message':_0x8d0e('0x79')};};module[_0x8d0e('0x7a')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 97189db..738ba13 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 _0x507f=['error','resolve','notify','[Notify]\x20','util','preview','lodash','../rpc/faxAccount'];(function(_0x2956b4,_0x4103ee){var _0x3ab868=function(_0x4df643){while(--_0x4df643){_0x2956b4['push'](_0x2956b4['shift']());}};_0x3ab868(++_0x4103ee);}(_0x507f,0xd4));var _0xf507=function(_0x3277ca,_0x383b79){_0x3277ca=_0x3277ca-0x0;var _0x47deb4=_0x507f[_0x3277ca];return _0x47deb4;};'use strict';var util=require(_0xf507('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0xf507('0x1'));var _=require(_0xf507('0x2'));var faxAccount=require(_0xf507('0x3'));function loggerCatch(_0x1e3cc6){return function(_0xa03b71){logger[_0xf507('0x4')](_0x1e3cc6,util['inspect'](_0xa03b71,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x17c3d0,_0x3db070){return BPromise[_0xf507('0x5')]()['then'](faxAccount[_0xf507('0x6')](_0x17c3d0,_0x3db070))['catch'](loggerCatch(_0xf507('0x7')));}; \ No newline at end of file +var _0x72b4=['then','catch','[Notify]\x20','util','bluebird','../../../config/logger','lodash','../rpc/faxAccount','error','notify','resolve'];(function(_0x14ea97,_0x42fbce){var _0x2d81bd=function(_0x53f96c){while(--_0x53f96c){_0x14ea97['push'](_0x14ea97['shift']());}};_0x2d81bd(++_0x42fbce);}(_0x72b4,0x1b0));var _0x472b=function(_0xdb01a,_0x54a83a){_0xdb01a=_0xdb01a-0x0;var _0x107ede=_0x72b4[_0xdb01a];return _0x107ede;};'use strict';var util=require(_0x472b('0x0'));var BPromise=require(_0x472b('0x1'));var logger=require(_0x472b('0x2'))('preview');var _=require(_0x472b('0x3'));var faxAccount=require(_0x472b('0x4'));function loggerCatch(_0x233285){return function(_0x1871df){logger[_0x472b('0x5')](_0x233285,util['inspect'](_0x1871df,{'showHidden':![],'depth':null}));};}exports[_0x472b('0x6')]=function(_0xfcc031,_0x4e2404){return BPromise[_0x472b('0x7')]()[_0x472b('0x8')](faxAccount[_0x472b('0x6')](_0xfcc031,_0x4e2404))[_0x472b('0x9')](loggerCatch(_0x472b('0xa')));}; \ 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 eb2a100..80b1b64 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 _0x9daf=['child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird'];(function(_0x4d7707,_0x9784ca){var _0x5d3421=function(_0x57dd26){while(--_0x57dd26){_0x4d7707['push'](_0x4d7707['shift']());}};_0x5d3421(++_0x9784ca);}(_0x9daf,0x80));var _0xf9da=function(_0x5dfe9b,_0x318b85){_0x5dfe9b=_0x5dfe9b-0x0;var _0x3bb0f4=_0x9daf[_0x5dfe9b];return _0x3bb0f4;};'use strict';var util=require(_0xf9da('0x0'));var logger=require(_0xf9da('0x1'))(_0xf9da('0x2'));var BPromise=require(_0xf9da('0x3'));var exec=require(_0xf9da('0x4'))[_0xf9da('0x5')];exports[_0xf9da('0x6')]=function(_0x564ef7){return new BPromise(function(_0x3029eb,_0x41adf8){exec(_0x564ef7,function(_0x97b98f,_0x23c659,_0x4bd457){logger[_0xf9da('0x7')]('Exec\x20gs',_0x23c659);if(_0x97b98f){logger['info'](_0xf9da('0x8'),_0xf9da('0x9'),util[_0xf9da('0xa')](_0x97b98f,{'showHidden':![],'depth':null}),_0x23c659,_0x4bd457);_0x41adf8(_0x97b98f);}_0x3029eb(_0x23c659);});});}; \ No newline at end of file +var _0x42f8=['Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','exec','execute'];(function(_0x214142,_0x2345a4){var _0x1bb644=function(_0x6819aa){while(--_0x6819aa){_0x214142['push'](_0x214142['shift']());}};_0x1bb644(++_0x2345a4);}(_0x42f8,0x1d8));var _0x842f=function(_0x22043e,_0x60a3d0){_0x22043e=_0x22043e-0x0;var _0x35ff34=_0x42f8[_0x22043e];return _0x35ff34;};'use strict';var util=require(_0x842f('0x0'));var logger=require(_0x842f('0x1'))('fax');var BPromise=require('bluebird');var exec=require('child_process')[_0x842f('0x2')];exports[_0x842f('0x3')]=function(_0x451308){return new BPromise(function(_0x5aa806,_0x28e2fe){exec(_0x451308,function(_0x379f0b,_0x23e959,_0x246dd0){logger['info'](_0x842f('0x4'),_0x23e959);if(_0x379f0b){logger['info'](_0x842f('0x4'),_0x842f('0x5'),util[_0x842f('0x6')](_0x379f0b,{'showHidden':![],'depth':null}),_0x23e959,_0x246dd0);_0x28e2fe(_0x379f0b);}_0x5aa806(_0x23e959);});});}; \ 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 3f15b64..c3c34c9 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 _0xf4eb=['faxdetect','t38timeout','variablesAction','uniqueid','channel','\x22%s\x22\x20<%s>','headerinfo','localstationid','util','message','info','inspect','addVariables','ecm','maxrate','format','\x22%s\x22','modem','gateway'];(function(_0x8787c,_0x9d9122){var _0x3e01be=function(_0x525d63){while(--_0x525d63){_0x8787c['push'](_0x8787c['shift']());}};_0x3e01be(++_0x9d9122);}(_0xf4eb,0xec));var _0xbf4e=function(_0x447e5f,_0x573a8c){_0x447e5f=_0x447e5f-0x0;var _0x34d1eb=_0xf4eb[_0x447e5f];return _0x34d1eb;};'use strict';var util=require(_0xbf4e('0x0'));var _=require('lodash');var moment=require('moment');var logger=require('../../../../config/logger')('fax');exports[_0xbf4e('0x1')]=function(_0x49d80e){return{'message':_0x49d80e};};exports['logger']=function(_0x2e3070,_0x1c7606){logger[_0xbf4e('0x2')](_0x2e3070,util[_0xbf4e('0x3')](_0x1c7606,{'showHidden':![],'depth':null}));};exports[_0xbf4e('0x4')]=function(_0x2fcfed,_0x15b99f){var _0x540736={'XMF-ECM':_0x15b99f[_0xbf4e('0x5')],'XMF-HEADERINFO':_0x15b99f['headerinfo'],'XMF-MINRATE':_0x15b99f['minrate'],'XMF-MAXRATE':_0x15b99f[_0xbf4e('0x6')],'XMF-MODEM':util[_0xbf4e('0x7')](_0xbf4e('0x8'),_0x15b99f[_0xbf4e('0x9')]),'XMF-GATEWAY':_0x15b99f[_0xbf4e('0xa')],'XMF-FAXDETECT':_0x15b99f[_0xbf4e('0xb')],'XMF-T38TIMEOUT':_0x15b99f[_0xbf4e('0xc')],'XMF-LOCALSTATIONID':_0x15b99f['localstationid'],'XMF-PATH':_0x2fcfed['path']};return _0x540736;};exports[_0xbf4e('0xd')]=function(_0x5a8397,_0x448788){return{'actionid':_0x5a8397[_0xbf4e('0xe')],'action':'originate','channel':_0x5a8397[_0xbf4e('0xf')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0xbf4e('0x7')](_0xbf4e('0x10'),_0x5a8397[_0xbf4e('0x11')]?_0x5a8397[_0xbf4e('0x11')]:'',_0x5a8397[_0xbf4e('0x12')]),'variable':_0x448788,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5a8397[_0xbf4e('0xe')]};}; \ No newline at end of file +var _0x4ea3=['modem','gateway','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','../../../../config/logger','message','logger','info','inspect','addVariables','ecm','minrate','maxrate','format'];(function(_0x41a763,_0x27442d){var _0x40e9a1=function(_0x27a1af){while(--_0x27a1af){_0x41a763['push'](_0x41a763['shift']());}};_0x40e9a1(++_0x27442d);}(_0x4ea3,0x70));var _0x34ea=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4ea3[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0x34ea('0x0'));var _=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var logger=require(_0x34ea('0x3'))('fax');exports[_0x34ea('0x4')]=function(_0x494b56){return{'message':_0x494b56};};exports[_0x34ea('0x5')]=function(_0x571f1b,_0x5e5a84){logger[_0x34ea('0x6')](_0x571f1b,util[_0x34ea('0x7')](_0x5e5a84,{'showHidden':![],'depth':null}));};exports[_0x34ea('0x8')]=function(_0x123d48,_0x40434e){var _0x18b461={'XMF-ECM':_0x40434e[_0x34ea('0x9')],'XMF-HEADERINFO':_0x40434e['headerinfo'],'XMF-MINRATE':_0x40434e[_0x34ea('0xa')],'XMF-MAXRATE':_0x40434e[_0x34ea('0xb')],'XMF-MODEM':util[_0x34ea('0xc')]('\x22%s\x22',_0x40434e[_0x34ea('0xd')]),'XMF-GATEWAY':_0x40434e[_0x34ea('0xe')],'XMF-FAXDETECT':_0x40434e['faxdetect'],'XMF-T38TIMEOUT':_0x40434e['t38timeout'],'XMF-LOCALSTATIONID':_0x40434e[_0x34ea('0xf')],'XMF-PATH':_0x123d48[_0x34ea('0x10')]};return _0x18b461;};exports[_0x34ea('0x11')]=function(_0x58bb0d,_0x11229e){return{'actionid':_0x58bb0d[_0x34ea('0x12')],'action':_0x34ea('0x13'),'channel':_0x58bb0d[_0x34ea('0x14')],'Exten':_0x34ea('0x15'),'Context':_0x34ea('0x16'),'Priority':'1','callerid':util[_0x34ea('0xc')](_0x34ea('0x17'),_0x58bb0d[_0x34ea('0x18')]?_0x58bb0d[_0x34ea('0x18')]:'',_0x58bb0d[_0x34ea('0xf')]),'variable':_0x11229e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x58bb0d['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 13ae2be..d7c8e4e 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 _0x97f1=['initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','catch','log','bluebird','util','./server','./realtime','./report','./acw','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/dynamics365','get','hour','resolve','getAgents','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x97f1,0x1ca));var _0x197f=function(_0x365db9,_0x107363){_0x365db9=_0x365db9-0x0;var _0x27adc4=_0x97f1[_0x365db9];return _0x27adc4;};'use strict';var BPromise=require(_0x197f('0x0'));var util=require(_0x197f('0x1'));var moment=require('moment');var server=require(_0x197f('0x2'));var Realtime=require(_0x197f('0x3'));var Report=require(_0x197f('0x4'));var Acw=require(_0x197f('0x5'));var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require(_0x197f('0x6'));var user=require('./rpc/user');var voiceQueue=require(_0x197f('0x7'));var voiceQueueReport=require(_0x197f('0x8'));var voiceCallReport=require(_0x197f('0x9'));var trunk=require(_0x197f('0xa'));var trigger=require(_0x197f('0xb'));var template=require(_0x197f('0xc'));var cmHopperHistory=require(_0x197f('0xd'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x197f('0xe'));var faxAccount=require(_0x197f('0xf'));var zendesk=require(_0x197f('0x10'));var salesforce=require(_0x197f('0x11'));var sugarcrm=require(_0x197f('0x12'));var freshdesk=require(_0x197f('0x13'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x197f('0x14'));var vtiger=require(_0x197f('0x15'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x197f('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x197f('0x17')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x197f('0x17')](_0x197f('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x197f('0x19')]()['then'](user[_0x197f('0x1a')]())[_0x197f('0x1b')](realtime[_0x197f('0x1c')]())[_0x197f('0x1b')](user[_0x197f('0x1d')]())[_0x197f('0x1b')](realtime[_0x197f('0x1e')]())[_0x197f('0x1b')](trunk[_0x197f('0x1f')]())[_0x197f('0x1b')](realtime[_0x197f('0x20')]())[_0x197f('0x1b')](voiceQueue['getVoiceQueues']())[_0x197f('0x1b')](realtime['initVoiceQueues']())[_0x197f('0x1b')](trigger[_0x197f('0x21')]())[_0x197f('0x1b')](realtime[_0x197f('0x22')]())[_0x197f('0x1b')](template[_0x197f('0x23')]())[_0x197f('0x1b')](realtime[_0x197f('0x24')]())['then'](zendesk['getZendeskAccounts']())[_0x197f('0x1b')](realtime[_0x197f('0x25')]())[_0x197f('0x1b')](salesforce[_0x197f('0x26')]())[_0x197f('0x1b')](realtime['initSalesforceAccounts']())[_0x197f('0x1b')](sugarcrm[_0x197f('0x27')]())[_0x197f('0x1b')](realtime[_0x197f('0x28')]())[_0x197f('0x1b')](freshdesk['getFreshdeskAccounts']())[_0x197f('0x1b')](realtime[_0x197f('0x29')]())['then'](desk[_0x197f('0x2a')]())[_0x197f('0x1b')](realtime[_0x197f('0x2b')]())[_0x197f('0x1b')](zoho[_0x197f('0x2c')]())[_0x197f('0x1b')](realtime[_0x197f('0x2d')]())[_0x197f('0x1b')](vtiger['getVtigerAccounts']())[_0x197f('0x1b')](realtime['initVtigerAccounts']())[_0x197f('0x1b')](freshsales['getFreshsalesAccounts']())[_0x197f('0x1b')](realtime[_0x197f('0x2e')]())[_0x197f('0x1b')](servicenow[_0x197f('0x2f')]())[_0x197f('0x1b')](realtime[_0x197f('0x30')]())[_0x197f('0x1b')](dynamics365[_0x197f('0x31')]())[_0x197f('0x1b')](realtime[_0x197f('0x32')]())['then'](campaign[_0x197f('0x33')]())[_0x197f('0x1b')](realtime[_0x197f('0x34')]())[_0x197f('0x1b')](voiceExtension[_0x197f('0x35')]())[_0x197f('0x1b')](realtime[_0x197f('0x36')]())[_0x197f('0x1b')](faxAccount['getFaxAccounts']())['then'](realtime[_0x197f('0x37')]())[_0x197f('0x1b')](function(){return realtime;});}function initParams(){return BPromise[_0x197f('0x19')]()[_0x197f('0x1b')](voiceQueueReport[_0x197f('0x38')]())[_0x197f('0x1b')](realtime[_0x197f('0x39')]())[_0x197f('0x1b')](cmHopperHistory[_0x197f('0x3a')]())[_0x197f('0x1b')](realtime[_0x197f('0x3b')]())[_0x197f('0x1b')](cmHopperHistory[_0x197f('0x3c')]())[_0x197f('0x1b')](realtime[_0x197f('0x3d')]())[_0x197f('0x1b')](voiceCallReport['getVoiceCallReports']())['then'](realtime['initVoiceCallReports']())[_0x197f('0x1b')](function(_0x3b4e07){})[_0x197f('0x3e')](function(_0x262704){console[_0x197f('0x3f')](_0x262704);});}function main(){return server['listen'](realtime,preview,fax)[_0x197f('0x1b')](function(_0x23daee){return initRealtime();})[_0x197f('0x1b')](function(){return initParams();})[_0x197f('0x1b')](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x1d51d8){console[_0x197f('0x3f')](_0x1d51d8);});}main(); \ No newline at end of file +var _0x6b7a=['./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','hour','resolve','then','getAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','log','listen','sync','bluebird','util','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/integrations/zendesk','./rpc/integrations/salesforce'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b7a,0x180));var _0xa6b7=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0x6b7a[_0x4c3ffe];return _0x28d3eb;};'use strict';var BPromise=require(_0xa6b7('0x0'));var util=require(_0xa6b7('0x1'));var moment=require(_0xa6b7('0x2'));var server=require(_0xa6b7('0x3'));var Realtime=require(_0xa6b7('0x4'));var Report=require(_0xa6b7('0x5'));var Acw=require('./acw');var Trigger=require(_0xa6b7('0x6'));var Dialer=require(_0xa6b7('0x7'));var Preview=require(_0xa6b7('0x8'));var Fax=require('./fax');var user=require(_0xa6b7('0x9'));var voiceQueue=require(_0xa6b7('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xa6b7('0xb'));var trunk=require('./rpc/trunk');var trigger=require(_0xa6b7('0xc'));var template=require(_0xa6b7('0xd'));var cmHopperHistory=require(_0xa6b7('0xe'));var campaign=require(_0xa6b7('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xa6b7('0x10'));var salesforce=require(_0xa6b7('0x11'));var sugarcrm=require(_0xa6b7('0x12'));var freshdesk=require(_0xa6b7('0x13'));var desk=require(_0xa6b7('0x14'));var zoho=require(_0xa6b7('0x15'));var vtiger=require(_0xa6b7('0x16'));var freshsales=require(_0xa6b7('0x17'));var servicenow=require(_0xa6b7('0x18'));var dynamics365=require(_0xa6b7('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xa6b7('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xa6b7('0x1b')]()[_0xa6b7('0x1c')](user[_0xa6b7('0x1d')]())['then'](realtime['initAgents']())[_0xa6b7('0x1c')](user[_0xa6b7('0x1e')]())[_0xa6b7('0x1c')](realtime['initTelephones']())[_0xa6b7('0x1c')](trunk[_0xa6b7('0x1f')]())[_0xa6b7('0x1c')](realtime[_0xa6b7('0x20')]())[_0xa6b7('0x1c')](voiceQueue[_0xa6b7('0x21')]())[_0xa6b7('0x1c')](realtime[_0xa6b7('0x22')]())['then'](trigger['getTriggers']())['then'](realtime[_0xa6b7('0x23')]())[_0xa6b7('0x1c')](template[_0xa6b7('0x24')]())[_0xa6b7('0x1c')](realtime[_0xa6b7('0x25')]())[_0xa6b7('0x1c')](zendesk[_0xa6b7('0x26')]())[_0xa6b7('0x1c')](realtime[_0xa6b7('0x27')]())['then'](salesforce[_0xa6b7('0x28')]())[_0xa6b7('0x1c')](realtime['initSalesforceAccounts']())[_0xa6b7('0x1c')](sugarcrm['getSugarcrmAccounts']())[_0xa6b7('0x1c')](realtime[_0xa6b7('0x29')]())[_0xa6b7('0x1c')](freshdesk[_0xa6b7('0x2a')]())[_0xa6b7('0x1c')](realtime[_0xa6b7('0x2b')]())[_0xa6b7('0x1c')](desk[_0xa6b7('0x2c')]())[_0xa6b7('0x1c')](realtime['initDeskAccounts']())['then'](zoho[_0xa6b7('0x2d')]())[_0xa6b7('0x1c')](realtime[_0xa6b7('0x2e')]())[_0xa6b7('0x1c')](vtiger[_0xa6b7('0x2f')]())[_0xa6b7('0x1c')](realtime[_0xa6b7('0x30')]())['then'](freshsales[_0xa6b7('0x31')]())[_0xa6b7('0x1c')](realtime['initFreshsalesAccounts']())[_0xa6b7('0x1c')](servicenow[_0xa6b7('0x32')]())[_0xa6b7('0x1c')](realtime[_0xa6b7('0x33')]())[_0xa6b7('0x1c')](dynamics365[_0xa6b7('0x34')]())['then'](realtime['initDynamics365Accounts']())[_0xa6b7('0x1c')](campaign[_0xa6b7('0x35')]())[_0xa6b7('0x1c')](realtime[_0xa6b7('0x36')]())[_0xa6b7('0x1c')](voiceExtension[_0xa6b7('0x37')]())['then'](realtime[_0xa6b7('0x38')]())['then'](faxAccount[_0xa6b7('0x39')]())[_0xa6b7('0x1c')](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xa6b7('0x1b')]()[_0xa6b7('0x1c')](voiceQueueReport[_0xa6b7('0x3a')]())['then'](realtime['initVoiceQueueReports']())[_0xa6b7('0x1c')](cmHopperHistory[_0xa6b7('0x3b')]())[_0xa6b7('0x1c')](realtime[_0xa6b7('0x3c')]())['then'](cmHopperHistory[_0xa6b7('0x3d')]())['then'](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0xa6b7('0x3e')]())['then'](realtime[_0xa6b7('0x3f')]())['then'](function(_0x4f8154){})['catch'](function(_0x1e6993){console[_0xa6b7('0x40')](_0x1e6993);});}function main(){return server[_0xa6b7('0x41')](realtime,preview,fax)[_0xa6b7('0x1c')](function(_0x4c4e44){return initRealtime();})[_0xa6b7('0x1c')](function(){return initParams();})['then'](function(){report[_0xa6b7('0x42')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x3980d1){console[_0xa6b7('0x40')](_0x3980d1);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 61c64df..f19392d 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 _0x0d6e=['idle','voiceStatus','toNumber','format','status','stringify','user:%s','emit','user:save','exports','lodash','util','moment','md5','ioredis','redis','defaults','localhost','name','email','accountcode','fullname','unknown','address','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','state','toLowerCase','not_inuse'];(function(_0x40bfd6,_0x584278){var _0xde5d8e=function(_0x541e1f){while(--_0x541e1f){_0x40bfd6['push'](_0x40bfd6['shift']());}};_0xde5d8e(++_0x584278);}(_0x0d6e,0x1ba));var _0xe0d6=function(_0xbe5a3,_0x3dbf71){_0xbe5a3=_0xbe5a3-0x0;var _0x7fcdbc=_0x0d6e[_0xbe5a3];return _0x7fcdbc;};'use strict';var _=require(_0xe0d6('0x0'));var util=require(_0xe0d6('0x1'));var moment=require(_0xe0d6('0x2'));var md5=require(_0xe0d6('0x3'));var Redis=require(_0xe0d6('0x4'));var config=require('../../../config/environment');config[_0xe0d6('0x5')]=_[_0xe0d6('0x6')](config[_0xe0d6('0x5')],{'host':_0xe0d6('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe0d6('0x5')]));function Agent(_0x2d550c){this['id']=_0x2d550c['id']||0x0;this[_0xe0d6('0x8')]=_0x2d550c[_0xe0d6('0x8')]||'';this[_0xe0d6('0x9')]=_0x2d550c[_0xe0d6('0x9')]||'';this[_0xe0d6('0xa')]=_0x2d550c[_0xe0d6('0xa')]||'';this['fullname']=_0x2d550c[_0xe0d6('0xb')]||'';this['state']=_0xe0d6('0xc');this['stateTime']=0x0;this['status']=_0xe0d6('0xc');this[_0xe0d6('0xd')]='';this[_0xe0d6('0xe')]='';this[_0xe0d6('0xf')]='';this[_0xe0d6('0x10')]='';this[_0xe0d6('0x11')]=_0x2d550c[_0xe0d6('0x11')]||![];this['voiceStatus']=_0xe0d6('0xc');this[_0xe0d6('0x12')]=0x0;this[_0xe0d6('0x13')]='';this[_0xe0d6('0x14')]='';this[_0xe0d6('0x15')]=![];this['local']=![];this[_0xe0d6('0x3')]='';}Agent[_0xe0d6('0x16')]['updateStatusRealtime']=function(_0x5bf885){var _0x3e8444;if(_0x5bf885&&_0x5bf885['state']){_0x3e8444=_0x5bf885[_0xe0d6('0x17')][_0xe0d6('0x18')]();switch(_0x3e8444){case _0xe0d6('0x19'):_0x3e8444=_0xe0d6('0x1a');break;case'inuse':_0x3e8444='talking';break;}}if(_0x3e8444&&this[_0xe0d6('0x1b')]!==_0x3e8444||_0x5bf885['statePause']){this[_0xe0d6('0x12')]=_[_0xe0d6('0x1c')](moment()[_0xe0d6('0x1d')]('x'));}if(_0x3e8444){this[_0xe0d6('0x1b')]=_0x3e8444;}var _0x57c828={'id':this['id'],'name':this['name'],'email':this[_0xe0d6('0x9')],'accountcode':this[_0xe0d6('0xa')],'fullname':this[_0xe0d6('0xb')],'state':this[_0xe0d6('0x17')],'stateTime':this['stateTime'],'status':this[_0xe0d6('0x1e')],'address':this[_0xe0d6('0xd')],'online':this['online'],'voiceStatus':this[_0xe0d6('0x1b')],'voiceStatusTime':this[_0xe0d6('0x12')],'voiceStatusCallerIdNumber':this[_0xe0d6('0x13')],'voiceStatusQueue':this[_0xe0d6('0x14')],'interface':this['interface'],'onhold':this[_0xe0d6('0x15')]};var _0x3b41ca=md5(JSON[_0xe0d6('0x1f')](_0x57c828));if(this[_0xe0d6('0x3')]!==_0x3b41ca){this['md5']=_0x3b41ca;io['to'](util[_0xe0d6('0x1d')](_0xe0d6('0x20'),_0x57c828[_0xe0d6('0x8')]))[_0xe0d6('0x21')](_0xe0d6('0x22'),_0x57c828);}};module[_0xe0d6('0x23')]=Agent; \ No newline at end of file +var _0xffe3=['accountcode','fullname','state','unknown','stateTime','status','address','mobile','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','local','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format','name','voiceStatusCallerIdNumber','interface','user:%s','emit','exports','util','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','email'];(function(_0xb1b08c,_0x1961a6){var _0x608518=function(_0x405997){while(--_0x405997){_0xb1b08c['push'](_0xb1b08c['shift']());}};_0x608518(++_0x1961a6);}(_0xffe3,0xb0));var _0x3ffe=function(_0x9a3d48,_0x39ebeb){_0x9a3d48=_0x9a3d48-0x0;var _0x47f8b9=_0xffe3[_0x9a3d48];return _0x47f8b9;};'use strict';var _=require('lodash');var util=require(_0x3ffe('0x0'));var moment=require('moment');var md5=require(_0x3ffe('0x1'));var Redis=require(_0x3ffe('0x2'));var config=require(_0x3ffe('0x3'));config['redis']=_[_0x3ffe('0x4')](config[_0x3ffe('0x5')],{'host':_0x3ffe('0x6'),'port':0x18eb});var io=require(_0x3ffe('0x7'))(new Redis(config[_0x3ffe('0x5')]));function Agent(_0x30c66e){this['id']=_0x30c66e['id']||0x0;this['name']=_0x30c66e['name']||'';this['email']=_0x30c66e[_0x3ffe('0x8')]||'';this[_0x3ffe('0x9')]=_0x30c66e['accountcode']||'';this['fullname']=_0x30c66e[_0x3ffe('0xa')]||'';this[_0x3ffe('0xb')]=_0x3ffe('0xc');this[_0x3ffe('0xd')]=0x0;this[_0x3ffe('0xe')]=_0x3ffe('0xc');this[_0x3ffe('0xf')]='';this['phone']='';this[_0x3ffe('0x10')]='';this['interface']='';this[_0x3ffe('0x11')]=_0x30c66e[_0x3ffe('0x11')]||![];this[_0x3ffe('0x12')]='unknown';this[_0x3ffe('0x13')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x3ffe('0x14')]='';this[_0x3ffe('0x15')]=![];this[_0x3ffe('0x16')]=![];this[_0x3ffe('0x1')]='';}Agent['prototype'][_0x3ffe('0x17')]=function(_0x388f2b){var _0x3c3955;if(_0x388f2b&&_0x388f2b[_0x3ffe('0xb')]){_0x3c3955=_0x388f2b[_0x3ffe('0xb')][_0x3ffe('0x18')]();switch(_0x3c3955){case _0x3ffe('0x19'):_0x3c3955=_0x3ffe('0x1a');break;case _0x3ffe('0x1b'):_0x3c3955='talking';break;}}if(_0x3c3955&&this[_0x3ffe('0x12')]!==_0x3c3955||_0x388f2b[_0x3ffe('0x1c')]){this[_0x3ffe('0x13')]=_[_0x3ffe('0x1d')](moment()[_0x3ffe('0x1e')]('x'));}if(_0x3c3955){this[_0x3ffe('0x12')]=_0x3c3955;}var _0x249f3b={'id':this['id'],'name':this[_0x3ffe('0x1f')],'email':this[_0x3ffe('0x8')],'accountcode':this[_0x3ffe('0x9')],'fullname':this[_0x3ffe('0xa')],'state':this['state'],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0x3ffe('0xf')],'online':this[_0x3ffe('0x11')],'voiceStatus':this[_0x3ffe('0x12')],'voiceStatusTime':this[_0x3ffe('0x13')],'voiceStatusCallerIdNumber':this[_0x3ffe('0x20')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x3ffe('0x21')],'onhold':this[_0x3ffe('0x15')]};var _0x474ad0=md5(JSON['stringify'](_0x249f3b));if(this[_0x3ffe('0x1')]!==_0x474ad0){this['md5']=_0x474ad0;io['to'](util[_0x3ffe('0x1e')](_0x3ffe('0x22'),_0x249f3b[_0x3ffe('0x1f')]))[_0x3ffe('0x23')]('user:save',_0x249f3b);}};module[_0x3ffe('0x24')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 640f85b..19422d7 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 _0x8877=['dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','originated','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime'];(function(_0x59e63c,_0x53f72c){var _0xee6bec=function(_0x49dfd){while(--_0x49dfd){_0x59e63c['push'](_0x59e63c['shift']());}};_0xee6bec(++_0x53f72c);}(_0x8877,0x6a));var _0x7887=function(_0x55a76a,_0x2d0203){_0x55a76a=_0x55a76a-0x0;var _0x45885a=_0x8877[_0x55a76a];return _0x45885a;};'use strict';function Campaign(_0x43b204){this['id']=_0x43b204['id']||0x0;this['name']=_0x43b204[_0x7887('0x0')]||'';this['type']=_0x43b204['type']||_0x7887('0x1');this[_0x7887('0x2')]=0x0;this[_0x7887('0x3')]=0x0;this[_0x7887('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x7887('0x5')]='';this[_0x7887('0x6')]=!![];this['active']=_0x43b204[_0x7887('0x7')];this[_0x7887('0x8')]=_0x43b204['limitCalls'];this[_0x7887('0x9')]=_0x43b204[_0x7887('0x9')]||null;this['dialGlobalInterval']=_0x43b204[_0x7887('0xa')]?_0x43b204['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x43b204['dialOriginateCallerIdName'];this[_0x7887('0xb')]=_0x43b204[_0x7887('0xb')];this[_0x7887('0xc')]=_0x43b204[_0x7887('0xc')]||0x1e;this[_0x7887('0xd')]=_0x43b204[_0x7887('0xd')];this[_0x7887('0xe')]=_0x43b204['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x43b204[_0x7887('0xf')];this[_0x7887('0x10')]=_0x43b204['dialBusyRetryFrequency'];this[_0x7887('0x11')]=_0x43b204['dialNoAnswerMaxRetry'];this[_0x7887('0x12')]=_0x43b204[_0x7887('0x12')];this[_0x7887('0x13')]=_0x43b204[_0x7887('0x13')];this[_0x7887('0x14')]=_0x43b204[_0x7887('0x14')]||0x3;this[_0x7887('0x15')]=_0x43b204[_0x7887('0x15')]||0x96;this[_0x7887('0x16')]=_0x43b204[_0x7887('0x16')]||0x3;this[_0x7887('0x17')]=_0x43b204['dialDropRetryFrequency']||0x96;this[_0x7887('0x18')]=_0x43b204[_0x7887('0x18')]||0x3;this[_0x7887('0x19')]=_0x43b204[_0x7887('0x19')]||0x96;this[_0x7887('0x1a')]=_0x43b204[_0x7887('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0x43b204['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x43b204[_0x7887('0x1b')]||0x3;this[_0x7887('0x1c')]=_0x43b204[_0x7887('0x1c')]||0x96;this['dialOrderByScheduledAt']=_0x43b204[_0x7887('0x1d')]||_0x7887('0x1e');this[_0x7887('0x1f')]=_0x43b204[_0x7887('0x1f')]||undefined;this[_0x7887('0x20')]=_0x43b204[_0x7887('0x20')]||undefined;this[_0x7887('0x21')]=_0x43b204['dialCutDigit']||undefined;this['TrunkBackup']=_0x43b204[_0x7887('0x22')]?_0x43b204[_0x7887('0x22')]:undefined;this[_0x7887('0x23')]=_0x43b204[_0x7887('0x23')]?_0x43b204[_0x7887('0x23')]:undefined;this[_0x7887('0x24')]=_0x43b204[_0x7887('0x24')]?_0x43b204[_0x7887('0x24')]:undefined;this[_0x7887('0x25')]=_0x43b204['SquareProject']?_0x43b204['SquareProject']:undefined;this[_0x7887('0x26')]=_0x43b204['SquareProject']?_0x43b204[_0x7887('0x25')][_0x7887('0x0')]:undefined;this[_0x7887('0x27')]=_0x43b204[_0x7887('0x27')]||![];this[_0x7887('0x28')]=_0x43b204[_0x7887('0x28')];this[_0x7887('0x29')]=_0x43b204[_0x7887('0x29')];this[_0x7887('0x2a')]=_0x43b204['dialAMDAfterGreetingSilence'];this[_0x7887('0x2b')]=_0x43b204[_0x7887('0x2b')];this[_0x7887('0x2c')]=_0x43b204[_0x7887('0x2c')];this[_0x7887('0x2d')]=_0x43b204[_0x7887('0x2d')];this[_0x7887('0x2e')]=_0x43b204[_0x7887('0x2e')];this[_0x7887('0x2f')]=_0x43b204[_0x7887('0x2f')];this[_0x7887('0x30')]=_0x43b204[_0x7887('0x30')];}module[_0x7887('0x31')]=Campaign; \ No newline at end of file +var _0x2b44=['dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','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','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry'];(function(_0x5311a1,_0x304912){var _0x2acb9f=function(_0x4803e7){while(--_0x4803e7){_0x5311a1['push'](_0x5311a1['shift']());}};_0x2acb9f(++_0x304912);}(_0x2b44,0x1d7));var _0x42b4=function(_0xfde763,_0x1e4b70){_0xfde763=_0xfde763-0x0;var _0x2a8a0f=_0x2b44[_0xfde763];return _0x2a8a0f;};'use strict';function Campaign(_0x2251a3){this['id']=_0x2251a3['id']||0x0;this['name']=_0x2251a3[_0x42b4('0x0')]||'';this[_0x42b4('0x1')]=_0x2251a3[_0x42b4('0x1')]||_0x42b4('0x2');this[_0x42b4('0x3')]=0x0;this[_0x42b4('0x4')]=0x0;this[_0x42b4('0x5')]=0x0;this[_0x42b4('0x6')]=0x0;this[_0x42b4('0x7')]='';this[_0x42b4('0x8')]=!![];this['active']=_0x2251a3[_0x42b4('0x9')];this[_0x42b4('0xa')]=_0x2251a3[_0x42b4('0xa')];this[_0x42b4('0xb')]=_0x2251a3[_0x42b4('0xb')]||null;this[_0x42b4('0xc')]=_0x2251a3[_0x42b4('0xc')]?_0x2251a3[_0x42b4('0xc')]:null;this['dialOriginateCallerIdName']=_0x2251a3['dialOriginateCallerIdName'];this[_0x42b4('0xd')]=_0x2251a3[_0x42b4('0xd')];this[_0x42b4('0xe')]=_0x2251a3['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x2251a3['dialCongestionMaxRetry'];this[_0x42b4('0xf')]=_0x2251a3[_0x42b4('0xf')];this[_0x42b4('0x10')]=_0x2251a3[_0x42b4('0x10')];this['dialBusyRetryFrequency']=_0x2251a3[_0x42b4('0x11')];this['dialNoAnswerMaxRetry']=_0x2251a3['dialNoAnswerMaxRetry'];this[_0x42b4('0x12')]=_0x2251a3[_0x42b4('0x12')];this[_0x42b4('0x13')]=_0x2251a3['dialGlobalMaxRetry'];this[_0x42b4('0x14')]=_0x2251a3[_0x42b4('0x14')]||0x3;this[_0x42b4('0x15')]=_0x2251a3[_0x42b4('0x15')]||0x96;this[_0x42b4('0x16')]=_0x2251a3[_0x42b4('0x16')]||0x3;this['dialDropRetryFrequency']=_0x2251a3[_0x42b4('0x17')]||0x96;this['dialAbandonedMaxRetry']=_0x2251a3[_0x42b4('0x18')]||0x3;this[_0x42b4('0x19')]=_0x2251a3[_0x42b4('0x19')]||0x96;this['dialMachineMaxRetry']=_0x2251a3[_0x42b4('0x1a')]||0x3;this[_0x42b4('0x1b')]=_0x2251a3[_0x42b4('0x1b')]||0x96;this['dialAgentRejectMaxRetry']=_0x2251a3[_0x42b4('0x1c')]||0x3;this[_0x42b4('0x1d')]=_0x2251a3[_0x42b4('0x1d')]||0x96;this[_0x42b4('0x1e')]=_0x2251a3['dialOrderByScheduledAt']||_0x42b4('0x1f');this[_0x42b4('0x20')]=_0x2251a3['dialPrefix']||undefined;this[_0x42b4('0x21')]=_0x2251a3[_0x42b4('0x21')]||undefined;this[_0x42b4('0x22')]=_0x2251a3['dialCutDigit']||undefined;this[_0x42b4('0x23')]=_0x2251a3[_0x42b4('0x23')]?_0x2251a3[_0x42b4('0x23')]:undefined;this['Trunk']=_0x2251a3['Trunk']?_0x2251a3['Trunk']:undefined;this[_0x42b4('0x24')]=_0x2251a3['Interval']?_0x2251a3['Interval']:undefined;this[_0x42b4('0x25')]=_0x2251a3[_0x42b4('0x25')]?_0x2251a3[_0x42b4('0x25')]:undefined;this[_0x42b4('0x26')]=_0x2251a3[_0x42b4('0x25')]?_0x2251a3[_0x42b4('0x25')][_0x42b4('0x0')]:undefined;this[_0x42b4('0x27')]=_0x2251a3['dialAMDActive']||![];this[_0x42b4('0x28')]=_0x2251a3[_0x42b4('0x28')];this[_0x42b4('0x29')]=_0x2251a3['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x2251a3[_0x42b4('0x2a')];this[_0x42b4('0x2b')]=_0x2251a3[_0x42b4('0x2b')];this[_0x42b4('0x2c')]=_0x2251a3['dialAMDMinWordLength'];this[_0x42b4('0x2d')]=_0x2251a3[_0x42b4('0x2d')];this[_0x42b4('0x2e')]=_0x2251a3[_0x42b4('0x2e')];this[_0x42b4('0x2f')]=_0x2251a3[_0x42b4('0x2f')];this['dialAMDMaximumWordLength']=_0x2251a3[_0x42b4('0x30')];}module[_0x42b4('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 420cd1a..bbb1d13 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 _0x3c8b=['monitors','transfercalleridnum','transferconnectedlinenum','exports','channel','calleridnum','calleridname','connectedlinenum','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','abandoned','lastdata','duration','tag','disposition','monitor','queue'];(function(_0x30107c,_0x38ec3c){var _0x2ebfc0=function(_0x4f1f8e){while(--_0x4f1f8e){_0x30107c['push'](_0x30107c['shift']());}};_0x2ebfc0(++_0x38ec3c);}(_0x3c8b,0x18b));var _0xb3c8=function(_0x43cd3d,_0x32919e){_0x43cd3d=_0x43cd3d-0x0;var _0x33ac43=_0x3c8b[_0x43cd3d];return _0x33ac43;};'use strict';function Channel(){this['starttime']=null;this[_0xb3c8('0x0')]='';this['destinationchannel']='';this[_0xb3c8('0x1')]=0x0;this[_0xb3c8('0x2')]='';this[_0xb3c8('0x3')]=undefined;this['connectedlinename']=undefined;this[_0xb3c8('0x4')]=0x0;this[_0xb3c8('0x5')]='';this[_0xb3c8('0x6')]=0x0;this[_0xb3c8('0x7')]=0x0;this[_0xb3c8('0x8')]=0x0;this[_0xb3c8('0x9')]=![];this[_0xb3c8('0xa')]=null;this[_0xb3c8('0xb')]=null;this['unmanaged']=![];this[_0xb3c8('0xc')]=![];this['lastapplication']='';this[_0xb3c8('0xd')]='';this[_0xb3c8('0xe')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this['type']=null;this[_0xb3c8('0xf')]=null;this[_0xb3c8('0x10')]=null;this[_0xb3c8('0x11')]=![];this['monitorFilename']=null;this[_0xb3c8('0x12')]=null;this[_0xb3c8('0x13')]=[];this[_0xb3c8('0x14')]=undefined;this[_0xb3c8('0x15')]=undefined;this['mohtime']=0x0;}module[_0xb3c8('0x16')]=Channel; \ No newline at end of file +var _0xa866=['transfercalleridnum','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','context','linkedid','exten','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','disposition','monitor','monitorFilename','monitors'];(function(_0x14fcdc,_0x3babb8){var _0x2d10c8=function(_0x474857){while(--_0x474857){_0x14fcdc['push'](_0x14fcdc['shift']());}};_0x2d10c8(++_0x3babb8);}(_0xa866,0x6a));var _0x6a86=function(_0x7277e,_0x555fd8){_0x7277e=_0x7277e-0x0;var _0x2075f7=_0xa866[_0x7277e];return _0x2075f7;};'use strict';function Channel(){this[_0x6a86('0x0')]=null;this[_0x6a86('0x1')]='';this[_0x6a86('0x2')]='';this[_0x6a86('0x3')]=0x0;this[_0x6a86('0x4')]='';this['connectedlinenum']=undefined;this[_0x6a86('0x5')]=undefined;this[_0x6a86('0x6')]=0x0;this[_0x6a86('0x7')]='';this['uniqueid']=0x0;this[_0x6a86('0x8')]=0x0;this[_0x6a86('0x9')]=0x0;this[_0x6a86('0xa')]=![];this['answertime']=null;this[_0x6a86('0xb')]=null;this[_0x6a86('0xc')]=![];this[_0x6a86('0xd')]=![];this[_0x6a86('0xe')]='';this[_0x6a86('0xf')]='';this[_0x6a86('0x10')]=0x0;this[_0x6a86('0x11')]=0x0;this[_0x6a86('0x12')]=0x0;this[_0x6a86('0x13')]=null;this['tag']=null;this[_0x6a86('0x14')]=null;this[_0x6a86('0x15')]=![];this[_0x6a86('0x16')]=null;this['queue']=null;this[_0x6a86('0x17')]=[];this[_0x6a86('0x18')]=undefined;this['transferconnectedlinenum']=undefined;this['mohtime']=0x0;}module[_0x6a86('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 5fbf75f..dcfd9d4 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 _0xf5a7=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','serverUrl','exports','name'];(function(_0x50ca56,_0x1d7802){var _0x574233=function(_0x1677bb){while(--_0x1677bb){_0x50ca56['push'](_0x50ca56['shift']());}};_0x574233(++_0x1d7802);}(_0xf5a7,0x133));var _0x7f5a=function(_0x406294,_0x3ba958){_0x406294=_0x406294-0x0;var _0x1836dd=_0xf5a7[_0x406294];return _0x1836dd;};'use strict';function DeskAccount(_0x227d06){this['id']=_0x227d06['id']||0x0;this[_0x7f5a('0x0')]=_0x227d06['name']||'';this[_0x7f5a('0x1')]=_0x227d06[_0x7f5a('0x1')]||'';this[_0x7f5a('0x2')]=_0x227d06[_0x7f5a('0x2')]||'';this[_0x7f5a('0x3')]=_0x227d06[_0x7f5a('0x3')]||'';this[_0x7f5a('0x4')]=_0x227d06[_0x7f5a('0x4')]||'';this[_0x7f5a('0x5')]=_0x227d06['consumerKey']||'';this[_0x7f5a('0x6')]=_0x227d06[_0x7f5a('0x6')]||'';this['token']=_0x227d06[_0x7f5a('0x7')]||'';this[_0x7f5a('0x8')]=_0x227d06[_0x7f5a('0x8')]||'';this['type']=_0x227d06['type']||'';this[_0x7f5a('0x9')]=_0x227d06[_0x7f5a('0x9')]||'';this['Configurations']=_0x227d06['Configurations']||{};}module[_0x7f5a('0xa')]=DeskAccount; \ No newline at end of file +var _0x3248=['type','Configurations','exports','name','username','remoteUri','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x1aa237,_0x1ce9c6){var _0x64a998=function(_0xe2d46e){while(--_0xe2d46e){_0x1aa237['push'](_0x1aa237['shift']());}};_0x64a998(++_0x1ce9c6);}(_0x3248,0x1b0));var _0x8324=function(_0x3504cd,_0x531da0){_0x3504cd=_0x3504cd-0x0;var _0x198097=_0x3248[_0x3504cd];return _0x198097;};'use strict';function DeskAccount(_0x168617){this['id']=_0x168617['id']||0x0;this[_0x8324('0x0')]=_0x168617[_0x8324('0x0')]||'';this[_0x8324('0x1')]=_0x168617[_0x8324('0x1')]||'';this[_0x8324('0x2')]=_0x168617[_0x8324('0x2')]||'';this['authType']=_0x168617['authType']||'';this[_0x8324('0x3')]=_0x168617[_0x8324('0x3')]||'';this['consumerKey']=_0x168617[_0x8324('0x4')]||'';this[_0x8324('0x5')]=_0x168617[_0x8324('0x5')]||'';this[_0x8324('0x6')]=_0x168617[_0x8324('0x6')]||'';this['tokenSecret']=_0x168617[_0x8324('0x7')]||'';this[_0x8324('0x8')]=_0x168617[_0x8324('0x8')]||'';this['serverUrl']=_0x168617['serverUrl']||'';this[_0x8324('0x9')]=_0x168617[_0x8324('0x9')]||{};}module[_0x8324('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 2560e00..511de5e 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 _0x09b4=['remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','name','username','password'];(function(_0x81f000,_0x15df85){var _0x337aa2=function(_0x37f6a4){while(--_0x37f6a4){_0x81f000['push'](_0x81f000['shift']());}};_0x337aa2(++_0x15df85);}(_0x09b4,0x1b6));var _0x409b=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x09b4[_0xc4001c];return _0x49f7bc;};'use strict';function Dynamics365Account(_0x4214b5){this['id']=_0x4214b5['id']||0x0;this[_0x409b('0x0')]=_0x4214b5[_0x409b('0x0')]||'';this[_0x409b('0x1')]=_0x4214b5['username']||'';this[_0x409b('0x2')]=_0x4214b5['password']||'';this[_0x409b('0x3')]=_0x4214b5[_0x409b('0x3')]||'';this[_0x409b('0x4')]=_0x4214b5[_0x409b('0x4')]||'';this[_0x409b('0x5')]=_0x4214b5[_0x409b('0x5')]||'';this[_0x409b('0x6')]=_0x4214b5['clientSecret']||{};this[_0x409b('0x7')]=_0x4214b5[_0x409b('0x7')]||'';this['Configurations']=_0x4214b5[_0x409b('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x02f7=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','name','username'];(function(_0x15f1b2,_0x186ef1){var _0xca1f2b=function(_0x1010b4){while(--_0x1010b4){_0x15f1b2['push'](_0x15f1b2['shift']());}};_0xca1f2b(++_0x186ef1);}(_0x02f7,0x130));var _0x702f=function(_0x28e96c,_0x2d75ed){_0x28e96c=_0x28e96c-0x0;var _0x1db3d5=_0x02f7[_0x28e96c];return _0x1db3d5;};'use strict';function Dynamics365Account(_0x1e01af){this['id']=_0x1e01af['id']||0x0;this[_0x702f('0x0')]=_0x1e01af[_0x702f('0x0')]||'';this[_0x702f('0x1')]=_0x1e01af['username']||'';this[_0x702f('0x2')]=_0x1e01af[_0x702f('0x2')]||'';this[_0x702f('0x3')]=_0x1e01af[_0x702f('0x3')]||'';this[_0x702f('0x4')]=_0x1e01af[_0x702f('0x4')]||'';this[_0x702f('0x5')]=_0x1e01af[_0x702f('0x5')]||'';this[_0x702f('0x6')]=_0x1e01af[_0x702f('0x6')]||{};this[_0x702f('0x7')]=_0x1e01af[_0x702f('0x7')]||'';this[_0x702f('0x8')]=_0x1e01af[_0x702f('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 1834ec7..ba299a5 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 _0x1aac=['modem','v17,v27,v29','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x1aac,0xca));var _0xc1aa=function(_0x52d547,_0x217992){_0x52d547=_0x52d547-0x0;var _0x576685=_0x1aac[_0x52d547];return _0x576685;};'use strict';function FaxAccount(_0x3d0456){this['id']=_0x3d0456['id']||0x0;this[_0xc1aa('0x0')]=_0x3d0456[_0xc1aa('0x0')]||'';this[_0xc1aa('0x1')]=_0x3d0456[_0xc1aa('0x1')];this[_0xc1aa('0x2')]=_0x3d0456['ecm'];this[_0xc1aa('0x3')]=_0x3d0456[_0xc1aa('0x3')];this[_0xc1aa('0x4')]=_0x3d0456[_0xc1aa('0x4')];this['minrate']=_0x3d0456[_0xc1aa('0x5')]||0x960;this['maxrate']=_0x3d0456['maxrate']||0x3840;this[_0xc1aa('0x6')]=_0x3d0456[_0xc1aa('0x6')]||_0xc1aa('0x7');this['gateway']=_0x3d0456['gateway']||'no';this[_0xc1aa('0x8')]=_0x3d0456['faxdetect']||'no';this[_0xc1aa('0x9')]=_0x3d0456[_0xc1aa('0x9')]||0x1388;this['tech']=_0x3d0456[_0xc1aa('0xa')]||_0xc1aa('0xb');this['Trunk']=_0x3d0456[_0xc1aa('0xc')]?_0x3d0456[_0xc1aa('0xc')]:undefined;this[_0xc1aa('0xd')]=_0x3d0456[_0xc1aa('0xd')];this[_0xc1aa('0xe')]=_0x3d0456[_0xc1aa('0xe')];}module[_0xc1aa('0xf')]=FaxAccount; \ No newline at end of file +var _0xe785=['faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','localstationid','minrate','modem','v17,v27,v29','gateway'];(function(_0x39783b,_0x4b1912){var _0x6b4fb3=function(_0x4ae04b){while(--_0x4ae04b){_0x39783b['push'](_0x39783b['shift']());}};_0x6b4fb3(++_0x4b1912);}(_0xe785,0x128));var _0x5e78=function(_0x3d1c2f,_0x2efbe4){_0x3d1c2f=_0x3d1c2f-0x0;var _0x44e19e=_0xe785[_0x3d1c2f];return _0x44e19e;};'use strict';function FaxAccount(_0x4e6f62){this['id']=_0x4e6f62['id']||0x0;this[_0x5e78('0x0')]=_0x4e6f62['name']||'';this[_0x5e78('0x1')]=_0x4e6f62[_0x5e78('0x1')];this[_0x5e78('0x2')]=_0x4e6f62[_0x5e78('0x2')];this['headerinfo']=_0x4e6f62['headerinfo'];this[_0x5e78('0x3')]=_0x4e6f62[_0x5e78('0x3')];this[_0x5e78('0x4')]=_0x4e6f62[_0x5e78('0x4')]||0x960;this['maxrate']=_0x4e6f62['maxrate']||0x3840;this[_0x5e78('0x5')]=_0x4e6f62[_0x5e78('0x5')]||_0x5e78('0x6');this['gateway']=_0x4e6f62[_0x5e78('0x7')]||'no';this['faxdetect']=_0x4e6f62[_0x5e78('0x8')]||'no';this['t38timeout']=_0x4e6f62[_0x5e78('0x9')]||0x1388;this[_0x5e78('0xa')]=_0x4e6f62['tech']||_0x5e78('0xb');this[_0x5e78('0xc')]=_0x4e6f62[_0x5e78('0xc')]?_0x4e6f62[_0x5e78('0xc')]:undefined;this[_0x5e78('0xd')]=_0x4e6f62[_0x5e78('0xd')];this[_0x5e78('0xe')]=_0x4e6f62['key'];}module[_0x5e78('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 7790ded..8d482bc 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 _0xd5d1=['serverUrl','Configurations','name','username','apiKey','token','remoteUri'];(function(_0x24d94b,_0x5cc40e){var _0x312acf=function(_0x31e8d3){while(--_0x31e8d3){_0x24d94b['push'](_0x24d94b['shift']());}};_0x312acf(++_0x5cc40e);}(_0xd5d1,0x1ad));var _0x1d5d=function(_0x48bc0e,_0x208776){_0x48bc0e=_0x48bc0e-0x0;var _0x548918=_0xd5d1[_0x48bc0e];return _0x548918;};'use strict';function FreshdeskAccount(_0x1994a8){this['id']=_0x1994a8['id']||0x0;this[_0x1d5d('0x0')]=_0x1994a8[_0x1d5d('0x0')]||'';this[_0x1d5d('0x1')]=_0x1994a8['username']||'';this[_0x1d5d('0x2')]=_0x1994a8[_0x1d5d('0x3')]||'';this['remoteUri']=_0x1994a8[_0x1d5d('0x4')]||'';this[_0x1d5d('0x5')]=_0x1994a8['serverUrl']||'';this[_0x1d5d('0x6')]=_0x1994a8[_0x1d5d('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x933b=['Configurations','exports','name','username','apiKey','remoteUri','serverUrl'];(function(_0x9c8f73,_0x2fc416){var _0x16b8d5=function(_0xd2c0ce){while(--_0xd2c0ce){_0x9c8f73['push'](_0x9c8f73['shift']());}};_0x16b8d5(++_0x2fc416);}(_0x933b,0xbf));var _0xb933=function(_0x133a40,_0x5ca760){_0x133a40=_0x133a40-0x0;var _0x2d5923=_0x933b[_0x133a40];return _0x2d5923;};'use strict';function FreshdeskAccount(_0x266b8c){this['id']=_0x266b8c['id']||0x0;this[_0xb933('0x0')]=_0x266b8c[_0xb933('0x0')]||'';this[_0xb933('0x1')]=_0x266b8c[_0xb933('0x1')]||'';this[_0xb933('0x2')]=_0x266b8c['token']||'';this[_0xb933('0x3')]=_0x266b8c[_0xb933('0x3')]||'';this[_0xb933('0x4')]=_0x266b8c['serverUrl']||'';this[_0xb933('0x5')]=_0x266b8c['Configurations']||{};}module[_0xb933('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index e8627bd..2f1f6fd 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 _0x5d16=['remoteUri','serverUrl','Configurations','name','username','token'];(function(_0x260803,_0x34a216){var _0x596844=function(_0x37d5ac){while(--_0x37d5ac){_0x260803['push'](_0x260803['shift']());}};_0x596844(++_0x34a216);}(_0x5d16,0xb7));var _0x65d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d16[_0x3dd15e];return _0x231fd0;};'use strict';function FreshsalesAccount(_0x1aa606){this['id']=_0x1aa606['id']||0x0;this['name']=_0x1aa606[_0x65d1('0x0')]||'';this['username']=_0x1aa606[_0x65d1('0x1')]||'';this['apiKey']=_0x1aa606[_0x65d1('0x2')]||'';this[_0x65d1('0x3')]=_0x1aa606[_0x65d1('0x3')]||'';this[_0x65d1('0x4')]=_0x1aa606[_0x65d1('0x4')]||'';this[_0x65d1('0x5')]=_0x1aa606['Configurations']||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xce2e=['remoteUri','serverUrl','Configurations','name','username','apiKey','token'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xce2e,0x1d8));var _0xece2=function(_0x2b1ceb,_0x318393){_0x2b1ceb=_0x2b1ceb-0x0;var _0x231071=_0xce2e[_0x2b1ceb];return _0x231071;};'use strict';function FreshsalesAccount(_0x1047c8){this['id']=_0x1047c8['id']||0x0;this[_0xece2('0x0')]=_0x1047c8[_0xece2('0x0')]||'';this[_0xece2('0x1')]=_0x1047c8[_0xece2('0x1')]||'';this[_0xece2('0x2')]=_0x1047c8[_0xece2('0x3')]||'';this['remoteUri']=_0x1047c8[_0xece2('0x4')]||'';this[_0xece2('0x5')]=_0x1047c8[_0xece2('0x5')]||'';this[_0xece2('0x6')]=_0x1047c8['Configurations']||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 9d4e977..635c931 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 _0x2d3e=['queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','context','priority','holdtime','lastAssignedTo','variables','type','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','position','count'];(function(_0x5a8930,_0x2d1bb0){var _0x2c9060=function(_0x3e5156){while(--_0x3e5156){_0x5a8930['push'](_0x5a8930['shift']());}};_0x2c9060(++_0x2d1bb0);}(_0x2d3e,0x66));var _0xe2d3=function(_0x1f07b4,_0xe2e9db){_0x1f07b4=_0x1f07b4-0x0;var _0x129fc4=_0x2d3e[_0x1f07b4];return _0x129fc4;};'use strict';function QueueReport(){this[_0xe2d3('0x0')]=_0xe2d3('0x1');this[_0xe2d3('0x2')]='';this['calleridnum']='';this[_0xe2d3('0x3')]='';this[_0xe2d3('0x4')]='';this[_0xe2d3('0x5')]=null;this['queuecallerleaveAt']=null;this[_0xe2d3('0x6')]=0x1;this[_0xe2d3('0x7')]=0x1;this[_0xe2d3('0x8')]=![];this[_0xe2d3('0x9')]=null;this[_0xe2d3('0xa')]=![];this[_0xe2d3('0xb')]=null;this['queuecallerexit']=![];this[_0xe2d3('0xc')]=null;this[_0xe2d3('0xd')]=0x1;this['channel']='';this[_0xe2d3('0xe')]='';this[_0xe2d3('0xf')]='';this[_0xe2d3('0x10')]='';this[_0xe2d3('0x11')]='';this['exten']='';this[_0xe2d3('0x12')]='';this[_0xe2d3('0x13')]=0x0;this['assigned']=![];this[_0xe2d3('0x14')]='';this['mohtime']=0x0;this[_0xe2d3('0x15')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xf538=['queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','context','exten','priority','holdtime','lastAssignedTo','mohtime','variables','exports','type','uniqueid','calleridname','queue'];(function(_0x413812,_0x2ad176){var _0x51cb42=function(_0x37ce06){while(--_0x37ce06){_0x413812['push'](_0x413812['shift']());}};_0x51cb42(++_0x2ad176);}(_0xf538,0x13e));var _0x8f53=function(_0x3db94a,_0x117062){_0x3db94a=_0x3db94a-0x0;var _0x5df368=_0xf538[_0x3db94a];return _0x5df368;};'use strict';function QueueReport(){this[_0x8f53('0x0')]='inbound';this[_0x8f53('0x1')]='';this['calleridnum']='';this[_0x8f53('0x2')]='';this[_0x8f53('0x3')]='';this[_0x8f53('0x4')]=null;this[_0x8f53('0x5')]=null;this['position']=0x1;this[_0x8f53('0x6')]=0x1;this['queuecallerabandon']=![];this[_0x8f53('0x7')]=null;this[_0x8f53('0x8')]=![];this[_0x8f53('0x9')]=null;this[_0x8f53('0xa')]=![];this[_0x8f53('0xb')]=null;this['originalposition']=0x1;this[_0x8f53('0xc')]='';this[_0x8f53('0xd')]='';this[_0x8f53('0xe')]='';this['accountcode']='';this[_0x8f53('0xf')]='';this[_0x8f53('0x10')]='';this[_0x8f53('0x11')]='';this[_0x8f53('0x12')]=0x0;this['assigned']=![];this[_0x8f53('0x13')]='';this[_0x8f53('0x14')]=0x0;this[_0x8f53('0x15')]={};}module[_0x8f53('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 2f7b10e..29ef841 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 _0x7c2e=['serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0x7c2e,0x7a));var _0xe7c2=function(_0x494c0b,_0x4027bb){_0x494c0b=_0x494c0b-0x0;var _0x2fe968=_0x7c2e[_0x494c0b];return _0x2fe968;};'use strict';function SalesforceAccount(_0x394def){this['id']=_0x394def['id']||0x0;this[_0xe7c2('0x0')]=_0x394def[_0xe7c2('0x0')]||'';this[_0xe7c2('0x1')]=_0x394def[_0xe7c2('0x1')]||'';this[_0xe7c2('0x2')]=_0x394def[_0xe7c2('0x2')]||'';this[_0xe7c2('0x3')]=_0x394def[_0xe7c2('0x3')]||'';this['clientId']=_0x394def[_0xe7c2('0x4')]||'';this[_0xe7c2('0x5')]=_0x394def[_0xe7c2('0x5')]||'';this[_0xe7c2('0x6')]=_0x394def[_0xe7c2('0x6')]||'';this[_0xe7c2('0x7')]=_0x394def[_0xe7c2('0x7')]||'integrationTab';this[_0xe7c2('0x8')]=_0x394def['serverUrl']||'';this[_0xe7c2('0x9')]=_0x394def[_0xe7c2('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xab10=['type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x5b0acf,_0x4e984d){var _0x2ed6e9=function(_0xea974a){while(--_0xea974a){_0x5b0acf['push'](_0x5b0acf['shift']());}};_0x2ed6e9(++_0x4e984d);}(_0xab10,0x119));var _0x0ab1=function(_0x479473,_0xe3765){_0x479473=_0x479473-0x0;var _0x45259c=_0xab10[_0x479473];return _0x45259c;};'use strict';function SalesforceAccount(_0x192e75){this['id']=_0x192e75['id']||0x0;this[_0x0ab1('0x0')]=_0x192e75[_0x0ab1('0x0')]||'';this[_0x0ab1('0x1')]=_0x192e75[_0x0ab1('0x1')]||'';this[_0x0ab1('0x2')]=_0x192e75[_0x0ab1('0x2')]||'';this['password']=_0x192e75[_0x0ab1('0x3')]||'';this[_0x0ab1('0x4')]=_0x192e75[_0x0ab1('0x4')]||'';this[_0x0ab1('0x5')]=_0x192e75[_0x0ab1('0x5')]||'';this[_0x0ab1('0x6')]=_0x192e75[_0x0ab1('0x6')]||'';this[_0x0ab1('0x7')]=_0x192e75[_0x0ab1('0x7')]||_0x0ab1('0x8');this[_0x0ab1('0x9')]=_0x192e75[_0x0ab1('0x9')]||'';this[_0x0ab1('0xa')]=_0x192e75[_0x0ab1('0xa')]||{};}module[_0x0ab1('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 9fd3ce7..923f3fc 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 _0x1b39=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x1ec94d,_0x50ed87){var _0x51db63=function(_0x4e83fd){while(--_0x4e83fd){_0x1ec94d['push'](_0x1ec94d['shift']());}};_0x51db63(++_0x50ed87);}(_0x1b39,0x188));var _0x91b3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1b39[_0x4a9fb1];return _0x348672;};'use strict';function ServicenowAccount(_0x346065){this['id']=_0x346065['id']||0x0;this['name']=_0x346065[_0x91b3('0x0')]||'';this[_0x91b3('0x1')]=_0x346065['username']||'';this[_0x91b3('0x2')]=_0x346065[_0x91b3('0x2')]||'';this[_0x91b3('0x3')]=_0x346065[_0x91b3('0x3')]||'';this[_0x91b3('0x4')]=_0x346065['serverUrl']||'';this[_0x91b3('0x5')]=_0x346065[_0x91b3('0x5')]||{};}module[_0x91b3('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xac10=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x3fa8f6,_0x31b548){var _0x1dd791=function(_0x511d00){while(--_0x511d00){_0x3fa8f6['push'](_0x3fa8f6['shift']());}};_0x1dd791(++_0x31b548);}(_0xac10,0x169));var _0x0ac1=function(_0x71ae3c,_0x404627){_0x71ae3c=_0x71ae3c-0x0;var _0x194072=_0xac10[_0x71ae3c];return _0x194072;};'use strict';function ServicenowAccount(_0x35c074){this['id']=_0x35c074['id']||0x0;this[_0x0ac1('0x0')]=_0x35c074['name']||'';this[_0x0ac1('0x1')]=_0x35c074[_0x0ac1('0x1')]||'';this[_0x0ac1('0x2')]=_0x35c074['password']||'';this['remoteUri']=_0x35c074[_0x0ac1('0x3')]||'';this[_0x0ac1('0x4')]=_0x35c074[_0x0ac1('0x4')]||'';this[_0x0ac1('0x5')]=_0x35c074[_0x0ac1('0x5')]||{};}module[_0x0ac1('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 8ecd44f..5d8ba38 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 _0x0215=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x0215,0xcf));var _0x5021=function(_0x1e9d62,_0x25bb8e){_0x1e9d62=_0x1e9d62-0x0;var _0x56c490=_0x0215[_0x1e9d62];return _0x56c490;};'use strict';function SugarcrmAccount(_0x173f1f){this['id']=_0x173f1f['id']||0x0;this['name']=_0x173f1f[_0x5021('0x0')]||'';this[_0x5021('0x1')]=_0x173f1f[_0x5021('0x1')]||'';this[_0x5021('0x2')]=_0x173f1f[_0x5021('0x2')]||'';this['remoteUri']=_0x173f1f[_0x5021('0x3')]||'';this[_0x5021('0x4')]=_0x173f1f[_0x5021('0x4')]||'';this[_0x5021('0x5')]=_0x173f1f[_0x5021('0x5')]||{};}module[_0x5021('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x7c7b=['username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0x7c7b,0x16e));var _0xb7c7=function(_0x1ec10d,_0x3adaad){_0x1ec10d=_0x1ec10d-0x0;var _0x4017a6=_0x7c7b[_0x1ec10d];return _0x4017a6;};'use strict';function SugarcrmAccount(_0x5e14fa){this['id']=_0x5e14fa['id']||0x0;this['name']=_0x5e14fa['name']||'';this[_0xb7c7('0x0')]=_0x5e14fa['username']||'';this[_0xb7c7('0x1')]=_0x5e14fa['password']||'';this[_0xb7c7('0x2')]=_0x5e14fa['remoteUri']||'';this[_0xb7c7('0x3')]=_0x5e14fa['serverUrl']||'';this[_0xb7c7('0x4')]=_0x5e14fa['Configurations']||{};}module[_0xb7c7('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 488cc80..6f8c188 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 _0xa441=['unknown','stateTime','address','exports','name','accountcode'];(function(_0x575b49,_0x44e6d9){var _0x5aba37=function(_0x379eed){while(--_0x379eed){_0x575b49['push'](_0x575b49['shift']());}};_0x5aba37(++_0x44e6d9);}(_0xa441,0x1d8));var _0x1a44=function(_0x8ee843,_0x52d7c3){_0x8ee843=_0x8ee843-0x0;var _0x1915a3=_0xa441[_0x8ee843];return _0x1915a3;};'use strict';function Telephone(_0x552b0a){this['id']=_0x552b0a['id']||0x0;this['name']=_0x552b0a[_0x1a44('0x0')]||'';this[_0x1a44('0x1')]=_0x552b0a[_0x1a44('0x1')]||'';this['state']=_0x1a44('0x2');this[_0x1a44('0x3')]=0x0;this['status']=_0x1a44('0x2');this[_0x1a44('0x4')]='';}module[_0x1a44('0x5')]=Telephone; \ No newline at end of file +var _0xd6d8=['exports','name','accountcode','state','stateTime','status','unknown'];(function(_0x37894d,_0xa70d55){var _0x284f04=function(_0x1eb6b4){while(--_0x1eb6b4){_0x37894d['push'](_0x37894d['shift']());}};_0x284f04(++_0xa70d55);}(_0xd6d8,0x71));var _0x8d6d=function(_0x5743e3,_0x4a2aab){_0x5743e3=_0x5743e3-0x0;var _0x24d100=_0xd6d8[_0x5743e3];return _0x24d100;};'use strict';function Telephone(_0x589315){this['id']=_0x589315['id']||0x0;this[_0x8d6d('0x0')]=_0x589315[_0x8d6d('0x0')]||'';this[_0x8d6d('0x1')]=_0x589315['accountcode']||'';this[_0x8d6d('0x2')]='unknown';this[_0x8d6d('0x3')]=0x0;this[_0x8d6d('0x4')]=_0x8d6d('0x5');this['address']='';}module[_0x8d6d('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index dd6d72d..a4ee203 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 _0x0219=['html','exports','name'];(function(_0x49b649,_0x2fc9b4){var _0x16b8a3=function(_0x307330){while(--_0x307330){_0x49b649['push'](_0x49b649['shift']());}};_0x16b8a3(++_0x2fc9b4);}(_0x0219,0x1dc));var _0x9021=function(_0x4162e5,_0x54698d){_0x4162e5=_0x4162e5-0x0;var _0x5c2c61=_0x0219[_0x4162e5];return _0x5c2c61;};'use strict';function template(_0x158af7){this['id']=_0x158af7['id']||0x0;this[_0x9021('0x0')]=_0x158af7[_0x9021('0x0')]||'';this[_0x9021('0x1')]=_0x158af7['html']||'';}module[_0x9021('0x2')]=template; \ No newline at end of file +var _0x4a2e=['name','html','exports'];(function(_0x1852c8,_0x3e0467){var _0x319e59=function(_0x1e34d7){while(--_0x1e34d7){_0x1852c8['push'](_0x1852c8['shift']());}};_0x319e59(++_0x3e0467);}(_0x4a2e,0x87));var _0xe4a2=function(_0x5634d2,_0x40ec38){_0x5634d2=_0x5634d2-0x0;var _0x4150b5=_0x4a2e[_0x5634d2];return _0x4150b5;};'use strict';function template(_0x56dfe0){this['id']=_0x56dfe0['id']||0x0;this[_0xe4a2('0x0')]=_0x56dfe0[_0xe4a2('0x0')]||'';this[_0xe4a2('0x1')]=_0x56dfe0[_0xe4a2('0x1')]||'';}module[_0xe4a2('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index ee274be..be5dd92 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['AnyConditions','Actions','exports','name','channel','voice','status','AllConditions'];(function(_0x5d0609,_0x127562){var _0xaa3fd1=function(_0x47f457){while(--_0x47f457){_0x5d0609['push'](_0x5d0609['shift']());}};_0xaa3fd1(++_0x127562);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';function Trigger(_0x202794){this['id']=_0x202794['id']||0x0;this[_0x7995('0x0')]=_0x202794[_0x7995('0x0')]||'';this[_0x7995('0x1')]=_0x202794['channel']||_0x7995('0x2');this[_0x7995('0x3')]=_0x202794[_0x7995('0x3')]||![];this[_0x7995('0x4')]=_0x202794['AllConditions']||[];this[_0x7995('0x5')]=_0x202794[_0x7995('0x5')]||[];this[_0x7995('0x6')]=_0x202794[_0x7995('0x6')]||[];}module[_0x7995('0x7')]=Trigger; \ No newline at end of file +var _0x6aa7=['voice','status','AllConditions','Actions','exports','name','channel'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0x6aa7,0x178));var _0x76aa=function(_0x2c97a7,_0x38d4a3){_0x2c97a7=_0x2c97a7-0x0;var _0x17c7d5=_0x6aa7[_0x2c97a7];return _0x17c7d5;};'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 diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 064506f..d1fe83f 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 _0xf50b=['indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','name','state','unknown','status','registry'];(function(_0x2fd0cf,_0x14df3e){var _0x524ef2=function(_0x5aeee){while(--_0x5aeee){_0x2fd0cf['push'](_0x2fd0cf['shift']());}};_0x524ef2(++_0x14df3e);}(_0xf50b,0xdc));var _0xbf50=function(_0x487605,_0x36e6b1){_0x487605=_0x487605-0x0;var _0x3e2f28=_0xf50b[_0x487605];return _0x3e2f28;};'use strict';function Trunk(_0x54b9c8){this['id']=_0x54b9c8['id']||0x0;this['active']=_0x54b9c8['active']||![];this[_0xbf50('0x0')]=_0x54b9c8[_0xbf50('0x0')]||'';this[_0xbf50('0x1')]=_0xbf50('0x2');this['stateTime']=0x0;this[_0xbf50('0x3')]=_0xbf50('0x2');this[_0xbf50('0x4')]=_0x54b9c8[_0xbf50('0x4')]&&_0x54b9c8['registry'][_0xbf50('0x5')](':')?_0x54b9c8[_0xbf50('0x4')][_0xbf50('0x6')](':')[0x0]:'';this[_0xbf50('0x7')]='';this[_0xbf50('0x8')]='';this[_0xbf50('0x9')]='';this[_0xbf50('0xa')]='';this[_0xbf50('0xb')]='';this[_0xbf50('0xc')]=_0xbf50('0x2');this[_0xbf50('0xd')]='';this[_0xbf50('0xe')]='';}module['exports']=Trunk; \ No newline at end of file +var _0x73b6=['unknown','registry','split','host','port','domain','refresh','registrationtime','address','active','name','state','status'];(function(_0x170f10,_0x20c1e4){var _0x183cc7=function(_0x36c6a3){while(--_0x36c6a3){_0x170f10['push'](_0x170f10['shift']());}};_0x183cc7(++_0x20c1e4);}(_0x73b6,0xe6));var _0x673b=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x73b6[_0x1e3c16];return _0x47a0c9;};'use strict';function Trunk(_0x534b8a){this['id']=_0x534b8a['id']||0x0;this[_0x673b('0x0')]=_0x534b8a[_0x673b('0x0')]||![];this[_0x673b('0x1')]=_0x534b8a[_0x673b('0x1')]||'';this[_0x673b('0x2')]='unknown';this['stateTime']=0x0;this[_0x673b('0x3')]=_0x673b('0x4');this['registry']=_0x534b8a[_0x673b('0x5')]&&_0x534b8a[_0x673b('0x5')]['indexOf'](':')?_0x534b8a[_0x673b('0x5')][_0x673b('0x6')](':')[0x0]:'';this[_0x673b('0x7')]='';this[_0x673b('0x8')]='';this[_0x673b('0x9')]='';this['domainport']='';this[_0x673b('0xa')]='';this['stateRegistry']='unknown';this[_0x673b('0xb')]='';this[_0x673b('0xc')]='';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index a262994..da13580 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 _0xa440=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0xa440,0x1b7));var _0x0a44=function(_0x178f52,_0x5d9675){_0x178f52=_0x178f52-0x0;var _0x556f99=_0xa440[_0x178f52];return _0x556f99;};'use strict';function voiceExtension(_0x5d1c29){this['id']=_0x5d1c29['id']||0x0;this[_0x0a44('0x0')]=_0x5d1c29['exten']||'';this[_0x0a44('0x1')]=_0x5d1c29[_0x0a44('0x1')]||_0x0a44('0x2');this[_0x0a44('0x3')]=_0x5d1c29[_0x0a44('0x3')]||![];}module[_0x0a44('0x4')]=voiceExtension; \ No newline at end of file +var _0xe7aa=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x5bc286,_0x557d8e){var _0x83ee96=function(_0x508028){while(--_0x508028){_0x5bc286['push'](_0x5bc286['shift']());}};_0x83ee96(++_0x557d8e);}(_0xe7aa,0xa4));var _0xae7a=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xe7aa[_0x1eda20];return _0x31b953;};'use strict';function voiceExtension(_0x523763){this['id']=_0x523763['id']||0x0;this[_0xae7a('0x0')]=_0x523763['exten']||'';this['recordingFormat']=_0x523763[_0xae7a('0x1')]||_0xae7a('0x2');this[_0xae7a('0x3')]=_0x523763['mandatoryDisposition']||![];}module[_0xae7a('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 4d6279a..ba7eb9a 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 _0xa54e=['dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAvgTalktime','predictiveIntervalPauses','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangBusyFactor','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringinuse','onhold','rrmemory','roundrobin','name','monitor_format','type','inbound','total','answered','sumDuration','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','message','originated','temp'];(function(_0x549ad8,_0x1d0e6c){var _0x448dfe=function(_0x18f2e0){while(--_0x18f2e0){_0x549ad8['push'](_0x549ad8['shift']());}};_0x448dfe(++_0x1d0e6c);}(_0xa54e,0x138));var _0xea54=function(_0x37c8ef,_0x334449){_0x37c8ef=_0x37c8ef-0x0;var _0x5eaee9=_0xa54e[_0x37c8ef];return _0x5eaee9;};'use strict';var statusDesc=[_0xea54('0x0'),_0xea54('0x1'),_0xea54('0x2'),_0xea54('0x3'),_0xea54('0x4'),_0xea54('0x5'),'ringing',_0xea54('0x6'),_0xea54('0x7')];var monitorFormat={'wav':'wav','wav49':'wav49','gsm':'gsm'};var strategy={'rrmemory':_0xea54('0x8'),'roundrobin':_0xea54('0x9')};function VoiceQueue(_0x157e77){this['id']=_0x157e77['id']||0x0;this[_0xea54('0xa')]=_0x157e77[_0xea54('0xa')]||'';this['monitor_format']=_0x157e77[_0xea54('0xb')]||'';this[_0xea54('0xc')]=_0x157e77[_0xea54('0xc')]||_0xea54('0xd');this['waiting']=0x0;this['talking']=0x0;this[_0xea54('0xe')]=0x0;this[_0xea54('0xf')]=0x0;this[_0xea54('0x10')]=0x0;this['sumHoldTime']=0x0;this[_0xea54('0x11')]=0x0;this[_0xea54('0x12')]=0x0;this['abandoned']=0x0;this[_0xea54('0x13')]=0x0;this[_0xea54('0x14')]=0x0;this['acw']=_0x157e77[_0xea54('0x15')]||![];this[_0xea54('0x16')]=_0x157e77[_0xea54('0x16')]||0xa;this[_0xea54('0x17')]=_0x157e77[_0xea54('0x17')]||'no';this['sendMessageOneNotActive']=!![];this[_0xea54('0x18')]='';this[_0xea54('0x19')]=0x0;this[_0xea54('0x1a')]=0x0;this[_0xea54('0x1b')]=_0x157e77['dialTimezone']||null;this['dialGlobalInterval']=_0x157e77[_0xea54('0x1c')]?_0x157e77['dialGlobalInterval']:null;this[_0xea54('0x1d')]=_0x157e77[_0xea54('0x1d')];this['dialMethod']=_0x157e77[_0xea54('0x1e')]||_0xea54('0x1f');this['dialLimitChannel']=_0x157e77[_0xea54('0x20')]||0x0;this[_0xea54('0x21')]=_0x157e77['dialLimitQueue']||0x0;this[_0xea54('0x22')]=_0x157e77['dialPowerLevel']||0x1;this[_0xea54('0x23')]=_0x157e77['dialPredictiveOptimization']||_0xea54('0x24');this[_0xea54('0x25')]=_0x157e77[_0xea54('0x25')]||0.03;this[_0xea54('0x26')]=_0x157e77[_0xea54('0x26')]||0x258;this['dialOriginateCallerIdName']=_0x157e77[_0xea54('0x27')]||_0xea54('0x28');this[_0xea54('0x29')]=_0x157e77[_0xea54('0x29')]||'anonymous';this[_0xea54('0x2a')]=_0x157e77['dialOriginateTimeout']||0x1e;this[_0xea54('0x2b')]=_0x157e77[_0xea54('0x2b')]||_0xea54('0x2c');this[_0xea54('0x2d')]=_0x157e77[_0xea54('0x2d')]||0x3;this[_0xea54('0x2e')]=_0x157e77[_0xea54('0x2e')]||undefined;this['dialCongestionMaxRetry']=_0x157e77[_0xea54('0x2f')]||0x3;this[_0xea54('0x30')]=_0x157e77['dialCongestionRetryFrequency']||0x96;this[_0xea54('0x31')]=_0x157e77['dialBusyMaxRetry']||0x3;this[_0xea54('0x32')]=_0x157e77['dialBusyRetryFrequency']||0x96;this[_0xea54('0x33')]=_0x157e77['dialNoAnswerMaxRetry']||0x3;this[_0xea54('0x34')]=_0x157e77['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x157e77[_0xea54('0x35')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x157e77[_0xea54('0x36')]||0x96;this[_0xea54('0x37')]=_0x157e77[_0xea54('0x37')]||0x3;this[_0xea54('0x38')]=_0x157e77[_0xea54('0x38')]||0x96;this[_0xea54('0x39')]=_0x157e77[_0xea54('0x39')]||0x3;this[_0xea54('0x3a')]=_0x157e77[_0xea54('0x3a')]||0x96;this['dialMachineMaxRetry']=_0x157e77['dialMachineMaxRetry']||0x3;this[_0xea54('0x3b')]=_0x157e77[_0xea54('0x3b')]||0x96;this['dialAgentRejectMaxRetry']=_0x157e77['dialAgentRejectMaxRetry']||0x3;this[_0xea54('0x3c')]=_0x157e77['dialAgentRejectRetryFrequency']||0x96;this[_0xea54('0x3d')]=_0x157e77['dialGlobalMaxRetry']||0x4;this[_0xea54('0x3e')]=_0x157e77[_0xea54('0x3e')]?_0x157e77['Trunk']:undefined;this[_0xea54('0x3f')]=_0x157e77[_0xea54('0x3f')]?_0x157e77[_0xea54('0x3f')]:undefined;this['dialPrefix']=_0x157e77[_0xea54('0x40')]||undefined;this[_0xea54('0x41')]=_0x157e77[_0xea54('0x41')]?_0x157e77['Interval']:undefined;this[_0xea54('0x42')]=_0x157e77[_0xea54('0x42')]||_0xea54('0x43');this[_0xea54('0x44')]=_0x157e77['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xea54('0x45')]=_0x157e77[_0xea54('0x45')]||undefined;this[_0xea54('0x46')]=strategy[_0x157e77[_0xea54('0x46')]]||_0xea54('0x8');this['queueStatusComplete']=!![];this['dialAMDActive']=_0x157e77[_0xea54('0x47')]||![];this[_0xea54('0x48')]=_0x157e77[_0xea54('0x48')];this[_0xea54('0x49')]=_0x157e77[_0xea54('0x49')];this['dialAMDAfterGreetingSilence']=_0x157e77[_0xea54('0x4a')];this[_0xea54('0x4b')]=_0x157e77[_0xea54('0x4b')];this[_0xea54('0x4c')]=_0x157e77['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x157e77[_0xea54('0x4d')];this[_0xea54('0x4e')]=_0x157e77[_0xea54('0x4e')];this[_0xea54('0x4f')]=_0x157e77[_0xea54('0x4f')];this[_0xea54('0x50')]=_0x157e77[_0xea54('0x50')];this[_0xea54('0x51')]=0x0;this[_0xea54('0x52')]=0x0;this[_0xea54('0x53')]=_0x157e77['timeout'];this[_0xea54('0x54')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xea54('0x55')]=0x0;this[_0xea54('0x56')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xea54('0x57')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xea54('0x58')]=0x0;this[_0xea54('0x59')]=0x0;this[_0xea54('0x5a')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xea54('0x5b')]=0x0;this[_0xea54('0x5c')]=0x0;this['outboundAbandonedDay']=0x0;this[_0xea54('0x5d')]=undefined;this[_0xea54('0x5e')]=undefined;this[_0xea54('0x5f')]=undefined;this[_0xea54('0x60')]=1.05;this[_0xea54('0x61')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xea54('0x62')]=0x0;this[_0xea54('0x63')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x157e77[_0xea54('0x64')]||0x14;this['predictiveIntervalMinThreshold']=_0x157e77[_0xea54('0x64')]||0xa;this[_0xea54('0x65')]=0x0;this[_0xea54('0x66')]=0x0;this[_0xea54('0x67')]=0x1;this[_0xea54('0x68')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0xea54('0x69')]=0x0;this['dialRecallMeTimeout']=_0x157e77['dialRecallMeTimeout']||0x1e;this[_0xea54('0x6a')]=_0x157e77[_0xea54('0x6a')]||![];this[_0xea54('0x6b')]=_0x157e77[_0xea54('0x6b')]||undefined;this[_0xea54('0x6c')]=_0x157e77[_0xea54('0x6c')]||![];this[_0xea54('0x6d')]=_0x157e77[_0xea54('0x6d')]||![];this['monitor_format']=monitorFormat[_0x157e77[_0xea54('0xb')]]?monitorFormat[_0x157e77[_0xea54('0xb')]]:undefined;this[_0xea54('0x6e')]=_0x157e77[_0xea54('0x6e')]||![];this[_0xea54('0x6f')]=_0x157e77['mandatoryDispositionPause']?_0x157e77[_0xea54('0x6f')]:undefined;}module[_0xea54('0x70')]=VoiceQueue; \ No newline at end of file +var _0x9cc6=['dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','inuse','busy','invalid','unavailable','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','acw','acwTimeout','autopause','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry'];(function(_0x3b1077,_0x414282){var _0x36de6d=function(_0x599a90){while(--_0x599a90){_0x3b1077['push'](_0x3b1077['shift']());}};_0x36de6d(++_0x414282);}(_0x9cc6,0x19b));var _0x69cc=function(_0x38ce4c,_0xfdbe8c){_0x38ce4c=_0x38ce4c-0x0;var _0x5d4544=_0x9cc6[_0x38ce4c];return _0x5d4544;};'use strict';var statusDesc=[_0x69cc('0x0'),'not_inuse',_0x69cc('0x1'),_0x69cc('0x2'),_0x69cc('0x3'),_0x69cc('0x4'),'ringing',_0x69cc('0x5'),_0x69cc('0x6')];var monitorFormat={'wav':_0x69cc('0x7'),'wav49':_0x69cc('0x8'),'gsm':_0x69cc('0x9')};var strategy={'rrmemory':_0x69cc('0xa'),'roundrobin':_0x69cc('0xb')};function VoiceQueue(_0x47c70b){this['id']=_0x47c70b['id']||0x0;this[_0x69cc('0xc')]=_0x47c70b['name']||'';this[_0x69cc('0xd')]=_0x47c70b[_0x69cc('0xd')]||'';this['type']=_0x47c70b[_0x69cc('0xe')]||_0x69cc('0xf');this[_0x69cc('0x10')]=0x0;this['talking']=0x0;this[_0x69cc('0x11')]=0x0;this[_0x69cc('0x12')]=0x0;this[_0x69cc('0x13')]=0x0;this[_0x69cc('0x14')]=0x0;this[_0x69cc('0x15')]=0x0;this['unmanaged']=0x0;this[_0x69cc('0x16')]=0x0;this[_0x69cc('0x17')]=0x0;this['available']=0x0;this[_0x69cc('0x18')]=_0x47c70b[_0x69cc('0x18')]||![];this['acwTimeout']=_0x47c70b[_0x69cc('0x19')]||0xa;this[_0x69cc('0x1a')]=_0x47c70b[_0x69cc('0x1a')]||'no';this['sendMessageOneNotActive']=!![];this[_0x69cc('0x1b')]='';this['originated']=0x0;this[_0x69cc('0x1c')]=0x0;this[_0x69cc('0x1d')]=_0x47c70b[_0x69cc('0x1d')]||null;this[_0x69cc('0x1e')]=_0x47c70b[_0x69cc('0x1e')]?_0x47c70b[_0x69cc('0x1e')]:null;this[_0x69cc('0x1f')]=_0x47c70b[_0x69cc('0x1f')];this[_0x69cc('0x20')]=_0x47c70b['dialMethod']||_0x69cc('0x21');this[_0x69cc('0x22')]=_0x47c70b['dialLimitChannel']||0x0;this[_0x69cc('0x23')]=_0x47c70b['dialLimitQueue']||0x0;this[_0x69cc('0x24')]=_0x47c70b[_0x69cc('0x24')]||0x1;this['dialPredictiveOptimization']=_0x47c70b[_0x69cc('0x25')]||_0x69cc('0x26');this[_0x69cc('0x27')]=_0x47c70b[_0x69cc('0x27')]||0.03;this['dialPredictiveInterval']=_0x47c70b['dialPredictiveInterval']||0x258;this[_0x69cc('0x28')]=_0x47c70b[_0x69cc('0x28')]||'anonymous';this[_0x69cc('0x29')]=_0x47c70b[_0x69cc('0x29')]||_0x69cc('0x2a');this[_0x69cc('0x2b')]=_0x47c70b[_0x69cc('0x2b')]||0x1e;this['dialQueueOptions']=_0x47c70b[_0x69cc('0x2c')]||_0x69cc('0x2d');this[_0x69cc('0x2e')]=_0x47c70b[_0x69cc('0x2e')]||0x3;this[_0x69cc('0x2f')]=_0x47c70b['dialQueueProject']||undefined;this[_0x69cc('0x30')]=_0x47c70b['dialCongestionMaxRetry']||0x3;this[_0x69cc('0x31')]=_0x47c70b[_0x69cc('0x31')]||0x96;this[_0x69cc('0x32')]=_0x47c70b['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x47c70b[_0x69cc('0x33')]||0x96;this[_0x69cc('0x34')]=_0x47c70b['dialNoAnswerMaxRetry']||0x3;this[_0x69cc('0x35')]=_0x47c70b[_0x69cc('0x35')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x47c70b['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x47c70b['dialNoSuchNumberRetryFrequency']||0x96;this[_0x69cc('0x36')]=_0x47c70b[_0x69cc('0x36')]||0x3;this[_0x69cc('0x37')]=_0x47c70b[_0x69cc('0x37')]||0x96;this['dialAbandonedMaxRetry']=_0x47c70b[_0x69cc('0x38')]||0x3;this[_0x69cc('0x39')]=_0x47c70b[_0x69cc('0x39')]||0x96;this[_0x69cc('0x3a')]=_0x47c70b['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x47c70b[_0x69cc('0x3b')]||0x96;this[_0x69cc('0x3c')]=_0x47c70b['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x47c70b[_0x69cc('0x3d')]||0x96;this[_0x69cc('0x3e')]=_0x47c70b[_0x69cc('0x3e')]||0x4;this[_0x69cc('0x3f')]=_0x47c70b[_0x69cc('0x3f')]?_0x47c70b[_0x69cc('0x3f')]:undefined;this[_0x69cc('0x40')]=_0x47c70b['TrunkBackup']?_0x47c70b[_0x69cc('0x40')]:undefined;this[_0x69cc('0x41')]=_0x47c70b[_0x69cc('0x41')]||undefined;this['Interval']=_0x47c70b[_0x69cc('0x42')]?_0x47c70b[_0x69cc('0x42')]:undefined;this[_0x69cc('0x43')]=_0x47c70b[_0x69cc('0x43')]||'DESC';this[_0x69cc('0x44')]=_0x47c70b[_0x69cc('0x44')]||undefined;this[_0x69cc('0x45')]=_0x47c70b['dialCutDigit']||undefined;this[_0x69cc('0x46')]=strategy[_0x47c70b[_0x69cc('0x46')]]||'rrmemory';this[_0x69cc('0x47')]=!![];this[_0x69cc('0x48')]=_0x47c70b[_0x69cc('0x48')]||![];this[_0x69cc('0x49')]=_0x47c70b[_0x69cc('0x49')];this['dialAMDGreeting']=_0x47c70b['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x47c70b['dialAMDAfterGreetingSilence'];this[_0x69cc('0x4a')]=_0x47c70b[_0x69cc('0x4a')];this[_0x69cc('0x4b')]=_0x47c70b[_0x69cc('0x4b')];this[_0x69cc('0x4c')]=_0x47c70b[_0x69cc('0x4c')];this[_0x69cc('0x4d')]=_0x47c70b[_0x69cc('0x4d')];this[_0x69cc('0x4e')]=_0x47c70b['dialAMDSilenceThreshold'];this[_0x69cc('0x4f')]=_0x47c70b[_0x69cc('0x4f')];this[_0x69cc('0x50')]=0x0;this[_0x69cc('0x51')]=0x0;this['timeout']=_0x47c70b[_0x69cc('0x52')];this[_0x69cc('0x53')]=0x0;this[_0x69cc('0x54')]=0x0;this[_0x69cc('0x55')]=0x0;this[_0x69cc('0x56')]=0x0;this[_0x69cc('0x57')]=0x0;this[_0x69cc('0x58')]=0x0;this[_0x69cc('0x59')]=0x0;this[_0x69cc('0x5a')]=0x0;this[_0x69cc('0x5b')]=0x0;this[_0x69cc('0x5c')]=0x0;this[_0x69cc('0x5d')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x69cc('0x5e')]=0x0;this[_0x69cc('0x5f')]=0x0;this[_0x69cc('0x60')]=undefined;this[_0x69cc('0x61')]=undefined;this[_0x69cc('0x62')]=undefined;this[_0x69cc('0x63')]=1.05;this[_0x69cc('0x64')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x69cc('0x65')]=0x0;this[_0x69cc('0x66')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x69cc('0x67')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x69cc('0x68')]=0x0;this['predictiveIntervalMaxThreshold']=_0x47c70b['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x69cc('0x69')]=_0x47c70b['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x69cc('0x6a')]=0x0;this[_0x69cc('0x6b')]=0x1;this[_0x69cc('0x6c')]=0x0;this['erlangCallToSecond']=0x0;this[_0x69cc('0x6d')]=0x0;this[_0x69cc('0x6e')]=0x0;this[_0x69cc('0x6f')]=_0x47c70b['dialRecallMeTimeout']||0x1e;this[_0x69cc('0x70')]=_0x47c70b[_0x69cc('0x70')]||![];this[_0x69cc('0x71')]=_0x47c70b[_0x69cc('0x71')]||undefined;this['dialAgiAfterHangupClient']=_0x47c70b[_0x69cc('0x72')]||![];this[_0x69cc('0x73')]=_0x47c70b[_0x69cc('0x73')]||![];this[_0x69cc('0xd')]=monitorFormat[_0x47c70b[_0x69cc('0xd')]]?monitorFormat[_0x47c70b[_0x69cc('0xd')]]:undefined;this[_0x69cc('0x74')]=_0x47c70b[_0x69cc('0x74')]||![];this['mandatoryDispositionPause']=_0x47c70b[_0x69cc('0x75')]?_0x47c70b['mandatoryDispositionPause']:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 5a553a9..74000f5 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 _0x14b4=['serverUrl','Configurations','username','accessKey','remoteUri'];(function(_0x49bd0e,_0x12b3c1){var _0x43d5c3=function(_0x5ed13b){while(--_0x5ed13b){_0x49bd0e['push'](_0x49bd0e['shift']());}};_0x43d5c3(++_0x12b3c1);}(_0x14b4,0x147));var _0x414b=function(_0x117b32,_0x3c2f57){_0x117b32=_0x117b32-0x0;var _0x31551c=_0x14b4[_0x117b32];return _0x31551c;};'use strict';function VtigerAccount(_0x41e8eb){this['id']=_0x41e8eb['id']||0x0;this['name']=_0x41e8eb['name']||'';this[_0x414b('0x0')]=_0x41e8eb[_0x414b('0x0')]||'';this[_0x414b('0x1')]=_0x41e8eb[_0x414b('0x1')]||'';this[_0x414b('0x2')]=_0x41e8eb['remoteUri']||'';this[_0x414b('0x3')]=_0x41e8eb[_0x414b('0x3')]||'';this[_0x414b('0x4')]=_0x41e8eb[_0x414b('0x4')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x2e17=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2e17,0x120));var _0x72e1=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x2e17[_0x47a349];return _0x18ab75;};'use strict';function VtigerAccount(_0x56c9ab){this['id']=_0x56c9ab['id']||0x0;this[_0x72e1('0x0')]=_0x56c9ab[_0x72e1('0x0')]||'';this[_0x72e1('0x1')]=_0x56c9ab[_0x72e1('0x1')]||'';this[_0x72e1('0x2')]=_0x56c9ab[_0x72e1('0x2')]||'';this[_0x72e1('0x3')]=_0x56c9ab[_0x72e1('0x3')]||'';this[_0x72e1('0x4')]=_0x56c9ab[_0x72e1('0x4')]||'';this[_0x72e1('0x5')]=_0x56c9ab['Configurations']||{};}module[_0x72e1('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 f5dcc17..37d5203 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(_0x4191af,_0x5783da){var _0x27bebf=function(_0x355be7){while(--_0x355be7){_0x4191af['push'](_0x4191af['shift']());}};_0x27bebf(++_0x5783da);}(_0x0b0e,0x187));var _0xe0b0=function(_0x17a32f,_0x5a51a){_0x17a32f=_0x17a32f-0x0;var _0x15a293=_0x0b0e[_0x17a32f];return _0x15a293;};'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 _0x5f66=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x1acc5e,_0x44b6ec){var _0x6aec44=function(_0x21395d){while(--_0x21395d){_0x1acc5e['push'](_0x1acc5e['shift']());}};_0x6aec44(++_0x44b6ec);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';function ZendeskAccount(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||'';this[_0x65f6('0x2')]=_0x253044[_0x65f6('0x2')]||'';this[_0x65f6('0x3')]=_0x253044['token']||'';this[_0x65f6('0x4')]=_0x253044['remoteUri']||'';this[_0x65f6('0x5')]=_0x253044[_0x65f6('0x5')]||'';this['type']=_0x253044['type']||_0x65f6('0x6');this[_0x65f6('0x7')]=_0x253044[_0x65f6('0x7')]||'';this[_0x65f6('0x8')]=_0x253044[_0x65f6('0x8')]||{};}module[_0x65f6('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index d808c90..f1dbff9 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 _0x21f8=['refreshToken','Configurations','exports','name','description','host','clientId','clientSecret','serverUrl','code'];(function(_0x72fa0,_0x1f81fd){var _0x1a2157=function(_0x38c05f){while(--_0x38c05f){_0x72fa0['push'](_0x72fa0['shift']());}};_0x1a2157(++_0x1f81fd);}(_0x21f8,0x71));var _0x821f=function(_0x1a87b3,_0x45ba68){_0x1a87b3=_0x1a87b3-0x0;var _0x37e84d=_0x21f8[_0x1a87b3];return _0x37e84d;};'use strict';function ZohoAccount(_0x4cc757){this['id']=_0x4cc757['id']||0x0;this[_0x821f('0x0')]=_0x4cc757[_0x821f('0x0')]||'';this[_0x821f('0x1')]=_0x4cc757[_0x821f('0x1')]||'';this[_0x821f('0x2')]=_0x4cc757[_0x821f('0x2')]||'';this['zone']=_0x4cc757['zone']||'';this['clientId']=_0x4cc757[_0x821f('0x3')]||'';this[_0x821f('0x4')]=_0x4cc757[_0x821f('0x4')]||'';this[_0x821f('0x5')]=_0x4cc757[_0x821f('0x5')]||'';this[_0x821f('0x6')]=_0x4cc757[_0x821f('0x6')]||'';this[_0x821f('0x7')]=_0x4cc757['refreshToken']||'';this['Configurations']=_0x4cc757[_0x821f('0x8')]||{};}module[_0x821f('0x9')]=ZohoAccount; \ No newline at end of file +var _0x2250=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x1e94ae,_0x2fe37a){var _0x261ef9=function(_0xc978a2){while(--_0xc978a2){_0x1e94ae['push'](_0x1e94ae['shift']());}};_0x261ef9(++_0x2fe37a);}(_0x2250,0x178));var _0x0225=function(_0x55c72d,_0x5d7876){_0x55c72d=_0x55c72d-0x0;var _0x3b64b6=_0x2250[_0x55c72d];return _0x3b64b6;};'use strict';function ZohoAccount(_0x2ea758){this['id']=_0x2ea758['id']||0x0;this[_0x0225('0x0')]=_0x2ea758[_0x0225('0x0')]||'';this[_0x0225('0x1')]=_0x2ea758[_0x0225('0x1')]||'';this[_0x0225('0x2')]=_0x2ea758[_0x0225('0x2')]||'';this['zone']=_0x2ea758[_0x0225('0x3')]||'';this[_0x0225('0x4')]=_0x2ea758[_0x0225('0x4')]||'';this[_0x0225('0x5')]=_0x2ea758[_0x0225('0x5')]||'';this[_0x0225('0x6')]=_0x2ea758[_0x0225('0x6')]||'';this[_0x0225('0x7')]=_0x2ea758['code']||'';this[_0x0225('0x8')]=_0x2ea758['refreshToken']||'';this['Configurations']=_0x2ea758[_0x0225('0x9')]||{};}module[_0x0225('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 c012491..f43f900 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 _0x19da=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','lodash','moment','isNil','string','uniqueid','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','active','calleridnum','scheduledat'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x19da,0xc7));var _0xa19d=function(_0x576d8a,_0x2d7bde){_0x576d8a=_0x576d8a-0x0;var _0x3dc3ef=_0x19da[_0x576d8a];return _0x3dc3ef;};'use strict';var util=require('util');var _=require(_0xa19d('0x0'));var moment=require(_0xa19d('0x1'));function checkNameSurname(_0x217599,_0x1514d5,_0x16fc17){var _0x39d4fb='';if(!_[_0xa19d('0x2')](_0x1514d5)&&_0xa19d('0x3')===typeof _0x1514d5){_0x39d4fb+=_0x1514d5;}if(!_[_0xa19d('0x2')](_0x16fc17)&&_0xa19d('0x3')===typeof _0x16fc17){_0x39d4fb+='\x20'+_0x16fc17;}if(_0x39d4fb!==''){return _0x39d4fb;}return _0x217599;}function Action(_0x118424,_0x69d211,_0x52bffa,_0x197ce,_0x4c43c7){this[_0xa19d('0x4')]=_0x52bffa||undefined;this['idContact']=_0x118424['id'];this['queue']=_0x69d211[_0xa19d('0x5')];this[_0xa19d('0x6')]=_0x69d211[_0xa19d('0x6')];this[_0xa19d('0x7')]='queue';this[_0xa19d('0x8')]=![];this[_0xa19d('0x9')]=_[_0xa19d('0x2')](_0x118424[_0xa19d('0xa')])?undefined:_0x118424[_0xa19d('0xa')][_0xa19d('0x5')];this[_0xa19d('0xb')]=this[_0xa19d('0x9')]?util[_0xa19d('0xc')](_0xa19d('0xd'),this['membername']):_0x197ce||undefined;this[_0xa19d('0xe')]=checkNameSurname(_0x118424[_0xa19d('0xf')][_0xa19d('0x10')],_0x118424[_0xa19d('0xf')][_0xa19d('0x11')],_0x118424[_0xa19d('0xf')]['lastName']);this[_0xa19d('0x12')]=_0x118424[_0xa19d('0x12')]||![];this[_0xa19d('0x13')]=_0x118424[_0xa19d('0xf')][_0xa19d('0x10')];this[_0xa19d('0x14')]=_0x118424[_0xa19d('0x14')];this[_0xa19d('0x15')]=_0x118424[_0xa19d('0x15')]||0x0;this['countcongestionretry']=_0x118424[_0xa19d('0x16')]||0x0;this[_0xa19d('0x17')]=_0x118424['countnoanswerretry']||0x0;this[_0xa19d('0x18')]=(_0x118424['countbusyretry']||0x0)+(_0x118424['countcongestionretry']||0x0)+(_0x118424[_0xa19d('0x17')]||0x0)+(_0x118424[_0xa19d('0x19')]||0x0)+(_0x118424['countdropretry']||0x0)+(_0x118424[_0xa19d('0x1a')]||0x0)+(_0x118424[_0xa19d('0x1b')]||0x0)+(_0x118424[_0xa19d('0x1c')]||0x0);this[_0xa19d('0x19')]=_0x118424[_0xa19d('0x19')]||0x0;this[_0xa19d('0x1d')]=_0x118424[_0xa19d('0x1d')]||0x0;this['countabandonedretry']=_0x118424[_0xa19d('0x1a')]||0x0;this[_0xa19d('0x1b')]=_0x118424[_0xa19d('0x1b')]||0x0;this['countagentrejectretry']=_0x118424[_0xa19d('0x1c')]||0x0;this['callback']=_0x118424[_0xa19d('0x1e')];this[_0xa19d('0x1f')]=_0x118424[_0xa19d('0x1f')];this[_0xa19d('0x20')]=_0x118424[_0xa19d('0x20')];this[_0xa19d('0x21')]=_0x118424[_0xa19d('0x21')];this[_0xa19d('0x22')]=_0x118424['ContactId'];this[_0xa19d('0x23')]=_0x118424['ListId'];this[_0xa19d('0x24')]=_['isNil'](_0x118424['Agent'])?_0x118424['UserId']:_0x118424[_0xa19d('0xa')]['id'];this[_0xa19d('0x25')]=_0x118424['VoiceQueueId'];this[_0xa19d('0x26')]='';this[_0xa19d('0x27')]='';}Action[_0xa19d('0x28')][_0xa19d('0x29')]=function(){return util['format'](_0xa19d('0x2a'),this[_0xa19d('0xe')],this[_0xa19d('0x2b')]);};module['exports']=Action; \ No newline at end of file +var _0x7552=['countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','exports','util','moment','isNil','string','queue','type','campaigntype','dialAnswer','membername','Agent','name','format','SIP/%s','calleridname','Contact','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x7552,0x8e));var _0x2755=function(_0x27497f,_0x52088e){_0x27497f=_0x27497f-0x0;var _0x29f35c=_0x7552[_0x27497f];return _0x29f35c;};'use strict';var util=require(_0x2755('0x0'));var _=require('lodash');var moment=require(_0x2755('0x1'));function checkNameSurname(_0x551952,_0x42c641,_0x33a70a){var _0x2b006a='';if(!_[_0x2755('0x2')](_0x42c641)&&_0x2755('0x3')===typeof _0x42c641){_0x2b006a+=_0x42c641;}if(!_[_0x2755('0x2')](_0x33a70a)&&_0x2755('0x3')===typeof _0x33a70a){_0x2b006a+='\x20'+_0x33a70a;}if(_0x2b006a!==''){return _0x2b006a;}return _0x551952;}function Action(_0x181388,_0x63b214,_0x2c7490,_0x31365d,_0x4f2d0b){this['uniqueid']=_0x2c7490||undefined;this['idContact']=_0x181388['id'];this[_0x2755('0x4')]=_0x63b214['name'];this[_0x2755('0x5')]=_0x63b214['type'];this[_0x2755('0x6')]=_0x2755('0x4');this[_0x2755('0x7')]=![];this[_0x2755('0x8')]=_[_0x2755('0x2')](_0x181388[_0x2755('0x9')])?undefined:_0x181388[_0x2755('0x9')][_0x2755('0xa')];this['channelAgent']=this['membername']?util[_0x2755('0xb')](_0x2755('0xc'),this[_0x2755('0x8')]):_0x31365d||undefined;this[_0x2755('0xd')]=checkNameSurname(_0x181388[_0x2755('0xe')]['phone'],_0x181388[_0x2755('0xe')]['firstName'],_0x181388[_0x2755('0xe')][_0x2755('0xf')]);this[_0x2755('0x10')]=_0x181388[_0x2755('0x10')]||![];this[_0x2755('0x11')]=_0x181388[_0x2755('0xe')]['phone'];this[_0x2755('0x12')]=_0x181388[_0x2755('0x12')];this[_0x2755('0x13')]=_0x181388['countbusyretry']||0x0;this[_0x2755('0x14')]=_0x181388[_0x2755('0x14')]||0x0;this[_0x2755('0x15')]=_0x181388[_0x2755('0x15')]||0x0;this[_0x2755('0x16')]=(_0x181388[_0x2755('0x13')]||0x0)+(_0x181388[_0x2755('0x14')]||0x0)+(_0x181388[_0x2755('0x15')]||0x0)+(_0x181388[_0x2755('0x17')]||0x0)+(_0x181388['countdropretry']||0x0)+(_0x181388[_0x2755('0x18')]||0x0)+(_0x181388[_0x2755('0x19')]||0x0)+(_0x181388[_0x2755('0x1a')]||0x0);this[_0x2755('0x17')]=_0x181388[_0x2755('0x17')]||0x0;this[_0x2755('0x1b')]=_0x181388[_0x2755('0x1b')]||0x0;this[_0x2755('0x18')]=_0x181388['countabandonedretry']||0x0;this['countmachineretry']=_0x181388[_0x2755('0x19')]||0x0;this[_0x2755('0x1a')]=_0x181388['countagentrejectretry']||0x0;this[_0x2755('0x1c')]=_0x181388[_0x2755('0x1c')];this[_0x2755('0x1d')]=_0x181388[_0x2755('0x1d')];this[_0x2755('0x1e')]=_0x181388[_0x2755('0x1e')];this[_0x2755('0x1f')]=_0x181388[_0x2755('0x1f')];this['ContactId']=_0x181388['ContactId'];this['ListId']=_0x181388[_0x2755('0x20')];this['UserId']=_[_0x2755('0x2')](_0x181388['Agent'])?_0x181388[_0x2755('0x21')]:_0x181388[_0x2755('0x9')]['id'];this[_0x2755('0x22')]=_0x181388[_0x2755('0x22')];this[_0x2755('0x23')]='';this[_0x2755('0x24')]='';}Action[_0x2755('0x25')]['getCaller']=function(){return util['format'](_0x2755('0x26'),this[_0x2755('0xd')],this[_0x2755('0x27')]);};module[_0x2755('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 492e861..39a682d 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 _0x14ce=['originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','dialend','syncDialEnd','newexten','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','outbound','answered','available','loggedIn','pTalking','sumDuration','talking','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','stringify','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','originated','sendMessageOneNotActive','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','prototype','syncCampaigns','hasOwnProperty','dialMethod','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','status','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','size','getContactRecallMe','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','catch','disableContact','starttime','format','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','answertime','\x20Queue','emit','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','total','[16]','Answer','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','uniqueid','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','AgentReject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','cause-txt','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','isEmpty','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','isActive','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','Action','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','lookAgent','logLookAgent','clone','responsetime','isFailure','response','unlockContact','idContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','transfer','[syncHangup][talking][cause]','destuniqueid','dialstatus','addVariable','variables','syncVarSet','filterKey','keys','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','../ami','./rpcDb','./util/util','redis','defaults','localhost','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels'];(function(_0x50dd2d,_0x2ed7d5){var _0x7b56fc=function(_0x48ce66){while(--_0x48ce66){_0x50dd2d['push'](_0x50dd2d['shift']());}};_0x7b56fc(++_0x2ed7d5);}(_0x14ce,0x129));var _0xe14c=function(_0x36451f,_0x17f580){_0x36451f=_0x36451f-0x0;var _0x184fc2=_0x14ce[_0x36451f];return _0x184fc2;};'use strict';var util=require('util');var _=require(_0xe14c('0x0'));var BPromise=require(_0xe14c('0x1'));var uuid=require(_0xe14c('0x2'));var moment=require(_0xe14c('0x3'));var md5=require(_0xe14c('0x4'));var Redis=require(_0xe14c('0x5'));var config=require(_0xe14c('0x6'));var logger=require(_0xe14c('0x7'))('preview');var loggerAction=require(_0xe14c('0x7'))('actionPreview');var ami=require(_0xe14c('0x8'));var rpcDb=require(_0xe14c('0x9'));var Action=require('./action');var ut=require(_0xe14c('0xa'));config[_0xe14c('0xb')]=_[_0xe14c('0xc')](config[_0xe14c('0xb')],{'host':_0xe14c('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe14c('0xb')]));var Sequence=function(){};Sequence['prototype'][_0xe14c('0xe')]=function(_0x432ef4){this[_0xe14c('0xf')]=this[_0xe14c('0xf')]?this[_0xe14c('0xf')][_0xe14c('0x10')](_0x432ef4):_0x432ef4();};function Preview(_0x425577){this[_0xe14c('0x11')]=new Sequence();this[_0xe14c('0x12')]=_0x425577['voiceQueues'];this[_0xe14c('0x13')]=_0x425577[_0xe14c('0x13')];this[_0xe14c('0x14')]={};this['agents']=_0x425577[_0xe14c('0x15')];this[_0xe14c('0x16')]=0x0;ami['on'](_0xe14c('0x17'),this[_0xe14c('0x18')][_0xe14c('0x19')](this));ami['on'](_0xe14c('0x1a'),this[_0xe14c('0x1b')][_0xe14c('0x19')](this));ami['on'](_0xe14c('0x1c'),this['syncHangupRequest']['bind'](this));ami['on'](_0xe14c('0x1d'),this[_0xe14c('0x1e')][_0xe14c('0x19')](this));ami['on'](_0xe14c('0x1f'),this[_0xe14c('0x20')][_0xe14c('0x19')](this));ami['on'](_0xe14c('0x21'),this['syncVarSet'][_0xe14c('0x19')](this));ami['on'](_0xe14c('0x22'),this[_0xe14c('0x23')][_0xe14c('0x19')](this));ami['on'](_0xe14c('0x24'),this[_0xe14c('0x25')][_0xe14c('0x19')](this));this[_0xe14c('0x26')](this[_0xe14c('0x12')]);}function emit(_0x3127ac,_0x1a58a9,_0x4238d5){io['to'](_0x3127ac)['emit'](_0x1a58a9,_0x4238d5);}function emitCampaignPreview(_0x43e23a){if(_0x43e23a[_0xe14c('0x27')]===_0xe14c('0x28')){var _0x378b7b={'id':_0x43e23a['id'],'name':_0x43e23a['name'],'strategy':_0x43e23a['strategy'],'answered':_0x43e23a[_0xe14c('0x29')],'available':_0x43e23a[_0xe14c('0x2a')],'loggedIn':_0x43e23a[_0xe14c('0x2b')],'pTalking':_0x43e23a[_0xe14c('0x2c')],'sumBillable':_0x43e23a['sumBillable'],'sumDuration':_0x43e23a[_0xe14c('0x2d')],'sumHoldTime':_0x43e23a['sumHoldTime']||0x0,'talking':_0x43e23a[_0xe14c('0x2e')],'total':_0x43e23a['total'],'type':_0x43e23a['type'],'unmanaged':_0x43e23a['unmanaged'],'abandoned':_0x43e23a[_0xe14c('0x2f')],'waiting':_0x43e23a[_0xe14c('0x30')],'loggedInDb':_0x43e23a[_0xe14c('0x31')],'dialActive':_0x43e23a[_0xe14c('0x32')],'dialMethod':_0x43e23a['dialMethod'],'dialOriginateCallerIdName':_0x43e23a[_0xe14c('0x33')],'dialOriginateCallerIdNumber':_0x43e23a[_0xe14c('0x34')],'dialOriginateTimeout':_0x43e23a['dialOriginateTimeout'],'dialPrefix':_0x43e23a[_0xe14c('0x35')],'outboundAnswerAgiCallsDay':_0x43e23a[_0xe14c('0x36')],'outboundAnswerCallsDay':_0x43e23a[_0xe14c('0x37')],'outboundBlacklistCallsDay':_0x43e23a[_0xe14c('0x38')],'outboundBusyCallsDay':_0x43e23a[_0xe14c('0x39')],'outboundCongestionCallsDay':_0x43e23a['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x43e23a[_0xe14c('0x3a')],'outboundDropCallsDayCallersExit':_0x43e23a[_0xe14c('0x3b')],'outboundDropCallsDayTimeout':_0x43e23a[_0xe14c('0x3c')],'outboundNoAnswerCallsDay':_0x43e23a[_0xe14c('0x3d')],'outboundNoSuchCallsDay':_0x43e23a[_0xe14c('0x3e')],'outboundOriginateFailureCallsDay':_0x43e23a['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x43e23a[_0xe14c('0x3f')],'outboundRejectCallsDay':_0x43e23a['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x43e23a['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x43e23a['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x43e23a[_0xe14c('0x40')],'predictiveIntervalAvgHoldtime':_0x43e23a[_0xe14c('0x41')],'predictiveIntervalAvgTalktime':_0x43e23a[_0xe14c('0x42')],'predictiveIntervalDroppedCallsCallersExit':_0x43e23a[_0xe14c('0x43')],'predictiveIntervalDroppedCallsTimeout':_0x43e23a['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x43e23a['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x43e23a['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x43e23a[_0xe14c('0x44')],'predictiveIntervalMultiplicativeFactor':_0x43e23a['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x43e23a['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x43e23a[_0xe14c('0x45')],'predictiveIntervalTotalCalls':_0x43e23a[_0xe14c('0x46')],'message':_0x43e23a[_0xe14c('0x47')],'originated':_0x43e23a['originated'],'erlangCalls':_0x43e23a['erlangCalls'],'erlangCallToSecond':_0x43e23a[_0xe14c('0x48')],'erlangAbandonmentRate':_0x43e23a[_0xe14c('0x49')],'erlangBusyFactor':_0x43e23a[_0xe14c('0x4a')],'startPredictive':_0x43e23a[_0xe14c('0x4b')],'startProgressive':_0x43e23a[_0xe14c('0x4c')]};if(_0x43e23a[_0xe14c('0x4d')]){_0x378b7b['Trunk']={'id':_0x43e23a[_0xe14c('0x4d')]['id'],'name':_0x43e23a[_0xe14c('0x4d')][_0xe14c('0x4e')],'active':_0x43e23a[_0xe14c('0x4d')][_0xe14c('0x4f')],'callerid':_0x43e23a['Trunk'][_0xe14c('0x50')]};}if(_0x43e23a[_0xe14c('0x51')]){_0x378b7b[_0xe14c('0x51')]={'id':_0x43e23a[_0xe14c('0x51')]['id'],'name':_0x43e23a[_0xe14c('0x51')][_0xe14c('0x4e')]};}var _0xf0a615=md5(JSON[_0xe14c('0x52')](_0x378b7b));if(_0x43e23a['md5']!==_0xf0a615){_0x43e23a[_0xe14c('0x4')]=_0xf0a615;emit(util['format'](_0xe14c('0x53'),_0x378b7b[_0xe14c('0x4e')]),'voice_queue:save',_0x378b7b);}}}function emitVoiceQueueChannelRemove(_0x33ef03){logger[_0xe14c('0x54')](_0xe14c('0x55'),JSON[_0xe14c('0x52')](_0x33ef03));emit(util['format'](_0xe14c('0x53'),_0x33ef03[_0xe14c('0x4e')]),'voice_queue_channel:remove',_0x33ef03);}function notSendMessagesQueue(_0x1883d3){if(_0x1883d3['sendMessageOneNotActive']){if(_0x1883d3[_0xe14c('0x56')]===0x0&&_0x1883d3[_0xe14c('0x2c')]===0x0){_0x1883d3[_0xe14c('0x57')]=![];_0x1883d3[_0xe14c('0x2a')]=0x0;_0x1883d3['paused']=0x0;_0x1883d3['message']=_0xe14c('0x58');ut[_0xe14c('0x59')](_0xe14c('0x5a'),_0x1883d3['name']+_0xe14c('0x5b'));}else{_0x1883d3[_0xe14c('0x47')]=_0xe14c('0x5c');ut['logger'](_0xe14c('0x5a'),_0x1883d3[_0xe14c('0x4e')]+'\x20is\x20disactive');}emitCampaignPreview(_0x1883d3);}}Preview[_0xe14c('0x5d')][_0xe14c('0x26')]=function(){var _0x5730f1=this;setInterval(function(){_0x5730f1[_0xe14c('0x5e')]();},0x7cf);};Preview[_0xe14c('0x5d')][_0xe14c('0x5e')]=function(){var _0x26a83d=this[_0xe14c('0x12')];this[_0xe14c('0x16')]+=0x1;for(var _0xc5ffc7 in _0x26a83d){if(_0x26a83d[_0xe14c('0x5f')](_0xc5ffc7)&&(_0x26a83d[_0xc5ffc7]['dialMethod']==='preview'||_0x26a83d[_0xc5ffc7][_0xe14c('0x60')]==='booked')&&_0x26a83d[_0xc5ffc7][_0xe14c('0x27')]==='outbound'){if(this[_0xe14c('0x16')]>0x7){this[_0xe14c('0x16')]=0x0;this[_0xe14c('0x61')]();}}if(_0x26a83d[_0xe14c('0x5f')](_0xc5ffc7)&&_0x26a83d[_0xc5ffc7][_0xe14c('0x60')]==='preview'&&_0x26a83d[_0xc5ffc7][_0xe14c('0x27')]==='outbound'){if(_0x26a83d[_0xc5ffc7][_0xe14c('0x32')]){this[_0xe14c('0x62')](_0x26a83d[_0xc5ffc7]);this[_0xe14c('0x63')](_0x26a83d[_0xc5ffc7]);}else{notSendMessagesQueue(_0x26a83d[_0xc5ffc7]);}}}};Preview['prototype'][_0xe14c('0x64')]=function(_0x233bf7){var _0x2a5fb9=this;this[_0xe14c('0x11')][_0xe14c('0xe')](function(){if(!_[_0xe14c('0x65')](_0x2a5fb9[_0xe14c('0x14')][_0x233bf7])){loggerAction['info'](_0xe14c('0x66'),_0x233bf7,_0xe14c('0x67'),_0x2a5fb9['actions'][_0x233bf7][_0xe14c('0x68')],'originated:\x20',JSON['stringify'](_0x2a5fb9[_0xe14c('0x12')][_0x2a5fb9[_0xe14c('0x14')][_0x233bf7]['queue']][_0xe14c('0x56')]),_0xe14c('0x69'),JSON['stringify'](_0x2a5fb9['campaignsPreview'][_0x2a5fb9[_0xe14c('0x14')][_0x233bf7][_0xe14c('0x68')]][_0xe14c('0x2c')]),JSON['stringify'](_0x2a5fb9[_0xe14c('0x14')][_0x233bf7][_0xe14c('0x6a')]),JSON[_0xe14c('0x52')](_[_0xe14c('0x6b')](_0x2a5fb9[_0xe14c('0x14')][_0x233bf7],['contactId',_0xe14c('0x6c'),_0xe14c('0x6d'),'ListId'])));return ami['Action']({'action':_0xe14c('0x6e'),'channel':_0x2a5fb9[_0xe14c('0x14')][_0x233bf7]['channel']})['catch'](function(_0x405e1b){if(_0x405e1b[_0xe14c('0x47')]===_0xe14c('0x6f')){setTimeout(function(){if(_0x2a5fb9['actions'][_0x233bf7]){ut[_0xe14c('0x70')](_0x2a5fb9['campaignsPreview'][_0x2a5fb9[_0xe14c('0x14')][_0x233bf7][_0xe14c('0x68')]],_0xe14c('0x71'));if(_0x2a5fb9[_0xe14c('0x14')][_0x233bf7][_0xe14c('0x6a')]===!![]){ut[_0xe14c('0x72')](_0x2a5fb9[_0xe14c('0x12')][_0x2a5fb9[_0xe14c('0x14')][_0x233bf7][_0xe14c('0x68')]],_0xe14c('0x71'));ut[_0xe14c('0x73')](_0xe14c('0x74')+_0x233bf7,_0x2a5fb9[_0xe14c('0x14')][_0x233bf7][_0xe14c('0x68')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x233bf7,_0x2a5fb9[_0xe14c('0x14')][_0x233bf7][_0xe14c('0x68')]);delete _0x2a5fb9[_0xe14c('0x14')][_0x233bf7];}},0x2328);}});}});};Preview[_0xe14c('0x5d')]['clearZombieChannels']=function(){var _0x303430=this;loggerAction[_0xe14c('0x54')]('[action]',_[_0xe14c('0x75')](this[_0xe14c('0x14')]));for(var _0x4e48e7 in this[_0xe14c('0x14')]){if(_0x303430[_0xe14c('0x14')][_0xe14c('0x5f')](_0x4e48e7)){_0x303430[_0xe14c('0x64')](_0x4e48e7);}}};Preview[_0xe14c('0x5d')][_0xe14c('0x63')]=function(_0x53d64c){var _0x1ed0d7=this;rpcDb[_0xe14c('0x76')](_0x53d64c['id'],ut['agentReadyId'](this['agents']))[_0xe14c('0x77')](function(_0x5cb86d){if(!_[_0xe14c('0x65')](_0x5cb86d)){for(var _0x1ab246=0x0;_0x1ab246<_0x5cb86d[_0xe14c('0x78')];_0x1ab246+=0x1){if(ut[_0xe14c('0x79')](_0x5cb86d[_0x1ab246][_0xe14c('0x7a')])<_0x53d64c[_0xe14c('0x7b')]*0x3c){if(_0x5cb86d[_0x1ab246][_0xe14c('0x7c')]&&!_0x5cb86d[_0x1ab246][_0xe14c('0x7c')]['voicePause']){_0x1ed0d7[_0xe14c('0x7d')](_0x5cb86d[_0x1ab246]['id'])[_0xe14c('0x77')](ut[_0xe14c('0x7e')](_0xe14c('0x7f')))[_0xe14c('0x80')](ut[_0xe14c('0x7e')](_0xe14c('0x7f')));}else{rpcDb[_0xe14c('0x81')](_0x5cb86d[_0x1ab246]['id']);}}else{var _0x1508a8=new Action(_0x5cb86d[_0x1ab246],_0x53d64c);_0x1508a8[_0xe14c('0x82')]=moment()[_0xe14c('0x83')](_0xe14c('0x84'));_0x53d64c['outboundReCallsDay']+=0x1;ut[_0xe14c('0x85')](_0x1508a8,0x17,_0xe14c('0x86'));if(_0x53d64c[_0xe14c('0x87')]){rpcDb['rescheduleContactInQueue'](ut[_0xe14c('0x88')](_0x5cb86d[_0x1ab246]));rpcDb['createCustomerHistory'](_0x1508a8,_0xe14c('0x89'));}else{ut['logCustomer'](_0x1508a8,0x16,'RecallFailedTimeout');rpcDb[_0xe14c('0x8a')](_0x1508a8,_0xe14c('0x8b'));rpcDb[_0xe14c('0x8c')](_0x1508a8,_0xe14c('0x8b'));}}}}})[_0xe14c('0x80')](ut[_0xe14c('0x7e')](_0xe14c('0x8d')));};Preview['prototype'][_0xe14c('0x62')]=function(_0x2e0ff0){_0x2e0ff0[_0xe14c('0x57')]=!![];if(ut[_0xe14c('0x8e')](_0x2e0ff0[_0xe14c('0x2b')])){_0x2e0ff0['message']=_0xe14c('0x8f');}else if(!ut['isActive'](_0x2e0ff0[_0xe14c('0x32')])){_0x2e0ff0[_0xe14c('0x47')]=_0xe14c('0x58');}else if(!this[_0xe14c('0x90')](_0x2e0ff0['Trunk'])){if(!this['isTrunkReachable'](_0x2e0ff0['TrunkBackup'])){_0x2e0ff0['message']=_0xe14c('0x91');}else{_0x2e0ff0['message']='ACTIVE';}}else{_0x2e0ff0[_0xe14c('0x47')]=_0xe14c('0x92');}emitCampaignPreview(_0x2e0ff0);};Preview[_0xe14c('0x5d')][_0xe14c('0x93')]=function(_0x14fae1,_0x209a45,_0x8ccf14){var _0x36689b=this;var _0x52ee69=this[_0xe14c('0x14')][_0x209a45];var _0x5b4fa4=this[_0xe14c('0x12')][_0x52ee69['queue']];var _0x3ffc64;if(_0x5b4fa4){switch(_0x8ccf14){case'1':_0x5b4fa4['outboundNoSuchCallsDay']+=0x1;_0x52ee69[_0xe14c('0x94')]+=0x1;_0x52ee69[_0xe14c('0x95')]=ut[_0xe14c('0x96')](_0x52ee69);ut[_0xe14c('0x85')](_0x52ee69,0x0,_0xe14c('0x97'));ami['emit'](_0xe14c('0x98'),ut['buildObj'](_0x52ee69,_0xe14c('0x99')));rpcDb[_0xe14c('0x8a')](_0x52ee69,_0xe14c('0x9a'));if(ut[_0xe14c('0x96')](_0x52ee69)>=_0x5b4fa4[_0xe14c('0x9b')]){_0x3ffc64=ut[_0xe14c('0x9c')](_0x52ee69,0xf,_0xe14c('0x9d'));rpcDb[_0xe14c('0x8c')](_0x3ffc64,_0xe14c('0x9e'));}else{if(_0x52ee69[_0xe14c('0x94')]>=_0x5b4fa4[_0xe14c('0x9f')]){rpcDb['createCustomerFinal'](_0x52ee69,_0xe14c('0x9e'));}else{rpcDb[_0xe14c('0xa0')](ut['scheduledAt'](_0x52ee69,'countnosuchnumberretry',_0x5b4fa4[_0xe14c('0xa1')]),_0x52ee69['unlockAgent'],_0x52ee69[_0xe14c('0xa2')]);}}delete this[_0xe14c('0x14')][_0x14fae1[_0xe14c('0xa3')]];break;case _0xe14c('0xa4'):var _0x2ba33a=moment()['format'](_0xe14c('0x84'));_0x52ee69['responsetime']=_0x2ba33a;_0x52ee69[_0xe14c('0xa5')]=_0x2ba33a;_0x52ee69[_0xe14c('0x6a')]=!![];_0x5b4fa4[_0xe14c('0x2c')]+=0x1;logger['info']('[syncHangup][talking][increment]',_0x52ee69['uniqueid'],_0xe14c('0xa6'),_0x5b4fa4[_0xe14c('0x4e')],_0xe14c('0x69'),_0x5b4fa4[_0xe14c('0x2c')]);ami[_0xe14c('0xa7')](_0xe14c('0xa8'),ut[_0xe14c('0xa9')](_0x52ee69,_0xe14c('0xaa')));if(_0x5b4fa4[_0xe14c('0xab')]){ami[_0xe14c('0xa7')](_0xe14c('0xac'),ut[_0xe14c('0xad')](_0x52ee69));}break;case'16':ami[_0xe14c('0xa7')](_0xe14c('0xae'),ut[_0xe14c('0xa9')](_0x52ee69,_0xe14c('0xaf')));emitVoiceQueueChannelRemove(ut[_0xe14c('0xa9')](_0x52ee69,_0xe14c('0xaf')));_0x5b4fa4[_0xe14c('0x37')]+=0x1;_0x5b4fa4[_0xe14c('0xb0')]+=0x1;_0x5b4fa4[_0xe14c('0x29')]+=0x1;ut[_0xe14c('0x72')](_0x5b4fa4,_0xe14c('0xb1'));_0x52ee69[_0xe14c('0x95')]=ut[_0xe14c('0x96')](_0x52ee69);ut[_0xe14c('0x85')](_0x52ee69,0x4,_0xe14c('0xb2'));rpcDb['createCustomerHistory'](_0x52ee69,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xe14c('0x8c')](_0x52ee69,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xe14c('0xb3')](_0x52ee69);_0x5b4fa4[_0xe14c('0x2d')]+=_0x52ee69['talktime'];_0x5b4fa4['sumBillable']+=_0x52ee69[_0xe14c('0xb4')];logger[_0xe14c('0x54')](_0xe14c('0xb5'),_0x52ee69[_0xe14c('0xb6')],_0xe14c('0xa6'),_0x5b4fa4[_0xe14c('0x4e')],_0xe14c('0x69'),_0x5b4fa4[_0xe14c('0x2c')]);delete this['actions'][_0x14fae1[_0xe14c('0xa3')]];break;case'BUSY':_0x5b4fa4[_0xe14c('0x39')]+=0x1;_0x52ee69[_0xe14c('0xb7')]+=0x1;_0x52ee69['countglobal']=ut[_0xe14c('0x96')](_0x52ee69);ut[_0xe14c('0x85')](_0x52ee69,0x5,_0xe14c('0xb8'));ami[_0xe14c('0xa7')](_0xe14c('0xb9'),ut[_0xe14c('0xa9')](_0x52ee69,'busy'));rpcDb[_0xe14c('0x8a')](_0x52ee69,_0xe14c('0xba'));if(ut[_0xe14c('0x96')](_0x52ee69)>=_0x5b4fa4[_0xe14c('0x9b')]){_0x3ffc64=ut['cloneAction'](_0x52ee69,0xf,_0xe14c('0x9d'));rpcDb[_0xe14c('0x8c')](_0x3ffc64,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x52ee69[_0xe14c('0xb7')]>=_0x5b4fa4[_0xe14c('0xbb')]){rpcDb['createCustomerFinal'](_0x52ee69,_0xe14c('0xba'));}else{rpcDb['rescheduleContact'](ut[_0xe14c('0xbc')](_0x52ee69,_0xe14c('0xb7'),_0x5b4fa4[_0xe14c('0xbd')]),_0x52ee69[_0xe14c('0xbe')],_0x52ee69['activeContact']);}}break;case _0xe14c('0xbf'):_0x5b4fa4[_0xe14c('0x3d')]+=0x1;_0x52ee69[_0xe14c('0xc0')]+=0x1;_0x52ee69['countglobal']=ut[_0xe14c('0x96')](_0x52ee69);ut[_0xe14c('0x85')](_0x52ee69,0x3,'NoAnswer');ami[_0xe14c('0xa7')](_0xe14c('0xc1'),ut[_0xe14c('0xa9')](_0x52ee69,'noanswer'));rpcDb[_0xe14c('0x8a')](_0x52ee69,_0xe14c('0xc2'));if(ut[_0xe14c('0x96')](_0x52ee69)>=_0x5b4fa4['dialGlobalMaxRetry']){_0x3ffc64=ut[_0xe14c('0x9c')](_0x52ee69,0xf,_0xe14c('0x9d'));rpcDb[_0xe14c('0x8c')](_0x3ffc64,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x52ee69[_0xe14c('0xc0')]>=_0x5b4fa4[_0xe14c('0xc3')]){rpcDb['createCustomerFinal'](_0x52ee69,_0xe14c('0xc2'));}else{rpcDb[_0xe14c('0xa0')](ut[_0xe14c('0xbc')](_0x52ee69,_0xe14c('0xc0'),_0x5b4fa4[_0xe14c('0xc4')]),_0x52ee69[_0xe14c('0xbe')],_0x52ee69[_0xe14c('0xa2')]);}}break;case'CONGESTION':_0x5b4fa4['outboundCongestionCallsDay']+=0x1;_0x52ee69['countcongestionretry']+=0x1;_0x52ee69[_0xe14c('0x95')]=ut[_0xe14c('0x96')](_0x52ee69);ut[_0xe14c('0x85')](_0x52ee69,0x8,_0xe14c('0xc5'));ami[_0xe14c('0xa7')](_0xe14c('0xc6'),ut['buildObj'](_0x52ee69,_0xe14c('0xc7')));rpcDb['createCustomerHistory'](_0x52ee69,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0xe14c('0x96')](_0x52ee69)>=_0x5b4fa4[_0xe14c('0x9b')]){_0x3ffc64=ut[_0xe14c('0x9c')](_0x52ee69,0xf,_0xe14c('0x9d'));rpcDb[_0xe14c('0x8c')](_0x3ffc64,_0xe14c('0xc8'));}else{if(_0x52ee69[_0xe14c('0xc9')]>=_0x5b4fa4['dialCongestionMaxRetry']){rpcDb[_0xe14c('0x8c')](_0x52ee69,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xe14c('0xa0')](ut[_0xe14c('0xbc')](_0x52ee69,_0xe14c('0xc9'),_0x5b4fa4[_0xe14c('0xbd')]),_0x52ee69['unlockAgent'],_0x52ee69[_0xe14c('0xa2')]);}}break;case'CANCEL':_0x5b4fa4['outboundRejectCallsDay']+=0x1;_0x52ee69['countagentrejectretry']+=0x1;_0x52ee69[_0xe14c('0x95')]=ut[_0xe14c('0x96')](_0x52ee69);ut[_0xe14c('0x85')](_0x52ee69,0x14,_0xe14c('0xca'));ami[_0xe14c('0xa7')]('custom:agentreject',ut[_0xe14c('0xa9')](_0x52ee69,_0xe14c('0xcb')));rpcDb[_0xe14c('0x8a')](_0x52ee69,_0xe14c('0xcc'));if(ut[_0xe14c('0x96')](_0x52ee69)>=_0x5b4fa4[_0xe14c('0x9b')]){_0x3ffc64=ut[_0xe14c('0x9c')](_0x52ee69,0x14,_0xe14c('0xca'));rpcDb[_0xe14c('0x8c')](_0x3ffc64,_0xe14c('0xcd'));}else{if(_0x52ee69[_0xe14c('0xce')]>=_0x5b4fa4[_0xe14c('0xcf')]){rpcDb[_0xe14c('0x8c')](_0x52ee69,_0xe14c('0xcd'));}else{rpcDb[_0xe14c('0xa0')](ut['scheduledAt'](_0x52ee69,_0xe14c('0xce'),_0x5b4fa4[_0xe14c('0xd0')]),_0x52ee69[_0xe14c('0xbe')],_0x52ee69[_0xe14c('0xa2')]);}}break;case'ABANDONED':_0x5b4fa4[_0xe14c('0xd1')]+=0x1;_0x52ee69[_0xe14c('0xd2')]+=0x1;_0x52ee69['countglobal']=ut[_0xe14c('0x96')](_0x52ee69);ut[_0xe14c('0x85')](_0x52ee69,0xb,_0xe14c('0xd3'));rpcDb[_0xe14c('0x8a')](_0x52ee69,'[callProgressDetectingCustomer][logAbandoned]');if(ut['totalGlobal'](_0x52ee69)>=_0x5b4fa4[_0xe14c('0x9b')]){_0x3ffc64=ut[_0xe14c('0x9c')](_0x52ee69,0xf,_0xe14c('0x9d'));rpcDb['createCustomerFinal'](_0x3ffc64,_0xe14c('0xd4'));}else{if(_0x52ee69[_0xe14c('0xd5')]>=_0x5b4fa4[_0xe14c('0xd6')]){rpcDb[_0xe14c('0x8c')](_0x52ee69,_0xe14c('0xd4'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x52ee69,_0xe14c('0xd2'),_0x5b4fa4['dialAbandonedRetryFrequency']),_0x52ee69['unlockAgent'],_0x52ee69[_0xe14c('0xa2')]);}}break;default:if(_0x52ee69['dialAnswer']){ut[_0xe14c('0x72')](_0x5b4fa4,'[default]');ut[_0xe14c('0x73')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x5b4fa4['name'],_0x14fae1);}_0x5b4fa4[_0xe14c('0xd7')]+=0x1;_0x52ee69[_0xe14c('0x95')]=ut[_0xe14c('0x96')](_0x52ee69);ut[_0xe14c('0x85')](_0x52ee69,0xc,_0x14fae1[_0xe14c('0xd8')]||_0x14fae1['dialstatus']);rpcDb['createCustomerHistory'](_0x52ee69,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0xe14c('0x96')](_0x52ee69)>=_0x5b4fa4['dialGlobalMaxRetry']){_0x3ffc64=ut[_0xe14c('0x9c')](_0x52ee69,0xf,_0xe14c('0x9d'));rpcDb[_0xe14c('0x8c')](_0x3ffc64,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xe14c('0x8c')](_0x52ee69,_0xe14c('0xd9'));}delete this[_0xe14c('0x14')][_0x14fae1[_0xe14c('0xa3')]];}if(!(_0x52ee69[_0xe14c('0x6a')]&&_0x8ccf14==='16')){ut['updateOriginated'](_0x5b4fa4,_0xe14c('0xda'));logger[_0xe14c('0x54')](_0xe14c('0xdb'),_0x52ee69[_0xe14c('0xb6')],_0xe14c('0xa6'),_0x5b4fa4[_0xe14c('0x4e')],_0xe14c('0xdc'),_0x5b4fa4[_0xe14c('0x56')]);}if(_0x8ccf14!==_0xe14c('0xa4')){delete this[_0xe14c('0x14')][_0x14fae1[_0xe14c('0xa3')]];delete this[_0xe14c('0x14')][_0x14fae1[_0xe14c('0xdd')]];}}};Preview[_0xe14c('0x5d')][_0xe14c('0xde')]=function(_0x5d3266,_0x46a08a,_0x30ef6c){if(_[_0xe14c('0xdf')](_0x46a08a)&&_0xe14c('0xe0')!==typeof _0x46a08a){return;}if(_[_0xe14c('0xdf')](_0x30ef6c)&&_0xe14c('0xe0')!==typeof _0x30ef6c){return;}switch(_0x30ef6c[_0xe14c('0xe1')]){case'0':ut[_0xe14c('0xe2')](_0x5d3266,0x0,_0xe14c('0x97'));rpcDb['createAgentHistory'](_0x5d3266,_0xe14c('0xe3'));break;case'3':ut[_0xe14c('0xe2')](_0x5d3266,0x3,_0xe14c('0xe4'));rpcDb[_0xe14c('0xe5')](_0x5d3266,_0xe14c('0xe6'));break;case'5':ut[_0xe14c('0xe2')](_0x5d3266,0x5,_0xe14c('0xb8'));rpcDb[_0xe14c('0xe5')](_0x5d3266,_0xe14c('0xe7'));break;case'8':ut[_0xe14c('0xe2')](_0x5d3266,0x8,_0xe14c('0xc5'));rpcDb[_0xe14c('0xe5')](_0x5d3266,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xe14c('0xe2')](_0x5d3266,0x16,_0xe14c('0xe8'));rpcDb['createAgentHistory'](_0x5d3266,_0xe14c('0xe9'));break;default:ut['logAgent'](_0x5d3266,0xc,_0x30ef6c[_0xe14c('0xe1')]);rpcDb[_0xe14c('0xe5')](_0x5d3266,_0xe14c('0xea'));}ut[_0xe14c('0x70')](_0x46a08a,_0xe14c('0xeb'));logger[_0xe14c('0x54')](_0xe14c('0xec'),_0x5d3266['uniqueid'],_0xe14c('0xa6'),_0x46a08a[_0xe14c('0x4e')],_0xe14c('0xdc'),_0x46a08a[_0xe14c('0x56')]);delete this['actions'][_0x5d3266[_0xe14c('0xb6')]];};Preview['prototype'][_0xe14c('0xed')]=function(_0x2cf88d,_0x32936e,_0x29bde1,_0x4d40a4,_0x1a87b2){var _0x4a3a80=this;return new BPromise(function(_0x4cb78a,_0x50c765){if(_[_0xe14c('0x65')](_0x32936e)||_['isNil'](_0x32936e['Contact'])||_[_0xe14c('0x65')](_0x32936e[_0xe14c('0xee')][_0xe14c('0xef')])||_[_0xe14c('0x65')](_0x32936e[_0xe14c('0x6d')])){_0x50c765(ut[_0xe14c('0x47')](_0xe14c('0xf0'),_0x4d40a4,_0x1a87b2));return;}var _0x16e350=uuid['v4']();var _0x3ee7dc=_0x4a3a80[_0xe14c('0x12')][_0x32936e[_0xe14c('0x67')]['name']];var _0x4aed13=_0x29bde1?_0x4a3a80[_0xe14c('0x15')][_0x29bde1]['id']:undefined;_0x4a3a80[_0xe14c('0x14')][_0x16e350]=new Action(_0x32936e,_0x3ee7dc,_0x16e350,_0x29bde1,_0x4aed13);var _0x14d226=_0x4a3a80[_0xe14c('0x14')][_0x16e350];_0x14d226['unlockAgent']=_0x4d40a4;_0x14d226['activeContact']=_0x1a87b2;_0x14d226['lookAgent']=_0x29bde1;if(_['isEmpty'](_0x2cf88d)){_0x4a3a80[_0xe14c('0xf1')](_0x14d226,_0x3ee7dc,_0x32936e,_0x29bde1)['then'](function(_0x26daab){logger[_0xe14c('0x54')]('[Preview][execCall][success]',_0xe14c('0xf2')+_0x14d226[_0xe14c('0x68')]+_0xe14c('0xf3')+_0x14d226['idContact'],JSON[_0xe14c('0x52')](_0x26daab));ami[_0xe14c('0xa7')](_0xe14c('0xf4'),ut['buildObj'](_0x14d226,_0xe14c('0xf5')));_0x4cb78a(ut[_0xe14c('0x47')](_0xe14c('0xf6')));})['catch'](function(_0x12a5c4){ut['logger'](_0xe14c('0xf7'),_0x12a5c4);_0x50c765(ut['message'](_0xe14c('0xf8'),_0x4d40a4,_0x1a87b2));});}else{_0x3ee7dc[_0xe14c('0x38')]+=0x1;ut['logBlacklist'](_0x14d226);rpcDb[_0xe14c('0xf9')](_0x14d226,_0xe14c('0xfa'));delete _0x4a3a80[_0xe14c('0x14')][_0x16e350];_0x50c765(ut[_0xe14c('0x47')]('Contact\x20in\x20black\x20List',_0x4d40a4,_0x1a87b2));}});};Preview[_0xe14c('0x5d')][_0xe14c('0x90')]=function(_0x59ae32){return!_['isNil'](_0x59ae32)&&!_[_0xe14c('0x65')](_0x59ae32[_0xe14c('0x4e')])&&!_[_0xe14c('0x65')](_0x59ae32[_0xe14c('0x4f')])&&_0x59ae32[_0xe14c('0x4f')]&&!_['isNil'](this[_0xe14c('0x13')][util[_0xe14c('0x83')](_0xe14c('0xfb'),_0x59ae32[_0xe14c('0x4e')])])&&!_[_0xe14c('0x65')](this[_0xe14c('0x13')][util[_0xe14c('0x83')](_0xe14c('0xfb'),_0x59ae32[_0xe14c('0x4e')])][_0xe14c('0x6e')])&&(this[_0xe14c('0x13')][util[_0xe14c('0x83')]('SIP/%s',_0x59ae32[_0xe14c('0x4e')])][_0xe14c('0x6e')]===_0xe14c('0xfc')||this[_0xe14c('0x13')][util['format'](_0xe14c('0xfb'),_0x59ae32['name'])]['status']===_0xe14c('0xfd'));};Preview[_0xe14c('0x5d')]['run']=function(_0x3ce561,_0x48090f){var _0x22f618=this;return new BPromise(function(_0x596fc7,_0xe573b7){_0x22f618[_0xe14c('0xfe')](_0x3ce561,_0x48090f)[_0xe14c('0x77')](function(_0x3c1eaf){_0x596fc7(_[_0xe14c('0x6b')](_0x3c1eaf,[_0xe14c('0x47')]));})[_0xe14c('0x80')](function(_0xc4c4d3){if(_0xc4c4d3[_0xe14c('0xff')]){rpcDb['unlockContact'](_0x3ce561);}if(_0xc4c4d3['active']){rpcDb[_0xe14c('0x81')](_0x3ce561);}_0xe573b7(_[_0xe14c('0x6b')](_0xc4c4d3,[_0xe14c('0x47')]));});});};Preview[_0xe14c('0x5d')][_0xe14c('0xfe')]=function(_0x848fdb,_0x28ad2b){var _0x11963e=this;return new BPromise(function(_0x5165ee,_0x48ee1c){var _0xa5117,_0x516938;rpcDb[_0xe14c('0x100')](_0x848fdb)[_0xe14c('0x77')](function(_0x1e4758){if(!_['isNil'](_0x1e4758[0x0])){_0x516938=_0x1e4758[0x0]['recallme']?![]:!![];_0xa5117=_0x1e4758[0x0][_0xe14c('0x101')]?!![]:![];_0xa5117=_0x28ad2b?!![]:_0xa5117;}var _0x14012e=_0x11963e[_0xe14c('0x102')](_0x1e4758);if(_0x14012e['isValid']){rpcDb[_0xe14c('0x103')](_['pick'](_0x1e4758[0x0],[_0xe14c('0x6d'),_0xe14c('0x104')]))[_0xe14c('0x77')](function(_0x559b86){_0x11963e[_0xe14c('0xed')](_0x559b86,_0x1e4758[0x0],_0x28ad2b,_0x516938,_0xa5117)[_0xe14c('0x77')](function(_0xbe4dcc){_0x5165ee(_0xbe4dcc);})[_0xe14c('0x80')](function(_0x4e6fcc){_0x48ee1c(_0x4e6fcc);});})[_0xe14c('0x80')](function(_0x2b49cf){ut['logger'](_0xe14c('0x105'),_0x2b49cf);_0x48ee1c(ut[_0xe14c('0x47')]('Call\x20unsuccessful',_0x516938,_0xa5117));});}else{_0x48ee1c(ut[_0xe14c('0x47')](_0x14012e[_0xe14c('0x47')],_0x516938,_0xa5117));}})[_0xe14c('0x80')](function(_0x636e4c){ut[_0xe14c('0x59')]('[Preview][getContactPreview]',_0x636e4c);_0x48ee1c(ut[_0xe14c('0x47')](_0xe14c('0x106'),![],!![]));});});};Preview[_0xe14c('0x5d')][_0xe14c('0x102')]=function(_0x49030e){if(_[_0xe14c('0x65')](_0x49030e)||_[_0xe14c('0x107')](_0x49030e)||!_[_0xe14c('0x65')](_0x49030e[0x0]['Agent'])&&_[_0xe14c('0x65')](_0x49030e[0x0][_0xe14c('0x7c')][_0xe14c('0x4e')])){ut[_0xe14c('0x59')](_0xe14c('0x108'),_0x49030e);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x43ab44=this[_0xe14c('0x12')][_0x49030e[0x0][_0xe14c('0x67')][_0xe14c('0x4e')]];_0x43ab44[_0xe14c('0x47')]=_0xe14c('0x92');if(_['isNil'](_0x43ab44)){ut[_0xe14c('0x59')](_0xe14c('0x109'),_0x43ab44);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xe14c('0x90')](_0x43ab44['Trunk'])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0xe14c('0x10a')+_0x43ab44[_0xe14c('0x4e')]+_0xe14c('0x10b'));if(!this[_0xe14c('0x90')](_0x43ab44[_0xe14c('0x10c')])){ut[_0xe14c('0x59')](_0xe14c('0x10d'),_0x43ab44[_0xe14c('0x4e')]+_0xe14c('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0xe14c('0x10f')](_0x43ab44[_0xe14c('0x32')])){ut[_0xe14c('0x59')]('[Preview][validateContact][Campaign\x20Active]',_0x43ab44[_0xe14c('0x4e')]+_0xe14c('0x110'));return{'isValid':![],'message':_0xe14c('0x10a')+_0x43ab44['name']+_0xe14c('0x110')};}return{'isValid':!![],'message':_0xe14c('0x111')};};Preview['prototype'][_0xe14c('0xf1')]=function(_0xd1fe3b,_0x433cfb,_0x24daea,_0x54d3e0){var _0x5aa297=this;return new BPromise(function(_0x18ac17,_0x52498e){var _0x107406=_0xd1fe3b[_0xe14c('0xb6')];var _0x3f8751=_0x5aa297[_0xe14c('0x90')](_0x433cfb[_0xe14c('0x4d')])?util[_0xe14c('0x83')](_0xe14c('0x112'),_0x433cfb[_0xe14c('0x4d')]['name'],_['isNil'](_0x433cfb[_0xe14c('0x35')])?'':_0x433cfb[_0xe14c('0x35')][_0xe14c('0x113')]()||'',_0x433cfb[_0xe14c('0x114')]>0x0?_0x24daea[_0xe14c('0xee')][_0xe14c('0xef')][_0xe14c('0x115')](_0x433cfb[_0xe14c('0x114')]):_0x24daea[_0xe14c('0xee')][_0xe14c('0xef')]):util['format'](_0xe14c('0x112'),_['isNil'](_0x433cfb[_0xe14c('0x10c')])?_0x433cfb[_0xe14c('0x4d')][_0xe14c('0x4e')]:_0x433cfb['TrunkBackup'][_0xe14c('0x4e')],_[_0xe14c('0x65')](_0x433cfb['dialPrefix'])?'':_0x433cfb[_0xe14c('0x35')][_0xe14c('0x113')]()||'',_0x433cfb[_0xe14c('0x114')]>0x0?_0x24daea['Contact'][_0xe14c('0xef')][_0xe14c('0x115')](_0x433cfb[_0xe14c('0x114')]):_0x24daea['Contact'][_0xe14c('0xef')]);var _0x151be6=_0x5aa297[_0xe14c('0x90')](_0x433cfb[_0xe14c('0x4d')])?ut[_0xe14c('0x116')](_0x433cfb[_0xe14c('0x4d')][_0xe14c('0x50')],_0x433cfb[_0xe14c('0x33')],_0x433cfb[_0xe14c('0x117')]>0x0?ut[_0xe14c('0x118')](_0x433cfb['dialOriginateCallerIdNumber'],_0x433cfb[_0xe14c('0x117')]):_0x433cfb[_0xe14c('0x34')]):ut[_0xe14c('0x116')](_['isNil'](_0x433cfb[_0xe14c('0x10c')])?_0x433cfb[_0xe14c('0x4d')]['callerid']:_0x433cfb['TrunkBackup'][_0xe14c('0x50')],_0x433cfb['dialOriginateCallerIdName'],_0x433cfb[_0xe14c('0x117')]>0x0?ut[_0xe14c('0x118')](_0x433cfb[_0xe14c('0x34')],_0x433cfb[_0xe14c('0x117')]):_0x433cfb['dialOriginateCallerIdNumber']);if(_0x151be6){_0xd1fe3b[_0xe14c('0x119')]=ut['extractCalleridName'](_0x151be6);_0xd1fe3b[_0xe14c('0x11a')]=ut[_0xe14c('0x11b')](_0x151be6);}var _0x1baf14=ut[_0xe14c('0x11c')](_0x433cfb,_0x24daea,_0x3f8751,_0x151be6,_0x107406,_0xd1fe3b);_['merge'](_0xd1fe3b,ut['toLowerVariables'](_0x1baf14));_0xd1fe3b['starttime']=moment()[_0xe14c('0x83')](_0xe14c('0x84'));ami[_0xe14c('0x11d')](ut[_0xe14c('0x11e')](_0xd1fe3b,_0x433cfb,_0x1baf14,_0xd1fe3b[_0xe14c('0xa2')],_0x54d3e0))[_0xe14c('0x77')](function(_0x1a52b2){_0x433cfb[_0xe14c('0x56')]+=0x1;logger['info']('[originated][increment]',_0x107406,_0xe14c('0xa6'),_0x433cfb[_0xe14c('0x4e')],_0xe14c('0xdc'),_0x433cfb['originated']);_0x18ac17(_0x1a52b2);})['catch'](function(_0x3a4328){ut[_0xe14c('0xe2')](_0xd1fe3b,0xe,_0xe14c('0x11f'));rpcDb[_0xe14c('0xe5')](_0xd1fe3b,_0xe14c('0x120'));_0x52498e(_0x3a4328);});});};Preview['prototype']['syncNewExten']=function(_0x563283){if(this['actions'][_0x563283[_0xe14c('0xa3')]]){this['actions'][_0x563283[_0xe14c('0xa3')]]['channel']=_0x563283[_0xe14c('0x121')];}};Preview[_0xe14c('0x5d')][_0xe14c('0x18')]=function(_0x550cc3){var _0x586bdb=this;var _0x5aa2ab=this['actions'][_0x550cc3[_0xe14c('0x122')]];if(_0x5aa2ab){if(_0x5aa2ab[_0xe14c('0x123')]&&this[_0xe14c('0x15')][_0x5aa2ab[_0xe14c('0x123')]]){ut[_0xe14c('0x124')](_0x5aa2ab,this[_0xe14c('0x15')][_0x5aa2ab[_0xe14c('0x123')]][_0xe14c('0x4e')],this['agents'][_0x5aa2ab['lookAgent']]['id']);}var _0x32999c=_[_0xe14c('0x125')](_0x5aa2ab);_0x32999c[_0xe14c('0x126')]=moment()[_0xe14c('0x83')](_0xe14c('0x84'));var _0x39c1d0=_0x586bdb[_0xe14c('0x12')][_0x5aa2ab[_0xe14c('0x68')]];if(ut[_0xe14c('0x127')](_0x550cc3[_0xe14c('0x128')])){if(_0x5aa2ab['unlockAgent']){rpcDb[_0xe14c('0x129')](_0x5aa2ab[_0xe14c('0x12a')]);}if(_0x5aa2ab[_0xe14c('0xa2')]){rpcDb[_0xe14c('0x81')](_0x5aa2ab[_0xe14c('0x12a')]);}ami[_0xe14c('0xa7')](_0xe14c('0x12b'),ut['buildObj'](_0x5aa2ab,_0xe14c('0x12c')));this[_0xe14c('0xde')](_0x32999c,_0x39c1d0,_0x550cc3);}else{_0x5aa2ab[_0xe14c('0x82')]=moment()[_0xe14c('0x83')](_0xe14c('0x84'));ut[_0xe14c('0xe2')](_0x32999c,0x4,_0xe14c('0xb2'));rpcDb['createAgentHistory'](_0x32999c,_0xe14c('0x12d'));}}};Preview[_0xe14c('0x5d')]['syncHangup']=function(_0x2c1933){var _0x2db96f=this;var _0x2160d8=this[_0xe14c('0x14')][_0x2c1933[_0xe14c('0xa3')]];var _0x15aeb0;if(_0x2160d8){_0x15aeb0=this[_0xe14c('0x12')][_0x2160d8['queue']];logger[_0xe14c('0x54')](_0xe14c('0x12e'),_0x2c1933[_0xe14c('0xa3')],_0xe14c('0xa6'),_0x15aeb0[_0xe14c('0x4e')],_0xe14c('0x69'),_0x15aeb0['pTalking']);}if(this[_0xe14c('0x14')][_0x2c1933[_0xe14c('0xa3')]]&&_0x2c1933[_0xe14c('0xa3')]!==_0x2c1933[_0xe14c('0xb6')]){if(_0x2c1933[_0xe14c('0x12f')]==='16'&&this[_0xe14c('0x14')][_0x2c1933[_0xe14c('0xa3')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x2c1933,_0x2c1933[_0xe14c('0xa3')],_0x2c1933[_0xe14c('0x12f')]);}else if(this[_0xe14c('0x14')][_0x2c1933[_0xe14c('0xa3')]]['dialAnswer']){logger[_0xe14c('0x54')]('[syncHangup][talking][cause]',_0x2c1933[_0xe14c('0xa3')],_0x2c1933[_0xe14c('0x12f')],'\x20Queue',_0x15aeb0[_0xe14c('0x4e')],_0xe14c('0x69'),_0x15aeb0[_0xe14c('0x2c')]);this['callProgressDetectingCustomer'](_0x2c1933,_0x2c1933[_0xe14c('0xa3')],_0x2c1933[_0xe14c('0x12f')]);}}else if(_0x2160d8&&_['isNil'](_0x2160d8[_0xe14c('0x130')])&&_0x15aeb0[_0xe14c('0x131')]&&_0x2c1933[_0xe14c('0xa3')]===_0x2c1933[_0xe14c('0xb6')]&&_[_0xe14c('0x65')](_0x2c1933['reason'])&&_0x2c1933[_0xe14c('0x12f')]==='16'&&_0x2c1933['channelstate']==='6'&&_['isUndefined'](_0x2160d8[_0xe14c('0x132')])){if(_0x2160d8[_0xe14c('0xbe')]){rpcDb[_0xe14c('0x129')](_0x2160d8[_0xe14c('0x12a')]);}if(_0x2160d8[_0xe14c('0xa2')]){rpcDb[_0xe14c('0x81')](_0x2160d8[_0xe14c('0x12a')]);}_0x2c1933[_0xe14c('0xe1')]='22';this[_0xe14c('0xde')](_0x2160d8,_0x15aeb0,_0x2c1933);}else if(_0x2160d8&&_0x2160d8[_0xe14c('0x132')]){if(_0x2c1933[_0xe14c('0x12f')]==='16'&&this['actions'][_0x2c1933[_0xe14c('0xa3')]][_0xe14c('0x6a')]){logger[_0xe14c('0x54')]('[syncHangup][talking][transfer]',_0x2c1933[_0xe14c('0xa3')],_0x2c1933['cause'],_0xe14c('0xa6'),_0x15aeb0[_0xe14c('0x4e')],_0xe14c('0x69'),_0x15aeb0['pTalking']);this[_0xe14c('0x93')](_0x2c1933,_0x2c1933['linkedid'],_0x2c1933[_0xe14c('0x12f')]);}else if(this[_0xe14c('0x14')][_0x2c1933[_0xe14c('0xa3')]]['dialAnswer']){logger[_0xe14c('0x54')](_0xe14c('0x133'),_0x2c1933[_0xe14c('0xa3')],_0x2c1933[_0xe14c('0x12f')],_0xe14c('0xa6'),_0x15aeb0['name'],_0xe14c('0x69'),_0x15aeb0[_0xe14c('0x2c')]);this[_0xe14c('0x93')](_0x2c1933,_0x2c1933['linkedid'],_0x2c1933[_0xe14c('0x12f')]);}}};Preview[_0xe14c('0x5d')]['syncDialEnd']=function(_0x10077f){if(this[_0xe14c('0x14')][_0x10077f['destlinkedid']]&&_0x10077f['destlinkedid']!==_0x10077f[_0xe14c('0x134')]){this['callProgressDetectingCustomer'](_0x10077f,_0x10077f[_0xe14c('0xdd')],_0x10077f[_0xe14c('0x135')]);}};Preview[_0xe14c('0x5d')]['syncHangupRequest']=function(_0x4759ef){if(this[_0xe14c('0x14')][_0x4759ef['linkedid']]&&_0x4759ef[_0xe14c('0xa3')]!==_0x4759ef[_0xe14c('0xb6')]&&!this[_0xe14c('0x14')][_0x4759ef['linkedid']][_0xe14c('0x6a')]){if(_0x4759ef['cause']==='1'){this[_0xe14c('0x93')](_0x4759ef,_0x4759ef[_0xe14c('0xa3')],_0x4759ef['cause']);}}};Preview[_0xe14c('0x5d')][_0xe14c('0x136')]=function(_0x581e58,_0x36c8a7,_0x5b287b){if(this[_0xe14c('0x14')][_0x581e58]){if(_[_0xe14c('0x65')](this[_0xe14c('0x14')][_0x581e58][_0xe14c('0x137')])){this[_0xe14c('0x14')][_0x581e58][_0xe14c('0x137')]={};}this['actions'][_0x581e58]['variables'][_0x36c8a7]=_0x5b287b;}};Preview[_0xe14c('0x5d')][_0xe14c('0x138')]=function(_0x44a08a){try{if(!_[_0xe14c('0x65')](_0x44a08a)){if(ut[_0xe14c('0x139')](_[_0xe14c('0x13a')](_0x44a08a['variable'])[0x0])){this[_0xe14c('0x136')](_0x44a08a[_0xe14c('0xb6')],_[_0xe14c('0x13a')](_0x44a08a['variable'])[0x0],_0x44a08a['value']);}}}catch(_0x2badf1){logger[_0xe14c('0x13b')](_0xe14c('0x13c'),util['inspect'](_0x2badf1,{'showHidden':![],'depth':null}));}};Preview[_0xe14c('0x5d')]['syncAttendedTransfer']=function(_0x3a9a7b){if(_0x3a9a7b){if(this['actions'][_0x3a9a7b[_0xe14c('0x13d')]]){this[_0xe14c('0x14')][_0x3a9a7b['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0xe14c('0x5d')][_0xe14c('0x25')]=function(_0x3388f4){if(_0x3388f4){if(this[_0xe14c('0x14')][_0x3388f4[_0xe14c('0x13e')]]){this[_0xe14c('0x14')][_0x3388f4[_0xe14c('0x13e')]][_0xe14c('0x132')]=!![];}}};module[_0xe14c('0x13f')]=Preview; \ No newline at end of file +var _0x3333=['booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','size','agentReadyId','then','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','catch','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','sendMessageOneNotActive','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','createCustomerFinal','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','answertime','uniqueid','\x20Queue','connect','acw','custom:agentConnectPreview','buildAcw','complete','total','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','AgentReject','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','isUndefined','object','reason','logAgent','createAgentHistory','NoAnswer','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','SIP/%s','status','reachable','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','toLowerVariables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','lookAgent','isFailure','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','addVariable','variables','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','lodash','bluebird','uuid','moment','md5','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','redis','defaults','localhost','prototype','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','hanguprequest','syncHangupRequest','dialend','newexten','attendedtransfer','blindtransfer','loopCampaigns','emit','type','outbound','strategy','answered','loggedIn','pTalking','sumBillable','sumHoldTime','talking','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','stringify','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','available','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty'];(function(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0x3333,0xed));var _0x3333=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x3333[_0x310504];return _0x5b36d0;};'use strict';var util=require('util');var _=require(_0x3333('0x0'));var BPromise=require(_0x3333('0x1'));var uuid=require(_0x3333('0x2'));var moment=require(_0x3333('0x3'));var md5=require(_0x3333('0x4'));var Redis=require('ioredis');var config=require(_0x3333('0x5'));var logger=require(_0x3333('0x6'))(_0x3333('0x7'));var loggerAction=require(_0x3333('0x6'))(_0x3333('0x8'));var ami=require('../ami');var rpcDb=require(_0x3333('0x9'));var Action=require('./action');var ut=require('./util/util');config[_0x3333('0xa')]=_[_0x3333('0xb')](config[_0x3333('0xa')],{'host':_0x3333('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3333('0xa')]));var Sequence=function(){};Sequence[_0x3333('0xd')][_0x3333('0xe')]=function(_0x4eca8c){this[_0x3333('0xf')]=this[_0x3333('0xf')]?this['tail'][_0x3333('0x10')](_0x4eca8c):_0x4eca8c();};function Preview(_0xba48){this['sequence']=new Sequence();this[_0x3333('0x11')]=_0xba48[_0x3333('0x12')];this[_0x3333('0x13')]=_0xba48[_0x3333('0x13')];this[_0x3333('0x14')]={};this[_0x3333('0x15')]=_0xba48['agents'];this[_0x3333('0x16')]=0x0;ami['on']('originateresponse',this[_0x3333('0x17')][_0x3333('0x18')](this));ami['on'](_0x3333('0x19'),this['syncHangup'][_0x3333('0x18')](this));ami['on'](_0x3333('0x1a'),this[_0x3333('0x1b')][_0x3333('0x18')](this));ami['on'](_0x3333('0x1c'),this['syncDialEnd'][_0x3333('0x18')](this));ami['on'](_0x3333('0x1d'),this['syncNewExten'][_0x3333('0x18')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x3333('0x1e'),this['syncAttendedTransfer'][_0x3333('0x18')](this));ami['on'](_0x3333('0x1f'),this['syncBlindTransfer'][_0x3333('0x18')](this));this[_0x3333('0x20')](this['campaignsPreview']);}function emit(_0x24be04,_0x124ee9,_0x4ed747){io['to'](_0x24be04)[_0x3333('0x21')](_0x124ee9,_0x4ed747);}function emitCampaignPreview(_0x225e47){if(_0x225e47[_0x3333('0x22')]===_0x3333('0x23')){var _0x2cd014={'id':_0x225e47['id'],'name':_0x225e47['name'],'strategy':_0x225e47[_0x3333('0x24')],'answered':_0x225e47[_0x3333('0x25')],'available':_0x225e47['available'],'loggedIn':_0x225e47[_0x3333('0x26')],'pTalking':_0x225e47[_0x3333('0x27')],'sumBillable':_0x225e47[_0x3333('0x28')],'sumDuration':_0x225e47['sumDuration'],'sumHoldTime':_0x225e47[_0x3333('0x29')]||0x0,'talking':_0x225e47[_0x3333('0x2a')],'total':_0x225e47['total'],'type':_0x225e47['type'],'unmanaged':_0x225e47[_0x3333('0x2b')],'abandoned':_0x225e47['abandoned'],'waiting':_0x225e47[_0x3333('0x2c')],'loggedInDb':_0x225e47[_0x3333('0x2d')],'dialActive':_0x225e47[_0x3333('0x2e')],'dialMethod':_0x225e47[_0x3333('0x2f')],'dialOriginateCallerIdName':_0x225e47[_0x3333('0x30')],'dialOriginateCallerIdNumber':_0x225e47[_0x3333('0x31')],'dialOriginateTimeout':_0x225e47[_0x3333('0x32')],'dialPrefix':_0x225e47['dialPrefix'],'outboundAnswerAgiCallsDay':_0x225e47[_0x3333('0x33')],'outboundAnswerCallsDay':_0x225e47[_0x3333('0x34')],'outboundBlacklistCallsDay':_0x225e47[_0x3333('0x35')],'outboundBusyCallsDay':_0x225e47[_0x3333('0x36')],'outboundCongestionCallsDay':_0x225e47['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x225e47[_0x3333('0x37')],'outboundDropCallsDayCallersExit':_0x225e47['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x225e47[_0x3333('0x38')],'outboundNoAnswerCallsDay':_0x225e47[_0x3333('0x39')],'outboundNoSuchCallsDay':_0x225e47['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x225e47[_0x3333('0x3a')],'outboundReCallsDay':_0x225e47[_0x3333('0x3b')],'outboundRejectCallsDay':_0x225e47[_0x3333('0x3c')],'outboundUnknownCallsDay':_0x225e47[_0x3333('0x3d')],'outboundAbandonedCallsDay':_0x225e47[_0x3333('0x3e')],'predictiveIntervalAnsweredCalls':_0x225e47[_0x3333('0x3f')],'predictiveIntervalAvgHoldtime':_0x225e47[_0x3333('0x40')],'predictiveIntervalAvgTalktime':_0x225e47[_0x3333('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x225e47[_0x3333('0x42')],'predictiveIntervalDroppedCallsTimeout':_0x225e47[_0x3333('0x43')],'predictiveIntervalErlangCalls':_0x225e47[_0x3333('0x44')],'predictiveIntervalErlangCallsDroppedCalls':_0x225e47[_0x3333('0x45')],'predictiveIntervalHitRate':_0x225e47[_0x3333('0x46')],'predictiveIntervalMultiplicativeFactor':_0x225e47['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x225e47[_0x3333('0x47')],'predictiveIntervalAvailable':_0x225e47[_0x3333('0x48')],'predictiveIntervalTotalCalls':_0x225e47[_0x3333('0x49')],'message':_0x225e47[_0x3333('0x4a')],'originated':_0x225e47[_0x3333('0x4b')],'erlangCalls':_0x225e47['erlangCalls'],'erlangCallToSecond':_0x225e47['erlangCallToSecond'],'erlangAbandonmentRate':_0x225e47[_0x3333('0x4c')],'erlangBusyFactor':_0x225e47[_0x3333('0x4d')],'startPredictive':_0x225e47[_0x3333('0x4e')],'startProgressive':_0x225e47[_0x3333('0x4f')]};if(_0x225e47[_0x3333('0x50')]){_0x2cd014['Trunk']={'id':_0x225e47[_0x3333('0x50')]['id'],'name':_0x225e47[_0x3333('0x50')][_0x3333('0x51')],'active':_0x225e47[_0x3333('0x50')][_0x3333('0x52')],'callerid':_0x225e47[_0x3333('0x50')][_0x3333('0x53')]};}if(_0x225e47[_0x3333('0x54')]){_0x2cd014[_0x3333('0x54')]={'id':_0x225e47[_0x3333('0x54')]['id'],'name':_0x225e47[_0x3333('0x54')][_0x3333('0x51')]};}var _0x2ccfd6=md5(JSON[_0x3333('0x55')](_0x2cd014));if(_0x225e47['md5']!==_0x2ccfd6){_0x225e47[_0x3333('0x4')]=_0x2ccfd6;emit(util[_0x3333('0x56')](_0x3333('0x57'),_0x2cd014[_0x3333('0x51')]),'voice_queue:save',_0x2cd014);}}}function emitVoiceQueueChannelRemove(_0x35cab7){logger[_0x3333('0x58')](_0x3333('0x59'),JSON[_0x3333('0x55')](_0x35cab7));emit(util[_0x3333('0x56')](_0x3333('0x57'),_0x35cab7['name']),_0x3333('0x5a'),_0x35cab7);}function notSendMessagesQueue(_0x445083){if(_0x445083['sendMessageOneNotActive']){if(_0x445083[_0x3333('0x4b')]===0x0&&_0x445083['pTalking']===0x0){_0x445083['sendMessageOneNotActive']=![];_0x445083[_0x3333('0x5b')]=0x0;_0x445083['paused']=0x0;_0x445083[_0x3333('0x4a')]=_0x3333('0x5c');ut[_0x3333('0x5d')](_0x3333('0x5e'),_0x445083[_0x3333('0x51')]+_0x3333('0x5f'));}else{_0x445083[_0x3333('0x4a')]=_0x3333('0x60');ut[_0x3333('0x5d')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x445083[_0x3333('0x51')]+_0x3333('0x61'));}emitCampaignPreview(_0x445083);}}Preview[_0x3333('0xd')][_0x3333('0x20')]=function(){var _0xe35571=this;setInterval(function(){_0xe35571[_0x3333('0x62')]();},0x7cf);};Preview['prototype'][_0x3333('0x62')]=function(){var _0x5fd91=this['campaignsPreview'];this[_0x3333('0x16')]+=0x1;for(var _0x155fdc in _0x5fd91){if(_0x5fd91[_0x3333('0x63')](_0x155fdc)&&(_0x5fd91[_0x155fdc]['dialMethod']===_0x3333('0x7')||_0x5fd91[_0x155fdc][_0x3333('0x2f')]===_0x3333('0x64'))&&_0x5fd91[_0x155fdc]['type']==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0x3333('0x16')]=0x0;this[_0x3333('0x65')]();}}if(_0x5fd91[_0x3333('0x63')](_0x155fdc)&&_0x5fd91[_0x155fdc]['dialMethod']==='preview'&&_0x5fd91[_0x155fdc]['type']===_0x3333('0x23')){if(_0x5fd91[_0x155fdc][_0x3333('0x2e')]){this[_0x3333('0x66')](_0x5fd91[_0x155fdc]);this[_0x3333('0x67')](_0x5fd91[_0x155fdc]);}else{notSendMessagesQueue(_0x5fd91[_0x155fdc]);}}}};Preview[_0x3333('0xd')][_0x3333('0x68')]=function(_0x41dc23){var _0x218535=this;this['sequence'][_0x3333('0xe')](function(){if(!_[_0x3333('0x69')](_0x218535[_0x3333('0x14')][_0x41dc23])){loggerAction[_0x3333('0x58')](_0x3333('0x6a'),_0x41dc23,_0x3333('0x6b'),_0x218535[_0x3333('0x14')][_0x41dc23][_0x3333('0x6c')],'originated:\x20',JSON[_0x3333('0x55')](_0x218535[_0x3333('0x11')][_0x218535['actions'][_0x41dc23][_0x3333('0x6c')]][_0x3333('0x4b')]),_0x3333('0x6d'),JSON['stringify'](_0x218535['campaignsPreview'][_0x218535[_0x3333('0x14')][_0x41dc23][_0x3333('0x6c')]]['pTalking']),JSON['stringify'](_0x218535[_0x3333('0x14')][_0x41dc23][_0x3333('0x6e')]),JSON[_0x3333('0x55')](_[_0x3333('0x6f')](_0x218535[_0x3333('0x14')][_0x41dc23],[_0x3333('0x70'),_0x3333('0x71'),_0x3333('0x72'),_0x3333('0x73')])));return ami[_0x3333('0x74')]({'action':'status','channel':_0x218535[_0x3333('0x14')][_0x41dc23][_0x3333('0x75')]})['catch'](function(_0x1553e4){if(_0x1553e4['message']===_0x3333('0x76')){setTimeout(function(){if(_0x218535[_0x3333('0x14')][_0x41dc23]){ut[_0x3333('0x77')](_0x218535[_0x3333('0x11')][_0x218535[_0x3333('0x14')][_0x41dc23][_0x3333('0x6c')]],_0x3333('0x78'));if(_0x218535[_0x3333('0x14')][_0x41dc23]['dialAnswer']===!![]){ut['decrementTalkink'](_0x218535[_0x3333('0x11')][_0x218535['actions'][_0x41dc23][_0x3333('0x6c')]],_0x3333('0x78'));ut['loggerError'](_0x3333('0x79')+_0x41dc23,_0x218535[_0x3333('0x14')][_0x41dc23][_0x3333('0x6c')]);}ut[_0x3333('0x7a')]('[Dialer][checkChannel][Preview]'+_0x41dc23,_0x218535[_0x3333('0x14')][_0x41dc23]['queue']);delete _0x218535[_0x3333('0x14')][_0x41dc23];}},0x2328);}});}});};Preview['prototype'][_0x3333('0x65')]=function(){var _0x203bc1=this;loggerAction['info']('[action]',_[_0x3333('0x7b')](this[_0x3333('0x14')]));for(var _0x43a270 in this['actions']){if(_0x203bc1[_0x3333('0x14')]['hasOwnProperty'](_0x43a270)){_0x203bc1[_0x3333('0x68')](_0x43a270);}}};Preview[_0x3333('0xd')][_0x3333('0x67')]=function(_0x239318){var _0x2c28dc=this;rpcDb['getContactRecallMe'](_0x239318['id'],ut[_0x3333('0x7c')](this[_0x3333('0x15')]))[_0x3333('0x7d')](function(_0x24186e){if(!_[_0x3333('0x69')](_0x24186e)){for(var _0x305c65=0x0;_0x305c65<_0x24186e['length'];_0x305c65+=0x1){if(ut[_0x3333('0x7e')](_0x24186e[_0x305c65][_0x3333('0x7f')])<_0x239318[_0x3333('0x80')]*0x3c){if(_0x24186e[_0x305c65][_0x3333('0x81')]&&!_0x24186e[_0x305c65][_0x3333('0x81')][_0x3333('0x82')]){_0x2c28dc[_0x3333('0x83')](_0x24186e[_0x305c65]['id'])[_0x3333('0x7d')](ut[_0x3333('0x84')](_0x3333('0x85')))[_0x3333('0x86')](ut['logger2'](_0x3333('0x85')));}else{rpcDb[_0x3333('0x87')](_0x24186e[_0x305c65]['id']);}}else{var _0x3668c6=new Action(_0x24186e[_0x305c65],_0x239318);_0x3668c6[_0x3333('0x88')]=moment()[_0x3333('0x56')](_0x3333('0x89'));_0x239318[_0x3333('0x3b')]+=0x1;ut[_0x3333('0x8a')](_0x3668c6,0x17,_0x3333('0x8b'));if(_0x239318[_0x3333('0x8c')]){rpcDb[_0x3333('0x8d')](ut[_0x3333('0x8e')](_0x24186e[_0x305c65]));rpcDb[_0x3333('0x8f')](_0x3668c6,_0x3333('0x90'));}else{ut[_0x3333('0x8a')](_0x3668c6,0x16,_0x3333('0x91'));rpcDb['createCustomerHistory'](_0x3668c6,_0x3333('0x92'));rpcDb['createCustomerFinal'](_0x3668c6,_0x3333('0x92'));}}}}})[_0x3333('0x86')](ut[_0x3333('0x84')](_0x3333('0x93')));};Preview[_0x3333('0xd')][_0x3333('0x66')]=function(_0x353627){_0x353627[_0x3333('0x94')]=!![];if(ut[_0x3333('0x95')](_0x353627[_0x3333('0x26')])){_0x353627[_0x3333('0x4a')]=_0x3333('0x96');}else if(!ut[_0x3333('0x97')](_0x353627[_0x3333('0x2e')])){_0x353627[_0x3333('0x4a')]='NOT_ACTIVE';}else if(!this[_0x3333('0x98')](_0x353627[_0x3333('0x50')])){if(!this['isTrunkReachable'](_0x353627[_0x3333('0x99')])){_0x353627[_0x3333('0x4a')]=_0x3333('0x9a');}else{_0x353627[_0x3333('0x4a')]=_0x3333('0x9b');}}else{_0x353627['message']=_0x3333('0x9b');}emitCampaignPreview(_0x353627);};Preview[_0x3333('0xd')][_0x3333('0x9c')]=function(_0x28395b,_0x2ead21,_0x540ffa){var _0xcddb99=this;var _0xeeabdc=this[_0x3333('0x14')][_0x2ead21];var _0x1043db=this[_0x3333('0x11')][_0xeeabdc[_0x3333('0x6c')]];var _0x17d08d;if(_0x1043db){switch(_0x540ffa){case'1':_0x1043db[_0x3333('0x9d')]+=0x1;_0xeeabdc[_0x3333('0x9e')]+=0x1;_0xeeabdc[_0x3333('0x9f')]=ut['totalGlobal'](_0xeeabdc);ut[_0x3333('0x8a')](_0xeeabdc,0x0,_0x3333('0xa0'));ami['emit'](_0x3333('0xa1'),ut[_0x3333('0xa2')](_0xeeabdc,_0x3333('0xa3')));rpcDb['createCustomerHistory'](_0xeeabdc,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x3333('0xa4')](_0xeeabdc)>=_0x1043db[_0x3333('0xa5')]){_0x17d08d=ut[_0x3333('0xa6')](_0xeeabdc,0xf,_0x3333('0xa7'));rpcDb['createCustomerFinal'](_0x17d08d,_0x3333('0xa8'));}else{if(_0xeeabdc[_0x3333('0x9e')]>=_0x1043db[_0x3333('0xa9')]){rpcDb[_0x3333('0xaa')](_0xeeabdc,_0x3333('0xa8'));}else{rpcDb[_0x3333('0xab')](ut[_0x3333('0xac')](_0xeeabdc,_0x3333('0x9e'),_0x1043db[_0x3333('0xad')]),_0xeeabdc[_0x3333('0xae')],_0xeeabdc[_0x3333('0xaf')]);}}delete this['actions'][_0x28395b[_0x3333('0xb0')]];break;case _0x3333('0xb1'):var _0x4261a2=moment()[_0x3333('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0xeeabdc['responsetime']=_0x4261a2;_0xeeabdc[_0x3333('0xb2')]=_0x4261a2;_0xeeabdc[_0x3333('0x6e')]=!![];_0x1043db[_0x3333('0x27')]+=0x1;logger[_0x3333('0x58')]('[syncHangup][talking][increment]',_0xeeabdc[_0x3333('0xb3')],_0x3333('0xb4'),_0x1043db[_0x3333('0x51')],_0x3333('0x6d'),_0x1043db[_0x3333('0x27')]);ami['emit']('custom:agentconnect',ut['buildObj'](_0xeeabdc,_0x3333('0xb5')));if(_0x1043db[_0x3333('0xb6')]){ami[_0x3333('0x21')](_0x3333('0xb7'),ut[_0x3333('0xb8')](_0xeeabdc));}break;case'16':ami[_0x3333('0x21')]('custom:agentcomplete',ut[_0x3333('0xa2')](_0xeeabdc,_0x3333('0xb9')));emitVoiceQueueChannelRemove(ut[_0x3333('0xa2')](_0xeeabdc,_0x3333('0xb9')));_0x1043db['outboundAnswerCallsDay']+=0x1;_0x1043db[_0x3333('0xba')]+=0x1;_0x1043db[_0x3333('0x25')]+=0x1;ut[_0x3333('0xbb')](_0x1043db,_0x3333('0xbc'));_0xeeabdc[_0x3333('0x9f')]=ut[_0x3333('0xa4')](_0xeeabdc);ut[_0x3333('0x8a')](_0xeeabdc,0x4,_0x3333('0xbd'));rpcDb[_0x3333('0x8f')](_0xeeabdc,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x3333('0xaa')](_0xeeabdc,_0x3333('0xbe'));rpcDb['crateCustomerReportQueue'](_0xeeabdc);_0x1043db[_0x3333('0xbf')]+=_0xeeabdc[_0x3333('0xc0')];_0x1043db[_0x3333('0x28')]+=_0xeeabdc[_0x3333('0xc0')];logger[_0x3333('0x58')](_0x3333('0xc1'),_0xeeabdc[_0x3333('0xb3')],_0x3333('0xb4'),_0x1043db[_0x3333('0x51')],_0x3333('0x6d'),_0x1043db[_0x3333('0x27')]);delete this[_0x3333('0x14')][_0x28395b[_0x3333('0xb0')]];break;case'BUSY':_0x1043db[_0x3333('0x36')]+=0x1;_0xeeabdc[_0x3333('0xc2')]+=0x1;_0xeeabdc[_0x3333('0x9f')]=ut['totalGlobal'](_0xeeabdc);ut[_0x3333('0x8a')](_0xeeabdc,0x5,_0x3333('0xc3'));ami[_0x3333('0x21')](_0x3333('0xc4'),ut[_0x3333('0xa2')](_0xeeabdc,_0x3333('0xc5')));rpcDb['createCustomerHistory'](_0xeeabdc,_0x3333('0xc6'));if(ut['totalGlobal'](_0xeeabdc)>=_0x1043db[_0x3333('0xa5')]){_0x17d08d=ut[_0x3333('0xa6')](_0xeeabdc,0xf,_0x3333('0xa7'));rpcDb['createCustomerFinal'](_0x17d08d,_0x3333('0xc7'));}else{if(_0xeeabdc[_0x3333('0xc2')]>=_0x1043db[_0x3333('0xc8')]){rpcDb['createCustomerFinal'](_0xeeabdc,_0x3333('0xc6'));}else{rpcDb[_0x3333('0xab')](ut['scheduledAt'](_0xeeabdc,_0x3333('0xc2'),_0x1043db[_0x3333('0xc9')]),_0xeeabdc[_0x3333('0xae')],_0xeeabdc['activeContact']);}}break;case _0x3333('0xca'):_0x1043db[_0x3333('0x39')]+=0x1;_0xeeabdc[_0x3333('0xcb')]+=0x1;_0xeeabdc[_0x3333('0x9f')]=ut[_0x3333('0xa4')](_0xeeabdc);ut[_0x3333('0x8a')](_0xeeabdc,0x3,'NoAnswer');ami[_0x3333('0x21')](_0x3333('0xcc'),ut[_0x3333('0xa2')](_0xeeabdc,_0x3333('0xcd')));rpcDb[_0x3333('0x8f')](_0xeeabdc,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x3333('0xa4')](_0xeeabdc)>=_0x1043db[_0x3333('0xa5')]){_0x17d08d=ut[_0x3333('0xa6')](_0xeeabdc,0xf,_0x3333('0xa7'));rpcDb[_0x3333('0xaa')](_0x17d08d,_0x3333('0xce'));}else{if(_0xeeabdc['countnoanswerretry']>=_0x1043db[_0x3333('0xcf')]){rpcDb['createCustomerFinal'](_0xeeabdc,_0x3333('0xd0'));}else{rpcDb[_0x3333('0xab')](ut[_0x3333('0xac')](_0xeeabdc,_0x3333('0xcb'),_0x1043db[_0x3333('0xd1')]),_0xeeabdc[_0x3333('0xae')],_0xeeabdc[_0x3333('0xaf')]);}}break;case'CONGESTION':_0x1043db['outboundCongestionCallsDay']+=0x1;_0xeeabdc[_0x3333('0xd2')]+=0x1;_0xeeabdc[_0x3333('0x9f')]=ut[_0x3333('0xa4')](_0xeeabdc);ut[_0x3333('0x8a')](_0xeeabdc,0x8,_0x3333('0xd3'));ami[_0x3333('0x21')](_0x3333('0xd4'),ut[_0x3333('0xa2')](_0xeeabdc,_0x3333('0xd5')));rpcDb['createCustomerHistory'](_0xeeabdc,_0x3333('0xd6'));if(ut[_0x3333('0xa4')](_0xeeabdc)>=_0x1043db[_0x3333('0xa5')]){_0x17d08d=ut[_0x3333('0xa6')](_0xeeabdc,0xf,_0x3333('0xa7'));rpcDb[_0x3333('0xaa')](_0x17d08d,_0x3333('0xd7'));}else{if(_0xeeabdc[_0x3333('0xd2')]>=_0x1043db[_0x3333('0xd8')]){rpcDb[_0x3333('0xaa')](_0xeeabdc,_0x3333('0xd6'));}else{rpcDb['rescheduleContact'](ut[_0x3333('0xac')](_0xeeabdc,_0x3333('0xd2'),_0x1043db[_0x3333('0xc9')]),_0xeeabdc['unlockAgent'],_0xeeabdc[_0x3333('0xaf')]);}}break;case _0x3333('0xd9'):_0x1043db[_0x3333('0x3c')]+=0x1;_0xeeabdc['countagentrejectretry']+=0x1;_0xeeabdc[_0x3333('0x9f')]=ut['totalGlobal'](_0xeeabdc);ut[_0x3333('0x8a')](_0xeeabdc,0x14,_0x3333('0xda'));ami[_0x3333('0x21')](_0x3333('0xdb'),ut[_0x3333('0xa2')](_0xeeabdc,_0x3333('0xdc')));rpcDb['createCustomerHistory'](_0xeeabdc,'[syncHangupRequest][logAgentReject]');if(ut[_0x3333('0xa4')](_0xeeabdc)>=_0x1043db[_0x3333('0xa5')]){_0x17d08d=ut[_0x3333('0xa6')](_0xeeabdc,0x14,_0x3333('0xda'));rpcDb['createCustomerFinal'](_0x17d08d,_0x3333('0xdd'));}else{if(_0xeeabdc[_0x3333('0xde')]>=_0x1043db[_0x3333('0xdf')]){rpcDb['createCustomerFinal'](_0xeeabdc,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x3333('0xab')](ut[_0x3333('0xac')](_0xeeabdc,_0x3333('0xde'),_0x1043db[_0x3333('0xe0')]),_0xeeabdc[_0x3333('0xae')],_0xeeabdc['activeContact']);}}break;case'ABANDONED':_0x1043db[_0x3333('0x3e')]+=0x1;_0xeeabdc[_0x3333('0xe1')]+=0x1;_0xeeabdc[_0x3333('0x9f')]=ut['totalGlobal'](_0xeeabdc);ut[_0x3333('0x8a')](_0xeeabdc,0xb,'Abandoned');rpcDb[_0x3333('0x8f')](_0xeeabdc,_0x3333('0xe2'));if(ut[_0x3333('0xa4')](_0xeeabdc)>=_0x1043db[_0x3333('0xa5')]){_0x17d08d=ut[_0x3333('0xa6')](_0xeeabdc,0xf,'Global');rpcDb['createCustomerFinal'](_0x17d08d,_0x3333('0xe2'));}else{if(_0xeeabdc['countabandonedetry']>=_0x1043db[_0x3333('0xe3')]){rpcDb[_0x3333('0xaa')](_0xeeabdc,_0x3333('0xe2'));}else{rpcDb['rescheduleContact'](ut[_0x3333('0xac')](_0xeeabdc,_0x3333('0xe1'),_0x1043db['dialAbandonedRetryFrequency']),_0xeeabdc['unlockAgent'],_0xeeabdc[_0x3333('0xaf')]);}}break;default:if(_0xeeabdc[_0x3333('0x6e')]){ut[_0x3333('0xbb')](_0x1043db,'[default]');ut[_0x3333('0x7a')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x1043db['name'],_0x28395b);}_0x1043db[_0x3333('0x3d')]+=0x1;_0xeeabdc['countglobal']=ut[_0x3333('0xa4')](_0xeeabdc);ut[_0x3333('0x8a')](_0xeeabdc,0xc,_0x28395b[_0x3333('0xe4')]||_0x28395b[_0x3333('0xe5')]);rpcDb[_0x3333('0x8f')](_0xeeabdc,_0x3333('0xe6'));if(ut[_0x3333('0xa4')](_0xeeabdc)>=_0x1043db['dialGlobalMaxRetry']){_0x17d08d=ut['cloneAction'](_0xeeabdc,0xf,'Global');rpcDb[_0x3333('0xaa')](_0x17d08d,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x3333('0xaa')](_0xeeabdc,_0x3333('0xe7'));}delete this[_0x3333('0x14')][_0x28395b[_0x3333('0xb0')]];}if(!(_0xeeabdc[_0x3333('0x6e')]&&_0x540ffa==='16')){ut[_0x3333('0x77')](_0x1043db,_0x3333('0xe8'));logger[_0x3333('0x58')](_0x3333('0xe9'),_0xeeabdc[_0x3333('0xb3')],_0x3333('0xb4'),_0x1043db[_0x3333('0x51')],_0x3333('0xea'),_0x1043db[_0x3333('0x4b')]);}if(_0x540ffa!==_0x3333('0xb1')){delete this[_0x3333('0x14')][_0x28395b[_0x3333('0xb0')]];delete this[_0x3333('0x14')][_0x28395b[_0x3333('0xeb')]];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0xe5c6e,_0x4f852a,_0x5b2b56){if(_[_0x3333('0xec')](_0x4f852a)&&_0x3333('0xed')!==typeof _0x4f852a){return;}if(_[_0x3333('0xec')](_0x5b2b56)&&_0x3333('0xed')!==typeof _0x5b2b56){return;}switch(_0x5b2b56[_0x3333('0xee')]){case'0':ut[_0x3333('0xef')](_0xe5c6e,0x0,_0x3333('0xa0'));rpcDb[_0x3333('0xf0')](_0xe5c6e,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x3333('0xef')](_0xe5c6e,0x3,_0x3333('0xf1'));rpcDb[_0x3333('0xf0')](_0xe5c6e,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x3333('0xef')](_0xe5c6e,0x5,_0x3333('0xc3'));rpcDb[_0x3333('0xf0')](_0xe5c6e,_0x3333('0xf2'));break;case'8':ut[_0x3333('0xef')](_0xe5c6e,0x8,_0x3333('0xd3'));rpcDb['createAgentHistory'](_0xe5c6e,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x3333('0xef')](_0xe5c6e,0x16,_0x3333('0xf3'));rpcDb[_0x3333('0xf0')](_0xe5c6e,_0x3333('0xf4'));break;default:ut[_0x3333('0xef')](_0xe5c6e,0xc,_0x5b2b56[_0x3333('0xee')]);rpcDb[_0x3333('0xf0')](_0xe5c6e,_0x3333('0xf5'));}ut[_0x3333('0x77')](_0x4f852a,_0x3333('0xf6'));logger[_0x3333('0x58')](_0x3333('0xf7'),_0xe5c6e[_0x3333('0xb3')],_0x3333('0xb4'),_0x4f852a[_0x3333('0x51')],_0x3333('0xea'),_0x4f852a['originated']);delete this['actions'][_0xe5c6e[_0x3333('0xb3')]];};Preview['prototype'][_0x3333('0xf8')]=function(_0x10affb,_0x261b14,_0xe17d4c,_0xa87b67,_0x303e97){var _0x3328fa=this;return new BPromise(function(_0x20749c,_0x3ef90c){if(_[_0x3333('0x69')](_0x261b14)||_[_0x3333('0x69')](_0x261b14[_0x3333('0xf9')])||_[_0x3333('0x69')](_0x261b14[_0x3333('0xf9')][_0x3333('0xfa')])||_[_0x3333('0x69')](_0x261b14[_0x3333('0x72')])){_0x3ef90c(ut[_0x3333('0x4a')]('Contact\x20is\x20undefined',_0xa87b67,_0x303e97));return;}var _0x97845d=uuid['v4']();var _0x80ab3=_0x3328fa['campaignsPreview'][_0x261b14[_0x3333('0x6b')][_0x3333('0x51')]];var _0x84a8dc=_0xe17d4c?_0x3328fa[_0x3333('0x15')][_0xe17d4c]['id']:undefined;_0x3328fa[_0x3333('0x14')][_0x97845d]=new Action(_0x261b14,_0x80ab3,_0x97845d,_0xe17d4c,_0x84a8dc);var _0x1138ef=_0x3328fa['actions'][_0x97845d];_0x1138ef['unlockAgent']=_0xa87b67;_0x1138ef['activeContact']=_0x303e97;_0x1138ef['lookAgent']=_0xe17d4c;if(_[_0x3333('0xfb')](_0x10affb)){_0x3328fa['execCall'](_0x1138ef,_0x80ab3,_0x261b14,_0xe17d4c)[_0x3333('0x7d')](function(_0x1fdffd){logger[_0x3333('0x58')](_0x3333('0xfc'),_0x3333('0xfd')+_0x1138ef[_0x3333('0x6c')]+_0x3333('0xfe')+_0x1138ef[_0x3333('0xff')],JSON[_0x3333('0x55')](_0x1fdffd));ami[_0x3333('0x21')](_0x3333('0x100'),ut[_0x3333('0xa2')](_0x1138ef,'called'));_0x20749c(ut[_0x3333('0x4a')](_0x3333('0x101')));})[_0x3333('0x86')](function(_0xc43c55){ut[_0x3333('0x5d')](_0x3333('0x102'),_0xc43c55);_0x3ef90c(ut[_0x3333('0x4a')](_0x3333('0x103'),_0xa87b67,_0x303e97));});}else{_0x80ab3['outboundBlacklistCallsDay']+=0x1;ut[_0x3333('0x104')](_0x1138ef);rpcDb[_0x3333('0x105')](_0x1138ef,_0x3333('0x106'));delete _0x3328fa[_0x3333('0x14')][_0x97845d];_0x3ef90c(ut['message']('Contact\x20in\x20black\x20List',_0xa87b67,_0x303e97));}});};Preview[_0x3333('0xd')][_0x3333('0x98')]=function(_0x3f972e){return!_[_0x3333('0x69')](_0x3f972e)&&!_[_0x3333('0x69')](_0x3f972e[_0x3333('0x51')])&&!_['isNil'](_0x3f972e['active'])&&_0x3f972e[_0x3333('0x52')]&&!_['isNil'](this[_0x3333('0x13')][util['format'](_0x3333('0x107'),_0x3f972e[_0x3333('0x51')])])&&!_[_0x3333('0x69')](this['trunks'][util['format']('SIP/%s',_0x3f972e[_0x3333('0x51')])][_0x3333('0x108')])&&(this[_0x3333('0x13')][util[_0x3333('0x56')]('SIP/%s',_0x3f972e['name'])]['status']===_0x3333('0x109')||this['trunks'][util[_0x3333('0x56')](_0x3333('0x107'),_0x3f972e['name'])][_0x3333('0x108')]==='unmonitored');};Preview['prototype']['run']=function(_0xa9608c,_0x2ec2cd){var _0x3cbf0e=this;return new BPromise(function(_0x201727,_0x570408){_0x3cbf0e['execRun'](_0xa9608c,_0x2ec2cd)['then'](function(_0x1387d3){_0x201727(_[_0x3333('0x6f')](_0x1387d3,['message']));})[_0x3333('0x86')](function(_0x27b952){if(_0x27b952[_0x3333('0x10a')]){rpcDb[_0x3333('0x10b')](_0xa9608c);}if(_0x27b952[_0x3333('0x52')]){rpcDb[_0x3333('0x87')](_0xa9608c);}_0x570408(_[_0x3333('0x6f')](_0x27b952,[_0x3333('0x4a')]));});});};Preview['prototype'][_0x3333('0x10c')]=function(_0x362398,_0x84d874){var _0x29742c=this;return new BPromise(function(_0x19cbf4,_0x349dad){var _0x5aa234,_0xac3cb5;rpcDb[_0x3333('0x10d')](_0x362398)[_0x3333('0x7d')](function(_0x318e98){if(!_[_0x3333('0x69')](_0x318e98[0x0])){_0xac3cb5=_0x318e98[0x0][_0x3333('0x10e')]?![]:!![];_0x5aa234=_0x318e98[0x0][_0x3333('0x10e')]?!![]:![];_0x5aa234=_0x84d874?!![]:_0x5aa234;}var _0x1151e7=_0x29742c[_0x3333('0x10f')](_0x318e98);if(_0x1151e7[_0x3333('0x110')]){rpcDb[_0x3333('0x111')](_[_0x3333('0x6f')](_0x318e98[0x0],[_0x3333('0x72'),_0x3333('0x112')]))[_0x3333('0x7d')](function(_0x44b94b){_0x29742c[_0x3333('0xf8')](_0x44b94b,_0x318e98[0x0],_0x84d874,_0xac3cb5,_0x5aa234)[_0x3333('0x7d')](function(_0x34902d){_0x19cbf4(_0x34902d);})[_0x3333('0x86')](function(_0x211d72){_0x349dad(_0x211d72);});})[_0x3333('0x86')](function(_0x315ee2){ut[_0x3333('0x5d')](_0x3333('0x113'),_0x315ee2);_0x349dad(ut[_0x3333('0x4a')]('Call\x20unsuccessful',_0xac3cb5,_0x5aa234));});}else{_0x349dad(ut[_0x3333('0x4a')](_0x1151e7[_0x3333('0x4a')],_0xac3cb5,_0x5aa234));}})[_0x3333('0x86')](function(_0x52fbe3){ut['logger'](_0x3333('0x114'),_0x52fbe3);_0x349dad(ut[_0x3333('0x4a')](_0x3333('0x115'),![],!![]));});});};Preview['prototype'][_0x3333('0x10f')]=function(_0x133a18){if(_[_0x3333('0x69')](_0x133a18)||_[_0x3333('0xfb')](_0x133a18)||!_[_0x3333('0x69')](_0x133a18[0x0][_0x3333('0x81')])&&_[_0x3333('0x69')](_0x133a18[0x0]['Agent'][_0x3333('0x51')])){ut[_0x3333('0x5d')](_0x3333('0x116'),_0x133a18);return{'isValid':![],'message':_0x3333('0x117')};}var _0x1ee2dc=this['campaignsPreview'][_0x133a18[0x0][_0x3333('0x6b')][_0x3333('0x51')]];_0x1ee2dc[_0x3333('0x4a')]=_0x3333('0x9b');if(_[_0x3333('0x69')](_0x1ee2dc)){ut[_0x3333('0x5d')](_0x3333('0x118'),_0x1ee2dc);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x3333('0x98')](_0x1ee2dc[_0x3333('0x50')])){ut['logger'](_0x3333('0x119'),_0x3333('0x11a')+_0x1ee2dc[_0x3333('0x51')]+_0x3333('0x11b'));if(!this[_0x3333('0x98')](_0x1ee2dc[_0x3333('0x99')])){ut[_0x3333('0x5d')](_0x3333('0x119'),_0x1ee2dc[_0x3333('0x51')]+_0x3333('0x11c'));return{'isValid':![],'message':_0x3333('0x11d')};}}if(!ut[_0x3333('0x97')](_0x1ee2dc[_0x3333('0x2e')])){ut[_0x3333('0x5d')](_0x3333('0x11e'),_0x1ee2dc[_0x3333('0x51')]+_0x3333('0x11f'));return{'isValid':![],'message':_0x3333('0x11a')+_0x1ee2dc[_0x3333('0x51')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x3333('0x120')};};Preview[_0x3333('0xd')][_0x3333('0x121')]=function(_0x58ae89,_0x278c71,_0x25d4c3,_0x3a47c4){var _0x124d12=this;return new BPromise(function(_0x344af8,_0x464d7c){var _0x184d83=_0x58ae89[_0x3333('0xb3')];var _0x4c240b=_0x124d12[_0x3333('0x98')](_0x278c71[_0x3333('0x50')])?util[_0x3333('0x56')](_0x3333('0x122'),_0x278c71[_0x3333('0x50')]['name'],_[_0x3333('0x69')](_0x278c71['dialPrefix'])?'':_0x278c71[_0x3333('0x123')]['trim']()||'',_0x278c71[_0x3333('0x124')]>0x0?_0x25d4c3['Contact'][_0x3333('0xfa')][_0x3333('0x125')](_0x278c71[_0x3333('0x124')]):_0x25d4c3['Contact']['phone']):util[_0x3333('0x56')](_0x3333('0x122'),_[_0x3333('0x69')](_0x278c71[_0x3333('0x99')])?_0x278c71['Trunk'][_0x3333('0x51')]:_0x278c71[_0x3333('0x99')]['name'],_['isNil'](_0x278c71['dialPrefix'])?'':_0x278c71[_0x3333('0x123')][_0x3333('0x126')]()||'',_0x278c71[_0x3333('0x124')]>0x0?_0x25d4c3[_0x3333('0xf9')][_0x3333('0xfa')][_0x3333('0x125')](_0x278c71['dialCutDigit']):_0x25d4c3[_0x3333('0xf9')][_0x3333('0xfa')]);var _0x2f4c7c=_0x124d12[_0x3333('0x98')](_0x278c71['Trunk'])?ut[_0x3333('0x127')](_0x278c71[_0x3333('0x50')][_0x3333('0x53')],_0x278c71[_0x3333('0x30')],_0x278c71[_0x3333('0x128')]>0x0?ut[_0x3333('0x129')](_0x278c71[_0x3333('0x31')],_0x278c71[_0x3333('0x128')]):_0x278c71[_0x3333('0x31')]):ut[_0x3333('0x127')](_[_0x3333('0x69')](_0x278c71[_0x3333('0x99')])?_0x278c71['Trunk'][_0x3333('0x53')]:_0x278c71[_0x3333('0x99')]['callerid'],_0x278c71[_0x3333('0x30')],_0x278c71[_0x3333('0x128')]>0x0?ut['getCallerIdRandom'](_0x278c71['dialOriginateCallerIdNumber'],_0x278c71[_0x3333('0x128')]):_0x278c71['dialOriginateCallerIdNumber']);if(_0x2f4c7c){_0x58ae89[_0x3333('0x12a')]=ut[_0x3333('0x12b')](_0x2f4c7c);_0x58ae89[_0x3333('0x12c')]=ut[_0x3333('0x12d')](_0x2f4c7c);}var _0x2dba94=ut['addVariables'](_0x278c71,_0x25d4c3,_0x4c240b,_0x2f4c7c,_0x184d83,_0x58ae89);_['merge'](_0x58ae89,ut[_0x3333('0x12e')](_0x2dba94));_0x58ae89[_0x3333('0x88')]=moment()[_0x3333('0x56')](_0x3333('0x89'));ami[_0x3333('0x74')](ut['variablesAction'](_0x58ae89,_0x278c71,_0x2dba94,_0x58ae89[_0x3333('0xaf')],_0x3a47c4))[_0x3333('0x7d')](function(_0x18dd8e){_0x278c71['originated']+=0x1;logger[_0x3333('0x58')](_0x3333('0x12f'),_0x184d83,_0x3333('0xb4'),_0x278c71[_0x3333('0x51')],_0x3333('0xea'),_0x278c71[_0x3333('0x4b')]);_0x344af8(_0x18dd8e);})['catch'](function(_0x4cc6b3){ut['logAgent'](_0x58ae89,0xe,_0x3333('0x130'));rpcDb['createAgentHistory'](_0x58ae89,_0x3333('0x131'));_0x464d7c(_0x4cc6b3);});});};Preview['prototype']['syncNewExten']=function(_0x2ed44f){if(this[_0x3333('0x14')][_0x2ed44f[_0x3333('0xb0')]]){this['actions'][_0x2ed44f[_0x3333('0xb0')]][_0x3333('0x75')]=_0x2ed44f[_0x3333('0x75')];}};Preview[_0x3333('0xd')]['syncOriginateResponse']=function(_0x2ce616){var _0x5d2adc=this;var _0x106cc0=this[_0x3333('0x14')][_0x2ce616[_0x3333('0x132')]];if(_0x106cc0){if(_0x106cc0['lookAgent']&&this['agents'][_0x106cc0['lookAgent']]){ut[_0x3333('0x133')](_0x106cc0,this[_0x3333('0x15')][_0x106cc0[_0x3333('0x134')]][_0x3333('0x51')],this[_0x3333('0x15')][_0x106cc0[_0x3333('0x134')]]['id']);}var _0x55c7d6=_['clone'](_0x106cc0);_0x55c7d6['responsetime']=moment()['format'](_0x3333('0x89'));var _0x20e1e2=_0x5d2adc[_0x3333('0x11')][_0x106cc0[_0x3333('0x6c')]];if(ut[_0x3333('0x135')](_0x2ce616['response'])){if(_0x106cc0['unlockAgent']){rpcDb['unlockContact'](_0x106cc0[_0x3333('0xff')]);}if(_0x106cc0[_0x3333('0xaf')]){rpcDb[_0x3333('0x87')](_0x106cc0[_0x3333('0xff')]);}ami[_0x3333('0x21')](_0x3333('0x136'),ut['buildObj'](_0x106cc0,_0x3333('0x137')));this[_0x3333('0x138')](_0x55c7d6,_0x20e1e2,_0x2ce616);}else{_0x106cc0[_0x3333('0x88')]=moment()[_0x3333('0x56')](_0x3333('0x89'));ut[_0x3333('0xef')](_0x55c7d6,0x4,_0x3333('0xbd'));rpcDb[_0x3333('0xf0')](_0x55c7d6,_0x3333('0x139'));}}};Preview[_0x3333('0xd')]['syncHangup']=function(_0x4f9375){var _0xfc3d9e=this;var _0x2a9731=this[_0x3333('0x14')][_0x4f9375[_0x3333('0xb0')]];var _0x29f3b0;if(_0x2a9731){_0x29f3b0=this[_0x3333('0x11')][_0x2a9731[_0x3333('0x6c')]];logger[_0x3333('0x58')](_0x3333('0x13a'),_0x4f9375[_0x3333('0xb0')],_0x3333('0xb4'),_0x29f3b0[_0x3333('0x51')],_0x3333('0x6d'),_0x29f3b0[_0x3333('0x27')]);}if(this[_0x3333('0x14')][_0x4f9375['linkedid']]&&_0x4f9375['linkedid']!==_0x4f9375['uniqueid']){if(_0x4f9375[_0x3333('0x13b')]==='16'&&this[_0x3333('0x14')][_0x4f9375[_0x3333('0xb0')]][_0x3333('0x6e')]){this['callProgressDetectingCustomer'](_0x4f9375,_0x4f9375['linkedid'],_0x4f9375['cause']);}else if(this[_0x3333('0x14')][_0x4f9375[_0x3333('0xb0')]][_0x3333('0x6e')]){logger[_0x3333('0x58')](_0x3333('0x13c'),_0x4f9375['linkedid'],_0x4f9375['cause'],_0x3333('0xb4'),_0x29f3b0['name'],'pTalking:\x20',_0x29f3b0[_0x3333('0x27')]);this[_0x3333('0x9c')](_0x4f9375,_0x4f9375[_0x3333('0xb0')],_0x4f9375['cause']);}}else if(_0x2a9731&&_['isNil'](_0x2a9731[_0x3333('0x13d')])&&_0x29f3b0[_0x3333('0x13e')]&&_0x4f9375[_0x3333('0xb0')]===_0x4f9375[_0x3333('0xb3')]&&_[_0x3333('0x69')](_0x4f9375[_0x3333('0xee')])&&_0x4f9375[_0x3333('0x13b')]==='16'&&_0x4f9375[_0x3333('0x13f')]==='6'&&_['isUndefined'](_0x2a9731['transfer'])){if(_0x2a9731[_0x3333('0xae')]){rpcDb[_0x3333('0x10b')](_0x2a9731[_0x3333('0xff')]);}if(_0x2a9731[_0x3333('0xaf')]){rpcDb['disableContact'](_0x2a9731[_0x3333('0xff')]);}_0x4f9375[_0x3333('0xee')]='22';this[_0x3333('0x138')](_0x2a9731,_0x29f3b0,_0x4f9375);}else if(_0x2a9731&&_0x2a9731[_0x3333('0x140')]){if(_0x4f9375['cause']==='16'&&this[_0x3333('0x14')][_0x4f9375[_0x3333('0xb0')]][_0x3333('0x6e')]){logger[_0x3333('0x58')](_0x3333('0x141'),_0x4f9375[_0x3333('0xb0')],_0x4f9375['cause'],_0x3333('0xb4'),_0x29f3b0[_0x3333('0x51')],_0x3333('0x6d'),_0x29f3b0['pTalking']);this[_0x3333('0x9c')](_0x4f9375,_0x4f9375[_0x3333('0xb0')],_0x4f9375['cause']);}else if(this['actions'][_0x4f9375['linkedid']][_0x3333('0x6e')]){logger['info'](_0x3333('0x13c'),_0x4f9375[_0x3333('0xb0')],_0x4f9375[_0x3333('0x13b')],_0x3333('0xb4'),_0x29f3b0[_0x3333('0x51')],_0x3333('0x6d'),_0x29f3b0[_0x3333('0x27')]);this[_0x3333('0x9c')](_0x4f9375,_0x4f9375['linkedid'],_0x4f9375[_0x3333('0x13b')]);}}};Preview[_0x3333('0xd')][_0x3333('0x142')]=function(_0x36219e){if(this[_0x3333('0x14')][_0x36219e[_0x3333('0xeb')]]&&_0x36219e[_0x3333('0xeb')]!==_0x36219e['destuniqueid']){this[_0x3333('0x9c')](_0x36219e,_0x36219e['destlinkedid'],_0x36219e[_0x3333('0xe5')]);}};Preview[_0x3333('0xd')][_0x3333('0x1b')]=function(_0x21c494){if(this[_0x3333('0x14')][_0x21c494[_0x3333('0xb0')]]&&_0x21c494['linkedid']!==_0x21c494['uniqueid']&&!this[_0x3333('0x14')][_0x21c494[_0x3333('0xb0')]][_0x3333('0x6e')]){if(_0x21c494['cause']==='1'){this[_0x3333('0x9c')](_0x21c494,_0x21c494[_0x3333('0xb0')],_0x21c494[_0x3333('0x13b')]);}}};Preview[_0x3333('0xd')][_0x3333('0x143')]=function(_0x3ca515,_0x565214,_0x200c7d){if(this[_0x3333('0x14')][_0x3ca515]){if(_[_0x3333('0x69')](this[_0x3333('0x14')][_0x3ca515][_0x3333('0x144')])){this[_0x3333('0x14')][_0x3ca515][_0x3333('0x144')]={};}this[_0x3333('0x14')][_0x3ca515][_0x3333('0x144')][_0x565214]=_0x200c7d;}};Preview['prototype'][_0x3333('0x145')]=function(_0x46dfd1){try{if(!_[_0x3333('0x69')](_0x46dfd1)){if(ut[_0x3333('0x146')](_[_0x3333('0x147')](_0x46dfd1['variable'])[0x0])){this[_0x3333('0x143')](_0x46dfd1[_0x3333('0xb3')],_[_0x3333('0x147')](_0x46dfd1[_0x3333('0x148')])[0x0],_0x46dfd1[_0x3333('0x149')]);}}}catch(_0x18d2b1){logger[_0x3333('0x14a')](_0x3333('0x14b'),util[_0x3333('0x14c')](_0x18d2b1,{'showHidden':![],'depth':null}));}};Preview[_0x3333('0xd')]['syncAttendedTransfer']=function(_0xa963ea){if(_0xa963ea){if(this[_0x3333('0x14')][_0xa963ea[_0x3333('0x14d')]]){this[_0x3333('0x14')][_0xa963ea[_0x3333('0x14d')]]['transfer']=!![];}}};Preview[_0x3333('0xd')][_0x3333('0x14e')]=function(_0x12e101){if(_0x12e101){if(this[_0x3333('0x14')][_0x12e101[_0x3333('0x14f')]]){this['actions'][_0x12e101[_0x3333('0x14f')]][_0x3333('0x140')]=!![];}}};module[_0x3333('0x150')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 2d46ee9..913a2b4 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 _0x0faf=['rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','[unlockContact]\x20','disableContact','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','connectedlinename','membername','from-sip','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','then','createHistory','resolve','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal'];(function(_0x1df092,_0x35e68f){var _0x559e6b=function(_0x3dbacf){while(--_0x3dbacf){_0x1df092['push'](_0x1df092['shift']());}};_0x559e6b(++_0x35e68f);}(_0x0faf,0x132));var _0xf0fa=function(_0x367995,_0x129ae2){_0x367995=_0x367995-0x0;var _0x22daa8=_0x0faf[_0x367995];return _0x22daa8;};'use strict';var util=require(_0xf0fa('0x0'));var BPromise=require('bluebird');var logger=require(_0xf0fa('0x1'))(_0xf0fa('0x2'));var _=require(_0xf0fa('0x3'));var cmHopper=require(_0xf0fa('0x4'));var cmHopperFinal=require(_0xf0fa('0x5'));var cmHopperHistory=require(_0xf0fa('0x6'));var cmHopperBlack=require(_0xf0fa('0x7'));var voiceQueueRt=require(_0xf0fa('0x8'));var agentReportPreview=require(_0xf0fa('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x3637a3){return function(_0x44ffa0){logger[_0xf0fa('0xa')](_0x3637a3,util[_0xf0fa('0xb')](_0x44ffa0,{'showHidden':![],'depth':null}));};}function create(_0x2db1d9){return BPromise['resolve']()[_0xf0fa('0xc')](cmHopperHistory[_0xf0fa('0xd')](_0x2db1d9))['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x3bda51){return BPromise[_0xf0fa('0xe')]()[_0xf0fa('0xc')](agentReportPreview[_0xf0fa('0xd')](_0x3bda51))[_0xf0fa('0xf')](loggerCatch(_0xf0fa('0x10')));}function moveContact(_0x379ff6){return BPromise[_0xf0fa('0xe')]()['then'](cmHopper[_0xf0fa('0x11')](_0x379ff6,!![]))['catch'](loggerCatch(_0xf0fa('0x12')));}exports['checkIsBlackList']=function(_0x39ae2b){return BPromise[_0xf0fa('0xe')]()[_0xf0fa('0xc')](cmHopperBlack['checkIsBlackList'](_0x39ae2b))['catch'](loggerCatch(_0xf0fa('0x13')));};exports['getContactPreview']=function(_0x1f7159){return BPromise[_0xf0fa('0xe')]()[_0xf0fa('0xc')](cmHopper[_0xf0fa('0x14')](_0x1f7159))[_0xf0fa('0xf')](loggerCatch(_0xf0fa('0x15')));};exports[_0xf0fa('0xd')]=function(_0x3f3bb7,_0x497542){create(_0x3f3bb7)[_0xf0fa('0xf')](loggerCatch(_0x497542));moveContact(_0x3f3bb7)[_0xf0fa('0xf')](loggerCatch(_0x497542));};exports[_0xf0fa('0x16')]=function(_0x1d3c22,_0x2bdf82){createAgent(_0x1d3c22)[_0xf0fa('0xf')](loggerCatch(_0x2bdf82));};exports['createCustomerHistory']=function(_0x56ef81,_0x2f376d){create(_0x56ef81)[_0xf0fa('0xf')](loggerCatch(_0x2f376d));};exports[_0xf0fa('0x17')]=function(_0x2385e2,_0x1a3620){moveContact(_0x2385e2)[_0xf0fa('0xf')](loggerCatch(_0x1a3620));};exports[_0xf0fa('0x18')]=function(_0x3de639,_0x3b87a2,_0x15942b){if(_0x3b87a2){_0x3de639[_0xf0fa('0x19')]=null;}if(_0x15942b){_0x3de639['active']=![];}return BPromise[_0xf0fa('0xe')]()[_0xf0fa('0xc')](cmHopper[_0xf0fa('0x18')](_0x3de639))[_0xf0fa('0xf')](loggerCatch(_0xf0fa('0x1a')));};exports[_0xf0fa('0x1b')]=function(_0x3901aa){return BPromise[_0xf0fa('0xe')]()[_0xf0fa('0xc')](cmHopper['countReScheduled'](_0x3901aa))[_0xf0fa('0xf')](loggerCatch(_0xf0fa('0x1c')));};exports['unlockContact']=function(_0x3b5d7d){return BPromise[_0xf0fa('0xe')]()[_0xf0fa('0xc')](cmHopper['unlockContact']({'UserId':null},_0x3b5d7d,0x1))[_0xf0fa('0xf')](loggerCatch(_0xf0fa('0x1d')));};exports[_0xf0fa('0x1e')]=function(_0xf631f6){return BPromise['resolve']()['then'](cmHopper[_0xf0fa('0x1f')]({'active':![]},_0xf631f6,0x1))[_0xf0fa('0xf')](loggerCatch(_0xf0fa('0x20')));};exports[_0xf0fa('0x21')]=function(_0x57b8e9){var _0x4058d6={};_0x4058d6[_0xf0fa('0x22')]=_0x57b8e9[_0xf0fa('0x22')];_0x4058d6['uniqueid']=_0x57b8e9[_0xf0fa('0x23')];_0x4058d6['calleridnum']=_0x57b8e9[_0xf0fa('0x24')];_0x4058d6[_0xf0fa('0x25')]=_0x57b8e9[_0xf0fa('0x25')];_0x4058d6['queue']=_0x57b8e9[_0xf0fa('0x26')];_0x4058d6[_0xf0fa('0x27')]=_0x57b8e9[_0xf0fa('0x28')];_0x4058d6[_0xf0fa('0x29')]=_0x57b8e9[_0xf0fa('0x28')];_0x4058d6[_0xf0fa('0x2a')]=0x1;_0x4058d6['queuecallercompleteAt']=_0x57b8e9['endtime'];_0x4058d6[_0xf0fa('0x2b')]=_0x57b8e9[_0xf0fa('0x2c')];_0x4058d6['context']=_0xf0fa('0x2d');_0x4058d6['exten']='xcally-motion-preview';_0x4058d6['holdtime']=0x0;_0x4058d6[_0xf0fa('0x2e')]=0x1;_0x4058d6['lastAssignedTo']=_0x57b8e9[_0xf0fa('0x2c')];_0x4058d6[_0xf0fa('0x2f')]=_0xf0fa('0x30');return BPromise[_0xf0fa('0xe')]()[_0xf0fa('0xc')](voiceQueueReport[_0xf0fa('0x31')](_0x4058d6))[_0xf0fa('0xf')](loggerCatch(_0xf0fa('0x32')));};exports['getContactRecallMe']=function(_0x3abd96,_0x307aa8){return BPromise[_0xf0fa('0xe')]()['then'](cmHopper[_0xf0fa('0x33')](_0x3abd96,_0x307aa8))[_0xf0fa('0xf')](loggerCatch(_0xf0fa('0x34')));};exports[_0xf0fa('0x35')]=function(_0x4879ef){return BPromise['resolve']()[_0xf0fa('0xc')](cmHopper[_0xf0fa('0x18')](_0x4879ef,!![],!![]))[_0xf0fa('0xf')](loggerCatch(_0xf0fa('0x36')));}; \ No newline at end of file +var _0x008c=['catch','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createHistory','createCustomerHistory','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','then','[createHistory]\x20'];(function(_0x17364a,_0x51924b){var _0x48917f=function(_0x14d302){while(--_0x14d302){_0x17364a['push'](_0x17364a['shift']());}};_0x48917f(++_0x51924b);}(_0x008c,0x188));var _0xc008=function(_0x16b133,_0x1fc6f3){_0x16b133=_0x16b133-0x0;var _0x248b99=_0x008c[_0x16b133];return _0x248b99;};'use strict';var util=require(_0xc008('0x0'));var BPromise=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var _=require(_0xc008('0x4'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xc008('0x5'));var cmHopperHistory=require(_0xc008('0x6'));var cmHopperBlack=require(_0xc008('0x7'));var voiceQueueRt=require(_0xc008('0x8'));var agentReportPreview=require(_0xc008('0x9'));var voiceQueueReport=require(_0xc008('0xa'));function loggerCatch(_0x13aa7){return function(_0x39bb5e){logger[_0xc008('0xb')](_0x13aa7,util['inspect'](_0x39bb5e,{'showHidden':![],'depth':null}));};}function create(_0x428fa9){return BPromise['resolve']()[_0xc008('0xc')](cmHopperHistory['createHistory'](_0x428fa9))['catch'](loggerCatch(_0xc008('0xd')));}function createAgent(_0x7231b4){return BPromise['resolve']()['then'](agentReportPreview['createHistory'](_0x7231b4))[_0xc008('0xe')](loggerCatch(_0xc008('0xd')));}function moveContact(_0x5b2004){return BPromise[_0xc008('0xf')]()[_0xc008('0xc')](cmHopper[_0xc008('0x10')](_0x5b2004,!![]))[_0xc008('0xe')](loggerCatch(_0xc008('0x11')));}exports[_0xc008('0x12')]=function(_0x69726e){return BPromise['resolve']()['then'](cmHopperBlack[_0xc008('0x12')](_0x69726e))['catch'](loggerCatch(_0xc008('0x13')));};exports[_0xc008('0x14')]=function(_0x2073ef){return BPromise[_0xc008('0xf')]()[_0xc008('0xc')](cmHopper['getContactPreview'](_0x2073ef))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0xc008('0x15')]=function(_0x15a6ad,_0x3cafe3){create(_0x15a6ad)[_0xc008('0xe')](loggerCatch(_0x3cafe3));moveContact(_0x15a6ad)['catch'](loggerCatch(_0x3cafe3));};exports['createAgentHistory']=function(_0x540e45,_0x5c2668){createAgent(_0x540e45)[_0xc008('0xe')](loggerCatch(_0x5c2668));};exports[_0xc008('0x16')]=function(_0x501137,_0x813397){create(_0x501137)['catch'](loggerCatch(_0x813397));};exports['createCustomerFinal']=function(_0x543e5d,_0x50261c){moveContact(_0x543e5d)[_0xc008('0xe')](loggerCatch(_0x50261c));};exports['rescheduleContact']=function(_0x5560b1,_0x590a71,_0x4a582d){if(_0x590a71){_0x5560b1['UserId']=null;}if(_0x4a582d){_0x5560b1[_0xc008('0x17')]=![];}return BPromise[_0xc008('0xf')]()[_0xc008('0xc')](cmHopper[_0xc008('0x18')](_0x5560b1))[_0xc008('0xe')](loggerCatch(_0xc008('0x19')));};exports['countReScheduled']=function(_0x459fd9){return BPromise['resolve']()['then'](cmHopper[_0xc008('0x1a')](_0x459fd9))[_0xc008('0xe')](loggerCatch(_0xc008('0x1b')));};exports[_0xc008('0x1c')]=function(_0x5410f5){return BPromise['resolve']()['then'](cmHopper[_0xc008('0x1c')]({'UserId':null},_0x5410f5,0x1))[_0xc008('0xe')](loggerCatch(_0xc008('0x1d')));};exports[_0xc008('0x1e')]=function(_0x5bebd9){return BPromise['resolve']()['then'](cmHopper['unlockContact']({'active':![]},_0x5bebd9,0x1))['catch'](loggerCatch(_0xc008('0x1f')));};exports[_0xc008('0x20')]=function(_0x25eae4){var _0x529961={};_0x529961[_0xc008('0x21')]=_0x25eae4[_0xc008('0x21')];_0x529961[_0xc008('0x22')]=_0x25eae4[_0xc008('0x22')];_0x529961['calleridnum']=_0x25eae4[_0xc008('0x23')];_0x529961[_0xc008('0x24')]=_0x25eae4['calleridname'];_0x529961['queue']=_0x25eae4['queue'];_0x529961[_0xc008('0x25')]=_0x25eae4[_0xc008('0x26')];_0x529961[_0xc008('0x27')]=_0x25eae4[_0xc008('0x26')];_0x529961[_0xc008('0x28')]=0x1;_0x529961[_0xc008('0x29')]=_0x25eae4[_0xc008('0x2a')];_0x529961[_0xc008('0x2b')]=_0x25eae4[_0xc008('0x2c')];_0x529961[_0xc008('0x2d')]=_0xc008('0x2e');_0x529961[_0xc008('0x2f')]='xcally-motion-preview';_0x529961[_0xc008('0x30')]=0x0;_0x529961[_0xc008('0x31')]=0x1;_0x529961['lastAssignedTo']=_0x25eae4[_0xc008('0x2c')];_0x529961[_0xc008('0x32')]=_0xc008('0x33');return BPromise[_0xc008('0xf')]()[_0xc008('0xc')](voiceQueueReport[_0xc008('0x34')](_0x529961))[_0xc008('0xe')](loggerCatch(_0xc008('0x35')));};exports[_0xc008('0x36')]=function(_0x4f14d2,_0x415b87){return BPromise[_0xc008('0xf')]()[_0xc008('0xc')](cmHopper[_0xc008('0x36')](_0x4f14d2,_0x415b87))[_0xc008('0xe')](loggerCatch(_0xc008('0x37')));};exports[_0xc008('0x38')]=function(_0x5d0e06){return BPromise[_0xc008('0xf')]()[_0xc008('0xc')](cmHopper['rescheduleContact'](_0x5d0e06,!![],!![]))[_0xc008('0xe')](loggerCatch(_0xc008('0x39')));}; \ 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 ca0e02f..2e82c51 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 _0x4f7a=['isUndefined','string','\x22%s\x22\x20<%s>','isEmpty','isActive','isNil','addVariables','Queue','name','format','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','dialQueueProject2','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','createdAt','updatedAt','XMD-','toUpper','toLower','updateOriginated','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','responsetime','endtime','logAgent','ringtime','starttime','logLookAgent','YYYY-MM-DD\x20HH:mm:ss','talktime','Failure','variablesAction','RECALL','uniqueid','originate','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','pTalking','IsNotLoggedIn','buildObj','lastevent','queue','interface','channelAgent','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','seconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','membername','countglobal','callbackuniqueid','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','random','extractCalleridName','extractCalleridNumber','match','moment','../../../../config/logger','preview','XCALLY_IP_AGI','milliseconds','loggerCatch','error','inspect','info','loggerError','logger2','message','getCallerId'];(function(_0xe32f8,_0x342d1d){var _0x52dcd1=function(_0x488386){while(--_0x488386){_0xe32f8['push'](_0xe32f8['shift']());}};_0x52dcd1(++_0x342d1d);}(_0x4f7a,0x105));var _0xa4f7=function(_0x3b5840,_0x4cede2){_0x3b5840=_0x3b5840-0x0;var _0x345095=_0x4f7a[_0x3b5840];return _0x345095;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xa4f7('0x0'));var logger=require(_0xa4f7('0x1'))(_0xa4f7('0x2'));var ipAgi=process['env'][_0xa4f7('0x3')]||'127.0.0.1';function getSeconds(_0x30d02d,_0x196f40){var _0x170150=moment(_0x30d02d)['milliseconds'](0x0);var _0x31c8ab=moment(_0x196f40)[_0xa4f7('0x4')](0x0);return _0x170150['diff'](_0x31c8ab,'seconds');}exports[_0xa4f7('0x5')]=function(_0x1e3ff3){return function(_0x1410a1){logger[_0xa4f7('0x6')](_0x1e3ff3,util[_0xa4f7('0x7')](_0x1410a1,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x390174,_0x2f1c78){logger[_0xa4f7('0x8')](_0x390174,util[_0xa4f7('0x7')](_0x2f1c78,{'showHidden':![],'depth':null}));};exports[_0xa4f7('0x9')]=function(_0x43ff9e,_0x9505f){logger['error'](_0x43ff9e,util['inspect'](_0x9505f,{'showHidden':![],'depth':null}));};exports[_0xa4f7('0xa')]=function(_0x1917f6){return function(_0x4a8cf9){logger[_0xa4f7('0x8')](_0x1917f6,util[_0xa4f7('0x7')](_0x4a8cf9,{'showHidden':![],'depth':null}));};};exports[_0xa4f7('0xb')]=function(_0x54bbd4,_0x1f60b3,_0x321bd7){return{'message':_0x54bbd4,'unlock':_0x1f60b3,'active':_0x321bd7};};exports[_0xa4f7('0xc')]=function(_0x593304,_0xd626dc,_0x1ddb6b){if(!_[_0xa4f7('0xd')](_0x1ddb6b)&&_0xa4f7('0xe')===typeof _0x1ddb6b&&!_['isEmpty'](_0x1ddb6b)){if(!_[_0xa4f7('0xd')](_0xd626dc)&&_0xa4f7('0xe')===typeof _0xd626dc&&!_['isEmpty'](_0xd626dc)){return util['format'](_0xa4f7('0xf'),_0xd626dc,_0x1ddb6b);}return util['format'](_0xa4f7('0xf'),_0x1ddb6b,_0x1ddb6b);}if(!_[_0xa4f7('0xd')](_0x593304)&&'string'===typeof _0x593304&&!_[_0xa4f7('0x10')](_0x593304)){return _0x593304;}return'\x22\x22\x20<>';};exports[_0xa4f7('0x11')]=function(_0xac81c9){if(_[_0xa4f7('0x12')](_0xac81c9)){return![];}return _0xac81c9;};exports[_0xa4f7('0x13')]=function(_0x181911,_0x44a54c,_0x48ec43,_0x18bb7a,_0x2ffd9a,_0x1d686a){var _0x33ef47={'XMD-QUEUE':_0x44a54c['Queue']?_0x44a54c[_0xa4f7('0x14')][_0xa4f7('0x15')]:'','XMD-CALLERID':_0x18bb7a,'XMD-CALLERID-PREVIEW':_0x1d686a?util[_0xa4f7('0x16')](_0xa4f7('0xf'),_0x1d686a[_0xa4f7('0x17')],_0x1d686a[_0xa4f7('0x18')]):_0x18bb7a,'XMD-DIALID':_0x2ffd9a,'XMD-CONTACTID':_0x44a54c[_0xa4f7('0x19')],'XMD-CDRTYPE':_0xa4f7('0x1a'),'CALLERID(all)':_0x18bb7a,'XMD-VOICEQUEUEID':_0x44a54c[_0xa4f7('0x1b')],'XMD-DIALCHANNEL':_0x48ec43,'XMD-DIALTIMEOUT':_0x181911[_0xa4f7('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0xa4f7('0x16')](_0xa4f7('0x1d'),_0x181911['dialQueueProject2']?'g':'',_[_0xa4f7('0x10')](_0x181911[_0xa4f7('0x1e')])?'':_0xa4f7('0x1f')),'XMD-DIALURL':_0x181911[_0xa4f7('0x20')]||'','XMD-AGI':_0x181911[_0xa4f7('0x21')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x181911['dialQueueProject']):_0xa4f7('0x22'),'XMD-AGIAFTER':_0x181911['dialQueueProject2']?util[_0xa4f7('0x16')](_0xa4f7('0x23'),ipAgi,_0x181911[_0xa4f7('0x24')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x1d686a?_0x1d686a[_0xa4f7('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x1d686a?_0x1d686a['originatecalleridname']:'','XMD-DESTINATION':_0xa4f7('0x26')};if(!_['isEmpty'](_0x181911[_0xa4f7('0x1e')])){_0x33ef47[util[_0xa4f7('0x16')]('%s',_0xa4f7('0x27'))]=_0x181911[_0xa4f7('0x1e')];_0x33ef47[util['format']('%s',_0xa4f7('0x28'))]=_0x2ffd9a;}if(_0x44a54c&&_0x44a54c[_0xa4f7('0x29')]){for(var _0x35c557 in _0x44a54c[_0xa4f7('0x29')]){if(_0x44a54c[_0xa4f7('0x29')]['hasOwnProperty'](_0x35c557)){if(!_[_0xa4f7('0x12')](_0x44a54c[_0xa4f7('0x29')][_0x35c557])&&_0x35c557!=='id'&&_0x35c557!=='tags'&&_0x35c557!==_0xa4f7('0x2a')&&_0x35c557!==_0xa4f7('0x2b')){_0x33ef47[util[_0xa4f7('0x16')]('%s%s',_0xa4f7('0x2c'),_[_0xa4f7('0x2d')](_0x35c557))]=_0x44a54c['Contact'][_0x35c557];}}}}return _0x33ef47;};exports['toLowerVariables']=function(_0x2aafcb){var _0x9b63ff={};for(var _0x342255 in _0x2aafcb){if(_0x2aafcb['hasOwnProperty'](_0x342255)){_0x9b63ff[util[_0xa4f7('0x16')]('%s',_[_0xa4f7('0x2e')](_0x342255))]=_0x2aafcb[_0x342255];}}return{'variables':_0x9b63ff};};exports[_0xa4f7('0x2f')]=function(_0x2ea41c,_0x41bd33){if(!_[_0xa4f7('0x12')](_0x2ea41c)){if(_0x2ea41c[_0xa4f7('0x30')](_0xa4f7('0x31'))){if(_0x2ea41c[_0xa4f7('0x31')]>0x0){_0x2ea41c['originated']-=0x1;}else{logger[_0xa4f7('0x6')](_0xa4f7('0x32'),_0x41bd33);}}}else{logger[_0xa4f7('0x6')](_0xa4f7('0x33'),_0x41bd33);}};exports[_0xa4f7('0x34')]=function(_0x3e401d){var _0x3f01fa=moment()[_0xa4f7('0x16')]('YYYY-MM-DD\x20HH:mm:ss');_0x3e401d[_0xa4f7('0x35')]=0xd;_0x3e401d[_0xa4f7('0x36')]='Blacklist';_0x3e401d['starttime']=_0x3f01fa;_0x3e401d[_0xa4f7('0x37')]=_0x3f01fa;_0x3e401d[_0xa4f7('0x38')]=_0x3f01fa;};exports[_0xa4f7('0x39')]=function(_0x57db76,_0x2318fd,_0x24488e){var _0x670a31=moment()[_0xa4f7('0x16')]('YYYY-MM-DD\x20HH:mm:ss');_0x57db76[_0xa4f7('0x35')]=_0x2318fd;_0x57db76[_0xa4f7('0x36')]=_0x24488e;_0x57db76[_0xa4f7('0x37')]=_0x670a31;_0x57db76[_0xa4f7('0x3a')]=getSeconds(_0x57db76[_0xa4f7('0x37')],_0x57db76[_0xa4f7('0x3b')]);};exports[_0xa4f7('0x3c')]=function(_0x1dc644,_0x3601f2,_0x256879){_0x1dc644['membername']=_0x3601f2;_0x1dc644['UserId']=_0x256879;};exports['logCustomer']=function(_0x22dfdd,_0x4a8215,_0x21f672){var _0x31f398=moment()[_0xa4f7('0x16')](_0xa4f7('0x3d'));_0x22dfdd[_0xa4f7('0x35')]=_0x4a8215;_0x22dfdd['statedesc']=_0x21f672;_0x22dfdd[_0xa4f7('0x37')]=_0x22dfdd[_0xa4f7('0x37')]?_0x22dfdd[_0xa4f7('0x37')]:_0x31f398;_0x22dfdd[_0xa4f7('0x38')]=_0x22dfdd[_0xa4f7('0x38')]?_0x22dfdd[_0xa4f7('0x38')]:_0x31f398;_0x22dfdd[_0xa4f7('0x3a')]=getSeconds(_0x22dfdd[_0xa4f7('0x37')]||0x0,_0x22dfdd[_0xa4f7('0x3b')]||0x0);_0x22dfdd[_0xa4f7('0x3e')]=_0x22dfdd['answertime']?getSeconds(_0x22dfdd[_0xa4f7('0x38')],_0x22dfdd['answertime']):0x0;};exports['isFailure']=function(_0x30aa9a){return _0x30aa9a===_0xa4f7('0x3f');};exports[_0xa4f7('0x40')]=function(_0x3cd8a0,_0x179a30,_0x590a09,_0x3a7cfc,_0x197a3a){var _0x158a08=_0x3a7cfc?_0xa4f7('0x41'):_0x3cd8a0[_0xa4f7('0x17')];_0x158a08=_0x197a3a?'BOOKED':_0x158a08;return{'actionid':_0x3cd8a0[_0xa4f7('0x42')],'action':_0xa4f7('0x43'),'channel':_0x3cd8a0['channelAgent'],'callerid':util[_0xa4f7('0x16')](_0xa4f7('0xf'),_0x158a08,_0x3cd8a0[_0xa4f7('0x18')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x590a09,'timeout':(_0x179a30[_0xa4f7('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3cd8a0[_0xa4f7('0x42')]};};exports[_0xa4f7('0x45')]=function(_0x5b1974){return _0x5b1974[_0xa4f7('0x46')]+_0x5b1974[_0xa4f7('0x47')]+_0x5b1974[_0xa4f7('0x48')]+_0x5b1974[_0xa4f7('0x49')]+_0x5b1974[_0xa4f7('0x4a')];};exports['cloneAction']=function(_0x4cf939){var _0x3d631b=_[_0xa4f7('0x4b')](_0x4cf939);_0x3d631b['state']=0xf;_0x3d631b['statedesc']=_0xa4f7('0x4c');return _0x3d631b;};exports[_0xa4f7('0x4d')]=function(_0x44e8a1,_0x1a4afb,_0x179e48){var _0x46ed86={};_0x46ed86[_0x1a4afb]=_0x44e8a1[_0x1a4afb];_0x46ed86[_0xa4f7('0x4e')]=![];_0x46ed86[_0xa4f7('0x4f')]=moment()[_0xa4f7('0x50')](_0x179e48,'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss');_0x46ed86[_0xa4f7('0x19')]=_0x44e8a1[_0xa4f7('0x19')];_0x46ed86[_0xa4f7('0x51')]=_0x44e8a1[_0xa4f7('0x51')];_0x46ed86[_0xa4f7('0x1b')]=_0x44e8a1[_0xa4f7('0x1b')]||undefined;return _0x46ed86;};exports[_0xa4f7('0x52')]=function(_0x179fb3,_0xfd2cde){if(!_['isNil'](_0x179fb3)){if(_0x179fb3['pTalking']>0x0){_0x179fb3[_0xa4f7('0x53')]-=0x1;}else{logger['error'](_0xfd2cde,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xa4f7('0x6')](_0xfd2cde,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xa4f7('0x54')]=function(_0x39d5a5){if(_0x39d5a5<=0x0){return!![];}return![];};exports[_0xa4f7('0x55')]=function(_0x14c6b8,_0x2891fd){_0x14c6b8[_0xa4f7('0x56')]=_0x2891fd;_0x14c6b8[_0xa4f7('0x15')]=_0x14c6b8[_0xa4f7('0x57')];_0x14c6b8[_0xa4f7('0x58')]=_0x14c6b8[_0xa4f7('0x59')];return _0x14c6b8;};exports[_0xa4f7('0x5a')]=function(_0x22ee53){var _0x50774f={};_0x50774f['queue']=_0x22ee53[_0xa4f7('0x57')];_0x50774f['interface']=_0x22ee53[_0xa4f7('0x59')];_0x50774f[_0xa4f7('0x42')]=_0x22ee53[_0xa4f7('0x42')];return _0x50774f;};exports[_0xa4f7('0x5b')]=function(_0x1e9079){var _0xa91ba7=[];for(var _0x1b1dcb in _0x1e9079){if(_0x1e9079[_0xa4f7('0x30')](_0x1b1dcb)){if(!_[_0xa4f7('0x12')](_0x1e9079[_0x1b1dcb])&&_0x1e9079[_0x1b1dcb][_0xa4f7('0x35')]===_0xa4f7('0x5c')&&_0x1e9079[_0x1b1dcb][_0xa4f7('0x5d')]===_0xa4f7('0x5e')){_0xa91ba7[_0xa4f7('0x5f')](_0x1e9079[_0x1b1dcb]['id']);}}}return _0xa91ba7;};exports[_0xa4f7('0x60')]=function(_0xe9ccba){var _0x16e38e=moment()[_0xa4f7('0x4')](0x0);var _0x4a834d=moment(_0xe9ccba)[_0xa4f7('0x4')](0x0);return _0x16e38e['diff'](_0x4a834d,_0xa4f7('0x61'));};exports[_0xa4f7('0x62')]=function(_0x244358){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x244358[_0xa4f7('0x19')],'ListId':_0x244358[_0xa4f7('0x51')],'VoiceQueueId':_0x244358[_0xa4f7('0x1b')]||undefined,'CampaignId':_0x244358[_0xa4f7('0x63')]||undefined};};exports[_0xa4f7('0x64')]=function(_0x153bc0){if(_0x153bc0===_0xa4f7('0x42')||_0x153bc0===_0xa4f7('0x65')||_0x153bc0==='queue'||_0x153bc0===_0xa4f7('0x66')||_0x153bc0===_0xa4f7('0x67')||_0x153bc0==='dialAnswer'||_0x153bc0===_0xa4f7('0x68')||_0x153bc0===_0xa4f7('0x59')||_0x153bc0===_0xa4f7('0x17')||_0x153bc0===_0xa4f7('0x4e')||_0x153bc0==='calleridnum'||_0x153bc0===_0xa4f7('0x4f')||_0x153bc0===_0xa4f7('0x46')||_0x153bc0===_0xa4f7('0x47')||_0x153bc0===_0xa4f7('0x48')||_0x153bc0===_0xa4f7('0x69')||_0x153bc0==='callback'||_0x153bc0===_0xa4f7('0x6a')||_0x153bc0==='callbackat'||_0x153bc0==='recallme'||_0x153bc0===_0xa4f7('0x19')||_0x153bc0==='ListId'||_0x153bc0===_0xa4f7('0x6b')||_0x153bc0==='VoiceQueueId'||_0x153bc0===_0xa4f7('0x6c')||_0x153bc0===_0xa4f7('0x6d')||_0x153bc0===_0xa4f7('0x6e')||_0x153bc0==='xmd-phone'||_0x153bc0===_0xa4f7('0x6f')||_0x153bc0===_0xa4f7('0x70')||_0x153bc0===_0xa4f7('0x71')||_0x153bc0===_0xa4f7('0x72')||_0x153bc0===_0xa4f7('0x73')||_0x153bc0===_0xa4f7('0x74')||_0x153bc0===_0xa4f7('0x75')||_0x153bc0==='xmd-cdrtype'||_0x153bc0===_0xa4f7('0x76')||_0x153bc0===_0xa4f7('0x77')||_0x153bc0===_0xa4f7('0x78')||_0x153bc0===_0xa4f7('0x79')||_0x153bc0===_0xa4f7('0x7a')||_0x153bc0===_0xa4f7('0x7b')||_0x153bc0===_0xa4f7('0x7c')||_0x153bc0==='rtpaudioqosloss'||_0x153bc0===_0xa4f7('0x7d')||_0x153bc0===_0xa4f7('0x7e')||_0x153bc0===_0xa4f7('0x7f')||_0x153bc0===_0xa4f7('0x79')||_0x153bc0===_0xa4f7('0x7a')||_0x153bc0===_0xa4f7('0x7b')||_0x153bc0==='rtpaudioqosjitterbridged'||_0x153bc0===_0xa4f7('0x80')||_0x153bc0===_0xa4f7('0x7d')||_0x153bc0===_0xa4f7('0x7e')||_0x153bc0===_0xa4f7('0x7f')||_0x153bc0===_0xa4f7('0x81')||_0x153bc0===_0xa4f7('0x82')||_0x153bc0===_0xa4f7('0x35')||_0x153bc0===_0xa4f7('0x36')){return![];}return!![];};exports[_0xa4f7('0x83')]=function(_0x2b2ad0,_0xb53398){var _0x1f23f5,_0x9fa737,_0x576133;if(_0xb53398<=0x0){_0xb53398=0x1;}_0x1f23f5=new RegExp('\x5cw{0,'+_0xb53398+'}$');_0x9fa737=Math[_0xa4f7('0x84')](0xa,_0xb53398-0x1);_0x576133=Math[_0xa4f7('0x84')](0xa,_0xb53398)-0x1;return util[_0xa4f7('0x16')]('%s',_['replace'](_0x2b2ad0,_0x1f23f5,_[_0xa4f7('0x85')](_0x9fa737,_0x576133)));};exports[_0xa4f7('0x86')]=function(_0xbcf0e7){var _0x54ade1=_0xbcf0e7['match'](/"(.*?)"/);return _0x54ade1?_0x54ade1[0x1]:_0xbcf0e7;};exports[_0xa4f7('0x87')]=function(_0x21a867){var _0x101a1a=_0x21a867[_0xa4f7('0x88')](/<(.*?)>/);return _0x101a1a?_0x101a1a[0x1]:_0x21a867;}; \ No newline at end of file +var _0xa76e=['info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','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','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','Blacklist','starttime','responsetime','endtime','logAgent','state','statedesc','ringtime','logLookAgent','membername','UserId','logCustomer','answertime','isFailure','Failure','variablesAction','RECALL','originate','channelAgent','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','IsNotLoggedIn','buildObj','lastevent','queue','interface','uniqueid','agentReadyId','getDiff','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','active','countnoanswerretry','countglobal','callbackuniqueid','callbackat','xmd-voicequeueid','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','random','extractCalleridName','match','extractCalleridNumber','lodash','moment','env','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','logger'];(function(_0x552eb2,_0x2d592d){var _0x1104b4=function(_0x60c393){while(--_0x60c393){_0x552eb2['push'](_0x552eb2['shift']());}};_0x1104b4(++_0x2d592d);}(_0xa76e,0xfe));var _0xea76=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xa76e[_0x2fc012];return _0x2891f9;};'use strict';var util=require('util');var _=require(_0xea76('0x0'));var moment=require(_0xea76('0x1'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0xea76('0x2')]['XCALLY_IP_AGI']||_0xea76('0x3');function getSeconds(_0x368f89,_0xd37efd){var _0x4ed094=moment(_0x368f89)[_0xea76('0x4')](0x0);var _0x48ff4f=moment(_0xd37efd)[_0xea76('0x4')](0x0);return _0x4ed094['diff'](_0x48ff4f,_0xea76('0x5'));}exports[_0xea76('0x6')]=function(_0x5eb746){return function(_0x55aae7){logger[_0xea76('0x7')](_0x5eb746,util[_0xea76('0x8')](_0x55aae7,{'showHidden':![],'depth':null}));};};exports[_0xea76('0x9')]=function(_0x1792cc,_0x4ad53c){logger[_0xea76('0xa')](_0x1792cc,util[_0xea76('0x8')](_0x4ad53c,{'showHidden':![],'depth':null}));};exports[_0xea76('0xb')]=function(_0x47eb62,_0x36839c){logger[_0xea76('0x7')](_0x47eb62,util[_0xea76('0x8')](_0x36839c,{'showHidden':![],'depth':null}));};exports[_0xea76('0xc')]=function(_0x1fda40){return function(_0x296060){logger[_0xea76('0xa')](_0x1fda40,util[_0xea76('0x8')](_0x296060,{'showHidden':![],'depth':null}));};};exports[_0xea76('0xd')]=function(_0x3fdfed,_0x36ba46,_0x360fed){return{'message':_0x3fdfed,'unlock':_0x36ba46,'active':_0x360fed};};exports[_0xea76('0xe')]=function(_0x4184f3,_0x7fb08e,_0x4b250f){if(!_[_0xea76('0xf')](_0x4b250f)&&_0xea76('0x10')===typeof _0x4b250f&&!_[_0xea76('0x11')](_0x4b250f)){if(!_[_0xea76('0xf')](_0x7fb08e)&&_0xea76('0x10')===typeof _0x7fb08e&&!_[_0xea76('0x11')](_0x7fb08e)){return util[_0xea76('0x12')](_0xea76('0x13'),_0x7fb08e,_0x4b250f);}return util[_0xea76('0x12')](_0xea76('0x13'),_0x4b250f,_0x4b250f);}if(!_[_0xea76('0xf')](_0x4184f3)&&_0xea76('0x10')===typeof _0x4184f3&&!_['isEmpty'](_0x4184f3)){return _0x4184f3;}return'\x22\x22\x20<>';};exports[_0xea76('0x14')]=function(_0x56fd72){if(_[_0xea76('0x15')](_0x56fd72)){return![];}return _0x56fd72;};exports[_0xea76('0x16')]=function(_0x3765b0,_0x509eee,_0x5d7f91,_0x4bfc66,_0x2ab3b2,_0x2a934e){var _0x227ef9={'XMD-QUEUE':_0x509eee[_0xea76('0x17')]?_0x509eee['Queue'][_0xea76('0x18')]:'','XMD-CALLERID':_0x4bfc66,'XMD-CALLERID-PREVIEW':_0x2a934e?util['format'](_0xea76('0x13'),_0x2a934e[_0xea76('0x19')],_0x2a934e[_0xea76('0x1a')]):_0x4bfc66,'XMD-DIALID':_0x2ab3b2,'XMD-CONTACTID':_0x509eee[_0xea76('0x1b')],'XMD-CDRTYPE':_0xea76('0x1c'),'CALLERID(all)':_0x4bfc66,'XMD-VOICEQUEUEID':_0x509eee[_0xea76('0x1d')],'XMD-DIALCHANNEL':_0x5d7f91,'XMD-DIALTIMEOUT':_0x3765b0[_0xea76('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0xea76('0x12')](_0xea76('0x1f'),_0x3765b0[_0xea76('0x20')]?'g':'',_[_0xea76('0x11')](_0x3765b0[_0xea76('0x21')])?'':_0xea76('0x22')),'XMD-DIALURL':_0x3765b0[_0xea76('0x23')]||'','XMD-AGI':_0x3765b0[_0xea76('0x24')]?util[_0xea76('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3765b0[_0xea76('0x24')]):'NONE','XMD-AGIAFTER':_0x3765b0['dialQueueProject2']?util[_0xea76('0x12')](_0xea76('0x25'),ipAgi,_0x3765b0[_0xea76('0x20')]):_0xea76('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x2a934e?_0x2a934e[_0xea76('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x2a934e?_0x2a934e[_0xea76('0x28')]:'','XMD-DESTINATION':_0xea76('0x29')};if(!_['isEmpty'](_0x3765b0['monitor_format'])){_0x227ef9[util[_0xea76('0x12')]('%s',_0xea76('0x2a'))]=_0x3765b0[_0xea76('0x21')];_0x227ef9[util[_0xea76('0x12')]('%s',_0xea76('0x2b'))]=_0x2ab3b2;}if(_0x509eee&&_0x509eee[_0xea76('0x2c')]){for(var _0x12c18f in _0x509eee[_0xea76('0x2c')]){if(_0x509eee[_0xea76('0x2c')][_0xea76('0x2d')](_0x12c18f)){if(!_[_0xea76('0x15')](_0x509eee[_0xea76('0x2c')][_0x12c18f])&&_0x12c18f!=='id'&&_0x12c18f!==_0xea76('0x2e')&&_0x12c18f!==_0xea76('0x2f')&&_0x12c18f!==_0xea76('0x30')){_0x227ef9[util['format'](_0xea76('0x31'),_0xea76('0x32'),_[_0xea76('0x33')](_0x12c18f))]=_0x509eee['Contact'][_0x12c18f];}}}}return _0x227ef9;};exports[_0xea76('0x34')]=function(_0x2350e8){var _0x3ee573={};for(var _0x1a1165 in _0x2350e8){if(_0x2350e8['hasOwnProperty'](_0x1a1165)){_0x3ee573[util[_0xea76('0x12')]('%s',_['toLower'](_0x1a1165))]=_0x2350e8[_0x1a1165];}}return{'variables':_0x3ee573};};exports['updateOriginated']=function(_0x193ce8,_0x565cfe){if(!_['isNil'](_0x193ce8)){if(_0x193ce8[_0xea76('0x2d')](_0xea76('0x35'))){if(_0x193ce8[_0xea76('0x35')]>0x0){_0x193ce8[_0xea76('0x35')]-=0x1;}else{logger[_0xea76('0x7')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x565cfe);}}}else{logger[_0xea76('0x7')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x565cfe);}};exports[_0xea76('0x36')]=function(_0x5db745){var _0x312032=moment()['format'](_0xea76('0x37'));_0x5db745['state']=0xd;_0x5db745['statedesc']=_0xea76('0x38');_0x5db745[_0xea76('0x39')]=_0x312032;_0x5db745[_0xea76('0x3a')]=_0x312032;_0x5db745[_0xea76('0x3b')]=_0x312032;};exports[_0xea76('0x3c')]=function(_0x360fd3,_0x3541ef,_0x3f3264){var _0x344a83=moment()[_0xea76('0x12')](_0xea76('0x37'));_0x360fd3[_0xea76('0x3d')]=_0x3541ef;_0x360fd3[_0xea76('0x3e')]=_0x3f3264;_0x360fd3[_0xea76('0x3a')]=_0x344a83;_0x360fd3[_0xea76('0x3f')]=getSeconds(_0x360fd3[_0xea76('0x3a')],_0x360fd3[_0xea76('0x39')]);};exports[_0xea76('0x40')]=function(_0x3df95c,_0x51acdb,_0x93e49e){_0x3df95c[_0xea76('0x41')]=_0x51acdb;_0x3df95c[_0xea76('0x42')]=_0x93e49e;};exports[_0xea76('0x43')]=function(_0x12a708,_0x3df280,_0x384e1a){var _0x290802=moment()[_0xea76('0x12')](_0xea76('0x37'));_0x12a708[_0xea76('0x3d')]=_0x3df280;_0x12a708['statedesc']=_0x384e1a;_0x12a708['responsetime']=_0x12a708[_0xea76('0x3a')]?_0x12a708['responsetime']:_0x290802;_0x12a708['endtime']=_0x12a708['endtime']?_0x12a708[_0xea76('0x3b')]:_0x290802;_0x12a708[_0xea76('0x3f')]=getSeconds(_0x12a708[_0xea76('0x3a')]||0x0,_0x12a708[_0xea76('0x39')]||0x0);_0x12a708['talktime']=_0x12a708[_0xea76('0x44')]?getSeconds(_0x12a708[_0xea76('0x3b')],_0x12a708[_0xea76('0x44')]):0x0;};exports[_0xea76('0x45')]=function(_0x5c95fd){return _0x5c95fd===_0xea76('0x46');};exports[_0xea76('0x47')]=function(_0x2517d2,_0x4fabf1,_0x49f7d4,_0x4884d8,_0x3a8034){var _0x52732e=_0x4884d8?_0xea76('0x48'):_0x2517d2[_0xea76('0x19')];_0x52732e=_0x3a8034?'BOOKED':_0x52732e;return{'actionid':_0x2517d2['uniqueid'],'action':_0xea76('0x49'),'channel':_0x2517d2[_0xea76('0x4a')],'callerid':util[_0xea76('0x12')](_0xea76('0x13'),_0x52732e,_0x2517d2[_0xea76('0x1a')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x49f7d4,'timeout':(_0x4fabf1['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2517d2['uniqueid']};};exports[_0xea76('0x4b')]=function(_0xa53f62){return _0xa53f62[_0xea76('0x4c')]+_0xa53f62[_0xea76('0x4d')]+_0xa53f62['countnoanswerretry']+_0xa53f62[_0xea76('0x4e')]+_0xa53f62['countnosuchnumberretry'];};exports[_0xea76('0x4f')]=function(_0x1ac55d){var _0x549a27=_[_0xea76('0x50')](_0x1ac55d);_0x549a27['state']=0xf;_0x549a27['statedesc']=_0xea76('0x51');return _0x549a27;};exports[_0xea76('0x52')]=function(_0x1e85d0,_0x24d4a8,_0x4af066){var _0x1cb4bf={};_0x1cb4bf[_0x24d4a8]=_0x1e85d0[_0x24d4a8];_0x1cb4bf['active']=![];_0x1cb4bf[_0xea76('0x53')]=moment()[_0xea76('0x54')](_0x4af066,_0xea76('0x55'))[_0xea76('0x12')](_0xea76('0x37'));_0x1cb4bf[_0xea76('0x1b')]=_0x1e85d0[_0xea76('0x1b')];_0x1cb4bf[_0xea76('0x56')]=_0x1e85d0[_0xea76('0x56')];_0x1cb4bf[_0xea76('0x1d')]=_0x1e85d0[_0xea76('0x1d')]||undefined;return _0x1cb4bf;};exports[_0xea76('0x57')]=function(_0x5c3f0d,_0x3ea981){if(!_['isNil'](_0x5c3f0d)){if(_0x5c3f0d['pTalking']>0x0){_0x5c3f0d[_0xea76('0x58')]-=0x1;}else{logger[_0xea76('0x7')](_0x3ea981,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xea76('0x7')](_0x3ea981,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xea76('0x59')]=function(_0x4dfd6b){if(_0x4dfd6b<=0x0){return!![];}return![];};exports[_0xea76('0x5a')]=function(_0x108280,_0x2d87f3){_0x108280[_0xea76('0x5b')]=_0x2d87f3;_0x108280['name']=_0x108280[_0xea76('0x5c')];_0x108280[_0xea76('0x5d')]=_0x108280['channelAgent'];return _0x108280;};exports['buildAcw']=function(_0x221131){var _0xb2040d={};_0xb2040d[_0xea76('0x5c')]=_0x221131[_0xea76('0x5c')];_0xb2040d[_0xea76('0x5d')]=_0x221131[_0xea76('0x4a')];_0xb2040d[_0xea76('0x5e')]=_0x221131[_0xea76('0x5e')];return _0xb2040d;};exports[_0xea76('0x5f')]=function(_0x1d0f97){var _0x132f21=[];for(var _0x250878 in _0x1d0f97){if(_0x1d0f97[_0xea76('0x2d')](_0x250878)){if(!_[_0xea76('0x15')](_0x1d0f97[_0x250878])&&_0x1d0f97[_0x250878][_0xea76('0x3d')]==='not_inuse'&&_0x1d0f97[_0x250878]['status']==='reachable'){_0x132f21['push'](_0x1d0f97[_0x250878]['id']);}}}return _0x132f21;};exports[_0xea76('0x60')]=function(_0x5e3680){var _0xca5f9=moment()[_0xea76('0x4')](0x0);var _0x304725=moment(_0x5e3680)[_0xea76('0x4')](0x0);return _0xca5f9['diff'](_0x304725,'seconds');};exports[_0xea76('0x61')]=function(_0x1b4677){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1b4677[_0xea76('0x1b')],'ListId':_0x1b4677[_0xea76('0x56')],'VoiceQueueId':_0x1b4677[_0xea76('0x1d')]||undefined,'CampaignId':_0x1b4677[_0xea76('0x62')]||undefined};};exports[_0xea76('0x63')]=function(_0x2fc026){if(_0x2fc026===_0xea76('0x5e')||_0x2fc026===_0xea76('0x64')||_0x2fc026===_0xea76('0x5c')||_0x2fc026==='type'||_0x2fc026===_0xea76('0x65')||_0x2fc026===_0xea76('0x66')||_0x2fc026===_0xea76('0x41')||_0x2fc026===_0xea76('0x4a')||_0x2fc026===_0xea76('0x19')||_0x2fc026===_0xea76('0x67')||_0x2fc026===_0xea76('0x1a')||_0x2fc026==='scheduledat'||_0x2fc026===_0xea76('0x4c')||_0x2fc026===_0xea76('0x4d')||_0x2fc026===_0xea76('0x68')||_0x2fc026===_0xea76('0x69')||_0x2fc026==='callback'||_0x2fc026===_0xea76('0x6a')||_0x2fc026===_0xea76('0x6b')||_0x2fc026==='recallme'||_0x2fc026===_0xea76('0x1b')||_0x2fc026===_0xea76('0x56')||_0x2fc026===_0xea76('0x42')||_0x2fc026===_0xea76('0x1d')||_0x2fc026==='sipcallid'||_0x2fc026===_0xea76('0x6c')||_0x2fc026==='xmd-queue'||_0x2fc026===_0xea76('0x6d')||_0x2fc026==='xmd-listid'||_0x2fc026===_0xea76('0x6e')||_0x2fc026===_0xea76('0x6f')||_0x2fc026===_0xea76('0x70')||_0x2fc026==='xmd-dialid'||_0x2fc026===_0xea76('0x71')||_0x2fc026===_0xea76('0x72')||_0x2fc026===_0xea76('0x73')||_0x2fc026==='xmd-callerid'||_0x2fc026===_0xea76('0x74')||_0x2fc026==='xmd-agi'||_0x2fc026===_0xea76('0x75')||_0x2fc026===_0xea76('0x76')||_0x2fc026===_0xea76('0x77')||_0x2fc026===_0xea76('0x78')||_0x2fc026===_0xea76('0x79')||_0x2fc026===_0xea76('0x7a')||_0x2fc026===_0xea76('0x7b')||_0x2fc026==='rtpaudioqosrttbridged'||_0x2fc026===_0xea76('0x75')||_0x2fc026==='rtpaudioqosbridged'||_0x2fc026==='rtpaudioqosjitter'||_0x2fc026===_0xea76('0x78')||_0x2fc026===_0xea76('0x79')||_0x2fc026===_0xea76('0x7a')||_0x2fc026===_0xea76('0x7b')||_0x2fc026==='rtpaudioqosrttbridged'||_0x2fc026===_0xea76('0x7c')||_0x2fc026===_0xea76('0x7d')||_0x2fc026==='state'||_0x2fc026==='statedesc'){return![];}return!![];};exports[_0xea76('0x7e')]=function(_0x1676a7,_0x5c7fe7){var _0x417e73,_0x514b84,_0x5cabba;if(_0x5c7fe7<=0x0){_0x5c7fe7=0x1;}_0x417e73=new RegExp('\x5cw{0,'+_0x5c7fe7+'}$');_0x514b84=Math[_0xea76('0x7f')](0xa,_0x5c7fe7-0x1);_0x5cabba=Math[_0xea76('0x7f')](0xa,_0x5c7fe7)-0x1;return util[_0xea76('0x12')]('%s',_['replace'](_0x1676a7,_0x417e73,_[_0xea76('0x80')](_0x514b84,_0x5cabba)));};exports[_0xea76('0x81')]=function(_0x1c75c2){var _0x177b71=_0x1c75c2[_0xea76('0x82')](/"(.*?)"/);return _0x177b71?_0x177b71[0x1]:_0x1c75c2;};exports[_0xea76('0x83')]=function(_0x5226ee){var _0x11fafb=_0x5226ee[_0xea76('0x82')](/<(.*?)>/);return _0x11fafb?_0x11fafb[0x1]:_0x5226ee;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 891d53f..0b728e9 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(_0x391ece,_0xc9da45){var _0x11313e=function(_0x24616b){while(--_0x24616b){_0x391ece['push'](_0x391ece['shift']());}};_0x11313e(++_0xc9da45);}(_0x5f2f,0x73));var _0xf5f2=function(_0x467ad7,_0x69f24c){_0x467ad7=_0x467ad7-0x0;var _0x277320=_0x5f2f[_0x467ad7];return _0x277320;};'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(_0xb96f8b,_0x4b0abe){var _0x43a994=function(_0x5bb90e){while(--_0x5bb90e){_0xb96f8b['push'](_0xb96f8b['shift']());}};_0x43a994(++_0x4b0abe);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c2863,_0x1b2cee){_0x3c2863=_0x3c2863-0x0;var _0x2c3d27=_0xb10b[_0x3c2863];return _0x2c3d27;};'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 ee93f3a..4707f55 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 _0x4ce0=['prototype','mergeFromDatabase','initAgents','length','initTelephones','isUndefined','initTrunks','initVoiceQueues','voiceQueues','triggers','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','deskAccounts','sugarcrmAccounts','vtigerAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initFaxAccounts','faxAccounts','exports','bluebird','util','moment','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','SIP/%s','name','isNil','interface','format','total','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','answered','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete'];(function(_0x4c326a,_0x193751){var _0x31a36a=function(_0x4cc03f){while(--_0x4cc03f){_0x4c326a['push'](_0x4c326a['shift']());}};_0x31a36a(++_0x193751);}(_0x4ce0,0x91));var _0x04ce=function(_0x189065,_0x321e33){_0x189065=_0x189065-0x0;var _0x281de2=_0x4ce0[_0x189065];return _0x281de2;};'use strict';var BPromise=require(_0x04ce('0x0'));var util=require(_0x04ce('0x1'));var _=require('lodash');var moment=require(_0x04ce('0x2'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0x04ce('0x3'));var Trigger=require(_0x04ce('0x4'));var Template=require(_0x04ce('0x5'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x04ce('0x6'));var ZendeskAccount=require(_0x04ce('0x7'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x04ce('0x8'));var ZohoAccount=require(_0x04ce('0x9'));var DeskAccount=require(_0x04ce('0xa'));var VtigerAccount=require(_0x04ce('0xb'));var ServicenowAccount=require(_0x04ce('0xc'));var Dynamics365Account=require(_0x04ce('0xd'));var FreshsalesAccount=require(_0x04ce('0xe'));var FaxAccount=require(_0x04ce('0xf'));var Realtime=function(){this[_0x04ce('0x10')]={};this[_0x04ce('0x11')]={};this[_0x04ce('0x12')]={};this['voiceQueues']={};this['triggers']={};this['campaigns']={};this[_0x04ce('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x04ce('0x14')]={};this[_0x04ce('0x15')]={};this[_0x04ce('0x16')]={};this[_0x04ce('0x17')]={};this[_0x04ce('0x18')]={};this[_0x04ce('0x19')]={};this[_0x04ce('0x1a')]={};this['sugarcrmAccounts']={};this[_0x04ce('0x1b')]={};this[_0x04ce('0x1c')]={};this['deskAccounts']={};this['vtigerAccounts']={};this[_0x04ce('0x1d')]={};this[_0x04ce('0x1e')]={};this[_0x04ce('0x1f')]={};this['faxAccounts']={};};function freeIsNotKey(_0x2ffc74,_0x5d8d65,_0x46809e){var _0x596a11=_[_0x04ce('0x20')](_0x2ffc74,function(_0x4f899f,_0x4ebb1e){return _0x4f899f[_0x46809e];});for(var _0x5b0917 in _0x5d8d65){if(_0x5d8d65[_0x04ce('0x21')](_0x5b0917)){if(!_0x596a11[_0x5b0917]){delete _0x5d8d65[_0x5b0917];}}}}function freeIsNotKeySip(_0x5d13f0,_0x430d9b){var _0x551bc8=_['mapKeys'](_0x5d13f0,function(_0x1b3a79,_0x589308){return util['format'](_0x04ce('0x22'),_0x1b3a79[_0x04ce('0x23')]);});for(var _0xf8c62 in _0x430d9b){if(_0x430d9b[_0x04ce('0x21')](_0xf8c62)){if(!_0x551bc8[_0xf8c62]){delete _0x430d9b[_0xf8c62];}}}}function freeIsNotKeyAgent(_0x5cfe4c,_0x413110){var _0x230af7=_[_0x04ce('0x20')](_0x5cfe4c,function(_0x22e4ba,_0x4779c3){var _0x52f7ff=_[_0x04ce('0x24')](_0x22e4ba[_0x04ce('0x25')])?util[_0x04ce('0x26')](_0x04ce('0x22'),_0x22e4ba[_0x04ce('0x23')]):_0x22e4ba[_0x04ce('0x25')];return _0x52f7ff;});for(var _0x409a02 in _0x413110){if(_0x413110[_0x04ce('0x21')](_0x409a02)){if(!_0x230af7[_0x409a02]){delete _0x413110[_0x409a02];}}}}function clearVoiceCallReports(_0x40f826){_0x40f826[_0x04ce('0x27')]=0x0;_0x40f826['answered']=0x0;_0x40f826['sumHoldTime']=0x0;_0x40f826[_0x04ce('0x28')]=0x0;_0x40f826[_0x04ce('0x29')]=0x0;}function clearCampaigns(_0x44232b){if(!_[_0x04ce('0x2a')](_0x44232b)){for(var _0x342bf0 in _0x44232b){if(_0x44232b[_0x04ce('0x21')](_0x342bf0)){_0x44232b[_0x342bf0]['ivrTotalCallsDays']=0x0;_0x44232b[_0x342bf0][_0x04ce('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x4cf3c2){if(!_[_0x04ce('0x2a')](_0x4cf3c2)){for(var _0x13deab in _0x4cf3c2){if(_0x4cf3c2[_0x04ce('0x21')](_0x13deab)){_0x4cf3c2[_0x13deab][_0x04ce('0x27')]=0x0;_0x4cf3c2[_0x13deab][_0x04ce('0x2c')]=0x0;_0x4cf3c2[_0x13deab]['unmanaged']=0x0;_0x4cf3c2[_0x13deab][_0x04ce('0x2d')]=0x0;_0x4cf3c2[_0x13deab][_0x04ce('0x2e')]=0x0;_0x4cf3c2[_0x13deab][_0x04ce('0x28')]=0x0;_0x4cf3c2[_0x13deab][_0x04ce('0x29')]=0x0;_0x4cf3c2[_0x13deab][_0x04ce('0x2f')]=0x0;_0x4cf3c2[_0x13deab][_0x04ce('0x30')]=0x0;_0x4cf3c2[_0x13deab]['outboundBusyCallsDay']=0x0;_0x4cf3c2[_0x13deab][_0x04ce('0x31')]=0x0;_0x4cf3c2[_0x13deab][_0x04ce('0x32')]=0x0;_0x4cf3c2[_0x13deab][_0x04ce('0x33')]=0x0;_0x4cf3c2[_0x13deab][_0x04ce('0x34')]=0x0;_0x4cf3c2[_0x13deab]['outboundDropCallsDayCallersExit']=0x0;_0x4cf3c2[_0x13deab][_0x04ce('0x35')]=0x0;_0x4cf3c2[_0x13deab]['outboundOriginateFailureCallsDay']=0x0;_0x4cf3c2[_0x13deab][_0x04ce('0x36')]=0x0;_0x4cf3c2[_0x13deab]['outboundReCallsDay']=0x0;_0x4cf3c2[_0x13deab][_0x04ce('0x2f')]=0x0;_0x4cf3c2[_0x13deab][_0x04ce('0x37')]=0x0;_0x4cf3c2[_0x13deab][_0x04ce('0x38')]=!![];}}}}Realtime[_0x04ce('0x39')][_0x04ce('0x3a')]=function(_0x45b8cb,_0x2b7bdb){for(var _0x5736dd in _0x2b7bdb){if(_0x45b8cb[_0x04ce('0x21')](_0x5736dd)){_0x45b8cb[_0x5736dd]=_0x2b7bdb[_0x5736dd];}}};Realtime['prototype'][_0x04ce('0x3b')]=function(){var _0x22f31b=this;return function(_0x2a2bea){if(_0x2a2bea){freeIsNotKeyAgent(_0x2a2bea,_0x22f31b[_0x04ce('0x10')]);for(var _0x123ac2=0x0,_0xff16f8={},_0x315dde={};_0x123ac2<_0x2a2bea[_0x04ce('0x3c')];_0x123ac2+=0x1){_0xff16f8=_0x2a2bea[_0x123ac2];var _0x2a4e00=_[_0x04ce('0x24')](_0xff16f8['interface'])?util['format'](_0x04ce('0x22'),_0xff16f8[_0x04ce('0x23')]):_0xff16f8['interface'];if(_['isUndefined'](_0x22f31b[_0x04ce('0x10')][_0x2a4e00])){_0x22f31b[_0x04ce('0x10')][_0x2a4e00]=new Agent(_0xff16f8);}else{_0x22f31b[_0x04ce('0x3a')](_0x22f31b[_0x04ce('0x10')][_0x2a4e00],_0xff16f8);}}}return _0x22f31b[_0x04ce('0x10')];};};Realtime[_0x04ce('0x39')][_0x04ce('0x3d')]=function(){var _0x50c5b1=this;return function(_0x1c7e0a){if(_0x1c7e0a){freeIsNotKeySip(_0x1c7e0a,_0x50c5b1[_0x04ce('0x11')]);for(var _0x4e516c=0x0,_0x2b6426={},_0x410338={};_0x4e516c<_0x1c7e0a['length'];_0x4e516c+=0x1){_0x2b6426=_0x1c7e0a[_0x4e516c];if(_[_0x04ce('0x3e')](_0x50c5b1['telephones'][util['format'](_0x04ce('0x22'),_0x2b6426[_0x04ce('0x23')])])){_0x50c5b1[_0x04ce('0x11')][util[_0x04ce('0x26')](_0x04ce('0x22'),_0x2b6426[_0x04ce('0x23')])]=new Telephone(_0x2b6426);}else{_0x50c5b1['mergeFromDatabase'](_0x50c5b1[_0x04ce('0x11')][util[_0x04ce('0x26')](_0x04ce('0x22'),_0x2b6426[_0x04ce('0x23')])],_0x2b6426);}}}return _0x50c5b1[_0x04ce('0x11')];};};Realtime[_0x04ce('0x39')][_0x04ce('0x3f')]=function(){var _0x20698c=this;return function(_0xdc705e){if(_0xdc705e){freeIsNotKeySip(_0xdc705e,_0x20698c['trunks']);for(var _0x468c10=0x0,_0x314194={},_0x241f4b={};_0x468c10<_0xdc705e[_0x04ce('0x3c')];_0x468c10+=0x1){_0x314194=_0xdc705e[_0x468c10];if(_['isUndefined'](_0x20698c[_0x04ce('0x12')][util[_0x04ce('0x26')]('SIP/%s',_0x314194[_0x04ce('0x23')])])){_0x20698c[_0x04ce('0x12')][util[_0x04ce('0x26')](_0x04ce('0x22'),_0x314194[_0x04ce('0x23')])]=new Trunk(_0x314194);}else{_0x20698c[_0x04ce('0x3a')](_0x20698c[_0x04ce('0x12')][util['format'](_0x04ce('0x22'),_0x314194['name'])],_0x314194);}}}return _0x20698c[_0x04ce('0x12')];};};Realtime[_0x04ce('0x39')][_0x04ce('0x40')]=function(){var _0x33966e=this;return function(_0x14c921){if(_0x14c921){freeIsNotKey(_0x14c921,_0x33966e[_0x04ce('0x41')],'name');for(var _0xa10f3d=0x0,_0x4ff3c7={},_0x11071c={};_0xa10f3d<_0x14c921[_0x04ce('0x3c')];_0xa10f3d+=0x1){_0x4ff3c7=_0x14c921[_0xa10f3d];if(_['isUndefined'](_0x33966e[_0x04ce('0x41')][_0x4ff3c7['name']])){_0x33966e[_0x04ce('0x41')][_0x4ff3c7[_0x04ce('0x23')]]=new VoiceQueue(_0x4ff3c7);}else{_0x33966e['mergeFromDatabase'](_0x33966e[_0x04ce('0x41')][_0x4ff3c7[_0x04ce('0x23')]],_0x4ff3c7);}}}return _0x33966e[_0x04ce('0x41')];};};Realtime[_0x04ce('0x39')]['initTriggers']=function(){var _0x5c3fd7=this;return function(_0x22eb4d){if(_0x22eb4d){freeIsNotKey(_0x22eb4d,_0x5c3fd7[_0x04ce('0x42')],'id');for(var _0x306bf9=0x0,_0x383f59={},_0x1415c8={};_0x306bf9<_0x22eb4d['length'];_0x306bf9+=0x1){_0x383f59=_0x22eb4d[_0x306bf9];if(_[_0x04ce('0x3e')](_0x5c3fd7[_0x04ce('0x42')][_0x383f59['id']])){_0x5c3fd7[_0x04ce('0x42')][_0x383f59['id']]=new Trigger(_0x383f59);}else{_0x5c3fd7[_0x04ce('0x3a')](_0x5c3fd7['triggers'][_0x383f59['id']],_0x383f59);}}}return _0x5c3fd7[_0x04ce('0x42')];};};Realtime[_0x04ce('0x39')]['initTemplates']=function(){var _0x1b8b9e=this;return function(_0x14f75f){if(_0x14f75f){freeIsNotKey(_0x14f75f,_0x1b8b9e['templates'],'id');for(var _0x41002e=0x0,_0x1ca7ed={},_0x5be85c={};_0x41002e<_0x14f75f[_0x04ce('0x3c')];_0x41002e+=0x1){_0x1ca7ed=_0x14f75f[_0x41002e];if(_[_0x04ce('0x3e')](_0x1b8b9e[_0x04ce('0x13')][_0x1ca7ed['id']])){_0x1b8b9e[_0x04ce('0x13')][_0x1ca7ed['id']]=new Template(_0x1ca7ed);}else{_0x1b8b9e[_0x04ce('0x3a')](_0x1b8b9e[_0x04ce('0x13')][_0x1ca7ed['id']],_0x1ca7ed);}}}return _0x1b8b9e[_0x04ce('0x13')];};};Realtime[_0x04ce('0x39')][_0x04ce('0x43')]=function(){var _0x1316c8=this;return function(_0x766b8b){if(_0x766b8b){freeIsNotKey(_0x766b8b,_0x1316c8[_0x04ce('0x19')],'id');for(var _0x3763ec=0x0,_0xae5f7c={},_0x6f380={};_0x3763ec<_0x766b8b['length'];_0x3763ec+=0x1){_0xae5f7c=_0x766b8b[_0x3763ec];if(_['isUndefined'](_0x1316c8['zendeskAccounts'][_0xae5f7c['id']])){_0x1316c8['zendeskAccounts'][_0xae5f7c['id']]=new ZendeskAccount(_0xae5f7c);}else{_0x1316c8[_0x04ce('0x3a')](_0x1316c8[_0x04ce('0x19')][_0xae5f7c['id']],_0xae5f7c);}}}return _0x1316c8[_0x04ce('0x19')];};};Realtime[_0x04ce('0x39')][_0x04ce('0x44')]=function(){var _0x377166=this;return function(_0x22b322){if(_0x22b322){freeIsNotKey(_0x22b322,_0x377166['salesforceAccounts'],'id');for(var _0x17b0d9=0x0,_0x540df2={},_0x328f58={};_0x17b0d9<_0x22b322['length'];_0x17b0d9+=0x1){_0x540df2=_0x22b322[_0x17b0d9];if(_['isUndefined'](_0x377166['salesforceAccounts'][_0x540df2['id']])){_0x377166['salesforceAccounts'][_0x540df2['id']]=new SalesforceAccount(_0x540df2);}else{_0x377166[_0x04ce('0x3a')](_0x377166['salesforceAccounts'][_0x540df2['id']],_0x540df2);}}}return _0x377166['salesforceAccounts'];};};Realtime[_0x04ce('0x39')][_0x04ce('0x45')]=function(){var _0x22d56b=this;return function(_0x80e607){if(_0x80e607){freeIsNotKey(_0x80e607,_0x22d56b[_0x04ce('0x1b')],'id');for(var _0x8b041d=0x0,_0x1bb331={},_0xe20f15={};_0x8b041d<_0x80e607['length'];_0x8b041d+=0x1){_0x1bb331=_0x80e607[_0x8b041d];if(_[_0x04ce('0x3e')](_0x22d56b[_0x04ce('0x1b')][_0x1bb331['id']])){_0x22d56b[_0x04ce('0x1b')][_0x1bb331['id']]=new FreshdeskAccount(_0x1bb331);}else{_0x22d56b[_0x04ce('0x3a')](_0x22d56b[_0x04ce('0x1b')][_0x1bb331['id']],_0x1bb331);}}}return _0x22d56b['freshdeskAccounts'];};};Realtime[_0x04ce('0x39')][_0x04ce('0x46')]=function(){var _0x3abfc1=this;return function(_0x14bf4a){if(_0x14bf4a){freeIsNotKey(_0x14bf4a,_0x3abfc1[_0x04ce('0x1c')],'id');for(var _0x5386e9=0x0,_0x55fec8={},_0x5329fe={};_0x5386e9<_0x14bf4a[_0x04ce('0x3c')];_0x5386e9+=0x1){_0x55fec8=_0x14bf4a[_0x5386e9];if(_[_0x04ce('0x3e')](_0x3abfc1[_0x04ce('0x1c')][_0x55fec8['id']])){_0x3abfc1[_0x04ce('0x1c')][_0x55fec8['id']]=new ZohoAccount(_0x55fec8);}else{_0x3abfc1[_0x04ce('0x3a')](_0x3abfc1['zohoAccounts'][_0x55fec8['id']],_0x55fec8);}}}return _0x3abfc1[_0x04ce('0x1c')];};};Realtime[_0x04ce('0x39')]['initDeskAccounts']=function(){var _0x371931=this;return function(_0x14eb5c){if(_0x14eb5c){freeIsNotKey(_0x14eb5c,_0x371931[_0x04ce('0x47')],'id');for(var _0x585d3e=0x0,_0x4cd203={},_0x523cbe={};_0x585d3e<_0x14eb5c[_0x04ce('0x3c')];_0x585d3e+=0x1){_0x4cd203=_0x14eb5c[_0x585d3e];if(_['isUndefined'](_0x371931['deskAccounts'][_0x4cd203['id']])){_0x371931['deskAccounts'][_0x4cd203['id']]=new DeskAccount(_0x4cd203);}else{_0x371931[_0x04ce('0x3a')](_0x371931['deskAccounts'][_0x4cd203['id']],_0x4cd203);}}}return _0x371931[_0x04ce('0x47')];};};Realtime[_0x04ce('0x39')]['initSugarcrmAccounts']=function(){var _0x3f5189=this;return function(_0x29e0dd){if(_0x29e0dd){freeIsNotKey(_0x29e0dd,_0x3f5189[_0x04ce('0x48')],'id');for(var _0x395113=0x0,_0x7ab1c9={},_0x4b7b84={};_0x395113<_0x29e0dd[_0x04ce('0x3c')];_0x395113+=0x1){_0x7ab1c9=_0x29e0dd[_0x395113];if(_['isUndefined'](_0x3f5189[_0x04ce('0x48')][_0x7ab1c9['id']])){_0x3f5189[_0x04ce('0x48')][_0x7ab1c9['id']]=new SugarcrmAccount(_0x7ab1c9);}else{_0x3f5189[_0x04ce('0x3a')](_0x3f5189[_0x04ce('0x48')][_0x7ab1c9['id']],_0x7ab1c9);}}}return _0x3f5189['sugarcrmAccounts'];};};Realtime[_0x04ce('0x39')]['initVtigerAccounts']=function(){var _0xe094e6=this;return function(_0x5e55e1){if(_0x5e55e1){freeIsNotKey(_0x5e55e1,_0xe094e6[_0x04ce('0x49')],'id');for(var _0x23ff5a=0x0,_0x12c992={},_0x57566e={};_0x23ff5a<_0x5e55e1['length'];_0x23ff5a+=0x1){_0x12c992=_0x5e55e1[_0x23ff5a];if(_['isUndefined'](_0xe094e6[_0x04ce('0x49')][_0x12c992['id']])){_0xe094e6[_0x04ce('0x49')][_0x12c992['id']]=new VtigerAccount(_0x12c992);}else{_0xe094e6['mergeFromDatabase'](_0xe094e6['vtigerAccounts'][_0x12c992['id']],_0x12c992);}}}return _0xe094e6['vtigerAccounts'];};};Realtime[_0x04ce('0x39')]['initServicenowAccounts']=function(){var _0x488d25=this;return function(_0x445a93){if(_0x445a93){freeIsNotKey(_0x445a93,_0x488d25['servicenowAccounts'],'id');for(var _0x4ea332=0x0,_0x1d3946={},_0x5b3d33={};_0x4ea332<_0x445a93[_0x04ce('0x3c')];_0x4ea332+=0x1){_0x1d3946=_0x445a93[_0x4ea332];if(_[_0x04ce('0x3e')](_0x488d25[_0x04ce('0x1d')][_0x1d3946['id']])){_0x488d25[_0x04ce('0x1d')][_0x1d3946['id']]=new ServicenowAccount(_0x1d3946);}else{_0x488d25[_0x04ce('0x3a')](_0x488d25[_0x04ce('0x1d')][_0x1d3946['id']],_0x1d3946);}}}return _0x488d25[_0x04ce('0x1d')];};};Realtime[_0x04ce('0x39')][_0x04ce('0x4a')]=function(){var _0x2e1581=this;return function(_0x1a9800){if(_0x1a9800){freeIsNotKey(_0x1a9800,_0x2e1581[_0x04ce('0x1e')],'id');for(var _0x28da63=0x0,_0x10ba0a={},_0x514b41={};_0x28da63<_0x1a9800[_0x04ce('0x3c')];_0x28da63+=0x1){_0x10ba0a=_0x1a9800[_0x28da63];if(_[_0x04ce('0x3e')](_0x2e1581[_0x04ce('0x1e')][_0x10ba0a['id']])){_0x2e1581['dynamics365Accounts'][_0x10ba0a['id']]=new Dynamics365Account(_0x10ba0a);}else{_0x2e1581[_0x04ce('0x3a')](_0x2e1581[_0x04ce('0x1e')][_0x10ba0a['id']],_0x10ba0a);}}}return _0x2e1581[_0x04ce('0x1e')];};};Realtime['prototype'][_0x04ce('0x4b')]=function(){var _0x46d9bc=this;return function(_0x1f53bc){if(_0x1f53bc){freeIsNotKey(_0x1f53bc,_0x46d9bc['freshsalesAccounts'],'id');for(var _0x5db930=0x0,_0x2708b1={},_0x34dfcf={};_0x5db930<_0x1f53bc[_0x04ce('0x3c')];_0x5db930+=0x1){_0x2708b1=_0x1f53bc[_0x5db930];if(_[_0x04ce('0x3e')](_0x46d9bc[_0x04ce('0x1f')][_0x2708b1['id']])){_0x46d9bc['freshsalesAccounts'][_0x2708b1['id']]=new FreshsalesAccount(_0x2708b1);}else{_0x46d9bc[_0x04ce('0x3a')](_0x46d9bc[_0x04ce('0x1f')][_0x2708b1['id']],_0x2708b1);}}}return _0x46d9bc[_0x04ce('0x1f')];};};Realtime[_0x04ce('0x39')][_0x04ce('0x4c')]=function(){var _0x2bd50a=this;return function(_0x5de918){for(var _0x3709f3=0x0;_0x3709f3<_0x5de918[_0x04ce('0x3c')];_0x3709f3+=0x1){_['merge'](_0x2bd50a[_0x04ce('0x41')][_0x5de918[_0x3709f3]['name']],_0x5de918[_0x3709f3]);}return _0x2bd50a[_0x04ce('0x41')];};};Realtime[_0x04ce('0x39')][_0x04ce('0x4d')]=function(){var _0x3382d4=this;return function(_0x113705){clearVoiceQueues(_0x3382d4[_0x04ce('0x41')]);if(_0x113705){_0x113705=_['groupBy'](_0x113705,'uniqueid');for(var _0x17944d in _0x113705){if(_0x113705[_0x04ce('0x21')](_0x17944d)){var _0x2a3d22={};for(var _0xf12c90=0x0;_0xf12c90<_0x113705[_0x17944d][_0x04ce('0x3c')];_0xf12c90+=0x1){var _0xfa4f5e=_0x113705[_0x17944d][_0xf12c90]['queue'];if(_0x3382d4[_0x04ce('0x41')][_0xfa4f5e]){if(_0x113705[_0x17944d][_0xf12c90][_0x04ce('0x4e')]){_0x3382d4[_0x04ce('0x41')][_0xfa4f5e]['unmanaged']+=0x1;}if(_0x113705[_0x17944d][_0xf12c90][_0x04ce('0x4f')]){_0x3382d4[_0x04ce('0x41')][_0xfa4f5e]['abandoned']+=0x1;}_0x3382d4[_0x04ce('0x41')][_0xfa4f5e][_0x04ce('0x2e')]+=moment(_0x113705[_0x17944d][_0xf12c90][_0x04ce('0x50')])[_0x04ce('0x51')](moment(_0x113705[_0x17944d][_0xf12c90]['queuecallerjoinAt']),_0x04ce('0x52'))||0x0;if(_0xf12c90===_0x113705[_0x17944d]['length']-0x1){_0x3382d4['voiceQueues'][_0xfa4f5e][_0x04ce('0x28')]+=moment(_0x113705[_0x17944d][_0xf12c90]['queuecallercompleteAt']||_0x113705[_0x17944d][_0xf12c90][_0x04ce('0x53')]||_0x113705[_0x17944d][_0xf12c90][_0x04ce('0x54')])[_0x04ce('0x51')](moment(_0x113705[_0x17944d][_0xf12c90][_0x04ce('0x55')]),_0x04ce('0x52'))||0x0;_0x3382d4[_0x04ce('0x41')][_0xfa4f5e][_0x04ce('0x27')]+=0x1;if(_0x113705[_0x17944d][_0xf12c90][_0x04ce('0x56')]){_0x3382d4['voiceQueues'][_0xfa4f5e]['answered']+=0x1;_0x3382d4[_0x04ce('0x41')][_0xfa4f5e][_0x04ce('0x29')]+=moment(_0x113705[_0x17944d][_0xf12c90][_0x04ce('0x57')])['diff'](moment(_0x113705[_0x17944d][_0xf12c90][_0x04ce('0x50')]),_0x04ce('0x52'))||0x0;}}else{_0x3382d4[_0x04ce('0x41')][_0xfa4f5e]['sumDuration']+=_0x3382d4[_0x04ce('0x41')][_0xfa4f5e][_0x04ce('0x2e')]||0x0;}}}}}}return _0x3382d4[_0x04ce('0x41')];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0x1167a5=this;return function(_0x50b6f7){clearVoiceCallReports(_0x1167a5[_0x04ce('0x58')]);if(_0x50b6f7){for(var _0x3803b3=0x0;_0x3803b3<_0x50b6f7[_0x04ce('0x3c')];_0x3803b3+=0x1){_0x1167a5[_0x04ce('0x58')]['total']+=0x1;_0x1167a5[_0x04ce('0x58')][_0x04ce('0x28')]+=_0x50b6f7[_0x3803b3][_0x04ce('0x59')];if(_0x50b6f7[_0x3803b3][_0x04ce('0x5a')]===_0x04ce('0x5b')){_0x1167a5['outbound'][_0x04ce('0x2c')]+=0x1;_0x1167a5['outbound']['sumHoldTime']+=_0x50b6f7[_0x3803b3][_0x04ce('0x59')]-_0x50b6f7[_0x3803b3][_0x04ce('0x5c')]||0x0;_0x1167a5[_0x04ce('0x58')][_0x04ce('0x29')]+=_0x50b6f7[_0x3803b3][_0x04ce('0x5c')];}}}return _0x1167a5['outbound'];};};Realtime[_0x04ce('0x39')][_0x04ce('0x5d')]=function(){var _0x4faf62=this;return function(_0x155992){if(_0x155992){freeIsNotKey(_0x155992,_0x4faf62[_0x04ce('0x5e')],_0x04ce('0x23'));for(var _0xe75d0f=0x0,_0x22278a={};_0xe75d0f<_0x155992[_0x04ce('0x3c')];_0xe75d0f+=0x1){_0x22278a=_0x155992[_0xe75d0f];if(_[_0x04ce('0x3e')](_0x4faf62[_0x04ce('0x5e')][_0x22278a[_0x04ce('0x23')]])){_0x4faf62[_0x04ce('0x5e')][_0x22278a[_0x04ce('0x23')]]=new Campaign(_0x22278a);}else{_0x4faf62[_0x04ce('0x3a')](_0x4faf62[_0x04ce('0x5e')][_0x22278a['name']],_0x22278a);_0x4faf62[_0x04ce('0x5e')][_0x22278a[_0x04ce('0x23')]][_0x04ce('0x5f')]=_0x22278a[_0x04ce('0x60')]?_0x22278a[_0x04ce('0x60')][_0x04ce('0x23')]:undefined;}}}return _0x4faf62['campaigns'];};};Realtime[_0x04ce('0x39')][_0x04ce('0x61')]=function(){var _0x427a80=this;return function(_0x34b95d){if(_0x34b95d){freeIsNotKey(_0x34b95d,_0x427a80[_0x04ce('0x14')],'id');for(var _0x3900f6=0x0,_0x1f090f={};_0x3900f6<_0x34b95d['length'];_0x3900f6+=0x1){_0x1f090f=_0x34b95d[_0x3900f6];if(_['isUndefined'](_0x427a80[_0x04ce('0x14')][_0x1f090f['id']])){_0x427a80[_0x04ce('0x14')][_0x1f090f['id']]=new VoiceExtension(_0x1f090f);}else{_0x427a80[_0x04ce('0x3a')](_0x427a80[_0x04ce('0x14')][_0x1f090f['id']],_0x1f090f);}}}return _0x427a80[_0x04ce('0x14')];};};Realtime[_0x04ce('0x39')]['initCampaignHopperHistory']=function(){var _0x133e93=this;return function(_0x193688){clearCampaigns(_0x133e93[_0x04ce('0x5e')]);for(var _0x4a52c8=0x0;_0x4a52c8<_0x193688[_0x04ce('0x3c')];_0x4a52c8+=0x1){_['merge'](_0x133e93['campaigns'][_0x193688[_0x4a52c8][_0x04ce('0x23')]],_0x193688[_0x4a52c8]);}return _0x133e93[_0x04ce('0x5e')];};};Realtime[_0x04ce('0x39')][_0x04ce('0x62')]=function(){var _0x10eb42=this;return function(_0x2a610a){if(_0x2a610a){freeIsNotKey(_0x2a610a,_0x10eb42[_0x04ce('0x63')],'id');for(var _0x2dd283=0x0,_0x5135f7={},_0x4cee55={};_0x2dd283<_0x2a610a[_0x04ce('0x3c')];_0x2dd283+=0x1){_0x5135f7=_0x2a610a[_0x2dd283];if(_[_0x04ce('0x3e')](_0x10eb42[_0x04ce('0x63')][_0x5135f7['id']])){_0x10eb42[_0x04ce('0x63')][_0x5135f7['id']]=new FaxAccount(_0x5135f7);}else{_0x10eb42['mergeFromDatabase'](_0x10eb42[_0x04ce('0x63')][_0x5135f7['id']],_0x5135f7);}}}return _0x10eb42[_0x04ce('0x63')];};};module[_0x04ce('0x64')]=Realtime; \ No newline at end of file +var _0xcea1=['sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','initTelephones','length','isUndefined','initTrunks','trunks','initVoiceQueues','voiceQueues','triggers','initTemplates','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','queuecallerexit','unmanaged','queuecallerabandon','queuecallerjoinAt','seconds','queuecallerabandonAt','diff','queuecallercomplete','queuecallercompleteAt','queuecallerleaveAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','bluebird','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','templates','outbound','channels','outboundChannels','timers','zendeskAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','faxAccounts','mapKeys','SIP/%s','name','isNil','format','interface','hasOwnProperty','total'];(function(_0x196590,_0x361992){var _0x332b7a=function(_0x3351c7){while(--_0x3351c7){_0x196590['push'](_0x196590['shift']());}};_0x332b7a(++_0x361992);}(_0xcea1,0x189));var _0x1cea=function(_0x5bac10,_0x436643){_0x5bac10=_0x5bac10-0x0;var _0x362c49=_0xcea1[_0x5bac10];return _0x362c49;};'use strict';var BPromise=require(_0x1cea('0x0'));var util=require(_0x1cea('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0x1cea('0x2'));var Telephone=require(_0x1cea('0x3'));var Trunk=require(_0x1cea('0x4'));var VoiceQueue=require(_0x1cea('0x5'));var Trigger=require(_0x1cea('0x6'));var Template=require('../model/template');var Campaign=require(_0x1cea('0x7'));var VoiceExtension=require(_0x1cea('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x1cea('0x9'));var FreshdeskAccount=require(_0x1cea('0xa'));var SugarcrmAccount=require(_0x1cea('0xb'));var ZohoAccount=require(_0x1cea('0xc'));var DeskAccount=require(_0x1cea('0xd'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x1cea('0xe'));var Dynamics365Account=require(_0x1cea('0xf'));var FreshsalesAccount=require(_0x1cea('0x10'));var FaxAccount=require(_0x1cea('0x11'));var Realtime=function(){this[_0x1cea('0x12')]={};this[_0x1cea('0x13')]={};this['trunks']={};this['voiceQueues']={};this['triggers']={};this['campaigns']={};this[_0x1cea('0x14')]={};this[_0x1cea('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x1cea('0x16')]={};this['queueChannels']={};this[_0x1cea('0x17')]={};this[_0x1cea('0x18')]={};this[_0x1cea('0x19')]={};this['salesforceAccounts']={};this['sugarcrmAccounts']={};this[_0x1cea('0x1a')]={};this['zohoAccounts']={};this[_0x1cea('0x1b')]={};this[_0x1cea('0x1c')]={};this[_0x1cea('0x1d')]={};this['dynamics365Accounts']={};this['freshsalesAccounts']={};this[_0x1cea('0x1e')]={};};function freeIsNotKey(_0x5c9c01,_0x4af979,_0x531120){var _0x59e03b=_[_0x1cea('0x1f')](_0x5c9c01,function(_0x3b652c,_0x5e48d5){return _0x3b652c[_0x531120];});for(var _0x49e50a in _0x4af979){if(_0x4af979['hasOwnProperty'](_0x49e50a)){if(!_0x59e03b[_0x49e50a]){delete _0x4af979[_0x49e50a];}}}}function freeIsNotKeySip(_0x61ccdc,_0x177d54){var _0x479768=_[_0x1cea('0x1f')](_0x61ccdc,function(_0x2f834d,_0x5d1127){return util['format'](_0x1cea('0x20'),_0x2f834d[_0x1cea('0x21')]);});for(var _0x367421 in _0x177d54){if(_0x177d54['hasOwnProperty'](_0x367421)){if(!_0x479768[_0x367421]){delete _0x177d54[_0x367421];}}}}function freeIsNotKeyAgent(_0x435ac5,_0x3be755){var _0x1dd31f=_[_0x1cea('0x1f')](_0x435ac5,function(_0x16d938,_0x25a125){var _0x67274c=_[_0x1cea('0x22')](_0x16d938['interface'])?util[_0x1cea('0x23')](_0x1cea('0x20'),_0x16d938['name']):_0x16d938[_0x1cea('0x24')];return _0x67274c;});for(var _0x50c48a in _0x3be755){if(_0x3be755[_0x1cea('0x25')](_0x50c48a)){if(!_0x1dd31f[_0x50c48a]){delete _0x3be755[_0x50c48a];}}}}function clearVoiceCallReports(_0x5db7b3){_0x5db7b3[_0x1cea('0x26')]=0x0;_0x5db7b3['answered']=0x0;_0x5db7b3[_0x1cea('0x27')]=0x0;_0x5db7b3[_0x1cea('0x28')]=0x0;_0x5db7b3[_0x1cea('0x29')]=0x0;}function clearCampaigns(_0x579c47){if(!_[_0x1cea('0x2a')](_0x579c47)){for(var _0x2b501b in _0x579c47){if(_0x579c47[_0x1cea('0x25')](_0x2b501b)){_0x579c47[_0x2b501b][_0x1cea('0x2b')]=0x0;_0x579c47[_0x2b501b][_0x1cea('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x5a546e){if(!_[_0x1cea('0x2a')](_0x5a546e)){for(var _0x3ff366 in _0x5a546e){if(_0x5a546e[_0x1cea('0x25')](_0x3ff366)){_0x5a546e[_0x3ff366][_0x1cea('0x26')]=0x0;_0x5a546e[_0x3ff366][_0x1cea('0x2d')]=0x0;_0x5a546e[_0x3ff366]['unmanaged']=0x0;_0x5a546e[_0x3ff366][_0x1cea('0x2e')]=0x0;_0x5a546e[_0x3ff366][_0x1cea('0x27')]=0x0;_0x5a546e[_0x3ff366][_0x1cea('0x28')]=0x0;_0x5a546e[_0x3ff366][_0x1cea('0x29')]=0x0;_0x5a546e[_0x3ff366][_0x1cea('0x2f')]=0x0;_0x5a546e[_0x3ff366][_0x1cea('0x30')]=0x0;_0x5a546e[_0x3ff366]['outboundBusyCallsDay']=0x0;_0x5a546e[_0x3ff366][_0x1cea('0x31')]=0x0;_0x5a546e[_0x3ff366][_0x1cea('0x32')]=0x0;_0x5a546e[_0x3ff366]['outboundUnknownCallsDay']=0x0;_0x5a546e[_0x3ff366][_0x1cea('0x33')]=0x0;_0x5a546e[_0x3ff366][_0x1cea('0x34')]=0x0;_0x5a546e[_0x3ff366][_0x1cea('0x35')]=0x0;_0x5a546e[_0x3ff366][_0x1cea('0x36')]=0x0;_0x5a546e[_0x3ff366][_0x1cea('0x37')]=0x0;_0x5a546e[_0x3ff366]['outboundReCallsDay']=0x0;_0x5a546e[_0x3ff366][_0x1cea('0x2f')]=0x0;_0x5a546e[_0x3ff366][_0x1cea('0x38')]=0x0;_0x5a546e[_0x3ff366]['queueStatusComplete']=!![];}}}}Realtime[_0x1cea('0x39')]['mergeFromDatabase']=function(_0x5537e8,_0x33c543){for(var _0x336bd4 in _0x33c543){if(_0x5537e8[_0x1cea('0x25')](_0x336bd4)){_0x5537e8[_0x336bd4]=_0x33c543[_0x336bd4];}}};Realtime['prototype']['initAgents']=function(){var _0x341877=this;return function(_0x15ae4e){if(_0x15ae4e){freeIsNotKeyAgent(_0x15ae4e,_0x341877['agents']);for(var _0x1aa564=0x0,_0x1a5558={},_0x240c29={};_0x1aa564<_0x15ae4e['length'];_0x1aa564+=0x1){_0x1a5558=_0x15ae4e[_0x1aa564];var _0x130acc=_['isNil'](_0x1a5558[_0x1cea('0x24')])?util[_0x1cea('0x23')](_0x1cea('0x20'),_0x1a5558[_0x1cea('0x21')]):_0x1a5558['interface'];if(_['isUndefined'](_0x341877[_0x1cea('0x12')][_0x130acc])){_0x341877[_0x1cea('0x12')][_0x130acc]=new Agent(_0x1a5558);}else{_0x341877[_0x1cea('0x3a')](_0x341877['agents'][_0x130acc],_0x1a5558);}}}return _0x341877[_0x1cea('0x12')];};};Realtime[_0x1cea('0x39')][_0x1cea('0x3b')]=function(){var _0x54a5ea=this;return function(_0x7f35bb){if(_0x7f35bb){freeIsNotKeySip(_0x7f35bb,_0x54a5ea[_0x1cea('0x13')]);for(var _0x4fa04f=0x0,_0x40013c={},_0x46adeb={};_0x4fa04f<_0x7f35bb[_0x1cea('0x3c')];_0x4fa04f+=0x1){_0x40013c=_0x7f35bb[_0x4fa04f];if(_[_0x1cea('0x3d')](_0x54a5ea[_0x1cea('0x13')][util[_0x1cea('0x23')]('SIP/%s',_0x40013c[_0x1cea('0x21')])])){_0x54a5ea[_0x1cea('0x13')][util[_0x1cea('0x23')](_0x1cea('0x20'),_0x40013c['name'])]=new Telephone(_0x40013c);}else{_0x54a5ea['mergeFromDatabase'](_0x54a5ea[_0x1cea('0x13')][util[_0x1cea('0x23')](_0x1cea('0x20'),_0x40013c[_0x1cea('0x21')])],_0x40013c);}}}return _0x54a5ea[_0x1cea('0x13')];};};Realtime['prototype'][_0x1cea('0x3e')]=function(){var _0x10e198=this;return function(_0x254662){if(_0x254662){freeIsNotKeySip(_0x254662,_0x10e198[_0x1cea('0x3f')]);for(var _0x21d746=0x0,_0x4918c3={},_0x49673c={};_0x21d746<_0x254662[_0x1cea('0x3c')];_0x21d746+=0x1){_0x4918c3=_0x254662[_0x21d746];if(_[_0x1cea('0x3d')](_0x10e198[_0x1cea('0x3f')][util[_0x1cea('0x23')](_0x1cea('0x20'),_0x4918c3['name'])])){_0x10e198[_0x1cea('0x3f')][util[_0x1cea('0x23')](_0x1cea('0x20'),_0x4918c3['name'])]=new Trunk(_0x4918c3);}else{_0x10e198[_0x1cea('0x3a')](_0x10e198[_0x1cea('0x3f')][util[_0x1cea('0x23')](_0x1cea('0x20'),_0x4918c3[_0x1cea('0x21')])],_0x4918c3);}}}return _0x10e198['trunks'];};};Realtime[_0x1cea('0x39')][_0x1cea('0x40')]=function(){var _0x3aaf26=this;return function(_0x16c4e2){if(_0x16c4e2){freeIsNotKey(_0x16c4e2,_0x3aaf26[_0x1cea('0x41')],_0x1cea('0x21'));for(var _0xc7da04=0x0,_0x342b21={},_0x5c37bd={};_0xc7da04<_0x16c4e2['length'];_0xc7da04+=0x1){_0x342b21=_0x16c4e2[_0xc7da04];if(_['isUndefined'](_0x3aaf26[_0x1cea('0x41')][_0x342b21['name']])){_0x3aaf26[_0x1cea('0x41')][_0x342b21[_0x1cea('0x21')]]=new VoiceQueue(_0x342b21);}else{_0x3aaf26[_0x1cea('0x3a')](_0x3aaf26[_0x1cea('0x41')][_0x342b21[_0x1cea('0x21')]],_0x342b21);}}}return _0x3aaf26['voiceQueues'];};};Realtime[_0x1cea('0x39')]['initTriggers']=function(){var _0x57dc5f=this;return function(_0x495b10){if(_0x495b10){freeIsNotKey(_0x495b10,_0x57dc5f[_0x1cea('0x42')],'id');for(var _0x35872b=0x0,_0x8a40e={},_0x4b69ae={};_0x35872b<_0x495b10['length'];_0x35872b+=0x1){_0x8a40e=_0x495b10[_0x35872b];if(_['isUndefined'](_0x57dc5f['triggers'][_0x8a40e['id']])){_0x57dc5f[_0x1cea('0x42')][_0x8a40e['id']]=new Trigger(_0x8a40e);}else{_0x57dc5f[_0x1cea('0x3a')](_0x57dc5f[_0x1cea('0x42')][_0x8a40e['id']],_0x8a40e);}}}return _0x57dc5f[_0x1cea('0x42')];};};Realtime[_0x1cea('0x39')][_0x1cea('0x43')]=function(){var _0x7ded47=this;return function(_0x1dd750){if(_0x1dd750){freeIsNotKey(_0x1dd750,_0x7ded47[_0x1cea('0x14')],'id');for(var _0x183efd=0x0,_0xed68fa={},_0x46ea44={};_0x183efd<_0x1dd750[_0x1cea('0x3c')];_0x183efd+=0x1){_0xed68fa=_0x1dd750[_0x183efd];if(_['isUndefined'](_0x7ded47[_0x1cea('0x14')][_0xed68fa['id']])){_0x7ded47[_0x1cea('0x14')][_0xed68fa['id']]=new Template(_0xed68fa);}else{_0x7ded47[_0x1cea('0x3a')](_0x7ded47['templates'][_0xed68fa['id']],_0xed68fa);}}}return _0x7ded47[_0x1cea('0x14')];};};Realtime[_0x1cea('0x39')]['initZendeskAccounts']=function(){var _0x346f71=this;return function(_0x2a29bb){if(_0x2a29bb){freeIsNotKey(_0x2a29bb,_0x346f71['zendeskAccounts'],'id');for(var _0x55c46c=0x0,_0x492ce7={},_0x1efd05={};_0x55c46c<_0x2a29bb[_0x1cea('0x3c')];_0x55c46c+=0x1){_0x492ce7=_0x2a29bb[_0x55c46c];if(_[_0x1cea('0x3d')](_0x346f71[_0x1cea('0x19')][_0x492ce7['id']])){_0x346f71[_0x1cea('0x19')][_0x492ce7['id']]=new ZendeskAccount(_0x492ce7);}else{_0x346f71[_0x1cea('0x3a')](_0x346f71[_0x1cea('0x19')][_0x492ce7['id']],_0x492ce7);}}}return _0x346f71[_0x1cea('0x19')];};};Realtime['prototype'][_0x1cea('0x44')]=function(){var _0x2b0397=this;return function(_0x34baef){if(_0x34baef){freeIsNotKey(_0x34baef,_0x2b0397['salesforceAccounts'],'id');for(var _0xd37fad=0x0,_0x257db9={},_0x27430f={};_0xd37fad<_0x34baef['length'];_0xd37fad+=0x1){_0x257db9=_0x34baef[_0xd37fad];if(_['isUndefined'](_0x2b0397['salesforceAccounts'][_0x257db9['id']])){_0x2b0397[_0x1cea('0x45')][_0x257db9['id']]=new SalesforceAccount(_0x257db9);}else{_0x2b0397[_0x1cea('0x3a')](_0x2b0397['salesforceAccounts'][_0x257db9['id']],_0x257db9);}}}return _0x2b0397[_0x1cea('0x45')];};};Realtime['prototype'][_0x1cea('0x46')]=function(){var _0x13c320=this;return function(_0x3bff73){if(_0x3bff73){freeIsNotKey(_0x3bff73,_0x13c320[_0x1cea('0x1a')],'id');for(var _0x577baf=0x0,_0x2a8a6b={},_0x4db744={};_0x577baf<_0x3bff73['length'];_0x577baf+=0x1){_0x2a8a6b=_0x3bff73[_0x577baf];if(_['isUndefined'](_0x13c320[_0x1cea('0x1a')][_0x2a8a6b['id']])){_0x13c320['freshdeskAccounts'][_0x2a8a6b['id']]=new FreshdeskAccount(_0x2a8a6b);}else{_0x13c320[_0x1cea('0x3a')](_0x13c320['freshdeskAccounts'][_0x2a8a6b['id']],_0x2a8a6b);}}}return _0x13c320[_0x1cea('0x1a')];};};Realtime[_0x1cea('0x39')][_0x1cea('0x47')]=function(){var _0x252877=this;return function(_0x4b1d5d){if(_0x4b1d5d){freeIsNotKey(_0x4b1d5d,_0x252877[_0x1cea('0x48')],'id');for(var _0x5c2d0f=0x0,_0x259e4a={},_0x13bd67={};_0x5c2d0f<_0x4b1d5d[_0x1cea('0x3c')];_0x5c2d0f+=0x1){_0x259e4a=_0x4b1d5d[_0x5c2d0f];if(_['isUndefined'](_0x252877['zohoAccounts'][_0x259e4a['id']])){_0x252877['zohoAccounts'][_0x259e4a['id']]=new ZohoAccount(_0x259e4a);}else{_0x252877[_0x1cea('0x3a')](_0x252877[_0x1cea('0x48')][_0x259e4a['id']],_0x259e4a);}}}return _0x252877[_0x1cea('0x48')];};};Realtime[_0x1cea('0x39')][_0x1cea('0x49')]=function(){var _0x2d22a8=this;return function(_0x4eb057){if(_0x4eb057){freeIsNotKey(_0x4eb057,_0x2d22a8[_0x1cea('0x1b')],'id');for(var _0x1d29e2=0x0,_0x25675d={},_0x2d4e27={};_0x1d29e2<_0x4eb057[_0x1cea('0x3c')];_0x1d29e2+=0x1){_0x25675d=_0x4eb057[_0x1d29e2];if(_[_0x1cea('0x3d')](_0x2d22a8[_0x1cea('0x1b')][_0x25675d['id']])){_0x2d22a8[_0x1cea('0x1b')][_0x25675d['id']]=new DeskAccount(_0x25675d);}else{_0x2d22a8['mergeFromDatabase'](_0x2d22a8[_0x1cea('0x1b')][_0x25675d['id']],_0x25675d);}}}return _0x2d22a8[_0x1cea('0x1b')];};};Realtime[_0x1cea('0x39')][_0x1cea('0x4a')]=function(){var _0x8e3197=this;return function(_0x2efaae){if(_0x2efaae){freeIsNotKey(_0x2efaae,_0x8e3197[_0x1cea('0x4b')],'id');for(var _0xeb6286=0x0,_0x5729b9={},_0x18264c={};_0xeb6286<_0x2efaae[_0x1cea('0x3c')];_0xeb6286+=0x1){_0x5729b9=_0x2efaae[_0xeb6286];if(_['isUndefined'](_0x8e3197[_0x1cea('0x4b')][_0x5729b9['id']])){_0x8e3197['sugarcrmAccounts'][_0x5729b9['id']]=new SugarcrmAccount(_0x5729b9);}else{_0x8e3197['mergeFromDatabase'](_0x8e3197['sugarcrmAccounts'][_0x5729b9['id']],_0x5729b9);}}}return _0x8e3197['sugarcrmAccounts'];};};Realtime[_0x1cea('0x39')][_0x1cea('0x4c')]=function(){var _0x4bf769=this;return function(_0x3639c3){if(_0x3639c3){freeIsNotKey(_0x3639c3,_0x4bf769[_0x1cea('0x1c')],'id');for(var _0x5e9c9e=0x0,_0xb25d={},_0x574a11={};_0x5e9c9e<_0x3639c3[_0x1cea('0x3c')];_0x5e9c9e+=0x1){_0xb25d=_0x3639c3[_0x5e9c9e];if(_[_0x1cea('0x3d')](_0x4bf769[_0x1cea('0x1c')][_0xb25d['id']])){_0x4bf769['vtigerAccounts'][_0xb25d['id']]=new VtigerAccount(_0xb25d);}else{_0x4bf769[_0x1cea('0x3a')](_0x4bf769[_0x1cea('0x1c')][_0xb25d['id']],_0xb25d);}}}return _0x4bf769[_0x1cea('0x1c')];};};Realtime[_0x1cea('0x39')][_0x1cea('0x4d')]=function(){var _0x31ef44=this;return function(_0x35345c){if(_0x35345c){freeIsNotKey(_0x35345c,_0x31ef44[_0x1cea('0x1d')],'id');for(var _0x5cd5a2=0x0,_0x37687d={},_0x34d14b={};_0x5cd5a2<_0x35345c['length'];_0x5cd5a2+=0x1){_0x37687d=_0x35345c[_0x5cd5a2];if(_['isUndefined'](_0x31ef44[_0x1cea('0x1d')][_0x37687d['id']])){_0x31ef44['servicenowAccounts'][_0x37687d['id']]=new ServicenowAccount(_0x37687d);}else{_0x31ef44[_0x1cea('0x3a')](_0x31ef44[_0x1cea('0x1d')][_0x37687d['id']],_0x37687d);}}}return _0x31ef44['servicenowAccounts'];};};Realtime['prototype'][_0x1cea('0x4e')]=function(){var _0xdf5287=this;return function(_0x1c7f9c){if(_0x1c7f9c){freeIsNotKey(_0x1c7f9c,_0xdf5287[_0x1cea('0x4f')],'id');for(var _0x210bc8=0x0,_0x35800d={},_0x1ce91a={};_0x210bc8<_0x1c7f9c['length'];_0x210bc8+=0x1){_0x35800d=_0x1c7f9c[_0x210bc8];if(_[_0x1cea('0x3d')](_0xdf5287[_0x1cea('0x4f')][_0x35800d['id']])){_0xdf5287[_0x1cea('0x4f')][_0x35800d['id']]=new Dynamics365Account(_0x35800d);}else{_0xdf5287[_0x1cea('0x3a')](_0xdf5287[_0x1cea('0x4f')][_0x35800d['id']],_0x35800d);}}}return _0xdf5287['dynamics365Accounts'];};};Realtime[_0x1cea('0x39')][_0x1cea('0x50')]=function(){var _0x488301=this;return function(_0x481385){if(_0x481385){freeIsNotKey(_0x481385,_0x488301[_0x1cea('0x51')],'id');for(var _0xb9f1d2=0x0,_0x550f4f={},_0x3234a3={};_0xb9f1d2<_0x481385[_0x1cea('0x3c')];_0xb9f1d2+=0x1){_0x550f4f=_0x481385[_0xb9f1d2];if(_[_0x1cea('0x3d')](_0x488301[_0x1cea('0x51')][_0x550f4f['id']])){_0x488301[_0x1cea('0x51')][_0x550f4f['id']]=new FreshsalesAccount(_0x550f4f);}else{_0x488301[_0x1cea('0x3a')](_0x488301[_0x1cea('0x51')][_0x550f4f['id']],_0x550f4f);}}}return _0x488301[_0x1cea('0x51')];};};Realtime[_0x1cea('0x39')][_0x1cea('0x52')]=function(){var _0x1d31c4=this;return function(_0xa43f83){for(var _0x288773=0x0;_0x288773<_0xa43f83[_0x1cea('0x3c')];_0x288773+=0x1){_['merge'](_0x1d31c4['voiceQueues'][_0xa43f83[_0x288773][_0x1cea('0x21')]],_0xa43f83[_0x288773]);}return _0x1d31c4[_0x1cea('0x41')];};};Realtime[_0x1cea('0x39')][_0x1cea('0x53')]=function(){var _0x11f6c7=this;return function(_0x3d4c36){clearVoiceQueues(_0x11f6c7[_0x1cea('0x41')]);if(_0x3d4c36){_0x3d4c36=_['groupBy'](_0x3d4c36,'uniqueid');for(var _0x354e6c in _0x3d4c36){if(_0x3d4c36[_0x1cea('0x25')](_0x354e6c)){var _0x1fa5cc={};for(var _0x3cbe1e=0x0;_0x3cbe1e<_0x3d4c36[_0x354e6c]['length'];_0x3cbe1e+=0x1){var _0x2c365d=_0x3d4c36[_0x354e6c][_0x3cbe1e]['queue'];if(_0x11f6c7[_0x1cea('0x41')][_0x2c365d]){if(_0x3d4c36[_0x354e6c][_0x3cbe1e][_0x1cea('0x54')]){_0x11f6c7[_0x1cea('0x41')][_0x2c365d][_0x1cea('0x55')]+=0x1;}if(_0x3d4c36[_0x354e6c][_0x3cbe1e][_0x1cea('0x56')]){_0x11f6c7[_0x1cea('0x41')][_0x2c365d][_0x1cea('0x2e')]+=0x1;}_0x11f6c7[_0x1cea('0x41')][_0x2c365d][_0x1cea('0x27')]+=moment(_0x3d4c36[_0x354e6c][_0x3cbe1e]['queuecallerleaveAt'])['diff'](moment(_0x3d4c36[_0x354e6c][_0x3cbe1e][_0x1cea('0x57')]),_0x1cea('0x58'))||0x0;if(_0x3cbe1e===_0x3d4c36[_0x354e6c][_0x1cea('0x3c')]-0x1){_0x11f6c7[_0x1cea('0x41')][_0x2c365d][_0x1cea('0x28')]+=moment(_0x3d4c36[_0x354e6c][_0x3cbe1e]['queuecallercompleteAt']||_0x3d4c36[_0x354e6c][_0x3cbe1e][_0x1cea('0x59')]||_0x3d4c36[_0x354e6c][_0x3cbe1e]['queuecallerexitAt'])[_0x1cea('0x5a')](moment(_0x3d4c36[_0x354e6c][_0x3cbe1e]['queuecallerjoinAt']),_0x1cea('0x58'))||0x0;_0x11f6c7[_0x1cea('0x41')][_0x2c365d]['total']+=0x1;if(_0x3d4c36[_0x354e6c][_0x3cbe1e][_0x1cea('0x5b')]){_0x11f6c7[_0x1cea('0x41')][_0x2c365d][_0x1cea('0x2d')]+=0x1;_0x11f6c7[_0x1cea('0x41')][_0x2c365d][_0x1cea('0x29')]+=moment(_0x3d4c36[_0x354e6c][_0x3cbe1e][_0x1cea('0x5c')])['diff'](moment(_0x3d4c36[_0x354e6c][_0x3cbe1e][_0x1cea('0x5d')]),'seconds')||0x0;}}else{_0x11f6c7[_0x1cea('0x41')][_0x2c365d]['sumDuration']+=_0x11f6c7[_0x1cea('0x41')][_0x2c365d]['sumHoldTime']||0x0;}}}}}}return _0x11f6c7[_0x1cea('0x41')];};};Realtime[_0x1cea('0x39')][_0x1cea('0x5e')]=function(){var _0x530ec5=this;return function(_0x28be61){clearVoiceCallReports(_0x530ec5[_0x1cea('0x15')]);if(_0x28be61){for(var _0x394cb8=0x0;_0x394cb8<_0x28be61[_0x1cea('0x3c')];_0x394cb8+=0x1){_0x530ec5[_0x1cea('0x15')][_0x1cea('0x26')]+=0x1;_0x530ec5[_0x1cea('0x15')][_0x1cea('0x28')]+=_0x28be61[_0x394cb8][_0x1cea('0x5f')];if(_0x28be61[_0x394cb8][_0x1cea('0x60')]===_0x1cea('0x61')){_0x530ec5['outbound']['answered']+=0x1;_0x530ec5[_0x1cea('0x15')][_0x1cea('0x27')]+=_0x28be61[_0x394cb8]['duration']-_0x28be61[_0x394cb8][_0x1cea('0x62')]||0x0;_0x530ec5[_0x1cea('0x15')][_0x1cea('0x29')]+=_0x28be61[_0x394cb8][_0x1cea('0x62')];}}}return _0x530ec5['outbound'];};};Realtime[_0x1cea('0x39')][_0x1cea('0x63')]=function(){var _0x4be2c5=this;return function(_0x5efd0c){if(_0x5efd0c){freeIsNotKey(_0x5efd0c,_0x4be2c5[_0x1cea('0x64')],'name');for(var _0x1d5ec8=0x0,_0x4c813e={};_0x1d5ec8<_0x5efd0c['length'];_0x1d5ec8+=0x1){_0x4c813e=_0x5efd0c[_0x1d5ec8];if(_[_0x1cea('0x3d')](_0x4be2c5['campaigns'][_0x4c813e['name']])){_0x4be2c5['campaigns'][_0x4c813e['name']]=new Campaign(_0x4c813e);}else{_0x4be2c5[_0x1cea('0x3a')](_0x4be2c5[_0x1cea('0x64')][_0x4c813e[_0x1cea('0x21')]],_0x4c813e);_0x4be2c5[_0x1cea('0x64')][_0x4c813e['name']]['dialQueueProject']=_0x4c813e[_0x1cea('0x65')]?_0x4c813e[_0x1cea('0x65')]['name']:undefined;}}}return _0x4be2c5[_0x1cea('0x64')];};};Realtime['prototype'][_0x1cea('0x66')]=function(){var _0x145d5c=this;return function(_0x2bee4a){if(_0x2bee4a){freeIsNotKey(_0x2bee4a,_0x145d5c['voiceExtensions'],'id');for(var _0x135710=0x0,_0x31e460={};_0x135710<_0x2bee4a[_0x1cea('0x3c')];_0x135710+=0x1){_0x31e460=_0x2bee4a[_0x135710];if(_['isUndefined'](_0x145d5c[_0x1cea('0x67')][_0x31e460['id']])){_0x145d5c[_0x1cea('0x67')][_0x31e460['id']]=new VoiceExtension(_0x31e460);}else{_0x145d5c[_0x1cea('0x3a')](_0x145d5c['voiceExtensions'][_0x31e460['id']],_0x31e460);}}}return _0x145d5c[_0x1cea('0x67')];};};Realtime['prototype'][_0x1cea('0x68')]=function(){var _0x15fa8c=this;return function(_0x295cb4){clearCampaigns(_0x15fa8c[_0x1cea('0x64')]);for(var _0x426394=0x0;_0x426394<_0x295cb4['length'];_0x426394+=0x1){_[_0x1cea('0x69')](_0x15fa8c[_0x1cea('0x64')][_0x295cb4[_0x426394][_0x1cea('0x21')]],_0x295cb4[_0x426394]);}return _0x15fa8c['campaigns'];};};Realtime[_0x1cea('0x39')][_0x1cea('0x6a')]=function(){var _0x204728=this;return function(_0x26534d){if(_0x26534d){freeIsNotKey(_0x26534d,_0x204728[_0x1cea('0x1e')],'id');for(var _0xa1159d=0x0,_0x2ffbcf={},_0x4b22da={};_0xa1159d<_0x26534d[_0x1cea('0x3c')];_0xa1159d+=0x1){_0x2ffbcf=_0x26534d[_0xa1159d];if(_[_0x1cea('0x3d')](_0x204728[_0x1cea('0x1e')][_0x2ffbcf['id']])){_0x204728[_0x1cea('0x1e')][_0x2ffbcf['id']]=new FaxAccount(_0x2ffbcf);}else{_0x204728[_0x1cea('0x3a')](_0x204728[_0x1cea('0x1e')][_0x2ffbcf['id']],_0x2ffbcf);}}}return _0x204728['faxAccounts'];};};module[_0x1cea('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 9ed2b39..618bc6c 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 _0x67e1=['find','accountcode','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','match','destination','exten','type','dialer','lastapplication','queue','lastdata','context','callerid','from-sip','calleridpreview','originatecalleridnum','channel','destinationchannel','disposition','calleridname','calleridnum','create','monitors','monitorFilename','createdAt','xcally-motion-preview','connectedlinename','membername','xcally-motion-dialer','isArray','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','exports','lodash','moment','util','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','name','isNil'];(function(_0x12a50c,_0x488abc){var _0x1cddf2=function(_0x626a54){while(--_0x626a54){_0x12a50c['push'](_0x12a50c['shift']());}};_0x1cddf2(++_0x488abc);}(_0x67e1,0x86));var _0x167e=function(_0x19a780,_0x10ecf6){_0x19a780=_0x19a780-0x0;var _0x4662ac=_0x67e1[_0x19a780];return _0x4662ac;};'use strict';var BPromise=require('bluebird');var _=require(_0x167e('0x0'));var moment=require(_0x167e('0x1'));var util=require(_0x167e('0x2'));var config=require('../../../config/environment');var logger=require(_0x167e('0x3'))(_0x167e('0x4'));var ami=require(_0x167e('0x5'));var RpcVoiceAgentReport=require(_0x167e('0x6'));var RpcVoiceCallReport=require(_0x167e('0x7'));var RpcVoiceDialReport=require(_0x167e('0x8'));var RpcMemberReport=require(_0x167e('0x9'));var RpcVoiceQueueReport=require(_0x167e('0xa'));var RpcVoiceRecording=require(_0x167e('0xb'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x167e('0xc'));var VoiceCallReport=require(_0x167e('0xd'));var VoiceAgentReport=require(_0x167e('0xe'));var VoiceDialReport=require(_0x167e('0xf'));var UserReport=require(_0x167e('0x10'));function Report(_0x2dccfe){this[_0x167e('0x11')]=_0x2dccfe;this[_0x167e('0x12')]=_0x2dccfe[_0x167e('0x12')];this['telephones']=_0x2dccfe[_0x167e('0x13')];}Report[_0x167e('0x14')]['sync']=function(_0x129678){var _0x1c8afd=new VoiceQueueReport(this[_0x167e('0x11')]);var _0x1a6175=new VoiceAgentReport(this[_0x167e('0x11')]);var _0x30be41=new VoiceDialReport(this[_0x167e('0x11')]);var _0x4d7f6b=new VoiceCallReport(this['realtime']);var _0x56a6ba=new UserReport(this[_0x167e('0x11')]);if(config[_0x167e('0x15')]&&config['xdr'][_0x167e('0x16')]){ami['on']('custom:voiceQueueReport',this[_0x167e('0x17')][_0x167e('0x18')](this));ami['on']('custom:voiceCallReport',this[_0x167e('0x19')][_0x167e('0x18')](this));ami['on'](_0x167e('0x1a'),this[_0x167e('0x1b')]['bind'](this));ami['on'](_0x167e('0x1c'),this[_0x167e('0x1d')][_0x167e('0x18')](this));ami['on']('blindtransfer',this[_0x167e('0x1e')]['bind'](this));ami['on'](_0x167e('0x1f'),this[_0x167e('0x20')][_0x167e('0x18')](this));}};Report[_0x167e('0x14')][_0x167e('0x21')]=function(_0x141887){var _0x378f58=undefined;_0x378f58=_['find'](this['agents'],function(_0x1fab12){return _0x1fab12['accountcode']==_0x141887||_0x1fab12[_0x167e('0x22')]==_0x141887;});if(_[_0x167e('0x23')](_0x378f58)){var _0x586980=_[_0x167e('0x24')](this['telephones'],function(_0x169cba){return _0x169cba[_0x167e('0x25')]==_0x141887||_0x169cba[_0x167e('0x22')]==_0x141887;});if(_0x586980){_0x378f58=_['find'](this[_0x167e('0x12')],function(_0x24c46b){return _0x24c46b[_0x167e('0x26')]==util[_0x167e('0x27')](_0x167e('0x28'),_0x586980[_0x167e('0x22')]);});}}return _0x378f58;};Report['prototype'][_0x167e('0x17')]=function(_0x24bf2e){for(var _0x11fdff=0x0;_0x11fdff<_0x24bf2e[_0x167e('0x29')];_0x11fdff+=0x1){var _0x19d11b=this['findAgent'](_0x24bf2e[_0x11fdff][_0x167e('0x2a')]);if(_0x19d11b){_0x24bf2e[_0x11fdff][_0x167e('0x25')]=_0x19d11b[_0x167e('0x25')];_0x24bf2e[_0x11fdff][_0x167e('0x2b')]=!![];_0x24bf2e[_0x11fdff][_0x167e('0x2c')]=_0x19d11b['name'];_0x24bf2e[_0x11fdff][_0x167e('0x26')]=_[_0x167e('0x23')](_0x19d11b[_0x167e('0x26')])?util['format'](_0x167e('0x28'),_0x19d11b[_0x167e('0x22')]):_0x19d11b['interface'];if(_0x24bf2e[_0x11fdff][_0x167e('0x2d')]){_0x24bf2e[_0x11fdff][_0x167e('0x2e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x24bf2e[_0x11fdff][_0x167e('0x2f')]){_0x24bf2e[_0x11fdff][_0x167e('0x30')]=moment()[_0x167e('0x27')](_0x167e('0x31'));}RpcMemberReport[_0x167e('0x17')](_0x24bf2e[_0x11fdff]);}RpcVoiceQueueReport['create'](_0x24bf2e[_0x11fdff]);}};function extractCalleridNumber(_0x53e751){var _0x14aa5f=_0x53e751[_0x167e('0x32')](/<(.*?)>/);return _0x14aa5f?_0x14aa5f[0x1]:_0x53e751;}Report[_0x167e('0x14')][_0x167e('0x19')]=function(_0x109ae6){_0x109ae6[_0x167e('0x33')]=_0x109ae6[_0x167e('0x33')]||_0x109ae6[_0x167e('0x34')];if(_0x109ae6[_0x167e('0x35')]==_0x167e('0x36')){_0x109ae6[_0x167e('0x37')]=_0x167e('0x38');_0x109ae6[_0x167e('0x39')]=_0x109ae6[_0x167e('0x38')];if(_0x109ae6[_0x167e('0x3a')]=='from-voip-provider'){_0x109ae6['accountcode']='';_0x109ae6[_0x167e('0x33')]=extractCalleridNumber(_0x109ae6[_0x167e('0x3b')]);}else if(_0x109ae6[_0x167e('0x3a')]==_0x167e('0x3c')){if(_0x109ae6[_0x167e('0x33')]=='xcally-motion-preview'){_0x109ae6['destination']=extractCalleridNumber(_0x109ae6[_0x167e('0x3d')]);_0x109ae6['calleridnum']=_0x109ae6[_0x167e('0x3e')];_0x109ae6['destinationchannel']=[_0x109ae6[_0x167e('0x3f')],_0x109ae6[_0x167e('0x3f')]=_0x109ae6[_0x167e('0x40')]][0x0];_0x109ae6[_0x167e('0x3b')]=_0x109ae6[_0x167e('0x3d')];}else{_0x109ae6[_0x167e('0x33')]=_0x109ae6['calleridnum'];_0x109ae6['calleridnum']=_0x109ae6[_0x167e('0x3e')];if(_0x109ae6[_0x167e('0x41')]=='ANSWERED'){_0x109ae6['accountcode']=_0x109ae6[_0x167e('0x2a')];}else{_0x109ae6['accountcode']='';}}}}else{_0x109ae6[_0x167e('0x3b')]=util[_0x167e('0x27')]('\x22%s\x22\x20<%s>',_0x109ae6[_0x167e('0x42')],_0x109ae6[_0x167e('0x43')]);}RpcVoiceCallReport[_0x167e('0x44')](_0x109ae6);if(_0x109ae6['monitor']){for(var _0x5b7c26=0x0;_0x5b7c26<_0x109ae6[_0x167e('0x45')][_0x167e('0x29')];_0x5b7c26+=0x1){_0x109ae6[_0x167e('0x46')]=_0x109ae6[_0x167e('0x45')][_0x5b7c26]['filename'];_0x109ae6[_0x167e('0x47')]=_0x109ae6[_0x167e('0x45')][_0x5b7c26][_0x167e('0x47')];if(_0x109ae6[_0x167e('0x34')]==_0x167e('0x48')){_0x109ae6[_0x167e('0x43')]=_0x109ae6[_0x167e('0x2a')];_0x109ae6['calleridname']=_0x109ae6[_0x167e('0x49')];_0x109ae6[_0x167e('0x2a')]=_0x109ae6['accountcode'];_0x109ae6[_0x167e('0x49')]=_0x109ae6[_0x167e('0x4a')];_0x109ae6[_0x167e('0x34')]=_0x109ae6[_0x167e('0x3e')];}else if(_0x109ae6[_0x167e('0x34')]==_0x167e('0x4b')){_0x109ae6[_0x167e('0x43')]=_0x109ae6[_0x167e('0x33')];_0x109ae6[_0x167e('0x34')]=_0x109ae6[_0x167e('0x3e')];}RpcVoiceRecording[_0x167e('0x44')](_0x109ae6);}}};Report[_0x167e('0x14')][_0x167e('0x1b')]=function(_0xdbb71){if(_[_0x167e('0x4c')](_0xdbb71)){_0xdbb71['forEach'](function(_0x2e21a0){RpcVoiceAgentReport[_0x167e('0x44')](_0x2e21a0);});}else{RpcVoiceAgentReport[_0x167e('0x44')](_0xdbb71);}};Report[_0x167e('0x14')][_0x167e('0x1d')]=function(_0x1c8e5e){RpcVoiceDialReport['create'](_0x1c8e5e);var _0x376039=undefined;var _0x1fdfba=_0x1c8e5e[_0x167e('0x3f')];if(_[_0x167e('0x4d')](_0x1fdfba,_0x167e('0x4e'))){var _0x22dca4=_0x1fdfba['substring'](_0x1fdfba[_0x167e('0x4f')]('/')+0x1,_0x1fdfba[_0x167e('0x4f')]('@'));_0x376039=_[_0x167e('0x24')](this[_0x167e('0x12')],function(_0x4ea993){return _0x4ea993[_0x167e('0x50')]==_0x22dca4||_0x4ea993[_0x167e('0x51')]==_0x22dca4||_0x4ea993[_0x167e('0x25')]==_0x22dca4;});}else{var _0x22dca4=_0x1fdfba[_0x167e('0x52')](_0x1fdfba[_0x167e('0x4f')]('/')+0x1,_0x1fdfba[_0x167e('0x53')]('-'));_0x376039=this[_0x167e('0x21')](_0x22dca4);}if(_0x376039){_0x1c8e5e[_0x167e('0x26')]=_[_0x167e('0x23')](_0x376039[_0x167e('0x26')])?util[_0x167e('0x27')]('SIP/%s',_0x376039[_0x167e('0x22')]):_0x376039[_0x167e('0x26')];_0x1c8e5e[_0x167e('0x4a')]=_0x376039['name'];_0x1c8e5e[_0x167e('0x25')]=_0x376039[_0x167e('0x25')];RpcMemberReport[_0x167e('0x1d')](_0x1c8e5e);}};Report[_0x167e('0x14')][_0x167e('0x1e')]=function(_0x1be462){RpcVoiceTransferReport['blindTransfer'](_0x1be462);};Report[_0x167e('0x14')][_0x167e('0x20')]=function(_0x22caa2){RpcVoiceTransferReport[_0x167e('0x20')](_0x22caa2);};module[_0x167e('0x54')]=Report; \ No newline at end of file +var _0x8b91=['calleridname','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','voiceDialReport','Local','indexOf','mobile','phone','substring','lastIndexOf','exports','bluebird','lodash','moment','util','../../../config/environment','ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','name','isNil','accountcode','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','exten','dialer','lastapplication','queue','lastdata','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','\x22%s\x22\x20<%s>'];(function(_0x29bc46,_0x1cbe78){var _0x5099d9=function(_0x44e4a3){while(--_0x44e4a3){_0x29bc46['push'](_0x29bc46['shift']());}};_0x5099d9(++_0x1cbe78);}(_0x8b91,0x1ac));var _0x18b9=function(_0x472b22,_0x3d0cca){_0x472b22=_0x472b22-0x0;var _0x5174a1=_0x8b91[_0x472b22];return _0x5174a1;};'use strict';var BPromise=require(_0x18b9('0x0'));var _=require(_0x18b9('0x1'));var moment=require(_0x18b9('0x2'));var util=require(_0x18b9('0x3'));var config=require(_0x18b9('0x4'));var logger=require('../../../config/logger')(_0x18b9('0x5'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x18b9('0x6'));var RpcVoiceCallReport=require(_0x18b9('0x7'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x18b9('0x8'));var RpcVoiceRecording=require(_0x18b9('0x9'));var RpcVoiceTransferReport=require(_0x18b9('0xa'));var VoiceQueueReport=require(_0x18b9('0xb'));var VoiceCallReport=require(_0x18b9('0xc'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0xcf2bf1){this[_0x18b9('0xd')]=_0xcf2bf1;this[_0x18b9('0xe')]=_0xcf2bf1[_0x18b9('0xe')];this[_0x18b9('0xf')]=_0xcf2bf1[_0x18b9('0xf')];}Report[_0x18b9('0x10')][_0x18b9('0x11')]=function(_0x1a4615){var _0x2001d6=new VoiceQueueReport(this[_0x18b9('0xd')]);var _0x2cb682=new VoiceAgentReport(this[_0x18b9('0xd')]);var _0x23b115=new VoiceDialReport(this['realtime']);var _0x3a87db=new VoiceCallReport(this['realtime']);var _0x41f9d8=new UserReport(this['realtime']);if(config[_0x18b9('0x12')]&&config[_0x18b9('0x12')]['disabled']){ami['on'](_0x18b9('0x13'),this[_0x18b9('0x14')][_0x18b9('0x15')](this));ami['on']('custom:voiceCallReport',this[_0x18b9('0x16')][_0x18b9('0x15')](this));ami['on'](_0x18b9('0x17'),this[_0x18b9('0x18')][_0x18b9('0x15')](this));ami['on'](_0x18b9('0x19'),this['voiceDialReport']['bind'](this));ami['on'](_0x18b9('0x1a'),this[_0x18b9('0x1b')][_0x18b9('0x15')](this));ami['on'](_0x18b9('0x1c'),this[_0x18b9('0x1d')][_0x18b9('0x15')](this));}};Report[_0x18b9('0x10')][_0x18b9('0x1e')]=function(_0x1105db){var _0x450a06=undefined;_0x450a06=_[_0x18b9('0x1f')](this[_0x18b9('0xe')],function(_0x1a05eb){return _0x1a05eb['accountcode']==_0x1105db||_0x1a05eb[_0x18b9('0x20')]==_0x1105db;});if(_[_0x18b9('0x21')](_0x450a06)){var _0x2bddda=_[_0x18b9('0x1f')](this[_0x18b9('0xf')],function(_0x7b5517){return _0x7b5517[_0x18b9('0x22')]==_0x1105db||_0x7b5517[_0x18b9('0x20')]==_0x1105db;});if(_0x2bddda){_0x450a06=_[_0x18b9('0x1f')](this[_0x18b9('0xe')],function(_0x39a6ef){return _0x39a6ef[_0x18b9('0x23')]==util[_0x18b9('0x24')](_0x18b9('0x25'),_0x2bddda[_0x18b9('0x20')]);});}}return _0x450a06;};Report['prototype'][_0x18b9('0x14')]=function(_0x2a3ad5){for(var _0x159c3f=0x0;_0x159c3f<_0x2a3ad5[_0x18b9('0x26')];_0x159c3f+=0x1){var _0x57263b=this['findAgent'](_0x2a3ad5[_0x159c3f][_0x18b9('0x27')]);if(_0x57263b){_0x2a3ad5[_0x159c3f][_0x18b9('0x22')]=_0x57263b[_0x18b9('0x22')];_0x2a3ad5[_0x159c3f][_0x18b9('0x28')]=!![];_0x2a3ad5[_0x159c3f][_0x18b9('0x29')]=_0x57263b['name'];_0x2a3ad5[_0x159c3f][_0x18b9('0x23')]=_[_0x18b9('0x21')](_0x57263b[_0x18b9('0x23')])?util[_0x18b9('0x24')](_0x18b9('0x25'),_0x57263b['name']):_0x57263b[_0x18b9('0x23')];if(_0x2a3ad5[_0x159c3f]['queuecallercomplete']){_0x2a3ad5[_0x159c3f][_0x18b9('0x2a')]=moment()['format'](_0x18b9('0x2b'));}if(_0x2a3ad5[_0x159c3f][_0x18b9('0x2c')]){_0x2a3ad5[_0x159c3f][_0x18b9('0x2d')]=moment()[_0x18b9('0x24')](_0x18b9('0x2b'));}RpcMemberReport[_0x18b9('0x14')](_0x2a3ad5[_0x159c3f]);}RpcVoiceQueueReport[_0x18b9('0x2e')](_0x2a3ad5[_0x159c3f]);}};function extractCalleridNumber(_0x2b1ead){var _0x1bce32=_0x2b1ead[_0x18b9('0x2f')](/<(.*?)>/);return _0x1bce32?_0x1bce32[0x1]:_0x2b1ead;}Report[_0x18b9('0x10')]['voiceCallReport']=function(_0x56e58f){_0x56e58f[_0x18b9('0x30')]=_0x56e58f['destination']||_0x56e58f[_0x18b9('0x31')];if(_0x56e58f['type']==_0x18b9('0x32')){_0x56e58f[_0x18b9('0x33')]=_0x18b9('0x34');_0x56e58f[_0x18b9('0x35')]=_0x56e58f['queue'];if(_0x56e58f['context']=='from-voip-provider'){_0x56e58f[_0x18b9('0x22')]='';_0x56e58f[_0x18b9('0x30')]=extractCalleridNumber(_0x56e58f[_0x18b9('0x36')]);}else if(_0x56e58f['context']==_0x18b9('0x37')){if(_0x56e58f[_0x18b9('0x30')]==_0x18b9('0x38')){_0x56e58f['destination']=extractCalleridNumber(_0x56e58f[_0x18b9('0x39')]);_0x56e58f[_0x18b9('0x3a')]=_0x56e58f[_0x18b9('0x3b')];_0x56e58f[_0x18b9('0x3c')]=[_0x56e58f[_0x18b9('0x3d')],_0x56e58f[_0x18b9('0x3d')]=_0x56e58f[_0x18b9('0x3c')]][0x0];_0x56e58f[_0x18b9('0x36')]=_0x56e58f['calleridpreview'];}else{_0x56e58f[_0x18b9('0x30')]=_0x56e58f['calleridnum'];_0x56e58f[_0x18b9('0x3a')]=_0x56e58f['originatecalleridnum'];if(_0x56e58f[_0x18b9('0x3e')]=='ANSWERED'){_0x56e58f[_0x18b9('0x22')]=_0x56e58f['connectedlinenum'];}else{_0x56e58f[_0x18b9('0x22')]='';}}}}else{_0x56e58f[_0x18b9('0x36')]=util[_0x18b9('0x24')](_0x18b9('0x3f'),_0x56e58f[_0x18b9('0x40')],_0x56e58f[_0x18b9('0x3a')]);}RpcVoiceCallReport[_0x18b9('0x2e')](_0x56e58f);if(_0x56e58f['monitor']){for(var _0x5014ec=0x0;_0x5014ec<_0x56e58f[_0x18b9('0x41')][_0x18b9('0x26')];_0x5014ec+=0x1){_0x56e58f[_0x18b9('0x42')]=_0x56e58f[_0x18b9('0x41')][_0x5014ec][_0x18b9('0x43')];_0x56e58f[_0x18b9('0x44')]=_0x56e58f['monitors'][_0x5014ec][_0x18b9('0x44')];if(_0x56e58f[_0x18b9('0x31')]=='xcally-motion-preview'){_0x56e58f[_0x18b9('0x3a')]=_0x56e58f[_0x18b9('0x27')];_0x56e58f[_0x18b9('0x40')]=_0x56e58f[_0x18b9('0x45')];_0x56e58f[_0x18b9('0x27')]=_0x56e58f[_0x18b9('0x22')];_0x56e58f[_0x18b9('0x45')]=_0x56e58f[_0x18b9('0x46')];_0x56e58f[_0x18b9('0x31')]=_0x56e58f[_0x18b9('0x3b')];}else if(_0x56e58f[_0x18b9('0x31')]==_0x18b9('0x47')){_0x56e58f[_0x18b9('0x3a')]=_0x56e58f[_0x18b9('0x30')];_0x56e58f[_0x18b9('0x31')]=_0x56e58f['originatecalleridnum'];}RpcVoiceRecording[_0x18b9('0x2e')](_0x56e58f);}}};Report[_0x18b9('0x10')][_0x18b9('0x18')]=function(_0x2d1e78){if(_[_0x18b9('0x48')](_0x2d1e78)){_0x2d1e78[_0x18b9('0x49')](function(_0x1cb662){RpcVoiceAgentReport[_0x18b9('0x2e')](_0x1cb662);});}else{RpcVoiceAgentReport['create'](_0x2d1e78);}};Report['prototype'][_0x18b9('0x4a')]=function(_0x1a3734){RpcVoiceDialReport[_0x18b9('0x2e')](_0x1a3734);var _0x392049=undefined;var _0x4a815d=_0x1a3734[_0x18b9('0x3d')];if(_['startsWith'](_0x4a815d,_0x18b9('0x4b'))){var _0x5723ae=_0x4a815d['substring'](_0x4a815d[_0x18b9('0x4c')]('/')+0x1,_0x4a815d[_0x18b9('0x4c')]('@'));_0x392049=_[_0x18b9('0x1f')](this['agents'],function(_0x2ebb41){return _0x2ebb41[_0x18b9('0x4d')]==_0x5723ae||_0x2ebb41[_0x18b9('0x4e')]==_0x5723ae||_0x2ebb41[_0x18b9('0x22')]==_0x5723ae;});}else{var _0x5723ae=_0x4a815d[_0x18b9('0x4f')](_0x4a815d[_0x18b9('0x4c')]('/')+0x1,_0x4a815d[_0x18b9('0x50')]('-'));_0x392049=this[_0x18b9('0x1e')](_0x5723ae);}if(_0x392049){_0x1a3734[_0x18b9('0x23')]=_[_0x18b9('0x21')](_0x392049['interface'])?util[_0x18b9('0x24')](_0x18b9('0x25'),_0x392049['name']):_0x392049[_0x18b9('0x23')];_0x1a3734['membername']=_0x392049[_0x18b9('0x20')];_0x1a3734[_0x18b9('0x22')]=_0x392049[_0x18b9('0x22')];RpcMemberReport[_0x18b9('0x4a')](_0x1a3734);}};Report['prototype'][_0x18b9('0x1b')]=function(_0x240d7e){RpcVoiceTransferReport[_0x18b9('0x1b')](_0x240d7e);};Report[_0x18b9('0x10')][_0x18b9('0x1d')]=function(_0x465aa){RpcVoiceTransferReport[_0x18b9('0x1d')](_0x465aa);};module[_0x18b9('0x51')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 3e84d52..d577a8a 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 _0x3ca6=['peer','registered','status','address','trunk:save','exports','lodash','moment','bluebird','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','trunks','agents','telephones','registry','bind','syncDeviceState','syncPeerStatus','loopSyncRealTimeShow','resolve','actionSipShowRegistry','actionDeviceStateList','then','actionSipPeerStatus','error','inspect','catch','[loopSyncRealTimeShow]','isNotNull','isUndefined','prototype','emit','syncRegistry','find','username','stateRegistry','state','merge','actionid','format','trunk:%s','[syncRegistry][UserReport]','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:%s','name','telephone:save','Queue','Local','substring','indexOf','mobile','phone','accountcode','[syncDeviceState][UserReport]','peerstatus'];(function(_0x5a62de,_0x483216){var _0x402056=function(_0x4ddaa3){while(--_0x4ddaa3){_0x5a62de['push'](_0x5a62de['shift']());}};_0x402056(++_0x483216);}(_0x3ca6,0x19e));var _0x63ca=function(_0x3ec153,_0x40604f){_0x3ec153=_0x3ec153-0x0;var _0x492fed=_0x3ca6[_0x3ec153];return _0x492fed;};'use strict';var _=require(_0x63ca('0x0'));var moment=require(_0x63ca('0x1'));var BPromise=require(_0x63ca('0x2'));var util=require(_0x63ca('0x3'));var Redis=require(_0x63ca('0x4'));var config=require(_0x63ca('0x5'));var logger=require(_0x63ca('0x6'))(_0x63ca('0x7'));var ami=require(_0x63ca('0x8'));config[_0x63ca('0x9')]=_[_0x63ca('0xa')](config['redis'],{'host':_0x63ca('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function UserReport(_0xb825c5){this[_0x63ca('0xc')]=_0xb825c5[_0x63ca('0xc')];this[_0x63ca('0xd')]=_0xb825c5[_0x63ca('0xd')];this[_0x63ca('0xe')]=_0xb825c5[_0x63ca('0xe')];ami['on']('registryentry',this['syncRegistry']['bind'](this));ami['on'](_0x63ca('0xf'),this['syncRegistry'][_0x63ca('0x10')](this));ami['on']('devicestatechange',this[_0x63ca('0x11')][_0x63ca('0x10')](this));ami['on']('peerstatus',this[_0x63ca('0x12')]['bind'](this));this[_0x63ca('0x13')]();return BPromise[_0x63ca('0x14')]()['then'](ami[_0x63ca('0x15')]())['then'](ami[_0x63ca('0x16')]())[_0x63ca('0x17')](ami[_0x63ca('0x18')]())['catch'](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x15ad49){return function(_0x535087){logger[_0x63ca('0x19')](_0x15ad49,util[_0x63ca('0x1a')](_0x535087,{'showHidden':![],'depth':null}));};}UserReport['prototype'][_0x63ca('0x13')]=function(){setInterval(function(){BPromise['resolve']()[_0x63ca('0x17')](ami[_0x63ca('0x15')]())[_0x63ca('0x17')](ami['actionDeviceStateList']())[_0x63ca('0x17')](ami['actionSipPeerStatus']())[_0x63ca('0x1b')](loggerCatch(_0x63ca('0x1c')));},0x32c8);};UserReport['prototype'][_0x63ca('0x1d')]=function(_0x52dd2f){return _0x52dd2f!==null&&!_[_0x63ca('0x1e')](_0x52dd2f);};UserReport[_0x63ca('0x1f')][_0x63ca('0x20')]=function(_0x22d505,_0x4f1113,_0x24eadb){io['to'](_0x22d505)['emit'](_0x4f1113,_0x24eadb);};UserReport[_0x63ca('0x1f')][_0x63ca('0x21')]=function(_0x56a93b){try{if(this[_0x63ca('0x1d')](_0x56a93b)){var _0x193139=_[_0x63ca('0x22')](this['trunks'],{'registry':_0x56a93b[_0x63ca('0x23')]});if(_0x193139){_0x56a93b[_0x63ca('0x24')]=_0x56a93b[_0x63ca('0x25')];_[_0x63ca('0x26')](_0x193139,_['omit'](_0x56a93b,['event',_0x63ca('0x27'),_0x63ca('0x23'),'state']));this['emit'](util[_0x63ca('0x28')](_0x63ca('0x29'),_0x193139['name']),'trunk:save',_0x193139);}}}catch(_0x1f51c8){logger[_0x63ca('0x19')](_0x63ca('0x2a'),util[_0x63ca('0x1a')](_0x1f51c8,{'showHidden':![],'depth':null}));}};UserReport[_0x63ca('0x1f')][_0x63ca('0x11')]=function(_0x59d1ca){try{if(this[_0x63ca('0x1d')](_0x59d1ca)){if(this['agents'][_0x59d1ca[_0x63ca('0x2b')]]){if(!this[_0x63ca('0xd')][_0x59d1ca['device']][_0x63ca('0x2c')]||_0x59d1ca[_0x63ca('0x25')][_0x63ca('0x2d')]()==_0x63ca('0x2e')){this[_0x63ca('0xd')][_0x59d1ca[_0x63ca('0x2b')]]['local']=![];if(this[_0x63ca('0xd')][_0x59d1ca[_0x63ca('0x2b')]][_0x63ca('0x25')]!==_0x59d1ca[_0x63ca('0x25')][_0x63ca('0x2d')]()){this[_0x63ca('0xd')][_0x59d1ca[_0x63ca('0x2b')]][_0x63ca('0x2f')]=_[_0x63ca('0x30')](moment()[_0x63ca('0x28')]('x'));}this[_0x63ca('0xd')][_0x59d1ca[_0x63ca('0x2b')]]['state']=_0x59d1ca[_0x63ca('0x25')]['toLowerCase']();this[_0x63ca('0xd')][_0x59d1ca['device']][_0x63ca('0x31')](_0x59d1ca);}}else if(this[_0x63ca('0xe')][_0x59d1ca['device']]){if(this[_0x63ca('0xe')][_0x59d1ca[_0x63ca('0x2b')]][_0x63ca('0x25')]!==_0x59d1ca[_0x63ca('0x25')][_0x63ca('0x2d')]()){this['telephones'][_0x59d1ca[_0x63ca('0x2b')]][_0x63ca('0x2f')]=_[_0x63ca('0x30')](moment()[_0x63ca('0x28')]('x'));}this[_0x63ca('0xe')][_0x59d1ca[_0x63ca('0x2b')]][_0x63ca('0x25')]=_0x59d1ca[_0x63ca('0x25')][_0x63ca('0x2d')]();this[_0x63ca('0x20')](util['format'](_0x63ca('0x32'),this['telephones'][_0x59d1ca['device']][_0x63ca('0x33')]),_0x63ca('0x34'),this[_0x63ca('0xe')][_0x59d1ca[_0x63ca('0x2b')]]);}else if(this['trunks'][_0x59d1ca[_0x63ca('0x2b')]]){if(this[_0x63ca('0xc')][_0x59d1ca[_0x63ca('0x2b')]][_0x63ca('0x25')]!==_0x59d1ca[_0x63ca('0x25')][_0x63ca('0x2d')]()){this[_0x63ca('0xc')][_0x59d1ca[_0x63ca('0x2b')]][_0x63ca('0x2f')]=_[_0x63ca('0x30')](moment()['format']('x'));}this[_0x63ca('0xc')][_0x59d1ca[_0x63ca('0x2b')]][_0x63ca('0x25')]=_0x59d1ca['state'][_0x63ca('0x2d')]();this['emit'](util['format'](_0x63ca('0x29'),this[_0x63ca('0xc')][_0x59d1ca[_0x63ca('0x2b')]][_0x63ca('0x33')]),'trunk:save',this['trunks'][_0x59d1ca[_0x63ca('0x2b')]]);}else if(_['startsWith'](_0x59d1ca[_0x63ca('0x2b')],_0x63ca('0x35'))){}else if(_['startsWith'](_0x59d1ca[_0x63ca('0x2b')],_0x63ca('0x36'))){var _0x29cd7f=_0x59d1ca[_0x63ca('0x2b')];var _0x4dc018=_0x29cd7f[_0x63ca('0x37')](_0x29cd7f[_0x63ca('0x38')]('/')+0x1,_0x29cd7f[_0x63ca('0x38')]('@'));var _0x3335fd=_[_0x63ca('0x22')](this[_0x63ca('0xd')],function(_0x1bf13f){return _0x1bf13f[_0x63ca('0x39')]==_0x4dc018||_0x1bf13f[_0x63ca('0x3a')]==_0x4dc018||_0x1bf13f[_0x63ca('0x3b')]==_0x4dc018;});if(_0x3335fd){if(_0x3335fd[_0x63ca('0x25')]!==_0x59d1ca[_0x63ca('0x25')]['toLowerCase']()){_0x3335fd[_0x63ca('0x2f')]=_[_0x63ca('0x30')](moment()[_0x63ca('0x28')]('x'));}_0x3335fd['state']=_0x59d1ca[_0x63ca('0x25')][_0x63ca('0x2d')]();_0x3335fd[_0x63ca('0x2c')]=!![];_0x3335fd[_0x63ca('0x31')](_0x59d1ca);}}else{}}}catch(_0x1d5747){logger[_0x63ca('0x19')](_0x63ca('0x3c'),util[_0x63ca('0x1a')](_0x1d5747,{'showHidden':![],'depth':null}));}};UserReport[_0x63ca('0x1f')]['syncPeerStatus']=function(_0xa83164){try{if(this['isNotNull'](_0xa83164)&&this[_0x63ca('0x1d')](_0xa83164[_0x63ca('0x3d')])){if(this[_0x63ca('0xd')][_0xa83164['peer']]){if(!this[_0x63ca('0xd')][_0xa83164[_0x63ca('0x3e')]]['local']||_0xa83164[_0x63ca('0x3d')][_0x63ca('0x2d')]()==_0x63ca('0x3f')){this[_0x63ca('0xd')][_0xa83164[_0x63ca('0x3e')]][_0x63ca('0x2c')]=![];this[_0x63ca('0xd')][_0xa83164['peer']][_0x63ca('0x40')]=_0xa83164['peerstatus'][_0x63ca('0x2d')]();this[_0x63ca('0xd')][_0xa83164['peer']]['address']=_0xa83164[_0x63ca('0x41')];this[_0x63ca('0xd')][_0xa83164[_0x63ca('0x3e')]][_0x63ca('0x31')](_0xa83164);}}else if(this[_0x63ca('0xe')][_0xa83164[_0x63ca('0x3e')]]){this[_0x63ca('0xe')][_0xa83164['peer']]['status']=_0xa83164[_0x63ca('0x3d')][_0x63ca('0x2d')]();this['telephones'][_0xa83164[_0x63ca('0x3e')]]['address']=_0xa83164[_0x63ca('0x41')];this[_0x63ca('0x20')](util[_0x63ca('0x28')](_0x63ca('0x32'),this['telephones'][_0xa83164[_0x63ca('0x3e')]]['name']),_0x63ca('0x34'),this[_0x63ca('0xe')][_0xa83164[_0x63ca('0x3e')]]);}else if(this[_0x63ca('0xc')][_0xa83164[_0x63ca('0x3e')]]){this[_0x63ca('0xc')][_0xa83164[_0x63ca('0x3e')]][_0x63ca('0x40')]=_0xa83164[_0x63ca('0x3d')][_0x63ca('0x2d')]();this[_0x63ca('0xc')][_0xa83164[_0x63ca('0x3e')]][_0x63ca('0x41')]=_0xa83164[_0x63ca('0x41')];this[_0x63ca('0x20')](util['format'](_0x63ca('0x29'),this['trunks'][_0xa83164['peer']][_0x63ca('0x33')]),_0x63ca('0x42'),this[_0x63ca('0xc')][_0xa83164[_0x63ca('0x3e')]]);}else{}}}catch(_0x2ff26d){logger[_0x63ca('0x19')]('[syncPeerStatus][UserReport]',util['inspect'](_0x2ff26d,{'showHidden':![],'depth':null}));}};module[_0x63ca('0x43')]=UserReport; \ No newline at end of file +var _0x076d=['inuse','stateTime','toNumber','updateStatusRealtime','telephone:%s','startsWith','indexOf','find','mobile','accountcode','[syncDeviceState][UserReport]','peer','registered','status','address','telephone:save','lodash','moment','bluebird','util','ioredis','../../../config/environment','redis','defaults','trunks','agents','telephones','registryentry','bind','registry','syncRegistry','devicestatechange','syncDeviceState','peerstatus','loopSyncRealTimeShow','actionSipShowRegistry','then','actionDeviceStateList','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','error','inspect','prototype','resolve','isNotNull','isUndefined','emit','stateRegistry','state','merge','actionid','username','format','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','device','local','toLowerCase'];(function(_0x168c2c,_0x3f4de0){var _0x53b528=function(_0x202102){while(--_0x202102){_0x168c2c['push'](_0x168c2c['shift']());}};_0x53b528(++_0x3f4de0);}(_0x076d,0x8a));var _0xd076=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x076d[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0xd076('0x0'));var moment=require(_0xd076('0x1'));var BPromise=require(_0xd076('0x2'));var util=require(_0xd076('0x3'));var Redis=require(_0xd076('0x4'));var config=require(_0xd076('0x5'));var logger=require('../../../config/logger')('ami');var ami=require('../ami');config[_0xd076('0x6')]=_[_0xd076('0x7')](config[_0xd076('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd076('0x6')]));function UserReport(_0x2ff0e6){this[_0xd076('0x8')]=_0x2ff0e6[_0xd076('0x8')];this[_0xd076('0x9')]=_0x2ff0e6[_0xd076('0x9')];this[_0xd076('0xa')]=_0x2ff0e6[_0xd076('0xa')];ami['on'](_0xd076('0xb'),this['syncRegistry'][_0xd076('0xc')](this));ami['on'](_0xd076('0xd'),this[_0xd076('0xe')][_0xd076('0xc')](this));ami['on'](_0xd076('0xf'),this[_0xd076('0x10')]['bind'](this));ami['on'](_0xd076('0x11'),this['syncPeerStatus'][_0xd076('0xc')](this));this[_0xd076('0x12')]();return BPromise['resolve']()['then'](ami[_0xd076('0x13')]())[_0xd076('0x14')](ami[_0xd076('0x15')]())[_0xd076('0x14')](ami[_0xd076('0x16')]())[_0xd076('0x17')](loggerCatch(_0xd076('0x18')));}function loggerCatch(_0x1641c0){return function(_0xdb3284){logger[_0xd076('0x19')](_0x1641c0,util[_0xd076('0x1a')](_0xdb3284,{'showHidden':![],'depth':null}));};}UserReport[_0xd076('0x1b')]['loopSyncRealTimeShow']=function(){setInterval(function(){BPromise[_0xd076('0x1c')]()[_0xd076('0x14')](ami[_0xd076('0x13')]())[_0xd076('0x14')](ami[_0xd076('0x15')]())['then'](ami[_0xd076('0x16')]())[_0xd076('0x17')](loggerCatch(_0xd076('0x18')));},0x32c8);};UserReport[_0xd076('0x1b')][_0xd076('0x1d')]=function(_0x4f2ddf){return _0x4f2ddf!==null&&!_[_0xd076('0x1e')](_0x4f2ddf);};UserReport[_0xd076('0x1b')][_0xd076('0x1f')]=function(_0xfcd25f,_0x2b21c9,_0x21ba1a){io['to'](_0xfcd25f)[_0xd076('0x1f')](_0x2b21c9,_0x21ba1a);};UserReport[_0xd076('0x1b')][_0xd076('0xe')]=function(_0x449082){try{if(this[_0xd076('0x1d')](_0x449082)){var _0x15ed01=_['find'](this[_0xd076('0x8')],{'registry':_0x449082['username']});if(_0x15ed01){_0x449082[_0xd076('0x20')]=_0x449082[_0xd076('0x21')];_[_0xd076('0x22')](_0x15ed01,_['omit'](_0x449082,['event',_0xd076('0x23'),_0xd076('0x24'),_0xd076('0x21')]));this['emit'](util[_0xd076('0x25')](_0xd076('0x26'),_0x15ed01[_0xd076('0x27')]),_0xd076('0x28'),_0x15ed01);}}}catch(_0x17df73){logger[_0xd076('0x19')](_0xd076('0x29'),util[_0xd076('0x1a')](_0x17df73,{'showHidden':![],'depth':null}));}};UserReport[_0xd076('0x1b')][_0xd076('0x10')]=function(_0x5d0cfd){try{if(this[_0xd076('0x1d')](_0x5d0cfd)){if(this[_0xd076('0x9')][_0x5d0cfd[_0xd076('0x2a')]]){if(!this[_0xd076('0x9')][_0x5d0cfd[_0xd076('0x2a')]][_0xd076('0x2b')]||_0x5d0cfd[_0xd076('0x21')][_0xd076('0x2c')]()==_0xd076('0x2d')){this[_0xd076('0x9')][_0x5d0cfd[_0xd076('0x2a')]]['local']=![];if(this[_0xd076('0x9')][_0x5d0cfd[_0xd076('0x2a')]]['state']!==_0x5d0cfd[_0xd076('0x21')]['toLowerCase']()){this['agents'][_0x5d0cfd[_0xd076('0x2a')]][_0xd076('0x2e')]=_[_0xd076('0x2f')](moment()[_0xd076('0x25')]('x'));}this[_0xd076('0x9')][_0x5d0cfd['device']][_0xd076('0x21')]=_0x5d0cfd[_0xd076('0x21')][_0xd076('0x2c')]();this[_0xd076('0x9')][_0x5d0cfd[_0xd076('0x2a')]][_0xd076('0x30')](_0x5d0cfd);}}else if(this[_0xd076('0xa')][_0x5d0cfd[_0xd076('0x2a')]]){if(this['telephones'][_0x5d0cfd[_0xd076('0x2a')]]['state']!==_0x5d0cfd[_0xd076('0x21')][_0xd076('0x2c')]()){this[_0xd076('0xa')][_0x5d0cfd[_0xd076('0x2a')]]['stateTime']=_[_0xd076('0x2f')](moment()['format']('x'));}this[_0xd076('0xa')][_0x5d0cfd['device']][_0xd076('0x21')]=_0x5d0cfd[_0xd076('0x21')][_0xd076('0x2c')]();this[_0xd076('0x1f')](util[_0xd076('0x25')](_0xd076('0x31'),this[_0xd076('0xa')][_0x5d0cfd[_0xd076('0x2a')]][_0xd076('0x27')]),'telephone:save',this[_0xd076('0xa')][_0x5d0cfd[_0xd076('0x2a')]]);}else if(this[_0xd076('0x8')][_0x5d0cfd['device']]){if(this['trunks'][_0x5d0cfd[_0xd076('0x2a')]]['state']!==_0x5d0cfd['state']['toLowerCase']()){this[_0xd076('0x8')][_0x5d0cfd[_0xd076('0x2a')]][_0xd076('0x2e')]=_['toNumber'](moment()['format']('x'));}this[_0xd076('0x8')][_0x5d0cfd[_0xd076('0x2a')]][_0xd076('0x21')]=_0x5d0cfd[_0xd076('0x21')][_0xd076('0x2c')]();this[_0xd076('0x1f')](util['format'](_0xd076('0x26'),this['trunks'][_0x5d0cfd[_0xd076('0x2a')]][_0xd076('0x27')]),_0xd076('0x28'),this['trunks'][_0x5d0cfd['device']]);}else if(_[_0xd076('0x32')](_0x5d0cfd['device'],'Queue')){}else if(_[_0xd076('0x32')](_0x5d0cfd[_0xd076('0x2a')],'Local')){var _0x5a78e6=_0x5d0cfd['device'];var _0x317554=_0x5a78e6['substring'](_0x5a78e6[_0xd076('0x33')]('/')+0x1,_0x5a78e6[_0xd076('0x33')]('@'));var _0xbe0a6c=_[_0xd076('0x34')](this[_0xd076('0x9')],function(_0x574e32){return _0x574e32[_0xd076('0x35')]==_0x317554||_0x574e32['phone']==_0x317554||_0x574e32[_0xd076('0x36')]==_0x317554;});if(_0xbe0a6c){if(_0xbe0a6c['state']!==_0x5d0cfd[_0xd076('0x21')][_0xd076('0x2c')]()){_0xbe0a6c['stateTime']=_[_0xd076('0x2f')](moment()[_0xd076('0x25')]('x'));}_0xbe0a6c[_0xd076('0x21')]=_0x5d0cfd['state'][_0xd076('0x2c')]();_0xbe0a6c['local']=!![];_0xbe0a6c[_0xd076('0x30')](_0x5d0cfd);}}else{}}}catch(_0x55345c){logger['error'](_0xd076('0x37'),util[_0xd076('0x1a')](_0x55345c,{'showHidden':![],'depth':null}));}};UserReport[_0xd076('0x1b')]['syncPeerStatus']=function(_0x6ee807){try{if(this[_0xd076('0x1d')](_0x6ee807)&&this[_0xd076('0x1d')](_0x6ee807[_0xd076('0x11')])){if(this['agents'][_0x6ee807[_0xd076('0x38')]]){if(!this[_0xd076('0x9')][_0x6ee807[_0xd076('0x38')]][_0xd076('0x2b')]||_0x6ee807[_0xd076('0x11')]['toLowerCase']()==_0xd076('0x39')){this[_0xd076('0x9')][_0x6ee807[_0xd076('0x38')]][_0xd076('0x2b')]=![];this[_0xd076('0x9')][_0x6ee807[_0xd076('0x38')]][_0xd076('0x3a')]=_0x6ee807[_0xd076('0x11')][_0xd076('0x2c')]();this[_0xd076('0x9')][_0x6ee807[_0xd076('0x38')]]['address']=_0x6ee807[_0xd076('0x3b')];this['agents'][_0x6ee807['peer']][_0xd076('0x30')](_0x6ee807);}}else if(this[_0xd076('0xa')][_0x6ee807['peer']]){this[_0xd076('0xa')][_0x6ee807[_0xd076('0x38')]]['status']=_0x6ee807['peerstatus'][_0xd076('0x2c')]();this['telephones'][_0x6ee807['peer']]['address']=_0x6ee807[_0xd076('0x3b')];this[_0xd076('0x1f')](util[_0xd076('0x25')](_0xd076('0x31'),this[_0xd076('0xa')][_0x6ee807[_0xd076('0x38')]][_0xd076('0x27')]),_0xd076('0x3c'),this[_0xd076('0xa')][_0x6ee807[_0xd076('0x38')]]);}else if(this[_0xd076('0x8')][_0x6ee807['peer']]){this[_0xd076('0x8')][_0x6ee807[_0xd076('0x38')]][_0xd076('0x3a')]=_0x6ee807[_0xd076('0x11')][_0xd076('0x2c')]();this[_0xd076('0x8')][_0x6ee807['peer']][_0xd076('0x3b')]=_0x6ee807[_0xd076('0x3b')];this[_0xd076('0x1f')](util[_0xd076('0x25')](_0xd076('0x26'),this[_0xd076('0x8')][_0x6ee807[_0xd076('0x38')]][_0xd076('0x27')]),_0xd076('0x28'),this['trunks'][_0x6ee807['peer']]);}else{}}}catch(_0x5f53ba){logger['error']('[syncPeerStatus][UserReport]',util[_0xd076('0x1a')](_0x5f53ba,{'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 fedd6bf..2cb535d 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 _0x3691=['answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','rejected','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','agentcompleteAt','complete','talktime','transfer','agent','acw','acwtime','acwTimeout','interface','destconnectedlinenum','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','keys','variable','value','[syncVarSet][VoiceAgentReport]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberlastcall','memberpenalty','isNil','includes','values','[syncHangup][VoiceAgentReport]','syncAttendedTransfer','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','transfereruniqueid','[syncBlindTransfer][VoiceAgentReport]','syncMusicOnHoldStart','channel','substring','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','lastIndexOf','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','syncAgentCalled','bind','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','syncHangup','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isUndefined','uniqueid','destuniqueid','format','called','queue','inbound','merge','omit','event','privilege','custom:agentcalled','user:%s','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','isNotNull','hasOwnProperty','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','pick','user:agentconnect','custom:agentconnect','agentringnoanswer','agentringnoanswerAt','reason','answered_elsewhere','lastevent'];(function(_0x49c47c,_0x44d47f){var _0x30b491=function(_0x29c2fc){while(--_0x29c2fc){_0x49c47c['push'](_0x49c47c['shift']());}};_0x30b491(++_0x44d47f);}(_0x3691,0x1a9));var _0x1369=function(_0x1b7af0,_0x4694a2){_0x1b7af0=_0x1b7af0-0x0;var _0x1772d1=_0x3691[_0x1b7af0];return _0x1772d1;};'use strict';var _=require(_0x1369('0x0'));var moment=require(_0x1369('0x1'));var util=require(_0x1369('0x2'));var Redis=require(_0x1369('0x3'));var config=require('../../../config/environment');var logger=require(_0x1369('0x4'))(_0x1369('0x5'));var ami=require(_0x1369('0x6'));config[_0x1369('0x7')]=_[_0x1369('0x8')](config[_0x1369('0x7')],{'host':_0x1369('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1369('0x7')]));function VoiceAgentReport(_0x5707d2){this[_0x1369('0xa')]={};this['voiceQueues']=_0x5707d2[_0x1369('0xb')];this[_0x1369('0xc')]=_0x5707d2['agents'];this[_0x1369('0xd')]={};ami['on']('agentcalled',this[_0x1369('0xe')][_0x1369('0xf')](this));ami['on'](_0x1369('0x10'),this[_0x1369('0x11')][_0x1369('0xf')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x1369('0xf')](this));ami['on'](_0x1369('0x12'),this[_0x1369('0x13')][_0x1369('0xf')](this));ami['on'](_0x1369('0x14'),this[_0x1369('0x15')][_0x1369('0xf')](this));ami['on'](_0x1369('0x16'),this[_0x1369('0x17')]['bind'](this));ami['on']('hangup',this[_0x1369('0x18')][_0x1369('0xf')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x1369('0xf')](this));ami['on'](_0x1369('0x19'),this[_0x1369('0x1a')][_0x1369('0xf')](this));ami['on'](_0x1369('0x1b'),this['syncAttendedTransfer'][_0x1369('0xf')](this));ami['on'](_0x1369('0x1c'),this[_0x1369('0x1d')][_0x1369('0xf')](this));}VoiceAgentReport[_0x1369('0x1e')][_0x1369('0x1f')]=function(_0x5640f6,_0x3f780d,_0x3f14f1){io['to'](_0x5640f6)[_0x1369('0x1f')](_0x3f780d,_0x3f14f1);};VoiceAgentReport['prototype']['isNotNull']=function(_0x3660d3){return _0x3660d3!==null&&!_[_0x1369('0x20')](_0x3660d3);};VoiceAgentReport[_0x1369('0x1e')]['syncAgentCalled']=function(_0x31fdea){try{if(this['isNotNull'](_0x31fdea)){if(_[_0x1369('0x20')](this[_0x1369('0xa')][_0x31fdea[_0x1369('0x21')]])){this['channels'][_0x31fdea[_0x1369('0x21')]]={};}if(_[_0x1369('0x20')](this[_0x1369('0xa')][_0x31fdea[_0x1369('0x21')]][_0x31fdea['destuniqueid']])){this['channels'][_0x31fdea[_0x1369('0x21')]][_0x31fdea[_0x1369('0x22')]]={'agentcalledAt':moment()[_0x1369('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x1369('0x24'),'variables':this[_0x1369('0xd')][_0x31fdea['uniqueid']],'type':this[_0x1369('0xb')][_0x31fdea[_0x1369('0x25')]]?this['voiceQueues'][_0x31fdea[_0x1369('0x25')]]['type']||_0x1369('0x26'):'inbound'};}_[_0x1369('0x27')](this[_0x1369('0xa')][_0x31fdea[_0x1369('0x21')]][_0x31fdea[_0x1369('0x22')]],_[_0x1369('0x28')](_0x31fdea,[_0x1369('0x29'),_0x1369('0x2a')]));ami[_0x1369('0x1f')](_0x1369('0x2b'),this[_0x1369('0xa')][_0x31fdea[_0x1369('0x21')]][_0x31fdea[_0x1369('0x22')]]);this['emit'](util['format'](_0x1369('0x2c'),_0x31fdea[_0x1369('0x2d')]),_0x1369('0x2e'),this['channels'][_0x31fdea[_0x1369('0x21')]][_0x31fdea['destuniqueid']]);}}catch(_0x405b80){logger[_0x1369('0x2f')](_0x1369('0x30'),util[_0x1369('0x31')](_0x405b80,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1369('0x11')]=function(_0xaac195){try{if(this[_0x1369('0x32')](_0xaac195)){if(this[_0x1369('0xa')][_0xaac195[_0x1369('0x21')]]){for(var _0x197030 in this['channels'][_0xaac195['uniqueid']]){if(this[_0x1369('0xa')][_0xaac195['uniqueid']][_0x1369('0x33')](_0x197030)){if(_0xaac195[_0x1369('0x22')]===_0x197030){this['channels'][_0xaac195[_0x1369('0x21')]][_0x197030][_0x1369('0x34')]=moment()[_0x1369('0x23')](_0x1369('0x35'));this[_0x1369('0xa')][_0xaac195['uniqueid']][_0x197030]['lastevent']='connect';this[_0x1369('0xa')][_0xaac195[_0x1369('0x21')]][_0x197030][_0x1369('0x36')]=_0xaac195[_0x1369('0x36')];this[_0x1369('0xa')][_0xaac195['uniqueid']][_0x197030][_0x1369('0x37')]=_0xaac195[_0x1369('0x37')];this[_0x1369('0xa')][_0xaac195[_0x1369('0x21')]][_0x197030][_0x1369('0x38')]=_0xaac195['connectedlinename'];this[_0x1369('0xa')][_0xaac195[_0x1369('0x21')]][_0x197030][_0x1369('0x39')]=_0xaac195['destchannelstate'];this[_0x1369('0xa')][_0xaac195['uniqueid']][_0x197030][_0x1369('0x3a')]=_0xaac195['destchannelstatedesc'];_[_0x1369('0x27')](this[_0x1369('0xc')][_0xaac195['interface']],_[_0x1369('0x3b')](_0xaac195,[_0x1369('0x25'),'destconnectedlinenum']));this[_0x1369('0x1f')](util[_0x1369('0x23')](_0x1369('0x2c'),_0xaac195[_0x1369('0x2d')]),_0x1369('0x3c'),this['channels'][_0xaac195[_0x1369('0x21')]][_0xaac195['destuniqueid']]);ami[_0x1369('0x1f')](_0x1369('0x3d'),this[_0x1369('0xa')][_0xaac195[_0x1369('0x21')]][_0x197030]);}else if(!this[_0x1369('0xa')][_0xaac195[_0x1369('0x21')]][_0x197030][_0x1369('0x3e')]&&!this[_0x1369('0xa')][_0xaac195[_0x1369('0x21')]][_0x197030][_0x1369('0x14')]){this[_0x1369('0xa')][_0xaac195['uniqueid']][_0x197030][_0x1369('0x3e')]=!![];this[_0x1369('0xa')][_0xaac195[_0x1369('0x21')]][_0x197030][_0x1369('0x3f')]=moment()[_0x1369('0x23')](_0x1369('0x35'));this[_0x1369('0xa')][_0xaac195[_0x1369('0x21')]][_0x197030][_0x1369('0x40')]=_0x1369('0x41');this[_0x1369('0xa')][_0xaac195[_0x1369('0x21')]][_0x197030][_0x1369('0x42')]=_0x1369('0x41');this[_0x1369('0xa')][_0xaac195['uniqueid']][_0x197030]['answeredelsewheredestinationuniqueid']=_0xaac195['destuniqueid'];this[_0x1369('0xa')][_0xaac195[_0x1369('0x21')]][_0x197030][_0x1369('0x43')]=_0xaac195['membername'];ami[_0x1369('0x1f')](_0x1369('0x44'),this[_0x1369('0xa')][_0xaac195['uniqueid']][_0x197030]);}}}}}}catch(_0x5a79d9){logger[_0x1369('0x2f')](_0x1369('0x45'),util[_0x1369('0x31')](_0x5a79d9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1369('0x1e')]['syncAgentRingNoAnswer']=function(_0x21e20a){try{if(this[_0x1369('0x32')](_0x21e20a)){if(this[_0x1369('0xa')][_0x21e20a[_0x1369('0x21')]]&&this[_0x1369('0xa')][_0x21e20a[_0x1369('0x21')]][_0x21e20a[_0x1369('0x22')]]){this[_0x1369('0xa')][_0x21e20a[_0x1369('0x21')]][_0x21e20a['destuniqueid']][_0x1369('0x3e')]=!![];this[_0x1369('0xa')][_0x21e20a[_0x1369('0x21')]][_0x21e20a[_0x1369('0x22')]][_0x1369('0x3f')]=moment()[_0x1369('0x23')](_0x1369('0x35'));this['channels'][_0x21e20a[_0x1369('0x21')]][_0x21e20a[_0x1369('0x22')]][_0x1369('0x40')]=_0x1369('0x46');this['channels'][_0x21e20a[_0x1369('0x21')]][_0x21e20a[_0x1369('0x22')]][_0x1369('0x42')]=_0x1369('0x46');ami[_0x1369('0x1f')]('custom:agentringnoanswer',this[_0x1369('0xa')][_0x21e20a[_0x1369('0x21')]][_0x21e20a[_0x1369('0x22')]]);}}}catch(_0x1878c3){logger[_0x1369('0x2f')](_0x1369('0x47'),util['inspect'](_0x1878c3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1369('0x1e')][_0x1369('0x13')]=function(_0x365bd8){try{if(this[_0x1369('0x32')](_0x365bd8)){if(this[_0x1369('0xa')][_0x365bd8['uniqueid']]){for(var _0x32b4a9 in this[_0x1369('0xa')][_0x365bd8[_0x1369('0x21')]]){if(this[_0x1369('0xa')][_0x365bd8[_0x1369('0x21')]][_0x1369('0x33')](_0x32b4a9)&&!this['channels'][_0x365bd8[_0x1369('0x21')]][_0x32b4a9][_0x1369('0x3e')]&&!this[_0x1369('0xa')][_0x365bd8[_0x1369('0x21')]][_0x32b4a9]['agentcomplete']){this['channels'][_0x365bd8[_0x1369('0x21')]][_0x32b4a9][_0x1369('0x3e')]=!![];this[_0x1369('0xa')][_0x365bd8[_0x1369('0x21')]][_0x32b4a9][_0x1369('0x3f')]=moment()['format'](_0x1369('0x35'));this[_0x1369('0xa')][_0x365bd8[_0x1369('0x21')]][_0x32b4a9]['reason']=_0x1369('0x48');this[_0x1369('0xa')][_0x365bd8[_0x1369('0x21')]][_0x32b4a9]['lastevent']=_0x1369('0x48');ami[_0x1369('0x1f')]('custom:agentqueuecallerabandon',this[_0x1369('0xa')][_0x365bd8['uniqueid']][_0x32b4a9]);}}}}}catch(_0x3fcfe2){logger['error']('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0x1369('0x31')](_0x3fcfe2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1369('0x1e')][_0x1369('0x15')]=function(_0x45235d){try{if(this[_0x1369('0x32')](_0x45235d)){if(this[_0x1369('0xa')][_0x45235d[_0x1369('0x21')]]){for(var _0x1877ea in this[_0x1369('0xa')][_0x45235d[_0x1369('0x21')]]){if(this[_0x1369('0xa')][_0x45235d['uniqueid']][_0x1369('0x33')](_0x1877ea)){if(this[_0x1369('0xa')][_0x45235d[_0x1369('0x21')]][_0x1877ea][_0x1369('0x34')]&&!this['channels'][_0x45235d[_0x1369('0x21')]][_0x1877ea][_0x1369('0x14')]){this[_0x1369('0xa')][_0x45235d[_0x1369('0x21')]][_0x1877ea][_0x1369('0x14')]=!![];this['channels'][_0x45235d['uniqueid']][_0x1877ea][_0x1369('0x49')]=moment()[_0x1369('0x23')](_0x1369('0x35'));this[_0x1369('0xa')][_0x45235d['uniqueid']][_0x1877ea][_0x1369('0x42')]=_0x1369('0x4a');this[_0x1369('0xa')][_0x45235d[_0x1369('0x21')]][_0x1877ea]['talktime']=_0x45235d[_0x1369('0x4b')];this[_0x1369('0xa')][_0x45235d['uniqueid']][_0x1877ea][_0x1369('0x40')]=_0x45235d[_0x1369('0x40')]==_0x1369('0x4c')?_0x1369('0x4d'):_0x45235d[_0x1369('0x40')];if(this[_0x1369('0xb')][_0x45235d[_0x1369('0x25')]]&&this[_0x1369('0xb')][_0x45235d[_0x1369('0x25')]][_0x1369('0x4e')]){this[_0x1369('0xa')][_0x45235d[_0x1369('0x21')]][_0x1877ea]['agentacw']=!![];this[_0x1369('0xa')][_0x45235d[_0x1369('0x21')]][_0x1877ea][_0x1369('0x4f')]=this[_0x1369('0xb')][_0x45235d['queue']][_0x1369('0x50')];}this[_0x1369('0xc')][_0x45235d[_0x1369('0x51')]]=_[_0x1369('0x28')](this[_0x1369('0xc')][_0x45235d[_0x1369('0x51')]],['queue',_0x1369('0x52')]);this[_0x1369('0x1f')](util[_0x1369('0x23')]('user:%s',_0x45235d['membername']),_0x1369('0x53'),this[_0x1369('0xa')][_0x45235d[_0x1369('0x21')]][_0x1877ea]);ami['emit'](_0x1369('0x54'),this[_0x1369('0xa')][_0x45235d[_0x1369('0x21')]][_0x1877ea]);}}}}}}catch(_0x124776){logger[_0x1369('0x2f')](_0x1369('0x55'),util[_0x1369('0x31')](_0x124776,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1369('0x1e')]['syncVarSet']=function(_0x50cb67){try{if(this[_0x1369('0x32')](_0x50cb67)){this['addVariable'](_0x50cb67[_0x1369('0x21')],_[_0x1369('0x56')](_0x50cb67[_0x1369('0x57')])[0x0],_0x50cb67[_0x1369('0x58')]);if(this[_0x1369('0xa')][_0x50cb67[_0x1369('0x21')]]){for(var _0x12bf3d in this[_0x1369('0xa')][_0x50cb67[_0x1369('0x21')]]){if(this[_0x1369('0xa')][_0x50cb67[_0x1369('0x21')]]['hasOwnProperty'](_0x12bf3d)){if(_[_0x1369('0x20')](this[_0x1369('0xa')][_0x50cb67['uniqueid']][_0x12bf3d][_0x1369('0xd')])){this[_0x1369('0xa')][_0x50cb67[_0x1369('0x21')]][_0x12bf3d][_0x1369('0xd')]={};}this[_0x1369('0xa')][_0x50cb67[_0x1369('0x21')]][_0x12bf3d]['variables']=this['variables'][_0x50cb67[_0x1369('0x21')]];}}}}}catch(_0x438516){logger[_0x1369('0x2f')](_0x1369('0x59'),util[_0x1369('0x31')](_0x438516,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1369('0x5a')]=function(_0x4ea9de,_0x52945a,_0x3a5d15){var _0x160503=[_0x1369('0x5b'),_0x1369('0x5c'),'rtpaudioqosjitter',_0x1369('0x5d'),'rtpaudioqosloss',_0x1369('0x5e'),_0x1369('0x5f'),'rtpaudioqosrttbridged',_0x1369('0x60'),_0x1369('0x61'),_0x1369('0x62'),_0x1369('0x63'),'membercalls',_0x1369('0x64'),'memberinterface',_0x1369('0x65'),'membername',_0x1369('0x66'),'memberrealtime'];if(!_[_0x1369('0x67')](_0x52945a)&&!_[_0x1369('0x68')](_0x160503,_0x52945a)){if(_[_0x1369('0x20')](this[_0x1369('0xd')][_0x4ea9de])){this['variables'][_0x4ea9de]={};}this[_0x1369('0xd')][_0x4ea9de][_0x52945a]=_0x3a5d15;}};VoiceAgentReport[_0x1369('0x1e')][_0x1369('0x18')]=function(_0x2b6a8f){try{if(this[_0x1369('0x32')](_0x2b6a8f)){if(this[_0x1369('0xa')][_0x2b6a8f[_0x1369('0x21')]]){for(var _0x3a11e1 in this[_0x1369('0xa')][_0x2b6a8f[_0x1369('0x21')]]){if(this[_0x1369('0xa')][_0x2b6a8f[_0x1369('0x21')]][_0x1369('0x33')](_0x3a11e1)){if(this[_0x1369('0xa')][_0x2b6a8f[_0x1369('0x21')]][_0x3a11e1][_0x1369('0x40')]==_0x1369('0x4c')&&this[_0x1369('0xa')][_0x2b6a8f[_0x1369('0x21')]][_0x3a11e1]['agentcomplete']){this['channels'][_0x2b6a8f[_0x1369('0x21')]][_0x3a11e1][_0x1369('0x49')]=moment()[_0x1369('0x23')](_0x1369('0x35'));}}}ami['emit']('custom:voiceAgentReport',_[_0x1369('0x69')](this['channels'][_0x2b6a8f['uniqueid']]));delete this[_0x1369('0xa')][_0x2b6a8f['uniqueid']];}if(this[_0x1369('0xd')][_0x2b6a8f[_0x1369('0x21')]]){delete this[_0x1369('0xd')][_0x2b6a8f[_0x1369('0x21')]];}}}catch(_0x417adb){logger[_0x1369('0x2f')](_0x1369('0x6a'),util[_0x1369('0x31')](_0x417adb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1369('0x1e')][_0x1369('0x6b')]=function(_0x95637d){try{if(this['isNotNull'](_0x95637d)){if(this[_0x1369('0xa')][_0x95637d[_0x1369('0x6c')]]){for(var _0x5ad375 in this[_0x1369('0xa')][_0x95637d[_0x1369('0x6c')]]){if(this['channels'][_0x95637d[_0x1369('0x6c')]][_0x1369('0x33')](_0x5ad375)){if(_0x95637d[_0x1369('0x6d')]===_0x5ad375){var _0xfa5556=moment();this[_0x1369('0xa')][_0x95637d[_0x1369('0x6c')]][_0x5ad375][_0x1369('0x14')]=!![];this[_0x1369('0xa')][_0x95637d[_0x1369('0x6c')]][_0x5ad375]['agentcompleteAt']=moment()[_0x1369('0x23')](_0x1369('0x35'));this[_0x1369('0xa')][_0x95637d[_0x1369('0x6c')]][_0x5ad375][_0x1369('0x40')]='transfer';this['channels'][_0x95637d[_0x1369('0x6c')]][_0x5ad375][_0x1369('0x42')]='complete';this['channels'][_0x95637d['transfereeuniqueid']][_0x5ad375][_0x1369('0x4b')]=_0xfa5556[_0x1369('0x6e')](this[_0x1369('0xa')][_0x95637d[_0x1369('0x6c')]][_0x5ad375]['agentconnectAt'],_0x1369('0x6f'));}}}}if(this[_0x1369('0xa')][_0x95637d['secondtransfereruniqueid']]){var _0x247a2d=this[_0x1369('0xa')][_0x95637d[_0x1369('0x70')]];this[_0x1369('0xa')][_0x95637d[_0x1369('0x70')]]=this[_0x1369('0xa')][_0x95637d[_0x1369('0x6c')]];this['channels'][_0x95637d[_0x1369('0x6c')]]=_0x247a2d;}}}catch(_0x36acc1){logger[_0x1369('0x2f')]('[syncAttendedTransfer][VoiceAgentReport]',util[_0x1369('0x31')](_0x36acc1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1369('0x1e')]['syncBlindTransfer']=function(_0x46cdf1){try{if(this[_0x1369('0x32')](_0x46cdf1)){if(this[_0x1369('0xa')][_0x46cdf1[_0x1369('0x6c')]]){for(var _0x1c76bb in this['channels'][_0x46cdf1['transfereeuniqueid']]){if(this[_0x1369('0xa')][_0x46cdf1['transfereeuniqueid']]['hasOwnProperty'](_0x1c76bb)){if(_0x46cdf1[_0x1369('0x71')]===_0x1c76bb){var _0x1b0466=moment();this[_0x1369('0xa')][_0x46cdf1[_0x1369('0x6c')]][_0x1c76bb][_0x1369('0x14')]=!![];this['channels'][_0x46cdf1[_0x1369('0x6c')]][_0x1c76bb]['agentcompleteAt']=_0x1b0466;this[_0x1369('0xa')][_0x46cdf1[_0x1369('0x6c')]][_0x1c76bb][_0x1369('0x40')]=_0x1369('0x4c');this[_0x1369('0xa')][_0x46cdf1[_0x1369('0x6c')]][_0x1c76bb][_0x1369('0x42')]=_0x1369('0x4a');this[_0x1369('0xa')][_0x46cdf1['transfereeuniqueid']][_0x1c76bb][_0x1369('0x4b')]=_0x1b0466[_0x1369('0x6e')](this['channels'][_0x46cdf1[_0x1369('0x6c')]][_0x1c76bb][_0x1369('0x34')],'seconds');}}}}}}catch(_0x4673ac){logger[_0x1369('0x2f')](_0x1369('0x72'),util[_0x1369('0x31')](_0x4673ac,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1369('0x1e')][_0x1369('0x73')]=function(_0x55ca75){var _0x2e17f8='';try{if(this[_0x1369('0x32')](_0x55ca75)){if(_0x55ca75[_0x1369('0x74')]){_0x2e17f8=_0x55ca75[_0x1369('0x74')][_0x1369('0x75')](0x0,_0x55ca75[_0x1369('0x74')]['lastIndexOf']('-'));if(this['agents'][_0x2e17f8]){this[_0x1369('0xc')][_0x2e17f8][_0x1369('0x76')]=!![];}}}}catch(_0x31639e){logger[_0x1369('0x2f')](_0x1369('0x77'),util[_0x1369('0x31')](_0x31639e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1369('0x1e')][_0x1369('0x1a')]=function(_0x3122b7){var _0x3403ef='';try{if(this['isNotNull'](_0x3122b7)){if(_0x3122b7[_0x1369('0x74')]){_0x3403ef=_0x3122b7['channel'][_0x1369('0x75')](0x0,_0x3122b7[_0x1369('0x74')][_0x1369('0x78')]('-'));if(this['agents'][_0x3403ef]){this[_0x1369('0xc')][_0x3403ef][_0x1369('0x76')]=![];}}}}catch(_0x9fb934){logger[_0x1369('0x2f')](_0x1369('0x79'),util['inspect'](_0x9fb934,{'showHidden':![],'depth':null}));}};module[_0x1369('0x7a')]=VoiceAgentReport; \ No newline at end of file +var _0xc704=['channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','lodash','util','../../../config/logger','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','uniqueid','isUndefined','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','type','inbound','merge','privilege','custom:agentcalled','membername','user:called','error','inspect','hasOwnProperty','agentconnectAt','lastevent','holdtime','connectedlinenum','destchannelstatedesc','interface','destconnectedlinenum','user:%s','user:agentconnect','custom:agentconnect','agentringnoanswerAt','format','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','syncQueueCallerAbandon','abandoned','custom:agentqueuecallerabandon','agentcompleteAt','complete','talktime','transfer','agent','acwtime','acwTimeout','omit','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','diff','secondtransfereruniqueid','transfereruniqueid','[syncBlindTransfer][VoiceAgentReport]'];(function(_0x3074d3,_0x1eb1aa){var _0x157bc9=function(_0x37ab36){while(--_0x37ab36){_0x3074d3['push'](_0x3074d3['shift']());}};_0x157bc9(++_0x1eb1aa);}(_0xc704,0x14c));var _0x4c70=function(_0x17d189,_0x40abca){_0x17d189=_0x17d189-0x0;var _0x118037=_0xc704[_0x17d189];return _0x118037;};'use strict';var _=require(_0x4c70('0x0'));var moment=require('moment');var util=require(_0x4c70('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x4c70('0x2'))('ami');var ami=require('../ami');config[_0x4c70('0x3')]=_[_0x4c70('0x4')](config[_0x4c70('0x3')],{'host':_0x4c70('0x5'),'port':0x18eb});var io=require(_0x4c70('0x6'))(new Redis(config[_0x4c70('0x3')]));function VoiceAgentReport(_0x150395){this[_0x4c70('0x7')]={};this['voiceQueues']=_0x150395[_0x4c70('0x8')];this[_0x4c70('0x9')]=_0x150395[_0x4c70('0x9')];this[_0x4c70('0xa')]={};ami['on'](_0x4c70('0xb'),this['syncAgentCalled'][_0x4c70('0xc')](this));ami['on'](_0x4c70('0xd'),this[_0x4c70('0xe')][_0x4c70('0xc')](this));ami['on'](_0x4c70('0xf'),this[_0x4c70('0x10')][_0x4c70('0xc')](this));ami['on'](_0x4c70('0x11'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x4c70('0x12'),this[_0x4c70('0x13')][_0x4c70('0xc')](this));ami['on'](_0x4c70('0x14'),this[_0x4c70('0x15')]['bind'](this));ami['on'](_0x4c70('0x16'),this[_0x4c70('0x17')]['bind'](this));ami['on'](_0x4c70('0x18'),this[_0x4c70('0x19')][_0x4c70('0xc')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop']['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0x4c70('0x1a'),this[_0x4c70('0x1b')]['bind'](this));}VoiceAgentReport[_0x4c70('0x1c')][_0x4c70('0x1d')]=function(_0x195893,_0x223f76,_0xc64c69){io['to'](_0x195893)[_0x4c70('0x1d')](_0x223f76,_0xc64c69);};VoiceAgentReport[_0x4c70('0x1c')][_0x4c70('0x1e')]=function(_0x1a70bb){return _0x1a70bb!==null&&!_['isUndefined'](_0x1a70bb);};VoiceAgentReport['prototype']['syncAgentCalled']=function(_0x3b34e2){try{if(this['isNotNull'](_0x3b34e2)){if(_['isUndefined'](this[_0x4c70('0x7')][_0x3b34e2[_0x4c70('0x1f')]])){this[_0x4c70('0x7')][_0x3b34e2[_0x4c70('0x1f')]]={};}if(_[_0x4c70('0x20')](this[_0x4c70('0x7')][_0x3b34e2[_0x4c70('0x1f')]][_0x3b34e2['destuniqueid']])){this[_0x4c70('0x7')][_0x3b34e2[_0x4c70('0x1f')]][_0x3b34e2[_0x4c70('0x21')]]={'agentcalledAt':moment()['format'](_0x4c70('0x22')),'lastevent':'called','variables':this[_0x4c70('0xa')][_0x3b34e2['uniqueid']],'type':this[_0x4c70('0x8')][_0x3b34e2[_0x4c70('0x23')]]?this[_0x4c70('0x8')][_0x3b34e2['queue']][_0x4c70('0x24')]||_0x4c70('0x25'):_0x4c70('0x25')};}_[_0x4c70('0x26')](this[_0x4c70('0x7')][_0x3b34e2['uniqueid']][_0x3b34e2[_0x4c70('0x21')]],_['omit'](_0x3b34e2,['event',_0x4c70('0x27')]));ami['emit'](_0x4c70('0x28'),this[_0x4c70('0x7')][_0x3b34e2[_0x4c70('0x1f')]][_0x3b34e2[_0x4c70('0x21')]]);this['emit'](util['format']('user:%s',_0x3b34e2[_0x4c70('0x29')]),_0x4c70('0x2a'),this[_0x4c70('0x7')][_0x3b34e2['uniqueid']][_0x3b34e2[_0x4c70('0x21')]]);}}catch(_0xc62800){logger[_0x4c70('0x2b')]('[syncAgentCalled][VoiceAgentReport]',util[_0x4c70('0x2c')](_0xc62800,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c70('0x1c')][_0x4c70('0xe')]=function(_0x5981f6){try{if(this[_0x4c70('0x1e')](_0x5981f6)){if(this[_0x4c70('0x7')][_0x5981f6['uniqueid']]){for(var _0x3df9f4 in this[_0x4c70('0x7')][_0x5981f6['uniqueid']]){if(this[_0x4c70('0x7')][_0x5981f6['uniqueid']][_0x4c70('0x2d')](_0x3df9f4)){if(_0x5981f6[_0x4c70('0x21')]===_0x3df9f4){this[_0x4c70('0x7')][_0x5981f6['uniqueid']][_0x3df9f4][_0x4c70('0x2e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x4c70('0x7')][_0x5981f6[_0x4c70('0x1f')]][_0x3df9f4][_0x4c70('0x2f')]='connect';this[_0x4c70('0x7')][_0x5981f6['uniqueid']][_0x3df9f4][_0x4c70('0x30')]=_0x5981f6['holdtime'];this[_0x4c70('0x7')][_0x5981f6[_0x4c70('0x1f')]][_0x3df9f4][_0x4c70('0x31')]=_0x5981f6[_0x4c70('0x31')];this[_0x4c70('0x7')][_0x5981f6[_0x4c70('0x1f')]][_0x3df9f4]['connectedlinename']=_0x5981f6['connectedlinename'];this[_0x4c70('0x7')][_0x5981f6[_0x4c70('0x1f')]][_0x3df9f4]['destchannelstate']=_0x5981f6['destchannelstate'];this[_0x4c70('0x7')][_0x5981f6['uniqueid']][_0x3df9f4]['destchannelstatedesc']=_0x5981f6[_0x4c70('0x32')];_[_0x4c70('0x26')](this[_0x4c70('0x9')][_0x5981f6[_0x4c70('0x33')]],_['pick'](_0x5981f6,[_0x4c70('0x23'),_0x4c70('0x34')]));this[_0x4c70('0x1d')](util['format'](_0x4c70('0x35'),_0x5981f6[_0x4c70('0x29')]),_0x4c70('0x36'),this[_0x4c70('0x7')][_0x5981f6['uniqueid']][_0x5981f6[_0x4c70('0x21')]]);ami[_0x4c70('0x1d')](_0x4c70('0x37'),this[_0x4c70('0x7')][_0x5981f6[_0x4c70('0x1f')]][_0x3df9f4]);}else if(!this[_0x4c70('0x7')][_0x5981f6[_0x4c70('0x1f')]][_0x3df9f4][_0x4c70('0xf')]&&!this[_0x4c70('0x7')][_0x5981f6[_0x4c70('0x1f')]][_0x3df9f4][_0x4c70('0x12')]){this[_0x4c70('0x7')][_0x5981f6[_0x4c70('0x1f')]][_0x3df9f4][_0x4c70('0xf')]=!![];this[_0x4c70('0x7')][_0x5981f6[_0x4c70('0x1f')]][_0x3df9f4][_0x4c70('0x38')]=moment()[_0x4c70('0x39')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4c70('0x7')][_0x5981f6[_0x4c70('0x1f')]][_0x3df9f4][_0x4c70('0x3a')]='answered_elsewhere';this[_0x4c70('0x7')][_0x5981f6[_0x4c70('0x1f')]][_0x3df9f4][_0x4c70('0x2f')]=_0x4c70('0x3b');this['channels'][_0x5981f6['uniqueid']][_0x3df9f4][_0x4c70('0x3c')]=_0x5981f6[_0x4c70('0x21')];this['channels'][_0x5981f6[_0x4c70('0x1f')]][_0x3df9f4][_0x4c70('0x3d')]=_0x5981f6[_0x4c70('0x29')];ami[_0x4c70('0x1d')](_0x4c70('0x3e'),this['channels'][_0x5981f6['uniqueid']][_0x3df9f4]);}}}}}}catch(_0x5f01de){logger['error'](_0x4c70('0x3f'),util[_0x4c70('0x2c')](_0x5f01de,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c70('0x1c')][_0x4c70('0x10')]=function(_0x5ec276){try{if(this['isNotNull'](_0x5ec276)){if(this[_0x4c70('0x7')][_0x5ec276[_0x4c70('0x1f')]]&&this[_0x4c70('0x7')][_0x5ec276[_0x4c70('0x1f')]][_0x5ec276[_0x4c70('0x21')]]){this[_0x4c70('0x7')][_0x5ec276[_0x4c70('0x1f')]][_0x5ec276[_0x4c70('0x21')]][_0x4c70('0xf')]=!![];this[_0x4c70('0x7')][_0x5ec276[_0x4c70('0x1f')]][_0x5ec276['destuniqueid']][_0x4c70('0x38')]=moment()[_0x4c70('0x39')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4c70('0x7')][_0x5ec276[_0x4c70('0x1f')]][_0x5ec276[_0x4c70('0x21')]][_0x4c70('0x3a')]='rejected';this[_0x4c70('0x7')][_0x5ec276['uniqueid']][_0x5ec276[_0x4c70('0x21')]][_0x4c70('0x2f')]='rejected';ami[_0x4c70('0x1d')](_0x4c70('0x40'),this[_0x4c70('0x7')][_0x5ec276[_0x4c70('0x1f')]][_0x5ec276[_0x4c70('0x21')]]);}}}catch(_0x5a78b9){logger[_0x4c70('0x2b')](_0x4c70('0x41'),util['inspect'](_0x5a78b9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c70('0x1c')][_0x4c70('0x42')]=function(_0x2f3982){try{if(this[_0x4c70('0x1e')](_0x2f3982)){if(this[_0x4c70('0x7')][_0x2f3982[_0x4c70('0x1f')]]){for(var _0x5abec9 in this[_0x4c70('0x7')][_0x2f3982[_0x4c70('0x1f')]]){if(this[_0x4c70('0x7')][_0x2f3982[_0x4c70('0x1f')]][_0x4c70('0x2d')](_0x5abec9)&&!this[_0x4c70('0x7')][_0x2f3982[_0x4c70('0x1f')]][_0x5abec9]['agentringnoanswer']&&!this[_0x4c70('0x7')][_0x2f3982[_0x4c70('0x1f')]][_0x5abec9][_0x4c70('0x12')]){this['channels'][_0x2f3982[_0x4c70('0x1f')]][_0x5abec9][_0x4c70('0xf')]=!![];this[_0x4c70('0x7')][_0x2f3982[_0x4c70('0x1f')]][_0x5abec9]['agentringnoanswerAt']=moment()[_0x4c70('0x39')](_0x4c70('0x22'));this['channels'][_0x2f3982[_0x4c70('0x1f')]][_0x5abec9][_0x4c70('0x3a')]=_0x4c70('0x43');this[_0x4c70('0x7')][_0x2f3982[_0x4c70('0x1f')]][_0x5abec9]['lastevent']='abandoned';ami[_0x4c70('0x1d')](_0x4c70('0x44'),this['channels'][_0x2f3982[_0x4c70('0x1f')]][_0x5abec9]);}}}}}catch(_0x5c2f62){logger[_0x4c70('0x2b')]('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0x4c70('0x2c')](_0x5c2f62,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c70('0x1c')][_0x4c70('0x13')]=function(_0x4f42aa){try{if(this['isNotNull'](_0x4f42aa)){if(this[_0x4c70('0x7')][_0x4f42aa[_0x4c70('0x1f')]]){for(var _0x217275 in this[_0x4c70('0x7')][_0x4f42aa[_0x4c70('0x1f')]]){if(this['channels'][_0x4f42aa[_0x4c70('0x1f')]][_0x4c70('0x2d')](_0x217275)){if(this['channels'][_0x4f42aa[_0x4c70('0x1f')]][_0x217275]['agentconnectAt']&&!this[_0x4c70('0x7')][_0x4f42aa['uniqueid']][_0x217275][_0x4c70('0x12')]){this[_0x4c70('0x7')][_0x4f42aa[_0x4c70('0x1f')]][_0x217275]['agentcomplete']=!![];this['channels'][_0x4f42aa[_0x4c70('0x1f')]][_0x217275][_0x4c70('0x45')]=moment()['format'](_0x4c70('0x22'));this[_0x4c70('0x7')][_0x4f42aa[_0x4c70('0x1f')]][_0x217275][_0x4c70('0x2f')]=_0x4c70('0x46');this[_0x4c70('0x7')][_0x4f42aa[_0x4c70('0x1f')]][_0x217275][_0x4c70('0x47')]=_0x4f42aa[_0x4c70('0x47')];this[_0x4c70('0x7')][_0x4f42aa[_0x4c70('0x1f')]][_0x217275][_0x4c70('0x3a')]=_0x4f42aa[_0x4c70('0x3a')]==_0x4c70('0x48')?_0x4c70('0x49'):_0x4f42aa['reason'];if(this[_0x4c70('0x8')][_0x4f42aa[_0x4c70('0x23')]]&&this[_0x4c70('0x8')][_0x4f42aa[_0x4c70('0x23')]]['acw']){this[_0x4c70('0x7')][_0x4f42aa[_0x4c70('0x1f')]][_0x217275]['agentacw']=!![];this[_0x4c70('0x7')][_0x4f42aa[_0x4c70('0x1f')]][_0x217275][_0x4c70('0x4a')]=this[_0x4c70('0x8')][_0x4f42aa[_0x4c70('0x23')]][_0x4c70('0x4b')];}this[_0x4c70('0x9')][_0x4f42aa[_0x4c70('0x33')]]=_[_0x4c70('0x4c')](this[_0x4c70('0x9')][_0x4f42aa[_0x4c70('0x33')]],[_0x4c70('0x23'),'destconnectedlinenum']);this['emit'](util[_0x4c70('0x39')](_0x4c70('0x35'),_0x4f42aa[_0x4c70('0x29')]),'user:agentcomplete',this[_0x4c70('0x7')][_0x4f42aa['uniqueid']][_0x217275]);ami[_0x4c70('0x1d')](_0x4c70('0x4d'),this[_0x4c70('0x7')][_0x4f42aa['uniqueid']][_0x217275]);}}}}}}catch(_0x310e2b){logger['error'](_0x4c70('0x4e'),util['inspect'](_0x310e2b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4c70('0x15')]=function(_0x5f2e3a){try{if(this[_0x4c70('0x1e')](_0x5f2e3a)){this[_0x4c70('0x4f')](_0x5f2e3a[_0x4c70('0x1f')],_[_0x4c70('0x50')](_0x5f2e3a[_0x4c70('0x51')])[0x0],_0x5f2e3a[_0x4c70('0x52')]);if(this[_0x4c70('0x7')][_0x5f2e3a['uniqueid']]){for(var _0x278037 in this[_0x4c70('0x7')][_0x5f2e3a[_0x4c70('0x1f')]]){if(this['channels'][_0x5f2e3a[_0x4c70('0x1f')]][_0x4c70('0x2d')](_0x278037)){if(_[_0x4c70('0x20')](this[_0x4c70('0x7')][_0x5f2e3a['uniqueid']][_0x278037][_0x4c70('0xa')])){this[_0x4c70('0x7')][_0x5f2e3a[_0x4c70('0x1f')]][_0x278037]['variables']={};}this[_0x4c70('0x7')][_0x5f2e3a[_0x4c70('0x1f')]][_0x278037][_0x4c70('0xa')]=this[_0x4c70('0xa')][_0x5f2e3a['uniqueid']];}}}}}catch(_0x386353){logger[_0x4c70('0x2b')](_0x4c70('0x53'),util['inspect'](_0x386353,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0x223e05,_0x37ce4c,_0x25c776){var _0x423c72=[_0x4c70('0x54'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x4c70('0x55'),'rtpaudioqosloss',_0x4c70('0x56'),_0x4c70('0x57'),'rtpaudioqosrttbridged',_0x4c70('0x58'),'sipuri','bridgepeer',_0x4c70('0x59'),_0x4c70('0x5a'),'memberdynamic',_0x4c70('0x5b'),_0x4c70('0x5c'),_0x4c70('0x29'),_0x4c70('0x5d'),_0x4c70('0x5e')];if(!_[_0x4c70('0x5f')](_0x37ce4c)&&!_[_0x4c70('0x60')](_0x423c72,_0x37ce4c)){if(_[_0x4c70('0x20')](this[_0x4c70('0xa')][_0x223e05])){this[_0x4c70('0xa')][_0x223e05]={};}this[_0x4c70('0xa')][_0x223e05][_0x37ce4c]=_0x25c776;}};VoiceAgentReport[_0x4c70('0x1c')][_0x4c70('0x17')]=function(_0x1e455f){try{if(this[_0x4c70('0x1e')](_0x1e455f)){if(this[_0x4c70('0x7')][_0x1e455f['uniqueid']]){for(var _0x4c2bf5 in this[_0x4c70('0x7')][_0x1e455f['uniqueid']]){if(this['channels'][_0x1e455f[_0x4c70('0x1f')]]['hasOwnProperty'](_0x4c2bf5)){if(this[_0x4c70('0x7')][_0x1e455f[_0x4c70('0x1f')]][_0x4c2bf5][_0x4c70('0x3a')]==_0x4c70('0x48')&&this['channels'][_0x1e455f['uniqueid']][_0x4c2bf5][_0x4c70('0x12')]){this[_0x4c70('0x7')][_0x1e455f[_0x4c70('0x1f')]][_0x4c2bf5][_0x4c70('0x45')]=moment()[_0x4c70('0x39')]('YYYY-MM-DD\x20HH:mm:ss');}}}ami['emit']('custom:voiceAgentReport',_[_0x4c70('0x61')](this['channels'][_0x1e455f['uniqueid']]));delete this[_0x4c70('0x7')][_0x1e455f[_0x4c70('0x1f')]];}if(this[_0x4c70('0xa')][_0x1e455f[_0x4c70('0x1f')]]){delete this[_0x4c70('0xa')][_0x1e455f[_0x4c70('0x1f')]];}}}catch(_0x2fbfa0){logger[_0x4c70('0x2b')](_0x4c70('0x62'),util[_0x4c70('0x2c')](_0x2fbfa0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c70('0x1c')]['syncAttendedTransfer']=function(_0x1a6a55){try{if(this[_0x4c70('0x1e')](_0x1a6a55)){if(this[_0x4c70('0x7')][_0x1a6a55[_0x4c70('0x63')]]){for(var _0x3b1a3f in this[_0x4c70('0x7')][_0x1a6a55[_0x4c70('0x63')]]){if(this[_0x4c70('0x7')][_0x1a6a55[_0x4c70('0x63')]][_0x4c70('0x2d')](_0x3b1a3f)){if(_0x1a6a55['origtransfereruniqueid']===_0x3b1a3f){var _0x3a8f78=moment();this[_0x4c70('0x7')][_0x1a6a55['transfereeuniqueid']][_0x3b1a3f]['agentcomplete']=!![];this[_0x4c70('0x7')][_0x1a6a55[_0x4c70('0x63')]][_0x3b1a3f][_0x4c70('0x45')]=moment()[_0x4c70('0x39')](_0x4c70('0x22'));this[_0x4c70('0x7')][_0x1a6a55[_0x4c70('0x63')]][_0x3b1a3f][_0x4c70('0x3a')]='transfer';this['channels'][_0x1a6a55[_0x4c70('0x63')]][_0x3b1a3f][_0x4c70('0x2f')]=_0x4c70('0x46');this['channels'][_0x1a6a55['transfereeuniqueid']][_0x3b1a3f][_0x4c70('0x47')]=_0x3a8f78[_0x4c70('0x64')](this[_0x4c70('0x7')][_0x1a6a55[_0x4c70('0x63')]][_0x3b1a3f][_0x4c70('0x2e')],'seconds');}}}}if(this[_0x4c70('0x7')][_0x1a6a55[_0x4c70('0x65')]]){var _0x4e4efe=this[_0x4c70('0x7')][_0x1a6a55[_0x4c70('0x65')]];this[_0x4c70('0x7')][_0x1a6a55['secondtransfereruniqueid']]=this[_0x4c70('0x7')][_0x1a6a55[_0x4c70('0x63')]];this[_0x4c70('0x7')][_0x1a6a55[_0x4c70('0x63')]]=_0x4e4efe;}}}catch(_0x4920a7){logger[_0x4c70('0x2b')]('[syncAttendedTransfer][VoiceAgentReport]',util[_0x4c70('0x2c')](_0x4920a7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4c70('0x1c')][_0x4c70('0x1b')]=function(_0x48c145){try{if(this['isNotNull'](_0x48c145)){if(this[_0x4c70('0x7')][_0x48c145[_0x4c70('0x63')]]){for(var _0x25b884 in this[_0x4c70('0x7')][_0x48c145[_0x4c70('0x63')]]){if(this[_0x4c70('0x7')][_0x48c145[_0x4c70('0x63')]][_0x4c70('0x2d')](_0x25b884)){if(_0x48c145[_0x4c70('0x66')]===_0x25b884){var _0x217bc5=moment();this['channels'][_0x48c145['transfereeuniqueid']][_0x25b884][_0x4c70('0x12')]=!![];this[_0x4c70('0x7')][_0x48c145[_0x4c70('0x63')]][_0x25b884][_0x4c70('0x45')]=_0x217bc5;this[_0x4c70('0x7')][_0x48c145[_0x4c70('0x63')]][_0x25b884][_0x4c70('0x3a')]='transfer';this[_0x4c70('0x7')][_0x48c145['transfereeuniqueid']][_0x25b884]['lastevent']=_0x4c70('0x46');this[_0x4c70('0x7')][_0x48c145[_0x4c70('0x63')]][_0x25b884][_0x4c70('0x47')]=_0x217bc5[_0x4c70('0x64')](this[_0x4c70('0x7')][_0x48c145['transfereeuniqueid']][_0x25b884]['agentconnectAt'],'seconds');}}}}}}catch(_0x574e52){logger[_0x4c70('0x2b')](_0x4c70('0x67'),util[_0x4c70('0x2c')](_0x574e52,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0x5ec461){var _0x3e3dc8='';try{if(this['isNotNull'](_0x5ec461)){if(_0x5ec461['channel']){_0x3e3dc8=_0x5ec461[_0x4c70('0x68')][_0x4c70('0x69')](0x0,_0x5ec461['channel'][_0x4c70('0x6a')]('-'));if(this[_0x4c70('0x9')][_0x3e3dc8]){this[_0x4c70('0x9')][_0x3e3dc8][_0x4c70('0x6b')]=!![];}}}}catch(_0x17fe8e){logger[_0x4c70('0x2b')](_0x4c70('0x6c'),util[_0x4c70('0x2c')](_0x17fe8e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStop']=function(_0x4bf025){var _0x358447='';try{if(this[_0x4c70('0x1e')](_0x4bf025)){if(_0x4bf025['channel']){_0x358447=_0x4bf025[_0x4c70('0x68')]['substring'](0x0,_0x4bf025[_0x4c70('0x68')][_0x4c70('0x6a')]('-'));if(this[_0x4c70('0x9')][_0x358447]){this['agents'][_0x358447]['onhold']=![];}}}}catch(_0x168c7c){logger[_0x4c70('0x2b')]('[syncMusicOnHoldStop][VoiceAgentReport]',util[_0x4c70('0x2c')](_0x168c7c,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index e8499ba..74995d6 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 _0xced8=['appdata','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','applicationdata','match','answered','answertime','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','calleridname','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','replace','.wav49','find','monitors','push','rec','mixmonitor_filename','variable','xmd-phone','value','xmd-cdrtype','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','calleridpreview','xmcs-queue','sipcalluniqueid','parse','sipcallid','sipcalllinkedid','endtime','billableseconds','omit','user:%s','user:agentcomplete','custom:voiceCallReport','syncAttendedTransfer','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','isNil','[syncMusicOnHoldStart][VoiceCallReport]','mohstarttime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','inuse','invalid','ringing','onhold','set','queue','agi','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','localhost','socket.io-emitter','agents','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','syncNewState','varset','syncVarSet','syncHangup','newcallerid','attendedtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','catch','log','isNotNull','isUndefined','emit','prototype','syncNewCallerId','uniqueid','linkedid','merge','channels','pick','keys','error','inspect','channel','OutgoingSpoolFailed','starttime','format','disposition','toNumber','channelstate','context','from-sip','split','destconnectedlinenum','name','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','exten','application','toLowerCase'];(function(_0x12f42c,_0x415b84){var _0xbcf616=function(_0x242128){while(--_0x242128){_0x12f42c['push'](_0x12f42c['shift']());}};_0xbcf616(++_0x415b84);}(_0xced8,0xe0));var _0x8ced=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xced8[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x8ced('0x0'));var _=require(_0x8ced('0x1'));var moment=require('moment');var util=require(_0x8ced('0x2'));var path=require(_0x8ced('0x3'));var Redis=require(_0x8ced('0x4'));var config=require(_0x8ced('0x5'));var logger=require(_0x8ced('0x6'))(_0x8ced('0x7'));var ami=require(_0x8ced('0x8'));var Channel=require(_0x8ced('0x9'));var statusDesc=[_0x8ced('0xa'),'not_inuse',_0x8ced('0xb'),'busy',_0x8ced('0xc'),'unavailable',_0x8ced('0xd'),'ringinuse',_0x8ced('0xe')];var applications=[_0x8ced('0xf'),_0x8ced('0x10'),_0x8ced('0x11'),'dial',_0x8ced('0x12'),_0x8ced('0x13')];var dispositions=[_0x8ced('0x14'),_0x8ced('0x15'),'FAILED',_0x8ced('0x14'),_0x8ced('0x14'),_0x8ced('0x14'),_0x8ced('0x16'),_0x8ced('0x17'),'FAILED','FAILED',_0x8ced('0x15')];var actions={};config['redis']=_['defaults'](config[_0x8ced('0x18')],{'host':_0x8ced('0x19'),'port':0x18eb});var io=require(_0x8ced('0x1a'))(new Redis(config[_0x8ced('0x18')]));function VoiceCallReport(_0x1efb18){this['channels']=_0x1efb18['channels'];this[_0x8ced('0x1b')]=_0x1efb18[_0x8ced('0x1b')];ami['on'](_0x8ced('0x1c'),this[_0x8ced('0x1d')][_0x8ced('0x1e')](this));ami['on'](_0x8ced('0x1f'),this[_0x8ced('0x1d')][_0x8ced('0x1e')](this));ami['on']('newchannel',this[_0x8ced('0x20')][_0x8ced('0x1e')](this));ami['on']('newstate',this[_0x8ced('0x21')][_0x8ced('0x1e')](this));ami['on'](_0x8ced('0x22'),this[_0x8ced('0x23')][_0x8ced('0x1e')](this));ami['on']('hangup',this[_0x8ced('0x24')][_0x8ced('0x1e')](this));ami['on'](_0x8ced('0x25'),this['syncNewCallerId'][_0x8ced('0x1e')](this));ami['on'](_0x8ced('0x26'),this['syncAttendedTransfer'][_0x8ced('0x1e')](this));ami['on']('blindtransfer',this[_0x8ced('0x27')][_0x8ced('0x1e')](this));ami['on'](_0x8ced('0x28'),this[_0x8ced('0x29')][_0x8ced('0x1e')](this));ami['on'](_0x8ced('0x2a'),this[_0x8ced('0x2b')][_0x8ced('0x1e')](this));return BPromise[_0x8ced('0x2c')]()[_0x8ced('0x2d')](ami[_0x8ced('0x2e')]())[_0x8ced('0x2f')](function(_0xfd4da6){console[_0x8ced('0x30')](_0xfd4da6);});}VoiceCallReport['prototype'][_0x8ced('0x31')]=function(_0x5f22ff){return _0x5f22ff!==null&&!_[_0x8ced('0x32')](_0x5f22ff);};VoiceCallReport['prototype'][_0x8ced('0x33')]=function(_0x5395a9,_0x3332b5,_0x275a33){io['to'](_0x5395a9)[_0x8ced('0x33')](_0x3332b5,_0x275a33);};VoiceCallReport[_0x8ced('0x34')][_0x8ced('0x35')]=function(_0xe90427){try{if(this[_0x8ced('0x31')](_0xe90427)){if(_0xe90427[_0x8ced('0x36')]===_0xe90427[_0x8ced('0x37')]){if(!_[_0x8ced('0x32')](this['channels'][_0xe90427[_0x8ced('0x36')]])){_[_0x8ced('0x38')](this[_0x8ced('0x39')][_0xe90427[_0x8ced('0x36')]],_[_0x8ced('0x3a')](_0xe90427,_[_0x8ced('0x3b')](this['channels'][_0xe90427[_0x8ced('0x36')]])));}}}}catch(_0x51e905){logger[_0x8ced('0x3c')]('[syncNewCallerId][VoiceCallReport]',util[_0x8ced('0x3d')](_0x51e905,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8ced('0x34')][_0x8ced('0x20')]=function(_0x30c9e7){try{if(this[_0x8ced('0x31')](_0x30c9e7)){if(_0x30c9e7[_0x8ced('0x36')]===_0x30c9e7['linkedid']&&_0x30c9e7[_0x8ced('0x3e')]!=_0x8ced('0x3f')){if(_[_0x8ced('0x32')](this[_0x8ced('0x39')][_0x30c9e7[_0x8ced('0x36')]])){this[_0x8ced('0x39')][_0x30c9e7['uniqueid']]=new Channel();this[_0x8ced('0x39')][_0x30c9e7[_0x8ced('0x36')]][_0x8ced('0x40')]=moment()[_0x8ced('0x41')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8ced('0x39')][_0x30c9e7[_0x8ced('0x36')]][_0x8ced('0x42')]=dispositions[_[_0x8ced('0x43')](_0x30c9e7[_0x8ced('0x44')])];_[_0x8ced('0x38')](this[_0x8ced('0x39')][_0x30c9e7[_0x8ced('0x36')]],_[_0x8ced('0x3a')](_0x30c9e7,_[_0x8ced('0x3b')](this[_0x8ced('0x39')][_0x30c9e7[_0x8ced('0x36')]])));if(_0x30c9e7[_0x8ced('0x45')]===_0x8ced('0x46')){if(this[_0x8ced('0x1b')][_0x30c9e7[_0x8ced('0x3e')][_0x8ced('0x47')]('-')[0x0]]){this[_0x8ced('0x1b')][_0x30c9e7['channel']['split']('-')[0x0]][_0x8ced('0x48')]=_0x30c9e7['exten'];this[_0x8ced('0x33')](util[_0x8ced('0x41')]('user:%s',this[_0x8ced('0x1b')][_0x30c9e7[_0x8ced('0x3e')][_0x8ced('0x47')]('-')[0x0]][_0x8ced('0x49')]),_0x8ced('0x4a'),{'destaccountcode':this[_0x8ced('0x1b')][_0x30c9e7[_0x8ced('0x3e')][_0x8ced('0x47')]('-')[0x0]][_0x8ced('0x4b')],'destconnectedlinenum':_0x30c9e7['exten']});}}}}}}catch(_0x3442a2){logger[_0x8ced('0x3c')](_0x8ced('0x4c'),util['inspect'](_0x3442a2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8ced('0x34')][_0x8ced('0x1d')]=function(_0x452c2a){try{if(this[_0x8ced('0x31')](_0x452c2a)){if(_0x452c2a[_0x8ced('0x36')]===_0x452c2a[_0x8ced('0x37')]&&_0x452c2a[_0x8ced('0x4d')]!='h'&&_0x452c2a['channel']!=_0x8ced('0x3f')){_0x452c2a[_0x8ced('0x4e')]=_0x452c2a[_0x8ced('0x4e')][_0x8ced('0x4f')]();_0x452c2a['applicationdata']=(_0x452c2a[_0x8ced('0x50')]||_0x452c2a['applicationdata'])['toLowerCase']();if(_['isUndefined'](this[_0x8ced('0x39')][_0x452c2a[_0x8ced('0x36')]])){this[_0x8ced('0x39')][_0x452c2a[_0x8ced('0x36')]]=new Channel();this[_0x8ced('0x39')][_0x452c2a['uniqueid']][_0x8ced('0x40')]=_0x452c2a[_0x8ced('0x51')]?moment()[_0x8ced('0x52')](moment[_0x8ced('0x51')](_0x452c2a[_0x8ced('0x51')])[_0x8ced('0x53')](),_0x8ced('0x53'))[_0x8ced('0x41')](_0x8ced('0x54')):moment()[_0x8ced('0x41')](_0x8ced('0x54'));this[_0x8ced('0x39')][_0x452c2a[_0x8ced('0x36')]][_0x8ced('0x42')]='NO\x20ANSWER';}_['merge'](this[_0x8ced('0x39')][_0x452c2a[_0x8ced('0x36')]],_[_0x8ced('0x3a')](_0x452c2a,_[_0x8ced('0x3b')](this[_0x8ced('0x39')][_0x452c2a[_0x8ced('0x36')]])));if(_[_0x8ced('0x55')](applications,_0x452c2a[_0x8ced('0x4e')])){this['channels'][_0x452c2a['uniqueid']][_0x8ced('0x56')]=_0x452c2a['application'];this[_0x8ced('0x39')][_0x452c2a['uniqueid']]['lastdata']=_0x452c2a[_0x8ced('0x57')];if(_0x452c2a[_0x8ced('0x4e')]===_0x8ced('0xf')&&_['startsWith'](_0x452c2a[_0x8ced('0x57')],'cdr(')){var _0x4d1fdc=_0x452c2a[_0x8ced('0x57')]['split']('=');var _0x2cce5d=_0x4d1fdc[0x0][_0x8ced('0x58')](/cdr\((.*)\)/);if(_0x2cce5d){this[_0x8ced('0x39')][_0x452c2a['uniqueid']][_0x2cce5d[0x1]]=_0x4d1fdc[0x1];}}else if(_0x452c2a['application']===_0x8ced('0x10')){this['channels'][_0x452c2a[_0x8ced('0x36')]][_0x8ced('0x10')]=_0x452c2a[_0x8ced('0x57')][_0x8ced('0x47')](',')[0x0];}}}}}catch(_0x18c48b){logger['error']('[syncNewExten][VoiceCallReport]',util[_0x8ced('0x3d')](_0x18c48b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x8ced('0x21')]=function(_0x10c122){try{if(this[_0x8ced('0x31')](_0x10c122)){if(_0x10c122[_0x8ced('0x36')]!==_0x10c122['linkedid']){if(this[_0x8ced('0x39')][_0x10c122[_0x8ced('0x37')]]){if(_0x10c122[_0x8ced('0x44')]==='6'){if(!this[_0x8ced('0x39')][_0x10c122[_0x8ced('0x37')]][_0x8ced('0x59')]){var _0x264a2e=moment();this['channels'][_0x10c122[_0x8ced('0x37')]][_0x8ced('0x59')]=!![];this[_0x8ced('0x39')][_0x10c122[_0x8ced('0x37')]][_0x8ced('0x5a')]=_0x264a2e[_0x8ced('0x41')](_0x8ced('0x54'));if(this[_0x8ced('0x39')][_0x10c122['linkedid']][_0x8ced('0x40')]){this[_0x8ced('0x39')][_0x10c122[_0x8ced('0x37')]][_0x8ced('0x5b')]=_0x264a2e[_0x8ced('0x5c')](this['channels'][_0x10c122[_0x8ced('0x37')]][_0x8ced('0x40')],_0x8ced('0x53'));}}this['channels'][_0x10c122[_0x8ced('0x37')]]['linkedid']=_0x10c122[_0x8ced('0x36')];if(_0x10c122[_0x8ced('0x5d')]!==_0x8ced('0x5e')){this[_0x8ced('0x39')][_0x10c122[_0x8ced('0x37')]][_0x8ced('0x5f')]=_0x10c122['calleridnum'];}this[_0x8ced('0x39')][_0x10c122[_0x8ced('0x37')]]['connectedlinename']=_0x10c122[_0x8ced('0x60')];this[_0x8ced('0x39')][_0x10c122[_0x8ced('0x37')]][_0x8ced('0x61')]=_0x10c122['channel'];this[_0x8ced('0x39')][_0x10c122['linkedid']]['disposition']=dispositions[_[_0x8ced('0x43')](_0x10c122[_0x8ced('0x44')])];if(this[_0x8ced('0x1b')][_0x10c122[_0x8ced('0x3e')][_0x8ced('0x47')]('-')[0x0]]){this[_0x8ced('0x39')][_0x10c122[_0x8ced('0x37')]]['UserId']=this[_0x8ced('0x1b')][_0x10c122[_0x8ced('0x3e')][_0x8ced('0x47')]('-')[0x0]]['id'];this[_0x8ced('0x39')][_0x10c122['linkedid']]['membername']=this[_0x8ced('0x1b')][_0x10c122['channel'][_0x8ced('0x47')]('-')[0x0]][_0x8ced('0x49')];}}}}else{if(this[_0x8ced('0x39')][_0x10c122['uniqueid']]){if(_0x10c122['channelstate']==='6'){if(this[_0x8ced('0x1b')][_0x10c122['channel'][_0x8ced('0x47')]('-')[0x0]]){this[_0x8ced('0x39')][_0x10c122[_0x8ced('0x36')]][_0x8ced('0x62')]=this[_0x8ced('0x1b')][_0x10c122[_0x8ced('0x3e')][_0x8ced('0x47')]('-')[0x0]]['id'];this[_0x8ced('0x39')][_0x10c122[_0x8ced('0x36')]][_0x8ced('0x63')]=this[_0x8ced('0x1b')][_0x10c122[_0x8ced('0x3e')][_0x8ced('0x47')]('-')[0x0]]['name'];}}}}}}catch(_0x534014){logger[_0x8ced('0x3c')](_0x8ced('0x64'),util[_0x8ced('0x3d')](_0x534014,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x8ced('0x65')]=function(_0x2088eb,_0x48c151){if(this[_0x8ced('0x39')][_0x2088eb]){this[_0x8ced('0x39')][_0x2088eb][_0x8ced('0x66')]=!![];if(_[_0x8ced('0x67')](_0x48c151,'.wav49')){_0x48c151=_0x48c151[_0x8ced('0x68')](_0x8ced('0x69'),'.WAV');}this[_0x8ced('0x39')][_0x2088eb]['monitorFilename']=_0x48c151;var _0x55be1c=_[_0x8ced('0x6a')](this[_0x8ced('0x39')][_0x2088eb][_0x8ced('0x6b')],{'filename':_0x48c151});if(_['isNil'](_0x55be1c)){this[_0x8ced('0x39')][_0x2088eb][_0x8ced('0x6b')][_0x8ced('0x6c')]({'filename':_0x48c151,'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x8ced('0x6d')});}}};VoiceCallReport[_0x8ced('0x34')]['syncVarSet']=function(_0x360115){try{if(this['isNotNull'](_0x360115)){if(this[_0x8ced('0x39')][_0x360115[_0x8ced('0x36')]]&&_0x360115[_0x8ced('0x3e')]!=_0x8ced('0x3f')){if(this[_0x8ced('0x31')](_0x360115['variable'])){if(this['isNotNull'](_0x360115['variable'][_0x8ced('0x6e')])){this[_0x8ced('0x65')](_0x360115[_0x8ced('0x36')],_0x360115['value']);}else if(this[_0x8ced('0x31')](_0x360115[_0x8ced('0x6f')][_0x8ced('0x70')])){this[_0x8ced('0x39')][_0x360115[_0x8ced('0x36')]]['calleridnum']=_0x360115[_0x8ced('0x71')];}else if(this[_0x8ced('0x31')](_0x360115[_0x8ced('0x6f')]['xmd-callerid'])){this[_0x8ced('0x39')][_0x360115[_0x8ced('0x36')]]['callerid']=_0x360115['value'];}else if(this[_0x8ced('0x31')](_0x360115[_0x8ced('0x6f')][_0x8ced('0x72')])){this['channels'][_0x360115['uniqueid']]['type']=_0x360115[_0x8ced('0x71')];}else if(this[_0x8ced('0x31')](_0x360115[_0x8ced('0x6f')][_0x8ced('0x73')])){this[_0x8ced('0x39')][_0x360115[_0x8ced('0x36')]][_0x8ced('0x10')]=_0x360115[_0x8ced('0x71')]['split'](',')[0x0];}else if(this['isNotNull'](_0x360115['variable'][_0x8ced('0x74')])){this[_0x8ced('0x39')][_0x360115[_0x8ced('0x36')]][_0x8ced('0x75')]=_0x360115[_0x8ced('0x71')];}else if(this['isNotNull'](_0x360115['variable'][_0x8ced('0x76')])){this['channels'][_0x360115[_0x8ced('0x36')]][_0x8ced('0x77')]=_0x360115[_0x8ced('0x71')];}else if(this[_0x8ced('0x31')](_0x360115['variable']['xmd-callerid-preview'])){this[_0x8ced('0x39')][_0x360115[_0x8ced('0x36')]][_0x8ced('0x78')]=_0x360115[_0x8ced('0x71')];}else if(this['isNotNull'](_0x360115[_0x8ced('0x6f')][_0x8ced('0x79')])){this['channels'][_0x360115[_0x8ced('0x36')]][_0x8ced('0x10')]=_0x360115[_0x8ced('0x71')];}else if(this[_0x8ced('0x31')](_0x360115['variable']['sipcallid'])){this[_0x8ced('0x39')][_0x360115[_0x8ced('0x36')]][_0x8ced('0x7a')]=_0x360115['value'];}}}else if(this[_0x8ced('0x31')](_0x360115[_0x8ced('0x6f')][_0x8ced('0x6e')])){if(_0x360115[_0x8ced('0x71')]){var _0x1d11da=path[_0x8ced('0x7b')](_0x360115[_0x8ced('0x71')])[_0x8ced('0x49')];this['syncMixMonitorFilename'](_0x1d11da,_0x360115[_0x8ced('0x71')]);}}else if(this[_0x8ced('0x39')][_0x360115[_0x8ced('0x37')]]){if(this[_0x8ced('0x31')](_0x360115[_0x8ced('0x6f')])){if(this[_0x8ced('0x31')](_0x360115[_0x8ced('0x6f')][_0x8ced('0x7c')])){this['channels'][_0x360115[_0x8ced('0x37')]][_0x8ced('0x7d')]=_0x360115[_0x8ced('0x71')];}}}}}catch(_0x803c59){logger['error']('[syncVarSet][VoiceCallReport]',util['inspect'](_0x803c59,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x8ced('0x24')]=function(_0x2f7037){try{if(this[_0x8ced('0x31')](_0x2f7037)){if(this[_0x8ced('0x39')][_0x2f7037['uniqueid']]){var _0x2e1c0b=moment();this[_0x8ced('0x39')][_0x2f7037[_0x8ced('0x36')]][_0x8ced('0x7e')]=_0x2e1c0b[_0x8ced('0x41')](_0x8ced('0x54'));this[_0x8ced('0x39')][_0x2f7037[_0x8ced('0x36')]][_0x8ced('0x51')]=_0x2e1c0b['diff'](this['channels'][_0x2f7037[_0x8ced('0x36')]]['starttime'],_0x8ced('0x53'));if(this[_0x8ced('0x39')][_0x2f7037[_0x8ced('0x36')]][_0x8ced('0x59')]){this[_0x8ced('0x39')][_0x2f7037[_0x8ced('0x36')]][_0x8ced('0x7f')]=_0x2e1c0b[_0x8ced('0x5c')](this[_0x8ced('0x39')][_0x2f7037[_0x8ced('0x36')]][_0x8ced('0x5a')],_0x8ced('0x53'));this[_0x8ced('0x39')][_0x2f7037[_0x8ced('0x36')]][_0x8ced('0x5b')]=this['channels'][_0x2f7037[_0x8ced('0x36')]][_0x8ced('0x51')]-this[_0x8ced('0x39')][_0x2f7037[_0x8ced('0x36')]][_0x8ced('0x7f')];}if(_0x2f7037['context']===_0x8ced('0x46')){if(this[_0x8ced('0x1b')][_0x2f7037[_0x8ced('0x3e')]['split']('-')[0x0]]){this[_0x8ced('0x1b')][_0x2f7037[_0x8ced('0x3e')]['split']('-')[0x0]]=_[_0x8ced('0x80')](this[_0x8ced('0x1b')][_0x2f7037['channel'][_0x8ced('0x47')]('-')[0x0]],[_0x8ced('0x48')]);this['emit'](util['format'](_0x8ced('0x81'),this[_0x8ced('0x1b')][_0x2f7037[_0x8ced('0x3e')][_0x8ced('0x47')]('-')[0x0]][_0x8ced('0x49')]),_0x8ced('0x82'),{'destaccountcode':this['agents'][_0x2f7037[_0x8ced('0x3e')][_0x8ced('0x47')]('-')[0x0]][_0x8ced('0x4b')]});}}ami['emit'](_0x8ced('0x83'),this[_0x8ced('0x39')][_0x2f7037[_0x8ced('0x36')]]);delete this['channels'][_0x2f7037[_0x8ced('0x36')]];}}}catch(_0x52ddf5){logger[_0x8ced('0x3c')]('[syncHangup][VoiceCallReport]',util['inspect'](_0x52ddf5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8ced('0x34')][_0x8ced('0x84')]=function(_0x162fb4){try{if(this[_0x8ced('0x31')](_0x162fb4)){if(this['channels'][_0x162fb4[_0x8ced('0x85')]]){this[_0x8ced('0x39')][_0x162fb4[_0x8ced('0x85')]][_0x8ced('0x86')]=_0x162fb4[_0x8ced('0x87')];this[_0x8ced('0x39')][_0x162fb4['transfereeuniqueid']][_0x8ced('0x88')]=_0x162fb4[_0x8ced('0x89')];if(this[_0x8ced('0x39')][_0x162fb4[_0x8ced('0x8a')]]){var _0x9b5551=this[_0x8ced('0x39')][_0x162fb4[_0x8ced('0x8a')]];this[_0x8ced('0x39')][_0x162fb4[_0x8ced('0x8a')]]=this[_0x8ced('0x39')][_0x162fb4['transfereeuniqueid']];this[_0x8ced('0x39')][_0x162fb4['transfereeuniqueid']]=_0x9b5551;}}else if(this['channels'][_0x162fb4[_0x8ced('0x8b')]]){this[_0x8ced('0x39')][_0x162fb4['transfertargetuniqueid']][_0x8ced('0x86')]=_0x162fb4[_0x8ced('0x87')];this[_0x8ced('0x39')][_0x162fb4[_0x8ced('0x8b')]][_0x8ced('0x88')]=_0x162fb4[_0x8ced('0x89')];if(this[_0x8ced('0x39')][_0x162fb4[_0x8ced('0x8c')]]){var _0x9b5551=this[_0x8ced('0x39')][_0x162fb4[_0x8ced('0x8c')]];this['channels'][_0x162fb4[_0x8ced('0x8c')]]=this['channels'][_0x162fb4['transfertargetuniqueid']];this[_0x8ced('0x39')][_0x162fb4[_0x8ced('0x8b')]]=_0x9b5551;}}}}catch(_0x378fdf){logger[_0x8ced('0x3c')](_0x8ced('0x8d'),util[_0x8ced('0x3d')](_0x378fdf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8ced('0x34')][_0x8ced('0x27')]=function(_0x2eaa52){try{if(this[_0x8ced('0x31')](_0x2eaa52)){if(this[_0x8ced('0x39')][_0x2eaa52[_0x8ced('0x85')]]){this['channels'][_0x2eaa52[_0x8ced('0x85')]]['transfercalleridnum']=_0x2eaa52['transfereecalleridnum'];this[_0x8ced('0x39')][_0x2eaa52[_0x8ced('0x85')]][_0x8ced('0x88')]=_0x2eaa52[_0x8ced('0x8e')];this[_0x8ced('0x24')]({'event':_0x8ced('0x8f'),'uniqueid':_0x2eaa52['transfereeuniqueid'],'context':_0x2eaa52['context'],'channel':_0x2eaa52[_0x8ced('0x90')]});}}}catch(_0x4df716){logger[_0x8ced('0x3c')](_0x8ced('0x91'),util[_0x8ced('0x3d')](_0x4df716,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8ced('0x34')][_0x8ced('0x29')]=function(_0x4209c5){try{if(this[_0x8ced('0x31')](_0x4209c5)){if(this[_0x8ced('0x39')][_0x4209c5[_0x8ced('0x36')]]){if(!_[_0x8ced('0x92')](this['channels'][_0x4209c5['uniqueid']]['answertime'])){this['channels'][_0x4209c5[_0x8ced('0x36')]]['mohstarttime']=moment()[_0x8ced('0x41')](_0x8ced('0x54'));}}}}catch(_0x148bdd){logger[_0x8ced('0x3c')](_0x8ced('0x93'),util['inspect'](_0x148bdd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8ced('0x34')][_0x8ced('0x2b')]=function(_0xcb90d0){try{if(this[_0x8ced('0x31')](_0xcb90d0)){if(this[_0x8ced('0x39')][_0xcb90d0[_0x8ced('0x36')]]){if(!_[_0x8ced('0x92')](this[_0x8ced('0x39')][_0xcb90d0[_0x8ced('0x36')]][_0x8ced('0x94')])){this[_0x8ced('0x39')][_0xcb90d0[_0x8ced('0x36')]]['mohtime']+=moment()[_0x8ced('0x95')](0x0)[_0x8ced('0x5c')](this[_0x8ced('0x39')][_0xcb90d0[_0x8ced('0x36')]]['mohstarttime'],'seconds');delete this['channels'][_0xcb90d0[_0x8ced('0x36')]]['mohstarttime'];}}}}catch(_0x413a01){logger['error'](_0x8ced('0x96'),util['inspect'](_0x413a01,{'showHidden':![],'depth':null}));}};module[_0x8ced('0x97')]=VoiceCallReport; \ No newline at end of file +var _0xfd4c=['name','user:agentconnect','accountcode','error','application','toLowerCase','applicationdata','appdata','subtract','duration','seconds','format','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','startsWith','cdr(','channelstate','answered','holdtime','diff','xcally-motion-preview','connectedlinenum','calleridnum','connectedlinename','calleridname','destinationchannel','membername','UserId','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','isNil','monitors','rec','variable','value','xmd-callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','calleridpreview','sipcalluniqueid','mixmonitor_filename','parse','sipcallid','sipcalllinkedid','[syncVarSet][VoiceCallReport]','omit','user:%s','user:agentcomplete','custom:voiceCallReport','syncAttendedTransfer','transfereeuniqueid','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','transfererchannel','answertime','mohstarttime','syncMusicOnHoldStop','mohtime','milliseconds','exports','bluebird','lodash','util','path','ioredis','../../../config/environment','../../../config/logger','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','onhold','set','queue','agi','voicemail','NO\x20ANSWER','FAILED','ANSWERED','redis','localhost','socket.io-emitter','channels','agents','syncNewExten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','then','catch','log','prototype','isNotNull','emit','uniqueid','linkedid','isUndefined','merge','pick','[syncNewCallerId][VoiceCallReport]','inspect','channel','OutgoingSpoolFailed','starttime','disposition','toNumber','keys','context','split','destconnectedlinenum','exten'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xfd4c,0x17b));var _0xcfd4=function(_0x50e332,_0x43898b){_0x50e332=_0x50e332-0x0;var _0x49dee4=_0xfd4c[_0x50e332];return _0x49dee4;};'use strict';var BPromise=require(_0xcfd4('0x0'));var _=require(_0xcfd4('0x1'));var moment=require('moment');var util=require(_0xcfd4('0x2'));var path=require(_0xcfd4('0x3'));var Redis=require(_0xcfd4('0x4'));var config=require(_0xcfd4('0x5'));var logger=require(_0xcfd4('0x6'))('ami');var ami=require(_0xcfd4('0x7'));var Channel=require(_0xcfd4('0x8'));var statusDesc=[_0xcfd4('0x9'),_0xcfd4('0xa'),_0xcfd4('0xb'),_0xcfd4('0xc'),_0xcfd4('0xd'),_0xcfd4('0xe'),_0xcfd4('0xf'),'ringinuse',_0xcfd4('0x10')];var applications=[_0xcfd4('0x11'),_0xcfd4('0x12'),_0xcfd4('0x13'),'dial','playback',_0xcfd4('0x14')];var dispositions=[_0xcfd4('0x15'),_0xcfd4('0x16'),_0xcfd4('0x16'),_0xcfd4('0x15'),'NO\x20ANSWER','NO\x20ANSWER',_0xcfd4('0x17'),'BUSY','FAILED','FAILED',_0xcfd4('0x16')];var actions={};config[_0xcfd4('0x18')]=_['defaults'](config[_0xcfd4('0x18')],{'host':_0xcfd4('0x19'),'port':0x18eb});var io=require(_0xcfd4('0x1a'))(new Redis(config[_0xcfd4('0x18')]));function VoiceCallReport(_0x16d33c){this[_0xcfd4('0x1b')]=_0x16d33c[_0xcfd4('0x1b')];this[_0xcfd4('0x1c')]=_0x16d33c[_0xcfd4('0x1c')];ami['on']('coreshowchannel',this[_0xcfd4('0x1d')][_0xcfd4('0x1e')](this));ami['on']('newexten',this[_0xcfd4('0x1d')][_0xcfd4('0x1e')](this));ami['on'](_0xcfd4('0x1f'),this[_0xcfd4('0x20')][_0xcfd4('0x1e')](this));ami['on'](_0xcfd4('0x21'),this[_0xcfd4('0x22')]['bind'](this));ami['on'](_0xcfd4('0x23'),this[_0xcfd4('0x24')][_0xcfd4('0x1e')](this));ami['on']('hangup',this[_0xcfd4('0x25')][_0xcfd4('0x1e')](this));ami['on'](_0xcfd4('0x26'),this[_0xcfd4('0x27')][_0xcfd4('0x1e')](this));ami['on'](_0xcfd4('0x28'),this['syncAttendedTransfer'][_0xcfd4('0x1e')](this));ami['on'](_0xcfd4('0x29'),this[_0xcfd4('0x2a')][_0xcfd4('0x1e')](this));ami['on']('musiconholdstart',this[_0xcfd4('0x2b')]['bind'](this));ami['on'](_0xcfd4('0x2c'),this['syncMusicOnHoldStop'][_0xcfd4('0x1e')](this));return BPromise['resolve']()[_0xcfd4('0x2d')](ami['actionCoreShowChannels']())[_0xcfd4('0x2e')](function(_0x5f3260){console[_0xcfd4('0x2f')](_0x5f3260);});}VoiceCallReport[_0xcfd4('0x30')][_0xcfd4('0x31')]=function(_0x27aee7){return _0x27aee7!==null&&!_['isUndefined'](_0x27aee7);};VoiceCallReport[_0xcfd4('0x30')][_0xcfd4('0x32')]=function(_0x9ccf8b,_0x44f374,_0x3a054d){io['to'](_0x9ccf8b)[_0xcfd4('0x32')](_0x44f374,_0x3a054d);};VoiceCallReport[_0xcfd4('0x30')][_0xcfd4('0x27')]=function(_0x144158){try{if(this[_0xcfd4('0x31')](_0x144158)){if(_0x144158[_0xcfd4('0x33')]===_0x144158[_0xcfd4('0x34')]){if(!_[_0xcfd4('0x35')](this[_0xcfd4('0x1b')][_0x144158['uniqueid']])){_[_0xcfd4('0x36')](this[_0xcfd4('0x1b')][_0x144158['uniqueid']],_[_0xcfd4('0x37')](_0x144158,_['keys'](this[_0xcfd4('0x1b')][_0x144158['uniqueid']])));}}}}catch(_0x57143e){logger['error'](_0xcfd4('0x38'),util[_0xcfd4('0x39')](_0x57143e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcfd4('0x30')][_0xcfd4('0x20')]=function(_0x3487d1){try{if(this[_0xcfd4('0x31')](_0x3487d1)){if(_0x3487d1[_0xcfd4('0x33')]===_0x3487d1[_0xcfd4('0x34')]&&_0x3487d1[_0xcfd4('0x3a')]!=_0xcfd4('0x3b')){if(_[_0xcfd4('0x35')](this['channels'][_0x3487d1[_0xcfd4('0x33')]])){this[_0xcfd4('0x1b')][_0x3487d1['uniqueid']]=new Channel();this[_0xcfd4('0x1b')][_0x3487d1[_0xcfd4('0x33')]][_0xcfd4('0x3c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3487d1[_0xcfd4('0x33')]][_0xcfd4('0x3d')]=dispositions[_[_0xcfd4('0x3e')](_0x3487d1['channelstate'])];_[_0xcfd4('0x36')](this[_0xcfd4('0x1b')][_0x3487d1[_0xcfd4('0x33')]],_[_0xcfd4('0x37')](_0x3487d1,_[_0xcfd4('0x3f')](this['channels'][_0x3487d1[_0xcfd4('0x33')]])));if(_0x3487d1[_0xcfd4('0x40')]==='from-sip'){if(this[_0xcfd4('0x1c')][_0x3487d1[_0xcfd4('0x3a')][_0xcfd4('0x41')]('-')[0x0]]){this[_0xcfd4('0x1c')][_0x3487d1[_0xcfd4('0x3a')][_0xcfd4('0x41')]('-')[0x0]][_0xcfd4('0x42')]=_0x3487d1[_0xcfd4('0x43')];this[_0xcfd4('0x32')](util['format']('user:%s',this['agents'][_0x3487d1[_0xcfd4('0x3a')][_0xcfd4('0x41')]('-')[0x0]][_0xcfd4('0x44')]),_0xcfd4('0x45'),{'destaccountcode':this[_0xcfd4('0x1c')][_0x3487d1['channel'][_0xcfd4('0x41')]('-')[0x0]][_0xcfd4('0x46')],'destconnectedlinenum':_0x3487d1[_0xcfd4('0x43')]});}}}}}}catch(_0x3cb1dd){logger[_0xcfd4('0x47')]('[syncNewChannel][VoiceCallReport]',util[_0xcfd4('0x39')](_0x3cb1dd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcfd4('0x30')][_0xcfd4('0x1d')]=function(_0x29fc79){try{if(this[_0xcfd4('0x31')](_0x29fc79)){if(_0x29fc79[_0xcfd4('0x33')]===_0x29fc79['linkedid']&&_0x29fc79[_0xcfd4('0x43')]!='h'&&_0x29fc79[_0xcfd4('0x3a')]!=_0xcfd4('0x3b')){_0x29fc79[_0xcfd4('0x48')]=_0x29fc79['application'][_0xcfd4('0x49')]();_0x29fc79[_0xcfd4('0x4a')]=(_0x29fc79[_0xcfd4('0x4b')]||_0x29fc79[_0xcfd4('0x4a')])['toLowerCase']();if(_[_0xcfd4('0x35')](this[_0xcfd4('0x1b')][_0x29fc79[_0xcfd4('0x33')]])){this[_0xcfd4('0x1b')][_0x29fc79[_0xcfd4('0x33')]]=new Channel();this[_0xcfd4('0x1b')][_0x29fc79[_0xcfd4('0x33')]][_0xcfd4('0x3c')]=_0x29fc79['duration']?moment()[_0xcfd4('0x4c')](moment[_0xcfd4('0x4d')](_0x29fc79['duration'])[_0xcfd4('0x4e')](),'seconds')[_0xcfd4('0x4f')](_0xcfd4('0x50')):moment()['format'](_0xcfd4('0x50'));this[_0xcfd4('0x1b')][_0x29fc79[_0xcfd4('0x33')]][_0xcfd4('0x3d')]=_0xcfd4('0x15');}_['merge'](this[_0xcfd4('0x1b')][_0x29fc79['uniqueid']],_['pick'](_0x29fc79,_[_0xcfd4('0x3f')](this[_0xcfd4('0x1b')][_0x29fc79['uniqueid']])));if(_[_0xcfd4('0x51')](applications,_0x29fc79['application'])){this[_0xcfd4('0x1b')][_0x29fc79[_0xcfd4('0x33')]][_0xcfd4('0x52')]=_0x29fc79[_0xcfd4('0x48')];this['channels'][_0x29fc79[_0xcfd4('0x33')]][_0xcfd4('0x53')]=_0x29fc79[_0xcfd4('0x4a')];if(_0x29fc79[_0xcfd4('0x48')]===_0xcfd4('0x11')&&_[_0xcfd4('0x54')](_0x29fc79[_0xcfd4('0x4a')],_0xcfd4('0x55'))){var _0x28c680=_0x29fc79[_0xcfd4('0x4a')][_0xcfd4('0x41')]('=');var _0x12ab96=_0x28c680[0x0]['match'](/cdr\((.*)\)/);if(_0x12ab96){this[_0xcfd4('0x1b')][_0x29fc79['uniqueid']][_0x12ab96[0x1]]=_0x28c680[0x1];}}else if(_0x29fc79[_0xcfd4('0x48')]==='queue'){this[_0xcfd4('0x1b')][_0x29fc79[_0xcfd4('0x33')]][_0xcfd4('0x12')]=_0x29fc79[_0xcfd4('0x4a')][_0xcfd4('0x41')](',')[0x0];}}}}}catch(_0x1f1d37){logger['error']('[syncNewExten][VoiceCallReport]',util['inspect'](_0x1f1d37,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcfd4('0x30')][_0xcfd4('0x22')]=function(_0x5419ff){try{if(this[_0xcfd4('0x31')](_0x5419ff)){if(_0x5419ff[_0xcfd4('0x33')]!==_0x5419ff[_0xcfd4('0x34')]){if(this[_0xcfd4('0x1b')][_0x5419ff[_0xcfd4('0x34')]]){if(_0x5419ff[_0xcfd4('0x56')]==='6'){if(!this['channels'][_0x5419ff[_0xcfd4('0x34')]]['answered']){var _0x5b89aa=moment();this[_0xcfd4('0x1b')][_0x5419ff['linkedid']][_0xcfd4('0x57')]=!![];this[_0xcfd4('0x1b')][_0x5419ff[_0xcfd4('0x34')]]['answertime']=_0x5b89aa[_0xcfd4('0x4f')](_0xcfd4('0x50'));if(this[_0xcfd4('0x1b')][_0x5419ff['linkedid']]['starttime']){this['channels'][_0x5419ff['linkedid']][_0xcfd4('0x58')]=_0x5b89aa[_0xcfd4('0x59')](this[_0xcfd4('0x1b')][_0x5419ff['linkedid']][_0xcfd4('0x3c')],_0xcfd4('0x4e'));}}this[_0xcfd4('0x1b')][_0x5419ff['linkedid']][_0xcfd4('0x34')]=_0x5419ff[_0xcfd4('0x33')];if(_0x5419ff['calleridnum']!==_0xcfd4('0x5a')){this[_0xcfd4('0x1b')][_0x5419ff[_0xcfd4('0x34')]][_0xcfd4('0x5b')]=_0x5419ff[_0xcfd4('0x5c')];}this['channels'][_0x5419ff[_0xcfd4('0x34')]][_0xcfd4('0x5d')]=_0x5419ff[_0xcfd4('0x5e')];this[_0xcfd4('0x1b')][_0x5419ff['linkedid']][_0xcfd4('0x5f')]=_0x5419ff[_0xcfd4('0x3a')];this[_0xcfd4('0x1b')][_0x5419ff['linkedid']][_0xcfd4('0x3d')]=dispositions[_[_0xcfd4('0x3e')](_0x5419ff['channelstate'])];if(this[_0xcfd4('0x1c')][_0x5419ff['channel'][_0xcfd4('0x41')]('-')[0x0]]){this[_0xcfd4('0x1b')][_0x5419ff[_0xcfd4('0x34')]]['UserId']=this[_0xcfd4('0x1c')][_0x5419ff[_0xcfd4('0x3a')]['split']('-')[0x0]]['id'];this[_0xcfd4('0x1b')][_0x5419ff[_0xcfd4('0x34')]][_0xcfd4('0x60')]=this['agents'][_0x5419ff[_0xcfd4('0x3a')][_0xcfd4('0x41')]('-')[0x0]]['name'];}}}}else{if(this[_0xcfd4('0x1b')][_0x5419ff[_0xcfd4('0x33')]]){if(_0x5419ff[_0xcfd4('0x56')]==='6'){if(this[_0xcfd4('0x1c')][_0x5419ff[_0xcfd4('0x3a')]['split']('-')[0x0]]){this[_0xcfd4('0x1b')][_0x5419ff[_0xcfd4('0x33')]][_0xcfd4('0x61')]=this[_0xcfd4('0x1c')][_0x5419ff['channel'][_0xcfd4('0x41')]('-')[0x0]]['id'];this['channels'][_0x5419ff[_0xcfd4('0x33')]][_0xcfd4('0x60')]=this['agents'][_0x5419ff[_0xcfd4('0x3a')][_0xcfd4('0x41')]('-')[0x0]][_0xcfd4('0x44')];}}}}}}catch(_0x58c783){logger['error'](_0xcfd4('0x62'),util[_0xcfd4('0x39')](_0x58c783,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcfd4('0x30')][_0xcfd4('0x63')]=function(_0x1fc091,_0x3d5e60){if(this[_0xcfd4('0x1b')][_0x1fc091]){this[_0xcfd4('0x1b')][_0x1fc091][_0xcfd4('0x64')]=!![];if(_[_0xcfd4('0x65')](_0x3d5e60,_0xcfd4('0x66'))){_0x3d5e60=_0x3d5e60[_0xcfd4('0x67')](_0xcfd4('0x66'),_0xcfd4('0x68'));}this[_0xcfd4('0x1b')][_0x1fc091][_0xcfd4('0x69')]=_0x3d5e60;var _0x52e74c=_[_0xcfd4('0x6a')](this[_0xcfd4('0x1b')][_0x1fc091]['monitors'],{'filename':_0x3d5e60});if(_[_0xcfd4('0x6b')](_0x52e74c)){this['channels'][_0x1fc091][_0xcfd4('0x6c')]['push']({'filename':_0x3d5e60,'createdAt':moment()[_0xcfd4('0x4f')](_0xcfd4('0x50')),'mixmonitorid':'','status':_0xcfd4('0x6d')});}}};VoiceCallReport['prototype'][_0xcfd4('0x24')]=function(_0x33f173){try{if(this[_0xcfd4('0x31')](_0x33f173)){if(this[_0xcfd4('0x1b')][_0x33f173[_0xcfd4('0x33')]]&&_0x33f173[_0xcfd4('0x3a')]!='OutgoingSpoolFailed'){if(this['isNotNull'](_0x33f173['variable'])){if(this['isNotNull'](_0x33f173[_0xcfd4('0x6e')]['mixmonitor_filename'])){this[_0xcfd4('0x63')](_0x33f173[_0xcfd4('0x33')],_0x33f173[_0xcfd4('0x6f')]);}else if(this[_0xcfd4('0x31')](_0x33f173[_0xcfd4('0x6e')]['xmd-phone'])){this[_0xcfd4('0x1b')][_0x33f173[_0xcfd4('0x33')]]['calleridnum']=_0x33f173[_0xcfd4('0x6f')];}else if(this[_0xcfd4('0x31')](_0x33f173['variable'][_0xcfd4('0x70')])){this[_0xcfd4('0x1b')][_0x33f173[_0xcfd4('0x33')]]['callerid']=_0x33f173[_0xcfd4('0x6f')];}else if(this[_0xcfd4('0x31')](_0x33f173[_0xcfd4('0x6e')][_0xcfd4('0x71')])){this[_0xcfd4('0x1b')][_0x33f173[_0xcfd4('0x33')]][_0xcfd4('0x72')]=_0x33f173[_0xcfd4('0x6f')];}else if(this[_0xcfd4('0x31')](_0x33f173[_0xcfd4('0x6e')][_0xcfd4('0x73')])){this['channels'][_0x33f173[_0xcfd4('0x33')]]['queue']=_0x33f173[_0xcfd4('0x6f')][_0xcfd4('0x41')](',')[0x0];}else if(this['isNotNull'](_0x33f173[_0xcfd4('0x6e')][_0xcfd4('0x74')])){this[_0xcfd4('0x1b')][_0x33f173[_0xcfd4('0x33')]][_0xcfd4('0x75')]=_0x33f173[_0xcfd4('0x6f')];}else if(this['isNotNull'](_0x33f173[_0xcfd4('0x6e')][_0xcfd4('0x76')])){this['channels'][_0x33f173[_0xcfd4('0x33')]][_0xcfd4('0x77')]=_0x33f173[_0xcfd4('0x6f')];}else if(this['isNotNull'](_0x33f173[_0xcfd4('0x6e')]['xmd-callerid-preview'])){this['channels'][_0x33f173[_0xcfd4('0x33')]][_0xcfd4('0x78')]=_0x33f173['value'];}else if(this['isNotNull'](_0x33f173[_0xcfd4('0x6e')]['xmcs-queue'])){this[_0xcfd4('0x1b')][_0x33f173[_0xcfd4('0x33')]][_0xcfd4('0x12')]=_0x33f173[_0xcfd4('0x6f')];}else if(this[_0xcfd4('0x31')](_0x33f173[_0xcfd4('0x6e')]['sipcallid'])){this[_0xcfd4('0x1b')][_0x33f173['uniqueid']][_0xcfd4('0x79')]=_0x33f173[_0xcfd4('0x6f')];}}}else if(this['isNotNull'](_0x33f173['variable'][_0xcfd4('0x7a')])){if(_0x33f173[_0xcfd4('0x6f')]){var _0x31db1e=path[_0xcfd4('0x7b')](_0x33f173[_0xcfd4('0x6f')])[_0xcfd4('0x44')];this['syncMixMonitorFilename'](_0x31db1e,_0x33f173[_0xcfd4('0x6f')]);}}else if(this[_0xcfd4('0x1b')][_0x33f173['linkedid']]){if(this[_0xcfd4('0x31')](_0x33f173[_0xcfd4('0x6e')])){if(this['isNotNull'](_0x33f173['variable'][_0xcfd4('0x7c')])){this['channels'][_0x33f173['linkedid']][_0xcfd4('0x7d')]=_0x33f173[_0xcfd4('0x6f')];}}}}}catch(_0x288e24){logger[_0xcfd4('0x47')](_0xcfd4('0x7e'),util[_0xcfd4('0x39')](_0x288e24,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcfd4('0x30')][_0xcfd4('0x25')]=function(_0x39a78f){try{if(this[_0xcfd4('0x31')](_0x39a78f)){if(this[_0xcfd4('0x1b')][_0x39a78f[_0xcfd4('0x33')]]){var _0x1e7433=moment();this[_0xcfd4('0x1b')][_0x39a78f[_0xcfd4('0x33')]]['endtime']=_0x1e7433[_0xcfd4('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x39a78f[_0xcfd4('0x33')]]['duration']=_0x1e7433[_0xcfd4('0x59')](this[_0xcfd4('0x1b')][_0x39a78f[_0xcfd4('0x33')]][_0xcfd4('0x3c')],_0xcfd4('0x4e'));if(this[_0xcfd4('0x1b')][_0x39a78f[_0xcfd4('0x33')]][_0xcfd4('0x57')]){this[_0xcfd4('0x1b')][_0x39a78f[_0xcfd4('0x33')]]['billableseconds']=_0x1e7433[_0xcfd4('0x59')](this['channels'][_0x39a78f[_0xcfd4('0x33')]]['answertime'],_0xcfd4('0x4e'));this['channels'][_0x39a78f[_0xcfd4('0x33')]][_0xcfd4('0x58')]=this[_0xcfd4('0x1b')][_0x39a78f[_0xcfd4('0x33')]][_0xcfd4('0x4d')]-this[_0xcfd4('0x1b')][_0x39a78f[_0xcfd4('0x33')]]['billableseconds'];}if(_0x39a78f['context']==='from-sip'){if(this[_0xcfd4('0x1c')][_0x39a78f['channel'][_0xcfd4('0x41')]('-')[0x0]]){this[_0xcfd4('0x1c')][_0x39a78f[_0xcfd4('0x3a')]['split']('-')[0x0]]=_[_0xcfd4('0x7f')](this[_0xcfd4('0x1c')][_0x39a78f[_0xcfd4('0x3a')]['split']('-')[0x0]],['destconnectedlinenum']);this['emit'](util['format'](_0xcfd4('0x80'),this[_0xcfd4('0x1c')][_0x39a78f[_0xcfd4('0x3a')][_0xcfd4('0x41')]('-')[0x0]][_0xcfd4('0x44')]),_0xcfd4('0x81'),{'destaccountcode':this['agents'][_0x39a78f[_0xcfd4('0x3a')]['split']('-')[0x0]][_0xcfd4('0x46')]});}}ami[_0xcfd4('0x32')](_0xcfd4('0x82'),this[_0xcfd4('0x1b')][_0x39a78f['uniqueid']]);delete this['channels'][_0x39a78f[_0xcfd4('0x33')]];}}}catch(_0x2b962e){logger[_0xcfd4('0x47')]('[syncHangup][VoiceCallReport]',util[_0xcfd4('0x39')](_0x2b962e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcfd4('0x30')][_0xcfd4('0x83')]=function(_0x563df0){try{if(this['isNotNull'](_0x563df0)){if(this[_0xcfd4('0x1b')][_0x563df0['transfereeuniqueid']]){this[_0xcfd4('0x1b')][_0x563df0[_0xcfd4('0x84')]]['transfercalleridnum']=_0x563df0[_0xcfd4('0x85')];this['channels'][_0x563df0[_0xcfd4('0x84')]][_0xcfd4('0x86')]=_0x563df0['transfertargetcalleridnum'];if(this['channels'][_0x563df0[_0xcfd4('0x87')]]){var _0x3f3ab0=this[_0xcfd4('0x1b')][_0x563df0['secondtransfereruniqueid']];this[_0xcfd4('0x1b')][_0x563df0[_0xcfd4('0x87')]]=this[_0xcfd4('0x1b')][_0x563df0[_0xcfd4('0x84')]];this[_0xcfd4('0x1b')][_0x563df0['transfereeuniqueid']]=_0x3f3ab0;}}else if(this[_0xcfd4('0x1b')][_0x563df0['transfertargetuniqueid']]){this[_0xcfd4('0x1b')][_0x563df0[_0xcfd4('0x88')]][_0xcfd4('0x89')]=_0x563df0[_0xcfd4('0x85')];this[_0xcfd4('0x1b')][_0x563df0[_0xcfd4('0x88')]]['transferconnectedlinenum']=_0x563df0['transfertargetcalleridnum'];if(this['channels'][_0x563df0[_0xcfd4('0x8a')]]){var _0x3f3ab0=this[_0xcfd4('0x1b')][_0x563df0['origtransfereruniqueid']];this['channels'][_0x563df0[_0xcfd4('0x8a')]]=this[_0xcfd4('0x1b')][_0x563df0[_0xcfd4('0x88')]];this['channels'][_0x563df0[_0xcfd4('0x88')]]=_0x3f3ab0;}}}}catch(_0x3ad307){logger[_0xcfd4('0x47')](_0xcfd4('0x8b'),util['inspect'](_0x3ad307,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcfd4('0x30')][_0xcfd4('0x2a')]=function(_0xfc32fc){try{if(this[_0xcfd4('0x31')](_0xfc32fc)){if(this[_0xcfd4('0x1b')][_0xfc32fc[_0xcfd4('0x84')]]){this[_0xcfd4('0x1b')][_0xfc32fc[_0xcfd4('0x84')]][_0xcfd4('0x89')]=_0xfc32fc[_0xcfd4('0x8c')];this[_0xcfd4('0x1b')][_0xfc32fc['transfereeuniqueid']][_0xcfd4('0x86')]=_0xfc32fc[_0xcfd4('0x8d')];this[_0xcfd4('0x25')]({'event':'BlindTransfer','uniqueid':_0xfc32fc['transfereeuniqueid'],'context':_0xfc32fc[_0xcfd4('0x40')],'channel':_0xfc32fc[_0xcfd4('0x8e')]});}}}catch(_0x357a94){logger['error']('[syncBlindTransfer][VoiceCallReport]',util[_0xcfd4('0x39')](_0x357a94,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xcfd4('0x2b')]=function(_0x1b9e57){try{if(this['isNotNull'](_0x1b9e57)){if(this['channels'][_0x1b9e57[_0xcfd4('0x33')]]){if(!_[_0xcfd4('0x6b')](this[_0xcfd4('0x1b')][_0x1b9e57['uniqueid']][_0xcfd4('0x8f')])){this['channels'][_0x1b9e57[_0xcfd4('0x33')]][_0xcfd4('0x90')]=moment()[_0xcfd4('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');}}}}catch(_0x471a33){logger[_0xcfd4('0x47')]('[syncMusicOnHoldStart][VoiceCallReport]',util[_0xcfd4('0x39')](_0x471a33,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcfd4('0x30')][_0xcfd4('0x91')]=function(_0x1e310a){try{if(this[_0xcfd4('0x31')](_0x1e310a)){if(this[_0xcfd4('0x1b')][_0x1e310a[_0xcfd4('0x33')]]){if(!_[_0xcfd4('0x6b')](this[_0xcfd4('0x1b')][_0x1e310a['uniqueid']]['mohstarttime'])){this[_0xcfd4('0x1b')][_0x1e310a[_0xcfd4('0x33')]][_0xcfd4('0x92')]+=moment()[_0xcfd4('0x93')](0x0)['diff'](this[_0xcfd4('0x1b')][_0x1e310a[_0xcfd4('0x33')]][_0xcfd4('0x90')],'seconds');delete this[_0xcfd4('0x1b')][_0x1e310a[_0xcfd4('0x33')]][_0xcfd4('0x90')];}}}}catch(_0x5b4b97){logger['error']('[syncMusicOnHoldStop][VoiceCallReport]',util[_0xcfd4('0x39')](_0x5b4b97,{'showHidden':![],'depth':null}));}};module[_0xcfd4('0x94')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index a7d7760..2ea5c77 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 _0x5c91=['value','[syncVarSet][VoiceDialReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberrealtime','syncHangup','endtime','duration','diff','starttime','seconds','complete','total','answertime','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outbound','variables','syncDialBegin','bind','dialend','varset','syncVarSet','prototype','isUndefined','isNotNull','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','voice:outbound','voice_outbound_channel:save','emit','custom:dialbegin','error','inspect','syncDialEnd','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','connect','custom:dialconnect','[syncDialEnd][VoiceDialReport]','keys','variable','outboundrouteid'];(function(_0x2c2390,_0x37ef1c){var _0x478b7e=function(_0x2ea947){while(--_0x2ea947){_0x2c2390['push'](_0x2c2390['shift']());}};_0x478b7e(++_0x37ef1c);}(_0x5c91,0x1e9));var _0x15c9=function(_0x3c3637,_0x470821){_0x3c3637=_0x3c3637-0x0;var _0x5a6a78=_0x5c91[_0x3c3637];return _0x5a6a78;};'use strict';var _=require(_0x15c9('0x0'));var moment=require(_0x15c9('0x1'));var util=require(_0x15c9('0x2'));var Redis=require('ioredis');var config=require(_0x15c9('0x3'));var logger=require(_0x15c9('0x4'))(_0x15c9('0x5'));var ami=require(_0x15c9('0x6'));config[_0x15c9('0x7')]=_[_0x15c9('0x8')](config['redis'],{'host':_0x15c9('0x9'),'port':0x18eb});var io=require(_0x15c9('0xa'))(new Redis(config[_0x15c9('0x7')]));function VoiceDialReport(_0x42bcb6){this[_0x15c9('0xb')]=_0x42bcb6['outboundChannels'];this[_0x15c9('0xc')]=_0x42bcb6[_0x15c9('0xc')];this[_0x15c9('0xd')]={};ami['on']('dialbegin',this[_0x15c9('0xe')][_0x15c9('0xf')](this));ami['on'](_0x15c9('0x10'),this['syncDialEnd']['bind'](this));ami['on'](_0x15c9('0x11'),this[_0x15c9('0x12')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0x15c9('0xf')](this));}VoiceDialReport[_0x15c9('0x13')]['isNotNull']=function(_0x20062a){return _0x20062a!==null&&!_[_0x15c9('0x14')](_0x20062a);};VoiceDialReport[_0x15c9('0x13')]['emit']=function(_0x4e221e,_0x9e4403,_0xd71ac0){io['to'](_0x4e221e)['emit'](_0x9e4403,_0xd71ac0);};VoiceDialReport[_0x15c9('0x13')]['syncDialBegin']=function(_0x3b768e){try{if(this[_0x15c9('0x15')](_0x3b768e)){if(this[_0x15c9('0xb')][_0x3b768e[_0x15c9('0x16')]]){_[_0x15c9('0x17')](this[_0x15c9('0xb')][_0x3b768e['uniqueid']],{'starttime':moment()[_0x15c9('0x18')](_0x15c9('0x19')),'lastevent':_0x15c9('0x1a'),'interface':_0x3b768e[_0x15c9('0x1b')][_0x15c9('0x1c')](0x0,_0x3b768e[_0x15c9('0x1b')][_0x15c9('0x1d')]('-')),'membername':_0x3b768e[_0x15c9('0x1b')]['substring'](_0x3b768e[_0x15c9('0x1b')][_0x15c9('0x1d')]('/')+0x1,_0x3b768e[_0x15c9('0x1b')][_0x15c9('0x1d')]('-'))},_[_0x15c9('0x1e')](_0x3b768e,[_0x15c9('0x1f'),_0x15c9('0x20')]));this['emit'](_0x15c9('0x21'),_0x15c9('0x22'),this[_0x15c9('0xb')][_0x3b768e[_0x15c9('0x16')]]);ami[_0x15c9('0x23')](_0x15c9('0x24'),this[_0x15c9('0xb')][_0x3b768e[_0x15c9('0x16')]]);}}}catch(_0x216b24){logger[_0x15c9('0x25')]('[syncDialBegin][VoiceDialReport]',util[_0x15c9('0x26')](_0x216b24,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x15c9('0x27')]=function(_0x2a64d3){try{if(this['isNotNull'](_0x2a64d3)){if(this[_0x15c9('0xb')][_0x2a64d3[_0x15c9('0x16')]]){this[_0x15c9('0xb')][_0x2a64d3['uniqueid']]['dialstatus']=_0x2a64d3[_0x15c9('0x28')];if(_0x2a64d3[_0x15c9('0x28')]===_0x15c9('0x29')){this[_0x15c9('0xb')][_0x2a64d3['uniqueid']][_0x15c9('0x2a')]=_0x2a64d3[_0x15c9('0x2a')];this[_0x15c9('0xb')][_0x2a64d3[_0x15c9('0x16')]][_0x15c9('0x2b')]=_0x2a64d3[_0x15c9('0x2b')];this[_0x15c9('0xb')][_0x2a64d3[_0x15c9('0x16')]]['answertime']=moment()[_0x15c9('0x18')](_0x15c9('0x19'));this[_0x15c9('0xb')][_0x2a64d3[_0x15c9('0x16')]][_0x15c9('0x2c')]=_0x15c9('0x2d');ami[_0x15c9('0x23')](_0x15c9('0x2e'),this[_0x15c9('0xb')][_0x2a64d3[_0x15c9('0x16')]]);}this[_0x15c9('0x23')](_0x15c9('0x21'),'voice_outbound_channel:save',this[_0x15c9('0xb')][_0x2a64d3['uniqueid']]);}}}catch(_0x1f6b35){logger['error'](_0x15c9('0x2f'),util[_0x15c9('0x26')](_0x1f6b35,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x15c9('0x13')]['syncVarSet']=function(_0x473152){try{if(this[_0x15c9('0x15')](_0x473152)){this['addVariable'](_0x473152['uniqueid'],_[_0x15c9('0x30')](_0x473152[_0x15c9('0x31')])[0x0],_0x473152['value']);if(this[_0x15c9('0x15')](_0x473152[_0x15c9('0x31')])&&this[_0x15c9('0x15')](_0x473152[_0x15c9('0x31')][_0x15c9('0x32')])){if(_[_0x15c9('0x14')](this['channels'][_0x473152[_0x15c9('0x16')]])){this['channels'][_0x473152[_0x15c9('0x16')]]={'routeId':_0x473152[_0x15c9('0x33')],'variables':this['variables'][_0x473152[_0x15c9('0x16')]]};this[_0x15c9('0x23')]('voice:outbound',_0x15c9('0x22'),this[_0x15c9('0xb')][_0x473152['uniqueid']]);}}}}catch(_0x5ec45e){logger[_0x15c9('0x25')](_0x15c9('0x34'),util['inspect'](_0x5ec45e,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['addVariable']=function(_0x1612e0,_0x3cf772,_0x49b5c5){var _0x5bd601=['rtpaudioqos',_0x15c9('0x35'),_0x15c9('0x36'),_0x15c9('0x37'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x15c9('0x38'),_0x15c9('0x39'),_0x15c9('0x3a'),_0x15c9('0x3b'),_0x15c9('0x3c'),_0x15c9('0x3d'),_0x15c9('0x3e'),_0x15c9('0x3f'),_0x15c9('0x40'),_0x15c9('0x41'),_0x15c9('0x42'),'memberpenalty',_0x15c9('0x43')];if(!_['isNil'](_0x3cf772)&&!_['includes'](_0x5bd601,_0x3cf772)){if(_[_0x15c9('0x14')](this[_0x15c9('0xd')][_0x1612e0])){this[_0x15c9('0xd')][_0x1612e0]={};}this[_0x15c9('0xd')][_0x1612e0][_0x3cf772]=_0x49b5c5;}};VoiceDialReport[_0x15c9('0x13')][_0x15c9('0x44')]=function(_0xe331cf){try{if(this['isNotNull'](_0xe331cf)){if(this[_0x15c9('0xb')][_0xe331cf['uniqueid']]){this[_0x15c9('0xb')][_0xe331cf[_0x15c9('0x16')]][_0x15c9('0x45')]=moment()[_0x15c9('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x15c9('0xb')][_0xe331cf[_0x15c9('0x16')]][_0x15c9('0x46')]=moment(this[_0x15c9('0xb')][_0xe331cf[_0x15c9('0x16')]][_0x15c9('0x45')])[_0x15c9('0x47')](this['channels'][_0xe331cf[_0x15c9('0x16')]][_0x15c9('0x48')],_0x15c9('0x49'));this[_0x15c9('0xb')][_0xe331cf[_0x15c9('0x16')]][_0x15c9('0x2c')]=_0x15c9('0x4a');this[_0x15c9('0xc')][_0x15c9('0x4b')]+=0x1;if(this[_0x15c9('0xb')][_0xe331cf[_0x15c9('0x16')]][_0x15c9('0x4c')]){this[_0x15c9('0xc')][_0x15c9('0x4d')]+=0x1;this['channels'][_0xe331cf[_0x15c9('0x16')]][_0x15c9('0x4e')]=moment(this[_0x15c9('0xb')][_0xe331cf['uniqueid']][_0x15c9('0x4c')])['diff'](this['channels'][_0xe331cf[_0x15c9('0x16')]][_0x15c9('0x48')],_0x15c9('0x49'));this[_0x15c9('0xb')][_0xe331cf[_0x15c9('0x16')]][_0x15c9('0x4f')]=moment(this[_0x15c9('0xb')][_0xe331cf['uniqueid']]['endtime'])[_0x15c9('0x47')](this[_0x15c9('0xb')][_0xe331cf[_0x15c9('0x16')]][_0x15c9('0x4c')],'seconds');this['outbound'][_0x15c9('0x50')]+=this['channels'][_0xe331cf[_0x15c9('0x16')]][_0x15c9('0x4e')]||0x0;this[_0x15c9('0xc')][_0x15c9('0x51')]+=this[_0x15c9('0xb')][_0xe331cf[_0x15c9('0x16')]][_0x15c9('0x4f')];}this['outbound'][_0x15c9('0x52')]+=this['channels'][_0xe331cf[_0x15c9('0x16')]]['duration'];ami['emit'](_0x15c9('0x53'),this[_0x15c9('0xb')][_0xe331cf['uniqueid']]);ami[_0x15c9('0x23')](_0x15c9('0x54'),this['channels'][_0xe331cf[_0x15c9('0x16')]]);this[_0x15c9('0x23')](_0x15c9('0x21'),_0x15c9('0x55'),this[_0x15c9('0xc')]);logger[_0x15c9('0x56')](_0x15c9('0x57'),JSON[_0x15c9('0x58')](this['channels'][_0xe331cf[_0x15c9('0x16')]]));this[_0x15c9('0x23')](_0x15c9('0x21'),'voice_outbound_channel:remove',this[_0x15c9('0xb')][_0xe331cf['uniqueid']]);delete this[_0x15c9('0xb')][_0xe331cf['uniqueid']];}if(this[_0x15c9('0xd')][_0xe331cf['uniqueid']]){delete this[_0x15c9('0xd')][_0xe331cf['uniqueid']];}}}catch(_0x5819e6){logger[_0x15c9('0x25')]('[syncHangup][VoiceDialReport]',util[_0x15c9('0x26')](_0x5819e6,{'showHidden':![],'depth':null}));}};module[_0x15c9('0x59')]=VoiceDialReport; \ No newline at end of file +var _0x5924=['diff','starttime','complete','seconds','billableseconds','endtime','sumBillable','custom:dialend','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','varset','syncVarSet','hangup','syncHangup','prototype','isUndefined','emit','isNotNull','uniqueid','merge','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','omit','event','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','syncDialEnd','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','custom:dialconnect','addVariable','keys','variable','outboundrouteid','value','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','isNil','includes','duration'];(function(_0x5b5b8b,_0x102a14){var _0x2d3ed2=function(_0x305251){while(--_0x305251){_0x5b5b8b['push'](_0x5b5b8b['shift']());}};_0x2d3ed2(++_0x102a14);}(_0x5924,0xb6));var _0x4592=function(_0x529a0f,_0x328763){_0x529a0f=_0x529a0f-0x0;var _0x187a88=_0x5924[_0x529a0f];return _0x187a88;};'use strict';var _=require(_0x4592('0x0'));var moment=require('moment');var util=require(_0x4592('0x1'));var Redis=require(_0x4592('0x2'));var config=require(_0x4592('0x3'));var logger=require(_0x4592('0x4'))(_0x4592('0x5'));var ami=require(_0x4592('0x6'));config[_0x4592('0x7')]=_[_0x4592('0x8')](config[_0x4592('0x7')],{'host':_0x4592('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x573ac0){this['channels']=_0x573ac0[_0x4592('0xa')];this[_0x4592('0xb')]=_0x573ac0[_0x4592('0xb')];this[_0x4592('0xc')]={};ami['on'](_0x4592('0xd'),this[_0x4592('0xe')][_0x4592('0xf')](this));ami['on'](_0x4592('0x10'),this['syncDialEnd'][_0x4592('0xf')](this));ami['on'](_0x4592('0x11'),this[_0x4592('0x12')][_0x4592('0xf')](this));ami['on'](_0x4592('0x13'),this[_0x4592('0x14')]['bind'](this));}VoiceDialReport[_0x4592('0x15')]['isNotNull']=function(_0x39796b){return _0x39796b!==null&&!_[_0x4592('0x16')](_0x39796b);};VoiceDialReport[_0x4592('0x15')][_0x4592('0x17')]=function(_0x5303c2,_0x584dbb,_0x38cdc2){io['to'](_0x5303c2)[_0x4592('0x17')](_0x584dbb,_0x38cdc2);};VoiceDialReport[_0x4592('0x15')][_0x4592('0xe')]=function(_0x247bf7){try{if(this[_0x4592('0x18')](_0x247bf7)){if(this['channels'][_0x247bf7[_0x4592('0x19')]]){_[_0x4592('0x1a')](this[_0x4592('0x1b')][_0x247bf7[_0x4592('0x19')]],{'starttime':moment()[_0x4592('0x1c')](_0x4592('0x1d')),'lastevent':_0x4592('0x1e'),'interface':_0x247bf7['channel']['substring'](0x0,_0x247bf7[_0x4592('0x1f')][_0x4592('0x20')]('-')),'membername':_0x247bf7[_0x4592('0x1f')]['substring'](_0x247bf7['channel'][_0x4592('0x20')]('/')+0x1,_0x247bf7['channel'][_0x4592('0x20')]('-'))},_[_0x4592('0x21')](_0x247bf7,[_0x4592('0x22'),_0x4592('0x23')]));this[_0x4592('0x17')](_0x4592('0x24'),_0x4592('0x25'),this[_0x4592('0x1b')][_0x247bf7[_0x4592('0x19')]]);ami[_0x4592('0x17')](_0x4592('0x26'),this['channels'][_0x247bf7['uniqueid']]);}}}catch(_0x3eca50){logger[_0x4592('0x27')](_0x4592('0x28'),util[_0x4592('0x29')](_0x3eca50,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4592('0x15')][_0x4592('0x2a')]=function(_0x334269){try{if(this[_0x4592('0x18')](_0x334269)){if(this['channels'][_0x334269[_0x4592('0x19')]]){this[_0x4592('0x1b')][_0x334269[_0x4592('0x19')]][_0x4592('0x2b')]=_0x334269[_0x4592('0x2b')];if(_0x334269[_0x4592('0x2b')]===_0x4592('0x2c')){this[_0x4592('0x1b')][_0x334269[_0x4592('0x19')]][_0x4592('0x2d')]=_0x334269[_0x4592('0x2d')];this[_0x4592('0x1b')][_0x334269[_0x4592('0x19')]][_0x4592('0x2e')]=_0x334269[_0x4592('0x2e')];this[_0x4592('0x1b')][_0x334269[_0x4592('0x19')]][_0x4592('0x2f')]=moment()['format'](_0x4592('0x1d'));this[_0x4592('0x1b')][_0x334269['uniqueid']][_0x4592('0x30')]=_0x4592('0x31');ami['emit'](_0x4592('0x32'),this[_0x4592('0x1b')][_0x334269['uniqueid']]);}this['emit'](_0x4592('0x24'),_0x4592('0x25'),this[_0x4592('0x1b')][_0x334269[_0x4592('0x19')]]);}}}catch(_0x25e1fb){logger[_0x4592('0x27')]('[syncDialEnd][VoiceDialReport]',util[_0x4592('0x29')](_0x25e1fb,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4592('0x15')][_0x4592('0x12')]=function(_0x160db5){try{if(this[_0x4592('0x18')](_0x160db5)){this[_0x4592('0x33')](_0x160db5[_0x4592('0x19')],_[_0x4592('0x34')](_0x160db5[_0x4592('0x35')])[0x0],_0x160db5['value']);if(this[_0x4592('0x18')](_0x160db5[_0x4592('0x35')])&&this[_0x4592('0x18')](_0x160db5['variable'][_0x4592('0x36')])){if(_['isUndefined'](this['channels'][_0x160db5[_0x4592('0x19')]])){this[_0x4592('0x1b')][_0x160db5['uniqueid']]={'routeId':_0x160db5[_0x4592('0x37')],'variables':this[_0x4592('0xc')][_0x160db5['uniqueid']]};this[_0x4592('0x17')](_0x4592('0x24'),_0x4592('0x25'),this['channels'][_0x160db5['uniqueid']]);}}}}catch(_0xb9e786){logger[_0x4592('0x27')](_0x4592('0x38'),util['inspect'](_0xb9e786,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4592('0x15')][_0x4592('0x33')]=function(_0x4f79d5,_0x2e4398,_0x4da8c2){var _0x224017=[_0x4592('0x39'),_0x4592('0x3a'),_0x4592('0x3b'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x4592('0x3c'),_0x4592('0x3d'),_0x4592('0x3e'),_0x4592('0x3f'),_0x4592('0x40'),'bridgepeer',_0x4592('0x41'),_0x4592('0x42'),_0x4592('0x43'),_0x4592('0x44'),_0x4592('0x45'),'membername','memberpenalty','memberrealtime'];if(!_[_0x4592('0x46')](_0x2e4398)&&!_[_0x4592('0x47')](_0x224017,_0x2e4398)){if(_[_0x4592('0x16')](this[_0x4592('0xc')][_0x4f79d5])){this[_0x4592('0xc')][_0x4f79d5]={};}this['variables'][_0x4f79d5][_0x2e4398]=_0x4da8c2;}};VoiceDialReport['prototype'][_0x4592('0x14')]=function(_0x45225d){try{if(this[_0x4592('0x18')](_0x45225d)){if(this[_0x4592('0x1b')][_0x45225d['uniqueid']]){this[_0x4592('0x1b')][_0x45225d[_0x4592('0x19')]]['endtime']=moment()[_0x4592('0x1c')](_0x4592('0x1d'));this['channels'][_0x45225d[_0x4592('0x19')]][_0x4592('0x48')]=moment(this['channels'][_0x45225d[_0x4592('0x19')]]['endtime'])[_0x4592('0x49')](this[_0x4592('0x1b')][_0x45225d[_0x4592('0x19')]][_0x4592('0x4a')],'seconds');this[_0x4592('0x1b')][_0x45225d[_0x4592('0x19')]]['lastevent']=_0x4592('0x4b');this[_0x4592('0xb')]['total']+=0x1;if(this[_0x4592('0x1b')][_0x45225d['uniqueid']][_0x4592('0x2f')]){this[_0x4592('0xb')]['answered']+=0x1;this['channels'][_0x45225d[_0x4592('0x19')]]['holdtime']=moment(this[_0x4592('0x1b')][_0x45225d[_0x4592('0x19')]][_0x4592('0x2f')])[_0x4592('0x49')](this[_0x4592('0x1b')][_0x45225d[_0x4592('0x19')]][_0x4592('0x4a')],_0x4592('0x4c'));this[_0x4592('0x1b')][_0x45225d[_0x4592('0x19')]][_0x4592('0x4d')]=moment(this[_0x4592('0x1b')][_0x45225d['uniqueid']][_0x4592('0x4e')])['diff'](this['channels'][_0x45225d[_0x4592('0x19')]]['answertime'],_0x4592('0x4c'));this[_0x4592('0xb')]['sumHoldTime']+=this[_0x4592('0x1b')][_0x45225d[_0x4592('0x19')]]['holdtime']||0x0;this['outbound'][_0x4592('0x4f')]+=this['channels'][_0x45225d[_0x4592('0x19')]][_0x4592('0x4d')];}this['outbound']['sumDuration']+=this[_0x4592('0x1b')][_0x45225d[_0x4592('0x19')]][_0x4592('0x48')];ami[_0x4592('0x17')]('custom:voiceDialReport',this['channels'][_0x45225d[_0x4592('0x19')]]);ami[_0x4592('0x17')](_0x4592('0x50'),this[_0x4592('0x1b')][_0x45225d[_0x4592('0x19')]]);this[_0x4592('0x17')](_0x4592('0x24'),'voice_outbound:save',this[_0x4592('0xb')]);logger['info'](_0x4592('0x51'),JSON[_0x4592('0x52')](this['channels'][_0x45225d['uniqueid']]));this[_0x4592('0x17')](_0x4592('0x24'),_0x4592('0x53'),this[_0x4592('0x1b')][_0x45225d['uniqueid']]);delete this[_0x4592('0x1b')][_0x45225d[_0x4592('0x19')]];}if(this[_0x4592('0xc')][_0x45225d[_0x4592('0x19')]]){delete this[_0x4592('0xc')][_0x45225d[_0x4592('0x19')]];}}}catch(_0x15f607){logger['error'](_0x4592('0x54'),util['inspect'](_0x15f607,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 790f3d6..1dd5b29 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 _0x45ca=['prototype','enqueue','tail','finally','queueReports','agents','queueChannels','voiceQueues','flagQueueSummary','campaigns','queuesummary','syncQueueSummary','queuesummarycomplete','bind','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','hangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','loopQueueSummary','isUndefined','originated','talking','pTalking','waiting','isEmpty','hasOwnProperty','unlockRR','channels','switch','Action','channel','catch','No\x20such\x20channel','error','variables','[voiceQueueReport][checkVariables]','clearQueueReport','inspect','emit','emitVoiceQueueChannelSave','format','voice:queue:%s','voice_queue_channel:save','info','stringify','voice_queue_channel:remove','emitVoiceQueueSummary','type','name','answered','available','loggedIn','sumBillable','sumHoldTime','total','unmanaged','abandoned','Trunk','active','callerid','Interval','voice_queue:save','loopQueueShow','queues','[queues]','then','[queuesummary]','isNotNull','queue','toNumber','loggedin','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncQueueSummaryComplete','syncNewExten','uniqueid','inbound','position','count','merge','keys','[syncQueueCallerJoin][VoiceQueueReport]','syncQueueCallerAbandon','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','YYYY-MM-DD\x20HH:mm:ss','ABANDONED','lastAssignedTo','emitVoiceQueueChannelRemove','[syncQueueCallerAbandon][VoiceQueueReport]','queuecallerleaveAt','connectedlinenum','connectedlinename','queuecallerexitreason','assigned','queuecallerexitAt','reason','transfer','COMPLETED','startsWith','local/','linkedid','queuecallerexit','queuecallerjoinAt','add','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','syncVarSet','addVariable','value','variable','queuestatus','TIMEOUT','lastevent','custom:timeout','queuecallerabandonAt','queueposition','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberlastcall','membername','memberpenalty','memberrealtime','includes','syncHangup','length','diff','seconds','sumDuration','milliseconds','custom:queuecallerunmanaged','custom:queuecallerabandon','custom:voiceQueueReport','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','syncBlindTransfer','BLINDTRANSFER','BLIND','extension','BlindTransfer','transfererchannel','isNil','mohstarttime','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','../model/queueReport','defaults','redis','localhost','socket.io-emitter'];(function(_0x10e3f7,_0x353b97){var _0x3ee398=function(_0x16d5ce){while(--_0x16d5ce){_0x10e3f7['push'](_0x10e3f7['shift']());}};_0x3ee398(++_0x353b97);}(_0x45ca,0xbb));var _0xa45c=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x45ca[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0xa45c('0x0'));var moment=require(_0xa45c('0x1'));var BPromise=require('bluebird');var util=require('util');var md5=require(_0xa45c('0x2'));var Redis=require(_0xa45c('0x3'));var config=require(_0xa45c('0x4'));var logger=require(_0xa45c('0x5'))('ami');var ami=require('../ami');var QueueReport=require(_0xa45c('0x6'));config['redis']=_[_0xa45c('0x7')](config[_0xa45c('0x8')],{'host':_0xa45c('0x9'),'port':0x18eb});var io=require(_0xa45c('0xa'))(new Redis(config[_0xa45c('0x8')]));var Sequence=function(){};Sequence[_0xa45c('0xb')][_0xa45c('0xc')]=function(_0x17140c){this[_0xa45c('0xd')]=this[_0xa45c('0xd')]?this['tail'][_0xa45c('0xe')](_0x17140c):_0x17140c();};function VoiceQueueReport(_0x1226d8){this['sequence']=new Sequence();this[_0xa45c('0xf')]={};this[_0xa45c('0x10')]=_0x1226d8[_0xa45c('0x10')];this['channels']=_0x1226d8[_0xa45c('0x11')];this[_0xa45c('0x12')]=_0x1226d8[_0xa45c('0x12')];this[_0xa45c('0x13')]=!![];this[_0xa45c('0x14')]=_0x1226d8[_0xa45c('0x14')];this['variables']={};ami['on'](_0xa45c('0x15'),this[_0xa45c('0x16')]['bind'](this));ami['on'](_0xa45c('0x17'),this['syncQueueSummaryComplete'][_0xa45c('0x18')](this));ami['on'](_0xa45c('0x19'),this[_0xa45c('0x1a')][_0xa45c('0x18')](this));ami['on'](_0xa45c('0x1b'),this['syncQueueCallerAbandon'][_0xa45c('0x18')](this));ami['on'](_0xa45c('0x1c'),this[_0xa45c('0x1d')][_0xa45c('0x18')](this));ami['on'](_0xa45c('0x1e'),this[_0xa45c('0x1f')]['bind'](this));ami['on'](_0xa45c('0x20'),this[_0xa45c('0x21')][_0xa45c('0x18')](this));ami['on'](_0xa45c('0x22'),this['syncVarSet'][_0xa45c('0x18')](this));ami['on'](_0xa45c('0x23'),this['syncHangup'][_0xa45c('0x18')](this));ami['on'](_0xa45c('0x24'),this[_0xa45c('0x25')][_0xa45c('0x18')](this));ami['on'](_0xa45c('0x26'),this[_0xa45c('0x27')][_0xa45c('0x18')](this));ami['on'](_0xa45c('0x28'),this[_0xa45c('0x29')][_0xa45c('0x18')](this));ami['on'](_0xa45c('0x2a'),this[_0xa45c('0x2b')][_0xa45c('0x18')](this));ami['on'](_0xa45c('0x2c'),this['syncBlindTransfer'][_0xa45c('0x18')](this));this[_0xa45c('0x2d')]();this['loopQueueShow']();}function isNotNull(_0x5f06ac){return _0x5f06ac!==null&&!_[_0xa45c('0x2e')](_0x5f06ac);}function clearChannels(_0x35c9dc){if(!_['isEmpty'](_0x35c9dc)){for(var _0x278797 in _0x35c9dc){if(_0x35c9dc['hasOwnProperty'](_0x278797)){delete _0x35c9dc[_0x278797];}}}}function clearCampaigns(_0x26895a){if(!_['isEmpty'](_0x26895a)){for(var _0x16fd5c in _0x26895a){if(_0x26895a['hasOwnProperty'](_0x16fd5c)){_0x26895a[_0x16fd5c][_0xa45c('0x2f')]=0x0;}}}}function clearVoiceQueues(_0xb2a121){if(!_['isEmpty'](_0xb2a121)){for(var _0x3e755b in _0xb2a121){if(_0xb2a121['hasOwnProperty'](_0x3e755b)){_0xb2a121[_0x3e755b][_0xa45c('0x2f')]=0x0;_0xb2a121[_0x3e755b][_0xa45c('0x30')]=0x0;_0xb2a121[_0x3e755b][_0xa45c('0x31')]=0x0;_0xb2a121[_0x3e755b][_0xa45c('0x32')]=0x0;_0xb2a121[_0x3e755b]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0xb9298e){if(!_[_0xa45c('0x33')](_0xb9298e)){for(var _0x4690ea in _0xb9298e){if(_0xb9298e[_0xa45c('0x34')](_0x4690ea)){_0xb9298e[_0x4690ea][_0xa45c('0x35')]=!![];}}}}VoiceQueueReport[_0xa45c('0xb')]['clearZombieChannels']=function(){var _0x5584f1=this;for(var _0x4a4015 in this[_0xa45c('0x36')]){if(this['channels']['hasOwnProperty'](_0x4a4015)&&!this[_0xa45c('0x36')][_0x4a4015][_0xa45c('0x37')]){this['sequence']['enqueue'](function(){if(!_['isNil'](_0x5584f1[_0xa45c('0x36')][_0x4a4015])){return ami[_0xa45c('0x38')]({'action':'status','channel':_0x5584f1['channels'][_0x4a4015][_0xa45c('0x39')]})[_0xa45c('0x3a')](function(_0x156ec8){if(_0x156ec8['message']===_0xa45c('0x3b')){setTimeout(function(){if(_0x5584f1['channels'][_0x4a4015]){delete _0x5584f1[_0xa45c('0x36')][_0x4a4015];logger[_0xa45c('0x3c')]('[voiceQueueReport][checkChannel]',_0x4a4015);}if(_0x5584f1[_0xa45c('0xf')][_0x4a4015]){delete _0x5584f1[_0xa45c('0xf')][_0x4a4015];logger[_0xa45c('0x3c')]('[voiceQueueReport][checkQueueReport]',_0x4a4015);}if(_0x5584f1[_0xa45c('0x3d')][_0x4a4015]){delete _0x5584f1[_0xa45c('0x3d')][_0x4a4015];logger[_0xa45c('0x3c')](_0xa45c('0x3e'),_0x4a4015);}},0x1f40);}});}});}}};VoiceQueueReport[_0xa45c('0xb')]['syncFullyBooted']=function(){logger['error']('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0xa45c('0x36')]);this[_0xa45c('0x3f')](this['queueReports']);clearAgentBooked(this[_0xa45c('0x10')]);clearVoiceQueues(this[_0xa45c('0x12')]);clearCampaigns(this['campaigns']);};VoiceQueueReport[_0xa45c('0xb')][_0xa45c('0x3f')]=function(_0x2cc5b5){var _0x3c8557=this;if(!_['isEmpty'](_0x2cc5b5)){for(var _0x51367c in _0x2cc5b5){if(_0x2cc5b5[_0xa45c('0x34')](_0x51367c)){_0x3c8557['emitVoiceQueueChannelRemove'](_0x2cc5b5[_0x51367c]);delete _0x2cc5b5[_0x51367c];}}}};function loggerCatch(_0x310a09){return function(_0x41ed65){logger[_0xa45c('0x3c')](_0x310a09,util[_0xa45c('0x40')](_0x41ed65,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0xa45c('0xb')][_0xa45c('0x41')]=function(_0x3a0820,_0x601565,_0x2df22f){io['to'](_0x3a0820)[_0xa45c('0x41')](_0x601565,_0x2df22f);};VoiceQueueReport['prototype'][_0xa45c('0x42')]=function(_0x54abee){this[_0xa45c('0x41')](util[_0xa45c('0x43')](_0xa45c('0x44'),_0x54abee['name']),_0xa45c('0x45'),_0x54abee);};VoiceQueueReport['prototype']['emitVoiceQueueChannelRemove']=function(_0x211b72){logger[_0xa45c('0x46')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0xa45c('0x47')](_0x211b72));this['emit'](util['format'](_0xa45c('0x44'),_0x211b72['name']),_0xa45c('0x48'),_0x211b72);};VoiceQueueReport['prototype'][_0xa45c('0x49')]=function(_0x4a9e1a){if(_0x4a9e1a[_0xa45c('0x4a')]==='inbound'){var _0x382e2b={'id':_0x4a9e1a['id'],'name':_0x4a9e1a[_0xa45c('0x4b')],'strategy':_0x4a9e1a['strategy'],'answered':_0x4a9e1a[_0xa45c('0x4c')],'available':_0x4a9e1a[_0xa45c('0x4d')],'loggedIn':_0x4a9e1a[_0xa45c('0x4e')],'pTalking':_0x4a9e1a[_0xa45c('0x31')],'sumBillable':_0x4a9e1a[_0xa45c('0x4f')],'sumDuration':_0x4a9e1a['sumDuration'],'sumHoldTime':_0x4a9e1a[_0xa45c('0x50')]||0x0,'talking':_0x4a9e1a['talking'],'total':_0x4a9e1a[_0xa45c('0x51')],'type':_0x4a9e1a[_0xa45c('0x4a')],'unmanaged':_0x4a9e1a[_0xa45c('0x52')],'abandoned':_0x4a9e1a[_0xa45c('0x53')],'waiting':_0x4a9e1a[_0xa45c('0x32')]};if(_0x4a9e1a[_0xa45c('0x54')]){_0x382e2b[_0xa45c('0x54')]={'id':_0x4a9e1a['Trunk']['id'],'name':_0x4a9e1a[_0xa45c('0x54')]['name'],'active':_0x4a9e1a[_0xa45c('0x54')][_0xa45c('0x55')],'callerid':_0x4a9e1a[_0xa45c('0x54')][_0xa45c('0x56')]};}if(_0x4a9e1a[_0xa45c('0x57')]){_0x382e2b['Interval']={'id':_0x4a9e1a[_0xa45c('0x57')]['id'],'name':_0x4a9e1a[_0xa45c('0x57')][_0xa45c('0x4b')]};}var _0x34e179=md5(JSON['stringify'](_0x382e2b));if(_0x4a9e1a[_0xa45c('0x2')]!==_0x34e179){_0x4a9e1a[_0xa45c('0x2')]=_0x34e179;this[_0xa45c('0x41')](util[_0xa45c('0x43')](_0xa45c('0x44'),_0x382e2b[_0xa45c('0x4b')]),_0xa45c('0x58'),_0x382e2b);}}};VoiceQueueReport['prototype']['isNotNull']=function(_0x322d0f){return _0x322d0f!==null&&!_[_0xa45c('0x2e')](_0x322d0f);};VoiceQueueReport[_0xa45c('0xb')][_0xa45c('0x59')]=function(){var _0x35f426=this;setInterval(function(){_0x35f426['clearZombieChannels']();ami[_0xa45c('0x38')]({'action':_0xa45c('0x5a')})[_0xa45c('0x3a')](loggerCatch(_0xa45c('0x5b')));},0x2710);};VoiceQueueReport[_0xa45c('0xb')][_0xa45c('0x2d')]=function(){var _0x2cff9b=this;setInterval(function(){if(_0x2cff9b[_0xa45c('0x13')]){return ami['Action']({'action':_0xa45c('0x15')})[_0xa45c('0x5c')](function(_0x1a1444){_0x2cff9b[_0xa45c('0x13')]=![];})[_0xa45c('0x3a')](loggerCatch(_0xa45c('0x5d')));}},0x3e8);};VoiceQueueReport[_0xa45c('0xb')][_0xa45c('0x16')]=function(_0x34b58e){try{if(this[_0xa45c('0x5e')](_0x34b58e)&&this[_0xa45c('0x5e')](_0x34b58e[_0xa45c('0x5f')])){if(this['voiceQueues'][_0x34b58e[_0xa45c('0x5f')]]){var _0x4acecb=_['countBy'](this[_0xa45c('0x36')],_0xa45c('0x5f'))[_0x34b58e[_0xa45c('0x5f')]]||0x0;var _0x13a888=_0x4acecb-_0x34b58e['callers'];if(this['voiceQueues'][_0x34b58e[_0xa45c('0x5f')]][_0xa45c('0x32')]!==_[_0xa45c('0x60')](_0x34b58e['callers'])||this[_0xa45c('0x12')][_0x34b58e[_0xa45c('0x5f')]][_0xa45c('0x4e')]!==_[_0xa45c('0x60')](_0x34b58e[_0xa45c('0x61')])||this['voiceQueues'][_0x34b58e[_0xa45c('0x5f')]][_0xa45c('0x4d')]!==_[_0xa45c('0x60')](_0x34b58e['available'])||this[_0xa45c('0x12')][_0x34b58e[_0xa45c('0x5f')]][_0xa45c('0x30')]!==_0x13a888){this['voiceQueues'][_0x34b58e[_0xa45c('0x5f')]][_0xa45c('0x32')]=_[_0xa45c('0x60')](_0x34b58e['callers']);this[_0xa45c('0x12')][_0x34b58e['queue']]['loggedIn']=_[_0xa45c('0x60')](_0x34b58e[_0xa45c('0x61')]);this['voiceQueues'][_0x34b58e[_0xa45c('0x5f')]][_0xa45c('0x4d')]=_[_0xa45c('0x60')](_0x34b58e[_0xa45c('0x4d')]);this['voiceQueues'][_0x34b58e[_0xa45c('0x5f')]][_0xa45c('0x30')]=_0x13a888>0x0?_0x13a888:0x0;this[_0xa45c('0x12')][_0x34b58e[_0xa45c('0x5f')]]['talking']=this[_0xa45c('0x12')][_0x34b58e['queue']][_0xa45c('0x30')]>_[_0xa45c('0x60')](_0x34b58e[_0xa45c('0x61')])?_['toNumber'](_0x34b58e['loggedin']):this[_0xa45c('0x12')][_0x34b58e[_0xa45c('0x5f')]][_0xa45c('0x30')];this[_0xa45c('0x49')](this['voiceQueues'][_0x34b58e['queue']]);}ami[_0xa45c('0x41')](_0xa45c('0x62'),this[_0xa45c('0x12')][_0x34b58e['queue']]);}}}catch(_0x483e3a){logger[_0xa45c('0x3c')](_0xa45c('0x63'),util[_0xa45c('0x40')](_0x483e3a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa45c('0xb')][_0xa45c('0x64')]=function(_0x166e5b){this[_0xa45c('0x13')]=!![];};VoiceQueueReport[_0xa45c('0xb')][_0xa45c('0x65')]=function(_0x2f74ef){};VoiceQueueReport[_0xa45c('0xb')][_0xa45c('0x1a')]=function(_0x24d49d){try{if(this[_0xa45c('0x5e')](_0x24d49d)){if(_['isUndefined'](this[_0xa45c('0xf')][_0x24d49d[_0xa45c('0x66')]])){this['queueReports'][_0x24d49d['uniqueid']]=[];this[_0xa45c('0x36')][_0x24d49d['uniqueid']]={};}var _0x2b2f3f=new QueueReport();_0x2b2f3f['name']=_0x24d49d[_0xa45c('0x5f')];_0x2b2f3f[_0xa45c('0x4a')]=this[_0xa45c('0x12')][_0x2b2f3f[_0xa45c('0x4b')]]&&this[_0xa45c('0x12')][_0x2b2f3f[_0xa45c('0x4b')]]['type']?this[_0xa45c('0x12')][_0x2b2f3f['name']]['type']||_0xa45c('0x67'):_0xa45c('0x67');_0x2b2f3f[_0xa45c('0x5f')]=_0x24d49d[_0xa45c('0x5f')];_0x2b2f3f['queuecallerjoinAt']=moment()[_0xa45c('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b2f3f[_0xa45c('0x68')]=_0x24d49d['position'];_0x2b2f3f['count']=_0x24d49d[_0xa45c('0x69')];_[_0xa45c('0x6a')](_0x2b2f3f,_['pick'](_0x24d49d,_[_0xa45c('0x6b')](_0x2b2f3f)));this['queueReports'][_0x24d49d[_0xa45c('0x66')]]['push'](_0x2b2f3f);this[_0xa45c('0x36')][_0x24d49d[_0xa45c('0x66')]]=_0x2b2f3f;this['emitVoiceQueueChannelSave'](_0x2b2f3f);}}catch(_0x26d277){logger[_0xa45c('0x3c')](_0xa45c('0x6c'),util[_0xa45c('0x40')](_0x26d277,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa45c('0xb')][_0xa45c('0x6d')]=function(_0x28afef){try{if(this[_0xa45c('0x5e')](_0x28afef)){if(this[_0xa45c('0xf')][_0x28afef[_0xa45c('0x66')]]){var _0x5d4a9b=_[_0xa45c('0x6e')](this[_0xa45c('0xf')][_0x28afef['uniqueid']]);_0x5d4a9b[_0xa45c('0x6f')]=![];_0x5d4a9b[_0xa45c('0x70')]=null;_0x5d4a9b[_0xa45c('0x71')]=_0x28afef[_0xa45c('0x71')];_0x5d4a9b[_0xa45c('0x72')]=_0x28afef[_0xa45c('0x72')];_0x5d4a9b['queuecallerabandon']=!![];_0x5d4a9b['queuecallerabandonAt']=moment()[_0xa45c('0x43')](_0xa45c('0x73'));_0x5d4a9b['queuecallerexitreason']=_0xa45c('0x74');_0x5d4a9b[_0xa45c('0x75')]=null;this['channels'][_0x28afef[_0xa45c('0x66')]]=_0x5d4a9b;this[_0xa45c('0x76')](_0x5d4a9b);}}}catch(_0x292319){logger[_0xa45c('0x3c')](_0xa45c('0x77'),util[_0xa45c('0x40')](_0x292319,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa45c('0xb')][_0xa45c('0x1d')]=function(_0x57e25d){try{if(this[_0xa45c('0x5e')](_0x57e25d)){if(this[_0xa45c('0xf')][_0x57e25d['uniqueid']]){var _0x5317b2=_[_0xa45c('0x6e')](this['queueReports'][_0x57e25d['uniqueid']]);_0x5317b2[_0xa45c('0x78')]=moment()[_0xa45c('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x5317b2[_0xa45c('0x79')]=_0x57e25d[_0xa45c('0x79')];_0x5317b2[_0xa45c('0x7a')]=_0x57e25d[_0xa45c('0x7a')];this[_0xa45c('0x36')][_0x57e25d[_0xa45c('0x66')]]=_0x5317b2;this[_0xa45c('0x42')](_0x5317b2);}}}catch(_0x49e690){logger[_0xa45c('0x3c')]('[syncQueueCallerLeave][VoiceQueueReport]',util[_0xa45c('0x40')](_0x49e690,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa45c('0xb')][_0xa45c('0x21')]=function(_0x23d842){try{if(this['isNotNull'](_0x23d842)){if(this[_0xa45c('0xf')][_0x23d842['uniqueid']]){var _0x8a28e8=_['last'](this[_0xa45c('0xf')][_0x23d842[_0xa45c('0x66')]]);_0x8a28e8[_0xa45c('0x6f')]=!![];_0x8a28e8[_0xa45c('0x7b')]='COMPLETEDBYAGENT';}}}catch(_0x4e4d4e){logger[_0xa45c('0x3c')]('[syncAgentConnect][VoiceQueueReport]',util[_0xa45c('0x40')](_0x4e4d4e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa45c('0xb')][_0xa45c('0x1f')]=function(_0xe89e7b){try{if(this[_0xa45c('0x5e')](_0xe89e7b)){if(this[_0xa45c('0xf')][_0xe89e7b[_0xa45c('0x66')]]){var _0x310879=_[_0xa45c('0x6e')](this[_0xa45c('0xf')][_0xe89e7b[_0xa45c('0x66')]]);_0x310879[_0xa45c('0x1b')]=![];_0x310879['queuecallerabandonAt']=null;_0x310879[_0xa45c('0x7c')]=!![];_0x310879[_0xa45c('0x75')]=_0xe89e7b['membername'];_0x310879[_0xa45c('0x71')]=_0xe89e7b['holdtime'];_0x310879['queuecallercomplete']=!![];_0x310879['queuecallerexit']=![];_0x310879[_0xa45c('0x7d')]=null;if(!_0x310879['transfer']){if(_0xe89e7b[_0xa45c('0x7e')]==_0xa45c('0x7f')){_0x310879[_0xa45c('0x7b')]=_0xa45c('0x80');}else{if(_[_0xa45c('0x81')](_0xe89e7b['channel']['toLowerCase'](),_0xa45c('0x82'))){if(this['queueReports'][_0xe89e7b[_0xa45c('0x83')]]){var _0x45d09f=_['last'](this[_0xa45c('0xf')][_0xe89e7b[_0xa45c('0x83')]]);_0x45d09f[_0xa45c('0x6f')]=![];_0x45d09f[_0xa45c('0x84')]=!![];_0x45d09f['queuecallerexitAt']=moment(_0x310879[_0xa45c('0x85')])[_0xa45c('0x86')](_0xe89e7b[_0xa45c('0x71')],'seconds')[_0xa45c('0x43')](_0xa45c('0x73'));_0x45d09f[_0xa45c('0x7b')]=_0xa45c('0x87');_0x45d09f[_0xa45c('0x7f')]=!![];_0x45d09f[_0xa45c('0x88')]=_0xa45c('0x89');_0x45d09f[_0xa45c('0x8a')]=_0xe89e7b[_0xa45c('0x8b')];_0x45d09f[_0xa45c('0x8c')]=_0xe89e7b['uniqueid'];var _0x583b77=this['queueReports'][_0xe89e7b[_0xa45c('0x83')]];this[_0xa45c('0xf')][_0xe89e7b[_0xa45c('0x83')]]=this[_0xa45c('0xf')][_0xe89e7b[_0xa45c('0x66')]];this[_0xa45c('0xf')][_0xe89e7b[_0xa45c('0x66')]]=_0x583b77;}}else{_0x310879['queuecallerexitreason']=_0xa45c('0x8d')+_0xe89e7b[_0xa45c('0x7e')][_0xa45c('0x8e')]();}}}this[_0xa45c('0x36')][_0xe89e7b[_0xa45c('0x66')]]=_0x310879;this[_0xa45c('0x76')](_0x310879);}}}catch(_0x553d58){logger[_0xa45c('0x3c')](_0xa45c('0x8f'),util[_0xa45c('0x40')](_0x553d58,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa45c('0xb')][_0xa45c('0x90')]=function(_0xb38177){try{if(this['isNotNull'](_0xb38177)){this[_0xa45c('0x91')](_0xb38177['uniqueid'],_['keys'](_0xb38177['variable'])[0x0],_0xb38177[_0xa45c('0x92')]);if(this[_0xa45c('0xf')][_0xb38177[_0xa45c('0x66')]]){var _0x3453f9=_[_0xa45c('0x6e')](this[_0xa45c('0xf')][_0xb38177[_0xa45c('0x66')]]);if(_0x3453f9){if(this[_0xa45c('0x5e')](_0xb38177['variable'])&&this['isNotNull'](_0xb38177[_0xa45c('0x93')][_0xa45c('0x94')])){switch(_0xb38177[_0xa45c('0x92')]){case'CONTINUE':_0x3453f9[_0xa45c('0x84')]=![];_0x3453f9[_0xa45c('0x7d')]=null;break;case _0xa45c('0x95'):_0x3453f9[_0xa45c('0x96')]='timeout';ami['emit'](_0xa45c('0x97'),_0x3453f9);break;default:_0x3453f9[_0xa45c('0x84')]=!![];_0x3453f9['queuecallerexitAt']=moment()[_0xa45c('0x43')](_0xa45c('0x73'));_0x3453f9['queuecallerleaveAt']=moment()[_0xa45c('0x43')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3453f9['queuecallerabandon']=![];_0x3453f9[_0xa45c('0x98')]=null;_0x3453f9['queuecallerexitreason']=_0xb38177[_0xa45c('0x92')];this[_0xa45c('0x36')][_0xb38177[_0xa45c('0x66')]]=_0x3453f9;this[_0xa45c('0x76')](_0x3453f9);}else if(this[_0xa45c('0x5e')](_0xb38177[_0xa45c('0x93')])&&this[_0xa45c('0x5e')](_0xb38177[_0xa45c('0x93')][_0xa45c('0x99')])){if(!_0x3453f9[_0xa45c('0x1b')]){_0x3453f9['queuecallerexit']=!![];_0x3453f9['queuecallerexitAt']=moment()[_0xa45c('0x43')](_0xa45c('0x73'));_0x3453f9[_0xa45c('0x7b')]=_0xa45c('0x9a');_0x3453f9['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xa45c('0x36')][_0xb38177[_0xa45c('0x66')]]=_0x3453f9;}}_0x3453f9[_0xa45c('0x3d')]=this[_0xa45c('0x3d')][_0xb38177[_0xa45c('0x66')]];}}}}catch(_0x17af66){logger['error'](_0xa45c('0x9b'),util[_0xa45c('0x40')](_0x17af66,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa45c('0xb')]['addVariable']=function(_0x1ea76f,_0x378487,_0x454253){var _0x585991=['rtpaudioqos',_0xa45c('0x9c'),_0xa45c('0x9d'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0xa45c('0x9e'),_0xa45c('0x9f'),_0xa45c('0xa0'),_0xa45c('0xa1'),_0xa45c('0xa2'),_0xa45c('0xa3'),'bridgepvtcallid',_0xa45c('0xa4'),'memberdynamic','memberinterface',_0xa45c('0xa5'),_0xa45c('0xa6'),_0xa45c('0xa7'),_0xa45c('0xa8')];if(!_['isNil'](_0x378487)&&!_[_0xa45c('0xa9')](_0x585991,_0x378487)){if(_[_0xa45c('0x2e')](this[_0xa45c('0x3d')][_0x1ea76f])){this[_0xa45c('0x3d')][_0x1ea76f]={};}this['variables'][_0x1ea76f][_0x378487]=_0x454253;}};VoiceQueueReport['prototype'][_0xa45c('0xaa')]=function(_0x5cf5f1){try{if(this[_0xa45c('0x5e')](_0x5cf5f1)){if(this[_0xa45c('0xf')][_0x5cf5f1['uniqueid']]){for(var _0x26ba9a=0x0,_0x1e2cee={};_0x26ba9a0x0?_0x4e5ff4:0x0;this[_0x16d7('0x13')][_0x4d89c2[_0x16d7('0x5d')]][_0x16d7('0x4e')]=this[_0x16d7('0x13')][_0x4d89c2[_0x16d7('0x5d')]]['talking']>_[_0x16d7('0x60')](_0x4d89c2[_0x16d7('0x61')])?_[_0x16d7('0x60')](_0x4d89c2[_0x16d7('0x61')]):this[_0x16d7('0x13')][_0x4d89c2[_0x16d7('0x5d')]][_0x16d7('0x4e')];this[_0x16d7('0x44')](this[_0x16d7('0x13')][_0x4d89c2['queue']]);}ami[_0x16d7('0x3c')]('custom:queuesummary',this[_0x16d7('0x13')][_0x4d89c2[_0x16d7('0x5d')]]);}}}catch(_0x5c5ca8){logger[_0x16d7('0x37')](_0x16d7('0x62'),util[_0x16d7('0x63')](_0x5c5ca8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x16d7('0xa')]['syncQueueSummaryComplete']=function(_0x1e0f68){this[_0x16d7('0x14')]=!![];};VoiceQueueReport[_0x16d7('0xa')][_0x16d7('0x64')]=function(_0x22ce0c){};VoiceQueueReport[_0x16d7('0xa')][_0x16d7('0x65')]=function(_0x20a6b0){try{if(this['isNotNull'](_0x20a6b0)){if(_[_0x16d7('0x57')](this['queueReports'][_0x20a6b0['uniqueid']])){this[_0x16d7('0xf')][_0x20a6b0[_0x16d7('0x66')]]=[];this[_0x16d7('0x11')][_0x20a6b0[_0x16d7('0x66')]]={};}var _0x578714=new QueueReport();_0x578714[_0x16d7('0x3f')]=_0x20a6b0[_0x16d7('0x5d')];_0x578714['type']=this[_0x16d7('0x13')][_0x578714[_0x16d7('0x3f')]]&&this[_0x16d7('0x13')][_0x578714['name']][_0x16d7('0x45')]?this['voiceQueues'][_0x578714[_0x16d7('0x3f')]][_0x16d7('0x45')]||_0x16d7('0x46'):_0x16d7('0x46');_0x578714['queue']=_0x20a6b0[_0x16d7('0x5d')];_0x578714[_0x16d7('0x67')]=moment()['format'](_0x16d7('0x68'));_0x578714[_0x16d7('0x69')]=_0x20a6b0[_0x16d7('0x69')];_0x578714[_0x16d7('0x6a')]=_0x20a6b0[_0x16d7('0x6a')];_[_0x16d7('0x6b')](_0x578714,_[_0x16d7('0x6c')](_0x20a6b0,_['keys'](_0x578714)));this['queueReports'][_0x20a6b0[_0x16d7('0x66')]]['push'](_0x578714);this['channels'][_0x20a6b0[_0x16d7('0x66')]]=_0x578714;this[_0x16d7('0x3d')](_0x578714);}}catch(_0x5b8818){logger['error'](_0x16d7('0x6d'),util[_0x16d7('0x63')](_0x5b8818,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x16d7('0x1b')]=function(_0x43866d){try{if(this['isNotNull'](_0x43866d)){if(this['queueReports'][_0x43866d[_0x16d7('0x66')]]){var _0x19ebd6=_[_0x16d7('0x6e')](this[_0x16d7('0xf')][_0x43866d[_0x16d7('0x66')]]);_0x19ebd6[_0x16d7('0x6f')]=![];_0x19ebd6[_0x16d7('0x70')]=null;_0x19ebd6['holdtime']=_0x43866d[_0x16d7('0x71')];_0x19ebd6[_0x16d7('0x72')]=_0x43866d[_0x16d7('0x72')];_0x19ebd6[_0x16d7('0x1a')]=!![];_0x19ebd6['queuecallerabandonAt']=moment()[_0x16d7('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');_0x19ebd6['queuecallerexitreason']=_0x16d7('0x73');_0x19ebd6[_0x16d7('0x74')]=null;this[_0x16d7('0x11')][_0x43866d[_0x16d7('0x66')]]=_0x19ebd6;this['emitVoiceQueueChannelRemove'](_0x19ebd6);}}}catch(_0x1f474b){logger[_0x16d7('0x37')](_0x16d7('0x75'),util['inspect'](_0x1f474b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x16d7('0xa')]['syncQueueCallerLeave']=function(_0x4fcb7e){try{if(this[_0x16d7('0x56')](_0x4fcb7e)){if(this['queueReports'][_0x4fcb7e['uniqueid']]){var _0x226453=_[_0x16d7('0x6e')](this[_0x16d7('0xf')][_0x4fcb7e[_0x16d7('0x66')]]);_0x226453[_0x16d7('0x76')]=moment()[_0x16d7('0x3e')](_0x16d7('0x68'));_0x226453[_0x16d7('0x77')]=_0x4fcb7e[_0x16d7('0x77')];_0x226453[_0x16d7('0x78')]=_0x4fcb7e['connectedlinename'];this['channels'][_0x4fcb7e[_0x16d7('0x66')]]=_0x226453;this[_0x16d7('0x3d')](_0x226453);}}}catch(_0x391cd8){logger[_0x16d7('0x37')](_0x16d7('0x79'),util[_0x16d7('0x63')](_0x391cd8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x16d7('0x20')]=function(_0x4b6720){try{if(this[_0x16d7('0x56')](_0x4b6720)){if(this[_0x16d7('0xf')][_0x4b6720[_0x16d7('0x66')]]){var _0x8a2db1=_[_0x16d7('0x6e')](this['queueReports'][_0x4b6720[_0x16d7('0x66')]]);_0x8a2db1[_0x16d7('0x6f')]=!![];_0x8a2db1[_0x16d7('0x7a')]=_0x16d7('0x7b');}}}catch(_0x27803b){logger[_0x16d7('0x37')](_0x16d7('0x7c'),util[_0x16d7('0x63')](_0x27803b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x16d7('0xa')]['syncAgentComplete']=function(_0x8f8b42){try{if(this[_0x16d7('0x56')](_0x8f8b42)){if(this[_0x16d7('0xf')][_0x8f8b42[_0x16d7('0x66')]]){var _0x444897=_[_0x16d7('0x6e')](this[_0x16d7('0xf')][_0x8f8b42['uniqueid']]);_0x444897[_0x16d7('0x1a')]=![];_0x444897[_0x16d7('0x7d')]=null;_0x444897[_0x16d7('0x7e')]=!![];_0x444897['lastAssignedTo']=_0x8f8b42[_0x16d7('0x7f')];_0x444897['holdtime']=_0x8f8b42[_0x16d7('0x71')];_0x444897[_0x16d7('0x6f')]=!![];_0x444897[_0x16d7('0x80')]=![];_0x444897[_0x16d7('0x81')]=null;if(!_0x444897[_0x16d7('0x82')]){if(_0x8f8b42['reason']==_0x16d7('0x82')){_0x444897[_0x16d7('0x7a')]=_0x16d7('0x83');}else{if(_[_0x16d7('0x84')](_0x8f8b42[_0x16d7('0x85')][_0x16d7('0x86')](),'local/')){if(this[_0x16d7('0xf')][_0x8f8b42[_0x16d7('0x87')]]){var _0x329be4=_[_0x16d7('0x6e')](this[_0x16d7('0xf')][_0x8f8b42[_0x16d7('0x87')]]);_0x329be4['queuecallercomplete']=![];_0x329be4[_0x16d7('0x80')]=!![];_0x329be4[_0x16d7('0x81')]=moment(_0x444897[_0x16d7('0x67')])[_0x16d7('0x88')](_0x8f8b42['holdtime'],_0x16d7('0x89'))['format'](_0x16d7('0x68'));_0x329be4[_0x16d7('0x7a')]=_0x16d7('0x8a');_0x329be4['transfer']=!![];_0x329be4['transfertype']=_0x16d7('0x8b');_0x329be4[_0x16d7('0x8c')]=_0x8f8b42['destexten'];_0x329be4[_0x16d7('0x8d')]=_0x8f8b42[_0x16d7('0x66')];var _0x192ac6=this[_0x16d7('0xf')][_0x8f8b42['linkedid']];this[_0x16d7('0xf')][_0x8f8b42[_0x16d7('0x87')]]=this[_0x16d7('0xf')][_0x8f8b42[_0x16d7('0x66')]];this[_0x16d7('0xf')][_0x8f8b42[_0x16d7('0x66')]]=_0x192ac6;}}else{_0x444897['queuecallerexitreason']='COMPLETEDBY'+_0x8f8b42['reason']['toUpperCase']();}}}this[_0x16d7('0x11')][_0x8f8b42[_0x16d7('0x66')]]=_0x444897;this[_0x16d7('0x3b')](_0x444897);}}}catch(_0x407c05){logger['error'](_0x16d7('0x8e'),util[_0x16d7('0x63')](_0x407c05,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x16d7('0x8f')]=function(_0x4c9adf){try{if(this[_0x16d7('0x56')](_0x4c9adf)){this['addVariable'](_0x4c9adf[_0x16d7('0x66')],_[_0x16d7('0x90')](_0x4c9adf['variable'])[0x0],_0x4c9adf[_0x16d7('0x91')]);if(this[_0x16d7('0xf')][_0x4c9adf[_0x16d7('0x66')]]){var _0x4f1449=_['last'](this[_0x16d7('0xf')][_0x4c9adf[_0x16d7('0x66')]]);if(_0x4f1449){if(this[_0x16d7('0x56')](_0x4c9adf['variable'])&&this[_0x16d7('0x56')](_0x4c9adf[_0x16d7('0x92')][_0x16d7('0x93')])){switch(_0x4c9adf[_0x16d7('0x91')]){case'CONTINUE':_0x4f1449[_0x16d7('0x80')]=![];_0x4f1449[_0x16d7('0x81')]=null;break;case _0x16d7('0x94'):_0x4f1449[_0x16d7('0x95')]='timeout';ami[_0x16d7('0x3c')](_0x16d7('0x96'),_0x4f1449);break;default:_0x4f1449[_0x16d7('0x80')]=!![];_0x4f1449[_0x16d7('0x81')]=moment()[_0x16d7('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f1449['queuecallerleaveAt']=moment()[_0x16d7('0x3e')](_0x16d7('0x68'));}_0x4f1449[_0x16d7('0x1a')]=![];_0x4f1449[_0x16d7('0x7d')]=null;_0x4f1449[_0x16d7('0x7a')]=_0x4c9adf['value'];this['channels'][_0x4c9adf[_0x16d7('0x66')]]=_0x4f1449;this[_0x16d7('0x3b')](_0x4f1449);}else if(this[_0x16d7('0x56')](_0x4c9adf[_0x16d7('0x92')])&&this[_0x16d7('0x56')](_0x4c9adf['variable']['queueposition'])){if(!_0x4f1449['queuecallerabandon']){_0x4f1449[_0x16d7('0x80')]=!![];_0x4f1449[_0x16d7('0x81')]=moment()[_0x16d7('0x3e')](_0x16d7('0x68'));_0x4f1449['queuecallerexitreason']=_0x16d7('0x97');_0x4f1449['queuecallerleaveAt']=moment()[_0x16d7('0x3e')](_0x16d7('0x68'));this[_0x16d7('0x11')][_0x4c9adf[_0x16d7('0x66')]]=_0x4f1449;}}_0x4f1449[_0x16d7('0x38')]=this[_0x16d7('0x38')][_0x4c9adf[_0x16d7('0x66')]];}}}}catch(_0x4ccea6){logger['error']('[syncVarSet][VoiceQueueReport]',util[_0x16d7('0x63')](_0x4ccea6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x16d7('0xa')][_0x16d7('0x98')]=function(_0x2318f9,_0x1ef99c,_0xf13fd1){var _0x2aa2e9=[_0x16d7('0x99'),_0x16d7('0x9a'),_0x16d7('0x9b'),_0x16d7('0x9c'),_0x16d7('0x9d'),_0x16d7('0x9e'),'rtpaudioqosrtt',_0x16d7('0x9f'),_0x16d7('0xa0'),_0x16d7('0xa1'),_0x16d7('0xa2'),'bridgepvtcallid',_0x16d7('0xa3'),_0x16d7('0xa4'),_0x16d7('0xa5'),_0x16d7('0xa6'),_0x16d7('0x7f'),_0x16d7('0xa7'),'memberrealtime'];if(!_['isNil'](_0x1ef99c)&&!_['includes'](_0x2aa2e9,_0x1ef99c)){if(_[_0x16d7('0x57')](this[_0x16d7('0x38')][_0x2318f9])){this[_0x16d7('0x38')][_0x2318f9]={};}this[_0x16d7('0x38')][_0x2318f9][_0x1ef99c]=_0xf13fd1;}};VoiceQueueReport[_0x16d7('0xa')][_0x16d7('0x23')]=function(_0x2cc369){try{if(this['isNotNull'](_0x2cc369)){if(this[_0x16d7('0xf')][_0x2cc369['uniqueid']]){for(var _0x474b29=0x0,_0xbb81ff={};_0x474b29=0x0?moment(_0x19135e[_0x519b('0x19')])[_0x519b('0xe')](_0x19135e['starttime'],_0x519b('0x1a')):null,'data1':_0x519b('0x1b'),'data2':_0x19135e[_0x519b('0x14')],'data3':_0x19135e[_0x519b('0x11')],'data4':_0x19135e[_0x519b('0x1c')]||null,'role':_0x519b('0x13'),'internal':_0x19135e[_0x519b('0x14')]?_[_0x519b('0x1d')](_0x19135e[_0x519b('0x14')]):undefined,'uniqueid':_0x19135e[_0x519b('0x15')]},'log':_0x519b('0x6')});}; \ No newline at end of file +var _0x18b3=['isNil','interface','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','exten','accountcode','uniqueid','voiceDialReport','membername','endtime','starttime','agent','toNumber','moment','lodash','util','queuecallercompleteAt','Request','CreateMemberReport','lastAssignedTo'];(function(_0x442e39,_0x2ccfb1){var _0x3dfb30=function(_0x40eaf6){while(--_0x40eaf6){_0x442e39['push'](_0x442e39['shift']());}};_0x3dfb30(++_0x2ccfb1);}(_0x18b3,0x131));var _0x318b=function(_0x49e88b,_0xd3800){_0x49e88b=_0x49e88b-0x0;var _0x4453ef=_0x18b3[_0x49e88b];return _0x4453ef;};'use strict';var moment=require(_0x318b('0x0'));var _=require(_0x318b('0x1'));var util=require(_0x318b('0x2'));var client=require('../client');exports['voiceQueueReport']=function(_0x4d4614){var _0x1d4f66=_0x4d4614[_0x318b('0x3')]||_0x4d4614['queuecallerexitAt'];return client[_0x318b('0x4')](_0x318b('0x5'),{'body':{'channel':'voice','membername':_0x4d4614[_0x318b('0x6')],'interface':_[_0x318b('0x7')](_0x4d4614[_0x318b('0x8')])?util['format'](_0x318b('0x9'),_0x4d4614[_0x318b('0x6')]):_0x4d4614[_0x318b('0x8')],'type':_0x318b('0xa'),'enterAt':_0x4d4614[_0x318b('0xb')],'exitAt':_0x1d4f66,'duration':moment(_0x1d4f66)[_0x318b('0xc')](_0x4d4614[_0x318b('0xb')],_0x318b('0xd')),'data1':_0x318b('0xe'),'data2':_0x4d4614['calleridnum'],'data3':_0x4d4614[_0x318b('0xf')],'data4':null,'data5':_0x4d4614['queue'],'role':'agent','internal':_0x4d4614['accountcode']?_['toNumber'](_0x4d4614[_0x318b('0x10')]):undefined,'uniqueid':_0x4d4614[_0x318b('0x11')]},'log':_0x318b('0x5')});};exports[_0x318b('0x12')]=function(_0x2b9991){return client['Request'](_0x318b('0x5'),{'body':{'channel':'voice','membername':_0x2b9991[_0x318b('0x13')],'interface':_0x2b9991[_0x318b('0x8')],'type':_0x318b('0xa'),'enterAt':_0x2b9991['starttime'],'exitAt':_0x2b9991[_0x318b('0x14')],'duration':moment(_0x2b9991[_0x318b('0x14')])[_0x318b('0xc')](_0x2b9991['starttime'],'seconds')>=0x0?moment(_0x2b9991[_0x318b('0x14')])[_0x318b('0xc')](_0x2b9991[_0x318b('0x15')],_0x318b('0xd')):null,'data1':'outbound','data2':_0x2b9991[_0x318b('0x10')],'data3':_0x2b9991[_0x318b('0xf')],'data4':_0x2b9991['dialstring']||null,'role':_0x318b('0x16'),'internal':_0x2b9991['accountcode']?_[_0x318b('0x17')](_0x2b9991[_0x318b('0x10')]):undefined,'uniqueid':_0x2b9991['uniqueid']},'log':_0x318b('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index a36be47..6a2c497 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 _0xd8b0=['GetTemplate','name','html','../client','getTemplates'];(function(_0x4ff735,_0x35b9f5){var _0x44213e=function(_0x42da75){while(--_0x42da75){_0x4ff735['push'](_0x4ff735['shift']());}};_0x44213e(++_0x35b9f5);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(_0x5a55a3){return function(_0x585166){return client['Request'](_0x0d8b('0x2'),{'options':{'raw':!![],'attributes':['id',_0x0d8b('0x3'),_0x0d8b('0x4')]},'log':_0x0d8b('0x2')});};}; \ No newline at end of file +var _0x6324=['GetTemplate','html','../client','getTemplates'];(function(_0x44bbfa,_0x47bdd7){var _0xdf3345=function(_0x5bfb33){while(--_0x5bfb33){_0x44bbfa['push'](_0x44bbfa['shift']());}};_0xdf3345(++_0x47bdd7);}(_0x6324,0x142));var _0x4632=function(_0x5bf79a,_0x2eaa1d){_0x5bf79a=_0x5bf79a-0x0;var _0x3ff10f=_0x6324[_0x5bf79a];return _0x3ff10f;};'use strict';var client=require(_0x4632('0x0'));exports[_0x4632('0x1')]=function(_0xb0927d){return function(_0x2fc528){return client['Request'](_0x4632('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x4632('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 422794b..905b3c1 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 _0xd300=['data6','GetTrigger','getTriggers','channel','status','AllConditions','field','operator','value','Condition','AnyConditions','Actions','action','data1','data2','data3','data4','data5'];(function(_0x47f00c,_0x522316){var _0x28764e=function(_0x105d2e){while(--_0x105d2e){_0x47f00c['push'](_0x47f00c['shift']());}};_0x28764e(++_0x522316);}(_0xd300,0x17c));var _0x0d30=function(_0x4bb1a0,_0x532425){_0x4bb1a0=_0x4bb1a0-0x0;var _0xff27b1=_0xd300[_0x4bb1a0];return _0xff27b1;};'use strict';var client=require('../client');exports[_0x0d30('0x0')]=function(_0x34a2d1){return function(_0x406792){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0x0d30('0x1'),_0x0d30('0x2')],'include':[{'model':'Condition','as':_0x0d30('0x3'),'attributes':['id',_0x0d30('0x4'),_0x0d30('0x5'),_0x0d30('0x6')]},{'model':_0x0d30('0x7'),'as':_0x0d30('0x8'),'attributes':['id',_0x0d30('0x4'),_0x0d30('0x5'),_0x0d30('0x6')]},{'model':'Action','as':_0x0d30('0x9'),'attributes':['id',_0x0d30('0xa'),_0x0d30('0xb'),_0x0d30('0xc'),_0x0d30('0xd'),_0x0d30('0xe'),_0x0d30('0xf'),_0x0d30('0x10'),'data7']}]},'log':_0x0d30('0x11')});};}; \ No newline at end of file +var _0x7136=['data4','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','field','operator','value','Condition','Action','Actions','data1','data2','data3'];(function(_0xbd350c,_0x2739ca){var _0x409793=function(_0x5773f5){while(--_0x5773f5){_0xbd350c['push'](_0xbd350c['shift']());}};_0x409793(++_0x2739ca);}(_0x7136,0xc1));var _0x6713=function(_0x289842,_0x2d9db4){_0x289842=_0x289842-0x0;var _0x16155a=_0x7136[_0x289842];return _0x16155a;};'use strict';var client=require(_0x6713('0x0'));exports[_0x6713('0x1')]=function(_0x57b68e){return function(_0x27e870){return client[_0x6713('0x2')](_0x6713('0x3'),{'options':{'raw':![],'attributes':['id',_0x6713('0x4'),_0x6713('0x5'),_0x6713('0x6')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0x6713('0x7'),_0x6713('0x8'),_0x6713('0x9')]},{'model':_0x6713('0xa'),'as':'AnyConditions','attributes':['id',_0x6713('0x7'),_0x6713('0x8'),_0x6713('0x9')]},{'model':_0x6713('0xb'),'as':_0x6713('0xc'),'attributes':['id','action',_0x6713('0xd'),_0x6713('0xe'),_0x6713('0xf'),_0x6713('0x10'),'data5',_0x6713('0x11'),_0x6713('0x12')]}]},'log':_0x6713('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 2a1afa1..e0fdcf8 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 _0x9383=['Request','GetTrunk','name','registry','getTrunks'];(function(_0x37a606,_0x4089e1){var _0x414f66=function(_0x1a2357){while(--_0x1a2357){_0x37a606['push'](_0x37a606['shift']());}};_0x414f66(++_0x4089e1);}(_0x9383,0x18f));var _0x3938=function(_0x1486cd,_0x47b17d){_0x1486cd=_0x1486cd-0x0;var _0x330594=_0x9383[_0x1486cd];return _0x330594;};'use strict';var client=require('../client');exports[_0x3938('0x0')]=function(_0xe8f9a){return function(_0x137a5c){return client[_0x3938('0x1')](_0x3938('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3938('0x3'),_0x3938('0x4')]},'log':_0x3938('0x2')});};}; \ No newline at end of file +var _0x4639=['getTrunks','Request','GetTrunk','name','registry','../client'];(function(_0x758c23,_0x387f5a){var _0x5db12b=function(_0x534722){while(--_0x534722){_0x758c23['push'](_0x758c23['shift']());}};_0x5db12b(++_0x387f5a);}(_0x4639,0xe3));var _0x9463=function(_0x31edbe,_0x34d231){_0x31edbe=_0x31edbe-0x0;var _0x37fcee=_0x4639[_0x31edbe];return _0x37fcee;};'use strict';var client=require(_0x9463('0x0'));exports[_0x9463('0x1')]=function(_0x356969){return function(_0x5de335){return client[_0x9463('0x2')](_0x9463('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x9463('0x4'),_0x9463('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 934128c..9a7c42e 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 _0x4ef8=['online','lastPauseAt','../client','getAgents','Request','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getTelephones','GetUser','telephone','internal','savePause','saveUnpause','UnpauseUser','getAgent','ShowUser','email'];(function(_0x550308,_0x1bfc37){var _0x306837=function(_0x4e7cb2){while(--_0x4e7cb2){_0x550308['push'](_0x550308['shift']());}};_0x306837(++_0x1bfc37);}(_0x4ef8,0x92));var _0x84ef=function(_0x224ded,_0x1b2757){_0x224ded=_0x224ded-0x0;var _0x3f2c61=_0x4ef8[_0x224ded];return _0x3f2c61;};'use strict';var client=require(_0x84ef('0x0'));exports[_0x84ef('0x1')]=function(){return function(){return client[_0x84ef('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x84ef('0x3')},'attributes':['id',_0x84ef('0x4'),'email',_0x84ef('0x5'),_0x84ef('0x6'),'online',_0x84ef('0x7'),_0x84ef('0x8'),'lastPauseAt',_0x84ef('0x9'),_0x84ef('0xa'),'mobile',_0x84ef('0xb')]},'log':'getAgents'});};};exports[_0x84ef('0xc')]=function(){return function(){return client[_0x84ef('0x2')](_0x84ef('0xd'),{'options':{'raw':!![],'where':{'role':_0x84ef('0xe')},'attributes':['id',_0x84ef('0x4'),_0x84ef('0x5'),_0x84ef('0xf')]},'log':_0x84ef('0xc')});};};exports[_0x84ef('0x10')]=function(_0x462954,_0x4a5e81,_0x3706e8){return client[_0x84ef('0x2')]('PauseUser',{'body':{'type':_0x4a5e81,'uniqueid':_0x3706e8},'options':{'where':{'id':_0x462954['id']}},'log':_0x84ef('0x10')});};exports[_0x84ef('0x11')]=function(_0x19feb0){return client['Request'](_0x84ef('0x12'),{'body':{},'options':{'where':{'id':_0x19feb0['id']}},'log':_0x84ef('0x10')});};exports[_0x84ef('0x13')]=function(_0x435d01){return client[_0x84ef('0x2')](_0x84ef('0x14'),{'options':{'raw':![],'where':{'role':_0x84ef('0x3'),'id':_0x435d01},'attributes':['id',_0x84ef('0x4'),_0x84ef('0x15'),'accountcode','fullname',_0x84ef('0x16'),_0x84ef('0x7'),_0x84ef('0x8'),_0x84ef('0x17'),_0x84ef('0x9'),_0x84ef('0xb')]},'log':'getAgent'});}; \ No newline at end of file +var _0xd1bb=['voicePause','phone','mobile','interface','getTelephones','GetUser','PauseUser','savePause','UnpauseUser','getAgent','ShowUser','agent','email','online','../client','getAgents','Request','name','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt'];(function(_0x78eba8,_0x4c2a48){var _0x4aed64=function(_0x3857d7){while(--_0x3857d7){_0x78eba8['push'](_0x78eba8['shift']());}};_0x4aed64(++_0x4c2a48);}(_0xd1bb,0x1ac));var _0xbd1b=function(_0xee613e,_0x5606dc){_0xee613e=_0xee613e-0x0;var _0x55c739=_0xd1bb[_0xee613e];return _0x55c739;};'use strict';var client=require(_0xbd1b('0x0'));exports[_0xbd1b('0x1')]=function(){return function(){return client[_0xbd1b('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0xbd1b('0x3'),'email',_0xbd1b('0x4'),_0xbd1b('0x5'),'online',_0xbd1b('0x6'),_0xbd1b('0x7'),_0xbd1b('0x8'),_0xbd1b('0x9'),_0xbd1b('0xa'),_0xbd1b('0xb'),_0xbd1b('0xc')]},'log':'getAgents'});};};exports[_0xbd1b('0xd')]=function(){return function(){return client[_0xbd1b('0x2')](_0xbd1b('0xe'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0xbd1b('0x3'),_0xbd1b('0x4'),'internal']},'log':_0xbd1b('0xd')});};};exports['savePause']=function(_0x57c6f1,_0x1d49a2,_0x252d48){return client[_0xbd1b('0x2')](_0xbd1b('0xf'),{'body':{'type':_0x1d49a2,'uniqueid':_0x252d48},'options':{'where':{'id':_0x57c6f1['id']}},'log':_0xbd1b('0x10')});};exports['saveUnpause']=function(_0xb50ae5){return client['Request'](_0xbd1b('0x11'),{'body':{},'options':{'where':{'id':_0xb50ae5['id']}},'log':_0xbd1b('0x10')});};exports[_0xbd1b('0x12')]=function(_0x4ded29){return client[_0xbd1b('0x2')](_0xbd1b('0x13'),{'options':{'raw':![],'where':{'role':_0xbd1b('0x14'),'id':_0x4ded29},'attributes':['id','name',_0xbd1b('0x15'),_0xbd1b('0x4'),_0xbd1b('0x5'),_0xbd1b('0x16'),_0xbd1b('0x6'),_0xbd1b('0x7'),'lastPauseAt',_0xbd1b('0x9'),_0xbd1b('0xc')]},'log':_0xbd1b('0x12')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 243632b..b306ad2 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 _0x521c=['update','UpdateVoiceAgentReport','create','Request','CreateVoiceAgentReport'];(function(_0x464569,_0x45410c){var _0xe2adca=function(_0x1b9858){while(--_0x1b9858){_0x464569['push'](_0x464569['shift']());}};_0xe2adca(++_0x45410c);}(_0x521c,0x6b));var _0xc521=function(_0x12a8f9,_0x3eadec){_0x12a8f9=_0x12a8f9-0x0;var _0x5a6304=_0x521c[_0x12a8f9];return _0x5a6304;};'use strict';var client=require('../client');exports[_0xc521('0x0')]=function(_0x39ec13){return client[_0xc521('0x1')]('CreateVoiceAgentReport',{'body':_0x39ec13,'log':_0xc521('0x2')});};exports[_0xc521('0x3')]=function(_0x542800,_0x4be45c,_0x20e07b){return client[_0xc521('0x1')](_0xc521('0x4'),{'body':_0x542800,'options':{'where':{'uniqueid':_0x4be45c,'interface':_0x20e07b,'agentcomplete':!![]}},'log':_0xc521('0x4')});}; \ No newline at end of file +var _0xd5f1=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x4d2c18,_0x1ce437){var _0x55f226=function(_0x361c6a){while(--_0x361c6a){_0x4d2c18['push'](_0x4d2c18['shift']());}};_0x55f226(++_0x1ce437);}(_0xd5f1,0x91));var _0x1d5f=function(_0x269e6b,_0x5bf136){_0x269e6b=_0x269e6b-0x0;var _0x408b6d=_0xd5f1[_0x269e6b];return _0x408b6d;};'use strict';var client=require(_0x1d5f('0x0'));exports[_0x1d5f('0x1')]=function(_0x179142){return client[_0x1d5f('0x2')](_0x1d5f('0x3'),{'body':_0x179142,'log':_0x1d5f('0x3')});};exports[_0x1d5f('0x4')]=function(_0x1dca7c,_0x280436,_0x4fa954){return client['Request']('UpdateVoiceAgentReport',{'body':_0x1dca7c,'options':{'where':{'uniqueid':_0x280436,'interface':_0x4fa954,'agentcomplete':!![]}},'log':_0x1d5f('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 60ba71b..75fc856 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 _0xd7d8=['billableseconds','GetVoiceCallReports','moment','util','create','Request','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration'];(function(_0x29b915,_0x25673a){var _0x28e294=function(_0x1de2b6){while(--_0x1de2b6){_0x29b915['push'](_0x29b915['shift']());}};_0x28e294(++_0x25673a);}(_0xd7d8,0x142));var _0x8d7d=function(_0x6c8d7e,_0x42f30f){_0x6c8d7e=_0x6c8d7e-0x0;var _0x1a679b=_0xd7d8[_0x6c8d7e];return _0x1a679b;};'use strict';var moment=require(_0x8d7d('0x0'));var util=require(_0x8d7d('0x1'));var _=require('lodash');var client=require('../client');exports[_0x8d7d('0x2')]=function(_0xb43f20){return client[_0x8d7d('0x3')](_0x8d7d('0x4'),{'body':_[_0x8d7d('0x5')](_0xb43f20,{'source':_0xb43f20[_0x8d7d('0x6')],'destinationcontext':_0xb43f20[_0x8d7d('0x7')],'callerid':_0xb43f20['callerid'],'amaflags':_0x8d7d('0x8')}),'log':_0x8d7d('0x4')});};exports[_0x8d7d('0x9')]=function(){return function(){return client['Request'](_0x8d7d('0xa'),{'options':{'where':{'type':[_0x8d7d('0xb')],'createdAt':{'$between':[moment()['startOf'](_0x8d7d('0xc'))[_0x8d7d('0xd')](_0x8d7d('0xe')),moment()[_0x8d7d('0xf')](_0x8d7d('0xc'))['format'](_0x8d7d('0xe'))]}},'attributes':['type',_0x8d7d('0x10'),_0x8d7d('0x11'),_0x8d7d('0x12')]},'log':_0x8d7d('0x13')});};}; \ No newline at end of file +var _0x1cd1=['startOf','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','lodash','../client','Request','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport'];(function(_0x1bcbf7,_0x31bf2a){var _0x4aeb5b=function(_0x113ee2){while(--_0x113ee2){_0x1bcbf7['push'](_0x1bcbf7['shift']());}};_0x4aeb5b(++_0x31bf2a);}(_0x1cd1,0x184));var _0x11cd=function(_0x33883c,_0x54a6b7){_0x33883c=_0x33883c-0x0;var _0x318eec=_0x1cd1[_0x33883c];return _0x318eec;};'use strict';var moment=require(_0x11cd('0x0'));var util=require('util');var _=require(_0x11cd('0x1'));var client=require(_0x11cd('0x2'));exports['create']=function(_0x266fa7){return client[_0x11cd('0x3')](_0x11cd('0x4'),{'body':_['merge'](_0x266fa7,{'source':_0x266fa7[_0x11cd('0x5')],'destinationcontext':_0x266fa7[_0x11cd('0x6')],'callerid':_0x266fa7[_0x11cd('0x7')],'amaflags':_0x11cd('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0x11cd('0x9')]=function(){return function(){return client[_0x11cd('0x3')](_0x11cd('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x11cd('0xb')]('day')[_0x11cd('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf']('day')['format'](_0x11cd('0xd'))]}},'attributes':[_0x11cd('0xe'),_0x11cd('0xf'),_0x11cd('0x10'),_0x11cd('0x11')]},'log':_0x11cd('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 615717c..3056201 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 _0x1263=['create','CreateVoiceDialReport','../client'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x1263,0x1b8));var _0x3126=function(_0xeb5b67,_0x5d48a2){_0xeb5b67=_0xeb5b67-0x0;var _0x218f26=_0x1263[_0xeb5b67];return _0x218f26;};'use strict';var client=require(_0x3126('0x0'));exports[_0x3126('0x1')]=function(_0x3f9355){return client['Request'](_0x3126('0x2'),{'body':_0x3f9355,'log':_0x3126('0x2')});}; \ No newline at end of file +var _0x971c=['CreateVoiceDialReport','../client'];(function(_0x10d670,_0x178996){var _0x20d6f8=function(_0x4a4b87){while(--_0x4a4b87){_0x10d670['push'](_0x10d670['shift']());}};_0x20d6f8(++_0x178996);}(_0x971c,0xab));var _0xc971=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x971c[_0x55f8b4];return _0x2475f9;};'use strict';var client=require(_0xc971('0x0'));exports['create']=function(_0x314bca){return client['Request']('CreateVoiceDialReport',{'body':_0x314bca,'log':_0xc971('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 028722f..1319a5d 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 _0x09ef=['exten','recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x2fa7ca,_0x552a3f){var _0xd8d4ff=function(_0x5b8975){while(--_0x5b8975){_0x2fa7ca['push'](_0x2fa7ca['shift']());}};_0xd8d4ff(++_0x552a3f);}(_0x09ef,0x15e));var _0xf09e=function(_0x3093ed,_0x678791){_0x3093ed=_0x3093ed-0x0;var _0x5cefec=_0x09ef[_0x3093ed];return _0x5cefec;};'use strict';var client=require(_0xf09e('0x0'));exports[_0xf09e('0x1')]=function(){return function(){return client[_0xf09e('0x2')](_0xf09e('0x3'),{'options':{'raw':!![],'attributes':['id',_0xf09e('0x4'),_0xf09e('0x5')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x0b41=['getVoiceExtensions','../client','Request','GetVoiceExtension','recordingFormat'];(function(_0x58ceb9,_0x5601df){var _0x3d0ff5=function(_0x3a79d0){while(--_0x3a79d0){_0x58ceb9['push'](_0x58ceb9['shift']());}};_0x3d0ff5(++_0x5601df);}(_0x0b41,0x6a));var _0x10b4=function(_0x3b6471,_0x4ea6b4){_0x3b6471=_0x3b6471-0x0;var _0xc7040a=_0x0b41[_0x3b6471];return _0xc7040a;};'use strict';var client=require(_0x10b4('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x10b4('0x1')](_0x10b4('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0x10b4('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x10b4('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 959b498..2217e95 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 _0x8a2c=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','Trunk','callerid','active','mandatoryDispositionPause','Interval','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x425393,_0x2a7033){var _0x3a4e58=function(_0x431404){while(--_0x431404){_0x425393['push'](_0x425393['shift']());}};_0x3a4e58(++_0x2a7033);}(_0x8a2c,0xb8));var _0xc8a2=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x8a2c[_0x273c39];return _0x46d6b5;};'use strict';var client=require(_0xc8a2('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xc8a2('0x1')](_0xc8a2('0x2'),{'options':{'raw':![],'attributes':['id',_0xc8a2('0x3'),_0xc8a2('0x4'),'acwTimeout',_0xc8a2('0x5'),_0xc8a2('0x6'),_0xc8a2('0x7'),'dialActive',_0xc8a2('0x8'),_0xc8a2('0x9'),'dialLimitQueue',_0xc8a2('0xa'),_0xc8a2('0xb'),_0xc8a2('0xc'),'dialPredictiveInterval',_0xc8a2('0xd'),_0xc8a2('0xe'),'dialOriginateTimeout','dialQueueOptions',_0xc8a2('0xf'),_0xc8a2('0x10'),'dialCongestionMaxRetry',_0xc8a2('0x11'),_0xc8a2('0x12'),_0xc8a2('0x13'),_0xc8a2('0x14'),'dialNoAnswerRetryFrequency',_0xc8a2('0x15'),_0xc8a2('0x16'),_0xc8a2('0x17'),_0xc8a2('0x18'),'dialCheckDuplicateType',_0xc8a2('0x19'),_0xc8a2('0x1a'),_0xc8a2('0x1b'),'dialAMDAfterGreetingSilence',_0xc8a2('0x1c'),_0xc8a2('0x1d'),_0xc8a2('0x1e'),_0xc8a2('0x1f'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout',_0xc8a2('0x20'),_0xc8a2('0x21'),_0xc8a2('0x22'),_0xc8a2('0x23'),'dialAgiAfterHangupClient',_0xc8a2('0x24'),'monitor_format',_0xc8a2('0x25'),_0xc8a2('0x26'),_0xc8a2('0x27'),_0xc8a2('0x28'),_0xc8a2('0x29'),_0xc8a2('0x2a'),_0xc8a2('0x2b'),'dialAbandonedMaxRetry',_0xc8a2('0x2c'),_0xc8a2('0x2d'),_0xc8a2('0x2e'),'dialAgentRejectMaxRetry',_0xc8a2('0x2f'),_0xc8a2('0x30'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold'],'include':[{'model':_0xc8a2('0x31'),'as':_0xc8a2('0x31'),'attributes':['id','name',_0xc8a2('0x32'),_0xc8a2('0x33')]},{'model':'Pause','as':_0xc8a2('0x34'),'attributes':['id',_0xc8a2('0x3')]},{'model':_0xc8a2('0x31'),'as':'TrunkBackup','attributes':['id',_0xc8a2('0x3'),_0xc8a2('0x32'),'active']},{'model':_0xc8a2('0x35'),'as':_0xc8a2('0x35'),'attributes':['id',_0xc8a2('0x3')],'include':[{'model':_0xc8a2('0x35'),'as':'Intervals','attributes':['id',_0xc8a2('0x3'),_0xc8a2('0x36')]}]}]},'log':_0xc8a2('0x37')});};}; \ No newline at end of file +var _0xd4b2=['dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','name','autopause','monitor_format','dialActive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0xd4b2,0x1ba));var _0x2d4b=function(_0x3f9606,_0x5b0a04){_0x3f9606=_0x3f9606-0x0;var _0x4487d6=_0xd4b2[_0x3f9606];return _0x4487d6;};'use strict';var client=require(_0x2d4b('0x0'));exports[_0x2d4b('0x1')]=function(){return function(){return client[_0x2d4b('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x2d4b('0x3'),'acw','acwTimeout',_0x2d4b('0x4'),_0x2d4b('0x5'),'type',_0x2d4b('0x6'),'dialMethod',_0x2d4b('0x7'),_0x2d4b('0x8'),'dialPowerLevel','dialPredictiveOptimization',_0x2d4b('0x9'),_0x2d4b('0xa'),_0x2d4b('0xb'),_0x2d4b('0xc'),_0x2d4b('0xd'),'dialQueueOptions',_0x2d4b('0xe'),_0x2d4b('0xf'),_0x2d4b('0x10'),'dialCongestionRetryFrequency',_0x2d4b('0x11'),_0x2d4b('0x12'),_0x2d4b('0x13'),_0x2d4b('0x14'),_0x2d4b('0x15'),'dialTimezone',_0x2d4b('0x16'),_0x2d4b('0x17'),_0x2d4b('0x18'),_0x2d4b('0x19'),_0x2d4b('0x1a'),_0x2d4b('0x1b'),_0x2d4b('0x1c'),_0x2d4b('0x1d'),_0x2d4b('0x1e'),_0x2d4b('0x1f'),_0x2d4b('0x20'),'dialAMDSilenceThreshold',_0x2d4b('0x21'),_0x2d4b('0x22'),'dialRecallMeTimeout',_0x2d4b('0x23'),_0x2d4b('0x24'),_0x2d4b('0x25'),_0x2d4b('0x26'),_0x2d4b('0x27'),_0x2d4b('0x5'),'strategy',_0x2d4b('0x28'),_0x2d4b('0x29'),_0x2d4b('0x2a'),_0x2d4b('0x2b'),'dialDropMaxRetry',_0x2d4b('0x2c'),_0x2d4b('0x2d'),_0x2d4b('0x2e'),_0x2d4b('0x2f'),_0x2d4b('0x30'),_0x2d4b('0x31'),_0x2d4b('0x32'),_0x2d4b('0x33'),_0x2d4b('0x34'),_0x2d4b('0x35')],'include':[{'model':_0x2d4b('0x36'),'as':_0x2d4b('0x36'),'attributes':['id','name',_0x2d4b('0x37'),_0x2d4b('0x38')]},{'model':'Pause','as':_0x2d4b('0x39'),'attributes':['id',_0x2d4b('0x3')]},{'model':_0x2d4b('0x36'),'as':_0x2d4b('0x3a'),'attributes':['id',_0x2d4b('0x3'),_0x2d4b('0x37'),_0x2d4b('0x38')]},{'model':'Interval','as':_0x2d4b('0x3b'),'attributes':['id',_0x2d4b('0x3')],'include':[{'model':_0x2d4b('0x3b'),'as':_0x2d4b('0x3c'),'attributes':['id',_0x2d4b('0x3'),'interval']}]}]},'log':_0x2d4b('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index aea7101..d35107f 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 _0x48e4=['endOf','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerabandon','queuecallerabandonAt','lodash','../client','Request','CreateVoiceQueueReport','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5c06fe,_0x12193a){var _0xf8ec9a=function(_0x3a7026){while(--_0x3a7026){_0x5c06fe['push'](_0x5c06fe['shift']());}};_0xf8ec9a(++_0x12193a);}(_0x48e4,0xdb));var _0x448e=function(_0x55e73d,_0x3d8e32){_0x55e73d=_0x55e73d-0x0;var _0x39d3cb=_0x48e4[_0x55e73d];return _0x39d3cb;};'use strict';var moment=require('moment');var _=require(_0x448e('0x0'));var client=require(_0x448e('0x1'));exports['create']=function(_0xe8ac2){return client[_0x448e('0x2')]('CreateVoiceQueueReport',{'body':_0xe8ac2,'log':_0x448e('0x3')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0x448e('0x2')](_0x448e('0x4'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x448e('0x5')](_0x448e('0x6'))[_0x448e('0x7')](_0x448e('0x8')),moment()[_0x448e('0x9')](_0x448e('0x6'))[_0x448e('0x7')](_0x448e('0x8'))]}},'attributes':[_0x448e('0xa'),_0x448e('0xb'),_0x448e('0xc'),_0x448e('0xd'),_0x448e('0xe'),_0x448e('0xf'),_0x448e('0x10'),'queuecallerexitAt',_0x448e('0x11'),_0x448e('0x12')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xe05d=['queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queuecallerjoinAt','queuecallerleaveAt','queuecallercompleteAt'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe05d,0x1d2));var _0xde05=function(_0x418c3a,_0xafc508){_0x418c3a=_0x418c3a-0x0;var _0x5ebf73=_0xe05d[_0x418c3a];return _0x5ebf73;};'use strict';var moment=require(_0xde05('0x0'));var _=require(_0xde05('0x1'));var client=require(_0xde05('0x2'));exports[_0xde05('0x3')]=function(_0x28eb6c){return client[_0xde05('0x4')](_0xde05('0x5'),{'body':_0x28eb6c,'log':_0xde05('0x5')});};exports[_0xde05('0x6')]=function(){return function(){return client[_0xde05('0x4')](_0xde05('0x7'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xde05('0x8')](_0xde05('0x9'))[_0xde05('0xa')](_0xde05('0xb')),moment()[_0xde05('0xc')](_0xde05('0x9'))[_0xde05('0xa')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xde05('0xd'),'queue',_0xde05('0xe'),_0xde05('0xf'),'queuecallercomplete',_0xde05('0x10'),_0xde05('0x11'),_0xde05('0x12'),_0xde05('0x13'),_0xde05('0x14')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 4662a71..f0c93f9 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 _0xc681=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc681,0x7c));var _0x1c68=function(_0x3d5cda,_0x4a47fa){_0x3d5cda=_0x3d5cda-0x0;var _0x37c9b3=_0xc681[_0x3d5cda];return _0x37c9b3;};'use strict';var client=require(_0x1c68('0x0'));exports[_0x1c68('0x1')]=function(_0x5c0454){return function(){return client[_0x1c68('0x2')](_0x1c68('0x3'),{'options':{'where':{'VoiceQueueId':_0x5c0454,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xf71a=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses','../client'];(function(_0xf73a4d,_0x2f6ca9){var _0xad99ac=function(_0x30af14){while(--_0x30af14){_0xf73a4d['push'](_0xf73a4d['shift']());}};_0xad99ac(++_0x2f6ca9);}(_0xf71a,0x1ca));var _0xaf71=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf71a[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xaf71('0x0'));exports[_0xaf71('0x1')]=function(_0x505cdf){return function(){return client['Request'](_0xaf71('0x2'),{'options':{'where':{'VoiceQueueId':_0x505cdf,'paused':!![]},'raw':!![]},'log':_0xaf71('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 4500aeb..42e3c68 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 _0x693e=['merge','lodash','../client','create','Request','CreateVoiceRecording'];(function(_0x3dcdf3,_0x337946){var _0x247832=function(_0x6b7320){while(--_0x6b7320){_0x3dcdf3['push'](_0x3dcdf3['shift']());}};_0x247832(++_0x337946);}(_0x693e,0x1c3));var _0xe693=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x693e[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xe693('0x0'));var client=require(_0xe693('0x1'));exports[_0xe693('0x2')]=function(_0x34900d){return client[_0xe693('0x3')](_0xe693('0x4'),{'body':_[_0xe693('0x5')](_0x34900d,{'value':_0x34900d['monitorFilename']}),'log':_0xe693('0x4')});}; \ No newline at end of file +var _0x5101=['lodash','../client','create','Request','CreateVoiceRecording','merge','monitorFilename'];(function(_0x203571,_0x5daa77){var _0x1b83fb=function(_0x5252e9){while(--_0x5252e9){_0x203571['push'](_0x203571['shift']());}};_0x1b83fb(++_0x5daa77);}(_0x5101,0x181));var _0x1510=function(_0xd69ddc,_0xcd529d){_0xd69ddc=_0xd69ddc-0x0;var _0xb7fd14=_0x5101[_0xd69ddc];return _0xb7fd14;};'use strict';var _=require(_0x1510('0x0'));var client=require(_0x1510('0x1'));exports[_0x1510('0x2')]=function(_0x1d308a){return client[_0x1510('0x3')](_0x1510('0x4'),{'body':_[_0x1510('0x5')](_0x1d308a,{'value':_0x1d308a[_0x1510('0x6')]}),'log':_0x1510('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 6cdccf1..050f2bc 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 _0x950f=['Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client'];(function(_0x516860,_0x172310){var _0x2daa1b=function(_0x500f72){while(--_0x500f72){_0x516860['push'](_0x516860['shift']());}};_0x2daa1b(++_0x172310);}(_0x950f,0x12f));var _0xf950=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0x950f[_0x2c0dc0];return _0x4c0990;};'use strict';var client=require(_0xf950('0x0'));exports['blindTransfer']=function(_0x238fbe){return client[_0xf950('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x238fbe[_0xf950('0x2')],'transfererchannel':_0x238fbe[_0xf950('0x3')],'transferercalleridnum':_0x238fbe[_0xf950('0x4')],'transferercalleridname':_0x238fbe[_0xf950('0x5')],'transfererconnectedlinenum':_0x238fbe[_0xf950('0x6')],'transfererconnectedlinename':_0x238fbe[_0xf950('0x7')],'transfereraccountcode':_0x238fbe[_0xf950('0x8')],'transferercontext':_0x238fbe[_0xf950('0x9')],'transfererexten':_0x238fbe[_0xf950('0xa')],'transfererlinkedid':_0x238fbe[_0xf950('0xb')],'transfereechannel':_0x238fbe[_0xf950('0xc')],'transfereecalleridnum':_0x238fbe[_0xf950('0xd')],'transfereecalleridname':_0x238fbe['transfereecalleridname'],'transfereeconnectedlinenum':_0x238fbe[_0xf950('0xe')],'transfereeconnectedlinename':_0x238fbe['transfereeconnectedlinename'],'transfereeaccountcode':_0x238fbe['transfereeaccountcode'],'transfereecontext':_0x238fbe['transfereecontext'],'transfereeexten':_0x238fbe[_0xf950('0xf')],'transfereelinkedid':_0x238fbe[_0xf950('0x10')],'isexternal':_0x238fbe[_0xf950('0x11')],'context':_0x238fbe[_0xf950('0x12')],'extension':_0x238fbe[_0xf950('0x13')],'type':_0xf950('0x14')},'log':_0xf950('0x15')});};exports[_0xf950('0x16')]=function(_0x25582c){return client[_0xf950('0x1')](_0xf950('0x15'),{'body':{'result':_0x25582c[_0xf950('0x2')],'transfererchannel':_0x25582c[_0xf950('0x17')],'transferercalleridnum':_0x25582c[_0xf950('0x18')],'transferercalleridname':_0x25582c[_0xf950('0x19')],'transfererconnectedlinenum':_0x25582c['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x25582c[_0xf950('0x1a')],'transfereraccountcode':_0x25582c[_0xf950('0x1b')],'transferercontext':_0x25582c['secondtransferercontext'],'transfererexten':_0x25582c['secondtransfererexten'],'transfererlinkedid':_0x25582c[_0xf950('0x1c')],'transfereechannel':_0x25582c[_0xf950('0x1d')],'transfereecalleridnum':_0x25582c[_0xf950('0x1e')],'transfereecalleridname':_0x25582c['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x25582c['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x25582c[_0xf950('0x1f')],'transfereeaccountcode':_0x25582c[_0xf950('0x20')],'transfereecontext':_0x25582c[_0xf950('0x21')],'transfereeexten':_0x25582c[_0xf950('0x22')],'transfereelinkedid':_0x25582c[_0xf950('0x23')],'isexternal':_0x25582c[_0xf950('0x11')],'context':_0x25582c[_0xf950('0x24')],'extension':_0x25582c[_0xf950('0x25')],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xee7f=['transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfereeconnectedlinenum','transfereeconnectedlinename'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xee7f,0x1dd));var _0xfee7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xee7f[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xfee7('0x0'));exports[_0xfee7('0x1')]=function(_0x37b9a9){return client['Request'](_0xfee7('0x2'),{'body':{'result':_0x37b9a9[_0xfee7('0x3')],'transfererchannel':_0x37b9a9[_0xfee7('0x4')],'transferercalleridnum':_0x37b9a9[_0xfee7('0x5')],'transferercalleridname':_0x37b9a9[_0xfee7('0x6')],'transfererconnectedlinenum':_0x37b9a9[_0xfee7('0x7')],'transfererconnectedlinename':_0x37b9a9[_0xfee7('0x8')],'transfereraccountcode':_0x37b9a9['transfereraccountcode'],'transferercontext':_0x37b9a9[_0xfee7('0x9')],'transfererexten':_0x37b9a9[_0xfee7('0xa')],'transfererlinkedid':_0x37b9a9['transfererlinkedid'],'transfereechannel':_0x37b9a9['transfereechannel'],'transfereecalleridnum':_0x37b9a9['transfereecalleridnum'],'transfereecalleridname':_0x37b9a9['transfereecalleridname'],'transfereeconnectedlinenum':_0x37b9a9[_0xfee7('0xb')],'transfereeconnectedlinename':_0x37b9a9[_0xfee7('0xc')],'transfereeaccountcode':_0x37b9a9[_0xfee7('0xd')],'transfereecontext':_0x37b9a9[_0xfee7('0xe')],'transfereeexten':_0x37b9a9[_0xfee7('0xf')],'transfereelinkedid':_0x37b9a9['transfereelinkedid'],'isexternal':_0x37b9a9[_0xfee7('0x10')],'context':_0x37b9a9[_0xfee7('0x11')],'extension':_0x37b9a9['extension'],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0xfee7('0x12')]=function(_0x2437cc){return client[_0xfee7('0x13')](_0xfee7('0x2'),{'body':{'result':_0x2437cc[_0xfee7('0x3')],'transfererchannel':_0x2437cc[_0xfee7('0x14')],'transferercalleridnum':_0x2437cc[_0xfee7('0x15')],'transferercalleridname':_0x2437cc['origtransferercalleridname'],'transfererconnectedlinenum':_0x2437cc[_0xfee7('0x16')],'transfererconnectedlinename':_0x2437cc[_0xfee7('0x17')],'transfereraccountcode':_0x2437cc[_0xfee7('0x18')],'transferercontext':_0x2437cc['secondtransferercontext'],'transfererexten':_0x2437cc[_0xfee7('0x19')],'transfererlinkedid':_0x2437cc[_0xfee7('0x1a')],'transfereechannel':_0x2437cc['transfertargetchannel'],'transfereecalleridnum':_0x2437cc[_0xfee7('0x1b')],'transfereecalleridname':_0x2437cc[_0xfee7('0x1c')],'transfereeconnectedlinenum':_0x2437cc[_0xfee7('0x1d')],'transfereeconnectedlinename':_0x2437cc['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2437cc['transfertargetaccountcode'],'transfereecontext':_0x2437cc['transfertargetcontext'],'transfereeexten':_0x2437cc[_0xfee7('0x1e')],'transfereelinkedid':_0x2437cc[_0xfee7('0x1f')],'isexternal':_0x2437cc[_0xfee7('0x10')],'context':_0x2437cc[_0xfee7('0x20')],'extension':_0x2437cc[_0xfee7('0x21')],'type':_0xfee7('0x22')},'log':_0xfee7('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index af458e6..67aa975 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 _0x3754=['answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','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','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','values','channels','length','username','ami\x20disconnected','voicechannel','find','channel','%s.%s','filename','uniqueid','wav','MixMonitor','ai(mixmonitorid)','toLowerCase','isNil','monitors','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','status','stop','voicequeuechannel','queueChannels','Hangup','voicequeuechannelredirect','exten','context','trunks','outboundChannels','run','event','Event\x20name\x20mandatory','emit','custom:','checkAfterSend','server','http','listen','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','format','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','join','pick','keys','action','Reload','Action','then','catch','message','command','Command','voiceQueues','strategy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3754,0x68));var _0x4375=function(_0x409900,_0x4dc39b){_0x409900=_0x409900-0x0;var _0x261689=_0x3754[_0x409900];return _0x261689;};'use strict';var _=require(_0x4375('0x0'));var util=require(_0x4375('0x1'));var jayson=require(_0x4375('0x2'));var schema=require(_0x4375('0x3'));var BPromise=require(_0x4375('0x4'));var moment=require(_0x4375('0x5'));var config=require(_0x4375('0x6'));var properties=require(_0x4375('0x7'));var ami=require(_0x4375('0x8'));exports['listen']=function(_0x342046,_0x3fbdf3,_0x53656e){return new BPromise(function(_0x25848b,_0x36f8e2){var _0x339c6e={'QueuePause':function(_0x349c4a){return new Promise(function(_0x56c7c7,_0x133802){var _0x20c2c5=util[_0x4375('0x9')](_0x4375('0xa'),'SIP',_0x349c4a[_0x4375('0xb')]);if(_0x342046[_0x4375('0xc')]&&_0x342046[_0x4375('0xc')][_0x20c2c5]&&_0x342046[_0x4375('0xc')][_0x20c2c5][_0x4375('0xd')]){_0x342046[_0x4375('0xc')][_0x20c2c5][_0x4375('0xe')]();}if(_0x342046[_0x4375('0xf')][_0x20c2c5]){_0x342046[_0x4375('0xf')][_0x20c2c5][_0x4375('0x10')]({'statePause':_0x349c4a[_0x4375('0x11')]?!![]:![]});}_0x56c7c7({'code':0xc8,'message':_0x4375('0x12')});});},'Reload':function(_0x1c1f55){var _0x2a14e0=this;return new Promise(function(_0x4392dd,_0x3030b2){if(ami[_0x4375('0x13')]()==![]){return _0x3030b2(_0x2a14e0[_0x4375('0x14')](0x1f4,[config[_0x4375('0x15')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0x4375('0x16')]('\x20')));}_0x1c1f55=_[_0x4375('0x17')](_0x1c1f55,_[_0x4375('0x18')](properties['module']));_0x1c1f55[_0x4375('0x19')]=_0x4375('0x1a');return ami[_0x4375('0x1b')](_0x1c1f55)[_0x4375('0x1c')](function(_0x2fa439){_0x4392dd({'code':0xc8,'message':_0x2fa439['message']});})[_0x4375('0x1d')](function(_0xb1f756){_0x3030b2(_0x2a14e0[_0x4375('0x14')](0x1f5,_0xb1f756[_0x4375('0x1e')]));});});},'Command':function(_0x444b74){var _0x10bee0=this;return new Promise(function(_0x1da8b4,_0x4192b5){if(ami[_0x4375('0x13')]()==![]){return _0x4192b5(_0x10bee0[_0x4375('0x14')](0x1f4,[config[_0x4375('0x15')]['ip'],config[_0x4375('0x15')]['username'],'ami\x20disconnected'][_0x4375('0x16')]('\x20')));}_0x444b74=_[_0x4375('0x17')](_0x444b74,_0x4375('0x1f'));_0x444b74[_0x4375('0x19')]=_0x4375('0x20');return ami[_0x4375('0x1b')](_0x444b74)[_0x4375('0x1c')](function(_0x4e3456){_0x1da8b4({'code':0xc8,'message':_0x4e3456['content']});})[_0x4375('0x1d')](function(_0x1cb7b4){_0x4192b5(_0x10bee0['error'](0x1f5,_0x1cb7b4[_0x4375('0x1e')]));});});},'VoiceQueues':function(_0x1720df){return new Promise(function(_0x5e8e95,_0x334cdc){var _0x3aaea8=[];for(var _0x1d2871 in _0x342046[_0x4375('0x21')]){if(_0x342046[_0x4375('0x21')]['hasOwnProperty'](_0x1d2871)){var _0xbbe08=_0x342046['voiceQueues'][_0x1d2871];var _0x4335cb={'id':_0xbbe08['id'],'name':_0xbbe08[_0x4375('0xb')],'strategy':_0xbbe08[_0x4375('0x22')],'answered':_0xbbe08[_0x4375('0x23')],'available':_0xbbe08[_0x4375('0x24')],'loggedIn':_0xbbe08['loggedIn'],'pTalking':_0xbbe08[_0x4375('0x25')],'sumBillable':_0xbbe08[_0x4375('0x26')],'sumDuration':_0xbbe08[_0x4375('0x27')],'sumHoldTime':_0xbbe08[_0x4375('0x28')]||0x0,'talking':_0xbbe08['talking'],'total':_0xbbe08[_0x4375('0x29')],'type':_0xbbe08[_0x4375('0x2a')],'unmanaged':_0xbbe08[_0x4375('0x2b')],'abandoned':_0xbbe08[_0x4375('0x2c')],'waiting':_0xbbe08[_0x4375('0x2d')],'loggedInDb':_0xbbe08['loggedInDb']};if(_0xbbe08[_0x4375('0x2a')]===_0x4375('0x2e')){_0x4335cb[_0x4375('0x2f')]=_0xbbe08[_0x4375('0x2f')];_0x4335cb[_0x4375('0x30')]=_0xbbe08[_0x4375('0x30')];_0x4335cb[_0x4375('0x31')]=_0xbbe08[_0x4375('0x31')];_0x4335cb[_0x4375('0x32')]=_0xbbe08[_0x4375('0x32')];_0x4335cb[_0x4375('0x33')]=_0xbbe08[_0x4375('0x33')];_0x4335cb[_0x4375('0x34')]=_0xbbe08['dialPrefix'];_0x4335cb[_0x4375('0x35')]=_0xbbe08['outboundAnswerAgiCallsDay'];_0x4335cb[_0x4375('0x36')]=_0xbbe08[_0x4375('0x36')];_0x4335cb[_0x4375('0x37')]=_0xbbe08[_0x4375('0x37')];_0x4335cb[_0x4375('0x38')]=_0xbbe08[_0x4375('0x38')];_0x4335cb[_0x4375('0x39')]=_0xbbe08['outboundCongestionCallsDay'];_0x4335cb[_0x4375('0x3a')]=_0xbbe08[_0x4375('0x3a')];_0x4335cb[_0x4375('0x3b')]=_0xbbe08['outboundDropCallsDayCallersExit'];_0x4335cb[_0x4375('0x3c')]=_0xbbe08[_0x4375('0x3c')];_0x4335cb[_0x4375('0x3d')]=_0xbbe08[_0x4375('0x3d')];_0x4335cb[_0x4375('0x3e')]=_0xbbe08[_0x4375('0x3e')];_0x4335cb[_0x4375('0x3f')]=_0xbbe08[_0x4375('0x3f')];_0x4335cb[_0x4375('0x40')]=_0xbbe08[_0x4375('0x40')];_0x4335cb[_0x4375('0x41')]=_0xbbe08[_0x4375('0x41')];_0x4335cb[_0x4375('0x42')]=_0xbbe08[_0x4375('0x42')];_0x4335cb[_0x4375('0x43')]=_0xbbe08[_0x4375('0x43')];_0x4335cb[_0x4375('0x44')]=_0xbbe08[_0x4375('0x44')];_0x4335cb['predictiveIntervalAvgTalktime']=_0xbbe08[_0x4375('0x45')];_0x4335cb[_0x4375('0x46')]=_0xbbe08['predictiveIntervalDroppedCallsCallersExit'];_0x4335cb[_0x4375('0x47')]=_0xbbe08[_0x4375('0x47')];_0x4335cb[_0x4375('0x48')]=_0xbbe08[_0x4375('0x48')];_0x4335cb['predictiveIntervalErlangCallsDroppedCalls']=_0xbbe08[_0x4375('0x49')];_0x4335cb[_0x4375('0x4a')]=_0xbbe08['predictiveIntervalHitRate'];_0x4335cb[_0x4375('0x4b')]=_0xbbe08[_0x4375('0x4b')];_0x4335cb[_0x4375('0x4c')]=_0xbbe08[_0x4375('0x4c')];_0x4335cb[_0x4375('0x4d')]=_0xbbe08[_0x4375('0x4d')];_0x4335cb[_0x4375('0x4e')]=_0xbbe08[_0x4375('0x4e')];_0x4335cb[_0x4375('0x1e')]=_0xbbe08['message'];_0x4335cb[_0x4375('0x4f')]=_0xbbe08['originated'];_0x4335cb[_0x4375('0x50')]=_0xbbe08[_0x4375('0x50')];_0x4335cb[_0x4375('0x51')]=_0xbbe08['erlangCallToSecond'];_0x4335cb[_0x4375('0x52')]=_0xbbe08[_0x4375('0x52')];_0x4335cb[_0x4375('0x53')]=_0xbbe08[_0x4375('0x53')];_0x4335cb[_0x4375('0x54')]=_0xbbe08[_0x4375('0x54')];_0x4335cb['startProgressive']=_0xbbe08[_0x4375('0x55')];}if(_0xbbe08['Trunk']){_0x4335cb[_0x4375('0x56')]={'id':_0xbbe08['Trunk']['id'],'name':_0xbbe08[_0x4375('0x56')]['name'],'active':_0xbbe08[_0x4375('0x56')][_0x4375('0x57')],'callerid':_0xbbe08['Trunk']['callerid']};}if(_0xbbe08[_0x4375('0x58')]){_0x4335cb[_0x4375('0x58')]={'id':_0xbbe08[_0x4375('0x58')]['id'],'name':_0xbbe08[_0x4375('0x58')][_0x4375('0xb')]};}_0x3aaea8[_0x4375('0x59')](_0x4335cb);}}_0x5e8e95({'count':_0x3aaea8['length'],'rows':_0x3aaea8});});},'VoiceChannels':function(_0x4e626f){return new Promise(function(_0x2720ec,_0x170f98){var _0x434494=_[_0x4375('0x5a')](_0x342046[_0x4375('0x5b')]);_0x2720ec({'count':_0x434494[_0x4375('0x5c')],'rows':_0x434494});});},'VoiceChannelMixMonitor':function(_0x4125a7){var _0x5e5126=this;return new Promise(function(_0x527bba,_0x471f2b){if(ami[_0x4375('0x13')]()==![]){return _0x471f2b(_0x5e5126[_0x4375('0x14')](0x1f4,[config[_0x4375('0x15')]['ip'],config[_0x4375('0x15')][_0x4375('0x5d')],_0x4375('0x5e')][_0x4375('0x16')]('\x20')));}var _0x53d461=schema(properties[_0x4375('0x5f')])[_0x4375('0x3')](_0x4125a7);if(_0x53d461[_0x4375('0x5c')]>0x0){return _0x471f2b(_0x5e5126[_0x4375('0x14')](0x1f4,_['map'](_0x53d461,'message')['join'](',\x20')));}var _0x2c58ae=_[_0x4375('0x60')](_0x342046[_0x4375('0x5b')],{'uniqueid':_0x4125a7['uniqueid']});if(_0x2c58ae&&_0x2c58ae[_0x4375('0x61')]){var _0x48ccd3=util[_0x4375('0x9')](_0x4375('0x62'),_0x4125a7[_0x4375('0x63')]||_0x4125a7[_0x4375('0x64')],_0x4125a7[_0x4375('0x9')]||_0x4375('0x65'));return ami[_0x4375('0x1b')]({'action':_0x4375('0x66'),'channel':_0x2c58ae['channel'],'file':_0x48ccd3,'options':_0x4375('0x67')})[_0x4375('0x1c')](function(_0x121c21){var _0x24e806=_[_0x4375('0x60')](_0x2c58ae['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x48ccd3[_0x4375('0x68')]()});if(_[_0x4375('0x69')](_0x24e806)){_0x2c58ae[_0x4375('0x6a')][_0x4375('0x59')]({'filename':_0x4375('0x6b')+_0x48ccd3[_0x4375('0x68')](),'createdAt':moment()[_0x4375('0x9')](_0x4375('0x6c')),'mixmonitorid':_0x121c21[_0x4375('0x6d')],'status':_0x4375('0x6e')});}else{_0x24e806['mixmonitorid']=_0x121c21['mixmonitorid'];_0x24e806['status']='rec';}_0x527bba({'code':0xc8,'message':[_0x4125a7['uniqueid'],_0x4375('0x6f'),_0x121c21[_0x4375('0x6d')]][_0x4375('0x16')]('\x20'),'mixmonitorid':_0x121c21[_0x4375('0x6d')]});})[_0x4375('0x1d')](function(_0x516808){_0x471f2b(_0x5e5126[_0x4375('0x14')](0x1f5,[_0x4125a7['uniqueid'],_0x516808['message'][_0x4375('0x68')]()][_0x4375('0x16')]('\x20')));});}else{return _0x471f2b(_0x5e5126[_0x4375('0x14')](0x1f5,_0x4375('0x70')));}});},'VoiceChannelStopMixMonitor':function(_0x566600){var _0x37be34=this;return new Promise(function(_0x528602,_0x3fb46d){if(ami[_0x4375('0x13')]()==![]){return _0x3fb46d(_0x37be34[_0x4375('0x14')](0x1f4,[config[_0x4375('0x15')]['ip'],config[_0x4375('0x15')][_0x4375('0x5d')],_0x4375('0x5e')]['join']('\x20')));}var _0x36cf31=schema(properties[_0x4375('0x5f')])[_0x4375('0x3')](_0x566600);if(_0x36cf31['length']>0x0){return _0x3fb46d(_0x37be34[_0x4375('0x14')](0x1f4,_[_0x4375('0x71')](_0x36cf31,'message')[_0x4375('0x16')](',\x20')));}var _0x137497=_['find'](_0x342046[_0x4375('0x5b')],{'uniqueid':_0x566600[_0x4375('0x64')]});if(_0x137497){return BPromise[_0x4375('0x72')]()['then'](function(){if(_0x137497['channel']){return ami[_0x4375('0x1b')]({'action':_0x4375('0x73'),'channel':_0x137497['channel'],'mixmonitorid':_0x566600[_0x4375('0x6d')]})['catch'](function(_0x1c5c87){});}})[_0x4375('0x1c')](function(){if(_0x137497[_0x4375('0x74')]){return ami[_0x4375('0x1b')]({'action':_0x4375('0x73'),'channel':_0x137497[_0x4375('0x74')],'mixmonitorid':_0x566600[_0x4375('0x6d')]})['catch'](function(_0xfaca47){});}})[_0x4375('0x1c')](function(_0xf7f0de){var _0x322065=_[_0x4375('0x60')](_0x137497[_0x4375('0x6a')],{'mixmonitorid':_0x566600[_0x4375('0x6d')]});if(_0x322065){_0x322065[_0x4375('0x75')]='stop';}})[_0x4375('0x1c')](function(){var _0x144d91=util[_0x4375('0x9')](_0x4375('0x62'),_0x566600[_0x4375('0x63')]||_0x566600[_0x4375('0x64')],_0x566600[_0x4375('0x9')]||_0x4375('0x65'));var _0x4b5aa3=_[_0x4375('0x60')](_0x137497['monitors'],{'filename':_0x4375('0x6b')+_0x144d91[_0x4375('0x68')]()});if(_0x4b5aa3){_0x4b5aa3['status']=_0x4375('0x76');}})[_0x4375('0x1c')](function(){_0x528602({'code':0xc8,'message':[_0x566600[_0x4375('0x64')],'StopMixMonitor\x20Success'][_0x4375('0x16')]('\x20')});})[_0x4375('0x1d')](function(_0x2c9f5e){_0x3fb46d(_0x37be34[_0x4375('0x14')](0x1f5,[_0x566600[_0x4375('0x64')],_0x2c9f5e[_0x4375('0x1e')][_0x4375('0x68')]()][_0x4375('0x16')]('\x20')));});}else{return _0x3fb46d(_0x37be34[_0x4375('0x14')](0x1f5,_0x4375('0x70')));}});},'VoiceQueuesChannels':function(_0x56bc3e){return new Promise(function(_0x34d052,_0x3e64b3){var _0x117789=_['values'](_0x342046['queueChannels']);_0x34d052({'count':_0x117789[_0x4375('0x5c')],'rows':_0x117789});});},'VoiceQueuesChannel':function(_0xbd54ac){var _0x13a9ca=this;return new Promise(function(_0x4f5765,_0x43871d){var _0x253561=schema(properties[_0x4375('0x77')])[_0x4375('0x3')](_0xbd54ac);if(_0x253561[_0x4375('0x5c')]>0x0){return _0x43871d(_0x13a9ca[_0x4375('0x14')](0x1f4,_[_0x4375('0x71')](_0x253561,_0x4375('0x1e'))[_0x4375('0x16')](',\x20')));}var _0x190d08=_[_0x4375('0x60')](_0x342046[_0x4375('0x78')],{'uniqueid':_0xbd54ac[_0x4375('0x64')]});if(_0x190d08){_0x4f5765(_0x190d08);}else{return _0x43871d(_0x13a9ca[_0x4375('0x14')](0x1f5,_0x4375('0x70')));}});},'VoiceQueuesChannelHangup':function(_0x28453a){var _0x4e07e6=this;return new Promise(function(_0xb56afe,_0x1704bc){if(ami[_0x4375('0x13')]()==![]){return _0x1704bc(_0x4e07e6[_0x4375('0x14')](0x1f4,[config[_0x4375('0x15')]['ip'],config[_0x4375('0x15')][_0x4375('0x5d')],'ami\x20disconnected'][_0x4375('0x16')]('\x20')));}var _0x24225c=schema(properties['voicequeuechannelhangup'])[_0x4375('0x3')](_0x28453a);if(_0x24225c[_0x4375('0x5c')]>0x0){return _0x1704bc(_0x4e07e6[_0x4375('0x14')](0x1f4,_['map'](_0x24225c,_0x4375('0x1e'))['join'](',\x20')));}var _0x11cb75=_[_0x4375('0x60')](_0x342046[_0x4375('0x78')],{'uniqueid':_0x28453a[_0x4375('0x64')]});if(_0x11cb75&&_0x11cb75[_0x4375('0x61')]){return ami[_0x4375('0x1b')]({'action':_0x4375('0x79'),'channel':_0x11cb75[_0x4375('0x61')]})[_0x4375('0x1c')](function(_0x630698){_0xb56afe({'code':0xc8,'message':[_0x28453a[_0x4375('0x64')],_0x630698[_0x4375('0x1e')]['toLowerCase']()]['join']('\x20')});})['catch'](function(_0x5e5d4a){_0x1704bc(_0x4e07e6['error'](0x1f5,[_0x28453a[_0x4375('0x64')],_0x5e5d4a[_0x4375('0x1e')]['toLowerCase']()][_0x4375('0x16')]('\x20')));});}else{return _0x1704bc(_0x4e07e6['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x287420){var _0x5d9244=this;return new Promise(function(_0xc8f799,_0x3666f6){if(ami[_0x4375('0x13')]()==![]){return _0x3666f6(_0x5d9244[_0x4375('0x14')](0x1f4,[config[_0x4375('0x15')]['ip'],config[_0x4375('0x15')][_0x4375('0x5d')],'ami\x20disconnected']['join']('\x20')));}var _0x16b614=schema(properties[_0x4375('0x7a')])[_0x4375('0x3')](_0x287420);if(_0x16b614[_0x4375('0x5c')]>0x0){return _0x3666f6(_0x5d9244[_0x4375('0x14')](0x1f4,_['map'](_0x16b614,_0x4375('0x1e'))['join'](',\x20')));}var _0x4216e2=_[_0x4375('0x60')](_0x342046[_0x4375('0x78')],{'uniqueid':_0x287420[_0x4375('0x64')]});if(_0x4216e2&&_0x4216e2['channel']){return ami[_0x4375('0x1b')]({'action':'Redirect','channel':_0x4216e2[_0x4375('0x61')],'exten':_0x287420[_0x4375('0x7b')],'context':_0x287420[_0x4375('0x7c')]||_0x4216e2[_0x4375('0x7c')],'priority':0x1})[_0x4375('0x1c')](function(_0xca69f4){_0xc8f799({'code':0xc8,'message':[_0x287420['uniqueid'],_0xca69f4[_0x4375('0x1e')][_0x4375('0x68')]()][_0x4375('0x16')]('\x20')});})[_0x4375('0x1d')](function(_0x48b3ce){_0x3666f6(_0x5d9244[_0x4375('0x14')](0x1f5,[_0x287420[_0x4375('0x64')],_0x48b3ce['message']['toLowerCase']()][_0x4375('0x16')]('\x20')));});}else{return _0x3666f6(_0x5d9244['error'](0x1f5,_0x4375('0x70')));}});},'Agents':function(_0x26f2e9){return new Promise(function(_0x14036f,_0x50b763){var _0x51c130=_['values'](_0x342046[_0x4375('0xf')]);_0x14036f({'count':_0x51c130[_0x4375('0x5c')],'rows':_0x51c130});});},'Telephones':function(_0x3bd214){return new Promise(function(_0x3e91ca,_0x2a64b1){var _0x504958=_[_0x4375('0x5a')](_0x342046['telephones']);_0x3e91ca({'count':_0x504958[_0x4375('0x5c')],'rows':_0x504958});});},'Trunks':function(_0x58b30c){return new Promise(function(_0x21665b,_0x36c567){var _0x4a9bbf=_['values'](_0x342046[_0x4375('0x7d')]);_0x21665b({'count':_0x4a9bbf[_0x4375('0x5c')],'rows':_0x4a9bbf});});},'OutboundChannels':function(_0x1adc23){return new Promise(function(_0x4d3407,_0x1ff6a0){var _0x22d954=_[_0x4375('0x5a')](_0x342046[_0x4375('0x7e')]);_0x4d3407({'count':_0x22d954['length'],'rows':_0x22d954});});},'Outbound':function(_0x4e7193){return new Promise(function(_0x12654c,_0x485211){_0x12654c(_0x342046[_0x4375('0x2e')]);});},'Campaigns':function(_0xb56f42){return new Promise(function(_0x495a14,_0x148d95){var _0x50289f=_['values'](_0x342046['campaigns']);_0x495a14({'count':_0x50289f[_0x4375('0x5c')],'rows':_0x50289f});});},'VoiceQueuesPreview':function(_0x183940){var _0x56964c=this;return new Promise(function(_0x2a2449,_0x18e1a1){_0x3fbdf3[_0x4375('0x7f')](_0x183940['id'])[_0x4375('0x1c')](function(_0x3b680e){_0x2a2449({'code':0xc8,'message':_0x3b680e['message']});})[_0x4375('0x1d')](function(_0x2a8580){_0x18e1a1(_0x56964c[_0x4375('0x14')](0x1f4,_0x2a8580[_0x4375('0x1e')]));});});},'EventManager':function(_0x2421aa){var _0x5e53a7=this;return new Promise(function(_0x2e35de,_0x1e3613){if(!_0x2421aa[_0x4375('0x80')]){return _0x1e3613(_0x5e53a7[_0x4375('0x14')](0x1f4,_0x4375('0x81')));}ami[_0x4375('0x82')](_0x4375('0x83')+_0x2421aa['event'],_0x2421aa[_0x4375('0x1e')]);_0x2e35de({'code':0xc8,'message':_0x2421aa});});},'FaxAccounts':function(_0x217447){return new Promise(function(_0x126416,_0x972ed){var _0x58c126=_[_0x4375('0x5a')](_0x342046['faxAccounts']);_0x126416({'count':_0x58c126[_0x4375('0x5c')],'rows':_0x58c126});});},'SendFax':function(_0x5a6ef4){var _0x4b37de=this;return new Promise(function(_0x10d978,_0x294f22){_0x53656e['send'](_0x5a6ef4)[_0x4375('0x1c')](function(_0x4d0420){_0x10d978({'code':0xc8,'message':_0x4d0420[_0x4375('0x1e')]});})[_0x4375('0x1d')](function(_0x138c46){_0x294f22(_0x4b37de[_0x4375('0x14')](0x1f4,_0x138c46[_0x4375('0x1e')]));});});},'CheckAfterSend':function(_0x8f99ea){var _0x58275a=this;return new Promise(function(_0x4c4f9a,_0x112b43){_0x53656e[_0x4375('0x84')](_0x8f99ea)[_0x4375('0x1c')](function(_0x25f75f){_0x4c4f9a({'code':0xc8,'message':_0x25f75f[_0x4375('0x1e')]});})[_0x4375('0x1d')](function(_0x3dfc3a){_0x112b43(_0x58275a[_0x4375('0x14')](0x1f4,_0x3dfc3a[_0x4375('0x1e')]));});});}};var _0x5e51a4=jayson[_0x4375('0x85')](_0x339c6e)[_0x4375('0x86')]();_0x5e51a4['on'](_0x4375('0x14'),function(_0xe64a77){return _0x36f8e2(_0xe64a77);});_0x5e51a4[_0x4375('0x87')](0x232a,_0x4375('0x88'),function(){console[_0x4375('0x89')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x25848b(_0x4375('0x8a')+0x232a);});});}; \ No newline at end of file +var _0x21b1=['outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','channels','isConnected','map','uniqueid','format','%s.%s','filename','MixMonitor','channel','then','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','find','status','stop','wav','StopMixMonitor\x20Success','values','voicequeuechannel','queueChannels','voicequeuechannelhangup','Hangup','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','http','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','../../../config/environment','../ami','%s/%s','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','message','catch','command','Command','Action','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','total','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS'];(function(_0x5b533e,_0x164b11){var _0x53d8a0=function(_0xb7061b){while(--_0xb7061b){_0x5b533e['push'](_0x5b533e['shift']());}};_0x53d8a0(++_0x164b11);}(_0x21b1,0x168));var _0x121b=function(_0x2cd630,_0x586e30){_0x2cd630=_0x2cd630-0x0;var _0x1e014f=_0x21b1[_0x2cd630];return _0x1e014f;};'use strict';var _=require(_0x121b('0x0'));var util=require(_0x121b('0x1'));var jayson=require(_0x121b('0x2'));var schema=require(_0x121b('0x3'));var BPromise=require(_0x121b('0x4'));var moment=require('moment');var config=require(_0x121b('0x5'));var properties=require('../properties');var ami=require(_0x121b('0x6'));exports['listen']=function(_0x34327c,_0x375fa4,_0x5b785e){return new BPromise(function(_0xc55aeb,_0x5f5c3a){var _0xafdcda={'QueuePause':function(_0x4db8db){return new Promise(function(_0x50af0e,_0x428642){var _0x293bd9=util['format'](_0x121b('0x7'),'SIP',_0x4db8db[_0x121b('0x8')]);if(_0x34327c['timers']&&_0x34327c[_0x121b('0x9')][_0x293bd9]&&_0x34327c[_0x121b('0x9')][_0x293bd9]['timer']){_0x34327c[_0x121b('0x9')][_0x293bd9][_0x121b('0xa')]();}if(_0x34327c[_0x121b('0xb')][_0x293bd9]){_0x34327c['agents'][_0x293bd9][_0x121b('0xc')]({'statePause':_0x4db8db[_0x121b('0xd')]?!![]:![]});}_0x50af0e({'code':0xc8,'message':_0x121b('0xe')});});},'Reload':function(_0x4c53a9){var _0x2f5240=this;return new Promise(function(_0x5099ac,_0x27f94c){if(ami['isConnected']()==![]){return _0x27f94c(_0x2f5240[_0x121b('0xf')](0x1f4,[config[_0x121b('0x10')]['ip'],config['asterisk'][_0x121b('0x11')],_0x121b('0x12')][_0x121b('0x13')]('\x20')));}_0x4c53a9=_[_0x121b('0x14')](_0x4c53a9,_[_0x121b('0x15')](properties[_0x121b('0x16')]));_0x4c53a9[_0x121b('0x17')]=_0x121b('0x18');return ami['Action'](_0x4c53a9)['then'](function(_0x17e5eb){_0x5099ac({'code':0xc8,'message':_0x17e5eb[_0x121b('0x19')]});})[_0x121b('0x1a')](function(_0x142251){_0x27f94c(_0x2f5240['error'](0x1f5,_0x142251[_0x121b('0x19')]));});});},'Command':function(_0xe57422){var _0x26e1e5=this;return new Promise(function(_0xba47e6,_0x52f32e){if(ami['isConnected']()==![]){return _0x52f32e(_0x26e1e5[_0x121b('0xf')](0x1f4,[config[_0x121b('0x10')]['ip'],config[_0x121b('0x10')][_0x121b('0x11')],_0x121b('0x12')]['join']('\x20')));}_0xe57422=_[_0x121b('0x14')](_0xe57422,_0x121b('0x1b'));_0xe57422[_0x121b('0x17')]=_0x121b('0x1c');return ami[_0x121b('0x1d')](_0xe57422)['then'](function(_0x40861a){_0xba47e6({'code':0xc8,'message':_0x40861a[_0x121b('0x1e')]});})[_0x121b('0x1a')](function(_0x2ec869){_0x52f32e(_0x26e1e5[_0x121b('0xf')](0x1f5,_0x2ec869[_0x121b('0x19')]));});});},'VoiceQueues':function(_0x1a6228){return new Promise(function(_0x406844,_0x2aa378){var _0x22e8a1=[];for(var _0x48c65c in _0x34327c[_0x121b('0x1f')]){if(_0x34327c[_0x121b('0x1f')][_0x121b('0x20')](_0x48c65c)){var _0x33d68b=_0x34327c[_0x121b('0x1f')][_0x48c65c];var _0x2b42f4={'id':_0x33d68b['id'],'name':_0x33d68b['name'],'strategy':_0x33d68b[_0x121b('0x21')],'answered':_0x33d68b[_0x121b('0x22')],'available':_0x33d68b[_0x121b('0x23')],'loggedIn':_0x33d68b[_0x121b('0x24')],'pTalking':_0x33d68b[_0x121b('0x25')],'sumBillable':_0x33d68b[_0x121b('0x26')],'sumDuration':_0x33d68b[_0x121b('0x27')],'sumHoldTime':_0x33d68b['sumHoldTime']||0x0,'talking':_0x33d68b['talking'],'total':_0x33d68b[_0x121b('0x28')],'type':_0x33d68b[_0x121b('0x29')],'unmanaged':_0x33d68b['unmanaged'],'abandoned':_0x33d68b[_0x121b('0x2a')],'waiting':_0x33d68b[_0x121b('0x2b')],'loggedInDb':_0x33d68b[_0x121b('0x2c')]};if(_0x33d68b['type']===_0x121b('0x2d')){_0x2b42f4[_0x121b('0x2e')]=_0x33d68b[_0x121b('0x2e')];_0x2b42f4[_0x121b('0x2f')]=_0x33d68b['dialMethod'];_0x2b42f4[_0x121b('0x30')]=_0x33d68b[_0x121b('0x30')];_0x2b42f4[_0x121b('0x31')]=_0x33d68b[_0x121b('0x31')];_0x2b42f4[_0x121b('0x32')]=_0x33d68b[_0x121b('0x32')];_0x2b42f4[_0x121b('0x33')]=_0x33d68b[_0x121b('0x33')];_0x2b42f4[_0x121b('0x34')]=_0x33d68b[_0x121b('0x34')];_0x2b42f4[_0x121b('0x35')]=_0x33d68b[_0x121b('0x35')];_0x2b42f4[_0x121b('0x36')]=_0x33d68b[_0x121b('0x36')];_0x2b42f4[_0x121b('0x37')]=_0x33d68b['outboundBusyCallsDay'];_0x2b42f4['outboundCongestionCallsDay']=_0x33d68b['outboundCongestionCallsDay'];_0x2b42f4[_0x121b('0x38')]=_0x33d68b[_0x121b('0x38')];_0x2b42f4[_0x121b('0x39')]=_0x33d68b['outboundDropCallsDayCallersExit'];_0x2b42f4[_0x121b('0x3a')]=_0x33d68b[_0x121b('0x3a')];_0x2b42f4[_0x121b('0x3b')]=_0x33d68b[_0x121b('0x3b')];_0x2b42f4[_0x121b('0x3c')]=_0x33d68b[_0x121b('0x3c')];_0x2b42f4[_0x121b('0x3d')]=_0x33d68b[_0x121b('0x3d')];_0x2b42f4[_0x121b('0x3e')]=_0x33d68b[_0x121b('0x3e')];_0x2b42f4['outboundRejectCallsDay']=_0x33d68b[_0x121b('0x3f')];_0x2b42f4[_0x121b('0x40')]=_0x33d68b[_0x121b('0x40')];_0x2b42f4[_0x121b('0x41')]=_0x33d68b[_0x121b('0x41')];_0x2b42f4[_0x121b('0x42')]=_0x33d68b[_0x121b('0x42')];_0x2b42f4[_0x121b('0x43')]=_0x33d68b[_0x121b('0x43')];_0x2b42f4[_0x121b('0x44')]=_0x33d68b[_0x121b('0x44')];_0x2b42f4[_0x121b('0x45')]=_0x33d68b[_0x121b('0x45')];_0x2b42f4[_0x121b('0x46')]=_0x33d68b['predictiveIntervalErlangCalls'];_0x2b42f4[_0x121b('0x47')]=_0x33d68b[_0x121b('0x47')];_0x2b42f4[_0x121b('0x48')]=_0x33d68b[_0x121b('0x48')];_0x2b42f4[_0x121b('0x49')]=_0x33d68b[_0x121b('0x49')];_0x2b42f4[_0x121b('0x4a')]=_0x33d68b[_0x121b('0x4a')];_0x2b42f4[_0x121b('0x4b')]=_0x33d68b[_0x121b('0x4b')];_0x2b42f4['predictiveIntervalTotalCalls']=_0x33d68b['predictiveIntervalTotalCalls'];_0x2b42f4['message']=_0x33d68b[_0x121b('0x19')];_0x2b42f4['originated']=_0x33d68b[_0x121b('0x4c')];_0x2b42f4[_0x121b('0x4d')]=_0x33d68b[_0x121b('0x4d')];_0x2b42f4[_0x121b('0x4e')]=_0x33d68b[_0x121b('0x4e')];_0x2b42f4[_0x121b('0x4f')]=_0x33d68b[_0x121b('0x4f')];_0x2b42f4[_0x121b('0x50')]=_0x33d68b[_0x121b('0x50')];_0x2b42f4[_0x121b('0x51')]=_0x33d68b[_0x121b('0x51')];_0x2b42f4[_0x121b('0x52')]=_0x33d68b['startProgressive'];}if(_0x33d68b[_0x121b('0x53')]){_0x2b42f4[_0x121b('0x53')]={'id':_0x33d68b[_0x121b('0x53')]['id'],'name':_0x33d68b['Trunk'][_0x121b('0x8')],'active':_0x33d68b[_0x121b('0x53')]['active'],'callerid':_0x33d68b[_0x121b('0x53')][_0x121b('0x54')]};}if(_0x33d68b[_0x121b('0x55')]){_0x2b42f4['Interval']={'id':_0x33d68b['Interval']['id'],'name':_0x33d68b[_0x121b('0x55')][_0x121b('0x8')]};}_0x22e8a1[_0x121b('0x56')](_0x2b42f4);}}_0x406844({'count':_0x22e8a1[_0x121b('0x57')],'rows':_0x22e8a1});});},'VoiceChannels':function(_0x5a27a8){return new Promise(function(_0x9ed68,_0x4fc598){var _0x1c9333=_['values'](_0x34327c[_0x121b('0x58')]);_0x9ed68({'count':_0x1c9333['length'],'rows':_0x1c9333});});},'VoiceChannelMixMonitor':function(_0x388610){var _0x591d96=this;return new Promise(function(_0x17ad46,_0x58a4f8){if(ami[_0x121b('0x59')]()==![]){return _0x58a4f8(_0x591d96[_0x121b('0xf')](0x1f4,[config[_0x121b('0x10')]['ip'],config[_0x121b('0x10')][_0x121b('0x11')],_0x121b('0x12')][_0x121b('0x13')]('\x20')));}var _0x26eb04=schema(properties['voicechannel'])[_0x121b('0x3')](_0x388610);if(_0x26eb04[_0x121b('0x57')]>0x0){return _0x58a4f8(_0x591d96[_0x121b('0xf')](0x1f4,_[_0x121b('0x5a')](_0x26eb04,_0x121b('0x19'))[_0x121b('0x13')](',\x20')));}var _0xddd696=_['find'](_0x34327c['channels'],{'uniqueid':_0x388610[_0x121b('0x5b')]});if(_0xddd696&&_0xddd696['channel']){var _0x32f16d=util[_0x121b('0x5c')](_0x121b('0x5d'),_0x388610[_0x121b('0x5e')]||_0x388610[_0x121b('0x5b')],_0x388610['format']||'wav');return ami['Action']({'action':_0x121b('0x5f'),'channel':_0xddd696[_0x121b('0x60')],'file':_0x32f16d,'options':'ai(mixmonitorid)'})[_0x121b('0x61')](function(_0x3804fa){var _0x2a31d4=_['find'](_0xddd696[_0x121b('0x62')],{'filename':'/var/spool/asterisk/monitor/'+_0x32f16d[_0x121b('0x63')]()});if(_[_0x121b('0x64')](_0x2a31d4)){_0xddd696[_0x121b('0x62')][_0x121b('0x56')]({'filename':_0x121b('0x65')+_0x32f16d[_0x121b('0x63')](),'createdAt':moment()[_0x121b('0x5c')](_0x121b('0x66')),'mixmonitorid':_0x3804fa[_0x121b('0x67')],'status':_0x121b('0x68')});}else{_0x2a31d4[_0x121b('0x67')]=_0x3804fa['mixmonitorid'];_0x2a31d4['status']=_0x121b('0x68');}_0x17ad46({'code':0xc8,'message':[_0x388610[_0x121b('0x5b')],'MixMonitor\x20Success',_0x3804fa[_0x121b('0x67')]]['join']('\x20'),'mixmonitorid':_0x3804fa[_0x121b('0x67')]});})[_0x121b('0x1a')](function(_0x5f0b38){_0x58a4f8(_0x591d96[_0x121b('0xf')](0x1f5,[_0x388610[_0x121b('0x5b')],_0x5f0b38[_0x121b('0x19')][_0x121b('0x63')]()][_0x121b('0x13')]('\x20')));});}else{return _0x58a4f8(_0x591d96[_0x121b('0xf')](0x1f5,_0x121b('0x69')));}});},'VoiceChannelStopMixMonitor':function(_0x15630b){var _0x57b306=this;return new Promise(function(_0x545b2b,_0x1e9576){if(ami[_0x121b('0x59')]()==![]){return _0x1e9576(_0x57b306[_0x121b('0xf')](0x1f4,[config['asterisk']['ip'],config[_0x121b('0x10')][_0x121b('0x11')],_0x121b('0x12')][_0x121b('0x13')]('\x20')));}var _0x296651=schema(properties['voicechannel'])[_0x121b('0x3')](_0x15630b);if(_0x296651['length']>0x0){return _0x1e9576(_0x57b306[_0x121b('0xf')](0x1f4,_[_0x121b('0x5a')](_0x296651,_0x121b('0x19'))[_0x121b('0x13')](',\x20')));}var _0x5e6e86=_['find'](_0x34327c[_0x121b('0x58')],{'uniqueid':_0x15630b[_0x121b('0x5b')]});if(_0x5e6e86){return BPromise[_0x121b('0x6a')]()[_0x121b('0x61')](function(){if(_0x5e6e86['channel']){return ami['Action']({'action':_0x121b('0x6b'),'channel':_0x5e6e86[_0x121b('0x60')],'mixmonitorid':_0x15630b[_0x121b('0x67')]})[_0x121b('0x1a')](function(_0x3e3e13){});}})[_0x121b('0x61')](function(){if(_0x5e6e86['destinationchannel']){return ami[_0x121b('0x1d')]({'action':'StopMixMonitor','channel':_0x5e6e86[_0x121b('0x6c')],'mixmonitorid':_0x15630b[_0x121b('0x67')]})[_0x121b('0x1a')](function(_0x1aa55e){});}})[_0x121b('0x61')](function(_0x69370e){var _0x389834=_[_0x121b('0x6d')](_0x5e6e86['monitors'],{'mixmonitorid':_0x15630b[_0x121b('0x67')]});if(_0x389834){_0x389834[_0x121b('0x6e')]=_0x121b('0x6f');}})[_0x121b('0x61')](function(){var _0x26006f=util[_0x121b('0x5c')]('%s.%s',_0x15630b['filename']||_0x15630b[_0x121b('0x5b')],_0x15630b[_0x121b('0x5c')]||_0x121b('0x70'));var _0x27f8ab=_[_0x121b('0x6d')](_0x5e6e86['monitors'],{'filename':_0x121b('0x65')+_0x26006f[_0x121b('0x63')]()});if(_0x27f8ab){_0x27f8ab['status']=_0x121b('0x6f');}})[_0x121b('0x61')](function(){_0x545b2b({'code':0xc8,'message':[_0x15630b[_0x121b('0x5b')],_0x121b('0x71')][_0x121b('0x13')]('\x20')});})['catch'](function(_0x16bb53){_0x1e9576(_0x57b306['error'](0x1f5,[_0x15630b[_0x121b('0x5b')],_0x16bb53[_0x121b('0x19')][_0x121b('0x63')]()][_0x121b('0x13')]('\x20')));});}else{return _0x1e9576(_0x57b306[_0x121b('0xf')](0x1f5,_0x121b('0x69')));}});},'VoiceQueuesChannels':function(_0x3254e5){return new Promise(function(_0x3e0c69,_0x5f1060){var _0x36411f=_[_0x121b('0x72')](_0x34327c['queueChannels']);_0x3e0c69({'count':_0x36411f['length'],'rows':_0x36411f});});},'VoiceQueuesChannel':function(_0x196245){var _0x9497c2=this;return new Promise(function(_0x44ce3a,_0x159882){var _0x5eec05=schema(properties[_0x121b('0x73')])[_0x121b('0x3')](_0x196245);if(_0x5eec05[_0x121b('0x57')]>0x0){return _0x159882(_0x9497c2[_0x121b('0xf')](0x1f4,_[_0x121b('0x5a')](_0x5eec05,_0x121b('0x19'))[_0x121b('0x13')](',\x20')));}var _0x166a42=_['find'](_0x34327c[_0x121b('0x74')],{'uniqueid':_0x196245['uniqueid']});if(_0x166a42){_0x44ce3a(_0x166a42);}else{return _0x159882(_0x9497c2['error'](0x1f5,_0x121b('0x69')));}});},'VoiceQueuesChannelHangup':function(_0x1a14d6){var _0x4b3df7=this;return new Promise(function(_0x4f20f1,_0x61def0){if(ami[_0x121b('0x59')]()==![]){return _0x61def0(_0x4b3df7['error'](0x1f4,[config[_0x121b('0x10')]['ip'],config['asterisk'][_0x121b('0x11')],_0x121b('0x12')][_0x121b('0x13')]('\x20')));}var _0xdb698a=schema(properties[_0x121b('0x75')])[_0x121b('0x3')](_0x1a14d6);if(_0xdb698a['length']>0x0){return _0x61def0(_0x4b3df7[_0x121b('0xf')](0x1f4,_['map'](_0xdb698a,_0x121b('0x19'))['join'](',\x20')));}var _0x2833c6=_[_0x121b('0x6d')](_0x34327c['queueChannels'],{'uniqueid':_0x1a14d6[_0x121b('0x5b')]});if(_0x2833c6&&_0x2833c6[_0x121b('0x60')]){return ami[_0x121b('0x1d')]({'action':_0x121b('0x76'),'channel':_0x2833c6[_0x121b('0x60')]})[_0x121b('0x61')](function(_0x2c3513){_0x4f20f1({'code':0xc8,'message':[_0x1a14d6[_0x121b('0x5b')],_0x2c3513[_0x121b('0x19')][_0x121b('0x63')]()][_0x121b('0x13')]('\x20')});})[_0x121b('0x1a')](function(_0x4273c8){_0x61def0(_0x4b3df7[_0x121b('0xf')](0x1f5,[_0x1a14d6[_0x121b('0x5b')],_0x4273c8[_0x121b('0x19')][_0x121b('0x63')]()][_0x121b('0x13')]('\x20')));});}else{return _0x61def0(_0x4b3df7[_0x121b('0xf')](0x1f5,_0x121b('0x69')));}});},'VoiceQueuesChannelRedirect':function(_0x498101){var _0x46f70b=this;return new Promise(function(_0x27904e,_0x4d0b96){if(ami['isConnected']()==![]){return _0x4d0b96(_0x46f70b['error'](0x1f4,[config[_0x121b('0x10')]['ip'],config['asterisk'][_0x121b('0x11')],_0x121b('0x12')]['join']('\x20')));}var _0x543477=schema(properties['voicequeuechannelredirect'])[_0x121b('0x3')](_0x498101);if(_0x543477[_0x121b('0x57')]>0x0){return _0x4d0b96(_0x46f70b[_0x121b('0xf')](0x1f4,_['map'](_0x543477,_0x121b('0x19'))['join'](',\x20')));}var _0x52713f=_['find'](_0x34327c[_0x121b('0x74')],{'uniqueid':_0x498101[_0x121b('0x5b')]});if(_0x52713f&&_0x52713f[_0x121b('0x60')]){return ami[_0x121b('0x1d')]({'action':'Redirect','channel':_0x52713f[_0x121b('0x60')],'exten':_0x498101[_0x121b('0x77')],'context':_0x498101[_0x121b('0x78')]||_0x52713f[_0x121b('0x78')],'priority':0x1})['then'](function(_0x30fddc){_0x27904e({'code':0xc8,'message':[_0x498101[_0x121b('0x5b')],_0x30fddc['message'][_0x121b('0x63')]()]['join']('\x20')});})[_0x121b('0x1a')](function(_0x29c649){_0x4d0b96(_0x46f70b[_0x121b('0xf')](0x1f5,[_0x498101[_0x121b('0x5b')],_0x29c649[_0x121b('0x19')][_0x121b('0x63')]()]['join']('\x20')));});}else{return _0x4d0b96(_0x46f70b[_0x121b('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3f8aec){return new Promise(function(_0x4c41c7,_0x397bf0){var _0x383c72=_[_0x121b('0x72')](_0x34327c['agents']);_0x4c41c7({'count':_0x383c72[_0x121b('0x57')],'rows':_0x383c72});});},'Telephones':function(_0x170a2f){return new Promise(function(_0x50673e,_0x1dfe53){var _0x577594=_[_0x121b('0x72')](_0x34327c[_0x121b('0x79')]);_0x50673e({'count':_0x577594[_0x121b('0x57')],'rows':_0x577594});});},'Trunks':function(_0x2fd82a){return new Promise(function(_0xe48859,_0x1f074c){var _0x2a1be9=_[_0x121b('0x72')](_0x34327c[_0x121b('0x7a')]);_0xe48859({'count':_0x2a1be9['length'],'rows':_0x2a1be9});});},'OutboundChannels':function(_0x5e8183){return new Promise(function(_0x976285,_0x1668a9){var _0x34c8a1=_[_0x121b('0x72')](_0x34327c[_0x121b('0x7b')]);_0x976285({'count':_0x34c8a1['length'],'rows':_0x34c8a1});});},'Outbound':function(_0x4ddb4c){return new Promise(function(_0xac569b,_0x3e59f7){_0xac569b(_0x34327c[_0x121b('0x2d')]);});},'Campaigns':function(_0x306ffa){return new Promise(function(_0x274a32,_0x293c2f){var _0x444694=_['values'](_0x34327c[_0x121b('0x7c')]);_0x274a32({'count':_0x444694['length'],'rows':_0x444694});});},'VoiceQueuesPreview':function(_0x23b715){var _0xab0f4c=this;return new Promise(function(_0x2067b4,_0x3c3480){_0x375fa4[_0x121b('0x7d')](_0x23b715['id'])[_0x121b('0x61')](function(_0x4d5298){_0x2067b4({'code':0xc8,'message':_0x4d5298[_0x121b('0x19')]});})['catch'](function(_0x458a99){_0x3c3480(_0xab0f4c['error'](0x1f4,_0x458a99[_0x121b('0x19')]));});});},'EventManager':function(_0x4dda4f){var _0xf8ade8=this;return new Promise(function(_0x3cd19d,_0x5bd6ea){if(!_0x4dda4f[_0x121b('0x7e')]){return _0x5bd6ea(_0xf8ade8['error'](0x1f4,_0x121b('0x7f')));}ami[_0x121b('0x80')](_0x121b('0x81')+_0x4dda4f[_0x121b('0x7e')],_0x4dda4f[_0x121b('0x19')]);_0x3cd19d({'code':0xc8,'message':_0x4dda4f});});},'FaxAccounts':function(_0x2631b4){return new Promise(function(_0x710610,_0x3941df){var _0x539146=_['values'](_0x34327c[_0x121b('0x82')]);_0x710610({'count':_0x539146[_0x121b('0x57')],'rows':_0x539146});});},'SendFax':function(_0x14e729){var _0x4479d2=this;return new Promise(function(_0x1eb300,_0x9d8054){_0x5b785e[_0x121b('0x83')](_0x14e729)[_0x121b('0x61')](function(_0x4a03ec){_0x1eb300({'code':0xc8,'message':_0x4a03ec['message']});})[_0x121b('0x1a')](function(_0x270ec4){_0x9d8054(_0x4479d2['error'](0x1f4,_0x270ec4[_0x121b('0x19')]));});});},'CheckAfterSend':function(_0x5931cd){var _0x39f03c=this;return new Promise(function(_0x501b24,_0x398619){_0x5b785e[_0x121b('0x84')](_0x5931cd)[_0x121b('0x61')](function(_0xe67a6d){_0x501b24({'code':0xc8,'message':_0xe67a6d[_0x121b('0x19')]});})['catch'](function(_0x5e77b4){_0x398619(_0x39f03c['error'](0x1f4,_0x5e77b4[_0x121b('0x19')]));});});}};var _0x564109=jayson['server'](_0xafdcda)[_0x121b('0x85')]();_0x564109['on']('error',function(_0x58c4af){return _0x5f5c3a(_0x58c4af);});_0x564109[_0x121b('0x86')](0x232a,_0x121b('0x87'),function(){console[_0x121b('0x88')](_0x121b('0x89'),0x232a);return _0xc55aeb(_0x121b('0x8a')+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 5a32681..f539708 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 _0x0685=['redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid2','isEmpty','ListId','data3','$or','map','routeId','destcalleridnum','calleridnum','firstName','phone','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','[CM][%s][%s]\x20Autocreate\x20enabled','data4','isNil','calleridname','Unknown','destcalleridname','','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','trigger:%s','toLowerCase','merge','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact'];(function(_0x2e6dbf,_0x57dd06){var _0x2680e5=function(_0x4018f4){while(--_0x4018f4){_0x2e6dbf['push'](_0x2e6dbf['shift']());}};_0x2680e5(++_0x57dd06);}(_0x0685,0x1a1));var _0x5068=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0685[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x5068('0x0'));var BPromise=require('bluebird');var Redis=require(_0x5068('0x1'));var util=require(_0x5068('0x2'));var config=require(_0x5068('0x3'));var logger=require(_0x5068('0x4'))(_0x5068('0x5'));var cmContactRpc=require(_0x5068('0x6'));config[_0x5068('0x7')]=_['defaults'](config[_0x5068('0x7')],{'host':_0x5068('0x8'),'port':0x18eb});var io=require(_0x5068('0x9'))(new Redis(config['redis']));function emit(_0x2124d1,_0x4e09cb,_0x1adc1f,_0x54850d,_0x104c60){logger[_0x5068('0xa')](_0x5068('0xb'),_0x2124d1,_0x4e09cb['id'],_0x1adc1f,_0x54850d,JSON[_0x5068('0xc')](_0x104c60));io['to'](_0x1adc1f)[_0x5068('0xd')](_0x54850d,_0x104c60);}exports[_0x5068('0xe')]=function(_0xeb3515,_0x2a4610,_0x35c7d6,_0x17d3db){var _0x40ebb,_0x292955;var _0x458672={};var _0x5a1e01=Number(_0x35c7d6[_0x5068('0xf')]);var _0x5b226b=_0x35c7d6[_0x5068('0x10')]?Boolean(Number(_0x35c7d6['data2'])):![];if(_0x17d3db[_0x5068('0x11')]&&!_[_0x5068('0x12')](_0x17d3db[_0x5068('0x11')]))_0x458672['id']=_0x17d3db['xmd-contactid2'];if(!_0x458672['id']){_0x458672[_0x5068('0x13')]=_0x5a1e01;var _0x11667e=_0x35c7d6[_0x5068('0x14')]&&_0x35c7d6[_0x5068('0x14')]!=='0'?_0x35c7d6[_0x5068('0x14')]['split'](','):['phone'];_0x458672[_0x5068('0x15')]=_[_0x5068('0x16')](_0x11667e,function(_0x5343b8){var _0x38d2a4={};_0x38d2a4[_0x5343b8]=_0x17d3db[_0x5068('0x17')]?_0x17d3db[_0x5068('0x18')]:_0x17d3db[_0x5068('0x19')];return _0x38d2a4;});}var _0x3221b2=['id',_0x5068('0x1a'),'lastName',_0x5068('0x1b'),'mobile',_0x5068('0x1c'),_0x5068('0x13'),_0x5068('0x1d'),_0x5068('0x1e'),_0x5068('0x1f')];var _0x502d91=_[_0x5068('0x20')](_0x3221b2,_0x11667e);BPromise[_0x5068('0x21')]()[_0x5068('0x22')](cmContactRpc['getContacts']({'attributes':_0x502d91,'where':_0x458672}))[_0x5068('0x22')](function(_0x3b4cd6){_0x292955=_0x3b4cd6;if(!_[_0x5068('0x12')](_0x292955)){if(_0x292955['length']===0x1){_0x40ebb=_0x292955[0x0];logger[_0x5068('0xa')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x17d3db['uniqueid'],_0x2a4610['id'],_0x40ebb['id']);}else{logger[_0x5068('0xa')](_0x5068('0x23'),_0x17d3db[_0x5068('0x24')],_0x2a4610['id'],_[_0x5068('0x16')](_0x292955,'id')[_0x5068('0x25')](','));}return;}else{logger[_0x5068('0xa')](_0x5068('0x26'),_0x17d3db[_0x5068('0x24')],_0x2a4610['id']);if(_0x5b226b){logger[_0x5068('0xa')](_0x5068('0x27'),_0x17d3db[_0x5068('0x24')],_0x2a4610['id']);var _0x1e8f63=_0x35c7d6[_0x5068('0x28')]&&_0x35c7d6['data4']!=='0'?_0x35c7d6['data4']:_0x5068('0x1b');var _0x518251={'ListId':_0x5a1e01};_0x518251[_0x1e8f63]=_[_0x5068('0x29')](_0x17d3db[_0x5068('0x17')])?_0x17d3db['calleridnum']:_0x17d3db[_0x5068('0x18')];if(_[_0x5068('0x29')](_0x17d3db['routeId'])){_0x518251[_0x5068('0x1a')]=_0x17d3db['calleridname']&&_0x17d3db[_0x5068('0x2a')]!==''?_0x17d3db[_0x5068('0x2a')]:_0x5068('0x2b');}else{_0x518251['firstName']=_0x17d3db[_0x5068('0x2c')]&&_0x17d3db['destcalleridname']!==_0x5068('0x2d')?_0x17d3db[_0x5068('0x2c')]:_0x5068('0x2b');}return BPromise[_0x5068('0x21')]()['then'](cmContactRpc['createContact'](_0x518251))[_0x5068('0x22')](function(_0x15a4f6){_0x40ebb=_0x15a4f6;if(_0x40ebb){logger[_0x5068('0xa')](_0x5068('0x2e'),_0x17d3db[_0x5068('0x24')],_0x2a4610['id'],_0x40ebb['id']);}return;});}else{logger['info'](_0x5068('0x2f'),_0x17d3db[_0x5068('0x24')],_0x2a4610['id']);return;}}})[_0x5068('0x22')](function(){if(_0xeb3515){emit(_0x17d3db[_0x5068('0x24')],_0x2a4610,util[_0x5068('0x30')](_0x5068('0x31'),_0xeb3515['name']),util[_0x5068('0x30')](_0x5068('0x32'),_0x35c7d6['action'][_0x5068('0x33')]()),{'evt':_[_0x5068('0x34')](_0x17d3db,{'autoCreate':_0x5b226b}),'contact':_0x40ebb,'contacts':!_0x40ebb?_0x292955:undefined});}});}; \ No newline at end of file +var _0x237b=['bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data2','xmd-contactid2','isEmpty','data3','phone','$or','routeId','calleridnum','lastName','mobile','fax','ListId','createdAt','scheduledAt','updatedAt','union','resolve','then','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','[CM][%s][%s]\x20Autocreate\x20enabled','data4','isNil','firstName','calleridname','','destcalleridname','Unknown','createContact','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash'];(function(_0x25a7fd,_0x49f28a){var _0x253d56=function(_0x513861){while(--_0x513861){_0x25a7fd['push'](_0x25a7fd['shift']());}};_0x253d56(++_0x49f28a);}(_0x237b,0x112));var _0xb237=function(_0x473bfd,_0x1ae5d2){_0x473bfd=_0x473bfd-0x0;var _0x43b816=_0x237b[_0x473bfd];return _0x43b816;};'use strict';var _=require(_0xb237('0x0'));var BPromise=require(_0xb237('0x1'));var Redis=require(_0xb237('0x2'));var util=require(_0xb237('0x3'));var config=require(_0xb237('0x4'));var logger=require(_0xb237('0x5'))(_0xb237('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0xb237('0x7')]=_[_0xb237('0x8')](config[_0xb237('0x7')],{'host':_0xb237('0x9'),'port':0x18eb});var io=require(_0xb237('0xa'))(new Redis(config[_0xb237('0x7')]));function emit(_0x1be4cf,_0x2d5055,_0x13c678,_0x7031a3,_0x52b08f){logger[_0xb237('0xb')](_0xb237('0xc'),_0x1be4cf,_0x2d5055['id'],_0x13c678,_0x7031a3,JSON[_0xb237('0xd')](_0x52b08f));io['to'](_0x13c678)[_0xb237('0xe')](_0x7031a3,_0x52b08f);}exports['exec']=function(_0xe599ac,_0x384fb1,_0x199ddd,_0x3ae565){var _0x4a9ce2,_0x273ec4;var _0x262263={};var _0x43de33=Number(_0x199ddd['data1']);var _0x9327a3=_0x199ddd[_0xb237('0xf')]?Boolean(Number(_0x199ddd[_0xb237('0xf')])):![];if(_0x3ae565[_0xb237('0x10')]&&!_[_0xb237('0x11')](_0x3ae565['xmd-contactid2']))_0x262263['id']=_0x3ae565[_0xb237('0x10')];if(!_0x262263['id']){_0x262263['ListId']=_0x43de33;var _0x54c586=_0x199ddd[_0xb237('0x12')]&&_0x199ddd['data3']!=='0'?_0x199ddd[_0xb237('0x12')]['split'](','):[_0xb237('0x13')];_0x262263[_0xb237('0x14')]=_['map'](_0x54c586,function(_0xdb5752){var _0x1a4f2e={};_0x1a4f2e[_0xdb5752]=_0x3ae565[_0xb237('0x15')]?_0x3ae565['destcalleridnum']:_0x3ae565[_0xb237('0x16')];return _0x1a4f2e;});}var _0xfb8ec4=['id','firstName',_0xb237('0x17'),_0xb237('0x13'),_0xb237('0x18'),_0xb237('0x19'),_0xb237('0x1a'),_0xb237('0x1b'),_0xb237('0x1c'),_0xb237('0x1d')];var _0xdc7f30=_[_0xb237('0x1e')](_0xfb8ec4,_0x54c586);BPromise[_0xb237('0x1f')]()[_0xb237('0x20')](cmContactRpc['getContacts']({'attributes':_0xdc7f30,'where':_0x262263}))['then'](function(_0x527324){_0x273ec4=_0x527324;if(!_[_0xb237('0x11')](_0x273ec4)){if(_0x273ec4['length']===0x1){_0x4a9ce2=_0x273ec4[0x0];logger['info'](_0xb237('0x21'),_0x3ae565[_0xb237('0x22')],_0x384fb1['id'],_0x4a9ce2['id']);}else{logger[_0xb237('0xb')](_0xb237('0x23'),_0x3ae565[_0xb237('0x22')],_0x384fb1['id'],_['map'](_0x273ec4,'id')[_0xb237('0x24')](','));}return;}else{logger[_0xb237('0xb')](_0xb237('0x25'),_0x3ae565['uniqueid'],_0x384fb1['id']);if(_0x9327a3){logger[_0xb237('0xb')](_0xb237('0x26'),_0x3ae565['uniqueid'],_0x384fb1['id']);var _0x17ab77=_0x199ddd['data4']&&_0x199ddd[_0xb237('0x27')]!=='0'?_0x199ddd[_0xb237('0x27')]:'phone';var _0x17dd4a={'ListId':_0x43de33};_0x17dd4a[_0x17ab77]=_['isNil'](_0x3ae565['routeId'])?_0x3ae565[_0xb237('0x16')]:_0x3ae565['destcalleridnum'];if(_[_0xb237('0x28')](_0x3ae565[_0xb237('0x15')])){_0x17dd4a[_0xb237('0x29')]=_0x3ae565[_0xb237('0x2a')]&&_0x3ae565[_0xb237('0x2a')]!==_0xb237('0x2b')?_0x3ae565[_0xb237('0x2a')]:'Unknown';}else{_0x17dd4a[_0xb237('0x29')]=_0x3ae565['destcalleridname']&&_0x3ae565[_0xb237('0x2c')]!==_0xb237('0x2b')?_0x3ae565['destcalleridname']:_0xb237('0x2d');}return BPromise[_0xb237('0x1f')]()[_0xb237('0x20')](cmContactRpc[_0xb237('0x2e')](_0x17dd4a))[_0xb237('0x20')](function(_0x54faff){_0x4a9ce2=_0x54faff;if(_0x4a9ce2){logger['info'](_0xb237('0x2f'),_0x3ae565[_0xb237('0x22')],_0x384fb1['id'],_0x4a9ce2['id']);}return;});}else{logger[_0xb237('0xb')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x3ae565[_0xb237('0x22')],_0x384fb1['id']);return;}}})[_0xb237('0x20')](function(){if(_0xe599ac){emit(_0x3ae565[_0xb237('0x22')],_0x384fb1,util[_0xb237('0x30')](_0xb237('0x31'),_0xe599ac[_0xb237('0x32')]),util[_0xb237('0x30')](_0xb237('0x33'),_0x199ddd[_0xb237('0x34')][_0xb237('0x35')]()),{'evt':_[_0xb237('0x36')](_0x3ae565,{'autoCreate':_0x9327a3}),'contact':_0x4a9ce2,'contacts':!_0x4a9ce2?_0x273ec4:undefined});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 54507ca..d18e7af 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 _0x26be=['trigger:%s:%s','jscripty','trigger:%s','exec','integration','queue','parse','query','search','checkTrigger','every','AllConditions','channel','AnyConditions','some','checkConditions','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','agent','membername','lastevent','routeId','lodash','mustache','ioredis','./urlforward','./script','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:rejectmessage','emit','info','stringify','prototype','checkTriggers','interface','hasOwnProperty','merge','variables','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','data1','popup','TemplateId','data2','html','render','template\x20not\x20found','url','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','data6','winApplication','winArguments','format','user:%s','name'];(function(_0x467bb1,_0x584cad){var _0x341a35=function(_0x3aded3){while(--_0x3aded3){_0x467bb1['push'](_0x467bb1['shift']());}};_0x341a35(++_0x584cad);}(_0x26be,0x108));var _0xe26b=function(_0x54b936,_0x145d9c){_0x54b936=_0x54b936-0x0;var _0x5d0201=_0x26be[_0x54b936];return _0x5d0201;};'use strict';var util=require('util');var _=require(_0xe26b('0x0'));var url=require('url');var Mustache=require(_0xe26b('0x1'));var Redis=require(_0xe26b('0x2'));var urlforward=require(_0xe26b('0x3'));var integration=require('./integration');var cmContact=require('./cmContact');var script=require(_0xe26b('0x4'));var config=require(_0xe26b('0x5'));var logger=require(_0xe26b('0x6'))('trigger');var ami=require(_0xe26b('0x7'));config[_0xe26b('0x8')]=_[_0xe26b('0x9')](config['redis'],{'host':_0xe26b('0xa'),'port':0x18eb});var io=require(_0xe26b('0xb'))(new Redis(config[_0xe26b('0x8')]));var operators={'equals':function(_0x176e23,_0x5c0a71){return _0x176e23==_0x5c0a71;},'not_equals':function(_0x230dd6,_0x1f2196){return _0x230dd6!=_0x1f2196;}};var barAndWebActions=['popup','url',_0xe26b('0xc')];function Trigger(_0x268485){this[_0xe26b('0xd')]=_0x268485[_0xe26b('0xd')];this[_0xe26b('0xe')]=_0x268485['agents'];this[_0xe26b('0xf')]=_0x268485[_0xe26b('0xf')];this[_0xe26b('0x10')]=_0x268485[_0xe26b('0x10')];this[_0xe26b('0x11')]=_0x268485['voiceExtensions'];this['zendeskAccounts']=_0x268485[_0xe26b('0x12')];this[_0xe26b('0x13')]=_0x268485['freshdeskAccounts'];this[_0xe26b('0x14')]=_0x268485[_0xe26b('0x14')];this[_0xe26b('0x15')]=_0x268485[_0xe26b('0x15')];this[_0xe26b('0x16')]=_0x268485[_0xe26b('0x16')];this[_0xe26b('0x17')]=_0x268485[_0xe26b('0x17')];this[_0xe26b('0x18')]=_0x268485['vtigerAccounts'];this[_0xe26b('0x19')]=_0x268485[_0xe26b('0x19')];this['dynamics365Accounts']=_0x268485[_0xe26b('0x1a')];this[_0xe26b('0x1b')]=_0x268485[_0xe26b('0x1b')];this[_0xe26b('0x1c')]={'zendesk':this[_0xe26b('0x12')],'salesforce':this[_0xe26b('0x14')],'freshdesk':this[_0xe26b('0x13')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this['zohoAccounts'],'desk':this[_0xe26b('0x17')],'vtiger':this['vtigerAccounts'],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xe26b('0x1b')],'servicenow':this[_0xe26b('0x19')]};ami['on'](_0xe26b('0x1d'),this[_0xe26b('0x1e')]['bind'](this));ami['on'](_0xe26b('0x1f'),this['syncCustomEvent'][_0xe26b('0x20')](this));ami['on'](_0xe26b('0x21'),this[_0xe26b('0x1e')][_0xe26b('0x20')](this));ami['on']('custom:agentcomplete',this[_0xe26b('0x1e')][_0xe26b('0x20')](this));ami['on'](_0xe26b('0x22'),this[_0xe26b('0x1e')]['bind'](this));ami['on'](_0xe26b('0x23'),this[_0xe26b('0x1e')][_0xe26b('0x20')](this));ami['on'](_0xe26b('0x24'),this['syncCustomEvent'][_0xe26b('0x20')](this));ami['on'](_0xe26b('0x25'),this[_0xe26b('0x1e')][_0xe26b('0x20')](this));ami['on'](_0xe26b('0x26'),this[_0xe26b('0x1e')][_0xe26b('0x20')](this));ami['on'](_0xe26b('0x27'),this['syncCustomEvent']['bind'](this));ami['on'](_0xe26b('0x28'),this[_0xe26b('0x1e')][_0xe26b('0x20')](this));ami['on'](_0xe26b('0x29'),this[_0xe26b('0x2a')][_0xe26b('0x20')](this));ami['on'](_0xe26b('0x2b'),this[_0xe26b('0x2a')][_0xe26b('0x20')](this));ami['on']('custom:dialend',this[_0xe26b('0x2a')]['bind'](this));ami['on'](_0xe26b('0x2c'),this[_0xe26b('0x1e')][_0xe26b('0x20')](this));ami['on'](_0xe26b('0x2d'),this[_0xe26b('0x1e')][_0xe26b('0x20')](this));ami['on'](_0xe26b('0x2e'),this[_0xe26b('0x1e')][_0xe26b('0x20')](this));ami['on']('custom:outgoingmessage',this[_0xe26b('0x1e')][_0xe26b('0x20')](this));ami['on']('custom:acceptmessage',this['syncCustomEvent'][_0xe26b('0x20')](this));ami['on'](_0xe26b('0x2f'),this['syncCustomEvent']['bind'](this));}Trigger['prototype'][_0xe26b('0x30')]=function(_0x30875d,_0x3437e9,_0x483fa0){logger[_0xe26b('0x31')](_0x30875d,_0x3437e9,JSON[_0xe26b('0x32')](_0x483fa0));io['to'](_0x30875d)[_0xe26b('0x30')](_0x3437e9,_0x483fa0);};Trigger[_0xe26b('0x33')][_0xe26b('0x1e')]=function(_0x24f031){var _0x452e1b=_['clone'](_0x24f031);this[_0xe26b('0x34')](_0x452e1b);};Trigger[_0xe26b('0x33')][_0xe26b('0x2a')]=function(_0xa7fcb0){if(this[_0xe26b('0xe')][_0xa7fcb0[_0xe26b('0x35')]]){this[_0xe26b('0x1e')](_0xa7fcb0);}};Trigger[_0xe26b('0x33')]['checkTriggers']=function(_0x26e9c4){var _0x41e98d;for(var _0x3b12b8 in this[_0xe26b('0xd')]){if(this[_0xe26b('0xd')][_0xe26b('0x36')](_0x3b12b8)){if(this[_0xe26b('0xd')][_0x3b12b8]['status']){_0x41e98d=this['checkTrigger'](this['triggers'][_0x3b12b8],_0x26e9c4);if(_0x41e98d){_[_0xe26b('0x37')](_0x26e9c4,_0x26e9c4[_0xe26b('0x38')]);for(var _0x3f1950=0x0,_0x5bab6b,_0x5dbf21,_0x5094be;_0x3f19500x0){_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(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 d85696c..c446981 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 _0xc263=['https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\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...','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','password','clientSecret','then','error',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','info','toUpperCase',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','username','userId','catch','message','outbound','contacts','/systemusers(','odata-entityid','substring','lastIndexOf','toLowerCase','destcalleridnum','calleridnum','telephone1','contactid','enduserId','type','customField','indexOf','content','ticketType','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecalls','queue','callDirection','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/'];(function(_0x1820f1,_0x1403e7){var _0x167aed=function(_0x4c89f5){while(--_0x4c89f5){_0x1820f1['push'](_0x1820f1['shift']());}};_0x167aed(++_0x1403e7);}(_0xc263,0xd0));var _0x3c26=function(_0x364670,_0x5592fb){_0x364670=_0x364670-0x0;var _0xaf309d=_0xc263[_0x364670];return _0xaf309d;};'use strict';var _=require(_0x3c26('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var util=require(_0x3c26('0x1'));var intUtil=require(_0x3c26('0x2'));var md5=require(_0x3c26('0x3'));var Redis=require(_0x3c26('0x4'));var logger=require(_0x3c26('0x5'))(_0x3c26('0x6'));var config=require(_0x3c26('0x7'));config[_0x3c26('0x8')]=_[_0x3c26('0x9')](config['redis'],{'host':_0x3c26('0xa'),'port':0x18eb});var io=require(_0x3c26('0xb'))(new Redis(config[_0x3c26('0x8')]));function getAuthToken(_0x21f115,_0x3783db,_0x450225){var _0xc2c846={'method':_0x3c26('0xc'),'uri':_0x3783db,'form':{'client_id':_0x21f115[_0x3c26('0xd')],'resource':_0x21f115[_0x3c26('0xe')],'username':_0x21f115['username'],'password':_0x21f115[_0x3c26('0xf')],'grant_type':_0x3c26('0xf'),'client_secret':_0x21f115[_0x3c26('0x10')]},'json':!![]};return rp(_0xc2c846)[_0x3c26('0x11')](function(_0x57382e){return _0x57382e['access_token'];})['catch'](function(_0x2ef4e8){logger[_0x3c26('0x12')]('['+[_0x450225['toUpperCase']()]+_0x3c26('0x13'));return _0x2ef4e8['message'];});}function getUser(_0x398a93,_0x4a70f7,_0x257270,_0x2fba62,_0x4e5aea,_0x220018){return new BPromise(function(_0x698f20,_0x4eee79){return getAuthToken(_0x4a70f7,_0x2fba62,_0x220018)[_0x3c26('0x11')](function(_0x2a165f){var _0x35a9fb={'method':_0x3c26('0x14'),'uri':_0x4e5aea+_0x3c26('0x15'),'headers':{'Authorization':_0x3c26('0x16')+_0x2a165f,'OData-Version':_0x3c26('0x17')},'json':!![]};return rp(_0x35a9fb);})[_0x3c26('0x11')](function(_0x45c413){var _0x1d4226=_0x45c413[_0x3c26('0x18')];var _0x1c2b4b=![];var _0x40d4e0=null;if(!_['isNil'](_0x257270)){if(intUtil[_0x3c26('0x19')](_0x257270[_0x3c26('0x1a')])){_0x398a93['userEmail']=_0x257270['email'];for(_0x40d4e0=0x0;_0x40d4e0<_0x1d4226[_0x3c26('0x1b')];_0x40d4e0++){if(_0x1d4226[_0x40d4e0][_0x3c26('0x1c')]===_0x257270['email']&&!_0x1d4226[_0x40d4e0][_0x3c26('0x1d')]){_0x1c2b4b=!![];logger['info']('['+[_0x220018['toUpperCase']()]+_0x3c26('0x1e')+_0x1d4226[_0x40d4e0][_0x3c26('0x1f')]+'!');_0x398a93['userId']=_0x1d4226[_0x40d4e0][_0x3c26('0x1f')];}}}}if(!_0x1c2b4b){logger[_0x3c26('0x20')]('['+[_0x220018[_0x3c26('0x21')]()]+_0x3c26('0x22'));_0x398a93[_0x3c26('0x23')]=_0x4a70f7[_0x3c26('0x24')];for(_0x40d4e0=0x0;_0x40d4e0<_0x1d4226[_0x3c26('0x1b')];_0x40d4e0++){if(_0x1d4226[_0x40d4e0][_0x3c26('0x1c')]===_0x4a70f7[_0x3c26('0x24')]){_0x398a93[_0x3c26('0x25')]=_0x1d4226[_0x40d4e0][_0x3c26('0x1f')];}}}_0x698f20(_0x398a93);})[_0x3c26('0x26')](function(_0x15b766){_0x4eee79(_0x15b766[_0x3c26('0x27')]);});});}function createEndUser(_0x59712f,_0x10b535,_0x1c0c29,_0x4a113a,_0x346d0e,_0x1dae7f){return new BPromise(function(_0x3de72c,_0x26dd32){return getAuthToken(_0x10b535,_0x1c0c29,_0x1dae7f)[_0x3c26('0x11')](function(_0x190615){var _0x49f9f8=_0x1dae7f['toLowerCase']()===_0x3c26('0x28')?_0x346d0e['destcalleridnum']:_0x346d0e['calleridnum'];var _0x265b40={'method':_0x3c26('0xc'),'uri':_0x4a113a+_0x3c26('0x29'),'body':{'telephone1':_0x49f9f8,'fullname':_0x49f9f8,'firstname':_0x49f9f8,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3c26('0x2a')+_0x59712f['userId']+')'},'headers':{'Authorization':_0x3c26('0x16')+_0x190615,'OData-Version':_0x3c26('0x17')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x265b40);})[_0x3c26('0x11')](function(_0x1da75e){var _0x5e2447=_0x1da75e['headers'][_0x3c26('0x2b')];var _0x318969=_0x5e2447[_0x3c26('0x2c')](_0x5e2447[_0x3c26('0x2d')]('(')+0x1,_0x5e2447[_0x3c26('0x2d')](')'));_0x59712f['enduserId']=_0x318969;_0x3de72c(_0x59712f);})[_0x3c26('0x26')](function(_0x2480b3){_0x26dd32(_0x2480b3[_0x3c26('0x27')]);});});}function getEndUser(_0x349b72,_0x58aa19,_0x4bb3d8,_0x10d124,_0x2de214,_0x5bef97){return new BPromise(function(_0x5b5259,_0x289e6e){return getAuthToken(_0x58aa19,_0x4bb3d8,_0x5bef97)['then'](function(_0x4cf559){var _0xeb8402={'method':'GET','uri':_0x10d124+'contacts?$select=telephone1','headers':{'Authorization':'Bearer\x20'+_0x4cf559,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xeb8402);})[_0x3c26('0x11')](function(_0x5c8b64){var _0x519890=null;if(_0x5c8b64){var _0x58814d=_0x5c8b64[_0x3c26('0x18')];var _0x2f97cc=![];for(_0x519890=0x0;_0x519890<_0x58814d[_0x3c26('0x1b')];_0x519890++){var _0x18b011=_0x5bef97[_0x3c26('0x2e')]()===_0x3c26('0x28')?_0x2de214[_0x3c26('0x2f')]:_0x2de214[_0x3c26('0x30')];if(_0x58814d[_0x519890][_0x3c26('0x31')]===_0x18b011){_0x2f97cc=!![];_0x349b72['enduserId']=_0x58814d[_0x519890][_0x3c26('0x32')];}}if(_0x2f97cc){_0x5b5259(_0x349b72);}else{return createEndUser(_0x349b72,_0x58aa19,_0x4bb3d8,_0x10d124,_0x2de214,_0x5bef97)['then'](function(_0x4e5308){logger[_0x3c26('0x20')]('['+[_0x5bef97[_0x3c26('0x21')]()]+']\x20Enduser\x20created!',_0x4e5308[_0x3c26('0x33')]);_0x5b5259(_0x4e5308);});}}else{return createEndUser(_0x349b72,_0x58aa19,_0x4bb3d8,_0x10d124,_0x2de214,_0x5bef97)[_0x3c26('0x11')](function(_0x58b2e4){logger[_0x3c26('0x20')]('['+[_0x5bef97['toUpperCase']()]+']\x20Enduser\x20Created!',_0x58b2e4[_0x3c26('0x33')]);_0x5b5259(_0x58b2e4);});}});});}function getCustomFields(_0x4ed14a,_0x391b4e,_0x49ccb2){var _0x2cd266={};if(_0x4ed14a[_0x3c26('0x1b')]>0x0){_['forEach'](_0x4ed14a,function(_0x200467){if(_0x200467[_0x3c26('0x34')]==='string'&&_0x200467['nameField']&&!_0x200467[_0x3c26('0x35')]){var _0x30873b=_0x200467['idField'][_0x3c26('0x2e')]();var _0x13cd8d=_0x30873b[_0x3c26('0x2c')](0x0,_0x30873b[_0x3c26('0x36')]('_'));var _0x4e533d=_0x30873b[_0x3c26('0x2c')](_0x30873b[_0x3c26('0x36')]('_')+0x1);if(_0x13cd8d===_0x49ccb2){_0x2cd266[_0x4e533d]=_0x200467[_0x3c26('0x37')];}}});}return _0x2cd266;}function getTicket(_0x34d7f8,_0x342fb8,_0x580ea2,_0x49e613,_0x4f8372,_0xe6b503,_0x250fdf){return new BPromise(function(_0x36adcf,_0x5079b3){var _0x15f0d7;return getAuthToken(_0x342fb8,_0x580ea2,_0x250fdf)[_0x3c26('0x11')](function(_0x498cc1){if(_0xe6b503[_0x3c26('0x38')]==='incident'){_0x15f0d7={'method':_0x3c26('0xc'),'uri':_0x49e613+'incidents','body':Object[_0x3c26('0x39')]({},{'title':intUtil[_0x3c26('0x3a')](_0xe6b503[_0x3c26('0x3b')],_0x4f8372,'\x20'),'description':intUtil['getString'](_0xe6b503[_0x3c26('0x3c')],_0x4f8372,'\x0a'),'customerid_contact@odata.bind':_0x3c26('0x3d')+_0x34d7f8[_0x3c26('0x33')]+')','ownerid@odata.bind':_0x3c26('0x2a')+_0x34d7f8['userId']+')','caseorigincode':'1'},getCustomFields(_0xe6b503[_0x3c26('0x3e')],_0x4f8372,_0xe6b503[_0x3c26('0x38')])),'headers':{'Authorization':_0x3c26('0x16')+_0x498cc1,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0xe6b503[_0x3c26('0x38')]==='phonecall'){_0x15f0d7={'method':_0x3c26('0xc'),'uri':_0x49e613+_0x3c26('0x3f'),'body':Object[_0x3c26('0x39')]({},{'subject':intUtil[_0x3c26('0x3a')](_0xe6b503[_0x3c26('0x3b')],_0x4f8372,'\x20'),'phonenumber':String(_0x4f8372[_0x3c26('0x30')]),'description':intUtil[_0x3c26('0x3a')](_0xe6b503[_0x3c26('0x3c')],_0x4f8372,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3c26('0x3d')+_0x34d7f8['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x34d7f8['userId']+')','directioncode':_0x34d7f8['callDirection']===_0x3c26('0x40')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x3c26('0x2a')+_0x34d7f8[_0x3c26('0x25')]+')','participationtypemask':_0x34d7f8[_0x3c26('0x41')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x3c26('0x3d')+_0x34d7f8[_0x3c26('0x33')]+')','participationtypemask':_0x34d7f8[_0x3c26('0x41')]===_0x3c26('0x40')?0x1:0x2}]},getCustomFields(_0xe6b503[_0x3c26('0x3e')],_0x4f8372,_0xe6b503[_0x3c26('0x38')])),'headers':{'Authorization':'Bearer\x20'+_0x498cc1,'OData-Version':_0x3c26('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x15f0d7);})[_0x3c26('0x11')](function(_0x4f570e){var _0x5c50e4=_0x4f570e['headers'][_0x3c26('0x2b')];var _0x3762a2=_0x5c50e4[_0x3c26('0x2c')](_0x5c50e4['lastIndexOf']('(')+0x1,_0x5c50e4[_0x3c26('0x2d')](')'));_0x34d7f8['ticketId']=_0x3762a2;_0x36adcf(_0x34d7f8);})[_0x3c26('0x26')](function(_0x508025){_0x5079b3(_0x508025['message']);});});}function emit(_0x65526,_0x2b2347,_0x310c7e,_0x1dd7ac){var _0x116808={'uri':util['format'](_0x3c26('0x42'),_0x65526,_0x310c7e,_0x1dd7ac)};io['to'](util[_0x3c26('0x43')]('user:%s',_0x2b2347))[_0x3c26('0x44')](_0x3c26('0x45'),_0x116808);}exports['cs']=function(_0x1d7c55,_0x4bb4db,_0x5ed3e2,_0x182cf8,_0x3457cd,_0x509447,_0x54a318,_0x328b0a){var _0x2a23cc={};_0x509447['remoteUri']=intUtil[_0x3c26('0x46')](_0x509447[_0x3c26('0xe')]);_0x509447[_0x3c26('0x47')]=intUtil[_0x3c26('0x46')](_0x509447[_0x3c26('0x47')]);_0x2a23cc['callDirection']=_0x328b0a===_0x3c26('0x40')||_0x328b0a===_0x3c26('0x48')?'queue':_0x3c26('0x28');var _0xb2460a=util[_0x3c26('0x43')](_0x3c26('0x49'),_0x509447[_0x3c26('0xe')]);var _0x49e8d2=util[_0x3c26('0x43')](_0x3c26('0x4a'),_0x509447['tenantId']);var _0x1708e3=util[_0x3c26('0x43')](_0x3c26('0x4b'),_0x509447[_0x3c26('0x47')],_0x4bb4db[_0x3c26('0x4c')],md5(_0x4bb4db['uniqueid']));if(_0x3457cd&&_0x3457cd[_0x3c26('0x4d')]){logger[_0x3c26('0x20')](_0x3c26('0x4e'),_0x3c26('0x4f'));_0x4bb4db[_0x3c26('0x50')]=_0x1708e3;}else if(_0x54a318&&_0x54a318[_0x3c26('0x51')]&&_0x54a318['recordingFormat']!==_0x3c26('0x52')){logger[_0x3c26('0x20')](_0x3c26('0x53'),_0x3c26('0x4f'));_0x4bb4db[_0x3c26('0x50')]=_0x1708e3;}else{_0x4bb4db[_0x3c26('0x50')]='';}return getUser(_0x2a23cc,_0x509447,_0x182cf8,_0x49e8d2,_0xb2460a,_0x328b0a)['then'](function(_0x259f51){logger[_0x3c26('0x20')]('['+_0x328b0a[_0x3c26('0x21')]()+_0x3c26('0x54'),_0x259f51[_0x3c26('0x25')]);logger[_0x3c26('0x20')]('['+_0x328b0a[_0x3c26('0x21')]()+_0x3c26('0x55'),_0x259f51['userEmail']);return getEndUser(_0x259f51,_0x509447,_0x49e8d2,_0xb2460a,_0x4bb4db,_0x328b0a);})[_0x3c26('0x11')](function(_0x5b8d56){logger[_0x3c26('0x20')]('['+_0x328b0a[_0x3c26('0x21')]()+_0x3c26('0x56'),_0x5b8d56['enduserId']);logger[_0x3c26('0x20')]('['+_0x328b0a[_0x3c26('0x21')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x4bb4db[_0x3c26('0x30')]);return getTicket(_0x5b8d56,_0x509447,_0x49e8d2,_0xb2460a,_0x4bb4db,_0x5ed3e2,_0x328b0a);})[_0x3c26('0x11')](function(_0x1974fe){logger[_0x3c26('0x20')](util[_0x3c26('0x43')]('['+_0x328b0a[_0x3c26('0x21')]()+_0x3c26('0x57'),_0x5ed3e2[_0x3c26('0x38')],_0x1974fe['ticketId']));logger[_0x3c26('0x20')](util[_0x3c26('0x43')]('['+_0x328b0a[_0x3c26('0x21')]()+_0x3c26('0x58'),_0x328b0a));if(_0x328b0a!=='unmanaged'){logger[_0x3c26('0x20')]('['+_0x328b0a['toUpperCase']()+']',_0x3c26('0x59'));emit(_0x509447[_0x3c26('0xe')],_0x182cf8[_0x3c26('0x5a')],_0x5ed3e2[_0x3c26('0x38')],_0x1974fe[_0x3c26('0x5b')]);}})[_0x3c26('0x26')](function(_0x8d648){logger['error']('['+_0x328b0a['toUpperCase']()+_0x3c26('0x5c'),util[_0x3c26('0x5d')](_0x8d648,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5c59=['odata-entityid','substring','lastIndexOf','GET','contacts?$select=telephone1','toLowerCase','destcalleridnum','telephone1','enduserId','contactid',']\x20Enduser\x20created!','string','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','phonecalls','calleridnum','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','request-promise','util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','length','internalemailaddress','isdisabled','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','outbound','contacts','/systemusers(','headers'];(function(_0x2a18b7,_0x5041c8){var _0x45e74e=function(_0x1d32d6){while(--_0x1d32d6){_0x2a18b7['push'](_0x2a18b7['shift']());}};_0x45e74e(++_0x5041c8);}(_0x5c59,0x96));var _0x95c5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5c59[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var rp=require(_0x95c5('0x0'));var util=require(_0x95c5('0x1'));var intUtil=require('./util');var md5=require(_0x95c5('0x2'));var Redis=require(_0x95c5('0x3'));var logger=require(_0x95c5('0x4'))('dynamics365');var config=require(_0x95c5('0x5'));config[_0x95c5('0x6')]=_['defaults'](config['redis'],{'host':_0x95c5('0x7'),'port':0x18eb});var io=require(_0x95c5('0x8'))(new Redis(config[_0x95c5('0x6')]));function getAuthToken(_0x532503,_0x29441c,_0x40ca08){var _0x91b9ea={'method':_0x95c5('0x9'),'uri':_0x29441c,'form':{'client_id':_0x532503[_0x95c5('0xa')],'resource':_0x532503[_0x95c5('0xb')],'username':_0x532503[_0x95c5('0xc')],'password':_0x532503[_0x95c5('0xd')],'grant_type':_0x95c5('0xd'),'client_secret':_0x532503[_0x95c5('0xe')]},'json':!![]};return rp(_0x91b9ea)[_0x95c5('0xf')](function(_0x370a58){return _0x370a58[_0x95c5('0x10')];})[_0x95c5('0x11')](function(_0x13a42f){logger[_0x95c5('0x12')]('['+[_0x40ca08[_0x95c5('0x13')]()]+_0x95c5('0x14'));return _0x13a42f[_0x95c5('0x15')];});}function getUser(_0x5024d4,_0xe2d79c,_0x5b45f4,_0x206bcb,_0x38aa43,_0x296000){return new BPromise(function(_0x2cf42b,_0x1ae92a){return getAuthToken(_0xe2d79c,_0x206bcb,_0x296000)[_0x95c5('0xf')](function(_0x19df83){var _0xfb59ae={'method':'GET','uri':_0x38aa43+_0x95c5('0x16'),'headers':{'Authorization':_0x95c5('0x17')+_0x19df83,'OData-Version':_0x95c5('0x18')},'json':!![]};return rp(_0xfb59ae);})[_0x95c5('0xf')](function(_0x4379a8){var _0x3e2832=_0x4379a8[_0x95c5('0x19')];var _0x193a0f=![];var _0x56bea1=null;if(!_['isNil'](_0x5b45f4)){if(intUtil[_0x95c5('0x1a')](_0x5b45f4[_0x95c5('0x1b')])){_0x5024d4['userEmail']=_0x5b45f4[_0x95c5('0x1b')];for(_0x56bea1=0x0;_0x56bea1<_0x3e2832[_0x95c5('0x1c')];_0x56bea1++){if(_0x3e2832[_0x56bea1][_0x95c5('0x1d')]===_0x5b45f4['email']&&!_0x3e2832[_0x56bea1][_0x95c5('0x1e')]){_0x193a0f=!![];logger['info']('['+[_0x296000[_0x95c5('0x13')]()]+']\x20Agent\x20found\x20'+_0x3e2832[_0x56bea1][_0x95c5('0x1f')]+'!');_0x5024d4[_0x95c5('0x20')]=_0x3e2832[_0x56bea1][_0x95c5('0x1f')];}}}}if(!_0x193a0f){logger[_0x95c5('0x21')]('['+[_0x296000[_0x95c5('0x13')]()]+_0x95c5('0x22'));_0x5024d4[_0x95c5('0x23')]=_0xe2d79c[_0x95c5('0xc')];for(_0x56bea1=0x0;_0x56bea1<_0x3e2832['length'];_0x56bea1++){if(_0x3e2832[_0x56bea1][_0x95c5('0x1d')]===_0xe2d79c[_0x95c5('0xc')]){_0x5024d4[_0x95c5('0x20')]=_0x3e2832[_0x56bea1]['systemuserid'];}}}_0x2cf42b(_0x5024d4);})['catch'](function(_0x1c3eba){_0x1ae92a(_0x1c3eba[_0x95c5('0x15')]);});});}function createEndUser(_0x551d71,_0x414bee,_0x541f25,_0xbbf1f9,_0x1e3b4f,_0x3befb9){return new BPromise(function(_0xcb53f,_0x12b1f3){return getAuthToken(_0x414bee,_0x541f25,_0x3befb9)['then'](function(_0x270995){var _0x24c31f=_0x3befb9['toLowerCase']()===_0x95c5('0x24')?_0x1e3b4f['destcalleridnum']:_0x1e3b4f['calleridnum'];var _0x5486ce={'method':_0x95c5('0x9'),'uri':_0xbbf1f9+_0x95c5('0x25'),'body':{'telephone1':_0x24c31f,'fullname':_0x24c31f,'firstname':_0x24c31f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x95c5('0x26')+_0x551d71['userId']+')'},'headers':{'Authorization':_0x95c5('0x17')+_0x270995,'OData-Version':_0x95c5('0x18')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5486ce);})[_0x95c5('0xf')](function(_0x31d2cc){var _0x4e9f84=_0x31d2cc[_0x95c5('0x27')][_0x95c5('0x28')];var _0x25ef36=_0x4e9f84[_0x95c5('0x29')](_0x4e9f84[_0x95c5('0x2a')]('(')+0x1,_0x4e9f84[_0x95c5('0x2a')](')'));_0x551d71['enduserId']=_0x25ef36;_0xcb53f(_0x551d71);})['catch'](function(_0x28d40e){_0x12b1f3(_0x28d40e['message']);});});}function getEndUser(_0x1ea25b,_0x1fe3ec,_0x47f34a,_0x30ec3d,_0x2f64f4,_0x23dd12){return new BPromise(function(_0x1d9cbf,_0x1656a3){return getAuthToken(_0x1fe3ec,_0x47f34a,_0x23dd12)[_0x95c5('0xf')](function(_0x2ac4f3){var _0x4020d5={'method':_0x95c5('0x2b'),'uri':_0x30ec3d+_0x95c5('0x2c'),'headers':{'Authorization':_0x95c5('0x17')+_0x2ac4f3,'If-None-Match':null,'OData-Version':_0x95c5('0x18')},'json':!![]};return rp(_0x4020d5);})[_0x95c5('0xf')](function(_0x5c4219){var _0x11db82=null;if(_0x5c4219){var _0x4497e7=_0x5c4219[_0x95c5('0x19')];var _0x3e20f6=![];for(_0x11db82=0x0;_0x11db82<_0x4497e7[_0x95c5('0x1c')];_0x11db82++){var _0x56d63f=_0x23dd12[_0x95c5('0x2d')]()==='outbound'?_0x2f64f4[_0x95c5('0x2e')]:_0x2f64f4['calleridnum'];if(_0x4497e7[_0x11db82][_0x95c5('0x2f')]===_0x56d63f){_0x3e20f6=!![];_0x1ea25b[_0x95c5('0x30')]=_0x4497e7[_0x11db82][_0x95c5('0x31')];}}if(_0x3e20f6){_0x1d9cbf(_0x1ea25b);}else{return createEndUser(_0x1ea25b,_0x1fe3ec,_0x47f34a,_0x30ec3d,_0x2f64f4,_0x23dd12)[_0x95c5('0xf')](function(_0x558a47){logger[_0x95c5('0x21')]('['+[_0x23dd12['toUpperCase']()]+_0x95c5('0x32'),_0x558a47[_0x95c5('0x30')]);_0x1d9cbf(_0x558a47);});}}else{return createEndUser(_0x1ea25b,_0x1fe3ec,_0x47f34a,_0x30ec3d,_0x2f64f4,_0x23dd12)[_0x95c5('0xf')](function(_0x2b7c5e){logger['info']('['+[_0x23dd12['toUpperCase']()]+']\x20Enduser\x20Created!',_0x2b7c5e['enduserId']);_0x1d9cbf(_0x2b7c5e);});}});});}function getCustomFields(_0x595c26,_0x560074,_0x38d524){var _0x263abb={};if(_0x595c26['length']>0x0){_['forEach'](_0x595c26,function(_0x542ec1){if(_0x542ec1['type']===_0x95c5('0x33')&&_0x542ec1[_0x95c5('0x34')]&&!_0x542ec1[_0x95c5('0x35')]){var _0x1da2c4=_0x542ec1[_0x95c5('0x36')]['toLowerCase']();var _0x183305=_0x1da2c4[_0x95c5('0x29')](0x0,_0x1da2c4[_0x95c5('0x37')]('_'));var _0xdeae7d=_0x1da2c4[_0x95c5('0x29')](_0x1da2c4[_0x95c5('0x37')]('_')+0x1);if(_0x183305===_0x38d524){_0x263abb[_0xdeae7d]=_0x542ec1[_0x95c5('0x38')];}}});}return _0x263abb;}function getTicket(_0x3579ff,_0x3462cb,_0x2d97d3,_0x58da17,_0x398ecd,_0x459451,_0x18c08b){return new BPromise(function(_0x1ada9f,_0x4a494d){var _0x40d5e4;return getAuthToken(_0x3462cb,_0x2d97d3,_0x18c08b)[_0x95c5('0xf')](function(_0x2118cb){if(_0x459451[_0x95c5('0x39')]===_0x95c5('0x3a')){_0x40d5e4={'method':_0x95c5('0x9'),'uri':_0x58da17+_0x95c5('0x3b'),'body':Object[_0x95c5('0x3c')]({},{'title':intUtil[_0x95c5('0x3d')](_0x459451[_0x95c5('0x3e')],_0x398ecd,'\x20'),'description':intUtil[_0x95c5('0x3d')](_0x459451[_0x95c5('0x3f')],_0x398ecd,'\x0a'),'customerid_contact@odata.bind':_0x95c5('0x40')+_0x3579ff[_0x95c5('0x30')]+')','ownerid@odata.bind':_0x95c5('0x26')+_0x3579ff['userId']+')','caseorigincode':'1'},getCustomFields(_0x459451[_0x95c5('0x41')],_0x398ecd,_0x459451[_0x95c5('0x39')])),'headers':{'Authorization':_0x95c5('0x17')+_0x2118cb,'OData-Version':_0x95c5('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x459451[_0x95c5('0x39')]===_0x95c5('0x42')){_0x40d5e4={'method':_0x95c5('0x9'),'uri':_0x58da17+_0x95c5('0x43'),'body':Object[_0x95c5('0x3c')]({},{'subject':intUtil[_0x95c5('0x3d')](_0x459451[_0x95c5('0x3e')],_0x398ecd,'\x20'),'phonenumber':String(_0x398ecd[_0x95c5('0x44')]),'description':intUtil[_0x95c5('0x3d')](_0x459451[_0x95c5('0x3f')],_0x398ecd,'\x0a'),'regardingobjectid_contact@odata.bind':_0x95c5('0x40')+_0x3579ff[_0x95c5('0x30')]+')','ownerid@odata.bind':_0x95c5('0x26')+_0x3579ff[_0x95c5('0x20')]+')','directioncode':_0x3579ff[_0x95c5('0x45')]===_0x95c5('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x95c5('0x26')+_0x3579ff[_0x95c5('0x20')]+')','participationtypemask':_0x3579ff['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x95c5('0x40')+_0x3579ff[_0x95c5('0x30')]+')','participationtypemask':_0x3579ff['callDirection']===_0x95c5('0x46')?0x1:0x2}]},getCustomFields(_0x459451[_0x95c5('0x41')],_0x398ecd,_0x459451[_0x95c5('0x39')])),'headers':{'Authorization':_0x95c5('0x17')+_0x2118cb,'OData-Version':_0x95c5('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x40d5e4);})[_0x95c5('0xf')](function(_0x568a40){var _0x4fd36e=_0x568a40['headers'][_0x95c5('0x28')];var _0x5a3c38=_0x4fd36e[_0x95c5('0x29')](_0x4fd36e[_0x95c5('0x2a')]('(')+0x1,_0x4fd36e[_0x95c5('0x2a')](')'));_0x3579ff[_0x95c5('0x47')]=_0x5a3c38;_0x1ada9f(_0x3579ff);})[_0x95c5('0x11')](function(_0x251151){_0x4a494d(_0x251151['message']);});});}function emit(_0x15062f,_0x32c3df,_0xd9c0bd,_0x5c7575){var _0x36798d={'uri':util[_0x95c5('0x48')](_0x95c5('0x49'),_0x15062f,_0xd9c0bd,_0x5c7575)};io['to'](util[_0x95c5('0x48')](_0x95c5('0x4a'),_0x32c3df))[_0x95c5('0x4b')](_0x95c5('0x4c'),_0x36798d);}exports['cs']=function(_0x293435,_0x1212c2,_0x14ddc9,_0x4f85fe,_0x56b9db,_0xac4fd5,_0xf68070,_0x1176c0){var _0x274529={};_0xac4fd5[_0x95c5('0xb')]=intUtil[_0x95c5('0x4d')](_0xac4fd5['remoteUri']);_0xac4fd5[_0x95c5('0x4e')]=intUtil[_0x95c5('0x4d')](_0xac4fd5[_0x95c5('0x4e')]);_0x274529[_0x95c5('0x45')]=_0x1176c0==='queue'||_0x1176c0==='unmanaged'?'queue':_0x95c5('0x24');var _0x5e4bad=util[_0x95c5('0x48')]('%s/api/data/v9.0/',_0xac4fd5['remoteUri']);var _0x5931dd=util[_0x95c5('0x48')]('https://login.microsoftonline.com/%s/oauth2/token',_0xac4fd5['tenantId']);var _0x2fdddd=util['format'](_0x95c5('0x4f'),_0xac4fd5[_0x95c5('0x4e')],_0x1212c2['uniqueid'],md5(_0x1212c2[_0x95c5('0x50')]));if(_0x56b9db&&_0x56b9db['monitor_format']){logger[_0x95c5('0x21')](_0x95c5('0x51'),_0x95c5('0x52'));_0x1212c2[_0x95c5('0x53')]=_0x2fdddd;}else if(_0xf68070&&_0xf68070[_0x95c5('0x54')]&&_0xf68070[_0x95c5('0x54')]!=='none'){logger[_0x95c5('0x21')](_0x95c5('0x55'),_0x95c5('0x52'));_0x1212c2[_0x95c5('0x53')]=_0x2fdddd;}else{_0x1212c2[_0x95c5('0x53')]='';}return getUser(_0x274529,_0xac4fd5,_0x4f85fe,_0x5931dd,_0x5e4bad,_0x1176c0)[_0x95c5('0xf')](function(_0x58b552){logger[_0x95c5('0x21')]('['+_0x1176c0[_0x95c5('0x13')]()+_0x95c5('0x56'),_0x58b552[_0x95c5('0x20')]);logger[_0x95c5('0x21')]('['+_0x1176c0[_0x95c5('0x13')]()+']\x20The\x20User\x20email\x20is:',_0x58b552[_0x95c5('0x23')]);return getEndUser(_0x58b552,_0xac4fd5,_0x5931dd,_0x5e4bad,_0x1212c2,_0x1176c0);})[_0x95c5('0xf')](function(_0x582b44){logger['info']('['+_0x1176c0[_0x95c5('0x13')]()+_0x95c5('0x57'),_0x582b44[_0x95c5('0x30')]);logger[_0x95c5('0x21')]('['+_0x1176c0[_0x95c5('0x13')]()+_0x95c5('0x58'),_0x1212c2['calleridnum']);return getTicket(_0x582b44,_0xac4fd5,_0x5931dd,_0x5e4bad,_0x1212c2,_0x14ddc9,_0x1176c0);})[_0x95c5('0xf')](function(_0x41a7e9){logger[_0x95c5('0x21')](util['format']('['+_0x1176c0[_0x95c5('0x13')]()+_0x95c5('0x59'),_0x14ddc9['ticketType'],_0x41a7e9[_0x95c5('0x47')]));logger[_0x95c5('0x21')](util[_0x95c5('0x48')]('['+_0x1176c0[_0x95c5('0x13')]()+_0x95c5('0x5a'),_0x1176c0));if(_0x1176c0!==_0x95c5('0x5b')){logger[_0x95c5('0x21')]('['+_0x1176c0[_0x95c5('0x13')]()+']',_0x95c5('0x5c'));emit(_0xac4fd5[_0x95c5('0xb')],_0x4f85fe[_0x95c5('0x5d')],_0x14ddc9[_0x95c5('0x39')],_0x41a7e9['ticketId']);}})['catch'](function(_0x59ef16){logger[_0x95c5('0x12')]('['+_0x1176c0[_0x95c5('0x13')]()+_0x95c5('0x5e'),util['inspect'](_0x59ef16,{'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 06760cb..584fc4a 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 _0xcd56=['user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','[OUTBOUND]','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','localhost','socket.io-emitter','redis','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','Subjects','getString','Descriptions','Tags','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','format','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','apiKey','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','type','nameField','toLowerCase','content','string','idField','push','variable','variableName','customField','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','Authorization','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x5641a8,_0x379bce){var _0x16a23d=function(_0x287f2e){while(--_0x287f2e){_0x5641a8['push'](_0x5641a8['shift']());}};_0x16a23d(++_0x379bce);}(_0xcd56,0x6c));var _0x6cd5=function(_0x11d466,_0x1d2fb6){_0x11d466=_0x11d466-0x0;var _0x26f82e=_0xcd56[_0x11d466];return _0x26f82e;};'use strict';var _=require(_0x6cd5('0x0'));var rp=require(_0x6cd5('0x1'));var md5=require(_0x6cd5('0x2'));var util=require('util');var Redis=require(_0x6cd5('0x3'));var intUtil=require(_0x6cd5('0x4'));var config=require(_0x6cd5('0x5'));var logger=require(_0x6cd5('0x6'))(_0x6cd5('0x7'));config['redis']=_['defaults'](config['redis'],{'host':_0x6cd5('0x8'),'port':0x18eb});var io=require(_0x6cd5('0x9'))(new Redis(config[_0x6cd5('0xa')]));var headers={'Content-Type':'application/json','Accept':_0x6cd5('0xb')};function emit(_0x4c4233,_0x140fb7,_0x5ac133){io['to'](_0x4c4233)[_0x6cd5('0xc')](_0x140fb7,_0x5ac133);}function getTicket(_0x1aa303,_0x4166fd,_0x223901,_0x22eb12,_0x353bf8){logger[_0x6cd5('0xd')](_0x6cd5('0xe'));var _0x191fa2=_[_0x6cd5('0xf')]({'responder_id':_0x4166fd['id'],'requester_id':_0x223901['id'],'name':util['format'](_0x6cd5('0x10'),_0x353bf8[_0x6cd5('0x11')]),'phone':_0x353bf8['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x22eb12[_0x6cd5('0x12')],_0x353bf8,'\x20'),'description':intUtil[_0x6cd5('0x13')](_0x22eb12[_0x6cd5('0x14')],_0x353bf8,'
'),'tags':getTags(_0x22eb12[_0x6cd5('0x15')],_0x6cd5('0x16'))},getCustomFields(_0x22eb12[_0x6cd5('0x17')],_0x353bf8));_0x191fa2[_0x6cd5('0x18')]=_['mapValues'](_[_0x6cd5('0x19')](_0x191fa2[_0x6cd5('0x18')],'id'),_0x6cd5('0x1a'));return request({'uri':util['format'](_0x6cd5('0x1b'),_0x1aa303[_0x6cd5('0x1c')]),'method':'POST','body':_0x191fa2})[_0x6cd5('0x1d')](function(_0x2c7985){logger[_0x6cd5('0xd')](_0x6cd5('0x1e'));return _0x2c7985;});}function getUser(_0x35b0ea,_0x3ccbbd){if(intUtil['validateEmail'](_0x3ccbbd)){return request({'uri':util[_0x6cd5('0x1f')](_0x6cd5('0x20'),_0x35b0ea[_0x6cd5('0x1c')]),'qs':{'email':_0x3ccbbd}})[_0x6cd5('0x1d')](function(_0x1b47ad){if(_0x1b47ad[_0x6cd5('0x21')]){logger[_0x6cd5('0xd')](_0x6cd5('0x22'));return _[_0x6cd5('0x23')](_0x1b47ad,function(_0x1b07cf){return _0x1b07cf[_0x6cd5('0x24')][_0x6cd5('0x25')]===_0x3ccbbd;});}else{logger[_0x6cd5('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x6cd5('0x1f')](_0x6cd5('0x26'),_0x35b0ea[_0x6cd5('0x1c')])})['then'](function(_0x239252){logger[_0x6cd5('0xd')](_0x6cd5('0x27'));return _0x239252;});}});}else{logger[_0x6cd5('0xd')](_0x6cd5('0x28'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x35b0ea[_0x6cd5('0x1c')])})[_0x6cd5('0x1d')](function(_0xb09d94){logger['info'](_0x6cd5('0x27'));return _0xb09d94;});}}function getEndUser(_0x407ee1,_0x419ff9,_0x2ff6cb){logger[_0x6cd5('0xd')]('Searching\x20enduser\x20with\x20phone',_0x2ff6cb);return request({'uri':util[_0x6cd5('0x1f')]('%s/api/v2/contacts',_0x407ee1[_0x6cd5('0x1c')]),'qs':{'phone':_0x2ff6cb}})[_0x6cd5('0x1d')](function(_0x51a873){if(_0x51a873[_0x6cd5('0x21')]){logger[_0x6cd5('0xd')](_0x6cd5('0x29'));return _['find'](_0x51a873,{'phone':_0x2ff6cb});}else{logger[_0x6cd5('0xd')](_0x6cd5('0x2a'));return request({'uri':util['format']('%s/api/v2/contacts',_0x407ee1[_0x6cd5('0x1c')]),'method':_0x6cd5('0x2b'),'body':{'name':_0x419ff9,'phone':_0x2ff6cb}})[_0x6cd5('0x1d')](function(_0x3c48cc){logger[_0x6cd5('0xd')]('Enduser\x20created.');return _0x3c48cc;});}});}function getAuth(_0x3e7004){return util['format']('Basic\x20%s',new Buffer(_0x3e7004[_0x6cd5('0x2c')]+':X')[_0x6cd5('0x2d')](_0x6cd5('0x2e')));}function request(_0x1e684f){logger[_0x6cd5('0x2f')](_0x6cd5('0x30'),JSON[_0x6cd5('0x31')](_0x1e684f));return rp(_[_0x6cd5('0x32')](_0x1e684f,{'method':_0x6cd5('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x40f345,_0x201fdc){var _0x50f20b=[];if(_0x40f345&&_0x40f345[_0x6cd5('0x21')]>0x0){_0x50f20b=_[_0x6cd5('0x34')](_0x40f345,_0x201fdc);}return _0x50f20b;}function getCustomFields(_0xd3efa1,_0x3b0321){var _0x413964=[];var _0x1c13a5={'custom_fields':[]};if(_0xd3efa1[_0x6cd5('0x21')]>0x0){_[_0x6cd5('0x35')](_0xd3efa1,function(_0x26afe0){if(_0x26afe0[_0x6cd5('0x36')]==='string'&&_0x26afe0[_0x6cd5('0x37')]&&!_0x26afe0['customField']){_0x1c13a5[_0x26afe0[_0x6cd5('0x37')][_0x6cd5('0x38')]()]=_0x26afe0[_0x6cd5('0x39')][_0x6cd5('0x2d')]();}else if(_0x26afe0[_0x6cd5('0x36')]===_0x6cd5('0x3a')&&_0x26afe0[_0x6cd5('0x3b')]&&_0x26afe0['customField']){_0x1c13a5[_0x6cd5('0x18')][_0x6cd5('0x3c')]({'id':_0x26afe0['idField'],'value':_0x26afe0['content'][_0x6cd5('0x2d')]()});}else if(_0x26afe0[_0x6cd5('0x36')]===_0x6cd5('0x3d')&&_0x26afe0[_0x6cd5('0x3e')]&&_0x26afe0[_0x6cd5('0x3b')]&&_0x26afe0[_0x6cd5('0x3f')]){_0x3b0321[_0x26afe0[_0x6cd5('0x3e')]]&&_0x1c13a5[_0x6cd5('0x18')]['push']({'id':_0x26afe0['idField'],'value':_0x3b0321[_0x26afe0['variableName']][_0x6cd5('0x2d')]()});}else if(_0x26afe0[_0x6cd5('0x36')]===_0x6cd5('0x40')&&_0x26afe0[_0x6cd5('0x41')]&&_0x26afe0[_0x6cd5('0x41')][_0x6cd5('0x16')]&&_0x26afe0[_0x6cd5('0x3b')]&&_0x26afe0[_0x6cd5('0x3f')]){_0x3b0321[_0x26afe0[_0x6cd5('0x41')]['name'][_0x6cd5('0x38')]()]&&_0x1c13a5['custom_fields']['push']({'id':_0x26afe0['idField'],'value':_0x3b0321[_0x26afe0[_0x6cd5('0x41')][_0x6cd5('0x16')][_0x6cd5('0x38')]()][_0x6cd5('0x2d')]()});}});}return _0x1c13a5;}exports['queue']=function(_0x4c11d1,_0x439bcd,_0x5d4ef7,_0x1aeafb,_0x3dd956,_0x411797){var _0x3a353a,_0x10ce9d;_0x411797[_0x6cd5('0x1c')]=intUtil[_0x6cd5('0x42')](_0x411797['remoteUri']);_0x411797[_0x6cd5('0x43')]=intUtil[_0x6cd5('0x42')](_0x411797['serverUrl']);if(_0x3dd956&&_0x3dd956[_0x6cd5('0x44')]){logger[_0x6cd5('0xd')]('[QUEUE]',_0x6cd5('0x45'));_0x439bcd['recordingURL']=util[_0x6cd5('0x1f')](_0x6cd5('0x46'),_0x411797['serverUrl'],_0x439bcd['uniqueid'],md5(_0x439bcd['uniqueid']));}else{_0x439bcd[_0x6cd5('0x47')]='';}headers[_0x6cd5('0x48')]=getAuth(_0x411797);return getUser(_0x411797,_0x1aeafb[_0x6cd5('0x25')])[_0x6cd5('0x1d')](function(_0x526770){_0x3a353a=_0x526770;logger[_0x6cd5('0xd')]('The\x20User\x20ID\x20is:',_0x3a353a['id']);return getEndUser(_0x411797,_0x439bcd['calleridname'],_0x439bcd[_0x6cd5('0x49')]);})[_0x6cd5('0x1d')](function(_0x36c5ac){_0x10ce9d=_0x36c5ac;logger[_0x6cd5('0xd')](_0x6cd5('0x4a'),_0x10ce9d['id']);return getTicket(_0x411797,_0x3a353a,_0x10ce9d,_0x5d4ef7,_0x439bcd);})['then'](function(_0x3a17c0){if(_0x3a17c0&&_0x3a17c0['id']){logger[_0x6cd5('0xd')](_0x6cd5('0x1e'));logger[_0x6cd5('0xd')](_0x6cd5('0x4b'),_0x3a17c0['id']);logger[_0x6cd5('0xd')](_0x6cd5('0x4c'),_0x6cd5('0x4d'));emit(util['format'](_0x6cd5('0x4e'),_0x1aeafb[_0x6cd5('0x16')]),_0x6cd5('0x4f'),{'uri':util['format'](_0x6cd5('0x50'),_0x411797[_0x6cd5('0x1c')],_0x3a17c0['id'])});}})[_0x6cd5('0x51')](function(_0x24e468){logger[_0x6cd5('0x52')](_0x6cd5('0x4c'),JSON[_0x6cd5('0x31')](_0x24e468));});};exports[_0x6cd5('0x53')]=function(_0x387779,_0x970829,_0x1db815,_0x4da367,_0x320063,_0x401523,_0x5d23aa){var _0x1b36d4,_0x3cfa6f;_0x401523[_0x6cd5('0x1c')]=intUtil[_0x6cd5('0x42')](_0x401523[_0x6cd5('0x1c')]);_0x401523[_0x6cd5('0x43')]=intUtil['stripTrailingSlash'](_0x401523[_0x6cd5('0x43')]);if(_0x5d23aa&&_0x5d23aa[_0x6cd5('0x54')]&&_0x5d23aa[_0x6cd5('0x54')]!==_0x6cd5('0x55')){logger[_0x6cd5('0xd')]('[OUTBOUND]',_0x6cd5('0x45'));_0x970829[_0x6cd5('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x401523[_0x6cd5('0x43')],_0x970829['uniqueid'],md5(_0x970829[_0x6cd5('0x56')]));}headers[_0x6cd5('0x48')]=getAuth(_0x401523);return getUser(_0x401523,_0x4da367[_0x6cd5('0x25')])[_0x6cd5('0x1d')](function(_0x5daa79){_0x1b36d4=_0x5daa79;logger['info'](_0x6cd5('0x57'),_0x1b36d4['id']);return getEndUser(_0x401523,_0x970829[_0x6cd5('0x58')],_0x970829['destcalleridnum']);})[_0x6cd5('0x1d')](function(_0x5ea5aa){_0x3cfa6f=_0x5ea5aa;logger[_0x6cd5('0xd')]('The\x20Enduser\x20ID\x20is:',_0x3cfa6f['id']);return getTicket(_0x401523,_0x1b36d4,_0x3cfa6f,_0x1db815,_0x970829);})['then'](function(_0x1f55de){if(_0x1f55de&&_0x1f55de['id']){logger[_0x6cd5('0xd')](_0x6cd5('0x1e'));logger['info'](_0x6cd5('0x4b'),_0x1f55de['id']);logger[_0x6cd5('0xd')](_0x6cd5('0x59'),_0x6cd5('0x4d'));emit(util[_0x6cd5('0x1f')](_0x6cd5('0x4e'),_0x4da367[_0x6cd5('0x16')]),_0x6cd5('0x4f'),{'uri':util[_0x6cd5('0x1f')](_0x6cd5('0x50'),_0x401523[_0x6cd5('0x1c')],_0x1f55de['id'])});}})['catch'](function(_0x184067){logger['error'](_0x6cd5('0x59'),JSON[_0x6cd5('0x31')](_0x184067));});};exports[_0x6cd5('0x5a')]=function(_0x22c347,_0x5ddc93,_0x3501a6,_0x581012,_0x180262,_0x28eec9){var _0x85cf80,_0x13a639;_0x28eec9['remoteUri']=intUtil[_0x6cd5('0x42')](_0x28eec9['remoteUri']);_0x28eec9[_0x6cd5('0x43')]=intUtil['stripTrailingSlash'](_0x28eec9[_0x6cd5('0x43')]);if(_0x180262&&_0x180262['monitor_format']){logger[_0x6cd5('0xd')]('['+_0x5ddc93[_0x6cd5('0x5b')][_0x6cd5('0x5c')]()+']',_0x6cd5('0x45'));_0x5ddc93['recordingURL']=util[_0x6cd5('0x1f')](_0x6cd5('0x46'),_0x28eec9['serverUrl'],_0x5ddc93[_0x6cd5('0x56')],md5(_0x5ddc93[_0x6cd5('0x56')]));}else{_0x5ddc93['recordingURL']='';}headers['Authorization']=getAuth(_0x28eec9);return getUser(_0x28eec9,'')[_0x6cd5('0x1d')](function(_0x266491){_0x85cf80=_0x266491;logger[_0x6cd5('0xd')](_0x6cd5('0x57'),_0x85cf80['id']);return getEndUser(_0x28eec9,_0x5ddc93[_0x6cd5('0x11')],_0x5ddc93['calleridnum']);})[_0x6cd5('0x1d')](function(_0x114301){_0x13a639=_0x114301;logger['info'](_0x6cd5('0x4a'),_0x13a639['id']);return getTicket(_0x28eec9,_0x85cf80,_0x13a639,_0x3501a6,_0x5ddc93);})['then'](function(_0x2aedca){if(_0x2aedca){logger[_0x6cd5('0xd')](_0x6cd5('0x1e'));logger['info'](_0x6cd5('0x4b'),_0x2aedca['id']);}})['catch'](function(_0x4ca16d){logger[_0x6cd5('0x52')]('['+_0x5ddc93[_0x6cd5('0x5b')]['toUpperCase']()+']',JSON[_0x6cd5('0x31')](_0x4ca16d));});}; \ No newline at end of file +var _0xbc4a=['queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','Authorization','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','lastevent','toUpperCase','request-promise','md5','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','
','Tags','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','length','find','Enduser\x20created.','apiKey','base64','debug','[HTTP]','stringify','GET','forEach','type','string','nameField','customField','toLowerCase','content','toString','idField','push','variableName','customVariable','Variable','name'];(function(_0x21cada,_0x38bd4a){var _0x107f81=function(_0x48be7c){while(--_0x48be7c){_0x21cada['push'](_0x21cada['shift']());}};_0x107f81(++_0x38bd4a);}(_0xbc4a,0x175));var _0xabc4=function(_0x19e940,_0x52ce43){_0x19e940=_0x19e940-0x0;var _0x3a3bcf=_0xbc4a[_0x19e940];return _0x3a3bcf;};'use strict';var _=require('lodash');var rp=require(_0xabc4('0x0'));var md5=require(_0xabc4('0x1'));var util=require(_0xabc4('0x2'));var Redis=require(_0xabc4('0x3'));var intUtil=require(_0xabc4('0x4'));var config=require(_0xabc4('0x5'));var logger=require('../../../../config/logger')(_0xabc4('0x6'));config[_0xabc4('0x7')]=_[_0xabc4('0x8')](config[_0xabc4('0x7')],{'host':_0xabc4('0x9'),'port':0x18eb});var io=require(_0xabc4('0xa'))(new Redis(config[_0xabc4('0x7')]));var headers={'Content-Type':_0xabc4('0xb'),'Accept':'application/json'};function emit(_0x72dcd3,_0x2d4625,_0x317723){io['to'](_0x72dcd3)['emit'](_0x2d4625,_0x317723);}function getTicket(_0x328469,_0x18ba3e,_0x21e459,_0x1e23f9,_0x298dc8){logger[_0xabc4('0xc')](_0xabc4('0xd'));var _0x577331=_[_0xabc4('0xe')]({'responder_id':_0x18ba3e['id'],'requester_id':_0x21e459['id'],'name':util[_0xabc4('0xf')](_0xabc4('0x10'),_0x298dc8[_0xabc4('0x11')]),'phone':_0x298dc8[_0xabc4('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xabc4('0x13')](_0x1e23f9['Subjects'],_0x298dc8,'\x20'),'description':intUtil[_0xabc4('0x13')](_0x1e23f9['Descriptions'],_0x298dc8,_0xabc4('0x14')),'tags':getTags(_0x1e23f9[_0xabc4('0x15')],'name')},getCustomFields(_0x1e23f9[_0xabc4('0x16')],_0x298dc8));_0x577331[_0xabc4('0x17')]=_[_0xabc4('0x18')](_[_0xabc4('0x19')](_0x577331[_0xabc4('0x17')],'id'),_0xabc4('0x1a'));return request({'uri':util['format'](_0xabc4('0x1b'),_0x328469[_0xabc4('0x1c')]),'method':_0xabc4('0x1d'),'body':_0x577331})[_0xabc4('0x1e')](function(_0x4c4fcd){logger['info'](_0xabc4('0x1f'));return _0x4c4fcd;});}function getUser(_0x17765c,_0x1fcb63){if(intUtil[_0xabc4('0x20')](_0x1fcb63)){return request({'uri':util['format'](_0xabc4('0x21'),_0x17765c[_0xabc4('0x1c')]),'qs':{'email':_0x1fcb63}})[_0xabc4('0x1e')](function(_0x1f1e19){if(_0x1f1e19['length']){logger['info']('Agent\x20found!');return _['find'](_0x1f1e19,function(_0x4fdb36){return _0x4fdb36[_0xabc4('0x22')]['email']===_0x1fcb63;});}else{logger[_0xabc4('0xc')](_0xabc4('0x23'));return request({'uri':util[_0xabc4('0xf')](_0xabc4('0x24'),_0x17765c['remoteUri'])})[_0xabc4('0x1e')](function(_0x5e53b2){logger[_0xabc4('0xc')](_0xabc4('0x25'));return _0x5e53b2;});}});}else{logger[_0xabc4('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/api/v2/agents/me',_0x17765c[_0xabc4('0x1c')])})['then'](function(_0x34020f){logger[_0xabc4('0xc')]('Admin\x20account\x20selected.');return _0x34020f;});}}function getEndUser(_0x3e5017,_0x2200b0,_0xf4bea0){logger[_0xabc4('0xc')]('Searching\x20enduser\x20with\x20phone',_0xf4bea0);return request({'uri':util[_0xabc4('0xf')](_0xabc4('0x26'),_0x3e5017[_0xabc4('0x1c')]),'qs':{'phone':_0xf4bea0}})[_0xabc4('0x1e')](function(_0x294e9b){if(_0x294e9b[_0xabc4('0x27')]){logger[_0xabc4('0xc')]('Enduser\x20found!');return _[_0xabc4('0x28')](_0x294e9b,{'phone':_0xf4bea0});}else{logger[_0xabc4('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xabc4('0xf')](_0xabc4('0x26'),_0x3e5017[_0xabc4('0x1c')]),'method':_0xabc4('0x1d'),'body':{'name':_0x2200b0,'phone':_0xf4bea0}})['then'](function(_0x396b38){logger[_0xabc4('0xc')](_0xabc4('0x29'));return _0x396b38;});}});}function getAuth(_0x4d33d5){return util[_0xabc4('0xf')]('Basic\x20%s',new Buffer(_0x4d33d5[_0xabc4('0x2a')]+':X')['toString'](_0xabc4('0x2b')));}function request(_0xdc808f){logger[_0xabc4('0x2c')](_0xabc4('0x2d'),JSON[_0xabc4('0x2e')](_0xdc808f));return rp(_[_0xabc4('0x8')](_0xdc808f,{'method':_0xabc4('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x4535f4,_0x3e29bf){var _0x42f39e=[];if(_0x4535f4&&_0x4535f4[_0xabc4('0x27')]>0x0){_0x42f39e=_['map'](_0x4535f4,_0x3e29bf);}return _0x42f39e;}function getCustomFields(_0x22df7d,_0x203a2e){var _0x4b423c=[];var _0x1ace91={'custom_fields':[]};if(_0x22df7d[_0xabc4('0x27')]>0x0){_[_0xabc4('0x30')](_0x22df7d,function(_0x25067a){if(_0x25067a[_0xabc4('0x31')]===_0xabc4('0x32')&&_0x25067a[_0xabc4('0x33')]&&!_0x25067a[_0xabc4('0x34')]){_0x1ace91[_0x25067a[_0xabc4('0x33')][_0xabc4('0x35')]()]=_0x25067a[_0xabc4('0x36')][_0xabc4('0x37')]();}else if(_0x25067a[_0xabc4('0x31')]==='string'&&_0x25067a[_0xabc4('0x38')]&&_0x25067a[_0xabc4('0x34')]){_0x1ace91[_0xabc4('0x17')][_0xabc4('0x39')]({'id':_0x25067a[_0xabc4('0x38')],'value':_0x25067a[_0xabc4('0x36')][_0xabc4('0x37')]()});}else if(_0x25067a[_0xabc4('0x31')]==='variable'&&_0x25067a[_0xabc4('0x3a')]&&_0x25067a['idField']&&_0x25067a['customField']){_0x203a2e[_0x25067a['variableName']]&&_0x1ace91['custom_fields'][_0xabc4('0x39')]({'id':_0x25067a[_0xabc4('0x38')],'value':_0x203a2e[_0x25067a['variableName']][_0xabc4('0x37')]()});}else if(_0x25067a[_0xabc4('0x31')]===_0xabc4('0x3b')&&_0x25067a[_0xabc4('0x3c')]&&_0x25067a[_0xabc4('0x3c')][_0xabc4('0x3d')]&&_0x25067a[_0xabc4('0x38')]&&_0x25067a[_0xabc4('0x34')]){_0x203a2e[_0x25067a['Variable'][_0xabc4('0x3d')]['toLowerCase']()]&&_0x1ace91[_0xabc4('0x17')][_0xabc4('0x39')]({'id':_0x25067a[_0xabc4('0x38')],'value':_0x203a2e[_0x25067a['Variable']['name'][_0xabc4('0x35')]()][_0xabc4('0x37')]()});}});}return _0x1ace91;}exports[_0xabc4('0x3e')]=function(_0x5cf206,_0x3a0778,_0x4f9bec,_0x4f1648,_0x2c4008,_0x54d895){var _0xf307d,_0x579575;_0x54d895[_0xabc4('0x1c')]=intUtil[_0xabc4('0x3f')](_0x54d895['remoteUri']);_0x54d895[_0xabc4('0x40')]=intUtil[_0xabc4('0x3f')](_0x54d895[_0xabc4('0x40')]);if(_0x2c4008&&_0x2c4008[_0xabc4('0x41')]){logger[_0xabc4('0xc')]('[QUEUE]',_0xabc4('0x42'));_0x3a0778[_0xabc4('0x43')]=util[_0xabc4('0xf')](_0xabc4('0x44'),_0x54d895['serverUrl'],_0x3a0778[_0xabc4('0x45')],md5(_0x3a0778[_0xabc4('0x45')]));}else{_0x3a0778[_0xabc4('0x43')]='';}headers['Authorization']=getAuth(_0x54d895);return getUser(_0x54d895,_0x4f1648[_0xabc4('0x46')])[_0xabc4('0x1e')](function(_0x81a9fe){_0xf307d=_0x81a9fe;logger[_0xabc4('0xc')](_0xabc4('0x47'),_0xf307d['id']);return getEndUser(_0x54d895,_0x3a0778[_0xabc4('0x11')],_0x3a0778[_0xabc4('0x12')]);})[_0xabc4('0x1e')](function(_0x121efc){_0x579575=_0x121efc;logger[_0xabc4('0xc')]('The\x20Enduser\x20ID\x20is:',_0x579575['id']);return getTicket(_0x54d895,_0xf307d,_0x579575,_0x4f9bec,_0x3a0778);})[_0xabc4('0x1e')](function(_0x4f8228){if(_0x4f8228&&_0x4f8228['id']){logger[_0xabc4('0xc')](_0xabc4('0x1f'));logger[_0xabc4('0xc')](_0xabc4('0x48'),_0x4f8228['id']);logger[_0xabc4('0xc')](_0xabc4('0x49'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xabc4('0xf')](_0xabc4('0x4a'),_0x4f1648[_0xabc4('0x3d')]),_0xabc4('0x4b'),{'uri':util[_0xabc4('0xf')](_0xabc4('0x4c'),_0x54d895[_0xabc4('0x1c')],_0x4f8228['id'])});}})['catch'](function(_0x4ce900){logger[_0xabc4('0x4d')](_0xabc4('0x49'),JSON['stringify'](_0x4ce900));});};exports[_0xabc4('0x4e')]=function(_0x2959e7,_0x4c453d,_0x1a6dba,_0x2b7baf,_0x4379ee,_0x91458d,_0x13385d){var _0x450d34,_0x98832a;_0x91458d[_0xabc4('0x1c')]=intUtil[_0xabc4('0x3f')](_0x91458d[_0xabc4('0x1c')]);_0x91458d[_0xabc4('0x40')]=intUtil['stripTrailingSlash'](_0x91458d['serverUrl']);if(_0x13385d&&_0x13385d['recordingFormat']&&_0x13385d[_0xabc4('0x4f')]!==_0xabc4('0x50')){logger['info']('[OUTBOUND]',_0xabc4('0x42'));_0x4c453d[_0xabc4('0x43')]=util[_0xabc4('0xf')](_0xabc4('0x44'),_0x91458d[_0xabc4('0x40')],_0x4c453d['uniqueid'],md5(_0x4c453d[_0xabc4('0x45')]));}headers[_0xabc4('0x51')]=getAuth(_0x91458d);return getUser(_0x91458d,_0x2b7baf[_0xabc4('0x46')])['then'](function(_0x4d315b){_0x450d34=_0x4d315b;logger[_0xabc4('0xc')]('The\x20User\x20ID\x20is:',_0x450d34['id']);return getEndUser(_0x91458d,_0x4c453d['destcalleridname'],_0x4c453d[_0xabc4('0x52')]);})[_0xabc4('0x1e')](function(_0x4a304a){_0x98832a=_0x4a304a;logger['info'](_0xabc4('0x53'),_0x98832a['id']);return getTicket(_0x91458d,_0x450d34,_0x98832a,_0x1a6dba,_0x4c453d);})[_0xabc4('0x1e')](function(_0x434a73){if(_0x434a73&&_0x434a73['id']){logger['info']('Ticket\x20created!');logger[_0xabc4('0xc')](_0xabc4('0x48'),_0x434a73['id']);logger[_0xabc4('0xc')](_0xabc4('0x54'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xabc4('0xf')](_0xabc4('0x4a'),_0x2b7baf['name']),'trigger:browser:url',{'uri':util[_0xabc4('0xf')]('%s/helpdesk/tickets/%d',_0x91458d[_0xabc4('0x1c')],_0x434a73['id'])});}})['catch'](function(_0x4c2fad){logger[_0xabc4('0x4d')](_0xabc4('0x54'),JSON[_0xabc4('0x2e')](_0x4c2fad));});};exports['unmanaged']=function(_0x2c5dcf,_0x2a80e1,_0x4c25fa,_0x1da809,_0x444c95,_0x3e2618){var _0xa5deb2,_0xe410b7;_0x3e2618[_0xabc4('0x1c')]=intUtil['stripTrailingSlash'](_0x3e2618[_0xabc4('0x1c')]);_0x3e2618[_0xabc4('0x40')]=intUtil[_0xabc4('0x3f')](_0x3e2618[_0xabc4('0x40')]);if(_0x444c95&&_0x444c95[_0xabc4('0x41')]){logger['info']('['+_0x2a80e1[_0xabc4('0x55')][_0xabc4('0x56')]()+']','Recording\x20is\x20enabled!');_0x2a80e1['recordingURL']=util[_0xabc4('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3e2618[_0xabc4('0x40')],_0x2a80e1[_0xabc4('0x45')],md5(_0x2a80e1['uniqueid']));}else{_0x2a80e1['recordingURL']='';}headers[_0xabc4('0x51')]=getAuth(_0x3e2618);return getUser(_0x3e2618,'')[_0xabc4('0x1e')](function(_0x498420){_0xa5deb2=_0x498420;logger[_0xabc4('0xc')]('The\x20User\x20ID\x20is:',_0xa5deb2['id']);return getEndUser(_0x3e2618,_0x2a80e1['calleridname'],_0x2a80e1[_0xabc4('0x12')]);})[_0xabc4('0x1e')](function(_0x2b0bab){_0xe410b7=_0x2b0bab;logger[_0xabc4('0xc')](_0xabc4('0x53'),_0xe410b7['id']);return getTicket(_0x3e2618,_0xa5deb2,_0xe410b7,_0x4c25fa,_0x2a80e1);})['then'](function(_0xa51d7f){if(_0xa51d7f){logger[_0xabc4('0xc')](_0xabc4('0x1f'));logger[_0xabc4('0xc')]('The\x20Ticket\x20ID\x20is:',_0xa51d7f['id']);}})['catch'](function(_0xa4e668){logger[_0xabc4('0x4d')]('['+_0x2a80e1[_0xabc4('0x55')][_0xabc4('0x56')]()+']',JSON[_0xabc4('0x2e')](_0xa4e668));});}; \ 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 d0bdf50..b791b3c 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 _0x8cdc=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','inspect','lodash','md5','moment','bluebird','ioredis','../../../../config/environment','redis','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','email','userId','User\x20found:','Admin\x20selected','userEmail','name','All\x20Contacts','Getting\x20contact\x20list','contactNumber','contacts','work_number','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','POST','/api/tasks','getString','Subjects','Descriptions','Contact','format','add','ticketId','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue'];(function(_0x180c47,_0x2489da){var _0x5347b4=function(_0x5c4c86){while(--_0x5c4c86){_0x180c47['push'](_0x180c47['shift']());}};_0x5347b4(++_0x2489da);}(_0x8cdc,0x1ec));var _0xc8cd=function(_0x1dc1bc,_0x13522c){_0x1dc1bc=_0x1dc1bc-0x0;var _0xe8656e=_0x8cdc[_0x1dc1bc];return _0xe8656e;};'use strict';var _=require(_0xc8cd('0x0'));var rp=require('request-promise');var md5=require(_0xc8cd('0x1'));var util=require('util');var moment=require(_0xc8cd('0x2'));var Promise=require(_0xc8cd('0x3'));var Redis=require(_0xc8cd('0x4'));var intUtil=require('./util');var config=require(_0xc8cd('0x5'));var logger=require('../../../../config/logger')('freshsales');config[_0xc8cd('0x6')]=_['defaults'](config[_0xc8cd('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xc8cd('0x7'))(new Redis(config['redis']));function getAdminId(_0x1fef51,_0x3afb00,_0x4ef6aa,_0x444d13){return new Promise(function(_0x2a7d50,_0x1c7759){var _0x3c953c=![];var _0xebffe4={'method':_0xc8cd('0x8'),'uri':_0x444d13+_0xc8cd('0x9'),'json':!![]};_0xebffe4[_0xc8cd('0xa')]=_0x4ef6aa;logger['info'](_0xc8cd('0xb'));return rp(_0xebffe4)[_0xc8cd('0xc')](function(_0x238deb){if(_0x238deb){var _0x2fa7c2=_0x238deb[_0xc8cd('0xd')];var _0x2b631a=null;for(_0x2b631a=0x0;_0x2b631a<_0x2fa7c2[_0xc8cd('0xe')];_0x2b631a++){if(_0x2fa7c2[_0x2b631a]['email']===_0x1fef51[_0xc8cd('0xf')]){_0x1fef51[_0xc8cd('0x10')]=_0x2fa7c2[_0x2b631a]['id'];_0x3c953c=!![];}}if(_0x3c953c){logger[_0xc8cd('0x11')](_0xc8cd('0x12'),_0x1fef51['adminId']);_0x2a7d50(_0x1fef51);}else{_0x1c7759({'statusCode':0x194,'message':_0xc8cd('0x13')});}}else{_0x1c7759({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xc8cd('0x14')](function(_0x522737){logger[_0xc8cd('0x15')]('['+[_0x3afb00[_0xc8cd('0x16')]()]+']',_0x522737[_0xc8cd('0x17')]);_0x1c7759(_0x522737);});});}function getUser(_0x36842a,_0x4c727f,_0x498f89){return function(_0x1aeffd){return new Promise(function(_0x58b03c,_0x3ea47d){var _0x7efcf4={'method':_0xc8cd('0x8'),'uri':_0x498f89+_0xc8cd('0x9'),'json':!![]};_0x7efcf4[_0xc8cd('0xa')]=_0x4c727f;logger[_0xc8cd('0x11')](_0xc8cd('0x18'));return rp(_0x7efcf4)[_0xc8cd('0xc')](function(_0x5d1455){if(_0x5d1455){var _0x29a25b=_0x5d1455[_0xc8cd('0xd')];var _0x55c5b8=![];var _0x524979=null;if(_0x1aeffd[_0xc8cd('0x19')]!==null){logger[_0xc8cd('0x11')]('Getting\x20user\x20with\x20email',_0x1aeffd['agentEmail']);_0x1aeffd['userEmail']=_0x1aeffd[_0xc8cd('0x19')];for(_0x524979=0x0;_0x524979<_0x29a25b[_0xc8cd('0xe')];_0x524979++){if(_0x29a25b[_0x524979][_0xc8cd('0x1a')]===_0x1aeffd[_0xc8cd('0x19')]){_0x55c5b8=!![];_0x1aeffd[_0xc8cd('0x1b')]=_0x29a25b[_0x524979]['id'];logger['info'](_0xc8cd('0x1c'),_0x1aeffd[_0xc8cd('0x1b')]);}}}if(!_0x55c5b8){logger[_0xc8cd('0x11')](_0xc8cd('0x1d'));_0x1aeffd[_0xc8cd('0x1e')]=_0x1aeffd[_0xc8cd('0xf')];_0x1aeffd[_0xc8cd('0x1b')]=_0x1aeffd[_0xc8cd('0x10')];_0x55c5b8=!![];}if(_0x55c5b8){_0x58b03c(_0x1aeffd);}else{_0x3ea47d({'statusCode':0x194,'message':_0xc8cd('0x13')});}}else{_0x3ea47d({'statusCode':0x194,'message':_0xc8cd('0x13')});}})['catch'](function(_0x33d9d5){logger[_0xc8cd('0x15')]('['+[_0x36842a[_0xc8cd('0x16')]()]+']',_0x33d9d5[_0xc8cd('0x17')]);_0x3ea47d(_0x33d9d5);});});};}function getEndUser(_0x94435c,_0x594d26,_0x35f1a6){return function(_0x2a7878){return new Promise(function(_0x5e6593,_0xf1789e){var _0x542055=0x0;var _0xfeed52={'method':_0xc8cd('0x8'),'uri':_0x35f1a6+'/api/contacts/filters','json':!![]};_0xfeed52['headers']=_0x594d26;logger[_0xc8cd('0x11')]('Getting\x20contacts\x20filter');return rp(_0xfeed52)[_0xc8cd('0xc')](function(_0x355d9e){_0x355d9e['filters']['forEach'](function(_0x4561ed){if(_0x4561ed[_0xc8cd('0x1f')]===_0xc8cd('0x20')){_0x542055=_0x4561ed['id'];}});})['then'](function(){logger['info'](_0xc8cd('0x21'));var _0x196790={'method':_0xc8cd('0x8'),'uri':_0x35f1a6+'/api/contacts/view/'+_0x542055,'json':!![]};_0x196790[_0xc8cd('0xa')]=_0x594d26;return rp(_0x196790);})[_0xc8cd('0xc')](function(_0x2fa591){logger[_0xc8cd('0x11')]('Searching\x20contact\x20with\x20phone',_0x2a7878[_0xc8cd('0x22')]);if(_0x2fa591[_0xc8cd('0x23')]['length']>0x0){var _0x5b28c9=_['find'](_0x2fa591[_0xc8cd('0x23')],function(_0xb4160b){if(_0xb4160b[_0xc8cd('0x24')]===_0x2a7878[_0xc8cd('0x22')]||_0xb4160b[_0xc8cd('0x25')]===_0x2a7878[_0xc8cd('0x22')]){return _0xb4160b;}});if(_0x5b28c9){_0x2a7878[_0xc8cd('0x26')]=_0x5b28c9['id'];logger[_0xc8cd('0x11')](_0xc8cd('0x27'),_0x2a7878[_0xc8cd('0x26')]);_0x5e6593(_0x2a7878);}else{return createEndUser(_0x2a7878,_0x94435c,_0x594d26,_0x35f1a6)[_0xc8cd('0xc')](function(_0x1de688){logger[_0xc8cd('0x11')]('Contact\x20created:',_0x2a7878[_0xc8cd('0x26')]);_0x5e6593(_0x1de688);});}}else{return createEndUser(_0x2a7878,_0x94435c,_0x594d26,_0x35f1a6)[_0xc8cd('0xc')](function(_0x32835c){logger['info'](_0xc8cd('0x28'),_0x2a7878[_0xc8cd('0x26')]);_0x5e6593(_0x32835c);});}})[_0xc8cd('0x14')](function(_0x11875b){throw new Error(_0x11875b[_0xc8cd('0x17')]);});});};}function createEndUser(_0x3b316b,_0xbd5721,_0x236403,_0x4cb05d){return new Promise(function(_0x334db7,_0x4558c0){var _0x25788f=moment();var _0x572fcc={'method':'POST','uri':_0x4cb05d+'/api/contacts','body':{'contact':{'last_name':_0x3b316b[_0xc8cd('0x22')],'work_number':_0x3b316b['contactNumber'],'mobile_number':_0x3b316b['contactNumber'],'owner_id':_0x3b316b['userId'],'created_at':_0x25788f['format'](_0xc8cd('0x29'))}},'json':!![]};_0x572fcc[_0xc8cd('0xa')]=_0x236403;logger['info'](_0xc8cd('0x2a'));return rp(_0x572fcc)[_0xc8cd('0xc')](function(_0x1cdfd0){_0x3b316b['endUserId']=_0x1cdfd0[_0xc8cd('0x2b')]['id'];_0x334db7(_0x3b316b);})[_0xc8cd('0x14')](function(_0x2e8927){logger[_0xc8cd('0x15')]('['+[_0xbd5721[_0xc8cd('0x16')]()]+']',_0x2e8927[_0xc8cd('0x17')]);_0x4558c0(_0x2e8927[_0xc8cd('0x17')]);});});}function getTicket(_0x26679c,_0x1b3fd0,_0x2ee056,_0x4a331c,_0x2e71b9){return function(_0x599c54){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x46aef,_0x3582c2){var _0x16f9dc=moment();var _0x1de8bb={'method':_0xc8cd('0x2c'),'uri':_0x2ee056+_0xc8cd('0x2d'),'body':{'title':intUtil[_0xc8cd('0x2e')](_0x4a331c[_0xc8cd('0x2f')],_0x2e71b9,'\x20'),'description':intUtil['getString'](_0x4a331c[_0xc8cd('0x30')],_0x2e71b9,'\x0a'),'owner_id':_0x599c54[_0xc8cd('0x1b')],'creater_id':_0x599c54[_0xc8cd('0x10')],'targetable_id':_0x599c54['endUserId'],'targetable_type':_0xc8cd('0x31'),'created_at':_0x16f9dc[_0xc8cd('0x32')](_0xc8cd('0x29')),'due_date':_0x16f9dc[_0xc8cd('0x33')](0x1e,'m')[_0xc8cd('0x32')](_0xc8cd('0x29'))},'json':!![]};_0x1de8bb[_0xc8cd('0xa')]=_0x1b3fd0;return rp(_0x1de8bb)[_0xc8cd('0xc')](function(_0x3bcb99){_0x599c54[_0xc8cd('0x34')]=_0x3bcb99['task']['id'];logger[_0xc8cd('0x11')](_0xc8cd('0x35'),_0x599c54[_0xc8cd('0x34')]);_0x46aef(_0x599c54);})[_0xc8cd('0x14')](function(_0x3e7568){logger[_0xc8cd('0x15')]('['+[_0x26679c[_0xc8cd('0x16')]()]+']',_0x3e7568['message']);_0x3582c2(_0x3e7568[_0xc8cd('0x17')]);});});};}function emit(_0x43aa31,_0x2b9a1e,_0x3c3dbf){var _0x17bbeb={'uri':_0x43aa31+_0xc8cd('0x36')+_0x3c3dbf};io['to'](util['format'](_0xc8cd('0x37'),_0x2b9a1e))['emit'](_0xc8cd('0x38'),_0x17bbeb);}exports['cs']=function(_0x21276a,_0xfbfb3d,_0x3bdcec,_0xa6a980,_0x2e8327,_0x4d34c8,_0x506819,_0x2244ca){var _0x3c2edb={};var _0x35e23f={'Authorization':_0xc8cd('0x39')+_0x4d34c8[_0xc8cd('0x3a')]};_0x4d34c8[_0xc8cd('0x3b')]=intUtil[_0xc8cd('0x3c')](_0x4d34c8[_0xc8cd('0x3b')]);_0x4d34c8[_0xc8cd('0x3d')]=intUtil[_0xc8cd('0x3c')](_0x4d34c8[_0xc8cd('0x3d')]);var _0x4d733a=_0x4d34c8[_0xc8cd('0x3b')];_0x3c2edb['adminEmail']=_0x4d34c8[_0xc8cd('0x3e')];_0x3c2edb['contactNumber']=_0x2244ca[_0xc8cd('0x3f')]()===_0xc8cd('0x40')?_0xfbfb3d['destcalleridnum']:_0xfbfb3d[_0xc8cd('0x41')];_0x3c2edb[_0xc8cd('0x42')]=_0x2244ca===_0xc8cd('0x43')||_0x2244ca==='unmanaged'?'queue':_0xc8cd('0x40');if(_0xa6a980){_0x3c2edb[_0xc8cd('0x19')]=_0xa6a980[_0xc8cd('0x1a')];}var _0x373e33=util[_0xc8cd('0x32')](_0xc8cd('0x44'),_0x4d34c8[_0xc8cd('0x3d')],_0xfbfb3d[_0xc8cd('0x45')],md5(_0xfbfb3d[_0xc8cd('0x45')]));if(_0x2e8327&&_0x2e8327[_0xc8cd('0x46')]){logger[_0xc8cd('0x11')](_0xc8cd('0x47'),_0xc8cd('0x48'));_0xfbfb3d[_0xc8cd('0x49')]=_0x373e33;}else if(_0x506819&&_0x506819['recordingFormat']&&_0x506819[_0xc8cd('0x4a')]!==_0xc8cd('0x4b')){logger[_0xc8cd('0x11')](_0xc8cd('0x4c'),_0xc8cd('0x48'));_0xfbfb3d[_0xc8cd('0x49')]=_0x373e33;}else{_0xfbfb3d[_0xc8cd('0x49')]='';}return getAdminId(_0x3c2edb,_0x2244ca,_0x35e23f,_0x4d733a)[_0xc8cd('0xc')](getUser(_0x2244ca,_0x35e23f,_0x4d733a))[_0xc8cd('0xc')](getEndUser(_0x2244ca,_0x35e23f,_0x4d733a))[_0xc8cd('0xc')](getTicket(_0x2244ca,_0x35e23f,_0x4d733a,_0x3bdcec,_0xfbfb3d))['then'](function(_0x4840f4){logger[_0xc8cd('0x11')](util[_0xc8cd('0x32')]('The\x20ticket\x20ID\x20is:\x20%s',_0x4840f4[_0xc8cd('0x34')]));if(_0x2244ca!==_0xc8cd('0x4d')){logger[_0xc8cd('0x11')]('['+[_0x2244ca[_0xc8cd('0x16')]()]+']',_0xc8cd('0x4e'));emit(_0x4d733a,_0xa6a980[_0xc8cd('0x1f')],_0x4840f4['endUserId']);}})[_0xc8cd('0x14')](function(_0x382cb3){logger['error']('['+[_0x2244ca[_0xc8cd('0x16')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xc8cd('0x4f')](_0x382cb3,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd6a5=['contacts','find','contactNumber','mobile_number','endUserId','Contact\x20found:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','adminEmail','username','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','/api/selector/owners','headers','info','then','users','length','email','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId','/api/contacts/filters','forEach','name','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone'];(function(_0x529af5,_0x46d53e){var _0x5a675b=function(_0x5b2bd2){while(--_0x5b2bd2){_0x529af5['push'](_0x529af5['shift']());}};_0x5a675b(++_0x46d53e);}(_0xd6a5,0x190));var _0x5d6a=function(_0x355494,_0x592917){_0x355494=_0x355494-0x0;var _0x59d215=_0xd6a5[_0x355494];return _0x59d215;};'use strict';var _=require(_0x5d6a('0x0'));var rp=require(_0x5d6a('0x1'));var md5=require(_0x5d6a('0x2'));var util=require(_0x5d6a('0x3'));var moment=require(_0x5d6a('0x4'));var Promise=require(_0x5d6a('0x5'));var Redis=require(_0x5d6a('0x6'));var intUtil=require(_0x5d6a('0x7'));var config=require('../../../../config/environment');var logger=require(_0x5d6a('0x8'))(_0x5d6a('0x9'));config['redis']=_['defaults'](config[_0x5d6a('0xa')],{'host':_0x5d6a('0xb'),'port':0x18eb});var io=require(_0x5d6a('0xc'))(new Redis(config[_0x5d6a('0xa')]));function getAdminId(_0x589912,_0x368321,_0x517a30,_0x1fa687){return new Promise(function(_0x4e9a7c,_0x270b8){var _0xc3b5af=![];var _0x577c06={'method':'GET','uri':_0x1fa687+_0x5d6a('0xd'),'json':!![]};_0x577c06[_0x5d6a('0xe')]=_0x517a30;logger[_0x5d6a('0xf')]('Getting\x20admin\x20information');return rp(_0x577c06)[_0x5d6a('0x10')](function(_0x2b4178){if(_0x2b4178){var _0x17fa67=_0x2b4178[_0x5d6a('0x11')];var _0x53a0ab=null;for(_0x53a0ab=0x0;_0x53a0ab<_0x17fa67[_0x5d6a('0x12')];_0x53a0ab++){if(_0x17fa67[_0x53a0ab][_0x5d6a('0x13')]===_0x589912['adminEmail']){_0x589912[_0x5d6a('0x14')]=_0x17fa67[_0x53a0ab]['id'];_0xc3b5af=!![];}}if(_0xc3b5af){logger[_0x5d6a('0xf')]('Admin\x20found:',_0x589912['adminId']);_0x4e9a7c(_0x589912);}else{_0x270b8({'statusCode':0x194,'message':_0x5d6a('0x15')});}}else{_0x270b8({'statusCode':0x194,'message':_0x5d6a('0x15')});}})[_0x5d6a('0x16')](function(_0x5dd03c){logger[_0x5d6a('0x17')]('['+[_0x368321[_0x5d6a('0x18')]()]+']',_0x5dd03c[_0x5d6a('0x19')]);_0x270b8(_0x5dd03c);});});}function getUser(_0x3419ab,_0x2106b9,_0x5d0491){return function(_0xfc8747){return new Promise(function(_0xa8d290,_0x3b3985){var _0x297c62={'method':_0x5d6a('0x1a'),'uri':_0x5d0491+_0x5d6a('0xd'),'json':!![]};_0x297c62[_0x5d6a('0xe')]=_0x2106b9;logger[_0x5d6a('0xf')](_0x5d6a('0x1b'));return rp(_0x297c62)['then'](function(_0x5b93c7){if(_0x5b93c7){var _0x385ad=_0x5b93c7[_0x5d6a('0x11')];var _0x561c04=![];var _0x51ff71=null;if(_0xfc8747[_0x5d6a('0x1c')]!==null){logger[_0x5d6a('0xf')](_0x5d6a('0x1d'),_0xfc8747[_0x5d6a('0x1c')]);_0xfc8747[_0x5d6a('0x1e')]=_0xfc8747[_0x5d6a('0x1c')];for(_0x51ff71=0x0;_0x51ff71<_0x385ad['length'];_0x51ff71++){if(_0x385ad[_0x51ff71][_0x5d6a('0x13')]===_0xfc8747[_0x5d6a('0x1c')]){_0x561c04=!![];_0xfc8747['userId']=_0x385ad[_0x51ff71]['id'];logger[_0x5d6a('0xf')](_0x5d6a('0x1f'),_0xfc8747[_0x5d6a('0x20')]);}}}if(!_0x561c04){logger[_0x5d6a('0xf')]('Admin\x20selected');_0xfc8747[_0x5d6a('0x1e')]=_0xfc8747['adminEmail'];_0xfc8747['userId']=_0xfc8747[_0x5d6a('0x14')];_0x561c04=!![];}if(_0x561c04){_0xa8d290(_0xfc8747);}else{_0x3b3985({'statusCode':0x194,'message':_0x5d6a('0x15')});}}else{_0x3b3985({'statusCode':0x194,'message':_0x5d6a('0x15')});}})[_0x5d6a('0x16')](function(_0x1e5fb0){logger['error']('['+[_0x3419ab['toUpperCase']()]+']',_0x1e5fb0['message']);_0x3b3985(_0x1e5fb0);});});};}function getEndUser(_0x434615,_0x2c851a,_0xa32dd9){return function(_0x24318f){return new Promise(function(_0x2cc6d7,_0x4f4833){var _0xee289b=0x0;var _0x3774b0={'method':_0x5d6a('0x1a'),'uri':_0xa32dd9+_0x5d6a('0x21'),'json':!![]};_0x3774b0[_0x5d6a('0xe')]=_0x2c851a;logger[_0x5d6a('0xf')]('Getting\x20contacts\x20filter');return rp(_0x3774b0)['then'](function(_0x288758){_0x288758['filters'][_0x5d6a('0x22')](function(_0x4db242){if(_0x4db242[_0x5d6a('0x23')]===_0x5d6a('0x24')){_0xee289b=_0x4db242['id'];}});})[_0x5d6a('0x10')](function(){logger[_0x5d6a('0xf')](_0x5d6a('0x25'));var _0x44fe5f={'method':'GET','uri':_0xa32dd9+_0x5d6a('0x26')+_0xee289b,'json':!![]};_0x44fe5f[_0x5d6a('0xe')]=_0x2c851a;return rp(_0x44fe5f);})[_0x5d6a('0x10')](function(_0x509deb){logger[_0x5d6a('0xf')](_0x5d6a('0x27'),_0x24318f['contactNumber']);if(_0x509deb[_0x5d6a('0x28')][_0x5d6a('0x12')]>0x0){var _0x1fc751=_[_0x5d6a('0x29')](_0x509deb[_0x5d6a('0x28')],function(_0x3850c9){if(_0x3850c9['work_number']===_0x24318f[_0x5d6a('0x2a')]||_0x3850c9[_0x5d6a('0x2b')]===_0x24318f[_0x5d6a('0x2a')]){return _0x3850c9;}});if(_0x1fc751){_0x24318f[_0x5d6a('0x2c')]=_0x1fc751['id'];logger['info'](_0x5d6a('0x2d'),_0x24318f[_0x5d6a('0x2c')]);_0x2cc6d7(_0x24318f);}else{return createEndUser(_0x24318f,_0x434615,_0x2c851a,_0xa32dd9)['then'](function(_0x26d217){logger['info']('Contact\x20created:',_0x24318f['endUserId']);_0x2cc6d7(_0x26d217);});}}else{return createEndUser(_0x24318f,_0x434615,_0x2c851a,_0xa32dd9)[_0x5d6a('0x10')](function(_0x1e82af){logger[_0x5d6a('0xf')]('Contact\x20created:',_0x24318f['endUserId']);_0x2cc6d7(_0x1e82af);});}})[_0x5d6a('0x16')](function(_0x202c40){throw new Error(_0x202c40[_0x5d6a('0x19')]);});});};}function createEndUser(_0x5862a2,_0x229d28,_0x4d4d75,_0x361fb5){return new Promise(function(_0xa4d32b,_0x5ac862){var _0x49ce9b=moment();var _0x3fcde0={'method':_0x5d6a('0x2e'),'uri':_0x361fb5+_0x5d6a('0x2f'),'body':{'contact':{'last_name':_0x5862a2['contactNumber'],'work_number':_0x5862a2['contactNumber'],'mobile_number':_0x5862a2[_0x5d6a('0x2a')],'owner_id':_0x5862a2[_0x5d6a('0x20')],'created_at':_0x49ce9b[_0x5d6a('0x30')](_0x5d6a('0x31'))}},'json':!![]};_0x3fcde0[_0x5d6a('0xe')]=_0x4d4d75;logger[_0x5d6a('0xf')](_0x5d6a('0x32'));return rp(_0x3fcde0)[_0x5d6a('0x10')](function(_0xce6e51){_0x5862a2['endUserId']=_0xce6e51[_0x5d6a('0x33')]['id'];_0xa4d32b(_0x5862a2);})[_0x5d6a('0x16')](function(_0x20a8c0){logger[_0x5d6a('0x17')]('['+[_0x229d28[_0x5d6a('0x18')]()]+']',_0x20a8c0[_0x5d6a('0x19')]);_0x5ac862(_0x20a8c0[_0x5d6a('0x19')]);});});}function getTicket(_0x2bf09e,_0x59623e,_0x46d88e,_0x4e3ccd,_0x289620){return function(_0x4925d1){logger[_0x5d6a('0xf')](_0x5d6a('0x34'));return new Promise(function(_0x5bcb23,_0x5e6311){var _0x206e02=moment();var _0x400910={'method':_0x5d6a('0x2e'),'uri':_0x46d88e+_0x5d6a('0x35'),'body':{'title':intUtil[_0x5d6a('0x36')](_0x4e3ccd['Subjects'],_0x289620,'\x20'),'description':intUtil['getString'](_0x4e3ccd[_0x5d6a('0x37')],_0x289620,'\x0a'),'owner_id':_0x4925d1[_0x5d6a('0x20')],'creater_id':_0x4925d1[_0x5d6a('0x14')],'targetable_id':_0x4925d1[_0x5d6a('0x2c')],'targetable_type':_0x5d6a('0x38'),'created_at':_0x206e02[_0x5d6a('0x30')](_0x5d6a('0x31')),'due_date':_0x206e02[_0x5d6a('0x39')](0x1e,'m')['format'](_0x5d6a('0x31'))},'json':!![]};_0x400910['headers']=_0x59623e;return rp(_0x400910)[_0x5d6a('0x10')](function(_0x5bbbdc){_0x4925d1[_0x5d6a('0x3a')]=_0x5bbbdc[_0x5d6a('0x3b')]['id'];logger[_0x5d6a('0xf')](_0x5d6a('0x3c'),_0x4925d1['ticketId']);_0x5bcb23(_0x4925d1);})[_0x5d6a('0x16')](function(_0x14dc65){logger[_0x5d6a('0x17')]('['+[_0x2bf09e[_0x5d6a('0x18')]()]+']',_0x14dc65[_0x5d6a('0x19')]);_0x5e6311(_0x14dc65[_0x5d6a('0x19')]);});});};}function emit(_0x14e681,_0x5005b9,_0x757387){var _0x39168c={'uri':_0x14e681+_0x5d6a('0x3d')+_0x757387};io['to'](util[_0x5d6a('0x30')](_0x5d6a('0x3e'),_0x5005b9))['emit'](_0x5d6a('0x3f'),_0x39168c);}exports['cs']=function(_0x299b47,_0x89ca2f,_0x17ea78,_0x314eb5,_0x527ab9,_0x3f72dc,_0x57ec7d,_0x5dfbd2){var _0x1d12c9={};var _0x407f57={'Authorization':_0x5d6a('0x40')+_0x3f72dc[_0x5d6a('0x41')]};_0x3f72dc['remoteUri']=intUtil[_0x5d6a('0x42')](_0x3f72dc[_0x5d6a('0x43')]);_0x3f72dc[_0x5d6a('0x44')]=intUtil['stripTrailingSlash'](_0x3f72dc['serverUrl']);var _0x8fe0a5=_0x3f72dc[_0x5d6a('0x43')];_0x1d12c9[_0x5d6a('0x45')]=_0x3f72dc[_0x5d6a('0x46')];_0x1d12c9[_0x5d6a('0x2a')]=_0x5dfbd2['toLowerCase']()===_0x5d6a('0x47')?_0x89ca2f[_0x5d6a('0x48')]:_0x89ca2f[_0x5d6a('0x49')];_0x1d12c9[_0x5d6a('0x4a')]=_0x5dfbd2===_0x5d6a('0x4b')||_0x5dfbd2===_0x5d6a('0x4c')?_0x5d6a('0x4b'):_0x5d6a('0x47');if(_0x314eb5){_0x1d12c9['agentEmail']=_0x314eb5[_0x5d6a('0x13')];}var _0x5c0408=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f72dc['serverUrl'],_0x89ca2f[_0x5d6a('0x4d')],md5(_0x89ca2f[_0x5d6a('0x4d')]));if(_0x527ab9&&_0x527ab9['monitor_format']){logger[_0x5d6a('0xf')](_0x5d6a('0x4e'),'Recording\x20is\x20enabled!');_0x89ca2f[_0x5d6a('0x4f')]=_0x5c0408;}else if(_0x57ec7d&&_0x57ec7d[_0x5d6a('0x50')]&&_0x57ec7d[_0x5d6a('0x50')]!==_0x5d6a('0x51')){logger['info'](_0x5d6a('0x52'),_0x5d6a('0x53'));_0x89ca2f['recordingURL']=_0x5c0408;}else{_0x89ca2f[_0x5d6a('0x4f')]='';}return getAdminId(_0x1d12c9,_0x5dfbd2,_0x407f57,_0x8fe0a5)['then'](getUser(_0x5dfbd2,_0x407f57,_0x8fe0a5))[_0x5d6a('0x10')](getEndUser(_0x5dfbd2,_0x407f57,_0x8fe0a5))[_0x5d6a('0x10')](getTicket(_0x5dfbd2,_0x407f57,_0x8fe0a5,_0x17ea78,_0x89ca2f))[_0x5d6a('0x10')](function(_0x51f390){logger[_0x5d6a('0xf')](util['format'](_0x5d6a('0x54'),_0x51f390[_0x5d6a('0x3a')]));if(_0x5dfbd2!==_0x5d6a('0x4c')){logger[_0x5d6a('0xf')]('['+[_0x5dfbd2[_0x5d6a('0x18')]()]+']',_0x5d6a('0x55'));emit(_0x8fe0a5,_0x314eb5[_0x5d6a('0x23')],_0x51f390[_0x5d6a('0x2c')]);}})['catch'](function(_0x43384e){logger[_0x5d6a('0x17')]('['+[_0x5dfbd2[_0x5d6a('0x18')]()]+_0x5d6a('0x56'),util[_0x5d6a('0x57')](_0x43384e,{'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 6f89e13..64f9afa 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 _0xbaf0=['format','%s\x20configuration\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','vtiger','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','EVENT\x20UNKNOWN','unmanaged','desk','unknown\x20integration','../../../../config/logger','error','[EXEC]'];(function(_0x13bc8d,_0x1c28b1){var _0x34497b=function(_0x3120ff){while(--_0x3120ff){_0x13bc8d['push'](_0x13bc8d['shift']());}};_0x34497b(++_0x1c28b1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var zendesk=require(_0x0baf('0x1'));var salesforce=require(_0x0baf('0x2'));var sugarcrm=require(_0x0baf('0x3'));var freshdesk=require(_0x0baf('0x4'));var zoho=require(_0x0baf('0x5'));var desk=require('./desk');var vtiger=require(_0x0baf('0x6'));var servicenow=require(_0x0baf('0x7'));var dynamics365=require(_0x0baf('0x8'));var freshsales=require(_0x0baf('0x9'));var integrations=[_0x0baf('0xa'),_0x0baf('0xb'),_0x0baf('0xc'),_0x0baf('0xd'),_0x0baf('0xe'),'desk',_0x0baf('0xf'),'dynamics365',_0x0baf('0x10'),_0x0baf('0x11')];exports[_0x0baf('0x12')]=function(_0x2f46e8,_0x7f54d4,_0xf4c8ac,_0x41cead,_0x245a6b,_0x1fc6b2){if(_0xf4c8ac){if(_[_0x0baf('0x13')](integrations,_0x2f46e8[_0x0baf('0x14')]['toLowerCase']())){try{var _0x5a53e2=null;var _0x465dd7='';var _0xe4378c=_0xf4c8ac[_0x2f46e8[_0x0baf('0x14')][_0x0baf('0x15')]()];if(_0xe4378c){var _0x5a0583=_0xe4378c[_0x2f46e8[_0x0baf('0x16')]];if(_0x5a0583){var _0x49e44b=_[_0x0baf('0x17')](_0x5a0583[_0x0baf('0x18')],{'id':parseInt(_0x2f46e8[_0x0baf('0x19')],0xa)});if(_0x49e44b){if(_0x41cead){if(_0x245a6b&&_0x7f54d4[_0x0baf('0x1a')]){_0x465dd7=_0x0baf('0x1a');}else if(_0x7f54d4[_0x0baf('0x1b')]){_0x465dd7='outbound';}else{console['log'](_0x0baf('0x1c'),_0x7f54d4);}}else{_0x465dd7=_0x0baf('0x1d');}switch(_0x2f46e8[_0x0baf('0x14')][_0x0baf('0x15')]()){case _0x0baf('0xa'):zendesk[_0x465dd7](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2);break;case _0x0baf('0xb'):salesforce[_0x465dd7](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2);break;case'sugarcrm':sugarcrm[_0x465dd7](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2);break;case _0x0baf('0xd'):freshdesk[_0x465dd7](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2);break;case _0x0baf('0xe'):zoho[_0x465dd7](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2);break;case _0x0baf('0x1e'):desk[_0x465dd7](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2);break;case _0x0baf('0xf'):vtiger[_0x465dd7](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2);break;case _0x0baf('0x10'):freshsales['cs'](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2,_0x465dd7);break;case _0x0baf('0x11'):servicenow['cs'](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2,_0x465dd7);break;case'dynamics365':dynamics365['cs'](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2,_0x465dd7);break;default:console['log'](_0x0baf('0x1f'));}}else{_0x5a53e2=require(_0x0baf('0x20'))(_0x2f46e8[_0x0baf('0x14')][_0x0baf('0x15')]());_0x5a53e2[_0x0baf('0x21')](_0x0baf('0x22'),util[_0x0baf('0x23')](_0x0baf('0x24'),_0x2f46e8[_0x0baf('0x14')][_0x0baf('0x15')](),_0x2f46e8['data3']));}}else{_0x5a53e2=require(_0x0baf('0x20'))(_0x2f46e8['data1'][_0x0baf('0x15')]());_0x5a53e2['error']('[EXEC]',util[_0x0baf('0x23')]('%s\x20account\x20#%s\x20not\x20found',_0x2f46e8['data1'][_0x0baf('0x15')](),_0x2f46e8[_0x0baf('0x16')]));}}else{}}catch(_0x34e264){console[_0x0baf('0x21')](_0x34e264);}}}}; \ No newline at end of file +var _0xed3c=['%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./dynamics365','./freshsales','zendesk','salesforce','desk','servicenow','exec','includes','toLowerCase','data1','Configurations','data3','queue','outbound','log','unmanaged','sugarcrm','zoho','vtiger','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','format'];(function(_0x53574a,_0x182cfe){var _0x1ceddd=function(_0x23f51b){while(--_0x23f51b){_0x53574a['push'](_0x53574a['shift']());}};_0x1ceddd(++_0x182cfe);}(_0xed3c,0x1a6));var _0xced3=function(_0x11722b,_0x247eb2){_0x11722b=_0x11722b-0x0;var _0x2065f0=_0xed3c[_0x11722b];return _0x2065f0;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var zendesk=require(_0xced3('0x2'));var salesforce=require(_0xced3('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xced3('0x4'));var zoho=require(_0xced3('0x5'));var desk=require(_0xced3('0x6'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0xced3('0x7'));var freshsales=require(_0xced3('0x8'));var integrations=[_0xced3('0x9'),_0xced3('0xa'),'sugarcrm','freshdesk','zoho',_0xced3('0xb'),'vtiger','dynamics365','freshsales',_0xced3('0xc')];exports[_0xced3('0xd')]=function(_0x3e5a04,_0x12612f,_0x1cb639,_0x5934b2,_0x36ea7f,_0x32a95d){if(_0x1cb639){if(_[_0xced3('0xe')](integrations,_0x3e5a04['data1'][_0xced3('0xf')]())){try{var _0x19b8c2=null;var _0x42d879='';var _0x3b2ac4=_0x1cb639[_0x3e5a04[_0xced3('0x10')][_0xced3('0xf')]()];if(_0x3b2ac4){var _0x1869d5=_0x3b2ac4[_0x3e5a04['data2']];if(_0x1869d5){var _0x65bb58=_['find'](_0x1869d5[_0xced3('0x11')],{'id':parseInt(_0x3e5a04[_0xced3('0x12')],0xa)});if(_0x65bb58){if(_0x5934b2){if(_0x36ea7f&&_0x12612f[_0xced3('0x13')]){_0x42d879=_0xced3('0x13');}else if(_0x12612f['routeId']){_0x42d879=_0xced3('0x14');}else{console[_0xced3('0x15')]('EVENT\x20UNKNOWN',_0x12612f);}}else{_0x42d879=_0xced3('0x16');}switch(_0x3e5a04[_0xced3('0x10')][_0xced3('0xf')]()){case _0xced3('0x9'):zendesk[_0x42d879](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d);break;case'salesforce':salesforce[_0x42d879](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d);break;case _0xced3('0x17'):sugarcrm[_0x42d879](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d);break;case'freshdesk':freshdesk[_0x42d879](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d);break;case _0xced3('0x18'):zoho[_0x42d879](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d);break;case _0xced3('0xb'):desk[_0x42d879](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d);break;case _0xced3('0x19'):vtiger[_0x42d879](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d);break;case _0xced3('0x1a'):freshsales['cs'](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d,_0x42d879);break;case _0xced3('0xc'):servicenow['cs'](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d,_0x42d879);break;case _0xced3('0x1b'):dynamics365['cs'](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d,_0x42d879);break;default:console[_0xced3('0x15')](_0xced3('0x1c'));}}else{_0x19b8c2=require(_0xced3('0x1d'))(_0x3e5a04[_0xced3('0x10')][_0xced3('0xf')]());_0x19b8c2['error']('[EXEC]',util['format'](_0xced3('0x1e'),_0x3e5a04[_0xced3('0x10')][_0xced3('0xf')](),_0x3e5a04['data3']));}}else{_0x19b8c2=require(_0xced3('0x1d'))(_0x3e5a04[_0xced3('0x10')]['toLowerCase']());_0x19b8c2['error'](_0xced3('0x1f'),util[_0xced3('0x20')](_0xced3('0x21'),_0x3e5a04[_0xced3('0x10')]['toLowerCase'](),_0x3e5a04[_0xced3('0x22')]));}}else{}}catch(_0x23f92b){console['error'](_0x23f92b);}}}}; \ 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 2ef52de..906a542 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 _0x994d=['Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','lead','Company','upperFirst','forEach','type','idField','content','toString','variableName','customVariable','Variable','name','password','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','[QUEUE]','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','calleridnum','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','localhost','socket.io-emitter','emit','utc','getString','Subjects','Descriptions','WhoId','ContactId','sobject','ticketType','create','isNil','validateEmail','User','find','execute','length','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','Task','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','Lead','Contact','Case','contact','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format'];(function(_0x30d036,_0x5404f6){var _0x541be6=function(_0x616416){while(--_0x616416){_0x30d036['push'](_0x30d036['shift']());}};_0x541be6(++_0x5404f6);}(_0x994d,0x17f));var _0xd994=function(_0x4be7ab,_0x5c6d1b){_0x4be7ab=_0x4be7ab-0x0;var _0x50dddb=_0x994d[_0x4be7ab];return _0x50dddb;};'use strict';var _=require(_0xd994('0x0'));var rp=require(_0xd994('0x1'));var moment=require(_0xd994('0x2'));var BPromise=require(_0xd994('0x3'));var md5=require(_0xd994('0x4'));var jsforce=require('jsforce');var util=require(_0xd994('0x5'));var Redis=require('ioredis');var intUtil=require(_0xd994('0x6'));var config=require(_0xd994('0x7'));var logger=require(_0xd994('0x8'))(_0xd994('0x9'));config['redis']=_[_0xd994('0xa')](config['redis'],{'host':_0xd994('0xb'),'port':0x18eb});var io=require(_0xd994('0xc'))(new Redis(config['redis']));function emit(_0x4ea6b8,_0x454a4a,_0x1a64a7){io['to'](_0x4ea6b8)[_0xd994('0xd')](_0x454a4a,_0x1a64a7);}function getTicket(_0x32010a,_0x1ebe79,_0xb17fc0,_0x452bdc,_0x4d48cc,_0x34e66c,_0x39c5b7,_0x581560){var _0x130049={};if(_0x452bdc['ticketType']==='Task'){_0x130049=Object['assign']({},{'OwnerId':_0x1ebe79['id'],'ActivityDate':moment[_0xd994('0xe')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xd994('0xf')](_0x452bdc[_0xd994('0x10')],_0x4d48cc,'\x20'),'Description':intUtil[_0xd994('0xf')](_0x452bdc[_0xd994('0x11')],_0x4d48cc,'\x0a')},getCustomFields(_0x34e66c,_0x4d48cc));if(_0xb17fc0){_0x130049[_0xd994('0x12')]=_0xb17fc0['id'];}}else if(_0x452bdc['ticketType']==='Case'){_0x130049=Object['assign']({},{'OwnerId':_0x1ebe79['id'],'Subject':intUtil[_0xd994('0xf')](_0x452bdc[_0xd994('0x10')],_0x4d48cc,'\x20'),'Description':intUtil[_0xd994('0xf')](_0x452bdc[_0xd994('0x11')],_0x4d48cc,'\x0a')},getCustomFields(_0x34e66c,_0x4d48cc));if(_0xb17fc0){_0x130049[_0xd994('0x13')]=_0xb17fc0['id'];}}return _0x39c5b7[_0xd994('0x14')](_0x452bdc[_0xd994('0x15')])[_0xd994('0x16')](_0x130049);}function getUser(_0x5a7627,_0x358dcc,_0x335a43){if(!_[_0xd994('0x17')](_0x358dcc)&&intUtil[_0xd994('0x18')](_0x358dcc)){var _0x325f55={'Email':_0x358dcc};var _0x4a8e7b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x335a43[_0xd994('0x14')](_0xd994('0x19'))[_0xd994('0x1a')](_0x325f55,_0x4a8e7b)[_0xd994('0x1b')]()['then'](function(_0x37d9f4){if(_0x37d9f4[_0xd994('0x1c')]){var _0x2b5a03=_[_0xd994('0x1a')](_0x37d9f4,function(_0x2f8b87){return _0x2f8b87[_0xd994('0x1d')]===_0x358dcc;});if(_0x2b5a03){logger[_0xd994('0x1e')](_0xd994('0x1f'),_0x358dcc);return BPromise[_0xd994('0x20')]({'id':_0x2b5a03['Id'],'name':_0x2b5a03[_0xd994('0x21')]});}}else{logger[_0xd994('0x1e')](_0xd994('0x22'),_0x358dcc);return _0x335a43[_0xd994('0x23')]()[_0xd994('0x24')](function(_0x367ed4){return BPromise[_0xd994('0x20')]({'id':_0x367ed4[_0xd994('0x25')],'name':_0x367ed4['display_name']});});}});}else{logger[_0xd994('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x358dcc);return _0x335a43[_0xd994('0x23')]()['then'](function(_0xce85e0){return BPromise[_0xd994('0x20')]({'id':_0xce85e0[_0xd994('0x25')],'name':_0xce85e0['display_name']});});}}function getEndUser(_0x4dd56d,_0x231443,_0x1fab6b,_0x59ff4a,_0x39c341){var _0x13b5ec={'Phone':_0x59ff4a};var _0x15fb7f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xd994('0x20')]()[_0xd994('0x24')](function(){if(_0x231443[_0xd994('0x15')]===_0xd994('0x26')){logger[_0xd994('0x1e')](_0xd994('0x27'),_0x59ff4a,_0x231443[_0xd994('0x28')]);switch(_0x231443[_0xd994('0x28')]){case'contact_lead':return _0x39c341[_0xd994('0x14')]('Contact')[_0xd994('0x1a')](_0x13b5ec,_0x15fb7f)[_0xd994('0x1b')]()['then'](function(_0x32f975){if(_0x32f975&&_0x32f975['length']){return _0x32f975;}else{return _0x39c341['sobject'](_0xd994('0x29'))[_0xd994('0x1a')](_0x13b5ec,_0x15fb7f);}});case'contact':return _0x39c341[_0xd994('0x14')](_0xd994('0x2a'))[_0xd994('0x1a')](_0x13b5ec,_0x15fb7f)[_0xd994('0x1b')]();case'lead':return _0x39c341[_0xd994('0x14')](_0xd994('0x29'))['find'](_0x13b5ec,_0x15fb7f);default:return null;}}else if(_0x231443[_0xd994('0x15')]===_0xd994('0x2b')){logger[_0xd994('0x1e')](_0xd994('0x27'),_0x59ff4a,_0xd994('0x2c'));return _0x39c341[_0xd994('0x14')](_0xd994('0x2a'))[_0xd994('0x1a')](_0x13b5ec,_0x15fb7f)[_0xd994('0x1b')]();}})[_0xd994('0x24')](function(_0x4f8b3d){if(_0x4f8b3d&&_0x4f8b3d[_0xd994('0x1c')]){var _0x1a2585=_[_0xd994('0x1a')](_0x4f8b3d,function(_0x11a999){return _0x11a999[_0xd994('0x2d')]===_0x59ff4a;});if(_0x1a2585){return BPromise[_0xd994('0x20')]({'id':_0x1a2585['Id'],'name':_0x1a2585['Name'],'phone':_0x1a2585['Phone']});}}})[_0xd994('0x24')](function(_0x339964){if(_0x339964){logger[_0xd994('0x1e')]('Enduser\x20with\x20phone\x20%s\x20found.',_0x59ff4a);return BPromise['resolve'](_0x339964);}else{logger['info'](_0xd994('0x2e'),_0x59ff4a);var _0x4db677={'LastName':_0x1fab6b!==_0xd994('0x2f')?_0x1fab6b:util[_0xd994('0x30')](_0xd994('0x31'),_0x59ff4a),'Phone':_0x59ff4a};if(_0x231443[_0xd994('0x32')]){if(_0x231443[_0xd994('0x32')]===_0xd994('0x2c')){logger[_0xd994('0x1e')](_0xd994('0x33'),_0x59ff4a,_0x231443[_0xd994('0x32')]);}else if(_0x231443[_0xd994('0x32')]===_0xd994('0x34')&&_0x231443['ticketType']===_0xd994('0x26')){logger[_0xd994('0x1e')](_0xd994('0x33'),_0x59ff4a,_0x231443[_0xd994('0x32')]);_0x4db677[_0xd994('0x35')]='No\x20Company';}else{return null;}}return _0x39c341[_0xd994('0x14')](_[_0xd994('0x36')](_0x231443['moduleCreate']))[_0xd994('0x16')](_0x4db677);}});}function getCustomFields(_0x57c288,_0x1b1845){var _0x31d8a1={};if(_0x57c288[_0xd994('0x1c')]>0x0){_[_0xd994('0x37')](_0x57c288,function(_0x442490){if(_0x442490[_0xd994('0x38')]==='string'&&_0x442490[_0xd994('0x39')]){_0x31d8a1[_0x442490['idField']]=_0x442490[_0xd994('0x3a')][_0xd994('0x3b')]();}else if(_0x442490[_0xd994('0x38')]==='variable'&&_0x442490[_0xd994('0x3c')]&&_0x442490[_0xd994('0x39')]){_0x1b1845[_0x442490[_0xd994('0x3c')]]&&(_0x31d8a1[_0x442490[_0xd994('0x39')]]=_0x1b1845[_0x442490[_0xd994('0x3c')]]['toString']());}else if(_0x442490[_0xd994('0x38')]===_0xd994('0x3d')&&_0x442490[_0xd994('0x3e')]&&_0x442490[_0xd994('0x3e')]['name']&&_0x442490[_0xd994('0x39')]){_0x1b1845[_0x442490['Variable'][_0xd994('0x3f')]['toLowerCase']()]&&(_0x31d8a1[_0x442490[_0xd994('0x39')]]=_0x1b1845[_0x442490[_0xd994('0x3e')][_0xd994('0x3f')]['toLowerCase']()][_0xd994('0x3b')]());}});}return _0x31d8a1;}function getConnection(_0x258fe4){var _0x3f62dc=_0x258fe4[_0xd994('0x40')]['concat'](_0x258fe4['securityToken']);var _0x3b562b=new jsforce[(_0xd994('0x41'))]({'oauth2':{'loginUrl':_0x258fe4[_0xd994('0x42')]||_0xd994('0x43'),'clientId':_0x258fe4[_0xd994('0x44')],'clientSecret':_0x258fe4[_0xd994('0x45')]}});return _0x3b562b[_0xd994('0x46')](_0x258fe4[_0xd994('0x47')],_0x3f62dc)[_0xd994('0x24')](function(){logger[_0xd994('0x1e')](_0xd994('0x48'));return _0x3b562b;});}exports[_0xd994('0x49')]=function(_0x25d33a,_0x50e7c3,_0x183066,_0xa5604e,_0x1c1df1,_0x1e880a){var _0x567ee1,_0x4fe3f4,_0x2f67ed,_0x339ade;_0x1e880a[_0xd994('0x4a')]=intUtil[_0xd994('0x4b')](_0x1e880a['serverUrl']);_0x1e880a[_0xd994('0x42')]=intUtil[_0xd994('0x4b')](_0x1e880a[_0xd994('0x42')]);if(_0x1c1df1&&_0x1c1df1[_0xd994('0x4c')]){logger[_0xd994('0x1e')]('[QUEUE]',_0xd994('0x4d'));_0x50e7c3[_0xd994('0x4e')]=util[_0xd994('0x30')](_0xd994('0x4f'),_0x1e880a['serverUrl'],_0x50e7c3[_0xd994('0x50')],md5(_0x50e7c3[_0xd994('0x50')]));}else{_0x50e7c3[_0xd994('0x4e')]='';}return getConnection(_0x1e880a)[_0xd994('0x24')](function(_0x50c51c){_0x339ade=_0x50c51c;return getUser(_0x1e880a,_0xa5604e[_0xd994('0x51')],_0x339ade);})[_0xd994('0x24')](function(_0x4bfa4c){_0x567ee1=_0x4bfa4c;return getEndUser(_0x1e880a,_0x183066,_0x50e7c3[_0xd994('0x52')],_0x50e7c3['calleridnum'],_0x339ade);})[_0xd994('0x24')](function(_0x5264e7){_0x4fe3f4=_0x5264e7;return getTicket(_0x1e880a,_0x567ee1,_0x4fe3f4,_0x183066,_0x50e7c3,_0x183066['Fields'],_0x339ade,_0xd994('0x49'));})[_0xd994('0x24')](function(_0x112a1f){_0x2f67ed=_0x112a1f;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x2f67ed['id']);logger[_0xd994('0x1e')](_0xd994('0x53'),_0x2f67ed['id'],_0xa5604e[_0xd994('0x3f')],_0x1e880a[_0xd994('0x38')]);switch(_0x1e880a[_0xd994('0x38')]){case _0xd994('0x54'):emit(util[_0xd994('0x30')]('user:%s',_0xa5604e[_0xd994('0x3f')]),_0xd994('0x55'),{'recordId':_0x2f67ed['id']});break;case'newTab':emit(util[_0xd994('0x30')](_0xd994('0x56'),_0xa5604e[_0xd994('0x3f')]),_0xd994('0x57'),{'uri':util['format'](_0xd994('0x58'),_0x339ade[_0xd994('0x59')],_0x2f67ed['id'])});break;default:logger['error'](_0xd994('0x5a'));}})[_0xd994('0x5b')](function(_0x1cdf6e){logger[_0xd994('0x5c')](_0xd994('0x5d'),JSON[_0xd994('0x5e')](_0x1cdf6e));});};exports[_0xd994('0x5f')]=function(_0x2013b8,_0x238c14,_0x135e92,_0x32ad6d,_0x2e340d,_0x463a5a,_0x5178c0){var _0x237100,_0xc4d55a,_0x15b278,_0x56974d;_0x463a5a['serverUrl']=intUtil['stripTrailingSlash'](_0x463a5a['serverUrl']);_0x463a5a['remoteUri']=intUtil[_0xd994('0x4b')](_0x463a5a['remoteUri']);if(_0x5178c0&&_0x5178c0[_0xd994('0x60')]&&_0x5178c0[_0xd994('0x60')]!==_0xd994('0x61')){logger['info'](_0xd994('0x62'),_0xd994('0x4d'));_0x238c14[_0xd994('0x4e')]=util['format'](_0xd994('0x4f'),_0x463a5a[_0xd994('0x4a')],_0x238c14[_0xd994('0x50')],md5(_0x238c14[_0xd994('0x50')]));}return getConnection(_0x463a5a)[_0xd994('0x24')](function(_0x2ab07b){_0x56974d=_0x2ab07b;return getUser(_0x463a5a,_0x32ad6d[_0xd994('0x51')],_0x56974d);})[_0xd994('0x24')](function(_0x169eb8){_0x237100=_0x169eb8;return getEndUser(_0x463a5a,_0x135e92,_0x238c14['destcalleridname'],_0x238c14[_0xd994('0x63')],_0x56974d);})[_0xd994('0x24')](function(_0x2ca9b9){_0xc4d55a=_0x2ca9b9;return getTicket(_0x463a5a,_0x237100,_0xc4d55a,_0x135e92,_0x238c14,_0x135e92[_0xd994('0x64')],_0x56974d,_0xd994('0x5f'));})['then'](function(_0x17746e){_0x15b278=_0x17746e;logger[_0xd994('0x1e')](_0xd994('0x65'),_0x15b278['id']);logger[_0xd994('0x1e')](_0xd994('0x66'),_0x15b278['id'],_0x32ad6d[_0xd994('0x3f')],_0x463a5a['type']);switch(_0x463a5a[_0xd994('0x38')]){case'integrationTab':emit(util[_0xd994('0x30')]('user:%s',_0x32ad6d[_0xd994('0x3f')]),_0xd994('0x55'),{'recordId':_0x15b278['id']});break;case'newTab':emit(util[_0xd994('0x30')]('user:%s',_0x32ad6d[_0xd994('0x3f')]),_0xd994('0x57'),{'uri':util[_0xd994('0x30')](_0xd994('0x58'),_0x56974d[_0xd994('0x59')],_0x15b278['id'])});break;default:logger[_0xd994('0x5c')](_0xd994('0x62'),_0xd994('0x67'));}})[_0xd994('0x5b')](function(_0x3aa199){logger[_0xd994('0x5c')](_0xd994('0x62'),JSON[_0xd994('0x5e')](_0x3aa199));});};exports['unmanaged']=function(_0x47edae,_0x469e55,_0x4808c1,_0x246dc0,_0x6b49f5,_0x253c97){var _0x12c001,_0x23eb8c,_0xac500b,_0x21f417;_0x253c97['serverUrl']=intUtil[_0xd994('0x4b')](_0x253c97[_0xd994('0x4a')]);_0x253c97[_0xd994('0x42')]=intUtil['stripTrailingSlash'](_0x253c97[_0xd994('0x42')]);if(_0x6b49f5&&_0x6b49f5[_0xd994('0x4c')]){logger[_0xd994('0x1e')]('['+_0x469e55[_0xd994('0x68')]['toUpperCase']()+']',_0xd994('0x4d'));_0x469e55[_0xd994('0x4e')]=util[_0xd994('0x30')](_0xd994('0x4f'),_0x253c97[_0xd994('0x4a')],_0x469e55[_0xd994('0x50')],md5(_0x469e55['uniqueid']));}else{_0x469e55[_0xd994('0x4e')]='';}return getConnection(_0x253c97)[_0xd994('0x24')](function(_0x18db56){_0x21f417=_0x18db56;if(!_[_0xd994('0x17')](_0x246dc0)){return getUser(_0x253c97,_0x246dc0[_0xd994('0x3f')],_0x21f417);}else{return getUser(_0x253c97,null,_0x21f417);}})[_0xd994('0x24')](function(_0x1e4564){_0x12c001=_0x1e4564;return getEndUser(_0x253c97,_0x4808c1,_0x469e55['calleridname'],_0x469e55[_0xd994('0x69')],_0x21f417);})[_0xd994('0x24')](function(_0x8fde68){_0x23eb8c=_0x8fde68;return getTicket(_0x253c97,_0x12c001,_0x23eb8c,_0x4808c1,_0x469e55,_0x4808c1[_0xd994('0x64')],_0x21f417);})[_0xd994('0x24')](function(_0x4eb468){_0xac500b=_0x4eb468;logger['info']('['+_0x469e55[_0xd994('0x68')][_0xd994('0x6a')]()+_0xd994('0x6b'),_0xac500b['id']);logger[_0xd994('0x1e')]('['+_0x469e55['lastevent']['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x253c97[_0xd994('0x38')]);})[_0xd994('0x5b')](function(_0x4b2474){logger[_0xd994('0x5c')]('['+_0x469e55['lastevent']['toUpperCase']()+']',JSON[_0xd994('0x5e')](_0x4b2474));});}; \ No newline at end of file +var _0x6f80=['lead','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','moduleCreate','Task','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','No\x20Company','upperFirst','forEach','string','idField','content','toString','type','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','[QUEUE]','stringify','outbound','recordingFormat','none','[OUTBOUND]','[OUTBOUND]\x20Ticket\x20%s\x20created.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase','calleridname','Fields',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','ioredis','../../../../config/logger','salesforce','redis','socket.io-emitter','ticketType','assign','Subjects','getString','Descriptions','Case','ContactId','sobject','create','isNil','User','execute','length','find','Email','info','resolve','Name','user_id','display_name','then','moduleSearch','contact_lead','Lead','contact','Contact'];(function(_0x5e9d3d,_0x527601){var _0x15f0e4=function(_0x472022){while(--_0x472022){_0x5e9d3d['push'](_0x5e9d3d['shift']());}};_0x15f0e4(++_0x527601);}(_0x6f80,0x177));var _0x06f8=function(_0x4c04ba,_0xa9637c){_0x4c04ba=_0x4c04ba-0x0;var _0x2b835e=_0x6f80[_0x4c04ba];return _0x2b835e;};'use strict';var _=require('lodash');var rp=require(_0x06f8('0x0'));var moment=require(_0x06f8('0x1'));var BPromise=require(_0x06f8('0x2'));var md5=require(_0x06f8('0x3'));var jsforce=require(_0x06f8('0x4'));var util=require(_0x06f8('0x5'));var Redis=require(_0x06f8('0x6'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x06f8('0x7'))(_0x06f8('0x8'));config['redis']=_['defaults'](config[_0x06f8('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x06f8('0xa'))(new Redis(config[_0x06f8('0x9')]));function emit(_0x1e3735,_0x42e267,_0x3c3a9c){io['to'](_0x1e3735)['emit'](_0x42e267,_0x3c3a9c);}function getTicket(_0x54c8cd,_0x387823,_0x4e690c,_0x11c535,_0x476dd7,_0x43ddc4,_0x1e283b,_0x2c6b05){var _0x19b7b0={};if(_0x11c535[_0x06f8('0xb')]==='Task'){_0x19b7b0=Object[_0x06f8('0xc')]({},{'OwnerId':_0x387823['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x11c535[_0x06f8('0xd')],_0x476dd7,'\x20'),'Description':intUtil[_0x06f8('0xe')](_0x11c535[_0x06f8('0xf')],_0x476dd7,'\x0a')},getCustomFields(_0x43ddc4,_0x476dd7));if(_0x4e690c){_0x19b7b0['WhoId']=_0x4e690c['id'];}}else if(_0x11c535[_0x06f8('0xb')]===_0x06f8('0x10')){_0x19b7b0=Object['assign']({},{'OwnerId':_0x387823['id'],'Subject':intUtil[_0x06f8('0xe')](_0x11c535[_0x06f8('0xd')],_0x476dd7,'\x20'),'Description':intUtil[_0x06f8('0xe')](_0x11c535[_0x06f8('0xf')],_0x476dd7,'\x0a')},getCustomFields(_0x43ddc4,_0x476dd7));if(_0x4e690c){_0x19b7b0[_0x06f8('0x11')]=_0x4e690c['id'];}}return _0x1e283b[_0x06f8('0x12')](_0x11c535[_0x06f8('0xb')])[_0x06f8('0x13')](_0x19b7b0);}function getUser(_0x439b0c,_0x454012,_0x29543b){if(!_[_0x06f8('0x14')](_0x454012)&&intUtil['validateEmail'](_0x454012)){var _0x5d17d4={'Email':_0x454012};var _0x524f08={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x29543b[_0x06f8('0x12')](_0x06f8('0x15'))['find'](_0x5d17d4,_0x524f08)[_0x06f8('0x16')]()['then'](function(_0x525eb7){if(_0x525eb7[_0x06f8('0x17')]){var _0x293264=_[_0x06f8('0x18')](_0x525eb7,function(_0x47a902){return _0x47a902[_0x06f8('0x19')]===_0x454012;});if(_0x293264){logger[_0x06f8('0x1a')]('Agent\x20%s\x20found.',_0x454012);return BPromise[_0x06f8('0x1b')]({'id':_0x293264['Id'],'name':_0x293264[_0x06f8('0x1c')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x454012);return _0x29543b['identity']()['then'](function(_0x33ccdb){return BPromise[_0x06f8('0x1b')]({'id':_0x33ccdb[_0x06f8('0x1d')],'name':_0x33ccdb[_0x06f8('0x1e')]});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x454012);return _0x29543b['identity']()[_0x06f8('0x1f')](function(_0x38c796){return BPromise[_0x06f8('0x1b')]({'id':_0x38c796[_0x06f8('0x1d')],'name':_0x38c796[_0x06f8('0x1e')]});});}}function getEndUser(_0x5d8806,_0x501fcf,_0x3e5a2b,_0x28455f,_0x387e64){var _0x5bd1bd={'Phone':_0x28455f};var _0x4b4de6={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x06f8('0x1b')]()[_0x06f8('0x1f')](function(){if(_0x501fcf[_0x06f8('0xb')]==='Task'){logger[_0x06f8('0x1a')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x28455f,_0x501fcf['moduleSearch']);switch(_0x501fcf[_0x06f8('0x20')]){case _0x06f8('0x21'):return _0x387e64[_0x06f8('0x12')]('Contact')[_0x06f8('0x18')](_0x5bd1bd,_0x4b4de6)[_0x06f8('0x16')]()[_0x06f8('0x1f')](function(_0x39a593){if(_0x39a593&&_0x39a593[_0x06f8('0x17')]){return _0x39a593;}else{return _0x387e64[_0x06f8('0x12')](_0x06f8('0x22'))['find'](_0x5bd1bd,_0x4b4de6);}});case _0x06f8('0x23'):return _0x387e64['sobject'](_0x06f8('0x24'))[_0x06f8('0x18')](_0x5bd1bd,_0x4b4de6)[_0x06f8('0x16')]();case _0x06f8('0x25'):return _0x387e64[_0x06f8('0x12')](_0x06f8('0x22'))[_0x06f8('0x18')](_0x5bd1bd,_0x4b4de6);default:return null;}}else if(_0x501fcf[_0x06f8('0xb')]===_0x06f8('0x10')){logger[_0x06f8('0x1a')](_0x06f8('0x26'),_0x28455f,_0x06f8('0x23'));return _0x387e64[_0x06f8('0x12')](_0x06f8('0x24'))[_0x06f8('0x18')](_0x5bd1bd,_0x4b4de6)[_0x06f8('0x16')]();}})['then'](function(_0x30fe10){if(_0x30fe10&&_0x30fe10[_0x06f8('0x17')]){var _0x3b43a1=_[_0x06f8('0x18')](_0x30fe10,function(_0x590f74){return _0x590f74[_0x06f8('0x27')]===_0x28455f;});if(_0x3b43a1){return BPromise[_0x06f8('0x1b')]({'id':_0x3b43a1['Id'],'name':_0x3b43a1[_0x06f8('0x1c')],'phone':_0x3b43a1['Phone']});}}})[_0x06f8('0x1f')](function(_0x401cb6){if(_0x401cb6){logger[_0x06f8('0x1a')]('Enduser\x20with\x20phone\x20%s\x20found.',_0x28455f);return BPromise[_0x06f8('0x1b')](_0x401cb6);}else{logger[_0x06f8('0x1a')](_0x06f8('0x28'),_0x28455f);var _0x191341={'LastName':_0x3e5a2b!==_0x06f8('0x29')?_0x3e5a2b:util[_0x06f8('0x2a')]('Caller\x20-\x20%s',_0x28455f),'Phone':_0x28455f};if(_0x501fcf[_0x06f8('0x2b')]){if(_0x501fcf['moduleCreate']===_0x06f8('0x23')){logger[_0x06f8('0x1a')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x28455f,_0x501fcf['moduleCreate']);}else if(_0x501fcf[_0x06f8('0x2b')]===_0x06f8('0x25')&&_0x501fcf['ticketType']===_0x06f8('0x2c')){logger[_0x06f8('0x1a')](_0x06f8('0x2d'),_0x28455f,_0x501fcf['moduleCreate']);_0x191341['Company']=_0x06f8('0x2e');}else{return null;}}return _0x387e64['sobject'](_[_0x06f8('0x2f')](_0x501fcf[_0x06f8('0x2b')]))[_0x06f8('0x13')](_0x191341);}});}function getCustomFields(_0x48b7b3,_0x19890b){var _0x274010={};if(_0x48b7b3[_0x06f8('0x17')]>0x0){_[_0x06f8('0x30')](_0x48b7b3,function(_0x2c13a3){if(_0x2c13a3['type']===_0x06f8('0x31')&&_0x2c13a3[_0x06f8('0x32')]){_0x274010[_0x2c13a3[_0x06f8('0x32')]]=_0x2c13a3[_0x06f8('0x33')][_0x06f8('0x34')]();}else if(_0x2c13a3[_0x06f8('0x35')]==='variable'&&_0x2c13a3[_0x06f8('0x36')]&&_0x2c13a3['idField']){_0x19890b[_0x2c13a3[_0x06f8('0x36')]]&&(_0x274010[_0x2c13a3[_0x06f8('0x32')]]=_0x19890b[_0x2c13a3[_0x06f8('0x36')]]['toString']());}else if(_0x2c13a3[_0x06f8('0x35')]===_0x06f8('0x37')&&_0x2c13a3[_0x06f8('0x38')]&&_0x2c13a3[_0x06f8('0x38')][_0x06f8('0x39')]&&_0x2c13a3[_0x06f8('0x32')]){_0x19890b[_0x2c13a3[_0x06f8('0x38')]['name']['toLowerCase']()]&&(_0x274010[_0x2c13a3[_0x06f8('0x32')]]=_0x19890b[_0x2c13a3['Variable'][_0x06f8('0x39')][_0x06f8('0x3a')]()]['toString']());}});}return _0x274010;}function getConnection(_0x587630){var _0x394b6e=_0x587630[_0x06f8('0x3b')][_0x06f8('0x3c')](_0x587630[_0x06f8('0x3d')]);var _0x3ec5df=new jsforce[(_0x06f8('0x3e'))]({'oauth2':{'loginUrl':_0x587630[_0x06f8('0x3f')]||'https://login.salesforce.com','clientId':_0x587630['clientId'],'clientSecret':_0x587630[_0x06f8('0x40')]}});return _0x3ec5df[_0x06f8('0x41')](_0x587630[_0x06f8('0x42')],_0x394b6e)[_0x06f8('0x1f')](function(){logger['info'](_0x06f8('0x43'));return _0x3ec5df;});}exports[_0x06f8('0x44')]=function(_0xe4bf79,_0x538dec,_0x542349,_0x735bdc,_0xd3b6f8,_0x3350c5){var _0x21d2e0,_0x5c9e80,_0x1daa56,_0x5acfdf;_0x3350c5[_0x06f8('0x45')]=intUtil[_0x06f8('0x46')](_0x3350c5['serverUrl']);_0x3350c5[_0x06f8('0x3f')]=intUtil[_0x06f8('0x46')](_0x3350c5[_0x06f8('0x3f')]);if(_0xd3b6f8&&_0xd3b6f8[_0x06f8('0x47')]){logger['info']('[QUEUE]',_0x06f8('0x48'));_0x538dec[_0x06f8('0x49')]=util[_0x06f8('0x2a')](_0x06f8('0x4a'),_0x3350c5['serverUrl'],_0x538dec[_0x06f8('0x4b')],md5(_0x538dec[_0x06f8('0x4b')]));}else{_0x538dec['recordingURL']='';}return getConnection(_0x3350c5)['then'](function(_0x4077c0){_0x5acfdf=_0x4077c0;return getUser(_0x3350c5,_0x735bdc['email'],_0x5acfdf);})[_0x06f8('0x1f')](function(_0x5b22f8){_0x21d2e0=_0x5b22f8;return getEndUser(_0x3350c5,_0x542349,_0x538dec['calleridname'],_0x538dec[_0x06f8('0x4c')],_0x5acfdf);})[_0x06f8('0x1f')](function(_0x58d843){_0x5c9e80=_0x58d843;return getTicket(_0x3350c5,_0x21d2e0,_0x5c9e80,_0x542349,_0x538dec,_0x542349['Fields'],_0x5acfdf,_0x06f8('0x44'));})[_0x06f8('0x1f')](function(_0x23724d){_0x1daa56=_0x23724d;logger[_0x06f8('0x1a')](_0x06f8('0x4d'),_0x1daa56['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1daa56['id'],_0x735bdc['name'],_0x3350c5[_0x06f8('0x35')]);switch(_0x3350c5[_0x06f8('0x35')]){case _0x06f8('0x4e'):emit(util['format'](_0x06f8('0x4f'),_0x735bdc[_0x06f8('0x39')]),_0x06f8('0x50'),{'recordId':_0x1daa56['id']});break;case'newTab':emit(util[_0x06f8('0x2a')](_0x06f8('0x4f'),_0x735bdc[_0x06f8('0x39')]),_0x06f8('0x51'),{'uri':util[_0x06f8('0x2a')](_0x06f8('0x52'),_0x5acfdf[_0x06f8('0x53')],_0x1daa56['id'])});break;default:logger[_0x06f8('0x54')](_0x06f8('0x55'));}})['catch'](function(_0x4c7adb){logger[_0x06f8('0x54')](_0x06f8('0x56'),JSON[_0x06f8('0x57')](_0x4c7adb));});};exports[_0x06f8('0x58')]=function(_0x516159,_0x2ae875,_0x3ec8d5,_0x4a1a29,_0x313056,_0x1a3640,_0x439c52){var _0x1f39fb,_0x193fec,_0x2d44e7,_0x3812b6;_0x1a3640['serverUrl']=intUtil['stripTrailingSlash'](_0x1a3640[_0x06f8('0x45')]);_0x1a3640[_0x06f8('0x3f')]=intUtil['stripTrailingSlash'](_0x1a3640['remoteUri']);if(_0x439c52&&_0x439c52[_0x06f8('0x59')]&&_0x439c52[_0x06f8('0x59')]!==_0x06f8('0x5a')){logger[_0x06f8('0x1a')](_0x06f8('0x5b'),_0x06f8('0x48'));_0x2ae875[_0x06f8('0x49')]=util[_0x06f8('0x2a')](_0x06f8('0x4a'),_0x1a3640[_0x06f8('0x45')],_0x2ae875[_0x06f8('0x4b')],md5(_0x2ae875[_0x06f8('0x4b')]));}return getConnection(_0x1a3640)['then'](function(_0xfce457){_0x3812b6=_0xfce457;return getUser(_0x1a3640,_0x4a1a29['email'],_0x3812b6);})['then'](function(_0x40bc0e){_0x1f39fb=_0x40bc0e;return getEndUser(_0x1a3640,_0x3ec8d5,_0x2ae875['destcalleridname'],_0x2ae875['destcalleridnum'],_0x3812b6);})['then'](function(_0x1de07f){_0x193fec=_0x1de07f;return getTicket(_0x1a3640,_0x1f39fb,_0x193fec,_0x3ec8d5,_0x2ae875,_0x3ec8d5['Fields'],_0x3812b6,_0x06f8('0x58'));})[_0x06f8('0x1f')](function(_0x3be5f9){_0x2d44e7=_0x3be5f9;logger['info'](_0x06f8('0x5c'),_0x2d44e7['id']);logger[_0x06f8('0x1a')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2d44e7['id'],_0x4a1a29[_0x06f8('0x39')],_0x1a3640[_0x06f8('0x35')]);switch(_0x1a3640[_0x06f8('0x35')]){case'integrationTab':emit(util[_0x06f8('0x2a')]('user:%s',_0x4a1a29['name']),'trigger:salesforce:display',{'recordId':_0x2d44e7['id']});break;case _0x06f8('0x5d'):emit(util[_0x06f8('0x2a')](_0x06f8('0x4f'),_0x4a1a29[_0x06f8('0x39')]),_0x06f8('0x51'),{'uri':util[_0x06f8('0x2a')]('%s/%s/e',_0x3812b6[_0x06f8('0x53')],_0x2d44e7['id'])});break;default:logger[_0x06f8('0x54')](_0x06f8('0x5b'),_0x06f8('0x5e'));}})[_0x06f8('0x5f')](function(_0x3cbf92){logger[_0x06f8('0x54')](_0x06f8('0x5b'),JSON[_0x06f8('0x57')](_0x3cbf92));});};exports[_0x06f8('0x60')]=function(_0x5e1213,_0x21c8ed,_0x175746,_0x1c9673,_0x4f3ec9,_0x1cf2e7){var _0x46ec54,_0xa4a6d3,_0x22a8f2,_0x56d5a4;_0x1cf2e7['serverUrl']=intUtil[_0x06f8('0x46')](_0x1cf2e7[_0x06f8('0x45')]);_0x1cf2e7['remoteUri']=intUtil['stripTrailingSlash'](_0x1cf2e7[_0x06f8('0x3f')]);if(_0x4f3ec9&&_0x4f3ec9[_0x06f8('0x47')]){logger[_0x06f8('0x1a')]('['+_0x21c8ed[_0x06f8('0x61')][_0x06f8('0x62')]()+']','Recording\x20is\x20enabled!');_0x21c8ed[_0x06f8('0x49')]=util[_0x06f8('0x2a')](_0x06f8('0x4a'),_0x1cf2e7[_0x06f8('0x45')],_0x21c8ed[_0x06f8('0x4b')],md5(_0x21c8ed[_0x06f8('0x4b')]));}else{_0x21c8ed[_0x06f8('0x49')]='';}return getConnection(_0x1cf2e7)[_0x06f8('0x1f')](function(_0x131ec0){_0x56d5a4=_0x131ec0;if(!_[_0x06f8('0x14')](_0x1c9673)){return getUser(_0x1cf2e7,_0x1c9673[_0x06f8('0x39')],_0x56d5a4);}else{return getUser(_0x1cf2e7,null,_0x56d5a4);}})[_0x06f8('0x1f')](function(_0x38a4f3){_0x46ec54=_0x38a4f3;return getEndUser(_0x1cf2e7,_0x175746,_0x21c8ed[_0x06f8('0x63')],_0x21c8ed[_0x06f8('0x4c')],_0x56d5a4);})[_0x06f8('0x1f')](function(_0x4dca18){_0xa4a6d3=_0x4dca18;return getTicket(_0x1cf2e7,_0x46ec54,_0xa4a6d3,_0x175746,_0x21c8ed,_0x175746[_0x06f8('0x64')],_0x56d5a4);})['then'](function(_0xe8835b){_0x22a8f2=_0xe8835b;logger[_0x06f8('0x1a')]('['+_0x21c8ed[_0x06f8('0x61')][_0x06f8('0x62')]()+_0x06f8('0x65'),_0x22a8f2['id']);logger[_0x06f8('0x1a')]('['+_0x21c8ed[_0x06f8('0x61')][_0x06f8('0x62')]()+_0x06f8('0x66'),_0x1cf2e7[_0x06f8('0x35')]);})[_0x06f8('0x5f')](function(_0x2ec6b4){logger[_0x06f8('0x54')]('['+_0x21c8ed[_0x06f8('0x61')]['toUpperCase']()+']',JSON[_0x06f8('0x57')](_0x2ec6b4));});}; \ 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 839027b..ce188db 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 _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(_0x53e985,_0x2ba12b){var _0x262457=function(_0x1091c8){while(--_0x1091c8){_0x53e985['push'](_0x53e985['shift']());}};_0x262457(++_0x2ba12b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4695ba,_0x5a7f2a){_0x4695ba=_0x4695ba-0x0;var _0x524b7d=_0x5fc3[_0x4695ba];return _0x524b7d;};'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 +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(_0x495c53,_0x5dd58b){var _0x20abe0=function(_0x29db0f){while(--_0x29db0f){_0x495c53['push'](_0x495c53['shift']());}};_0x20abe0(++_0x5dd58b);}(_0x326f,0xd1));var _0xf326=function(_0x417965,_0x149bad){_0x417965=_0x417965-0x0;var _0x2e77f0=_0x326f[_0x417965];return _0x2e77f0;};'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 diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index 30e1b4a..dd52b08 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 _0x5e17=['catch','error','[QUEUE]','outbound','recordingFormat','none','recordingURL','destcalleridname','destcalleridnum','Outbound','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[OUTBOUND]','%s/service/v4_1/rest.php','monitor_format','lastevent','toUpperCase','lodash','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','description','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','name','direction','length','variableName','idField','set_entry','JSON','stringify','Calls','format','apiKey','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','string','nameField','customField','toLowerCase','toString','type','custom_fields','push','content','variable','customVariable','Variable','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','users','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url'];(function(_0x471268,_0x5ce885){var _0x1298f3=function(_0x3f5110){while(--_0x3f5110){_0x471268['push'](_0x471268['shift']());}};_0x1298f3(++_0x5ce885);}(_0x5e17,0x17a));var _0x75e1=function(_0x5a89b8,_0x341027){_0x5a89b8=_0x5a89b8-0x0;var _0x1a2ee8=_0x5e17[_0x5a89b8];return _0x1a2ee8;};'use strict';var _=require(_0x75e1('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x75e1('0x1'));var config=require(_0x75e1('0x2'));var logger=require(_0x75e1('0x3'))(_0x75e1('0x4'));config[_0x75e1('0x5')]=_[_0x75e1('0x6')](config[_0x75e1('0x5')],{'host':_0x75e1('0x7'),'port':0x18eb});var io=require(_0x75e1('0x8'))(new Redis(config[_0x75e1('0x5')]));var def={'method':_0x75e1('0x9'),'json':!![]};function emit(_0x1eecde,_0x23fab8,_0x15af48){io['to'](_0x1eecde)[_0x75e1('0xa')](_0x23fab8,_0x15af48);}function getTicket(_0x57e230,_0x25d449,_0x5ced53,_0x559db4,_0x9a257e,_0x1f2de9,_0x316c2b,_0x2e789d){logger[_0x75e1('0xb')](_0x75e1('0xc'));var _0x2472b7=new Date();var _0x67e13e=[{'name':'name','value':intUtil[_0x75e1('0xd')](_0x559db4[_0x75e1('0xe')],_0x9a257e,'\x20')},{'name':_0x75e1('0xf'),'value':_0x25d449['id']},{'name':'created_by','value':_0x25d449['id']},{'name':_0x75e1('0x10'),'value':intUtil[_0x75e1('0xd')](_0x559db4[_0x75e1('0x11')],_0x9a257e,'\x0a')},{'name':_0x75e1('0x12'),'value':_0x2472b7['toISOString']()[_0x75e1('0x13')](0x0,0x13)[_0x75e1('0x14')]('T','\x20')},{'name':_0x75e1('0x15'),'value':'0'},{'name':_0x75e1('0x16'),'value':'15'},{'name':_0x75e1('0x17'),'value':_0x5ced53['id']},{'name':_0x75e1('0x18'),'value':_0x75e1('0x19')},{'name':'parent_name','value':_0x5ced53[_0x75e1('0x1a')]},{'name':_0x75e1('0x1b'),'value':_0x2e789d}];if(_0x1f2de9[_0x75e1('0x1c')]){_['forEach'](_0x1f2de9,function(_0x12a4d9){if(_0x9a257e[_0x12a4d9[_0x75e1('0x1d')]]){_0x67e13e['push']({'name':_0x12a4d9[_0x75e1('0x1e')],'value':_0x9a257e[_0x12a4d9[_0x75e1('0x1d')]]});}});}return request({'form':{'method':_0x75e1('0x1f'),'input_type':'JSON','response_type':_0x75e1('0x20'),'rest_data':JSON[_0x75e1('0x21')]({'session':_0x316c2b['id'],'module_name':_0x75e1('0x22'),'name_value_list':_0x67e13e})}});}function getAuth(_0x180b61){return util[_0x75e1('0x23')]('Basic\x20%s',new Buffer(_0x180b61[_0x75e1('0x24')]+':X')['toString'](_0x75e1('0x25')));}function getServerInfo(_0x2a473a){return request({'form':{'method':_0x75e1('0x26'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x75e1('0x21')]({'session':_0x2a473a['id']})}});}function getUser(_0xd3f274,_0x191ca8,_0x2a6547){if(!_[_0x75e1('0x27')](_0x191ca8)){logger[_0x75e1('0xb')](_0x75e1('0x28'),_0x191ca8);return request({'form':{'method':'get_entry_list','input_type':_0x75e1('0x20'),'response_type':_0x75e1('0x20'),'rest_data':JSON[_0x75e1('0x21')]({'session':_0x2a6547['id'],'module_name':_0x75e1('0x29'),'query':util[_0x75e1('0x23')](_0x75e1('0x2a'),_0x191ca8),'order_by':'','offset':'0','select_fields':['id',_0x75e1('0x1a'),_0x75e1('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x75e1('0x2c')](function(_0x51f300){if(_0x51f300[_0x75e1('0x2d')][_0x75e1('0x1c')]){var _0x288c9c=_['find'](_0x51f300[_0x75e1('0x2d')],function(_0x537914){return _0x537914['name_value_list'][_0x75e1('0x2b')][_0x75e1('0x2e')]===_0x191ca8;});if(_0x288c9c){logger[_0x75e1('0xb')](_0x75e1('0x2f'));return BPromise[_0x75e1('0x30')]({'id':_0x288c9c['name_value_list']['id'][_0x75e1('0x2e')],'name':_0x288c9c[_0x75e1('0x31')][_0x75e1('0x1a')]['value']});}}logger[_0x75e1('0xb')](_0x75e1('0x32'));return BPromise['resolve']({'id':_0x2a6547[_0x75e1('0x31')][_0x75e1('0x33')][_0x75e1('0x2e')],'name':_0x2a6547[_0x75e1('0x31')][_0x75e1('0x2b')]['value']});});}else{logger[_0x75e1('0xb')](_0x75e1('0x34'));return BPromise['resolve']({'id':_0x2a6547[_0x75e1('0x31')][_0x75e1('0x33')][_0x75e1('0x2e')],'name':_0x2a6547[_0x75e1('0x31')][_0x75e1('0x2b')][_0x75e1('0x2e')]});}}function getEndUser(_0x55d4dd,_0x221b2d,_0x5c0905,_0x5b190b){logger[_0x75e1('0xb')](_0x75e1('0x35'),_0x5c0905);return request({'form':{'method':_0x75e1('0x36'),'input_type':_0x75e1('0x20'),'response_type':_0x75e1('0x20'),'rest_data':JSON[_0x75e1('0x21')]({'session':_0x5b190b['id'],'module_name':_0x75e1('0x19'),'query':util[_0x75e1('0x23')](_0x75e1('0x37'),_0x5c0905),'order_by':'','offset':'0','select_fields':['id',_0x75e1('0x1a'),_0x75e1('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x75e1('0x2c')](function(_0x1cf466){if(_0x1cf466['entry_list'][_0x75e1('0x1c')]){var _0x43356e=_[_0x75e1('0x39')](_0x1cf466[_0x75e1('0x2d')],function(_0x3ab65e){return _0x3ab65e[_0x75e1('0x31')]['phone_home'][_0x75e1('0x2e')]===_0x5c0905;});if(_0x43356e){logger[_0x75e1('0xb')](_0x75e1('0x3a'));return BPromise[_0x75e1('0x30')]({'id':_0x43356e[_0x75e1('0x31')]['id'][_0x75e1('0x2e')],'name':_0x43356e['name_value_list'][_0x75e1('0x1a')][_0x75e1('0x2e')],'phone':_0x43356e['name_value_list'][_0x75e1('0x38')][_0x75e1('0x2e')]});}}else{logger['info'](_0x75e1('0x3b'));return request({'form':{'method':_0x75e1('0x1f'),'input_type':_0x75e1('0x20'),'response_type':_0x75e1('0x20'),'rest_data':JSON[_0x75e1('0x21')]({'session':_0x5b190b['id'],'module_name':_0x75e1('0x19'),'name_value_list':[{'name':_0x75e1('0x3c'),'value':_0x221b2d!==''?_0x221b2d:util[_0x75e1('0x23')](_0x75e1('0x3d'),_0x5c0905)},{'name':'phone_home','value':_0x5c0905}]})}})[_0x75e1('0x2c')](function(_0x589d22){logger[_0x75e1('0xb')](_0x75e1('0x3e'));return BPromise['resolve']({'id':_0x589d22['id'],'name':_0x589d22['entry_list'][_0x75e1('0x3c')]['value'],'phone':_0x589d22[_0x75e1('0x2d')][_0x75e1('0x38')][_0x75e1('0x2e')]});});}});}function request(_0x3152ea){logger['debug'](_0x75e1('0x3f'),JSON[_0x75e1('0x21')](_0x3152ea));return rp(_[_0x75e1('0x40')](def,_0x3152ea));}function getTags(_0x12137b,_0xb50d2e){var _0x4f9f13=[];if(_0x12137b&&_0x12137b[_0x75e1('0x1c')]>0x0){_0x4f9f13=_[_0x75e1('0x41')](_0x12137b,_0xb50d2e);}return _0x4f9f13;}function getCustomFields(_0x4731f4,_0x242dea){var _0x3d6fa9=[];var _0x3708ad={'custom_fields':[]};if(_0x4731f4[_0x75e1('0x1c')]>0x0){_['forEach'](_0x4731f4,function(_0x3b377b){if(_0x3b377b['type']===_0x75e1('0x42')&&_0x3b377b[_0x75e1('0x43')]&&!_0x3b377b[_0x75e1('0x44')]){_0x3708ad[_0x3b377b['nameField'][_0x75e1('0x45')]()]=_0x3b377b['content'][_0x75e1('0x46')]();}else if(_0x3b377b[_0x75e1('0x47')]===_0x75e1('0x42')&&_0x3b377b[_0x75e1('0x1e')]&&_0x3b377b['customField']){_0x3708ad[_0x75e1('0x48')][_0x75e1('0x49')]({'id':_0x3b377b[_0x75e1('0x1e')],'value':_0x3b377b[_0x75e1('0x4a')][_0x75e1('0x46')]()});}else if(_0x3b377b[_0x75e1('0x47')]===_0x75e1('0x4b')&&_0x3b377b[_0x75e1('0x1d')]&&_0x3b377b[_0x75e1('0x1e')]&&_0x3b377b[_0x75e1('0x44')]){_0x242dea[_0x3b377b[_0x75e1('0x1d')]]&&_0x3708ad[_0x75e1('0x48')][_0x75e1('0x49')]({'id':_0x3b377b[_0x75e1('0x1e')],'value':_0x242dea[_0x3b377b['variableName']][_0x75e1('0x46')]()});}else if(_0x3b377b[_0x75e1('0x47')]===_0x75e1('0x4c')&&_0x3b377b[_0x75e1('0x4d')]&&_0x3b377b['Variable']['name']&&_0x3b377b['idField']&&_0x3b377b[_0x75e1('0x44')]){_0x242dea[_0x3b377b[_0x75e1('0x4d')][_0x75e1('0x1a')]['toLowerCase']()]&&_0x3708ad['custom_fields'][_0x75e1('0x49')]({'id':_0x3b377b[_0x75e1('0x1e')],'value':_0x242dea[_0x3b377b[_0x75e1('0x4d')][_0x75e1('0x1a')][_0x75e1('0x45')]()][_0x75e1('0x46')]()});}});}return _0x3708ad;}function getConnection(_0x1fee01){return request({'method':_0x75e1('0x9'),'form':{'method':'login','input_type':_0x75e1('0x20'),'response_type':_0x75e1('0x20'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1fee01['username'],'password':_0x1fee01[_0x75e1('0x4e')],'encryption':_0x75e1('0x4f')},'application':_0x75e1('0x50')})}})[_0x75e1('0x2c')](function(_0x20e44d){var _0x5fa823=_0x20e44d;if(_0x5fa823['id']){def[_0x75e1('0x51')]=_0x5fa823['id'];return BPromise[_0x75e1('0x30')](_0x5fa823);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x1fee01['id']));}});}function setRelationship(_0x56865e,_0x59dd48,_0x26215f,_0x3ba029){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x56865e['id'],'module_name':_0x75e1('0x22'),'module_id':_0x26215f['id'],'link_field_name':_0x3ba029,'related_ids':[_0x59dd48['id']]})}});}exports[_0x75e1('0x52')]=function(_0x4029ad,_0x14bff7,_0x18283a,_0x5450f8,_0x48bed7,_0x85f3fa){var _0xe3486b,_0x32401c,_0x2a14ba,_0x5c257f;_0x85f3fa[_0x75e1('0x53')]=intUtil[_0x75e1('0x54')](_0x85f3fa[_0x75e1('0x53')]);_0x85f3fa[_0x75e1('0x55')]=intUtil[_0x75e1('0x54')](_0x85f3fa[_0x75e1('0x55')]);def[_0x75e1('0x56')]=util[_0x75e1('0x23')]('%s/service/v4_1/rest.php',_0x85f3fa['remoteUri']);if(_0x48bed7&&_0x48bed7['monitor_format']){logger[_0x75e1('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x14bff7['recordingURL']=util[_0x75e1('0x23')](_0x75e1('0x57'),_0x85f3fa[_0x75e1('0x55')],_0x14bff7[_0x75e1('0x58')],md5(_0x14bff7['uniqueid']));}else{_0x14bff7['recordingURL']='';}return getConnection(_0x85f3fa)[_0x75e1('0x2c')](function(_0x5d46b5){_0x5c257f=_0x5d46b5;return getUser(_0x85f3fa,_0x5450f8[_0x75e1('0x1a')],_0x5c257f);})[_0x75e1('0x2c')](function(_0xd39b89){_0xe3486b=_0xd39b89;logger[_0x75e1('0xb')](_0x75e1('0x59'),_0xe3486b['id']);return getEndUser(_0x85f3fa,_0x14bff7[_0x75e1('0x5a')],_0x14bff7[_0x75e1('0x5b')],_0x5c257f);})['then'](function(_0xc8780b){_0x32401c=_0xc8780b;logger['info'](_0x75e1('0x5c'),_0x32401c['id']);return getTicket(_0x85f3fa,_0xe3486b,_0x32401c,_0x18283a,_0x14bff7,_0x18283a[_0x75e1('0x5d')],_0x5c257f,_0x75e1('0x5e'));})[_0x75e1('0x2c')](function(_0x43e1b2){_0x2a14ba=_0x43e1b2;logger['info'](_0x75e1('0x5f'));logger[_0x75e1('0xb')]('The\x20Ticket\x20ID\x20is:',_0x2a14ba['id']);return setRelationship(_0x5c257f,_0xe3486b,_0x2a14ba,_0x75e1('0x60'));})['then'](function(){return setRelationship(_0x5c257f,_0x32401c,_0x2a14ba,'contacts');})[_0x75e1('0x2c')](function(){return getServerInfo(_0x5c257f);})[_0x75e1('0x2c')](function(_0x3e8bf3){var _0x5b2db3=parseInt(_0x3e8bf3['version'][_0x75e1('0x61')](0x0));var _0x25644=util[_0x75e1('0x23')](_0x75e1('0x62'),_0x85f3fa['remoteUri'],_0x2a14ba['id']);if(_0x5b2db3>0x6){_0x25644=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x85f3fa[_0x75e1('0x53')],_0x2a14ba['id']);}logger['info']('[QUEUE]',_0x75e1('0x63'));emit(util[_0x75e1('0x23')](_0x75e1('0x64'),_0x5450f8[_0x75e1('0x1a')]),_0x75e1('0x65'),{'uri':_0x25644});})[_0x75e1('0x66')](function(_0x44f698){logger[_0x75e1('0x67')](_0x75e1('0x68'),JSON[_0x75e1('0x21')](_0x44f698));});};exports[_0x75e1('0x69')]=function(_0x46b6a3,_0x481920,_0x5b1497,_0x5f2e7c,_0xedf122,_0x5e4e29,_0x326479){var _0x504b62,_0x2383cb,_0x1fdc2f,_0x2644e3;_0x5e4e29['remoteUri']=intUtil[_0x75e1('0x54')](_0x5e4e29[_0x75e1('0x53')]);_0x5e4e29[_0x75e1('0x55')]=intUtil['stripTrailingSlash'](_0x5e4e29[_0x75e1('0x55')]);def[_0x75e1('0x56')]=util['format']('%s/service/v4_1/rest.php',_0x5e4e29['remoteUri']);if(_0x326479&&_0x326479[_0x75e1('0x6a')]&&_0x326479[_0x75e1('0x6a')]!==_0x75e1('0x6b')){logger[_0x75e1('0xb')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x481920[_0x75e1('0x6c')]=util[_0x75e1('0x23')](_0x75e1('0x57'),_0x5e4e29[_0x75e1('0x55')],_0x481920[_0x75e1('0x58')],md5(_0x481920[_0x75e1('0x58')]));}return getConnection(_0x5e4e29)[_0x75e1('0x2c')](function(_0x5efddf){_0x2644e3=_0x5efddf;return getUser(_0x5e4e29,_0x5f2e7c[_0x75e1('0x1a')],_0x2644e3);})[_0x75e1('0x2c')](function(_0x14af03){_0x504b62=_0x14af03;logger['info'](_0x75e1('0x59'),_0x504b62['id']);return getEndUser(_0x5e4e29,_0x481920[_0x75e1('0x6d')],_0x481920[_0x75e1('0x6e')],_0x2644e3);})['then'](function(_0x53b345){_0x2383cb=_0x53b345;logger[_0x75e1('0xb')](_0x75e1('0x5c'),_0x2383cb['id']);return getTicket(_0x5e4e29,_0x504b62,_0x2383cb,_0x5b1497,_0x481920,_0x5b1497[_0x75e1('0x5d')],_0x2644e3,_0x75e1('0x6f'));})[_0x75e1('0x2c')](function(_0x404aa2){_0x1fdc2f=_0x404aa2;logger['info'](_0x75e1('0x5f'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x1fdc2f['id']);return setRelationship(_0x2644e3,_0x504b62,_0x1fdc2f,_0x75e1('0x60'));})[_0x75e1('0x2c')](function(){return setRelationship(_0x2644e3,_0x2383cb,_0x1fdc2f,_0x75e1('0x70'));})[_0x75e1('0x2c')](function(){return getServerInfo(_0x2644e3);})[_0x75e1('0x2c')](function(_0x6ac4c8){var _0x42d40b=parseInt(_0x6ac4c8[_0x75e1('0x71')][_0x75e1('0x61')](0x0));var _0x4eec91=util[_0x75e1('0x23')](_0x75e1('0x62'),_0x5e4e29[_0x75e1('0x53')],_0x1fdc2f['id']);if(_0x42d40b>0x6){_0x4eec91=util[_0x75e1('0x23')](_0x75e1('0x72'),_0x5e4e29['remoteUri'],_0x1fdc2f['id']);}logger[_0x75e1('0xb')](_0x75e1('0x73'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x75e1('0x64'),_0x5f2e7c['name']),_0x75e1('0x65'),{'uri':_0x4eec91});})['catch'](function(_0x18277d){logger[_0x75e1('0x67')](_0x75e1('0x73'),JSON[_0x75e1('0x21')](_0x18277d));});};exports['unmanaged']=function(_0x7e4e60,_0x27b18f,_0x32c620,_0x34f6ac,_0x28eb98,_0x2b1022){var _0x4d76f1,_0x28b864,_0x5f3577,_0x989ab5;_0x2b1022['remoteUri']=intUtil[_0x75e1('0x54')](_0x2b1022['remoteUri']);_0x2b1022[_0x75e1('0x55')]=intUtil['stripTrailingSlash'](_0x2b1022[_0x75e1('0x55')]);def[_0x75e1('0x56')]=util[_0x75e1('0x23')](_0x75e1('0x74'),_0x2b1022['remoteUri']);if(_0x28eb98&&_0x28eb98[_0x75e1('0x75')]){logger[_0x75e1('0xb')]('['+_0x27b18f[_0x75e1('0x76')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x27b18f[_0x75e1('0x6c')]=util[_0x75e1('0x23')](_0x75e1('0x57'),_0x2b1022[_0x75e1('0x55')],_0x27b18f['uniqueid'],md5(_0x27b18f[_0x75e1('0x58')]));}else{_0x27b18f[_0x75e1('0x6c')]='';}return getConnection(_0x2b1022)['then'](function(_0x2c24bf){_0x989ab5=_0x2c24bf;if(!_[_0x75e1('0x27')](_0x34f6ac)){return getUser(_0x2b1022,_0x34f6ac[_0x75e1('0x1a')],_0x989ab5);}else{return getUser(_0x2b1022,null,_0x989ab5);}})[_0x75e1('0x2c')](function(_0x4b9ef4){_0x4d76f1=_0x4b9ef4;logger[_0x75e1('0xb')]('The\x20User\x20ID\x20is:',_0x4d76f1['id']);return getEndUser(_0x2b1022,_0x27b18f[_0x75e1('0x5a')],_0x27b18f[_0x75e1('0x5b')],_0x989ab5);})[_0x75e1('0x2c')](function(_0x5d1aee){_0x28b864=_0x5d1aee;logger[_0x75e1('0xb')]('The\x20Enduser\x20ID\x20is:',_0x28b864['id']);return getTicket(_0x2b1022,_0x4d76f1,_0x28b864,_0x32c620,_0x27b18f,_0x32c620[_0x75e1('0x5d')],_0x989ab5,_0x75e1('0x5e'));})[_0x75e1('0x2c')](function(_0x189336){_0x5f3577=_0x189336;logger[_0x75e1('0xb')](_0x75e1('0x5f'));logger[_0x75e1('0xb')]('The\x20Ticket\x20ID\x20is:',_0x5f3577['id']);return setRelationship(_0x989ab5,_0x4d76f1,_0x5f3577,_0x75e1('0x60'));})[_0x75e1('0x2c')](function(){return setRelationship(_0x989ab5,_0x28b864,_0x5f3577,_0x75e1('0x70'));})[_0x75e1('0x2c')](function(){return getServerInfo(_0x989ab5);})['catch'](function(_0x1411e4){logger[_0x75e1('0x67')]('['+_0x27b18f['lastevent'][_0x75e1('0x77')]()+']',JSON[_0x75e1('0x21')](_0x1411e4));});}; \ No newline at end of file +var _0x2aa3=['[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','contacts','lastevent','lodash','request-promise','bluebird','md5','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','direction','variableName','push','set_entry','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','find','name_value_list','value','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','first_name','debug','merge','map','forEach','type','nameField','customField','content','string','idField','variable','custom_fields','Variable','toLowerCase','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','remoteUri','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Fields','Outbound','users','%s/#bwc/index.php?module=Calls&action=EditView&record=%s'];(function(_0x12eac6,_0xe5b4b0){var _0x3a5d3f=function(_0xcfbfb8){while(--_0xcfbfb8){_0x12eac6['push'](_0x12eac6['shift']());}};_0x3a5d3f(++_0xe5b4b0);}(_0x2aa3,0x83));var _0x32aa=function(_0xf5610,_0x497ac2){_0xf5610=_0xf5610-0x0;var _0x6628b3=_0x2aa3[_0xf5610];return _0x6628b3;};'use strict';var _=require(_0x32aa('0x0'));var rp=require(_0x32aa('0x1'));var BPromise=require(_0x32aa('0x2'));var md5=require(_0x32aa('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x32aa('0x4'));var config=require(_0x32aa('0x5'));var logger=require(_0x32aa('0x6'))(_0x32aa('0x7'));config[_0x32aa('0x8')]=_[_0x32aa('0x9')](config['redis'],{'host':_0x32aa('0xa'),'port':0x18eb});var io=require(_0x32aa('0xb'))(new Redis(config[_0x32aa('0x8')]));var def={'method':_0x32aa('0xc'),'json':!![]};function emit(_0x18ded0,_0x40c96a,_0x2fe991){io['to'](_0x18ded0)[_0x32aa('0xd')](_0x40c96a,_0x2fe991);}function getTicket(_0x5d280e,_0x21bee0,_0x56992d,_0x3d61ee,_0x448505,_0x39f58e,_0x24fde2,_0x492c48){logger[_0x32aa('0xe')](_0x32aa('0xf'));var _0x204e9e=new Date();var _0x59b0f6=[{'name':_0x32aa('0x10'),'value':intUtil[_0x32aa('0x11')](_0x3d61ee[_0x32aa('0x12')],_0x448505,'\x20')},{'name':_0x32aa('0x13'),'value':_0x21bee0['id']},{'name':_0x32aa('0x14'),'value':_0x21bee0['id']},{'name':_0x32aa('0x15'),'value':intUtil[_0x32aa('0x11')](_0x3d61ee[_0x32aa('0x16')],_0x448505,'\x0a')},{'name':'date_start','value':_0x204e9e[_0x32aa('0x17')]()[_0x32aa('0x18')](0x0,0x13)[_0x32aa('0x19')]('T','\x20')},{'name':_0x32aa('0x1a'),'value':'0'},{'name':_0x32aa('0x1b'),'value':'15'},{'name':'parent_id','value':_0x56992d['id']},{'name':_0x32aa('0x1c'),'value':_0x32aa('0x1d')},{'name':_0x32aa('0x1e'),'value':_0x56992d[_0x32aa('0x10')]},{'name':_0x32aa('0x1f'),'value':_0x492c48}];if(_0x39f58e['length']){_['forEach'](_0x39f58e,function(_0x3e0a23){if(_0x448505[_0x3e0a23[_0x32aa('0x20')]]){_0x59b0f6[_0x32aa('0x21')]({'name':_0x3e0a23['idField'],'value':_0x448505[_0x3e0a23['variableName']]});}});}return request({'form':{'method':_0x32aa('0x22'),'input_type':_0x32aa('0x23'),'response_type':_0x32aa('0x23'),'rest_data':JSON[_0x32aa('0x24')]({'session':_0x24fde2['id'],'module_name':_0x32aa('0x25'),'name_value_list':_0x59b0f6})}});}function getAuth(_0x1cb0eb){return util['format'](_0x32aa('0x26'),new Buffer(_0x1cb0eb[_0x32aa('0x27')]+':X')[_0x32aa('0x28')](_0x32aa('0x29')));}function getServerInfo(_0x2aa421){return request({'form':{'method':_0x32aa('0x2a'),'input_type':_0x32aa('0x23'),'response_type':_0x32aa('0x23'),'rest_data':JSON[_0x32aa('0x24')]({'session':_0x2aa421['id']})}});}function getUser(_0x53c65a,_0x4e66e6,_0x5c82d2){if(!_[_0x32aa('0x2b')](_0x4e66e6)){logger[_0x32aa('0xe')]('Getting\x20agent\x20with\x20name',_0x4e66e6);return request({'form':{'method':'get_entry_list','input_type':_0x32aa('0x23'),'response_type':_0x32aa('0x23'),'rest_data':JSON[_0x32aa('0x24')]({'session':_0x5c82d2['id'],'module_name':_0x32aa('0x2c'),'query':util[_0x32aa('0x2d')](_0x32aa('0x2e'),_0x4e66e6),'order_by':'','offset':'0','select_fields':['id',_0x32aa('0x10'),_0x32aa('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x32aa('0x30')](function(_0x5750e2){if(_0x5750e2[_0x32aa('0x31')][_0x32aa('0x32')]){var _0x552208=_[_0x32aa('0x33')](_0x5750e2['entry_list'],function(_0x4f73d1){return _0x4f73d1[_0x32aa('0x34')][_0x32aa('0x2f')][_0x32aa('0x35')]===_0x4e66e6;});if(_0x552208){logger[_0x32aa('0xe')]('Agent\x20found!');return BPromise[_0x32aa('0x36')]({'id':_0x552208[_0x32aa('0x34')]['id'][_0x32aa('0x35')],'name':_0x552208[_0x32aa('0x34')][_0x32aa('0x10')][_0x32aa('0x35')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x32aa('0x36')]({'id':_0x5c82d2[_0x32aa('0x34')][_0x32aa('0x37')][_0x32aa('0x35')],'name':_0x5c82d2['name_value_list']['user_name'][_0x32aa('0x35')]});});}else{logger['info'](_0x32aa('0x38'));return BPromise[_0x32aa('0x36')]({'id':_0x5c82d2['name_value_list'][_0x32aa('0x37')][_0x32aa('0x35')],'name':_0x5c82d2['name_value_list'][_0x32aa('0x2f')][_0x32aa('0x35')]});}}function getEndUser(_0x25211f,_0xd23473,_0x28960b,_0x1f30ed){logger[_0x32aa('0xe')](_0x32aa('0x39'),_0x28960b);return request({'form':{'method':_0x32aa('0x3a'),'input_type':_0x32aa('0x23'),'response_type':_0x32aa('0x23'),'rest_data':JSON[_0x32aa('0x24')]({'session':_0x1f30ed['id'],'module_name':_0x32aa('0x1d'),'query':util[_0x32aa('0x2d')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x28960b),'order_by':'','offset':'0','select_fields':['id',_0x32aa('0x10'),_0x32aa('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x32aa('0x30')](function(_0x3a9d83){if(_0x3a9d83[_0x32aa('0x31')]['length']){var _0x337cb7=_[_0x32aa('0x33')](_0x3a9d83[_0x32aa('0x31')],function(_0x106279){return _0x106279[_0x32aa('0x34')][_0x32aa('0x3b')][_0x32aa('0x35')]===_0x28960b;});if(_0x337cb7){logger[_0x32aa('0xe')](_0x32aa('0x3c'));return BPromise[_0x32aa('0x36')]({'id':_0x337cb7[_0x32aa('0x34')]['id']['value'],'name':_0x337cb7['name_value_list'][_0x32aa('0x10')][_0x32aa('0x35')],'phone':_0x337cb7[_0x32aa('0x34')][_0x32aa('0x3b')][_0x32aa('0x35')]});}}else{logger[_0x32aa('0xe')](_0x32aa('0x3d'));return request({'form':{'method':'set_entry','input_type':_0x32aa('0x23'),'response_type':_0x32aa('0x23'),'rest_data':JSON[_0x32aa('0x24')]({'session':_0x1f30ed['id'],'module_name':_0x32aa('0x1d'),'name_value_list':[{'name':'first_name','value':_0xd23473!==_0x32aa('0x3e')?_0xd23473:util['format'](_0x32aa('0x3f'),_0x28960b)},{'name':_0x32aa('0x3b'),'value':_0x28960b}]})}})[_0x32aa('0x30')](function(_0x317677){logger[_0x32aa('0xe')]('Enduser\x20created.');return BPromise[_0x32aa('0x36')]({'id':_0x317677['id'],'name':_0x317677[_0x32aa('0x31')][_0x32aa('0x40')][_0x32aa('0x35')],'phone':_0x317677['entry_list'][_0x32aa('0x3b')]['value']});});}});}function request(_0x1640f3){logger[_0x32aa('0x41')]('[HTTP]',JSON[_0x32aa('0x24')](_0x1640f3));return rp(_[_0x32aa('0x42')](def,_0x1640f3));}function getTags(_0x370db4,_0x51de96){var _0x11afd5=[];if(_0x370db4&&_0x370db4[_0x32aa('0x32')]>0x0){_0x11afd5=_[_0x32aa('0x43')](_0x370db4,_0x51de96);}return _0x11afd5;}function getCustomFields(_0x16f59a,_0x5dfc79){var _0x4f541c=[];var _0x3a67aa={'custom_fields':[]};if(_0x16f59a[_0x32aa('0x32')]>0x0){_[_0x32aa('0x44')](_0x16f59a,function(_0x3d99ff){if(_0x3d99ff[_0x32aa('0x45')]==='string'&&_0x3d99ff[_0x32aa('0x46')]&&!_0x3d99ff[_0x32aa('0x47')]){_0x3a67aa[_0x3d99ff[_0x32aa('0x46')]['toLowerCase']()]=_0x3d99ff[_0x32aa('0x48')]['toString']();}else if(_0x3d99ff['type']===_0x32aa('0x49')&&_0x3d99ff[_0x32aa('0x4a')]&&_0x3d99ff[_0x32aa('0x47')]){_0x3a67aa['custom_fields']['push']({'id':_0x3d99ff[_0x32aa('0x4a')],'value':_0x3d99ff[_0x32aa('0x48')][_0x32aa('0x28')]()});}else if(_0x3d99ff[_0x32aa('0x45')]===_0x32aa('0x4b')&&_0x3d99ff[_0x32aa('0x20')]&&_0x3d99ff[_0x32aa('0x4a')]&&_0x3d99ff[_0x32aa('0x47')]){_0x5dfc79[_0x3d99ff[_0x32aa('0x20')]]&&_0x3a67aa[_0x32aa('0x4c')][_0x32aa('0x21')]({'id':_0x3d99ff[_0x32aa('0x4a')],'value':_0x5dfc79[_0x3d99ff[_0x32aa('0x20')]][_0x32aa('0x28')]()});}else if(_0x3d99ff['type']==='customVariable'&&_0x3d99ff[_0x32aa('0x4d')]&&_0x3d99ff[_0x32aa('0x4d')][_0x32aa('0x10')]&&_0x3d99ff[_0x32aa('0x4a')]&&_0x3d99ff[_0x32aa('0x47')]){_0x5dfc79[_0x3d99ff[_0x32aa('0x4d')][_0x32aa('0x10')][_0x32aa('0x4e')]()]&&_0x3a67aa['custom_fields']['push']({'id':_0x3d99ff[_0x32aa('0x4a')],'value':_0x5dfc79[_0x3d99ff['Variable']['name'][_0x32aa('0x4e')]()][_0x32aa('0x28')]()});}});}return _0x3a67aa;}function getConnection(_0x17c097){return request({'method':_0x32aa('0xc'),'form':{'method':_0x32aa('0x4f'),'input_type':_0x32aa('0x23'),'response_type':'JSON','rest_data':JSON[_0x32aa('0x24')]({'user_auth':{'user_name':_0x17c097['username'],'password':_0x17c097[_0x32aa('0x50')],'encryption':_0x32aa('0x51')},'application':_0x32aa('0x52')})}})[_0x32aa('0x30')](function(_0x1f323e){var _0x73078=_0x1f323e;if(_0x73078['id']){def[_0x32aa('0x53')]=_0x73078['id'];return BPromise['resolve'](_0x73078);}else{throw new Error(util[_0x32aa('0x2d')]('Account\x20%d\x20is\x20not\x20valid',_0x17c097['id']));}});}function setRelationship(_0x4c2c88,_0xbb6f36,_0x4b11ed,_0x48573d){return request({'form':{'method':_0x32aa('0x54'),'input_type':_0x32aa('0x23'),'response_type':_0x32aa('0x23'),'rest_data':JSON[_0x32aa('0x24')]({'session':_0x4c2c88['id'],'module_name':'Calls','module_id':_0x4b11ed['id'],'link_field_name':_0x48573d,'related_ids':[_0xbb6f36['id']]})}});}exports['queue']=function(_0x498c2a,_0x31bb40,_0x163082,_0x574149,_0x3cffd9,_0x292ef8){var _0xa82b87,_0x3308f0,_0x11e866,_0x2e4b9d;_0x292ef8[_0x32aa('0x55')]=intUtil[_0x32aa('0x56')](_0x292ef8[_0x32aa('0x55')]);_0x292ef8['serverUrl']=intUtil[_0x32aa('0x56')](_0x292ef8['serverUrl']);def[_0x32aa('0x57')]=util['format'](_0x32aa('0x58'),_0x292ef8['remoteUri']);if(_0x3cffd9&&_0x3cffd9[_0x32aa('0x59')]){logger[_0x32aa('0xe')](_0x32aa('0x5a'),_0x32aa('0x5b'));_0x31bb40[_0x32aa('0x5c')]=util[_0x32aa('0x2d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x292ef8[_0x32aa('0x5d')],_0x31bb40[_0x32aa('0x5e')],md5(_0x31bb40[_0x32aa('0x5e')]));}else{_0x31bb40[_0x32aa('0x5c')]='';}return getConnection(_0x292ef8)['then'](function(_0x58ab48){_0x2e4b9d=_0x58ab48;return getUser(_0x292ef8,_0x574149[_0x32aa('0x10')],_0x2e4b9d);})['then'](function(_0x2dcece){_0xa82b87=_0x2dcece;logger[_0x32aa('0xe')](_0x32aa('0x5f'),_0xa82b87['id']);return getEndUser(_0x292ef8,_0x31bb40[_0x32aa('0x60')],_0x31bb40[_0x32aa('0x61')],_0x2e4b9d);})[_0x32aa('0x30')](function(_0x2947d2){_0x3308f0=_0x2947d2;logger[_0x32aa('0xe')](_0x32aa('0x62'),_0x3308f0['id']);return getTicket(_0x292ef8,_0xa82b87,_0x3308f0,_0x163082,_0x31bb40,_0x163082['Fields'],_0x2e4b9d,_0x32aa('0x63'));})[_0x32aa('0x30')](function(_0x1da4cc){_0x11e866=_0x1da4cc;logger[_0x32aa('0xe')](_0x32aa('0x64'));logger['info'](_0x32aa('0x65'),_0x11e866['id']);return setRelationship(_0x2e4b9d,_0xa82b87,_0x11e866,'users');})[_0x32aa('0x30')](function(){return setRelationship(_0x2e4b9d,_0x3308f0,_0x11e866,'contacts');})['then'](function(){return getServerInfo(_0x2e4b9d);})[_0x32aa('0x30')](function(_0x458fbe){var _0x2228b3=parseInt(_0x458fbe[_0x32aa('0x66')][_0x32aa('0x67')](0x0));var _0x2b3d4b=util[_0x32aa('0x2d')](_0x32aa('0x68'),_0x292ef8[_0x32aa('0x55')],_0x11e866['id']);if(_0x2228b3>0x6){_0x2b3d4b=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x292ef8[_0x32aa('0x55')],_0x11e866['id']);}logger[_0x32aa('0xe')](_0x32aa('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x32aa('0x69'),_0x574149[_0x32aa('0x10')]),_0x32aa('0x6a'),{'uri':_0x2b3d4b});})[_0x32aa('0x6b')](function(_0x45741a){logger[_0x32aa('0x6c')]('[QUEUE]',JSON[_0x32aa('0x24')](_0x45741a));});};exports[_0x32aa('0x6d')]=function(_0x15bea7,_0x233f9b,_0x17fb63,_0x2cd724,_0x255513,_0x27ecf4,_0x262b35){var _0x1400ac,_0x160dd9,_0x45c64d,_0x3161b1;_0x27ecf4[_0x32aa('0x55')]=intUtil[_0x32aa('0x56')](_0x27ecf4[_0x32aa('0x55')]);_0x27ecf4[_0x32aa('0x5d')]=intUtil[_0x32aa('0x56')](_0x27ecf4[_0x32aa('0x5d')]);def[_0x32aa('0x57')]=util[_0x32aa('0x2d')](_0x32aa('0x58'),_0x27ecf4[_0x32aa('0x55')]);if(_0x262b35&&_0x262b35[_0x32aa('0x6e')]&&_0x262b35[_0x32aa('0x6e')]!==_0x32aa('0x6f')){logger[_0x32aa('0xe')]('[OUTBOUND]',_0x32aa('0x5b'));_0x233f9b[_0x32aa('0x5c')]=util['format'](_0x32aa('0x70'),_0x27ecf4[_0x32aa('0x5d')],_0x233f9b[_0x32aa('0x5e')],md5(_0x233f9b['uniqueid']));}return getConnection(_0x27ecf4)['then'](function(_0x3856d1){_0x3161b1=_0x3856d1;return getUser(_0x27ecf4,_0x2cd724[_0x32aa('0x10')],_0x3161b1);})[_0x32aa('0x30')](function(_0x29b6b9){_0x1400ac=_0x29b6b9;logger['info'](_0x32aa('0x5f'),_0x1400ac['id']);return getEndUser(_0x27ecf4,_0x233f9b[_0x32aa('0x71')],_0x233f9b[_0x32aa('0x72')],_0x3161b1);})[_0x32aa('0x30')](function(_0x214e96){_0x160dd9=_0x214e96;logger[_0x32aa('0xe')](_0x32aa('0x62'),_0x160dd9['id']);return getTicket(_0x27ecf4,_0x1400ac,_0x160dd9,_0x17fb63,_0x233f9b,_0x17fb63[_0x32aa('0x73')],_0x3161b1,_0x32aa('0x74'));})[_0x32aa('0x30')](function(_0x56f445){_0x45c64d=_0x56f445;logger[_0x32aa('0xe')]('Ticket\x20created!');logger['info'](_0x32aa('0x65'),_0x45c64d['id']);return setRelationship(_0x3161b1,_0x1400ac,_0x45c64d,_0x32aa('0x75'));})[_0x32aa('0x30')](function(){return setRelationship(_0x3161b1,_0x160dd9,_0x45c64d,'contacts');})[_0x32aa('0x30')](function(){return getServerInfo(_0x3161b1);})[_0x32aa('0x30')](function(_0x223f1c){var _0x6accb0=parseInt(_0x223f1c[_0x32aa('0x66')][_0x32aa('0x67')](0x0));var _0x3e4b50=util[_0x32aa('0x2d')](_0x32aa('0x68'),_0x27ecf4[_0x32aa('0x55')],_0x45c64d['id']);if(_0x6accb0>0x6){_0x3e4b50=util[_0x32aa('0x2d')](_0x32aa('0x76'),_0x27ecf4[_0x32aa('0x55')],_0x45c64d['id']);}logger['info'](_0x32aa('0x77'),_0x32aa('0x78'));emit(util[_0x32aa('0x2d')](_0x32aa('0x69'),_0x2cd724[_0x32aa('0x10')]),_0x32aa('0x6a'),{'uri':_0x3e4b50});})[_0x32aa('0x6b')](function(_0x535985){logger[_0x32aa('0x6c')](_0x32aa('0x77'),JSON[_0x32aa('0x24')](_0x535985));});};exports[_0x32aa('0x79')]=function(_0x5d498b,_0xfbac6e,_0x2806db,_0x2952cf,_0x51b56c,_0x123deb){var _0x4db087,_0x2b1a72,_0x688a2b,_0x55cc49;_0x123deb['remoteUri']=intUtil[_0x32aa('0x56')](_0x123deb['remoteUri']);_0x123deb[_0x32aa('0x5d')]=intUtil['stripTrailingSlash'](_0x123deb[_0x32aa('0x5d')]);def[_0x32aa('0x57')]=util['format'](_0x32aa('0x58'),_0x123deb[_0x32aa('0x55')]);if(_0x51b56c&&_0x51b56c[_0x32aa('0x59')]){logger['info']('['+_0xfbac6e['lastevent'][_0x32aa('0x7a')]()+']',_0x32aa('0x5b'));_0xfbac6e[_0x32aa('0x5c')]=util['format'](_0x32aa('0x70'),_0x123deb[_0x32aa('0x5d')],_0xfbac6e[_0x32aa('0x5e')],md5(_0xfbac6e[_0x32aa('0x5e')]));}else{_0xfbac6e['recordingURL']='';}return getConnection(_0x123deb)[_0x32aa('0x30')](function(_0x509ba5){_0x55cc49=_0x509ba5;if(!_['isNil'](_0x2952cf)){return getUser(_0x123deb,_0x2952cf[_0x32aa('0x10')],_0x55cc49);}else{return getUser(_0x123deb,null,_0x55cc49);}})['then'](function(_0x4ab5f3){_0x4db087=_0x4ab5f3;logger[_0x32aa('0xe')](_0x32aa('0x5f'),_0x4db087['id']);return getEndUser(_0x123deb,_0xfbac6e[_0x32aa('0x60')],_0xfbac6e[_0x32aa('0x61')],_0x55cc49);})['then'](function(_0x25e24b){_0x2b1a72=_0x25e24b;logger['info'](_0x32aa('0x62'),_0x2b1a72['id']);return getTicket(_0x123deb,_0x4db087,_0x2b1a72,_0x2806db,_0xfbac6e,_0x2806db['Fields'],_0x55cc49,_0x32aa('0x63'));})[_0x32aa('0x30')](function(_0x1ccd78){_0x688a2b=_0x1ccd78;logger[_0x32aa('0xe')](_0x32aa('0x64'));logger[_0x32aa('0xe')](_0x32aa('0x65'),_0x688a2b['id']);return setRelationship(_0x55cc49,_0x4db087,_0x688a2b,_0x32aa('0x75'));})['then'](function(){return setRelationship(_0x55cc49,_0x2b1a72,_0x688a2b,_0x32aa('0x7b'));})['then'](function(){return getServerInfo(_0x55cc49);})[_0x32aa('0x6b')](function(_0x2c03f3){logger['error']('['+_0xfbac6e[_0x32aa('0x7c')][_0x32aa('0x7a')]()+']',JSON['stringify'](_0x2c03f3));});}; \ 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 75402b0..7ecb1d4 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 _0x4059=['lodash','getString','sortBy','type','string','push','variable','variableName','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail'];(function(_0x4b4b4b,_0x1d2bcd){var _0x522237=function(_0x9893da){while(--_0x9893da){_0x4b4b4b['push'](_0x4b4b4b['shift']());}};_0x522237(++_0x1d2bcd);}(_0x4059,0xa8));var _0x9405=function(_0x3c0757,_0x54ae6d){_0x3c0757=_0x3c0757-0x0;var _0x2446e8=_0x4059[_0x3c0757];return _0x2446e8;};'use strict';var _=require(_0x9405('0x0'));var util=require('util');exports[_0x9405('0x1')]=function(_0x59fbf8,_0x1f2925,_0x29a074){var _0x469b26=[];if(_0x59fbf8['length']>0x0){var _0x43c8d3=_[_0x9405('0x2')](_0x59fbf8,['id']);for(var _0x4898e1=0x0;_0x4898e1<_0x43c8d3['length'];_0x4898e1++){var _0x25cb83=_0x43c8d3[_0x4898e1];if(_0x25cb83[_0x9405('0x3')]===_0x9405('0x4')){_0x469b26[_0x9405('0x5')](_0x25cb83['content']);}else if(_0x25cb83[_0x9405('0x3')]===_0x9405('0x6')&&_0x25cb83['variableName']){_0x1f2925[_0x25cb83['variableName']]&&_0x469b26['push'](_0x1f2925[_0x25cb83[_0x9405('0x7')]]['toString']());}else if(_0x25cb83[_0x9405('0x3')]===_0x9405('0x8')&&_0x25cb83[_0x9405('0x9')]&&_0x25cb83[_0x9405('0x9')]['name']){_0x1f2925[_0x25cb83[_0x9405('0x9')][_0x9405('0xa')][_0x9405('0xb')]()]&&_0x469b26[_0x9405('0x5')](_0x1f2925[_0x25cb83[_0x9405('0x9')][_0x9405('0xa')][_0x9405('0xb')]()]['toString']());}else if(_0x25cb83[_0x9405('0x3')]===_0x9405('0xc')){if(_0x25cb83[_0x9405('0xd')]===_0x9405('0x4')&&_0x25cb83[_0x9405('0xe')]){_0x469b26[_0x9405('0x5')](util[_0x9405('0xf')](_0x9405('0x10'),_0x25cb83['key'],_0x25cb83[_0x9405('0x11')]));}else if(_0x25cb83['keyType']===_0x9405('0x6')&&_0x25cb83[_0x9405('0x7')]&&_0x25cb83['key']){_0x1f2925[_0x25cb83[_0x9405('0x7')]]&&_0x469b26[_0x9405('0x5')](util[_0x9405('0xf')](_0x9405('0x10'),_0x25cb83[_0x9405('0xe')],_0x1f2925[_0x25cb83['variableName']]));}else if(_0x25cb83['keyType']===_0x9405('0x8')&&_0x25cb83[_0x9405('0x9')]&&_0x25cb83[_0x9405('0x9')][_0x9405('0xa')]&&_0x25cb83['key']){_0x1f2925[_0x25cb83['Variable'][_0x9405('0xa')][_0x9405('0xb')]()]&&_0x469b26['push'](util[_0x9405('0xf')]('%s:\x20%s',_0x25cb83[_0x9405('0xe')],_0x1f2925[_0x25cb83[_0x9405('0x9')][_0x9405('0xa')][_0x9405('0xb')]()]));}}}}return _0x469b26[_0x9405('0x12')](_0x29a074);};exports[_0x9405('0x13')]=function(_0x19be4e){var _0x19e319=_0x19be4e[_0x9405('0x14')](-0x1);if(_0x19e319==='/'){_0x19be4e=_0x19be4e[_0x9405('0x15')](0x0,_0x19be4e[_0x9405('0x16')](_0x19e319));}return _0x19be4e;};exports[_0x9405('0x17')]=function(_0x9e63d3){if(!_['isNil'](_0x9e63d3)&&_0x9e63d3!==''){var _0x3e366d=/^(([^<>()\[\]\\.,;:\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 _0x3e366d['test'](String(_0x9e63d3)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x0469=['length','string','push','content','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','keyContent','variable','join','stripTrailingSlash','substring','lastIndexOf','isNil','test','lodash','util','getString'];(function(_0x562852,_0x2fdd5e){var _0x4be499=function(_0x219ec8){while(--_0x219ec8){_0x562852['push'](_0x562852['shift']());}};_0x4be499(++_0x2fdd5e);}(_0x0469,0xf7));var _0x9046=function(_0x3d769c,_0x262f16){_0x3d769c=_0x3d769c-0x0;var _0xf631=_0x0469[_0x3d769c];return _0xf631;};'use strict';var _=require(_0x9046('0x0'));var util=require(_0x9046('0x1'));exports[_0x9046('0x2')]=function(_0x466215,_0x7f4029,_0x3b42ff){var _0x37721a=[];if(_0x466215[_0x9046('0x3')]>0x0){var _0x4a6381=_['sortBy'](_0x466215,['id']);for(var _0x5798e7=0x0;_0x5798e7<_0x4a6381[_0x9046('0x3')];_0x5798e7++){var _0x18271b=_0x4a6381[_0x5798e7];if(_0x18271b['type']===_0x9046('0x4')){_0x37721a[_0x9046('0x5')](_0x18271b[_0x9046('0x6')]);}else if(_0x18271b['type']==='variable'&&_0x18271b['variableName']){_0x7f4029[_0x18271b[_0x9046('0x7')]]&&_0x37721a[_0x9046('0x5')](_0x7f4029[_0x18271b[_0x9046('0x7')]][_0x9046('0x8')]());}else if(_0x18271b['type']===_0x9046('0x9')&&_0x18271b[_0x9046('0xa')]&&_0x18271b[_0x9046('0xa')][_0x9046('0xb')]){_0x7f4029[_0x18271b['Variable']['name'][_0x9046('0xc')]()]&&_0x37721a[_0x9046('0x5')](_0x7f4029[_0x18271b['Variable'][_0x9046('0xb')][_0x9046('0xc')]()][_0x9046('0x8')]());}else if(_0x18271b['type']==='keyValue'){if(_0x18271b[_0x9046('0xd')]===_0x9046('0x4')&&_0x18271b[_0x9046('0xe')]){_0x37721a['push'](util[_0x9046('0xf')](_0x9046('0x10'),_0x18271b[_0x9046('0xe')],_0x18271b[_0x9046('0x11')]));}else if(_0x18271b['keyType']===_0x9046('0x12')&&_0x18271b[_0x9046('0x7')]&&_0x18271b[_0x9046('0xe')]){_0x7f4029[_0x18271b[_0x9046('0x7')]]&&_0x37721a['push'](util['format']('%s:\x20%s',_0x18271b['key'],_0x7f4029[_0x18271b[_0x9046('0x7')]]));}else if(_0x18271b[_0x9046('0xd')]===_0x9046('0x9')&&_0x18271b[_0x9046('0xa')]&&_0x18271b['Variable'][_0x9046('0xb')]&&_0x18271b['key']){_0x7f4029[_0x18271b[_0x9046('0xa')]['name'][_0x9046('0xc')]()]&&_0x37721a[_0x9046('0x5')](util[_0x9046('0xf')](_0x9046('0x10'),_0x18271b['key'],_0x7f4029[_0x18271b['Variable'][_0x9046('0xb')][_0x9046('0xc')]()]));}}}}return _0x37721a[_0x9046('0x13')](_0x3b42ff);};exports[_0x9046('0x14')]=function(_0x29bb72){var _0xf55925=_0x29bb72['slice'](-0x1);if(_0xf55925==='/'){_0x29bb72=_0x29bb72[_0x9046('0x15')](0x0,_0x29bb72[_0x9046('0x16')](_0xf55925));}return _0x29bb72;};exports['validateEmail']=function(_0x168d84){if(!_[_0x9046('0x17')](_0x168d84)&&_0x168d84!==''){var _0x317765=/^(([^<>()\[\]\\.,;:\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 _0x317765[_0x9046('0x18')](String(_0x168d84)[_0x9046('0xc')]());}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 42fdd6f..ebe8dbc 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 _0x4ee3=['accessKey','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','stripTrailingSlash','serverUrl','recordingFormat','none','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','[OUTBOUND]','unmanaged','toUpperCase','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','vTiger','defaults','redis','socket.io-emitter','length','idField','content','type','variable','variableName','toString','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','Descriptions','format','remoteUri','username','sessionName','HelpDesk','stringify','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','Getting\x20agent\x20with\x20email','%s/webservice.php','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','then','result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','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;','success','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser'];(function(_0x269018,_0x5c01c5){var _0xb0f016=function(_0x5f0f41){while(--_0x5f0f41){_0x269018['push'](_0x269018['shift']());}};_0xb0f016(++_0x5c01c5);}(_0x4ee3,0x147));var _0x34ee=function(_0xbcc5c5,_0x487725){_0xbcc5c5=_0xbcc5c5-0x0;var _0x548e99=_0x4ee3[_0xbcc5c5];return _0x548e99;};'use strict';var _=require('lodash');var rp=require(_0x34ee('0x0'));var BPromise=require(_0x34ee('0x1'));var md5=require(_0x34ee('0x2'));var util=require(_0x34ee('0x3'));var Redis=require(_0x34ee('0x4'));var intUtil=require(_0x34ee('0x5'));var config=require(_0x34ee('0x6'));var logger=require('../../../../config/logger')(_0x34ee('0x7'));config['redis']=_[_0x34ee('0x8')](config[_0x34ee('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x34ee('0xa'))(new Redis(config[_0x34ee('0x9')]));function emit(_0x10861a,_0x1e48eb,_0x378620){io['to'](_0x10861a)['emit'](_0x1e48eb,_0x378620);}function getCustomFields(_0xe4a575,_0x2966ee){var _0x567024={};if(_0xe4a575[_0x34ee('0xb')]>0x0){_['forEach'](_0xe4a575,function(_0x4afc50){if(_0x4afc50['type']==='string'&&_0x4afc50[_0x34ee('0xc')]){_0x567024[_0x4afc50[_0x34ee('0xc')]]=_0x4afc50[_0x34ee('0xd')]['toString']();}else if(_0x4afc50[_0x34ee('0xe')]===_0x34ee('0xf')&&_0x4afc50[_0x34ee('0x10')]&&_0x4afc50[_0x34ee('0xc')]&&_0x2966ee[_0x4afc50[_0x34ee('0x10')]]){_0x567024[_0x4afc50[_0x34ee('0xc')]]=_0x2966ee[_0x4afc50[_0x34ee('0x10')]][_0x34ee('0x11')]();}else if(_0x4afc50[_0x34ee('0xe')]==='customVariable'&&_0x4afc50[_0x34ee('0x12')]&&_0x4afc50[_0x34ee('0x12')][_0x34ee('0x13')]&&_0x4afc50[_0x34ee('0xc')]&&_0x2966ee[_0x4afc50[_0x34ee('0x12')][_0x34ee('0x13')][_0x34ee('0x14')]()]){_0x567024[_0x4afc50[_0x34ee('0xc')]]=_0x2966ee[_0x4afc50['Variable']['name'][_0x34ee('0x14')]()]['toString']();}});}return _0x567024;}function createTicket(_0x198e9d,_0x4a46be,_0x39fa31,_0x427f4c,_0x3c3dee,_0x572f6c,_0x16fe91){logger[_0x34ee('0x15')](_0x34ee('0x16'));var _0x1fb171=_[_0x34ee('0x17')]({'parent_id':'','assigned_user_id':_0x4a46be['id'],'ticketpriorities':_0x34ee('0x18'),'ticketstatus':'Open','ticket_title':intUtil[_0x34ee('0x19')](_0x427f4c[_0x34ee('0x1a')],_0x3c3dee,'\x20'),'description':intUtil['getString'](_0x427f4c[_0x34ee('0x1b')],_0x3c3dee,'\x0a'),'contact_id':_0x39fa31['id']},getCustomFields(_0x572f6c,_0x3c3dee));var _0x282437={'method':'POST','uri':util[_0x34ee('0x1c')]('%s/webservice.php',_0x198e9d[_0x34ee('0x1d')]),'form':{'operation':'create','username':_0x198e9d[_0x34ee('0x1e')],'sessionName':_0x16fe91[_0x34ee('0x1f')],'elementType':_0x34ee('0x20'),'element':JSON[_0x34ee('0x21')](_0x1fb171)},'json':!![]};return request(_0x282437)['then'](function(_0x5b8dd9){if(_0x5b8dd9['success']){return BPromise[_0x34ee('0x22')]({'id':_0x5b8dd9['result']['id']});}else{throw new Error(util['format'](_0x34ee('0x23'),JSON[_0x34ee('0x21')](_0x5b8dd9[_0x34ee('0x24')])));}})[_0x34ee('0x25')](function(_0x4321ad){var _0x178fb2=_0x4321ad[_0x34ee('0x26')]||0x1f4;logger[_0x34ee('0x24')](_0x34ee('0x27'),_0x34ee('0x28'),_0x178fb2,JSON[_0x34ee('0x21')](_0x4321ad));});}function getUser(_0x1de031,_0x554558,_0x427da0){if(intUtil['validateEmail'](_0x554558)){logger[_0x34ee('0x15')](_0x34ee('0x29'),_0x554558);return request({'method':'GET','uri':util[_0x34ee('0x1c')](_0x34ee('0x2a'),_0x1de031[_0x34ee('0x1d')]),'qs':{'operation':_0x34ee('0x2b'),'username':_0x1de031[_0x34ee('0x1e')],'sessionName':_0x427da0[_0x34ee('0x1f')],'query':util[_0x34ee('0x1c')](_0x34ee('0x2c'),_0x554558)},'json':!![]})[_0x34ee('0x2d')](function(_0x31a505){if(_0x31a505['success']&&_0x31a505[_0x34ee('0x2e')][_0x34ee('0xb')]){logger['info'](_0x34ee('0x2f'));return BPromise[_0x34ee('0x22')]({'id':_0x31a505[_0x34ee('0x2e')][0x0]['id'],'email':_0x31a505[_0x34ee('0x2e')][0x0][_0x34ee('0x30')],'name':_0x31a505[_0x34ee('0x2e')][0x0][_0x34ee('0x31')]+'\x20'+_0x31a505[_0x34ee('0x2e')][_0x34ee('0x32')]});}else{logger[_0x34ee('0x15')](_0x34ee('0x33'));return BPromise[_0x34ee('0x22')]({'id':_0x427da0[_0x34ee('0x34')],'email':_0x1de031['username'],'name':_0x34ee('0x35')});}})['catch'](function(_0x407329){var _0x5d5f45=_0x407329[_0x34ee('0x26')]||0x1f4;logger[_0x34ee('0x24')](_0x34ee('0x27'),'getUser',_0x5d5f45,JSON[_0x34ee('0x21')](_0x407329));});}else{logger['info'](_0x34ee('0x33'));return BPromise[_0x34ee('0x22')]({'id':_0x427da0['userId'],'email':_0x1de031[_0x34ee('0x1e')],'name':_0x34ee('0x35')})[_0x34ee('0x25')](function(_0x1dbaed){var _0x1417a7=_0x1dbaed[_0x34ee('0x26')]||0x1f4;logger[_0x34ee('0x24')](_0x34ee('0x27'),_0x34ee('0x36'),_0x1417a7,JSON[_0x34ee('0x21')](_0x1dbaed));});}}function getEndUser(_0x23faf8,_0x4f4942,_0x15439e,_0x5e2736){logger['info']('Searching\x20end\x20user\x20with\x20phone',_0x15439e);return request({'method':_0x34ee('0x37'),'uri':util['format'](_0x34ee('0x2a'),_0x23faf8[_0x34ee('0x1d')]),'qs':{'operation':_0x34ee('0x2b'),'username':_0x23faf8[_0x34ee('0x1e')],'sessionName':_0x5e2736[_0x34ee('0x1f')],'query':util[_0x34ee('0x1c')](_0x34ee('0x38'),_0x15439e,_0x15439e,_0x15439e,_0x15439e,_0x15439e)},'json':!![]})[_0x34ee('0x2d')](function(_0xb9ced){if(_0xb9ced[_0x34ee('0x39')]&&_0xb9ced[_0x34ee('0x2e')]['length']){logger[_0x34ee('0x15')]('Enduser\x20found!');return BPromise['resolve']({'id':_0xb9ced[_0x34ee('0x2e')][0x0]['id'],'name':_0xb9ced[_0x34ee('0x2e')][0x0][_0x34ee('0x3a')]+'\x20'+_0xb9ced['result'][0x0][_0x34ee('0x3b')],'phone':_0x15439e});}else{logger['info'](_0x34ee('0x3c'));return request({'method':'POST','uri':util[_0x34ee('0x1c')]('%s/webservice.php',_0x23faf8[_0x34ee('0x1d')]),'form':{'operation':'create','sessionName':_0x5e2736[_0x34ee('0x1f')],'elementType':_0x34ee('0x3d'),'element':JSON[_0x34ee('0x21')]({'lastname':_0x4f4942,'phone':_0x15439e,'assigned_user_id':'\x20'})},'json':!![]})[_0x34ee('0x2d')](function(_0x2c7244){logger[_0x34ee('0x15')](_0x34ee('0x3e'));return BPromise[_0x34ee('0x22')]({'id':_0x2c7244[_0x34ee('0x2e')]['id'],'name':_0x2c7244[_0x34ee('0x2e')][_0x34ee('0x3b')],'phone':_0x2c7244[_0x34ee('0x2e')][_0x34ee('0x3f')]});})[_0x34ee('0x25')](function(_0x4b3de2){var _0x72dce0=_0x4b3de2[_0x34ee('0x26')]||0x1f4;logger[_0x34ee('0x24')](_0x34ee('0x27'),_0x34ee('0x40'),_0x72dce0,JSON['stringify'](_0x4b3de2));});}});}function getConnection(_0xd79c37){var _0x5974a3=_0xd79c37['username'];var _0x17fc3f=_0xd79c37[_0x34ee('0x41')];return request({'method':'GET','uri':util[_0x34ee('0x1c')](_0x34ee('0x2a'),_0xd79c37[_0x34ee('0x1d')]),'qs':{'operation':'getchallenge','username':_0x5974a3},'json':!![]})[_0x34ee('0x2d')](function(_0x4a1026){if(_0x4a1026[_0x34ee('0x39')]){return request({'method':'POST','uri':util[_0x34ee('0x1c')](_0x34ee('0x2a'),_0xd79c37[_0x34ee('0x1d')]),'form':{'operation':_0x34ee('0x42'),'username':_0x5974a3,'accessKey':md5(_0x4a1026[_0x34ee('0x2e')][_0x34ee('0x43')]+_0x17fc3f)},'json':!![]});}})[_0x34ee('0x2d')](function(_0x317d67){if(_0x317d67[_0x34ee('0x39')]){return BPromise[_0x34ee('0x22')](_0x317d67['result']);}else{throw new Error(util[_0x34ee('0x1c')](_0x34ee('0x44'),_0xd79c37['id']));}})['catch'](function(_0x365c75){var _0xc5938a=_0x365c75[_0x34ee('0x26')]||0x1f4;logger[_0x34ee('0x24')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x34ee('0x45'),_0xc5938a,JSON[_0x34ee('0x21')](_0x365c75));});}function request(_0x3fafa2){logger[_0x34ee('0x15')]('[HTTP]',JSON[_0x34ee('0x21')](_0x3fafa2));return rp(_0x3fafa2);}exports[_0x34ee('0x46')]=function(_0x18f86c,_0x493050,_0x84e0af,_0x4dc5ca,_0x387235,_0x964e3a){var _0x7aebbe,_0x5d2436,_0xc182b5,_0x3af4e1;_0x964e3a[_0x34ee('0x1d')]=intUtil['stripTrailingSlash'](_0x964e3a['remoteUri']);if(_0x387235&&_0x387235[_0x34ee('0x47')]){logger[_0x34ee('0x15')](_0x34ee('0x48'),'Recording\x20is\x20enabled!');_0x493050['recordingURL']=util[_0x34ee('0x1c')](_0x34ee('0x49'),_0x964e3a['serverUrl'],_0x493050['uniqueid'],md5(_0x493050[_0x34ee('0x4a')]));}else{_0x493050[_0x34ee('0x4b')]='';}return getConnection(_0x964e3a)[_0x34ee('0x2d')](function(_0x3e7ef4){_0x3af4e1=_0x3e7ef4;return getUser(_0x964e3a,_0x4dc5ca['email'],_0x3af4e1);})['then'](function(_0x25d494){_0x7aebbe=_0x25d494;logger[_0x34ee('0x15')]('The\x20User\x20ID\x20is:',_0x7aebbe['id']);return getEndUser(_0x964e3a,_0x493050[_0x34ee('0x4c')],_0x493050[_0x34ee('0x4d')],_0x3af4e1);})[_0x34ee('0x2d')](function(_0x14c52c){_0x5d2436=_0x14c52c;logger[_0x34ee('0x15')](_0x34ee('0x4e'),_0x5d2436['id']);return createTicket(_0x964e3a,_0x7aebbe,_0x5d2436,_0x84e0af,_0x493050,_0x84e0af[_0x34ee('0x4f')],_0x3af4e1);})['then'](function(_0x218b1d){_0xc182b5=_0x218b1d;logger[_0x34ee('0x15')](_0x34ee('0x50'));logger[_0x34ee('0x15')](_0x34ee('0x51'),_0xc182b5['id']);var _0x1a86cf=util[_0x34ee('0x1c')](_0x34ee('0x52'),_0x964e3a[_0x34ee('0x1d')],_[_0x34ee('0x53')](_0xc182b5['id'],'x')[0x1]);logger['info'](_0x34ee('0x48'),_0x34ee('0x54'));emit(util[_0x34ee('0x1c')]('user:%s',_0x4dc5ca[_0x34ee('0x13')]),_0x34ee('0x55'),{'uri':_0x1a86cf});})[_0x34ee('0x25')](function(_0x591475){logger[_0x34ee('0x24')]('[QUEUE]',JSON[_0x34ee('0x21')](_0x591475));});};exports[_0x34ee('0x56')]=function(_0x15a754,_0x879de0,_0x1c5c1c,_0x35eba7,_0x3e9c55,_0x186ae3,_0x49e0cb){var _0x482fd7,_0x46bf5a,_0x228437,_0x4e2875;_0x186ae3[_0x34ee('0x1d')]=intUtil[_0x34ee('0x57')](_0x186ae3[_0x34ee('0x1d')]);_0x186ae3[_0x34ee('0x58')]=intUtil[_0x34ee('0x57')](_0x186ae3[_0x34ee('0x58')]);if(_0x49e0cb&&_0x49e0cb[_0x34ee('0x59')]&&_0x49e0cb['recordingFormat']!==_0x34ee('0x5a')){logger[_0x34ee('0x15')]('[OUTBOUND]',_0x34ee('0x5b'));_0x879de0[_0x34ee('0x4b')]=util[_0x34ee('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x186ae3[_0x34ee('0x58')],_0x879de0[_0x34ee('0x4a')],md5(_0x879de0[_0x34ee('0x4a')]));}return getConnection(_0x186ae3)[_0x34ee('0x2d')](function(_0x356aa6){_0x4e2875=_0x356aa6;return getUser(_0x186ae3,_0x35eba7['email'],_0x4e2875);})[_0x34ee('0x2d')](function(_0x43fabd){_0x482fd7=_0x43fabd;logger[_0x34ee('0x15')](_0x34ee('0x5c'),_0x482fd7['id']);return getEndUser(_0x186ae3,_0x879de0[_0x34ee('0x5d')],_0x879de0[_0x34ee('0x5e')],_0x4e2875);})[_0x34ee('0x2d')](function(_0x20fdb6){_0x46bf5a=_0x20fdb6;logger['info'](_0x34ee('0x4e'),_0x46bf5a['id']);return createTicket(_0x186ae3,_0x482fd7,_0x46bf5a,_0x1c5c1c,_0x879de0,_0x1c5c1c[_0x34ee('0x4f')],_0x4e2875);})['then'](function(_0x51600f){_0x228437=_0x51600f;logger[_0x34ee('0x15')](_0x34ee('0x50'));logger[_0x34ee('0x15')](_0x34ee('0x51'),_0x228437['id']);var _0x2bf6d2=util['format'](_0x34ee('0x52'),_0x186ae3['remoteUri'],_[_0x34ee('0x53')](_0x228437['id'],'x')[0x1]);logger[_0x34ee('0x15')](_0x34ee('0x5f'),_0x34ee('0x54'));emit(util[_0x34ee('0x1c')]('user:%s',_0x35eba7[_0x34ee('0x13')]),_0x34ee('0x55'),{'uri':_0x2bf6d2});})[_0x34ee('0x25')](function(_0xce39cc){logger[_0x34ee('0x24')](_0x34ee('0x5f'),JSON['stringify'](_0xce39cc));});};exports[_0x34ee('0x60')]=function(_0x2238e5,_0x17f9bf,_0x7b8cd8,_0x502168,_0x4f012c,_0x5075ce){var _0x3c0bae,_0x2c3ee1,_0x3a9094,_0x30f5ec;_0x5075ce[_0x34ee('0x1d')]=intUtil[_0x34ee('0x57')](_0x5075ce['remoteUri']);_0x5075ce[_0x34ee('0x58')]=intUtil[_0x34ee('0x57')](_0x5075ce['serverUrl']);if(_0x4f012c&&_0x4f012c[_0x34ee('0x47')]){logger[_0x34ee('0x15')]('['+_0x17f9bf['lastevent'][_0x34ee('0x61')]()+']',_0x34ee('0x5b'));_0x17f9bf[_0x34ee('0x4b')]=util[_0x34ee('0x1c')](_0x34ee('0x49'),_0x5075ce[_0x34ee('0x58')],_0x17f9bf['uniqueid'],md5(_0x17f9bf[_0x34ee('0x4a')]));}else{_0x17f9bf[_0x34ee('0x4b')]='';}return getConnection(_0x5075ce)[_0x34ee('0x2d')](function(_0x447904){_0x30f5ec=_0x447904;return getUser(_0x5075ce,'',_0x30f5ec);})[_0x34ee('0x2d')](function(_0x564ae7){_0x3c0bae=_0x564ae7;logger[_0x34ee('0x15')](_0x34ee('0x5c'),_0x3c0bae['id']);return getEndUser(_0x5075ce,_0x17f9bf[_0x34ee('0x4c')],_0x17f9bf[_0x34ee('0x4d')],_0x30f5ec);})[_0x34ee('0x2d')](function(_0x2818f5){_0x2c3ee1=_0x2818f5;logger[_0x34ee('0x15')]('The\x20Enduser\x20ID\x20is:',_0x2c3ee1['id']);return createTicket(_0x5075ce,_0x3c0bae,_0x2c3ee1,_0x7b8cd8,_0x17f9bf,_0x7b8cd8[_0x34ee('0x4f')],_0x30f5ec);})[_0x34ee('0x2d')](function(_0x42c218){_0x3a9094=_0x42c218;logger['info'](_0x34ee('0x50'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x3a9094['id']);})[_0x34ee('0x25')](function(_0x11d0f6){logger[_0x34ee('0x24')]('['+_0x17f9bf['lastevent'][_0x34ee('0x61')]()+']',JSON['stringify'](_0x11d0f6));});}; \ No newline at end of file +var _0x9850=['type','string','idField','content','variable','variableName','customVariable','Variable','name','toLowerCase','toString','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','Descriptions','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','getUser','userId','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridnum','The\x20Enduser\x20ID\x20is:','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','vTiger','defaults','socket.io-emitter','emit','length'];(function(_0x3cf5c7,_0x1eb319){var _0xf3d981=function(_0x3521ef){while(--_0x3521ef){_0x3cf5c7['push'](_0x3cf5c7['shift']());}};_0xf3d981(++_0x1eb319);}(_0x9850,0xb7));var _0x0985=function(_0x52e9b7,_0x400b8d){_0x52e9b7=_0x52e9b7-0x0;var _0xb92535=_0x9850[_0x52e9b7];return _0xb92535;};'use strict';var _=require(_0x0985('0x0'));var rp=require(_0x0985('0x1'));var BPromise=require(_0x0985('0x2'));var md5=require(_0x0985('0x3'));var util=require(_0x0985('0x4'));var Redis=require(_0x0985('0x5'));var intUtil=require(_0x0985('0x6'));var config=require(_0x0985('0x7'));var logger=require('../../../../config/logger')(_0x0985('0x8'));config['redis']=_[_0x0985('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0985('0xa'))(new Redis(config['redis']));function emit(_0x5f59ea,_0x148896,_0x479cd0){io['to'](_0x5f59ea)[_0x0985('0xb')](_0x148896,_0x479cd0);}function getCustomFields(_0x21f05f,_0x115ddd){var _0x227ee3={};if(_0x21f05f[_0x0985('0xc')]>0x0){_['forEach'](_0x21f05f,function(_0x3367ec){if(_0x3367ec[_0x0985('0xd')]===_0x0985('0xe')&&_0x3367ec['idField']){_0x227ee3[_0x3367ec[_0x0985('0xf')]]=_0x3367ec[_0x0985('0x10')]['toString']();}else if(_0x3367ec[_0x0985('0xd')]===_0x0985('0x11')&&_0x3367ec[_0x0985('0x12')]&&_0x3367ec[_0x0985('0xf')]&&_0x115ddd[_0x3367ec[_0x0985('0x12')]]){_0x227ee3[_0x3367ec[_0x0985('0xf')]]=_0x115ddd[_0x3367ec[_0x0985('0x12')]]['toString']();}else if(_0x3367ec[_0x0985('0xd')]===_0x0985('0x13')&&_0x3367ec[_0x0985('0x14')]&&_0x3367ec[_0x0985('0x14')][_0x0985('0x15')]&&_0x3367ec[_0x0985('0xf')]&&_0x115ddd[_0x3367ec['Variable'][_0x0985('0x15')][_0x0985('0x16')]()]){_0x227ee3[_0x3367ec['idField']]=_0x115ddd[_0x3367ec[_0x0985('0x14')][_0x0985('0x15')][_0x0985('0x16')]()][_0x0985('0x17')]();}});}return _0x227ee3;}function createTicket(_0x3393f7,_0x13adea,_0x2ffaf7,_0x5430dd,_0x2313b4,_0x567492,_0x2273ee){logger[_0x0985('0x18')](_0x0985('0x19'));var _0x2b4cc0=_[_0x0985('0x1a')]({'parent_id':'','assigned_user_id':_0x13adea['id'],'ticketpriorities':_0x0985('0x1b'),'ticketstatus':_0x0985('0x1c'),'ticket_title':intUtil[_0x0985('0x1d')](_0x5430dd[_0x0985('0x1e')],_0x2313b4,'\x20'),'description':intUtil[_0x0985('0x1d')](_0x5430dd[_0x0985('0x1f')],_0x2313b4,'\x0a'),'contact_id':_0x2ffaf7['id']},getCustomFields(_0x567492,_0x2313b4));var _0x2b73aa={'method':_0x0985('0x20'),'uri':util[_0x0985('0x21')](_0x0985('0x22'),_0x3393f7[_0x0985('0x23')]),'form':{'operation':_0x0985('0x24'),'username':_0x3393f7[_0x0985('0x25')],'sessionName':_0x2273ee[_0x0985('0x26')],'elementType':'HelpDesk','element':JSON[_0x0985('0x27')](_0x2b4cc0)},'json':!![]};return request(_0x2b73aa)[_0x0985('0x28')](function(_0x27674b){if(_0x27674b[_0x0985('0x29')]){return BPromise[_0x0985('0x2a')]({'id':_0x27674b[_0x0985('0x2b')]['id']});}else{throw new Error(util[_0x0985('0x21')](_0x0985('0x2c'),JSON[_0x0985('0x27')](_0x27674b[_0x0985('0x2d')])));}})[_0x0985('0x2e')](function(_0x3639f5){var _0x169716=_0x3639f5[_0x0985('0x2f')]||0x1f4;logger[_0x0985('0x2d')](_0x0985('0x30'),_0x0985('0x31'),_0x169716,JSON['stringify'](_0x3639f5));});}function getUser(_0x38b363,_0x1e40cf,_0x1019d1){if(intUtil[_0x0985('0x32')](_0x1e40cf)){logger[_0x0985('0x18')]('Getting\x20agent\x20with\x20email',_0x1e40cf);return request({'method':_0x0985('0x33'),'uri':util[_0x0985('0x21')](_0x0985('0x22'),_0x38b363['remoteUri']),'qs':{'operation':_0x0985('0x34'),'username':_0x38b363[_0x0985('0x25')],'sessionName':_0x1019d1[_0x0985('0x26')],'query':util[_0x0985('0x21')](_0x0985('0x35'),_0x1e40cf)},'json':!![]})[_0x0985('0x28')](function(_0x398cdc){if(_0x398cdc['success']&&_0x398cdc[_0x0985('0x2b')][_0x0985('0xc')]){logger['info'](_0x0985('0x36'));return BPromise[_0x0985('0x2a')]({'id':_0x398cdc[_0x0985('0x2b')][0x0]['id'],'email':_0x398cdc[_0x0985('0x2b')][0x0]['email1'],'name':_0x398cdc[_0x0985('0x2b')][0x0][_0x0985('0x37')]+'\x20'+_0x398cdc[_0x0985('0x2b')][_0x0985('0x38')]});}else{logger['info'](_0x0985('0x39'));return BPromise['resolve']({'id':_0x1019d1['userId'],'email':_0x38b363[_0x0985('0x25')],'name':'admin'});}})[_0x0985('0x2e')](function(_0x5b5f86){var _0x53a28c=_0x5b5f86[_0x0985('0x2f')]||0x1f4;logger['error'](_0x0985('0x30'),_0x0985('0x3a'),_0x53a28c,JSON[_0x0985('0x27')](_0x5b5f86));});}else{logger[_0x0985('0x18')](_0x0985('0x39'));return BPromise[_0x0985('0x2a')]({'id':_0x1019d1[_0x0985('0x3b')],'email':_0x38b363[_0x0985('0x25')],'name':'admin'})[_0x0985('0x2e')](function(_0x109c8d){var _0xd93789=_0x109c8d[_0x0985('0x2f')]||0x1f4;logger[_0x0985('0x2d')](_0x0985('0x30'),'getUser',_0xd93789,JSON[_0x0985('0x27')](_0x109c8d));});}}function getEndUser(_0x5e415c,_0x3b07bc,_0x211ae5,_0x10982d){logger[_0x0985('0x18')](_0x0985('0x3c'),_0x211ae5);return request({'method':_0x0985('0x33'),'uri':util[_0x0985('0x21')](_0x0985('0x22'),_0x5e415c['remoteUri']),'qs':{'operation':_0x0985('0x34'),'username':_0x5e415c[_0x0985('0x25')],'sessionName':_0x10982d[_0x0985('0x26')],'query':util['format'](_0x0985('0x3d'),_0x211ae5,_0x211ae5,_0x211ae5,_0x211ae5,_0x211ae5)},'json':!![]})[_0x0985('0x28')](function(_0x2ac527){if(_0x2ac527[_0x0985('0x29')]&&_0x2ac527[_0x0985('0x2b')][_0x0985('0xc')]){logger['info'](_0x0985('0x3e'));return BPromise[_0x0985('0x2a')]({'id':_0x2ac527[_0x0985('0x2b')][0x0]['id'],'name':_0x2ac527[_0x0985('0x2b')][0x0][_0x0985('0x3f')]+'\x20'+_0x2ac527[_0x0985('0x2b')][0x0]['lastname'],'phone':_0x211ae5});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x0985('0x20'),'uri':util[_0x0985('0x21')](_0x0985('0x22'),_0x5e415c[_0x0985('0x23')]),'form':{'operation':'create','sessionName':_0x10982d['sessionName'],'elementType':'Contacts','element':JSON[_0x0985('0x27')]({'lastname':_0x3b07bc,'phone':_0x211ae5,'assigned_user_id':'\x20'})},'json':!![]})[_0x0985('0x28')](function(_0x2be076){logger[_0x0985('0x18')](_0x0985('0x40'));return BPromise[_0x0985('0x2a')]({'id':_0x2be076[_0x0985('0x2b')]['id'],'name':_0x2be076['result'][_0x0985('0x41')],'phone':_0x2be076[_0x0985('0x2b')][_0x0985('0x42')]});})[_0x0985('0x2e')](function(_0x397aac){var _0x161238=_0x397aac[_0x0985('0x2f')]||0x1f4;logger[_0x0985('0x2d')](_0x0985('0x30'),'getEndUser',_0x161238,JSON['stringify'](_0x397aac));});}});}function getConnection(_0x3e9894){var _0x5e4f35=_0x3e9894[_0x0985('0x25')];var _0x1961a6=_0x3e9894[_0x0985('0x43')];return request({'method':_0x0985('0x33'),'uri':util[_0x0985('0x21')]('%s/webservice.php',_0x3e9894[_0x0985('0x23')]),'qs':{'operation':_0x0985('0x44'),'username':_0x5e4f35},'json':!![]})[_0x0985('0x28')](function(_0x390b01){if(_0x390b01[_0x0985('0x29')]){return request({'method':_0x0985('0x20'),'uri':util[_0x0985('0x21')](_0x0985('0x22'),_0x3e9894[_0x0985('0x23')]),'form':{'operation':_0x0985('0x45'),'username':_0x5e4f35,'accessKey':md5(_0x390b01['result']['token']+_0x1961a6)},'json':!![]});}})['then'](function(_0x1847dc){if(_0x1847dc['success']){return BPromise[_0x0985('0x2a')](_0x1847dc[_0x0985('0x2b')]);}else{throw new Error(util[_0x0985('0x21')](_0x0985('0x46'),_0x3e9894['id']));}})[_0x0985('0x2e')](function(_0x219b04){var _0x170a9f=_0x219b04['statusCode']||0x1f4;logger[_0x0985('0x2d')](_0x0985('0x30'),_0x0985('0x47'),_0x170a9f,JSON['stringify'](_0x219b04));});}function request(_0x14ca75){logger['info'](_0x0985('0x48'),JSON[_0x0985('0x27')](_0x14ca75));return rp(_0x14ca75);}exports['queue']=function(_0x417237,_0x31c4c6,_0x53dfb7,_0x215daa,_0x271bc2,_0x2a0ce9){var _0x3b1cd5,_0x3fd2c2,_0x4bd73d,_0x273f21;_0x2a0ce9['remoteUri']=intUtil['stripTrailingSlash'](_0x2a0ce9['remoteUri']);if(_0x271bc2&&_0x271bc2['monitor_format']){logger[_0x0985('0x18')]('[QUEUE]',_0x0985('0x49'));_0x31c4c6[_0x0985('0x4a')]=util[_0x0985('0x21')](_0x0985('0x4b'),_0x2a0ce9[_0x0985('0x4c')],_0x31c4c6[_0x0985('0x4d')],md5(_0x31c4c6[_0x0985('0x4d')]));}else{_0x31c4c6[_0x0985('0x4a')]='';}return getConnection(_0x2a0ce9)[_0x0985('0x28')](function(_0xcb5c92){_0x273f21=_0xcb5c92;return getUser(_0x2a0ce9,_0x215daa[_0x0985('0x4e')],_0x273f21);})[_0x0985('0x28')](function(_0x3e1fb5){_0x3b1cd5=_0x3e1fb5;logger[_0x0985('0x18')](_0x0985('0x4f'),_0x3b1cd5['id']);return getEndUser(_0x2a0ce9,_0x31c4c6['calleridname'],_0x31c4c6[_0x0985('0x50')],_0x273f21);})[_0x0985('0x28')](function(_0xcebcf2){_0x3fd2c2=_0xcebcf2;logger[_0x0985('0x18')]('The\x20Enduser\x20ID\x20is:',_0x3fd2c2['id']);return createTicket(_0x2a0ce9,_0x3b1cd5,_0x3fd2c2,_0x53dfb7,_0x31c4c6,_0x53dfb7[_0x0985('0x51')],_0x273f21);})[_0x0985('0x28')](function(_0x3e961d){_0x4bd73d=_0x3e961d;logger['info'](_0x0985('0x52'));logger[_0x0985('0x18')](_0x0985('0x53'),_0x4bd73d['id']);var _0x337989=util[_0x0985('0x21')](_0x0985('0x54'),_0x2a0ce9[_0x0985('0x23')],_['split'](_0x4bd73d['id'],'x')[0x1]);logger[_0x0985('0x18')]('[QUEUE]',_0x0985('0x55'));emit(util['format']('user:%s',_0x215daa[_0x0985('0x15')]),_0x0985('0x56'),{'uri':_0x337989});})['catch'](function(_0x5ac458){logger[_0x0985('0x2d')]('[QUEUE]',JSON['stringify'](_0x5ac458));});};exports[_0x0985('0x57')]=function(_0x90be95,_0x4509e5,_0x1d8c77,_0x1dcd3d,_0x203476,_0x48a9d4,_0x35cf94){var _0x1fac1b,_0x582f9e,_0x12cf4d,_0x4a87d0;_0x48a9d4[_0x0985('0x23')]=intUtil[_0x0985('0x58')](_0x48a9d4['remoteUri']);_0x48a9d4[_0x0985('0x4c')]=intUtil['stripTrailingSlash'](_0x48a9d4[_0x0985('0x4c')]);if(_0x35cf94&&_0x35cf94['recordingFormat']&&_0x35cf94[_0x0985('0x59')]!==_0x0985('0x5a')){logger['info'](_0x0985('0x5b'),_0x0985('0x49'));_0x4509e5[_0x0985('0x4a')]=util[_0x0985('0x21')](_0x0985('0x4b'),_0x48a9d4[_0x0985('0x4c')],_0x4509e5[_0x0985('0x4d')],md5(_0x4509e5[_0x0985('0x4d')]));}return getConnection(_0x48a9d4)[_0x0985('0x28')](function(_0x4f539c){_0x4a87d0=_0x4f539c;return getUser(_0x48a9d4,_0x1dcd3d['email'],_0x4a87d0);})[_0x0985('0x28')](function(_0x548b42){_0x1fac1b=_0x548b42;logger[_0x0985('0x18')](_0x0985('0x4f'),_0x1fac1b['id']);return getEndUser(_0x48a9d4,_0x4509e5['destcalleridname'],_0x4509e5[_0x0985('0x5c')],_0x4a87d0);})[_0x0985('0x28')](function(_0x4deefb){_0x582f9e=_0x4deefb;logger[_0x0985('0x18')](_0x0985('0x5d'),_0x582f9e['id']);return createTicket(_0x48a9d4,_0x1fac1b,_0x582f9e,_0x1d8c77,_0x4509e5,_0x1d8c77[_0x0985('0x51')],_0x4a87d0);})[_0x0985('0x28')](function(_0x4d49f4){_0x12cf4d=_0x4d49f4;logger[_0x0985('0x18')]('Ticket\x20created!');logger[_0x0985('0x18')](_0x0985('0x53'),_0x12cf4d['id']);var _0x2674a1=util['format'](_0x0985('0x54'),_0x48a9d4[_0x0985('0x23')],_['split'](_0x12cf4d['id'],'x')[0x1]);logger[_0x0985('0x18')]('[OUTBOUND]',_0x0985('0x55'));emit(util['format']('user:%s',_0x1dcd3d[_0x0985('0x15')]),_0x0985('0x56'),{'uri':_0x2674a1});})['catch'](function(_0xe4ee68){logger['error'](_0x0985('0x5b'),JSON[_0x0985('0x27')](_0xe4ee68));});};exports[_0x0985('0x5e')]=function(_0x4e2c6b,_0x5a536a,_0x50a168,_0x1f61a2,_0x272582,_0x2a2e14){var _0x41abed,_0x299082,_0xebad69,_0x494d6b;_0x2a2e14[_0x0985('0x23')]=intUtil[_0x0985('0x58')](_0x2a2e14['remoteUri']);_0x2a2e14[_0x0985('0x4c')]=intUtil[_0x0985('0x58')](_0x2a2e14['serverUrl']);if(_0x272582&&_0x272582[_0x0985('0x5f')]){logger[_0x0985('0x18')]('['+_0x5a536a[_0x0985('0x60')][_0x0985('0x61')]()+']',_0x0985('0x49'));_0x5a536a[_0x0985('0x4a')]=util[_0x0985('0x21')](_0x0985('0x4b'),_0x2a2e14[_0x0985('0x4c')],_0x5a536a[_0x0985('0x4d')],md5(_0x5a536a[_0x0985('0x4d')]));}else{_0x5a536a[_0x0985('0x4a')]='';}return getConnection(_0x2a2e14)['then'](function(_0x2e44d3){_0x494d6b=_0x2e44d3;return getUser(_0x2a2e14,'',_0x494d6b);})[_0x0985('0x28')](function(_0x26b9d0){_0x41abed=_0x26b9d0;logger[_0x0985('0x18')](_0x0985('0x4f'),_0x41abed['id']);return getEndUser(_0x2a2e14,_0x5a536a['calleridname'],_0x5a536a[_0x0985('0x50')],_0x494d6b);})[_0x0985('0x28')](function(_0x3829c3){_0x299082=_0x3829c3;logger[_0x0985('0x18')](_0x0985('0x5d'),_0x299082['id']);return createTicket(_0x2a2e14,_0x41abed,_0x299082,_0x50a168,_0x5a536a,_0x50a168['Fields'],_0x494d6b);})['then'](function(_0x1dad93){_0xebad69=_0x1dad93;logger[_0x0985('0x18')](_0x0985('0x52'));logger['info'](_0x0985('0x53'),_0xebad69['id']);})[_0x0985('0x2e')](function(_0x5ade0b){logger[_0x0985('0x2d')]('['+_0x5a536a[_0x0985('0x60')][_0x0985('0x61')]()+']',JSON[_0x0985('0x27')](_0x5ade0b));});}; \ 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 c226790..84e5bea 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 _0xb33f=['Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','map','forEach','string','customField','nameField','toLowerCase','type','idField','custom_fields','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','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:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','replace','error','catch','inspect','recordingFormat','none','[OUTBOUND]','email','destcalleridname','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','Recording\x20is\x20enabled!','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','application/json','info','format','%s/tickets.json','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','ticket','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0xb33f,0x1cf));var _0xfb33=function(_0x50f38a,_0xb07144){_0x50f38a=_0x50f38a-0x0;var _0x18597c=_0xb33f[_0x50f38a];return _0x18597c;};'use strict';var _=require(_0xfb33('0x0'));var rp=require(_0xfb33('0x1'));var md5=require('md5');var util=require(_0xfb33('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xfb33('0x3'));var logger=require('../../../../config/logger')('zendesk');config['redis']=_[_0xfb33('0x4')](config[_0xfb33('0x5')],{'host':_0xfb33('0x6'),'port':0x18eb});var io=require(_0xfb33('0x7'))(new Redis(config['redis']));function emit(_0x990d80,_0xaa58dc,_0x3a2776){io['to'](_0x990d80)['emit'](_0xaa58dc,_0x3a2776);}var headers={'Content-Type':_0xfb33('0x8'),'Accept':_0xfb33('0x8')};function getTicket(_0x529bd8,_0x2b4039,_0x11e819,_0x3428a4,_0x1c61b7){logger[_0xfb33('0x9')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xfb33('0xa')](_0xfb33('0xb'),_0x529bd8[_0xfb33('0xc')]),'method':'POST','body':{'ticket':_[_0xfb33('0xd')]({'requester_id':_0x11e819['id'],'submitter_id':_0x2b4039?_0x2b4039['id']:undefined,'assignee_id':_0x2b4039?_0x2b4039['id']:undefined,'tags':getTags(_0x3428a4[_0xfb33('0xe')],_0xfb33('0xf')),'subject':intUtil[_0xfb33('0x10')](_0x3428a4[_0xfb33('0x11')],_0x1c61b7,'\x20'),'description':intUtil[_0xfb33('0x10')](_0x3428a4[_0xfb33('0x12')],_0x1c61b7,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x3428a4['Descriptions'],_0x1c61b7,'\x0a')}},getCustomFields(_0x3428a4[_0xfb33('0x13')],_0x1c61b7))}})[_0xfb33('0x14')](function(_0x433eeb){logger[_0xfb33('0x9')]('Ticket\x20created!');return _0x433eeb[_0xfb33('0x15')];});}function getUser(_0x59cebb,_0x1a9d2c){if(intUtil['validateEmail'](_0x1a9d2c)){logger[_0xfb33('0x9')]('Getting\x20agent\x20with\x20email',_0x1a9d2c);return request({'uri':util['format'](_0xfb33('0x16'),_0x59cebb[_0xfb33('0xc')]),'qs':{'query':util[_0xfb33('0xa')](_0xfb33('0x17'),_0x1a9d2c)}})[_0xfb33('0x14')](function(_0x4d9623){if(_0x4d9623[_0xfb33('0x18')]){logger['info'](_0xfb33('0x19'));return _[_0xfb33('0x1a')](_0x4d9623['results'],{'email':_0x1a9d2c,'role':_0xfb33('0x1b')});}else{logger[_0xfb33('0x9')](_0xfb33('0x1c'));return request({'uri':util[_0xfb33('0xa')](_0xfb33('0x1d'),_0x59cebb[_0xfb33('0xc')])})[_0xfb33('0x14')](function(_0x4019e1){logger[_0xfb33('0x9')](_0xfb33('0x1e'));return _0x4019e1[_0xfb33('0x1f')];});}});}else{logger['info'](_0xfb33('0x1c'));return request({'uri':util[_0xfb33('0xa')](_0xfb33('0x1d'),_0x59cebb[_0xfb33('0xc')])})[_0xfb33('0x14')](function(_0xf7aba6){logger[_0xfb33('0x9')](_0xfb33('0x1e'));return _0xf7aba6[_0xfb33('0x1f')];});}}function getEndUser(_0x138114,_0x1c35bb,_0x1cdbed){logger[_0xfb33('0x9')](_0xfb33('0x20'),_0x1cdbed);return request({'uri':util[_0xfb33('0xa')](_0xfb33('0x16'),_0x138114['remoteUri']),'qs':{'query':util[_0xfb33('0xa')](_0xfb33('0x21'),_0x1cdbed)}})[_0xfb33('0x14')](function(_0x26e0f6){var _0x150ecf;if(_0x26e0f6[_0xfb33('0x22')][_0xfb33('0x23')]){_0x26e0f6[_0xfb33('0x22')]=_[_0xfb33('0x24')](_0x26e0f6[_0xfb33('0x22')],{'suspended':![],'role':_0xfb33('0x25')});if(_0x26e0f6[_0xfb33('0x22')][_0xfb33('0x23')]){_0x150ecf=_['first'](_0x26e0f6[_0xfb33('0x22')]);}}if(_0x150ecf){logger[_0xfb33('0x9')]('Enduser\x20found!');return _0x150ecf;}else{logger[_0xfb33('0x9')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xfb33('0x26'),_0x138114[_0xfb33('0xc')]),'method':_0xfb33('0x27'),'body':{'user':{'role':_0xfb33('0x25'),'name':util[_0xfb33('0xa')](_0xfb33('0x28'),_0x1c35bb||_0x1cdbed),'phone':_0x1cdbed}}})[_0xfb33('0x14')](function(_0x4d8ece){logger[_0xfb33('0x9')](_0xfb33('0x29'));return _0x4d8ece[_0xfb33('0x1f')];});}});}function getAuth(_0x287525){var _0x1c45aa;if(_0x287525[_0xfb33('0x2a')]==='password'){_0x1c45aa=util[_0xfb33('0xa')](_0xfb33('0x2b'),_0x287525[_0xfb33('0x2c')],_0x287525[_0xfb33('0x2d')]);}else if(_0x287525[_0xfb33('0x2a')]===_0xfb33('0x2e')){_0x1c45aa=util[_0xfb33('0xa')](_0xfb33('0x2f'),_0x287525['username'],_0x287525[_0xfb33('0x2e')]);}return util[_0xfb33('0xa')](_0xfb33('0x30'),new Buffer(_0x1c45aa)[_0xfb33('0x31')](_0xfb33('0x32')));}function request(_0x47ab4a){logger['debug']('[HTTP]',JSON['stringify'](_0x47ab4a));return rp(_[_0xfb33('0x4')](_0x47ab4a,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x20f648,_0x53d3cb){var _0x2b1a5a=[];if(_0x20f648&&_0x20f648[_0xfb33('0x23')]>0x0){_0x2b1a5a=_[_0xfb33('0x33')](_0x20f648,_0x53d3cb);}return _0x2b1a5a;}function getCustomFields(_0x1feb5f,_0x23ef8f){var _0x2d3c28=[];var _0x42c366={'custom_fields':[]};if(_0x1feb5f[_0xfb33('0x23')]>0x0){_[_0xfb33('0x34')](_0x1feb5f,function(_0x53436c){if(_0x53436c['type']===_0xfb33('0x35')&&_0x53436c['nameField']&&!_0x53436c[_0xfb33('0x36')]){_0x42c366[_0x53436c[_0xfb33('0x37')][_0xfb33('0x38')]()]=_0x53436c['content'][_0xfb33('0x31')]();}else if(_0x53436c[_0xfb33('0x39')]===_0xfb33('0x35')&&_0x53436c[_0xfb33('0x3a')]&&_0x53436c[_0xfb33('0x36')]){_0x42c366[_0xfb33('0x3b')][_0xfb33('0x3c')]({'id':_0x53436c[_0xfb33('0x3a')],'value':_0x53436c['content']['toString']()});}else if(_0x53436c[_0xfb33('0x39')]===_0xfb33('0x3d')&&_0x53436c[_0xfb33('0x3e')]&&_0x53436c['idField']&&_0x53436c[_0xfb33('0x36')]){_0x23ef8f[_0x53436c[_0xfb33('0x3e')]]&&_0x42c366['custom_fields']['push']({'id':_0x53436c[_0xfb33('0x3a')],'value':_0x23ef8f[_0x53436c['variableName']]['toString']()});}else if(_0x53436c[_0xfb33('0x39')]==='customVariable'&&_0x53436c['Variable']&&_0x53436c['Variable'][_0xfb33('0xf')]&&_0x53436c[_0xfb33('0x3a')]&&_0x53436c['customField']){_0x23ef8f[_0x53436c[_0xfb33('0x3f')]['name'][_0xfb33('0x38')]()]&&_0x42c366[_0xfb33('0x3b')]['push']({'id':_0x53436c[_0xfb33('0x3a')],'value':_0x23ef8f[_0x53436c[_0xfb33('0x3f')][_0xfb33('0xf')]['toLowerCase']()][_0xfb33('0x31')]()});}});}return _0x42c366;}exports[_0xfb33('0x40')]=function(_0x12242c,_0x39e1db,_0x1b952b,_0x4176b1,_0x1324e6,_0x6db31a){var _0x3be9d3,_0x4c9f49;_0x6db31a[_0xfb33('0xc')]=intUtil[_0xfb33('0x41')](_0x6db31a[_0xfb33('0xc')]);_0x6db31a[_0xfb33('0x42')]=intUtil[_0xfb33('0x41')](_0x6db31a[_0xfb33('0x42')]);if(_0x1324e6&&_0x1324e6[_0xfb33('0x43')]){logger[_0xfb33('0x9')](_0xfb33('0x44'),'Recording\x20is\x20enabled!');_0x39e1db[_0xfb33('0x45')]=util[_0xfb33('0xa')](_0xfb33('0x46'),_0x6db31a[_0xfb33('0x42')],_0x39e1db[_0xfb33('0x47')],md5(_0x39e1db['uniqueid']));}else{_0x39e1db[_0xfb33('0x45')]='';}headers[_0xfb33('0x48')]=getAuth(_0x6db31a);return getUser(_0x6db31a,_0x4176b1['email'])[_0xfb33('0x14')](function(_0x37c5e5){_0x3be9d3=_0x37c5e5;logger[_0xfb33('0x9')](_0xfb33('0x49'),_0x3be9d3['id']);return getEndUser(_0x6db31a,_0x39e1db[_0xfb33('0x4a')],_0x39e1db[_0xfb33('0x4b')]);})[_0xfb33('0x14')](function(_0x481b11){_0x4c9f49=_0x481b11;logger[_0xfb33('0x9')](_0xfb33('0x4c'),_0x4c9f49['id']);return getTicket(_0x6db31a,_0x3be9d3,_0x4c9f49,_0x1b952b,_0x39e1db);})[_0xfb33('0x14')](function(_0x454295){if(_0x454295){logger['info'](_0xfb33('0x4d'),_0x454295['id']);switch(_0x6db31a[_0xfb33('0x39')]){case'integrationTab':logger['info'](_0xfb33('0x44'),_0xfb33('0x4e'));return request({'uri':util[_0xfb33('0xa')](_0xfb33('0x4f'),_0x6db31a[_0xfb33('0xc')],_0x3be9d3['id'],_0x454295['id']),'method':_0xfb33('0x27')});case'newTab':logger[_0xfb33('0x9')](_0xfb33('0x44'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfb33('0xa')](_0xfb33('0x50'),_0x4176b1[_0xfb33('0xf')]),'trigger:browser:url',{'uri':util[_0xfb33('0xa')]('%s/agent/tickets/%s',_0x6db31a['remoteUri'][_0xfb33('0x51')]('/api/v2',''),_0x454295['id'])});break;default:logger[_0xfb33('0x52')](_0xfb33('0x44'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xfb33('0x53')](function(_0x157ff5){logger[_0xfb33('0x52')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xfb33('0x54')](_0x157ff5,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x3b367e,_0x90215f,_0xe0e936,_0x4719a0,_0x53db70,_0x1c56ec,_0x38cc96){var _0x42af51,_0x25b1a1;_0x1c56ec[_0xfb33('0xc')]=intUtil['stripTrailingSlash'](_0x1c56ec['remoteUri']);_0x1c56ec[_0xfb33('0x42')]=intUtil[_0xfb33('0x41')](_0x1c56ec[_0xfb33('0x42')]);if(_0x38cc96&&_0x38cc96['recordingFormat']&&_0x38cc96[_0xfb33('0x55')]!==_0xfb33('0x56')){logger[_0xfb33('0x9')](_0xfb33('0x57'),'Recording\x20is\x20enabled!');_0x90215f[_0xfb33('0x45')]=util[_0xfb33('0xa')](_0xfb33('0x46'),_0x1c56ec[_0xfb33('0x42')],_0x90215f['uniqueid'],md5(_0x90215f['uniqueid']));}headers[_0xfb33('0x48')]=getAuth(_0x1c56ec);return getUser(_0x1c56ec,_0x4719a0[_0xfb33('0x58')])[_0xfb33('0x14')](function(_0x5bfe89){_0x42af51=_0x5bfe89;logger[_0xfb33('0x9')]('The\x20User\x20ID\x20is:',_0x42af51['id']);return getEndUser(_0x1c56ec,_0x90215f[_0xfb33('0x59')],_0x90215f['destcalleridnum']);})[_0xfb33('0x14')](function(_0xd7bfb2){_0x25b1a1=_0xd7bfb2;logger[_0xfb33('0x9')](_0xfb33('0x4c'),_0x25b1a1['id']);return getTicket(_0x1c56ec,_0x42af51,_0x25b1a1,_0xe0e936,_0x90215f);})[_0xfb33('0x14')](function(_0x5410d2){if(_0x5410d2){logger[_0xfb33('0x9')]('The\x20Ticket\x20ID\x20is:',_0x5410d2['id']);switch(_0x1c56ec[_0xfb33('0x39')]){case'integrationTab':logger['info'](_0xfb33('0x57'),_0xfb33('0x4e'));return request({'uri':util[_0xfb33('0xa')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1c56ec[_0xfb33('0xc')],_0x42af51['id'],_0x5410d2['id']),'method':_0xfb33('0x27')});case'newTab':logger['info'](_0xfb33('0x57'),_0xfb33('0x5a'));emit(util[_0xfb33('0xa')](_0xfb33('0x50'),_0x4719a0['name']),_0xfb33('0x5b'),{'uri':util[_0xfb33('0xa')](_0xfb33('0x5c'),_0x1c56ec['remoteUri']['replace']('/api/v2',''),_0x5410d2['id'])});break;default:logger[_0xfb33('0x52')](_0xfb33('0x57'),_0xfb33('0x5d'));}}})['catch'](function(_0x4ad20a){logger['error'](_0xfb33('0x5e'),util[_0xfb33('0x54')](_0x4ad20a,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x4dda56,_0x508ac5,_0x4a9caf,_0x518299,_0x386fc9,_0x4aae4f){var _0x4df732,_0x266b58;_0x4aae4f[_0xfb33('0xc')]=intUtil['stripTrailingSlash'](_0x4aae4f['remoteUri']);_0x4aae4f['serverUrl']=intUtil[_0xfb33('0x41')](_0x4aae4f[_0xfb33('0x42')]);if(_0x386fc9&&_0x386fc9[_0xfb33('0x43')]){logger[_0xfb33('0x9')]('['+_0x508ac5[_0xfb33('0x5f')][_0xfb33('0x60')]()+']',_0xfb33('0x61'));_0x508ac5[_0xfb33('0x45')]=util[_0xfb33('0xa')](_0xfb33('0x46'),_0x4aae4f['serverUrl'],_0x508ac5[_0xfb33('0x47')],md5(_0x508ac5[_0xfb33('0x47')]));}else{_0x508ac5[_0xfb33('0x45')]='';}headers[_0xfb33('0x48')]=getAuth(_0x4aae4f);return getUser(_0x4aae4f)[_0xfb33('0x14')](function(_0x5934a6){_0x4df732=_0x5934a6;logger[_0xfb33('0x9')](_0xfb33('0x49'),_0x4df732['id']);return getEndUser(_0x4aae4f,_0x508ac5[_0xfb33('0x4a')],_0x508ac5[_0xfb33('0x4b')]);})[_0xfb33('0x14')](function(_0x5ec4bf){_0x266b58=_0x5ec4bf;logger['info'](_0xfb33('0x4c'),_0x266b58['id']);return getTicket(_0x4aae4f,_0x4df732,_0x266b58,_0x4a9caf,_0x508ac5);})[_0xfb33('0x14')](function(_0x1acea9){if(_0x1acea9){logger[_0xfb33('0x9')](_0xfb33('0x4d'),_0x1acea9['id']);}})[_0xfb33('0x53')](function(_0x308652){logger['error']('['+_0x508ac5['lastevent'][_0xfb33('0x60')]()+']'+_0xfb33('0x62'),util[_0xfb33('0x54')](_0x308652,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x714c=['base64','debug','stringify','defaults','map','nameField','customField','toLowerCase','content','type','string','idField','push','variable','variableName','custom_fields','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridname','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','./util','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','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','results','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString'];(function(_0x49a124,_0x3538e7){var _0x35c643=function(_0x27c06b){while(--_0x27c06b){_0x49a124['push'](_0x49a124['shift']());}};_0x35c643(++_0x3538e7);}(_0x714c,0x18d));var _0xc714=function(_0x216d45,_0x4989fe){_0x216d45=_0x216d45-0x0;var _0xbaac0b=_0x714c[_0x216d45];return _0xbaac0b;};'use strict';var _=require('lodash');var rp=require(_0xc714('0x0'));var md5=require(_0xc714('0x1'));var util=require(_0xc714('0x2'));var Redis=require(_0xc714('0x3'));var intUtil=require(_0xc714('0x4'));var config=require('../../../../config/environment');var logger=require(_0xc714('0x5'))(_0xc714('0x6'));config['redis']=_['defaults'](config[_0xc714('0x7')],{'host':_0xc714('0x8'),'port':0x18eb});var io=require(_0xc714('0x9'))(new Redis(config[_0xc714('0x7')]));function emit(_0x4a2dd9,_0x56327c,_0x477078){io['to'](_0x4a2dd9)[_0xc714('0xa')](_0x56327c,_0x477078);}var headers={'Content-Type':_0xc714('0xb'),'Accept':_0xc714('0xb')};function getTicket(_0xbaa220,_0x5b6aa5,_0x226622,_0x34a03f,_0x3438b4){logger[_0xc714('0xc')](_0xc714('0xd'));return request({'uri':util['format'](_0xc714('0xe'),_0xbaa220[_0xc714('0xf')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x226622['id'],'submitter_id':_0x5b6aa5?_0x5b6aa5['id']:undefined,'assignee_id':_0x5b6aa5?_0x5b6aa5['id']:undefined,'tags':getTags(_0x34a03f[_0xc714('0x10')],'name'),'subject':intUtil[_0xc714('0x11')](_0x34a03f[_0xc714('0x12')],_0x3438b4,'\x20'),'description':intUtil[_0xc714('0x11')](_0x34a03f[_0xc714('0x13')],_0x3438b4,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x34a03f[_0xc714('0x13')],_0x3438b4,'\x0a')}},getCustomFields(_0x34a03f[_0xc714('0x14')],_0x3438b4))}})[_0xc714('0x15')](function(_0x25a61c){logger[_0xc714('0xc')](_0xc714('0x16'));return _0x25a61c[_0xc714('0x17')];});}function getUser(_0x54144c,_0x4fd793){if(intUtil['validateEmail'](_0x4fd793)){logger[_0xc714('0xc')](_0xc714('0x18'),_0x4fd793);return request({'uri':util[_0xc714('0x19')](_0xc714('0x1a'),_0x54144c[_0xc714('0xf')]),'qs':{'query':util[_0xc714('0x19')](_0xc714('0x1b'),_0x4fd793)}})[_0xc714('0x15')](function(_0x50a84a){if(_0x50a84a[_0xc714('0x1c')]){logger[_0xc714('0xc')](_0xc714('0x1d'));return _[_0xc714('0x1e')](_0x50a84a['results'],{'email':_0x4fd793,'role':_0xc714('0x1f')});}else{logger[_0xc714('0xc')](_0xc714('0x20'));return request({'uri':util[_0xc714('0x19')](_0xc714('0x21'),_0x54144c['remoteUri'])})[_0xc714('0x15')](function(_0x5d4a4d){logger[_0xc714('0xc')](_0xc714('0x22'));return _0x5d4a4d[_0xc714('0x23')];});}});}else{logger[_0xc714('0xc')](_0xc714('0x20'));return request({'uri':util['format']('%s/users/me.json',_0x54144c[_0xc714('0xf')])})['then'](function(_0xbc41ee){logger[_0xc714('0xc')]('Admin\x20account\x20selected.');return _0xbc41ee['user'];});}}function getEndUser(_0x33ac9c,_0x306dd0,_0x270386){logger[_0xc714('0xc')](_0xc714('0x24'),_0x270386);return request({'uri':util['format'](_0xc714('0x1a'),_0x33ac9c[_0xc714('0xf')]),'qs':{'query':util['format'](_0xc714('0x25'),_0x270386)}})[_0xc714('0x15')](function(_0x43f8d9){var _0x48b64b;if(_0x43f8d9['results'][_0xc714('0x26')]){_0x43f8d9['results']=_[_0xc714('0x27')](_0x43f8d9[_0xc714('0x28')],{'suspended':![],'role':'end-user'});if(_0x43f8d9[_0xc714('0x28')][_0xc714('0x26')]){_0x48b64b=_['first'](_0x43f8d9[_0xc714('0x28')]);}}if(_0x48b64b){logger[_0xc714('0xc')]('Enduser\x20found!');return _0x48b64b;}else{logger[_0xc714('0xc')](_0xc714('0x29'));return request({'uri':util[_0xc714('0x19')](_0xc714('0x2a'),_0x33ac9c[_0xc714('0xf')]),'method':_0xc714('0x2b'),'body':{'user':{'role':_0xc714('0x2c'),'name':util['format'](_0xc714('0x2d'),_0x306dd0||_0x270386),'phone':_0x270386}}})[_0xc714('0x15')](function(_0x30e6fd){logger[_0xc714('0xc')](_0xc714('0x2e'));return _0x30e6fd[_0xc714('0x23')];});}});}function getAuth(_0xc2898b){var _0x7cd758;if(_0xc2898b[_0xc714('0x2f')]===_0xc714('0x30')){_0x7cd758=util[_0xc714('0x19')](_0xc714('0x31'),_0xc2898b[_0xc714('0x32')],_0xc2898b[_0xc714('0x30')]);}else if(_0xc2898b['authType']===_0xc714('0x33')){_0x7cd758=util[_0xc714('0x19')](_0xc714('0x34'),_0xc2898b[_0xc714('0x32')],_0xc2898b[_0xc714('0x33')]);}return util[_0xc714('0x19')](_0xc714('0x35'),new Buffer(_0x7cd758)[_0xc714('0x36')](_0xc714('0x37')));}function request(_0x4f845b){logger[_0xc714('0x38')]('[HTTP]',JSON[_0xc714('0x39')](_0x4f845b));return rp(_[_0xc714('0x3a')](_0x4f845b,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x58834f,_0x4f8bf0){var _0xbd4c0b=[];if(_0x58834f&&_0x58834f[_0xc714('0x26')]>0x0){_0xbd4c0b=_[_0xc714('0x3b')](_0x58834f,_0x4f8bf0);}return _0xbd4c0b;}function getCustomFields(_0x38011b,_0x54c071){var _0x4611c7=[];var _0xcdd574={'custom_fields':[]};if(_0x38011b[_0xc714('0x26')]>0x0){_['forEach'](_0x38011b,function(_0x5d8fba){if(_0x5d8fba['type']==='string'&&_0x5d8fba[_0xc714('0x3c')]&&!_0x5d8fba[_0xc714('0x3d')]){_0xcdd574[_0x5d8fba[_0xc714('0x3c')][_0xc714('0x3e')]()]=_0x5d8fba[_0xc714('0x3f')][_0xc714('0x36')]();}else if(_0x5d8fba[_0xc714('0x40')]===_0xc714('0x41')&&_0x5d8fba[_0xc714('0x42')]&&_0x5d8fba[_0xc714('0x3d')]){_0xcdd574['custom_fields'][_0xc714('0x43')]({'id':_0x5d8fba[_0xc714('0x42')],'value':_0x5d8fba[_0xc714('0x3f')]['toString']()});}else if(_0x5d8fba[_0xc714('0x40')]===_0xc714('0x44')&&_0x5d8fba['variableName']&&_0x5d8fba['idField']&&_0x5d8fba[_0xc714('0x3d')]){_0x54c071[_0x5d8fba[_0xc714('0x45')]]&&_0xcdd574[_0xc714('0x46')][_0xc714('0x43')]({'id':_0x5d8fba[_0xc714('0x42')],'value':_0x54c071[_0x5d8fba[_0xc714('0x45')]]['toString']()});}else if(_0x5d8fba['type']==='customVariable'&&_0x5d8fba[_0xc714('0x47')]&&_0x5d8fba[_0xc714('0x47')][_0xc714('0x48')]&&_0x5d8fba['idField']&&_0x5d8fba[_0xc714('0x3d')]){_0x54c071[_0x5d8fba[_0xc714('0x47')][_0xc714('0x48')][_0xc714('0x3e')]()]&&_0xcdd574['custom_fields'][_0xc714('0x43')]({'id':_0x5d8fba['idField'],'value':_0x54c071[_0x5d8fba[_0xc714('0x47')][_0xc714('0x48')]['toLowerCase']()][_0xc714('0x36')]()});}});}return _0xcdd574;}exports[_0xc714('0x49')]=function(_0x5064fc,_0x4da5db,_0x37ad1a,_0xbb88de,_0x4c954d,_0x110358){var _0x4b3778,_0x3d0e9c;_0x110358[_0xc714('0xf')]=intUtil[_0xc714('0x4a')](_0x110358[_0xc714('0xf')]);_0x110358['serverUrl']=intUtil[_0xc714('0x4a')](_0x110358[_0xc714('0x4b')]);if(_0x4c954d&&_0x4c954d[_0xc714('0x4c')]){logger[_0xc714('0xc')](_0xc714('0x4d'),_0xc714('0x4e'));_0x4da5db[_0xc714('0x4f')]=util[_0xc714('0x19')](_0xc714('0x50'),_0x110358['serverUrl'],_0x4da5db[_0xc714('0x51')],md5(_0x4da5db[_0xc714('0x51')]));}else{_0x4da5db[_0xc714('0x4f')]='';}headers[_0xc714('0x52')]=getAuth(_0x110358);return getUser(_0x110358,_0xbb88de[_0xc714('0x53')])[_0xc714('0x15')](function(_0x8fd54d){_0x4b3778=_0x8fd54d;logger[_0xc714('0xc')](_0xc714('0x54'),_0x4b3778['id']);return getEndUser(_0x110358,_0x4da5db['calleridname'],_0x4da5db[_0xc714('0x55')]);})[_0xc714('0x15')](function(_0x417ca0){_0x3d0e9c=_0x417ca0;logger[_0xc714('0xc')](_0xc714('0x56'),_0x3d0e9c['id']);return getTicket(_0x110358,_0x4b3778,_0x3d0e9c,_0x37ad1a,_0x4da5db);})['then'](function(_0x38242e){if(_0x38242e){logger['info'](_0xc714('0x57'),_0x38242e['id']);switch(_0x110358[_0xc714('0x40')]){case _0xc714('0x58'):logger[_0xc714('0xc')]('[QUEUE]',_0xc714('0x59'));return request({'uri':util[_0xc714('0x19')](_0xc714('0x5a'),_0x110358[_0xc714('0xf')],_0x4b3778['id'],_0x38242e['id']),'method':_0xc714('0x2b')});case _0xc714('0x5b'):logger['info'](_0xc714('0x4d'),_0xc714('0x5c'));emit(util[_0xc714('0x19')](_0xc714('0x5d'),_0xbb88de['name']),_0xc714('0x5e'),{'uri':util['format'](_0xc714('0x5f'),_0x110358['remoteUri'][_0xc714('0x60')](_0xc714('0x61'),''),_0x38242e['id'])});break;default:logger[_0xc714('0x62')](_0xc714('0x4d'),_0xc714('0x63'));}}})[_0xc714('0x64')](function(_0x2bc0fb){logger['error'](_0xc714('0x65'),util[_0xc714('0x66')](_0x2bc0fb,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x4ceeb5,_0x1e0cad,_0x5d184f,_0x577b81,_0x409b2b,_0x4360c5,_0x230e53){var _0x340eec,_0x146803;_0x4360c5['remoteUri']=intUtil[_0xc714('0x4a')](_0x4360c5[_0xc714('0xf')]);_0x4360c5['serverUrl']=intUtil['stripTrailingSlash'](_0x4360c5[_0xc714('0x4b')]);if(_0x230e53&&_0x230e53[_0xc714('0x67')]&&_0x230e53['recordingFormat']!==_0xc714('0x68')){logger[_0xc714('0xc')](_0xc714('0x69'),_0xc714('0x4e'));_0x1e0cad[_0xc714('0x4f')]=util['format'](_0xc714('0x50'),_0x4360c5[_0xc714('0x4b')],_0x1e0cad[_0xc714('0x51')],md5(_0x1e0cad[_0xc714('0x51')]));}headers[_0xc714('0x52')]=getAuth(_0x4360c5);return getUser(_0x4360c5,_0x577b81[_0xc714('0x53')])[_0xc714('0x15')](function(_0x1fd41c){_0x340eec=_0x1fd41c;logger[_0xc714('0xc')]('The\x20User\x20ID\x20is:',_0x340eec['id']);return getEndUser(_0x4360c5,_0x1e0cad['destcalleridname'],_0x1e0cad[_0xc714('0x6a')]);})[_0xc714('0x15')](function(_0x348e45){_0x146803=_0x348e45;logger['info'](_0xc714('0x56'),_0x146803['id']);return getTicket(_0x4360c5,_0x340eec,_0x146803,_0x5d184f,_0x1e0cad);})[_0xc714('0x15')](function(_0x24a3b0){if(_0x24a3b0){logger['info'](_0xc714('0x57'),_0x24a3b0['id']);switch(_0x4360c5[_0xc714('0x40')]){case _0xc714('0x58'):logger[_0xc714('0xc')](_0xc714('0x69'),_0xc714('0x59'));return request({'uri':util[_0xc714('0x19')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x4360c5[_0xc714('0xf')],_0x340eec['id'],_0x24a3b0['id']),'method':_0xc714('0x2b')});case _0xc714('0x5b'):logger[_0xc714('0xc')](_0xc714('0x69'),_0xc714('0x5c'));emit(util['format'](_0xc714('0x5d'),_0x577b81['name']),'trigger:browser:url',{'uri':util[_0xc714('0x19')]('%s/agent/tickets/%s',_0x4360c5[_0xc714('0xf')][_0xc714('0x60')]('/api/v2',''),_0x24a3b0['id'])});break;default:logger[_0xc714('0x62')](_0xc714('0x69'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xc714('0x64')](function(_0x47c26d){logger[_0xc714('0x62')](_0xc714('0x6b'),util[_0xc714('0x66')](_0x47c26d,{'showHidden':!![],'depth':null}));});};exports[_0xc714('0x6c')]=function(_0x218a82,_0x292ee7,_0x4363b0,_0x5b8f3f,_0x285eee,_0x49643f){var _0x185c83,_0x1f184a;_0x49643f[_0xc714('0xf')]=intUtil[_0xc714('0x4a')](_0x49643f['remoteUri']);_0x49643f[_0xc714('0x4b')]=intUtil[_0xc714('0x4a')](_0x49643f['serverUrl']);if(_0x285eee&&_0x285eee['monitor_format']){logger[_0xc714('0xc')]('['+_0x292ee7[_0xc714('0x6d')][_0xc714('0x6e')]()+']',_0xc714('0x4e'));_0x292ee7[_0xc714('0x4f')]=util[_0xc714('0x19')](_0xc714('0x50'),_0x49643f[_0xc714('0x4b')],_0x292ee7[_0xc714('0x51')],md5(_0x292ee7[_0xc714('0x51')]));}else{_0x292ee7[_0xc714('0x4f')]='';}headers[_0xc714('0x52')]=getAuth(_0x49643f);return getUser(_0x49643f)[_0xc714('0x15')](function(_0x4f66a1){_0x185c83=_0x4f66a1;logger['info']('The\x20User\x20ID\x20is:',_0x185c83['id']);return getEndUser(_0x49643f,_0x292ee7[_0xc714('0x6f')],_0x292ee7[_0xc714('0x55')]);})[_0xc714('0x15')](function(_0x407380){_0x1f184a=_0x407380;logger[_0xc714('0xc')](_0xc714('0x56'),_0x1f184a['id']);return getTicket(_0x49643f,_0x185c83,_0x1f184a,_0x4363b0,_0x292ee7);})[_0xc714('0x15')](function(_0x1507e7){if(_0x1507e7){logger[_0xc714('0xc')](_0xc714('0x57'),_0x1507e7['id']);}})['catch'](function(_0x54a6e5){logger['error']('['+_0x292ee7[_0xc714('0x6d')][_0xc714('0x6e')]()+']'+_0xc714('0x70'),util[_0xc714('0x66')](_0x54a6e5,{'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 885df81..2de618f 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 _0xf7fb=['toUpperCase','lodash','util','./util','moment','bluebird','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','type','string','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','expires_in','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','ActiveUsers','users','isArrayLikeObject','findIndex','profile','Administrator','user','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','catch','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','data','code','SUCCESS','details','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','Called','complete','connect','Answered','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','merge','Call\x20created!','err','stack','log','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','/crm/EntityInfo.do?module=Calls&id='];(function(_0x303750,_0x129e23){var _0x1dc3ef=function(_0x39e8e2){while(--_0x39e8e2){_0x303750['push'](_0x303750['shift']());}};_0x1dc3ef(++_0x129e23);}(_0xf7fb,0x1cc));var _0xbf7f=function(_0x1157ad,_0x520abd){_0x1157ad=_0x1157ad-0x0;var _0x7f5ad6=_0xf7fb[_0x1157ad];return _0x7f5ad6;};'use strict';var _=require(_0xbf7f('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xbf7f('0x1'));var intUtil=require(_0xbf7f('0x2'));var moment=require(_0xbf7f('0x3'));var Redis=require('ioredis');var BPromise=require(_0xbf7f('0x4'));var config=require('../../../../config/environment');var logger=require(_0xbf7f('0x5'))('zoho');config[_0xbf7f('0x6')]=_[_0xbf7f('0x7')](config['redis'],{'host':_0xbf7f('0x8'),'port':0x18eb});var io=require(_0xbf7f('0x9'))(new Redis(config[_0xbf7f('0x6')]));function emit(_0x42584a,_0xd11ec7,_0x5a09ca){io['to'](_0x42584a)[_0xbf7f('0xa')](_0xd11ec7,_0x5a09ca);}function request(_0x29430c){logger[_0xbf7f('0xb')](_0xbf7f('0xc'),JSON[_0xbf7f('0xd')](_0x29430c));return rp(_0x29430c);}function getCustomFields(_0x5c81a4,_0x37084c){var _0x1f60d5={};if(_0x5c81a4[_0xbf7f('0xe')]>0x0){_[_0xbf7f('0xf')](_0x5c81a4,function(_0x48e14b){if(_0x48e14b[_0xbf7f('0x10')]===_0xbf7f('0x11')&&_0x48e14b[_0xbf7f('0x12')]){_0x1f60d5[_0x48e14b[_0xbf7f('0x12')]]=_0x48e14b['content'][_0xbf7f('0x13')]();}else if(_0x48e14b[_0xbf7f('0x10')]===_0xbf7f('0x14')&&_0x48e14b['variableName']&&_0x48e14b[_0xbf7f('0x12')]&&_0x37084c[_0x48e14b[_0xbf7f('0x15')]]){_0x1f60d5[_0x48e14b[_0xbf7f('0x12')]]=_0x37084c[_0x48e14b[_0xbf7f('0x15')]][_0xbf7f('0x13')]();}else if(_0x48e14b[_0xbf7f('0x10')]===_0xbf7f('0x16')&&_0x48e14b[_0xbf7f('0x17')]&&_0x48e14b['Variable'][_0xbf7f('0x18')]&&_0x48e14b[_0xbf7f('0x12')]&&_0x37084c[_0x48e14b[_0xbf7f('0x17')]['name'][_0xbf7f('0x19')]()]){_0x1f60d5[_0x48e14b[_0xbf7f('0x12')]]=_0x37084c[_0x48e14b[_0xbf7f('0x17')][_0xbf7f('0x18')][_0xbf7f('0x19')]()][_0xbf7f('0x13')]();}});}return _0x1f60d5;}function getName(_0x4462bf){if(_0x4462bf[_0xbf7f('0x1a')]('\x20')>0x0){var _0x42074d=_0x4462bf[_0xbf7f('0x1b')](/ (.+)/);if(_0x42074d[0x1]){return _0x42074d;}}return[_0x4462bf,_0x4462bf];}var accountsTokens={};function getAccessToken(_0x4b9a79){return new Promise(function(_0x42acf6,_0x4e1545){if(!_[_0xbf7f('0x1c')](accountsTokens[_0x4b9a79['id']])&&!_[_0xbf7f('0x1c')](accountsTokens[_0x4b9a79['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x4b9a79['id']][_0xbf7f('0x1d')])){_0x42acf6(accountsTokens[_0x4b9a79['id']][_0xbf7f('0x1e')]);}}var _0xa2f08e;switch(_0x4b9a79[_0xbf7f('0x1f')]){case'US':_0xa2f08e='https://accounts.zoho.com';break;case'AU':_0xa2f08e=_0xbf7f('0x20');break;case'EU':_0xa2f08e=_0xbf7f('0x21');break;case'IN':_0xa2f08e=_0xbf7f('0x22');break;case'CN':_0xa2f08e='https://accounts.zoho.com.cn';break;default:_0xa2f08e=_0xbf7f('0x21');break;}var _0x2ea8cd={'method':_0xbf7f('0x23'),'uri':_0xa2f08e+_0xbf7f('0x24'),'qs':{'refresh_token':_0x4b9a79[_0xbf7f('0x25')],'client_id':_0x4b9a79[_0xbf7f('0x26')],'client_secret':_0x4b9a79[_0xbf7f('0x27')],'grant_type':_0xbf7f('0x28')},'json':!![]};return rp(_0x2ea8cd)[_0xbf7f('0x29')](function(_0x9ade45){accountsTokens[_0x4b9a79['id']]={'access_token':_0x9ade45['access_token'],'expires_in':moment()[_0xbf7f('0x2a')](_0x9ade45[_0xbf7f('0x1d')],'seconds')};_0x42acf6(_0x9ade45[_0xbf7f('0x1e')]);})['catch'](function(_0x1f57bd){logger[_0xbf7f('0x2b')](_0xbf7f('0x2c'),_0x1f57bd['stack']);_0x4e1545(_0x1f57bd);});});}function getUser(_0xed41,_0x2db20b,_0x1981f3,_0xb55bc8){logger[_0xbf7f('0x2d')](_0xbf7f('0x2e'));return request({'method':_0xbf7f('0x2f'),'uri':util[_0xbf7f('0x30')]('https://www.zohoapis.%s/crm/v2/users',_0x2db20b),'qs':{'type':_0xbf7f('0x31')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xed41},'json':!![]})['then'](function(_0x35ba3c){if(_0x35ba3c[_0xbf7f('0x32')]){var _0x4608d2=-0x1;if(_[_0xbf7f('0x33')](_0x35ba3c[_0xbf7f('0x32')])){if(!_['isNil'](_0xb55bc8)){_0x4608d2=_[_0xbf7f('0x34')](_0x35ba3c[_0xbf7f('0x32')],function(_0x123e62){return _0x123e62['email']===_0xb55bc8;});}if(_0x4608d2>=0x0){logger[_0xbf7f('0x2d')]('Agent\x20found!');}else{logger['info']('Using\x20the\x20admin\x20account!');_0x4608d2=_[_0xbf7f('0x34')](_0x35ba3c[_0xbf7f('0x32')],function(_0x3987c8){return _0x3987c8[_0xbf7f('0x35')][_0xbf7f('0x18')]===_0xbf7f('0x36');});}return _0x35ba3c[_0xbf7f('0x32')][_0x4608d2];}else{if(_0x35ba3c[_0xbf7f('0x37')][_0xbf7f('0x35')]['name']===_0xbf7f('0x36')){logger[_0xbf7f('0x2d')](_0xbf7f('0x38'));user=_0x35ba3c[_0xbf7f('0x37')];return user;}else{logger[_0xbf7f('0x2b')](_0xbf7f('0x39'),JSON['stringify'](_0x35ba3c));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xbf7f('0xd')](_0x35ba3c));}}}else{logger[_0xbf7f('0x2b')](_0xbf7f('0x39'),JSON['stringify'](_0x35ba3c));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x35ba3c));}})[_0xbf7f('0x3a')](function(_0x3a0233){console[_0xbf7f('0x2b')](_0x3a0233);});}function getZohoUser(_0xc06115,_0x2f1899){return new BPromise(function(_0x3ac377,_0x5e1264){request(_0xc06115)[_0xbf7f('0x29')](function(_0x4a8bf0){var _0x4e5427=null;if(_0x4a8bf0){_0x4e5427=_0x4a8bf0['data'][0x0];_0x4e5427[_0xbf7f('0x3b')]=_0x2f1899;}_0x3ac377(_0x4e5427);})[_0xbf7f('0x3a')](function(_0x2e7d33){_0x5e1264(_0x2e7d33);});});}function createEndUser(_0x5af504,_0x186817,_0x2883c8,_0x54bcea,_0x5dc060,_0xa013a4){var _0x2883c8=getName(_0x2883c8);return request({'method':_0xbf7f('0x23'),'uri':_0xbf7f('0x3c')+_0x186817+'/crm/v2/'+_[_0xbf7f('0x3d')](_0xa013a4[_0xbf7f('0x3e')])+'s','body':{'data':[{'Last_Name':_0x2883c8[0x1],'First_Name':_0x2883c8[0x0],'Phone':_0x54bcea,'Owner':{'name':!_['isNil'](_0x5dc060[_0xbf7f('0x3f')][_0xbf7f('0x18')])?_0x5dc060[_0xbf7f('0x3f')][_0xbf7f('0x18')]:!_[_0xbf7f('0x1c')](_0x5dc060[_0xbf7f('0x40')])?_0x5dc060[_0xbf7f('0x40')]+'\x20'+_0x5dc060[_0xbf7f('0x41')]:_0x5dc060['last_name'],'id':_0x5dc060['id']}}]},'headers':{'Authorization':_0xbf7f('0x42')+_0x5af504},'json':!![]})['then'](function(_0x2f5c80){if(_0x2f5c80&&_0x2f5c80[_0xbf7f('0x43')][0x0][_0xbf7f('0x44')]===_0xbf7f('0x45')){var _0x473362=_0x2f5c80[_0xbf7f('0x43')][0x0][_0xbf7f('0x46')];_0x473362[_0xbf7f('0x3b')]=_[_0xbf7f('0x3d')](_0xa013a4['moduleCreate'])+'s';return _0x473362;}logger[_0xbf7f('0x2b')](_0xbf7f('0x39'),JSON['stringify'](data));throw new Error(_0xbf7f('0x47')+JSON[_0xbf7f('0xd')](data));})['catch'](function(_0x21d66a){console['log'](_0xbf7f('0x48'),_0x21d66a);});}function getEndUser(_0x20b378,_0x3b4dcc,_0x1963e7,_0x24d68c,_0x55779b,_0x33a17c,_0x3480a6){var _0x2f2f86={'method':'GET','uri':'','headers':{'Authorization':_0xbf7f('0x42')+_0x20b378},'json':!![]};switch(_0x3480a6[_0xbf7f('0x49')]){case _0xbf7f('0x4a'):_0x2f2f86[_0xbf7f('0x4b')]=_0xbf7f('0x3c')+_0x3b4dcc+_0xbf7f('0x4c')+_0x55779b+'))';return getZohoUser(_0x2f2f86,_0xbf7f('0x4d'))['then'](function(_0x3b3101){if(_0x3b3101)return _0x3b3101;_0x2f2f86[_0xbf7f('0x4b')]='https://www.zohoapis.'+_0x3b4dcc+_0xbf7f('0x4e')+_0x55779b+'))';return getZohoUser(_0x2f2f86,_0xbf7f('0x4f'))[_0xbf7f('0x29')](function(_0x455e97){if(_0x455e97)return _0x455e97;if(_0x3480a6[_0xbf7f('0x3e')]!=_0xbf7f('0x50')){return createEndUser(_0x20b378,_0x3b4dcc,_0x24d68c,_0x55779b,_0x33a17c,_0x3480a6);}else{return{};}});});break;case'contact':_0x2f2f86['uri']=_0xbf7f('0x3c')+_0x3b4dcc+_0xbf7f('0x4c')+_0x55779b+'))';return getZohoUser(_0x2f2f86,_0xbf7f('0x4d'))[_0xbf7f('0x29')](function(_0x5d7cc6){if(_0x5d7cc6)return _0x5d7cc6;if(_0x3480a6[_0xbf7f('0x3e')]!=_0xbf7f('0x50')){return createEndUser(_0x20b378,_0x3b4dcc,_0x24d68c,_0x55779b,_0x33a17c,_0x3480a6);}else{return{};}});break;case _0xbf7f('0x51'):_0x2f2f86[_0xbf7f('0x4b')]=_0xbf7f('0x3c')+_0x3b4dcc+_0xbf7f('0x4e')+_0x55779b+'))';return getZohoUser(_0x2f2f86,_0xbf7f('0x4f'))['then'](function(_0x22ed1d){if(_0x22ed1d)return _0x22ed1d;if(_0x3480a6[_0xbf7f('0x3e')]!='nothing'){return createEndUser(_0x20b378,_0x3b4dcc,_0x24d68c,_0x55779b,_0x33a17c,_0x3480a6);}else{return{};}});break;}}function getCall(_0x58b532,_0x98c60b,_0x4b7ab0,_0x2d95f6,_0x365701,_0xeea16e,_0x4caf48,_0x44e3e7){logger[_0xbf7f('0x2d')](_0xbf7f('0x52'));var _0x56f5aa={};_0x56f5aa[_0xbf7f('0x53')]={'name':!_['isNil'](_0x2d95f6[_0xbf7f('0x3f')][_0xbf7f('0x18')])&&!_[_0xbf7f('0x1c')](_0x2d95f6[_0xbf7f('0x35')]['name'])&&_0x2d95f6['profile']['name']===_0xbf7f('0x54')?_0x2d95f6[_0xbf7f('0x3f')][_0xbf7f('0x18')]:!_[_0xbf7f('0x1c')](_0x2d95f6[_0xbf7f('0x40')])?_0x2d95f6[_0xbf7f('0x40')]+'\x20'+_0x2d95f6[_0xbf7f('0x41')]:_0x2d95f6[_0xbf7f('0x41')],'id':_0x2d95f6['id']};_0x56f5aa[_0xbf7f('0x55')]=intUtil[_0xbf7f('0x56')](_0xeea16e[_0xbf7f('0x57')],_0x4caf48,'\x20');_0x56f5aa[_0xbf7f('0x58')]=intUtil[_0xbf7f('0x56')](_0xeea16e[_0xbf7f('0x59')],_0x4caf48,'\x0a');if(_0x365701[_0xbf7f('0x3b')]===_0xbf7f('0x4d')){_0x56f5aa[_0xbf7f('0x5a')]={'name':!_[_0xbf7f('0x1c')](_0x365701[_0xbf7f('0x5b')])?_0x365701[_0xbf7f('0x5b')]:!_[_0xbf7f('0x1c')](_0x365701['First_Name'])?_0x365701[_0xbf7f('0x5c')]+'\x20'+_0x365701[_0xbf7f('0x5d')]:_0x365701[_0xbf7f('0x5d')],'id':_0x365701['id']};}if(_0x365701[_0xbf7f('0x3b')]===_0xbf7f('0x4f')){_0x56f5aa[_0xbf7f('0x5e')]={'name':!_[_0xbf7f('0x1c')](_0x365701[_0xbf7f('0x5b')])?_0x365701[_0xbf7f('0x5b')]:!_[_0xbf7f('0x1c')](_0x365701[_0xbf7f('0x5c')])?_0x365701['First_Name']+'\x20'+_0x365701[_0xbf7f('0x5d')]:_0x365701[_0xbf7f('0x5d')],'id':_0x365701['id']};_0x56f5aa['$se_module']=_[_0xbf7f('0x3d')](_0x365701['enduserType']);}if(_0x4caf48[_0xbf7f('0x5f')]){_0x56f5aa[_0xbf7f('0x60')]=moment[_0xbf7f('0x61')](parseInt(_0x4caf48[_0xbf7f('0x5f')])*0x3e8)[_0xbf7f('0x30')](_0xbf7f('0x62'));}else if(_0x4caf48[_0xbf7f('0x63')]&&_0x4caf48[_0xbf7f('0x64')]){_0x56f5aa[_0xbf7f('0x60')]=moment['utc'](moment(_0x4caf48[_0xbf7f('0x64')],_0xbf7f('0x65'))[_0xbf7f('0x66')](moment(_0x4caf48[_0xbf7f('0x67')],'YYYY-MM-DDTHH:mm:ss')))[_0xbf7f('0x30')]('mm:ss');}switch(_0x4caf48[_0xbf7f('0x68')]){case'called':_0x56f5aa[_0xbf7f('0x69')]=_0xbf7f('0x6a');break;case _0xbf7f('0x6b'):case _0xbf7f('0x6c'):_0x56f5aa[_0xbf7f('0x69')]=_0xbf7f('0x6d');break;case'rejected':_0x56f5aa['Call_Result']=_0xbf7f('0x6e');break;case'abandoned':_0x56f5aa['Call_Result']=_0xbf7f('0x6f');break;case _0xbf7f('0x70'):_0x56f5aa[_0xbf7f('0x69')]=_0xbf7f('0x71');default:}_0x56f5aa[_0xbf7f('0x72')]=(_0x44e3e7==='outbound'?moment(_0x4caf48[_0xbf7f('0x67')])['format'](_0xbf7f('0x65')):moment(_0x4caf48[_0xbf7f('0x73')])['format'](_0xbf7f('0x65')))||moment()[_0xbf7f('0x30')](_0xbf7f('0x65'));_0x56f5aa[_0xbf7f('0x74')]=_0x44e3e7||_0xbf7f('0x75');_0x56f5aa=_[_0xbf7f('0x76')](_0x56f5aa,getCustomFields(_0xeea16e['Fields'],_0x4caf48));return request({'method':'POST','uri':_0xbf7f('0x3c')+_0x98c60b+'/crm/v2/Calls','headers':{'Authorization':_0xbf7f('0x42')+_0x58b532},'body':{'data':[_0x56f5aa]},'json':!![]})[_0xbf7f('0x29')](function(_0x3bced6){if(_0x3bced6&&_0x3bced6[_0xbf7f('0x43')][0x0][_0xbf7f('0x44')]===_0xbf7f('0x45')){logger[_0xbf7f('0x2d')](_0xbf7f('0x77'));return{'id':_0x3bced6[_0xbf7f('0x43')][0x0][_0xbf7f('0x46')]['id']};}})[_0xbf7f('0x3a')](function(_0x134da1){logger['info'](_0xbf7f('0x78'),_0x134da1[_0xbf7f('0x79')]);console[_0xbf7f('0x7a')](_0xbf7f('0x78'),_0x134da1);});}exports[_0xbf7f('0x7b')]=function(_0x362373,_0x1e4cce,_0x3ecacb,_0x552b4f,_0xec8199,_0x5a492f){var _0x3a6ee1,_0x344263,_0x103927;_0x5a492f[_0xbf7f('0x7c')]=intUtil['stripTrailingSlash'](_0x5a492f['host']);_0x5a492f[_0xbf7f('0x7d')]=intUtil[_0xbf7f('0x7e')](_0x5a492f[_0xbf7f('0x7d')]);if(_0xec8199&&_0xec8199[_0xbf7f('0x7f')]){logger['info'](_0xbf7f('0x80'),_0xbf7f('0x81'));_0x1e4cce[_0xbf7f('0x82')]=_0x5a492f[_0xbf7f('0x7d')]+_0xbf7f('0x83')+_0x1e4cce[_0xbf7f('0x84')]+_0xbf7f('0x85')+md5(_0x1e4cce[_0xbf7f('0x84')]);}else{_0x1e4cce[_0xbf7f('0x82')]='';}var _0x5ef119=_0x5a492f['host']===_0xbf7f('0x86')?'eu':_0xbf7f('0x87');return getAccessToken(_0x5a492f)['then'](function(_0x396013){_0x103927=_0x396013;return getUser(_0x103927,_0x5ef119,_0x5a492f,_0x552b4f[_0xbf7f('0x88')]);})[_0xbf7f('0x29')](function(_0x5290bd){_0x3a6ee1=_0x5290bd;logger[_0xbf7f('0x2d')](_0xbf7f('0x89'),_0x3a6ee1['id']);return getEndUser(_0x103927,_0x5ef119,_0x5a492f,_0x1e4cce[_0xbf7f('0x8a')],_0x1e4cce[_0xbf7f('0x8b')],_0x3a6ee1,_0x3ecacb);})['then'](function(_0x50bc6f){_0x344263=_0x50bc6f;return getCall(_0x103927,_0x5ef119,_0x5a492f,_0x3a6ee1,_0x344263,_0x3ecacb,_0x1e4cce,_0xbf7f('0x75'));})[_0xbf7f('0x29')](function(_0xb4fcc2){if(_0xb4fcc2){logger['info'](_0xbf7f('0x8c'),_0xb4fcc2['id']);logger[_0xbf7f('0x2d')](_0xbf7f('0x80'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbf7f('0x30')](_0xbf7f('0x8d'),_0x552b4f[_0xbf7f('0x18')]),_0xbf7f('0x8e'),{'uri':'https://crm.'+_0x5a492f[_0xbf7f('0x7c')]+'/crm/EntityInfo.do?module=Calls&id='+_0xb4fcc2['id']});}})[_0xbf7f('0x3a')](function(_0x152e0c){logger[_0xbf7f('0x2b')](_0xbf7f('0x80'),JSON[_0xbf7f('0xd')](_0x152e0c));});};exports['outbound']=function(_0x439281,_0x496566,_0x83bc97,_0x324bef,_0x1687de,_0x1b1f57,_0x19a202){var _0x1a1fdc,_0x11159f,_0x375ca8;_0x1b1f57[_0xbf7f('0x7c')]=intUtil[_0xbf7f('0x7e')](_0x1b1f57[_0xbf7f('0x7c')]);_0x1b1f57[_0xbf7f('0x7d')]=intUtil[_0xbf7f('0x7e')](_0x1b1f57[_0xbf7f('0x7d')]);if(_0x19a202&&_0x19a202[_0xbf7f('0x8f')]&&_0x19a202[_0xbf7f('0x8f')]!==_0xbf7f('0x90')){logger['info']('[OUTBOUND]',_0xbf7f('0x81'));_0x496566[_0xbf7f('0x82')]=_0x1b1f57['serverUrl']+_0xbf7f('0x83')+_0x496566[_0xbf7f('0x84')]+_0xbf7f('0x85')+md5(_0x496566[_0xbf7f('0x84')]);}var _0x118681=_0x1b1f57['host']==='zoho.eu'?'eu':'com';return getAccessToken(_0x1b1f57)[_0xbf7f('0x29')](function(_0x353b36){_0x375ca8=_0x353b36;return getUser(_0x375ca8,_0x118681,_0x1b1f57,_0x324bef['email']);})[_0xbf7f('0x29')](function(_0xd8cad6){_0x1a1fdc=_0xd8cad6;logger['info'](_0xbf7f('0x89'),_0x1a1fdc['id']);return getEndUser(_0x375ca8,_0x118681,_0x1b1f57,_0x496566[_0xbf7f('0x91')],_0x496566[_0xbf7f('0x92')],_0x1a1fdc,_0x83bc97);})['then'](function(_0x316ae5){_0x11159f=_0x316ae5;return getCall(_0x375ca8,_0x118681,_0x1b1f57,_0x1a1fdc,_0x11159f,_0x83bc97,_0x496566,_0xbf7f('0x93'));})['then'](function(_0x1b13c5){if(_0x1b13c5){logger[_0xbf7f('0x2d')](_0xbf7f('0x8c'),_0x1b13c5['id']);logger['info'](_0xbf7f('0x94'),_0xbf7f('0x95'));emit(util[_0xbf7f('0x30')](_0xbf7f('0x8d'),_0x324bef[_0xbf7f('0x18')]),_0xbf7f('0x8e'),{'uri':_0xbf7f('0x96')+_0x1b1f57[_0xbf7f('0x7c')]+_0xbf7f('0x97')+_0x1b13c5['id']});}})['catch'](function(_0x3c41b7){logger[_0xbf7f('0x2b')](_0xbf7f('0x94'),JSON['stringify'](_0x3c41b7));});};exports['unmanaged']=function(_0x4f0c2e,_0x45485a,_0x3f005a,_0x221f99,_0x434e29,_0x1a610d){var _0x3e152a,_0xa35dbb,_0x2b575e;_0x1a610d[_0xbf7f('0x7c')]=intUtil['stripTrailingSlash'](_0x1a610d['host']);_0x1a610d[_0xbf7f('0x7d')]=intUtil[_0xbf7f('0x7e')](_0x1a610d['serverUrl']);if(_0x434e29&&_0x434e29[_0xbf7f('0x7f')]){logger[_0xbf7f('0x2d')]('['+_0x45485a[_0xbf7f('0x68')][_0xbf7f('0x98')]()+']','Recording\x20is\x20enabled!');_0x45485a['recordingURL']=_0x1a610d['serverUrl']+'/api/voice/recordings/'+_0x45485a[_0xbf7f('0x84')]+_0xbf7f('0x85')+md5(_0x45485a[_0xbf7f('0x84')]);}else{_0x45485a['recordingURL']='';}var _0x1f0e93=_0x1a610d[_0xbf7f('0x7c')]===_0xbf7f('0x86')?'eu':_0xbf7f('0x87');return getAccessToken(_0x1a610d)['then'](function(_0x1d73f6){_0x2b575e=_0x1d73f6;return getUser(_0x2b575e,_0x1f0e93,_0x1a610d);})[_0xbf7f('0x29')](function(_0x3745fc){_0x3e152a=_0x3745fc;logger['info'](_0xbf7f('0x89'),_0x3e152a['id']);return getEndUser(_0x2b575e,_0x1f0e93,_0x1a610d,_0x45485a[_0xbf7f('0x8a')],_0x45485a[_0xbf7f('0x8b')],_0x3e152a,_0x3f005a);})[_0xbf7f('0x29')](function(_0x138f59){_0xa35dbb=_0x138f59;return getCall(_0x2b575e,_0x1f0e93,_0x1a610d,_0x3e152a,_0xa35dbb,_0x3f005a,_0x45485a,'Inbound');})[_0xbf7f('0x29')](function(_0x301adb){if(_0x301adb){logger[_0xbf7f('0x2d')](_0xbf7f('0x8c'),_0x301adb['id']);}})[_0xbf7f('0x3a')](function(_0x3bd88e){logger[_0xbf7f('0x2b')]('['+_0x45485a[_0xbf7f('0x68')]['toUpperCase']()+']',JSON[_0xbf7f('0xd')](_0x3bd88e));});}; \ No newline at end of file +var _0xf274=['toUpperCase','zoho.eu','calleridname','request-promise','md5','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','refreshToken','clientId','refresh_token','then','add','seconds','catch','error','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','isArrayLikeObject','users','findIndex','info','Using\x20the\x20admin\x20account!','profile','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','SUCCESS','details','Error:\x20','log','moduleSearch','contact_lead','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','administrator','Subject','getString','Subjects','Description','Descriptions','Full_Name','Last_Name','What_Id','First_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Answered','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','Fields','/crm/v2/Calls','code','Call\x20created!','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','recordingURL','com','email','The\x20User\x20ID\x20is:','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','The\x20Call\x20ID\x20is:','user:%s','unmanaged'];(function(_0x26309f,_0x9f9f8f){var _0x46d396=function(_0x4ba96f){while(--_0x4ba96f){_0x26309f['push'](_0x26309f['shift']());}};_0x46d396(++_0x9f9f8f);}(_0xf274,0x99));var _0x4f27=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xf274[_0x8a969d];return _0x1d8dc7;};'use strict';var _=require('lodash');var rp=require(_0x4f27('0x0'));var md5=require(_0x4f27('0x1'));var util=require(_0x4f27('0x2'));var intUtil=require(_0x4f27('0x3'));var moment=require(_0x4f27('0x4'));var Redis=require(_0x4f27('0x5'));var BPromise=require('bluebird');var config=require(_0x4f27('0x6'));var logger=require(_0x4f27('0x7'))(_0x4f27('0x8'));config[_0x4f27('0x9')]=_[_0x4f27('0xa')](config['redis'],{'host':_0x4f27('0xb'),'port':0x18eb});var io=require(_0x4f27('0xc'))(new Redis(config[_0x4f27('0x9')]));function emit(_0x1f603a,_0x31dfc0,_0x247735){io['to'](_0x1f603a)[_0x4f27('0xd')](_0x31dfc0,_0x247735);}function request(_0x482256){logger['debug'](_0x4f27('0xe'),JSON[_0x4f27('0xf')](_0x482256));return rp(_0x482256);}function getCustomFields(_0x4f4640,_0x211294){var _0x3f07d9={};if(_0x4f4640[_0x4f27('0x10')]>0x0){_[_0x4f27('0x11')](_0x4f4640,function(_0x569620){if(_0x569620[_0x4f27('0x12')]===_0x4f27('0x13')&&_0x569620[_0x4f27('0x14')]){_0x3f07d9[_0x569620['idField']]=_0x569620[_0x4f27('0x15')][_0x4f27('0x16')]();}else if(_0x569620[_0x4f27('0x12')]===_0x4f27('0x17')&&_0x569620[_0x4f27('0x18')]&&_0x569620[_0x4f27('0x14')]&&_0x211294[_0x569620[_0x4f27('0x18')]]){_0x3f07d9[_0x569620[_0x4f27('0x14')]]=_0x211294[_0x569620[_0x4f27('0x18')]][_0x4f27('0x16')]();}else if(_0x569620[_0x4f27('0x12')]===_0x4f27('0x19')&&_0x569620[_0x4f27('0x1a')]&&_0x569620['Variable'][_0x4f27('0x1b')]&&_0x569620['idField']&&_0x211294[_0x569620[_0x4f27('0x1a')][_0x4f27('0x1b')][_0x4f27('0x1c')]()]){_0x3f07d9[_0x569620[_0x4f27('0x14')]]=_0x211294[_0x569620[_0x4f27('0x1a')][_0x4f27('0x1b')][_0x4f27('0x1c')]()]['toString']();}});}return _0x3f07d9;}function getName(_0x258e80){if(_0x258e80['indexOf']('\x20')>0x0){var _0x37740c=_0x258e80[_0x4f27('0x1d')](/ (.+)/);if(_0x37740c[0x1]){return _0x37740c;}}return[_0x258e80,_0x258e80];}var accountsTokens={};function getAccessToken(_0x6cb587){return new Promise(function(_0x426ac7,_0x57c89f){if(!_[_0x4f27('0x1e')](accountsTokens[_0x6cb587['id']])&&!_[_0x4f27('0x1e')](accountsTokens[_0x6cb587['id']][_0x4f27('0x1f')])){if(moment()[_0x4f27('0x20')](accountsTokens[_0x6cb587['id']][_0x4f27('0x21')])){_0x426ac7(accountsTokens[_0x6cb587['id']][_0x4f27('0x1f')]);}}var _0x500f38;switch(_0x6cb587[_0x4f27('0x22')]){case'US':_0x500f38=_0x4f27('0x23');break;case'AU':_0x500f38='https://accounts.zoho.com.au';break;case'EU':_0x500f38=_0x4f27('0x24');break;case'IN':_0x500f38='https://accounts.zoho.in';break;case'CN':_0x500f38=_0x4f27('0x25');break;default:_0x500f38=_0x4f27('0x24');break;}var _0x3aa1d0={'method':_0x4f27('0x26'),'uri':_0x500f38+'/oauth/v2/token','qs':{'refresh_token':_0x6cb587[_0x4f27('0x27')],'client_id':_0x6cb587[_0x4f27('0x28')],'client_secret':_0x6cb587['clientSecret'],'grant_type':_0x4f27('0x29')},'json':!![]};return rp(_0x3aa1d0)[_0x4f27('0x2a')](function(_0x219bcf){accountsTokens[_0x6cb587['id']]={'access_token':_0x219bcf['access_token'],'expires_in':moment()[_0x4f27('0x2b')](_0x219bcf['expires_in'],_0x4f27('0x2c'))};_0x426ac7(_0x219bcf['access_token']);})[_0x4f27('0x2d')](function(_0x5c7304){logger[_0x4f27('0x2e')]('Failing\x20creating\x20the\x20access_token',_0x5c7304['stack']);_0x57c89f(_0x5c7304);});});}function getUser(_0x31917e,_0x190999,_0x5277d0,_0x36d787){logger['info'](_0x4f27('0x2f'));return request({'method':_0x4f27('0x30'),'uri':util[_0x4f27('0x31')](_0x4f27('0x32'),_0x190999),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x31917e},'json':!![]})[_0x4f27('0x2a')](function(_0x1ddb26){if(_0x1ddb26['users']){var _0x5cbdde=-0x1;if(_[_0x4f27('0x33')](_0x1ddb26[_0x4f27('0x34')])){if(!_[_0x4f27('0x1e')](_0x36d787)){_0x5cbdde=_[_0x4f27('0x35')](_0x1ddb26['users'],function(_0x4886b9){return _0x4886b9['email']===_0x36d787;});}if(_0x5cbdde>=0x0){logger[_0x4f27('0x36')]('Agent\x20found!');}else{logger['info'](_0x4f27('0x37'));_0x5cbdde=_[_0x4f27('0x35')](_0x1ddb26[_0x4f27('0x34')],function(_0x3448b5){return _0x3448b5[_0x4f27('0x38')][_0x4f27('0x1b')]==='Administrator';});}return _0x1ddb26[_0x4f27('0x34')][_0x5cbdde];}else{if(_0x1ddb26[_0x4f27('0x39')][_0x4f27('0x38')][_0x4f27('0x1b')]==='Administrator'){logger['info'](_0x4f27('0x37'));user=_0x1ddb26[_0x4f27('0x39')];return user;}else{logger[_0x4f27('0x2e')](_0x4f27('0x3a'),JSON[_0x4f27('0xf')](_0x1ddb26));throw new Error(_0x4f27('0x3b')+JSON[_0x4f27('0xf')](_0x1ddb26));}}}else{logger['error'](_0x4f27('0x3a'),JSON[_0x4f27('0xf')](_0x1ddb26));throw new Error(_0x4f27('0x3b')+JSON[_0x4f27('0xf')](_0x1ddb26));}})[_0x4f27('0x2d')](function(_0x3aa5b2){console['error'](_0x3aa5b2);});}function getZohoUser(_0x5bb394,_0x5afea9){return new BPromise(function(_0x4f1692,_0xde6094){request(_0x5bb394)[_0x4f27('0x2a')](function(_0x161f46){var _0x9db4d8=null;if(_0x161f46){_0x9db4d8=_0x161f46[_0x4f27('0x3c')][0x0];_0x9db4d8[_0x4f27('0x3d')]=_0x5afea9;}_0x4f1692(_0x9db4d8);})[_0x4f27('0x2d')](function(_0x49ece4){_0xde6094(_0x49ece4);});});}function createEndUser(_0x439c02,_0x38c7f1,_0x54ac87,_0x45249a,_0x3ef392,_0x2fb748){var _0x54ac87=getName(_0x54ac87);return request({'method':_0x4f27('0x26'),'uri':'https://www.zohoapis.'+_0x38c7f1+_0x4f27('0x3e')+_[_0x4f27('0x3f')](_0x2fb748[_0x4f27('0x40')])+'s','body':{'data':[{'Last_Name':_0x54ac87[0x1],'First_Name':_0x54ac87[0x0],'Phone':_0x45249a,'Owner':{'name':!_[_0x4f27('0x1e')](_0x3ef392[_0x4f27('0x41')][_0x4f27('0x1b')])?_0x3ef392['role'][_0x4f27('0x1b')]:!_['isNil'](_0x3ef392[_0x4f27('0x42')])?_0x3ef392[_0x4f27('0x42')]+'\x20'+_0x3ef392[_0x4f27('0x43')]:_0x3ef392[_0x4f27('0x43')],'id':_0x3ef392['id']}}]},'headers':{'Authorization':_0x4f27('0x44')+_0x439c02},'json':!![]})['then'](function(_0x463819){if(_0x463819&&_0x463819[_0x4f27('0x3c')][0x0]['code']===_0x4f27('0x45')){var _0x44f340=_0x463819[_0x4f27('0x3c')][0x0][_0x4f27('0x46')];_0x44f340[_0x4f27('0x3d')]=_[_0x4f27('0x3f')](_0x2fb748[_0x4f27('0x40')])+'s';return _0x44f340;}logger[_0x4f27('0x2e')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0x4f27('0x47')+JSON['stringify'](data));})[_0x4f27('0x2d')](function(_0x156a5b){console[_0x4f27('0x48')]('CREATE\x20ERROR',_0x156a5b);});}function getEndUser(_0x5d0f71,_0x80dc5e,_0x5690f2,_0x534eec,_0x496ac9,_0x3115bc,_0x2ef500){var _0x2267a4={'method':_0x4f27('0x30'),'uri':'','headers':{'Authorization':_0x4f27('0x44')+_0x5d0f71},'json':!![]};switch(_0x2ef500[_0x4f27('0x49')]){case _0x4f27('0x4a'):_0x2267a4['uri']=_0x4f27('0x4b')+_0x80dc5e+_0x4f27('0x4c')+_0x496ac9+'))';return getZohoUser(_0x2267a4,_0x4f27('0x4d'))['then'](function(_0x2c68b8){if(_0x2c68b8)return _0x2c68b8;_0x2267a4[_0x4f27('0x4e')]=_0x4f27('0x4b')+_0x80dc5e+_0x4f27('0x4f')+_0x496ac9+'))';return getZohoUser(_0x2267a4,_0x4f27('0x50'))[_0x4f27('0x2a')](function(_0x436c83){if(_0x436c83)return _0x436c83;if(_0x2ef500[_0x4f27('0x40')]!=_0x4f27('0x51')){return createEndUser(_0x5d0f71,_0x80dc5e,_0x534eec,_0x496ac9,_0x3115bc,_0x2ef500);}else{return{};}});});break;case _0x4f27('0x52'):_0x2267a4['uri']=_0x4f27('0x4b')+_0x80dc5e+_0x4f27('0x4c')+_0x496ac9+'))';return getZohoUser(_0x2267a4,_0x4f27('0x4d'))[_0x4f27('0x2a')](function(_0x3b2e20){if(_0x3b2e20)return _0x3b2e20;if(_0x2ef500[_0x4f27('0x40')]!=_0x4f27('0x51')){return createEndUser(_0x5d0f71,_0x80dc5e,_0x534eec,_0x496ac9,_0x3115bc,_0x2ef500);}else{return{};}});break;case'lead':_0x2267a4['uri']=_0x4f27('0x4b')+_0x80dc5e+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x496ac9+'))';return getZohoUser(_0x2267a4,_0x4f27('0x50'))[_0x4f27('0x2a')](function(_0xbbdd44){if(_0xbbdd44)return _0xbbdd44;if(_0x2ef500[_0x4f27('0x40')]!=_0x4f27('0x51')){return createEndUser(_0x5d0f71,_0x80dc5e,_0x534eec,_0x496ac9,_0x3115bc,_0x2ef500);}else{return{};}});break;}}function getCall(_0x54bfb5,_0x212a68,_0x3a8146,_0x237ece,_0x471b4a,_0x457dbb,_0x1f4427,_0x21edb1){logger[_0x4f27('0x36')]('Creating\x20new\x20call...');var _0x5aa339={};_0x5aa339['Owner']={'name':!_[_0x4f27('0x1e')](_0x237ece[_0x4f27('0x41')]['name'])&&!_[_0x4f27('0x1e')](_0x237ece[_0x4f27('0x38')][_0x4f27('0x1b')])&&_0x237ece[_0x4f27('0x38')]['name']===_0x4f27('0x53')?_0x237ece[_0x4f27('0x41')][_0x4f27('0x1b')]:!_['isNil'](_0x237ece[_0x4f27('0x42')])?_0x237ece['first_name']+'\x20'+_0x237ece[_0x4f27('0x43')]:_0x237ece[_0x4f27('0x43')],'id':_0x237ece['id']};_0x5aa339[_0x4f27('0x54')]=intUtil[_0x4f27('0x55')](_0x457dbb[_0x4f27('0x56')],_0x1f4427,'\x20');_0x5aa339[_0x4f27('0x57')]=intUtil[_0x4f27('0x55')](_0x457dbb[_0x4f27('0x58')],_0x1f4427,'\x0a');if(_0x471b4a[_0x4f27('0x3d')]==='Contacts'){_0x5aa339['Who_Id']={'name':!_[_0x4f27('0x1e')](_0x471b4a['Full_Name'])?_0x471b4a[_0x4f27('0x59')]:!_[_0x4f27('0x1e')](_0x471b4a['First_Name'])?_0x471b4a['First_Name']+'\x20'+_0x471b4a['Last_Name']:_0x471b4a[_0x4f27('0x5a')],'id':_0x471b4a['id']};}if(_0x471b4a['enduserType']==='Leads'){_0x5aa339[_0x4f27('0x5b')]={'name':!_[_0x4f27('0x1e')](_0x471b4a[_0x4f27('0x59')])?_0x471b4a[_0x4f27('0x59')]:!_[_0x4f27('0x1e')](_0x471b4a[_0x4f27('0x5c')])?_0x471b4a[_0x4f27('0x5c')]+'\x20'+_0x471b4a['Last_Name']:_0x471b4a[_0x4f27('0x5a')],'id':_0x471b4a['id']};_0x5aa339[_0x4f27('0x5d')]=_[_0x4f27('0x3f')](_0x471b4a[_0x4f27('0x3d')]);}if(_0x1f4427[_0x4f27('0x5e')]){_0x5aa339[_0x4f27('0x5f')]=moment[_0x4f27('0x60')](parseInt(_0x1f4427[_0x4f27('0x5e')])*0x3e8)['format'](_0x4f27('0x61'));}else if(_0x1f4427[_0x4f27('0x62')]&&_0x1f4427[_0x4f27('0x63')]){_0x5aa339[_0x4f27('0x5f')]=moment[_0x4f27('0x60')](moment(_0x1f4427[_0x4f27('0x63')],_0x4f27('0x64'))[_0x4f27('0x65')](moment(_0x1f4427[_0x4f27('0x66')],_0x4f27('0x64'))))[_0x4f27('0x31')](_0x4f27('0x61'));}switch(_0x1f4427[_0x4f27('0x67')]){case _0x4f27('0x68'):_0x5aa339[_0x4f27('0x69')]='Called';break;case'complete':case'connect':_0x5aa339['Call_Result']=_0x4f27('0x6a');break;case _0x4f27('0x6b'):_0x5aa339['Call_Result']=_0x4f27('0x6c');break;case _0x4f27('0x6d'):_0x5aa339[_0x4f27('0x69')]='Abandoned';break;case _0x4f27('0x6e'):_0x5aa339['Call_Result']=_0x4f27('0x6f');default:}_0x5aa339[_0x4f27('0x70')]=(_0x21edb1===_0x4f27('0x71')?moment(_0x1f4427[_0x4f27('0x66')])[_0x4f27('0x31')](_0x4f27('0x64')):moment(_0x1f4427[_0x4f27('0x72')])[_0x4f27('0x31')](_0x4f27('0x64')))||moment()['format'](_0x4f27('0x64'));_0x5aa339['Call_Type']=_0x21edb1||_0x4f27('0x73');_0x5aa339=_['merge'](_0x5aa339,getCustomFields(_0x457dbb[_0x4f27('0x74')],_0x1f4427));return request({'method':_0x4f27('0x26'),'uri':_0x4f27('0x4b')+_0x212a68+_0x4f27('0x75'),'headers':{'Authorization':_0x4f27('0x44')+_0x54bfb5},'body':{'data':[_0x5aa339]},'json':!![]})[_0x4f27('0x2a')](function(_0x3bffed){if(_0x3bffed&&_0x3bffed['data'][0x0][_0x4f27('0x76')]===_0x4f27('0x45')){logger[_0x4f27('0x36')](_0x4f27('0x77'));return{'id':_0x3bffed[_0x4f27('0x3c')][0x0]['details']['id']};}})[_0x4f27('0x2d')](function(_0x3634de){logger[_0x4f27('0x36')](_0x4f27('0x78'),_0x3634de[_0x4f27('0x79')]);console[_0x4f27('0x48')](_0x4f27('0x78'),_0x3634de);});}exports[_0x4f27('0x7a')]=function(_0x270ddc,_0x48414c,_0x3431bb,_0x3868cd,_0x1b4b72,_0x27f795){var _0x1008e7,_0x2a8c47,_0xa2e834;_0x27f795[_0x4f27('0x7b')]=intUtil['stripTrailingSlash'](_0x27f795[_0x4f27('0x7b')]);_0x27f795['serverUrl']=intUtil[_0x4f27('0x7c')](_0x27f795[_0x4f27('0x7d')]);if(_0x1b4b72&&_0x1b4b72[_0x4f27('0x7e')]){logger[_0x4f27('0x36')](_0x4f27('0x7f'),_0x4f27('0x80'));_0x48414c['recordingURL']=_0x27f795[_0x4f27('0x7d')]+_0x4f27('0x81')+_0x48414c[_0x4f27('0x82')]+'/downloads?type=uniqueid&token='+md5(_0x48414c[_0x4f27('0x82')]);}else{_0x48414c[_0x4f27('0x83')]='';}var _0x183c4b=_0x27f795['host']==='zoho.eu'?'eu':_0x4f27('0x84');return getAccessToken(_0x27f795)['then'](function(_0x19e7cc){_0xa2e834=_0x19e7cc;return getUser(_0xa2e834,_0x183c4b,_0x27f795,_0x3868cd[_0x4f27('0x85')]);})['then'](function(_0x2a9669){_0x1008e7=_0x2a9669;logger[_0x4f27('0x36')](_0x4f27('0x86'),_0x1008e7['id']);return getEndUser(_0xa2e834,_0x183c4b,_0x27f795,_0x48414c['calleridname'],_0x48414c[_0x4f27('0x87')],_0x1008e7,_0x3431bb);})[_0x4f27('0x2a')](function(_0x47f365){_0x2a8c47=_0x47f365;return getCall(_0xa2e834,_0x183c4b,_0x27f795,_0x1008e7,_0x2a8c47,_0x3431bb,_0x48414c,_0x4f27('0x73'));})['then'](function(_0x1a5d1d){if(_0x1a5d1d){logger[_0x4f27('0x36')]('The\x20Call\x20ID\x20is:',_0x1a5d1d['id']);logger[_0x4f27('0x36')](_0x4f27('0x7f'),_0x4f27('0x88'));emit(util[_0x4f27('0x31')]('user:%s',_0x3868cd[_0x4f27('0x1b')]),'trigger:browser:url',{'uri':_0x4f27('0x89')+_0x27f795[_0x4f27('0x7b')]+_0x4f27('0x8a')+_0x1a5d1d['id']});}})[_0x4f27('0x2d')](function(_0x46f0e3){logger[_0x4f27('0x2e')](_0x4f27('0x7f'),JSON[_0x4f27('0xf')](_0x46f0e3));});};exports['outbound']=function(_0x37b5e1,_0xcbea83,_0x5d0800,_0x435614,_0x577316,_0x84b4c0,_0x395585){var _0x4696ff,_0x448c6d,_0x48aa8b;_0x84b4c0[_0x4f27('0x7b')]=intUtil[_0x4f27('0x7c')](_0x84b4c0[_0x4f27('0x7b')]);_0x84b4c0[_0x4f27('0x7d')]=intUtil[_0x4f27('0x7c')](_0x84b4c0['serverUrl']);if(_0x395585&&_0x395585[_0x4f27('0x8b')]&&_0x395585[_0x4f27('0x8b')]!==_0x4f27('0x8c')){logger[_0x4f27('0x36')]('[OUTBOUND]',_0x4f27('0x80'));_0xcbea83[_0x4f27('0x83')]=_0x84b4c0[_0x4f27('0x7d')]+'/api/voice/recordings/'+_0xcbea83['uniqueid']+_0x4f27('0x8d')+md5(_0xcbea83[_0x4f27('0x82')]);}var _0x4a1033=_0x84b4c0[_0x4f27('0x7b')]==='zoho.eu'?'eu':_0x4f27('0x84');return getAccessToken(_0x84b4c0)['then'](function(_0x1b2e71){_0x48aa8b=_0x1b2e71;return getUser(_0x48aa8b,_0x4a1033,_0x84b4c0,_0x435614[_0x4f27('0x85')]);})[_0x4f27('0x2a')](function(_0x465cd8){_0x4696ff=_0x465cd8;logger[_0x4f27('0x36')](_0x4f27('0x86'),_0x4696ff['id']);return getEndUser(_0x48aa8b,_0x4a1033,_0x84b4c0,_0xcbea83[_0x4f27('0x8e')],_0xcbea83[_0x4f27('0x8f')],_0x4696ff,_0x5d0800);})[_0x4f27('0x2a')](function(_0x4489af){_0x448c6d=_0x4489af;return getCall(_0x48aa8b,_0x4a1033,_0x84b4c0,_0x4696ff,_0x448c6d,_0x5d0800,_0xcbea83,'Outbound');})['then'](function(_0xff5fde){if(_0xff5fde){logger['info'](_0x4f27('0x90'),_0xff5fde['id']);logger[_0x4f27('0x36')]('[OUTBOUND]',_0x4f27('0x88'));emit(util[_0x4f27('0x31')](_0x4f27('0x91'),_0x435614['name']),'trigger:browser:url',{'uri':'https://crm.'+_0x84b4c0[_0x4f27('0x7b')]+_0x4f27('0x8a')+_0xff5fde['id']});}})[_0x4f27('0x2d')](function(_0x130a17){logger[_0x4f27('0x2e')]('[OUTBOUND]',JSON[_0x4f27('0xf')](_0x130a17));});};exports[_0x4f27('0x92')]=function(_0x158dc2,_0x2816e2,_0x474990,_0x315273,_0x947eff,_0x49fe24){var _0x200f02,_0x24a436,_0x13c116;_0x49fe24[_0x4f27('0x7b')]=intUtil[_0x4f27('0x7c')](_0x49fe24[_0x4f27('0x7b')]);_0x49fe24[_0x4f27('0x7d')]=intUtil[_0x4f27('0x7c')](_0x49fe24[_0x4f27('0x7d')]);if(_0x947eff&&_0x947eff[_0x4f27('0x7e')]){logger[_0x4f27('0x36')]('['+_0x2816e2['lastevent'][_0x4f27('0x93')]()+']',_0x4f27('0x80'));_0x2816e2['recordingURL']=_0x49fe24[_0x4f27('0x7d')]+'/api/voice/recordings/'+_0x2816e2[_0x4f27('0x82')]+_0x4f27('0x8d')+md5(_0x2816e2[_0x4f27('0x82')]);}else{_0x2816e2[_0x4f27('0x83')]='';}var _0x196cb8=_0x49fe24[_0x4f27('0x7b')]===_0x4f27('0x94')?'eu':'com';return getAccessToken(_0x49fe24)[_0x4f27('0x2a')](function(_0x3ea440){_0x13c116=_0x3ea440;return getUser(_0x13c116,_0x196cb8,_0x49fe24);})[_0x4f27('0x2a')](function(_0x4ab745){_0x200f02=_0x4ab745;logger[_0x4f27('0x36')](_0x4f27('0x86'),_0x200f02['id']);return getEndUser(_0x13c116,_0x196cb8,_0x49fe24,_0x2816e2[_0x4f27('0x95')],_0x2816e2['calleridnum'],_0x200f02,_0x474990);})[_0x4f27('0x2a')](function(_0x43eb9f){_0x24a436=_0x43eb9f;return getCall(_0x13c116,_0x196cb8,_0x49fe24,_0x200f02,_0x24a436,_0x474990,_0x2816e2,_0x4f27('0x73'));})[_0x4f27('0x2a')](function(_0x5e60c3){if(_0x5e60c3){logger[_0x4f27('0x36')]('The\x20Call\x20ID\x20is:',_0x5e60c3['id']);}})[_0x4f27('0x2d')](function(_0x2b0865){logger['error']('['+_0x2816e2[_0x4f27('0x67')][_0x4f27('0x93')]()+']',JSON[_0x4f27('0xf')](_0x2b0865));});}; \ 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 774cc4d..35e3793 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(_0x1d9eb7,_0x580fa7){var _0x1e2c02=function(_0x26c424){while(--_0x26c424){_0x1d9eb7['push'](_0x1d9eb7['shift']());}};_0x1e2c02(++_0x580fa7);}(_0x7a54,0x106));var _0x47a5=function(_0x5a0f1a,_0x27f822){_0x5a0f1a=_0x5a0f1a-0x0;var _0x16b411=_0x7a54[_0x5a0f1a];return _0x16b411;};'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(_0x15ace6,_0x20c9b8){var _0x2da5f6=function(_0x1e116e){while(--_0x1e116e){_0x15ace6['push'](_0x15ace6['shift']());}};_0x2da5f6(++_0x20c9b8);}(_0x7a54,0x106));var _0x47a5=function(_0x40f693,_0x90e516){_0x40f693=_0x40f693-0x0;var _0x3a4914=_0x7a54[_0x40f693];return _0x3a4914;};'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 43b3f43..a309331 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x31c4cb,_0x41204f){var _0x5280c2=function(_0x301a1e){while(--_0x301a1e){_0x31c4cb['push'](_0x31c4cb['shift']());}};_0x5280c2(++_0x41204f);}(_0x7a54,0x106));var _0x47a5=function(_0x11e34c,_0x332640){_0x11e34c=_0x11e34c-0x0;var _0x12b933=_0x7a54[_0x11e34c];return _0x12b933;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file +var _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(_0x385ae8,_0x58e703){var _0x5cb09d=function(_0x17bc81){while(--_0x17bc81){_0x385ae8['push'](_0x385ae8['shift']());}};_0x5cb09d(++_0x58e703);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1c62b4,_0x318934){_0x1c62b4=_0x1c62b4-0x0;var _0x3cbb5f=_0x5f2f[_0x1c62b4];return _0x3cbb5f;};'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 132932b..9712252 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 _0xe14b=['error','message','catch','exports','jayson/promise','bluebird','client','http','request','then','debug','rpc','routing'];(function(_0x493357,_0x188840){var _0x13f962=function(_0x5632ee){while(--_0x5632ee){_0x493357['push'](_0x493357['shift']());}};_0x13f962(++_0x188840);}(_0xe14b,0x93));var _0xbe14=function(_0x15ad2f,_0x3eed9){_0x15ad2f=_0x15ad2f-0x0;var _0x60a51a=_0xe14b[_0x15ad2f];return _0x60a51a;};'use strict';var jayson=require(_0xbe14('0x0'));var BPromise=require(_0xbe14('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0xbe14('0x2')][_0xbe14('0x3')]({'port':0x2329});client['Request']=function(_0x7d3665,_0x5ce8fb){return new BPromise(function(_0x496c04,_0x1833e3){return client[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb)[_0xbe14('0x5')](function(_0x1ff100){logger[_0xbe14('0x6')](_0xbe14('0x7'),_0xbe14('0x8'),_0x7d3665,_0x5ce8fb,_0x1ff100);if(_0x1ff100['error']){logger['error']('rpc',_0xbe14('0x8'),_0x7d3665,_0x1ff100[_0xbe14('0x9')][_0xbe14('0xa')],_0x5ce8fb);return _0x1833e3(_0x1ff100[_0xbe14('0x9')]['message']);}else{return _0x496c04(_0x1ff100['result']);}})[_0xbe14('0xb')](function(_0x3f70cb){logger['error'](_0xbe14('0x7'),_0xbe14('0x8'),_0x7d3665,_0x3f70cb,_0x5ce8fb);return _0x1833e3(_0x3f70cb);});});};module[_0xbe14('0xc')]=client; \ No newline at end of file +var _0x55ca=['jayson/promise','bluebird','http','Request','request','then','debug','routing','error','rpc','message','result','catch','exports'];(function(_0x1c510a,_0x1413a9){var _0x23cedd=function(_0x3f3e43){while(--_0x3f3e43){_0x1c510a['push'](_0x1c510a['shift']());}};_0x23cedd(++_0x1413a9);}(_0x55ca,0x126));var _0xa55c=function(_0x22a8c4,_0x51c09a){_0x22a8c4=_0x22a8c4-0x0;var _0x104c6d=_0x55ca[_0x22a8c4];return _0x104c6d;};'use strict';var jayson=require(_0xa55c('0x0'));var BPromise=require(_0xa55c('0x1'));var logger=require('../../config/logger')('routing');var client=jayson['client'][_0xa55c('0x2')]({'port':0x2329});client[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return new BPromise(function(_0x2db02a,_0xcb02e3){return client[_0xa55c('0x4')](_0x5dc716,_0x3b478a)[_0xa55c('0x5')](function(_0x279caa){logger[_0xa55c('0x6')]('rpc',_0xa55c('0x7'),_0x5dc716,_0x3b478a,_0x279caa);if(_0x279caa[_0xa55c('0x8')]){logger['error'](_0xa55c('0x9'),_0xa55c('0x7'),_0x5dc716,_0x279caa['error']['message'],_0x3b478a);return _0xcb02e3(_0x279caa[_0xa55c('0x8')][_0xa55c('0xa')]);}else{return _0x2db02a(_0x279caa[_0xa55c('0xb')]);}})[_0xa55c('0xc')](function(_0x31646d){logger[_0xa55c('0x8')](_0xa55c('0x9'),_0xa55c('0x7'),_0x5dc716,_0x31646d,_0x3b478a);return _0xcb02e3(_0x31646d);});});};module[_0xa55c('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 2ec0372..a9c22fc 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 _0x093a=['./lib/email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','./server','./realtime'];(function(_0x3d0198,_0x94b95c){var _0x3488b2=function(_0x1483ba){while(--_0x1483ba){_0x3d0198['push'](_0x3d0198['shift']());}};_0x3488b2(++_0x94b95c);}(_0x093a,0x16a));var _0xa093=function(_0x15cdcb,_0x4340e9){_0x15cdcb=_0x15cdcb-0x0;var _0x37b069=_0x093a[_0x15cdcb];return _0x37b069;};'use strict';var BPromise=require('bluebird');var server=require(_0xa093('0x0'));var Realtime=require(_0xa093('0x1'));var EmailChannel=require(_0xa093('0x2'));var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0xa093('0x3')]()[_0xa093('0x4')](mailAccount[_0xa093('0x5')]())[_0xa093('0x4')](realtime[_0xa093('0x6')]())[_0xa093('0x4')](function(){email[_0xa093('0x7')](realtime[_0xa093('0x8')]);return realtime;});}function main(){return server[_0xa093('0x9')](realtime,email)[_0xa093('0x4')](function(_0x21ee11){return initRealtime();})[_0xa093('0x4')](function(_0x3fec02){return db[_0xa093('0xa')][_0xa093('0xb')]({'attributes':['id',_0xa093('0xc')],'raw':!![]});})[_0xa093('0x4')](function(_0x28892a){return setInterval(initRealtime,_0x28892a[_0xa093('0xc')]*0x3e8);})[_0xa093('0xd')](function(_0x5cb78){console['log'](_0x5cb78);});}main(); \ No newline at end of file +var _0x4e00=['./server','./lib/email','./rpc/mailAccount','then','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne'];(function(_0x533132,_0xf5b6fa){var _0x1a7447=function(_0x44d580){while(--_0x44d580){_0x533132['push'](_0x533132['shift']());}};_0x1a7447(++_0xf5b6fa);}(_0x4e00,0xa0));var _0x04e0=function(_0x482a97,_0x3b8c9a){_0x482a97=_0x482a97-0x0;var _0xb5394a=_0x4e00[_0x482a97];return _0xb5394a;};'use strict';var BPromise=require('bluebird');var server=require(_0x04e0('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x04e0('0x1'));var mailAccount=require(_0x04e0('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise['resolve']()[_0x04e0('0x3')](mailAccount['getMailAccounts']())[_0x04e0('0x3')](realtime[_0x04e0('0x4')]())[_0x04e0('0x3')](function(){email[_0x04e0('0x5')](realtime[_0x04e0('0x6')]);return realtime;});}function main(){return server[_0x04e0('0x7')](realtime,email)[_0x04e0('0x3')](function(_0x4c3fb0){return initRealtime();})[_0x04e0('0x3')](function(_0x3a47a6){return db[_0x04e0('0x8')][_0x04e0('0x9')]({'attributes':['id','loginMailFrequency'],'raw':!![]});})[_0x04e0('0x3')](function(_0x125f86){return setInterval(initRealtime,_0x125f86['loginMailFrequency']*0x3e8);})['catch'](function(_0x361b7f){console['log'](_0x361b7f);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 1a7ad7b..226bd38 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 _0xee2b=['../../../config/environment','../../../config/logger','email','redis','defaults','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','active','Imap','status','messageStatus','total','isNil','stringify','md5','refresh','hasOwnProperty','imapAccounts','box','handleImapBox','bind','handleImapEmail','end','error','handleImapError','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail','send','Smtp','verify','verified','exports','lodash','moment','bluebird','ioredis'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0xee2b,0x10a));var _0xbee2=function(_0x3cf139,_0x4d2549){_0x3cf139=_0x3cf139-0x0;var _0x334673=_0xee2b[_0x3cf139];return _0x334673;};'use strict';var _=require(_0xbee2('0x0'));var moment=require(_0xbee2('0x1'));var BPromise=require(_0xbee2('0x2'));var md5=require('md5');var Redis=require(_0xbee2('0x3'));var config=require(_0xbee2('0x4'));var logger=require(_0xbee2('0x5'))(_0xbee2('0x6'));config[_0xbee2('0x7')]=_[_0xbee2('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbee2('0x7')]));var EmailImap=require(_0xbee2('0x9'));var EmailSmtp=require(_0xbee2('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x439138){logger[_0xbee2('0xb')](_0xbee2('0xc'));this['mailAccounts']=_0x439138[_0xbee2('0xd')];this['imapAccounts']={};this[_0xbee2('0xe')]=new EmailSmtp();}EmailChannel[_0xbee2('0xf')][_0xbee2('0x10')]=function(_0x11ba2b){var _0x1ba5c1=this[_0xbee2('0xd')][_0x11ba2b];var _0x1e42b0={'id':_0x1ba5c1['id'],'name':_0x1ba5c1[_0xbee2('0x11')],'key':_0x1ba5c1['key'],'active':_0x1ba5c1[_0xbee2('0x12')],'Imap':{'status':_0x1ba5c1[_0xbee2('0x13')][_0xbee2('0x14')],'messageStatus':_0x1ba5c1[_0xbee2('0x13')][_0xbee2('0x15')],'total':_0x1ba5c1['Imap'][_0xbee2('0x16')]}};if(_[_0xbee2('0x17')](md5Accounts[_0x11ba2b])){md5Accounts[_0x11ba2b]={};}var _0x35f165=md5(JSON[_0xbee2('0x18')](_0x1e42b0));if(md5Accounts[_0x11ba2b][_0xbee2('0x19')]!==_0x35f165){md5Accounts[_0x11ba2b][_0xbee2('0x19')]=_0x35f165;io[_0xbee2('0x10')]('mailAccount:update',_0x1e42b0);}};EmailChannel['prototype'][_0xbee2('0x1a')]=function(_0x31f141){for(var _0x1ed205 in _0x31f141){if(_0x31f141[_0xbee2('0x1b')](_0x1ed205)){if(_0x31f141[_0x1ed205][_0xbee2('0x13')]&&_0x31f141[_0x1ed205]['active']){var _0x589338=_0x31f141[_0x1ed205]['Imap'];if(!this[_0xbee2('0x1c')][_0xbee2('0x1b')](_0x589338['id'])){this[_0xbee2('0x1c')][_0x589338['id']]=new EmailImap(_0x589338,_0x31f141[_0x1ed205]['email']);this['imapAccounts'][_0x589338['id']]['on'](_0xbee2('0x1d'),this[_0xbee2('0x1e')][_0xbee2('0x1f')](this,_0x1ed205));this[_0xbee2('0x1c')][_0x589338['id']]['on'](_0xbee2('0x6'),this[_0xbee2('0x20')][_0xbee2('0x1f')](this,_0x1ed205));this[_0xbee2('0x1c')][_0x589338['id']]['on'](_0xbee2('0x21'),this['handleImapEnd']['bind'](this,_0x1ed205));this[_0xbee2('0x1c')][_0x589338['id']]['on'](_0xbee2('0x22'),this[_0xbee2('0x23')][_0xbee2('0x1f')](this,_0x1ed205));}}else{if(_[_0xbee2('0x17')](this[_0xbee2('0xd')][_0x1ed205][_0xbee2('0x13')])){this[_0xbee2('0xd')][_0x1ed205]['Imap']={};}this[_0xbee2('0xd')][_0x1ed205][_0xbee2('0x13')][_0xbee2('0x14')]=_0xbee2('0x24');this[_0xbee2('0xd')][_0x1ed205][_0xbee2('0x13')][_0xbee2('0x15')]='';this[_0xbee2('0x10')](_0x1ed205);}}}};EmailChannel[_0xbee2('0xf')][_0xbee2('0x1e')]=function(_0x9cf0c,_0x9cbd6e){if(this['mailAccounts'][_0x9cf0c]){this[_0xbee2('0xd')][_0x9cf0c][_0xbee2('0x13')][_0xbee2('0x14')]='connected';this['mailAccounts'][_0x9cf0c][_0xbee2('0x13')][_0xbee2('0x15')]=_0x9cbd6e[_0xbee2('0x11')];if(_0x9cbd6e[_0xbee2('0x25')]){this[_0xbee2('0xd')][_0x9cf0c][_0xbee2('0x13')]['total']=_0x9cbd6e[_0xbee2('0x25')][_0xbee2('0x16')];}return this[_0xbee2('0x10')](_0x9cf0c);}};EmailChannel[_0xbee2('0xf')][_0xbee2('0x20')]=function(_0x18cd9e,_0x14c39c){logger[_0xbee2('0xb')](_0xbee2('0x26'),_0x14c39c['firstName'],_0x14c39c[_0xbee2('0x27')],_0x14c39c[_0xbee2('0x28')],_0x18cd9e);if(this[_0xbee2('0xd')][_0x18cd9e]){return mailAccount[_0xbee2('0x29')](_0x18cd9e,_0x14c39c)[_0xbee2('0x2a')](function(_0x15376c){if(_0x15376c){logger[_0xbee2('0xb')](_0xbee2('0x2b'));}})[_0xbee2('0x2c')](function(_0x190e23){logger[_0xbee2('0x22')](_0xbee2('0x2d'),JSON['stringify'](_0x190e23));});}};EmailChannel[_0xbee2('0xf')][_0xbee2('0x2e')]=function(_0x110483){if(this[_0xbee2('0xd')][_0x110483]&&this[_0xbee2('0xd')][_0x110483][_0xbee2('0x13')]){if(this[_0xbee2('0x1c')][this[_0xbee2('0xd')][_0x110483]['Imap']['id']]){delete this[_0xbee2('0x1c')][this[_0xbee2('0xd')][_0x110483]['Imap']['id']];}this[_0xbee2('0xd')][_0x110483][_0xbee2('0x13')][_0xbee2('0x2f')]=moment();this[_0xbee2('0x10')](_0x110483);}};EmailChannel[_0xbee2('0xf')]['handleImapError']=function(_0x321a36,_0x540f51){if(this[_0xbee2('0xd')][_0x321a36]){this[_0xbee2('0xd')][_0x321a36][_0xbee2('0x13')][_0xbee2('0x14')]=_0xbee2('0x22');this[_0xbee2('0xd')][_0x321a36][_0xbee2('0x13')][_0xbee2('0x15')]=_0x540f51;return this['emit'](_0x321a36);}};EmailChannel[_0xbee2('0xf')][_0xbee2('0x30')]=function(_0x2b5442,_0x229fa8){return this[_0xbee2('0xe')][_0xbee2('0x31')](_0x2b5442,_0x229fa8);};EmailChannel[_0xbee2('0xf')]['verifySmtp']=function(_0x54ebec){var _0x3095b2=this;if(this[_0xbee2('0xd')][_0x54ebec['id']]){if(_[_0xbee2('0x17')](this['mailAccounts'][_0x54ebec['id']][_0xbee2('0x32')])){this[_0xbee2('0xd')][_0x54ebec['id']][_0xbee2('0x32')]={};}this[_0xbee2('0xd')][_0x54ebec['id']][_0xbee2('0x32')][_0xbee2('0x2f')]=moment();return new BPromise(function(_0x1d6ca8,_0x2629da){return _0x3095b2[_0xbee2('0xe')][_0xbee2('0x33')](_0x54ebec)[_0xbee2('0x2a')](function(_0x2e5f4d){_0x3095b2[_0xbee2('0xd')][_0x54ebec['id']][_0xbee2('0x32')][_0xbee2('0x14')]=_0xbee2('0x34');_0x3095b2[_0xbee2('0xd')][_0x54ebec['id']][_0xbee2('0x32')]['messageStatus']='';_0x3095b2['emit'](_0x54ebec['id']);_0x1d6ca8(_0x2e5f4d);})[_0xbee2('0x2c')](function(_0x3f2fc3){_0x3095b2['mailAccounts'][_0x54ebec['id']][_0xbee2('0x32')]['status']=_0xbee2('0x22');_0x3095b2['mailAccounts'][_0x54ebec['id']][_0xbee2('0x32')][_0xbee2('0x15')]=_0x3f2fc3;_0x3095b2[_0xbee2('0x10')](_0x54ebec['id']);_0x2629da(_0x3f2fc3);});});}return this['smtp']['verify'](_0x54ebec);};module[_0xbee2('0x35')]=EmailChannel; \ No newline at end of file +var _0xaf9a=['notify','info','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','status','send','verifySmtp','Smtp','verify','then','verified','exports','lodash','../../../config/environment','../../../config/logger','email','defaults','localhost','redis','./imap','./smtp','mailAccounts','imapAccounts','smtp','prototype','emit','key','active','Imap','messageStatus','total','isNil','stringify','md5','mailAccount:update','refresh','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName'];(function(_0x346b59,_0x3ef5ca){var _0x1d4fee=function(_0x51ed4d){while(--_0x51ed4d){_0x346b59['push'](_0x346b59['shift']());}};_0x1d4fee(++_0x3ef5ca);}(_0xaf9a,0x1ec));var _0xaaf9=function(_0x52b866,_0xa2f342){_0x52b866=_0x52b866-0x0;var _0x474d32=_0xaf9a[_0x52b866];return _0x474d32;};'use strict';var _=require(_0xaaf9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var Redis=require('ioredis');var config=require(_0xaaf9('0x1'));var logger=require(_0xaaf9('0x2'))(_0xaaf9('0x3'));config['redis']=_[_0xaaf9('0x4')](config['redis'],{'host':_0xaaf9('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaaf9('0x6')]));var EmailImap=require(_0xaaf9('0x7'));var EmailSmtp=require(_0xaaf9('0x8'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x308302){logger['info']('start\x20email\x20channel');this[_0xaaf9('0x9')]=_0x308302[_0xaaf9('0x9')];this[_0xaaf9('0xa')]={};this[_0xaaf9('0xb')]=new EmailSmtp();}EmailChannel[_0xaaf9('0xc')][_0xaaf9('0xd')]=function(_0x25a6de){var _0xe09782=this[_0xaaf9('0x9')][_0x25a6de];var _0x82799e={'id':_0xe09782['id'],'name':_0xe09782['name'],'key':_0xe09782[_0xaaf9('0xe')],'active':_0xe09782[_0xaaf9('0xf')],'Imap':{'status':_0xe09782['Imap']['status'],'messageStatus':_0xe09782[_0xaaf9('0x10')][_0xaaf9('0x11')],'total':_0xe09782['Imap'][_0xaaf9('0x12')]}};if(_[_0xaaf9('0x13')](md5Accounts[_0x25a6de])){md5Accounts[_0x25a6de]={};}var _0x168e0e=md5(JSON[_0xaaf9('0x14')](_0x82799e));if(md5Accounts[_0x25a6de][_0xaaf9('0x15')]!==_0x168e0e){md5Accounts[_0x25a6de][_0xaaf9('0x15')]=_0x168e0e;io[_0xaaf9('0xd')](_0xaaf9('0x16'),_0x82799e);}};EmailChannel[_0xaaf9('0xc')][_0xaaf9('0x17')]=function(_0x171960){for(var _0x2f23a7 in _0x171960){if(_0x171960['hasOwnProperty'](_0x2f23a7)){if(_0x171960[_0x2f23a7][_0xaaf9('0x10')]&&_0x171960[_0x2f23a7][_0xaaf9('0xf')]){var _0x2e4001=_0x171960[_0x2f23a7][_0xaaf9('0x10')];if(!this[_0xaaf9('0xa')][_0xaaf9('0x18')](_0x2e4001['id'])){this['imapAccounts'][_0x2e4001['id']]=new EmailImap(_0x2e4001,_0x171960[_0x2f23a7][_0xaaf9('0x3')]);this[_0xaaf9('0xa')][_0x2e4001['id']]['on'](_0xaaf9('0x19'),this[_0xaaf9('0x1a')][_0xaaf9('0x1b')](this,_0x2f23a7));this[_0xaaf9('0xa')][_0x2e4001['id']]['on'](_0xaaf9('0x3'),this[_0xaaf9('0x1c')][_0xaaf9('0x1b')](this,_0x2f23a7));this['imapAccounts'][_0x2e4001['id']]['on'](_0xaaf9('0x1d'),this[_0xaaf9('0x1e')][_0xaaf9('0x1b')](this,_0x2f23a7));this[_0xaaf9('0xa')][_0x2e4001['id']]['on']('error',this[_0xaaf9('0x1f')][_0xaaf9('0x1b')](this,_0x2f23a7));}}else{if(_[_0xaaf9('0x13')](this[_0xaaf9('0x9')][_0x2f23a7][_0xaaf9('0x10')])){this[_0xaaf9('0x9')][_0x2f23a7][_0xaaf9('0x10')]={};}this['mailAccounts'][_0x2f23a7][_0xaaf9('0x10')]['status']='disabled';this[_0xaaf9('0x9')][_0x2f23a7]['Imap'][_0xaaf9('0x11')]='';this['emit'](_0x2f23a7);}}}};EmailChannel[_0xaaf9('0xc')][_0xaaf9('0x1a')]=function(_0x5dfceb,_0xc0cebe){if(this[_0xaaf9('0x9')][_0x5dfceb]){this[_0xaaf9('0x9')][_0x5dfceb][_0xaaf9('0x10')]['status']=_0xaaf9('0x20');this['mailAccounts'][_0x5dfceb][_0xaaf9('0x10')][_0xaaf9('0x11')]=_0xc0cebe[_0xaaf9('0x21')];if(_0xc0cebe[_0xaaf9('0x22')]){this[_0xaaf9('0x9')][_0x5dfceb][_0xaaf9('0x10')][_0xaaf9('0x12')]=_0xc0cebe[_0xaaf9('0x22')][_0xaaf9('0x12')];}return this[_0xaaf9('0xd')](_0x5dfceb);}};EmailChannel['prototype'][_0xaaf9('0x1c')]=function(_0x1f56e0,_0x5a09c0){logger['info'](_0xaaf9('0x23'),_0x5a09c0[_0xaaf9('0x24')],_0x5a09c0[_0xaaf9('0x25')],_0x5a09c0['from'],_0x1f56e0);if(this['mailAccounts'][_0x1f56e0]){return mailAccount[_0xaaf9('0x26')](_0x1f56e0,_0x5a09c0)['then'](function(_0x1dda65){if(_0x1dda65){logger[_0xaaf9('0x27')](_0xaaf9('0x28'));}})[_0xaaf9('0x29')](function(_0x5b2a0b){logger[_0xaaf9('0x2a')](_0xaaf9('0x2b'),JSON[_0xaaf9('0x14')](_0x5b2a0b));});}};EmailChannel[_0xaaf9('0xc')][_0xaaf9('0x1e')]=function(_0x4f683a){if(this[_0xaaf9('0x9')][_0x4f683a]&&this[_0xaaf9('0x9')][_0x4f683a][_0xaaf9('0x10')]){if(this[_0xaaf9('0xa')][this[_0xaaf9('0x9')][_0x4f683a][_0xaaf9('0x10')]['id']]){delete this[_0xaaf9('0xa')][this[_0xaaf9('0x9')][_0x4f683a][_0xaaf9('0x10')]['id']];}this['mailAccounts'][_0x4f683a][_0xaaf9('0x10')][_0xaaf9('0x2c')]=moment();this['emit'](_0x4f683a);}};EmailChannel[_0xaaf9('0xc')]['handleImapError']=function(_0x9bc2aa,_0x24da43){if(this[_0xaaf9('0x9')][_0x9bc2aa]){this[_0xaaf9('0x9')][_0x9bc2aa][_0xaaf9('0x10')][_0xaaf9('0x2d')]=_0xaaf9('0x2a');this[_0xaaf9('0x9')][_0x9bc2aa][_0xaaf9('0x10')][_0xaaf9('0x11')]=_0x24da43;return this[_0xaaf9('0xd')](_0x9bc2aa);}};EmailChannel['prototype']['sendMail']=function(_0x3ed537,_0x5a40e1){return this[_0xaaf9('0xb')][_0xaaf9('0x2e')](_0x3ed537,_0x5a40e1);};EmailChannel['prototype'][_0xaaf9('0x2f')]=function(_0x5982af){var _0x38f348=this;if(this[_0xaaf9('0x9')][_0x5982af['id']]){if(_[_0xaaf9('0x13')](this[_0xaaf9('0x9')][_0x5982af['id']][_0xaaf9('0x30')])){this[_0xaaf9('0x9')][_0x5982af['id']]['Smtp']={};}this[_0xaaf9('0x9')][_0x5982af['id']][_0xaaf9('0x30')][_0xaaf9('0x2c')]=moment();return new BPromise(function(_0x280f3e,_0x1aa906){return _0x38f348[_0xaaf9('0xb')][_0xaaf9('0x31')](_0x5982af)[_0xaaf9('0x32')](function(_0x2e10d0){_0x38f348['mailAccounts'][_0x5982af['id']]['Smtp'][_0xaaf9('0x2d')]=_0xaaf9('0x33');_0x38f348[_0xaaf9('0x9')][_0x5982af['id']][_0xaaf9('0x30')][_0xaaf9('0x11')]='';_0x38f348[_0xaaf9('0xd')](_0x5982af['id']);_0x280f3e(_0x2e10d0);})[_0xaaf9('0x29')](function(_0xabe679){_0x38f348[_0xaaf9('0x9')][_0x5982af['id']][_0xaaf9('0x30')][_0xaaf9('0x2d')]='error';_0x38f348[_0xaaf9('0x9')][_0x5982af['id']][_0xaaf9('0x30')][_0xaaf9('0x11')]=_0xabe679;_0x38f348['emit'](_0x5982af['id']);_0x1aa906(_0xabe679);});});}return this['smtp'][_0xaaf9('0x31')](_0x5982af);};module[_0xaaf9('0x34')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index d048b0c..ec8b7fb 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 _0xd4a0=['handleFetchEnd','closeBox','handleCloseBox','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleFetchError','stringify','textCode','hasOwnProperty','exports','path','util','imap','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','events','./utils','mailbox','account','getAccount','once','handleReady','bind','end','handleEnd','handleError','connect','inherits','connTimeout','authTimeout','authentication','user','password','host','port','tls','autotls','required','service','email','anonymous@xcally.com','openBox','prototype','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','message','handleFetchMessage','error'];(function(_0x1933af,_0x2970d8){var _0x46e7ef=function(_0x4e3db2){while(--_0x4e3db2){_0x1933af['push'](_0x1933af['shift']());}};_0x46e7ef(++_0x2970d8);}(_0xd4a0,0x82));var _0x0d4a=function(_0xa50265,_0x2039da){_0xa50265=_0xa50265-0x0;var _0x366418=_0xd4a0[_0xa50265];return _0x366418;};'use strict';var fs=require('fs');var path=require(_0x0d4a('0x0'));var util=require(_0x0d4a('0x1'));var Imap=require(_0x0d4a('0x2'));var _=require(_0x0d4a('0x3'));var rs=require(_0x0d4a('0x4'));var simpleParser=require(_0x0d4a('0x5'))[_0x0d4a('0x6')];var Iconv=require(_0x0d4a('0x7'))[_0x0d4a('0x8')];var EventEmitter=require(_0x0d4a('0x9'))['EventEmitter'];var utils=require(_0x0d4a('0xa'));var logger=require('../../../config/logger')('email');function EmailImap(_0x2d65bb,_0x527d36){this[_0x0d4a('0xb')]='INBOX';this[_0x0d4a('0xc')]=this[_0x0d4a('0xd')](_0x2d65bb,_0x527d36);this['imap']=new Imap(this['account']);this[_0x0d4a('0x2')][_0x0d4a('0xe')]('ready',this[_0x0d4a('0xf')][_0x0d4a('0x10')](this));this[_0x0d4a('0x2')]['once'](_0x0d4a('0x11'),this[_0x0d4a('0x12')][_0x0d4a('0x10')](this));this['imap']['on']('error',this[_0x0d4a('0x13')][_0x0d4a('0x10')](this));this['imap'][_0x0d4a('0x14')]();}util[_0x0d4a('0x15')](EmailImap,EventEmitter);EmailImap['prototype'][_0x0d4a('0xd')]=function(_0x280b9f,_0x333808){var _0x1096aa={'connTimeout':_0x280b9f[_0x0d4a('0x16')]?_0x280b9f[_0x0d4a('0x16')]*0x3e8:0x2710,'authTimeout':_0x280b9f[_0x0d4a('0x17')]?_0x280b9f[_0x0d4a('0x17')]*0x3e8:0x1388};if(_['isNil'](_0x280b9f['service'])){if(_0x280b9f[_0x0d4a('0x18')]){_0x1096aa[_0x0d4a('0x19')]=_0x280b9f[_0x0d4a('0x19')];_0x1096aa[_0x0d4a('0x1a')]=_0x280b9f[_0x0d4a('0x1a')];}_0x1096aa[_0x0d4a('0x1b')]=_0x280b9f[_0x0d4a('0x1b')];_0x1096aa[_0x0d4a('0x1c')]=_0x280b9f[_0x0d4a('0x1c')]||0x3e1;if(_0x280b9f['tls']){_0x1096aa[_0x0d4a('0x1d')]=!![];}else{_0x1096aa[_0x0d4a('0x1d')]=![];_0x1096aa[_0x0d4a('0x1e')]=_0x0d4a('0x1f');}}else{_0x1096aa[_0x0d4a('0x19')]=_0x280b9f[_0x0d4a('0x19')];_0x1096aa[_0x0d4a('0x1a')]=_0x280b9f[_0x0d4a('0x1a')];_0x1096aa['host']=utils['getHost'](_0x280b9f[_0x0d4a('0x20')]);_0x1096aa[_0x0d4a('0x1c')]=0x3e1;_0x1096aa['tls']=!![];}_0x1096aa[_0x0d4a('0x21')]=_0x333808||_0x280b9f[_0x0d4a('0x19')]||_0x0d4a('0x22');return _0x1096aa;};EmailImap['prototype'][_0x0d4a('0xf')]=function(){this[_0x0d4a('0x2')][_0x0d4a('0x23')](this['mailbox'],![],this['handleOpenBox'][_0x0d4a('0x10')](this));};EmailImap[_0x0d4a('0x24')][_0x0d4a('0x25')]=function(_0x465ef6,_0x2218e9){if(_0x465ef6){this['handleError'](_0x465ef6,!![]);}else{this[_0x0d4a('0x26')](_0x0d4a('0x27'),_0x2218e9);this[_0x0d4a('0x28')]();}};EmailImap[_0x0d4a('0x24')]['handleCloseBox']=function(_0x54e512){if(_0x54e512){this[_0x0d4a('0x13')](_0x54e512,!![]);}else{this[_0x0d4a('0x2')]['end']();}};EmailImap['prototype'][_0x0d4a('0x28')]=function(){this[_0x0d4a('0x2')][_0x0d4a('0x29')]([_0x0d4a('0x2a')],this['handleReadUnseen']['bind'](this));};EmailImap['prototype'][_0x0d4a('0x2b')]=function(_0x2339e9,_0x144fa8){if(_0x2339e9){this[_0x0d4a('0x13')](_0x2339e9,!![]);}else{if(_0x144fa8['length']){try{var _0x277998=this[_0x0d4a('0x2')]['fetch'](_0x144fa8,{'bodies':'','markSeen':!![]});_0x277998['on'](_0x0d4a('0x2c'),this[_0x0d4a('0x2d')][_0x0d4a('0x10')](this));_0x277998[_0x0d4a('0xe')](_0x0d4a('0x2e'),this['handleFetchError']['bind'](this));_0x277998[_0x0d4a('0xe')]('end',this[_0x0d4a('0x2f')]['bind'](this));}catch(_0x30f020){logger[_0x0d4a('0x2e')](_0x30f020);}}else{this[_0x0d4a('0x2')][_0x0d4a('0x30')](!![],this[_0x0d4a('0x31')][_0x0d4a('0x10')](this));}}};EmailImap['prototype'][_0x0d4a('0x2d')]=function(_0x21c21e,_0xe275dd){_0x21c21e['on']('body',this[_0x0d4a('0x32')]['bind'](this));_0x21c21e[_0x0d4a('0xe')]('attributes',this[_0x0d4a('0x33')]['bind'](this));_0x21c21e[_0x0d4a('0xe')](_0x0d4a('0x11'),this[_0x0d4a('0x34')][_0x0d4a('0x10')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x245347,_0xb07514){simpleParser(_0x245347,{'Iconv':Iconv},this[_0x0d4a('0x35')][_0x0d4a('0x10')](this));};EmailImap[_0x0d4a('0x24')][_0x0d4a('0x33')]=function(_0x45de9b){};EmailImap[_0x0d4a('0x24')][_0x0d4a('0x34')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x189981,_0x4300d5){if(_0x189981){logger['error'](_0x189981);}else{var _0x31da36=this;utils['parser'](this[_0x0d4a('0xc')],_0x4300d5,function(_0x21befb){_0x31da36[_0x0d4a('0x26')](_0x0d4a('0x21'),_0x21befb);});}};EmailImap['prototype'][_0x0d4a('0x2f')]=function(){this[_0x0d4a('0x2')][_0x0d4a('0x30')](!![],this[_0x0d4a('0x31')][_0x0d4a('0x10')](this));};EmailImap[_0x0d4a('0x24')][_0x0d4a('0x36')]=function(_0x1dae86){this[_0x0d4a('0x13')](_0x1dae86);this['imap'][_0x0d4a('0x30')](!![],this['handleCloseBox'][_0x0d4a('0x10')](this));};EmailImap[_0x0d4a('0x24')]['handleEnd']=function(){this[_0x0d4a('0x26')]('end');};EmailImap[_0x0d4a('0x24')][_0x0d4a('0x13')]=function(_0x238b06,_0x8860e){logger[_0x0d4a('0x2e')](_0x0d4a('0x13'),this['account']['email'],JSON[_0x0d4a('0x37')](_0x238b06));var _0x318603='';if(_0x238b06){if(_0x238b06[_0x0d4a('0x38')]){_0x318603=_0x238b06[_0x0d4a('0x38')];}else{for(var _0x2a361e in _0x238b06){if(_0x238b06[_0x0d4a('0x39')](_0x2a361e)){_0x318603+=_['upperFirst'](_0x2a361e)+':\x20'+_0x238b06[_0x2a361e]+'\x0a';}}}}if(_0x8860e){this[_0x0d4a('0x2')][_0x0d4a('0x11')]();}else{this[_0x0d4a('0x26')](_0x0d4a('0x2e'),_0x318603);this['emit']('end');}};module[_0x0d4a('0x3a')]=EmailImap; \ No newline at end of file +var _0xa648=['upperFirst','exports','path','util','randomstring','mailparser','iconv','Iconv','events','./utils','email','mailbox','INBOX','account','getAccount','imap','once','ready','handleReady','bind','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','password','host','port','tls','autotls','required','user','getHost','openBox','handleOpenBox','box','handleCloseBox','end','readUnseen','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','emit','stringify','textCode','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa648,0xf6));var _0x8a64=function(_0x397a88,_0x969c09){_0x397a88=_0x397a88-0x0;var _0x5b13e8=_0xa648[_0x397a88];return _0x5b13e8;};'use strict';var fs=require('fs');var path=require(_0x8a64('0x0'));var util=require(_0x8a64('0x1'));var Imap=require('imap');var _=require('lodash');var rs=require(_0x8a64('0x2'));var simpleParser=require(_0x8a64('0x3'))['simpleParser'];var Iconv=require(_0x8a64('0x4'))[_0x8a64('0x5')];var EventEmitter=require(_0x8a64('0x6'))['EventEmitter'];var utils=require(_0x8a64('0x7'));var logger=require('../../../config/logger')(_0x8a64('0x8'));function EmailImap(_0x172c69,_0x160642){this[_0x8a64('0x9')]=_0x8a64('0xa');this[_0x8a64('0xb')]=this[_0x8a64('0xc')](_0x172c69,_0x160642);this[_0x8a64('0xd')]=new Imap(this['account']);this['imap'][_0x8a64('0xe')](_0x8a64('0xf'),this[_0x8a64('0x10')][_0x8a64('0x11')](this));this['imap'][_0x8a64('0xe')]('end',this[_0x8a64('0x12')][_0x8a64('0x11')](this));this[_0x8a64('0xd')]['on'](_0x8a64('0x13'),this[_0x8a64('0x14')]['bind'](this));this[_0x8a64('0xd')][_0x8a64('0x15')]();}util[_0x8a64('0x16')](EmailImap,EventEmitter);EmailImap[_0x8a64('0x17')][_0x8a64('0xc')]=function(_0x318059,_0x940431){var _0x504bda={'connTimeout':_0x318059[_0x8a64('0x18')]?_0x318059['connTimeout']*0x3e8:0x2710,'authTimeout':_0x318059[_0x8a64('0x19')]?_0x318059[_0x8a64('0x19')]*0x3e8:0x1388};if(_[_0x8a64('0x1a')](_0x318059[_0x8a64('0x1b')])){if(_0x318059[_0x8a64('0x1c')]){_0x504bda['user']=_0x318059['user'];_0x504bda[_0x8a64('0x1d')]=_0x318059[_0x8a64('0x1d')];}_0x504bda[_0x8a64('0x1e')]=_0x318059[_0x8a64('0x1e')];_0x504bda['port']=_0x318059[_0x8a64('0x1f')]||0x3e1;if(_0x318059['tls']){_0x504bda[_0x8a64('0x20')]=!![];}else{_0x504bda[_0x8a64('0x20')]=![];_0x504bda[_0x8a64('0x21')]=_0x8a64('0x22');}}else{_0x504bda['user']=_0x318059[_0x8a64('0x23')];_0x504bda[_0x8a64('0x1d')]=_0x318059[_0x8a64('0x1d')];_0x504bda['host']=utils[_0x8a64('0x24')](_0x318059[_0x8a64('0x1b')]);_0x504bda['port']=0x3e1;_0x504bda['tls']=!![];}_0x504bda[_0x8a64('0x8')]=_0x940431||_0x318059[_0x8a64('0x23')]||'anonymous@xcally.com';return _0x504bda;};EmailImap[_0x8a64('0x17')]['handleReady']=function(){this['imap'][_0x8a64('0x25')](this[_0x8a64('0x9')],![],this[_0x8a64('0x26')][_0x8a64('0x11')](this));};EmailImap[_0x8a64('0x17')]['handleOpenBox']=function(_0x2ba8ce,_0x4b7cc6){if(_0x2ba8ce){this[_0x8a64('0x14')](_0x2ba8ce,!![]);}else{this['emit'](_0x8a64('0x27'),_0x4b7cc6);this['readUnseen']();}};EmailImap['prototype'][_0x8a64('0x28')]=function(_0x3dc4cc){if(_0x3dc4cc){this['handleError'](_0x3dc4cc,!![]);}else{this[_0x8a64('0xd')][_0x8a64('0x29')]();}};EmailImap[_0x8a64('0x17')][_0x8a64('0x2a')]=function(){this[_0x8a64('0xd')][_0x8a64('0x2b')]([_0x8a64('0x2c')],this['handleReadUnseen'][_0x8a64('0x11')](this));};EmailImap[_0x8a64('0x17')][_0x8a64('0x2d')]=function(_0x2991bc,_0x2f9762){if(_0x2991bc){this[_0x8a64('0x14')](_0x2991bc,!![]);}else{if(_0x2f9762['length']){try{var _0x16bcc0=this['imap'][_0x8a64('0x2e')](_0x2f9762,{'bodies':'','markSeen':!![]});_0x16bcc0['on'](_0x8a64('0x2f'),this[_0x8a64('0x30')][_0x8a64('0x11')](this));_0x16bcc0[_0x8a64('0xe')]('error',this['handleFetchError'][_0x8a64('0x11')](this));_0x16bcc0[_0x8a64('0xe')]('end',this[_0x8a64('0x31')]['bind'](this));}catch(_0xce7d08){logger['error'](_0xce7d08);}}else{this[_0x8a64('0xd')][_0x8a64('0x32')](!![],this[_0x8a64('0x28')][_0x8a64('0x11')](this));}}};EmailImap['prototype'][_0x8a64('0x30')]=function(_0x2577d2,_0x3e691e){_0x2577d2['on']('body',this['handleMessageBody'][_0x8a64('0x11')](this));_0x2577d2[_0x8a64('0xe')]('attributes',this['handleMessageAttributes'][_0x8a64('0x11')](this));_0x2577d2['once'](_0x8a64('0x29'),this[_0x8a64('0x33')]['bind'](this));};EmailImap[_0x8a64('0x17')]['handleMessageBody']=function(_0x86b89,_0xbb5e0d){simpleParser(_0x86b89,{'Iconv':Iconv},this[_0x8a64('0x34')][_0x8a64('0x11')](this));};EmailImap[_0x8a64('0x17')][_0x8a64('0x35')]=function(_0x3f6aa7){};EmailImap[_0x8a64('0x17')][_0x8a64('0x33')]=function(){};EmailImap[_0x8a64('0x17')]['handleSimpleParser']=function(_0x56cb9d,_0x52a722){if(_0x56cb9d){logger[_0x8a64('0x13')](_0x56cb9d);}else{var _0x42b53a=this;utils[_0x8a64('0x36')](this[_0x8a64('0xb')],_0x52a722,function(_0x34d664){_0x42b53a[_0x8a64('0x37')]('email',_0x34d664);});}};EmailImap[_0x8a64('0x17')][_0x8a64('0x31')]=function(){this['imap'][_0x8a64('0x32')](!![],this[_0x8a64('0x28')]['bind'](this));};EmailImap[_0x8a64('0x17')]['handleFetchError']=function(_0x5ea8e8){this[_0x8a64('0x14')](_0x5ea8e8);this[_0x8a64('0xd')]['closeBox'](!![],this[_0x8a64('0x28')][_0x8a64('0x11')](this));};EmailImap[_0x8a64('0x17')][_0x8a64('0x12')]=function(){this[_0x8a64('0x37')](_0x8a64('0x29'));};EmailImap[_0x8a64('0x17')]['handleError']=function(_0x58456d,_0x1ee5c6){logger[_0x8a64('0x13')](_0x8a64('0x14'),this[_0x8a64('0xb')]['email'],JSON[_0x8a64('0x38')](_0x58456d));var _0x572e38='';if(_0x58456d){if(_0x58456d[_0x8a64('0x39')]){_0x572e38=_0x58456d[_0x8a64('0x39')];}else{for(var _0x1bae30 in _0x58456d){if(_0x58456d[_0x8a64('0x3a')](_0x1bae30)){_0x572e38+=_[_0x8a64('0x3b')](_0x1bae30)+':\x20'+_0x58456d[_0x1bae30]+'\x0a';}}}}if(_0x1ee5c6){this['imap'][_0x8a64('0x29')]();}else{this['emit'](_0x8a64('0x13'),_0x572e38);this[_0x8a64('0x37')](_0x8a64('0x29'));}};module[_0x8a64('0x3c')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 845aed1..dafb8a9 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 _0xe68d=['verify','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport','use','compile','sendMail'];(function(_0x35c506,_0x18351c){var _0x4d025c=function(_0x4f8b02){while(--_0x4f8b02){_0x35c506['push'](_0x35c506['shift']());}};_0x4d025c(++_0x18351c);}(_0xe68d,0x107));var _0xde68=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xe68d[_0x4fc9e6];return _0x551d28;};'use strict';var nodemailer=require(_0xde68('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0xde68('0x1'));function EmailSmtp(){}EmailSmtp[_0xde68('0x2')]['send']=function(_0x482d9c,_0x3bcae7){return new BPromise(function(_0x42fb67,_0x4e710a){var _0x6757d8=nodemailer[_0xde68('0x3')](_0x482d9c);_0x6757d8[_0xde68('0x4')](_0xde68('0x5'),inlineBase64());_0x6757d8[_0xde68('0x6')](_0x3bcae7,function(_0x149aeb,_0x577947){if(_0x149aeb){_0x4e710a(_0x149aeb['toString']());}else{_0x42fb67(_0x577947);}});});};EmailSmtp[_0xde68('0x2')][_0xde68('0x7')]=function(_0x138261){return new BPromise(function(_0x33a29e,_0x106764){var _0x15c9fc=nodemailer[_0xde68('0x3')](_0x138261);_0x15c9fc[_0xde68('0x7')](function(_0x5643d8,_0x26e18e){if(_0x5643d8){_0x106764(_0x5643d8['toString']());}else{if(_0x26e18e){_0x33a29e(_0x26e18e);}else{_0x106764(_0xde68('0x8'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x4844=['toString','Not\x20verifired','nodemailer','bluebird','prototype','send','createTransport','compile','sendMail','verify'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0x4844,0x1b0));var _0x4484=function(_0x1caa8c,_0x3d4419){_0x1caa8c=_0x1caa8c-0x0;var _0x538457=_0x4844[_0x1caa8c];return _0x538457;};'use strict';var nodemailer=require(_0x4484('0x0'));var BPromise=require(_0x4484('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x4484('0x2')][_0x4484('0x3')]=function(_0x35d9f1,_0x34d079){return new BPromise(function(_0x874ba0,_0x2c970d){var _0x709b9b=nodemailer[_0x4484('0x4')](_0x35d9f1);_0x709b9b['use'](_0x4484('0x5'),inlineBase64());_0x709b9b[_0x4484('0x6')](_0x34d079,function(_0x4f9dbf,_0x31312c){if(_0x4f9dbf){_0x2c970d(_0x4f9dbf['toString']());}else{_0x874ba0(_0x31312c);}});});};EmailSmtp[_0x4484('0x2')][_0x4484('0x7')]=function(_0x47d8d7){return new BPromise(function(_0x9431bc,_0x36906e){var _0x394203=nodemailer['createTransport'](_0x47d8d7);_0x394203[_0x4484('0x7')](function(_0x27bbe6,_0x358f93){if(_0x27bbe6){_0x36906e(_0x27bbe6[_0x4484('0x8')]());}else{if(_0x358f93){_0x9431bc(_0x358f93);}else{_0x36906e(_0x4484('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 8010e77..fa04189 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 _0x89ff=['application/ms-tnef','info','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','address','anonymous','generate','value','split','length','slice','join','name','Anonymous','isEmpty','@xcally.com','html','replace','body','0x1?_0x558a07['pop']():'';}return'';}function getMails(_0x237fcc,_0x2b37ae){var _0x4551e9='';for(var _0x49f2e6=0x0;_0x49f2e6<_0x2b37ae[_0xf89f('0xc')][_0xf89f('0xe')];_0x49f2e6+=0x1){if(_0x2b37ae[_0xf89f('0xc')][_0x49f2e6][_0xf89f('0x9')]!==_0x237fcc){if(!_[_0xf89f('0x13')](_0x4551e9)){_0x4551e9+=',';}_0x4551e9+=_0x2b37ae['value'][_0x49f2e6][_0xf89f('0x11')]||_0x2b37ae[_0xf89f('0xc')][_0x49f2e6][_0xf89f('0x9')]||'';_0x4551e9+='\x20<';_0x4551e9+=_0x2b37ae[_0xf89f('0xc')][_0x49f2e6][_0xf89f('0x9')]?_0x2b37ae['value'][_0x49f2e6][_0xf89f('0x9')]:_0xf89f('0xa')+random['generate'](0x6)+_0xf89f('0x14');_0x4551e9+='>';}}return _0x4551e9;}function parseEmail(_0x3d7dc6,_0x4e3481,_0x16b200){if(_0x4e3481[_0xf89f('0x15')]){var _0x46eea9=/)<[^<]*)*<\/script>/gi;while(_0x46eea9['test'](_0x4e3481['html'])){_0x4e3481['html']=_0x4e3481[_0xf89f('0x15')][_0xf89f('0x16')](_0x46eea9,'');}_0x16b200[_0xf89f('0x17')]=_0x4e3481['html'];}else{_0x16b200[_0xf89f('0x17')]=_0x4e3481['textAsHtml'];}if(_0x16b200['body']){_0x16b200[_0xf89f('0x17')]=_0x16b200[_0xf89f('0x17')][_0xf89f('0x16')](/Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','split','length','slice','join','isEmpty','html','test','textAsHtml','body','replace','message'];(function(_0x18e030,_0x1667e2){var _0x2f77b4=function(_0x24c291){while(--_0x24c291){_0x18e030['push'](_0x18e030['shift']());}};_0x2f77b4(++_0x1667e2);}(_0x0307,0x1d0));var _0x7030=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x0307[_0x39e283];return _0x7de89f;};'use strict';var _=require(_0x7030('0x0'));var moment=require(_0x7030('0x1'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require('util');var tnef=require(_0x7030('0x2'));var logger=require(_0x7030('0x3'))(_0x7030('0x4'));var config=require(_0x7030('0x5'));function getAddress(_0x533d2d){var _0x119678=_[_0x7030('0x6')](_0x533d2d[_0x7030('0x7')]);return _0x119678&&_0x119678[_0x7030('0x8')]?_0x119678[_0x7030('0x8')]:_0x7030('0x9')+random[_0x7030('0xa')](0x6)+_0x7030('0xb');}function getFirstName(_0x4b4f2b){var _0x19fa86=_[_0x7030('0x6')](_0x4b4f2b[_0x7030('0x7')]);if(_0x19fa86&&_0x19fa86[_0x7030('0xc')]){var _0x1eefc3=_0x19fa86[_0x7030('0xc')][_0x7030('0xd')](/\s+/);return _0x1eefc3[_0x7030('0xe')]?_0x1eefc3[_0x7030('0xf')](0x0,-0x1)[_0x7030('0x10')]('\x20'):_0x19fa86[_0x7030('0xc')];}return'Anonymous';}function getLastName(_0x53f87c){var _0x4e8126=_[_0x7030('0x6')](_0x53f87c['value']);if(_0x4e8126&&_0x4e8126[_0x7030('0xc')]){var _0x2e30fa=_0x4e8126['name']['split'](/\s+/);return _0x2e30fa[_0x7030('0xe')]>0x1?_0x2e30fa['pop']():'';}return'';}function getMails(_0x55d1a5,_0x34031e){var _0x48dc77='';for(var _0x18fbae=0x0;_0x18fbae<_0x34031e[_0x7030('0x7')][_0x7030('0xe')];_0x18fbae+=0x1){if(_0x34031e[_0x7030('0x7')][_0x18fbae][_0x7030('0x8')]!==_0x55d1a5){if(!_[_0x7030('0x11')](_0x48dc77)){_0x48dc77+=',';}_0x48dc77+=_0x34031e[_0x7030('0x7')][_0x18fbae][_0x7030('0xc')]||_0x34031e[_0x7030('0x7')][_0x18fbae][_0x7030('0x8')]||'';_0x48dc77+='\x20<';_0x48dc77+=_0x34031e['value'][_0x18fbae]['address']?_0x34031e[_0x7030('0x7')][_0x18fbae][_0x7030('0x8')]:_0x7030('0x9')+random['generate'](0x6)+_0x7030('0xb');_0x48dc77+='>';}}return _0x48dc77;}function parseEmail(_0x4d2788,_0x2f0269,_0x869eff){if(_0x2f0269[_0x7030('0x12')]){var _0xfd1772=/)<[^<]*)*<\/script>/gi;while(_0xfd1772[_0x7030('0x13')](_0x2f0269['html'])){_0x2f0269[_0x7030('0x12')]=_0x2f0269['html']['replace'](_0xfd1772,'');}_0x869eff['body']=_0x2f0269[_0x7030('0x12')];}else{_0x869eff['body']=_0x2f0269[_0x7030('0x14')];}if(_0x869eff[_0x7030('0x15')]){_0x869eff[_0x7030('0x15')]=_0x869eff[_0x7030('0x15')][_0x7030('0x16')](/0x0){if(this[_0x43ae5e+'Capacity']>0x0&&this[_0x43ae5e+'CurrentCapacity']>=this[_0x43ae5e+_0x3d98('0x25')]){return _0x3d98('0x26');}else{return _0x3d98('0x27');}}else{return _0x3d98('0x28');}};Agent[_0x3d98('0x23')][_0x3d98('0x22')]=function(){var _0x245ffa=['mail','chat','openchannel',_0x3d98('0x29'),'sms',_0x3d98('0x2a')];for(var _0x867f85=0x0;_0x867f85<_0x245ffa[_0x3d98('0x2b')];_0x867f85+=0x1){var _0x499233=this[_0x3d98('0x2c')](_0x245ffa[_0x867f85]);if(this[_0x245ffa[_0x867f85]+_0x3d98('0x2d')]!==_0x499233){this[_0x245ffa[_0x867f85]+_0x3d98('0x2e')]=_[_0x3d98('0x2f')](moment()[_0x3d98('0x30')]('x'));}this[_0x245ffa[_0x867f85]+'Status']=_0x499233;}var _0x29c14f={'id':this['id'],'name':this[_0x3d98('0x8')],'online':this['online'],'voicePause':this[_0x3d98('0xa')],'chatPause':this[_0x3d98('0xb')],'mailPause':this[_0x3d98('0xc')],'smsPause':this['smsPause'],'faxPause':this[_0x3d98('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x3d98('0xf')],'chatStatusTime':this[_0x3d98('0x31')],'chatCapacity':this[_0x3d98('0x11')],'chatCurrentCapacity':this[_0x3d98('0x12')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x3d98('0x32')],'mailCapacity':this[_0x3d98('0x14')],'mailCurrentCapacity':this[_0x3d98('0x33')],'faxStatus':this[_0x3d98('0x15')],'faxStatusTime':this[_0x3d98('0x16')],'faxCapacity':this[_0x3d98('0x34')],'faxCurrentCapacity':this[_0x3d98('0x17')],'smsStatus':this[_0x3d98('0x18')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x3d98('0x19')],'smsCurrentCapacity':this[_0x3d98('0x35')],'whatsappStatus':this[_0x3d98('0x1a')],'whatsappStatusTime':this[_0x3d98('0x1b')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x3d98('0x1e')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x3d98('0x1f')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x3d98('0x36')]};var _0x561258=md5(JSON['stringify'](_0x29c14f));if(this[_0x3d98('0x2')]!==_0x561258){this[_0x3d98('0x2')]=_0x561258;io[_0x3d98('0x37')](_0x3d98('0x38'),_0x29c14f);}};module[_0x3d98('0x39')]=Agent; \ No newline at end of file +var _0xa03c=['whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime','mail','chat','fax','sms','whatsapp','length','StatusTime','format','Status','openchannelStatus','openchannelStatusTime','busyQueue','user:save','lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity'];(function(_0x3e374d,_0x24f356){var _0x35693f=function(_0x21af93){while(--_0x21af93){_0x3e374d['push'](_0x3e374d['shift']());}};_0x35693f(++_0x24f356);}(_0xa03c,0x94));var _0xca03=function(_0x33fc15,_0x405a34){_0x33fc15=_0x33fc15-0x0;var _0x3c558c=_0xa03c[_0x33fc15];return _0x3c558c;};'use strict';var _=require(_0xca03('0x0'));var moment=require('moment');var md5=require(_0xca03('0x1'));var Redis=require(_0xca03('0x2'));var config=require(_0xca03('0x3'));config['redis']=_[_0xca03('0x4')](config[_0xca03('0x5')],{'host':_0xca03('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xca03('0x5')]));function Agent(_0x1bf647){this['id']=_0x1bf647['id']||0x0;this[_0xca03('0x7')]=_0x1bf647[_0xca03('0x7')]||'';this[_0xca03('0x8')]=_0x1bf647[_0xca03('0x8')]||!![];this['voicePause']=_0x1bf647[_0xca03('0x9')]||![];this[_0xca03('0xa')]=_0x1bf647[_0xca03('0xa')]||![];this[_0xca03('0xb')]=_0x1bf647[_0xca03('0xb')]||![];this[_0xca03('0xc')]=_0x1bf647[_0xca03('0xc')]||![];this[_0xca03('0xd')]=_0x1bf647[_0xca03('0xd')]||![];this[_0xca03('0xe')]=_0x1bf647['openchannelPause']||![];this[_0xca03('0xf')]=_0xca03('0x10');this[_0xca03('0x11')]=0x0;this[_0xca03('0x12')]=_0x1bf647[_0xca03('0x12')]||0x0;this[_0xca03('0x13')]=0x0;this[_0xca03('0x14')]=_0xca03('0x10');this[_0xca03('0x15')]=0x0;this[_0xca03('0x16')]=_0x1bf647[_0xca03('0x16')]||0x0;this[_0xca03('0x17')]=0x0;this[_0xca03('0x18')]=_0xca03('0x10');this[_0xca03('0x19')]=0x0;this[_0xca03('0x1a')]=_0x1bf647[_0xca03('0x1a')]||0x0;this[_0xca03('0x1b')]=0x0;this[_0xca03('0x1c')]='unknown';this[_0xca03('0x1d')]=0x0;this[_0xca03('0x1e')]=_0x1bf647[_0xca03('0x1e')]||0x0;this[_0xca03('0x1f')]=0x0;this[_0xca03('0x20')]=_0xca03('0x10');this[_0xca03('0x21')]=0x0;this[_0xca03('0x22')]=_0x1bf647['whatsappCapacity']||0x0;this[_0xca03('0x23')]=0x0;this['openchannelStatus']='unknown';this['openchannelStatusTime']=0x0;this[_0xca03('0x24')]=_0x1bf647[_0xca03('0x24')]||0x0;this[_0xca03('0x25')]=0x0;this[_0xca03('0x26')]=![];this['busyQueue']=undefined;this[_0xca03('0x1')]='';this['updateRealtime']();}Agent[_0xca03('0x27')][_0xca03('0x28')]=function(_0x2d4c42){if(this[_0x2d4c42+_0xca03('0x29')]>0x0){if(this[_0x2d4c42+_0xca03('0x2a')]>0x0&&this[_0x2d4c42+_0xca03('0x29')]>=this[_0x2d4c42+_0xca03('0x2a')]){return _0xca03('0x2b');}else{return _0xca03('0x2c');}}else{return _0xca03('0x2d');}};Agent['prototype'][_0xca03('0x2e')]=function(){var _0x178e40=[_0xca03('0x2f'),_0xca03('0x30'),'openchannel',_0xca03('0x31'),_0xca03('0x32'),_0xca03('0x33')];for(var _0x4f9248=0x0;_0x4f9248<_0x178e40[_0xca03('0x34')];_0x4f9248+=0x1){var _0x5b8de4=this[_0xca03('0x28')](_0x178e40[_0x4f9248]);if(this[_0x178e40[_0x4f9248]+'Status']!==_0x5b8de4){this[_0x178e40[_0x4f9248]+_0xca03('0x35')]=_['toNumber'](moment()[_0xca03('0x36')]('x'));}this[_0x178e40[_0x4f9248]+_0xca03('0x37')]=_0x5b8de4;}var _0x79fc86={'id':this['id'],'name':this[_0xca03('0x7')],'online':this[_0xca03('0x8')],'voicePause':this[_0xca03('0x9')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0xca03('0xc')],'openchannelPause':this[_0xca03('0xe')],'chatStatus':this[_0xca03('0xf')],'chatStatusTime':this[_0xca03('0x11')],'chatCapacity':this[_0xca03('0x12')],'chatCurrentCapacity':this[_0xca03('0x13')],'mailStatus':this[_0xca03('0x14')],'mailStatusTime':this[_0xca03('0x15')],'mailCapacity':this[_0xca03('0x16')],'mailCurrentCapacity':this[_0xca03('0x17')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xca03('0x19')],'faxCapacity':this[_0xca03('0x1a')],'faxCurrentCapacity':this[_0xca03('0x1b')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xca03('0x1d')],'smsCapacity':this[_0xca03('0x1e')],'smsCurrentCapacity':this[_0xca03('0x1f')],'whatsappStatus':this[_0xca03('0x20')],'whatsappStatusTime':this[_0xca03('0x21')],'whatsappCapacity':this[_0xca03('0x22')],'whatsappCurrentCapacity':this[_0xca03('0x23')],'openchannelStatus':this[_0xca03('0x38')],'openchannelStatusTime':this[_0xca03('0x39')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xca03('0x25')],'busy':this['busy'],'busyQueue':this[_0xca03('0x3a')]};var _0x2f0529=md5(JSON['stringify'](_0x79fc86));if(this[_0xca03('0x1')]!==_0x2f0529){this[_0xca03('0x1')]=_0x2f0529;io['emit'](_0xca03('0x3b'),_0x79fc86);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 354d221..6caf870 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 _0x4982=['paused','length','loggedIn','chatPause','available','stringify','format','chat:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype'];(function(_0x30dba4,_0x568aaf){var _0x1bcc3b=function(_0x3dcfc5){while(--_0x3dcfc5){_0x30dba4['push'](_0x30dba4['shift']());}};_0x1bcc3b(++_0x568aaf);}(_0x4982,0x172));var _0x2498=function(_0x2b3396,_0x109c27){_0x2b3396=_0x2b3396-0x0;var _0x2d9812=_0x4982[_0x2b3396];return _0x2d9812;};'use strict';var _=require(_0x2498('0x0'));var md5=require(_0x2498('0x1'));var util=require(_0x2498('0x2'));var Redis=require('ioredis');var config=require(_0x2498('0x3'));config[_0x2498('0x4')]=_[_0x2498('0x5')](config[_0x2498('0x4')],{'host':_0x2498('0x6'),'port':0x18eb});var io=require(_0x2498('0x7'))(new Redis(config[_0x2498('0x4')]));function ChatQueue(_0x23d819){this['id']=_0x23d819['id']||0x0;this[_0x2498('0x8')]=_0x23d819[_0x2498('0x8')]||'';this['timeout']=_0x23d819[_0x2498('0x9')]||0xa;this[_0x2498('0xa')]=_0x23d819[_0x2498('0xa')]||_0x2498('0xb');this['Agents']=_0x23d819[_0x2498('0xc')];this[_0x2498('0xd')]={};this[_0x2498('0xe')]=0x0;this[_0x2498('0x1')]='';this[_0x2498('0xf')]();this[_0x2498('0x10')]();}ChatQueue['prototype'][_0x2498('0xf')]=function(){var _0x477596=this[_0x2498('0xd')][_0x2498('0x11')];this[_0x2498('0xd')]=_[_0x2498('0x12')](this[_0x2498('0xc')],'id');this[_0x2498('0xd')]['_rr']=_0x477596;};ChatQueue[_0x2498('0x13')][_0x2498('0x10')]=function(){this['loggedIn']=0x0;this[_0x2498('0x14')]=0x0;for(var _0x44ec60=0x0;_0x44ec60=0x0?this['available']:0x0;var _0x42b447={'id':this['id'],'available':this[_0x2498('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x2498('0x8')],'paused':this[_0x2498('0x14')],'waiting':this[_0x2498('0xe')]};var _0x31b59d=md5(JSON[_0x2498('0x19')](_0x42b447));if(this[_0x2498('0x1')]!==_0x31b59d){this[_0x2498('0x1')]=_0x31b59d;io['to'](util[_0x2498('0x1a')](_0x2498('0x1b'),_0x42b447[_0x2498('0x8')]))[_0x2498('0x1c')]('chat_queue:save',_0x42b447);}};module[_0x2498('0x1d')]=ChatQueue; \ No newline at end of file +var _0x62a7=['defaults','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','length','chatPause','paused','available','format','emit','chat_queue:save','exports','lodash','md5','util'];(function(_0x536866,_0x54e594){var _0x3f8cee=function(_0x116c1e){while(--_0x116c1e){_0x536866['push'](_0x536866['shift']());}};_0x3f8cee(++_0x54e594);}(_0x62a7,0x1d8));var _0x762a=function(_0x39cbe4,_0x4a7958){_0x39cbe4=_0x39cbe4-0x0;var _0xe76ba7=_0x62a7[_0x39cbe4];return _0xe76ba7;};'use strict';var _=require(_0x762a('0x0'));var md5=require(_0x762a('0x1'));var util=require(_0x762a('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x762a('0x3')](config[_0x762a('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x762a('0x5'))(new Redis(config[_0x762a('0x4')]));function ChatQueue(_0xa0581){this['id']=_0xa0581['id']||0x0;this[_0x762a('0x6')]=_0xa0581[_0x762a('0x6')]||'';this['timeout']=_0xa0581[_0x762a('0x7')]||0xa;this[_0x762a('0x8')]=_0xa0581[_0x762a('0x8')]||'beepall';this['Agents']=_0xa0581[_0x762a('0x9')];this[_0x762a('0xa')]={};this[_0x762a('0xb')]=0x0;this[_0x762a('0x1')]='';this[_0x762a('0xc')]();this[_0x762a('0xd')]();}ChatQueue[_0x762a('0xe')][_0x762a('0xc')]=function(){var _0x20fb60=this['mapAgentsId']['_rr'];this[_0x762a('0xa')]=_[_0x762a('0xf')](this[_0x762a('0x9')],'id');this[_0x762a('0xa')]['_rr']=_0x20fb60;};ChatQueue['prototype']['updateRealtime']=function(){this[_0x762a('0x10')]=0x0;this['paused']=0x0;for(var _0x3b298a=0x0;_0x3b298a=0x0?this['available']:0x0;var _0x36ccb0={'id':this['id'],'available':this[_0x762a('0x14')],'loggedIn':this[_0x762a('0x10')],'name':this[_0x762a('0x6')],'paused':this[_0x762a('0x13')],'waiting':this['waiting']};var _0x570644=md5(JSON['stringify'](_0x36ccb0));if(this['md5']!==_0x570644){this['md5']=_0x570644;io['to'](util[_0x762a('0x15')]('chat:queue:%s',_0x36ccb0['name']))[_0x762a('0x16')](_0x762a('0x17'),_0x36ccb0);}};module[_0x762a('0x18')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index d3e10d0..d3345aa 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(_0x1fed46,_0x4557ea){var _0x962493=function(_0x2c4961){while(--_0x2c4961){_0x1fed46['push'](_0x1fed46['shift']());}};_0x962493(++_0x4557ea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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(_0xc115d,_0x4643d3){var _0x35cf3d=function(_0x1934df){while(--_0x1934df){_0xc115d['push'](_0xc115d['shift']());}};_0x35cf3d(++_0x4643d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 367b9c9..e48e700 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 _0x207e=['exports','name','Intervals'];(function(_0x55c427,_0x1240af){var _0x12c78f=function(_0x3c9da1){while(--_0x3c9da1){_0x55c427['push'](_0x55c427['shift']());}};_0x12c78f(++_0x1240af);}(_0x207e,0x1e7));var _0xe207=function(_0x36d1f9,_0x16a2b4){_0x36d1f9=_0x36d1f9-0x0;var _0x319efe=_0x207e[_0x36d1f9];return _0x319efe;};'use strict';function Interval(_0x5b40e3){this['id']=_0x5b40e3['id']||0x0;this[_0xe207('0x0')]=_0x5b40e3[_0xe207('0x0')]||'';this['Intervals']=_0x5b40e3[_0xe207('0x1')]||{};}module[_0xe207('0x2')]=Interval; \ No newline at end of file +var _0x8f94=['name'];(function(_0x5707b5,_0x579bf7){var _0x28ef9d=function(_0x18c291){while(--_0x18c291){_0x5707b5['push'](_0x5707b5['shift']());}};_0x28ef9d(++_0x579bf7);}(_0x8f94,0x75));var _0x48f9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8f94[_0x2dafbe];return _0x58a45a;};'use strict';function Interval(_0x5327de){this['id']=_0x5327de['id']||0x0;this[_0x48f9('0x0')]=_0x5327de[_0x48f9('0x0')]||'';this['Intervals']=_0x5327de['Intervals']||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 6d8c69f..ae8cb1e 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 _0x74e6=['socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','paused','online','loggedIn','available','waiting','stringify','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','redis','localhost'];(function(_0x284bb4,_0x598e6c){var _0x574d5b=function(_0x4e3dac){while(--_0x4e3dac){_0x284bb4['push'](_0x284bb4['shift']());}};_0x574d5b(++_0x598e6c);}(_0x74e6,0xed));var _0x674e=function(_0x3e4c0b,_0x4750be){_0x3e4c0b=_0x3e4c0b-0x0;var _0x12f6f0=_0x74e6[_0x3e4c0b];return _0x12f6f0;};'use strict';var _=require(_0x674e('0x0'));var md5=require(_0x674e('0x1'));var util=require(_0x674e('0x2'));var Redis=require(_0x674e('0x3'));var config=require('../../../config/environment');config[_0x674e('0x4')]=_['defaults'](config[_0x674e('0x4')],{'host':_0x674e('0x5'),'port':0x18eb});var io=require(_0x674e('0x6'))(new Redis(config[_0x674e('0x4')]));function MailQueue(_0x577fcc){this['id']=_0x577fcc['id']||0x0;this[_0x674e('0x7')]=_0x577fcc['name']||'';this[_0x674e('0x8')]=_0x577fcc[_0x674e('0x8')]||0xa;this[_0x674e('0x9')]=_0x577fcc['strategy']||'beepall';this[_0x674e('0xa')]=_0x577fcc['Agents'];this[_0x674e('0xb')]={};this['waiting']=0x0;this['md5']='';this[_0x674e('0xc')]();this[_0x674e('0xd')]();}MailQueue[_0x674e('0xe')][_0x674e('0xc')]=function(){var _0x8966e2=this[_0x674e('0xb')][_0x674e('0xf')];this[_0x674e('0xb')]=_[_0x674e('0x10')](this['Agents'],'id');this[_0x674e('0xb')][_0x674e('0xf')]=_0x8966e2;};MailQueue[_0x674e('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x674e('0x11')]=0x0;for(var _0x10037d=0x0;_0x10037d=0x0?this[_0x674e('0x14')]:0x0;var _0x308a24={'id':this['id'],'available':this[_0x674e('0x14')],'loggedIn':this[_0x674e('0x13')],'name':this[_0x674e('0x7')],'paused':this[_0x674e('0x11')],'waiting':this[_0x674e('0x15')]};var _0x1153c3=md5(JSON[_0x674e('0x16')](_0x308a24));if(this['md5']!==_0x1153c3){this['md5']=_0x1153c3;io['to'](util['format'](_0x674e('0x17'),_0x308a24[_0x674e('0x7')]))[_0x674e('0x18')](_0x674e('0x19'),_0x308a24);}};module[_0x674e('0x1a')]=MailQueue; \ No newline at end of file +var _0x6d77=['mapAgentsId','updateRouting','prototype','_rr','map','Agents','paused','length','loggedIn','mailPause','available','name','stringify','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','timeout','strategy','beepall'];(function(_0xf73a11,_0x295aeb){var _0x57081e=function(_0x55c725){while(--_0x55c725){_0xf73a11['push'](_0xf73a11['shift']());}};_0x57081e(++_0x295aeb);}(_0x6d77,0x13a));var _0x76d7=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x6d77[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x76d7('0x0'));var md5=require(_0x76d7('0x1'));var util=require(_0x76d7('0x2'));var Redis=require(_0x76d7('0x3'));var config=require('../../../config/environment');config[_0x76d7('0x4')]=_['defaults'](config[_0x76d7('0x4')],{'host':_0x76d7('0x5'),'port':0x18eb});var io=require(_0x76d7('0x6'))(new Redis(config[_0x76d7('0x4')]));function MailQueue(_0x521824){this['id']=_0x521824['id']||0x0;this['name']=_0x521824['name']||'';this[_0x76d7('0x7')]=_0x521824['timeout']||0xa;this['strategy']=_0x521824[_0x76d7('0x8')]||_0x76d7('0x9');this['Agents']=_0x521824['Agents'];this[_0x76d7('0xa')]={};this['waiting']=0x0;this[_0x76d7('0x1')]='';this[_0x76d7('0xb')]();this['updateRealtime']();}MailQueue[_0x76d7('0xc')][_0x76d7('0xb')]=function(){var _0x511208=this['mapAgentsId'][_0x76d7('0xd')];this[_0x76d7('0xa')]=_[_0x76d7('0xe')](this[_0x76d7('0xf')],'id');this[_0x76d7('0xa')][_0x76d7('0xd')]=_0x511208;};MailQueue[_0x76d7('0xc')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x76d7('0x10')]=0x0;for(var _0xc27df5=0x0;_0xc27df5=0x0?this[_0x76d7('0x14')]:0x0;var _0x5d9faf={'id':this['id'],'available':this[_0x76d7('0x14')],'loggedIn':this[_0x76d7('0x12')],'name':this[_0x76d7('0x15')],'paused':this[_0x76d7('0x10')],'waiting':this['waiting']};var _0x1deb0e=md5(JSON[_0x76d7('0x16')](_0x5d9faf));if(this['md5']!==_0x1deb0e){this['md5']=_0x1deb0e;io['to'](util['format'](_0x76d7('0x17'),_0x5d9faf[_0x76d7('0x15')]))[_0x76d7('0x18')](_0x76d7('0x19'),_0x5d9faf);}};module[_0x76d7('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 486e741..8348104 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 _0xd9c0=['prototype','mapAgentsId','_rr','loggedIn','paused','online','openchannelPause','available','stringify','format','emit','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime'];(function(_0x31ddd9,_0x25a759){var _0x2a18ae=function(_0xb5291d){while(--_0xb5291d){_0x31ddd9['push'](_0x31ddd9['shift']());}};_0x2a18ae(++_0x25a759);}(_0xd9c0,0x186));var _0x0d9c=function(_0x41ee1f,_0x31ea45){_0x41ee1f=_0x41ee1f-0x0;var _0x44a42f=_0xd9c0[_0x41ee1f];return _0x44a42f;};'use strict';var _=require(_0x0d9c('0x0'));var md5=require(_0x0d9c('0x1'));var util=require(_0x0d9c('0x2'));var Redis=require(_0x0d9c('0x3'));var config=require(_0x0d9c('0x4'));config['redis']=_[_0x0d9c('0x5')](config['redis'],{'host':_0x0d9c('0x6'),'port':0x18eb});var io=require(_0x0d9c('0x7'))(new Redis(config[_0x0d9c('0x8')]));function OpenchannelQueue(_0x39a651){this['id']=_0x39a651['id']||0x0;this['name']=_0x39a651[_0x0d9c('0x9')]||'';this[_0x0d9c('0xa')]=_0x39a651['timeout']||0xa;this[_0x0d9c('0xb')]=_0x39a651[_0x0d9c('0xb')]||'beepall';this['Agents']=_0x39a651[_0x0d9c('0xc')];this['mapAgentsId']={};this[_0x0d9c('0xd')]=0x0;this['md5']='';this[_0x0d9c('0xe')]();this[_0x0d9c('0xf')]();}OpenchannelQueue[_0x0d9c('0x10')][_0x0d9c('0xe')]=function(){var _0x4e3d07=this[_0x0d9c('0x11')][_0x0d9c('0x12')];this['mapAgentsId']=_['map'](this[_0x0d9c('0xc')],'id');this[_0x0d9c('0x11')]['_rr']=_0x4e3d07;};OpenchannelQueue[_0x0d9c('0x10')][_0x0d9c('0xf')]=function(){this[_0x0d9c('0x13')]=0x0;this[_0x0d9c('0x14')]=0x0;for(var _0x3d11de=0x0;_0x3d11de=0x0?this[_0x0d9c('0x17')]:0x0;var _0x1fbb79={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x0d9c('0x9')],'paused':this['paused'],'waiting':this['waiting']};var _0x449709=md5(JSON[_0x0d9c('0x18')](_0x1fbb79));if(this[_0x0d9c('0x1')]!==_0x449709){this['md5']=_0x449709;io['to'](util[_0x0d9c('0x19')]('openchannel:queue:%s',_0x1fbb79[_0x0d9c('0x9')]))[_0x0d9c('0x1a')](_0x0d9c('0x1b'),_0x1fbb79);}};module[_0x0d9c('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0xda3e=['emit','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','openchannelPause','available','stringify','format'];(function(_0x35e591,_0x2934fa){var _0x1aa862=function(_0x2b5c2d){while(--_0x2b5c2d){_0x35e591['push'](_0x35e591['shift']());}};_0x1aa862(++_0x2934fa);}(_0xda3e,0x15f));var _0xeda3=function(_0x31c5bc,_0x54543e){_0x31c5bc=_0x31c5bc-0x0;var _0x4aa581=_0xda3e[_0x31c5bc];return _0x4aa581;};'use strict';var _=require(_0xeda3('0x0'));var md5=require(_0xeda3('0x1'));var util=require(_0xeda3('0x2'));var Redis=require(_0xeda3('0x3'));var config=require(_0xeda3('0x4'));config['redis']=_['defaults'](config[_0xeda3('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xeda3('0x6'))(new Redis(config[_0xeda3('0x5')]));function OpenchannelQueue(_0x36321c){this['id']=_0x36321c['id']||0x0;this[_0xeda3('0x7')]=_0x36321c[_0xeda3('0x7')]||'';this['timeout']=_0x36321c[_0xeda3('0x8')]||0xa;this['strategy']=_0x36321c[_0xeda3('0x9')]||_0xeda3('0xa');this[_0xeda3('0xb')]=_0x36321c[_0xeda3('0xb')];this[_0xeda3('0xc')]={};this[_0xeda3('0xd')]=0x0;this[_0xeda3('0x1')]='';this[_0xeda3('0xe')]();this[_0xeda3('0xf')]();}OpenchannelQueue[_0xeda3('0x10')]['updateRouting']=function(){var _0x3cc5aa=this[_0xeda3('0xc')]['_rr'];this[_0xeda3('0xc')]=_['map'](this[_0xeda3('0xb')],'id');this[_0xeda3('0xc')][_0xeda3('0x11')]=_0x3cc5aa;};OpenchannelQueue[_0xeda3('0x10')][_0xeda3('0xf')]=function(){this[_0xeda3('0x12')]=0x0;this[_0xeda3('0x13')]=0x0;for(var _0x18a312=0x0;_0x18a312=0x0?this[_0xeda3('0x17')]:0x0;var _0x3c6868={'id':this['id'],'available':this[_0xeda3('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xeda3('0xd')]};var _0xb39e62=md5(JSON[_0xeda3('0x18')](_0x3c6868));if(this[_0xeda3('0x1')]!==_0xb39e62){this[_0xeda3('0x1')]=_0xb39e62;io['to'](util[_0xeda3('0x19')]('openchannel:queue:%s',_0x3c6868[_0xeda3('0x7')]))[_0xeda3('0x1a')](_0xeda3('0x1b'),_0x3c6868);}};module[_0xeda3('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 00b4bc5..25eb634 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['length','online','loggedIn','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','updateRealtime','paused'];(function(_0x1f1e31,_0x27b5c3){var _0x229b56=function(_0x16db77){while(--_0x16db77){_0x1f1e31['push'](_0x1f1e31['shift']());}};_0x229b56(++_0x27b5c3);}(_0xb10b,0x12a));var _0xbb10=function(_0x336adb,_0x1c3608){_0x336adb=_0x336adb-0x0;var _0x5be7f5=_0xb10b[_0x336adb];return _0x5be7f5;};'use strict';var _=require(_0xbb10('0x0'));var md5=require('md5');var util=require(_0xbb10('0x1'));var Redis=require(_0xbb10('0x2'));var config=require(_0xbb10('0x3'));config['redis']=_[_0xbb10('0x4')](config[_0xbb10('0x5')],{'host':_0xbb10('0x6'),'port':0x18eb});var io=require(_0xbb10('0x7'))(new Redis(config[_0xbb10('0x5')]));function SmsQueue(_0x312b72){this['id']=_0x312b72['id']||0x0;this['name']=_0x312b72[_0xbb10('0x8')]||'';this[_0xbb10('0x9')]=_0x312b72['timeout']||0xa;this[_0xbb10('0xa')]=_0x312b72[_0xbb10('0xa')]||_0xbb10('0xb');this[_0xbb10('0xc')]=_0x312b72[_0xbb10('0xc')];this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]=0x0;this[_0xbb10('0xf')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xbb10('0x10')][_0xbb10('0x11')]=function(){var _0xce64f3=this['mapAgentsId'][_0xbb10('0x12')];this['mapAgentsId']=_[_0xbb10('0x13')](this[_0xbb10('0xc')],'id');this[_0xbb10('0xd')][_0xbb10('0x12')]=_0xce64f3;};SmsQueue[_0xbb10('0x10')][_0xbb10('0x14')]=function(){this['loggedIn']=0x0;this[_0xbb10('0x15')]=0x0;for(var _0x42d7e4=0x0;_0x42d7e4=0x0?this[_0xbb10('0x1a')]:0x0;var _0x1682a4={'id':this['id'],'available':this[_0xbb10('0x1a')],'loggedIn':this[_0xbb10('0x18')],'name':this[_0xbb10('0x8')],'paused':this[_0xbb10('0x15')],'waiting':this['waiting']};var _0x5ff0cf=md5(JSON[_0xbb10('0x1b')](_0x1682a4));if(this[_0xbb10('0xf')]!==_0x5ff0cf){this[_0xbb10('0xf')]=_0x5ff0cf;io['to'](util[_0xbb10('0x1c')](_0xbb10('0x1d'),_0x1682a4['name']))[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x1682a4);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x1f7c56,_0x468320){var _0x930575=function(_0xec97a1){while(--_0xec97a1){_0x1f7c56['push'](_0x1f7c56['shift']());}};_0x930575(++_0x468320);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xb7e7[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index e841f5a..2de7395 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 _0x2a63=['mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','loggedIn','length','online','whatsappPause','paused','available','stringify','md5','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x2a63,0xae));var _0x32a6=function(_0x3f4a8e,_0x507c39){_0x3f4a8e=_0x3f4a8e-0x0;var _0x7f68fd=_0x2a63[_0x3f4a8e];return _0x7f68fd;};'use strict';var _=require(_0x32a6('0x0'));var md5=require('md5');var util=require(_0x32a6('0x1'));var Redis=require('ioredis');var config=require(_0x32a6('0x2'));config[_0x32a6('0x3')]=_[_0x32a6('0x4')](config[_0x32a6('0x3')],{'host':_0x32a6('0x5'),'port':0x18eb});var io=require(_0x32a6('0x6'))(new Redis(config[_0x32a6('0x3')]));function WhatsappQueue(_0x2f9614){this['id']=_0x2f9614['id']||0x0;this[_0x32a6('0x7')]=_0x2f9614[_0x32a6('0x7')]||'';this[_0x32a6('0x8')]=_0x2f9614[_0x32a6('0x8')]||0xa;this[_0x32a6('0x9')]=_0x2f9614['strategy']||_0x32a6('0xa');this[_0x32a6('0xb')]=_0x2f9614[_0x32a6('0xb')];this[_0x32a6('0xc')]={};this[_0x32a6('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0x32a6('0xe')]();}WhatsappQueue[_0x32a6('0xf')][_0x32a6('0x10')]=function(){var _0x56e9af=this[_0x32a6('0xc')]['_rr'];this[_0x32a6('0xc')]=_[_0x32a6('0x11')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x56e9af;};WhatsappQueue[_0x32a6('0xf')][_0x32a6('0xe')]=function(){this[_0x32a6('0x12')]=0x0;this['paused']=0x0;for(var _0x590af5=0x0;_0x590af5=0x0?this[_0x32a6('0x17')]:0x0;var _0x1fdda7={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x32a6('0x7')],'paused':this['paused'],'waiting':this[_0x32a6('0xd')]};var _0x35ffb1=md5(JSON[_0x32a6('0x18')](_0x1fdda7));if(this[_0x32a6('0x19')]!==_0x35ffb1){this[_0x32a6('0x19')]=_0x35ffb1;io['to'](util[_0x32a6('0x1a')](_0x32a6('0x1b'),_0x1fdda7[_0x32a6('0x7')]))[_0x32a6('0x1c')](_0x32a6('0x1d'),_0x1fdda7);}};module[_0x32a6('0x1e')]=WhatsappQueue; \ No newline at end of file +var _0xc9e3=['updateRealtime','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','_rr'];(function(_0x501401,_0x2d8737){var _0xfd0a47=function(_0x57decb){while(--_0x57decb){_0x501401['push'](_0x501401['shift']());}};_0xfd0a47(++_0x2d8737);}(_0xc9e3,0x15e));var _0x3c9e=function(_0x12bff8,_0x35b8ee){_0x12bff8=_0x12bff8-0x0;var _0x1a0cd4=_0xc9e3[_0x12bff8];return _0x1a0cd4;};'use strict';var _=require(_0x3c9e('0x0'));var md5=require(_0x3c9e('0x1'));var util=require(_0x3c9e('0x2'));var Redis=require('ioredis');var config=require(_0x3c9e('0x3'));config[_0x3c9e('0x4')]=_['defaults'](config[_0x3c9e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x3c9e('0x5'))(new Redis(config[_0x3c9e('0x4')]));function WhatsappQueue(_0x43ab69){this['id']=_0x43ab69['id']||0x0;this[_0x3c9e('0x6')]=_0x43ab69[_0x3c9e('0x6')]||'';this['timeout']=_0x43ab69[_0x3c9e('0x7')]||0xa;this['strategy']=_0x43ab69[_0x3c9e('0x8')]||'beepall';this[_0x3c9e('0x9')]=_0x43ab69['Agents'];this[_0x3c9e('0xa')]={};this[_0x3c9e('0xb')]=0x0;this[_0x3c9e('0x1')]='';this[_0x3c9e('0xc')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0x3c9e('0xc')]=function(){var _0x131cf6=this[_0x3c9e('0xa')][_0x3c9e('0xd')];this[_0x3c9e('0xa')]=_['map'](this['Agents'],'id');this[_0x3c9e('0xa')]['_rr']=_0x131cf6;};WhatsappQueue['prototype'][_0x3c9e('0xe')]=function(){this[_0x3c9e('0xf')]=0x0;this[_0x3c9e('0x10')]=0x0;for(var _0x460c98=0x0;_0x460c98=0x0?this[_0x3c9e('0x14')]:0x0;var _0x4c23d5={'id':this['id'],'available':this[_0x3c9e('0x14')],'loggedIn':this[_0x3c9e('0xf')],'name':this[_0x3c9e('0x6')],'paused':this['paused'],'waiting':this[_0x3c9e('0xb')]};var _0x3c9fe7=md5(JSON[_0x3c9e('0x15')](_0x4c23d5));if(this[_0x3c9e('0x1')]!==_0x3c9fe7){this[_0x3c9e('0x1')]=_0x3c9fe7;io['to'](util[_0x3c9e('0x16')](_0x3c9e('0x17'),_0x4c23d5[_0x3c9e('0x6')]))[_0x3c9e('0x18')]('whatsapp_queue:save',_0x4c23d5);}};module[_0x3c9e('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 0352b54..1e1d754 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(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7217,0x19e));var _0x7721=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x7217[_0x134c2e];return _0x2825db;};'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 _0x9957=['../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','moment','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/faxQueue'];(function(_0x48a836,_0xa1d010){var _0x249dc8=function(_0x2a95a0){while(--_0x2a95a0){_0x48a836['push'](_0x48a836['shift']());}};_0x249dc8(++_0xa1d010);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var _=require(_0x7995('0x2'));var moment=require(_0x7995('0x3'));var Agent=require('../model/agent');var Interval=require(_0x7995('0x4'));var OpenchannelQueue=require(_0x7995('0x5'));var ChatQueue=require(_0x7995('0x6'));var SmsQueue=require(_0x7995('0x7'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0x7995('0x8'));var WhatsappQueue=require(_0x7995('0x9'));var Realtime=function(){this[_0x7995('0xa')]={};this[_0x7995('0xb')]={};this[_0x7995('0xc')]={};this[_0x7995('0xd')]={};this['smsQueues']={};this[_0x7995('0xe')]={};this[_0x7995('0xf')]={};this['whatsappQueues']={};this[_0x7995('0x10')]={};this[_0x7995('0x11')]={};this[_0x7995('0x12')]={};this[_0x7995('0x13')]={};this[_0x7995('0x14')]={};this[_0x7995('0x15')]={};};function freeIsNotKey(_0x341672,_0x524f7b,_0x245143){var _0x41c652=_['mapKeys'](_0x341672,function(_0xb0c872,_0x2cb37a){return _0xb0c872[_0x245143];});for(var _0x19a27e in _0x524f7b){if(_0x524f7b[_0x7995('0x16')](_0x19a27e)){if(!_0x41c652[_0x19a27e]){delete _0x524f7b[_0x19a27e];}}}}Realtime[_0x7995('0x17')][_0x7995('0x18')]=function(_0x2bbe7a,_0x4cc004){for(var _0x58f5ad in _0x4cc004){if(_0x2bbe7a[_0x7995('0x16')](_0x58f5ad)){_0x2bbe7a[_0x58f5ad]=_0x4cc004[_0x58f5ad];}}};Realtime[_0x7995('0x17')][_0x7995('0x19')]=function(){var _0x321ae8=this;return function(_0x3f1d3e){if(_0x3f1d3e){freeIsNotKey(_0x3f1d3e,_0x321ae8[_0x7995('0xa')],'id');for(var _0x2202ce=0x0,_0x41cbf0={},_0x5377e5={};_0x2202ce<_0x3f1d3e[_0x7995('0x1a')];_0x2202ce+=0x1){_0x41cbf0=_0x3f1d3e[_0x2202ce];if(_['isUndefined'](_0x321ae8[_0x7995('0xa')][_0x41cbf0['id']])){_0x321ae8[_0x7995('0xa')][_0x41cbf0['id']]=new Agent(_0x41cbf0);}else{_0x321ae8[_0x7995('0x18')](_0x321ae8[_0x7995('0xa')][_0x41cbf0['id']],_0x41cbf0);}}}return _0x321ae8[_0x7995('0xa')];};};Realtime[_0x7995('0x17')]['initIntervals']=function(){var _0x54c9ae=this;return function(_0x2536c8){if(_0x2536c8){freeIsNotKey(_0x2536c8,_0x54c9ae['intervals'],'id');for(var _0x555f74=0x0,_0x3ec178={},_0x3d463e={};_0x555f74<_0x2536c8['length'];_0x555f74+=0x1){_0x3ec178=_0x2536c8[_0x555f74];if(_[_0x7995('0x1b')](_0x54c9ae['intervals'][_0x3ec178['id']])){_0x54c9ae['intervals'][_0x3ec178['id']]=new Interval(_0x3ec178);}else{_0x54c9ae[_0x7995('0x18')](_0x54c9ae[_0x7995('0xb')][_0x3ec178['id']],_0x3ec178);}}}return _0x54c9ae[_0x7995('0xb')];};};Realtime[_0x7995('0x17')][_0x7995('0x1c')]=function(){var _0x1c278a=this;return function(_0x5d40ae){if(_0x5d40ae){freeIsNotKey(_0x5d40ae,_0x1c278a[_0x7995('0xc')],'id');for(var _0x46ee4b=0x0,_0x204507={},_0x285437={};_0x46ee4b<_0x5d40ae[_0x7995('0x1a')];_0x46ee4b+=0x1){_0x204507=_0x5d40ae[_0x46ee4b];if(_[_0x7995('0x1b')](_0x1c278a[_0x7995('0xc')][_0x204507['id']])){_0x1c278a[_0x7995('0xc')][_0x204507['id']]=new OpenchannelQueue(_0x204507);}else{_0x1c278a['mergeFromDatabase'](_0x1c278a[_0x7995('0xc')][_0x204507['id']],_0x204507);}_0x1c278a[_0x7995('0xc')][_0x204507['id']][_0x7995('0x1d')]();_0x1c278a[_0x7995('0xc')][_0x204507['id']][_0x7995('0x1e')]();}}return _0x1c278a[_0x7995('0xc')];};};Realtime['prototype'][_0x7995('0x1f')]=function(){var _0x5911c3=this;return function(_0x229742){if(_0x229742){freeIsNotKey(_0x229742,_0x5911c3[_0x7995('0xd')],'id');for(var _0xf16cc2=0x0,_0x132a42={},_0x11c1eb={};_0xf16cc2<_0x229742['length'];_0xf16cc2+=0x1){_0x132a42=_0x229742[_0xf16cc2];if(_[_0x7995('0x1b')](_0x5911c3['chatQueues'][_0x132a42['id']])){_0x5911c3[_0x7995('0xd')][_0x132a42['id']]=new ChatQueue(_0x132a42);}else{_0x5911c3[_0x7995('0x18')](_0x5911c3[_0x7995('0xd')][_0x132a42['id']],_0x132a42);}_0x5911c3['chatQueues'][_0x132a42['id']]['updateRouting']();_0x5911c3['chatQueues'][_0x132a42['id']][_0x7995('0x1e')]();}}return _0x5911c3[_0x7995('0xd')];};};Realtime[_0x7995('0x17')][_0x7995('0x20')]=function(){var _0x2e3493=this;return function(_0x1ca460){if(_0x1ca460){freeIsNotKey(_0x1ca460,_0x2e3493['smsQueues'],'id');for(var _0x481c74=0x0,_0xfa8f15={},_0x5524af={};_0x481c74<_0x1ca460[_0x7995('0x1a')];_0x481c74+=0x1){_0xfa8f15=_0x1ca460[_0x481c74];if(_[_0x7995('0x1b')](_0x2e3493[_0x7995('0x21')][_0xfa8f15['id']])){_0x2e3493[_0x7995('0x21')][_0xfa8f15['id']]=new SmsQueue(_0xfa8f15);}else{_0x2e3493[_0x7995('0x18')](_0x2e3493['smsQueues'][_0xfa8f15['id']],_0xfa8f15);}_0x2e3493[_0x7995('0x21')][_0xfa8f15['id']][_0x7995('0x1d')]();_0x2e3493['smsQueues'][_0xfa8f15['id']]['updateRealtime']();}}return _0x2e3493['smsQueues'];};};Realtime[_0x7995('0x17')][_0x7995('0x22')]=function(){var _0x4a176f=this;return function(_0x3e7020){if(_0x3e7020){freeIsNotKey(_0x3e7020,_0x4a176f['mailQueues'],'id');for(var _0x37917b=0x0,_0x1cb058={},_0x177cb4={};_0x37917b<_0x3e7020['length'];_0x37917b+=0x1){_0x1cb058=_0x3e7020[_0x37917b];if(_['isUndefined'](_0x4a176f[_0x7995('0xe')][_0x1cb058['id']])){_0x4a176f['mailQueues'][_0x1cb058['id']]=new MailQueue(_0x1cb058);}else{_0x4a176f['mergeFromDatabase'](_0x4a176f[_0x7995('0xe')][_0x1cb058['id']],_0x1cb058);}_0x4a176f[_0x7995('0xe')][_0x1cb058['id']]['updateRouting']();_0x4a176f[_0x7995('0xe')][_0x1cb058['id']][_0x7995('0x1e')]();}}return _0x4a176f[_0x7995('0xe')];};};Realtime[_0x7995('0x17')][_0x7995('0x23')]=function(){var _0x53002a=this;return function(_0x2d4285){if(_0x2d4285){freeIsNotKey(_0x2d4285,_0x53002a[_0x7995('0xf')],'id');for(var _0xf612e6=0x0,_0x1d60b8={},_0x4b1541={};_0xf612e6<_0x2d4285[_0x7995('0x1a')];_0xf612e6+=0x1){_0x1d60b8=_0x2d4285[_0xf612e6];if(_[_0x7995('0x1b')](_0x53002a[_0x7995('0xf')][_0x1d60b8['id']])){_0x53002a[_0x7995('0xf')][_0x1d60b8['id']]=new FaxQueue(_0x1d60b8);}else{_0x53002a[_0x7995('0x18')](_0x53002a[_0x7995('0xf')][_0x1d60b8['id']],_0x1d60b8);}_0x53002a['faxQueues'][_0x1d60b8['id']][_0x7995('0x1d')]();_0x53002a[_0x7995('0xf')][_0x1d60b8['id']][_0x7995('0x1e')]();}}return _0x53002a[_0x7995('0xf')];};};Realtime[_0x7995('0x17')][_0x7995('0x24')]=function(){var _0x14d638=this;return function(_0x270c0e){if(_0x270c0e){freeIsNotKey(_0x270c0e,_0x14d638[_0x7995('0x25')],'id');for(var _0x447981=0x0,_0x6fe77b={},_0x270d52={};_0x447981<_0x270c0e[_0x7995('0x1a')];_0x447981+=0x1){_0x6fe77b=_0x270c0e[_0x447981];if(_['isUndefined'](_0x14d638['whatsappQueues'][_0x6fe77b['id']])){_0x14d638[_0x7995('0x25')][_0x6fe77b['id']]=new WhatsappQueue(_0x6fe77b);}else{_0x14d638[_0x7995('0x18')](_0x14d638['whatsappQueues'][_0x6fe77b['id']],_0x6fe77b);}_0x14d638['whatsappQueues'][_0x6fe77b['id']][_0x7995('0x1d')]();_0x14d638['whatsappQueues'][_0x6fe77b['id']]['updateRealtime']();}}return _0x14d638[_0x7995('0x25')];};};module[_0x7995('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 930bb5c..275fecb 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 _0x0111=['UpdateChatInteraction','updateChatInteraction','Request','../client'];(function(_0x531740,_0xc7c725){var _0x4ff0fe=function(_0x3cc04e){while(--_0x3cc04e){_0x531740['push'](_0x531740['shift']());}};_0x4ff0fe(++_0xc7c725);}(_0x0111,0x1df));var _0x1011=function(_0x302537,_0x27c8ea){_0x302537=_0x302537-0x0;var _0x129986=_0x0111[_0x302537];return _0x129986;};'use strict';var client=require(_0x1011('0x0'));exports['update']=function(_0x4c0acf,_0x289354){return client['Request'](_0x1011('0x1'),{'body':_0x289354,'options':{'where':{'id':_0x4c0acf}},'log':_0x1011('0x2')});};exports['addTags']=function(_0x1c951b,_0x4b44f5){return client[_0x1011('0x3')]('AddTagsToChatInteraction',{'body':_0x4b44f5,'options':{'where':{'id':_0x1c951b}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x4624=['updateChatInteraction','addTags','AddTagsToChatInteraction','../client','update','Request','UpdateChatInteraction'];(function(_0x16bea7,_0x326891){var _0x288594=function(_0x2c13bc){while(--_0x2c13bc){_0x16bea7['push'](_0x16bea7['shift']());}};_0x288594(++_0x326891);}(_0x4624,0x106));var _0x4462=function(_0x23b5c1,_0x1861ec){_0x23b5c1=_0x23b5c1-0x0;var _0x2ad62c=_0x4624[_0x23b5c1];return _0x2ad62c;};'use strict';var client=require(_0x4462('0x0'));exports[_0x4462('0x1')]=function(_0x1fe7e2,_0x42a264){return client[_0x4462('0x2')](_0x4462('0x3'),{'body':_0x42a264,'options':{'where':{'id':_0x1fe7e2}},'log':_0x4462('0x4')});};exports[_0x4462('0x5')]=function(_0x174a1c,_0x53ff3){return client[_0x4462('0x2')](_0x4462('0x6'),{'body':_0x53ff3,'options':{'where':{'id':_0x174a1c}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 0acd5d1..4f60965 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 _0x48f4=['CreateChatMessage','../client','create','Request'];(function(_0x4236ca,_0x3414b9){var _0x5ae56e=function(_0x224476){while(--_0x224476){_0x4236ca['push'](_0x4236ca['shift']());}};_0x5ae56e(++_0x3414b9);}(_0x48f4,0xf1));var _0x448f=function(_0x8a7bcb,_0x2cf7d1){_0x8a7bcb=_0x8a7bcb-0x0;var _0x23ccc0=_0x48f4[_0x8a7bcb];return _0x23ccc0;};'use strict';var client=require(_0x448f('0x0'));exports[_0x448f('0x1')]=function(_0x5c57eb){return client[_0x448f('0x2')](_0x448f('0x3'),{'body':_0x5c57eb,'log':'createChatMessage'});}; \ No newline at end of file +var _0x131e=['../client','Request','createChatMessage'];(function(_0x4cbfc3,_0x12425b){var _0x1f6a01=function(_0x452228){while(--_0x452228){_0x4cbfc3['push'](_0x4cbfc3['shift']());}};_0x1f6a01(++_0x12425b);}(_0x131e,0x102));var _0xe131=function(_0x27b14e,_0x57a587){_0x27b14e=_0x27b14e-0x0;var _0x1390a5=_0x131e[_0x27b14e];return _0x1390a5;};'use strict';var client=require(_0xe131('0x0'));exports['create']=function(_0x11676b){return client[_0xe131('0x1')]('CreateChatMessage',{'body':_0x11676b,'log':_0xe131('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 6d72446..21c0b2d 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 _0x2920=['chatPause','../client','getChatQueues','Request','GetChatQueue','name','strategy','User','Agents','online'];(function(_0x8421d1,_0x471099){var _0x3e5e40=function(_0xb7cd31){while(--_0xb7cd31){_0x8421d1['push'](_0x8421d1['shift']());}};_0x3e5e40(++_0x471099);}(_0x2920,0xfb));var _0x0292=function(_0x3c34bf,_0x12e4e2){_0x3c34bf=_0x3c34bf-0x0;var _0x1eeb35=_0x2920[_0x3c34bf];return _0x1eeb35;};'use strict';var client=require(_0x0292('0x0'));exports[_0x0292('0x1')]=function(){return function(){return client[_0x0292('0x2')](_0x0292('0x3'),{'options':{'raw':![],'attributes':['id',_0x0292('0x4'),'timeout',_0x0292('0x5')],'include':[{'model':_0x0292('0x6'),'as':_0x0292('0x7'),'attributes':['id','name',_0x0292('0x8'),_0x0292('0x9')]}]},'log':_0x0292('0x1')});};}; \ No newline at end of file +var _0xde5c=['Request','GetChatQueue','name','timeout','User','Agents','online','chatPause','getChatQueues'];(function(_0x14540b,_0x85d32d){var _0x394822=function(_0x2e9b0e){while(--_0x2e9b0e){_0x14540b['push'](_0x14540b['shift']());}};_0x394822(++_0x85d32d);}(_0xde5c,0x1e5));var _0xcde5=function(_0x23c3f4,_0x24f0b3){_0x23c3f4=_0x23c3f4-0x0;var _0x82f0f1=_0xde5c[_0x23c3f4];return _0x82f0f1;};'use strict';var client=require('../client');exports[_0xcde5('0x0')]=function(){return function(){return client[_0xcde5('0x1')](_0xcde5('0x2'),{'options':{'raw':![],'attributes':['id',_0xcde5('0x3'),_0xcde5('0x4'),'strategy'],'include':[{'model':_0xcde5('0x5'),'as':_0xcde5('0x6'),'attributes':['id',_0xcde5('0x3'),_0xcde5('0x7'),_0xcde5('0x8')]}]},'log':_0xcde5('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index db00a34..9f7185e 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 _0x27c9=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x384d39,_0xf060fc){var _0x13bf22=function(_0x5d83f2){while(--_0x5d83f2){_0x384d39['push'](_0x384d39['shift']());}};_0x13bf22(++_0xf060fc);}(_0x27c9,0x1af));var _0x927c=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x27c9[_0x138adb];return _0x1b27f2;};'use strict';var client=require(_0x927c('0x0'));exports[_0x927c('0x1')]=function(_0x3d23a5){return client[_0x927c('0x2')]('CreateChatQueueReport',{'body':_0x3d23a5,'log':_0x927c('0x3')});};exports[_0x927c('0x4')]=function(_0x591cb0,_0x3a091e){return client[_0x927c('0x2')](_0x927c('0x5'),{'body':_0x3a091e,'options':{'where':{'uniqueid':_0x591cb0},'order':[['id',_0x927c('0x6')]],'limit':0x1},'log':_0x927c('0x5')});}; \ No newline at end of file +var _0x94b1=['CreateChatQueueReport','UpdateChatQueueReport','create','Request'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0x94b1,0x102));var _0x194b=function(_0x29d005,_0x4ebcc6){_0x29d005=_0x29d005-0x0;var _0x328b3b=_0x94b1[_0x29d005];return _0x328b3b;};'use strict';var client=require('../client');exports[_0x194b('0x0')]=function(_0x5525d4){return client[_0x194b('0x1')](_0x194b('0x2'),{'body':_0x5525d4,'log':_0x194b('0x2')});};exports['update']=function(_0x13fda1,_0x3a21be){return client[_0x194b('0x1')](_0x194b('0x3'),{'body':_0x3a21be,'options':{'where':{'uniqueid':_0x13fda1},'order':[['id','DESC']],'limit':0x1},'log':_0x194b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 6e69e43..3290590 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 _0x827d=['addTagsToFaxInteraction','../client','update','Request','UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction'];(function(_0x16d578,_0x3cbca3){var _0x3c0177=function(_0x57032a){while(--_0x57032a){_0x16d578['push'](_0x16d578['shift']());}};_0x3c0177(++_0x3cbca3);}(_0x827d,0xd1));var _0xd827=function(_0x1e2b7b,_0x40f1a4){_0x1e2b7b=_0x1e2b7b-0x0;var _0x1477ad=_0x827d[_0x1e2b7b];return _0x1477ad;};'use strict';var client=require(_0xd827('0x0'));exports[_0xd827('0x1')]=function(_0x4bd4f2,_0x5e5095){return client[_0xd827('0x2')](_0xd827('0x3'),{'body':_0x5e5095,'options':{'where':{'id':_0x4bd4f2}},'log':_0xd827('0x4')});};exports[_0xd827('0x5')]=function(_0x1f78df,_0x25f476){return client[_0xd827('0x2')](_0xd827('0x6'),{'body':_0x25f476,'options':{'where':{'id':_0x1f78df}},'log':_0xd827('0x7')});}; \ No newline at end of file +var _0xfe7b=['../client','Request','UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction'];(function(_0xaead4b,_0x1d94b9){var _0x3fe76e=function(_0x1966b7){while(--_0x1966b7){_0xaead4b['push'](_0xaead4b['shift']());}};_0x3fe76e(++_0x1d94b9);}(_0xfe7b,0x1ab));var _0xbfe7=function(_0x1d3892,_0x47d5fe){_0x1d3892=_0x1d3892-0x0;var _0x574ff2=_0xfe7b[_0x1d3892];return _0x574ff2;};'use strict';var client=require(_0xbfe7('0x0'));exports['update']=function(_0x44115e,_0x95291c){return client[_0xbfe7('0x1')](_0xbfe7('0x2'),{'body':_0x95291c,'options':{'where':{'id':_0x44115e}},'log':_0xbfe7('0x3')});};exports[_0xbfe7('0x4')]=function(_0x4b2737,_0x73b30c){return client[_0xbfe7('0x1')](_0xbfe7('0x5'),{'body':_0x73b30c,'options':{'where':{'id':_0x4b2737}},'log':_0xbfe7('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 0d7b9a8..f85f13c 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 _0xded4=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xded4,0x9e));var _0x4ded=function(_0x15a80c,_0x1ffbcc){_0x15a80c=_0x15a80c-0x0;var _0x1d4863=_0xded4[_0x15a80c];return _0x1d4863;};'use strict';var client=require(_0x4ded('0x0'));exports[_0x4ded('0x1')]=function(_0x2d0783){return client[_0x4ded('0x2')](_0x4ded('0x3'),{'body':_0x2d0783,'log':_0x4ded('0x4')});}; \ No newline at end of file +var _0xbf88=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x50e703,_0x127370){var _0xf1840c=function(_0x1418df){while(--_0x1418df){_0x50e703['push'](_0x50e703['shift']());}};_0xf1840c(++_0x127370);}(_0xbf88,0xc5));var _0x8bf8=function(_0x384b47,_0x6c8913){_0x384b47=_0x384b47-0x0;var _0xd73a96=_0xbf88[_0x384b47];return _0xd73a96;};'use strict';var client=require(_0x8bf8('0x0'));exports[_0x8bf8('0x1')]=function(_0x96aeb){return client[_0x8bf8('0x2')](_0x8bf8('0x3'),{'body':_0x96aeb,'log':_0x8bf8('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 073015f..31c5c5b 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 _0x5d09=['online','faxPause','getFaxQueues','GetFaxQueue','timeout','strategy','User','Agents','name'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5d09,0xec));var _0x95d0=function(_0x3e57ef,_0x388fab){_0x3e57ef=_0x3e57ef-0x0;var _0x5ade66=_0x5d09[_0x3e57ef];return _0x5ade66;};'use strict';var client=require('../client');exports[_0x95d0('0x0')]=function(){return function(){return client['Request'](_0x95d0('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x95d0('0x2'),_0x95d0('0x3')],'include':[{'model':_0x95d0('0x4'),'as':_0x95d0('0x5'),'attributes':['id',_0x95d0('0x6'),_0x95d0('0x7'),_0x95d0('0x8')]}]},'log':_0x95d0('0x0')});};}; \ No newline at end of file +var _0xc27e=['strategy','online','faxPause','../client','getFaxQueues','GetFaxQueue','name','timeout'];(function(_0x4c0a72,_0x540cfe){var _0x24451b=function(_0x1dbcf0){while(--_0x1dbcf0){_0x4c0a72['push'](_0x4c0a72['shift']());}};_0x24451b(++_0x540cfe);}(_0xc27e,0x133));var _0xec27=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc27e[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xec27('0x0'));exports[_0xec27('0x1')]=function(){return function(){return client['Request'](_0xec27('0x2'),{'options':{'raw':![],'attributes':['id',_0xec27('0x3'),_0xec27('0x4'),_0xec27('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xec27('0x3'),_0xec27('0x6'),_0xec27('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 19ec703..1a99526 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 _0xb681=['CreateFaxQueueReport','update','DESC','../client','create','Request'];(function(_0xe5b424,_0x1e1d90){var _0x4470d4=function(_0x19063d){while(--_0x19063d){_0xe5b424['push'](_0xe5b424['shift']());}};_0x4470d4(++_0x1e1d90);}(_0xb681,0x153));var _0x1b68=function(_0x366853,_0x266a61){_0x366853=_0x366853-0x0;var _0x263de4=_0xb681[_0x366853];return _0x263de4;};'use strict';var client=require(_0x1b68('0x0'));exports[_0x1b68('0x1')]=function(_0x115ed6){return client[_0x1b68('0x2')](_0x1b68('0x3'),{'body':_0x115ed6,'log':_0x1b68('0x3')});};exports[_0x1b68('0x4')]=function(_0xf7f494,_0x4085f4){return client[_0x1b68('0x2')]('UpdateFaxQueueReport',{'body':_0x4085f4,'options':{'where':{'uniqueid':_0xf7f494},'order':[['id',_0x1b68('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x6863=['DESC','../client','create','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x2fe2b0,_0x278230){var _0x30eb7d=function(_0x160c14){while(--_0x160c14){_0x2fe2b0['push'](_0x2fe2b0['shift']());}};_0x30eb7d(++_0x278230);}(_0x6863,0xd9));var _0x3686=function(_0x5e6432,_0x29db2e){_0x5e6432=_0x5e6432-0x0;var _0x2cfd9d=_0x6863[_0x5e6432];return _0x2cfd9d;};'use strict';var client=require(_0x3686('0x0'));exports[_0x3686('0x1')]=function(_0x2bfe36){return client['Request']('CreateFaxQueueReport',{'body':_0x2bfe36,'log':_0x3686('0x2')});};exports[_0x3686('0x3')]=function(_0x53ea9c,_0x1eb8e2){return client['Request'](_0x3686('0x4'),{'body':_0x1eb8e2,'options':{'where':{'uniqueid':_0x53ea9c},'order':[['id',_0x3686('0x5')]],'limit':0x1},'log':_0x3686('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 83b0cf9..20cbce6 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 _0x6ae2=['GetInterval','name','Interval','Intervals','interval','../client','getIntervals','Request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6ae2,0x1ed));var _0x26ae=function(_0xa5b38f,_0x288859){_0xa5b38f=_0xa5b38f-0x0;var _0x4a2762=_0x6ae2[_0xa5b38f];return _0x4a2762;};'use strict';var client=require(_0x26ae('0x0'));exports[_0x26ae('0x1')]=function(){return function(){return client[_0x26ae('0x2')](_0x26ae('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x26ae('0x4')],'include':[{'model':_0x26ae('0x5'),'as':_0x26ae('0x6'),'attributes':['id',_0x26ae('0x4'),_0x26ae('0x7')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0xb58b=['Request','GetInterval','Interval','Intervals','interval','getIntervals'];(function(_0x5844c3,_0x13fc8c){var _0x3a4d56=function(_0x24328e){while(--_0x24328e){_0x5844c3['push'](_0x5844c3['shift']());}};_0x3a4d56(++_0x13fc8c);}(_0xb58b,0x1f1));var _0xbb58=function(_0x3c903d,_0x2389fd){_0x3c903d=_0x3c903d-0x0;var _0x46fab0=_0xb58b[_0x3c903d];return _0x46fab0;};'use strict';var client=require('../client');exports[_0xbb58('0x0')]=function(){return function(){return client[_0xbb58('0x1')](_0xbb58('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xbb58('0x3'),'as':_0xbb58('0x4'),'attributes':['id','name',_0xbb58('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index dde7771..be15d9e 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 _0xe745=['update','Request','UpdateMailInteraction','addTags','../client'];(function(_0x28cba1,_0x33cd94){var _0x575740=function(_0x2a9c0c){while(--_0x2a9c0c){_0x28cba1['push'](_0x28cba1['shift']());}};_0x575740(++_0x33cd94);}(_0xe745,0x9a));var _0x5e74=function(_0x5b5dfd,_0x5dfa67){_0x5b5dfd=_0x5b5dfd-0x0;var _0xb156f8=_0xe745[_0x5b5dfd];return _0xb156f8;};'use strict';var client=require(_0x5e74('0x0'));exports[_0x5e74('0x1')]=function(_0x57460a,_0x10e024){return client[_0x5e74('0x2')](_0x5e74('0x3'),{'body':_0x10e024,'options':{'where':{'id':_0x57460a}},'log':'updateMailInteraction'});};exports[_0x5e74('0x4')]=function(_0x21256a,_0x4a4b40){return client[_0x5e74('0x2')]('AddTagsToMailInteraction',{'body':_0x4a4b40,'options':{'where':{'id':_0x21256a}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xc3bc=['updateMailInteraction','AddTagsToMailInteraction','../client','update','Request'];(function(_0x109da9,_0x1b3921){var _0x459857=function(_0x400e54){while(--_0x400e54){_0x109da9['push'](_0x109da9['shift']());}};_0x459857(++_0x1b3921);}(_0xc3bc,0x1c4));var _0xcc3b=function(_0x3b11d0,_0x43cc28){_0x3b11d0=_0x3b11d0-0x0;var _0x29f83d=_0xc3bc[_0x3b11d0];return _0x29f83d;};'use strict';var client=require(_0xcc3b('0x0'));exports[_0xcc3b('0x1')]=function(_0x23e39e,_0x13dc39){return client[_0xcc3b('0x2')]('UpdateMailInteraction',{'body':_0x13dc39,'options':{'where':{'id':_0x23e39e}},'log':_0xcc3b('0x3')});};exports['addTags']=function(_0x49ed93,_0x4232f0){return client['Request'](_0xcc3b('0x4'),{'body':_0x4232f0,'options':{'where':{'id':_0x49ed93}},'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 2469c40..7820e87 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 _0xbea7=['../client','Request','CreateMailMessage'];(function(_0x20d46d,_0x4f4fe8){var _0x136cf3=function(_0x14db26){while(--_0x14db26){_0x20d46d['push'](_0x20d46d['shift']());}};_0x136cf3(++_0x4f4fe8);}(_0xbea7,0x87));var _0x7bea=function(_0x184d2a,_0x30772c){_0x184d2a=_0x184d2a-0x0;var _0x41b24d=_0xbea7[_0x184d2a];return _0x41b24d;};'use strict';var client=require(_0x7bea('0x0'));exports['create']=function(_0x1db38c){return client[_0x7bea('0x1')](_0x7bea('0x2'),{'body':_0x1db38c,'log':'createMailMessage'});}; \ No newline at end of file +var _0x435a=['../client','create','createMailMessage'];(function(_0x2b9ccf,_0x84134d){var _0x12fa91=function(_0xbdafb2){while(--_0xbdafb2){_0x2b9ccf['push'](_0x2b9ccf['shift']());}};_0x12fa91(++_0x84134d);}(_0x435a,0x1ad));var _0xa435=function(_0x1d7973,_0x357676){_0x1d7973=_0x1d7973-0x0;var _0x43190c=_0x435a[_0x1d7973];return _0x43190c;};'use strict';var client=require(_0xa435('0x0'));exports[_0xa435('0x1')]=function(_0x64c578){return client['Request']('CreateMailMessage',{'body':_0x64c578,'log':_0xa435('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 7e44e4d..7c06ed7 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 _0xebc7=['online','mailPause','../client','getMailQueues','Request','GetMailQueue','User','Agents','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xebc7,0x14f));var _0x7ebc=function(_0x295ce3,_0xdd529b){_0x295ce3=_0x295ce3-0x0;var _0x2c1172=_0xebc7[_0x295ce3];return _0x2c1172;};'use strict';var client=require(_0x7ebc('0x0'));exports[_0x7ebc('0x1')]=function(){return function(){return client[_0x7ebc('0x2')](_0x7ebc('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x7ebc('0x4'),'as':_0x7ebc('0x5'),'attributes':['id',_0x7ebc('0x6'),_0x7ebc('0x7'),_0x7ebc('0x8')]}]},'log':_0x7ebc('0x1')});};}; \ No newline at end of file +var _0x9979=['Agents','mailPause','getMailQueues','../client','Request','GetMailQueue','name','strategy'];(function(_0x1eb355,_0x655b0f){var _0x29b854=function(_0x452186){while(--_0x452186){_0x1eb355['push'](_0x1eb355['shift']());}};_0x29b854(++_0x655b0f);}(_0x9979,0x163));var _0x9997=function(_0x27d7e4,_0x500749){_0x27d7e4=_0x27d7e4-0x0;var _0x4f7d26=_0x9979[_0x27d7e4];return _0x4f7d26;};'use strict';var client=require(_0x9997('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x9997('0x1')](_0x9997('0x2'),{'options':{'raw':![],'attributes':['id',_0x9997('0x3'),'timeout',_0x9997('0x4')],'include':[{'model':'User','as':_0x9997('0x5'),'attributes':['id','name','online',_0x9997('0x6')]}]},'log':_0x9997('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 3ddaa9e..3422363 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 _0x0054=['Request','DESC','UpdateMailQueueReport','create','CreateMailQueueReport','update'];(function(_0x4b2cc6,_0x29ef43){var _0x3e0b08=function(_0x3b4131){while(--_0x3b4131){_0x4b2cc6['push'](_0x4b2cc6['shift']());}};_0x3e0b08(++_0x29ef43);}(_0x0054,0x135));var _0x4005=function(_0x2c32a7,_0x5b6f6e){_0x2c32a7=_0x2c32a7-0x0;var _0x4216ad=_0x0054[_0x2c32a7];return _0x4216ad;};'use strict';var client=require('../client');exports[_0x4005('0x0')]=function(_0x6b3364){return client['Request']('CreateMailQueueReport',{'body':_0x6b3364,'log':_0x4005('0x1')});};exports[_0x4005('0x2')]=function(_0x30ff87,_0x19f535){return client[_0x4005('0x3')]('UpdateMailQueueReport',{'body':_0x19f535,'options':{'where':{'uniqueid':_0x30ff87},'order':[['id',_0x4005('0x4')]],'limit':0x1},'log':_0x4005('0x5')});}; \ No newline at end of file +var _0xcb43=['DESC','../client','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x3d34f0,_0x4a5dc0){var _0x135ecd=function(_0x9a81d5){while(--_0x9a81d5){_0x3d34f0['push'](_0x3d34f0['shift']());}};_0x135ecd(++_0x4a5dc0);}(_0xcb43,0x109));var _0x3cb4=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xcb43[_0x35da42];return _0x370035;};'use strict';var client=require(_0x3cb4('0x0'));exports['create']=function(_0x73fc55){return client[_0x3cb4('0x1')](_0x3cb4('0x2'),{'body':_0x73fc55,'log':_0x3cb4('0x2')});};exports[_0x3cb4('0x3')]=function(_0x51e428,_0xa3d141){return client[_0x3cb4('0x1')](_0x3cb4('0x4'),{'body':_0xa3d141,'options':{'where':{'uniqueid':_0x51e428},'order':[['id',_0x3cb4('0x5')]],'limit':0x1},'log':_0x3cb4('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 1f53230..379db8d 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 _0x3402=['update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','addTagsToChatInteraction'];(function(_0x58eb6e,_0x314940){var _0x5d2637=function(_0x5d8d01){while(--_0x5d8d01){_0x58eb6e['push'](_0x58eb6e['shift']());}};_0x5d2637(++_0x314940);}(_0x3402,0x180));var _0x2340=function(_0x59a34c,_0x212ba2){_0x59a34c=_0x59a34c-0x0;var _0x1eabaa=_0x3402[_0x59a34c];return _0x1eabaa;};'use strict';var client=require('../client');exports[_0x2340('0x0')]=function(_0x401a47,_0x3dee98){return client[_0x2340('0x1')](_0x2340('0x2'),{'body':_0x3dee98,'options':{'where':{'id':_0x401a47}},'log':_0x2340('0x3')});};exports[_0x2340('0x4')]=function(_0x36b204,_0x2745aa){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x2745aa,'options':{'where':{'id':_0x36b204}},'log':_0x2340('0x5')});}; \ No newline at end of file +var _0xf738=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update'];(function(_0x32e39f,_0x4d6c6c){var _0x579277=function(_0x19d3f0){while(--_0x19d3f0){_0x32e39f['push'](_0x32e39f['shift']());}};_0x579277(++_0x4d6c6c);}(_0xf738,0x1d3));var _0x8f73=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xf738[_0x36dfbd];return _0x4ecad9;};'use strict';var client=require('../client');exports[_0x8f73('0x0')]=function(_0x4aaeb4,_0x9a8168){return client['Request'](_0x8f73('0x1'),{'body':_0x9a8168,'options':{'where':{'id':_0x4aaeb4}},'log':_0x8f73('0x2')});};exports['addTags']=function(_0x2c7743,_0x30065d){return client[_0x8f73('0x3')](_0x8f73('0x4'),{'body':_0x30065d,'options':{'where':{'id':_0x2c7743}},'log':_0x8f73('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index f043ee2..7e5ec8b 100644 --- a/server/services/routing/rpc/openchannelMessage.js +++ b/server/services/routing/rpc/openchannelMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['create','Request','createOpenchannelMessage','../client'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0xaa88,0x137));var _0x8aa8=function(_0x4d0662,_0x145963){_0x4d0662=_0x4d0662-0x0;var _0x6eea6d=_0xaa88[_0x4d0662];return _0x6eea6d;};'use strict';var client=require(_0x8aa8('0x0'));exports[_0x8aa8('0x1')]=function(_0x1643a6){return client[_0x8aa8('0x2')]('CreateOpenchannelMessage',{'body':_0x1643a6,'log':_0x8aa8('0x3')});}; \ No newline at end of file +var _0xe14d=['Request','createOpenchannelMessage','../client','create'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe14d,0x1ee));var _0xde14=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xe14d[_0x4e9628];return _0x27bc8c;};'use strict';var client=require(_0xde14('0x0'));exports[_0xde14('0x1')]=function(_0x1b5d3b){return client[_0xde14('0x2')]('CreateOpenchannelMessage',{'body':_0x1b5d3b,'log':_0xde14('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index d2d0068..a2625b2 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 _0x49ee=['online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','User','Agents'];(function(_0x559a80,_0x3d193d){var _0x42f555=function(_0x24e596){while(--_0x24e596){_0x559a80['push'](_0x559a80['shift']());}};_0x42f555(++_0x3d193d);}(_0x49ee,0x65));var _0xe49e=function(_0x42b2c6,_0x136325){_0x42b2c6=_0x42b2c6-0x0;var _0x2430e5=_0x49ee[_0x42b2c6];return _0x2430e5;};'use strict';var client=require('../client');exports[_0xe49e('0x0')]=function(){return function(){return client[_0xe49e('0x1')](_0xe49e('0x2'),{'options':{'raw':![],'attributes':['id',_0xe49e('0x3'),'timeout',_0xe49e('0x4')],'include':[{'model':_0xe49e('0x5'),'as':_0xe49e('0x6'),'attributes':['id',_0xe49e('0x3'),_0xe49e('0x7'),_0xe49e('0x8')]}]},'log':_0xe49e('0x0')});};}; \ No newline at end of file +var _0xec90=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','User','name','online'];(function(_0x113889,_0x510257){var _0x3816cf=function(_0x576d70){while(--_0x576d70){_0x113889['push'](_0x113889['shift']());}};_0x3816cf(++_0x510257);}(_0xec90,0x99));var _0x0ec9=function(_0xeb56e0,_0x242ed0){_0xeb56e0=_0xeb56e0-0x0;var _0xc9e71d=_0xec90[_0xeb56e0];return _0xc9e71d;};'use strict';var client=require(_0x0ec9('0x0'));exports[_0x0ec9('0x1')]=function(){return function(){return client[_0x0ec9('0x2')](_0x0ec9('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x0ec9('0x4'),_0x0ec9('0x5')],'include':[{'model':_0x0ec9('0x6'),'as':'Agents','attributes':['id',_0x0ec9('0x7'),_0x0ec9('0x8'),'openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index da9f575..8857838 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 _0x3e25=['../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x2ccdb9,_0x1e3e48){var _0x5354aa=function(_0x1414c1){while(--_0x1414c1){_0x2ccdb9['push'](_0x2ccdb9['shift']());}};_0x5354aa(++_0x1e3e48);}(_0x3e25,0x9a));var _0x53e2=function(_0x18c5cc,_0x451765){_0x18c5cc=_0x18c5cc-0x0;var _0x47a40a=_0x3e25[_0x18c5cc];return _0x47a40a;};'use strict';var client=require(_0x53e2('0x0'));exports[_0x53e2('0x1')]=function(_0x5efbf9){return client[_0x53e2('0x2')]('CreateOpenchannelQueueReport',{'body':_0x5efbf9,'log':_0x53e2('0x3')});};exports[_0x53e2('0x4')]=function(_0x3bf778,_0x576ad1){return client['Request'](_0x53e2('0x5'),{'body':_0x576ad1,'options':{'where':{'uniqueid':_0x3bf778},'order':[['id',_0x53e2('0x6')]],'limit':0x1},'log':_0x53e2('0x5')});}; \ No newline at end of file +var _0x114c=['DESC','../client','Request','update','UpdateOpenchannelQueueReport'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x114c,0x141));var _0xc114=function(_0x50c5b7,_0x5422cd){_0x50c5b7=_0x50c5b7-0x0;var _0x1b2209=_0x114c[_0x50c5b7];return _0x1b2209;};'use strict';var client=require(_0xc114('0x0'));exports['create']=function(_0x1fca94){return client[_0xc114('0x1')]('CreateOpenchannelQueueReport',{'body':_0x1fca94,'log':'CreateOpenchannelQueueReport'});};exports[_0xc114('0x2')]=function(_0x889b2b,_0x2f6f9e){return client['Request'](_0xc114('0x3'),{'body':_0x2f6f9e,'options':{'where':{'uniqueid':_0x889b2b},'order':[['id',_0xc114('0x4')]],'limit':0x1},'log':_0xc114('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 413f711..4cab675 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 _0xcad3=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x4770ce,_0x2da54c){var _0x58fcac=function(_0x27cfa4){while(--_0x27cfa4){_0x4770ce['push'](_0x4770ce['shift']());}};_0x58fcac(++_0x2da54c);}(_0xcad3,0x153));var _0x3cad=function(_0x1c0781,_0x4a19f1){_0x1c0781=_0x1c0781-0x0;var _0x1f577e=_0xcad3[_0x1c0781];return _0x1f577e;};'use strict';var client=require('../client');exports[_0x3cad('0x0')]=function(_0x10ca82,_0xeb741e){return client[_0x3cad('0x1')](_0x3cad('0x2'),{'body':_0xeb741e,'options':{'where':{'id':_0x10ca82}},'log':_0x3cad('0x3')});};exports[_0x3cad('0x4')]=function(_0x38f63a,_0x5a015f){return client[_0x3cad('0x1')](_0x3cad('0x5'),{'body':_0x5a015f,'options':{'where':{'id':_0x38f63a}},'log':_0x3cad('0x6')});}; \ No newline at end of file +var _0x81c9=['../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x43ea46,_0x1e3fa2){var _0x445c85=function(_0x3ed5ea){while(--_0x3ed5ea){_0x43ea46['push'](_0x43ea46['shift']());}};_0x445c85(++_0x1e3fa2);}(_0x81c9,0x188));var _0x981c=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x81c9[_0x4b2863];return _0x567d67;};'use strict';var client=require(_0x981c('0x0'));exports[_0x981c('0x1')]=function(_0x45c5a3,_0x4ff24b){return client[_0x981c('0x2')](_0x981c('0x3'),{'body':_0x4ff24b,'options':{'where':{'id':_0x45c5a3}},'log':_0x981c('0x4')});};exports[_0x981c('0x5')]=function(_0x204de5,_0x3cab5e){return client[_0x981c('0x2')](_0x981c('0x6'),{'body':_0x3cab5e,'options':{'where':{'id':_0x204de5}},'log':_0x981c('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index f84de9d..e1f0dac 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 _0xea1c=['createSmsMessage','create','Request','CreateSmsMessage'];(function(_0x49df7d,_0x29351b){var _0x3bd5c8=function(_0x5264a2){while(--_0x5264a2){_0x49df7d['push'](_0x49df7d['shift']());}};_0x3bd5c8(++_0x29351b);}(_0xea1c,0xc1));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xcea1('0x0')]=function(_0x1451f7){return client[_0xcea1('0x1')](_0xcea1('0x2'),{'body':_0x1451f7,'log':_0xcea1('0x3')});}; \ No newline at end of file +var _0x51aa=['Request','CreateSmsMessage','../client','create'];(function(_0x29c2c9,_0x120194){var _0x16e8e6=function(_0x893934){while(--_0x893934){_0x29c2c9['push'](_0x29c2c9['shift']());}};_0x16e8e6(++_0x120194);}(_0x51aa,0x1da));var _0xa51a=function(_0x1f345f,_0x23c133){_0x1f345f=_0x1f345f-0x0;var _0x404f91=_0x51aa[_0x1f345f];return _0x404f91;};'use strict';var client=require(_0xa51a('0x0'));exports[_0xa51a('0x1')]=function(_0x5399e1){return client[_0xa51a('0x2')](_0xa51a('0x3'),{'body':_0x5399e1,'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 7dc22b1..14522f5 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 _0xb073=['GetSmsQueue','name','timeout','User','Agents','smsPause','getSmsQueues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb073,0x187));var _0x3b07=function(_0x42bfb7,_0x25a3ec){_0x42bfb7=_0x42bfb7-0x0;var _0x5c497d=_0xb073[_0x42bfb7];return _0x5c497d;};'use strict';var client=require('../client');exports[_0x3b07('0x0')]=function(){return function(){return client['Request'](_0x3b07('0x1'),{'options':{'raw':![],'attributes':['id',_0x3b07('0x2'),_0x3b07('0x3'),'strategy'],'include':[{'model':_0x3b07('0x4'),'as':_0x3b07('0x5'),'attributes':['id',_0x3b07('0x2'),'online',_0x3b07('0x6')]}]},'log':_0x3b07('0x0')});};}; \ No newline at end of file +var _0x44cd=['online','../client','getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','User','Agents'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x44cd,0xd3));var _0xd44c=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x44cd[_0x2642cb];return _0xe6e41;};'use strict';var client=require(_0xd44c('0x0'));exports[_0xd44c('0x1')]=function(){return function(){return client[_0xd44c('0x2')](_0xd44c('0x3'),{'options':{'raw':![],'attributes':['id',_0xd44c('0x4'),_0xd44c('0x5'),_0xd44c('0x6')],'include':[{'model':_0xd44c('0x7'),'as':_0xd44c('0x8'),'attributes':['id','name',_0xd44c('0x9'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index e9d80e1..34f2e56 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 _0xc4b0=['DESC','../client','Request','CreateSmsQueueReport','UpdateSmsQueueReport'];(function(_0x43c0d8,_0x59449e){var _0x255aaf=function(_0x204b32){while(--_0x204b32){_0x43c0d8['push'](_0x43c0d8['shift']());}};_0x255aaf(++_0x59449e);}(_0xc4b0,0xfb));var _0x0c4b=function(_0x1d77b2,_0x3d03e4){_0x1d77b2=_0x1d77b2-0x0;var _0x3c3341=_0xc4b0[_0x1d77b2];return _0x3c3341;};'use strict';var client=require(_0x0c4b('0x0'));exports['create']=function(_0x3eba0b){return client[_0x0c4b('0x1')](_0x0c4b('0x2'),{'body':_0x3eba0b,'log':_0x0c4b('0x2')});};exports['update']=function(_0xa04c22,_0xc8918e){return client[_0x0c4b('0x1')](_0x0c4b('0x3'),{'body':_0xc8918e,'options':{'where':{'uniqueid':_0xa04c22},'order':[['id',_0x0c4b('0x4')]],'limit':0x1},'log':_0x0c4b('0x3')});}; \ No newline at end of file +var _0xbbdd=['DESC','UpdateSmsQueueReport','create','Request','CreateSmsQueueReport'];(function(_0x2a3373,_0x56df99){var _0x3bd188=function(_0x1dd8d9){while(--_0x1dd8d9){_0x2a3373['push'](_0x2a3373['shift']());}};_0x3bd188(++_0x56df99);}(_0xbbdd,0x1ba));var _0xdbbd=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xbbdd[_0x5f1391];return _0x50ebe3;};'use strict';var client=require('../client');exports[_0xdbbd('0x0')]=function(_0x4de3d6){return client[_0xdbbd('0x1')](_0xdbbd('0x2'),{'body':_0x4de3d6,'log':'CreateSmsQueueReport'});};exports['update']=function(_0x510732,_0x2af007){return client['Request']('UpdateSmsQueueReport',{'body':_0x2af007,'options':{'where':{'uniqueid':_0x510732},'order':[['id',_0xdbbd('0x3')]],'limit':0x1},'log':_0xdbbd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index de38167..a973c69 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 _0x09db=['chatPause','mailPause','whatsappPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','../client','getAgents','GetUser','name','pauseType','lastPauseAt','voicePause'];(function(_0x2d5e69,_0x2c2fb8){var _0x80477b=function(_0x2254f4){while(--_0x2254f4){_0x2d5e69['push'](_0x2d5e69['shift']());}};_0x80477b(++_0x2c2fb8);}(_0x09db,0x1ab));var _0xb09d=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x09db[_0x243b2f];return _0xcb3c2d;};'use strict';var client=require(_0xb09d('0x0'));exports[_0xb09d('0x1')]=function(){return function(){return client['Request'](_0xb09d('0x2'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0xb09d('0x3'),'online',_0xb09d('0x4'),_0xb09d('0x5'),_0xb09d('0x6'),_0xb09d('0x7'),_0xb09d('0x8'),'faxPause','smsPause',_0xb09d('0x9'),'openchannelPause',_0xb09d('0xa'),_0xb09d('0xb'),_0xb09d('0xc'),_0xb09d('0xd'),'whatsappCapacity','openchannelCapacity']},'log':_0xb09d('0x1')});};}; \ No newline at end of file +var _0x7347=['faxPause','smsPause','whatsappPause','openchannelPause','chatCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','agent','name','online','lastPauseAt','voicePause','mailPause'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x7347,0x100));var _0x7734=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x7347[_0x45d3f0];return _0x314b79;};'use strict';var client=require(_0x7734('0x0'));exports[_0x7734('0x1')]=function(){return function(){return client[_0x7734('0x2')](_0x7734('0x3'),{'options':{'raw':!![],'where':{'role':_0x7734('0x4')},'attributes':['id',_0x7734('0x5'),_0x7734('0x6'),'pauseType',_0x7734('0x7'),_0x7734('0x8'),'chatPause',_0x7734('0x9'),_0x7734('0xa'),_0x7734('0xb'),_0x7734('0xc'),_0x7734('0xd'),_0x7734('0xe'),'mailCapacity',_0x7734('0xf'),_0x7734('0x10'),_0x7734('0x11'),_0x7734('0x12')]},'log':_0x7734('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index ff525b9..5809913 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 _0xb4e6=['update','Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x527e02,_0x3ed694){var _0x2e4b49=function(_0x8075bf){while(--_0x8075bf){_0x527e02['push'](_0x527e02['shift']());}};_0x2e4b49(++_0x3ed694);}(_0xb4e6,0xd8));var _0x6b4e=function(_0x493a51,_0x45128c){_0x493a51=_0x493a51-0x0;var _0xc85756=_0xb4e6[_0x493a51];return _0xc85756;};'use strict';var client=require(_0x6b4e('0x0'));exports[_0x6b4e('0x1')]=function(_0x3c385b,_0x9babca){return client[_0x6b4e('0x2')](_0x6b4e('0x3'),{'body':_0x9babca,'options':{'where':{'id':_0x3c385b}},'log':'updateWhatsappInteraction'});};exports[_0x6b4e('0x4')]=function(_0x55df8c,_0x1f75ee){return client[_0x6b4e('0x2')](_0x6b4e('0x5'),{'body':_0x1f75ee,'options':{'where':{'id':_0x55df8c}},'log':_0x6b4e('0x6')});}; \ No newline at end of file +var _0xdadd=['AddTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xdadd,0x1c8));var _0xddad=function(_0x4828f3,_0x5774b6){_0x4828f3=_0x4828f3-0x0;var _0x8a2a6=_0xdadd[_0x4828f3];return _0x8a2a6;};'use strict';var client=require(_0xddad('0x0'));exports['update']=function(_0x34afe8,_0x5cafca){return client[_0xddad('0x1')](_0xddad('0x2'),{'body':_0x5cafca,'options':{'where':{'id':_0x34afe8}},'log':_0xddad('0x3')});};exports['addTags']=function(_0x3d18f1,_0xa6ab61){return client[_0xddad('0x1')](_0xddad('0x4'),{'body':_0xa6ab61,'options':{'where':{'id':_0x3d18f1}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index ca14029..f93e94c 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 _0xd32c=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x13a2e4,_0x1a0df4){var _0x427d03=function(_0x165e52){while(--_0x165e52){_0x13a2e4['push'](_0x13a2e4['shift']());}};_0x427d03(++_0x1a0df4);}(_0xd32c,0x176));var _0xcd32=function(_0x516f4f,_0x29f1c6){_0x516f4f=_0x516f4f-0x0;var _0x10851d=_0xd32c[_0x516f4f];return _0x10851d;};'use strict';var client=require(_0xcd32('0x0'));exports[_0xcd32('0x1')]=function(_0x137671){return client[_0xcd32('0x2')](_0xcd32('0x3'),{'body':_0x137671,'log':_0xcd32('0x4')});}; \ No newline at end of file +var _0x55c3=['../client','CreateWhatsappMessage'];(function(_0x480243,_0x4464be){var _0x57ce35=function(_0x3bc08f){while(--_0x3bc08f){_0x480243['push'](_0x480243['shift']());}};_0x57ce35(++_0x4464be);}(_0x55c3,0x1ec));var _0x355c=function(_0x559366,_0x57f695){_0x559366=_0x559366-0x0;var _0x1fec7e=_0x55c3[_0x559366];return _0x1fec7e;};'use strict';var client=require(_0x355c('0x0'));exports['create']=function(_0x2b4b43){return client['Request'](_0x355c('0x1'),{'body':_0x2b4b43,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 246fd6f..13018d4 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 _0x80ed=['strategy','User','Agents','whatsappPause','getWhatsappQueues','../client','Request','GetWhatsappQueue','name'];(function(_0x2a8122,_0xd957e){var _0x49a5c7=function(_0x12ab58){while(--_0x12ab58){_0x2a8122['push'](_0x2a8122['shift']());}};_0x49a5c7(++_0xd957e);}(_0x80ed,0x11c));var _0xd80e=function(_0x25c06e,_0x40cda5){_0x25c06e=_0x25c06e-0x0;var _0x32a041=_0x80ed[_0x25c06e];return _0x32a041;};'use strict';var client=require(_0xd80e('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0xd80e('0x1')](_0xd80e('0x2'),{'options':{'raw':![],'attributes':['id',_0xd80e('0x3'),'timeout',_0xd80e('0x4')],'include':[{'model':_0xd80e('0x5'),'as':_0xd80e('0x6'),'attributes':['id',_0xd80e('0x3'),'online',_0xd80e('0x7')]}]},'log':_0xd80e('0x8')});};}; \ No newline at end of file +var _0x6f2f=['timeout','Agents','name','online','../client','getWhatsappQueues'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x6f2f[_0x3de8a4];return _0x4635cf;};'use strict';var client=require(_0xf6f2('0x0'));exports[_0xf6f2('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0xf6f2('0x2'),'strategy'],'include':[{'model':'User','as':_0xf6f2('0x3'),'attributes':['id',_0xf6f2('0x4'),_0xf6f2('0x5'),'whatsappPause']}]},'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 b8f155c..0f732a7 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 _0x5231=['UpdateWhatsappQueueReport','../client','Request','CreateWhatsappQueueReport','update'];(function(_0x511211,_0x392bf6){var _0x585d44=function(_0x1f24bf){while(--_0x1f24bf){_0x511211['push'](_0x511211['shift']());}};_0x585d44(++_0x392bf6);}(_0x5231,0x16e));var _0x1523=function(_0x2412fe,_0x344b72){_0x2412fe=_0x2412fe-0x0;var _0x231e29=_0x5231[_0x2412fe];return _0x231e29;};'use strict';var client=require(_0x1523('0x0'));exports['create']=function(_0x4b5816){return client[_0x1523('0x1')](_0x1523('0x2'),{'body':_0x4b5816,'log':_0x1523('0x2')});};exports[_0x1523('0x3')]=function(_0x418622,_0x5e1f07){return client[_0x1523('0x1')](_0x1523('0x4'),{'body':_0x5e1f07,'options':{'where':{'uniqueid':_0x418622},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xb1bb=['UpdateWhatsappQueueReport','DESC','create','Request','update'];(function(_0xff6e94,_0x367814){var _0x3d08e4=function(_0x500e7d){while(--_0x500e7d){_0xff6e94['push'](_0xff6e94['shift']());}};_0x3d08e4(++_0x367814);}(_0xb1bb,0xd4));var _0xbb1b=function(_0x36f15c,_0x16c770){_0x36f15c=_0x36f15c-0x0;var _0x396e01=_0xb1bb[_0x36f15c];return _0x396e01;};'use strict';var client=require('../client');exports[_0xbb1b('0x0')]=function(_0x485ab1){return client[_0xbb1b('0x1')]('CreateWhatsappQueueReport',{'body':_0x485ab1,'log':'CreateWhatsappQueueReport'});};exports[_0xbb1b('0x2')]=function(_0x2a4d48,_0x2cf7e5){return client['Request'](_0xbb1b('0x3'),{'body':_0x2cf7e5,'options':{'where':{'uniqueid':_0x2a4d48},'order':[['id',_0xbb1b('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ 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 88db036..9602d3f 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 _0x71fd=['stop','find','agents','timeout','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','map','message','join'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x71fd,0x1da));var _0xd71f=function(_0x4f025f,_0x274149){_0x4f025f=_0x4f025f-0x0;var _0x143048=_0x71fd[_0x4f025f];return _0x143048;};'use strict';var schema=require(_0xd71f('0x0'));var _=require(_0xd71f('0x1'));var util=require(_0xd71f('0x2'));var seqqueue=require('seq-queue');var logger=require(_0xd71f('0x3'))('routing');var strategy=require(_0xd71f('0x4'));var queue=schema({'name':{'type':_0xd71f('0x5'),'required':!![],'message':_0xd71f('0x6')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x116840,_0x14a089,_0x9c7e9f){return logger[_0xd71f('0x7')](util[_0xd71f('0x8')](_0xd71f('0x9'),_0x116840,_0x14a089[_0xd71f('0xa')],_0x9c7e9f));}function handleFindAgent(_0x10e7d3){return function(_0x3deaf9){return _0x3deaf9['name'][_0xd71f('0xb')]()===_0x10e7d3[_0xd71f('0xb')]();};}exports['consequence']=function(_0x503650,_0x37b19a,_0x26eb6c,_0x2c056f){return function(_0x23e742){try{var _0x1afd17={'name':_0x37b19a[0x0],'timeout':_0x37b19a[0x1]};var _0x573d02=queue[_0xd71f('0x0')](_0x1afd17,{'typecast':!![]});if(_0x573d02[_0xd71f('0xc')]){logger['error']('[%s][AGENT]\x20%s',_0x503650,_[_0xd71f('0xd')](_0x573d02,_0xd71f('0xe'))[_0xd71f('0xf')](',\x20'));_0x23e742[_0xd71f('0x10')]();}else{var _0x1eb45d=_[_0xd71f('0x11')](_0x26eb6c[_0xd71f('0x12')],handleFindAgent(_0x1afd17['name']));if(_0x1eb45d){var _0x5042dd=(_0x1afd17[_0xd71f('0x13')]||0xa)*0x3e8;var _0x3c4bcc,_0x4ad50f;var _0x33dc26=seqqueue[_0xd71f('0x14')](_0x5042dd);_0x33dc26['id']=_0x503650;_0x33dc26['atimeout']=_0x5042dd;_0x33dc26[_0xd71f('0x15')]=_0x2c056f[_0xd71f('0x15')];writeLog(_0x503650,_0x1eb45d,util[_0xd71f('0x8')](_0xd71f('0x16'),_0x5042dd));_0x26eb6c[_0xd71f('0x17')][_0x503650]['on'](_0xd71f('0x18'),function(){logger[_0xd71f('0x7')](_0xd71f('0x19'),_0x503650);clearTimeout(_0x4ad50f);_0x4ad50f=undefined;_0x33dc26[_0xd71f('0x1a')]();if(_0x26eb6c[_0xd71f('0x17')][_0x503650]){delete _0x26eb6c[_0xd71f('0x17')][_0x503650];}_0x23e742['stop']();});_0x26eb6c[_0xd71f('0x17')][_0x503650]['on'](_0xd71f('0x1b'),function(){if(_0x26eb6c[_0xd71f('0x17')][_0x503650]){delete _0x26eb6c['rules'][_0x503650];}});_0x4ad50f=setTimeout(function(){logger[_0xd71f('0x7')](_0xd71f('0x1c'),_0x503650);clearTimeout(_0x4ad50f);_0x33dc26['close']();_0x23e742[_0xd71f('0x1d')]();},_0x5042dd);strategy['agent'](_0x33dc26,_0x1eb45d,_0x26eb6c,_0x2c056f);}else{logger[_0xd71f('0x1e')](_0xd71f('0x1f'),_0x503650,_0x1afd17[_0xd71f('0xa')]);_0x23e742[_0xd71f('0x10')]();}}}catch(_0x480717){console[_0xd71f('0x20')](_0x480717);logger['error'](_0xd71f('0x21'),_0x503650,_0x480717[_0xd71f('0x22')]);_0x23e742[_0xd71f('0x10')]();}};}; \ No newline at end of file +var _0xb85c=['log','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','atimeout','channel','format','rules','info','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent'];(function(_0x4d0fb2,_0x2326b6){var _0x8429a5=function(_0x4ae77b){while(--_0x4ae77b){_0x4d0fb2['push'](_0x4d0fb2['shift']());}};_0x8429a5(++_0x2326b6);}(_0xb85c,0x178));var _0xcb85=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xb85c[_0x1c8c28];return _0x1f59b4;};'use strict';var schema=require(_0xcb85('0x0'));var _=require(_0xcb85('0x1'));var util=require(_0xcb85('0x2'));var seqqueue=require(_0xcb85('0x3'));var logger=require(_0xcb85('0x4'))(_0xcb85('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xcb85('0x6'),'required':!![],'message':_0xcb85('0x7')},'timeout':{'type':_0xcb85('0x8'),'message':_0xcb85('0x9')}});function writeLog(_0xf235d4,_0x3c6284,_0x7d8d05){return logger['info'](util['format'](_0xcb85('0xa'),_0xf235d4,_0x3c6284[_0xcb85('0xb')],_0x7d8d05));}function handleFindAgent(_0x25cfda){return function(_0x214658){return _0x214658['name'][_0xcb85('0xc')]()===_0x25cfda[_0xcb85('0xc')]();};}exports[_0xcb85('0xd')]=function(_0x27914f,_0x40bbfb,_0x301bc9,_0x25e3e8){return function(_0x1cb770){try{var _0x5908af={'name':_0x40bbfb[0x0],'timeout':_0x40bbfb[0x1]};var _0x3f2ebe=queue[_0xcb85('0x0')](_0x5908af,{'typecast':!![]});if(_0x3f2ebe[_0xcb85('0xe')]){logger[_0xcb85('0xf')](_0xcb85('0x10'),_0x27914f,_[_0xcb85('0x11')](_0x3f2ebe,_0xcb85('0x12'))[_0xcb85('0x13')](',\x20'));_0x1cb770[_0xcb85('0x14')]();}else{var _0x654edf=_['find'](_0x301bc9[_0xcb85('0x15')],handleFindAgent(_0x5908af[_0xcb85('0xb')]));if(_0x654edf){var _0x1912dd=(_0x5908af['timeout']||0xa)*0x3e8;var _0x20c033,_0x52ae3e;var _0x3e6e05=seqqueue['createQueue'](_0x1912dd);_0x3e6e05['id']=_0x27914f;_0x3e6e05[_0xcb85('0x16')]=_0x1912dd;_0x3e6e05[_0xcb85('0x17')]=_0x25e3e8['channel'];writeLog(_0x27914f,_0x654edf,util[_0xcb85('0x18')]('START:%s',_0x1912dd));_0x301bc9[_0xcb85('0x19')][_0x27914f]['on']('end',function(){logger[_0xcb85('0x1a')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x27914f);clearTimeout(_0x52ae3e);_0x52ae3e=undefined;_0x3e6e05[_0xcb85('0x1b')]();if(_0x301bc9['rules'][_0x27914f]){delete _0x301bc9[_0xcb85('0x19')][_0x27914f];}_0x1cb770[_0xcb85('0x14')]();});_0x301bc9['rules'][_0x27914f]['on'](_0xcb85('0x1c'),function(){if(_0x301bc9[_0xcb85('0x19')][_0x27914f]){delete _0x301bc9[_0xcb85('0x19')][_0x27914f];}});_0x52ae3e=setTimeout(function(){logger['info'](_0xcb85('0x1d'),_0x27914f);clearTimeout(_0x52ae3e);_0x3e6e05['close']();_0x1cb770[_0xcb85('0x1e')]();},_0x1912dd);strategy[_0xcb85('0x1f')](_0x3e6e05,_0x654edf,_0x301bc9,_0x25e3e8);}else{logger[_0xcb85('0xf')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x27914f,_0x5908af['name']);_0x1cb770[_0xcb85('0x14')]();}}}catch(_0x1d35c7){console[_0xcb85('0x20')](_0x1d35c7);logger[_0xcb85('0xf')](_0xcb85('0x21'),_0x27914f,_0x1d35c7['stack']);_0x1cb770[_0xcb85('0x14')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 0e31dc2..1bef195 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 _0x1cb9=['out','channel','chat','account','upperFirst','InteractionId','isEmpty','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','error','finally','stop','$LATEST','message','body','toString','postText','amazonlex','Failed','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3aa493,_0x8cc50e){var _0x42ef12=function(_0x40af00){while(--_0x40af00){_0x3aa493['push'](_0x3aa493['shift']());}};_0x42ef12(++_0x8cc50e);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5c7cbd,_0x34db31){_0x5c7cbd=_0x5c7cbd-0x0;var _0x4d7db4=_0x1cb9[_0x5c7cbd];return _0x4d7db4;};'use strict';var _=require(_0x91cb('0x0'));var moment=require('moment');var AWS=require(_0x91cb('0x1'));var utils=require(_0x91cb('0x2'));var logger=require(_0x91cb('0x3'))(_0x91cb('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x91cb('0x5')),'mailMessage':require(_0x91cb('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x91cb('0x7')),'whatsappMessage':require(_0x91cb('0x8'))};exports[_0x91cb('0x9')]=function(_0x28543e,_0x3b9d98){return function(_0x8f8a3b){try{if(!_['isNil'](this[_0x91cb('0xa')]['UserId'])){logger[_0x91cb('0xb')]('[%s][AMAZONLEX]\x20%s',_0x28543e,_0x91cb('0xc'));return _0x8f8a3b[_0x91cb('0xd')]();}var _0x45317f={'ContactId':this[_0x91cb('0xe')]['id'],'sentAt':moment()[_0x91cb('0xf')](_0x91cb('0x10')),'direction':_0x91cb('0x11')};var _0x22dcab=this[_0x91cb('0x12')];if(_0x22dcab===_0x91cb('0x13')){_0x45317f['ChatWebsiteId']=this[_0x91cb('0x14')]['id'];}else{_0x45317f[_[_0x91cb('0x15')](_0x22dcab)+'AccountId']=this[_0x91cb('0x14')]['id'];}_0x45317f[_[_0x91cb('0x15')](_0x22dcab)+_0x91cb('0x16')]=this[_0x91cb('0xa')]['id'];if(this['interaction']['created']){var _0x4aae25=_0x3b9d98[0x4];if(!_[_0x91cb('0x17')](_0x4aae25)){_0x45317f['body']=utils['getMustacheRender'](_0x4aae25,this);return rpc[_0x22dcab+_0x91cb('0x18')][_0x91cb('0x19')](_0x45317f)[_0x91cb('0x1a')](function(_0x5ea796){logger[_0x91cb('0xb')](_0x91cb('0x1b'),_0x28543e,_0x45317f['body']);})[_0x91cb('0x1c')](function(_0x139f4b){logger[_0x91cb('0x1d')](_0x91cb('0x1b'),_0x28543e,JSON['stringify'](_0x139f4b));})[_0x91cb('0x1e')](function(){logger[_0x91cb('0xb')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x28543e);_0x8f8a3b[_0x91cb('0x1f')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x28543e);_0x8f8a3b[_0x91cb('0x1f')]();}}else{var _0x160ded=this;var _0x56e409=new AWS['LexRuntime']({'accessKeyId':_0x3b9d98[0x0],'secretAccessKey':_0x3b9d98[0x1],'region':_0x3b9d98[0x2]});var _0x5b385a={'botAlias':_0x91cb('0x20'),'botName':_0x3b9d98[0x3],'inputText':this[_0x91cb('0x21')][_0x91cb('0x22')],'userId':this[_0x91cb('0x12')]+':'+this['interaction']['id'][_0x91cb('0x23')]()};_0x56e409[_0x91cb('0x24')](_0x5b385a,function(_0x1fa837,_0x55fa78){if(_0x1fa837){logger[_0x91cb('0x1d')](_0x91cb('0x1b'),_0x28543e,_0x1fa837[_0x91cb('0x21')]);_0x8f8a3b[_0x91cb('0xd')]();}else if(_0x55fa78&&_0x55fa78[_0x91cb('0x21')]){_0x160ded[_0x91cb('0x22')][_0x91cb('0x25')]=_0x55fa78;_0x45317f[_0x91cb('0x22')]=_0x55fa78[_0x91cb('0x21')];return rpc[_0x22dcab+'Message']['create'](_0x45317f)[_0x91cb('0x1a')](function(_0x554350){logger[_0x91cb('0xb')](_0x91cb('0x1b'),_0x28543e,_0x45317f[_0x91cb('0x22')]);if(_0x55fa78['dialogState']==_0x91cb('0x26')){_0x8f8a3b['next']();}else{_0x8f8a3b[_0x91cb('0x1f')]();}})[_0x91cb('0x1c')](function(_0x3b3ee6){logger[_0x91cb('0x1d')](_0x91cb('0x1b'),_0x28543e,JSON['stringify'](_0x3b3ee6));_0x8f8a3b[_0x91cb('0xd')]();});}else{_0x8f8a3b['next']();}});}}catch(_0x196385){logger[_0x91cb('0x1d')](_0x91cb('0x1b'),_0x28543e,JSON['stringify'](_0x196385));_0x8f8a3b[_0x91cb('0x1f')]();}};}; \ No newline at end of file +var _0x46ed=['create','then','body','catch','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','error','dialogState','Failed','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','account','upperFirst','created','isEmpty','getMustacheRender','Message'];(function(_0x2f9d2b,_0x8c5f4c){var _0x190bc6=function(_0x4e698b){while(--_0x4e698b){_0x2f9d2b['push'](_0x2f9d2b['shift']());}};_0x190bc6(++_0x8c5f4c);}(_0x46ed,0x168));var _0xd46e=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x46ed[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xd46e('0x0'));var moment=require(_0xd46e('0x1'));var AWS=require('aws-sdk');var utils=require(_0xd46e('0x2'));var logger=require(_0xd46e('0x3'))(_0xd46e('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xd46e('0x5')),'mailMessage':require(_0xd46e('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xd46e('0x7')),'whatsappMessage':require(_0xd46e('0x8'))};exports[_0xd46e('0x9')]=function(_0x25cf78,_0x45e680){return function(_0x855f24){try{if(!_[_0xd46e('0xa')](this[_0xd46e('0xb')][_0xd46e('0xc')])){logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x25cf78,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x855f24[_0xd46e('0xf')]();}var _0x81235b={'ContactId':this['contact']['id'],'sentAt':moment()[_0xd46e('0x10')](_0xd46e('0x11')),'direction':_0xd46e('0x12')};var _0x443000=this[_0xd46e('0x13')];if(_0x443000===_0xd46e('0x14')){_0x81235b['ChatWebsiteId']=this[_0xd46e('0x15')]['id'];}else{_0x81235b[_['upperFirst'](_0x443000)+'AccountId']=this[_0xd46e('0x15')]['id'];}_0x81235b[_[_0xd46e('0x16')](_0x443000)+'InteractionId']=this['interaction']['id'];if(this[_0xd46e('0xb')][_0xd46e('0x17')]){var _0x1e9aae=_0x45e680[0x4];if(!_[_0xd46e('0x18')](_0x1e9aae)){_0x81235b['body']=utils[_0xd46e('0x19')](_0x1e9aae,this);return rpc[_0x443000+_0xd46e('0x1a')][_0xd46e('0x1b')](_0x81235b)[_0xd46e('0x1c')](function(_0x36a317){logger['info'](_0xd46e('0xe'),_0x25cf78,_0x81235b[_0xd46e('0x1d')]);})[_0xd46e('0x1e')](function(_0x551358){logger['error'](_0xd46e('0xe'),_0x25cf78,JSON[_0xd46e('0x1f')](_0x551358));})['finally'](function(){logger['info'](_0xd46e('0x20'),_0x25cf78);_0x855f24[_0xd46e('0x21')]();});}else{logger[_0xd46e('0xd')](_0xd46e('0x22'),_0x25cf78);_0x855f24[_0xd46e('0x21')]();}}else{var _0x312d6f=this;var _0x3b5fa4=new AWS[(_0xd46e('0x23'))]({'accessKeyId':_0x45e680[0x0],'secretAccessKey':_0x45e680[0x1],'region':_0x45e680[0x2]});var _0xb4940={'botAlias':_0xd46e('0x24'),'botName':_0x45e680[0x3],'inputText':this[_0xd46e('0x25')]['body'],'userId':this[_0xd46e('0x13')]+':'+this[_0xd46e('0xb')]['id'][_0xd46e('0x26')]()};_0x3b5fa4[_0xd46e('0x27')](_0xb4940,function(_0x128246,_0xc1af7f){if(_0x128246){logger[_0xd46e('0x28')](_0xd46e('0xe'),_0x25cf78,_0x128246[_0xd46e('0x25')]);_0x855f24['next']();}else if(_0xc1af7f&&_0xc1af7f[_0xd46e('0x25')]){_0x312d6f['body']['amazonlex']=_0xc1af7f;_0x81235b[_0xd46e('0x1d')]=_0xc1af7f[_0xd46e('0x25')];return rpc[_0x443000+_0xd46e('0x1a')][_0xd46e('0x1b')](_0x81235b)[_0xd46e('0x1c')](function(_0x180851){logger[_0xd46e('0xd')]('[%s][AMAZONLEX]\x20%s',_0x25cf78,_0x81235b[_0xd46e('0x1d')]);if(_0xc1af7f[_0xd46e('0x29')]==_0xd46e('0x2a')){_0x855f24[_0xd46e('0xf')]();}else{_0x855f24[_0xd46e('0x21')]();}})[_0xd46e('0x1e')](function(_0x58aeef){logger[_0xd46e('0x28')](_0xd46e('0xe'),_0x25cf78,JSON[_0xd46e('0x1f')](_0x58aeef));_0x855f24[_0xd46e('0xf')]();});}else{_0x855f24[_0xd46e('0xf')]();}});}}catch(_0x423ea3){logger[_0xd46e('0x28')](_0xd46e('0xe'),_0x25cf78,JSON[_0xd46e('0x1f')](_0x423ea3));_0x855f24[_0xd46e('0x21')]();}};}; \ 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 aaaa7b8..246af03 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 _0x11f6=['stop','lodash','moment','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','channel','getMustacheRender','format','YYYY-MM-DD\x20HH:mm:ss','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','mail','service','Smtp','host','port','secure','authentication','auth','user','inReplyTo','messageId','html','replace','body','','sendMailMessage','then','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','create','next'];(function(_0x4372f0,_0x208ad8){var _0x3ec606=function(_0x13d3a6){while(--_0x13d3a6){_0x4372f0['push'](_0x4372f0['shift']());}};_0x3ec606(++_0x208ad8);}(_0x11f6,0xf9));var _0x611f=function(_0xd2d6a0,_0x17dc2c){_0xd2d6a0=_0xd2d6a0-0x0;var _0x40e4a3=_0x11f6[_0xd2d6a0];return _0x40e4a3;};'use strict';var _=require(_0x611f('0x0'));var moment=require(_0x611f('0x1'));var utils=require(_0x611f('0x2'));var logger=require('../../../../config/logger')(_0x611f('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x611f('0x4')),'mailMessage':require(_0x611f('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x611f('0x6')),'whatsappMessage':require(_0x611f('0x7'))};var mailRpc=require(_0x611f('0x8'));exports[_0x611f('0x9')]=function(_0x1fd902,_0xcc396d){return function(_0x40b117){try{if(_0xcc396d[0x0]==='1'&&(_[_0x611f('0xa')](this[_0x611f('0xb')][_0x611f('0xc')])||!this[_0x611f('0xb')][_0x611f('0xc')])){logger[_0x611f('0xd')](_0x611f('0xe'),_0x1fd902,_0x611f('0xf'));return _0x40b117['next']();}var _0x33ad85=this[_0x611f('0x10')];var _0x1cfa3b={'body':utils[_0x611f('0x11')](_0xcc396d[0x1],this),'ContactId':this['contact']['id'],'sentAt':moment()[_0x611f('0x12')](_0x611f('0x13')),'direction':'out'};if(this[_0x611f('0x14')]){_0x1cfa3b['to']=this[_0x611f('0x14')][_0x611f('0x15')]||'';_0x1cfa3b['cc']=this[_0x611f('0x14')]['cc']||'';_0x1cfa3b[_0x611f('0x15')]=this[_0x611f('0x14')]['to']||'';_0x1cfa3b['phone']=this[_0x611f('0x14')][_0x611f('0x16')]||'';_0x1cfa3b[_0x611f('0x17')]=!![];if(this[_0x611f('0x14')][_0x611f('0x18')]){_0x1cfa3b[_0x611f('0x18')]='';_0x1cfa3b[_0x611f('0x18')]+=_[_0x611f('0x19')](this[_0x611f('0x14')][_0x611f('0x18')],_0x611f('0x1a'))?'':_0x611f('0x1b');_0x1cfa3b['subject']+=this['message'][_0x611f('0x18')];}}if(this[_0x611f('0x10')]===_0x611f('0x1c')){_0x1cfa3b[_0x611f('0x1d')]=this['account']['id'];}else{_0x1cfa3b[_[_0x611f('0x1e')](this[_0x611f('0x10')])+_0x611f('0x1f')]=this[_0x611f('0x20')]['id'];}_0x1cfa3b[_['upperFirst'](this['channel'])+_0x611f('0x21')]=this[_0x611f('0xb')]['id'];if(rpc[this[_0x611f('0x10')]+_0x611f('0x22')]){if(this['channel']===_0x611f('0x23')){var _0x365ab5={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp'][_0x611f('0x24')]){_0x365ab5['service']=this[_0x611f('0x20')][_0x611f('0x25')][_0x611f('0x24')];}else{_0x365ab5[_0x611f('0x26')]=this['account'][_0x611f('0x25')][_0x611f('0x26')];_0x365ab5[_0x611f('0x27')]=this[_0x611f('0x20')][_0x611f('0x25')][_0x611f('0x27')];_0x365ab5[_0x611f('0x28')]=this[_0x611f('0x20')][_0x611f('0x25')]['secure'];}if(this[_0x611f('0x20')]['Smtp'][_0x611f('0x29')]){_0x365ab5[_0x611f('0x2a')]={'user':this[_0x611f('0x20')][_0x611f('0x25')][_0x611f('0x2b')],'pass':this['account'][_0x611f('0x25')]['pass']};}_0x1cfa3b[_0x611f('0x2c')]=this[_0x611f('0x14')][_0x611f('0x2d')];_0x1cfa3b[_0x611f('0x2e')]=''+_[_0x611f('0x2f')](_0x1cfa3b[_0x611f('0x30')],_0x611f('0x31'),_0x611f('0x32'))+_0x611f('0x33');return mailRpc[_0x611f('0x34')](_0x365ab5,_0x1cfa3b)[_0x611f('0x35')](function(_0x25f1a5){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x1fd902);_0x1cfa3b[_0x611f('0x2d')]=_0x25f1a5['message'][_0x611f('0x2d')];return rpc[_0x33ad85+_0x611f('0x22')]['create'](_0x1cfa3b);})[_0x611f('0x35')](function(_0x2bd0fc){logger[_0x611f('0xd')]('[%s][AUTOREPLY]\x20%s',_0x1fd902,JSON['stringify'](_0x2bd0fc));})[_0x611f('0x36')](function(_0x5d8953){logger[_0x611f('0x37')](_0x611f('0x38'),_0x1fd902,JSON[_0x611f('0x39')](_0x5d8953));})[_0x611f('0x3a')](function(){_0x40b117['next']();});}else{return rpc[this[_0x611f('0x10')]+'Message'][_0x611f('0x3b')](_0x1cfa3b)['then'](function(_0x537a2b){logger[_0x611f('0xd')](_0x611f('0xe'),_0x1fd902,_0x1cfa3b[_0x611f('0x30')]);})[_0x611f('0x36')](function(_0x498d85){logger[_0x611f('0x37')](_0x611f('0xe'),_0x1fd902,JSON[_0x611f('0x39')](_0x498d85));})['finally'](function(){_0x40b117[_0x611f('0x3c')]();});}}}catch(_0x5b134e){logger['error'](_0x611f('0xe'),_0x1fd902,JSON[_0x611f('0x39')](_0x5b134e));_0x40b117[_0x611f('0x3d')]();}};}; \ No newline at end of file +var _0xcd38=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','created','interaction','info','Autoreply\x20already\x20sent','channel','getMustacheRender','format','YYYY-MM-DD\x20HH:mm:ss','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','mail','Smtp','service','host','port','secure','auth','user','inReplyTo','messageId','','replace','','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','next','body','error','[%s][AUTOREPLY]\x20%s','lodash','moment','./utils','../../../../config/logger','routing'];(function(_0x4e0347,_0x4809f7){var _0x1020b3=function(_0x1d552b){while(--_0x1d552b){_0x4e0347['push'](_0x4e0347['shift']());}};_0x1020b3(++_0x4809f7);}(_0xcd38,0xb2));var _0x8cd3=function(_0x194277,_0x23d38a){_0x194277=_0x194277-0x0;var _0x3e9ad4=_0xcd38[_0x194277];return _0x3e9ad4;};'use strict';var _=require(_0x8cd3('0x0'));var moment=require(_0x8cd3('0x1'));var utils=require(_0x8cd3('0x2'));var logger=require(_0x8cd3('0x3'))(_0x8cd3('0x4'));var rpc={'chatMessage':require(_0x8cd3('0x5')),'openchannelMessage':require(_0x8cd3('0x6')),'mailMessage':require(_0x8cd3('0x7')),'smsMessage':require(_0x8cd3('0x8')),'faxMessage':require(_0x8cd3('0x9')),'whatsappMessage':require(_0x8cd3('0xa'))};var mailRpc=require(_0x8cd3('0xb'));exports['consequence']=function(_0x10fbc9,_0x1f7284){return function(_0x1b2fd3){try{if(_0x1f7284[0x0]==='1'&&(_['isNil'](this['interaction'][_0x8cd3('0xc')])||!this[_0x8cd3('0xd')][_0x8cd3('0xc')])){logger[_0x8cd3('0xe')]('[%s][AUTOREPLY]\x20%s',_0x10fbc9,_0x8cd3('0xf'));return _0x1b2fd3['next']();}var _0xad2194=this[_0x8cd3('0x10')];var _0x8efe32={'body':utils[_0x8cd3('0x11')](_0x1f7284[0x1],this),'ContactId':this['contact']['id'],'sentAt':moment()[_0x8cd3('0x12')](_0x8cd3('0x13')),'direction':'out'};if(this['message']){_0x8efe32['to']=this[_0x8cd3('0x14')][_0x8cd3('0x15')]||'';_0x8efe32['cc']=this['message']['cc']||'';_0x8efe32[_0x8cd3('0x15')]=this[_0x8cd3('0x14')]['to']||'';_0x8efe32[_0x8cd3('0x16')]=this[_0x8cd3('0x14')]['phone']||'';_0x8efe32[_0x8cd3('0x17')]=!![];if(this[_0x8cd3('0x14')]['subject']){_0x8efe32['subject']='';_0x8efe32[_0x8cd3('0x18')]+=_[_0x8cd3('0x19')](this['message'][_0x8cd3('0x18')],_0x8cd3('0x1a'))?'':_0x8cd3('0x1b');_0x8efe32[_0x8cd3('0x18')]+=this[_0x8cd3('0x14')][_0x8cd3('0x18')];}}if(this[_0x8cd3('0x10')]===_0x8cd3('0x1c')){_0x8efe32[_0x8cd3('0x1d')]=this[_0x8cd3('0x1e')]['id'];}else{_0x8efe32[_['upperFirst'](this['channel'])+_0x8cd3('0x1f')]=this[_0x8cd3('0x1e')]['id'];}_0x8efe32[_[_0x8cd3('0x20')](this[_0x8cd3('0x10')])+_0x8cd3('0x21')]=this[_0x8cd3('0xd')]['id'];if(rpc[this[_0x8cd3('0x10')]+'Message']){if(this[_0x8cd3('0x10')]===_0x8cd3('0x22')){var _0x3cb884={'tls':{'rejectUnauthorized':![]}};if(this[_0x8cd3('0x1e')][_0x8cd3('0x23')][_0x8cd3('0x24')]){_0x3cb884[_0x8cd3('0x24')]=this['account']['Smtp'][_0x8cd3('0x24')];}else{_0x3cb884[_0x8cd3('0x25')]=this[_0x8cd3('0x1e')]['Smtp'][_0x8cd3('0x25')];_0x3cb884['port']=this[_0x8cd3('0x1e')]['Smtp'][_0x8cd3('0x26')];_0x3cb884[_0x8cd3('0x27')]=this[_0x8cd3('0x1e')][_0x8cd3('0x23')][_0x8cd3('0x27')];}if(this['account'][_0x8cd3('0x23')]['authentication']){_0x3cb884[_0x8cd3('0x28')]={'user':this[_0x8cd3('0x1e')][_0x8cd3('0x23')][_0x8cd3('0x29')],'pass':this[_0x8cd3('0x1e')][_0x8cd3('0x23')]['pass']};}_0x8efe32[_0x8cd3('0x2a')]=this[_0x8cd3('0x14')][_0x8cd3('0x2b')];_0x8efe32['html']=_0x8cd3('0x2c')+_[_0x8cd3('0x2d')](_0x8efe32['body'],_0x8cd3('0x2e'),']+(>|$)/g,''),'priorityTrue':_0x3a555d[0x1],'priorityFalse':_0x3a555d[0x2]};var _0x582ca6=gotoif[_0x0bee('0x0')](_0xa7b6dc,{'typecast':!![]});if(_0x582ca6['length']){logger['error'](_0x0bee('0xc'),_0x1bb0ba,_[_0x0bee('0xd')](_0x582ca6,_0x0bee('0xe'))[_0x0bee('0xf')](',\x20'));_0x4a7bee['stop']();}else{try{var _0x50308f=eval('('+_0xa7b6dc['condition']+')');var _0x167b8a=_0x50308f?_0xa7b6dc['priorityTrue']:_0xa7b6dc[_0x0bee('0x10')];logger[_0x0bee('0x11')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x1bb0ba,_0xa7b6dc[_0x0bee('0x12')],_0x50308f,_0x167b8a||_0x0bee('0x13'));if(_0x167b8a){var _0x4d35f9=_['findIndex'](_0x4a7bee[_0x0bee('0x14')](),{'p':_0x167b8a});if(_0x4d35f9>=0x0){logger[_0x0bee('0x11')](_0x0bee('0x15'),_0x1bb0ba,_0x167b8a||_0x0bee('0x13'),_0x4d35f9);_0x4a7bee[_0x0bee('0x13')](_0x4d35f9);}else{logger['info'](_0x0bee('0x16'),_0x1bb0ba,_0x167b8a||_0x0bee('0x13'));_0x4a7bee[_0x0bee('0x17')]();}}else{_0x4a7bee[_0x0bee('0x13')]();}}catch(_0x3789c7){logger[_0x0bee('0x18')](_0x0bee('0x19'),_0x1bb0ba,_0x3789c7[_0x0bee('0xe')]);_0x4a7bee[_0x0bee('0x17')]();}}}catch(_0x40a95d){logger['error'](_0x0bee('0xc'),_0x1bb0ba,JSON['stringify'](_0x40a95d));_0x4a7bee[_0x0bee('0x17')]();}};}; \ No newline at end of file +var _0x4e7b=['map','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','replace','length','error','[%s][GOTOIF]\x20%s'];(function(_0x220ee1,_0x5934fc){var _0x46e202=function(_0x4fda27){while(--_0x4fda27){_0x220ee1['push'](_0x220ee1['shift']());}};_0x46e202(++_0x5934fc);}(_0x4e7b,0x146));var _0xb4e7=function(_0x2e9149,_0x58345e){_0x2e9149=_0x2e9149-0x0;var _0x10414e=_0x4e7b[_0x2e9149];return _0x10414e;};'use strict';var schema=require(_0xb4e7('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0xb4e7('0x1'));var logger=require(_0xb4e7('0x2'))('routing');var gotoif=schema({'condition':{'type':_0xb4e7('0x3'),'required':!![],'message':_0xb4e7('0x4')},'priorityTrue':{'type':'number','message':_0xb4e7('0x5')},'priorityFalse':{'type':'number','message':_0xb4e7('0x6')}});exports['consequence']=function(_0x4cd287,_0x549db5){return function(_0x5112e9){try{var _0x334f18={'condition':htmlToText[_0xb4e7('0x7')](utils['getMustacheRender'](_0x549db5[0x0],this),{'wordwrap':![]})[_0xb4e7('0x8')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x549db5[0x1],'priorityFalse':_0x549db5[0x2]};var _0x4398a1=gotoif[_0xb4e7('0x0')](_0x334f18,{'typecast':!![]});if(_0x4398a1[_0xb4e7('0x9')]){logger[_0xb4e7('0xa')](_0xb4e7('0xb'),_0x4cd287,_[_0xb4e7('0xc')](_0x4398a1,'message')['join'](',\x20'));_0x5112e9[_0xb4e7('0xd')]();}else{try{var _0xccc8a1=eval('('+_0x334f18[_0xb4e7('0xe')]+')');var _0xb32d4b=_0xccc8a1?_0x334f18[_0xb4e7('0xf')]:_0x334f18['priorityFalse'];logger[_0xb4e7('0x10')](_0xb4e7('0x11'),_0x4cd287,_0x334f18[_0xb4e7('0xe')],_0xccc8a1,_0xb32d4b||_0xb4e7('0x12'));if(_0xb32d4b){var _0x32ff37=_[_0xb4e7('0x13')](_0x5112e9[_0xb4e7('0x14')](),{'p':_0xb32d4b});if(_0x32ff37>=0x0){logger['info'](_0xb4e7('0x15'),_0x4cd287,_0xb32d4b||_0xb4e7('0x12'),_0x32ff37);_0x5112e9[_0xb4e7('0x12')](_0x32ff37);}else{logger[_0xb4e7('0x10')](_0xb4e7('0x16'),_0x4cd287,_0xb32d4b||'next');_0x5112e9[_0xb4e7('0xd')]();}}else{_0x5112e9[_0xb4e7('0x12')]();}}catch(_0x3eb3bb){logger['error'](_0xb4e7('0x17'),_0x4cd287,_0x3eb3bb[_0xb4e7('0x18')]);_0x5112e9[_0xb4e7('0xd')]();}}}catch(_0x527b41){logger[_0xb4e7('0xa')]('[%s][GOTOIF]\x20%s',_0x4cd287,JSON[_0xb4e7('0x19')](_0x527b41));_0x5112e9['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 752bfa0..e8cce71 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 _0x3071=['[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','validate','error'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3071,0xf6));var _0x1307=function(_0x13c70c,_0x546b34){_0x13c70c=_0x13c70c-0x0;var _0x50f0f2=_0x3071[_0x13c70c];return _0x50f0f2;};'use strict';var schema=require('validate');var _=require(_0x1307('0x0'));var logger=require(_0x1307('0x1'))(_0x1307('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x1307('0x3')}});exports['consequence']=function(_0x208bd3,_0x56ef5a){return function(_0xe3597){try{var _0x167b30={'priority':_0x56ef5a[0x0]};var _0x147585=gotop[_0x1307('0x4')](_0x167b30,{'typecast':!![]});if(_0x147585['length']){logger[_0x1307('0x5')](_0x1307('0x6'),_0x208bd3,_[_0x1307('0x7')](_0x147585,_0x1307('0x8'))[_0x1307('0x9')](',\x20'));_0xe3597[_0x1307('0xa')]();}else{logger[_0x1307('0xb')](_0x1307('0xc'),_0x208bd3,_0x167b30[_0x1307('0xd')]);if(_0x167b30[_0x1307('0xd')]){var _0x36e265=_['findIndex'](_0xe3597[_0x1307('0xe')](),{'p':_0x167b30[_0x1307('0xd')]});if(_0x36e265>=0x0){logger[_0x1307('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x208bd3,_0x167b30[_0x1307('0xd')]||_0x1307('0xf'),_0x36e265);_0xe3597[_0x1307('0xf')](_0x36e265);}else{logger[_0x1307('0xb')](_0x1307('0x10'),_0x208bd3,_0x167b30[_0x1307('0xd')]||_0x1307('0xf'));_0xe3597[_0x1307('0xa')]();}}else{_0xe3597['next']();}}}catch(_0x56e370){logger[_0x1307('0x5')]('[%s][GOTOP]\x20%s',_0x208bd3,JSON[_0x1307('0x11')](_0x56e370));_0xe3597[_0x1307('0xa')]();}};}; \ No newline at end of file +var _0x01b6=['priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','map','join','info','[%s][GOTOP]\x20priority\x20%s'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x01b6,0x1bf));var _0x601b=function(_0x172948,_0x4262cc){_0x172948=_0x172948-0x0;var _0x4aeaa9=_0x01b6[_0x172948];return _0x4aeaa9;};'use strict';var schema=require(_0x601b('0x0'));var _=require(_0x601b('0x1'));var logger=require(_0x601b('0x2'))(_0x601b('0x3'));var gotop=schema({'priority':{'type':_0x601b('0x4'),'required':!![],'message':_0x601b('0x5')}});exports[_0x601b('0x6')]=function(_0x2128cf,_0x246018){return function(_0x5e5b5d){try{var _0x1bf8e4={'priority':_0x246018[0x0]};var _0x335d40=gotop['validate'](_0x1bf8e4,{'typecast':!![]});if(_0x335d40['length']){logger[_0x601b('0x7')](_0x601b('0x8'),_0x2128cf,_[_0x601b('0x9')](_0x335d40,'message')[_0x601b('0xa')](',\x20'));_0x5e5b5d['stop']();}else{logger[_0x601b('0xb')](_0x601b('0xc'),_0x2128cf,_0x1bf8e4[_0x601b('0xd')]);if(_0x1bf8e4[_0x601b('0xd')]){var _0x168fe8=_[_0x601b('0xe')](_0x5e5b5d['rules'](),{'p':_0x1bf8e4[_0x601b('0xd')]});if(_0x168fe8>=0x0){logger['info'](_0x601b('0xf'),_0x2128cf,_0x1bf8e4[_0x601b('0xd')]||_0x601b('0x10'),_0x168fe8);_0x5e5b5d[_0x601b('0x10')](_0x168fe8);}else{logger[_0x601b('0xb')](_0x601b('0x11'),_0x2128cf,_0x1bf8e4[_0x601b('0xd')]||_0x601b('0x10'));_0x5e5b5d[_0x601b('0x12')]();}}else{_0x5e5b5d[_0x601b('0x10')]();}}}catch(_0x47911d){logger[_0x601b('0x7')](_0x601b('0x8'),_0x2128cf,JSON[_0x601b('0x13')](_0x47911d));_0x5e5b5d[_0x601b('0x12')]();}};}; \ 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 97d17a9..210bf35 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 _0xab3d=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','interaction','Message','create','then','info','body','error','[%s][MESSAGE]\x20%s','stringify','stop','../../../../config/logger'];(function(_0x156e21,_0x28c9e1){var _0x455239=function(_0xd888ea){while(--_0xd888ea){_0x156e21['push'](_0x156e21['shift']());}};_0x455239(++_0x28c9e1);}(_0xab3d,0x1af));var _0xdab3=function(_0x12686c,_0x4a58db){_0x12686c=_0x12686c-0x0;var _0x4a72b7=_0xab3d[_0x12686c];return _0x4a72b7;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0xdab3('0x0'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xdab3('0x1')),'mailMessage':require(_0xdab3('0x2')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xdab3('0x3')),'whatsappMessage':require(_0xdab3('0x4'))};exports[_0xdab3('0x5')]=function(_0x3328fd,_0x4c5965){return function(_0x553d64){try{var _0x5d5fd4={'body':utils[_0xdab3('0x6')](_0x4c5965[0x0],this),'ContactId':this[_0xdab3('0x7')]['id']};if(this[_0xdab3('0x8')]===_0xdab3('0x9')){_0x5d5fd4[_0xdab3('0xa')]=this['account']['id'];}else{_0x5d5fd4[_[_0xdab3('0xb')](this[_0xdab3('0x8')])+_0xdab3('0xc')]=this[_0xdab3('0xd')]['id'];}_0x5d5fd4[_[_0xdab3('0xb')](this[_0xdab3('0x8')])+'InteractionId']=this[_0xdab3('0xe')]['id'];if(rpc[this['channel']+'Message']){return rpc[this[_0xdab3('0x8')]+_0xdab3('0xf')][_0xdab3('0x10')](_0x5d5fd4)[_0xdab3('0x11')](function(_0x515c2a){logger[_0xdab3('0x12')]('[%s][MESSAGE]\x20%s',_0x3328fd,_0x5d5fd4[_0xdab3('0x13')]);_0x553d64['next']();})['catch'](function(_0x51b22e){logger[_0xdab3('0x14')](_0xdab3('0x15'),_0x3328fd,JSON[_0xdab3('0x16')](_0x51b22e));_0x553d64['stop']();});}}catch(_0x399478){logger['error'](_0xdab3('0x15'),_0x3328fd,JSON[_0xdab3('0x16')](_0x399478));_0x553d64[_0xdab3('0x17')]();}};}; \ No newline at end of file +var _0xecdc=['[%s][MESSAGE]\x20%s','next','error','stop','lodash','./utils','routing','../../rpc/mailMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','upperFirst','AccountId','account','interaction','Message','then','info'];(function(_0x232f9f,_0x39f116){var _0x4a7251=function(_0x3aba7c){while(--_0x3aba7c){_0x232f9f['push'](_0x232f9f['shift']());}};_0x4a7251(++_0x39f116);}(_0xecdc,0x130));var _0xcecd=function(_0x3e90cd,_0xb48c79){_0x3e90cd=_0x3e90cd-0x0;var _0x355962=_0xecdc[_0x3e90cd];return _0x355962;};'use strict';var _=require(_0xcecd('0x0'));var utils=require(_0xcecd('0x1'));var logger=require('../../../../config/logger')(_0xcecd('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xcecd('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xcecd('0x4')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xcecd('0x5')]=function(_0x90d92b,_0x1a213a){return function(_0x329f4c){try{var _0x5c0d56={'body':utils[_0xcecd('0x6')](_0x1a213a[0x0],this),'ContactId':this[_0xcecd('0x7')]['id']};if(this[_0xcecd('0x8')]==='chat'){_0x5c0d56['ChatWebsiteId']=this['account']['id'];}else{_0x5c0d56[_[_0xcecd('0x9')](this[_0xcecd('0x8')])+_0xcecd('0xa')]=this[_0xcecd('0xb')]['id'];}_0x5c0d56[_['upperFirst'](this['channel'])+'InteractionId']=this[_0xcecd('0xc')]['id'];if(rpc[this[_0xcecd('0x8')]+'Message']){return rpc[this['channel']+_0xcecd('0xd')]['create'](_0x5c0d56)[_0xcecd('0xe')](function(_0x2d4abb){logger[_0xcecd('0xf')](_0xcecd('0x10'),_0x90d92b,_0x5c0d56['body']);_0x329f4c[_0xcecd('0x11')]();})['catch'](function(_0x53f5d6){logger['error'](_0xcecd('0x10'),_0x90d92b,JSON['stringify'](_0x53f5d6));_0x329f4c['stop']();});}}catch(_0x158aa3){logger[_0xcecd('0x12')](_0xcecd('0x10'),_0x90d92b,JSON['stringify'](_0x158aa3));_0x329f4c[_0xcecd('0x13')]();}};}; \ 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 e9f0c4e..1cdeaba 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 _0x0a35=['getMustacheRender','error','[%s][NOOP]\x20%s','./utils','../../../../config/logger','routing','consequence'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a35,0x18b));var _0x50a3=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x0a35[_0x4fde08];return _0x12e725;};'use strict';var utils=require(_0x50a3('0x0'));var logger=require(_0x50a3('0x1'))(_0x50a3('0x2'));exports[_0x50a3('0x3')]=function(_0x4371fc,_0x2163ad){return function(_0x32945f){try{logger['info']('[%s][NOOP]\x20%s',_0x4371fc,utils[_0x50a3('0x4')](_0x2163ad[0x0],this));_0x32945f['next']();}catch(_0x2da209){logger[_0x50a3('0x5')](_0x50a3('0x6'),_0x4371fc,JSON['stringify'](_0x2da209));_0x32945f['stop']();}};}; \ No newline at end of file +var _0x855f=['stop','./utils','routing','info','[%s][NOOP]\x20%s','next','error'];(function(_0x53749f,_0x4dd11a){var _0x4c6480=function(_0x1fea8e){while(--_0x1fea8e){_0x53749f['push'](_0x53749f['shift']());}};_0x4c6480(++_0x4dd11a);}(_0x855f,0xb7));var _0xf855=function(_0x105aaf,_0x54d530){_0x105aaf=_0x105aaf-0x0;var _0x289355=_0x855f[_0x105aaf];return _0x289355;};'use strict';var utils=require(_0xf855('0x0'));var logger=require('../../../../config/logger')(_0xf855('0x1'));exports['consequence']=function(_0x4a7f9d,_0x5c26d2){return function(_0x193259){try{logger[_0xf855('0x2')](_0xf855('0x3'),_0x4a7f9d,utils['getMustacheRender'](_0x5c26d2[0x0],this));_0x193259[_0xf855('0x4')]();}catch(_0x242dc2){logger[_0xf855('0x5')](_0xf855('0x3'),_0x4a7f9d,JSON['stringify'](_0x242dc2));_0x193259[_0xf855('0x6')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 685ba58..a44be97 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 _0x34e8=['../../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','channel','MessageId','chat','AccountId','WebsiteId','name','message','QueueReport','create','catch','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport'];(function(_0xe00671,_0x1f7f4e){var _0x360eb9=function(_0x192a2f){while(--_0x192a2f){_0xe00671['push'](_0xe00671['shift']());}};_0x360eb9(++_0x1f7f4e);}(_0x34e8,0x12c));var _0x834e=function(_0x4870cf,_0xd7a433){_0x4870cf=_0x4870cf-0x0;var _0x3cc8f2=_0x34e8[_0x4870cf];return _0x3cc8f2;};'use strict';var schema=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var seqqueue=require(_0x834e('0x3'));var moment=require('moment');var Redis=require(_0x834e('0x4'));var config=require(_0x834e('0x5'));var logger=require(_0x834e('0x6'))(_0x834e('0x7'));var strategy=require(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));var attributes=['id',_0x834e('0xc'),_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10')];function emit(_0x363786,_0x1af45a,_0x3bdda9){io['to'](_0x363786)[_0x834e('0x11')](_0x1af45a,_0x3bdda9);}function emitChannelQueueInteraction(_0x1e41fe,_0x36e124,_0x14038b,_0x2e1a37,_0x293514,_0x1e00de,_0x2fd95c,_0x538bb3){var _0x5e5b6d=_[_0x834e('0x12')](_0x14038b);_0x5e5b6d['queue_id']=_0x538bb3;_0x5e5b6d[_0x834e('0xe')]=_0x36e124;_0x5e5b6d[_0x834e('0xd')]=_0x2e1a37;_0x5e5b6d['id']=_0x293514;if(_0x1e00de){_0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514]=_['pick'](_0x5e5b6d,attributes);}else{delete _0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514];}emit(util['format'](_0x834e('0x15'),_0x1e41fe,_0x36e124),util['format'](_0x834e('0x16'),_0x1e41fe,_0x1e00de?_0x834e('0x17'):'remove'),_[_0x834e('0x18')](_0x5e5b6d,attributes));}var rpc={'openchannelQueueReport':require(_0x834e('0x19')),'mailQueueReport':require(_0x834e('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x834e('0x1b')),'faxQueueReport':require(_0x834e('0x1c')),'whatsappQueueReport':require(_0x834e('0x1d'))};var queue=schema({'name':{'type':_0x834e('0x1e'),'required':!![],'message':_0x834e('0x1f')},'timeout':{'type':_0x834e('0x20'),'message':_0x834e('0x21')}});function startRouting(_0x595515,_0x2545b4,_0x1fd2c6,_0x113ff4){if(_0x595515&&_0x2545b4&&_0x1fd2c6){_0x2545b4[_0x834e('0x22')]+=0x1;var _0x4ab05d={'uniqueid':_0x595515,'from':_0x1fd2c6[_0x834e('0x23')]?_0x1fd2c6[_0x834e('0x23')]['from']:'','joinAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'ContactId':_0x1fd2c6[_0x834e('0x25')]?_0x1fd2c6['contact']['id']:null,'ListId':_0x1fd2c6['list']?_0x1fd2c6[_0x834e('0x26')]['id']:null};_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x28')]=_0x2545b4['id']||null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x29')]=_0x1fd2c6[_0x834e('0x2a')]?_0x1fd2c6[_0x834e('0x2a')]['id']:null;_0x4ab05d[_['upperFirst'](_0x1fd2c6[_0x834e('0x2b')])+_0x834e('0x2c')]=_0x1fd2c6['message']?_0x1fd2c6['message']['id']:null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+(_0x1fd2c6[_0x834e('0x2b')]!==_0x834e('0x2d')?_0x834e('0x2e'):_0x834e('0x2f'))]=_0x1fd2c6[_0x834e('0xd')]?_0x1fd2c6[_0x834e('0xd')]['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x595515,_0x2545b4['name']));emitChannelQueueInteraction(_0x1fd2c6[_0x834e('0x2b')],_0x2545b4[_0x834e('0x30')],_0x4ab05d,_0x1fd2c6[_0x834e('0xd')]['name'],_0x1fd2c6[_0x834e('0x31')]['id'],!![],_0x113ff4,_0x2545b4['id']);if(rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x33')](_0x4ab05d)[_0x834e('0x34')](function(_0xfaf716){logger[_0x834e('0x35')]('create\x20queue\x20report');});}}}function stopRouting(_0xef9ec2,_0x5cad11,_0x2c75c2,_0x3787b0){if(_0xef9ec2&&_0x5cad11){_0x5cad11[_0x834e('0x22')]-=0x1;var _0x2b3418={'leaveAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'acceptAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'reason':_0x834e('0x36')};logger[_0x834e('0x37')](util['format'](_0x834e('0x38'),_0xef9ec2,_0x5cad11[_0x834e('0x30')]));emitChannelQueueInteraction(_0x2c75c2[_0x834e('0x2b')],_0x5cad11[_0x834e('0x30')],_0x2c75c2['body'],_0x2c75c2[_0x834e('0xd')][_0x834e('0x30')],_0x2c75c2['message']['id'],![],_0x3787b0,_0x5cad11['id']);if(rpc[_0x2c75c2['channel']+'QueueReport']){return rpc[_0x2c75c2[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x39')](_0xef9ec2,_0x2b3418)[_0x834e('0x34')](function(_0x339e28){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function endRouting(_0x2c2d94,_0x513f36,_0xe103fe,_0x6a3ac){if(_0x2c2d94&&_0x513f36){_0x513f36['waiting']-=0x1;var _0x18ac3b={'leaveAt':moment()[_0x834e('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x834e('0x24')),'reason':_0x834e('0x3a')};logger[_0x834e('0x37')](util[_0x834e('0x13')](_0x834e('0x3b'),_0x2c2d94,_0x513f36['name']));emitChannelQueueInteraction(_0xe103fe[_0x834e('0x2b')],_0x513f36['name'],_0xe103fe['body'],_0xe103fe[_0x834e('0xd')]['name'],_0xe103fe[_0x834e('0x31')]['id'],![],_0x6a3ac);if(rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]['update'](_0x2c2d94,_0x18ac3b)[_0x834e('0x34')](function(_0x26b847){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x35380e){return function(_0x16ac45){return _0x16ac45['name'][_0x834e('0x3c')]()===_0x35380e['toLowerCase']();};}exports[_0x834e('0x3d')]=function(_0x585335,_0x4a18bb,_0x4a6942,_0x22ea21){return function(_0x16969b){try{var _0x3bcbf4={'name':_0x4a18bb[0x0],'timeout':_0x4a18bb[0x1]};var _0xbc1571=queue[_0x834e('0x0')](_0x3bcbf4,{'typecast':!![]});if(_0xbc1571[_0x834e('0x3e')]){logger[_0x834e('0x35')]('[%s][QUEUE]\x20%s',_0x585335,_[_0x834e('0x3f')](_0xbc1571,'message')[_0x834e('0x40')](',\x20'));_0x16969b['stop']();}else{var _0x1df5b0=_['find'](_0x4a6942[_0x22ea21[_0x834e('0x2b')]+_0x834e('0x41')],handleFindQueue(_0x3bcbf4['name']));if(_0x1df5b0){startRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);var _0x39e7b9=(_0x1df5b0[_0x834e('0x3a')]||0xa)*0x3e8;var _0xa880cb=(_0x3bcbf4[_0x834e('0x3a')]||0x14)*0x3e8;var _0x252ea0,_0x1a7149;if(_0x39e7b9>_0xa880cb){_0xa880cb=_0x39e7b9;}var _0xfa28da=seqqueue[_0x834e('0x42')](_0x39e7b9);_0xfa28da['id']=_0x585335;_0xfa28da[_0x834e('0x43')]=_0x39e7b9;_0xfa28da[_0x834e('0x44')]=_0xa880cb;_0xfa28da['channel']=_0x22ea21[_0x834e('0x2b')];_0x4a6942[_0x834e('0x45')][_0x585335]['on']('end',function(){logger[_0x834e('0x37')](_0x834e('0x46'),_0x585335);stopRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0x252ea0=undefined;_0xfa28da[_0x834e('0x47')](!![]);if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}_0x16969b[_0x834e('0x48')]();});_0x4a6942['rules'][_0x585335]['on']('complete',function(){if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}});_0x252ea0=setTimeout(function(){logger[_0x834e('0x37')](_0x834e('0x49'),_0x585335);endRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0xfa28da[_0x834e('0x47')](!![]);_0x16969b[_0x834e('0x4a')]();},_0xa880cb);switch(_0x1df5b0[_0x834e('0x4b')]){case _0x834e('0x4c'):strategy[_0x834e('0x4c')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);break;default:strategy[_0x834e('0x4d')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);}}else{logger[_0x834e('0x35')](_0x834e('0x4e'),_0x585335,_0x3bcbf4[_0x834e('0x30')]);_0x16969b[_0x834e('0x48')]();}}}catch(_0x2aa072){console[_0x834e('0x4f')](_0x2aa072);logger[_0x834e('0x35')](_0x834e('0x50'),_0x585335,_0x2aa072[_0x834e('0x51')]);_0x16969b[_0x834e('0x48')]();}};}; \ No newline at end of file +var _0x34e8=['../../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','channel','MessageId','chat','AccountId','WebsiteId','name','message','QueueReport','create','catch','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport'];(function(_0x19a629,_0x88df73){var _0x4383eb=function(_0x362cda){while(--_0x362cda){_0x19a629['push'](_0x19a629['shift']());}};_0x4383eb(++_0x88df73);}(_0x34e8,0x12c));var _0x834e=function(_0x55c831,_0x5a49c5){_0x55c831=_0x55c831-0x0;var _0x1823ab=_0x34e8[_0x55c831];return _0x1823ab;};'use strict';var schema=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var seqqueue=require(_0x834e('0x3'));var moment=require('moment');var Redis=require(_0x834e('0x4'));var config=require(_0x834e('0x5'));var logger=require(_0x834e('0x6'))(_0x834e('0x7'));var strategy=require(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));var attributes=['id',_0x834e('0xc'),_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10')];function emit(_0x363786,_0x1af45a,_0x3bdda9){io['to'](_0x363786)[_0x834e('0x11')](_0x1af45a,_0x3bdda9);}function emitChannelQueueInteraction(_0x1e41fe,_0x36e124,_0x14038b,_0x2e1a37,_0x293514,_0x1e00de,_0x2fd95c,_0x538bb3){var _0x5e5b6d=_[_0x834e('0x12')](_0x14038b);_0x5e5b6d['queue_id']=_0x538bb3;_0x5e5b6d[_0x834e('0xe')]=_0x36e124;_0x5e5b6d[_0x834e('0xd')]=_0x2e1a37;_0x5e5b6d['id']=_0x293514;if(_0x1e00de){_0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514]=_['pick'](_0x5e5b6d,attributes);}else{delete _0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514];}emit(util['format'](_0x834e('0x15'),_0x1e41fe,_0x36e124),util['format'](_0x834e('0x16'),_0x1e41fe,_0x1e00de?_0x834e('0x17'):'remove'),_[_0x834e('0x18')](_0x5e5b6d,attributes));}var rpc={'openchannelQueueReport':require(_0x834e('0x19')),'mailQueueReport':require(_0x834e('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x834e('0x1b')),'faxQueueReport':require(_0x834e('0x1c')),'whatsappQueueReport':require(_0x834e('0x1d'))};var queue=schema({'name':{'type':_0x834e('0x1e'),'required':!![],'message':_0x834e('0x1f')},'timeout':{'type':_0x834e('0x20'),'message':_0x834e('0x21')}});function startRouting(_0x595515,_0x2545b4,_0x1fd2c6,_0x113ff4){if(_0x595515&&_0x2545b4&&_0x1fd2c6){_0x2545b4[_0x834e('0x22')]+=0x1;var _0x4ab05d={'uniqueid':_0x595515,'from':_0x1fd2c6[_0x834e('0x23')]?_0x1fd2c6[_0x834e('0x23')]['from']:'','joinAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'ContactId':_0x1fd2c6[_0x834e('0x25')]?_0x1fd2c6['contact']['id']:null,'ListId':_0x1fd2c6['list']?_0x1fd2c6[_0x834e('0x26')]['id']:null};_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x28')]=_0x2545b4['id']||null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x29')]=_0x1fd2c6[_0x834e('0x2a')]?_0x1fd2c6[_0x834e('0x2a')]['id']:null;_0x4ab05d[_['upperFirst'](_0x1fd2c6[_0x834e('0x2b')])+_0x834e('0x2c')]=_0x1fd2c6['message']?_0x1fd2c6['message']['id']:null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+(_0x1fd2c6[_0x834e('0x2b')]!==_0x834e('0x2d')?_0x834e('0x2e'):_0x834e('0x2f'))]=_0x1fd2c6[_0x834e('0xd')]?_0x1fd2c6[_0x834e('0xd')]['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x595515,_0x2545b4['name']));emitChannelQueueInteraction(_0x1fd2c6[_0x834e('0x2b')],_0x2545b4[_0x834e('0x30')],_0x4ab05d,_0x1fd2c6[_0x834e('0xd')]['name'],_0x1fd2c6[_0x834e('0x31')]['id'],!![],_0x113ff4,_0x2545b4['id']);if(rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x33')](_0x4ab05d)[_0x834e('0x34')](function(_0xfaf716){logger[_0x834e('0x35')]('create\x20queue\x20report');});}}}function stopRouting(_0xef9ec2,_0x5cad11,_0x2c75c2,_0x3787b0){if(_0xef9ec2&&_0x5cad11){_0x5cad11[_0x834e('0x22')]-=0x1;var _0x2b3418={'leaveAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'acceptAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'reason':_0x834e('0x36')};logger[_0x834e('0x37')](util['format'](_0x834e('0x38'),_0xef9ec2,_0x5cad11[_0x834e('0x30')]));emitChannelQueueInteraction(_0x2c75c2[_0x834e('0x2b')],_0x5cad11[_0x834e('0x30')],_0x2c75c2['body'],_0x2c75c2[_0x834e('0xd')][_0x834e('0x30')],_0x2c75c2['message']['id'],![],_0x3787b0,_0x5cad11['id']);if(rpc[_0x2c75c2['channel']+'QueueReport']){return rpc[_0x2c75c2[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x39')](_0xef9ec2,_0x2b3418)[_0x834e('0x34')](function(_0x339e28){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function endRouting(_0x2c2d94,_0x513f36,_0xe103fe,_0x6a3ac){if(_0x2c2d94&&_0x513f36){_0x513f36['waiting']-=0x1;var _0x18ac3b={'leaveAt':moment()[_0x834e('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x834e('0x24')),'reason':_0x834e('0x3a')};logger[_0x834e('0x37')](util[_0x834e('0x13')](_0x834e('0x3b'),_0x2c2d94,_0x513f36['name']));emitChannelQueueInteraction(_0xe103fe[_0x834e('0x2b')],_0x513f36['name'],_0xe103fe['body'],_0xe103fe[_0x834e('0xd')]['name'],_0xe103fe[_0x834e('0x31')]['id'],![],_0x6a3ac);if(rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]['update'](_0x2c2d94,_0x18ac3b)[_0x834e('0x34')](function(_0x26b847){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x35380e){return function(_0x16ac45){return _0x16ac45['name'][_0x834e('0x3c')]()===_0x35380e['toLowerCase']();};}exports[_0x834e('0x3d')]=function(_0x585335,_0x4a18bb,_0x4a6942,_0x22ea21){return function(_0x16969b){try{var _0x3bcbf4={'name':_0x4a18bb[0x0],'timeout':_0x4a18bb[0x1]};var _0xbc1571=queue[_0x834e('0x0')](_0x3bcbf4,{'typecast':!![]});if(_0xbc1571[_0x834e('0x3e')]){logger[_0x834e('0x35')]('[%s][QUEUE]\x20%s',_0x585335,_[_0x834e('0x3f')](_0xbc1571,'message')[_0x834e('0x40')](',\x20'));_0x16969b['stop']();}else{var _0x1df5b0=_['find'](_0x4a6942[_0x22ea21[_0x834e('0x2b')]+_0x834e('0x41')],handleFindQueue(_0x3bcbf4['name']));if(_0x1df5b0){startRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);var _0x39e7b9=(_0x1df5b0[_0x834e('0x3a')]||0xa)*0x3e8;var _0xa880cb=(_0x3bcbf4[_0x834e('0x3a')]||0x14)*0x3e8;var _0x252ea0,_0x1a7149;if(_0x39e7b9>_0xa880cb){_0xa880cb=_0x39e7b9;}var _0xfa28da=seqqueue[_0x834e('0x42')](_0x39e7b9);_0xfa28da['id']=_0x585335;_0xfa28da[_0x834e('0x43')]=_0x39e7b9;_0xfa28da[_0x834e('0x44')]=_0xa880cb;_0xfa28da['channel']=_0x22ea21[_0x834e('0x2b')];_0x4a6942[_0x834e('0x45')][_0x585335]['on']('end',function(){logger[_0x834e('0x37')](_0x834e('0x46'),_0x585335);stopRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0x252ea0=undefined;_0xfa28da[_0x834e('0x47')](!![]);if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}_0x16969b[_0x834e('0x48')]();});_0x4a6942['rules'][_0x585335]['on']('complete',function(){if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}});_0x252ea0=setTimeout(function(){logger[_0x834e('0x37')](_0x834e('0x49'),_0x585335);endRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0xfa28da[_0x834e('0x47')](!![]);_0x16969b[_0x834e('0x4a')]();},_0xa880cb);switch(_0x1df5b0[_0x834e('0x4b')]){case _0x834e('0x4c'):strategy[_0x834e('0x4c')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);break;default:strategy[_0x834e('0x4d')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);}}else{logger[_0x834e('0x35')](_0x834e('0x4e'),_0x585335,_0x3bcbf4[_0x834e('0x30')]);_0x16969b[_0x834e('0x48')]();}}}catch(_0x2aa072){console[_0x834e('0x4f')](_0x2aa072);logger[_0x834e('0x35')](_0x834e('0x50'),_0x585335,_0x2aa072[_0x834e('0x51')]);_0x16969b[_0x834e('0x48')]();}};}; \ 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 3462723..4980cd4 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 _0xc56a=['exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','push','bind','timeout','drained','handleDrained','handleRun','handleTimeout','prototype','info','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','busy','busyQueue','showNotification','writeLog','RINGING','forcedOwnership','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','STOP'];(function(_0x373e5a,_0x4fa391){var _0x7adac2=function(_0x42ac46){while(--_0x42ac46){_0x373e5a['push'](_0x373e5a['shift']());}};_0x7adac2(++_0x4fa391);}(_0xc56a,0x14b));var _0xac56=function(_0x549c65,_0x29a979){_0x549c65=_0x549c65-0x0;var _0x119a0d=_0xc56a[_0x549c65];return _0x119a0d;};'use strict';var _=require(_0xac56('0x0'));var uuid=require(_0xac56('0x1'));var util=require(_0xac56('0x2'));var logger=require(_0xac56('0x3'))('routing');var Agent=function(_0x1f33b8,_0x1328cc,_0x54b286,_0xcbadc9){this[_0xac56('0x4')]=uuid['v4']();this[_0xac56('0x5')]=_0x1f33b8;this[_0xac56('0x6')]=_0x1328cc;this[_0xac56('0x7')]=_0x54b286;this[_0xac56('0x8')]=_0xcbadc9;this[_0xac56('0x5')][_0xac56('0x9')](this['handleRun'][_0xac56('0xa')](this),this['handleTimeout'][_0xac56('0xa')](this));this[_0xac56('0x5')]['on'](_0xac56('0xb'),this['handleTimeout'][_0xac56('0xa')](this));this[_0xac56('0x5')]['on'](_0xac56('0xc'),this[_0xac56('0xd')][_0xac56('0xa')](this));};Agent['prototype']['push']=function(){this[_0xac56('0x5')]['push'](this[_0xac56('0xe')][_0xac56('0xa')](this),this['handleTimeout'][_0xac56('0xa')](this));};Agent['prototype'][_0xac56('0xd')]=function(){this[_0xac56('0xf')](!![]);};Agent[_0xac56('0x10')][_0xac56('0xe')]=function(_0x46ae29){logger[_0xac56('0x11')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0xac56('0x6')]['id']);if(_[_0xac56('0x12')](this['realtime']['agents'][this[_0xac56('0x6')]['id']])){logger['info'](_0xac56('0x13'),this[_0xac56('0x5')]['id'],this[_0xac56('0x6')]['id']);setTimeout(this[_0xac56('0x9')][_0xac56('0xa')](this),0x3e8);}else{if(this[_0xac56('0x8')]['forcedOwnership']||util[_0xac56('0x14')](this[_0xac56('0x5')]['id'],this[_0xac56('0x7')][_0xac56('0x15')][this[_0xac56('0x6')]['id']],this[_0xac56('0x5')][_0xac56('0x16')],![])){this[_0xac56('0x7')][_0xac56('0x15')][this[_0xac56('0x6')]['id']][_0xac56('0x17')]=!![];this[_0xac56('0x7')][_0xac56('0x15')][this[_0xac56('0x6')]['id']][_0xac56('0x18')]=undefined;util[_0xac56('0x19')](this[_0xac56('0x4')],this[_0xac56('0x5')]['id'],this[_0xac56('0x7')][_0xac56('0x15')][this[_0xac56('0x6')]['id']],null,this[_0xac56('0x8')]);util[_0xac56('0x1a')](this[_0xac56('0x5')]['id'],this[_0xac56('0x7')][_0xac56('0x15')][this[_0xac56('0x6')]['id']],_0xac56('0x1b')+(this[_0xac56('0x8')][_0xac56('0x1c')]?':FORCED':''));}else{logger[_0xac56('0x11')](_0xac56('0x1d'),this['squeue']['id'],this[_0xac56('0x6')]['id']);setTimeout(this[_0xac56('0x9')][_0xac56('0xa')](this),0x3e8);}}};Agent[_0xac56('0x10')][_0xac56('0xf')]=function(_0x43b80c){if(_[_0xac56('0x12')](this['realtime'][_0xac56('0x15')][this[_0xac56('0x6')]['id']])){return logger['info'](_0xac56('0x13'),this[_0xac56('0x5')]['id'],this['agent']['id']);}else{logger[_0xac56('0x11')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0xac56('0x6')]['id']);util[_0xac56('0x1e')](this[_0xac56('0x4')],this[_0xac56('0x5')]['id'],this[_0xac56('0x7')][_0xac56('0x15')][this[_0xac56('0x6')]['id']],null,this[_0xac56('0x8')]);this[_0xac56('0x7')][_0xac56('0x15')][this[_0xac56('0x6')]['id']][_0xac56('0x17')]=![];this[_0xac56('0x7')][_0xac56('0x15')][this[_0xac56('0x6')]['id']][_0xac56('0x18')]=undefined;util[_0xac56('0x1a')](this[_0xac56('0x5')]['id'],this[_0xac56('0x7')]['agents'][this[_0xac56('0x6')]['id']],_0x43b80c?_0xac56('0x1f'):'TIMEOUT');}if(!_0x43b80c){setTimeout(this[_0xac56('0x9')]['bind'](this),0x3e8);}};function agent(_0x45c164,_0x4b6761,_0x57bc4c,_0xcf5f00){return new Agent(_0x45c164,_0x4b6761,_0x57bc4c,_0xcf5f00);}module[_0xac56('0x20')]=agent; \ No newline at end of file +var _0x4528=['info','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','exports','lodash','uuid','./util','routing','notificationId','agent','realtime','squeue','handleRun','bind','handleTimeout','timeout','drained','prototype','push'];(function(_0x106e74,_0x214572){var _0x1cfbf8=function(_0x325e4f){while(--_0x325e4f){_0x106e74['push'](_0x106e74['shift']());}};_0x1cfbf8(++_0x214572);}(_0x4528,0x1a3));var _0x8452=function(_0x557fe7,_0x2bce93){_0x557fe7=_0x557fe7-0x0;var _0x1b62e2=_0x4528[_0x557fe7];return _0x1b62e2;};'use strict';var _=require(_0x8452('0x0'));var uuid=require(_0x8452('0x1'));var util=require(_0x8452('0x2'));var logger=require('../../../../../config/logger')(_0x8452('0x3'));var Agent=function(_0x1f4b66,_0xfce448,_0x18a2af,_0x182ada){this[_0x8452('0x4')]=uuid['v4']();this['squeue']=_0x1f4b66;this[_0x8452('0x5')]=_0xfce448;this[_0x8452('0x6')]=_0x18a2af;this[_0x8452('0x3')]=_0x182ada;this[_0x8452('0x7')]['push'](this[_0x8452('0x8')][_0x8452('0x9')](this),this[_0x8452('0xa')][_0x8452('0x9')](this));this[_0x8452('0x7')]['on'](_0x8452('0xb'),this[_0x8452('0xa')][_0x8452('0x9')](this));this[_0x8452('0x7')]['on'](_0x8452('0xc'),this['handleDrained'][_0x8452('0x9')](this));};Agent[_0x8452('0xd')][_0x8452('0xe')]=function(){this[_0x8452('0x7')][_0x8452('0xe')](this[_0x8452('0x8')][_0x8452('0x9')](this),this[_0x8452('0xa')]['bind'](this));};Agent[_0x8452('0xd')]['handleDrained']=function(){this[_0x8452('0xa')](!![]);};Agent['prototype']['handleRun']=function(_0x42fa96){logger[_0x8452('0xf')](_0x8452('0x10'),this[_0x8452('0x7')]['id'],this[_0x8452('0x5')]['id']);if(_['isNil'](this[_0x8452('0x6')][_0x8452('0x11')][this[_0x8452('0x5')]['id']])){logger[_0x8452('0xf')](_0x8452('0x12'),this[_0x8452('0x7')]['id'],this[_0x8452('0x5')]['id']);setTimeout(this[_0x8452('0xe')][_0x8452('0x9')](this),0x3e8);}else{if(this[_0x8452('0x3')][_0x8452('0x13')]||util[_0x8452('0x14')](this[_0x8452('0x7')]['id'],this[_0x8452('0x6')][_0x8452('0x11')][this[_0x8452('0x5')]['id']],this[_0x8452('0x7')][_0x8452('0x15')],![])){this[_0x8452('0x6')][_0x8452('0x11')][this[_0x8452('0x5')]['id']][_0x8452('0x16')]=!![];this[_0x8452('0x6')][_0x8452('0x11')][this['agent']['id']]['busyQueue']=undefined;util[_0x8452('0x17')](this['notificationId'],this['squeue']['id'],this['realtime'][_0x8452('0x11')][this[_0x8452('0x5')]['id']],null,this[_0x8452('0x3')]);util[_0x8452('0x18')](this[_0x8452('0x7')]['id'],this[_0x8452('0x6')][_0x8452('0x11')][this[_0x8452('0x5')]['id']],_0x8452('0x19')+(this['routing'][_0x8452('0x13')]?':FORCED':''));}else{logger[_0x8452('0xf')](_0x8452('0x1a'),this[_0x8452('0x7')]['id'],this['agent']['id']);setTimeout(this[_0x8452('0xe')][_0x8452('0x9')](this),0x3e8);}}};Agent[_0x8452('0xd')][_0x8452('0xa')]=function(_0x33cb8e){if(_[_0x8452('0x1b')](this[_0x8452('0x6')]['agents'][this[_0x8452('0x5')]['id']])){return logger[_0x8452('0xf')](_0x8452('0x12'),this[_0x8452('0x7')]['id'],this[_0x8452('0x5')]['id']);}else{logger[_0x8452('0xf')](_0x8452('0x1c'),this[_0x8452('0x7')]['id'],this[_0x8452('0x5')]['id']);util[_0x8452('0x1d')](this['notificationId'],this[_0x8452('0x7')]['id'],this[_0x8452('0x6')][_0x8452('0x11')][this[_0x8452('0x5')]['id']],null,this['routing']);this['realtime'][_0x8452('0x11')][this[_0x8452('0x5')]['id']][_0x8452('0x16')]=![];this[_0x8452('0x6')][_0x8452('0x11')][this[_0x8452('0x5')]['id']]['busyQueue']=undefined;util[_0x8452('0x18')](this[_0x8452('0x7')]['id'],this[_0x8452('0x6')]['agents'][this[_0x8452('0x5')]['id']],_0x33cb8e?'STOP':'TIMEOUT');}if(!_0x33cb8e){setTimeout(this['push'][_0x8452('0x9')](this),0x3e8);}};function agent(_0x2c4eae,_0x2523b8,_0x374f36,_0x2c577f){return new Agent(_0x2c4eae,_0x2523b8,_0x374f36,_0x2c577f);}module[_0x8452('0x1e')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 55e64d3..bc65889 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 _0x55c4=['RINGING','busyQueue','name','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','writeLog','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','notificationId','routing','squeue','push','handleRun','bind','timeout','drained','handleDrained','prototype','handleTimeout','isNil','queue','Agents','length','realtime','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents'];(function(_0x622b3e,_0x2e4b3d){var _0x2d07b9=function(_0x1e63fc){while(--_0x1e63fc){_0x622b3e['push'](_0x622b3e['shift']());}};_0x2d07b9(++_0x2e4b3d);}(_0x55c4,0x109));var _0x455c=function(_0x35fa10,_0x63b4bf){_0x35fa10=_0x35fa10-0x0;var _0x128b5a=_0x55c4[_0x35fa10];return _0x128b5a;};'use strict';var _=require(_0x455c('0x0'));var uuid=require('uuid');var util=require(_0x455c('0x1'));var logger=require(_0x455c('0x2'))('routing');var Beepall=function(_0x263938,_0x5ae04c,_0x370fab,_0x5d8484){this[_0x455c('0x3')]=uuid['v4']();this['squeue']=_0x263938;this['queue']=_0x5ae04c;this['realtime']=_0x370fab;this[_0x455c('0x4')]=_0x5d8484;this[_0x455c('0x5')][_0x455c('0x6')](this[_0x455c('0x7')][_0x455c('0x8')](this),this['handleTimeout']['bind'](this));this[_0x455c('0x5')]['on'](_0x455c('0x9'),this['handleTimeout']['bind'](this));this['squeue']['on'](_0x455c('0xa'),this[_0x455c('0xb')][_0x455c('0x8')](this));};Beepall[_0x455c('0xc')]['push']=function(){this['squeue'][_0x455c('0x6')](this[_0x455c('0x7')][_0x455c('0x8')](this),this['handleTimeout'][_0x455c('0x8')](this));};Beepall[_0x455c('0xc')][_0x455c('0xb')]=function(_0x98acf7){this[_0x455c('0xd')](!![]);};Beepall[_0x455c('0xc')][_0x455c('0x7')]=function(_0x1fb38e){var _0x3f7b7b=!![];if(!_[_0x455c('0xe')](this[_0x455c('0xf')])&&!_[_0x455c('0xe')](this[_0x455c('0xf')][_0x455c('0x10')])&&this[_0x455c('0xf')][_0x455c('0x10')][_0x455c('0x11')]>0x0){for(var _0x28f40d=0x0,_0x1ba239;_0x28f40d0x0){for(var _0xdebdb4=0x0,_0x118849;_0xdebdb40x0&&_0x9067e2[_0x2e95f0+_0x2fa1('0x23')]>=_0x9067e2[_0x2e95f0+_0x2fa1('0x24')]){writeLog(_0x1b3434,_0x9067e2,_0x2e95f0[_0x2fa1('0x25')]()+_0x2fa1('0x26'));return![];}}return!![];};exports[_0x2fa1('0x27')]=function(_0x255974,_0x12ffc7,_0x28f35e,_0x28300d,_0x16c050){return sendNotification(!![],_0x255974,_0x12ffc7,_0x28f35e,_0x28300d,_0x16c050);};exports[_0x2fa1('0x28')]=function(_0x2a5dda,_0xdb4308,_0xd53b8,_0x300970,_0x5f41d1){return sendNotification(![],_0x2a5dda,_0xdb4308,_0xd53b8,_0x300970,_0x5f41d1);};exports[_0x2fa1('0x29')]=writeLog; \ No newline at end of file +var _0x2160=['mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name','split','account','notificationSound','notificationShake','body','queue','getMustacheRender','msg','I\x20can\x27t\x20render\x20your\x20template','message','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','util','../utils'];(function(_0x2d6b40,_0x4a592f){var _0x5d4ae6=function(_0x5acfe6){while(--_0x5acfe6){_0x2d6b40['push'](_0x2d6b40['shift']());}};_0x5d4ae6(++_0x4a592f);}(_0x2160,0x132));var _0x0216=function(_0x1a141c,_0x39f018){_0x1a141c=_0x1a141c-0x0;var _0x4b830f=_0x2160[_0x1a141c];return _0x4b830f;};'use strict';var _=require('lodash');var util=require(_0x0216('0x0'));var utils=require(_0x0216('0x1'));var Mustache=require(_0x0216('0x2'));var Redis=require(_0x0216('0x3'));var config=require(_0x0216('0x4'));var logger=require(_0x0216('0x5'))(_0x0216('0x6'));config[_0x0216('0x7')]=_[_0x0216('0x8')](config[_0x0216('0x7')],{'host':_0x0216('0x9'),'port':0x18eb});var io=require(_0x0216('0xa'))(new Redis(config[_0x0216('0x7')]));function emit(_0x462464,_0x47af64,_0x337ccd){io['to'](_0x462464)[_0x0216('0xb')](_0x47af64,_0x337ccd);}function sendNotification(_0x578377,_0x555235,_0x3f6b7e,_0x34ec07,_0x34fbb5,_0x5c96d8){io['to'](util[_0x0216('0xc')](_0x0216('0xd'),_0x34ec07[_0x0216('0xe')]))['emit']('user:save',_0x34ec07);var _0x3a6c4d=_0x5c96d8||{};var _0x2bbf8b=_0x3f6b7e[_0x0216('0xf')]('.');var _0x5815aa={'uniqueid':_0x555235,'channel':_0x2bbf8b[0x0],'id':_0x2bbf8b[0x1],'title':_0x2bbf8b[0x0]+'\x20interaction','interactionId':_0x2bbf8b[0x2],'queue':_0x34fbb5?_0x34fbb5[_0x0216('0xe')]:null,'sound':_0x3a6c4d[_0x0216('0x10')][_0x0216('0x11')],'shake':_0x3a6c4d[_0x0216('0x10')][_0x0216('0x12')]};try{if(!_0x3a6c4d[_0x0216('0x13')]){_0x3a6c4d[_0x0216('0x13')]={};}if(_0x34fbb5){_0x3a6c4d['body']['queue']=_0x34fbb5;}else if(_0x3a6c4d[_0x0216('0x13')][_0x0216('0x14')]){delete _0x3a6c4d[_0x0216('0x13')][_0x0216('0x14')];}_0x5815aa['msg']=utils[_0x0216('0x15')](_0x3a6c4d[_0x0216('0x10')]['notificationTemplate'],_0x3a6c4d);}catch(_0x80dce5){_0x5815aa[_0x0216('0x16')]=_0x0216('0x17');logger['error'](util['format']('[%s][QUEUE]\x20%s',_0x555235,_0x80dce5[_0x0216('0x18')]));}io['to'](util['format'](_0x0216('0xd'),_0x34ec07['name']))[_0x0216('0xb')](util[_0x0216('0xc')]('notification:%s',_0x578377?_0x0216('0x19'):_0x0216('0x1a')),_0x5815aa);}function writeLog(_0x101c1f,_0x101ea5,_0x41c772){return logger[_0x0216('0x1b')](util[_0x0216('0xc')](_0x0216('0x1c'),_0x101c1f,_0x101ea5[_0x0216('0xe')],_0x41c772));}exports[_0x0216('0x1d')]=function(_0x3b19c4,_0x403a13,_0x935a30,_0x59ae0f){if(_0x403a13[_0x0216('0x1e')]){writeLog(_0x3b19c4,_0x403a13,_0x0216('0x1f'));return![];}if(!_0x403a13[_0x0216('0x20')]){writeLog(_0x3b19c4,_0x403a13,_0x0216('0x21'));return![];}if(_0x403a13[_0x935a30+_0x0216('0x22')]){writeLog(_0x3b19c4,_0x403a13,_0x0216('0x23'));return![];}if(_0x59ae0f&&_0x403a13['hasOwnProperty'](_0x935a30+'Capacity')&&_0x403a13[_0x0216('0x24')](_0x935a30+'CurrentCapacity')){if(_0x403a13[_0x935a30+_0x0216('0x25')]>0x0&&_0x403a13[_0x935a30+_0x0216('0x26')]>=_0x403a13[_0x935a30+_0x0216('0x25')]){writeLog(_0x3b19c4,_0x403a13,_0x935a30[_0x0216('0x27')]()+_0x0216('0x28'));return![];}}return!![];};exports[_0x0216('0x29')]=function(_0x2758b3,_0x26ea10,_0x258275,_0xe64ab8,_0x3b37e3){return sendNotification(!![],_0x2758b3,_0x26ea10,_0x258275,_0xe64ab8,_0x3b37e3);};exports[_0x0216('0x2a')]=function(_0x342fce,_0x364774,_0x24a509,_0x2cfa67,_0x3ea1a6){return sendNotification(![],_0x342fce,_0x364774,_0x24a509,_0x2cfa67,_0x3ea1a6);};exports[_0x0216('0x2b')]=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 345fccc..2dc43eb 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 _0xaeee=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','error','[%s][SYSTEM]\x20%s','isObject','shelljs','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','info'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0xaeee,0x1be));var _0xeaee=function(_0x3c77e5,_0x16c4d9){_0x3c77e5=_0x3c77e5-0x0;var _0xdb089c=_0xaeee[_0x3c77e5];return _0xdb089c;};'use strict';var schema=require('validate');var sh=require(_0xeaee('0x0'));var _=require(_0xeaee('0x1'));var utils=require(_0xeaee('0x2'));var logger=require(_0xeaee('0x3'))('routing');var system=schema({'command':{'type':_0xeaee('0x4'),'required':!![],'message':_0xeaee('0x5')}});exports[_0xeaee('0x6')]=function(_0x5e677f,_0x1dadfa){return function(_0x3ece67){try{var _0x136518={'command':_0x1dadfa[0x0]};var _0x27d698=system[_0xeaee('0x7')](_0x136518,{'typecast':!![]});if(_0x27d698[_0xeaee('0x8')]){logger['error']('[%s][SYSTEM]\x20%s',_0x5e677f,_['map'](_0x27d698,'message')['join'](',\x20'));logger[_0xeaee('0x9')](_0xeaee('0xa'),_0x5e677f);_0x3ece67[_0xeaee('0xb')]();}else{var _0x427bab=this;var _0xf81fe0=utils[_0xeaee('0xc')](_0x1dadfa[0x0],this);logger[_0xeaee('0x9')](_0xeaee('0xd'),_0x5e677f,_0xf81fe0);sh[_0xeaee('0xe')](_[_0xeaee('0xf')](_0xf81fe0),function(_0x50f9bc,_0x138ffd){logger[_0xeaee('0x9')](_0xeaee('0x10'),_0x5e677f,_0x50f9bc);if(_0x50f9bc==0x0){var _0x8fa95d=_0x138ffd[_0xeaee('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x1dadfa[0x1])||_[_0xeaee('0x12')](_0x1dadfa[0x1])){logger['info'](_0xeaee('0x13'),_0x5e677f);_0x427bab['body'][_0x1dadfa[0x1]]=_0x8fa95d;}else{logger[_0xeaee('0x9')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x5e677f,_0x1dadfa[0x1],_0x8fa95d);_0x427bab[_0xeaee('0x14')][_0x1dadfa[0x1]]=_0x8fa95d;}}_0x3ece67[_0xeaee('0xb')]();});}}catch(_0x177199){logger[_0xeaee('0x15')](_0xeaee('0x16'),_0x5e677f,_[_0xeaee('0x17')](_0x177199)?JSON['stringify'](_0x177199):_0x177199);logger['info'](_0xeaee('0xa'),_0x5e677f);_0x3ece67[_0xeaee('0xb')]();}};}; \ No newline at end of file +var _0x04be=['[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty'];(function(_0x2ee822,_0x4c15ab){var _0x3df987=function(_0x29e89a){while(--_0x29e89a){_0x2ee822['push'](_0x2ee822['shift']());}};_0x3df987(++_0x4c15ab);}(_0x04be,0x113));var _0xe04b=function(_0x1e1729,_0x3321b5){_0x1e1729=_0x1e1729-0x0;var _0x328e0d=_0x04be[_0x1e1729];return _0x328e0d;};'use strict';var schema=require(_0xe04b('0x0'));var sh=require(_0xe04b('0x1'));var _=require(_0xe04b('0x2'));var utils=require(_0xe04b('0x3'));var logger=require(_0xe04b('0x4'))(_0xe04b('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xe04b('0x6')]=function(_0x2045b4,_0x3ac24d){return function(_0x1f6c52){try{var _0x5196d6={'command':_0x3ac24d[0x0]};var _0x280c77=system[_0xe04b('0x0')](_0x5196d6,{'typecast':!![]});if(_0x280c77[_0xe04b('0x7')]){logger[_0xe04b('0x8')](_0xe04b('0x9'),_0x2045b4,_[_0xe04b('0xa')](_0x280c77,_0xe04b('0xb'))[_0xe04b('0xc')](',\x20'));logger['info'](_0xe04b('0xd'),_0x2045b4);_0x1f6c52[_0xe04b('0xe')]();}else{var _0x61abdf=this;var _0x221cc7=utils[_0xe04b('0xf')](_0x3ac24d[0x0],this);logger[_0xe04b('0x10')](_0xe04b('0x11'),_0x2045b4,_0x221cc7);sh['exec'](_[_0xe04b('0x12')](_0x221cc7),function(_0x4b1d18,_0x3e6d3b){logger['info'](_0xe04b('0x13'),_0x2045b4,_0x4b1d18);if(_0x4b1d18==0x0){var _0x1539a4=_0x3e6d3b[_0xe04b('0x14')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x3ac24d[0x1])||_[_0xe04b('0x15')](_0x3ac24d[0x1])){logger[_0xe04b('0x10')](_0xe04b('0x16'),_0x2045b4);_0x61abdf[_0xe04b('0x17')][_0x3ac24d[0x1]]=_0x1539a4;}else{logger[_0xe04b('0x10')](_0xe04b('0x18'),_0x2045b4,_0x3ac24d[0x1],_0x1539a4);_0x61abdf[_0xe04b('0x17')][_0x3ac24d[0x1]]=_0x1539a4;}}_0x1f6c52[_0xe04b('0xe')]();});}}catch(_0x4f4c92){logger[_0xe04b('0x8')](_0xe04b('0x9'),_0x2045b4,_[_0xe04b('0x19')](_0x4f4c92)?JSON[_0xe04b('0x1a')](_0x4f4c92):_0x4f4c92);logger[_0xe04b('0x10')](_0xe04b('0xd'),_0x2045b4);_0x1f6c52['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 99bb267..22d4220 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 _0x1716=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','length','error','[%s][TAG]\x20%s','message','join','info','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','finally','isObject','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','lodash','../../rpc/chatInteraction'];(function(_0x20bec4,_0x38d8e4){var _0x4b9828=function(_0x20c2af){while(--_0x20c2af){_0x20bec4['push'](_0x20bec4['shift']());}};_0x4b9828(++_0x38d8e4);}(_0x1716,0x8e));var _0x6171=function(_0x1aa66a,_0x5ed49){_0x1aa66a=_0x1aa66a-0x0;var _0x5f4288=_0x1716[_0x1aa66a];return _0x5f4288;};'use strict';var schema=require(_0x6171('0x0'));var _=require(_0x6171('0x1'));var rpc={'chatInteraction':require(_0x6171('0x2')),'openchannelInteraction':require(_0x6171('0x3')),'smsInteraction':require(_0x6171('0x4')),'mailInteraction':require(_0x6171('0x5')),'faxInteraction':require(_0x6171('0x6')),'whatsappInteraction':require(_0x6171('0x7'))};var logger=require(_0x6171('0x8'))(_0x6171('0x9'));var tag=schema({'tag':{'type':_0x6171('0xa'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x6171('0xb')]=function(_0x54d0dc,_0x558e1,_0x115462,_0x4111cd){return function(_0x4aafeb){try{var _0x29a8a9={'tag':_0x558e1[0x0]};var _0x485b32=tag[_0x6171('0x0')](_0x29a8a9,{'typecast':!![]});if(_0x485b32[_0x6171('0xc')]){logger[_0x6171('0xd')](_0x6171('0xe'),_0x54d0dc,_['map'](_0x485b32,_0x6171('0xf'))[_0x6171('0x10')](',\x20'));logger[_0x6171('0x11')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x54d0dc);_0x4aafeb[_0x6171('0x12')]();}else{var _0x3c7af5={'ids':[_0x558e1[0x0]]};if(rpc[_0x4111cd[_0x6171('0x13')]+_0x6171('0x14')]){rpc[_0x4111cd['channel']+'Interaction'][_0x6171('0x15')](_0x4111cd[_0x6171('0x16')]['id'],_0x3c7af5)[_0x6171('0x17')](function(_0x17830d){logger[_0x6171('0x11')](_0x6171('0x18'),_0x54d0dc,_0x558e1[0x1],_0x4111cd[_0x6171('0x13')],_0x4111cd[_0x6171('0x16')]['id']);})['catch'](function(_0x4820a7){logger[_0x6171('0xd')](_0x6171('0xe'),_0x54d0dc,JSON[_0x6171('0x19')](_0x4820a7));logger[_0x6171('0x11')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x54d0dc);})[_0x6171('0x1a')](function(){_0x4aafeb[_0x6171('0x12')]();});}}}catch(_0x445d22){logger[_0x6171('0xd')](_0x6171('0xe'),_0x54d0dc,_[_0x6171('0x1b')](_0x445d22)?JSON[_0x6171('0x19')](_0x445d22):_0x445d22);logger[_0x6171('0x11')](_0x6171('0x1c'),_0x54d0dc);_0x4aafeb['next']();}};}; \ No newline at end of file +var _0x6236=['isObject','validate','lodash','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x6236,0x181));var _0x6623=function(_0x4cb7c7,_0x4f4808){_0x4cb7c7=_0x4cb7c7-0x0;var _0x497052=_0x6236[_0x4cb7c7];return _0x497052;};'use strict';var schema=require(_0x6623('0x0'));var _=require(_0x6623('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x6623('0x2')),'mailInteraction':require(_0x6623('0x3')),'faxInteraction':require(_0x6623('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x6623('0x5'))(_0x6623('0x6'));var tag=schema({'tag':{'type':_0x6623('0x7'),'required':!![],'message':_0x6623('0x8')}});exports[_0x6623('0x9')]=function(_0x1f9223,_0x120b4a,_0x4d670e,_0x1e730a){return function(_0x3a499d){try{var _0x21417e={'tag':_0x120b4a[0x0]};var _0x15e212=tag['validate'](_0x21417e,{'typecast':!![]});if(_0x15e212[_0x6623('0xa')]){logger['error']('[%s][TAG]\x20%s',_0x1f9223,_[_0x6623('0xb')](_0x15e212,_0x6623('0xc'))[_0x6623('0xd')](',\x20'));logger[_0x6623('0xe')](_0x6623('0xf'),_0x1f9223);_0x3a499d['next']();}else{var _0x230b7d={'ids':[_0x120b4a[0x0]]};if(rpc[_0x1e730a[_0x6623('0x10')]+_0x6623('0x11')]){rpc[_0x1e730a['channel']+_0x6623('0x11')][_0x6623('0x12')](_0x1e730a[_0x6623('0x13')]['id'],_0x230b7d)['then'](function(_0x498480){logger[_0x6623('0xe')](_0x6623('0x14'),_0x1f9223,_0x120b4a[0x1],_0x1e730a[_0x6623('0x10')],_0x1e730a['interaction']['id']);})[_0x6623('0x15')](function(_0x39a265){logger['error'](_0x6623('0x16'),_0x1f9223,JSON['stringify'](_0x39a265));logger[_0x6623('0xe')](_0x6623('0xf'),_0x1f9223);})['finally'](function(){_0x3a499d['next']();});}}}catch(_0x3ee601){logger['error'](_0x6623('0x16'),_0x1f9223,_[_0x6623('0x17')](_0x3ee601)?JSON['stringify'](_0x3ee601):_0x3ee601);logger[_0x6623('0xe')](_0x6623('0xf'),_0x1f9223);_0x3a499d['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 c9ccdbf..ebb55e3 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 _0xfa68=['message','account','interaction','list','mustache','lodash','exports','render','merge','contact'];(function(_0x5e445d,_0x167181){var _0x3f70ff=function(_0x1b9330){while(--_0x1b9330){_0x5e445d['push'](_0x5e445d['shift']());}};_0x3f70ff(++_0x167181);}(_0xfa68,0x86));var _0x8fa6=function(_0xc7856d,_0x4babb0){_0xc7856d=_0xc7856d-0x0;var _0x29b50a=_0xfa68[_0xc7856d];return _0x29b50a;};'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 +var _0x1306=['message','account','interaction','list','mustache','lodash','exports','render','merge','body','contact'];(function(_0x9cd22d,_0x56b74a){var _0x35109e=function(_0x51a3a0){while(--_0x51a3a0){_0x9cd22d['push'](_0x9cd22d['shift']());}};_0x35109e(++_0x56b74a);}(_0x1306,0x17a));var _0x6130=function(_0x3f5195,_0x4c2ea1){_0x3f5195=_0x3f5195-0x0;var _0x169969=_0x1306[_0x3f5195];return _0x169969;};'use strict';var Mustache=require(_0x6130('0x0'));var _=require(_0x6130('0x1'));module[_0x6130('0x2')]={'getMustacheRender':function(_0xa1da01,_0x193b62){return Mustache[_0x6130('0x3')](_0xa1da01,_[_0x6130('0x4')](_0x193b62[_0x6130('0x5')],{'contact':_0x193b62[_0x6130('0x6')],'message':_0x193b62[_0x6130('0x7')],'account':_0x193b62[_0x6130('0x8')],'interaction':_0x193b62[_0x6130('0x9')],'list':_0x193b62[_0x6130('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 6339135..c9d94ea 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 _0x317f=['end','QueueReport','update','UserId','catch','error','message\x20is\x20empty','agent','agents','busy','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','waiting','mailQueues','loggedIn','name','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','rules','message','interaction','applications','isArray','length','existsSync','app','.js','toLowerCase','autoreply','appdata','split','push','slice','join','dialogflow','amazonlex','tag','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','channel','emit'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x317f,0x82));var _0xf317=function(_0x53dee9,_0x1dc404){_0x53dee9=_0x53dee9-0x0;var _0x4c5da0=_0x317f[_0x53dee9];return _0x4c5da0;};'use strict';var _=require(_0xf317('0x0'));var util=require(_0xf317('0x1'));var path=require(_0xf317('0x2'));var fs=require('fs');var jayson=require(_0xf317('0x3'));var BPromise=require(_0xf317('0x4'));var uuid=require('uuid');var config=require('../../../config/environment');var logger=require(_0xf317('0x5'))(_0xf317('0x6'));var rpc={'openchannelQueueReport':require(_0xf317('0x7')),'mailQueueReport':require(_0xf317('0x8')),'chatQueueReport':require(_0xf317('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xf317('0xa'))};var RuleEngine=require(_0xf317('0xb'));function getId(_0x379c36,_0x33a9ab,_0x40c4c6){return util[_0xf317('0xc')](_0xf317('0xd'),_0x379c36,_0x33a9ab||0x0,_0x40c4c6||0x0);}function getIntervals(_0x376035,_0x543721){var _0x4a1385=[];if(!_[_0xf317('0xe')](_0x543721[_0xf317('0xf')])&&!_[_0xf317('0xe')](_0x376035[_0x543721[_0xf317('0xf')]])&&!_[_0xf317('0xe')](_0x376035[_0x543721['IntervalId']]['Intervals'])){_0x4a1385=_[_0xf317('0x10')](_0x376035[_0x543721[_0xf317('0xf')]][_0xf317('0x11')],_0xf317('0x12'));}else if(!_[_0xf317('0xe')](_0x543721[_0xf317('0x12')])){_0x4a1385=[_0x543721[_0xf317('0x12')]];}return _0x4a1385;}exports['listen']=function(_0x851b7c){_0x851b7c[_0xf317('0x13')]={};return new BPromise(function(_0x5be48f,_0x3df151){var _0x4165e9={'Start':function(_0x108be4){var _0x23765c=this;return new Promise(function(_0x43c91d,_0x28ff29){if(_0x108be4){try{var _0x442cba=[];var _0x357bbd=getId(_0x108be4['channel'],_0x108be4[_0xf317('0x14')]?_0x108be4[_0xf317('0x14')]['id']:0x0,_0x108be4[_0xf317('0x15')]?_0x108be4[_0xf317('0x15')]['id']:0x0);if(_0x108be4[_0xf317('0x16')]&&_[_0xf317('0x17')](_0x108be4[_0xf317('0x16')])&&_0x108be4[_0xf317('0x16')][_0xf317('0x18')]){for(var _0x317eaf=0x0;_0x317eaf<_0x108be4[_0xf317('0x16')]['length'];_0x317eaf+=0x1){var _0x2c6782=_0x108be4[_0xf317('0x16')][_0x317eaf];if(fs[_0xf317('0x19')](path['join'](__dirname,'applications',_0x2c6782[_0xf317('0x1a')]+_0xf317('0x1b')))){var _0x3521c4=[];switch(_0x2c6782[_0xf317('0x1a')][_0xf317('0x1c')]()){case _0xf317('0x1d'):var _0x135e38=_0x2c6782[_0xf317('0x1e')][_0xf317('0x1f')](',');_0x3521c4[_0xf317('0x20')](_0x135e38[0x0]);_0x3521c4[_0xf317('0x20')](_0x135e38[_0xf317('0x21')](0x1,_0x135e38['length'])[_0xf317('0x22')](','));break;case _0xf317('0x23'):var _0xccf4f8=_0x2c6782[_0xf317('0x1e')][_0xf317('0x1f')](',');_0x3521c4['push'](_0xccf4f8[0x0]);_0x3521c4['push'](_0xccf4f8[0x1]);_0x3521c4['push'](_0xccf4f8['slice'](0x2,_0xccf4f8[_0xf317('0x18')])['join'](','));break;case _0xf317('0x24'):var _0x1e8371=_0x2c6782[_0xf317('0x1e')]['split'](',');_0x3521c4['push'](_0x1e8371[0x0]);_0x3521c4[_0xf317('0x20')](_0x1e8371[0x1]);_0x3521c4[_0xf317('0x20')](_0x1e8371[0x2]);_0x3521c4['push'](_0x1e8371[0x3]);_0x3521c4[_0xf317('0x20')](_0x1e8371['slice'](0x4,_0x1e8371[_0xf317('0x18')])[_0xf317('0x22')](','));break;case'message':_0x3521c4[_0xf317('0x20')](_0x2c6782[_0xf317('0x1e')]);break;case _0xf317('0x25'):_0x3521c4[_0xf317('0x20')](_0x2c6782['TagId']);_0x3521c4[_0xf317('0x20')](_0x2c6782[_0xf317('0x1e')]);break;default:_0x3521c4=_[_0xf317('0xe')](_0x2c6782[_0xf317('0x1e')])?[]:_0x2c6782[_0xf317('0x1e')][_0xf317('0x1f')](',');}var _0x26e9b3={'id':util['format']('%s:%s:%s',_0x357bbd,_0x2c6782['id'],_0x2c6782[_0xf317('0x1a')]),'condition':require(_0xf317('0x26'))[_0xf317('0x27')](_0x357bbd,getIntervals(_0x851b7c[_0xf317('0x28')],_0x2c6782),_0x851b7c),'consequence':require(_0xf317('0x29')+_0x2c6782[_0xf317('0x1a')])[_0xf317('0x2a')](_0x357bbd,_0x3521c4,_0x851b7c,_0x108be4),'p':_0x2c6782[_0xf317('0x2b')]||0x0};logger[_0xf317('0x2c')](_0xf317('0x2d'),_0x26e9b3['id'],_0xf317('0x2e'),getIntervals(_0x851b7c['intervals'],_0x2c6782)[_0xf317('0x22')](_0xf317('0x2f')));_0x442cba['push'](_0x26e9b3);}else{logger['error'](_0xf317('0x30'),path[_0xf317('0x22')](__dirname,_0xf317('0x16'),_0x2c6782[_0xf317('0x1a')]+_0xf317('0x1b')));}}_0x851b7c[_0xf317('0x13')][_0x357bbd]=new RuleEngine(_0x442cba);_0x851b7c[_0xf317('0x13')][_0x357bbd][_0xf317('0x31')](_0x108be4,function(_0x1b7421){logger['info'](_0xf317('0x32'),JSON[_0xf317('0x33')](_0x1b7421[_0xf317('0x34')]));if(_0x851b7c[_0xf317('0x13')][_0x357bbd]){_0x851b7c[_0xf317('0x13')][_0x357bbd]['emit']('complete');}});return _0x43c91d({'code':0xc8,'message':_0x108be4});}else{logger['info'](_0xf317('0x35'));return _0x43c91d({'code':0xc8,'message':_0x108be4});}}catch(_0x413da9){logger['error'](_0x413da9[_0xf317('0x36')]);return _0x28ff29(_0x23765c['error'](0x1f4,_0x413da9));}}return _0x28ff29(_0xf317('0x37'));});},'AcceptMessage':function(_0x2861a7){var _0x243a9b=this;return new Promise(function(_0x12004d,_0x41ee0d){if(_0x2861a7[_0xf317('0x14')]&&_0x2861a7[_0xf317('0x14')]['id']){try{var _0x46f2e9=getId(_0x2861a7[_0xf317('0x38')],_0x2861a7['message']?_0x2861a7[_0xf317('0x14')]['id']:0x0,_0x2861a7[_0xf317('0x15')]?_0x2861a7['interaction']['id']:0x0);if(_0x851b7c[_0xf317('0x13')][_0x46f2e9]){_0x851b7c[_0xf317('0x13')][_0x46f2e9][_0xf317('0x39')](_0xf317('0x3a'));if(rpc[_0x2861a7[_0xf317('0x38')]+_0xf317('0x3b')]){rpc[_0x2861a7[_0xf317('0x38')]+_0xf317('0x3b')][_0xf317('0x3c')](_0x46f2e9,{'UserId':_0x2861a7['message'][_0xf317('0x3d')]})[_0xf317('0x3e')](function(_0x593de2){logger[_0xf317('0x3f')]('error\x20update\x20queue\x20report');});}}return _0x12004d({'code':0xc8,'message':_0x2861a7});}catch(_0x41a7fd){logger['error'](_0x41a7fd[_0xf317('0x36')]);return _0x41ee0d(_0x243a9b['error'](0x1f4,_0x41a7fd));}}logger[_0xf317('0x3f')](_0xf317('0x40'));return _0x41ee0d(_0x243a9b[_0xf317('0x3f')](0x1f4,_0xf317('0x40')));});},'RejectMessage':function(_0x241a1e){var _0x4556f4=this;return new Promise(function(_0x94766c,_0x4e717b){if(_0x241a1e[_0xf317('0x41')]&&_0x241a1e[_0xf317('0x41')]['id']){try{if(_0x851b7c[_0xf317('0x42')][_0x241a1e[_0xf317('0x41')]['id']]){_0x851b7c[_0xf317('0x42')][_0x241a1e['agent']['id']][_0xf317('0x43')]=![];_0x851b7c['agents'][_0x241a1e[_0xf317('0x41')]['id']]['busyQueue']=undefined;}return _0x94766c({'code':0xc8,'message':_0x241a1e});}catch(_0x976038){logger[_0xf317('0x3f')](_0x976038[_0xf317('0x36')]);return _0x4e717b(_0x4556f4[_0xf317('0x3f')](0x1f4,_0x976038));}}logger[_0xf317('0x3f')](_0xf317('0x40'));return _0x4e717b(_0x4556f4['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x400dd8){var _0x406aac=this;return new Promise(function(_0x2daef4,_0x1443cd){if(_0x400dd8[_0xf317('0x38')]&&_0x400dd8['interaction']&&_0x400dd8[_0xf317('0x15')]['id']){try{var _0x3d5c87=getId(_0x400dd8[_0xf317('0x38')],_0x400dd8[_0xf317('0x14')]?_0x400dd8['message']['id']:0x0,_0x400dd8[_0xf317('0x15')]?_0x400dd8[_0xf317('0x15')]['id']:0x0);if(_0x851b7c[_0xf317('0x13')][_0x3d5c87]){_0x851b7c[_0xf317('0x13')][_0x3d5c87][_0xf317('0x39')](_0xf317('0x3a'));}return _0x2daef4({'code':0xc8,'message':_0x400dd8});}catch(_0xa0f73f){logger[_0xf317('0x3f')](_0xa0f73f[_0xf317('0x36')]);return _0x1443cd(_0x406aac[_0xf317('0x3f')](0x1f4,_0xa0f73f));}}logger['error']('message\x20is\x20empty');return _0x1443cd(_0x406aac[_0xf317('0x3f')](0x1f4,_0xf317('0x40')));});},'AgentCapacity':function(_0x3b3048){var _0xf8f7f3=this;return new Promise(function(_0x3f41f8,_0x859fe1){if(_0x851b7c['agents'][_0xf317('0x44')](_0x3b3048['id'])){for(var _0x2511ff in _0x3b3048[_0xf317('0x45')]){if(_0x3b3048['capacity'][_0xf317('0x44')](_0x2511ff)){if(_0x851b7c[_0xf317('0x42')][_0x3b3048['id']][_0xf317('0x44')](_0x2511ff+_0xf317('0x46'))){_0x851b7c['agents'][_0x3b3048['id']][_0x2511ff+'CurrentCapacity']=parseInt(_0x3b3048[_0xf317('0x45')][_0x2511ff],0xa);}}}_0x851b7c[_0xf317('0x42')][_0x3b3048['id']]['updateRealtime']();return _0x3f41f8({'code':0xc8,'message':_0x851b7c[_0xf317('0x42')][_0x3b3048['id']]});}else{return _0x859fe1(_0xf8f7f3[_0xf317('0x3f')](0x1f4,_0xf317('0x47')));}});},'Agents':function(_0x319862){return new Promise(function(_0x1c0b0a,_0x5494e4){var _0x55ae3e=_[_0xf317('0x48')](_0x851b7c[_0xf317('0x42')]);_0x1c0b0a({'count':_0x55ae3e[_0xf317('0x18')],'rows':_0x55ae3e});});},'ChatQueues':function(_0x123bc8){return new Promise(function(_0xd3609e,_0xf280cf){var _0x1dd353=[];for(var _0x593c7a in _0x851b7c['chatQueues']){if(_0x851b7c[_0xf317('0x49')][_0xf317('0x44')](_0x593c7a)){var _0x43a9b6=_0x851b7c[_0xf317('0x49')][_0x593c7a];var _0x4e06c6={'id':_0x43a9b6['id'],'available':_0x43a9b6[_0xf317('0x4a')],'loggedIn':_0x43a9b6['loggedIn'],'name':_0x43a9b6['name'],'paused':_0x43a9b6['paused'],'waiting':_0x43a9b6[_0xf317('0x4b')]};_0x1dd353[_0xf317('0x20')](_0x4e06c6);}}_0xd3609e({'count':_0x1dd353['length'],'rows':_0x1dd353});});},'MailQueues':function(_0x52fb9d){return new Promise(function(_0x5e5b17,_0x548200){var _0x281986=[];for(var _0x266b6b in _0x851b7c[_0xf317('0x4c')]){if(_0x851b7c[_0xf317('0x4c')][_0xf317('0x44')](_0x266b6b)){var _0x2fbc57=_0x851b7c[_0xf317('0x4c')][_0x266b6b];var _0x49badb={'id':_0x2fbc57['id'],'available':_0x2fbc57['available'],'loggedIn':_0x2fbc57[_0xf317('0x4d')],'name':_0x2fbc57[_0xf317('0x4e')],'paused':_0x2fbc57[_0xf317('0x4f')],'waiting':_0x2fbc57['waiting']};_0x281986[_0xf317('0x20')](_0x49badb);}}_0x5e5b17({'count':_0x281986[_0xf317('0x18')],'rows':_0x281986});});},'OpenchannelQueues':function(_0x4579e4){return new Promise(function(_0x17a99c,_0x1d0cd5){var _0x2d0830=[];for(var _0x1e9195 in _0x851b7c[_0xf317('0x50')]){if(_0x851b7c[_0xf317('0x50')]['hasOwnProperty'](_0x1e9195)){var _0x329177=_0x851b7c[_0xf317('0x50')][_0x1e9195];var _0x2c9161={'id':_0x329177['id'],'available':_0x329177['available'],'loggedIn':_0x329177[_0xf317('0x4d')],'name':_0x329177[_0xf317('0x4e')],'paused':_0x329177['paused'],'waiting':_0x329177['waiting']};_0x2d0830['push'](_0x2c9161);}}_0x17a99c({'count':_0x2d0830[_0xf317('0x18')],'rows':_0x2d0830});});},'SmsQueues':function(_0x3c7c3c){return new Promise(function(_0x5dfff5,_0x46049a){var _0x5d9401=[];for(var _0x169c2d in _0x851b7c[_0xf317('0x51')]){if(_0x851b7c[_0xf317('0x51')][_0xf317('0x44')](_0x169c2d)){var _0x2eaa17=_0x851b7c[_0xf317('0x51')][_0x169c2d];var _0x55b35b={'id':_0x2eaa17['id'],'available':_0x2eaa17[_0xf317('0x4a')],'loggedIn':_0x2eaa17[_0xf317('0x4d')],'name':_0x2eaa17['name'],'paused':_0x2eaa17[_0xf317('0x4f')],'waiting':_0x2eaa17[_0xf317('0x4b')]};_0x5d9401[_0xf317('0x20')](_0x55b35b);}}_0x5dfff5({'count':_0x5d9401[_0xf317('0x18')],'rows':_0x5d9401});});},'FaxQueues':function(_0x12d2c0){return new Promise(function(_0x165840,_0x239486){var _0x2f0a92=[];for(var _0xfebe6f in _0x851b7c[_0xf317('0x52')]){if(_0x851b7c[_0xf317('0x52')][_0xf317('0x44')](_0xfebe6f)){var _0x207794=_0x851b7c['faxQueues'][_0xfebe6f];var _0x595179={'id':_0x207794['id'],'available':_0x207794[_0xf317('0x4a')],'loggedIn':_0x207794[_0xf317('0x4d')],'name':_0x207794[_0xf317('0x4e')],'paused':_0x207794[_0xf317('0x4f')],'waiting':_0x207794[_0xf317('0x4b')]};_0x2f0a92[_0xf317('0x20')](_0x595179);}}_0x165840({'count':_0x2f0a92['length'],'rows':_0x2f0a92});});},'WhatsappQueues':function(_0x483524){return new Promise(function(_0x361100,_0x18c7e6){var _0x11191e=[];for(var _0x34ab77 in _0x851b7c[_0xf317('0x53')]){if(_0x851b7c[_0xf317('0x53')]['hasOwnProperty'](_0x34ab77)){var _0x4d0f14=_0x851b7c['whatsappQueues'][_0x34ab77];var _0x536e9e={'id':_0x4d0f14['id'],'available':_0x4d0f14[_0xf317('0x4a')],'loggedIn':_0x4d0f14[_0xf317('0x4d')],'name':_0x4d0f14[_0xf317('0x4e')],'paused':_0x4d0f14[_0xf317('0x4f')],'waiting':_0x4d0f14['waiting']};_0x11191e[_0xf317('0x20')](_0x536e9e);}}_0x361100({'count':_0x11191e[_0xf317('0x18')],'rows':_0x11191e});});},'ChatQueuesWaitingInteractions':function(_0x5ea0e9){return new Promise(function(_0x354774,_0x451372){var _0x59a09d=_[_0xf317('0x48')](_0x851b7c[_0xf317('0x54')]);_0x354774({'count':_0x59a09d['length'],'rows':_0x59a09d});});},'MailQueuesWaitingInteractions':function(_0x484503){return new Promise(function(_0x52a0c3,_0x286fe0){var _0x176058=_[_0xf317('0x48')](_0x851b7c[_0xf317('0x55')]);_0x52a0c3({'count':_0x176058[_0xf317('0x18')],'rows':_0x176058});});},'OpenchannelQueuesWaitingInteractions':function(_0x4ac586){return new Promise(function(_0x392280,_0x6f075a){var _0x2a9cf2=_[_0xf317('0x48')](_0x851b7c[_0xf317('0x56')]);_0x392280({'count':_0x2a9cf2[_0xf317('0x18')],'rows':_0x2a9cf2});});},'SmsQueuesWaitingInteractions':function(_0x45067e){return new Promise(function(_0x2a80e7,_0x3356d6){var _0x395148=_[_0xf317('0x48')](_0x851b7c['smsQueuesWaitingInteractions']);_0x2a80e7({'count':_0x395148[_0xf317('0x18')],'rows':_0x395148});});},'FaxQueuesWaitingInteractions':function(_0x102582){return new Promise(function(_0x4e0f04,_0xdfbb3){var _0x52aa9e=_[_0xf317('0x48')](_0x851b7c['faxQueuesWaitingInteractions']);_0x4e0f04({'count':_0x52aa9e['length'],'rows':_0x52aa9e});});},'WhatsappQueuesWaitingInteractions':function(_0x557d5a){return new Promise(function(_0x18a79c,_0x33f2b9){var _0x632655=_['values'](_0x851b7c[_0xf317('0x57')]);_0x18a79c({'count':_0x632655[_0xf317('0x18')],'rows':_0x632655});});}};var _0x3d6553=jayson[_0xf317('0x58')](_0x4165e9)[_0xf317('0x59')]();_0x3d6553['on'](_0xf317('0x3f'),function(_0x5b8889){logger['error'](JSON[_0xf317('0x33')](_0x5b8889));return _0x3df151(_0x5b8889);});_0x3d6553[_0xf317('0x5a')](0x232c,'127.0.0.1',function(){console[_0xf317('0x5b')](_0xf317('0x5c'),0x232c);return _0x5be48f(_0xf317('0x5d')+0x232c);});});}; \ No newline at end of file +var _0x6197=['error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','values','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','interaction','applications','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','push','slice','amazonlex','message','tag','TagId','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','QueueReport','UserId','catch'];(function(_0x3203a1,_0x46c498){var _0x24215e=function(_0x4ffab0){while(--_0x4ffab0){_0x3203a1['push'](_0x3203a1['shift']());}};_0x24215e(++_0x46c498);}(_0x6197,0x132));var _0x7619=function(_0x45ff0f,_0x5917fa){_0x45ff0f=_0x45ff0f-0x0;var _0xafac18=_0x6197[_0x45ff0f];return _0xafac18;};'use strict';var _=require(_0x7619('0x0'));var util=require(_0x7619('0x1'));var path=require(_0x7619('0x2'));var fs=require('fs');var jayson=require(_0x7619('0x3'));var BPromise=require(_0x7619('0x4'));var uuid=require(_0x7619('0x5'));var config=require('../../../config/environment');var logger=require(_0x7619('0x6'))(_0x7619('0x7'));var rpc={'openchannelQueueReport':require(_0x7619('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x7619('0x9')),'smsQueueReport':require(_0x7619('0xa')),'faxQueueReport':require(_0x7619('0xb')),'whatsappQueueReport':require(_0x7619('0xc'))};var RuleEngine=require(_0x7619('0xd'));function getId(_0x5c6ebf,_0x3b0ea2,_0x294625){return util[_0x7619('0xe')]('%s.%s.%s',_0x5c6ebf,_0x3b0ea2||0x0,_0x294625||0x0);}function getIntervals(_0x4aba7a,_0x1d0775){var _0x10cce2=[];if(!_[_0x7619('0xf')](_0x1d0775[_0x7619('0x10')])&&!_[_0x7619('0xf')](_0x4aba7a[_0x1d0775[_0x7619('0x10')]])&&!_[_0x7619('0xf')](_0x4aba7a[_0x1d0775[_0x7619('0x10')]][_0x7619('0x11')])){_0x10cce2=_[_0x7619('0x12')](_0x4aba7a[_0x1d0775[_0x7619('0x10')]]['Intervals'],'interval');}else if(!_[_0x7619('0xf')](_0x1d0775[_0x7619('0x13')])){_0x10cce2=[_0x1d0775[_0x7619('0x13')]];}return _0x10cce2;}exports[_0x7619('0x14')]=function(_0x28a948){_0x28a948[_0x7619('0x15')]={};return new BPromise(function(_0x267352,_0x2e1abd){var _0x85080e={'Start':function(_0x2f77a9){var _0x667abb=this;return new Promise(function(_0x55cb22,_0x7e46ee){if(_0x2f77a9){try{var _0x401ca2=[];var _0x55d5e3=getId(_0x2f77a9[_0x7619('0x16')],_0x2f77a9['message']?_0x2f77a9['message']['id']:0x0,_0x2f77a9['interaction']?_0x2f77a9[_0x7619('0x17')]['id']:0x0);if(_0x2f77a9[_0x7619('0x18')]&&_['isArray'](_0x2f77a9[_0x7619('0x18')])&&_0x2f77a9[_0x7619('0x18')][_0x7619('0x19')]){for(var _0xb7028d=0x0;_0xb7028d<_0x2f77a9[_0x7619('0x18')][_0x7619('0x19')];_0xb7028d+=0x1){var _0x22b8a4=_0x2f77a9[_0x7619('0x18')][_0xb7028d];if(fs[_0x7619('0x1a')](path[_0x7619('0x1b')](__dirname,_0x7619('0x18'),_0x22b8a4[_0x7619('0x1c')]+'.js'))){var _0x25e612=[];switch(_0x22b8a4[_0x7619('0x1c')][_0x7619('0x1d')]()){case _0x7619('0x1e'):var _0x1641df=_0x22b8a4[_0x7619('0x1f')][_0x7619('0x20')](',');_0x25e612[_0x7619('0x21')](_0x1641df[0x0]);_0x25e612['push'](_0x1641df[_0x7619('0x22')](0x1,_0x1641df[_0x7619('0x19')])[_0x7619('0x1b')](','));break;case'dialogflow':var _0x54fd78=_0x22b8a4[_0x7619('0x1f')][_0x7619('0x20')](',');_0x25e612['push'](_0x54fd78[0x0]);_0x25e612[_0x7619('0x21')](_0x54fd78[0x1]);_0x25e612[_0x7619('0x21')](_0x54fd78[_0x7619('0x22')](0x2,_0x54fd78[_0x7619('0x19')])[_0x7619('0x1b')](','));break;case _0x7619('0x23'):var _0x206435=_0x22b8a4[_0x7619('0x1f')][_0x7619('0x20')](',');_0x25e612[_0x7619('0x21')](_0x206435[0x0]);_0x25e612[_0x7619('0x21')](_0x206435[0x1]);_0x25e612[_0x7619('0x21')](_0x206435[0x2]);_0x25e612[_0x7619('0x21')](_0x206435[0x3]);_0x25e612[_0x7619('0x21')](_0x206435['slice'](0x4,_0x206435[_0x7619('0x19')])['join'](','));break;case _0x7619('0x24'):_0x25e612[_0x7619('0x21')](_0x22b8a4[_0x7619('0x1f')]);break;case _0x7619('0x25'):_0x25e612[_0x7619('0x21')](_0x22b8a4[_0x7619('0x26')]);_0x25e612[_0x7619('0x21')](_0x22b8a4['appdata']);break;default:_0x25e612=_['isNil'](_0x22b8a4['appdata'])?[]:_0x22b8a4[_0x7619('0x1f')][_0x7619('0x20')](',');}var _0x551446={'id':util[_0x7619('0xe')]('%s:%s:%s',_0x55d5e3,_0x22b8a4['id'],_0x22b8a4[_0x7619('0x1c')]),'condition':require(_0x7619('0x27'))[_0x7619('0x28')](_0x55d5e3,getIntervals(_0x28a948[_0x7619('0x29')],_0x22b8a4),_0x28a948),'consequence':require(_0x7619('0x2a')+_0x22b8a4[_0x7619('0x1c')])[_0x7619('0x2b')](_0x55d5e3,_0x25e612,_0x28a948,_0x2f77a9),'p':_0x22b8a4[_0x7619('0x2c')]||0x0};logger[_0x7619('0x2d')](_0x7619('0x2e'),_0x551446['id'],'on\x20interval',getIntervals(_0x28a948[_0x7619('0x29')],_0x22b8a4)[_0x7619('0x1b')](_0x7619('0x2f')));_0x401ca2[_0x7619('0x21')](_0x551446);}else{logger[_0x7619('0x30')](_0x7619('0x31'),path[_0x7619('0x1b')](__dirname,_0x7619('0x18'),_0x22b8a4[_0x7619('0x1c')]+'.js'));}}_0x28a948[_0x7619('0x15')][_0x55d5e3]=new RuleEngine(_0x401ca2);_0x28a948[_0x7619('0x15')][_0x55d5e3][_0x7619('0x32')](_0x2f77a9,function(_0x3cee39){logger['info'](_0x7619('0x33'),JSON[_0x7619('0x34')](_0x3cee39[_0x7619('0x35')]));if(_0x28a948[_0x7619('0x15')][_0x55d5e3]){_0x28a948[_0x7619('0x15')][_0x55d5e3][_0x7619('0x36')](_0x7619('0x37'));}});return _0x55cb22({'code':0xc8,'message':_0x2f77a9});}else{logger[_0x7619('0x2d')](_0x7619('0x38'));return _0x55cb22({'code':0xc8,'message':_0x2f77a9});}}catch(_0x33b194){logger['error'](_0x33b194[_0x7619('0x39')]);return _0x7e46ee(_0x667abb[_0x7619('0x30')](0x1f4,_0x33b194));}}return _0x7e46ee(_0x7619('0x3a'));});},'AcceptMessage':function(_0x46fd4a){var _0x528a78=this;return new Promise(function(_0x3b45e5,_0x152e2f){if(_0x46fd4a[_0x7619('0x24')]&&_0x46fd4a[_0x7619('0x24')]['id']){try{var _0x6001b5=getId(_0x46fd4a[_0x7619('0x16')],_0x46fd4a['message']?_0x46fd4a['message']['id']:0x0,_0x46fd4a[_0x7619('0x17')]?_0x46fd4a[_0x7619('0x17')]['id']:0x0);if(_0x28a948[_0x7619('0x15')][_0x6001b5]){_0x28a948[_0x7619('0x15')][_0x6001b5][_0x7619('0x36')]('end');if(rpc[_0x46fd4a[_0x7619('0x16')]+_0x7619('0x3b')]){rpc[_0x46fd4a[_0x7619('0x16')]+'QueueReport']['update'](_0x6001b5,{'UserId':_0x46fd4a[_0x7619('0x24')][_0x7619('0x3c')]})[_0x7619('0x3d')](function(_0x473aef){logger[_0x7619('0x30')](_0x7619('0x3e'));});}}return _0x3b45e5({'code':0xc8,'message':_0x46fd4a});}catch(_0x19d4df){logger[_0x7619('0x30')](_0x19d4df[_0x7619('0x39')]);return _0x152e2f(_0x528a78['error'](0x1f4,_0x19d4df));}}logger[_0x7619('0x30')](_0x7619('0x3f'));return _0x152e2f(_0x528a78[_0x7619('0x30')](0x1f4,_0x7619('0x3f')));});},'RejectMessage':function(_0xe0fd8e){var _0x1c4b78=this;return new Promise(function(_0xd94c57,_0x4f2c6e){if(_0xe0fd8e[_0x7619('0x40')]&&_0xe0fd8e[_0x7619('0x40')]['id']){try{if(_0x28a948[_0x7619('0x41')][_0xe0fd8e['agent']['id']]){_0x28a948['agents'][_0xe0fd8e[_0x7619('0x40')]['id']][_0x7619('0x42')]=![];_0x28a948['agents'][_0xe0fd8e[_0x7619('0x40')]['id']]['busyQueue']=undefined;}return _0xd94c57({'code':0xc8,'message':_0xe0fd8e});}catch(_0x2dcdd4){logger[_0x7619('0x30')](_0x2dcdd4[_0x7619('0x39')]);return _0x4f2c6e(_0x1c4b78['error'](0x1f4,_0x2dcdd4));}}logger[_0x7619('0x30')](_0x7619('0x3f'));return _0x4f2c6e(_0x1c4b78[_0x7619('0x30')](0x1f4,_0x7619('0x3f')));});},'AbandonInteraction':function(_0x55e22b){var _0x29a8b7=this;return new Promise(function(_0xb70328,_0x22aaa4){if(_0x55e22b['channel']&&_0x55e22b[_0x7619('0x17')]&&_0x55e22b[_0x7619('0x17')]['id']){try{var _0x5f1e51=getId(_0x55e22b[_0x7619('0x16')],_0x55e22b[_0x7619('0x24')]?_0x55e22b[_0x7619('0x24')]['id']:0x0,_0x55e22b[_0x7619('0x17')]?_0x55e22b[_0x7619('0x17')]['id']:0x0);if(_0x28a948['rules'][_0x5f1e51]){_0x28a948[_0x7619('0x15')][_0x5f1e51]['emit']('end');}return _0xb70328({'code':0xc8,'message':_0x55e22b});}catch(_0x538c38){logger[_0x7619('0x30')](_0x538c38[_0x7619('0x39')]);return _0x22aaa4(_0x29a8b7[_0x7619('0x30')](0x1f4,_0x538c38));}}logger[_0x7619('0x30')](_0x7619('0x3f'));return _0x22aaa4(_0x29a8b7['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x13a88c){var _0x225710=this;return new Promise(function(_0x26b2d9,_0x859acc){if(_0x28a948['agents'][_0x7619('0x43')](_0x13a88c['id'])){for(var _0x57b67 in _0x13a88c[_0x7619('0x44')]){if(_0x13a88c['capacity'][_0x7619('0x43')](_0x57b67)){if(_0x28a948[_0x7619('0x41')][_0x13a88c['id']][_0x7619('0x43')](_0x57b67+_0x7619('0x45'))){_0x28a948[_0x7619('0x41')][_0x13a88c['id']][_0x57b67+_0x7619('0x45')]=parseInt(_0x13a88c['capacity'][_0x57b67],0xa);}}}_0x28a948[_0x7619('0x41')][_0x13a88c['id']][_0x7619('0x46')]();return _0x26b2d9({'code':0xc8,'message':_0x28a948[_0x7619('0x41')][_0x13a88c['id']]});}else{return _0x859acc(_0x225710[_0x7619('0x30')](0x1f4,_0x7619('0x47')));}});},'Agents':function(_0x4d74aa){return new Promise(function(_0x427bc6,_0x10bda1){var _0x183f73=_['values'](_0x28a948[_0x7619('0x41')]);_0x427bc6({'count':_0x183f73[_0x7619('0x19')],'rows':_0x183f73});});},'ChatQueues':function(_0x505612){return new Promise(function(_0x43b124,_0x4152fb){var _0x5bfc19=[];for(var _0x1581f1 in _0x28a948[_0x7619('0x48')]){if(_0x28a948[_0x7619('0x48')][_0x7619('0x43')](_0x1581f1)){var _0x5d0472=_0x28a948[_0x7619('0x48')][_0x1581f1];var _0x16a5a9={'id':_0x5d0472['id'],'available':_0x5d0472[_0x7619('0x49')],'loggedIn':_0x5d0472[_0x7619('0x4a')],'name':_0x5d0472['name'],'paused':_0x5d0472[_0x7619('0x4b')],'waiting':_0x5d0472[_0x7619('0x4c')]};_0x5bfc19[_0x7619('0x21')](_0x16a5a9);}}_0x43b124({'count':_0x5bfc19[_0x7619('0x19')],'rows':_0x5bfc19});});},'MailQueues':function(_0x1c159b){return new Promise(function(_0x37b09a,_0x479136){var _0x5b0cac=[];for(var _0x191069 in _0x28a948[_0x7619('0x4d')]){if(_0x28a948[_0x7619('0x4d')][_0x7619('0x43')](_0x191069)){var _0x4a1c4a=_0x28a948[_0x7619('0x4d')][_0x191069];var _0x1adab9={'id':_0x4a1c4a['id'],'available':_0x4a1c4a[_0x7619('0x49')],'loggedIn':_0x4a1c4a[_0x7619('0x4a')],'name':_0x4a1c4a[_0x7619('0x4e')],'paused':_0x4a1c4a[_0x7619('0x4b')],'waiting':_0x4a1c4a[_0x7619('0x4c')]};_0x5b0cac['push'](_0x1adab9);}}_0x37b09a({'count':_0x5b0cac[_0x7619('0x19')],'rows':_0x5b0cac});});},'OpenchannelQueues':function(_0x2eda02){return new Promise(function(_0x3a7be8,_0x51c39c){var _0x259487=[];for(var _0x114a3c in _0x28a948[_0x7619('0x4f')]){if(_0x28a948[_0x7619('0x4f')][_0x7619('0x43')](_0x114a3c)){var _0x590f97=_0x28a948[_0x7619('0x4f')][_0x114a3c];var _0x481604={'id':_0x590f97['id'],'available':_0x590f97[_0x7619('0x49')],'loggedIn':_0x590f97[_0x7619('0x4a')],'name':_0x590f97[_0x7619('0x4e')],'paused':_0x590f97[_0x7619('0x4b')],'waiting':_0x590f97['waiting']};_0x259487['push'](_0x481604);}}_0x3a7be8({'count':_0x259487[_0x7619('0x19')],'rows':_0x259487});});},'SmsQueues':function(_0x27fd06){return new Promise(function(_0x1b008e,_0x116493){var _0x5682f2=[];for(var _0x1ba7ce in _0x28a948[_0x7619('0x50')]){if(_0x28a948[_0x7619('0x50')][_0x7619('0x43')](_0x1ba7ce)){var _0xd5d585=_0x28a948['smsQueues'][_0x1ba7ce];var _0x217410={'id':_0xd5d585['id'],'available':_0xd5d585[_0x7619('0x49')],'loggedIn':_0xd5d585[_0x7619('0x4a')],'name':_0xd5d585['name'],'paused':_0xd5d585[_0x7619('0x4b')],'waiting':_0xd5d585[_0x7619('0x4c')]};_0x5682f2[_0x7619('0x21')](_0x217410);}}_0x1b008e({'count':_0x5682f2[_0x7619('0x19')],'rows':_0x5682f2});});},'FaxQueues':function(_0x2e9192){return new Promise(function(_0x27cfec,_0x32e465){var _0x48b133=[];for(var _0x5a3efa in _0x28a948['faxQueues']){if(_0x28a948[_0x7619('0x51')][_0x7619('0x43')](_0x5a3efa)){var _0x27928a=_0x28a948[_0x7619('0x51')][_0x5a3efa];var _0x293111={'id':_0x27928a['id'],'available':_0x27928a[_0x7619('0x49')],'loggedIn':_0x27928a[_0x7619('0x4a')],'name':_0x27928a[_0x7619('0x4e')],'paused':_0x27928a['paused'],'waiting':_0x27928a[_0x7619('0x4c')]};_0x48b133['push'](_0x293111);}}_0x27cfec({'count':_0x48b133[_0x7619('0x19')],'rows':_0x48b133});});},'WhatsappQueues':function(_0x48cc1b){return new Promise(function(_0x2cf920,_0x20b07a){var _0x320170=[];for(var _0x1269e7 in _0x28a948[_0x7619('0x52')]){if(_0x28a948[_0x7619('0x52')]['hasOwnProperty'](_0x1269e7)){var _0x98b8ec=_0x28a948[_0x7619('0x52')][_0x1269e7];var _0x51e005={'id':_0x98b8ec['id'],'available':_0x98b8ec[_0x7619('0x49')],'loggedIn':_0x98b8ec[_0x7619('0x4a')],'name':_0x98b8ec['name'],'paused':_0x98b8ec[_0x7619('0x4b')],'waiting':_0x98b8ec['waiting']};_0x320170[_0x7619('0x21')](_0x51e005);}}_0x2cf920({'count':_0x320170[_0x7619('0x19')],'rows':_0x320170});});},'ChatQueuesWaitingInteractions':function(_0x25e17a){return new Promise(function(_0x2335cf,_0x2fe96b){var _0x4018fa=_['values'](_0x28a948[_0x7619('0x53')]);_0x2335cf({'count':_0x4018fa['length'],'rows':_0x4018fa});});},'MailQueuesWaitingInteractions':function(_0x2437b9){return new Promise(function(_0x2db002,_0x236db6){var _0x69d11c=_['values'](_0x28a948[_0x7619('0x54')]);_0x2db002({'count':_0x69d11c[_0x7619('0x19')],'rows':_0x69d11c});});},'OpenchannelQueuesWaitingInteractions':function(_0x35d252){return new Promise(function(_0x188136,_0x23d4a3){var _0x1ca1a2=_['values'](_0x28a948[_0x7619('0x55')]);_0x188136({'count':_0x1ca1a2['length'],'rows':_0x1ca1a2});});},'SmsQueuesWaitingInteractions':function(_0x1d6576){return new Promise(function(_0x1cefc5,_0x58dc35){var _0x2e7216=_[_0x7619('0x56')](_0x28a948[_0x7619('0x57')]);_0x1cefc5({'count':_0x2e7216['length'],'rows':_0x2e7216});});},'FaxQueuesWaitingInteractions':function(_0x452e35){return new Promise(function(_0x491d26,_0x483c87){var _0xc38a5b=_['values'](_0x28a948['faxQueuesWaitingInteractions']);_0x491d26({'count':_0xc38a5b[_0x7619('0x19')],'rows':_0xc38a5b});});},'WhatsappQueuesWaitingInteractions':function(_0xec9e7b){return new Promise(function(_0xc71ac3,_0x38e260){var _0x46f88e=_[_0x7619('0x56')](_0x28a948[_0x7619('0x58')]);_0xc71ac3({'count':_0x46f88e['length'],'rows':_0x46f88e});});}};var _0x1449f5=jayson[_0x7619('0x59')](_0x85080e)['http']();_0x1449f5['on'](_0x7619('0x30'),function(_0x356e39){logger[_0x7619('0x30')](JSON[_0x7619('0x34')](_0x356e39));return _0x2e1abd(_0x356e39);});_0x1449f5[_0x7619('0x14')](0x232c,_0x7619('0x5a'),function(){console['log'](_0x7619('0x5b'),0x232c);return _0x267352('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 8384cd6..53e175c 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 _0x30b1=['indexOf','true','all','some','join','\x20|\x20','log','[%s][INTERVAL]\x20%s\x20%s','stack','util','bluebird','jayson/promise','lodash','routing','client','http','request','then','error','message','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format'];(function(_0x3f823a,_0x29330a){var _0x440e40=function(_0x317e5f){while(--_0x317e5f){_0x3f823a['push'](_0x3f823a['shift']());}};_0x440e40(++_0x29330a);}(_0x30b1,0x165));var _0x130b=function(_0x3dfe12,_0xb018f6){_0x3dfe12=_0x3dfe12-0x0;var _0x2de22e=_0x30b1[_0x3dfe12];return _0x2de22e;};'use strict';var util=require(_0x130b('0x0'));var BPromise=require(_0x130b('0x1'));var jayson=require(_0x130b('0x2'));var _=require(_0x130b('0x3'));var logger=require('../../../config/logger')(_0x130b('0x4'));var client=jayson[_0x130b('0x5')][_0x130b('0x6')]({'port':0x232a});function request(_0x4b9f48,_0x21d31c){return new BPromise(function(_0x4828fa,_0x351a3a){return client[_0x130b('0x7')](_0x4b9f48,_0x21d31c)[_0x130b('0x8')](function(_0x4c192b){if(_0x4c192b[_0x130b('0x9')]){return _0x351a3a(_0x4c192b['error'][_0x130b('0xa')]);}else{return _0x4828fa(_0x4c192b[_0x130b('0xb')]);}})[_0x130b('0xc')](function(_0x1f3455){return _0x351a3a(_0x1f3455);});});}exports['condition']=function(_0x2e994e,_0x40f711,_0x450cb3){return function(_0xf68432){if(_0x450cb3['rules']&&!_0x450cb3[_0x130b('0xd')][_0x2e994e]){logger[_0x130b('0xe')](_0x130b('0xf'),_0x2e994e);return _0xf68432[_0x130b('0x10')]();}var _0x424b20=[];for(var _0x398bb6=0x0;_0x398bb6<_0x40f711[_0x130b('0x11')];_0x398bb6+=0x1){_0x424b20['push'](request(_0x130b('0x12'),{'command':util[_0x130b('0x13')]('iftime\x20%s',_0x40f711[_0x398bb6])})[_0x130b('0x8')](function(_0x27e752){return _0x27e752&&_0x27e752[_0x130b('0xa')]&&_0x27e752['message'][_0x130b('0x14')](_0x130b('0x15'))>=0x0?!![]:![];})['catch'](function(_0x4d7b99){logger[_0x130b('0x9')]('[%s][INTERVAL]\x20%s',_0x2e994e,_0x40f711[_0x398bb6]);}));}BPromise[_0x130b('0x16')](_0x424b20)[_0x130b('0x8')](function(_0x241f47){var _0x969f07=_[_0x130b('0x17')](_0x241f47);logger[_0x130b('0xe')]('[%s][INTERVAL]\x20%s\x20%s',_0x2e994e,_0x40f711[_0x130b('0x18')](_0x130b('0x19')),_0x969f07);_0xf68432['when'](_0x969f07);})[_0x130b('0xc')](function(_0x370566){console[_0x130b('0x1a')](_0x370566);logger['error'](_0x130b('0x1b'),_0x2e994e,_0x40f711[_0x130b('0x18')]('\x20|\x20'),_0x370566[_0x130b('0x1c')]);_0xf68432[_0x130b('0x10')]();});};}; \ No newline at end of file +var _0x5bba=['push','Command','format','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','util','lodash','client','http','request','then','error','message','catch','condition','rules','info','stop'];(function(_0x388f51,_0x3b2c1c){var _0x1ba997=function(_0x138086){while(--_0x138086){_0x388f51['push'](_0x388f51['shift']());}};_0x1ba997(++_0x3b2c1c);}(_0x5bba,0x127));var _0xa5bb=function(_0x33d2e0,_0x5ba435){_0x33d2e0=_0x33d2e0-0x0;var _0x4185d6=_0x5bba[_0x33d2e0];return _0x4185d6;};'use strict';var util=require(_0xa5bb('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0xa5bb('0x1'));var logger=require('../../../config/logger')('routing');var client=jayson[_0xa5bb('0x2')][_0xa5bb('0x3')]({'port':0x232a});function request(_0x307178,_0x18bdd6){return new BPromise(function(_0x6c8b15,_0x4c23b8){return client[_0xa5bb('0x4')](_0x307178,_0x18bdd6)[_0xa5bb('0x5')](function(_0x164891){if(_0x164891[_0xa5bb('0x6')]){return _0x4c23b8(_0x164891[_0xa5bb('0x6')][_0xa5bb('0x7')]);}else{return _0x6c8b15(_0x164891['result']);}})[_0xa5bb('0x8')](function(_0x46dc9d){return _0x4c23b8(_0x46dc9d);});});}exports[_0xa5bb('0x9')]=function(_0x173313,_0x2f833b,_0x5d46eb){return function(_0x4eec19){if(_0x5d46eb[_0xa5bb('0xa')]&&!_0x5d46eb[_0xa5bb('0xa')][_0x173313]){logger[_0xa5bb('0xb')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x173313);return _0x4eec19[_0xa5bb('0xc')]();}var _0xaa0acc=[];for(var _0x17cdf5=0x0;_0x17cdf5<_0x2f833b['length'];_0x17cdf5+=0x1){_0xaa0acc[_0xa5bb('0xd')](request(_0xa5bb('0xe'),{'command':util[_0xa5bb('0xf')]('iftime\x20%s',_0x2f833b[_0x17cdf5])})[_0xa5bb('0x5')](function(_0x4d614c){return _0x4d614c&&_0x4d614c[_0xa5bb('0x7')]&&_0x4d614c[_0xa5bb('0x7')]['indexOf']('true')>=0x0?!![]:![];})[_0xa5bb('0x8')](function(_0x3e6492){logger[_0xa5bb('0x6')](_0xa5bb('0x10'),_0x173313,_0x2f833b[_0x17cdf5]);}));}BPromise[_0xa5bb('0x11')](_0xaa0acc)[_0xa5bb('0x5')](function(_0x1e0abe){var _0x37bfdf=_['some'](_0x1e0abe);logger[_0xa5bb('0xb')](_0xa5bb('0x12'),_0x173313,_0x2f833b[_0xa5bb('0x13')](_0xa5bb('0x14')),_0x37bfdf);_0x4eec19['when'](_0x37bfdf);})[_0xa5bb('0x8')](function(_0x122305){console['log'](_0x122305);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x173313,_0x2f833b['join'](_0xa5bb('0x14')),_0x122305[_0xa5bb('0x15')]);_0x4eec19['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index e830a5d..3633bef 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 _0x6ff6=['push','error','queuecallerabandon','forIn','includes','abandoned','agentconnect','agentconnectAt','connectedlinename','connect','talktime','answered_elsewhere','reason','answeredelsewheredestinationuniqueid','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','ATTENDED','secondtransfererexten','transfertargetuniqueid','indexOf','splice','agent','./utils','info','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','membername','interface','lastevent','queue','then','type','agentacw','agentcomplete','acw','CreateVoiceAgentReport','request','agentcalled','destuniqueid','agentcalledAt','now','connectedlinenum','stack','agentringnoanswer','isNil','agentringnoanswerAt','timeout','holdtime','ringtime'];(function(_0x339605,_0x28e8f8){var _0x169661=function(_0x2e7e0b){while(--_0x2e7e0b){_0x339605['push'](_0x339605['shift']());}};_0x169661(++_0x28e8f8);}(_0x6ff6,0x182));var _0x66ff=function(_0x1951b3,_0x4c6003){_0x1951b3=_0x1951b3-0x0;var _0x328b34=_0x6ff6[_0x1951b3];return _0x328b34;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x66ff('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0xf5bc88,_0x311885){utils[_0x66ff('0x1')](util[_0x66ff('0x2')](_0x66ff('0x3'),_0xf5bc88[_0x66ff('0x4')],_0xf5bc88['channel'],_0xf5bc88['queue'],_0xf5bc88[_0x66ff('0x5')],_0xf5bc88[_0x66ff('0x6')],_0xf5bc88['calleridnum'],_0xf5bc88['connectedlinenum'],_0xf5bc88[_0x66ff('0x7')]));if(_0xf5bc88[_0x66ff('0x8')]){utils['getVoiceQueueByName'](_0xf5bc88[_0x66ff('0x8')])[_0x66ff('0x9')](function(_0x2386fa){if(_0x2386fa){_0xf5bc88[_0x66ff('0xa')]=_0x2386fa[_0x66ff('0xa')];_0xf5bc88[_0x66ff('0xb')]=_0xf5bc88[_0x66ff('0xc')]?_0x2386fa[_0x66ff('0xd')]:![];_0xf5bc88['acwtime']=_0xf5bc88['agentacw']?_0x2386fa['acwTimeout']:0x0;}utils['request'](_0x66ff('0xe'),_0xf5bc88);});}else{utils[_0x66ff('0xf')](_0x66ff('0xe'),_0xf5bc88);}if(_0x311885){delete transfers[_0xf5bc88[_0x66ff('0x4')]];}else{delete agents[_0xf5bc88['destuniqueid']];}}exports[_0x66ff('0x10')]=function(_0x5a3e22){try{agents[_0x5a3e22[_0x66ff('0x11')]]=_0x5a3e22;agents[_0x5a3e22[_0x66ff('0x11')]][_0x66ff('0x12')]=utils[_0x66ff('0x13')]();agents[_0x5a3e22[_0x66ff('0x11')]][_0x66ff('0x7')]='called';agents[_0x5a3e22[_0x66ff('0x11')]][_0x66ff('0x14')]=null;agents[_0x5a3e22[_0x66ff('0x11')]]['connectedlinename']=null;}catch(_0x586137){utils['error'](_0x586137[_0x66ff('0x15')]);}};exports[_0x66ff('0x16')]=function(_0x402cae){try{if(!_[_0x66ff('0x17')](agents[_0x402cae[_0x66ff('0x11')]])){agents[_0x402cae[_0x66ff('0x11')]][_0x66ff('0x16')]=!![];agents[_0x402cae[_0x66ff('0x11')]][_0x66ff('0x18')]=utils[_0x66ff('0x13')]();agents[_0x402cae[_0x66ff('0x11')]][_0x66ff('0x7')]=_0x66ff('0x19');agents[_0x402cae[_0x66ff('0x11')]]['reason']=_0x66ff('0x19');agents[_0x402cae['destuniqueid']][_0x66ff('0x1a')]=_0x402cae['ringtime']?parseInt(_0x402cae[_0x66ff('0x1b')])/0x3e8:0x0;agents[_0x402cae['destuniqueid']]['talktime']=0x0;unanswered[_0x66ff('0x1c')](_0x402cae[_0x66ff('0x11')]);}}catch(_0x7dbe25){utils[_0x66ff('0x1d')](_0x7dbe25[_0x66ff('0x15')]);}};exports[_0x66ff('0x1e')]=function(_0x26ddb6){try{_[_0x66ff('0x1f')](agents,function(_0x465922,_0xe3ccc2){if(_0x465922[_0x66ff('0x4')]==_0x26ddb6[_0x66ff('0x4')]&&!_[_0x66ff('0x20')](unanswered,_0x465922[_0x66ff('0x11')])){_0x465922[_0x66ff('0x16')]=!![];_0x465922[_0x66ff('0x18')]=utils[_0x66ff('0x13')]();_0x465922['lastevent']=_0x66ff('0x21');_0x465922['reason']=_0x66ff('0x21');_0x465922['holdtime']=_0x26ddb6[_0x66ff('0x1a')];_0x465922['talktime']=0x0;writeDB(_0x465922);}});}catch(_0x10c2d1){utils[_0x66ff('0x1d')](_0x10c2d1[_0x66ff('0x15')]);}};exports[_0x66ff('0x22')]=function(_0x1d4b6f){try{if(agents[_0x1d4b6f[_0x66ff('0x11')]]){agents[_0x1d4b6f['destuniqueid']][_0x66ff('0x23')]=utils[_0x66ff('0x13')]();agents[_0x1d4b6f['destuniqueid']]['connectedlinenum']=_0x1d4b6f[_0x66ff('0x14')];agents[_0x1d4b6f[_0x66ff('0x11')]][_0x66ff('0x24')]=_0x1d4b6f['connectedlinename'];agents[_0x1d4b6f[_0x66ff('0x11')]]['holdtime']=_0x1d4b6f['ringtime'];agents[_0x1d4b6f['destuniqueid']][_0x66ff('0x7')]=_0x66ff('0x25');_[_0x66ff('0x1f')](agents,function(_0xf72131,_0x1230e8){if(_0xf72131[_0x66ff('0x11')]!=_0x1d4b6f['destuniqueid']&&_0xf72131[_0x66ff('0x4')]==_0x1d4b6f['uniqueid']){_0xf72131[_0x66ff('0x26')]=0x0;_0xf72131['holdtime']=_0x1d4b6f[_0x66ff('0x1b')];_0xf72131[_0x66ff('0x16')]=!![];_0xf72131[_0x66ff('0x18')]=utils[_0x66ff('0x13')]();_0xf72131[_0x66ff('0x7')]=_0x66ff('0x27');_0xf72131[_0x66ff('0x28')]='answered_elsewhere';_0xf72131[_0x66ff('0x29')]=_0x1d4b6f[_0x66ff('0x11')];_0xf72131['answeredelsewheremembername']=_0x1d4b6f[_0x66ff('0x5')];writeDB(_0xf72131);}});}}catch(_0x3e3a81){utils[_0x66ff('0x1d')](_0x3e3a81[_0x66ff('0x15')]);}};exports['agentcomplete']=function(_0x4eb956){try{if(!_['isNil'](agents[_0x4eb956['destuniqueid']])){agents[_0x4eb956[_0x66ff('0x11')]]['agentcomplete']=!![];agents[_0x4eb956[_0x66ff('0x11')]][_0x66ff('0x2a')]=utils[_0x66ff('0x13')]();agents[_0x4eb956[_0x66ff('0x11')]]['talktime']=utils[_0x66ff('0x2b')](agents[_0x4eb956[_0x66ff('0x11')]][_0x66ff('0x2a')],agents[_0x4eb956[_0x66ff('0x11')]]['agentconnectAt']);agents[_0x4eb956[_0x66ff('0x11')]]['reason']=_0x4eb956[_0x66ff('0x28')];agents[_0x4eb956[_0x66ff('0x11')]][_0x66ff('0x7')]=_0x66ff('0x2c');writeDB(agents[_0x4eb956['destuniqueid']]);}}catch(_0x1a135f){utils['error'](_0x1a135f['stack']);}};exports[_0x66ff('0x2d')]=function(_0x303ea9){try{if(!_[_0x66ff('0x17')](agents[_0x303ea9[_0x66ff('0x2e')]])){agents[_0x303ea9[_0x66ff('0x2e')]][_0x66ff('0x2f')]=!![];agents[_0x303ea9[_0x66ff('0x2e')]][_0x66ff('0x30')]=_0x66ff('0x31');agents[_0x303ea9[_0x66ff('0x2e')]][_0x66ff('0x32')]=_0x303ea9[_0x66ff('0x33')];agents[_0x303ea9[_0x66ff('0x2e')]][_0x66ff('0x34')]=agents[_0x303ea9[_0x66ff('0x2e')]][_0x66ff('0x4')];}}catch(_0x3dc5e3){utils[_0x66ff('0x1d')](_0x3dc5e3[_0x66ff('0x15')]);}};exports[_0x66ff('0x35')]=function(_0x910843){try{if(_0x910843[_0x66ff('0x36')]==_0x910843[_0x66ff('0x37')]){if(!_['isNil'](agents[_0x910843[_0x66ff('0x38')]])){agents[_0x910843[_0x66ff('0x38')]][_0x66ff('0x2f')]=!![];agents[_0x910843[_0x66ff('0x38')]][_0x66ff('0x30')]='ATTENDED';agents[_0x910843[_0x66ff('0x38')]]['transferexten']=_0x910843[_0x66ff('0x39')];agents[_0x910843[_0x66ff('0x38')]][_0x66ff('0x34')]=_0x910843[_0x66ff('0x36')];}if(_0x910843[_0x66ff('0x3a')]&&agents[_0x910843[_0x66ff('0x3a')]]){agents[_0x910843[_0x66ff('0x3a')]][_0x66ff('0x3b')]=0x1;transfers[_0x910843['transfereeuniqueid']]=_[_0x66ff('0x3c')](agents[_0x910843[_0x66ff('0x3a')]]);transfers[_0x910843[_0x66ff('0x3a')]]['calleridnum']=agents[_0x910843[_0x66ff('0x38')]][_0x66ff('0x3d')];transfers[_0x910843['transfereeuniqueid']][_0x66ff('0x3e')]=agents[_0x910843[_0x66ff('0x38')]][_0x66ff('0x3e')];transfers[_0x910843[_0x66ff('0x3a')]][_0x66ff('0x12')]=utils[_0x66ff('0x13')]();transfers[_0x910843[_0x66ff('0x3a')]][_0x66ff('0x23')]=utils[_0x66ff('0x13')]();transfers[_0x910843[_0x66ff('0x3a')]][_0x66ff('0x1a')]=0x0;transfers[_0x910843[_0x66ff('0x3a')]][_0x66ff('0x3b')]=0x2;}}else if(_0x910843[_0x66ff('0x38')]==_0x910843['secondtransfererlinkedid']){if(!_[_0x66ff('0x17')](agents[_0x910843['origtransfereruniqueid']])){agents[_0x910843[_0x66ff('0x36')]]['transfer']=!![];agents[_0x910843[_0x66ff('0x36')]][_0x66ff('0x30')]=_0x66ff('0x3f');agents[_0x910843[_0x66ff('0x36')]][_0x66ff('0x32')]=_0x910843[_0x66ff('0x40')];agents[_0x910843[_0x66ff('0x36')]][_0x66ff('0x34')]=_0x910843[_0x66ff('0x38')];}if(_0x910843['transfertargetuniqueid']&&agents[_0x910843['transfertargetuniqueid']]){agents[_0x910843[_0x66ff('0x41')]][_0x66ff('0x3b')]=0x1;transfers[_0x910843[_0x66ff('0x41')]]=_[_0x66ff('0x3c')](agents[_0x910843[_0x66ff('0x41')]]);transfers[_0x910843[_0x66ff('0x41')]][_0x66ff('0x3d')]=agents[_0x910843[_0x66ff('0x36')]][_0x66ff('0x3d')];transfers[_0x910843[_0x66ff('0x41')]][_0x66ff('0x3e')]=agents[_0x910843[_0x66ff('0x36')]][_0x66ff('0x3e')];transfers[_0x910843[_0x66ff('0x41')]][_0x66ff('0x12')]=utils['now']();transfers[_0x910843[_0x66ff('0x41')]][_0x66ff('0x23')]=utils[_0x66ff('0x13')]();transfers[_0x910843[_0x66ff('0x41')]]['holdtime']=0x0;transfers[_0x910843[_0x66ff('0x41')]]['agententerreason']=0x2;}}}catch(_0x3526ef){utils[_0x66ff('0x1d')](_0x3526ef[_0x66ff('0x15')]);}};exports['hangup']=function(_0x3afb5e){try{if(agents[_0x3afb5e[_0x66ff('0x4')]]&&agents[_0x3afb5e[_0x66ff('0x4')]][_0x66ff('0x28')]===_0x66ff('0x19')){if(_0x3afb5e['cause']==='21'){agents[_0x3afb5e[_0x66ff('0x4')]]['reason']='rejected';agents[_0x3afb5e['uniqueid']][_0x66ff('0x7')]='rejected';}writeDB(agents[_0x3afb5e['uniqueid']]);var _0xb5fb94=unanswered[_0x66ff('0x42')](_0x3afb5e[_0x66ff('0x4')]);if(_0xb5fb94>-0x1)unanswered[_0x66ff('0x43')](_0xb5fb94,0x1);}if(transfers[_0x3afb5e[_0x66ff('0x4')]]){transfers[_0x3afb5e[_0x66ff('0x4')]]['agentcomplete']=!![];transfers[_0x3afb5e[_0x66ff('0x4')]]['agentcompleteAt']=utils[_0x66ff('0x13')]();transfers[_0x3afb5e[_0x66ff('0x4')]][_0x66ff('0x26')]=utils['diffTime'](transfers[_0x3afb5e[_0x66ff('0x4')]][_0x66ff('0x2a')],transfers[_0x3afb5e[_0x66ff('0x4')]][_0x66ff('0x23')]);transfers[_0x3afb5e[_0x66ff('0x4')]][_0x66ff('0x28')]='agent';transfers[_0x3afb5e[_0x66ff('0x4')]][_0x66ff('0x7')]=_0x66ff('0x2c');writeDB(transfers[_0x3afb5e[_0x66ff('0x4')]],!![]);}if(agents[_0x3afb5e[_0x66ff('0x4')]]&&agents[_0x3afb5e[_0x66ff('0x4')]][_0x66ff('0x23')]){agents[_0x3afb5e[_0x66ff('0x4')]][_0x66ff('0xc')]=!![];agents[_0x3afb5e['uniqueid']][_0x66ff('0x2a')]=utils[_0x66ff('0x13')]();agents[_0x3afb5e[_0x66ff('0x4')]][_0x66ff('0x26')]=utils[_0x66ff('0x2b')](agents[_0x3afb5e[_0x66ff('0x4')]][_0x66ff('0x2a')],agents[_0x3afb5e[_0x66ff('0x4')]]['agentconnectAt']);agents[_0x3afb5e[_0x66ff('0x4')]][_0x66ff('0x28')]=agents[_0x3afb5e['uniqueid']][_0x66ff('0x2f')]?_0x66ff('0x2f'):_0x66ff('0x44');agents[_0x3afb5e[_0x66ff('0x4')]]['lastevent']=_0x66ff('0x2c');writeDB(agents[_0x3afb5e[_0x66ff('0x4')]]);}}catch(_0x5f5d75){utils['error'](_0x5f5d75[_0x66ff('0x15')]);}}; \ No newline at end of file +var _0x0e4e=['attendedtransfer','origtransfererlinkedid','isNil','secondtransfereruniqueid','ATTENDED','transferexten','origtransfererexten','origtransfereruniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','agentcalledAt','secondtransfererexten','transfertargetuniqueid','cause','rejected','indexOf','agent','util','./utils','info','format','uniqueid','channel','membername','interface','connectedlinenum','queue','getVoiceQueueByName','then','type','agentacw','acw','acwtime','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalled','now','lastevent','called','connectedlinename','error','stack','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime','ringtime','push','queuecallerabandon','forIn','includes','abandoned','agentconnect','connect','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','agentcomplete','diffTime','agentcompleteAt','agentconnectAt','complete','transfereruniqueid','transfer','transfertype','extension','transferuniqueid'];(function(_0x2440df,_0x453be8){var _0x1fa6fb=function(_0x1e0417){while(--_0x1e0417){_0x2440df['push'](_0x2440df['shift']());}};_0x1fa6fb(++_0x453be8);}(_0x0e4e,0xa6));var _0xe0e4=function(_0x4c7c4a,_0x520920){_0x4c7c4a=_0x4c7c4a-0x0;var _0x4d78ae=_0x0e4e[_0x4c7c4a];return _0x4d78ae;};'use strict';var _=require('lodash');var util=require(_0xe0e4('0x0'));var utils=require(_0xe0e4('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4282f0,_0xda977e){utils[_0xe0e4('0x2')](util[_0xe0e4('0x3')]('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x4282f0[_0xe0e4('0x4')],_0x4282f0[_0xe0e4('0x5')],_0x4282f0['queue'],_0x4282f0[_0xe0e4('0x6')],_0x4282f0[_0xe0e4('0x7')],_0x4282f0['calleridnum'],_0x4282f0[_0xe0e4('0x8')],_0x4282f0['lastevent']));if(_0x4282f0[_0xe0e4('0x9')]){utils[_0xe0e4('0xa')](_0x4282f0[_0xe0e4('0x9')])[_0xe0e4('0xb')](function(_0x254d2d){if(_0x254d2d){_0x4282f0[_0xe0e4('0xc')]=_0x254d2d[_0xe0e4('0xc')];_0x4282f0[_0xe0e4('0xd')]=_0x4282f0['agentcomplete']?_0x254d2d[_0xe0e4('0xe')]:![];_0x4282f0[_0xe0e4('0xf')]=_0x4282f0['agentacw']?_0x254d2d[_0xe0e4('0x10')]:0x0;}utils['request'](_0xe0e4('0x11'),_0x4282f0);});}else{utils[_0xe0e4('0x12')](_0xe0e4('0x11'),_0x4282f0);}if(_0xda977e){delete transfers[_0x4282f0[_0xe0e4('0x4')]];}else{delete agents[_0x4282f0[_0xe0e4('0x13')]];}}exports[_0xe0e4('0x14')]=function(_0x1d2b1c){try{agents[_0x1d2b1c[_0xe0e4('0x13')]]=_0x1d2b1c;agents[_0x1d2b1c[_0xe0e4('0x13')]]['agentcalledAt']=utils[_0xe0e4('0x15')]();agents[_0x1d2b1c['destuniqueid']][_0xe0e4('0x16')]=_0xe0e4('0x17');agents[_0x1d2b1c[_0xe0e4('0x13')]]['connectedlinenum']=null;agents[_0x1d2b1c['destuniqueid']][_0xe0e4('0x18')]=null;}catch(_0x6b352){utils[_0xe0e4('0x19')](_0x6b352[_0xe0e4('0x1a')]);}};exports[_0xe0e4('0x1b')]=function(_0x2d87e4){try{if(!_['isNil'](agents[_0x2d87e4['destuniqueid']])){agents[_0x2d87e4['destuniqueid']]['agentringnoanswer']=!![];agents[_0x2d87e4[_0xe0e4('0x13')]][_0xe0e4('0x1c')]=utils['now']();agents[_0x2d87e4[_0xe0e4('0x13')]][_0xe0e4('0x16')]=_0xe0e4('0x1d');agents[_0x2d87e4[_0xe0e4('0x13')]][_0xe0e4('0x1e')]=_0xe0e4('0x1d');agents[_0x2d87e4['destuniqueid']][_0xe0e4('0x1f')]=_0x2d87e4[_0xe0e4('0x20')]?parseInt(_0x2d87e4['ringtime'])/0x3e8:0x0;agents[_0x2d87e4['destuniqueid']]['talktime']=0x0;unanswered[_0xe0e4('0x21')](_0x2d87e4[_0xe0e4('0x13')]);}}catch(_0x5618f0){utils[_0xe0e4('0x19')](_0x5618f0[_0xe0e4('0x1a')]);}};exports[_0xe0e4('0x22')]=function(_0x2436e6){try{_[_0xe0e4('0x23')](agents,function(_0x48605f,_0x3a5156){if(_0x48605f[_0xe0e4('0x4')]==_0x2436e6[_0xe0e4('0x4')]&&!_[_0xe0e4('0x24')](unanswered,_0x48605f[_0xe0e4('0x13')])){_0x48605f[_0xe0e4('0x1b')]=!![];_0x48605f[_0xe0e4('0x1c')]=utils['now']();_0x48605f[_0xe0e4('0x16')]=_0xe0e4('0x25');_0x48605f[_0xe0e4('0x1e')]=_0xe0e4('0x25');_0x48605f[_0xe0e4('0x1f')]=_0x2436e6['holdtime'];_0x48605f['talktime']=0x0;writeDB(_0x48605f);}});}catch(_0x3da394){utils['error'](_0x3da394['stack']);}};exports[_0xe0e4('0x26')]=function(_0x1d3309){try{if(agents[_0x1d3309[_0xe0e4('0x13')]]){agents[_0x1d3309[_0xe0e4('0x13')]]['agentconnectAt']=utils['now']();agents[_0x1d3309[_0xe0e4('0x13')]][_0xe0e4('0x8')]=_0x1d3309[_0xe0e4('0x8')];agents[_0x1d3309[_0xe0e4('0x13')]][_0xe0e4('0x18')]=_0x1d3309[_0xe0e4('0x18')];agents[_0x1d3309[_0xe0e4('0x13')]][_0xe0e4('0x1f')]=_0x1d3309[_0xe0e4('0x20')];agents[_0x1d3309[_0xe0e4('0x13')]][_0xe0e4('0x16')]=_0xe0e4('0x27');_[_0xe0e4('0x23')](agents,function(_0x5c033c,_0x2f4702){if(_0x5c033c[_0xe0e4('0x13')]!=_0x1d3309['destuniqueid']&&_0x5c033c[_0xe0e4('0x4')]==_0x1d3309['uniqueid']){_0x5c033c[_0xe0e4('0x28')]=0x0;_0x5c033c[_0xe0e4('0x1f')]=_0x1d3309[_0xe0e4('0x20')];_0x5c033c['agentringnoanswer']=!![];_0x5c033c[_0xe0e4('0x1c')]=utils[_0xe0e4('0x15')]();_0x5c033c[_0xe0e4('0x16')]=_0xe0e4('0x29');_0x5c033c[_0xe0e4('0x1e')]=_0xe0e4('0x29');_0x5c033c[_0xe0e4('0x2a')]=_0x1d3309[_0xe0e4('0x13')];_0x5c033c['answeredelsewheremembername']=_0x1d3309[_0xe0e4('0x6')];writeDB(_0x5c033c);}});}}catch(_0x31faea){utils['error'](_0x31faea[_0xe0e4('0x1a')]);}};exports['agentcomplete']=function(_0x6ac0b9){try{if(!_['isNil'](agents[_0x6ac0b9[_0xe0e4('0x13')]])){agents[_0x6ac0b9[_0xe0e4('0x13')]][_0xe0e4('0x2b')]=!![];agents[_0x6ac0b9['destuniqueid']]['agentcompleteAt']=utils['now']();agents[_0x6ac0b9[_0xe0e4('0x13')]][_0xe0e4('0x28')]=utils[_0xe0e4('0x2c')](agents[_0x6ac0b9[_0xe0e4('0x13')]][_0xe0e4('0x2d')],agents[_0x6ac0b9[_0xe0e4('0x13')]][_0xe0e4('0x2e')]);agents[_0x6ac0b9[_0xe0e4('0x13')]][_0xe0e4('0x1e')]=_0x6ac0b9[_0xe0e4('0x1e')];agents[_0x6ac0b9[_0xe0e4('0x13')]]['lastevent']=_0xe0e4('0x2f');writeDB(agents[_0x6ac0b9[_0xe0e4('0x13')]]);}}catch(_0x3076db){utils['error'](_0x3076db['stack']);}};exports['blindtransfer']=function(_0x477491){try{if(!_['isNil'](agents[_0x477491['transfereruniqueid']])){agents[_0x477491[_0xe0e4('0x30')]][_0xe0e4('0x31')]=!![];agents[_0x477491['transfereruniqueid']][_0xe0e4('0x32')]='blind';agents[_0x477491[_0xe0e4('0x30')]]['transferexten']=_0x477491[_0xe0e4('0x33')];agents[_0x477491[_0xe0e4('0x30')]][_0xe0e4('0x34')]=agents[_0x477491[_0xe0e4('0x30')]][_0xe0e4('0x4')];}}catch(_0x530485){utils['error'](_0x530485['stack']);}};exports[_0xe0e4('0x35')]=function(_0x40b8cc){try{if(_0x40b8cc['origtransfereruniqueid']==_0x40b8cc[_0xe0e4('0x36')]){if(!_[_0xe0e4('0x37')](agents[_0x40b8cc[_0xe0e4('0x38')]])){agents[_0x40b8cc[_0xe0e4('0x38')]][_0xe0e4('0x31')]=!![];agents[_0x40b8cc[_0xe0e4('0x38')]]['transfertype']=_0xe0e4('0x39');agents[_0x40b8cc[_0xe0e4('0x38')]][_0xe0e4('0x3a')]=_0x40b8cc[_0xe0e4('0x3b')];agents[_0x40b8cc[_0xe0e4('0x38')]][_0xe0e4('0x34')]=_0x40b8cc[_0xe0e4('0x3c')];}if(_0x40b8cc[_0xe0e4('0x3d')]&&agents[_0x40b8cc[_0xe0e4('0x3d')]]){agents[_0x40b8cc[_0xe0e4('0x3d')]][_0xe0e4('0x3e')]=0x1;transfers[_0x40b8cc[_0xe0e4('0x3d')]]=_[_0xe0e4('0x3f')](agents[_0x40b8cc[_0xe0e4('0x3d')]]);transfers[_0x40b8cc[_0xe0e4('0x3d')]][_0xe0e4('0x40')]=agents[_0x40b8cc[_0xe0e4('0x38')]]['calleridnum'];transfers[_0x40b8cc[_0xe0e4('0x3d')]][_0xe0e4('0x41')]=agents[_0x40b8cc[_0xe0e4('0x38')]][_0xe0e4('0x41')];transfers[_0x40b8cc['transfereeuniqueid']][_0xe0e4('0x42')]=utils['now']();transfers[_0x40b8cc[_0xe0e4('0x3d')]][_0xe0e4('0x2e')]=utils[_0xe0e4('0x15')]();transfers[_0x40b8cc['transfereeuniqueid']][_0xe0e4('0x1f')]=0x0;transfers[_0x40b8cc[_0xe0e4('0x3d')]][_0xe0e4('0x3e')]=0x2;}}else if(_0x40b8cc[_0xe0e4('0x38')]==_0x40b8cc['secondtransfererlinkedid']){if(!_[_0xe0e4('0x37')](agents[_0x40b8cc['origtransfereruniqueid']])){agents[_0x40b8cc[_0xe0e4('0x3c')]][_0xe0e4('0x31')]=!![];agents[_0x40b8cc[_0xe0e4('0x3c')]][_0xe0e4('0x32')]=_0xe0e4('0x39');agents[_0x40b8cc[_0xe0e4('0x3c')]][_0xe0e4('0x3a')]=_0x40b8cc[_0xe0e4('0x43')];agents[_0x40b8cc[_0xe0e4('0x3c')]][_0xe0e4('0x34')]=_0x40b8cc[_0xe0e4('0x38')];}if(_0x40b8cc['transfertargetuniqueid']&&agents[_0x40b8cc[_0xe0e4('0x44')]]){agents[_0x40b8cc[_0xe0e4('0x44')]][_0xe0e4('0x3e')]=0x1;transfers[_0x40b8cc[_0xe0e4('0x44')]]=_[_0xe0e4('0x3f')](agents[_0x40b8cc[_0xe0e4('0x44')]]);transfers[_0x40b8cc[_0xe0e4('0x44')]]['calleridnum']=agents[_0x40b8cc['origtransfereruniqueid']][_0xe0e4('0x40')];transfers[_0x40b8cc[_0xe0e4('0x44')]][_0xe0e4('0x41')]=agents[_0x40b8cc['origtransfereruniqueid']][_0xe0e4('0x41')];transfers[_0x40b8cc[_0xe0e4('0x44')]]['agentcalledAt']=utils[_0xe0e4('0x15')]();transfers[_0x40b8cc[_0xe0e4('0x44')]][_0xe0e4('0x2e')]=utils[_0xe0e4('0x15')]();transfers[_0x40b8cc['transfertargetuniqueid']]['holdtime']=0x0;transfers[_0x40b8cc[_0xe0e4('0x44')]]['agententerreason']=0x2;}}}catch(_0x3bf7cb){utils['error'](_0x3bf7cb[_0xe0e4('0x1a')]);}};exports['hangup']=function(_0x220b2c){try{if(agents[_0x220b2c['uniqueid']]&&agents[_0x220b2c[_0xe0e4('0x4')]][_0xe0e4('0x1e')]===_0xe0e4('0x1d')){if(_0x220b2c[_0xe0e4('0x45')]==='21'){agents[_0x220b2c['uniqueid']][_0xe0e4('0x1e')]=_0xe0e4('0x46');agents[_0x220b2c[_0xe0e4('0x4')]][_0xe0e4('0x16')]='rejected';}writeDB(agents[_0x220b2c['uniqueid']]);var _0x363797=unanswered[_0xe0e4('0x47')](_0x220b2c[_0xe0e4('0x4')]);if(_0x363797>-0x1)unanswered['splice'](_0x363797,0x1);}if(transfers[_0x220b2c[_0xe0e4('0x4')]]){transfers[_0x220b2c['uniqueid']][_0xe0e4('0x2b')]=!![];transfers[_0x220b2c['uniqueid']][_0xe0e4('0x2d')]=utils['now']();transfers[_0x220b2c['uniqueid']][_0xe0e4('0x28')]=utils[_0xe0e4('0x2c')](transfers[_0x220b2c['uniqueid']][_0xe0e4('0x2d')],transfers[_0x220b2c[_0xe0e4('0x4')]]['agentconnectAt']);transfers[_0x220b2c[_0xe0e4('0x4')]][_0xe0e4('0x1e')]='agent';transfers[_0x220b2c[_0xe0e4('0x4')]][_0xe0e4('0x16')]=_0xe0e4('0x2f');writeDB(transfers[_0x220b2c[_0xe0e4('0x4')]],!![]);}if(agents[_0x220b2c[_0xe0e4('0x4')]]&&agents[_0x220b2c['uniqueid']][_0xe0e4('0x2e')]){agents[_0x220b2c[_0xe0e4('0x4')]]['agentcomplete']=!![];agents[_0x220b2c[_0xe0e4('0x4')]][_0xe0e4('0x2d')]=utils[_0xe0e4('0x15')]();agents[_0x220b2c[_0xe0e4('0x4')]][_0xe0e4('0x28')]=utils[_0xe0e4('0x2c')](agents[_0x220b2c[_0xe0e4('0x4')]][_0xe0e4('0x2d')],agents[_0x220b2c[_0xe0e4('0x4')]][_0xe0e4('0x2e')]);agents[_0x220b2c[_0xe0e4('0x4')]][_0xe0e4('0x1e')]=agents[_0x220b2c[_0xe0e4('0x4')]][_0xe0e4('0x31')]?_0xe0e4('0x31'):_0xe0e4('0x48');agents[_0x220b2c[_0xe0e4('0x4')]]['lastevent']='complete';writeDB(agents[_0x220b2c[_0xe0e4('0x4')]]);}}catch(_0x4c76bc){utils[_0xe0e4('0x19')](_0x4c76bc['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 16ee3e2..cd6d176 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 _0xc79a=['routeid','sipcallid','application','toLowerCase','set','startsWith','appdata','cdr','substring','lastIndexOf','noop','lastdata','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','info','format','uniqueid','channel','accountcode','destination','callerid','disposition','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','OutgoingSpoolFailed','calleridnum','context','now','error','newstate','isNil','channelstate','systemanswertime','linkedid','transfer','destinationchannel','answertime','toNumber','stack','hangup','calleridname','endtime','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','_attended','transfertargetchannel','origtransfererchannel','userfield','musiconholdstartAt','mohtime','varset','variable','xmd-originatecalleridnum','source','value','\x22\x20<','xmd-callerid-preview','lastapplication','Queue','queue','ContactId','xmd-cdrtype','type'];(function(_0x312b2b,_0x2174f3){var _0x1d6a18=function(_0x4f95ae){while(--_0x4f95ae){_0x312b2b['push'](_0x312b2b['shift']());}};_0x1d6a18(++_0x2174f3);}(_0xc79a,0xa0));var _0xac79=function(_0x404992,_0x58aca1){_0x404992=_0x404992-0x0;var _0x384bae=_0xc79a[_0x404992];return _0x384bae;};'use strict';var _=require(_0xac79('0x0'));var util=require(_0xac79('0x1'));var utils=require('./utils');var dispositions=[_0xac79('0x2'),_0xac79('0x3'),_0xac79('0x3'),_0xac79('0x2'),_0xac79('0x2'),_0xac79('0x2'),_0xac79('0x4'),'BUSY','FAILED',_0xac79('0x3'),_0xac79('0x3')];var channels={};function writeDB(_0x33c1df){utils[_0xac79('0x5')](util[_0xac79('0x6')]('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x33c1df[_0xac79('0x7')],_0x33c1df[_0xac79('0x8')],_0x33c1df['type'],_0x33c1df[_0xac79('0x9')],_0x33c1df['source'],_0x33c1df[_0xac79('0xa')],_0x33c1df[_0xac79('0xb')],_0x33c1df[_0xac79('0xc')]));if(_0x33c1df[_0xac79('0x9')]){utils[_0xac79('0xd')](_0x33c1df[_0xac79('0x9')])[_0xac79('0xe')](function(_0x5be288){if(_0x5be288){_0x33c1df[_0xac79('0xf')]=_0x5be288['id'];}utils[_0xac79('0x10')](_0xac79('0x11'),_0x33c1df);});}else{utils['request'](_0xac79('0x11'),_0x33c1df);}if(channels[_0x33c1df[_0xac79('0x7')]]){delete channels[_0x33c1df[_0xac79('0x7')]];}}exports[_0xac79('0x12')]=function(_0x8c126d){try{if(_0x8c126d['uniqueid']==_0x8c126d['linkedid']&&_0x8c126d['channel']!=_0xac79('0x13')){channels[_0x8c126d[_0xac79('0x7')]]={'uniqueid':_0x8c126d[_0xac79('0x7')],'accountcode':_0x8c126d[_0xac79('0x9')],'source':_0x8c126d[_0xac79('0x14')],'destination':_0x8c126d['exten'],'destinationcontext':_0x8c126d[_0xac79('0x15')],'channel':_0x8c126d[_0xac79('0x8')],'starttime':utils[_0xac79('0x16')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xac79('0x2'),'amaflags':'DOCUMENTATION'};}}catch(_0x3efdc6){utils[_0xac79('0x17')](_0x3efdc6['stack']);}};exports[_0xac79('0x18')]=function(_0x434bec){try{if(!_[_0xac79('0x19')](channels[_0x434bec[_0xac79('0x7')]])&&_0x434bec[_0xac79('0x1a')]==0x6){if(_[_0xac79('0x19')](channels[_0x434bec[_0xac79('0x7')]][_0xac79('0x1b')])){channels[_0x434bec[_0xac79('0x7')]][_0xac79('0x1b')]=utils[_0xac79('0x16')]();}}else if(!_['isNil'](channels[_0x434bec[_0xac79('0x1c')]])&&_0x434bec[_0xac79('0x1a')]==0x6&&_0x434bec[_0xac79('0x15')]!=_0xac79('0x1d')){channels[_0x434bec[_0xac79('0x1c')]]['accountcode']=_0x434bec[_0xac79('0x9')];channels[_0x434bec[_0xac79('0x1c')]][_0xac79('0x1e')]=_0x434bec['channel'];if(_[_0xac79('0x19')](channels[_0x434bec[_0xac79('0x1c')]][_0xac79('0x1f')])){channels[_0x434bec[_0xac79('0x1c')]][_0xac79('0x1f')]=utils[_0xac79('0x16')]();}channels[_0x434bec[_0xac79('0x1c')]][_0xac79('0xc')]=dispositions[_[_0xac79('0x20')](_0x434bec['channelstate'])]||'ANSWERED';}}catch(_0x3f19b7){utils[_0xac79('0x17')](_0x3f19b7[_0xac79('0x21')]);}};exports[_0xac79('0x22')]=function(_0x2c4703){try{if(!_['isNil'](channels[_0x2c4703[_0xac79('0x7')]])){if(_['isNil'](channels[_0x2c4703[_0xac79('0x7')]][_0xac79('0xb')])){channels[_0x2c4703[_0xac79('0x7')]][_0xac79('0xb')]=_0x2c4703[_0xac79('0x23')]+'\x20<'+_0x2c4703[_0xac79('0x14')]+'>';}channels[_0x2c4703[_0xac79('0x7')]][_0xac79('0x24')]=utils[_0xac79('0x16')]();channels[_0x2c4703[_0xac79('0x7')]]['duration']=utils[_0xac79('0x25')](channels[_0x2c4703['uniqueid']][_0xac79('0x24')],channels[_0x2c4703[_0xac79('0x7')]][_0xac79('0x26')]);channels[_0x2c4703[_0xac79('0x7')]][_0xac79('0x27')]=channels[_0x2c4703['uniqueid']]['answertime']?utils[_0xac79('0x25')](channels[_0x2c4703[_0xac79('0x7')]][_0xac79('0x24')],channels[_0x2c4703[_0xac79('0x7')]]['answertime']):0x0;writeDB(channels[_0x2c4703[_0xac79('0x7')]]);}}catch(_0x5ab90a){utils[_0xac79('0x17')](_0x5ab90a[_0xac79('0x21')]);}};exports[_0xac79('0x28')]=function(_0x59dc83){try{if(!_[_0xac79('0x19')](channels[_0x59dc83[_0xac79('0x29')]])){if(channels[_0x59dc83[_0xac79('0x29')]][_0xac79('0x8')]==_0x59dc83[_0xac79('0x2a')]){channels[_0x59dc83['localtwolinkedid']][_0xac79('0x1e')]=_0x59dc83['secondtransfererchannel'];channels[_0x59dc83[_0xac79('0x29')]]['userfield']=_0xac79('0x2b');}else if(channels[_0x59dc83['localtwolinkedid']][_0xac79('0x8')]=_0x59dc83[_0xac79('0x2c')]){channels[_0x59dc83['localtwolinkedid']]['destinationchannel']=_0x59dc83[_0xac79('0x2d')];channels[_0x59dc83['localtwolinkedid']][_0xac79('0x2e')]=_0xac79('0x2b');}}}catch(_0x2fe2ff){utils[_0xac79('0x17')](_0x2fe2ff[_0xac79('0x21')]);}};exports['musiconholdstart']=function(_0x13ddeb){try{if(!_[_0xac79('0x19')](channels[_0x13ddeb['uniqueid']])){channels[_0x13ddeb['uniqueid']][_0xac79('0x2f')]=utils['now']();}}catch(_0x33b135){utils['error'](_0x33b135[_0xac79('0x21')]);}};exports['musiconholdstop']=function(_0x39a4de){try{if(!_[_0xac79('0x19')](channels[_0x39a4de[_0xac79('0x7')]])){if(!_[_0xac79('0x19')](channels[_0x39a4de[_0xac79('0x7')]]['musiconholdstartAt'])){channels[_0x39a4de[_0xac79('0x7')]][_0xac79('0x30')]+=utils[_0xac79('0x25')](utils[_0xac79('0x16')](),channels[_0x39a4de['uniqueid']]['musiconholdstartAt']);delete channels[_0x39a4de[_0xac79('0x7')]]['musiconholdstartAt'];}}}catch(_0x63ee53){utils[_0xac79('0x17')](_0x63ee53[_0xac79('0x21')]);}};exports[_0xac79('0x31')]=function(_0x18c7d0){try{if(!_['isNil'](channels[_0x18c7d0[_0xac79('0x7')]])){if(!_[_0xac79('0x19')](_0x18c7d0[_0xac79('0x32')][_0xac79('0x33')])){channels[_0x18c7d0['uniqueid']][_0xac79('0x34')]=_0x18c7d0['value'];}if(!_[_0xac79('0x19')](_0x18c7d0[_0xac79('0x32')]['xmd-phone'])){channels[_0x18c7d0[_0xac79('0x7')]][_0xac79('0xa')]=_0x18c7d0[_0xac79('0x35')];channels[_0x18c7d0[_0xac79('0x7')]][_0xac79('0xb')]='\x22'+_0x18c7d0[_0xac79('0x35')]+_0xac79('0x36')+_0x18c7d0[_0xac79('0x35')]+'>';}if(!_[_0xac79('0x19')](_0x18c7d0[_0xac79('0x32')][_0xac79('0x37')])||!_['isNil'](_0x18c7d0[_0xac79('0x32')]['xmd-callerid'])){channels[_0x18c7d0[_0xac79('0x7')]][_0xac79('0xb')]=_0x18c7d0[_0xac79('0x35')];}if(!_[_0xac79('0x19')](_0x18c7d0[_0xac79('0x32')]['xmd-queue'])||!_[_0xac79('0x19')](_0x18c7d0['variable']['xmcs-queue'])){channels[_0x18c7d0[_0xac79('0x7')]][_0xac79('0x38')]=_0xac79('0x39');channels[_0x18c7d0[_0xac79('0x7')]]['lastdata']=_0x18c7d0[_0xac79('0x35')];channels[_0x18c7d0[_0xac79('0x7')]][_0xac79('0x3a')]=!![];}if(!_['isNil'](_0x18c7d0[_0xac79('0x32')]['xmd-contactid'])){channels[_0x18c7d0['uniqueid']][_0xac79('0x3b')]=_0x18c7d0[_0xac79('0x35')];}if(!_[_0xac79('0x19')](_0x18c7d0['variable'][_0xac79('0x3c')])){channels[_0x18c7d0[_0xac79('0x7')]][_0xac79('0x3d')]=_0x18c7d0[_0xac79('0x35')];}if(!_['isNil'](_0x18c7d0[_0xac79('0x32')]['outboundrouteid'])){channels[_0x18c7d0[_0xac79('0x7')]][_0xac79('0x3e')]=_0x18c7d0['value'];}if(!_['isNil'](_0x18c7d0[_0xac79('0x32')][_0xac79('0x3f')])){channels[_0x18c7d0[_0xac79('0x7')]]['sipcallid']=_0x18c7d0['value'];}}}catch(_0x4cdee4){utils[_0xac79('0x17')](_0x4cdee4['stack']);}};exports['newexten']=function(_0x3d8f70){try{if(!_[_0xac79('0x19')](channels[_0x3d8f70[_0xac79('0x7')]])){if(_0x3d8f70[_0xac79('0x40')][_0xac79('0x41')]()==_0xac79('0x42')&&_[_0xac79('0x43')](_0x3d8f70[_0xac79('0x44')][_0xac79('0x41')](),_0xac79('0x45'))){var _0x44baff=_0x3d8f70[_0xac79('0x44')]['split']('=');var _0x120491=_0x44baff[0x0][_0xac79('0x46')](_0x44baff[0x0]['lastIndexOf']('(')+0x1,_0x44baff[0x0][_0xac79('0x47')](')'));var _0x509172=_0x44baff[0x1];channels[_0x3d8f70[_0xac79('0x7')]][_0x120491]=_0x509172;}if(!_['includes']([_0xac79('0x22'),_0xac79('0x48'),'execif',_0xac79('0x42'),'gotoif'],_0x3d8f70[_0xac79('0x40')][_0xac79('0x41')]())){channels[_0x3d8f70[_0xac79('0x7')]][_0xac79('0x38')]=_0x3d8f70[_0xac79('0x40')];channels[_0x3d8f70[_0xac79('0x7')]][_0xac79('0x49')]=_0x3d8f70[_0xac79('0x44')];}}}catch(_0x377038){utils[_0xac79('0x17')](_0x377038[_0xac79('0x21')]);}}; \ No newline at end of file +var _0x9e59=['xmd-contactid','ContactId','xmd-cdrtype','outboundrouteid','sipcallid','newexten','application','appdata','toLowerCase','cdr','split','substring','lastIndexOf','includes','gotoif','lastapplication','lastdata','util','./utils','NO\x20ANSWER','FAILED','info','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','accountcode','destination','disposition','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','linkedid','OutgoingSpoolFailed','calleridnum','exten','now','error','stack','newstate','isNil','channelstate','systemanswertime','transfer','answertime','ANSWERED','hangup','callerid','calleridname','duration','diffTime','endtime','billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','destinationchannel','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','mohtime','varset','variable','xmd-originatecalleridnum','source','value','xmd-phone','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','Queue','queue'];(function(_0xea1dfe,_0x510830){var _0x142f0d=function(_0x259b24){while(--_0x259b24){_0xea1dfe['push'](_0xea1dfe['shift']());}};_0x142f0d(++_0x510830);}(_0x9e59,0x1a6));var _0x99e5=function(_0x1afe8e,_0x1990a7){_0x1afe8e=_0x1afe8e-0x0;var _0x18ee89=_0x9e59[_0x1afe8e];return _0x18ee89;};'use strict';var _=require('lodash');var util=require(_0x99e5('0x0'));var utils=require(_0x99e5('0x1'));var dispositions=['NO\x20ANSWER','FAILED','FAILED','NO\x20ANSWER',_0x99e5('0x2'),'NO\x20ANSWER','ANSWERED','BUSY',_0x99e5('0x3'),_0x99e5('0x3'),_0x99e5('0x3')];var channels={};function writeDB(_0xe8635e){utils[_0x99e5('0x4')](util['format'](_0x99e5('0x5'),_0xe8635e[_0x99e5('0x6')],_0xe8635e[_0x99e5('0x7')],_0xe8635e[_0x99e5('0x8')],_0xe8635e[_0x99e5('0x9')],_0xe8635e['source'],_0xe8635e[_0x99e5('0xa')],_0xe8635e['callerid'],_0xe8635e[_0x99e5('0xb')]));if(_0xe8635e[_0x99e5('0x9')]){utils[_0x99e5('0xc')](_0xe8635e[_0x99e5('0x9')])[_0x99e5('0xd')](function(_0x4a630c){if(_0x4a630c){_0xe8635e[_0x99e5('0xe')]=_0x4a630c['id'];}utils['request']('CreateVoiceCallReport',_0xe8635e);});}else{utils[_0x99e5('0xf')](_0x99e5('0x10'),_0xe8635e);}if(channels[_0xe8635e[_0x99e5('0x6')]]){delete channels[_0xe8635e[_0x99e5('0x6')]];}}exports[_0x99e5('0x11')]=function(_0x1eb180){try{if(_0x1eb180['uniqueid']==_0x1eb180[_0x99e5('0x12')]&&_0x1eb180[_0x99e5('0x7')]!=_0x99e5('0x13')){channels[_0x1eb180[_0x99e5('0x6')]]={'uniqueid':_0x1eb180[_0x99e5('0x6')],'accountcode':_0x1eb180['accountcode'],'source':_0x1eb180[_0x99e5('0x14')],'destination':_0x1eb180[_0x99e5('0x15')],'destinationcontext':_0x1eb180['context'],'channel':_0x1eb180[_0x99e5('0x7')],'starttime':utils[_0x99e5('0x16')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x107455){utils[_0x99e5('0x17')](_0x107455[_0x99e5('0x18')]);}};exports[_0x99e5('0x19')]=function(_0x100972){try{if(!_[_0x99e5('0x1a')](channels[_0x100972[_0x99e5('0x6')]])&&_0x100972[_0x99e5('0x1b')]==0x6){if(_[_0x99e5('0x1a')](channels[_0x100972[_0x99e5('0x6')]]['systemanswertime'])){channels[_0x100972[_0x99e5('0x6')]][_0x99e5('0x1c')]=utils[_0x99e5('0x16')]();}}else if(!_[_0x99e5('0x1a')](channels[_0x100972[_0x99e5('0x12')]])&&_0x100972['channelstate']==0x6&&_0x100972['context']!=_0x99e5('0x1d')){channels[_0x100972[_0x99e5('0x12')]]['accountcode']=_0x100972[_0x99e5('0x9')];channels[_0x100972[_0x99e5('0x12')]]['destinationchannel']=_0x100972[_0x99e5('0x7')];if(_['isNil'](channels[_0x100972['linkedid']]['answertime'])){channels[_0x100972[_0x99e5('0x12')]][_0x99e5('0x1e')]=utils[_0x99e5('0x16')]();}channels[_0x100972[_0x99e5('0x12')]][_0x99e5('0xb')]=dispositions[_['toNumber'](_0x100972[_0x99e5('0x1b')])]||_0x99e5('0x1f');}}catch(_0xdf2d3){utils['error'](_0xdf2d3[_0x99e5('0x18')]);}};exports[_0x99e5('0x20')]=function(_0x11952a){try{if(!_[_0x99e5('0x1a')](channels[_0x11952a['uniqueid']])){if(_['isNil'](channels[_0x11952a['uniqueid']][_0x99e5('0x21')])){channels[_0x11952a['uniqueid']][_0x99e5('0x21')]=_0x11952a[_0x99e5('0x22')]+'\x20<'+_0x11952a['calleridnum']+'>';}channels[_0x11952a[_0x99e5('0x6')]]['endtime']=utils[_0x99e5('0x16')]();channels[_0x11952a['uniqueid']][_0x99e5('0x23')]=utils[_0x99e5('0x24')](channels[_0x11952a[_0x99e5('0x6')]][_0x99e5('0x25')],channels[_0x11952a[_0x99e5('0x6')]]['starttime']);channels[_0x11952a[_0x99e5('0x6')]][_0x99e5('0x26')]=channels[_0x11952a['uniqueid']]['answertime']?utils[_0x99e5('0x24')](channels[_0x11952a[_0x99e5('0x6')]]['endtime'],channels[_0x11952a['uniqueid']][_0x99e5('0x1e')]):0x0;writeDB(channels[_0x11952a[_0x99e5('0x6')]]);}}catch(_0x321035){utils['error'](_0x321035[_0x99e5('0x18')]);}};exports[_0x99e5('0x27')]=function(_0x1d25c2){try{if(!_[_0x99e5('0x1a')](channels[_0x1d25c2['localtwolinkedid']])){if(channels[_0x1d25c2[_0x99e5('0x28')]][_0x99e5('0x7')]==_0x1d25c2[_0x99e5('0x29')]){channels[_0x1d25c2[_0x99e5('0x28')]][_0x99e5('0x2a')]=_0x1d25c2[_0x99e5('0x2b')];channels[_0x1d25c2[_0x99e5('0x28')]][_0x99e5('0x2c')]=_0x99e5('0x2d');}else if(channels[_0x1d25c2['localtwolinkedid']]['channel']=_0x1d25c2['transfertargetchannel']){channels[_0x1d25c2[_0x99e5('0x28')]]['destinationchannel']=_0x1d25c2[_0x99e5('0x2e')];channels[_0x1d25c2[_0x99e5('0x28')]]['userfield']=_0x99e5('0x2d');}}}catch(_0x54e83a){utils[_0x99e5('0x17')](_0x54e83a[_0x99e5('0x18')]);}};exports[_0x99e5('0x2f')]=function(_0x63c830){try{if(!_['isNil'](channels[_0x63c830[_0x99e5('0x6')]])){channels[_0x63c830[_0x99e5('0x6')]][_0x99e5('0x30')]=utils[_0x99e5('0x16')]();}}catch(_0x233705){utils[_0x99e5('0x17')](_0x233705[_0x99e5('0x18')]);}};exports[_0x99e5('0x31')]=function(_0x1b6f46){try{if(!_[_0x99e5('0x1a')](channels[_0x1b6f46[_0x99e5('0x6')]])){if(!_[_0x99e5('0x1a')](channels[_0x1b6f46[_0x99e5('0x6')]]['musiconholdstartAt'])){channels[_0x1b6f46[_0x99e5('0x6')]][_0x99e5('0x32')]+=utils['diffTime'](utils[_0x99e5('0x16')](),channels[_0x1b6f46[_0x99e5('0x6')]][_0x99e5('0x30')]);delete channels[_0x1b6f46['uniqueid']]['musiconholdstartAt'];}}}catch(_0x253e3f){utils[_0x99e5('0x17')](_0x253e3f[_0x99e5('0x18')]);}};exports[_0x99e5('0x33')]=function(_0x4e1a47){try{if(!_[_0x99e5('0x1a')](channels[_0x4e1a47[_0x99e5('0x6')]])){if(!_[_0x99e5('0x1a')](_0x4e1a47[_0x99e5('0x34')][_0x99e5('0x35')])){channels[_0x4e1a47[_0x99e5('0x6')]][_0x99e5('0x36')]=_0x4e1a47[_0x99e5('0x37')];}if(!_[_0x99e5('0x1a')](_0x4e1a47[_0x99e5('0x34')][_0x99e5('0x38')])){channels[_0x4e1a47[_0x99e5('0x6')]][_0x99e5('0xa')]=_0x4e1a47['value'];channels[_0x4e1a47[_0x99e5('0x6')]][_0x99e5('0x21')]='\x22'+_0x4e1a47[_0x99e5('0x37')]+_0x99e5('0x39')+_0x4e1a47[_0x99e5('0x37')]+'>';}if(!_[_0x99e5('0x1a')](_0x4e1a47['variable'][_0x99e5('0x3a')])||!_[_0x99e5('0x1a')](_0x4e1a47[_0x99e5('0x34')][_0x99e5('0x3b')])){channels[_0x4e1a47['uniqueid']]['callerid']=_0x4e1a47[_0x99e5('0x37')];}if(!_[_0x99e5('0x1a')](_0x4e1a47[_0x99e5('0x34')][_0x99e5('0x3c')])||!_['isNil'](_0x4e1a47[_0x99e5('0x34')][_0x99e5('0x3d')])){channels[_0x4e1a47[_0x99e5('0x6')]]['lastapplication']=_0x99e5('0x3e');channels[_0x4e1a47[_0x99e5('0x6')]]['lastdata']=_0x4e1a47['value'];channels[_0x4e1a47[_0x99e5('0x6')]][_0x99e5('0x3f')]=!![];}if(!_[_0x99e5('0x1a')](_0x4e1a47['variable'][_0x99e5('0x40')])){channels[_0x4e1a47[_0x99e5('0x6')]][_0x99e5('0x41')]=_0x4e1a47[_0x99e5('0x37')];}if(!_[_0x99e5('0x1a')](_0x4e1a47['variable'][_0x99e5('0x42')])){channels[_0x4e1a47[_0x99e5('0x6')]][_0x99e5('0x8')]=_0x4e1a47[_0x99e5('0x37')];}if(!_['isNil'](_0x4e1a47[_0x99e5('0x34')][_0x99e5('0x43')])){channels[_0x4e1a47[_0x99e5('0x6')]]['routeid']=_0x4e1a47[_0x99e5('0x37')];}if(!_[_0x99e5('0x1a')](_0x4e1a47[_0x99e5('0x34')][_0x99e5('0x44')])){channels[_0x4e1a47[_0x99e5('0x6')]][_0x99e5('0x44')]=_0x4e1a47[_0x99e5('0x37')];}}}catch(_0xb51d7d){utils[_0x99e5('0x17')](_0xb51d7d['stack']);}};exports[_0x99e5('0x45')]=function(_0x3e0521){try{if(!_[_0x99e5('0x1a')](channels[_0x3e0521[_0x99e5('0x6')]])){if(_0x3e0521[_0x99e5('0x46')]['toLowerCase']()=='set'&&_['startsWith'](_0x3e0521[_0x99e5('0x47')][_0x99e5('0x48')](),_0x99e5('0x49'))){var _0x5e8676=_0x3e0521[_0x99e5('0x47')][_0x99e5('0x4a')]('=');var _0x4f9360=_0x5e8676[0x0][_0x99e5('0x4b')](_0x5e8676[0x0][_0x99e5('0x4c')]('(')+0x1,_0x5e8676[0x0][_0x99e5('0x4c')](')'));var _0x2d2261=_0x5e8676[0x1];channels[_0x3e0521[_0x99e5('0x6')]][_0x4f9360]=_0x2d2261;}if(!_[_0x99e5('0x4d')]([_0x99e5('0x20'),'noop','execif','set',_0x99e5('0x4e')],_0x3e0521[_0x99e5('0x46')][_0x99e5('0x48')]())){channels[_0x3e0521['uniqueid']][_0x99e5('0x4f')]=_0x3e0521[_0x99e5('0x46')];channels[_0x3e0521[_0x99e5('0x6')]][_0x99e5('0x50')]=_0x3e0521[_0x99e5('0x47')];}}}catch(_0x14d920){utils[_0x99e5('0x17')](_0x14d920[_0x99e5('0x18')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 14d57ae..0395e02 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 _0x187d=['error','close','CLOSE','managerevent','./utils','connect','info','CONNECTED','shutdown','SHUTDOWN','FULLYBOOTED'];(function(_0x2f91bc,_0x2382d8){var _0x63c4c=function(_0x4b61ac){while(--_0x4b61ac){_0x2f91bc['push'](_0x2f91bc['shift']());}};_0x63c4c(++_0x2382d8);}(_0x187d,0x93));var _0xd187=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x187d[_0x3947c9];return _0x2e7871;};'use strict';var utils=require(_0xd187('0x0'));var _=require('lodash');exports[_0xd187('0x1')]=function(){utils[_0xd187('0x2')](_0xd187('0x3'));};exports[_0xd187('0x4')]=function(){utils[_0xd187('0x2')](_0xd187('0x5'));};exports['fullybooted']=function(){utils[_0xd187('0x2')](_0xd187('0x6'));};exports['error']=function(_0x1d2533){utils[_0xd187('0x7')](_0x1d2533);};exports[_0xd187('0x8')]=function(){utils[_0xd187('0x2')](_0xd187('0x9'));};exports[_0xd187('0xa')]=function(_0x358c45){}; \ No newline at end of file +var _0x3c6c=['SHUTDOWN','fullybooted','error','./utils','connect','info','CONNECTED','shutdown'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x2d5850,_0x31cc29){_0x2d5850=_0x2d5850-0x0;var _0x358c55=_0x3c6c[_0x2d5850];return _0x358c55;};'use strict';var utils=require(_0xc3c6('0x0'));var _=require('lodash');exports[_0xc3c6('0x1')]=function(){utils[_0xc3c6('0x2')](_0xc3c6('0x3'));};exports[_0xc3c6('0x4')]=function(){utils[_0xc3c6('0x2')](_0xc3c6('0x5'));};exports[_0xc3c6('0x6')]=function(){utils[_0xc3c6('0x2')]('FULLYBOOTED');};exports[_0xc3c6('0x7')]=function(_0x4a2ca1){utils[_0xc3c6('0x7')](_0x4a2ca1);};exports['close']=function(){utils['info']('CLOSE');};exports['managerevent']=function(_0x4f39dd){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index c4f3685..fa60667 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 _0x967b=['info','format','uniqueid','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','newexten','set','startsWith','appdata','toLowerCase','cdr(routeid)','split','stack','varset','variable','outboundrouteid','value','error','dialbegin','isNil','assign','starttime','now','lastevent','called','dialend','ANSWER','answertime','complete','duration','diffTime','endtime','billableseconds','lodash','util','./utils'];(function(_0x4bbcc1,_0x594e19){var _0x34435b=function(_0x124582){while(--_0x124582){_0x4bbcc1['push'](_0x4bbcc1['shift']());}};_0x34435b(++_0x594e19);}(_0x967b,0x10e));var _0xb967=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x967b[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xb967('0x0'));var util=require(_0xb967('0x1'));var utils=require(_0xb967('0x2'));var dials={};function writeDB(_0x34a727){utils[_0xb967('0x3')](util[_0xb967('0x4')]('DIAL|%s|%s|%s|%s|%s|%s',_0x34a727[_0xb967('0x5')],_0x34a727['channel'],_0x34a727[_0xb967('0x6')],_0x34a727[_0xb967('0x7')],_0x34a727['connectedlinenum'],_0x34a727[_0xb967('0x8')]));utils[_0xb967('0x9')](_0xb967('0xa'),_0x34a727);delete dials[_0x34a727[_0xb967('0x5')]];}exports[_0xb967('0xb')]=function(_0x7dd9e6){try{if(_0x7dd9e6['application']['toLowerCase']()==_0xb967('0xc')&&_[_0xb967('0xd')](_0x7dd9e6[_0xb967('0xe')][_0xb967('0xf')](),_0xb967('0x10'))){var _0x51aa02=_0x7dd9e6['appdata'][_0xb967('0x11')]('=');dials[_0x7dd9e6[_0xb967('0x5')]]={'routeId':_0x51aa02[0x1]};}}catch(_0x4b3613){utils['error'](_0x4b3613[_0xb967('0x12')]);}};exports[_0xb967('0x13')]=function(_0x592dd8){try{if(!_['isNil'](_0x592dd8[_0xb967('0x14')][_0xb967('0x15')])){dials[_0x592dd8[_0xb967('0x5')]]={'routeId':_0x592dd8[_0xb967('0x16')]};}}catch(_0x4821b1){utils[_0xb967('0x17')](_0x4821b1[_0xb967('0x12')]);}};exports[_0xb967('0x18')]=function(_0x3405c3){try{if(!_[_0xb967('0x19')](dials[_0x3405c3[_0xb967('0x5')]])){dials[_0x3405c3[_0xb967('0x5')]]=_[_0xb967('0x1a')](dials[_0x3405c3[_0xb967('0x5')]],_0x3405c3);dials[_0x3405c3['uniqueid']][_0xb967('0x1b')]=utils[_0xb967('0x1c')]();dials[_0x3405c3[_0xb967('0x5')]][_0xb967('0x1d')]=_0xb967('0x1e');}}catch(_0x1b2fcc){utils[_0xb967('0x17')](_0x1b2fcc[_0xb967('0x12')]);}};exports[_0xb967('0x1f')]=function(_0x4c73f8){try{if(!_[_0xb967('0x19')](dials[_0x4c73f8[_0xb967('0x5')]])){dials[_0x4c73f8[_0xb967('0x5')]][_0xb967('0x8')]=_0x4c73f8[_0xb967('0x8')];if(_0x4c73f8[_0xb967('0x8')]==_0xb967('0x20')){dials[_0x4c73f8[_0xb967('0x5')]]=_[_0xb967('0x1a')](dials[_0x4c73f8[_0xb967('0x5')]],_0x4c73f8);dials[_0x4c73f8[_0xb967('0x5')]][_0xb967('0x21')]=utils['now']();dials[_0x4c73f8[_0xb967('0x5')]][_0xb967('0x1d')]='connect';}}}catch(_0x5e7504){utils['error'](_0x5e7504[_0xb967('0x12')]);}};exports['hangup']=function(_0x5403b0){try{if(!_['isNil'](dials[_0x5403b0[_0xb967('0x5')]])){dials[_0x5403b0[_0xb967('0x5')]]=_['assign'](dials[_0x5403b0[_0xb967('0x5')]],{'endtime':utils[_0xb967('0x1c')](),'lastevent':_0xb967('0x22')});dials[_0x5403b0[_0xb967('0x5')]][_0xb967('0x23')]=utils[_0xb967('0x24')](dials[_0x5403b0[_0xb967('0x5')]][_0xb967('0x25')],dials[_0x5403b0[_0xb967('0x5')]][_0xb967('0x1b')]);dials[_0x5403b0['uniqueid']]['holdtime']=utils[_0xb967('0x24')](dials[_0x5403b0[_0xb967('0x5')]][_0xb967('0x21')]||dials[_0x5403b0['uniqueid']][_0xb967('0x25')],dials[_0x5403b0[_0xb967('0x5')]][_0xb967('0x1b')]);dials[_0x5403b0[_0xb967('0x5')]][_0xb967('0x26')]=dials[_0x5403b0[_0xb967('0x5')]][_0xb967('0x21')]?utils[_0xb967('0x24')](dials[_0x5403b0[_0xb967('0x5')]]['endtime'],dials[_0x5403b0[_0xb967('0x5')]][_0xb967('0x21')]):0x0;writeDB(dials[_0x5403b0[_0xb967('0x5')]]);}}catch(_0x3dc4ea){utils[_0xb967('0x17')](_0x3dc4ea[_0xb967('0x12')]);}}; \ No newline at end of file +var _0x215d=['stack','varset','isNil','variable','value','error','dialbegin','assign','starttime','now','lastevent','called','dialend','ANSWER','answertime','connect','duration','diffTime','endtime','holdtime','billableseconds','lodash','./utils','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','dialstring','connectedlinenum','dialstatus','request','application','toLowerCase','startsWith','appdata','cdr(routeid)','split'];(function(_0x5c92f9,_0x216181){var _0x47cec1=function(_0x47a3d1){while(--_0x47a3d1){_0x5c92f9['push'](_0x5c92f9['shift']());}};_0x47cec1(++_0x216181);}(_0x215d,0x187));var _0xd215=function(_0x3585f0,_0x42a45f){_0x3585f0=_0x3585f0-0x0;var _0x583ff1=_0x215d[_0x3585f0];return _0x583ff1;};'use strict';var _=require(_0xd215('0x0'));var util=require('util');var utils=require(_0xd215('0x1'));var dials={};function writeDB(_0x2c98a7){utils[_0xd215('0x2')](util[_0xd215('0x3')](_0xd215('0x4'),_0x2c98a7[_0xd215('0x5')],_0x2c98a7['channel'],_0x2c98a7[_0xd215('0x6')],_0x2c98a7['calleridnum'],_0x2c98a7[_0xd215('0x7')],_0x2c98a7[_0xd215('0x8')]));utils[_0xd215('0x9')]('CreateVoiceDialReport',_0x2c98a7);delete dials[_0x2c98a7[_0xd215('0x5')]];}exports['newexten']=function(_0x1ab6c8){try{if(_0x1ab6c8[_0xd215('0xa')][_0xd215('0xb')]()=='set'&&_[_0xd215('0xc')](_0x1ab6c8[_0xd215('0xd')][_0xd215('0xb')](),_0xd215('0xe'))){var _0x7da315=_0x1ab6c8['appdata'][_0xd215('0xf')]('=');dials[_0x1ab6c8[_0xd215('0x5')]]={'routeId':_0x7da315[0x1]};}}catch(_0x286e85){utils['error'](_0x286e85[_0xd215('0x10')]);}};exports[_0xd215('0x11')]=function(_0x1526b8){try{if(!_[_0xd215('0x12')](_0x1526b8[_0xd215('0x13')]['outboundrouteid'])){dials[_0x1526b8[_0xd215('0x5')]]={'routeId':_0x1526b8[_0xd215('0x14')]};}}catch(_0x306a45){utils[_0xd215('0x15')](_0x306a45[_0xd215('0x10')]);}};exports[_0xd215('0x16')]=function(_0x6e50d0){try{if(!_[_0xd215('0x12')](dials[_0x6e50d0['uniqueid']])){dials[_0x6e50d0[_0xd215('0x5')]]=_[_0xd215('0x17')](dials[_0x6e50d0[_0xd215('0x5')]],_0x6e50d0);dials[_0x6e50d0[_0xd215('0x5')]][_0xd215('0x18')]=utils[_0xd215('0x19')]();dials[_0x6e50d0[_0xd215('0x5')]][_0xd215('0x1a')]=_0xd215('0x1b');}}catch(_0x55f934){utils[_0xd215('0x15')](_0x55f934[_0xd215('0x10')]);}};exports[_0xd215('0x1c')]=function(_0x269d91){try{if(!_[_0xd215('0x12')](dials[_0x269d91[_0xd215('0x5')]])){dials[_0x269d91[_0xd215('0x5')]]['dialstatus']=_0x269d91[_0xd215('0x8')];if(_0x269d91[_0xd215('0x8')]==_0xd215('0x1d')){dials[_0x269d91['uniqueid']]=_[_0xd215('0x17')](dials[_0x269d91[_0xd215('0x5')]],_0x269d91);dials[_0x269d91[_0xd215('0x5')]][_0xd215('0x1e')]=utils['now']();dials[_0x269d91[_0xd215('0x5')]][_0xd215('0x1a')]=_0xd215('0x1f');}}}catch(_0x31466e){utils['error'](_0x31466e['stack']);}};exports['hangup']=function(_0x640b73){try{if(!_[_0xd215('0x12')](dials[_0x640b73[_0xd215('0x5')]])){dials[_0x640b73[_0xd215('0x5')]]=_['assign'](dials[_0x640b73[_0xd215('0x5')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x640b73[_0xd215('0x5')]][_0xd215('0x20')]=utils[_0xd215('0x21')](dials[_0x640b73[_0xd215('0x5')]][_0xd215('0x22')],dials[_0x640b73[_0xd215('0x5')]]['starttime']);dials[_0x640b73[_0xd215('0x5')]][_0xd215('0x23')]=utils[_0xd215('0x21')](dials[_0x640b73[_0xd215('0x5')]][_0xd215('0x1e')]||dials[_0x640b73[_0xd215('0x5')]][_0xd215('0x22')],dials[_0x640b73[_0xd215('0x5')]][_0xd215('0x18')]);dials[_0x640b73[_0xd215('0x5')]][_0xd215('0x24')]=dials[_0x640b73[_0xd215('0x5')]][_0xd215('0x1e')]?utils['diffTime'](dials[_0x640b73['uniqueid']][_0xd215('0x22')],dials[_0x640b73['uniqueid']][_0xd215('0x1e')]):0x0;writeDB(dials[_0x640b73['uniqueid']]);}}catch(_0x1890cc){utils[_0xd215('0x15')](_0x1890cc[_0xd215('0x10')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index bcf951c..21943dd 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 _0x36ba=['dialend','../../config/environment','./utils','port','asterisk','username','password','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x36ba,0xd8));var _0xa36b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x36ba[_0x20a584];return _0x4b41a8;};var AsteriskManager=require('asterisk-manager');var config=require(_0xa36b('0x0'));var utils=require(_0xa36b('0x1'));var ami=new AsteriskManager(config['asterisk'][_0xa36b('0x2')],config[_0xa36b('0x3')]['ip'],config[_0xa36b('0x3')][_0xa36b('0x4')],config[_0xa36b('0x3')][_0xa36b('0x5')],!![]);ami['keepConnected']();if(config['xdr']&&config[_0xa36b('0x6')][_0xa36b('0x7')]){utils[_0xa36b('0x8')](_0xa36b('0x9'));}else{var agents=require(_0xa36b('0xa'));var calls=require(_0xa36b('0xb'));var queues=require(_0xa36b('0xc'));var recordings=require(_0xa36b('0xd'));var members=require(_0xa36b('0xe'));var dials=require(_0xa36b('0xf'));var transfers=require('./transfers.controller');var core=require(_0xa36b('0x10'));ami['on'](_0xa36b('0x11'),core[_0xa36b('0x11')]);ami['on'](_0xa36b('0x12'),core[_0xa36b('0x12')]);ami['on']('fullybooted',core[_0xa36b('0x13')]);ami['on']('error',core[_0xa36b('0x14')]);ami['on'](_0xa36b('0x15'),core[_0xa36b('0x15')]);ami['on'](_0xa36b('0x16'),core[_0xa36b('0x16')]);ami['on'](_0xa36b('0x17'),function(_0x1c99f3){try{members[_0xa36b('0x17')](_0x1c99f3);}catch(_0x504517){utils[_0xa36b('0x14')](_0x504517);}});ami['on'](_0xa36b('0x18'),function(_0xfcaac9){try{agents[_0xa36b('0x18')](_0xfcaac9);}catch(_0x5b7f5c){utils[_0xa36b('0x14')](_0x5b7f5c);}});ami['on']('agentringnoanswer',function(_0x2a89ee){try{agents[_0xa36b('0x19')](_0x2a89ee);}catch(_0x105ac7){utils[_0xa36b('0x14')](_0x105ac7);}});ami['on']('agentconnect',function(_0x2283a9){try{agents[_0xa36b('0x1a')](_0x2283a9);queues[_0xa36b('0x1a')](_0x2283a9);}catch(_0x362cca){utils[_0xa36b('0x14')](_0x362cca);}});ami['on']('agentcomplete',function(_0x1596b2){try{agents[_0xa36b('0x1b')](_0x1596b2);queues[_0xa36b('0x1b')](_0x1596b2);members[_0xa36b('0x1b')](_0x1596b2);}catch(_0x52158c){utils[_0xa36b('0x14')](_0x52158c);}});ami['on']('queuecallerabandon',function(_0x172abf){try{agents[_0xa36b('0x1c')](_0x172abf);queues[_0xa36b('0x1c')](_0x172abf);}catch(_0x3a9906){utils['error'](_0x3a9906);}});ami['on'](_0xa36b('0x1d'),function(_0x45c4a1){try{queues[_0xa36b('0x1d')](_0x45c4a1);recordings[_0xa36b('0x1d')](_0x45c4a1);}catch(_0x108557){utils[_0xa36b('0x14')](_0x108557);}});ami['on'](_0xa36b('0x1e'),function(_0x4407b2){try{queues[_0xa36b('0x1e')](_0x4407b2);}catch(_0x41fe27){utils[_0xa36b('0x14')](_0x41fe27);}});ami['on'](_0xa36b('0x1f'),function(_0x5872d1){try{queues['musiconholdstart'](_0x5872d1);calls[_0xa36b('0x1f')](_0x5872d1);}catch(_0x53f797){utils[_0xa36b('0x14')](_0x53f797);}});ami['on'](_0xa36b('0x20'),function(_0x1c233d){try{queues[_0xa36b('0x20')](_0x1c233d);calls[_0xa36b('0x20')](_0x1c233d);}catch(_0xd9273b){utils[_0xa36b('0x14')](_0xd9273b);}});ami['on'](_0xa36b('0x21'),function(_0x1c68a6){try{calls['newstate'](_0x1c68a6);recordings['newstate'](_0x1c68a6);}catch(_0x40387c){utils[_0xa36b('0x14')](_0x40387c);}});ami['on'](_0xa36b('0x22'),function(_0x2fa2ad){try{calls['hangup'](_0x2fa2ad);recordings[_0xa36b('0x22')](_0x2fa2ad);dials[_0xa36b('0x22')](_0x2fa2ad);agents[_0xa36b('0x22')](_0x2fa2ad);queues['hangup'](_0x2fa2ad);}catch(_0x3d63c9){utils[_0xa36b('0x14')](_0x3d63c9);}});ami['on'](_0xa36b('0x23'),function(_0x1da426){try{members[_0xa36b('0x23')](_0x1da426);}catch(_0x4b7ed5){utils[_0xa36b('0x14')](_0x4b7ed5);}});ami['on'](_0xa36b('0x24'),function(_0x3b77e0){try{queues[_0xa36b('0x24')](_0x3b77e0);agents[_0xa36b('0x24')](_0x3b77e0);transfers['blindtransfer'](_0x3b77e0);}catch(_0x574680){utils[_0xa36b('0x14')](_0x574680);}});ami['on'](_0xa36b('0x25'),function(_0xad3ef){try{queues[_0xa36b('0x25')](_0xad3ef);transfers[_0xa36b('0x25')](_0xad3ef);agents[_0xa36b('0x25')](_0xad3ef);calls[_0xa36b('0x25')](_0xad3ef);}catch(_0x584b53){utils[_0xa36b('0x14')](_0x584b53);}});ami['on'](_0xa36b('0x26'),function(_0x152d51){try{queues[_0xa36b('0x26')](_0x152d51);recordings[_0xa36b('0x26')](_0x152d51);calls['varset'](_0x152d51);dials[_0xa36b('0x26')](_0x152d51);}catch(_0x3a7675){utils[_0xa36b('0x14')](_0x3a7675);}});ami['on'](_0xa36b('0x27'),function(_0x22d3c9){try{calls[_0xa36b('0x27')](_0x22d3c9);recordings[_0xa36b('0x27')](_0x22d3c9);dials[_0xa36b('0x27')](_0x22d3c9);}catch(_0xd74a59){utils[_0xa36b('0x14')](_0xd74a59);}});ami['on']('newchannel',function(_0x57e354){try{calls[_0xa36b('0x28')](_0x57e354);recordings[_0xa36b('0x28')](_0x57e354);}catch(_0x512838){utils[_0xa36b('0x14')](_0x512838);}});ami['on'](_0xa36b('0x29'),function(_0x116834){try{dials[_0xa36b('0x29')](_0x116834);}catch(_0xa5646d){utils[_0xa36b('0x14')](_0xa5646d);}});ami['on']('dialend',function(_0x15f8f7){try{dials[_0xa36b('0x2a')](_0x15f8f7);}catch(_0x5e7b12){utils['error'](_0x5e7b12);}});} \ No newline at end of file +var _0xdabf=['../../config/environment','./utils','asterisk','port','password','keepConnected','xdr','XDR\x20DISABLED','./calls.controller','./queues.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager'];(function(_0x40b0cc,_0x2cd9f2){var _0x459a3f=function(_0x351246){while(--_0x351246){_0x40b0cc['push'](_0x40b0cc['shift']());}};_0x459a3f(++_0x2cd9f2);}(_0xdabf,0x1ac));var _0xfdab=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xdabf[_0x50007c];return _0x5c1ec7;};var AsteriskManager=require(_0xfdab('0x0'));var config=require(_0xfdab('0x1'));var utils=require(_0xfdab('0x2'));var ami=new AsteriskManager(config[_0xfdab('0x3')][_0xfdab('0x4')],config['asterisk']['ip'],config[_0xfdab('0x3')]['username'],config[_0xfdab('0x3')][_0xfdab('0x5')],!![]);ami[_0xfdab('0x6')]();if(config[_0xfdab('0x7')]&&config['xdr']['disabled']){utils['info'](_0xfdab('0x8'));}else{var agents=require('./agents.controller');var calls=require(_0xfdab('0x9'));var queues=require(_0xfdab('0xa'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0xfdab('0xb'));var core=require(_0xfdab('0xc'));ami['on'](_0xfdab('0xd'),core['connect']);ami['on'](_0xfdab('0xe'),core[_0xfdab('0xe')]);ami['on'](_0xfdab('0xf'),core[_0xfdab('0xf')]);ami['on'](_0xfdab('0x10'),core['error']);ami['on'](_0xfdab('0x11'),core[_0xfdab('0x11')]);ami['on'](_0xfdab('0x12'),core['managerevent']);ami['on'](_0xfdab('0x13'),function(_0x5ca545){try{members['devicestatechange'](_0x5ca545);}catch(_0x385928){utils[_0xfdab('0x10')](_0x385928);}});ami['on'](_0xfdab('0x14'),function(_0x1bd14a){try{agents[_0xfdab('0x14')](_0x1bd14a);}catch(_0x543d08){utils['error'](_0x543d08);}});ami['on']('agentringnoanswer',function(_0x57eec2){try{agents[_0xfdab('0x15')](_0x57eec2);}catch(_0x2a11d6){utils[_0xfdab('0x10')](_0x2a11d6);}});ami['on'](_0xfdab('0x16'),function(_0x4c84c2){try{agents['agentconnect'](_0x4c84c2);queues[_0xfdab('0x16')](_0x4c84c2);}catch(_0x59729c){utils['error'](_0x59729c);}});ami['on']('agentcomplete',function(_0x22a836){try{agents[_0xfdab('0x17')](_0x22a836);queues['agentcomplete'](_0x22a836);members['agentcomplete'](_0x22a836);}catch(_0x29a908){utils[_0xfdab('0x10')](_0x29a908);}});ami['on']('queuecallerabandon',function(_0x5907d7){try{agents[_0xfdab('0x18')](_0x5907d7);queues['queuecallerabandon'](_0x5907d7);}catch(_0x4d3890){utils['error'](_0x4d3890);}});ami['on'](_0xfdab('0x19'),function(_0x1fe9da){try{queues['queuecallerjoin'](_0x1fe9da);recordings[_0xfdab('0x19')](_0x1fe9da);}catch(_0x48cea4){utils[_0xfdab('0x10')](_0x48cea4);}});ami['on'](_0xfdab('0x1a'),function(_0x1a4a0c){try{queues[_0xfdab('0x1a')](_0x1a4a0c);}catch(_0xb4db74){utils['error'](_0xb4db74);}});ami['on'](_0xfdab('0x1b'),function(_0x393dd3){try{queues[_0xfdab('0x1b')](_0x393dd3);calls[_0xfdab('0x1b')](_0x393dd3);}catch(_0x2ad67d){utils[_0xfdab('0x10')](_0x2ad67d);}});ami['on'](_0xfdab('0x1c'),function(_0x26165a){try{queues[_0xfdab('0x1c')](_0x26165a);calls['musiconholdstop'](_0x26165a);}catch(_0x152731){utils[_0xfdab('0x10')](_0x152731);}});ami['on'](_0xfdab('0x1d'),function(_0x1c1810){try{calls[_0xfdab('0x1d')](_0x1c1810);recordings[_0xfdab('0x1d')](_0x1c1810);}catch(_0x214162){utils[_0xfdab('0x10')](_0x214162);}});ami['on']('hangup',function(_0x5f4c8f){try{calls[_0xfdab('0x1e')](_0x5f4c8f);recordings[_0xfdab('0x1e')](_0x5f4c8f);dials[_0xfdab('0x1e')](_0x5f4c8f);agents[_0xfdab('0x1e')](_0x5f4c8f);queues[_0xfdab('0x1e')](_0x5f4c8f);}catch(_0x5f4d4f){utils['error'](_0x5f4d4f);}});ami['on']('cdr',function(_0x5bb691){try{members[_0xfdab('0x1f')](_0x5bb691);}catch(_0x1443ba){utils[_0xfdab('0x10')](_0x1443ba);}});ami['on'](_0xfdab('0x20'),function(_0x2ad577){try{queues[_0xfdab('0x20')](_0x2ad577);agents[_0xfdab('0x20')](_0x2ad577);transfers[_0xfdab('0x20')](_0x2ad577);}catch(_0x41d493){utils[_0xfdab('0x10')](_0x41d493);}});ami['on'](_0xfdab('0x21'),function(_0x3f57cc){try{queues['attendedtransfer'](_0x3f57cc);transfers[_0xfdab('0x21')](_0x3f57cc);agents['attendedtransfer'](_0x3f57cc);calls[_0xfdab('0x21')](_0x3f57cc);}catch(_0x1856c7){utils['error'](_0x1856c7);}});ami['on'](_0xfdab('0x22'),function(_0x4295bd){try{queues['varset'](_0x4295bd);recordings[_0xfdab('0x22')](_0x4295bd);calls[_0xfdab('0x22')](_0x4295bd);dials[_0xfdab('0x22')](_0x4295bd);}catch(_0x1346ca){utils[_0xfdab('0x10')](_0x1346ca);}});ami['on'](_0xfdab('0x23'),function(_0x16d68c){try{calls['newexten'](_0x16d68c);recordings['newexten'](_0x16d68c);dials[_0xfdab('0x23')](_0x16d68c);}catch(_0x2c0d53){utils[_0xfdab('0x10')](_0x2c0d53);}});ami['on'](_0xfdab('0x24'),function(_0x711e65){try{calls[_0xfdab('0x24')](_0x711e65);recordings[_0xfdab('0x24')](_0x711e65);}catch(_0x3a43c4){utils[_0xfdab('0x10')](_0x3a43c4);}});ami['on']('dialbegin',function(_0x168f4e){try{dials[_0xfdab('0x25')](_0x168f4e);}catch(_0x2bb944){utils['error'](_0x2bb944);}});ami['on'](_0xfdab('0x26'),function(_0x249851){try{dials[_0xfdab('0x26')](_0x249851);}catch(_0x42ba74){utils[_0xfdab('0x10')](_0x42ba74);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 3d30f9f..f4d458e 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 _0x7aa2=['util','./utils','Local/_attended@transfer','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','data2','membername','type','getUserByInterface','interface','then','name','internal','request','getUserByName','split','catch','error','some','devicestatechange','state','INUSE','device','voice','now','agent','exitAt','duration','diffTime','enterAt','agentcomplete','isNil','assign','queue','channel','data3','data1','source','lodash'];(function(_0xc0d9bc,_0x2bd6be){var _0x32ff73=function(_0x28c592){while(--_0x28c592){_0xc0d9bc['push'](_0xc0d9bc['shift']());}};_0x32ff73(++_0x2bd6be);}(_0x7aa2,0xd1));var _0x27aa=function(_0x32fe22,_0x5287d6){_0x32fe22=_0x32fe22-0x0;var _0x319ba7=_0x7aa2[_0x32fe22];return _0x319ba7;};'use strict';var _=require(_0x27aa('0x0'));var util=require(_0x27aa('0x1'));var utils=require(_0x27aa('0x2'));var members={};var exclude=[_0x27aa('0x3'),_0x27aa('0x4')];function writeDB(_0x33e553){utils[_0x27aa('0x5')](util[_0x27aa('0x6')](_0x27aa('0x7'),_0x33e553[_0x27aa('0x8')],_0x33e553['interface'],_0x33e553['channel'],_0x33e553[_0x27aa('0x9')],_0x33e553[_0x27aa('0xa')],_0x33e553[_0x27aa('0xb')]));if(_0x33e553['interface']){utils[_0x27aa('0xc')](_0x33e553[_0x27aa('0xd')])[_0x27aa('0xe')](function(_0x987280){if(_0x987280){_0x33e553[_0x27aa('0xa')]=_0x987280[_0x27aa('0xf')];_0x33e553[_0x27aa('0x10')]=_0x987280[_0x27aa('0x10')];utils[_0x27aa('0x11')]('CreateMemberReport',_0x33e553);}else{utils[_0x27aa('0x12')](_0x33e553[_0x27aa('0xd')][_0x27aa('0x13')]('/')[0x1])[_0x27aa('0xe')](function(_0x25bbc8){if(_0x25bbc8){_0x33e553[_0x27aa('0xa')]=_0x25bbc8[_0x27aa('0xf')];_0x33e553[_0x27aa('0x10')]=_0x25bbc8[_0x27aa('0x10')];utils[_0x27aa('0x11')]('CreateMemberReport',_0x33e553);}});}})[_0x27aa('0x14')](function(_0x51c831){utils[_0x27aa('0x15')](_0x51c831);});}delete members[_0x33e553[_0x27aa('0xd')]];}function startsWith(_0x23c884,_0x2b5196){return _[_0x27aa('0x16')](_0x23c884,function(_0x43921d){return _['startsWith'](_0x2b5196,_0x43921d);});}exports[_0x27aa('0x17')]=function(_0x26eae7){switch(_0x26eae7[_0x27aa('0x18')]){case _0x27aa('0x19'):case'BUSY':if(!startsWith(exclude,_0x26eae7['device'])){members[_0x26eae7[_0x27aa('0x1a')]]={'channel':_0x27aa('0x1b'),'interface':_0x26eae7[_0x27aa('0x1a')],'type':'TALKING','enterAt':utils[_0x27aa('0x1c')](),'role':_0x27aa('0x1d')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x26eae7[_0x27aa('0x1a')]])){members[_0x26eae7[_0x27aa('0x1a')]][_0x27aa('0x1e')]=utils[_0x27aa('0x1c')]();members[_0x26eae7[_0x27aa('0x1a')]][_0x27aa('0x1f')]=utils[_0x27aa('0x20')](members[_0x26eae7['device']][_0x27aa('0x1e')],members[_0x26eae7[_0x27aa('0x1a')]][_0x27aa('0x21')]);if(members[_0x26eae7[_0x27aa('0x1a')]][_0x27aa('0x8')]){writeDB(members[_0x26eae7['device']]);}}default:break;}};exports[_0x27aa('0x22')]=function(_0x3b6e70){if(!_[_0x27aa('0x23')](members[_0x3b6e70[_0x27aa('0xd')]])){members[_0x3b6e70[_0x27aa('0xd')]]=_[_0x27aa('0x24')](members[_0x3b6e70[_0x27aa('0xd')]],{'data4':_0x3b6e70[_0x27aa('0x25')],'uniqueid':_0x3b6e70[_0x27aa('0x8')]});}};exports['cdr']=function(_0x1d97f3){if(_0x1d97f3[_0x27aa('0x26')]){var _0x10f61a=_0x1d97f3['channel'][_0x27aa('0x13')]('-')[0x0];if(!_['isNil'](members[_0x10f61a])){members[_0x10f61a]=_['assign'](members[_0x10f61a],{'data1':members[_0x10f61a]['data1']||_0x1d97f3[_0x27aa('0xb')],'data2':members[_0x10f61a][_0x27aa('0x9')]||_0x1d97f3['source'],'data3':members[_0x10f61a][_0x27aa('0x27')]||_0x1d97f3['destination'],'uniqueid':members[_0x10f61a]['uniqueid']||_0x1d97f3['uniqueid']});if(members[_0x10f61a][_0x27aa('0x1e')]){writeDB(members[_0x10f61a]);}}}if(_0x1d97f3['destinationchannel']){var _0x173dcd=_0x1d97f3['destinationchannel'][_0x27aa('0x13')]('-')[0x0];if(!_[_0x27aa('0x23')](members[_0x173dcd])){members[_0x173dcd]=_[_0x27aa('0x24')](members[_0x173dcd],{'data1':members[_0x173dcd][_0x27aa('0x28')]||_0x1d97f3['type'],'data2':members[_0x173dcd][_0x27aa('0x9')]||_0x1d97f3[_0x27aa('0x29')],'data3':members[_0x173dcd][_0x27aa('0x27')]||_0x1d97f3['destination'],'uniqueid':members[_0x173dcd]['uniqueid']||_0x1d97f3[_0x27aa('0x8')]});if(members[_0x173dcd][_0x27aa('0x1e')]){writeDB(members[_0x173dcd]);}}}}; \ No newline at end of file +var _0xa44c=['name','catch','error','some','devicestatechange','state','device','TALKING','now','agent','isNil','duration','diffTime','enterAt','assign','queue','cdr','data1','source','data3','destination','destinationchannel','exitAt','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split'];(function(_0x2c9dc2,_0x5a395a){var _0x10c3d3=function(_0x2e0a39){while(--_0x2e0a39){_0x2c9dc2['push'](_0x2c9dc2['shift']());}};_0x10c3d3(++_0x5a395a);}(_0xa44c,0x14b));var _0xca44=function(_0x47a6ea,_0x3a40eb){_0x47a6ea=_0x47a6ea-0x0;var _0x2f118b=_0xa44c[_0x47a6ea];return _0x2f118b;};'use strict';var _=require(_0xca44('0x0'));var util=require(_0xca44('0x1'));var utils=require(_0xca44('0x2'));var members={};var exclude=[_0xca44('0x3'),_0xca44('0x4')];function writeDB(_0x3b298a){utils[_0xca44('0x5')](util[_0xca44('0x6')](_0xca44('0x7'),_0x3b298a[_0xca44('0x8')],_0x3b298a[_0xca44('0x9')],_0x3b298a[_0xca44('0xa')],_0x3b298a[_0xca44('0xb')],_0x3b298a[_0xca44('0xc')],_0x3b298a[_0xca44('0xd')]));if(_0x3b298a[_0xca44('0x9')]){utils[_0xca44('0xe')](_0x3b298a['interface'])[_0xca44('0xf')](function(_0x11985d){if(_0x11985d){_0x3b298a[_0xca44('0xc')]=_0x11985d['name'];_0x3b298a[_0xca44('0x10')]=_0x11985d[_0xca44('0x10')];utils[_0xca44('0x11')](_0xca44('0x12'),_0x3b298a);}else{utils[_0xca44('0x13')](_0x3b298a[_0xca44('0x9')][_0xca44('0x14')]('/')[0x1])['then'](function(_0xfb7858){if(_0xfb7858){_0x3b298a[_0xca44('0xc')]=_0xfb7858[_0xca44('0x15')];_0x3b298a[_0xca44('0x10')]=_0xfb7858[_0xca44('0x10')];utils['request'](_0xca44('0x12'),_0x3b298a);}});}})[_0xca44('0x16')](function(_0x5add6c){utils[_0xca44('0x17')](_0x5add6c);});}delete members[_0x3b298a['interface']];}function startsWith(_0x471072,_0x1f425c){return _[_0xca44('0x18')](_0x471072,function(_0x3f4c7d){return _['startsWith'](_0x1f425c,_0x3f4c7d);});}exports[_0xca44('0x19')]=function(_0x1d0432){switch(_0x1d0432[_0xca44('0x1a')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x1d0432[_0xca44('0x1b')])){members[_0x1d0432[_0xca44('0x1b')]]={'channel':'voice','interface':_0x1d0432[_0xca44('0x1b')],'type':_0xca44('0x1c'),'enterAt':utils[_0xca44('0x1d')](),'role':_0xca44('0x1e')};}break;case'NOT_INUSE':if(!_[_0xca44('0x1f')](members[_0x1d0432[_0xca44('0x1b')]])){members[_0x1d0432[_0xca44('0x1b')]]['exitAt']=utils[_0xca44('0x1d')]();members[_0x1d0432[_0xca44('0x1b')]][_0xca44('0x20')]=utils[_0xca44('0x21')](members[_0x1d0432[_0xca44('0x1b')]]['exitAt'],members[_0x1d0432['device']][_0xca44('0x22')]);if(members[_0x1d0432[_0xca44('0x1b')]][_0xca44('0x8')]){writeDB(members[_0x1d0432[_0xca44('0x1b')]]);}}default:break;}};exports['agentcomplete']=function(_0x119831){if(!_[_0xca44('0x1f')](members[_0x119831[_0xca44('0x9')]])){members[_0x119831[_0xca44('0x9')]]=_[_0xca44('0x23')](members[_0x119831[_0xca44('0x9')]],{'data4':_0x119831[_0xca44('0x24')],'uniqueid':_0x119831[_0xca44('0x8')]});}};exports[_0xca44('0x25')]=function(_0x352d19){if(_0x352d19[_0xca44('0xa')]){var _0x3e8f3a=_0x352d19[_0xca44('0xa')][_0xca44('0x14')]('-')[0x0];if(!_[_0xca44('0x1f')](members[_0x3e8f3a])){members[_0x3e8f3a]=_[_0xca44('0x23')](members[_0x3e8f3a],{'data1':members[_0x3e8f3a][_0xca44('0x26')]||_0x352d19['type'],'data2':members[_0x3e8f3a][_0xca44('0xb')]||_0x352d19[_0xca44('0x27')],'data3':members[_0x3e8f3a][_0xca44('0x28')]||_0x352d19[_0xca44('0x29')],'uniqueid':members[_0x3e8f3a][_0xca44('0x8')]||_0x352d19['uniqueid']});if(members[_0x3e8f3a]['exitAt']){writeDB(members[_0x3e8f3a]);}}}if(_0x352d19[_0xca44('0x2a')]){var _0x33bd64=_0x352d19[_0xca44('0x2a')][_0xca44('0x14')]('-')[0x0];if(!_[_0xca44('0x1f')](members[_0x33bd64])){members[_0x33bd64]=_[_0xca44('0x23')](members[_0x33bd64],{'data1':members[_0x33bd64][_0xca44('0x26')]||_0x352d19[_0xca44('0xd')],'data2':members[_0x33bd64]['data2']||_0x352d19[_0xca44('0x27')],'data3':members[_0x33bd64][_0xca44('0x28')]||_0x352d19['destination'],'uniqueid':members[_0x33bd64]['uniqueid']||_0x352d19[_0xca44('0x8')]});if(members[_0x33bd64][_0xca44('0x2b')]){writeDB(members[_0x33bd64]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 95bc764..eeb7725 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 _0xd7a3=['queueposition','EXITWITHKEY','ABANDONED','queuecallerleave','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','accountcode','destaccountcode','agentcomplete','assigned','membername','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','ATTENDEDTRANSFER','clone','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','mohtime','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','error','musiconholdstart','musiconholdstop','musiconholdstartAt','lodash','util','./utils','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','lastAssignedTo','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','position','now','hangup','isNil','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','queuecallerenterreason','varset','variable','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','value','toUpperCase'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xd7a3,0x1bf));var _0x3d7a=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xd7a3[_0x59c301];return _0x3866b9;};'use strict';var _=require(_0x3d7a('0x0'));var util=require(_0x3d7a('0x1'));var utils=require(_0x3d7a('0x2'));var queues={};function writeDB(_0x5b9760){utils['info'](util[_0x3d7a('0x3')](_0x3d7a('0x4'),_0x5b9760[_0x3d7a('0x5')],_0x5b9760[_0x3d7a('0x6')],_0x5b9760[_0x3d7a('0x7')],_0x5b9760[_0x3d7a('0x8')],_0x5b9760['calleridnum'],_0x5b9760['accountcode'],_0x5b9760[_0x3d7a('0x9')]));if(_0x5b9760[_0x3d7a('0x7')]){utils[_0x3d7a('0xa')](_0x5b9760[_0x3d7a('0x7')])[_0x3d7a('0xb')](function(_0x3f350d){if(_0x3f350d){_0x5b9760[_0x3d7a('0xc')]=_0x3f350d[_0x3d7a('0xc')];}utils[_0x3d7a('0xd')]('CreateVoiceQueueReport',_0x5b9760);});}else{utils[_0x3d7a('0xd')](_0x3d7a('0xe'),_0x5b9760);}if(_0x5b9760[_0x3d7a('0xf')]){delete queues[_0x5b9760[_0x3d7a('0xf')]];}else{delete queues[_0x5b9760[_0x3d7a('0x5')]];}}exports[_0x3d7a('0x10')]=function(_0x1f2a19){queues[_0x1f2a19[_0x3d7a('0x5')]]=_[_0x3d7a('0x11')](_0x1f2a19,{'originalposition':_0x1f2a19[_0x3d7a('0x12')],'queuecallerjoinAt':utils[_0x3d7a('0x13')](),'mohtime':0x0});};exports[_0x3d7a('0x14')]=function(_0x14ec4a){if(!_[_0x3d7a('0x15')](queues[_0x14ec4a[_0x3d7a('0x5')]])){if(queues[_0x14ec4a[_0x3d7a('0x5')]]['queuecallerleaveAt']){if(!queues[_0x14ec4a['uniqueid']]['queuecallerabandon']&&!queues[_0x14ec4a['uniqueid']][_0x3d7a('0x16')]){queues[_0x14ec4a['uniqueid']]['queuecallercomplete']=!![];queues[_0x14ec4a[_0x3d7a('0x5')]][_0x3d7a('0x17')]=utils[_0x3d7a('0x13')]();queues[_0x14ec4a['uniqueid']][_0x3d7a('0x9')]=_0x3d7a('0x18');}writeDB(queues[_0x14ec4a[_0x3d7a('0x5')]]);}else{if(queues[_0x14ec4a[_0x3d7a('0x5')]][_0x3d7a('0xf')]){queues[queues[_0x14ec4a['uniqueid']][_0x3d7a('0xf')]]=queues[_0x14ec4a[_0x3d7a('0x5')]];queues[queues[_0x14ec4a['uniqueid']][_0x3d7a('0xf')]][_0x3d7a('0x19')]=0x2;delete queues[_0x14ec4a[_0x3d7a('0x5')]];}}}};exports[_0x3d7a('0x1a')]=function(_0x591e32){if(!_['isNil'](_0x591e32[_0x3d7a('0x1b')]['queuestatus'])&&_0x591e32['value']['toUpperCase']()!=='CONTINUE'){if(!_[_0x3d7a('0x15')](queues[_0x591e32[_0x3d7a('0x5')]])){queues[_0x591e32[_0x3d7a('0x5')]][_0x3d7a('0x1c')]=![];queues[_0x591e32[_0x3d7a('0x5')]][_0x3d7a('0x1d')]=null;queues[_0x591e32[_0x3d7a('0x5')]]['queuecallerexit']=!![];queues[_0x591e32[_0x3d7a('0x5')]][_0x3d7a('0x1e')]=utils[_0x3d7a('0x13')]();queues[_0x591e32[_0x3d7a('0x5')]][_0x3d7a('0x9')]=_0x591e32[_0x3d7a('0x1f')][_0x3d7a('0x20')]();writeDB(queues[_0x591e32[_0x3d7a('0x5')]]);}}else if(!_[_0x3d7a('0x15')](_0x591e32[_0x3d7a('0x1b')][_0x3d7a('0x21')])){if(!_[_0x3d7a('0x15')](queues[_0x591e32[_0x3d7a('0x5')]])&&!queues[_0x591e32[_0x3d7a('0x5')]][_0x3d7a('0x1c')]){queues[_0x591e32[_0x3d7a('0x5')]]['queuecallerabandon']=![];queues[_0x591e32[_0x3d7a('0x5')]]['queuecallerabandonAt']=null;queues[_0x591e32[_0x3d7a('0x5')]][_0x3d7a('0x16')]=!![];queues[_0x591e32[_0x3d7a('0x5')]][_0x3d7a('0x1e')]=utils[_0x3d7a('0x13')]();queues[_0x591e32[_0x3d7a('0x5')]][_0x3d7a('0x9')]=_0x3d7a('0x22');}}};exports['queuecallerabandon']=function(_0x311fb2){if(!_[_0x3d7a('0x15')](queues[_0x311fb2[_0x3d7a('0x5')]])){queues[_0x311fb2[_0x3d7a('0x5')]][_0x3d7a('0x16')]=![];queues[_0x311fb2[_0x3d7a('0x5')]][_0x3d7a('0x1e')]=null;queues[_0x311fb2[_0x3d7a('0x5')]][_0x3d7a('0x1c')]=!![];queues[_0x311fb2['uniqueid']][_0x3d7a('0x1d')]=utils['now']();queues[_0x311fb2['uniqueid']]['queuecallerexitreason']=_0x3d7a('0x23');}};exports['queuecallerleave']=function(_0x5305ba){if(!_[_0x3d7a('0x15')](queues[_0x5305ba[_0x3d7a('0x5')]])){queues[_0x5305ba[_0x3d7a('0x5')]][_0x3d7a('0x24')]=!![];queues[_0x5305ba[_0x3d7a('0x5')]][_0x3d7a('0x25')]=utils[_0x3d7a('0x13')]();queues[_0x5305ba['uniqueid']][_0x3d7a('0x26')]=utils[_0x3d7a('0x27')](queues[_0x5305ba[_0x3d7a('0x5')]]['queuecallerleaveAt'],queues[_0x5305ba[_0x3d7a('0x5')]][_0x3d7a('0x28')]);queues[_0x5305ba[_0x3d7a('0x5')]][_0x3d7a('0x12')]=_0x5305ba[_0x3d7a('0x12')];queues[_0x5305ba[_0x3d7a('0x5')]][_0x3d7a('0x29')]=_0x5305ba[_0x3d7a('0x29')];queues[_0x5305ba['uniqueid']][_0x3d7a('0x2a')]=_0x5305ba[_0x3d7a('0x2a')];queues[_0x5305ba[_0x3d7a('0x5')]][_0x3d7a('0x2b')]=_0x5305ba['connectedlinename'];}};exports['agentconnect']=function(_0x5a79e5){if(!_[_0x3d7a('0x15')](queues[_0x5a79e5['uniqueid']])){queues[_0x5a79e5['uniqueid']][_0x3d7a('0x1c')]=![];queues[_0x5a79e5[_0x3d7a('0x5')]][_0x3d7a('0x1c')]=![];queues[_0x5a79e5[_0x3d7a('0x5')]][_0x3d7a('0x1d')]=null;queues[_0x5a79e5[_0x3d7a('0x5')]]['queuecallerexit']=![];queues[_0x5a79e5[_0x3d7a('0x5')]]['queuecallerexitreason']=null;queues[_0x5a79e5[_0x3d7a('0x5')]][_0x3d7a('0x1e')]=null;queues[_0x5a79e5[_0x3d7a('0x5')]]['assigned']=!![];queues[_0x5a79e5[_0x3d7a('0x5')]][_0x3d7a('0x2c')]=_0x5a79e5[_0x3d7a('0x2d')];queues[_0x5a79e5[_0x3d7a('0x5')]][_0x3d7a('0x8')]=_0x5a79e5['membername'];}};exports[_0x3d7a('0x2e')]=function(_0x4fd4ec){if(!_[_0x3d7a('0x15')](queues[_0x4fd4ec[_0x3d7a('0x5')]])){if(queues[_0x4fd4ec['uniqueid']][_0x3d7a('0x25')]){queues[_0x4fd4ec[_0x3d7a('0x5')]][_0x3d7a('0x1c')]=![];queues[_0x4fd4ec[_0x3d7a('0x5')]][_0x3d7a('0x1c')]=![];queues[_0x4fd4ec['uniqueid']][_0x3d7a('0x1d')]=null;queues[_0x4fd4ec[_0x3d7a('0x5')]]['queuecallerexit']=![];queues[_0x4fd4ec[_0x3d7a('0x5')]][_0x3d7a('0x1e')]=null;queues[_0x4fd4ec['uniqueid']][_0x3d7a('0x2f')]=!![];queues[_0x4fd4ec[_0x3d7a('0x5')]][_0x3d7a('0x8')]=_0x4fd4ec[_0x3d7a('0x30')];queues[_0x4fd4ec[_0x3d7a('0x5')]][_0x3d7a('0x31')]=!![];queues[_0x4fd4ec[_0x3d7a('0x5')]][_0x3d7a('0x17')]=utils[_0x3d7a('0x13')]();if(_0x4fd4ec[_0x3d7a('0x32')]==_0x3d7a('0x33')){if(!queues[_0x4fd4ec[_0x3d7a('0x5')]][_0x3d7a('0x33')]){queues[_0x4fd4ec[_0x3d7a('0x5')]][_0x3d7a('0x9')]=_0x3d7a('0x34');}}else{queues[_0x4fd4ec[_0x3d7a('0x5')]][_0x3d7a('0x9')]=_0x3d7a('0x35')+_0x4fd4ec['reason'][_0x3d7a('0x20')]();}writeDB(queues[_0x4fd4ec[_0x3d7a('0x5')]]);}}};exports[_0x3d7a('0x36')]=function(_0x260445){if(!_[_0x3d7a('0x15')](queues[_0x260445[_0x3d7a('0x37')]])){queues[_0x260445[_0x3d7a('0x37')]]['transfer']=!![];queues[_0x260445[_0x3d7a('0x37')]][_0x3d7a('0x38')]=_0x3d7a('0x39');queues[_0x260445[_0x3d7a('0x37')]][_0x3d7a('0x3a')]=_0x260445['extension'];queues[_0x260445[_0x3d7a('0x37')]][_0x3d7a('0x3b')]=_0x260445[_0x3d7a('0x37')];queues[_0x260445[_0x3d7a('0x37')]][_0x3d7a('0x9')]=_0x3d7a('0x3c');}};exports[_0x3d7a('0x3d')]=function(_0x240cbd){try{if(_0x240cbd[_0x3d7a('0x3e')]==_0x240cbd[_0x3d7a('0x3f')]){if(!_[_0x3d7a('0x15')](queues[_0x240cbd['secondtransfererlinkedid']])){queues[_0x240cbd[_0x3d7a('0x40')]][_0x3d7a('0x33')]=!![];queues[_0x240cbd[_0x3d7a('0x40')]][_0x3d7a('0x38')]=_0x3d7a('0x41');queues[_0x240cbd['secondtransfererlinkedid']][_0x3d7a('0x3a')]=_0x240cbd['origtransfererexten'];queues[_0x240cbd['secondtransfererlinkedid']][_0x3d7a('0x3b')]=_0x240cbd[_0x3d7a('0x3e')];queues[_0x240cbd['secondtransfererlinkedid']][_0x3d7a('0x9')]=_0x3d7a('0x42');}if(!_['isNil'](queues[_0x240cbd[_0x3d7a('0x3f')]])){if(_0x240cbd['transfereelinkedid']&&queues[_0x240cbd['transfereelinkedid']]){queues[_0x240cbd['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x240cbd[_0x3d7a('0x37')]]=_[_0x3d7a('0x43')](queues[_0x240cbd[_0x3d7a('0x44')]]);queues[_0x240cbd[_0x3d7a('0x37')]]['transfereduniqueid']=_0x240cbd[_0x3d7a('0x45')];queues[_0x240cbd['transfereeuniqueid']][_0x3d7a('0x19')]=0x2;queues[_0x240cbd[_0x3d7a('0x37')]][_0x3d7a('0x46')]=queues[_0x240cbd[_0x3d7a('0x40')]][_0x3d7a('0x46')];queues[_0x240cbd[_0x3d7a('0x37')]][_0x3d7a('0x47')]=queues[_0x240cbd[_0x3d7a('0x40')]][_0x3d7a('0x47')];queues[_0x240cbd['transfereeuniqueid']]['queuecallerjoinAt']=utils['now']();queues[_0x240cbd[_0x3d7a('0x37')]][_0x3d7a('0x25')]=utils[_0x3d7a('0x13')]();queues[_0x240cbd[_0x3d7a('0x37')]][_0x3d7a('0x26')]=0x0;queues[_0x240cbd['transfereeuniqueid']][_0x3d7a('0x48')]=0x0;}else{queues[_0x240cbd[_0x3d7a('0x3f')]]['transfereduniqueid']=_0x240cbd['secondtransfererlinkedid'];}}}else if(_0x240cbd[_0x3d7a('0x49')]==_0x240cbd['secondtransfererlinkedid']){if(!_[_0x3d7a('0x15')](queues[_0x240cbd['origtransfererlinkedid']])){queues[_0x240cbd[_0x3d7a('0x3f')]][_0x3d7a('0x33')]=!![];queues[_0x240cbd['origtransfererlinkedid']][_0x3d7a('0x38')]=_0x3d7a('0x41');queues[_0x240cbd['origtransfererlinkedid']][_0x3d7a('0x3a')]=_0x240cbd[_0x3d7a('0x4a')];queues[_0x240cbd[_0x3d7a('0x3f')]][_0x3d7a('0x3b')]=_0x240cbd['secondtransfereruniqueid'];queues[_0x240cbd[_0x3d7a('0x3f')]][_0x3d7a('0x9')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x240cbd[_0x3d7a('0x40')]])){if(_0x240cbd[_0x3d7a('0x4b')]&&queues[_0x240cbd[_0x3d7a('0x4b')]]){queues[_0x240cbd[_0x3d7a('0x4b')]]['queuecallerenterreason']=0x1;queues[_0x240cbd[_0x3d7a('0x45')]]=_[_0x3d7a('0x43')](queues[_0x240cbd['transfertargetlinkedid']]);queues[_0x240cbd[_0x3d7a('0x45')]]['transfereduniqueid']=_0x240cbd[_0x3d7a('0x45')];queues[_0x240cbd[_0x3d7a('0x45')]][_0x3d7a('0x19')]=0x2;queues[_0x240cbd[_0x3d7a('0x45')]][_0x3d7a('0x46')]=queues[_0x240cbd[_0x3d7a('0x3f')]]['calleridnum'];queues[_0x240cbd[_0x3d7a('0x45')]][_0x3d7a('0x47')]=queues[_0x240cbd[_0x3d7a('0x3f')]]['calleridname'];queues[_0x240cbd['transfertargetuniqueid']]['queuecallerjoinAt']=utils['now']();queues[_0x240cbd[_0x3d7a('0x45')]]['queuecallerleaveAt']=utils[_0x3d7a('0x13')]();queues[_0x240cbd[_0x3d7a('0x45')]]['holdtime']=0x0;queues[_0x240cbd[_0x3d7a('0x45')]]['mohtime']=0x0;}else{queues[_0x240cbd[_0x3d7a('0x40')]][_0x3d7a('0xf')]=_0x240cbd[_0x3d7a('0x3f')];}}}}catch(_0x1cff11){utils[_0x3d7a('0x4c')](_0x1cff11['stack']);}};exports[_0x3d7a('0x4d')]=function(_0x37a619){if(!_['isNil'](queues[_0x37a619[_0x3d7a('0x5')]])){queues[_0x37a619[_0x3d7a('0x5')]]['musiconholdstartAt']=utils[_0x3d7a('0x13')]();}};exports[_0x3d7a('0x4e')]=function(_0x5a4f7a){if(!_['isNil'](queues[_0x5a4f7a[_0x3d7a('0x5')]])){if(!_[_0x3d7a('0x15')](queues[_0x5a4f7a[_0x3d7a('0x5')]]['musiconholdstartAt'])){queues[_0x5a4f7a[_0x3d7a('0x5')]][_0x3d7a('0x48')]+=utils['diffTime'](utils['now'](),queues[_0x5a4f7a['uniqueid']][_0x3d7a('0x4f')]);delete queues[_0x5a4f7a[_0x3d7a('0x5')]]['musiconholdstartAt'];}}}; \ No newline at end of file +var _0xb6e5=['calleridname','mohtime','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','musiconholdstart','musiconholdstartAt','musiconholdstop','lodash','util','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','CreateVoiceQueueReport','request','transfereduniqueid','uniqueid','queuecallerjoin','assign','position','now','hangup','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','queuecallerenterreason','variable','queuestatus','value','CONTINUE','isNil','queuecallerabandonAt','queuecallerexitAt','toUpperCase','EXITWITHKEY','ABANDONED','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','membername','agentcomplete','assigned','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','transferexten','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid'];(function(_0x2b5334,_0x577a5b){var _0x403c90=function(_0x4860d0){while(--_0x4860d0){_0x2b5334['push'](_0x2b5334['shift']());}};_0x403c90(++_0x577a5b);}(_0xb6e5,0x134));var _0x5b6e=function(_0x5f4c13,_0x557253){_0x5f4c13=_0x5f4c13-0x0;var _0x537514=_0xb6e5[_0x5f4c13];return _0x537514;};'use strict';var _=require(_0x5b6e('0x0'));var util=require(_0x5b6e('0x1'));var utils=require(_0x5b6e('0x2'));var queues={};function writeDB(_0x5d62e2){utils[_0x5b6e('0x3')](util[_0x5b6e('0x4')](_0x5b6e('0x5'),_0x5d62e2['uniqueid'],_0x5d62e2['channel'],_0x5d62e2[_0x5b6e('0x6')],_0x5d62e2[_0x5b6e('0x7')],_0x5d62e2[_0x5b6e('0x8')],_0x5d62e2[_0x5b6e('0x9')],_0x5d62e2[_0x5b6e('0xa')]));if(_0x5d62e2[_0x5b6e('0x6')]){utils[_0x5b6e('0xb')](_0x5d62e2['queue'])['then'](function(_0x4995f8){if(_0x4995f8){_0x5d62e2['type']=_0x4995f8[_0x5b6e('0xc')];}utils['request'](_0x5b6e('0xd'),_0x5d62e2);});}else{utils[_0x5b6e('0xe')](_0x5b6e('0xd'),_0x5d62e2);}if(_0x5d62e2[_0x5b6e('0xf')]){delete queues[_0x5d62e2[_0x5b6e('0xf')]];}else{delete queues[_0x5d62e2[_0x5b6e('0x10')]];}}exports[_0x5b6e('0x11')]=function(_0x469186){queues[_0x469186[_0x5b6e('0x10')]]=_[_0x5b6e('0x12')](_0x469186,{'originalposition':_0x469186[_0x5b6e('0x13')],'queuecallerjoinAt':utils[_0x5b6e('0x14')](),'mohtime':0x0});};exports[_0x5b6e('0x15')]=function(_0x1a8ddd){if(!_['isNil'](queues[_0x1a8ddd['uniqueid']])){if(queues[_0x1a8ddd[_0x5b6e('0x10')]][_0x5b6e('0x16')]){if(!queues[_0x1a8ddd[_0x5b6e('0x10')]][_0x5b6e('0x17')]&&!queues[_0x1a8ddd[_0x5b6e('0x10')]][_0x5b6e('0x18')]){queues[_0x1a8ddd[_0x5b6e('0x10')]][_0x5b6e('0x19')]=!![];queues[_0x1a8ddd[_0x5b6e('0x10')]]['queuecallercompleteAt']=utils[_0x5b6e('0x14')]();queues[_0x1a8ddd['uniqueid']][_0x5b6e('0xa')]=_0x5b6e('0x1a');}writeDB(queues[_0x1a8ddd[_0x5b6e('0x10')]]);}else{if(queues[_0x1a8ddd[_0x5b6e('0x10')]][_0x5b6e('0xf')]){queues[queues[_0x1a8ddd[_0x5b6e('0x10')]]['transfereduniqueid']]=queues[_0x1a8ddd[_0x5b6e('0x10')]];queues[queues[_0x1a8ddd[_0x5b6e('0x10')]]['transfereduniqueid']][_0x5b6e('0x1b')]=0x2;delete queues[_0x1a8ddd[_0x5b6e('0x10')]];}}}};exports['varset']=function(_0x5c63d3){if(!_['isNil'](_0x5c63d3[_0x5b6e('0x1c')][_0x5b6e('0x1d')])&&_0x5c63d3[_0x5b6e('0x1e')]['toUpperCase']()!==_0x5b6e('0x1f')){if(!_[_0x5b6e('0x20')](queues[_0x5c63d3[_0x5b6e('0x10')]])){queues[_0x5c63d3[_0x5b6e('0x10')]][_0x5b6e('0x17')]=![];queues[_0x5c63d3['uniqueid']][_0x5b6e('0x21')]=null;queues[_0x5c63d3['uniqueid']][_0x5b6e('0x18')]=!![];queues[_0x5c63d3[_0x5b6e('0x10')]][_0x5b6e('0x22')]=utils[_0x5b6e('0x14')]();queues[_0x5c63d3['uniqueid']][_0x5b6e('0xa')]=_0x5c63d3['value'][_0x5b6e('0x23')]();writeDB(queues[_0x5c63d3[_0x5b6e('0x10')]]);}}else if(!_[_0x5b6e('0x20')](_0x5c63d3[_0x5b6e('0x1c')]['queueposition'])){if(!_[_0x5b6e('0x20')](queues[_0x5c63d3[_0x5b6e('0x10')]])&&!queues[_0x5c63d3[_0x5b6e('0x10')]][_0x5b6e('0x17')]){queues[_0x5c63d3['uniqueid']][_0x5b6e('0x17')]=![];queues[_0x5c63d3['uniqueid']][_0x5b6e('0x21')]=null;queues[_0x5c63d3[_0x5b6e('0x10')]][_0x5b6e('0x18')]=!![];queues[_0x5c63d3[_0x5b6e('0x10')]][_0x5b6e('0x22')]=utils['now']();queues[_0x5c63d3[_0x5b6e('0x10')]]['queuecallerexitreason']=_0x5b6e('0x24');}}};exports['queuecallerabandon']=function(_0x4ee276){if(!_[_0x5b6e('0x20')](queues[_0x4ee276[_0x5b6e('0x10')]])){queues[_0x4ee276[_0x5b6e('0x10')]][_0x5b6e('0x18')]=![];queues[_0x4ee276[_0x5b6e('0x10')]][_0x5b6e('0x22')]=null;queues[_0x4ee276[_0x5b6e('0x10')]][_0x5b6e('0x17')]=!![];queues[_0x4ee276['uniqueid']][_0x5b6e('0x21')]=utils[_0x5b6e('0x14')]();queues[_0x4ee276[_0x5b6e('0x10')]]['queuecallerexitreason']=_0x5b6e('0x25');}};exports[_0x5b6e('0x26')]=function(_0x18dd91){if(!_[_0x5b6e('0x20')](queues[_0x18dd91['uniqueid']])){queues[_0x18dd91[_0x5b6e('0x10')]][_0x5b6e('0x26')]=!![];queues[_0x18dd91[_0x5b6e('0x10')]][_0x5b6e('0x16')]=utils[_0x5b6e('0x14')]();queues[_0x18dd91[_0x5b6e('0x10')]][_0x5b6e('0x27')]=utils[_0x5b6e('0x28')](queues[_0x18dd91[_0x5b6e('0x10')]]['queuecallerleaveAt'],queues[_0x18dd91[_0x5b6e('0x10')]][_0x5b6e('0x29')]);queues[_0x18dd91['uniqueid']]['position']=_0x18dd91[_0x5b6e('0x13')];queues[_0x18dd91[_0x5b6e('0x10')]][_0x5b6e('0x2a')]=_0x18dd91[_0x5b6e('0x2a')];queues[_0x18dd91['uniqueid']][_0x5b6e('0x2b')]=_0x18dd91[_0x5b6e('0x2b')];queues[_0x18dd91[_0x5b6e('0x10')]][_0x5b6e('0x2c')]=_0x18dd91[_0x5b6e('0x2c')];}};exports['agentconnect']=function(_0x24766c){if(!_[_0x5b6e('0x20')](queues[_0x24766c['uniqueid']])){queues[_0x24766c['uniqueid']][_0x5b6e('0x17')]=![];queues[_0x24766c[_0x5b6e('0x10')]][_0x5b6e('0x17')]=![];queues[_0x24766c['uniqueid']][_0x5b6e('0x21')]=null;queues[_0x24766c[_0x5b6e('0x10')]][_0x5b6e('0x18')]=![];queues[_0x24766c[_0x5b6e('0x10')]][_0x5b6e('0xa')]=null;queues[_0x24766c[_0x5b6e('0x10')]][_0x5b6e('0x22')]=null;queues[_0x24766c[_0x5b6e('0x10')]]['assigned']=!![];queues[_0x24766c[_0x5b6e('0x10')]]['accountcode']=_0x24766c['destaccountcode'];queues[_0x24766c['uniqueid']][_0x5b6e('0x7')]=_0x24766c[_0x5b6e('0x2d')];}};exports[_0x5b6e('0x2e')]=function(_0x48e825){if(!_[_0x5b6e('0x20')](queues[_0x48e825[_0x5b6e('0x10')]])){if(queues[_0x48e825[_0x5b6e('0x10')]][_0x5b6e('0x16')]){queues[_0x48e825[_0x5b6e('0x10')]]['queuecallerabandon']=![];queues[_0x48e825[_0x5b6e('0x10')]][_0x5b6e('0x17')]=![];queues[_0x48e825[_0x5b6e('0x10')]][_0x5b6e('0x21')]=null;queues[_0x48e825[_0x5b6e('0x10')]]['queuecallerexit']=![];queues[_0x48e825['uniqueid']]['queuecallerexitAt']=null;queues[_0x48e825[_0x5b6e('0x10')]][_0x5b6e('0x2f')]=!![];queues[_0x48e825[_0x5b6e('0x10')]]['lastAssignedTo']=_0x48e825[_0x5b6e('0x2d')];queues[_0x48e825[_0x5b6e('0x10')]][_0x5b6e('0x19')]=!![];queues[_0x48e825[_0x5b6e('0x10')]]['queuecallercompleteAt']=utils[_0x5b6e('0x14')]();if(_0x48e825[_0x5b6e('0x30')]==_0x5b6e('0x31')){if(!queues[_0x48e825[_0x5b6e('0x10')]][_0x5b6e('0x31')]){queues[_0x48e825[_0x5b6e('0x10')]]['queuecallerexitreason']=_0x5b6e('0x32');}}else{queues[_0x48e825[_0x5b6e('0x10')]][_0x5b6e('0xa')]=_0x5b6e('0x33')+_0x48e825[_0x5b6e('0x30')][_0x5b6e('0x23')]();}writeDB(queues[_0x48e825['uniqueid']]);}}};exports[_0x5b6e('0x34')]=function(_0x17c99e){if(!_[_0x5b6e('0x20')](queues[_0x17c99e[_0x5b6e('0x35')]])){queues[_0x17c99e[_0x5b6e('0x35')]][_0x5b6e('0x31')]=!![];queues[_0x17c99e[_0x5b6e('0x35')]][_0x5b6e('0x36')]=_0x5b6e('0x37');queues[_0x17c99e[_0x5b6e('0x35')]]['transferexten']=_0x17c99e[_0x5b6e('0x38')];queues[_0x17c99e['transfereeuniqueid']][_0x5b6e('0x39')]=_0x17c99e[_0x5b6e('0x35')];queues[_0x17c99e[_0x5b6e('0x35')]]['queuecallerexitreason']='BLINDTRANSFER';}};exports['attendedtransfer']=function(_0x12e71c){try{if(_0x12e71c[_0x5b6e('0x3a')]==_0x12e71c[_0x5b6e('0x3b')]){if(!_[_0x5b6e('0x20')](queues[_0x12e71c['secondtransfererlinkedid']])){queues[_0x12e71c[_0x5b6e('0x3c')]]['transfer']=!![];queues[_0x12e71c[_0x5b6e('0x3c')]][_0x5b6e('0x36')]=_0x5b6e('0x3d');queues[_0x12e71c[_0x5b6e('0x3c')]][_0x5b6e('0x3e')]=_0x12e71c[_0x5b6e('0x3f')];queues[_0x12e71c['secondtransfererlinkedid']][_0x5b6e('0x39')]=_0x12e71c[_0x5b6e('0x3a')];queues[_0x12e71c[_0x5b6e('0x3c')]][_0x5b6e('0xa')]=_0x5b6e('0x40');}if(!_[_0x5b6e('0x20')](queues[_0x12e71c['origtransfererlinkedid']])){if(_0x12e71c[_0x5b6e('0x41')]&&queues[_0x12e71c[_0x5b6e('0x41')]]){queues[_0x12e71c[_0x5b6e('0x41')]][_0x5b6e('0x1b')]=0x1;queues[_0x12e71c[_0x5b6e('0x35')]]=_['clone'](queues[_0x12e71c['transfereelinkedid']]);queues[_0x12e71c[_0x5b6e('0x35')]][_0x5b6e('0xf')]=_0x12e71c[_0x5b6e('0x42')];queues[_0x12e71c[_0x5b6e('0x35')]][_0x5b6e('0x1b')]=0x2;queues[_0x12e71c[_0x5b6e('0x35')]][_0x5b6e('0x8')]=queues[_0x12e71c[_0x5b6e('0x3c')]][_0x5b6e('0x8')];queues[_0x12e71c[_0x5b6e('0x35')]][_0x5b6e('0x43')]=queues[_0x12e71c[_0x5b6e('0x3c')]][_0x5b6e('0x43')];queues[_0x12e71c[_0x5b6e('0x35')]][_0x5b6e('0x29')]=utils[_0x5b6e('0x14')]();queues[_0x12e71c[_0x5b6e('0x35')]][_0x5b6e('0x16')]=utils[_0x5b6e('0x14')]();queues[_0x12e71c['transfereeuniqueid']][_0x5b6e('0x27')]=0x0;queues[_0x12e71c[_0x5b6e('0x35')]][_0x5b6e('0x44')]=0x0;}else{queues[_0x12e71c['origtransfererlinkedid']][_0x5b6e('0xf')]=_0x12e71c[_0x5b6e('0x3c')];}}}else if(_0x12e71c[_0x5b6e('0x45')]==_0x12e71c[_0x5b6e('0x3c')]){if(!_[_0x5b6e('0x20')](queues[_0x12e71c['origtransfererlinkedid']])){queues[_0x12e71c[_0x5b6e('0x3b')]][_0x5b6e('0x31')]=!![];queues[_0x12e71c[_0x5b6e('0x3b')]][_0x5b6e('0x36')]=_0x5b6e('0x3d');queues[_0x12e71c[_0x5b6e('0x3b')]]['transferexten']=_0x12e71c[_0x5b6e('0x46')];queues[_0x12e71c[_0x5b6e('0x3b')]]['transferuniqueid']=_0x12e71c[_0x5b6e('0x45')];queues[_0x12e71c[_0x5b6e('0x3b')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x5b6e('0x20')](queues[_0x12e71c[_0x5b6e('0x3c')]])){if(_0x12e71c[_0x5b6e('0x47')]&&queues[_0x12e71c[_0x5b6e('0x47')]]){queues[_0x12e71c[_0x5b6e('0x47')]]['queuecallerenterreason']=0x1;queues[_0x12e71c[_0x5b6e('0x42')]]=_['clone'](queues[_0x12e71c[_0x5b6e('0x47')]]);queues[_0x12e71c[_0x5b6e('0x42')]][_0x5b6e('0xf')]=_0x12e71c[_0x5b6e('0x42')];queues[_0x12e71c[_0x5b6e('0x42')]][_0x5b6e('0x1b')]=0x2;queues[_0x12e71c[_0x5b6e('0x42')]][_0x5b6e('0x8')]=queues[_0x12e71c[_0x5b6e('0x3b')]][_0x5b6e('0x8')];queues[_0x12e71c[_0x5b6e('0x42')]]['calleridname']=queues[_0x12e71c['origtransfererlinkedid']][_0x5b6e('0x43')];queues[_0x12e71c[_0x5b6e('0x42')]][_0x5b6e('0x29')]=utils[_0x5b6e('0x14')]();queues[_0x12e71c[_0x5b6e('0x42')]]['queuecallerleaveAt']=utils['now']();queues[_0x12e71c[_0x5b6e('0x42')]]['holdtime']=0x0;queues[_0x12e71c[_0x5b6e('0x42')]][_0x5b6e('0x44')]=0x0;}else{queues[_0x12e71c[_0x5b6e('0x3c')]][_0x5b6e('0xf')]=_0x12e71c[_0x5b6e('0x3b')];}}}}catch(_0x75f726){utils['error'](_0x75f726['stack']);}};exports[_0x5b6e('0x48')]=function(_0x331aec){if(!_[_0x5b6e('0x20')](queues[_0x331aec['uniqueid']])){queues[_0x331aec[_0x5b6e('0x10')]][_0x5b6e('0x49')]=utils['now']();}};exports[_0x5b6e('0x4a')]=function(_0x599332){if(!_[_0x5b6e('0x20')](queues[_0x599332['uniqueid']])){if(!_[_0x5b6e('0x20')](queues[_0x599332[_0x5b6e('0x10')]][_0x5b6e('0x49')])){queues[_0x599332['uniqueid']][_0x5b6e('0x44')]+=utils[_0x5b6e('0x28')](utils[_0x5b6e('0x14')](),queues[_0x599332[_0x5b6e('0x10')]]['musiconholdstartAt']);delete queues[_0x599332[_0x5b6e('0x10')]][_0x5b6e('0x49')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 5a334fd..ac61995 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 _0x008c=['then','membername','name','UserId','request','CreateVoiceRecording','newchannel','uniqueid','error','newstate','isNil','channelstate','linkedid','transfer','stack','variable','mixmonitor_filename','value','replace','.WAV','monitors','hangup','calleridnum','calleridname','connectedlinename','connectedlinenum','forEach','clone','newexten','application','toLowerCase','set','startsWith','cdr','appdata','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','debug','accountcode'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x008c,0x188));var _0xc008=function(_0x53a356,_0x9da31a){_0x53a356=_0x53a356-0x0;var _0xc2b531=_0x008c[_0x53a356];return _0xc2b531;};'use strict';var _=require(_0xc008('0x0'));var utils=require(_0xc008('0x1'));var recordings={};function writeDB(_0x15aadc){utils[_0xc008('0x2')](_0x15aadc);if(_0x15aadc[_0xc008('0x3')]){utils['getUserByInternal'](_0x15aadc[_0xc008('0x3')])[_0xc008('0x4')](function(_0x10b33c){if(_0x10b33c){_0x15aadc[_0xc008('0x5')]=_0x10b33c[_0xc008('0x6')];_0x15aadc[_0xc008('0x7')]=_0x10b33c['id'];}utils[_0xc008('0x8')](_0xc008('0x9'),_0x15aadc);});}else{utils[_0xc008('0x8')]('CreateVoiceRecording',_0x15aadc);}}exports[_0xc008('0xa')]=function(_0x5aa09b){try{if(_0x5aa09b[_0xc008('0xb')]==_0x5aa09b['linkedid']){recordings[_0x5aa09b['uniqueid']]={'uniqueid':_0x5aa09b[_0xc008('0xb')],'accountcode':_0x5aa09b[_0xc008('0x3')],'exten':_0x5aa09b['exten'],'context':_0x5aa09b['context'],'channel':_0x5aa09b['channel'],'monitors':[]};}}catch(_0x1eacfa){utils[_0xc008('0xc')](_0x1eacfa['stack']);}};exports[_0xc008('0xd')]=function(_0x332fd4){try{if(!_[_0xc008('0xe')](recordings[_0x332fd4[_0xc008('0xb')]])&&_0x332fd4[_0xc008('0xf')]==0x6){}else if(!_[_0xc008('0xe')](recordings[_0x332fd4[_0xc008('0x10')]])&&_0x332fd4['channelstate']==0x6&&_0x332fd4['context']!=_0xc008('0x11')){recordings[_0x332fd4['linkedid']][_0xc008('0x3')]=_0x332fd4[_0xc008('0x3')];}}catch(_0x2073ef){utils[_0xc008('0xc')](_0x2073ef[_0xc008('0x12')]);}};exports['varset']=function(_0x5e894e){try{if(!_['isNil'](_0x5e894e[_0xc008('0x13')])&&!_[_0xc008('0xe')](_0x5e894e[_0xc008('0x13')][_0xc008('0x14')])){if(_['endsWith'](_0x5e894e['value'],'.wav49')){_0x5e894e['value']=_0x5e894e[_0xc008('0x15')][_0xc008('0x16')]('.wav49',_0xc008('0x17'));}if(recordings[_0x5e894e['linkedid']]){var _0x4bd611=_['find'](recordings[_0x5e894e['linkedid']][_0xc008('0x18')],{'value':_0x5e894e['value']});if(_['isNil'](_0x4bd611)){recordings[_0x5e894e['linkedid']]['monitors']['push']({'value':_0x5e894e[_0xc008('0x15')]});}}}}catch(_0x4777a6){utils[_0xc008('0xc')](_0x4777a6[_0xc008('0x12')]);}};exports[_0xc008('0x19')]=function(_0x110128){try{if(!_['isNil'](recordings[_0x110128[_0xc008('0xb')]])){recordings[_0x110128['uniqueid']]['calleridnum']=_0x110128[_0xc008('0x1a')];recordings[_0x110128[_0xc008('0xb')]][_0xc008('0x1b')]=_0x110128[_0xc008('0x1b')];recordings[_0x110128['uniqueid']]['connectedlinenum']=_0x110128['connectedlinenum'];recordings[_0x110128[_0xc008('0xb')]][_0xc008('0x1c')]=_0x110128[_0xc008('0x1c')];if(recordings[_0x110128[_0xc008('0xb')]]['type']=='outbound'&&recordings[_0x110128['uniqueid']]['accountcode']){recordings[_0x110128['uniqueid']][_0xc008('0x1d')]=recordings[_0x110128[_0xc008('0xb')]][_0xc008('0x3')];recordings[_0x110128['uniqueid']][_0xc008('0x1c')]='';}recordings[_0x110128[_0xc008('0xb')]][_0xc008('0x18')][_0xc008('0x1e')](_0x4c5dec=>{var _0xcdb32b=_[_0xc008('0x1f')](recordings[_0x110128['uniqueid']]);_0xcdb32b['value']=_0x4c5dec['value'];writeDB(_0xcdb32b);});delete recordings[_0x110128[_0xc008('0xb')]];}}catch(_0x267abd){utils[_0xc008('0xc')](_0x267abd[_0xc008('0x12')]);}};exports[_0xc008('0x20')]=function(_0xceebc3){try{if(!_[_0xc008('0xe')](recordings[_0xceebc3[_0xc008('0xb')]])){if(_0xceebc3[_0xc008('0x21')][_0xc008('0x22')]()==_0xc008('0x23')&&_[_0xc008('0x24')](_0xceebc3['appdata'][_0xc008('0x22')](),_0xc008('0x25'))){var _0x499754=_0xceebc3[_0xc008('0x26')][_0xc008('0x27')]('=');var _0x383be7=_0x499754[0x0][_0xc008('0x28')](_0x499754[0x0][_0xc008('0x29')]('(')+0x1,_0x499754[0x0][_0xc008('0x29')](')'));var _0x7cfbc5=_0x499754[0x1];recordings[_0xceebc3[_0xc008('0xb')]][_0x383be7]=_0x7cfbc5;}}}catch(_0x29d4b3){utils['error'](_0x29d4b3[_0xc008('0x12')]);}};exports[_0xc008('0x2a')]=function(_0x459df4){try{if(!_[_0xc008('0xe')](recordings[_0x459df4[_0xc008('0xb')]])){recordings[_0x459df4[_0xc008('0xb')]][_0xc008('0x2b')]=_0x459df4['queue'];}}catch(_0x35f360){utils[_0xc008('0xc')](_0x35f360['stack']);}}; \ No newline at end of file +var _0xe706=['CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','isNil','channelstate','stack','varset','variable','value','.WAV','find','monitors','hangup','calleridname','connectedlinenum','connectedlinename','forEach','clone','newexten','application','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','accountcode','getUserByInternal','then','membername','name','UserId','request'];(function(_0x14c9df,_0x3ec1c2){var _0x4c1c85=function(_0x3ef342){while(--_0x3ef342){_0x14c9df['push'](_0x14c9df['shift']());}};_0x4c1c85(++_0x3ec1c2);}(_0xe706,0xa3));var _0x6e70=function(_0xe75d24,_0x54f93b){_0xe75d24=_0xe75d24-0x0;var _0x4d2587=_0xe706[_0xe75d24];return _0x4d2587;};'use strict';var _=require(_0x6e70('0x0'));var utils=require(_0x6e70('0x1'));var recordings={};function writeDB(_0x311951){utils['debug'](_0x311951);if(_0x311951[_0x6e70('0x2')]){utils[_0x6e70('0x3')](_0x311951[_0x6e70('0x2')])[_0x6e70('0x4')](function(_0x142c27){if(_0x142c27){_0x311951[_0x6e70('0x5')]=_0x142c27[_0x6e70('0x6')];_0x311951[_0x6e70('0x7')]=_0x142c27['id'];}utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);});}else{utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);}}exports[_0x6e70('0xa')]=function(_0x188ed3){try{if(_0x188ed3[_0x6e70('0xb')]==_0x188ed3[_0x6e70('0xc')]){recordings[_0x188ed3[_0x6e70('0xb')]]={'uniqueid':_0x188ed3[_0x6e70('0xb')],'accountcode':_0x188ed3[_0x6e70('0x2')],'exten':_0x188ed3[_0x6e70('0xd')],'context':_0x188ed3[_0x6e70('0xe')],'channel':_0x188ed3[_0x6e70('0xf')],'monitors':[]};}}catch(_0x37b3e0){utils[_0x6e70('0x10')](_0x37b3e0['stack']);}};exports['newstate']=function(_0x3594c1){try{if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xb')]])&&_0x3594c1[_0x6e70('0x12')]==0x6){}else if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xc')]])&&_0x3594c1[_0x6e70('0x12')]==0x6&&_0x3594c1[_0x6e70('0xe')]!='transfer'){recordings[_0x3594c1['linkedid']]['accountcode']=_0x3594c1[_0x6e70('0x2')];}}catch(_0x5a37a6){utils['error'](_0x5a37a6[_0x6e70('0x13')]);}};exports[_0x6e70('0x14')]=function(_0x5d9263){try{if(!_[_0x6e70('0x11')](_0x5d9263['variable'])&&!_[_0x6e70('0x11')](_0x5d9263[_0x6e70('0x15')]['mixmonitor_filename'])){if(_['endsWith'](_0x5d9263[_0x6e70('0x16')],'.wav49')){_0x5d9263[_0x6e70('0x16')]=_0x5d9263[_0x6e70('0x16')]['replace']('.wav49',_0x6e70('0x17'));}if(recordings[_0x5d9263[_0x6e70('0xc')]]){var _0x2368eb=_[_0x6e70('0x18')](recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')],{'value':_0x5d9263[_0x6e70('0x16')]});if(_[_0x6e70('0x11')](_0x2368eb)){recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')]['push']({'value':_0x5d9263[_0x6e70('0x16')]});}}}}catch(_0x344b65){utils[_0x6e70('0x10')](_0x344b65['stack']);}};exports[_0x6e70('0x1a')]=function(_0xa5d49){try{if(!_[_0x6e70('0x11')](recordings[_0xa5d49['uniqueid']])){recordings[_0xa5d49[_0x6e70('0xb')]]['calleridnum']=_0xa5d49['calleridnum'];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1b')]=_0xa5d49[_0x6e70('0x1b')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1c')]=_0xa5d49[_0x6e70('0x1c')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1d')]=_0xa5d49[_0x6e70('0x1d')];if(recordings[_0xa5d49[_0x6e70('0xb')]]['type']=='outbound'&&recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x2')]){recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1c')]=recordings[_0xa5d49[_0x6e70('0xb')]]['accountcode'];recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1d')]='';}recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x19')][_0x6e70('0x1e')](_0x20a225=>{var _0x3f78d2=_[_0x6e70('0x1f')](recordings[_0xa5d49[_0x6e70('0xb')]]);_0x3f78d2[_0x6e70('0x16')]=_0x20a225['value'];writeDB(_0x3f78d2);});delete recordings[_0xa5d49[_0x6e70('0xb')]];}}catch(_0x50d60b){utils[_0x6e70('0x10')](_0x50d60b['stack']);}};exports[_0x6e70('0x20')]=function(_0x2722e8){try{if(!_[_0x6e70('0x11')](recordings[_0x2722e8['uniqueid']])){if(_0x2722e8[_0x6e70('0x21')][_0x6e70('0x22')]()=='set'&&_[_0x6e70('0x23')](_0x2722e8[_0x6e70('0x24')]['toLowerCase'](),_0x6e70('0x25'))){var _0x3665a1=_0x2722e8[_0x6e70('0x24')][_0x6e70('0x26')]('=');var _0x3b4a13=_0x3665a1[0x0][_0x6e70('0x27')](_0x3665a1[0x0][_0x6e70('0x28')]('(')+0x1,_0x3665a1[0x0][_0x6e70('0x28')](')'));var _0xf146fd=_0x3665a1[0x1];recordings[_0x2722e8[_0x6e70('0xb')]][_0x3b4a13]=_0xf146fd;}}}catch(_0x4d32d8){utils[_0x6e70('0x10')](_0x4d32d8['stack']);}};exports[_0x6e70('0x29')]=function(_0x3222a2){try{if(!_[_0x6e70('0x11')](recordings[_0x3222a2[_0x6e70('0xb')]])){recordings[_0x3222a2[_0x6e70('0xb')]][_0x6e70('0x2a')]=_0x3222a2[_0x6e70('0x2a')];}}catch(_0xdd0bee){utils[_0x6e70('0x10')](_0xdd0bee[_0x6e70('0x13')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index bf138b7..1b006cc 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 _0x0d4e=['transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','TRANSFER|%s','type','request','blindtransfer','blind','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0d4e[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xe0d4('0x0'));var util=require(_0xe0d4('0x1'));var utils=require(_0xe0d4('0x2'));function writeDB(_0x329c53){utils[_0xe0d4('0x3')](util[_0xe0d4('0x4')](_0xe0d4('0x5'),_0x329c53[_0xe0d4('0x6')]));utils[_0xe0d4('0x7')]('CreateVoiceTransferReport',_0x329c53);}exports[_0xe0d4('0x8')]=function(_0x118831){try{_0x118831[_0xe0d4('0x6')]=_0xe0d4('0x9');writeDB(_0x118831);}catch(_0x54a11f){utils['error'](_0x54a11f[_0xe0d4('0xa')]);}};exports[_0xe0d4('0xb')]=function(_0x151e51){try{_0x151e51=_[_0xe0d4('0xc')](_0x151e51,{'transfererchannel':_0x151e51[_0xe0d4('0xd')],'transferercalleridnum':_0x151e51[_0xe0d4('0xe')],'transferercalleridname':_0x151e51[_0xe0d4('0xf')],'transfererconnectedlinenum':_0x151e51[_0xe0d4('0x10')],'transfererconnectedlinename':_0x151e51[_0xe0d4('0x11')],'transfereraccountcode':_0x151e51[_0xe0d4('0x12')],'transferercontext':_0x151e51[_0xe0d4('0x13')],'transfererexten':_0x151e51[_0xe0d4('0x14')],'transfererlinkedid':_0x151e51[_0xe0d4('0x15')],'context':_0x151e51['origtransferercontext'],'extension':_0x151e51[_0xe0d4('0x16')],'type':_0xe0d4('0x17')});if(_[_0xe0d4('0x18')](_0x151e51[_0xe0d4('0x19')])){_0x151e51=_[_0xe0d4('0xc')](_0x151e51,{'transfereechannel':_0x151e51[_0xe0d4('0x1a')],'transfereecalleridnum':_0x151e51[_0xe0d4('0x1b')],'transfereecalleridname':_0x151e51[_0xe0d4('0x1c')],'transfereeconnectedlinenum':_0x151e51[_0xe0d4('0x1d')],'transfereeconnectedlinename':_0x151e51[_0xe0d4('0x1e')],'transfereeaccountcode':_0x151e51[_0xe0d4('0x1f')],'transfereecontext':_0x151e51[_0xe0d4('0x20')],'transfereeexten':_0x151e51[_0xe0d4('0x21')],'transfereelinkedid':_0x151e51[_0xe0d4('0x22')]});}writeDB(_0x151e51);}catch(_0x3a2a41){utils['error'](_0x3a2a41[_0xe0d4('0xa')]);}}; \ No newline at end of file +var _0x131a=['stack','attendedtransfer','assign','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','origtransferercontext','attended','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','TRANSFER|%s','request','CreateVoiceTransferReport','type','blind','error'];(function(_0xd88cc8,_0x2959d9){var _0x730207=function(_0x5284dc){while(--_0x5284dc){_0xd88cc8['push'](_0xd88cc8['shift']());}};_0x730207(++_0x2959d9);}(_0x131a,0x18b));var _0xa131=function(_0x2b83cd,_0x333d4d){_0x2b83cd=_0x2b83cd-0x0;var _0x345f05=_0x131a[_0x2b83cd];return _0x345f05;};'use strict';var _=require(_0xa131('0x0'));var util=require(_0xa131('0x1'));var utils=require(_0xa131('0x2'));function writeDB(_0x3bc74d){utils[_0xa131('0x3')](util['format'](_0xa131('0x4'),_0x3bc74d['type']));utils[_0xa131('0x5')](_0xa131('0x6'),_0x3bc74d);}exports['blindtransfer']=function(_0x41133b){try{_0x41133b[_0xa131('0x7')]=_0xa131('0x8');writeDB(_0x41133b);}catch(_0x273875){utils[_0xa131('0x9')](_0x273875[_0xa131('0xa')]);}};exports[_0xa131('0xb')]=function(_0x2820d3){try{_0x2820d3=_[_0xa131('0xc')](_0x2820d3,{'transfererchannel':_0x2820d3['origtransfererchannel'],'transferercalleridnum':_0x2820d3[_0xa131('0xd')],'transferercalleridname':_0x2820d3[_0xa131('0xe')],'transfererconnectedlinenum':_0x2820d3['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2820d3[_0xa131('0xf')],'transfereraccountcode':_0x2820d3[_0xa131('0x10')],'transferercontext':_0x2820d3['secondtransferercontext'],'transfererexten':_0x2820d3['secondtransfererexten'],'transfererlinkedid':_0x2820d3['origtransfererlinkedid'],'context':_0x2820d3[_0xa131('0x11')],'extension':_0x2820d3['origtransfererexten'],'type':_0xa131('0x12')});if(_[_0xa131('0x13')](_0x2820d3['transfereechannel'])){_0x2820d3=_[_0xa131('0xc')](_0x2820d3,{'transfereechannel':_0x2820d3[_0xa131('0x14')],'transfereecalleridnum':_0x2820d3['transfertargetcalleridnum'],'transfereecalleridname':_0x2820d3['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2820d3[_0xa131('0x15')],'transfereeconnectedlinename':_0x2820d3[_0xa131('0x16')],'transfereeaccountcode':_0x2820d3[_0xa131('0x17')],'transfereecontext':_0x2820d3[_0xa131('0x18')],'transfereeexten':_0x2820d3[_0xa131('0x19')],'transfereelinkedid':_0x2820d3[_0xa131('0x1a')]});}writeDB(_0x2820d3);}catch(_0x3d3862){utils[_0xa131('0x9')](_0x3d3862[_0xa131('0xa')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index cdb7cfd..444602f 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 _0x00ce=['GetVoiceQueue','type','acw','GETVOICEQUEUEBYNAME|','NOTFOUND','add','seconds','format','subtractTime','diff','sumTime','YYYY-MM-DD\x20HH:mm:ss','isAfter','isBefore','moment','bluebird','client','http','xdr','info','stringify','error','request','then','GetUser','name','interface','GETUSER|','length','FOUND','result','getUserByInternal','stack','getUserByInterface','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x00ce,0x77));var _0xe00c=function(_0x398c3f,_0x3d8771){_0x398c3f=_0x398c3f-0x0;var _0x3bd903=_0x00ce[_0x398c3f];return _0x3bd903;};'use strict';var jayson=require('jayson/promise');var moment=require(_0xe00c('0x0'));var BPromise=require(_0xe00c('0x1'));var client=jayson[_0xe00c('0x2')][_0xe00c('0x3')]({'port':0x2329});var logger=require('../../config/logger')(_0xe00c('0x4'));exports[_0xe00c('0x5')]=function(_0x1f035c){logger[_0xe00c('0x5')](_0x1f035c);};exports['debug']=function(_0x4ad4e4){logger['debug'](JSON[_0xe00c('0x6')](_0x4ad4e4));};exports[_0xe00c('0x7')]=function(_0x1ddf21){logger[_0xe00c('0x7')](_0x1ddf21['stack']);};exports[_0xe00c('0x8')]=function(_0x3b0c00,_0x2c2b88){return client[_0xe00c('0x8')](_0x3b0c00,{'body':_0x2c2b88})[_0xe00c('0x9')](function(_0xa1b64){logger['debug'](JSON['stringify'](_0xa1b64));})['catch'](function(_0x49bdb1){logger[_0xe00c('0x7')](_0x49bdb1['stack']);});};function getUser(_0x185430){return client[_0xe00c('0x8')](_0xe00c('0xa'),{'options':{'raw':!![],'attributes':['id','internal',_0xe00c('0xb'),_0xe00c('0xc')],'where':_0x185430,'limit':0x1}})[_0xe00c('0x9')](function(_0x36b4a8){logger[_0xe00c('0x5')](_0xe00c('0xd')+JSON[_0xe00c('0x6')](_0x185430)+'|'+(_0x36b4a8['result'][_0xe00c('0xe')]?_0xe00c('0xf'):'NOTFOUND'));return _0x36b4a8['result'][_0xe00c('0xe')]?_0x36b4a8[_0xe00c('0x10')][0x0]:null;});}exports[_0xe00c('0x11')]=function(_0x5cf678){return new BPromise(function(_0xc74daf,_0x2bdb91){if(_0x5cf678){return getUser({'internal':_0x5cf678})[_0xe00c('0x9')](function(_0x44e215){return _0xc74daf(_0x44e215);})['catch'](function(_0x2fcfaf){logger[_0xe00c('0x7')](_0x2fcfaf[_0xe00c('0x12')]);return _0xc74daf(null);});}else{return _0xc74daf(null);}});};exports[_0xe00c('0x13')]=function(_0x270b1a){return new BPromise(function(_0x17ea68,_0x1299f2){if(_0x270b1a){return getUser({'interface':_0x270b1a})[_0xe00c('0x9')](function(_0x372a85){return _0x17ea68(_0x372a85);})[_0xe00c('0x14')](function(_0x94a8f2){logger[_0xe00c('0x7')](_0x94a8f2[_0xe00c('0x12')]);return _0x17ea68(null);});}else{return _0x17ea68(null);}});};exports['getUserByName']=function(_0x37f024){return new BPromise(function(_0x26cb9f,_0x86c898){if(_0x37f024){return getUser({'name':_0x37f024})[_0xe00c('0x9')](function(_0x17de8c){return _0x26cb9f(_0x17de8c);})[_0xe00c('0x14')](function(_0xe71fb4){logger[_0xe00c('0x7')](_0xe71fb4[_0xe00c('0x12')]);return _0x26cb9f(null);});}else{return _0x26cb9f(null);}});};exports['getVoiceQueueByName']=function(_0x40f7bb){return new BPromise(function(_0x1edeb1,_0x20303f){if(_0x40f7bb){return client[_0xe00c('0x8')](_0xe00c('0x15'),{'options':{'raw':!![],'attributes':['id',_0xe00c('0xb'),_0xe00c('0x16'),_0xe00c('0x17'),'acwTimeout'],'where':{'name':_0x40f7bb},'limit':0x1}})['then'](function(_0x31c7a2){logger[_0xe00c('0x5')](_0xe00c('0x18')+_0x40f7bb+'|'+(_0x31c7a2['result'][_0xe00c('0xe')]?_0xe00c('0xf'):_0xe00c('0x19')));return _0x1edeb1(_0x31c7a2[_0xe00c('0x10')][_0xe00c('0xe')]?_0x31c7a2['result'][0x0]:null);})[_0xe00c('0x14')](function(_0x3db430){logger['error'](_0x3db430['stack']);return _0x1edeb1(null);});}else{return _0x1edeb1(null);}});};exports['addTime']=function(_0x58ddb3,_0x236a4f){return moment(_0x58ddb3)[_0xe00c('0x1a')](_0x236a4f,_0xe00c('0x1b'))[_0xe00c('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xe00c('0x1d')]=function(_0x180669,_0x1d69bb){return moment(_0x180669)['subtract'](_0x1d69bb,_0xe00c('0x1b'))[_0xe00c('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x5d30dd,_0x1451bb){return moment(_0x5d30dd)[_0xe00c('0x1e')](moment(_0x1451bb),'seconds');};exports[_0xe00c('0x1f')]=function(_0x46bf2e,_0x2de9d0){return parseInt(_0x46bf2e,0xa)+parseInt(_0x2de9d0,0xa);};exports['now']=function(){return moment()[_0xe00c('0x1c')](_0xe00c('0x20'));};exports[_0xe00c('0x21')]=function(_0x4bcb88,_0x2592cd){if(_0x2592cd){return moment(_0x4bcb88)[_0xe00c('0x21')](_0x2592cd);}else{return!![];}};exports[_0xe00c('0x22')]=function(_0x1fb573,_0x2a2309){if(_0x2a2309){return moment(_0x1fb573)[_0xe00c('0x22')](_0x2a2309);}else if(_0x1fb573){return!![];}else{return![];}}; \ No newline at end of file +var _0x6b6f=['getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','GETVOICEQUEUEBYNAME|','FOUND','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtract','diff','now','format','isAfter','isBefore','jayson/promise','moment','bluebird','http','xdr','info','debug','stringify','error','request','catch','stack','GetUser','internal','name','interface','then','GETUSER|','result','length','NOTFOUND','getUserByInternal','getUserByInterface','getUserByName'];(function(_0x49944a,_0x1a3723){var _0x2567fc=function(_0x2aa79e){while(--_0x2aa79e){_0x49944a['push'](_0x49944a['shift']());}};_0x2567fc(++_0x1a3723);}(_0x6b6f,0xd8));var _0xf6b6=function(_0x384900,_0xb6537e){_0x384900=_0x384900-0x0;var _0x30c2a2=_0x6b6f[_0x384900];return _0x30c2a2;};'use strict';var jayson=require(_0xf6b6('0x0'));var moment=require(_0xf6b6('0x1'));var BPromise=require(_0xf6b6('0x2'));var client=jayson['client'][_0xf6b6('0x3')]({'port':0x2329});var logger=require('../../config/logger')(_0xf6b6('0x4'));exports[_0xf6b6('0x5')]=function(_0x1f8b14){logger[_0xf6b6('0x5')](_0x1f8b14);};exports[_0xf6b6('0x6')]=function(_0x23e524){logger[_0xf6b6('0x6')](JSON[_0xf6b6('0x7')](_0x23e524));};exports[_0xf6b6('0x8')]=function(_0x1c4ad1){logger[_0xf6b6('0x8')](_0x1c4ad1['stack']);};exports[_0xf6b6('0x9')]=function(_0x1f93c8,_0x50c0da){return client[_0xf6b6('0x9')](_0x1f93c8,{'body':_0x50c0da})['then'](function(_0x365814){logger[_0xf6b6('0x6')](JSON[_0xf6b6('0x7')](_0x365814));})[_0xf6b6('0xa')](function(_0x333c17){logger[_0xf6b6('0x8')](_0x333c17[_0xf6b6('0xb')]);});};function getUser(_0x34f3c1){return client[_0xf6b6('0x9')](_0xf6b6('0xc'),{'options':{'raw':!![],'attributes':['id',_0xf6b6('0xd'),_0xf6b6('0xe'),_0xf6b6('0xf')],'where':_0x34f3c1,'limit':0x1}})[_0xf6b6('0x10')](function(_0x2e7d37){logger['info'](_0xf6b6('0x11')+JSON[_0xf6b6('0x7')](_0x34f3c1)+'|'+(_0x2e7d37[_0xf6b6('0x12')][_0xf6b6('0x13')]?'FOUND':_0xf6b6('0x14')));return _0x2e7d37[_0xf6b6('0x12')][_0xf6b6('0x13')]?_0x2e7d37[_0xf6b6('0x12')][0x0]:null;});}exports[_0xf6b6('0x15')]=function(_0x1c0abc){return new BPromise(function(_0x19c06b,_0x4cd2f6){if(_0x1c0abc){return getUser({'internal':_0x1c0abc})[_0xf6b6('0x10')](function(_0x3f089b){return _0x19c06b(_0x3f089b);})[_0xf6b6('0xa')](function(_0x2232a6){logger[_0xf6b6('0x8')](_0x2232a6['stack']);return _0x19c06b(null);});}else{return _0x19c06b(null);}});};exports[_0xf6b6('0x16')]=function(_0x386eec){return new BPromise(function(_0x4658b6,_0x3de45a){if(_0x386eec){return getUser({'interface':_0x386eec})[_0xf6b6('0x10')](function(_0x5f3ec9){return _0x4658b6(_0x5f3ec9);})['catch'](function(_0x4fde47){logger[_0xf6b6('0x8')](_0x4fde47['stack']);return _0x4658b6(null);});}else{return _0x4658b6(null);}});};exports[_0xf6b6('0x17')]=function(_0x4490ab){return new BPromise(function(_0xdda185,_0x1a9084){if(_0x4490ab){return getUser({'name':_0x4490ab})[_0xf6b6('0x10')](function(_0x1ea7dc){return _0xdda185(_0x1ea7dc);})[_0xf6b6('0xa')](function(_0xcf4282){logger[_0xf6b6('0x8')](_0xcf4282['stack']);return _0xdda185(null);});}else{return _0xdda185(null);}});};exports[_0xf6b6('0x18')]=function(_0x5376dd){return new BPromise(function(_0x51b6bb,_0x27e481){if(_0x5376dd){return client['request'](_0xf6b6('0x19'),{'options':{'raw':!![],'attributes':['id',_0xf6b6('0xe'),_0xf6b6('0x1a'),'acw',_0xf6b6('0x1b')],'where':{'name':_0x5376dd},'limit':0x1}})[_0xf6b6('0x10')](function(_0x5f6655){logger[_0xf6b6('0x5')](_0xf6b6('0x1c')+_0x5376dd+'|'+(_0x5f6655['result'][_0xf6b6('0x13')]?_0xf6b6('0x1d'):_0xf6b6('0x14')));return _0x51b6bb(_0x5f6655['result']['length']?_0x5f6655[_0xf6b6('0x12')][0x0]:null);})['catch'](function(_0x42b63c){logger['error'](_0x42b63c[_0xf6b6('0xb')]);return _0x51b6bb(null);});}else{return _0x51b6bb(null);}});};exports[_0xf6b6('0x1e')]=function(_0x27f6e3,_0x2542c3){return moment(_0x27f6e3)[_0xf6b6('0x1f')](_0x2542c3,_0xf6b6('0x20'))['format'](_0xf6b6('0x21'));};exports['subtractTime']=function(_0x3104bc,_0x21756c){return moment(_0x3104bc)[_0xf6b6('0x22')](_0x21756c,_0xf6b6('0x20'))['format'](_0xf6b6('0x21'));};exports['diffTime']=function(_0x578489,_0x3cf5fa){return moment(_0x578489)[_0xf6b6('0x23')](moment(_0x3cf5fa),_0xf6b6('0x20'));};exports['sumTime']=function(_0x381b73,_0xb1507){return parseInt(_0x381b73,0xa)+parseInt(_0xb1507,0xa);};exports[_0xf6b6('0x24')]=function(){return moment()[_0xf6b6('0x25')](_0xf6b6('0x21'));};exports['isAfter']=function(_0x9e6800,_0x5ded6d){if(_0x5ded6d){return moment(_0x9e6800)[_0xf6b6('0x26')](_0x5ded6d);}else{return!![];}};exports[_0xf6b6('0x27')]=function(_0x2dc00a,_0x2b0825){if(_0x2b0825){return moment(_0x2dc00a)[_0xf6b6('0x27')](_0x2b0825);}else if(_0x2dc00a){return!![];}else{return![];}}; \ No newline at end of file